From 8e0de4b1a47c3fe6a665eff743f819d20d7c3af8 Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Fri, 4 Jan 2008 09:38:09 +0000 Subject: [PATCH 1/1] experimental branch with no set baseuri command and no developments --- Makefile | 124 + Makefile.defs.in | 18 + components/METAS/meta.helm-acic_content.src | 4 + .../METAS/meta.helm-acic_procedural.src | 4 + components/METAS/meta.helm-cic.src | 5 + components/METAS/meta.helm-cic_acic.src | 4 + .../METAS/meta.helm-cic_disambiguation.src | 4 + .../METAS/meta.helm-cic_exportation.src | 5 + .../METAS/meta.helm-cic_proof_checking.src | 7 + .../METAS/meta.helm-cic_unification.src | 5 + components/METAS/meta.helm-content_pres.src | 4 + components/METAS/meta.helm-extlib.src | 5 + components/METAS/meta.helm-getter.src | 5 + components/METAS/meta.helm-grafite.src | 4 + components/METAS/meta.helm-grafite_engine.src | 5 + components/METAS/meta.helm-grafite_parser.src | 5 + components/METAS/meta.helm-hgdome.src | 4 + components/METAS/meta.helm-hmysql.src | 4 + components/METAS/meta.helm-lexicon.src | 4 + components/METAS/meta.helm-library.src | 5 + components/METAS/meta.helm-logger.src | 5 + components/METAS/meta.helm-metadata.src | 4 + components/METAS/meta.helm-registry.src | 4 + .../METAS/meta.helm-syntax_extensions.src | 7 + components/METAS/meta.helm-tactics.src | 4 + components/METAS/meta.helm-thread.src | 7 + components/METAS/meta.helm-tptp_grafite.src | 5 + components/METAS/meta.helm-urimanager.src | 5 + components/METAS/meta.helm-whelp.src | 4 + components/METAS/meta.helm-xml.src | 5 + components/METAS/meta.helm-xmldiff.src | 4 + components/Makefile | 149 + components/Makefile.common | 149 + components/STATS/clusters.dot | 57 + components/STATS/daemons.dot | 19 + components/STATS/deps.patch | 23 + components/STATS/patch_deps.sh | 53 + components/acic_content/.depend | 27 + components/acic_content/.depend.opt | 27 + components/acic_content/Makefile | 19 + components/acic_content/acic2astMatcher.ml | 98 + components/acic_content/acic2astMatcher.mli | 34 + components/acic_content/acic2content.ml | 1173 +++ components/acic_content/acic2content.mli | 36 + components/acic_content/cicNotationEnv.ml | 153 + components/acic_content/cicNotationEnv.mli | 92 + components/acic_content/cicNotationPp.ml | 352 + components/acic_content/cicNotationPp.mli | 55 + components/acic_content/cicNotationPt.ml | 194 + components/acic_content/cicNotationUtil.ml | 399 + components/acic_content/cicNotationUtil.mli | 91 + components/acic_content/content.ml | 169 + components/acic_content/content.mli | 157 + components/acic_content/content2cic.ml | 270 + components/acic_content/content2cic.mli | 35 + components/acic_content/termAcicContent.ml | 466 ++ components/acic_content/termAcicContent.mli | 70 + components/acic_procedural/.depend | 18 + components/acic_procedural/.depend.opt | 18 + components/acic_procedural/Makefile | 17 + components/acic_procedural/acic2Procedural.ml | 455 ++ .../acic_procedural/acic2Procedural.mli | 34 + .../acic_procedural/proceduralClassify.ml | 113 + .../acic_procedural/proceduralClassify.mli | 32 + .../acic_procedural/proceduralConversion.ml | 251 + .../acic_procedural/proceduralConversion.mli | 43 + .../acic_procedural/proceduralHelpers.ml | 264 + .../acic_procedural/proceduralHelpers.mli | 61 + components/acic_procedural/proceduralMode.ml | 57 + components/acic_procedural/proceduralMode.mli | 29 + .../acic_procedural/proceduralOptimizer.ml | 277 + .../acic_procedural/proceduralOptimizer.mli | 26 + components/acic_procedural/proceduralTypes.ml | 244 + .../acic_procedural/proceduralTypes.mli | 71 + components/binaries/Makefile | 18 + components/binaries/dump_db/dump.sh | 20 + components/binaries/extractor/.depend | 0 components/binaries/extractor/.depend.opt | 0 components/binaries/extractor/Makefile | 55 + .../binaries/extractor/extractor.conf.xml | 18 + components/binaries/extractor/extractor.ml | 75 + .../binaries/extractor/extractor_manager.ml | 295 + components/binaries/heights/.depend | 0 components/binaries/heights/.depend.opt | 0 components/binaries/heights/Makefile | 104 + components/binaries/heights/heights.conf.xml | 7 + components/binaries/heights/heights.ml | 48 + components/binaries/saturate/Makefile | 33 + components/binaries/saturate/saturate_main.ml | 166 + components/binaries/table_creator/.depend | 0 components/binaries/table_creator/.depend.opt | 0 components/binaries/table_creator/Makefile | 56 + components/binaries/table_creator/sync_db.sh | 28 + .../binaries/table_creator/table_creator.ml | 87 + components/binaries/transcript/.depend | 12 + components/binaries/transcript/.depend.opt | 12 + components/binaries/transcript/CoRN.conf.xml | 15 + components/binaries/transcript/Makefile | 106 + components/binaries/transcript/engine.ml | 218 + components/binaries/transcript/engine.mli | 32 + components/binaries/transcript/grafite.ml | 113 + components/binaries/transcript/grafite.mli | 28 + components/binaries/transcript/top.ml | 31 + .../binaries/transcript/transcript.conf.xml | 8 + components/binaries/transcript/types.ml | 47 + components/binaries/transcript/v8Lexer.mll | 72 + components/binaries/transcript/v8Parser.mly | 344 + components/binaries/utilities/.depend | 0 components/binaries/utilities/.depend.opt | 0 components/binaries/utilities/Makefile | 41 + .../binaries/utilities/create_environment.ml | 73 + components/binaries/utilities/list_uris.ml | 30 + .../binaries/utilities/parse_library.ml | 54 + components/binaries/utilities/test_library.ml | 153 + .../binaries/utilities/test_xml_parser.ml | 88 + components/cic/.depend | 31 + components/cic/.depend.opt | 31 + components/cic/Makefile | 21 + components/cic/cic.ml | 244 + components/cic/cicInspect.ml | 143 + components/cic/cicInspect.mli | 35 + components/cic/cicParser.ml | 797 ++ components/cic/cicParser.mli | 46 + components/cic/cicUniv.ml | 1011 +++ components/cic/cicUniv.mli | 157 + components/cic/cicUtil.ml | 595 ++ components/cic/cicUtil.mli | 73 + components/cic/deannotate.ml | 128 + components/cic/deannotate.mli | 37 + components/cic/discrimination_tree.ml | 305 + components/cic/discrimination_tree.mli | 40 + components/cic/helmLibraryObjects.ml | 230 + components/cic/helmLibraryObjects.mli | 182 + components/cic/libraryObjects.ml | 225 + components/cic/libraryObjects.mli | 69 + components/cic/path_indexing.ml | 227 + components/cic/path_indexing.mli | 42 + components/cic/unshare.ml | 84 + components/cic/unshare.mli | 26 + components/cic_acic/.depend | 9 + components/cic_acic/.depend.opt | 9 + components/cic_acic/Makefile | 13 + components/cic_acic/cic2Xml.ml | 493 ++ components/cic_acic/cic2Xml.mli | 47 + components/cic_acic/cic2acic.ml | 774 ++ components/cic_acic/cic2acic.mli | 61 + components/cic_acic/doubleTypeInference.ml | 676 ++ components/cic_acic/doubleTypeInference.mli | 21 + components/cic_acic/eta_fixing.ml | 310 + components/cic_acic/eta_fixing.mli | 28 + components/cic_disambiguation/.depend | 12 + components/cic_disambiguation/.depend.opt | 12 + components/cic_disambiguation/Makefile | 32 + .../cic_disambiguation/disambiguate.crit2.ml | 1317 ++++ .../cic_disambiguation/disambiguate.crit4.ml | 1294 ++++ components/cic_disambiguation/disambiguate.ml | 1302 ++++ .../cic_disambiguation/disambiguate.mli | 84 + .../cic_disambiguation/disambiguateChoices.ml | 82 + .../disambiguateChoices.mli | 53 + .../cic_disambiguation/disambiguateTypes.ml | 130 + .../cic_disambiguation/disambiguateTypes.mli | 97 + .../cic_disambiguation/doc/precedence.txt | 32 + .../cic_disambiguation/number_notation.ml | 58 + .../cic_disambiguation/tests/aliases.txt | 6 + components/cic_disambiguation/tests/eq.txt | 1 + components/cic_disambiguation/tests/match.txt | 49 + components/cic_exportation/.depend | 2 + components/cic_exportation/.depend.opt | 2 + components/cic_exportation/Makefile | 14 + components/cic_exportation/cicExportation.ml | 596 ++ components/cic_exportation/cicExportation.mli | 29 + components/cic_proof_checking/.depend | 24 + components/cic_proof_checking/.depend.opt | 24 + components/cic_proof_checking/Makefile | 27 + .../cic_proof_checking/cicEnvironment.ml | 548 ++ .../cic_proof_checking/cicEnvironment.mli | 136 + components/cic_proof_checking/cicLogger.ml | 62 + components/cic_proof_checking/cicLogger.mli | 42 + .../cic_proof_checking/cicMiniReduction.ml | 76 + .../cic_proof_checking/cicMiniReduction.mli | 26 + components/cic_proof_checking/cicPp.ml | 535 ++ components/cic_proof_checking/cicPp.mli | 55 + components/cic_proof_checking/cicReduction.ml | 1255 ++++ .../cic_proof_checking/cicReduction.mli | 44 + .../cic_proof_checking/cicSubstitution.ml | 439 ++ .../cic_proof_checking/cicSubstitution.mli | 59 + .../cic_proof_checking/cicTypeChecker.ml | 2278 ++++++ .../cic_proof_checking/cicTypeChecker.mli | 61 + components/cic_proof_checking/cicUnivUtils.ml | 153 + .../cic_proof_checking/cicUnivUtils.mli | 32 + .../cic_proof_checking/doc/inductive.txt | 41 + .../cic_proof_checking/freshNamesGenerator.ml | 365 + .../freshNamesGenerator.mli | 46 + components/cic_unification/.depend | 16 + components/cic_unification/.depend.opt | 16 + components/cic_unification/Makefile | 16 + components/cic_unification/cicMetaSubst.ml | 938 +++ components/cic_unification/cicMetaSubst.mli | 99 + components/cic_unification/cicMkImplicit.ml | 122 + components/cic_unification/cicMkImplicit.mli | 60 + components/cic_unification/cicRefine.ml | 2139 ++++++ components/cic_unification/cicRefine.mli | 51 + components/cic_unification/cicReplace.ml | 129 + components/cic_unification/cicReplace.mli | 34 + components/cic_unification/cicUnification.ml | 900 +++ components/cic_unification/cicUnification.mli | 58 + components/cic_unification/coercGraph.ml | 278 + components/cic_unification/coercGraph.mli | 65 + components/cic_unification/termUtil.ml | 89 + components/cic_unification/termUtil.mli | 37 + components/content_pres/.depend | 36 + components/content_pres/.depend.opt | 36 + components/content_pres/Makefile | 61 + components/content_pres/box.ml | 153 + components/content_pres/box.mli | 79 + components/content_pres/boxPp.ml | 246 + components/content_pres/boxPp.mli | 43 + components/content_pres/cicNotationLexer.ml | 351 + components/content_pres/cicNotationLexer.mli | 48 + components/content_pres/cicNotationParser.ml | 661 ++ components/content_pres/cicNotationParser.mli | 71 + components/content_pres/cicNotationPres.ml | 451 ++ components/content_pres/cicNotationPres.mli | 54 + components/content_pres/content2pres.ml | 967 +++ components/content_pres/content2pres.mli | 40 + .../content_pres/content2presMatcher.ml | 233 + .../content_pres/content2presMatcher.mli | 34 + components/content_pres/mpresentation.ml | 258 + components/content_pres/mpresentation.mli | 86 + components/content_pres/renderingAttrs.ml | 54 + components/content_pres/renderingAttrs.mli | 57 + components/content_pres/sequent2pres.ml | 107 + components/content_pres/sequent2pres.mli | 38 + components/content_pres/termContentPres.ml | 674 ++ components/content_pres/termContentPres.mli | 52 + components/content_pres/test_lexer.ml | 63 + components/extlib/.depend | 18 + components/extlib/.depend.opt | 18 + components/extlib/Makefile | 21 + components/extlib/componentsConf.ml.in | 29 + components/extlib/componentsConf.mli | 37 + components/extlib/graphvizPp.ml | 78 + components/extlib/graphvizPp.mli | 55 + components/extlib/hExtlib.ml | 456 ++ components/extlib/hExtlib.mli | 121 + components/extlib/hLog.ml | 64 + components/extlib/hLog.mli | 36 + components/extlib/hMarshal.ml | 73 + components/extlib/hMarshal.mli | 59 + components/extlib/hTopoSort.ml | 69 + components/extlib/hTopoSort.mli | 32 + components/extlib/patternMatcher.ml | 191 + components/extlib/patternMatcher.mli | 62 + components/extlib/refCounter.ml | 49 + components/extlib/refCounter.mli | 31 + components/extlib/trie.ml | 153 + components/extlib/trie.mli | 43 + components/getter/.depend | 31 + components/getter/.depend.opt | 31 + components/getter/.ocamlinit | 3 + components/getter/Makefile | 21 + components/getter/http_getter.ml | 387 + components/getter/http_getter.mli | 71 + components/getter/http_getter_common.ml | 167 + components/getter/http_getter_common.mli | 70 + components/getter/http_getter_const.ml | 102 + components/getter/http_getter_const.mli | 39 + components/getter/http_getter_env.ml | 123 + components/getter/http_getter_env.mli | 54 + components/getter/http_getter_logger.ml | 63 + components/getter/http_getter_logger.mli | 49 + components/getter/http_getter_misc.ml | 315 + components/getter/http_getter_misc.mli | 102 + components/getter/http_getter_storage.ml | 447 ++ components/getter/http_getter_storage.mli | 75 + components/getter/http_getter_types.ml | 72 + components/getter/http_getter_wget.ml | 70 + components/getter/http_getter_wget.mli | 35 + components/getter/mkindexes.pl | 40 + components/getter/sample.conf.xml | 50 + components/getter/test.ml | 12 + components/grafite/.depend | 6 + components/grafite/.depend.opt | 6 + components/grafite/Makefile | 14 + components/grafite/grafiteAst.ml | 187 + components/grafite/grafiteAstPp.ml | 335 + components/grafite/grafiteAstPp.mli | 84 + components/grafite/grafiteMarshal.ml | 63 + components/grafite/grafiteMarshal.mli | 33 + components/grafite_engine/.depend | 8 + components/grafite_engine/.depend.opt | 8 + components/grafite_engine/Makefile | 12 + components/grafite_engine/grafiteEngine.ml | 847 +++ components/grafite_engine/grafiteEngine.mli | 59 + components/grafite_engine/grafiteSync.ml | 148 + components/grafite_engine/grafiteSync.mli | 43 + components/grafite_engine/grafiteTypes.ml | 198 + components/grafite_engine/grafiteTypes.mli | 80 + components/grafite_parser/.depend | 13 + components/grafite_parser/.depend.opt | 13 + components/grafite_parser/Makefile | 48 + components/grafite_parser/cicNotation2.ml | 49 + components/grafite_parser/cicNotation2.mli | 35 + .../grafite_parser/dependenciesParser.ml | 79 + .../grafite_parser/dependenciesParser.mli | 37 + .../grafite_parser/grafiteDisambiguate.ml | 499 ++ .../grafite_parser/grafiteDisambiguate.mli | 56 + .../grafite_parser/grafiteDisambiguator.ml | 224 + .../grafite_parser/grafiteDisambiguator.mli | 60 + components/grafite_parser/grafiteParser.ml | 730 ++ components/grafite_parser/grafiteParser.mli | 46 + components/grafite_parser/grafiteWalker.ml | 77 + components/grafite_parser/grafiteWalker.mli | 48 + components/grafite_parser/print_grammar.ml | 291 + components/grafite_parser/test_dep.ml | 40 + components/grafite_parser/test_parser.ml | 135 + components/hbugs/.depend | 20 + components/hbugs/Makefile | 98 + components/hbugs/broker.ml | 293 + components/hbugs/client.ml | 46 + components/hbugs/data/hbugs_tutor.TPL.ml | 42 + components/hbugs/data/tutors_index.xml | 140 + components/hbugs/doc/hbugs.dia | Bin 0 -> 1927 bytes components/hbugs/hbugs_broker_registry.ml | 317 + components/hbugs/hbugs_broker_registry.mli | 87 + components/hbugs/hbugs_client.ml | 526 ++ components/hbugs/hbugs_client.mli | 33 + components/hbugs/hbugs_client_gui.glade | 672 ++ components/hbugs/hbugs_common.ml | 48 + components/hbugs/hbugs_common.mli | 32 + components/hbugs/hbugs_id_generator.ml | 67 + components/hbugs/hbugs_id_generator.mli | 35 + components/hbugs/hbugs_messages.ml | 368 + components/hbugs/hbugs_messages.mli | 49 + components/hbugs/hbugs_misc.ml | 122 + components/hbugs/hbugs_misc.mli | 50 + components/hbugs/hbugs_tutors.ml | 266 + components/hbugs/hbugs_tutors.mli | 60 + components/hbugs/hbugs_types.mli | 104 + components/hbugs/scripts/brokerctl.sh | 15 + components/hbugs/scripts/build_tutors.ml | 112 + components/hbugs/scripts/ls_tutors.ml | 68 + components/hbugs/scripts/sabba.sh | 47 + .../hbugs/search_pattern_apply_tutor.ml | 147 + components/hbugs/test/HBUGS_MESSAGES.xml | 144 + components/hbugs/test/Makefile | 5 + components/hbugs/test/test_serialization.ml | 70 + components/hgdome/.depend | 4 + components/hgdome/.depend.opt | 4 + components/hgdome/Makefile | 12 + components/hgdome/domMisc.ml | 43 + components/hgdome/domMisc.mli | 42 + components/hgdome/xml2Gdome.ml | 135 + components/hgdome/xml2Gdome.mli | 27 + components/hmysql/.depend | 2 + components/hmysql/.depend.opt | 2 + components/hmysql/Makefile | 14 + components/hmysql/hMysql.ml | 92 + components/hmysql/hSql.ml | 175 + components/hmysql/hSql.mli | 70 + components/hmysql/hSqlite3.ml | 232 + components/lexicon/.depend | 20 + components/lexicon/.depend.opt | 20 + components/lexicon/Makefile | 18 + components/lexicon/cicNotation.ml | 98 + components/lexicon/cicNotation.mli | 40 + components/lexicon/disambiguatePp.ml | 53 + components/lexicon/disambiguatePp.mli | 30 + components/lexicon/lexiconAst.ml | 57 + components/lexicon/lexiconAstPp.ml | 90 + components/lexicon/lexiconAstPp.mli | 29 + components/lexicon/lexiconEngine.ml | 140 + components/lexicon/lexiconEngine.mli | 45 + components/lexicon/lexiconMarshal.ml | 67 + components/lexicon/lexiconMarshal.mli | 32 + components/lexicon/lexiconSync.ml | 111 + components/lexicon/lexiconSync.mli | 39 + components/library/.depend | 24 + components/library/.depend.opt | 22 + components/library/Makefile | 20 + components/library/cicCoercion.ml | 39 + components/library/cicCoercion.mli | 40 + components/library/cicElim.ml | 422 ++ components/library/cicElim.mli | 41 + components/library/cicRecord.ml | 88 + components/library/cicRecord.mli | 28 + components/library/coercDb.ml | 192 + components/library/coercDb.mli | 68 + components/library/libraryClean.ml | 266 + components/library/libraryClean.mli | 27 + components/library/libraryDb.ml | 212 + components/library/libraryDb.mli | 35 + components/library/libraryMisc.ml | 38 + components/library/libraryMisc.mli | 30 + components/library/librarySync.ml | 533 ++ components/library/librarySync.mli | 62 + components/library/refinementTool.ml | 41 + components/license | 22 + components/logger/.depend | 2 + components/logger/.depend.opt | 2 + components/logger/Makefile | 10 + components/logger/helmLogger.ml | 62 + components/logger/helmLogger.mli | 27 + components/metadata/.depend | 23 + components/metadata/.depend.opt | 23 + components/metadata/Makefile | 18 + components/metadata/metadataConstraints.ml | 693 ++ components/metadata/metadataConstraints.mli | 112 + components/metadata/metadataDb.ml | 224 + components/metadata/metadataDb.mli | 41 + components/metadata/metadataDeps.ml | 305 + components/metadata/metadataDeps.mli | 62 + components/metadata/metadataExtractor.ml | 350 + components/metadata/metadataExtractor.mli | 42 + components/metadata/metadataPp.ml | 117 + components/metadata/metadataPp.mli | 49 + components/metadata/metadataTypes.ml | 115 + components/metadata/metadataTypes.mli | 86 + components/metadata/sqlStatements.ml | 221 + components/metadata/sqlStatements.mli | 59 + components/registry/.depend | 2 + components/registry/.depend.opt | 2 + components/registry/.ocamlinit | 4 + components/registry/Makefile | 8 + components/registry/helm_registry.ml | 432 ++ components/registry/helm_registry.mli | 200 + components/registry/test.ml | 32 + components/registry/tests/sample.xml | 34 + components/registry/tests/sample_include.xml | 15 + components/syntax_extensions/.depend | 2 + components/syntax_extensions/.depend.opt | 2 + components/syntax_extensions/Makefile | 51 + components/syntax_extensions/README.syntax | 15 + .../syntax_extensions/data/dictionary-tex.xml | 378 + .../syntax_extensions/data/entities-table.xml | 2079 ++++++ .../syntax_extensions/data/extra-entities.xml | 16 + components/syntax_extensions/make_table.ml | 107 + .../syntax_extensions/pa_unicode_macro.ml | 61 + .../syntax_extensions/profiling_macros.ml | 82 + components/syntax_extensions/test.ml | 3 + components/syntax_extensions/utf8Macro.ml | 50 + components/syntax_extensions/utf8Macro.mli | 39 + .../syntax_extensions/utf8MacroTable.ml | 2140 ++++++ .../syntax_extensions/utf8MacroTable.ml.txt | 2131 ++++++ components/tactics/.depend | 210 + components/tactics/.depend.opt | 210 + components/tactics/Makefile | 61 + components/tactics/auto.ml | 1839 +++++ components/tactics/auto.mli | 72 + components/tactics/autoCache.ml | 151 + components/tactics/autoCache.mli | 45 + components/tactics/autoTypes.ml | 61 + components/tactics/autoTypes.mli | 49 + components/tactics/closeCoercionGraph.ml | 497 ++ components/tactics/closeCoercionGraph.mli | 40 + components/tactics/compose.ml | 195 + components/tactics/compose.mli | 30 + components/tactics/continuationals.ml | 365 + components/tactics/continuationals.mli | 125 + components/tactics/declarative.ml | 308 + components/tactics/declarative.mli | 61 + components/tactics/destructTactic.ml | 592 ++ components/tactics/destructTactic.mli | 30 + components/tactics/doc/Makefile | 124 + components/tactics/doc/body.tex | 474 ++ components/tactics/doc/infernce.sty | 217 + components/tactics/doc/ligature.sty | 169 + components/tactics/doc/main.tex | 70 + components/tactics/doc/reserved.sty | 80 + components/tactics/doc/semantic.sty | 137 + components/tactics/doc/shrthand.sty | 96 + components/tactics/doc/tdiagram.sty | 166 + components/tactics/eliminationTactics.ml | 170 + components/tactics/eliminationTactics.mli | 33 + components/tactics/equalityTactics.ml | 380 + components/tactics/equalityTactics.mli | 42 + components/tactics/fourier.ml | 244 + components/tactics/fourier.mli | 27 + components/tactics/fourierR.ml | 1201 +++ components/tactics/fourierR.mli | 5 + components/tactics/fwdSimplTactic.ml | 173 + components/tactics/fwdSimplTactic.mli | 33 + components/tactics/hashtbl_equiv.ml | 190 + components/tactics/hashtbl_equiv.mli | 38 + components/tactics/history.ml | 86 + components/tactics/history.mli | 35 + components/tactics/introductionTactics.ml | 49 + components/tactics/introductionTactics.mli | 31 + components/tactics/inversion.ml | 361 + components/tactics/inversion.mli | 29 + components/tactics/inversion_principle.ml | 231 + components/tactics/inversion_principle.mli | 1 + components/tactics/metadataQuery.ml | 524 ++ components/tactics/metadataQuery.mli | 71 + components/tactics/negationTactics.ml | 97 + components/tactics/negationTactics.mli | 28 + components/tactics/paramodulation/.depend | 0 components/tactics/paramodulation/Makefile | 6 + components/tactics/paramodulation/README | 45 + components/tactics/paramodulation/equality.ml | 1363 ++++ .../tactics/paramodulation/equality.mli | 147 + .../paramodulation/equality_indexing.ml | 129 + .../paramodulation/equality_indexing.mli | 41 + components/tactics/paramodulation/founif.ml | 199 + components/tactics/paramodulation/founif.mli | 45 + components/tactics/paramodulation/indexing.ml | 1213 +++ .../tactics/paramodulation/indexing.mli | 112 + .../tactics/paramodulation/saturation.ml | 1665 +++++ .../tactics/paramodulation/saturation.mli | 73 + components/tactics/paramodulation/subst.ml | 217 + components/tactics/paramodulation/subst.mli | 43 + .../tactics/paramodulation/test_indexing.ml | 253 + components/tactics/paramodulation/utils.ml | 772 ++ components/tactics/paramodulation/utils.mli | 89 + components/tactics/primitiveTactics.ml | 894 +++ components/tactics/primitiveTactics.mli | 99 + components/tactics/proofEngineHelpers.ml | 708 ++ components/tactics/proofEngineHelpers.mli | 130 + components/tactics/proofEngineReduction.ml | 1136 +++ components/tactics/proofEngineReduction.mli | 74 + .../tactics/proofEngineStructuralRules.ml | 196 + .../tactics/proofEngineStructuralRules.mli | 31 + components/tactics/proofEngineTypes.ml | 111 + components/tactics/proofEngineTypes.mli | 78 + components/tactics/reductionTactics.ml | 238 + components/tactics/reductionTactics.mli | 49 + components/tactics/ring.ml | 594 ++ components/tactics/ring.mli | 12 + components/tactics/setoids.ml | 1904 +++++ components/tactics/setoids.mli | 70 + components/tactics/statefulProofEngine.ml | 216 + components/tactics/statefulProofEngine.mli | 123 + components/tactics/tacticChaser.ml | 259 + components/tactics/tacticals.ml | 305 + components/tactics/tacticals.mli | 48 + components/tactics/tactics.ml | 77 + components/tactics/tactics.mli | 110 + components/tactics/universe.ml | 167 + components/tactics/universe.mli | 45 + components/tactics/variousTactics.ml | 191 + components/tactics/variousTactics.mli | 35 + components/thread/.depend | 4 + components/thread/.depend.opt | 4 + components/thread/Makefile | 31 + components/thread/extThread.ml | 110 + components/thread/extThread.mli | 35 + components/thread/fake/threadSafe.ml | 35 + components/thread/fake/threadSafe.mli | 44 + components/thread/threadSafe.ml | 100 + components/thread/threadSafe.mli | 44 + components/tptp_grafite/.depend | 7 + components/tptp_grafite/.depend.opt | 7 + components/tptp_grafite/Makefile | 50 + components/tptp_grafite/ast.ml | 31 + components/tptp_grafite/heq_problems | 142 + components/tptp_grafite/hne_problems | 90 + components/tptp_grafite/lexer.mll | 57 + components/tptp_grafite/main.ml | 22 + components/tptp_grafite/parser.mly | 150 + components/tptp_grafite/tptp2grafite.ml | 383 + components/tptp_grafite/tptp2grafite.mli | 31 + .../tptp_grafite/unit_equality_problems | 860 +++ components/urimanager/.depend | 2 + components/urimanager/.depend.opt | 2 + components/urimanager/Makefile | 10 + components/urimanager/uriManager.ml | 245 + components/urimanager/uriManager.mli | 73 + components/whelp/.depend | 4 + components/whelp/.depend.opt | 4 + components/whelp/Makefile | 11 + components/whelp/fwdQueries.ml | 115 + components/whelp/fwdQueries.mli | 28 + components/whelp/whelp.ml | 232 + components/whelp/whelp.mli | 30 + components/xml/.depend | 4 + components/xml/.depend.opt | 4 + components/xml/Makefile | 12 + components/xml/test.ml | 60 + components/xml/xml.ml | 181 + components/xml/xml.mli | 75 + components/xml/xmlPushParser.ml | 118 + components/xml/xmlPushParser.mli | 78 + components/xmldiff/.depend | 2 + components/xmldiff/.depend.opt | 2 + components/xmldiff/Makefile | 10 + components/xmldiff/xmlDiff.ml | 345 + components/xmldiff/xmlDiff.mli | 30 + configure.ac | 194 + make/main.ml | 34 + make/make.ml | 103 + make/make.mli | 18 + make/test/a.c | 0 make/test/b.c | 0 make/test/c.c | 0 make/test/d.c | 0 make/test/e.c | 0 matita/.depend | 87 + matita/.depend.opt | 85 + matita/.ocamlinit | 45 + matita/AUTHORS | 6 + matita/LICENSE | 24 + matita/Makefile | 468 ++ matita/applyTransformation.ml | 224 + matita/applyTransformation.mli | 79 + matita/bench_disamberrors | 90 + matita/bench_summary.py | 75 + matita/buildTimeConf.ml.in | 59 + matita/closed.xml | 17 + matita/contribs/CoRN-Decl/CoRN.ma | 733 ++ matita/contribs/CoRN-Decl/algebra/Basics.ma | 314 + .../contribs/CoRN-Decl/algebra/CAbGroups.ma | 304 + .../contribs/CoRN-Decl/algebra/CAbMonoids.ma | 99 + matita/contribs/CoRN-Decl/algebra/CFields.ma | 585 ++ matita/contribs/CoRN-Decl/algebra/CGroups.ma | 407 ++ matita/contribs/CoRN-Decl/algebra/CLogic.ma | 623 ++ matita/contribs/CoRN-Decl/algebra/CMonoids.ma | 175 + matita/contribs/CoRN-Decl/algebra/COrdAbs.ma | 160 + .../contribs/CoRN-Decl/algebra/COrdCauchy.ma | 284 + .../contribs/CoRN-Decl/algebra/COrdFields.ma | 743 ++ .../contribs/CoRN-Decl/algebra/COrdFields2.ma | 372 + .../CoRN-Decl/algebra/CPoly_ApZero.ma | 194 + .../CoRN-Decl/algebra/CPoly_Degree.ma | 246 + .../CoRN-Decl/algebra/CPoly_NthCoeff.ma | 212 + .../CoRN-Decl/algebra/CPolynomials.ma | 643 ++ matita/contribs/CoRN-Decl/algebra/CRings.ma | 1013 +++ .../contribs/CoRN-Decl/algebra/CSemiGroups.ma | 199 + .../contribs/CoRN-Decl/algebra/CSetoidFun.ma | 619 ++ .../contribs/CoRN-Decl/algebra/CSetoidInc.ma | 108 + matita/contribs/CoRN-Decl/algebra/CSetoids.ma | 974 +++ matita/contribs/CoRN-Decl/algebra/CSums.ma | 244 + .../CoRN-Decl/algebra/CVectorSpace.ma | 128 + .../contribs/CoRN-Decl/algebra/Cauchy_COF.ma | 244 + matita/contribs/CoRN-Decl/algebra/Expon.ma | 288 + matita/contribs/CoRN-Decl/algebra/ListType.ma | 245 + matita/contribs/CoRN-Decl/complex/AbsCC.ma | 169 + matita/contribs/CoRN-Decl/complex/CComplex.ma | 387 + .../CoRN-Decl/complex/Complex_Exponential.ma | 104 + matita/contribs/CoRN-Decl/complex/NRootCC.ma | 576 ++ .../contribs/CoRN-Decl/devel/loeb/IDA/Ch6.ma | 627 ++ .../CoRN-Decl/devel/loeb/per/csetfun.ma | 134 + .../CoRN-Decl/devel/loeb/per/lst2fun.ma | 52 + matita/contribs/CoRN-Decl/fta/CC_Props.ma | 101 + .../contribs/CoRN-Decl/fta/CPoly_Contin1.ma | 60 + matita/contribs/CoRN-Decl/fta/CPoly_Rev.ma | 179 + matita/contribs/CoRN-Decl/fta/CPoly_Shift.ma | 64 + matita/contribs/CoRN-Decl/fta/FTA.ma | 97 + matita/contribs/CoRN-Decl/fta/FTAreg.ma | 219 + matita/contribs/CoRN-Decl/fta/KeyLemma.ma | 167 + matita/contribs/CoRN-Decl/fta/KneserLemma.ma | 145 + matita/contribs/CoRN-Decl/fta/MainLemma.ma | 128 + matita/contribs/CoRN-Decl/ftc/COrdLemmas.ma | 123 + .../CoRN-Decl/ftc/CalculusTheorems.ma | 123 + matita/contribs/CoRN-Decl/ftc/Composition.ma | 403 + matita/contribs/CoRN-Decl/ftc/Continuity.ma | 407 ++ matita/contribs/CoRN-Decl/ftc/Derivative.ma | 180 + .../contribs/CoRN-Decl/ftc/DerivativeOps.ma | 235 + .../CoRN-Decl/ftc/Differentiability.ma | 275 + matita/contribs/CoRN-Decl/ftc/FTC.ma | 373 + .../contribs/CoRN-Decl/ftc/FunctSequence.ma | 506 ++ matita/contribs/CoRN-Decl/ftc/FunctSeries.ma | 366 + matita/contribs/CoRN-Decl/ftc/FunctSums.ma | 165 + matita/contribs/CoRN-Decl/ftc/Integral.ma | 496 ++ .../contribs/CoRN-Decl/ftc/IntervalFunct.ma | 270 + .../contribs/CoRN-Decl/ftc/MoreFunSeries.ma | 571 ++ .../contribs/CoRN-Decl/ftc/MoreFunctions.ma | 650 ++ .../contribs/CoRN-Decl/ftc/MoreIntegrals.ma | 302 + .../contribs/CoRN-Decl/ftc/MoreIntervals.ma | 460 ++ .../contribs/CoRN-Decl/ftc/NthDerivative.ma | 302 + .../contribs/CoRN-Decl/ftc/PartFunEquality.ma | 417 ++ matita/contribs/CoRN-Decl/ftc/PartInterval.ma | 195 + matita/contribs/CoRN-Decl/ftc/Partitions.ma | 488 ++ matita/contribs/CoRN-Decl/ftc/RefLemma.ma | 567 ++ matita/contribs/CoRN-Decl/ftc/RefSepRef.ma | 148 + matita/contribs/CoRN-Decl/ftc/RefSeparated.ma | 181 + .../contribs/CoRN-Decl/ftc/RefSeparating.ma | 185 + matita/contribs/CoRN-Decl/ftc/Rolle.ma | 286 + matita/contribs/CoRN-Decl/ftc/StrongIVT.ma | 164 + matita/contribs/CoRN-Decl/ftc/Taylor.ma | 156 + matita/contribs/CoRN-Decl/ftc/TaylorLemma.ma | 330 + matita/contribs/CoRN-Decl/ftc/WeakIVT.ma | 237 + matita/contribs/CoRN-Decl/makefile | 39 + .../CoRN-Decl/metrics/CMetricSpaces.ma | 205 + .../contribs/CoRN-Decl/metrics/CPMSTheory.ma | 228 + .../CoRN-Decl/metrics/CPseudoMSpaces.ma | 192 + .../CoRN-Decl/metrics/ContFunctions.ma | 248 + matita/contribs/CoRN-Decl/metrics/Equiv.ma | 66 + .../contribs/CoRN-Decl/metrics/IR_CPMSpace.ma | 105 + matita/contribs/CoRN-Decl/metrics/Prod_Sub.ma | 131 + .../CoRN-Decl/model/abgroups/QSposabgroup.ma | 34 + .../CoRN-Decl/model/abgroups/Qabgroup.ma | 37 + .../CoRN-Decl/model/abgroups/Qposabgroup.ma | 34 + .../CoRN-Decl/model/abgroups/Zabgroup.ma | 35 + .../contribs/CoRN-Decl/model/fields/Qfield.ma | 35 + .../CoRN-Decl/model/groups/QSposgroup.ma | 35 + .../contribs/CoRN-Decl/model/groups/Qgroup.ma | 34 + .../CoRN-Decl/model/groups/Qposgroup.ma | 34 + .../contribs/CoRN-Decl/model/groups/Zgroup.ma | 35 + .../CoRN-Decl/model/monoids/Nmonoid.ma | 42 + .../CoRN-Decl/model/monoids/Nposmonoid.ma | 42 + .../CoRN-Decl/model/monoids/QSposmonoid.ma | 39 + .../CoRN-Decl/model/monoids/Qmonoid.ma | 51 + .../CoRN-Decl/model/monoids/Qposmonoid.ma | 38 + .../CoRN-Decl/model/monoids/Zmonoid.ma | 57 + .../model/non_examples/N_no_group.ma | 37 + .../model/non_examples/Npos_no_group.ma | 37 + .../model/non_examples/Npos_no_monoid.ma | 38 + .../CoRN-Decl/model/ordfields/Qordfield.ma | 38 + .../CoRN-Decl/model/reals/Cauchy_IR.ma | 36 + .../contribs/CoRN-Decl/model/rings/Qring.ma | 48 + .../contribs/CoRN-Decl/model/rings/Zring.ma | 39 + .../model/semigroups/Npossemigroup.ma | 44 + .../CoRN-Decl/model/semigroups/Nsemigroup.ma | 34 + .../model/semigroups/QSpossemigroup.ma | 33 + .../model/semigroups/Qpossemigroup.ma | 32 + .../CoRN-Decl/model/semigroups/Qsemigroup.ma | 37 + .../CoRN-Decl/model/semigroups/Zsemigroup.ma | 39 + .../CoRN-Decl/model/setoids/Npossetoid.ma | 70 + .../CoRN-Decl/model/setoids/Nsetoid.ma | 66 + .../CoRN-Decl/model/setoids/Qpossetoid.ma | 99 + .../CoRN-Decl/model/setoids/Qsetoid.ma | 90 + .../CoRN-Decl/model/setoids/Zsetoid.ma | 84 + .../CoRN-Decl/model/structures/Npossec.ma | 37 + .../CoRN-Decl/model/structures/Nsec.ma | 68 + .../CoRN-Decl/model/structures/Qpossec.ma | 70 + .../CoRN-Decl/model/structures/Qsec.ma | 266 + .../CoRN-Decl/model/structures/Zsec.ma | 100 + .../CoRN-Decl/ordine_compilazione.txt | 157 + matita/contribs/CoRN-Decl/preamble.ma | 23 + .../contribs/CoRN-Decl/reals/Bridges_LUB.ma | 220 + .../contribs/CoRN-Decl/reals/Bridges_iso.ma | 311 + .../contribs/CoRN-Decl/reals/CMetricFields.ma | 89 + .../contribs/CoRN-Decl/reals/CPoly_Contin.ma | 34 + matita/contribs/CoRN-Decl/reals/CReals.ma | 51 + matita/contribs/CoRN-Decl/reals/CReals1.ma | 168 + matita/contribs/CoRN-Decl/reals/CSumsReals.ma | 94 + matita/contribs/CoRN-Decl/reals/CauchySeq.ma | 315 + .../contribs/CoRN-Decl/reals/Cauchy_CReals.ma | 136 + matita/contribs/CoRN-Decl/reals/IVT.ma | 236 + matita/contribs/CoRN-Decl/reals/Intervals.ma | 313 + matita/contribs/CoRN-Decl/reals/Max_AbsIR.ma | 413 ++ matita/contribs/CoRN-Decl/reals/NRootIR.ma | 269 + .../contribs/CoRN-Decl/reals/OddPolyRootIR.ma | 166 + matita/contribs/CoRN-Decl/reals/Q_dense.ma | 169 + .../contribs/CoRN-Decl/reals/Q_in_CReals.ma | 170 + matita/contribs/CoRN-Decl/reals/R_morphism.ma | 298 + matita/contribs/CoRN-Decl/reals/RealFuncts.ma | 264 + matita/contribs/CoRN-Decl/reals/RealLists.ma | 106 + matita/contribs/CoRN-Decl/reals/Series.ma | 382 + matita/contribs/CoRN-Decl/reals/iso_CReals.ma | 125 + .../CoRN-Decl/tactics/AlgReflection.ma | 132 + .../CoRN-Decl/tactics/DiffTactics1.ma | 41 + .../CoRN-Decl/tactics/DiffTactics2.ma | 236 + .../CoRN-Decl/tactics/DiffTactics3.ma | 106 + .../CoRN-Decl/tactics/FieldReflection.ma | 218 + .../CoRN-Decl/tactics/GroupReflection.ma | 246 + .../CoRN-Decl/tactics/Opaque_algebra.ma | 100 + .../CoRN-Decl/tactics/RingReflection.ma | 324 + matita/contribs/CoRN-Decl/tactics/Step.ma | 76 + .../CoRN-Decl/tactics/Transparent_algebra.ma | 102 + .../contribs/CoRN-Decl/transc/Exponential.ma | 310 + .../contribs/CoRN-Decl/transc/InvTrigonom.ma | 296 + matita/contribs/CoRN-Decl/transc/Pi.ma | 287 + .../contribs/CoRN-Decl/transc/PowerSeries.ma | 242 + .../contribs/CoRN-Decl/transc/RealPowers.ma | 197 + matita/contribs/CoRN-Decl/transc/SinCos.ma | 176 + .../contribs/CoRN-Decl/transc/TaylorSeries.ma | 258 + matita/contribs/CoRN-Decl/transc/TrigMon.ma | 103 + .../CoRN-Decl/transc/Trigonometric.ma | 216 + .../contribs/LAMBDA-TYPES/Base-1/blt/defs.ma | 27 + .../contribs/LAMBDA-TYPES/Base-1/blt/props.ma | 102 + .../LAMBDA-TYPES/Base-1/definitions.ma | 24 + .../contribs/LAMBDA-TYPES/Base-1/ext/arith.ma | 613 ++ .../LAMBDA-TYPES/Base-1/ext/tactics.ma | 42 + matita/contribs/LAMBDA-TYPES/Base-1/makefile | 39 + .../LAMBDA-TYPES/Base-1/plist/defs.ma | 45 + .../LAMBDA-TYPES/Base-1/plist/props.ma | 33 + .../contribs/LAMBDA-TYPES/Base-1/preamble.ma | 112 + matita/contribs/LAMBDA-TYPES/Base-1/spare.ma | 174 + matita/contribs/LAMBDA-TYPES/Base-1/theory.ma | 28 + .../LAMBDA-TYPES/Base-1/types/defs.ma | 153 + .../LAMBDA-TYPES/Base-1/types/props.ma | 32 + .../contribs/LAMBDA-TYPES/Base-2/blt/defs.mma | 23 + .../LAMBDA-TYPES/Base-2/blt/props.mma | 28 + matita/contribs/LAMBDA-TYPES/Base-2/depend | 9 + .../LAMBDA-TYPES/Base-2/ext/arith.mma | 112 + .../LAMBDA-TYPES/Base-2/ext/tactics.mma | 27 + matita/contribs/LAMBDA-TYPES/Base-2/log.txt | 744 ++ matita/contribs/LAMBDA-TYPES/Base-2/makefile | 58 + .../LAMBDA-TYPES/Base-2/plist/defs.mma | 32 + .../LAMBDA-TYPES/Base-2/plist/props.mma | 22 + .../contribs/LAMBDA-TYPES/Base-2/preamble.ma | 30 + .../contribs/LAMBDA-TYPES/Base-2/theory.mma | 28 + .../LAMBDA-TYPES/Base-2/types/defs.mma | 80 + .../LAMBDA-TYPES/Base-2/types/props.mma | 22 + .../LAMBDA-TYPES/LambdaDelta-1/A/defs.ma | 24 + .../LAMBDA-TYPES/LambdaDelta-1/C/defs.ma | 47 + .../LAMBDA-TYPES/LambdaDelta-1/C/props.ma | 120 + .../LAMBDA-TYPES/LambdaDelta-1/G/defs.ma | 25 + .../LAMBDA-TYPES/LambdaDelta-1/T/dec.ma | 427 ++ .../LAMBDA-TYPES/LambdaDelta-1/T/defs.ma | 45 + .../LAMBDA-TYPES/LambdaDelta-1/T/props.ma | 79 + .../LAMBDA-TYPES/LambdaDelta-1/aplus/defs.ma | 26 + .../LAMBDA-TYPES/LambdaDelta-1/aplus/props.ma | 251 + .../LAMBDA-TYPES/LambdaDelta-1/aprem/defs.ma | 25 + .../LAMBDA-TYPES/LambdaDelta-1/aprem/props.ma | 151 + .../LAMBDA-TYPES/LambdaDelta-1/arity/aprem.ma | 357 + .../LAMBDA-TYPES/LambdaDelta-1/arity/cimp.ma | 101 + .../LAMBDA-TYPES/LambdaDelta-1/arity/defs.ma | 47 + .../LAMBDA-TYPES/LambdaDelta-1/arity/fwd.ma | 1140 +++ .../LAMBDA-TYPES/LambdaDelta-1/arity/lift1.ma | 88 + .../LAMBDA-TYPES/LambdaDelta-1/arity/pr3.ma | 625 ++ .../LAMBDA-TYPES/LambdaDelta-1/arity/props.ma | 415 ++ .../LambdaDelta-1/arity/subst0.ma | 1129 +++ .../LAMBDA-TYPES/LambdaDelta-1/asucc/defs.ma | 30 + .../LAMBDA-TYPES/LambdaDelta-1/asucc/fwd.ma | 95 + .../LAMBDA-TYPES/LambdaDelta-1/cimp/defs.ma | 27 + .../LAMBDA-TYPES/LambdaDelta-1/cimp/props.ma | 127 + .../LAMBDA-TYPES/LambdaDelta-1/clear/defs.ma | 26 + .../LAMBDA-TYPES/LambdaDelta-1/clear/drop.ma | 174 + .../LAMBDA-TYPES/LambdaDelta-1/clear/fwd.ma | 159 + .../LAMBDA-TYPES/LambdaDelta-1/clear/props.ma | 139 + .../LAMBDA-TYPES/LambdaDelta-1/clen/defs.ma | 28 + .../LAMBDA-TYPES/LambdaDelta-1/clen/getl.ma | 357 + .../LAMBDA-TYPES/LambdaDelta-1/cnt/defs.ma | 25 + .../LAMBDA-TYPES/LambdaDelta-1/cnt/props.ma | 36 + .../LAMBDA-TYPES/LambdaDelta-1/csuba/arity.ma | 219 + .../LAMBDA-TYPES/LambdaDelta-1/csuba/clear.ma | 104 + .../LAMBDA-TYPES/LambdaDelta-1/csuba/defs.ma | 29 + .../LAMBDA-TYPES/LambdaDelta-1/csuba/drop.ma | 1608 ++++ .../LAMBDA-TYPES/LambdaDelta-1/csuba/fwd.ma | 843 +++ .../LAMBDA-TYPES/LambdaDelta-1/csuba/getl.ma | 924 +++ .../LAMBDA-TYPES/LambdaDelta-1/csuba/props.ma | 27 + .../LAMBDA-TYPES/LambdaDelta-1/csubc/arity.ma | 38 + .../LAMBDA-TYPES/LambdaDelta-1/csubc/clear.ma | 149 + .../LAMBDA-TYPES/LambdaDelta-1/csubc/csuba.ma | 38 + .../LAMBDA-TYPES/LambdaDelta-1/csubc/defs.ma | 29 + .../LAMBDA-TYPES/LambdaDelta-1/csubc/drop.ma | 450 ++ .../LAMBDA-TYPES/LambdaDelta-1/csubc/drop1.ma | 198 + .../LAMBDA-TYPES/LambdaDelta-1/csubc/getl.ma | 44 + .../LAMBDA-TYPES/LambdaDelta-1/csubc/props.ma | 29 + .../LambdaDelta-1/csubst0/clear.ma | 1029 +++ .../LambdaDelta-1/csubst0/defs.ma | 34 + .../LambdaDelta-1/csubst0/drop.ma | 6496 +++++++++++++++++ .../LAMBDA-TYPES/LambdaDelta-1/csubst0/fwd.ma | 391 + .../LambdaDelta-1/csubst0/getl.ma | 1105 +++ .../LambdaDelta-1/csubst0/props.ma | 54 + .../LambdaDelta-1/csubst1/defs.ma | 24 + .../LAMBDA-TYPES/LambdaDelta-1/csubst1/fwd.ma | 126 + .../LambdaDelta-1/csubst1/getl.ma | 275 + .../LambdaDelta-1/csubst1/props.ma | 68 + .../LAMBDA-TYPES/LambdaDelta-1/csubt/clear.ma | 72 + .../LAMBDA-TYPES/LambdaDelta-1/csubt/defs.ma | 31 + .../LAMBDA-TYPES/LambdaDelta-1/csubt/drop.ma | 805 ++ .../LAMBDA-TYPES/LambdaDelta-1/csubt/fwd.ma | 389 + .../LAMBDA-TYPES/LambdaDelta-1/csubt/getl.ma | 398 + .../LAMBDA-TYPES/LambdaDelta-1/csubt/pc3.ma | 58 + .../LAMBDA-TYPES/LambdaDelta-1/csubt/props.ma | 27 + .../LAMBDA-TYPES/LambdaDelta-1/csubt/ty3.ma | 99 + .../LAMBDA-TYPES/LambdaDelta-1/definitions.ma | 62 + .../LAMBDA-TYPES/LambdaDelta-1/drop/defs.ma | 33 + .../LAMBDA-TYPES/LambdaDelta-1/drop/fwd.ma | 326 + .../LAMBDA-TYPES/LambdaDelta-1/drop/props.ma | 729 ++ .../LAMBDA-TYPES/LambdaDelta-1/drop1/defs.ma | 37 + .../LAMBDA-TYPES/LambdaDelta-1/drop1/getl.ma | 195 + .../LAMBDA-TYPES/LambdaDelta-1/drop1/props.ma | 234 + .../LAMBDA-TYPES/LambdaDelta-1/ex0/defs.ma | 34 + .../LAMBDA-TYPES/LambdaDelta-1/ex0/props.ma | 208 + .../LAMBDA-TYPES/LambdaDelta-1/ex1/defs.ma | 31 + .../LAMBDA-TYPES/LambdaDelta-1/ex1/props.ma | 542 ++ .../LAMBDA-TYPES/LambdaDelta-1/ex2/defs.ma | 30 + .../LAMBDA-TYPES/LambdaDelta-1/ex2/props.ma | 171 + .../LAMBDA-TYPES/LambdaDelta-1/flt/defs.ma | 31 + .../LAMBDA-TYPES/LambdaDelta-1/flt/props.ma | 119 + .../LambdaDelta-1/fsubst0/defs.ma | 30 + .../LAMBDA-TYPES/LambdaDelta-1/fsubst0/fwd.ma | 67 + .../LAMBDA-TYPES/LambdaDelta-1/getl/clear.ma | 143 + .../LAMBDA-TYPES/LambdaDelta-1/getl/dec.ma | 99 + .../LAMBDA-TYPES/LambdaDelta-1/getl/defs.ma | 26 + .../LAMBDA-TYPES/LambdaDelta-1/getl/drop.ma | 491 ++ .../LAMBDA-TYPES/LambdaDelta-1/getl/flt.ma | 66 + .../LAMBDA-TYPES/LambdaDelta-1/getl/fwd.ma | 107 + .../LAMBDA-TYPES/LambdaDelta-1/getl/getl.ma | 53 + .../LAMBDA-TYPES/LambdaDelta-1/getl/props.ma | 91 + .../LAMBDA-TYPES/LambdaDelta-1/iso/defs.ma | 26 + .../LAMBDA-TYPES/LambdaDelta-1/iso/fwd.ma | 313 + .../LAMBDA-TYPES/LambdaDelta-1/iso/props.ma | 52 + .../LAMBDA-TYPES/LambdaDelta-1/leq/asucc.ma | 746 ++ .../LAMBDA-TYPES/LambdaDelta-1/leq/defs.ma | 28 + .../LAMBDA-TYPES/LambdaDelta-1/leq/fwd.ma | 118 + .../LAMBDA-TYPES/LambdaDelta-1/leq/props.ma | 373 + .../LAMBDA-TYPES/LambdaDelta-1/lift/defs.ma | 46 + .../LAMBDA-TYPES/LambdaDelta-1/lift/fwd.ma | 654 ++ .../LAMBDA-TYPES/LambdaDelta-1/lift/props.ma | 520 ++ .../LAMBDA-TYPES/LambdaDelta-1/lift/tlt.ma | 294 + .../LAMBDA-TYPES/LambdaDelta-1/lift1/defs.ma | 42 + .../LAMBDA-TYPES/LambdaDelta-1/lift1/fwd.ma | 142 + .../LAMBDA-TYPES/LambdaDelta-1/lift1/props.ma | 131 + .../LAMBDA-TYPES/LambdaDelta-1/llt/defs.ma | 32 + .../LAMBDA-TYPES/LambdaDelta-1/llt/props.ma | 95 + .../LAMBDA-TYPES/LambdaDelta-1/makefile | 39 + .../LambdaDelta-1/next_plus/defs.ma | 26 + .../LambdaDelta-1/next_plus/props.ma | 61 + .../LAMBDA-TYPES/LambdaDelta-1/nf2/arity.ma | 534 ++ .../LAMBDA-TYPES/LambdaDelta-1/nf2/dec.ma | 199 + .../LAMBDA-TYPES/LambdaDelta-1/nf2/defs.ma | 33 + .../LAMBDA-TYPES/LambdaDelta-1/nf2/fwd.ma | 198 + .../LAMBDA-TYPES/LambdaDelta-1/nf2/iso.ma | 129 + .../LAMBDA-TYPES/LambdaDelta-1/nf2/lift1.ma | 84 + .../LAMBDA-TYPES/LambdaDelta-1/nf2/pr3.ma | 52 + .../LAMBDA-TYPES/LambdaDelta-1/nf2/props.ma | 237 + .../LAMBDA-TYPES/LambdaDelta-1/pc1/defs.ma | 26 + .../LAMBDA-TYPES/LambdaDelta-1/pc1/props.ma | 118 + .../LAMBDA-TYPES/LambdaDelta-1/pc3/dec.ma | 153 + .../LAMBDA-TYPES/LambdaDelta-1/pc3/defs.ma | 33 + .../LAMBDA-TYPES/LambdaDelta-1/pc3/fsubst0.ma | 719 ++ .../LAMBDA-TYPES/LambdaDelta-1/pc3/fwd.ma | 314 + .../LAMBDA-TYPES/LambdaDelta-1/pc3/left.ma | 109 + .../LAMBDA-TYPES/LambdaDelta-1/pc3/nf2.ma | 37 + .../LAMBDA-TYPES/LambdaDelta-1/pc3/pc1.ma | 35 + .../LAMBDA-TYPES/LambdaDelta-1/pc3/props.ma | 460 ++ .../LAMBDA-TYPES/LambdaDelta-1/pc3/subst1.ma | 47 + .../LAMBDA-TYPES/LambdaDelta-1/pc3/wcpr0.ma | 103 + .../LAMBDA-TYPES/LambdaDelta-1/pr0/dec.ma | 528 ++ .../LAMBDA-TYPES/LambdaDelta-1/pr0/defs.ma | 42 + .../LAMBDA-TYPES/LambdaDelta-1/pr0/fwd.ma | 1736 +++++ .../LAMBDA-TYPES/LambdaDelta-1/pr0/pr0.ma | 2818 +++++++ .../LAMBDA-TYPES/LambdaDelta-1/pr0/props.ma | 1772 +++++ .../LAMBDA-TYPES/LambdaDelta-1/pr0/subst1.ma | 95 + .../LAMBDA-TYPES/LambdaDelta-1/pr1/defs.ma | 25 + .../LAMBDA-TYPES/LambdaDelta-1/pr1/pr1.ma | 64 + .../LAMBDA-TYPES/LambdaDelta-1/pr1/props.ma | 110 + .../LAMBDA-TYPES/LambdaDelta-1/pr2/clen.ma | 182 + .../LAMBDA-TYPES/LambdaDelta-1/pr2/defs.ma | 30 + .../LAMBDA-TYPES/LambdaDelta-1/pr2/fwd.ma | 3630 +++++++++ .../LAMBDA-TYPES/LambdaDelta-1/pr2/pr2.ma | 248 + .../LAMBDA-TYPES/LambdaDelta-1/pr2/props.ma | 339 + .../LAMBDA-TYPES/LambdaDelta-1/pr2/subst1.ma | 290 + .../LAMBDA-TYPES/LambdaDelta-1/pr3/defs.ma | 25 + .../LAMBDA-TYPES/LambdaDelta-1/pr3/fwd.ma | 1559 ++++ .../LAMBDA-TYPES/LambdaDelta-1/pr3/iso.ma | 1136 +++ .../LAMBDA-TYPES/LambdaDelta-1/pr3/pr1.ma | 33 + .../LAMBDA-TYPES/LambdaDelta-1/pr3/pr3.ma | 70 + .../LAMBDA-TYPES/LambdaDelta-1/pr3/props.ma | 415 ++ .../LAMBDA-TYPES/LambdaDelta-1/pr3/subst1.ma | 91 + .../LAMBDA-TYPES/LambdaDelta-1/pr3/wcpr0.ma | 79 + .../LAMBDA-TYPES/LambdaDelta-1/preamble.ma | 42 + .../LAMBDA-TYPES/LambdaDelta-1/r/defs.ma | 26 + .../LAMBDA-TYPES/LambdaDelta-1/r/props.ma | 95 + .../LAMBDA-TYPES/LambdaDelta-1/s/defs.ma | 26 + .../LAMBDA-TYPES/LambdaDelta-1/s/props.ma | 120 + .../LAMBDA-TYPES/LambdaDelta-1/sc3/arity.ma | 307 + .../LAMBDA-TYPES/LambdaDelta-1/sc3/defs.ma | 34 + .../LAMBDA-TYPES/LambdaDelta-1/sc3/props.ma | 739 ++ .../LAMBDA-TYPES/LambdaDelta-1/sn3/defs.ma | 31 + .../LAMBDA-TYPES/LambdaDelta-1/sn3/fwd.ma | 183 + .../LAMBDA-TYPES/LambdaDelta-1/sn3/lift1.ma | 90 + .../LAMBDA-TYPES/LambdaDelta-1/sn3/nf2.ma | 62 + .../LAMBDA-TYPES/LambdaDelta-1/sn3/props.ma | 2499 +++++++ .../LAMBDA-TYPES/LambdaDelta-1/spare.ma | 118 + .../LAMBDA-TYPES/LambdaDelta-1/subst0/dec.ma | 178 + .../LAMBDA-TYPES/LambdaDelta-1/subst0/defs.ma | 34 + .../LAMBDA-TYPES/LambdaDelta-1/subst0/fwd.ma | 817 +++ .../LambdaDelta-1/subst0/props.ma | 230 + .../LambdaDelta-1/subst0/subst0.ma | 1374 ++++ .../LAMBDA-TYPES/LambdaDelta-1/subst0/tlt.ma | 460 ++ .../LAMBDA-TYPES/LambdaDelta-1/subst1/defs.ma | 24 + .../LAMBDA-TYPES/LambdaDelta-1/subst1/fwd.ma | 166 + .../LambdaDelta-1/subst1/props.ma | 166 + .../LambdaDelta-1/subst1/subst1.ma | 198 + .../LAMBDA-TYPES/LambdaDelta-1/tau0/defs.ma | 41 + .../LAMBDA-TYPES/LambdaDelta-1/tau0/props.ma | 213 + .../LAMBDA-TYPES/LambdaDelta-1/tau1/cnt.ma | 88 + .../LAMBDA-TYPES/LambdaDelta-1/tau1/defs.ma | 25 + .../LAMBDA-TYPES/LambdaDelta-1/tau1/props.ma | 144 + .../LAMBDA-TYPES/LambdaDelta-1/theory.ma | 38 + .../LAMBDA-TYPES/LambdaDelta-1/tlist/defs.ma | 49 + .../LAMBDA-TYPES/LambdaDelta-1/tlist/props.ma | 120 + .../LAMBDA-TYPES/LambdaDelta-1/tlt/defs.ma | 48 + .../LAMBDA-TYPES/LambdaDelta-1/tlt/props.ma | 267 + .../LAMBDA-TYPES/LambdaDelta-1/ty3/arity.ma | 198 + .../LambdaDelta-1/ty3/arity_props.ma | 111 + .../LAMBDA-TYPES/LambdaDelta-1/ty3/dec.ma | 470 ++ .../LAMBDA-TYPES/LambdaDelta-1/ty3/defs.ma | 46 + .../LAMBDA-TYPES/LambdaDelta-1/ty3/fsubst0.ma | 1009 +++ .../LAMBDA-TYPES/LambdaDelta-1/ty3/fwd.ma | 954 +++ .../LAMBDA-TYPES/LambdaDelta-1/ty3/nf2.ma | 467 ++ .../LAMBDA-TYPES/LambdaDelta-1/ty3/pr3.ma | 747 ++ .../LambdaDelta-1/ty3/pr3_props.ma | 506 ++ .../LAMBDA-TYPES/LambdaDelta-1/ty3/props.ma | 483 ++ .../LAMBDA-TYPES/LambdaDelta-1/ty3/subst1.ma | 1167 +++ .../LAMBDA-TYPES/LambdaDelta-1/ty3/tau0.ma | 633 ++ .../LAMBDA-TYPES/LambdaDelta-1/wcpr0/defs.ma | 28 + .../LAMBDA-TYPES/LambdaDelta-1/wcpr0/fwd.ma | 102 + .../LAMBDA-TYPES/LambdaDelta-1/wcpr0/getl.ma | 468 ++ matita/contribs/LAMBDA-TYPES/Makefile | 10 + .../LAMBDA-TYPES/Unified-Sub/Lift/defs.ma | 37 + .../LAMBDA-TYPES/Unified-Sub/Lift/fun.ma | 57 + .../LAMBDA-TYPES/Unified-Sub/Lift/inv.ma | 149 + .../LAMBDA-TYPES/Unified-Sub/Lift/props.ma | 83 + .../Unified-Sub/datatypes/Context.ma | 27 + .../Unified-Sub/datatypes/Term.ma | 53 + .../LAMBDA-TYPES/Unified-Sub/makefile | 39 + .../LAMBDA-TYPES/Unified-Sub/preamble.ma | 34 + matita/contribs/LOGIC/CLE/defs.ma | 29 + matita/contribs/LOGIC/Insert/defs.ma | 30 + matita/contribs/LOGIC/Insert/fun.ma | 34 + matita/contribs/LOGIC/Insert/inv.ma | 57 + matita/contribs/LOGIC/Insert/props.ma | 73 + matita/contribs/LOGIC/Lift/defs.ma | 38 + matita/contribs/LOGIC/NTrack/defs.ma | 38 + matita/contribs/LOGIC/NTrack/inv.ma | 66 + matita/contribs/LOGIC/NTrack/order.ma | 39 + matita/contribs/LOGIC/NTrack/props.ma | 63 + matita/contribs/LOGIC/PEq/defs.ma | 35 + matita/contribs/LOGIC/PNF/defs.ma | 27 + matita/contribs/LOGIC/PRed/defs.ma | 63 + matita/contribs/LOGIC/PRed/wlt.ma | 29 + matita/contribs/LOGIC/Track/defs.ma | 41 + matita/contribs/LOGIC/Track/inv.ma | 60 + matita/contribs/LOGIC/Track/order.ma | 36 + matita/contribs/LOGIC/Track/pred.ma | 46 + matita/contribs/LOGIC/WLT/defs.ma | 34 + matita/contribs/LOGIC/Weight/defs.ma | 36 + .../contribs/LOGIC/datatypes_defs/Context.ma | 33 + .../contribs/LOGIC/datatypes_defs/Formula.ma | 27 + matita/contribs/LOGIC/datatypes_defs/Proof.ma | 31 + .../contribs/LOGIC/datatypes_defs/Sequent.ma | 46 + .../contribs/LOGIC/datatypes_props/Sequent.ma | 25 + matita/contribs/LOGIC/makefile | 39 + matita/contribs/LOGIC/preamble.ma | 22 + matita/contribs/Makefile | 10 + .../PREDICATIVE-TOPOLOGY/class_defs.ma | 79 + .../contribs/PREDICATIVE-TOPOLOGY/class_eq.ma | 32 + .../contribs/PREDICATIVE-TOPOLOGY/coa_defs.ma | 63 + .../PREDICATIVE-TOPOLOGY/coa_props.ma | 31 + .../PREDICATIVE-TOPOLOGY/domain_data.ma | 42 + .../PREDICATIVE-TOPOLOGY/domain_defs.ma | 60 + matita/contribs/PREDICATIVE-TOPOLOGY/iff.ma | 33 + matita/contribs/PREDICATIVE-TOPOLOGY/makefile | 33 + .../PREDICATIVE-TOPOLOGY/subset_defs.ma | 68 + matita/contribs/RELATIONAL/NLE/defs.ma | 40 + matita/contribs/RELATIONAL/NLE/inv.ma | 40 + matita/contribs/RELATIONAL/NLE/nplus.ma | 29 + matita/contribs/RELATIONAL/NLE/order.ma | 53 + matita/contribs/RELATIONAL/NLE/props.ma | 31 + matita/contribs/RELATIONAL/NPlus/defs.ma | 29 + matita/contribs/RELATIONAL/NPlus/fun.ma | 40 + matita/contribs/RELATIONAL/NPlus/inv.ma | 81 + matita/contribs/RELATIONAL/NPlus/monoid.ma | 131 + matita/contribs/RELATIONAL/NPlusList/defs.ma | 38 + matita/contribs/RELATIONAL/NPlusList/props.ma | 34 + matita/contribs/RELATIONAL/ZEq/defs.ma | 28 + matita/contribs/RELATIONAL/ZEq/setoid.ma | 37 + matita/contribs/RELATIONAL/datatypes/Bool.ma | 22 + matita/contribs/RELATIONAL/datatypes/List.ma | 39 + matita/contribs/RELATIONAL/datatypes/Nat.ma | 22 + matita/contribs/RELATIONAL/datatypes/Zah.ma | 19 + matita/contribs/RELATIONAL/makefile | 39 + matita/contribs/RELATIONAL/preamble.ma | 19 + matita/contribs/developments.txt | 14 + matita/contribs/formal_topology/bin/Makefile | 2 + .../formal_topology/bin/formal_topology.ma | 61 + .../formal_topology/bin/theory_explorer.ml | 568 ++ .../bin/theory_explorer_do_not_trust_auto.ml | 232 + .../formal_topology/formal_topology.ma | 114 + .../formal_topology/formal_topology2.ma | 77 + matita/contribs/prova.ma | 236 + matita/core_notation.moo | 121 + matita/dama/attic/fields.ma | 60 + matita/dama/attic/integration_algebras.ma | 368 + matita/dama/attic/ordered_fields_ch0.ma | 151 + matita/dama/attic/reals.ma | 172 + matita/dama/attic/rings.ma | 103 + matita/dama/attic/vector_spaces.ma | 151 + .../dama/classical_pointfree/ordered_sets.ma | 424 ++ .../dama/classical_pointfree/ordered_sets2.ma | 127 + matita/dama/classical_pointwise/sets.ma | 102 + .../dama/classical_pointwise/sigma_algebra.ma | 40 + matita/dama/classical_pointwise/topology.ma | 45 + matita/dama/constructive_connectives.ma | 53 + .../constructive_higher_order_relations.ma | 50 + .../dama/constructive_pointfree/lebesgue.ma | 31 + matita/dama/divisible_group.ma | 99 + matita/dama/doc/DIMOSTRAZIONE | 126 + matita/dama/doc/NotaReticoli.pdf | 3078 ++++++++ matita/dama/excess.ma | 249 + matita/dama/group.ma | 221 + matita/dama/lattice.ma | 87 + matita/dama/makefile | 33 + matita/dama/metric_lattice.ma | 110 + matita/dama/metric_space.ma | 51 + matita/dama/ordered_divisible_group.ma | 75 + matita/dama/ordered_group.ma | 328 + matita/dama/premetric_lattice.ma | 69 + matita/dama/prevalued_lattice.ma | 243 + matita/dama/sandwich.ma | 81 + matita/dama/sequence.ma | 235 + matita/dama_didactic/bottom.ma | 117 + matita/dama_didactic/deriv.ma | 114 + matita/dama_didactic/ex_deriv.ma | 247 + matita/dama_didactic/ex_seq.ma | 201 + matita/dama_didactic/makefile | 33 + matita/dama_didactic/reals.ma | 103 + matita/dama_didactic/sequences.ma | 57 + matita/dep2dot.rb | 30 + matita/dictionary-matita.xml | 15 + matita/dist/BUGS | 5 + matita/dist/COPYING | 340 + matita/dist/ChangeLog | 5 + matita/dist/INSTALL | 191 + matita/dist/Makefile | 27 + matita/dist/README | 53 + matita/dist/configure.ac.sed | 4 + matita/dist/fill_db.sh | 53 + matita/dist/static_link/Makefile | 5 + matita/dist/static_link/static_link.ml | 162 + matita/doc/primer.txt | 720 ++ matita/dump_moo.ml | 60 + matita/gragrep.ml | 67 + matita/gragrep.mli | 27 + matita/gtkmathview.matita.conf.xml.in | 31 + matita/help/C/Makefile | 105 + matita/help/C/TODO | 12 + .../help/C/declarative_tactics_quickref.xml | 71 + matita/help/C/docbook.css | 56 + matita/help/C/figures/database.dia | Bin 0 -> 5538 bytes matita/help/C/figures/database.png | Bin 0 -> 15256 bytes matita/help/C/figures/developments.png | Bin 0 -> 15793 bytes matita/help/C/legal.xml | 20 + matita/help/C/matita.xml | 180 + matita/help/C/sec_commands.xml | 374 + matita/help/C/sec_declarative_tactics.xml | 471 ++ matita/help/C/sec_gettingstarted.xml | 226 + matita/help/C/sec_install.xml | 501 ++ matita/help/C/sec_intro.xml | 96 + matita/help/C/sec_license.xml | 8 + matita/help/C/sec_tacticals.xml | 305 + matita/help/C/sec_tactics.xml | 1824 +++++ matita/help/C/sec_terms.xml | 760 ++ matita/help/C/sec_usernotation.xml | 18 + matita/help/C/tactic_quickref.xml | 6 + matita/help/C/tactics_quickref.xml | 312 + matita/help/C/version.txt.in | 1 + matita/help/C/xhtml1-transitional.dtd | 1717 +++++ matita/help/C/xsl/matita-fo.xsl | 5 + matita/help/C/xsl/matita-tex.xsl | 31 + matita/help/C/xsl/matita-xhtml.xsl | 73 + matita/help/C/xsl/tactic_quickref.xsl | 75 + matita/icons/matita-32.xpm | 70 + matita/icons/matita-bulb-high.png | Bin 0 -> 1149 bytes matita/icons/matita-bulb-low.png | Bin 0 -> 1072 bytes matita/icons/matita-bulb-medium.png | Bin 0 -> 1272 bytes matita/icons/matita-folder.png | Bin 0 -> 706 bytes matita/icons/matita-object.png | Bin 0 -> 893 bytes matita/icons/matita-theory.png | Bin 0 -> 1287 bytes matita/icons/matita.png | Bin 0 -> 17605 bytes matita/icons/matita_medium.png | Bin 0 -> 12270 bytes matita/icons/matita_small.png | Bin 0 -> 4786 bytes matita/icons/matita_very_small.png | Bin 0 -> 3650 bytes matita/icons/meegg.png | Bin 0 -> 157131 bytes matita/icons/whelp.png | Bin 0 -> 1073 bytes matita/icons/whelp.svg | 221 + matita/lablGraphviz.ml | 162 + matita/lablGraphviz.mli | 72 + matita/legacy/coq.ma | 94 + matita/legacy/makefile | 39 + matita/library/Fsub/defn.ma | 393 + matita/library/Fsub/part1a.ma | 134 + matita/library/Fsub/part1a_inversion.ma | 156 + matita/library/Fsub/util.ma | 134 + matita/library/Q/Qaxioms.ma | 71 + matita/library/Q/q.ma | 341 + matita/library/Z/compare.ma | 143 + matita/library/Z/dirichlet_product.ma | 520 ++ matita/library/Z/inversion.ma | 101 + matita/library/Z/moebius.ma | 368 + matita/library/Z/orders.ma | 245 + matita/library/Z/plus.ma | 329 + matita/library/Z/sigma_p.ma | 823 +++ matita/library/Z/times.ma | 253 + matita/library/Z/z.ma | 180 + matita/library/algebra/CoRN/SemiGroups.ma | 400 + matita/library/algebra/CoRN/SetoidFun.ma | 1303 ++++ matita/library/algebra/CoRN/SetoidInc.ma | 150 + matita/library/algebra/CoRN/Setoids.ma | 1282 ++++ matita/library/algebra/finite_groups.ma | 401 + matita/library/algebra/groups.ma | 326 + matita/library/algebra/monoids.ma | 69 + matita/library/algebra/semigroups.ma | 56 + matita/library/assembly/byte.ma | 334 + matita/library/assembly/exadecimal.ma | 926 +++ matita/library/assembly/extra.ma | 84 + matita/library/assembly/test.ma | 289 + matita/library/assembly/vm.ma | 282 + matita/library/datatypes/bool.ma | 199 + matita/library/datatypes/compare.ma | 27 + matita/library/datatypes/constructors.ma | 79 + matita/library/decidable_kit/decidable.ma | 197 + matita/library/decidable_kit/eqtype.ma | 156 + matita/library/decidable_kit/fgraph.ma | 259 + matita/library/decidable_kit/fintype.ma | 230 + matita/library/decidable_kit/list_aux.ma | 105 + matita/library/decidable_kit/streicher.ma | 56 + matita/library/demo/power_derivative.ma | 330 + .../demo/propositional_sequent_calculus.ma | 917 +++ matita/library/higher_order_defs/functions.ma | 67 + matita/library/higher_order_defs/ordering.ma | 22 + matita/library/higher_order_defs/relations.ma | 51 + matita/library/library_notation.ma | 54 + matita/library/list/list.ma | 145 + matita/library/list/sort.ma | 172 + matita/library/logic/coimplication.ma | 47 + matita/library/logic/connectives.ma | 86 + matita/library/logic/connectives2.ma | 44 + matita/library/logic/equality.ma | 247 + matita/library/makefile | 39 + matita/library/nat/binomial.ma | 229 + matita/library/nat/chebyshev.ma | 1544 ++++ matita/library/nat/chebyshev_thm.ma | 345 + matita/library/nat/chinese_reminder.ma | 249 + matita/library/nat/compare.ma | 321 + matita/library/nat/congruence.ma | 195 + matita/library/nat/count.ma | 243 + matita/library/nat/div_and_mod.ma | 400 + matita/library/nat/div_and_mod_diseq.ma | 341 + .../nat/div_and_mod_new.ma.dontcompile | 360 + matita/library/nat/euler_theorem.ma | 411 ++ matita/library/nat/exp.ma | 237 + matita/library/nat/factorial.ma | 61 + matita/library/nat/factorial2.ma | 216 + matita/library/nat/factorization.ma | 760 ++ matita/library/nat/fermat_little_theorem.ma | 259 + matita/library/nat/gcd.ma | 906 +++ matita/library/nat/gcd_properties1.ma | 352 + matita/library/nat/generic_iter_p.ma | 1763 +++++ matita/library/nat/iteration2.ma | 983 +++ matita/library/nat/le_arith.ma | 170 + matita/library/nat/log.ma | 474 ++ matita/library/nat/lt_arith.ma | 588 ++ matita/library/nat/map_iter_p.ma | 870 +++ matita/library/nat/minimization.ma | 435 ++ matita/library/nat/minus.ma | 401 + matita/library/nat/nat.ma | 107 + matita/library/nat/neper.ma | 747 ++ matita/library/nat/nth_prime.ma | 203 + matita/library/nat/ord.ma | 617 ++ matita/library/nat/orders.ma | 447 ++ matita/library/nat/permutation.ma | 755 ++ matita/library/nat/pi_p.ma | 395 + matita/library/nat/plus.ma | 77 + matita/library/nat/primes.ma | 784 ++ matita/library/nat/relevant_equations.ma | 62 + matita/library/nat/sigma_and_pi.ma | 79 + matita/library/nat/times.ma | 104 + matita/library/nat/totient.ma | 139 + matita/library/nat/totient1.ma | 243 + matita/library/technicalities/setoids.ma | 1056 +++ matita/library_auto/auto/Q/q.ma | 523 ++ matita/library_auto/auto/Z/compare.ma | 234 + matita/library_auto/auto/Z/orders.ma | 188 + matita/library_auto/auto/Z/plus.ma | 470 ++ matita/library_auto/auto/Z/times.ma | 352 + matita/library_auto/auto/Z/z.ma | 251 + .../library_auto/auto/nat/chinese_reminder.ma | 364 + matita/library_auto/auto/nat/compare.ma | 320 + matita/library_auto/auto/nat/congruence.ma | 259 + matita/library_auto/auto/nat/count.ma | 347 + matita/library_auto/auto/nat/div_and_mod.ma | 425 ++ matita/library_auto/auto/nat/euler_theorem.ma | 329 + matita/library_auto/auto/nat/exp.ma | 154 + matita/library_auto/auto/nat/factorial.ma | 105 + matita/library_auto/auto/nat/factorization.ma | 972 +++ .../auto/nat/fermat_little_theorem.ma | 448 ++ matita/library_auto/auto/nat/gcd.ma | 1088 +++ matita/library_auto/auto/nat/le_arith.ma | 135 + matita/library_auto/auto/nat/lt_arith.ma | 329 + matita/library_auto/auto/nat/map_iter_p.ma | 1279 ++++ matita/library_auto/auto/nat/minimization.ma | 406 ++ matita/library_auto/auto/nat/minus.ma | 514 ++ matita/library_auto/auto/nat/nat.ma | 151 + matita/library_auto/auto/nat/nth_prime.ma | 275 + matita/library_auto/auto/nat/ord.ma | 389 + matita/library_auto/auto/nat/orders.ma | 568 ++ matita/library_auto/auto/nat/permutation.ma | 1432 ++++ matita/library_auto/auto/nat/plus.ma | 97 + matita/library_auto/auto/nat/primes.ma | 999 +++ .../auto/nat/relevant_equations.ma | 57 + matita/library_auto/auto/nat/sigma_and_pi.ma | 139 + matita/library_auto/auto/nat/times.ma | 131 + matita/library_auto/auto/nat/totient.ma | 172 + matita/library_auto/makefile | 39 + matita/matita.conf.xml.in | 125 + matita/matita.glade | 3393 +++++++++ matita/matita.gtkrc | 80 + matita/matita.lang | 223 + matita/matita.ma.templ | 16 + matita/matita.ml | 319 + matita/matita.txt | 458 ++ matita/matitaAutoGui.ml | 217 + matita/matitaAutoGui.mli | 32 + matita/matitaEngine.ml | 159 + matita/matitaEngine.mli | 65 + matita/matitaExcPp.ml | 212 + matita/matitaExcPp.mli | 33 + matita/matitaGtkMisc.ml | 414 ++ matita/matitaGtkMisc.mli | 154 + matita/matitaGui.ml | 1701 +++++ matita/matitaGui.mli | 52 + matita/matitaGuiTypes.mli | 152 + matita/matitaInit.ml | 358 + matita/matitaInit.mli | 40 + matita/matitaMathView.ml | 1319 ++++ matita/matitaMathView.mli | 87 + matita/matitaMisc.ml | 161 + matita/matitaMisc.mli | 78 + matita/matitaScript.ml | 1146 +++ matita/matitaScript.mli | 103 + matita/matitaTypes.ml | 95 + matita/matitaTypes.mli | 49 + matita/matitaWiki.ml | 271 + matita/matitac.ml | 110 + matita/matitacLib.ml | 443 ++ matita/matitacLib.mli | 40 + matita/matitaclean.ml | 108 + matita/matitaclean.mli | 27 + matita/matitadep.ml | 227 + matita/matitadep.mli | 27 + matita/matitamake.ml | 135 + matita/matitamake.mli | 27 + matita/matitamakeLib.ml | 394 + matita/matitamakeLib.mli | 62 + matita/matitaprover.ml | 136 + matita/matitaprover.mli | 29 + matita/matitatop.ml | 31 + matita/rottener.ml | 169 + matita/rottenize_lib | 4 + matita/scripts/README | 17 + matita/scripts/bench.sql | 13 + matita/scripts/clean_db.sh | 7 + matita/scripts/crontab | 4 + matita/scripts/crontab.sh | 117 + matita/scripts/functions.lua | 101 + matita/scripts/profile_svn.sh | 79 + matita/scripts/public_html/bench.php | 430 ++ matita/scripts/public_html/common.php | 80 + matita/scripts/public_html/composequery.php | 46 + matita/scripts/public_html/index.html | 15 + matita/scripts/public_html/showquery.php | 35 + matita/scripts/public_html/style.css | 55 + matita/template_makefile.in | 36 + matita/template_makefile_devel.in | 39 + matita/tests/TPTP/README | 42 + matita/tests/TPTP/Veloci/BOO001-1.p.ma | 66 + matita/tests/TPTP/Veloci/BOO003-2.p.ma | 75 + matita/tests/TPTP/Veloci/BOO003-4.p.ma | 69 + matita/tests/TPTP/Veloci/BOO004-2.p.ma | 75 + matita/tests/TPTP/Veloci/BOO004-4.p.ma | 69 + matita/tests/TPTP/Veloci/BOO005-2.p.ma | 76 + matita/tests/TPTP/Veloci/BOO005-4.p.ma | 70 + matita/tests/TPTP/Veloci/BOO006-2.p.ma | 75 + matita/tests/TPTP/Veloci/BOO006-4.p.ma | 69 + matita/tests/TPTP/Veloci/BOO009-2.p.ma | 76 + matita/tests/TPTP/Veloci/BOO009-4.p.ma | 70 + matita/tests/TPTP/Veloci/BOO010-2.p.ma | 76 + matita/tests/TPTP/Veloci/BOO010-4.p.ma | 70 + matita/tests/TPTP/Veloci/BOO011-2.p.ma | 76 + matita/tests/TPTP/Veloci/BOO011-4.p.ma | 69 + matita/tests/TPTP/Veloci/BOO012-2.p.ma | 75 + matita/tests/TPTP/Veloci/BOO012-4.p.ma | 69 + matita/tests/TPTP/Veloci/BOO013-2.p.ma | 83 + matita/tests/TPTP/Veloci/BOO013-4.p.ma | 72 + matita/tests/TPTP/Veloci/BOO016-2.p.ma | 78 + matita/tests/TPTP/Veloci/BOO017-2.p.ma | 78 + matita/tests/TPTP/Veloci/BOO018-4.p.ma | 69 + matita/tests/TPTP/Veloci/BOO034-1.p.ma | 75 + matita/tests/TPTP/Veloci/BOO069-1.p.ma | 38 + matita/tests/TPTP/Veloci/BOO071-1.p.ma | 38 + matita/tests/TPTP/Veloci/BOO075-1.p.ma | 37 + matita/tests/TPTP/Veloci/COL004-3.p.ma | 43 + matita/tests/TPTP/Veloci/COL007-1.p.ma | 44 + matita/tests/TPTP/Veloci/COL008-1.p.ma | 48 + matita/tests/TPTP/Veloci/COL010-1.p.ma | 47 + matita/tests/TPTP/Veloci/COL012-1.p.ma | 44 + matita/tests/TPTP/Veloci/COL013-1.p.ma | 47 + matita/tests/TPTP/Veloci/COL014-1.p.ma | 47 + matita/tests/TPTP/Veloci/COL015-1.p.ma | 46 + matita/tests/TPTP/Veloci/COL016-1.p.ma | 49 + matita/tests/TPTP/Veloci/COL017-1.p.ma | 49 + matita/tests/TPTP/Veloci/COL018-1.p.ma | 49 + matita/tests/TPTP/Veloci/COL021-1.p.ma | 49 + matita/tests/TPTP/Veloci/COL022-1.p.ma | 49 + matita/tests/TPTP/Veloci/COL024-1.p.ma | 49 + matita/tests/TPTP/Veloci/COL025-1.p.ma | 48 + matita/tests/TPTP/Veloci/COL045-1.p.ma | 49 + matita/tests/TPTP/Veloci/COL048-1.p.ma | 49 + matita/tests/TPTP/Veloci/COL050-1.p.ma | 56 + matita/tests/TPTP/Veloci/COL058-2.p.ma | 42 + matita/tests/TPTP/Veloci/COL058-3.p.ma | 42 + matita/tests/TPTP/Veloci/COL060-2.p.ma | 46 + matita/tests/TPTP/Veloci/COL060-3.p.ma | 46 + matita/tests/TPTP/Veloci/COL061-2.p.ma | 46 + matita/tests/TPTP/Veloci/COL061-3.p.ma | 46 + matita/tests/TPTP/Veloci/COL062-2.p.ma | 46 + matita/tests/TPTP/Veloci/COL062-3.p.ma | 46 + matita/tests/TPTP/Veloci/COL063-2.p.ma | 46 + matita/tests/TPTP/Veloci/COL063-3.p.ma | 46 + matita/tests/TPTP/Veloci/COL063-4.p.ma | 46 + matita/tests/TPTP/Veloci/COL063-5.p.ma | 46 + matita/tests/TPTP/Veloci/COL063-6.p.ma | 46 + matita/tests/TPTP/Veloci/COL064-2.p.ma | 46 + matita/tests/TPTP/Veloci/COL064-3.p.ma | 46 + matita/tests/TPTP/Veloci/COL064-4.p.ma | 46 + matita/tests/TPTP/Veloci/COL064-5.p.ma | 46 + matita/tests/TPTP/Veloci/COL064-6.p.ma | 46 + matita/tests/TPTP/Veloci/COL064-7.p.ma | 46 + matita/tests/TPTP/Veloci/COL064-8.p.ma | 46 + matita/tests/TPTP/Veloci/COL064-9.p.ma | 46 + matita/tests/TPTP/Veloci/COL083-1.p.ma | 46 + matita/tests/TPTP/Veloci/COL084-1.p.ma | 46 + matita/tests/TPTP/Veloci/COL085-1.p.ma | 44 + matita/tests/TPTP/Veloci/COL086-1.p.ma | 44 + matita/tests/TPTP/Veloci/GRP001-2.p.ma | 86 + matita/tests/TPTP/Veloci/GRP001-4.p.ma | 47 + matita/tests/TPTP/Veloci/GRP010-4.p.ma | 45 + matita/tests/TPTP/Veloci/GRP011-4.p.ma | 46 + matita/tests/TPTP/Veloci/GRP012-4.p.ma | 78 + matita/tests/TPTP/Veloci/GRP022-2.p.ma | 78 + matita/tests/TPTP/Veloci/GRP023-2.p.ma | 75 + matita/tests/TPTP/Veloci/GRP115-1.p.ma | 36 + matita/tests/TPTP/Veloci/GRP116-1.p.ma | 36 + matita/tests/TPTP/Veloci/GRP117-1.p.ma | 36 + matita/tests/TPTP/Veloci/GRP118-1.p.ma | 38 + matita/tests/TPTP/Veloci/GRP136-1.p.ma | 119 + matita/tests/TPTP/Veloci/GRP137-1.p.ma | 119 + matita/tests/TPTP/Veloci/GRP139-1.p.ma | 122 + matita/tests/TPTP/Veloci/GRP141-1.p.ma | 122 + matita/tests/TPTP/Veloci/GRP142-1.p.ma | 117 + matita/tests/TPTP/Veloci/GRP143-1.p.ma | 117 + matita/tests/TPTP/Veloci/GRP144-1.p.ma | 117 + matita/tests/TPTP/Veloci/GRP145-1.p.ma | 117 + matita/tests/TPTP/Veloci/GRP146-1.p.ma | 122 + matita/tests/TPTP/Veloci/GRP149-1.p.ma | 122 + matita/tests/TPTP/Veloci/GRP150-1.p.ma | 117 + matita/tests/TPTP/Veloci/GRP151-1.p.ma | 117 + matita/tests/TPTP/Veloci/GRP152-1.p.ma | 117 + matita/tests/TPTP/Veloci/GRP153-1.p.ma | 117 + matita/tests/TPTP/Veloci/GRP154-1.p.ma | 121 + matita/tests/TPTP/Veloci/GRP155-1.p.ma | 119 + matita/tests/TPTP/Veloci/GRP156-1.p.ma | 121 + matita/tests/TPTP/Veloci/GRP157-1.p.ma | 119 + matita/tests/TPTP/Veloci/GRP158-1.p.ma | 119 + matita/tests/TPTP/Veloci/GRP159-1.p.ma | 119 + matita/tests/TPTP/Veloci/GRP160-1.p.ma | 116 + matita/tests/TPTP/Veloci/GRP161-1.p.ma | 116 + matita/tests/TPTP/Veloci/GRP162-1.p.ma | 120 + matita/tests/TPTP/Veloci/GRP163-1.p.ma | 120 + matita/tests/TPTP/Veloci/GRP168-1.p.ma | 123 + matita/tests/TPTP/Veloci/GRP168-2.p.ma | 121 + matita/tests/TPTP/Veloci/GRP173-1.p.ma | 122 + matita/tests/TPTP/Veloci/GRP174-1.p.ma | 119 + matita/tests/TPTP/Veloci/GRP176-1.p.ma | 125 + matita/tests/TPTP/Veloci/GRP176-2.p.ma | 121 + matita/tests/TPTP/Veloci/GRP182-1.p.ma | 127 + matita/tests/TPTP/Veloci/GRP182-2.p.ma | 128 + matita/tests/TPTP/Veloci/GRP182-3.p.ma | 120 + matita/tests/TPTP/Veloci/GRP182-4.p.ma | 121 + matita/tests/TPTP/Veloci/GRP186-3.p.ma | 119 + matita/tests/TPTP/Veloci/GRP186-4.p.ma | 120 + matita/tests/TPTP/Veloci/GRP188-1.p.ma | 118 + matita/tests/TPTP/Veloci/GRP188-2.p.ma | 119 + matita/tests/TPTP/Veloci/GRP189-1.p.ma | 118 + matita/tests/TPTP/Veloci/GRP189-2.p.ma | 119 + matita/tests/TPTP/Veloci/GRP192-1.p.ma | 118 + matita/tests/TPTP/Veloci/GRP206-1.p.ma | 53 + matita/tests/TPTP/Veloci/GRP454-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP455-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP456-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP457-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP458-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP459-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP460-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP463-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP467-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP481-1.p.ma | 42 + matita/tests/TPTP/Veloci/GRP484-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP485-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP486-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP487-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP488-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP490-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP491-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP492-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP493-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP494-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP495-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP496-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP497-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP498-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP509-1.p.ma | 38 + matita/tests/TPTP/Veloci/GRP510-1.p.ma | 38 + matita/tests/TPTP/Veloci/GRP511-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP512-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP513-1.p.ma | 37 + matita/tests/TPTP/Veloci/GRP514-1.p.ma | 37 + matita/tests/TPTP/Veloci/GRP515-1.p.ma | 38 + matita/tests/TPTP/Veloci/GRP516-1.p.ma | 38 + matita/tests/TPTP/Veloci/GRP517-1.p.ma | 37 + matita/tests/TPTP/Veloci/GRP518-1.p.ma | 37 + matita/tests/TPTP/Veloci/GRP520-1.p.ma | 38 + matita/tests/TPTP/Veloci/GRP541-1.p.ma | 42 + matita/tests/TPTP/Veloci/GRP542-1.p.ma | 42 + matita/tests/TPTP/Veloci/GRP543-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP544-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP545-1.p.ma | 42 + matita/tests/TPTP/Veloci/GRP546-1.p.ma | 42 + matita/tests/TPTP/Veloci/GRP547-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP548-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP549-1.p.ma | 42 + matita/tests/TPTP/Veloci/GRP550-1.p.ma | 42 + matita/tests/TPTP/Veloci/GRP551-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP552-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP556-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP558-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP560-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP561-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP562-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP564-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP565-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP566-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP567-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP568-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP569-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP570-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP572-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP573-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP574-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP576-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP577-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP578-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP580-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP581-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP582-1.p.ma | 41 + matita/tests/TPTP/Veloci/GRP583-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP584-1.p.ma | 43 + matita/tests/TPTP/Veloci/GRP586-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP588-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP590-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP592-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP595-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP596-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP597-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP598-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP599-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP600-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP602-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP603-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP604-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP605-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP606-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP608-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP612-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP613-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP614-1.p.ma | 39 + matita/tests/TPTP/Veloci/GRP615-1.p.ma | 40 + matita/tests/TPTP/Veloci/GRP616-1.p.ma | 40 + matita/tests/TPTP/Veloci/LAT008-1.p.ma | 43 + matita/tests/TPTP/Veloci/LAT033-1.p.ma | 46 + matita/tests/TPTP/Veloci/LAT034-1.p.ma | 46 + matita/tests/TPTP/Veloci/LAT039-1.p.ma | 77 + matita/tests/TPTP/Veloci/LAT039-2.p.ma | 76 + matita/tests/TPTP/Veloci/LAT040-1.p.ma | 77 + matita/tests/TPTP/Veloci/LAT045-1.p.ma | 84 + matita/tests/TPTP/Veloci/LCL110-2.p.ma | 71 + matita/tests/TPTP/Veloci/LCL112-2.p.ma | 72 + matita/tests/TPTP/Veloci/LCL113-2.p.ma | 71 + matita/tests/TPTP/Veloci/LCL114-2.p.ma | 72 + matita/tests/TPTP/Veloci/LCL115-2.p.ma | 71 + matita/tests/TPTP/Veloci/LCL132-1.p.ma | 66 + matita/tests/TPTP/Veloci/LCL133-1.p.ma | 68 + matita/tests/TPTP/Veloci/LCL134-1.p.ma | 66 + matita/tests/TPTP/Veloci/LCL135-1.p.ma | 71 + matita/tests/TPTP/Veloci/LCL139-1.p.ma | 66 + matita/tests/TPTP/Veloci/LCL140-1.p.ma | 66 + matita/tests/TPTP/Veloci/LCL141-1.p.ma | 71 + matita/tests/TPTP/Veloci/LCL153-1.p.ma | 136 + matita/tests/TPTP/Veloci/LCL154-1.p.ma | 136 + matita/tests/TPTP/Veloci/LCL155-1.p.ma | 136 + matita/tests/TPTP/Veloci/LCL156-1.p.ma | 136 + matita/tests/TPTP/Veloci/LCL157-1.p.ma | 136 + matita/tests/TPTP/Veloci/LCL158-1.p.ma | 136 + matita/tests/TPTP/Veloci/LCL161-1.p.ma | 85 + matita/tests/TPTP/Veloci/LCL164-1.p.ma | 86 + matita/tests/TPTP/Veloci/LDA001-1.p.ma | 43 + matita/tests/TPTP/Veloci/LDA007-3.p.ma | 51 + matita/tests/TPTP/Veloci/RNG007-4.p.ma | 90 + matita/tests/TPTP/Veloci/RNG008-4.p.ma | 94 + matita/tests/TPTP/Veloci/RNG011-5.p.ma | 83 + matita/tests/TPTP/Veloci/RNG023-6.p.ma | 91 + matita/tests/TPTP/Veloci/RNG023-7.p.ma | 99 + matita/tests/TPTP/Veloci/RNG024-6.p.ma | 91 + matita/tests/TPTP/Veloci/RNG024-7.p.ma | 99 + matita/tests/TPTP/Veloci/ROB002-1.p.ma | 66 + matita/tests/TPTP/Veloci/ROB009-1.p.ma | 65 + matita/tests/TPTP/Veloci/ROB010-1.p.ma | 67 + matita/tests/TPTP/Veloci/ROB013-1.p.ma | 65 + matita/tests/TPTP/Veloci/ROB030-1.p.ma | 75 + matita/tests/TPTP/Veloci/SYN083-1.p.ma | 38 + matita/tests/TPTP/classify.sh | 27 + matita/tests/TPTP/compare.ods | Bin 0 -> 247881 bytes ...letin_sulle_meta_del_body_spacca_tutto.txt | 8 + matita/tests/TPTP/elenco_CASC.txt | 119 + ...o_problemi_rating0_ancora_da_risolvere.txt | 13 + .../TPTP/elenco_problemi_veloci_per_test.txt | 255 + matita/tests/TPTP/elenco_unsatisfiable.txt | 698 ++ matita/tests/TPTP/fetch_results_tptp.lua | 43 + matita/tests/TPTP/hne_problems.txt | 90 + matita/tests/TPTP/log.120.orsay.txt | 698 ++ matita/tests/TPTP/log.300.19-6.txt | 698 ++ matita/tests/TPTP/log.300.26-5.menvcorti | 698 ++ .../TPTP/log.300.26-5.menvcorti.con_rating | 698 ++ .../log.300.27-6.fixprove.fixsimpl-infergoal | 65 + .../log.300.28-6.fixprove.fixsimpl-infergoal | 698 ++ matita/tests/TPTP/log.300.29-5.CASC | 119 + .../log.300.29-6.fix-demodulationgoalwithcurr | 286 + .../TPTP/log.300.30-6.fixdemodgoalinpassive | 18 + ...dasvn_stampapesomassimoeqinprovanellog.txt | 698 ++ .../tests/TPTP/log.600.22-7.matitaprover.txt | 698 ++ .../log.600.30-6.weghtNOTlookingatgoalsymbols | 523 ++ ...log.600.30-6.weghtlookingatgoalsymbols.txt | 698 ++ matita/tests/TPTP/maxweight.txt | 510 ++ matita/tests/TPTP/merge_sorted_logs.awk | 14 + .../tests/TPTP/prova_LAT145_rating_93.tar.gz | Bin 0 -> 36411 bytes matita/tests/TPTP/risultati_CASC_2005.txt | 120 + matita/tests/TPTP/simulate_casc.sh | 7 + matita/tests/TPTP/try.sh | 46 + matita/tests/TPTP/unit_equality_problems.txt | 850 +++ matita/tests/absurd.ma | 26 + matita/tests/apply.ma | 57 + matita/tests/apply2.ma | 24 + matita/tests/applys.ma | 39 + matita/tests/assumption.ma | 39 + matita/tests/bad_induction.ma | 27 + matita/tests/bad_tests/Makefile | 57 + matita/tests/bad_tests/auto.log | 100 + matita/tests/bad_tests/auto.ma | 27 + matita/tests/bad_tests/baseuri.log | 4 + matita/tests/bad_tests/baseuri.ma | 16 + matita/tests/bool.ma | 633 ++ matita/tests/change.ma | 40 + matita/tests/clear.ma | 30 + matita/tests/clearbody.ma | 30 + matita/tests/coercions.ma | 148 + matita/tests/coercions_contravariant.ma | 38 + matita/tests/coercions_dependent.ma | 33 + matita/tests/coercions_dupelim.ma | 31 + matita/tests/coercions_nonuniform.ma | 46 + matita/tests/coercions_open.ma | 38 + matita/tests/coercions_propagation.ma | 138 + matita/tests/coercions_russell.ma | 144 + matita/tests/comments.ma | 36 + matita/tests/compose.ma | 53 + matita/tests/constructor.ma | 23 + matita/tests/continuationals.ma | 80 + matita/tests/contradiction.ma | 31 + matita/tests/cut.ma | 25 + matita/tests/decl.ma | 202 + matita/tests/decompose.ma | 29 + matita/tests/demodulation_coq.ma | 53 + matita/tests/demodulation_matita.ma | 33 + matita/tests/dependent_injection.ma | 48 + matita/tests/dependent_type_inference.ma | 19 + matita/tests/destruct.ma | 95 + matita/tests/elim.ma | 79 + matita/tests/fguidi.ma | 117 + matita/tests/first.ma | 37 + matita/tests/fix_betareduction.ma | 27 + matita/tests/fold.ma | 26 + matita/tests/generalize.ma | 37 + matita/tests/hard_refine.ma | 67 + matita/tests/injection.ma | 62 + .../tests/interactive/automatic_insertion.ma | 17 + matita/tests/interactive/drop.ma | 8 + matita/tests/interactive/grafite.ma | 34 + matita/tests/interactive/test5.ma | 7 + matita/tests/interactive/test6.ma | 7 + matita/tests/interactive/test7.ma | 7 + matita/tests/interactive/test_instance.ma | 16 + matita/tests/inversion.ma | 61 + matita/tests/inversion2.ma | 63 + matita/tests/letrec.ma | 25 + matita/tests/letrecand.ma | 74 + matita/tests/makefile | 37 + matita/tests/match_inference.ma | 52 + matita/tests/metasenv_ordering.ma | 139 + matita/tests/multiple_inheritance.ma | 58 + matita/tests/mysql_escaping.ma | 17 + matita/tests/naiveparamod.ma | 47 + matita/tests/overred.ma | 33 + matita/tests/paramodulation.ma | 32 + matita/tests/paramodulation/BOO075-1.ma | 101 + .../tests/paramodulation/boolean_algebra.ma | 520 ++ matita/tests/paramodulation/group.ma | 51 + matita/tests/paramodulation/irratsqrt2.ma | 160 + matita/tests/pullback.ma | 42 + matita/tests/record.ma | 44 + matita/tests/replace.ma | 39 + matita/tests/rewrite.ma | 71 + matita/tests/second.ma | 24 + matita/tests/simpl.ma | 39 + matita/tests/tacticals.ma | 50 + matita/tests/test2.ma | 26 + matita/tests/test3.ma | 31 + matita/tests/test4.ma | 38 + matita/tests/third.ma | 24 + matita/tests/tinycals.ma | 53 + matita/tests/unfold.ma | 41 + 1716 files changed, 311948 insertions(+) create mode 100644 Makefile create mode 100644 Makefile.defs.in create mode 100644 components/METAS/meta.helm-acic_content.src create mode 100644 components/METAS/meta.helm-acic_procedural.src create mode 100644 components/METAS/meta.helm-cic.src create mode 100644 components/METAS/meta.helm-cic_acic.src create mode 100644 components/METAS/meta.helm-cic_disambiguation.src create mode 100644 components/METAS/meta.helm-cic_exportation.src create mode 100644 components/METAS/meta.helm-cic_proof_checking.src create mode 100644 components/METAS/meta.helm-cic_unification.src create mode 100644 components/METAS/meta.helm-content_pres.src create mode 100644 components/METAS/meta.helm-extlib.src create mode 100644 components/METAS/meta.helm-getter.src create mode 100644 components/METAS/meta.helm-grafite.src create mode 100644 components/METAS/meta.helm-grafite_engine.src create mode 100644 components/METAS/meta.helm-grafite_parser.src create mode 100644 components/METAS/meta.helm-hgdome.src create mode 100644 components/METAS/meta.helm-hmysql.src create mode 100644 components/METAS/meta.helm-lexicon.src create mode 100644 components/METAS/meta.helm-library.src create mode 100644 components/METAS/meta.helm-logger.src create mode 100644 components/METAS/meta.helm-metadata.src create mode 100644 components/METAS/meta.helm-registry.src create mode 100644 components/METAS/meta.helm-syntax_extensions.src create mode 100644 components/METAS/meta.helm-tactics.src create mode 100644 components/METAS/meta.helm-thread.src create mode 100644 components/METAS/meta.helm-tptp_grafite.src create mode 100644 components/METAS/meta.helm-urimanager.src create mode 100644 components/METAS/meta.helm-whelp.src create mode 100644 components/METAS/meta.helm-xml.src create mode 100644 components/METAS/meta.helm-xmldiff.src create mode 100644 components/Makefile create mode 100644 components/Makefile.common create mode 100644 components/STATS/clusters.dot create mode 100644 components/STATS/daemons.dot create mode 100644 components/STATS/deps.patch create mode 100755 components/STATS/patch_deps.sh create mode 100644 components/acic_content/.depend create mode 100644 components/acic_content/.depend.opt create mode 100644 components/acic_content/Makefile create mode 100644 components/acic_content/acic2astMatcher.ml create mode 100644 components/acic_content/acic2astMatcher.mli create mode 100644 components/acic_content/acic2content.ml create mode 100644 components/acic_content/acic2content.mli create mode 100644 components/acic_content/cicNotationEnv.ml create mode 100644 components/acic_content/cicNotationEnv.mli create mode 100644 components/acic_content/cicNotationPp.ml create mode 100644 components/acic_content/cicNotationPp.mli create mode 100644 components/acic_content/cicNotationPt.ml create mode 100644 components/acic_content/cicNotationUtil.ml create mode 100644 components/acic_content/cicNotationUtil.mli create mode 100644 components/acic_content/content.ml create mode 100644 components/acic_content/content.mli create mode 100644 components/acic_content/content2cic.ml create mode 100644 components/acic_content/content2cic.mli create mode 100644 components/acic_content/termAcicContent.ml create mode 100644 components/acic_content/termAcicContent.mli create mode 100644 components/acic_procedural/.depend create mode 100644 components/acic_procedural/.depend.opt create mode 100644 components/acic_procedural/Makefile create mode 100644 components/acic_procedural/acic2Procedural.ml create mode 100644 components/acic_procedural/acic2Procedural.mli create mode 100644 components/acic_procedural/proceduralClassify.ml create mode 100644 components/acic_procedural/proceduralClassify.mli create mode 100644 components/acic_procedural/proceduralConversion.ml create mode 100644 components/acic_procedural/proceduralConversion.mli create mode 100644 components/acic_procedural/proceduralHelpers.ml create mode 100644 components/acic_procedural/proceduralHelpers.mli create mode 100644 components/acic_procedural/proceduralMode.ml create mode 100644 components/acic_procedural/proceduralMode.mli create mode 100644 components/acic_procedural/proceduralOptimizer.ml create mode 100644 components/acic_procedural/proceduralOptimizer.mli create mode 100644 components/acic_procedural/proceduralTypes.ml create mode 100644 components/acic_procedural/proceduralTypes.mli create mode 100644 components/binaries/Makefile create mode 100755 components/binaries/dump_db/dump.sh create mode 100644 components/binaries/extractor/.depend create mode 100644 components/binaries/extractor/.depend.opt create mode 100644 components/binaries/extractor/Makefile create mode 100644 components/binaries/extractor/extractor.conf.xml create mode 100644 components/binaries/extractor/extractor.ml create mode 100644 components/binaries/extractor/extractor_manager.ml create mode 100644 components/binaries/heights/.depend create mode 100644 components/binaries/heights/.depend.opt create mode 100644 components/binaries/heights/Makefile create mode 100644 components/binaries/heights/heights.conf.xml create mode 100644 components/binaries/heights/heights.ml create mode 100644 components/binaries/saturate/Makefile create mode 100644 components/binaries/saturate/saturate_main.ml create mode 100644 components/binaries/table_creator/.depend create mode 100644 components/binaries/table_creator/.depend.opt create mode 100644 components/binaries/table_creator/Makefile create mode 100755 components/binaries/table_creator/sync_db.sh create mode 100644 components/binaries/table_creator/table_creator.ml create mode 100644 components/binaries/transcript/.depend create mode 100644 components/binaries/transcript/.depend.opt create mode 100644 components/binaries/transcript/CoRN.conf.xml create mode 100644 components/binaries/transcript/Makefile create mode 100644 components/binaries/transcript/engine.ml create mode 100644 components/binaries/transcript/engine.mli create mode 100644 components/binaries/transcript/grafite.ml create mode 100644 components/binaries/transcript/grafite.mli create mode 100644 components/binaries/transcript/top.ml create mode 100644 components/binaries/transcript/transcript.conf.xml create mode 100644 components/binaries/transcript/types.ml create mode 100644 components/binaries/transcript/v8Lexer.mll create mode 100644 components/binaries/transcript/v8Parser.mly create mode 100644 components/binaries/utilities/.depend create mode 100644 components/binaries/utilities/.depend.opt create mode 100644 components/binaries/utilities/Makefile create mode 100644 components/binaries/utilities/create_environment.ml create mode 100644 components/binaries/utilities/list_uris.ml create mode 100644 components/binaries/utilities/parse_library.ml create mode 100644 components/binaries/utilities/test_library.ml create mode 100644 components/binaries/utilities/test_xml_parser.ml create mode 100644 components/cic/.depend create mode 100644 components/cic/.depend.opt create mode 100644 components/cic/Makefile create mode 100644 components/cic/cic.ml create mode 100644 components/cic/cicInspect.ml create mode 100644 components/cic/cicInspect.mli create mode 100644 components/cic/cicParser.ml create mode 100644 components/cic/cicParser.mli create mode 100644 components/cic/cicUniv.ml create mode 100644 components/cic/cicUniv.mli create mode 100644 components/cic/cicUtil.ml create mode 100644 components/cic/cicUtil.mli create mode 100644 components/cic/deannotate.ml create mode 100644 components/cic/deannotate.mli create mode 100644 components/cic/discrimination_tree.ml create mode 100644 components/cic/discrimination_tree.mli create mode 100644 components/cic/helmLibraryObjects.ml create mode 100644 components/cic/helmLibraryObjects.mli create mode 100644 components/cic/libraryObjects.ml create mode 100644 components/cic/libraryObjects.mli create mode 100644 components/cic/path_indexing.ml create mode 100644 components/cic/path_indexing.mli create mode 100644 components/cic/unshare.ml create mode 100644 components/cic/unshare.mli create mode 100644 components/cic_acic/.depend create mode 100644 components/cic_acic/.depend.opt create mode 100644 components/cic_acic/Makefile create mode 100644 components/cic_acic/cic2Xml.ml create mode 100644 components/cic_acic/cic2Xml.mli create mode 100644 components/cic_acic/cic2acic.ml create mode 100644 components/cic_acic/cic2acic.mli create mode 100644 components/cic_acic/doubleTypeInference.ml create mode 100644 components/cic_acic/doubleTypeInference.mli create mode 100644 components/cic_acic/eta_fixing.ml create mode 100644 components/cic_acic/eta_fixing.mli create mode 100644 components/cic_disambiguation/.depend create mode 100644 components/cic_disambiguation/.depend.opt create mode 100644 components/cic_disambiguation/Makefile create mode 100644 components/cic_disambiguation/disambiguate.crit2.ml create mode 100644 components/cic_disambiguation/disambiguate.crit4.ml create mode 100644 components/cic_disambiguation/disambiguate.ml create mode 100644 components/cic_disambiguation/disambiguate.mli create mode 100644 components/cic_disambiguation/disambiguateChoices.ml create mode 100644 components/cic_disambiguation/disambiguateChoices.mli create mode 100644 components/cic_disambiguation/disambiguateTypes.ml create mode 100644 components/cic_disambiguation/disambiguateTypes.mli create mode 100644 components/cic_disambiguation/doc/precedence.txt create mode 100644 components/cic_disambiguation/number_notation.ml create mode 100644 components/cic_disambiguation/tests/aliases.txt create mode 100644 components/cic_disambiguation/tests/eq.txt create mode 100644 components/cic_disambiguation/tests/match.txt create mode 100644 components/cic_exportation/.depend create mode 100644 components/cic_exportation/.depend.opt create mode 100644 components/cic_exportation/Makefile create mode 100644 components/cic_exportation/cicExportation.ml create mode 100644 components/cic_exportation/cicExportation.mli create mode 100644 components/cic_proof_checking/.depend create mode 100644 components/cic_proof_checking/.depend.opt create mode 100644 components/cic_proof_checking/Makefile create mode 100644 components/cic_proof_checking/cicEnvironment.ml create mode 100644 components/cic_proof_checking/cicEnvironment.mli create mode 100644 components/cic_proof_checking/cicLogger.ml create mode 100644 components/cic_proof_checking/cicLogger.mli create mode 100644 components/cic_proof_checking/cicMiniReduction.ml create mode 100644 components/cic_proof_checking/cicMiniReduction.mli create mode 100644 components/cic_proof_checking/cicPp.ml create mode 100644 components/cic_proof_checking/cicPp.mli create mode 100644 components/cic_proof_checking/cicReduction.ml create mode 100644 components/cic_proof_checking/cicReduction.mli create mode 100644 components/cic_proof_checking/cicSubstitution.ml create mode 100644 components/cic_proof_checking/cicSubstitution.mli create mode 100644 components/cic_proof_checking/cicTypeChecker.ml create mode 100644 components/cic_proof_checking/cicTypeChecker.mli create mode 100644 components/cic_proof_checking/cicUnivUtils.ml create mode 100644 components/cic_proof_checking/cicUnivUtils.mli create mode 100644 components/cic_proof_checking/doc/inductive.txt create mode 100755 components/cic_proof_checking/freshNamesGenerator.ml create mode 100644 components/cic_proof_checking/freshNamesGenerator.mli create mode 100644 components/cic_unification/.depend create mode 100644 components/cic_unification/.depend.opt create mode 100644 components/cic_unification/Makefile create mode 100644 components/cic_unification/cicMetaSubst.ml create mode 100644 components/cic_unification/cicMetaSubst.mli create mode 100644 components/cic_unification/cicMkImplicit.ml create mode 100644 components/cic_unification/cicMkImplicit.mli create mode 100644 components/cic_unification/cicRefine.ml create mode 100644 components/cic_unification/cicRefine.mli create mode 100644 components/cic_unification/cicReplace.ml create mode 100644 components/cic_unification/cicReplace.mli create mode 100644 components/cic_unification/cicUnification.ml create mode 100644 components/cic_unification/cicUnification.mli create mode 100644 components/cic_unification/coercGraph.ml create mode 100644 components/cic_unification/coercGraph.mli create mode 100644 components/cic_unification/termUtil.ml create mode 100644 components/cic_unification/termUtil.mli create mode 100644 components/content_pres/.depend create mode 100644 components/content_pres/.depend.opt create mode 100644 components/content_pres/Makefile create mode 100644 components/content_pres/box.ml create mode 100644 components/content_pres/box.mli create mode 100644 components/content_pres/boxPp.ml create mode 100644 components/content_pres/boxPp.mli create mode 100644 components/content_pres/cicNotationLexer.ml create mode 100644 components/content_pres/cicNotationLexer.mli create mode 100644 components/content_pres/cicNotationParser.ml create mode 100644 components/content_pres/cicNotationParser.mli create mode 100644 components/content_pres/cicNotationPres.ml create mode 100644 components/content_pres/cicNotationPres.mli create mode 100644 components/content_pres/content2pres.ml create mode 100644 components/content_pres/content2pres.mli create mode 100644 components/content_pres/content2presMatcher.ml create mode 100644 components/content_pres/content2presMatcher.mli create mode 100644 components/content_pres/mpresentation.ml create mode 100644 components/content_pres/mpresentation.mli create mode 100644 components/content_pres/renderingAttrs.ml create mode 100644 components/content_pres/renderingAttrs.mli create mode 100644 components/content_pres/sequent2pres.ml create mode 100644 components/content_pres/sequent2pres.mli create mode 100644 components/content_pres/termContentPres.ml create mode 100644 components/content_pres/termContentPres.mli create mode 100644 components/content_pres/test_lexer.ml create mode 100644 components/extlib/.depend create mode 100644 components/extlib/.depend.opt create mode 100644 components/extlib/Makefile create mode 100644 components/extlib/componentsConf.ml.in create mode 100644 components/extlib/componentsConf.mli create mode 100644 components/extlib/graphvizPp.ml create mode 100644 components/extlib/graphvizPp.mli create mode 100644 components/extlib/hExtlib.ml create mode 100644 components/extlib/hExtlib.mli create mode 100644 components/extlib/hLog.ml create mode 100644 components/extlib/hLog.mli create mode 100644 components/extlib/hMarshal.ml create mode 100644 components/extlib/hMarshal.mli create mode 100644 components/extlib/hTopoSort.ml create mode 100644 components/extlib/hTopoSort.mli create mode 100644 components/extlib/patternMatcher.ml create mode 100644 components/extlib/patternMatcher.mli create mode 100644 components/extlib/refCounter.ml create mode 100644 components/extlib/refCounter.mli create mode 100644 components/extlib/trie.ml create mode 100644 components/extlib/trie.mli create mode 100644 components/getter/.depend create mode 100644 components/getter/.depend.opt create mode 100644 components/getter/.ocamlinit create mode 100644 components/getter/Makefile create mode 100644 components/getter/http_getter.ml create mode 100644 components/getter/http_getter.mli create mode 100644 components/getter/http_getter_common.ml create mode 100644 components/getter/http_getter_common.mli create mode 100644 components/getter/http_getter_const.ml create mode 100644 components/getter/http_getter_const.mli create mode 100644 components/getter/http_getter_env.ml create mode 100644 components/getter/http_getter_env.mli create mode 100644 components/getter/http_getter_logger.ml create mode 100644 components/getter/http_getter_logger.mli create mode 100644 components/getter/http_getter_misc.ml create mode 100644 components/getter/http_getter_misc.mli create mode 100644 components/getter/http_getter_storage.ml create mode 100644 components/getter/http_getter_storage.mli create mode 100644 components/getter/http_getter_types.ml create mode 100644 components/getter/http_getter_wget.ml create mode 100644 components/getter/http_getter_wget.mli create mode 100755 components/getter/mkindexes.pl create mode 100644 components/getter/sample.conf.xml create mode 100644 components/getter/test.ml create mode 100644 components/grafite/.depend create mode 100644 components/grafite/.depend.opt create mode 100644 components/grafite/Makefile create mode 100644 components/grafite/grafiteAst.ml create mode 100644 components/grafite/grafiteAstPp.ml create mode 100644 components/grafite/grafiteAstPp.mli create mode 100644 components/grafite/grafiteMarshal.ml create mode 100644 components/grafite/grafiteMarshal.mli create mode 100644 components/grafite_engine/.depend create mode 100644 components/grafite_engine/.depend.opt create mode 100644 components/grafite_engine/Makefile create mode 100644 components/grafite_engine/grafiteEngine.ml create mode 100644 components/grafite_engine/grafiteEngine.mli create mode 100644 components/grafite_engine/grafiteSync.ml create mode 100644 components/grafite_engine/grafiteSync.mli create mode 100644 components/grafite_engine/grafiteTypes.ml create mode 100644 components/grafite_engine/grafiteTypes.mli create mode 100644 components/grafite_parser/.depend create mode 100644 components/grafite_parser/.depend.opt create mode 100644 components/grafite_parser/Makefile create mode 100644 components/grafite_parser/cicNotation2.ml create mode 100644 components/grafite_parser/cicNotation2.mli create mode 100644 components/grafite_parser/dependenciesParser.ml create mode 100644 components/grafite_parser/dependenciesParser.mli create mode 100644 components/grafite_parser/grafiteDisambiguate.ml create mode 100644 components/grafite_parser/grafiteDisambiguate.mli create mode 100644 components/grafite_parser/grafiteDisambiguator.ml create mode 100644 components/grafite_parser/grafiteDisambiguator.mli create mode 100644 components/grafite_parser/grafiteParser.ml create mode 100644 components/grafite_parser/grafiteParser.mli create mode 100644 components/grafite_parser/grafiteWalker.ml create mode 100644 components/grafite_parser/grafiteWalker.mli create mode 100644 components/grafite_parser/print_grammar.ml create mode 100644 components/grafite_parser/test_dep.ml create mode 100644 components/grafite_parser/test_parser.ml create mode 100644 components/hbugs/.depend create mode 100644 components/hbugs/Makefile create mode 100644 components/hbugs/broker.ml create mode 100644 components/hbugs/client.ml create mode 100644 components/hbugs/data/hbugs_tutor.TPL.ml create mode 100644 components/hbugs/data/tutors_index.xml create mode 100644 components/hbugs/doc/hbugs.dia create mode 100644 components/hbugs/hbugs_broker_registry.ml create mode 100644 components/hbugs/hbugs_broker_registry.mli create mode 100644 components/hbugs/hbugs_client.ml create mode 100644 components/hbugs/hbugs_client.mli create mode 100644 components/hbugs/hbugs_client_gui.glade create mode 100644 components/hbugs/hbugs_common.ml create mode 100644 components/hbugs/hbugs_common.mli create mode 100644 components/hbugs/hbugs_id_generator.ml create mode 100644 components/hbugs/hbugs_id_generator.mli create mode 100644 components/hbugs/hbugs_messages.ml create mode 100644 components/hbugs/hbugs_messages.mli create mode 100644 components/hbugs/hbugs_misc.ml create mode 100644 components/hbugs/hbugs_misc.mli create mode 100644 components/hbugs/hbugs_tutors.ml create mode 100644 components/hbugs/hbugs_tutors.mli create mode 100644 components/hbugs/hbugs_types.mli create mode 100755 components/hbugs/scripts/brokerctl.sh create mode 100755 components/hbugs/scripts/build_tutors.ml create mode 100755 components/hbugs/scripts/ls_tutors.ml create mode 100755 components/hbugs/scripts/sabba.sh create mode 100644 components/hbugs/search_pattern_apply_tutor.ml create mode 100644 components/hbugs/test/HBUGS_MESSAGES.xml create mode 100644 components/hbugs/test/Makefile create mode 100644 components/hbugs/test/test_serialization.ml create mode 100644 components/hgdome/.depend create mode 100644 components/hgdome/.depend.opt create mode 100644 components/hgdome/Makefile create mode 100644 components/hgdome/domMisc.ml create mode 100644 components/hgdome/domMisc.mli create mode 100644 components/hgdome/xml2Gdome.ml create mode 100644 components/hgdome/xml2Gdome.mli create mode 100644 components/hmysql/.depend create mode 100644 components/hmysql/.depend.opt create mode 100644 components/hmysql/Makefile create mode 100644 components/hmysql/hMysql.ml create mode 100644 components/hmysql/hSql.ml create mode 100644 components/hmysql/hSql.mli create mode 100644 components/hmysql/hSqlite3.ml create mode 100644 components/lexicon/.depend create mode 100644 components/lexicon/.depend.opt create mode 100644 components/lexicon/Makefile create mode 100644 components/lexicon/cicNotation.ml create mode 100644 components/lexicon/cicNotation.mli create mode 100644 components/lexicon/disambiguatePp.ml create mode 100644 components/lexicon/disambiguatePp.mli create mode 100644 components/lexicon/lexiconAst.ml create mode 100644 components/lexicon/lexiconAstPp.ml create mode 100644 components/lexicon/lexiconAstPp.mli create mode 100644 components/lexicon/lexiconEngine.ml create mode 100644 components/lexicon/lexiconEngine.mli create mode 100644 components/lexicon/lexiconMarshal.ml create mode 100644 components/lexicon/lexiconMarshal.mli create mode 100644 components/lexicon/lexiconSync.ml create mode 100644 components/lexicon/lexiconSync.mli create mode 100644 components/library/.depend create mode 100644 components/library/.depend.opt create mode 100644 components/library/Makefile create mode 100644 components/library/cicCoercion.ml create mode 100644 components/library/cicCoercion.mli create mode 100644 components/library/cicElim.ml create mode 100644 components/library/cicElim.mli create mode 100644 components/library/cicRecord.ml create mode 100644 components/library/cicRecord.mli create mode 100644 components/library/coercDb.ml create mode 100644 components/library/coercDb.mli create mode 100644 components/library/libraryClean.ml create mode 100644 components/library/libraryClean.mli create mode 100644 components/library/libraryDb.ml create mode 100644 components/library/libraryDb.mli create mode 100644 components/library/libraryMisc.ml create mode 100644 components/library/libraryMisc.mli create mode 100644 components/library/librarySync.ml create mode 100644 components/library/librarySync.mli create mode 100644 components/library/refinementTool.ml create mode 100644 components/license create mode 100644 components/logger/.depend create mode 100644 components/logger/.depend.opt create mode 100644 components/logger/Makefile create mode 100644 components/logger/helmLogger.ml create mode 100644 components/logger/helmLogger.mli create mode 100644 components/metadata/.depend create mode 100644 components/metadata/.depend.opt create mode 100644 components/metadata/Makefile create mode 100644 components/metadata/metadataConstraints.ml create mode 100644 components/metadata/metadataConstraints.mli create mode 100644 components/metadata/metadataDb.ml create mode 100644 components/metadata/metadataDb.mli create mode 100644 components/metadata/metadataDeps.ml create mode 100644 components/metadata/metadataDeps.mli create mode 100644 components/metadata/metadataExtractor.ml create mode 100644 components/metadata/metadataExtractor.mli create mode 100644 components/metadata/metadataPp.ml create mode 100644 components/metadata/metadataPp.mli create mode 100644 components/metadata/metadataTypes.ml create mode 100644 components/metadata/metadataTypes.mli create mode 100644 components/metadata/sqlStatements.ml create mode 100644 components/metadata/sqlStatements.mli create mode 100644 components/registry/.depend create mode 100644 components/registry/.depend.opt create mode 100644 components/registry/.ocamlinit create mode 100644 components/registry/Makefile create mode 100644 components/registry/helm_registry.ml create mode 100644 components/registry/helm_registry.mli create mode 100644 components/registry/test.ml create mode 100644 components/registry/tests/sample.xml create mode 100644 components/registry/tests/sample_include.xml create mode 100644 components/syntax_extensions/.depend create mode 100644 components/syntax_extensions/.depend.opt create mode 100644 components/syntax_extensions/Makefile create mode 100644 components/syntax_extensions/README.syntax create mode 100644 components/syntax_extensions/data/dictionary-tex.xml create mode 100644 components/syntax_extensions/data/entities-table.xml create mode 100644 components/syntax_extensions/data/extra-entities.xml create mode 100644 components/syntax_extensions/make_table.ml create mode 100644 components/syntax_extensions/pa_unicode_macro.ml create mode 100644 components/syntax_extensions/profiling_macros.ml create mode 100644 components/syntax_extensions/test.ml create mode 100644 components/syntax_extensions/utf8Macro.ml create mode 100644 components/syntax_extensions/utf8Macro.mli create mode 100644 components/syntax_extensions/utf8MacroTable.ml create mode 100644 components/syntax_extensions/utf8MacroTable.ml.txt create mode 100644 components/tactics/.depend create mode 100644 components/tactics/.depend.opt create mode 100644 components/tactics/Makefile create mode 100644 components/tactics/auto.ml create mode 100644 components/tactics/auto.mli create mode 100644 components/tactics/autoCache.ml create mode 100644 components/tactics/autoCache.mli create mode 100644 components/tactics/autoTypes.ml create mode 100644 components/tactics/autoTypes.mli create mode 100644 components/tactics/closeCoercionGraph.ml create mode 100644 components/tactics/closeCoercionGraph.mli create mode 100644 components/tactics/compose.ml create mode 100644 components/tactics/compose.mli create mode 100644 components/tactics/continuationals.ml create mode 100644 components/tactics/continuationals.mli create mode 100644 components/tactics/declarative.ml create mode 100644 components/tactics/declarative.mli create mode 100644 components/tactics/destructTactic.ml create mode 100644 components/tactics/destructTactic.mli create mode 100644 components/tactics/doc/Makefile create mode 100644 components/tactics/doc/body.tex create mode 100644 components/tactics/doc/infernce.sty create mode 100644 components/tactics/doc/ligature.sty create mode 100644 components/tactics/doc/main.tex create mode 100644 components/tactics/doc/reserved.sty create mode 100644 components/tactics/doc/semantic.sty create mode 100644 components/tactics/doc/shrthand.sty create mode 100644 components/tactics/doc/tdiagram.sty create mode 100644 components/tactics/eliminationTactics.ml create mode 100644 components/tactics/eliminationTactics.mli create mode 100644 components/tactics/equalityTactics.ml create mode 100644 components/tactics/equalityTactics.mli create mode 100644 components/tactics/fourier.ml create mode 100644 components/tactics/fourier.mli create mode 100644 components/tactics/fourierR.ml create mode 100644 components/tactics/fourierR.mli create mode 100644 components/tactics/fwdSimplTactic.ml create mode 100644 components/tactics/fwdSimplTactic.mli create mode 100644 components/tactics/hashtbl_equiv.ml create mode 100644 components/tactics/hashtbl_equiv.mli create mode 100644 components/tactics/history.ml create mode 100644 components/tactics/history.mli create mode 100644 components/tactics/introductionTactics.ml create mode 100644 components/tactics/introductionTactics.mli create mode 100644 components/tactics/inversion.ml create mode 100644 components/tactics/inversion.mli create mode 100644 components/tactics/inversion_principle.ml create mode 100644 components/tactics/inversion_principle.mli create mode 100644 components/tactics/metadataQuery.ml create mode 100644 components/tactics/metadataQuery.mli create mode 100644 components/tactics/negationTactics.ml create mode 100644 components/tactics/negationTactics.mli create mode 100644 components/tactics/paramodulation/.depend create mode 100644 components/tactics/paramodulation/Makefile create mode 100644 components/tactics/paramodulation/README create mode 100644 components/tactics/paramodulation/equality.ml create mode 100644 components/tactics/paramodulation/equality.mli create mode 100644 components/tactics/paramodulation/equality_indexing.ml create mode 100644 components/tactics/paramodulation/equality_indexing.mli create mode 100644 components/tactics/paramodulation/founif.ml create mode 100644 components/tactics/paramodulation/founif.mli create mode 100644 components/tactics/paramodulation/indexing.ml create mode 100644 components/tactics/paramodulation/indexing.mli create mode 100644 components/tactics/paramodulation/saturation.ml create mode 100644 components/tactics/paramodulation/saturation.mli create mode 100644 components/tactics/paramodulation/subst.ml create mode 100644 components/tactics/paramodulation/subst.mli create mode 100644 components/tactics/paramodulation/test_indexing.ml create mode 100644 components/tactics/paramodulation/utils.ml create mode 100644 components/tactics/paramodulation/utils.mli create mode 100644 components/tactics/primitiveTactics.ml create mode 100644 components/tactics/primitiveTactics.mli create mode 100644 components/tactics/proofEngineHelpers.ml create mode 100644 components/tactics/proofEngineHelpers.mli create mode 100644 components/tactics/proofEngineReduction.ml create mode 100644 components/tactics/proofEngineReduction.mli create mode 100644 components/tactics/proofEngineStructuralRules.ml create mode 100644 components/tactics/proofEngineStructuralRules.mli create mode 100644 components/tactics/proofEngineTypes.ml create mode 100644 components/tactics/proofEngineTypes.mli create mode 100644 components/tactics/reductionTactics.ml create mode 100644 components/tactics/reductionTactics.mli create mode 100644 components/tactics/ring.ml create mode 100644 components/tactics/ring.mli create mode 100644 components/tactics/setoids.ml create mode 100644 components/tactics/setoids.mli create mode 100644 components/tactics/statefulProofEngine.ml create mode 100644 components/tactics/statefulProofEngine.mli create mode 100644 components/tactics/tacticChaser.ml create mode 100644 components/tactics/tacticals.ml create mode 100644 components/tactics/tacticals.mli create mode 100644 components/tactics/tactics.ml create mode 100644 components/tactics/tactics.mli create mode 100644 components/tactics/universe.ml create mode 100644 components/tactics/universe.mli create mode 100644 components/tactics/variousTactics.ml create mode 100644 components/tactics/variousTactics.mli create mode 100644 components/thread/.depend create mode 100644 components/thread/.depend.opt create mode 100644 components/thread/Makefile create mode 100644 components/thread/extThread.ml create mode 100644 components/thread/extThread.mli create mode 100644 components/thread/fake/threadSafe.ml create mode 100644 components/thread/fake/threadSafe.mli create mode 100644 components/thread/threadSafe.ml create mode 100644 components/thread/threadSafe.mli create mode 100644 components/tptp_grafite/.depend create mode 100644 components/tptp_grafite/.depend.opt create mode 100644 components/tptp_grafite/Makefile create mode 100644 components/tptp_grafite/ast.ml create mode 100644 components/tptp_grafite/heq_problems create mode 100644 components/tptp_grafite/hne_problems create mode 100644 components/tptp_grafite/lexer.mll create mode 100644 components/tptp_grafite/main.ml create mode 100644 components/tptp_grafite/parser.mly create mode 100644 components/tptp_grafite/tptp2grafite.ml create mode 100644 components/tptp_grafite/tptp2grafite.mli create mode 100644 components/tptp_grafite/unit_equality_problems create mode 100644 components/urimanager/.depend create mode 100644 components/urimanager/.depend.opt create mode 100644 components/urimanager/Makefile create mode 100644 components/urimanager/uriManager.ml create mode 100644 components/urimanager/uriManager.mli create mode 100644 components/whelp/.depend create mode 100644 components/whelp/.depend.opt create mode 100644 components/whelp/Makefile create mode 100644 components/whelp/fwdQueries.ml create mode 100644 components/whelp/fwdQueries.mli create mode 100644 components/whelp/whelp.ml create mode 100644 components/whelp/whelp.mli create mode 100644 components/xml/.depend create mode 100644 components/xml/.depend.opt create mode 100644 components/xml/Makefile create mode 100644 components/xml/test.ml create mode 100644 components/xml/xml.ml create mode 100644 components/xml/xml.mli create mode 100644 components/xml/xmlPushParser.ml create mode 100644 components/xml/xmlPushParser.mli create mode 100644 components/xmldiff/.depend create mode 100644 components/xmldiff/.depend.opt create mode 100644 components/xmldiff/Makefile create mode 100644 components/xmldiff/xmlDiff.ml create mode 100644 components/xmldiff/xmlDiff.mli create mode 100644 configure.ac create mode 100644 make/main.ml create mode 100644 make/make.ml create mode 100644 make/make.mli create mode 100644 make/test/a.c create mode 100644 make/test/b.c create mode 100644 make/test/c.c create mode 100644 make/test/d.c create mode 100644 make/test/e.c create mode 100644 matita/.depend create mode 100644 matita/.depend.opt create mode 100644 matita/.ocamlinit create mode 100644 matita/AUTHORS create mode 100644 matita/LICENSE create mode 100644 matita/Makefile create mode 100644 matita/applyTransformation.ml create mode 100644 matita/applyTransformation.mli create mode 100755 matita/bench_disamberrors create mode 100755 matita/bench_summary.py create mode 100644 matita/buildTimeConf.ml.in create mode 100644 matita/closed.xml create mode 100644 matita/contribs/CoRN-Decl/CoRN.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/Basics.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CAbGroups.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CAbMonoids.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CFields.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CGroups.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CLogic.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CMonoids.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/COrdAbs.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/COrdCauchy.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/COrdFields.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/COrdFields2.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CPoly_ApZero.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CPoly_Degree.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CPoly_NthCoeff.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CPolynomials.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CRings.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CSemiGroups.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CSetoidFun.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CSetoidInc.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CSetoids.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CSums.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/CVectorSpace.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/Cauchy_COF.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/Expon.ma create mode 100644 matita/contribs/CoRN-Decl/algebra/ListType.ma create mode 100644 matita/contribs/CoRN-Decl/complex/AbsCC.ma create mode 100644 matita/contribs/CoRN-Decl/complex/CComplex.ma create mode 100644 matita/contribs/CoRN-Decl/complex/Complex_Exponential.ma create mode 100644 matita/contribs/CoRN-Decl/complex/NRootCC.ma create mode 100644 matita/contribs/CoRN-Decl/devel/loeb/IDA/Ch6.ma create mode 100644 matita/contribs/CoRN-Decl/devel/loeb/per/csetfun.ma create mode 100644 matita/contribs/CoRN-Decl/devel/loeb/per/lst2fun.ma create mode 100644 matita/contribs/CoRN-Decl/fta/CC_Props.ma create mode 100644 matita/contribs/CoRN-Decl/fta/CPoly_Contin1.ma create mode 100644 matita/contribs/CoRN-Decl/fta/CPoly_Rev.ma create mode 100644 matita/contribs/CoRN-Decl/fta/CPoly_Shift.ma create mode 100644 matita/contribs/CoRN-Decl/fta/FTA.ma create mode 100644 matita/contribs/CoRN-Decl/fta/FTAreg.ma create mode 100644 matita/contribs/CoRN-Decl/fta/KeyLemma.ma create mode 100644 matita/contribs/CoRN-Decl/fta/KneserLemma.ma create mode 100644 matita/contribs/CoRN-Decl/fta/MainLemma.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/COrdLemmas.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/CalculusTheorems.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/Composition.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/Continuity.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/Derivative.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/DerivativeOps.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/Differentiability.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/FTC.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/FunctSequence.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/FunctSeries.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/FunctSums.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/Integral.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/IntervalFunct.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/MoreFunSeries.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/MoreFunctions.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/MoreIntegrals.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/MoreIntervals.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/NthDerivative.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/PartFunEquality.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/PartInterval.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/Partitions.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/RefLemma.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/RefSepRef.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/RefSeparated.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/RefSeparating.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/Rolle.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/StrongIVT.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/Taylor.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/TaylorLemma.ma create mode 100644 matita/contribs/CoRN-Decl/ftc/WeakIVT.ma create mode 100644 matita/contribs/CoRN-Decl/makefile create mode 100644 matita/contribs/CoRN-Decl/metrics/CMetricSpaces.ma create mode 100644 matita/contribs/CoRN-Decl/metrics/CPMSTheory.ma create mode 100644 matita/contribs/CoRN-Decl/metrics/CPseudoMSpaces.ma create mode 100644 matita/contribs/CoRN-Decl/metrics/ContFunctions.ma create mode 100644 matita/contribs/CoRN-Decl/metrics/Equiv.ma create mode 100644 matita/contribs/CoRN-Decl/metrics/IR_CPMSpace.ma create mode 100644 matita/contribs/CoRN-Decl/metrics/Prod_Sub.ma create mode 100644 matita/contribs/CoRN-Decl/model/abgroups/QSposabgroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/abgroups/Qabgroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/abgroups/Qposabgroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/abgroups/Zabgroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/fields/Qfield.ma create mode 100644 matita/contribs/CoRN-Decl/model/groups/QSposgroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/groups/Qgroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/groups/Qposgroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/groups/Zgroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/monoids/Nmonoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/monoids/Nposmonoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/monoids/QSposmonoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/monoids/Qmonoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/monoids/Qposmonoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/monoids/Zmonoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/non_examples/N_no_group.ma create mode 100644 matita/contribs/CoRN-Decl/model/non_examples/Npos_no_group.ma create mode 100644 matita/contribs/CoRN-Decl/model/non_examples/Npos_no_monoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/ordfields/Qordfield.ma create mode 100644 matita/contribs/CoRN-Decl/model/reals/Cauchy_IR.ma create mode 100644 matita/contribs/CoRN-Decl/model/rings/Qring.ma create mode 100644 matita/contribs/CoRN-Decl/model/rings/Zring.ma create mode 100644 matita/contribs/CoRN-Decl/model/semigroups/Npossemigroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/semigroups/Nsemigroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/semigroups/QSpossemigroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/semigroups/Qpossemigroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/semigroups/Qsemigroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/semigroups/Zsemigroup.ma create mode 100644 matita/contribs/CoRN-Decl/model/setoids/Npossetoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/setoids/Nsetoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/setoids/Qpossetoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/setoids/Qsetoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/setoids/Zsetoid.ma create mode 100644 matita/contribs/CoRN-Decl/model/structures/Npossec.ma create mode 100644 matita/contribs/CoRN-Decl/model/structures/Nsec.ma create mode 100644 matita/contribs/CoRN-Decl/model/structures/Qpossec.ma create mode 100644 matita/contribs/CoRN-Decl/model/structures/Qsec.ma create mode 100644 matita/contribs/CoRN-Decl/model/structures/Zsec.ma create mode 100644 matita/contribs/CoRN-Decl/ordine_compilazione.txt create mode 100644 matita/contribs/CoRN-Decl/preamble.ma create mode 100644 matita/contribs/CoRN-Decl/reals/Bridges_LUB.ma create mode 100644 matita/contribs/CoRN-Decl/reals/Bridges_iso.ma create mode 100644 matita/contribs/CoRN-Decl/reals/CMetricFields.ma create mode 100644 matita/contribs/CoRN-Decl/reals/CPoly_Contin.ma create mode 100644 matita/contribs/CoRN-Decl/reals/CReals.ma create mode 100644 matita/contribs/CoRN-Decl/reals/CReals1.ma create mode 100644 matita/contribs/CoRN-Decl/reals/CSumsReals.ma create mode 100644 matita/contribs/CoRN-Decl/reals/CauchySeq.ma create mode 100644 matita/contribs/CoRN-Decl/reals/Cauchy_CReals.ma create mode 100644 matita/contribs/CoRN-Decl/reals/IVT.ma create mode 100644 matita/contribs/CoRN-Decl/reals/Intervals.ma create mode 100644 matita/contribs/CoRN-Decl/reals/Max_AbsIR.ma create mode 100644 matita/contribs/CoRN-Decl/reals/NRootIR.ma create mode 100644 matita/contribs/CoRN-Decl/reals/OddPolyRootIR.ma create mode 100644 matita/contribs/CoRN-Decl/reals/Q_dense.ma create mode 100644 matita/contribs/CoRN-Decl/reals/Q_in_CReals.ma create mode 100644 matita/contribs/CoRN-Decl/reals/R_morphism.ma create mode 100644 matita/contribs/CoRN-Decl/reals/RealFuncts.ma create mode 100644 matita/contribs/CoRN-Decl/reals/RealLists.ma create mode 100644 matita/contribs/CoRN-Decl/reals/Series.ma create mode 100644 matita/contribs/CoRN-Decl/reals/iso_CReals.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/AlgReflection.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/DiffTactics1.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/DiffTactics2.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/DiffTactics3.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/FieldReflection.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/GroupReflection.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/Opaque_algebra.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/RingReflection.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/Step.ma create mode 100644 matita/contribs/CoRN-Decl/tactics/Transparent_algebra.ma create mode 100644 matita/contribs/CoRN-Decl/transc/Exponential.ma create mode 100644 matita/contribs/CoRN-Decl/transc/InvTrigonom.ma create mode 100644 matita/contribs/CoRN-Decl/transc/Pi.ma create mode 100644 matita/contribs/CoRN-Decl/transc/PowerSeries.ma create mode 100644 matita/contribs/CoRN-Decl/transc/RealPowers.ma create mode 100644 matita/contribs/CoRN-Decl/transc/SinCos.ma create mode 100644 matita/contribs/CoRN-Decl/transc/TaylorSeries.ma create mode 100644 matita/contribs/CoRN-Decl/transc/TrigMon.ma create mode 100644 matita/contribs/CoRN-Decl/transc/Trigonometric.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/blt/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/blt/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/definitions.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/ext/arith.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/ext/tactics.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/makefile create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/plist/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/plist/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/preamble.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/spare.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/theory.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/types/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-1/types/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/blt/defs.mma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/blt/props.mma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/depend create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/ext/arith.mma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/ext/tactics.mma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/log.txt create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/makefile create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/plist/defs.mma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/plist/props.mma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/preamble.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/theory.mma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/types/defs.mma create mode 100644 matita/contribs/LAMBDA-TYPES/Base-2/types/props.mma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/A/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/G/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/dec.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/aprem.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/cimp.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/lift1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/pr3.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/subst0.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/drop.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/getl.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/arity.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/clear.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/drop.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/getl.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/arity.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/clear.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/csuba.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/getl.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/clear.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/drop.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/getl.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/getl.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/clear.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/drop.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/getl.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/pc3.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/ty3.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/definitions.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/getl.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/clear.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/dec.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/drop.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/flt.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/getl.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/asucc.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/tlt.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/makefile create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/arity.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/dec.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/iso.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/lift1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/pr3.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/dec.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fsubst0.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/left.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/nf2.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/pc1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/subst1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/wcpr0.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/dec.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/pr0.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/subst1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/pr1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/clen.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/pr2.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/subst1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/iso.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr3.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/subst1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/wcpr0.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/preamble.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/arity.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/lift1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/nf2.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/spare.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/dec.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/subst0.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/tlt.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/subst1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/cnt.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/theory.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity_props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/dec.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fsubst0.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/nf2.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3_props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/subst1.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/tau0.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/fwd.ma create mode 100644 matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/getl.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Makefile create mode 100644 matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/defs.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/fun.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/inv.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/props.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Context.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Term.ma create mode 100644 matita/contribs/LAMBDA-TYPES/Unified-Sub/makefile create mode 100644 matita/contribs/LAMBDA-TYPES/Unified-Sub/preamble.ma create mode 100644 matita/contribs/LOGIC/CLE/defs.ma create mode 100644 matita/contribs/LOGIC/Insert/defs.ma create mode 100644 matita/contribs/LOGIC/Insert/fun.ma create mode 100644 matita/contribs/LOGIC/Insert/inv.ma create mode 100644 matita/contribs/LOGIC/Insert/props.ma create mode 100644 matita/contribs/LOGIC/Lift/defs.ma create mode 100644 matita/contribs/LOGIC/NTrack/defs.ma create mode 100644 matita/contribs/LOGIC/NTrack/inv.ma create mode 100644 matita/contribs/LOGIC/NTrack/order.ma create mode 100644 matita/contribs/LOGIC/NTrack/props.ma create mode 100644 matita/contribs/LOGIC/PEq/defs.ma create mode 100644 matita/contribs/LOGIC/PNF/defs.ma create mode 100644 matita/contribs/LOGIC/PRed/defs.ma create mode 100644 matita/contribs/LOGIC/PRed/wlt.ma create mode 100644 matita/contribs/LOGIC/Track/defs.ma create mode 100644 matita/contribs/LOGIC/Track/inv.ma create mode 100644 matita/contribs/LOGIC/Track/order.ma create mode 100644 matita/contribs/LOGIC/Track/pred.ma create mode 100644 matita/contribs/LOGIC/WLT/defs.ma create mode 100644 matita/contribs/LOGIC/Weight/defs.ma create mode 100644 matita/contribs/LOGIC/datatypes_defs/Context.ma create mode 100644 matita/contribs/LOGIC/datatypes_defs/Formula.ma create mode 100644 matita/contribs/LOGIC/datatypes_defs/Proof.ma create mode 100644 matita/contribs/LOGIC/datatypes_defs/Sequent.ma create mode 100644 matita/contribs/LOGIC/datatypes_props/Sequent.ma create mode 100644 matita/contribs/LOGIC/makefile create mode 100644 matita/contribs/LOGIC/preamble.ma create mode 100644 matita/contribs/Makefile create mode 100644 matita/contribs/PREDICATIVE-TOPOLOGY/class_defs.ma create mode 100644 matita/contribs/PREDICATIVE-TOPOLOGY/class_eq.ma create mode 100644 matita/contribs/PREDICATIVE-TOPOLOGY/coa_defs.ma create mode 100644 matita/contribs/PREDICATIVE-TOPOLOGY/coa_props.ma create mode 100644 matita/contribs/PREDICATIVE-TOPOLOGY/domain_data.ma create mode 100644 matita/contribs/PREDICATIVE-TOPOLOGY/domain_defs.ma create mode 100644 matita/contribs/PREDICATIVE-TOPOLOGY/iff.ma create mode 100644 matita/contribs/PREDICATIVE-TOPOLOGY/makefile create mode 100644 matita/contribs/PREDICATIVE-TOPOLOGY/subset_defs.ma create mode 100644 matita/contribs/RELATIONAL/NLE/defs.ma create mode 100644 matita/contribs/RELATIONAL/NLE/inv.ma create mode 100644 matita/contribs/RELATIONAL/NLE/nplus.ma create mode 100644 matita/contribs/RELATIONAL/NLE/order.ma create mode 100644 matita/contribs/RELATIONAL/NLE/props.ma create mode 100644 matita/contribs/RELATIONAL/NPlus/defs.ma create mode 100644 matita/contribs/RELATIONAL/NPlus/fun.ma create mode 100644 matita/contribs/RELATIONAL/NPlus/inv.ma create mode 100644 matita/contribs/RELATIONAL/NPlus/monoid.ma create mode 100644 matita/contribs/RELATIONAL/NPlusList/defs.ma create mode 100644 matita/contribs/RELATIONAL/NPlusList/props.ma create mode 100644 matita/contribs/RELATIONAL/ZEq/defs.ma create mode 100644 matita/contribs/RELATIONAL/ZEq/setoid.ma create mode 100644 matita/contribs/RELATIONAL/datatypes/Bool.ma create mode 100644 matita/contribs/RELATIONAL/datatypes/List.ma create mode 100644 matita/contribs/RELATIONAL/datatypes/Nat.ma create mode 100644 matita/contribs/RELATIONAL/datatypes/Zah.ma create mode 100644 matita/contribs/RELATIONAL/makefile create mode 100644 matita/contribs/RELATIONAL/preamble.ma create mode 100644 matita/contribs/developments.txt create mode 100644 matita/contribs/formal_topology/bin/Makefile create mode 100644 matita/contribs/formal_topology/bin/formal_topology.ma create mode 100644 matita/contribs/formal_topology/bin/theory_explorer.ml create mode 100644 matita/contribs/formal_topology/bin/theory_explorer_do_not_trust_auto.ml create mode 100644 matita/contribs/formal_topology/formal_topology.ma create mode 100644 matita/contribs/formal_topology/formal_topology2.ma create mode 100644 matita/contribs/prova.ma create mode 100644 matita/core_notation.moo create mode 100644 matita/dama/attic/fields.ma create mode 100644 matita/dama/attic/integration_algebras.ma create mode 100644 matita/dama/attic/ordered_fields_ch0.ma create mode 100644 matita/dama/attic/reals.ma create mode 100644 matita/dama/attic/rings.ma create mode 100644 matita/dama/attic/vector_spaces.ma create mode 100644 matita/dama/classical_pointfree/ordered_sets.ma create mode 100644 matita/dama/classical_pointfree/ordered_sets2.ma create mode 100644 matita/dama/classical_pointwise/sets.ma create mode 100644 matita/dama/classical_pointwise/sigma_algebra.ma create mode 100644 matita/dama/classical_pointwise/topology.ma create mode 100644 matita/dama/constructive_connectives.ma create mode 100644 matita/dama/constructive_higher_order_relations.ma create mode 100644 matita/dama/constructive_pointfree/lebesgue.ma create mode 100644 matita/dama/divisible_group.ma create mode 100644 matita/dama/doc/DIMOSTRAZIONE create mode 100644 matita/dama/doc/NotaReticoli.pdf create mode 100644 matita/dama/excess.ma create mode 100644 matita/dama/group.ma create mode 100644 matita/dama/lattice.ma create mode 100644 matita/dama/makefile create mode 100644 matita/dama/metric_lattice.ma create mode 100644 matita/dama/metric_space.ma create mode 100644 matita/dama/ordered_divisible_group.ma create mode 100644 matita/dama/ordered_group.ma create mode 100644 matita/dama/premetric_lattice.ma create mode 100644 matita/dama/prevalued_lattice.ma create mode 100644 matita/dama/sandwich.ma create mode 100644 matita/dama/sequence.ma create mode 100644 matita/dama_didactic/bottom.ma create mode 100644 matita/dama_didactic/deriv.ma create mode 100644 matita/dama_didactic/ex_deriv.ma create mode 100644 matita/dama_didactic/ex_seq.ma create mode 100644 matita/dama_didactic/makefile create mode 100644 matita/dama_didactic/reals.ma create mode 100644 matita/dama_didactic/sequences.ma create mode 100755 matita/dep2dot.rb create mode 100644 matita/dictionary-matita.xml create mode 100644 matita/dist/BUGS create mode 100644 matita/dist/COPYING create mode 100644 matita/dist/ChangeLog create mode 100644 matita/dist/INSTALL create mode 100644 matita/dist/Makefile create mode 100644 matita/dist/README create mode 100644 matita/dist/configure.ac.sed create mode 100755 matita/dist/fill_db.sh create mode 100644 matita/dist/static_link/Makefile create mode 100644 matita/dist/static_link/static_link.ml create mode 100644 matita/doc/primer.txt create mode 100644 matita/dump_moo.ml create mode 100644 matita/gragrep.ml create mode 100644 matita/gragrep.mli create mode 100644 matita/gtkmathview.matita.conf.xml.in create mode 100644 matita/help/C/Makefile create mode 100644 matita/help/C/TODO create mode 100644 matita/help/C/declarative_tactics_quickref.xml create mode 100644 matita/help/C/docbook.css create mode 100644 matita/help/C/figures/database.dia create mode 100644 matita/help/C/figures/database.png create mode 100644 matita/help/C/figures/developments.png create mode 100644 matita/help/C/legal.xml create mode 100644 matita/help/C/matita.xml create mode 100644 matita/help/C/sec_commands.xml create mode 100644 matita/help/C/sec_declarative_tactics.xml create mode 100644 matita/help/C/sec_gettingstarted.xml create mode 100644 matita/help/C/sec_install.xml create mode 100644 matita/help/C/sec_intro.xml create mode 100644 matita/help/C/sec_license.xml create mode 100644 matita/help/C/sec_tacticals.xml create mode 100644 matita/help/C/sec_tactics.xml create mode 100644 matita/help/C/sec_terms.xml create mode 100644 matita/help/C/sec_usernotation.xml create mode 100644 matita/help/C/tactic_quickref.xml create mode 100644 matita/help/C/tactics_quickref.xml create mode 100644 matita/help/C/version.txt.in create mode 100644 matita/help/C/xhtml1-transitional.dtd create mode 100644 matita/help/C/xsl/matita-fo.xsl create mode 100644 matita/help/C/xsl/matita-tex.xsl create mode 100644 matita/help/C/xsl/matita-xhtml.xsl create mode 100644 matita/help/C/xsl/tactic_quickref.xsl create mode 100644 matita/icons/matita-32.xpm create mode 100644 matita/icons/matita-bulb-high.png create mode 100644 matita/icons/matita-bulb-low.png create mode 100644 matita/icons/matita-bulb-medium.png create mode 100644 matita/icons/matita-folder.png create mode 100644 matita/icons/matita-object.png create mode 100644 matita/icons/matita-theory.png create mode 100644 matita/icons/matita.png create mode 100644 matita/icons/matita_medium.png create mode 100644 matita/icons/matita_small.png create mode 100644 matita/icons/matita_very_small.png create mode 100644 matita/icons/meegg.png create mode 100644 matita/icons/whelp.png create mode 100644 matita/icons/whelp.svg create mode 100644 matita/lablGraphviz.ml create mode 100644 matita/lablGraphviz.mli create mode 100644 matita/legacy/coq.ma create mode 100644 matita/legacy/makefile create mode 100644 matita/library/Fsub/defn.ma create mode 100644 matita/library/Fsub/part1a.ma create mode 100644 matita/library/Fsub/part1a_inversion.ma create mode 100644 matita/library/Fsub/util.ma create mode 100644 matita/library/Q/Qaxioms.ma create mode 100644 matita/library/Q/q.ma create mode 100644 matita/library/Z/compare.ma create mode 100644 matita/library/Z/dirichlet_product.ma create mode 100644 matita/library/Z/inversion.ma create mode 100644 matita/library/Z/moebius.ma create mode 100644 matita/library/Z/orders.ma create mode 100644 matita/library/Z/plus.ma create mode 100644 matita/library/Z/sigma_p.ma create mode 100644 matita/library/Z/times.ma create mode 100644 matita/library/Z/z.ma create mode 100644 matita/library/algebra/CoRN/SemiGroups.ma create mode 100644 matita/library/algebra/CoRN/SetoidFun.ma create mode 100644 matita/library/algebra/CoRN/SetoidInc.ma create mode 100644 matita/library/algebra/CoRN/Setoids.ma create mode 100644 matita/library/algebra/finite_groups.ma create mode 100644 matita/library/algebra/groups.ma create mode 100644 matita/library/algebra/monoids.ma create mode 100644 matita/library/algebra/semigroups.ma create mode 100644 matita/library/assembly/byte.ma create mode 100644 matita/library/assembly/exadecimal.ma create mode 100644 matita/library/assembly/extra.ma create mode 100644 matita/library/assembly/test.ma create mode 100644 matita/library/assembly/vm.ma create mode 100644 matita/library/datatypes/bool.ma create mode 100644 matita/library/datatypes/compare.ma create mode 100644 matita/library/datatypes/constructors.ma create mode 100644 matita/library/decidable_kit/decidable.ma create mode 100644 matita/library/decidable_kit/eqtype.ma create mode 100644 matita/library/decidable_kit/fgraph.ma create mode 100644 matita/library/decidable_kit/fintype.ma create mode 100644 matita/library/decidable_kit/list_aux.ma create mode 100644 matita/library/decidable_kit/streicher.ma create mode 100644 matita/library/demo/power_derivative.ma create mode 100644 matita/library/demo/propositional_sequent_calculus.ma create mode 100644 matita/library/higher_order_defs/functions.ma create mode 100644 matita/library/higher_order_defs/ordering.ma create mode 100644 matita/library/higher_order_defs/relations.ma create mode 100644 matita/library/library_notation.ma create mode 100644 matita/library/list/list.ma create mode 100644 matita/library/list/sort.ma create mode 100644 matita/library/logic/coimplication.ma create mode 100644 matita/library/logic/connectives.ma create mode 100644 matita/library/logic/connectives2.ma create mode 100644 matita/library/logic/equality.ma create mode 100644 matita/library/makefile create mode 100644 matita/library/nat/binomial.ma create mode 100644 matita/library/nat/chebyshev.ma create mode 100644 matita/library/nat/chebyshev_thm.ma create mode 100644 matita/library/nat/chinese_reminder.ma create mode 100644 matita/library/nat/compare.ma create mode 100644 matita/library/nat/congruence.ma create mode 100644 matita/library/nat/count.ma create mode 100644 matita/library/nat/div_and_mod.ma create mode 100644 matita/library/nat/div_and_mod_diseq.ma create mode 100644 matita/library/nat/div_and_mod_new.ma.dontcompile create mode 100644 matita/library/nat/euler_theorem.ma create mode 100644 matita/library/nat/exp.ma create mode 100644 matita/library/nat/factorial.ma create mode 100644 matita/library/nat/factorial2.ma create mode 100644 matita/library/nat/factorization.ma create mode 100644 matita/library/nat/fermat_little_theorem.ma create mode 100644 matita/library/nat/gcd.ma create mode 100644 matita/library/nat/gcd_properties1.ma create mode 100644 matita/library/nat/generic_iter_p.ma create mode 100644 matita/library/nat/iteration2.ma create mode 100644 matita/library/nat/le_arith.ma create mode 100644 matita/library/nat/log.ma create mode 100644 matita/library/nat/lt_arith.ma create mode 100644 matita/library/nat/map_iter_p.ma create mode 100644 matita/library/nat/minimization.ma create mode 100644 matita/library/nat/minus.ma create mode 100644 matita/library/nat/nat.ma create mode 100644 matita/library/nat/neper.ma create mode 100644 matita/library/nat/nth_prime.ma create mode 100644 matita/library/nat/ord.ma create mode 100644 matita/library/nat/orders.ma create mode 100644 matita/library/nat/permutation.ma create mode 100644 matita/library/nat/pi_p.ma create mode 100644 matita/library/nat/plus.ma create mode 100644 matita/library/nat/primes.ma create mode 100644 matita/library/nat/relevant_equations.ma create mode 100644 matita/library/nat/sigma_and_pi.ma create mode 100644 matita/library/nat/times.ma create mode 100644 matita/library/nat/totient.ma create mode 100644 matita/library/nat/totient1.ma create mode 100644 matita/library/technicalities/setoids.ma create mode 100644 matita/library_auto/auto/Q/q.ma create mode 100644 matita/library_auto/auto/Z/compare.ma create mode 100644 matita/library_auto/auto/Z/orders.ma create mode 100644 matita/library_auto/auto/Z/plus.ma create mode 100644 matita/library_auto/auto/Z/times.ma create mode 100644 matita/library_auto/auto/Z/z.ma create mode 100644 matita/library_auto/auto/nat/chinese_reminder.ma create mode 100644 matita/library_auto/auto/nat/compare.ma create mode 100644 matita/library_auto/auto/nat/congruence.ma create mode 100644 matita/library_auto/auto/nat/count.ma create mode 100644 matita/library_auto/auto/nat/div_and_mod.ma create mode 100644 matita/library_auto/auto/nat/euler_theorem.ma create mode 100644 matita/library_auto/auto/nat/exp.ma create mode 100644 matita/library_auto/auto/nat/factorial.ma create mode 100644 matita/library_auto/auto/nat/factorization.ma create mode 100644 matita/library_auto/auto/nat/fermat_little_theorem.ma create mode 100644 matita/library_auto/auto/nat/gcd.ma create mode 100644 matita/library_auto/auto/nat/le_arith.ma create mode 100644 matita/library_auto/auto/nat/lt_arith.ma create mode 100644 matita/library_auto/auto/nat/map_iter_p.ma create mode 100644 matita/library_auto/auto/nat/minimization.ma create mode 100644 matita/library_auto/auto/nat/minus.ma create mode 100644 matita/library_auto/auto/nat/nat.ma create mode 100644 matita/library_auto/auto/nat/nth_prime.ma create mode 100644 matita/library_auto/auto/nat/ord.ma create mode 100644 matita/library_auto/auto/nat/orders.ma create mode 100644 matita/library_auto/auto/nat/permutation.ma create mode 100644 matita/library_auto/auto/nat/plus.ma create mode 100644 matita/library_auto/auto/nat/primes.ma create mode 100644 matita/library_auto/auto/nat/relevant_equations.ma create mode 100644 matita/library_auto/auto/nat/sigma_and_pi.ma create mode 100644 matita/library_auto/auto/nat/times.ma create mode 100644 matita/library_auto/auto/nat/totient.ma create mode 100644 matita/library_auto/makefile create mode 100644 matita/matita.conf.xml.in create mode 100644 matita/matita.glade create mode 100644 matita/matita.gtkrc create mode 100644 matita/matita.lang create mode 100644 matita/matita.ma.templ create mode 100644 matita/matita.ml create mode 100644 matita/matita.txt create mode 100644 matita/matitaAutoGui.ml create mode 100644 matita/matitaAutoGui.mli create mode 100644 matita/matitaEngine.ml create mode 100644 matita/matitaEngine.mli create mode 100644 matita/matitaExcPp.ml create mode 100644 matita/matitaExcPp.mli create mode 100644 matita/matitaGtkMisc.ml create mode 100644 matita/matitaGtkMisc.mli create mode 100644 matita/matitaGui.ml create mode 100644 matita/matitaGui.mli create mode 100644 matita/matitaGuiTypes.mli create mode 100644 matita/matitaInit.ml create mode 100644 matita/matitaInit.mli create mode 100644 matita/matitaMathView.ml create mode 100644 matita/matitaMathView.mli create mode 100644 matita/matitaMisc.ml create mode 100644 matita/matitaMisc.mli create mode 100644 matita/matitaScript.ml create mode 100644 matita/matitaScript.mli create mode 100644 matita/matitaTypes.ml create mode 100644 matita/matitaTypes.mli create mode 100644 matita/matitaWiki.ml create mode 100644 matita/matitac.ml create mode 100644 matita/matitacLib.ml create mode 100644 matita/matitacLib.mli create mode 100644 matita/matitaclean.ml create mode 100644 matita/matitaclean.mli create mode 100644 matita/matitadep.ml create mode 100644 matita/matitadep.mli create mode 100644 matita/matitamake.ml create mode 100644 matita/matitamake.mli create mode 100644 matita/matitamakeLib.ml create mode 100644 matita/matitamakeLib.mli create mode 100644 matita/matitaprover.ml create mode 100644 matita/matitaprover.mli create mode 100644 matita/matitatop.ml create mode 100644 matita/rottener.ml create mode 100755 matita/rottenize_lib create mode 100644 matita/scripts/README create mode 100644 matita/scripts/bench.sql create mode 100755 matita/scripts/clean_db.sh create mode 100644 matita/scripts/crontab create mode 100644 matita/scripts/crontab.sh create mode 100755 matita/scripts/functions.lua create mode 100755 matita/scripts/profile_svn.sh create mode 100644 matita/scripts/public_html/bench.php create mode 100644 matita/scripts/public_html/common.php create mode 100644 matita/scripts/public_html/composequery.php create mode 100644 matita/scripts/public_html/index.html create mode 100644 matita/scripts/public_html/showquery.php create mode 100644 matita/scripts/public_html/style.css create mode 100644 matita/template_makefile.in create mode 100644 matita/template_makefile_devel.in create mode 100644 matita/tests/TPTP/README create mode 100644 matita/tests/TPTP/Veloci/BOO001-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO003-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO003-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO004-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO004-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO005-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO005-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO006-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO006-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO009-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO009-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO010-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO010-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO011-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO011-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO012-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO012-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO013-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO013-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO016-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO017-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO018-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO034-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO069-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO071-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/BOO075-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL004-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL007-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL008-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL010-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL012-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL013-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL014-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL015-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL016-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL017-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL018-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL021-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL022-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL024-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL025-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL045-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL048-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL050-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL058-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL058-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL060-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL060-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL061-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL061-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL062-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL062-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL063-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL063-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL063-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL063-5.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL063-6.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL064-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL064-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL064-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL064-5.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL064-6.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL064-7.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL064-8.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL064-9.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL083-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL084-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL085-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/COL086-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP001-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP001-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP010-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP011-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP012-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP022-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP023-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP115-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP116-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP117-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP118-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP136-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP137-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP139-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP141-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP142-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP143-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP144-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP145-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP146-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP149-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP150-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP151-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP152-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP153-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP154-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP155-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP156-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP157-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP158-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP159-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP160-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP161-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP162-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP163-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP168-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP168-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP173-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP174-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP176-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP176-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP182-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP182-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP182-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP182-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP186-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP186-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP188-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP188-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP189-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP189-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP192-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP206-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP454-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP455-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP456-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP457-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP458-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP459-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP460-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP463-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP467-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP481-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP484-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP485-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP486-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP487-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP488-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP490-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP491-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP492-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP493-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP494-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP495-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP496-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP497-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP498-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP509-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP510-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP511-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP512-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP513-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP514-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP515-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP516-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP517-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP518-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP520-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP541-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP542-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP543-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP544-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP545-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP546-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP547-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP548-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP549-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP550-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP551-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP552-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP556-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP558-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP560-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP561-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP562-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP564-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP565-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP566-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP567-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP568-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP569-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP570-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP572-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP573-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP574-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP576-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP577-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP578-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP580-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP581-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP582-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP583-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP584-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP586-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP588-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP590-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP592-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP595-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP596-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP597-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP598-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP599-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP600-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP602-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP603-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP604-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP605-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP606-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP608-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP612-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP613-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP614-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP615-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/GRP616-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LAT008-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LAT033-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LAT034-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LAT039-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LAT039-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/LAT040-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LAT045-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL110-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL112-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL113-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL114-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL115-2.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL132-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL133-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL134-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL135-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL139-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL140-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL141-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL153-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL154-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL155-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL156-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL157-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL158-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL161-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LCL164-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LDA001-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/LDA007-3.p.ma create mode 100644 matita/tests/TPTP/Veloci/RNG007-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/RNG008-4.p.ma create mode 100644 matita/tests/TPTP/Veloci/RNG011-5.p.ma create mode 100644 matita/tests/TPTP/Veloci/RNG023-6.p.ma create mode 100644 matita/tests/TPTP/Veloci/RNG023-7.p.ma create mode 100644 matita/tests/TPTP/Veloci/RNG024-6.p.ma create mode 100644 matita/tests/TPTP/Veloci/RNG024-7.p.ma create mode 100644 matita/tests/TPTP/Veloci/ROB002-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/ROB009-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/ROB010-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/ROB013-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/ROB030-1.p.ma create mode 100644 matita/tests/TPTP/Veloci/SYN083-1.p.ma create mode 100755 matita/tests/TPTP/classify.sh create mode 100644 matita/tests/TPTP/compare.ods create mode 100644 matita/tests/TPTP/da_indagare_perche_non_astrarre_i_letin_sulle_meta_del_body_spacca_tutto.txt create mode 100644 matita/tests/TPTP/elenco_CASC.txt create mode 100644 matita/tests/TPTP/elenco_problemi_rating0_ancora_da_risolvere.txt create mode 100644 matita/tests/TPTP/elenco_problemi_veloci_per_test.txt create mode 100644 matita/tests/TPTP/elenco_unsatisfiable.txt create mode 100755 matita/tests/TPTP/fetch_results_tptp.lua create mode 100644 matita/tests/TPTP/hne_problems.txt create mode 100644 matita/tests/TPTP/log.120.orsay.txt create mode 100644 matita/tests/TPTP/log.300.19-6.txt create mode 100644 matita/tests/TPTP/log.300.26-5.menvcorti create mode 100644 matita/tests/TPTP/log.300.26-5.menvcorti.con_rating create mode 100644 matita/tests/TPTP/log.300.27-6.fixprove.fixsimpl-infergoal create mode 100644 matita/tests/TPTP/log.300.28-6.fixprove.fixsimpl-infergoal create mode 100644 matita/tests/TPTP/log.300.29-5.CASC create mode 100644 matita/tests/TPTP/log.300.29-6.fix-demodulationgoalwithcurr create mode 100644 matita/tests/TPTP/log.300.30-6.fixdemodgoalinpassive create mode 100644 matita/tests/TPTP/log.600.15-7.comedasvn_stampapesomassimoeqinprovanellog.txt create mode 100644 matita/tests/TPTP/log.600.22-7.matitaprover.txt create mode 100644 matita/tests/TPTP/log.600.30-6.weghtNOTlookingatgoalsymbols create mode 100644 matita/tests/TPTP/log.600.30-6.weghtlookingatgoalsymbols.txt create mode 100644 matita/tests/TPTP/maxweight.txt create mode 100644 matita/tests/TPTP/merge_sorted_logs.awk create mode 100644 matita/tests/TPTP/prova_LAT145_rating_93.tar.gz create mode 100644 matita/tests/TPTP/risultati_CASC_2005.txt create mode 100755 matita/tests/TPTP/simulate_casc.sh create mode 100755 matita/tests/TPTP/try.sh create mode 100644 matita/tests/TPTP/unit_equality_problems.txt create mode 100644 matita/tests/absurd.ma create mode 100644 matita/tests/apply.ma create mode 100644 matita/tests/apply2.ma create mode 100644 matita/tests/applys.ma create mode 100644 matita/tests/assumption.ma create mode 100644 matita/tests/bad_induction.ma create mode 100644 matita/tests/bad_tests/Makefile create mode 100644 matita/tests/bad_tests/auto.log create mode 100755 matita/tests/bad_tests/auto.ma create mode 100644 matita/tests/bad_tests/baseuri.log create mode 100644 matita/tests/bad_tests/baseuri.ma create mode 100644 matita/tests/bool.ma create mode 100644 matita/tests/change.ma create mode 100644 matita/tests/clear.ma create mode 100644 matita/tests/clearbody.ma create mode 100644 matita/tests/coercions.ma create mode 100644 matita/tests/coercions_contravariant.ma create mode 100644 matita/tests/coercions_dependent.ma create mode 100644 matita/tests/coercions_dupelim.ma create mode 100644 matita/tests/coercions_nonuniform.ma create mode 100644 matita/tests/coercions_open.ma create mode 100644 matita/tests/coercions_propagation.ma create mode 100644 matita/tests/coercions_russell.ma create mode 100644 matita/tests/comments.ma create mode 100644 matita/tests/compose.ma create mode 100644 matita/tests/constructor.ma create mode 100644 matita/tests/continuationals.ma create mode 100644 matita/tests/contradiction.ma create mode 100644 matita/tests/cut.ma create mode 100644 matita/tests/decl.ma create mode 100644 matita/tests/decompose.ma create mode 100644 matita/tests/demodulation_coq.ma create mode 100644 matita/tests/demodulation_matita.ma create mode 100644 matita/tests/dependent_injection.ma create mode 100644 matita/tests/dependent_type_inference.ma create mode 100644 matita/tests/destruct.ma create mode 100644 matita/tests/elim.ma create mode 100644 matita/tests/fguidi.ma create mode 100644 matita/tests/first.ma create mode 100644 matita/tests/fix_betareduction.ma create mode 100644 matita/tests/fold.ma create mode 100644 matita/tests/generalize.ma create mode 100644 matita/tests/hard_refine.ma create mode 100644 matita/tests/injection.ma create mode 100644 matita/tests/interactive/automatic_insertion.ma create mode 100644 matita/tests/interactive/drop.ma create mode 100644 matita/tests/interactive/grafite.ma create mode 100644 matita/tests/interactive/test5.ma create mode 100644 matita/tests/interactive/test6.ma create mode 100644 matita/tests/interactive/test7.ma create mode 100644 matita/tests/interactive/test_instance.ma create mode 100644 matita/tests/inversion.ma create mode 100644 matita/tests/inversion2.ma create mode 100644 matita/tests/letrec.ma create mode 100644 matita/tests/letrecand.ma create mode 100644 matita/tests/makefile create mode 100644 matita/tests/match_inference.ma create mode 100644 matita/tests/metasenv_ordering.ma create mode 100644 matita/tests/multiple_inheritance.ma create mode 100644 matita/tests/mysql_escaping.ma create mode 100644 matita/tests/naiveparamod.ma create mode 100644 matita/tests/overred.ma create mode 100644 matita/tests/paramodulation.ma create mode 100644 matita/tests/paramodulation/BOO075-1.ma create mode 100644 matita/tests/paramodulation/boolean_algebra.ma create mode 100644 matita/tests/paramodulation/group.ma create mode 100644 matita/tests/paramodulation/irratsqrt2.ma create mode 100644 matita/tests/pullback.ma create mode 100644 matita/tests/record.ma create mode 100644 matita/tests/replace.ma create mode 100644 matita/tests/rewrite.ma create mode 100644 matita/tests/second.ma create mode 100644 matita/tests/simpl.ma create mode 100644 matita/tests/tacticals.ma create mode 100644 matita/tests/test2.ma create mode 100644 matita/tests/test3.ma create mode 100644 matita/tests/test4.ma create mode 100644 matita/tests/third.ma create mode 100644 matita/tests/tinycals.ma create mode 100644 matita/tests/unfold.ma diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..44b87c579 --- /dev/null +++ b/Makefile @@ -0,0 +1,124 @@ +H=@ + +include Makefile.defs + +SUBDIRS = components matita + +ifeq ($(DISTRIBUTED),yes) +# 'world' is the default target when distributed, otherwise 'all' is +world: depend $(foreach d,$(SUBDIRS),rec@world@$(d)) +all: depend $(foreach d,$(SUBDIRS),rec@all@$(d)) +opt: depend $(foreach d,$(SUBDIRS),rec@opt@$(d)) +else +all: $(foreach d,$(SUBDIRS),rec@all@$(d)) +opt: $(foreach d,$(SUBDIRS),rec@opt@$(d)) +world: depend $(foreach d,$(SUBDIRS),rec@world@$(d)) +endif +depend: depend-stamp +depend-stamp: +ifeq ($(HAVE_OCAMLOPT),yes) + ifeq ($(DISTRIBUTED),yes) + $(MAKE) $(foreach d,$(SUBDIRS),rec@depend.opt@$(d)) + else + $(MAKE) $(foreach d,$(SUBDIRS),rec@depend@$(d)) + endif +else + $(MAKE) $(foreach d,$(SUBDIRS),rec@depend@$(d)) +endif + $(H)touch depend-stamp + +clean: + $(H)make $(foreach d,$(SUBDIRS),rec@clean@$(d)) || true +distclean: + $(H)make $(foreach d,$(SUBDIRS),rec@distclean@$(d)) || true + $(H)rm -rf .matita library-stamp depend-stamp +install-indep: $(foreach d,$(SUBDIRS),rec@install-indep@$(d)) +install-arch: $(foreach d,$(SUBDIRS),rec@install-arch@$(d)) +install: install-indep install-arch +uninstall: $(foreach d,$(SUBDIRS),rec@uninstall@$(d)) + +rec@%: + $(MAKE) -C $(word 2, $(subst @, ,$*)) $(word 1, $(subst @, ,$*)) DESTDIR=$(shell pwd)/$(DESTDIR) + +# {{{ Distribution stuff + +ifeq ($(DISTRIBUTED),yes) +library: library-stamp +library-stamp: + $(MAKE) -C matita/ dist_library + touch $@ +endif + +BASENAME = matita +NULL = +DISTDIR = $(BASENAME)-$(MATITA_VERSION) +CLEAN_ON_DIST = \ + components/license \ + matita/TPTP/ \ + matita/dama/ \ + matita/dama_didactic/ \ + matita/contribs/ \ + matita/library_auto/ \ + $(NULL) +EXTRA_DIST = \ + matita/AUTHORS \ + matita/LICENSE \ + matita/dist/BUGS \ + matita/dist/ChangeLog \ + matita/dist/COPYING \ + matita/dist/INSTALL \ + matita/dist/README \ + Makefile \ + Makefile.defs.in \ + $(NULL) +EXTRA_DIST_matita = \ + matita/matitaGeneratedGui.ml \ + $(NULL) + +distcheck: dist dist_extract dist_test + +dist: dist_mktmpdir dist_pre dist_export dist_mktarball dist_rmtmpdir +dist/configure.ac: configure.ac matita/dist/configure.ac.sed + sed -f matita/dist/configure.ac.sed < $< > $@ +dist/configure: dist/configure.ac + cd dist && autoconf +dist_mktmpdir: + test -d dist || mkdir dist +dist_rmtmpdir: + test -d dist && rm -rf dist/ || true +dist_pre: + $(MAKE) -C matita dist_pre +dist_export: dist/configure + rm -rf $(DISTDIR) + mkdir $(DISTDIR) + svn export components $(DISTDIR)/components + svn export matita $(DISTDIR)/matita + (cd $(DISTDIR) && find . -name .depend -exec rm \{\} \;) + (cd $(DISTDIR) && find . -name .depend.opt -exec rm \{\} \;) + (cd $(DISTDIR) && rm -rf $(CLEAN_ON_DIST)) + cp $< $(DISTDIR)/configure + cp -r $(EXTRA_DIST) $(DISTDIR) + cp -r $(EXTRA_DIST_matita) $(DISTDIR)/matita + # distribute HTML version of the manual + mkdir -p $(DISTDIR)/docs/manual/ + $(MAKE) -C matita/help/C/ install DESTDIR=$(CURDIR)/$(DISTDIR)/docs/manual/ +dist_mktarball: + tar czf $(DISTDIR).tar.gz $(DISTDIR) + #tar cjf $(DISTDIR).tar.bz2 $(DISTDIR) + rm -rf $(DISTDIR) + +dist_extract: + tar xzf $(DISTDIR).tar.gz +dist_test: + (cd $(DISTDIR)/ \ + && ./configure \ + && $(MAKE) world \ + && $(MAKE) install DESTDIR=`pwd`/install) + +.PHONY: dist dist_export dist_mktarball distcheck dist_extract dist_test dist_autotools + +# }}} End of distribution stuff + +.PHONY: all opt clean distclean + +# vim: set foldmethod=marker: diff --git a/Makefile.defs.in b/Makefile.defs.in new file mode 100644 index 000000000..faa0c41f4 --- /dev/null +++ b/Makefile.defs.in @@ -0,0 +1,18 @@ +ifeq ($(origin OCAMLPATH), undefined) +OCAMLFIND = OCAMLPATH=@OCAMLPATH@ @OCAMLFIND@ +else +OCAMLFIND = @OCAMLFIND@ +endif +CAMLP5O = @CAMLP5O@ +LABLGLADECC = @LABLGLADECC@ +HAVE_OCAMLOPT = @HAVE_OCAMLOPT@ +DISTRIBUTED = @DISTRIBUTED@ + +MATITA_REQUIRES = @FINDLIB_REQUIRES@ +MATITA_CREQUIRES = @FINDLIB_CREQUIRES@ + +MATITA_VERSION = @MATITA_VERSION@ + +SRCROOT = @SRCROOT@ +RT_BASE_DIR = @RT_BASE_DIR@ +DBHOST = @DBHOST@ diff --git a/components/METAS/meta.helm-acic_content.src b/components/METAS/meta.helm-acic_content.src new file mode 100644 index 000000000..8e10b789e --- /dev/null +++ b/components/METAS/meta.helm-acic_content.src @@ -0,0 +1,4 @@ +requires="helm-library" +version="0.0.1" +archive(byte)="acic_content.cma" +archive(native)="acic_content.cmxa" diff --git a/components/METAS/meta.helm-acic_procedural.src b/components/METAS/meta.helm-acic_procedural.src new file mode 100644 index 000000000..f696baea6 --- /dev/null +++ b/components/METAS/meta.helm-acic_procedural.src @@ -0,0 +1,4 @@ +requires="helm-acic_content helm-grafite helm-tactics" +version="0.0.1" +archive(byte)="acic_procedural.cma" +archive(native)="acic_procedural.cmxa" diff --git a/components/METAS/meta.helm-cic.src b/components/METAS/meta.helm-cic.src new file mode 100644 index 000000000..525cc9c22 --- /dev/null +++ b/components/METAS/meta.helm-cic.src @@ -0,0 +1,5 @@ +requires="helm-urimanager helm-xml expat" +version="0.0.1" +archive(byte)="cic.cma" +archive(native)="cic.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-cic_acic.src b/components/METAS/meta.helm-cic_acic.src new file mode 100644 index 000000000..51afe1bda --- /dev/null +++ b/components/METAS/meta.helm-cic_acic.src @@ -0,0 +1,4 @@ +requires="helm-cic_proof_checking" +version="0.0.1" +archive(byte)="cic_acic.cma" +archive(native)="cic_acic.cmxa" diff --git a/components/METAS/meta.helm-cic_disambiguation.src b/components/METAS/meta.helm-cic_disambiguation.src new file mode 100644 index 000000000..d2e467aae --- /dev/null +++ b/components/METAS/meta.helm-cic_disambiguation.src @@ -0,0 +1,4 @@ +requires="helm-whelp helm-acic_content helm-cic_unification" +version="0.0.1" +archive(byte)="cic_disambiguation.cma" +archive(native)="cic_disambiguation.cmxa" diff --git a/components/METAS/meta.helm-cic_exportation.src b/components/METAS/meta.helm-cic_exportation.src new file mode 100644 index 000000000..f73bbeb64 --- /dev/null +++ b/components/METAS/meta.helm-cic_exportation.src @@ -0,0 +1,5 @@ +requires="helm-cic_acic" +version="0.0.1" +archive(byte)="cic_exportation.cma" +archive(native)="cic_exportation.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-cic_proof_checking.src b/components/METAS/meta.helm-cic_proof_checking.src new file mode 100644 index 000000000..223a182a9 --- /dev/null +++ b/components/METAS/meta.helm-cic_proof_checking.src @@ -0,0 +1,7 @@ +requires="helm-cic helm-logger helm-getter" +version="0.0.1" +archive(byte)="cic_proof_checking.cma" +archive(native)="cic_proof_checking.cmxa" +archive(byte,miniReduction)="cicSubstitution.cmo cicMiniReduction.cmo" +archive(native,miniReduction)="cicSubstitution.cmx cicMiniReduction.cmx" +linkopts="" diff --git a/components/METAS/meta.helm-cic_unification.src b/components/METAS/meta.helm-cic_unification.src new file mode 100644 index 000000000..75e2d4d31 --- /dev/null +++ b/components/METAS/meta.helm-cic_unification.src @@ -0,0 +1,5 @@ +requires="helm-cic_proof_checking helm-library" +version="0.0.1" +archive(byte)="cic_unification.cma" +archive(native)="cic_unification.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-content_pres.src b/components/METAS/meta.helm-content_pres.src new file mode 100644 index 000000000..976b8f10c --- /dev/null +++ b/components/METAS/meta.helm-content_pres.src @@ -0,0 +1,4 @@ +requires="helm-acic_content helm-syntax_extensions camlp5.gramlib ulex08 helm-grafite" +version="0.0.1" +archive(byte)="content_pres.cma" +archive(native)="content_pres.cmxa" diff --git a/components/METAS/meta.helm-extlib.src b/components/METAS/meta.helm-extlib.src new file mode 100644 index 000000000..2002fccf1 --- /dev/null +++ b/components/METAS/meta.helm-extlib.src @@ -0,0 +1,5 @@ +requires="unix camlp5.gramlib" +version="0.0.1" +archive(byte)="extlib.cma" +archive(native)="extlib.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-getter.src b/components/METAS/meta.helm-getter.src new file mode 100644 index 000000000..8a7badf74 --- /dev/null +++ b/components/METAS/meta.helm-getter.src @@ -0,0 +1,5 @@ +requires="http unix pcre zip helm-xml helm-logger helm-urimanager helm-registry" +version="0.0.1" +archive(byte)="getter.cma" +archive(native)="getter.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-grafite.src b/components/METAS/meta.helm-grafite.src new file mode 100644 index 000000000..0ae4a09d3 --- /dev/null +++ b/components/METAS/meta.helm-grafite.src @@ -0,0 +1,4 @@ +requires="helm-cic" +version="0.0.1" +archive(byte)="grafite.cma" +archive(native)="grafite.cmxa" diff --git a/components/METAS/meta.helm-grafite_engine.src b/components/METAS/meta.helm-grafite_engine.src new file mode 100644 index 000000000..c7203724c --- /dev/null +++ b/components/METAS/meta.helm-grafite_engine.src @@ -0,0 +1,5 @@ +requires="helm-library helm-grafite helm-tactics" +version="0.0.1" +archive(byte)="grafite_engine.cma" +archive(native)="grafite_engine.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-grafite_parser.src b/components/METAS/meta.helm-grafite_parser.src new file mode 100644 index 000000000..abf16caeb --- /dev/null +++ b/components/METAS/meta.helm-grafite_parser.src @@ -0,0 +1,5 @@ +requires="helm-lexicon helm-grafite ulex08" +version="0.0.1" +archive(byte)="grafite_parser.cma" +archive(native)="grafite_parser.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-hgdome.src b/components/METAS/meta.helm-hgdome.src new file mode 100644 index 000000000..d06666f43 --- /dev/null +++ b/components/METAS/meta.helm-hgdome.src @@ -0,0 +1,4 @@ +requires="helm-xml gdome2" +version="0.0.1" +archive(byte)="hgdome.cma" +archive(native)="hgdome.cmxa" diff --git a/components/METAS/meta.helm-hmysql.src b/components/METAS/meta.helm-hmysql.src new file mode 100644 index 000000000..21841b5ca --- /dev/null +++ b/components/METAS/meta.helm-hmysql.src @@ -0,0 +1,4 @@ +requires="helm-registry sqlite3 mysql helm-extlib" +version="0.0.1" +archive(byte)="hmysql.cma" +archive(native)="hmysql.cmxa" diff --git a/components/METAS/meta.helm-lexicon.src b/components/METAS/meta.helm-lexicon.src new file mode 100644 index 000000000..741fd603e --- /dev/null +++ b/components/METAS/meta.helm-lexicon.src @@ -0,0 +1,4 @@ +requires="helm-content_pres helm-cic_disambiguation camlp5.gramlib" +version="0.0.1" +archive(byte)="lexicon.cma" +archive(native)="lexicon.cmxa" diff --git a/components/METAS/meta.helm-library.src b/components/METAS/meta.helm-library.src new file mode 100644 index 000000000..d4955e05d --- /dev/null +++ b/components/METAS/meta.helm-library.src @@ -0,0 +1,5 @@ +requires="helm-cic_acic helm-metadata" +version="0.0.1" +archive(byte)="library.cma" +archive(native)="library.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-logger.src b/components/METAS/meta.helm-logger.src new file mode 100644 index 000000000..5b2e8d8ff --- /dev/null +++ b/components/METAS/meta.helm-logger.src @@ -0,0 +1,5 @@ +requires="" +version="0.0.1" +archive(byte)="logger.cma" +archive(native)="logger.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-metadata.src b/components/METAS/meta.helm-metadata.src new file mode 100644 index 000000000..a5b138301 --- /dev/null +++ b/components/METAS/meta.helm-metadata.src @@ -0,0 +1,4 @@ +requires="helm-hmysql helm-cic_proof_checking" +version="0.0.1" +archive(byte)="metadata.cma" +archive(native)="metadata.cmxa" diff --git a/components/METAS/meta.helm-registry.src b/components/METAS/meta.helm-registry.src new file mode 100644 index 000000000..82d364016 --- /dev/null +++ b/components/METAS/meta.helm-registry.src @@ -0,0 +1,4 @@ +requires="str netstring helm-xml" +version="0.0.1" +archive(byte)="registry.cma" +archive(native)="registry.cmxa" diff --git a/components/METAS/meta.helm-syntax_extensions.src b/components/METAS/meta.helm-syntax_extensions.src new file mode 100644 index 000000000..f9e210f6e --- /dev/null +++ b/components/METAS/meta.helm-syntax_extensions.src @@ -0,0 +1,7 @@ +requires="str" +version="0.0.1" +archive(byte)="utf8_macros.cma" +archive(native)="utf8_macros.cmxa" +requires(syntax,preprocessor)="camlp5" +archive(syntax,preprocessor)="pa_extend.cmo pa_unicode_macro.cma profiling_macros.cma" +linkopts="" diff --git a/components/METAS/meta.helm-tactics.src b/components/METAS/meta.helm-tactics.src new file mode 100644 index 000000000..5f620680a --- /dev/null +++ b/components/METAS/meta.helm-tactics.src @@ -0,0 +1,4 @@ +requires="helm-extlib helm-cic_proof_checking helm-cic_unification helm-whelp" +version="0.0.1" +archive(byte)="tactics.cma" +archive(native)="tactics.cmxa" diff --git a/components/METAS/meta.helm-thread.src b/components/METAS/meta.helm-thread.src new file mode 100644 index 000000000..5253060d2 --- /dev/null +++ b/components/METAS/meta.helm-thread.src @@ -0,0 +1,7 @@ +requires="" +version="0.0.1" +archive(byte,mt)="thread.cma" +archive(native,mt)="thread.cmxa" +archive(byte)="thread_fake.cma" +archive(native)="thread_fake.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-tptp_grafite.src b/components/METAS/meta.helm-tptp_grafite.src new file mode 100644 index 000000000..4c1675626 --- /dev/null +++ b/components/METAS/meta.helm-tptp_grafite.src @@ -0,0 +1,5 @@ +requires="helm-acic_content helm-grafite helm-lexicon" +version="0.0.1" +archive(byte)="tptp_grafite.cma" +archive(native)="tptp_grafite.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-urimanager.src b/components/METAS/meta.helm-urimanager.src new file mode 100644 index 000000000..ff1874688 --- /dev/null +++ b/components/METAS/meta.helm-urimanager.src @@ -0,0 +1,5 @@ +requires="str" +version="0.0.1" +archive(byte)="urimanager.cma" +archive(native)="urimanager.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-whelp.src b/components/METAS/meta.helm-whelp.src new file mode 100644 index 000000000..20ea84329 --- /dev/null +++ b/components/METAS/meta.helm-whelp.src @@ -0,0 +1,4 @@ +requires="helm-metadata" +version="0.0.1" +archive(byte)="whelp.cma" +archive(native)="whelp.cmxa" diff --git a/components/METAS/meta.helm-xml.src b/components/METAS/meta.helm-xml.src new file mode 100644 index 000000000..626e644fc --- /dev/null +++ b/components/METAS/meta.helm-xml.src @@ -0,0 +1,5 @@ +requires="zip expat helm-extlib" +version="0.0.1" +archive(byte)="xml.cma" +archive(native)="xml.cmxa" +linkopts="" diff --git a/components/METAS/meta.helm-xmldiff.src b/components/METAS/meta.helm-xmldiff.src new file mode 100644 index 000000000..9cc918307 --- /dev/null +++ b/components/METAS/meta.helm-xmldiff.src @@ -0,0 +1,4 @@ +requires="gdome2" +version="0.0.1" +archive(byte)="xmldiff.cma" +archive(native)="xmldiff.cmxa" diff --git a/components/Makefile b/components/Makefile new file mode 100644 index 000000000..01dabc9a6 --- /dev/null +++ b/components/Makefile @@ -0,0 +1,149 @@ +H=@ +export SHELL=/bin/bash + +include ../Makefile.defs + +# Warning: the modules must be in compilation order +NULL = +MODULES = \ + extlib \ + xml \ + hgdome \ + registry \ + hmysql \ + syntax_extensions \ + thread \ + xmldiff \ + urimanager \ + logger \ + getter \ + cic \ + cic_proof_checking \ + cic_acic \ + cic_exportation \ + metadata \ + library \ + acic_content \ + grafite \ + content_pres \ + cic_unification \ + whelp \ + tactics \ + acic_procedural \ + cic_disambiguation \ + lexicon \ + grafite_engine \ + grafite_parser \ + tptp_grafite \ + $(NULL) + +METAS = $(MODULES:%=METAS/META.helm-%) + +ifeq ($(DISTRIBUTED),no) + MODULES+=binaries +endif + +all: metas $(MODULES:%=rec@all@%) +opt: metas syntax-extensions $(MODULES:%=rec@opt@%) + +ifeq ($(HAVE_OCAMLOPT),yes) +world: opt +else +world: all +endif +syntax-extensions: + $(H)$(MAKE) -C syntax_extensions depend + $(H)$(MAKE) -C syntax_extensions +depend: syntax-extensions $(MODULES:%=rec@depend@%) +depend.opt: syntax-extensions $(MODULES:%=rec@depend.opt@%) +install-arch: $(MODULES:%=rec@install@%) +install-indep: +uninstall: $(MODULES:%=rec@uninstall@%) +clean: $(MODULES:%=rec@clean@%) clean_metas + +.stats: $(MODULES:%=rec@.stats@%) + $(H)(for m in $(MODULES); do echo -n "$$m:"; cat $$m/.stats; done) \ + | sort -t : -k 2 -n -r > .stats + +rec@%: + $(H)$(MAKE) -C $(word 2, $(subst @, ,$*)) $(word 1, $(subst @, ,$*)) + +EXTRA_DIST_CLEAN = \ + libraries-clusters.ps \ + libraries-clusters.pdf \ + libraries-ext.ps \ + libraries.ps \ + .dep.dot \ + .extdep.dot \ + .clustersdep.dot \ + $(NULL) + +distclean: clean clean_metas + $(H)rm -f $(METAS) + $(H)rm -f configure config.log config.cache config.status + $(H)rm -f $(EXTRA_DIST_CLEAN) + +.PHONY: all opt world metas depend install uninstall clean clean_metas distclean + +METAS/META.helm-%: METAS/meta.helm-%.src + $(H)cp $< $@ && echo "directory=\"$(shell pwd)/$*\"" >> $@ + +SIMPLIFYDEPS = ../daemons/graphs/tools/simplify_deps/simplify_deps +$(SIMPLIFYDEPS): + $(H)$(MAKE) -C $(dir $(SIMPLIFYDEPS)) + +.PHONY: .dep.dot +.dep.dot: $(SIMPLIFYDEPS) + $(H)echo "digraph G {" > $@ + $(H)echo " rankdir = TB ;" >> $@ + $(H)for i in $(MODULES); do \ + $(OCAMLFIND) query helm-$$i -recursive -p-format | \ + grep helm | \ + sed "s/^helm-/ \"$$i\" -> \"/g" | \ + sed "s/$$/\";/g" >> $@ ; \ + done + $(H)mv $@ $@.old ; $(SIMPLIFYDEPS) < $@.old > $@ ; rm $@.old + $(H)echo "}" >> $@ + +.PHONY: .alldep.dot +.alldep.dot: + $(H)echo "digraph G {" > $@ + $(H)echo " rankdir = TB ;" >> $@ + $(H)for i in $(MODULES); do \ + $(OCAMLFIND) query helm-$$i -recursive -p-format | \ + grep -v "pxp-" | \ + sed "s/^pxp/pxp[-*]/g" | \ + sed "s/^/ \"helm-$$i\" -> \"/g" | \ + sed "s/$$/\";/g" >> $@ ; \ + done + $(H)mv $@ $@.old ; \ + ./simplify_deps/simplify_deps.opt < $@.old > $@ ; \ + rm $@.old + $(H)for i in $(MODULES); do \ + echo "\"helm-$$i\" [shape=box,style=filled,fillcolor=yellow];"\ + >> $@ ; \ + done + $(H)echo "}" >> $@ + +.extdep.dot: .dep.dot + $(H)STATS/patch_deps.sh $< $@ +.clustersdep.dot: .dep.dot + $(H)USE_CLUSTERS=yes STATS/patch_deps.sh $< $@ + +libraries.ps: .dep.dot + $(H)dot -Tps -o $@ $< +libraries-ext.ps: .extdep.dot + $(H)dot -Tps -o $@ $< +libraries-clusters.ps: .clustersdep.dot + $(H)dot -Tps -o $@ $< +libraries-complete.ps: .alldep.dot + $(H)dot -Tps -o $@ $< + +ps: libraries.ps libraries-ext.ps libraries-clusters.ps + +tags: TAGS +.PHONY: TAGS +TAGS: + $(H)otags -vi -r . + +metas: $(filter-out METAS/META.helm-binaries, $(METAS)) diff --git a/components/Makefile.common b/components/Makefile.common new file mode 100644 index 000000000..5090dcc78 --- /dev/null +++ b/components/Makefile.common @@ -0,0 +1,149 @@ +H=@ + +# This Makefile must be included by another one defining: +# $PACKAGE +# $PREDICATES +# $INTERFACE_FILES +# $IMPLEMENTATION_FILES +# $EXTRA_OBJECTS_TO_INSTALL +# $EXTRA_OBJECTS_TO_CLEAN +# and put in a directory where there is a .depend or .depend.opt file. + +# $OCAMLFIND must be set to a meaningful vaule, including OCAMLPATH= + +PREPROCOPTIONS = -pp camlp5o +SYNTAXOPTIONS = -syntax camlp5o +PREREQ = +OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -thread -rectypes +OCAMLDEBUGOPTIONS = -g +#OCAML_PROF=p -p a +OCAMLARCHIVEOPTIONS = +REQUIRES := $(shell $(OCAMLFIND) -query -format '%(requires)' helm-$(PACKAGE)) +OCAMLC = $(OCAMLFIND) ocamlc$(OCAML_PROF) $(OCAMLDEBUGOPTIONS) $(OCAMLOPTIONS) $(PREPROCOPTIONS) +#OCAMLOPT_DEBUG_FLAGS = -p +OCAMLOPT = $(OCAMLFIND) opt $(OCAMLOPTIONS) $(PREPROCOPTIONS) $(OCAMLOPT_DEBUG_FLAGS) +OCAMLDEP = $(OCAMLFIND) ocamldep -package "camlp5 $(CAMLP5REQUIRES)" $(SYNTAXOPTIONS) $(OCAMLDEPOPTIONS) +OCAMLLEX = ocamllex +OCAMLYACC = ocamlyacc + +OCAMLC_P4 = $(OCAMLFIND) ocamlc $(OCAMLDEBUGOPTIONS) $(OCAMLOPTIONS) $(SYNTAXOPTIONS) +OCAMLOPT_P4 = $(OCAMLFIND) opt $(OCAMLOPTIONS) $(SYNTAXOPTIONS) + +LIBRARIES = $(shell $(OCAMLFIND) query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES)) +LIBRARIES_OPT = $(shell $(OCAMLFIND) query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES)) +LIBRARIES_DEPS := \ + $(foreach X,$(filter-out /usr/lib/ocaml%,$(LIBRARIES)),\ + $(wildcard \ + $(shell dirname $(X))/*.mli \ + $(shell dirname $(X))/*.ml \ + $(shell dirname $(X))/paramodulation/*.ml \ + $(shell dirname $(X))/paramodultation/*.mli)) + + +ARCHIVE = $(PACKAGE).cma +ARCHIVE_OPT = $(PACKAGE).cmxa +OBJECTS_TO_INSTALL = $(ARCHIVE) $(ARCHIVE_OPT) $(ARCHIVE_OPT:%.cmxa=%.a) \ + $(INTERFACE_FILES) $(INTERFACE_FILES:%.mli=%.cmi) \ + $(EXTRA_OBJECTS_TO_INSTALL) +DEPEND_FILES = $(INTERFACE_FILES) $(IMPLEMENTATION_FILES) + +$(ARCHIVE): $(IMPLEMENTATION_FILES:%.ml=%.cmo) $(LIBRARIES) + $(H)if [ $(PACKAGE) != dummy ]; then \ + echo " OCAMLC -a $@";\ + $(OCAMLC) $(OCAMLARCHIVEOPTIONS) -a -o $@ \ + $(IMPLEMENTATION_FILES:%.ml=%.cmo); fi + +$(ARCHIVE_OPT): $(IMPLEMENTATION_FILES:%.ml=%.cmx) $(LIBRARIES_OPT) + $(H)if [ $(PACKAGE) != dummy ]; then \ + echo " OCAMLOPT -a $@";\ + $(OCAMLOPT) $(OCAMLARCHIVEOPTIONS) -a -o $@ \ + $(IMPLEMENTATION_FILES:%.ml=%.cmx); fi + +prereq: $(PREREQ) +all: prereq $(IMPLEMENTATION_FILES:%.ml=%.cmo) $(ARCHIVE) + @echo -n +opt: prereq $(IMPLEMENTATION_FILES:%.ml=%.cmx) $(ARCHIVE_OPT) + @echo -n +test: test.ml $(ARCHIVE) + $(OCAMLC) $(ARCHIVE) -linkpkg -o $@ $< +test.opt: test.ml $(ARCHIVE_OPT) + $(OCAMLOPT) $(ARCHIVE_OPT) -linkpkg -o $@ $< +install: +uninstall: + +depend:: $(DEPEND_FILES) + $(H)echo " OCAMLDEP" + $(H)$(OCAMLDEP) $(INTERFACE_FILES) $(IMPLEMENTATION_FILES) > .depend +depend.opt:: $(DEPEND_FILES) + $(H)echo " OCAMLDEP -native" + $(H)$(OCAMLDEP) -native \ + $(INTERFACE_FILES) $(IMPLEMENTATION_FILES) > .depend.opt + +$(PACKAGE).ps: .dep.dot + dot -Tps -o $@ $< + +# FG: .depend or .depend.opt? +.dep.dot: .depend + ocamldot < .depend > $@ + +%.cmi: %.mli + @echo " OCAMLC $<" + $(H)$(OCAMLC) -c $< +%.cmo %.cmi: %.ml + @echo " OCAMLC $<" + $(H)$(OCAMLC) -c $< +%.cmx: %.ml + @echo " OCAMLOPT $<" + $(H)$(OCAMLOPT) -c $< +%.annot: %.ml + $(OCAMLC) -dtypes $(PKGS) -c $< +%.ml %.mli: %.mly + $(OCAMLYACC) $< +%.ml: %.mll + $(OCAMLLEX) $< + +ifneq ($(MAKECMDGOALS), clean) +$(IMPLEMENTATION_FILES:%.ml=%.cmo): $(LIBRARIES) +$(IMPLEMENTATION_FILES:%.ml=%.cmi): $(LIBRARIES_DEPS) +$(IMPLEMENTATION_FILES:%.ml=%.cmx): $(LIBRARIES_OPT) +endif + +clean: + rm -f *.cm[ioax] *.cmxa *.o *.a *.annot $(EXTRA_OBJECTS_TO_CLEAN) + if [ -f test ]; then rm -f test; else true; fi + if [ -f test.opt ]; then rm -f test.opt; else true; fi + +backup: + cd ..; tar cvzf $(PACKAGE)_$(shell date +%s).tar.gz $(PACKAGE) + +ocamlinit: + echo "#use \"topfind\";;" > .ocamlinit + echo "#thread;;" >> .ocamlinit + for p in $(REQUIRES); do echo "#require \"$$p\";;" >> .ocamlinit; done + echo "#load \"$(PACKAGE).cma\";;" >> .ocamlinit + +# $(STATS_EXCLUDE) may be defined in libraries' Makefile to exclude some file +# from statistics collection +STATS_FILES = \ + $(shell find . -maxdepth 1 -type f -name \*.ml $(foreach f,$(STATS_EXCLUDE),-not -name $(f))) \ + $(shell find . -maxdepth 1 -type f -name \*.mli $(foreach f,$(STATS_EXCLUDE),-not -name $(f))) +.stats: $(STATS_FILES) + rm -f .stats + echo -n "LOC:" >> .stats + wc -l $(STATS_FILES) | tail -1 | awk '{ print $$1 }' >> .stats + +.PHONY: all opt backup depend depend.opt install uninstall clean ocamlinit + +ifeq ($(MAKECMDGOALS),) + include .depend +endif + +ifeq ($(MAKECMDGOALS), all) + include .depend +endif + +ifeq ($(MAKECMDGOALS), opt) + include .depend.opt +endif + +NULL = diff --git a/components/STATS/clusters.dot b/components/STATS/clusters.dot new file mode 100644 index 000000000..b7298bce8 --- /dev/null +++ b/components/STATS/clusters.dot @@ -0,0 +1,57 @@ +// clusterrank = none; + fillcolor = "gray93"; + fontsize = 24; + node [fontsize = 24]; + /* libs clusters */ + subgraph cluster_presentation { + label = "Terms at the content and presentation level"; + labelloc = "b"; + labeljust = "r"; + style = "filled"; + color = "white" + acic_content; + cic_disambiguation; + content_pres; + grafite_parser; + lexicon; + } + subgraph cluster_partially { + label = "Partially specified terms"; + labelloc = "t"; + labeljust = "l"; + style = "filled"; + color = "white" + cic_unification; + tactics; + grafite; + grafite_engine; + } + subgraph cluster_fully { + label = "Fully specified terms"; + labelloc = "b"; + labeljust = "l"; + style = "filled"; + color = "white" + cic; + cic_proof_checking; + getter; + metadata; + urimanager; + whelp; + library; + cic_acic; + } + subgraph cluster_utilities { + label = "Utilities"; + labelloc = "b"; + labeljust = "r"; + style = "filled"; + color = "white" + extlib; + hgdome; + hmysql; + registry; + utf8_macros; + xml; + logger; + } diff --git a/components/STATS/daemons.dot b/components/STATS/daemons.dot new file mode 100644 index 000000000..4a8ba388f --- /dev/null +++ b/components/STATS/daemons.dot @@ -0,0 +1,19 @@ + /* apps */ + subgraph applications { + node [shape=plaintext,style=filled,fillcolor=slategray2]; + DependencyAnalyzer [label="Dependency\nAnalyzer\n .3 klocs"]; + Getter [label="Getter\n .3 klocs"]; + Matita [label="Matita\n 6.7 klocs"]; + ProofChecker [label="Proof Checker\n .1 klocs"]; + Uwobo [label="Uwobo\n 2.1 klocs"]; + Whelp [label="Whelp\n .6 klocs"]; + } + /* apps dep */ + DependencyAnalyzer -> metadata; + Getter -> getter; + Matita -> grafite_engine; + Matita -> grafite_parser; + Matita -> hgdome; + ProofChecker -> cic_proof_checking; + Uwobo -> content_pres; + Whelp -> grafite_parser; diff --git a/components/STATS/deps.patch b/components/STATS/deps.patch new file mode 100644 index 000000000..90130dfe8 --- /dev/null +++ b/components/STATS/deps.patch @@ -0,0 +1,23 @@ +--- .clustersdep.dot 2006-01-26 10:10:46.000000000 +0100 ++++ .clustersdep.new 2006-01-26 10:10:44.000000000 +0100 +@@ -1,11 +1,8 @@ + digraph G { + xml [label="xml\n.5 klocs"]; +- xmldiff [label="xmldiff\n.3 klocs"]; + whelp [label="whelp\n.3 klocs"]; + utf8_macros [label="utf8_macros\n.2 klocs"]; + urimanager [label="urimanager\n.2 klocs"]; +- thread [label="thread\n.2 klocs"]; +- paramodulation [label="paramodulation\n5.9 klocs"]; + tactics [label="tactics\n10.0 klocs"]; + registry [label="registry\n.6 klocs"]; + metadata [label="metadata\n1.9 klocs"]; +@@ -42,7 +39,7 @@ + "cic_unification" -> "library"; + "library" -> "metadata"; + "library" -> "cic_acic"; +-"metadata" -> "cic_proof_checking"; ++"metadata" -> "cic"; + "metadata" -> "hmysql"; + "grafite" -> "cic"; + "content_pres" -> "utf8_macros"; diff --git a/components/STATS/patch_deps.sh b/components/STATS/patch_deps.sh new file mode 100755 index 000000000..d7dd7b3ba --- /dev/null +++ b/components/STATS/patch_deps.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# script args: source_file target_file + +use_clusters='no' +if [ ! -z "$USE_CLUSTERS" ]; then + use_clusters=$USE_CLUSTERS +fi + +# args: file snippet +# file will be modified in place +include_dot_snippet () +{ + echo "Adding to $1 graphviz snippet $2 ..." + sed -i "/digraph/r $2" $1 +} + +# args: stats file +# file will be modified in place +include_loc_stats () +{ + echo "Adding to $1 KLOCs stats from $2 ..." + tmp=`mktemp tmp.stats.XXXXXX` + for l in `cat $2`; do + module=$(basename $(echo $l | cut -d : -f 1)) + stat=$(echo $l | cut -d : -f 2) + if [ "$stat" = "LOC" ]; then + locs=$(echo $l | cut -d : -f 3) + klocs=$(echo "scale=1; $locs / 1000" | bc) + if [ "$klocs" = "0" ]; then klocs=".1"; fi + printf ' %s [label="%s\\n%s klocs"];\n' $module $module $klocs >> $tmp + fi + done + include_dot_snippet $1 $tmp + rm $tmp +} + +# args: file patch +apply_patch () +{ + if [ -f "$2" ]; then + echo "Applying to $1 patch $2 ..." + patch $1 $2 + fi +} + +cp $1 $2 +include_loc_stats $2 .stats +apply_patch $2 STATS/deps.patch +include_dot_snippet $2 STATS/daemons.dot +if [ "$use_clusters" = "yes" ]; then + include_dot_snippet $2 STATS/clusters.dot +fi + diff --git a/components/acic_content/.depend b/components/acic_content/.depend new file mode 100644 index 000000000..8ade458af --- /dev/null +++ b/components/acic_content/.depend @@ -0,0 +1,27 @@ +acic2content.cmi: content.cmi +content2cic.cmi: content.cmi +cicNotationUtil.cmi: cicNotationPt.cmo +cicNotationEnv.cmi: cicNotationPt.cmo +cicNotationPp.cmi: cicNotationPt.cmo cicNotationEnv.cmi +acic2astMatcher.cmi: cicNotationPt.cmo +termAcicContent.cmi: cicNotationPt.cmo +content.cmo: content.cmi +content.cmx: content.cmi +acic2content.cmo: content.cmi acic2content.cmi +acic2content.cmx: content.cmx acic2content.cmi +content2cic.cmo: content.cmi content2cic.cmi +content2cic.cmx: content.cmx content2cic.cmi +cicNotationUtil.cmo: cicNotationPt.cmo cicNotationUtil.cmi +cicNotationUtil.cmx: cicNotationPt.cmx cicNotationUtil.cmi +cicNotationEnv.cmo: cicNotationUtil.cmi cicNotationPt.cmo cicNotationEnv.cmi +cicNotationEnv.cmx: cicNotationUtil.cmx cicNotationPt.cmx cicNotationEnv.cmi +cicNotationPp.cmo: cicNotationPt.cmo cicNotationEnv.cmi cicNotationPp.cmi +cicNotationPp.cmx: cicNotationPt.cmx cicNotationEnv.cmx cicNotationPp.cmi +acic2astMatcher.cmo: cicNotationUtil.cmi cicNotationPt.cmo cicNotationPp.cmi \ + acic2astMatcher.cmi +acic2astMatcher.cmx: cicNotationUtil.cmx cicNotationPt.cmx cicNotationPp.cmx \ + acic2astMatcher.cmi +termAcicContent.cmo: cicNotationUtil.cmi cicNotationPt.cmo cicNotationPp.cmi \ + acic2content.cmi acic2astMatcher.cmi termAcicContent.cmi +termAcicContent.cmx: cicNotationUtil.cmx cicNotationPt.cmx cicNotationPp.cmx \ + acic2content.cmx acic2astMatcher.cmx termAcicContent.cmi diff --git a/components/acic_content/.depend.opt b/components/acic_content/.depend.opt new file mode 100644 index 000000000..fef879256 --- /dev/null +++ b/components/acic_content/.depend.opt @@ -0,0 +1,27 @@ +acic2content.cmi: content.cmi +content2cic.cmi: content.cmi +cicNotationUtil.cmi: cicNotationPt.cmx +cicNotationEnv.cmi: cicNotationPt.cmx +cicNotationPp.cmi: cicNotationPt.cmx cicNotationEnv.cmi +acic2astMatcher.cmi: cicNotationPt.cmx +termAcicContent.cmi: cicNotationPt.cmx +content.cmo: content.cmi +content.cmx: content.cmi +acic2content.cmo: content.cmi acic2content.cmi +acic2content.cmx: content.cmx acic2content.cmi +content2cic.cmo: content.cmi content2cic.cmi +content2cic.cmx: content.cmx content2cic.cmi +cicNotationUtil.cmo: cicNotationPt.cmx cicNotationUtil.cmi +cicNotationUtil.cmx: cicNotationPt.cmx cicNotationUtil.cmi +cicNotationEnv.cmo: cicNotationUtil.cmi cicNotationPt.cmx cicNotationEnv.cmi +cicNotationEnv.cmx: cicNotationUtil.cmx cicNotationPt.cmx cicNotationEnv.cmi +cicNotationPp.cmo: cicNotationPt.cmx cicNotationEnv.cmi cicNotationPp.cmi +cicNotationPp.cmx: cicNotationPt.cmx cicNotationEnv.cmx cicNotationPp.cmi +acic2astMatcher.cmo: cicNotationUtil.cmi cicNotationPt.cmx cicNotationPp.cmi \ + acic2astMatcher.cmi +acic2astMatcher.cmx: cicNotationUtil.cmx cicNotationPt.cmx cicNotationPp.cmx \ + acic2astMatcher.cmi +termAcicContent.cmo: cicNotationUtil.cmi cicNotationPt.cmx cicNotationPp.cmi \ + acic2content.cmi acic2astMatcher.cmi termAcicContent.cmi +termAcicContent.cmx: cicNotationUtil.cmx cicNotationPt.cmx cicNotationPp.cmx \ + acic2content.cmx acic2astMatcher.cmx termAcicContent.cmi diff --git a/components/acic_content/Makefile b/components/acic_content/Makefile new file mode 100644 index 000000000..72aa997d1 --- /dev/null +++ b/components/acic_content/Makefile @@ -0,0 +1,19 @@ +PACKAGE = acic_content +PREDICATES = + +INTERFACE_FILES = \ + content.mli \ + acic2content.mli \ + content2cic.mli \ + cicNotationUtil.mli \ + cicNotationEnv.mli \ + cicNotationPp.mli \ + acic2astMatcher.mli \ + termAcicContent.mli \ + $(NULL) +IMPLEMENTATION_FILES = \ + cicNotationPt.ml \ + $(INTERFACE_FILES:%.mli=%.ml) + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/acic_content/acic2astMatcher.ml b/components/acic_content/acic2astMatcher.ml new file mode 100644 index 000000000..d62786cc7 --- /dev/null +++ b/components/acic_content/acic2astMatcher.ml @@ -0,0 +1,98 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +module Ast = CicNotationPt +module Util = CicNotationUtil + +module Matcher32 = +struct + module Pattern32 = + struct + type cic_mask_t = + Blob + | Uri of UriManager.uri + | Appl of cic_mask_t list + + let uri_of_term t = CicUtil.uri_of_term (Deannotate.deannotate_term t) + + let mask_of_cic = function + | Cic.AAppl (_, tl) -> Appl (List.map (fun _ -> Blob) tl), tl + | Cic.AConst (_, _, []) + | Cic.AVar (_, _, []) + | Cic.AMutInd (_, _, _, []) + | Cic.AMutConstruct (_, _, _, _, []) as t -> Uri (uri_of_term t), [] + | _ -> Blob, [] + + let tag_of_term t = + let mask, tl = mask_of_cic t in + Hashtbl.hash mask, tl + + let mask_of_appl_pattern = function + | Ast.UriPattern uri -> Uri uri, [] + | Ast.ImplicitPattern + | Ast.VarPattern _ -> Blob, [] + | Ast.ApplPattern pl -> Appl (List.map (fun _ -> Blob) pl), pl + + let tag_of_pattern p = + let mask, pl = mask_of_appl_pattern p in + Hashtbl.hash mask, pl + + type pattern_t = Ast.cic_appl_pattern + type term_t = Cic.annterm + + let string_of_pattern = CicNotationPp.pp_cic_appl_pattern + let string_of_term t = CicPp.ppterm (Deannotate.deannotate_term t) + + let classify = function + | Ast.ImplicitPattern + | Ast.VarPattern _ -> PatternMatcher.Variable + | Ast.UriPattern _ + | Ast.ApplPattern _ -> PatternMatcher.Constructor + end + + module M = PatternMatcher.Matcher (Pattern32) + + let compiler rows = + let match_cb rows = + let pl, pid = try List.hd rows with Not_found -> assert false in + (fun matched_terms constructors -> + let env = + try + List.map2 + (fun p t -> + match p with + | Ast.ImplicitPattern -> Util.fresh_name (), t + | Ast.VarPattern name -> name, t + | _ -> assert false) + pl matched_terms + with Invalid_argument _ -> assert false + in + Some (env, constructors, pid)) + in + M.compiler rows match_cb (fun () -> None) +end + diff --git a/components/acic_content/acic2astMatcher.mli b/components/acic_content/acic2astMatcher.mli new file mode 100644 index 000000000..0a9ec6a6b --- /dev/null +++ b/components/acic_content/acic2astMatcher.mli @@ -0,0 +1,34 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +module Matcher32: +sig + (** @param l3_patterns level 3 (CIC) patterns (AKA cic_appl_pattern) *) + val compiler : + (CicNotationPt.cic_appl_pattern * int) list -> + (Cic.annterm -> + ((string * Cic.annterm) list * Cic.annterm list * int) option) +end + diff --git a/components/acic_content/acic2content.ml b/components/acic_content/acic2content.ml new file mode 100644 index 000000000..69a1f632d --- /dev/null +++ b/components/acic_content/acic2content.ml @@ -0,0 +1,1173 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(**************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 16/6/2003 *) +(* *) +(**************************************************************************) + +(* $Id$ *) + +let object_prefix = "obj:";; +let declaration_prefix = "decl:";; +let definition_prefix = "def:";; +let inductive_prefix = "ind:";; +let joint_prefix = "joint:";; +let proof_prefix = "proof:";; +let conclude_prefix = "concl:";; +let premise_prefix = "prem:";; +let lemma_prefix = "lemma:";; + +let hide_coercions = ref true;; + +(* e se mettessi la conversione di BY nell'apply_context ? *) +(* sarebbe carino avere l'invariante che la proof2pres +generasse sempre prove con contesto vuoto *) + +let gen_id prefix seed = + let res = prefix ^ string_of_int !seed in + incr seed ; + res +;; + +let name_of = function + Cic.Anonymous -> None + | Cic.Name b -> Some b;; + +exception Not_a_proof;; +exception NotImplemented;; +exception NotApplicable;; + +(* we do not care for positivity, here, that in any case is enforced by + well typing. Just a brutal search *) + +let rec occur uri = + let module C = Cic in + function + C.Rel _ -> false + | C.Var _ -> false + | C.Meta _ -> false + | C.Sort _ -> false + | C.Implicit _ -> assert false + | C.Prod (_,s,t) -> (occur uri s) or (occur uri t) + | C.Cast (te,ty) -> (occur uri te) + | C.Lambda (_,s,t) -> (occur uri s) or (occur uri t) (* or false ?? *) + | C.LetIn (_,s,t) -> (occur uri s) or (occur uri t) + | C.Appl l -> + List.fold_left + (fun b a -> + if b then b + else (occur uri a)) false l + | C.Const (_,_) -> false + | C.MutInd (uri1,_,_) -> if uri = uri1 then true else false + | C.MutConstruct (_,_,_,_) -> false + | C.MutCase _ -> false (* presuming too much?? *) + | C.Fix _ -> false (* presuming too much?? *) + | C.CoFix (_,_) -> false (* presuming too much?? *) +;; + +let get_id = + let module C = Cic in + function + C.ARel (id,_,_,_) -> id + | C.AVar (id,_,_) -> id + | C.AMeta (id,_,_) -> id + | C.ASort (id,_) -> id + | C.AImplicit _ -> raise NotImplemented + | C.AProd (id,_,_,_) -> id + | C.ACast (id,_,_) -> id + | C.ALambda (id,_,_,_) -> id + | C.ALetIn (id,_,_,_) -> id + | C.AAppl (id,_) -> id + | C.AConst (id,_,_) -> id + | C.AMutInd (id,_,_,_) -> id + | C.AMutConstruct (id,_,_,_,_) -> id + | C.AMutCase (id,_,_,_,_,_) -> id + | C.AFix (id,_,_) -> id + | C.ACoFix (id,_,_) -> id +;; + +let test_for_lifting ~ids_to_inner_types ~ids_to_inner_sorts= + let module C = Cic in + let module C2A = Cic2acic in + (* atomic terms are never lifted, according to my policy *) + function + C.ARel (id,_,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + | C.AVar (id,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + | C.AMeta (id,_,_) -> + (try + Hashtbl.find ids_to_inner_sorts id = `Prop + with Not_found -> assert false) + | C.ASort (id,_) -> false + | C.AImplicit _ -> raise NotImplemented + | C.AProd (id,_,_,_) -> false + | C.ACast (id,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + | C.ALambda (id,_,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + | C.ALetIn (id,_,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + | C.AAppl (id,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + | C.AConst (id,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + | C.AMutInd (id,_,_,_) -> false + | C.AMutConstruct (id,_,_,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + (* oppure: false *) + | C.AMutCase (id,_,_,_,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + | C.AFix (id,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) + | C.ACoFix (id,_,_) -> + (try + ignore (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized; + true; + with Not_found -> false) +;; + +(* transform a proof p into a proof list, concatenating the last +conclude element to the apply_context list, in case context is +empty. Otherwise, it just returns [p] *) + +let flat seed p = + let module K = Content in + if (p.K.proof_context = []) then + if p.K.proof_apply_context = [] then [p] + else + let p1 = + { p with + K.proof_context = []; + K.proof_apply_context = [] + } in + p.K.proof_apply_context@[p1] + else + [p] +;; + +let rec serialize seed = + function + [] -> [] + | a::l -> (flat seed a)@(serialize seed l) +;; + +(* top_down = true if the term is a LAMBDA or a decl *) +let generate_conversion seed top_down id inner_proof ~ids_to_inner_types = + let module C2A = Cic2acic in + let module K = Content in + let exp = (try ((Hashtbl.find ids_to_inner_types id).C2A.annexpected) + with Not_found -> None) + in + match exp with + None -> inner_proof + | Some expty -> + if inner_proof.K.proof_conclude.K.conclude_method = "Intros+LetTac" then + { K.proof_name = inner_proof.K.proof_name; + K.proof_id = gen_id proof_prefix seed; + K.proof_context = [] ; + K.proof_apply_context = []; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = "TD_Conversion"; + K.conclude_args = + [K.ArgProof {inner_proof with K.proof_name = None}]; + K.conclude_conclusion = Some expty + }; + } + else + { K.proof_name = inner_proof.K.proof_name; + K.proof_id = gen_id proof_prefix seed; + K.proof_context = [] ; + K.proof_apply_context = [{inner_proof with K.proof_name = None}]; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = "BU_Conversion"; + K.conclude_args = + [K.Premise + { K.premise_id = gen_id premise_prefix seed; + K.premise_xref = inner_proof.K.proof_id; + K.premise_binder = None; + K.premise_n = None + } + ]; + K.conclude_conclusion = Some expty + }; + } +;; + +let generate_exact seed t id name ~ids_to_inner_types = + let module C2A = Cic2acic in + let module K = Content in + { K.proof_name = name; + K.proof_id = gen_id proof_prefix seed ; + K.proof_context = [] ; + K.proof_apply_context = []; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = "Exact"; + K.conclude_args = [K.Term (false, t)]; + K.conclude_conclusion = + try Some (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized + with Not_found -> None + }; + } +;; + +let generate_intros_let_tac seed id n s is_intro inner_proof name ~ids_to_inner_types = + let module C2A = Cic2acic in + let module C = Cic in + let module K = Content in + { K.proof_name = name; + K.proof_id = gen_id proof_prefix seed ; + K.proof_context = [] ; + K.proof_apply_context = []; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = "Intros+LetTac"; + K.conclude_args = [K.ArgProof inner_proof]; + K.conclude_conclusion = + try Some + (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized + with Not_found -> + (match inner_proof.K.proof_conclude.K.conclude_conclusion with + None -> None + | Some t -> + if is_intro then Some (C.AProd ("gen"^id,n,s,t)) + else Some (C.ALetIn ("gen"^id,n,s,t))) + }; + } +;; + +let build_decl_item seed id n s ~ids_to_inner_sorts = + let module K = Content in + let sort = + try + Some (Hashtbl.find ids_to_inner_sorts (Cic2acic.source_id_of_id id)) + with Not_found -> None + in + match sort with + | Some `Prop -> + `Hypothesis + { K.dec_name = name_of n; + K.dec_id = gen_id declaration_prefix seed; + K.dec_inductive = false; + K.dec_aref = id; + K.dec_type = s + } + | _ -> + `Declaration + { K.dec_name = name_of n; + K.dec_id = gen_id declaration_prefix seed; + K.dec_inductive = false; + K.dec_aref = id; + K.dec_type = s + } +;; + +let infer_dependent ~headless context metasenv = function + | [] -> assert false + | [t] -> [false, t] + | he::tl as l -> + if headless then + List.map (function s -> false,s) l + else + try + let hety,_ = + CicTypeChecker.type_of_aux' + metasenv context (Deannotate.deannotate_term he) + CicUniv.oblivion_ugraph + in + let fstorder t = + match CicReduction.whd context t with + | Cic.Prod _ -> false + | _ -> true + in + let rec dummify_last_tgt t = + match CicReduction.whd context t with + | Cic.Prod (n,s,tgt) -> Cic.Prod(n,s, dummify_last_tgt tgt) + | _ -> Cic.Implicit None + in + let rec aux ty = function + | [] -> [] + | t::tl -> + match + FreshNamesGenerator.clean_dummy_dependent_types + (dummify_last_tgt ty) + with + | Cic.Prod (n,src,tgt) -> + (n <> Cic.Anonymous && fstorder src, t) :: + aux (CicSubstitution.subst + (Deannotate.deannotate_term t) tgt) tl + | _ -> List.map (fun s -> false,s) (t::tl) + in + (false, he) :: aux hety tl + with CicTypeChecker.TypeCheckerFailure _ -> assert false +;; + +let rec build_subproofs_and_args ?(headless=false) seed context metasenv l ~ids_to_inner_types ~ids_to_inner_sorts = + let module C = Cic in + let module K = Content in + let rec aux n = + function + [] -> [],[] + | (dep, t)::l1 -> + let need_lifting = + test_for_lifting t ~ids_to_inner_types ~ids_to_inner_sorts in + let subproofs,args = aux (n + if need_lifting then 1 else 0) l1 in + if need_lifting then + let new_subproof = + acic2content + seed context metasenv + ~name:("H" ^ string_of_int n) ~ids_to_inner_types + ~ids_to_inner_sorts t in + let new_arg = + K.Premise + { K.premise_id = gen_id premise_prefix seed; + K.premise_xref = new_subproof.K.proof_id; + K.premise_binder = new_subproof.K.proof_name; + K.premise_n = None + } in + new_subproof::subproofs,new_arg::args + else + let hd = + (match t with + C.ARel (idr,idref,n,b) -> + let sort = + (try + Hashtbl.find ids_to_inner_sorts idr + with Not_found -> `Type (CicUniv.fresh())) in + if sort = `Prop then + K.Premise + { K.premise_id = gen_id premise_prefix seed; + K.premise_xref = idr; + K.premise_binder = Some b; + K.premise_n = Some n + } + else (K.Term (dep,t)) + | C.AConst(id,uri,[]) -> + let sort = + (try + Hashtbl.find ids_to_inner_sorts id + with Not_found -> `Type (CicUniv.fresh())) in + if sort = `Prop then + K.Lemma + { K.lemma_id = gen_id lemma_prefix seed; + K.lemma_name = UriManager.name_of_uri uri; + K.lemma_uri = UriManager.string_of_uri uri + } + else (K.Term (dep,t)) + | C.AMutConstruct(id,uri,tyno,consno,[]) -> + let sort = + (try + Hashtbl.find ids_to_inner_sorts id + with Not_found -> `Type (CicUniv.fresh())) in + if sort = `Prop then + let inductive_types = + (let o,_ = + CicEnvironment.get_obj CicUniv.empty_ugraph uri + in + match o with + | Cic.InductiveDefinition (l,_,_,_) -> l + | _ -> assert false + ) in + let (_,_,_,constructors) = + List.nth inductive_types tyno in + let name,_ = List.nth constructors (consno - 1) in + K.Lemma + { K.lemma_id = gen_id lemma_prefix seed; + K.lemma_name = name; + K.lemma_uri = + UriManager.string_of_uri uri ^ "#xpointer(1/" ^ + string_of_int (tyno+1) ^ "/" ^ string_of_int consno ^ + ")" + } + else (K.Term (dep,t)) + | _ -> (K.Term (dep,t))) in + subproofs,hd::args + in + match (aux 1 (infer_dependent ~headless context metasenv l)) with + [p],args -> + [{p with K.proof_name = None}], + List.map + (function + K.Premise prem when prem.K.premise_xref = p.K.proof_id -> + K.Premise {prem with K.premise_binder = None} + | i -> i) args + | p,a as c -> c + +and + +build_def_item seed context metasenv id n t ~ids_to_inner_sorts ~ids_to_inner_types = + let module K = Content in + try + let sort = Hashtbl.find ids_to_inner_sorts id in + if sort = `Prop then + (let p = + (acic2content seed context metasenv ?name:(name_of n) ~ids_to_inner_sorts ~ids_to_inner_types t) + in + `Proof p;) + else + `Definition + { K.def_name = name_of n; + K.def_id = gen_id definition_prefix seed; + K.def_aref = id; + K.def_term = t + } + with + Not_found -> assert false + +(* the following function must be called with an object of sort +Prop. For debugging purposes this is tested again, possibly raising an +Not_a_proof exception *) + +and acic2content seed context metasenv ?name ~ids_to_inner_sorts ~ids_to_inner_types t = + let rec aux ?name context t = + let module C = Cic in + let module K = Content in + let module C2A = Cic2acic in + let t1 = + match t with + C.ARel (id,idref,n,b) as t -> + let sort = Hashtbl.find ids_to_inner_sorts id in + if sort = `Prop then + generate_exact seed t id name ~ids_to_inner_types + else raise Not_a_proof + | C.AVar (id,uri,exp_named_subst) as t -> + let sort = Hashtbl.find ids_to_inner_sorts id in + if sort = `Prop then + generate_exact seed t id name ~ids_to_inner_types + else raise Not_a_proof + | C.AMeta (id,n,l) as t -> + let sort = Hashtbl.find ids_to_inner_sorts id in + if sort = `Prop then + generate_exact seed t id name ~ids_to_inner_types + else raise Not_a_proof + | C.ASort (id,s) -> raise Not_a_proof + | C.AImplicit _ -> raise NotImplemented + | C.AProd (_,_,_,_) -> raise Not_a_proof + | C.ACast (id,v,t) -> aux context v + | C.ALambda (id,n,s,t) -> + let sort = Hashtbl.find ids_to_inner_sorts id in + if sort = `Prop then + let proof = + aux ((Some (n,Cic.Decl (Deannotate.deannotate_term s)))::context) t + in + let proof' = + if proof.K.proof_conclude.K.conclude_method = "Intros+LetTac" then + match proof.K.proof_conclude.K.conclude_args with + [K.ArgProof p] -> p + | _ -> assert false + else proof in + let proof'' = + { proof' with + K.proof_name = None; + K.proof_context = + (build_decl_item seed id n s ids_to_inner_sorts):: + proof'.K.proof_context + } + in + generate_intros_let_tac seed id n s true proof'' name ~ids_to_inner_types + else + raise Not_a_proof + | C.ALetIn (id,n,s,t) -> + let sort = Hashtbl.find ids_to_inner_sorts id in + if sort = `Prop then + let proof = (* XXX TIPAMI!!! *) + aux ((Some (n,Cic.Def (Deannotate.deannotate_term s,None)))::context) t + in + let proof' = + if proof.K.proof_conclude.K.conclude_method = "Intros+LetTac" then + match proof.K.proof_conclude.K.conclude_args with + [K.ArgProof p] -> p + | _ -> assert false + else proof in + let proof'' = + { proof' with + K.proof_name = None; + K.proof_context = + ((build_def_item seed context metasenv (get_id s) n s ids_to_inner_sorts + ids_to_inner_types):> Cic.annterm K.in_proof_context_element) + ::proof'.K.proof_context; + } + in + generate_intros_let_tac seed id n s false proof'' name ~ids_to_inner_types + else + raise Not_a_proof + | C.AAppl (id,li) -> + (try coercion + seed context metasenv li ~ids_to_inner_types ~ids_to_inner_sorts + with NotApplicable -> + try rewrite + seed context metasenv name id li ~ids_to_inner_types ~ids_to_inner_sorts + with NotApplicable -> + try inductive + seed context metasenv name id li ~ids_to_inner_types ~ids_to_inner_sorts + with NotApplicable -> + try transitivity + seed context metasenv name id li ~ids_to_inner_types ~ids_to_inner_sorts + with NotApplicable -> + let subproofs, args = + build_subproofs_and_args + seed context metasenv li ~ids_to_inner_types ~ids_to_inner_sorts in +(* + let args_to_lift = + List.filter (test_for_lifting ~ids_to_inner_types) li in + let subproofs = + match args_to_lift with + [_] -> List.map aux args_to_lift + | _ -> List.map (aux ~name:"H") args_to_lift in + let args = build_args seed li subproofs + ~ids_to_inner_types ~ids_to_inner_sorts in *) + { K.proof_name = name; + K.proof_id = gen_id proof_prefix seed; + K.proof_context = []; + K.proof_apply_context = serialize seed subproofs; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = "Apply"; + K.conclude_args = args; + K.conclude_conclusion = + try Some + (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized + with Not_found -> None + }; + }) + | C.AConst (id,uri,exp_named_subst) as t -> + let sort = Hashtbl.find ids_to_inner_sorts id in + if sort = `Prop then + generate_exact seed t id name ~ids_to_inner_types + else raise Not_a_proof + | C.AMutInd (id,uri,i,exp_named_subst) -> raise Not_a_proof + | C.AMutConstruct (id,uri,i,j,exp_named_subst) as t -> + let sort = Hashtbl.find ids_to_inner_sorts id in + if sort = `Prop then + generate_exact seed t id name ~ids_to_inner_types + else raise Not_a_proof + | C.AMutCase (id,uri,typeno,ty,te,patterns) -> + let inductive_types,noparams = + (let o, _ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + Cic.Constant _ -> assert false + | Cic.Variable _ -> assert false + | Cic.CurrentProof _ -> assert false + | Cic.InductiveDefinition (l,_,n,_) -> l,n + ) in + let (_,_,_,constructors) = List.nth inductive_types typeno in + let name_and_arities = + let rec count_prods = + function + C.Prod (_,_,t) -> 1 + count_prods t + | _ -> 0 in + List.map + (function (n,t) -> Some n,((count_prods t) - noparams)) constructors in + let pp = + let build_proof p (name,arity) = + let rec make_context_and_body c p n = + if n = 0 then c,(aux context p) + else + (match p with + Cic.ALambda(idl,vname,s1,t1) -> + let ce = + build_decl_item + seed idl vname s1 ~ids_to_inner_sorts in + make_context_and_body (ce::c) t1 (n-1) + | _ -> assert false) in + let context,body = make_context_and_body [] p arity in + K.ArgProof + {body with K.proof_name = name; K.proof_context=context} in + List.map2 build_proof patterns name_and_arities in + let context,term = + (match + build_subproofs_and_args ~headless:true + seed context metasenv ~ids_to_inner_types ~ids_to_inner_sorts [te] + with + l,[t] -> l,t + | _ -> assert false) in + { K.proof_name = name; + K.proof_id = gen_id proof_prefix seed; + K.proof_context = []; + K.proof_apply_context = serialize seed context; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = "Case"; + K.conclude_args = + (K.Aux (UriManager.string_of_uri uri)):: + (K.Aux (string_of_int typeno))::(K.Term (false,ty))::term::pp; + K.conclude_conclusion = + try Some + (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized + with Not_found -> None + } + } + | C.AFix (id, no, funs) -> + let context' = + List.fold_left + (fun ctx (_,n,_,ty,_) -> + let ty = Deannotate.deannotate_term ty in + Some (Cic.Name n,Cic.Decl ty) :: ctx) + [] funs @ context + in + let proofs = + List.map + (function (_,name,_,_,bo) -> `Proof (aux context' ~name bo)) funs in + let fun_name = + List.nth (List.map (fun (_,name,_,_,_) -> name) funs) no + in + let decreasing_args = + List.map (function (_,_,n,_,_) -> n) funs in + let jo = + { K.joint_id = gen_id joint_prefix seed; + K.joint_kind = `Recursive decreasing_args; + K.joint_defs = proofs + } + in + { K.proof_name = name; + K.proof_id = gen_id proof_prefix seed; + K.proof_context = [`Joint jo]; + K.proof_apply_context = []; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = "Exact"; + K.conclude_args = + [ K.Premise + { K.premise_id = gen_id premise_prefix seed; + K.premise_xref = jo.K.joint_id; + K.premise_binder = Some fun_name; + K.premise_n = Some no; + } + ]; + K.conclude_conclusion = + try Some + (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized + with Not_found -> None + } + } + | C.ACoFix (id,no,funs) -> + let context' = + List.fold_left + (fun ctx (_,n,ty,_) -> + let ty = Deannotate.deannotate_term ty in + Some (Cic.Name n,Cic.Decl ty) :: ctx) + [] funs @ context + in + let proofs = + List.map + (function (_,name,_,bo) -> `Proof (aux context' ~name bo)) funs in + let jo = + { K.joint_id = gen_id joint_prefix seed; + K.joint_kind = `CoRecursive; + K.joint_defs = proofs + } + in + { K.proof_name = name; + K.proof_id = gen_id proof_prefix seed; + K.proof_context = [`Joint jo]; + K.proof_apply_context = []; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = "Exact"; + K.conclude_args = + [ K.Premise + { K.premise_id = gen_id premise_prefix seed; + K.premise_xref = jo.K.joint_id; + K.premise_binder = Some "tiralo fuori"; + K.premise_n = Some no; + } + ]; + K.conclude_conclusion = + try Some + (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized + with Not_found -> None + }; + } + in + let id = get_id t in + generate_conversion seed false id t1 ~ids_to_inner_types +in aux ?name context t + +and inductive seed context metasenv name id li ~ids_to_inner_types ~ids_to_inner_sorts = + let aux context ?name = + acic2content seed context metasenv ~ids_to_inner_types ~ids_to_inner_sorts + in + let module C2A = Cic2acic in + let module K = Content in + let module C = Cic in + match li with + C.AConst (idc,uri,exp_named_subst)::args -> + let uri_str = UriManager.string_of_uri uri in + let suffix = Str.regexp_string "_ind.con" in + let len = String.length uri_str in + let n = (try (Str.search_backward suffix uri_str len) + with Not_found -> -1) in + if n<0 then raise NotApplicable + else + let method_name = + if UriManager.eq uri HelmLibraryObjects.Logic.ex_ind_URI then "Exists" + else if UriManager.eq uri HelmLibraryObjects.Logic.and_ind_URI then "AndInd" + else if UriManager.eq uri HelmLibraryObjects.Logic.false_ind_URI then "FalseInd" + else "ByInduction" in + let prefix = String.sub uri_str 0 n in + let ind_str = (prefix ^ ".ind") in + let ind_uri = UriManager.uri_of_string ind_str in + let inductive_types,noparams = + (let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph ind_uri in + match o with + | Cic.InductiveDefinition (l,_,n,_) -> (l,n) + | _ -> assert false + ) in + let rec split n l = + if n = 0 then ([],l) else + let p,a = split (n-1) (List.tl l) in + ((List.hd l::p),a) in + let params_and_IP,tail_args = split (noparams+1) args in + let constructors = + (match inductive_types with + [(_,_,_,l)] -> l + | _ -> raise NotApplicable) (* don't care for mutual ind *) in + let constructors1 = + let rec clean_up n t = + if n = 0 then t else + (match t with + (label,Cic.Prod (_,_,t)) -> clean_up (n-1) (label,t) + | _ -> assert false) in + List.map (clean_up noparams) constructors in + let no_constructors= List.length constructors in + let args_for_cases, other_args = + split no_constructors tail_args in + let subproofs,other_method_args = + build_subproofs_and_args ~headless:true seed context metasenv + other_args ~ids_to_inner_types ~ids_to_inner_sorts in + let method_args= + let rec build_method_args = + function + [],_-> [] (* extra args are ignored ???? *) + | (name,ty)::tlc,arg::tla -> + let idarg = get_id arg in + let sortarg = + (try (Hashtbl.find ids_to_inner_sorts idarg) + with Not_found -> `Type (CicUniv.fresh())) in + let hdarg = + if sortarg = `Prop then + let (co,bo) = + let rec bc context = + function + Cic.Prod (_,s,t),Cic.ALambda(idl,n,s1,t1) -> + let context' = + Some (n,Cic.Decl(Deannotate.deannotate_term s1)) + ::context + in + let ce = + build_decl_item + seed idl n s1 ~ids_to_inner_sorts in + if (occur ind_uri s) then + ( match t1 with + Cic.ALambda(id2,n2,s2,t2) -> + let context'' = + Some + (n2,Cic.Decl + (Deannotate.deannotate_term s2)) + ::context' + in + let inductive_hyp = + `Hypothesis + { K.dec_name = name_of n2; + K.dec_id = + gen_id declaration_prefix seed; + K.dec_inductive = true; + K.dec_aref = id2; + K.dec_type = s2 + } in + let (context,body) = bc context'' (t,t2) in + (ce::inductive_hyp::context,body) + | _ -> assert false) + else + ( + let (context,body) = bc context' (t,t1) in + (ce::context,body)) + | _ , t -> ([],aux context t) in + bc context (ty,arg) in + K.ArgProof + { bo with + K.proof_name = Some name; + K.proof_context = co; + }; + else (K.Term (false,arg)) in + hdarg::(build_method_args (tlc,tla)) + | _ -> assert false in + build_method_args (constructors1,args_for_cases) in + { K.proof_name = name; + K.proof_id = gen_id proof_prefix seed; + K.proof_context = []; + K.proof_apply_context = serialize seed subproofs; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = method_name; + K.conclude_args = + K.Aux (string_of_int no_constructors) + ::K.Term (false,(C.AAppl(id,((C.AConst(idc,uri,exp_named_subst))::params_and_IP)))) + ::method_args@other_method_args; + K.conclude_conclusion = + try Some + (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized + with Not_found -> None + } + } + | _ -> raise NotApplicable + +and coercion seed context metasenv li ~ids_to_inner_types ~ids_to_inner_sorts = + match li with + | ((Cic.AConst _) as he)::tl + | ((Cic.AMutInd _) as he)::tl + | ((Cic.AMutConstruct _) as he)::tl when + CoercDb.is_a_coercion' (Deannotate.deannotate_term he) && + !hide_coercions -> + let rec last = + function + [] -> assert false + | [t] -> t + | _::tl -> last tl + in + acic2content + seed context metasenv ~ids_to_inner_types ~ids_to_inner_sorts (last tl) + | _ -> raise NotApplicable + +and rewrite seed context metasenv name id li ~ids_to_inner_types ~ids_to_inner_sorts = + let aux context ?name = + acic2content seed context metasenv ~ids_to_inner_types ~ids_to_inner_sorts + in + let module C2A = Cic2acic in + let module K = Content in + let module C = Cic in + match li with + C.AConst (sid,uri,exp_named_subst)::args -> + if UriManager.eq uri HelmLibraryObjects.Logic.eq_ind_URI or + UriManager.eq uri HelmLibraryObjects.Logic.eq_ind_r_URI or + LibraryObjects.is_eq_ind_URI uri or + LibraryObjects.is_eq_ind_r_URI uri then + let subproofs,arg = + (match + build_subproofs_and_args + seed context metasenv + ~ids_to_inner_types ~ids_to_inner_sorts [List.nth args 3] + with + l,[p] -> l,p + | _,_ -> assert false) in + let method_args = + let rec ma_aux n = function + [] -> [] + | a::tl -> + let hd = + if n = 0 then arg + else + let aid = get_id a in + let asort = (try (Hashtbl.find ids_to_inner_sorts aid) + with Not_found -> `Type (CicUniv.fresh())) in + if asort = `Prop then + K.ArgProof (aux context a) + else K.Term (false,a) in + hd::(ma_aux (n-1) tl) in + (ma_aux 3 args) in + { K.proof_name = name; + K.proof_id = gen_id proof_prefix seed; + K.proof_context = []; + K.proof_apply_context = serialize seed subproofs; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = + if UriManager.eq uri HelmLibraryObjects.Logic.eq_ind_URI + || LibraryObjects.is_eq_ind_URI uri then + "RewriteLR" + else + "RewriteRL"; + K.conclude_args = + K.Term (false,(C.AConst (sid,uri,exp_named_subst)))::method_args; + K.conclude_conclusion = + try Some + (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized + with Not_found -> None + } + } + else raise NotApplicable + | _ -> raise NotApplicable + +and transitivity + seed context metasenv name id li ~ids_to_inner_types ~ids_to_inner_sorts += + let module C2A = Cic2acic in + let module K = Content in + let module C = Cic in + match li with + | C.AConst (sid,uri,exp_named_subst)::args + when LibraryObjects.is_trans_eq_URI uri -> + let exp_args = List.map snd exp_named_subst in + let t1,t2,t3,p1,p2 = + match exp_args@args with + | [_;t1;t2;t3;p1;p2] -> t1,t2,t3,p1,p2 + | _ -> raise NotApplicable + in + { K.proof_name = name; + K.proof_id = gen_id proof_prefix seed; + K.proof_context = []; + K.proof_apply_context = []; + K.proof_conclude = + { K.conclude_id = gen_id conclude_prefix seed; + K.conclude_aref = id; + K.conclude_method = "Eq_chain"; + K.conclude_args = + K.Term (false,t1):: + (transitivity_aux + seed context metasenv ~ids_to_inner_types ~ids_to_inner_sorts p1) + @ [K.Term (false,t2)]@ + (transitivity_aux + seed context metasenv ~ids_to_inner_types ~ids_to_inner_sorts p2) + @ [K.Term (false,t3)]; + K.conclude_conclusion = + try Some + (Hashtbl.find ids_to_inner_types id).C2A.annsynthesized + with Not_found -> None + } + } + | _ -> raise NotApplicable + +and transitivity_aux seed context metasenv ~ids_to_inner_types ~ids_to_inner_sorts t = + let module C2A = Cic2acic in + let module K = Content in + let module C = Cic in + match t with + | C.AAppl (_,C.AConst (sid,uri,exp_named_subst)::args) + when LibraryObjects.is_trans_eq_URI uri -> + let exp_args = List.map snd exp_named_subst in + let t1,t2,t3,p1,p2 = + match exp_args@args with + | [_;t1;t2;t3;p1;p2] -> t1,t2,t3,p1,p2 + | _ -> raise NotApplicable + in + (transitivity_aux + seed context metasenv ~ids_to_inner_types ~ids_to_inner_sorts p1) + @[K.Term (false,t2)] + @(transitivity_aux + seed context metasenv ~ids_to_inner_types ~ids_to_inner_sorts p2) + | _ -> [K.ArgProof + (acic2content seed context metasenv ~ids_to_inner_sorts ~ids_to_inner_types t)] + +;; + + +let map_conjectures + seed ~ids_to_inner_sorts ~ids_to_inner_types (id,n,context,ty) += + let module K = Content in + let context' = + List.map + (function + (id,None) -> None + | (id,Some (name,Cic.ADecl t)) -> + Some + (* We should call build_decl_item, but we have not computed *) + (* the inner-types ==> we always produce a declaration *) + (`Declaration + { K.dec_name = name_of name; + K.dec_id = gen_id declaration_prefix seed; + K.dec_inductive = false; + K.dec_aref = get_id t; + K.dec_type = t + }) + | (id,Some (name,Cic.ADef t)) -> + Some + (* We should call build_def_item, but we have not computed *) + (* the inner-types ==> we always produce a declaration *) + (`Definition + { K.def_name = name_of name; + K.def_id = gen_id definition_prefix seed; + K.def_aref = get_id t; + K.def_term = t + }) + ) context + in + (id,n,context',ty) +;; + +(* map_sequent is similar to map_conjectures, but the for the hid +of the hypothesis, which are preserved instead of generating +fresh ones. We shall have to adopt a uniform policy, soon or later *) + +let map_sequent ((id,n,context,ty):Cic.annconjecture) = + let module K = Content in + let context' = + List.map + (function + (id,None) -> None + | (id,Some (name,Cic.ADecl t)) -> + Some + (* We should call build_decl_item, but we have not computed *) + (* the inner-types ==> we always produce a declaration *) + (`Declaration + { K.dec_name = name_of name; + K.dec_id = id; + K.dec_inductive = false; + K.dec_aref = get_id t; + K.dec_type = t + }) + | (id,Some (name,Cic.ADef t)) -> + Some + (* We should call build_def_item, but we have not computed *) + (* the inner-types ==> we always produce a declaration *) + (`Definition + { K.def_name = name_of name; + K.def_id = id; + K.def_aref = get_id t; + K.def_term = t + }) + ) context + in + (id,n,context',ty) +;; + +let rec annobj2content ~ids_to_inner_sorts ~ids_to_inner_types = + let module C = Cic in + let module K = Content in + let module C2A = Cic2acic in + let seed = ref 0 in + function + C.ACurrentProof (_,_,n,conjectures,bo,ty,params,_) -> + (gen_id object_prefix seed, params, + Some + (List.map + (map_conjectures seed ~ids_to_inner_sorts ~ids_to_inner_types) + conjectures), + `Def (K.Const,ty, + build_def_item + seed [] (Deannotate.deannotate_conjectures conjectures) + (get_id bo) (C.Name n) bo + ~ids_to_inner_sorts ~ids_to_inner_types)) + | C.AConstant (_,_,n,Some bo,ty,params,_) -> + (gen_id object_prefix seed, params, None, + `Def (K.Const,ty, + build_def_item seed [] [] (get_id bo) (C.Name n) bo + ~ids_to_inner_sorts ~ids_to_inner_types)) + | C.AConstant (id,_,n,None,ty,params,_) -> + (gen_id object_prefix seed, params, None, + `Decl (K.Const, + build_decl_item seed id (C.Name n) ty + ~ids_to_inner_sorts)) + | C.AVariable (_,n,Some bo,ty,params,_) -> + (gen_id object_prefix seed, params, None, + `Def (K.Var,ty, + build_def_item seed [] [] (get_id bo) (C.Name n) bo + ~ids_to_inner_sorts ~ids_to_inner_types)) + | C.AVariable (id,n,None,ty,params,_) -> + (gen_id object_prefix seed, params, None, + `Decl (K.Var, + build_decl_item seed id (C.Name n) ty + ~ids_to_inner_sorts)) + | C.AInductiveDefinition (id,l,params,nparams,_) -> + (gen_id object_prefix seed, params, None, + `Joint + { K.joint_id = gen_id joint_prefix seed; + K.joint_kind = `Inductive nparams; + K.joint_defs = List.map (build_inductive seed) l + }) + +and + build_inductive seed = + let module K = Content in + fun (_,n,b,ty,l) -> + `Inductive + { K.inductive_id = gen_id inductive_prefix seed; + K.inductive_name = n; + K.inductive_kind = b; + K.inductive_type = ty; + K.inductive_constructors = build_constructors seed l + } + +and + build_constructors seed l = + let module K = Content in + List.map + (fun (n,t) -> + { K.dec_name = Some n; + K.dec_id = gen_id declaration_prefix seed; + K.dec_inductive = false; + K.dec_aref = ""; + K.dec_type = t + }) l +;; + +(* +and 'term cinductiveType = + id * string * bool * 'term * (* typename, inductive, arity *) + 'term cconstructor list (* constructors *) + +and 'term cconstructor = + string * 'term +*) + + diff --git a/components/acic_content/acic2content.mli b/components/acic_content/acic2content.mli new file mode 100644 index 000000000..32ce68859 --- /dev/null +++ b/components/acic_content/acic2content.mli @@ -0,0 +1,36 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val annobj2content : + ids_to_inner_sorts:(Cic.id, Cic2acic.sort_kind) Hashtbl.t -> + ids_to_inner_types:(Cic.id, Cic2acic.anntypes) Hashtbl.t -> + Cic.annobj -> + Cic.annterm Content.cobj + +val map_sequent : + Cic.annconjecture -> Cic.annterm Content.conjecture + +val hide_coercions: bool ref + diff --git a/components/acic_content/cicNotationEnv.ml b/components/acic_content/cicNotationEnv.ml new file mode 100644 index 000000000..32d4f0df5 --- /dev/null +++ b/components/acic_content/cicNotationEnv.ml @@ -0,0 +1,153 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +module Ast = CicNotationPt + +type value = + | TermValue of Ast.term + | StringValue of string + | NumValue of string + | OptValue of value option + | ListValue of value list + +type value_type = + | TermType + | StringType + | NumType + | OptType of value_type + | ListType of value_type + +exception Value_not_found of string +exception Type_mismatch of string * value_type + +type declaration = string * value_type +type binding = string * (value_type * value) +type t = binding list + +let lookup env name = + try + List.assoc name env + with Not_found -> raise (Value_not_found name) + +let lookup_value env name = + try + snd (List.assoc name env) + with Not_found -> raise (Value_not_found name) + +let remove_name env name = List.remove_assoc name env + +let remove_names env names = + List.filter (fun name, _ -> not (List.mem name names)) env + +let lookup_term env name = + match lookup env name with + | _, TermValue x -> x + | ty, _ -> raise (Type_mismatch (name, ty)) + +let lookup_num env name = + match lookup env name with + | _, NumValue x -> x + | ty, _ -> raise (Type_mismatch (name, ty)) + +let lookup_string env name = + match lookup env name with + | _, StringValue x -> x + | ty, _ -> raise (Type_mismatch (name, ty)) + +let lookup_opt env name = + match lookup env name with + | _, OptValue x -> x + | ty, _ -> raise (Type_mismatch (name, ty)) + +let lookup_list env name = + match lookup env name with + | _, ListValue x -> x + | ty, _ -> raise (Type_mismatch (name, ty)) + +let opt_binding_some (n, (ty, v)) = (n, (OptType ty, OptValue (Some v))) +let opt_binding_none (n, (ty, v)) = (n, (OptType ty, OptValue None)) +let opt_binding_of_name (n, ty) = (n, (OptType ty, OptValue None)) +let list_binding_of_name (n, ty) = (n, (ListType ty, ListValue [])) +let opt_declaration (n, ty) = (n, OptType ty) +let list_declaration (n, ty) = (n, ListType ty) + +let declaration_of_var = function + | Ast.NumVar s -> s, NumType + | Ast.IdentVar s -> s, StringType + | Ast.TermVar s -> s, TermType + | _ -> assert false + +let value_of_term = function + | Ast.Num (s, _) -> NumValue s + | Ast.Ident (s, None) -> StringValue s + | t -> TermValue t + +let term_of_value = function + | NumValue s -> Ast.Num (s, 0) + | StringValue s -> Ast.Ident (s, None) + | TermValue t -> t + | _ -> assert false (* TO BE UNDERSTOOD *) + +let rec well_typed ty value = + match ty, value with + | TermType, TermValue _ + | StringType, StringValue _ + | OptType _, OptValue None + | NumType, NumValue _ -> true + | OptType ty', OptValue (Some value') -> well_typed ty' value' + | ListType ty', ListValue vl -> + List.for_all (fun value' -> well_typed ty' value') vl + | _ -> false + +let declarations_of_env = List.map (fun (name, (ty, _)) -> (name, ty)) +let declarations_of_term p = + List.map declaration_of_var (CicNotationUtil.variables_of_term p) + +let rec combine decls values = + match decls, values with + | [], [] -> [] + | (name, ty) :: decls, v :: values -> + (name, (ty, v)) :: (combine decls values) + | _ -> assert false + +let coalesce_env declarations env_list = + let env0 = List.map list_binding_of_name declarations in + let grow_env_entry env n v = + List.map + (function + | (n', (ty, ListValue vl)) as entry -> + if n' = n then n', (ty, ListValue (v :: vl)) else entry + | _ -> assert false) + env + in + let grow_env env_i env = + List.fold_left + (fun env (n, (_, v)) -> grow_env_entry env n v) + env env_i + in + List.fold_right grow_env env_list env0 + diff --git a/components/acic_content/cicNotationEnv.mli b/components/acic_content/cicNotationEnv.mli new file mode 100644 index 000000000..d4f87097e --- /dev/null +++ b/components/acic_content/cicNotationEnv.mli @@ -0,0 +1,92 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 Types} *) + +type value = + | TermValue of CicNotationPt.term + | StringValue of string + | NumValue of string + | OptValue of value option + | ListValue of value list + +type value_type = + | TermType + | StringType + | NumType + | OptType of value_type + | ListType of value_type + + (** looked up value not found in environment *) +exception Value_not_found of string + + (** looked up value has the wrong type + * parameters are value name and value type in environment *) +exception Type_mismatch of string * value_type + +type declaration = string * value_type +type binding = string * (value_type * value) +type t = binding list + +val declaration_of_var: CicNotationPt.pattern_variable -> declaration +val value_of_term: CicNotationPt.term -> value +val term_of_value: value -> CicNotationPt.term +val well_typed: value_type -> value -> bool + +val declarations_of_env: t -> declaration list +val declarations_of_term: CicNotationPt.term -> declaration list +val combine: declaration list -> value list -> t (** @raise Invalid_argument *) + +(** {2 Environment lookup} *) + +val lookup_value: t -> string -> value (** @raise Value_not_found *) + +(** lookup_* functions below may raise Value_not_found and Type_mismatch *) + +val lookup_term: t -> string -> CicNotationPt.term +val lookup_string: t -> string -> string +val lookup_num: t -> string -> string +val lookup_opt: t -> string -> value option +val lookup_list: t -> string -> value list + +val remove_name: t -> string -> t +val remove_names: t -> string list -> t + +(** {2 Bindings mangling} *) + +val opt_binding_some: binding -> binding (* v -> Some v *) +val opt_binding_none: binding -> binding (* v -> None *) + +val opt_binding_of_name: declaration -> binding (* None binding *) +val list_binding_of_name: declaration -> binding (* [] binding *) + +val opt_declaration: declaration -> declaration (* t -> OptType t *) +val list_declaration: declaration -> declaration (* t -> ListType t *) + +(** given a list of environments bindings a set of names n_1, ..., n_k, returns + * a single environment where n_i is bound to the list of values bound in the + * starting environments *) +val coalesce_env: declaration list -> t list -> t + diff --git a/components/acic_content/cicNotationPp.ml b/components/acic_content/cicNotationPp.ml new file mode 100644 index 000000000..4bd2f93ed --- /dev/null +++ b/components/acic_content/cicNotationPp.ml @@ -0,0 +1,352 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +module Ast = CicNotationPt +module Env = CicNotationEnv + + (* when set to true debugging information, not in sync with input syntax, will + * be added to the output of pp_term. + * set to false if you need, for example, cut and paste from matitac output to + * matitatop *) +let debug_printing = true + +let pp_binder = function + | `Lambda -> "lambda" + | `Pi -> "Pi" + | `Exists -> "exists" + | `Forall -> "forall" + +let pp_literal = + if debug_printing then + (function (* debugging version *) + | `Symbol s -> sprintf "symbol(%s)" s + | `Keyword s -> sprintf "keyword(%s)" s + | `Number s -> sprintf "number(%s)" s) + else + (function + | `Symbol s + | `Keyword s + | `Number s -> s) + +let pp_assoc = + function + | Gramext.NonA -> "NonA" + | Gramext.LeftA -> "LeftA" + | Gramext.RightA -> "RightA" + +let pp_pos = + function +(* `None -> "`None" *) + | `Left -> "`Left" + | `Right -> "`Right" + | `Inner -> "`Inner" + +let pp_attribute = + function + | `IdRef id -> sprintf "x(%s)" id + | `XmlAttrs attrs -> + sprintf "X(%s)" + (String.concat ";" + (List.map (fun (_, n, v) -> sprintf "%s=%s" n v) attrs)) + | `Level (prec, assoc) -> sprintf "L(%d%s)" prec (pp_assoc assoc) + | `Raw _ -> "R" + | `Loc _ -> "@" + | `ChildPos p -> sprintf "P(%s)" (pp_pos p) + +let pp_capture_variable pp_term = + function + | term, None -> pp_term (* ~pp_parens:false *) term + | term, Some typ -> "(" ^ pp_term (* ~pp_parens:false *) term ^ ": " ^ pp_term typ ^ ")" + +let rec pp_term ?(pp_parens = true) t = + let t_pp = + match t with + | Ast.AttributedTerm (attr, term) when debug_printing -> + sprintf "%s[%s]" (pp_attribute attr) (pp_term ~pp_parens:false term) + | Ast.AttributedTerm (`Raw text, _) -> text + | Ast.AttributedTerm (_, term) -> pp_term ~pp_parens:false term + | Ast.Appl terms -> + sprintf "%s" (String.concat " " (List.map pp_term terms)) + | Ast.Binder (`Forall, (Ast.Ident ("_", None), typ), body) + | Ast.Binder (`Pi, (Ast.Ident ("_", None), typ), body) -> + sprintf "%s \\to %s" + (match typ with None -> "?" | Some typ -> pp_term typ) + (pp_term ~pp_parens:true body) + | Ast.Binder (kind, var, body) -> + sprintf "\\%s %s.%s" (pp_binder kind) (pp_capture_variable pp_term var) + (pp_term ~pp_parens:true body) + | Ast.Case (term, indtype, typ, patterns) -> + sprintf "match %s%s%s with %s" + (pp_term term) + (match indtype with + | None -> "" + | Some (ty, href_opt) -> + sprintf " in %s%s" ty + (match debug_printing, href_opt with + | true, Some uri -> + sprintf "(i.e.%s)" (UriManager.string_of_uri uri) + | _ -> "")) + (match typ with None -> "" | Some t -> sprintf " return %s" (pp_term t)) + (pp_patterns patterns) + | Ast.Cast (t1, t2) -> sprintf "(%s: %s)" (pp_term ~pp_parens:true t1) (pp_term ~pp_parens:true t2) + | Ast.LetIn (var, t1, t2) -> + sprintf "let %s \\def %s in %s" (pp_capture_variable pp_term var) (pp_term ~pp_parens:true t1) + (pp_term ~pp_parens:true t2) + | Ast.LetRec (kind, definitions, term) -> + let rec get_guard i = function + | [] -> (*assert false*) Ast.Implicit + | [term, _] when i = 1 -> term + | _ :: tl -> get_guard (pred i) tl + in + let map (params, (id,typ), body, i) = + let typ = + match typ with + None -> Ast.Implicit + | Some typ -> typ + in + sprintf "%s %s on %s: %s \\def %s" + (pp_term ~pp_parens:false term) + (String.concat " " (List.map (pp_capture_variable pp_term) params)) + (pp_term ~pp_parens:false (get_guard i params)) + (pp_term typ) (pp_term body) + in + sprintf "let %s %s in %s" + (match kind with `Inductive -> "rec" | `CoInductive -> "corec") + (String.concat " and " (List.map map definitions)) + (pp_term term) + | Ast.Ident (name, Some []) | Ast.Ident (name, None) + | Ast.Uri (name, Some []) | Ast.Uri (name, None) -> + name + | Ast.Ident (name, Some substs) + | Ast.Uri (name, Some substs) -> + sprintf "%s \\subst [%s]" name (pp_substs substs) + | Ast.Implicit -> "?" + | Ast.Meta (index, substs) -> + sprintf "%d[%s]" index + (String.concat "; " + (List.map (function None -> "_" | Some t -> pp_term t) substs)) + | Ast.Num (num, _) -> num + | Ast.Sort `Set -> "Set" + | Ast.Sort `Prop -> "Prop" + | Ast.Sort (`Type _) -> "Type" + | Ast.Sort `CProp -> "CProp" + | Ast.Symbol (name, _) -> "'" ^ name + + | Ast.UserInput -> "" + + | Ast.Literal l -> pp_literal l + | Ast.Layout l -> pp_layout l + | Ast.Magic m -> pp_magic m + | Ast.Variable v -> pp_variable v + in + match pp_parens, t with + | false, _ + | true, Ast.Implicit + | true, Ast.Sort _ + | true, Ast.Ident (_, Some []) + | true, Ast.Ident (_, None) -> t_pp + | _ -> sprintf "(%s)" t_pp + +and pp_subst (name, term) = sprintf "%s \\Assign %s" name (pp_term term) +and pp_substs substs = String.concat "; " (List.map pp_subst substs) + +and pp_pattern = + function + Ast.Pattern (head, href, vars), term -> + let head_pp = + head ^ + (match debug_printing, href with + | true, Some uri -> sprintf "(i.e.%s)" (UriManager.string_of_uri uri) + | _ -> "") + in + sprintf "%s \\Rightarrow %s" + (match vars with + | [] -> head_pp + | _ -> + sprintf "(%s %s)" head_pp + (String.concat " " (List.map (pp_capture_variable pp_term) vars))) + (pp_term term) + | Ast.Wildcard, term -> + sprintf "_ \\Rightarrow %s" (pp_term term) + +and pp_patterns patterns = + sprintf "[%s]" (String.concat " | " (List.map pp_pattern patterns)) + +and pp_box_spec (kind, spacing, indent) = + let int_of_bool b = if b then 1 else 0 in + let kind_string = + match kind with + Ast.H -> "H" | Ast.V -> "V" | Ast.HV -> "HV" | Ast.HOV -> "HOV" + in + sprintf "%sBOX%d%d" kind_string (int_of_bool spacing) (int_of_bool indent) + +and pp_layout = function + | Ast.Sub (t1, t2) -> sprintf "%s \\SUB %s" (pp_term t1) (pp_term t2) + | Ast.Sup (t1, t2) -> sprintf "%s \\SUP %s" (pp_term t1) (pp_term t2) + | Ast.Below (t1, t2) -> sprintf "%s \\BELOW %s" (pp_term t1) (pp_term t2) + | Ast.Above (t1, t2) -> sprintf "%s \\ABOVE %s" (pp_term t1) (pp_term t2) + | Ast.Over (t1, t2) -> sprintf "[%s \\OVER %s]" (pp_term t1) (pp_term t2) + | Ast.Atop (t1, t2) -> sprintf "[%s \\ATOP %s]" (pp_term t1) (pp_term t2) + | Ast.Frac (t1, t2) -> sprintf "\\FRAC %s %s" (pp_term t1) (pp_term t2) + | Ast.Sqrt t -> sprintf "\\SQRT %s" (pp_term t) + | Ast.Root (arg, index) -> + sprintf "\\ROOT %s \\OF %s" (pp_term index) (pp_term arg) + | Ast.Break -> "\\BREAK" +(* | Space -> "\\SPACE" *) + | Ast.Box (box_spec, terms) -> + sprintf "\\%s [%s]" (pp_box_spec box_spec) + (String.concat " " (List.map pp_term terms)) + | Ast.Group terms -> + sprintf "\\GROUP [%s]" (String.concat " " (List.map pp_term terms)) + +and pp_magic = function + | Ast.List0 (t, sep_opt) -> + sprintf "list0 %s%s" (pp_term t) (pp_sep_opt sep_opt) + | Ast.List1 (t, sep_opt) -> + sprintf "list1 %s%s" (pp_term t) (pp_sep_opt sep_opt) + | Ast.Opt t -> sprintf "opt %s" (pp_term t) + | Ast.Fold (kind, p_base, names, p_rec) -> + let acc = match names with acc :: _ -> acc | _ -> assert false in + sprintf "fold %s %s rec %s %s" + (pp_fold_kind kind) (pp_term p_base) acc (pp_term p_rec) + | Ast.Default (p_some, p_none) -> + sprintf "default %s %s" (pp_term p_some) (pp_term p_none) + | Ast.If (p_test, p_true, p_false) -> + sprintf "if %s then %s else %s" + (pp_term p_test) (pp_term p_true) (pp_term p_false) + | Ast.Fail -> "fail" + +and pp_fold_kind = function + | `Left -> "left" + | `Right -> "right" + +and pp_sep_opt = function + | None -> "" + | Some sep -> sprintf " sep %s" (pp_literal sep) + +and pp_variable = function + | Ast.NumVar s -> "number " ^ s + | Ast.IdentVar s -> "ident " ^ s + | Ast.TermVar s -> "term " ^ s + | Ast.Ascription (t, n) -> assert false + | Ast.FreshVar n -> "fresh " ^ n + +let _pp_term = ref (pp_term ~pp_parens:false) +let pp_term t = !_pp_term t +let set_pp_term f = _pp_term := f + +let pp_params pp_term = function + | [] -> "" + | params -> " " ^ String.concat " " (List.map (pp_capture_variable pp_term) params) + +let pp_flavour = function + | `Definition -> "definition" + | `MutualDefinition -> assert false + | `Fact -> "fact" + | `Goal -> "goal" + | `Lemma -> "lemma" + | `Remark -> "remark" + | `Theorem -> "theorem" + | `Variant -> "variant" + | `Axiom -> "axiom" + +let pp_fields pp_term fields = + (if fields <> [] then "\n" else "") ^ + String.concat ";\n" + (List.map + (fun (name,ty,coercion,arity) -> + " " ^ name ^ + if coercion then (":" ^ + if arity > 0 then string_of_int arity else "" ^ ">") else ": " ^ + pp_term ty) fields) + +let pp_obj pp_term = function + | Ast.Inductive (params, types) -> + let pp_constructors constructors = + String.concat "\n" + (List.map (fun (name, typ) -> sprintf "| %s: %s" name (pp_term typ)) + constructors) + in + let pp_type (name, _, typ, constructors) = + sprintf "\nwith %s: %s \\def\n%s" name (pp_term typ) + (pp_constructors constructors) + in + (match types with + | [] -> assert false + | (name, inductive, typ, constructors) :: tl -> + let fst_typ_pp = + sprintf "%sinductive %s%s: %s \\def\n%s" + (if inductive then "" else "co") name (pp_params pp_term params) + (pp_term typ) (pp_constructors constructors) + in + fst_typ_pp ^ String.concat "" (List.map pp_type tl)) + | Ast.Theorem (`MutualDefinition, name, typ, body) -> + sprintf "<>" + | Ast.Theorem (flavour, name, typ, body) -> + sprintf "%s %s:\n %s\n%s" + (pp_flavour flavour) + name + (pp_term typ) + (match body with + | None -> "" + | Some body -> "\\def\n " ^ pp_term body) + | Ast.Record (params,name,ty,fields) -> + "record " ^ name ^ " " ^ pp_params pp_term params ^ ": " ^ pp_term ty ^ + " \\def {" ^ pp_fields pp_term fields ^ "\n}" + +let rec pp_value = function + | Env.TermValue t -> sprintf "$%s$" (pp_term t) + | Env.StringValue s -> sprintf "\"%s\"" s + | Env.NumValue n -> n + | Env.OptValue (Some v) -> "Some " ^ pp_value v + | Env.OptValue None -> "None" + | Env.ListValue l -> sprintf "[%s]" (String.concat "; " (List.map pp_value l)) + +let rec pp_value_type = + function + | Env.TermType -> "Term" + | Env.StringType -> "String" + | Env.NumType -> "Number" + | Env.OptType t -> "Maybe " ^ pp_value_type t + | Env.ListType l -> "List " ^ pp_value_type l + +let pp_env env = + String.concat "; " + (List.map + (fun (name, (ty, value)) -> + sprintf "%s : %s = %s" name (pp_value_type ty) (pp_value value)) + env) + +let rec pp_cic_appl_pattern = function + | Ast.UriPattern uri -> UriManager.string_of_uri uri + | Ast.VarPattern name -> name + | Ast.ImplicitPattern -> "_" + | Ast.ApplPattern aps -> + sprintf "(%s)" (String.concat " " (List.map pp_cic_appl_pattern aps)) + diff --git a/components/acic_content/cicNotationPp.mli b/components/acic_content/cicNotationPp.mli new file mode 100644 index 000000000..d883ddfc6 --- /dev/null +++ b/components/acic_content/cicNotationPp.mli @@ -0,0 +1,55 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** ZACK + * This module does not print terms and object properly, it has been created + * mainly for debugging reason. There is no guarantee that printed strings are + * re-parsable. Moreover, actually there is no way at all to proper print + * objects in a way that is re-parsable. + * + * TODO the proper implementation of a pp_obj function like the one below should + * be as follows. Change its type to + * pp_obj: CicNotationPt.obj -> CicNotationPres.markup + * and parametrize it over a function with the following type + * pp_term: CicNotationPt.term -> CicNotationPres.markup + * The obtained markup can then be printed using CicNotationPres.print_xml or + * BoxPp.render_to_string(s) + *) + +val pp_term: CicNotationPt.term -> string +val pp_obj: ('term -> string) -> 'term CicNotationPt.obj -> string + +val pp_env: CicNotationEnv.t -> string +val pp_value: CicNotationEnv.value -> string +val pp_value_type: CicNotationEnv.value_type -> string + +val pp_pos: CicNotationPt.child_pos -> string +val pp_attribute: CicNotationPt.term_attribute -> string + +val pp_cic_appl_pattern: CicNotationPt.cic_appl_pattern -> string + + (** non re-entrant change of pp_term function above *) +val set_pp_term: (CicNotationPt.term -> string) -> unit + diff --git a/components/acic_content/cicNotationPt.ml b/components/acic_content/cicNotationPt.ml new file mode 100644 index 000000000..d9d92ad6f --- /dev/null +++ b/components/acic_content/cicNotationPt.ml @@ -0,0 +1,194 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +(** CIC Notation Parse Tree *) + +type binder_kind = [ `Lambda | `Pi | `Exists | `Forall ] +type induction_kind = [ `Inductive | `CoInductive ] +type sort_kind = [ `Prop | `Set | `Type of CicUniv.universe | `CProp ] +type fold_kind = [ `Left | `Right ] + +type location = Stdpp.location +let fail floc msg = + let (x, y) = HExtlib.loc_of_floc floc in + failwith (Printf.sprintf "Error at characters %d - %d: %s" x y msg) + +type href = UriManager.uri + +type child_pos = [ `Left | `Right | `Inner ] + +type term_attribute = + [ `Loc of location (* source file location *) + | `IdRef of string (* ACic pointer *) + | `Level of int * Gramext.g_assoc (* precedence, associativity *) + | `ChildPos of child_pos (* position of l1 pattern variables *) + | `XmlAttrs of (string option * string * string) list + (* list of XML attributes: namespace, name, value *) + | `Raw of string (* unparsed version *) + ] + +type literal = + [ `Symbol of string + | `Keyword of string + | `Number of string + ] + +type case_indtype = string * href option + +type 'term capture_variable = 'term * 'term option + +(** To be increased each time the term type below changes, used for "safe" + * marshalling *) +let magic = 2 + +type term = + (* CIC AST *) + + | AttributedTerm of term_attribute * term + + | Appl of term list + | Binder of binder_kind * term capture_variable * term (* kind, name, body *) + | Case of term * case_indtype option * term option * + (case_pattern * term) list + (* what to match, inductive type, out type, list *) + | Cast of term * term + | LetIn of term capture_variable * term * term (* name, body, where *) + | LetRec of induction_kind * (term capture_variable list * term capture_variable * term * int) list * term + (* (params, name, body, decreasing arg) list, where *) + | Ident of string * subst list option + (* literal, substitutions. + * Some [] -> user has given an empty explicit substitution list + * None -> user has given no explicit substitution list *) + | Implicit + | Meta of int * meta_subst list + | Num of string * int (* literal, instance *) + | Sort of sort_kind + | Symbol of string * int (* canonical name, instance *) + + | UserInput (* place holder for user input, used by MatitaConsole, not to be + used elsewhere *) + | Uri of string * subst list option (* as Ident, for long names *) + + (* Syntax pattern extensions *) + + | Literal of literal + | Layout of layout_pattern + + | Magic of magic_term + | Variable of pattern_variable + + (* name, type. First component must be Ident or Variable (FreshVar _) *) + +and meta_subst = term option +and subst = string * term +and case_pattern = + Pattern of string * href option * term capture_variable list + | Wildcard + +and box_kind = H | V | HV | HOV +and box_spec = box_kind * bool * bool (* kind, spacing, indent *) + +and layout_pattern = + | Sub of term * term + | Sup of term * term + | Below of term * term + | Above of term * term + | Frac of term * term + | Over of term * term + | Atop of term * term +(* | array of term * literal option * literal option + |+ column separator, row separator +| *) + | Sqrt of term + | Root of term * term (* argument, index *) + | Break + | Box of box_spec * term list + | Group of term list + +and magic_term = + (* level 1 magics *) + | List0 of term * literal option (* pattern, separator *) + | List1 of term * literal option (* pattern, separator *) + | Opt of term + + (* level 2 magics *) + | Fold of fold_kind * term * string list * term + (* base case pattern, recursive case bound names, recursive case pattern *) + | Default of term * term (* "some" case pattern, "none" case pattern *) + | Fail + | If of term * term * term (* test, pattern if true, pattern if false *) + +and pattern_variable = + (* level 1 and 2 variables *) + | NumVar of string + | IdentVar of string + | TermVar of string + + (* level 1 variables *) + | Ascription of term * string + + (* level 2 variables *) + | FreshVar of string + +type argument_pattern = + | IdentArg of int * string (* eta-depth, name *) + +type cic_appl_pattern = + | UriPattern of UriManager.uri + | VarPattern of string + | ImplicitPattern + | ApplPattern of cic_appl_pattern list + + (** + * true means inductive, false coinductive *) +type 'term inductive_type = string * bool * 'term * (string * 'term) list + +type 'term obj = + | Inductive of 'term capture_variable list * 'term inductive_type list + (** parameters, list of loc * mutual inductive types *) + | Theorem of Cic.object_flavour * string * 'term * 'term option + (** flavour, name, type, body + * - name is absent when an unnamed theorem is being proved, tipically in + * interactive usage + * - body is present when its given along with the command, otherwise it + * will be given in proof editing mode using the tactical language, + * unless the flavour is an Axiom + *) + | Record of 'term capture_variable list * string * 'term * (string * 'term * bool * int) list + (** left parameters, name, type, fields *) + +(** {2 Standard precedences} *) + +let let_in_prec = 10 +let binder_prec = 20 +let apply_prec = 70 +let simple_prec = 90 + +let let_in_assoc = Gramext.NonA +let binder_assoc = Gramext.RightA +let apply_assoc = Gramext.LeftA +let simple_assoc = Gramext.NonA + diff --git a/components/acic_content/cicNotationUtil.ml b/components/acic_content/cicNotationUtil.ml new file mode 100644 index 000000000..99aafa440 --- /dev/null +++ b/components/acic_content/cicNotationUtil.ml @@ -0,0 +1,399 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +module Ast = CicNotationPt + +let visit_ast ?(special_k = fun _ -> assert false) k = + let rec aux = function + | Ast.Appl terms -> Ast.Appl (List.map k terms) + | Ast.Binder (kind, var, body) -> + Ast.Binder (kind, aux_capture_variable var, k body) + | Ast.Case (term, indtype, typ, patterns) -> + Ast.Case (k term, indtype, aux_opt typ, aux_patterns patterns) + | Ast.Cast (t1, t2) -> Ast.Cast (k t1, k t2) + | Ast.LetIn (var, t1, t2) -> + Ast.LetIn (aux_capture_variable var, k t1, k t2) + | Ast.LetRec (kind, definitions, term) -> + let definitions = + List.map + (fun (params, var, ty, decrno) -> + List.map aux_capture_variable params, aux_capture_variable var, + k ty, decrno) + definitions + in + Ast.LetRec (kind, definitions, k term) + | Ast.Ident (name, Some substs) -> + Ast.Ident (name, Some (aux_substs substs)) + | Ast.Uri (name, Some substs) -> Ast.Uri (name, Some (aux_substs substs)) + | Ast.Meta (index, substs) -> Ast.Meta (index, List.map aux_opt substs) + | (Ast.AttributedTerm _ + | Ast.Layout _ + | Ast.Literal _ + | Ast.Magic _ + | Ast.Variable _) as t -> special_k t + | (Ast.Ident _ + | Ast.Implicit + | Ast.Num _ + | Ast.Sort _ + | Ast.Symbol _ + | Ast.Uri _ + | Ast.UserInput) as t -> t + and aux_opt = function + | None -> None + | Some term -> Some (k term) + and aux_capture_variable (term, typ_opt) = k term, aux_opt typ_opt + and aux_patterns patterns = List.map aux_pattern patterns + and aux_pattern = + function + Ast.Pattern (head, hrefs, vars), term -> + Ast.Pattern (head, hrefs, List.map aux_capture_variable vars), k term + | Ast.Wildcard, term -> Ast.Wildcard, k term + and aux_subst (name, term) = (name, k term) + and aux_substs substs = List.map aux_subst substs + in + aux + +let visit_layout k = function + | Ast.Sub (t1, t2) -> Ast.Sub (k t1, k t2) + | Ast.Sup (t1, t2) -> Ast.Sup (k t1, k t2) + | Ast.Below (t1, t2) -> Ast.Below (k t1, k t2) + | Ast.Above (t1, t2) -> Ast.Above (k t1, k t2) + | Ast.Over (t1, t2) -> Ast.Over (k t1, k t2) + | Ast.Atop (t1, t2) -> Ast.Atop (k t1, k t2) + | Ast.Frac (t1, t2) -> Ast.Frac (k t1, k t2) + | Ast.Sqrt t -> Ast.Sqrt (k t) + | Ast.Root (arg, index) -> Ast.Root (k arg, k index) + | Ast.Break -> Ast.Break + | Ast.Box (kind, terms) -> Ast.Box (kind, List.map k terms) + | Ast.Group terms -> Ast.Group (List.map k terms) + +let visit_magic k = function + | Ast.List0 (t, l) -> Ast.List0 (k t, l) + | Ast.List1 (t, l) -> Ast.List1 (k t, l) + | Ast.Opt t -> Ast.Opt (k t) + | Ast.Fold (kind, t1, names, t2) -> Ast.Fold (kind, k t1, names, k t2) + | Ast.Default (t1, t2) -> Ast.Default (k t1, k t2) + | Ast.If (t1, t2, t3) -> Ast.If (k t1, k t2, k t3) + | Ast.Fail -> Ast.Fail + +let visit_variable k = function + | Ast.NumVar _ + | Ast.IdentVar _ + | Ast.TermVar _ + | Ast.FreshVar _ as t -> t + | Ast.Ascription (t, s) -> Ast.Ascription (k t, s) + +let variables_of_term t = + let rec vars = ref [] in + let add_variable v = + if List.mem v !vars then () + else vars := v :: !vars + in + let rec aux = function + | Ast.Magic m -> Ast.Magic (visit_magic aux m) + | Ast.Layout l -> Ast.Layout (visit_layout aux l) + | Ast.Variable v -> Ast.Variable (aux_variable v) + | Ast.Literal _ as t -> t + | Ast.AttributedTerm (_, t) -> aux t + | t -> visit_ast aux t + and aux_variable = function + | (Ast.NumVar _ + | Ast.IdentVar _ + | Ast.TermVar _) as t -> + add_variable t ; + t + | Ast.FreshVar _ as t -> t + | Ast.Ascription _ -> assert false + in + ignore (aux t) ; + !vars + +let names_of_term t = + let aux = function + | Ast.NumVar s + | Ast.IdentVar s + | Ast.TermVar s -> s + | _ -> assert false + in + List.map aux (variables_of_term t) + +let keywords_of_term t = + let rec keywords = ref [] in + let add_keyword k = keywords := k :: !keywords in + let rec aux = function + | Ast.AttributedTerm (_, t) -> aux t + | Ast.Layout l -> Ast.Layout (visit_layout aux l) + | Ast.Literal (`Keyword k) as t -> + add_keyword k; + t + | Ast.Literal _ as t -> t + | Ast.Magic m -> Ast.Magic (visit_magic aux m) + | Ast.Variable _ as v -> v + | t -> visit_ast aux t + in + ignore (aux t) ; + !keywords + +let rec strip_attributes t = + let special_k = function + | Ast.AttributedTerm (_, term) -> strip_attributes term + | Ast.Magic m -> Ast.Magic (visit_magic strip_attributes m) + | Ast.Variable _ as t -> t + | t -> assert false + in + visit_ast ~special_k strip_attributes t + +let rec get_idrefs = + function + | Ast.AttributedTerm (`IdRef id, t) -> id :: get_idrefs t + | Ast.AttributedTerm (_, t) -> get_idrefs t + | _ -> [] + +let meta_names_of_term term = + let rec names = ref [] in + let add_name n = + if List.mem n !names then () + else names := n :: !names + in + let rec aux = function + | Ast.AttributedTerm (_, term) -> aux term + | Ast.Appl terms -> List.iter aux terms + | Ast.Binder (_, _, body) -> aux body + | Ast.Case (term, indty, outty_opt, patterns) -> + aux term ; + aux_opt outty_opt ; + List.iter aux_branch patterns + | Ast.LetIn (_, t1, t2) -> + aux t1 ; + aux t2 + | Ast.LetRec (_, definitions, body) -> + List.iter aux_definition definitions ; + aux body + | Ast.Uri (_, Some substs) -> aux_substs substs + | Ast.Ident (_, Some substs) -> aux_substs substs + | Ast.Meta (_, substs) -> aux_meta_substs substs + + | Ast.Implicit + | Ast.Ident _ + | Ast.Num _ + | Ast.Sort _ + | Ast.Symbol _ + | Ast.Uri _ + | Ast.UserInput -> () + + | Ast.Magic magic -> aux_magic magic + | Ast.Variable var -> aux_variable var + + | _ -> assert false + and aux_opt = function + | Some term -> aux term + | None -> () + and aux_capture_var (_, ty_opt) = aux_opt ty_opt + and aux_branch (pattern, term) = + aux_pattern pattern ; + aux term + and aux_pattern = + function + Ast.Pattern (head, _, vars) -> List.iter aux_capture_var vars + | Ast.Wildcard -> () + and aux_definition (params, var, term, decrno) = + List.iter aux_capture_var params ; + aux_capture_var var ; + aux term + and aux_substs substs = List.iter (fun (_, term) -> aux term) substs + and aux_meta_substs meta_substs = List.iter aux_opt meta_substs + and aux_variable = function + | Ast.NumVar name -> add_name name + | Ast.IdentVar name -> add_name name + | Ast.TermVar name -> add_name name + | Ast.FreshVar _ -> () + | Ast.Ascription _ -> assert false + and aux_magic = function + | Ast.Default (t1, t2) + | Ast.Fold (_, t1, _, t2) -> + aux t1 ; + aux t2 + | Ast.If (t1, t2, t3) -> + aux t1 ; + aux t2 ; + aux t3 + | Ast.Fail -> () + | _ -> assert false + in + aux term ; + !names + +let rectangular matrix = + let columns = Array.length matrix.(0) in + try + Array.iter (fun a -> if Array.length a <> columns then raise Exit) matrix; + true + with Exit -> false + +let ncombine ll = + let matrix = Array.of_list (List.map Array.of_list ll) in + assert (rectangular matrix); + let rows = Array.length matrix in + let columns = Array.length matrix.(0) in + let lists = ref [] in + for j = 0 to columns - 1 do + let l = ref [] in + for i = 0 to rows - 1 do + l := matrix.(i).(j) :: !l + done; + lists := List.rev !l :: !lists + done; + List.rev !lists + +let string_of_literal = function + | `Symbol s + | `Keyword s + | `Number s -> s + +let boxify = function + | [ a ] -> a + | l -> Ast.Layout (Ast.Box ((Ast.H, false, false), l)) + +let unboxify = function + | Ast.Layout (Ast.Box ((Ast.H, false, false), [ a ])) -> a + | l -> l + +let group = function + | [ a ] -> a + | l -> Ast.Layout (Ast.Group l) + +let ungroup = + let rec aux acc = + function + [] -> List.rev acc + | Ast.Layout (Ast.Group terms) :: terms' -> aux acc (terms @ terms') + | term :: terms -> aux (term :: acc) terms + in + aux [] + +let dress ~sep:sauce = + let rec aux = + function + | [] -> [] + | [hd] -> [hd] + | hd :: tl -> hd :: sauce :: aux tl + in + aux + +let dressn ~sep:sauces = + let rec aux = + function + | [] -> [] + | [hd] -> [hd] + | hd :: tl -> hd :: sauces @ aux tl + in + aux + +let find_appl_pattern_uris ap = + let rec aux acc = + function + | Ast.UriPattern uri -> uri :: acc + | Ast.ImplicitPattern + | Ast.VarPattern _ -> acc + | Ast.ApplPattern apl -> List.fold_left aux acc apl + in + let uris = aux [] ap in + HExtlib.list_uniq (List.fast_sort UriManager.compare uris) + +let rec find_branch = + function + Ast.Magic (Ast.If (_, Ast.Magic Ast.Fail, t)) -> find_branch t + | Ast.Magic (Ast.If (_, t, _)) -> find_branch t + | t -> t + +let cic_name_of_name = function + | Ast.Ident ("_", None) -> Cic.Anonymous + | Ast.Ident (name, None) -> Cic.Name name + | _ -> assert false + +let name_of_cic_name = +(* let add_dummy_xref t = Ast.AttributedTerm (`IdRef "", t) in *) + (* ZACK why we used to generate dummy xrefs? *) + let add_dummy_xref t = t in + function + | Cic.Name s -> add_dummy_xref (Ast.Ident (s, None)) + | Cic.Anonymous -> add_dummy_xref (Ast.Ident ("_", None)) + +let fresh_index = ref ~-1 + +type notation_id = int + +let fresh_id () = + incr fresh_index; + !fresh_index + + (* TODO ensure that names generated by fresh_var do not clash with user's *) +let fresh_name () = "fresh" ^ string_of_int (fresh_id ()) + +let rec freshen_term ?(index = ref 0) term = + let freshen_term = freshen_term ~index in + let fresh_instance () = incr index; !index in + let special_k = function + | Ast.AttributedTerm (attr, t) -> Ast.AttributedTerm (attr, freshen_term t) + | Ast.Layout l -> Ast.Layout (visit_layout freshen_term l) + | Ast.Magic m -> Ast.Magic (visit_magic freshen_term m) + | Ast.Variable v -> Ast.Variable (visit_variable freshen_term v) + | Ast.Literal _ as t -> t + | _ -> assert false + in + match term with + | Ast.Symbol (s, instance) -> Ast.Symbol (s, fresh_instance ()) + | Ast.Num (s, instance) -> Ast.Num (s, fresh_instance ()) + | t -> visit_ast ~special_k freshen_term t + +let freshen_obj obj = + let index = ref 0 in + let freshen_term = freshen_term ~index in + let freshen_name_ty = List.map (fun (n, t) -> (n, freshen_term t)) in + let freshen_name_ty_b = List.map (fun (n,t,b,i) -> (n,freshen_term t,b,i)) in + let freshen_capture_variables = + List.map (fun (n,t) -> (freshen_term n, HExtlib.map_option freshen_term t)) + in + match obj with + | CicNotationPt.Inductive (params, indtypes) -> + let indtypes = + List.map + (fun (n, co, ty, ctors) -> (n, co, ty, freshen_name_ty ctors)) + indtypes + in + CicNotationPt.Inductive (freshen_capture_variables params, indtypes) + | CicNotationPt.Theorem (flav, n, t, ty_opt) -> + let ty_opt = + match ty_opt with None -> None | Some ty -> Some (freshen_term ty) + in + CicNotationPt.Theorem (flav, n, freshen_term t, ty_opt) + | CicNotationPt.Record (params, n, ty, fields) -> + CicNotationPt.Record (freshen_capture_variables params, n, + freshen_term ty, freshen_name_ty_b fields) + +let freshen_term = freshen_term ?index:None + diff --git a/components/acic_content/cicNotationUtil.mli b/components/acic_content/cicNotationUtil.mli new file mode 100644 index 000000000..2ead321f6 --- /dev/null +++ b/components/acic_content/cicNotationUtil.mli @@ -0,0 +1,91 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val fresh_name: unit -> string + +val variables_of_term: CicNotationPt.term -> CicNotationPt.pattern_variable list +val names_of_term: CicNotationPt.term -> string list + + (** extract all keywords (i.e. string literals) from a level 1 pattern *) +val keywords_of_term: CicNotationPt.term -> string list + +val visit_ast: + ?special_k:(CicNotationPt.term -> CicNotationPt.term) -> + (CicNotationPt.term -> CicNotationPt.term) -> + CicNotationPt.term -> + CicNotationPt.term + +val visit_layout: + (CicNotationPt.term -> CicNotationPt.term) -> + CicNotationPt.layout_pattern -> + CicNotationPt.layout_pattern + +val visit_magic: + (CicNotationPt.term -> CicNotationPt.term) -> + CicNotationPt.magic_term -> + CicNotationPt.magic_term + +val visit_variable: + (CicNotationPt.term -> CicNotationPt.term) -> + CicNotationPt.pattern_variable -> + CicNotationPt.pattern_variable + +val strip_attributes: CicNotationPt.term -> CicNotationPt.term + + (** @return the list of proper (i.e. non recursive) IdRef of a term *) +val get_idrefs: CicNotationPt.term -> string list + + (** generalization of List.combine to n lists *) +val ncombine: 'a list list -> 'a list list + +val string_of_literal: CicNotationPt.literal -> string + +val dress: sep:'a -> 'a list -> 'a list +val dressn: sep:'a list -> 'a list -> 'a list + +val boxify: CicNotationPt.term list -> CicNotationPt.term +val group: CicNotationPt.term list -> CicNotationPt.term +val ungroup: CicNotationPt.term list -> CicNotationPt.term list + +val find_appl_pattern_uris: + CicNotationPt.cic_appl_pattern -> UriManager.uri list + +val find_branch: + CicNotationPt.term -> CicNotationPt.term + +val cic_name_of_name: CicNotationPt.term -> Cic.name +val name_of_cic_name: Cic.name -> CicNotationPt.term + + (** Symbol/Numbers instances *) + +val freshen_term: CicNotationPt.term -> CicNotationPt.term +val freshen_obj: CicNotationPt.term CicNotationPt.obj -> CicNotationPt.term CicNotationPt.obj + + (** Notation id handling *) + +type notation_id + +val fresh_id: unit -> notation_id + diff --git a/components/acic_content/content.ml b/components/acic_content/content.ml new file mode 100644 index 000000000..c8b22f497 --- /dev/null +++ b/components/acic_content/content.ml @@ -0,0 +1,169 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(**************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 16/6/2003 *) +(* *) +(**************************************************************************) + +(* $Id$ *) + +type id = string;; +type joint_recursion_kind = + [ `Recursive of int list + | `CoRecursive + | `Inductive of int (* paramsno *) + | `CoInductive of int (* paramsno *) + ] +;; + +type var_or_const = Var | Const;; + +type 'term declaration = + { dec_name : string option; + dec_id : id ; + dec_inductive : bool; + dec_aref : string; + dec_type : 'term + } +;; + +type 'term definition = + { def_name : string option; + def_id : id ; + def_aref : string ; + def_term : 'term + } +;; + +type 'term inductive = + { inductive_id : id ; + inductive_name : string; + inductive_kind : bool; + inductive_type : 'term; + inductive_constructors : 'term declaration list + } +;; + +type 'term decl_context_element = + [ `Declaration of 'term declaration + | `Hypothesis of 'term declaration + ] +;; + +type ('term,'proof) def_context_element = + [ `Proof of 'proof + | `Definition of 'term definition + ] +;; + +type ('term,'proof) in_joint_context_element = + [ `Inductive of 'term inductive + | 'term decl_context_element + | ('term,'proof) def_context_element + ] +;; + +type ('term,'proof) joint = + { joint_id : id ; + joint_kind : joint_recursion_kind ; + joint_defs : ('term,'proof) in_joint_context_element list + } +;; + +type ('term,'proof) joint_context_element = + [ `Joint of ('term,'proof) joint ] +;; + +type 'term proof = + { proof_name : string option; + proof_id : id ; + proof_context : 'term in_proof_context_element list ; + proof_apply_context: 'term proof list; + proof_conclude : 'term conclude_item + } + +and 'term in_proof_context_element = + [ 'term decl_context_element + | ('term,'term proof) def_context_element + | ('term,'term proof) joint_context_element + ] + +and 'term conclude_item = + { conclude_id : id; + conclude_aref : string; + conclude_method : string; + conclude_args : ('term arg) list ; + conclude_conclusion : 'term option + } + +and 'term arg = + Aux of string + | Premise of premise + | Lemma of lemma + | Term of bool * 'term + | ArgProof of 'term proof + | ArgMethod of string (* ???? *) + +and premise = + { premise_id: id; + premise_xref : string ; + premise_binder : string option; + premise_n : int option; + } + +and lemma = + { lemma_id: id; + lemma_name: string; + lemma_uri: string + } + +;; + +type 'term conjecture = id * int * 'term context * 'term + +and 'term context = 'term hypothesis list + +and 'term hypothesis = + ['term decl_context_element | ('term,'term proof) def_context_element ] option +;; + +type 'term in_object_context_element = + [ `Decl of var_or_const * 'term decl_context_element + | `Def of var_or_const * 'term * ('term,'term proof) def_context_element + | ('term,'term proof) joint_context_element + ] +;; + +type 'term cobj = + id * (* id *) + UriManager.uri list * (* params *) + 'term conjecture list option * (* optional metasenv *) + 'term in_object_context_element (* actual object *) +;; diff --git a/components/acic_content/content.mli b/components/acic_content/content.mli new file mode 100644 index 000000000..546000330 --- /dev/null +++ b/components/acic_content/content.mli @@ -0,0 +1,157 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type id = string;; +type joint_recursion_kind = + [ `Recursive of int list (* decreasing arguments *) + | `CoRecursive + | `Inductive of int (* paramsno *) + | `CoInductive of int (* paramsno *) + ] +;; + +type var_or_const = Var | Const;; + +type 'term declaration = + { dec_name : string option; + dec_id : id ; + dec_inductive : bool; + dec_aref : string; + dec_type : 'term + } +;; + +type 'term definition = + { def_name : string option; + def_id : id ; + def_aref : string ; + def_term : 'term + } +;; + +type 'term inductive = + { inductive_id : id ; + inductive_name : string; + inductive_kind : bool; + inductive_type : 'term; + inductive_constructors : 'term declaration list + } +;; + +type 'term decl_context_element = + [ `Declaration of 'term declaration + | `Hypothesis of 'term declaration + ] +;; + +type ('term,'proof) def_context_element = + [ `Proof of 'proof + | `Definition of 'term definition + ] +;; + +type ('term,'proof) in_joint_context_element = + [ `Inductive of 'term inductive + | 'term decl_context_element + | ('term,'proof) def_context_element + ] +;; + +type ('term,'proof) joint = + { joint_id : id ; + joint_kind : joint_recursion_kind ; + joint_defs : ('term,'proof) in_joint_context_element list + } +;; + +type ('term,'proof) joint_context_element = + [ `Joint of ('term,'proof) joint ] +;; + +type 'term proof = + { proof_name : string option; + proof_id : id ; + proof_context : 'term in_proof_context_element list ; + proof_apply_context: 'term proof list; + proof_conclude : 'term conclude_item + } + +and 'term in_proof_context_element = + [ 'term decl_context_element + | ('term,'term proof) def_context_element + | ('term,'term proof) joint_context_element + ] + +and 'term conclude_item = + { conclude_id : id; + conclude_aref : string; + conclude_method : string; + conclude_args : ('term arg) list ; + conclude_conclusion : 'term option + } + +and 'term arg = + Aux of string + | Premise of premise + | Lemma of lemma + | Term of bool * 'term (* inferrable, term *) + | ArgProof of 'term proof + | ArgMethod of string (* ???? *) + +and premise = + { premise_id: id; + premise_xref : string ; + premise_binder : string option; + premise_n : int option; + } + +and lemma = + { lemma_id: id; + lemma_name : string; + lemma_uri: string + } +;; + +type 'term conjecture = id * int * 'term context * 'term + +and 'term context = 'term hypothesis list + +and 'term hypothesis = + ['term decl_context_element | ('term,'term proof) def_context_element ] option +;; + +type 'term in_object_context_element = + [ `Decl of var_or_const * 'term decl_context_element + | `Def of var_or_const * 'term * ('term,'term proof) def_context_element + | ('term,'term proof) joint_context_element + ] +;; + +type 'term cobj = + id * (* id *) + UriManager.uri list * (* params *) + 'term conjecture list option * (* optional metasenv *) + 'term in_object_context_element (* actual object *) +;; diff --git a/components/acic_content/content2cic.ml b/components/acic_content/content2cic.ml new file mode 100644 index 000000000..dcec61d84 --- /dev/null +++ b/components/acic_content/content2cic.ml @@ -0,0 +1,270 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(***************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 17/06/2003 *) +(* *) +(***************************************************************************) + +(* $Id$ *) + +exception TO_DO;; + +let proof2cic deannotate p = + let rec proof2cic premise_env p = + let module C = Cic in + let module Con = Content in + let rec extend_premise_env current_env = + function + [] -> current_env + | p::atl -> + extend_premise_env + ((p.Con.proof_id,(proof2cic current_env p))::current_env) atl in + let new_premise_env = extend_premise_env premise_env p.Con.proof_apply_context in + let body = conclude2cic new_premise_env p.Con.proof_conclude in + context2cic premise_env p.Con.proof_context body + + and context2cic premise_env context body = + List.fold_right (ce2cic premise_env) context body + + and ce2cic premise_env ce target = + let module C = Cic in + let module Con = Content in + match ce with + `Declaration d -> + (match d.Con.dec_name with + Some s -> + C.Lambda (C.Name s, deannotate d.Con.dec_type, target) + | None -> + C.Lambda (C.Anonymous, deannotate d.Con.dec_type, target)) + | `Hypothesis h -> + (match h.Con.dec_name with + Some s -> + C.Lambda (C.Name s, deannotate h.Con.dec_type, target) + | None -> + C.Lambda (C.Anonymous, deannotate h.Con.dec_type, target)) + | `Proof p -> + (match p.Con.proof_name with + Some s -> + C.LetIn (C.Name s, proof2cic premise_env p, target) + | None -> + C.LetIn (C.Anonymous, proof2cic premise_env p, target)) + | `Definition d -> + (match d.Con.def_name with + Some s -> + C.LetIn (C.Name s, proof2cic premise_env p, target) + | None -> + C.LetIn (C.Anonymous, proof2cic premise_env p, target)) + | `Joint {Con.joint_kind = kind; Con.joint_defs = defs} -> + (match target with + C.Rel n -> + (match kind with + `Recursive l -> + let funs = + List.map2 + (fun n bo -> + match bo with + `Proof bo -> + (match + bo.Con.proof_conclude.Con.conclude_conclusion, + bo.Con.proof_name + with + Some ty, Some name -> + (name,n,deannotate ty, + proof2cic premise_env bo) + | _,_ -> assert false) + | _ -> assert false) + l defs in + C.Fix (n, funs) + | `CoRecursive -> + let funs = + List.map + (function bo -> + match bo with + `Proof bo -> + (match + bo.Con.proof_conclude.Con.conclude_conclusion, + bo.Con.proof_name + with + Some ty, Some name -> + (name,deannotate ty, + proof2cic premise_env bo) + | _,_ -> assert false) + | _ -> assert false) + defs in + C.CoFix (n, funs) + | _ -> (* no inductive types in local contexts *) + assert false) + | _ -> assert false) + + and conclude2cic premise_env conclude = + let module C = Cic in + let module Con = Content in + if conclude.Con.conclude_method = "TD_Conversion" then + (match conclude.Con.conclude_args with + [Con.ArgProof p] -> proof2cic [] p (* empty! *) + | _ -> prerr_endline "1"; assert false) + else if conclude.Con.conclude_method = "BU_Conversion" then + (match conclude.Con.conclude_args with + [Con.Premise prem] -> + (try List.assoc prem.Con.premise_xref premise_env + with Not_found -> + prerr_endline + ("Not_found in BU_Conversion: " ^ prem.Con.premise_xref); + raise Not_found) + | _ -> prerr_endline "2"; assert false) + else if conclude.Con.conclude_method = "Exact" then + (match conclude.Con.conclude_args with + [Con.Term (_,t)] -> deannotate t + | [Con.Premise prem] -> + (match prem.Con.premise_n with + None -> assert false + | Some n -> C.Rel n) + | _ -> prerr_endline "3"; assert false) + else if conclude.Con.conclude_method = "Intros+LetTac" then + (match conclude.Con.conclude_args with + [Con.ArgProof p] -> proof2cic [] p (* empty! *) + | _ -> prerr_endline "4"; assert false) + else if (conclude.Con.conclude_method = "ByInduction" || + conclude.Con.conclude_method = "AndInd" || + conclude.Con.conclude_method = "Exists" || + conclude.Con.conclude_method = "FalseInd") then + (match (List.tl conclude.Con.conclude_args) with + Con.Term (_,C.AAppl ( + id,((C.AConst(idc,uri,exp_named_subst))::params_and_IP)))::args -> + let subst = + List.map (fun (u,t) -> (u, deannotate t)) exp_named_subst in + let cargs = args2cic premise_env args in + let cparams_and_IP = List.map deannotate params_and_IP in + C.Appl (C.Const(uri,subst)::cparams_and_IP@cargs) + | _ -> prerr_endline "5"; assert false) + else if (conclude.Con.conclude_method = "Rewrite") then + (match conclude.Con.conclude_args with + Con.Term (_,C.AConst (sid,uri,exp_named_subst))::args -> + let subst = + List.map (fun (u,t) -> (u, deannotate t)) exp_named_subst in + let cargs = args2cic premise_env args in + C.Appl (C.Const(uri,subst)::cargs) + | _ -> prerr_endline "6"; assert false) + else if (conclude.Con.conclude_method = "Case") then + (match conclude.Con.conclude_args with + Con.Aux(uri)::Con.Aux(notype)::Con.Term(_,ty)::Con.Premise(prem)::patterns -> + C.MutCase + (UriManager.uri_of_string uri, + int_of_string notype, deannotate ty, + List.assoc prem.Con.premise_xref premise_env, + List.map + (function + Con.ArgProof p -> proof2cic [] p + | _ -> prerr_endline "7a"; assert false) patterns) + | Con.Aux(uri)::Con.Aux(notype)::Con.Term(_,ty)::Con.Term(_,te)::patterns -> C.MutCase + (UriManager.uri_of_string uri, + int_of_string notype, deannotate ty, deannotate te, + List.map + (function + (Con.ArgProof p) -> proof2cic [] p + | _ -> prerr_endline "7a"; assert false) patterns) + | _ -> (prerr_endline "7"; assert false)) + else if (conclude.Con.conclude_method = "Apply") then + let cargs = (args2cic premise_env conclude.Con.conclude_args) in + C.Appl cargs + else (prerr_endline "8"; assert false) + + and args2cic premise_env l = + List.map (arg2cic premise_env) l + + and arg2cic premise_env = + let module C = Cic in + let module Con = Content in + function + Con.Aux n -> prerr_endline "8"; assert false + | Con.Premise prem -> + (match prem.Con.premise_n with + Some n -> C.Rel n + | None -> + (try List.assoc prem.Con.premise_xref premise_env + with Not_found -> + prerr_endline ("Not_found in arg2cic: premise " ^ (match prem.Con.premise_binder with None -> "previous" | Some p -> p) ^ ", xref=" ^ prem.Con.premise_xref); + raise Not_found)) + | Con.Lemma lemma -> + CicUtil.term_of_uri (UriManager.uri_of_string lemma.Con.lemma_uri) + | Con.Term (_,t) -> deannotate t + | Con.ArgProof p -> proof2cic [] p (* empty! *) + | Con.ArgMethod s -> raise TO_DO + +in proof2cic [] p +;; + +exception ToDo;; + +let cobj2obj deannotate (id,params,metasenv,obj) = + let module K = Content in + match obj with + `Def (Content.Const,ty,`Proof bo) -> + (match metasenv with + None -> + Cic.Constant + (id, Some (proof2cic deannotate bo), deannotate ty, params, []) + | Some metasenv' -> + let metasenv'' = + List.map + (function (_,i,canonical_context,term) -> + let canonical_context' = + List.map + (function + None -> None + | Some (`Declaration d) + | Some (`Hypothesis d) -> + (match d with + {K.dec_name = Some n ; K.dec_type = t} -> + Some (Cic.Name n, Cic.Decl (deannotate t)) + | _ -> assert false) + | Some (`Definition d) -> + (match d with + {K.def_name = Some n ; K.def_term = t} -> + Some (Cic.Name n, Cic.Def ((deannotate t),None)) + | _ -> assert false) + | Some (`Proof d) -> + (match d with + {K.proof_name = Some n } -> + Some (Cic.Name n, + Cic.Def ((proof2cic deannotate d),None)) + | _ -> assert false) + ) canonical_context + in + (i,canonical_context',deannotate term) + ) metasenv' + in + Cic.CurrentProof + (id, metasenv'', proof2cic deannotate bo, deannotate ty, params, + [])) + | _ -> raise ToDo +;; + +let cobj2obj = cobj2obj Deannotate.deannotate_term;; diff --git a/components/acic_content/content2cic.mli b/components/acic_content/content2cic.mli new file mode 100644 index 000000000..9bb6509cc --- /dev/null +++ b/components/acic_content/content2cic.mli @@ -0,0 +1,35 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(**************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 27/6/2003 *) +(* *) +(**************************************************************************) + +val cobj2obj : Cic.annterm Content.cobj -> Cic.obj diff --git a/components/acic_content/termAcicContent.ml b/components/acic_content/termAcicContent.ml new file mode 100644 index 000000000..681f3cd54 --- /dev/null +++ b/components/acic_content/termAcicContent.ml @@ -0,0 +1,466 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +module Ast = CicNotationPt + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) else () + +type interpretation_id = int + +let idref id t = Ast.AttributedTerm (`IdRef id, t) + +type term_info = + { sort: (Cic.id, Ast.sort_kind) Hashtbl.t; + uri: (Cic.id, UriManager.uri) Hashtbl.t; + } + +let get_types uri = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + | Cic.InductiveDefinition (l,_,lpsno,_) -> l, lpsno + | _ -> assert false + +let name_of_inductive_type uri i = + let types, _ = get_types uri in + let (name, _, _, _) = try List.nth types i with Not_found -> assert false in + name + + (* returns pairs *) +let constructors_of_inductive_type uri i = + let types, _ = get_types uri in + let (_, _, _, constructors) = + try List.nth types i with Not_found -> assert false + in + constructors + + (* returns name only *) +let constructor_of_inductive_type uri i j = + (try + fst (List.nth (constructors_of_inductive_type uri i) (j-1)) + with Not_found -> assert false) + + (* returns the number of left parameters *) +let left_params_no_of_inductive_type uri = + snd (get_types uri) + +let ast_of_acic0 ~output_type term_info acic k = + let k = k term_info in + let id_to_uris = term_info.uri in + let register_uri id uri = Hashtbl.add id_to_uris id uri in + let sort_of_id id = + try + Hashtbl.find term_info.sort id + with Not_found -> + prerr_endline (sprintf "warning: sort of id %s not found, using Type" id); + `Type (CicUniv.fresh ()) + in + let aux_substs substs = + Some + (List.map + (fun (uri, annterm) -> (UriManager.name_of_uri uri, k annterm)) + substs) + in + let aux_context context = + List.map + (function + | None -> None + | Some annterm -> Some (k annterm)) + context + in + let aux = function + | Cic.ARel (id,_,_,b) -> idref id (Ast.Ident (b, None)) + | Cic.AVar (id,uri,substs) -> + register_uri id uri; + idref id (Ast.Ident (UriManager.name_of_uri uri, aux_substs substs)) + | Cic.AMeta (id,n,l) -> idref id (Ast.Meta (n, aux_context l)) + | Cic.ASort (id,Cic.Prop) -> idref id (Ast.Sort `Prop) + | Cic.ASort (id,Cic.Set) -> idref id (Ast.Sort `Set) + | Cic.ASort (id,Cic.Type u) -> idref id (Ast.Sort (`Type u)) + | Cic.ASort (id,Cic.CProp) -> idref id (Ast.Sort `CProp) + | Cic.AImplicit (id, Some `Hole) -> idref id Ast.UserInput + | Cic.AImplicit (id, _) -> idref id Ast.Implicit + | Cic.AProd (id,n,s,t) -> + let binder_kind = + match sort_of_id id with + | `Set | `Type _ -> `Pi + | `Prop | `CProp -> `Forall + in + idref id (Ast.Binder (binder_kind, + (CicNotationUtil.name_of_cic_name n, Some (k s)), k t)) + | Cic.ACast (id,v,t) -> idref id (Ast.Cast (k v, k t)) + | Cic.ALambda (id,n,s,t) -> + idref id (Ast.Binder (`Lambda, + (CicNotationUtil.name_of_cic_name n, Some (k s)), k t)) + | Cic.ALetIn (id,n,s,t) -> + idref id (Ast.LetIn ((CicNotationUtil.name_of_cic_name n, None), + k s, k t)) + | Cic.AAppl (aid,(Cic.AConst _ as he::tl as args)) + | Cic.AAppl (aid,(Cic.AMutInd _ as he::tl as args)) + | Cic.AAppl (aid,(Cic.AMutConstruct _ as he::tl as args)) as t -> + let last_n n l = + let rec aux = + function + [] -> assert false + | [_] as l -> l,1 + | he::tl -> + let (res,len) as res' = aux tl in + if len < n then + he::res,len + 1 + else + res' + in + match fst (aux l) with + [] -> assert false + | [t] -> t + | Ast.AttributedTerm (_,(Ast.Appl l))::tl -> + idref aid (Ast.Appl (l@tl)) + | l -> idref aid (Ast.Appl l) + in + (match LibraryObjects.destroy_nat t with + | Some n -> idref aid (Ast.Num (string_of_int n, -1)) + | None -> + let deannot_he = Deannotate.deannotate_term he in + if CoercDb.is_a_coercion' deannot_he && !Acic2content.hide_coercions + then + (match CoercDb.is_a_coercion_to_funclass deannot_he with + | None -> idref aid (last_n 1 (List.map k tl)) + | Some i -> idref aid (last_n (i+1) (List.map k tl))) + else + idref aid (Ast.Appl (List.map k args))) + | Cic.AAppl (aid,args) -> + idref aid (Ast.Appl (List.map k args)) + | Cic.AConst (id,uri,substs) -> + register_uri id uri; + idref id (Ast.Ident (UriManager.name_of_uri uri, aux_substs substs)) + | Cic.AMutInd (id,uri,i,substs) -> + let name = name_of_inductive_type uri i in + let uri_str = UriManager.string_of_uri uri in + let puri_str = sprintf "%s#xpointer(1/%d)" uri_str (i+1) in + register_uri id (UriManager.uri_of_string puri_str); + idref id (Ast.Ident (name, aux_substs substs)) + | Cic.AMutConstruct (id,uri,i,j,substs) -> + let name = constructor_of_inductive_type uri i j in + let uri_str = UriManager.string_of_uri uri in + let puri_str = sprintf "%s#xpointer(1/%d/%d)" uri_str (i + 1) j in + register_uri id (UriManager.uri_of_string puri_str); + idref id (Ast.Ident (name, aux_substs substs)) + | Cic.AMutCase (id,uri,typeno,ty,te,patterns) -> + let name = name_of_inductive_type uri typeno in + let uri_str = UriManager.string_of_uri uri in + let puri_str = sprintf "%s#xpointer(1/%d)" uri_str (typeno+1) in + let ctor_puri j = + UriManager.uri_of_string + (sprintf "%s#xpointer(1/%d/%d)" uri_str (typeno+1) j) + in + let case_indty = name, Some (UriManager.uri_of_string puri_str) in + let constructors = constructors_of_inductive_type uri typeno in + let lpsno = left_params_no_of_inductive_type uri in + let rec eat_branch n ty pat = + match (ty, pat) with + | Cic.Prod (_, _, t), _ when n > 0 -> eat_branch (pred n) t pat + | Cic.Prod (_, _, t), Cic.ALambda (_, name, s, t') -> + let (cv, rhs) = eat_branch 0 t t' in + (CicNotationUtil.name_of_cic_name name, Some (k s)) :: cv, rhs + | _, _ -> [], k pat + in + let j = ref 0 in + let patterns = + try + List.map2 + (fun (name, ty) pat -> + incr j; + let name,(capture_variables,rhs) = + match output_type with + `Term -> name, eat_branch lpsno ty pat + | `Pattern -> "_", ([], k pat) + in + Ast.Pattern (name, Some (ctor_puri !j), capture_variables), rhs + ) constructors patterns + with Invalid_argument _ -> assert false + in + let indty = + match output_type with + `Pattern -> None + | `Term -> Some case_indty + in + idref id (Ast.Case (k te, indty, Some (k ty), patterns)) + | Cic.AFix (id, no, funs) -> + let defs = + List.map + (fun (_, n, decr_idx, ty, bo) -> + let params,bo = + let rec aux = + function + Cic.ALambda (_,name,so,ta) -> + let params,rest = aux ta in + (CicNotationUtil.name_of_cic_name name,Some (k so)):: + params, rest + | t -> [],t + in + aux bo + in + let ty = + let rec eat_pis = + function + 0,ty -> ty + | n,Cic.AProd (_,_,_,ta) -> eat_pis (n - 1,ta) + | n,ty -> + (* I should do a whd here, but I have no context *) + assert false + in + eat_pis ((List.length params),ty) + in + (params,(Ast.Ident (n, None), Some (k ty)), k bo, decr_idx)) + funs + in + let name = + try + (match List.nth defs no with + | _, (Ast.Ident (n, _), _), _, _ when n <> "_" -> n + | _ -> assert false) + with Not_found -> assert false + in + idref id (Ast.LetRec (`Inductive, defs, Ast.Ident (name, None))) + | Cic.ACoFix (id, no, funs) -> + let defs = + List.map + (fun (_, n, ty, bo) -> + let params,bo = + let rec aux = + function + Cic.ALambda (_,name,so,ta) -> + let params,rest = aux ta in + (CicNotationUtil.name_of_cic_name name,Some (k so)):: + params, rest + | t -> [],t + in + aux bo + in + let ty = + let rec eat_pis = + function + 0,ty -> ty + | n,Cic.AProd (_,_,_,ta) -> eat_pis (n - 1,ta) + | n,ty -> + (* I should do a whd here, but I have no context *) + assert false + in + eat_pis ((List.length params),ty) + in + (params,(Ast.Ident (n, None), Some (k ty)), k bo, 0)) + funs + in + let name = + try + (match List.nth defs no with + | _, (Ast.Ident (n, _), _), _, _ when n <> "_" -> n + | _ -> assert false) + with Not_found -> assert false + in + idref id (Ast.LetRec (`CoInductive, defs, Ast.Ident (name, None))) + in + aux acic + + (* persistent state *) + +let level2_patterns32 = Hashtbl.create 211 +let interpretations = Hashtbl.create 211 (* symb -> id list ref *) + +let compiled32 = ref None +let pattern32_matrix = ref [] + +let get_compiled32 () = + match !compiled32 with + | None -> assert false + | Some f -> Lazy.force f + +let set_compiled32 f = compiled32 := Some f + +let add_idrefs = + List.fold_right (fun idref t -> Ast.AttributedTerm (`IdRef idref, t)) + +let instantiate32 term_info idrefs env symbol args = + let rec instantiate_arg = function + | Ast.IdentArg (n, name) -> + let t = (try List.assoc name env with Not_found -> assert false) in + let rec count_lambda = function + | Ast.AttributedTerm (_, t) -> count_lambda t + | Ast.Binder (`Lambda, _, body) -> 1 + count_lambda body + | _ -> 0 + in + let rec add_lambda t n = + if n > 0 then + let name = CicNotationUtil.fresh_name () in + Ast.Binder (`Lambda, (Ast.Ident (name, None), None), + Ast.Appl [add_lambda t (n - 1); Ast.Ident (name, None)]) + else + t + in + add_lambda t (n - count_lambda t) + in + let head = + let symbol = Ast.Symbol (symbol, 0) in + add_idrefs idrefs symbol + in + if args = [] then head + else Ast.Appl (head :: List.map instantiate_arg args) + +let rec ast_of_acic1 ~output_type term_info annterm = + let id_to_uris = term_info.uri in + let register_uri id uri = Hashtbl.add id_to_uris id uri in + match (get_compiled32 ()) annterm with + | None -> + ast_of_acic0 ~output_type term_info annterm (ast_of_acic1 ~output_type) + | Some (env, ctors, pid) -> + let idrefs = + List.map + (fun annterm -> + let idref = CicUtil.id_of_annterm annterm in + (try + register_uri idref + (CicUtil.uri_of_term (Deannotate.deannotate_term annterm)) + with Invalid_argument _ -> ()); + idref) + ctors + in + let env' = + List.map + (fun (name, term) -> name, ast_of_acic1 ~output_type term_info term) env + in + let _, symbol, args, _ = + try + Hashtbl.find level2_patterns32 pid + with Not_found -> assert false + in + let ast = instantiate32 term_info idrefs env' symbol args in + Ast.AttributedTerm (`IdRef (CicUtil.id_of_annterm annterm), ast) + +let load_patterns32 t = + let t = + HExtlib.filter_map (function (true, ap, id) -> Some (ap, id) | _ -> None) t + in + set_compiled32 (lazy (Acic2astMatcher.Matcher32.compiler t)) + +let ast_of_acic ~output_type id_to_sort annterm = + debug_print (lazy ("ast_of_acic <- " + ^ CicPp.ppterm (Deannotate.deannotate_term annterm))); + let term_info = { sort = id_to_sort; uri = Hashtbl.create 211 } in + let ast = ast_of_acic1 ~output_type term_info annterm in + debug_print (lazy ("ast_of_acic -> " ^ CicNotationPp.pp_term ast)); + ast, term_info.uri + +let fresh_id = + let counter = ref ~-1 in + fun () -> + incr counter; + !counter + +let add_interpretation dsc (symbol, args) appl_pattern = + let id = fresh_id () in + Hashtbl.add level2_patterns32 id (dsc, symbol, args, appl_pattern); + pattern32_matrix := (true, appl_pattern, id) :: !pattern32_matrix; + load_patterns32 !pattern32_matrix; + (try + let ids = Hashtbl.find interpretations symbol in + ids := id :: !ids + with Not_found -> Hashtbl.add interpretations symbol (ref [id])); + id + +let get_all_interpretations () = + List.map + (function (_, _, id) -> + let (dsc, _, _, _) = + try + Hashtbl.find level2_patterns32 id + with Not_found -> assert false + in + (id, dsc)) + !pattern32_matrix + +let get_active_interpretations () = + HExtlib.filter_map (function (true, _, id) -> Some id | _ -> None) + !pattern32_matrix + +let set_active_interpretations ids = + let pattern32_matrix' = + List.map + (function + | (_, ap, id) when List.mem id ids -> (true, ap, id) + | (_, ap, id) -> (false, ap, id)) + !pattern32_matrix + in + pattern32_matrix := pattern32_matrix'; + load_patterns32 !pattern32_matrix + +exception Interpretation_not_found + +let lookup_interpretations symbol = + try + HExtlib.list_uniq + (List.sort Pervasives.compare + (List.map + (fun id -> + let (dsc, _, args, appl_pattern) = + try + Hashtbl.find level2_patterns32 id + with Not_found -> assert false + in + dsc, args, appl_pattern) + !(Hashtbl.find interpretations symbol))) + with Not_found -> raise Interpretation_not_found + +let remove_interpretation id = + (try + let _, symbol, _, _ = Hashtbl.find level2_patterns32 id in + let ids = Hashtbl.find interpretations symbol in + ids := List.filter ((<>) id) !ids; + Hashtbl.remove level2_patterns32 id; + with Not_found -> raise Interpretation_not_found); + pattern32_matrix := + List.filter (fun (_, _, id') -> id <> id') !pattern32_matrix; + load_patterns32 !pattern32_matrix + +let _ = load_patterns32 [] + +let instantiate_appl_pattern env appl_pattern = + let lookup name = + try List.assoc name env + with Not_found -> + prerr_endline (sprintf "Name %s not found" name); + assert false + in + let rec aux = function + | Ast.UriPattern uri -> CicUtil.term_of_uri uri + | Ast.ImplicitPattern -> Cic.Implicit None + | Ast.VarPattern name -> lookup name + | Ast.ApplPattern terms -> Cic.Appl (List.map aux terms) + in + aux appl_pattern + diff --git a/components/acic_content/termAcicContent.mli b/components/acic_content/termAcicContent.mli new file mode 100644 index 000000000..def5b0a1b --- /dev/null +++ b/components/acic_content/termAcicContent.mli @@ -0,0 +1,70 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + + (** {2 Persistant state handling} *) + +type interpretation_id + +val add_interpretation: + string -> (* id / description *) + string * CicNotationPt.argument_pattern list -> (* symbol, level 2 pattern *) + CicNotationPt.cic_appl_pattern -> (* level 3 pattern *) + interpretation_id + + (** @raise Interpretation_not_found *) +val lookup_interpretations: + string -> (* symbol *) + (string * CicNotationPt.argument_pattern list * + CicNotationPt.cic_appl_pattern) list + +exception Interpretation_not_found + + (** @raise Interpretation_not_found *) +val remove_interpretation: interpretation_id -> unit + + (** {3 Interpretations toggling} *) + +val get_all_interpretations: unit -> (interpretation_id * string) list +val get_active_interpretations: unit -> interpretation_id list +val set_active_interpretations: interpretation_id list -> unit + + (** {2 acic -> content} *) + +val ast_of_acic: + output_type:[`Pattern|`Term] -> + (Cic.id, CicNotationPt.sort_kind) Hashtbl.t -> (* id -> sort *) + Cic.annterm -> (* acic *) + CicNotationPt.term (* ast *) + * (Cic.id, UriManager.uri) Hashtbl.t (* id -> uri *) + + (** {2 content -> acic} *) + + (** @param env environment from argument_pattern to cic terms + * @param pat cic_appl_pattern *) +val instantiate_appl_pattern: + (string * Cic.term) list -> CicNotationPt.cic_appl_pattern -> + Cic.term + diff --git a/components/acic_procedural/.depend b/components/acic_procedural/.depend new file mode 100644 index 000000000..f0b67ebc3 --- /dev/null +++ b/components/acic_procedural/.depend @@ -0,0 +1,18 @@ +proceduralHelpers.cmo: proceduralHelpers.cmi +proceduralHelpers.cmx: proceduralHelpers.cmi +proceduralClassify.cmo: proceduralHelpers.cmi proceduralClassify.cmi +proceduralClassify.cmx: proceduralHelpers.cmx proceduralClassify.cmi +proceduralOptimizer.cmo: proceduralHelpers.cmi proceduralClassify.cmi \ + proceduralOptimizer.cmi +proceduralOptimizer.cmx: proceduralHelpers.cmx proceduralClassify.cmx \ + proceduralOptimizer.cmi +proceduralTypes.cmo: proceduralHelpers.cmi proceduralTypes.cmi +proceduralTypes.cmx: proceduralHelpers.cmx proceduralTypes.cmi +proceduralMode.cmo: proceduralClassify.cmi proceduralMode.cmi +proceduralMode.cmx: proceduralClassify.cmx proceduralMode.cmi +proceduralConversion.cmo: proceduralConversion.cmi +proceduralConversion.cmx: proceduralConversion.cmi +acic2Procedural.cmo: proceduralTypes.cmi proceduralHelpers.cmi \ + proceduralConversion.cmi proceduralClassify.cmi acic2Procedural.cmi +acic2Procedural.cmx: proceduralTypes.cmx proceduralHelpers.cmx \ + proceduralConversion.cmx proceduralClassify.cmx acic2Procedural.cmi diff --git a/components/acic_procedural/.depend.opt b/components/acic_procedural/.depend.opt new file mode 100644 index 000000000..f0b67ebc3 --- /dev/null +++ b/components/acic_procedural/.depend.opt @@ -0,0 +1,18 @@ +proceduralHelpers.cmo: proceduralHelpers.cmi +proceduralHelpers.cmx: proceduralHelpers.cmi +proceduralClassify.cmo: proceduralHelpers.cmi proceduralClassify.cmi +proceduralClassify.cmx: proceduralHelpers.cmx proceduralClassify.cmi +proceduralOptimizer.cmo: proceduralHelpers.cmi proceduralClassify.cmi \ + proceduralOptimizer.cmi +proceduralOptimizer.cmx: proceduralHelpers.cmx proceduralClassify.cmx \ + proceduralOptimizer.cmi +proceduralTypes.cmo: proceduralHelpers.cmi proceduralTypes.cmi +proceduralTypes.cmx: proceduralHelpers.cmx proceduralTypes.cmi +proceduralMode.cmo: proceduralClassify.cmi proceduralMode.cmi +proceduralMode.cmx: proceduralClassify.cmx proceduralMode.cmi +proceduralConversion.cmo: proceduralConversion.cmi +proceduralConversion.cmx: proceduralConversion.cmi +acic2Procedural.cmo: proceduralTypes.cmi proceduralHelpers.cmi \ + proceduralConversion.cmi proceduralClassify.cmi acic2Procedural.cmi +acic2Procedural.cmx: proceduralTypes.cmx proceduralHelpers.cmx \ + proceduralConversion.cmx proceduralClassify.cmx acic2Procedural.cmi diff --git a/components/acic_procedural/Makefile b/components/acic_procedural/Makefile new file mode 100644 index 000000000..df39ba896 --- /dev/null +++ b/components/acic_procedural/Makefile @@ -0,0 +1,17 @@ +PACKAGE = acic_procedural +PREDICATES = + +INTERFACE_FILES = \ + proceduralHelpers.mli \ + proceduralClassify.mli \ + proceduralOptimizer.mli \ + proceduralTypes.mli \ + proceduralMode.mli \ + proceduralConversion.mli \ + acic2Procedural.mli \ + $(NULL) +IMPLEMENTATION_FILES = \ + $(INTERFACE_FILES:%.mli=%.ml) + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/acic_procedural/acic2Procedural.ml b/components/acic_procedural/acic2Procedural.ml new file mode 100644 index 000000000..b4f6053c0 --- /dev/null +++ b/components/acic_procedural/acic2Procedural.ml @@ -0,0 +1,455 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module C = Cic +module I = CicInspect +module S = CicSubstitution +module TC = CicTypeChecker +module Un = CicUniv +module UM = UriManager +module Obj = LibraryObjects +module HObj = HelmLibraryObjects +module A = Cic2acic +module Ut = CicUtil +module E = CicEnvironment +module Pp = CicPp +module PEH = ProofEngineHelpers +module HEL = HExtlib +module DTI = DoubleTypeInference + +module Cl = ProceduralClassify +module T = ProceduralTypes +module Cn = ProceduralConversion +module H = ProceduralHelpers + +type status = { + sorts : (C.id, A.sort_kind) Hashtbl.t; + types : (C.id, A.anntypes) Hashtbl.t; + prefix: string; + max_depth: int option; + depth: int; + context: C.context; + intros: string option list; + clears: string list; + clears_note: string; + case: int list; + skip_thm_and_qed : bool; +} + +(* helpers ******************************************************************) + +let split2_last l1 l2 = +try + let n = pred (List.length l1) in + let before1, after1 = HEL.split_nth n l1 in + let before2, after2 = HEL.split_nth n l2 in + before1, before2, List.hd after1, List.hd after2 +with Invalid_argument _ -> failwith "A2P.split2_last" + +let string_of_head = function + | C.ASort _ -> "sort" + | C.AConst _ -> "const" + | C.AMutInd _ -> "mutind" + | C.AMutConstruct _ -> "mutconstruct" + | C.AVar _ -> "var" + | C.ARel _ -> "rel" + | C.AProd _ -> "prod" + | C.ALambda _ -> "lambda" + | C.ALetIn _ -> "letin" + | C.AFix _ -> "fix" + | C.ACoFix _ -> "cofix" + | C.AAppl _ -> "appl" + | C.ACast _ -> "cast" + | C.AMutCase _ -> "mutcase" + | C.AMeta _ -> "meta" + | C.AImplicit _ -> "implict" + +let clear st = {st with intros = []} + +let next st = {(clear st) with depth = succ st.depth} + +let add st entry intro = + {st with context = entry :: st.context; intros = intro :: st.intros} + +let push st = {st with case = 1 :: st.case} + +let inc st = + {st with case = match st.case with + | [] -> assert false + | hd :: tl -> succ hd :: tl + } + +let case st str = + let case = String.concat "." (List.rev_map string_of_int st.case) in + Printf.sprintf "case %s: %s" case str + +let test_depth st = +try + let msg = Printf.sprintf "Depth %u: " st.depth in + match st.max_depth with + | None -> true, "" + | Some d -> if st.depth < d then true, msg else false, "DEPTH EXCEDED: " +with Invalid_argument _ -> failwith "A2P.test_depth" + +let is_rewrite_right = function + | C.AConst (_, uri, []) -> + UM.eq uri HObj.Logic.eq_ind_r_URI || Obj.is_eq_ind_r_URI uri + | _ -> false + +let is_rewrite_left = function + | C.AConst (_, uri, []) -> + UM.eq uri HObj.Logic.eq_ind_URI || Obj.is_eq_ind_URI uri + | _ -> false + +let is_fwd_rewrite_right hd tl = + if is_rewrite_right hd then match List.nth tl 3 with + | C.ARel _ -> true + | _ -> false + else false + +let is_fwd_rewrite_left hd tl = + if is_rewrite_left hd then match List.nth tl 3 with + | C.ARel _ -> true + | _ -> false + else false + +let get_inner_types st v = +try + let id = Ut.id_of_annterm v in + try match Hashtbl.find st.types id with + | {A.annsynthesized = st; A.annexpected = Some et} -> Some (st, et) + | {A.annsynthesized = st; A.annexpected = None} -> Some (st, st) + with Not_found -> None +with Invalid_argument _ -> failwith "A2P.get_inner_types" +(* +let get_inner_sort st v = +try + let id = Ut.id_of_annterm v in + try Hashtbl.find st.sorts id + with Not_found -> `Type (CicUniv.fresh()) +with Invalid_argument _ -> failwith "A2P.get_sort" +*) +let get_type msg st bo = +try + let ty, _ = TC.type_of_aux' [] st.context (H.cic bo) Un.empty_ugraph in + ty +with e -> failwith (msg ^ ": " ^ Printexc.to_string e) + +let get_entry st id = + let rec aux = function + | [] -> assert false + | Some (C.Name name, e) :: _ when name = id -> e + | _ :: tl -> aux tl + in + aux st.context + +let get_ind_names uri tno = +try + let ts = match E.get_obj Un.empty_ugraph uri with + | C.InductiveDefinition (ts, _, _, _), _ -> ts + | _ -> assert false + in + match List.nth ts tno with + | (_, _, _, cs) -> List.map fst cs +with Invalid_argument _ -> failwith "A2P.get_ind_names" + +(* proof construction *******************************************************) + +let used_premise = C.Name "USED" + +let mk_exp_args hd tl classes synth = + let meta id = C.AImplicit (id, None) in + let map v (cl, b) = + if I.overlaps synth cl && b then v else meta "" + in + let rec aux = function + | [] -> [] + | hd :: tl -> if hd = meta "" then aux tl else List.rev (hd :: tl) + in + let args = T.list_rev_map2 map tl classes in + let args = aux args in + if args = [] then hd else C.AAppl ("", hd :: args) + +let mk_convert st ?name sty ety note = + let e = Cn.hole "" in + let csty, cety = H.cic sty, H.cic ety in + let _note = Printf.sprintf "%s\nSINTH: %s\nEXP: %s" + note (Pp.ppterm csty) (Pp.ppterm cety) + in + assert (Ut.is_sober csty); + assert (Ut.is_sober cety); + if Ut.alpha_equivalence csty cety then [(* T.Note note *)] else + let sty, ety = H.acic_bc st.context sty, H.acic_bc st.context ety in + match name with + | None -> [T.Change (sty, ety, None, e, ""(*note*))] + | Some (id, i) -> + begin match get_entry st id with + | C.Def _ -> assert false (* [T.ClearBody (id, note)] *) + | C.Decl _ -> [T.Change (ety, sty, Some (id, Some id), e, "" (* note *))] + end + +let convert st ?name v = + match get_inner_types st v with + | None -> [(*T.Note "NORMAL: NO INNER TYPES"*)] + | Some (sty, ety) -> mk_convert st ?name sty ety "NORMAL" + +let convert_elim st ?name t v pattern = + match t, get_inner_types st t, get_inner_types st v with + | _, None, _ + | _, _, None -> [(* T.Note "ELIM: NO INNER TYPES"*)] + | C.AAppl (_, hd :: tl), Some (tsty, _), Some (vsty, _) -> + let where = List.hd (List.rev tl) in + let cty = Cn.elim_inferred_type + st.context (H.cic vsty) (H.cic where) (H.cic hd) (H.cic pattern) + in + mk_convert st ?name (Cn.fake_annotate "" st.context cty) tsty "ELIM" + | _, Some _, Some _ -> assert false + +let get_intro = function + | C.Anonymous -> None + | C.Name s -> Some s + +let mk_intros st what script = + let intros st script = + if st.intros = [] then script else + let count = List.length st.intros in + T.Intros (Some count, List.rev st.intros, "") :: script + in + let clears st script = + if true (* st.clears = [] *) then script else T.Clear (st.clears, st.clears_note) :: script + in + intros st (clears st (convert st what @ script)) + +let mk_arg st = function + | C.ARel (_, _, i, name) as what -> convert st ~name:(name, i) what + | _ -> [] + +let mk_fwd_rewrite st dtext name tl direction t = + assert (List.length tl = 6); + let what, where, predicate = List.nth tl 5, List.nth tl 3, List.nth tl 2 in + let e = Cn.mk_pattern 1 predicate in + match where with + | C.ARel (_, _, i, premise) as v -> + let where = Some (premise, name) in +(* let _script = convert_elim st ~name:(premise, i) t v e in *) + let script = mk_arg st what @ mk_arg st v (* @ script *) in + let st = {st with context = Cn.clear st.context premise} in + st, T.Rewrite (direction, what, where, e, dtext) :: script + | _ -> assert false + +let mk_rewrite st dtext where qs tl direction t = + assert (List.length tl = 5); + let predicate = List.nth tl 2 in + let e = Cn.mk_pattern 1 predicate in + let script = [] (* convert_elim st t t e *) in + script @ [T.Rewrite (direction, where, None, e, dtext); T.Branch (qs, "")] + +let rec proc_lambda st name v t = + let dno = DTI.does_not_occur 1 (H.cic t) in + let dno = dno && match get_inner_types st t with + | None -> false + | Some (it, et) -> + DTI.does_not_occur 1 (H.cic it) && DTI.does_not_occur 1 (H.cic et) + in + let name = match dno, name with + | true, _ -> C.Anonymous + | false, C.Anonymous -> H.mk_fresh_name st.context used_premise + | false, name -> name + in + let entry = Some (name, C.Decl (H.cic v)) in + let intro = get_intro name in + proc_proof (add st entry intro) t + +and proc_letin st what name v t = + let intro = get_intro name in + let proceed, dtext = test_depth st in + let script = if proceed then + let st, hyp, rqv = match get_inner_types st v with + | Some (ity, _) -> + let st, rqv = match v with + | C.AAppl (_, hd :: tl) when is_fwd_rewrite_right hd tl -> + mk_fwd_rewrite st dtext intro tl true v + | C.AAppl (_, hd :: tl) when is_fwd_rewrite_left hd tl -> + mk_fwd_rewrite st dtext intro tl false v + | v -> + let qs = [proc_proof (next st) v; [T.Id ""]] in + let ity = H.acic_bc st.context ity in + st, [T.Branch (qs, ""); T.Cut (intro, ity, dtext)] + in + st, C.Decl (H.cic ity), rqv + | None -> + st, C.Def (H.cic v, None), [T.LetIn (intro, v, dtext)] + in + let entry = Some (name, hyp) in + let qt = proc_proof (next (add st entry intro)) t in + List.rev_append rqv qt + else + [T.Apply (what, dtext)] + in + mk_intros st what script + +and proc_rel st what = + let _, dtext = test_depth st in + let text = "assumption" in + let script = [T.Apply (what, dtext ^ text)] in + mk_intros st what script + +and proc_mutconstruct st what = + let _, dtext = test_depth st in + let script = [T.Apply (what, dtext)] in + mk_intros st what script + +and proc_appl st what hd tl = + let proceed, dtext = test_depth st in + let script = if proceed then + let ty = get_type "TC2" st hd in + let classes, rc = Cl.classify st.context ty in + let goal_arity = match get_inner_types st what with + | None -> 0 + | Some (ity, _) -> snd (PEH.split_with_whd (st.context, H.cic ity)) + in + let parsno, argsno = List.length classes, List.length tl in + let decurry = parsno - argsno in + let diff = goal_arity - decurry in + if diff < 0 then failwith (Printf.sprintf "NOT TOTAL: %i %s |--- %s" diff (Pp.ppcontext st.context) (Pp.ppterm (H.cic hd))); + let rec mk_synth a n = + if n < 0 then a else mk_synth (I.S.add n a) (pred n) + in + let synth = mk_synth I.S.empty decurry in + let text = "" (* Printf.sprintf "%u %s" parsno (Cl.to_string h) *) in + let script = List.rev (mk_arg st hd) in + match rc with + | Some (i, j, uri, tyno) -> + let classes, tl, _, where = split2_last classes tl in + let script = List.rev (mk_arg st where) @ script in + let synth = I.S.add 1 synth in + let names = get_ind_names uri tyno in + let qs = proc_bkd_proofs (next st) synth names classes tl in + if is_rewrite_right hd then + script @ mk_rewrite st dtext where qs tl false what + else if is_rewrite_left hd then + script @ mk_rewrite st dtext where qs tl true what + else + let predicate = List.nth tl (parsno - i) in + let e = Cn.mk_pattern j predicate in + let using = Some hd in + (* convert_elim st what what e @ *) script @ + [T.Elim (where, using, e, dtext ^ text); T.Branch (qs, "")] + | None -> + let qs = proc_bkd_proofs (next st) synth [] classes tl in + let hd = mk_exp_args hd tl classes synth in + script @ [T.Apply (hd, dtext ^ text); T.Branch (qs, "")] + else + [T.Apply (what, dtext)] + in + mk_intros st what script + +and proc_other st what = + let text = Printf.sprintf "%s: %s" "UNEXPANDED" (string_of_head what) in + let script = [T.Note text] in + mk_intros st what script + +and proc_proof st t = + let f st = + let xtypes, note = match get_inner_types st t with + | Some (it, et) -> Some (H.cic it, H.cic et), + (Printf.sprintf "\nInferred: %s\nExpected: %s" + (Pp.ppterm (H.cic it)) (Pp.ppterm (H.cic et))) + | None -> None, "\nNo types" + in + let context, clears = Cn.get_clears st.context (H.cic t) xtypes in + let note = Pp.ppcontext st.context ^ note in + {st with context = context; clears = clears; clears_note = note; } + in + match t with + | C.ALambda (_, name, w, t) -> proc_lambda st name w t + | C.ALetIn (_, name, v, t) as what -> proc_letin (f st) what name v t + | C.ARel _ as what -> proc_rel (f st) what + | C.AMutConstruct _ as what -> proc_mutconstruct (f st) what + | C.AAppl (_, hd :: tl) as what -> proc_appl (f st) what hd tl + | what -> proc_other (f st) what + +and proc_bkd_proofs st synth names classes ts = +try + let get_note = + let names = ref (names, push st) in + fun f -> + match !names with + | [], st -> fun _ -> f st + | "" :: tl, st -> names := tl, st; fun _ -> f st + | hd :: tl, st -> + let note = case st hd in + names := tl, inc st; + fun b -> if b then T.Note note :: f st else f st + in + let _, dtext = test_depth st in + let aux (inv, _) v = + if I.overlaps synth inv then None else + if I.S.is_empty inv then Some (get_note (fun st -> proc_proof st v)) else + Some (fun _ -> [T.Apply (v, dtext ^ "dependent")]) + in + let ps = T.list_map2_filter aux classes ts in + let b = List.length ps > 1 in + List.rev_map (fun f -> f b) ps + +with Invalid_argument s -> failwith ("A2P.proc_bkd_proofs: " ^ s) + +(* object costruction *******************************************************) + +let is_theorem pars = + List.mem (`Flavour `Theorem) pars || List.mem (`Flavour `Fact) pars || + List.mem (`Flavour `Remark) pars || List.mem (`Flavour `Lemma) pars + +let proc_obj st = function + | C.AConstant (_, _, s, Some v, t, [], pars) when is_theorem pars -> + let ast = proc_proof st v in + let steps, nodes = T.count_steps 0 ast, T.count_nodes 0 ast in + let text = Printf.sprintf "tactics: %u\nnodes: %u" steps nodes in + if st.skip_thm_and_qed then ast + else T.Theorem (Some s, t, "") :: ast @ [T.Qed text] + | _ -> + failwith "not a theorem" + +(* interface functions ******************************************************) + +let acic2procedural ~ids_to_inner_sorts ~ids_to_inner_types ?depth +?(skip_thm_and_qed=false) prefix aobj = + let st = { + sorts = ids_to_inner_sorts; + types = ids_to_inner_types; + prefix = prefix; + max_depth = depth; + depth = 0; + context = []; + intros = []; + clears = []; + clears_note = ""; + case = []; + skip_thm_and_qed = skip_thm_and_qed; + } in + HLog.debug "Procedural: level 2 transformation"; + let steps = proc_obj st aobj in + HLog.debug "Procedural: grafite rendering"; + List.rev (T.render_steps [] steps) diff --git a/components/acic_procedural/acic2Procedural.mli b/components/acic_procedural/acic2Procedural.mli new file mode 100644 index 000000000..08e49a343 --- /dev/null +++ b/components/acic_procedural/acic2Procedural.mli @@ -0,0 +1,34 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val acic2procedural: + ids_to_inner_sorts:(Cic.id, Cic2acic.sort_kind) Hashtbl.t -> + ids_to_inner_types:(Cic.id, Cic2acic.anntypes) Hashtbl.t -> + ?depth:int -> ?skip_thm_and_qed:bool -> + string -> Cic.annobj -> + (Cic.annterm, Cic.annterm, + Cic.annterm GrafiteAst.reduction, Cic.annterm CicNotationPt.obj, string) + GrafiteAst.statement list + diff --git a/components/acic_procedural/proceduralClassify.ml b/components/acic_procedural/proceduralClassify.ml new file mode 100644 index 000000000..4c0014d2e --- /dev/null +++ b/components/acic_procedural/proceduralClassify.ml @@ -0,0 +1,113 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module UM = UriManager +module C = Cic +module D = Deannotate +module I = CicInspect +module PEH = ProofEngineHelpers + +module H = ProceduralHelpers + +type dependence = I.S.t * bool + +type conclusion = (int * int * UM.uri * int) option + +(* debugging ****************************************************************) + +let string_of_entry (inverse, b) = + if I.S.mem 0 inverse then begin if b then "CF" else "C" end else + if I.S.is_empty inverse then "I" else "P" + +let to_string (classes, rc) = + let linearize = String.concat " " (List.map string_of_entry classes) in + match rc with + | None -> linearize + | Some (i, j, _, _) -> Printf.sprintf "%s %u %u" linearize i j + +let out_table b = + let map i (_, inverse) = + let map i tl = Printf.sprintf "%2u" i :: tl in + let iset = String.concat " " (I.S.fold map inverse []) in + Printf.eprintf "%2u|%s\n" i iset + in + Array.iteri map b; + prerr_newline () + +(* classification ***********************************************************) + +let classify_conclusion vs = + let rec get_argsno = function + | c, C.Appl (t :: vs) -> + let hd, argsno = get_argsno (c, t) in + hd, argsno + List.length vs + | _, t -> t, 0 + in + let inside i = i > 1 && i <= List.length vs in + match vs with + | v0 :: v1 :: _ -> + let hd0, a0 = get_argsno v0 in + let hd1, a1 = get_argsno v1 in + begin match hd0, hd1 with + | C.Rel i, C.MutInd (u, n, _) when inside i -> Some (i, a0, u, n) + | _ -> None + end + | _ -> None + +let classify c t = +try + let vs, h = PEH.split_with_normalize (c, t) in + let rc = classify_conclusion vs in + let map (b, h) (c, v) = + let _, argsno = PEH.split_with_whd (c, v) in + let isf = argsno > 0 || H.is_sort v in + let iu = H.is_unsafe h (List.hd vs) in + (I.get_rels_from_premise h v, I.S.empty, isf && iu) :: b, succ h + in + let l, h = List.fold_left map ([], 0) vs in + let b = Array.of_list (List.rev l) in + let mk_closure b h = + let map j = if j < h then I.S.union (H.fst3 b.(j)) else H.identity in + for i = pred h downto 0 do + let direct, unused, fa = b.(i) in + b.(i) <- I.S.fold map direct direct, unused, fa + done; b + in + let b = mk_closure b h in + let rec mk_inverse i direct = + if I.S.is_empty direct then () else + let j = I.S.choose direct in + if j < h then + let unused, inverse, fa = b.(j) in + b.(j) <- unused, I.S.add i inverse, fa + else (); + mk_inverse i (I.S.remove j direct) + in + let map i (direct, _, _) = mk_inverse i direct in + Array.iteri map b; +(* out_table b; *) + let extract (x, y, z) = y, z in + List.rev_map extract (List.tl (Array.to_list b)), rc +with Invalid_argument _ -> failwith "Classify.classify" diff --git a/components/acic_procedural/proceduralClassify.mli b/components/acic_procedural/proceduralClassify.mli new file mode 100644 index 000000000..aea3c6e81 --- /dev/null +++ b/components/acic_procedural/proceduralClassify.mli @@ -0,0 +1,32 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type dependence = CicInspect.S.t * bool + +type conclusion = (int * int * UriManager.uri * int) option + +val classify: Cic.context -> Cic.term -> dependence list * conclusion + +val to_string: dependence list * conclusion -> string diff --git a/components/acic_procedural/proceduralConversion.ml b/components/acic_procedural/proceduralConversion.ml new file mode 100644 index 000000000..376313ac8 --- /dev/null +++ b/components/acic_procedural/proceduralConversion.ml @@ -0,0 +1,251 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module C = Cic +module E = CicEnvironment +module Un = CicUniv +module TC = CicTypeChecker +module D = Deannotate +module UM = UriManager +module Rd = CicReduction +module PEH = ProofEngineHelpers +module PT = PrimitiveTactics + +module DTI = DoubleTypeInference + +(* helpers ******************************************************************) + +let cic = D.deannotate_term + +let rec list_sub start length = function + | _ :: tl when start > 0 -> list_sub (pred start) length tl + | hd :: tl when length > 0 -> hd :: list_sub start (pred length) tl + | _ -> [] + +(* proof construction *******************************************************) + +let lift k n = + let rec lift_xns k (uri, t) = uri, lift_term k t + and lift_ms k = function + | None -> None + | Some t -> Some (lift_term k t) + and lift_fix len k (id, name, i, ty, bo) = + id, name, i, lift_term k ty, lift_term (k + len) bo + and lift_cofix len k (id, name, ty, bo) = + id, name, lift_term k ty, lift_term (k + len) bo + and lift_term k = function + | C.ASort _ as t -> t + | C.AImplicit _ as t -> t + | C.ARel (id, rid, m, b) as t -> + if m < k then t else + if m + n > 0 then C.ARel (id, rid, m + n, b) else + assert false + | C.AConst (id, uri, xnss) -> C.AConst (id, uri, List.map (lift_xns k) xnss) + | C.AVar (id, uri, xnss) -> C.AVar (id, uri, List.map (lift_xns k) xnss) + | C.AMutInd (id, uri, tyno, xnss) -> C.AMutInd (id, uri, tyno, List.map (lift_xns k) xnss) + | C.AMutConstruct (id, uri, tyno, consno, xnss) -> C.AMutConstruct (id, uri,tyno,consno, List.map (lift_xns k) xnss) + | C.AMeta (id, i, mss) -> C.AMeta(id, i, List.map (lift_ms k) mss) + | C.AAppl (id, ts) -> C.AAppl (id, List.map (lift_term k) ts) + | C.ACast (id, te, ty) -> C.ACast (id, lift_term k te, lift_term k ty) + | C.AMutCase (id, sp, i, outty, t, pl) -> C.AMutCase (id, sp, i, lift_term k outty, lift_term k t, List.map (lift_term k) pl) + | C.AProd (id, n, s, t) -> C.AProd (id, n, lift_term k s, lift_term (succ k) t) + | C.ALambda (id, n, s, t) -> C.ALambda (id, n, lift_term k s, lift_term (succ k) t) + | C.ALetIn (id, n, s, t) -> C.ALetIn (id, n, lift_term k s, lift_term (succ k) t) + | C.AFix (id, i, fl) -> C.AFix (id, i, List.map (lift_fix (List.length fl) k) fl) + | C.ACoFix (id, i, fl) -> C.ACoFix (id, i, List.map (lift_cofix (List.length fl) k) fl) + in + lift_term k + + let fake_annotate id c = + let get_binder c m = + try match List.nth c (pred m) with + | Some (C.Name s, _) -> s + | _ -> assert false + with + | Invalid_argument _ -> assert false + in + let mk_decl n v = Some (n, C.Decl v) in + let mk_def n v = Some (n, C.Def (v, None)) in + let mk_fix (name, _, _, bo) = mk_def (C.Name name) bo in + let mk_cofix (name, _, bo) = mk_def (C.Name name) bo in + let rec ann_xns c (uri, t) = uri, ann_term c t + and ann_ms c = function + | None -> None + | Some t -> Some (ann_term c t) + and ann_fix newc c (name, i, ty, bo) = + id, name, i, ann_term c ty, ann_term (List.rev_append newc c) bo + and ann_cofix newc c (name, ty, bo) = + id, name, ann_term c ty, ann_term (List.rev_append newc c) bo + and ann_term c = function + | C.Sort sort -> C.ASort (id, sort) + | C.Implicit ann -> C.AImplicit (id, ann) + | C.Rel m -> C.ARel (id, id, m, get_binder c m) + | C.Const (uri, xnss) -> C.AConst (id, uri, List.map (ann_xns c) xnss) + | C.Var (uri, xnss) -> C.AVar (id, uri, List.map (ann_xns c) xnss) + | C.MutInd (uri, tyno, xnss) -> C.AMutInd (id, uri, tyno, List.map (ann_xns c) xnss) + | C.MutConstruct (uri, tyno, consno, xnss) -> C.AMutConstruct (id, uri,tyno,consno, List.map (ann_xns c) xnss) + | C.Meta (i, mss) -> C.AMeta(id, i, List.map (ann_ms c) mss) + | C.Appl ts -> C.AAppl (id, List.map (ann_term c) ts) + | C.Cast (te, ty) -> C.ACast (id, ann_term c te, ann_term c ty) + | C.MutCase (sp, i, outty, t, pl) -> C.AMutCase (id, sp, i, ann_term c outty, ann_term c t, List.map (ann_term c) pl) + | C.Prod (n, s, t) -> C.AProd (id, n, ann_term c s, ann_term (mk_decl n s :: c) t) + | C.Lambda (n, s, t) -> C.ALambda (id, n, ann_term c s, ann_term (mk_decl n s :: c) t) + | C.LetIn (n, s, t) -> C.ALetIn (id, n, ann_term c s, ann_term (mk_def n s :: c) t) + | C.Fix (i, fl) -> C.AFix (id, i, List.map (ann_fix (List.rev_map mk_fix fl) c) fl) + | C.CoFix (i, fl) -> C.ACoFix (id, i, List.map (ann_cofix (List.rev_map mk_cofix fl) c) fl) + in + ann_term c + +let clear_absts m = + let rec aux k n = function + | C.AImplicit (_, None) as t -> t + | C.ALambda (id, s, v, t) when k > 0 -> + C.ALambda (id, s, v, aux (pred k) n t) + | C.ALambda (_, _, _, t) when n > 0 -> + aux 0 (pred n) (lift 1 (-1) t) + | t when n > 0 -> + Printf.eprintf "CLEAR: %u %s\n" n (CicPp.ppterm (cic t)); + assert false + | t -> t + in + aux m + +let hole id = C.AImplicit (id, Some `Hole) + +let meta id = C.AImplicit (id, None) + +let anon = C.Anonymous + +let generalize n = + let is_meta = + let map b = function + | C.AImplicit (_, None) when b -> b + | _ -> false + in + List.fold_left map true + in + let rec gen_fix len k (id, name, i, ty, bo) = + id, name, i, gen_term k ty, gen_term (k + len) bo + and gen_cofix len k (id, name, ty, bo) = + id, name, gen_term k ty, gen_term (k + len) bo + and gen_term k = function + | C.ASort (id, _) + | C.AImplicit (id, _) + | C.AConst (id, _, _) + | C.AVar (id, _, _) + | C.AMutInd (id, _, _, _) + | C.AMutConstruct (id, _, _, _, _) + | C.AMeta (id, _, _) -> meta id + | C.ARel (id, _, m, _) -> + if succ (k - n) <= m && m <= k then hole id else meta id + | C.AAppl (id, ts) -> + let ts = List.map (gen_term k) ts in + if is_meta ts then meta id else C.AAppl (id, ts) + | C.ACast (id, te, ty) -> + let te, ty = gen_term k te, gen_term k ty in + if is_meta [te; ty] then meta id else C.ACast (id, te, ty) + | C.AMutCase (id, sp, i, outty, t, pl) -> + let outty, t, pl = gen_term k outty, gen_term k t, List.map (gen_term k) pl in + if is_meta (outty :: t :: pl) then meta id else hole id (* C.AMutCase (id, sp, i, outty, t, pl) *) + | C.AProd (id, _, s, t) -> + let s, t = gen_term k s, gen_term (succ k) t in + if is_meta [s; t] then meta id else C.AProd (id, anon, s, t) + | C.ALambda (id, _, s, t) -> + let s, t = gen_term k s, gen_term (succ k) t in + if is_meta [s; t] then meta id else C.ALambda (id, anon, s, t) + | C.ALetIn (id, _, s, t) -> + let s, t = gen_term k s, gen_term (succ k) t in + if is_meta [s; t] then meta id else C.ALetIn (id, anon, s, t) + | C.AFix (id, i, fl) -> C.AFix (id, i, List.map (gen_fix (List.length fl) k) fl) + | C.ACoFix (id, i, fl) -> C.ACoFix (id, i, List.map (gen_cofix (List.length fl) k) fl) + in + gen_term 0 + +let mk_pattern psno predicate = + let body = generalize psno predicate in + clear_absts 0 psno body + +let get_clears c p xtypes = + let meta = C.Implicit None in + let rec aux c names p it et = function + | [] -> + List.rev c, List.rev names + | Some (C.Name name as n, C.Decl v) as hd :: tl -> + let hd, names, v = + if DTI.does_not_occur 1 p && DTI.does_not_occur 1 it && DTI.does_not_occur 1 et then + Some (C.Anonymous, C.Decl v), name :: names, meta + else + hd, names, v + in + let p = C.Lambda (n, v, p) in + let it = C.Prod (n, v, it) in + let et = C.Prod (n, v, et) in + aux (hd :: c) names p it et tl + | Some (C.Name name as n, C.Def (v, x)) as hd :: tl -> + let hd, names, v = + if DTI.does_not_occur 1 p && DTI.does_not_occur 1 it && DTI.does_not_occur 1 et then + Some (C.Anonymous, C.Def (v, x)), name :: names, meta + else + hd, names, v + in + let p = C.LetIn (n, v, p) in + let it = C.LetIn (n, v, it) in + let et = C.LetIn (n, v, et) in + aux (hd :: c) names p it et tl + | Some (C.Anonymous as n, C.Decl v) as hd :: tl -> + let p = C.Lambda (n, meta, p) in + let it = C.Lambda (n, meta, it) in + let et = C.Lambda (n, meta, et) in + aux (hd :: c) names p it et tl + | Some (C.Anonymous as n, C.Def (v, _)) as hd :: tl -> + let p = C.LetIn (n, meta, p) in + let it = C.LetIn (n, meta, it) in + let et = C.LetIn (n, meta, et) in + aux (hd :: c) names p it et tl + | None :: tl -> assert false + in + match xtypes with + | Some (it, et) -> aux [] [] p it et c + | None -> c, [] + +let clear c hyp = + let rec aux c = function + | [] -> List.rev c + | Some (C.Name name, entry) :: tail when name = hyp -> + aux (Some (C.Anonymous, entry) :: c) tail + | entry :: tail -> aux (entry :: c) tail + in + aux [] c + +let elim_inferred_type context goal arg using cpattern = + let metasenv, ugraph = [], Un.empty_ugraph in + let ety, _ugraph = TC.type_of_aux' metasenv context using ugraph in + let _splits, args_no = PEH.split_with_whd (context, ety) in + let _metasenv, predicate, _arg, actual_args = PT.mk_predicate_for_elim + ~context ~metasenv ~ugraph ~goal ~arg ~using ~cpattern ~args_no + in + let ty = C.Appl (predicate :: actual_args) in + let upto = List.length actual_args in + Rd.head_beta_reduce ~delta:false ~upto ty diff --git a/components/acic_procedural/proceduralConversion.mli b/components/acic_procedural/proceduralConversion.mli new file mode 100644 index 000000000..ffc55d45e --- /dev/null +++ b/components/acic_procedural/proceduralConversion.mli @@ -0,0 +1,43 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val meta: Cic.id -> Cic.annterm + +val hole: Cic.id -> Cic.annterm + +val lift: int -> int -> Cic.annterm -> Cic.annterm + +val fake_annotate: Cic.id -> Cic.context -> Cic.term -> Cic.annterm + +val mk_pattern: int -> Cic.annterm -> Cic.annterm + +val get_clears: + Cic.context -> Cic.term -> (Cic.term * Cic.term) option -> + Cic.context * string list + +val clear: Cic.context -> string -> Cic.context + +val elim_inferred_type: + Cic.context -> Cic.term -> Cic.term -> Cic.term -> Cic.term -> Cic.term diff --git a/components/acic_procedural/proceduralHelpers.ml b/components/acic_procedural/proceduralHelpers.ml new file mode 100644 index 000000000..fb95a6d0c --- /dev/null +++ b/components/acic_procedural/proceduralHelpers.ml @@ -0,0 +1,264 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module C = Cic +module Rf = CicRefine +module Un = CicUniv +module Pp = CicPp +module TC = CicTypeChecker +module PEH = ProofEngineHelpers +module E = CicEnvironment +module UM = UriManager +module D = Deannotate + +(* fresh name generator *****************************************************) + +let split name = + let rec aux i = + if i <= 0 then assert false else + let c = name.[pred i] in + if c >= '0' && c <= '9' then aux (pred i) + else Str.string_before name i, Str.string_after name i + in + let before, after = aux (String.length name) in + let i = if after = "" then -1 else int_of_string after in + before, i + +let join (s, i) = + C.Name (if i < 0 then s else s ^ string_of_int i) + +let mk_fresh_name context (name, k) = + let rec aux i = function + | [] -> name, i + | Some (C.Name s, _) :: entries -> + let m, j = split s in + if m = name && j >= i then aux (succ j) entries else aux i entries + | _ :: entries -> aux i entries + in + join (aux k context) + +let mk_fresh_name context = function + | C.Anonymous -> C.Anonymous + | C.Name s -> mk_fresh_name context (split s) + +(* helper functions *********************************************************) + +let rec list_map_cps g map = function + | [] -> g [] + | hd :: tl -> + let h hd = + let g tl = g (hd :: tl) in + list_map_cps g map tl + in + map h hd + +let identity x = x + +let compose f g x = f (g x) + +let fst3 (x, _, _) = x + +let refine c t = + try let t, _, _, _ = Rf.type_of_aux' [] c t Un.empty_ugraph in t + with e -> + Printf.eprintf "REFINE EROR: %s\n" (Printexc.to_string e); + Printf.eprintf "Ref: context: %s\n" (Pp.ppcontext c); + Printf.eprintf "Ref: term : %s\n" (Pp.ppterm t); + raise e + +let get_type c t = + try let ty, _ = TC.type_of_aux' [] c t Un.empty_ugraph in ty + with e -> + Printf.eprintf "TC: context: %s\n" (Pp.ppcontext c); + Printf.eprintf "TC: term : %s\n" (Pp.ppterm t); + raise e + +let get_tail c t = + match PEH.split_with_whd (c, t) with + | (_, hd) :: _, _ -> hd + | _ -> assert false + +let is_proof c t = + match get_tail c (get_type c (get_type c t)) with + | C.Sort C.Prop -> true + | C.Sort _ -> false + | _ -> assert false + +let is_sort = function + | C.Sort _ -> true + | _ -> false + +let is_unsafe h (c, t) = true + +let is_not_atomic = function + | C.Sort _ + | C.Rel _ + | C.Const _ + | C.Var _ + | C.MutInd _ + | C.MutConstruct _ -> false + | _ -> true + +let is_atomic t = not (is_not_atomic t) + +let get_ind_type uri tyno = + match E.get_obj Un.empty_ugraph uri with + | C.InductiveDefinition (tys, _, lpsno, _), _ -> lpsno, List.nth tys tyno + | _ -> assert false + +let get_default_eliminator context uri tyno ty = + let _, (name, _, _, _) = get_ind_type uri tyno in + let ext = match get_tail context (get_type context ty) with + | C.Sort C.Prop -> "_ind" + | C.Sort C.Set -> "_rec" + | C.Sort C.CProp -> "_rec" + | C.Sort (C.Type _) -> "_rect" + | t -> + Printf.eprintf "CicPPP get_default_eliminator: %s\n" (Pp.ppterm t); + assert false + in + let buri = UM.buri_of_uri uri in + let uri = UM.uri_of_string (buri ^ "/" ^ name ^ ext ^ ".con") in + C.Const (uri, []) + +let get_ind_parameters c t = + let ty = get_type c t in + let ps = match get_tail c ty with + | C.MutInd _ -> [] + | C.Appl (C.MutInd _ :: args) -> args + | _ -> assert false + in + let disp = match get_tail c (get_type c ty) with + | C.Sort C.Prop -> 0 + | C.Sort _ -> 1 + | _ -> assert false + in + ps, disp + +let cic = D.deannotate_term + +(* Ensuring Barendregt convenction ******************************************) + +let rec add_entries map c = function + | [] -> c + | hd :: tl -> + let sname, w = map hd in + let entry = Some (Cic.Name sname, C.Decl w) in + add_entries map (entry :: c) tl + +let get_sname c i = + try match List.nth c (pred i) with + | Some (Cic.Name sname, _) -> sname + | _ -> assert false + with + | Failure _ -> assert false + | Invalid_argument _ -> assert false + +let cic_bc c t = + let get_fix_decl (sname, i, w, v) = sname, w in + let get_cofix_decl (sname, w, v) = sname, w in + let rec bc c = function + | C.LetIn (name, v, t) -> + let name = mk_fresh_name c name in + let entry = Some (name, C.Def (v, None)) in + let v, t = bc c v, bc (entry :: c) t in + C.LetIn (name, v, t) + | C.Lambda (name, w, t) -> + let name = mk_fresh_name c name in + let entry = Some (name, C.Decl w) in + let w, t = bc c w, bc (entry :: c) t in + C.Lambda (name, w, t) + | C.Prod (name, w, t) -> + let name = mk_fresh_name c name in + let entry = Some (name, C.Decl w) in + let w, t = bc c w, bc (entry :: c) t in + C.Prod (name, w, t) + | C.Appl vs -> + let vs = List.map (bc c) vs in + C.Appl vs + | C.MutCase (uri, tyno, u, v, ts) -> + let u, v, ts = bc c u, bc c v, List.map (bc c) ts in + C.MutCase (uri, tyno, u, v, ts) + | C.Cast (t, u) -> + let t, u = bc c t, bc c u in + C.Cast (t, u) + | C.Fix (i, fixes) -> + let d = add_entries get_fix_decl c fixes in + let bc_fix (sname, i, w, v) = (sname, i, bc c w, bc d v) in + let fixes = List.map bc_fix fixes in + C.Fix (i, fixes) + | C.CoFix (i, cofixes) -> + let d = add_entries get_cofix_decl c cofixes in + let bc_cofix (sname, w, v) = (sname, bc c w, bc d v) in + let cofixes = List.map bc_cofix cofixes in + C.CoFix (i, cofixes) + | t -> t + in + bc c t + +let acic_bc c t = + let get_fix_decl (id, sname, i, w, v) = sname, cic w in + let get_cofix_decl (id, sname, w, v) = sname, cic w in + let rec bc c = function + | C.ALetIn (id, name, v, t) -> + let name = mk_fresh_name c name in + let entry = Some (name, C.Def (cic v, None)) in + let v, t = bc c v, bc (entry :: c) t in + C.ALetIn (id, name, v, t) + | C.ALambda (id, name, w, t) -> + let name = mk_fresh_name c name in + let entry = Some (name, C.Decl (cic w)) in + let w, t = bc c w, bc (entry :: c) t in + C.ALambda (id, name, w, t) + | C.AProd (id, name, w, t) -> + let name = mk_fresh_name c name in + let entry = Some (name, C.Decl (cic w)) in + let w, t = bc c w, bc (entry :: c) t in + C.AProd (id, name, w, t) + | C.AAppl (id, vs) -> + let vs = List.map (bc c) vs in + C.AAppl (id, vs) + | C.AMutCase (id, uri, tyno, u, v, ts) -> + let u, v, ts = bc c u, bc c v, List.map (bc c) ts in + C.AMutCase (id, uri, tyno, u, v, ts) + | C.ACast (id, t, u) -> + let t, u = bc c t, bc c u in + C.ACast (id, t, u) + | C.AFix (id, i, fixes) -> + let d = add_entries get_fix_decl c fixes in + let bc_fix (id, sname, i, w, v) = (id, sname, i, bc c w, bc d v) in + let fixes = List.map bc_fix fixes in + C.AFix (id, i, fixes) + | C.ACoFix (id, i, cofixes) -> + let d = add_entries get_cofix_decl c cofixes in + let bc_cofix (id, sname, w, v) = (id, sname, bc c w, bc d v) in + let cofixes = List.map bc_cofix cofixes in + C.ACoFix (id, i, cofixes) + | C.ARel (id1, id2, i, sname) -> + let sname = get_sname c i in + C.ARel (id1, id2, i, sname) + | t -> t + in + bc c t diff --git a/components/acic_procedural/proceduralHelpers.mli b/components/acic_procedural/proceduralHelpers.mli new file mode 100644 index 000000000..c374a1866 --- /dev/null +++ b/components/acic_procedural/proceduralHelpers.mli @@ -0,0 +1,61 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val mk_fresh_name: + Cic.context -> Cic.name -> Cic.name +val list_map_cps: + ('a list -> 'b) -> (('a -> 'b) -> 'c -> 'b) -> 'c list -> 'b +val identity: + 'a -> 'a +val compose: + ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b +val fst3: + 'a * 'b * 'c -> 'a +val refine: + Cic.context -> Cic.term -> Cic.term +val get_type: + Cic.context -> Cic.term -> Cic.term +val is_proof: + Cic.context -> Cic.term -> bool +val is_sort: + Cic.term -> bool +val is_unsafe: + int -> Cic.context * Cic.term -> bool +val is_not_atomic: + Cic.term -> bool +val is_atomic: + Cic.term -> bool +val get_ind_type: + UriManager.uri -> int -> int * Cic.inductiveType +val get_default_eliminator: + Cic.context -> UriManager.uri -> int -> Cic.term -> Cic.term +val get_ind_parameters: + Cic.context -> Cic.term -> Cic.term list * int +val cic: + Cic.annterm -> Cic.term +val cic_bc: + Cic.context -> Cic.term -> Cic.term +val acic_bc: + Cic.context -> Cic.annterm -> Cic.annterm diff --git a/components/acic_procedural/proceduralMode.ml b/components/acic_procedural/proceduralMode.ml new file mode 100644 index 000000000..e13846fc8 --- /dev/null +++ b/components/acic_procedural/proceduralMode.ml @@ -0,0 +1,57 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module C = Cic +module PEH = ProofEngineHelpers + +module Cl = ProceduralClassify + +let is_eliminator = function + | _ :: (_, C.MutInd _) :: _ -> true + | _ :: (_, C.Appl (C.MutInd _ :: _)) :: _ -> true + | _ -> false + +let is_const = function + | C.Sort _ + | C.Const _ + | C.Var _ + | C.MutInd _ + | C.MutConstruct _ -> true + | _ -> false + +let rec is_appl b = function + | C.Appl (hd :: tl) -> List.fold_left is_appl (is_const hd) tl + | t when is_const t -> b + | C.Rel _ -> b + | _ -> false + +let bkd c t = + let classes, rc = Cl.classify c t in + let premises, _ = PEH.split_with_whd (c, t) in + match rc with + | Some (i, j, _, _) when i > 1 && i <= List.length classes && is_eliminator premises -> true + | _ -> + let _, conclusion = List.hd premises in + is_appl true conclusion diff --git a/components/acic_procedural/proceduralMode.mli b/components/acic_procedural/proceduralMode.mli new file mode 100644 index 000000000..71356b6ff --- /dev/null +++ b/components/acic_procedural/proceduralMode.mli @@ -0,0 +1,29 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) +(* +val is_eliminator: (Cic.context * Cic.term) list -> bool + +val bkd: Cic.context -> Cic.term -> bool +*) diff --git a/components/acic_procedural/proceduralOptimizer.ml b/components/acic_procedural/proceduralOptimizer.ml new file mode 100644 index 000000000..1953ae7f1 --- /dev/null +++ b/components/acic_procedural/proceduralOptimizer.ml @@ -0,0 +1,277 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module C = Cic +module Pp = CicPp +module I = CicInspect +module S = CicSubstitution +module DTI = DoubleTypeInference +module HEL = HExtlib +module PEH = ProofEngineHelpers + +module H = ProceduralHelpers +module Cl = ProceduralClassify + +(* term preprocessing: optomization 1 ***************************************) + +let defined_premise = "DEFINED" + +let define v = + let name = C.Name defined_premise in + C.LetIn (name, v, C.Rel 1) + +let clear_absts m = + let rec aux k n = function + | C.Lambda (s, v, t) when k > 0 -> + C.Lambda (s, v, aux (pred k) n t) + | C.Lambda (_, _, t) when n > 0 -> + aux 0 (pred n) (S.lift (-1) t) + | t when n > 0 -> + Printf.eprintf "CicPPP clear_absts: %u %s\n" n (Pp.ppterm t); + assert false + | t -> t + in + aux m + +let rec add_abst k = function + | C.Lambda (s, v, t) when k > 0 -> C.Lambda (s, v, add_abst (pred k) t) + | t when k > 0 -> assert false + | t -> C.Lambda (C.Anonymous, C.Implicit None, S.lift 1 t) + +let rec opt1_letin g es c name v t = + let name = H.mk_fresh_name c name in + let entry = Some (name, C.Def (v, None)) in + let g t = + if DTI.does_not_occur 1 t then begin + let x = S.lift (-1) t in + HLog.warn "Optimizer: remove 1"; opt1_proof g true c x + end else + let g = function + | C.LetIn (nname, vv, tt) when H.is_proof c v -> + let x = C.LetIn (nname, vv, C.LetIn (name, tt, S.lift_from 2 1 t)) in + HLog.warn "Optimizer: swap 1"; opt1_proof g true c x + | v when H.is_proof c v && H.is_atomic v -> + let x = S.subst v t in + HLog.warn "Optimizer: remove 5"; opt1_proof g true c x + | v -> + g (C.LetIn (name, v, t)) + in + if es then opt1_term g es c v else g v + in + if es then opt1_proof g es (entry :: c) t else g t + +and opt1_lambda g es c name w t = + let name = H.mk_fresh_name c name in + let entry = Some (name, C.Decl w) in + let g t = g (C.Lambda (name, w, t)) in + if es then opt1_proof g es (entry :: c) t else g t + +and opt1_appl g es c t vs = + let g vs = + let g = function + | C.LetIn (mame, vv, tt) -> + let vs = List.map (S.lift 1) vs in + let x = C.LetIn (mame, vv, C.Appl (tt :: vs)) in + HLog.warn "Optimizer: swap 2"; opt1_proof g true c x + | C.Lambda (name, ww, tt) -> + let v, vs = List.hd vs, List.tl vs in + let x = C.Appl (C.LetIn (name, v, tt) :: vs) in + HLog.warn "Optimizer: remove 2"; opt1_proof g true c x + | C.Appl vvs -> + let x = C.Appl (vvs @ vs) in + HLog.warn "Optimizer: nested application"; opt1_proof g true c x + | t -> + let rec aux d rvs = function + | [], _ -> + let x = C.Appl (t :: List.rev rvs) in + if d then opt1_proof g true c x else g x + | v :: vs, (cc, bb) :: cs -> + if H.is_not_atomic v && I.S.mem 0 cc && bb then begin + HLog.warn "Optimizer: anticipate 1"; + aux true (define v :: rvs) (vs, cs) + end else + aux d (v :: rvs) (vs, cs) + | _, [] -> assert false + in + let h () = + let classes, conclusion = Cl.classify c (H.get_type c t) in + let csno, vsno = List.length classes, List.length vs in + if csno < vsno then + let vvs, vs = HEL.split_nth csno vs in + let x = C.Appl (define (C.Appl (t :: vvs)) :: vs) in + HLog.warn "Optimizer: anticipate 2"; opt1_proof g true c x + else match conclusion, List.rev vs with + | Some _, rv :: rvs when csno = vsno && H.is_not_atomic rv -> + let x = C.Appl (t :: List.rev rvs @ [define rv]) in + HLog.warn "Optimizer: anticipate 3"; opt1_proof g true c x + | _ (* Some _, _ *) -> + g (C.Appl (t :: vs)) +(* | None, _ -> + aux false [] (vs, classes) +*) in + let rec aux h prev = function + | C.LetIn (name, vv, tt) :: vs -> + let t = S.lift 1 t in + let prev = List.map (S.lift 1) prev in + let vs = List.map (S.lift 1) vs in + let y = C.Appl (t :: List.rev prev @ tt :: vs) in + let x = C.LetIn (name, vv, y) in + HLog.warn "Optimizer: swap 3"; opt1_proof g true c x + | v :: vs -> aux h (v :: prev) vs + | [] -> h () + in + aux h [] vs + in + if es then opt1_proof g es c t else g t + in + if es then H.list_map_cps g (fun h -> opt1_term h es c) vs else g vs + +and opt1_mutcase g es c uri tyno outty arg cases = + let eliminator = H.get_default_eliminator c uri tyno outty in + let lpsno, (_, _, _, constructors) = H.get_ind_type uri tyno in + let ps, sort_disp = H.get_ind_parameters c arg in + let lps, rps = HEL.split_nth lpsno ps in + let rpsno = List.length rps in + let predicate = clear_absts rpsno (1 - sort_disp) outty in + let is_recursive t = + I.S.mem tyno (I.get_mutinds_of_uri uri t) + in + let map2 case (_, cty) = + let map (h, case, k) (_, premise) = + if h > 0 then pred h, case, k else + if is_recursive premise then + 0, add_abst k case, k + 2 + else + 0, case, succ k + in + let premises, _ = PEH.split_with_whd (c, cty) in + let _, lifted_case, _ = + List.fold_left map (lpsno, case, 1) (List.rev (List.tl premises)) + in + lifted_case + in + let lifted_cases = List.map2 map2 cases constructors in + let args = eliminator :: lps @ predicate :: lifted_cases @ rps @ [arg] in + let x = H.refine c (C.Appl args) in + HLog.warn "Optimizer: remove 3"; opt1_proof g es c x + +and opt1_cast g es c t w = + let g t = HLog.warn "Optimizer: remove 4"; g t in + if es then opt1_proof g es c t else g t + +and opt1_other g es c t = g t + +and opt1_proof g es c = function + | C.LetIn (name, v, t) -> opt1_letin g es c name v t + | C.Lambda (name, w, t) -> opt1_lambda g es c name w t + | C.Appl (t :: v :: vs) -> opt1_appl g es c t (v :: vs) + | C.Appl [t] -> opt1_proof g es c t + | C.MutCase (u, n, t, v, ws) -> opt1_mutcase g es c u n t v ws + | C.Cast (t, w) -> opt1_cast g es c t w + | t -> opt1_other g es c t + +and opt1_term g es c t = + if H.is_proof c t then opt1_proof g es c t else g t + +(* term preprocessing: optomization 2 ***************************************) + +let expanded_premise = "EXPANDED" + +let eta_expand g tys t = + assert (tys <> []); + let name i = Printf.sprintf "%s%u" expanded_premise i in + let lambda i ty t = C.Lambda (C.Name (name i), ty, t) in + let arg i = C.Rel (succ i) in + let rec aux i f a = function + | [] -> f, a + | (_, ty) :: tl -> aux (succ i) (H.compose f (lambda i ty)) (arg i :: a) tl + in + let n = List.length tys in + let absts, args = aux 0 H.identity [] tys in + let t = match S.lift n t with + | C.Appl ts -> C.Appl (ts @ args) + | t -> C.Appl (t :: args) + in + g (absts t) + +let rec opt2_letin g c name v t = + let entry = Some (name, C.Def (v, None)) in + let g t = + let g v = g (C.LetIn (name, v, t)) in + opt2_term g c v + in + opt2_proof g (entry :: c) t + +and opt2_lambda g c name w t = + let entry = Some (name, C.Decl w) in + let g t = g (C.Lambda (name, w, t)) in + opt2_proof g (entry :: c) t + +and opt2_appl g c t vs = + let g vs = + let x = C.Appl (t :: vs) in + let vsno = List.length vs in + let _, csno = PEH.split_with_whd (c, H.get_type c t) in + if vsno < csno then + let tys, _ = PEH.split_with_whd (c, H.get_type c x) in + let tys = List.rev (List.tl tys) in + let tys, _ = HEL.split_nth (csno - vsno) tys in + HLog.warn "Optimizer: eta 1"; eta_expand g tys x + else g x + in + H.list_map_cps g (fun h -> opt2_term h c) vs + +and opt2_other g c t = + let tys, csno = PEH.split_with_whd (c, H.get_type c t) in + if csno > 0 then begin + let tys = List.rev (List.tl tys) in + HLog.warn "Optimizer: eta 2"; eta_expand g tys t + end else g t + +and opt2_proof g c = function + | C.LetIn (name, v, t) -> opt2_letin g c name v t + | C.Lambda (name, w, t) -> opt2_lambda g c name w t + | C.Appl (t :: vs) -> opt2_appl g c t vs + | t -> opt2_other g c t + +and opt2_term g c t = + if H.is_proof c t then opt2_proof g c t else g t + +(* object preprocessing *****************************************************) + +let optimize_obj = function + | C.Constant (name, Some bo, ty, pars, attrs) -> + let bo, ty = H.cic_bc [] bo, H.cic_bc [] ty in + let g bo = + Printf.eprintf "Optimized : %s\nPost Nodes: %u\n" + (Pp.ppterm bo) (I.count_nodes 0 bo); + let _ = H.get_type [] (C.Cast (bo, ty)) in + C.Constant (name, Some bo, ty, pars, attrs) + in + Printf.eprintf "BEGIN: %s\nPre Nodes : %u\n" + name (I.count_nodes 0 bo); + begin try opt1_term g (* (opt2_term g []) *) true [] bo + with e -> failwith ("PPP: " ^ Printexc.to_string e) end + | obj -> obj diff --git a/components/acic_procedural/proceduralOptimizer.mli b/components/acic_procedural/proceduralOptimizer.mli new file mode 100644 index 000000000..45505d72c --- /dev/null +++ b/components/acic_procedural/proceduralOptimizer.mli @@ -0,0 +1,26 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val optimize_obj: Cic.obj -> Cic.obj diff --git a/components/acic_procedural/proceduralTypes.ml b/components/acic_procedural/proceduralTypes.ml new file mode 100644 index 000000000..8a60f9658 --- /dev/null +++ b/components/acic_procedural/proceduralTypes.ml @@ -0,0 +1,244 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module HEL = HExtlib +module C = Cic +module I = CicInspect +module G = GrafiteAst +module N = CicNotationPt + +module H = ProceduralHelpers + +(* functions to be moved ****************************************************) + +let list_rev_map2 map l1 l2 = + let rec aux res = function + | hd1 :: tl1, hd2 :: tl2 -> aux (map hd1 hd2 :: res) (tl1, tl2) + | _ -> res + in + aux [] (l1, l2) + +let list_map2_filter map l1 l2 = + let rec filter l = function + | [] -> l + | None :: tl -> filter l tl + | Some a :: tl -> filter (a :: l) tl + in + filter [] (list_rev_map2 map l1 l2) + +let list_init f i = + let rec aux a j = if j < 0 then a else aux (f j :: a) (pred j) in + aux [] i + +(****************************************************************************) + +type name = string option +type hyp = string +type what = Cic.annterm +type how = bool +type using = Cic.annterm +type count = int +type note = string +type where = (hyp * name) option +type inferred = Cic.annterm +type pattern = Cic.annterm + +type step = Note of note + | Theorem of name * what * note + | Qed of note + | Id of note + | Intros of count option * name list * note + | Cut of name * what * note + | LetIn of name * what * note + | Rewrite of how * what * where * pattern * note + | Elim of what * using option * pattern * note + | Apply of what * note + | Change of inferred * what * where * pattern * note + | Clear of hyp list * note + | ClearBody of hyp * note + | Branch of step list list * note + +(* annterm constructors *****************************************************) + +let mk_arel i b = Cic.ARel ("", "", i, b) + +(* grafite ast constructors *************************************************) + +let floc = HEL.dummy_floc + +let mk_note str = G.Comment (floc, G.Note (floc, str)) + +let mk_tacnote str a = + if str = "" then mk_note "" :: a else mk_note "" :: mk_note str :: a + +let mk_notenote str a = + if str = "" then a else mk_note str :: a + +let mk_thnote str a = + if str = "" then a else mk_note "" :: mk_note str :: a + +let mk_theorem name t = + let name = match name with Some name -> name | None -> assert false in + let obj = N.Theorem (`Theorem, name, t, None) in + G.Executable (floc, G.Command (floc, G.Obj (floc, obj))) + +let mk_qed = + G.Executable (floc, G.Command (floc, G.Qed floc)) + +let mk_tactic tactic punctation = + G.Executable (floc, G.Tactic (floc, Some tactic, punctation)) + +let mk_punctation punctation = + G.Executable (floc, G.Tactic (floc, None, punctation)) + +let mk_id punctation = + let tactic = G.IdTac floc in + mk_tactic tactic punctation + +let mk_intros xi xids punctation = + let tactic = G.Intros (floc, (xi, xids)) in + mk_tactic tactic punctation + +let mk_cut name what punctation = + let name = match name with Some name -> name | None -> assert false in + let tactic = G.Cut (floc, Some name, what) in + mk_tactic tactic punctation + +let mk_letin name what punctation = + let name = match name with Some name -> name | None -> assert false in + let tactic = G.LetIn (floc, what, name) in + mk_tactic tactic punctation + +let mk_rewrite direction what where pattern punctation = + let direction = if direction then `RightToLeft else `LeftToRight in + let pattern, rename = match where with + | None -> (None, [], Some pattern), [] + | Some (premise, name) -> (None, [premise, pattern], None), [name] + in + let tactic = G.Rewrite (floc, direction, what, pattern, rename) in + mk_tactic tactic punctation + +let mk_elim what using pattern punctation = + let pattern = None, [], Some pattern in + let tactic = G.Elim (floc, what, using, pattern, (Some 0, [])) in + mk_tactic tactic punctation + +let mk_apply t punctation = + let tactic = G.Apply (floc, t) in + mk_tactic tactic punctation + +let mk_change t where pattern punctation = + let pattern = match where with + | None -> None, [], Some pattern + | Some (premise, _) -> None, [premise, pattern], None + in + let tactic = G.Change (floc, pattern, t) in + mk_tactic tactic punctation + +let mk_clear ids punctation = + let tactic = G.Clear (floc, ids) in + mk_tactic tactic punctation + +let mk_clearbody id punctation = + let tactic = G.ClearBody (floc, id) in + mk_tactic tactic punctation + +let mk_ob = + let punctation = G.Branch floc in + mk_punctation punctation + +let mk_dot = G.Dot floc + +let mk_sc = G.Semicolon floc + +let mk_cb = G.Merge floc + +let mk_vb = G.Shift floc + +(* rendering ****************************************************************) + +let rec render_step sep a = function + | Note s -> mk_notenote s a + | Theorem (n, t, s) -> mk_theorem n t :: mk_thnote s a + | Qed s -> mk_qed :: mk_tacnote s a + | Id s -> mk_id sep :: mk_tacnote s a + | Intros (c, ns, s) -> mk_intros c ns sep :: mk_tacnote s a + | Cut (n, t, s) -> mk_cut n t sep :: mk_tacnote s a + | LetIn (n, t, s) -> mk_letin n t sep :: mk_tacnote s a + | Rewrite (b, t, w, e, s) -> mk_rewrite b t w e sep :: mk_tacnote s a + | Elim (t, xu, e, s) -> mk_elim t xu e sep :: mk_tacnote s a + | Apply (t, s) -> mk_apply t sep :: mk_tacnote s a + | Change (t, _, w, e, s) -> mk_change t w e sep :: mk_tacnote s a + | Clear (ns, s) -> mk_clear ns sep :: mk_tacnote s a + | ClearBody (n, s) -> mk_clearbody n sep :: mk_tacnote s a + | Branch ([], s) -> a + | Branch ([ps], s) -> render_steps sep a ps + | Branch (ps :: pss, s) -> + let a = mk_ob :: mk_tacnote s a in + let a = List.fold_left (render_steps mk_vb) a (List.rev pss) in + mk_punctation sep :: render_steps mk_cb a ps + +and render_steps sep a = function + | [] -> a + | [p] -> render_step sep a p + | p :: Branch ([], _) :: ps -> + render_steps sep a (p :: ps) + | p :: ((Branch (_ :: _ :: _, _) :: _) as ps) -> + render_steps sep (render_step mk_sc a p) ps + | p :: ps -> + render_steps sep (render_step mk_sc a p) ps + +let render_steps a = render_steps mk_dot a + +(* counting *****************************************************************) + +let rec count_step a = function + | Note _ + | Theorem _ + | Qed _ -> a + | Branch (pps, _) -> List.fold_left count_steps a pps + | _ -> succ a + +and count_steps a = List.fold_left count_step a + +let rec count_node a = function + | Note _ + | Theorem _ + | Qed _ + | Id _ + | Intros _ + | Clear _ + | ClearBody _ -> a + | Cut (_, t, _) + | LetIn (_, t, _) + | Apply (t, _) -> I.count_nodes a (H.cic t) + | Rewrite (_, t, _, p, _) + | Elim (t, _, p, _) + | Change (t, _, _, p, _) -> + let a = I.count_nodes a (H.cic t) in + I.count_nodes a (H.cic p) + | Branch (ss, _) -> List.fold_left count_nodes a ss + +and count_nodes a = List.fold_left count_node a diff --git a/components/acic_procedural/proceduralTypes.mli b/components/acic_procedural/proceduralTypes.mli new file mode 100644 index 000000000..c493873ff --- /dev/null +++ b/components/acic_procedural/proceduralTypes.mli @@ -0,0 +1,71 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* functions to be moved ****************************************************) + +val list_rev_map2: ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list + +val list_map2_filter: ('a -> 'b -> 'c option) -> 'a list -> 'b list -> 'c list + +val mk_arel: int -> string -> Cic.annterm + +(****************************************************************************) + +type name = string option +type hyp = string +type what = Cic.annterm +type how = bool +type using = Cic.annterm +type count = int +type note = string +type where = (hyp * name) option +type inferred = Cic.annterm +type pattern = Cic.annterm + +type step = Note of note + | Theorem of name * what * note + | Qed of note + | Id of note + | Intros of count option * name list * note + | Cut of name * what * note + | LetIn of name * what * note + | Rewrite of how * what * where * pattern * note + | Elim of what * using option * pattern * note + | Apply of what * note + | Change of inferred * what * where * pattern * note + | Clear of hyp list * note + | ClearBody of hyp * note + | Branch of step list list * note + +val render_steps: + (what, inferred, [> `Whd] as 'b, what CicNotationPt.obj, hyp) GrafiteAst.statement list -> + step list -> + (what, inferred, 'b, what CicNotationPt.obj, hyp) GrafiteAst.statement list + +val count_steps: + int -> step list -> int + +val count_nodes: + int -> step list -> int diff --git a/components/binaries/Makefile b/components/binaries/Makefile new file mode 100644 index 000000000..cd732517c --- /dev/null +++ b/components/binaries/Makefile @@ -0,0 +1,18 @@ +H=@ + +#CSC: saturate is broken after the huge refactoring of auto/paramodulation +#CSC: by Andrea +#BINARIES=extractor table_creator utilities saturate +BINARIES=extractor table_creator utilities transcript heights + +all: $(BINARIES:%=rec@all@%) +opt: $(BINARIES:%=rec@opt@%) +depend: $(BINARIES:%=rec@depend@%) +depend.opt: $(BINARIES:%=rec@depend.opt@%) +install: $(BINARIES:%=rec@install@%) +uninstall: $(BINARIES:%=rec@uninstall@%) +clean: $(BINARIES:%=rec@clean@%) + +rec@%: + $(H)$(MAKE) -C $(word 2, $(subst @, ,$*)) $(word 1, $(subst @, ,$*)) + diff --git a/components/binaries/dump_db/dump.sh b/components/binaries/dump_db/dump.sh new file mode 100755 index 000000000..e7b43666e --- /dev/null +++ b/components/binaries/dump_db/dump.sh @@ -0,0 +1,20 @@ +ALL_TABLES=`../table_creator/table_creator list all` + +if [ -z "$1" ]; then + echo "Dumps to stdout some tables of a given db on mowgli." + echo "If no tables are given the dump will contain:" + echo " $ALL_TABLES" + echo "" + echo "usage: dump.sh dbname [tables...]" + echo "" + exit 1 +fi +DB=$1 +shift +if [ -z "$1" ]; then + TABLES=$ALL_TABLES +else + TABLES=$@ +fi + +mysqldump -e --add-drop-table -u helm -h mowgli.cs.unibo.it $DB $TABLES diff --git a/components/binaries/extractor/.depend b/components/binaries/extractor/.depend new file mode 100644 index 000000000..e69de29bb diff --git a/components/binaries/extractor/.depend.opt b/components/binaries/extractor/.depend.opt new file mode 100644 index 000000000..e69de29bb diff --git a/components/binaries/extractor/Makefile b/components/binaries/extractor/Makefile new file mode 100644 index 000000000..512b13e73 --- /dev/null +++ b/components/binaries/extractor/Makefile @@ -0,0 +1,55 @@ +H=@ + +all: extractor extractor_manager + $(H)echo -n +opt: extractor.opt extractor_manager.opt + $(H)echo -n + +clean: + rm -f *.cm[ixo] *.[ao] extractor extractor.opt *.err *.out extractor_manager extractor_manager.opt + +extractor: extractor.ml + $(H)echo " OCAMLC $<" + $(H)$(OCAMLFIND) ocamlc \ + -thread -package mysql,helm-metadata,helm-library -linkpkg -rectypes -o $@ $< + +extractor.opt: extractor.ml + $(H)echo " OCAMLOPT $<" + $(H)$(OCAMLFIND) ocamlopt \ + -thread -package mysql,helm-metadata,helm-library -linkpkg -rectypes -o $@ $< + +extractor_manager: extractor_manager.ml + $(H)echo " OCAMLC $<" + $(H)$(OCAMLFIND) ocamlc \ + -thread -package mysql,helm-metadata,helm-library -linkpkg -rectypes -o $@ $< + +extractor_manager.opt: extractor_manager.ml + $(H)echo " OCAMLOPT $<" + $(H)$(OCAMLFIND) ocamlopt \ + -thread -package mysql,helm-metadata,helm-library -linkpkg -rectypes -o $@ $< + +export: extractor.opt extractor_manager.opt + nice -n 20 \ + time \ + ./extractor_manager.opt 1>export.out 2>export.err + +depend: + $(H)echo " OCAMLDEP" + $(H)ocamldep extractor.ml extractor_manager.ml > .depend +depend.opt: + $(H)echo " OCAMLDEP -native" + $(H)ocamldep -native extractor.ml extractor_manager.ml > .depend.opt + +ifeq ($(MAKECMDGOALS),) + include .depend +endif + +ifeq ($(MAKECMDGOALS), all) + include .depend +endif + +ifeq ($(MAKECMDGOALS), opt) + include .depend.opt +endif + +include ../../../Makefile.defs diff --git a/components/binaries/extractor/extractor.conf.xml b/components/binaries/extractor/extractor.conf.xml new file mode 100644 index 000000000..d82b16028 --- /dev/null +++ b/components/binaries/extractor/extractor.conf.xml @@ -0,0 +1,18 @@ + + +
+ .tmp/ +
+
+ mysql://mowgli.cs.unibo.it mowgli helm helm library + file:///tmp/ user.db helm helm user +
+
+ + file:///projects/helm/library/coq_contribs + + $(tmp.dir)/cache + $(tmp.dir)/maps + /projects/helm/xml/dtd +
+
diff --git a/components/binaries/extractor/extractor.ml b/components/binaries/extractor/extractor.ml new file mode 100644 index 000000000..981900c3c --- /dev/null +++ b/components/binaries/extractor/extractor.ml @@ -0,0 +1,75 @@ +let _ = Helm_registry.load_from "extractor.conf.xml" + +let usage () = + prerr_endline " + +!! This binary should not be called by hand, use the extractor_manager. !! + +usage: ./extractor[.opt] path owner + +path: the path for the getter maps +owner: the owner of the tables to update + +" + +let _ = + try + let _ = Sys.argv.(2), Sys.argv.(1) in + if Sys.argv.(1) = "-h"||Sys.argv.(1) = "-help"||Sys.argv.(1) = "--help" then + begin + usage (); + exit 1 + end + with + Invalid_argument _ -> usage (); exit 1 + +let owner = Sys.argv.(2) +let path = Sys.argv.(1) + +let main () = + print_endline (Printf.sprintf "%d alive on path:%s owner:%s" + (Unix.getpid()) path owner); + Helm_registry.load_from "extractor.conf.xml"; + Helm_registry.set "tmp.dir" path; + Http_getter.init (); + let dbspec = LibraryDb.parse_dbd_conf () in + let dbd = HSql.quick_connect dbspec in + MetadataTypes.ownerize_tables owner; + let uris = + let ic = open_in (path ^ "/todo") in + let acc = ref [] in + (try + while true do + let l = input_line ic in + acc := l :: !acc + done + with + End_of_file -> ()); + close_in ic; + !acc + in + let len = float_of_int (List.length uris) in + let i = ref 0 in + let magic = 45 in + List.iter (fun u -> + incr i; + let perc = ((float_of_int !i) /. len *. 100.0) in + let l = String.length u in + let short = + if l < magic then + u ^ String.make (magic + 3 - l) ' ' + else + "..." ^ String.sub u (l - magic) magic + in + Printf.printf "%d (%d of %.0f = %3.1f%%): %s\n" + (Unix.getpid ()) !i len perc short; + flush stdout; + let uri = UriManager.uri_of_string u in + MetadataDb.index_obj ~dbd ~uri; + CicEnvironment.empty ()) + uris; + print_string "END "; Unix.system "date" +;; + +main () + diff --git a/components/binaries/extractor/extractor_manager.ml b/components/binaries/extractor/extractor_manager.ml new file mode 100644 index 000000000..13e92777f --- /dev/null +++ b/components/binaries/extractor/extractor_manager.ml @@ -0,0 +1,295 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* HELPERS *) + +let create_all dbd = + let obj_tbl = MetadataTypes.obj_tbl () in + let sort_tbl = MetadataTypes.sort_tbl () in + let rel_tbl = MetadataTypes.rel_tbl () in + let name_tbl = MetadataTypes.name_tbl () in + let count_tbl = MetadataTypes.count_tbl () in + let tbls = [ + (obj_tbl,`RefObj) ; (sort_tbl,`RefSort) ; (rel_tbl,`RefRel) ; + (name_tbl,`ObjectName) ; (count_tbl,`Count) ] + in + let statements = + (SqlStatements.create_tables tbls) @ + (SqlStatements.create_indexes tbls) + in + List.iter (fun statement -> + try + ignore (HSql.exec HSql.Library dbd statement) + with + HSql.Error _ as exn -> + match HSql.errno HSql.Library dbd with + | HSql.Table_exists_error -> () + | HSql.OK -> () + | _ -> raise exn + ) statements + +let drop_all dbd = + let obj_tbl = MetadataTypes.obj_tbl () in + let sort_tbl = MetadataTypes.sort_tbl () in + let rel_tbl = MetadataTypes.rel_tbl () in + let name_tbl = MetadataTypes.name_tbl () in + let count_tbl = MetadataTypes.count_tbl () in + let tbls = [ + (obj_tbl,`RefObj) ; (sort_tbl,`RefSort) ; (rel_tbl,`RefRel) ; + (name_tbl,`ObjectName) ; (count_tbl,`Count) ] + in + let statements = + (SqlStatements.drop_tables tbls) @ + (SqlStatements.drop_indexes tbls HSql.Library dbd) + in + List.iter (fun statement -> + try + ignore (HSql.exec HSql.Library dbd statement) + with HSql.Error _ as exn -> + match HSql.errno HSql.Library dbd with + | HSql.Bad_table_error + | HSql.No_such_index | HSql.No_such_table -> () + | _ -> raise exn + ) statements + +let slash_RE = Str.regexp "/" + +let partition l = + let l = List.fast_sort Pervasives.compare l in + let matches s1 s2 = + let l1,l2 = Str.split slash_RE s1, Str.split slash_RE s2 in + match l1,l2 with + | _::x::_,_::y::_ -> x = y + | _ -> false + in + let rec chunk l = + match l with + | [] -> [],[] + | h::(h1::tl as rest) when matches h h1 -> + let ch,todo = chunk rest in + (h::ch),todo + | h::(h1::tl as rest)-> [h],rest + | h::_ -> [h],[] + in + let rec split l = + let ch, todo = chunk l in + match todo with + | [] -> [ch] + | _ -> ch :: split todo + in + split l + + +(* ARGV PARSING *) + +let _ = + try + if Sys.argv.(1) = "-h"||Sys.argv.(1) = "-help"||Sys.argv.(1) = "--help" then + begin + prerr_endline " +usage: ./extractor_manager[.opt] [processes] [owner] + +defaults: + processes = 2 + owner = NEW + +"; + exit 1 + end + with Invalid_argument _ -> () + +let processes = + try + int_of_string (Sys.argv.(1)) + with + Invalid_argument _ -> 2 + +let owner = + try + Sys.argv.(2) + with Invalid_argument _ -> "NEW" + +let create_peons i = + let rec aux = function + | 0 -> [] + | n -> (n,0) :: aux (n-1) + in + ref (aux i) + +let is_a_peon_idle peons = + List.exists (fun (_,x) -> x = 0) !peons + +let get_ide_peon peons = + let p = fst(List.find (fun (_,x) -> x = 0) !peons) in + peons := List.filter (fun (x,_) -> x <> p) !peons; + p + +let assign_peon peon pid peons = + peons := (peon,pid) :: !peons + +let wait_a_peon peons = + let pid,status = Unix.wait () in + (match status with + | Unix.WEXITED 0 -> () + | Unix.WEXITED s -> + prerr_endline (Printf.sprintf "PEON %d EXIT STATUS %d" pid s) + | Unix.WSIGNALED s -> + prerr_endline + (Printf.sprintf "PEON %d HAD A PROBLEM, KILLED BY SIGNAL %d" pid s) + | Unix.WSTOPPED s -> + prerr_endline + (Printf.sprintf "PEON %d HAD A PROBLEM, STOPPED BY %d" pid s)); + let p = fst(List.find (fun (_,x) -> x = pid) !peons) in + peons := List.filter (fun (x,_) -> x <> p) !peons; + peons := (p,0) :: !peons + +let is_a_peon_busy peons = + List.exists (fun (_,x) -> x <> 0) !peons + +(* MAIN *) +let main () = + Helm_registry.load_from "extractor.conf.xml"; + Http_getter.init (); + print_endline "Updating the getter...."; + let base = (Helm_registry.get "tmp.dir") ^ "/maps" in + let formats i = + (Helm_registry.get "tmp.dir") ^ "/"^(string_of_int i)^"/maps" + in + for i = 1 to processes do + let fmt = formats i in + ignore(Unix.system ("rm -rf " ^ fmt)); + ignore(Unix.system ("mkdir -p " ^ fmt)); + ignore(Unix.system ("cp -r " ^ base ^ " " ^ fmt ^ "/../")); + done; + let dbspec = LibraryDb.parse_dbd_conf () in + let dbd = HSql.quick_connect dbspec in + MetadataTypes.ownerize_tables owner; + let uri_RE = Str.regexp ".*\\(ind\\|var\\|con\\)$" in + drop_all dbd; + create_all dbd; + let uris = Http_getter.getalluris () in + let uris = List.filter (fun u -> Str.string_match uri_RE u 0) uris in + let todo = partition uris in + let cur = ref 0 in + let tot = List.length todo in + let peons = create_peons processes in + print_string "START "; flush stdout; + ignore(Unix.system "date"); + while !cur < tot do + if is_a_peon_idle peons then + let peon = get_ide_peon peons in + let fmt = formats peon in + let oc = open_out (fmt ^ "/../todo") in + List.iter (fun s -> output_string oc (s^"\n")) (List.nth todo !cur); + close_out oc; + let pid = Unix.fork () in + if pid = 0 then + Unix.execv + "./extractor.opt" [| "./extractor.opt" ; fmt ^ "/../" ; owner|] + else + begin + assign_peon peon pid peons; + incr cur + end + else + wait_a_peon peons + done; + while is_a_peon_busy peons do wait_a_peon peons done; + print_string "END "; flush stdout; + ignore(Unix.system "date"); + (* and now the rename table stuff *) + let obj_tbl = MetadataTypes.library_obj_tbl in + let sort_tbl = MetadataTypes.library_sort_tbl in + let rel_tbl = MetadataTypes.library_rel_tbl in + let name_tbl = MetadataTypes.library_name_tbl in + let count_tbl = MetadataTypes.library_count_tbl in + let hits_tbl = MetadataTypes.library_hits_tbl in + let obj_tbl_b = obj_tbl ^ "_BACKUP" in + let sort_tbl_b = sort_tbl ^ "_BACKUP" in + let rel_tbl_b = rel_tbl ^ "_BACKUP" in + let name_tbl_b = name_tbl ^ "_BACKUP" in + let count_tbl_b = count_tbl ^ "_BACKUP" in + let obj_tbl_c = MetadataTypes.obj_tbl () in + let sort_tbl_c = MetadataTypes.sort_tbl () in + let rel_tbl_c = MetadataTypes.rel_tbl () in + let name_tbl_c = MetadataTypes.name_tbl () in + let count_tbl_c = MetadataTypes.count_tbl () in + let stats = + SqlStatements.drop_tables [ + (obj_tbl_b,`RefObj); + (sort_tbl_b,`RefSort); + (rel_tbl_b,`RefRel); + (name_tbl_b,`ObjectName); + (count_tbl_b,`Count); + (hits_tbl,`Hits) ] @ + SqlStatements.drop_indexes [ + (obj_tbl,`RefObj); + (sort_tbl,`RefSort); + (rel_tbl,`RefRel); + (name_tbl,`ObjectName); + (count_tbl,`Count); + (obj_tbl_c,`RefObj); + (sort_tbl_c,`RefSort); + (rel_tbl_c,`RefRel); + (name_tbl_c,`ObjectName); + (count_tbl_c,`Count); + (hits_tbl,`Hits) ] HSql.Library dbd @ + SqlStatements.rename_tables [ + (obj_tbl,obj_tbl_b); + (sort_tbl,sort_tbl_b); + (rel_tbl,rel_tbl_b); + (name_tbl,name_tbl_b); + (count_tbl,count_tbl_b) ] @ + SqlStatements.rename_tables [ + (obj_tbl_c,obj_tbl); + (sort_tbl_c,sort_tbl); + (rel_tbl_c,rel_tbl); + (name_tbl_c,name_tbl); + (count_tbl_c,count_tbl) ] @ + SqlStatements.create_tables [ + (hits_tbl,`Hits) ] @ + SqlStatements.fill_hits obj_tbl hits_tbl @ + SqlStatements.create_indexes [ + (obj_tbl,`RefObj); + (sort_tbl,`RefSort); + (rel_tbl,`RefRel); + (name_tbl,`ObjectName); + (count_tbl,`Count); + (hits_tbl,`Hits) ] + in + List.iter (fun statement -> + try + ignore (HSql.exec HSql.Library dbd statement) + with HSql.Error _ as exn -> + match HSql.errno HSql.Library dbd with + | HSql.Table_exists_error + | HSql.Bad_table_error -> () + | _ -> + prerr_endline (Printexc.to_string exn); + raise exn) + stats +;; + +main () diff --git a/components/binaries/heights/.depend b/components/binaries/heights/.depend new file mode 100644 index 000000000..e69de29bb diff --git a/components/binaries/heights/.depend.opt b/components/binaries/heights/.depend.opt new file mode 100644 index 000000000..e69de29bb diff --git a/components/binaries/heights/Makefile b/components/binaries/heights/Makefile new file mode 100644 index 000000000..cd270082a --- /dev/null +++ b/components/binaries/heights/Makefile @@ -0,0 +1,104 @@ +include ../../../Makefile.defs + +H=@ + +REQUIRES = helm-library + +MLS = heights.ml +MLIS = +CLEAN = + +LIBRARIES = $(shell $(OCAMLFIND) query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES)) +LIBRARIES_OPT = $(shell $(OCAMLFIND) query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES)) + +CMOS = $(MLS:%.ml=%.cmo) +CMXS = $(MLS:%.ml=%.cmx) +CMIS = $(MLIS:%.mli=%.cmi) +EXTRAS = + +OCAMLC = $(OCAMLFIND) ocamlc -thread -package "$(REQUIRES)" -linkpkg -rectypes +OCAMLOPT = $(OCAMLFIND) ocamlopt -thread -package "$(REQUIRES)" -linkpkg -rectypes +OCAMLDEP = $(OCAMLFIND) ocamldep +OCAMLYACC = ocamlyacc +OCAMLLEX = ocamllex + +all: heights .depend + @echo -n + +opt: heights.opt $(EXTRAS) .depend.opt + @echo -n + +heights: $(CMIS) $(CMOS) $(EXTRAS) + @echo " OCAMLC $(CMOS)" + $(H)$(OCAMLC) -o $@ $(CMOS) + +heights.opt: $(CMIS) $(CMXS) $(EXTRAS) + @echo " OCAMLOPT $(CMXS)" + $(H)$(OCAMLOPT) -o $@ $(CMXS) + +clean: + $(H)rm -f *.cm[iox] *.a *.o *.output + $(H)rm -f heights heights.opt $(CLEAN) + +.depend: $(MLIS) $(MLS) $(EXTRAS) + @echo " OCAMLDEP $(MLIS) $(MLS)" + $(H)$(OCAMLDEP) $(MLIS) $(MLS) > .depend + +.depend.opt: $(MLIS) $(MLS) $(EXTRAS) + @echo " OCAMLDEP -native $(MLIS) $(MLS)" + $(H)$(OCAMLDEP) -native $(MLIS) $(MLS) > .depend.opt + +test: heights heights.conf.xml + @echo " HEIGHTS" + $(H)$< 1> heights.txt 2> errors.txt + +test.opt: heights.opt heights.conf.xml $(PACKAGES:%=%.conf.xml) + @echo " HEIGHTS.OPT" + $(H)$< 1> heights.txt 2> errors.txt + +export: clean + $(H)rm -f *~ + @echo " TAR heights" + $(H)cd .. && tar --exclude=heights/.svn -czf heights.tgz heights + +depend: .depend + +depend.opt: .depend.opt + +%.cmi: %.mli $(EXTRAS) + @echo " OCAMLC $<" + $(H)$(OCAMLC) -c $< +%.cmo %.cmi: %.ml $(EXTRAS) $(LIBRARIES) + @echo " OCAMLC $<" + $(H)$(OCAMLC) -c $< +%.cmx: %.ml $(EXTRAS) $(LIBRARIES_OPT) + @echo " OCAMLOPT $<" + $(H)$(OCAMLOPT) -c $< +%.ml %.mli: %.mly $(EXTRAS) + @echo " OCAMLYACC $<" + $(H)$(OCAMLYACC) -v $< +%.ml: %.mll $(EXTRAS) + @echo " OCAMLLEX $<" + $(H)$(OCAMLLEX) $< + +include ../../../Makefile.defs + +ifeq ($(MAKECMDGOALS),) + include .depend +endif + +ifeq ($(MAKECMDGOALS), all) + include .depend +endif + +ifeq ($(MAKECMDGOALS), opt) + include .depend.opt +endif + +ifeq ($(MAKECMDGOALS), test) + include .depend +endif + +ifeq ($(MAKECMDGOALS), test.opt) + include .depend.opt +endif diff --git a/components/binaries/heights/heights.conf.xml b/components/binaries/heights/heights.conf.xml new file mode 100644 index 000000000..9ecb8b687 --- /dev/null +++ b/components/binaries/heights/heights.conf.xml @@ -0,0 +1,7 @@ + + +
+ mysql://mowgli.cs.unibo.it mowgli helm none legacy + legacy +
+
diff --git a/components/binaries/heights/heights.ml b/components/binaries/heights/heights.ml new file mode 100644 index 000000000..f77c6cb4d --- /dev/null +++ b/components/binaries/heights/heights.ml @@ -0,0 +1,48 @@ +module Registry = Helm_registry +module SQL = HSql +module DB = LibraryDb + +let tbl = Hashtbl.create 50147 +let ord = ref 1 +let conf_file = ref "heights.conf.xml" + +let rec mesure db_type dbd prim str = + try + let h, p = Hashtbl.find tbl str in + if prim then begin + if p > 0 then Printf.eprintf "Hit %2u: %s\n" (succ p) str; + Hashtbl.replace tbl str (h, succ p) + end; + h + with Not_found -> + let query = + Printf.sprintf "SELECT h_occurrence FROM refObj WHERE source = '%s'" + (SQL.escape db_type dbd str) + in + let result = SQL.exec db_type dbd query in + let f res = match res.(0) with + | Some str -> mesure db_type dbd false str + | None -> assert false + in + let hs = SQL.map result ~f in + let h = succ (List.fold_left max 0 hs) in + Printf.printf "%3u %5u %s\n" h !ord str; flush stdout; + ord := succ !ord; + let p = if prim then 1 else 0 in + Hashtbl.add tbl str (h, p); h + +let scan_objs db_type dbd = + let query = "SELECT source FROM objectName" in + let result = SQL.exec db_type dbd query in + let f res = match res.(0) with + | Some str -> ignore (mesure db_type dbd true str) + | None -> assert false + in + SQL.iter result ~f + +let _ = + Registry.load_from !conf_file; + let db_type = DB.dbtype_of_string (Registry.get_string "db.type") in + let db_spec = DB.parse_dbd_conf () in + let dbd = SQL.quick_connect db_spec in + scan_objs db_type dbd diff --git a/components/binaries/saturate/Makefile b/components/binaries/saturate/Makefile new file mode 100644 index 000000000..ecd8d9111 --- /dev/null +++ b/components/binaries/saturate/Makefile @@ -0,0 +1,33 @@ +H=@ + +REQUIRES = helm-grafite_parser helm-tactics + +INTERFACE_FILES = +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = \ + saturate saturate.opt + +all: saturate + $(H)echo -n +opt: saturate.opt + $(H)echo -n + +saturate: saturate_main.ml + $(H)echo " OCAMLC $<" + $(H)$(OCAMLFIND) ocamlc \ + -I ../../tactics/paramodulation/ -thread -package "$(REQUIRES)" -linkpkg -o $@ $< + +saturate.opt: saturate_main.ml + $(H)echo " OCAMLOPT $<" + $(H)$(OCAMLFIND) ocamlopt \ + -I ../../tactics/paramodulation/ -thread -package "$(REQUIRES)" -linkpkg -o $@ $< + +clean: + $(H)rm -f *.cm[iox] *.a *.o + $(H)rm -f saturate saturate.opt + +depend: +depend.opt: + +include ../../../Makefile.defs diff --git a/components/binaries/saturate/saturate_main.ml b/components/binaries/saturate/saturate_main.ml new file mode 100644 index 000000000..abb23a67a --- /dev/null +++ b/components/binaries/saturate/saturate_main.ml @@ -0,0 +1,166 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +module Trivial_disambiguate: +sig + exception Ambiguous_term of string Lazy.t + (** disambiguate an _unanmbiguous_ term using dummy callbacks which fail if a + * choice from the user is needed to disambiguate the term + * @raise Ambiguous_term for ambiguous term *) + val disambiguate_string: + dbd:HSql.dbd -> + ?context:Cic.context -> + ?metasenv:Cic.metasenv -> + ?initial_ugraph:CicUniv.universe_graph -> + ?aliases:DisambiguateTypes.environment ->(* previous interpretation status*) + string -> + ((DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Cic.metasenv * (* new metasenv *) + Cic.term * + CicUniv.universe_graph) list (* disambiguated term *) +end += +struct + exception Ambiguous_term of string Lazy.t + exception Exit + module Callbacks = + struct + let non p x = not (p x) + let interactive_user_uri_choice ~selection_mode ?ok + ?(enable_button_for_non_vars = true) ~title ~msg ~id uris = + List.filter (non UriManager.uri_is_var) uris + let interactive_interpretation_choice interp = raise Exit + let input_or_locate_uri ~(title:string) ?id = raise Exit + end + module Disambiguator = Disambiguate.Make (Callbacks) + let disambiguate_string ~dbd ?(context = []) ?(metasenv = []) ?initial_ugraph + ?(aliases = DisambiguateTypes.Environment.empty) term + = + let ast = + CicNotationParser.parse_level2_ast (Ulexing.from_utf8_string term) + in + try + fst (Disambiguator.disambiguate_term ~dbd ~context ~metasenv ("",0,ast) + ?initial_ugraph ~aliases ~universe:None) + with Exit -> raise (Ambiguous_term (lazy term)) +end + +let configuration_file = ref "../../../matita/matita.conf.xml";; + +let core_notation_script = "../../../matita/core_notation.moo";; + +let get_from_user ~(dbd:HSql.dbd) = + let rec get () = + match read_line () with + | "" -> [] + | t -> t::(get ()) + in + let term_string = String.concat "\n" (get ()) in + let env, metasenv, term, ugraph = + List.nth (Trivial_disambiguate.disambiguate_string dbd term_string) 0 + in + term, metasenv, ugraph +;; + +let full = ref false;; + +let retrieve_only = ref false;; + +let demod_equalities = ref false;; + +let main () = + let module S = Saturation in + let set_ratio v = S.weight_age_ratio := v; S.weight_age_counter := v + and set_sel v = S.symbols_ratio := v; S.symbols_counter := v; + and set_conf f = configuration_file := f + and set_ordering o = + match o with + | "lpo" -> Utils.compare_terms := Utils.lpo + | "kbo" -> Utils.compare_terms := Utils.kbo + | "nr-kbo" -> Utils.compare_terms := Utils.nonrec_kbo + | "ao" -> Utils.compare_terms := Utils.ao + | o -> raise (Arg.Bad ("Unknown term ordering: " ^ o)) + and set_fullred b = S.use_fullred := b + and set_time_limit v = S.time_limit := float_of_int v + and set_width w = S.maxwidth := w + and set_depth d = S.maxdepth := d + and set_full () = full := true + and set_retrieve () = retrieve_only := true + and set_demod_equalities () = demod_equalities := true + in + Arg.parse [ + "-full", Arg.Unit set_full, "Enable full mode"; + "-f", Arg.Bool set_fullred, + "Enable/disable full-reduction strategy (default: enabled)"; + + "-r", Arg.Int set_ratio, "Weight-Age equality selection ratio (default: 4)"; + + "-s", Arg.Int set_sel, + "symbols-based selection ratio (relative to the weight ratio, default: 0)"; + + "-c", Arg.String set_conf, "Configuration file (for the db connection)"; + + "-o", Arg.String set_ordering, + "Term ordering. Possible values are:\n" ^ + "\tkbo: Knuth-Bendix ordering\n" ^ + "\tnr-kbo: Non-recursive variant of kbo (default)\n" ^ + "\tlpo: Lexicographic path ordering"; + + "-l", Arg.Int set_time_limit, "Time limit in seconds (default: no limit)"; + + "-w", Arg.Int set_width, + Printf.sprintf "Maximal width (default: %d)" !Saturation.maxwidth; + + "-d", Arg.Int set_depth, + Printf.sprintf "Maximal depth (default: %d)" !Saturation.maxdepth; + + "-retrieve", Arg.Unit set_retrieve, "retrieve only"; + "-demod-equalities", Arg.Unit set_demod_equalities, "demod equalities"; + ] (fun a -> ()) "Usage:"; + Helm_registry.load_from !configuration_file; + ignore (CicNotation2.load_notation [] core_notation_script); + ignore (CicNotation2.load_notation [] "../../../matita/library/legacy/coq.ma"); + let dbd = HSql.quick_connect + ~host:(Helm_registry.get "db.host") + ~user:(Helm_registry.get "db.user") + ~database:(Helm_registry.get "db.database") + () + in + let term, metasenv, ugraph = get_from_user ~dbd in + if !retrieve_only then + Saturation.retrieve_and_print dbd term metasenv ugraph + else if !demod_equalities then + Saturation.main_demod_equalities dbd term metasenv ugraph + else + Saturation.main dbd !full term metasenv ugraph +;; + +let _ = + (*try*) + main () + (*with exn -> prerr_endline (Printexc.to_string exn)*) + diff --git a/components/binaries/table_creator/.depend b/components/binaries/table_creator/.depend new file mode 100644 index 000000000..e69de29bb diff --git a/components/binaries/table_creator/.depend.opt b/components/binaries/table_creator/.depend.opt new file mode 100644 index 000000000..e69de29bb diff --git a/components/binaries/table_creator/Makefile b/components/binaries/table_creator/Makefile new file mode 100644 index 000000000..d5889699f --- /dev/null +++ b/components/binaries/table_creator/Makefile @@ -0,0 +1,56 @@ +H=@ + +REQUIRES = mysql helm-metadata + +INTERFACE_FILES = +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = \ + table_creator table_creator.opt table_destructor table_destructor.opt + +all: table_creator table_destructor + $(H)echo -n +opt: table_creator.opt table_destructor.opt + $(H)echo -n + +table_creator: table_creator.ml + $(H)echo " OCAMLC $<" + $(H)$(OCAMLFIND) ocamlc \ + -thread -package mysql,helm-metadata -linkpkg -rectypes -o $@ $< + +table_destructor: table_creator + $(H)ln -f $< $@ + +table_creator.opt: table_creator.ml + $(H)echo " OCAMLOPT $<" + $(H)$(OCAMLFIND) ocamlopt \ + -thread -package mysql,helm-metadata -linkpkg -rectypes -o $@ $< + +table_destructor.opt: table_creator.opt + $(H)ln -f $< $@ + +clean: + $(H)rm -f *.cm[iox] *.a *.o + $(H)rm -f table_creator table_creator.opt \ + table_destructor table_destructor.opt + +depend: + $(H)echo " OCAMLDEP" + $(H)ocamldep table_creator.ml > .depend +depend.opt: + $(H)echo " OCAMLDEP -native" + $(H)ocamldep -native table_creator.ml > .depend.opt + +ifeq ($(MAKECMDGOALS),) + include .depend +endif + +ifeq ($(MAKECMDGOALS), all) + include .depend +endif + +ifeq ($(MAKECMDGOALS), opt) + include .depend.opt +endif + +include ../../../Makefile.defs diff --git a/components/binaries/table_creator/sync_db.sh b/components/binaries/table_creator/sync_db.sh new file mode 100755 index 000000000..7b201382a --- /dev/null +++ b/components/binaries/table_creator/sync_db.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# sync metadata from a source database (usually "mowgli") to a target one +# (usually "matita") +# Created: Fri, 13 May 2005 13:50:16 +0200 zacchiro +# Last-Modified: Fri, 13 May 2005 13:50:16 +0200 zacchiro + +SOURCE_DB="mowgli" +TARGET_DB="matita" +MYSQL_FLAGS="-u helm -h localhost" + +MYSQL="mysql $MYSQL_FLAGS -f" +MYSQLDUMP="mysqldump $MYSQL_FLAGS" +MYSQLRESTORE="mysqlrestore $MYSQL_FLAGS" +TABLES=`./table_creator list all` +DUMP="${SOURCE_DB}_dump.gz" + +echo "Dumping source db $SOURCE_DB ..." +$MYSQLDUMP $SOURCE_DB $TABLES | gzip -c > $DUMP +echo "Destroying old tables in target db $TARGET_DB ..." +./table_destructor table all | $MYSQL $TARGET_DB +echo "Creating table structure in target db $TARGET_DB ..." +echo "Filling target db $TARGET_DB ..." +zcat $DUMP | $MYSQL $TARGET_DB +./table_creator index all | $MYSQL $TARGET_DB +rm $DUMP +echo "Done." + diff --git a/components/binaries/table_creator/table_creator.ml b/components/binaries/table_creator/table_creator.ml new file mode 100644 index 000000000..c735fe67f --- /dev/null +++ b/components/binaries/table_creator/table_creator.ml @@ -0,0 +1,87 @@ + +open Printf + +let map = + (MetadataTypes.library_obj_tbl,`RefObj) :: + (MetadataTypes.library_sort_tbl,`RefSort) :: + (MetadataTypes.library_rel_tbl,`RefRel) :: + (MetadataTypes.library_name_tbl,`ObjectName) :: + (MetadataTypes.library_hits_tbl,`Hits) :: + (MetadataTypes.library_count_tbl,`Count) :: [] + +let usage argv_o = + prerr_string "\nusage:"; + prerr_string ("\t" ^ argv_o ^ " what tablename[=rename]\n"); + prerr_string ("\t" ^ argv_o ^ " what all\n\n"); + prerr_endline "what:"; + prerr_endline "\tlist\tlist table names"; + prerr_endline "\ttable\toutput SQL regarding tables"; + prerr_endline "\tindex\toutput SQL regarding indexes"; + prerr_endline "\tfill\toutput SQL filling tables (only \"hits\" supported)\n"; + prerr_string "known tables:\n\t"; + List.iter (fun (n,_) -> prerr_string (" " ^ n)) map; + prerr_endline "\n" + +let eq_RE = Str.regexp "=" + +let parse_args l = + List.map (fun s -> + let parts = Str.split eq_RE s in + let len = List.length parts in + assert (len = 1 || len = 2); + if len = 1 then (s,s) else (List.nth parts 0, List.nth parts 1)) + l + +let destructor_RE = Str.regexp "table_destructor\\(\\|\\.opt\\)$" + +let am_i_destructor () = + try + let _ = Str.search_forward destructor_RE Sys.argv.(0) 0 in true + with Not_found -> false + +let main () = + let len = Array.length Sys.argv in + if len < 3 then + begin + usage Sys.argv.(0); + exit 1 + end + else + begin + let tab,idx,fill = + if am_i_destructor () then + (SqlStatements.drop_tables, + (fun x -> + let dbd = HSql.fake_db_for_mysql HSql.Library in + SqlStatements.drop_indexes x HSql.Library dbd), + fun _ t -> [sprintf "DELETE * FROM %s;" t]) + else + (SqlStatements.create_tables, + SqlStatements.create_indexes, + SqlStatements.fill_hits) + in + let from = 2 in + let what = + match Sys.argv.(1) with + | "list" -> `List + | "index" -> `Index + | "table" -> `Table + | "fill" -> `Fill + | _ -> failwith "what must be one of \"index\", \"table\", \"fill\"" + in + let todo = Array.to_list (Array.sub Sys.argv from (len - from)) in + let todo = match todo with ["all"] -> List.map fst map | todo -> todo in + let todo = parse_args todo in + let todo = List.map (fun (x,name) -> name, (List.assoc x map)) todo in + match what with + | `Index -> print_endline (String.concat "\n" (idx todo)) + | `Table -> print_endline (String.concat "\n" (tab todo)) + | `Fill -> + print_endline (String.concat "\n" + (fill MetadataTypes.library_obj_tbl MetadataTypes.library_hits_tbl)) + | `List -> print_endline (String.concat " " (List.map fst map)) + end + +let _ = main () + + diff --git a/components/binaries/transcript/.depend b/components/binaries/transcript/.depend new file mode 100644 index 000000000..5e737a14a --- /dev/null +++ b/components/binaries/transcript/.depend @@ -0,0 +1,12 @@ +v8Parser.cmi: types.cmo +grafite.cmi: types.cmo +v8Parser.cmo: types.cmo v8Parser.cmi +v8Parser.cmx: types.cmx v8Parser.cmi +v8Lexer.cmo: v8Parser.cmi +v8Lexer.cmx: v8Parser.cmx +grafite.cmo: types.cmo grafite.cmi +grafite.cmx: types.cmx grafite.cmi +engine.cmo: v8Parser.cmi v8Lexer.cmo types.cmo grafite.cmi engine.cmi +engine.cmx: v8Parser.cmx v8Lexer.cmx types.cmx grafite.cmx engine.cmi +top.cmo: engine.cmi +top.cmx: engine.cmx diff --git a/components/binaries/transcript/.depend.opt b/components/binaries/transcript/.depend.opt new file mode 100644 index 000000000..61ce486f9 --- /dev/null +++ b/components/binaries/transcript/.depend.opt @@ -0,0 +1,12 @@ +v8Parser.cmi: types.cmx +grafite.cmi: types.cmx +v8Parser.cmo: types.cmx v8Parser.cmi +v8Parser.cmx: types.cmx v8Parser.cmi +v8Lexer.cmo: v8Parser.cmi +v8Lexer.cmx: v8Parser.cmx +grafite.cmo: types.cmx grafite.cmi +grafite.cmx: types.cmx grafite.cmi +engine.cmo: v8Parser.cmi v8Lexer.cmx types.cmx grafite.cmi engine.cmi +engine.cmx: v8Parser.cmx v8Lexer.cmx types.cmx grafite.cmx engine.cmi +top.cmo: engine.cmi +top.cmx: engine.cmx diff --git a/components/binaries/transcript/CoRN.conf.xml b/components/binaries/transcript/CoRN.conf.xml new file mode 100644 index 000000000..e904b4d4e --- /dev/null +++ b/components/binaries/transcript/CoRN.conf.xml @@ -0,0 +1,15 @@ + + +
+ CoRN + CoRN-Decl + cic:/CoRN + cic:/matita/CoRN-Decl + /projects/helm/exportation/CoRN + $(transcript.helm_dir)/matita/contribs/CoRN-Decl + .v + Z_of_nat cic:/Coq/ZArith/BinInt/Z_of_nat.con + Zpos cic:/Coq/ZArith/BinInt/Z.ind#xpointer(1/1/2) + nat_of_P cic:/Coq/NArith/BinPos/nat_of_P.con +
+
diff --git a/components/binaries/transcript/Makefile b/components/binaries/transcript/Makefile new file mode 100644 index 000000000..b9bfc6109 --- /dev/null +++ b/components/binaries/transcript/Makefile @@ -0,0 +1,106 @@ +include ../../../Makefile.defs + +H=@ + +REQUIRES = unix str helm-grafite_parser + +MLS = types.ml v8Parser.ml v8Lexer.ml grafite.ml engine.ml top.ml +MLIS = v8Parser.mli grafite.mli engine.mli +CLEAN = v8Parser.ml v8Parser.mli v8Lexer.ml + +PACKAGES = CoRN + +LIBRARIES = $(shell $(OCAMLFIND) query -recursive -predicates "byte $(PREDICATES)" -format "%d/%a" $(REQUIRES)) +LIBRARIES_OPT = $(shell $(OCAMLFIND) query -recursive -predicates "native $(PREDICATES)" -format "%d/%a" $(REQUIRES)) + +CMOS = $(MLS:%.ml=%.cmo) +CMXS = $(MLS:%.ml=%.cmx) +CMIS = $(MLIS:%.mli=%.cmi) +EXTRAS = + +OCAMLC = $(OCAMLFIND) ocamlc -thread -package "$(REQUIRES)" -linkpkg -rectypes +OCAMLOPT = $(OCAMLFIND) ocamlopt -thread -package "$(REQUIRES)" -linkpkg -rectypes +OCAMLDEP = $(OCAMLFIND) ocamldep +OCAMLYACC = ocamlyacc +OCAMLLEX = ocamllex + +all: transcript .depend + @echo -n + +opt: transcript.opt $(EXTRAS) .depend.opt + @echo -n + +transcript: $(CMIS) $(CMOS) $(EXTRAS) + @echo " OCAMLC $(CMOS)" + $(H)$(OCAMLC) -o $@ $(CMOS) + +transcript.opt: $(CMIS) $(CMXS) $(EXTRAS) + @echo " OCAMLOPT $(CMXS)" + $(H)$(OCAMLOPT) -o $@ $(CMXS) + +clean: + $(H)rm -f *.cm[iox] *.a *.o *.output + $(H)rm -f transcript transcript.opt $(CLEAN) + +.depend: $(MLIS) $(MLS) $(EXTRAS) + @echo " OCAMLDEP $(MLIS) $(MLS)" + $(H)$(OCAMLDEP) $(MLIS) $(MLS) > .depend + +.depend.opt: $(MLIS) $(MLS) $(EXTRAS) + @echo " OCAMLDEP -native $(MLIS) $(MLS)" + $(H)$(OCAMLDEP) -native $(MLIS) $(MLS) > .depend.opt + +test: transcript transcript.conf.xml $(PACKAGES:%=%.conf.xml) + @echo " TRANSCRIPT $(PACKAGES)" + $(H)$< $(PACKAGES) + +test.opt: transcript.opt transcript.conf.xml $(PACKAGES:%=%.conf.xml) + @echo " TRANSCRIPT.OPT $(PACKAGES)" + $(H)$< $(PACKAGES) + +export: clean + $(H)rm -f *~ + @echo " TAR transcript" + $(H)cd .. && tar --exclude=transcript/.svn -czf transcript.tgz transcript + +depend: .depend + +depend.opt: .depend.opt + +%.cmi: %.mli $(EXTRAS) + @echo " OCAMLC $<" + $(H)$(OCAMLC) -c $< +%.cmo %.cmi: %.ml $(EXTRAS) $(LIBRARIES) + @echo " OCAMLC $<" + $(H)$(OCAMLC) -c $< +%.cmx: %.ml $(EXTRAS) $(LIBRARIES_OPT) + @echo " OCAMLOPT $<" + $(H)$(OCAMLOPT) -c $< +%.ml %.mli: %.mly $(EXTRAS) + @echo " OCAMLYACC $<" + $(H)$(OCAMLYACC) -v $< +%.ml: %.mll $(EXTRAS) + @echo " OCAMLLEX $<" + $(H)$(OCAMLLEX) $< + +include ../../../Makefile.defs + +ifeq ($(MAKECMDGOALS),) + include .depend +endif + +ifeq ($(MAKECMDGOALS), all) + include .depend +endif + +ifeq ($(MAKECMDGOALS), opt) + include .depend.opt +endif + +ifeq ($(MAKECMDGOALS), test) + include .depend +endif + +ifeq ($(MAKECMDGOALS), test.opt) + include .depend.opt +endif diff --git a/components/binaries/transcript/engine.ml b/components/binaries/transcript/engine.ml new file mode 100644 index 000000000..66c6c33be --- /dev/null +++ b/components/binaries/transcript/engine.ml @@ -0,0 +1,218 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module R = Helm_registry +module X = HExtlib +module T = Types +module G = Grafite + +type script = { + name: string; + contents: T.items +} + +type status = { + helm_dir: string; + heading_path: string; + heading_lines: int; + input_package: string; + output_package: string; + input_base_uri: string; + output_base_uri: string; + input_path: string; + output_path: string; + script_ext: string; + coercions: (string * string) list; + files: string list; + requires: (string * string) list; + scripts: script array +} + +let default_script = { + name = ""; contents = [] +} + +let default_scripts = 2 + +let load_registry registry = + let suffix = ".conf.xml" in + let registry = + if Filename.check_suffix registry suffix then registry + else registry ^ suffix + in + Printf.eprintf "reading configuration %s ...\n" registry; flush stderr; + R.load_from registry + +let set_files st = + let eof ich = try Some (input_line ich) with End_of_file -> None in + let trim l = Filename.chop_extension (Str.string_after l 2) in + let cmd = Printf.sprintf "cd %s && find -name *%s" st.input_path st.script_ext in + let ich = Unix.open_process_in cmd in + let rec aux files = + match eof ich with + | None -> List.rev files + | Some l -> aux (trim l :: files) + in + let files = aux [] in + let _ = Unix.close_process_in ich in + {st with files = files} + +let set_requires st = + let map file = (Filename.basename file, file) in + let requires = List.rev_map map st.files in + {st with requires = requires} + +let init () = + let default_registry = "transcript" in + load_registry default_registry + +let make registry = + let id x = x in + let get_coercions = R.get_list (R.pair id id) in + load_registry registry; + let st = { + helm_dir = R.get_string "transcript.helm_dir"; + heading_path = R.get_string "transcript.heading_path"; + heading_lines = R.get_int "transcript.heading_lines"; + input_package = R.get_string "package.input_name"; + output_package = R.get_string "package.output_name"; + input_base_uri = R.get_string "package.input_base_uri"; + output_base_uri = R.get_string "package.output_base_uri"; + input_path = R.get_string "package.input_path"; + output_path = R.get_string "package.output_path"; + script_ext = R.get_string "package.script_type"; + coercions = get_coercions "package.coercion"; + files = []; + requires = []; + scripts = Array.make default_scripts default_script + } in + prerr_endline "reading file names ..."; + let st = set_files st in + let st = set_requires st in + st + +let get_index st name = + let rec get_index name i = + if i >= Array.length st.scripts then None else + if st.scripts.(i).name = name then Some i else + get_index name (succ i) + in + match get_index name 0, get_index "" 0 with + | Some i, _ | _, Some i -> i + | None, None -> failwith "not enought script entries" + +let set_items st name items = + let i = get_index st name in + let script = st.scripts.(i) in + let contents = List.rev_append items script.contents in + st.scripts.(i) <- {name = name; contents = contents} + +let set_heading st name = + let heading = Filename.concat st.helm_dir st.heading_path, st.heading_lines in + set_items st name [T.Heading heading] + +let set_baseuri st name = + let baseuri = Filename.concat st.output_base_uri name in + set_items st name [T.BaseUri baseuri] + +let require st name inc = + set_items st name [T.Include inc] + +let get_coercion st str = + try List.assoc str st.coercions with Not_found -> "" + +let make_path path = + List.fold_left Filename.concat "" (List.rev path) + +let make_prefix path = + String.concat "__" (List.rev path) ^ "__" + +let commit st name = + let i = get_index st name in + let script = st.scripts.(i) in + let path = Filename.concat st.output_path (Filename.dirname name) in + let name = Filename.concat st.output_path (name ^ ".ma") in + let cmd = Printf.sprintf "mkdir -p %s" path in + let _ = Sys.command cmd in + let och = open_out name in + G.commit och script.contents; + close_out och; + st.scripts.(i) <- default_script + +let produce st = + let init name = set_heading st name; set_baseuri st name in + let partition = function + | T.Coercion (false, _) + | T.Notation (false, _) -> false + | _ -> true + in + let produce st name = + let in_base_uri = Filename.concat st.input_base_uri name in + let out_base_uri = Filename.concat st.output_base_uri name in + let filter path = function + | T.Inline (b, k, obj, p) -> + let obj, p = + if b then Filename.concat (make_path path) obj, make_prefix path + else obj, p + in + let s = obj ^ G.string_of_inline_kind k in + path, Some (T.Inline (b, k, Filename.concat in_base_uri s, p)) + | T.Include s -> + begin + try path, Some (T.Include (List.assoc s st.requires)) + with Not_found -> path, None + end + | T.Coercion (b, obj) -> + let str = get_coercion st obj in + if str <> "" then path, Some (T.Coercion (b, str)) else + let base_uri = if b then out_base_uri else in_base_uri in + let s = obj ^ G.string_of_inline_kind T.Con in + path, Some (T.Coercion (b, Filename.concat base_uri s)) + | T.Section (b, id, _) as item -> + let path = if b then id :: path else List.tl path in + path, Some item + | item -> path, Some item + in + Printf.eprintf "processing file name: %s ...\n" name; flush stderr; + let file = Filename.concat st.input_path (name ^ st.script_ext) in + let ich = open_in file in + let lexbuf = Lexing.from_channel ich in + try + let items = V8Parser.items V8Lexer.token lexbuf in + close_in ich; + let _, rev_items = X.list_rev_map_filter_fold filter [] items in + let items = List.rev rev_items in + let local_items, global_items = List.partition partition items in + let comment = T.Line (Printf.sprintf "From %s" name) in + if global_items <> [] then + set_items st st.input_package (comment :: global_items); + init name; require st name st.input_package; + set_items st name local_items; commit st name + with e -> + prerr_endline (Printexc.to_string e); close_in ich + in + init st.input_package; require st st.input_package "preamble"; + List.iter (produce st) st.files; + commit st st.input_package diff --git a/components/binaries/transcript/engine.mli b/components/binaries/transcript/engine.mli new file mode 100644 index 000000000..8016d71cf --- /dev/null +++ b/components/binaries/transcript/engine.mli @@ -0,0 +1,32 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type status + +val init: unit -> unit + +val make: string -> status + +val produce: status -> unit diff --git a/components/binaries/transcript/grafite.ml b/components/binaries/transcript/grafite.ml new file mode 100644 index 000000000..e88406b58 --- /dev/null +++ b/components/binaries/transcript/grafite.ml @@ -0,0 +1,113 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module T = Types + +module UM = UriManager +module NP = CicNotationPp +module GP = GrafiteAstPp +module G = GrafiteAst +module H = HExtlib + +let floc = H.dummy_floc + +let out_verbatim och s = + Printf.fprintf och "%s" s + +let out_comment och s = + let s = if s <> "" && s.[0] = '*' then "#" ^ s else s in + Printf.fprintf och "%s%s%s\n\n" "(*" s "*)" + +let out_unexported och head s = + let s = Printf.sprintf " %s\n%s\n" head s in + out_comment och s + +let out_line_comment och s = + let l = 70 - String.length s in + let s = Printf.sprintf " %s %s" s (String.make l '*') in + out_comment och s + +let out_preamble och (path, lines) = + let ich = open_in path in + let rec print i = + if i > 0 then + let s = input_line ich in + begin Printf.fprintf och "%s\n" s; print (pred i) end + in + print lines; + out_line_comment och "This file was automatically generated: do not edit" + +let out_command och cmd = + let term_pp = NP.pp_term in + let lazy_term_pp = NP.pp_term in + let obj_pp = NP.pp_obj NP.pp_term in + let s = GP.pp_statement ~map_unicode_to_tex:false ~term_pp ~lazy_term_pp ~obj_pp cmd in + Printf.fprintf och "%s\n\n" s + +let command_of_obj obj = + G.Executable (floc, G.Command (floc, obj)) + +let command_of_macro macro = + G.Executable (floc, G.Macro (floc, macro)) + +let set key value = + command_of_obj (G.Set (floc, key, value)) + +let require value = + command_of_obj (G.Include (floc, value ^ ".ma")) + +let coercion value = + command_of_obj (G.Coercion (floc, UM.uri_of_string value, true, 0, 0)) + +let inline (uri, prefix) = + command_of_macro (G.Inline (floc, G.Declarative, uri, prefix)) + +let out_alias och name uri = + Printf.fprintf och "alias id \"%s\" = \"%s\".\n\n" name uri + +let commit och items = + let trd (_, _, x) = x in + let trd_rth (_, _, x, y) = x, y in + let commit = function + | T.Heading heading -> out_preamble och heading + | T.Line line -> out_line_comment och line + | T.BaseUri uri -> out_command och (set "baseuri" uri) + | T.Include script -> out_command och (require script) + | T.Coercion specs -> out_command och (coercion (snd specs)) + | T.Notation specs -> out_unexported och "NOTATION" (snd specs) (**) + | T.Inline (_, T.Var, src, _) -> out_alias och (UriManager.name_of_uri (UriManager.uri_of_string src)) src + | T.Inline specs -> out_command och (inline (trd_rth specs)) + | T.Section specs -> out_unexported och "UNEXPORTED" (trd specs) + | T.Comment comment -> out_comment och comment + | T.Unexport unexport -> out_unexported och "UNEXPORTED" unexport + | T.Verbatim verbatim -> out_verbatim och verbatim + | T.Discard _ -> () + in + List.iter commit (List.rev items) + +let string_of_inline_kind = function + | T.Con -> ".con" + | T.Var -> ".var" + | T.Ind -> ".ind" diff --git a/components/binaries/transcript/grafite.mli b/components/binaries/transcript/grafite.mli new file mode 100644 index 000000000..53aff6990 --- /dev/null +++ b/components/binaries/transcript/grafite.mli @@ -0,0 +1,28 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val commit: out_channel -> Types.items -> unit + +val string_of_inline_kind: Types.inline_kind -> string diff --git a/components/binaries/transcript/top.ml b/components/binaries/transcript/top.ml new file mode 100644 index 000000000..387d47f12 --- /dev/null +++ b/components/binaries/transcript/top.ml @@ -0,0 +1,31 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +let main = + let help = "Usage: transcript [ | ]*" in + let process_package package = Engine.produce (Engine.make package) in + Engine.init (); + Arg.parse [ + ] process_package help diff --git a/components/binaries/transcript/transcript.conf.xml b/components/binaries/transcript/transcript.conf.xml new file mode 100644 index 000000000..d79636f39 --- /dev/null +++ b/components/binaries/transcript/transcript.conf.xml @@ -0,0 +1,8 @@ + + +
+ /home/fguidi/svn/software + matita/matita.ma.templ + 14 +
+
diff --git a/components/binaries/transcript/types.ml b/components/binaries/transcript/types.ml new file mode 100644 index 000000000..de7c1036e --- /dev/null +++ b/components/binaries/transcript/types.ml @@ -0,0 +1,47 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type local = bool + +type inline_kind = Con | Ind | Var + +type source = string + +type prefix = string + +type item = Heading of (string * int) + | Line of string + | Comment of string + | Unexport of string + | BaseUri of string + | Include of string + | Coercion of (local * string) + | Notation of (local * string) + | Section of (local * string * string) + | Inline of (local * inline_kind * source * prefix) + | Verbatim of string + | Discard of string + +type items = item list diff --git a/components/binaries/transcript/v8Lexer.mll b/components/binaries/transcript/v8Lexer.mll new file mode 100644 index 000000000..5a90aabf7 --- /dev/null +++ b/components/binaries/transcript/v8Lexer.mll @@ -0,0 +1,72 @@ +{ + module P = V8Parser + + let out t s = () (* prerr_endline (t ^ " " ^ s) *) +} + +let QT = '"' +let SPC = [' ' '\t' '\n' '\r']+ +let ALPHA = ['A'-'Z' 'a'-'z' '_'] +let FIG = ['0'-'9'] +let ID = ALPHA (ALPHA | FIG | "\'")* +let RAWID = QT [^ '"']* QT +let NUM = "-"? FIG+ + +rule token = parse + | "Let" { let s = Lexing.lexeme lexbuf in out "LET" s; P.LET s } + | "Remark" { let s = Lexing.lexeme lexbuf in out "TH" s; P.TH s } + | "Lemma" { let s = Lexing.lexeme lexbuf in out "TH" s; P.TH s } + | "Theorem" { let s = Lexing.lexeme lexbuf in out "TH" s; P.TH s } + | "Definition" { let s = Lexing.lexeme lexbuf in out "TH" s; P.TH s } + | "Fixpoint" { let s = Lexing.lexeme lexbuf in out "TH" s; P.TH s } + | "Qed" { let s = Lexing.lexeme lexbuf in out "QED" s; P.QED s } + | "Defined" { let s = Lexing.lexeme lexbuf in out "QED" s; P.QED s } + | "Proof" { let s = Lexing.lexeme lexbuf in out "PRF" s; P.PROOF s } + | "Variable" { let s = Lexing.lexeme lexbuf in out "VAR" s; P.VAR s } + | "Variables" { let s = Lexing.lexeme lexbuf in out "VAR" s; P.VAR s } + | "Hypothesis" { let s = Lexing.lexeme lexbuf in out "VAR" s; P.VAR s } + | "Hypotheses" { let s = Lexing.lexeme lexbuf in out "VAR" s; P.VAR s } + | "Axiom" { let s = Lexing.lexeme lexbuf in out "AX" s; P.AX s } + | "Inductive" { let s = Lexing.lexeme lexbuf in out "IND" s; P.IND s } + | "Record" { let s = Lexing.lexeme lexbuf in out "IND" s; P.IND s } + | "Section" { let s = Lexing.lexeme lexbuf in out "SEC" s; P.SEC s } + | "End" { let s = Lexing.lexeme lexbuf in out "END" s; P.END s } + | "Hint" { let s = Lexing.lexeme lexbuf in out "UNX" s; P.UNX s } + | "Unset" { let s = Lexing.lexeme lexbuf in out "UNX" s; P.UNX s } + | "Print" { let s = Lexing.lexeme lexbuf in out "UNX" s; P.UNX s } + | "Opaque" { let s = Lexing.lexeme lexbuf in out "UNX" s; P.UNX s } + | "Transparent" { let s = Lexing.lexeme lexbuf in out "UNX" s; P.UNX s } + | "Ltac" { let s = Lexing.lexeme lexbuf in out "UNX" s; P.UNX s } + | "Tactic" { let s = Lexing.lexeme lexbuf in out "UNX" s; P.UNX s } + | "Declare" { let s = Lexing.lexeme lexbuf in out "UNX" s; P.UNX s } + | "Require" { let s = Lexing.lexeme lexbuf in out "REQ" s; P.REQ s } + | "Export" { let s = Lexing.lexeme lexbuf in out "XP" s; P.XP s } + | "Import" { let s = Lexing.lexeme lexbuf in out "IP" s; P.IP s } + | "Load" { let s = Lexing.lexeme lexbuf in out "LOAD" s; P.LOAD s } + | "Set" { let s = Lexing.lexeme lexbuf in out "SET" s; P.SET s } + | "Implicit" { let s = Lexing.lexeme lexbuf in out "SET" s; P.SET s } + | "Notation" { let s = Lexing.lexeme lexbuf in out "NOT" s; P.NOT s } + | "Infix" { let s = Lexing.lexeme lexbuf in out "NOT" s; P.NOT s } + | "Identity" { let s = Lexing.lexeme lexbuf in out "ID" s; P.ID s } + | "Coercion" { let s = Lexing.lexeme lexbuf in out "CO" s; P.COERC s } + | "let" { let s = Lexing.lexeme lexbuf in out "ABBR" s; P.ABBR s } + | "in" { let s = Lexing.lexeme lexbuf in out "IN" s; P.IN s } + | SPC { let s = Lexing.lexeme lexbuf in out "SPC" s; P.SPC s } + | ID { let s = Lexing.lexeme lexbuf in out "ID" s; P.IDENT s } + | RAWID { let s = Lexing.lexeme lexbuf in out "STR" s; P.STR s } + | NUM { let s = Lexing.lexeme lexbuf in out "INT" s; P.INT s } + | ":=" { let s = Lexing.lexeme lexbuf in out "DEF" s; P.DEF s } + | ":>" { let s = Lexing.lexeme lexbuf in out "COE" s; P.COE s } + | "." ID { let s = Lexing.lexeme lexbuf in out "AC" s; P.AC s } + | "." SPC { let s = Lexing.lexeme lexbuf in out "FS" s; P.FS s } + | "." eof { let s = Lexing.lexeme lexbuf in out "FS" s; P.FS s } + | "(*" { let s = Lexing.lexeme lexbuf in out "OQ" s; P.OQ s } + | "*)" { let s = Lexing.lexeme lexbuf in out "CQ" s; P.CQ s } + | "(" { let s = Lexing.lexeme lexbuf in out "OP" s; P.OP s } + | ")" { let s = Lexing.lexeme lexbuf in out "CP" s; P.CP s } + | "{" { let s = Lexing.lexeme lexbuf in out "OC" s; P.OC s } + | "}" { let s = Lexing.lexeme lexbuf in out "CC" s; P.CC s } + | ";" { let s = Lexing.lexeme lexbuf in out "SC" s; P.SC s } + | ":" { let s = Lexing.lexeme lexbuf in out "CN" s; P.CN s } + | _ { let s = Lexing.lexeme lexbuf in out "SPEC" s; P.EXTRA s } + | eof { let s = Lexing.lexeme lexbuf in out "EOF" s; P.EOF } diff --git a/components/binaries/transcript/v8Parser.mly b/components/binaries/transcript/v8Parser.mly new file mode 100644 index 000000000..ff70df713 --- /dev/null +++ b/components/binaries/transcript/v8Parser.mly @@ -0,0 +1,344 @@ +/* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + */ + +%{ + module T = Types + + let out t s = () (* prerr_endline ("-- " ^ t ^ " " ^ s) *) + + let trim = HExtlib.trim_blanks + + let hd = List.hd + + let cat x = String.concat " " x + + let mk_vars local idents = + let map ident = T.Inline (local, T.Var, trim ident, "") in + List.map map idents + + let strip2 s = + String.sub s 1 (String.length s - 2) + + let strip1 s = + String.sub s 1 (String.length s - 1) + + let coercion str = + [T.Coercion (false, str); T.Coercion (true, str)] + + let notation str = + [T.Notation (false, str); T.Notation (true, str)] +%} + %token SPC STR IDENT INT EXTRA AC OP CP OC CC OQ CQ DEF FS COE CN SC + %token ABBR IN LET TH PROOF QED VAR AX IND SEC END UNX REQ XP IP SET NOT LOAD ID COERC + %token EOF + + %start items + %type items +%% + comment: + | OQ verbatims CQ { $1 ^ $2 ^ $3 } + ; + spc: + | SPC { $1 } + | comment { $1 } + ; + spcs: + | { "" } + | spc spcs { $1 ^ $2 } + ; + rspcs: + | { "" } + | SPC rspcs { $1 ^ $2 } + ; + xident: + | IDENT { $1 } + | LET { $1 } + | TH { $1 } + | QED { $1 } + | PROOF { $1 } + | VAR { $1 } + | AX { $1 } + | IND { $1 } + | SEC { $1 } + | END { $1 } + | UNX { $1 } + | REQ { $1 } + | LOAD { $1 } + | NOT { $1 } + | ID { $1 } + | COERC { $1 } + ; + fs: FS spcs { $1 ^ $2 }; + ident: xident spcs { $1 ^ $2 }; + th: TH spcs { $1 ^ $2 }; + xlet: LET spcs { $1 ^ $2 }; + proof: PROOF spcs { $1 ^ $2 }; + qed: QED spcs { $1 ^ $2 }; + sec: SEC spcs { $1 ^ $2 }; + xend: END spcs { $1 ^ $2 }; + unx: UNX spcs { $1 ^ $2 }; + def: DEF spcs { $1 ^ $2 }; + op: OP spcs { $1 ^ $2 }; + abbr: ABBR spcs { $1 ^ $2 }; + var: VAR spcs { $1 ^ $2 }; + ax: AX spcs { $1 ^ $2 }; + req: REQ spcs { $1 ^ $2 }; + load: LOAD spcs { $1 ^ $2 }; + xp: XP spcs { $1 ^ $2 }; + ip: IP spcs { $1 ^ $2 }; + ind: IND spcs { $1 ^ $2 }; + set: SET spcs { $1 ^ $2 }; + notation: NOT spcs { $1 ^ $2 }; + oc: OC spcs { $1 ^ $2 }; + coe: COE spcs { $1 ^ $2 }; + cn: CN spcs { $1 ^ $2 }; + sc: SC spcs { $1 ^ $2 }; + str: STR spcs { $1 ^ $2 }; + id: ID spcs { $1 ^ $2 }; + coerc: COERC spcs { $1 ^ $2 }; + + idents: + | ident { [$1] } + | ident idents { $1 :: $2 } + ; + + cnot: + | EXTRA { $1 } + | INT { $1 } + ; + cnots: + | cnot spcs { $1 ^ $2 } + | cnot spcs cnots { $1 ^ $2 ^ $3 } + ; + + xstrict: + | AC { $1 } + | INT { $1 } + | EXTRA { $1 } + | CN { $1 } + | SC { $1 } + | OC { $1 } + | CC { $1 } + | COE { $1 } + | STR { $1 } + | abbr extends0 IN { $1 ^ $2 ^ $3 } + | op extends1 CP { $1 ^ $2 ^ $3 } + + ; + strict: + | xstrict { $1 } + | IDENT { $1 } + | SET { $1 } + | NOT { $1 } + ; + restrict: + | strict { $1 } + | IN { $1 } + | CP { $1 } + ; + xre: + | xstrict { $1 } + | IN { $1 } + | CP { $1 } + ; + restricts: + | restrict spcs { $1 ^ $2 } + | restrict spcs restricts { $1 ^ $2 ^ $3 } + ; + xres: + | xre spcs { $1 ^ $2 } + | xre spcs restricts { $1 ^ $2 ^ $3 } + ; + extend0: + | strict { $1 } + | DEF { $1 } + ; + extends0: + | extend0 spcs { $1 ^ $2 } + | extend0 spcs extends0 { $1 ^ $2 ^ $3 } + ; + extend1: + | strict { $1 } + | DEF { $1 } + | IN { $1 } + ; + extends1: + | extend1 spcs { $1 ^ $2 } + | extend1 spcs extends1 { $1 ^ $2 ^ $3 } + ; + unexport_rr: + | AC { $1 } + | INT { $1 } + | IDENT { $1 } + | EXTRA { $1 } + | CN { $1 } + | COE { $1 } + | STR { $1 } + | OP { $1 } + | ABBR { $1 } + | IN { $1 } + | CP { $1 } + | DEF { $1 } + | SET { $1 } + | NOT { $1 } + | LOAD { $1 } + | ID { $1 } + | COERC { $1 } + ; + unexport_r: + | unexport_rr { $1, [] } + | oc fields CC { $1 ^ fst $2 ^ $3, snd $2 } + ; + unexports_r: + | unexport_r spcs { fst $1 ^ $2, snd $1 } + | unexport_r spcs unexports_r { fst $1 ^ $2 ^ fst $3, snd $1 @ snd $3 } + ; + field: + | ident cn unexports_r + { $1 ^ $2 ^ fst $3, snd $3 } + | ident coe unexports_r + { $1 ^ $2 ^ fst $3, snd $3 @ coercion (trim $1) } + ; + fields: + | field { $1 } + | field sc fields { fst $1 ^ $2 ^ fst $3, snd $1 @ snd $3 } + | cnots { $1, [] } + | error { out "ERROR" "fields"; failwith "fields" } + ; + unexport: + | unexport_r { $1 } + | SC { $1, [] } + | CC { $1, [] } + ; + unexports: + | unexport spcs { fst $1 ^ $2, snd $1 } + | unexport spcs unexports { fst $1 ^ $2 ^ fst $3, snd $1 @ snd $3 } + ; + verbatim: + | unexport_rr { $1 } + | OC { $1 } + | CC { $1 } + | SC { $1 } + | TH { $1 } + | LET { $1 } + | VAR { $1 } + | AX { $1 } + | IND { $1 } + | SEC { $1 } + | END { $1 } + | UNX { $1 } + | REQ { $1 } + | XP { $1 } + | IP { $1 } + | QED { $1 } + | PROOF { $1 } + | FS { $1 } + | SPC { $1 } + ; + verbatims: + | { "" } + | verbatim verbatims { $1 ^ $2 } + ; + step: + | macro_step { $1 } + | restricts FS { [] } + ; + steps: + | step spcs { [] } + | step spcs steps { $1 @ $3 } + ; + + qid: + | xident { [$1] } + | qid AC { strip1 $2 :: $1 } + ; + + macro_step: + | th ident restricts fs proof FS steps qed FS + { out "TH" $2; $7 @ [T.Inline (false, T.Con, trim $2, "")] } + | th ident restricts fs proof restricts FS + { out "TH" $2; [T.Inline (false, T.Con, trim $2, "")] } + | th ident restricts fs steps qed FS + { out "TH" $2; $5 @ [T.Inline (false, T.Con, trim $2, "")] } + | th ident restricts def restricts FS + { out "TH" $2; [T.Inline (false, T.Con, trim $2, "")] } + | th ident def restricts FS + { out "TH" $2; [T.Inline (false, T.Con, trim $2, "")] } + | xlet ident restricts fs proof FS steps qed FS + { out "LET" $2; $7 @ [T.Inline (true, T.Con, trim $2, "")] } + | xlet ident restricts fs proof restricts FS + { out "LET" $2; [T.Inline (true, T.Con, trim $2, "")] } + | xlet ident restricts fs steps qed FS + { out "LET" $2; $5 @ [T.Inline (true, T.Con, trim $2, "")] } + | xlet ident restricts def restricts FS + { out "LET" $2; [T.Inline (true, T.Con, trim $2, "")] } + | xlet ident def restricts FS + { out "LET" $2; [T.Inline (true, T.Con, trim $2, "")] } + | var idents xres FS + { out "VAR" (cat $2); mk_vars true $2 } + | ax idents xres FS + { out "AX" (cat $2); mk_vars false $2 } + | ind ident unexports FS + { out "IND" $2; T.Inline (false, T.Ind, trim $2, "") :: snd $3 } + | sec ident FS + { out "SEC" $2; [T.Section (true, trim $2, $1 ^ $2)] } + | xend ident FS + { out "END" $2; [T.Section (false, trim $2, $1 ^ $2)] } + | unx unexports FS + { out "UNX" (fst $2); [T.Unexport ($1 ^ fst $2 ^ trim $3)] } + | req xp ident FS + { out "REQ" $3; [T.Include (trim $3)] } + | req ip ident FS + { out "REQ" $3; [T.Include (trim $3)] } + | req ident FS + { out "REQ" $2; [T.Include (trim $2)] } + | load str FS + { out "REQ" $2; [T.Include (strip2 (trim $2))] } + | coerc qid spcs cn unexports FS + { out "COERCE" (hd $2); coercion (hd $2) } + | id coerc qid spcs cn unexports FS + { out "COERCE" (hd $3); coercion (hd $3) } + | th ident error + { out "ERROR" $2; failwith ("macro_step " ^ $2) } + | ind ident error + { out "ERROR" $2; failwith ("macro_step " ^ $2) } + | var idents error + { let vs = cat $2 in + out "ERROR" vs; failwith ("macro_step " ^ vs) } + | ax idents error + { let vs = cat $2 in + out "ERROR" vs; failwith ("macro_step " ^ vs) } + ; + item: + | OQ verbatims CQ { [T.Comment $2] } + | macro_step { $1 } + | set unexports FS { [T.Unexport ($1 ^ fst $2 ^ trim $3)] } + | notation unexports FS { notation ($1 ^ fst $2 ^ trim $3) } + | error { out "ERROR" "item"; failwith "item" } + ; + items: + | rspcs EOF { [] } + | rspcs item items { $2 @ $3 } + ; diff --git a/components/binaries/utilities/.depend b/components/binaries/utilities/.depend new file mode 100644 index 000000000..e69de29bb diff --git a/components/binaries/utilities/.depend.opt b/components/binaries/utilities/.depend.opt new file mode 100644 index 000000000..e69de29bb diff --git a/components/binaries/utilities/Makefile b/components/binaries/utilities/Makefile new file mode 100644 index 000000000..db76fb51d --- /dev/null +++ b/components/binaries/utilities/Makefile @@ -0,0 +1,41 @@ +H=@ + +UTILITIES = create_environment parse_library list_uris test_library +UTILITIES_OPT = $(patsubst %,%.opt,$(UTILITIES)) +LINKOPTS = -linkpkg -rectypes -thread +LIBS = helm-cic_proof_checking +OCAMLC = $(OCAMLFIND) ocamlc $(LINKOPTS) -package $(LIBS) +OCAMLOPT = $(OCAMLFIND) opt $(LINKOPTS) -package $(LIBS) +all: $(UTILITIES) + $(H)echo -n +opt: $(UTILITIES_OPT) + $(H)echo -n +%: %.ml + $(H)echo " OCAMLC $<" + $(H)$(OCAMLC) -o $@ $< +%.opt: %.ml + $(H)echo " OCAMLOPT $<" + $(H)$(OCAMLOPT) -o $@ $< +clean: + rm -f $(UTILITIES) $(UTILITIES_OPT) *.cm[iox] *.o +depend: + $(H)echo " OCAMLDEP" + $(H)ocamldep extractor.ml extractor_manager.ml > .depend +depend.opt: + $(H)echo " OCAMLDEP -native" + $(H)ocamldep -native extractor.ml extractor_manager.ml > .depend.opt + +ifeq ($(MAKECMDGOALS),) + include .depend +endif + +ifeq ($(MAKECMDGOALS), all) + include .depend +endif + +ifeq ($(MAKECMDGOALS), opt) + include .depend.opt +endif + +include ../../../Makefile.defs + diff --git a/components/binaries/utilities/create_environment.ml b/components/binaries/utilities/create_environment.ml new file mode 100644 index 000000000..8a8524d24 --- /dev/null +++ b/components/binaries/utilities/create_environment.ml @@ -0,0 +1,73 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +let trust = true + +let outfname = + match Sys.argv.(1) with + | "-help" | "--help" | "-h" | "--h" -> + print_endline + ("Usage: create_environment \n" ^ + " is the file where environment will be dumped\n" ^ + " is the file containing the URIs, one per line,\n" ^ + " that will be typechecked. Could be \"-\" for\n" ^ + " standard input"); + flush stdout; + exit 0 + | f -> f +let _ = + CicEnvironment.set_trust (fun _ -> trust); + Helm_registry.set "getter.mode" "remote"; + Helm_registry.set "getter.url" "http://mowgli.cs.unibo.it:58081/"; + Sys.catch_break true; + if Sys.file_exists outfname then begin + let ic = open_in outfname in + CicEnvironment.restore_from_channel ic; + close_in ic + end +let urifname = + try + Sys.argv.(2) + with Invalid_argument _ -> "-" +let ic = + match urifname with + | "-" -> stdin + | fname -> open_in fname +let _ = + try + while true do +(* try *) + let uri = input_line ic in + print_endline uri; + flush stdout; + let uri = UriManager.uri_of_string uri in + ignore (CicTypeChecker.typecheck uri) +(* with Sys.Break -> () *) + done + with End_of_file | Sys.Break -> + let oc = open_out outfname in + CicEnvironment.dump_to_channel oc; + close_out oc + diff --git a/components/binaries/utilities/list_uris.ml b/components/binaries/utilities/list_uris.ml new file mode 100644 index 000000000..90ea51616 --- /dev/null +++ b/components/binaries/utilities/list_uris.ml @@ -0,0 +1,30 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +let ic = open_in Sys.argv.(1) in +CicEnvironment.restore_from_channel ic; +List.iter + (fun uri -> print_endline (UriManager.string_of_uri uri)) + (CicEnvironment.list_uri ()) diff --git a/components/binaries/utilities/parse_library.ml b/components/binaries/utilities/parse_library.ml new file mode 100644 index 000000000..1d65291cb --- /dev/null +++ b/components/binaries/utilities/parse_library.ml @@ -0,0 +1,54 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +let trust = true + +let _ = + CicEnvironment.set_trust (fun _ -> trust); + Helm_registry.set "getter.mode" "remote"; + Helm_registry.set "getter.url" "http://mowgli.cs.unibo.it:58081/" +let urifname = + try + Sys.argv.(1) + with Invalid_argument _ -> "-" +let ic = + match urifname with + | "-" -> stdin + | fname -> open_in fname +let _ = + try + while true do + try + let uri = input_line ic in + prerr_endline uri; + let uri = UriManager.uri_of_string uri in + ignore (CicEnvironment.get_obj CicUniv.empty_ugraph uri) +(* with Sys.Break -> () *) + with + | End_of_file -> raise End_of_file + | exn -> () + done + with End_of_file -> Unix.sleep max_int + diff --git a/components/binaries/utilities/test_library.ml b/components/binaries/utilities/test_library.ml new file mode 100644 index 000000000..98ade3adb --- /dev/null +++ b/components/binaries/utilities/test_library.ml @@ -0,0 +1,153 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +let trust = true +let deadline = 30 +let conffile = "../../../matita/matita.conf.xml" + +let _ = CicEnvironment.set_trust (fun _ -> trust);; +let _ = Helm_registry.load_from conffile;; + +let old_total = ref 0.0 +let new_total = ref 0.0 + +let separator = "=============" + +let perc newt oldt = (newt -. oldt) /. oldt *. 100.0 + +let _ = + Sys.catch_break true; + at_exit + (fun () -> + Printf.printf "%s\n" separator; + Printf.printf "Total: %.2f\n" !new_total; + if !old_total <> 0.0 then + Printf.printf "Old: %.2f (%.2f%%)\n" !old_total (perc !new_total !old_total)) +;; + +let timeout = ref false;; + +let _ = + Sys.set_signal 14 (* SIGALRM *) + (Sys.Signal_handle (fun _ -> + timeout := true; + raise Sys.Break)) +;; + +let urifname = + try + Sys.argv.(1) + with Invalid_argument _ -> + prerr_endline "You must supply a file with the list of URIs to check"; + exit (-1) + +let ic = open_in urifname + +exception Done;; + +let _ = + try + while true do + try + let uri = input_line ic in + if uri = separator then raise End_of_file; + let uri,res,time = + match Str.split (Str.regexp " ") uri with + uri::res::time::_ -> uri, Some res, Some (float_of_string time) + | [uri;res] -> uri, Some res, None + | [ uri ] -> uri, None, None + | _ -> assert false + in + Printf.printf "%s " uri; + flush stdout; + let uri = UriManager.uri_of_string uri in + let obj,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + ignore (Unix.alarm deadline); + CicTypeChecker.typecheck_obj uri obj; + ignore (Unix.alarm 0); + CicEnvironment.remove_obj uri; + let before = Unix.times () in + ignore (Unix.alarm deadline); + ignore (CicTypeChecker.typecheck_obj uri obj); + ignore (Unix.alarm 0); + let memusage = (Gc.stat ()).Gc.live_words * 4 / 1024 / 1024 in + if memusage > 500 then + begin + prerr_endline ("MEMORIA ALLOCATA: " ^ string_of_int memusage ^ "Mb"); + CicEnvironment.empty (); + Gc.compact (); + let memusage = (Gc.stat ()).Gc.live_words * 4 / 1024 / 1024 in + prerr_endline ("DOPO CicEnvironment.empty: " ^ string_of_int memusage ^ "Mb"); + end; + let after = Unix.times () in + let diff = after.Unix.tms_utime +. after.Unix.tms_stime -. before.Unix.tms_utime -. before.Unix.tms_stime in + new_total := !new_total +. diff; + Printf.printf "OK %.2f" diff; + (match time with + None -> Printf.printf "\n" + | Some time -> + old_total := !old_total +. time; + Printf.printf " %.2f%%\n" (perc diff time)) + with + | End_of_file as exn -> raise exn + | Sys.Break -> + let rec skip_break prompt = + try + if prompt then + begin + Printf.printf "SKIPPED\n"; + flush stdout; + if not !timeout then + begin + Printf.eprintf "Continue with next URI? [y/_]"; + flush stderr; + end; + end; + if not !timeout then + (match input_line stdin with + "y" -> () + | _ -> raise Done) + else + timeout := false + with + Sys.Break -> skip_break false + in + skip_break true + | CicEnvironment.CircularDependency _ -> + Printf.printf "CIRCULARDEP\n" + | exn -> + Printf.printf "FAIL\n"; + flush stdout; + prerr_endline + (match exn with + CicTypeChecker.TypeCheckerFailure msg -> + "TypeCheckerFailure: " ^ Lazy.force msg + | CicTypeChecker.AssertFailure msg -> + "TypeCheckerAssertion: " ^ Lazy.force msg + | _ -> Printexc.to_string exn) + done + with + End_of_file + | Done -> () diff --git a/components/binaries/utilities/test_xml_parser.ml b/components/binaries/utilities/test_xml_parser.ml new file mode 100644 index 000000000..e15468f99 --- /dev/null +++ b/components/binaries/utilities/test_xml_parser.ml @@ -0,0 +1,88 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let _ = + Helm_registry.set "getter.mode" "remote"; + Helm_registry.set "getter.url" "http://mowgli.cs.unibo.it:58081/" + +let body_RE = Str.regexp "^.*\\.body$" +let con_RE = Str.regexp "^.*\\.con$" + +let unlink f = + if Sys.file_exists f then + Unix.unlink f + +let rec parse uri tmpfile1 tmpfile2 = +(*prerr_endline (sprintf "%s %s" tmpfile1 (match tmpfile2 with None -> "None" | Some f -> "Some " ^ f));*) + (try + let uri' = UriManager.uri_of_string uri in + let time_new0 = Unix.gettimeofday () in +(* let obj_new = CicPushParser.CicParser.annobj_of_xml tmpfile1 tmpfile2 in*) + let obj_new = CicParser.annobj_of_xml uri' tmpfile1 tmpfile2 in + let time_new1 = Unix.gettimeofday () in + + let time_old0 = Unix.gettimeofday () in + ignore (Unix.system (sprintf "gunzip -c %s > test.tmp && mv test.tmp %s" + tmpfile1 tmpfile1)); + (match tmpfile2 with + | Some tmpfile2 -> + ignore (Unix.system (sprintf "gunzip -c %s > test.tmp && mv test.tmp %s" + tmpfile2 tmpfile2)); + | None -> ()); + let obj_old = CicPxpParser.CicParser.annobj_of_xml uri' tmpfile1 tmpfile2 in + let time_old1 = Unix.gettimeofday () in + + let time_old = time_old1 -. time_old0 in + let time_new = time_new1 -. time_new0 in + let are_equal = (obj_old = obj_new) in + printf "%s\t%b\t%f\t%f\t%f\n" + uri are_equal time_old time_new (time_new /. time_old *. 100.); + flush stdout; + with + | CicParser.Getter_failure ("key_not_found", uri) + when Str.string_match body_RE uri 0 -> + parse uri tmpfile1 None + | CicParser.Parser_failure msg -> + printf "%s FAILED (%s)\n" uri msg; flush stdout) + +let _ = + try + while true do + let uri = input_line stdin in + let tmpfile1 = Http_getter.getxml uri in + let tmpfile2 = + if Str.string_match con_RE uri 0 then begin + Some (Http_getter.getxml (uri ^ ".body")) + end else + None + in + parse uri tmpfile1 tmpfile2 + done + with End_of_file -> () + diff --git a/components/cic/.depend b/components/cic/.depend new file mode 100644 index 000000000..538d4b10d --- /dev/null +++ b/components/cic/.depend @@ -0,0 +1,31 @@ +unshare.cmi: cic.cmo +deannotate.cmi: cic.cmo +cicParser.cmi: cic.cmo +cicUtil.cmi: cic.cmo +helmLibraryObjects.cmi: cic.cmo +libraryObjects.cmi: cic.cmo +discrimination_tree.cmi: cic.cmo +path_indexing.cmi: cic.cmo +cicInspect.cmi: cic.cmo +cic.cmo: cicUniv.cmi +cic.cmx: cicUniv.cmx +unshare.cmo: cic.cmo unshare.cmi +unshare.cmx: cic.cmx unshare.cmi +cicUniv.cmo: cicUniv.cmi +cicUniv.cmx: cicUniv.cmi +deannotate.cmo: cic.cmo deannotate.cmi +deannotate.cmx: cic.cmx deannotate.cmi +cicParser.cmo: deannotate.cmi cicUniv.cmi cic.cmo cicParser.cmi +cicParser.cmx: deannotate.cmx cicUniv.cmx cic.cmx cicParser.cmi +cicUtil.cmo: cicUniv.cmi cic.cmo cicUtil.cmi +cicUtil.cmx: cicUniv.cmx cic.cmx cicUtil.cmi +helmLibraryObjects.cmo: cic.cmo helmLibraryObjects.cmi +helmLibraryObjects.cmx: cic.cmx helmLibraryObjects.cmi +libraryObjects.cmo: cic.cmo libraryObjects.cmi +libraryObjects.cmx: cic.cmx libraryObjects.cmi +discrimination_tree.cmo: cicUtil.cmi cic.cmo discrimination_tree.cmi +discrimination_tree.cmx: cicUtil.cmx cic.cmx discrimination_tree.cmi +path_indexing.cmo: cic.cmo path_indexing.cmi +path_indexing.cmx: cic.cmx path_indexing.cmi +cicInspect.cmo: cic.cmo cicInspect.cmi +cicInspect.cmx: cic.cmx cicInspect.cmi diff --git a/components/cic/.depend.opt b/components/cic/.depend.opt new file mode 100644 index 000000000..c1e2b0beb --- /dev/null +++ b/components/cic/.depend.opt @@ -0,0 +1,31 @@ +unshare.cmi: cic.cmx +deannotate.cmi: cic.cmx +cicParser.cmi: cic.cmx +cicUtil.cmi: cic.cmx +helmLibraryObjects.cmi: cic.cmx +libraryObjects.cmi: cic.cmx +discrimination_tree.cmi: cic.cmx +path_indexing.cmi: cic.cmx +cicInspect.cmi: cic.cmx +cic.cmo: cicUniv.cmi +cic.cmx: cicUniv.cmx +unshare.cmo: cic.cmx unshare.cmi +unshare.cmx: cic.cmx unshare.cmi +cicUniv.cmo: cicUniv.cmi +cicUniv.cmx: cicUniv.cmi +deannotate.cmo: cic.cmx deannotate.cmi +deannotate.cmx: cic.cmx deannotate.cmi +cicParser.cmo: deannotate.cmi cicUniv.cmi cic.cmx cicParser.cmi +cicParser.cmx: deannotate.cmx cicUniv.cmx cic.cmx cicParser.cmi +cicUtil.cmo: cicUniv.cmi cic.cmx cicUtil.cmi +cicUtil.cmx: cicUniv.cmx cic.cmx cicUtil.cmi +helmLibraryObjects.cmo: cic.cmx helmLibraryObjects.cmi +helmLibraryObjects.cmx: cic.cmx helmLibraryObjects.cmi +libraryObjects.cmo: cic.cmx libraryObjects.cmi +libraryObjects.cmx: cic.cmx libraryObjects.cmi +discrimination_tree.cmo: cicUtil.cmi cic.cmx discrimination_tree.cmi +discrimination_tree.cmx: cicUtil.cmx cic.cmx discrimination_tree.cmi +path_indexing.cmo: cic.cmx path_indexing.cmi +path_indexing.cmx: cic.cmx path_indexing.cmi +cicInspect.cmo: cic.cmx cicInspect.cmi +cicInspect.cmx: cic.cmx cicInspect.cmi diff --git a/components/cic/Makefile b/components/cic/Makefile new file mode 100644 index 000000000..67979211b --- /dev/null +++ b/components/cic/Makefile @@ -0,0 +1,21 @@ +PACKAGE = cic +PREDICATES = + +INTERFACE_FILES = \ + unshare.mli \ + cicUniv.mli \ + deannotate.mli \ + cicParser.mli \ + cicUtil.mli \ + helmLibraryObjects.mli \ + libraryObjects.mli \ + discrimination_tree.mli \ + path_indexing.mli \ + cicInspect.mli +IMPLEMENTATION_FILES = \ + cic.ml $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = cic.ml cic.cmi +EXTRA_OBJECTS_TO_CLEAN = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/cic/cic.ml b/components/cic/cic.ml new file mode 100644 index 000000000..1b02df3f1 --- /dev/null +++ b/components/cic/cic.ml @@ -0,0 +1,244 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*****************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 29/11/2000 *) +(* *) +(* This module defines the internal representation of the objects (variables,*) +(* blocks of (co)inductive definitions and constants) and the terms of cic *) +(* *) +(*****************************************************************************) + +(* $Id$ *) + +(* STUFF TO MANAGE IDENTIFIERS *) +type id = string (* the abstract type of the (annotated) node identifiers *) +type 'term explicit_named_substitution = (UriManager.uri * 'term) list + +type implicit_annotation = [ `Closed | `Type | `Hole ] + +(* INTERNAL REPRESENTATION OF CIC OBJECTS AND TERMS *) + +type sort = + Prop + | Set + | Type of CicUniv.universe + | CProp + +type name = + | Name of string + | Anonymous + +type object_flavour = + [ `Definition + | `MutualDefinition + | `Fact + | `Lemma + | `Remark + | `Theorem + | `Variant + | `Axiom + ] + +type object_class = + [ `Coercion of int + | `Elim of sort (** elimination principle; if sort is Type, the universe is + * not relevant *) + | `Record of (string * bool * int) list (** + inductive type that encodes a record; the arguments are + the record fields names and if they are coercions and + then the coercion arity *) + | `Projection (** record projection *) + | `InversionPrinciple (** inversion principle *) + ] + +type attribute = + [ `Class of object_class + | `Flavour of object_flavour + | `Generated + ] + +type term = + Rel of int (* DeBrujin index, 1 based*) + | Var of UriManager.uri * (* uri, *) + term explicit_named_substitution (* explicit named subst. *) + | Meta of int * (term option) list (* numeric id, *) + (* local context *) + | Sort of sort (* sort *) + | Implicit of implicit_annotation option (* *) + | Cast of term * term (* value, type *) + | Prod of name * term * term (* binder, source, target *) + | Lambda of name * term * term (* binder, source, target *) + | LetIn of name * term * term (* binder, term, target *) + | Appl of term list (* arguments *) + | Const of UriManager.uri * (* uri, *) + term explicit_named_substitution (* explicit named subst. *) + | MutInd of UriManager.uri * int * (* uri, typeno, *) + term explicit_named_substitution (* explicit named subst. *) + (* typeno is 0 based *) + | MutConstruct of UriManager.uri * (* uri, *) + int * int * (* typeno, consno *) + term explicit_named_substitution (* explicit named subst. *) + (* typeno is 0 based *) + (* consno is 1 based *) + | MutCase of UriManager.uri * (* ind. uri, *) + int * (* ind. typeno, *) + term * term * (* outtype, ind. term *) + term list (* patterns *) + | Fix of int * inductiveFun list (* funno (0 based), funs *) + | CoFix of int * coInductiveFun list (* funno (0 based), funs *) +and obj = + Constant of string * term option * term * (* id, body, type, *) + UriManager.uri list * attribute list (* parameters *) + | Variable of string * term option * term * (* name, body, type *) + UriManager.uri list * attribute list (* parameters *) + | CurrentProof of string * metasenv * term * (* name, conjectures, body, *) + term * UriManager.uri list * attribute list (* type, parameters *) + | InductiveDefinition of inductiveType list * (* inductive types, *) + UriManager.uri list * int * attribute list (* params, left params no *) +and inductiveType = + string * bool * term * (* typename, inductive, arity *) + constructor list (* constructors *) +and constructor = + string * term (* id, type *) +and inductiveFun = + string * int * term * term (* name, ind. index, type, body *) +and coInductiveFun = + string * term * term (* name, type, body *) + +(* a metasenv is a list of declarations of metas in declarations *) +(* order (i.e. [oldest ; ... ; newest]). Older variables can not *) +(* depend on new ones. *) +and conjecture = int * context * term +and metasenv = conjecture list +and substitution = (int * (context * term * term)) list + + + +(* a metasenv is a list of declarations of metas in declarations *) +(* order (i.e. [oldest ; ... ; newest]). Older variables can not *) +(* depend on new ones. *) +and annconjecture = id * int * anncontext * annterm +and annmetasenv = annconjecture list + +and annterm = + ARel of id * id * int * (* idref, DeBrujin index, *) + string (* binder *) + | AVar of id * UriManager.uri * (* uri, *) + annterm explicit_named_substitution (* explicit named subst. *) + | AMeta of id * int * (annterm option) list (* numeric id, *) + (* local context *) + | ASort of id * sort (* sort *) + | AImplicit of id * implicit_annotation option (* *) + | ACast of id * annterm * annterm (* value, type *) + | AProd of id * name * annterm * annterm (* binder, source, target *) + | ALambda of id * name * annterm * annterm (* binder, source, target *) + | ALetIn of id * name * annterm * annterm (* binder, term, target *) + | AAppl of id * annterm list (* arguments *) + | AConst of id * UriManager.uri * (* uri, *) + annterm explicit_named_substitution (* explicit named subst. *) + | AMutInd of id * UriManager.uri * int * (* uri, typeno *) + annterm explicit_named_substitution (* explicit named subst. *) + (* typeno is 0 based *) + | AMutConstruct of id * UriManager.uri * (* uri, *) + int * int * (* typeno, consno *) + annterm explicit_named_substitution (* explicit named subst. *) + (* typeno is 0 based *) + (* consno is 1 based *) + | AMutCase of id * UriManager.uri * (* ind. uri, *) + int * (* ind. typeno, *) + annterm * annterm * (* outtype, ind. term *) + annterm list (* patterns *) + | AFix of id * int * anninductiveFun list (* funno, functions *) + | ACoFix of id * int * anncoInductiveFun list (* funno, functions *) +and annobj = + AConstant of id * id option * string * (* name, *) + annterm option * annterm * (* body, type, *) + UriManager.uri list * attribute list (* parameters *) + | AVariable of id * + string * annterm option * annterm * (* name, body, type *) + UriManager.uri list * attribute list (* parameters *) + | ACurrentProof of id * id * + string * annmetasenv * (* name, conjectures, *) + annterm * annterm * UriManager.uri list * (* body,type,parameters *) + attribute list + | AInductiveDefinition of id * + anninductiveType list * (* inductive types , *) + UriManager.uri list * int * attribute list (* parameters,n ind. pars*) +and anninductiveType = + id * string * bool * annterm * (* typename, inductive, arity *) + annconstructor list (* constructors *) +and annconstructor = + string * annterm (* id, type *) +and anninductiveFun = + id * string * int * annterm * annterm (* name, ind. index, type, body *) +and anncoInductiveFun = + id * string * annterm * annterm (* name, type, body *) +and annotation = + string + +and context_entry = (* A declaration or definition *) + Decl of term + | Def of term * term option (* body, type (if known) *) + +and hypothesis = + (name * context_entry) option (* None means no more accessible *) + +and context = hypothesis list + +and anncontext_entry = (* A declaration or definition *) + ADecl of annterm + | ADef of annterm + +and annhypothesis = + id * (name * anncontext_entry) option (* None means no more accessible *) + +and anncontext = annhypothesis list +;; + +type lazy_term = + context -> metasenv -> CicUniv.universe_graph -> + term * metasenv * CicUniv.universe_graph + +type anntarget = + Object of annobj (* if annobj is a Constant, this is its type *) + | ConstantBody of annobj + | Term of annterm + | Conjecture of annconjecture + | Hypothesis of annhypothesis + +module CicHash = + Hashtbl.Make + (struct + type t = term + let equal = (==) + let hash = Hashtbl.hash_param 100 1000 + end) +;; + diff --git a/components/cic/cicInspect.ml b/components/cic/cicInspect.ml new file mode 100644 index 000000000..a1e94e247 --- /dev/null +++ b/components/cic/cicInspect.ml @@ -0,0 +1,143 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module UM = UriManager +module C = Cic + +module Int = struct + type t = int + let compare = compare +end +module S = Set.Make (Int) + +let overlaps s1 s2 = + let predicate x = S.mem x s1 in + S.exists predicate s2 + +let get_rels_from_premise h t = + let rec aux d g = function + | C.Sort _ + | C.Implicit _ -> g + | C.Rel i -> + if i < d then g else fun a -> g (S.add (i - d + h + 1) a) + | C.Appl ss -> List.fold_left (aux d) g ss + | C.Const (_, ss) + | C.MutInd (_, _, ss) + | C.MutConstruct (_, _, _, ss) + | C.Var (_, ss) -> + let map g (_, t) = aux d g t in + List.fold_left map g ss + | C.Meta (_, ss) -> + let map g = function + | None -> g + | Some t -> aux d g t + in + List.fold_left map g ss + | C.Cast (t1, t2) -> aux d (aux d g t2) t1 + | C.LetIn (_, t1, t2) + | C.Lambda (_, t1, t2) + | C.Prod (_, t1, t2) -> aux d (aux (succ d) g t2) t1 + | C.MutCase (_, _, t1, t2, ss) -> + aux d (aux d (List.fold_left (aux d) g ss) t2) t1 + | C.Fix (_, ss) -> + let k = List.length ss in + let map g (_, _, t1, t2) = aux d (aux (d + k) g t2) t1 in + List.fold_left map g ss + | C.CoFix (_, ss) -> + let k = List.length ss in + let map g (_, t1, t2) = aux d (aux (d + k) g t2) t1 in + List.fold_left map g ss + in + let g a = a in + aux 1 g t S.empty + +let get_mutinds_of_uri u t = + let rec aux g = function + | C.Sort _ + | C.Implicit _ + | C.Rel _ -> g + | C.Appl ss -> List.fold_left aux g ss + | C.Const (_, ss) + | C.MutConstruct (_, _, _, ss) + | C.Var (_, ss) -> + let map g (_, t) = aux g t in + List.fold_left map g ss + | C.MutInd (uri, tyno, ss) -> + let map g (_, t) = aux g t in + let g = List.fold_left map g ss in + if UM.eq u uri then fun a -> g (S.add tyno a) else g + | C.Meta (_, ss) -> + let map g = function + | None -> g + | Some t -> aux g t + in + List.fold_left map g ss + | C.Cast (t1, t2) -> aux (aux g t2) t1 + | C.LetIn (_, t1, t2) + | C.Lambda (_, t1, t2) + | C.Prod (_, t1, t2) -> aux (aux g t2) t1 + | C.MutCase (_, _, t1, t2, ss) -> + aux (aux (List.fold_left aux g ss) t2) t1 + | C.Fix (_, ss) -> + let map g (_, _, t1, t2) = aux (aux g t2) t1 in + List.fold_left map g ss + | C.CoFix (_, ss) -> + let map g (_, t1, t2) = aux (aux g t2) t1 in + List.fold_left map g ss + in + let g a = a in + aux g t S.empty + +let rec aux n = function + | C.Sort _ + | C.Implicit _ + | C.Rel _ -> succ n + | C.Appl ts -> List.fold_left aux (succ n) ts + | C.Const (_, ss) + | C.MutConstruct (_, _, _, ss) + | C.MutInd (_, _, ss) + | C.Var (_, ss) -> + let map n (_, t) = aux n t in + List.fold_left map (succ n) ss + | C.Meta (_, ss) -> + let map n = function + | None -> n + | Some t -> aux n t + in + List.fold_left map (succ n) ss + | C.Cast (t1, t2) + | C.LetIn (_, t1, t2) + | C.Lambda (_, t1, t2) + | C.Prod (_, t1, t2) -> aux (aux (succ n) t2) t1 + | C.MutCase (_, _, t1, t2, ss) -> + aux (aux (List.fold_left aux (succ n) ss) t2) t1 + | C.Fix (_, ss) -> + let map n (_, _, t1, t2) = aux (aux n t2) t1 in + List.fold_left map (succ n) ss + | C.CoFix (_, ss) -> + let map n (_, t1, t2) = aux (aux n t2) t1 in + List.fold_left map (succ n) ss + +let count_nodes = aux diff --git a/components/cic/cicInspect.mli b/components/cic/cicInspect.mli new file mode 100644 index 000000000..e7ee2ed8d --- /dev/null +++ b/components/cic/cicInspect.mli @@ -0,0 +1,35 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module S: Set.S with type elt = int + +val overlaps: S.t -> S.t -> bool + +val get_rels_from_premise: int -> Cic.term -> S.t + +val get_mutinds_of_uri: UriManager.uri -> Cic.term -> S.t + +(* count_nodes n t returns n + the number of nodes in t *) +val count_nodes: int -> Cic.term -> int diff --git a/components/cic/cicParser.ml b/components/cic/cicParser.ml new file mode 100644 index 000000000..8334ccfb6 --- /dev/null +++ b/components/cic/cicParser.ml @@ -0,0 +1,797 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) + +open Printf + +(* ZACK TODO element from the DTD still to be handled: + + + + + + + +*) + +exception Getter_failure of string * string +exception Parser_failure of string + +type stack_entry = + | Arg of string * Cic.annterm (* relative uri, term *) + (* constants' body and types resides in differne files, thus we can't simple + * keep constants in Cic_obj stack entries *) + | Cic_attributes of Cic.attribute list + | Cic_constant_body of string * string * UriManager.uri list * Cic.annterm + * Cic.attribute list + (* id, for, params, body, object attributes *) + | Cic_constant_type of string * string * UriManager.uri list * Cic.annterm + * Cic.attribute list + (* id, name, params, type, object attributes *) + | Cic_term of Cic.annterm (* term *) + | Cic_obj of Cic.annobj (* object *) + | Cofix_fun of Cic.id * string * Cic.annterm * Cic.annterm + (* id, name, type, body *) + | Constructor of string * Cic.annterm (* name, type *) + | Decl of Cic.id * Cic.name * Cic.annterm (* id, binder, source *) + | Def of Cic.id * Cic.name * Cic.annterm (* id, binder, source *) + | Fix_fun of Cic.id * string * int * Cic.annterm * Cic.annterm + (* id, name, ind. index, type, body *) + | Inductive_type of string * string * bool * Cic.annterm * + (string * Cic.annterm) list (* id, name, inductive, arity, constructors *) + | Meta_subst of Cic.annterm option + | Obj_class of Cic.object_class + | Obj_flavour of Cic.object_flavour + | Obj_field of string (* field name *) + | Obj_generated + | Tag of string * (string * string) list (* tag name, attributes *) + (* ZACK TODO add file position to tag stack entry so that when attribute + * errors occur, the position of their _start_tag_ could be printed + * instead of the current position (usually the end tag) *) + +type ctxt = { + mutable stack: stack_entry list; + mutable xml_parser: XmlPushParser.xml_parser option; + mutable filename: string; + uri: UriManager.uri; +} + +let string_of_stack ctxt = + "[" ^ (String.concat "; " + (List.map + (function + | Arg (reluri, _) -> sprintf "Arg %s" reluri + | Cic_attributes _ -> "Cic_attributes" + | Cic_constant_body (id, name, _, _, _) -> + sprintf "Cic_constant_body %s (id=%s)" name id + | Cic_constant_type (id, name, _, _, _) -> + sprintf "Cic_constant_type %s (id=%s)" name id + | Cic_term _ -> "Cic_term" + | Cic_obj _ -> "Cic_obj" + | Constructor (name, _) -> "Constructor " ^ name + | Cofix_fun (id, _, _, _) -> sprintf "Cofix_fun (id=%s)" id + | Decl (id, _, _) -> sprintf "Decl (id=%s)" id + | Def (id, _, _) -> sprintf "Def (id=%s)" id + | Fix_fun (id, _, _, _, _) -> sprintf "Fix_fun (id=%s)" id + | Inductive_type (id, name, _, _, _) -> + sprintf "Inductive_type %s (id=%s)" name id + | Meta_subst _ -> "Meta_subst" + | Obj_class _ -> "Obj_class" + | Obj_flavour _ -> "Obj_flavour" + | Obj_field name -> "Obj_field " ^ name + | Obj_generated -> "Obj_generated" + | Tag (tag, _) -> "Tag " ^ tag) + ctxt.stack)) ^ "]" + +let compare_attrs (a1, v1) (a2, v2) = Pervasives.compare a1 a2 +let sort_attrs = List.sort compare_attrs + +let new_parser_context uri = { + stack = []; + xml_parser = None; + filename = "-"; + uri = uri; +} + +let get_parser ctxt = + match ctxt.xml_parser with + | Some p -> p + | None -> assert false + +(** {2 Error handling} *) + +let parse_error ctxt msg = + let (line, col) = XmlPushParser.get_position (get_parser ctxt) in + raise (Parser_failure (sprintf "[%s: line %d, column %d] %s" + ctxt.filename line col msg)) + +let attribute_error ctxt tag = + parse_error ctxt ("wrong attribute set for " ^ tag) + +(** {2 Parsing context management} *) + +let pop ctxt = +(* debug_print (lazy "pop");*) + match ctxt.stack with + | hd :: tl -> (ctxt.stack <- tl) + | _ -> assert false + +let push ctxt v = +(* debug_print (lazy "push");*) + ctxt.stack <- v :: ctxt.stack + +let set_top ctxt v = +(* debug_print (lazy "set_top");*) + match ctxt.stack with + | _ :: tl -> (ctxt.stack <- v :: tl) + | _ -> assert false + + (** pop the last tag from the open tags stack returning a pair *) +let pop_tag ctxt = + match ctxt.stack with + | Tag (tag, attrs) :: tl -> + ctxt.stack <- tl; + (tag, attrs) + | _ -> parse_error ctxt "unexpected extra content" + + (** pop the last tag from the open tags stack returning its attributes. + * Attributes are returned as a list of pair _sorted_ by + * attribute name *) +let pop_tag_attrs ctxt = sort_attrs (snd (pop_tag ctxt)) + +let pop_cics ctxt = + let rec aux acc stack = + match stack with + | Cic_term t :: tl -> aux (t :: acc) tl + | tl -> acc, tl + in + let values, new_stack = aux [] ctxt.stack in + ctxt.stack <- new_stack; + values + +let pop_class_modifiers ctxt = + let rec aux acc stack = + match stack with + | (Cic_term (Cic.ASort _) as m) :: tl + | (Obj_field _ as m) :: tl -> + aux (m :: acc) tl + | tl -> acc, tl + in + let values, new_stack = aux [] ctxt.stack in + ctxt.stack <- new_stack; + values + +let pop_meta_substs ctxt = + let rec aux acc stack = + match stack with + | Meta_subst t :: tl -> aux (t :: acc) tl + | tl -> acc, tl + in + let values, new_stack = aux [] ctxt.stack in + ctxt.stack <- new_stack; + values + +let pop_fix_funs ctxt = + let rec aux acc stack = + match stack with + | Fix_fun (id, name, index, typ, body) :: tl -> + aux ((id, name, index, typ, body) :: acc) tl + | tl -> acc, tl + in + let values, new_stack = aux [] ctxt.stack in + ctxt.stack <- new_stack; + values + +let pop_cofix_funs ctxt = + let rec aux acc stack = + match stack with + | Cofix_fun (id, name, typ, body) :: tl -> + aux ((id, name, typ, body) :: acc) tl + | tl -> acc, tl + in + let values, new_stack = aux [] ctxt.stack in + ctxt.stack <- new_stack; + values + +let pop_constructors ctxt = + let rec aux acc stack = + match stack with + | Constructor (name, t) :: tl -> aux ((name, t) :: acc) tl + | tl -> acc, tl + in + let values, new_stack = aux [] ctxt.stack in + ctxt.stack <- new_stack; + values + +let pop_inductive_types ctxt = + let rec aux acc stack = + match stack with + | Inductive_type (id, name, ind, arity, ctors) :: tl -> + aux ((id, name, ind, arity, ctors) :: acc) tl + | tl -> acc, tl + in + let values, new_stack = aux [] ctxt.stack in + if values = [] then + parse_error ctxt "no \"InductiveType\" element found"; + ctxt.stack <- new_stack; + values + + (** travels the stack (without popping) for the first term subject of explicit + * named substitution and return its URI *) +let find_base_uri ctxt = + let rec aux = function + | Cic_term (Cic.AConst (_, uri, _)) :: _ + | Cic_term (Cic.AMutInd (_, uri, _, _)) :: _ + | Cic_term (Cic.AMutConstruct (_, uri, _, _, _)) :: _ + | Cic_term (Cic.AVar (_, uri, _)) :: _ -> + uri + | Arg _ :: tl -> aux tl + | _ -> parse_error ctxt "no \"arg\" element found" + in + UriManager.buri_of_uri (aux ctxt.stack) + + (** backwardly eats the stack building an explicit named substitution from Arg + * stack entries *) +let pop_subst ctxt base_uri = + let rec aux acc stack = + match stack with + | Arg (rel_uri, term) :: tl -> + let uri = UriManager.uri_of_string (base_uri ^ "/" ^ rel_uri) in + aux ((uri, term) :: acc) tl + | tl -> acc, tl + in + let subst, new_stack = aux [] ctxt.stack in + if subst = [] then + parse_error ctxt "no \"arg\" element found"; + ctxt.stack <- new_stack; + subst + +let pop_cic ctxt = + match ctxt.stack with + | Cic_term t :: tl -> + ctxt.stack <- tl; + t + | _ -> parse_error ctxt "no cic term found" + +let pop_obj_attributes ctxt = + match ctxt.stack with + | Cic_attributes attributes :: tl -> + ctxt.stack <- tl; + attributes + | _ -> [] + +(** {2 Auxiliary functions} *) + +let uri_of_string = UriManager.uri_of_string + +let uri_list_of_string = + let space_RE = Str.regexp " " in + fun s -> + List.map uri_of_string (Str.split space_RE s) + +let sort_of_string ctxt = function + | "Prop" -> Cic.Prop + | "Set" -> Cic.Set + | "CProp" -> Cic.CProp + (* THIS CASE IS HERE ONLY TO ALLOW THE PARSING OF COQ LIBRARY + * THIS SHOULD BE REMOVED AS SOON AS univ_maker OR COQ'S EXPORTATION + * IS FIXED *) + | "Type" -> Cic.Type (CicUniv.fresh ~uri:ctxt.uri ()) + | s -> + let len = String.length s in + if not(len > 5) then parse_error ctxt "sort expected"; + if not(String.sub s 0 5 = "Type:") then parse_error ctxt "sort expected"; + try + Cic.Type + (CicUniv.fresh + ~uri:ctxt.uri + ~id:(int_of_string (String.sub s 5 (len - 5))) ()) + with + | Failure "int_of_string" + | Invalid_argument _ -> parse_error ctxt "sort expected" + +let patch_subst ctxt subst = function + | Cic.AConst (id, uri, _) -> Cic.AConst (id, uri, subst) + | Cic.AMutInd (id, uri, typeno, _) -> + Cic.AMutInd (id, uri, typeno, subst) + | Cic.AMutConstruct (id, uri, typeno, consno, _) -> + Cic.AMutConstruct (id, uri, typeno, consno, subst) + | Cic.AVar (id, uri, _) -> Cic.AVar (id, uri, subst) + | _ -> + parse_error ctxt + ("only \"CONST\", \"VAR\", \"MUTIND\", and \"MUTCONSTRUCT\" can be" ^ + " instantiated") + + (** backwardly eats the stack seeking for the first open tag carrying + * "helm:exception" attributes. If found return Some of a pair containing + * exception name and argument. Return None otherwise *) +let find_helm_exception ctxt = + let rec aux = function + | [] -> None + | Tag (_, attrs) :: tl -> + (try + let exn = List.assoc "helm:exception" attrs in + let arg = + try List.assoc "helm:exception_arg" attrs with Not_found -> "" + in + Some (exn, arg) + with Not_found -> aux tl) + | _ :: tl -> aux tl + in + aux ctxt.stack + +(** {2 Push parser callbacks} + * each callback needs to be instantiated to a parsing context *) + +let start_element ctxt tag attrs = +(* debug_print (lazy (sprintf "<%s%s>" tag (match attrs with | [] -> "" | _ -> " " ^ String.concat " " (List.map (fun (a,v) -> sprintf "%s=\"%s\"" a v) attrs))));*) + push ctxt (Tag (tag, attrs)) + +let end_element ctxt tag = +(* debug_print (lazy (sprintf "" tag));*) +(* debug_print (lazy (string_of_stack ctxt));*) + let attribute_error () = attribute_error ctxt tag in + let parse_error = parse_error ctxt in + let sort_of_string = sort_of_string ctxt in + match tag with + | "REL" -> + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["binder", binder; "id", id; "idref", idref; "value", value] + | ["binder", binder; "id", id; "idref", idref; "sort", _; + "value", value] -> + Cic.ARel (id, idref, int_of_string value, binder) + | _ -> attribute_error ())) + | "VAR" -> + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id; "uri", uri] + | ["id", id; "sort", _; "uri", uri] -> + Cic.AVar (id, uri_of_string uri, []) + | _ -> attribute_error ())) + | "CONST" -> + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id; "uri", uri] + | ["id", id; "sort", _; "uri", uri] -> + Cic.AConst (id, uri_of_string uri, []) + | _ -> attribute_error ())) + | "SORT" -> + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id; "value", sort] -> Cic.ASort (id, sort_of_string sort) + | _ -> attribute_error ())) + | "APPLY" -> + let args = pop_cics ctxt in + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id ] + | ["id", id; "sort", _] -> Cic.AAppl (id, args) + | _ -> attribute_error ())) + | "decl" -> + let source = pop_cic ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["binder", binder; "id", id ] + | ["binder", binder; "id", id; "type", _] -> + Decl (id, Cic.Name binder, source) + | ["id", id] + | ["id", id; "type", _] -> Decl (id, Cic.Anonymous, source) + | _ -> attribute_error ()) + | "def" -> (* same as "decl" above *) + let source = pop_cic ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["binder", binder; "id", id] + | ["binder", binder; "id", id; "sort", _] -> + Def (id, Cic.Name binder, source) + | ["id", id] + | ["id", id; "sort", _] -> Def (id, Cic.Anonymous, source) + | _ -> attribute_error ()) + | "arity" (* transparent elements (i.e. which contain a CIC) *) + | "body" + | "inductiveTerm" + | "pattern" + | "patternsType" + | "target" + | "term" + | "type" -> + let term = pop_cic ctxt in + pop ctxt; (* pops start tag matching current end tag (e.g. ) *) + push ctxt (Cic_term term) + | "substitution" -> (* optional transparent elements (i.e. which _may_ + * contain a CIC) *) + set_top ctxt (* replace *) + (match ctxt.stack with + | Cic_term term :: tl -> + ctxt.stack <- tl; + (Meta_subst (Some term)) + | _ -> Meta_subst None) + | "PROD" -> + let target = pop_cic ctxt in + let rec add_decl target = function + | Decl (id, binder, source) :: tl -> + add_decl (Cic.AProd (id, binder, source, target)) tl + | tl -> + ctxt.stack <- tl; + target + in + let term = add_decl target ctxt.stack in + (match pop_tag_attrs ctxt with + [] + | ["type", _] -> () + | _ -> attribute_error ()); + push ctxt (Cic_term term) + | "LAMBDA" -> + let target = pop_cic ctxt in + let rec add_decl target = function + | Decl (id, binder, source) :: tl -> + add_decl (Cic.ALambda (id, binder, source, target)) tl + | tl -> + ctxt.stack <- tl; + target + in + let term = add_decl target ctxt.stack in + (match pop_tag_attrs ctxt with + [] + | ["sort", _] -> () + | _ -> attribute_error ()); + push ctxt (Cic_term term) + | "LETIN" -> + let target = pop_cic ctxt in + let rec add_def target = function + | Def (id, binder, source) :: tl -> + add_def (Cic.ALetIn (id, binder, source, target)) tl + | tl -> + ctxt.stack <- tl; + target + in + let term = add_def target ctxt.stack in + (match pop_tag_attrs ctxt with + [] + | ["sort", _] -> () + | _ -> attribute_error ()); + push ctxt (Cic_term term) + | "CAST" -> + let typ = pop_cic ctxt in + let term = pop_cic ctxt in + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + ["id", id] + | ["id", id; "sort", _] -> Cic.ACast (id, term, typ) + | _ -> attribute_error ())); + | "IMPLICIT" -> + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id] -> Cic.AImplicit (id, None) + | ["annotation", annotation; "id", id] -> + let implicit_annotation = + match annotation with + | "closed" -> `Closed + | "hole" -> `Hole + | "type" -> `Type + | _ -> parse_error "invalid value for \"annotation\" attribute" + in + Cic.AImplicit (id, Some implicit_annotation) + | _ -> attribute_error ())) + | "META" -> + let meta_substs = pop_meta_substs ctxt in + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id; "no", no] + | ["id", id; "no", no; "sort", _] -> + Cic.AMeta (id, int_of_string no, meta_substs) + | _ -> attribute_error ())); + | "MUTIND" -> + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id; "noType", noType; "uri", uri] -> + Cic.AMutInd (id, uri_of_string uri, int_of_string noType, []) + | _ -> attribute_error ())); + | "MUTCONSTRUCT" -> + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id; "noConstr", noConstr; "noType", noType; "uri", uri] + | ["id", id; "noConstr", noConstr; "noType", noType; "sort", _; + "uri", uri] -> + Cic.AMutConstruct (id, uri_of_string uri, int_of_string noType, + int_of_string noConstr, []) + | _ -> attribute_error ())); + | "FixFunction" -> + let body = pop_cic ctxt in + let typ = pop_cic ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["id", id; "name", name; "recIndex", recIndex] -> + Fix_fun (id, name, int_of_string recIndex, typ, body) + | _ -> attribute_error ()) + | "CofixFunction" -> + let body = pop_cic ctxt in + let typ = pop_cic ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["id", id; "name", name] -> + Cofix_fun (id, name, typ, body) + | _ -> attribute_error ()) + | "FIX" -> + let fix_funs = pop_fix_funs ctxt in + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id; "noFun", noFun] + | ["id", id; "noFun", noFun; "sort", _] -> + Cic.AFix (id, int_of_string noFun, fix_funs) + | _ -> attribute_error ())) + | "COFIX" -> + let cofix_funs = pop_cofix_funs ctxt in + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id; "noFun", noFun] + | ["id", id; "noFun", noFun; "sort", _] -> + Cic.ACoFix (id, int_of_string noFun, cofix_funs) + | _ -> attribute_error ())) + | "MUTCASE" -> + (match pop_cics ctxt with + | patternsType :: inductiveTerm :: patterns -> + push ctxt (Cic_term + (match pop_tag_attrs ctxt with + | ["id", id; "noType", noType; "uriType", uriType] + | ["id", id; "noType", noType; "sort", _; "uriType", uriType] -> + Cic.AMutCase (id, uri_of_string uriType, int_of_string noType, + patternsType, inductiveTerm, patterns) + | _ -> attribute_error ())) + | _ -> parse_error "invalid \"MUTCASE\" content") + | "Constructor" -> + let typ = pop_cic ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["name", name] -> Constructor (name, typ) + | _ -> attribute_error ()) + | "InductiveType" -> + let constructors = pop_constructors ctxt in + let arity = pop_cic ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["id", id; "inductive", inductive; "name", name] -> + Inductive_type (id, name, bool_of_string inductive, arity, + constructors) + | _ -> attribute_error ()) + | "InductiveDefinition" -> + let inductive_types = pop_inductive_types ctxt in + let obj_attributes = pop_obj_attributes ctxt in + push ctxt (Cic_obj + (match pop_tag_attrs ctxt with + | ["id", id; "noParams", noParams; "params", params] -> + Cic.AInductiveDefinition (id, inductive_types, + uri_list_of_string params, int_of_string noParams, obj_attributes) + | _ -> attribute_error ())) + | "ConstantType" -> + let typ = pop_cic ctxt in + let obj_attributes = pop_obj_attributes ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["id", id; "name", name; "params", params] -> + Cic_constant_type (id, name, uri_list_of_string params, typ, + obj_attributes) + | _ -> attribute_error ()) + | "ConstantBody" -> + let body = pop_cic ctxt in + let obj_attributes = pop_obj_attributes ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["for", for_; "id", id; "params", params] -> + Cic_constant_body (id, for_, uri_list_of_string params, body, + obj_attributes) + | _ -> attribute_error ()) + | "Variable" -> + let typ = pop_cic ctxt in + let body = + match pop_cics ctxt with + | [] -> None + | [t] -> Some t + | _ -> parse_error "wrong content for \"Variable\"" + in + let obj_attributes = pop_obj_attributes ctxt in + push ctxt (Cic_obj + (match pop_tag_attrs ctxt with + | ["id", id; "name", name; "params", params] -> + Cic.AVariable (id, name, body, typ, uri_list_of_string params, + obj_attributes) + | _ -> attribute_error ())) + | "arg" -> + let term = pop_cic ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["relUri", relUri] -> Arg (relUri, term) + | _ -> attribute_error ()) + | "instantiate" -> + (* explicit named substitution handling: when the end tag of an element + * subject of exlicit named subst (MUTIND, MUTCONSTRUCT, CONST, VAR) it + * is stored on the stack with no substitutions (i.e. []). When the end + * tag of an "instantiate" element is found we patch the term currently + * on the stack with the substitution built from "instantiate" children + *) + (* XXX inefficiency here: first travels the elements in order to + * find the baseUri, then in order to build the explicit named subst *) + let base_uri = find_base_uri ctxt in + let subst = pop_subst ctxt base_uri in + let term = pop_cic ctxt in + (* comment from CicParser3.ml: + * CSC: the "id" optional attribute should be parsed and reflected in + * Cic.annterm and id = string_of_xml_attr (n#attribute "id") *) + (* replace *) + set_top ctxt (Cic_term (patch_subst ctxt subst term)) + | "attributes" -> + let rec aux acc = function (* retrieve object attributes *) + | Obj_class c :: tl -> aux (`Class c :: acc) tl + | Obj_flavour f :: tl -> aux (`Flavour f :: acc) tl + | Obj_generated :: tl -> aux (`Generated :: acc) tl + | tl -> acc, tl + in + let obj_attrs, new_stack = aux [] ctxt.stack in + ctxt.stack <- new_stack; + set_top ctxt (Cic_attributes obj_attrs) + | "generated" -> set_top ctxt Obj_generated + | "field" -> + push ctxt + (match pop_tag_attrs ctxt with + | ["name", name] -> Obj_field name + | _ -> attribute_error ()) + | "flavour" -> + push ctxt + (match pop_tag_attrs ctxt with + | [ "value", "definition"] -> Obj_flavour `Definition + | [ "value", "mutual_definition"] -> Obj_flavour `MutualDefinition + | [ "value", "fact"] -> Obj_flavour `Fact + | [ "value", "lemma"] -> Obj_flavour `Lemma + | [ "value", "remark"] -> Obj_flavour `Remark + | [ "value", "theorem"] -> Obj_flavour `Theorem + | [ "value", "variant"] -> Obj_flavour `Variant + | [ "value", "axiom"] -> Obj_flavour `Axiom + | _ -> attribute_error ()) + | "class" -> + let class_modifiers = pop_class_modifiers ctxt in + push ctxt + (match pop_tag_attrs ctxt with + | ["value", "coercion"] -> Obj_class (`Coercion 0) + | ("value", "coercion")::["arity",n] + | ("arity",n)::["value", "coercion"] -> + let arity = try int_of_string n with Failure _ -> + parse_error "\"arity\" must be an integer" + in + Obj_class (`Coercion arity) + | ["value", "elim"] -> + (match class_modifiers with + | [Cic_term (Cic.ASort (_, sort))] -> Obj_class (`Elim sort) + | _ -> + parse_error + "unexpected extra content for \"elim\" object class") + | ["value", "record"] -> + let fields = + List.map + (function + | Obj_field name -> + (match Str.split (Str.regexp " ") name with + | [name] -> name, false, 0 + | [name;"coercion"] -> name,true,0 + | [name;"coercion"; n] -> + let n = + try int_of_string n + with Failure _ -> + parse_error "int expected after \"coercion\"" + in + name,true,n + | _ -> + parse_error + "wrong \"field\"'s name attribute") + | _ -> + parse_error + "unexpected extra content for \"record\" object class") + class_modifiers + in + Obj_class (`Record fields) + | ["value", "projection"] -> Obj_class `Projection + | ["value", "inversion"] -> Obj_class `InversionPrinciple + | _ -> attribute_error ()) + | tag -> + match find_helm_exception ctxt with + | Some (exn, arg) -> raise (Getter_failure (exn, arg)) + | None -> parse_error (sprintf "unknown element \"%s\"" tag) + +(** {2 Parser internals} *) + +let has_gz_suffix fname = + try + let idx = String.rindex fname '.' in + let suffix = String.sub fname idx (String.length fname - idx) in + suffix = ".gz" + with Not_found -> false + +let parse uri filename = + let ctxt = new_parser_context uri in + ctxt.filename <- filename; + let module P = XmlPushParser in + let callbacks = { + P.default_callbacks with + P.start_element = Some (start_element ctxt); + P.end_element = Some (end_element ctxt); + } in + let xml_parser = P.create_parser callbacks in + ctxt.xml_parser <- Some xml_parser; + try + (try + let xml_source = + if has_gz_suffix filename then `Gzip_file filename + else `File filename + in + P.parse xml_parser xml_source + with exn -> + ctxt.xml_parser <- None; + (* ZACK: the above "<- None" is vital for garbage collection. Without it + * we keep in memory a circular structure parser -> callbacks -> ctxt -> + * parser. I don't know if the ocaml garbage collector is supposed to + * collect such structures, but for sure the expat bindings will (orribly) + * leak when used in conjunction with such structures *) + raise exn); + ctxt.xml_parser <- None; (* ZACK: same comment as above *) +(* debug_print (lazy (string_of_stack stack));*) + (* assert (List.length ctxt.stack = 1) *) + List.hd ctxt.stack + with + | Failure "int_of_string" -> parse_error ctxt "integer number expected" + | Invalid_argument "bool_of_string" -> parse_error ctxt "boolean expected" + | P.Parse_error msg -> parse_error ctxt ("parse error: " ^ msg) + | Sys.Break + | Parser_failure _ + | Getter_failure _ as exn -> + raise exn + | exn -> + raise (Parser_failure ("CicParser: uncaught exception: " ^ Printexc.to_string exn)) + +(** {2 API implementation} *) + +let annobj_of_xml uri filename filenamebody = + match filenamebody with + | None -> + (match parse uri filename with + | Cic_constant_type (id, name, params, typ, obj_attributes) -> + Cic.AConstant (id, None, name, None, typ, params, obj_attributes) + | Cic_obj obj -> obj + | _ -> raise (Parser_failure ("no object found in " ^ filename))) + | Some filenamebody -> + (match parse uri filename, parse uri filenamebody with + | Cic_constant_type (type_id, name, params, typ, obj_attributes), + Cic_constant_body (body_id, _, _, body, _) -> + Cic.AConstant (type_id, Some body_id, name, Some body, typ, params,obj_attributes) + | _ -> + raise (Parser_failure (sprintf "no constant found in %s, %s" + filename filenamebody))) + +let obj_of_xml uri filename filenamebody = + Deannotate.deannotate_obj (annobj_of_xml uri filename filenamebody) diff --git a/components/cic/cicParser.mli b/components/cic/cicParser.mli new file mode 100644 index 000000000..9472b4c54 --- /dev/null +++ b/components/cic/cicParser.mli @@ -0,0 +1,46 @@ +(* Copyright (C) 2000-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + + (** raised for exception received by the getter (i.e. embedded in the source + * XML document). Arguments are values of "helm:exception" and + * "helm:exception_arg" attributes *) +exception Getter_failure of string * string + + (** generic parser failure *) +exception Parser_failure of string + + (* given the filename of an xml file of a cic object, it returns + * its internal annotated representation. In the case of constants (whose + * type is splitted from the body), a second xml file (for the body) must be + * provided. + * Both files are assumed to be gzipped. *) +val annobj_of_xml: UriManager.uri -> string -> string option -> Cic.annobj + + (* given the filename of an xml file of a cic object, it returns its internal + * logical representation. In the case of constants (whose type is splitted + * from the body), a second xml file (for the body) must be provided. + * Both files are assumed to be gzipped. *) +val obj_of_xml : UriManager.uri -> string -> string option -> Cic.obj + diff --git a/components/cic/cicUniv.ml b/components/cic/cicUniv.ml new file mode 100644 index 000000000..9bd7b9e74 --- /dev/null +++ b/components/cic/cicUniv.ml @@ -0,0 +1,1011 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*****************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Enrico Tassi *) +(* 23/04/2004 *) +(* *) +(* This module implements the aciclic graph of universes. *) +(* *) +(*****************************************************************************) + +(* $Id$ *) + +(*****************************************************************************) +(** switch implementation **) +(*****************************************************************************) + +let fast_implementation = ref true ;; + +(*****************************************************************************) +(** open **) +(*****************************************************************************) + +open Printf + +(*****************************************************************************) +(** Types and default values **) +(*****************************************************************************) + +type universe = int * UriManager.uri option + +module UniverseType = struct + type t = universe + let compare = Pervasives.compare +end + +module SOF = Set.Make(UniverseType) + +type entry = { + eq_closure : SOF.t; + ge_closure : SOF.t; + gt_closure : SOF.t; + in_gegt_of : SOF.t; + one_s_eq : SOF.t; + one_s_ge : SOF.t; + one_s_gt : SOF.t; +} + +module MAL = Map.Make(UniverseType) + +type arc_type = GE | GT | EQ + +type bag = entry MAL.t + +let empty_entry = { + eq_closure=SOF.empty; + ge_closure=SOF.empty; + gt_closure=SOF.empty; + in_gegt_of=SOF.empty; + one_s_eq=SOF.empty; + one_s_ge=SOF.empty; + one_s_gt=SOF.empty; +} +let empty_bag = MAL.empty + +let are_set_eq s1 s2 = + SOF.equal s1 s2 + +let are_entry_eq v1 v2 = + (are_set_eq v1.gt_closure v2.gt_closure ) && + (are_set_eq v1.ge_closure v2.ge_closure ) && + (are_set_eq v1.eq_closure v2.eq_closure ) && + (*(are_set_eq v1.in_gegt_of v2.in_gegt_of ) &&*) + (are_set_eq v1.one_s_ge v2.one_s_ge ) && + (are_set_eq v1.one_s_gt v2.one_s_gt ) && + (are_set_eq v1.one_s_eq v2.one_s_eq ) + +let are_ugraph_eq = MAL.equal are_entry_eq + +(*****************************************************************************) +(** Pretty printings **) +(*****************************************************************************) + +let string_of_universe (i,u) = + match u with + Some u -> + "(" ^ ((string_of_int i) ^ "," ^ (UriManager.string_of_uri u) ^ ")") + | None -> "(" ^ (string_of_int i) ^ ",None)" + +let string_of_universe_set l = + SOF.fold (fun x s -> s ^ (string_of_universe x) ^ " ") l "" + +let string_of_node n = + "{"^ + "eq_c: " ^ (string_of_universe_set n.eq_closure) ^ "; " ^ + "ge_c: " ^ (string_of_universe_set n.ge_closure) ^ "; " ^ + "gt_c: " ^ (string_of_universe_set n.gt_closure) ^ "; " ^ + "i_gegt: " ^ (string_of_universe_set n.in_gegt_of) ^ "}\n" + +let string_of_arc (a,u,v) = + (string_of_universe u) ^ " " ^ a ^ " " ^ (string_of_universe v) + +let string_of_mal m = + let rc = ref "" in + MAL.iter (fun k v -> + rc := !rc ^ sprintf "%s --> %s" (string_of_universe k) + (string_of_node v)) m; + !rc + +let string_of_bag b = + string_of_mal b + +(*****************************************************************************) +(** Benchmarking **) +(*****************************************************************************) +let time_spent = ref 0.0;; +let partial = ref 0.0 ;; + +let reset_spent_time () = time_spent := 0.0;; +let get_spent_time () = !time_spent ;; +let begin_spending () = () + (*assert (!partial = 0.0);*) +(* partial := Unix.gettimeofday () *) +;; + +let end_spending () = () +(* + assert (!partial > 0.0); + let interval = (Unix.gettimeofday ()) -. !partial in + partial := 0.0; + time_spent := !time_spent +. interval +*) +;; + + +(*****************************************************************************) +(** Helpers **) +(*****************************************************************************) + +(* find the repr *) +let repr u m = + try + MAL.find u m + with + Not_found -> empty_entry + +(* FIXME: May be faster if we make it by hand *) +let merge_closures f nodes m = + SOF.fold (fun x i -> SOF.union (f (repr x m)) i ) nodes SOF.empty + + +(*****************************************************************************) +(** _fats implementation **) +(*****************************************************************************) + +let rec closure_of_fast ru m = + let eq_c = closure_eq_fast ru m in + let ge_c = closure_ge_fast ru m in + let gt_c = closure_gt_fast ru m in + { + eq_closure = eq_c; + ge_closure = ge_c; + gt_closure = gt_c; + in_gegt_of = ru.in_gegt_of; + one_s_eq = ru.one_s_eq; + one_s_ge = ru.one_s_ge; + one_s_gt = ru.one_s_gt + } + +and closure_eq_fast ru m = + let eq_c = + let j = ru.one_s_eq in + let _Uj = merge_closures (fun x -> x.eq_closure) j m in + let one_step_eq = ru.one_s_eq in + (SOF.union one_step_eq _Uj) + in + eq_c + +and closure_ge_fast ru m = + let ge_c = + let j = SOF.union ru.one_s_ge (SOF.union ru.one_s_gt ru.one_s_eq) in + let _Uj = merge_closures (fun x -> x.ge_closure) j m in + let _Ux = j in + (SOF.union _Uj _Ux) + in + ge_c + +and closure_gt_fast ru m = + let gt_c = + let j = ru.one_s_gt in + let k = ru.one_s_ge in + let l = ru.one_s_eq in + let _Uj = merge_closures (fun x -> x.ge_closure) j m in + let _Uk = merge_closures (fun x -> x.gt_closure) k m in + let _Ul = merge_closures (fun x -> x.gt_closure) l m in + let one_step_gt = ru.one_s_gt in + (SOF.union (SOF.union (SOF.union _Ul one_step_gt) _Uk) _Uj) + in + gt_c + +and print_rec_status u ru = + print_endline ("Aggiusto " ^ (string_of_universe u) ^ + "e ottengo questa chiusura\n " ^ (string_of_node ru)) + +and adjust_fast u m = + let ru = repr u m in + let gt_c = closure_gt_fast ru m in + let ge_c = closure_ge_fast ru m in + let eq_c = closure_eq_fast ru m in + let changed_eq = not (are_set_eq eq_c ru.eq_closure) in + let changed_gegt = + (not (are_set_eq gt_c ru.gt_closure)) || + (not (are_set_eq ge_c ru.ge_closure)) + in + if ((not changed_gegt) && (not changed_eq)) then + m + else + begin + let ru' = { + eq_closure = eq_c; + ge_closure = ge_c; + gt_closure = gt_c; + in_gegt_of = ru.in_gegt_of; + one_s_eq = ru.one_s_eq; + one_s_ge = ru.one_s_ge; + one_s_gt = ru.one_s_gt} + in + let m = MAL.add u ru' m in + let m = + SOF.fold (fun x m -> adjust_fast x m) + (SOF.union ru'.eq_closure ru'.in_gegt_of) m + (* TESI: + ru'.in_gegt_of m + *) + in + m (*adjust_fast u m*) + end + +and add_gt_arc_fast u v m = + let ru = repr u m in + let ru' = {ru with one_s_gt = SOF.add v ru.one_s_gt} in + let m' = MAL.add u ru' m in + let rv = repr v m' in + let rv' = {rv with in_gegt_of = SOF.add u rv.in_gegt_of} in + let m'' = MAL.add v rv' m' in + adjust_fast u m'' + +and add_ge_arc_fast u v m = + let ru = repr u m in + let ru' = { ru with one_s_ge = SOF.add v ru.one_s_ge} in + let m' = MAL.add u ru' m in + let rv = repr v m' in + let rv' = {rv with in_gegt_of = SOF.add u rv.in_gegt_of} in + let m'' = MAL.add v rv' m' in + adjust_fast u m'' + +and add_eq_arc_fast u v m = + let ru = repr u m in + let rv = repr v m in + let ru' = {ru with one_s_eq = SOF.add v ru.one_s_eq} in + (*TESI: let ru' = {ru' with in_gegt_of = SOF.add v ru.in_gegt_of} in *) + let m' = MAL.add u ru' m in + let rv' = {rv with one_s_eq = SOF.add u rv.one_s_eq} in + (*TESI: let rv' = {rv' with in_gegt_of = SOF.add u rv.in_gegt_of} in *) + let m'' = MAL.add v rv' m' in + adjust_fast v (*(adjust_fast u*) m'' (* ) *) +;; + + +(*****************************************************************************) +(** safe implementation **) +(*****************************************************************************) + +let closure_of u m = + let ru = repr u m in + let eq_c = + let j = ru.one_s_eq in + let _Uj = merge_closures (fun x -> x.eq_closure) j m in + let one_step_eq = ru.one_s_eq in + (SOF.union one_step_eq _Uj) + in + let ge_c = + let j = SOF.union ru.one_s_ge (SOF.union ru.one_s_gt ru.one_s_eq) in + let _Uj = merge_closures (fun x -> x.ge_closure) j m in + let _Ux = j in + (SOF.union _Uj _Ux) + in + let gt_c = + let j = ru.one_s_gt in + let k = ru.one_s_ge in + let l = ru.one_s_eq in + let _Uj = merge_closures (fun x -> x.ge_closure) j m in + let _Uk = merge_closures (fun x -> x.gt_closure) k m in + let _Ul = merge_closures (fun x -> x.gt_closure) l m in + let one_step_gt = ru.one_s_gt in + (SOF.union (SOF.union (SOF.union _Ul one_step_gt) _Uk) _Uj) + in + { + eq_closure = eq_c; + ge_closure = ge_c; + gt_closure = gt_c; + in_gegt_of = ru.in_gegt_of; + one_s_eq = ru.one_s_eq; + one_s_ge = ru.one_s_ge; + one_s_gt = ru.one_s_gt + } + +let rec simple_adjust m = + let m' = + MAL.mapi (fun x _ -> closure_of x m) m + in + if not (are_ugraph_eq m m') then( + simple_adjust m') + else + m' + +let add_eq_arc u v m = + let ru = repr u m in + let rv = repr v m in + let ru' = {ru with one_s_eq = SOF.add v ru.one_s_eq} in + let m' = MAL.add u ru' m in + let rv' = {rv with one_s_eq = SOF.add u rv.one_s_eq} in + let m'' = MAL.add v rv' m' in + simple_adjust m'' + +let add_ge_arc u v m = + let ru = repr u m in + let ru' = { ru with one_s_ge = SOF.add v ru.one_s_ge} in + let m' = MAL.add u ru' m in + simple_adjust m' + +let add_gt_arc u v m = + let ru = repr u m in + let ru' = {ru with one_s_gt = SOF.add v ru.one_s_gt} in + let m' = MAL.add u ru' m in + simple_adjust m' + + +(*****************************************************************************) +(** Outhern interface, that chooses between _fast and safe **) +(*****************************************************************************) + +(* + given the 2 nodes plus the current bag, adds the arc, recomputes the + closures and returns the new map +*) +let add_eq fast u v b = + if fast then + add_eq_arc_fast u v b + else + add_eq_arc u v b + +(* + given the 2 nodes plus the current bag, adds the arc, recomputes the + closures and returns the new map +*) +let add_ge fast u v b = + if fast then + add_ge_arc_fast u v b + else + add_ge_arc u v b +(* + given the 2 nodes plus the current bag, adds the arc, recomputes the + closures and returns the new map +*) +let add_gt fast u v b = + if fast then + add_gt_arc_fast u v b + else + add_gt_arc u v b + + +(*****************************************************************************) +(** Other real code **) +(*****************************************************************************) + +exception UniverseInconsistency of string Lazy.t + +let error arc node1 closure_type node2 closure = + let s = + lazy + ("\n ===== Universe Inconsistency detected =====\n\n" ^ + " Unable to add\n" ^ + "\t" ^ (string_of_arc arc) ^ "\n" ^ + " cause\n" ^ + "\t" ^ (string_of_universe node1) ^ "\n" ^ + " is in the " ^ closure_type ^ " closure\n" ^ + "\t{" ^ (string_of_universe_set closure) ^ "}\n" ^ + " of\n" ^ + "\t" ^ (string_of_universe node2) ^ "\n\n" ^ + " ===== Universe Inconsistency detected =====\n") in + prerr_endline (Lazy.force s); + raise (UniverseInconsistency s) + + +let fill_empty_nodes_with_uri (g, already_contained,o) l uri = + let fill_empty_universe u = + match u with + (i,None) -> (i,Some uri) + | (i,Some _) as u -> u + in + let fill_empty_set s = + SOF.fold (fun e s -> SOF.add (fill_empty_universe e) s) s SOF.empty + in + let fill_empty_entry e = { + eq_closure = (fill_empty_set e.eq_closure) ; + ge_closure = (fill_empty_set e.ge_closure) ; + gt_closure = (fill_empty_set e.gt_closure) ; + in_gegt_of = (fill_empty_set e.in_gegt_of) ; + one_s_eq = (fill_empty_set e.one_s_eq) ; + one_s_ge = (fill_empty_set e.one_s_ge) ; + one_s_gt = (fill_empty_set e.one_s_gt) ; + } in + let m = g in + let m' = MAL.fold ( + fun k v m -> + MAL.add (fill_empty_universe k) (fill_empty_entry v) m) m MAL.empty + in + let l' = List.map fill_empty_universe l in + (m', already_contained,o),l' + + +(*****************************************************************************) +(** World interface **) +(*****************************************************************************) + +type universe_graph = bag * UriManager.UriSet.t * bool +(* the graph , the cache of already merged ugraphs, oblivion? *) + +let empty_ugraph = empty_bag, UriManager.UriSet.empty, false +let oblivion_ugraph = empty_bag, UriManager.UriSet.empty, true + +let current_index_anon = ref (-1) +let current_index_named = ref (-1) + +let restart_numbering () = current_index_named := (-1) + +let fresh ?uri ?id () = + let i = + match uri,id with + | None,None -> + current_index_anon := !current_index_anon + 1; + !current_index_anon + | None, Some _ -> assert false + | Some _, None -> + current_index_named := !current_index_named + 1; + !current_index_named + | Some _, Some id -> id + in + (i,uri) + +let name_universe u uri = + match u with + | (i, None) -> (i, Some uri) + | _ -> u + +let print_ugraph (g, _, o) = + if o then prerr_endline "oblivion universe" else + prerr_endline (string_of_bag g) + +let add_eq ?(fast=(!fast_implementation)) u v b = + (* should we check to no add twice the same?? *) + let m = b in + let ru = repr u m in + if SOF.mem v ru.gt_closure then + error ("EQ",u,v) v "GT" u ru.gt_closure + else + begin + let rv = repr v m in + if SOF.mem u rv.gt_closure then + error ("EQ",u,v) u "GT" v rv.gt_closure + else + add_eq fast u v b + end + +let add_ge ?(fast=(!fast_implementation)) u v b = + (* should we check to no add twice the same?? *) + let m = b in + let rv = repr v m in + if SOF.mem u rv.gt_closure then + error ("GE",u,v) u "GT" v rv.gt_closure + else + add_ge fast u v b + +let add_gt ?(fast=(!fast_implementation)) u v b = + (* should we check to no add twice the same?? *) + (* + FIXME : check the thesis... no need to check GT and EQ closure since the + GE is a superset of both + *) + let m = b in + let rv = repr v m in + + if u = v then + error ("GT",u,v) u "==" v SOF.empty + else + + (*if SOF.mem u rv.gt_closure then + error ("GT",u,v) u "GT" v rv.gt_closure + else + begin*) + if SOF.mem u rv.ge_closure then + error ("GT",u,v) u "GE" v rv.ge_closure + else +(* begin + if SOF.mem u rv.eq_closure then + error ("GT",u,v) u "EQ" v rv.eq_closure + else*) + add_gt fast u v b +(* end + end*) + +(*****************************************************************************) +(** START: Decomment this for performance comparisons **) +(*****************************************************************************) + +let add_eq ?(fast=(!fast_implementation)) u v (b,already_contained,oblivion) = + if oblivion then (b,already_contained,oblivion) else + (*prerr_endline "add_eq";*) + (begin_spending (); + let rc = add_eq ~fast u v b in + end_spending (); + rc,already_contained,false) + +let add_ge ?(fast=(!fast_implementation)) u v (b,already_contained,oblivion) = + if oblivion then (b,already_contained,oblivion) else +(* prerr_endline "add_ge"; *) + (begin_spending (); + let rc = add_ge ~fast u v b in + end_spending (); + rc,already_contained,false) + +let add_gt ?(fast=(!fast_implementation)) u v (b,already_contained,oblivion) = + if oblivion then (b,already_contained,oblivion) else +(* prerr_endline "add_gt"; *) + (begin_spending (); + let rc = add_gt ~fast u v b in + end_spending (); + rc,already_contained,false) + +(* profiling code +let profiler_eq = HExtlib.profile "CicUniv.add_eq" +let profiler_ge = HExtlib.profile "CicUniv.add_ge" +let profiler_gt = HExtlib.profile "CicUniv.add_gt" +let add_gt ?fast u v b = + profiler_gt.HExtlib.profile (fun _ -> add_gt ?fast u v b) () +let add_ge ?fast u v b = + profiler_ge.HExtlib.profile (fun _ -> add_ge ?fast u v b) () +let add_eq ?fast u v b = + profiler_eq.HExtlib.profile (fun _ -> add_eq ?fast u v b) () +*) + +(*****************************************************************************) +(** END: Decomment this for performance comparisons **) +(*****************************************************************************) + +(* TODO: uncomment l to gain a small speedup *) +let merge_ugraphs ~base_ugraph ~increment:(increment, uri_of_increment(*,l*)) = + let merge_brutal (u,a,_) v = +(* prerr_endline ("merging graph: "^UriManager.string_of_uri + * uri_of_increment); *) + let m1 = u in + let m2 = v in + MAL.fold ( + fun k v x -> + (SOF.fold ( + fun u x -> + let m = add_gt k u x in m) + (SOF.union v.one_s_gt v.gt_closure) + (SOF.fold ( + fun u x -> + let m = add_ge k u x in m) + (SOF.union v.one_s_ge v.ge_closure) + (SOF.fold ( + fun u x -> + let m = add_eq k u x in m) + (SOF.union v.one_s_eq v.eq_closure) x))) + ) m1 m2 + in + let base, already_contained, oblivion = base_ugraph in + let inc,_,oblivion2 = increment in + if oblivion then + base_ugraph + else if oblivion2 then + increment + else if MAL.is_empty base then + increment + else if + MAL.is_empty inc || + UriManager.UriSet.mem uri_of_increment already_contained + then + base_ugraph + else + (fun (x,_,_) -> x) (merge_brutal increment base_ugraph), +(* + List.fold_right UriManager.UriSet.add + (List.map (fun (_,x) -> HExtlib.unopt x) l) +*) + (UriManager.UriSet.add uri_of_increment already_contained), false + +(* profiling code; WARNING: the time spent during profiling can be + greater than the profiled time +let profiler_merge = HExtlib.profile "CicUniv.merge_ugraphs" +let merge_ugraphs ~base_ugraph ~increment = + profiler_merge.HExtlib.profile + (fun _ -> merge_ugraphs ~base_ugraph ~increment) () +*) + +(*****************************************************************************) +(** Xml sesialization and parsing **) +(*****************************************************************************) + +let xml_of_universe name u = + match u with + | (i,Some u) -> + Xml.xml_empty name [ + None,"id",(string_of_int i) ; + None,"uri",(UriManager.string_of_uri u)] + | (_,None) -> + raise (Failure "we can serialize only universes with uri") + +let xml_of_set s = + let l = + List.map (xml_of_universe "node") (SOF.elements s) + in + List.fold_left (fun s x -> [< s ; x >] ) [<>] l + +let xml_of_entry_content e = + let stream_of_field f name = + let eq_c = xml_of_set f in + if eq_c != [<>] then + Xml.xml_nempty name [] eq_c + else + [<>] + in + [< + (stream_of_field e.eq_closure "eq_closure"); + (stream_of_field e.gt_closure "gt_closure"); + (stream_of_field e.ge_closure "ge_closure"); + (stream_of_field e.in_gegt_of "in_gegt_of"); + (stream_of_field e.one_s_eq "one_s_eq"); + (stream_of_field e.one_s_gt "one_s_gt"); + (stream_of_field e.one_s_ge "one_s_ge") + >] + +let xml_of_entry u e = + let (i,u') = u in + let u'' = + match u' with + Some x -> x + | None -> + raise (Failure "we can serialize only universes (entry) with uri") + in + let ent = Xml.xml_nempty "entry" [ + None,"id",(string_of_int i) ; + None,"uri",(UriManager.string_of_uri u'')] in + let content = xml_of_entry_content e in + ent content + +let write_xml_of_ugraph filename (m,_,_) l = + let tokens = + [< + Xml.xml_cdata "\n"; + Xml.xml_nempty "ugraph" [] + ([< (MAL.fold ( fun k v s -> [< s ; (xml_of_entry k v) >]) m [<>]) ; + (List.fold_left + (fun s u -> [< s ; xml_of_universe "owned_node" u >]) [<>] l) >])>] + in + Xml.pp ~gzip:true tokens (Some filename) + +let univno = fst + + +let rec clean_ugraph m already_contained f = + let m' = + MAL.fold (fun k v x -> if (f k) then MAL.add k v x else x ) m MAL.empty in + let m'' = MAL.fold (fun k v x -> + let v' = { + eq_closure = SOF.filter f v.eq_closure; + ge_closure = SOF.filter f v.ge_closure; + gt_closure = SOF.filter f v.gt_closure; + in_gegt_of = SOF.filter f v.in_gegt_of; + one_s_eq = SOF.filter f v.one_s_eq; + one_s_ge = SOF.filter f v.one_s_ge; + one_s_gt = SOF.filter f v.one_s_gt + } in + MAL.add k v' x ) m' MAL.empty in + let e_l = + MAL.fold (fun k v l -> if v = empty_entry && not(f k) then + begin + k::l end else l) m'' [] + in + if e_l != [] then + clean_ugraph + m'' already_contained (fun u -> (f u) && not (List.mem u e_l)) + else + MAL.fold + (fun k v x -> if v <> empty_entry then MAL.add k v x else x) + m'' MAL.empty, + already_contained + +let clean_ugraph (m,a,o) l = + assert(not o); + let m, a = clean_ugraph m a (fun u -> List.mem u l) in + m, a, o + +let assigner_of = + function + "ge_closure" -> (fun e u->{e with ge_closure=SOF.add u e.ge_closure}) + | "gt_closure" -> (fun e u->{e with gt_closure=SOF.add u e.gt_closure}) + | "eq_closure" -> (fun e u->{e with eq_closure=SOF.add u e.eq_closure}) + | "in_gegt_of" -> (fun e u->{e with in_gegt_of =SOF.add u e.in_gegt_of}) + | "one_s_ge" -> (fun e u->{e with one_s_ge =SOF.add u e.one_s_ge}) + | "one_s_gt" -> (fun e u->{e with one_s_gt =SOF.add u e.one_s_gt}) + | "one_s_eq" -> (fun e u->{e with one_s_eq =SOF.add u e.one_s_eq}) + | s -> raise (Failure ("unsupported tag " ^ s)) +;; + +let cb_factory m l = + let module XPP = XmlPushParser in + let current_node = ref (0,None) in + let current_entry = ref empty_entry in + let current_assign = ref (assigner_of "in_gegt_of") in + { XPP.default_callbacks with + XPP.end_element = Some( fun name -> + match name with + | "entry" -> + m := MAL.add !current_node !current_entry !m; + current_entry := empty_entry + | _ -> () + ); + XPP.start_element = Some( fun name attlist -> + match name with + | "ugraph" -> () + | "entry" -> + let id = List.assoc "id" attlist in + let uri = List.assoc "uri" attlist in + current_node := (int_of_string id,Some (UriManager.uri_of_string uri)) + | "node" -> + let id = int_of_string (List.assoc "id" attlist) in + let uri = List.assoc "uri" attlist in + current_entry := !current_assign !current_entry + (id,Some (UriManager.uri_of_string uri)) + | "owned_node" -> + let id = int_of_string (List.assoc "id" attlist) in + let uri = List.assoc "uri" attlist in + l := (id,Some (UriManager.uri_of_string uri)) :: !l + | s -> current_assign := assigner_of s + ) + } +;; + +let ugraph_and_univlist_of_xml filename = + let module XPP = XmlPushParser in + let result_map = ref MAL.empty in + let result_list = ref [] in + let cb = cb_factory result_map result_list in + let xml_parser = XPP.create_parser cb in + let xml_source = `Gzip_file filename in + (try XPP.parse xml_parser xml_source + with (XPP.Parse_error err) as exn -> raise exn); + (!result_map,UriManager.UriSet.empty,false), !result_list + + +(*****************************************************************************) +(** the main, only for testing **) +(*****************************************************************************) + +(* + +type arc = Ge | Gt | Eq ;; + +let randomize_actionlist n m = + let ge_percent = 0.7 in + let gt_percent = 0.15 in + let random_step () = + let node1 = Random.int m in + let node2 = Random.int m in + let op = + let r = Random.float 1.0 in + if r < ge_percent then + Ge + else (if r < (ge_percent +. gt_percent) then + Gt + else + Eq) + in + op,node1,node2 + in + let rec aux n = + match n with + 0 -> [] + | n -> (random_step ())::(aux (n-1)) + in + aux n + +let print_action_list l = + let string_of_step (op,node1,node2) = + (match op with + Ge -> "Ge" + | Gt -> "Gt" + | Eq -> "Eq") ^ + "," ^ (string_of_int node1) ^ "," ^ (string_of_int node2) + in + let rec aux l = + match l with + [] -> "]" + | a::tl -> + ";" ^ (string_of_step a) ^ (aux tl) + in + let body = aux l in + let l_body = (String.length body) - 1 in + prerr_endline ("[" ^ (String.sub body 1 l_body)) + +let debug = false +let d_print_endline = if debug then print_endline else ignore +let d_print_ugraph = if debug then print_ugraph else ignore + +let _ = + (if Array.length Sys.argv < 2 then + prerr_endline ("Usage " ^ Sys.argv.(0) ^ " max_edges max_nodes")); + Random.self_init (); + let max_edges = int_of_string Sys.argv.(1) in + let max_nodes = int_of_string Sys.argv.(2) in + let action_listR = randomize_actionlist max_edges max_nodes in + + let action_list = [Ge,1,4;Ge,2,6;Ge,1,1;Eq,6,4;Gt,6,3] in + let action_list = action_listR in + + print_action_list action_list; + let prform_step ?(fast=false) (t,u,v) g = + let f,str = + match t with + Ge -> add_ge,">=" + | Gt -> add_gt,">" + | Eq -> add_eq,"=" + in + d_print_endline ( + "Aggiungo " ^ + (string_of_int u) ^ + " " ^ str ^ " " ^ + (string_of_int v)); + let g' = f ~fast (u,None) (v,None) g in + (*print_ugraph g' ;*) + g' + in + let fail = ref false in + let time1 = Unix.gettimeofday () in + let n_safe = ref 0 in + let g_safe = + try + d_print_endline "SAFE"; + List.fold_left ( + fun g e -> + n_safe := !n_safe + 1; + prform_step e g + ) empty_ugraph action_list + with + UniverseInconsistency s -> fail:=true;empty_bag + in + let time2 = Unix.gettimeofday () in + d_print_ugraph g_safe; + let time3 = Unix.gettimeofday () in + let n_test = ref 0 in + let g_test = + try + d_print_endline "FAST"; + List.fold_left ( + fun g e -> + n_test := !n_test + 1; + prform_step ~fast:true e g + ) empty_ugraph action_list + with + UniverseInconsistency s -> empty_bag + in + let time4 = Unix.gettimeofday () in + d_print_ugraph g_test; + if are_ugraph_eq g_safe g_test && !n_test = !n_safe then + begin + let num_eq = + List.fold_left ( + fun s (e,_,_) -> + if e = Eq then s+1 else s + ) 0 action_list + in + let num_gt = + List.fold_left ( + fun s (e,_,_) -> + if e = Gt then s+1 else s + ) 0 action_list + in + let num_ge = max_edges - num_gt - num_eq in + let time_fast = (time4 -. time3) in + let time_safe = (time2 -. time1) in + let gap = ((time_safe -. time_fast) *. 100.0) /. time_safe in + let fail = if !fail then 1 else 0 in + print_endline + (sprintf + "OK %d safe %1.4f fast %1.4f %% %1.2f #eq %d #gt %d #ge %d %d" + fail time_safe time_fast gap num_eq num_gt num_ge !n_safe); + exit 0 + end + else + begin + print_endline "FAIL"; + print_ugraph g_safe; + print_ugraph g_test; + exit 1 + end +;; + + *) + +let recons_univ u = + match u with + | i, None -> u + | i, Some uri -> + i, Some (UriManager.uri_of_string (UriManager.string_of_uri uri)) + +let recons_entry entry = + let recons_set set = + SOF.fold (fun univ set -> SOF.add (recons_univ univ) set) set SOF.empty + in + { + eq_closure = recons_set entry.eq_closure; + ge_closure = recons_set entry.ge_closure; + gt_closure = recons_set entry.gt_closure; + in_gegt_of = recons_set entry.in_gegt_of; + one_s_eq = recons_set entry.one_s_eq; + one_s_ge = recons_set entry.one_s_ge; + one_s_gt = recons_set entry.one_s_gt; + } + +let recons_graph (graph,uriset,o) = + MAL.fold + (fun universe entry map -> + MAL.add (recons_univ universe) (recons_entry entry) map) + graph + MAL.empty, + UriManager.UriSet.fold + (fun u acc -> + UriManager.UriSet.add + (UriManager.uri_of_string (UriManager.string_of_uri u)) acc) + uriset UriManager.UriSet.empty, o + +let assert_univ u = + match u with + | (_,None) -> + raise (UniverseInconsistency (lazy "This universe graph has a hole")) + | _ -> () + +let assert_univs_have_uri (graph,_,_) univlist = + let assert_set s = + SOF.iter (fun u -> assert_univ u) s + in + let assert_entry e = + assert_set e.eq_closure; + assert_set e.ge_closure; + assert_set e.gt_closure; + assert_set e.in_gegt_of; + assert_set e.one_s_eq; + assert_set e.one_s_ge; + assert_set e.one_s_gt; + in + MAL.iter (fun k v -> assert_univ k; assert_entry v)graph; + List.iter assert_univ univlist + +let eq u1 u2 = + match u1,u2 with + | (id1, Some uri1),(id2, Some uri2) -> + id1 = id2 && UriManager.eq uri1 uri2 + | (id1, None),(id2, None) -> id1 = id2 + | _ -> false + +let compare (id1, uri1) (id2, uri2) = + let cmp = id1 - id2 in + if cmp = 0 then + match uri1,uri2 with + | None, None -> 0 + | Some _, None -> 1 + | None, Some _ -> ~-1 + | Some uri1, Some uri2 -> UriManager.compare uri1 uri2 + else + cmp + +(* EOF *) diff --git a/components/cic/cicUniv.mli b/components/cic/cicUniv.mli new file mode 100644 index 000000000..7a4331905 --- /dev/null +++ b/components/cic/cicUniv.mli @@ -0,0 +1,157 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + +(* + The strings contains an unreadable message +*) +exception UniverseInconsistency of string Lazy.t + +(* + Cic.Type of universe +*) +type universe + +(* + Opaque data structure you will use to store constraints +*) +type universe_graph + +(* + returns a fresh universe +*) +val fresh: + ?uri:UriManager.uri -> + ?id:int -> + unit -> + universe + + (* names a universe if unnamed *) +val name_universe: universe -> UriManager.uri -> universe + +(* + really useful at the begin and in all the functions that don't care + of universes +*) +val empty_ugraph: universe_graph + +(* an universe that does nothing: i.e. no constraints are kept, no merges.. *) +val oblivion_ugraph: universe_graph + +(* + These are the real functions to add eq/ge/gt constraints + to the passed graph, returning an updated graph or raising + UniverseInconsistency +*) +val add_eq: + ?fast:bool -> universe -> universe -> universe_graph -> universe_graph +val add_ge: + ?fast:bool -> universe -> universe -> universe_graph -> universe_graph +val add_gt: + ?fast:bool -> universe -> universe -> universe_graph -> universe_graph + +(* + debug function to print the graph to standard error +*) +val print_ugraph: + universe_graph -> unit + +(* + does what expected, but I don't remember why this was exported +*) +val string_of_universe: + universe -> string + +(* + given the list of visible universes (see universes_of_obj) returns a + cleaned graph (cleaned from the not visible nodes) +*) +val clean_ugraph: + universe_graph -> universe list -> universe_graph + +(* + Since fresh() can't add the right uri to each node, you + must fill empty nodes with the uri before you serialize the graph to xml + + these empty nodes are also filled in the universe list +*) +val fill_empty_nodes_with_uri: + universe_graph -> universe list -> UriManager.uri -> + universe_graph * universe list + +(* + makes a union. + TODO: + - remember already merged uri so that we completely skip already merged + graphs, this may include a dependecy graph (not merge a subpart of an + already merged graph) +*) +val merge_ugraphs: + base_ugraph:universe_graph -> + increment:(universe_graph * UriManager.uri) -> universe_graph + +(* + ugraph to xml file and viceversa +*) +val write_xml_of_ugraph: + string -> universe_graph -> universe list -> unit + +(* + given a filename parses the xml and returns the data structure +*) +val ugraph_and_univlist_of_xml: + string -> universe_graph * universe list +val restart_numbering: + unit -> unit + +(* + returns the universe number (used to save it do xml) +*) +val univno: universe -> int + + (** re-hash-cons URIs contained in the given universe so that phisicaly + * equality could be enforced. Mainly used by + * CicEnvironment.restore_from_channel *) +val recons_graph: universe_graph -> universe_graph + + (** re-hash-cons a single universe *) +val recons_univ: universe -> universe + + (** consistency check that should be done before committin the graph to the + * cache *) +val assert_univs_have_uri: universe_graph -> universe list-> unit + + (** asserts the universe is named *) +val assert_univ: universe -> unit + +val compare: universe -> universe -> int +val eq: universe -> universe -> bool + +(* + Benchmarking stuff +*) +val get_spent_time: unit -> float +val reset_spent_time: unit -> unit + diff --git a/components/cic/cicUtil.ml b/components/cic/cicUtil.ml new file mode 100644 index 000000000..dd1652196 --- /dev/null +++ b/components/cic/cicUtil.ml @@ -0,0 +1,595 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +module C = Cic + +exception Meta_not_found of int +exception Subst_not_found of int + +let lookup_meta index metasenv = + try + List.find (fun (index', _, _) -> index = index') metasenv + with Not_found -> raise (Meta_not_found index) + +let lookup_subst n subst = + try + List.assoc n subst + with Not_found -> raise (Subst_not_found n) + +let exists_meta index = List.exists (fun (index', _, _) -> (index = index')) + +(* clean_up_meta take a substitution, a metasenv a meta_inex and a local +context l and clean up l with respect to the hidden hipothesis in the +canonical context *) + +let clean_up_local_context subst metasenv n l = + let cc = + (try + let (cc,_,_) = lookup_subst n subst in cc + with Subst_not_found _ -> + try + let (_,cc,_) = lookup_meta n metasenv in cc + with Meta_not_found _ -> assert false) in + (try + List.map2 + (fun t1 t2 -> + match t1,t2 with + None , _ -> None + | _ , t -> t) cc l + with + Invalid_argument _ -> + assert false) + +let is_closed = + let module C = Cic in + let rec is_closed k = + function + C.Rel m when m > k -> false + | C.Rel m -> true + | C.Meta (_,l) -> + List.fold_left + (fun i t -> i && (match t with None -> true | Some t -> is_closed k t) + ) true l + | C.Sort _ -> true + | C.Implicit _ -> assert false + | C.Cast (te,ty) -> is_closed k te && is_closed k ty + | C.Prod (name,so,dest) -> is_closed k so && is_closed (k+1) dest + | C.Lambda (_,so,dest) -> is_closed k so && is_closed (k+1) dest + | C.LetIn (_,so,dest) -> is_closed k so && is_closed (k+1) dest + | C.Appl l -> + List.fold_right (fun x i -> i && is_closed k x) l true + | C.Var (_,exp_named_subst) + | C.Const (_,exp_named_subst) + | C.MutInd (_,_,exp_named_subst) + | C.MutConstruct (_,_,_,exp_named_subst) -> + List.fold_right (fun (_,x) i -> i && is_closed k x) + exp_named_subst true + | C.MutCase (_,_,out,te,pl) -> + is_closed k out && is_closed k te && + List.fold_right (fun x i -> i && is_closed k x) pl true + | C.Fix (_,fl) -> + let len = List.length fl in + let k_plus_len = k + len in + List.fold_right + (fun (_,_,ty,bo) i -> i && is_closed k ty && is_closed k_plus_len bo + ) fl true + | C.CoFix (_,fl) -> + let len = List.length fl in + let k_plus_len = k + len in + List.fold_right + (fun (_,ty,bo) i -> i && is_closed k ty && is_closed k_plus_len bo + ) fl true +in + is_closed 0 +;; + +let rec is_meta_closed = + function + C.Rel _ -> true + | C.Meta _ -> false + | C.Sort _ -> true + | C.Implicit _ -> assert false + | C.Cast (te,ty) -> is_meta_closed te && is_meta_closed ty + | C.Prod (name,so,dest) -> is_meta_closed so && is_meta_closed dest + | C.Lambda (_,so,dest) -> is_meta_closed so && is_meta_closed dest + | C.LetIn (_,so,dest) -> is_meta_closed so && is_meta_closed dest + | C.Appl l -> + not (List.exists (fun x -> not (is_meta_closed x)) l) + | C.Var (_,exp_named_subst) + | C.Const (_,exp_named_subst) + | C.MutInd (_,_,exp_named_subst) + | C.MutConstruct (_,_,_,exp_named_subst) -> + not (List.exists (fun (_,x) -> not (is_meta_closed x)) exp_named_subst) + | C.MutCase (_,_,out,te,pl) -> + is_meta_closed out && is_meta_closed te && + not (List.exists (fun x -> not (is_meta_closed x)) pl) + | C.Fix (_,fl) -> + not (List.exists + (fun (_,_,ty,bo) -> + not (is_meta_closed ty) || not (is_meta_closed bo)) + fl) + | C.CoFix (_,fl) -> + not (List.exists + (fun (_,ty,bo) -> + not (is_meta_closed ty) || not (is_meta_closed bo)) + fl) +;; + +let xpointer_RE = Str.regexp "\\([^#]+\\)#xpointer(\\(.*\\))" +let slash_RE = Str.regexp "/" + +let term_of_uri uri = + let s = UriManager.string_of_uri uri in + try + (if UriManager.uri_is_con uri then + C.Const (uri, []) + else if UriManager.uri_is_var uri then + C.Var (uri, []) + else if not (Str.string_match xpointer_RE s 0) then + raise (UriManager.IllFormedUri s) + else + let (baseuri,xpointer) = (Str.matched_group 1 s, Str.matched_group 2 s) in + let baseuri = UriManager.uri_of_string baseuri in + (match Str.split slash_RE xpointer with + | [_; tyno] -> C.MutInd (baseuri, int_of_string tyno - 1, []) + | [_; tyno; consno] -> + C.MutConstruct + (baseuri, int_of_string tyno - 1, int_of_string consno, []) + | _ -> raise Exit)) + with + | Exit + | Failure _ + | Not_found -> raise (UriManager.IllFormedUri s) + +let uri_of_term = function + | C.Const (uri, _) + | C.Var (uri, _) -> uri + | C.MutInd (baseuri, tyno, _) -> + UriManager.uri_of_string + (Printf.sprintf "%s#xpointer(1/%d)" (UriManager.string_of_uri baseuri) (tyno+1)) + | C.MutConstruct (baseuri, tyno, consno, _) -> + UriManager.uri_of_string + (Printf.sprintf "%s#xpointer(1/%d/%d)" (UriManager.string_of_uri baseuri) + (tyno + 1) consno) + | _ -> raise (Invalid_argument "uri_of_term") + + +(* +let pack terms = + List.fold_right + (fun term acc -> C.Prod (C.Anonymous, term, acc)) + terms (C.Sort (C.Type (CicUniv.fresh ()))) + +let rec unpack = function + | C.Prod (C.Anonymous, term, C.Sort (C.Type _)) -> [term] + | C.Prod (C.Anonymous, term, tgt) -> term :: unpack tgt + | _ -> assert false +*) + +let rec strip_prods n = function + | t when n = 0 -> t + | C.Prod (_, _, tgt) when n > 0 -> strip_prods (n-1) tgt + | _ -> failwith "not enough prods" + +let params_of_obj = function + | C.Constant (_, _, _, params, _) + | C.Variable (_, _, _, params, _) + | C.CurrentProof (_, _, _, _, params, _) + | C.InductiveDefinition (_, params, _, _) -> + params + +let attributes_of_obj = function + | C.Constant (_, _, _, _, attributes) + | C.Variable (_, _, _, _, attributes) + | C.CurrentProof (_, _, _, _, _, attributes) + | C.InductiveDefinition (_, _, _, attributes) -> + attributes + +let is_generated obj = List.exists ((=) `Generated) (attributes_of_obj obj) + +let arity_of_composed_coercion obj = + let attrs = attributes_of_obj obj in + try + let tag=List.find (function `Class (`Coercion _) -> true|_->false) attrs in + match tag with + | `Class (`Coercion n) -> n + | _-> assert false + with Not_found -> 0 +;; + +let projections_of_record obj uri = + let attrs = attributes_of_obj obj in + try + let tag=List.find (function `Class (`Record _) -> true|_->false) attrs in + match tag with + | `Class (`Record l) -> + List.map (fun (name,_,_) -> + let buri = UriManager.buri_of_uri uri in + let puri = UriManager.uri_of_string (buri ^ "/" ^ name ^ ".con") in + puri) l + | _-> assert false + with Not_found -> [] +;; + +let rec mk_rels howmany from = + match howmany with + | 0 -> [] + | _ -> (C.Rel (howmany + from)) :: (mk_rels (howmany-1) from) + +let id_of_annterm = + function + | C.ARel (id,_,_,_) + | C.AVar (id,_,_) + | C.AMeta (id,_,_) + | C.ASort (id,_) + | C.AImplicit (id,_) + | C.ACast (id,_,_) + | C.AProd (id,_,_,_) + | C.ALambda (id,_,_,_) + | C.ALetIn (id,_,_,_) + | C.AAppl (id,_) + | C.AConst (id,_,_) + | C.AMutInd (id,_,_,_) + | C.AMutConstruct (id,_,_,_,_) + | C.AMutCase (id,_,_,_,_,_) + | C.AFix (id,_,_) + | C.ACoFix (id,_,_) -> id + + +let rec rehash_term = + let module C = Cic in + let recons uri = UriManager.uri_of_string (UriManager.string_of_uri uri) in + function + | (C.Rel _) as t -> t + | C.Var (uri,exp_named_subst) -> + let uri' = recons uri in + let exp_named_subst' = + List.map + (function (uri,t) ->(recons uri,rehash_term t)) + exp_named_subst + in + C.Var (uri',exp_named_subst') + | C.Meta (i,l) -> + let l' = + List.map + (function + None -> None + | Some t -> Some (rehash_term t) + ) l + in + C.Meta(i,l') + | C.Sort (C.Type u) -> + CicUniv.assert_univ u; + C.Sort (C.Type (CicUniv.recons_univ u)) + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (rehash_term te, rehash_term ty) + | C.Prod (n,s,t) -> C.Prod (n, rehash_term s, rehash_term t) + | C.Lambda (n,s,t) -> C.Lambda (n, rehash_term s, rehash_term t) + | C.LetIn (n,s,t) -> C.LetIn (n, rehash_term s, rehash_term t) + | C.Appl l -> C.Appl (List.map rehash_term l) + | C.Const (uri,exp_named_subst) -> + let uri' = recons uri in + let exp_named_subst' = + List.map + (function (uri,t) -> (recons uri,rehash_term t)) exp_named_subst + in + C.Const (uri',exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let uri' = recons uri in + let exp_named_subst' = + List.map + (function (uri,t) -> (recons uri,rehash_term t)) exp_named_subst + in + C.MutInd (uri',tyno,exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let uri' = recons uri in + let exp_named_subst' = + List.map + (function (uri,t) -> (recons uri,rehash_term t)) exp_named_subst + in + C.MutConstruct (uri',tyno,consno,exp_named_subst') + | C.MutCase (uri,i,outty,t,pl) -> + C.MutCase (recons uri, i, rehash_term outty, rehash_term t, + List.map rehash_term pl) + | C.Fix (i, fl) -> + let liftedfl = + List.map + (fun (name, i, ty, bo) -> + (name, i, rehash_term ty, rehash_term bo)) + fl + in + C.Fix (i, liftedfl) + | C.CoFix (i, fl) -> + let liftedfl = + List.map + (fun (name, ty, bo) -> (name, rehash_term ty, rehash_term bo)) + fl + in + C.CoFix (i, liftedfl) + +let rehash_obj = + let module C = Cic in + let recons uri = UriManager.uri_of_string (UriManager.string_of_uri uri) in + function + C.Constant (name,bo,ty,params,attrs) -> + let bo' = + match bo with + None -> None + | Some bo -> Some (rehash_term bo) + in + let ty' = rehash_term ty in + let params' = List.map recons params in + C.Constant (name, bo', ty', params',attrs) + | C.CurrentProof (name,conjs,bo,ty,params,attrs) -> + let conjs' = + List.map + (function (i,hyps,ty) -> + (i, + List.map (function + None -> None + | Some (name,C.Decl t) -> + Some (name,C.Decl (rehash_term t)) + | Some (name,C.Def (bo,ty)) -> + let ty' = + match ty with + None -> None + | Some ty'' -> Some (rehash_term ty'') + in + Some (name,C.Def (rehash_term bo, ty'))) hyps, + rehash_term ty)) + conjs + in + let bo' = rehash_term bo in + let ty' = rehash_term ty in + let params' = List.map recons params in + C.CurrentProof (name, conjs', bo', ty', params',attrs) + | C.Variable (name,bo,ty,params,attrs) -> + let bo' = + match bo with + None -> None + | Some bo -> Some (rehash_term bo) + in + let ty' = rehash_term ty in + let params' = List.map recons params in + C.Variable (name, bo', ty', params',attrs) + | C.InductiveDefinition (tl,params,paramsno,attrs) -> + let params' = List.map recons params in + let tl' = + List.map (function (name, inductive, ty, constructors) -> + name, + inductive, + rehash_term ty, + (List.map + (function (name, ty) -> name, rehash_term ty) + constructors)) + tl + in + C.InductiveDefinition (tl', params', paramsno, attrs) + +let rec metas_of_term = function + | C.Meta (i, c) -> [i,c] + | C.Var (_, ens) + | C.Const (_, ens) + | C.MutInd (_, _, ens) + | C.MutConstruct (_, _, _, ens) -> + List.flatten (List.map (fun (u, t) -> metas_of_term t) ens) + | C.Cast (s, t) + | C.Prod (_, s, t) + | C.Lambda (_, s, t) + | C.LetIn (_, s, t) -> (metas_of_term s) @ (metas_of_term t) + | C.Appl l -> List.flatten (List.map metas_of_term l) + | C.MutCase (uri, i, s, t, l) -> + (metas_of_term s) @ (metas_of_term t) @ + (List.flatten (List.map metas_of_term l)) + | C.Fix (i, il) -> + List.flatten + (List.map (fun (s, i, t1, t2) -> + (metas_of_term t1) @ (metas_of_term t2)) il) + | C.CoFix (i, il) -> + List.flatten + (List.map (fun (s, t1, t2) -> + (metas_of_term t1) @ (metas_of_term t2)) il) + | _ -> [] +;; + +module MetaOT = struct + type t = int * C.term option list + let compare = Pervasives.compare +end + +module S = Set.Make(MetaOT) + +let rec metas_of_term_set = function + | C.Meta (i, c) -> S.singleton (i,c) + | C.Var (_, ens) + | C.Const (_, ens) + | C.MutInd (_, _, ens) + | C.MutConstruct (_, _, _, ens) -> + List.fold_left + (fun s (_,t) -> S.union s (metas_of_term_set t)) + S.empty ens + | C.Cast (s, t) + | C.Prod (_, s, t) + | C.Lambda (_, s, t) + | C.LetIn (_, s, t) -> S.union (metas_of_term_set s) (metas_of_term_set t) + | C.Appl l -> + List.fold_left + (fun s t -> S.union s (metas_of_term_set t)) + S.empty l + | C.MutCase (uri, i, s, t, l) -> + S.union + (S.union (metas_of_term_set s) (metas_of_term_set t)) + (List.fold_left + (fun s t -> S.union s (metas_of_term_set t)) + S.empty l) + | C.Fix (_, il) -> + (List.fold_left + (fun s (_,_,t1,t2) -> + S.union s (S.union (metas_of_term_set t1) (metas_of_term_set t2)))) + S.empty il + | C.CoFix (i, il) -> + (List.fold_left + (fun s (_,t1,t2) -> + S.union s (S.union (metas_of_term_set t1) (metas_of_term_set t2)))) + S.empty il + | _ -> S.empty +;; + +let metas_of_term_set t = + let s = metas_of_term_set t in + S.elements s +;; + +(* syntactic_equality up to the *) +(* distinction between fake dependent products *) +(* and non-dependent products, alfa-conversion *) +let alpha_equivalence = + let rec aux t t' = + if t = t' then true + else + match t,t' with + C.Var (uri1,exp_named_subst1), C.Var (uri2,exp_named_subst2) -> + UriManager.eq uri1 uri2 && + aux_exp_named_subst exp_named_subst1 exp_named_subst2 + | C.Cast (te,ty), C.Cast (te',ty') -> + aux te te' && aux ty ty' + | C.Prod (_,s,t), C.Prod (_,s',t') -> + aux s s' && aux t t' + | C.Lambda (_,s,t), C.Lambda (_,s',t') -> + aux s s' && aux t t' + | C.LetIn (_,s,t), C.LetIn(_,s',t') -> + aux s s' && aux t t' + | C.Appl l, C.Appl l' when List.length l = List.length l' -> + (try + List.fold_left2 + (fun b t1 t2 -> b && aux t1 t2) true l l' + with + Invalid_argument _ -> false) + | C.Const (uri,exp_named_subst1), C.Const (uri',exp_named_subst2) -> + UriManager.eq uri uri' && + aux_exp_named_subst exp_named_subst1 exp_named_subst2 + | C.MutInd (uri,i,exp_named_subst1), C.MutInd (uri',i',exp_named_subst2) -> + UriManager.eq uri uri' && i = i' && + aux_exp_named_subst exp_named_subst1 exp_named_subst2 + | C.MutConstruct (uri,i,j,exp_named_subst1), + C.MutConstruct (uri',i',j',exp_named_subst2) -> + UriManager.eq uri uri' && i = i' && j = j' && + aux_exp_named_subst exp_named_subst1 exp_named_subst2 + | C.MutCase (sp,i,outt,t,pl), C.MutCase (sp',i',outt',t',pl') -> + UriManager.eq sp sp' && i = i' && + aux outt outt' && aux t t' && + (try + List.fold_left2 + (fun b t1 t2 -> b && aux t1 t2) true pl pl' + with + Invalid_argument _ -> false) + | C.Fix (i,fl), C.Fix (i',fl') -> + i = i' && + (try + List.fold_left2 + (fun b (_,i,ty,bo) (_,i',ty',bo') -> + b && i = i' && aux ty ty' && aux bo bo' + ) true fl fl' + with + Invalid_argument _ -> false) + | C.CoFix (i,fl), C.CoFix (i',fl') -> + i = i' && + (try + List.fold_left2 + (fun b (_,ty,bo) (_,ty',bo') -> + b && aux ty ty' && aux bo bo' + ) true fl fl' + with + Invalid_argument _ -> false) + | C.Meta (i, subst), C.Meta (i', subst') -> + i = i' && + (try + List.fold_left2 + (fun b xt xt' -> match xt,xt' with + | Some t, Some t' -> b && aux t t' + | _ -> b + ) true subst subst' + with + Invalid_argument _ -> false) + | C.Appl [t], t' | t, C.Appl [t'] -> assert false +(* FG: are we _really_ sure of these? + | C.Sort (C.Type u), C.Sort (C.Type u') -> u = u' + | C.Implicit a, C.Implicit a' -> a = a' + we insert an unused variable below to genarate a warning at compile time +*) + | _,_ -> false (* we already know that t != t' *) + and aux_exp_named_subst exp_named_subst1 exp_named_subst2 = + try + List.fold_left2 + (fun b (uri1,t1) (uri2,t2) -> + b && UriManager.eq uri1 uri2 && aux t1 t2 + ) true exp_named_subst1 exp_named_subst2 + with + Invalid_argument _ -> false + in + aux + +let is_sober t = + let rec sober_term g = function + | C.Rel _ + | C.Sort _ + | C.Implicit _ -> g + | C.Const (_, xnss) + | C.Var (_, xnss) + | C.MutConstruct (_, _, _, xnss) + | C.MutInd (_, _, xnss) -> sober_xnss g xnss + | C.Meta (_, xss) -> sober_xss g xss + | C.LetIn (_, v, t) + | C.Lambda (_, v, t) + | C.Prod (_, v, t) + | C.Cast (t, v) -> sober_term (sober_term g t) v + | C.Appl [] + | C.Appl [_] -> fun b -> false + | C.Appl ts -> sober_terms g ts + | C.MutCase (_, _, t, v, ts) -> + sober_terms (sober_term (sober_term g t) v) ts + | C.Fix (_, ifs) -> sober_ifs g ifs + | C.CoFix (_, cifs) -> sober_cifs g cifs + and sober_terms g = List.fold_left sober_term g + and sober_xnss g = + let map g (_, t) = sober_term g t in + List.fold_left map g + and sober_xss g = + let map g = function + | None -> g + | Some t -> sober_term g t + in + List.fold_left map g + and sober_ifs g = + let map g (_, _, t, v) = sober_term (sober_term g t) v in + List.fold_left map g + and sober_cifs g = + let map g (_, t, v) = sober_term (sober_term g t) v in + List.fold_left map g + in + sober_term (fun b -> b) t true diff --git a/components/cic/cicUtil.mli b/components/cic/cicUtil.mli new file mode 100644 index 000000000..9977d1864 --- /dev/null +++ b/components/cic/cicUtil.mli @@ -0,0 +1,73 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception Meta_not_found of int +exception Subst_not_found of int + +val lookup_meta: int -> Cic.metasenv -> Cic.conjecture +val lookup_subst: int -> Cic.substitution -> Cic.context * Cic.term * Cic.term +val exists_meta: int -> Cic.metasenv -> bool +val clean_up_local_context : + Cic.substitution -> Cic.metasenv -> int -> (Cic.term option) list + -> (Cic.term option) list + +val is_closed : Cic.term -> bool +val is_meta_closed : Cic.term -> bool +val metas_of_term : Cic.term -> (int * Cic.term option list) list +(* as before but with no duplicates. may avoind some stack overflows *) +val metas_of_term_set : Cic.term -> (int * Cic.term option list) list + + (** @raise Failure "not enough prods" *) +val strip_prods: int -> Cic.term -> Cic.term + +(** conversions between terms which are fully representable as uris (Var, Const, + * Mutind, and MutConstruct) and corresponding tree representations *) +val term_of_uri: UriManager.uri -> Cic.term (** @raise UriManager.IllFormedUri *) +val uri_of_term: Cic.term -> UriManager.uri (** @raise Invalid_argument "uri_of_term" *) + +val id_of_annterm: Cic.annterm -> Cic.id + +(** {2 Cic selectors} *) + +val params_of_obj: Cic.obj -> UriManager.uri list +val attributes_of_obj: Cic.obj -> Cic.attribute list +val projections_of_record: Cic.obj -> UriManager.uri -> UriManager.uri list +val arity_of_composed_coercion: Cic.obj -> int +val is_generated: Cic.obj -> bool + +(** mk_rels [howmany] [from] + * creates a list of [howmany] rels starting from [from] in decreasing order *) +val mk_rels : int -> int -> Cic.term list + +(** {2 Uri hash consing} *) +val rehash_term: Cic.term -> Cic.term +val rehash_obj: Cic.obj -> Cic.obj + +val alpha_equivalence: Cic.term -> Cic.term -> bool + +(* FG: Consistency Check + * detects applications without arguments + *) +val is_sober: Cic.term -> bool diff --git a/components/cic/deannotate.ml b/components/cic/deannotate.ml new file mode 100644 index 000000000..b7c7d1113 --- /dev/null +++ b/components/cic/deannotate.ml @@ -0,0 +1,128 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(* converts annotated terms into cic terms (forgetting ids and names) *) +let rec deannotate_term = + let module C = Cic in + function + C.ARel (_,_,n,_) -> C.Rel n + | C.AVar (_,uri,exp_named_subst) -> + let deann_exp_named_subst = + List.map (function (uri,t) -> uri,deannotate_term t) exp_named_subst + in + C.Var (uri, deann_exp_named_subst) + | C.AMeta (_,n, l) -> + let l' = + List.map + (function + None -> None + | Some at -> Some (deannotate_term at) + ) l + in + C.Meta (n, l') + | C.ASort (_,s) -> C.Sort s + | C.AImplicit (_, annotation) -> C.Implicit annotation + | C.ACast (_,va,ty) -> C.Cast (deannotate_term va, deannotate_term ty) + | C.AProd (_,name,so,ta) -> + C.Prod (name, deannotate_term so, deannotate_term ta) + | C.ALambda (_,name,so,ta) -> + C.Lambda (name, deannotate_term so, deannotate_term ta) + | C.ALetIn (_,name,so,ta) -> + C.LetIn (name, deannotate_term so, deannotate_term ta) + | C.AAppl (_,l) -> C.Appl (List.map deannotate_term l) + | C.AConst (_,uri,exp_named_subst) -> + let deann_exp_named_subst = + List.map (function (uri,t) -> uri,deannotate_term t) exp_named_subst + in + C.Const (uri, deann_exp_named_subst) + | C.AMutInd (_,uri,i,exp_named_subst) -> + let deann_exp_named_subst = + List.map (function (uri,t) -> uri,deannotate_term t) exp_named_subst + in + C.MutInd (uri,i,deann_exp_named_subst) + | C.AMutConstruct (_,uri,i,j,exp_named_subst) -> + let deann_exp_named_subst = + List.map (function (uri,t) -> uri,deannotate_term t) exp_named_subst + in + C.MutConstruct (uri,i,j,deann_exp_named_subst) + | C.AMutCase (_,uri,i,outtype,te,pl) -> + C.MutCase (uri,i,deannotate_term outtype, + deannotate_term te, List.map deannotate_term pl) + | C.AFix (_,funno,ifl) -> + C.Fix (funno, List.map deannotate_inductiveFun ifl) + | C.ACoFix (_,funno,ifl) -> + C.CoFix (funno, List.map deannotate_coinductiveFun ifl) + +and deannotate_inductiveFun (_,name,index,ty,bo) = + (name, index, deannotate_term ty, deannotate_term bo) + +and deannotate_coinductiveFun (_,name,ty,bo) = + (name, deannotate_term ty, deannotate_term bo) +;; + +let deannotate_inductiveType (_, name, isinductive, arity, cons) = + (name, isinductive, deannotate_term arity, + List.map (fun (id,ty) -> (id,deannotate_term ty)) cons) +;; + +let deannotate_conjectures = + let module C = Cic in + List.map + (function + (_,id,acontext,con) -> + let context = + List.map + (function + | _,Some (n,(C.ADef at)) -> Some(n,(C.Def((deannotate_term at),None))) + | _,Some (n,(C.ADecl at)) -> Some (n,(C.Decl (deannotate_term at))) + | _,None -> None) + acontext + in + (id,context,deannotate_term con)) +;; + +let deannotate_obj = + let module C = Cic in + function + C.AConstant (_, _, id, bo, ty, params, attrs) -> + C.Constant (id, + (match bo with None -> None | Some bo -> Some (deannotate_term bo)), + deannotate_term ty, params, attrs) + | C.AVariable (_, name, bo, ty, params, attrs) -> + C.Variable (name, + (match bo with None -> None | Some bo -> Some (deannotate_term bo)), + deannotate_term ty, params, attrs) + | C.ACurrentProof (_, _, name, conjs, bo, ty, params, attrs) -> + C.CurrentProof ( + name, + deannotate_conjectures conjs, + deannotate_term bo,deannotate_term ty, params, attrs + ) + | C.AInductiveDefinition (_, tys, params, parno, attrs) -> + C.InductiveDefinition (List.map deannotate_inductiveType tys, + params, parno, attrs) +;; diff --git a/components/cic/deannotate.mli b/components/cic/deannotate.mli new file mode 100644 index 000000000..1e29b5b64 --- /dev/null +++ b/components/cic/deannotate.mli @@ -0,0 +1,37 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(******************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 29/11/2000 *) +(* *) +(******************************************************************************) + +val deannotate_term : Cic.annterm -> Cic.term +val deannotate_conjectures : Cic.annmetasenv -> Cic.metasenv +val deannotate_obj : Cic.annobj -> Cic.obj diff --git a/components/cic/discrimination_tree.ml b/components/cic/discrimination_tree.ml new file mode 100644 index 000000000..546f4a34f --- /dev/null +++ b/components/cic/discrimination_tree.ml @@ -0,0 +1,305 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +module DiscriminationTreeIndexing = + functor (A:Set.S) -> + struct + + type path_string_elem = + | Constant of UriManager.uri + | Bound of int | Variable | Proposition | Datatype | Dead;; + type path_string = path_string_elem list;; + + + (* needed by the retrieve_* functions, to know the arities of the + * "functions" *) + + let ppelem = function + | Constant uri -> UriManager.name_of_uri uri + | Bound i -> string_of_int i + | Variable -> "?" + | Proposition -> "Prop" + | Datatype -> "Type" + | Dead -> "DEAD" + ;; + let pppath l = String.concat "::" (List.map ppelem l) ;; + let elem_of_cic = function + | Cic.Meta _ | Cic.Implicit _ -> Variable + | Cic.Rel i -> Bound i + | Cic.Sort (Cic.Prop) -> Proposition + | Cic.Sort _ -> Datatype + | Cic.Const _ | Cic.Var _ | Cic.MutInd _ | Cic.MutConstruct _ as t -> + (try Constant (CicUtil.uri_of_term t) + with Invalid_argument _ -> assert false) + | Cic.Appl _ -> + assert false (* should not happen *) + | Cic.LetIn _ | Cic.Lambda _ | Cic.Prod _ | Cic.Cast _ + | Cic.MutCase _ | Cic.Fix _ | Cic.CoFix _ -> + HLog.debug "FIXME: the trie receives an invalid term"; + Dead + (* assert false universe.ml removes these *) + ;; + let path_string_of_term arities = + let set_arity arities k n = + (assert (k<>Variable || n=0); + if k = Dead then arities else (k,n)::(List.remove_assoc k arities)) + in + let rec aux arities = function + | Cic.Appl ((hd::tl) as l) -> + let arities = + set_arity arities (elem_of_cic hd) (List.length tl) in + List.fold_left + (fun (arities,path) t -> + let arities,tpath = aux arities t in + arities,path@tpath) + (arities,[]) l + | t -> arities, [elem_of_cic t] + in + aux arities + ;; + let compare_elem e1 e2 = + match e1,e2 with + | Constant u1,Constant u2 -> UriManager.compare u1 u2 + | e1,e2 -> Pervasives.compare e1 e2 + ;; + + module OrderedPathStringElement = struct + type t = path_string_elem + let compare = compare_elem + end + + module PSMap = Map.Make(OrderedPathStringElement);; + + type key = PSMap.key + + module DiscriminationTree = Trie.Make(PSMap);; + + type t = A.t DiscriminationTree.t * (path_string_elem*int) list + let empty = DiscriminationTree.empty, [] ;; + + let index (tree,arity) term info = + let arity,ps = path_string_of_term arity term in + let ps_set = + try DiscriminationTree.find ps tree + with Not_found -> A.empty in + let tree = DiscriminationTree.add ps (A.add info ps_set) tree in + tree,arity + ;; + + let remove_index (tree,arity) term info = + let arity,ps = path_string_of_term arity term in + try + let ps_set = A.remove info (DiscriminationTree.find ps tree) in + if A.is_empty ps_set then + DiscriminationTree.remove ps tree,arity + else + DiscriminationTree.add ps ps_set tree,arity + with Not_found -> + tree,arity + ;; + + let in_index (tree,arity) term test = + let arity,ps = path_string_of_term arity term in + try + let ps_set = DiscriminationTree.find ps tree in + A.exists test ps_set + with Not_found -> + false + ;; + + let head_of_term = function + | Cic.Appl (hd::tl) -> hd + | term -> term + ;; + + let rec skip_prods = function + | Cic.Prod (_,_,t) -> skip_prods t + | term -> term + ;; + + let rec subterm_at_pos pos term = + match pos with + | [] -> term + | index::pos -> + match term with + | Cic.Appl l -> + (try subterm_at_pos pos (List.nth l index) + with Failure _ -> raise Not_found) + | _ -> raise Not_found + ;; + + + let rec after_t pos term = + let pos' = + match pos with + | [] -> raise Not_found + | pos -> + List.fold_right + (fun i r -> if r = [] then [i+1] else i::r) pos [] + in + try + ignore(subterm_at_pos pos' term ); pos' + with Not_found -> + let pos, _ = + List.fold_right + (fun i (r, b) -> if b then (i::r, true) else (r, true)) + pos ([], false) + in + after_t pos term + ;; + + + let next_t pos term = + let t = subterm_at_pos pos term in + try + let _ = subterm_at_pos [1] t in + pos @ [1] + with Not_found -> + match pos with + | [] -> [1] + | pos -> after_t pos term + ;; + + let retrieve_generalizations (tree,arity) term = + let term = skip_prods term in + let rec retrieve tree term pos = + match tree with + | DiscriminationTree.Node (Some s, _) when pos = [] -> s + | DiscriminationTree.Node (_, map) -> + let res = + let hd_term = + elem_of_cic (head_of_term (subterm_at_pos pos term)) + in + if hd_term = Variable then A.empty else + try + let n = PSMap.find hd_term map in + match n with + | DiscriminationTree.Node (Some s, _) -> s + | DiscriminationTree.Node (None, _) -> + let newpos = + try next_t pos term + with Not_found -> [] + in + retrieve n term newpos + with Not_found -> + A.empty + in + try + let n = PSMap.find Variable map in + let newpos = try after_t pos term with Not_found -> [-1] in + if newpos = [-1] then + match n with + | DiscriminationTree.Node (Some s, _) -> A.union s res + | _ -> res + else + A.union res (retrieve n term newpos) + with Not_found -> + res + in + retrieve tree term [] + ;; + + + let jump_list arities = function + | DiscriminationTree.Node (value, map) -> + let rec get n tree = + match tree with + | DiscriminationTree.Node (v, m) -> + if n = 0 then + [tree] + else + PSMap.fold + (fun k v res -> + let a = + try List.assoc k arities + with Not_found -> 0 + in + (get (n-1 + a) v) @ res) m [] + in + PSMap.fold + (fun k v res -> + let arity = + try + List.assoc k arities + with Not_found -> 0 in + (get arity v) @ res) + map [] + ;; + + + let retrieve_unifiables (tree,arities) term = + let term = skip_prods term in + let rec retrieve tree term pos = + match tree with + | DiscriminationTree.Node (Some s, _) when pos = [] -> s + | DiscriminationTree.Node (_, map) -> + let subterm = + try Some (subterm_at_pos pos term) with Not_found -> None + in + match subterm with + | None -> A.empty + | Some (Cic.Meta _) -> + let newpos = try next_t pos term with Not_found -> [] in + let jl = jump_list arities tree in + List.fold_left + (fun r s -> A.union r s) + A.empty + (List.map (fun t -> retrieve t term newpos) jl) + | Some subterm -> + let res = + let hd_term = elem_of_cic (head_of_term subterm) in + if hd_term = Variable then + A.empty else + try + let n = PSMap.find hd_term map in + match n with + | DiscriminationTree.Node (Some s, _) -> s + | DiscriminationTree.Node (None, _) -> + retrieve n term (next_t pos term) + with Not_found -> + A.empty + in + try + let n = PSMap.find Variable map in + let newpos = + try after_t pos term + with Not_found -> [-1] + in + if newpos = [-1] then + match n with + | DiscriminationTree.Node (Some s, _) -> + A.union s res + | _ -> res + else + A.union res (retrieve n term newpos) + with Not_found -> + res + in + retrieve tree term [] + end +;; + diff --git a/components/cic/discrimination_tree.mli b/components/cic/discrimination_tree.mli new file mode 100644 index 000000000..63464e2cc --- /dev/null +++ b/components/cic/discrimination_tree.mli @@ -0,0 +1,40 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module DiscriminationTreeIndexing : + functor (A : Set.S) -> + sig + + type t + + val empty : t + val index : t -> Cic.term -> A.elt -> t + val remove_index : t -> Cic.term -> A.elt -> t + val in_index : t -> Cic.term -> (A.elt -> bool) -> bool + val retrieve_generalizations : t -> Cic.term -> A.t + val retrieve_unifiables : t -> Cic.term -> A.t + end + + diff --git a/components/cic/helmLibraryObjects.ml b/components/cic/helmLibraryObjects.ml new file mode 100644 index 000000000..3038582ab --- /dev/null +++ b/components/cic/helmLibraryObjects.ml @@ -0,0 +1,230 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(** {2 Auxiliary functions} *) + +let uri = UriManager.uri_of_string + +let const ?(subst = []) uri = Cic.Const (uri, subst) +let var ?(subst = []) uri = Cic.Var (uri, subst) +let mutconstruct ?(subst = []) uri typeno consno = + Cic.MutConstruct (uri, typeno, consno, subst) +let mutind ?(subst = []) uri typeno = Cic.MutInd (uri, typeno, subst) + +let indtyuri_of_uri uri = + let index_sharp = String.index uri '#' in + let index_num = index_sharp + 3 in + (UriManager.uri_of_string (String.sub uri 0 index_sharp), + int_of_string(String.sub uri index_num (String.length uri - index_num)) - 1) + +let indconuri_of_uri uri = + let index_sharp = String.index uri '#' in + let index_div = String.rindex uri '/' in + let index_con = index_div + 1 in + (UriManager.uri_of_string (String.sub uri 0 index_sharp), + int_of_string + (String.sub uri (index_sharp + 3) (index_div - index_sharp - 3)) - 1, + int_of_string + (String.sub uri index_con (String.length uri - index_con))) + +(** {2 Helm's objects shorthands} *) + +module Logic = + struct + let eq_SURI = "cic:/Coq/Init/Logic/eq.ind" + let eq_URI = uri eq_SURI + let eq_XURI = eq_SURI ^ "#xpointer(1/1)" + let eq_ind_URI = uri "cic:/Coq/Init/Logic/eq_ind.con" + let eq_ind_r_URI = uri "cic:/Coq/Init/Logic/eq_ind_r.con" + let true_URI = uri "cic:/Coq/Init/Logic/True.ind" + let false_URI = uri "cic:/Coq/Init/Logic/False.ind" + let false_ind_URI = uri "cic:/Coq/Init/Logic/False_ind.con" + let ex_SURI = "cic:/Coq/Init/Logic/ex.ind" + let ex_URI = uri ex_SURI + let ex_XURI = ex_SURI ^ "#xpointer(1/1)" + let ex_ind_URI = uri "cic:/Coq/Init/Logic/ex_ind.con" + let and_SURI = "cic:/Coq/Init/Logic/and.ind" + let and_URI = uri and_SURI + let and_XURI = and_SURI ^ "#xpointer(1/1)" + let and_ind_URI = uri "cic:/Coq/Init/Logic/and_ind.con" + let or_SURI = "cic:/Coq/Init/Logic/or.ind" + let or_URI = uri or_SURI + let or_XURI = or_SURI ^ "#xpointer(1/1)" + let not_SURI = "cic:/Coq/Init/Logic/not.con" + let not_URI = uri not_SURI + let iff_SURI = "cic:/Coq/Init/Logic/iff.con" + let iff_URI = uri "cic:/Coq/Init/Logic/iff.con" + let sym_eq_URI = uri "cic:/Coq/Init/Logic/sym_eq.con" + let trans_eq_URI = uri "cic:/Coq/Init/Logic/trans_eq.con" + let absurd_URI = uri "cic:/Coq/Init/Logic/absurd.con" + end + +module Datatypes = + struct + let bool_URI = uri "cic:/Coq/Init/Datatypes/bool.ind" + let nat_URI = uri "cic:/Coq/Init/Datatypes/nat.ind" + + let trueb = mutconstruct bool_URI 0 1 + let falseb = mutconstruct bool_URI 0 2 + let zero = mutconstruct nat_URI 0 1 + let succ = mutconstruct nat_URI 0 2 + end + +module Reals = + struct + let r_URI = uri "cic:/Coq/Reals/Rdefinitions/R.con" + let rplus_SURI = "cic:/Coq/Reals/Rdefinitions/Rplus.con" + let rplus_URI = uri rplus_SURI + let rminus_SURI = "cic:/Coq/Reals/Rdefinitions/Rminus.con" + let rminus_URI = uri rminus_SURI + let rmult_SURI = "cic:/Coq/Reals/Rdefinitions/Rmult.con" + let rmult_URI = uri rmult_SURI + let rdiv_SURI = "cic:/Coq/Reals/Rdefinitions/Rdiv.con" + let rdiv_URI = uri rdiv_SURI + let ropp_SURI = "cic:/Coq/Reals/Rdefinitions/Ropp.con" + let ropp_URI = uri ropp_SURI + let rinv_SURI = "cic:/Coq/Reals/Rdefinitions/Rinv.con" + let rinv_URI = uri rinv_SURI + let r0_SURI = "cic:/Coq/Reals/Rdefinitions/R0.con" + let r0_URI = uri r0_SURI + let r1_SURI = "cic:/Coq/Reals/Rdefinitions/R1.con" + let r1_URI = uri r1_SURI + let rle_SURI = "cic:/Coq/Reals/Rdefinitions/Rle.con" + let rle_URI = uri rle_SURI + let rge_SURI = "cic:/Coq/Reals/Rdefinitions/Rge.con" + let rge_URI = uri rge_SURI + let rlt_SURI = "cic:/Coq/Reals/Rdefinitions/Rlt.con" + let rlt_URI = uri rlt_SURI + let rgt_SURI = "cic:/Coq/Reals/Rdefinitions/Rgt.con" + let rgt_URI = uri rgt_SURI + let rtheory_URI = uri "cic:/Coq/Reals/RIneq/RTheory.con" + let rinv_r1_URI = uri "cic:/Coq/Reals/RIneq/Rinv_1.con" + let pow_URI = uri "cic:/Coq/Reals/Rfunctions/pow.con" + + let r = const r_URI + let rplus = const rplus_URI + let rmult = const rmult_URI + let ropp = const ropp_URI + let r0 = const r0_URI + let r1 = const r1_URI + let rtheory = const rtheory_URI + end + +module Peano = + struct + let plus_SURI = "cic:/Coq/Init/Peano/plus.con" + let plus_URI = uri plus_SURI + let minus_SURI = "cic:/Coq/Init/Peano/minus.con" + let minus_URI = uri minus_SURI + let mult_SURI = "cic:/Coq/Init/Peano/mult.con" + let mult_URI = uri mult_SURI + let pred_URI = uri "cic:/Coq/Init/Peano/pred.con" + let le_SURI = "cic:/Coq/Init/Peano/le.ind" + let le_URI = uri le_SURI + let le_XURI = le_SURI ^ "#xpointer(1/1)" + let ge_SURI = "cic:/Coq/Init/Peano/ge.con" + let ge_URI = uri ge_SURI + let lt_SURI = "cic:/Coq/Init/Peano/lt.con" + let lt_URI = uri lt_SURI + let gt_SURI = "cic:/Coq/Init/Peano/gt.con" + let gt_URI = uri gt_SURI + + let plus = const plus_URI + let mult = const mult_URI + let pred = const pred_URI + end + +module BinPos = + struct + let positive_SURI = "cic:/Coq/NArith/BinPos/positive.ind" + let positive_URI = uri positive_SURI + let xI = mutconstruct positive_URI 0 1 + let xO = mutconstruct positive_URI 0 2 + let xH = mutconstruct positive_URI 0 3 + let pplus_SURI = "cic:/Coq/NArith/BinPos/Pplus.con" + let pplus_URI = uri pplus_SURI + let pplus = const pplus_URI + let pminus_SURI = "cic:/Coq/NArith/BinPos/Pminus.con" + let pminus_URI = uri pminus_SURI + let pminus = const pminus_URI + let pmult_SURI = "cic:/Coq/NArith/BinPos/Pmult.con" + let pmult_URI = uri pmult_SURI + let pmult = const pmult_URI + end + +module BinInt = + struct + let zmult_URI = uri "cic:/Coq/ZArith/BinInt/Zmult.con" + let zmult = const zmult_URI + let zplus_SURI = "cic:/Coq/ZArith/BinInt/Zplus.con" + let zplus_URI = uri zplus_SURI + let zplus = const zplus_URI + let zminus_SURI = "cic:/Coq/ZArith/BinInt/Zminus.con" + let zminus_URI = uri zminus_SURI + let zminus = const zminus_URI + let z_SURI = "cic:/Coq/ZArith/BinInt/Z.ind" + let z_URI = uri z_SURI + let z0 = mutconstruct z_URI 0 1 + let zpos = mutconstruct z_URI 0 2 + let zneg = mutconstruct z_URI 0 3 + let zopp_SURI = "cic:/Coq/ZArith/BinInt/Zopp.con" + let zopp_URI = uri zopp_SURI + let zopp = const zopp_URI + let zpower_URI = uri "cic:/Coq/ZArith/Zpower/Zpower.con" + end + +(** {2 Helpers for creating common terms} + * (e.g. numbers)} *) + +exception NegativeInteger + +let build_nat n = + if n < 0 then raise NegativeInteger; + let rec aux = function + | 0 -> Datatypes.zero + | n -> Cic.Appl [ Datatypes.succ; (aux (n - 1)) ] + in + aux n + +let build_real n = + if n < 0 then raise NegativeInteger; + let rec aux = function + | 0 -> Reals.r0 + | 1 -> Reals.r1 (* to avoid trailing "+ 0" *) + | n -> Cic.Appl [ Reals.rplus; Reals.r1; (aux (n - 1)) ] + in + aux n + +let build_bin_pos n = + if n < 1 then raise NegativeInteger; + let rec aux = function + | 1 -> BinPos.xH + | n when n mod 2 = 0 -> Cic.Appl [ BinPos.xO; aux (n / 2) ] + | n -> Cic.Appl [ BinPos.xI; aux (n / 2) ] + in + aux n + diff --git a/components/cic/helmLibraryObjects.mli b/components/cic/helmLibraryObjects.mli new file mode 100644 index 000000000..677879899 --- /dev/null +++ b/components/cic/helmLibraryObjects.mli @@ -0,0 +1,182 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +module Logic : + sig + val absurd_URI : UriManager.uri + val and_ind_URI : UriManager.uri + val and_URI : UriManager.uri + val eq_ind_r_URI : UriManager.uri + val eq_ind_URI : UriManager.uri + val eq_URI : UriManager.uri + val ex_ind_URI : UriManager.uri + val ex_URI : UriManager.uri + val false_ind_URI : UriManager.uri + val false_URI : UriManager.uri + val iff_URI : UriManager.uri + val not_URI : UriManager.uri + val or_URI : UriManager.uri + val sym_eq_URI : UriManager.uri + val trans_eq_URI : UriManager.uri + val true_URI : UriManager.uri + + val and_SURI : string + val eq_SURI : string + val ex_SURI : string + val iff_SURI : string + val not_SURI : string + val or_SURI : string + + val and_XURI : string + val eq_XURI : string + val ex_XURI : string + val or_XURI : string + end + +module Datatypes : + sig + val bool_URI : UriManager.uri + val nat_URI : UriManager.uri + + val trueb : Cic.term + val falseb : Cic.term + val zero : Cic.term + val succ : Cic.term + end + +module Reals : + sig + val pow_URI : UriManager.uri + val r0_URI : UriManager.uri + val r1_URI : UriManager.uri + val rdiv_URI : UriManager.uri + val rge_URI : UriManager.uri + val rgt_URI : UriManager.uri + val rinv_r1_URI : UriManager.uri + val rinv_URI : UriManager.uri + val rle_URI : UriManager.uri + val rlt_URI : UriManager.uri + val rminus_URI : UriManager.uri + val rmult_URI : UriManager.uri + val ropp_URI : UriManager.uri + val rplus_URI : UriManager.uri + val rtheory_URI : UriManager.uri + val r_URI : UriManager.uri + + val r0_SURI : string + val r1_SURI : string + val rdiv_SURI : string + val rge_SURI : string + val rgt_SURI : string + val rinv_SURI : string + val rle_SURI : string + val rlt_SURI : string + val rminus_SURI : string + val rmult_SURI : string + val ropp_SURI : string + val rplus_SURI : string + + val r0 : Cic.term + val r1 : Cic.term + val r : Cic.term + val rmult : Cic.term + val ropp : Cic.term + val rplus : Cic.term + val rtheory : Cic.term + end + +module Peano : + sig + val ge_URI : UriManager.uri + val gt_URI : UriManager.uri + val le_URI : UriManager.uri + val lt_URI : UriManager.uri + val minus_URI : UriManager.uri + val mult_URI : UriManager.uri + val plus_URI : UriManager.uri + val pred_URI : UriManager.uri + + val ge_SURI : string + val gt_SURI : string + val le_SURI : string + val lt_SURI : string + val minus_SURI : string + val mult_SURI : string + val plus_SURI : string + + val le_XURI : string + + val mult : Cic.term + val plus : Cic.term + val pred : Cic.term + end + +module BinPos : + sig + val pminus_URI : UriManager.uri + val pmult_URI : UriManager.uri + val positive_URI : UriManager.uri + val pplus_URI : UriManager.uri + + val pminus_SURI : string + val pmult_SURI : string + val positive_SURI : string + val pplus_SURI : string + + val pminus : Cic.term + val pmult : Cic.term + val pplus : Cic.term + val xH : Cic.term + val xI : Cic.term + val xO : Cic.term + end + +module BinInt : + sig + val zminus_URI : UriManager.uri + val zmult_URI : UriManager.uri + val zopp_URI : UriManager.uri + val zplus_URI : UriManager.uri + val zpower_URI : UriManager.uri + val z_URI : UriManager.uri + + val zminus_SURI : string + val zopp_SURI : string + val zplus_SURI : string + val z_SURI : string + + val z0 : Cic.term + val zminus : Cic.term + val zmult : Cic.term + val zneg : Cic.term + val zopp : Cic.term + val zplus : Cic.term + val zpos : Cic.term + end + +val build_bin_pos : int -> Cic.term +val build_nat : int -> Cic.term +val build_real : int -> Cic.term + diff --git a/components/cic/libraryObjects.ml b/components/cic/libraryObjects.ml new file mode 100644 index 000000000..7e1dc626f --- /dev/null +++ b/components/cic/libraryObjects.ml @@ -0,0 +1,225 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +(**** TABLES ****) + +let default_eq_URIs = [] +let default_true_URIs = [] +let default_false_URIs = [] +let default_absurd_URIs = [] + +(* eq, sym_eq, trans_eq, eq_ind, eq_ind_R *) +let eq_URIs_ref = ref default_eq_URIs;; + +let true_URIs_ref = ref default_true_URIs +let false_URIs_ref = ref default_false_URIs +let absurd_URIs_ref = ref default_absurd_URIs + + +(**** SET_DEFAULT ****) + +exception NotRecognized of string;; + +(* insert an element in front of the list, removing from the list all the + previous elements with the same key associated *) +let insert_unique e extract l = + let uri = extract e in + let l' = + List.filter (fun x -> let uri' = extract x in not (UriManager.eq uri uri')) l + in + e :: l' + +let set_default what l = + match what,l with + "equality",[eq_URI;sym_eq_URI;trans_eq_URI;eq_ind_URI; + eq_ind_r_URI;eq_rec_URI;eq_rec_r_URI;eq_rect_URI; + eq_rect_r_URI;eq_f_URI;eq_f_sym_URI] -> + eq_URIs_ref := + insert_unique + (eq_URI,sym_eq_URI,trans_eq_URI,eq_ind_URI, + eq_ind_r_URI,eq_rec_URI,eq_rec_r_URI,eq_rect_URI, + eq_rect_r_URI,eq_f_URI,eq_f_sym_URI) + (fun x,_,_,_,_,_,_,_,_,_,_ -> x) !eq_URIs_ref + | "true",[true_URI] -> + true_URIs_ref := insert_unique true_URI (fun x -> x) !true_URIs_ref + | "false",[false_URI] -> + false_URIs_ref := insert_unique false_URI (fun x -> x) !false_URIs_ref + | "absurd",[absurd_URI] -> + absurd_URIs_ref := insert_unique absurd_URI (fun x -> x) !absurd_URIs_ref + | _,l -> + raise + (NotRecognized (what^" with "^string_of_int(List.length l)^" params")) +;; + +let reset_defaults () = + eq_URIs_ref := default_eq_URIs; + true_URIs_ref := default_true_URIs; + false_URIs_ref := default_false_URIs; + absurd_URIs_ref := default_absurd_URIs + + +(**** LOOKUP FUNCTIONS ****) +let eq_URI () = + try let eq,_,_,_,_,_,_,_,_,_,_ = List.hd !eq_URIs_ref in Some eq + with Failure "hd" -> None + +let is_eq_URI uri = + List.exists (fun (eq,_,_,_,_,_,_,_,_,_,_) -> UriManager.eq eq uri) !eq_URIs_ref + +let is_eq_refl_URI uri = + let urieq = UriManager.strip_xpointer uri in + is_eq_URI urieq && + not (UriManager.eq urieq uri) +;; + +let is_eq_ind_URI uri = + List.exists (fun (_,_,_,eq_ind,_,_,_,_,_,_,_) -> UriManager.eq eq_ind uri) !eq_URIs_ref +let is_eq_ind_r_URI uri = + List.exists (fun (_,_,_,_,eq_ind_r,_,_,_,_,_,_) -> UriManager.eq eq_ind_r uri) !eq_URIs_ref +let is_eq_rec_URI uri = + List.exists (fun (_,_,_,_,_,eq_rec,_,_,_,_,_) -> UriManager.eq eq_rec uri) !eq_URIs_ref +let is_eq_rec_r_URI uri = + List.exists (fun (_,_,_,_,_,_,eq_rec_r,_,_,_,_) -> UriManager.eq eq_rec_r uri) !eq_URIs_ref +let is_eq_rect_URI uri = + List.exists (fun (_,_,_,_,_,_,_,eq_rect,_,_,_) -> UriManager.eq eq_rect uri) !eq_URIs_ref +let is_eq_rect_r_URI uri = + List.exists (fun (_,_,_,_,_,_,_,_,eq_rect_r,_,_) -> UriManager.eq eq_rect_r uri) !eq_URIs_ref +let is_trans_eq_URI uri = + List.exists (fun (_,_,trans_eq,_,_,_,_,_,_,_,_) -> UriManager.eq trans_eq uri) !eq_URIs_ref +let is_sym_eq_URI uri = + List.exists (fun (_,sym_eq,_,_,_,_,_,_,_,_,_) -> UriManager.eq sym_eq uri) !eq_URIs_ref +let is_eq_f_URI uri = + List.exists (fun (_,_,_,_,_,_,_,_,_,eq_f,_) -> UriManager.eq eq_f uri) !eq_URIs_ref +let is_eq_f_sym_URI uri = + List.exists (fun (_,_,_,_,_,_,_,_,_,_,eq_f1) -> UriManager.eq eq_f1 uri) !eq_URIs_ref + +let in_eq_URIs uri = + is_eq_URI uri || is_eq_refl_URI uri || is_eq_ind_URI uri || + is_eq_ind_r_URI uri || is_eq_rec_URI uri || is_eq_rec_r_URI uri || + is_eq_rect_URI uri || is_eq_rect_r_URI uri || + is_trans_eq_URI uri || is_sym_eq_URI uri || is_eq_f_URI uri || + is_eq_f_sym_URI uri + + + +let eq_refl_URI ~eq:uri = + let uri = UriManager.strip_xpointer uri in + UriManager.uri_of_string (UriManager.string_of_uri uri ^ "#xpointer(1/1/1)") + +let sym_eq_URI ~eq:uri = + try + let _,x,_,_,_,_,_,_,_,_,_ = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + +let trans_eq_URI ~eq:uri = + try + let _,_,x,_,_,_,_,_,_,_,_ = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + +let eq_ind_URI ~eq:uri = + try + let _,_,_,x,_,_,_,_,_,_,_ = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + +let eq_ind_r_URI ~eq:uri = + try + let _,_,_,_,x,_,_,_,_,_,_ = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + +let eq_rec_URI ~eq:uri = + try + let _,_,_,_,_,x,_,_,_,_,_ = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + +let eq_rec_r_URI ~eq:uri = + try + let _,_,_,_,_,_,x,_,_,_,_ = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + +let eq_rect_URI ~eq:uri = + try + let _,_,_,_,_,_,_,x,_,_,_ = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + +let eq_rect_r_URI ~eq:uri = + try + let _,_,_,_,_,_,_,_,x,_,_ = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + +let eq_f_URI ~eq:uri = + try + let _,_,_,_,_,_,_,_,_,x,_ = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + +let eq_f_sym_URI ~eq:uri = + try + let _,_,_,_,_,_,_,_,_,_,x = List.find (fun eq,_,_,_,_,_,_,_,_,_,_ -> UriManager.eq eq uri) !eq_URIs_ref in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri uri)) + + +let eq_URI_of_eq_f_URI eq_f_URI = + try + let x,_,_,_,_,_,_,_,_,_,_ = + List.find (fun _,_,_,_,_,_,_,_,_,u,_ -> UriManager.eq eq_f_URI u) !eq_URIs_ref + in x + with Not_found -> raise (NotRecognized (UriManager.string_of_uri eq_f_URI)) + +let true_URI () = + try Some (List.hd !true_URIs_ref) with Failure "hd" -> None +let false_URI () = + try Some (List.hd !false_URIs_ref) with Failure "hd" -> None +let absurd_URI () = + try Some (List.hd !absurd_URIs_ref) with Failure "hd" -> None + +let nat_URI = UriManager.uri_of_string "cic:/matita/nat/nat/nat.ind" + +let zero = Cic.MutConstruct (nat_URI,0,1,[]) +let succ = Cic.MutConstruct (nat_URI,0,2,[]) + +let is_zero = function + | Cic.AMutConstruct (_, uri, 0, 1, _) when UriManager.eq uri nat_URI -> true + | _ -> false + +let is_succ = function + | Cic.AMutConstruct (_, uri, 0, 2, _) when UriManager.eq uri nat_URI -> true + | _ -> false + +let build_nat n = + if n < 0 then assert false; + let rec aux = function + | 0 -> zero + | n -> Cic.Appl [ succ; (aux (n - 1)) ] + in + aux n + +let destroy_nat annterm = + let rec aux acc = function + | Cic.AAppl (_, [he ; tl]) when is_succ he -> aux (acc + 1) tl + | t when is_zero t -> Some acc + | _ -> None in + aux 0 annterm + diff --git a/components/cic/libraryObjects.mli b/components/cic/libraryObjects.mli new file mode 100644 index 000000000..bb742f172 --- /dev/null +++ b/components/cic/libraryObjects.mli @@ -0,0 +1,69 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val set_default : string -> UriManager.uri list -> unit +val reset_defaults : unit -> unit + + +val eq_URI : unit -> UriManager.uri option + +val is_eq_URI : UriManager.uri -> bool +val is_eq_refl_URI : UriManager.uri -> bool +val is_eq_ind_URI : UriManager.uri -> bool +val is_eq_ind_r_URI : UriManager.uri -> bool +val is_eq_rec_URI : UriManager.uri -> bool +val is_eq_rec_r_URI : UriManager.uri -> bool +val is_eq_rect_URI : UriManager.uri -> bool +val is_eq_rect_r_URI : UriManager.uri -> bool +val is_trans_eq_URI : UriManager.uri -> bool +val is_sym_eq_URI : UriManager.uri -> bool +val is_eq_f_URI : UriManager.uri -> bool +val is_eq_f_sym_URI : UriManager.uri -> bool +val in_eq_URIs : UriManager.uri -> bool + +val eq_URI_of_eq_f_URI : UriManager.uri -> UriManager.uri + +exception NotRecognized of string;; + +val eq_refl_URI : eq:UriManager.uri -> UriManager.uri +val eq_ind_URI : eq:UriManager.uri -> UriManager.uri +val eq_ind_r_URI : eq:UriManager.uri -> UriManager.uri +val eq_rec_URI : eq:UriManager.uri -> UriManager.uri +val eq_rec_r_URI : eq:UriManager.uri -> UriManager.uri +val eq_rect_URI : eq:UriManager.uri -> UriManager.uri +val eq_rect_r_URI : eq:UriManager.uri -> UriManager.uri +val trans_eq_URI : eq:UriManager.uri -> UriManager.uri +val sym_eq_URI : eq:UriManager.uri -> UriManager.uri +val eq_f_URI : eq:UriManager.uri -> UriManager.uri +val eq_f_sym_URI : eq:UriManager.uri -> UriManager.uri + + +val false_URI : unit -> UriManager.uri option +val true_URI : unit -> UriManager.uri option +val absurd_URI : unit -> UriManager.uri option + +val build_nat : int -> Cic.term +val destroy_nat : Cic.annterm -> int option + diff --git a/components/cic/path_indexing.ml b/components/cic/path_indexing.ml new file mode 100644 index 000000000..c0e4bb2be --- /dev/null +++ b/components/cic/path_indexing.ml @@ -0,0 +1,227 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(* path indexing implementation *) + +(* position of the subterm, subterm (Appl are not stored...) *) + +module PathIndexing = + functor(A:Set.S) -> + struct + +type path_string_elem = Index of int | Term of Cic.term;; +type path_string = path_string_elem list;; + + +let rec path_strings_of_term index = + let module C = Cic in function + | C.Meta _ -> [ [Index index; Term (C.Implicit None)] ] + | C.Appl (hd::tl) -> + let p = if index > 0 then [Index index; Term hd] else [Term hd] in + let _, res = + List.fold_left + (fun (i, r) t -> + let rr = path_strings_of_term i t in + (i+1, r @ (List.map (fun ps -> p @ ps) rr))) + (1, []) tl + in + res + | term -> [ [Index index; Term term] ] +;; + +(* +let string_of_path_string ps = + String.concat "." + (List.map + (fun e -> + let s = + match e with + | Index i -> "Index " ^ (string_of_int i) + | Term t -> "Term " ^ (CicPp.ppterm t) + in + "(" ^ s ^ ")") + ps) +;; +*) + +module OrderedPathStringElement = struct + type t = path_string_elem + + let compare t1 t2 = + match t1, t2 with + | Index i, Index j -> Pervasives.compare i j + | Term t1, Term t2 -> if t1 = t2 then 0 else Pervasives.compare t1 t2 + | Index _, Term _ -> -1 + | Term _, Index _ -> 1 +end + +module PSMap = Map.Make(OrderedPathStringElement);; + +module PSTrie = Trie.Make(PSMap);; + +type t = A.t PSTrie.t +type key = Cic.term +let empty = PSTrie.empty +let arities = Hashtbl.create 0 + +let index trie term info = + let ps = path_strings_of_term 0 term in + List.fold_left + (fun trie ps -> + let ps_set = try PSTrie.find ps trie with Not_found -> A.empty in + let trie = PSTrie.add ps (A.add info ps_set) trie in + trie) trie ps + +let remove_index trie term info= + let ps = path_strings_of_term 0 term in + List.fold_left + (fun trie ps -> + try + let ps_set = A.remove info (PSTrie.find ps trie) in + if A.is_empty ps_set then + PSTrie.remove ps trie + else + PSTrie.add ps ps_set trie + with Not_found -> trie) trie ps +;; + +let in_index trie term test = + let ps = path_strings_of_term 0 term in + let ok ps = + try + let set = PSTrie.find ps trie in + A.exists test set + with Not_found -> + false + in + List.exists ok ps +;; + + +let head_of_term = function + | Cic.Appl (hd::tl) -> hd + | term -> term +;; + + +let subterm_at_pos index term = + if index = 0 then + term + else + match term with + | Cic.Appl l -> + (try List.nth l index with Failure _ -> raise Not_found) + | _ -> raise Not_found +;; + + +let rec retrieve_generalizations trie term = + match trie with + | PSTrie.Node (value, map) -> + let res = + match term with + | Cic.Meta _ -> A.empty + | term -> + let hd_term = head_of_term term in + try + let n = PSMap.find (Term hd_term) map in + match n with + | PSTrie.Node (Some s, _) -> s + | PSTrie.Node (None, m) -> + let l = + PSMap.fold + (fun k v res -> + match k with + | Index i -> + let t = subterm_at_pos i term in + let s = retrieve_generalizations v t in + s::res + | _ -> res) + m [] + in + match l with + | hd::tl -> + List.fold_left (fun r s -> A.inter r s) hd tl + | _ -> A.empty + with Not_found -> + A.empty + in + try + let n = PSMap.find (Term (Cic.Implicit None)) map in + match n with + | PSTrie.Node (Some s, _) -> A.union res s + | _ -> res + with Not_found -> + res +;; + + +let rec retrieve_unifiables trie term = + match trie with + | PSTrie.Node (value, map) -> + let res = + match term with + | Cic.Meta _ -> + PSTrie.fold + (fun ps v res -> A.union res v) + (PSTrie.Node (None, map)) + A.empty + | _ -> + let hd_term = head_of_term term in + try + let n = PSMap.find (Term hd_term) map in + match n with + | PSTrie.Node (Some v, _) -> v + | PSTrie.Node (None, m) -> + let l = + PSMap.fold + (fun k v res -> + match k with + | Index i -> + let t = subterm_at_pos i term in + let s = retrieve_unifiables v t in + s::res + | _ -> res) + m [] + in + match l with + | hd::tl -> + List.fold_left (fun r s -> A.inter r s) hd tl + | _ -> A.empty + with Not_found -> + A.empty + in + try + let n = PSMap.find (Term (Cic.Implicit None)) map in + match n with + | PSTrie.Node (Some s, _) -> A.union res s + | _ -> res + with Not_found -> + res +;; + +end diff --git a/components/cic/path_indexing.mli b/components/cic/path_indexing.mli new file mode 100644 index 000000000..899901618 --- /dev/null +++ b/components/cic/path_indexing.mli @@ -0,0 +1,42 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module PathIndexing : + functor (A : Set.S) -> + sig + val arities : (Cic.term, int) Hashtbl.t + + type key = Cic.term + type t + + val empty : t + val index : t -> key -> A.elt -> t + val remove_index : t -> key -> A.elt -> t + val in_index : t -> key -> (A.elt -> bool) -> bool + val retrieve_generalizations : t -> key -> A.t + val retrieve_unifiables : t -> key -> A.t + end + + diff --git a/components/cic/unshare.ml b/components/cic/unshare.ml new file mode 100644 index 000000000..e198bcd49 --- /dev/null +++ b/components/cic/unshare.ml @@ -0,0 +1,84 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +let rec unshare = + let module C = Cic in + function + C.Rel m -> C.Rel m + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,unshare t)) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (i,l) -> + let l' = + List.map + (function + None -> None + | Some t -> Some (unshare t) + ) l + in + C.Meta(i,l') + | C.Sort s -> C.Sort s + | C.Implicit info -> C.Implicit info + | C.Cast (te,ty) -> C.Cast (unshare te, unshare ty) + | C.Prod (n,s,t) -> C.Prod (n, unshare s, unshare t) + | C.Lambda (n,s,t) -> C.Lambda (n, unshare s, unshare t) + | C.LetIn (n,s,t) -> C.LetIn (n, unshare s, unshare t) + | C.Appl l -> C.Appl (List.map unshare l) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,unshare t)) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,unshare t)) exp_named_subst + in + C.MutInd (uri,tyno,exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,unshare t)) exp_named_subst + in + C.MutConstruct (uri,tyno,consno,exp_named_subst') + | C.MutCase (sp,i,outty,t,pl) -> + C.MutCase (sp, i, unshare outty, unshare t, + List.map unshare pl) + | C.Fix (i, fl) -> + let liftedfl = + List.map + (fun (name, i, ty, bo) -> (name, i, unshare ty, unshare bo)) + fl + in + C.Fix (i, liftedfl) + | C.CoFix (i, fl) -> + let liftedfl = + List.map + (fun (name, ty, bo) -> (name, unshare ty, unshare bo)) + fl + in + C.CoFix (i, liftedfl) diff --git a/components/cic/unshare.mli b/components/cic/unshare.mli new file mode 100644 index 000000000..5582abcbf --- /dev/null +++ b/components/cic/unshare.mli @@ -0,0 +1,26 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val unshare : Cic.term -> Cic.term diff --git a/components/cic_acic/.depend b/components/cic_acic/.depend new file mode 100644 index 000000000..3fc1e0dce --- /dev/null +++ b/components/cic_acic/.depend @@ -0,0 +1,9 @@ +cic2Xml.cmi: cic2acic.cmi +eta_fixing.cmo: eta_fixing.cmi +eta_fixing.cmx: eta_fixing.cmi +doubleTypeInference.cmo: doubleTypeInference.cmi +doubleTypeInference.cmx: doubleTypeInference.cmi +cic2acic.cmo: eta_fixing.cmi doubleTypeInference.cmi cic2acic.cmi +cic2acic.cmx: eta_fixing.cmx doubleTypeInference.cmx cic2acic.cmi +cic2Xml.cmo: cic2acic.cmi cic2Xml.cmi +cic2Xml.cmx: cic2acic.cmx cic2Xml.cmi diff --git a/components/cic_acic/.depend.opt b/components/cic_acic/.depend.opt new file mode 100644 index 000000000..3fc1e0dce --- /dev/null +++ b/components/cic_acic/.depend.opt @@ -0,0 +1,9 @@ +cic2Xml.cmi: cic2acic.cmi +eta_fixing.cmo: eta_fixing.cmi +eta_fixing.cmx: eta_fixing.cmi +doubleTypeInference.cmo: doubleTypeInference.cmi +doubleTypeInference.cmx: doubleTypeInference.cmi +cic2acic.cmo: eta_fixing.cmi doubleTypeInference.cmi cic2acic.cmi +cic2acic.cmx: eta_fixing.cmx doubleTypeInference.cmx cic2acic.cmi +cic2Xml.cmo: cic2acic.cmi cic2Xml.cmi +cic2Xml.cmx: cic2acic.cmx cic2Xml.cmi diff --git a/components/cic_acic/Makefile b/components/cic_acic/Makefile new file mode 100644 index 000000000..2669afb11 --- /dev/null +++ b/components/cic_acic/Makefile @@ -0,0 +1,13 @@ +PACKAGE = cic_acic +PREDICATES = + +INTERFACE_FILES = \ + eta_fixing.mli \ + doubleTypeInference.mli \ + cic2acic.mli \ + cic2Xml.mli \ + $(NULL) +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/cic_acic/cic2Xml.ml b/components/cic_acic/cic2Xml.ml new file mode 100644 index 000000000..eb3b93408 --- /dev/null +++ b/components/cic_acic/cic2Xml.ml @@ -0,0 +1,493 @@ +(* Copyright (C) 2000-2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +(*CSC codice cut & paste da cicPp e xmlcommand *) + +exception NotImplemented;; + +let dtdname ~ask_dtd_to_the_getter dtd = + if ask_dtd_to_the_getter then + Helm_registry.get "getter.url" ^ "getdtd?uri=" ^ dtd + else + "http://mowgli.cs.unibo.it/dtd/" ^ dtd +;; + +let param_attribute_of_params params = + String.concat " " (List.map UriManager.string_of_uri params) +;; + +(*CSC ottimizzazione: al posto di curi cdepth (vedi codice) *) +let print_term ?ids_to_inner_sorts = + let find_sort name id = + match ids_to_inner_sorts with + None -> [] + | Some ids_to_inner_sorts -> + [None,name,Cic2acic.string_of_sort (Hashtbl.find ids_to_inner_sorts id)] + in + let rec aux = + let module C = Cic in + let module X = Xml in + let module U = UriManager in + function + C.ARel (id,idref,n,b) -> + let sort = find_sort "sort" id in + X.xml_empty "REL" + (sort @ + [None,"value",(string_of_int n) ; None,"binder",b ; None,"id",id ; + None,"idref",idref]) + | C.AVar (id,uri,exp_named_subst) -> + let sort = find_sort "sort" id in + aux_subst uri + (X.xml_empty "VAR" + (sort @ [None,"uri",U.string_of_uri uri;None,"id",id])) + exp_named_subst + | C.AMeta (id,n,l) -> + let sort = find_sort "sort" id in + X.xml_nempty "META" + (sort @ [None,"no",(string_of_int n) ; None,"id",id]) + (List.fold_left + (fun i t -> + match t with + Some t' -> + [< i ; X.xml_nempty "substitution" [] (aux t') >] + | None -> + [< i ; X.xml_empty "substitution" [] >] + ) [< >] l) + | C.ASort (id,s) -> + let string_of_sort s = + Cic2acic.string_of_sort (Cic2acic.sort_of_sort s) + in + X.xml_empty "SORT" [None,"value",(string_of_sort s) ; None,"id",id] + | C.AImplicit _ -> raise NotImplemented + | C.AProd (last_id,_,_,_) as prods -> + let rec eat_prods = + function + C.AProd (id,n,s,t) -> + let prods,t' = eat_prods t in + (id,n,s)::prods,t' + | t -> [],t + in + let prods,t = eat_prods prods in + let sort = find_sort "type" last_id in + X.xml_nempty "PROD" sort + [< List.fold_left + (fun i (id,binder,s) -> + let sort = find_sort "type" (Cic2acic.source_id_of_id id) in + let attrs = + sort @ ((None,"id",id):: + match binder with + C.Anonymous -> [] + | C.Name b -> [None,"binder",b]) + in + [< i ; X.xml_nempty "decl" attrs (aux s) >] + ) [< >] prods ; + X.xml_nempty "target" [] (aux t) + >] + | C.ACast (id,v,t) -> + let sort = find_sort "sort" id in + X.xml_nempty "CAST" (sort @ [None,"id",id]) + [< X.xml_nempty "term" [] (aux v) ; + X.xml_nempty "type" [] (aux t) + >] + | C.ALambda (last_id,_,_,_) as lambdas -> + let rec eat_lambdas = + function + C.ALambda (id,n,s,t) -> + let lambdas,t' = eat_lambdas t in + (id,n,s)::lambdas,t' + | t -> [],t + in + let lambdas,t = eat_lambdas lambdas in + let sort = find_sort "sort" last_id in + X.xml_nempty "LAMBDA" sort + [< List.fold_left + (fun i (id,binder,s) -> + let sort = find_sort "type" (Cic2acic.source_id_of_id id) in + let attrs = + sort @ ((None,"id",id):: + match binder with + C.Anonymous -> [] + | C.Name b -> [None,"binder",b]) + in + [< i ; X.xml_nempty "decl" attrs (aux s) >] + ) [< >] lambdas ; + X.xml_nempty "target" [] (aux t) + >] + | C.ALetIn (xid,C.Anonymous,s,t) -> + assert false + | C.ALetIn (last_id,C.Name _,_,_) as letins -> + let rec eat_letins = + function + C.ALetIn (id,n,s,t) -> + let letins,t' = eat_letins t in + (id,n,s)::letins,t' + | t -> [],t + in + let letins,t = eat_letins letins in + let sort = find_sort "sort" last_id in + X.xml_nempty "LETIN" sort + [< List.fold_left + (fun i (id,binder,s) -> + let sort = find_sort "sort" id in + let attrs = + sort @ ((None,"id",id):: + match binder with + C.Anonymous -> [] + | C.Name b -> [None,"binder",b]) + in + [< i ; X.xml_nempty "def" attrs (aux s) >] + ) [< >] letins ; + X.xml_nempty "target" [] (aux t) + >] + | C.AAppl (id,li) -> + let sort = find_sort "sort" id in + X.xml_nempty "APPLY" (sort @ [None,"id",id]) + [< (List.fold_right (fun x i -> [< (aux x) ; i >]) li [<>]) + >] + | C.AConst (id,uri,exp_named_subst) -> + let sort = find_sort "sort" id in + aux_subst uri + (X.xml_empty "CONST" + (sort @ [None,"uri",(U.string_of_uri uri) ; None,"id",id]) + ) exp_named_subst + | C.AMutInd (id,uri,i,exp_named_subst) -> + aux_subst uri + (X.xml_empty "MUTIND" + [None, "uri", (U.string_of_uri uri) ; + None, "noType", (string_of_int i) ; + None, "id", id] + ) exp_named_subst + | C.AMutConstruct (id,uri,i,j,exp_named_subst) -> + let sort = find_sort "sort" id in + aux_subst uri + (X.xml_empty "MUTCONSTRUCT" + (sort @ + [None,"uri", (U.string_of_uri uri) ; + None,"noType",(string_of_int i) ; + None,"noConstr",(string_of_int j) ; + None,"id",id]) + ) exp_named_subst + | C.AMutCase (id,uri,typeno,ty,te,patterns) -> + let sort = find_sort "sort" id in + X.xml_nempty "MUTCASE" + (sort @ + [None,"uriType",(U.string_of_uri uri) ; + None,"noType", (string_of_int typeno) ; + None,"id", id]) + [< X.xml_nempty "patternsType" [] [< (aux ty) >] ; + X.xml_nempty "inductiveTerm" [] [< (aux te) >] ; + List.fold_right + (fun x i -> [< X.xml_nempty "pattern" [] [< aux x >] ; i>]) + patterns [<>] + >] + | C.AFix (id, no, funs) -> + let sort = find_sort "sort" id in + X.xml_nempty "FIX" + (sort @ [None,"noFun", (string_of_int no) ; None,"id",id]) + [< List.fold_right + (fun (id,fi,ai,ti,bi) i -> + [< X.xml_nempty "FixFunction" + [None,"id",id ; None,"name", fi ; + None,"recIndex", (string_of_int ai)] + [< X.xml_nempty "type" [] [< aux ti >] ; + X.xml_nempty "body" [] [< aux bi >] + >] ; + i + >] + ) funs [<>] + >] + | C.ACoFix (id,no,funs) -> + let sort = find_sort "sort" id in + X.xml_nempty "COFIX" + (sort @ [None,"noFun", (string_of_int no) ; None,"id",id]) + [< List.fold_right + (fun (id,fi,ti,bi) i -> + [< X.xml_nempty "CofixFunction" [None,"id",id ; None,"name", fi] + [< X.xml_nempty "type" [] [< aux ti >] ; + X.xml_nempty "body" [] [< aux bi >] + >] ; + i + >] + ) funs [<>] + >] + and aux_subst buri target subst = +(*CSC: I have now no way to assign an ID to the explicit named substitution *) + let id = None in + if subst = [] then + target + else + Xml.xml_nempty "instantiate" + (match id with None -> [] | Some id -> [None,"id",id]) + [< target ; + List.fold_left + (fun i (uri,arg) -> + let relUri = + let buri_frags = + Str.split (Str.regexp "/") (UriManager.string_of_uri buri) in + let uri_frags = + Str.split (Str.regexp "/") (UriManager.string_of_uri uri) in + let rec find_relUri buri_frags uri_frags = + match buri_frags,uri_frags with + [_], _ -> String.concat "/" uri_frags + | he1::tl1, he2::tl2 -> + assert (he1 = he2) ; + find_relUri tl1 tl2 + | _,_ -> assert false (* uri is not relative to buri *) + in + find_relUri buri_frags uri_frags + in + [< i ; Xml.xml_nempty "arg" [None,"relUri", relUri] (aux arg) >] + ) [<>] subst + >] + in + aux +;; + +let xml_of_attrs generate_attributes attributes = + let class_of = function + | `Coercion n -> + Xml.xml_empty "class" [None,"value","coercion";None,"arity",string_of_int n] + | `Elim s -> + Xml.xml_nempty "class" [None,"value","elim"] + [< Xml.xml_empty + "SORT" [None,"value", + (Cic2acic.string_of_sort (Cic2acic.sort_of_sort s)) ; + None,"id","elimination_sort"] >] + | `Record field_names -> + Xml.xml_nempty "class" [None,"value","record"] + (List.fold_right + (fun (name,coercion,arity) res -> + [< Xml.xml_empty "field" + [None,"name", + if coercion then + name ^ " coercion " ^ string_of_int arity + else + name]; + res >] + ) field_names [<>]) + | `Projection -> Xml.xml_empty "class" [None,"value","projection"] + | `InversionPrinciple -> Xml.xml_empty "class" [None,"value","inversion"] + in + let flavour_of = function + | `Definition -> Xml.xml_empty "flavour" [None, "value", "definition"] + | `MutualDefinition -> + Xml.xml_empty "flavour" [None, "value", "mutual_definition"] + | `Fact -> Xml.xml_empty "flavour" [None, "value", "fact"] + | `Lemma -> Xml.xml_empty "flavour" [None, "value", "lemma"] + | `Remark -> Xml.xml_empty "flavour" [None, "value", "remark"] + | `Theorem -> Xml.xml_empty "flavour" [None, "value", "theorem"] + | `Variant -> Xml.xml_empty "flavour" [None, "value", "variant"] + | `Axiom -> Xml.xml_empty "flavour" [None, "value", "axiom"] + in + let xml_attr_of = function + | `Generated -> Xml.xml_empty "generated" [] + | `Class c -> class_of c + | `Flavour f -> flavour_of f + in + let xml_attrs = + List.fold_right + (fun attr res -> [< xml_attr_of attr ; res >]) attributes [<>] + in + if generate_attributes then Xml.xml_nempty "attributes" [] xml_attrs else [<>] + +let print_object uri + ?ids_to_inner_sorts ?(generate_attributes=true) ~ask_dtd_to_the_getter obj = + let module C = Cic in + let module X = Xml in + let module U = UriManager in + let dtdname = dtdname ~ask_dtd_to_the_getter "cic.dtd" in + match obj with + C.ACurrentProof (id,idbody,n,conjectures,bo,ty,params,obj_attrs) -> + let params' = param_attribute_of_params params in + let xml_attrs = xml_of_attrs generate_attributes obj_attrs in + let xml_for_current_proof_body = +(*CSC: Should the CurrentProof also have the list of variables it depends on? *) +(*CSC: I think so. Not implemented yet. *) + X.xml_nempty "CurrentProof" + [None,"of",UriManager.string_of_uri uri ; None,"id", id] + [< xml_attrs; + List.fold_left + (fun i (cid,n,canonical_context,t) -> + [< i ; + X.xml_nempty "Conjecture" + [None,"id",cid ; None,"no",(string_of_int n)] + [< List.fold_left + (fun i (hid,t) -> + [< (match t with + Some (n,C.ADecl t) -> + X.xml_nempty "Decl" + (match n with + C.Name n' -> + [None,"id",hid;None,"name",n'] + | C.Anonymous -> [None,"id",hid]) + (print_term ?ids_to_inner_sorts t) + | Some (n,C.ADef t) -> + X.xml_nempty "Def" + (match n with + C.Name n' -> + [None,"id",hid;None,"name",n'] + | C.Anonymous -> [None,"id",hid]) + (print_term ?ids_to_inner_sorts t) + | None -> X.xml_empty "Hidden" [None,"id",hid] + ) ; + i + >] + ) [< >] canonical_context ; + X.xml_nempty "Goal" [] + (print_term ?ids_to_inner_sorts t) + >] + >]) + [< >] conjectures ; + X.xml_nempty "body" [] (print_term ?ids_to_inner_sorts bo) >] + in + let xml_for_current_proof_type = + X.xml_nempty "ConstantType" + [None,"name",n ; None,"params",params' ; None,"id", id] + (print_term ?ids_to_inner_sorts ty) + in + let xmlbo = + [< X.xml_cdata "\n" ; + X.xml_cdata ("\n"); + xml_for_current_proof_body + >] in + let xmlty = + [< X.xml_cdata "\n" ; + X.xml_cdata ("\n"); + xml_for_current_proof_type + >] + in + xmlty, Some xmlbo + | C.AConstant (id,idbody,n,bo,ty,params,obj_attrs) -> + let params' = param_attribute_of_params params in + let xml_attrs = xml_of_attrs generate_attributes obj_attrs in + let xmlbo = + match bo with + None -> None + | Some bo -> + Some + [< X.xml_cdata + "\n" ; + X.xml_cdata + ("\n") ; + X.xml_nempty "ConstantBody" + [None,"for",UriManager.string_of_uri uri ; + None,"params",params' ; None,"id", id] + [< print_term ?ids_to_inner_sorts bo >] + >] + in + let xmlty = + [< X.xml_cdata "\n" ; + X.xml_cdata ("\n"); + X.xml_nempty "ConstantType" + [None,"name",n ; None,"params",params' ; None,"id", id] + [< xml_attrs; print_term ?ids_to_inner_sorts ty >] + >] + in + xmlty, xmlbo + | C.AVariable (id,n,bo,ty,params,obj_attrs) -> + let params' = param_attribute_of_params params in + let xml_attrs = xml_of_attrs generate_attributes obj_attrs in + let xmlbo = + match bo with + None -> [< >] + | Some bo -> + X.xml_nempty "body" [] [< print_term ?ids_to_inner_sorts bo >] + in + let aobj = + [< X.xml_cdata "\n" ; + X.xml_cdata ("\n"); + X.xml_nempty "Variable" + [None,"name",n ; None,"params",params' ; None,"id", id] + [< xml_attrs; xmlbo; + X.xml_nempty "type" [] (print_term ?ids_to_inner_sorts ty) + >] + >] + in + aobj, None + | C.AInductiveDefinition (id,tys,params,nparams,obj_attrs) -> + let params' = param_attribute_of_params params in + let xml_attrs = xml_of_attrs generate_attributes obj_attrs in + [< X.xml_cdata "\n" ; + X.xml_cdata + ("\n") ; + X.xml_nempty "InductiveDefinition" + [None,"noParams",string_of_int nparams ; + None,"id",id ; + None,"params",params'] + [< xml_attrs; + (List.fold_left + (fun i (id,typename,finite,arity,cons) -> + [< i ; + X.xml_nempty "InductiveType" + [None,"id",id ; None,"name",typename ; + None,"inductive",(string_of_bool finite) + ] + [< X.xml_nempty "arity" [] + (print_term ?ids_to_inner_sorts arity) ; + (List.fold_left + (fun i (name,lc) -> + [< i ; + X.xml_nempty "Constructor" + [None,"name",name] + (print_term ?ids_to_inner_sorts lc) + >]) [<>] cons + ) + >] + >] + ) [< >] tys + ) + >] + >], None +;; + +let + print_inner_types curi ~ids_to_inner_sorts ~ids_to_inner_types + ~ask_dtd_to_the_getter += + let module C2A = Cic2acic in + let module X = Xml in + let dtdname = dtdname ~ask_dtd_to_the_getter "cictypes.dtd" in + [< X.xml_cdata "\n" ; + X.xml_cdata + ("\n") ; + X.xml_nempty "InnerTypes" [None,"of",UriManager.string_of_uri curi] + (Hashtbl.fold + (fun id {C2A.annsynthesized = synty ; C2A.annexpected = expty} x -> + [< x ; + X.xml_nempty "TYPE" [None,"of",id] + [< X.xml_nempty "synthesized" [] + [< print_term ~ids_to_inner_sorts synty >] ; + match expty with + None -> [<>] + | Some expty' -> X.xml_nempty "expected" [] + [< print_term ~ids_to_inner_sorts expty' >] + >] + >] + ) ids_to_inner_types [<>] + ) + >] +;; diff --git a/components/cic_acic/cic2Xml.mli b/components/cic_acic/cic2Xml.mli new file mode 100644 index 000000000..dcbff3d0f --- /dev/null +++ b/components/cic_acic/cic2Xml.mli @@ -0,0 +1,47 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception NotImplemented + +val print_term : + ?ids_to_inner_sorts: (string, Cic2acic.sort_kind) Hashtbl.t -> + Cic.annterm -> + Xml.token Stream.t + +val print_object : + UriManager.uri -> + ?ids_to_inner_sorts: (string, Cic2acic.sort_kind) Hashtbl.t -> + ?generate_attributes:bool -> + ask_dtd_to_the_getter:bool -> + Cic.annobj -> + Xml.token Stream.t * Xml.token Stream.t option + +val print_inner_types : + UriManager.uri -> + ids_to_inner_sorts: (string, Cic2acic.sort_kind) Hashtbl.t -> + ids_to_inner_types: (string, Cic2acic.anntypes) Hashtbl.t -> + ask_dtd_to_the_getter:bool -> + Xml.token Stream.t + diff --git a/components/cic_acic/cic2acic.ml b/components/cic_acic/cic2acic.ml new file mode 100644 index 000000000..bb00476b9 --- /dev/null +++ b/components/cic_acic/cic2acic.ml @@ -0,0 +1,774 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +type sort_kind = [ `Prop | `Set | `Type of CicUniv.universe | `CProp ] + +let string_of_sort = function + | `Prop -> "Prop" + | `Set -> "Set" + | `Type u -> "Type:" ^ string_of_int (CicUniv.univno u) + | `CProp -> "CProp" + +let sort_of_sort = function + | Cic.Prop -> `Prop + | Cic.Set -> `Set + | Cic.Type u -> `Type u + | Cic.CProp -> `CProp + +(* let hashtbl_add_time = ref 0.0;; *) + +let xxx_add_profiler = HExtlib.profile "xxx_add";; +let xxx_add h k v = + xxx_add_profiler.HExtlib.profile (Hashtbl.add h k) v +;; + +let xxx_type_of_aux' m c t = + let res,_ = + try + CicTypeChecker.type_of_aux' m c t CicUniv.empty_ugraph + with + | CicTypeChecker.AssertFailure _ + | CicTypeChecker.TypeCheckerFailure _ -> + Cic.Sort Cic.Prop, CicUniv.empty_ugraph + in + res +;; + +let xxx_type_of_aux'_profiler = HExtlib.profile "xxx_type_of_aux'";; +let xxx_type_of_aux' m c t = + xxx_type_of_aux'_profiler.HExtlib.profile (xxx_type_of_aux' m c) t + +type anntypes = + {annsynthesized : Cic.annterm ; annexpected : Cic.annterm option} +;; + +let gen_id seed = + let res = "i" ^ string_of_int !seed in + incr seed ; + res +;; + +let fresh_id seed ids_to_terms ids_to_father_ids = + fun father t -> + let res = gen_id seed in + xxx_add ids_to_father_ids res father ; + xxx_add ids_to_terms res t ; + res +;; + +let source_id_of_id id = "#source#" ^ id;; + +exception NotEnoughElements of string;; + +(*CSC: cut&paste da cicPp.ml *) +(* get_nth l n returns the nth element of the list l if it exists or *) +(* raises NotEnoughElements if l has less than n elements *) +let rec get_nth msg l n = + match (n,l) with + (1, he::_) -> he + | (n, he::tail) when n > 1 -> get_nth msg tail (n-1) + | (_,_) -> raise (NotEnoughElements msg) +;; + + +let profiler_for_find = HExtlib.profile "CicHash" ;; +let profiler_for_whd = HExtlib.profile "whd" ;; + +let cic_CicHash_find a b = + profiler_for_find.HExtlib.profile (Cic.CicHash.find a) b +;; + +let cicReduction_whd c t = + profiler_for_whd.HExtlib.profile (CicReduction.whd c) t +;; + +let acic_of_cic_context' ~computeinnertypes:global_computeinnertypes + seed ids_to_terms ids_to_father_ids ids_to_inner_sorts ids_to_inner_types + metasenv context idrefs t expectedty += + let module D = DoubleTypeInference in + let module C = Cic in + let fresh_id' = fresh_id seed ids_to_terms ids_to_father_ids in +(* let time1 = Sys.time () in *) + let terms_to_types = +(* + let time0 = Sys.time () in + let prova = CicTypeChecker.type_of_aux' metasenv context t in + let time1 = Sys.time () in + prerr_endline ("*** Fine type_inference:" ^ (string_of_float (time1 -. time0))); + let res = D.double_type_of metasenv context t expectedty in + let time2 = Sys.time () in + prerr_endline ("*** Fine double_type_inference:" ^ (string_of_float (time2 -. time1))); + res +*) + if global_computeinnertypes then + D.double_type_of metasenv context t expectedty + else + Cic.CicHash.create 1 (* empty table *) + in +(* + let time2 = Sys.time () in + prerr_endline + ("++++++++++++ Tempi della double_type_of: "^ string_of_float (time2 -. time1)) ; +*) + let rec aux computeinnertypes father context idrefs tt = + let fresh_id'' = fresh_id' father tt in + (*CSC: computeinnertypes era true, il che e' proprio sbagliato, no? *) + (* First of all we compute the inner type and the inner sort *) + (* of the term. They may be useful in what follows. *) + (*CSC: This is a very inefficient way of computing inner types *) + (*CSC: and inner sorts: very deep terms have their types/sorts *) + (*CSC: computed again and again. *) + let sort_of t = + match cicReduction_whd context t with + C.Sort C.Prop -> `Prop + | C.Sort C.Set -> `Set + | C.Sort (C.Type u) -> `Type u + | C.Meta _ -> `Type (CicUniv.fresh()) + | C.Sort C.CProp -> `CProp + | t -> + prerr_endline ("Cic2acic.sort_of applied to: " ^ CicPp.ppterm t) ; + assert false + in + let ainnertypes,innertype,innersort,expected_available = + +(*CSC: Here we need the algorithm for Coscoy's double type-inference *) +(*CSC: (expected type + inferred type). Just for now we use the usual *) +(*CSC: type-inference, but the result is very poor. As a very weak *) +(*CSC: patch, I apply whd to the computed type. Full beta *) +(*CSC: reduction would be a much better option. *) +(*CSC: solo per testare i tempi *) +(*XXXXXXX *) + try +(* *) + let {D.synthesized = synthesized; D.expected = expected} = + if computeinnertypes then + cic_CicHash_find terms_to_types tt + else + (* We are already in an inner-type and Coscoy's double *) + (* type inference algorithm has not been applied. *) + { D.synthesized = +(***CSC: patch per provare i tempi + CicReduction.whd context (xxx_type_of_aux' metasenv context tt) ; *) + (*if global_computeinnertypes then + Cic.Sort (Cic.Type (CicUniv.fresh())) + else*) + cicReduction_whd context (xxx_type_of_aux' metasenv context tt); + D.expected = None} + in +(* incr number_new_type_of_aux' ; *) + let innersort = (*XXXXX *) xxx_type_of_aux' metasenv context synthesized (* Cic.Sort Cic.Prop *) in + let ainnertypes,expected_available = + if computeinnertypes then + let annexpected,expected_available = + match expected with + None -> None,false + | Some expectedty' -> + Some + (aux false (Some fresh_id'') context idrefs expectedty'), + true + in + Some + {annsynthesized = + aux false (Some fresh_id'') context idrefs synthesized ; + annexpected = annexpected + }, expected_available + else + None,false + in + ainnertypes,synthesized, sort_of innersort, expected_available +(*XXXXXXXX *) + with + Not_found -> (* l'inner-type non e' nella tabella ==> sort <> Prop *) + (* CSC: Type or Set? I can not tell *) + let u = CicUniv.fresh() in + None,Cic.Sort (Cic.Type u),`Type u,false + (* TASSI non dovrebbe fare danni *) +(* *) + in + let aux' = + if innersort = `Prop then + aux computeinnertypes (Some fresh_id'') + else + aux false (Some fresh_id'') + in + let add_inner_type id = + match ainnertypes with + None -> () + | Some ainnertypes -> xxx_add ids_to_inner_types id ainnertypes + in + match tt with + C.Rel n -> + let id = + match get_nth "1" context n with + (Some (C.Name s,_)) -> s + | _ -> "__" ^ string_of_int n + in + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop && expected_available then + add_inner_type fresh_id'' ; + C.ARel (fresh_id'', List.nth idrefs (n-1), n, id) + | C.Var (uri,exp_named_subst) -> + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop && expected_available then + add_inner_type fresh_id'' ; + let exp_named_subst' = + List.map + (function i,t -> i, (aux' context idrefs t)) exp_named_subst + in + C.AVar (fresh_id'', uri,exp_named_subst') + | C.Meta (n,l) -> + let (_,canonical_context,_) = CicUtil.lookup_meta n metasenv in + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop && expected_available then + add_inner_type fresh_id'' ; + C.AMeta (fresh_id'', n, + (List.map2 + (fun ct t -> + match (ct, t) with + | None, _ -> None + | _, Some t -> Some (aux' context idrefs t) + | Some _, None -> assert false (* due to typing rules *)) + canonical_context l)) + | C.Sort s -> C.ASort (fresh_id'', s) + | C.Implicit annotation -> C.AImplicit (fresh_id'', annotation) + | C.Cast (v,t) -> + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop then + add_inner_type fresh_id'' ; + C.ACast (fresh_id'', aux' context idrefs v, aux' context idrefs t) + | C.Prod (n,s,t) -> + xxx_add ids_to_inner_sorts fresh_id'' + (sort_of innertype) ; + let sourcetype = xxx_type_of_aux' metasenv context s in + xxx_add ids_to_inner_sorts (source_id_of_id fresh_id'') + (sort_of sourcetype) ; + let n' = + match n with + C.Anonymous -> n + | C.Name n' -> + if DoubleTypeInference.does_not_occur 1 t then + C.Anonymous + else + C.Name n' + in + C.AProd + (fresh_id'', n', aux' context idrefs s, + aux' ((Some (n, C.Decl s))::context) (fresh_id''::idrefs) t) + | C.Lambda (n,s,t) -> + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + let sourcetype = xxx_type_of_aux' metasenv context s in + xxx_add ids_to_inner_sorts (source_id_of_id fresh_id'') + (sort_of sourcetype) ; + if innersort = `Prop then + begin + let father_is_lambda = + match father with + None -> false + | Some father' -> + match Hashtbl.find ids_to_terms father' with + C.Lambda _ -> true + | _ -> false + in + if (not father_is_lambda) || expected_available then + add_inner_type fresh_id'' + end ; + C.ALambda + (fresh_id'',n, aux' context idrefs s, + aux' ((Some (n, C.Decl s)::context)) (fresh_id''::idrefs) t) + | C.LetIn (n,s,t) -> + let s_ty = + try + (cic_CicHash_find terms_to_types s).D.synthesized + with + Not_found -> + cicReduction_whd context (xxx_type_of_aux' metasenv context s); + in + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop then + add_inner_type fresh_id'' ; + C.ALetIn + (fresh_id'', n, aux' context idrefs s, + aux' ((Some (n, C.Def(s,Some s_ty)))::context) (fresh_id''::idrefs) t) + | C.Appl l -> + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop then + add_inner_type fresh_id'' ; + C.AAppl (fresh_id'', List.map (aux' context idrefs) l) + | C.Const (uri,exp_named_subst) -> + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop && expected_available then + add_inner_type fresh_id'' ; + let exp_named_subst' = + List.map + (function i,t -> i, (aux' context idrefs t)) exp_named_subst + in + C.AConst (fresh_id'', uri, exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst' = + List.map + (function i,t -> i, (aux' context idrefs t)) exp_named_subst + in + C.AMutInd (fresh_id'', uri, tyno, exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop && expected_available then + add_inner_type fresh_id'' ; + let exp_named_subst' = + List.map + (function i,t -> i, (aux' context idrefs t)) exp_named_subst + in + C.AMutConstruct (fresh_id'', uri, tyno, consno, exp_named_subst') + | C.MutCase (uri, tyno, outty, term, patterns) -> + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop then + add_inner_type fresh_id'' ; + C.AMutCase (fresh_id'', uri, tyno, aux' context idrefs outty, + aux' context idrefs term, List.map (aux' context idrefs) patterns) + | C.Fix (funno, funs) -> + let fresh_idrefs = + List.map (function _ -> gen_id seed) funs in + let new_idrefs = List.rev fresh_idrefs @ idrefs in + let tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) funs + in + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop then + add_inner_type fresh_id'' ; + C.AFix (fresh_id'', funno, + List.map2 + (fun id (name, indidx, ty, bo) -> + (id, name, indidx, aux' context idrefs ty, + aux' (tys@context) new_idrefs bo) + ) fresh_idrefs funs + ) + | C.CoFix (funno, funs) -> + let fresh_idrefs = + List.map (function _ -> gen_id seed) funs in + let new_idrefs = List.rev fresh_idrefs @ idrefs in + let tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) funs + in + xxx_add ids_to_inner_sorts fresh_id'' innersort ; + if innersort = `Prop then + add_inner_type fresh_id'' ; + C.ACoFix (fresh_id'', funno, + List.map2 + (fun id (name, ty, bo) -> + (id, name, aux' context idrefs ty, + aux' (tys@context) new_idrefs bo) + ) fresh_idrefs funs + ) + in +(* + let timea = Sys.time () in + let res = aux true None context idrefs t in + let timeb = Sys.time () in + prerr_endline + ("+++++++++++++ Tempi della aux dentro alla acic_of_cic: "^ string_of_float (timeb -. timea)) ; + res +*) + aux global_computeinnertypes None context idrefs t +;; + +let acic_of_cic_context ~computeinnertypes metasenv context idrefs t = + let ids_to_terms = Hashtbl.create 503 in + let ids_to_father_ids = Hashtbl.create 503 in + let ids_to_inner_sorts = Hashtbl.create 503 in + let ids_to_inner_types = Hashtbl.create 503 in + let seed = ref 0 in + acic_of_cic_context' ~computeinnertypes seed ids_to_terms ids_to_father_ids ids_to_inner_sorts + ids_to_inner_types metasenv context idrefs t, + ids_to_terms, ids_to_father_ids, ids_to_inner_sorts, ids_to_inner_types +;; + +let aconjecture_of_conjecture seed ids_to_terms ids_to_father_ids + ids_to_inner_sorts ids_to_inner_types ids_to_hypotheses hypotheses_seed + metasenv (metano,context,goal) += + let computeinnertypes = false in + let acic_of_cic_context = + acic_of_cic_context' seed ids_to_terms ids_to_father_ids ids_to_inner_sorts + ids_to_inner_types metasenv in + let _, acontext,final_idrefs = + (List.fold_right + (fun binding (context, acontext,idrefs) -> + let hid = "h" ^ string_of_int !hypotheses_seed in + Hashtbl.add ids_to_hypotheses hid binding ; + incr hypotheses_seed ; + match binding with + Some (n,Cic.Def (t,_)) -> + let acic = acic_of_cic_context ~computeinnertypes context idrefs t None in + Hashtbl.replace ids_to_father_ids (CicUtil.id_of_annterm acic) + (Some hid); + (binding::context), + ((hid,Some (n,Cic.ADef acic))::acontext),(hid::idrefs) + | Some (n,Cic.Decl t) -> + let acic = acic_of_cic_context ~computeinnertypes context idrefs t None in + Hashtbl.replace ids_to_father_ids (CicUtil.id_of_annterm acic) + (Some hid); + (binding::context), + ((hid,Some (n,Cic.ADecl acic))::acontext),(hid::idrefs) + | None -> + (* Invariant: "" is never looked up *) + (None::context),((hid,None)::acontext),""::idrefs + ) context ([],[],[]) + ) + in + let agoal = acic_of_cic_context ~computeinnertypes context final_idrefs goal None in + (metano,acontext,agoal) +;; + +let asequent_of_sequent (metasenv:Cic.metasenv) (sequent:Cic.conjecture) = + let ids_to_terms = Hashtbl.create 503 in + let ids_to_father_ids = Hashtbl.create 503 in + let ids_to_inner_sorts = Hashtbl.create 503 in + let ids_to_inner_types = Hashtbl.create 503 in + let ids_to_hypotheses = Hashtbl.create 23 in + let hypotheses_seed = ref 0 in + let seed = ref 1 in (* 'i0' is used for the whole sequent *) + let unsh_sequent = + let i,canonical_context,term = sequent in + let canonical_context' = + List.fold_right + (fun d canonical_context' -> + let d = + match d with + None -> None + | Some (n, Cic.Decl t)-> + Some (n, Cic.Decl (Unshare.unshare t)) + | Some (n, Cic.Def (t,None)) -> + Some (n, Cic.Def ((Unshare.unshare t),None)) + | Some (n,Cic.Def (bo,Some ty)) -> + Some (n, Cic.Def (Unshare.unshare bo,Some (Unshare.unshare ty))) + in + d::canonical_context' + ) canonical_context [] + in + let term' = Unshare.unshare term in + (i,canonical_context',term') + in + let (metano,acontext,agoal) = + aconjecture_of_conjecture seed ids_to_terms ids_to_father_ids + ids_to_inner_sorts ids_to_inner_types ids_to_hypotheses hypotheses_seed + metasenv unsh_sequent in + (unsh_sequent, + (("i0",metano,acontext,agoal), + ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,ids_to_hypotheses)) +;; + +let acic_object_of_cic_object ?(eta_fix=false) obj = + let module C = Cic in + let module E = Eta_fixing in + let ids_to_terms = Hashtbl.create 503 in + let ids_to_father_ids = Hashtbl.create 503 in + let ids_to_inner_sorts = Hashtbl.create 503 in + let ids_to_inner_types = Hashtbl.create 503 in + let ids_to_conjectures = Hashtbl.create 11 in + let ids_to_hypotheses = Hashtbl.create 127 in + let hypotheses_seed = ref 0 in + let conjectures_seed = ref 0 in + let seed = ref 0 in + let acic_term_of_cic_term_context' = + acic_of_cic_context' seed ids_to_terms ids_to_father_ids ids_to_inner_sorts + ids_to_inner_types in + let acic_term_of_cic_term' = acic_term_of_cic_term_context' [] [] [] in + let aconjecture_of_conjecture' = aconjecture_of_conjecture seed + ids_to_terms ids_to_father_ids ids_to_inner_sorts ids_to_inner_types + ids_to_hypotheses hypotheses_seed in + let eta_fix_and_unshare metasenv context t = + let t = if eta_fix then E.eta_fix metasenv context t else t in + Unshare.unshare t in + let aobj = + match obj with + C.Constant (id,Some bo,ty,params,attrs) -> + let bo' = (*eta_fix_and_unshare[] [] bo*) Unshare.unshare bo in + let ty' = eta_fix_and_unshare [] [] ty in + let abo = acic_term_of_cic_term' ~computeinnertypes:true bo' (Some ty') in + let aty = acic_term_of_cic_term' ~computeinnertypes:false ty' None in + C.AConstant + ("mettereaposto",Some "mettereaposto2",id,Some abo,aty,params,attrs) + | C.Constant (id,None,ty,params,attrs) -> + let ty' = eta_fix_and_unshare [] [] ty in + let aty = acic_term_of_cic_term' ~computeinnertypes:false ty' None in + C.AConstant + ("mettereaposto",None,id,None,aty,params,attrs) + | C.Variable (id,bo,ty,params,attrs) -> + let ty' = eta_fix_and_unshare [] [] ty in + let abo = + match bo with + None -> None + | Some bo -> + let bo' = eta_fix_and_unshare [] [] bo in + Some (acic_term_of_cic_term' ~computeinnertypes:true bo' (Some ty')) + in + let aty = acic_term_of_cic_term' ~computeinnertypes:false ty' None in + C.AVariable + ("mettereaposto",id,abo,aty,params,attrs) + | C.CurrentProof (id,conjectures,bo,ty,params,attrs) -> + let conjectures' = + List.map + (function (i,canonical_context,term) -> + let canonical_context' = + List.fold_right + (fun d canonical_context' -> + let d = + match d with + None -> None + | Some (n, C.Decl t)-> + Some (n, C.Decl (eta_fix_and_unshare conjectures canonical_context' t)) + | Some (n, C.Def (t,None)) -> + Some (n, + C.Def ((eta_fix_and_unshare conjectures canonical_context' t),None)) + | Some (_,C.Def (_,Some _)) -> assert false + in + d::canonical_context' + ) canonical_context [] + in + let term' = eta_fix_and_unshare conjectures canonical_context' term in + (i,canonical_context',term') + ) conjectures + in + let aconjectures = + List.map + (function (i,canonical_context,term) as conjecture -> + let cid = "c" ^ string_of_int !conjectures_seed in + xxx_add ids_to_conjectures cid conjecture ; + incr conjectures_seed ; + let (i,acanonical_context,aterm) + = aconjecture_of_conjecture' conjectures conjecture in + (cid,i,acanonical_context,aterm)) + conjectures' in + (* let bo' = eta_fix conjectures' [] bo in *) + let bo' = bo in + let ty' = eta_fix_and_unshare conjectures' [] ty in +(* + let time2 = Sys.time () in + prerr_endline + ("++++++++++ Tempi della eta_fix: "^ string_of_float (time2 -. time1)) ; + hashtbl_add_time := 0.0 ; + type_of_aux'_add_time := 0.0 ; + DoubleTypeInference.syntactic_equality_add_time := 0.0 ; +*) + let abo = + acic_term_of_cic_term_context' ~computeinnertypes:true conjectures' [] [] bo' (Some ty') in + let aty = acic_term_of_cic_term_context' ~computeinnertypes:false conjectures' [] [] ty' None in +(* + let time3 = Sys.time () in + prerr_endline + ("++++++++++++ Tempi della hashtbl_add_time: " ^ string_of_float !hashtbl_add_time) ; + prerr_endline + ("++++++++++++ Tempi della type_of_aux'_add_time(" ^ string_of_int !number_new_type_of_aux' ^ "): " ^ string_of_float !type_of_aux'_add_time) ; + prerr_endline + ("++++++++++++ Tempi della type_of_aux'_add_time nella double_type_inference(" ^ string_of_int !DoubleTypeInference.number_new_type_of_aux'_double_work ^ ";" ^ string_of_int !DoubleTypeInference.number_new_type_of_aux'_prop ^ "/" ^ string_of_int !DoubleTypeInference.number_new_type_of_aux' ^ "): " ^ string_of_float !DoubleTypeInference.type_of_aux'_add_time) ; + prerr_endline + ("++++++++++++ Tempi della syntactic_equality_add_time: " ^ string_of_float !DoubleTypeInference.syntactic_equality_add_time) ; + prerr_endline + ("++++++++++ Tempi della acic_of_cic: " ^ string_of_float (time3 -. time2)) ; + prerr_endline + ("++++++++++ Numero di iterazioni della acic_of_cic: " ^ string_of_int !seed) ; +*) + C.ACurrentProof + ("mettereaposto","mettereaposto2",id,aconjectures,abo,aty,params,attrs) + | C.InductiveDefinition (tys,params,paramsno,attrs) -> + let tys = + List.map + (fun (name,i,arity,cl) -> + (name,i,Unshare.unshare arity, + List.map (fun (name,ty) -> name,Unshare.unshare ty) cl)) tys in + let context = + List.map + (fun (name,_,arity,_) -> + Some (C.Name name, C.Decl (Unshare.unshare arity))) tys in + let idrefs = List.map (function _ -> gen_id seed) tys in + let atys = + List.map2 + (fun id (name,inductive,ty,cons) -> + let acons = + List.map + (function (name,ty) -> + (name, + acic_term_of_cic_term_context' ~computeinnertypes:false [] context idrefs ty None) + ) cons + in + (id,name,inductive, + acic_term_of_cic_term' ~computeinnertypes:false ty None,acons) + ) (List.rev idrefs) tys + in + C.AInductiveDefinition ("mettereaposto",atys,params,paramsno,attrs) + in + aobj,ids_to_terms,ids_to_father_ids,ids_to_inner_sorts,ids_to_inner_types, + ids_to_conjectures,ids_to_hypotheses +;; + +let plain_acic_term_of_cic_term = + let module C = Cic in + let mk_fresh_id = + let id = ref 0 in + function () -> incr id; "i" ^ string_of_int !id in + let rec aux context t = + let fresh_id = mk_fresh_id () in + match t with + C.Rel n -> + let idref,id = + match get_nth "2" context n with + idref,(Some (C.Name s,_)) -> idref,s + | idref,_ -> idref,"__" ^ string_of_int n + in + C.ARel (fresh_id, idref, n, id) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map + (function i,t -> i, (aux context t)) exp_named_subst + in + C.AVar (fresh_id,uri,exp_named_subst') + | C.Implicit _ + | C.Meta _ -> assert false + | C.Sort s -> C.ASort (fresh_id, s) + | C.Cast (v,t) -> + C.ACast (fresh_id, aux context v, aux context t) + | C.Prod (n,s,t) -> + C.AProd + (fresh_id, n, aux context s, + aux ((fresh_id, Some (n, C.Decl s))::context) t) + | C.Lambda (n,s,t) -> + C.ALambda + (fresh_id,n, aux context s, + aux ((fresh_id, Some (n, C.Decl s))::context) t) + | C.LetIn (n,s,t) -> + C.ALetIn + (fresh_id, n, aux context s, + aux ((fresh_id, Some (n, C.Def(s,None)))::context) t) + | C.Appl l -> + C.AAppl (fresh_id, List.map (aux context) l) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map + (function i,t -> i, (aux context t)) exp_named_subst + in + C.AConst (fresh_id, uri, exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst' = + List.map + (function i,t -> i, (aux context t)) exp_named_subst + in + C.AMutInd (fresh_id, uri, tyno, exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map + (function i,t -> i, (aux context t)) exp_named_subst + in + C.AMutConstruct (fresh_id, uri, tyno, consno, exp_named_subst') + | C.MutCase (uri, tyno, outty, term, patterns) -> + C.AMutCase (fresh_id, uri, tyno, aux context outty, + aux context term, List.map (aux context) patterns) + | C.Fix (funno, funs) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (mk_fresh_id (),(Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))))::types, + len+1 + ) ([],0) funs + in + C.AFix (fresh_id, funno, + List.map2 + (fun (id,_) (name, indidx, ty, bo) -> + (id, name, indidx, aux context ty, aux (tys@context) bo) + ) tys funs + ) + | C.CoFix (funno, funs) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (mk_fresh_id (),(Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))))::types, + len+1 + ) ([],0) funs + in + C.ACoFix (fresh_id, funno, + List.map2 + (fun (id,_) (name, ty, bo) -> + (id, name, aux context ty, aux (tys@context) bo) + ) tys funs + ) + in + aux +;; + +let plain_acic_object_of_cic_object obj = + let module C = Cic in + let mk_fresh_id = + let id = ref 0 in + function () -> incr id; "it" ^ string_of_int !id + in + match obj with + C.Constant (id,Some bo,ty,params,attrs) -> + let abo = plain_acic_term_of_cic_term [] bo in + let aty = plain_acic_term_of_cic_term [] ty in + C.AConstant + ("mettereaposto",Some "mettereaposto2",id,Some abo,aty,params,attrs) + | C.Constant (id,None,ty,params,attrs) -> + let aty = plain_acic_term_of_cic_term [] ty in + C.AConstant + ("mettereaposto",None,id,None,aty,params,attrs) + | C.Variable (id,bo,ty,params,attrs) -> + let abo = + match bo with + None -> None + | Some bo -> Some (plain_acic_term_of_cic_term [] bo) + in + let aty = plain_acic_term_of_cic_term [] ty in + C.AVariable + ("mettereaposto",id,abo,aty,params,attrs) + | C.CurrentProof _ -> assert false + | C.InductiveDefinition (tys,params,paramsno,attrs) -> + let context = + List.map + (fun (name,_,arity,_) -> + mk_fresh_id (), Some (C.Name name, C.Decl arity)) tys in + let atys = + List.map2 + (fun (id,_) (name,inductive,ty,cons) -> + let acons = + List.map + (function (name,ty) -> + (name, + plain_acic_term_of_cic_term context ty) + ) cons + in + (id,name,inductive,plain_acic_term_of_cic_term [] ty,acons) + ) context tys + in + C.AInductiveDefinition ("mettereaposto",atys,params,paramsno,attrs) +;; diff --git a/components/cic_acic/cic2acic.mli b/components/cic_acic/cic2acic.mli new file mode 100644 index 000000000..b63a585e6 --- /dev/null +++ b/components/cic_acic/cic2acic.mli @@ -0,0 +1,61 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception NotEnoughElements of string + +val source_id_of_id : string -> string + +type anntypes = + {annsynthesized : Cic.annterm ; annexpected : Cic.annterm option} +;; + +type sort_kind = [ `Prop | `Set | `Type of CicUniv.universe | `CProp ] + +val string_of_sort: sort_kind -> string +(*val sort_of_string: string -> sort_kind*) +val sort_of_sort: Cic.sort -> sort_kind + +val acic_object_of_cic_object : + ?eta_fix: bool -> (* perform eta_fixing; default: true*) + Cic.obj -> (* object *) + Cic.annobj * (* annotated object *) + (Cic.id, Cic.term) Hashtbl.t * (* ids_to_terms *) + (Cic.id, Cic.id option) Hashtbl.t * (* ids_to_father_ids *) + (Cic.id, sort_kind) Hashtbl.t * (* ids_to_inner_sorts *) + (Cic.id, anntypes) Hashtbl.t * (* ids_to_inner_types *) + (Cic.id, Cic.conjecture) Hashtbl.t * (* ids_to_conjectures *) + (Cic.id, Cic.hypothesis) Hashtbl.t (* ids_to_hypotheses *) + +val asequent_of_sequent : + Cic.metasenv -> (* metasenv *) + Cic.conjecture -> (* sequent *) + Cic.conjecture * (* unshared sequent *) + (Cic.annconjecture * (* annotated sequent *) + (Cic.id, Cic.term) Hashtbl.t * (* ids_to_terms *) + (Cic.id, Cic.id option) Hashtbl.t * (* ids_to_father_ids *) + (Cic.id, sort_kind) Hashtbl.t * (* ids_to_inner_sorts *) + (Cic.id, Cic.hypothesis) Hashtbl.t) (* ids_to_hypotheses *) + +val plain_acic_object_of_cic_object : Cic.obj -> Cic.annobj diff --git a/components/cic_acic/doubleTypeInference.ml b/components/cic_acic/doubleTypeInference.ml new file mode 100644 index 000000000..905d1e6bc --- /dev/null +++ b/components/cic_acic/doubleTypeInference.ml @@ -0,0 +1,676 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +exception Impossible of int;; +exception NotWellTyped of string;; +exception WrongUriToConstant of string;; +exception WrongUriToVariable of string;; +exception WrongUriToMutualInductiveDefinitions of string;; +exception ListTooShort;; +exception RelToHiddenHypothesis;; + +(*CSC: must alfa-conversion be considered or not? *) + +let xxx_type_of_aux' m c t = + try + Some (fst (CicTypeChecker.type_of_aux' m c t CicUniv.empty_ugraph)) + with + | CicTypeChecker.TypeCheckerFailure _ -> None (* because eta_expansion *) +;; + +type types = {synthesized : Cic.term ; expected : Cic.term option};; + +(* does_not_occur n te *) +(* returns [true] if [Rel n] does not occur in [te] *) +let rec does_not_occur n = + let module C = Cic in + function + C.Rel m when m = n -> false + | C.Rel _ +(* FG/CSC: maybe we assume the meta is guarded so we do not recur on its *) +(* explicit subsitutions (copied from the kernel) ??? *) + | C.Meta _ + | C.Sort _ + | C.Implicit _ -> true + | C.Cast (te,ty) -> + does_not_occur n te && does_not_occur n ty + | C.Prod (name,so,dest) -> + does_not_occur n so && + does_not_occur (n + 1) dest + | C.Lambda (name,so,dest) -> + does_not_occur n so && + does_not_occur (n + 1) dest + | C.LetIn (name,so,dest) -> + does_not_occur n so && + does_not_occur (n + 1) dest + | C.Appl l -> + List.fold_right (fun x i -> i && does_not_occur n x) l true + | C.Var (_,exp_named_subst) + | C.Const (_,exp_named_subst) + | C.MutInd (_,_,exp_named_subst) + | C.MutConstruct (_,_,_,exp_named_subst) -> + List.fold_right (fun (_,x) i -> i && does_not_occur n x) + exp_named_subst true + | C.MutCase (_,_,out,te,pl) -> + does_not_occur n out && does_not_occur n te && + List.fold_right (fun x i -> i && does_not_occur n x) pl true + | C.Fix (_,fl) -> + let len = List.length fl in + let n_plus_len = n + len in + List.fold_right + (fun (_,_,ty,bo) i -> + i && does_not_occur n ty && + does_not_occur n_plus_len bo + ) fl true + | C.CoFix (_,fl) -> + let len = List.length fl in + let n_plus_len = n + len in + List.fold_right + (fun (_,ty,bo) i -> + i && does_not_occur n ty && + does_not_occur n_plus_len bo + ) fl true +;; + +let rec beta_reduce = + let module S = CicSubstitution in + let module C = Cic in + function + C.Rel _ as t -> t + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (i,t) -> i, beta_reduce t) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (n,l) -> + C.Meta (n, + List.map + (function None -> None | Some t -> Some (beta_reduce t)) l + ) + | C.Sort _ as t -> t + | C.Implicit _ -> assert false + | C.Cast (te,ty) -> + C.Cast (beta_reduce te, beta_reduce ty) + | C.Prod (n,s,t) -> + C.Prod (n, beta_reduce s, beta_reduce t) + | C.Lambda (n,s,t) -> + C.Lambda (n, beta_reduce s, beta_reduce t) + | C.LetIn (n,s,t) -> + C.LetIn (n, beta_reduce s, beta_reduce t) + | C.Appl ((C.Lambda (name,s,t))::he::tl) -> + let he' = S.subst he t in + if tl = [] then + beta_reduce he' + else + (match he' with + C.Appl l -> beta_reduce (C.Appl (l@tl)) + | _ -> beta_reduce (C.Appl (he'::tl))) + | C.Appl l -> + C.Appl (List.map beta_reduce l) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (i,t) -> i, beta_reduce t) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,i,exp_named_subst) -> + let exp_named_subst' = + List.map (function (i,t) -> i, beta_reduce t) exp_named_subst + in + C.MutInd (uri,i,exp_named_subst') + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let exp_named_subst' = + List.map (function (i,t) -> i, beta_reduce t) exp_named_subst + in + C.MutConstruct (uri,i,j,exp_named_subst') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,beta_reduce outt,beta_reduce t, + List.map beta_reduce pl) + | C.Fix (i,fl) -> + let fl' = + List.map + (function (name,i,ty,bo) -> + name,i,beta_reduce ty,beta_reduce bo + ) fl + in + C.Fix (i,fl') + | C.CoFix (i,fl) -> + let fl' = + List.map + (function (name,ty,bo) -> + name,beta_reduce ty,beta_reduce bo + ) fl + in + C.CoFix (i,fl') +;; + +let rec split l n = + match (l,n) with + (l,0) -> ([], l) + | (he::tl, n) -> let (l1,l2) = split tl (n-1) in (he::l1,l2) + | (_,_) -> raise ListTooShort +;; + +let type_of_constant uri = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let cobj = + match CicEnvironment.is_type_checked CicUniv.empty_ugraph uri with + CicEnvironment.CheckedObj (cobj,_) -> cobj + | CicEnvironment.UncheckedObj uobj -> + raise (NotWellTyped "Reference to an unchecked constant") + in + match cobj with + C.Constant (_,_,ty,_,_) -> ty + | C.CurrentProof (_,_,_,ty,_,_) -> ty + | _ -> raise (WrongUriToConstant (U.string_of_uri uri)) +;; + +let type_of_variable uri = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + match CicEnvironment.is_type_checked CicUniv.empty_ugraph uri with + CicEnvironment.CheckedObj ((C.Variable (_,_,ty,_,_)),_) -> ty + | CicEnvironment.UncheckedObj (C.Variable _) -> + raise (NotWellTyped "Reference to an unchecked variable") + | _ -> raise (WrongUriToVariable (UriManager.string_of_uri uri)) +;; + +let type_of_mutual_inductive_defs uri i = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let cobj = + match CicEnvironment.is_type_checked CicUniv.empty_ugraph uri with + CicEnvironment.CheckedObj (cobj,_) -> cobj + | CicEnvironment.UncheckedObj uobj -> + raise (NotWellTyped "Reference to an unchecked inductive type") + in + match cobj with + C.InductiveDefinition (dl,_,_,_) -> + let (_,_,arity,_) = List.nth dl i in + arity + | _ -> raise (WrongUriToMutualInductiveDefinitions (U.string_of_uri uri)) +;; + +let type_of_mutual_inductive_constr uri i j = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let cobj = + match CicEnvironment.is_type_checked CicUniv.empty_ugraph uri with + CicEnvironment.CheckedObj (cobj,_) -> cobj + | CicEnvironment.UncheckedObj uobj -> + raise (NotWellTyped "Reference to an unchecked constructor") + in + match cobj with + C.InductiveDefinition (dl,_,_,_) -> + let (_,_,_,cl) = List.nth dl i in + let (_,ty) = List.nth cl (j-1) in + ty + | _ -> raise (WrongUriToMutualInductiveDefinitions (U.string_of_uri uri)) +;; + +let pack_coercion = ref (fun _ _ _ -> assert false);; + +let profiler_for_find = HExtlib.profile "CicHash ADD" ;; + +let cic_CicHash_add a b c = + profiler_for_find.HExtlib.profile (Cic.CicHash.add a b) c +;; + +let profiler_for_find1 = HExtlib.profile "CicHash MEM" ;; + +let cic_CicHash_mem a b = + profiler_for_find1.HExtlib.profile (Cic.CicHash.mem a) b +;; + +(* type_of_aux' is just another name (with a different scope) for type_of_aux *) +let rec type_of_aux' subterms_to_types metasenv context t expectedty = + (* Coscoy's double type-inference algorithm *) + (* It computes the inner-types of every subterm of [t], *) + (* even when they are not needed to compute the types *) + (* of other terms. *) + let rec type_of_aux context t expectedty = + let module C = Cic in + let module R = CicReduction in + let module S = CicSubstitution in + let module U = UriManager in + let expectedty = + match expectedty with + None -> None + | Some t -> Some (!pack_coercion metasenv context t) in + let synthesized = + match t with + C.Rel n -> + (try + match List.nth context (n - 1) with + Some (_,C.Decl t) -> S.lift n t + | Some (_,C.Def (_,Some ty)) -> S.lift n ty + | Some (_,C.Def (bo,None)) -> + type_of_aux context (S.lift n bo) expectedty + | None -> raise RelToHiddenHypothesis + with + _ -> raise (NotWellTyped "Not a close term") + ) + | C.Var (uri,exp_named_subst) -> + visit_exp_named_subst context uri exp_named_subst ; + CicSubstitution.subst_vars exp_named_subst (type_of_variable uri) + | C.Meta (n,l) -> + (* Let's visit all the subterms that will not be visited later *) + let (_,canonical_context,_) = CicUtil.lookup_meta n metasenv in + let lifted_canonical_context = + let rec aux i = + function + [] -> [] + | (Some (n,C.Decl t))::tl -> + (Some (n,C.Decl (S.subst_meta l (S.lift i t))))::(aux (i+1) tl) + | (Some (n,C.Def (t,None)))::tl -> + (Some (n,C.Def ((S.subst_meta l (S.lift i t)),None))):: + (aux (i+1) tl) + | None::tl -> None::(aux (i+1) tl) + | (Some (_,C.Def (_,Some _)))::_ -> assert false + in + aux 1 canonical_context + in + let _ = + List.iter2 + (fun t ct -> + match t,ct with + _,None -> () + | Some t,Some (_,C.Def (ct,_)) -> + let expected_type = + match xxx_type_of_aux' metasenv context ct with + | None -> None + | Some t -> Some (R.whd context t) + in + (* Maybe I am a bit too paranoid, because *) + (* if the term is well-typed than t and ct *) + (* are convertible. Nevertheless, I compute *) + (* the expected type. *) + ignore (type_of_aux context t expected_type) + | Some t,Some (_,C.Decl ct) -> + ignore (type_of_aux context t (Some ct)) + | _,_ -> assert false (* the term is not well typed!!! *) + ) l lifted_canonical_context + in + let (_,canonical_context,ty) = CicUtil.lookup_meta n metasenv in + (* Checks suppressed *) + CicSubstitution.subst_meta l ty + | C.Sort (C.Type t) -> (* TASSI: CONSTRAINT *) + C.Sort (C.Type (CicUniv.fresh())) + | C.Sort _ -> C.Sort (C.Type (CicUniv.fresh())) (* TASSI: CONSTRAINT *) + | C.Implicit _ -> raise (Impossible 21) + | C.Cast (te,ty) -> + (* Let's visit all the subterms that will not be visited later *) + let _ = type_of_aux context te (Some (beta_reduce ty)) in + let _ = type_of_aux context ty None in + (* Checks suppressed *) + ty + | C.Prod (name,s,t) -> + let sort1 = type_of_aux context s None + and sort2 = type_of_aux ((Some (name,(C.Decl s)))::context) t None in + sort_of_prod context (name,s) (sort1,sort2) + | C.Lambda (n,s,t) -> + (* Let's visit all the subterms that will not be visited later *) + let _ = type_of_aux context s None in + let expected_target_type = + match expectedty with + None -> None + | Some expectedty' -> + let ty = + match R.whd context expectedty' with + C.Prod (_,_,expected_target_type) -> + beta_reduce expected_target_type + | _ -> assert false + in + Some ty + in + let type2 = + type_of_aux ((Some (n,(C.Decl s)))::context) t expected_target_type + in + (* Checks suppressed *) + C.Prod (n,s,type2) + | C.LetIn (n,s,t) -> +(*CSC: What are the right expected types for the source and *) +(*CSC: target of a LetIn? None used. *) + (* Let's visit all the subterms that will not be visited later *) + let ty = type_of_aux context s None in + let t_typ = + (* Checks suppressed *) + type_of_aux ((Some (n,(C.Def (s,Some ty))))::context) t None + in (* CicSubstitution.subst s t_typ *) + if does_not_occur 1 t_typ then + (* since [Rel 1] does not occur in typ, substituting any term *) + (* in place of [Rel 1] is equivalent to delifting once *) + CicSubstitution.subst (C.Implicit None) t_typ + else + C.LetIn (n,s,t_typ) + | C.Appl (he::tl) when List.length tl > 0 -> + (* + let expected_hetype = + (* Inefficient, the head is computed twice. But I know *) + (* of no other solution. *) + (beta_reduce + (R.whd context (xxx_type_of_aux' metasenv context he))) + in + let hetype = type_of_aux context he (Some expected_hetype) in + let tlbody_and_type = + let rec aux = + function + _,[] -> [] + | C.Prod (n,s,t),he::tl -> + (he, type_of_aux context he (Some (beta_reduce s))):: + (aux (R.whd context (S.subst he t), tl)) + | _ -> assert false + in + aux (expected_hetype, tl) *) + let hetype = R.whd context (type_of_aux context he None) in + let tlbody_and_type = + let rec aux = + function + _,[] -> [] + | C.Prod (n,s,t),he::tl -> + (he, type_of_aux context he (Some (beta_reduce s))):: + (aux (R.whd context (S.subst he t), tl)) + | _ -> assert false + in + aux (hetype, tl) + in + eat_prods context hetype tlbody_and_type + | C.Appl _ -> raise (NotWellTyped "Appl: no arguments") + | C.Const (uri,exp_named_subst) -> + visit_exp_named_subst context uri exp_named_subst ; + CicSubstitution.subst_vars exp_named_subst (type_of_constant uri) + | C.MutInd (uri,i,exp_named_subst) -> + visit_exp_named_subst context uri exp_named_subst ; + CicSubstitution.subst_vars exp_named_subst + (type_of_mutual_inductive_defs uri i) + | C.MutConstruct (uri,i,j,exp_named_subst) -> + visit_exp_named_subst context uri exp_named_subst ; + CicSubstitution.subst_vars exp_named_subst + (type_of_mutual_inductive_constr uri i j) + | C.MutCase (uri,i,outtype,term,pl) -> + let outsort = type_of_aux context outtype None in + let (need_dummy, k) = + let rec guess_args context t = + match CicReduction.whd context t with + C.Sort _ -> (true, 0) + | C.Prod (name, s, t) -> + let (b, n) = guess_args ((Some (name,(C.Decl s)))::context) t in + if n = 0 then + (* last prod before sort *) + match CicReduction.whd context s with + C.MutInd (uri',i',_) when U.eq uri' uri && i' = i -> + (false, 1) + | C.Appl ((C.MutInd (uri',i',_)) :: _) + when U.eq uri' uri && i' = i -> (false, 1) + | _ -> (true, 1) + else + (b, n + 1) + | _ -> raise (NotWellTyped "MutCase: outtype ill-formed") + in + let (b, k) = guess_args context outsort in + if not b then (b, k - 1) else (b, k) + in + let (parameters, arguments,exp_named_subst) = + let type_of_term = + match xxx_type_of_aux' metasenv context term with + | None -> None + | Some t -> Some (beta_reduce t) + in + match + R.whd context (type_of_aux context term type_of_term) + with + (*CSC manca il caso dei CAST *) + C.MutInd (uri',i',exp_named_subst) -> + (* Checks suppressed *) + [],[],exp_named_subst + | C.Appl (C.MutInd (uri',i',exp_named_subst) :: tl) -> + let params,args = + split tl (List.length tl - k) + in params,args,exp_named_subst + | _ -> + raise (NotWellTyped "MutCase: the term is not an inductive one") + in + (* Checks suppressed *) + (* Let's visit all the subterms that will not be visited later *) + let (cl,parsno) = + let obj,_ = + try + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + with Not_found -> assert false + in + match obj with + C.InductiveDefinition (tl,_,parsno,_) -> + let (_,_,_,cl) = List.nth tl i in (cl,parsno) + | _ -> + raise (WrongUriToMutualInductiveDefinitions (U.string_of_uri uri)) + in + let _ = + List.fold_left + (fun j (p,(_,c)) -> + let cons = + if parameters = [] then + (C.MutConstruct (uri,i,j,exp_named_subst)) + else + (C.Appl (C.MutConstruct (uri,i,j,exp_named_subst)::parameters)) + in + let expectedtype = + match xxx_type_of_aux' metasenv context cons with + | None -> None + | Some t -> + Some + (beta_reduce + (type_of_branch context parsno need_dummy outtype + cons t)) + in + ignore (type_of_aux context p expectedtype); + j+1 + ) 1 (List.combine pl cl) + in + if not need_dummy then + C.Appl ((outtype::arguments)@[term]) + else if arguments = [] then + outtype + else + C.Appl (outtype::arguments) + | C.Fix (i,fl) -> + (* Let's visit all the subterms that will not be visited later *) + let context' = + List.rev + (List.map + (fun (n,_,ty,_) -> + let _ = type_of_aux context ty None in + (Some (C.Name n,(C.Decl ty))) + ) fl + ) @ + context + in + let _ = + List.iter + (fun (_,_,ty,bo) -> + let expectedty = + beta_reduce (CicSubstitution.lift (List.length fl) ty) + in + ignore (type_of_aux context' bo (Some expectedty)) + ) fl + in + (* Checks suppressed *) + let (_,_,ty,_) = List.nth fl i in + ty + | C.CoFix (i,fl) -> + (* Let's visit all the subterms that will not be visited later *) + let context' = + List.rev + (List.map + (fun (n,ty,_) -> + let _ = type_of_aux context ty None in + (Some (C.Name n,(C.Decl ty))) + ) fl + ) @ + context + in + let _ = + List.iter + (fun (_,ty,bo) -> + let expectedty = + beta_reduce (CicSubstitution.lift (List.length fl) ty) + in + ignore (type_of_aux context' bo (Some expectedty)) + ) fl + in + (* Checks suppressed *) + let (_,ty,_) = List.nth fl i in + ty + in + let synthesized' = beta_reduce synthesized in + let synthesized' = !pack_coercion metasenv context synthesized' in + let types,res = + match expectedty with + None -> + (* No expected type *) + {synthesized = synthesized' ; expected = None}, synthesized + | Some ty when CicUtil.alpha_equivalence synthesized' ty -> + (* The expected type is synthactically equal to *) + (* the synthesized type. Let's forget it. *) + {synthesized = synthesized' ; expected = None}, synthesized + | Some expectedty' -> + {synthesized = synthesized' ; expected = Some expectedty'}, + expectedty' + in +(* assert (not (cic_CicHash_mem subterms_to_types t));*) + cic_CicHash_add subterms_to_types t types ; + res + + and visit_exp_named_subst context uri exp_named_subst = + let uris_and_types = + let obj,_ = + try + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + with Not_found -> assert false + in + let params = CicUtil.params_of_obj obj in + List.map + (function uri -> + let obj,_ = + try + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + with Not_found -> assert false + in + match obj with + Cic.Variable (_,None,ty,_,_) -> uri,ty + | _ -> assert false (* the theorem is well-typed *) + ) params + in + let rec check uris_and_types subst = + match uris_and_types,subst with + _,[] -> [] + | (uri,ty)::tytl,(uri',t)::substtl when uri = uri' -> + ignore (type_of_aux context t (Some ty)) ; + let tytl' = + List.map + (function uri,t' -> uri,(CicSubstitution.subst_vars [uri',t] t')) tytl + in + check tytl' substtl + | _,_ -> assert false (* the theorem is well-typed *) + in + check uris_and_types exp_named_subst + + and sort_of_prod context (name,s) (t1, t2) = + let module C = Cic in + let t1' = CicReduction.whd context t1 in + let t2' = CicReduction.whd ((Some (name,C.Decl s))::context) t2 in + match (t1', t2') with + (C.Sort _, C.Sort s2) + when (s2 = C.Prop or s2 = C.Set or s2 = C.CProp) -> + (* different from Coq manual!!! *) + C.Sort s2 + | (C.Sort (C.Type t1), C.Sort (C.Type t2)) -> + C.Sort (C.Type (CicUniv.fresh())) + | (C.Sort _,C.Sort (C.Type t1)) -> + (* TASSI: CONSRTAINTS: the same in cictypechecker,cicrefine *) + C.Sort (C.Type t1) (* c'e' bisogno di un fresh? *) + | (C.Meta _, C.Sort _) -> t2' + | (C.Meta _, (C.Meta (_,_) as t)) + | (C.Sort _, (C.Meta (_,_) as t)) when CicUtil.is_closed t -> + t2' + | (_,_) -> + raise + (NotWellTyped + ("Prod: sort1= " ^ CicPp.ppterm t1' ^ " ; sort2= " ^ CicPp.ppterm t2')) + + and eat_prods context hetype = + (*CSC: siamo sicuri che le are_convertible non lavorino con termini non *) + (*CSC: cucinati *) + function + [] -> hetype + | (hete, hety)::tl -> + (match (CicReduction.whd context hetype) with + Cic.Prod (n,s,t) -> + (* Checks suppressed *) + eat_prods context (CicSubstitution.subst hete t) tl + | _ -> raise (NotWellTyped "Appl: wrong Prod-type") + ) + +and type_of_branch context argsno need_dummy outtype term constype = + let module C = Cic in + let module R = CicReduction in + match R.whd context constype with + C.MutInd (_,_,_) -> + if need_dummy then + outtype + else + C.Appl [outtype ; term] + | C.Appl (C.MutInd (_,_,_)::tl) -> + let (_,arguments) = split tl argsno + in + if need_dummy && arguments = [] then + outtype + else + C.Appl (outtype::arguments@(if need_dummy then [] else [term])) + | C.Prod (name,so,de) -> + let term' = + match CicSubstitution.lift 1 term with + C.Appl l -> C.Appl (l@[C.Rel 1]) + | t -> C.Appl [t ; C.Rel 1] + in + C.Prod (C.Anonymous,so,type_of_branch + ((Some (name,(C.Decl so)))::context) argsno need_dummy + (CicSubstitution.lift 1 outtype) term' de) + | _ -> raise (Impossible 20) + + in + type_of_aux context t expectedty +;; + +let double_type_of metasenv context t expectedty = + let subterms_to_types = Cic.CicHash.create 503 in + ignore (type_of_aux' subterms_to_types metasenv context t expectedty) ; + subterms_to_types +;; diff --git a/components/cic_acic/doubleTypeInference.mli b/components/cic_acic/doubleTypeInference.mli new file mode 100644 index 000000000..dcc7b66bd --- /dev/null +++ b/components/cic_acic/doubleTypeInference.mli @@ -0,0 +1,21 @@ +exception Impossible of int +exception NotWellTyped of string +exception WrongUriToConstant of string +exception WrongUriToVariable of string +exception WrongUriToMutualInductiveDefinitions of string +exception ListTooShort +exception RelToHiddenHypothesis + +type types = {synthesized : Cic.term ; expected : Cic.term option};; + +val pack_coercion : (Cic.metasenv -> Cic.context -> Cic.term -> Cic.term) ref;; + +val double_type_of : + Cic.metasenv -> Cic.context -> Cic.term -> Cic.term option -> + types Cic.CicHash.t + +(** Auxiliary functions **) + +(* does_not_occur n te *) +(* returns [true] if [Rel n] does not occur in [te] *) +val does_not_occur : int -> Cic.term -> bool diff --git a/components/cic_acic/eta_fixing.ml b/components/cic_acic/eta_fixing.ml new file mode 100644 index 000000000..78789179f --- /dev/null +++ b/components/cic_acic/eta_fixing.ml @@ -0,0 +1,310 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +exception ReferenceToNonVariable;; + +let prerr_endline _ = ();; + +(* +let rec fix_lambdas_wrt_type ty te = + let module C = Cic in + let module S = CicSubstitution in +(* prerr_endline ("entering fix_lambdas: type=" ^ CicPp.ppterm ty ^ "term=" ^ CicPp.ppterm te); *) + match ty with + C.Prod (_,_,ty') -> + (match CicReduction.whd [] te with + C.Lambda (n,s,te') -> + C.Lambda (n,s,fix_lambdas_wrt_type ty' te') + | t -> + let rec get_sources = + function + C.Prod (_,s,ty) -> s::(get_sources ty) + | _ -> [] in + let sources = get_sources ty in + let no_sources = List.length sources in + let rec mk_rels n shift = + if n = 0 then [] + else (C.Rel (n + shift))::(mk_rels (n - 1) shift) in + let t' = S.lift no_sources t in + let t2 = + match t' with + C.Appl l -> + C.LetIn + (C.Name "w",t',C.Appl ((C.Rel 1)::(mk_rels no_sources 1))) + | _ -> + C.Appl (t'::(mk_rels no_sources 0)) in + List.fold_right + (fun source t -> C.Lambda (C.Name "y",source,t)) + sources t2) + | _ -> te +;; *) + +let rec fix_lambdas_wrt_type ty te = + let module C = Cic in + let module S = CicSubstitution in +(* prerr_endline ("entering fix_lambdas: type=" ^ CicPp.ppterm ty ^ "term=" ^ CicPp.ppterm te); *) + match ty,te with + C.Prod (_,_,ty'), C.Lambda (n,s,te') -> + C.Lambda (n,s,fix_lambdas_wrt_type ty' te') + | C.Prod (_,s,ty'), t -> + let rec get_sources = + function + C.Prod (_,s,ty) -> s::(get_sources ty) + | _ -> [] in + let sources = get_sources ty in + let no_sources = List.length sources in + let rec mk_rels n shift = + if n = 0 then [] + else (C.Rel (n + shift))::(mk_rels (n - 1) shift) in + let t' = S.lift no_sources t in + let t2 = + match t' with + C.Appl l -> + C.LetIn (C.Name "w",t',C.Appl ((C.Rel 1)::(mk_rels no_sources 1))) + | _ -> C.Appl (t'::(mk_rels no_sources 0)) in + List.fold_right + (fun source t -> C.Lambda (C.Name "y",CicReduction.whd [] source,t)) sources t2 + | _, _ -> te +;; + +(* +let rec fix_lambdas_wrt_type ty te = + let module C = Cic in + let module S = CicSubstitution in +(* prerr_endline ("entering fix_lambdas: type=" ^ CicPp.ppterm ty ^ "term=" ^ CicPp.ppterm te); *) + match ty,te with + C.Prod (_,_,ty'), C.Lambda (n,s,te') -> + C.Lambda (n,s,fix_lambdas_wrt_type ty' te') + | C.Prod (_,s,ty'), ((C.Appl (C.Const _ ::_)) as t) -> + (* const have a fixed arity *) + (* prerr_endline ("******** fl - eta expansion 0: type=" ^ CicPp.ppterm ty ^ "term=" ^ CicPp.ppterm te); *) + let t' = S.lift 1 t in + C.Lambda (C.Name "x",s, + C.LetIn + (C.Name "H", fix_lambdas_wrt_type ty' t', + C.Appl [C.Rel 1;C.Rel 2])) + | C.Prod (_,s,ty'), C.Appl l -> + (* prerr_endline ("******** fl - eta expansion 1: type=" ^ CicPp.ppterm ty ^ "term=" ^ CicPp.ppterm te); *) + let l' = List.map (S.lift 1) l in + C.Lambda (C.Name "x",s, + fix_lambdas_wrt_type ty' (C.Appl (l'@[C.Rel 1]))) + | C.Prod (_,s,ty'), _ -> + (* prerr_endline ("******** fl - eta expansion 2: type=" ^ CicPp.ppterm ty ^ "term=" ^ CicPp.ppterm te); *) + flush stderr ; + let te' = S.lift 1 te in + C.Lambda (C.Name "x",s, + fix_lambdas_wrt_type ty' (C.Appl [te';C.Rel 1])) + | _, _ -> te +;;*) + +let fix_according_to_type ty hd tl = + let module C = Cic in + let module S = CicSubstitution in + let rec count_prods = + function + C.Prod (_,_,t) -> 1 + (count_prods t) + | _ -> 0 in + let expected_arity = count_prods ty in + let rec aux n ty tl res = + if n = 0 then + (match tl with + [] -> + (match res with + [] -> assert false + | [res] -> res + | _ -> C.Appl res) + | _ -> + match res with + [] -> assert false + | [a] -> C.Appl (a::tl) + | _ -> + (* prerr_endline ("******* too many args: type=" ^ CicPp.ppterm ty ^ "term=" ^ CicPp.ppterm (C.Appl res)); *) + C.LetIn + (C.Name "H", + C.Appl res, C.Appl (C.Rel 1::(List.map (S.lift 1) tl)))) + else + let name,source,target = + (match ty with + C.Prod (C.Name _ as n,s,t) -> n,s,t + | C.Prod (C.Anonymous, s,t) -> C.Name "z",s,t + | _ -> (* prods number may only increase for substitution *) + assert false) in + match tl with + [] -> + (* prerr_endline ("******* too few args: type=" ^ CicPp.ppterm ty ^ "term=" ^ CicPp.ppterm (C.Appl res)); *) + let res' = List.map (S.lift 1) res in + C.Lambda + (name, source, aux (n-1) target [] (res'@[C.Rel 1])) + | hd::tl' -> + let hd' = fix_lambdas_wrt_type source hd in + (* (prerr_endline ("++++++prima :" ^(CicPp.ppterm hd)); + prerr_endline ("++++++dopo :" ^(CicPp.ppterm hd'))); *) + aux (n-1) (S.subst hd' target) tl' (res@[hd']) in + aux expected_arity ty tl [hd] +;; + +let eta_fix metasenv context t = + let rec eta_fix' context t = + (* prerr_endline ("entering aux with: term=" ^ CicPp.ppterm t); + flush stderr ; *) + let module C = Cic in + let module S = CicSubstitution in + match t with + C.Rel n -> C.Rel n + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = fix_exp_named_subst context exp_named_subst in + C.Var (uri,exp_named_subst') + | C.Meta (n,l) -> + let (_,canonical_context,_) = CicUtil.lookup_meta n metasenv in + let l' = + List.map2 + (fun ct t -> + match (ct, t) with + None, _ -> None + | _, Some t -> Some (eta_fix' context t) + | Some _, None -> assert false (* due to typing rules *)) + canonical_context l + in + C.Meta (n,l') + | C.Sort s -> C.Sort s + | C.Implicit _ as t -> t + | C.Cast (v,t) -> C.Cast (eta_fix' context v, eta_fix' context t) + | C.Prod (n,s,t) -> + C.Prod + (n, eta_fix' context s, eta_fix' ((Some (n,(C.Decl s)))::context) t) + | C.Lambda (n,s,t) -> + C.Lambda + (n, eta_fix' context s, eta_fix' ((Some (n,(C.Decl s)))::context) t) + | C.LetIn (n,s,t) -> + C.LetIn + (n,eta_fix' context s,eta_fix' ((Some (n,(C.Def (s,None))))::context) t) + | C.Appl [] -> assert false + | C.Appl (he::tl) -> + let tl' = List.map (eta_fix' context) tl in + let ty,_ = + CicTypeChecker.type_of_aux' metasenv context he + CicUniv.empty_ugraph + in + fix_according_to_type ty (eta_fix' context he) tl' +(* + C.Const(uri,exp_named_subst)::l'' -> + let constant_type = + (match CicEnvironment.get_obj uri with + C.Constant (_,_,ty,_) -> ty + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof (_,_,_,_,params) -> raise ReferenceToCurrentProof + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + ) in + fix_according_to_type + constant_type (C.Const(uri,exp_named_subst)) l'' + | _ -> C.Appl l' *) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = fix_exp_named_subst context exp_named_subst in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst' = fix_exp_named_subst context exp_named_subst in + C.MutInd (uri, tyno, exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst' = fix_exp_named_subst context exp_named_subst in + C.MutConstruct (uri, tyno, consno, exp_named_subst') + | C.MutCase (uri, tyno, outty, term, patterns) -> + let outty' = eta_fix' context outty in + let term' = eta_fix' context term in + let patterns' = List.map (eta_fix' context) patterns in + let inductive_types,noparams = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + (match o with + Cic.Constant _ -> assert false + | Cic.Variable _ -> assert false + | Cic.CurrentProof _ -> assert false + | Cic.InductiveDefinition (l,_,n,_) -> l,n + ) in + let (_,_,_,constructors) = List.nth inductive_types tyno in + let constructor_types = + let rec clean_up t = + function + [] -> t + | a::tl -> + (match t with + Cic.Prod (_,_,t') -> clean_up (S.subst a t') tl + | _ -> assert false) in + if noparams = 0 then + List.map (fun (_,t) -> t) constructors + else + let term_type,_ = + CicTypeChecker.type_of_aux' metasenv context term + CicUniv.empty_ugraph + in + (match term_type with + C.Appl (hd::params) -> + let rec first_n n l = + if n = 0 then [] + else + (match l with + a::tl -> a::(first_n (n-1) tl) + | _ -> assert false) in + List.map + (fun (_,t) -> + clean_up t (first_n noparams params)) constructors + | _ -> prerr_endline ("QUA"); assert false) in + let patterns2 = + List.map2 fix_lambdas_wrt_type + constructor_types patterns' in + C.MutCase (uri, tyno, outty',term',patterns2) + | C.Fix (funno, funs) -> + let fun_types = + List.map (fun (n,_,ty,_) -> Some (C.Name n,(Cic.Decl ty))) funs in + C.Fix (funno, + List.map + (fun (name, no, ty, bo) -> + (name, no, eta_fix' context ty, eta_fix' (fun_types@context) bo)) + funs) + | C.CoFix (funno, funs) -> + let fun_types = + List.map (fun (n,ty,_) -> Some (C.Name n,(Cic.Decl ty))) funs in + C.CoFix (funno, + List.map + (fun (name, ty, bo) -> + (name, eta_fix' context ty, eta_fix' (fun_types@context) bo)) funs) + and fix_exp_named_subst context exp_named_subst = + List.rev + (List.fold_left + (fun newsubst (uri,t) -> + let t' = eta_fix' context t in + let ty = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + Cic.Variable (_,_,ty,_,_) -> + CicSubstitution.subst_vars newsubst ty + | _ -> raise ReferenceToNonVariable + in + let t'' = fix_according_to_type ty t' [] in + (uri,t'')::newsubst + ) [] exp_named_subst) + in + eta_fix' context t +;; diff --git a/components/cic_acic/eta_fixing.mli b/components/cic_acic/eta_fixing.mli new file mode 100644 index 000000000..c6c68119d --- /dev/null +++ b/components/cic_acic/eta_fixing.mli @@ -0,0 +1,28 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val eta_fix : Cic.metasenv -> Cic.context -> Cic.term -> Cic.term + + diff --git a/components/cic_disambiguation/.depend b/components/cic_disambiguation/.depend new file mode 100644 index 000000000..ca4124461 --- /dev/null +++ b/components/cic_disambiguation/.depend @@ -0,0 +1,12 @@ +disambiguateChoices.cmi: disambiguateTypes.cmi +disambiguate.cmi: disambiguateTypes.cmi +disambiguateTypes.cmo: disambiguateTypes.cmi +disambiguateTypes.cmx: disambiguateTypes.cmi +disambiguateChoices.cmo: disambiguateTypes.cmi disambiguateChoices.cmi +disambiguateChoices.cmx: disambiguateTypes.cmx disambiguateChoices.cmi +disambiguate.cmo: disambiguateTypes.cmi disambiguateChoices.cmi \ + disambiguate.cmi +disambiguate.cmx: disambiguateTypes.cmx disambiguateChoices.cmx \ + disambiguate.cmi +number_notation.cmo: disambiguateTypes.cmi disambiguateChoices.cmi +number_notation.cmx: disambiguateTypes.cmx disambiguateChoices.cmx diff --git a/components/cic_disambiguation/.depend.opt b/components/cic_disambiguation/.depend.opt new file mode 100644 index 000000000..ca4124461 --- /dev/null +++ b/components/cic_disambiguation/.depend.opt @@ -0,0 +1,12 @@ +disambiguateChoices.cmi: disambiguateTypes.cmi +disambiguate.cmi: disambiguateTypes.cmi +disambiguateTypes.cmo: disambiguateTypes.cmi +disambiguateTypes.cmx: disambiguateTypes.cmi +disambiguateChoices.cmo: disambiguateTypes.cmi disambiguateChoices.cmi +disambiguateChoices.cmx: disambiguateTypes.cmx disambiguateChoices.cmi +disambiguate.cmo: disambiguateTypes.cmi disambiguateChoices.cmi \ + disambiguate.cmi +disambiguate.cmx: disambiguateTypes.cmx disambiguateChoices.cmx \ + disambiguate.cmi +number_notation.cmo: disambiguateTypes.cmi disambiguateChoices.cmi +number_notation.cmx: disambiguateTypes.cmx disambiguateChoices.cmx diff --git a/components/cic_disambiguation/Makefile b/components/cic_disambiguation/Makefile new file mode 100644 index 000000000..cd03e8281 --- /dev/null +++ b/components/cic_disambiguation/Makefile @@ -0,0 +1,32 @@ + +PACKAGE = cic_disambiguation +NOTATIONS = number +INTERFACE_FILES = \ + disambiguateTypes.mli \ + disambiguateChoices.mli \ + disambiguate.mli +IMPLEMENTATION_FILES = \ + $(patsubst %.mli, %.ml, $(INTERFACE_FILES)) \ + $(patsubst %,%_notation.ml,$(NOTATIONS)) + +all: + +clean: +distclean: + rm -f macro_table.dump + +include ../../Makefile.defs +include ../Makefile.common + +OCAMLARCHIVEOPTIONS += -linkall + +disambiguateTypes.cmi: disambiguateTypes.mli + @echo " OCAMLC -rectypes $<" + @$(OCAMLC) -c -rectypes $< +disambiguateTypes.cmo: disambiguateTypes.ml disambiguateTypes.cmi + @echo " OCAMLC -rectypes $<" + @$(OCAMLC) -c -rectypes $< +disambiguateTypes.cmx: disambiguateTypes.ml disambiguateTypes.cmi + @echo " OCAMLOPT -rectypes $<" + @$(OCAMLOPT) -c -rectypes $< + diff --git a/components/cic_disambiguation/disambiguate.crit2.ml b/components/cic_disambiguation/disambiguate.crit2.ml new file mode 100644 index 000000000..7aeb65a21 --- /dev/null +++ b/components/cic_disambiguation/disambiguate.crit2.ml @@ -0,0 +1,1317 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id: disambiguate.ml 7760 2007-10-26 12:37:21Z sacerdot $ *) + +open Printf + +open DisambiguateTypes +open UriManager + +module Ast = CicNotationPt + +(* the integer is an offset to be added to each location *) +exception NoWellTypedInterpretation of + int * + ((Stdpp.location list * string * string) list * + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Stdpp.location option * string Lazy.t * bool) list +exception PathNotWellFormed + + (** raised when an environment is not enough informative to decide *) +exception Try_again of string Lazy.t + +type aliases = bool * DisambiguateTypes.environment +type 'a disambiguator_input = string * int * 'a + +type domain = domain_tree list +and domain_tree = Node of Stdpp.location list * domain_item * domain + +let rec string_of_domain = + function + [] -> "" + | Node (_,domain_item,l)::tl -> + DisambiguateTypes.string_of_domain_item domain_item ^ + " [ " ^ string_of_domain l ^ " ] " ^ string_of_domain tl + +let rec filter_map_domain f = + function + [] -> [] + | Node (locs,domain_item,l)::tl -> + match f locs domain_item with + None -> filter_map_domain f l @ filter_map_domain f tl + | Some res -> res :: filter_map_domain f l @ filter_map_domain f tl + +let rec map_domain f = + function + [] -> [] + | Node (locs,domain_item,l)::tl -> + f locs domain_item :: map_domain f l @ map_domain f tl + +let uniq_domain dom = + let rec aux seen = + function + [] -> seen,[] + | Node (locs,domain_item,l)::tl -> + if List.mem domain_item seen then + let seen,l = aux seen l in + let seen,tl = aux seen tl in + seen, l @ tl + else + let seen,l = aux (domain_item::seen) l in + let seen,tl = aux seen tl in + seen, Node (locs,domain_item,l)::tl + in + snd (aux [] dom) + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) else () + +(* + (** print benchmark information *) +let benchmark = true +let max_refinements = ref 0 (* benchmarking is not thread safe *) +let actual_refinements = ref 0 +let domain_size = ref 0 +let choices_avg = ref 0. +*) + +let descr_of_domain_item = function + | Id s -> s + | Symbol (s, _) -> s + | Num i -> string_of_int i + +type 'a test_result = + | Ok of 'a * Cic.metasenv + | Ko of Stdpp.location option * string Lazy.t + | Uncertain of Stdpp.location option * string Lazy.t + +let refine_term metasenv context uri term ugraph ~localization_tbl = +(* if benchmark then incr actual_refinements; *) + assert (uri=None); + debug_print (lazy (sprintf "TEST_INTERPRETATION: %s" (CicPp.ppterm term))); + try + let term', _, metasenv',ugraph1 = + CicRefine.type_of_aux' metasenv context term ugraph ~localization_tbl in + debug_print (lazy (sprintf "OK!!!")); + (Ok (term', metasenv')),ugraph1 + with + exn -> + let rec process_exn loc = + function + HExtlib.Localized (loc,exn) -> process_exn (Some loc) exn + | CicRefine.Uncertain msg -> + debug_print (lazy ("UNCERTAIN!!! [" ^ (Lazy.force msg) ^ "] " ^ CicPp.ppterm term)) ; + Uncertain (loc,msg),ugraph + | CicRefine.RefineFailure msg -> + debug_print (lazy (sprintf "PRUNED!!!\nterm%s\nmessage:%s" + (CicPp.ppterm term) (Lazy.force msg))); + Ko (loc,msg),ugraph + | exn -> raise exn + in + process_exn None exn + +let refine_obj metasenv context uri obj ugraph ~localization_tbl = + assert (context = []); + debug_print (lazy (sprintf "TEST_INTERPRETATION: %s" (CicPp.ppobj obj))) ; + try + let obj', metasenv,ugraph = + CicRefine.typecheck metasenv uri obj ~localization_tbl + in + debug_print (lazy (sprintf "OK!!!")); + (Ok (obj', metasenv)),ugraph + with + exn -> + let rec process_exn loc = + function + HExtlib.Localized (loc,exn) -> process_exn (Some loc) exn + | CicRefine.Uncertain msg -> + debug_print (lazy ("UNCERTAIN!!! [" ^ (Lazy.force msg) ^ "] " ^ CicPp.ppobj obj)) ; + Uncertain (loc,msg),ugraph + | CicRefine.RefineFailure msg -> + debug_print (lazy (sprintf "PRUNED!!!\nterm%s\nmessage:%s" + (CicPp.ppobj obj) (Lazy.force msg))) ; + Ko (loc,msg),ugraph + | exn -> raise exn + in + process_exn None exn + +let resolve (env: codomain_item Environment.t) (item: domain_item) ?(num = "") ?(args = []) () = + try + snd (Environment.find item env) env num args + with Not_found -> + failwith ("Domain item not found: " ^ + (DisambiguateTypes.string_of_domain_item item)) + + (* TODO move it to Cic *) +let find_in_context name context = + let rec aux acc = function + | [] -> raise Not_found + | Cic.Name hd :: tl when hd = name -> acc + | _ :: tl -> aux (acc + 1) tl + in + aux 1 context + +let interpretate_term ?(create_dummy_ids=false) ~(context: Cic.name list) ~env ~uri ~is_path ast + ~localization_tbl += + (* create_dummy_ids shouldbe used only for interpretating patterns *) + assert (uri = None); + let rec aux ~localize loc (context: Cic.name list) = function + | CicNotationPt.AttributedTerm (`Loc loc, term) -> + let res = aux ~localize loc context term in + if localize then Cic.CicHash.add localization_tbl res loc; + res + | CicNotationPt.AttributedTerm (_, term) -> aux ~localize loc context term + | CicNotationPt.Appl (CicNotationPt.Symbol (symb, i) :: args) -> + let cic_args = List.map (aux ~localize loc context) args in + resolve env (Symbol (symb, i)) ~args:cic_args () + | CicNotationPt.Appl terms -> + Cic.Appl (List.map (aux ~localize loc context) terms) + | CicNotationPt.Binder (binder_kind, (var, typ), body) -> + let cic_type = aux_option ~localize loc context (Some `Type) typ in + let cic_name = CicNotationUtil.cic_name_of_name var in + let cic_body = aux ~localize loc (cic_name :: context) body in + (match binder_kind with + | `Lambda -> Cic.Lambda (cic_name, cic_type, cic_body) + | `Pi + | `Forall -> Cic.Prod (cic_name, cic_type, cic_body) + | `Exists -> + resolve env (Symbol ("exists", 0)) + ~args:[ cic_type; Cic.Lambda (cic_name, cic_type, cic_body) ] ()) + | CicNotationPt.Case (term, indty_ident, outtype, branches) -> + let cic_term = aux ~localize loc context term in + let cic_outtype = aux_option ~localize loc context None outtype in + let do_branch ((head, _, args), term) = + let rec do_branch' context = function + | [] -> aux ~localize loc context term + | (name, typ) :: tl -> + let cic_name = CicNotationUtil.cic_name_of_name name in + let cic_body = do_branch' (cic_name :: context) tl in + let typ = + match typ with + | None -> Cic.Implicit (Some `Type) + | Some typ -> aux ~localize loc context typ + in + Cic.Lambda (cic_name, typ, cic_body) + in + do_branch' context args + in + let indtype_uri, indtype_no = + if create_dummy_ids then + (UriManager.uri_of_string "cic:/fake_indty.con", 0) + else + match indty_ident with + | Some (indty_ident, _) -> + (match resolve env (Id indty_ident) () with + | Cic.MutInd (uri, tyno, _) -> (uri, tyno) + | Cic.Implicit _ -> + raise (Try_again (lazy "The type of the term to be matched + is still unknown")) + | _ -> + raise (Invalid_choice (Some loc, lazy "The type of the term to be matched is not (co)inductive!"))) + | None -> + let rec fst_constructor = + function + (Ast.Pattern (head, _, _), _) :: _ -> head + | (Ast.Wildcard, _) :: tl -> fst_constructor tl + | [] -> raise (Invalid_choice (Some loc, lazy "The type of the term to be matched cannot be determined because it is an inductive type without constructors or because all patterns use wildcards")) + in + (match resolve env (Id (fst_constructor branches)) () with + | Cic.MutConstruct (indtype_uri, indtype_no, _, _) -> + (indtype_uri, indtype_no) + | Cic.Implicit _ -> + raise (Try_again (lazy "The type of the term to be matched + is still unknown")) + | _ -> + raise (Invalid_choice (Some loc, lazy "The type of the term to be matched is not (co)inductive!"))) + in + let branches = + if create_dummy_ids then + List.map + (function + Ast.Wildcard,term -> ("wildcard",None,[]), term + | Ast.Pattern _,_ -> + raise (Invalid_choice (Some loc, lazy "Syntax error: the left hand side of a branch patterns must be \"_\"")) + ) branches + else + match fst(CicEnvironment.get_obj CicUniv.empty_ugraph indtype_uri) with + Cic.InductiveDefinition (il,_,leftsno,_) -> + let _,_,_,cl = + try + List.nth il indtype_no + with _ -> assert false + in + let rec count_prod t = + match CicReduction.whd [] t with + Cic.Prod (_, _, t) -> 1 + (count_prod t) + | _ -> 0 + in + let rec sort branches cl = + match cl with + [] -> + let rec analyze unused unrecognized useless = + function + [] -> + if unrecognized != [] then + raise (Invalid_choice + (Some loc, + lazy + ("Unrecognized constructors: " ^ + String.concat " " unrecognized))) + else if useless > 0 then + raise (Invalid_choice + (Some loc, + lazy + ("The last " ^ string_of_int useless ^ + "case" ^ if useless > 1 then "s are" else " is" ^ + " unused"))) + else + [] + | (Ast.Wildcard,_)::tl when not unused -> + analyze true unrecognized useless tl + | (Ast.Pattern (head,_,_),_)::tl when not unused -> + analyze unused (head::unrecognized) useless tl + | _::tl -> analyze unused unrecognized (useless + 1) tl + in + analyze false [] 0 branches + | (name,ty)::cltl -> + let rec find_and_remove = + function + [] -> + raise + (Invalid_choice + (Some loc, lazy ("Missing case: " ^ name))) + | ((Ast.Wildcard, _) as branch :: _) as branches -> + branch, branches + | (Ast.Pattern (name',_,_),_) as branch :: tl + when name = name' -> + branch,tl + | branch::tl -> + let found,rest = find_and_remove tl in + found, branch::rest + in + let branch,tl = find_and_remove branches in + match branch with + Ast.Pattern (name,y,args),term -> + if List.length args = count_prod ty - leftsno then + ((name,y,args),term)::sort tl cltl + else + raise + (Invalid_choice + (Some loc, + lazy ("Wrong number of arguments for " ^ name))) + | Ast.Wildcard,term -> + let rec mk_lambdas = + function + 0 -> term + | n -> + CicNotationPt.Binder + (`Lambda, (CicNotationPt.Ident ("_", None), None), + mk_lambdas (n - 1)) + in + (("wildcard",None,[]), + mk_lambdas (count_prod ty - leftsno)) :: sort tl cltl + in + sort branches cl + | _ -> assert false + in + Cic.MutCase (indtype_uri, indtype_no, cic_outtype, cic_term, + (List.map do_branch branches)) + | CicNotationPt.Cast (t1, t2) -> + let cic_t1 = aux ~localize loc context t1 in + let cic_t2 = aux ~localize loc context t2 in + Cic.Cast (cic_t1, cic_t2) + | CicNotationPt.LetIn ((name, typ), def, body) -> + let cic_def = aux ~localize loc context def in + let cic_name = CicNotationUtil.cic_name_of_name name in + let cic_def = + match typ with + | None -> cic_def + | Some t -> Cic.Cast (cic_def, aux ~localize loc context t) + in + let cic_body = aux ~localize loc (cic_name :: context) body in + Cic.LetIn (cic_name, cic_def, cic_body) + | CicNotationPt.LetRec (kind, defs, body) -> + let context' = + List.fold_left + (fun acc (_, (name, _), _, _) -> + CicNotationUtil.cic_name_of_name name :: acc) + context defs + in + let cic_body = + let unlocalized_body = aux ~localize:false loc context' body in + match unlocalized_body with + Cic.Rel n when n <= List.length defs -> `AvoidLetInNoAppl n + | Cic.Appl (Cic.Rel n::l) when n <= List.length defs -> + (try + let l' = + List.map + (function t -> + let t',subst,metasenv = + CicMetaSubst.delift_rels [] [] (List.length defs) t + in + assert (subst=[]); + assert (metasenv=[]); + t') l + in + (* We can avoid the LetIn. But maybe we need to recompute l' + so that it is localized *) + if localize then + match body with + CicNotationPt.AttributedTerm (_,CicNotationPt.Appl(_::l)) -> + let l' = List.map (aux ~localize loc context) l in + `AvoidLetIn (n,l') + | _ -> assert false + else + `AvoidLetIn (n,l') + with + CicMetaSubst.DeliftingARelWouldCaptureAFreeVariable -> + if localize then + `AddLetIn (aux ~localize loc context' body) + else + `AddLetIn unlocalized_body) + | _ -> + if localize then + `AddLetIn (aux ~localize loc context' body) + else + `AddLetIn unlocalized_body + in + let inductiveFuns = + List.map + (fun (params, (name, typ), body, decr_idx) -> + let add_binders kind t = + List.fold_right + (fun var t -> CicNotationPt.Binder (kind, var, t)) params t + in + let cic_body = + aux ~localize loc context' (add_binders `Lambda body) in + let cic_type = + aux_option ~localize loc context (Some `Type) + (HExtlib.map_option (add_binders `Pi) typ) in + let name = + match CicNotationUtil.cic_name_of_name name with + | Cic.Anonymous -> + CicNotationPt.fail loc + "Recursive functions cannot be anonymous" + | Cic.Name name -> name + in + (name, decr_idx, cic_type, cic_body)) + defs + in + let fix_or_cofix n = + match kind with + `Inductive -> Cic.Fix (n,inductiveFuns) + | `CoInductive -> + let coinductiveFuns = + List.map + (fun (name, _, typ, body) -> name, typ, body) + inductiveFuns + in + Cic.CoFix (n,coinductiveFuns) + in + let counter = ref ~-1 in + let build_term funs (var,_,_,_) t = + incr counter; + Cic.LetIn (Cic.Name var, fix_or_cofix !counter, t) + in + (match cic_body with + `AvoidLetInNoAppl n -> + let n' = List.length inductiveFuns - n in + fix_or_cofix n' + | `AvoidLetIn (n,l) -> + let n' = List.length inductiveFuns - n in + Cic.Appl (fix_or_cofix n'::l) + | `AddLetIn cic_body -> + List.fold_right (build_term inductiveFuns) inductiveFuns + cic_body) + | CicNotationPt.Ident _ + | CicNotationPt.Uri _ when is_path -> raise PathNotWellFormed + | CicNotationPt.Ident (name, subst) + | CicNotationPt.Uri (name, subst) as ast -> + let is_uri = function CicNotationPt.Uri _ -> true | _ -> false in + (try + if is_uri ast then raise Not_found;(* don't search the env for URIs *) + let index = find_in_context name context in + if subst <> None then + CicNotationPt.fail loc "Explicit substitutions not allowed here"; + Cic.Rel index + with Not_found -> + let cic = + if is_uri ast then (* we have the URI, build the term out of it *) + try + CicUtil.term_of_uri (UriManager.uri_of_string name) + with UriManager.IllFormedUri _ -> + CicNotationPt.fail loc "Ill formed URI" + else + resolve env (Id name) () + in + let mk_subst uris = + let ids_to_uris = + List.map (fun uri -> UriManager.name_of_uri uri, uri) uris + in + (match subst with + | Some subst -> + List.map + (fun (s, term) -> + (try + List.assoc s ids_to_uris, aux ~localize loc context term + with Not_found -> + raise (Invalid_choice (Some loc, lazy "The provided explicit named substitution is trying to instantiate a named variable the object is not abstracted on")))) + subst + | None -> List.map (fun uri -> uri, Cic.Implicit None) uris) + in + (try + match cic with + | Cic.Const (uri, []) -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.Const (uri, mk_subst uris) + | Cic.Var (uri, []) -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.Var (uri, mk_subst uris) + | Cic.MutInd (uri, i, []) -> + (try + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.MutInd (uri, i, mk_subst uris) + with + CicEnvironment.Object_not_found _ -> + (* if we are here it is probably the case that during the + definition of a mutual inductive type we have met an + occurrence of the type in one of its constructors. + However, the inductive type is not yet in the environment + *) + (*here the explicit_named_substituion is assumed to be of length 0 *) + Cic.MutInd (uri,i,[])) + | Cic.MutConstruct (uri, i, j, []) -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.MutConstruct (uri, i, j, mk_subst uris) + | Cic.Meta _ | Cic.Implicit _ as t -> +(* + debug_print (lazy (sprintf + "Warning: %s must be instantiated with _[%s] but we do not enforce it" + (CicPp.ppterm t) + (String.concat "; " + (List.map + (fun (s, term) -> s ^ " := " ^ CicNotationPtPp.pp_term term) + subst)))); +*) + t + | _ -> + raise (Invalid_choice (Some loc, lazy "??? Can this happen?")) + with + CicEnvironment.CircularDependency _ -> + raise (Invalid_choice (None, lazy "Circular dependency in the environment")))) + | CicNotationPt.Implicit -> Cic.Implicit None + | CicNotationPt.UserInput -> Cic.Implicit (Some `Hole) + | CicNotationPt.Num (num, i) -> resolve env (Num i) ~num () + | CicNotationPt.Meta (index, subst) -> + let cic_subst = + List.map + (function + None -> None + | Some term -> Some (aux ~localize loc context term)) + subst + in + Cic.Meta (index, cic_subst) + | CicNotationPt.Sort `Prop -> Cic.Sort Cic.Prop + | CicNotationPt.Sort `Set -> Cic.Sort Cic.Set + | CicNotationPt.Sort (`Type u) -> Cic.Sort (Cic.Type u) + | CicNotationPt.Sort `CProp -> Cic.Sort Cic.CProp + | CicNotationPt.Symbol (symbol, instance) -> + resolve env (Symbol (symbol, instance)) () + | _ -> assert false (* god bless Bologna *) + and aux_option ~localize loc (context: Cic.name list) annotation = function + | None -> Cic.Implicit annotation + | Some term -> aux ~localize loc context term + in + aux ~localize:true HExtlib.dummy_floc context ast + +let interpretate_path ~context path = + let localization_tbl = Cic.CicHash.create 23 in + (* here we are throwing away useful localization informations!!! *) + fst ( + interpretate_term ~create_dummy_ids:true + ~context ~env:Environment.empty ~uri:None ~is_path:true + path ~localization_tbl, localization_tbl) + +let interpretate_obj ~context ~env ~uri ~is_path obj ~localization_tbl = + assert (context = []); + assert (is_path = false); + let interpretate_term = interpretate_term ~localization_tbl in + match obj with + | CicNotationPt.Inductive (params,tyl) -> + let uri = match uri with Some uri -> uri | None -> assert false in + let context,params = + let context,res = + List.fold_left + (fun (context,res) (name,t) -> + let t = + match t with + None -> CicNotationPt.Implicit + | Some t -> t in + let name = CicNotationUtil.cic_name_of_name name in + name::context,(name, interpretate_term context env None false t)::res + ) ([],[]) params + in + context,List.rev res in + let add_params = + List.fold_right (fun (name,ty) t -> Cic.Prod (name,ty,t)) params in + let name_to_uris = + snd ( + List.fold_left + (*here the explicit_named_substituion is assumed to be of length 0 *) + (fun (i,res) (name,_,_,_) -> + i + 1,(name,name,Cic.MutInd (uri,i,[]))::res + ) (0,[]) tyl) in + let con_env = DisambiguateTypes.env_of_list name_to_uris env in + let tyl = + List.map + (fun (name,b,ty,cl) -> + let ty' = add_params (interpretate_term context env None false ty) in + let cl' = + List.map + (fun (name,ty) -> + let ty' = + add_params (interpretate_term context con_env None false ty) + in + name,ty' + ) cl + in + name,b,ty',cl' + ) tyl + in + Cic.InductiveDefinition (tyl,[],List.length params,[]) + | CicNotationPt.Record (params,name,ty,fields) -> + let uri = match uri with Some uri -> uri | None -> assert false in + let context,params = + let context,res = + List.fold_left + (fun (context,res) (name,t) -> + let t = + match t with + None -> CicNotationPt.Implicit + | Some t -> t in + let name = CicNotationUtil.cic_name_of_name name in + name::context,(name, interpretate_term context env None false t)::res + ) ([],[]) params + in + context,List.rev res in + let add_params = + List.fold_right + (fun (name,ty) t -> Cic.Prod (name,ty,t)) params in + let ty' = add_params (interpretate_term context env None false ty) in + let fields' = + snd ( + List.fold_left + (fun (context,res) (name,ty,_coercion,arity) -> + let context' = Cic.Name name :: context in + context',(name,interpretate_term context env None false ty)::res + ) (context,[]) fields) in + let concl = + (*here the explicit_named_substituion is assumed to be of length 0 *) + let mutind = Cic.MutInd (uri,0,[]) in + if params = [] then mutind + else + Cic.Appl + (mutind::CicUtil.mk_rels (List.length params) (List.length fields)) in + let con = + List.fold_left + (fun t (name,ty) -> Cic.Prod (Cic.Name name,ty,t)) + concl fields' in + let con' = add_params con in + let tyl = [name,true,ty',["mk_" ^ name,con']] in + let field_names = List.map (fun (x,_,y,z) -> x,y,z) fields in + Cic.InductiveDefinition + (tyl,[],List.length params,[`Class (`Record field_names)]) + | CicNotationPt.Theorem (flavour, name, ty, bo) -> + let attrs = [`Flavour flavour] in + let ty' = interpretate_term [] env None false ty in + (match bo,flavour with + None,`Axiom -> + Cic.Constant (name,None,ty',[],attrs) + | Some bo,`Axiom -> assert false + | None,_ -> + Cic.CurrentProof (name,[],Cic.Implicit None,ty',[],attrs) + | Some bo,_ -> + let bo' = Some (interpretate_term [] env None false bo) in + Cic.Constant (name,bo',ty',[],attrs)) + +let rec domain_of_term ?(loc = HExtlib.dummy_floc) ~context = function + | Ast.AttributedTerm (`Loc loc, term) -> + domain_of_term ~loc ~context term + | Ast.AttributedTerm (_, term) -> + domain_of_term ~loc ~context term + | Ast.Symbol (symbol, instance) -> + [ Node ([loc], Symbol (symbol, instance), []) ] + (* to be kept in sync with Ast.Appl (Ast.Symbol ...) *) + | Ast.Appl (Ast.Symbol (symbol, instance) as hd :: args) + | Ast.Appl (Ast.AttributedTerm (_,Ast.Symbol (symbol, instance)) as hd :: args) + -> + let args_dom = + List.fold_right + (fun term acc -> domain_of_term ~loc ~context term @ acc) + args [] in + let loc = + match hd with + Ast.AttributedTerm (`Loc loc,_) -> loc + | _ -> loc + in + [ Node ([loc], Symbol (symbol, instance), args_dom) ] + | Ast.Appl (Ast.Ident (name, subst) as hd :: args) + | Ast.Appl (Ast.AttributedTerm (_,Ast.Ident (name, subst)) as hd :: args) -> + let args_dom = + List.fold_right + (fun term acc -> domain_of_term ~loc ~context term @ acc) + args [] in + let loc = + match hd with + Ast.AttributedTerm (`Loc loc,_) -> loc + | _ -> loc + in + (try + (* the next line can raise Not_found *) + ignore(find_in_context name context); + if subst <> None then + Ast.fail loc "Explicit substitutions not allowed here" + else + args_dom + with Not_found -> + (match subst with + | None -> [ Node ([loc], Id name, args_dom) ] + | Some subst -> + let terms = + List.fold_left + (fun dom (_, term) -> + let dom' = domain_of_term ~loc ~context term in + dom @ dom') + [] subst in + [ Node ([loc], Id name, terms @ args_dom) ])) + | Ast.Appl terms -> + List.fold_right + (fun term acc -> domain_of_term ~loc ~context term @ acc) + terms [] + | Ast.Binder (kind, (var, typ), body) -> + let type_dom = domain_of_term_option ~loc ~context typ in + let body_dom = + domain_of_term ~loc + ~context:(CicNotationUtil.cic_name_of_name var :: context) body in + (match kind with + | `Exists -> [ Node ([loc], Symbol ("exists", 0), (type_dom @ body_dom)) ] + | _ -> type_dom @ body_dom) + | Ast.Case (term, indty_ident, outtype, branches) -> + let term_dom = domain_of_term ~loc ~context term in + let outtype_dom = domain_of_term_option ~loc ~context outtype in + let rec get_first_constructor = function + | [] -> [] + | (Ast.Pattern (head, _, _), _) :: _ -> [ Node ([loc], Id head, []) ] + | _ :: tl -> get_first_constructor tl in + let do_branch = + function + Ast.Pattern (head, _, args), term -> + let (term_context, args_domain) = + List.fold_left + (fun (cont, dom) (name, typ) -> + (CicNotationUtil.cic_name_of_name name :: cont, + (match typ with + | None -> dom + | Some typ -> dom @ domain_of_term ~loc ~context:cont typ))) + (context, []) args + in + domain_of_term ~loc ~context:term_context term @ args_domain + | Ast.Wildcard, term -> + domain_of_term ~loc ~context term + in + let branches_dom = + List.fold_left (fun dom branch -> dom @ do_branch branch) [] branches in + (match indty_ident with + | None -> get_first_constructor branches + | Some (ident, _) -> [ Node ([loc], Id ident, []) ]) + @ term_dom @ outtype_dom @ branches_dom + | Ast.Cast (term, ty) -> + let term_dom = domain_of_term ~loc ~context term in + let ty_dom = domain_of_term ~loc ~context ty in + term_dom @ ty_dom + | Ast.LetIn ((var, typ), body, where) -> + let body_dom = domain_of_term ~loc ~context body in + let type_dom = domain_of_term_option ~loc ~context typ in + let where_dom = + domain_of_term ~loc + ~context:(CicNotationUtil.cic_name_of_name var :: context) where in + body_dom @ type_dom @ where_dom + | Ast.LetRec (kind, defs, where) -> + let add_defs context = + List.fold_left + (fun acc (_, (var, _), _, _) -> + CicNotationUtil.cic_name_of_name var :: acc + ) context defs in + let where_dom = domain_of_term ~loc ~context:(add_defs context) where in + let defs_dom = + List.fold_left + (fun dom (params, (_, typ), body, _) -> + let context' = + add_defs + (List.fold_left + (fun acc (var,_) -> CicNotationUtil.cic_name_of_name var :: acc) + context params) + in + List.rev + (snd + (List.fold_left + (fun (context,res) (var,ty) -> + CicNotationUtil.cic_name_of_name var :: context, + domain_of_term_option ~loc ~context ty @ res) + (add_defs context,[]) params)) + @ domain_of_term_option ~loc ~context:context' typ + @ domain_of_term ~loc ~context:context' body + ) [] defs + in + defs_dom @ where_dom + | Ast.Ident (name, subst) -> + (try + (* the next line can raise Not_found *) + ignore(find_in_context name context); + if subst <> None then + Ast.fail loc "Explicit substitutions not allowed here" + else + [] + with Not_found -> + (match subst with + | None -> [ Node ([loc], Id name, []) ] + | Some subst -> + let terms = + List.fold_left + (fun dom (_, term) -> + let dom' = domain_of_term ~loc ~context term in + dom @ dom') + [] subst in + [ Node ([loc], Id name, terms) ])) + | Ast.Uri _ -> [] + | Ast.Implicit -> [] + | Ast.Num (num, i) -> [ Node ([loc], Num i, []) ] + | Ast.Meta (index, local_context) -> + List.fold_left + (fun dom term -> dom @ domain_of_term_option ~loc ~context term) + [] local_context + | Ast.Sort _ -> [] + | Ast.UserInput + | Ast.Literal _ + | Ast.Layout _ + | Ast.Magic _ + | Ast.Variable _ -> assert false + +and domain_of_term_option ~loc ~context = function + | None -> [] + | Some t -> domain_of_term ~loc ~context t + +let domain_of_term ~context term = + uniq_domain (domain_of_term ~context term) + +let domain_of_obj ~context ast = + assert (context = []); + match ast with + | Ast.Theorem (_,_,ty,bo) -> + domain_of_term [] ty + @ (match bo with + None -> [] + | Some bo -> domain_of_term [] bo) + | Ast.Inductive (params,tyl) -> + let context, dom = + List.fold_left + (fun (context, dom) (var, ty) -> + let context' = CicNotationUtil.cic_name_of_name var :: context in + match ty with + None -> context', dom + | Some ty -> context', dom @ domain_of_term context ty + ) ([], []) params in + let context_w_types = + List.rev_map + (fun (var, _, _, _) -> Cic.Name var) tyl + @ context in + dom + @ List.flatten ( + List.map + (fun (_,_,ty,cl) -> + domain_of_term context ty + @ List.flatten ( + List.map + (fun (_,ty) -> domain_of_term context_w_types ty) cl)) + tyl) + | CicNotationPt.Record (params,var,ty,fields) -> + let context, dom = + List.fold_left + (fun (context, dom) (var, ty) -> + let context' = CicNotationUtil.cic_name_of_name var :: context in + match ty with + None -> context', dom + | Some ty -> context', dom @ domain_of_term context ty + ) ([], []) params in + let context_w_types = Cic.Name var :: context in + dom + @ domain_of_term context ty + @ snd + (List.fold_left + (fun (context,res) (name,ty,_,_) -> + Cic.Name name::context, res @ domain_of_term context ty + ) (context_w_types,[]) fields) + +let domain_of_obj ~context obj = + uniq_domain (domain_of_obj ~context obj) + + (* dom1 \ dom2 *) +let domain_diff dom1 dom2 = +(* let domain_diff = Domain.diff *) + let is_in_dom2 elt = + List.exists + (function + | Symbol (symb, 0) -> + (match elt with + Symbol (symb',_) when symb = symb' -> true + | _ -> false) + | Num i -> + (match elt with + Num _ -> true + | _ -> false) + | item -> elt = item + ) dom2 + in + let rec aux = + function + [] -> [] + | Node (_,elt,l)::tl when is_in_dom2 elt -> aux (l @ tl) + | Node (loc,elt,l)::tl -> Node (loc,elt,aux l)::(aux tl) + in + aux dom1 + +module type Disambiguator = +sig + val disambiguate_term : + ?fresh_instances:bool -> + dbd:HSql.dbd -> + context:Cic.context -> + metasenv:Cic.metasenv -> + ?initial_ugraph:CicUniv.universe_graph -> + aliases:DisambiguateTypes.environment ->(* previous interpretation status *) + universe:DisambiguateTypes.multiple_environment option -> + CicNotationPt.term disambiguator_input -> + ((DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Cic.metasenv * (* new metasenv *) + Cic.term* + CicUniv.universe_graph) list * (* disambiguated term *) + bool + + val disambiguate_obj : + ?fresh_instances:bool -> + dbd:HSql.dbd -> + aliases:DisambiguateTypes.environment ->(* previous interpretation status *) + universe:DisambiguateTypes.multiple_environment option -> + uri:UriManager.uri option -> (* required only for inductive types *) + CicNotationPt.term CicNotationPt.obj disambiguator_input -> + ((DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Cic.metasenv * (* new metasenv *) + Cic.obj * + CicUniv.universe_graph) list * (* disambiguated obj *) + bool +end + +module Make (C: Callbacks) = + struct + let choices_of_id dbd id = + let uris = Whelp.locate ~dbd id in + let uris = + match uris with + | [] -> + (match + (C.input_or_locate_uri + ~title:("URI matching \"" ^ id ^ "\" unknown.") ~id ()) + with + | None -> [] + | Some uri -> [uri]) + | [uri] -> [uri] + | _ -> + C.interactive_user_uri_choice ~selection_mode:`MULTIPLE + ~ok:"Try selected." ~enable_button_for_non_vars:true + ~title:"Ambiguous input." ~id + ~msg: ("Ambiguous input \"" ^ id ^ + "\". Please, choose one or more interpretations:") + uris + in + List.map + (fun uri -> + (UriManager.string_of_uri uri, + let term = + try + CicUtil.term_of_uri uri + with exn -> + debug_print (lazy (UriManager.string_of_uri uri)); + debug_print (lazy (Printexc.to_string exn)); + assert false + in + fun _ _ _ -> term)) + uris + +let refine_profiler = HExtlib.profile "disambiguate_thing.refine_thing" + + let disambiguate_thing ~dbd ~context ~metasenv + ?(initial_ugraph = CicUniv.empty_ugraph) ~aliases ~universe + ~uri ~pp_thing ~domain_of_thing ~interpretate_thing ~refine_thing + (thing_txt,thing_txt_prefix_len,thing) + = + debug_print (lazy "DISAMBIGUATE INPUT"); + let disambiguate_context = (* cic context -> disambiguate context *) + List.map + (function None -> Cic.Anonymous | Some (name, _) -> name) + context + in + debug_print (lazy ("TERM IS: " ^ (pp_thing thing))); + let thing_dom = domain_of_thing ~context:disambiguate_context thing in + debug_print + (lazy (sprintf "DISAMBIGUATION DOMAIN: %s"(string_of_domain thing_dom))); +(* + debug_print (lazy (sprintf "DISAMBIGUATION ENVIRONMENT: %s" + (DisambiguatePp.pp_environment aliases))); + debug_print (lazy (sprintf "DISAMBIGUATION UNIVERSE: %s" + (match universe with None -> "None" | Some _ -> "Some _"))); +*) + let current_dom = + Environment.fold (fun item _ dom -> item :: dom) aliases [] in + let todo_dom = domain_diff thing_dom current_dom in + debug_print + (lazy (sprintf "DISAMBIGUATION DOMAIN AFTER DIFF: %s"(string_of_domain todo_dom))); + (* (2) lookup function for any item (Id/Symbol/Num) *) + let lookup_choices = + fun item -> + let choices = + let lookup_in_library () = + match item with + | Id id -> choices_of_id dbd id + | Symbol (symb, _) -> + (try + List.map DisambiguateChoices.mk_choice + (TermAcicContent.lookup_interpretations symb) + with + TermAcicContent.Interpretation_not_found -> []) + | Num instance -> + DisambiguateChoices.lookup_num_choices () + in + match universe with + | None -> lookup_in_library () + | Some e -> + (try + let item = + match item with + | Symbol (symb, _) -> Symbol (symb, 0) + | item -> item + in + Environment.find item e + with Not_found -> lookup_in_library ()) + in + choices + in +(* + (* *) + let _ = + if benchmark then begin + let per_item_choices = + List.map + (fun dom_item -> + try + let len = List.length (lookup_choices dom_item) in + debug_print (lazy (sprintf "BENCHMARK %s: %d" + (string_of_domain_item dom_item) len)); + len + with No_choices _ -> 0) + thing_dom + in + max_refinements := List.fold_left ( * ) 1 per_item_choices; + actual_refinements := 0; + domain_size := List.length thing_dom; + choices_avg := + (float_of_int !max_refinements) ** (1. /. float_of_int !domain_size) + end + in + (* *) +*) + + (* (3) test an interpretation filling with meta uninterpreted identifiers + *) + let test_env aliases todo_dom ugraph = + let rec aux env = function + | [] -> env + | Node (_, item, l) :: tl -> + let env = + Environment.add item + ("Implicit", + (match item with + | Id _ | Num _ -> + (fun _ _ _ -> Cic.Implicit (Some `Closed)) + | Symbol _ -> (fun _ _ _ -> Cic.Implicit None))) + env in + aux (aux env l) tl in + let filled_env = aux aliases todo_dom in + try + let localization_tbl = Cic.CicHash.create 503 in + let cic_thing = + interpretate_thing ~context:disambiguate_context ~env:filled_env + ~uri ~is_path:false thing ~localization_tbl + in +let foo () = + let k,ugraph1 = + refine_thing metasenv context uri cic_thing ugraph ~localization_tbl + in + (k , ugraph1 ) +in refine_profiler.HExtlib.profile foo () + with + | Try_again msg -> Uncertain (None,msg), ugraph + | Invalid_choice (loc,msg) -> Ko (loc,msg), ugraph + in + (* (4) build all possible interpretations *) + let (@@) (l1,l2,l3) (l1',l2',l3') = l1@l1', l2@l2', l3@l3' in + (* aux returns triples Ok/Uncertain/Ko *) + (* rem_dom is the concatenation of all the remaining domains *) + let rec aux aliases diff lookup_in_todo_dom todo_dom rem_dom base_univ = + (* debug_print (lazy ("ZZZ: " ^ string_of_domain todo_dom)); *) + match todo_dom with + | Node (locs,item,inner_dom) -> + debug_print (lazy (sprintf "CHOOSED ITEM: %s" + (string_of_domain_item item))); + let choices = + match lookup_in_todo_dom with + None -> lookup_choices item + | Some choices -> choices in + match choices with + [] -> + [], [], + [aliases, diff, Some (List.hd locs), + lazy ("No choices for " ^ string_of_domain_item item), + true] +(* + | [codomain_item] -> + (* just one choice. We perform a one-step look-up and + if the next set of choices is also a singleton we + skip this refinement step *) + debug_print(lazy (sprintf "%s CHOSEN" (fst codomain_item))); + let new_env = Environment.add item codomain_item aliases in + let new_diff = (item,codomain_item)::diff in + let lookup_in_todo_dom,next_choice_is_single = + match remaining_dom with + [] -> None,false + | (_,he)::_ -> + let choices = lookup_choices he in + Some choices,List.length choices = 1 + in + if next_choice_is_single then + aux new_env new_diff lookup_in_todo_dom remaining_dom + base_univ + else + (match test_env new_env remaining_dom base_univ with + | Ok (thing, metasenv),new_univ -> + (match remaining_dom with + | [] -> + [ new_env, new_diff, metasenv, thing, new_univ ], [] + | _ -> + aux new_env new_diff lookup_in_todo_dom + remaining_dom new_univ) + | Uncertain (loc,msg),new_univ -> + (match remaining_dom with + | [] -> [], [new_env,new_diff,loc,msg,true] + | _ -> + aux new_env new_diff lookup_in_todo_dom + remaining_dom new_univ) + | Ko (loc,msg),_ -> [], [new_env,new_diff,loc,msg,true]) +*) + | _::_ -> + let outcomes = + List.map + (function codomain_item -> + debug_print(lazy (sprintf "%s CHOSEN" (fst codomain_item))); + let new_env = Environment.add item codomain_item aliases in + let new_diff = (item,codomain_item)::diff in + test_env new_env (inner_dom@rem_dom) base_univ, + new_env,new_diff + ) choices in + let some_outcome_ok = + List.exists + (function + (Ok (_,_),_),_,_ + | (Uncertain (_,_),_),_,_ -> true + | _ -> false) + outcomes in + let rec filter univ = function + | [] -> [],[],[] + | (outcome,new_env,new_diff) :: tl -> + match outcome with + | Ok (thing, metasenv),new_univ -> + let res = + (match inner_dom with + | [] -> + [new_env,new_diff,metasenv,thing,new_univ], [], [] + | _ -> + visit_children new_env new_diff new_univ rem_dom inner_dom) + in + res @@ filter univ tl + | Uncertain (loc,msg),new_univ -> + let res = + (match inner_dom with + | [] -> [],[new_env,new_diff,loc,msg,new_univ],[] + | _ -> + visit_children new_env new_diff new_univ rem_dom inner_dom) + in + res @@ filter univ tl + | Ko (loc,msg),_ -> + let res = + [],[],[new_env,new_diff,loc,msg,not some_outcome_ok] + in + res @@ filter univ tl + in + filter base_univ outcomes + and visit_children env diff univ rem_dom = + function + [] -> assert false + | [dom] -> aux env diff None dom rem_dom univ + | dom::remaining_dom -> + let ok_l,uncertain_l,error_l = + aux env diff None dom (remaining_dom@rem_dom) univ + in + let res_after_ok_l = + List.fold_right + (fun (env,diff,_,_,univ) res -> + visit_children env diff univ rem_dom remaining_dom + @@ res + ) ok_l ([],[],error_l) + in + List.fold_right + (fun (env,diff,_,_,univ) res -> + visit_children env diff univ rem_dom remaining_dom + @@ res + ) uncertain_l res_after_ok_l + in + let aux' aliases diff lookup_in_todo_dom todo_dom base_univ = + match test_env aliases todo_dom base_univ with + | Ok (thing, metasenv),new_univ -> + if todo_dom = [] then + [ aliases, diff, metasenv, thing, new_univ ], [], [] + else + visit_children aliases diff base_univ [] todo_dom +(* + _lookup_in_todo_dom_ +*) + | Uncertain (loc,msg),new_univ -> + if todo_dom = [] then + [],[aliases,diff,loc,msg,new_univ],[] + else + visit_children aliases diff base_univ [] todo_dom +(* + _lookup_in_todo_dom_ +*) + | Ko (loc,msg),_ -> [],[],[aliases,diff,loc,msg,true] in + let base_univ = initial_ugraph in + try + let res = + match aux' aliases [] None todo_dom base_univ with + | [],uncertain,errors -> + debug_print (lazy "NO INTERPRETATIONS"); + let errors = + List.map + (fun (env,diff,loc,msg,_) -> (env,diff,loc,msg,true) + ) uncertain @ errors + in + let errors = + List.map + (fun (env,diff,loc,msg,significant) -> + let env' = + filter_map_domain + (fun locs domain_item -> + try + let description = + fst (Environment.find domain_item env) + in + Some (locs,descr_of_domain_item domain_item,description) + with + Not_found -> None) + thing_dom + in + env',diff,loc,msg,significant + ) errors + in + raise (NoWellTypedInterpretation (0,errors)) + | [_,diff,metasenv,t,ugraph],_,_ -> + debug_print (lazy "SINGLE INTERPRETATION"); + [diff,metasenv,t,ugraph], false + | l,_,_ -> + debug_print + (lazy (sprintf "MANY INTERPRETATIONS (%d)" (List.length l))); + let choices = + List.map + (fun (env, _, _, _, _) -> + map_domain + (fun locs domain_item -> + let description = + fst (Environment.find domain_item env) + in + locs,descr_of_domain_item domain_item, description) + thing_dom) + l + in + let choosed = + C.interactive_interpretation_choice + thing_txt thing_txt_prefix_len choices + in + (List.map (fun n->let _,d,m,t,u= List.nth l n in d,m,t,u) choosed), + true + in + res + with + CicEnvironment.CircularDependency s -> + failwith "Disambiguate: circular dependency" + + let disambiguate_term ?(fresh_instances=false) ~dbd ~context ~metasenv + ?(initial_ugraph = CicUniv.empty_ugraph) ~aliases ~universe + (text,prefix_len,term) + = + let term = + if fresh_instances then CicNotationUtil.freshen_term term else term + in + disambiguate_thing ~dbd ~context ~metasenv ~initial_ugraph ~aliases + ~universe ~uri:None ~pp_thing:CicNotationPp.pp_term + ~domain_of_thing:domain_of_term + ~interpretate_thing:(interpretate_term (?create_dummy_ids:None)) + ~refine_thing:refine_term (text,prefix_len,term) + + let disambiguate_obj ?(fresh_instances=false) ~dbd ~aliases ~universe ~uri + (text,prefix_len,obj) + = + let obj = + if fresh_instances then CicNotationUtil.freshen_obj obj else obj + in + disambiguate_thing ~dbd ~context:[] ~metasenv:[] ~aliases ~universe ~uri + ~pp_thing:(CicNotationPp.pp_obj CicNotationPp.pp_term) ~domain_of_thing:domain_of_obj + ~interpretate_thing:interpretate_obj ~refine_thing:refine_obj + (text,prefix_len,obj) + end + diff --git a/components/cic_disambiguation/disambiguate.crit4.ml b/components/cic_disambiguation/disambiguate.crit4.ml new file mode 100644 index 000000000..0a966ba3a --- /dev/null +++ b/components/cic_disambiguation/disambiguate.crit4.ml @@ -0,0 +1,1294 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id: disambiguate.ml 7760 2007-10-26 12:37:21Z sacerdot $ *) + +open Printf + +open DisambiguateTypes +open UriManager + +module Ast = CicNotationPt + +(* the integer is an offset to be added to each location *) +exception NoWellTypedInterpretation of + int * + ((Stdpp.location list * string * string) list * + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Stdpp.location option * string Lazy.t * bool) list +exception PathNotWellFormed + + (** raised when an environment is not enough informative to decide *) +exception Try_again of string Lazy.t + +type aliases = bool * DisambiguateTypes.environment +type 'a disambiguator_input = string * int * 'a + +type domain = domain_tree list +and domain_tree = Node of Stdpp.location list * domain_item * domain + +let rec string_of_domain = + function + [] -> "" + | Node (_,domain_item,l)::tl -> + DisambiguateTypes.string_of_domain_item domain_item ^ + " [ " ^ string_of_domain l ^ " ] " ^ string_of_domain tl + +let rec filter_map_domain f = + function + [] -> [] + | Node (locs,domain_item,l)::tl -> + match f locs domain_item with + None -> filter_map_domain f l @ filter_map_domain f tl + | Some res -> res :: filter_map_domain f l @ filter_map_domain f tl + +let rec map_domain f = + function + [] -> [] + | Node (locs,domain_item,l)::tl -> + f locs domain_item :: map_domain f l @ map_domain f tl + +let uniq_domain dom = + let rec aux seen = + function + [] -> seen,[] + | Node (locs,domain_item,l)::tl -> + if List.mem domain_item seen then + let seen,l = aux seen l in + let seen,tl = aux seen tl in + seen, l @ tl + else + let seen,l = aux (domain_item::seen) l in + let seen,tl = aux seen tl in + seen, Node (locs,domain_item,l)::tl + in + snd (aux [] dom) + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) else () + +(* + (** print benchmark information *) +let benchmark = true +let max_refinements = ref 0 (* benchmarking is not thread safe *) +let actual_refinements = ref 0 +let domain_size = ref 0 +let choices_avg = ref 0. +*) + +let descr_of_domain_item = function + | Id s -> s + | Symbol (s, _) -> s + | Num i -> string_of_int i + +type 'a test_result = + | Ok of 'a * Cic.metasenv * CicUniv.universe_graph + | Ko of Stdpp.location option * string Lazy.t + | Uncertain of Stdpp.location option * string Lazy.t + +let refine_term metasenv context uri term ugraph ~localization_tbl = +(* if benchmark then incr actual_refinements; *) + assert (uri=None); + debug_print (lazy (sprintf "TEST_INTERPRETATION: %s" (CicPp.ppterm term))); + try + let term', _, metasenv',ugraph1 = + CicRefine.type_of_aux' metasenv context term ugraph ~localization_tbl in + debug_print (lazy (sprintf "OK!!!")); + Ok (term', metasenv',ugraph1) + with + exn -> + let rec process_exn loc = + function + HExtlib.Localized (loc,exn) -> process_exn (Some loc) exn + | CicRefine.Uncertain msg -> + debug_print (lazy ("UNCERTAIN!!! [" ^ (Lazy.force msg) ^ "] " ^ CicPp.ppterm term)) ; + Uncertain (loc,msg) + | CicRefine.RefineFailure msg -> + debug_print (lazy (sprintf "PRUNED!!!\nterm%s\nmessage:%s" + (CicPp.ppterm term) (Lazy.force msg))); + Ko (loc,msg) + | exn -> raise exn + in + process_exn None exn + +let refine_obj metasenv context uri obj ugraph ~localization_tbl = + assert (context = []); + debug_print (lazy (sprintf "TEST_INTERPRETATION: %s" (CicPp.ppobj obj))) ; + try + let obj', metasenv,ugraph = + CicRefine.typecheck metasenv uri obj ~localization_tbl + in + debug_print (lazy (sprintf "OK!!!")); + Ok (obj', metasenv,ugraph) + with + exn -> + let rec process_exn loc = + function + HExtlib.Localized (loc,exn) -> process_exn (Some loc) exn + | CicRefine.Uncertain msg -> + debug_print (lazy ("UNCERTAIN!!! [" ^ (Lazy.force msg) ^ "] " ^ CicPp.ppobj obj)) ; + Uncertain (loc,msg) + | CicRefine.RefineFailure msg -> + debug_print (lazy (sprintf "PRUNED!!!\nterm%s\nmessage:%s" + (CicPp.ppobj obj) (Lazy.force msg))) ; + Ko (loc,msg) + | exn -> raise exn + in + process_exn None exn + +let resolve (env: codomain_item Environment.t) (item: domain_item) ?(num = "") ?(args = []) () = + try + snd (Environment.find item env) env num args + with Not_found -> + failwith ("Domain item not found: " ^ + (DisambiguateTypes.string_of_domain_item item)) + + (* TODO move it to Cic *) +let find_in_context name context = + let rec aux acc = function + | [] -> raise Not_found + | Cic.Name hd :: tl when hd = name -> acc + | _ :: tl -> aux (acc + 1) tl + in + aux 1 context + +let interpretate_term ?(create_dummy_ids=false) ~(context: Cic.name list) ~env ~uri ~is_path ast + ~localization_tbl += + (* create_dummy_ids shouldbe used only for interpretating patterns *) + assert (uri = None); + let rec aux ~localize loc (context: Cic.name list) = function + | CicNotationPt.AttributedTerm (`Loc loc, term) -> + let res = aux ~localize loc context term in + if localize then Cic.CicHash.add localization_tbl res loc; + res + | CicNotationPt.AttributedTerm (_, term) -> aux ~localize loc context term + | CicNotationPt.Appl (CicNotationPt.Symbol (symb, i) :: args) -> + let cic_args = List.map (aux ~localize loc context) args in + resolve env (Symbol (symb, i)) ~args:cic_args () + | CicNotationPt.Appl terms -> + Cic.Appl (List.map (aux ~localize loc context) terms) + | CicNotationPt.Binder (binder_kind, (var, typ), body) -> + let cic_type = aux_option ~localize loc context (Some `Type) typ in + let cic_name = CicNotationUtil.cic_name_of_name var in + let cic_body = aux ~localize loc (cic_name :: context) body in + (match binder_kind with + | `Lambda -> Cic.Lambda (cic_name, cic_type, cic_body) + | `Pi + | `Forall -> Cic.Prod (cic_name, cic_type, cic_body) + | `Exists -> + resolve env (Symbol ("exists", 0)) + ~args:[ cic_type; Cic.Lambda (cic_name, cic_type, cic_body) ] ()) + | CicNotationPt.Case (term, indty_ident, outtype, branches) -> + let cic_term = aux ~localize loc context term in + let cic_outtype = aux_option ~localize loc context None outtype in + let do_branch ((head, _, args), term) = + let rec do_branch' context = function + | [] -> aux ~localize loc context term + | (name, typ) :: tl -> + let cic_name = CicNotationUtil.cic_name_of_name name in + let cic_body = do_branch' (cic_name :: context) tl in + let typ = + match typ with + | None -> Cic.Implicit (Some `Type) + | Some typ -> aux ~localize loc context typ + in + Cic.Lambda (cic_name, typ, cic_body) + in + do_branch' context args + in + let indtype_uri, indtype_no = + if create_dummy_ids then + (UriManager.uri_of_string "cic:/fake_indty.con", 0) + else + match indty_ident with + | Some (indty_ident, _) -> + (match resolve env (Id indty_ident) () with + | Cic.MutInd (uri, tyno, _) -> (uri, tyno) + | Cic.Implicit _ -> + raise (Try_again (lazy "The type of the term to be matched + is still unknown")) + | _ -> + raise (Invalid_choice (Some loc, lazy "The type of the term to be matched is not (co)inductive!"))) + | None -> + let rec fst_constructor = + function + (Ast.Pattern (head, _, _), _) :: _ -> head + | (Ast.Wildcard, _) :: tl -> fst_constructor tl + | [] -> raise (Invalid_choice (Some loc, lazy "The type of the term to be matched cannot be determined because it is an inductive type without constructors or because all patterns use wildcards")) + in + (match resolve env (Id (fst_constructor branches)) () with + | Cic.MutConstruct (indtype_uri, indtype_no, _, _) -> + (indtype_uri, indtype_no) + | Cic.Implicit _ -> + raise (Try_again (lazy "The type of the term to be matched + is still unknown")) + | _ -> + raise (Invalid_choice (Some loc, lazy "The type of the term to be matched is not (co)inductive!"))) + in + let branches = + if create_dummy_ids then + List.map + (function + Ast.Wildcard,term -> ("wildcard",None,[]), term + | Ast.Pattern _,_ -> + raise (Invalid_choice (Some loc, lazy "Syntax error: the left hand side of a branch patterns must be \"_\"")) + ) branches + else + match fst(CicEnvironment.get_obj CicUniv.empty_ugraph indtype_uri) with + Cic.InductiveDefinition (il,_,leftsno,_) -> + let _,_,_,cl = + try + List.nth il indtype_no + with _ -> assert false + in + let rec count_prod t = + match CicReduction.whd [] t with + Cic.Prod (_, _, t) -> 1 + (count_prod t) + | _ -> 0 + in + let rec sort branches cl = + match cl with + [] -> + let rec analyze unused unrecognized useless = + function + [] -> + if unrecognized != [] then + raise (Invalid_choice + (Some loc, + lazy + ("Unrecognized constructors: " ^ + String.concat " " unrecognized))) + else if useless > 0 then + raise (Invalid_choice + (Some loc, + lazy + ("The last " ^ string_of_int useless ^ + "case" ^ if useless > 1 then "s are" else " is" ^ + " unused"))) + else + [] + | (Ast.Wildcard,_)::tl when not unused -> + analyze true unrecognized useless tl + | (Ast.Pattern (head,_,_),_)::tl when not unused -> + analyze unused (head::unrecognized) useless tl + | _::tl -> analyze unused unrecognized (useless + 1) tl + in + analyze false [] 0 branches + | (name,ty)::cltl -> + let rec find_and_remove = + function + [] -> + raise + (Invalid_choice + (Some loc, lazy ("Missing case: " ^ name))) + | ((Ast.Wildcard, _) as branch :: _) as branches -> + branch, branches + | (Ast.Pattern (name',_,_),_) as branch :: tl + when name = name' -> + branch,tl + | branch::tl -> + let found,rest = find_and_remove tl in + found, branch::rest + in + let branch,tl = find_and_remove branches in + match branch with + Ast.Pattern (name,y,args),term -> + if List.length args = count_prod ty - leftsno then + ((name,y,args),term)::sort tl cltl + else + raise + (Invalid_choice + (Some loc, + lazy ("Wrong number of arguments for " ^ name))) + | Ast.Wildcard,term -> + let rec mk_lambdas = + function + 0 -> term + | n -> + CicNotationPt.Binder + (`Lambda, (CicNotationPt.Ident ("_", None), None), + mk_lambdas (n - 1)) + in + (("wildcard",None,[]), + mk_lambdas (count_prod ty - leftsno)) :: sort tl cltl + in + sort branches cl + | _ -> assert false + in + Cic.MutCase (indtype_uri, indtype_no, cic_outtype, cic_term, + (List.map do_branch branches)) + | CicNotationPt.Cast (t1, t2) -> + let cic_t1 = aux ~localize loc context t1 in + let cic_t2 = aux ~localize loc context t2 in + Cic.Cast (cic_t1, cic_t2) + | CicNotationPt.LetIn ((name, typ), def, body) -> + let cic_def = aux ~localize loc context def in + let cic_name = CicNotationUtil.cic_name_of_name name in + let cic_def = + match typ with + | None -> cic_def + | Some t -> Cic.Cast (cic_def, aux ~localize loc context t) + in + let cic_body = aux ~localize loc (cic_name :: context) body in + Cic.LetIn (cic_name, cic_def, cic_body) + | CicNotationPt.LetRec (kind, defs, body) -> + let context' = + List.fold_left + (fun acc (_, (name, _), _, _) -> + CicNotationUtil.cic_name_of_name name :: acc) + context defs + in + let cic_body = + let unlocalized_body = aux ~localize:false loc context' body in + match unlocalized_body with + Cic.Rel n when n <= List.length defs -> `AvoidLetInNoAppl n + | Cic.Appl (Cic.Rel n::l) when n <= List.length defs -> + (try + let l' = + List.map + (function t -> + let t',subst,metasenv = + CicMetaSubst.delift_rels [] [] (List.length defs) t + in + assert (subst=[]); + assert (metasenv=[]); + t') l + in + (* We can avoid the LetIn. But maybe we need to recompute l' + so that it is localized *) + if localize then + match body with + CicNotationPt.AttributedTerm (_,CicNotationPt.Appl(_::l)) -> + let l' = List.map (aux ~localize loc context) l in + `AvoidLetIn (n,l') + | _ -> assert false + else + `AvoidLetIn (n,l') + with + CicMetaSubst.DeliftingARelWouldCaptureAFreeVariable -> + if localize then + `AddLetIn (aux ~localize loc context' body) + else + `AddLetIn unlocalized_body) + | _ -> + if localize then + `AddLetIn (aux ~localize loc context' body) + else + `AddLetIn unlocalized_body + in + let inductiveFuns = + List.map + (fun (params, (name, typ), body, decr_idx) -> + let add_binders kind t = + List.fold_right + (fun var t -> CicNotationPt.Binder (kind, var, t)) params t + in + let cic_body = + aux ~localize loc context' (add_binders `Lambda body) in + let cic_type = + aux_option ~localize loc context (Some `Type) + (HExtlib.map_option (add_binders `Pi) typ) in + let name = + match CicNotationUtil.cic_name_of_name name with + | Cic.Anonymous -> + CicNotationPt.fail loc + "Recursive functions cannot be anonymous" + | Cic.Name name -> name + in + (name, decr_idx, cic_type, cic_body)) + defs + in + let fix_or_cofix n = + match kind with + `Inductive -> Cic.Fix (n,inductiveFuns) + | `CoInductive -> + let coinductiveFuns = + List.map + (fun (name, _, typ, body) -> name, typ, body) + inductiveFuns + in + Cic.CoFix (n,coinductiveFuns) + in + let counter = ref ~-1 in + let build_term funs (var,_,_,_) t = + incr counter; + Cic.LetIn (Cic.Name var, fix_or_cofix !counter, t) + in + (match cic_body with + `AvoidLetInNoAppl n -> + let n' = List.length inductiveFuns - n in + fix_or_cofix n' + | `AvoidLetIn (n,l) -> + let n' = List.length inductiveFuns - n in + Cic.Appl (fix_or_cofix n'::l) + | `AddLetIn cic_body -> + List.fold_right (build_term inductiveFuns) inductiveFuns + cic_body) + | CicNotationPt.Ident _ + | CicNotationPt.Uri _ when is_path -> raise PathNotWellFormed + | CicNotationPt.Ident (name, subst) + | CicNotationPt.Uri (name, subst) as ast -> + let is_uri = function CicNotationPt.Uri _ -> true | _ -> false in + (try + if is_uri ast then raise Not_found;(* don't search the env for URIs *) + let index = find_in_context name context in + if subst <> None then + CicNotationPt.fail loc "Explicit substitutions not allowed here"; + Cic.Rel index + with Not_found -> + let cic = + if is_uri ast then (* we have the URI, build the term out of it *) + try + CicUtil.term_of_uri (UriManager.uri_of_string name) + with UriManager.IllFormedUri _ -> + CicNotationPt.fail loc "Ill formed URI" + else + resolve env (Id name) () + in + let mk_subst uris = + let ids_to_uris = + List.map (fun uri -> UriManager.name_of_uri uri, uri) uris + in + (match subst with + | Some subst -> + List.map + (fun (s, term) -> + (try + List.assoc s ids_to_uris, aux ~localize loc context term + with Not_found -> + raise (Invalid_choice (Some loc, lazy "The provided explicit named substitution is trying to instantiate a named variable the object is not abstracted on")))) + subst + | None -> List.map (fun uri -> uri, Cic.Implicit None) uris) + in + (try + match cic with + | Cic.Const (uri, []) -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.Const (uri, mk_subst uris) + | Cic.Var (uri, []) -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.Var (uri, mk_subst uris) + | Cic.MutInd (uri, i, []) -> + (try + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.MutInd (uri, i, mk_subst uris) + with + CicEnvironment.Object_not_found _ -> + (* if we are here it is probably the case that during the + definition of a mutual inductive type we have met an + occurrence of the type in one of its constructors. + However, the inductive type is not yet in the environment + *) + (*here the explicit_named_substituion is assumed to be of length 0 *) + Cic.MutInd (uri,i,[])) + | Cic.MutConstruct (uri, i, j, []) -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.MutConstruct (uri, i, j, mk_subst uris) + | Cic.Meta _ | Cic.Implicit _ as t -> +(* + debug_print (lazy (sprintf + "Warning: %s must be instantiated with _[%s] but we do not enforce it" + (CicPp.ppterm t) + (String.concat "; " + (List.map + (fun (s, term) -> s ^ " := " ^ CicNotationPtPp.pp_term term) + subst)))); +*) + t + | _ -> + raise (Invalid_choice (Some loc, lazy "??? Can this happen?")) + with + CicEnvironment.CircularDependency _ -> + raise (Invalid_choice (None, lazy "Circular dependency in the environment")))) + | CicNotationPt.Implicit -> Cic.Implicit None + | CicNotationPt.UserInput -> Cic.Implicit (Some `Hole) + | CicNotationPt.Num (num, i) -> resolve env (Num i) ~num () + | CicNotationPt.Meta (index, subst) -> + let cic_subst = + List.map + (function + None -> None + | Some term -> Some (aux ~localize loc context term)) + subst + in + Cic.Meta (index, cic_subst) + | CicNotationPt.Sort `Prop -> Cic.Sort Cic.Prop + | CicNotationPt.Sort `Set -> Cic.Sort Cic.Set + | CicNotationPt.Sort (`Type u) -> Cic.Sort (Cic.Type u) + | CicNotationPt.Sort `CProp -> Cic.Sort Cic.CProp + | CicNotationPt.Symbol (symbol, instance) -> + resolve env (Symbol (symbol, instance)) () + | _ -> assert false (* god bless Bologna *) + and aux_option ~localize loc (context: Cic.name list) annotation = function + | None -> Cic.Implicit annotation + | Some term -> aux ~localize loc context term + in + aux ~localize:true HExtlib.dummy_floc context ast + +let interpretate_path ~context path = + let localization_tbl = Cic.CicHash.create 23 in + (* here we are throwing away useful localization informations!!! *) + fst ( + interpretate_term ~create_dummy_ids:true + ~context ~env:Environment.empty ~uri:None ~is_path:true + path ~localization_tbl, localization_tbl) + +let interpretate_obj ~context ~env ~uri ~is_path obj ~localization_tbl = + assert (context = []); + assert (is_path = false); + let interpretate_term = interpretate_term ~localization_tbl in + match obj with + | CicNotationPt.Inductive (params,tyl) -> + let uri = match uri with Some uri -> uri | None -> assert false in + let context,params = + let context,res = + List.fold_left + (fun (context,res) (name,t) -> + let t = + match t with + None -> CicNotationPt.Implicit + | Some t -> t in + let name = CicNotationUtil.cic_name_of_name name in + name::context,(name, interpretate_term context env None false t)::res + ) ([],[]) params + in + context,List.rev res in + let add_params = + List.fold_right (fun (name,ty) t -> Cic.Prod (name,ty,t)) params in + let name_to_uris = + snd ( + List.fold_left + (*here the explicit_named_substituion is assumed to be of length 0 *) + (fun (i,res) (name,_,_,_) -> + i + 1,(name,name,Cic.MutInd (uri,i,[]))::res + ) (0,[]) tyl) in + let con_env = DisambiguateTypes.env_of_list name_to_uris env in + let tyl = + List.map + (fun (name,b,ty,cl) -> + let ty' = add_params (interpretate_term context env None false ty) in + let cl' = + List.map + (fun (name,ty) -> + let ty' = + add_params (interpretate_term context con_env None false ty) + in + name,ty' + ) cl + in + name,b,ty',cl' + ) tyl + in + Cic.InductiveDefinition (tyl,[],List.length params,[]) + | CicNotationPt.Record (params,name,ty,fields) -> + let uri = match uri with Some uri -> uri | None -> assert false in + let context,params = + let context,res = + List.fold_left + (fun (context,res) (name,t) -> + let t = + match t with + None -> CicNotationPt.Implicit + | Some t -> t in + let name = CicNotationUtil.cic_name_of_name name in + name::context,(name, interpretate_term context env None false t)::res + ) ([],[]) params + in + context,List.rev res in + let add_params = + List.fold_right + (fun (name,ty) t -> Cic.Prod (name,ty,t)) params in + let ty' = add_params (interpretate_term context env None false ty) in + let fields' = + snd ( + List.fold_left + (fun (context,res) (name,ty,_coercion,arity) -> + let context' = Cic.Name name :: context in + context',(name,interpretate_term context env None false ty)::res + ) (context,[]) fields) in + let concl = + (*here the explicit_named_substituion is assumed to be of length 0 *) + let mutind = Cic.MutInd (uri,0,[]) in + if params = [] then mutind + else + Cic.Appl + (mutind::CicUtil.mk_rels (List.length params) (List.length fields)) in + let con = + List.fold_left + (fun t (name,ty) -> Cic.Prod (Cic.Name name,ty,t)) + concl fields' in + let con' = add_params con in + let tyl = [name,true,ty',["mk_" ^ name,con']] in + let field_names = List.map (fun (x,_,y,z) -> x,y,z) fields in + Cic.InductiveDefinition + (tyl,[],List.length params,[`Class (`Record field_names)]) + | CicNotationPt.Theorem (flavour, name, ty, bo) -> + let attrs = [`Flavour flavour] in + let ty' = interpretate_term [] env None false ty in + (match bo,flavour with + None,`Axiom -> + Cic.Constant (name,None,ty',[],attrs) + | Some bo,`Axiom -> assert false + | None,_ -> + Cic.CurrentProof (name,[],Cic.Implicit None,ty',[],attrs) + | Some bo,_ -> + let bo' = Some (interpretate_term [] env None false bo) in + Cic.Constant (name,bo',ty',[],attrs)) + +let rec domain_of_term ?(loc = HExtlib.dummy_floc) ~context = function + | Ast.AttributedTerm (`Loc loc, term) -> + domain_of_term ~loc ~context term + | Ast.AttributedTerm (_, term) -> + domain_of_term ~loc ~context term + | Ast.Symbol (symbol, instance) -> + [ Node ([loc], Symbol (symbol, instance), []) ] + (* to be kept in sync with Ast.Appl (Ast.Symbol ...) *) + | Ast.Appl (Ast.Symbol (symbol, instance) as hd :: args) + | Ast.Appl (Ast.AttributedTerm (_,Ast.Symbol (symbol, instance)) as hd :: args) + -> + let args_dom = + List.fold_right + (fun term acc -> domain_of_term ~loc ~context term @ acc) + args [] in + let loc = + match hd with + Ast.AttributedTerm (`Loc loc,_) -> loc + | _ -> loc + in + [ Node ([loc], Symbol (symbol, instance), args_dom) ] + | Ast.Appl (Ast.Ident (name, subst) as hd :: args) + | Ast.Appl (Ast.AttributedTerm (_,Ast.Ident (name, subst)) as hd :: args) -> + let args_dom = + List.fold_right + (fun term acc -> domain_of_term ~loc ~context term @ acc) + args [] in + let loc = + match hd with + Ast.AttributedTerm (`Loc loc,_) -> loc + | _ -> loc + in + (try + (* the next line can raise Not_found *) + ignore(find_in_context name context); + if subst <> None then + Ast.fail loc "Explicit substitutions not allowed here" + else + args_dom + with Not_found -> + (match subst with + | None -> [ Node ([loc], Id name, args_dom) ] + | Some subst -> + let terms = + List.fold_left + (fun dom (_, term) -> + let dom' = domain_of_term ~loc ~context term in + dom @ dom') + [] subst in + [ Node ([loc], Id name, terms @ args_dom) ])) + | Ast.Appl terms -> + List.fold_right + (fun term acc -> domain_of_term ~loc ~context term @ acc) + terms [] + | Ast.Binder (kind, (var, typ), body) -> + let type_dom = domain_of_term_option ~loc ~context typ in + let body_dom = + domain_of_term ~loc + ~context:(CicNotationUtil.cic_name_of_name var :: context) body in + (match kind with + | `Exists -> [ Node ([loc], Symbol ("exists", 0), (type_dom @ body_dom)) ] + | _ -> type_dom @ body_dom) + | Ast.Case (term, indty_ident, outtype, branches) -> + let term_dom = domain_of_term ~loc ~context term in + let outtype_dom = domain_of_term_option ~loc ~context outtype in + let rec get_first_constructor = function + | [] -> [] + | (Ast.Pattern (head, _, _), _) :: _ -> [ Node ([loc], Id head, []) ] + | _ :: tl -> get_first_constructor tl in + let do_branch = + function + Ast.Pattern (head, _, args), term -> + let (term_context, args_domain) = + List.fold_left + (fun (cont, dom) (name, typ) -> + (CicNotationUtil.cic_name_of_name name :: cont, + (match typ with + | None -> dom + | Some typ -> dom @ domain_of_term ~loc ~context:cont typ))) + (context, []) args + in + domain_of_term ~loc ~context:term_context term @ args_domain + | Ast.Wildcard, term -> + domain_of_term ~loc ~context term + in + let branches_dom = + List.fold_left (fun dom branch -> dom @ do_branch branch) [] branches in + (match indty_ident with + | None -> get_first_constructor branches + | Some (ident, _) -> [ Node ([loc], Id ident, []) ]) + @ term_dom @ outtype_dom @ branches_dom + | Ast.Cast (term, ty) -> + let term_dom = domain_of_term ~loc ~context term in + let ty_dom = domain_of_term ~loc ~context ty in + term_dom @ ty_dom + | Ast.LetIn ((var, typ), body, where) -> + let body_dom = domain_of_term ~loc ~context body in + let type_dom = domain_of_term_option ~loc ~context typ in + let where_dom = + domain_of_term ~loc + ~context:(CicNotationUtil.cic_name_of_name var :: context) where in + body_dom @ type_dom @ where_dom + | Ast.LetRec (kind, defs, where) -> + let add_defs context = + List.fold_left + (fun acc (_, (var, _), _, _) -> + CicNotationUtil.cic_name_of_name var :: acc + ) context defs in + let where_dom = domain_of_term ~loc ~context:(add_defs context) where in + let defs_dom = + List.fold_left + (fun dom (params, (_, typ), body, _) -> + let context' = + add_defs + (List.fold_left + (fun acc (var,_) -> CicNotationUtil.cic_name_of_name var :: acc) + context params) + in + List.rev + (snd + (List.fold_left + (fun (context,res) (var,ty) -> + CicNotationUtil.cic_name_of_name var :: context, + domain_of_term_option ~loc ~context ty @ res) + (add_defs context,[]) params)) + @ domain_of_term_option ~loc ~context:context' typ + @ domain_of_term ~loc ~context:context' body + ) [] defs + in + defs_dom @ where_dom + | Ast.Ident (name, subst) -> + (try + (* the next line can raise Not_found *) + ignore(find_in_context name context); + if subst <> None then + Ast.fail loc "Explicit substitutions not allowed here" + else + [] + with Not_found -> + (match subst with + | None -> [ Node ([loc], Id name, []) ] + | Some subst -> + let terms = + List.fold_left + (fun dom (_, term) -> + let dom' = domain_of_term ~loc ~context term in + dom @ dom') + [] subst in + [ Node ([loc], Id name, terms) ])) + | Ast.Uri _ -> [] + | Ast.Implicit -> [] + | Ast.Num (num, i) -> [ Node ([loc], Num i, []) ] + | Ast.Meta (index, local_context) -> + List.fold_left + (fun dom term -> dom @ domain_of_term_option ~loc ~context term) + [] local_context + | Ast.Sort _ -> [] + | Ast.UserInput + | Ast.Literal _ + | Ast.Layout _ + | Ast.Magic _ + | Ast.Variable _ -> assert false + +and domain_of_term_option ~loc ~context = function + | None -> [] + | Some t -> domain_of_term ~loc ~context t + +let domain_of_term ~context term = + uniq_domain (domain_of_term ~context term) + +let domain_of_obj ~context ast = + assert (context = []); + match ast with + | Ast.Theorem (_,_,ty,bo) -> + domain_of_term [] ty + @ (match bo with + None -> [] + | Some bo -> domain_of_term [] bo) + | Ast.Inductive (params,tyl) -> + let context, dom = + List.fold_left + (fun (context, dom) (var, ty) -> + let context' = CicNotationUtil.cic_name_of_name var :: context in + match ty with + None -> context', dom + | Some ty -> context', dom @ domain_of_term context ty + ) ([], []) params in + let context_w_types = + List.rev_map + (fun (var, _, _, _) -> Cic.Name var) tyl + @ context in + dom + @ List.flatten ( + List.map + (fun (_,_,ty,cl) -> + domain_of_term context ty + @ List.flatten ( + List.map + (fun (_,ty) -> domain_of_term context_w_types ty) cl)) + tyl) + | CicNotationPt.Record (params,var,ty,fields) -> + let context, dom = + List.fold_left + (fun (context, dom) (var, ty) -> + let context' = CicNotationUtil.cic_name_of_name var :: context in + match ty with + None -> context', dom + | Some ty -> context', dom @ domain_of_term context ty + ) ([], []) params in + let context_w_types = Cic.Name var :: context in + dom + @ domain_of_term context ty + @ snd + (List.fold_left + (fun (context,res) (name,ty,_,_) -> + Cic.Name name::context, res @ domain_of_term context ty + ) (context_w_types,[]) fields) + +let domain_of_obj ~context obj = + uniq_domain (domain_of_obj ~context obj) + + (* dom1 \ dom2 *) +let domain_diff dom1 dom2 = +(* let domain_diff = Domain.diff *) + let is_in_dom2 elt = + List.exists + (function + | Symbol (symb, 0) -> + (match elt with + Symbol (symb',_) when symb = symb' -> true + | _ -> false) + | Num i -> + (match elt with + Num _ -> true + | _ -> false) + | item -> elt = item + ) dom2 + in + let rec aux = + function + [] -> [] + | Node (_,elt,l)::tl when is_in_dom2 elt -> aux (l @ tl) + | Node (loc,elt,l)::tl -> Node (loc,elt,aux l)::(aux tl) + in + aux dom1 + +module type Disambiguator = +sig + val disambiguate_term : + ?fresh_instances:bool -> + dbd:HSql.dbd -> + context:Cic.context -> + metasenv:Cic.metasenv -> + ?initial_ugraph:CicUniv.universe_graph -> + aliases:DisambiguateTypes.environment ->(* previous interpretation status *) + universe:DisambiguateTypes.multiple_environment option -> + CicNotationPt.term disambiguator_input -> + ((DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Cic.metasenv * (* new metasenv *) + Cic.term* + CicUniv.universe_graph) list * (* disambiguated term *) + bool + + val disambiguate_obj : + ?fresh_instances:bool -> + dbd:HSql.dbd -> + aliases:DisambiguateTypes.environment ->(* previous interpretation status *) + universe:DisambiguateTypes.multiple_environment option -> + uri:UriManager.uri option -> (* required only for inductive types *) + CicNotationPt.term CicNotationPt.obj disambiguator_input -> + ((DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Cic.metasenv * (* new metasenv *) + Cic.obj * + CicUniv.universe_graph) list * (* disambiguated obj *) + bool +end + +module Make (C: Callbacks) = + struct + let choices_of_id dbd id = + let uris = Whelp.locate ~dbd id in + let uris = + match uris with + | [] -> + (match + (C.input_or_locate_uri + ~title:("URI matching \"" ^ id ^ "\" unknown.") ~id ()) + with + | None -> [] + | Some uri -> [uri]) + | [uri] -> [uri] + | _ -> + C.interactive_user_uri_choice ~selection_mode:`MULTIPLE + ~ok:"Try selected." ~enable_button_for_non_vars:true + ~title:"Ambiguous input." ~id + ~msg: ("Ambiguous input \"" ^ id ^ + "\". Please, choose one or more interpretations:") + uris + in + List.map + (fun uri -> + (UriManager.string_of_uri uri, + let term = + try + CicUtil.term_of_uri uri + with exn -> + debug_print (lazy (UriManager.string_of_uri uri)); + debug_print (lazy (Printexc.to_string exn)); + assert false + in + fun _ _ _ -> term)) + uris + +let refine_profiler = HExtlib.profile "disambiguate_thing.refine_thing" + + let disambiguate_thing ~dbd ~context ~metasenv + ?(initial_ugraph = CicUniv.empty_ugraph) ~aliases:env ~universe + ~uri ~pp_thing ~domain_of_thing ~interpretate_thing ~refine_thing + (thing_txt,thing_txt_prefix_len,thing) + = + debug_print (lazy "DISAMBIGUATE INPUT"); + let disambiguate_context = (* cic context -> disambiguate context *) + List.map + (function None -> Cic.Anonymous | Some (name, _) -> name) + context + in + debug_print (lazy ("TERM IS: " ^ (pp_thing thing))); + let thing_dom = domain_of_thing ~context:disambiguate_context thing in + debug_print + (lazy (sprintf "DISAMBIGUATION DOMAIN: %s"(string_of_domain thing_dom))); +(* + debug_print (lazy (sprintf "DISAMBIGUATION ENVIRONMENT: %s" + (DisambiguatePp.pp_environment env))); + debug_print (lazy (sprintf "DISAMBIGUATION UNIVERSE: %s" + (match universe with None -> "None" | Some _ -> "Some _"))); +*) + let current_dom = + Environment.fold (fun item _ dom -> item :: dom) env [] in + let todo_dom = domain_diff thing_dom current_dom in + debug_print + (lazy (sprintf "DISAMBIGUATION DOMAIN AFTER DIFF: %s"(string_of_domain todo_dom))); + (* (2) lookup function for any item (Id/Symbol/Num) *) + let lookup_choices = + fun item -> + let choices = + let lookup_in_library () = + match item with + | Id id -> choices_of_id dbd id + | Symbol (symb, _) -> + (try + List.map DisambiguateChoices.mk_choice + (TermAcicContent.lookup_interpretations symb) + with + TermAcicContent.Interpretation_not_found -> []) + | Num instance -> + DisambiguateChoices.lookup_num_choices () + in + match universe with + | None -> lookup_in_library () + | Some e -> + (try + let item = + match item with + | Symbol (symb, _) -> Symbol (symb, 0) + | item -> item + in + Environment.find item e + with Not_found -> lookup_in_library ()) + in + choices + in +(* + (* *) + let _ = + if benchmark then begin + let per_item_choices = + List.map + (fun dom_item -> + try + let len = List.length (lookup_choices dom_item) in + debug_print (lazy (sprintf "BENCHMARK %s: %d" + (string_of_domain_item dom_item) len)); + len + with No_choices _ -> 0) + thing_dom + in + max_refinements := List.fold_left ( * ) 1 per_item_choices; + actual_refinements := 0; + domain_size := List.length thing_dom; + choices_avg := + (float_of_int !max_refinements) ** (1. /. float_of_int !domain_size) + end + in + (* *) +*) + + (* (3) test an interpretation filling with meta uninterpreted identifiers + *) + let test_env env todo_dom = + let rec aux env = function + | [] -> env + | Node (_, item, l) :: tl -> + let env = + Environment.add item + ("Implicit", + (match item with + | Id _ | Num _ -> + (fun _ _ _ -> Cic.Implicit (Some `Closed)) + | Symbol _ -> (fun _ _ _ -> Cic.Implicit None))) + env in + aux (aux env l) tl in + let filled_env = aux env todo_dom in + try + let localization_tbl = Cic.CicHash.create 503 in + let cic_thing = + interpretate_thing ~context:disambiguate_context ~env:filled_env + ~uri ~is_path:false thing ~localization_tbl + in +let foo () = + refine_thing + metasenv context uri cic_thing initial_ugraph ~localization_tbl +in refine_profiler.HExtlib.profile foo () + with + | Try_again msg -> Uncertain (None,msg) + | Invalid_choice (loc,msg) -> Ko (loc,msg) + in + (* (4) build all possible interpretations *) + let (@@) (l1,l2,l3) (l1',l2',l3') = l1@l1', l2@l2', l3@l3' in + (* aux returns triples Ok/Uncertain/Ko *) + (* rem_dom is the concatenation of all the remaining domains *) + let rec aux envs_and_diffs lookup_in_todo_dom todo_dom rem_dom = + assert(lookup_in_todo_dom = None); (* to be removed *) + (* debug_print (lazy ("ZZZ: " ^ string_of_domain todo_dom)); *) + match todo_dom with + | Node (locs,item,inner_dom) -> + debug_print (lazy (sprintf "CHOOSED ITEM: %s" + (string_of_domain_item item))); + let choices = + match lookup_in_todo_dom with + None -> lookup_choices item + | Some choices -> choices in + match choices with + [] -> + [], [], + List.map + (function (env,diff) -> + env, diff, Some (List.hd locs), + lazy ("No choices for " ^ string_of_domain_item item), + true + ) envs_and_diffs +(*{{{ + | [codomain_item] -> + (* just one choice. We perform a one-step look-up and + if the next set of choices is also a singleton we + skip this refinement step *) + debug_print(lazy (sprintf "%s CHOSEN" (fst codomain_item))); + let new_env = Environment.add item codomain_item aliases in + let new_diff = (item,codomain_item)::diff in + let lookup_in_todo_dom,next_choice_is_single = + match remaining_dom with + [] -> None,false + | (_,he)::_ -> + let choices = lookup_choices he in + Some choices,List.length choices = 1 + in + if next_choice_is_single then + aux new_env new_diff lookup_in_todo_dom remaining_dom + base_univ + else + (match test_env new_env remaining_dom base_univ with + | Ok (thing, metasenv),new_univ -> + (match remaining_dom with + | [] -> + [ new_env, new_diff, metasenv, thing, new_univ ], [] + | _ -> + aux new_env new_diff lookup_in_todo_dom + remaining_dom new_univ) + | Uncertain (loc,msg),new_univ -> + (match remaining_dom with + | [] -> [], [new_env,new_diff,loc,msg,true] + | _ -> + aux new_env new_diff lookup_in_todo_dom + remaining_dom new_univ) + | Ko (loc,msg),_ -> [], [new_env,new_diff,loc,msg,true]) +}}}*) + | _::_ -> + let outcomes = + List.flatten + (List.map + (function codomain_item -> + List.map + (function (env,diff) -> + debug_print(lazy(sprintf"%s CHOSEN"(fst codomain_item))); + let new_env = Environment.add item codomain_item env in + let new_diff = (item,codomain_item)::diff in + test_env new_env (inner_dom@rem_dom), new_env,new_diff + ) envs_and_diffs + ) choices) in + let some_outcome_ok = + List.exists + (function + (Ok (_,_,_)),_,_ + | (Uncertain (_,_)),_,_ -> true + | _ -> false) + outcomes in + let res = + List.fold_right + (fun (outcome,env,diff) res -> + (match outcome with + | Ok (thing, metasenv, univ) -> + [env,diff,metasenv,thing,univ],[],[] + | Uncertain (loc,msg) -> + [],[env,diff,loc,msg],[] + | Ko (loc,msg) -> + [],[],[env,diff,loc,msg,not some_outcome_ok]) @@ res + ) outcomes ([],[],[]) + in + visit_children res rem_dom inner_dom + and visit_children res rem_dom inner_dom = + let rec vc_aux ((ok_l,uncertain_l,error_l) as res) = + function + [] -> res + | dom::remaining_dom -> + let envs_and_diffs = + List.map (fun (env,diff,_,_,_) -> env,diff) ok_l @ + List.map (fun (env,diff,_,_) -> env,diff) uncertain_l + in + let res = aux envs_and_diffs None dom (remaining_dom@rem_dom) in + vc_aux (([],[],error_l) @@ res) remaining_dom + in + vc_aux res inner_dom + in + let aux' env diff lookup_in_todo_dom todo_dom = + match test_env env todo_dom with + | Ok (thing, metasenv,new_univ) -> + visit_children ([ env, diff, metasenv, thing, new_univ ],[],[]) + [] todo_dom +(* + _lookup_in_todo_dom_ +*) + | Uncertain (loc,msg) -> + visit_children ([],[env,diff,loc,msg],[]) [] todo_dom +(* + _lookup_in_todo_dom_ +*) + | Ko (loc,msg) -> [],[],[env,diff,loc,msg,true] in + try + let res = + match aux' env [] None todo_dom with + | [],uncertain,errors -> + debug_print (lazy "NO INTERPRETATIONS"); + let errors = + List.map + (fun (env,diff,loc,msg) -> (env,diff,loc,msg,true) + ) uncertain @ errors + in + let errors = + List.map + (fun (env,diff,loc,msg,significant) -> + let env' = + filter_map_domain + (fun locs domain_item -> + try + let description = + fst (Environment.find domain_item env) + in + Some (locs,descr_of_domain_item domain_item,description) + with + Not_found -> None) + thing_dom + in + env',diff,loc,msg,significant + ) errors + in + raise (NoWellTypedInterpretation (0,errors)) + | [_,diff,metasenv,t,ugraph],_,_ -> + debug_print (lazy "SINGLE INTERPRETATION"); + [diff,metasenv,t,ugraph], false + | l,_,_ -> + debug_print + (lazy (sprintf "MANY INTERPRETATIONS (%d)" (List.length l))); + let choices = + List.map + (fun (env, _, _, _, _) -> + map_domain + (fun locs domain_item -> + let description = + fst (Environment.find domain_item env) + in + locs,descr_of_domain_item domain_item, description) + thing_dom) + l + in + let choosed = + C.interactive_interpretation_choice + thing_txt thing_txt_prefix_len choices + in + (List.map (fun n->let _,d,m,t,u= List.nth l n in d,m,t,u) choosed), + true + in + res + with + CicEnvironment.CircularDependency s -> + failwith "Disambiguate: circular dependency" + + let disambiguate_term ?(fresh_instances=false) ~dbd ~context ~metasenv + ?(initial_ugraph = CicUniv.empty_ugraph) ~aliases ~universe + (text,prefix_len,term) + = + let term = + if fresh_instances then CicNotationUtil.freshen_term term else term + in + disambiguate_thing ~dbd ~context ~metasenv ~initial_ugraph ~aliases + ~universe ~uri:None ~pp_thing:CicNotationPp.pp_term + ~domain_of_thing:domain_of_term + ~interpretate_thing:(interpretate_term (?create_dummy_ids:None)) + ~refine_thing:refine_term (text,prefix_len,term) + + let disambiguate_obj ?(fresh_instances=false) ~dbd ~aliases ~universe ~uri + (text,prefix_len,obj) + = + let obj = + if fresh_instances then CicNotationUtil.freshen_obj obj else obj + in + disambiguate_thing ~dbd ~context:[] ~metasenv:[] ~aliases ~universe ~uri + ~pp_thing:(CicNotationPp.pp_obj CicNotationPp.pp_term) ~domain_of_thing:domain_of_obj + ~interpretate_thing:interpretate_obj ~refine_thing:refine_obj + (text,prefix_len,obj) + end + diff --git a/components/cic_disambiguation/disambiguate.ml b/components/cic_disambiguation/disambiguate.ml new file mode 100644 index 000000000..dbdb1530f --- /dev/null +++ b/components/cic_disambiguation/disambiguate.ml @@ -0,0 +1,1302 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open DisambiguateTypes +open UriManager + +module Ast = CicNotationPt + +(* the integer is an offset to be added to each location *) +exception NoWellTypedInterpretation of + int * + ((Stdpp.location list * string * string) list * + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Stdpp.location option * string Lazy.t * bool) list +exception PathNotWellFormed + + (** raised when an environment is not enough informative to decide *) +exception Try_again of string Lazy.t + +type aliases = bool * DisambiguateTypes.environment +type 'a disambiguator_input = string * int * 'a + +type domain = domain_tree list +and domain_tree = Node of Stdpp.location list * domain_item * domain + +let rec string_of_domain = + function + [] -> "" + | Node (_,domain_item,l)::tl -> + DisambiguateTypes.string_of_domain_item domain_item ^ + " [ " ^ string_of_domain l ^ " ] " ^ string_of_domain tl + +let rec filter_map_domain f = + function + [] -> [] + | Node (locs,domain_item,l)::tl -> + match f locs domain_item with + None -> filter_map_domain f l @ filter_map_domain f tl + | Some res -> res :: filter_map_domain f l @ filter_map_domain f tl + +let rec map_domain f = + function + [] -> [] + | Node (locs,domain_item,l)::tl -> + f locs domain_item :: map_domain f l @ map_domain f tl + +let uniq_domain dom = + let rec aux seen = + function + [] -> seen,[] + | Node (locs,domain_item,l)::tl -> + if List.mem domain_item seen then + let seen,l = aux seen l in + let seen,tl = aux seen tl in + seen, l @ tl + else + let seen,l = aux (domain_item::seen) l in + let seen,tl = aux seen tl in + seen, Node (locs,domain_item,l)::tl + in + snd (aux [] dom) + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) else () + +(* + (** print benchmark information *) +let benchmark = true +let max_refinements = ref 0 (* benchmarking is not thread safe *) +let actual_refinements = ref 0 +let domain_size = ref 0 +let choices_avg = ref 0. +*) + +let descr_of_domain_item = function + | Id s -> s + | Symbol (s, _) -> s + | Num i -> string_of_int i + +type 'a test_result = + | Ok of 'a * Cic.metasenv + | Ko of Stdpp.location option * string Lazy.t + | Uncertain of Stdpp.location option * string Lazy.t + +let refine_term metasenv context uri term ugraph ~localization_tbl = +(* if benchmark then incr actual_refinements; *) + assert (uri=None); + debug_print (lazy (sprintf "TEST_INTERPRETATION: %s" (CicPp.ppterm term))); + try + let term', _, metasenv',ugraph1 = + CicRefine.type_of_aux' metasenv context term ugraph ~localization_tbl in + (Ok (term', metasenv')),ugraph1 + with + exn -> + let rec process_exn loc = + function + HExtlib.Localized (loc,exn) -> process_exn (Some loc) exn + | CicRefine.Uncertain msg -> + debug_print (lazy ("UNCERTAIN!!! [" ^ (Lazy.force msg) ^ "] " ^ CicPp.ppterm term)) ; + Uncertain (loc,msg),ugraph + | CicRefine.RefineFailure msg -> + debug_print (lazy (sprintf "PRUNED!!!\nterm%s\nmessage:%s" + (CicPp.ppterm term) (Lazy.force msg))); + Ko (loc,msg),ugraph + | exn -> raise exn + in + process_exn None exn + +let refine_obj metasenv context uri obj ugraph ~localization_tbl = + assert (context = []); + debug_print (lazy (sprintf "TEST_INTERPRETATION: %s" (CicPp.ppobj obj))) ; + try + let obj', metasenv,ugraph = + CicRefine.typecheck metasenv uri obj ~localization_tbl + in + (Ok (obj', metasenv)),ugraph + with + exn -> + let rec process_exn loc = + function + HExtlib.Localized (loc,exn) -> process_exn (Some loc) exn + | CicRefine.Uncertain msg -> + debug_print (lazy ("UNCERTAIN!!! [" ^ (Lazy.force msg) ^ "] " ^ CicPp.ppobj obj)) ; + Uncertain (loc,msg),ugraph + | CicRefine.RefineFailure msg -> + debug_print (lazy (sprintf "PRUNED!!!\nterm%s\nmessage:%s" + (CicPp.ppobj obj) (Lazy.force msg))) ; + Ko (loc,msg),ugraph + | exn -> raise exn + in + process_exn None exn + +let resolve (env: codomain_item Environment.t) (item: domain_item) ?(num = "") ?(args = []) () = + try + snd (Environment.find item env) env num args + with Not_found -> + failwith ("Domain item not found: " ^ + (DisambiguateTypes.string_of_domain_item item)) + + (* TODO move it to Cic *) +let find_in_context name context = + let rec aux acc = function + | [] -> raise Not_found + | Cic.Name hd :: tl when hd = name -> acc + | _ :: tl -> aux (acc + 1) tl + in + aux 1 context + +let interpretate_term ?(create_dummy_ids=false) ~(context: Cic.name list) ~env ~uri ~is_path ast + ~localization_tbl += + (* create_dummy_ids shouldbe used only for interpretating patterns *) + assert (uri = None); + let rec aux ~localize loc (context: Cic.name list) = function + | CicNotationPt.AttributedTerm (`Loc loc, term) -> + let res = aux ~localize loc context term in + if localize then Cic.CicHash.add localization_tbl res loc; + res + | CicNotationPt.AttributedTerm (_, term) -> aux ~localize loc context term + | CicNotationPt.Appl (CicNotationPt.Symbol (symb, i) :: args) -> + let cic_args = List.map (aux ~localize loc context) args in + resolve env (Symbol (symb, i)) ~args:cic_args () + | CicNotationPt.Appl terms -> + Cic.Appl (List.map (aux ~localize loc context) terms) + | CicNotationPt.Binder (binder_kind, (var, typ), body) -> + let cic_type = aux_option ~localize loc context (Some `Type) typ in + let cic_name = CicNotationUtil.cic_name_of_name var in + let cic_body = aux ~localize loc (cic_name :: context) body in + (match binder_kind with + | `Lambda -> Cic.Lambda (cic_name, cic_type, cic_body) + | `Pi + | `Forall -> Cic.Prod (cic_name, cic_type, cic_body) + | `Exists -> + resolve env (Symbol ("exists", 0)) + ~args:[ cic_type; Cic.Lambda (cic_name, cic_type, cic_body) ] ()) + | CicNotationPt.Case (term, indty_ident, outtype, branches) -> + let cic_term = aux ~localize loc context term in + let cic_outtype = aux_option ~localize loc context None outtype in + let do_branch ((head, _, args), term) = + let rec do_branch' context = function + | [] -> aux ~localize loc context term + | (name, typ) :: tl -> + let cic_name = CicNotationUtil.cic_name_of_name name in + let cic_body = do_branch' (cic_name :: context) tl in + let typ = + match typ with + | None -> Cic.Implicit (Some `Type) + | Some typ -> aux ~localize loc context typ + in + Cic.Lambda (cic_name, typ, cic_body) + in + do_branch' context args + in + let indtype_uri, indtype_no = + if create_dummy_ids then + (UriManager.uri_of_string "cic:/fake_indty.con", 0) + else + match indty_ident with + | Some (indty_ident, _) -> + (match resolve env (Id indty_ident) () with + | Cic.MutInd (uri, tyno, _) -> (uri, tyno) + | Cic.Implicit _ -> + raise (Try_again (lazy "The type of the term to be matched + is still unknown")) + | _ -> + raise (Invalid_choice (Some loc, lazy "The type of the term to be matched is not (co)inductive!"))) + | None -> + let rec fst_constructor = + function + (Ast.Pattern (head, _, _), _) :: _ -> head + | (Ast.Wildcard, _) :: tl -> fst_constructor tl + | [] -> raise (Invalid_choice (Some loc, lazy "The type of the term to be matched cannot be determined because it is an inductive type without constructors or because all patterns use wildcards")) + in + (match resolve env (Id (fst_constructor branches)) () with + | Cic.MutConstruct (indtype_uri, indtype_no, _, _) -> + (indtype_uri, indtype_no) + | Cic.Implicit _ -> + raise (Try_again (lazy "The type of the term to be matched + is still unknown")) + | _ -> + raise (Invalid_choice (Some loc, lazy "The type of the term to be matched is not (co)inductive!"))) + in + let branches = + if create_dummy_ids then + List.map + (function + Ast.Wildcard,term -> ("wildcard",None,[]), term + | Ast.Pattern _,_ -> + raise (Invalid_choice (Some loc, lazy "Syntax error: the left hand side of a branch patterns must be \"_\"")) + ) branches + else + match fst(CicEnvironment.get_obj CicUniv.empty_ugraph indtype_uri) with + Cic.InductiveDefinition (il,_,leftsno,_) -> + let _,_,_,cl = + try + List.nth il indtype_no + with _ -> assert false + in + let rec count_prod t = + match CicReduction.whd [] t with + Cic.Prod (_, _, t) -> 1 + (count_prod t) + | _ -> 0 + in + let rec sort branches cl = + match cl with + [] -> + let rec analyze unused unrecognized useless = + function + [] -> + if unrecognized != [] then + raise (Invalid_choice + (Some loc, + lazy + ("Unrecognized constructors: " ^ + String.concat " " unrecognized))) + else if useless > 0 then + raise (Invalid_choice + (Some loc, + lazy + ("The last " ^ string_of_int useless ^ + "case" ^ if useless > 1 then "s are" else " is" ^ + " unused"))) + else + [] + | (Ast.Wildcard,_)::tl when not unused -> + analyze true unrecognized useless tl + | (Ast.Pattern (head,_,_),_)::tl when not unused -> + analyze unused (head::unrecognized) useless tl + | _::tl -> analyze unused unrecognized (useless + 1) tl + in + analyze false [] 0 branches + | (name,ty)::cltl -> + let rec find_and_remove = + function + [] -> + raise + (Invalid_choice + (Some loc, lazy ("Missing case: " ^ name))) + | ((Ast.Wildcard, _) as branch :: _) as branches -> + branch, branches + | (Ast.Pattern (name',_,_),_) as branch :: tl + when name = name' -> + branch,tl + | branch::tl -> + let found,rest = find_and_remove tl in + found, branch::rest + in + let branch,tl = find_and_remove branches in + match branch with + Ast.Pattern (name,y,args),term -> + if List.length args = count_prod ty - leftsno then + ((name,y,args),term)::sort tl cltl + else + raise + (Invalid_choice + (Some loc, + lazy ("Wrong number of arguments for " ^ name))) + | Ast.Wildcard,term -> + let rec mk_lambdas = + function + 0 -> term + | n -> + CicNotationPt.Binder + (`Lambda, (CicNotationPt.Ident ("_", None), None), + mk_lambdas (n - 1)) + in + (("wildcard",None,[]), + mk_lambdas (count_prod ty - leftsno)) :: sort tl cltl + in + sort branches cl + | _ -> assert false + in + Cic.MutCase (indtype_uri, indtype_no, cic_outtype, cic_term, + (List.map do_branch branches)) + | CicNotationPt.Cast (t1, t2) -> + let cic_t1 = aux ~localize loc context t1 in + let cic_t2 = aux ~localize loc context t2 in + Cic.Cast (cic_t1, cic_t2) + | CicNotationPt.LetIn ((name, typ), def, body) -> + let cic_def = aux ~localize loc context def in + let cic_name = CicNotationUtil.cic_name_of_name name in + let cic_def = + match typ with + | None -> cic_def + | Some t -> Cic.Cast (cic_def, aux ~localize loc context t) + in + let cic_body = aux ~localize loc (cic_name :: context) body in + Cic.LetIn (cic_name, cic_def, cic_body) + | CicNotationPt.LetRec (kind, defs, body) -> + let context' = + List.fold_left + (fun acc (_, (name, _), _, _) -> + CicNotationUtil.cic_name_of_name name :: acc) + context defs + in + let cic_body = + let unlocalized_body = aux ~localize:false loc context' body in + match unlocalized_body with + Cic.Rel n when n <= List.length defs -> `AvoidLetInNoAppl n + | Cic.Appl (Cic.Rel n::l) when n <= List.length defs -> + (try + let l' = + List.map + (function t -> + let t',subst,metasenv = + CicMetaSubst.delift_rels [] [] (List.length defs) t + in + assert (subst=[]); + assert (metasenv=[]); + t') l + in + (* We can avoid the LetIn. But maybe we need to recompute l' + so that it is localized *) + if localize then + match body with + CicNotationPt.AttributedTerm (_,CicNotationPt.Appl(_::l)) -> + let l' = List.map (aux ~localize loc context) l in + `AvoidLetIn (n,l') + | _ -> assert false + else + `AvoidLetIn (n,l') + with + CicMetaSubst.DeliftingARelWouldCaptureAFreeVariable -> + if localize then + `AddLetIn (aux ~localize loc context' body) + else + `AddLetIn unlocalized_body) + | _ -> + if localize then + `AddLetIn (aux ~localize loc context' body) + else + `AddLetIn unlocalized_body + in + let inductiveFuns = + List.map + (fun (params, (name, typ), body, decr_idx) -> + let add_binders kind t = + List.fold_right + (fun var t -> CicNotationPt.Binder (kind, var, t)) params t + in + let cic_body = + aux ~localize loc context' (add_binders `Lambda body) in + let cic_type = + aux_option ~localize loc context (Some `Type) + (HExtlib.map_option (add_binders `Pi) typ) in + let name = + match CicNotationUtil.cic_name_of_name name with + | Cic.Anonymous -> + CicNotationPt.fail loc + "Recursive functions cannot be anonymous" + | Cic.Name name -> name + in + (name, decr_idx, cic_type, cic_body)) + defs + in + let fix_or_cofix n = + match kind with + `Inductive -> Cic.Fix (n,inductiveFuns) + | `CoInductive -> + let coinductiveFuns = + List.map + (fun (name, _, typ, body) -> name, typ, body) + inductiveFuns + in + Cic.CoFix (n,coinductiveFuns) + in + let counter = ref ~-1 in + let build_term funs (var,_,_,_) t = + incr counter; + Cic.LetIn (Cic.Name var, fix_or_cofix !counter, t) + in + (match cic_body with + `AvoidLetInNoAppl n -> + let n' = List.length inductiveFuns - n in + fix_or_cofix n' + | `AvoidLetIn (n,l) -> + let n' = List.length inductiveFuns - n in + Cic.Appl (fix_or_cofix n'::l) + | `AddLetIn cic_body -> + List.fold_right (build_term inductiveFuns) inductiveFuns + cic_body) + | CicNotationPt.Ident _ + | CicNotationPt.Uri _ when is_path -> raise PathNotWellFormed + | CicNotationPt.Ident (name, subst) + | CicNotationPt.Uri (name, subst) as ast -> + let is_uri = function CicNotationPt.Uri _ -> true | _ -> false in + (try + if is_uri ast then raise Not_found;(* don't search the env for URIs *) + let index = find_in_context name context in + if subst <> None then + CicNotationPt.fail loc "Explicit substitutions not allowed here"; + Cic.Rel index + with Not_found -> + let cic = + if is_uri ast then (* we have the URI, build the term out of it *) + try + CicUtil.term_of_uri (UriManager.uri_of_string name) + with UriManager.IllFormedUri _ -> + CicNotationPt.fail loc "Ill formed URI" + else + resolve env (Id name) () + in + let mk_subst uris = + let ids_to_uris = + List.map (fun uri -> UriManager.name_of_uri uri, uri) uris + in + (match subst with + | Some subst -> + List.map + (fun (s, term) -> + (try + List.assoc s ids_to_uris, aux ~localize loc context term + with Not_found -> + raise (Invalid_choice (Some loc, lazy "The provided explicit named substitution is trying to instantiate a named variable the object is not abstracted on")))) + subst + | None -> List.map (fun uri -> uri, Cic.Implicit None) uris) + in + (try + match cic with + | Cic.Const (uri, []) -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.Const (uri, mk_subst uris) + | Cic.Var (uri, []) -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.Var (uri, mk_subst uris) + | Cic.MutInd (uri, i, []) -> + (try + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.MutInd (uri, i, mk_subst uris) + with + CicEnvironment.Object_not_found _ -> + (* if we are here it is probably the case that during the + definition of a mutual inductive type we have met an + occurrence of the type in one of its constructors. + However, the inductive type is not yet in the environment + *) + (*here the explicit_named_substituion is assumed to be of length 0 *) + Cic.MutInd (uri,i,[])) + | Cic.MutConstruct (uri, i, j, []) -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let uris = CicUtil.params_of_obj o in + Cic.MutConstruct (uri, i, j, mk_subst uris) + | Cic.Meta _ | Cic.Implicit _ as t -> +(* + debug_print (lazy (sprintf + "Warning: %s must be instantiated with _[%s] but we do not enforce it" + (CicPp.ppterm t) + (String.concat "; " + (List.map + (fun (s, term) -> s ^ " := " ^ CicNotationPtPp.pp_term term) + subst)))); +*) + t + | _ -> + raise (Invalid_choice (Some loc, lazy "??? Can this happen?")) + with + CicEnvironment.CircularDependency _ -> + raise (Invalid_choice (None, lazy "Circular dependency in the environment")))) + | CicNotationPt.Implicit -> Cic.Implicit None + | CicNotationPt.UserInput -> Cic.Implicit (Some `Hole) + | CicNotationPt.Num (num, i) -> resolve env (Num i) ~num () + | CicNotationPt.Meta (index, subst) -> + let cic_subst = + List.map + (function + None -> None + | Some term -> Some (aux ~localize loc context term)) + subst + in + Cic.Meta (index, cic_subst) + | CicNotationPt.Sort `Prop -> Cic.Sort Cic.Prop + | CicNotationPt.Sort `Set -> Cic.Sort Cic.Set + | CicNotationPt.Sort (`Type u) -> Cic.Sort (Cic.Type u) + | CicNotationPt.Sort `CProp -> Cic.Sort Cic.CProp + | CicNotationPt.Symbol (symbol, instance) -> + resolve env (Symbol (symbol, instance)) () + | _ -> assert false (* god bless Bologna *) + and aux_option ~localize loc (context: Cic.name list) annotation = function + | None -> Cic.Implicit annotation + | Some term -> aux ~localize loc context term + in + aux ~localize:true HExtlib.dummy_floc context ast + +let interpretate_path ~context path = + let localization_tbl = Cic.CicHash.create 23 in + (* here we are throwing away useful localization informations!!! *) + fst ( + interpretate_term ~create_dummy_ids:true + ~context ~env:Environment.empty ~uri:None ~is_path:true + path ~localization_tbl, localization_tbl) + +let interpretate_obj ~context ~env ~uri ~is_path obj ~localization_tbl = + assert (context = []); + assert (is_path = false); + let interpretate_term = interpretate_term ~localization_tbl in + match obj with + | CicNotationPt.Inductive (params,tyl) -> + let uri = match uri with Some uri -> uri | None -> assert false in + let context,params = + let context,res = + List.fold_left + (fun (context,res) (name,t) -> + let t = + match t with + None -> CicNotationPt.Implicit + | Some t -> t in + let name = CicNotationUtil.cic_name_of_name name in + name::context,(name, interpretate_term context env None false t)::res + ) ([],[]) params + in + context,List.rev res in + let add_params = + List.fold_right (fun (name,ty) t -> Cic.Prod (name,ty,t)) params in + let name_to_uris = + snd ( + List.fold_left + (*here the explicit_named_substituion is assumed to be of length 0 *) + (fun (i,res) (name,_,_,_) -> + i + 1,(name,name,Cic.MutInd (uri,i,[]))::res + ) (0,[]) tyl) in + let con_env = DisambiguateTypes.env_of_list name_to_uris env in + let tyl = + List.map + (fun (name,b,ty,cl) -> + let ty' = add_params (interpretate_term context env None false ty) in + let cl' = + List.map + (fun (name,ty) -> + let ty' = + add_params (interpretate_term context con_env None false ty) + in + name,ty' + ) cl + in + name,b,ty',cl' + ) tyl + in + Cic.InductiveDefinition (tyl,[],List.length params,[]) + | CicNotationPt.Record (params,name,ty,fields) -> + let uri = match uri with Some uri -> uri | None -> assert false in + let context,params = + let context,res = + List.fold_left + (fun (context,res) (name,t) -> + let t = + match t with + None -> CicNotationPt.Implicit + | Some t -> t in + let name = CicNotationUtil.cic_name_of_name name in + name::context,(name, interpretate_term context env None false t)::res + ) ([],[]) params + in + context,List.rev res in + let add_params = + List.fold_right + (fun (name,ty) t -> Cic.Prod (name,ty,t)) params in + let ty' = add_params (interpretate_term context env None false ty) in + let fields' = + snd ( + List.fold_left + (fun (context,res) (name,ty,_coercion,arity) -> + let context' = Cic.Name name :: context in + context',(name,interpretate_term context env None false ty)::res + ) (context,[]) fields) in + let concl = + (*here the explicit_named_substituion is assumed to be of length 0 *) + let mutind = Cic.MutInd (uri,0,[]) in + if params = [] then mutind + else + Cic.Appl + (mutind::CicUtil.mk_rels (List.length params) (List.length fields)) in + let con = + List.fold_left + (fun t (name,ty) -> Cic.Prod (Cic.Name name,ty,t)) + concl fields' in + let con' = add_params con in + let tyl = [name,true,ty',["mk_" ^ name,con']] in + let field_names = List.map (fun (x,_,y,z) -> x,y,z) fields in + Cic.InductiveDefinition + (tyl,[],List.length params,[`Class (`Record field_names)]) + | CicNotationPt.Theorem (flavour, name, ty, bo) -> + let attrs = [`Flavour flavour] in + let ty' = interpretate_term [] env None false ty in + (match bo,flavour with + None,`Axiom -> + Cic.Constant (name,None,ty',[],attrs) + | Some bo,`Axiom -> assert false + | None,_ -> + Cic.CurrentProof (name,[],Cic.Implicit None,ty',[],attrs) + | Some bo,_ -> + let bo' = Some (interpretate_term [] env None false bo) in + Cic.Constant (name,bo',ty',[],attrs)) + +let rec domain_of_term ?(loc = HExtlib.dummy_floc) ~context = function + | Ast.AttributedTerm (`Loc loc, term) -> + domain_of_term ~loc ~context term + | Ast.AttributedTerm (_, term) -> + domain_of_term ~loc ~context term + | Ast.Symbol (symbol, instance) -> + [ Node ([loc], Symbol (symbol, instance), []) ] + (* to be kept in sync with Ast.Appl (Ast.Symbol ...) *) + | Ast.Appl (Ast.Symbol (symbol, instance) as hd :: args) + | Ast.Appl (Ast.AttributedTerm (_,Ast.Symbol (symbol, instance)) as hd :: args) + -> + let args_dom = + List.fold_right + (fun term acc -> domain_of_term ~loc ~context term @ acc) + args [] in + let loc = + match hd with + Ast.AttributedTerm (`Loc loc,_) -> loc + | _ -> loc + in + [ Node ([loc], Symbol (symbol, instance), args_dom) ] + | Ast.Appl (Ast.Ident (name, subst) as hd :: args) + | Ast.Appl (Ast.AttributedTerm (_,Ast.Ident (name, subst)) as hd :: args) -> + let args_dom = + List.fold_right + (fun term acc -> domain_of_term ~loc ~context term @ acc) + args [] in + let loc = + match hd with + Ast.AttributedTerm (`Loc loc,_) -> loc + | _ -> loc + in + (try + (* the next line can raise Not_found *) + ignore(find_in_context name context); + if subst <> None then + Ast.fail loc "Explicit substitutions not allowed here" + else + args_dom + with Not_found -> + (match subst with + | None -> [ Node ([loc], Id name, args_dom) ] + | Some subst -> + let terms = + List.fold_left + (fun dom (_, term) -> + let dom' = domain_of_term ~loc ~context term in + dom @ dom') + [] subst in + [ Node ([loc], Id name, terms @ args_dom) ])) + | Ast.Appl terms -> + List.fold_right + (fun term acc -> domain_of_term ~loc ~context term @ acc) + terms [] + | Ast.Binder (kind, (var, typ), body) -> + let type_dom = domain_of_term_option ~loc ~context typ in + let body_dom = + domain_of_term ~loc + ~context:(CicNotationUtil.cic_name_of_name var :: context) body in + (match kind with + | `Exists -> [ Node ([loc], Symbol ("exists", 0), (type_dom @ body_dom)) ] + | _ -> type_dom @ body_dom) + | Ast.Case (term, indty_ident, outtype, branches) -> + let term_dom = domain_of_term ~loc ~context term in + let outtype_dom = domain_of_term_option ~loc ~context outtype in + let rec get_first_constructor = function + | [] -> [] + | (Ast.Pattern (head, _, _), _) :: _ -> [ Node ([loc], Id head, []) ] + | _ :: tl -> get_first_constructor tl in + let do_branch = + function + Ast.Pattern (head, _, args), term -> + let (term_context, args_domain) = + List.fold_left + (fun (cont, dom) (name, typ) -> + (CicNotationUtil.cic_name_of_name name :: cont, + (match typ with + | None -> dom + | Some typ -> dom @ domain_of_term ~loc ~context:cont typ))) + (context, []) args + in + domain_of_term ~loc ~context:term_context term @ args_domain + | Ast.Wildcard, term -> + domain_of_term ~loc ~context term + in + let branches_dom = + List.fold_left (fun dom branch -> dom @ do_branch branch) [] branches in + (match indty_ident with + | None -> get_first_constructor branches + | Some (ident, _) -> [ Node ([loc], Id ident, []) ]) + @ term_dom @ outtype_dom @ branches_dom + | Ast.Cast (term, ty) -> + let term_dom = domain_of_term ~loc ~context term in + let ty_dom = domain_of_term ~loc ~context ty in + term_dom @ ty_dom + | Ast.LetIn ((var, typ), body, where) -> + let body_dom = domain_of_term ~loc ~context body in + let type_dom = domain_of_term_option ~loc ~context typ in + let where_dom = + domain_of_term ~loc + ~context:(CicNotationUtil.cic_name_of_name var :: context) where in + body_dom @ type_dom @ where_dom + | Ast.LetRec (kind, defs, where) -> + let add_defs context = + List.fold_left + (fun acc (_, (var, _), _, _) -> + CicNotationUtil.cic_name_of_name var :: acc + ) context defs in + let where_dom = domain_of_term ~loc ~context:(add_defs context) where in + let defs_dom = + List.fold_left + (fun dom (params, (_, typ), body, _) -> + let context' = + add_defs + (List.fold_left + (fun acc (var,_) -> CicNotationUtil.cic_name_of_name var :: acc) + context params) + in + List.rev + (snd + (List.fold_left + (fun (context,res) (var,ty) -> + CicNotationUtil.cic_name_of_name var :: context, + domain_of_term_option ~loc ~context ty @ res) + (add_defs context,[]) params)) + @ domain_of_term_option ~loc ~context:context' typ + @ domain_of_term ~loc ~context:context' body + ) [] defs + in + defs_dom @ where_dom + | Ast.Ident (name, subst) -> + (try + (* the next line can raise Not_found *) + ignore(find_in_context name context); + if subst <> None then + Ast.fail loc "Explicit substitutions not allowed here" + else + [] + with Not_found -> + (match subst with + | None -> [ Node ([loc], Id name, []) ] + | Some subst -> + let terms = + List.fold_left + (fun dom (_, term) -> + let dom' = domain_of_term ~loc ~context term in + dom @ dom') + [] subst in + [ Node ([loc], Id name, terms) ])) + | Ast.Uri _ -> [] + | Ast.Implicit -> [] + | Ast.Num (num, i) -> [ Node ([loc], Num i, []) ] + | Ast.Meta (index, local_context) -> + List.fold_left + (fun dom term -> dom @ domain_of_term_option ~loc ~context term) + [] local_context + | Ast.Sort _ -> [] + | Ast.UserInput + | Ast.Literal _ + | Ast.Layout _ + | Ast.Magic _ + | Ast.Variable _ -> assert false + +and domain_of_term_option ~loc ~context = function + | None -> [] + | Some t -> domain_of_term ~loc ~context t + +let domain_of_term ~context term = + uniq_domain (domain_of_term ~context term) + +let domain_of_obj ~context ast = + assert (context = []); + match ast with + | Ast.Theorem (_,_,ty,bo) -> + domain_of_term [] ty + @ (match bo with + None -> [] + | Some bo -> domain_of_term [] bo) + | Ast.Inductive (params,tyl) -> + let context, dom = + List.fold_left + (fun (context, dom) (var, ty) -> + let context' = CicNotationUtil.cic_name_of_name var :: context in + match ty with + None -> context', dom + | Some ty -> context', dom @ domain_of_term context ty + ) ([], []) params in + let context_w_types = + List.rev_map + (fun (var, _, _, _) -> Cic.Name var) tyl + @ context in + dom + @ List.flatten ( + List.map + (fun (_,_,ty,cl) -> + domain_of_term context ty + @ List.flatten ( + List.map + (fun (_,ty) -> domain_of_term context_w_types ty) cl)) + tyl) + | CicNotationPt.Record (params,var,ty,fields) -> + let context, dom = + List.fold_left + (fun (context, dom) (var, ty) -> + let context' = CicNotationUtil.cic_name_of_name var :: context in + match ty with + None -> context', dom + | Some ty -> context', dom @ domain_of_term context ty + ) ([], []) params in + let context_w_types = Cic.Name var :: context in + dom + @ domain_of_term context ty + @ snd + (List.fold_left + (fun (context,res) (name,ty,_,_) -> + Cic.Name name::context, res @ domain_of_term context ty + ) (context_w_types,[]) fields) + +let domain_of_obj ~context obj = + uniq_domain (domain_of_obj ~context obj) + + (* dom1 \ dom2 *) +let domain_diff dom1 dom2 = +(* let domain_diff = Domain.diff *) + let is_in_dom2 elt = + List.exists + (function + | Symbol (symb, 0) -> + (match elt with + Symbol (symb',_) when symb = symb' -> true + | _ -> false) + | Num i -> + (match elt with + Num _ -> true + | _ -> false) + | item -> elt = item + ) dom2 + in + let rec aux = + function + [] -> [] + | Node (_,elt,l)::tl when is_in_dom2 elt -> aux (l @ tl) + | Node (loc,elt,l)::tl -> Node (loc,elt,aux l)::(aux tl) + in + aux dom1 + +module type Disambiguator = +sig + val disambiguate_term : + ?fresh_instances:bool -> + dbd:HSql.dbd -> + context:Cic.context -> + metasenv:Cic.metasenv -> + ?initial_ugraph:CicUniv.universe_graph -> + aliases:DisambiguateTypes.environment ->(* previous interpretation status *) + universe:DisambiguateTypes.multiple_environment option -> + CicNotationPt.term disambiguator_input -> + ((DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Cic.metasenv * (* new metasenv *) + Cic.term* + CicUniv.universe_graph) list * (* disambiguated term *) + bool + + val disambiguate_obj : + ?fresh_instances:bool -> + dbd:HSql.dbd -> + aliases:DisambiguateTypes.environment ->(* previous interpretation status *) + universe:DisambiguateTypes.multiple_environment option -> + uri:UriManager.uri option -> (* required only for inductive types *) + CicNotationPt.term CicNotationPt.obj disambiguator_input -> + ((DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Cic.metasenv * (* new metasenv *) + Cic.obj * + CicUniv.universe_graph) list * (* disambiguated obj *) + bool +end + +module Make (C: Callbacks) = + struct + let choices_of_id dbd id = + let uris = Whelp.locate ~dbd id in + let uris = + match uris with + | [] -> + (match + (C.input_or_locate_uri + ~title:("URI matching \"" ^ id ^ "\" unknown.") ~id ()) + with + | None -> [] + | Some uri -> [uri]) + | [uri] -> [uri] + | _ -> + C.interactive_user_uri_choice ~selection_mode:`MULTIPLE + ~ok:"Try selected." ~enable_button_for_non_vars:true + ~title:"Ambiguous input." ~id + ~msg: ("Ambiguous input \"" ^ id ^ + "\". Please, choose one or more interpretations:") + uris + in + List.map + (fun uri -> + (UriManager.string_of_uri uri, + let term = + try + CicUtil.term_of_uri uri + with exn -> + debug_print (lazy (UriManager.string_of_uri uri)); + debug_print (lazy (Printexc.to_string exn)); + assert false + in + fun _ _ _ -> term)) + uris + +let refine_profiler = HExtlib.profile "disambiguate_thing.refine_thing" + + let disambiguate_thing ~dbd ~context ~metasenv + ?(initial_ugraph = CicUniv.empty_ugraph) ~aliases ~universe + ~uri ~pp_thing ~domain_of_thing ~interpretate_thing ~refine_thing + (thing_txt,thing_txt_prefix_len,thing) + = + debug_print (lazy "DISAMBIGUATE INPUT"); + let disambiguate_context = (* cic context -> disambiguate context *) + List.map + (function None -> Cic.Anonymous | Some (name, _) -> name) + context + in + debug_print (lazy ("TERM IS: " ^ (pp_thing thing))); + let thing_dom = domain_of_thing ~context:disambiguate_context thing in + debug_print + (lazy (sprintf "DISAMBIGUATION DOMAIN: %s"(string_of_domain thing_dom))); +(* + debug_print (lazy (sprintf "DISAMBIGUATION ENVIRONMENT: %s" + (DisambiguatePp.pp_environment aliases))); + debug_print (lazy (sprintf "DISAMBIGUATION UNIVERSE: %s" + (match universe with None -> "None" | Some _ -> "Some _"))); +*) + let current_dom = + Environment.fold (fun item _ dom -> item :: dom) aliases [] in + let todo_dom = domain_diff thing_dom current_dom in + debug_print + (lazy (sprintf "DISAMBIGUATION DOMAIN AFTER DIFF: %s"(string_of_domain todo_dom))); + (* (2) lookup function for any item (Id/Symbol/Num) *) + let lookup_choices = + fun item -> + let choices = + let lookup_in_library () = + match item with + | Id id -> choices_of_id dbd id + | Symbol (symb, _) -> + (try + List.map DisambiguateChoices.mk_choice + (TermAcicContent.lookup_interpretations symb) + with + TermAcicContent.Interpretation_not_found -> []) + | Num instance -> + DisambiguateChoices.lookup_num_choices () + in + match universe with + | None -> lookup_in_library () + | Some e -> + (try + let item = + match item with + | Symbol (symb, _) -> Symbol (symb, 0) + | item -> item + in + Environment.find item e + with Not_found -> lookup_in_library ()) + in + choices + in +(* + (* *) + let _ = + if benchmark then begin + let per_item_choices = + List.map + (fun dom_item -> + try + let len = List.length (lookup_choices dom_item) in + debug_print (lazy (sprintf "BENCHMARK %s: %d" + (string_of_domain_item dom_item) len)); + len + with No_choices _ -> 0) + thing_dom + in + max_refinements := List.fold_left ( * ) 1 per_item_choices; + actual_refinements := 0; + domain_size := List.length thing_dom; + choices_avg := + (float_of_int !max_refinements) ** (1. /. float_of_int !domain_size) + end + in + (* *) +*) + + (* (3) test an interpretation filling with meta uninterpreted identifiers + *) + let test_env aliases todo_dom ugraph = + let rec aux env = function + | [] -> env + | Node (_, item, l) :: tl -> + let env = + Environment.add item + ("Implicit", + (match item with + | Id _ | Num _ -> + (fun _ _ _ -> Cic.Implicit (Some `Closed)) + | Symbol _ -> (fun _ _ _ -> Cic.Implicit None))) + env in + aux (aux env l) tl in + let filled_env = aux aliases todo_dom in + try + let localization_tbl = Cic.CicHash.create 503 in + let cic_thing = + interpretate_thing ~context:disambiguate_context ~env:filled_env + ~uri ~is_path:false thing ~localization_tbl + in +let foo () = + let k,ugraph1 = + refine_thing metasenv context uri cic_thing ugraph ~localization_tbl + in + (k , ugraph1 ) +in refine_profiler.HExtlib.profile foo () + with + | Try_again msg -> Uncertain (None,msg), ugraph + | Invalid_choice (loc,msg) -> Ko (loc,msg), ugraph + in + (* (4) build all possible interpretations *) + let (@@) (l1,l2,l3) (l1',l2',l3') = l1@l1', l2@l2', l3@l3' in + (* aux returns triples Ok/Uncertain/Ko *) + (* rem_dom is the concatenation of all the remainin domains *) + let rec aux aliases diff lookup_in_todo_dom todo_dom rem_dom base_univ = + debug_print (lazy ("ZZZ: " ^ string_of_domain todo_dom)); + match todo_dom with + | [] -> + assert (lookup_in_todo_dom = None); + (match test_env aliases rem_dom base_univ with + | Ok (thing, metasenv),new_univ -> + [ aliases, diff, metasenv, thing, new_univ ], [], [] + | Ko (loc,msg),_ -> [],[],[aliases,diff,loc,msg,true] + | Uncertain (loc,msg),new_univ -> + [],[aliases,diff,loc,msg,new_univ],[]) + | Node (locs,item,inner_dom) :: remaining_dom -> + debug_print (lazy (sprintf "CHOOSED ITEM: %s" + (string_of_domain_item item))); + let choices = + match lookup_in_todo_dom with + None -> lookup_choices item + | Some choices -> choices in + match choices with + [] -> + [], [], + [aliases, diff, Some (List.hd locs), + lazy ("No choices for " ^ string_of_domain_item item), + true] +(* + | [codomain_item] -> + (* just one choice. We perform a one-step look-up and + if the next set of choices is also a singleton we + skip this refinement step *) + debug_print(lazy (sprintf "%s CHOSEN" (fst codomain_item))); + let new_env = Environment.add item codomain_item aliases in + let new_diff = (item,codomain_item)::diff in + let lookup_in_todo_dom,next_choice_is_single = + match remaining_dom with + [] -> None,false + | (_,he)::_ -> + let choices = lookup_choices he in + Some choices,List.length choices = 1 + in + if next_choice_is_single then + aux new_env new_diff lookup_in_todo_dom remaining_dom + base_univ + else + (match test_env new_env remaining_dom base_univ with + | Ok (thing, metasenv),new_univ -> + (match remaining_dom with + | [] -> + [ new_env, new_diff, metasenv, thing, new_univ ], [] + | _ -> + aux new_env new_diff lookup_in_todo_dom + remaining_dom new_univ) + | Uncertain (loc,msg),new_univ -> + (match remaining_dom with + | [] -> [], [new_env,new_diff,loc,msg,true] + | _ -> + aux new_env new_diff lookup_in_todo_dom + remaining_dom new_univ) + | Ko (loc,msg),_ -> [], [new_env,new_diff,loc,msg,true]) +*) + | _::_ -> + let mark_not_significant failures = + List.map + (fun (env, diff, loc, msg, _b) -> + env, diff, loc, msg, false) + failures in + let classify_errors ((ok_l,uncertain_l,error_l) as outcome) = + if ok_l <> [] || uncertain_l <> [] then + ok_l,uncertain_l,mark_not_significant error_l + else + outcome in + let rec filter univ = function + | [] -> [],[],[] + | codomain_item :: tl -> + debug_print(lazy (sprintf "%s CHOSEN" (fst codomain_item))); + let new_env = Environment.add item codomain_item aliases in + let new_diff = (item,codomain_item)::diff in + (match + test_env new_env (inner_dom@remaining_dom@rem_dom) univ + with + | Ok (thing, metasenv),new_univ -> + let res = + (match inner_dom with + | [] -> + [new_env,new_diff,metasenv,thing,new_univ], [], [] + | _ -> + aux new_env new_diff None inner_dom + (remaining_dom@rem_dom) new_univ + ) + in + res @@ filter univ tl + | Uncertain (loc,msg),new_univ -> + let res = + (match inner_dom with + | [] -> [],[new_env,new_diff,loc,msg,new_univ],[] + | _ -> + aux new_env new_diff None inner_dom + (remaining_dom@rem_dom) new_univ + ) + in + res @@ filter univ tl + | Ko (loc,msg),_ -> + let res = [],[],[new_env,new_diff,loc,msg,true] in + res @@ filter univ tl) + in + let ok_l,uncertain_l,error_l = + classify_errors (filter base_univ choices) + in + let res_after_ok_l = + List.fold_right + (fun (env,diff,_,_,univ) res -> + aux env diff None remaining_dom rem_dom univ @@ res + ) ok_l ([],[],error_l) + in + List.fold_right + (fun (env,diff,_,_,univ) res -> + aux env diff None remaining_dom rem_dom univ @@ res + ) uncertain_l res_after_ok_l + in + let aux' aliases diff lookup_in_todo_dom todo_dom base_univ = + match test_env aliases todo_dom base_univ with + | Ok _,_ + | Uncertain _,_ -> + aux aliases diff lookup_in_todo_dom todo_dom [] base_univ + | Ko (loc,msg),_ -> [],[],[aliases,diff,loc,msg,true] in + let base_univ = initial_ugraph in + try + let res = + match aux' aliases [] None todo_dom base_univ with + | [],uncertain,errors -> + let errors = + List.map + (fun (env,diff,loc,msg,_) -> (env,diff,loc,msg,true) + ) uncertain @ errors + in + let errors = + List.map + (fun (env,diff,loc,msg,significant) -> + let env' = + filter_map_domain + (fun locs domain_item -> + try + let description = + fst (Environment.find domain_item env) + in + Some (locs,descr_of_domain_item domain_item,description) + with + Not_found -> None) + thing_dom + in + env',diff,loc,msg,significant + ) errors + in + raise (NoWellTypedInterpretation (0,errors)) + | [_,diff,metasenv,t,ugraph],_,_ -> + debug_print (lazy "SINGLE INTERPRETATION"); + [diff,metasenv,t,ugraph], false + | l,_,_ -> + debug_print + (lazy (sprintf "MANY INTERPRETATIONS (%d)" (List.length l))); + let choices = + List.map + (fun (env, _, _, _, _) -> + map_domain + (fun locs domain_item -> + let description = + fst (Environment.find domain_item env) + in + locs,descr_of_domain_item domain_item, description) + thing_dom) + l + in + let choosed = + C.interactive_interpretation_choice + thing_txt thing_txt_prefix_len choices + in + (List.map (fun n->let _,d,m,t,u= List.nth l n in d,m,t,u) choosed), + true + in + res + with + CicEnvironment.CircularDependency s -> + failwith "Disambiguate: circular dependency" + + let disambiguate_term ?(fresh_instances=false) ~dbd ~context ~metasenv + ?(initial_ugraph = CicUniv.empty_ugraph) ~aliases ~universe + (text,prefix_len,term) + = + let term = + if fresh_instances then CicNotationUtil.freshen_term term else term + in + disambiguate_thing ~dbd ~context ~metasenv ~initial_ugraph ~aliases + ~universe ~uri:None ~pp_thing:CicNotationPp.pp_term + ~domain_of_thing:domain_of_term + ~interpretate_thing:(interpretate_term (?create_dummy_ids:None)) + ~refine_thing:refine_term (text,prefix_len,term) + + let disambiguate_obj ?(fresh_instances=false) ~dbd ~aliases ~universe ~uri + (text,prefix_len,obj) + = + let obj = + if fresh_instances then CicNotationUtil.freshen_obj obj else obj + in + disambiguate_thing ~dbd ~context:[] ~metasenv:[] ~aliases ~universe ~uri + ~pp_thing:(CicNotationPp.pp_obj CicNotationPp.pp_term) ~domain_of_thing:domain_of_obj + ~interpretate_thing:interpretate_obj ~refine_thing:refine_obj + (text,prefix_len,obj) + end + diff --git a/components/cic_disambiguation/disambiguate.mli b/components/cic_disambiguation/disambiguate.mli new file mode 100644 index 000000000..5dc0df28b --- /dev/null +++ b/components/cic_disambiguation/disambiguate.mli @@ -0,0 +1,84 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 Disambiguation interface} *) + +(* the integer is an offset to be added to each location *) +(* list of located error messages, each list is a tuple: + * - environment in string form + * - environment patch + * - location + * - error message + * - significancy of the error message, if false the error is likely to be + * useless for the final user ... *) +exception NoWellTypedInterpretation of + int * + ((Stdpp.location list * string * string) list * + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Stdpp.location option * string Lazy.t * bool) list +exception PathNotWellFormed + +val interpretate_path : + context:Cic.name list -> CicNotationPt.term -> Cic.term + +type 'a disambiguator_input = string * int * 'a + +module type Disambiguator = +sig + (** @param fresh_instances when set to true fresh instances will be generated + * for each number _and_ symbol in the disambiguation domain. Instances of the + * input AST will be ignored. Defaults to false. *) + val disambiguate_term : + ?fresh_instances:bool -> + dbd:HSql.dbd -> + context:Cic.context -> + metasenv:Cic.metasenv -> + ?initial_ugraph:CicUniv.universe_graph -> + aliases:DisambiguateTypes.environment ->(* previous interpretation status *) + universe:DisambiguateTypes.multiple_environment option -> + CicNotationPt.term disambiguator_input -> + ((DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Cic.metasenv * (* new metasenv *) + Cic.term * + CicUniv.universe_graph) list * (* disambiguated term *) + bool (* has interactive_interpretation_choice been invoked? *) + + (** @param fresh_instances as per disambiguate_term *) + val disambiguate_obj : + ?fresh_instances:bool -> + dbd:HSql.dbd -> + aliases:DisambiguateTypes.environment ->(* previous interpretation status *) + universe:DisambiguateTypes.multiple_environment option -> + uri:UriManager.uri option -> (* required only for inductive types *) + CicNotationPt.term CicNotationPt.obj disambiguator_input -> + ((DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Cic.metasenv * (* new metasenv *) + Cic.obj * + CicUniv.universe_graph) list * (* disambiguated obj *) + bool (* has interactive_interpretation_choice been invoked? *) +end + +module Make (C : DisambiguateTypes.Callbacks) : Disambiguator + diff --git a/components/cic_disambiguation/disambiguateChoices.ml b/components/cic_disambiguation/disambiguateChoices.ml new file mode 100644 index 000000000..c3fa7efb2 --- /dev/null +++ b/components/cic_disambiguation/disambiguateChoices.ml @@ -0,0 +1,82 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open DisambiguateTypes + +exception Choice_not_found of string Lazy.t + +let num_choices = ref [] + +let add_num_choice choice = num_choices := choice :: !num_choices + +let has_description dsc = (fun x -> fst x = dsc) + +let lookup_num_choices () = !num_choices + +let lookup_num_by_dsc dsc = + try + List.find (has_description dsc) !num_choices + with Not_found -> raise (Choice_not_found (lazy ("Num with dsc " ^ dsc))) + +let mk_choice (dsc, args, appl_pattern) = + dsc, + (fun env _ cic_args -> + let env',rest = + let names = + List.map (function CicNotationPt.IdentArg (_, name) -> name) args + in + let rec combine_with_rest l1 l2 = + match l1,l2 with + _::_,[] -> raise (Invalid_argument "combine_with_rest") + | [],rest -> [],rest + | he1::tl1,he2::tl2 -> + let l,rest = combine_with_rest tl1 tl2 in + (he1,he2)::l,rest + in + try + combine_with_rest names cic_args + with Invalid_argument _ -> + raise (Invalid_choice (None, lazy ("The notation " ^ dsc ^ " expects more arguments"))) + in + let combined = + TermAcicContent.instantiate_appl_pattern env' appl_pattern + in + match rest with + [] -> combined + | _::_ -> Cic.Appl (combined::rest)) + +let lookup_symbol_by_dsc symbol dsc = + try + mk_choice + (List.find + (fun (dsc', _, _) -> dsc = dsc') + (TermAcicContent.lookup_interpretations symbol)) + with TermAcicContent.Interpretation_not_found | Not_found -> + raise (Choice_not_found (lazy (sprintf "Symbol %s, dsc %s" symbol dsc))) + diff --git a/components/cic_disambiguation/disambiguateChoices.mli b/components/cic_disambiguation/disambiguateChoices.mli new file mode 100644 index 000000000..0ad498106 --- /dev/null +++ b/components/cic_disambiguation/disambiguateChoices.mli @@ -0,0 +1,53 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open DisambiguateTypes + +(** {2 Choice registration low-level interface} *) + + (** raised by lookup_XXXX below *) +exception Choice_not_found of string Lazy.t + + (** register a new number choice *) +val add_num_choice: codomain_item -> unit + +(** {2 Choices lookup} + * for user defined aliases *) + +val lookup_num_choices: unit -> codomain_item list + + (** @param dsc description (1st component of codomain_item) *) +val lookup_num_by_dsc: string -> codomain_item + + (** @param symbol symbol as per AST + * @param dsc description (1st component of codomain_item) + *) +val lookup_symbol_by_dsc: string -> string -> codomain_item + +val mk_choice: + string * CicNotationPt.argument_pattern list * + CicNotationPt.cic_appl_pattern -> + codomain_item + diff --git a/components/cic_disambiguation/disambiguateTypes.ml b/components/cic_disambiguation/disambiguateTypes.ml new file mode 100644 index 000000000..1eade4ca0 --- /dev/null +++ b/components/cic_disambiguation/disambiguateTypes.ml @@ -0,0 +1,130 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +(* +type term = CicNotationPt.term +type tactic = (term, term, GrafiteAst.reduction, string) GrafiteAst.tactic +type tactical = (term, term, GrafiteAst.reduction, string) GrafiteAst.tactical +type script_entry = + | Command of tactical + | Comment of CicNotationPt.location * string +type script = CicNotationPt.location * script_entry list +*) + +type domain_item = + | Id of string (* literal *) + | Symbol of string * int (* literal, instance num *) + | Num of int (* instance num *) + +exception Invalid_choice of Stdpp.location option * string Lazy.t + +module OrderedDomain = + struct + type t = domain_item + let compare = Pervasives.compare + end + +(* module Domain = Set.Make (OrderedDomain) *) +module Environment = +struct + module Environment' = Map.Make (OrderedDomain) + + include Environment' + + let find k env = + match k with + Symbol (sym,n) -> + (try find k env + with Not_found -> find (Symbol (sym,0)) env) + | Num n -> + (try find k env + with Not_found -> find (Num 0) env) + | _ -> find k env + + let cons k v env = + try + let current = find k env in + let dsc, _ = v in + add k (v :: (List.filter (fun (dsc', _) -> dsc' <> dsc) current)) env + with Not_found -> + add k [v] env + + let hd list_env = + try + map List.hd list_env + with Failure _ -> assert false + + let fold_flatten f env base = + fold + (fun k l acc -> List.fold_right (fun v acc -> f k v acc) l acc) + env base + +end + +type codomain_item = + string * (* description *) + (environment -> string -> Cic.term list -> Cic.term) + (* environment, literal number, arguments as needed *) + +and environment = codomain_item Environment.t + +type multiple_environment = codomain_item list Environment.t + + +(** adds a (name,uri) list l to a disambiguation environment e **) +let multiple_env_of_list l e = + List.fold_left + (fun e (name,descr,t) -> Environment.cons (Id name) (descr,fun _ _ _ -> t) e) + e l + +let env_of_list l e = + List.fold_left + (fun e (name,descr,t) -> Environment.add (Id name) (descr,fun _ _ _ -> t) e) + e l + +module type Callbacks = + sig + val interactive_user_uri_choice: + selection_mode:[`SINGLE | `MULTIPLE] -> + ?ok:string -> + ?enable_button_for_non_vars:bool -> + title:string -> msg:string -> id:string -> UriManager.uri list -> + UriManager.uri list + val interactive_interpretation_choice: + string -> int -> + (Stdpp.location list * string * string) list list -> int list + val input_or_locate_uri: + title:string -> ?id:string -> unit -> UriManager.uri option + end + +let string_of_domain_item = function + | Id s -> Printf.sprintf "ID(%s)" s + | Symbol (s, i) -> Printf.sprintf "SYMBOL(%s,%d)" s i + | Num i -> Printf.sprintf "NUM(instance %d)" i + +let string_of_domain dom = + String.concat "; " (List.map string_of_domain_item dom) diff --git a/components/cic_disambiguation/disambiguateTypes.mli b/components/cic_disambiguation/disambiguateTypes.mli new file mode 100644 index 000000000..00fe4114c --- /dev/null +++ b/components/cic_disambiguation/disambiguateTypes.mli @@ -0,0 +1,97 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type domain_item = + | Id of string (* literal *) + | Symbol of string * int (* literal, instance num *) + | Num of int (* instance num *) + +(* module Domain: Set.S with type elt = domain_item *) +module Environment: +sig + include Map.S with type key = domain_item + val cons: domain_item -> ('a * 'b) -> ('a * 'b) list t -> ('a * 'b) list t + val hd: 'a list t -> 'a t + + (** last alias cons-ed will be processed first *) + val fold_flatten: (domain_item -> 'a -> 'b -> 'b) -> 'a list t -> 'b -> 'b +end + + (** to be raised when a choice is invalid due to some given parameter (e.g. + * wrong number of Cic.term arguments received) *) +exception Invalid_choice of Stdpp.location option * string Lazy.t + +type codomain_item = + string * (* description *) + (environment -> string -> Cic.term list -> Cic.term) + (* environment, literal number, arguments as needed *) + +and environment = codomain_item Environment.t + +type multiple_environment = codomain_item list Environment.t + +(* a simple case of extension of a disambiguation environment *) +val env_of_list: + (string * string * Cic.term) list -> environment -> environment + +val multiple_env_of_list: + (string * string * Cic.term) list -> multiple_environment -> + multiple_environment + +module type Callbacks = + sig + + val interactive_user_uri_choice : + selection_mode:[`SINGLE | `MULTIPLE] -> + ?ok:string -> + ?enable_button_for_non_vars:bool -> + title:string -> msg:string -> id:string -> UriManager.uri list -> + UriManager.uri list + + val interactive_interpretation_choice : + string -> int -> + (Stdpp.location list * string * string) list list -> int list + + (** @param title gtk window title for user prompting + * @param id unbound identifier which originated this callback invocation *) + val input_or_locate_uri: + title:string -> ?id:string -> unit -> UriManager.uri option + end + +val string_of_domain_item: domain_item -> string +val string_of_domain: domain_item list -> string + +(** {3 type shortands} *) + +(* +type term = CicNotationPt.term +type tactic = (term, term, GrafiteAst.reduction, string) GrafiteAst.tactic +type tactical = (term, term, GrafiteAst.reduction, string) GrafiteAst.tactical + +type script_entry = + | Command of tactical + | Comment of CicNotationPt.location * string +type script = CicNotationPt.location * script_entry list +*) diff --git a/components/cic_disambiguation/doc/precedence.txt b/components/cic_disambiguation/doc/precedence.txt new file mode 100644 index 000000000..09efea853 --- /dev/null +++ b/components/cic_disambiguation/doc/precedence.txt @@ -0,0 +1,32 @@ + +Input Should be parsed as Derived constraint + on precedence +-------------------------------------------------------------------------------- +\lambda x.x y \lambda x.(x y) lambda > apply +S x = y (= (S x) y) apply > infix operators +\forall x.x=x (\forall x.(= x x)) infix operators > binders +\lambda x.x \to x \lambda. (x \to x) \to > \lambda +-------------------------------------------------------------------------------- + +Precedence total order: + + apply > infix operators > to > binders + +where binders are all binders except lambda (i.e. \forall, \pi, \exists) + +to test: + +./test_parser term << EOT + \lambda x.x y + S x = y + \forall x.x=x + \lambda x.x \to x +EOT + +should respond with: + + \lambda x.(x y) + (eq (S x) y) + \forall x.(eq x x) + \lambda x.(x \to x) + diff --git a/components/cic_disambiguation/number_notation.ml b/components/cic_disambiguation/number_notation.ml new file mode 100644 index 000000000..e3cc4fa0b --- /dev/null +++ b/components/cic_disambiguation/number_notation.ml @@ -0,0 +1,58 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let _ = + DisambiguateChoices.add_num_choice + ("natural number", + (fun _ num _ -> LibraryObjects.build_nat (int_of_string num))); +(* DisambiguateChoices.add_num_choice + ("Coq natural number", + (fun _ num _ -> HelmLibraryObjects.build_nat (int_of_string num))); + DisambiguateChoices.add_num_choice + ("real number", + (fun _ num _ -> HelmLibraryObjects.build_real (int_of_string num))); + DisambiguateChoices.add_num_choice + ("binary positive number", + (fun _ num _ -> + let num = int_of_string num in + if num = 0 then + raise (DisambiguateTypes.Invalid_choice (None, lazy "0 is not a valid positive number")) + else + HelmLibraryObjects.build_bin_pos num)); + DisambiguateChoices.add_num_choice + ("binary integer number", + (fun _ num _ -> + let num = int_of_string num in + if num = 0 then + HelmLibraryObjects.BinInt.z0 + else if num > 0 then + Cic.Appl [ + HelmLibraryObjects.BinInt.zpos; + HelmLibraryObjects.build_bin_pos num ] + else + assert false)) +*) diff --git a/components/cic_disambiguation/tests/aliases.txt b/components/cic_disambiguation/tests/aliases.txt new file mode 100644 index 000000000..12b09fff1 --- /dev/null +++ b/components/cic_disambiguation/tests/aliases.txt @@ -0,0 +1,6 @@ +alias id foo = cic:/a.con +alias id bar = cic:/b.con +alias symbol "plus" (instance 0) = "real plus" +alias symbol "plus" (instance 1) = "natural plus" +alias num (instance 0) = "real number" +alias num (instance 1) = "natural number" diff --git a/components/cic_disambiguation/tests/eq.txt b/components/cic_disambiguation/tests/eq.txt new file mode 100644 index 000000000..6a826fc71 --- /dev/null +++ b/components/cic_disambiguation/tests/eq.txt @@ -0,0 +1 @@ +\forall n. \forall m. n + m = n diff --git a/components/cic_disambiguation/tests/match.txt b/components/cic_disambiguation/tests/match.txt new file mode 100644 index 000000000..87bb0159b --- /dev/null +++ b/components/cic_disambiguation/tests/match.txt @@ -0,0 +1,49 @@ +[\lambda x:nat. + [\lambda y:nat. Set] + match x:nat with [ O \Rightarrow nat | (S x) \Rightarrow bool ]] +match (S O):nat with +[ O \Rightarrow O +| (S x) \Rightarrow false ] + +[\lambda z:nat. \lambda h:(le O z). (eq nat O O)] +match (le_n O): le with +[ le_n \Rightarrow (refl_equal nat O) +| (le_S x y) \Rightarrow (refl_equal nat O) ] + +[\lambda z:nat. \lambda h:(le (plus (plus O O) (plus O O)) z). (eq nat (plus (plus O O) (plus O O)) (plus (plus O O) (plus O O)))] +match (le_n (plus (plus O O) (plus O O))): le with +[ le_n \Rightarrow (refl_equal nat (plus (plus O O) (plus O O))) +| (le_S x y) \Rightarrow (refl_equal nat (plus (plus O O) (plus O O))) ] + +(* +[\lambda z:nat. \lambda h:(le 1 z). (le 0 z)] +match (le_S 2 (le_n 1)): le with +[ le_n \Rightarrow (le_S 1 (le_n 0)) +| (le_S x y) \Rightarrow y ] +*) + +[\lambda z:nat. \lambda h:(le 0 z). (le 0 (S z))] +match (le_S 0 0 (le_n 0)): le with +[ le_n \Rightarrow (le_S 0 0 (le_n 0)) +| (le_S x y) \Rightarrow (le_S 0 (S x) (le_S 0 x y)) ] + + +[\lambda x:bool. nat] +match true:bool with +[ true \Rightarrow O +| false \Rightarrow (S O) ] + +[\lambda x:nat. nat] +match O:nat with +[ O \Rightarrow O +| (S x) \Rightarrow (S (S x)) ] + +[\lambda x:list. list] +match nil:list with +[ nil \Rightarrow nil +| (cons x y) \Rightarrow (cons x y) ] + +\lambda x:False. + [\lambda h:False. True] + match x:False with [] + diff --git a/components/cic_exportation/.depend b/components/cic_exportation/.depend new file mode 100644 index 000000000..288ea5f6c --- /dev/null +++ b/components/cic_exportation/.depend @@ -0,0 +1,2 @@ +cicExportation.cmo: cicExportation.cmi +cicExportation.cmx: cicExportation.cmi diff --git a/components/cic_exportation/.depend.opt b/components/cic_exportation/.depend.opt new file mode 100644 index 000000000..288ea5f6c --- /dev/null +++ b/components/cic_exportation/.depend.opt @@ -0,0 +1,2 @@ +cicExportation.cmo: cicExportation.cmi +cicExportation.cmx: cicExportation.cmi diff --git a/components/cic_exportation/Makefile b/components/cic_exportation/Makefile new file mode 100644 index 000000000..3062749b6 --- /dev/null +++ b/components/cic_exportation/Makefile @@ -0,0 +1,14 @@ +PACKAGE = cic_exportation +PREDICATES = + +INTERFACE_FILES = \ + cicExportation.mli \ + $(NULL) +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) + +# Metadata tools only need zeta-reduction +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/cic_exportation/cicExportation.ml b/components/cic_exportation/cicExportation.ml new file mode 100644 index 000000000..58e817091 --- /dev/null +++ b/components/cic_exportation/cicExportation.ml @@ -0,0 +1,596 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id: cicPp.ml 7413 2007-05-29 15:30:53Z tassi $ *) + +exception CicExportationInternalError;; +exception NotEnoughElements;; + +(* Utility functions *) + +let analyze_term context t = + match fst(CicTypeChecker.type_of_aux' [] context t CicUniv.oblivion_ugraph)with + Cic.Sort _ -> `Type + | ty -> + match + fst (CicTypeChecker.type_of_aux' [] context ty CicUniv.oblivion_ugraph) + with + Cic.Sort Cic.Prop -> `Proof + | _ -> `Term +;; + +let analyze_type context t = + let rec aux = + function + Cic.Sort s -> `Sort s + | Cic.Prod (_,_,t) -> aux t + | _ -> `SomethingElse + in + match aux t with + `Sort _ as res -> res + | `SomethingElse -> + match + fst(CicTypeChecker.type_of_aux' [] context t CicUniv.oblivion_ugraph) + with + Cic.Sort Cic.Prop -> `Statement + | _ -> `Type +;; + +let ppid = + let reserved = + [ "to"; + "mod"; + "val"; + "in"; + "function" + ] + in + function n -> + let n = String.uncapitalize n in + if List.mem n reserved then n ^ "_" else n +;; + +let ppname = + function + Cic.Name s -> ppid s + | Cic.Anonymous -> "_" +;; + +(* get_nth l n returns the nth element of the list l if it exists or *) +(* raises NotEnoughElements if l has less than n elements *) +let rec get_nth l n = + match (n,l) with + (1, he::_) -> he + | (n, he::tail) when n > 1 -> get_nth tail (n-1) + | (_,_) -> raise NotEnoughElements +;; + +let qualified_name_of_uri current_module_uri ?(capitalize=false) uri = + let name = + if capitalize then + String.capitalize (UriManager.name_of_uri uri) + else + ppid (UriManager.name_of_uri uri) in + let filename = + let suri = UriManager.buri_of_uri uri in + let s = String.sub suri 5 (String.length suri - 5) in + let s = Pcre.replace ~pat:"/" ~templ:"_" s in + String.uncapitalize s in + if current_module_uri = UriManager.buri_of_uri uri then + name + else + String.capitalize filename ^ "." ^ name +;; + +let pp current_module_uri ?metasenv ~in_type = +let rec pp ~in_type t context = + let module C = Cic in + match t with + C.Rel n -> + begin + try + (match get_nth context n with + Some (C.Name s,_) -> ppid s + | Some (C.Anonymous,_) -> "__" ^ string_of_int n + | None -> "_hidden_" ^ string_of_int n + ) + with + NotEnoughElements -> string_of_int (List.length context - n) + end + | C.Var (uri,exp_named_subst) -> + qualified_name_of_uri current_module_uri uri ^ + pp_exp_named_subst exp_named_subst context + | C.Meta (n,l1) -> + (match metasenv with + None -> + "?" ^ (string_of_int n) ^ "[" ^ + String.concat " ; " + (List.rev_map + (function + None -> "_" + | Some t -> pp ~in_type:false t context) l1) ^ + "]" + | Some metasenv -> + try + let _,context,_ = CicUtil.lookup_meta n metasenv in + "?" ^ (string_of_int n) ^ "[" ^ + String.concat " ; " + (List.rev + (List.map2 + (fun x y -> + match x,y with + _, None + | None, _ -> "_" + | Some _, Some t -> pp ~in_type:false t context + ) context l1)) ^ + "]" + with + CicUtil.Meta_not_found _ + | Invalid_argument _ -> + "???" ^ (string_of_int n) ^ "[" ^ + String.concat " ; " + (List.rev_map (function None -> "_" | Some t -> + pp ~in_type:false t context) l1) ^ + "]" + ) + | C.Sort s -> + (match s with + C.Prop -> "Prop" + | C.Set -> "Set" + | C.Type _ -> "Type" + (*| C.Type u -> ("Type" ^ CicUniv.string_of_universe u)*) + | C.CProp -> "CProp" + ) + | C.Implicit (Some `Hole) -> "%" + | C.Implicit _ -> "?" + | C.Prod (b,s,t) -> + (match b with + C.Name n -> + let n = "'" ^ String.uncapitalize n in + "(" ^ pp ~in_type:true s context ^ " -> " ^ + pp ~in_type:true t ((Some (Cic.Name n,Cic.Decl s))::context) ^ ")" + | C.Anonymous -> + "(" ^ pp ~in_type:true s context ^ " -> " ^ + pp ~in_type:true t ((Some (b,Cic.Decl s))::context) ^ ")") + | C.Cast (v,t) -> pp ~in_type v context + | C.Lambda (b,s,t) -> + (match analyze_type context s with + `Sort _ + | `Statement -> pp ~in_type t ((Some (b,Cic.Decl s))::context) + | `Type -> + "(function " ^ ppname b ^ " -> " ^ + pp ~in_type t ((Some (b,Cic.Decl s))::context) ^ ")") + | C.LetIn (b,s,t) -> + (match analyze_term context s with + `Type + | `Proof -> + let ty,_ = + CicTypeChecker.type_of_aux' [] context s CicUniv.oblivion_ugraph + in + pp ~in_type t ((Some (b,Cic.Def (s,Some ty)))::context) + | `Term -> + let ty,_ = + CicTypeChecker.type_of_aux' [] context s CicUniv.oblivion_ugraph + in + "(let " ^ ppname b ^ " = " ^ pp ~in_type:false s context ^ " in " ^ + pp ~in_type t ((Some (b,Cic.Def (s,Some ty)))::context) ^ ")") + | C.Appl (he::tl) when in_type -> + let hes = pp ~in_type he context in + let stl = String.concat "," (clean_args_for_ty context tl) in + (if stl = "" then "" else "(" ^ stl ^ ") ") ^ hes + | C.Appl (C.MutInd _ as he::tl) -> + let hes = pp ~in_type he context in + let stl = String.concat "," (clean_args_for_ty context tl) in + (if stl = "" then "" else "(" ^ stl ^ ") ") ^ hes + | C.Appl (C.MutConstruct (uri,n,_,_) as he::tl) -> + let nparams = + match fst(CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + C.InductiveDefinition (_,_,nparams,_) -> nparams + | _ -> assert false in + let hes = pp ~in_type he context in + let stl = String.concat "," (clean_args nparams context tl) in + "(" ^ hes ^ (if stl = "" then "" else "(" ^ stl ^ ")") ^ ")" + | C.Appl li -> + "(" ^ String.concat " " (clean_args 0 context li) ^ ")" + | C.Const (uri,exp_named_subst) -> + qualified_name_of_uri current_module_uri uri ^ + pp_exp_named_subst exp_named_subst context + | C.MutInd (uri,n,exp_named_subst) -> + (try + match fst(CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + C.InductiveDefinition (dl,_,_,_) -> + let (name,_,_,_) = get_nth dl (n+1) in + qualified_name_of_uri current_module_uri + (UriManager.uri_of_string + (UriManager.buri_of_uri uri ^ "/" ^ name ^ ".con")) ^ + pp_exp_named_subst exp_named_subst context + | _ -> raise CicExportationInternalError + with + Sys.Break as exn -> raise exn + | _ -> UriManager.string_of_uri uri ^ "#1/" ^ string_of_int (n + 1) + ) + | C.MutConstruct (uri,n1,n2,exp_named_subst) -> + (try + match fst(CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + C.InductiveDefinition (dl,_,_,_) -> + let _,_,_,cons = get_nth dl (n1+1) in + let id,_ = get_nth cons n2 in + qualified_name_of_uri current_module_uri ~capitalize:true + (UriManager.uri_of_string + (UriManager.buri_of_uri uri ^ "/" ^ id ^ ".con")) ^ + pp_exp_named_subst exp_named_subst context + | _ -> raise CicExportationInternalError + with + Sys.Break as exn -> raise exn + | _ -> + UriManager.string_of_uri uri ^ "#1/" ^ string_of_int (n1 + 1) ^ "/" ^ + string_of_int n2 + ) + | C.MutCase (uri,n1,ty,te,patterns) -> + if in_type then + "unit (* TOO POLYMORPHIC TYPE *)" + else ( + let needs_obj_magic = + (* BUG HERE: we should consider also the right parameters *) + match CicReduction.whd context ty with + Cic.Lambda (_,_,t) -> not (DoubleTypeInference.does_not_occur 1 t) + | _ -> false (* it can be a Rel, e.g. in *_rec *) + in + (match analyze_term context te with + `Type -> assert false + | `Proof -> + (match patterns with + [] -> "assert false" (* empty type elimination *) + | [he] -> + pp ~in_type:false he context (* singleton elimination *) + | _ -> assert false) + | `Term -> + if patterns = [] then "assert false" + else + (let connames_and_argsno = + (match fst(CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + C.InductiveDefinition (dl,_,paramsno,_) -> + let (_,_,_,cons) = get_nth dl (n1+1) in + List.map + (fun (id,ty) -> + (* this is just an approximation since we do not have + reduction yet! *) + let rec count_prods toskip = + function + C.Prod (_,_,bo) when toskip > 0 -> + count_prods (toskip - 1) bo + | C.Prod (_,_,bo) -> 1 + count_prods 0 bo + | _ -> 0 + in + qualified_name_of_uri current_module_uri + ~capitalize:true + (UriManager.uri_of_string + (UriManager.buri_of_uri uri ^ "/" ^ id ^ ".con")), + count_prods paramsno ty + ) cons + | _ -> raise CicExportationInternalError + ) + in + let connames_and_argsno_and_patterns = + let rec combine = + function + [],[] -> [] + | (x,no)::tlx,y::tly -> (x,no,y)::(combine (tlx,tly)) + | _,_ -> assert false + in + combine (connames_and_argsno,patterns) + in + "\n(match " ^ pp ~in_type:false te context ^ " with \n " ^ + (String.concat "\n | " + (List.map + (fun (x,argsno,y) -> + let rec aux argsno context = + function + Cic.Lambda (name,ty,bo) when argsno > 0 -> + let name = + match name with + Cic.Anonymous -> Cic.Anonymous + | Cic.Name n -> Cic.Name (ppid n) in + let args,res = + aux (argsno - 1) (Some (name,Cic.Decl ty)::context) + bo + in + (match analyze_type context ty with + `Statement + | `Sort _ -> args,res + | `Type -> + (match name with + C.Anonymous -> "_" + | C.Name s -> s)::args,res) + | t when argsno = 0 -> [],pp ~in_type:false t context + | t -> + ["{" ^ string_of_int argsno ^ " args missing}"], + pp ~in_type:false t context + in + let pattern,body = + if argsno = 0 then x,pp ~in_type:false y context + else + let args,body = aux argsno context y in + let sargs = String.concat "," args in + x ^ (if sargs = "" then "" else "(" ^ sargs^ ")"), + body + in + pattern ^ " -> " ^ + if needs_obj_magic then + "Obj.magic (" ^ body ^ ")" + else + body + ) connames_and_argsno_and_patterns)) ^ + ")\n"))) + | C.Fix (no, funs) -> + let names,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) funs + in + "let rec " ^ + List.fold_right + (fun (name,ind,ty,bo) i -> name ^ " = \n" ^ + pp ~in_type:false bo (names@context) ^ i) + funs "" ^ + " in " ^ + (match get_nth names (no + 1) with + Some (Cic.Name n,_) -> n + | _ -> assert false) + | C.CoFix (no,funs) -> + let names,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) funs + in + "\nCoFix " ^ " {" ^ + List.fold_right + (fun (name,ty,bo) i -> "\n" ^ name ^ + " : " ^ pp ~in_type:true ty context ^ " := \n" ^ + pp ~in_type:false bo (names@context) ^ i) + funs "" ^ + "}\n" +and pp_exp_named_subst exp_named_subst context = + if exp_named_subst = [] then "" else + "\\subst[" ^ + String.concat " ; " ( + List.map + (function (uri,t) -> UriManager.name_of_uri uri ^ " \\Assign " ^ pp ~in_type:false t context) + exp_named_subst + ) ^ "]" +and clean_args nparams context = + let nparams = ref nparams in + HExtlib.filter_map + (function t -> + decr nparams; + match analyze_term context t with + `Term when !nparams < 0 -> Some (pp ~in_type:false t context) + | `Term + | `Type + | `Proof -> None) +and clean_args_for_ty context = + HExtlib.filter_map + (function t -> + match analyze_term context t with + `Type -> Some (pp ~in_type:true t context) + | `Proof -> None + | `Term -> None) +in + pp ~in_type +;; + +let ppty current_module_uri = + (* nparams is the number of left arguments + left arguments should either become parameters or be skipped altogether *) + let rec args nparams context = + function + Cic.Prod (n,s,t) -> + let n = + match n with + Cic.Anonymous -> Cic.Anonymous + | Cic.Name n -> Cic.Name (String.uncapitalize n) + in + (match analyze_type context s with + `Statement + | `Sort Cic.Prop -> + args (nparams - 1) ((Some (n,Cic.Decl s))::context) t + | `Type when nparams > 0 -> + args (nparams - 1) ((Some (n,Cic.Decl s))::context) t + | `Type -> + let abstr,args = + args (nparams - 1) ((Some (n,Cic.Decl s))::context) t in + abstr,pp ~in_type:true current_module_uri s context::args + | `Sort _ when nparams <= 0 -> + let n = Cic.Name "unit (* EXISTENTIAL TYPE *)" in + args (nparams - 1) ((Some (n,Cic.Decl s))::context) t + | `Sort _ -> + let n = + match n with + Cic.Anonymous -> Cic.Anonymous + | Cic.Name name -> Cic.Name ("'" ^ name) in + let abstr,args = + args (nparams - 1) ((Some (n,Cic.Decl s))::context) t + in + (match n with + Cic.Anonymous -> abstr + | Cic.Name name -> name::abstr), + args) + | _ -> [],[] + in + args +;; + +exception DoNotExtract;; + +let pp_abstracted_ty current_module_uri = + let rec args context = + function + Cic.Lambda (n,s,t) -> + let n = + match n with + Cic.Anonymous -> Cic.Anonymous + | Cic.Name n -> Cic.Name (String.uncapitalize n) + in + (match analyze_type context s with + `Statement + | `Type + | `Sort Cic.Prop -> + args ((Some (n,Cic.Decl s))::context) t + | `Sort _ -> + let n = + match n with + Cic.Anonymous -> Cic.Anonymous + | Cic.Name name -> Cic.Name ("'" ^ name) in + let abstr,res = + args ((Some (n,Cic.Decl s))::context) t + in + (match n with + Cic.Anonymous -> abstr + | Cic.Name name -> name::abstr), + res) + | ty -> + match analyze_type context ty with + ` Sort _ + | `Statement -> raise DoNotExtract + | `Type -> + (* BUG HERE: this can be a real System F type *) + let head = pp ~in_type:true current_module_uri ty context in + [],head + in + args +;; + + +(* ppinductiveType (typename, inductive, arity, cons) *) +(* pretty-prints a single inductive definition *) +(* (typename, inductive, arity, cons) *) +let ppinductiveType current_module_uri nparams (typename, inductive, arity, cons) += + match analyze_type [] arity with + `Sort Cic.Prop -> "" + | `Statement + | `Type -> assert false + | `Sort _ -> + if cons = [] then + "type " ^ String.uncapitalize typename ^ " = unit (* empty type *)\n" + else ( + let abstr,scons = + List.fold_right + (fun (id,ty) (_abstr,i) -> (* we should verify _abstr = abstr' *) + let abstr',sargs = ppty current_module_uri nparams [] ty in + let sargs = String.concat " * " sargs in + abstr', + String.capitalize id ^ + (if sargs = "" then "" else " of " ^ sargs) ^ + (if i = "" then "" else "\n | ") ^ i) + cons ([],"") + in + let abstr = + let s = String.concat "," abstr in + if s = "" then "" else "(" ^ s ^ ") " + in + "type " ^ abstr ^ String.uncapitalize typename ^ " =\n" ^ scons ^ "\n") +;; + +let ppobj current_module_uri obj = + let module C = Cic in + let module U = UriManager in + let pp ~in_type = pp ~in_type current_module_uri in + match obj with + C.Constant (name, Some t1, t2, params, _) -> + (match analyze_type [] t2 with + `Sort Cic.Prop + | `Statement -> "" + | `Type -> "let " ^ ppid name ^ " =\n" ^ pp ~in_type:false t1 [] ^ "\n" + | `Sort _ -> + match analyze_type [] t1 with + `Sort Cic.Prop -> "" + | _ -> + (try + let abstr,res = pp_abstracted_ty current_module_uri [] t1 in + let abstr = + let s = String.concat "," abstr in + if s = "" then "" else "(" ^ s ^ ") " + in + "type " ^ abstr ^ ppid name ^ " = " ^ res ^ "\n" + with + DoNotExtract -> "")) + | C.Constant (name, None, ty, params, _) -> + (match analyze_type [] ty with + `Sort Cic.Prop + | `Statement -> "" + | `Sort _ -> "type " ^ ppid name ^ "\n" + | `Type -> "let " ^ ppid name ^ " = assert false\n") + | C.Variable (name, bo, ty, params, _) -> + "Variable " ^ name ^ + "(" ^ String.concat ";" (List.map UriManager.string_of_uri params) ^ + ")" ^ ":\n" ^ + pp ~in_type:true ty [] ^ "\n" ^ + (match bo with None -> "" | Some bo -> ":= " ^ pp ~in_type:false bo []) + | C.CurrentProof (name, conjectures, value, ty, params, _) -> + "Current Proof of " ^ name ^ + "(" ^ String.concat ";" (List.map UriManager.string_of_uri params) ^ + ")" ^ ":\n" ^ + let separate s = if s = "" then "" else s ^ " ; " in + List.fold_right + (fun (n, context, t) i -> + let conjectures',name_context = + List.fold_right + (fun context_entry (i,name_context) -> + (match context_entry with + Some (n,C.Decl at) -> + (separate i) ^ + ppname n ^ ":" ^ + pp ~in_type:true ~metasenv:conjectures + at name_context ^ " ", + context_entry::name_context + | Some (n,C.Def (at,None)) -> + (separate i) ^ + ppname n ^ ":= " ^ pp ~in_type:false + ~metasenv:conjectures at name_context ^ " ", + context_entry::name_context + | None -> + (separate i) ^ "_ :? _ ", context_entry::name_context + | _ -> assert false) + ) context ("",[]) + in + conjectures' ^ " |- " ^ "?" ^ (string_of_int n) ^ ": " ^ + pp ~in_type:true ~metasenv:conjectures t name_context ^ "\n" ^ i + ) conjectures "" ^ + "\n" ^ pp ~in_type:false ~metasenv:conjectures value [] ^ " : " ^ + pp ~in_type:true ~metasenv:conjectures ty [] + | C.InductiveDefinition (l, params, nparams, _) -> + List.fold_right + (fun x i -> ppinductiveType current_module_uri nparams x ^ i) l "" +;; + +let ppobj current_module_uri obj = + let res = ppobj current_module_uri obj in + if res = "" then "" else res ^ ";;\n\n" +;; diff --git a/components/cic_exportation/cicExportation.mli b/components/cic_exportation/cicExportation.mli new file mode 100644 index 000000000..4d1c82c86 --- /dev/null +++ b/components/cic_exportation/cicExportation.mli @@ -0,0 +1,29 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id: cicPp.ml 7413 2007-05-29 15:30:53Z tassi $ *) + +(* ppobj current_module_uri obj *) +val ppobj : string -> Cic.obj -> string diff --git a/components/cic_proof_checking/.depend b/components/cic_proof_checking/.depend new file mode 100644 index 000000000..06b9188a0 --- /dev/null +++ b/components/cic_proof_checking/.depend @@ -0,0 +1,24 @@ +cicLogger.cmo: cicLogger.cmi +cicLogger.cmx: cicLogger.cmi +cicEnvironment.cmo: cicEnvironment.cmi +cicEnvironment.cmx: cicEnvironment.cmi +cicPp.cmo: cicEnvironment.cmi cicPp.cmi +cicPp.cmx: cicEnvironment.cmx cicPp.cmi +cicUnivUtils.cmo: cicEnvironment.cmi cicUnivUtils.cmi +cicUnivUtils.cmx: cicEnvironment.cmx cicUnivUtils.cmi +cicSubstitution.cmo: cicEnvironment.cmi cicSubstitution.cmi +cicSubstitution.cmx: cicEnvironment.cmx cicSubstitution.cmi +cicMiniReduction.cmo: cicSubstitution.cmi cicMiniReduction.cmi +cicMiniReduction.cmx: cicSubstitution.cmx cicMiniReduction.cmi +cicReduction.cmo: cicSubstitution.cmi cicPp.cmi cicEnvironment.cmi \ + cicReduction.cmi +cicReduction.cmx: cicSubstitution.cmx cicPp.cmx cicEnvironment.cmx \ + cicReduction.cmi +cicTypeChecker.cmo: cicUnivUtils.cmi cicSubstitution.cmi cicReduction.cmi \ + cicPp.cmi cicLogger.cmi cicEnvironment.cmi cicTypeChecker.cmi +cicTypeChecker.cmx: cicUnivUtils.cmx cicSubstitution.cmx cicReduction.cmx \ + cicPp.cmx cicLogger.cmx cicEnvironment.cmx cicTypeChecker.cmi +freshNamesGenerator.cmo: cicTypeChecker.cmi cicSubstitution.cmi \ + freshNamesGenerator.cmi +freshNamesGenerator.cmx: cicTypeChecker.cmx cicSubstitution.cmx \ + freshNamesGenerator.cmi diff --git a/components/cic_proof_checking/.depend.opt b/components/cic_proof_checking/.depend.opt new file mode 100644 index 000000000..06b9188a0 --- /dev/null +++ b/components/cic_proof_checking/.depend.opt @@ -0,0 +1,24 @@ +cicLogger.cmo: cicLogger.cmi +cicLogger.cmx: cicLogger.cmi +cicEnvironment.cmo: cicEnvironment.cmi +cicEnvironment.cmx: cicEnvironment.cmi +cicPp.cmo: cicEnvironment.cmi cicPp.cmi +cicPp.cmx: cicEnvironment.cmx cicPp.cmi +cicUnivUtils.cmo: cicEnvironment.cmi cicUnivUtils.cmi +cicUnivUtils.cmx: cicEnvironment.cmx cicUnivUtils.cmi +cicSubstitution.cmo: cicEnvironment.cmi cicSubstitution.cmi +cicSubstitution.cmx: cicEnvironment.cmx cicSubstitution.cmi +cicMiniReduction.cmo: cicSubstitution.cmi cicMiniReduction.cmi +cicMiniReduction.cmx: cicSubstitution.cmx cicMiniReduction.cmi +cicReduction.cmo: cicSubstitution.cmi cicPp.cmi cicEnvironment.cmi \ + cicReduction.cmi +cicReduction.cmx: cicSubstitution.cmx cicPp.cmx cicEnvironment.cmx \ + cicReduction.cmi +cicTypeChecker.cmo: cicUnivUtils.cmi cicSubstitution.cmi cicReduction.cmi \ + cicPp.cmi cicLogger.cmi cicEnvironment.cmi cicTypeChecker.cmi +cicTypeChecker.cmx: cicUnivUtils.cmx cicSubstitution.cmx cicReduction.cmx \ + cicPp.cmx cicLogger.cmx cicEnvironment.cmx cicTypeChecker.cmi +freshNamesGenerator.cmo: cicTypeChecker.cmi cicSubstitution.cmi \ + freshNamesGenerator.cmi +freshNamesGenerator.cmx: cicTypeChecker.cmx cicSubstitution.cmx \ + freshNamesGenerator.cmi diff --git a/components/cic_proof_checking/Makefile b/components/cic_proof_checking/Makefile new file mode 100644 index 000000000..b2ee8993f --- /dev/null +++ b/components/cic_proof_checking/Makefile @@ -0,0 +1,27 @@ + +PACKAGE = cic_proof_checking +PREDICATES = + +REDUCTION_IMPLEMENTATION = cicReductionMachine.ml + +INTERFACE_FILES = \ + cicLogger.mli \ + cicEnvironment.mli \ + cicPp.mli \ + cicUnivUtils.mli \ + cicSubstitution.mli \ + cicMiniReduction.mli \ + cicReduction.mli \ + cicTypeChecker.mli \ + freshNamesGenerator.mli \ + $(NULL) +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) + +# Metadata tools only need zeta-reduction +EXTRA_OBJECTS_TO_INSTALL = \ + cicSubstitution.cmo cicSubstitution.cmx cicSubstitution.o \ + cicMiniReduction.cmo cicMiniReduction.cmx cicMiniReduction.o +EXTRA_OBJECTS_TO_CLEAN = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/cic_proof_checking/cicEnvironment.ml b/components/cic_proof_checking/cicEnvironment.ml new file mode 100644 index 000000000..8ae5c1b13 --- /dev/null +++ b/components/cic_proof_checking/cicEnvironment.ml @@ -0,0 +1,548 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*****************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 24/01/2000 *) +(* *) +(* This module implements a trival cache system (an hash-table) for cic *) +(* objects. Uses the getter (getter.ml) and the parser (cicParser.ml) *) +(* *) +(*****************************************************************************) + +(* $Id$ *) + +(* ************************************************************************** * + CicEnvironment SETTINGS (trust and clean_tmp) + * ************************************************************************** *) + +let debug = false;; +let cleanup_tmp = true;; +let trust = ref (fun _ -> true);; +let set_trust f = trust := f +let trust_obj uri = !trust uri +let debug_print = if debug then fun x -> prerr_endline (Lazy.force x) else ignore + +(* ************************************************************************** * + TYPES + * ************************************************************************** *) + +type type_checked_obj = + CheckedObj of (Cic.obj * CicUniv.universe_graph) (* cooked obj *) + | UncheckedObj of Cic.obj (* uncooked obj to proof-check *) +;; + +exception AlreadyCooked of string;; +exception CircularDependency of string Lazy.t;; +exception CouldNotFreeze of string;; +exception CouldNotUnfreeze of string;; +exception Object_not_found of UriManager.uri;; + + +(* ************************************************************************** * + HERE STARTS THE CACHE MODULE + * ************************************************************************** *) + +(* I think this should be the right place to implement mecanisms and + * invasriants + *) + +(* Cache that uses == instead of = for testing equality *) +(* Invariant: an object is always in at most one of the *) +(* following states: unchecked, frozen and cooked. *) +module Cache : + sig + val find_or_add_to_unchecked : + UriManager.uri -> + get_object_to_add: + (UriManager.uri -> + Cic.obj * (CicUniv.universe_graph * CicUniv.universe list) option) -> + Cic.obj * CicUniv.universe_graph * CicUniv.universe list + val can_be_cooked: + UriManager.uri -> bool + val unchecked_to_frozen : + UriManager.uri -> unit + val frozen_to_cooked : + uri:UriManager.uri -> unit + val hack_univ: + UriManager.uri -> CicUniv.universe_graph * CicUniv.universe list -> unit + val find_cooked : + key:UriManager.uri -> + Cic.obj * CicUniv.universe_graph * CicUniv.universe list + val add_cooked : + key:UriManager.uri -> + (Cic.obj * CicUniv.universe_graph * CicUniv.universe list) -> unit + val remove: UriManager.uri -> unit + val dump_to_channel : ?callback:(string -> unit) -> out_channel -> unit + val restore_from_channel : ?callback:(string -> unit) -> in_channel -> unit + val empty : unit -> unit + val is_in_frozen: UriManager.uri -> bool + val is_in_unchecked: UriManager.uri -> bool + val is_in_cooked: UriManager.uri -> bool + val list_all_cooked_uris: unit -> UriManager.uri list + end += + struct + (************************************************************************* + TASSI: invariant + The cacheOfCookedObjects will contain only objects with a valid universe + graph. valid means that not None (used if there is no universe file + in the universe generation phase). + **************************************************************************) + + (* DATA: the data structure that implements the CACHE *) + module HashedType = + struct + type t = UriManager.uri + let equal = UriManager.eq + let hash = Hashtbl.hash + end + ;; + + module HT = Hashtbl.Make(HashedType);; + + let cacheOfCookedObjects = HT.create 1009;; + + (* DATA: The parking lists + * the lists elements are (uri * (obj * universe_graph option)) + * ( u, ( o, None )) means that the object has no universes file, this + * should happen only in the universe generation phase. + * FIXME: if the universe generation is integrated in the library + * exportation phase, the 'option' MUST be removed. + * ( u, ( o, Some g)) means that the object has a universes file, + * the usual case. + *) + + (* frozen is used to detect circular dependency. *) + let frozen_list = ref [];; + (* unchecked is used to store objects just fetched, nothing more. *) + let unchecked_list = ref [];; + + let empty () = + HT.clear cacheOfCookedObjects; + unchecked_list := [] ; + frozen_list := [] + ;; + + (* FIX: universe stuff?? *) + let dump_to_channel ?(callback = ignore) oc = + HT.iter (fun uri _ -> callback (UriManager.string_of_uri uri)) + cacheOfCookedObjects; + Marshal.to_channel oc cacheOfCookedObjects [] + ;; + + (* FIX: universes stuff?? *) + let restore_from_channel ?(callback = ignore) ic = + let restored = Marshal.from_channel ic in + (* FIXME: should this empty clean the frozen and unchecked? + * if not, the only-one-empty-end-not-3 patch is wrong + *) + empty (); + HT.iter + (fun k (v,u,l) -> + callback (UriManager.string_of_uri k); + let reconsed_entry = + CicUtil.rehash_obj v, + CicUniv.recons_graph u, + List.map CicUniv.recons_univ l + in + HT.add cacheOfCookedObjects + (UriManager.uri_of_string (UriManager.string_of_uri k)) + reconsed_entry) + restored + ;; + + + let is_in_frozen uri = + List.mem_assoc uri !frozen_list + ;; + + let is_in_unchecked uri = + List.mem_assoc uri !unchecked_list + ;; + + let is_in_cooked uri = + HT.mem cacheOfCookedObjects uri + ;; + + + (******************************************************************* + TASSI: invariant + we need, in the universe generation phase, to traverse objects + that are not yet committed, so we search them in the frozen list. + Only uncommitted objects without a universe file (see the assertion) + can be searched with method + *******************************************************************) + + let find_or_add_to_unchecked uri ~get_object_to_add = + try + let o,g_and_l = List.assq uri !unchecked_list in + match g_and_l with + (* FIXME: we accept both cases, as at the end of this function + * maybe the None universe outside the cache module should be + * avoided elsewhere. + * + * another thing that should be removed if univ generation phase + * and lib exportation are unified. + *) + | None -> o,CicUniv.empty_ugraph,[] + | Some (g,l) -> o,g,l + with + Not_found -> + if List.mem_assq uri !frozen_list then + (* CIRCULAR DEPENDENCY DETECTED, print the error and raise *) + begin +(* + prerr_endline "\nCircularDependency!\nfrozen list: \n"; + List.iter ( + fun (u,(_,o)) -> + let su = UriManager.string_of_uri u in + let univ = if o = None then "NO_UNIV" else "" in + prerr_endline (su^" "^univ)) + !frozen_list; +*) + raise (CircularDependency (lazy (UriManager.string_of_uri uri))) + end + else + if HT.mem cacheOfCookedObjects uri then + (* DOUBLE COOK DETECTED, raise the exception *) + raise (AlreadyCooked (UriManager.string_of_uri uri)) + else + (* OK, it is not already frozen nor cooked *) + let obj,ugraph_and_univlist = get_object_to_add uri in + let ugraph_real, univlist_real = + match ugraph_and_univlist with + (* FIXME: not sure it is OK*) + None -> CicUniv.empty_ugraph, [] + | Some ((g,l) as g_and_l) -> g_and_l + in + unchecked_list := + (uri,(obj,ugraph_and_univlist))::!unchecked_list ; + obj, ugraph_real, univlist_real + ;; + + let unchecked_to_frozen uri = + try + let obj,ugraph_and_univlist = List.assq uri !unchecked_list in + unchecked_list := List.remove_assq uri !unchecked_list ; + frozen_list := (uri,(obj,ugraph_and_univlist))::!frozen_list + with + Not_found -> raise (CouldNotFreeze (UriManager.string_of_uri uri)) + ;; + + + (************************************************************ + TASSI: invariant + only object with a valid universe graph can be committed + + this should disappear if the universe generation phase and the + library exportation are unified. + *************************************************************) + let frozen_to_cooked ~uri = + try + let obj,ugraph_and_univlist = List.assq uri !frozen_list in + match ugraph_and_univlist with + | None -> assert false (* only NON dummy universes can be committed *) + | Some (g,l) -> + CicUniv.assert_univs_have_uri g l; + frozen_list := List.remove_assq uri !frozen_list ; + HT.add cacheOfCookedObjects uri (obj,g,l) + with + Not_found -> raise (CouldNotUnfreeze (UriManager.string_of_uri uri)) + ;; + + let can_be_cooked uri = + try + let obj,ugraph_and_univlist = List.assq uri !frozen_list in + (* FIXME: another thing to remove if univ generation phase and lib + * exportation are unified. + *) + match ugraph_and_univlist with + None -> false + | Some _ -> true + with + Not_found -> false + ;; + + (* this function injects a real universe graph in a (uri, (obj, None)) + * element of the frozen list. + * + * FIXME: another thing to remove if univ generation phase and lib + * exportation are unified. + *) + let hack_univ uri (real_ugraph, real_univlist) = + try + let o,ugraph_and_univlist = List.assq uri !frozen_list in + match ugraph_and_univlist with + None -> + frozen_list := List.remove_assoc uri !frozen_list; + frozen_list := + (uri,(o,Some (real_ugraph, real_univlist)))::!frozen_list; + | Some g -> + debug_print (lazy ( + "You are probably hacking an object already hacked or an"^ + " object that has the universe file but is not"^ + " yet committed.")); + assert false + with + Not_found -> + debug_print (lazy ( + "You are hacking an object that is not in the"^ + " frozen_list, this means you are probably generating an"^ + " universe file for an object that already"^ + " as an universe file")); + assert false + ;; + + let find_cooked ~key:uri = HT.find cacheOfCookedObjects uri ;; + + let add_cooked ~key:uri (obj,ugraph,univlist) = + HT.add cacheOfCookedObjects uri (obj,ugraph,univlist) + ;; + + (* invariant + * + * an object can be romeved from the cache only if we are not typechecking + * something. this means check and frozen must be empty. + *) + let remove uri = + if !frozen_list <> [] then + failwith "CicEnvironment.remove while type checking" + else + begin + HT.remove cacheOfCookedObjects uri; + unchecked_list := + List.filter (fun (uri',_) -> not (UriManager.eq uri uri')) !unchecked_list + end + ;; + + let list_all_cooked_uris () = + HT.fold (fun u _ l -> u::l) cacheOfCookedObjects [] + ;; + + end +;; + +(* ************************************************************************ + HERE ENDS THE CACHE MODULE + * ************************************************************************ *) + +(* exported cache functions *) +let dump_to_channel = Cache.dump_to_channel;; +let restore_from_channel = Cache.restore_from_channel;; +let empty = Cache.empty;; + +let total_parsing_time = ref 0.0 + +let get_object_to_add uri = + try + let filename = Http_getter.getxml' uri in + let bodyfilename = + match UriManager.bodyuri_of_uri uri with + None -> None + | Some bodyuri -> + if Http_getter.exists' ~local:false bodyuri then + Some (Http_getter.getxml' bodyuri) + else + None + in + let obj = + try + let time = Unix.gettimeofday() in + let rc = CicParser.obj_of_xml uri filename bodyfilename in + total_parsing_time := + !total_parsing_time +. ((Unix.gettimeofday()) -. time ); + rc + with exn -> + (match exn with + | CicParser.Getter_failure ("key_not_found", uri) -> + raise (Object_not_found (UriManager.uri_of_string uri)) + | _ -> raise exn) + in + let ugraph_and_univlist,filename_univ = + try + let filename_univ = + let univ_uri = UriManager.univgraphuri_of_uri uri in + Http_getter.getxml' univ_uri + in + Some (CicUniv.ugraph_and_univlist_of_xml filename_univ), + Some filename_univ + with + | Http_getter_types.Key_not_found _ + | Http_getter_types.Unresolvable_URI _ -> + debug_print (lazy ( + "WE HAVE NO UNIVERSE FILE FOR " ^ (UriManager.string_of_uri uri))); + (* WE SHOULD FAIL (or return None, None *) + Some (CicUniv.empty_ugraph, []), None + in + obj, ugraph_and_univlist + with Http_getter_types.Key_not_found _ -> raise (Object_not_found uri) +;; + +(* this is the function to fetch the object in the unchecked list and + * nothing more (except returning it) + *) +let find_or_add_to_unchecked uri = + Cache.find_or_add_to_unchecked uri ~get_object_to_add + +(* set_type_checking_info uri *) +(* must be called once the type-checking of uri is finished *) +(* The object whose uri is uri is unfreezed *) +(* *) +(* the replacement ugraph must be the one returned by the *) +(* typechecker, restricted with the CicUnivUtils.clean_and_fill *) +let set_type_checking_info ?(replace_ugraph_and_univlist=None) uri = +(* + if not (Cache.can_be_cooked uri) && replace_ugraph <> None then begin + debug_print (lazy ( + "?replace_ugraph must be None if you are not committing an "^ + "object that has a universe graph associated "^ + "(can happen only in the fase of universes graphs generation).")); + assert false + else +*) + match Cache.can_be_cooked uri, replace_ugraph_and_univlist with + | true, Some _ + | false, None -> + debug_print (lazy ( + "?replace_ugraph must be (Some ugraph) when committing an object that "^ + "has no associated universe graph. If this is in make_univ phase you "^ + "should drop this exception and let univ_make commit thi object with "^ + "proper arguments")); + assert false + | _ -> + (match replace_ugraph_and_univlist with + | None -> () + | Some g_and_l -> Cache.hack_univ uri g_and_l); + Cache.frozen_to_cooked uri +;; + +(* fetch, unfreeze and commit an uri to the cacheOfCookedObjects and + * return the object,ugraph + *) +let add_trusted_uri_to_cache uri = + let _ = find_or_add_to_unchecked uri in + Cache.unchecked_to_frozen uri; + set_type_checking_info uri; + try + Cache.find_cooked uri + with Not_found -> assert false +;; + +(* get the uri, if we trust it will be added to the cacheOfCookedObjects *) +let get_cooked_obj_with_univlist ?(trust=true) base_ugraph uri = + try + (* the object should be in the cacheOfCookedObjects *) + let o,u,l = Cache.find_cooked uri in + o,(CicUniv.merge_ugraphs ~base_ugraph ~increment:(u,uri(*,l*))),l + with Not_found -> + (* this should be an error case, but if we trust the uri... *) + if trust && trust_obj uri then + (* trusting means that we will fetch cook it on the fly *) + let o,u,l = add_trusted_uri_to_cache uri in + o,(CicUniv.merge_ugraphs ~base_ugraph ~increment:(u,uri(*,l*))),l + else + (* we don't trust the uri, so we fail *) + begin + debug_print (lazy ("CACHE MISS: " ^ (UriManager.string_of_uri uri))); + raise Not_found + end + +let get_cooked_obj ?trust base_ugraph uri = + let o,g,_ = get_cooked_obj_with_univlist ?trust base_ugraph uri in + o,g + +(* This has not the old semantic :( but is what the name suggests + * + * let is_type_checked ?(trust=true) uri = + * try + * let _ = Cache.find_cooked uri in + * true + * with + * Not_found -> + * trust && trust_obj uri + * ;; + * + * as the get_cooked_obj but returns a type_checked_obj + * + *) +let is_type_checked ?(trust=true) base_ugraph uri = + try + let o,u,l = Cache.find_cooked uri in + CheckedObj (o,(CicUniv.merge_ugraphs ~base_ugraph ~increment:(u,uri(*,l*)))) + with Not_found -> + (* this should return UncheckedObj *) + if trust && trust_obj uri then + (* trusting means that we will fetch cook it on the fly *) + let o,u,l = add_trusted_uri_to_cache uri in + CheckedObj ( o, CicUniv.merge_ugraphs ~base_ugraph ~increment:(u,uri(*,l*))) + else + let o,u,_ = find_or_add_to_unchecked uri in + Cache.unchecked_to_frozen uri; + UncheckedObj o +;; + +(* as the get cooked, but if not present the object is only fetched, + * not unfreezed and committed + *) +let get_obj base_ugraph uri = + try + (* the object should be in the cacheOfCookedObjects *) + let o,u,l = Cache.find_cooked uri in + o,(CicUniv.merge_ugraphs ~base_ugraph ~increment:(u,uri(*,l*))) + with Not_found -> + (* this should be an error case, but if we trust the uri... *) + let o,u,l = find_or_add_to_unchecked uri in + o,(CicUniv.merge_ugraphs ~base_ugraph ~increment:(u,uri(*,l*))) +;; + +let in_cache uri = + Cache.is_in_cooked uri || Cache.is_in_frozen uri || Cache.is_in_unchecked uri + +let add_type_checked_obj uri (obj,ugraph,univlist) = + Cache.add_cooked ~key:uri (obj,ugraph,univlist) + +let in_library uri = in_cache uri || Http_getter.exists' ~local:false uri + +let remove_obj = Cache.remove + +let list_uri () = + Cache.list_all_cooked_uris () +;; + +let list_obj () = + try + List.map (fun u -> + let o,ug = get_obj CicUniv.empty_ugraph u in + (u,o,ug)) + (list_uri ()) + with + Not_found -> + debug_print (lazy "Who has removed the uri in the meanwhile?"); + raise Not_found +;; diff --git a/components/cic_proof_checking/cicEnvironment.mli b/components/cic_proof_checking/cicEnvironment.mli new file mode 100644 index 000000000..55566a614 --- /dev/null +++ b/components/cic_proof_checking/cicEnvironment.mli @@ -0,0 +1,136 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(****************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 24/01/2000 *) +(* *) +(* This module implements a trival cache system (an hash-table) for cic *) +(* ^^^^^^ *) +(* objects. Uses the getter (getter.ml) and the parser (cicParser.ml) *) +(* *) +(****************************************************************************) + +exception CircularDependency of string Lazy.t;; +exception Object_not_found of UriManager.uri;; + +(* as the get cooked, but if not present the object is only fetched, + * not unfreezed and committed + *) +val get_obj : + CicUniv.universe_graph -> UriManager.uri -> + Cic.obj * CicUniv.universe_graph + +type type_checked_obj = + CheckedObj of (Cic.obj * CicUniv.universe_graph) (* cooked obj *) + | UncheckedObj of Cic.obj (* uncooked obj *) + +(* + * I think this should be the real semantic: + * + * val is_type_checked: + * ?trust:bool -> UriManager.uri -> bool + * + * but the old semantic is similar to get_cooked_obj, but + * returns an unchecked object intead of a Not_found + *) +val is_type_checked : + ?trust:bool -> CicUniv.universe_graph -> UriManager.uri -> + type_checked_obj + +(* set_type_checking_info uri *) +(* must be called once the type-checking of uri is finished *) +(* The object whose uri is uri is unfreezed and won't be type-checked *) +(* again in the future (is_type_checked will return true) *) +(* *) +(* Since the universes are not exported directly, but generated *) +(* typecheking the library, we can't find them in the library as we *) +(* do for the types. This means that when we commit uris during *) +(* univ generation we can't associate the uri with the universe graph *) +(* we find in the library, we have to calculate it and then inject it *) +(* in the cacke. This is an orrible backdoor used by univ_maker. *) +(* see the .ml file for some reassuring invariants *) +(* WARNING: THIS FUNCTION MUST BE CALLED ONLY BY CicTypeChecker *) +val set_type_checking_info : + ?replace_ugraph_and_univlist: + ((CicUniv.universe_graph * CicUniv.universe list) option) -> + UriManager.uri -> unit + +(* this function is called by CicTypeChecker.typecheck_obj to add to the *) +(* environment a new well typed object that is not yet in the library *) +(* WARNING: THIS FUNCTION MUST BE CALLED ONLY BY CicTypeChecker *) +val add_type_checked_obj : + UriManager.uri -> + (Cic.obj * CicUniv.universe_graph * CicUniv.universe list) -> unit + + (** remove a type checked object + * @raise Object_not_found when given term is not in the environment + * @raise Failure when remove_term is invoked while type checking *) +val remove_obj: UriManager.uri -> unit + +(* get_cooked_obj ~trust uri *) +(* returns the object if it is already type-checked or if it can be *) +(* trusted (if [trust] = true and the trusting function accepts it) *) +(* Otherwise it raises Not_found *) +val get_cooked_obj : + ?trust:bool -> CicUniv.universe_graph -> UriManager.uri -> + Cic.obj * CicUniv.universe_graph + +(* get_cooked_obj_with_univlist ~trust uri *) +(* returns the object if it is already type-checked or if it can be *) +(* trusted (if [trust] = true and the trusting function accepts it) *) +(* Otherwise it raises Not_found *) +val get_cooked_obj_with_univlist : + ?trust:bool -> CicUniv.universe_graph -> UriManager.uri -> + Cic.obj * CicUniv.universe_graph * CicUniv.universe list + +(* FUNCTIONS USED ONLY IN THE TOPLEVEL/PROOF-ENGINE *) + +(* (de)serialization *) +val dump_to_channel : ?callback:(string -> unit) -> out_channel -> unit +val restore_from_channel : ?callback:(string -> unit) -> in_channel -> unit +val empty : unit -> unit + +(** Set trust function. Per default this function is set to (fun _ -> true) *) +val set_trust: (UriManager.uri -> bool) -> unit + + (** @return true for objects currently cooked/frozend/unchecked, false + * otherwise (i.e. objects already parsed from XML) *) +val in_cache : UriManager.uri -> bool + +(* to debug the matitac batch compiler *) +val list_obj: unit -> (UriManager.uri * Cic.obj * CicUniv.universe_graph) list +val list_uri: unit -> UriManager.uri list + + (** @return true for objects available in the library *) +val in_library: UriManager.uri -> bool + + (** total parsing time, only to benchmark the parser *) +val total_parsing_time: float ref + +(* EOF *) diff --git a/components/cic_proof_checking/cicLogger.ml b/components/cic_proof_checking/cicLogger.ml new file mode 100644 index 000000000..5921c61b0 --- /dev/null +++ b/components/cic_proof_checking/cicLogger.ml @@ -0,0 +1,62 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +type msg = + [ `Start_type_checking of UriManager.uri + | `Type_checking_completed of UriManager.uri + | `Trusting of UriManager.uri + ] + +let log ?(level = 1) = + let module U = UriManager in + function + | `Start_type_checking uri -> + HelmLogger.log (`Msg (`DIV (level, None, `T + ("Type-Checking of " ^ (U.string_of_uri uri) ^ " started")))) + | `Type_checking_completed uri -> + HelmLogger.log (`Msg (`DIV (level, Some "green", `T + ("Type-Checking of " ^ (U.string_of_uri uri) ^ " completed")))) + | `Trusting uri -> + HelmLogger.log (`Msg (`DIV (level, Some "blue", `T + ((U.string_of_uri uri) ^ " is trusted.")))) + +class logger = + object + val mutable level = 0 (* indentation level *) + method log (msg: msg) = + match msg with + | `Start_type_checking _ -> + level <- level + 1; + log ~level msg + | `Type_checking_completed _ -> + log ~level msg; + level <- level - 1; + | _ -> log ~level msg + end + +let log msg = log ~level:1 msg + diff --git a/components/cic_proof_checking/cicLogger.mli b/components/cic_proof_checking/cicLogger.mli new file mode 100644 index 000000000..408bc8879 --- /dev/null +++ b/components/cic_proof_checking/cicLogger.mli @@ -0,0 +1,42 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type msg = + [ `Start_type_checking of UriManager.uri + | `Type_checking_completed of UriManager.uri + | `Trusting of UriManager.uri + ] + + (** Stateless logging. Each message is logged with indentation level 1 *) +val log: msg -> unit + + (** Stateful logging. Each `Start_type_checing message increase the + * indentation level by 1, each `Type_checking_completed message decrease it by + * the same amount. *) +class logger: + object + method log: msg -> unit + end + diff --git a/components/cic_proof_checking/cicMiniReduction.ml b/components/cic_proof_checking/cicMiniReduction.ml new file mode 100644 index 000000000..5c88713c5 --- /dev/null +++ b/components/cic_proof_checking/cicMiniReduction.ml @@ -0,0 +1,76 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +let rec letin_nf = + let module C = Cic in + function + C.Rel _ as t -> t + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,letin_nf t)) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta _ as t -> t + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (letin_nf te, letin_nf ty) + | C.Prod (n,s,t) -> C.Prod (n, letin_nf s, letin_nf t) + | C.Lambda (n,s,t) -> C.Lambda (n, letin_nf s, letin_nf t) + | C.LetIn (n,s,t) -> CicSubstitution.subst (letin_nf s) t + | C.Appl l -> C.Appl (List.map letin_nf l) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,letin_nf t)) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,typeno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,letin_nf t)) exp_named_subst + in + C.MutInd (uri,typeno,exp_named_subst') + | C.MutConstruct (uri,typeno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,letin_nf t)) exp_named_subst + in + C.MutConstruct (uri,typeno,consno,exp_named_subst') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,letin_nf outt, letin_nf t, List.map letin_nf pl) + | C.Fix (i,fl) -> + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> (name, i, letin_nf ty, letin_nf bo)) + fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let substitutedfl = + List.map + (fun (name,ty,bo) -> (name, letin_nf ty, letin_nf bo)) + fl + in + C.CoFix (i, substitutedfl) +;; diff --git a/components/cic_proof_checking/cicMiniReduction.mli b/components/cic_proof_checking/cicMiniReduction.mli new file mode 100644 index 000000000..c923c6acf --- /dev/null +++ b/components/cic_proof_checking/cicMiniReduction.mli @@ -0,0 +1,26 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val letin_nf : Cic.term -> Cic.term diff --git a/components/cic_proof_checking/cicPp.ml b/components/cic_proof_checking/cicPp.ml new file mode 100644 index 000000000..8c37c0f93 --- /dev/null +++ b/components/cic_proof_checking/cicPp.ml @@ -0,0 +1,535 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*****************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* This module implements a very simple Coq-like pretty printer that, given *) +(* an object of cic (internal representation) returns a string describing *) +(* the object in a syntax similar to that of coq *) +(* *) +(* It also contains the utility functions to check a name w.r.t the Matita *) +(* naming policy *) +(* *) +(*****************************************************************************) + +(* $Id$ *) + +exception CicPpInternalError;; +exception NotEnoughElements;; + +(* Utility functions *) + +let ppname = + function + Cic.Name s -> s + | Cic.Anonymous -> "_" +;; + +(* get_nth l n returns the nth element of the list l if it exists or *) +(* raises NotEnoughElements if l has less than n elements *) +let rec get_nth l n = + match (n,l) with + (1, he::_) -> he + | (n, he::tail) when n > 1 -> get_nth tail (n-1) + | (_,_) -> raise NotEnoughElements +;; + +(* pp t l *) +(* pretty-prints a term t of cic in an environment l where l is a list of *) +(* identifier names used to resolve DeBrujin indexes. The head of l is the *) +(* name associated to the greatest DeBrujin index in t *) +let pp ?metasenv = +let rec pp t l = + let module C = Cic in + match t with + C.Rel n -> + begin + try + (match get_nth l n with + Some (C.Name s) -> s + | Some C.Anonymous -> "__" ^ string_of_int n + | None -> "_hidden_" ^ string_of_int n + ) + with + NotEnoughElements -> string_of_int (List.length l - n) + end + | C.Var (uri,exp_named_subst) -> + UriManager.string_of_uri (*UriManager.name_of_uri*) uri ^ pp_exp_named_subst exp_named_subst l + | C.Meta (n,l1) -> + (match metasenv with + None -> + "?" ^ (string_of_int n) ^ "[" ^ + String.concat " ; " + (List.rev_map (function None -> "_" | Some t -> pp t l) l1) ^ + "]" + | Some metasenv -> + try + let _,context,_ = CicUtil.lookup_meta n metasenv in + "?" ^ (string_of_int n) ^ "[" ^ + String.concat " ; " + (List.rev + (List.map2 + (fun x y -> + match x,y with + _, None + | None, _ -> "_" + | Some _, Some t -> pp t l + ) context l1)) ^ + "]" + with + CicUtil.Meta_not_found _ + | Invalid_argument _ -> + "???" ^ (string_of_int n) ^ "[" ^ + String.concat " ; " + (List.rev_map (function None -> "_" | Some t -> pp t l) l1) ^ + "]" + ) + | C.Sort s -> + (match s with + C.Prop -> "Prop" + | C.Set -> "Set" + | C.Type _ -> "Type" + (*| C.Type u -> ("Type" ^ CicUniv.string_of_universe u)*) + | C.CProp -> "CProp" + ) + | C.Implicit (Some `Hole) -> "%" + | C.Implicit _ -> "?" + | C.Prod (b,s,t) -> + (match b with + C.Name n -> "(\\forall " ^ n ^ ":" ^ pp s l ^ "." ^ pp t ((Some b)::l) ^ ")" + | C.Anonymous -> "(" ^ pp s l ^ "\\to " ^ pp t ((Some b)::l) ^ ")" + ) + | C.Cast (v,t) -> "(" ^ pp v l ^ ":" ^ pp t l ^ ")" + | C.Lambda (b,s,t) -> + "(\\lambda " ^ ppname b ^ ":" ^ pp s l ^ "." ^ pp t ((Some b)::l) ^ ")" + | C.LetIn (b,s,t) -> + " let " ^ ppname b ^ " \\def " ^ pp s l ^ " in " ^ pp t ((Some b)::l) + | C.Appl li -> + "(" ^ + (List.fold_right + (fun x i -> pp x l ^ (match i with "" -> "" | _ -> " ") ^ i) + li "" + ) ^ ")" + | C.Const (uri,exp_named_subst) -> + UriManager.name_of_uri uri ^ pp_exp_named_subst exp_named_subst l + | C.MutInd (uri,n,exp_named_subst) -> + (try + match fst(CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + C.InductiveDefinition (dl,_,_,_) -> + let (name,_,_,_) = get_nth dl (n+1) in + name ^ pp_exp_named_subst exp_named_subst l + | _ -> raise CicPpInternalError + with + Sys.Break as exn -> raise exn + | _ -> UriManager.string_of_uri uri ^ "#1/" ^ string_of_int (n + 1) + ) + | C.MutConstruct (uri,n1,n2,exp_named_subst) -> + (try + match fst(CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + C.InductiveDefinition (dl,_,_,_) -> + let (_,_,_,cons) = get_nth dl (n1+1) in + let (id,_) = get_nth cons n2 in + id ^ pp_exp_named_subst exp_named_subst l + | _ -> raise CicPpInternalError + with + Sys.Break as exn -> raise exn + | _ -> + UriManager.string_of_uri uri ^ "#1/" ^ string_of_int (n1 + 1) ^ "/" ^ + string_of_int n2 + ) + | C.MutCase (uri,n1,ty,te,patterns) -> + let connames_and_argsno = + (match fst(CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + C.InductiveDefinition (dl,_,paramsno,_) -> + let (_,_,_,cons) = get_nth dl (n1+1) in + List.map + (fun (id,ty) -> + (* this is just an approximation since we do not have + reduction yet! *) + let rec count_prods toskip = + function + C.Prod (_,_,bo) when toskip > 0 -> + count_prods (toskip - 1) bo + | C.Prod (_,_,bo) -> 1 + count_prods 0 bo + | _ -> 0 + in + id, count_prods paramsno ty + ) cons + | _ -> raise CicPpInternalError + ) + in + let connames_and_argsno_and_patterns = + let rec combine = + function + [],[] -> [] + | [],l -> List.map (fun x -> "???",0,Some x) l + | l,[] -> List.map (fun (x,no) -> x,no,None) l + | (x,no)::tlx,y::tly -> (x,no,Some y)::(combine (tlx,tly)) + in + combine (connames_and_argsno,patterns) + in + "\nmatch " ^ pp te l ^ " return " ^ pp ty l ^ " with \n [ " ^ + (String.concat "\n | " + (List.map + (fun (x,argsno,y) -> + let rec aux argsno l = + function + Cic.Lambda (name,ty,bo) when argsno > 0 -> + let args,res = aux (argsno - 1) (Some name::l) bo in + ("(" ^ (match name with C.Anonymous -> "_" | C.Name s -> s)^ + ":" ^ pp ty l ^ ")")::args, res + | t when argsno = 0 -> [],pp t l + | t -> ["{" ^ string_of_int argsno ^ " args missing}"],pp t l + in + let pattern,body = + match y with + None -> x,"" + | Some y when argsno = 0 -> x,pp y l + | Some y -> + let args,body = aux argsno l y in + "(" ^ x ^ " " ^ String.concat " " args ^ ")",body + in + pattern ^ " => " ^ body + ) connames_and_argsno_and_patterns)) ^ + "\n]" + | C.Fix (no, funs) -> + let snames = List.map (fun (name,_,_,_) -> name) funs in + let names = + List.rev (List.map (function name -> Some (C.Name name)) snames) + in + "\nFix " ^ get_nth snames (no + 1) ^ " {" ^ + List.fold_right + (fun (name,ind,ty,bo) i -> "\n" ^ name ^ " / " ^ string_of_int ind ^ + " : " ^ pp ty l ^ " := \n" ^ + pp bo (names@l) ^ i) + funs "" ^ + "}\n" + | C.CoFix (no,funs) -> + let snames = List.map (fun (name,_,_) -> name) funs in + let names = + List.rev (List.map (function name -> Some (C.Name name)) snames) + in + "\nCoFix " ^ get_nth snames (no + 1) ^ " {" ^ + List.fold_right + (fun (name,ty,bo) i -> "\n" ^ name ^ + " : " ^ pp ty l ^ " := \n" ^ + pp bo (names@l) ^ i) + funs "" ^ + "}\n" +and pp_exp_named_subst exp_named_subst l = + if exp_named_subst = [] then "" else + "\\subst[" ^ + String.concat " ; " ( + List.map + (function (uri,t) -> UriManager.name_of_uri uri ^ " \\Assign " ^ pp t l) + exp_named_subst + ) ^ "]" +in + pp +;; + +let ppterm ?metasenv t = + pp ?metasenv t [] +;; + +(* ppinductiveType (typename, inductive, arity, cons) *) +(* pretty-prints a single inductive definition *) +(* (typename, inductive, arity, cons) *) +let ppinductiveType (typename, inductive, arity, cons) = + (if inductive then "\nInductive " else "\nCoInductive ") ^ typename ^ ": " ^ + pp arity [] ^ " =\n " ^ + List.fold_right + (fun (id,ty) i -> id ^ " : " ^ pp ty [] ^ + (if i = "" then "\n" else "\n | ") ^ i) + cons "" +;; + +let ppcontext ?metasenv ?(sep = "\n") context = + let separate s = if s = "" then "" else s ^ sep in + fst (List.fold_right + (fun context_entry (i,name_context) -> + match context_entry with + Some (n,Cic.Decl t) -> + Printf.sprintf "%s%s : %s" (separate i) (ppname n) + (pp ?metasenv t name_context), (Some n)::name_context + | Some (n,Cic.Def (bo,ty)) -> + Printf.sprintf "%s%s : %s := %s" (separate i) (ppname n) + (match ty with + None -> "_" + | Some ty -> pp ?metasenv ty name_context) + (pp ?metasenv bo name_context), (Some n)::name_context + | None -> + Printf.sprintf "%s_ :? _" (separate i), None::name_context + ) context ("",[])) + +(* ppobj obj returns a string with describing the cic object obj in a syntax *) +(* similar to the one used by Coq *) +let ppobj obj = + let module C = Cic in + let module U = UriManager in + match obj with + C.Constant (name, Some t1, t2, params, _) -> + "Definition of " ^ name ^ + "(" ^ String.concat ";" (List.map UriManager.string_of_uri params) ^ + ")" ^ ":\n" ^ pp t1 [] ^ " : " ^ pp t2 [] + | C.Constant (name, None, ty, params, _) -> + "Axiom " ^ name ^ + "(" ^ String.concat ";" (List.map UriManager.string_of_uri params) ^ + "):\n" ^ pp ty [] + | C.Variable (name, bo, ty, params, _) -> + "Variable " ^ name ^ + "(" ^ String.concat ";" (List.map UriManager.string_of_uri params) ^ + ")" ^ ":\n" ^ + pp ty [] ^ "\n" ^ + (match bo with None -> "" | Some bo -> ":= " ^ pp bo []) + | C.CurrentProof (name, conjectures, value, ty, params, _) -> + "Current Proof of " ^ name ^ + "(" ^ String.concat ";" (List.map UriManager.string_of_uri params) ^ + ")" ^ ":\n" ^ + let separate s = if s = "" then "" else s ^ " ; " in + List.fold_right + (fun (n, context, t) i -> + let conjectures',name_context = + List.fold_right + (fun context_entry (i,name_context) -> + (match context_entry with + Some (n,C.Decl at) -> + (separate i) ^ + ppname n ^ ":" ^ + pp ~metasenv:conjectures at name_context ^ " ", + (Some n)::name_context + | Some (n,C.Def (at,None)) -> + (separate i) ^ + ppname n ^ ":= " ^ pp ~metasenv:conjectures + at name_context ^ " ", + (Some n)::name_context + | None -> + (separate i) ^ "_ :? _ ", None::name_context + | _ -> assert false) + ) context ("",[]) + in + conjectures' ^ " |- " ^ "?" ^ (string_of_int n) ^ ": " ^ + pp ~metasenv:conjectures t name_context ^ "\n" ^ i + ) conjectures "" ^ + "\n" ^ pp ~metasenv:conjectures value [] ^ " : " ^ + pp ~metasenv:conjectures ty [] + | C.InductiveDefinition (l, params, nparams, _) -> + "Parameters = " ^ + String.concat ";" (List.map UriManager.string_of_uri params) ^ "\n" ^ + "NParams = " ^ string_of_int nparams ^ "\n" ^ + List.fold_right (fun x i -> ppinductiveType x ^ i) l "" +;; + +let ppsort = function + | Cic.Prop -> "Prop" + | Cic.Set -> "Set" + | Cic.Type _ -> "Type" + | Cic.CProp -> "CProp" + + +(* MATITA NAMING CONVENTION *) + +let is_prefix prefix string = + let len = String.length prefix in + let len1 = String.length string in + if len <= len1 then + begin + let head = String.sub string 0 len in + if + (String.compare (String.lowercase head) (String.lowercase prefix)=0) then + begin + let diff = len1-len in + let tail = String.sub string len diff in + if ((diff > 0) && (String.rcontains_from tail 0 '_')) then + Some (String.sub tail 1 (diff-1)) + else Some tail + end + else None + end + else None + +let remove_prefix prefix (last,string) = + if string = "" then (last,string) + else + match is_prefix prefix string with + None -> + if last <> "" then + match is_prefix last prefix with + None -> (last,string) + | Some _ -> + (match is_prefix prefix (last^string) with + None -> (last,string) + | Some tail -> (prefix,tail)) + else (last,string) + | Some tail -> (prefix, tail) + +let legal_suffix string = + if string = "" then true else + begin + let legal_s = Str.regexp "_?\\([0-9]+\\|r\\|l\\|'\\|\"\\)" in + (Str.string_match legal_s string 0) && (Str.matched_string string = string) + end + +(** check if a prefix of string_name is legal for term and returns the tail. + chec_rec cannot fail: at worst it return string_name. + The algorithm is greedy, but last contains the last name matched, providing + a one slot buffer. + string_name is here a pair (last,string_name).*) + +let rec check_rec ctx string_name = + function + | Cic.Rel m -> + (match List.nth ctx (m-1) with + Cic.Name name -> + remove_prefix name string_name + | Cic.Anonymous -> string_name) + | Cic.Meta _ -> string_name + | Cic.Sort sort -> remove_prefix (ppsort sort) string_name + | Cic.Implicit _ -> string_name + | Cic.Cast (te,ty) -> check_rec ctx string_name te + | Cic.Prod (name,so,dest) -> + let l_string_name = check_rec ctx string_name so in + check_rec (name::ctx) string_name dest + | Cic.Lambda (name,so,dest) -> + let string_name = + match name with + Cic.Anonymous -> string_name + | Cic.Name name -> remove_prefix name string_name in + let l_string_name = check_rec ctx string_name so in + check_rec (name::ctx) l_string_name dest + | Cic.LetIn (name,so,dest) -> + let string_name = check_rec ctx string_name so in + check_rec (name::ctx) string_name dest + | Cic.Appl l -> + List.fold_left (check_rec ctx) string_name l + | Cic.Var (uri,exp_named_subst) -> + let name = UriManager.name_of_uri uri in + remove_prefix name string_name + | Cic.Const (uri,exp_named_subst) -> + let name = UriManager.name_of_uri uri in + remove_prefix name string_name + | Cic.MutInd (uri,_,exp_named_subst) -> + let name = UriManager.name_of_uri uri in + remove_prefix name string_name + | Cic.MutConstruct (uri,n,m,exp_named_subst) -> + let name = + (match fst(CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + Cic.InductiveDefinition (dl,_,_,_) -> + let (_,_,_,cons) = get_nth dl (n+1) in + let (id,_) = get_nth cons m in + id + | _ -> assert false) in + remove_prefix name string_name + | Cic.MutCase (_,_,_,te,pl) -> + let string_name = remove_prefix "match" string_name in + let string_name = check_rec ctx string_name te in + List.fold_right (fun t s -> check_rec ctx s t) pl string_name + | Cic.Fix (_,fl) -> + let string_name = remove_prefix "fix" string_name in + let names = List.map (fun (name,_,_,_) -> name) fl in + let onames = + List.rev (List.map (function name -> Cic.Name name) names) + in + List.fold_right + (fun (_,_,_,bo) s -> check_rec (onames@ctx) s bo) fl string_name + | Cic.CoFix (_,fl) -> + let string_name = remove_prefix "cofix" string_name in + let names = List.map (fun (name,_,_) -> name) fl in + let onames = + List.rev (List.map (function name -> Cic.Name name) names) + in + List.fold_right + (fun (_,_,bo) s -> check_rec (onames@ctx) s bo) fl string_name + +let check_name ?(allow_suffix=false) ctx name term = + let (_,tail) = check_rec ctx ("",name) term in + if (not allow_suffix) then (String.length tail = 0) + else legal_suffix tail + +let check_elim ctx conclusion_name = + let elim = Str.regexp "_elim\\|_case" in + if (Str.string_match elim conclusion_name 0) then + let len = String.length conclusion_name in + let tail = String.sub conclusion_name 5 (len-5) in + legal_suffix tail + else false + +let rec check_names ctx hyp_names conclusion_name t = + match t with + | Cic.Prod (name,s,t) -> + (match hyp_names with + [] -> check_names (name::ctx) hyp_names conclusion_name t + | hd::tl -> + if check_name ctx hd s then + check_names (name::ctx) tl conclusion_name t + else + check_names (name::ctx) hyp_names conclusion_name t) + | Cic.Appl ((Cic.Rel n)::args) -> + (match hyp_names with + | [] -> + (check_name ~allow_suffix:true ctx conclusion_name t) || + (check_elim ctx conclusion_name) + | [what_to_elim] -> + (* what to elim could be an argument + of the predicate: e.g. leb_elim *) + let (last,tail) = + List.fold_left (check_rec ctx) ("",what_to_elim) args in + (tail = "" && check_elim ctx conclusion_name) + | _ -> false) + | Cic.MutCase (_,_,Cic.Lambda(name,so,ty),te,_) -> + (match hyp_names with + | [] -> + (match is_prefix "match" conclusion_name with + None -> check_name ~allow_suffix:true ctx conclusion_name t + | Some tail -> check_name ~allow_suffix:true ctx tail t) + | [what_to_match] -> + (* what to match could be the term te or its type so; in this case the + conclusion name should match ty *) + check_name ~allow_suffix:true (name::ctx) conclusion_name ty && + (check_name ctx what_to_match te || check_name ctx what_to_match so) + | _ -> false) + | _ -> + hyp_names=[] && check_name ~allow_suffix:true ctx conclusion_name t + +let check name term = + let names = Str.split (Str.regexp_string "_to_") name in + let hyp_names,conclusion_name = + match List.rev names with + [] -> assert false + | hd::tl -> + let elim = Str.regexp "_elim\\|_case" in + let len = String.length hd in + try + let pos = Str.search_backward elim hd len in + let hyp = String.sub hd 0 pos in + let concl = String.sub hd pos (len-pos) in + List.rev (hyp::tl),concl + with Not_found -> (List.rev tl),hd in + check_names [] hyp_names conclusion_name term +;; + + diff --git a/components/cic_proof_checking/cicPp.mli b/components/cic_proof_checking/cicPp.mli new file mode 100644 index 000000000..e898c352d --- /dev/null +++ b/components/cic_proof_checking/cicPp.mli @@ -0,0 +1,55 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*****************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 24/01/2000 *) +(* *) +(* This module implements a very simple Coq-like pretty printer that, given *) +(* an object of cic (internal representation) returns a string describing the*) +(* object in a syntax similar to that of coq *) +(* *) +(*****************************************************************************) + +(* ppobj obj returns a string with describing the cic object obj in a syntax*) +(* similar to the one used by Coq *) +val ppobj : Cic.obj -> string + +val ppterm : ?metasenv:Cic.metasenv -> Cic.term -> string + +val ppcontext : ?metasenv:Cic.metasenv -> ?sep:string -> Cic.context -> string + +(* Required only by the topLevel. It is the generalization of ppterm to *) +(* work with environments. *) +val pp : ?metasenv:Cic.metasenv -> Cic.term -> (Cic.name option) list -> string + +val ppname : Cic.name -> string + +val ppsort: Cic.sort -> string + +val check: string -> Cic.term -> bool diff --git a/components/cic_proof_checking/cicReduction.ml b/components/cic_proof_checking/cicReduction.ml new file mode 100644 index 000000000..7f1ec5835 --- /dev/null +++ b/components/cic_proof_checking/cicReduction.ml @@ -0,0 +1,1255 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(* TODO unify exceptions *) + +exception WrongUriToInductiveDefinition;; +exception Impossible of int;; +exception ReferenceToConstant;; +exception ReferenceToVariable;; +exception ReferenceToCurrentProof;; +exception ReferenceToInductiveDefinition;; + +let debug = false +let profile = false +let debug_print s = if debug then prerr_endline (Lazy.force s) + +let fdebug = ref 1;; +let debug t env s = + let rec debug_aux t i = + let module C = Cic in + let module U = UriManager in + CicPp.ppobj (C.Variable ("DEBUG", None, t, [], [])) ^ "\n" ^ i + in + if !fdebug = 0 then + debug_print (lazy (s ^ "\n" ^ List.fold_right debug_aux (t::env) "")) +;; + +module type Strategy = + sig + type stack_term + type env_term + type ens_term + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + val to_env : + reduce: (config -> config) -> + unwind: (config -> Cic.term) -> + config -> env_term + val to_ens : + reduce: (config -> config) -> + unwind: (config -> Cic.term) -> + config -> ens_term + val from_stack : stack_term -> config + val from_stack_list_for_unwind : + unwind: (config -> Cic.term) -> + stack_term list -> Cic.term list + val from_env : env_term -> config + val from_env_for_unwind : + unwind: (config -> Cic.term) -> + env_term -> Cic.term + val from_ens : ens_term -> config + val from_ens_for_unwind : + unwind: (config -> Cic.term) -> + ens_term -> Cic.term + val stack_to_env : + reduce: (config -> config) -> + unwind: (config -> Cic.term) -> + stack_term -> env_term + val compute_to_env : + reduce: (config -> config) -> + unwind: (config -> Cic.term) -> + int -> env_term list -> ens_term Cic.explicit_named_substitution -> + Cic.term -> env_term + val compute_to_stack : + reduce: (config -> config) -> + unwind: (config -> Cic.term) -> + config -> stack_term + end +;; + +module CallByValueByNameForUnwind = + struct + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + and stack_term = config + and env_term = config * config (* cbv, cbn *) + and ens_term = config * config (* cbv, cbn *) + + let to_env c = c,c + let to_ens c = c,c + let from_stack config = config + let from_stack_list_for_unwind ~unwind l = List.map unwind l + let from_env (c,_) = c + let from_ens (c,_) = c + let from_env_for_unwind ~unwind (_,c) = unwind c + let from_ens_for_unwind ~unwind (_,c) = unwind c + let stack_to_env ~reduce ~unwind config = reduce config, (0,[],[],unwind config,[]) + let compute_to_env ~reduce ~unwind k e ens t = (k,e,ens,t,[]), (k,e,ens,t,[]) + let compute_to_stack ~reduce ~unwind config = config + end +;; + +module CallByValueByNameForUnwind' = + struct + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + and stack_term = config lazy_t * Cic.term lazy_t (* cbv, cbn *) + and env_term = config lazy_t * Cic.term lazy_t (* cbv, cbn *) + and ens_term = config lazy_t * Cic.term lazy_t (* cbv, cbn *) + + let to_env ~reduce ~unwind c = lazy (reduce c),lazy (unwind c) + let to_ens ~reduce ~unwind c = lazy (reduce c),lazy (unwind c) + let from_stack (c,_) = Lazy.force c + let from_stack_list_for_unwind ~unwind l = List.map (function (_,c) -> Lazy.force c) l + let from_env (c,_) = Lazy.force c + let from_ens (c,_) = Lazy.force c + let from_env_for_unwind ~unwind (_,c) = Lazy.force c + let from_ens_for_unwind ~unwind (_,c) = Lazy.force c + let stack_to_env ~reduce ~unwind config = config + let compute_to_env ~reduce ~unwind k e ens t = + lazy (reduce (k,e,ens,t,[])), lazy (unwind (k,e,ens,t,[])) + let compute_to_stack ~reduce ~unwind config = lazy (reduce config), lazy (unwind config) + end +;; + + +(* Old Machine +module CallByNameStrategy = + struct + type stack_term = Cic.term + type env_term = Cic.term + type ens_term = Cic.term + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + let to_env v = v + let to_ens v = v + let from_stack ~unwind v = v + let from_stack_list ~unwind l = l + let from_env v = v + let from_ens v = v + let from_env_for_unwind ~unwind v = v + let from_ens_for_unwind ~unwind v = v + let stack_to_env ~reduce ~unwind v = v + let compute_to_stack ~reduce ~unwind k e ens t = unwind k e ens t + let compute_to_env ~reduce ~unwind k e ens t = unwind k e ens t + end +;; +*) + +module CallByNameStrategy = + struct + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + and stack_term = config + and env_term = config + and ens_term = config + + let to_env c = c + let to_ens c = c + let from_stack config = config + let from_stack_list_for_unwind ~unwind l = List.map unwind l + let from_env c = c + let from_ens c = c + let from_env_for_unwind ~unwind c = unwind c + let from_ens_for_unwind ~unwind c = unwind c + let stack_to_env ~reduce ~unwind config = 0,[],[],unwind config,[] + let compute_to_env ~reduce ~unwind k e ens t = k,e,ens,t,[] + let compute_to_stack ~reduce ~unwind config = config + end +;; + +module CallByValueStrategy = + struct + type stack_term = Cic.term + type env_term = Cic.term + type ens_term = Cic.term + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + let to_env v = v + let to_ens v = v + let from_stack ~unwind v = v + let from_stack_list ~unwind l = l + let from_env v = v + let from_ens v = v + let from_env_for_unwind ~unwind v = v + let from_ens_for_unwind ~unwind v = v + let stack_to_env ~reduce ~unwind v = v + let compute_to_stack ~reduce ~unwind k e ens t = reduce (k,e,ens,t,[]) + let compute_to_env ~reduce ~unwind k e ens t = reduce (k,e,ens,t,[]) + end +;; + +module CallByValueStrategyByNameOnConstants = + struct + type stack_term = Cic.term + type env_term = Cic.term + type ens_term = Cic.term + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + let to_env v = v + let to_ens v = v + let from_stack ~unwind v = v + let from_stack_list ~unwind l = l + let from_env v = v + let from_ens v = v + let from_env_for_unwind ~unwind v = v + let from_ens_for_unwind ~unwind v = v + let stack_to_env ~reduce ~unwind v = v + let compute_to_stack ~reduce ~unwind k e ens = + function + Cic.Const _ as t -> unwind k e ens t + | t -> reduce (k,e,ens,t,[]) + let compute_to_env ~reduce ~unwind k e ens = + function + Cic.Const _ as t -> unwind k e ens t + | t -> reduce (k,e,ens,t,[]) + end +;; + +module LazyCallByValueStrategy = + struct + type stack_term = Cic.term lazy_t + type env_term = Cic.term lazy_t + type ens_term = Cic.term lazy_t + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + let to_env v = lazy v + let to_ens v = lazy v + let from_stack ~unwind v = Lazy.force v + let from_stack_list ~unwind l = List.map (from_stack ~unwind) l + let from_env v = Lazy.force v + let from_ens v = Lazy.force v + let from_env_for_unwind ~unwind v = Lazy.force v + let from_ens_for_unwind ~unwind v = Lazy.force v + let stack_to_env ~reduce ~unwind v = v + let compute_to_stack ~reduce ~unwind k e ens t = lazy (reduce (k,e,ens,t,[])) + let compute_to_env ~reduce ~unwind k e ens t = lazy (reduce (k,e,ens,t,[])) + end +;; + +module LazyCallByValueStrategyByNameOnConstants = + struct + type stack_term = Cic.term lazy_t + type env_term = Cic.term lazy_t + type ens_term = Cic.term lazy_t + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + let to_env v = lazy v + let to_ens v = lazy v + let from_stack ~unwind v = Lazy.force v + let from_stack_list ~unwind l = List.map (from_stack ~unwind) l + let from_env v = Lazy.force v + let from_ens v = Lazy.force v + let from_env_for_unwind ~unwind v = Lazy.force v + let from_ens_for_unwind ~unwind v = Lazy.force v + let stack_to_env ~reduce ~unwind v = v + let compute_to_stack ~reduce ~unwind k e ens t = + lazy ( + match t with + Cic.Const _ as t -> unwind k e ens t + | t -> reduce (k,e,ens,t,[])) + let compute_to_env ~reduce ~unwind k e ens t = + lazy ( + match t with + Cic.Const _ as t -> unwind k e ens t + | t -> reduce (k,e,ens,t,[])) + end +;; + +module LazyCallByNameStrategy = + struct + type stack_term = Cic.term lazy_t + type env_term = Cic.term lazy_t + type ens_term = Cic.term lazy_t + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + let to_env v = lazy v + let to_ens v = lazy v + let from_stack ~unwind v = Lazy.force v + let from_stack_list ~unwind l = List.map (from_stack ~unwind) l + let from_env v = Lazy.force v + let from_ens v = Lazy.force v + let from_env_for_unwind ~unwind v = Lazy.force v + let from_ens_for_unwind ~unwind v = Lazy.force v + let stack_to_env ~reduce ~unwind v = v + let compute_to_stack ~reduce ~unwind k e ens t = lazy (unwind k e ens t) + let compute_to_env ~reduce ~unwind k e ens t = lazy (unwind k e ens t) + end +;; + +module + LazyCallByValueByNameOnConstantsWhenFromStack_ByNameStrategyWhenFromEnvOrEns += + struct + type stack_term = reduce:bool -> Cic.term + type env_term = reduce:bool -> Cic.term + type ens_term = reduce:bool -> Cic.term + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + let to_env v = + let value = lazy v in + fun ~reduce -> Lazy.force value + let to_ens v = + let value = lazy v in + fun ~reduce -> Lazy.force value + let from_stack ~unwind v = (v ~reduce:false) + let from_stack_list ~unwind l = List.map (from_stack ~unwind) l + let from_env v = (v ~reduce:true) + let from_ens v = (v ~reduce:true) + let from_env_for_unwind ~unwind v = (v ~reduce:true) + let from_ens_for_unwind ~unwind v = (v ~reduce:true) + let stack_to_env ~reduce ~unwind v = v + let compute_to_stack ~reduce ~unwind k e ens t = + let svalue = + lazy ( + match t with + Cic.Const _ as t -> unwind k e ens t + | t -> reduce (k,e,ens,t,[]) + ) in + let lvalue = + lazy (unwind k e ens t) + in + fun ~reduce -> + if reduce then Lazy.force svalue else Lazy.force lvalue + let compute_to_env ~reduce ~unwind k e ens t = + let svalue = + lazy ( + match t with + Cic.Const _ as t -> unwind k e ens t + | t -> reduce (k,e,ens,t,[]) + ) in + let lvalue = + lazy (unwind k e ens t) + in + fun ~reduce -> + if reduce then Lazy.force svalue else Lazy.force lvalue + end +;; + +module ClosuresOnStackByValueFromEnvOrEnsStrategy = + struct + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + and stack_term = config + and env_term = config + and ens_term = config + + let to_env config = config + let to_ens config = config + let from_stack config = config + let from_stack_list_for_unwind ~unwind l = List.map unwind l + let from_env v = v + let from_ens v = v + let from_env_for_unwind ~unwind config = unwind config + let from_ens_for_unwind ~unwind config = unwind config + let stack_to_env ~reduce ~unwind config = reduce config + let compute_to_env ~reduce ~unwind k e ens t = (k,e,ens,t,[]) + let compute_to_stack ~reduce ~unwind config = config + end +;; + +module ClosuresOnStackByValueFromEnvOrEnsByNameOnConstantsStrategy = + struct + type stack_term = + int * Cic.term list * Cic.term Cic.explicit_named_substitution * Cic.term + type env_term = Cic.term + type ens_term = Cic.term + type config = int * env_term list * ens_term Cic.explicit_named_substitution * Cic.term * stack_term list + let to_env v = v + let to_ens v = v + let from_stack ~unwind (k,e,ens,t) = unwind k e ens t + let from_stack_list ~unwind l = List.map (from_stack ~unwind) l + let from_env v = v + let from_ens v = v + let from_env_for_unwind ~unwind v = v + let from_ens_for_unwind ~unwind v = v + let stack_to_env ~reduce ~unwind (k,e,ens,t) = + match t with + Cic.Const _ as t -> unwind k e ens t + | t -> reduce (k,e,ens,t,[]) + let compute_to_env ~reduce ~unwind k e ens t = + unwind k e ens t + let compute_to_stack ~reduce ~unwind k e ens t = (k,e,ens,t) + end +;; + +module Reduction(RS : Strategy) = + struct + type env = RS.env_term list + type ens = RS.ens_term Cic.explicit_named_substitution + type stack = RS.stack_term list + type config = int * env * ens * Cic.term * stack + + (* k is the length of the environment e *) + (* m is the current depth inside the term *) + let rec unwind' m k e ens t = + let module C = Cic in + let module S = CicSubstitution in + if k = 0 && ens = [] then + t + else + let rec unwind_aux m = + function + C.Rel n as t -> + if n <= m then t else + let d = + try + Some (RS.from_env_for_unwind ~unwind (List.nth e (n-m-1))) + with Failure _ -> None + in + (match d with + Some t' -> + if m = 0 then t' else S.lift m t' + | None -> C.Rel (n-k) + ) + | C.Var (uri,exp_named_subst) -> +(* +debug_print (lazy ("%%%%%UWVAR " ^ String.concat " ; " (List.map (function (uri,t) -> UriManager.string_of_uri uri ^ " := " ^ CicPp.ppterm t) ens))) ; +*) + if List.exists (function (uri',_) -> UriManager.eq uri' uri) ens then + CicSubstitution.lift m (RS.from_ens_for_unwind ~unwind (List.assq uri ens)) + else + let params = + let o,_ = + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + in + (match o with + C.Constant _ -> raise ReferenceToConstant + | C.Variable (_,_,_,params,_) -> params + | C.CurrentProof _ -> raise ReferenceToCurrentProof + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + ) + in + let exp_named_subst' = + substaux_in_exp_named_subst params exp_named_subst m + in + C.Var (uri,exp_named_subst') + | C.Meta (i,l) -> + let l' = + List.map + (function + None -> None + | Some t -> Some (unwind_aux m t) + ) l + in + C.Meta (i, l') + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (unwind_aux m te, unwind_aux m ty) (*CSC ???*) + | C.Prod (n,s,t) -> C.Prod (n, unwind_aux m s, unwind_aux (m + 1) t) + | C.Lambda (n,s,t) -> C.Lambda (n, unwind_aux m s, unwind_aux (m + 1) t) + | C.LetIn (n,s,t) -> C.LetIn (n, unwind_aux m s, unwind_aux (m + 1) t) + | C.Appl l -> C.Appl (List.map (unwind_aux m) l) + | C.Const (uri,exp_named_subst) -> + let params = + let o,_ = + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + in + (match o with + C.Constant (_,_,_,params,_) -> params + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof (_,_,_,_,params,_) -> params + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + ) + in + let exp_named_subst' = + substaux_in_exp_named_subst params exp_named_subst m + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,i,exp_named_subst) -> + let params = + let o,_ = + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + in + (match o with + C.Constant _ -> raise ReferenceToConstant + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof _ -> raise ReferenceToCurrentProof + | C.InductiveDefinition (_,params,_,_) -> params + ) + in + let exp_named_subst' = + substaux_in_exp_named_subst params exp_named_subst m + in + C.MutInd (uri,i,exp_named_subst') + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let params = + let o,_ = + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + in + (match o with + C.Constant _ -> raise ReferenceToConstant + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof _ -> raise ReferenceToCurrentProof + | C.InductiveDefinition (_,params,_,_) -> params + ) + in + let exp_named_subst' = + substaux_in_exp_named_subst params exp_named_subst m + in + C.MutConstruct (uri,i,j,exp_named_subst') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,unwind_aux m outt, unwind_aux m t, + List.map (unwind_aux m) pl) + | C.Fix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> + (name, i, unwind_aux m ty, unwind_aux (m+len) bo)) + fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,ty,bo) -> (name, unwind_aux m ty, unwind_aux (m+len) bo)) + fl + in + C.CoFix (i, substitutedfl) + and substaux_in_exp_named_subst params exp_named_subst' m = + (*CSC: Idea di Andrea di ordinare compatibilmente con l'ordine dei params + let ens' = + List.map (function (uri,t) -> uri, unwind_aux m t) exp_named_subst' @ + (*CSC: qui liftiamo tutti gli ens anche se magari me ne servono la meta'!!! *) + List.map (function (uri,t) -> uri, CicSubstitution.lift m t) ens + in + let rec filter_and_lift = + function + [] -> [] + | uri::tl -> + let r = filter_and_lift tl in + (try + (uri,(List.assq uri ens'))::r + with + Not_found -> r + ) + in + filter_and_lift params + *) + + (*CSC: invece di concatenare sarebbe meglio rispettare l'ordine dei params *) + (*CSC: e' vero???? una veloce prova non sembra confermare la teoria *) + + (*CSC: codice copiato e modificato dalla cicSubstitution.subst_vars *) + (*CSC: codice altamente inefficiente *) + let rec filter_and_lift already_instantiated = + function + [] -> [] + | (uri,t)::tl when + List.for_all + (function (uri',_)-> not (UriManager.eq uri uri')) exp_named_subst' + && + not (List.mem uri already_instantiated) + && + List.mem uri params + -> + (uri,CicSubstitution.lift m (RS.from_ens_for_unwind ~unwind t)) :: + (filter_and_lift (uri::already_instantiated) tl) + | _::tl -> filter_and_lift already_instantiated tl +(* + | (uri,_)::tl -> +debug_print (lazy ("---- SKIPPO " ^ UriManager.string_of_uri uri)) ; +if List.for_all (function (uri',_) -> not (UriManager.eq uri uri')) +exp_named_subst' then debug_print (lazy "---- OK1") ; +debug_print (lazy ("++++ uri " ^ UriManager.string_of_uri uri ^ " not in " ^ String.concat " ; " (List.map UriManager.string_of_uri params))) ; +if List.mem uri params then debug_print (lazy "---- OK2") ; + filter_and_lift tl +*) + in + List.map (function (uri,t) -> uri, unwind_aux m t) exp_named_subst' @ + (filter_and_lift [] (List.rev ens)) + in + unwind_aux m t + + and unwind (k,e,ens,t,s) = + let t' = unwind' 0 k e ens t in + if s = [] then t' else Cic.Appl (t'::(RS.from_stack_list_for_unwind ~unwind s)) + ;; + +(* + let unwind = + let profiler_unwind = HExtlib.profile ~enable:profile "are_convertible.unwind" in + fun k e ens t -> + profiler_unwind.HExtlib.profile (unwind k e ens) t + ;; +*) + + let reduce ~delta ?(subst = []) context : config -> config = + let module C = Cic in + let module S = CicSubstitution in + let rec reduce = + function + (k, e, _, C.Rel n, s) as config -> + let config' = + try + Some (RS.from_env (List.nth e (n-1))) + with + Failure _ -> + try + begin + match List.nth context (n - 1 - k) with + None -> assert false + | Some (_,C.Decl _) -> None + | Some (_,C.Def (x,_)) -> Some (0,[],[],S.lift (n - k) x,[]) + end + with + Failure _ -> None + in + (match config' with + Some (k',e',ens',t',s') -> reduce (k',e',ens',t',s'@s) + | None -> config) + | (k, e, ens, C.Var (uri,exp_named_subst), s) as config -> + if List.exists (function (uri',_) -> UriManager.eq uri' uri) ens then + let (k',e',ens',t',s') = RS.from_ens (List.assq uri ens) in + reduce (k',e',ens',t',s'@s) + else + ( let o,_ = + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + in + match o with + C.Constant _ -> raise ReferenceToConstant + | C.CurrentProof _ -> raise ReferenceToCurrentProof + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + | C.Variable (_,None,_,_,_) -> config + | C.Variable (_,Some body,_,_,_) -> + let ens' = push_exp_named_subst k e ens exp_named_subst in + reduce (0, [], ens', body, s) + ) + | (k, e, ens, C.Meta (n,l), s) as config -> + (try + let (_, term,_) = CicUtil.lookup_subst n subst in + reduce (k, e, ens,CicSubstitution.subst_meta l term,s) + with CicUtil.Subst_not_found _ -> config) + | (_, _, _, C.Sort _, _) + | (_, _, _, C.Implicit _, _) as config -> config + | (k, e, ens, C.Cast (te,ty), s) -> + reduce (k, e, ens, te, s) + | (_, _, _, C.Prod _, _) as config -> config + | (_, _, _, C.Lambda _, []) as config -> config + | (k, e, ens, C.Lambda (_,_,t), p::s) -> + reduce (k+1, (RS.stack_to_env ~reduce ~unwind p)::e, ens, t,s) + | (k, e, ens, C.LetIn (_,m,t), s) -> + let m' = RS.compute_to_env ~reduce ~unwind k e ens m in + reduce (k+1, m'::e, ens, t, s) + | (_, _, _, C.Appl [], _) -> assert false + | (k, e, ens, C.Appl (he::tl), s) -> + let tl' = + List.map + (function t -> RS.compute_to_stack ~reduce ~unwind (k,e,ens,t,[])) tl + in + reduce (k, e, ens, he, (List.append tl') s) + | (_, _, _, C.Const _, _) as config when delta=false-> config + | (k, e, ens, C.Const (uri,exp_named_subst), s) as config -> + (let o,_ = + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + in + match o with + C.Constant (_,Some body,_,_,_) -> + let ens' = push_exp_named_subst k e ens exp_named_subst in + (* constants are closed *) + reduce (0, [], ens', body, s) + | C.Constant (_,None,_,_,_) -> config + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof (_,_,body,_,_,_) -> + let ens' = push_exp_named_subst k e ens exp_named_subst in + (* constants are closed *) + reduce (0, [], ens', body, s) + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + ) + | (_, _, _, C.MutInd _, _) + | (_, _, _, C.MutConstruct _, _) as config -> config + | (k, e, ens, C.MutCase (mutind,i,outty,term,pl),s) as config -> + let decofix = + function + (k, e, ens, C.CoFix (i,fl), s) -> + let (_,_,body) = List.nth fl i in + let body' = + let counter = ref (List.length fl) in + List.fold_right + (fun _ -> decr counter ; S.subst (C.CoFix (!counter,fl))) + fl + body + in + reduce (k,e,ens,body',s) + | config -> config + in + (match decofix (reduce (k,e,ens,term,[])) with + (k', e', ens', C.MutConstruct (_,_,j,_), []) -> + reduce (k, e, ens, (List.nth pl (j-1)), s) + | (k', e', ens', C.MutConstruct (_,_,j,_), s') -> + let r = + let o,_ = + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph mutind + in + match o with + C.InductiveDefinition (_,_,r,_) -> r + | _ -> raise WrongUriToInductiveDefinition + in + let ts = + let num_to_eat = r in + let rec eat_first = + function + (0,l) -> l + | (n,he::s) when n > 0 -> eat_first (n - 1, s) + | _ -> raise (Impossible 5) + in + eat_first (num_to_eat,s') + in + reduce (k, e, ens, (List.nth pl (j-1)), ts@s) + | (_, _, _, C.Cast _, _) + | (_, _, _, C.Implicit _, _) -> + raise (Impossible 2) (* we don't trust our whd ;-) *) + | config' -> + (*CSC: here I am unwinding the configuration and for sure I + will do it twice; to avoid this unwinding I should push the + "match [] with _" continuation on the stack; + another possibility is to just return the original configuration, + partially undoing the weak-head computation *) + (*this code is uncorrect since term' lives in e' <> e + let term' = unwind config' in + (k, e, ens, C.MutCase (mutind,i,outty,term',pl),s) + *) + config) + | (k, e, ens, C.Fix (i,fl), s) as config -> + let (_,recindex,_,body) = List.nth fl i in + let recparam = + try + Some (RS.from_stack (List.nth s recindex)) + with + Failure _ -> None + in + (match recparam with + Some recparam -> + (match reduce recparam with + (_,_,_,C.MutConstruct _,_) as config -> + let leng = List.length fl in + let new_env = + let counter = ref 0 in + let rec build_env e' = + if !counter = leng then e' + else + (incr counter ; + build_env + ((RS.to_env ~reduce ~unwind (k,e,ens,C.Fix (!counter -1, fl),[]))::e')) + in + build_env e + in + let rec replace i s t = + match i,s with + 0,_::tl -> t::tl + | n,he::tl -> he::(replace (n - 1) tl t) + | _,_ -> assert false in + let new_s = + replace recindex s (RS.compute_to_stack ~reduce ~unwind config) + in + reduce (k+leng, new_env, ens, body, new_s) + | _ -> config) + | None -> config + ) + | (_,_,_,C.CoFix _,_) as config -> config + and push_exp_named_subst k e ens = + function + [] -> ens + | (uri,t)::tl -> + push_exp_named_subst k e ((uri,RS.to_ens ~reduce ~unwind (k,e,ens,t,[]))::ens) tl + in + reduce + ;; + + let whd ?(delta=true) ?(subst=[]) context t = + unwind (reduce ~delta ~subst context (0, [], [], t, [])) + ;; + + end +;; + + +(* ROTTO = rompe l'unificazione poiche' riduce gli argomenti di un'applicazione + senza ridurre la testa +module R = Reduction CallByNameStrategy;; OK 56.368s +module R = Reduction CallByValueStrategy;; ROTTO +module R = Reduction CallByValueStrategyByNameOnConstants;; ROTTO +module R = Reduction LazyCallByValueStrategy;; ROTTO +module R = Reduction LazyCallByValueStrategyByNameOnConstants;; ROTTO +module R = Reduction LazyCallByNameStrategy;; OK 0m56.398s +module R = Reduction + LazyCallByValueByNameOnConstantsWhenFromStack_ByNameStrategyWhenFromEnvOrEns;; + OK 59.058s +module R = Reduction ClosuresOnStackByValueFromEnvOrEnsStrategy;; OK 58.583s +module R = Reduction + ClosuresOnStackByValueFromEnvOrEnsByNameOnConstantsStrategy;; OK 58.094s +module R = Reduction(ClosuresOnStackByValueFromEnvOrEnsStrategy);; OK 58.127s +*) +(*module R = Reduction(CallByValueByNameForUnwind);;*) +module RS = CallByValueByNameForUnwind';; +(*module R = Reduction(CallByNameStrategy);;*) +(*module R = Reduction(ClosuresOnStackByValueFromEnvOrEnsStrategy);;*) +module R = Reduction(RS);; +module U = UriManager;; + +let whd = R.whd + +(* +let whd = + let profiler_whd = HExtlib.profile ~enable:profile "are_convertible.whd" in + fun ?(delta=true) ?(subst=[]) context t -> + profiler_whd.HExtlib.profile (whd ~delta ~subst context) t +*) + + (* mimic ocaml (<< 3.08) "=" behaviour. Tests physical equality first then + * fallbacks to structural equality *) +let (===) x y = + Pervasives.compare x y = 0 + +(* t1, t2 must be well-typed *) +let are_convertible whd ?(subst=[]) ?(metasenv=[]) = + let heuristic = ref true in + let rec aux test_equality_only context t1 t2 ugraph = + let rec aux2 test_equality_only t1 t2 ugraph = + + (* this trivial euristic cuts down the total time of about five times ;-) *) + (* this because most of the time t1 and t2 are "sintactically" the same *) + if t1 === t2 then + true,ugraph + else + begin + let module C = Cic in + match (t1,t2) with + (C.Rel n1, C.Rel n2) -> (n1 = n2),ugraph + | (C.Var (uri1,exp_named_subst1), C.Var (uri2,exp_named_subst2)) -> + if U.eq uri1 uri2 then + (try + List.fold_right2 + (fun (uri1,x) (uri2,y) (b,ugraph) -> + let b',ugraph' = aux test_equality_only context x y ugraph in + (U.eq uri1 uri2 && b' && b),ugraph' + ) exp_named_subst1 exp_named_subst2 (true,ugraph) + with + Invalid_argument _ -> false,ugraph + ) + else + false,ugraph + | (C.Meta (n1,l1), C.Meta (n2,l2)) -> + if n1 = n2 then + let b2, ugraph1 = + let l1 = CicUtil.clean_up_local_context subst metasenv n1 l1 in + let l2 = CicUtil.clean_up_local_context subst metasenv n2 l2 in + List.fold_left2 + (fun (b,ugraph) t1 t2 -> + if b then + match t1,t2 with + None,_ + | _,None -> true,ugraph + | Some t1',Some t2' -> + aux test_equality_only context t1' t2' ugraph + else + false,ugraph + ) (true,ugraph) l1 l2 + in + if b2 then true,ugraph1 else false,ugraph + else + false,ugraph + | C.Meta (n1,l1), _ -> + (try + let _,term,_ = CicUtil.lookup_subst n1 subst in + let term' = CicSubstitution.subst_meta l1 term in +(* +prerr_endline ("%?: " ^ CicPp.ppterm t1 ^ " <==> " ^ CicPp.ppterm t2); +prerr_endline ("%%%%%%: " ^ CicPp.ppterm term' ^ " <==> " ^ CicPp.ppterm t2); +*) + aux test_equality_only context term' t2 ugraph + with CicUtil.Subst_not_found _ -> false,ugraph) + | _, C.Meta (n2,l2) -> + (try + let _,term,_ = CicUtil.lookup_subst n2 subst in + let term' = CicSubstitution.subst_meta l2 term in +(* +prerr_endline ("%?: " ^ CicPp.ppterm t1 ^ " <==> " ^ CicPp.ppterm t2); +prerr_endline ("%%%%%%: " ^ CicPp.ppterm term' ^ " <==> " ^ CicPp.ppterm t1); +*) + aux test_equality_only context t1 term' ugraph + with CicUtil.Subst_not_found _ -> false,ugraph) + (* TASSI: CONSTRAINTS *) + | (C.Sort (C.Type t1), C.Sort (C.Type t2)) when test_equality_only -> + (try + true,(CicUniv.add_eq t2 t1 ugraph) + with CicUniv.UniverseInconsistency _ -> false,ugraph) + (* TASSI: CONSTRAINTS *) + | (C.Sort (C.Type t1), C.Sort (C.Type t2)) -> + (try + true,(CicUniv.add_ge t2 t1 ugraph) + with CicUniv.UniverseInconsistency _ -> false,ugraph) + (* TASSI: CONSTRAINTS *) + | (C.Sort s1, C.Sort (C.Type _)) -> (not test_equality_only),ugraph + (* TASSI: CONSTRAINTS *) + | (C.Sort s1, C.Sort s2) -> (s1 = s2),ugraph + | (C.Prod (name1,s1,t1), C.Prod(_,s2,t2)) -> + let b',ugraph' = aux true context s1 s2 ugraph in + if b' then + aux test_equality_only ((Some (name1, (C.Decl s1)))::context) + t1 t2 ugraph' + else + false,ugraph + | (C.Lambda (name1,s1,t1), C.Lambda(_,s2,t2)) -> + let b',ugraph' = aux test_equality_only context s1 s2 ugraph in + if b' then + aux test_equality_only ((Some (name1, (C.Decl s1)))::context) + t1 t2 ugraph' + else + false,ugraph + | (C.LetIn (name1,s1,t1), C.LetIn(_,s2,t2)) -> + let b',ugraph' = aux test_equality_only context s1 s2 ugraph in + if b' then + aux test_equality_only + ((Some (name1, (C.Def (s1,None))))::context) t1 t2 ugraph' + else + false,ugraph + | (C.Appl l1, C.Appl l2) -> + (try + List.fold_right2 + (fun x y (b,ugraph) -> + if b then + aux test_equality_only context x y ugraph + else + false,ugraph) l1 l2 (true,ugraph) + with + Invalid_argument _ -> false,ugraph + ) + | (C.Const (uri1,exp_named_subst1), C.Const (uri2,exp_named_subst2)) -> + let b' = U.eq uri1 uri2 in + if b' then + (try + List.fold_right2 + (fun (uri1,x) (uri2,y) (b,ugraph) -> + if b && U.eq uri1 uri2 then + aux test_equality_only context x y ugraph + else + false,ugraph + ) exp_named_subst1 exp_named_subst2 (true,ugraph) + with + Invalid_argument _ -> false,ugraph + ) + else + false,ugraph + | (C.MutInd (uri1,i1,exp_named_subst1), + C.MutInd (uri2,i2,exp_named_subst2) + ) -> + let b' = U.eq uri1 uri2 && i1 = i2 in + if b' then + (try + List.fold_right2 + (fun (uri1,x) (uri2,y) (b,ugraph) -> + if b && U.eq uri1 uri2 then + aux test_equality_only context x y ugraph + else + false,ugraph + ) exp_named_subst1 exp_named_subst2 (true,ugraph) + with + Invalid_argument _ -> false,ugraph + ) + else + false,ugraph + | (C.MutConstruct (uri1,i1,j1,exp_named_subst1), + C.MutConstruct (uri2,i2,j2,exp_named_subst2) + ) -> + let b' = U.eq uri1 uri2 && i1 = i2 && j1 = j2 in + if b' then + (try + List.fold_right2 + (fun (uri1,x) (uri2,y) (b,ugraph) -> + if b && U.eq uri1 uri2 then + aux test_equality_only context x y ugraph + else + false,ugraph + ) exp_named_subst1 exp_named_subst2 (true,ugraph) + with + Invalid_argument _ -> false,ugraph + ) + else + false,ugraph + | (C.MutCase (uri1,i1,outtype1,term1,pl1), + C.MutCase (uri2,i2,outtype2,term2,pl2)) -> + let b' = U.eq uri1 uri2 && i1 = i2 in + if b' then + let b'',ugraph''=aux test_equality_only context + outtype1 outtype2 ugraph in + if b'' then + let b''',ugraph'''= aux test_equality_only context + term1 term2 ugraph'' in + List.fold_right2 + (fun x y (b,ugraph) -> + if b then + aux test_equality_only context x y ugraph + else + false,ugraph) + pl1 pl2 (b''',ugraph''') + else + false,ugraph + else + false,ugraph + | (C.Fix (i1,fl1), C.Fix (i2,fl2)) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl1 + in + if i1 = i2 then + List.fold_right2 + (fun (_,recindex1,ty1,bo1) (_,recindex2,ty2,bo2) (b,ugraph) -> + if b && recindex1 = recindex2 then + let b',ugraph' = aux test_equality_only context ty1 ty2 + ugraph in + if b' then + aux test_equality_only (tys@context) bo1 bo2 ugraph' + else + false,ugraph + else + false,ugraph) + fl1 fl2 (true,ugraph) + else + false,ugraph + | (C.CoFix (i1,fl1), C.CoFix (i2,fl2)) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl1 + in + if i1 = i2 then + List.fold_right2 + (fun (_,ty1,bo1) (_,ty2,bo2) (b,ugraph) -> + if b then + let b',ugraph' = aux test_equality_only context ty1 ty2 + ugraph in + if b' then + aux test_equality_only (tys@context) bo1 bo2 ugraph' + else + false,ugraph + else + false,ugraph) + fl1 fl2 (true,ugraph) + else + false,ugraph + | C.Cast (bo,_),t -> aux2 test_equality_only bo t ugraph + | t,C.Cast (bo,_) -> aux2 test_equality_only t bo ugraph + | (C.Implicit _, _) | (_, C.Implicit _) -> assert false + | (_,_) -> false,ugraph + end + in + let res = + if !heuristic then + aux2 test_equality_only t1 t2 ugraph + else + false,ugraph + in + if fst res = true then + res + else +begin +(*if !heuristic then prerr_endline ("NON FACILE: " ^ CicPp.ppterm t1 ^ " <===> " ^ CicPp.ppterm t2);*) + (* heuristic := false; *) + debug t1 [t2] "PREWHD"; +(*prerr_endline ("PREWHD: " ^ CicPp.ppterm t1 ^ " <===> " ^ CicPp.ppterm t2);*) +(* +prerr_endline ("PREWHD: " ^ CicPp.ppterm t1 ^ " <===> " ^ CicPp.ppterm t2); + let t1' = whd ?delta:(Some true) ?subst:(Some subst) context t1 in + let t2' = whd ?delta:(Some true) ?subst:(Some subst) context t2 in + debug t1' [t2'] "POSTWHD"; +*) +let rec convert_machines ugraph = + function + [] -> true,ugraph + | ((k1,env1,ens1,h1,s1),(k2,env2,ens2,h2,s2))::tl -> + let (b,ugraph) as res = + aux2 test_equality_only + (R.unwind (k1,env1,ens1,h1,[])) (R.unwind (k2,env2,ens2,h2,[])) ugraph + in + if b then + let problems = + try + Some + (List.combine + (List.map + (fun si-> R.reduce ~delta:false ~subst context(RS.from_stack si)) + s1) + (List.map + (fun si-> R.reduce ~delta:false ~subst context(RS.from_stack si)) + s2) + @ tl) + with + Invalid_argument _ -> None + in + match problems with + None -> false,ugraph + | Some problems -> convert_machines ugraph problems + else + res +in + convert_machines ugraph + [R.reduce ~delta:true ~subst context (0,[],[],t1,[]), + R.reduce ~delta:true ~subst context (0,[],[],t2,[])] +(*prerr_endline ("POSTWH: " ^ CicPp.ppterm t1' ^ " <===> " ^ CicPp.ppterm t2');*) +(* + aux2 test_equality_only t1' t2' ugraph +*) +end + in + aux false (*c t1 t2 ugraph *) +;; + +(* DEBUGGING ONLY +let whd ?(delta=true) ?(subst=[]) context t = + let res = whd ~delta ~subst context t in + let rescsc = CicReductionNaif.whd ~delta ~subst context t in + if not (fst (are_convertible CicReductionNaif.whd ~subst context res rescsc CicUniv.empty_ugraph)) then + begin + debug_print (lazy ("PRIMA: " ^ CicPp.ppterm t)) ; + flush stderr ; + debug_print (lazy ("DOPO: " ^ CicPp.ppterm res)) ; + flush stderr ; + debug_print (lazy ("CSC: " ^ CicPp.ppterm rescsc)) ; + flush stderr ; +fdebug := 0 ; +let _ = are_convertible CicReductionNaif.whd ~subst context res rescsc CicUniv.empty_ugraph in + assert false ; + end + else + res +;; +*) + +let are_convertible = are_convertible whd + +let whd = R.whd + +(* +let profiler_other_whd = HExtlib.profile ~enable:profile "~are_convertible.whd" +let whd ?(delta=true) ?(subst=[]) context t = + let foo () = + whd ~delta ~subst context t + in + profiler_other_whd.HExtlib.profile foo () +*) + +let rec normalize ?(delta=true) ?(subst=[]) ctx term = + let module C = Cic in + let t = whd ~delta ~subst ctx term in + let aux = normalize ~delta ~subst in + let decl name t = Some (name, C.Decl t) in + match t with + | C.Rel n -> t + | C.Var (uri,exp_named_subst) -> + C.Var (uri, List.map (fun (n,t) -> n,aux ctx t) exp_named_subst) + | C.Meta (i,l) -> + C.Meta (i,List.map (function Some t -> Some (aux ctx t) | None -> None) l) + | C.Sort _ -> t + | C.Implicit _ -> t + | C.Cast (te,ty) -> C.Cast (aux ctx te, aux ctx ty) + | C.Prod (n,s,t) -> + let s' = aux ctx s in + C.Prod (n, s', aux ((decl n s')::ctx) t) + | C.Lambda (n,s,t) -> + let s' = aux ctx s in + C.Lambda (n, s', aux ((decl n s')::ctx) t) + | C.LetIn (n,s,t) -> + (* the term is already in weak head normal form *) + assert false + | C.Appl (h::l) -> C.Appl (h::(List.map (aux ctx) l)) + | C.Appl [] -> assert false + | C.Const (uri,exp_named_subst) -> + C.Const (uri, List.map (fun (n,t) -> n,aux ctx t) exp_named_subst) + | C.MutInd (uri,typeno,exp_named_subst) -> + C.MutInd (uri,typeno, List.map (fun (n,t) -> n,aux ctx t) exp_named_subst) + | C.MutConstruct (uri,typeno,consno,exp_named_subst) -> + C.MutConstruct (uri, typeno, consno, + List.map (fun (n,t) -> n,aux ctx t) exp_named_subst) + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i, aux ctx outt, aux ctx t, List.map (aux ctx) pl) +(*CSC: to be completed, I suppose *) + | C.Fix _ -> t + | C.CoFix _ -> t + +let normalize ?delta ?subst ctx term = +(* prerr_endline ("NORMALIZE:" ^ CicPp.ppterm term); *) + let t = normalize ?delta ?subst ctx term in +(* prerr_endline ("NORMALIZED:" ^ CicPp.ppterm t); *) + t + + +(* performs an head beta/cast reduction *) +let rec head_beta_reduce ?(delta=false) ?(upto=(-1)) t = + match upto with + 0 -> t + | n -> + match t with + (Cic.Appl (Cic.Lambda (_,_,t)::he'::tl')) -> + let he'' = CicSubstitution.subst he' t in + if tl' = [] then + he'' + else + let he''' = + match he'' with + Cic.Appl l -> Cic.Appl (l@tl') + | _ -> Cic.Appl (he''::tl') + in + head_beta_reduce ~delta ~upto:(upto - 1) he''' + | Cic.Cast (te,_) -> head_beta_reduce ~delta ~upto te + | Cic.Appl (Cic.Const (uri,ens)::tl) as t when delta=true -> + let bo = + match fst (CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri) with + Cic.Constant (_,bo,_,_,_) -> bo + | Cic.Variable _ -> raise ReferenceToVariable + | Cic.CurrentProof (_,_,bo,_,_,_) -> Some bo + | Cic.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + in + (match bo with + None -> t + | Some bo -> + head_beta_reduce ~upto + ~delta (Cic.Appl ((CicSubstitution.subst_vars ens bo)::tl))) + | Cic.Const (uri,ens) as t when delta=true -> + let bo = + match fst (CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri) with + Cic.Constant (_,bo,_,_,_) -> bo + | Cic.Variable _ -> raise ReferenceToVariable + | Cic.CurrentProof (_,_,bo,_,_,_) -> Some bo + | Cic.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + in + (match bo with + None -> t + | Some bo -> + head_beta_reduce ~delta ~upto (CicSubstitution.subst_vars ens bo)) + | t -> t + +(* +let are_convertible ?subst ?metasenv context t1 t2 ugraph = + let before = Unix.gettimeofday () in + let res = are_convertible ?subst ?metasenv context t1 t2 ugraph in + let after = Unix.gettimeofday () in + let diff = after -. before in + if diff > 0.1 then + begin + let nc = List.map (function None -> None | Some (n,_) -> Some n) context in + prerr_endline + ("\n#(" ^ string_of_float diff ^ "):\n" ^ CicPp.pp t1 nc ^ "\n<=>\n" ^ CicPp.pp t2 nc); + end; + res +*) diff --git a/components/cic_proof_checking/cicReduction.mli b/components/cic_proof_checking/cicReduction.mli new file mode 100644 index 000000000..82be7fd3f --- /dev/null +++ b/components/cic_proof_checking/cicReduction.mli @@ -0,0 +1,44 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception WrongUriToInductiveDefinition +exception ReferenceToConstant +exception ReferenceToVariable +exception ReferenceToCurrentProof +exception ReferenceToInductiveDefinition +val fdebug : int ref +val whd : + ?delta:bool -> ?subst:Cic.substitution -> Cic.context -> Cic.term -> Cic.term +val are_convertible : + ?subst:Cic.substitution -> ?metasenv:Cic.metasenv -> + Cic.context -> Cic.term -> Cic.term -> CicUniv.universe_graph -> + bool * CicUniv.universe_graph +val normalize: + ?delta:bool -> ?subst:Cic.substitution -> Cic.context -> Cic.term -> Cic.term + +(* performs head beta/(delta)/cast reduction; the default is to not perform + delta reduction; if provided, ~upto is the maximum number of beta redexes + reduced *) +val head_beta_reduce: ?delta:bool -> ?upto:int -> Cic.term -> Cic.term diff --git a/components/cic_proof_checking/cicSubstitution.ml b/components/cic_proof_checking/cicSubstitution.ml new file mode 100644 index 000000000..a4340583e --- /dev/null +++ b/components/cic_proof_checking/cicSubstitution.ml @@ -0,0 +1,439 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +exception CannotSubstInMeta;; +exception RelToHiddenHypothesis;; +exception ReferenceToVariable;; +exception ReferenceToConstant;; +exception ReferenceToCurrentProof;; +exception ReferenceToInductiveDefinition;; + +let debug_print = fun _ -> () + +let lift_from k n = + let rec liftaux k = + let module C = Cic in + function + C.Rel m -> + if m < k then + C.Rel m + else + C.Rel (m + n) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,liftaux k t)) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (i,l) -> + let l' = + List.map + (function + None -> None + | Some t -> Some (liftaux k t) + ) l + in + C.Meta(i,l') + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (liftaux k te, liftaux k ty) + | C.Prod (n,s,t) -> C.Prod (n, liftaux k s, liftaux (k+1) t) + | C.Lambda (n,s,t) -> C.Lambda (n, liftaux k s, liftaux (k+1) t) + | C.LetIn (n,s,t) -> C.LetIn (n, liftaux k s, liftaux (k+1) t) + | C.Appl l -> C.Appl (List.map (liftaux k) l) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,liftaux k t)) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,liftaux k t)) exp_named_subst + in + C.MutInd (uri,tyno,exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,liftaux k t)) exp_named_subst + in + C.MutConstruct (uri,tyno,consno,exp_named_subst') + | C.MutCase (sp,i,outty,t,pl) -> + C.MutCase (sp, i, liftaux k outty, liftaux k t, + List.map (liftaux k) pl) + | C.Fix (i, fl) -> + let len = List.length fl in + let liftedfl = + List.map + (fun (name, i, ty, bo) -> (name, i, liftaux k ty, liftaux (k+len) bo)) + fl + in + C.Fix (i, liftedfl) + | C.CoFix (i, fl) -> + let len = List.length fl in + let liftedfl = + List.map + (fun (name, ty, bo) -> (name, liftaux k ty, liftaux (k+len) bo)) + fl + in + C.CoFix (i, liftedfl) + in + liftaux k + +let lift n t = + if n = 0 then + t + else + lift_from 1 n t +;; + +(* subst t1 t2 *) +(* substitutes [t1] for [Rel 1] in [t2] *) +(* if avoid_beta_redexes is true (default: false) no new beta redexes *) +(* are generated. WARNING: the substitution can diverge when t2 is not *) +(* well typed and avoid_beta_redexes is true. *) +let rec subst ?(avoid_beta_redexes=false) arg = + let rec substaux k = + let module C = Cic in + function + C.Rel n as t -> + (match n with + n when n = k -> lift (k - 1) arg + | n when n < k -> t + | _ -> C.Rel (n - 1) + ) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,substaux k t)) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (i, l) -> + let l' = + List.map + (function + None -> None + | Some t -> Some (substaux k t) + ) l + in + C.Meta(i,l') + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (substaux k te, substaux k ty) + | C.Prod (n,s,t) -> C.Prod (n, substaux k s, substaux (k + 1) t) + | C.Lambda (n,s,t) -> C.Lambda (n, substaux k s, substaux (k + 1) t) + | C.LetIn (n,s,t) -> C.LetIn (n, substaux k s, substaux (k + 1) t) + | C.Appl (he::tl) -> + (* Invariant: no Appl applied to another Appl *) + let tl' = List.map (substaux k) tl in + begin + match substaux k he with + C.Appl l -> C.Appl (l@tl') + (* Experimental *) + | C.Lambda (_,_,bo) when avoid_beta_redexes -> + (match tl' with + [] -> assert false + | [he] -> subst ~avoid_beta_redexes he bo + | he::tl -> C.Appl (subst he bo::tl)) + | _ as he' -> C.Appl (he'::tl') + end + | C.Appl _ -> assert false + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,substaux k t)) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,typeno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,substaux k t)) exp_named_subst + in + C.MutInd (uri,typeno,exp_named_subst') + | C.MutConstruct (uri,typeno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,substaux k t)) exp_named_subst + in + C.MutConstruct (uri,typeno,consno,exp_named_subst') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,substaux k outt, substaux k t, + List.map (substaux k) pl) + | C.Fix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> (name, i, substaux k ty, substaux (k+len) bo)) + fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,ty,bo) -> (name, substaux k ty, substaux (k+len) bo)) + fl + in + C.CoFix (i, substitutedfl) + in + substaux 1 +;; + +(*CSC: i controlli di tipo debbono essere svolti da destra a *) +(*CSC: sinistra: i{B/A;b/a} ==> a{B/A;b/a} ==> a{b/a{B/A}} ==> b *) +(*CSC: la sostituzione ora e' implementata in maniera simultanea, ma *) +(*CSC: dovrebbe diventare da sinistra verso destra: *) +(*CSC: t{a=a/A;b/a} ==> \H:a=a.H{b/a} ==> \H:b=b.H *) +(*CSC: per la roba che proviene da Coq questo non serve! *) +let subst_vars exp_named_subst t = +(* +debug_print (lazy ("@@@POSSIBLE BUG: SUBSTITUTION IS NOT SIMULTANEOUS")) ; +*) + let rec substaux k = + let module C = Cic in + function + C.Rel _ as t -> t + | C.Var (uri,exp_named_subst') -> + (try + let (_,arg) = + List.find + (function (varuri,_) -> UriManager.eq uri varuri) exp_named_subst + in + lift (k -1) arg + with + Not_found -> + let params = + let obj,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + (match obj with + C.Constant _ -> raise ReferenceToConstant + | C.Variable (_,_,_,params,_) -> params + | C.CurrentProof _ -> raise ReferenceToCurrentProof + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + ) + in +(* +debug_print (lazy "\n\n---- BEGIN ") ; +debug_print (lazy ("----params: " ^ String.concat " ; " (List.map UriManager.string_of_uri params))) ; +debug_print (lazy ("----S(" ^ UriManager.string_of_uri uri ^ "): " ^ String.concat " ; " (List.map (function (uri,_) -> UriManager.string_of_uri uri) exp_named_subst))) ; +debug_print (lazy ("----P: " ^ String.concat " ; " (List.map (function (uri,_) -> UriManager.string_of_uri uri) exp_named_subst'))) ; +*) + let exp_named_subst'' = + substaux_in_exp_named_subst uri k exp_named_subst' params + in +(* +debug_print (lazy ("----D: " ^ String.concat " ; " (List.map (function (uri,_) -> UriManager.string_of_uri uri) exp_named_subst''))) ; +debug_print (lazy "---- END\n\n ") ; +*) + C.Var (uri,exp_named_subst'') + ) + | C.Meta (i, l) -> + let l' = + List.map + (function + None -> None + | Some t -> Some (substaux k t) + ) l + in + C.Meta(i,l') + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (substaux k te, substaux k ty) + | C.Prod (n,s,t) -> C.Prod (n, substaux k s, substaux (k + 1) t) + | C.Lambda (n,s,t) -> C.Lambda (n, substaux k s, substaux (k + 1) t) + | C.LetIn (n,s,t) -> C.LetIn (n, substaux k s, substaux (k + 1) t) + | C.Appl (he::tl) -> + (* Invariant: no Appl applied to another Appl *) + let tl' = List.map (substaux k) tl in + begin + match substaux k he with + C.Appl l -> C.Appl (l@tl') + | _ as he' -> C.Appl (he'::tl') + end + | C.Appl _ -> assert false + | C.Const (uri,exp_named_subst') -> + let params = + let obj,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + (match obj with + C.Constant (_,_,_,params,_) -> params + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof (_,_,_,_,params,_) -> params + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + ) + in + let exp_named_subst'' = + substaux_in_exp_named_subst uri k exp_named_subst' params + in + C.Const (uri,exp_named_subst'') + | C.MutInd (uri,typeno,exp_named_subst') -> + let params = + let obj,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + (match obj with + C.Constant _ -> raise ReferenceToConstant + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof _ -> raise ReferenceToCurrentProof + | C.InductiveDefinition (_,params,_,_) -> params + ) + in + let exp_named_subst'' = + substaux_in_exp_named_subst uri k exp_named_subst' params + in + C.MutInd (uri,typeno,exp_named_subst'') + | C.MutConstruct (uri,typeno,consno,exp_named_subst') -> + let params = + let obj,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + (match obj with + C.Constant _ -> raise ReferenceToConstant + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof _ -> raise ReferenceToCurrentProof + | C.InductiveDefinition (_,params,_,_) -> params + ) + in + let exp_named_subst'' = + substaux_in_exp_named_subst uri k exp_named_subst' params + in + C.MutConstruct (uri,typeno,consno,exp_named_subst'') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,substaux k outt, substaux k t, + List.map (substaux k) pl) + | C.Fix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> (name, i, substaux k ty, substaux (k+len) bo)) + fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,ty,bo) -> (name, substaux k ty, substaux (k+len) bo)) + fl + in + C.CoFix (i, substitutedfl) + and substaux_in_exp_named_subst uri k exp_named_subst' params = +(*CSC: invece di concatenare sarebbe meglio rispettare l'ordine dei params *) +(*CSC: e' vero???? una veloce prova non sembra confermare la teoria *) + let rec filter_and_lift = + function + [] -> [] + | (uri,t)::tl when + List.for_all + (function (uri',_) -> not (UriManager.eq uri uri')) exp_named_subst' + && + List.mem uri params + -> + (uri,lift (k-1) t)::(filter_and_lift tl) + | _::tl -> filter_and_lift tl +(* + | (uri,_)::tl -> +debug_print (lazy ("---- SKIPPO " ^ UriManager.string_of_uri uri)) ; +if List.for_all (function (uri',_) -> not (UriManager.eq uri uri')) +exp_named_subst' then debug_print (lazy "---- OK1") ; +debug_print (lazy ("++++ uri " ^ UriManager.string_of_uri uri ^ " not in " ^ String.concat " ; " (List.map UriManager.string_of_uri params))) ; +if List.mem uri params then debug_print (lazy "---- OK2") ; + filter_and_lift tl +*) + in + List.map (function (uri,t) -> (uri,substaux k t)) exp_named_subst' @ + (filter_and_lift exp_named_subst) + in + if exp_named_subst = [] then t + else substaux 1 t +;; + +(* subst_meta [t_1 ; ... ; t_n] t *) +(* returns the term [t] where [Rel i] is substituted with [t_i] *) +(* [t_i] is lifted as usual when it crosses an abstraction *) +let subst_meta l t = + let module C = Cic in + if l = [] then t else + let rec aux k = function + C.Rel n as t -> + if n <= k then t else + (try + match List.nth l (n-k-1) with + None -> raise RelToHiddenHypothesis + | Some t -> lift k t + with + (Failure _) -> assert false + ) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,aux k t)) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (i,l) -> + let l' = + List.map + (function + None -> None + | Some t -> + try + Some (aux k t) + with + RelToHiddenHypothesis -> None + ) l + in + C.Meta(i,l') + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (aux k te, aux k ty) (*CSC ??? *) + | C.Prod (n,s,t) -> C.Prod (n, aux k s, aux (k + 1) t) + | C.Lambda (n,s,t) -> C.Lambda (n, aux k s, aux (k + 1) t) + | C.LetIn (n,s,t) -> C.LetIn (n, aux k s, aux (k + 1) t) + | C.Appl l -> C.Appl (List.map (aux k) l) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,aux k t)) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,typeno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,aux k t)) exp_named_subst + in + C.MutInd (uri,typeno,exp_named_subst') + | C.MutConstruct (uri,typeno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,aux k t)) exp_named_subst + in + C.MutConstruct (uri,typeno,consno,exp_named_subst') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,aux k outt, aux k t, List.map (aux k) pl) + | C.Fix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> (name, i, aux k ty, aux (k+len) bo)) + fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,ty,bo) -> (name, aux k ty, aux (k+len) bo)) + fl + in + C.CoFix (i, substitutedfl) + in + aux 0 t +;; + diff --git a/components/cic_proof_checking/cicSubstitution.mli b/components/cic_proof_checking/cicSubstitution.mli new file mode 100644 index 000000000..36291fb18 --- /dev/null +++ b/components/cic_proof_checking/cicSubstitution.mli @@ -0,0 +1,59 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception CannotSubstInMeta;; +exception RelToHiddenHypothesis;; +exception ReferenceToVariable;; +exception ReferenceToConstant;; +exception ReferenceToInductiveDefinition;; + +(* lift n t *) +(* lifts [t] of [n] *) +(* NOTE: the opposite function (delift_rels) is defined in CicMetaSubst *) +(* since it needs to restrict the metavariables in case of failure *) +val lift : int -> Cic.term -> Cic.term + + +(* lift from n t *) +(* as lift but lifts only indexes >= from *) +val lift_from: int -> int -> Cic.term -> Cic.term + +(* subst t1 t2 *) +(* substitutes [t1] for [Rel 1] in [t2] *) +(* if avoid_beta_redexes is true (default: false) no new beta redexes *) +(* are generated. WARNING: the substitution can diverge when t2 is not *) +(* well typed and avoid_beta_redexes is true. *) +val subst : ?avoid_beta_redexes:bool -> Cic.term -> Cic.term -> Cic.term + +(* subst_vars exp_named_subst t2 *) +(* applies [exp_named_subst] to [t2] *) +val subst_vars : + Cic.term Cic.explicit_named_substitution -> Cic.term -> Cic.term + +(* subst_meta [t_1 ; ... ; t_n] t *) +(* returns the term [t] where [Rel i] is substituted with [t_i] *) +(* [t_i] is lifted as usual when it crosses an abstraction *) +val subst_meta : (Cic.term option) list -> Cic.term -> Cic.term + diff --git a/components/cic_proof_checking/cicTypeChecker.ml b/components/cic_proof_checking/cicTypeChecker.ml new file mode 100644 index 000000000..87a0ca054 --- /dev/null +++ b/components/cic_proof_checking/cicTypeChecker.ml @@ -0,0 +1,2278 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(* TODO factorize functions to frequent errors (e.g. "Unknwon mutual inductive + * ...") *) + +open Printf + +exception AssertFailure of string Lazy.t;; +exception TypeCheckerFailure of string Lazy.t;; + +let fdebug = ref 0;; +let debug t context = + let rec debug_aux t i = + let module C = Cic in + let module U = UriManager in + CicPp.ppobj (C.Variable ("DEBUG", None, t, [], [])) ^ "\n" ^ i + in + if !fdebug = 0 then + raise (TypeCheckerFailure (lazy (List.fold_right debug_aux (t::context) ""))) +;; + +let debug_print = fun _ -> ();; + +let rec split l n = + match (l,n) with + (l,0) -> ([], l) + | (he::tl, n) -> let (l1,l2) = split tl (n-1) in (he::l1,l2) + | (_,_) -> + raise (TypeCheckerFailure (lazy "Parameters number < left parameters number")) +;; + +let debrujin_constructor ?(cb=fun _ _ -> ()) uri number_of_types = + let rec aux k t = + let module C = Cic in + let res = + match t with + C.Rel n as t when n <= k -> t + | C.Rel _ -> + raise (TypeCheckerFailure (lazy "unbound variable found in constructor type")) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,aux k t)) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (i,l) -> + let l' = List.map (function None -> None | Some t -> Some (aux k t)) l in + C.Meta (i,l') + | C.Sort _ + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (aux k te, aux k ty) + | C.Prod (n,s,t) -> C.Prod (n, aux k s, aux (k+1) t) + | C.Lambda (n,s,t) -> C.Lambda (n, aux k s, aux (k+1) t) + | C.LetIn (n,s,t) -> C.LetIn (n, aux k s, aux (k+1) t) + | C.Appl l -> C.Appl (List.map (aux k) l) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,aux k t)) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri',tyno,exp_named_subst) when UriManager.eq uri uri' -> + if exp_named_subst != [] then + raise (TypeCheckerFailure + (lazy ("non-empty explicit named substitution is applied to "^ + "a mutual inductive type which is being defined"))) ; + C.Rel (k + number_of_types - tyno) ; + | C.MutInd (uri',tyno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,aux k t)) exp_named_subst + in + C.MutInd (uri',tyno,exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> (uri,aux k t)) exp_named_subst + in + C.MutConstruct (uri,tyno,consno,exp_named_subst') + | C.MutCase (sp,i,outty,t,pl) -> + C.MutCase (sp, i, aux k outty, aux k t, + List.map (aux k) pl) + | C.Fix (i, fl) -> + let len = List.length fl in + let liftedfl = + List.map + (fun (name, i, ty, bo) -> (name, i, aux k ty, aux (k+len) bo)) + fl + in + C.Fix (i, liftedfl) + | C.CoFix (i, fl) -> + let len = List.length fl in + let liftedfl = + List.map + (fun (name, ty, bo) -> (name, aux k ty, aux (k+len) bo)) + fl + in + C.CoFix (i, liftedfl) + in + cb t res; + res + in + aux 0 +;; + +exception CicEnvironmentError;; + +let rec type_of_constant ~logger uri ugraph = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let cobj,ugraph = + match CicEnvironment.is_type_checked ~trust:true ugraph uri with + CicEnvironment.CheckedObj (cobj,ugraph') -> cobj,ugraph' + | CicEnvironment.UncheckedObj uobj -> + logger#log (`Start_type_checking uri) ; + (* let's typecheck the uncooked obj *) + +(**************************************************************** + TASSI: FIXME qui e' inutile ricordarselo, + tanto poi lo richiediamo alla cache che da quello su disco +*****************************************************************) + + let ugraph_dust = + (match uobj with + C.Constant (_,Some te,ty,_,_) -> + let _,ugraph = type_of ~logger ty ugraph in + let type_of_te,ugraph' = type_of ~logger te ugraph in + let b',ugraph'' = (R.are_convertible [] type_of_te ty ugraph') in + if not b' then + raise (TypeCheckerFailure (lazy (sprintf + "the constant %s is not well typed because the type %s of the body is not convertible to the declared type %s" + (U.string_of_uri uri) (CicPp.ppterm type_of_te) + (CicPp.ppterm ty)))) + else + ugraph' + | C.Constant (_,None,ty,_,_) -> + (* only to check that ty is well-typed *) + let _,ugraph' = type_of ~logger ty ugraph in + ugraph' + | C.CurrentProof (_,conjs,te,ty,_,_) -> + let _,ugraph1 = + List.fold_left + (fun (metasenv,ugraph) ((_,context,ty) as conj) -> + let _,ugraph' = + type_of_aux' ~logger metasenv context ty ugraph + in + (metasenv @ [conj],ugraph') + ) ([],ugraph) conjs + in + let _,ugraph2 = type_of_aux' ~logger conjs [] ty ugraph1 in + let type_of_te,ugraph3 = + type_of_aux' ~logger conjs [] te ugraph2 + in + let b,ugraph4 = (R.are_convertible [] type_of_te ty ugraph3) in + if not b then + raise (TypeCheckerFailure (lazy (sprintf + "the current proof %s is not well typed because the type %s of the body is not convertible to the declared type %s" + (U.string_of_uri uri) (CicPp.ppterm type_of_te) + (CicPp.ppterm ty)))) + else + ugraph4 + | _ -> + raise + (TypeCheckerFailure (lazy ("Unknown constant:" ^ U.string_of_uri uri)))) + in + try + CicEnvironment.set_type_checking_info uri; + logger#log (`Type_checking_completed uri) ; + match CicEnvironment.is_type_checked ~trust:false ugraph uri with + CicEnvironment.CheckedObj (cobj,ugraph') -> cobj,ugraph' + | CicEnvironment.UncheckedObj _ -> raise CicEnvironmentError + with Invalid_argument s -> + (*debug_print (lazy s);*) + uobj,ugraph_dust + in + match cobj,ugraph with + (C.Constant (_,_,ty,_,_)),g -> ty,g + | (C.CurrentProof (_,_,_,ty,_,_)),g -> ty,g + | _ -> + raise (TypeCheckerFailure (lazy ("Unknown constant:" ^ U.string_of_uri uri))) + +and type_of_variable ~logger uri ugraph = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + (* 0 because a variable is never cooked => no partial cooking at one level *) + match CicEnvironment.is_type_checked ~trust:true ugraph uri with + CicEnvironment.CheckedObj ((C.Variable (_,_,ty,_,_)),ugraph') -> ty,ugraph' + | CicEnvironment.UncheckedObj (C.Variable (_,bo,ty,_,_)) -> + logger#log (`Start_type_checking uri) ; + (* only to check that ty is well-typed *) + let _,ugraph1 = type_of ~logger ty ugraph in + let ugraph2 = + (match bo with + None -> ugraph + | Some bo -> + let ty_bo,ugraph' = type_of ~logger bo ugraph1 in + let b,ugraph'' = (R.are_convertible [] ty_bo ty ugraph') in + if not b then + raise (TypeCheckerFailure + (lazy ("Unknown variable:" ^ U.string_of_uri uri))) + else + ugraph'') + in + (try + CicEnvironment.set_type_checking_info uri ; + logger#log (`Type_checking_completed uri) ; + match CicEnvironment.is_type_checked ~trust:false ugraph uri with + CicEnvironment.CheckedObj ((C.Variable (_,_,ty,_,_)),ugraph') -> + ty,ugraph' + | CicEnvironment.CheckedObj _ + | CicEnvironment.UncheckedObj _ -> raise CicEnvironmentError + with Invalid_argument s -> + (*debug_print (lazy s);*) + ty,ugraph2) + | _ -> + raise (TypeCheckerFailure (lazy ("Unknown variable:" ^ U.string_of_uri uri))) + +and does_not_occur ?(subst=[]) context n nn te = + let module C = Cic in + match te with + C.Rel m when m > n && m <= nn -> false + | C.Rel m -> + (try + (match List.nth context (m-1) with + Some (_,C.Def (bo,_)) -> + does_not_occur ~subst context n nn (CicSubstitution.lift m bo) + | _ -> true) + with + Failure _ -> assert false) + | C.Sort _ + | C.Implicit _ -> true + | C.Meta (_,l) -> + List.fold_right + (fun x i -> + match x with + None -> i + | Some x -> i && does_not_occur ~subst context n nn x) l true && + (try + let (canonical_context,term,ty) = CicUtil.lookup_subst n subst in + does_not_occur ~subst context n nn (CicSubstitution.subst_meta l term) + with + CicUtil.Subst_not_found _ -> true) + | C.Cast (te,ty) -> + does_not_occur ~subst context n nn te && does_not_occur ~subst context n nn ty + | C.Prod (name,so,dest) -> + does_not_occur ~subst context n nn so && + does_not_occur ~subst ((Some (name,(C.Decl so)))::context) (n + 1) + (nn + 1) dest + | C.Lambda (name,so,dest) -> + does_not_occur ~subst context n nn so && + does_not_occur ~subst ((Some (name,(C.Decl so)))::context) (n + 1) (nn + 1) + dest + | C.LetIn (name,so,dest) -> + does_not_occur ~subst context n nn so && + does_not_occur ~subst ((Some (name,(C.Def (so,None))))::context) + (n + 1) (nn + 1) dest + | C.Appl l -> + List.fold_right (fun x i -> i && does_not_occur ~subst context n nn x) l true + | C.Var (_,exp_named_subst) + | C.Const (_,exp_named_subst) + | C.MutInd (_,_,exp_named_subst) + | C.MutConstruct (_,_,_,exp_named_subst) -> + List.fold_right (fun (_,x) i -> i && does_not_occur ~subst context n nn x) + exp_named_subst true + | C.MutCase (_,_,out,te,pl) -> + does_not_occur ~subst context n nn out && does_not_occur ~subst context n nn te && + List.fold_right (fun x i -> i && does_not_occur ~subst context n nn x) pl true + | C.Fix (_,fl) -> + let len = List.length fl in + let n_plus_len = n + len in + let nn_plus_len = nn + len in + let tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + List.fold_right + (fun (_,_,ty,bo) i -> + i && does_not_occur ~subst context n nn ty && + does_not_occur ~subst (tys @ context) n_plus_len nn_plus_len bo + ) fl true + | C.CoFix (_,fl) -> + let len = List.length fl in + let n_plus_len = n + len in + let nn_plus_len = nn + len in + let tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + List.fold_right + (fun (_,ty,bo) i -> + i && does_not_occur ~subst context n nn ty && + does_not_occur ~subst (tys @ context) n_plus_len nn_plus_len bo + ) fl true + +(*CSC l'indice x dei tipi induttivi e' t.c. n < x <= nn *) +(*CSC questa funzione e' simile alla are_all_occurrences_positive, ma fa *) +(*CSC dei controlli leggermente diversi. Viene invocata solamente dalla *) +(*CSC strictly_positive *) +(*CSC definizione (giusta???) tratta dalla mail di Hugo ;-) *) +and weakly_positive context n nn uri te = + let module C = Cic in +(*CSC: Che schifo! Bisogna capire meglio e trovare una soluzione ragionevole!*) + let dummy_mutind = + C.MutInd (HelmLibraryObjects.Datatypes.nat_URI,0,[]) + in + (*CSC: mettere in cicSubstitution *) + let rec subst_inductive_type_with_dummy_mutind = + function + C.MutInd (uri',0,_) when UriManager.eq uri' uri -> + dummy_mutind + | C.Appl ((C.MutInd (uri',0,_))::tl) when UriManager.eq uri' uri -> + dummy_mutind + | C.Cast (te,ty) -> subst_inductive_type_with_dummy_mutind te + | C.Prod (name,so,ta) -> + C.Prod (name, subst_inductive_type_with_dummy_mutind so, + subst_inductive_type_with_dummy_mutind ta) + | C.Lambda (name,so,ta) -> + C.Lambda (name, subst_inductive_type_with_dummy_mutind so, + subst_inductive_type_with_dummy_mutind ta) + | C.Appl tl -> + C.Appl (List.map subst_inductive_type_with_dummy_mutind tl) + | C.MutCase (uri,i,outtype,term,pl) -> + C.MutCase (uri,i, + subst_inductive_type_with_dummy_mutind outtype, + subst_inductive_type_with_dummy_mutind term, + List.map subst_inductive_type_with_dummy_mutind pl) + | C.Fix (i,fl) -> + C.Fix (i,List.map (fun (name,i,ty,bo) -> (name,i, + subst_inductive_type_with_dummy_mutind ty, + subst_inductive_type_with_dummy_mutind bo)) fl) + | C.CoFix (i,fl) -> + C.CoFix (i,List.map (fun (name,ty,bo) -> (name, + subst_inductive_type_with_dummy_mutind ty, + subst_inductive_type_with_dummy_mutind bo)) fl) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map + (function (uri,t) -> (uri,subst_inductive_type_with_dummy_mutind t)) + exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,typeno,exp_named_subst) -> + let exp_named_subst' = + List.map + (function (uri,t) -> (uri,subst_inductive_type_with_dummy_mutind t)) + exp_named_subst + in + C.MutInd (uri,typeno,exp_named_subst') + | C.MutConstruct (uri,typeno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map + (function (uri,t) -> (uri,subst_inductive_type_with_dummy_mutind t)) + exp_named_subst + in + C.MutConstruct (uri,typeno,consno,exp_named_subst') + | t -> t + in + match CicReduction.whd context te with +(* + C.Appl ((C.MutInd (uri',0,_))::tl) when UriManager.eq uri' uri -> true +*) + C.Appl ((C.MutInd (uri',_,_))::tl) when UriManager.eq uri' uri -> true + | C.MutInd (uri',0,_) when UriManager.eq uri' uri -> true + | C.Prod (C.Anonymous,source,dest) -> + strictly_positive context n nn + (subst_inductive_type_with_dummy_mutind source) && + weakly_positive ((Some (C.Anonymous,(C.Decl source)))::context) + (n + 1) (nn + 1) uri dest + | C.Prod (name,source,dest) when + does_not_occur ((Some (name,(C.Decl source)))::context) 0 n dest -> + (* dummy abstraction, so we behave as in the anonimous case *) + strictly_positive context n nn + (subst_inductive_type_with_dummy_mutind source) && + weakly_positive ((Some (name,(C.Decl source)))::context) + (n + 1) (nn + 1) uri dest + | C.Prod (name,source,dest) -> + does_not_occur context n nn + (subst_inductive_type_with_dummy_mutind source)&& + weakly_positive ((Some (name,(C.Decl source)))::context) + (n + 1) (nn + 1) uri dest + | _ -> + raise (TypeCheckerFailure (lazy "Malformed inductive constructor type")) + +(* instantiate_parameters ps (x1:T1)...(xn:Tn)C *) +(* returns ((x_|ps|:T_|ps|)...(xn:Tn)C){ps_1 / x1 ; ... ; ps_|ps| / x_|ps|} *) +and instantiate_parameters params c = + let module C = Cic in + match (c,params) with + (c,[]) -> c + | (C.Prod (_,_,ta), he::tl) -> + instantiate_parameters tl + (CicSubstitution.subst he ta) + | (C.Cast (te,_), _) -> instantiate_parameters params te + | (t,l) -> raise (AssertFailure (lazy "1")) + +and strictly_positive context n nn te = + let module C = Cic in + let module U = UriManager in + match CicReduction.whd context te with + | t when does_not_occur context n nn t -> true + | C.Rel _ -> true + | C.Cast (te,ty) -> + (*CSC: bisogna controllare ty????*) + strictly_positive context n nn te + | C.Prod (name,so,ta) -> + does_not_occur context n nn so && + strictly_positive ((Some (name,(C.Decl so)))::context) (n+1) (nn+1) ta + | C.Appl ((C.Rel m)::tl) when m > n && m <= nn -> + List.fold_right (fun x i -> i && does_not_occur context n nn x) tl true + | C.Appl ((C.MutInd (uri,i,exp_named_subst))::tl) -> + let (ok,paramsno,ity,cl,name) = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.InductiveDefinition (tl,_,paramsno,_) -> + let (name,_,ity,cl) = List.nth tl i in + (List.length tl = 1, paramsno, ity, cl, name) + (* (true, paramsno, ity, cl, name) *) + | _ -> + raise + (TypeCheckerFailure + (lazy ("Unknown inductive type:" ^ U.string_of_uri uri))) + in + let (params,arguments) = split tl paramsno in + let lifted_params = List.map (CicSubstitution.lift 1) params in + let cl' = + List.map + (fun (_,te) -> + instantiate_parameters lifted_params + (CicSubstitution.subst_vars exp_named_subst te) + ) cl + in + ok && + List.fold_right + (fun x i -> i && does_not_occur context n nn x) + arguments true && + (*CSC: MEGAPATCH3 (sara' quella giusta?)*) + List.fold_right + (fun x i -> + i && + weakly_positive + ((Some (C.Name name,(Cic.Decl ity)))::context) (n+1) (nn+1) uri + x + ) cl' true + | t -> false + +(* the inductive type indexes are s.t. n < x <= nn *) +and are_all_occurrences_positive context uri indparamsno i n nn te = + let module C = Cic in + match CicReduction.whd context te with + C.Appl ((C.Rel m)::tl) when m = i -> + (*CSC: riscrivere fermandosi a 0 *) + (* let's check if the inductive type is applied at least to *) + (* indparamsno parameters *) + let last = + List.fold_left + (fun k x -> + if k = 0 then 0 + else + match CicReduction.whd context x with + C.Rel m when m = n - (indparamsno - k) -> k - 1 + | _ -> + raise (TypeCheckerFailure + (lazy + ("Non-positive occurence in mutual inductive definition(s) [1]" ^ + UriManager.string_of_uri uri))) + ) indparamsno tl + in + if last = 0 then + List.fold_right (fun x i -> i && does_not_occur context n nn x) tl true + else + raise (TypeCheckerFailure + (lazy ("Non-positive occurence in mutual inductive definition(s) [2]"^ + UriManager.string_of_uri uri))) + | C.Rel m when m = i -> + if indparamsno = 0 then + true + else + raise (TypeCheckerFailure + (lazy ("Non-positive occurence in mutual inductive definition(s) [3]"^ + UriManager.string_of_uri uri))) + | C.Prod (C.Anonymous,source,dest) -> + let b = strictly_positive context n nn source in + b && + are_all_occurrences_positive + ((Some (C.Anonymous,(C.Decl source)))::context) uri indparamsno + (i+1) (n + 1) (nn + 1) dest + | C.Prod (name,source,dest) when + does_not_occur ((Some (name,(C.Decl source)))::context) 0 n dest -> + (* dummy abstraction, so we behave as in the anonimous case *) + strictly_positive context n nn source && + are_all_occurrences_positive + ((Some (name,(C.Decl source)))::context) uri indparamsno + (i+1) (n + 1) (nn + 1) dest + | C.Prod (name,source,dest) -> + does_not_occur context n nn source && + are_all_occurrences_positive ((Some (name,(C.Decl source)))::context) + uri indparamsno (i+1) (n + 1) (nn + 1) dest + | _ -> + raise + (TypeCheckerFailure (lazy ("Malformed inductive constructor type " ^ + (UriManager.string_of_uri uri)))) + +(* Main function to checks the correctness of a mutual *) +(* inductive block definition. This is the function *) +(* exported to the proof-engine. *) +and typecheck_mutual_inductive_defs ~logger uri (itl,_,indparamsno) ugraph = + let module U = UriManager in + (* let's check if the arity of the inductive types are well *) + (* formed *) + let ugrap1 = List.fold_left + (fun ugraph (_,_,x,_) -> let _,ugraph' = + type_of ~logger x ugraph in ugraph') + ugraph itl in + + (* let's check if the types of the inductive constructors *) + (* are well formed. *) + (* In order not to use type_of_aux we put the types of the *) + (* mutual inductive types at the head of the types of the *) + (* constructors using Prods *) + let len = List.length itl in + let tys = + List.map (fun (n,_,ty,_) -> Some (Cic.Name n,(Cic.Decl ty))) itl in + let _,ugraph2 = + List.fold_right + (fun (_,_,_,cl) (i,ugraph) -> + let ugraph'' = + List.fold_left + (fun ugraph (name,te) -> + let debrujinedte = debrujin_constructor uri len te in + let augmented_term = + List.fold_right + (fun (name,_,ty,_) i -> Cic.Prod (Cic.Name name, ty, i)) + itl debrujinedte + in + let _,ugraph' = type_of ~logger augmented_term ugraph in + (* let's check also the positivity conditions *) + if + not + (are_all_occurrences_positive tys uri indparamsno i 0 len + debrujinedte) + then + begin + prerr_endline (UriManager.string_of_uri uri); + prerr_endline (string_of_int (List.length tys)); + raise + (TypeCheckerFailure + (lazy ("Non positive occurence in " ^ U.string_of_uri uri))) end + else + ugraph' + ) ugraph cl in + (i + 1),ugraph'' + ) itl (1,ugrap1) + in + ugraph2 + +(* Main function to checks the correctness of a mutual *) +(* inductive block definition. *) +and check_mutual_inductive_defs uri obj ugraph = + match obj with + Cic.InductiveDefinition (itl, params, indparamsno, _) -> + typecheck_mutual_inductive_defs uri (itl,params,indparamsno) ugraph + | _ -> + raise (TypeCheckerFailure ( + lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + +and type_of_mutual_inductive_defs ~logger uri i ugraph = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let cobj,ugraph1 = + match CicEnvironment.is_type_checked ~trust:true ugraph uri with + CicEnvironment.CheckedObj (cobj,ugraph') -> cobj,ugraph' + | CicEnvironment.UncheckedObj uobj -> + logger#log (`Start_type_checking uri) ; + let ugraph1_dust = + check_mutual_inductive_defs ~logger uri uobj ugraph + in + (* TASSI: FIXME: check ugraph1 == ugraph ritornato da env *) + try + CicEnvironment.set_type_checking_info uri ; + logger#log (`Type_checking_completed uri) ; + (match CicEnvironment.is_type_checked ~trust:false ugraph uri with + CicEnvironment.CheckedObj (cobj,ugraph') -> (cobj,ugraph') + | CicEnvironment.UncheckedObj _ -> raise CicEnvironmentError + ) + with + Invalid_argument s -> + (*debug_print (lazy s);*) + uobj,ugraph1_dust + in + match cobj with + C.InductiveDefinition (dl,_,_,_) -> + let (_,_,arity,_) = List.nth dl i in + arity,ugraph1 + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ U.string_of_uri uri))) + +and type_of_mutual_inductive_constr ~logger uri i j ugraph = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let cobj,ugraph1 = + match CicEnvironment.is_type_checked ~trust:true ugraph uri with + CicEnvironment.CheckedObj (cobj,ugraph') -> cobj,ugraph' + | CicEnvironment.UncheckedObj uobj -> + logger#log (`Start_type_checking uri) ; + let ugraph1_dust = + check_mutual_inductive_defs ~logger uri uobj ugraph + in + (* check ugraph1 validity ??? == ugraph' *) + try + CicEnvironment.set_type_checking_info uri ; + logger#log (`Type_checking_completed uri) ; + (match + CicEnvironment.is_type_checked ~trust:false ugraph uri + with + CicEnvironment.CheckedObj (cobj,ugraph') -> cobj,ugraph' + | CicEnvironment.UncheckedObj _ -> + raise CicEnvironmentError) + with + Invalid_argument s -> + (*debug_print (lazy s);*) + uobj,ugraph1_dust + in + match cobj with + C.InductiveDefinition (dl,_,_,_) -> + let (_,_,_,cl) = List.nth dl i in + let (_,ty) = List.nth cl (j-1) in + ty,ugraph1 + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ UriManager.string_of_uri uri))) + +and recursive_args context n nn te = + let module C = Cic in + match CicReduction.whd context te with + C.Rel _ -> [] + | C.Var _ + | C.Meta _ + | C.Sort _ + | C.Implicit _ + | C.Cast _ (*CSC ??? *) -> + raise (AssertFailure (lazy "3")) (* due to type-checking *) + | C.Prod (name,so,de) -> + (not (does_not_occur context n nn so)) :: + (recursive_args ((Some (name,(C.Decl so)))::context) (n+1) (nn + 1) de) + | C.Lambda _ + | C.LetIn _ -> + raise (AssertFailure (lazy "4")) (* due to type-checking *) + | C.Appl _ -> [] + | C.Const _ -> raise (AssertFailure (lazy "5")) + | C.MutInd _ + | C.MutConstruct _ + | C.MutCase _ + | C.Fix _ + | C.CoFix _ -> raise (AssertFailure (lazy "6")) (* due to type-checking *) + +and get_new_safes ~subst context p c rl safes n nn x = + let module C = Cic in + let module U = UriManager in + let module R = CicReduction in + match (R.whd ~subst context c, R.whd ~subst context p, rl) with + (C.Prod (_,so,ta1), C.Lambda (name,_,ta2), b::tl) -> + (* we are sure that the two sources are convertible because we *) + (* have just checked this. So let's go along ... *) + let safes' = + List.map (fun x -> x + 1) safes + in + let safes'' = + if b then 1::safes' else safes' + in + get_new_safes ~subst ((Some (name,(C.Decl so)))::context) + ta2 ta1 tl safes'' (n+1) (nn+1) (x+1) + | (C.Prod _, (C.MutConstruct _ as e), _) + | (C.Prod _, (C.Rel _ as e), _) + | (C.MutInd _, e, []) + | (C.Appl _, e, []) -> (e,safes,n,nn,x,context) + | (c,p,l) -> + (* CSC: If the next exception is raised, it just means that *) + (* CSC: the proof-assistant allows to use very strange things *) + (* CSC: as a branch of a case whose type is a Prod. In *) + (* CSC: particular, this means that a new (C.Prod, x,_) case *) + (* CSC: must be considered in this match. (e.g. x = MutCase) *) + raise + (AssertFailure (lazy + (Printf.sprintf "Get New Safes: c=%s ; p=%s" + (CicPp.ppterm c) (CicPp.ppterm p)))) + +and split_prods ~subst context n te = + let module C = Cic in + let module R = CicReduction in + match (n, R.whd ~subst context te) with + (0, _) -> context,te + | (n, C.Prod (name,so,ta)) when n > 0 -> + split_prods ~subst ((Some (name,(C.Decl so)))::context) (n - 1) ta + | (_, _) -> raise (AssertFailure (lazy "8")) + +and eat_lambdas ~subst context n te = + let module C = Cic in + let module R = CicReduction in + match (n, R.whd ~subst context te) with + (0, _) -> (te, 0, context) + | (n, C.Lambda (name,so,ta)) when n > 0 -> + let (te, k, context') = + eat_lambdas ~subst ((Some (name,(C.Decl so)))::context) (n - 1) ta + in + (te, k + 1, context') + | (n, te) -> + raise (AssertFailure (lazy (sprintf "9 (%d, %s)" n (CicPp.ppterm te)))) + +(*CSC: Tutto quello che segue e' l'intuzione di luca ;-) *) +and check_is_really_smaller_arg ~subst context n nn kl x safes te = + (*CSC: forse la whd si puo' fare solo quando serve veramente. *) + (*CSC: cfr guarded_by_destructors *) + let module C = Cic in + let module U = UriManager in + match CicReduction.whd ~subst context te with + C.Rel m when List.mem m safes -> true + | C.Rel _ -> false + | C.Var _ + | C.Meta _ + | C.Sort _ + | C.Implicit _ + | C.Cast _ +(* | C.Cast (te,ty) -> + check_is_really_smaller_arg ~subst n nn kl x safes te && + check_is_really_smaller_arg ~subst n nn kl x safes ty*) +(* | C.Prod (_,so,ta) -> + check_is_really_smaller_arg ~subst n nn kl x safes so && + check_is_really_smaller_arg ~subst (n+1) (nn+1) kl (x+1) + (List.map (fun x -> x + 1) safes) ta*) + | C.Prod _ -> raise (AssertFailure (lazy "10")) + | C.Lambda (name,so,ta) -> + check_is_really_smaller_arg ~subst context n nn kl x safes so && + check_is_really_smaller_arg ~subst ((Some (name,(C.Decl so)))::context) + (n+1) (nn+1) kl (x+1) (List.map (fun x -> x + 1) safes) ta + | C.LetIn (name,so,ta) -> + check_is_really_smaller_arg ~subst context n nn kl x safes so && + check_is_really_smaller_arg ~subst ((Some (name,(C.Def (so,None))))::context) + (n+1) (nn+1) kl (x+1) (List.map (fun x -> x + 1) safes) ta + | C.Appl (he::_) -> + (*CSC: sulla coda ci vogliono dei controlli? secondo noi no, ma *) + (*CSC: solo perche' non abbiamo trovato controesempi *) + check_is_really_smaller_arg ~subst context n nn kl x safes he + | C.Appl [] -> raise (AssertFailure (lazy "11")) + | C.Const _ + | C.MutInd _ -> raise (AssertFailure (lazy "12")) + | C.MutConstruct _ -> false + | C.MutCase (uri,i,outtype,term,pl) -> + (match term with + C.Rel m when List.mem m safes || m = x -> + let (lefts_and_tys,len,isinductive,paramsno,cl) = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.InductiveDefinition (tl,_,paramsno,_) -> + let tys = + List.map + (fun (n,_,ty,_) -> Some (Cic.Name n,(Cic.Decl ty))) tl + in + let (_,isinductive,_,cl) = List.nth tl i in + let cl' = + List.map + (fun (id,ty) -> + (id, snd (split_prods ~subst tys paramsno ty))) cl in + let lefts = + match tl with + [] -> assert false + | (_,_,ty,_)::_ -> + fst (split_prods ~subst [] paramsno ty) + in + (tys@lefts,List.length tl,isinductive,paramsno,cl') + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + in + if not isinductive then + List.fold_right + (fun p i -> + i && check_is_really_smaller_arg ~subst context n nn kl x safes p) + pl true + else + let pl_and_cl = + try + List.combine pl cl + with + Invalid_argument _ -> + raise (TypeCheckerFailure (lazy "not enough patterns")) + in + List.fold_right + (fun (p,(_,c)) i -> + let rl' = + let debrujinedte = debrujin_constructor uri len c in + recursive_args lefts_and_tys 0 len debrujinedte + in + let (e,safes',n',nn',x',context') = + get_new_safes ~subst context p c rl' safes n nn x + in + i && + check_is_really_smaller_arg ~subst context' n' nn' kl x' safes' e + ) pl_and_cl true + | C.Appl ((C.Rel m)::tl) when List.mem m safes || m = x -> + let (lefts_and_tys,len,isinductive,paramsno,cl) = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.InductiveDefinition (tl,_,paramsno,_) -> + let (_,isinductive,_,cl) = List.nth tl i in + let tys = + List.map (fun (n,_,ty,_) -> + Some(Cic.Name n,(Cic.Decl ty))) tl + in + let cl' = + List.map + (fun (id,ty) -> + (id, snd (split_prods ~subst tys paramsno ty))) cl in + let lefts = + match tl with + [] -> assert false + | (_,_,ty,_)::_ -> + fst (split_prods ~subst [] paramsno ty) + in + (tys@lefts,List.length tl,isinductive,paramsno,cl') + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + in + if not isinductive then + List.fold_right + (fun p i -> + i && check_is_really_smaller_arg ~subst context n nn kl x safes p) + pl true + else + let pl_and_cl = + try + List.combine pl cl + with + Invalid_argument _ -> + raise (TypeCheckerFailure (lazy "not enough patterns")) + in + (*CSC: supponiamo come prima che nessun controllo sia necessario*) + (*CSC: sugli argomenti di una applicazione *) + List.fold_right + (fun (p,(_,c)) i -> + let rl' = + let debrujinedte = debrujin_constructor uri len c in + recursive_args lefts_and_tys 0 len debrujinedte + in + let (e, safes',n',nn',x',context') = + get_new_safes ~subst context p c rl' safes n nn x + in + i && + check_is_really_smaller_arg ~subst context' n' nn' kl x' safes' e + ) pl_and_cl true + | _ -> + List.fold_right + (fun p i -> + i && check_is_really_smaller_arg ~subst context n nn kl x safes p + ) pl true + ) + | C.Fix (_, fl) -> + let len = List.length fl in + let n_plus_len = n + len + and nn_plus_len = nn + len + and x_plus_len = x + len + and tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + and safes' = List.map (fun x -> x + len) safes in + List.fold_right + (fun (_,_,ty,bo) i -> + i && + check_is_really_smaller_arg ~subst (tys@context) n_plus_len nn_plus_len kl + x_plus_len safes' bo + ) fl true + | C.CoFix (_, fl) -> + let len = List.length fl in + let n_plus_len = n + len + and nn_plus_len = nn + len + and x_plus_len = x + len + and tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + and safes' = List.map (fun x -> x + len) safes in + List.fold_right + (fun (_,ty,bo) i -> + i && + check_is_really_smaller_arg ~subst (tys@context) n_plus_len nn_plus_len kl + x_plus_len safes' bo + ) fl true + +and guarded_by_destructors ~subst context n nn kl x safes = + let module C = Cic in + let module U = UriManager in + function + C.Rel m when m > n && m <= nn -> false + | C.Rel m -> + (match List.nth context (n-1) with + Some (_,C.Decl _) -> true + | Some (_,C.Def (bo,_)) -> + guarded_by_destructors ~subst context m nn kl x safes + (CicSubstitution.lift m bo) + | None -> raise (TypeCheckerFailure (lazy "Reference to deleted hypothesis")) + ) + | C.Meta _ + | C.Sort _ + | C.Implicit _ -> true + | C.Cast (te,ty) -> + guarded_by_destructors ~subst context n nn kl x safes te && + guarded_by_destructors ~subst context n nn kl x safes ty + | C.Prod (name,so,ta) -> + guarded_by_destructors ~subst context n nn kl x safes so && + guarded_by_destructors ~subst ((Some (name,(C.Decl so)))::context) + (n+1) (nn+1) kl (x+1) (List.map (fun x -> x + 1) safes) ta + | C.Lambda (name,so,ta) -> + guarded_by_destructors ~subst context n nn kl x safes so && + guarded_by_destructors ~subst ((Some (name,(C.Decl so)))::context) + (n+1) (nn+1) kl (x+1) (List.map (fun x -> x + 1) safes) ta + | C.LetIn (name,so,ta) -> + guarded_by_destructors ~subst context n nn kl x safes so && + guarded_by_destructors ~subst ((Some (name,(C.Def (so,None))))::context) + (n+1) (nn+1) kl (x+1) (List.map (fun x -> x + 1) safes) ta + | C.Appl ((C.Rel m)::tl) when m > n && m <= nn -> + let k = List.nth kl (m - n - 1) in + if not (List.length tl > k) then false + else + List.fold_right + (fun param i -> + i && guarded_by_destructors ~subst context n nn kl x safes param + ) tl true && + check_is_really_smaller_arg ~subst context n nn kl x safes (List.nth tl k) + | C.Appl tl -> + List.fold_right + (fun t i -> i && guarded_by_destructors ~subst context n nn kl x safes t) + tl true + | C.Var (_,exp_named_subst) + | C.Const (_,exp_named_subst) + | C.MutInd (_,_,exp_named_subst) + | C.MutConstruct (_,_,_,exp_named_subst) -> + List.fold_right + (fun (_,t) i -> i && guarded_by_destructors ~subst context n nn kl x safes t) + exp_named_subst true + | C.MutCase (uri,i,outtype,term,pl) -> + (match CicReduction.whd ~subst context term with + C.Rel m when List.mem m safes || m = x -> + let (lefts_and_tys,len,isinductive,paramsno,cl) = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.InductiveDefinition (tl,_,paramsno,_) -> + let len = List.length tl in + let (_,isinductive,_,cl) = List.nth tl i in + let tys = + List.map (fun (n,_,ty,_) -> + Some(Cic.Name n,(Cic.Decl ty))) tl + in + let cl' = + List.map + (fun (id,ty) -> + let debrujinedty = debrujin_constructor uri len ty in + (id, snd (split_prods ~subst tys paramsno ty), + snd (split_prods ~subst tys paramsno debrujinedty) + )) cl in + let lefts = + match tl with + [] -> assert false + | (_,_,ty,_)::_ -> + fst (split_prods ~subst [] paramsno ty) + in + (tys@lefts,len,isinductive,paramsno,cl') + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + in + if not isinductive then + guarded_by_destructors ~subst context n nn kl x safes outtype && + guarded_by_destructors ~subst context n nn kl x safes term && + (*CSC: manca ??? il controllo sul tipo di term? *) + List.fold_right + (fun p i -> + i && guarded_by_destructors ~subst context n nn kl x safes p) + pl true + else + let pl_and_cl = + try + List.combine pl cl + with + Invalid_argument _ -> + raise (TypeCheckerFailure (lazy "not enough patterns")) + in + guarded_by_destructors ~subst context n nn kl x safes outtype && + (*CSC: manca ??? il controllo sul tipo di term? *) + List.fold_right + (fun (p,(_,c,brujinedc)) i -> + let rl' = recursive_args lefts_and_tys 0 len brujinedc in + let (e,safes',n',nn',x',context') = + get_new_safes ~subst context p c rl' safes n nn x + in + i && + guarded_by_destructors ~subst context' n' nn' kl x' safes' e + ) pl_and_cl true + | C.Appl ((C.Rel m)::tl) when List.mem m safes || m = x -> + let (lefts_and_tys,len,isinductive,paramsno,cl) = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.InductiveDefinition (tl,_,paramsno,_) -> + let (_,isinductive,_,cl) = List.nth tl i in + let tys = + List.map + (fun (n,_,ty,_) -> Some(Cic.Name n,(Cic.Decl ty))) tl + in + let cl' = + List.map + (fun (id,ty) -> + (id, snd (split_prods ~subst tys paramsno ty))) cl in + let lefts = + match tl with + [] -> assert false + | (_,_,ty,_)::_ -> + fst (split_prods ~subst [] paramsno ty) + in + (tys@lefts,List.length tl,isinductive,paramsno,cl') + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + in + if not isinductive then + guarded_by_destructors ~subst context n nn kl x safes outtype && + guarded_by_destructors ~subst context n nn kl x safes term && + (*CSC: manca ??? il controllo sul tipo di term? *) + List.fold_right + (fun p i -> + i && guarded_by_destructors ~subst context n nn kl x safes p) + pl true + else + let pl_and_cl = + try + List.combine pl cl + with + Invalid_argument _ -> + raise (TypeCheckerFailure (lazy "not enough patterns")) + in + guarded_by_destructors ~subst context n nn kl x safes outtype && + (*CSC: manca ??? il controllo sul tipo di term? *) + List.fold_right + (fun t i -> + i && guarded_by_destructors ~subst context n nn kl x safes t) + tl true && + List.fold_right + (fun (p,(_,c)) i -> + let rl' = + let debrujinedte = debrujin_constructor uri len c in + recursive_args lefts_and_tys 0 len debrujinedte + in + let (e, safes',n',nn',x',context') = + get_new_safes ~subst context p c rl' safes n nn x + in + i && + guarded_by_destructors ~subst context' n' nn' kl x' safes' e + ) pl_and_cl true + | _ -> + guarded_by_destructors ~subst context n nn kl x safes outtype && + guarded_by_destructors ~subst context n nn kl x safes term && + (*CSC: manca ??? il controllo sul tipo di term? *) + List.fold_right + (fun p i -> i && guarded_by_destructors ~subst context n nn kl x safes p) + pl true + ) + | C.Fix (_, fl) -> + let len = List.length fl in + let n_plus_len = n + len + and nn_plus_len = nn + len + and x_plus_len = x + len + and tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + and safes' = List.map (fun x -> x + len) safes in + List.fold_right + (fun (_,_,ty,bo) i -> + i && guarded_by_destructors ~subst context n nn kl x_plus_len safes' ty && + guarded_by_destructors ~subst (tys@context) n_plus_len nn_plus_len kl + x_plus_len safes' bo + ) fl true + | C.CoFix (_, fl) -> + let len = List.length fl in + let n_plus_len = n + len + and nn_plus_len = nn + len + and x_plus_len = x + len + and tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + and safes' = List.map (fun x -> x + len) safes in + List.fold_right + (fun (_,ty,bo) i -> + i && + guarded_by_destructors ~subst context n nn kl x_plus_len safes' ty && + guarded_by_destructors ~subst (tys@context) n_plus_len nn_plus_len kl + x_plus_len safes' bo + ) fl true + +(* the boolean h means already protected *) +(* args is the list of arguments the type of the constructor that may be *) +(* found in head position must be applied to. *) +and guarded_by_constructors ~subst context n nn h te args coInductiveTypeURI = + let module C = Cic in + (*CSC: There is a lot of code replication between the cases X and *) + (*CSC: (C.Appl X tl). Maybe it will be better to define a function *) + (*CSC: that maps X into (C.Appl X []) when X is not already a C.Appl *) + match CicReduction.whd ~subst context te with + C.Rel m when m > n && m <= nn -> h + | C.Rel _ -> true + | C.Meta _ + | C.Sort _ + | C.Implicit _ + | C.Cast _ + | C.Prod _ + | C.LetIn _ -> + (* the term has just been type-checked *) + raise (AssertFailure (lazy "17")) + | C.Lambda (name,so,de) -> + does_not_occur ~subst context n nn so && + guarded_by_constructors ~subst ((Some (name,(C.Decl so)))::context) + (n + 1) (nn + 1) h de args coInductiveTypeURI + | C.Appl ((C.Rel m)::tl) when m > n && m <= nn -> + h && + List.fold_right (fun x i -> i && does_not_occur ~subst context n nn x) tl true + | C.Appl ((C.MutConstruct (uri,i,j,exp_named_subst))::tl) -> + let consty = + let obj,_ = + try + CicEnvironment.get_cooked_obj ~trust:false CicUniv.empty_ugraph uri + with Not_found -> assert false + in + match obj with + C.InductiveDefinition (itl,_,_,_) -> + let (_,_,_,cl) = List.nth itl i in + let (_,cons) = List.nth cl (j - 1) in + CicSubstitution.subst_vars exp_named_subst cons + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ UriManager.string_of_uri uri))) + in + let rec analyse_branch context ty te = + match CicReduction.whd ~subst context ty with + C.Meta _ -> raise (AssertFailure (lazy "34")) + | C.Rel _ + | C.Var _ + | C.Sort _ -> + does_not_occur ~subst context n nn te + | C.Implicit _ + | C.Cast _ -> + raise (AssertFailure (lazy "24"))(* due to type-checking *) + | C.Prod (name,so,de) -> + analyse_branch ((Some (name,(C.Decl so)))::context) de te + | C.Lambda _ + | C.LetIn _ -> + raise (AssertFailure (lazy "25"))(* due to type-checking *) + | C.Appl ((C.MutInd (uri,_,_))::_) when uri == coInductiveTypeURI -> + guarded_by_constructors ~subst context n nn true te [] + coInductiveTypeURI + | C.Appl ((C.MutInd (uri,_,_))::_) -> + guarded_by_constructors ~subst context n nn true te tl + coInductiveTypeURI + | C.Appl _ -> + does_not_occur ~subst context n nn te + | C.Const _ -> raise (AssertFailure (lazy "26")) + | C.MutInd (uri,_,_) when uri == coInductiveTypeURI -> + guarded_by_constructors ~subst context n nn true te [] + coInductiveTypeURI + | C.MutInd _ -> + does_not_occur ~subst context n nn te + | C.MutConstruct _ -> raise (AssertFailure (lazy "27")) + (*CSC: we do not consider backbones with a MutCase, Fix, Cofix *) + (*CSC: in head position. *) + | C.MutCase _ + | C.Fix _ + | C.CoFix _ -> + raise (AssertFailure (lazy "28"))(* due to type-checking *) + in + let rec analyse_instantiated_type context ty l = + match CicReduction.whd ~subst context ty with + C.Rel _ + | C.Var _ + | C.Meta _ + | C.Sort _ + | C.Implicit _ + | C.Cast _ -> raise (AssertFailure (lazy "29"))(* due to type-checking *) + | C.Prod (name,so,de) -> + begin + match l with + [] -> true + | he::tl -> + analyse_branch context so he && + analyse_instantiated_type + ((Some (name,(C.Decl so)))::context) de tl + end + | C.Lambda _ + | C.LetIn _ -> + raise (AssertFailure (lazy "30"))(* due to type-checking *) + | C.Appl _ -> + List.fold_left + (fun i x -> i && does_not_occur ~subst context n nn x) true l + | C.Const _ -> raise (AssertFailure (lazy "31")) + | C.MutInd _ -> + List.fold_left + (fun i x -> i && does_not_occur ~subst context n nn x) true l + | C.MutConstruct _ -> raise (AssertFailure (lazy "32")) + (*CSC: we do not consider backbones with a MutCase, Fix, Cofix *) + (*CSC: in head position. *) + | C.MutCase _ + | C.Fix _ + | C.CoFix _ -> + raise (AssertFailure (lazy "33"))(* due to type-checking *) + in + let rec instantiate_type args consty = + function + [] -> true + | tlhe::tltl as l -> + let consty' = CicReduction.whd ~subst context consty in + match args with + he::tl -> + begin + match consty' with + C.Prod (_,_,de) -> + let instantiated_de = CicSubstitution.subst he de in + (*CSC: siamo sicuri che non sia troppo forte? *) + does_not_occur ~subst context n nn tlhe & + instantiate_type tl instantiated_de tltl + | _ -> + (*CSC:We do not consider backbones with a MutCase, a *) + (*CSC:FixPoint, a CoFixPoint and so on in head position.*) + raise (AssertFailure (lazy "23")) + end + | [] -> analyse_instantiated_type context consty' l + (* These are all the other cases *) + in + instantiate_type args consty tl + | C.Appl ((C.CoFix (_,fl))::tl) -> + List.fold_left (fun i x -> i && does_not_occur ~subst context n nn x) true tl && + let len = List.length fl in + let n_plus_len = n + len + and nn_plus_len = nn + len + (*CSC: Is a Decl of the ty ok or should I use Def of a Fix? *) + and tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + List.fold_right + (fun (_,ty,bo) i -> + i && does_not_occur ~subst context n nn ty && + guarded_by_constructors ~subst (tys@context) n_plus_len nn_plus_len + h bo args coInductiveTypeURI + ) fl true + | C.Appl ((C.MutCase (_,_,out,te,pl))::tl) -> + List.fold_left (fun i x -> i && does_not_occur ~subst context n nn x) true tl && + does_not_occur ~subst context n nn out && + does_not_occur ~subst context n nn te && + List.fold_right + (fun x i -> + i && + guarded_by_constructors ~subst context n nn h x args + coInductiveTypeURI + ) pl true + | C.Appl l -> + List.fold_right (fun x i -> i && does_not_occur ~subst context n nn x) l true + | C.Var (_,exp_named_subst) + | C.Const (_,exp_named_subst) -> + List.fold_right + (fun (_,x) i -> i && does_not_occur ~subst context n nn x) exp_named_subst true + | C.MutInd _ -> assert false + | C.MutConstruct (_,_,_,exp_named_subst) -> + List.fold_right + (fun (_,x) i -> i && does_not_occur ~subst context n nn x) exp_named_subst true + | C.MutCase (_,_,out,te,pl) -> + does_not_occur ~subst context n nn out && + does_not_occur ~subst context n nn te && + List.fold_right + (fun x i -> + i && + guarded_by_constructors ~subst context n nn h x args + coInductiveTypeURI + ) pl true + | C.Fix (_,fl) -> + let len = List.length fl in + let n_plus_len = n + len + and nn_plus_len = nn + len + (*CSC: Is a Decl of the ty ok or should I use Def of a Fix? *) + and tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + List.fold_right + (fun (_,_,ty,bo) i -> + i && does_not_occur ~subst context n nn ty && + does_not_occur ~subst (tys@context) n_plus_len nn_plus_len bo + ) fl true + | C.CoFix (_,fl) -> + let len = List.length fl in + let n_plus_len = n + len + and nn_plus_len = nn + len + (*CSC: Is a Decl of the ty ok or should I use Def of a Fix? *) + and tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + List.fold_right + (fun (_,ty,bo) i -> + i && does_not_occur ~subst context n nn ty && + guarded_by_constructors ~subst (tys@context) n_plus_len nn_plus_len + h bo + args coInductiveTypeURI + ) fl true + +and check_allowed_sort_elimination ~subst ~metasenv ~logger context uri i + need_dummy ind arity1 arity2 ugraph = + let module C = Cic in + let module U = UriManager in + let arity1 = CicReduction.whd ~subst context arity1 in + let rec check_allowed_sort_elimination_aux ugraph context arity2 need_dummy = + match arity1, CicReduction.whd ~subst context arity2 with + (C.Prod (_,so1,de1), C.Prod (_,so2,de2)) -> + let b,ugraph1 = + CicReduction.are_convertible ~subst ~metasenv context so1 so2 ugraph in + if b then + check_allowed_sort_elimination ~subst ~metasenv ~logger context uri i + need_dummy (C.Appl [CicSubstitution.lift 1 ind ; C.Rel 1]) de1 de2 + ugraph1 + else + false,ugraph1 + | (C.Sort _, C.Prod (name,so,ta)) when not need_dummy -> + let b,ugraph1 = + CicReduction.are_convertible ~subst ~metasenv context so ind ugraph in + if not b then + false,ugraph1 + else + check_allowed_sort_elimination_aux ugraph1 + ((Some (name,C.Decl so))::context) ta true + | (C.Sort C.Prop, C.Sort C.Prop) when need_dummy -> true,ugraph + | (C.Sort C.Prop, C.Sort C.Set) + | (C.Sort C.Prop, C.Sort C.CProp) + | (C.Sort C.Prop, C.Sort (C.Type _) ) when need_dummy -> + (let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.InductiveDefinition (itl,_,paramsno,_) -> + let itl_len = List.length itl in + let (name,_,ty,cl) = List.nth itl i in + let cl_len = List.length cl in + if (cl_len = 0 || (itl_len = 1 && cl_len = 1)) then + let non_informative,ugraph = + if cl_len = 0 then true,ugraph + else + is_non_informative ~logger [Some (C.Name name,C.Decl ty)] + paramsno (snd (List.nth cl 0)) ugraph + in + (* is it a singleton or empty non recursive and non informative + definition? *) + non_informative, ugraph + else + false,ugraph + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + ) + | (C.Sort C.Set, C.Sort C.Prop) when need_dummy -> true , ugraph + | (C.Sort C.CProp, C.Sort C.Prop) when need_dummy -> true , ugraph + | (C.Sort C.Set, C.Sort C.Set) when need_dummy -> true , ugraph + | (C.Sort C.Set, C.Sort C.CProp) when need_dummy -> true , ugraph + | (C.Sort C.CProp, C.Sort C.Set) when need_dummy -> true , ugraph + | (C.Sort C.CProp, C.Sort C.CProp) when need_dummy -> true , ugraph + | ((C.Sort C.Set, C.Sort (C.Type _)) | (C.Sort C.CProp, C.Sort (C.Type _))) + when need_dummy -> + (let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.InductiveDefinition (itl,_,paramsno,_) -> + let tys = + List.map (fun (n,_,ty,_) -> Some (Cic.Name n,(Cic.Decl ty))) itl + in + let (_,_,_,cl) = List.nth itl i in + (List.fold_right + (fun (_,x) (i,ugraph) -> + if i then + is_small ~logger tys paramsno x ugraph + else + false,ugraph + ) cl (true,ugraph)) + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + ) + | (C.Sort (C.Type _), C.Sort _) when need_dummy -> true , ugraph + | (_,_) -> false,ugraph + in + check_allowed_sort_elimination_aux ugraph context arity2 need_dummy + +and type_of_branch ~subst context argsno need_dummy outtype term constype = + let module C = Cic in + let module R = CicReduction in + match R.whd ~subst context constype with + C.MutInd (_,_,_) -> + if need_dummy then + outtype + else + C.Appl [outtype ; term] + | C.Appl (C.MutInd (_,_,_)::tl) -> + let (_,arguments) = split tl argsno + in + if need_dummy && arguments = [] then + outtype + else + C.Appl (outtype::arguments@(if need_dummy then [] else [term])) + | C.Prod (name,so,de) -> + let term' = + match CicSubstitution.lift 1 term with + C.Appl l -> C.Appl (l@[C.Rel 1]) + | t -> C.Appl [t ; C.Rel 1] + in + C.Prod (name,so,type_of_branch ~subst + ((Some (name,(C.Decl so)))::context) argsno need_dummy + (CicSubstitution.lift 1 outtype) term' de) + | _ -> raise (AssertFailure (lazy "20")) + +(* check_metasenv_consistency checks that the "canonical" context of a +metavariable is consitent - up to relocation via the relocation list l - +with the actual context *) + + +and check_metasenv_consistency ~logger ~subst metasenv context + canonical_context l ugraph += + let module C = Cic in + let module R = CicReduction in + let module S = CicSubstitution in + let lifted_canonical_context = + let rec aux i = + function + [] -> [] + | (Some (n,C.Decl t))::tl -> + (Some (n,C.Decl (S.subst_meta l (S.lift i t))))::(aux (i+1) tl) + | (Some (n,C.Def (t,None)))::tl -> + (Some (n,C.Def ((S.subst_meta l (S.lift i t)),None)))::(aux (i+1) tl) + | None::tl -> None::(aux (i+1) tl) + | (Some (n,C.Def (t,Some ty)))::tl -> + (Some (n,C.Def ((S.subst_meta l (S.lift i t)),Some (S.subst_meta l (S.lift i ty)))))::(aux (i+1) tl) + in + aux 1 canonical_context + in + List.fold_left2 + (fun ugraph t ct -> + match (t,ct) with + | _,None -> ugraph + | Some t,Some (_,C.Def (ct,_)) -> + let b,ugraph1 = + R.are_convertible ~subst ~metasenv context t ct ugraph + in + if not b then + raise + (TypeCheckerFailure + (lazy (sprintf "Not well typed metavariable local context: expected a term convertible with %s, found %s" (CicPp.ppterm ct) (CicPp.ppterm t)))) + else + ugraph1 + | Some t,Some (_,C.Decl ct) -> + let type_t,ugraph1 = + type_of_aux' ~logger ~subst metasenv context t ugraph + in + let b,ugraph2 = + R.are_convertible ~subst ~metasenv context type_t ct ugraph1 + in + if not b then + raise (TypeCheckerFailure + (lazy (sprintf "Not well typed metavariable local context: expected a term of type %s, found %s of type %s" + (CicPp.ppterm ct) (CicPp.ppterm t) + (CicPp.ppterm type_t)))) + else + ugraph2 + | None, _ -> + raise (TypeCheckerFailure + (lazy ("Not well typed metavariable local context: "^ + "an hypothesis, that is not hidden, is not instantiated"))) + ) ugraph l lifted_canonical_context + + +(* + type_of_aux' is just another name (with a different scope) + for type_of_aux +*) + +and type_of_aux' ~logger ?(subst = []) metasenv context t ugraph = + let rec type_of_aux ~logger context t ugraph = + let module C = Cic in + let module R = CicReduction in + let module S = CicSubstitution in + let module U = UriManager in + match t with + C.Rel n -> + (try + match List.nth context (n - 1) with + Some (_,C.Decl t) -> S.lift n t,ugraph + | Some (_,C.Def (_,Some ty)) -> S.lift n ty,ugraph + | Some (_,C.Def (bo,None)) -> + debug_print (lazy "##### CASO DA INVESTIGARE E CAPIRE") ; + type_of_aux ~logger context (S.lift n bo) ugraph + | None -> raise + (TypeCheckerFailure (lazy "Reference to deleted hypothesis")) + with + Failure _ -> + raise (TypeCheckerFailure (lazy "unbound variable")) + ) + | C.Var (uri,exp_named_subst) -> + incr fdebug ; + let ugraph1 = + check_exp_named_subst ~logger ~subst context exp_named_subst ugraph + in + let ty,ugraph2 = type_of_variable ~logger uri ugraph1 in + let ty1 = CicSubstitution.subst_vars exp_named_subst ty in + decr fdebug ; + ty1,ugraph2 + | C.Meta (n,l) -> + (try + let (canonical_context,term,ty) = CicUtil.lookup_subst n subst in + let ugraph1 = + check_metasenv_consistency ~logger + ~subst metasenv context canonical_context l ugraph + in + (* assuming subst is well typed !!!!! *) + ((CicSubstitution.subst_meta l ty), ugraph1) + (* type_of_aux context (CicSubstitution.subst_meta l term) *) + with CicUtil.Subst_not_found _ -> + let (_,canonical_context,ty) = CicUtil.lookup_meta n metasenv in + let ugraph1 = + check_metasenv_consistency ~logger + ~subst metasenv context canonical_context l ugraph + in + ((CicSubstitution.subst_meta l ty),ugraph1)) + (* TASSI: CONSTRAINTS *) + | C.Sort (C.Type t) -> + let t' = CicUniv.fresh() in + (try + let ugraph1 = CicUniv.add_gt t' t ugraph in + (C.Sort (C.Type t')),ugraph1 + with + CicUniv.UniverseInconsistency msg -> raise (TypeCheckerFailure msg)) + | C.Sort s -> (C.Sort (C.Type (CicUniv.fresh ()))),ugraph + | C.Implicit _ -> raise (AssertFailure (lazy "Implicit found")) + | C.Cast (te,ty) as t -> + let _,ugraph1 = type_of_aux ~logger context ty ugraph in + let ty_te,ugraph2 = type_of_aux ~logger context te ugraph1 in + let b,ugraph3 = + R.are_convertible ~subst ~metasenv context ty_te ty ugraph2 + in + if b then + ty,ugraph3 + else + raise (TypeCheckerFailure + (lazy (sprintf "Invalid cast %s" (CicPp.ppterm t)))) + | C.Prod (name,s,t) -> + let sort1,ugraph1 = type_of_aux ~logger context s ugraph in + let sort2,ugraph2 = + type_of_aux ~logger ((Some (name,(C.Decl s)))::context) t ugraph1 + in + sort_of_prod ~subst context (name,s) (sort1,sort2) ugraph2 + | C.Lambda (n,s,t) -> + let sort1,ugraph1 = type_of_aux ~logger context s ugraph in + (match R.whd ~subst context sort1 with + C.Meta _ + | C.Sort _ -> () + | _ -> + raise + (TypeCheckerFailure (lazy (sprintf + "Not well-typed lambda-abstraction: the source %s should be a type; instead it is a term of type %s" (CicPp.ppterm s) + (CicPp.ppterm sort1)))) + ) ; + let type2,ugraph2 = + type_of_aux ~logger ((Some (n,(C.Decl s)))::context) t ugraph1 + in + (C.Prod (n,s,type2)),ugraph2 + | C.LetIn (n,s,t) -> + (* only to check if s is well-typed *) + let ty,ugraph1 = type_of_aux ~logger context s ugraph in + (* The type of a LetIn is a LetIn. Extremely slow since the computed + LetIn is later reduced and maybe also re-checked. + (C.LetIn (n,s, type_of_aux ((Some (n,(C.Def s)))::context) t)) + *) + (* The type of the LetIn is reduced. Much faster than the previous + solution. Moreover the inferred type is probably very different + from the expected one. + (CicReduction.whd ~subst context + (C.LetIn (n,s, type_of_aux ((Some (n,(C.Def s)))::context) t))) + *) + (* One-step LetIn reduction. Even faster than the previous solution. + Moreover the inferred type is closer to the expected one. *) + let ty1,ugraph2 = + type_of_aux ~logger + ((Some (n,(C.Def (s,Some ty))))::context) t ugraph1 + in + (CicSubstitution.subst ~avoid_beta_redexes:true s ty1),ugraph2 + | C.Appl (he::tl) when List.length tl > 0 -> + let hetype,ugraph1 = type_of_aux ~logger context he ugraph in + let tlbody_and_type,ugraph2 = + List.fold_right ( + fun x (l,ugraph) -> + let ty,ugraph1 = type_of_aux ~logger context x ugraph in + let _,ugraph1 = type_of_aux ~logger context ty ugraph1 in + ((x,ty)::l,ugraph1)) + tl ([],ugraph1) + in + (* TASSI: questa c'era nel mio... ma non nel CVS... *) + (* let _,ugraph2 = type_of_aux context hetype ugraph2 in *) + eat_prods ~subst context hetype tlbody_and_type ugraph2 + | C.Appl _ -> raise (AssertFailure (lazy "Appl: no arguments")) + | C.Const (uri,exp_named_subst) -> + incr fdebug ; + let ugraph1 = + check_exp_named_subst ~logger ~subst context exp_named_subst ugraph + in + let cty,ugraph2 = type_of_constant ~logger uri ugraph1 in + let cty1 = + CicSubstitution.subst_vars exp_named_subst cty + in + decr fdebug ; + cty1,ugraph2 + | C.MutInd (uri,i,exp_named_subst) -> + incr fdebug ; + let ugraph1 = + check_exp_named_subst ~logger ~subst context exp_named_subst ugraph + in + (* TASSI: da me c'era anche questa, ma in CVS no *) + let mty,ugraph2 = type_of_mutual_inductive_defs ~logger uri i ugraph1 in + (* fine parte dubbia *) + let cty = + CicSubstitution.subst_vars exp_named_subst mty + in + decr fdebug ; + cty,ugraph2 + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let ugraph1 = + check_exp_named_subst ~logger ~subst context exp_named_subst ugraph + in + (* TASSI: idem come sopra *) + let mty,ugraph2 = + type_of_mutual_inductive_constr ~logger uri i j ugraph1 + in + let cty = + CicSubstitution.subst_vars exp_named_subst mty + in + cty,ugraph2 + | C.MutCase (uri,i,outtype,term,pl) -> + let outsort,ugraph1 = type_of_aux ~logger context outtype ugraph in + let (need_dummy, k) = + let rec guess_args context t = + let outtype = CicReduction.whd ~subst context t in + match outtype with + C.Sort _ -> (true, 0) + | C.Prod (name, s, t) -> + let (b, n) = + guess_args ((Some (name,(C.Decl s)))::context) t in + if n = 0 then + (* last prod before sort *) + match CicReduction.whd ~subst context s with +(*CSC: for _ see comment below about the missing named_exp_subst ?????????? *) + C.MutInd (uri',i',_) when U.eq uri' uri && i' = i -> + (false, 1) +(*CSC: for _ see comment below about the missing named_exp_subst ?????????? *) + | C.Appl ((C.MutInd (uri',i',_)) :: _) + when U.eq uri' uri && i' = i -> (false, 1) + | _ -> (true, 1) + else + (b, n + 1) + | _ -> + raise + (TypeCheckerFailure + (lazy (sprintf + "Malformed case analasys' output type %s" + (CicPp.ppterm outtype)))) + in +(* + let (parameters, arguments, exp_named_subst),ugraph2 = + let ty,ugraph2 = type_of_aux context term ugraph1 in + match R.whd ~subst context ty with + (*CSC manca il caso dei CAST *) +(*CSC: ma servono i parametri (uri,i)? Se si', perche' non serve anche il *) +(*CSC: parametro exp_named_subst? Se no, perche' non li togliamo? *) +(*CSC: Hint: nella DTD servono per gli stylesheet. *) + C.MutInd (uri',i',exp_named_subst) as typ -> + if U.eq uri uri' && i = i' then + ([],[],exp_named_subst),ugraph2 + else + raise + (TypeCheckerFailure + (lazy (sprintf + ("Case analysys: analysed term type is %s, but is expected to be (an application of) %s#1/%d{_}") + (CicPp.ppterm typ) (U.string_of_uri uri) i))) + | C.Appl + ((C.MutInd (uri',i',exp_named_subst) as typ):: tl) as typ' -> + if U.eq uri uri' && i = i' then + let params,args = + split tl (List.length tl - k) + in (params,args,exp_named_subst),ugraph2 + else + raise + (TypeCheckerFailure + (lazy (sprintf + ("Case analysys: analysed term type is %s, "^ + "but is expected to be (an application of) "^ + "%s#1/%d{_}") + (CicPp.ppterm typ') (U.string_of_uri uri) i))) + | _ -> + raise + (TypeCheckerFailure + (lazy (sprintf + ("Case analysis: "^ + "analysed term %s is not an inductive one") + (CicPp.ppterm term)))) +*) + let (b, k) = guess_args context outsort in + if not b then (b, k - 1) else (b, k) in + let (parameters, arguments, exp_named_subst),ugraph2 = + let ty,ugraph2 = type_of_aux ~logger context term ugraph1 in + match R.whd ~subst context ty with + C.MutInd (uri',i',exp_named_subst) as typ -> + if U.eq uri uri' && i = i' then + ([],[],exp_named_subst),ugraph2 + else raise + (TypeCheckerFailure + (lazy (sprintf + ("Case analysys: analysed term type is %s (%s#1/%d{_}), but is expected to be (an application of) %s#1/%d{_}") + (CicPp.ppterm typ) (U.string_of_uri uri') i' (U.string_of_uri uri) i))) + | C.Appl ((C.MutInd (uri',i',exp_named_subst) as typ):: tl) -> + if U.eq uri uri' && i = i' then + let params,args = + split tl (List.length tl - k) + in (params,args,exp_named_subst),ugraph2 + else raise + (TypeCheckerFailure + (lazy (sprintf + ("Case analysys: analysed term type is %s (%s#1/%d{_}), but is expected to be (an application of) %s#1/%d{_}") + (CicPp.ppterm typ) (U.string_of_uri uri') i' (U.string_of_uri uri) i))) + | _ -> + raise + (TypeCheckerFailure + (lazy (sprintf + "Case analysis: analysed term %s is not an inductive one" + (CicPp.ppterm term)))) + in + (* + let's control if the sort elimination is allowed: + [(I q1 ... qr)|B] + *) + let sort_of_ind_type = + if parameters = [] then + C.MutInd (uri,i,exp_named_subst) + else + C.Appl ((C.MutInd (uri,i,exp_named_subst))::parameters) + in + let type_of_sort_of_ind_ty,ugraph3 = + type_of_aux ~logger context sort_of_ind_type ugraph2 in + let b,ugraph4 = + check_allowed_sort_elimination ~subst ~metasenv ~logger context uri i + need_dummy sort_of_ind_type type_of_sort_of_ind_ty outsort ugraph3 + in + if not b then + raise + (TypeCheckerFailure (lazy ("Case analysis: sort elimination not allowed"))); + (* let's check if the type of branches are right *) + let parsno,constructorsno = + let obj,_ = + try + CicEnvironment.get_cooked_obj ~trust:false CicUniv.empty_ugraph uri + with Not_found -> assert false + in + match obj with + C.InductiveDefinition (il,_,parsno,_) -> + let _,_,_,cl = + try List.nth il i with Failure _ -> assert false + in + parsno, List.length cl + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + in + if List.length pl <> constructorsno then + raise (TypeCheckerFailure + (lazy ("Wrong number of cases in case analysis"))) ; + let (_,branches_ok,ugraph5) = + List.fold_left + (fun (j,b,ugraph) p -> + if b then + let cons = + if parameters = [] then + (C.MutConstruct (uri,i,j,exp_named_subst)) + else + (C.Appl + (C.MutConstruct (uri,i,j,exp_named_subst)::parameters)) + in + let ty_p,ugraph1 = type_of_aux ~logger context p ugraph in + let ty_cons,ugraph3 = type_of_aux ~logger context cons ugraph1 in + (* 2 is skipped *) + let ty_branch = + type_of_branch ~subst context parsno need_dummy outtype cons + ty_cons in + let b1,ugraph4 = + R.are_convertible + ~subst ~metasenv context ty_p ty_branch ugraph3 + in +(* Debugging code +if not b1 then +begin +prerr_endline ("\n!OUTTYPE= " ^ CicPp.ppterm outtype); +prerr_endline ("!CONS= " ^ CicPp.ppterm cons); +prerr_endline ("!TY_CONS= " ^ CicPp.ppterm ty_cons); +prerr_endline ("#### " ^ CicPp.ppterm ty_p ^ "\n<==>\n" ^ CicPp.ppterm ty_branch); +end; +*) + if not b1 then + debug_print (lazy + ("#### " ^ CicPp.ppterm ty_p ^ + " <==> " ^ CicPp.ppterm ty_branch)); + (j + 1,b1,ugraph4) + else + (j,false,ugraph) + ) (1,true,ugraph4) pl + in + if not branches_ok then + raise + (TypeCheckerFailure (lazy "Case analysys: wrong branch type")); + let arguments' = + if not need_dummy then outtype::arguments@[term] + else outtype::arguments in + let outtype = + if need_dummy && arguments = [] then outtype + else CicReduction.head_beta_reduce (C.Appl arguments') + in + outtype,ugraph5 + | C.Fix (i,fl) -> + let types,kl,ugraph1,len = + List.fold_left + (fun (types,kl,ugraph,len) (n,k,ty,_) -> + let _,ugraph1 = type_of_aux ~logger context ty ugraph in + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + k::kl,ugraph1,len+1) + ) ([],[],ugraph,0) fl + in + let ugraph2 = + List.fold_left + (fun ugraph (name,x,ty,bo) -> + let ty_bo,ugraph1 = + type_of_aux ~logger (types@context) bo ugraph + in + let b,ugraph2 = + R.are_convertible ~subst ~metasenv (types@context) + ty_bo (CicSubstitution.lift len ty) ugraph1 in + if b then + begin + let (m, eaten, context') = + eat_lambdas ~subst (types @ context) (x + 1) bo + in + (* + let's control the guarded by + destructors conditions D{f,k,x,M} + *) + if not (guarded_by_destructors ~subst context' eaten + (len + eaten) kl 1 [] m) then + raise + (TypeCheckerFailure + (lazy ("Fix: not guarded by destructors"))) + else + ugraph2 + end + else + raise (TypeCheckerFailure (lazy ("Fix: ill-typed bodies"))) + ) ugraph1 fl in + (*CSC: controlli mancanti solo su D{f,k,x,M} *) + let (_,_,ty,_) = List.nth fl i in + ty,ugraph2 + | C.CoFix (i,fl) -> + let types,ugraph1,len = + List.fold_left + (fun (l,ugraph,len) (n,ty,_) -> + let _,ugraph1 = + type_of_aux ~logger context ty ugraph in + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::l, + ugraph1,len+1) + ) ([],ugraph,0) fl + in + let ugraph2 = + List.fold_left + (fun ugraph (_,ty,bo) -> + let ty_bo,ugraph1 = + type_of_aux ~logger (types @ context) bo ugraph + in + let b,ugraph2 = + R.are_convertible ~subst ~metasenv (types @ context) ty_bo + (CicSubstitution.lift len ty) ugraph1 + in + if b then + begin + (* let's control that the returned type is coinductive *) + match returns_a_coinductive ~subst context ty with + None -> + raise + (TypeCheckerFailure + (lazy "CoFix: does not return a coinductive type")) + | Some uri -> + (* + let's control the guarded by constructors + conditions C{f,M} + *) + if not (guarded_by_constructors ~subst + (types @ context) 0 len false bo [] uri) then + raise + (TypeCheckerFailure + (lazy "CoFix: not guarded by constructors")) + else + ugraph2 + end + else + raise + (TypeCheckerFailure (lazy "CoFix: ill-typed bodies")) + ) ugraph1 fl + in + let (_,ty,_) = List.nth fl i in + ty,ugraph2 + + and check_exp_named_subst ~logger ~subst context ugraph = + let rec check_exp_named_subst_aux ~logger esubsts l ugraph = + match l with + [] -> ugraph + | ((uri,t) as item)::tl -> + let ty_uri,ugraph1 = type_of_variable ~logger uri ugraph in + let typeofvar = + CicSubstitution.subst_vars esubsts ty_uri in + let typeoft,ugraph2 = type_of_aux ~logger context t ugraph1 in + let b,ugraph3 = + CicReduction.are_convertible ~subst ~metasenv + context typeoft typeofvar ugraph2 + in + if b then + check_exp_named_subst_aux ~logger (esubsts@[item]) tl ugraph3 + else + begin + CicReduction.fdebug := 0 ; + ignore + (CicReduction.are_convertible + ~subst ~metasenv context typeoft typeofvar ugraph2) ; + fdebug := 0 ; + debug typeoft [typeofvar] ; + raise (TypeCheckerFailure (lazy "Wrong Explicit Named Substitution")) + end + in + check_exp_named_subst_aux ~logger [] ugraph + + and sort_of_prod ~subst context (name,s) (t1, t2) ugraph = + let module C = Cic in + let t1' = CicReduction.whd ~subst context t1 in + let t2' = CicReduction.whd ~subst ((Some (name,C.Decl s))::context) t2 in + match (t1', t2') with + (C.Sort s1, C.Sort s2) + when (s2 = C.Prop or s2 = C.Set or s2 = C.CProp) -> + (* different from Coq manual!!! *) + C.Sort s2,ugraph + | (C.Sort (C.Type t1), C.Sort (C.Type t2)) -> + (* TASSI: CONSRTAINTS: the same in doubletypeinference, cicrefine *) + let t' = CicUniv.fresh() in + (try + let ugraph1 = CicUniv.add_ge t' t1 ugraph in + let ugraph2 = CicUniv.add_ge t' t2 ugraph1 in + C.Sort (C.Type t'),ugraph2 + with + CicUniv.UniverseInconsistency msg -> raise (TypeCheckerFailure msg)) + | (C.Sort _,C.Sort (C.Type t1)) -> + (* TASSI: CONSRTAINTS: the same in doubletypeinference, cicrefine *) + C.Sort (C.Type t1),ugraph (* c'e' bisogno di un fresh? *) + | (C.Meta _, C.Sort _) -> t2',ugraph + | (C.Meta _, (C.Meta (_,_) as t)) + | (C.Sort _, (C.Meta (_,_) as t)) when CicUtil.is_closed t -> + t2',ugraph + | (_,_) -> raise (TypeCheckerFailure (lazy (sprintf + "Prod: expected two sorts, found = %s, %s" (CicPp.ppterm t1') + (CicPp.ppterm t2')))) + + and eat_prods ~subst context hetype l ugraph = + (*CSC: siamo sicuri che le are_convertible non lavorino con termini non *) + (*CSC: cucinati *) + match l with + [] -> hetype,ugraph + | (hete, hety)::tl -> + (match (CicReduction.whd ~subst context hetype) with + Cic.Prod (n,s,t) -> + let b,ugraph1 = + CicReduction.are_convertible + ~subst ~metasenv context hety s ugraph + in + if b then + begin + CicReduction.fdebug := -1 ; + eat_prods ~subst context + (CicSubstitution.subst ~avoid_beta_redexes:true hete t) + tl ugraph1 + (*TASSI: not sure *) + end + else + begin + CicReduction.fdebug := 0 ; + ignore (CicReduction.are_convertible + ~subst ~metasenv context s hety ugraph) ; + fdebug := 0 ; + debug s [hety] ; + raise + (TypeCheckerFailure + (lazy (sprintf + ("Appl: wrong parameter-type, expected %s, found %s") + (CicPp.ppterm hetype) (CicPp.ppterm s)))) + end + | _ -> + raise (TypeCheckerFailure + (lazy "Appl: this is not a function, it cannot be applied")) + ) + + and returns_a_coinductive ~subst context ty = + let module C = Cic in + match CicReduction.whd ~subst context ty with + C.MutInd (uri,i,_) -> + (*CSC: definire una funzioncina per questo codice sempre replicato *) + let obj,_ = + try + CicEnvironment.get_cooked_obj ~trust:false CicUniv.empty_ugraph uri + with Not_found -> assert false + in + (match obj with + C.InductiveDefinition (itl,_,_,_) -> + let (_,is_inductive,_,_) = List.nth itl i in + if is_inductive then None else (Some uri) + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + ) + | C.Appl ((C.MutInd (uri,i,_))::_) -> + (let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.InductiveDefinition (itl,_,_,_) -> + let (_,is_inductive,_,_) = List.nth itl i in + if is_inductive then None else (Some uri) + | _ -> + raise (TypeCheckerFailure + (lazy ("Unknown mutual inductive definition:" ^ + UriManager.string_of_uri uri))) + ) + | C.Prod (n,so,de) -> + returns_a_coinductive ~subst ((Some (n,C.Decl so))::context) de + | _ -> None + + in +(*CSC +debug_print (lazy ("INIZIO TYPE_OF_AUX " ^ CicPp.ppterm t)) ; flush stderr ; +let res = +*) + type_of_aux ~logger context t ugraph +(* +in debug_print (lazy "FINE TYPE_OF_AUX") ; flush stderr ; res +*) + +(* is a small constructor? *) +(*CSC: ottimizzare calcolando staticamente *) +and is_small_or_non_informative ~condition ~logger context paramsno c ugraph = + let rec is_small_or_non_informative_aux ~logger context c ugraph = + let module C = Cic in + match CicReduction.whd context c with + C.Prod (n,so,de) -> + let s,ugraph1 = type_of_aux' ~logger [] context so ugraph in + let b = condition s in + if b then + is_small_or_non_informative_aux + ~logger ((Some (n,(C.Decl so)))::context) de ugraph1 + else + false,ugraph1 + | _ -> true,ugraph (*CSC: we trust the type-checker *) + in + let (context',dx) = split_prods ~subst:[] context paramsno c in + is_small_or_non_informative_aux ~logger context' dx ugraph + +and is_small ~logger = + is_small_or_non_informative + ~condition:(fun s -> s=Cic.Sort Cic.Prop || s=Cic.Sort Cic.Set) + ~logger + +and is_non_informative ~logger = + is_small_or_non_informative + ~condition:(fun s -> s=Cic.Sort Cic.Prop) + ~logger + +and type_of ~logger t ugraph = +(*CSC +debug_print (lazy ("INIZIO TYPE_OF_AUX' " ^ CicPp.ppterm t)) ; flush stderr ; +let res = +*) + type_of_aux' ~logger [] [] t ugraph +(*CSC +in debug_print (lazy "FINE TYPE_OF_AUX'") ; flush stderr ; res +*) +;; + +let typecheck_obj0 ~logger uri ugraph = + let module C = Cic in + function + C.Constant (_,Some te,ty,_,_) -> + let _,ugraph = type_of ~logger ty ugraph in + let ty_te,ugraph = type_of ~logger te ugraph in + let b,ugraph = (CicReduction.are_convertible [] ty_te ty ugraph) in + if not b then + raise (TypeCheckerFailure + (lazy + ("the type of the body is not the one expected:\n" ^ + CicPp.ppterm ty_te ^ "\nvs\n" ^ + CicPp.ppterm ty))) + else + ugraph + | C.Constant (_,None,ty,_,_) -> + (* only to check that ty is well-typed *) + let _,ugraph = type_of ~logger ty ugraph in + ugraph + | C.CurrentProof (_,conjs,te,ty,_,_) -> + let _,ugraph = + List.fold_left + (fun (metasenv,ugraph) ((_,context,ty) as conj) -> + let _,ugraph = + type_of_aux' ~logger metasenv context ty ugraph + in + metasenv @ [conj],ugraph + ) ([],ugraph) conjs + in + let _,ugraph = type_of_aux' ~logger conjs [] ty ugraph in + let type_of_te,ugraph = + type_of_aux' ~logger conjs [] te ugraph + in + let b,ugraph = CicReduction.are_convertible [] type_of_te ty ugraph in + if not b then + raise (TypeCheckerFailure (lazy (sprintf + "the current proof is not well typed because the type %s of the body is not convertible to the declared type %s" + (CicPp.ppterm type_of_te) (CicPp.ppterm ty)))) + else + ugraph + | C.Variable (_,bo,ty,_,_) -> + (* only to check that ty is well-typed *) + let _,ugraph = type_of ~logger ty ugraph in + (match bo with + None -> ugraph + | Some bo -> + let ty_bo,ugraph = type_of ~logger bo ugraph in + let b,ugraph = CicReduction.are_convertible [] ty_bo ty ugraph in + if not b then + raise (TypeCheckerFailure + (lazy "the body is not the one expected")) + else + ugraph + ) + | (C.InductiveDefinition _ as obj) -> + check_mutual_inductive_defs ~logger uri obj ugraph + +let typecheck uri = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let logger = new CicLogger.logger in + (* ??? match CicEnvironment.is_type_checked ~trust:true uri with ???? *) + match CicEnvironment.is_type_checked ~trust:false CicUniv.empty_ugraph uri with + CicEnvironment.CheckedObj (cobj,ugraph') -> + (* debug_print (lazy ("NON-INIZIO A TYPECHECKARE " ^ U.string_of_uri uri));*) + cobj,ugraph' + | CicEnvironment.UncheckedObj uobj -> + (* let's typecheck the uncooked object *) + logger#log (`Start_type_checking uri) ; + (* debug_print (lazy ("INIZIO A TYPECHECKARE " ^ U.string_of_uri uri)); *) + let ugraph = typecheck_obj0 ~logger uri CicUniv.empty_ugraph uobj in + try + CicEnvironment.set_type_checking_info uri; + logger#log (`Type_checking_completed uri); + match CicEnvironment.is_type_checked ~trust:false ugraph uri with + CicEnvironment.CheckedObj (cobj,ugraph') -> cobj,ugraph' + | _ -> raise CicEnvironmentError + with + (* + this is raised if set_type_checking_info is called on an object + that has no associated universe file. If we are in univ_maker + phase this is OK since univ_maker will properly commit the + object. + *) + Invalid_argument s -> + (*debug_print (lazy s);*) + uobj,ugraph +;; + +let typecheck_obj ~logger uri obj = + let ugraph = typecheck_obj0 ~logger uri CicUniv.empty_ugraph obj in + let ugraph, univlist, obj = CicUnivUtils.clean_and_fill uri obj ugraph in + CicEnvironment.add_type_checked_obj uri (obj,ugraph,univlist) + +(** wrappers which instantiate fresh loggers *) + +let profiler = HExtlib.profile "K/CicTypeChecker.type_of_aux'" + +let type_of_aux' ?(subst = []) metasenv context t ugraph = + let logger = new CicLogger.logger in + profiler.HExtlib.profile + (type_of_aux' ~logger ~subst metasenv context t) ugraph + +let typecheck_obj uri obj = + let logger = new CicLogger.logger in + typecheck_obj ~logger uri obj + +(* check_allowed_sort_elimination uri i s1 s2 + This function is used outside the kernel to determine in advance whether + a MutCase will be allowed or not. + [uri,i] is the type of the term to match + [s1] is the sort of the term to eliminate (i.e. the head of the arity + of the inductive type [uri,i]) + [s2] is the sort of the goal (i.e. the head of the type of the outtype + of the MutCase) *) +let check_allowed_sort_elimination uri i s1 s2 = + fst (check_allowed_sort_elimination ~subst:[] ~metasenv:[] + ~logger:(new CicLogger.logger) [] uri i true + (Cic.Implicit None) (* never used *) (Cic.Sort s1) (Cic.Sort s2) + CicUniv.empty_ugraph) diff --git a/components/cic_proof_checking/cicTypeChecker.mli b/components/cic_proof_checking/cicTypeChecker.mli new file mode 100644 index 000000000..e9419171e --- /dev/null +++ b/components/cic_proof_checking/cicTypeChecker.mli @@ -0,0 +1,61 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* These are the only exceptions that will be raised *) +exception TypeCheckerFailure of string Lazy.t +exception AssertFailure of string Lazy.t + +(* this function is exported to be used also by the refiner; + the callback function (defaul value: ignore) is invoked on each + processed subterm; its first argument is the undebrujined term (the + input); its second argument the corresponding debrujined term (the + output). The callback is used to relocalize the error messages *) +val debrujin_constructor : + ?cb:(Cic.term -> Cic.term -> unit) -> + UriManager.uri -> int -> Cic.term -> Cic.term + +val typecheck : UriManager.uri -> Cic.obj * CicUniv.universe_graph + +(* FUNCTIONS USED ONLY IN THE TOPLEVEL *) + +(* type_of_aux' metasenv context term *) +val type_of_aux': + ?subst:Cic.substitution -> Cic.metasenv -> Cic.context -> + Cic.term -> CicUniv.universe_graph -> + Cic.term * CicUniv.universe_graph + +(* typechecks the obj and puts it in the environment *) +val typecheck_obj : UriManager.uri -> Cic.obj -> unit + +(* check_allowed_sort_elimination uri i s1 s2 + This function is used outside the kernel to determine in advance whether + a MutCase will be allowed or not. + [uri,i] is the type of the term to match + [s1] is the sort of the term to eliminate (i.e. the head of the arity + of the inductive type [uri,i]) + [s2] is the sort of the goal (i.e. the head of the type of the outtype + of the MutCase) *) +val check_allowed_sort_elimination: + UriManager.uri -> int -> Cic.sort -> Cic.sort -> bool diff --git a/components/cic_proof_checking/cicUnivUtils.ml b/components/cic_proof_checking/cicUnivUtils.ml new file mode 100644 index 000000000..cbc87e98a --- /dev/null +++ b/components/cic_proof_checking/cicUnivUtils.ml @@ -0,0 +1,153 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*****************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Enrico Tassi *) +(* 23/04/2004 *) +(* *) +(* This module implements some useful function regarding univers graphs *) +(* *) +(*****************************************************************************) + +(* $Id$ *) + +module C = Cic +module H = UriManager.UriHashtbl +let eq = UriManager.eq + +(* uri is the uri of the actual object that must be 'skipped' *) +let universes_of_obj uri t = + (* don't the same work twice *) + let visited_objs = H.create 31 in + let visited u = H.replace visited_objs u true in + let is_not_visited u = not (H.mem visited_objs u) in + visited uri; + (* the result *) + let results = ref [] in + let add_result l = results := l :: !results in + (* the iterators *) + let rec aux = function + | C.Const (u,exp_named_subst) when is_not_visited u -> + aux_uri u; + visited u; + C.Const (u, List.map (fun (x,t) -> x,aux t) exp_named_subst) + | C.Var (u,exp_named_subst) when is_not_visited u -> + aux_uri u; + visited u; + C.Var (u, List.map (fun (x,t) -> x,aux t) exp_named_subst) + | C.Const (u,exp_named_subst) -> + C.Const (u, List.map (fun (x,t) -> x,aux t) exp_named_subst) + | C.Var (u,exp_named_subst) -> + C.Var (u, List.map (fun (x,t) -> x,aux t) exp_named_subst) + | C.MutInd (u,x,exp_named_subst) when is_not_visited u -> + aux_uri u; + visited u; + C.MutInd (u,x,List.map (fun (x,t) -> x,aux t) exp_named_subst) + | C.MutInd (u,x,exp_named_subst) -> + C.MutInd (u,x, List.map (fun (x,t) -> x,aux t) exp_named_subst) + | C.MutConstruct (u,x,y,exp_named_subst) when is_not_visited u -> + aux_uri u; + visited u; + C.MutConstruct (u,x,y,List.map (fun (x,t) -> x,aux t) exp_named_subst) + | C.MutConstruct (x,y,z,exp_named_subst) -> + C.MutConstruct (x,y,z,List.map (fun (x,t) -> x,aux t) exp_named_subst) + | C.Meta (n,l1) -> C.Meta (n, List.map (HExtlib.map_option aux) l1) + | C.Sort (C.Type i) -> add_result [i]; + C.Sort (C.Type (CicUniv.name_universe i uri)) + | C.Rel _ + | C.Sort _ + | C.Implicit _ as x -> x + | C.Cast (v,t) -> C.Cast (aux v, aux t) + | C.Prod (b,s,t) -> C.Prod (b,aux s, aux t) + | C.Lambda (b,s,t) -> C.Lambda (b,aux s, aux t) + | C.LetIn (b,s,t) -> C.LetIn (b,aux s, aux t) + | C.Appl li -> C.Appl (List.map aux li) + | C.MutCase (uri,n1,ty,te,patterns) -> + C.MutCase (uri,n1,aux ty,aux te, List.map aux patterns) + | C.Fix (no, funs) -> + C.Fix(no, List.map (fun (x,y,b,c) -> (x,y,aux b,aux c)) funs) + | C.CoFix (no,funs) -> + C.CoFix(no, List.map (fun (x,b,c) -> (x,aux b,aux c)) funs) + and aux_uri u = + if is_not_visited u then + let _, _, l = + CicEnvironment.get_cooked_obj_with_univlist CicUniv.empty_ugraph u in + add_result l + and aux_obj = function + | C.Constant (x,Some te,ty,v,y) -> + List.iter aux_uri v; + C.Constant (x,Some (aux te),aux ty,v,y) + | C.Variable (x,Some te,ty,v,y) -> + List.iter aux_uri v; + C.Variable (x,Some (aux te),aux ty,v,y) + | C.Constant (x,None, ty, v,y) -> + List.iter aux_uri v; + C.Constant (x,None, aux ty, v,y) + | C.Variable (x,None, ty, v,y) -> + List.iter aux_uri v; + C.Variable (x,None, aux ty, v,y) + | C.CurrentProof (_,conjs,te,ty,v,_) -> assert false + | C.InductiveDefinition (l,v,x,y) -> + List.iter aux_uri v; + C.InductiveDefinition ( + List.map + (fun (x,y,t,l') -> + (x,y,aux t, List.map (fun (x,t) -> x,aux t) l')) + l,v,x,y) + in + let o = aux_obj t in + List.flatten !results, o + +let rec list_uniq = function + | [] -> [] + | h::[] -> [h] + | h1::h2::tl when CicUniv.eq h1 h2 -> list_uniq (h2 :: tl) + | h1::tl (* when h1 <> h2 *) -> h1 :: list_uniq tl + +let list_uniq l = + list_uniq (List.fast_sort CicUniv.compare l) + +let clean_and_fill uri obj ugraph = + (* universes of obj fills the universes of the obj with the right uri *) + let list_of_universes, obj = universes_of_obj uri obj in + let list_of_universes = list_uniq list_of_universes in +(* CicUniv.print_ugraph ugraph;*) +(* List.iter (fun u -> prerr_endline (CicUniv.string_of_universe u))*) +(* list_of_universes;*) + let ugraph = CicUniv.clean_ugraph ugraph list_of_universes in +(* CicUniv.print_ugraph ugraph;*) + let ugraph, list_of_universes = + CicUniv.fill_empty_nodes_with_uri ugraph list_of_universes uri + in + ugraph, list_of_universes, obj + +(* +let profiler = (HExtlib.profile "clean_and_fill").HExtlib.profile +let clean_and_fill u o g = + profiler (clean_and_fill u o) g +*) diff --git a/components/cic_proof_checking/cicUnivUtils.mli b/components/cic_proof_checking/cicUnivUtils.mli new file mode 100644 index 000000000..eb55a47eb --- /dev/null +++ b/components/cic_proof_checking/cicUnivUtils.mli @@ -0,0 +1,32 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + + (** cleans the universe graph for a given object and fills universes with URI. + * to be used on qed + *) +val clean_and_fill: + UriManager.uri -> Cic.obj -> CicUniv.universe_graph -> + CicUniv.universe_graph * CicUniv.universe list * Cic.obj + diff --git a/components/cic_proof_checking/doc/inductive.txt b/components/cic_proof_checking/doc/inductive.txt new file mode 100644 index 000000000..f2e49d398 --- /dev/null +++ b/components/cic_proof_checking/doc/inductive.txt @@ -0,0 +1,41 @@ +Table of allowed eliminations: + + +--------------------+----------------------------------+ + | Inductive Type | Elimination to | + +--------------------+----------------------------------+ + | Sort | "Smallness" | Prop | SetI | SetP | CProp| Type | + +--------------------+----------------------------------+ + | Prop empty | yes yes yes yes yes | + | Prop unit | yes yes yes yes yes | + | Prop small | yes no2 no2 no2 no12 | + | Prop | yes no2 no2 no2 no12 | + | SetI empty | yes yes -- yes yes | + | SetI small | yes yes -- yes yes | + | SetI | yes yes -- no1 no1 | + | SetP empty | yes -- yes yes yes | + | SetP small | yes -- yes yes yes | + | SetP | na3 na3 na3 na3 na3 | + | CProp empty | yes yes yes yes yes | + | CProp small | yes yes yes yes yes | + | CProp | yes yes yes yes yes | + | Type | yes yes yes yes yes | + +--------------------+----------------------------------+ + +Legenda: + no: elimination not allowed + na: not allowed, the inductive definition is rejected + + 1 : due to paradoxes a la Hurkens + 2 : due to code extraction + proof irreleveance incompatibility + (if you define Bool in Prop, you will be able to prove true<>false) + 3 : inductive type is rejected due to universe inconsistency + + SetP : Predicative Set + SetI : Impredicative Set + + non-informative : Constructor arguments are in Prop only + small : Constructor arguments are not in Type and SetP and CProp + unit : Non (mutually) recursive /\ only one constructor /\ non-informative + empty : in Coq: no constructors and non mutually recursive + in Matita: no constructors (but eventually mutually recursive + with non-empty types) diff --git a/components/cic_proof_checking/freshNamesGenerator.ml b/components/cic_proof_checking/freshNamesGenerator.ml new file mode 100755 index 000000000..73b75ce18 --- /dev/null +++ b/components/cic_proof_checking/freshNamesGenerator.ml @@ -0,0 +1,365 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +let debug_print = fun _ -> () + +let rec higher_name arity = + function + Cic.Sort Cic.Prop + | Cic.Sort Cic.CProp -> + if arity = 0 then "A" (* propositions *) + else if arity = 1 then "P" (* predicates *) + else "R" (*relations *) + | Cic.Sort Cic.Set + -> if arity = 0 then "S" else "F" + | Cic.Sort (Cic.Type _ ) -> + if arity = 0 then "T" else "F" + | Cic.Prod (_,_,t) -> higher_name (arity+1) t + | _ -> "f" + +let get_initial s = + if String.length s = 0 then "_" + else + let head = String.sub s 0 1 in + String.lowercase head + +(* only used when the sort is not Prop or CProp *) +let rec guess_a_name context ty = + match ty with + Cic.Rel n -> + (match List.nth context (n-1) with + None -> assert false + | Some (Cic.Anonymous,_) -> "eccomi_qua" + | Some (Cic.Name s,_) -> get_initial s) + | Cic.Var (uri,_) -> get_initial (UriManager.name_of_uri uri) + | Cic.Sort _ -> higher_name 0 ty + | Cic.Implicit _ -> assert false + | Cic.Cast (t1,t2) -> guess_a_name context t1 + | Cic.Prod (na_,_,t) -> higher_name 1 t +(* warning: on appl we should beta reduce before the recursive call + | Cic.Lambda _ -> assert false +*) + | Cic.LetIn (_,s,t) -> guess_a_name context (CicSubstitution.subst ~avoid_beta_redexes:true s t) + | Cic.Appl [] -> assert false + | Cic.Appl (he::_) -> guess_a_name context he + | Cic.Const (uri,_) + | Cic.MutInd (uri,_,_) + | Cic.MutConstruct (uri,_,_,_) -> get_initial (UriManager.name_of_uri uri) + | _ -> "x" + +(* mk_fresh_name context name typ *) +(* returns an identifier which is fresh in the context *) +(* and that resembles [name] as much as possible. *) +(* [typ] will be the type of the variable *) +let mk_fresh_name ~subst metasenv context name ~typ = + let module C = Cic in + let basename = + match name with + C.Anonymous -> + (try + let ty,_ = + CicTypeChecker.type_of_aux' ~subst metasenv context typ + CicUniv.oblivion_ugraph + in + (match ty with + C.Sort C.Prop + | C.Sort C.CProp -> "H" + | _ -> guess_a_name context typ + ) + with CicTypeChecker.TypeCheckerFailure _ -> "H" + ) + | C.Name name -> + Str.global_replace (Str.regexp "[0-9']*$") "" name + in + let already_used name = + List.exists (function Some (n,_) -> n=name | _ -> false) context + in + if name <> C.Anonymous && not (already_used name) then + name + else if not (already_used (C.Name basename)) then + C.Name basename + else + let rec try_next n = + let name' = C.Name (basename ^ string_of_int n) in + if already_used name' then + try_next (n+1) + else + name' + in + try_next 1 +;; + +(* let mk_fresh_names ~subst metasenv context t *) +let rec mk_fresh_names ~subst metasenv context t = + match t with + Cic.Rel _ -> t + | Cic.Var (uri,exp_named_subst) -> + let ens = + List.map + (fun (uri,t) -> + (uri,mk_fresh_names ~subst metasenv context t)) exp_named_subst in + Cic.Var (uri,ens) + | Cic.Meta (i,l) -> + let l' = + List.map + (fun t -> + match t with + None -> None + | Some t -> Some (mk_fresh_names ~subst metasenv context t)) l in + Cic.Meta(i,l') + | Cic.Sort _ + | Cic.Implicit _ -> t + | Cic.Cast (te,ty) -> + let te' = mk_fresh_names ~subst metasenv context te in + let ty' = mk_fresh_names ~subst metasenv context ty in + Cic.Cast (te', ty') + | Cic.Prod (n,s,t) -> + let s' = mk_fresh_names ~subst metasenv context s in + let n' = + match n with + Cic.Anonymous -> Cic.Anonymous + | Cic.Name "matita_dummy" -> + mk_fresh_name ~subst metasenv context Cic.Anonymous ~typ:s' + | _ -> n in + let t' = mk_fresh_names ~subst metasenv (Some(n',Cic.Decl s')::context) t in + Cic.Prod (n',s',t') + | Cic.Lambda (n,s,t) -> + let s' = mk_fresh_names ~subst metasenv context s in + let n' = + match n with + Cic.Anonymous -> Cic.Anonymous + | Cic.Name "matita_dummy" -> + mk_fresh_name ~subst metasenv context Cic.Anonymous ~typ:s' + | _ -> n in + let t' = mk_fresh_names ~subst metasenv (Some(n',Cic.Decl s')::context) t in + Cic.Lambda (n',s',t') + | Cic.LetIn (n,s,t) -> + let s' = mk_fresh_names ~subst metasenv context s in + let n' = + match n with + Cic.Anonymous -> Cic.Anonymous + | Cic.Name "matita_dummy" -> + mk_fresh_name ~subst metasenv context Cic.Anonymous ~typ:s' + | _ -> n in + let t' = mk_fresh_names ~subst metasenv (Some(n',Cic.Def (s',None))::context) t in + Cic.LetIn (n',s',t') + | Cic.Appl l -> + Cic.Appl (List.map (mk_fresh_names ~subst metasenv context) l) + | Cic.Const (uri,exp_named_subst) -> + let ens = + List.map + (fun (uri,t) -> + (uri,mk_fresh_names ~subst metasenv context t)) exp_named_subst in + Cic.Const(uri,ens) + | Cic.MutInd (uri,tyno,exp_named_subst) -> + let ens = + List.map + (fun (uri,t) -> + (uri,mk_fresh_names ~subst metasenv context t)) exp_named_subst in + Cic.MutInd (uri,tyno,ens) + | Cic.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let ens = + List.map + (fun (uri,t) -> + (uri,mk_fresh_names ~subst metasenv context t)) exp_named_subst in + Cic.MutConstruct (uri,tyno,consno, ens) + | Cic.MutCase (sp,i,outty,t,pl) -> + let outty' = mk_fresh_names ~subst metasenv context outty in + let t' = mk_fresh_names ~subst metasenv context t in + let pl' = List.map (mk_fresh_names ~subst metasenv context) pl in + Cic.MutCase (sp, i, outty', t', pl') + | Cic.Fix (i, fl) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (Cic.Name n,(Cic.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + let fl' = List.map + (fun (n,i,ty,bo) -> + let ty' = mk_fresh_names ~subst metasenv context ty in + let bo' = mk_fresh_names ~subst metasenv (tys@context) bo in + (n,i,ty',bo')) fl in + Cic.Fix (i, fl') + | Cic.CoFix (i, fl) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (Cic.Name n,(Cic.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + let fl' = List.map + (fun (n,ty,bo) -> + let ty' = mk_fresh_names ~subst metasenv context ty in + let bo' = mk_fresh_names ~subst metasenv (tys@context) bo in + (n,ty',bo')) fl in + Cic.CoFix (i, fl') +;; + +(* clean_dummy_dependent_types term *) +(* returns a copy of [term] where every dummy dependent product *) +(* have been replaced with a non-dependent product and where *) +(* dummy let-ins have been removed. *) +let clean_dummy_dependent_types t = + let module C = Cic in + let rec aux k = + function + C.Rel m as t -> t,[k - m] + | C.Var (uri,exp_named_subst) -> + let exp_named_subst',rels = + List.fold_right + (fun (uri,t) (exp_named_subst,rels) -> + let t',rels' = aux k t in + (uri,t')::exp_named_subst, rels' @ rels + ) exp_named_subst ([],[]) + in + C.Var (uri,exp_named_subst'),rels + | C.Meta (i,l) -> + let l',rels = + List.fold_right + (fun t (l,rels) -> + let t',rels' = + match t with + None -> None,[] + | Some t -> + let t',rels' = aux k t in + Some t', rels' + in + t'::l, rels' @ rels + ) l ([],[]) + in + C.Meta(i,l'),rels + | C.Sort _ as t -> t,[] + | C.Implicit _ as t -> t,[] + | C.Cast (te,ty) -> + let te',rels1 = aux k te in + let ty',rels2 = aux k ty in + C.Cast (te', ty'), rels1@rels2 + | C.Prod (n,s,t) -> + let s',rels1 = aux k s in + let t',rels2 = aux (k+1) t in + let n' = + match n with + C.Anonymous -> + if List.mem k rels2 then +( + debug_print (lazy "If this happens often, we can do something about it (i.e. we can generate a new fresh name; problem: we need the metasenv and context ;-(. Alternative solution: mk_implicit does not generate entries for the elements in the context that have no name") ; + C.Anonymous +) + else + C.Anonymous + | C.Name _ as n -> + if List.mem k rels2 then n else C.Anonymous + in + C.Prod (n', s', t'), rels1@rels2 + | C.Lambda (n,s,t) -> + let s',rels1 = aux k s in + let t',rels2 = aux (k+1) t in + C.Lambda (n, s', t'), rels1@rels2 + | C.LetIn (n,s,t) -> + let s',rels1 = aux k s in + let t',rels2 = aux (k+1) t in + let rels = rels1 @ rels2 in + if List.mem k rels2 then + C.LetIn (n, s', t'), rels + else + (* (C.Rel 1) is just a dummy term; any term would fit *) + CicSubstitution.subst (C.Rel 1) t', rels + | C.Appl l -> + let l',rels = + List.fold_right + (fun t (exp_named_subst,rels) -> + let t',rels' = aux k t in + t'::exp_named_subst, rels' @ rels + ) l ([],[]) + in + C.Appl l', rels + | C.Const (uri,exp_named_subst) -> + let exp_named_subst',rels = + List.fold_right + (fun (uri,t) (exp_named_subst,rels) -> + let t',rels' = aux k t in + (uri,t')::exp_named_subst, rels' @ rels + ) exp_named_subst ([],[]) + in + C.Const (uri,exp_named_subst'),rels + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst',rels = + List.fold_right + (fun (uri,t) (exp_named_subst,rels) -> + let t',rels' = aux k t in + (uri,t')::exp_named_subst, rels' @ rels + ) exp_named_subst ([],[]) + in + C.MutInd (uri,tyno,exp_named_subst'),rels + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst',rels = + List.fold_right + (fun (uri,t) (exp_named_subst,rels) -> + let t',rels' = aux k t in + (uri,t')::exp_named_subst, rels' @ rels + ) exp_named_subst ([],[]) + in + C.MutConstruct (uri,tyno,consno,exp_named_subst'),rels + | C.MutCase (sp,i,outty,t,pl) -> + let outty',rels1 = aux k outty in + let t',rels2 = aux k t in + let pl',rels3 = + List.fold_right + (fun t (exp_named_subst,rels) -> + let t',rels' = aux k t in + t'::exp_named_subst, rels' @ rels + ) pl ([],[]) + in + C.MutCase (sp, i, outty', t', pl'), rels1 @ rels2 @rels3 + | C.Fix (i, fl) -> + let len = List.length fl in + let fl',rels = + List.fold_right + (fun (name,i,ty,bo) (fl,rels) -> + let ty',rels1 = aux k ty in + let bo',rels2 = aux (k + len) bo in + (name,i,ty',bo')::fl, rels1 @ rels2 @ rels + ) fl ([],[]) + in + C.Fix (i, fl'),rels + | C.CoFix (i, fl) -> + let len = List.length fl in + let fl',rels = + List.fold_right + (fun (name,ty,bo) (fl,rels) -> + let ty',rels1 = aux k ty in + let bo',rels2 = aux (k + len) bo in + (name,ty',bo')::fl, rels1 @ rels2 @ rels + ) fl ([],[]) + in + C.CoFix (i, fl'),rels + in + fst (aux 0 t) +;; diff --git a/components/cic_proof_checking/freshNamesGenerator.mli b/components/cic_proof_checking/freshNamesGenerator.mli new file mode 100644 index 000000000..b90c0f2f5 --- /dev/null +++ b/components/cic_proof_checking/freshNamesGenerator.mli @@ -0,0 +1,46 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* mk_fresh_name metasenv context name typ *) +(* returns an identifier which is fresh in the context *) +(* and that resembles [name] as much as possible. *) +(* [typ] will be the type of the variable *) +val mk_fresh_name : + subst:Cic.substitution -> + Cic.metasenv -> Cic.context -> Cic.name -> typ:Cic.term -> Cic.name + +(* mk_fresh_names metasenv context term *) +(* returns a term t' convertible with term where all *) +(* matita_dummies have been replaced by fresh names *) + +val mk_fresh_names : + subst:Cic.substitution -> + Cic.metasenv -> Cic.context -> Cic.term -> Cic.term + +(* clean_dummy_dependent_types term *) +(* returns a copy of [term] where every dummy dependent product *) +(* have been replaced with a non-dependent product and where *) +(* dummy let-ins have been removed. *) +val clean_dummy_dependent_types : Cic.term -> Cic.term diff --git a/components/cic_unification/.depend b/components/cic_unification/.depend new file mode 100644 index 000000000..a7b23ceb4 --- /dev/null +++ b/components/cic_unification/.depend @@ -0,0 +1,16 @@ +cicMetaSubst.cmo: cicMetaSubst.cmi +cicMetaSubst.cmx: cicMetaSubst.cmi +cicMkImplicit.cmo: cicMkImplicit.cmi +cicMkImplicit.cmx: cicMkImplicit.cmi +termUtil.cmo: cicMkImplicit.cmi termUtil.cmi +termUtil.cmx: cicMkImplicit.cmx termUtil.cmi +coercGraph.cmo: termUtil.cmi cicMkImplicit.cmi coercGraph.cmi +coercGraph.cmx: termUtil.cmx cicMkImplicit.cmx coercGraph.cmi +cicUnification.cmo: coercGraph.cmi cicMetaSubst.cmi cicUnification.cmi +cicUnification.cmx: coercGraph.cmx cicMetaSubst.cmx cicUnification.cmi +cicReplace.cmo: cicReplace.cmi +cicReplace.cmx: cicReplace.cmi +cicRefine.cmo: coercGraph.cmi cicUnification.cmi cicReplace.cmi \ + cicMkImplicit.cmi cicMetaSubst.cmi cicRefine.cmi +cicRefine.cmx: coercGraph.cmx cicUnification.cmx cicReplace.cmx \ + cicMkImplicit.cmx cicMetaSubst.cmx cicRefine.cmi diff --git a/components/cic_unification/.depend.opt b/components/cic_unification/.depend.opt new file mode 100644 index 000000000..a7b23ceb4 --- /dev/null +++ b/components/cic_unification/.depend.opt @@ -0,0 +1,16 @@ +cicMetaSubst.cmo: cicMetaSubst.cmi +cicMetaSubst.cmx: cicMetaSubst.cmi +cicMkImplicit.cmo: cicMkImplicit.cmi +cicMkImplicit.cmx: cicMkImplicit.cmi +termUtil.cmo: cicMkImplicit.cmi termUtil.cmi +termUtil.cmx: cicMkImplicit.cmx termUtil.cmi +coercGraph.cmo: termUtil.cmi cicMkImplicit.cmi coercGraph.cmi +coercGraph.cmx: termUtil.cmx cicMkImplicit.cmx coercGraph.cmi +cicUnification.cmo: coercGraph.cmi cicMetaSubst.cmi cicUnification.cmi +cicUnification.cmx: coercGraph.cmx cicMetaSubst.cmx cicUnification.cmi +cicReplace.cmo: cicReplace.cmi +cicReplace.cmx: cicReplace.cmi +cicRefine.cmo: coercGraph.cmi cicUnification.cmi cicReplace.cmi \ + cicMkImplicit.cmi cicMetaSubst.cmi cicRefine.cmi +cicRefine.cmx: coercGraph.cmx cicUnification.cmx cicReplace.cmx \ + cicMkImplicit.cmx cicMetaSubst.cmx cicRefine.cmi diff --git a/components/cic_unification/Makefile b/components/cic_unification/Makefile new file mode 100644 index 000000000..ad87356d1 --- /dev/null +++ b/components/cic_unification/Makefile @@ -0,0 +1,16 @@ +PACKAGE = cic_unification +PREDICATES = + +INTERFACE_FILES = \ + cicMetaSubst.mli \ + cicMkImplicit.mli \ + termUtil.mli \ + coercGraph.mli \ + cicUnification.mli \ + cicReplace.mli \ + cicRefine.mli +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/cic_unification/cicMetaSubst.ml b/components/cic_unification/cicMetaSubst.ml new file mode 100644 index 000000000..f082fc230 --- /dev/null +++ b/components/cic_unification/cicMetaSubst.ml @@ -0,0 +1,938 @@ +(* Copyright (C) 2003, HELM Team. + * + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +open Printf + +(* PROFILING *) +(* +let deref_counter = ref 0 +let apply_subst_context_counter = ref 0 +let apply_subst_metasenv_counter = ref 0 +let lift_counter = ref 0 +let subst_counter = ref 0 +let whd_counter = ref 0 +let are_convertible_counter = ref 0 +let metasenv_length = ref 0 +let context_length = ref 0 +let reset_counters () = + apply_subst_counter := 0; + apply_subst_context_counter := 0; + apply_subst_metasenv_counter := 0; + lift_counter := 0; + subst_counter := 0; + whd_counter := 0; + are_convertible_counter := 0; + metasenv_length := 0; + context_length := 0 +let print_counters () = + debug_print (lazy (Printf.sprintf +"apply_subst: %d +apply_subst_context: %d +apply_subst_metasenv: %d +lift: %d +subst: %d +whd: %d +are_convertible: %d +metasenv length: %d (avg = %.2f) +context length: %d (avg = %.2f) +" + !apply_subst_counter !apply_subst_context_counter + !apply_subst_metasenv_counter !lift_counter !subst_counter !whd_counter + !are_convertible_counter !metasenv_length + ((float !metasenv_length) /. (float !apply_subst_metasenv_counter)) + !context_length + ((float !context_length) /. (float !apply_subst_context_counter)) + ))*) + + + +exception MetaSubstFailure of string Lazy.t +exception Uncertain of string Lazy.t +exception AssertFailure of string Lazy.t +exception DeliftingARelWouldCaptureAFreeVariable;; + +let debug_print = fun _ -> () + +type substitution = (int * (Cic.context * Cic.term)) list + +(* +let rec deref subst = + let third _,_,a = a in + function + Cic.Meta(n,l) as t -> + (try + deref subst + (CicSubstitution.subst_meta + l (third (CicUtil.lookup_subst n subst))) + with + CicUtil.Subst_not_found _ -> t) + | t -> t +;; +*) + +let lookup_subst = CicUtil.lookup_subst +;; + +(* clean_up_meta take a metasenv and a term and make every local context +of each occurrence of a metavariable consistent with its canonical context, +with respect to the hidden hipothesis *) + +(* +let clean_up_meta subst metasenv t = + let module C = Cic in + let rec aux t = + match t with + C.Rel _ + | C.Sort _ -> t + | C.Implicit _ -> assert false + | C.Meta (n,l) as t -> + let cc = + (try + let (cc,_) = lookup_subst n subst in cc + with CicUtil.Subst_not_found _ -> + try + let (_,cc,_) = CicUtil.lookup_meta n metasenv in cc + with CicUtil.Meta_not_found _ -> assert false) in + let l' = + (try + List.map2 + (fun t1 t2 -> + match t1,t2 with + None , _ -> None + | _ , t -> t) cc l + with + Invalid_argument _ -> assert false) in + C.Meta (n, l') + | C.Cast (te,ty) -> C.Cast (aux te, aux ty) + | C.Prod (name,so,dest) -> C.Prod (name, aux so, aux dest) + | C.Lambda (name,so,dest) -> C.Lambda (name, aux so, aux dest) + | C.LetIn (name,so,dest) -> C.LetIn (name, aux so, aux dest) + | C.Appl l -> C.Appl (List.map aux l) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri,t) -> (uri, aux t)) exp_named_subst + in + C.Var (uri, exp_named_subst') + | C.Const (uri, exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri,t) -> (uri, aux t)) exp_named_subst + in + C.Const (uri, exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri,t) -> (uri, aux t)) exp_named_subst + in + C.MutInd (uri, tyno, exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri,t) -> (uri, aux t)) exp_named_subst + in + C.MutConstruct (uri, tyno, consno, exp_named_subst') + | C.MutCase (uri,tyno,out,te,pl) -> + C.MutCase (uri, tyno, aux out, aux te, List.map aux pl) + | C.Fix (i,fl) -> + let fl' = + List.map + (fun (name,j,ty,bo) -> (name, j, aux ty, aux bo)) fl + in + C.Fix (i, fl') + | C.CoFix (i,fl) -> + let fl' = + List.map + (fun (name,ty,bo) -> (name, aux ty, aux bo)) fl + in + C.CoFix (i, fl') + in + aux t *) + +(*** Functions to apply a substitution ***) + +let apply_subst_gen ~appl_fun subst term = + let rec um_aux = + let module C = Cic in + let module S = CicSubstitution in + function + C.Rel _ as t -> t + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri, t) -> (uri, um_aux t)) exp_named_subst + in + C.Var (uri, exp_named_subst') + | C.Meta (i, l) -> + (try + let (_, t,_) = lookup_subst i subst in + um_aux (S.subst_meta l t) + with CicUtil.Subst_not_found _ -> + (* unconstrained variable, i.e. free in subst*) + let l' = + List.map (function None -> None | Some t -> Some (um_aux t)) l + in + C.Meta (i,l')) + | C.Sort _ + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (um_aux te, um_aux ty) + | C.Prod (n,s,t) -> C.Prod (n, um_aux s, um_aux t) + | C.Lambda (n,s,t) -> C.Lambda (n, um_aux s, um_aux t) + | C.LetIn (n,s,t) -> C.LetIn (n, um_aux s, um_aux t) + | C.Appl (hd :: tl) -> appl_fun um_aux hd tl + | C.Appl _ -> assert false + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri, t) -> (uri, um_aux t)) exp_named_subst + in + C.Const (uri, exp_named_subst') + | C.MutInd (uri,typeno,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri, t) -> (uri, um_aux t)) exp_named_subst + in + C.MutInd (uri,typeno,exp_named_subst') + | C.MutConstruct (uri,typeno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri, t) -> (uri, um_aux t)) exp_named_subst + in + C.MutConstruct (uri,typeno,consno,exp_named_subst') + | C.MutCase (sp,i,outty,t,pl) -> + let pl' = List.map um_aux pl in + C.MutCase (sp, i, um_aux outty, um_aux t, pl') + | C.Fix (i, fl) -> + let fl' = + List.map (fun (name, i, ty, bo) -> (name, i, um_aux ty, um_aux bo)) fl + in + C.Fix (i, fl') + | C.CoFix (i, fl) -> + let fl' = + List.map (fun (name, ty, bo) -> (name, um_aux ty, um_aux bo)) fl + in + C.CoFix (i, fl') + in + um_aux term +;; + +let apply_subst = + let appl_fun um_aux he tl = + let tl' = List.map um_aux tl in + let t' = + match um_aux he with + Cic.Appl l -> Cic.Appl (l@tl') + | he' -> Cic.Appl (he'::tl') + in + begin + match he with + Cic.Meta (m,_) -> CicReduction.head_beta_reduce t' + | _ -> t' + end + in + fun subst t -> +(* incr apply_subst_counter; *) +match subst with + [] -> t + | _ -> apply_subst_gen ~appl_fun subst t +;; + +let profiler = HExtlib.profile "U/CicMetaSubst.apply_subst" +let apply_subst s t = + profiler.HExtlib.profile (apply_subst s) t + + +let apply_subst_context subst context = + match subst with + [] -> context + | _ -> +(* + incr apply_subst_context_counter; + context_length := !context_length + List.length context; +*) + List.fold_right + (fun item context -> + match item with + | Some (n, Cic.Decl t) -> + let t' = apply_subst subst t in + Some (n, Cic.Decl t') :: context + | Some (n, Cic.Def (t, ty)) -> + let ty' = + match ty with + | None -> None + | Some ty -> Some (apply_subst subst ty) + in + let t' = apply_subst subst t in + Some (n, Cic.Def (t', ty')) :: context + | None -> None :: context) + context [] + +let apply_subst_metasenv subst metasenv = +(* + incr apply_subst_metasenv_counter; + metasenv_length := !metasenv_length + List.length metasenv; +*) +match subst with + [] -> metasenv + | _ -> + List.map + (fun (n, context, ty) -> + (n, apply_subst_context subst context, apply_subst subst ty)) + (List.filter + (fun (i, _, _) -> not (List.mem_assoc i subst)) + metasenv) + +(***** Pretty printing functions ******) + +let ppterm ~metasenv subst term = + CicPp.ppterm ~metasenv (apply_subst subst term) + +let ppterm_in_name_context ~metasenv subst term name_context = + CicPp.pp ~metasenv (apply_subst subst term) name_context + +let ppterm_in_context ~metasenv subst term context = + let name_context = + List.map (function None -> None | Some (n,_) -> Some n) context + in + ppterm_in_name_context ~metasenv subst term name_context + +let ppterm_in_context_ref = ref ppterm_in_context +let set_ppterm_in_context f = + ppterm_in_context_ref := f +let use_low_level_ppterm_in_context = ref false + +let ppterm_in_context ~metasenv subst term context = + if !use_low_level_ppterm_in_context then + ppterm_in_context ~metasenv subst term context + else + !ppterm_in_context_ref ~metasenv subst term context + +let ppcontext' ~metasenv ?(sep = "\n") subst context = + let separate s = if s = "" then "" else s ^ sep in + List.fold_right + (fun context_entry (i,name_context) -> + match context_entry with + Some (n,Cic.Decl t) -> + sprintf "%s%s : %s" (separate i) (CicPp.ppname n) + (ppterm_in_name_context ~metasenv subst t name_context), + (Some n)::name_context + | Some (n,Cic.Def (bo,ty)) -> + sprintf "%s%s : %s := %s" (separate i) (CicPp.ppname n) + (match ty with + None -> "_" + | Some ty -> ppterm_in_name_context ~metasenv subst ty name_context) + (ppterm_in_name_context ~metasenv subst bo name_context), (Some n)::name_context + | None -> + sprintf "%s_ :? _" (separate i), None::name_context + ) context ("",[]) + +let ppsubst_unfolded ~metasenv subst = + String.concat "\n" + (List.map + (fun (idx, (c, t,ty)) -> + let context,name_context = ppcontext' ~metasenv ~sep:"; " subst c in + sprintf "%s |- ?%d : %s := %s" context idx +(ppterm_in_name_context ~metasenv [] ty name_context) + (ppterm_in_name_context ~metasenv subst t name_context)) + subst) +(* + Printf.sprintf "?%d := %s" idx (CicPp.ppterm term)) + subst) *) +;; + +let ppsubst ~metasenv subst = + String.concat "\n" + (List.map + (fun (idx, (c, t, ty)) -> + let context,name_context = ppcontext' ~metasenv ~sep:"; " [] c in + sprintf "%s |- ?%d : %s := %s" context idx (ppterm_in_name_context ~metasenv [] ty name_context) + (ppterm_in_name_context ~metasenv [] t name_context)) + subst) +;; + +let ppcontext ~metasenv ?sep subst context = + fst (ppcontext' ~metasenv ?sep subst context) + +let ppmetasenv ?(sep = "\n") subst metasenv = + String.concat sep + (List.map + (fun (i, c, t) -> + let context,name_context = ppcontext' ~metasenv ~sep:"; " subst c in + sprintf "%s |- ?%d: %s" context i + (ppterm_in_name_context ~metasenv subst t name_context)) + (List.filter + (fun (i, _, _) -> not (List.mem_assoc i subst)) + metasenv)) + +let tempi_type_of_aux_subst = ref 0.0;; +let tempi_subst = ref 0.0;; +let tempi_type_of_aux = ref 0.0;; + +(**** DELIFT ****) +(* the delift function takes in input a metavariable index, an ordered list of + * optional terms [t1,...,tn] and a term t, and substitutes every tk = Some + * (rel(nk)) with rel(k). Typically, the list of optional terms is the explicit + * substitution that is applied to a metavariable occurrence and the result of + * the delift function is a term the implicit variable can be substituted with + * to make the term [t] unifiable with the metavariable occurrence. In general, + * the problem is undecidable if we consider equivalence in place of alpha + * convertibility. Our implementation, though, is even weaker than alpha + * convertibility, since it replace the term [tk] if and only if [tk] is a Rel + * (missing all the other cases). Does this matter in practice? + * The metavariable index is the index of the metavariable that must not occur + * in the term (for occur check). + *) + +exception NotInTheList;; + +let position n = + let rec aux k = + function + [] -> raise NotInTheList + | (Some (Cic.Rel m))::_ when m=n -> k + | _::tl -> aux (k+1) tl in + aux 1 +;; + +exception Occur;; + +let rec force_does_not_occur subst to_be_restricted t = + let module C = Cic in + let more_to_be_restricted = ref [] in + let rec aux k = function + C.Rel r when List.mem (r - k) to_be_restricted -> raise Occur + | C.Rel _ + | C.Sort _ as t -> t + | C.Implicit _ -> assert false + | C.Meta (n, l) -> + (* we do not retrieve the term associated to ?n in subst since *) + (* in this way we can restrict if something goes wrong *) + let l' = + let i = ref 0 in + List.map + (function t -> + incr i ; + match t with + None -> None + | Some t -> + try + Some (aux k t) + with Occur -> + more_to_be_restricted := (n,!i) :: !more_to_be_restricted; + None) + l + in + C.Meta (n, l') + | C.Cast (te,ty) -> C.Cast (aux k te, aux k ty) + | C.Prod (name,so,dest) -> C.Prod (name, aux k so, aux (k+1) dest) + | C.Lambda (name,so,dest) -> C.Lambda (name, aux k so, aux (k+1) dest) + | C.LetIn (name,so,dest) -> C.LetIn (name, aux k so, aux (k+1) dest) + | C.Appl l -> C.Appl (List.map (aux k) l) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri,t) -> (uri, aux k t)) exp_named_subst + in + C.Var (uri, exp_named_subst') + | C.Const (uri, exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri,t) -> (uri, aux k t)) exp_named_subst + in + C.Const (uri, exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri,t) -> (uri, aux k t)) exp_named_subst + in + C.MutInd (uri, tyno, exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri,t) -> (uri, aux k t)) exp_named_subst + in + C.MutConstruct (uri, tyno, consno, exp_named_subst') + | C.MutCase (uri,tyno,out,te,pl) -> + C.MutCase (uri, tyno, aux k out, aux k te, List.map (aux k) pl) + | C.Fix (i,fl) -> + let len = List.length fl in + let k_plus_len = k + len in + let fl' = + List.map + (fun (name,j,ty,bo) -> (name, j, aux k ty, aux k_plus_len bo)) fl + in + C.Fix (i, fl') + | C.CoFix (i,fl) -> + let len = List.length fl in + let k_plus_len = k + len in + let fl' = + List.map + (fun (name,ty,bo) -> (name, aux k ty, aux k_plus_len bo)) fl + in + C.CoFix (i, fl') + in + let res = aux 0 t in + (!more_to_be_restricted, res) + +let rec restrict subst to_be_restricted metasenv = + match to_be_restricted with + | [] -> metasenv, subst + | _ -> + let names_of_context_indexes context indexes = + String.concat ", " + (List.map + (fun i -> + try + match List.nth context (i-1) with + | None -> assert false + | Some (n, _) -> CicPp.ppname n + with + Failure _ -> assert false + ) indexes) + in + let force_does_not_occur_in_context to_be_restricted = function + | None -> [], None + | Some (name, Cic.Decl t) -> + let (more_to_be_restricted, t') = + force_does_not_occur subst to_be_restricted t + in + more_to_be_restricted, Some (name, Cic.Decl t') + | Some (name, Cic.Def (bo, ty)) -> + let (more_to_be_restricted, bo') = + force_does_not_occur subst to_be_restricted bo + in + let more_to_be_restricted, ty' = + match ty with + | None -> more_to_be_restricted, None + | Some ty -> + let more_to_be_restricted', ty' = + force_does_not_occur subst to_be_restricted ty + in + more_to_be_restricted @ more_to_be_restricted', + Some ty' + in + more_to_be_restricted, Some (name, Cic.Def (bo', ty')) + in + let rec erase i to_be_restricted n = function + | [] -> [], to_be_restricted, [] + | hd::tl -> + let more_to_be_restricted,restricted,tl' = + erase (i+1) to_be_restricted n tl + in + let restrict_me = List.mem i restricted in + if restrict_me then + more_to_be_restricted, restricted, None:: tl' + else + (try + let more_to_be_restricted', hd' = + let delifted_restricted = + let rec aux = + function + [] -> [] + | j::tl when j > i -> (j - i)::aux tl + | _::tl -> aux tl + in + aux restricted + in + force_does_not_occur_in_context delifted_restricted hd + in + more_to_be_restricted @ more_to_be_restricted', + restricted, hd' :: tl' + with Occur -> + more_to_be_restricted, (i :: restricted), None :: tl') + in + let (more_to_be_restricted, metasenv) = (* restrict metasenv *) + List.fold_right + (fun (n, context, t) (more, metasenv) -> + let to_be_restricted = + List.map snd (List.filter (fun (m, _) -> m = n) to_be_restricted) + in + let (more_to_be_restricted, restricted, context') = + (* just an optimization *) + if to_be_restricted = [] then + [],[],context + else + erase 1 to_be_restricted n context + in + try + let more_to_be_restricted', t' = + force_does_not_occur subst restricted t + in + let metasenv' = (n, context', t') :: metasenv in + (more @ more_to_be_restricted @ more_to_be_restricted', + metasenv') + with Occur -> + raise (MetaSubstFailure (lazy (sprintf + "Cannot restrict the context of the metavariable ?%d over the hypotheses %s since metavariable's type depends on at least one of them" + n (names_of_context_indexes context to_be_restricted))))) + metasenv ([], []) + in + let (more_to_be_restricted', subst) = (* restrict subst *) + List.fold_right + (* TODO: cambiare dopo l'aggiunta del ty *) + (fun (n, (context, term,ty)) (more, subst') -> + let to_be_restricted = + List.map snd (List.filter (fun (m, _) -> m = n) to_be_restricted) + in + (try + let (more_to_be_restricted, restricted, context') = + (* just an optimization *) + if to_be_restricted = [] then + [], [], context + else + erase 1 to_be_restricted n context + in + let more_to_be_restricted', term' = + force_does_not_occur subst restricted term + in + let more_to_be_restricted'', ty' = + force_does_not_occur subst restricted ty in + let subst' = (n, (context', term',ty')) :: subst' in + let more = + more @ more_to_be_restricted + @ more_to_be_restricted'@more_to_be_restricted'' in + (more, subst') + with Occur -> + let error_msg = lazy (sprintf + "Cannot restrict the context of the metavariable ?%d over the hypotheses %s since ?%d is already instantiated with %s and at least one of the hypotheses occurs in the substituted term" + n (names_of_context_indexes context to_be_restricted) n + (ppterm ~metasenv subst term)) + in + (* DEBUG + debug_print (lazy error_msg); + debug_print (lazy ("metasenv = \n" ^ (ppmetasenv metasenv subst))); + debug_print (lazy ("subst = \n" ^ (ppsubst subst))); + debug_print (lazy ("context = \n" ^ (ppcontext subst context))); *) + raise (MetaSubstFailure error_msg))) + subst ([], []) + in + restrict subst (more_to_be_restricted @ more_to_be_restricted') metasenv +;; + +(*CSC: maybe we should rename delift in abstract, as I did in my dissertation *)(*Andrea: maybe not*) + +let delift n subst context metasenv l t = +(* INVARIANT: we suppose that t is not another occurrence of Meta(n,_), + otherwise the occur check does not make sense *) + +(* + debug_print (lazy ("sto deliftando il termine " ^ (CicPp.ppterm t) ^ " rispetto + al contesto locale " ^ (CicPp.ppterm (Cic.Meta(0,l))))); +*) + + let module S = CicSubstitution in + let l = + let (_, canonical_context, _) = CicUtil.lookup_meta n metasenv in + List.map2 (fun ct lt -> + match (ct, lt) with + | None, _ -> None + | Some _, _ -> lt) + canonical_context l + in + let to_be_restricted = ref [] in + let rec deliftaux k = + let module C = Cic in + function + | C.Rel m as t-> + if m <=k then + t + else + (try + match List.nth context (m-k-1) with + Some (_,C.Def (t,_)) -> + (*CSC: Hmmm. This bit of reduction is not in the spirit of *) + (*CSC: first order unification. Does it help or does it harm? *) + (*CSC: ANSWER: it hurts performances since it is possible to *) + (*CSC: have an exponential explosion of the size of the proof.*) + (*CSC: However, without this bit of reduction some "apply" in *) + (*CSC: the library fail (e.g. nat/nth_prime.ma). *) + deliftaux k (S.lift m t) + | Some (_,C.Decl t) -> + C.Rel ((position (m-k) l) + k) + | None -> raise (MetaSubstFailure (lazy "RelToHiddenHypothesis")) + with + Failure _ -> + raise (MetaSubstFailure (lazy "Unbound variable found in deliftaux")) + ) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,deliftaux k t) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (i, l1) as t -> + (try + let (_,t,_) = CicUtil.lookup_subst i subst in + deliftaux k (CicSubstitution.subst_meta l1 t) + with CicUtil.Subst_not_found _ -> + (* see the top level invariant *) + if (i = n) then + raise (MetaSubstFailure (lazy (sprintf + "Cannot unify the metavariable ?%d with a term that has as subterm %s in which the same metavariable occurs (occur check)" + i (ppterm ~metasenv subst t)))) + else + begin + (* I do not consider the term associated to ?i in subst since *) + (* in this way I can restrict if something goes wrong. *) + let rec deliftl j = + function + [] -> [] + | None::tl -> None::(deliftl (j+1) tl) + | (Some t)::tl -> + let l1' = (deliftl (j+1) tl) in + try + Some (deliftaux k t)::l1' + with + NotInTheList + | MetaSubstFailure _ -> + to_be_restricted := + (i,j)::!to_be_restricted ; None::l1' + in + let l' = deliftl 1 l1 in + C.Meta(i,l') + end) + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (deliftaux k te, deliftaux k ty) + | C.Prod (n,s,t) -> C.Prod (n, deliftaux k s, deliftaux (k+1) t) + | C.Lambda (n,s,t) -> C.Lambda (n, deliftaux k s, deliftaux (k+1) t) + | C.LetIn (n,s,t) -> C.LetIn (n, deliftaux k s, deliftaux (k+1) t) + | C.Appl l -> C.Appl (List.map (deliftaux k) l) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,deliftaux k t) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,typeno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,deliftaux k t) exp_named_subst + in + C.MutInd (uri,typeno,exp_named_subst') + | C.MutConstruct (uri,typeno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,deliftaux k t) exp_named_subst + in + C.MutConstruct (uri,typeno,consno,exp_named_subst') + | C.MutCase (sp,i,outty,t,pl) -> + C.MutCase (sp, i, deliftaux k outty, deliftaux k t, + List.map (deliftaux k) pl) + | C.Fix (i, fl) -> + let len = List.length fl in + let liftedfl = + List.map + (fun (name, i, ty, bo) -> + (name, i, deliftaux k ty, deliftaux (k+len) bo)) + fl + in + C.Fix (i, liftedfl) + | C.CoFix (i, fl) -> + let len = List.length fl in + let liftedfl = + List.map + (fun (name, ty, bo) -> (name, deliftaux k ty, deliftaux (k+len) bo)) + fl + in + C.CoFix (i, liftedfl) + in + let res = + try + deliftaux 0 t + with + NotInTheList -> + (* This is the case where we fail even first order unification. *) + (* The reason is that our delift function is weaker than first *) + (* order (in the sense of alpha-conversion). See comment above *) + (* related to the delift function. *) +(* debug_print (lazy "First Order UnificationFailure during delift") ; +debug_print(lazy (sprintf + "Error trying to abstract %s over [%s]: the algorithm only tried to abstract over bound variables" + (ppterm subst t) + (String.concat "; " + (List.map + (function Some t -> ppterm subst t | None -> "_") l + )))); *) + let msg = (lazy (sprintf + "Error trying to abstract %s over [%s]: the algorithm only tried to abstract over bound variables" + (ppterm ~metasenv subst t) + (String.concat "; " + (List.map + (function Some t -> ppterm ~metasenv subst t | None -> "_") + l)))) + in + if + List.exists + (function + Some t -> CicUtil.is_meta_closed (apply_subst subst t) + | None -> true) l + then + raise (Uncertain msg) + else + raise (MetaSubstFailure msg) + in + let (metasenv, subst) = restrict subst !to_be_restricted metasenv in + res, metasenv, subst +;; + +(* delifts a term t of n levels strating from k, that is changes (Rel m) + * to (Rel (m - n)) when m > (k + n). if k <= m < k + n delift fails + *) +let delift_rels_from subst metasenv k n = + let rec liftaux subst metasenv k = + let module C = Cic in + function + C.Rel m as t -> + if m < k then + t, subst, metasenv + else if m < k + n then + raise DeliftingARelWouldCaptureAFreeVariable + else + C.Rel (m - n), subst, metasenv + | C.Var (uri,exp_named_subst) -> + let exp_named_subst',subst,metasenv = + List.fold_right + (fun (uri,t) (l,subst,metasenv) -> + let t',subst,metasenv = liftaux subst metasenv k t in + (uri,t')::l,subst,metasenv) exp_named_subst ([],subst,metasenv) + in + C.Var (uri,exp_named_subst'),subst,metasenv + | C.Meta (i,l) -> + (try + let (_, t,_) = lookup_subst i subst in + liftaux subst metasenv k (CicSubstitution.subst_meta l t) + with CicUtil.Subst_not_found _ -> + let l',to_be_restricted,subst,metasenv = + let rec aux con l subst metasenv = + match l with + [] -> [],[],subst,metasenv + | he::tl -> + let tl',to_be_restricted,subst,metasenv = + aux (con + 1) tl subst metasenv in + let he',more_to_be_restricted,subst,metasenv = + match he with + None -> None,[],subst,metasenv + | Some t -> + try + let t',subst,metasenv = liftaux subst metasenv k t in + Some t',[],subst,metasenv + with + DeliftingARelWouldCaptureAFreeVariable -> + None,[i,con],subst,metasenv + in + he'::tl',more_to_be_restricted@to_be_restricted,subst,metasenv + in + aux 1 l subst metasenv in + let metasenv,subst = restrict subst to_be_restricted metasenv in + C.Meta(i,l'),subst,metasenv) + | C.Sort _ as t -> t,subst,metasenv + | C.Implicit _ as t -> t,subst,metasenv + | C.Cast (te,ty) -> + let te',subst,metasenv = liftaux subst metasenv k te in + let ty',subst,metasenv = liftaux subst metasenv k ty in + C.Cast (te',ty'),subst,metasenv + | C.Prod (n,s,t) -> + let s',subst,metasenv = liftaux subst metasenv k s in + let t',subst,metasenv = liftaux subst metasenv (k+1) t in + C.Prod (n,s',t'),subst,metasenv + | C.Lambda (n,s,t) -> + let s',subst,metasenv = liftaux subst metasenv k s in + let t',subst,metasenv = liftaux subst metasenv (k+1) t in + C.Lambda (n,s',t'),subst,metasenv + | C.LetIn (n,s,t) -> + let s',subst,metasenv = liftaux subst metasenv k s in + let t',subst,metasenv = liftaux subst metasenv (k+1) t in + C.LetIn (n,s',t'),subst,metasenv + | C.Appl l -> + let l',subst,metasenv = + List.fold_right + (fun t (l,subst,metasenv) -> + let t',subst,metasenv = liftaux subst metasenv k t in + t'::l,subst,metasenv) l ([],subst,metasenv) in + C.Appl l',subst,metasenv + | C.Const (uri,exp_named_subst) -> + let exp_named_subst',subst,metasenv = + List.fold_right + (fun (uri,t) (l,subst,metasenv) -> + let t',subst,metasenv = liftaux subst metasenv k t in + (uri,t')::l,subst,metasenv) exp_named_subst ([],subst,metasenv) + in + C.Const (uri,exp_named_subst'),subst,metasenv + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst',subst,metasenv = + List.fold_right + (fun (uri,t) (l,subst,metasenv) -> + let t',subst,metasenv = liftaux subst metasenv k t in + (uri,t')::l,subst,metasenv) exp_named_subst ([],subst,metasenv) + in + C.MutInd (uri,tyno,exp_named_subst'),subst,metasenv + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst',subst,metasenv = + List.fold_right + (fun (uri,t) (l,subst,metasenv) -> + let t',subst,metasenv = liftaux subst metasenv k t in + (uri,t')::l,subst,metasenv) exp_named_subst ([],subst,metasenv) + in + C.MutConstruct (uri,tyno,consno,exp_named_subst'),subst,metasenv + | C.MutCase (sp,i,outty,t,pl) -> + let outty',subst,metasenv = liftaux subst metasenv k outty in + let t',subst,metasenv = liftaux subst metasenv k t in + let pl',subst,metasenv = + List.fold_right + (fun t (l,subst,metasenv) -> + let t',subst,metasenv = liftaux subst metasenv k t in + t'::l,subst,metasenv) pl ([],subst,metasenv) + in + C.MutCase (sp,i,outty',t',pl'),subst,metasenv + | C.Fix (i, fl) -> + let len = List.length fl in + let liftedfl,subst,metasenv = + List.fold_right + (fun (name, i, ty, bo) (l,subst,metasenv) -> + let ty',subst,metasenv = liftaux subst metasenv k ty in + let bo',subst,metasenv = liftaux subst metasenv (k+len) bo in + (name,i,ty',bo')::l,subst,metasenv + ) fl ([],subst,metasenv) + in + C.Fix (i, liftedfl),subst,metasenv + | C.CoFix (i, fl) -> + let len = List.length fl in + let liftedfl,subst,metasenv = + List.fold_right + (fun (name, ty, bo) (l,subst,metasenv) -> + let ty',subst,metasenv = liftaux subst metasenv k ty in + let bo',subst,metasenv = liftaux subst metasenv (k+len) bo in + (name,ty',bo')::l,subst,metasenv + ) fl ([],subst,metasenv) + in + C.CoFix (i, liftedfl),subst,metasenv + in + liftaux subst metasenv k + +let delift_rels subst metasenv n t = + delift_rels_from subst metasenv 1 n t + + +(**** END OF DELIFT ****) + + +(** {2 Format-like pretty printers} *) + +let fpp_gen ppf s = + Format.pp_print_string ppf s; + Format.pp_print_newline ppf (); + Format.pp_print_flush ppf () + +let fppsubst ppf subst = fpp_gen ppf (ppsubst ~metasenv:[] subst) +let fppterm ppf term = fpp_gen ppf (CicPp.ppterm term) +let fppmetasenv ppf metasenv = fpp_gen ppf (ppmetasenv [] metasenv) diff --git a/components/cic_unification/cicMetaSubst.mli b/components/cic_unification/cicMetaSubst.mli new file mode 100644 index 000000000..bc5b4c039 --- /dev/null +++ b/components/cic_unification/cicMetaSubst.mli @@ -0,0 +1,99 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception MetaSubstFailure of string Lazy.t +exception Uncertain of string Lazy.t +exception AssertFailure of string Lazy.t +exception DeliftingARelWouldCaptureAFreeVariable;; + +(* The entry (i,t) in a substitution means that *) +(* (META i) have been instantiated with t. *) +(* type substitution = (int * (Cic.context * Cic.term)) list *) + + (** @raise SubstNotFound *) + +(* apply_subst subst t *) +(* applies the substitution [subst] to [t] *) +(* [subst] must be already unwinded *) + +val apply_subst : Cic.substitution -> Cic.term -> Cic.term +val apply_subst_context : Cic.substitution -> Cic.context -> Cic.context +val apply_subst_metasenv: Cic.substitution -> Cic.metasenv -> Cic.metasenv + +(*** delifting ***) + +val delift : + int -> Cic.substitution -> Cic.context -> Cic.metasenv -> + (Cic.term option) list -> Cic.term -> + Cic.term * Cic.metasenv * Cic.substitution +val restrict : + Cic.substitution -> (int * int) list -> Cic.metasenv -> + Cic.metasenv * Cic.substitution + +(** delifts the Rels in t of n + * @raise DeliftingARelWouldCaptureAFreeVariable + *) +val delift_rels : + Cic.substitution -> Cic.metasenv -> int -> Cic.term -> + Cic.term * Cic.substitution * Cic.metasenv + +(** {2 Pretty printers} *) +val use_low_level_ppterm_in_context : bool ref +val set_ppterm_in_context : + (metasenv:Cic.metasenv -> Cic.substitution -> Cic.term -> Cic.context -> + string) -> unit + +val ppsubst_unfolded: metasenv:Cic.metasenv -> Cic.substitution -> string +val ppsubst: metasenv:Cic.metasenv -> Cic.substitution -> string +val ppterm: metasenv:Cic.metasenv -> Cic.substitution -> Cic.term -> string +val ppcontext: + metasenv:Cic.metasenv -> ?sep: string -> Cic.substitution -> Cic.context -> + string +val ppterm_in_name_context: + metasenv:Cic.metasenv -> Cic.substitution -> Cic.term -> + (Cic.name option) list -> string +val ppterm_in_context: + metasenv:Cic.metasenv -> Cic.substitution -> Cic.term -> Cic.context -> string +val ppmetasenv: ?sep: string -> Cic.substitution -> Cic.metasenv -> string + +(** {2 Format-like pretty printers} + * As above with prototypes suitable for toplevel/ocamldebug printers. No + * subsitutions are applied here since such printers are required to be invoked + * with only one argument. + *) + +val fppsubst: Format.formatter -> Cic.substitution -> unit +val fppterm: Format.formatter -> Cic.term -> unit +val fppmetasenv: Format.formatter -> Cic.metasenv -> unit + +(* +(* DEBUG *) +val print_counters: unit -> unit +val reset_counters: unit -> unit +*) + +(* val clean_up_meta : + Cic.substitution -> Cic.metasenv -> Cic.term -> Cic.term +*) diff --git a/components/cic_unification/cicMkImplicit.ml b/components/cic_unification/cicMkImplicit.ml new file mode 100644 index 000000000..36679223c --- /dev/null +++ b/components/cic_unification/cicMkImplicit.ml @@ -0,0 +1,122 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(* identity_relocation_list_for_metavariable i canonical_context *) +(* returns the identity relocation list, which is the list [1 ; ... ; n] *) +(* where n = List.length [canonical_context] *) +(*CSC: ma mi basta la lunghezza del contesto canonico!!!*) +let identity_relocation_list_for_metavariable ?(start = 1) canonical_context = + let rec aux = + function + (_,[]) -> [] + | (n,None::tl) -> None::(aux ((n+1),tl)) + | (n,_::tl) -> (Some (Cic.Rel n))::(aux ((n+1),tl)) + in + aux (start,canonical_context) + +(* Returns the first meta whose number is above the *) +(* number of the higher meta. *) +let new_meta metasenv subst = + let rec aux = + function + None, [] -> 1 + | Some n, [] -> n + | None, n::tl -> aux (Some n,tl) + | Some m, n::tl -> if n > m then aux (Some n,tl) else aux (Some m,tl) + in + let indexes = + (List.map (fun (i, _, _) -> i) metasenv) @ (List.map fst subst) + in + 1 + aux (None, indexes) + +(* let apply_subst_context = CicMetaSubst.apply_subst_context;; *) +(* questa o la precedente sembrano essere equivalenti come tempi *) +let apply_subst_context _ context = context ;; + +let mk_implicit metasenv subst context = + let newmeta = new_meta metasenv subst in + let newuniv = CicUniv.fresh () in + let irl = identity_relocation_list_for_metavariable context in + (* in the following mk_* functions we apply substitution to canonical + * context since we have the invariant that the metasenv has already been + * instantiated with subst *) + let context = apply_subst_context subst context in + ([ newmeta, [], Cic.Sort (Cic.Type newuniv) ; + (* TASSI: ?? *) + newmeta + 1, context, Cic.Meta (newmeta, []); + newmeta + 2, context, Cic.Meta (newmeta + 1,irl) ] @ metasenv, + newmeta + 2) + +let mk_implicit_type metasenv subst context = + let newmeta = new_meta metasenv subst in + let newuniv = CicUniv.fresh () in + let context = apply_subst_context subst context in + ([ newmeta, [], Cic.Sort (Cic.Type newuniv); + (* TASSI: ?? *) + newmeta + 1, context, Cic.Meta (newmeta, []) ] @metasenv, + newmeta + 1) + +let mk_implicit_sort metasenv subst = + let newmeta = new_meta metasenv subst in + let newuniv = CicUniv.fresh () in + ([ newmeta, [], Cic.Sort (Cic.Type newuniv)] @ metasenv, newmeta) + (* TASSI: ?? *) + +let n_fresh_metas metasenv subst context n = + if n = 0 then metasenv, [] + else + let irl = identity_relocation_list_for_metavariable context in + let context = apply_subst_context subst context in + let newmeta = new_meta metasenv subst in + let newuniv = CicUniv.fresh () in + let rec aux newmeta n = + if n = 0 then metasenv, [] + else + let metasenv', l = aux (newmeta + 3) (n-1) in + (* TASSI: ?? *) + (newmeta, context, Cic.Sort (Cic.Type newuniv)):: + (newmeta + 1, context, Cic.Meta (newmeta, irl)):: + (newmeta + 2, context, Cic.Meta (newmeta + 1,irl))::metasenv', + Cic.Meta(newmeta+2,irl)::l in + aux newmeta n + +let fresh_subst metasenv subst context uris = + let irl = identity_relocation_list_for_metavariable context in + let context = apply_subst_context subst context in + let newmeta = new_meta metasenv subst in + let newuniv = CicUniv.fresh () in + let rec aux newmeta = function + [] -> metasenv, [] + | uri::tl -> + let metasenv', l = aux (newmeta + 3) tl in + (* TASSI: ?? *) + (newmeta, context, Cic.Sort (Cic.Type newuniv)):: + (newmeta + 1, context, Cic.Meta (newmeta, irl)):: + (newmeta + 2, context, Cic.Meta (newmeta + 1,irl))::metasenv', + (uri,Cic.Meta(newmeta+2,irl))::l in + aux newmeta uris + diff --git a/components/cic_unification/cicMkImplicit.mli b/components/cic_unification/cicMkImplicit.mli new file mode 100644 index 000000000..476270144 --- /dev/null +++ b/components/cic_unification/cicMkImplicit.mli @@ -0,0 +1,60 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + +(* identity_relocation_list_for_metavariable i canonical_context *) +(* returns the identity relocation list, which is the list *) +(* [Rel 1 ; ... ; Rel n] where n = List.length [canonical_context] *) +val identity_relocation_list_for_metavariable : + ?start: int -> 'a option list -> Cic.term option list + +(* Returns the first meta whose number is above the *) +(* number of the higher meta. *) +val new_meta : Cic.metasenv -> Cic.substitution -> int + +(** [mk_implicit metasenv context] + * add a fresh metavariable to the given metasenv, using given context + * @return the new metasenv and the index of the added conjecture *) +val mk_implicit: Cic.metasenv -> Cic.substitution -> Cic.context -> Cic.metasenv * int + +(** as above, but the fresh metavariable represents a type *) +val mk_implicit_type: Cic.metasenv -> Cic.substitution -> Cic.context -> Cic.metasenv * int + +(** as above, but the fresh metavariable represents a sort *) +val mk_implicit_sort: Cic.metasenv -> Cic.substitution -> Cic.metasenv * int + +(** [mk_implicit metasenv context] create n fresh metavariables *) +val n_fresh_metas: + Cic.metasenv -> Cic.substitution -> Cic.context -> int -> Cic.metasenv * Cic.term list + +(** [fresh_subst metasenv context uris] takes in input a list of uri and +creates a fresh explicit substitution *) +val fresh_subst: + Cic.metasenv -> + Cic.substitution -> + Cic.context -> + UriManager.uri list -> + Cic.metasenv * (Cic.term Cic.explicit_named_substitution) + diff --git a/components/cic_unification/cicRefine.ml b/components/cic_unification/cicRefine.ml new file mode 100644 index 000000000..954c4835b --- /dev/null +++ b/components/cic_unification/cicRefine.ml @@ -0,0 +1,2139 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +open Printf + +exception RefineFailure of string Lazy.t;; +exception Uncertain of string Lazy.t;; +exception AssertFailure of string Lazy.t;; + +(* for internal use only; the integer is the number of surplus arguments *) +exception MoreArgsThanExpected of int * exn;; + +let insert_coercions = ref true +let pack_coercions = ref true + +let debug = false;; + +let debug_print = + if debug then (fun x -> prerr_endline (Lazy.force x)) else (fun _ -> ());; + +let profiler_eat_prods2 = HExtlib.profile "CicRefine.fo_unif_eat_prods2" + +let fo_unif_subst_eat_prods2 subst context metasenv t1 t2 ugraph = + try +let foo () = + CicUnification.fo_unif_subst subst context metasenv t1 t2 ugraph +in profiler_eat_prods2.HExtlib.profile foo () + with + (CicUnification.UnificationFailure msg) -> raise (RefineFailure msg) + | (CicUnification.Uncertain msg) -> raise (Uncertain msg) +;; + +let profiler_eat_prods = HExtlib.profile "CicRefine.fo_unif_eat_prods" + +let fo_unif_subst_eat_prods subst context metasenv t1 t2 ugraph = + try +let foo () = + CicUnification.fo_unif_subst subst context metasenv t1 t2 ugraph +in profiler_eat_prods.HExtlib.profile foo () + with + (CicUnification.UnificationFailure msg) -> raise (RefineFailure msg) + | (CicUnification.Uncertain msg) -> raise (Uncertain msg) +;; + +let profiler = HExtlib.profile "CicRefine.fo_unif" + +let fo_unif_subst subst context metasenv t1 t2 ugraph = + try +let foo () = + CicUnification.fo_unif_subst subst context metasenv t1 t2 ugraph +in profiler.HExtlib.profile foo () + with + (CicUnification.UnificationFailure msg) -> raise (RefineFailure msg) + | (CicUnification.Uncertain msg) -> raise (Uncertain msg) +;; + +let enrich localization_tbl t ?(f = fun msg -> msg) exn = + let exn' = + match exn with + RefineFailure msg -> RefineFailure (f msg) + | Uncertain msg -> Uncertain (f msg) + | AssertFailure msg -> prerr_endline (Lazy.force msg); AssertFailure (f msg) + | Sys.Break -> raise exn + | _ -> prerr_endline (Printexc.to_string exn); assert false + in + let loc = + try + Cic.CicHash.find localization_tbl t + with Not_found -> + HLog.debug ("!!! NOT LOCALIZED: " ^ CicPp.ppterm t); + raise exn' + in + raise (HExtlib.Localized (loc,exn')) + +let relocalize localization_tbl oldt newt = + try + let infos = Cic.CicHash.find localization_tbl oldt in + Cic.CicHash.remove localization_tbl oldt; + Cic.CicHash.add localization_tbl newt infos; + with + Not_found -> () +;; + +let rec split l n = + match (l,n) with + (l,0) -> ([], l) + | (he::tl, n) -> let (l1,l2) = split tl (n-1) in (he::l1,l2) + | (_,_) -> raise (AssertFailure (lazy "split: list too short")) +;; + +let exp_impl metasenv subst context = + function + | Some `Type -> + let (metasenv', idx) = + CicMkImplicit.mk_implicit_type metasenv subst context in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context in + metasenv', Cic.Meta (idx, irl) + | Some `Closed -> + let (metasenv', idx) = CicMkImplicit.mk_implicit metasenv subst [] in + metasenv', Cic.Meta (idx, []) + | None -> + let (metasenv', idx) = CicMkImplicit.mk_implicit metasenv subst context in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context in + metasenv', Cic.Meta (idx, irl) + | _ -> assert false +;; + +let is_a_double_coercion t = + let last_of l = + let rec aux acc = function + | x::[] -> acc,x + | x::tl -> aux (acc@[x]) tl + | [] -> assert false + in + aux [] l + in + let imp = Cic.Implicit None in + let dummyres = false,imp, imp,imp,imp in + match t with + | Cic.Appl (c1::tl) when CoercDb.is_a_coercion' c1 -> + (match last_of tl with + | sib1,Cic.Appl (c2::tl2) when CoercDb.is_a_coercion' c2 -> + let sib2,head = last_of tl2 in + true, c1, c2, head,Cic.Appl (c1::sib1@[Cic.Appl + (c2::sib2@[imp])]) + | _ -> dummyres) + | _ -> dummyres + +let more_args_than_expected localization_tbl metasenv subst he context hetype' residuals tlbody_and_type exn += + let len = List.length tlbody_and_type in + let msg = + lazy ("The term " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst he context ^ + " (that has type "^ CicMetaSubst.ppterm_in_context ~metasenv subst hetype' context ^ + ") is here applied to " ^ string_of_int len ^ + " arguments but here it can handle only up to " ^ + string_of_int (len - residuals) ^ " arguments") + in + enrich localization_tbl he ~f:(fun _-> msg) exn +;; + +let mk_prod_of_metas metasenv context subst args = + let rec mk_prod metasenv context' = function + | [] -> + let (metasenv, idx) = + CicMkImplicit.mk_implicit_type metasenv subst context' + in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context' + in + metasenv,Cic.Meta (idx, irl) + | (_,argty)::tl -> + let (metasenv, idx) = + CicMkImplicit.mk_implicit_type metasenv subst context' + in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context' + in + let meta = Cic.Meta (idx,irl) in + let name = + (* The name must be fresh for context. *) + (* Nevertheless, argty is well-typed only in context. *) + (* Thus I generate a name (name_hint) in context and *) + (* then I generate a name --- using the hint name_hint *) + (* --- that is fresh in context'. *) + let name_hint = + FreshNamesGenerator.mk_fresh_name ~subst metasenv + (CicMetaSubst.apply_subst_context subst context) + Cic.Anonymous + ~typ:(CicMetaSubst.apply_subst subst argty) + in + FreshNamesGenerator.mk_fresh_name ~subst + [] context' name_hint ~typ:(Cic.Sort Cic.Prop) + in + let metasenv,target = + mk_prod metasenv ((Some (name, Cic.Decl meta))::context') tl + in + metasenv,Cic.Prod (name,meta,target) + in + mk_prod metasenv context args +;; + +let rec type_of_constant uri ugraph = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let _ = CicTypeChecker.typecheck uri in + let obj,u = + try + CicEnvironment.get_cooked_obj ugraph uri + with Not_found -> assert false + in + match obj with + C.Constant (_,_,ty,_,_) -> ty,u + | C.CurrentProof (_,_,_,ty,_,_) -> ty,u + | _ -> + raise + (RefineFailure + (lazy ("Unknown constant definition " ^ U.string_of_uri uri))) + +and type_of_variable uri ugraph = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let _ = CicTypeChecker.typecheck uri in + let obj,u = + try + CicEnvironment.get_cooked_obj ugraph uri + with Not_found -> assert false + in + match obj with + C.Variable (_,_,ty,_,_) -> ty,u + | _ -> + raise + (RefineFailure + (lazy ("Unknown variable definition " ^ UriManager.string_of_uri uri))) + +and type_of_mutual_inductive_defs uri i ugraph = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let _ = CicTypeChecker.typecheck uri in + let obj,u = + try + CicEnvironment.get_cooked_obj ugraph uri + with Not_found -> assert false + in + match obj with + C.InductiveDefinition (dl,_,_,_) -> + let (_,_,arity,_) = List.nth dl i in + arity,u + | _ -> + raise + (RefineFailure + (lazy ("Unknown mutual inductive definition " ^ U.string_of_uri uri))) + +and type_of_mutual_inductive_constr uri i j ugraph = + let module C = Cic in + let module R = CicReduction in + let module U = UriManager in + let _ = CicTypeChecker.typecheck uri in + let obj,u = + try + CicEnvironment.get_cooked_obj ugraph uri + with Not_found -> assert false + in + match obj with + C.InductiveDefinition (dl,_,_,_) -> + let (_,_,_,cl) = List.nth dl i in + let (_,ty) = List.nth cl (j-1) in + ty,u + | _ -> + raise + (RefineFailure + (lazy + ("Unkown mutual inductive definition " ^ U.string_of_uri uri))) + + +(* type_of_aux' is just another name (with a different scope) for type_of_aux *) + +(* the check_branch function checks if a branch of a case is refinable. + It returns a pair (outype_instance,args), a subst and a metasenv. + outype_instance is the expected result of applying the case outtype + to args. + The problem is that outype is in general unknown, and we should + try to synthesize it from the above information, that is in general + a second order unification problem. *) + +and check_branch n context metasenv subst left_args_no actualtype term expectedtype ugraph = + let module C = Cic in + (* let module R = CicMetaSubst in *) + let module R = CicReduction in + match R.whd ~subst context expectedtype with + C.MutInd (_,_,_) -> + (n,context,actualtype, [term]), subst, metasenv, ugraph + | C.Appl (C.MutInd (_,_,_)::tl) -> + let (_,arguments) = split tl left_args_no in + (n,context,actualtype, arguments@[term]), subst, metasenv, ugraph + | C.Prod (name,so,de) -> + (* we expect that the actual type of the branch has the due + number of Prod *) + (match R.whd ~subst context actualtype with + C.Prod (name',so',de') -> + let subst, metasenv, ugraph1 = + fo_unif_subst subst context metasenv so so' ugraph in + let term' = + (match CicSubstitution.lift 1 term with + C.Appl l -> C.Appl (l@[C.Rel 1]) + | t -> C.Appl [t ; C.Rel 1]) in + (* we should also check that the name variable is anonymous in + the actual type de' ?? *) + check_branch (n+1) + ((Some (name,(C.Decl so)))::context) + metasenv subst left_args_no de' term' de ugraph1 + | _ -> raise (AssertFailure (lazy "Wrong number of arguments"))) + | _ -> raise (AssertFailure (lazy "Prod or MutInd expected")) + +and type_of_aux' ?(localization_tbl = Cic.CicHash.create 1) metasenv context t + ugraph += + let rec type_of_aux subst metasenv context t ugraph = + let module C = Cic in + let module S = CicSubstitution in + let module U = UriManager in + let (t',_,_,_,_) as res = + match t with + (* function *) + C.Rel n -> + (try + match List.nth context (n - 1) with + Some (_,C.Decl ty) -> + t,S.lift n ty,subst,metasenv, ugraph + | Some (_,C.Def (_,Some ty)) -> + t,S.lift n ty,subst,metasenv, ugraph + | Some (_,C.Def (bo,None)) -> + let ty,ugraph = + (* if it is in the context it must be already well-typed*) + CicTypeChecker.type_of_aux' ~subst metasenv context + (S.lift n bo) ugraph + in + t,ty,subst,metasenv,ugraph + | None -> + enrich localization_tbl t + (RefineFailure (lazy "Rel to hidden hypothesis")) + with + Failure _ -> + enrich localization_tbl t + (RefineFailure (lazy "Not a closed term"))) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst',subst',metasenv',ugraph1 = + check_exp_named_subst + subst metasenv context exp_named_subst ugraph + in + let ty_uri,ugraph1 = type_of_variable uri ugraph in + let ty = + CicSubstitution.subst_vars exp_named_subst' ty_uri + in + C.Var (uri,exp_named_subst'),ty,subst',metasenv',ugraph1 + | C.Meta (n,l) -> + (try + let (canonical_context, term,ty) = + CicUtil.lookup_subst n subst + in + let l',subst',metasenv',ugraph1 = + check_metasenv_consistency n subst metasenv context + canonical_context l ugraph + in + (* trust or check ??? *) + C.Meta (n,l'),CicSubstitution.subst_meta l' ty, + subst', metasenv', ugraph1 + (* type_of_aux subst metasenv + context (CicSubstitution.subst_meta l term) *) + with CicUtil.Subst_not_found _ -> + let (_,canonical_context,ty) = CicUtil.lookup_meta n metasenv in + let l',subst',metasenv', ugraph1 = + check_metasenv_consistency n subst metasenv context + canonical_context l ugraph + in + C.Meta (n,l'),CicSubstitution.subst_meta l' ty, + subst', metasenv',ugraph1) + | C.Sort (C.Type tno) -> + let tno' = CicUniv.fresh() in + (try + let ugraph1 = CicUniv.add_gt tno' tno ugraph in + t,(C.Sort (C.Type tno')),subst,metasenv,ugraph1 + with + CicUniv.UniverseInconsistency msg -> raise (RefineFailure msg)) + | C.Sort _ -> + t,C.Sort (C.Type (CicUniv.fresh())),subst,metasenv,ugraph + | C.Implicit infos -> + let metasenv',t' = exp_impl metasenv subst context infos in + type_of_aux subst metasenv' context t' ugraph + | C.Cast (te,ty) -> + let ty',_,subst',metasenv',ugraph1 = + type_of_aux subst metasenv context ty ugraph + in + let te',inferredty,subst'',metasenv'',ugraph2 = + type_of_aux subst' metasenv' context te ugraph1 + in + let (te', ty'), subst''',metasenv''',ugraph3 = + coerce_to_something true localization_tbl te' inferredty ty' + subst'' metasenv'' context ugraph2 + in + C.Cast (te',ty'),ty',subst''',metasenv''',ugraph3 + | C.Prod (name,s,t) -> + let s',sort1,subst',metasenv',ugraph1 = + type_of_aux subst metasenv context s ugraph + in + let s',sort1,subst', metasenv',ugraph1 = + coerce_to_sort localization_tbl + s' sort1 subst' context metasenv' ugraph1 + in + let context_for_t = ((Some (name,(C.Decl s')))::context) in + let t',sort2,subst'',metasenv'',ugraph2 = + type_of_aux subst' metasenv' + context_for_t t ugraph1 + in + let t',sort2,subst'',metasenv'',ugraph2 = + coerce_to_sort localization_tbl + t' sort2 subst'' context_for_t metasenv'' ugraph2 + in + let sop,subst''',metasenv''',ugraph3 = + sort_of_prod localization_tbl subst'' metasenv'' + context (name,s') t' (sort1,sort2) ugraph2 + in + C.Prod (name,s',t'),sop,subst''',metasenv''',ugraph3 + | C.Lambda (n,s,t) -> + let s',sort1,subst',metasenv',ugraph1 = + type_of_aux subst metasenv context s ugraph + in + let s',sort1,subst',metasenv',ugraph1 = + coerce_to_sort localization_tbl + s' sort1 subst' context metasenv' ugraph1 + in + let context_for_t = ((Some (n,(C.Decl s')))::context) in + let t',type2,subst'',metasenv'',ugraph2 = + type_of_aux subst' metasenv' context_for_t t ugraph1 + in + C.Lambda (n,s',t'),C.Prod (n,s',type2), + subst'',metasenv'',ugraph2 + | C.LetIn (n,s,t) -> + (* only to check if s is well-typed *) + let s',ty,subst',metasenv',ugraph1 = + type_of_aux subst metasenv context s ugraph + in + let context_for_t = ((Some (n,(C.Def (s',Some ty))))::context) in + + let t',inferredty,subst'',metasenv'',ugraph2 = + type_of_aux subst' metasenv' + context_for_t t ugraph1 + in + (* One-step LetIn reduction. + * Even faster than the previous solution. + * Moreover the inferred type is closer to the expected one. + *) + C.LetIn (n,s',t'), + CicSubstitution.subst ~avoid_beta_redexes:true s' inferredty, + subst'',metasenv'',ugraph2 + | C.Appl (he::((_::_) as tl)) -> + let he',hetype,subst',metasenv',ugraph1 = + type_of_aux subst metasenv context he ugraph + in + let tlbody_and_type,subst'',metasenv'',ugraph2 = + typeof_list subst' metasenv' context ugraph1 tl + in + let coerced_he,coerced_args,applty,subst''',metasenv''',ugraph3 = + eat_prods true subst'' metasenv'' context + he' hetype tlbody_and_type ugraph2 + in + let newappl = (C.Appl (coerced_he::coerced_args)) in + avoid_double_coercion + context subst''' metasenv''' ugraph3 newappl applty + | C.Appl _ -> assert false + | C.Const (uri,exp_named_subst) -> + let exp_named_subst',subst',metasenv',ugraph1 = + check_exp_named_subst subst metasenv context + exp_named_subst ugraph in + let ty_uri,ugraph2 = type_of_constant uri ugraph1 in + let cty = + CicSubstitution.subst_vars exp_named_subst' ty_uri + in + C.Const (uri,exp_named_subst'),cty,subst',metasenv',ugraph2 + | C.MutInd (uri,i,exp_named_subst) -> + let exp_named_subst',subst',metasenv',ugraph1 = + check_exp_named_subst subst metasenv context + exp_named_subst ugraph + in + let ty_uri,ugraph2 = type_of_mutual_inductive_defs uri i ugraph1 in + let cty = + CicSubstitution.subst_vars exp_named_subst' ty_uri in + C.MutInd (uri,i,exp_named_subst'),cty,subst',metasenv',ugraph2 + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let exp_named_subst',subst',metasenv',ugraph1 = + check_exp_named_subst subst metasenv context + exp_named_subst ugraph + in + let ty_uri,ugraph2 = + type_of_mutual_inductive_constr uri i j ugraph1 + in + let cty = + CicSubstitution.subst_vars exp_named_subst' ty_uri + in + C.MutConstruct (uri,i,j,exp_named_subst'),cty,subst', + metasenv',ugraph2 + | C.MutCase (uri, i, outtype, term, pl) -> + (* first, get the inductive type (and noparams) + * in the environment *) + let (_,b,arity,constructors), expl_params, no_left_params,ugraph = + let _ = CicTypeChecker.typecheck uri in + let obj,u = CicEnvironment.get_cooked_obj ugraph uri in + match obj with + C.InductiveDefinition (l,expl_params,parsno,_) -> + List.nth l i , expl_params, parsno, u + | _ -> + enrich localization_tbl t + (RefineFailure + (lazy ("Unkown mutual inductive definition " ^ + U.string_of_uri uri))) + in + if List.length constructors <> List.length pl then + enrich localization_tbl t + (RefineFailure + (lazy "Wrong number of cases")) ; + let rec count_prod t = + match CicReduction.whd ~subst context t with + C.Prod (_, _, t) -> 1 + (count_prod t) + | _ -> 0 + in + let no_args = count_prod arity in + (* now, create a "generic" MutInd *) + let metasenv,left_args = + CicMkImplicit.n_fresh_metas metasenv subst context no_left_params + in + let metasenv,right_args = + let no_right_params = no_args - no_left_params in + if no_right_params < 0 then assert false + else CicMkImplicit.n_fresh_metas + metasenv subst context no_right_params + in + let metasenv,exp_named_subst = + CicMkImplicit.fresh_subst metasenv subst context expl_params in + let expected_type = + if no_args = 0 then + C.MutInd (uri,i,exp_named_subst) + else + C.Appl + (C.MutInd (uri,i,exp_named_subst)::(left_args @ right_args)) + in + (* check consistency with the actual type of term *) + let term',actual_type,subst,metasenv,ugraph1 = + type_of_aux subst metasenv context term ugraph in + let expected_type',_, subst, metasenv,ugraph2 = + type_of_aux subst metasenv context expected_type ugraph1 + in + let actual_type = CicReduction.whd ~subst context actual_type in + let subst,metasenv,ugraph3 = + try + fo_unif_subst subst context metasenv + expected_type' actual_type ugraph2 + with + exn -> + enrich localization_tbl term' exn + ~f:(function _ -> + lazy ("The term " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst term' + context ^ " has type " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst actual_type + context ^ " but is here used with type " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst expected_type' context)) + in + let rec instantiate_prod t = + function + [] -> t + | he::tl -> + match CicReduction.whd ~subst context t with + C.Prod (_,_,t') -> + instantiate_prod (CicSubstitution.subst he t') tl + | _ -> assert false + in + let arity_instantiated_with_left_args = + instantiate_prod arity left_args in + (* TODO: check if the sort elimination + * is allowed: [(I q1 ... qr)|B] *) + let (pl',_,outtypeinstances,subst,metasenv,ugraph4) = + List.fold_right + (fun p (pl,j,outtypeinstances,subst,metasenv,ugraph) -> + let constructor = + if left_args = [] then + (C.MutConstruct (uri,i,j,exp_named_subst)) + else + (C.Appl + (C.MutConstruct (uri,i,j,exp_named_subst)::left_args)) + in + let p',actual_type,subst,metasenv,ugraph1 = + type_of_aux subst metasenv context p ugraph + in + let constructor',expected_type, subst, metasenv,ugraph2 = + type_of_aux subst metasenv context constructor ugraph1 + in + let outtypeinstance,subst,metasenv,ugraph3 = + try + check_branch 0 context metasenv subst + no_left_params actual_type constructor' expected_type + ugraph2 + with + exn -> + enrich localization_tbl constructor' + ~f:(fun _ -> + lazy ("The term " ^ + CicMetaSubst.ppterm_in_context metasenv subst p' + context ^ " has type " ^ + CicMetaSubst.ppterm_in_context metasenv subst actual_type + context ^ " but is here used with type " ^ + CicMetaSubst.ppterm_in_context metasenv subst expected_type + context)) exn + in + (p'::pl,j-1, + outtypeinstances@[outtypeinstance],subst,metasenv,ugraph3)) + pl ([],List.length pl,[],subst,metasenv,ugraph3) + in + + (* we are left to check that the outype matches his instances. + The easy case is when the outype is specified, that amount + to a trivial check. Otherwise, we should guess a type from + its instances + *) + + let outtype,outtypety, subst, metasenv,ugraph4 = + type_of_aux subst metasenv context outtype ugraph4 in + (match outtype with + | C.Meta (n,l) -> + (let candidate,ugraph5,metasenv,subst = + let exp_name_subst, metasenv = + let o,_ = + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri + in + let uris = CicUtil.params_of_obj o in + List.fold_right ( + fun uri (acc,metasenv) -> + let metasenv',new_meta = + CicMkImplicit.mk_implicit metasenv subst context + in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable + context + in + (uri, Cic.Meta(new_meta,irl))::acc, metasenv' + ) uris ([],metasenv) + in + let ty = + match left_args,right_args with + [],[] -> Cic.MutInd(uri, i, exp_name_subst) + | _,_ -> + let rec mk_right_args = + function + 0 -> [] + | n -> (Cic.Rel n)::(mk_right_args (n - 1)) + in + let right_args_no = List.length right_args in + let lifted_left_args = + List.map (CicSubstitution.lift right_args_no) left_args + in + Cic.Appl (Cic.MutInd(uri,i,exp_name_subst):: + (lifted_left_args @ mk_right_args right_args_no)) + in + let fresh_name = + FreshNamesGenerator.mk_fresh_name ~subst metasenv + context Cic.Anonymous ~typ:ty + in + match outtypeinstances with + | [] -> + let extended_context = + let rec add_right_args = + function + Cic.Prod (name,ty,t) -> + Some (name,Cic.Decl ty)::(add_right_args t) + | _ -> [] + in + (Some (fresh_name,Cic.Decl ty)):: + (List.rev + (add_right_args arity_instantiated_with_left_args))@ + context + in + let metasenv,new_meta = + CicMkImplicit.mk_implicit metasenv subst extended_context + in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable + extended_context + in + let rec add_lambdas b = + function + Cic.Prod (name,ty,t) -> + Cic.Lambda (name,ty,(add_lambdas b t)) + | _ -> Cic.Lambda (fresh_name, ty, b) + in + let candidate = + add_lambdas (Cic.Meta (new_meta,irl)) + arity_instantiated_with_left_args + in + (Some candidate),ugraph4,metasenv,subst + | (constructor_args_no,_,instance,_)::tl -> + try + let instance',subst,metasenv = + CicMetaSubst.delift_rels subst metasenv + constructor_args_no instance + in + let candidate,ugraph,metasenv,subst = + List.fold_left ( + fun (candidate_oty,ugraph,metasenv,subst) + (constructor_args_no,_,instance,_) -> + match candidate_oty with + | None -> None,ugraph,metasenv,subst + | Some ty -> + try + let instance',subst,metasenv = + CicMetaSubst.delift_rels subst metasenv + constructor_args_no instance + in + let subst,metasenv,ugraph = + fo_unif_subst subst context metasenv + instance' ty ugraph + in + candidate_oty,ugraph,metasenv,subst + with + CicMetaSubst.DeliftingARelWouldCaptureAFreeVariable + | RefineFailure _ | Uncertain _ -> + None,ugraph,metasenv,subst + ) (Some instance',ugraph4,metasenv,subst) tl + in + match candidate with + | None -> None, ugraph,metasenv,subst + | Some t -> + let rec add_lambdas n b = + function + Cic.Prod (name,ty,t) -> + Cic.Lambda (name,ty,(add_lambdas (n + 1) b t)) + | _ -> + Cic.Lambda (fresh_name, ty, + CicSubstitution.lift (n + 1) t) + in + Some + (add_lambdas 0 t arity_instantiated_with_left_args), + ugraph,metasenv,subst + with CicMetaSubst.DeliftingARelWouldCaptureAFreeVariable -> + None,ugraph4,metasenv,subst + in + match candidate with + | None -> raise (Uncertain (lazy "can't solve an higher order unification problem")) + | Some candidate -> + let subst,metasenv,ugraph = + try + fo_unif_subst subst context metasenv + candidate outtype ugraph5 + with + exn -> assert false(* unification against a metavariable *) + in + C.MutCase (uri, i, outtype, term', pl'), + CicReduction.head_beta_reduce + (CicMetaSubst.apply_subst subst + (Cic.Appl (outtype::right_args@[term']))), + subst,metasenv,ugraph) + | _ -> (* easy case *) + let tlbody_and_type,subst,metasenv,ugraph4 = + typeof_list subst metasenv context ugraph4 (right_args @ [term']) + in + let _,_,_,subst,metasenv,ugraph4 = + eat_prods false subst metasenv context + outtype outtypety tlbody_and_type ugraph4 + in + let _,_, subst, metasenv,ugraph5 = + type_of_aux subst metasenv context + (C.Appl ((outtype :: right_args) @ [term'])) ugraph4 + in + let (subst,metasenv,ugraph6) = + List.fold_left2 + (fun (subst,metasenv,ugraph) + p (constructor_args_no,context,instance,args) + -> + let instance' = + let appl = + let outtype' = + CicSubstitution.lift constructor_args_no outtype + in + C.Appl (outtype'::args) + in + CicReduction.whd ~subst context appl + in + try + fo_unif_subst subst context metasenv instance instance' + ugraph + with + exn -> + enrich localization_tbl p exn + ~f:(function _ -> + lazy ("The term " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst p + context ^ " has type " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst instance' + context ^ " but is here used with type " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst instance + context))) + (subst,metasenv,ugraph5) pl' outtypeinstances + in + C.MutCase (uri, i, outtype, term', pl'), + CicReduction.head_beta_reduce + (CicMetaSubst.apply_subst subst + (C.Appl(outtype::right_args@[term]))), + subst,metasenv,ugraph6) + | C.Fix (i,fl) -> + let fl_ty',subst,metasenv,types,ugraph1,len = + List.fold_left + (fun (fl,subst,metasenv,types,ugraph,len) (n,_,ty,_) -> + let ty',_,subst',metasenv',ugraph1 = + type_of_aux subst metasenv context ty ugraph + in + fl @ [ty'],subst',metasenv', + Some (C.Name n,(C.Decl (CicSubstitution.lift len ty'))) + :: types, ugraph, len+1 + ) ([],subst,metasenv,[],ugraph,0) fl + in + let context' = types@context in + let fl_bo',subst,metasenv,ugraph2 = + List.fold_left + (fun (fl,subst,metasenv,ugraph) ((name,x,_,bo),ty) -> + let bo',ty_of_bo,subst,metasenv,ugraph1 = + type_of_aux subst metasenv context' bo ugraph in + let expected_ty = CicSubstitution.lift len ty in + let subst',metasenv',ugraph' = + try + fo_unif_subst subst context' metasenv + ty_of_bo expected_ty ugraph1 + with + exn -> + enrich localization_tbl bo exn + ~f:(function _ -> + lazy ("The term " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst bo + context' ^ " has type " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst ty_of_bo + context' ^ " but is here used with type " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst expected_ty + context)) + in + fl @ [bo'] , subst',metasenv',ugraph' + ) ([],subst,metasenv,ugraph1) (List.combine fl fl_ty') + in + let ty = List.nth fl_ty' i in + (* now we have the new ty in fl_ty', the new bo in fl_bo', + * and we want the new fl with bo' and ty' injected in the right + * place. + *) + let rec map3 f l1 l2 l3 = + match l1,l2,l3 with + | [],[],[] -> [] + | h1::tl1,h2::tl2,h3::tl3 -> (f h1 h2 h3) :: (map3 f tl1 tl2 tl3) + | _ -> assert false + in + let fl'' = map3 (fun ty' bo' (name,x,ty,bo) -> (name,x,ty',bo') ) + fl_ty' fl_bo' fl + in + C.Fix (i,fl''),ty,subst,metasenv,ugraph2 + | C.CoFix (i,fl) -> + let fl_ty',subst,metasenv,types,ugraph1,len = + List.fold_left + (fun (fl,subst,metasenv,types,ugraph,len) (n,ty,_) -> + let ty',_,subst',metasenv',ugraph1 = + type_of_aux subst metasenv context ty ugraph + in + fl @ [ty'],subst',metasenv', + Some (C.Name n,(C.Decl (CicSubstitution.lift len ty'))) :: + types, ugraph1, len+1 + ) ([],subst,metasenv,[],ugraph,0) fl + in + let context' = types@context in + let fl_bo',subst,metasenv,ugraph2 = + List.fold_left + (fun (fl,subst,metasenv,ugraph) ((name,_,bo),ty) -> + let bo',ty_of_bo,subst,metasenv,ugraph1 = + type_of_aux subst metasenv context' bo ugraph in + let expected_ty = CicSubstitution.lift len ty in + let subst',metasenv',ugraph' = + try + fo_unif_subst subst context' metasenv + ty_of_bo expected_ty ugraph1 + with + exn -> + enrich localization_tbl bo exn + ~f:(function _ -> + lazy ("The term " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst bo + context' ^ " has type " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst ty_of_bo + context' ^ " but is here used with type " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst expected_ty + context)) + in + fl @ [bo'],subst',metasenv',ugraph' + ) ([],subst,metasenv,ugraph1) (List.combine fl fl_ty') + in + let ty = List.nth fl_ty' i in + (* now we have the new ty in fl_ty', the new bo in fl_bo', + * and we want the new fl with bo' and ty' injected in the right + * place. + *) + let rec map3 f l1 l2 l3 = + match l1,l2,l3 with + | [],[],[] -> [] + | h1::tl1,h2::tl2,h3::tl3 -> (f h1 h2 h3) :: (map3 f tl1 tl2 tl3) + | _ -> assert false + in + let fl'' = map3 (fun ty' bo' (name,ty,bo) -> (name,ty',bo') ) + fl_ty' fl_bo' fl + in + C.CoFix (i,fl''),ty,subst,metasenv,ugraph2 + in + relocalize localization_tbl t t'; + res + + (* check_metasenv_consistency checks that the "canonical" context of a + metavariable is consitent - up to relocation via the relocation list l - + with the actual context *) + and check_metasenv_consistency + metano subst metasenv context canonical_context l ugraph + = + let module C = Cic in + let module R = CicReduction in + let module S = CicSubstitution in + let lifted_canonical_context = + let rec aux i = + function + [] -> [] + | (Some (n,C.Decl t))::tl -> + (Some (n,C.Decl (S.subst_meta l (S.lift i t))))::(aux (i+1) tl) + | (Some (n,C.Def (t,None)))::tl -> + (Some (n,C.Def ((S.subst_meta l (S.lift i t)),None)))::(aux (i+1) tl) + | None::tl -> None::(aux (i+1) tl) + | (Some (n,C.Def (t,Some ty)))::tl -> + (Some (n, + C.Def ((S.subst_meta l (S.lift i t)), + Some (S.subst_meta l (S.lift i ty))))) :: (aux (i+1) tl) + in + aux 1 canonical_context + in + try + List.fold_left2 + (fun (l,subst,metasenv,ugraph) t ct -> + match (t,ct) with + _,None -> + l @ [None],subst,metasenv,ugraph + | Some t,Some (_,C.Def (ct,_)) -> + let subst',metasenv',ugraph' = + (try +(*prerr_endline ("poco geniale: nel caso di IRL basterebbe sapere che questo e' + * il Rel corrispondente. Si puo' ottimizzare il caso t = rel.");*) + fo_unif_subst subst context metasenv t ct ugraph + with e -> raise (RefineFailure (lazy (sprintf "The local context is not consistent with the canonical context, since %s cannot be unified with %s. Reason: %s" (CicMetaSubst.ppterm ~metasenv subst t) (CicMetaSubst.ppterm ~metasenv subst ct) (match e with AssertFailure msg -> Lazy.force msg | _ -> (Printexc.to_string e)))))) + in + l @ [Some t],subst',metasenv',ugraph' + | Some t,Some (_,C.Decl ct) -> + let t',inferredty,subst',metasenv',ugraph1 = + type_of_aux subst metasenv context t ugraph + in + let subst'',metasenv'',ugraph2 = + (try + fo_unif_subst + subst' context metasenv' inferredty ct ugraph1 + with e -> raise (RefineFailure (lazy (sprintf "The local context is not consistent with the canonical context, since the type %s of %s cannot be unified with the expected type %s. Reason: %s" (CicMetaSubst.ppterm metasenv' subst' inferredty) (CicMetaSubst.ppterm metasenv' subst' t) (CicMetaSubst.ppterm metasenv' subst' ct) (match e with AssertFailure msg -> Lazy.force msg | RefineFailure msg -> Lazy.force msg | _ -> (Printexc.to_string e)))))) + in + l @ [Some t'], subst'',metasenv'',ugraph2 + | None, Some _ -> + raise (RefineFailure (lazy (sprintf "Not well typed metavariable instance %s: the local context does not instantiate an hypothesis even if the hypothesis is not restricted in the canonical context %s" (CicMetaSubst.ppterm ~metasenv subst (Cic.Meta (metano, l))) (CicMetaSubst.ppcontext ~metasenv subst canonical_context))))) ([],subst,metasenv,ugraph) l lifted_canonical_context + with + Invalid_argument _ -> + raise + (RefineFailure + (lazy (sprintf + "Not well typed metavariable instance %s: the length of the local context does not match the length of the canonical context %s" + (CicMetaSubst.ppterm ~metasenv subst (Cic.Meta (metano, l))) + (CicMetaSubst.ppcontext ~metasenv subst canonical_context)))) + + and check_exp_named_subst metasubst metasenv context tl ugraph = + let rec check_exp_named_subst_aux metasubst metasenv substs tl ugraph = + match tl with + [] -> [],metasubst,metasenv,ugraph + | (uri,t)::tl -> + let ty_uri,ugraph1 = type_of_variable uri ugraph in + let typeofvar = + CicSubstitution.subst_vars substs ty_uri in + (* CSC: why was this code here? it is wrong + (match CicEnvironment.get_cooked_obj ~trust:false uri with + Cic.Variable (_,Some bo,_,_) -> + raise + (RefineFailure (lazy + "A variable with a body can not be explicit substituted")) + | Cic.Variable (_,None,_,_) -> () + | _ -> + raise + (RefineFailure (lazy + ("Unkown variable definition " ^ UriManager.string_of_uri uri))) + ) ; + *) + let t',typeoft,metasubst',metasenv',ugraph2 = + type_of_aux metasubst metasenv context t ugraph1 in + let subst = uri,t' in + let metasubst'',metasenv'',ugraph3 = + try + fo_unif_subst + metasubst' context metasenv' typeoft typeofvar ugraph2 + with _ -> + raise (RefineFailure (lazy + ("Wrong Explicit Named Substitution: " ^ + CicMetaSubst.ppterm metasenv' metasubst' typeoft ^ + " not unifiable with " ^ + CicMetaSubst.ppterm metasenv' metasubst' typeofvar))) + in + (* FIXME: no mere tail recursive! *) + let exp_name_subst, metasubst''', metasenv''', ugraph4 = + check_exp_named_subst_aux + metasubst'' metasenv'' (substs@[subst]) tl ugraph3 + in + ((uri,t')::exp_name_subst), metasubst''', metasenv''', ugraph4 + in + check_exp_named_subst_aux metasubst metasenv [] tl ugraph + + + and sort_of_prod localization_tbl subst metasenv context (name,s) t (t1, t2) + ugraph + = + let module C = Cic in + let context_for_t2 = (Some (name,C.Decl s))::context in + let t1'' = CicReduction.whd ~subst context t1 in + let t2'' = CicReduction.whd ~subst context_for_t2 t2 in + match (t1'', t2'') with + (C.Sort s1, C.Sort s2) + when (s2 = C.Prop or s2 = C.Set or s2 = C.CProp) -> + (* different than Coq manual!!! *) + C.Sort s2,subst,metasenv,ugraph + | (C.Sort (C.Type t1), C.Sort (C.Type t2)) -> + let t' = CicUniv.fresh() in + (try + let ugraph1 = CicUniv.add_ge t' t1 ugraph in + let ugraph2 = CicUniv.add_ge t' t2 ugraph1 in + C.Sort (C.Type t'),subst,metasenv,ugraph2 + with + CicUniv.UniverseInconsistency msg -> raise (RefineFailure msg)) + | (C.Sort _,C.Sort (C.Type t1)) -> + C.Sort (C.Type t1),subst,metasenv,ugraph + | (C.Meta _, C.Sort _) -> t2'',subst,metasenv,ugraph + | (C.Sort _,C.Meta _) | (C.Meta _,C.Meta _) -> + (* TODO how can we force the meta to become a sort? If we don't we + * break the invariant that refine produce only well typed terms *) + (* TODO if we check the non meta term and if it is a sort then we + * are likely to know the exact value of the result e.g. if the rhs + * is a Sort (Prop | Set | CProp) then the result is the rhs *) + let (metasenv,idx) = + CicMkImplicit.mk_implicit_sort metasenv subst in + let (subst, metasenv,ugraph1) = + try + fo_unif_subst subst context_for_t2 metasenv + (C.Meta (idx,[])) t2'' ugraph + with _ -> assert false (* unification against a metavariable *) + in + t2'',subst,metasenv,ugraph1 + | (C.Sort _,_) + | (C.Meta _,_) -> + enrich localization_tbl s + (RefineFailure + (lazy + (sprintf + "%s is supposed to be a type, but its type is %s" + (CicMetaSubst.ppterm_in_context ~metasenv subst t context) + (CicMetaSubst.ppterm_in_context ~metasenv subst t2 context)))) + | _,_ -> + enrich localization_tbl t + (RefineFailure + (lazy + (sprintf + "%s is supposed to be a type, but its type is %s" + (CicMetaSubst.ppterm_in_context ~metasenv subst s context) + (CicMetaSubst.ppterm_in_context ~metasenv subst t1 context)))) + + and avoid_double_coercion context subst metasenv ugraph t ty = + if not !pack_coercions then + t,ty,subst,metasenv,ugraph + else + let b, c1, c2, head, c1_c2_implicit = is_a_double_coercion t in + if b then + let source_carr = CoercGraph.source_of c2 in + let tgt_carr = CicMetaSubst.apply_subst subst ty in + (match CoercGraph.look_for_coercion metasenv subst context source_carr tgt_carr + with + | CoercGraph.SomeCoercion candidates -> + let selected = + HExtlib.list_findopt + (function (metasenv,last,c) -> + match c with + | c when not (CoercGraph.is_composite c) -> + debug_print (lazy ("\nNot a composite.."^CicPp.ppterm c)); + None + | c -> + let subst,metasenv,ugraph = + fo_unif_subst subst context metasenv last head ugraph in + debug_print (lazy ("\nprovo" ^ CicPp.ppterm c)); + (try + debug_print + (lazy + ("packing: " ^ + CicPp.ppterm t ^ " ==> " ^ CicPp.ppterm c)); + let newt,_,subst,metasenv,ugraph = + type_of_aux subst metasenv context c ugraph in + debug_print (lazy "tipa..."); + let subst, metasenv, ugraph = + (* COME MAI C'ERA UN IF su !pack_coercions ??? *) + fo_unif_subst subst context metasenv newt t ugraph + in + debug_print (lazy "unifica..."); + Some (newt, ty, subst, metasenv, ugraph) + with + | RefineFailure s | Uncertain s when not !pack_coercions-> + debug_print s; debug_print (lazy "stop\n");None + | RefineFailure s | Uncertain s -> + debug_print s;debug_print (lazy "goon\n"); + try + let old_pack_coercions = !pack_coercions in + pack_coercions := false; (* to avoid diverging *) + let refined_c1_c2_implicit,ty,subst,metasenv,ugraph = + type_of_aux subst metasenv context c1_c2_implicit ugraph + in + pack_coercions := old_pack_coercions; + let b, _, _, _, _ = + is_a_double_coercion refined_c1_c2_implicit + in + if b then + None + else + let head' = + match refined_c1_c2_implicit with + | Cic.Appl l -> HExtlib.list_last l + | _ -> assert false + in + let subst, metasenv, ugraph = + try fo_unif_subst subst context metasenv + head head' ugraph + with RefineFailure s| Uncertain s-> + debug_print s;assert false + in + let subst, metasenv, ugraph = + fo_unif_subst subst context metasenv + refined_c1_c2_implicit t ugraph + in + Some (refined_c1_c2_implicit,ty,subst,metasenv,ugraph) + with + | RefineFailure s | Uncertain s -> + pack_coercions := true;debug_print s;None + | exn -> pack_coercions := true; raise exn)) + candidates + in + (match selected with + | Some x -> x + | None -> + debug_print + (lazy ("#### Coercion not packed: " ^ CicPp.ppterm t)); + t, ty, subst, metasenv, ugraph) + | _ -> t, ty, subst, metasenv, ugraph) + else + t, ty, subst, metasenv, ugraph + + and typeof_list subst metasenv context ugraph l = + let tlbody_and_type,subst,metasenv,ugraph = + List.fold_right + (fun x (res,subst,metasenv,ugraph) -> + let x',ty,subst',metasenv',ugraph1 = + type_of_aux subst metasenv context x ugraph + in + (x', ty)::res,subst',metasenv',ugraph1 + ) l ([],subst,metasenv,ugraph) + in + tlbody_and_type,subst,metasenv,ugraph + + and eat_prods + allow_coercions subst metasenv context he hetype args_bo_and_ty ugraph + = + (* given he:hety, gives beack all (c he) such that (c e):?->? *) + let fix_arity n metasenv context subst he hetype ugraph = + let hetype = CicMetaSubst.apply_subst subst hetype in + let src = CoercDb.coerc_carr_of_term hetype in + let tgt = CoercDb.Fun 0 in + match CoercGraph.look_for_coercion' metasenv subst context src tgt with + | CoercGraph.NoCoercion -> [] + | CoercGraph.NotMetaClosed + | CoercGraph.NotHandled _ -> + raise (MoreArgsThanExpected (n,Uncertain (lazy ""))) + | CoercGraph.SomeCoercionToTgt candidates + | CoercGraph.SomeCoercion candidates -> + HExtlib.filter_map + (fun (metasenv,last,coerc) -> + let pp t = + CicMetaSubst.ppterm_in_context ~metasenv subst t context in + try + let subst,metasenv,ugraph = + fo_unif_subst subst context metasenv last he ugraph in + debug_print (lazy ("New head: "^ pp coerc)); + let tty,ugraph = + CicTypeChecker.type_of_aux' ~subst metasenv context coerc + ugraph + in + debug_print (lazy (" has type: "^ pp tty)); + Some (coerc,tty,subst,metasenv,ugraph) + with + | Uncertain _ | RefineFailure _ + | HExtlib.Localized (_,Uncertain _) + | HExtlib.Localized (_,RefineFailure _) -> None + | exn -> assert false) + candidates + in + (* aux function to process the type of the head and the args in parallel *) + let rec eat_prods_and_args metasenv subst context he hetype ugraph newargs = + function + | [] -> newargs,subst,metasenv,he,hetype,ugraph + | (hete, hety)::tl as args -> + match (CicReduction.whd ~subst context hetype) with + | Cic.Prod (n,s,t) -> + let arg,subst,metasenv,ugraph = + coerce_to_something allow_coercions localization_tbl + hete hety s subst metasenv context ugraph in + eat_prods_and_args + metasenv subst context he (CicSubstitution.subst (fst arg) t) + ugraph (newargs@[arg]) tl + | _ -> + let he = + match he, newargs with + | _, [] -> he + | Cic.Appl l, _ -> Cic.Appl (l@List.map fst newargs) + | _ -> Cic.Appl (he::List.map fst newargs) + in + (*{{{*) debug_print (lazy + let pp x = + CicMetaSubst.ppterm_in_context ~metasenv subst x context in + "Fixing arity of: "^ pp he ^ "\n that has type: "^ pp hetype^ + "\n but is applyed to: " ^ String.concat ";" + (List.map (fun (t,_)->pp t) args_bo_and_ty)); (*}}}*) + let possible_fixes = + fix_arity (List.length args) metasenv context subst he hetype + ugraph in + match + HExtlib.list_findopt + (fun (he,hetype,subst,metasenv,ugraph) -> + (* {{{ *)debug_print (lazy ("Try fix: "^ + CicMetaSubst.ppterm_in_context ~metasenv subst he context)); + debug_print (lazy (" of type: "^ + CicMetaSubst.ppterm_in_context + ~metasenv subst hetype context)); (* }}} *) + try + Some (eat_prods_and_args + metasenv subst context he hetype ugraph [] args) + with + | RefineFailure _ | Uncertain _ + | HExtlib.Localized (_,RefineFailure _) + | HExtlib.Localized (_,Uncertain _) -> None) + possible_fixes + with + | Some x -> x + | None -> + raise + (MoreArgsThanExpected + (List.length args, RefineFailure (lazy ""))) + in + (* first we check if we are in the simple case of a meta closed term *) + let subst,metasenv,ugraph1,hetype',he,args_bo_and_ty = + if CicUtil.is_meta_closed (CicMetaSubst.apply_subst subst hetype) then + (* this optimization is to postpone fix_arity (the most common case)*) + subst,metasenv,ugraph,hetype,he,args_bo_and_ty + else + (* this (says CSC) is also useful to infer dependent types *) + let pristinemenv = metasenv in + let metasenv,hetype' = + mk_prod_of_metas metasenv context subst args_bo_and_ty + in + try + let subst,metasenv,ugraph = + fo_unif_subst_eat_prods subst context metasenv hetype hetype' ugraph + in + subst,metasenv,ugraph,hetype',he,args_bo_and_ty + with RefineFailure _ | Uncertain _ -> + subst,pristinemenv,ugraph,hetype,he,args_bo_and_ty + in + let coerced_args,subst,metasenv,he,t,ugraph = + try + eat_prods_and_args + metasenv subst context he hetype' ugraph1 [] args_bo_and_ty + with + MoreArgsThanExpected (residuals,exn) -> + more_args_than_expected localization_tbl metasenv + subst he context hetype' residuals args_bo_and_ty exn + in + he,(List.map fst coerced_args),t,subst,metasenv,ugraph + + and coerce_to_something + allow_coercions localization_tbl t infty expty subst metasenv context ugraph + = + let module CS = CicSubstitution in + let module CR = CicReduction in + let cs_subst = CS.subst ~avoid_beta_redexes:true in + let coerce_atom_to_something t infty expty subst metasenv context ugraph = + debug_print (lazy ("COERCE_ATOM_TO_SOMETHING")); + let coer = + CoercGraph.look_for_coercion metasenv subst context infty expty + in + match coer with + | CoercGraph.NotMetaClosed -> raise (Uncertain (lazy + "coerce_atom_to_something fails since not meta closed")) + | CoercGraph.NoCoercion + | CoercGraph.SomeCoercionToTgt _ + | CoercGraph.NotHandled _ -> raise (RefineFailure (lazy + "coerce_atom_to_something fails since no coercions found")) + | CoercGraph.SomeCoercion candidates -> + debug_print (lazy (string_of_int (List.length candidates) ^ + " candidates found")); + let uncertain = ref false in + let selected = + let posibilities = + HExtlib.filter_map + (fun (metasenv,last,c) -> + try + (* {{{ *) debug_print (lazy ("FO_UNIF_SUBST: " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst last context ^ + " <==> " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst t context ^ + "####" ^ CicMetaSubst.ppterm_in_context ~metasenv subst c + context)); + debug_print (lazy ("FO_UNIF_SUBST: " ^ + CicPp.ppterm last ^ " <==> " ^ CicPp.ppterm t)); (* }}} *) + let subst,metasenv,ugraph = + fo_unif_subst subst context metasenv last t ugraph + in + let newt,newhety,subst,metasenv,ugraph = + type_of_aux subst metasenv context c ugraph in + let newt, newty, subst, metasenv, ugraph = + avoid_double_coercion context subst metasenv ugraph newt expty + in + let subst,metasenv,ugraph = + fo_unif_subst subst context metasenv newhety expty ugraph in + Some ((newt,newty), subst, metasenv, ugraph) + with + | Uncertain _ -> uncertain := true; None + | RefineFailure _ -> None) + candidates + in + match + List.fast_sort + (fun (_,_,m1,_) (_,_,m2,_) -> List.length m1 - List.length m2) + posibilities + with + | [] -> None + | x::_ -> Some x + in + match selected with + | Some x -> x + | None when !uncertain -> raise (Uncertain (lazy "coerce_atom fails")) + | None -> raise (RefineFailure (lazy "coerce_atom fails")) + in + let rec coerce_to_something_aux + t infty expty subst metasenv context ugraph + = + try + let subst, metasenv, ugraph = + fo_unif_subst subst context metasenv infty expty ugraph + in + (t, expty), subst, metasenv, ugraph + with (Uncertain _ | RefineFailure _ as exn) + when allow_coercions && !insert_coercions -> + let whd = CicReduction.whd ~delta:false in + let clean t s c = whd c (CicMetaSubst.apply_subst s t) in + let infty = clean infty subst context in + let expty = clean expty subst context in + let t = clean t subst context in + (*{{{*) debug_print (lazy ("COERCE_TO_SOMETHING: " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst t context ^ " : " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst infty context ^" ==> "^ + CicMetaSubst.ppterm_in_context ~metasenv subst expty context));(*}}}*) + let (coerced,_),subst,metasenv,_ as result = + match infty, expty, t with + | Cic.Prod (nameprod,src,ty), Cic.Prod (_,src2,ty2),Cic.Fix (n,fl) -> + (*{{{*) debug_print (lazy "FIX"); + (match fl with + [name,i,_(* infty *),bo] -> + let context_bo = + Some (Cic.Name name,Cic.Decl expty)::context in + let (rel1, _), subst, metasenv, ugraph = + coerce_to_something_aux (Cic.Rel 1) + (CS.lift 1 expty) (CS.lift 1 infty) subst + metasenv context_bo ugraph in + let bo = cs_subst rel1 (CS.lift_from 2 1 bo) in + let (bo,_), subst, metasenv, ugraph = + coerce_to_something_aux bo (CS.lift 1 infty) (CS.lift 1 + expty) subst + metasenv context_bo ugraph + in + (Cic.Fix (n,[name,i,expty,bo]),expty),subst,metasenv,ugraph + | _ -> assert false (* not implemented yet *)) (*}}}*) + | _,_, Cic.MutCase (uri,tyno,outty,m,pl) -> + (*{{{*) debug_print (lazy "CASE"); + (* {{{ helper functions *) + let get_cl_and_left_p uri tyno outty ugraph = + match CicEnvironment.get_obj ugraph uri with + | Cic.InductiveDefinition (tl, _, leftno, _),ugraph -> + let count_pis t = + let rec aux ctx t = + match CicReduction.whd ~delta:false ctx t with + | Cic.Prod (name,src,tgt) -> + let ctx = Some (name, Cic.Decl src) :: ctx in + 1 + aux ctx tgt + | _ -> 0 + in + aux [] t + in + let rec skip_lambda_delifting t n = + match t,n with + | _,0 -> t + | Cic.Lambda (_,_,t),n -> + skip_lambda_delifting + (CS.subst (Cic.Implicit None) t) (n - 1) + | _ -> assert false + in + let get_l_r_p n = function + | Cic.Lambda (_,Cic.MutInd _,_) -> [],[] + | Cic.Lambda (_,Cic.Appl (Cic.MutInd _ :: args),_) -> + HExtlib.split_nth n args + | _ -> assert false + in + let _, _, ty, cl = List.nth tl tyno in + let pis = count_pis ty in + let rno = pis - leftno in + let t = skip_lambda_delifting outty rno in + let left_p, _ = get_l_r_p leftno t in + let instantiale_with_left cl = + List.map + (fun ty -> + List.fold_left + (fun t p -> match t with + | Cic.Prod (_,_,t) -> + cs_subst p t + | _-> assert false) + ty left_p) + cl + in + let cl = instantiale_with_left (List.map snd cl) in + cl, left_p, leftno, rno, ugraph + | _ -> raise exn + in + let rec keep_lambdas_and_put_expty ctx t bo right_p matched n = + match t,n with + | _,0 -> + let rec mkr n = function + | [] -> [] | _::tl -> Cic.Rel n :: mkr (n+1) tl + in + let bo = + CicReplace.replace_lifting + ~equality:(fun _ -> CicUtil.alpha_equivalence) + ~context:ctx + ~what:(matched::right_p) + ~with_what:(Cic.Rel 1::List.rev (mkr 2 right_p)) + ~where:bo + in + bo + | Cic.Lambda (name, src, tgt),_ -> + Cic.Lambda (name, src, + keep_lambdas_and_put_expty + (Some (name, Cic.Decl src)::ctx) tgt (CS.lift 1 bo) + (List.map (CS.lift 1) right_p) (CS.lift 1 matched) (n-1)) + | _ -> assert false + in + let eq_uri, eq, eq_refl = + match LibraryObjects.eq_URI () with + | None -> HLog.warn "no default equality"; raise exn + | Some u -> u, Cic.MutInd(u,0,[]), Cic.MutConstruct (u,0,1,[]) + in + let add_params + metasenv subst context uri tyno cty outty mty m leftno i + = + let rec aux context outty par k mty m = function + | Cic.Prod (name, src, tgt) -> + let t,k = + aux + (Some (name, Cic.Decl src) :: context) + (CS.lift 1 outty) (Cic.Rel k::par) (k+1) + (CS.lift 1 mty) (CS.lift 1 m) tgt + in + Cic.Prod (name, src, t), k + | Cic.MutInd _ -> + let k = + let k = Cic.MutConstruct (uri,tyno,i,[]) in + if par <> [] then Cic.Appl (k::par) else k + in + Cic.Prod (Cic.Name "p", + Cic.Appl [eq; mty; m; k], + (CS.lift 1 + (CR.head_beta_reduce ~delta:false + (Cic.Appl [outty;k])))),k + | Cic.Appl (Cic.MutInd _::pl) -> + let left_p,right_p = HExtlib.split_nth leftno pl in + let has_rights = right_p <> [] in + let k = + let k = Cic.MutConstruct (uri,tyno,i,[]) in + Cic.Appl (k::left_p@par) + in + let right_p = + try match + CicTypeChecker.type_of_aux' ~subst metasenv context k + CicUniv.oblivion_ugraph + with + | Cic.Appl (Cic.MutInd _::args),_ -> + snd (HExtlib.split_nth leftno args) + | _ -> assert false + with CicTypeChecker.TypeCheckerFailure _-> assert false + in + if has_rights then + CR.head_beta_reduce ~delta:false + (Cic.Appl (outty ::right_p @ [k])),k + else + Cic.Prod (Cic.Name "p", + Cic.Appl [eq; mty; m; k], + (CS.lift 1 + (CR.head_beta_reduce ~delta:false + (Cic.Appl (outty ::right_p @ [k]))))),k + | _ -> assert false + in + aux context outty [] 1 mty m cty + in + let add_lambda_for_refl_m pbo rno mty m k cty = + (* k lives in the right context *) + if rno <> 0 then pbo else + let rec aux mty m = function + | Cic.Lambda (name,src,bo), Cic.Prod (_,_,ty) -> + Cic.Lambda (name,src, + (aux (CS.lift 1 mty) (CS.lift 1 m) (bo,ty))) + | t,_ -> + Cic.Lambda (Cic.Name "p", + Cic.Appl [eq; mty; m; k],CS.lift 1 t) + in + aux mty m (pbo,cty) + in + let add_pi_for_refl_m new_outty mty m rno = + if rno <> 0 then new_outty else + let rec aux m mty = function + | Cic.Lambda (name, src, tgt) -> + Cic.Lambda (name, src, + aux (CS.lift 1 m) (CS.lift 1 mty) tgt) + | t -> + Cic.Prod + (Cic.Anonymous, Cic.Appl [eq;mty;m;Cic.Rel 1], + CS.lift 1 t) + in + aux m mty new_outty + in (* }}} end helper functions *) + (* constructors types with left params already instantiated *) + let outty = CicMetaSubst.apply_subst subst outty in + let cl, left_p, leftno,rno,ugraph = + get_cl_and_left_p uri tyno outty ugraph + in + let right_p, mty = + try + match + CicTypeChecker.type_of_aux' ~subst metasenv context m + CicUniv.oblivion_ugraph + with + | Cic.MutInd _ as mty,_ -> [], mty + | Cic.Appl (Cic.MutInd _::args) as mty,_ -> + snd (HExtlib.split_nth leftno args), mty + | _ -> assert false + with CicTypeChecker.TypeCheckerFailure _ -> assert false + in + let new_outty = + keep_lambdas_and_put_expty context outty expty right_p m (rno+1) + in + debug_print + (lazy ("CASE: new_outty: " ^ CicMetaSubst.ppterm_in_context + ~metasenv subst new_outty context)); + let _,pl,subst,metasenv,ugraph = + List.fold_right2 + (fun cty pbo (i, acc, s, menv, ugraph) -> + (* Pi k_par, (Pi H:m=(K_i left_par k_par)), + * (new_)outty right_par (K_i left_par k_par) *) + let infty_pbo, _ = + add_params menv s context uri tyno + cty outty mty m leftno i in + debug_print + (lazy ("CASE: infty_pbo: "^CicMetaSubst.ppterm_in_context + ~metasenv subst infty_pbo context)); + let expty_pbo, k = (* k is (K_i left_par k_par) *) + add_params menv s context uri tyno + cty new_outty mty m leftno i in + debug_print + (lazy ("CASE: expty_pbo: "^CicMetaSubst.ppterm_in_context + ~metasenv subst expty_pbo context)); + let pbo = add_lambda_for_refl_m pbo rno mty m k cty in + debug_print + (lazy ("CASE: pbo: " ^ CicMetaSubst.ppterm_in_context + ~metasenv subst pbo context)); + let (pbo, _), subst, metasenv, ugraph = + coerce_to_something_aux pbo infty_pbo expty_pbo + s menv context ugraph + in + debug_print + (lazy ("CASE: pbo: " ^ CicMetaSubst.ppterm_in_context + ~metasenv subst pbo context)); + (i-1, pbo::acc, subst, metasenv, ugraph)) + cl pl (List.length pl, [], subst, metasenv, ugraph) + in + let new_outty = add_pi_for_refl_m new_outty mty m rno in + debug_print + (lazy ("CASE: new_outty: " ^ CicMetaSubst.ppterm_in_context + ~metasenv subst new_outty context)); + let t = + if rno = 0 then + let refl_m=Cic.Appl[eq_refl;mty;m]in + Cic.Appl [Cic.MutCase(uri,tyno,new_outty,m,pl);refl_m] + else + Cic.MutCase(uri,tyno,new_outty,m,pl) + in + (t, expty), subst, metasenv, ugraph (*}}}*) + | Cic.Prod (nameprod, src, ty),Cic.Prod (_, src2, ty2), _ -> + (*{{{*) debug_print (lazy "LAM"); + let name_con = + FreshNamesGenerator.mk_fresh_name + ~subst metasenv context ~typ:src2 Cic.Anonymous + in + let context_src2 = (Some (name_con, Cic.Decl src2) :: context) in + (* contravariant part: the argument of f:src->ty *) + let (rel1, _), subst, metasenv, ugraph = + coerce_to_something_aux + (Cic.Rel 1) (CS.lift 1 src2) + (CS.lift 1 src) subst metasenv context_src2 ugraph + in + (* covariant part: the result of f(c x); x:src2; (c x):src *) + let name_t, bo = + match t with + | Cic.Lambda (n,_,bo) -> n, cs_subst rel1 (CS.lift_from 2 1 bo) + | _ -> name_con, Cic.Appl[CS.lift 1 t;rel1] + in + (* we fix the possible dependency problem in the source ty *) + let ty = cs_subst rel1 (CS.lift_from 2 1 ty) in + let (bo, _), subst, metasenv, ugraph = + coerce_to_something_aux + bo ty ty2 subst metasenv context_src2 ugraph + in + let coerced = Cic.Lambda (name_t,src2, bo) in + (coerced, expty), subst, metasenv, ugraph (*}}}*) + | _ -> + (*{{{*)debug_print (lazy ("ATOM: "^CicMetaSubst.ppterm_in_context + ~metasenv subst infty context ^ " ==> " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst expty context)); + coerce_atom_to_something + t infty expty subst metasenv context ugraph (*}}}*) + in + debug_print (lazy ("COERCE TO SOMETHING END: "^ + CicMetaSubst.ppterm_in_context ~metasenv subst coerced context)); + result + in + try + coerce_to_something_aux t infty expty subst metasenv context ugraph + with Uncertain _ | RefineFailure _ as exn -> + let f _ = + lazy ("The term " ^ + CicMetaSubst.ppterm_in_context metasenv subst t context ^ + " has type " ^ CicMetaSubst.ppterm_in_context metasenv subst + infty context ^ " but is here used with type " ^ + CicMetaSubst.ppterm_in_context metasenv subst expty context) + in + enrich localization_tbl ~f t exn + + and coerce_to_sort localization_tbl t infty subst context metasenv uragph = + match CicReduction.whd ~delta:false ~subst context infty with + | Cic.Meta _ | Cic.Sort _ -> + t,infty, subst, metasenv, ugraph + | src -> + debug_print (lazy ("COERCE TO SORT: "^CicMetaSubst.ppterm_in_context + ~metasenv subst src context)); + let tgt = Cic.Sort (Cic.Type (CicUniv.fresh())) in + try + let (t, ty_t), subst, metasenv, ugraph = + coerce_to_something true + localization_tbl t src tgt subst metasenv context ugraph + in + debug_print (lazy ("COERCE TO SORT END: "^ + CicMetaSubst.ppterm_in_context ~metasenv subst t context)); + t, ty_t, subst, metasenv, ugraph + with HExtlib.Localized (_, exn) -> + let f _ = + lazy ("(7)The term " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst t context + ^ " is not a type since it has type " ^ + CicMetaSubst.ppterm_in_context ~metasenv subst src context + ^ " that is not a sort") + in + enrich localization_tbl ~f t exn + in + + (* eat prods ends here! *) + + let t',ty,subst',metasenv',ugraph1 = + type_of_aux [] metasenv context t ugraph + in + let substituted_t = CicMetaSubst.apply_subst subst' t' in + let substituted_ty = CicMetaSubst.apply_subst subst' ty in + (* Andrea: ho rimesso qui l'applicazione della subst al + metasenv dopo che ho droppato l'invariante che il metsaenv + e' sempre istanziato *) + let substituted_metasenv = + CicMetaSubst.apply_subst_metasenv subst' metasenv' in + (* metasenv' *) + (* substituted_t,substituted_ty,substituted_metasenv *) + (* ANDREA: spostare tutta questa robaccia da un altra parte *) + let cleaned_t = + FreshNamesGenerator.clean_dummy_dependent_types substituted_t in + let cleaned_ty = + FreshNamesGenerator.clean_dummy_dependent_types substituted_ty in + let cleaned_metasenv = + List.map + (function (n,context,ty) -> + let ty' = FreshNamesGenerator.clean_dummy_dependent_types ty in + let context' = + List.map + (function + None -> None + | Some (n, Cic.Decl t) -> + Some (n, + Cic.Decl (FreshNamesGenerator.clean_dummy_dependent_types t)) + | Some (n, Cic.Def (bo,ty)) -> + let bo' = FreshNamesGenerator.clean_dummy_dependent_types bo in + let ty' = + match ty with + None -> None + | Some ty -> + Some (FreshNamesGenerator.clean_dummy_dependent_types ty) + in + Some (n, Cic.Def (bo',ty')) + ) context + in + (n,context',ty') + ) substituted_metasenv + in + (cleaned_t,cleaned_ty,cleaned_metasenv,ugraph1) +;; + +let undebrujin uri typesno tys t = + snd + (List.fold_right + (fun (name,_,_,_) (i,t) -> + (* here the explicit_named_substituion is assumed to be *) + (* of length 0 *) + let t' = Cic.MutInd (uri,i,[]) in + let t = CicSubstitution.subst t' t in + i - 1,t + ) tys (typesno - 1,t)) + +let map_first_n n start f g l = + let rec aux acc k l = + if k < n then + match l with + | [] -> raise (Invalid_argument "map_first_n") + | hd :: tl -> f hd k (aux acc (k+1) tl) + else + g acc l + in + aux start 0 l + +(*CSC: this is a very rough approximation; to be finished *) +let are_all_occurrences_positive metasenv ugraph uri tys leftno = + let subst,metasenv,ugraph,tys = + List.fold_right + (fun (name,ind,arity,cl) (subst,metasenv,ugraph,acc) -> + let subst,metasenv,ugraph,cl = + List.fold_right + (fun (name,ty) (subst,metasenv,ugraph,acc) -> + let rec aux ctx k subst = function + | Cic.Appl((Cic.MutInd (uri',_,_)as hd)::tl) when uri = uri'-> + let subst,metasenv,ugraph,tl = + map_first_n leftno + (subst,metasenv,ugraph,[]) + (fun t n (subst,metasenv,ugraph,acc) -> + let subst,metasenv,ugraph = + fo_unif_subst + subst ctx metasenv t (Cic.Rel (k-n)) ugraph + in + subst,metasenv,ugraph,(t::acc)) + (fun (s,m,g,acc) tl -> assert(acc=[]);(s,m,g,tl)) + tl + in + subst,metasenv,ugraph,(Cic.Appl (hd::tl)) + | Cic.MutInd(uri',_,_) as t when uri = uri'-> + subst,metasenv,ugraph,t + | Cic.Prod (name,s,t) -> + let ctx = (Some (name,Cic.Decl s))::ctx in + let subst,metasenv,ugraph,t = aux ctx (k+1) subst t in + subst,metasenv,ugraph,Cic.Prod (name,s,t) + | _ -> + raise + (RefineFailure + (lazy "not well formed constructor type")) + in + let subst,metasenv,ugraph,ty = aux [] 0 subst ty in + subst,metasenv,ugraph,(name,ty) :: acc) + cl (subst,metasenv,ugraph,[]) + in + subst,metasenv,ugraph,(name,ind,arity,cl)::acc) + tys ([],metasenv,ugraph,[]) + in + let substituted_tys = + List.map + (fun (name,ind,arity,cl) -> + let cl = + List.map (fun (name, ty) -> name,CicMetaSubst.apply_subst subst ty) cl + in + name,ind,CicMetaSubst.apply_subst subst arity,cl) + tys + in + metasenv,ugraph,substituted_tys + +let typecheck metasenv uri obj ~localization_tbl = + let ugraph = CicUniv.empty_ugraph in + match obj with + Cic.Constant (name,Some bo,ty,args,attrs) -> + (* CSC: ugly code. Here I need to retrieve in advance the loc of bo + since type_of_aux' destroys localization information (which are + preserved by type_of_aux *) + let loc exn' = + try + Cic.CicHash.find localization_tbl bo + with Not_found -> + HLog.debug ("!!! NOT LOCALIZED: " ^ CicPp.ppterm bo); + raise exn' in + let bo',boty,metasenv,ugraph = + type_of_aux' ~localization_tbl metasenv [] bo ugraph in + let ty',_,metasenv,ugraph = + type_of_aux' ~localization_tbl metasenv [] ty ugraph in + let subst,metasenv,ugraph = + try + fo_unif_subst [] [] metasenv boty ty' ugraph + with + RefineFailure _ + | Uncertain _ as exn -> + let msg = + lazy ("The term " ^ + CicMetaSubst.ppterm_in_context ~metasenv [] bo' [] ^ + " has type " ^ + CicMetaSubst.ppterm_in_context ~metasenv [] boty [] ^ + " but is here used with type " ^ + CicMetaSubst.ppterm_in_context ~metasenv [] ty' []) + in + let exn' = + match exn with + RefineFailure _ -> RefineFailure msg + | Uncertain _ -> Uncertain msg + | _ -> assert false + in + raise (HExtlib.Localized (loc exn',exn')) + in + let bo' = CicMetaSubst.apply_subst subst bo' in + let ty' = CicMetaSubst.apply_subst subst ty' in + let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in + Cic.Constant (name,Some bo',ty',args,attrs),metasenv,ugraph + | Cic.Constant (name,None,ty,args,attrs) -> + let ty',_,metasenv,ugraph = + type_of_aux' ~localization_tbl metasenv [] ty ugraph + in + Cic.Constant (name,None,ty',args,attrs),metasenv,ugraph + | Cic.CurrentProof (name,metasenv',bo,ty,args,attrs) -> + assert (metasenv' = metasenv); + (* Here we do not check the metasenv for correctness *) + let bo',boty,metasenv,ugraph = + type_of_aux' ~localization_tbl metasenv [] bo ugraph in + let ty',sort,metasenv,ugraph = + type_of_aux' ~localization_tbl metasenv [] ty ugraph in + begin + match sort with + Cic.Sort _ + (* instead of raising Uncertain, let's hope that the meta will become + a sort *) + | Cic.Meta _ -> () + | _ -> raise (RefineFailure (lazy "The term provided is not a type")) + end; + let subst,metasenv,ugraph = fo_unif_subst [] [] metasenv boty ty' ugraph in + let bo' = CicMetaSubst.apply_subst subst bo' in + let ty' = CicMetaSubst.apply_subst subst ty' in + let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in + Cic.CurrentProof (name,metasenv,bo',ty',args,attrs),metasenv,ugraph + | Cic.Variable _ -> assert false (* not implemented *) + | Cic.InductiveDefinition (tys,args,paramsno,attrs) -> + (*CSC: this code is greately simplified and many many checks are missing *) + (*CSC: e.g. the constructors are not required to build their own types, *) + (*CSC: the arities are not required to have as type a sort, etc. *) + let uri = match uri with Some uri -> uri | None -> assert false in + let typesno = List.length tys in + (* first phase: we fix only the types *) + let metasenv,ugraph,tys = + List.fold_right + (fun (name,b,ty,cl) (metasenv,ugraph,res) -> + let ty',_,metasenv,ugraph = + type_of_aux' ~localization_tbl metasenv [] ty ugraph + in + metasenv,ugraph,(name,b,ty',cl)::res + ) tys (metasenv,ugraph,[]) in + let con_context = + List.rev_map (fun (name,_,ty,_)-> Some (Cic.Name name,Cic.Decl ty)) tys in + (* second phase: we fix only the constructors *) + let saved_menv = metasenv in + let metasenv,ugraph,tys = + List.fold_right + (fun (name,b,ty,cl) (metasenv,ugraph,res) -> + let metasenv,ugraph,cl' = + List.fold_right + (fun (name,ty) (metasenv,ugraph,res) -> + let ty = + CicTypeChecker.debrujin_constructor + ~cb:(relocalize localization_tbl) uri typesno ty in + let ty',_,metasenv,ugraph = + type_of_aux' ~localization_tbl metasenv con_context ty ugraph in + let ty' = undebrujin uri typesno tys ty' in + metasenv@saved_menv,ugraph,(name,ty')::res + ) cl (metasenv,ugraph,[]) + in + metasenv,ugraph,(name,b,ty,cl')::res + ) tys (metasenv,ugraph,[]) in + (* third phase: we check the positivity condition *) + let metasenv,ugraph,tys = + are_all_occurrences_positive metasenv ugraph uri tys paramsno + in + Cic.InductiveDefinition (tys,args,paramsno,attrs),metasenv,ugraph +;; + +(* sara' piu' veloce che raffinare da zero? mah.... *) +let pack_coercion metasenv ctx t = + let module C = Cic in + let rec merge_coercions ctx = + let aux = (fun (u,t) -> u,merge_coercions ctx t) in + function + | C.Rel _ | C.Sort _ | C.Implicit _ as t -> t + | C.Meta (n,subst) -> + let subst' = + List.map + (function None -> None | Some t -> Some (merge_coercions ctx t)) subst + in + C.Meta (n,subst') + | C.Cast (te,ty) -> C.Cast (merge_coercions ctx te, merge_coercions ctx ty) + | C.Prod (name,so,dest) -> + let ctx' = (Some (name,C.Decl so))::ctx in + C.Prod (name, merge_coercions ctx so, merge_coercions ctx' dest) + | C.Lambda (name,so,dest) -> + let ctx' = (Some (name,C.Decl so))::ctx in + C.Lambda (name, merge_coercions ctx so, merge_coercions ctx' dest) + | C.LetIn (name,so,dest) -> + let _,ty,metasenv,ugraph = + pack_coercions := false; + type_of_aux' metasenv ctx so CicUniv.oblivion_ugraph in + pack_coercions := true; + let ctx' = Some (name,(C.Def (so,Some ty)))::ctx in + C.LetIn (name, merge_coercions ctx so, merge_coercions ctx' dest) + | C.Appl l -> + let l = List.map (merge_coercions ctx) l in + let t = C.Appl l in + let b,_,_,_,_ = is_a_double_coercion t in + if b then + let ugraph = CicUniv.oblivion_ugraph in + let old_insert_coercions = !insert_coercions in + insert_coercions := false; + let newt, _, menv, _ = + try + type_of_aux' metasenv ctx t ugraph + with RefineFailure _ | Uncertain _ -> + t, t, [], ugraph + in + insert_coercions := old_insert_coercions; + if metasenv <> [] || menv = [] then + newt + else + (prerr_endline "PUO' SUCCEDERE!!!!!";t) + else + t + | C.Var (uri,exp_named_subst) -> + let exp_named_subst = List.map aux exp_named_subst in + C.Var (uri, exp_named_subst) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst = List.map aux exp_named_subst in + C.Const (uri, exp_named_subst) + | C.MutInd (uri,tyno,exp_named_subst) -> + let exp_named_subst = List.map aux exp_named_subst in + C.MutInd (uri,tyno,exp_named_subst) + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let exp_named_subst = List.map aux exp_named_subst in + C.MutConstruct (uri,tyno,consno,exp_named_subst) + | C.MutCase (uri,tyno,out,te,pl) -> + let pl = List.map (merge_coercions ctx) pl in + C.MutCase (uri,tyno,merge_coercions ctx out, merge_coercions ctx te, pl) + | C.Fix (fno, fl) -> + let ctx' = + List.fold_left + (fun l (n,_,ty,_) -> (Some (C.Name n,C.Decl ty))::l) + ctx fl + in + let fl = + List.map + (fun (name,idx,ty,bo) -> + (name,idx,merge_coercions ctx ty,merge_coercions ctx' bo)) + fl + in + C.Fix (fno, fl) + | C.CoFix (fno, fl) -> + let ctx' = + List.fold_left + (fun l (n,ty,_) -> (Some (C.Name n,C.Decl ty))::l) + ctx fl + in + let fl = + List.map + (fun (name,ty,bo) -> + (name, merge_coercions ctx ty, merge_coercions ctx' bo)) + fl + in + C.CoFix (fno, fl) + in + merge_coercions ctx t +;; + +let pack_coercion_metasenv conjectures = conjectures (* + + TASSI: this code war written when coercions were a toy, + now packing coercions involves unification thus + the metasenv may change, and this pack coercion + does not handle that. + + let module C = Cic in + List.map + (fun (i, ctx, ty) -> + let ctx = + List.fold_right + (fun item ctx -> + let item' = + match item with + Some (name, C.Decl t) -> + Some (name, C.Decl (pack_coercion conjectures ctx t)) + | Some (name, C.Def (t,None)) -> + Some (name,C.Def (pack_coercion conjectures ctx t,None)) + | Some (name, C.Def (t,Some ty)) -> + Some (name, C.Def (pack_coercion conjectures ctx t, + Some (pack_coercion conjectures ctx ty))) + | None -> None + in + item'::ctx + ) ctx [] + in + ((i,ctx,pack_coercion conjectures ctx ty)) + ) conjectures + *) +;; + +let pack_coercion_obj obj = obj (* + + TASSI: this code war written when coercions were a toy, + now packing coercions involves unification thus + the metasenv may change, and this pack coercion + does not handle that. + + let module C = Cic in + match obj with + | C.Constant (id, body, ty, params, attrs) -> + let body = + match body with + | None -> None + | Some body -> Some (pack_coercion [] [] body) + in + let ty = pack_coercion [] [] ty in + C.Constant (id, body, ty, params, attrs) + | C.Variable (name, body, ty, params, attrs) -> + let body = + match body with + | None -> None + | Some body -> Some (pack_coercion [] [] body) + in + let ty = pack_coercion [] [] ty in + C.Variable (name, body, ty, params, attrs) + | C.CurrentProof (name, conjectures, body, ty, params, attrs) -> + let conjectures = pack_coercion_metasenv conjectures in + let body = pack_coercion conjectures [] body in + let ty = pack_coercion conjectures [] ty in + C.CurrentProof (name, conjectures, body, ty, params, attrs) + | C.InductiveDefinition (indtys, params, leftno, attrs) -> + let indtys = + List.map + (fun (name, ind, arity, cl) -> + let arity = pack_coercion [] [] arity in + let cl = + List.map (fun (name, ty) -> (name,pack_coercion [] [] ty)) cl + in + (name, ind, arity, cl)) + indtys + in + C.InductiveDefinition (indtys, params, leftno, attrs) *) +;; + + +(* DEBUGGING ONLY +let type_of_aux' metasenv context term = + try + let (t,ty,m) = + type_of_aux' metasenv context term in + debug_print (lazy + ("@@@ REFINE SUCCESSFUL: " ^ CicPp.ppterm t ^ " : " ^ CicPp.ppterm ty)); + debug_print (lazy + ("@@@ REFINE SUCCESSFUL (metasenv):\n" ^ CicMetaSubst.ppmetasenv ~sep:";" m [])); + (t,ty,m) + with + | RefineFailure msg as e -> + debug_print (lazy ("@@@ REFINE FAILED: " ^ msg)); + raise e + | Uncertain msg as e -> + debug_print (lazy ("@@@ REFINE UNCERTAIN: " ^ msg)); + raise e +;; *) + +let profiler2 = HExtlib.profile "CicRefine" + +let type_of_aux' ?localization_tbl metasenv context term ugraph = + profiler2.HExtlib.profile + (type_of_aux' ?localization_tbl metasenv context term) ugraph + +let typecheck ~localization_tbl metasenv uri obj = + profiler2.HExtlib.profile (typecheck ~localization_tbl metasenv uri) obj + +let _ = DoubleTypeInference.pack_coercion := pack_coercion;; +(* vim:set foldmethod=marker: *) diff --git a/components/cic_unification/cicRefine.mli b/components/cic_unification/cicRefine.mli new file mode 100644 index 000000000..924020cbb --- /dev/null +++ b/components/cic_unification/cicRefine.mli @@ -0,0 +1,51 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception RefineFailure of string Lazy.t;; +exception Uncertain of string Lazy.t;; +exception AssertFailure of string Lazy.t;; + +(* type_of_aux' metasenv context term graph *) +(* refines [term] and returns the refined form of [term], *) +(* its type, the new metasenv and universe graph. *) +val type_of_aux': + ?localization_tbl:Stdpp.location Cic.CicHash.t -> + Cic.metasenv -> Cic.context -> Cic.term -> CicUniv.universe_graph -> + Cic.term * Cic.term * Cic.metasenv * CicUniv.universe_graph + +(* typecheck metasenv uri obj graph *) +(* refines [obj] and returns the refined form of [obj], *) +(* the new metasenv and universe graph. *) +(* the [uri] is required only for inductive definitions *) +val typecheck : + localization_tbl:Stdpp.location Cic.CicHash.t -> + Cic.metasenv -> UriManager.uri option -> Cic.obj -> + Cic.obj * Cic.metasenv * CicUniv.universe_graph + +val insert_coercions: bool ref (* initially true *) + +val pack_coercion_obj: Cic.obj -> Cic.obj + +val pack_coercion_metasenv: Cic.metasenv -> Cic.metasenv diff --git a/components/cic_unification/cicReplace.ml b/components/cic_unification/cicReplace.ml new file mode 100644 index 000000000..7f53e1ee5 --- /dev/null +++ b/components/cic_unification/cicReplace.ml @@ -0,0 +1,129 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id: cicRefine.ml 7618 2007-09-05 10:07:39Z sacerdot $ *) + +exception WhatAndWithWhatDoNotHaveTheSameLength;; + +module C = Cic +module S = CicSubstitution + +let replace_lifting ~equality ~context ~what ~with_what ~where = + let find_image ctx what t = + let rec find_image_aux = + function + [],[] -> raise Not_found + | what::tl1,with_what::tl2 -> + if equality ctx what t then with_what else find_image_aux (tl1,tl2) + | _,_ -> raise WhatAndWithWhatDoNotHaveTheSameLength + in + find_image_aux (what,with_what) + in + let add_ctx ctx n s = (Some (n, Cic.Decl s))::ctx in + let add_ctx1 ctx n s = (Some (n, Cic.Def (s,None)))::ctx in + let rec substaux k ctx what t = + try + S.lift (k-1) (find_image ctx what t) + with Not_found -> + match t with + C.Rel n as t -> t + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k ctx what t) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (i, l) -> + let l' = + List.map + (function + None -> None + | Some t -> Some (substaux k ctx what t) + ) l + in + C.Meta(i,l') + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (substaux k ctx what te, substaux k ctx what ty) + | C.Prod (n,s,t) -> + C.Prod + (n, substaux k ctx what s, substaux (k + 1) (add_ctx ctx n s) (List.map (S.lift 1) what) t) + | C.Lambda (n,s,t) -> + C.Lambda + (n, substaux k ctx what s, substaux (k + 1) (add_ctx ctx n s) (List.map (S.lift 1) what) t) + | C.LetIn (n,s,t) -> + C.LetIn + (n, substaux k ctx what s, substaux (k + 1) (add_ctx1 ctx n s) (List.map (S.lift 1) what) t) + | C.Appl (he::tl) -> + (* Invariant: no Appl applied to another Appl *) + let tl' = List.map (substaux k ctx what) tl in + begin + match substaux k ctx what he with + C.Appl l -> C.Appl (l@tl') + | _ as he' -> C.Appl (he'::tl') + end + | C.Appl _ -> assert false + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k ctx what t) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,i,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k ctx what t) exp_named_subst + in + C.MutInd (uri,i,exp_named_subst') + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k ctx what t) exp_named_subst + in + C.MutConstruct (uri,i,j,exp_named_subst') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,substaux k ctx what outt, substaux k ctx what t, + List.map (substaux k ctx what) pl) + | C.Fix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> (* WRONG CTX *) + (name, i, substaux k ctx what ty, + substaux (k+len) ctx (List.map (S.lift len) what) bo) + ) fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,ty,bo) -> (* WRONG CTX *) + (name, substaux k ctx what ty, + substaux (k+len) ctx (List.map (S.lift len) what) bo) + ) fl + in + C.CoFix (i, substitutedfl) + in + substaux 1 context what where +;; + + diff --git a/components/cic_unification/cicReplace.mli b/components/cic_unification/cicReplace.mli new file mode 100644 index 000000000..c2f9aaff3 --- /dev/null +++ b/components/cic_unification/cicReplace.mli @@ -0,0 +1,34 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id: cicRefine.ml 7618 2007-09-05 10:07:39Z sacerdot $ *) + +exception WhatAndWithWhatDoNotHaveTheSameLength + + +val replace_lifting : + equality:(Cic.context -> Cic.term -> Cic.term -> bool) -> + context:Cic.context -> + what:Cic.term list -> with_what:Cic.term list -> where:Cic.term -> Cic.term diff --git a/components/cic_unification/cicUnification.ml b/components/cic_unification/cicUnification.ml new file mode 100644 index 000000000..fb6a66d4f --- /dev/null +++ b/components/cic_unification/cicUnification.ml @@ -0,0 +1,900 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +open Printf + +exception UnificationFailure of string Lazy.t;; +exception Uncertain of string Lazy.t;; +exception AssertFailure of string Lazy.t;; + +let verbose = false;; +let debug_print = fun _ -> () + +let profiler_toa = HExtlib.profile "fo_unif_subst.type_of_aux'" +let profiler_beta_expand = HExtlib.profile "fo_unif_subst.beta_expand" +let profiler_deref = HExtlib.profile "fo_unif_subst.deref'" +let profiler_are_convertible = HExtlib.profile "fo_unif_subst.are_convertible" + +let profile = HExtlib.profile "U/CicTypeChecker.type_of_aux'" + +let type_of_aux' metasenv subst context term ugraph = +let foo () = + try + profile.HExtlib.profile + (CicTypeChecker.type_of_aux' ~subst metasenv context term) ugraph + with + CicTypeChecker.TypeCheckerFailure msg -> + let msg = + lazy + (sprintf + "Kernel Type checking error: +%s\n%s\ncontext=\n%s\nmetasenv=\n%s\nsubstitution=\n%s\nException:\n%s.\nToo bad." + (CicMetaSubst.ppterm ~metasenv subst term) + (CicMetaSubst.ppterm ~metasenv [] term) + (CicMetaSubst.ppcontext ~metasenv subst context) + (CicMetaSubst.ppmetasenv subst metasenv) + (CicMetaSubst.ppsubst ~metasenv subst) (Lazy.force msg)) in + raise (AssertFailure msg) + | CicTypeChecker.AssertFailure msg -> + let msg = lazy + (sprintf + "Kernel Type checking assertion failure: +%s\n%s\ncontext=\n%s\nmetasenv=\n%s\nsubstitution=\n%s\nException:\n%s.\nToo bad." + (CicMetaSubst.ppterm ~metasenv subst term) + (CicMetaSubst.ppterm ~metasenv [] term) + (CicMetaSubst.ppcontext ~metasenv subst context) + (CicMetaSubst.ppmetasenv subst metasenv) + (CicMetaSubst.ppsubst ~metasenv subst) (Lazy.force msg)) in + raise (AssertFailure msg) +in profiler_toa.HExtlib.profile foo () +;; + +let exists_a_meta l = + List.exists + (function + | Cic.Meta _ + | Cic.Appl (Cic.Meta _::_) -> true + | _ -> false) l + +let rec deref subst t = + let snd (_,a,_) = a in + match t with + Cic.Meta(n,l) -> + (try + deref subst + (CicSubstitution.subst_meta + l (snd (CicUtil.lookup_subst n subst))) + with + CicUtil.Subst_not_found _ -> t) + | Cic.Appl(Cic.Meta(n,l)::args) -> + (match deref subst (Cic.Meta(n,l)) with + | Cic.Lambda _ as t -> + deref subst (CicReduction.head_beta_reduce (Cic.Appl(t::args))) + | r -> Cic.Appl(r::args)) + | Cic.Appl(((Cic.Lambda _) as t)::args) -> + deref subst (CicReduction.head_beta_reduce (Cic.Appl(t::args))) + | t -> t +;; + +let deref subst t = + let foo () = deref subst t + in profiler_deref.HExtlib.profile foo () + +exception WrongShape;; +let eta_reduce after_beta_expansion after_beta_expansion_body + before_beta_expansion + = + try + match before_beta_expansion,after_beta_expansion_body with + Cic.Appl l, Cic.Appl l' -> + let rec all_but_last check_last = + function + [] -> assert false + | [Cic.Rel 1] -> [] + | [_] -> if check_last then raise WrongShape else [] + | he::tl -> he::(all_but_last check_last tl) + in + let all_but_last check_last l = + match all_but_last check_last l with + [] -> assert false + | [he] -> he + | l -> Cic.Appl l + in + let t = CicSubstitution.subst (Cic.Rel (-1)) (all_but_last true l') in + let all_but_last = all_but_last false l in + (* here we should test alpha-equivalence; however we know by + construction that here alpha_equivalence is equivalent to = *) + if t = all_but_last then + all_but_last + else + after_beta_expansion + | _,_ -> after_beta_expansion + with + WrongShape -> after_beta_expansion + +let rec beta_expand num test_equality_only metasenv subst context t arg ugraph = + let module S = CicSubstitution in + let module C = Cic in +let foo () = + let rec aux metasenv subst n context t' ugraph = + try + + let subst,metasenv,ugraph1 = + fo_unif_subst test_equality_only subst context metasenv + (CicSubstitution.lift n arg) t' ugraph + + in + subst,metasenv,C.Rel (1 + n),ugraph1 + with + Uncertain _ + | UnificationFailure _ -> + match t' with + | C.Rel m -> subst,metasenv, + (if m <= n then C.Rel m else C.Rel (m+1)),ugraph + | C.Var (uri,exp_named_subst) -> + let subst,metasenv,exp_named_subst',ugraph1 = + aux_exp_named_subst metasenv subst n context exp_named_subst ugraph + in + subst,metasenv,C.Var (uri,exp_named_subst'),ugraph1 + | C.Meta (i,l) -> + (* andrea: in general, beta_expand can create badly typed + terms. This happens quite seldom in practice, UNLESS we + iterate on the local context. For this reason, we renounce + to iterate and just lift *) + let l = + List.map + (function + Some t -> Some (CicSubstitution.lift 1 t) + | None -> None) l in + subst, metasenv, C.Meta (i,l), ugraph + | C.Sort _ + | C.Implicit _ as t -> subst,metasenv,t,ugraph + | C.Cast (te,ty) -> + let subst,metasenv,te',ugraph1 = + aux metasenv subst n context te ugraph in + let subst,metasenv,ty',ugraph2 = + aux metasenv subst n context ty ugraph1 in + (* TASSI: sure this is in serial? *) + subst,metasenv,(C.Cast (te', ty')),ugraph2 + | C.Prod (nn,s,t) -> + let subst,metasenv,s',ugraph1 = + aux metasenv subst n context s ugraph in + let subst,metasenv,t',ugraph2 = + aux metasenv subst (n+1) ((Some (nn, C.Decl s))::context) t + ugraph1 + in + (* TASSI: sure this is in serial? *) + subst,metasenv,(C.Prod (nn, s', t')),ugraph2 + | C.Lambda (nn,s,t) -> + let subst,metasenv,s',ugraph1 = + aux metasenv subst n context s ugraph in + let subst,metasenv,t',ugraph2 = + aux metasenv subst (n+1) ((Some (nn, C.Decl s))::context) t ugraph1 + in + (* TASSI: sure this is in serial? *) + subst,metasenv,(C.Lambda (nn, s', t')),ugraph2 + | C.LetIn (nn,s,t) -> + let subst,metasenv,s',ugraph1 = + aux metasenv subst n context s ugraph in + let subst,metasenv,t',ugraph2 = + aux metasenv subst (n+1) ((Some (nn, C.Def (s,None)))::context) t + ugraph1 + in + (* TASSI: sure this is in serial? *) + subst,metasenv,(C.LetIn (nn, s', t')),ugraph2 + | C.Appl l -> + let subst,metasenv,revl',ugraph1 = + List.fold_left + (fun (subst,metasenv,appl,ugraph) t -> + let subst,metasenv,t',ugraph1 = + aux metasenv subst n context t ugraph in + subst,metasenv,(t'::appl),ugraph1 + ) (subst,metasenv,[],ugraph) l + in + subst,metasenv,(C.Appl (List.rev revl')),ugraph1 + | C.Const (uri,exp_named_subst) -> + let subst,metasenv,exp_named_subst',ugraph1 = + aux_exp_named_subst metasenv subst n context exp_named_subst ugraph + in + subst,metasenv,(C.Const (uri,exp_named_subst')),ugraph1 + | C.MutInd (uri,i,exp_named_subst) -> + let subst,metasenv,exp_named_subst',ugraph1 = + aux_exp_named_subst metasenv subst n context exp_named_subst ugraph + in + subst,metasenv,(C.MutInd (uri,i,exp_named_subst')),ugraph1 + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let subst,metasenv,exp_named_subst',ugraph1 = + aux_exp_named_subst metasenv subst n context exp_named_subst ugraph + in + subst,metasenv,(C.MutConstruct (uri,i,j,exp_named_subst')),ugraph1 + | C.MutCase (sp,i,outt,t,pl) -> + let subst,metasenv,outt',ugraph1 = + aux metasenv subst n context outt ugraph in + let subst,metasenv,t',ugraph2 = + aux metasenv subst n context t ugraph1 in + let subst,metasenv,revpl',ugraph3 = + List.fold_left + (fun (subst,metasenv,pl,ugraph) t -> + let subst,metasenv,t',ugraph1 = + aux metasenv subst n context t ugraph in + subst,metasenv,(t'::pl),ugraph1 + ) (subst,metasenv,[],ugraph2) pl + in + subst,metasenv,(C.MutCase (sp,i,outt', t', List.rev revpl')),ugraph3 + (* TASSI: not sure this is serial *) + | C.Fix (i,fl) -> +(*CSC: not implemented + let tylen = List.length fl in + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> (name, i, aux n ty, aux (n+tylen) bo)) + fl + in + C.Fix (i, substitutedfl) +*) + subst,metasenv,(CicSubstitution.lift 1 t' ),ugraph + | C.CoFix (i,fl) -> +(*CSC: not implemented + let tylen = List.length fl in + let substitutedfl = + List.map + (fun (name,ty,bo) -> (name, aux n ty, aux (n+tylen) bo)) + fl + in + C.CoFix (i, substitutedfl) + +*) + subst,metasenv,(CicSubstitution.lift 1 t'), ugraph + + and aux_exp_named_subst metasenv subst n context ens ugraph = + List.fold_right + (fun (uri,t) (subst,metasenv,l,ugraph) -> + let subst,metasenv,t',ugraph1 = aux metasenv subst n context t ugraph in + subst,metasenv,((uri,t')::l),ugraph1) ens (subst,metasenv,[],ugraph) + in + let argty,ugraph1 = type_of_aux' metasenv subst context arg ugraph in + let fresh_name = + FreshNamesGenerator.mk_fresh_name ~subst + metasenv context (Cic.Name ("Hbeta" ^ string_of_int num)) ~typ:argty + in + let subst,metasenv,t',ugraph2 = aux metasenv subst 0 context t ugraph1 in + let t'' = eta_reduce (C.Lambda (fresh_name,argty,t')) t' t in + subst, metasenv, t'', ugraph2 +in profiler_beta_expand.HExtlib.profile foo () + + +and beta_expand_many test_equality_only metasenv subst context t args ugraph = + let _,subst,metasenv,hd,ugraph = + List.fold_right + (fun arg (num,subst,metasenv,t,ugraph) -> + let subst,metasenv,t,ugraph1 = + beta_expand num test_equality_only + metasenv subst context t arg ugraph + in + num+1,subst,metasenv,t,ugraph1 + ) args (1,subst,metasenv,t,ugraph) + in + subst,metasenv,hd,ugraph + + +(* NUOVA UNIFICAZIONE *) +(* A substitution is a (int * Cic.term) list that associates a + metavariable i with its body. + A metaenv is a (int * Cic.term) list that associate a metavariable + i with is type. + fo_unif_new takes a metasenv, a context, two terms t1 and t2 and gives back + a new substitution which is _NOT_ unwinded. It must be unwinded before + applying it. *) + +and fo_unif_subst test_equality_only subst context metasenv t1 t2 ugraph = + let module C = Cic in + let module R = CicReduction in + let module S = CicSubstitution in + let t1 = deref subst t1 in + let t2 = deref subst t2 in + let b,ugraph = +let foo () = + R.are_convertible ~subst ~metasenv context t1 t2 ugraph +in profiler_are_convertible.HExtlib.profile foo () + in + if b then + subst, metasenv, ugraph + else + match (t1, t2) with + | (C.Meta (n,ln), C.Meta (m,lm)) when n=m -> + let _,subst,metasenv,ugraph1 = + (try + List.fold_left2 + (fun (j,subst,metasenv,ugraph) t1 t2 -> + match t1,t2 with + None,_ + | _,None -> j+1,subst,metasenv,ugraph + | Some t1', Some t2' -> + (* First possibility: restriction *) + (* Second possibility: unification *) + (* Third possibility: convertibility *) + let b, ugraph1 = + R.are_convertible + ~subst ~metasenv context t1' t2' ugraph + in + if b then + j+1,subst,metasenv, ugraph1 + else + (try + let subst,metasenv,ugraph2 = + fo_unif_subst + test_equality_only + subst context metasenv t1' t2' ugraph + in + j+1,subst,metasenv,ugraph2 + with + Uncertain _ + | UnificationFailure _ -> +debug_print (lazy ("restringo Meta n." ^ (string_of_int n) ^ "on variable n." ^ (string_of_int j))); + let metasenv, subst = + CicMetaSubst.restrict + subst [(n,j)] metasenv in + j+1,subst,metasenv,ugraph1) + ) (1,subst,metasenv,ugraph) ln lm + with + Exit -> + raise + (UnificationFailure (lazy "1")) + (* + (sprintf + "Error trying to unify %s with %s: the algorithm tried to check whether the two substitutions are convertible; if they are not, it tried to unify the two substitutions. No restriction was attempted." + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2))) *) + | Invalid_argument _ -> + raise + (UnificationFailure (lazy "2"))) + (* + (sprintf + "Error trying to unify %s with %s: the lengths of the two local contexts do not match." + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2)))) *) + in subst,metasenv,ugraph1 + | (C.Meta (n,_), C.Meta (m,_)) when n>m -> + fo_unif_subst test_equality_only subst context metasenv t2 t1 ugraph + | (C.Meta (n,l), t) + | (t, C.Meta (n,l)) -> + let swap = + match t1,t2 with + C.Meta (n,_), C.Meta (m,_) when n < m -> false + | _, C.Meta _ -> false + | _,_ -> true + in + let lower = fun x y -> if swap then y else x in + let upper = fun x y -> if swap then x else y in + let fo_unif_subst_ordered + test_equality_only subst context metasenv m1 m2 ugraph = + fo_unif_subst test_equality_only subst context metasenv + (lower m1 m2) (upper m1 m2) ugraph + in + begin + let subst,metasenv,ugraph1 = + let (_,_,meta_type) = CicUtil.lookup_meta n metasenv in + (try + let tyt,ugraph1 = + type_of_aux' metasenv subst context t ugraph + in + fo_unif_subst + test_equality_only + subst context metasenv tyt (S.subst_meta l meta_type) ugraph1 + with + UnificationFailure _ as e -> raise e + | Uncertain msg -> raise (UnificationFailure msg) + | AssertFailure _ -> + debug_print (lazy "siamo allo huge hack"); + (* TODO huge hack!!!! + * we keep on unifying/refining in the hope that + * the problem will be eventually solved. + * In the meantime we're breaking a big invariant: + * the terms that we are unifying are no longer well + * typed in the current context (in the worst case + * we could even diverge) *) + (subst, metasenv,ugraph)) in + let t',metasenv,subst = + try + CicMetaSubst.delift n subst context metasenv l t + with + (CicMetaSubst.MetaSubstFailure msg)-> + raise (UnificationFailure msg) + | (CicMetaSubst.Uncertain msg) -> raise (Uncertain msg) + in + let t'',ugraph2 = + match t' with + C.Sort (C.Type u) when not test_equality_only -> + let u' = CicUniv.fresh () in + let s = C.Sort (C.Type u') in + (try + let ugraph2 = + CicUniv.add_ge (upper u u') (lower u u') ugraph1 + in + s,ugraph2 + with + CicUniv.UniverseInconsistency msg -> + raise (UnificationFailure msg)) + | _ -> t',ugraph1 + in + (* Unifying the types may have already instantiated n. Let's check *) + try + let (_, oldt,_) = CicUtil.lookup_subst n subst in + let lifted_oldt = S.subst_meta l oldt in + fo_unif_subst_ordered + test_equality_only subst context metasenv t lifted_oldt ugraph2 + with + CicUtil.Subst_not_found _ -> + let (_, context, ty) = CicUtil.lookup_meta n metasenv in + let subst = (n, (context, t'',ty)) :: subst in + let metasenv = + List.filter (fun (m,_,_) -> not (n = m)) metasenv in + subst, metasenv, ugraph2 + end + | (C.Var (uri1,exp_named_subst1),C.Var (uri2,exp_named_subst2)) + | (C.Const (uri1,exp_named_subst1),C.Const (uri2,exp_named_subst2)) -> + if UriManager.eq uri1 uri2 then + fo_unif_subst_exp_named_subst test_equality_only subst context metasenv + exp_named_subst1 exp_named_subst2 ugraph + else + raise (UnificationFailure (lazy + (sprintf + "Can't unify %s with %s due to different constants" + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2)))) + | C.MutInd (uri1,i1,exp_named_subst1),C.MutInd (uri2,i2,exp_named_subst2) -> + if UriManager.eq uri1 uri2 && i1 = i2 then + fo_unif_subst_exp_named_subst + test_equality_only + subst context metasenv exp_named_subst1 exp_named_subst2 ugraph + else + raise (UnificationFailure + (lazy + (sprintf + "Can't unify %s with %s due to different inductive principles" + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2)))) + | C.MutConstruct (uri1,i1,j1,exp_named_subst1), + C.MutConstruct (uri2,i2,j2,exp_named_subst2) -> + if UriManager.eq uri1 uri2 && i1 = i2 && j1 = j2 then + fo_unif_subst_exp_named_subst + test_equality_only + subst context metasenv exp_named_subst1 exp_named_subst2 ugraph + else + raise (UnificationFailure + (lazy + (sprintf + "Can't unify %s with %s due to different inductive constructors" + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2)))) + | (C.Implicit _, _) | (_, C.Implicit _) -> assert false + | (C.Cast (te,ty), t2) -> fo_unif_subst test_equality_only + subst context metasenv te t2 ugraph + | (t1, C.Cast (te,ty)) -> fo_unif_subst test_equality_only + subst context metasenv t1 te ugraph + | (C.Prod (n1,s1,t1), C.Prod (_,s2,t2)) -> + let subst',metasenv',ugraph1 = + fo_unif_subst true subst context metasenv s1 s2 ugraph + in + fo_unif_subst test_equality_only + subst' ((Some (n1,(C.Decl s1)))::context) metasenv' t1 t2 ugraph1 + | (C.Lambda (n1,s1,t1), C.Lambda (_,s2,t2)) -> + let subst',metasenv',ugraph1 = + fo_unif_subst test_equality_only subst context metasenv s1 s2 ugraph + in + fo_unif_subst test_equality_only + subst' ((Some (n1,(C.Decl s1)))::context) metasenv' t1 t2 ugraph1 + | (C.LetIn (_,s1,t1), t2) + | (t2, C.LetIn (_,s1,t1)) -> + fo_unif_subst + test_equality_only subst context metasenv t2 (S.subst s1 t1) ugraph + | (C.Appl l1, C.Appl l2) -> + (* andrea: this case should be probably rewritten in the + spirit of deref *) + (match l1,l2 with + | C.Meta (i,_)::args1, C.Meta (j,_)::args2 when i = j -> + (try + List.fold_left2 + (fun (subst,metasenv,ugraph) t1 t2 -> + fo_unif_subst + test_equality_only subst context metasenv t1 t2 ugraph) + (subst,metasenv,ugraph) l1 l2 + with (Invalid_argument msg) -> + raise (UnificationFailure (lazy msg))) + | C.Meta (i,l)::args, _ when not(exists_a_meta args) -> + (* we verify that none of the args is a Meta, + since beta expanding with respoect to a metavariable + makes no sense *) + (* + (try + let (_,t,_) = CicUtil.lookup_subst i subst in + let lifted = S.subst_meta l t in + let reduced = CicReduction.head_beta_reduce (Cic.Appl (lifted::args)) in + fo_unif_subst + test_equality_only + subst context metasenv reduced t2 ugraph + with CicUtil.Subst_not_found _ -> *) + let subst,metasenv,beta_expanded,ugraph1 = + beta_expand_many + test_equality_only metasenv subst context t2 args ugraph + in + fo_unif_subst test_equality_only subst context metasenv + (C.Meta (i,l)) beta_expanded ugraph1 + | _, C.Meta (i,l)::args when not(exists_a_meta args) -> + (* (try + let (_,t,_) = CicUtil.lookup_subst i subst in + let lifted = S.subst_meta l t in + let reduced = CicReduction.head_beta_reduce (Cic.Appl (lifted::args)) in + fo_unif_subst + test_equality_only + subst context metasenv t1 reduced ugraph + with CicUtil.Subst_not_found _ -> *) + let subst,metasenv,beta_expanded,ugraph1 = + beta_expand_many + test_equality_only + metasenv subst context t1 args ugraph + in + fo_unif_subst test_equality_only subst context metasenv + (C.Meta (i,l)) beta_expanded ugraph1 + | _,_ -> + let lr1 = List.rev l1 in + let lr2 = List.rev l2 in + let rec + fo_unif_l test_equality_only subst metasenv (l1,l2) ugraph = + match (l1,l2) with + [],_ + | _,[] -> assert false + | ([h1],[h2]) -> + fo_unif_subst + test_equality_only subst context metasenv h1 h2 ugraph + | ([h],l) + | (l,[h]) -> + fo_unif_subst test_equality_only subst context metasenv + h (C.Appl (List.rev l)) ugraph + | ((h1::l1),(h2::l2)) -> + let subst', metasenv',ugraph1 = + fo_unif_subst + test_equality_only + subst context metasenv h1 h2 ugraph + in + fo_unif_l + test_equality_only subst' metasenv' (l1,l2) ugraph1 + in + (try + fo_unif_l + test_equality_only subst metasenv (lr1, lr2) ugraph + with + | UnificationFailure s + | Uncertain s as exn -> + (match l1, l2 with + | (((Cic.Const (uri1, ens1)) as c1) :: tl1), + (((Cic.Const (uri2, ens2)) as c2) :: tl2) when + CoercDb.is_a_coercion' c1 && + CoercDb.is_a_coercion' c2 && + not (UriManager.eq uri1 uri2) -> +(*DEBUGGING ONLY: +prerr_endline ("<<<< " ^ CicMetaSubst.ppterm_in_context ~metasenv subst (C.Appl l1) context ^ " <==> " ^ CicMetaSubst.ppterm_in_context ~metasenv subst (C.Appl l2) context); +let res = +*) + let rec look_for_first_coercion c tl = + match + CicMetaSubst.apply_subst subst (HExtlib.list_last tl) + with + Cic.Appl ((Cic.Const (uri1,ens1) as c')::tl') + when CoercDb.is_a_coercion' c' -> + look_for_first_coercion c' tl' + | last_tl -> c,last_tl + in + let c1,last_tl1 = look_for_first_coercion c1 tl1 in + let c2,last_tl2 = look_for_first_coercion c2 tl2 in + let car1 = + CoercDb.coerc_carr_of_term (CoercGraph.source_of c1) in + let car2 = + CoercDb.coerc_carr_of_term (CoercGraph.source_of c2) in + if CoercDb.eq_carr car1 car2 then + (match last_tl1,last_tl2 with + C.Meta (i1,_),C.Meta(i2,_) when i1=i2 -> raise exn + | C.Meta _, _ + | _, C.Meta _ -> + let subst,metasenv,ugraph = + fo_unif_subst test_equality_only subst context + metasenv last_tl1 last_tl2 ugraph + in + fo_unif_subst test_equality_only subst context + metasenv (C.Appl l1) (C.Appl l2) ugraph + | _ -> raise exn) + else + let meets = + CoercGraph.meets metasenv subst context car1 car2 + in + (match meets with + | [] -> raise exn + | (carr,metasenv,to1,to2)::xxx -> + (match xxx with + [] -> () + | (m2,_,c2,c2')::_ -> + let m1,_,c1,c1' = carr,metasenv,to1,to2 in + let unopt = + function Some (_,t) -> CicPp.ppterm t + | None -> "id" + in + HLog.warn + ("There are two minimal joins of "^ + CoercDb.name_of_carr car1^" and "^ + CoercDb.name_of_carr car2^": " ^ + CoercDb.name_of_carr m1 ^ " via "^unopt c1^" + "^ + unopt c1'^" and " ^ CoercDb.name_of_carr m2^" via "^ + unopt c2^" + "^unopt c2')); + let last_tl1',(subst,metasenv,ugraph) = + match last_tl1,to1 with + | Cic.Meta (i1,l1),Some (last,coerced) -> + last, + fo_unif_subst test_equality_only subst context + metasenv coerced last_tl1 ugraph + | _ -> last_tl1,(subst,metasenv,ugraph) + in + let last_tl2',(subst,metasenv,ugraph) = + match last_tl2,to2 with + | Cic.Meta (i2,l2),Some (last,coerced) -> + last, + fo_unif_subst test_equality_only subst context + metasenv coerced last_tl2 ugraph + | _ -> last_tl2,(subst,metasenv,ugraph) + in + (*DEBUGGING ONLY: +prerr_endline ("OK " ^ CicMetaSubst.ppterm_in_context ~metasenv subst last_tl1' context ^ " <==> " ^ CicMetaSubst.ppterm_in_context ~metasenv subst last_tl2' context); +*) + let subst,metasenv,ugraph = + fo_unif_subst test_equality_only subst context + metasenv last_tl1' last_tl2' ugraph + in + fo_unif_subst test_equality_only subst context + metasenv (C.Appl l1) (C.Appl l2) ugraph) +(*DEBUGGING ONLY: +in +let subst,metasenv,ugraph = res in +prerr_endline (">>>> " ^ CicMetaSubst.ppterm_in_context ~metasenv subst (C.Appl l1) context ^ " <==> " ^ CicMetaSubst.ppterm_in_context ~metasenv subst (C.Appl l2) context); +res +*) + (*CSC: This is necessary because of the "elim H" tactic + where the type of H is only reducible to an + inductive type. This could be extended from inductive + types to any rigid term. However, the code is + duplicated in two places: inside applications and + outside them. Probably it would be better to + work with lambda-bar terms instead. *) + | (Cic.MutInd _::_, Cic.MutInd _::_) -> raise exn + | (_, Cic.MutInd _::_) -> + let t1' = R.whd ~subst context t1 in + (match t1' with + C.Appl (C.MutInd _::_) -> + fo_unif_subst test_equality_only + subst context metasenv t1' t2 ugraph + | _ -> raise (UnificationFailure (lazy "88"))) + | (Cic.MutInd _::_,_) -> + let t2' = R.whd ~subst context t2 in + (match t2' with + C.Appl (C.MutInd _::_) -> + fo_unif_subst test_equality_only + subst context metasenv t1 t2' ugraph + | _ -> raise + (UnificationFailure + (lazy ("not a mutind :"^CicMetaSubst.ppterm ~metasenv subst t2 )))) + | _ -> raise exn))) + | (C.MutCase (_,_,outt1,t1',pl1), C.MutCase (_,_,outt2,t2',pl2))-> + let subst', metasenv',ugraph1 = + fo_unif_subst test_equality_only subst context metasenv outt1 outt2 + ugraph in + let subst'',metasenv'',ugraph2 = + fo_unif_subst test_equality_only subst' context metasenv' t1' t2' + ugraph1 in + (try + List.fold_left2 + (fun (subst,metasenv,ugraph) t1 t2 -> + fo_unif_subst + test_equality_only subst context metasenv t1 t2 ugraph + ) (subst'',metasenv'',ugraph2) pl1 pl2 + with + Invalid_argument _ -> + raise (UnificationFailure (lazy "6.1"))) + (* (sprintf + "Error trying to unify %s with %s: the number of branches is not the same." + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2)))) *) + | (C.Rel _, _) | (_, C.Rel _) -> + if t1 = t2 then + subst, metasenv,ugraph + else + raise (UnificationFailure (lazy + (sprintf + "Can't unify %s with %s because they are not convertible" + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2)))) + | (C.Appl (C.Meta(i,l)::args),t2) when not(exists_a_meta args) -> + let subst,metasenv,beta_expanded,ugraph1 = + beta_expand_many + test_equality_only metasenv subst context t2 args ugraph + in + fo_unif_subst test_equality_only subst context metasenv + (C.Meta (i,l)) beta_expanded ugraph1 + | (t1,C.Appl (C.Meta(i,l)::args)) when not(exists_a_meta args) -> + let subst,metasenv,beta_expanded,ugraph1 = + beta_expand_many + test_equality_only metasenv subst context t1 args ugraph + in + fo_unif_subst test_equality_only subst context metasenv + beta_expanded (C.Meta (i,l)) ugraph1 +(* Works iff there are no arguments applied to it; similar to the + case below + | (_, C.MutInd _) -> + let t1' = R.whd ~subst context t1 in + (match t1' with + C.MutInd _ -> + fo_unif_subst test_equality_only + subst context metasenv t1' t2 ugraph + | _ -> raise (UnificationFailure (lazy "8"))) +*) +(* The following idea could be exploited again; right now we have no + longer any example requiring it + | (C.Prod _, t2) -> + let t2' = R.whd ~subst context t2 in + (match t2' with + C.Prod _ -> + fo_unif_subst test_equality_only + subst context metasenv t1 t2' ugraph + | _ -> raise (UnificationFailure (lazy "8"))) + | (t1, C.Prod _) -> + let t1' = R.whd ~subst context t1 in + (match t1' with + C.Prod _ -> + fo_unif_subst test_equality_only + subst context metasenv t1' t2 ugraph + | _ -> (* raise (UnificationFailure "9")) *) + raise + (UnificationFailure (lazy (sprintf + "Can't unify %s with %s because they are not convertible" + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2))))) +*) + | (_,_) -> + (* delta-beta reduction should almost never be a problem for + unification since: + 1. long computations require iota reduction + 2. it is extremely rare that a close term t1 (that could be unified + to t2) beta-delta reduces to t1' while t2 does not beta-delta + reduces in the same way. This happens only if one meta of t2 + occurs in head position during beta reduction. In this unluky + case too much reduction will be performed on t1 and unification + will surely fail. *) + let t1' = CicReduction.head_beta_reduce ~delta:true t1 in + let t2' = CicReduction.head_beta_reduce ~delta:true t2 in + if t1 = t1' && t2 = t2' then + raise (UnificationFailure + (lazy + (sprintf + "Can't unify %s with %s because they are not convertible" + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2)))) + else + try + fo_unif_subst test_equality_only subst context metasenv t1' t2' ugraph + with + UnificationFailure _ + | Uncertain _ -> + raise (UnificationFailure + (lazy + (sprintf + "Can't unify %s with %s because they are not convertible" + (CicMetaSubst.ppterm ~metasenv subst t1) + (CicMetaSubst.ppterm ~metasenv subst t2)))) + +and fo_unif_subst_exp_named_subst test_equality_only subst context metasenv + exp_named_subst1 exp_named_subst2 ugraph += + try + List.fold_left2 + (fun (subst,metasenv,ugraph) (uri1,t1) (uri2,t2) -> + assert (uri1=uri2) ; + fo_unif_subst test_equality_only subst context metasenv t1 t2 ugraph + ) (subst,metasenv,ugraph) exp_named_subst1 exp_named_subst2 + with + Invalid_argument _ -> + let print_ens ens = + String.concat " ; " + (List.map + (fun (uri,t) -> + UriManager.string_of_uri uri ^ " := " ^ (CicMetaSubst.ppterm ~metasenv subst t) + ) ens) + in + raise (UnificationFailure (lazy (sprintf + "Error trying to unify the two explicit named substitutions (local contexts) %s and %s: their lengths is different." (print_ens exp_named_subst1) (print_ens exp_named_subst2)))) + +(* A substitution is a (int * Cic.term) list that associates a *) +(* metavariable i with its body. *) +(* metasenv is of type Cic.metasenv *) +(* fo_unif takes a metasenv, a context, two terms t1 and t2 and gives back *) +(* a new substitution which is already unwinded and ready to be applied and *) +(* a new metasenv in which some hypothesis in the contexts of the *) +(* metavariables may have been restricted. *) +let fo_unif metasenv context t1 t2 ugraph = + fo_unif_subst false [] context metasenv t1 t2 ugraph ;; + +let enrich_msg msg subst context metasenv t1 t2 ugraph = + lazy ( + if verbose then + sprintf "[Verbose] Unification error unifying %s of type %s with %s of type %s in context\n%s\nand metasenv\n%s\nand substitution\n%s\nbecause %s" + (CicMetaSubst.ppterm ~metasenv subst t1) + (try + let ty_t1,_ = type_of_aux' metasenv subst context t1 ugraph in + CicPp.ppterm ty_t1 + with + | UnificationFailure s + | Uncertain s + | AssertFailure s -> sprintf "MALFORMED(t1): \n%s\n" (Lazy.force s)) + (CicMetaSubst.ppterm ~metasenv subst t2) + (try + let ty_t2,_ = type_of_aux' metasenv subst context t2 ugraph in + CicPp.ppterm ty_t2 + with + | UnificationFailure s + | Uncertain s + | AssertFailure s -> sprintf "MALFORMED(t2): \n%s\n" (Lazy.force s)) + (CicMetaSubst.ppcontext ~metasenv subst context) + (CicMetaSubst.ppmetasenv subst metasenv) + (CicMetaSubst.ppsubst ~metasenv subst) (Lazy.force msg) + else + sprintf "Unification error unifying %s of type %s with %s of type %s in context\n%s\nand metasenv\n%s\nbecause %s" + (CicMetaSubst.ppterm_in_context ~metasenv subst t1 context) + (try + let ty_t1,_ = type_of_aux' metasenv subst context t1 ugraph in + CicMetaSubst.ppterm_in_context ~metasenv subst ty_t1 context + with + | UnificationFailure s + | Uncertain s + | AssertFailure s -> sprintf "MALFORMED(t1): \n%s\n" (Lazy.force s)) + (CicMetaSubst.ppterm_in_context ~metasenv subst t2 context) + (try + let ty_t2,_ = type_of_aux' metasenv subst context t2 ugraph in + CicMetaSubst.ppterm_in_context ~metasenv subst ty_t2 context + with + | UnificationFailure s + | Uncertain s + | AssertFailure s -> sprintf "MALFORMED(t2): \n%s\n" (Lazy.force s)) + (CicMetaSubst.ppcontext ~metasenv subst context) + (CicMetaSubst.ppmetasenv subst metasenv) + (Lazy.force msg) + ) + +let fo_unif_subst subst context metasenv t1 t2 ugraph = + try + fo_unif_subst false subst context metasenv t1 t2 ugraph + with + | AssertFailure msg -> + raise (AssertFailure (enrich_msg msg subst context metasenv t1 t2 ugraph)) + | UnificationFailure msg -> + raise (UnificationFailure (enrich_msg msg subst context metasenv t1 t2 ugraph)) +;; diff --git a/components/cic_unification/cicUnification.mli b/components/cic_unification/cicUnification.mli new file mode 100644 index 000000000..e1a6c2899 --- /dev/null +++ b/components/cic_unification/cicUnification.mli @@ -0,0 +1,58 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception UnificationFailure of string Lazy.t;; +exception Uncertain of string Lazy.t;; +exception AssertFailure of string Lazy.t;; + +(* fo_unif metasenv context t1 t2 *) +(* unifies [t1] and [t2] in a context [context]. *) +(* Only the metavariables declared in [metasenv] *) +(* can be used in [t1] and [t2]. *) +(* The returned substitution can be directly *) +(* withouth first unwinding it. *) +val fo_unif : + Cic.metasenv -> Cic.context -> + Cic.term -> Cic.term -> CicUniv.universe_graph -> + Cic.substitution * Cic.metasenv * CicUniv.universe_graph + +(* fo_unif_subst metasenv subst context t1 t2 *) +(* unifies [t1] and [t2] in a context [context] *) +(* and with [subst] as the current substitution *) +(* (i.e. unifies ([subst] [t1]) and *) +(* ([subst] [t2]) in a context *) +(* ([subst] [context]) using the metasenv *) +(* ([subst] [metasenv]) *) +(* Only the metavariables declared in [metasenv] *) +(* can be used in [t1] and [t2]. *) +(* [subst] and the substitution returned are not *) +(* unwinded. *) +(*CSC: fare un tipo unione Unwinded o ToUnwind e fare gestire la + cosa all'apply_subst!!!*) +val fo_unif_subst : + Cic.substitution -> Cic.context -> Cic.metasenv -> + Cic.term -> Cic.term -> CicUniv.universe_graph -> + Cic.substitution * Cic.metasenv * CicUniv.universe_graph + diff --git a/components/cic_unification/coercGraph.ml b/components/cic_unification/coercGraph.ml new file mode 100644 index 000000000..f12ea14b1 --- /dev/null +++ b/components/cic_unification/coercGraph.ml @@ -0,0 +1,278 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +open Printf;; + +type coercion_search_result = + (* metasenv, last coercion argument, fully saturated coercion *) + (* to apply the coercion it is sufficient to unify the last coercion + argument (that is a Meta) with the term to be coerced *) + | SomeCoercion of (Cic.metasenv * Cic.term * Cic.term) list + | SomeCoercionToTgt of (Cic.metasenv * Cic.term * Cic.term) list + | NoCoercion + | NotMetaClosed + | NotHandled of string Lazy.t + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) else () + +let saturate_coercion ul metasenv subst context = + let cl = + List.map (fun u,saturations -> CicUtil.term_of_uri u,saturations) ul in + let funclass_arityl = + let _,tgtcarl = List.split (List.map (fun u,_ -> CoercDb.get_carr u) ul) in + List.map (function CoercDb.Fun i -> i | _ -> 0) tgtcarl + in + let freshmeta = CicMkImplicit.new_meta metasenv subst in + List.map2 + (fun arity (c,saturations) -> + let ty,_ = + CicTypeChecker.type_of_aux' ~subst metasenv context c + CicUniv.empty_ugraph in + let _,metasenv,args,lastmeta = + TermUtil.saturate_term ~delta:false freshmeta metasenv context ty arity in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context + in + metasenv, Cic.Meta (lastmeta - saturations - 1,irl), + match args with + [] -> c + | _ -> Cic.Appl (c::args) + ) funclass_arityl cl +;; + +(* searches a coercion fron src to tgt in the !coercions list *) +let look_for_coercion' metasenv subst context src tgt = + let pp_l s l = + match l with + | [] -> + debug_print + (lazy + (sprintf ":-( coercion non trovata[%s] da %s a %s" s + (CoercDb.name_of_carr src) + (CoercDb.name_of_carr tgt))); + | _::_ -> + debug_print (lazy ( + sprintf ":-) TROVATE[%s] %d coercion(s) da %s a %s" s + (List.length l) + (CoercDb.name_of_carr src) + (CoercDb.name_of_carr tgt))); + in + try + let l = + CoercDb.find_coercion + (fun (s,t) -> CoercDb.eq_carr s src && CoercDb.eq_carr t tgt) + in + pp_l "precise" l; + (match l with + | [] -> + let l = + CoercDb.find_coercion + (fun (_,t) -> CoercDb.eq_carr t tgt) + in + pp_l "approx" l; + (match l with + | [] -> NoCoercion + | ul -> SomeCoercionToTgt (saturate_coercion ul metasenv subst context)) + | ul -> SomeCoercion (saturate_coercion ul metasenv subst context)) + with + | CoercDb.EqCarrNotImplemented s -> NotHandled s + | CoercDb.EqCarrOnNonMetaClosed -> NotMetaClosed +;; + +let look_for_coercion metasenv subst context src tgt = + let src_uri = CoercDb.coerc_carr_of_term src in + let tgt_uri = CoercDb.coerc_carr_of_term tgt in + look_for_coercion' metasenv subst context src_uri tgt_uri + +let source_of t = + try + let uri = CicUtil.uri_of_term t in + CoercDb.term_of_carr (fst (CoercDb.get_carr uri)) + with Invalid_argument _ -> assert false (* t must be a coercion *) + +let generate_dot_file () = + let module Pp = GraphvizPp.Dot in + let buf = Buffer.create 10240 in + let fmt = Format.formatter_of_buffer buf in + Pp.header ~node_attrs:["fontsize", "9"; "width", ".4"; "height", ".4"] + ~edge_attrs:["fontsize", "10"] fmt; + let l = CoercDb.to_list () in + let pp_description carr = + match CoercDb.uri_of_carr carr with + | None -> () + | Some uri -> + Pp.node (CoercDb.name_of_carr carr) + ~attrs:["href", UriManager.string_of_uri uri] fmt in + List.iter + (fun (src, tgt, ul) -> + let src_name = CoercDb.name_of_carr src in + let tgt_name = CoercDb.name_of_carr tgt in + pp_description src; + pp_description tgt; + List.iter + (fun (u,saturations) -> + Pp.edge src_name tgt_name + ~attrs:[ "label", + (UriManager.name_of_uri u ^ + if saturations = 0 then + "" + else + "(" ^ string_of_int saturations ^ ")"); + "href", UriManager.string_of_uri u ] + fmt) + ul) + l; + Pp.trailer fmt; + Buffer.contents buf +;; + +let is_composite t = + try + let uri = + match t with + | Cic.Appl (he::_) -> CicUtil.uri_of_term he + | _ -> CicUtil.uri_of_term t + in + match CicEnvironment.get_obj CicUniv.empty_ugraph uri with + | Cic.Constant (_,_, _, _, attrs),_ -> + List.exists (function `Class (`Coercion _) -> true | _ -> false) attrs + | _ -> false + with Invalid_argument _ -> false +;; + +let coerced_arg l = + match l with + | [] | [_] -> assert false + | c::_ when not (CoercDb.is_a_coercion' c) -> assert false + | c::tl -> + let arity = + match CoercDb.is_a_coercion_to_funclass c with None -> 0 | Some a -> a + in + (* decide a decent structure for coercion carriers so that all this stuff is + * useless *) + let pi = + (* this calculation is not complete, since we have strange carriers *) + let rec count_pi = function + | Cic.Prod(_,_,t) -> 1+ (count_pi t) + | _ -> 0 + in + let uri = CicUtil.uri_of_term c in + match fst(CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + | Cic.Constant (_, _, ty, _, _) -> count_pi ty + | _ -> assert false + in + try Some (List.nth tl (pi - arity)) with Invalid_argument _ -> None +;; + +(************************* meet calculation stuff ********************) +let eq_uri_opt u1 u2 = + match u1,u2 with + | Some (u1,_), Some (u2,_) -> UriManager.eq u1 u2 + | None,Some _ | Some _, None -> false + | None, None -> true +;; + +let eq_carr_uri (c1,u1) (c2,u2) = CoercDb.eq_carr c1 c2 && eq_uri_opt u1 u2;; + +let eq_carr_uri_uri (c1,u1,u11) (c2,u2,u22) = + CoercDb.eq_carr c1 c2 && eq_uri_opt u1 u2 && eq_uri_opt u11 u22 +;; + +let uniq = HExtlib.list_uniq ~eq:eq_carr_uri;; + +let uniq2 = HExtlib.list_uniq ~eq:eq_carr_uri_uri;; + +let splat e l = List.map (fun x -> e, Some x) l;; + +(* : carr -> (carr * uri option) where the option is always Some *) +let get_coercions_to carr = + let l = CoercDb.to_list () in + let splat_coercion_to carr (src,tgt,cl) = + if CoercDb.eq_carr tgt carr then Some (splat src cl) else None + in + let l = List.flatten (HExtlib.filter_map (splat_coercion_to carr) l) in + l +;; + +(* : carr -> (carr * uri option) where the option is always Some *) +let get_coercions_from carr = + let l = CoercDb.to_list () in + let splat_coercion_from carr (src,tgt,cl) = + if CoercDb.eq_carr src carr then Some (splat tgt cl) else None + in + List.flatten (HExtlib.filter_map (splat_coercion_from carr) l) +;; + +(* intersect { (s1,u1) | u1:s1->t1 } { (s2,u2) | u2:s2->t2 } + * gives the set { (s,u1,u2) | u1:s->t1 /\ u2:s->t2 } *) +let intersect l1 l2 = + let is_in_l1 (x,u2) = + HExtlib.filter_map + (fun (src,u1) -> + if CoercDb.eq_carr x src then Some (src,u1,u2) else None) + l1 + in + uniq2 (List.flatten (List.map is_in_l1 l2)) +;; + +(* grow tgt gives all the (src,u) such that u:tgt->src *) +let grow tgt = + uniq ((tgt,None)::(get_coercions_to tgt)) +;; + +let lb (c,_,_) = + let l = get_coercions_from c in + fun (x,_,_) -> List.exists (fun (y,_) -> CoercDb.eq_carr x y) l +;; + +(* given the set { (s,u1,u2) | u1:s->t1 /\ u2:s->t2 } removes the elements + * (s,_,_) such that (s',_,_) is in the set and there exists a coercion s->s' *) +let rec min acc = function + | c::tl -> + if List.exists (lb c) (tl@acc) then min acc tl else min (c::acc) tl + | [] -> acc +;; + +let meets metasenv subst context left right = + let saturate metasenv uo = + match uo with + | None -> metasenv, None + | Some u -> + match saturate_coercion [u] metasenv subst context with + | [metasenv, sat, last] -> metasenv, Some (sat, last) + | _ -> assert false + in + List.map + (fun (c,uo1,uo2) -> + let metasenv, uo1 = saturate metasenv uo1 in + let metasenv, uo2 = saturate metasenv uo2 in + c,metasenv, uo1, uo2) + (min [] (intersect (grow left) (grow right))) +;; + +(* EOF *) diff --git a/components/cic_unification/coercGraph.mli b/components/cic_unification/coercGraph.mli new file mode 100644 index 000000000..711a1527d --- /dev/null +++ b/components/cic_unification/coercGraph.mli @@ -0,0 +1,65 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(* This module implements the Query interface to the Coercion Graph *) + +type coercion_search_result = + (* metasenv, last coercion argument, fully saturated coercion *) + (* to apply the coercion it is sufficient to unify the last coercion + argument (that is a Meta) with the term to be coerced *) + | SomeCoercion of (Cic.metasenv * Cic.term * Cic.term) list + | SomeCoercionToTgt of (Cic.metasenv * Cic.term * Cic.term) list + | NoCoercion + | NotMetaClosed + | NotHandled of string Lazy.t + +val look_for_coercion : + Cic.metasenv -> Cic.substitution -> Cic.context -> + Cic.term -> Cic.term -> coercion_search_result + +val look_for_coercion' : + Cic.metasenv -> Cic.substitution -> Cic.context -> + CoercDb.coerc_carr -> CoercDb.coerc_carr -> coercion_search_result + +(* checks if term is a constant or + * a constant applyed that is marked with (`Class `Coercion) *) +val is_composite: Cic.term -> bool + +val source_of: Cic.term -> Cic.term + +val generate_dot_file: unit -> string + +(* given the Appl contents returns the argument of the head coercion *) +val coerced_arg: Cic.term list -> Cic.term option + +(* returns: (carr,menv,(saturated coercion,last arg)option,idem) list *) +val meets : + Cic.metasenv -> Cic.substitution -> Cic.context -> + CoercDb.coerc_carr -> CoercDb.coerc_carr -> + (CoercDb.coerc_carr * Cic.metasenv * + (Cic.term * Cic.term) option * (Cic.term * Cic.term) option) list + diff --git a/components/cic_unification/termUtil.ml b/components/cic_unification/termUtil.ml new file mode 100644 index 000000000..1886b25d7 --- /dev/null +++ b/components/cic_unification/termUtil.ml @@ -0,0 +1,89 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id: proofEngineHelpers.ml 7022 2006-11-15 19:47:41Z fguidi $ *) + +(* saturate_term newmeta metasenv context ty goal_arity *) +(* Given a type [ty] (a backbone), it returns its suffix of length *) +(* [goal_arity] head and a new metasenv in which there is new a META for each *) +(* hypothesis, a list of arguments for the new applications and the index of *) +(* the last new META introduced. The nth argument in the list of arguments is *) +(* just the nth new META. *) +let saturate_term ?(delta=true) newmeta metasenv context ty goal_arity = + let module C = Cic in + let module S = CicSubstitution in + assert (goal_arity >= 0); + let rec aux newmeta ty = + match ty with + C.Cast (he,_) -> aux newmeta he +(* CSC: patch to generate ?1 : ?2 : Type in place of ?1 : Type to simulate ?1 :< Type + (* If the expected type is a Type, then also Set is OK ==> + * we accept any term of type Type *) + (*CSC: BUG HERE: in this way it is possible for the term of + * type Type to be different from a Sort!!! *) + | C.Prod (name,(C.Sort (C.Type _) as s),t) -> + (* TASSI: ask CSC if BUG HERE refers to the C.Cast or C.Propd case *) + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context + in + let newargument = C.Meta (newmeta+1,irl) in + let (res,newmetasenv,arguments,lastmeta) = + aux (newmeta + 2) (S.subst newargument t) + in + res, + (newmeta,[],s)::(newmeta+1,context,C.Meta (newmeta,[]))::newmetasenv, + newargument::arguments,lastmeta +*) + | C.Prod (name,s,t) -> + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context + in + let newargument = C.Meta (newmeta,irl) in + let res,newmetasenv,arguments,lastmeta,prod_no = + aux (newmeta + 1) (S.subst newargument t) + in + if prod_no + 1 = goal_arity then + let head = CicReduction.normalize ~delta:false context ty in + head,[],[],newmeta,goal_arity + 1 + else + (** NORMALIZE RATIONALE + * we normalize the target only NOW since we may be in this case: + * A1 -> A2 -> T where T = (\lambda x.A3 -> P) k + * and we want a mesasenv with ?1:A1 and ?2:A2 and not + * ?1, ?2, ?3 (that is the one we whould get if we start from the + * beta-normalized A1 -> A2 -> A3 -> P **) + let s' = CicReduction.normalize ~delta:false context s in + res,(newmeta,context,s')::newmetasenv,newargument::arguments, + lastmeta,prod_no + 1 + | t -> + let head = CicReduction.normalize ~delta:false context t in + match CicReduction.whd context head ~delta with + C.Prod _ as head' -> aux newmeta head' + | _ -> head,[],[],newmeta,0 + in + (* WARNING: here we are using the invariant that above the most *) + (* recente new_meta() there are no used metas. *) + let res,newmetasenv,arguments,lastmeta,_ = aux newmeta ty in + res,metasenv @ newmetasenv,arguments,lastmeta diff --git a/components/cic_unification/termUtil.mli b/components/cic_unification/termUtil.mli new file mode 100644 index 000000000..c851bb588 --- /dev/null +++ b/components/cic_unification/termUtil.mli @@ -0,0 +1,37 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id: proofEngineHelpers.ml 7022 2006-11-15 19:47:41Z fguidi $ *) + +(* saturate_term newmeta metasenv context ty goal_arity *) +(* Given a type [ty] (a backbone), it returns its suffix of length *) +(* [goal_arity] head and a new metasenv in which there is new a META for each *) +(* hypothesis, a list of arguments for the new applications and the index of *) +(* the last new META introduced. The nth argument in the list of arguments is *) +(* just the nth new META. *) +val saturate_term: + ?delta: bool -> (* default true *) + int -> Cic.metasenv -> Cic.context -> Cic.term -> int -> + Cic.term * Cic.metasenv * Cic.term list * int diff --git a/components/content_pres/.depend b/components/content_pres/.depend new file mode 100644 index 000000000..2c5d65140 --- /dev/null +++ b/components/content_pres/.depend @@ -0,0 +1,36 @@ +cicNotationPres.cmi: mpresentation.cmi box.cmi +boxPp.cmi: mpresentation.cmi cicNotationPres.cmi box.cmi +content2pres.cmi: cicNotationPres.cmi +sequent2pres.cmi: cicNotationPres.cmi +renderingAttrs.cmo: renderingAttrs.cmi +renderingAttrs.cmx: renderingAttrs.cmi +cicNotationLexer.cmo: cicNotationLexer.cmi +cicNotationLexer.cmx: cicNotationLexer.cmi +cicNotationParser.cmo: cicNotationLexer.cmi cicNotationParser.cmi +cicNotationParser.cmx: cicNotationLexer.cmx cicNotationParser.cmi +mpresentation.cmo: mpresentation.cmi +mpresentation.cmx: mpresentation.cmi +box.cmo: renderingAttrs.cmi box.cmi +box.cmx: renderingAttrs.cmx box.cmi +content2presMatcher.cmo: content2presMatcher.cmi +content2presMatcher.cmx: content2presMatcher.cmi +termContentPres.cmo: renderingAttrs.cmi content2presMatcher.cmi \ + termContentPres.cmi +termContentPres.cmx: renderingAttrs.cmx content2presMatcher.cmx \ + termContentPres.cmi +cicNotationPres.cmo: renderingAttrs.cmi mpresentation.cmi box.cmi \ + cicNotationPres.cmi +cicNotationPres.cmx: renderingAttrs.cmx mpresentation.cmx box.cmx \ + cicNotationPres.cmi +boxPp.cmo: renderingAttrs.cmi mpresentation.cmi cicNotationPres.cmi box.cmi \ + boxPp.cmi +boxPp.cmx: renderingAttrs.cmx mpresentation.cmx cicNotationPres.cmx box.cmx \ + boxPp.cmi +content2pres.cmo: termContentPres.cmi renderingAttrs.cmi mpresentation.cmi \ + cicNotationPres.cmi box.cmi content2pres.cmi +content2pres.cmx: termContentPres.cmx renderingAttrs.cmx mpresentation.cmx \ + cicNotationPres.cmx box.cmx content2pres.cmi +sequent2pres.cmo: termContentPres.cmi mpresentation.cmi cicNotationPres.cmi \ + box.cmi sequent2pres.cmi +sequent2pres.cmx: termContentPres.cmx mpresentation.cmx cicNotationPres.cmx \ + box.cmx sequent2pres.cmi diff --git a/components/content_pres/.depend.opt b/components/content_pres/.depend.opt new file mode 100644 index 000000000..2c5d65140 --- /dev/null +++ b/components/content_pres/.depend.opt @@ -0,0 +1,36 @@ +cicNotationPres.cmi: mpresentation.cmi box.cmi +boxPp.cmi: mpresentation.cmi cicNotationPres.cmi box.cmi +content2pres.cmi: cicNotationPres.cmi +sequent2pres.cmi: cicNotationPres.cmi +renderingAttrs.cmo: renderingAttrs.cmi +renderingAttrs.cmx: renderingAttrs.cmi +cicNotationLexer.cmo: cicNotationLexer.cmi +cicNotationLexer.cmx: cicNotationLexer.cmi +cicNotationParser.cmo: cicNotationLexer.cmi cicNotationParser.cmi +cicNotationParser.cmx: cicNotationLexer.cmx cicNotationParser.cmi +mpresentation.cmo: mpresentation.cmi +mpresentation.cmx: mpresentation.cmi +box.cmo: renderingAttrs.cmi box.cmi +box.cmx: renderingAttrs.cmx box.cmi +content2presMatcher.cmo: content2presMatcher.cmi +content2presMatcher.cmx: content2presMatcher.cmi +termContentPres.cmo: renderingAttrs.cmi content2presMatcher.cmi \ + termContentPres.cmi +termContentPres.cmx: renderingAttrs.cmx content2presMatcher.cmx \ + termContentPres.cmi +cicNotationPres.cmo: renderingAttrs.cmi mpresentation.cmi box.cmi \ + cicNotationPres.cmi +cicNotationPres.cmx: renderingAttrs.cmx mpresentation.cmx box.cmx \ + cicNotationPres.cmi +boxPp.cmo: renderingAttrs.cmi mpresentation.cmi cicNotationPres.cmi box.cmi \ + boxPp.cmi +boxPp.cmx: renderingAttrs.cmx mpresentation.cmx cicNotationPres.cmx box.cmx \ + boxPp.cmi +content2pres.cmo: termContentPres.cmi renderingAttrs.cmi mpresentation.cmi \ + cicNotationPres.cmi box.cmi content2pres.cmi +content2pres.cmx: termContentPres.cmx renderingAttrs.cmx mpresentation.cmx \ + cicNotationPres.cmx box.cmx content2pres.cmi +sequent2pres.cmo: termContentPres.cmi mpresentation.cmi cicNotationPres.cmi \ + box.cmi sequent2pres.cmi +sequent2pres.cmx: termContentPres.cmx mpresentation.cmx cicNotationPres.cmx \ + box.cmx sequent2pres.cmi diff --git a/components/content_pres/Makefile b/components/content_pres/Makefile new file mode 100644 index 000000000..2eadef187 --- /dev/null +++ b/components/content_pres/Makefile @@ -0,0 +1,61 @@ +PACKAGE = content_pres +PREDICATES = + +INTERFACE_FILES = \ + renderingAttrs.mli \ + cicNotationLexer.mli \ + cicNotationParser.mli \ + mpresentation.mli \ + box.mli \ + content2presMatcher.mli \ + termContentPres.mli \ + cicNotationPres.mli \ + boxPp.mli \ + content2pres.mli \ + sequent2pres.mli \ + $(NULL) +IMPLEMENTATION_FILES = \ + $(INTERFACE_FILES:%.mli=%.ml) + +cicNotationPres.cmi: OCAMLOPTIONS += -rectypes +cicNotationPres.cmo: OCAMLOPTIONS += -rectypes +cicNotationPres.cmx: OCAMLOPTIONS += -rectypes + +all: test_lexer +clean: clean_tests + +LOCAL_LINKOPTS = -package helm-content_pres -linkpkg +test: test_lexer +test_lexer: test_lexer.ml $(PACKAGE).cma + @echo " OCAMLC $<" + @$(OCAMLC) $(LOCAL_LINKOPTS) -o $@ $< + +clean_tests: + rm -f test_lexer{,.opt} + +cicNotationLexer.cmo: OCAMLC = $(OCAMLC_P4) +cicNotationParser.cmo: OCAMLC = $(OCAMLC_P4) +cicNotationLexer.cmx: OCAMLOPT = $(OCAMLOPT_P4) +cicNotationParser.cmx: OCAMLOPT = $(OCAMLOPT_P4) +cicNotationLexer.ml.annot: OCAMLC = $(OCAMLC_P4) +cicNotationParser.ml.annot: OCAMLC = $(OCAMLC_P4) + +include ../../Makefile.defs +include ../Makefile.common + +# cross compatibility among ocaml 3.09 and ocaml 3.08, to be removed as +# soon as we have ocaml 3.09 everywhere and "loc" occurrences are replaced by +# "_loc" occurrences +UTF8DIR := $(shell $(OCAMLFIND) query helm-syntax_extensions) +ULEXDIR := $(shell $(OCAMLFIND) query ulex08) +MY_SYNTAXOPTIONS = -pp "camlp5o -I $(UTF8DIR) -I $(ULEXDIR) pa_extend.cmo pa_ulex.cma pa_unicode_macro.cma -loc loc" +cicNotationLexer.cmo: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +cicNotationParser.cmo: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +cicNotationLexer.cmx: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +cicNotationParser.cmx: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +cicNotationLexer.ml.annot: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +cicNotationParser.ml.annot: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +depend: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +depend.opt: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +# + diff --git a/components/content_pres/box.ml b/components/content_pres/box.ml new file mode 100644 index 000000000..7c5069262 --- /dev/null +++ b/components/content_pres/box.ml @@ -0,0 +1,153 @@ +(* Copyright (C) 2000-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 13/2/2004 *) +(* *) +(*************************************************************************) + +(* $Id$ *) + +type + 'expr box = + Text of attr * string + | Space of attr + | Ink of attr + | H of attr * ('expr box) list + | V of attr * ('expr box) list + | HV of attr * ('expr box) list + | HOV of attr * ('expr box) list + | Object of attr * 'expr + | Action of attr * ('expr box) list + +and attr = (string option * string * string) list + +let smallskip = Space([None,"width","0.5em"]);; +let skip = Space([None,"width","1em"]);; + +let indent t = H([],[skip;t]);; + +(* BoxML prefix *) +let prefix = "b";; + +let tag_of_box = function + | H _ -> "h" + | V _ -> "v" + | HV _ -> "hv" + | HOV _ -> "hov" + | _ -> assert false + +let box2xml ~obj2xml box = + let rec aux = + let module X = Xml in + function + Text (attr,s) -> X.xml_nempty ~prefix "text" attr (X.xml_cdata s) + | Space attr -> X.xml_empty ~prefix "space" attr + | Ink attr -> X.xml_empty ~prefix "ink" attr + | H (attr,l) + | V (attr,l) + | HV (attr,l) + | HOV (attr,l) as box -> + X.xml_nempty ~prefix (tag_of_box box) attr + [< (List.fold_right (fun x i -> [< (aux x) ; i >]) l [<>]) + >] + | Object (attr,m) -> + X.xml_nempty ~prefix "obj" attr [< obj2xml m >] + | Action (attr,l) -> + X.xml_nempty ~prefix "action" attr + [< (List.fold_right (fun x i -> [< (aux x) ; i >]) l [<>]) >] + in + aux box +;; + +let rec map f = function + | (Text _) as box -> box + | (Space _) as box -> box + | (Ink _) as box -> box + | H (attr, l) -> H (attr, List.map (map f) l) + | V (attr, l) -> V (attr, List.map (map f) l) + | HV (attr, l) -> HV (attr, List.map (map f) l) + | HOV (attr, l) -> HOV (attr, List.map (map f) l) + | Action (attr, l) -> Action (attr, List.map (map f) l) + | Object (attr, obj) -> Object (attr, f obj) +;; + +(* +let document_of_box ~obj2xml pres = + [< Xml.xml_cdata "\n" ; + Xml.xml_cdata "\n"; + Xml.xml_nempty ~prefix "box" + [Some "xmlns","m","http://www.w3.org/1998/Math/MathML" ; + Some "xmlns","b","http://helm.cs.unibo.it/2003/BoxML" ; + Some "xmlns","helm","http://www.cs.unibo.it/helm" ; + Some "xmlns","xlink","http://www.w3.org/1999/xlink" + ] (print_box pres) + >] +*) + +let b_h a b = H(a,b) +let b_v a b = V(a,b) +let b_hv a b = HV(a,b) +let b_hov a b = HOV(a,b) +let b_text a b = Text(a,b) +let b_object b = Object ([],b) +let b_indent = indent +let b_space = Space [None, "width", "0.5em"] +let b_kw = b_text (RenderingAttrs.object_keyword_attributes `BoxML) +let b_toggle items = Action ([ None, "type", "toggle"], items) + +let pp_attr attr = + let pp (ns, n, v) = + Printf.sprintf "%s%s=%s" (match ns with None -> "" | Some s -> s ^ ":") n v + in + String.concat " " (List.map pp attr) + +let get_attr = function + | Text (attr, _) + | Space attr + | Ink attr + | H (attr, _) + | V (attr, _) + | HV (attr, _) + | HOV (attr, _) + | Object (attr, _) + | Action (attr, _) -> + attr + +let set_attr attr = function + | Text (_, x) -> Text (attr, x) + | Space _ -> Space attr + | Ink _ -> Ink attr + | H (_, x) -> H (attr, x) + | V (_, x) -> V (attr, x) + | HV (_, x) -> HV (attr, x) + | HOV (_, x) -> HOV (attr, x) + | Object (_, x) -> Object (attr, x) + | Action (_, x) -> Action (attr, x) + diff --git a/components/content_pres/box.mli b/components/content_pres/box.mli new file mode 100644 index 000000000..d2ca17bdd --- /dev/null +++ b/components/content_pres/box.mli @@ -0,0 +1,79 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 13/2/2004 *) +(* *) +(*************************************************************************) + +type + 'expr box = + Text of attr * string + | Space of attr + | Ink of attr + | H of attr * ('expr box) list + | V of attr * ('expr box) list + | HV of attr * ('expr box) list + | HOV of attr * ('expr box) list + | Object of attr * 'expr + | Action of attr * ('expr box) list + +and attr = (string option * string * string) list + +val get_attr: 'a box -> attr +val set_attr: attr -> 'a box -> 'a box + +val smallskip : 'expr box +val skip: 'expr box +val indent : 'expr box -> 'expr box + +val box2xml: + obj2xml:('a -> Xml.token Stream.t) -> 'a box -> + Xml.token Stream.t + +val map: ('a -> 'b) -> 'a box -> 'b box + +(* +val document_of_box : + ~obj2xml:('a -> Xml.token Stream.t) -> 'a box -> Xml.token Stream.t +*) + +val b_h: attr -> 'expr box list -> 'expr box +val b_v: attr -> 'expr box list -> 'expr box +val b_hv: attr -> 'expr box list -> 'expr box (** default indent and spacing *) +val b_hov: attr -> 'expr box list -> 'expr box (** default indent and spacing *) +val b_text: attr -> string -> 'expr box +val b_object: 'expr -> 'expr box +val b_indent: 'expr box -> 'expr box +val b_space: 'expr box +val b_kw: string -> 'expr box +val b_toggle: 'expr box list -> 'expr box (** action which toggle among items *) + +val pp_attr: attr -> string + diff --git a/components/content_pres/boxPp.ml b/components/content_pres/boxPp.ml new file mode 100644 index 000000000..0c1847548 --- /dev/null +++ b/components/content_pres/boxPp.ml @@ -0,0 +1,246 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +module Pres = Mpresentation + +(** {2 Pretty printing from BoxML to strings} *) + +let string_space = " " +let string_space_len = String.length string_space +let string_indent = (* string_space *) "" +let string_indent_len = String.length string_indent +let string_ink = "##" +let string_ink_len = String.length string_ink + +let contains_attrs contained container = + List.for_all (fun attr -> List.mem attr container) contained + +let want_indent = contains_attrs (RenderingAttrs.indent_attributes `BoxML) +let want_spacing = contains_attrs (RenderingAttrs.spacing_attributes `BoxML) + +let indent_string s = string_indent ^ s +let indent_children (size, children) = + let children' = List.map indent_string children in + size + string_space_len, children' + +let choose_rendering size (best, other) = + let best_size, _ = best in + if size >= best_size then best else other + +let merge_columns sep cols = + let sep_len = String.length sep in + let indent = ref 0 in + let res_rows = ref [] in + let add_row ~continue row = + match !res_rows with + | last :: prev when continue -> + res_rows := (String.concat sep [last; row]) :: prev; + indent := !indent + String.length last + sep_len + | _ -> res_rows := (String.make !indent ' ' ^ row) :: !res_rows; + in + List.iter + (fun rows -> + match rows with + | hd :: tl -> + add_row ~continue:true hd; + List.iter (add_row ~continue:false) tl + | [] -> ()) + cols; + List.rev !res_rows + +let max_len = + List.fold_left (fun max_size s -> max (String.length s) max_size) 0 + +let render_row available_space spacing children = + let spacing_bonus = if spacing then string_space_len else 0 in + let rem_space = ref available_space in + let renderings = ref [] in + List.iter + (fun f -> + let occupied_space, rendering = f !rem_space in + renderings := rendering :: !renderings; + rem_space := !rem_space - (occupied_space + spacing_bonus)) + children; + let sep = if spacing then string_space else "" in + let rendering = merge_columns sep (List.rev !renderings) in + max_len rendering, rendering + +let fixed_rendering s = + let s_len = String.length s in + (fun _ -> s_len, [s]) + +let render_to_strings ~map_unicode_to_tex choose_action size markup = + let max_size = max_int in + let rec aux_box = + function + | Box.Text (_, t) -> fixed_rendering t + | Box.Space _ -> fixed_rendering string_space + | Box.Ink _ -> fixed_rendering string_ink + | Box.Action (_, []) -> assert false + | Box.Action (_, l) -> aux_box (choose_action l) + | Box.Object (_, o) -> aux_mpres o + | Box.H (attrs, children) -> + let spacing = want_spacing attrs in + let children' = List.map aux_box children in + (fun size -> render_row size spacing children') + | Box.HV (attrs, children) -> + let spacing = want_spacing attrs in + let children' = List.map aux_box children in + (fun size -> + let (size', renderings) as res = + render_row max_size spacing children' + in + if size' <= size then (* children fit in a row *) + res + else (* break needed, re-render using a Box.V *) + aux_box (Box.V (attrs, children)) size) + | Box.V (attrs, []) -> assert false + | Box.V (attrs, [child]) -> aux_box child + | Box.V (attrs, hd :: tl) -> + let indent = want_indent attrs in + let hd_f = aux_box hd in + let tl_fs = List.map aux_box tl in + (fun size -> + let _, hd_rendering = hd_f size in + let children_size = + max 0 (if indent then size - string_indent_len else size) + in + let tl_renderings = + List.map + (fun f -> +(* let indent_header = if indent then string_indent else "" in *) + snd (indent_children (f children_size))) + tl_fs + in + let rows = hd_rendering @ List.concat tl_renderings in + max_len rows, rows) + | Box.HOV (attrs, []) -> assert false + | Box.HOV (attrs, [child]) -> aux_box child + | Box.HOV (attrs, children) -> + let spacing = want_spacing attrs in + let indent = want_indent attrs in + let spacing_bonus = if spacing then string_space_len else 0 in + let indent_bonus = if indent then string_indent_len else 0 in + let sep = if spacing then string_space else "" in + let fs = List.map aux_box children in + (fun size -> + let rows = ref [] in + let renderings = ref [] in + let rem_space = ref size in + let first_row = ref true in + let use_rendering (space, rendering) = + let use_indent = !renderings = [] && not !first_row in + let rendering' = + if use_indent then List.map indent_string rendering + else rendering + in + renderings := rendering' :: !renderings; + let bonus = if use_indent then indent_bonus else spacing_bonus in + rem_space := !rem_space - (space + bonus) + in + let end_cluster () = + let new_rows = merge_columns sep (List.rev !renderings) in + rows := List.rev_append new_rows !rows; + rem_space := size - indent_bonus; + renderings := []; + first_row := false + in + List.iter + (fun f -> + let (best_space, _) as best = f max_size in + if best_space <= !rem_space then + use_rendering best + else begin + end_cluster (); + if best_space <= !rem_space then use_rendering best + else use_rendering (f size) + end) + fs; + if !renderings <> [] then end_cluster (); + max_len !rows, List.rev !rows) + and aux_mpres = + let text s = Pres.Mtext ([], s) in + let mrow c = Pres.Mrow ([], c) in + function + | Pres.Mi (_, s) + | Pres.Mn (_, s) + | Pres.Mtext (_, s) + | Pres.Ms (_, s) + | Pres.Mgliph (_, s) -> fixed_rendering s + | Pres.Mo (_, s) -> + let s = + if map_unicode_to_tex then begin + if String.length s = 1 && Char.code s.[0] < 128 then + s + else + match Utf8Macro.tex_of_unicode s with + | Some s -> s ^ " " + | None -> " " ^ s ^ " " + end else + s + in + fixed_rendering s + | Pres.Mspace _ -> fixed_rendering string_space + | Pres.Mrow (attrs, children) -> + let children' = List.map aux_mpres children in + (fun size -> render_row size false children') + | Pres.Mfrac (_, m, n) -> + aux_mpres (mrow [ text "\\frac("; text ")"; text "("; n; text ")" ]) + | Pres.Msqrt (_, m) -> aux_mpres (mrow [ text "\\sqrt("; m; text ")" ]) + | Pres.Mroot (_, r, i) -> + aux_mpres (mrow [ + text "\\root("; i; text ")"; text "\\of("; r; text ")" ]) + | Pres.Mstyle (_, m) + | Pres.Merror (_, m) + | Pres.Mpadded (_, m) + | Pres.Mphantom (_, m) + | Pres.Menclose (_, m) -> aux_mpres m + | Pres.Mfenced (_, children) -> aux_mpres (mrow children) + | Pres.Maction (_, []) -> assert false + | Pres.Msub (_, m, n) -> + aux_mpres (mrow [ text "("; m; text ")\\sub("; n; text ")" ]) + | Pres.Msup (_, m, n) -> + aux_mpres (mrow [ text "("; m; text ")\\sup("; n; text ")" ]) + | Pres.Munder (_, m, n) -> + aux_mpres (mrow [ text "("; m; text ")\\below("; n; text ")" ]) + | Pres.Mover (_, m, n) -> + aux_mpres (mrow [ text "("; m; text ")\\above("; n; text ")" ]) + | Pres.Msubsup _ + | Pres.Munderover _ + | Pres.Mtable _ -> + prerr_endline + "MathML presentation element not yet available in concrete syntax"; + assert false + | Pres.Maction (_, hd :: _) -> aux_mpres hd + | Pres.Mobject (_, o) -> aux_box (o: CicNotationPres.boxml_markup) + in + snd (aux_mpres markup size) + +let render_to_string ~map_unicode_to_tex choose_action size markup = + String.concat "\n" + (render_to_strings ~map_unicode_to_tex choose_action size markup) + diff --git a/components/content_pres/boxPp.mli b/components/content_pres/boxPp.mli new file mode 100644 index 000000000..291c59a2a --- /dev/null +++ b/components/content_pres/boxPp.mli @@ -0,0 +1,43 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** + * @param map_unicode_to_tex if true converts multibye unicode sequences to + * TeX-like macros (when possible). Default: true + * @return rows list of rows *) +val render_to_strings: + map_unicode_to_tex:bool -> + (CicNotationPres.boxml_markup Mpresentation.mpres Box.box list -> CicNotationPres.boxml_markup) -> + int -> CicNotationPres.markup -> string list + + (** helper function + * @param map_unicode_to_tex as above + * @return s, concatenation of the return value of render_to_strings above + * with newlines as separators *) +val render_to_string: + map_unicode_to_tex:bool -> + (CicNotationPres.boxml_markup Mpresentation.mpres Box.box list -> CicNotationPres.boxml_markup) -> + int -> CicNotationPres.markup -> string + diff --git a/components/content_pres/cicNotationLexer.ml b/components/content_pres/cicNotationLexer.ml new file mode 100644 index 000000000..911ddc57e --- /dev/null +++ b/components/content_pres/cicNotationLexer.ml @@ -0,0 +1,351 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +exception Error of int * int * string + +let regexp number = xml_digit+ +let regexp utf8_blank = " " | "\r\n" | "\n" | "\t" | [160] (* this is a nbsp *) + + (* ZACK: breaks unicode's binder followed by an ascii letter without blank *) +(* let regexp ident_letter = xml_letter *) + +let regexp ident_letter = [ 'a' - 'z' 'A' - 'Z' ] + + (* must be in sync with "is_ligature_char" below *) +let regexp ligature_char = [ "'`~!?@*()[]<>-+=|:;.,/\"" ] +let regexp ligature = ligature_char ligature_char+ + +let is_ligature_char = + (* must be in sync with "regexp ligature_char" above *) + let chars = "'`~!?@*()[]<>-+=|:;.,/\"" in + (fun char -> + (try + ignore (String.index chars char); + true + with Not_found -> false)) + +let regexp ident_decoration = '\'' | '?' | '`' +let regexp ident_cont = ident_letter | xml_digit | '_' +let regexp ident = ident_letter ident_cont* ident_decoration* + +let regexp tex_token = '\\' ident + +let regexp delim_begin = "\\[" +let regexp delim_end = "\\]" + +let regexp qkeyword = "'" ident "'" + +let regexp implicit = '?' +let regexp placeholder = '%' +let regexp meta = implicit number + +let regexp csymbol = '\'' ident + +let regexp begin_group = "@{" | "${" +let regexp end_group = '}' +let regexp wildcard = "$_" +let regexp ast_ident = "@" ident +let regexp ast_csymbol = "@" csymbol +let regexp meta_ident = "$" ident +let regexp meta_anonymous = "$_" +let regexp qstring = '"' [^ '"']* '"' + +let regexp begincomment = "(**" utf8_blank +let regexp beginnote = "(*" +let regexp endcomment = "*)" +(* let regexp comment_char = [^'*'] | '*'[^')'] +let regexp note = "|+" ([^'*'] | "**") comment_char* "+|" *) + +let level1_layouts = + [ "sub"; "sup"; + "below"; "above"; + "over"; "atop"; "frac"; + "sqrt"; "root" + ] + +let level1_keywords = + [ "hbox"; "hvbox"; "hovbox"; "vbox"; + "break"; + "list0"; "list1"; "sep"; + "opt"; + "term"; "ident"; "number" + ] @ level1_layouts + +let level2_meta_keywords = + [ "if"; "then"; "else"; + "fold"; "left"; "right"; "rec"; + "fail"; + "default"; + "anonymous"; "ident"; "number"; "term"; "fresh" + ] + + (* (string, unit) Hashtbl.t, to exploit multiple bindings *) +let level2_ast_keywords = Hashtbl.create 23 +let _ = + List.iter (fun k -> Hashtbl.add level2_ast_keywords k ()) + [ "CProp"; "Prop"; "Type"; "Set"; "let"; "rec"; "corec"; "match"; + "with"; "in"; "and"; "to"; "as"; "on"; "return" ] + +let add_level2_ast_keyword k = Hashtbl.add level2_ast_keywords k () +let remove_level2_ast_keyword k = Hashtbl.remove level2_ast_keywords k + + (* (string, int) Hashtbl.t, with multiple bindings. + * int is the unicode codepoint *) +let ligatures = Hashtbl.create 23 +let _ = + List.iter + (fun (ligature, symbol) -> Hashtbl.add ligatures ligature symbol) + [ ("->", <:unicode>); ("=>", <:unicode>); + ("<=", <:unicode>); (">=", <:unicode>); + ("<>", <:unicode>); (":=", <:unicode>); + ("==", <:unicode>); + ] + +let regexp uri_step = [ 'a' - 'z' 'A' - 'Z' '0' - '9' '_' '-' ''' ]+ + +let regexp uri = + ("cic:/" | "theory:/") (* schema *) +(* ident ('/' ident)* |+ path +| *) + uri_step ('/' uri_step)* (* path *) + ('.' ident)+ (* ext *) + ("#xpointer(" number ('/' number)+ ")")? (* xpointer *) + +let error lexbuf msg = + let begin_cnum, end_cnum = Ulexing.loc lexbuf in + raise (Error (begin_cnum, end_cnum, msg)) +let error_at_end lexbuf msg = + let begin_cnum, end_cnum = Ulexing.loc lexbuf in + raise (Error (begin_cnum, end_cnum, msg)) + +let return_with_loc token begin_cnum end_cnum = + let flocation = HExtlib.floc_of_loc (begin_cnum,end_cnum) in + token, flocation + +let return lexbuf token = + let begin_cnum, end_cnum = Ulexing.loc lexbuf in + return_with_loc token begin_cnum end_cnum + +let return_lexeme lexbuf name = return lexbuf (name, Ulexing.utf8_lexeme lexbuf) + +let return_symbol lexbuf s = return lexbuf ("SYMBOL", s) +let return_eoi lexbuf = return lexbuf ("EOI", "") + +let remove_quotes s = String.sub s 1 (String.length s - 2) + +let mk_lexer token = + let tok_func stream = +(* let lexbuf = Ulexing.from_utf8_stream stream in *) +(** XXX Obj.magic rationale. + * The problem. + * camlp5 constraints the tok_func field of Token.glexer to have type: + * Stream.t char -> (Stream.t 'te * flocation_function) + * In order to use ulex we have (in theory) to instantiate a new lexbuf each + * time a char Stream.t is passed, destroying the previous lexbuf which may + * have consumed a character from the old stream which is lost forever :-( + * The "solution". + * Instead of passing to camlp5 a char Stream.t we pass a lexbuf, casting it to + * char Stream.t with Obj.magic where needed. + *) + let lexbuf = Obj.magic stream in + Token.make_stream_and_location + (fun () -> + try + token lexbuf + with + | Ulexing.Error -> error_at_end lexbuf "Unexpected character" + | Ulexing.InvalidCodepoint p -> + error_at_end lexbuf (sprintf "Invalid code point: %d" p)) + in + { + Token.tok_func = tok_func; + Token.tok_using = (fun _ -> ()); + Token.tok_removing = (fun _ -> ()); + Token.tok_match = Token.default_match; + Token.tok_text = Token.lexer_text; + Token.tok_comm = None; + } + +let expand_macro lexbuf = + let macro = + Ulexing.utf8_sub_lexeme lexbuf 1 (Ulexing.lexeme_length lexbuf - 1) + in + try + ("SYMBOL", Utf8Macro.expand macro) + with Utf8Macro.Macro_not_found _ -> "SYMBOL", Ulexing.utf8_lexeme lexbuf + +let remove_quotes s = String.sub s 1 (String.length s - 2) +let remove_left_quote s = String.sub s 1 (String.length s - 1) + +let rec level2_pattern_token_group counter buffer = + lexer + | end_group -> + if (counter > 0) then + Buffer.add_string buffer (Ulexing.utf8_lexeme lexbuf) ; + snd (Ulexing.loc lexbuf) + | begin_group -> + Buffer.add_string buffer (Ulexing.utf8_lexeme lexbuf) ; + ignore (level2_pattern_token_group (counter + 1) buffer lexbuf) ; + level2_pattern_token_group counter buffer lexbuf + | _ -> + Buffer.add_string buffer (Ulexing.utf8_lexeme lexbuf) ; + level2_pattern_token_group counter buffer lexbuf + +let read_unparsed_group token_name lexbuf = + let buffer = Buffer.create 16 in + let begin_cnum, _ = Ulexing.loc lexbuf in + let end_cnum = level2_pattern_token_group 0 buffer lexbuf in + return_with_loc (token_name, Buffer.contents buffer) begin_cnum end_cnum + +let rec level2_meta_token = + lexer + | utf8_blank+ -> level2_meta_token lexbuf + | ident -> + let s = Ulexing.utf8_lexeme lexbuf in + begin + if List.mem s level2_meta_keywords then + return lexbuf ("", s) + else + return lexbuf ("IDENT", s) + end + | "@{" -> read_unparsed_group "UNPARSED_AST" lexbuf + | ast_ident -> + return lexbuf ("UNPARSED_AST", + remove_left_quote (Ulexing.utf8_lexeme lexbuf)) + | ast_csymbol -> + return lexbuf ("UNPARSED_AST", + remove_left_quote (Ulexing.utf8_lexeme lexbuf)) + | eof -> return_eoi lexbuf + +let rec comment_token acc depth = + lexer + | beginnote -> + let acc = acc ^ Ulexing.utf8_lexeme lexbuf in + comment_token acc (depth + 1) lexbuf + | endcomment -> + let acc = acc ^ Ulexing.utf8_lexeme lexbuf in + if depth = 0 + then acc + else comment_token acc (depth - 1) lexbuf + | _ -> + let acc = acc ^ Ulexing.utf8_lexeme lexbuf in + comment_token acc depth lexbuf + + (** @param k continuation to be invoked when no ligature has been found *) +let rec ligatures_token k = + lexer + | ligature -> + let lexeme = Ulexing.utf8_lexeme lexbuf in + (match List.rev (Hashtbl.find_all ligatures lexeme) with + | [] -> (* ligature not found, rollback and try default lexer *) + Ulexing.rollback lexbuf; + k lexbuf + | default_lig :: _ -> (* ligatures found, use the default one *) + return_symbol lexbuf default_lig) + | eof -> return_eoi lexbuf + | _ -> (* not a ligature, rollback and try default lexer *) + Ulexing.rollback lexbuf; + k lexbuf + +and level2_ast_token = + lexer + | utf8_blank+ -> ligatures_token level2_ast_token lexbuf + | meta -> + let s = Ulexing.utf8_lexeme lexbuf in + return lexbuf ("META", String.sub s 1 (String.length s - 1)) + | implicit -> return lexbuf ("IMPLICIT", "") + | placeholder -> return lexbuf ("PLACEHOLDER", "") + | ident -> + let lexeme = Ulexing.utf8_lexeme lexbuf in + if Hashtbl.mem level2_ast_keywords lexeme then + return lexbuf ("", lexeme) + else + return lexbuf ("IDENT", lexeme) + | number -> return lexbuf ("NUMBER", Ulexing.utf8_lexeme lexbuf) + | tex_token -> return lexbuf (expand_macro lexbuf) + | uri -> return lexbuf ("URI", Ulexing.utf8_lexeme lexbuf) + | qstring -> + return lexbuf ("QSTRING", remove_quotes (Ulexing.utf8_lexeme lexbuf)) + | csymbol -> + return lexbuf ("CSYMBOL", remove_left_quote (Ulexing.utf8_lexeme lexbuf)) + | "${" -> read_unparsed_group "UNPARSED_META" lexbuf + | "@{" -> read_unparsed_group "UNPARSED_AST" lexbuf + | '(' -> return lexbuf ("LPAREN", "") + | ')' -> return lexbuf ("RPAREN", "") + | meta_ident -> + return lexbuf ("UNPARSED_META", + remove_left_quote (Ulexing.utf8_lexeme lexbuf)) + | meta_anonymous -> return lexbuf ("UNPARSED_META", "anonymous") + | beginnote -> + let _comment = comment_token (Ulexing.utf8_lexeme lexbuf) 0 lexbuf in +(* let comment = + Ulexing.utf8_sub_lexeme lexbuf 2 (Ulexing.lexeme_length lexbuf - 4) + in + return lexbuf ("NOTE", comment) *) + ligatures_token level2_ast_token lexbuf + | begincomment -> return lexbuf ("BEGINCOMMENT","") + | endcomment -> return lexbuf ("ENDCOMMENT","") + | eof -> return_eoi lexbuf + | _ -> return_symbol lexbuf (Ulexing.utf8_lexeme lexbuf) + +and level1_pattern_token = + lexer + | utf8_blank+ -> ligatures_token level1_pattern_token lexbuf + | number -> return lexbuf ("NUMBER", Ulexing.utf8_lexeme lexbuf) + | ident -> + let s = Ulexing.utf8_lexeme lexbuf in + begin + if List.mem s level1_keywords then + return lexbuf ("", s) + else + return lexbuf ("IDENT", s) + end + | tex_token -> return lexbuf (expand_macro lexbuf) + | qkeyword -> + return lexbuf ("QKEYWORD", remove_quotes (Ulexing.utf8_lexeme lexbuf)) + | '(' -> return lexbuf ("LPAREN", "") + | ')' -> return lexbuf ("RPAREN", "") + | eof -> return_eoi lexbuf + | _ -> return_symbol lexbuf (Ulexing.utf8_lexeme lexbuf) + +let level1_pattern_token = ligatures_token level1_pattern_token +let level2_ast_token = ligatures_token level2_ast_token + +(* API implementation *) + +let level1_pattern_lexer = mk_lexer level1_pattern_token +let level2_ast_lexer = mk_lexer level2_ast_token +let level2_meta_lexer = mk_lexer level2_meta_token + +let lookup_ligatures lexeme = + try + if lexeme.[0] = '\\' + then [ Utf8Macro.expand (String.sub lexeme 1 (String.length lexeme - 1)) ] + else List.rev (Hashtbl.find_all ligatures lexeme) + with Invalid_argument _ | Utf8Macro.Macro_not_found _ -> [] + diff --git a/components/content_pres/cicNotationLexer.mli b/components/content_pres/cicNotationLexer.mli new file mode 100644 index 000000000..cd5f0876d --- /dev/null +++ b/components/content_pres/cicNotationLexer.mli @@ -0,0 +1,48 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** begin of error offset (counted in unicode codepoint) + * end of error offset (counted as above) + * error message *) +exception Error of int * int * string + + (** XXX ZACK DEFCON 4 BEGIN: never use the tok_func field of the glexers below + * passing values of type char Stream.t, they should be in fact Ulexing.lexbuf + * casted with Obj.magic :-/ Read the comment in the .ml for the rationale *) + +val level1_pattern_lexer: (string * string) Token.glexer +val level2_ast_lexer: (string * string) Token.glexer +val level2_meta_lexer: (string * string) Token.glexer + + (** XXX ZACK DEFCON 4 END *) + +val add_level2_ast_keyword: string -> unit (** non idempotent *) +val remove_level2_ast_keyword: string -> unit (** non idempotent *) + +(** {2 Ligatures} *) + +val is_ligature_char: char -> bool +val lookup_ligatures: string -> string list + diff --git a/components/content_pres/cicNotationParser.ml b/components/content_pres/cicNotationParser.ml new file mode 100644 index 000000000..461e2fc9f --- /dev/null +++ b/components/content_pres/cicNotationParser.ml @@ -0,0 +1,661 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +module Ast = CicNotationPt +module Env = CicNotationEnv + +exception Parse_error of string +exception Level_not_found of int + +let level1_pattern_grammar = + Grammar.gcreate CicNotationLexer.level1_pattern_lexer +let level2_ast_grammar = Grammar.gcreate CicNotationLexer.level2_ast_lexer +let level2_meta_grammar = Grammar.gcreate CicNotationLexer.level2_meta_lexer + +let min_precedence = 0 +let max_precedence = 100 + +let level1_pattern = + Grammar.Entry.create level1_pattern_grammar "level1_pattern" +let level2_ast = Grammar.Entry.create level2_ast_grammar "level2_ast" +let term = Grammar.Entry.create level2_ast_grammar "term" +let let_defs = Grammar.Entry.create level2_ast_grammar "let_defs" +let protected_binder_vars = Grammar.Entry.create level2_ast_grammar "protected_binder_vars" +let level2_meta = Grammar.Entry.create level2_meta_grammar "level2_meta" + +let int_of_string s = + try + Pervasives.int_of_string s + with Failure _ -> + failwith (sprintf "Lexer failure: string_of_int \"%s\" failed" s) + +(** {2 Grammar extension} *) + +let gram_symbol s = Gramext.Stoken ("SYMBOL", s) +let gram_ident s = Gramext.Stoken ("IDENT", s) +let gram_number s = Gramext.Stoken ("NUMBER", s) +let gram_keyword s = Gramext.Stoken ("", s) +let gram_term = Gramext.Sself + +let gram_of_literal = + function + | `Symbol s -> gram_symbol s + | `Keyword s -> gram_keyword s + | `Number s -> gram_number s + +type binding = + | NoBinding + | Binding of string * Env.value_type + | Env of (string * Env.value_type) list + +let make_action action bindings = + let rec aux (vl : CicNotationEnv.t) = + function + [] -> Gramext.action (fun (loc: Ast.location) -> action vl loc) + | NoBinding :: tl -> Gramext.action (fun _ -> aux vl tl) + (* LUCA: DEFCON 3 BEGIN *) + | Binding (name, Env.TermType) :: tl -> + Gramext.action + (fun (v:Ast.term) -> + aux ((name, (Env.TermType, Env.TermValue v))::vl) tl) + | Binding (name, Env.StringType) :: tl -> + Gramext.action + (fun (v:string) -> + aux ((name, (Env.StringType, Env.StringValue v)) :: vl) tl) + | Binding (name, Env.NumType) :: tl -> + Gramext.action + (fun (v:string) -> + aux ((name, (Env.NumType, Env.NumValue v)) :: vl) tl) + | Binding (name, Env.OptType t) :: tl -> + Gramext.action + (fun (v:'a option) -> + aux ((name, (Env.OptType t, Env.OptValue v)) :: vl) tl) + | Binding (name, Env.ListType t) :: tl -> + Gramext.action + (fun (v:'a list) -> + aux ((name, (Env.ListType t, Env.ListValue v)) :: vl) tl) + | Env _ :: tl -> + Gramext.action (fun (v:CicNotationEnv.t) -> aux (v @ vl) tl) + (* LUCA: DEFCON 3 END *) + in + aux [] (List.rev bindings) + +let flatten_opt = + let rec aux acc = + function + [] -> List.rev acc + | NoBinding :: tl -> aux acc tl + | Env names :: tl -> aux (List.rev names @ acc) tl + | Binding (name, ty) :: tl -> aux ((name, ty) :: acc) tl + in + aux [] + + (* given a level 1 pattern computes the new RHS of "term" grammar entry *) +let extract_term_production pattern = + let rec aux = function + | Ast.AttributedTerm (_, t) -> aux t + | Ast.Literal l -> aux_literal l + | Ast.Layout l -> aux_layout l + | Ast.Magic m -> aux_magic m + | Ast.Variable v -> aux_variable v + | t -> + prerr_endline (CicNotationPp.pp_term t); + assert false + and aux_literal = + function + | `Symbol s -> [NoBinding, gram_symbol s] + | `Keyword s -> + (* assumption: s will be registered as a keyword with the lexer *) + [NoBinding, gram_keyword s] + | `Number s -> [NoBinding, gram_number s] + and aux_layout = function + | Ast.Sub (p1, p2) -> aux p1 @ [NoBinding, gram_symbol "\\sub"] @ aux p2 + | Ast.Sup (p1, p2) -> aux p1 @ [NoBinding, gram_symbol "\\sup"] @ aux p2 + | Ast.Below (p1, p2) -> aux p1 @ [NoBinding, gram_symbol "\\below"] @ aux p2 + | Ast.Above (p1, p2) -> aux p1 @ [NoBinding, gram_symbol "\\above"] @ aux p2 + | Ast.Frac (p1, p2) -> aux p1 @ [NoBinding, gram_symbol "\\frac"] @ aux p2 + | Ast.Atop (p1, p2) -> aux p1 @ [NoBinding, gram_symbol "\\atop"] @ aux p2 + | Ast.Over (p1, p2) -> aux p1 @ [NoBinding, gram_symbol "\\over"] @ aux p2 + | Ast.Root (p1, p2) -> + [NoBinding, gram_symbol "\\root"] @ aux p2 + @ [NoBinding, gram_symbol "\\of"] @ aux p1 + | Ast.Sqrt p -> [NoBinding, gram_symbol "\\sqrt"] @ aux p + | Ast.Break -> [] + | Ast.Box (_, pl) -> List.flatten (List.map aux pl) + | Ast.Group pl -> List.flatten (List.map aux pl) + and aux_magic magic = + match magic with + | Ast.Opt p -> + let p_bindings, p_atoms, p_names, p_action = inner_pattern p in + let action (env_opt : CicNotationEnv.t option) (loc : Ast.location) = + match env_opt with + | Some env -> List.map Env.opt_binding_some env + | None -> List.map Env.opt_binding_of_name p_names + in + [ Env (List.map Env.opt_declaration p_names), + Gramext.srules + [ [ Gramext.Sopt (Gramext.srules [ p_atoms, p_action ]) ], + Gramext.action action ] ] + | Ast.List0 (p, _) + | Ast.List1 (p, _) -> + let p_bindings, p_atoms, p_names, p_action = inner_pattern p in +(* let env0 = List.map list_binding_of_name p_names in + let grow_env_entry env n v = + List.map + (function + | (n', (ty, ListValue vl)) as entry -> + if n' = n then n', (ty, ListValue (v :: vl)) else entry + | _ -> assert false) + env + in + let grow_env env_i env = + List.fold_left + (fun env (n, (_, v)) -> grow_env_entry env n v) + env env_i + in *) + let action (env_list : CicNotationEnv.t list) (loc : Ast.location) = + CicNotationEnv.coalesce_env p_names env_list + in + let gram_of_list s = + match magic with + | Ast.List0 (_, None) -> Gramext.Slist0 s + | Ast.List1 (_, None) -> Gramext.Slist1 s + | Ast.List0 (_, Some l) -> Gramext.Slist0sep (s, gram_of_literal l) + | Ast.List1 (_, Some l) -> Gramext.Slist1sep (s, gram_of_literal l) + | _ -> assert false + in + [ Env (List.map Env.list_declaration p_names), + Gramext.srules + [ [ gram_of_list (Gramext.srules [ p_atoms, p_action ]) ], + Gramext.action action ] ] + | _ -> assert false + and aux_variable = + function + | Ast.NumVar s -> [Binding (s, Env.NumType), gram_number ""] + | Ast.TermVar s -> [Binding (s, Env.TermType), gram_term] + | Ast.IdentVar s -> [Binding (s, Env.StringType), gram_ident ""] + | Ast.Ascription (p, s) -> assert false (* TODO *) + | Ast.FreshVar _ -> assert false + and inner_pattern p = + let p_bindings, p_atoms = List.split (aux p) in + let p_names = flatten_opt p_bindings in + let action = + make_action (fun (env : CicNotationEnv.t) (loc : Ast.location) -> env) + p_bindings + in + p_bindings, p_atoms, p_names, action + in + aux pattern + +let level_of precedence associativity = + if precedence < min_precedence || precedence > max_precedence then + raise (Level_not_found precedence); + let assoc_string = + match associativity with + | Gramext.NonA -> "N" + | Gramext.LeftA -> "L" + | Gramext.RightA -> "R" + in + string_of_int precedence ^ assoc_string + +type rule_id = Grammar.token Gramext.g_symbol list + + (* mapping: rule_id -> owned keywords. (rule_id, string list) Hashtbl.t *) +let owned_keywords = Hashtbl.create 23 + +let extend level1_pattern ~precedence ~associativity action = + let p_bindings, p_atoms = + List.split (extract_term_production level1_pattern) + in + let level = level_of precedence associativity in +(* let p_names = flatten_opt p_bindings in *) + let _ = + Grammar.extend + [ Grammar.Entry.obj (term: 'a Grammar.Entry.e), + Some (Gramext.Level level), + [ None, + Some associativity, + [ p_atoms, + (make_action + (fun (env: CicNotationEnv.t) (loc: Ast.location) -> + (action env loc)) + p_bindings) ]]] + in + let keywords = CicNotationUtil.keywords_of_term level1_pattern in + let rule_id = p_atoms in + List.iter CicNotationLexer.add_level2_ast_keyword keywords; + Hashtbl.add owned_keywords rule_id keywords; (* keywords may be [] *) + rule_id + +let delete rule_id = + let atoms = rule_id in + (try + let keywords = Hashtbl.find owned_keywords rule_id in + List.iter CicNotationLexer.remove_level2_ast_keyword keywords + with Not_found -> assert false); + Grammar.delete_rule term atoms + +(** {2 Grammar} *) + +let parse_level1_pattern_ref = ref (fun _ -> assert false) +let parse_level2_ast_ref = ref (fun _ -> assert false) +let parse_level2_meta_ref = ref (fun _ -> assert false) + +let fold_cluster binder terms ty body = + List.fold_right + (fun term body -> Ast.Binder (binder, (term, ty), body)) + terms body (* terms are names: either Ident or FreshVar *) + +let fold_exists terms ty body = + List.fold_right + (fun term body -> + let lambda = Ast.Binder (`Lambda, (term, ty), body) in + Ast.Appl [ Ast.Symbol ("exists", 0); lambda ]) + terms body + +let fold_binder binder pt_names body = + List.fold_right + (fun (names, ty) body -> fold_cluster binder names ty body) + pt_names body + +let return_term loc term = Ast.AttributedTerm (`Loc loc, term) + + (* create empty precedence level for "term" *) +let _ = + let dummy_action = + Gramext.action (fun _ -> + failwith "internal error, lexer generated a dummy token") + in + (* Needed since campl4 on "delete_rule" remove the precedence level if it gets + * empty after the deletion. The lexer never generate the Stoken below. *) + let dummy_prod = [ [ Gramext.Stoken ("DUMMY", "") ], dummy_action ] in + let mk_level_list first last = + let rec aux acc = function + | i when i < first -> acc + | i -> + aux + ((Some (string_of_int i ^ "N"), Some Gramext.NonA, dummy_prod) + :: (Some (string_of_int i ^ "L"), Some Gramext.LeftA, dummy_prod) + :: (Some (string_of_int i ^ "R"), Some Gramext.RightA, dummy_prod) + :: acc) + (i - 1) + in + aux [] last + in + Grammar.extend + [ Grammar.Entry.obj (term: 'a Grammar.Entry.e), + None, + mk_level_list min_precedence max_precedence ] + +(* {{{ Grammar for concrete syntax patterns, notation level 1 *) +EXTEND + GLOBAL: level1_pattern; + + level1_pattern: [ [ p = l1_pattern; EOI -> CicNotationUtil.boxify p ] ]; + l1_pattern: [ [ p = LIST1 l1_simple_pattern -> p ] ]; + literal: [ + [ s = SYMBOL -> `Symbol s + | k = QKEYWORD -> `Keyword k + | n = NUMBER -> `Number n + ] + ]; + sep: [ [ "sep"; sep = literal -> sep ] ]; +(* row_sep: [ [ "rowsep"; sep = literal -> sep ] ]; + field_sep: [ [ "fieldsep"; sep = literal -> sep ] ]; *) + l1_magic_pattern: [ + [ "list0"; p = l1_simple_pattern; sep = OPT sep -> Ast.List0 (p, sep) + | "list1"; p = l1_simple_pattern; sep = OPT sep -> Ast.List1 (p, sep) + | "opt"; p = l1_simple_pattern -> Ast.Opt p + ] + ]; + l1_pattern_variable: [ + [ "term"; id = IDENT -> Ast.TermVar id + | "number"; id = IDENT -> Ast.NumVar id + | "ident"; id = IDENT -> Ast.IdentVar id + ] + ]; + l1_simple_pattern: + [ "layout" LEFTA + [ p1 = SELF; SYMBOL "\\sub"; p2 = SELF -> + return_term loc (Ast.Layout (Ast.Sub (p1, p2))) + | p1 = SELF; SYMBOL "\\sup"; p2 = SELF -> + return_term loc (Ast.Layout (Ast.Sup (p1, p2))) + | p1 = SELF; SYMBOL "\\below"; p2 = SELF -> + return_term loc (Ast.Layout (Ast.Below (p1, p2))) + | p1 = SELF; SYMBOL "\\above"; p2 = SELF -> + return_term loc (Ast.Layout (Ast.Above (p1, p2))) + | p1 = SELF; SYMBOL "\\over"; p2 = SELF -> + return_term loc (Ast.Layout (Ast.Over (p1, p2))) + | p1 = SELF; SYMBOL "\\atop"; p2 = SELF -> + return_term loc (Ast.Layout (Ast.Atop (p1, p2))) +(* | "array"; p = SELF; csep = OPT field_sep; rsep = OPT row_sep -> + return_term loc (Array (p, csep, rsep)) *) + | SYMBOL "\\frac"; p1 = SELF; p2 = SELF -> + return_term loc (Ast.Layout (Ast.Frac (p1, p2))) + | SYMBOL "\\sqrt"; p = SELF -> return_term loc (Ast.Layout (Ast.Sqrt p)) + | SYMBOL "\\root"; index = SELF; SYMBOL "\\of"; arg = SELF -> + return_term loc (Ast.Layout (Ast.Root (arg, index))) + | "hbox"; LPAREN; p = l1_pattern; RPAREN -> + return_term loc (Ast.Layout (Ast.Box ((Ast.H, false, false), p))) + | "vbox"; LPAREN; p = l1_pattern; RPAREN -> + return_term loc (Ast.Layout (Ast.Box ((Ast.V, false, false), p))) + | "hvbox"; LPAREN; p = l1_pattern; RPAREN -> + return_term loc (Ast.Layout (Ast.Box ((Ast.HV, false, false), p))) + | "hovbox"; LPAREN; p = l1_pattern; RPAREN -> + return_term loc (Ast.Layout (Ast.Box ((Ast.HOV, false, false), p))) + | "break" -> return_term loc (Ast.Layout Ast.Break) +(* | SYMBOL "\\SPACE" -> return_term loc (Layout Space) *) + | LPAREN; p = l1_pattern; RPAREN -> + return_term loc (CicNotationUtil.group p) + ] + | "simple" NONA + [ i = IDENT -> return_term loc (Ast.Variable (Ast.TermVar i)) + | m = l1_magic_pattern -> return_term loc (Ast.Magic m) + | v = l1_pattern_variable -> return_term loc (Ast.Variable v) + | l = literal -> return_term loc (Ast.Literal l) + ] + ]; + END +(* }}} *) + +(* {{{ Grammar for ast magics, notation level 2 *) +EXTEND + GLOBAL: level2_meta; + l2_variable: [ + [ "term"; id = IDENT -> Ast.TermVar id + | "number"; id = IDENT -> Ast.NumVar id + | "ident"; id = IDENT -> Ast.IdentVar id + | "fresh"; id = IDENT -> Ast.FreshVar id + | "anonymous" -> Ast.TermVar "_" + | id = IDENT -> Ast.TermVar id + ] + ]; + l2_magic: [ + [ "fold"; kind = [ "left" -> `Left | "right" -> `Right ]; + base = level2_meta; "rec"; id = IDENT; recursive = level2_meta -> + Ast.Fold (kind, base, [id], recursive) + | "default"; some = level2_meta; none = level2_meta -> + Ast.Default (some, none) + | "if"; p_test = level2_meta; + "then"; p_true = level2_meta; + "else"; p_false = level2_meta -> + Ast.If (p_test, p_true, p_false) + | "fail" -> Ast.Fail + ] + ]; + level2_meta: [ + [ magic = l2_magic -> Ast.Magic magic + | var = l2_variable -> Ast.Variable var + | blob = UNPARSED_AST -> + !parse_level2_ast_ref (Ulexing.from_utf8_string blob) + ] + ]; +END +(* }}} *) + +(* {{{ Grammar for ast patterns, notation level 2 *) +EXTEND + GLOBAL: level2_ast term let_defs protected_binder_vars; + level2_ast: [ [ p = term -> p ] ]; + sort: [ + [ "Prop" -> `Prop + | "Set" -> `Set + | "Type" -> `Type (CicUniv.fresh ()) + | "CProp" -> `CProp + ] + ]; + explicit_subst: [ + [ SYMBOL "\\subst"; (* to avoid catching frequent "a [1]" cases *) + SYMBOL "["; + substs = LIST1 [ + i = IDENT; SYMBOL <:unicode> (* ≔ *); t = term -> (i, t) + ] SEP SYMBOL ";"; + SYMBOL "]" -> + substs + ] + ]; + meta_subst: [ + [ s = SYMBOL "_" -> None + | p = term -> Some p ] + ]; + meta_substs: [ + [ SYMBOL "["; substs = LIST0 meta_subst; SYMBOL "]" -> substs ] + ]; + possibly_typed_name: [ + [ LPAREN; id = single_arg; SYMBOL ":"; typ = term; RPAREN -> + id, Some typ + | arg = single_arg -> arg, None + | SYMBOL "_" -> Ast.Ident ("_", None), None + | LPAREN; SYMBOL "_"; SYMBOL ":"; typ = term; RPAREN -> + Ast.Ident ("_", None), Some typ + ] + ]; + match_pattern: [ + [ id = IDENT -> Ast.Pattern (id, None, []) + | LPAREN; id = IDENT; vars = LIST1 possibly_typed_name; RPAREN -> + Ast.Pattern (id, None, vars) + | id = IDENT; vars = LIST1 possibly_typed_name -> + Ast.Pattern (id, None, vars) + | SYMBOL "_" -> Ast.Wildcard + ] + ]; + binder: [ + [ SYMBOL <:unicode> (* Π *) -> `Pi +(* | SYMBOL <:unicode> |+ ∃ +| -> `Exists *) + | SYMBOL <:unicode> (* ∀ *) -> `Forall + | SYMBOL <:unicode> (* λ *) -> `Lambda + ] + ]; + arg: [ + [ LPAREN; names = LIST1 IDENT SEP SYMBOL ","; + SYMBOL ":"; ty = term; RPAREN -> + List.map (fun n -> Ast.Ident (n, None)) names, Some ty + | name = IDENT -> [Ast.Ident (name, None)], None + | blob = UNPARSED_META -> + let meta = !parse_level2_meta_ref (Ulexing.from_utf8_string blob) in + match meta with + | Ast.Variable (Ast.FreshVar _) -> [meta], None + | Ast.Variable (Ast.TermVar "_") -> [Ast.Ident ("_", None)], None + | _ -> failwith "Invalid bound name." + ] + ]; + single_arg: [ + [ name = IDENT -> Ast.Ident (name, None) + | blob = UNPARSED_META -> + let meta = !parse_level2_meta_ref (Ulexing.from_utf8_string blob) in + match meta with + | Ast.Variable (Ast.FreshVar _) + | Ast.Variable (Ast.IdentVar _) -> meta + | Ast.Variable (Ast.TermVar "_") -> Ast.Ident ("_", None) + | _ -> failwith "Invalid index name." + ] + ]; + induction_kind: [ + [ "rec" -> `Inductive + | "corec" -> `CoInductive + ] + ]; + let_defs: [ + [ defs = LIST1 [ + name = single_arg; + args = LIST1 arg; + index_name = OPT [ "on"; id = single_arg -> id ]; + ty = OPT [ SYMBOL ":" ; p = term -> p ]; + SYMBOL <:unicode> (* ≝ *); body = term -> + let rec position_of name p = function + | [] -> None, p + | n :: _ when n = name -> Some p, p + | _ :: tl -> position_of name (p + 1) tl + in + let rec find_arg name n = function + | [] -> + Ast.fail loc (sprintf "Argument %s not found" + (CicNotationPp.pp_term name)) + | (l,_) :: tl -> + (match position_of name 0 l with + | None, len -> find_arg name (n + len) tl + | Some where, len -> n + where) + in + let index = + match index_name with + | None -> 0 + | Some index_name -> find_arg index_name 0 args + in + let args = + List.concat + (List.map + (function (names,ty) -> List.map (function x -> x,ty) names + ) args) + in + args, (name, ty), body, index + ] SEP "and" -> + defs + ] + ]; + binder_vars: [ + [ vars = [ + l = LIST1 single_arg SEP SYMBOL "," -> l + | SYMBOL "_" -> [Ast.Ident ("_", None)] ]; + typ = OPT [ SYMBOL ":"; t = term -> t ] -> (vars, typ) + ] + ]; + protected_binder_vars: [ + [ LPAREN; vars = binder_vars; RPAREN -> vars + ] + ]; + maybe_protected_binder_vars: [ + [ vars = binder_vars -> vars + | vars = protected_binder_vars -> vars + ] + ]; + term: LEVEL "10N" [ (* let in *) + [ "let"; var = possibly_typed_name; SYMBOL <:unicode> (* ≝ *); + p1 = term; "in"; p2 = term -> + return_term loc (Ast.LetIn (var, p1, p2)) + | "let"; k = induction_kind; defs = let_defs; "in"; + body = term -> + return_term loc (Ast.LetRec (k, defs, body)) + ] + ]; + term: LEVEL "20R" (* binder *) + [ + [ b = binder; (vars, typ) = maybe_protected_binder_vars; SYMBOL "."; body = term -> + return_term loc (fold_cluster b vars typ body) + | SYMBOL <:unicode> (* ∃ *); + (vars, typ) = maybe_protected_binder_vars; SYMBOL "."; body = term -> + return_term loc (fold_exists vars typ body) + ] + ]; + term: LEVEL "70L" (* apply *) + [ + [ p1 = term; p2 = term -> + let rec aux = function + | Ast.Appl (hd :: tl) + | Ast.AttributedTerm (_, Ast.Appl (hd :: tl)) -> + aux hd @ tl + | term -> [term] + in + return_term loc (Ast.Appl (aux p1 @ [p2])) + ] + ]; + term: LEVEL "90N" (* simple *) + [ + [ id = IDENT -> return_term loc (Ast.Ident (id, None)) + | id = IDENT; s = explicit_subst -> + return_term loc (Ast.Ident (id, Some s)) + | s = CSYMBOL -> return_term loc (Ast.Symbol (s, 0)) + | u = URI -> return_term loc (Ast.Uri (u, None)) + | n = NUMBER -> return_term loc (Ast.Num (n, 0)) + | IMPLICIT -> return_term loc (Ast.Implicit) + | PLACEHOLDER -> return_term loc Ast.UserInput + | m = META -> return_term loc (Ast.Meta (int_of_string m, [])) + | m = META; s = meta_substs -> + return_term loc (Ast.Meta (int_of_string m, s)) + | s = sort -> return_term loc (Ast.Sort s) + | "match"; t = term; + indty_ident = OPT [ "in"; id = IDENT -> id, None ]; + outtyp = OPT [ "return"; ty = term -> ty ]; + "with"; SYMBOL "["; + patterns = LIST0 [ + lhs = match_pattern; SYMBOL <:unicode> (* ⇒ *); + rhs = term -> + lhs, rhs + ] SEP SYMBOL "|"; + SYMBOL "]" -> + return_term loc (Ast.Case (t, indty_ident, outtyp, patterns)) + | LPAREN; p1 = term; SYMBOL ":"; p2 = term; RPAREN -> + return_term loc (Ast.Cast (p1, p2)) + | LPAREN; p = term; RPAREN -> p + | blob = UNPARSED_META -> + !parse_level2_meta_ref (Ulexing.from_utf8_string blob) + ] + ]; +END +(* }}} *) + +(** {2 API implementation} *) + +let exc_located_wrapper f = + try + f () + with + | Stdpp.Exc_located (floc, Stream.Error msg) -> + raise (HExtlib.Localized (floc, Parse_error msg)) + | Stdpp.Exc_located (floc, exn) -> + raise (HExtlib.Localized (floc, (Parse_error (Printexc.to_string exn)))) + +let parse_level1_pattern lexbuf = + exc_located_wrapper + (fun () -> Grammar.Entry.parse level1_pattern (Obj.magic lexbuf)) + +let parse_level2_ast lexbuf = + exc_located_wrapper + (fun () -> Grammar.Entry.parse level2_ast (Obj.magic lexbuf)) + +let parse_level2_meta lexbuf = + exc_located_wrapper + (fun () -> Grammar.Entry.parse level2_meta (Obj.magic lexbuf)) + +let _ = + parse_level1_pattern_ref := parse_level1_pattern; + parse_level2_ast_ref := parse_level2_ast; + parse_level2_meta_ref := parse_level2_meta + +let parse_term lexbuf = + exc_located_wrapper + (fun () -> (Grammar.Entry.parse term (Obj.magic lexbuf))) + +(** {2 Debugging} *) + +let print_l2_pattern () = + Grammar.print_entry Format.std_formatter (Grammar.Entry.obj term); + Format.pp_print_flush Format.std_formatter (); + flush stdout + +(* vim:set encoding=utf8 foldmethod=marker: *) diff --git a/components/content_pres/cicNotationParser.mli b/components/content_pres/cicNotationParser.mli new file mode 100644 index 000000000..134a42c3c --- /dev/null +++ b/components/content_pres/cicNotationParser.mli @@ -0,0 +1,71 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception Parse_error of string +exception Level_not_found of int + +(** {2 Parsing functions} *) + + (** concrete syntax pattern: notation level 1 *) +val parse_level1_pattern: Ulexing.lexbuf -> CicNotationPt.term + + (** AST pattern: notation level 2 *) +val parse_level2_ast: Ulexing.lexbuf -> CicNotationPt.term +val parse_level2_meta: Ulexing.lexbuf -> CicNotationPt.term + +(** {2 Grammar extension} *) + +type rule_id + +val extend: + CicNotationPt.term -> (* level 1 pattern *) + precedence:int -> + associativity:Gramext.g_assoc -> + (CicNotationEnv.t -> CicNotationPt.location -> CicNotationPt.term) -> + rule_id + +val delete: rule_id -> unit + +(** {2 Grammar entries} + * needed by grafite parser *) + +val level2_ast_grammar: Grammar.g + +val term : CicNotationPt.term Grammar.Entry.e + +val let_defs : + (CicNotationPt.term CicNotationPt.capture_variable list * CicNotationPt.term CicNotationPt.capture_variable * CicNotationPt.term * int) list + Grammar.Entry.e + +val protected_binder_vars : + (CicNotationPt.term list * CicNotationPt.term option) Grammar.Entry.e + +val parse_term: Ulexing.lexbuf -> CicNotationPt.term + +(** {2 Debugging} *) + + (** print "level2_pattern" entry on stdout, flushing afterwards *) +val print_l2_pattern: unit -> unit + diff --git a/components/content_pres/cicNotationPres.ml b/components/content_pres/cicNotationPres.ml new file mode 100644 index 000000000..673df335f --- /dev/null +++ b/components/content_pres/cicNotationPres.ml @@ -0,0 +1,451 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +module Ast = CicNotationPt +module Mpres = Mpresentation + +type mathml_markup = boxml_markup Mpres.mpres +and boxml_markup = mathml_markup Box.box + +type markup = mathml_markup + +let atop_attributes = [None, "linethickness", "0pt"] + +let to_unicode = Utf8Macro.unicode_of_tex + +let rec make_attributes l1 = function + | [] -> [] + | hd :: tl -> + (match hd with + | None -> make_attributes (List.tl l1) tl + | Some s -> + let p,n = List.hd l1 in + (p,n,s) :: make_attributes (List.tl l1) tl) + +let box_of_mpres = + function + | Mpresentation.Mobject (attrs, box) -> + assert (attrs = []); + box + | mpres -> Box.Object ([], mpres) + +let mpres_of_box = + function + | Box.Object (attrs, mpres) -> + assert (attrs = []); + mpres + | box -> Mpresentation.Mobject ([], box) + +let rec genuine_math = + function + | Mpresentation.Mobject ([], obj) -> not (genuine_box obj) + | _ -> true +and genuine_box = + function + | Box.Object ([], mpres) -> not (genuine_math mpres) + | _ -> true + +let rec eligible_math = + function + | Mpresentation.Mobject ([], Box.Object ([], mpres)) -> eligible_math mpres + | Mpresentation.Mobject ([], _) -> false + | _ -> true + +let rec promote_to_math = + function + | Mpresentation.Mobject ([], Box.Object ([], mpres)) -> promote_to_math mpres + | math -> math + +let small_skip = + Mpresentation.Mspace (RenderingAttrs.small_skip_attributes `MathML) + +let rec add_mpres_attributes new_attr = function + | Mpresentation.Mobject (attr, box) -> + Mpresentation.Mobject (attr, add_box_attributes new_attr box) + | mpres -> + Mpresentation.set_attr (new_attr @ Mpresentation.get_attr mpres) mpres +and add_box_attributes new_attr = function + | Box.Object (attr, mpres) -> + Box.Object (attr, add_mpres_attributes new_attr mpres) + | box -> Box.set_attr (new_attr @ Box.get_attr box) box + +let box_of mathonly spec attrs children = + match children with + | [t] -> add_mpres_attributes attrs t + | _ -> + let kind, spacing, indent = spec in + let dress children = + if spacing then + CicNotationUtil.dress small_skip children + else + children + in + if mathonly then Mpresentation.Mrow (attrs, dress children) + else + let attrs' = + (if spacing then RenderingAttrs.spacing_attributes `BoxML else []) + @ (if indent then RenderingAttrs.indent_attributes `BoxML else []) + @ attrs + in + match kind with + | Ast.H -> + if List.for_all eligible_math children then + Mpresentation.Mrow (attrs', + dress (List.map promote_to_math children)) + else + mpres_of_box (Box.H (attrs', + List.map box_of_mpres children)) +(* | Ast.H when List.for_all genuine_math children -> + Mpresentation.Mrow (attrs', dress children) *) + | Ast.V -> + mpres_of_box (Box.V (attrs', + List.map box_of_mpres children)) + | Ast.HV -> + mpres_of_box (Box.HV (attrs', + List.map box_of_mpres children)) + | Ast.HOV -> + mpres_of_box (Box.HOV (attrs', + List.map box_of_mpres children)) + +let open_paren = Mpresentation.Mo ([], "(") +let closed_paren = Mpresentation.Mo ([], ")") +let open_bracket = Mpresentation.Mo ([], "[") +let closed_bracket = Mpresentation.Mo ([], "]") +let open_brace = Mpresentation.Mo ([], "{") +let closed_brace = Mpresentation.Mo ([], "}") +let hidden_substs = Mpresentation.Mtext ([], "{...}") +let hidden_lctxt = Mpresentation.Mtext ([], "[...]") +let open_box_paren = Box.Text ([], "(") +let closed_box_paren = Box.Text ([], ")") +let semicolon = Mpresentation.Mo ([], ";") +let toggle_action children = + Mpresentation.Maction ([None, "actiontype", "toggle"], children) + +type child_pos = [ `Left | `Right | `Inner ] + +let pp_assoc = + function + | Gramext.LeftA -> "LeftA" + | Gramext.RightA -> "RightA" + | Gramext.NonA -> "NonA" + +let is_atomic t = + let rec aux_mpres = function + | Mpres.Mi _ + | Mpres.Mo _ + | Mpres.Mn _ + | Mpres.Ms _ + | Mpres.Mtext _ + | Mpres.Mspace _ -> true + | Mpres.Mobject (_, box) -> aux_box box + | Mpres.Maction (_, [mpres]) + | Mpres.Mrow (_, [mpres]) -> aux_mpres mpres + | _ -> false + and aux_box = function + | Box.Space _ + | Box.Ink _ + | Box.Text _ -> true + | Box.Object (_, mpres) -> aux_mpres mpres + | Box.H (_, [box]) + | Box.V (_, [box]) + | Box.HV (_, [box]) + | Box.HOV (_, [box]) + | Box.Action (_, [box]) -> aux_box box + | _ -> false + in + aux_mpres t + +let add_parens child_prec child_assoc child_pos curr_prec t = +(* eprintf + ("add_parens: " ^^ + "child_prec = %d\nchild_assoc = %s\nchild_pos = %s\ncurr_prec= %d\n\n%!") + child_prec (pp_assoc child_assoc) (CicNotationPp.pp_pos child_pos) + curr_prec; *) + if is_atomic t then t + else if child_prec >= 0 + && (child_prec < curr_prec + || (child_prec = curr_prec && + child_assoc = Gramext.LeftA && + child_pos <> `Left) + || (child_prec = curr_prec && + child_assoc = Gramext.RightA && + child_pos <> `Right)) + then begin (* parens should be added *) +(* prerr_endline "adding parens!"; *) + match t with + | Mpresentation.Mobject (_, box) -> + mpres_of_box (Box.H ([], [ open_box_paren; box; closed_box_paren ])) + | mpres -> Mpresentation.Mrow ([], [open_paren; t; closed_paren]) + end else + t + +let render ids_to_uris ?(prec=(-1)) = + let module A = Ast in + let module P = Mpresentation in +(* let use_unicode = true in *) + let lookup_uri id = + (try + let uri = Hashtbl.find ids_to_uris id in + Some (UriManager.string_of_uri uri) + with Not_found -> None) + in + let make_href xmlattrs xref = + let xref_uris = + List.fold_right + (fun xref uris -> + match lookup_uri xref with + | None -> uris + | Some uri -> uri :: uris) + !xref [] + in + let xmlattrs_uris, xmlattrs = + let xref_attrs, other_attrs = + List.partition + (function Some "xlink", "href", _ -> true | _ -> false) + xmlattrs + in + List.map (fun (_, _, uri) -> uri) xref_attrs, + other_attrs + in + let uris = + match xmlattrs_uris @ xref_uris with + | [] -> None + | uris -> + Some (String.concat " " + (HExtlib.list_uniq (List.sort String.compare uris))) + in + let xrefs = + match !xref with [] -> None | xrefs -> Some (String.concat " " xrefs) + in + xref := []; + xmlattrs + @ make_attributes [Some "helm", "xref"; Some "xlink", "href"] + [xrefs; uris] + in + let make_xref xref = + let xrefs = + match !xref with [] -> None | xrefs -> Some (String.concat " " xrefs) + in + xref := []; + make_attributes [Some "helm","xref"] [xrefs] + in + (* when mathonly is true no boxes should be generated, only mrows *) + (* "xref" is *) + let rec aux xmlattrs mathonly xref pos prec t = + match t with + | A.AttributedTerm _ -> + aux_attributes xmlattrs mathonly xref pos prec t + | A.Num (literal, _) -> + let attrs = + (RenderingAttrs.number_attributes `MathML) + @ make_href xmlattrs xref + in + Mpres.Mn (attrs, literal) + | A.Symbol (literal, _) -> + let attrs = + (RenderingAttrs.symbol_attributes `MathML) + @ make_href xmlattrs xref + in + Mpres.Mo (attrs, to_unicode literal) + | A.Ident (literal, subst) + | A.Uri (literal, subst) -> + let attrs = + (RenderingAttrs.ident_attributes `MathML) + @ make_href xmlattrs xref + in + let name = Mpres.Mi (attrs, to_unicode literal) in + (match subst with + | Some [] + | None -> name + | Some substs -> + let substs' = + box_of mathonly (A.H, false, false) [] + (open_brace + :: (CicNotationUtil.dress semicolon + (List.map + (fun (name, t) -> + box_of mathonly (A.H, false, false) [] [ + Mpres.Mi ([], name); + Mpres.Mo ([], to_unicode "\\def"); + aux [] mathonly xref pos prec t ]) + substs)) + @ [ closed_brace ]) + in + let substs_maction = toggle_action [ hidden_substs; substs' ] in + box_of mathonly (A.H, false, false) [] [ name; substs_maction ]) + | A.Meta(n, l) -> + let local_context l = + box_of mathonly (A.H, false, false) [] + ([ Mpres.Mtext ([], "[") ] @ + (CicNotationUtil.dress (Mpres.Mtext ([], ";")) + (List.map + (function + | None -> Mpres.Mtext ([], "_") + | Some t -> aux xmlattrs mathonly xref pos prec t) l)) @ + [ Mpres.Mtext ([], "]")]) + in + let lctxt_maction = toggle_action [ hidden_lctxt; local_context l ] in + box_of mathonly (A.H, false, false) [] + ([Mpres.Mtext ([], "?"^string_of_int n) ] + @ (if l <> [] then [lctxt_maction] else [])) + | A.Literal l -> aux_literal xmlattrs xref prec l + | A.UserInput -> Mpres.Mtext ([], "%") + | A.Layout l -> aux_layout mathonly xref pos prec l + | A.Magic _ + | A.Variable _ -> assert false (* should have been instantiated *) + | t -> + prerr_endline ("unexpected ast: " ^ CicNotationPp.pp_term t); + assert false + and aux_attributes xmlattrs mathonly xref pos prec t = + let reset = ref false in + let new_level = ref None in + let new_xref = ref [] in + let new_xmlattrs = ref [] in + let new_pos = ref pos in +(* let reinit = ref false in *) + let rec aux_attribute = + function + | A.AttributedTerm (attr, t) -> + (match attr with + | `Loc _ + | `Raw _ -> () + | `Level (-1, _) -> reset := true + | `Level (child_prec, child_assoc) -> + new_level := Some (child_prec, child_assoc) + | `IdRef xref -> new_xref := xref :: !new_xref + | `ChildPos pos -> new_pos := pos + | `XmlAttrs attrs -> new_xmlattrs := attrs @ !new_xmlattrs); + aux_attribute t + | t -> + (match !new_level with + | None -> aux !new_xmlattrs mathonly new_xref !new_pos prec t + | Some (child_prec, child_assoc) -> + let t' = + aux !new_xmlattrs mathonly new_xref !new_pos child_prec t in + if !reset + then t' + else add_parens child_prec child_assoc !new_pos prec t') + in + aux_attribute t + and aux_literal xmlattrs xref prec l = + let attrs = make_href xmlattrs xref in + (match l with + | `Symbol s -> Mpres.Mo (attrs, to_unicode s) + | `Keyword s -> Mpres.Mtext (attrs, to_unicode s) + | `Number s -> Mpres.Mn (attrs, to_unicode s)) + and aux_layout mathonly xref pos prec l = + let attrs = make_xref xref in + let invoke' t = aux [] true (ref []) pos prec t in + (* use the one below to reset precedence and associativity *) + let invoke_reinit t = aux [] mathonly xref `Inner ~-1 t in + match l with + | A.Sub (t1, t2) -> Mpres.Msub (attrs, invoke' t1, invoke_reinit t2) + | A.Sup (t1, t2) -> Mpres.Msup (attrs, invoke' t1, invoke_reinit t2) + | A.Below (t1, t2) -> Mpres.Munder (attrs, invoke' t1, invoke_reinit t2) + | A.Above (t1, t2) -> Mpres.Mover (attrs, invoke' t1, invoke_reinit t2) + | A.Frac (t1, t2) + | A.Over (t1, t2) -> + Mpres.Mfrac (attrs, invoke_reinit t1, invoke_reinit t2) + | A.Atop (t1, t2) -> + Mpres.Mfrac (atop_attributes @ attrs, invoke_reinit t1, + invoke_reinit t2) + | A.Sqrt t -> Mpres.Msqrt (attrs, invoke_reinit t) + | A.Root (t1, t2) -> + Mpres.Mroot (attrs, invoke_reinit t1, invoke_reinit t2) + | A.Box ((_, spacing, _) as kind, terms) -> + let children = + aux_children mathonly spacing xref pos prec + (CicNotationUtil.ungroup terms) + in + box_of mathonly kind attrs children + | A.Group terms -> + let children = + aux_children mathonly false xref pos prec + (CicNotationUtil.ungroup terms) + in + box_of mathonly (A.H, false, false) attrs children + | A.Break -> assert false (* TODO? *) + and aux_children mathonly spacing xref pos prec terms = + let find_clusters = + let rec aux_list first clusters acc = + function + [] when acc = [] -> List.rev clusters + | [] -> aux_list first (List.rev acc :: clusters) [] [] + | (A.Layout A.Break) :: tl when acc = [] -> + aux_list first clusters [] tl + | (A.Layout A.Break) :: tl -> + aux_list first (List.rev acc :: clusters) [] tl + | [hd] -> +(* let pos' = + if first then + pos + else + match pos with + `None -> `Right + | `Inner -> `Inner + | `Right -> `Right + | `Left -> `Inner + in *) + aux_list false clusters + (aux [] mathonly xref pos prec hd :: acc) [] + | hd :: tl -> +(* let pos' = + match pos, first with + `None, true -> `Left + | `None, false -> `Inner + | `Left, true -> `Left + | `Left, false -> `Inner + | `Right, _ -> `Inner + | `Inner, _ -> `Inner + in *) + aux_list false clusters + (aux [] mathonly xref pos prec hd :: acc) tl + in + aux_list true [] [] + in + let boxify_pres = + function + [t] -> t + | tl -> box_of mathonly (A.H, spacing, false) [] tl + in + List.map boxify_pres (find_clusters terms) + in + aux [] false (ref []) `Inner prec + +let rec print_box (t: boxml_markup) = + Box.box2xml print_mpres t +and print_mpres (t: mathml_markup) = + Mpresentation.print_mpres print_box t + +let print_xml = print_mpres + +(* let render_to_boxml id_to_uri t = + let xml_stream = print_box (box_of_mpres (render id_to_uri t)) in + Xml.add_xml_declaration xml_stream *) + diff --git a/components/content_pres/cicNotationPres.mli b/components/content_pres/cicNotationPres.mli new file mode 100644 index 000000000..1d06d19ba --- /dev/null +++ b/components/content_pres/cicNotationPres.mli @@ -0,0 +1,54 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type mathml_markup = boxml_markup Mpresentation.mpres +and boxml_markup = mathml_markup Box.box + +type markup = mathml_markup + +(** {2 Markup conversions} *) + +val mpres_of_box: boxml_markup -> mathml_markup +val box_of_mpres: mathml_markup -> boxml_markup + +(** {2 Rendering} *) + +(** level 1 -> level 0 + * @param ids_to_uris mapping id -> uri for hyperlinking + * @param prec precedence level *) +val render: + (Cic.id, UriManager.uri) Hashtbl.t -> ?prec:int -> CicNotationPt.term -> markup + +(** level 0 -> xml stream *) +val print_xml: markup -> Xml.token Stream.t + +(* |+* level 1 -> xml stream + * @param ids_to_uris +| +val render_to_boxml: + (Cic.id, string) Hashtbl.t -> CicNotationPt.term -> Xml.token Stream.t *) + +val print_box: boxml_markup -> Xml.token Stream.t +val print_mpres: mathml_markup -> Xml.token Stream.t + diff --git a/components/content_pres/content2pres.ml b/components/content_pres/content2pres.ml new file mode 100644 index 000000000..b9e897694 --- /dev/null +++ b/components/content_pres/content2pres.ml @@ -0,0 +1,967 @@ +(* Copyright (C) 2003-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(***************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 17/06/2003 *) +(* *) +(***************************************************************************) + +(* $Id$ *) + +module P = Mpresentation +module B = Box +module Con = Content + +let p_mtr a b = Mpresentation.Mtr(a,b) +let p_mtd a b = Mpresentation.Mtd(a,b) +let p_mtable a b = Mpresentation.Mtable(a,b) +let p_mtext a b = Mpresentation.Mtext(a,b) +let p_mi a b = Mpresentation.Mi(a,b) +let p_mo a b = Mpresentation.Mo(a,b) +let p_mrow a b = Mpresentation.Mrow(a,b) +let p_mphantom a b = Mpresentation.Mphantom(a,b) + +let rec split n l = + if n = 0 then [],l + else let l1,l2 = + split (n-1) (List.tl l) in + (List.hd l)::l1,l2 + +let get_xref = function + | `Declaration d + | `Hypothesis d -> d.Con.dec_id + | `Proof p -> p.Con.proof_id + | `Definition d -> d.Con.def_id + | `Joint jo -> jo.Con.joint_id + +let hv_attrs = + RenderingAttrs.spacing_attributes `BoxML + @ RenderingAttrs.indent_attributes `BoxML + +let make_row items concl = + B.b_hv hv_attrs (items @ [ concl ]) +(* match concl with + B.V _ -> |+ big! +| + B.b_v attrs [B.b_h [] items; B.b_indent concl] + | _ -> |+ small +| + B.b_h attrs (items@[B.b_space; concl]) *) + +let make_concl ?(attrs=[]) verb concl = + B.b_hv (hv_attrs @ attrs) [ B.b_kw verb; concl ] +(* match concl with + B.V _ -> |+ big! +| + B.b_v attrs [ B.b_kw verb; B.b_indent concl] + | _ -> |+ small +| + B.b_h attrs [ B.b_kw verb; B.b_space; concl ] *) + +let make_args_for_apply term2pres args = + let make_arg_for_apply is_first arg row = + let res = + match arg with + Con.Aux n -> assert false + | Con.Premise prem -> + let name = + (match prem.Con.premise_binder with + None -> "previous" + | Some s -> s) in + (B.b_object (P.Mi ([], name)))::row + | Con.Lemma lemma -> + let lemma_attrs = [ + Some "helm", "xref", lemma.Con.lemma_id; + Some "xlink", "href", lemma.Con.lemma_uri ] + in + (B.b_object (P.Mi(lemma_attrs,lemma.Con.lemma_name)))::row + | Con.Term (b,t) -> + if is_first || (not b) then + (term2pres t)::row + else (B.b_object (P.Mi([],"?")))::row + | Con.ArgProof _ + | Con.ArgMethod _ -> + (B.b_object (P.Mi([],"?")))::row + in + if is_first then res else B.skip::res + in + match args with + hd::tl -> + make_arg_for_apply true hd + (List.fold_right (make_arg_for_apply false) tl []) + | _ -> assert false + +let get_name ?(default="_") = function + | Some s -> s + | None -> default + +let add_xref id = function + | B.Text (attrs, t) -> B.Text (((Some "helm", "xref", id) :: attrs), t) + | _ -> assert false (* TODO, add_xref is meaningful for all boxes *) + +let rec justification ~ignore_atoms term2pres p = + if p.Con.proof_conclude.Con.conclude_method = "Exact" && + ignore_atoms + then + [], None + else if + (p.Con.proof_conclude.Con.conclude_method = "Exact" && not ignore_atoms) || + (p.Con.proof_context = [] && + p.Con.proof_apply_context = [] && + p.Con.proof_conclude.Con.conclude_method = "Apply") + then + let pres_args = + make_args_for_apply term2pres p.Con.proof_conclude.Con.conclude_args + in + [B.H([], + (B.b_kw "by")::B.b_space:: + B.Text([],"(")::pres_args@[B.Text([],")")])], None + else + [B.H([],[B.b_kw "by"; B.b_space; B.b_kw "proof"])], + Some (B.b_toggle [B.b_kw "proof";B.indent (proof2pres true term2pres p)]) + +and proof2pres ?skip_initial_lambdas is_top_down term2pres p = + let rec proof2pres ?skip_initial_lambdas_internal is_top_down p in_bu_conversion = + let indent = + let is_decl e = + (match e with + `Declaration _ + | `Hypothesis _ -> true + | _ -> false) in + ((List.filter is_decl p.Con.proof_context) != []) in + let omit_conclusion = (not indent) && (p.Con.proof_context != []) in + let concl = + (match p.Con.proof_conclude.Con.conclude_conclusion with + None -> None + | Some t -> Some (term2pres t)) in + let body = + let presconclude = + conclude2pres + ?skip_initial_lambdas_internal: + (match skip_initial_lambdas_internal with + Some (`Later s) -> Some (`Now s) + | _ -> None) + is_top_down p.Con.proof_name p.Con.proof_conclude indent + omit_conclusion in_bu_conversion in + let presacontext = + acontext2pres + (if p.Con.proof_conclude.Con.conclude_method = "BU_Conversion" then + is_top_down + else + false) + p.Con.proof_apply_context + presconclude indent + (p.Con.proof_conclude.Con.conclude_method = "BU_Conversion") + in + context2pres + (match skip_initial_lambdas_internal with + Some (`Now n) -> snd (HExtlib.split_nth n p.Con.proof_context) + | _ -> p.Con.proof_context) + presacontext + in +(* +let body = B.V([],[B.b_kw ("(*<<" ^ p.Con.proof_conclude.Con.conclude_method ^ (if is_top_down then "(TD)" else "(NTD)") ^ "*)"); body; B.b_kw "(*>>*)"]) in +*) + match p.Con.proof_name with + None -> body + | Some name -> + let action = + match concl with + None -> body + | Some ac -> + let concl = + make_concl ~attrs:[ Some "helm", "xref", p.Con.proof_id ] + "proof of" ac in + B.b_toggle [ B.H ([], [concl; B.skip ; B.Text([],"("); + B.Object ([], P.Mi ([],name)); + B.Text([],")") ]) ; body ] + in + B.indent action + + and context2pres c continuation = + (* we generate a subtable for each context element, for selection + purposes + The table generated by the head-element does not have an xref; + the whole context-proof is already selectable *) + match c with + [] -> continuation + | hd::tl -> + let continuation' = + List.fold_right + (fun ce continuation -> + let xref = get_xref ce in + B.V([Some "helm", "xref", xref ], + [B.H([Some "helm", "xref", "ce_"^xref], + [ce2pres_in_proof_context_element ce]); + continuation])) tl continuation in + let hd_xref= get_xref hd in + B.V([], + [B.H([Some "helm", "xref", "ce_"^hd_xref], + [ce2pres_in_proof_context_element hd]); + continuation']) + + and ce2pres_in_joint_context_element = function + | `Inductive _ -> assert false (* TODO *) + | (`Declaration _) as x -> ce2pres x + | (`Hypothesis _) as x -> ce2pres x + | (`Proof _) as x -> ce2pres x + | (`Definition _) as x -> ce2pres x + + and ce2pres_in_proof_context_element = function + | `Joint ho -> + B.H ([],(List.map ce2pres_in_joint_context_element ho.Content.joint_defs)) + | (`Declaration _) as x -> ce2pres x + | (`Hypothesis _) as x -> ce2pres x + | (`Proof _) as x -> ce2pres x + | (`Definition _) as x -> ce2pres x + + and ce2pres = + function + `Declaration d -> + let ty = term2pres d.Con.dec_type in + B.H ([], + [(B.b_kw "assume"); + B.b_space; + B.Object ([], P.Mi([],get_name d.Con.dec_name)); + B.Text([],":"); + ty; + B.Text([],".")]) + | `Hypothesis h -> + let ty = term2pres h.Con.dec_type in + B.H ([], + [(B.b_kw "suppose"); + B.b_space; + ty; + B.b_space; + B.Text([],"("); + B.Object ([], P.Mi ([],get_name h.Con.dec_name)); + B.Text([],")"); + B.Text([],".")]) + | `Proof p -> + proof2pres false p false + | `Definition d -> + let term = term2pres d.Con.def_term in + B.H ([], + [ B.b_kw "let"; B.b_space; + B.Object ([], P.Mi([],get_name d.Con.def_name)); + B.Text([],Utf8Macro.unicode_of_tex "\\def"); + term]) + + and acontext2pres is_top_down ac continuation indent in_bu_conversion = + let rec aux = + function + [] -> continuation + | p::tl -> + let continuation = aux tl in + (* Applicative context get flattened and the "body" of a BU_Conversion + is put in the applicative context. Thus two different situations + are possible: + {method = "BU_Conversion"; applicative_context=[p1; ...; pn]} + {method = xxx; applicative_context = + [ p1; ...; pn; {method="BU_Conversion"} ; p_{n+1}; ... ; pm ]} + In both situations only pn must be processed in in_bu_conversion + mode + *) + let in_bu_conversion = + match tl with + [] -> in_bu_conversion + | p::_ -> p.Con.proof_conclude.Con.conclude_method = "BU_Conversion" + in + let hd = proof2pres is_top_down p in_bu_conversion in + let hd = if indent then B.indent hd else hd in + B.V([Some "helm","xref",p.Con.proof_id], + [B.H([Some "helm","xref","ace_"^p.Con.proof_id],[hd]); + continuation]) + in aux ac + + and conclude2pres ?skip_initial_lambdas_internal is_top_down name conclude indent omit_conclusion in_bu_conversion = + let tconclude_body = + match conclude.Con.conclude_conclusion with + Some t (*when not omit_conclusion or + (* CSC: I ignore the omit_conclusion flag in this case. *) + (* CSC: Is this the correct behaviour? In the stylesheets *) + (* CSC: we simply generated nothing (i.e. the output type *) + (* CSC: of the function should become an option. *) + conclude.Con.conclude_method = "BU_Conversion" *) -> + let concl = term2pres t in + if conclude.Con.conclude_method = "BU_Conversion" then + B.b_hv [] + (make_concl "that is equivalent to" concl :: + if is_top_down then [B.b_space ; B.b_kw "done"; + B.Text([],".")] else [B.Text([],".")]) + else if conclude.Con.conclude_method = "FalseInd" then + (* false ind is in charge to add the conclusion *) + falseind conclude + else + let prequel = + if + (not is_top_down) && + conclude.Con.conclude_method = "Intros+LetTac" + then + let name = get_name name in + [B.V ([], + [ B.H([], + let expected = + (match conclude.Con.conclude_conclusion with + None -> B.Text([],"NO EXPECTED!!!") + | Some c -> term2pres c) + in + [make_concl "we need to prove" expected; + B.skip; + B.Text([],"("); + B.Object ([], P.Mi ([],name)); + B.Text([],")"); + B.Text ([],".") + ])])] + else + [] in + let conclude_body = + conclude_aux ?skip_initial_lambdas_internal is_top_down conclude in + let ann_concl = + if conclude.Con.conclude_method = "Intros+LetTac" + || conclude.Con.conclude_method = "ByInduction" + || conclude.Con.conclude_method = "TD_Conversion" + || conclude.Con.conclude_method = "Eq_chain" + then + B.Text([],"") + else if omit_conclusion then + B.H([], [B.b_kw "done" ; B.Text([],".") ]) + else + B.b_hv [] + ((if not is_top_down || in_bu_conversion then + (make_concl "we proved" concl) :: + if not is_top_down then + let name = get_name ~default:"previous" name in + [B.b_space; B.Text([],"(" ^ name ^ ")")] + else [] + else [B.b_kw "done"] + ) @ if not in_bu_conversion then [B.Text([],".")] else []) + in + B.V ([], prequel @ [conclude_body; ann_concl]) + | _ -> conclude_aux ?skip_initial_lambdas_internal is_top_down conclude + in + if indent then + B.indent (B.H ([Some "helm", "xref", conclude.Con.conclude_id], + [tconclude_body])) + else + B.H ([Some "helm", "xref", conclude.Con.conclude_id],[tconclude_body]) + + and conclude_aux ?skip_initial_lambdas_internal is_top_down conclude = + if conclude.Con.conclude_method = "TD_Conversion" then + let expected = + (match conclude.Con.conclude_conclusion with + None -> B.Text([],"NO EXPECTED!!!") + | Some c -> term2pres c) in + let subproof = + (match conclude.Con.conclude_args with + [Con.ArgProof p] -> p + | _ -> assert false) in + let synth = + (match subproof.Con.proof_conclude.Con.conclude_conclusion with + None -> B.Text([],"NO SYNTH!!!") + | Some c -> (term2pres c)) in + B.V + ([], + [make_concl "we need to prove" expected; + B.H ([],[make_concl "or equivalently" synth; B.Text([],".")]); + proof2pres true subproof false]) + else if conclude.Con.conclude_method = "BU_Conversion" then + assert false + else if conclude.Con.conclude_method = "Exact" then + let arg = + (match conclude.Con.conclude_args with + [Con.Term (b,t)] -> assert (not b);term2pres t + | [Con.Premise p] -> + (match p.Con.premise_binder with + | None -> assert false; (* unnamed hypothesis ??? *) + | Some s -> B.Text([],s)) + | err -> assert false) in + (match conclude.Con.conclude_conclusion with + None -> + B.b_h [] [B.b_kw "by"; B.b_space; arg] + | Some c -> + B.b_h [] [B.b_kw "by"; B.b_space; arg] + ) + else if conclude.Con.conclude_method = "Intros+LetTac" then + (match conclude.Con.conclude_args with + [Con.ArgProof p] -> + (match conclude.Con.conclude_args with + [Con.ArgProof p] -> + proof2pres ?skip_initial_lambdas_internal true p false + | _ -> assert false) + | _ -> assert false) +(* OLD CODE + let conclusion = + (match conclude.Con.conclude_conclusion with + None -> B.Text([],"NO Conclusion!!!") + | Some c -> term2pres c) in + (match conclude.Con.conclude_args with + [Con.ArgProof p] -> + B.V + ([None,"align","baseline 1"; None,"equalrows","false"; + None,"columnalign","left"], + [B.H([],[B.Object([],proof2pres p false)]); + B.H([],[B.Object([], + (make_concl "we proved 1" conclusion))])]); + | _ -> assert false) +*) + else if (conclude.Con.conclude_method = "Case") then + case conclude + else if (conclude.Con.conclude_method = "ByInduction") then + byinduction conclude + else if (conclude.Con.conclude_method = "Exists") then + exists conclude + else if (conclude.Con.conclude_method = "AndInd") then + andind conclude + else if (conclude.Con.conclude_method = "FalseInd") then + falseind conclude + else if conclude.Con.conclude_method = "RewriteLR" + || conclude.Con.conclude_method = "RewriteRL" then + let justif1,justif2 = + (match (List.nth conclude.Con.conclude_args 6) with + Con.ArgProof p -> justification ~ignore_atoms:true term2pres p + | _ -> assert false) in + let justif = + match justif2 with + None -> justif1 + | Some j -> [j] + in + let index_term1, index_term2 = + if conclude.Con.conclude_method = "RewriteLR" then 2,5 else 5,2 + in + let term1 = + (match List.nth conclude.Con.conclude_args index_term1 with + Con.Term (_,t) -> term2pres t + | _ -> assert false) in + let term2 = + (match List.nth conclude.Con.conclude_args index_term2 with + Con.Term (_,t) -> term2pres t + | _ -> assert false) in + let justif = + match justif with + [] -> [] + | _ -> + justif @ + [B.V([], + [B.b_kw "we proved (" ; + term1 ; + B.b_kw "=" ; + term2; B.b_kw ") (equality)."])] + in +(* + B.V ([], + B.H ([],[ + (B.b_kw "rewrite"); + B.b_space; term1; + B.b_space; (B.b_kw "with"); + B.b_space; term2; + B.b_space; justif1]):: + match justif2 with None -> [] | Some j -> [B.indent j]) +*) + B.V([], justif @ [B.b_kw "by _"]) + else if conclude.Con.conclude_method = "Eq_chain" then + let justification p = + let j1,j2 = justification ~ignore_atoms:false term2pres p in + j1, match j2 with Some j -> [j] | None -> [] + in + let rec aux args = + match args with + | [] -> [] + | (Con.ArgProof p)::(Con.Term (_,t))::tl -> + let justif1,justif2 = justification p in + B.HOV(RenderingAttrs.indent_attributes `BoxML,([B.b_kw + "=";B.b_space;term2pres t;B.b_space]@justif1@ + (if tl <> [] then [B.Text ([],".")] else [B.b_space; B.b_kw "done" ; B.Text([],".")])@ + justif2))::(aux tl) + | _ -> assert false + in + let hd = + match List.hd conclude.Con.conclude_args with + | Con.Term (_,t) -> t + | _ -> assert false + in + if is_top_down then + B.HOV([], + [B.b_kw "conclude";B.b_space;term2pres hd; + B.V ([],aux (List.tl conclude.Con.conclude_args))]) + else + B.HOV([], + [B.b_kw "obtain";B.b_space;B.b_kw "FIXMEXX"; B.b_space;term2pres hd; + B.V ([],aux (List.tl conclude.Con.conclude_args))]) + else if conclude.Con.conclude_method = "Apply" then + let pres_args = + make_args_for_apply term2pres conclude.Con.conclude_args in + B.H([], + (B.b_kw "by"):: + B.b_space:: + B.Text([],"(")::pres_args@[B.Text([],")")]) + else + B.V ([], [ + B.b_kw ("Apply method" ^ conclude.Con.conclude_method ^ " to"); + (B.indent (B.V ([], args2pres conclude.Con.conclude_args)))]) + + and args2pres l = List.map arg2pres l + + and arg2pres = + function + Con.Aux n -> B.b_kw ("aux " ^ n) + | Con.Premise prem -> B.b_kw "premise" + | Con.Lemma lemma -> B.b_kw "lemma" + | Con.Term (_,t) -> term2pres t + | Con.ArgProof p -> proof2pres true p false + | Con.ArgMethod s -> B.b_kw "method" + + and case conclude = + let proof_conclusion = + (match conclude.Con.conclude_conclusion with + None -> B.b_kw "No conclusion???" + | Some t -> term2pres t) in + let arg,args_for_cases = + (match conclude.Con.conclude_args with + Con.Aux(_)::Con.Aux(_)::Con.Term(_)::arg::tl -> + arg,tl + | _ -> assert false) in + let case_on = + let case_arg = + (match arg with + Con.Aux n -> B.b_kw "an aux???" + | Con.Premise prem -> + (match prem.Con.premise_binder with + None -> B.b_kw "previous" + | Some n -> B.Object ([], P.Mi([],n))) + | Con.Lemma lemma -> B.Object ([], P.Mi([],lemma.Con.lemma_name)) + | Con.Term (_,t) -> + term2pres t + | Con.ArgProof p -> B.b_kw "a proof???" + | Con.ArgMethod s -> B.b_kw "a method???") + in + (make_concl "we proceed by cases on" case_arg) in + let to_prove = + (make_concl "to prove" proof_conclusion) in + B.V ([], case_on::to_prove::(make_cases args_for_cases)) + + and byinduction conclude = + let proof_conclusion = + (match conclude.Con.conclude_conclusion with + None -> B.b_kw "No conclusion???" + | Some t -> term2pres t) in + let inductive_arg,args_for_cases = + (match conclude.Con.conclude_args with + Con.Aux(n)::_::tl -> + let l1,l2 = split (int_of_string n) tl in + let last_pos = (List.length l2)-1 in + List.nth l2 last_pos,l1 + | _ -> assert false) in + let induction_on = + let arg = + (match inductive_arg with + Con.Aux n -> B.b_kw "an aux???" + | Con.Premise prem -> + (match prem.Con.premise_binder with + None -> B.b_kw "previous" + | Some n -> B.Object ([], P.Mi([],n))) + | Con.Lemma lemma -> B.Object ([], P.Mi([],lemma.Con.lemma_name)) + | Con.Term (_,t) -> + term2pres t + | Con.ArgProof p -> B.b_kw "a proof???" + | Con.ArgMethod s -> B.b_kw "a method???") in + (make_concl "we proceed by induction on" arg) in + let to_prove = + B.H ([], [make_concl "to prove" proof_conclusion ; B.Text([],".")]) in + B.V ([], induction_on::to_prove::(make_cases args_for_cases)) + + and make_cases l = List.map make_case l + + and make_case = + function + Con.ArgProof p -> + let name = + (match p.Con.proof_name with + None -> B.b_kw "no name for case!!" + | Some n -> B.Object ([], P.Mi([],n))) in + let indhyps,args = + List.partition + (function + `Hypothesis h -> h.Con.dec_inductive + | _ -> false) p.Con.proof_context in + let pattern_aux = + List.fold_right + (fun e p -> + let dec = + (match e with + `Declaration h + | `Hypothesis h -> + let name = get_name h.Con.dec_name in + [B.b_space; + B.Text([],"("); + B.Object ([], P.Mi ([],name)); + B.Text([],":"); + (term2pres h.Con.dec_type); + B.Text([],")")] + | _ -> assert false (*[B.Text ([],"???")]*)) in + dec@p) args [] in + let pattern = + B.H ([], + (B.b_kw "case"::B.b_space::name::pattern_aux)@ + [B.b_space; + B.Text([], ".")]) in + let subconcl = + (match p.Con.proof_conclude.Con.conclude_conclusion with + None -> B.b_kw "No conclusion!!!" + | Some t -> term2pres t) in + let asubconcl = B.indent (make_concl "the thesis becomes" subconcl) in + let induction_hypothesis = + (match indhyps with + [] -> [] + | _ -> + let text = B.indent (B.b_kw "by induction hypothesis we know") in + let make_hyp = + function + `Hypothesis h -> + let name = + (match h.Con.dec_name with + None -> "useless" + | Some s -> s) in + B.indent (B.H ([], + [term2pres h.Con.dec_type; + B.b_space; + B.Text([],"("); + B.Object ([], P.Mi ([],name)); + B.Text([],")"); + B.Text([],".")])) + | _ -> assert false in + let hyps = List.map make_hyp indhyps in + text::hyps) in + let body = + conclude2pres true p.Con.proof_name p.Con.proof_conclude true true false in + let presacontext = + let acontext_id = + match p.Con.proof_apply_context with + [] -> p.Con.proof_conclude.Con.conclude_id + | {Con.proof_id = id}::_ -> id + in + B.Action([None,"type","toggle"], + [ B.indent (add_xref acontext_id (B.b_kw "Proof")); + acontext2pres + (p.Con.proof_conclude.Con.conclude_method = "BU_Conversion") + p.Con.proof_apply_context body true + (p.Con.proof_conclude.Con.conclude_method = "BU_Conversion") + ]) in + B.V ([], pattern::induction_hypothesis@[B.H ([],[asubconcl;B.Text([],".")]);presacontext]) + | _ -> assert false + + and falseind conclude = + let proof_conclusion = + (match conclude.Con.conclude_conclusion with + None -> B.b_kw "No conclusion???" + | Some t -> term2pres t) in + let case_arg = + (match conclude.Con.conclude_args with + [Con.Aux(n);_;case_arg] -> case_arg + | _ -> assert false; + (* + List.map (ContentPp.parg 0) conclude.Con.conclude_args; + assert false *)) in + let arg = + (match case_arg with + Con.Aux n -> assert false + | Con.Premise prem -> + (match prem.Con.premise_binder with + None -> [B.b_kw "Contradiction, hence"] + | Some n -> + [ B.Object ([],P.Mi([],n)); B.skip; + B.b_kw "is contradictory, hence"]) + | Con.Lemma lemma -> + [ B.Object ([], P.Mi([],lemma.Con.lemma_name)); B.skip; + B.b_kw "is contradictory, hence" ] + | _ -> assert false) in + make_row arg proof_conclusion + + and andind conclude = + let proof,case_arg = + (match conclude.Con.conclude_args with + [Con.Aux(n);_;Con.ArgProof proof;case_arg] -> proof,case_arg + | _ -> assert false; + (* + List.map (ContentPp.parg 0) conclude.Con.conclude_args; + assert false *)) in + let arg = + (match case_arg with + Con.Aux n -> assert false + | Con.Premise prem -> + (match prem.Con.premise_binder with + None -> [] + | Some n -> [(B.b_kw "by"); B.b_space; B.Object([], P.Mi([],n))]) + | Con.Lemma lemma -> + [(B.b_kw "by");B.skip; + B.Object([], P.Mi([],lemma.Con.lemma_name))] + | _ -> assert false) in + match proof.Con.proof_context with + `Hypothesis hyp1::`Hypothesis hyp2::tl -> + let preshyp1 = + B.H ([], + [B.Text([],"("); + B.Object ([], P.Mi([],get_name hyp1.Con.dec_name)); + B.Text([],")"); + B.skip; + term2pres hyp1.Con.dec_type]) in + let preshyp2 = + B.H ([], + [B.Text([],"("); + B.Object ([], P.Mi([],get_name hyp2.Con.dec_name)); + B.Text([],")"); + B.skip; + term2pres hyp2.Con.dec_type]) in + let body = + conclude2pres false proof.Con.proof_name proof.Con.proof_conclude + false true false in + let presacontext = + acontext2pres false proof.Con.proof_apply_context body false false + in + B.V + ([], + [B.H ([],arg@[B.skip; B.b_kw "we have"]); + preshyp1; + B.b_kw "and"; + preshyp2; + presacontext]); + | _ -> assert false + + and exists conclude = + let proof = + (match conclude.Con.conclude_args with + [Con.Aux(n);_;Con.ArgProof proof;_] -> proof + | _ -> assert false; + (* + List.map (ContentPp.parg 0) conclude.Con.conclude_args; + assert false *)) in + match proof.Con.proof_context with + `Declaration decl::`Hypothesis hyp::tl + | `Hypothesis decl::`Hypothesis hyp::tl -> + let presdecl = + B.H ([], + [(B.b_kw "let"); + B.skip; + B.Object ([], P.Mi([],get_name decl.Con.dec_name)); + B.Text([],":"); term2pres decl.Con.dec_type]) in + let suchthat = + B.H ([], + [(B.b_kw "such that"); + B.skip; + B.Text([],"("); + B.Object ([], P.Mi([],get_name hyp.Con.dec_name)); + B.Text([],")"); + B.skip; + term2pres hyp.Con.dec_type]) in + let body = + conclude2pres false proof.Con.proof_name proof.Con.proof_conclude + false true false in + let presacontext = + acontext2pres false proof.Con.proof_apply_context body false false + in + B.V + ([], + [presdecl; + suchthat; + presacontext]); + | _ -> assert false + + in + proof2pres + ?skip_initial_lambdas_internal: + (match skip_initial_lambdas with + None -> Some (`Later 0) (* we already printed theorem: *) + | Some n -> Some (`Later n)) + is_top_down p false + +exception ToDo + +let counter = ref 0 + +let conjecture2pres term2pres (id, n, context, ty) = + B.b_indent + (B.b_hv [Some "helm", "xref", id] + ((B.b_toggle [ + B.b_h [] [B.b_text [] "{...}"; B.b_space]; + B.b_hv [] (List.map + (function + | None -> + B.b_h [] + [ B.b_object (p_mi [] "_") ; + B.b_object (p_mo [] ":?") ; + B.b_object (p_mi [] "_")] + | Some (`Declaration d) + | Some (`Hypothesis d) -> + let { Content.dec_name = + dec_name ; Content.dec_type = ty } = d + in + B.b_h [] + [ B.b_object + (p_mi [] + (match dec_name with + None -> "_" + | Some n -> n)); + B.b_text [] ":"; + term2pres ty ] + | Some (`Definition d) -> + let + { Content.def_name = def_name ; + Content.def_term = bo } = d + in + B.b_h [] + [ B.b_object (p_mi [] + (match def_name with + None -> "_" + | Some n -> n)) ; + B.b_text [] (Utf8Macro.unicode_of_tex "\\Assign"); + term2pres bo] + | Some (`Proof p) -> + let proof_name = p.Content.proof_name in + B.b_h [] + [ B.b_object (p_mi [] + (match proof_name with + None -> "_" + | Some n -> n)) ; + B.b_text [] (Utf8Macro.unicode_of_tex "\\Assign"); + proof2pres true term2pres p]) + (List.rev context)) ] :: + [ B.b_h [] + [ B.b_text [] (Utf8Macro.unicode_of_tex "\\vdash"); + B.b_object (p_mi [] (string_of_int n)) ; + B.b_text [] ":" ; + term2pres ty ]]))) + +let metasenv2pres term2pres = function + | None -> [] + | Some metasenv' -> + (* Conjectures are in their own table to make *) + (* diffing the DOM trees easier. *) + [B.b_v [] + ((B.b_kw ("Conjectures:" ^ + (let _ = incr counter; in (string_of_int !counter)))) :: + (List.map (conjecture2pres term2pres) metasenv'))] + +let params2pres params = + let param2pres uri = + B.b_text [Some "xlink", "href", UriManager.string_of_uri uri] + (UriManager.name_of_uri uri) + in + let rec spatiate = function + | [] -> [] + | hd :: [] -> [hd] + | hd :: tl -> hd :: B.b_text [] ", " :: spatiate tl + in + match params with + | [] -> [] + | p -> + let params = spatiate (List.map param2pres p) in + [B.b_space; + B.b_h [] (B.b_text [] "[" :: params @ [ B.b_text [] "]" ])] + +let recursion_kind2pres params kind = + let kind = + match kind with + | `Recursive _ -> "Recursive definition" + | `CoRecursive -> "CoRecursive definition" + | `Inductive _ -> "Inductive definition" + | `CoInductive _ -> "CoInductive definition" + in + B.b_h [] (B.b_kw kind :: params2pres params) + +let inductive2pres term2pres ind = + let constructor2pres decl = + B.b_h [] [ + B.b_text [] ("| " ^ get_name decl.Content.dec_name ^ ":"); + B.b_space; + term2pres decl.Content.dec_type + ] + in + B.b_v [] + (B.b_h [] [ + B.b_kw (ind.Content.inductive_name ^ " of arity"); + B.smallskip; + term2pres ind.Content.inductive_type ] + :: List.map constructor2pres ind.Content.inductive_constructors) + +let joint_def2pres term2pres def = + match def with + | `Inductive ind -> inductive2pres term2pres ind + | _ -> assert false (* ZACK or raise ToDo? *) + +let content2pres + ?skip_initial_lambdas ?(skip_thm_and_qed=false) term2pres + (id,params,metasenv,obj) += + match obj with + | `Def (Content.Const, thesis, `Proof p) -> + let name = get_name p.Content.proof_name in + let proof = proof2pres true term2pres ?skip_initial_lambdas p in + if skip_thm_and_qed then + proof + else + B.b_v + [Some "helm","xref","id"] + ([ B.b_h [] (B.b_kw ("theorem " ^ name) :: + params2pres params @ [B.b_kw ":"]); + B.H ([],[B.indent (term2pres thesis) ; B.b_kw "." ])] @ + metasenv2pres term2pres metasenv @ + [proof ; B.b_kw "qed."]) + | `Def (_, ty, `Definition body) -> + let name = get_name body.Content.def_name in + B.b_v + [Some "helm","xref","id"] + ([B.b_h [] + (B.b_kw ("definition " ^ name) :: params2pres params @ [B.b_kw ":"]); + B.indent (term2pres ty)] @ + metasenv2pres term2pres metasenv @ + [B.b_kw ":="; + B.indent (term2pres body.Content.def_term); + B.b_kw "."]) + | `Decl (_, `Declaration decl) + | `Decl (_, `Hypothesis decl) -> + let name = get_name decl.Content.dec_name in + B.b_v + [Some "helm","xref","id"] + ([B.b_h [] (B.b_kw ("Axiom " ^ name) :: params2pres params); + B.b_kw "Type:"; + B.indent (term2pres decl.Content.dec_type)] @ + metasenv2pres term2pres metasenv) + | `Joint joint -> + B.b_v [] + (recursion_kind2pres params joint.Content.joint_kind + :: List.map (joint_def2pres term2pres) joint.Content.joint_defs) + | _ -> raise ToDo + +let content2pres + ?skip_initial_lambdas ?skip_thm_and_qed ~ids_to_inner_sorts += + content2pres ?skip_initial_lambdas ?skip_thm_and_qed + (fun ?(prec=90) annterm -> + let ast, ids_to_uris = + TermAcicContent.ast_of_acic ~output_type:`Term ids_to_inner_sorts annterm + in + CicNotationPres.box_of_mpres + (CicNotationPres.render ids_to_uris ~prec + (TermContentPres.pp_ast ast))) diff --git a/components/content_pres/content2pres.mli b/components/content_pres/content2pres.mli new file mode 100644 index 000000000..8d3753d86 --- /dev/null +++ b/components/content_pres/content2pres.mli @@ -0,0 +1,40 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(**************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 27/6/2003 *) +(* *) +(**************************************************************************) + +val content2pres: + ?skip_initial_lambdas:int -> ?skip_thm_and_qed:bool -> + ids_to_inner_sorts:(Cic.id, Cic2acic.sort_kind) Hashtbl.t -> + Cic.annterm Content.cobj -> + CicNotationPres.boxml_markup + diff --git a/components/content_pres/content2presMatcher.ml b/components/content_pres/content2presMatcher.ml new file mode 100644 index 000000000..7e080ea69 --- /dev/null +++ b/components/content_pres/content2presMatcher.ml @@ -0,0 +1,233 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +module Ast = CicNotationPt +module Env = CicNotationEnv +module Pp = CicNotationPp +module Util = CicNotationUtil + +let get_tag term0 = + let subterms = ref [] in + let map_term t = + subterms := t :: !subterms ; + Ast.Implicit + in + let rec aux t = CicNotationUtil.visit_ast ~special_k map_term t + and special_k = function + | Ast.AttributedTerm (_, t) -> aux t + | _ -> assert false + in + let term_mask = aux term0 in + let tag = Hashtbl.hash term_mask in + tag, List.rev !subterms + +module Matcher21 = +struct + module Pattern21 = + struct + type pattern_t = Ast.term + type term_t = Ast.term + let rec classify = function + | Ast.AttributedTerm (_, t) -> classify t + | Ast.Variable _ -> PatternMatcher.Variable + | Ast.Magic _ + | Ast.Layout _ + | Ast.Literal _ -> assert false + | _ -> PatternMatcher.Constructor + let tag_of_pattern = get_tag + let tag_of_term t = get_tag t + let string_of_term = CicNotationPp.pp_term + let string_of_pattern = CicNotationPp.pp_term + end + + module M = PatternMatcher.Matcher (Pattern21) + + let extract_magic term = + let magic_map = ref [] in + let add_magic m = + let name = Util.fresh_name () in + magic_map := (name, m) :: !magic_map; + Ast.Variable (Ast.TermVar name) + in + let rec aux = function + | Ast.AttributedTerm (_, t) -> assert false + | Ast.Literal _ + | Ast.Layout _ -> assert false + | Ast.Variable v -> Ast.Variable v + | Ast.Magic m -> add_magic m + | t -> Util.visit_ast aux t + in + let term' = aux term in + term', !magic_map + + let env_of_matched pl tl = + try + List.map2 + (fun p t -> + match p, t with + Ast.Variable (Ast.TermVar name), _ -> + name, (Env.TermType, Env.TermValue t) + | Ast.Variable (Ast.NumVar name), (Ast.Num (s, _)) -> + name, (Env.NumType, Env.NumValue s) + | Ast.Variable (Ast.IdentVar name), (Ast.Ident (s, None)) -> + name, (Env.StringType, Env.StringValue s) + | _ -> assert false) + pl tl + with Invalid_argument _ -> assert false + + let rec compiler rows = + let rows', magic_maps = + List.split + (List.map + (fun (p, pid) -> + let p', map = extract_magic p in + (p', pid), (pid, map)) + rows) + in + let magichecker map = + List.fold_left + (fun f (name, m) -> + let m_checker = compile_magic m in + (fun env ctors -> + match m_checker (Env.lookup_term env name) env ctors with + | None -> None + | Some (env, ctors) -> f env ctors)) + (fun env ctors -> Some (env, ctors)) + map + in + let magichooser candidates = + List.fold_left + (fun f (pid, pl, checker) -> + (fun matched_terms constructors -> + let env = env_of_matched pl matched_terms in + match checker env constructors with + | None -> f matched_terms constructors + | Some (env, ctors') -> + let magic_map = + try List.assoc pid magic_maps with Not_found -> assert false + in + let env' = Env.remove_names env (List.map fst magic_map) in + Some (env', ctors', pid))) + (fun _ _ -> None) + (List.rev candidates) + in + let match_cb rows = + let candidates = + List.map + (fun (pl, pid) -> + let magic_map = + try List.assoc pid magic_maps with Not_found -> assert false + in + pid, pl, magichecker magic_map) + rows + in + magichooser candidates + in + M.compiler rows' match_cb (fun _ -> None) + + and compile_magic = function + | Ast.Fold (kind, p_base, names, p_rec) -> + let p_rec_decls = Env.declarations_of_term p_rec in + (* LUCA: p_rec_decls should not contain "names" *) + let acc_name = try List.hd names with Failure _ -> assert false in + let compiled_base = compiler [p_base, 0] + and compiled_rec = compiler [p_rec, 0] in + (fun term env ctors -> + let aux_base term = + match compiled_base term with + | None -> None + | Some (env', ctors', _) -> Some (env', ctors', []) + in + let rec aux term = + match compiled_rec term with + | None -> aux_base term + | Some (env', ctors', _) -> + begin + let acc = Env.lookup_term env' acc_name in + let env'' = Env.remove_name env' acc_name in + match aux acc with + | None -> aux_base term + | Some (base_env, ctors', rec_envl) -> + let ctors'' = ctors' @ ctors in + Some (base_env, ctors'',env'' :: rec_envl) + end + in + match aux term with + | None -> None + | Some (base_env, ctors, rec_envl) -> + let env' = + base_env @ Env.coalesce_env p_rec_decls rec_envl @ env + (* @ env LUCA!!! *) + in + Some (env', ctors)) + + | Ast.Default (p_some, p_none) -> (* p_none can't bound names *) + let p_some_decls = Env.declarations_of_term p_some in + let p_none_decls = Env.declarations_of_term p_none in + let p_opt_decls = + List.filter + (fun decl -> not (List.mem decl p_none_decls)) + p_some_decls + in + let none_env = List.map Env.opt_binding_of_name p_opt_decls in + let compiled = compiler [p_some, 0] in + (fun term env ctors -> + match compiled term with + | None -> Some (none_env, ctors) (* LUCA: @ env ??? *) + | Some (env', ctors', 0) -> + let env' = + List.map + (fun (name, (ty, v)) as binding -> + if List.exists (fun (name', _) -> name = name') p_opt_decls + then Env.opt_binding_some binding + else binding) + env' + in + Some (env' @ env, ctors' @ ctors) + | _ -> assert false) + + | Ast.If (p_test, p_true, p_false) -> + let compiled_test = compiler [p_test, 0] + and compiled_true = compiler [p_true, 0] + and compiled_false = compiler [p_false, 0] in + (fun term env ctors -> + let branch = + match compiled_test term with + | None -> compiled_false + | Some _ -> compiled_true + in + match branch term with + | None -> None + | Some (env', ctors', _) -> Some (env' @ env, ctors' @ ctors)) + + | Ast.Fail -> (fun _ _ _ -> None) + + | _ -> assert false +end + diff --git a/components/content_pres/content2presMatcher.mli b/components/content_pres/content2presMatcher.mli new file mode 100644 index 000000000..86b97b6d8 --- /dev/null +++ b/components/content_pres/content2presMatcher.mli @@ -0,0 +1,34 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +module Matcher21: +sig + (** @param l2_patterns level 2 (AST) patterns *) + val compiler : + (CicNotationPt.term * int) list -> + (CicNotationPt.term -> + (CicNotationEnv.t * CicNotationPt.term list * int) option) +end + diff --git a/components/content_pres/mpresentation.ml b/components/content_pres/mpresentation.ml new file mode 100644 index 000000000..1aa5db129 --- /dev/null +++ b/components/content_pres/mpresentation.ml @@ -0,0 +1,258 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(**************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 16/62003 *) +(* *) +(**************************************************************************) + +(* $Id$ *) + +type 'a mpres = + Mi of attr * string + | Mn of attr * string + | Mo of attr * string + | Mtext of attr * string + | Mspace of attr + | Ms of attr * string + | Mgliph of attr * string + | Mrow of attr * 'a mpres list + | Mfrac of attr * 'a mpres * 'a mpres + | Msqrt of attr * 'a mpres + | Mroot of attr * 'a mpres * 'a mpres + | Mstyle of attr * 'a mpres + | Merror of attr * 'a mpres + | Mpadded of attr * 'a mpres + | Mphantom of attr * 'a mpres + | Mfenced of attr * 'a mpres list + | Menclose of attr * 'a mpres + | Msub of attr * 'a mpres * 'a mpres + | Msup of attr * 'a mpres * 'a mpres + | Msubsup of attr * 'a mpres * 'a mpres *'a mpres + | Munder of attr * 'a mpres * 'a mpres + | Mover of attr * 'a mpres * 'a mpres + | Munderover of attr * 'a mpres * 'a mpres *'a mpres +(* | Multiscripts of ??? NOT IMPLEMEMENTED *) + | Mtable of attr * 'a row list + | Maction of attr * 'a mpres list + | Mobject of attr * 'a +and 'a row = Mtr of attr * 'a mtd list +and 'a mtd = Mtd of attr * 'a mpres +and attr = (string option * string * string) list +;; + +let smallskip = Mspace([None,"width","0.5em"]);; +let indentation = Mspace([None,"width","1em"]);; + +let indented elem = + Mrow([],[indentation;elem]);; + +let standard_tbl_attr = + [None,"align","baseline 1";None,"equalrows","false";None,"columnalign","left"] +;; + +let two_rows_table attr a b = + Mtable(attr@standard_tbl_attr, + [Mtr([],[Mtd([],a)]); + Mtr([],[Mtd([],b)])]);; + +let two_rows_table_with_brackets attr a b op = + (* only the open bracket is added; the closed bracket must be in b *) + Mtable(attr@standard_tbl_attr, + [Mtr([],[Mtd([],Mrow([],[Mtext([],"(");a]))]); + Mtr([],[Mtd([],Mrow([],[indentation;op;b]))])]);; + +let two_rows_table_without_brackets attr a b op = + Mtable(attr@standard_tbl_attr, + [Mtr([],[Mtd([],a)]); + Mtr([],[Mtd([],Mrow([],[indentation;op;b]))])]);; + +let row_with_brackets attr a b op = + (* by analogy with two_rows_table_with_brackets we only add the + open brackets *) + Mrow(attr,[Mtext([],"(");a;op;b;Mtext([],")")]) + +let row_without_brackets attr a b op = + Mrow(attr,[a;op;b]) + +(* MathML prefix *) +let prefix = "m";; + +let print_mpres obj_printer mpres = + let module X = Xml in + let rec aux = + function + Mi (attr,s) -> X.xml_nempty ~prefix "mi" attr (X.xml_cdata s) + | Mn (attr,s) -> X.xml_nempty ~prefix "mn" attr (X.xml_cdata s) + | Mo (attr,s) -> + let s = + let len = String.length s in + if len > 1 && s.[0] = '\\' + then String.sub s 1 (len - 1) + else s + in + X.xml_nempty ~prefix "mo" attr (X.xml_cdata s) + | Mtext (attr,s) -> X.xml_nempty ~prefix "mtext" attr (X.xml_cdata s) + | Mspace attr -> X.xml_empty ~prefix "mspace" attr + | Ms (attr,s) -> X.xml_nempty ~prefix "ms" attr (X.xml_cdata s) + | Mgliph (attr,s) -> X.xml_nempty ~prefix "mgliph" attr (X.xml_cdata s) + (* General Layout Schemata *) + | Mrow (attr,l) -> + X.xml_nempty ~prefix "mrow" attr + [< (List.fold_right (fun x i -> [< (aux x) ; i >]) l [<>]) + >] + | Mfrac (attr,m1,m2) -> + X.xml_nempty ~prefix "mfrac" attr [< aux m1; aux m2 >] + | Msqrt (attr,m) -> + X.xml_nempty ~prefix "msqrt" attr [< aux m >] + | Mroot (attr,m1,m2) -> + X.xml_nempty ~prefix "mroot" attr [< aux m1; aux m2 >] + | Mstyle (attr,m) -> X.xml_nempty ~prefix "mstyle" attr [< aux m >] + | Merror (attr,m) -> X.xml_nempty ~prefix "merror" attr [< aux m >] + | Mpadded (attr,m) -> X.xml_nempty ~prefix "mpadded" attr [< aux m >] + | Mphantom (attr,m) -> X.xml_nempty ~prefix "mphantom" attr [< aux m >] + | Mfenced (attr,l) -> + X.xml_nempty ~prefix "mfenced" attr + [< (List.fold_right (fun x i -> [< (aux x) ; i >]) l [<>]) + >] + | Menclose (attr,m) -> X.xml_nempty ~prefix "menclose" attr [< aux m >] + (* Script and Limit Schemata *) + | Msub (attr,m1,m2) -> + X.xml_nempty ~prefix "msub" attr [< aux m1; aux m2 >] + | Msup (attr,m1,m2) -> + X.xml_nempty ~prefix "msup" attr [< aux m1; aux m2 >] + | Msubsup (attr,m1,m2,m3) -> + X.xml_nempty ~prefix "msubsup" attr [< aux m1; aux m2; aux m3 >] + | Munder (attr,m1,m2) -> + X.xml_nempty ~prefix "munder" attr [< aux m1; aux m2 >] + | Mover (attr,m1,m2) -> + X.xml_nempty ~prefix "mover" attr [< aux m1; aux m2 >] + | Munderover (attr,m1,m2,m3) -> + X.xml_nempty ~prefix "munderover" attr [< aux m1; aux m2; aux m3 >] + (* | Multiscripts of ??? NOT IMPLEMEMENTED *) + (* Tables and Matrices *) + | Mtable (attr, rl) -> + X.xml_nempty ~prefix "mtable" attr + [< (List.fold_right (fun x i -> [< (aux_mrow x) ; i >]) rl [<>]) >] + (* Enlivening Expressions *) + | Maction (attr, l) -> + X.xml_nempty ~prefix "maction" attr + [< (List.fold_right (fun x i -> [< (aux x) ; i >]) l [<>]) >] + | Mobject (attr, obj) -> + let box_stream = obj_printer obj in + X.xml_nempty ~prefix "semantics" attr + [< X.xml_nempty ~prefix "annotation-xml" [None, "encoding", "BoxML"] + box_stream >] + + and aux_mrow = + let module X = Xml in + function + Mtr (attr, l) -> + X.xml_nempty ~prefix "mtr" attr + [< (List.fold_right (fun x i -> [< (aux_mtd x) ; i >]) l [<>]) + >] + and aux_mtd = + let module X = Xml in + function + Mtd (attr,m) -> X.xml_nempty ~prefix "mtd" attr + [< (aux m) ; + X.xml_nempty ~prefix "mphantom" [] + (X.xml_nempty ~prefix "mtext" [] (X.xml_cdata "(")) >] + in + aux mpres +;; + +let document_of_mpres pres = + [< Xml.xml_cdata "\n" ; + Xml.xml_cdata "\n"; + Xml.xml_nempty ~prefix "math" + [Some "xmlns","m","http://www.w3.org/1998/Math/MathML" ; + Some "xmlns","helm","http://www.cs.unibo.it/helm" ; + Some "xmlns","xlink","http://www.w3.org/1999/xlink" + ] (Xml.xml_nempty ~prefix "mstyle" [None, "mathvariant", "normal"; None, + "rowspacing", "0.6ex"] (print_mpres (fun _ -> assert false) pres)) + >] + +let get_attr = function + | Maction (attr, _) + | Menclose (attr, _) + | Merror (attr, _) + | Mfenced (attr, _) + | Mfrac (attr, _, _) + | Mgliph (attr, _) + | Mi (attr, _) + | Mn (attr, _) + | Mo (attr, _) + | Mobject (attr, _) + | Mover (attr, _, _) + | Mpadded (attr, _) + | Mphantom (attr, _) + | Mroot (attr, _, _) + | Mrow (attr, _) + | Ms (attr, _) + | Mspace attr + | Msqrt (attr, _) + | Mstyle (attr, _) + | Msub (attr, _, _) + | Msubsup (attr, _, _, _) + | Msup (attr, _, _) + | Mtable (attr, _) + | Mtext (attr, _) + | Munder (attr, _, _) + | Munderover (attr, _, _, _) -> + attr + +let set_attr attr = function + | Maction (_, x) -> Maction (attr, x) + | Menclose (_, x) -> Menclose (attr, x) + | Merror (_, x) -> Merror (attr, x) + | Mfenced (_, x) -> Mfenced (attr, x) + | Mfrac (_, x, y) -> Mfrac (attr, x, y) + | Mgliph (_, x) -> Mgliph (attr, x) + | Mi (_, x) -> Mi (attr, x) + | Mn (_, x) -> Mn (attr, x) + | Mo (_, x) -> Mo (attr, x) + | Mobject (_, x) -> Mobject (attr, x) + | Mover (_, x, y) -> Mover (attr, x, y) + | Mpadded (_, x) -> Mpadded (attr, x) + | Mphantom (_, x) -> Mphantom (attr, x) + | Mroot (_, x, y) -> Mroot (attr, x, y) + | Mrow (_, x) -> Mrow (attr, x) + | Ms (_, x) -> Ms (attr, x) + | Mspace _ -> Mspace attr + | Msqrt (_, x) -> Msqrt (attr, x) + | Mstyle (_, x) -> Mstyle (attr, x) + | Msub (_, x, y) -> Msub (attr, x, y) + | Msubsup (_, x, y, z) -> Msubsup (attr, x, y, z) + | Msup (_, x, y) -> Msup (attr, x, y) + | Mtable (_, x) -> Mtable (attr, x) + | Mtext (_, x) -> Mtext (attr, x) + | Munder (_, x, y) -> Munder (attr, x, y) + | Munderover (_, x, y, z) -> Munderover (attr, x, y, z) + diff --git a/components/content_pres/mpresentation.mli b/components/content_pres/mpresentation.mli new file mode 100644 index 000000000..8252517a6 --- /dev/null +++ b/components/content_pres/mpresentation.mli @@ -0,0 +1,86 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type 'a mpres = + (* token elements *) + Mi of attr * string + | Mn of attr * string + | Mo of attr * string + | Mtext of attr * string + | Mspace of attr + | Ms of attr * string + | Mgliph of attr * string + (* General Layout Schemata *) + | Mrow of attr * 'a mpres list + | Mfrac of attr * 'a mpres * 'a mpres + | Msqrt of attr * 'a mpres + | Mroot of attr * 'a mpres * 'a mpres + | Mstyle of attr * 'a mpres + | Merror of attr * 'a mpres + | Mpadded of attr * 'a mpres + | Mphantom of attr * 'a mpres + | Mfenced of attr * 'a mpres list + | Menclose of attr * 'a mpres + (* Script and Limit Schemata *) + | Msub of attr * 'a mpres * 'a mpres + | Msup of attr * 'a mpres * 'a mpres + | Msubsup of attr * 'a mpres * 'a mpres *'a mpres + | Munder of attr * 'a mpres * 'a mpres + | Mover of attr * 'a mpres * 'a mpres + | Munderover of attr * 'a mpres * 'a mpres *'a mpres + (* Tables and Matrices *) + | Mtable of attr * 'a row list + (* Enlivening Expressions *) + | Maction of attr * 'a mpres list + (* Embedding *) + | Mobject of attr * 'a + +and 'a row = Mtr of attr * 'a mtd list + +and 'a mtd = Mtd of attr * 'a mpres + + (** XML attribute: namespace, name, value *) +and attr = (string option * string * string) list + +;; + +val get_attr: 'a mpres -> attr +val set_attr: attr -> 'a mpres -> 'a mpres + +val smallskip : 'a mpres +val indented : 'a mpres -> 'a mpres +val standard_tbl_attr : attr +val two_rows_table : attr -> 'a mpres -> 'a mpres -> 'a mpres +val two_rows_table_with_brackets : + attr -> 'a mpres -> 'a mpres -> 'a mpres -> 'a mpres +val two_rows_table_without_brackets : + attr -> 'a mpres -> 'a mpres -> 'a mpres -> 'a mpres +val row_with_brackets : + attr -> 'a mpres -> 'a mpres -> 'a mpres -> 'a mpres +val row_without_brackets : + attr -> 'a mpres -> 'a mpres -> 'a mpres -> 'a mpres +val print_mpres : ('a -> Xml.token Stream.t) -> 'a mpres -> Xml.token Stream.t +val document_of_mpres : 'a mpres -> Xml.token Stream.t + diff --git a/components/content_pres/renderingAttrs.ml b/components/content_pres/renderingAttrs.ml new file mode 100644 index 000000000..256238d3d --- /dev/null +++ b/components/content_pres/renderingAttrs.ml @@ -0,0 +1,54 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type xml_attribute = string option * string * string +type markup = [ `MathML | `BoxML ] + +let color1 = "blue" +(* let color2 = "red" *) +let color2 = "blue" + +let keyword_attributes = function + | `MathML -> [ None, "mathcolor", color1 ] + | `BoxML -> [ None, "color", color1 ] + +let builtin_symbol_attributes = function + | `MathML -> [ None, "mathcolor", color1 ] + | `BoxML -> [ None, "color", color1 ] + +let object_keyword_attributes = function + | `MathML -> [ None, "mathcolor", color2 ] + | `BoxML -> [ None, "color", color2 ] + +let symbol_attributes _ = [] +let ident_attributes _ = [] +let number_attributes _ = [] + +let spacing_attributes _ = [ None, "spacing", "0.5em" ] +let indent_attributes _ = [ None, "indent", "0.5em" ] +let small_skip_attributes _ = [ None, "width", "0.5em" ] + diff --git a/components/content_pres/renderingAttrs.mli b/components/content_pres/renderingAttrs.mli new file mode 100644 index 000000000..64323598b --- /dev/null +++ b/components/content_pres/renderingAttrs.mli @@ -0,0 +1,57 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** XML attributes for MathML/BoxML rendering of terms and objects + * markup defaults to MathML in all functions below *) + +type xml_attribute = string option * string * string +type markup = [ `MathML | `BoxML ] + +(** High-level attributes *) + +val keyword_attributes: (* let, match, in, ... *) + markup -> xml_attribute list + +val builtin_symbol_attributes: (* \\Pi, \\to, ... *) + markup -> xml_attribute list + +val symbol_attributes: (* +, *, ... *) + markup -> xml_attribute list + +val ident_attributes: (* nat, plus, ... *) + markup -> xml_attribute list + +val number_attributes: (* 1, 2, ... *) + markup -> xml_attribute list + +val object_keyword_attributes: (* Body, Definition, ... *) + markup -> xml_attribute list + +(** Low-level attributes *) + +val spacing_attributes: markup -> xml_attribute list +val indent_attributes: markup -> xml_attribute list +val small_skip_attributes: markup -> xml_attribute list + diff --git a/components/content_pres/sequent2pres.ml b/components/content_pres/sequent2pres.ml new file mode 100644 index 000000000..d9c3a325e --- /dev/null +++ b/components/content_pres/sequent2pres.ml @@ -0,0 +1,107 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(***************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 19/11/2003 *) +(* *) +(***************************************************************************) + +(* $Id$ *) + +let p_mtr a b = Mpresentation.Mtr(a,b) +let p_mtd a b = Mpresentation.Mtd(a,b) +let p_mtable a b = Mpresentation.Mtable(a,b) +let p_mtext a b = Mpresentation.Mtext(a,b) +let p_mi a b = Mpresentation.Mi(a,b) +let p_mo a b = Mpresentation.Mo(a,b) +let p_mrow a b = Mpresentation.Mrow(a,b) +let p_mphantom a b = Mpresentation.Mphantom(a,b) +let b_ink a = Box.Ink a + +module K = Content +module P = Mpresentation + +let sequent2pres term2pres (_,_,context,ty) = + let context2pres context = + let rec aux accum = + function + [] -> accum + | None::tl -> aux accum tl + | (Some (`Declaration d))::tl -> + let + { K.dec_name = dec_name ; + K.dec_id = dec_id ; + K.dec_type = ty } = d in + let r = + Box.b_h [Some "helm", "xref", dec_id] + [ Box.b_object (p_mi [] + (match dec_name with + None -> "_" + | Some n -> n)) ; + Box.b_space; Box.b_text [] ":"; Box.b_space; + term2pres ty] in + aux (r::accum) tl + | (Some (`Definition d))::tl -> + let + { K.def_name = def_name ; + K.def_id = def_id ; + K.def_term = bo } = d in + let r = + Box.b_h [Some "helm", "xref", def_id] + [ Box.b_object (p_mi [] + (match def_name with + None -> "_" + | Some n -> n)) ; Box.b_space ; + Box.b_text [] (Utf8Macro.unicode_of_tex "\\def") ; + Box.b_space; term2pres bo] in + aux (r::accum) tl + | _::_ -> assert false in + aux [] context in + let pres_context = + if context <> [] then [Box.b_v [] (context2pres context)] else [] in + let pres_goal = term2pres ty in + (Box.b_h [] [ + Box.b_space; + (Box.b_v [] + (Box.b_space :: + pres_context @ [ + b_ink [None,"width","4cm"; None,"height","2px"]; (* sequent line *) + Box.b_space; + pres_goal]))]) + +let sequent2pres ~ids_to_inner_sorts = + sequent2pres + (fun annterm -> + let ast, ids_to_uris = + TermAcicContent.ast_of_acic ~output_type:`Term ids_to_inner_sorts annterm + in + CicNotationPres.box_of_mpres + (CicNotationPres.render ids_to_uris + (TermContentPres.pp_ast ast))) + diff --git a/components/content_pres/sequent2pres.mli b/components/content_pres/sequent2pres.mli new file mode 100644 index 000000000..d6d9daa40 --- /dev/null +++ b/components/content_pres/sequent2pres.mli @@ -0,0 +1,38 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(***************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 19/11/2003 *) +(* *) +(***************************************************************************) + +val sequent2pres : + ids_to_inner_sorts:(Cic.id, Cic2acic.sort_kind) Hashtbl.t -> + Cic.annterm Content.conjecture -> + CicNotationPres.boxml_markup diff --git a/components/content_pres/termContentPres.ml b/components/content_pres/termContentPres.ml new file mode 100644 index 000000000..0ee424f18 --- /dev/null +++ b/components/content_pres/termContentPres.ml @@ -0,0 +1,674 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +module Ast = CicNotationPt +module Env = CicNotationEnv + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) else () + +type pattern_id = int +type pretty_printer_id = pattern_id + +let resolve_binder = function + | `Lambda -> "\\lambda" + | `Pi -> "\\Pi" + | `Forall -> "\\forall" + | `Exists -> "\\exists" + +let add_level_info prec assoc t = Ast.AttributedTerm (`Level (prec, assoc), t) +let add_pos_info pos t = Ast.AttributedTerm (`ChildPos pos, t) +let left_pos = add_pos_info `Left +let right_pos = add_pos_info `Right +let inner_pos = add_pos_info `Inner + +let rec top_pos t = add_level_info ~-1 Gramext.NonA (inner_pos t) +(* function + | Ast.AttributedTerm (`Level _, t) -> + add_level_info ~-1 Gramext.NonA (inner_pos t) + | Ast.AttributedTerm (attr, t) -> Ast.AttributedTerm (attr, top_pos t) + | t -> add_level_info ~-1 Gramext.NonA (inner_pos t) *) + +let rec remove_level_info = + function + | Ast.AttributedTerm (`Level _, t) -> remove_level_info t + | Ast.AttributedTerm (a, t) -> Ast.AttributedTerm (a, remove_level_info t) + | t -> t + +let add_xml_attrs attrs t = + if attrs = [] then t else Ast.AttributedTerm (`XmlAttrs attrs, t) + +let add_keyword_attrs = + add_xml_attrs (RenderingAttrs.keyword_attributes `MathML) + +let box kind spacing indent content = + Ast.Layout (Ast.Box ((kind, spacing, indent), content)) + +let hbox = box Ast.H +let vbox = box Ast.V +let hvbox = box Ast.HV +let hovbox = box Ast.HOV +let break = Ast.Layout Ast.Break +let space = Ast.Literal (`Symbol " ") +let builtin_symbol s = Ast.Literal (`Symbol s) +let keyword k = add_keyword_attrs (Ast.Literal (`Keyword k)) + +let number s = + add_xml_attrs (RenderingAttrs.number_attributes `MathML) + (Ast.Literal (`Number s)) + +let ident i = + add_xml_attrs (RenderingAttrs.ident_attributes `MathML) (Ast.Ident (i, None)) + +let ident_w_href href i = + match href with + | None -> ident i + | Some href -> + let href = UriManager.string_of_uri href in + add_xml_attrs [Some "xlink", "href", href] (ident i) + +let binder_symbol s = + add_xml_attrs (RenderingAttrs.builtin_symbol_attributes `MathML) + (builtin_symbol s) + +let string_of_sort_kind = function + | `Prop -> "Prop" + | `Set -> "Set" + | `CProp -> "CProp" + | `Type _ -> "Type" + +let pp_ast0 t k = + let rec aux = + function + | Ast.Appl ts -> + let rec aux_args pos = + function + | [] -> [] + | [ last ] -> + let last = k last in + if pos = `Left then [ left_pos last ] else [ right_pos last ] + | hd :: tl -> + (add_pos_info pos (k hd)) :: aux_args `Inner tl + in + add_level_info Ast.apply_prec Ast.apply_assoc + (hovbox true true (CicNotationUtil.dress break (aux_args `Left ts))) + | Ast.Binder (binder_kind, (id, ty), body) -> + add_level_info Ast.binder_prec Ast.binder_assoc + (hvbox false true + [ binder_symbol (resolve_binder binder_kind); + k id; builtin_symbol ":"; aux_ty ty; break; + builtin_symbol "."; right_pos (k body) ]) + | Ast.Case (what, indty_opt, outty_opt, patterns) -> + let outty_box = + match outty_opt with + | None -> [] + | Some outty -> + [ space; keyword "return"; space; break; remove_level_info (k outty)] + in + let indty_box = + match indty_opt with + | None -> [] + | Some (indty, href) -> [ space; keyword "in"; space; break; ident_w_href href indty ] + in + let match_box = + hvbox false false [ + hvbox false true [ + hvbox false true [keyword "match"; space; break; top_pos (k what)]; + break; + hvbox false true indty_box; + break; + hvbox false true outty_box + ]; + break; + space; + keyword "with"; + space + ] + in + let mk_case_pattern = + function + Ast.Pattern (head, href, vars) -> + hbox true false (ident_w_href href head :: List.map aux_var vars) + | Ast.Wildcard -> builtin_symbol "_" + in + let patterns' = + List.map + (fun (lhs, rhs) -> + remove_level_info + (hvbox false true [ + hbox false true [ + mk_case_pattern lhs; builtin_symbol "\\Rightarrow" ]; + break; top_pos (k rhs) ])) + patterns + in + let patterns'' = + let rec aux_patterns = function + | [] -> assert false + | [ last ] -> + [ break; + hbox false false [ + builtin_symbol "|"; + last; builtin_symbol "]" ] ] + | hd :: tl -> + [ break; hbox false false [ builtin_symbol "|"; hd ] ] + @ aux_patterns tl + in + match patterns' with + | [] -> + [ hbox false false [ builtin_symbol "["; builtin_symbol "]" ] ] + | [ one ] -> + [ hbox false false [ + builtin_symbol "["; one; builtin_symbol "]" ] ] + | hd :: tl -> + hbox false false [ builtin_symbol "["; hd ] + :: aux_patterns tl + in + add_level_info Ast.simple_prec Ast.simple_assoc + (hvbox false false [ + hvbox false false ([match_box]); break; + hbox false false [ hvbox false false patterns'' ] ]) + | Ast.Cast (bo, ty) -> + add_level_info Ast.simple_prec Ast.simple_assoc + (hvbox false true [ + builtin_symbol "("; top_pos (k bo); break; builtin_symbol ":"; + top_pos (k ty); builtin_symbol ")"]) + | Ast.LetIn (var, s, t) -> + add_level_info Ast.let_in_prec Ast.let_in_assoc + (hvbox false true [ + hvbox false true [ + keyword "let"; space; + hvbox false true [ + aux_var var; space; builtin_symbol "\\def"; break; top_pos (k s) ]; + break; space; keyword "in" ]; + break; + k t ]) + | Ast.LetRec (rec_kind, funs, where) -> + let rec_op = + match rec_kind with `Inductive -> "rec" | `CoInductive -> "corec" + in + let mk_fun (args, (name,ty), body, rec_param) = + List.map aux_var args ,k name, HExtlib.map_option k ty, k body, + fst (List.nth args rec_param) + in + let mk_funs = List.map mk_fun in + let fst_fun, tl_funs = + match mk_funs funs with hd :: tl -> hd, tl | [] -> assert false + in + let fst_row = + let (params, name, ty, body, rec_param) = fst_fun in + hvbox false true ([ + keyword "let"; + space; + keyword rec_op; + space; + name] @ + params @ + [space; keyword "on" ; space ; rec_param ;space ] @ + (match ty with None -> [] | Some ty -> [builtin_symbol ":"; ty]) @ + [ builtin_symbol "\\def"; + break; + top_pos body ]) + in + let tl_rows = + List.map + (fun (params, name, ty, body, rec_param) -> + [ break; + hvbox false true ([ + keyword "and"; + name] @ + params @ + [space; keyword "on" ; space; rec_param ;space ] @ + (match ty with + None -> [] + | Some ty -> [builtin_symbol ":"; ty]) @ + [ builtin_symbol "\\def"; break; body ])]) + tl_funs + in + add_level_info Ast.let_in_prec Ast.let_in_assoc + ((hvbox false false + (fst_row :: List.flatten tl_rows + @ [ break; keyword "in"; break; k where ]))) + | Ast.Implicit -> builtin_symbol "?" + | Ast.Meta (n, l) -> + let local_context l = + List.map (function None -> None | Some t -> Some (k t)) l + in + Ast.Meta(n, local_context l) + | Ast.Sort sort -> aux_sort sort + | Ast.Num _ + | Ast.Symbol _ + | Ast.Ident (_, None) | Ast.Ident (_, Some []) + | Ast.Uri (_, None) | Ast.Uri (_, Some []) + | Ast.Literal _ + | Ast.UserInput as leaf -> leaf + | t -> CicNotationUtil.visit_ast ~special_k k t + and aux_sort sort_kind = + add_xml_attrs (RenderingAttrs.keyword_attributes `MathML) + (Ast.Ident (string_of_sort_kind sort_kind, None)) + and aux_ty = function + | None -> builtin_symbol "?" + | Some ty -> k ty + and aux_var = function + | name, Some ty -> + hvbox false true [ + builtin_symbol "("; name; builtin_symbol ":"; break; k ty; + builtin_symbol ")" ] + | name, None -> name + and special_k = function + | Ast.AttributedTerm (attrs, t) -> Ast.AttributedTerm (attrs, k t) + | t -> + prerr_endline ("unexpected special: " ^ CicNotationPp.pp_term t); + assert false + in + aux t + + (* persistent state *) + +let level1_patterns21 = Hashtbl.create 211 + +let compiled21 = ref None + +let pattern21_matrix = ref [] + +let get_compiled21 () = + match !compiled21 with + | None -> assert false + | Some f -> Lazy.force f + +let set_compiled21 f = compiled21 := Some f + +let add_idrefs = + List.fold_right (fun idref t -> Ast.AttributedTerm (`IdRef idref, t)) + +let instantiate21 idrefs env l1 = + let rec subst_singleton pos env = + function + Ast.AttributedTerm (attr, t) -> + Ast.AttributedTerm (attr, subst_singleton pos env t) + | t -> CicNotationUtil.group (subst pos env t) + and subst pos env = function + | Ast.AttributedTerm (attr, t) -> +(* prerr_endline ("loosing attribute " ^ CicNotationPp.pp_attribute attr); *) + subst pos env t + | Ast.Variable var -> + let name, expected_ty = CicNotationEnv.declaration_of_var var in + let ty, value = + try + List.assoc name env + with Not_found -> + prerr_endline ("name " ^ name ^ " not found in environment"); + assert false + in + assert (CicNotationEnv.well_typed ty value); (* INVARIANT *) + (* following assertion should be a conditional that makes this + * instantiation fail *) + assert (CicNotationEnv.well_typed expected_ty value); + [ add_pos_info pos (CicNotationEnv.term_of_value value) ] + | Ast.Magic m -> subst_magic pos env m + | Ast.Literal l as t -> + let t = add_idrefs idrefs t in + (match l with + | `Keyword k -> [ add_keyword_attrs t ] + | _ -> [ t ]) + | Ast.Layout l -> [ Ast.Layout (subst_layout pos env l) ] + | t -> [ CicNotationUtil.visit_ast (subst_singleton pos env) t ] + and subst_magic pos env = function + | Ast.List0 (p, sep_opt) + | Ast.List1 (p, sep_opt) -> + let rec_decls = CicNotationEnv.declarations_of_term p in + let rec_values = + List.map (fun (n, _) -> CicNotationEnv.lookup_list env n) rec_decls + in + let values = CicNotationUtil.ncombine rec_values in + let sep = + match sep_opt with + | None -> [] + | Some l -> [ Ast.Literal l ] + in + let rec instantiate_list acc = function + | [] -> List.rev acc + | value_set :: [] -> + let env = CicNotationEnv.combine rec_decls value_set in + instantiate_list (CicNotationUtil.group (subst pos env p) :: acc) + [] + | value_set :: tl -> + let env = CicNotationEnv.combine rec_decls value_set in + let terms = subst pos env p in + instantiate_list (CicNotationUtil.group (terms @ sep) :: acc) tl + in + instantiate_list [] values + | Ast.Opt p -> + let opt_decls = CicNotationEnv.declarations_of_term p in + let env = + let rec build_env = function + | [] -> [] + | (name, ty) :: tl -> + (* assumption: if one of the value is None then all are *) + (match CicNotationEnv.lookup_opt env name with + | None -> raise Exit + | Some v -> (name, (ty, v)) :: build_env tl) + in + try build_env opt_decls with Exit -> [] + in + begin + match env with + | [] -> [] + | _ -> subst pos env p + end + | _ -> assert false (* impossible *) + and subst_layout pos env = function + | Ast.Box (kind, tl) -> + let tl' = subst_children pos env tl in + Ast.Box (kind, List.concat tl') + | l -> CicNotationUtil.visit_layout (subst_singleton pos env) l + and subst_children pos env = + function + | [] -> [] + | [ child ] -> + let pos' = + match pos with + | `Inner -> `Right + | `Left -> `Left +(* | `None -> assert false *) + | `Right -> `Right + in + [ subst pos' env child ] + | hd :: tl -> + let pos' = + match pos with + | `Inner -> `Inner + | `Left -> `Inner +(* | `None -> assert false *) + | `Right -> `Right + in + (subst pos env hd) :: subst_children pos' env tl + in + subst_singleton `Left env l1 + +let rec pp_ast1 term = + let rec pp_value = function + | CicNotationEnv.NumValue _ as v -> v + | CicNotationEnv.StringValue _ as v -> v +(* | CicNotationEnv.TermValue t when t == term -> CicNotationEnv.TermValue (pp_ast0 t pp_ast1) *) + | CicNotationEnv.TermValue t -> CicNotationEnv.TermValue (pp_ast1 t) + | CicNotationEnv.OptValue None as v -> v + | CicNotationEnv.OptValue (Some v) -> + CicNotationEnv.OptValue (Some (pp_value v)) + | CicNotationEnv.ListValue vl -> + CicNotationEnv.ListValue (List.map pp_value vl) + in + let ast_env_of_env env = + List.map (fun (var, (ty, value)) -> (var, (ty, pp_value value))) env + in +(* prerr_endline ("pattern matching from 2 to 1 on term " ^ CicNotationPp.pp_term term); *) + match term with + | Ast.AttributedTerm (attrs, term') -> + Ast.AttributedTerm (attrs, pp_ast1 term') + | _ -> + (match (get_compiled21 ()) term with + | None -> pp_ast0 term pp_ast1 + | Some (env, ctors, pid) -> + let idrefs = + List.flatten (List.map CicNotationUtil.get_idrefs ctors) + in + let l1 = + try + Hashtbl.find level1_patterns21 pid + with Not_found -> assert false + in + instantiate21 idrefs (ast_env_of_env env) l1) + +let load_patterns21 t = + set_compiled21 (lazy (Content2presMatcher.Matcher21.compiler t)) + +let pp_ast ast = + debug_print (lazy "pp_ast <-"); + let ast' = pp_ast1 ast in + debug_print (lazy ("pp_ast -> " ^ CicNotationPp.pp_term ast')); + ast' + +exception Pretty_printer_not_found + +let fill_pos_info l1_pattern = l1_pattern +(* let rec aux toplevel pos = + function + | Ast.Layout l -> + (match l + + | Ast.Magic m -> + Ast.Box ( + | Ast.Variable _ as t -> add_pos_info pos t + | t -> t + in + aux true l1_pattern *) + +let fresh_id = + let counter = ref ~-1 in + fun () -> + incr counter; + !counter + +let add_pretty_printer ~precedence ~associativity l2 l1 = + let id = fresh_id () in + let l1' = add_level_info precedence associativity (fill_pos_info l1) in + let l2' = CicNotationUtil.strip_attributes l2 in + Hashtbl.add level1_patterns21 id l1'; + pattern21_matrix := (l2', id) :: !pattern21_matrix; + load_patterns21 !pattern21_matrix; + id + +let remove_pretty_printer id = + (try + Hashtbl.remove level1_patterns21 id; + with Not_found -> raise Pretty_printer_not_found); + pattern21_matrix := List.filter (fun (_, id') -> id <> id') !pattern21_matrix; + load_patterns21 !pattern21_matrix + + (* presentation -> content *) + +let unopt_names names env = + let rec aux acc = function + | (name, (ty, v)) :: tl when List.mem name names -> + (match ty, v with + | Env.OptType ty, Env.OptValue (Some v) -> + aux ((name, (ty, v)) :: acc) tl + | _ -> assert false) + | hd :: tl -> aux (hd :: acc) tl + | [] -> acc + in + aux [] env + +let head_names names env = + let rec aux acc = function + | (name, (ty, v)) :: tl when List.mem name names -> + (match ty, v with + | Env.ListType ty, Env.ListValue (v :: _) -> + aux ((name, (ty, v)) :: acc) tl + | _ -> assert false) + | _ :: tl -> aux acc tl + (* base pattern may contain only meta names, thus we trash all others *) + | [] -> acc + in + aux [] env + +let tail_names names env = + let rec aux acc = function + | (name, (ty, v)) :: tl when List.mem name names -> + (match ty, v with + | Env.ListType ty, Env.ListValue (_ :: vtl) -> + aux ((name, (Env.ListType ty, Env.ListValue vtl)) :: acc) tl + | _ -> assert false) + | binding :: tl -> aux (binding :: acc) tl + | [] -> acc + in + aux [] env + +let instantiate_level2 env term = + let fresh_env = ref [] in + let lookup_fresh_name n = + try + List.assoc n !fresh_env + with Not_found -> + let new_name = CicNotationUtil.fresh_name () in + fresh_env := (n, new_name) :: !fresh_env; + new_name + in + let rec aux env term = +(* prerr_endline ("ENV " ^ CicNotationPp.pp_env env); *) + match term with + | Ast.AttributedTerm (_, term) -> aux env term + | Ast.Appl terms -> Ast.Appl (List.map (aux env) terms) + | Ast.Binder (binder, var, body) -> + Ast.Binder (binder, aux_capture_var env var, aux env body) + | Ast.Case (term, indty, outty_opt, patterns) -> + Ast.Case (aux env term, indty, aux_opt env outty_opt, + List.map (aux_branch env) patterns) + | Ast.LetIn (var, t1, t2) -> + Ast.LetIn (aux_capture_var env var, aux env t1, aux env t2) + | Ast.LetRec (kind, definitions, body) -> + Ast.LetRec (kind, List.map (aux_definition env) definitions, + aux env body) + | Ast.Uri (name, None) -> Ast.Uri (name, None) + | Ast.Uri (name, Some substs) -> + Ast.Uri (name, Some (aux_substs env substs)) + | Ast.Ident (name, Some substs) -> + Ast.Ident (name, Some (aux_substs env substs)) + | Ast.Meta (index, substs) -> Ast.Meta (index, aux_meta_substs env substs) + + | Ast.Implicit + | Ast.Ident _ + | Ast.Num _ + | Ast.Sort _ + | Ast.Symbol _ + | Ast.UserInput -> term + + | Ast.Magic magic -> aux_magic env magic + | Ast.Variable var -> aux_variable env var + + | _ -> assert false + and aux_opt env = function + | Some term -> Some (aux env term) + | None -> None + and aux_capture_var env (name, ty_opt) = (aux env name, aux_opt env ty_opt) + and aux_branch env (pattern, term) = + (aux_pattern env pattern, aux env term) + and aux_pattern env = + function + Ast.Pattern (head, hrefs, vars) -> + Ast.Pattern (head, hrefs, List.map (aux_capture_var env) vars) + | Ast.Wildcard -> Ast.Wildcard + and aux_definition env (params, var, term, i) = + (List.map (aux_capture_var env) params, aux_capture_var env var, aux env term, i) + and aux_substs env substs = + List.map (fun (name, term) -> (name, aux env term)) substs + and aux_meta_substs env meta_substs = List.map (aux_opt env) meta_substs + and aux_variable env = function + | Ast.NumVar name -> Ast.Num (Env.lookup_num env name, 0) + | Ast.IdentVar name -> Ast.Ident (Env.lookup_string env name, None) + | Ast.TermVar name -> Env.lookup_term env name + | Ast.FreshVar name -> Ast.Ident (lookup_fresh_name name, None) + | Ast.Ascription (term, name) -> assert false + and aux_magic env = function + | Ast.Default (some_pattern, none_pattern) -> + let some_pattern_names = CicNotationUtil.names_of_term some_pattern in + let none_pattern_names = CicNotationUtil.names_of_term none_pattern in + let opt_names = + List.filter + (fun name -> not (List.mem name none_pattern_names)) + some_pattern_names + in + (match opt_names with + | [] -> assert false (* some pattern must contain at least 1 name *) + | (name :: _) as names -> + (match Env.lookup_value env name with + | Env.OptValue (Some _) -> + (* assumption: if "name" above is bound to Some _, then all + * names returned by "meta_names_of" are bound to Some _ as well + *) + aux (unopt_names names env) some_pattern + | Env.OptValue None -> aux env none_pattern + | _ -> + prerr_endline (sprintf + "lookup of %s in env %s did not return an optional value" + name (CicNotationPp.pp_env env)); + assert false)) + | Ast.Fold (`Left, base_pattern, names, rec_pattern) -> + let acc_name = List.hd names in (* names can't be empty, cfr. parser *) + let meta_names = + List.filter ((<>) acc_name) + (CicNotationUtil.names_of_term rec_pattern) + in + (match meta_names with + | [] -> assert false (* as above *) + | (name :: _) as names -> + let rec instantiate_fold_left acc env' = + match Env.lookup_value env' name with + | Env.ListValue (_ :: _) -> + instantiate_fold_left + (let acc_binding = + acc_name, (Env.TermType, Env.TermValue acc) + in + aux (acc_binding :: head_names names env') rec_pattern) + (tail_names names env') + | Env.ListValue [] -> acc + | _ -> assert false + in + instantiate_fold_left (aux env base_pattern) env) + | Ast.Fold (`Right, base_pattern, names, rec_pattern) -> + let acc_name = List.hd names in (* names can't be empty, cfr. parser *) + let meta_names = + List.filter ((<>) acc_name) + (CicNotationUtil.names_of_term rec_pattern) + in + (match meta_names with + | [] -> assert false (* as above *) + | (name :: _) as names -> + let rec instantiate_fold_right env' = + match Env.lookup_value env' name with + | Env.ListValue (_ :: _) -> + let acc = instantiate_fold_right (tail_names names env') in + let acc_binding = + acc_name, (Env.TermType, Env.TermValue acc) + in + aux (acc_binding :: head_names names env') rec_pattern + | Env.ListValue [] -> aux env base_pattern + | _ -> assert false + in + instantiate_fold_right env) + | Ast.If (_, p_true, p_false) as t -> + aux env (CicNotationUtil.find_branch (Ast.Magic t)) + | Ast.Fail -> assert false + | _ -> assert false + in + aux env term + + (* initialization *) + +let _ = load_patterns21 [] + diff --git a/components/content_pres/termContentPres.mli b/components/content_pres/termContentPres.mli new file mode 100644 index 000000000..5ff710036 --- /dev/null +++ b/components/content_pres/termContentPres.mli @@ -0,0 +1,52 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** {2 Persistant state handling} *) + +type pretty_printer_id + +val add_pretty_printer: + precedence:int -> + associativity:Gramext.g_assoc -> + CicNotationPt.term -> (* level 2 pattern *) + CicNotationPt.term -> (* level 1 pattern *) + pretty_printer_id + +exception Pretty_printer_not_found + + (** @raise Pretty_printer_not_found *) +val remove_pretty_printer: pretty_printer_id -> unit + + (** {2 content -> pres} *) + +val pp_ast: CicNotationPt.term -> CicNotationPt.term + + (** {2 pres -> content} *) + + (** fills a term pattern instantiating variable magics *) +val instantiate_level2: + CicNotationEnv.t -> CicNotationPt.term -> + CicNotationPt.term + diff --git a/components/content_pres/test_lexer.ml b/components/content_pres/test_lexer.ml new file mode 100644 index 000000000..e76756e0f --- /dev/null +++ b/components/content_pres/test_lexer.ml @@ -0,0 +1,63 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let _ = + let level = ref "2@" in + let ic = ref stdin in + let arg_spec = [ "-level", Arg.Set_string level, "set the notation level" ] in + let usage = "test_lexer [ -level level ] [ file ]" in + let open_file fname = + if !ic <> stdin then close_in !ic; + ic := open_in fname + in + Arg.parse arg_spec open_file usage; + let lexer = + match !level with + "1" -> CicNotationLexer.level1_pattern_lexer + | "2@" -> CicNotationLexer.level2_ast_lexer + | "2$" -> CicNotationLexer.level2_meta_lexer + | l -> + prerr_endline (Printf.sprintf "Unsupported level %s" l); + exit 2 + in + let token_stream, loc_func = + lexer.Token.tok_func (Obj.magic (Ulexing.from_utf8_channel !ic)) in + Printf.printf "Lexing notation level %s\n" !level; flush stdout; + let tok_count = ref 0 in + let rec dump () = + let (a,b) = Stream.next token_stream in + if a = "EOI" then raise Stream.Failure; + let pos = loc_func !tok_count in + print_endline (Printf.sprintf "%s '%s' (@ %d-%d)" a b + (Stdpp.first_pos pos) (Stdpp.last_pos pos)); + incr tok_count; + dump () + in + try + dump () + with Stream.Failure -> () + diff --git a/components/extlib/.depend b/components/extlib/.depend new file mode 100644 index 000000000..6d96e61e2 --- /dev/null +++ b/components/extlib/.depend @@ -0,0 +1,18 @@ +componentsConf.cmo: componentsConf.cmi +componentsConf.cmx: componentsConf.cmi +hExtlib.cmo: hExtlib.cmi +hExtlib.cmx: hExtlib.cmi +hMarshal.cmo: hExtlib.cmi hMarshal.cmi +hMarshal.cmx: hExtlib.cmx hMarshal.cmi +patternMatcher.cmo: patternMatcher.cmi +patternMatcher.cmx: patternMatcher.cmi +hLog.cmo: hLog.cmi +hLog.cmx: hLog.cmi +trie.cmo: trie.cmi +trie.cmx: trie.cmi +hTopoSort.cmo: hTopoSort.cmi +hTopoSort.cmx: hTopoSort.cmi +refCounter.cmo: refCounter.cmi +refCounter.cmx: refCounter.cmi +graphvizPp.cmo: graphvizPp.cmi +graphvizPp.cmx: graphvizPp.cmi diff --git a/components/extlib/.depend.opt b/components/extlib/.depend.opt new file mode 100644 index 000000000..6d96e61e2 --- /dev/null +++ b/components/extlib/.depend.opt @@ -0,0 +1,18 @@ +componentsConf.cmo: componentsConf.cmi +componentsConf.cmx: componentsConf.cmi +hExtlib.cmo: hExtlib.cmi +hExtlib.cmx: hExtlib.cmi +hMarshal.cmo: hExtlib.cmi hMarshal.cmi +hMarshal.cmx: hExtlib.cmx hMarshal.cmi +patternMatcher.cmo: patternMatcher.cmi +patternMatcher.cmx: patternMatcher.cmi +hLog.cmo: hLog.cmi +hLog.cmx: hLog.cmi +trie.cmo: trie.cmi +trie.cmx: trie.cmi +hTopoSort.cmo: hTopoSort.cmi +hTopoSort.cmx: hTopoSort.cmi +refCounter.cmo: refCounter.cmi +refCounter.cmx: refCounter.cmi +graphvizPp.cmo: graphvizPp.cmi +graphvizPp.cmx: graphvizPp.cmi diff --git a/components/extlib/Makefile b/components/extlib/Makefile new file mode 100644 index 000000000..f4d92191d --- /dev/null +++ b/components/extlib/Makefile @@ -0,0 +1,21 @@ +PACKAGE = extlib +PREDICATES = + +INTERFACE_FILES = \ + componentsConf.mli \ + hExtlib.mli \ + hMarshal.mli \ + patternMatcher.mli \ + hLog.mli \ + trie.mli \ + hTopoSort.mli \ + refCounter.mli \ + graphvizPp.mli \ + $(NULL) +IMPLEMENTATION_FILES = \ + $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/extlib/componentsConf.ml.in b/components/extlib/componentsConf.ml.in new file mode 100644 index 000000000..c24b74e58 --- /dev/null +++ b/components/extlib/componentsConf.ml.in @@ -0,0 +1,29 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +let debug = @DEBUG@ +let profiling = debug +let src_root = "@SRCROOT@" + diff --git a/components/extlib/componentsConf.mli b/components/extlib/componentsConf.mli new file mode 100644 index 000000000..3d8548cf7 --- /dev/null +++ b/components/extlib/componentsConf.mli @@ -0,0 +1,37 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 Compile time components configuration} + * + * This module does not really belong to the extlib (where it is actually + * located) it is here just because it's the first in the component dependencies + * graph *) + +val debug: bool +val profiling: bool + + (** absolute path of the helm/software directory, only for development use *) +val src_root: string + diff --git a/components/extlib/graphvizPp.ml b/components/extlib/graphvizPp.ml new file mode 100644 index 000000000..82fa9807d --- /dev/null +++ b/components/extlib/graphvizPp.ml @@ -0,0 +1,78 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type attribute = string * string (* pair *) + +module type GraphvizFormatter = + sig + val header: + ?graph_type:string -> + ?name:string -> ?graph_attrs:(attribute list) -> + ?node_attrs:(attribute list) -> ?edge_attrs:(attribute list) -> + Format.formatter -> + unit + val node: string -> ?attrs:(attribute list) -> Format.formatter -> unit + val edge: + string -> string -> ?attrs:(attribute list) -> Format.formatter -> + unit + val raw: string -> Format.formatter -> unit + val trailer: Format.formatter -> unit + end + +open Format + +module Dot = + struct + let attribute fmt (k, v) = fprintf fmt "@[%s=@,\"%s\",@]" k v + let attributes attrs fmt = List.iter (attribute fmt) attrs + + let node name ~quote ?(attrs = []) fmt = + let quote_string = if quote then "\"" else "" in + fprintf fmt "@[%s%s%s@ [" quote_string name quote_string; + attributes attrs fmt; + fprintf fmt "];@]@," + + let header ?(graph_type = "digraph") ?(name = "g") ?(graph_attrs = []) ?node_attrs ?edge_attrs fmt = + fprintf fmt "@[%s %s {@," graph_type name; + List.iter (fun (k, v) -> fprintf fmt "@[%s=@,%s;@]@," k v) + graph_attrs; + (match node_attrs with + | Some attrs -> node "node" ~quote:false ~attrs fmt + | None -> ()); + (match edge_attrs with + | Some attrs -> node "edge" ~quote:false ~attrs fmt + | None -> ()) + + let node = node ~quote:true + let edge name1 name2 ?(attrs = []) fmt = + fprintf fmt "@[\"%s\" ->@ \"%s\"@ [" name1 name2; + attributes attrs fmt; + fprintf fmt "];@]@," + let raw s fmt = pp_print_string fmt s + let trailer fmt = fprintf fmt "@,}@]%!" + end + diff --git a/components/extlib/graphvizPp.mli b/components/extlib/graphvizPp.mli new file mode 100644 index 000000000..79037df72 --- /dev/null +++ b/components/extlib/graphvizPp.mli @@ -0,0 +1,55 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +(** {2 Pretty printer for generating (textual) Graphviz markup} *) + +type attribute = string * string (* pair *) + +module type GraphvizFormatter = + sig + (** @param name graph name + * @param graph_type type of dot graph, default value "digraph" + * interesting options: "strict digraph" + * @param graph_attrs graph attributes + * @param node_attrs graph-wide node attributes + * @param edge_attrs graph-wide edge attributes *) + val header: + ?graph_type:string -> + ?name:string -> ?graph_attrs:(attribute list) -> + ?node_attrs:(attribute list) -> ?edge_attrs:(attribute list) -> + Format.formatter -> + unit + val node: string -> ?attrs:(attribute list) -> Format.formatter -> unit + val edge: + string -> string -> ?attrs:(attribute list) -> Format.formatter -> + unit + val raw: string -> Format.formatter -> unit + val trailer: Format.formatter -> unit + end + +module Dot: GraphvizFormatter + diff --git a/components/extlib/hExtlib.ml b/components/extlib/hExtlib.ml new file mode 100644 index 000000000..2fba7f651 --- /dev/null +++ b/components/extlib/hExtlib.ml @@ -0,0 +1,456 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(** PROFILING *) + +let profiling_enabled = false ;; (* ComponentsConf.profiling *) + +let something_profiled = ref false + +let _ = + if !something_profiled then + at_exit + (fun _ -> + prerr_endline + (Printf.sprintf "!! %39s ---------- --------- --------- ---------" + (String.make 39 '-')); + prerr_endline + (Printf.sprintf "!! %-39s %10s %9s %9s %9s" + "function" "#calls" "total" "max" "average")) + +let profiling_printings = ref (fun _ -> true) +let set_profiling_printings f = profiling_printings := f + +type profiler = { profile : 'a 'b. ('a -> 'b) -> 'a -> 'b } +let profile ?(enable = true) s = + if profiling_enabled && enable then + let total = ref 0.0 in + let calls = ref 0 in + let max = ref 0.0 in + let profile f x = + let before = Unix.gettimeofday () in + try + incr calls; + let res = f x in + let after = Unix.gettimeofday () in + let delta = after -. before in + total := !total +. delta; + if delta > !max then max := delta; + res + with + exc -> + let after = Unix.gettimeofday () in + let delta = after -. before in + total := !total +. delta; + if delta > !max then max := delta; + raise exc + in + at_exit + (fun () -> + if !profiling_printings s && !calls <> 0 then + begin + something_profiled := true; + prerr_endline + (Printf.sprintf "!! %-39s %10d %9.4f %9.4f %9.4f" + s !calls !total !max (!total /. (float_of_int !calls))) + end); + { profile = profile } + else + { profile = fun f x -> f x } + +(** {2 Optional values} *) + +let map_option f = function None -> None | Some v -> Some (f v) +let iter_option f = function None -> () | Some v -> f v +let unopt = function None -> failwith "unopt: None" | Some v -> v + +(** {2 String processing} *) + +let split ?(sep = ' ') s = + let pieces = ref [] in + let rec aux idx = + match (try Some (String.index_from s idx sep) with Not_found -> None) with + | Some pos -> + pieces := String.sub s idx (pos - idx) :: !pieces; + aux (pos + 1) + | None -> pieces := String.sub s idx (String.length s - idx) :: !pieces + in + aux 0; + List.rev !pieces + +let trim_blanks s = + let rec find_left idx = + match s.[idx] with + | ' ' | '\t' | '\r' | '\n' -> find_left (idx + 1) + | _ -> idx + in + let rec find_right idx = + match s.[idx] with + | ' ' | '\t' | '\r' | '\n' -> find_right (idx - 1) + | _ -> idx + in + let s_len = String.length s in + let left, right = find_left 0, find_right (s_len - 1) in + String.sub s left (right - left + 1) + +(** {2 Char processing} *) + +let is_alpha c = + let code = Char.code c in + (code >= 65 && code <= 90) || (code >= 97 && code <= 122) + +let is_digit c = + let code = Char.code c in + code >= 48 && code <= 57 + +let is_blank c = + let code = Char.code c in + code = 9 || code = 10 || code = 13 || code = 32 + +let is_alphanum c = is_alpha c || is_digit c + +(** {2 List processing} *) + +let flatten_map f l = + List.flatten (List.map f l) +;; + +let rec list_uniq ?(eq=(=)) = function + | [] -> [] + | h::[] -> [h] + | h1::h2::tl when eq h1 h2 -> list_uniq ~eq (h2 :: tl) + | h1::tl (* when h1 <> h2 *) -> h1 :: list_uniq ~eq tl + +let rec filter_map f = + function + | [] -> [] + | hd :: tl -> + (match f hd with + | None -> filter_map f tl + | Some v -> v :: filter_map f tl) + +let list_rev_map_filter f l = + let rec aux a = function + | [] -> a + | hd :: tl -> + begin match f hd with + | None -> aux a tl + | Some b -> aux (b :: a) tl + end + in + aux [] l + +let list_rev_map_filter_fold f v l = + let rec aux v a = function + | [] -> v, a + | hd :: tl -> + begin match f v hd with + | v, None -> aux v a tl + | v, Some b -> aux v (b :: a) tl + end + in + aux v [] l + +let list_concat ?(sep = []) = + let rec aux acc = + function + | [] -> [] + | [ last ] -> List.flatten (List.rev (last :: acc)) + | hd :: tl -> aux ([sep; hd] @ acc) tl + in + aux [] + +let rec list_findopt f l = + let rec aux = function + | [] -> None + | x::tl -> + (match f x with + | None -> aux tl + | Some _ as rc -> rc) + in + aux l + +let split_nth n l = + let rec aux acc n l = + match n, l with + | 0, _ -> List.rev acc, l + | n, [] -> raise (Failure "HExtlib.split_nth") + | n, hd :: tl -> aux (hd :: acc) (n - 1) tl in + aux [] n l + +let list_last l = + let l = List.rev l in + try List.hd l with exn -> raise (Failure "HExtlib.list_last") +;; + +(** {2 File predicates} *) + +let is_dir fname = + try + (Unix.stat fname).Unix.st_kind = Unix.S_DIR + with Unix.Unix_error _ -> false + +let writable_dir path = + try + let file = path ^ "/prova_matita" in + let oc = open_out file in + close_out oc; + Sys.remove file; + true + with Sys_error _ -> false + + +let is_regular fname = + try + (Unix.stat fname).Unix.st_kind = Unix.S_REG + with Unix.Unix_error _ -> false + +let is_executable fname = + try + let stat = (Unix.stat fname) in + stat.Unix.st_kind = Unix.S_REG && + (stat.Unix.st_perm land 0o001 > 0) + with Unix.Unix_error _ -> false + +let chmod mode filename = + Unix.chmod filename mode + +let mkdir path = + let components = split ~sep:'/' path in + let rec aux where = function + | [] -> () + | piece::tl -> + let path = + if where = "" then piece else where ^ "/" ^ piece in + (try + Unix.mkdir path 0o755; chmod 0o2775 path + with + | Unix.Unix_error (Unix.EEXIST,_,_) -> () + | Unix.Unix_error (e,_,_) -> + raise + (Failure + ("Unix.mkdir " ^ path ^ " 0o2775 :" ^ (Unix.error_message e)))); + aux path tl + in + let where = if path.[0] = '/' then "/" else "" in + aux where components + +(** {2 Filesystem} *) + +let input_file fname = + let size = (Unix.stat fname).Unix.st_size in + let buf = Buffer.create size in + let ic = open_in fname in + Buffer.add_channel buf ic size; + close_in ic; + Buffer.contents buf + +let input_all ic = + let size = 10240 in + let buf = Buffer.create size in + let s = String.create size in + (try + while true do + let bytes = input ic s 0 size in + if bytes = 0 then raise End_of_file + else Buffer.add_substring buf s 0 bytes + done + with End_of_file -> ()); + Buffer.contents buf + +let output_file ~filename ~text = + let oc = open_out filename in + output_string oc text; + close_out oc; + chmod 0o664 filename + +let blank_split s = + let len = String.length s in + let buf = Buffer.create 0 in + let rec aux acc i = + if i >= len + then begin + if Buffer.length buf > 0 + then List.rev (Buffer.contents buf :: acc) + else List.rev acc + end else begin + if is_blank s.[i] then + if Buffer.length buf > 0 then begin + let s = Buffer.contents buf in + Buffer.clear buf; + aux (s :: acc) (i + 1) + end else + aux acc (i + 1) + else begin + Buffer.add_char buf s.[i]; + aux acc (i + 1) + end + end + in + aux [] 0 + + (* Rules: * "~name" -> home dir of "name" + * "~" -> value of $HOME if defined, home dir of the current user otherwise *) +let tilde_expand s = + let get_home login = (Unix.getpwnam login).Unix.pw_dir in + let expand_one s = + let len = String.length s in + if len > 0 && s.[0] = '~' then begin + let login_len = ref 1 in + while !login_len < len && is_alphanum (s.[!login_len]) do + incr login_len + done; + let login = String.sub s 1 (!login_len - 1) in + try + let home = + if login = "" then + try Sys.getenv "HOME" with Not_found -> get_home (Unix.getlogin ()) + else + get_home login + in + home ^ String.sub s !login_len (len - !login_len) + with Not_found | Invalid_argument _ -> s + end else + s + in + String.concat " " (List.map expand_one (blank_split s)) + +let find ?(test = fun _ -> true) path = + let rec aux acc todo = + match todo with + | [] -> acc + | path :: tl -> + try + let handle = Unix.opendir path in + let dirs = ref [] in + let matching_files = ref [] in + (try + while true do + match Unix.readdir handle with + | "." | ".." -> () + | entry -> + let qentry = path ^ "/" ^ entry in + (try + if is_dir qentry then + dirs := qentry :: !dirs + else if test qentry then + matching_files := qentry :: !matching_files; + with Unix.Unix_error _ -> ()) + done + with End_of_file -> Unix.closedir handle); + aux (!matching_files @ acc) (!dirs @ tl) + with Unix.Unix_error _ -> aux acc tl + in + aux [] [path] + +let safe_remove fname = if Sys.file_exists fname then Sys.remove fname + +let is_dir_empty d = + try + let od = Unix.opendir d in + let rec aux () = + let name = Unix.readdir od in + if name <> "." && name <> ".." then false else aux () in + let res = try aux () with End_of_file -> true in + Unix.closedir od; + res + with + Unix.Unix_error _ -> true (* raised by Unix.opendir, we hope :-) *) + +let safe_rmdir d = try Unix.rmdir d with Unix.Unix_error _ -> () + +let rec rmdir_descend d = + if is_dir_empty d then + begin + safe_rmdir d; + rmdir_descend (Filename.dirname d) + end + + +(** {2 Exception handling} *) + +let finally at_end f arg = + let res = + try f arg + with exn -> at_end (); raise exn + in + at_end (); + res + +(** {2 Localized exceptions } *) + +exception Localized of Stdpp.location * exn + +let loc_of_floc floc = Stdpp.first_pos floc, Stdpp.last_pos floc;; + +let floc_of_loc (loc_begin, loc_end) = + Stdpp.make_loc (loc_begin, loc_end) + +let dummy_floc = floc_of_loc (-1, -1) + +let raise_localized_exception ~offset floc exn = + let x, y = loc_of_floc floc in + let x = offset + x in + let y = offset + y in + let floc = floc_of_loc (x,y) in + raise (Localized (floc, exn)) + +let estimate_size x = + 4 * (String.length (Marshal.to_string x [])) / 1024 + +let normalize_path s = + let s = Str.global_replace (Str.regexp "//") "/" s in + let l = Str.split (Str.regexp "/") s in + let rec aux = function + | [] -> [] + | he::".."::tl -> aux tl + | he::"."::tl -> aux (he::tl) + | he::tl -> he :: aux tl + in + (if Str.string_match (Str.regexp "^/") s 0 then "/" else "") ^ + String.concat "/" (aux l) + ^ (if Str.string_match (Str.regexp "/$") s 0 then "/" else "") +;; + +let find_in paths path = + let rec aux = function + | [] -> raise (Failure "not found") + | p :: tl -> + let path = normalize_path (p ^ "/" ^ path) in + try + if (Unix.stat path).Unix.st_kind = Unix.S_REG then path + else aux tl + with Unix.Unix_error _ -> aux tl + in + try + aux paths + with Unix.Unix_error _ | Failure _ -> + raise + (Failure ("File " ^ path ^ " not found (or not readable) in: " ^ + String.concat ":" paths)) +;; + diff --git a/components/extlib/hExtlib.mli b/components/extlib/hExtlib.mli new file mode 100644 index 000000000..07de4bea6 --- /dev/null +++ b/components/extlib/hExtlib.mli @@ -0,0 +1,121 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 Optional values} *) + +val map_option: ('a -> 'b) -> 'a option -> 'b option +val iter_option: ('a -> unit) -> 'a option -> unit +val unopt: 'a option -> 'a (** @raise Failure *) + +(** {2 Filesystem} *) + +val is_dir: string -> bool (** @return true if file is a directory *) +val writable_dir: string -> bool (** @return true if the directory is writable *) +val is_regular: string -> bool (** @return true if file is a regular file *) +val is_executable: string -> bool (** @return true if file is executable *) +val mkdir: string -> unit (** create dir and parents. @raise Failure *) +val tilde_expand: string -> string (** bash-like (head) tilde expansion *) +val safe_remove: string -> unit (** removes a file if it exists *) +val safe_rmdir: string -> unit (** removes a dir if it exists and is empty *) +val is_dir_empty: string -> bool (** checks if the dir is empty *) +val rmdir_descend: string -> unit (** rmdir -p *) +val chmod: int -> string -> unit (** chmod *) +val normalize_path: string -> string (** /foo/./bar/..//baz -> /foo/baz *) + + (** find all _files_ whose name matches test under a filesystem root. + * Test is passed the filename path relative to the given filesystem root *) +val find: ?test:(string -> bool) -> string -> string list + + (** find_in paths name returns the first path^"/"^name such that + * is a regular file and the current user can 'stat' it. May raise Failure. *) +val find_in: string list -> string -> string + +(** {2 File I/O} *) + +val input_file: string -> string (** read all the contents of file to string *) +val input_all: in_channel -> string (** read all the contents of a channel *) +val output_file: filename:string -> text:string -> unit (** other way round *) + +(** {2 Exception handling} *) + + (** @param finalizer finalization function (execution both in case of success + * and in case of raised exception + * @param f function to be invoked + * @param arg argument to be passed to function *) +val finally: (unit -> unit) -> ('a -> 'b) -> 'a -> 'b + +(** {2 Char processing} *) + +val is_alpha: char -> bool +val is_blank: char -> bool +val is_digit: char -> bool +val is_alphanum: char -> bool (** is_alpha || is_digit *) + +(** {2 String processing} *) + +val split: ?sep:char -> string -> string list (** @param sep defaults to ' ' *) +val trim_blanks: string -> string (** strip heading and trailing blanks *) + +(** {2 List processing} *) + +val list_uniq: + ?eq:('a->'a->bool) -> 'a list -> 'a list (** uniq unix filter on lists *) +val filter_map: ('a -> 'b option) -> 'a list -> 'b list (** filter + map *) +val list_rev_map_filter: ('a -> 'b option) -> 'a list -> 'b list +val list_rev_map_filter_fold: ('c -> 'a -> 'c * 'b option) -> 'c -> 'a list -> 'c * 'b list +val list_concat: ?sep:'a list -> 'a list list -> 'a list (**String.concat-like*) +val list_findopt: ('a -> 'b option) -> 'a list -> 'b option +val flatten_map: ('a -> 'b list) -> 'a list -> 'b list +val list_last: 'a list -> 'a + + (** split_nth n l + * @returns two list, the first contains at least n elements, the second the + * remaining one + * @raise Failure when List.length l < n *) +val split_nth: int -> 'a list -> 'a list * 'a list + +(** {2 Debugging & Profiling} *) + +type profiler = { profile : 'a 'b. ('a -> 'b) -> 'a -> 'b } + + (** @return a profiling function; [s] is used for labelling the total time at + * the end of the execution *) +val profile : ?enable:bool -> string -> profiler +val set_profiling_printings : (string -> bool) -> unit + +(** {2 Localized exceptions } *) + +exception Localized of Stdpp.location * exn + +val loc_of_floc: Stdpp.location -> int * int +val floc_of_loc: int * int -> Stdpp.location + +val dummy_floc: Stdpp.location + +val raise_localized_exception: offset:int -> Stdpp.location -> exn -> 'a + +(* size in KB (SLOW) *) +val estimate_size: 'a -> int + diff --git a/components/extlib/hLog.ml b/components/extlib/hLog.ml new file mode 100644 index 000000000..4ad2b5ba4 --- /dev/null +++ b/components/extlib/hLog.ml @@ -0,0 +1,64 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +type log_tag = [ `Debug | `Error | `Message | `Warning ] +type log_callback = log_tag -> string -> unit + +(* +colors=(black red green yellow blue magenta cyan gray white) +ccodes=(30 31 32 33 34 35 36 37 39) +*) + +let blue = "" +let yellow = "" +let green = "" +let red = "" +let black = "" + +let default_callback tag s = + let prefix,ch = + match tag with + | `Message -> green ^ "Info: ", stdout + | `Warning -> yellow ^ "Warn: ", stderr + | `Error -> red ^ "Error: ", stderr + | `Debug -> blue ^ "Debug: ", stderr + in + output_string ch (prefix ^ black ^ s ^ "\n"); + flush ch + +let callback = ref default_callback + +let set_log_callback f = callback := f +let get_log_callback () = !callback + +let message s = !callback `Message s +let warn s = !callback `Warning s +let error s = !callback `Error s +let debug s = !callback `Debug s + diff --git a/components/extlib/hLog.mli b/components/extlib/hLog.mli new file mode 100644 index 000000000..6847ce32d --- /dev/null +++ b/components/extlib/hLog.mli @@ -0,0 +1,36 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type log_tag = [ `Debug | `Error | `Message | `Warning ] +type log_callback = log_tag -> string -> unit + +val set_log_callback: log_callback -> unit +val get_log_callback: unit -> log_callback + +val message : string -> unit +val warn : string -> unit +val error : string -> unit +val debug : string -> unit + diff --git a/components/extlib/hMarshal.ml b/components/extlib/hMarshal.ml new file mode 100644 index 000000000..cb4976e7d --- /dev/null +++ b/components/extlib/hMarshal.ml @@ -0,0 +1,73 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +exception Corrupt_file of string +exception Format_mismatch of string +exception Version_mismatch of string + +let ensure_path_exists fname = HExtlib.mkdir (Filename.dirname fname) +let marshal_flags = [] + +let save ~fmt ~version ~fname data = + ensure_path_exists fname; + let oc = open_out fname in + let marshalled = Marshal.to_string data marshal_flags in + output_binary_int oc (Hashtbl.hash fmt); (* field 1 *) + output_binary_int oc version; (* field 2 *) + output_string oc fmt; (* field 3 *) + output_string oc (string_of_int version); (* field 4 *) + output_binary_int oc (Hashtbl.hash marshalled); (* field 5 *) + output_string oc marshalled; (* field 6 *) + close_out oc; + HExtlib.chmod 0o664 fname + +let expect ic fname s = + let len = String.length s in + let buf = String.create len in + really_input ic buf 0 len; + if buf <> s then raise (Corrupt_file fname) + +let load ~fmt ~version ~fname = + let ic = open_in fname in + HExtlib.finally + (fun () -> close_in ic) + (fun () -> + try + let fmt' = input_binary_int ic in (* field 1 *) + if fmt' <> Hashtbl.hash fmt then raise (Format_mismatch fname); + let version' = input_binary_int ic in (* field 2 *) + if version' <> version then raise (Version_mismatch fname); + expect ic fname fmt; (* field 3 *) + expect ic fname (string_of_int version); (* field 4 *) + let checksum' = input_binary_int ic in (* field 5 *) + let marshalled' = HExtlib.input_all ic in (* field 6 *) + if checksum' <> Hashtbl.hash marshalled' then + raise (Corrupt_file fname); + Marshal.from_string marshalled' 0 + with End_of_file -> raise (Corrupt_file fname)) + () + diff --git a/components/extlib/hMarshal.mli b/components/extlib/hMarshal.mli new file mode 100644 index 000000000..90ce20def --- /dev/null +++ b/components/extlib/hMarshal.mli @@ -0,0 +1,59 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 Marshalling with version/consistency checks} *) + +(** {3 File formats} + * + * Files saved/loaded by this module share a common format: + * + * | n | Field name | Field type | Description | + * +---+-------------+------------+---------------------------------------+ + * | 1 | format | integer | hash value of the 'fmt' parameter | + * | 2 | version | integer | 'version' parameter | + * | 3 | format dsc | string | extended 'fmt' parameter | + * | 4 | version dsc | string | extended 'version' parameter | + * | 5 | checksum | integer | hash value of the _field_ below | + * | 6 | data | raw | ocaml marshalling of 'data' parameter | + * + *) + +exception Corrupt_file of string (** checksum mismatch, or file too short *) +exception Format_mismatch of string +exception Version_mismatch of string + + (** Marhsal some data according to the file format above. + * @param fmt format name + * @param version version number + * @param fname file name to which marshal data + * @param data data to be marshalled on disk *) +val save: fmt:string -> version:int -> fname:string -> 'a -> unit + + (** parameters as above + * @raise Corrupt_file + * @raise Format_mismatch + * @raise Version_mismatch *) +val load: fmt:string -> version:int -> fname:string -> 'a + diff --git a/components/extlib/hTopoSort.ml b/components/extlib/hTopoSort.ml new file mode 100644 index 000000000..cc593d570 --- /dev/null +++ b/components/extlib/hTopoSort.ml @@ -0,0 +1,69 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +module Make (OT:Map.OrderedType) = + struct + + module M = Map.Make(OT);; + + let topological_sort l find_deps = + let find_deps m x = + let deps = find_deps x in + M.add x deps m + in + (* build the partial order relation *) + let m = List.fold_left (fun m i -> find_deps m i) M.empty l in + let m = (* keep only deps inside l *) + List.fold_left + (fun m' i -> + M.add i (List.filter (fun x -> List.mem x l) (M.find i m)) m') + M.empty l + in + let m = M.map (fun x -> Some x) m in + (* utils *) + let keys m = M.fold (fun i _ acc -> i::acc) m [] in + let split l m = List.filter (fun i -> M.find i m = Some []) l in + let purge l m = + M.mapi + (fun k v -> if List.mem k l then None else + match v with + | None -> None + | Some ll -> Some (List.filter (fun i -> not (List.mem i l)) ll)) + m + in + let rec aux m res = + let keys = keys m in + let ok = split keys m in + let m = purge ok m in + let res = ok @ res in + if ok = [] then res else aux m res + in + let rc = List.rev (aux m []) in + rc + ;; + + end +;; + diff --git a/components/extlib/hTopoSort.mli b/components/extlib/hTopoSort.mli new file mode 100644 index 000000000..5cd15fbf1 --- /dev/null +++ b/components/extlib/hTopoSort.mli @@ -0,0 +1,32 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +module Make : + functor (OT : Map.OrderedType) -> + sig + module M : Map.S with type key = OT.t + val topological_sort : + M.key list -> (M.key -> M.key list) -> M.key list + end diff --git a/components/extlib/patternMatcher.ml b/components/extlib/patternMatcher.ml new file mode 100644 index 000000000..c1b436a97 --- /dev/null +++ b/components/extlib/patternMatcher.ml @@ -0,0 +1,191 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +type pattern_kind = Variable | Constructor +type tag_t = int + +type pattern_id = int + +module OrderedInt = +struct + type t = int + let compare (x1:t) (x2:t) = Pervasives.compare x2 x1 (* reverse order *) +end + +module IntSet = Set.Make (OrderedInt) + +let int_set_of_int_list l = + List.fold_left (fun acc i -> IntSet.add i acc) IntSet.empty l + +module type PATTERN = +sig + type pattern_t + type term_t + val classify : pattern_t -> pattern_kind + val tag_of_pattern : pattern_t -> tag_t * pattern_t list + val tag_of_term : term_t -> tag_t * term_t list + val string_of_term: term_t -> string + val string_of_pattern: pattern_t -> string +end + +module Matcher (P: PATTERN) = +struct + type row_t = P.pattern_t list * P.pattern_t list * pattern_id + type t = row_t list + + let compatible p1 p2 = P.classify p1 = P.classify p2 + + let matched = List.map (fun (matched, _, pid) -> matched, pid) + + let partition t pidl = + let partitions = Hashtbl.create 11 in + let add pid row = Hashtbl.add partitions pid row in + (try + List.iter2 add pidl t + with Invalid_argument _ -> assert false); + let pidset = int_set_of_int_list pidl in + IntSet.fold + (fun pid acc -> + match Hashtbl.find_all partitions pid with + | [] -> acc + | patterns -> (pid, List.rev patterns) :: acc) + pidset [] + + let are_empty t = + match t with + | (_, [], _) :: _ -> true + (* if first row has an empty list of patterns, then others have as well *) + | _ -> false + + (* return 2 lists of rows, first one containing homogeneous rows according + * to "compatible" below *) + let horizontal_split t = + let ap, first_row, t', first_row_class = + match t with + | [] -> assert false + | (_, [], _) :: _ -> + assert false (* are_empty should have been invoked in advance *) + | ((_, hd :: _ , _) as row) :: tl -> hd, row, tl, P.classify hd + in + let rec aux prev_t = function + | [] -> List.rev prev_t, [] + | (_, [], _) :: _ -> assert false + | ((_, hd :: _, _) as row) :: tl when compatible ap hd -> + aux (row :: prev_t) tl + | t -> List.rev prev_t, t + in + let rows1, rows2 = aux [first_row] t' in + first_row_class, rows1, rows2 + + (* return 2 lists, first one representing first column, second one + * representing a new pattern matrix where matched patterns have been moved + * to decl *) + let vertical_split t = + List.map + (function + | decls, hd :: tl, pid -> hd :: decls, tl, pid + | _ -> assert false) + t + + let variable_closure ksucc = + (fun matched_terms constructors terms -> +(* prerr_endline "variable_closure"; *) + match terms with + | hd :: tl -> ksucc (hd :: matched_terms) constructors tl + | _ -> assert false) + + let success_closure ksucc = + (fun matched_terms constructors terms -> +(* prerr_endline "success_closure"; *) + ksucc matched_terms constructors) + + let constructor_closure ksuccs = + (fun matched_terms constructors terms -> +(* prerr_endline "constructor_closure"; *) + match terms with + | t :: tl -> + (try + let tag, subterms = P.tag_of_term t in + let constructors' = + if subterms = [] then t :: constructors else constructors + in + let k' = List.assoc tag ksuccs in + k' matched_terms constructors' (subterms @ tl) + with Not_found -> None) + | [] -> assert false) + + let backtrack_closure ksucc kfail = + (fun matched_terms constructors terms -> +(* prerr_endline "backtrack_closure"; *) + match ksucc matched_terms constructors terms with + | Some x -> Some x + | None -> kfail matched_terms constructors terms) + + let compiler rows match_cb fail_k = + let rec aux t = + if t = [] then + (fun _ _ _ -> fail_k ()) + else if are_empty t then + success_closure (match_cb (matched t)) + else + match horizontal_split t with + | _, [], _ -> assert false + | Variable, t', [] -> variable_closure (aux (vertical_split t')) + | Constructor, t', [] -> + let tagl = + List.map + (function + | _, p :: _, _ -> fst (P.tag_of_pattern p) + | _ -> assert false) + t' + in + let clusters = partition t' tagl in + let ksuccs = + List.map + (fun (tag, cluster) -> + let cluster' = + List.map (* add args as patterns heads *) + (function + | matched_p, p :: tl, pid -> + let _, subpatterns = P.tag_of_pattern p in + matched_p, subpatterns @ tl, pid + | _ -> assert false) + cluster + in + tag, aux cluster') + clusters + in + constructor_closure ksuccs + | _, t', t'' -> backtrack_closure (aux t') (aux t'') + in + let t = List.map (fun (p, pid) -> [], [p], pid) rows in + let matcher = aux t in + (fun term -> matcher [] [] [term]) +end + diff --git a/components/extlib/patternMatcher.mli b/components/extlib/patternMatcher.mli new file mode 100644 index 000000000..2201ddf7f --- /dev/null +++ b/components/extlib/patternMatcher.mli @@ -0,0 +1,62 @@ + +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type pattern_kind = Variable | Constructor +type tag_t = int + +module type PATTERN = +sig + type pattern_t + type term_t + + val classify : pattern_t -> pattern_kind + val tag_of_pattern : pattern_t -> tag_t * pattern_t list + val tag_of_term : term_t -> tag_t * term_t list + + (** {3 Debugging} *) + val string_of_term: term_t -> string + val string_of_pattern: pattern_t -> string +end + +module Matcher (P: PATTERN) : +sig + (** @param patterns pattern matrix (pairs ) + * @param success_cb callback invoked in case of matching. + * Its argument are the list of pattern who matches the input term, the list + * of terms bound in them, the list of terms which matched constructors. + * Its return value is Some _ if the matching is valid, None otherwise; the + * latter kind of return value will trigger backtracking in the pattern + * matching algorithm + * @param failure_cb callback invoked in case of matching failure + * @param term term on which pattern match on *) + val compiler: + (P.pattern_t * int) list -> + ((P.pattern_t list * int) list -> P.term_t list -> P.term_t list -> + 'a option) -> (* terms *) (* constructors *) + (unit -> 'a option) -> + (P.term_t -> 'a option) +end + diff --git a/components/extlib/refCounter.ml b/components/extlib/refCounter.ml new file mode 100644 index 000000000..f5edb69f5 --- /dev/null +++ b/components/extlib/refCounter.ml @@ -0,0 +1,49 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type 'a t = ('a, int ref) Hashtbl.t + +let create () = Hashtbl.create 113 + +let incr ~create_cb counters item = + try + let counter = Hashtbl.find counters item in + incr counter + with Not_found -> + Hashtbl.add counters item (ref 1); + create_cb item + +let decr ~delete_cb counters item = + try + let counter = Hashtbl.find counters item in + decr counter; + if !counter = 0 then begin + Hashtbl.remove counters item; + delete_cb item + end + with Not_found -> + prerr_endline "RefCounter: attempt to decrease unexistent counter"; + assert false + diff --git a/components/extlib/refCounter.mli b/components/extlib/refCounter.mli new file mode 100644 index 000000000..fc5216648 --- /dev/null +++ b/components/extlib/refCounter.mli @@ -0,0 +1,31 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type 'a t + +val create: unit -> 'a t +val incr: create_cb:('a -> unit) -> 'a t -> 'a -> unit +val decr: delete_cb:('a -> unit) -> 'a t -> 'a -> unit + diff --git a/components/extlib/trie.ml b/components/extlib/trie.ml new file mode 100644 index 000000000..f60b2d45c --- /dev/null +++ b/components/extlib/trie.ml @@ -0,0 +1,153 @@ +(* + * Trie: maps over lists. + * Copyright (C) 2000 Jean-Christophe FILLIATRE + * + * This software is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License version 2, as published by the Free Software Foundation. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU Library General Public License version 2 for more details + * (enclosed in the file LGPL). + *) + +(* $Id$ *) + +(*s A trie is a tree-like structure to implement dictionaries over + keys which have list-like structures. The idea is that each node + branches on an element of the list and stores the value associated + to the path from the root, if any. Therefore, a trie can be + defined as soon as a map over the elements of the list is + given. *) + + +module Make (M : Map.S) = struct + +(*s Then a trie is just a tree-like structure, where a possible + information is stored at the node (['a option]) and where the sons + are given by a map from type [key] to sub-tries, so of type + ['a t M.t]. The empty trie is just the empty map. *) + + type key = M.key list + + type 'a t = Node of 'a option * 'a t M.t + + let empty = Node (None, M.empty) + +(*s To find a mapping in a trie is easy: when all the elements of the + key have been read, we just inspect the optional info at the + current node; otherwise, we descend in the appropriate sub-trie + using [M.find]. *) + + let rec find l t = match (l,t) with + | [], Node (None,_) -> raise Not_found + | [], Node (Some v,_) -> v + | x::r, Node (_,m) -> find r (M.find x m) + + let rec mem l t = match (l,t) with + | [], Node (None,_) -> false + | [], Node (Some _,_) -> true + | x::r, Node (_,m) -> try mem r (M.find x m) with Not_found -> false + +(*s Insertion is more subtle. When the final node is reached, we just + put the information ([Some v]). Otherwise, we have to insert the + binding in the appropriate sub-trie [t']. But it may not exists, + and in that case [t'] is bound to an empty trie. Then we get a new + sub-trie [t''] by a recursive insertion and we modify the + branching, so that it now points to [t''], with [M.add]. *) + + let add l v t = + let rec ins = function + | [], Node (_,m) -> Node (Some v,m) + | x::r, Node (v,m) -> + let t' = try M.find x m with Not_found -> empty in + let t'' = ins (r,t') in + Node (v, M.add x t'' m) + in + ins (l,t) + +(*s When removing a binding, we take care of not leaving bindings to empty + sub-tries in the nodes. Therefore, we test wether the result [t'] of + the recursive call is the empty trie [empty]: if so, we just remove + the branching with [M.remove]; otherwise, we modify it with [M.add]. *) + + let rec remove l t = match (l,t) with + | [], Node (_,m) -> Node (None,m) + | x::r, Node (v,m) -> + try + let t' = remove r (M.find x m) in + Node (v, if t' = empty then M.remove x m else M.add x t' m) + with Not_found -> + t + +(*s The iterators [map], [mapi], [iter] and [fold] are implemented in + a straigthforward way using the corresponding iterators [M.map], + [M.mapi], [M.iter] and [M.fold]. For the last three of them, + we have to remember the path from the root, as an extra argument + [revp]. Since elements are pushed in reverse order in [revp], + we have to reverse it with [List.rev] when the actual binding + has to be passed to function [f]. *) + + let rec map f = function + | Node (None,m) -> Node (None, M.map (map f) m) + | Node (Some v,m) -> Node (Some (f v), M.map (map f) m) + + let mapi f t = + let rec maprec revp = function + | Node (None,m) -> + Node (None, M.mapi (fun x -> maprec (x::revp)) m) + | Node (Some v,m) -> + Node (Some (f (List.rev revp) v), M.mapi (fun x -> maprec (x::revp)) m) + in + maprec [] t + + let iter f t = + let rec traverse revp = function + | Node (None,m) -> + M.iter (fun x -> traverse (x::revp)) m + | Node (Some v,m) -> + f (List.rev revp) v; M.iter (fun x t -> traverse (x::revp) t) m + in + traverse [] t + + let rec fold f t acc = + let rec traverse revp t acc = match t with + | Node (None,m) -> + M.fold (fun x -> traverse (x::revp)) m acc + | Node (Some v,m) -> + f (List.rev revp) v (M.fold (fun x -> traverse (x::revp)) m acc) + in + traverse [] t acc + + let compare cmp a b = + let rec comp a b = match a,b with + | Node (Some _, _), Node (None, _) -> 1 + | Node (None, _), Node (Some _, _) -> -1 + | Node (None, m1), Node (None, m2) -> + M.compare comp m1 m2 + | Node (Some a, m1), Node (Some b, m2) -> + let c = cmp a b in + if c <> 0 then c else M.compare comp m1 m2 + in + comp a b + + let equal eq a b = + let rec comp a b = match a,b with + | Node (None, m1), Node (None, m2) -> + M.equal comp m1 m2 + | Node (Some a, m1), Node (Some b, m2) -> + eq a b && M.equal comp m1 m2 + | _ -> + false + in + comp a b + + (* The base case is rather stupid, but constructable *) + let is_empty = function + | Node (None, m1) -> M.is_empty m1 + | _ -> false + +end diff --git a/components/extlib/trie.mli b/components/extlib/trie.mli new file mode 100644 index 000000000..b95157fd0 --- /dev/null +++ b/components/extlib/trie.mli @@ -0,0 +1,43 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +module Make : + functor (M : Map.S) -> + sig + type key = M.key list + type 'a t = Node of 'a option * 'a t M.t + val empty : 'a t + val find : M.key list -> 'a t -> 'a + val mem : M.key list -> 'a t -> bool + val add : M.key list -> 'a -> 'a t -> 'a t + val remove : M.key list -> 'a t -> 'a t + val map : ('a -> 'b) -> 'a t -> 'b t + val mapi : (M.key list -> 'a -> 'b) -> 'a t -> 'b t + val iter : (M.key list -> 'a -> 'b) -> 'a t -> unit + val fold : (M.key list -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b + val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int + val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool + val is_empty : 'a t -> bool + end diff --git a/components/getter/.depend b/components/getter/.depend new file mode 100644 index 000000000..20f69cf0c --- /dev/null +++ b/components/getter/.depend @@ -0,0 +1,31 @@ +http_getter_env.cmi: http_getter_types.cmo +http_getter_common.cmi: http_getter_types.cmo +http_getter.cmi: http_getter_types.cmo +http_getter_wget.cmo: http_getter_types.cmo http_getter_wget.cmi +http_getter_wget.cmx: http_getter_types.cmx http_getter_wget.cmi +http_getter_logger.cmo: http_getter_logger.cmi +http_getter_logger.cmx: http_getter_logger.cmi +http_getter_misc.cmo: http_getter_logger.cmi http_getter_misc.cmi +http_getter_misc.cmx: http_getter_logger.cmx http_getter_misc.cmi +http_getter_const.cmo: http_getter_const.cmi +http_getter_const.cmx: http_getter_const.cmi +http_getter_env.cmo: http_getter_types.cmo http_getter_misc.cmi \ + http_getter_logger.cmi http_getter_const.cmi http_getter_env.cmi +http_getter_env.cmx: http_getter_types.cmx http_getter_misc.cmx \ + http_getter_logger.cmx http_getter_const.cmx http_getter_env.cmi +http_getter_storage.cmo: http_getter_wget.cmi http_getter_types.cmo \ + http_getter_misc.cmi http_getter_env.cmi http_getter_storage.cmi +http_getter_storage.cmx: http_getter_wget.cmx http_getter_types.cmx \ + http_getter_misc.cmx http_getter_env.cmx http_getter_storage.cmi +http_getter_common.cmo: http_getter_types.cmo http_getter_misc.cmi \ + http_getter_logger.cmi http_getter_env.cmi http_getter_common.cmi +http_getter_common.cmx: http_getter_types.cmx http_getter_misc.cmx \ + http_getter_logger.cmx http_getter_env.cmx http_getter_common.cmi +http_getter.cmo: http_getter_wget.cmi http_getter_types.cmo \ + http_getter_storage.cmi http_getter_misc.cmi http_getter_logger.cmi \ + http_getter_env.cmi http_getter_const.cmi http_getter_common.cmi \ + http_getter.cmi +http_getter.cmx: http_getter_wget.cmx http_getter_types.cmx \ + http_getter_storage.cmx http_getter_misc.cmx http_getter_logger.cmx \ + http_getter_env.cmx http_getter_const.cmx http_getter_common.cmx \ + http_getter.cmi diff --git a/components/getter/.depend.opt b/components/getter/.depend.opt new file mode 100644 index 000000000..554fb1ec7 --- /dev/null +++ b/components/getter/.depend.opt @@ -0,0 +1,31 @@ +http_getter_env.cmi: http_getter_types.cmx +http_getter_common.cmi: http_getter_types.cmx +http_getter.cmi: http_getter_types.cmx +http_getter_wget.cmo: http_getter_types.cmx http_getter_wget.cmi +http_getter_wget.cmx: http_getter_types.cmx http_getter_wget.cmi +http_getter_logger.cmo: http_getter_logger.cmi +http_getter_logger.cmx: http_getter_logger.cmi +http_getter_misc.cmo: http_getter_logger.cmi http_getter_misc.cmi +http_getter_misc.cmx: http_getter_logger.cmx http_getter_misc.cmi +http_getter_const.cmo: http_getter_const.cmi +http_getter_const.cmx: http_getter_const.cmi +http_getter_env.cmo: http_getter_types.cmx http_getter_misc.cmi \ + http_getter_logger.cmi http_getter_const.cmi http_getter_env.cmi +http_getter_env.cmx: http_getter_types.cmx http_getter_misc.cmx \ + http_getter_logger.cmx http_getter_const.cmx http_getter_env.cmi +http_getter_storage.cmo: http_getter_wget.cmi http_getter_types.cmx \ + http_getter_misc.cmi http_getter_env.cmi http_getter_storage.cmi +http_getter_storage.cmx: http_getter_wget.cmx http_getter_types.cmx \ + http_getter_misc.cmx http_getter_env.cmx http_getter_storage.cmi +http_getter_common.cmo: http_getter_types.cmx http_getter_misc.cmi \ + http_getter_logger.cmi http_getter_env.cmi http_getter_common.cmi +http_getter_common.cmx: http_getter_types.cmx http_getter_misc.cmx \ + http_getter_logger.cmx http_getter_env.cmx http_getter_common.cmi +http_getter.cmo: http_getter_wget.cmi http_getter_types.cmx \ + http_getter_storage.cmi http_getter_misc.cmi http_getter_logger.cmi \ + http_getter_env.cmi http_getter_const.cmi http_getter_common.cmi \ + http_getter.cmi +http_getter.cmx: http_getter_wget.cmx http_getter_types.cmx \ + http_getter_storage.cmx http_getter_misc.cmx http_getter_logger.cmx \ + http_getter_env.cmx http_getter_const.cmx http_getter_common.cmx \ + http_getter.cmi diff --git a/components/getter/.ocamlinit b/components/getter/.ocamlinit new file mode 100644 index 000000000..6512190cd --- /dev/null +++ b/components/getter/.ocamlinit @@ -0,0 +1,3 @@ +#use "topfind";; +#require "helm-getter";; +Helm_registry.load_from "sample.conf.xml";; diff --git a/components/getter/Makefile b/components/getter/Makefile new file mode 100644 index 000000000..0f2132eec --- /dev/null +++ b/components/getter/Makefile @@ -0,0 +1,21 @@ + +PACKAGE = getter + +INTERFACE_FILES = \ + http_getter_wget.mli \ + http_getter_logger.mli \ + http_getter_misc.mli \ + http_getter_const.mli \ + http_getter_env.mli \ + http_getter_storage.mli \ + http_getter_common.mli \ + http_getter.mli \ + $(NULL) + +IMPLEMENTATION_FILES = \ + http_getter_types.ml \ + $(INTERFACE_FILES:%.mli=%.ml) + +include ../../Makefile.defs +include ../Makefile.common + diff --git a/components/getter/http_getter.ml b/components/getter/http_getter.ml new file mode 100644 index 000000000..b41c4788f --- /dev/null +++ b/components/getter/http_getter.ml @@ -0,0 +1,387 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open Http_getter_common +open Http_getter_misc +open Http_getter_types + +exception Not_implemented of string +exception UnexpectedGetterOutput + +type resolve_result = + | Unknown + | Exception of exn + | Resolved of string + +type logger_callback = HelmLogger.html_tag -> unit + +let stdout_logger tag = print_string (HelmLogger.string_of_html_tag tag) + +let not_implemented s = raise (Not_implemented ("Http_getter." ^ s)) + +let index_line_sep_RE = Pcre.regexp "[ \t]+" +let index_sep_RE = Pcre.regexp "\r\n|\r|\n" +let trailing_types_RE = Pcre.regexp "\\.types$" +let heading_cic_RE = Pcre.regexp "^cic:" +let heading_theory_RE = Pcre.regexp "^theory:" +let heading_nuprl_RE = Pcre.regexp "^nuprl:" +let types_RE = Pcre.regexp "\\.types$" +let types_ann_RE = Pcre.regexp "\\.types\\.ann$" +let body_RE = Pcre.regexp "\\.body$" +let body_ann_RE = Pcre.regexp "\\.body\\.ann$" +let proof_tree_RE = Pcre.regexp "\\.proof_tree$" +let proof_tree_ann_RE = Pcre.regexp "\\.proof_tree\\.ann$" +let theory_RE = Pcre.regexp "\\.theory$" +let basepart_RE = Pcre.regexp + "^([^.]*\\.[^.]*)((\\.body)|(\\.proof_tree)|(\\.types))?(\\.ann)?$" +let slash_RE = Pcre.regexp "/" +let pipe_RE = Pcre.regexp "\\|" +let til_slash_RE = Pcre.regexp "^.*/" +let no_slashes_RE = Pcre.regexp "^[^/]*$" +let fix_regexp_RE = Pcre.regexp ("^" ^ (Pcre.quote "(cic|theory)")) +let showable_file_RE = + Pcre.regexp "(\\.con|\\.ind|\\.var|\\.body|\\.types|\\.proof_tree)$" + +let xml_suffix = ".xml" +let theory_suffix = ".theory" + + (* global maps, shared by all threads *) + +let ends_with_slash s = + try + s.[String.length s - 1] = '/' + with Invalid_argument _ -> false + + (* should we use a remote getter or not *) +let remote () = + try + Helm_registry.get "getter.mode" = "remote" + with Helm_registry.Key_not_found _ -> false + +let getter_url () = Helm_registry.get "getter.url" + +(* Remote interface: getter methods implemented using a remote getter *) + + (* *) +let getxml_remote uri = not_implemented "getxml_remote" +let getxslt_remote uri = not_implemented "getxslt_remote" +let getdtd_remote uri = not_implemented "getdtd_remote" +let clean_cache_remote () = not_implemented "clean_cache_remote" +let list_servers_remote () = not_implemented "list_servers_remote" +let add_server_remote ~logger ~position name = + not_implemented "add_server_remote" +let remove_server_remote ~logger position = + not_implemented "remove_server_remote" +let getalluris_remote () = not_implemented "getalluris_remote" +let ls_remote lsuri = not_implemented "ls_remote" +let exists_remote uri = not_implemented "exists_remote" + (* *) + +let resolve_remote ~writable uri = + (* deliver resolve request to http_getter *) + let doc = + Http_getter_wget.get (sprintf "%sresolve?uri=%s&writable=%b" (getter_url ()) + uri writable) + in + let res = ref Unknown in + let start_element tag attrs = + match tag with + | "url" -> + (try + res := Resolved (List.assoc "value" attrs) + with Not_found -> ()) + | "unresolvable" -> res := Exception (Unresolvable_URI uri) + | "not_found" -> res := Exception (Key_not_found uri) + | _ -> () + in + let callbacks = { + XmlPushParser.default_callbacks with + XmlPushParser.start_element = Some start_element + } in + let xml_parser = XmlPushParser.create_parser callbacks in + XmlPushParser.parse xml_parser (`String doc); + XmlPushParser.final xml_parser; + match !res with + | Unknown -> raise UnexpectedGetterOutput + | Exception e -> raise e + | Resolved url -> url + +let deref_index_theory ~local uri = +(* if Http_getter_storage.exists ~local (uri ^ xml_suffix) then uri *) + if is_theory_uri uri && Filename.basename uri = "index.theory" then + strip_trailing_slash (Filename.dirname uri) ^ theory_suffix + else + uri + +(* API *) + +let help () = Http_getter_const.usage_string (Http_getter_env.env_to_string ()) + +let exists ~local uri = +(* prerr_endline ("Http_getter.exists " ^ uri); *) + if remote () then + exists_remote uri + else + let uri = deref_index_theory ~local uri in + Http_getter_storage.exists ~local (uri ^ xml_suffix) + +let is_an_obj s = + try + s <> UriManager.buri_of_uri (UriManager.uri_of_string s) + with UriManager.IllFormedUri _ -> true + +let resolve ~local ~writable uri = + if remote () then + resolve_remote ~writable uri + else + let uri = deref_index_theory ~local uri in + try + if is_an_obj uri then + Http_getter_storage.resolve ~writable ~local (uri ^ xml_suffix) + else + Http_getter_storage.resolve ~writable ~local uri + with Http_getter_storage.Resource_not_found _ -> raise (Key_not_found uri) + +let filename ~local ~writable uri = + if remote () then + raise (Key_not_found uri) + else + let uri = deref_index_theory ~local uri in + try + Http_getter_storage.resolve + ~must_exists:false ~writable ~local uri + with Http_getter_storage.Resource_not_found _ -> raise (Key_not_found uri) + +let getxml uri = + if remote () then getxml_remote uri + else begin + let uri' = deref_index_theory ~local:false uri in + (try + Http_getter_storage.filename ~local:false (uri' ^ xml_suffix) + with Http_getter_storage.Resource_not_found _ -> raise (Key_not_found uri)) + end + +let getxslt uri = + if remote () then getxslt_remote uri + else Http_getter_storage.filename ~local:false ~find:true ("xslt:/" ^ uri) + +let getdtd uri = + if remote () then + getdtd_remote uri + else begin + let fname = Http_getter_env.get_dtd_dir () ^ "/" ^ uri in + if not (Sys.file_exists fname) then raise (Dtd_not_found uri); + fname + end + +let clean_cache () = + if remote () then + clean_cache_remote () + else + Http_getter_storage.clean_cache () + +let (++) (oldann, oldtypes, oldbody, oldtree) + (newann, newtypes, newbody, newtree) = + ((if newann > oldann then newann else oldann), + (if newtypes > oldtypes then newtypes else oldtypes), + (if newbody > oldbody then newbody else oldbody), + (if newtree > oldtree then newtree else oldtree)) + +let store_obj tbl o = +(* prerr_endline ("Http_getter.store_obj " ^ o); *) + if Pcre.pmatch ~rex:showable_file_RE o then begin + let basepart = Pcre.replace ~rex:basepart_RE ~templ:"$1" o in + let no_flags = false, No, No, No in + let oldflags = + try + Hashtbl.find tbl basepart + with Not_found -> (* no ann, no types, no body, no proof tree *) + no_flags + in + let newflags = + match o with + | s when Pcre.pmatch ~rex:types_RE s -> (false, Yes, No, No) + | s when Pcre.pmatch ~rex:types_ann_RE s -> (true, Ann, No, No) + | s when Pcre.pmatch ~rex:body_RE s -> (false, No, Yes, No) + | s when Pcre.pmatch ~rex:body_ann_RE s -> (true, No, Ann, No) + | s when Pcre.pmatch ~rex:proof_tree_RE s -> (false, No, No, Yes) + | s when Pcre.pmatch ~rex:proof_tree_ann_RE s -> (true, No, No, Ann) + | s -> no_flags + in + Hashtbl.replace tbl basepart (oldflags ++ newflags) + end + +let store_dir set_ref d = + set_ref := StringSet.add (List.hd (Pcre.split ~rex:slash_RE d)) !set_ref + +let collect_ls_items dirs_set objs_tbl = + let items = ref [] in + StringSet.iter (fun dir -> items := Ls_section dir :: !items) dirs_set; + Http_getter_misc.hashtbl_sorted_iter + (fun uri (annflag, typesflag, bodyflag, treeflag) -> + items := + Ls_object { + uri = uri; ann = annflag; + types = typesflag; body = bodyflag; proof_tree = treeflag + } :: !items) + objs_tbl; + List.rev !items + +let contains_object = (<>) [] + + (** non regexp-aware version of ls *) +let rec dumb_ls ~local uri_prefix = +(* prerr_endline ("Http_getter.dumb_ls " ^ uri_prefix); *) + if is_cic_obj_uri uri_prefix then begin + let dirs = ref StringSet.empty in + let objs = Hashtbl.create 17 in + List.iter + (fun fname -> + if ends_with_slash fname then + store_dir dirs fname + else + try + store_obj objs (strip_suffix ~suffix:xml_suffix fname) + with Invalid_argument _ -> ()) + (Http_getter_storage.ls ~local uri_prefix); + collect_ls_items !dirs objs + end else if is_theory_uri uri_prefix then begin + let items = ref [] in + let add_theory fname = + items := + Ls_object { + uri = fname; ann = false; types = No; body = No; proof_tree = No } + :: !items + in + let cic_uri_prefix = + Pcre.replace_first ~rex:heading_theory_RE ~templ:"cic:" uri_prefix + in + List.iter + (fun fname -> + if ends_with_slash fname then + items := Ls_section (strip_trailing_slash fname) :: !items + else + try + let fname = strip_suffix ~suffix:xml_suffix fname in + let theory_name = strip_suffix ~suffix:theory_suffix fname in + let sub_theory = normalize_dir cic_uri_prefix ^ theory_name ^ "/" in + if is_empty_theory ~local sub_theory then add_theory fname + with Invalid_argument _ -> ()) + (Http_getter_storage.ls ~local uri_prefix); + (try + if contains_object (dumb_ls ~local cic_uri_prefix) + && exists ~local:false (strip_trailing_slash uri_prefix ^ theory_suffix) + then + add_theory "index.theory"; + with Unresolvable_URI _ -> ()); + !items + end else + raise (Invalid_URI uri_prefix) + +and is_empty_theory ~local uri_prefix = +(* prerr_endline ("is_empty_theory " ^ uri_prefix); *) + not (contains_object (dumb_ls ~local uri_prefix)) + + (* handle simple regular expressions of the form "...(..|..|..)..." on cic + * uris, not meant to be a real implementation of regexp. The only we use is + * "(cic|theory):/..." *) +let explode_ls_regexp regexp = + try + let len = String.length regexp in + let lparen_idx = String.index regexp '(' in + let rparen_idx = String.index_from regexp lparen_idx ')' in + let choices_str = (* substring between parens, parens excluded *) + String.sub regexp (lparen_idx + 1) (rparen_idx - lparen_idx - 1) + in + let choices = Pcre.split ~rex:pipe_RE choices_str in + let prefix = String.sub regexp 0 lparen_idx in + let suffix = String.sub regexp (rparen_idx + 1) (len - (rparen_idx + 1)) in + List.map (fun choice -> prefix ^ choice ^ suffix) choices + with Not_found -> [regexp] + +let merge_results results = + let rec aux objects_acc dirs_acc = function + | [] -> dirs_acc @ objects_acc + | Ls_object _ as obj :: tl -> aux (obj :: objects_acc) dirs_acc tl + | Ls_section _ as dir :: tl -> + if List.mem dir dirs_acc then (* filters out dir duplicates *) + aux objects_acc dirs_acc tl + else + aux objects_acc (dir :: dirs_acc) tl + in + aux [] [] (List.concat results) + +let ls ~local regexp = + if remote () then + ls_remote regexp + else + let prefixes = explode_ls_regexp regexp in + merge_results (List.map (dumb_ls ~local) prefixes) + +let getalluris () = + let rec aux acc = function + | [] -> acc + | dir :: todo -> + let acc', todo' = + List.fold_left + (fun (acc, subdirs) result -> + match result with + | Ls_object obj -> (dir ^ obj.uri) :: acc, subdirs + | Ls_section sect -> acc, (dir ^ sect ^ "/") :: subdirs) + (acc, todo) + (dumb_ls ~local:false dir) + in + aux acc' todo' + in + aux [] ["cic:/"] (* trailing slash required *) + +(* Shorthands from now on *) + +let getxml' uri = getxml (UriManager.string_of_uri uri) +let resolve' ~local ~writable uri = + resolve ~local ~writable (UriManager.string_of_uri uri) +;; +let exists' ~local uri = exists ~local (UriManager.string_of_uri uri) +let filename' ~local ~writable uri = + filename ~local ~writable (UriManager.string_of_uri uri) +;; + +let tilde_expand_key k = + try + Helm_registry.set k (HExtlib.tilde_expand (Helm_registry.get k)) + with Helm_registry.Key_not_found _ -> () + +let init () = + List.iter tilde_expand_key ["getter.cache_dir"; "getter.dtd_dir"]; + Http_getter_logger.set_log_level + (Helm_registry.get_opt_default Helm_registry.int ~default:1 + "getter.log_level"); + Http_getter_logger.set_log_file + (Helm_registry.get_opt Helm_registry.string "getter.log_file") + diff --git a/components/getter/http_getter.mli b/components/getter/http_getter.mli new file mode 100644 index 000000000..5cf5cd38e --- /dev/null +++ b/components/getter/http_getter.mli @@ -0,0 +1,71 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Http_getter_types + + (** {2 Loggers} *) + +type logger_callback = HelmLogger.html_tag -> unit + +val stdout_logger: logger_callback + + (** {2 Getter Web Service interface as API *) + +val help: unit -> string + + (** @raise Http_getter_types.Unresolvable_URI _ + * @raise Http_getter_types.Key_not_found _ *) +val resolve: local:bool -> writable:bool -> string -> string (* uri -> url *) + + (** as resolve, but does not check if the resource exists + * @raise Http_getter_types.Key_not_found *) +val filename: local:bool -> writable:bool -> string -> string (* uri -> url *) + +val exists: local:bool -> string -> bool + +val getxml : string -> string +val getxslt : string -> string +val getdtd : string -> string +val clean_cache: unit -> unit +val getalluris: unit -> string list + + (** @param baseuri uri to be listed, simple form or regular expressions (a + * single choice among parens) are permitted *) +val ls: local:bool -> string -> ls_item list + + (** {2 UriManager shorthands} *) + +val getxml' : UriManager.uri -> string +val resolve' : local:bool -> writable:bool -> UriManager.uri -> string +val exists' : local:bool -> UriManager.uri -> bool +val filename' : local:bool -> writable:bool -> UriManager.uri -> string + + (** {2 Misc} *) + +val init: unit -> unit + diff --git a/components/getter/http_getter_common.ml b/components/getter/http_getter_common.ml new file mode 100644 index 000000000..ddce33f5d --- /dev/null +++ b/components/getter/http_getter_common.ml @@ -0,0 +1,167 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Http_getter_types;; +open Printf;; + +let string_of_ls_flag = function No -> "NO" | Yes -> "YES" | Ann -> "ANN" +let string_of_encoding = function + | `Normal -> "Normal" + | `Gzipped -> "GZipped" + +let is_cic_obj_uri uri = Pcre.pmatch ~pat:"^cic:" uri +let is_theory_uri uri = Pcre.pmatch ~pat:"^theory:" uri +let is_cic_uri uri = is_cic_obj_uri uri || is_theory_uri uri +let is_nuprl_uri uri = Pcre.pmatch ~pat:"^nuprl:" uri +let is_rdf_uri uri = Pcre.pmatch ~pat:"^helm:rdf(.*):(.*)//(.*)" uri +let is_xsl_uri uri = Pcre.pmatch ~pat:"^\\w+\\.xsl" uri + +let rec uri_of_string = function + | uri when is_rdf_uri uri -> + (match Pcre.split ~pat:"//" uri with + | [ prefix; uri ] -> + let rest = + match uri_of_string uri with + | Cic_uri xmluri -> xmluri + | _ -> raise (Invalid_URI uri) + in + Rdf_uri (prefix, rest) + | _ -> raise (Invalid_URI uri)) + | uri when is_cic_obj_uri uri -> Cic_uri (Cic (Pcre.replace ~pat:"^cic:" uri)) + | uri when is_nuprl_uri uri -> Nuprl_uri (Pcre.replace ~pat:"^nuprl:" uri) + | uri when is_theory_uri uri -> + Cic_uri (Theory (Pcre.replace ~pat:"^theory:" uri)) + | uri -> raise (Invalid_URI uri) + +let patch_xsl ?(via_http = true) () = + fun line -> + let mk_patch_fun tag line = + Pcre.replace + ~pat:(sprintf "%s\\s+href=\"" tag) + ~templ:(sprintf "%s href=\"%s/getxslt?uri=" + tag (Lazy.force Http_getter_env.my_own_url)) + line + in + let (patch_import, patch_include) = + (mk_patch_fun "xsl:import", mk_patch_fun "xsl:include") + in + patch_include (patch_import line) + +let patch_system kind ?(via_http = true) () = + let rex = + Pcre.regexp (sprintf "%s (.*) SYSTEM\\s+\"((%s)/)?" kind + (String.concat "|" (Lazy.force Http_getter_env.dtd_base_urls))) + in + let templ = + if via_http then + sprintf "%s $1 SYSTEM \"%s/getdtd?uri=" kind + (Lazy.force Http_getter_env.my_own_url) + else + sprintf "%s $1 SYSTEM \"file://%s/" kind (Http_getter_env.get_dtd_dir ()) + in + fun line -> Pcre.replace ~rex ~templ line + +let patch_entity = patch_system "ENTITY" +let patch_doctype = patch_system "DOCTYPE" + +let patch_xmlbase = + let rex = Pcre.regexp "^(\\s*<\\w[^ ]*)(\\s|>)" in + fun xmlbases baseurl baseuri s -> + let s' = + Pcre.replace ~rex + ~templ:(sprintf "$1 xml:base=\"%s\" helm:base=\"%s\"$2" baseurl baseuri) + s + in + if s <> s' then xmlbases := None; + s' + +let patch_dtd = patch_entity +let patch_xml ?via_http ?xmlbases () = + let xmlbases = ref xmlbases in + fun line -> + match !xmlbases with + | None -> patch_doctype ?via_http () (patch_entity ?via_http () line) + | Some (xmlbaseuri, xmlbaseurl) -> + patch_xmlbase xmlbases xmlbaseurl xmlbaseuri + (patch_doctype ?via_http () (patch_entity ?via_http () line)) + +let return_file + ~fname ?contype ?contenc ?patch_fun ?(gunzip = false) ?(via_http = true) + ~enc outchan += + if via_http then begin + let headers = + match (contype, contenc) with + | (Some t, Some e) -> ["Content-Encoding", e; "Content-Type", t] + | (Some t, None) -> ["Content-Type" , t] + | (None, Some e) -> ["Content-Encoding", e] + | (None, None) -> [] + in + Http_daemon.send_basic_headers ~code:(`Code 200) outchan; + Http_daemon.send_headers headers outchan; + Http_daemon.send_CRLF outchan + end; + match gunzip, patch_fun with + | true, Some patch_fun -> + Http_getter_logger.log ~level:2 + "Patch required, uncompress/compress cycle needed :-("; + (* gunzip needed, uncompress file, apply patch_fun to it, compress the + * result and sent it to client *) + let (tmp1, tmp2) = + (Http_getter_misc.tempfile (), Http_getter_misc.tempfile ()) + in + (try + Http_getter_misc.gunzip ~keep:true ~output:tmp1 fname; (* gunzip tmp1 *) + let new_file = open_out tmp2 in + Http_getter_misc.iter_file (* tmp2 = patch(tmp1) *) + (fun line -> + output_string new_file (patch_fun line ^ "\n"); + flush outchan) + tmp1; + close_out new_file; + Http_getter_misc.gzip ~output:tmp1 tmp2;(* tmp1 = gzip(tmp2); rm tmp2 *) + Http_getter_misc.iter_file (* send tmp1 to client as is*) + (fun line -> output_string outchan (line ^ "\n"); flush outchan) + tmp1; + Sys.remove tmp1 (* rm tmp1 *) + with e -> + Sys.remove tmp1; + raise e) + | false, Some patch_fun -> + (match enc with + | `Normal -> + Http_getter_misc.iter_file + (fun line -> output_string outchan (patch_fun (line ^ "\n"))) + fname + | `Gzipped -> assert false) + (* dangerous case, if this happens it needs to be investigated *) + | _, None -> Http_getter_misc.iter_file_data (output_string outchan) fname +;; + diff --git a/components/getter/http_getter_common.mli b/components/getter/http_getter_common.mli new file mode 100644 index 000000000..d1bc66f76 --- /dev/null +++ b/components/getter/http_getter_common.mli @@ -0,0 +1,70 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Http_getter_types;; + +val string_of_ls_flag: ls_flag -> string +val string_of_encoding: encoding -> string + +val is_cic_uri: string -> bool +val is_cic_obj_uri: string -> bool +val is_theory_uri: string -> bool +val is_nuprl_uri: string -> bool +val is_rdf_uri: string -> bool +val is_xsl_uri: string -> bool + +val uri_of_string: string -> uri + + (** @param xmlbases (xml base URI * xml base URL) *) +val patch_xml : + ?via_http:bool -> ?xmlbases:(string * string) -> unit -> (string -> string) +val patch_dtd : ?via_http:bool -> unit -> (string -> string) + (* TODO via_http not yet supported for patch_xsl *) +val patch_xsl : ?via_http:bool -> unit -> (string -> string) + + (** + @param fname name of the file to be sent + @param contype Content-Type header value + @param contenc Content-Enconding header value + @param patch_fun function used to patch file contents + @param gunzip is meaningful only if a patch function is provided. If gunzip + is true and patch_fun is given (i.e. is not None), then patch_fun is applied + to the uncompressed version of the file. The file is then compressed again and + send to client + @param via_http (default: true) if true http specific communications are used + (e.g. headers, crlf before body) and sent via outchan, otherwise they're not. + Set it to false when saving to a local file + @param outchan output channel over which sent file fname *) +val return_file: + fname:string -> + ?contype:string -> ?contenc:string -> + ?patch_fun:(string -> string) -> ?gunzip:bool -> ?via_http:bool -> + enc:encoding -> + out_channel -> + unit + diff --git a/components/getter/http_getter_const.ml b/components/getter/http_getter_const.ml new file mode 100644 index 000000000..8103efcfa --- /dev/null +++ b/components/getter/http_getter_const.ml @@ -0,0 +1,102 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf;; + +let version = "0.4.0" +let conffile = "http_getter.conf.xml" + +let xhtml_ns = "http://www.w3.org/1999/xhtml" +let helm_ns = "http://www.cs.unibo.it/helm" + + (* TODO provide a better usage string *) +let usage_string configuration = + sprintf +" + + + HTTP Getter's help message + + +

HTTP Getter, version %s

+

Usage information

+

+ Usage: http://hostname:getterport/command +

+

+ Available commands: +

+

+ help
+ display this help message +

+

+ getxml?uri=URI[&format=(normal|gz)][&patch_dtd=(yes|no)]
+

+

+ resolve?uri=URI
+

+

+ getdtd?uri=URI[&patch_dtd=(yes|no)]
+

+

+ getxslt?uri=URI[&patch_dtd=(yes|no)]
+

+

+ update
+

+

+ clean_cache
+

+

+ ls?baseuri=regexp&format=(txt|xml)
+

+

+ getalluris?format=(txt|xml)
+

+

+ getempty
+

+

Current configuration

+
%s
+ + +" + xhtml_ns helm_ns + version configuration + +let empty_xml = +" + +]> + +" + diff --git a/components/getter/http_getter_const.mli b/components/getter/http_getter_const.mli new file mode 100644 index 000000000..d532313f0 --- /dev/null +++ b/components/getter/http_getter_const.mli @@ -0,0 +1,39 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val version: string +val conffile: string +val empty_xml: string + +val helm_ns: string (** helm namespace *) +val xhtml_ns: string (** xhtml namespace *) + + (** @return an HTML usage string including configuration information passed as + input parameter *) +val usage_string: string -> string + diff --git a/components/getter/http_getter_env.ml b/components/getter/http_getter_env.ml new file mode 100644 index 000000000..af5896ea8 --- /dev/null +++ b/components/getter/http_getter_env.ml @@ -0,0 +1,123 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open Http_getter_types +open Http_getter_misc + +let version = Http_getter_const.version + +let prefix_RE = Pcre.regexp "^\\s*([^\\s]+)\\s+([^\\s]+)\\s*(.*)$" + +let cache_dir = lazy (normalize_dir (Helm_registry.get "getter.cache_dir")) +let dtd_dir = lazy ( + match Helm_registry.get_opt Helm_registry.string "getter.dtd_dir" with + | None -> None + | Some dir -> Some (normalize_dir dir)) +let dtd_base_urls = lazy ( + let rex = Pcre.regexp "/*$" in + let raw_urls = + match + Helm_registry.get_list Helm_registry.string "getter.dtd_base_urls" + with + | [] -> ["http://helm.cs.unibo.it/dtd"; "http://mowgli.cs.unibo.it/dtd"] + | urls -> urls + in + List.map (Pcre.replace ~rex) raw_urls) +let port = lazy ( + Helm_registry.get_opt_default Helm_registry.int ~default:58081 "getter.port") + +let parse_prefix_attrs s = + List.fold_right + (fun s acc -> + match s with + | "ro" -> `Read_only :: acc + | "legacy" -> `Legacy :: acc + | s -> + Http_getter_logger.log ("ignoring unknown attribute: " ^ s); + acc) + (Pcre.split s) [] + +let prefixes = lazy ( + let prefixes = Helm_registry.get_list Helm_registry.string "getter.prefix" in + List.fold_left + (fun acc prefix -> + let subs = Pcre.extract ~rex:prefix_RE prefix in + try + (subs.(1), (subs.(2), parse_prefix_attrs subs.(3))) :: acc + with Invalid_argument _ -> + Http_getter_logger.log ("skipping invalid prefix: " ^ prefix); + acc) + [] prefixes) + +let host = lazy (Http_getter_misc.backtick "hostname -f") + +let my_own_url = + lazy + (let (host, port) = (Lazy.force host, Lazy.force port) in + sprintf "http://%s%s" (* without trailing '/' *) + host (if port = 80 then "" else (sprintf ":%d" port))) + +let env_to_string () = + let pp_attr = function `Read_only -> "ro" | `Legacy -> "legacy" in + let pp_prefix (uri_prefix, (url_prefix, attrs)) = + sprintf " %s -> %s [%s]" uri_prefix url_prefix + (String.concat "," (List.map pp_attr attrs)) in + let pp_prefixes prefixes = + match prefixes with + | [] -> "" + | l -> "\n" ^ String.concat "\n" (List.map pp_prefix l) + in + sprintf +"HTTP Getter %s + +prefixes:%s +dtd_dir:\t%s +host:\t\t%s +port:\t\t%d +my_own_url:\t%s +dtd_base_urls:\t%s +log_file:\t%s +log_level:\t%d +" + version + (pp_prefixes (Lazy.force prefixes)) + (match Lazy.force dtd_dir with Some dir -> dir | None -> "NONE") + (Lazy.force host) (Lazy.force port) + (Lazy.force my_own_url) (String.concat " " (Lazy.force dtd_base_urls)) + (match Http_getter_logger.get_log_file () with None -> "None" | Some f -> f) + (Http_getter_logger.get_log_level ()) + +let get_dtd_dir () = + match Lazy.force dtd_dir with + | None -> raise (Internal_error "dtd_dir is not available") + | Some dtd_dir -> dtd_dir + diff --git a/components/getter/http_getter_env.mli b/components/getter/http_getter_env.mli new file mode 100644 index 000000000..d1ab73db8 --- /dev/null +++ b/components/getter/http_getter_env.mli @@ -0,0 +1,54 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Http_getter_types + + (** {2 general information} *) + +val version : string (* getter version *) + + (** {2 environment gathered data} *) + (** all *_dir values are returned with trailing "/" *) + +val cache_dir : string lazy_t (* cache root *) +val dtd_dir : string option lazy_t (* DTDs' root directory *) +val port : int lazy_t (* port on which getter listens *) +val dtd_base_urls : string list lazy_t (* base URLs for document patching *) +val prefixes : (string * (string * prefix_attr list)) list lazy_t + (* prefix map uri -> url + attrs *) + + (* {2 derived data} *) + +val host : string lazy_t (* host on which getter listens *) +val my_own_url : string lazy_t (* URL at which contact getter *) + + (* {2 misc} *) + +val env_to_string : unit -> string (* dump a textual representation of the + current http_getter settings on an output + channel *) + +val get_dtd_dir : unit -> string + diff --git a/components/getter/http_getter_logger.ml b/components/getter/http_getter_logger.ml new file mode 100644 index 000000000..1d774c102 --- /dev/null +++ b/components/getter/http_getter_logger.ml @@ -0,0 +1,63 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let log_level = ref 1 +let get_log_level () = !log_level +let set_log_level l = log_level := l + +(* invariant: if logfile is set, then logchan is set too *) +let logfile = ref None +let logchan = ref None + +let set_log_file f = + (match !logchan with None -> () | Some oc -> close_out oc); + match f with + | Some f -> + logfile := Some f; + logchan := Some (open_out f) + | None -> + logfile := None; + logchan := None + +let get_log_file () = !logfile + +let close_log_file () = set_log_file None + +let log ?(level = 1) s = + if level <= !log_level then + let msg = "[HTTP-Getter] " ^ s in + match (!logfile, !logchan) with + | None, _ -> prerr_endline msg + | Some fname, Some oc -> + output_string oc msg; + output_string oc "\n"; + flush oc + | Some _, None -> assert false + diff --git a/components/getter/http_getter_logger.mli b/components/getter/http_getter_logger.mli new file mode 100644 index 000000000..d39fe739d --- /dev/null +++ b/components/getter/http_getter_logger.mli @@ -0,0 +1,49 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 Debugger and logger} *) + + (** log level + * 0 -> logging disabled + * 1 -> standard logging + * >=2 -> verbose logging + * default is 1 *) +val get_log_level: unit -> int +val set_log_level: int -> unit + + (** log a message through the logger with a given log level + * level defaults to 1, higher level denotes more verbose messages which are + * ignored with the default log_level *) +val log: ?level: int -> string -> unit + + (** if set to Some fname, fname will be used as a logfile, otherwise stderr + * will be used *) +val get_log_file: unit -> string option +val set_log_file: string option -> unit +val close_log_file: unit -> unit + diff --git a/components/getter/http_getter_misc.ml b/components/getter/http_getter_misc.ml new file mode 100644 index 000000000..f7dffd066 --- /dev/null +++ b/components/getter/http_getter_misc.ml @@ -0,0 +1,315 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let file_scheme_prefix = "file://" + +let trailing_dot_gz_RE = Pcre.regexp "\\.gz$" (* for g{,un}zip *) +let url_RE = Pcre.regexp "^([\\w.-]+)(:(\\d+))?(/.*)?$" +let http_scheme_RE = Pcre.regexp ~flags:[`CASELESS] "^http://" +let file_scheme_RE = Pcre.regexp ~flags:[`CASELESS] ("^" ^ file_scheme_prefix) +let dir_sep_RE = Pcre.regexp "/" +let heading_slash_RE = Pcre.regexp "^/" + +let local_url = + let rex = Pcre.regexp ("^(" ^ file_scheme_prefix ^ ")(.*)(.gz)$") in + fun s -> + try + Some ((Pcre.extract ~rex s).(2)) + with Not_found -> None + +let bufsiz = 16384 (* for file system I/O *) +let tcp_bufsiz = 4096 (* for TCP I/O *) + +let fold_file f init fname = + let ic = open_in fname in + let rec aux acc = + let line = try Some (input_line ic) with End_of_file -> None in + match line with + | None -> acc + | Some line -> aux (f line acc) + in + let res = try aux init with e -> close_in ic; raise e in + close_in ic; + res + +let iter_file f = fold_file (fun line _ -> f line) () + +let iter_buf_size = 10240 + +let iter_file_data f fname = + let ic = open_in fname in + let buf = String.create iter_buf_size in + try + while true do + let bytes = input ic buf 0 iter_buf_size in + if bytes = 0 then raise End_of_file; + f (String.sub buf 0 bytes) + done + with End_of_file -> close_in ic + +let hashtbl_sorted_fold f tbl init = + let sorted_keys = + List.sort compare (Hashtbl.fold (fun key _ keys -> key::keys) tbl []) + in + List.fold_left (fun acc k -> f k (Hashtbl.find tbl k) acc) init sorted_keys + +let hashtbl_sorted_iter f tbl = + let sorted_keys = + List.sort compare (Hashtbl.fold (fun key _ keys -> key::keys) tbl []) + in + List.iter (fun k -> f k (Hashtbl.find tbl k)) sorted_keys + +let cp src dst = + try + let ic = open_in src in + try + let oc = open_out dst in + let buf = String.create bufsiz in + (try + while true do + let bytes = input ic buf 0 bufsiz in + if bytes = 0 then raise End_of_file else output oc buf 0 bytes + done + with + End_of_file -> () + ); + close_in ic; close_out oc + with + Sys_error s -> + Http_getter_logger.log s; + close_in ic + | e -> + Http_getter_logger.log (Printexc.to_string e); + close_in ic; + raise e + with + Sys_error s -> + Http_getter_logger.log s + | e -> + Http_getter_logger.log (Printexc.to_string e); + raise e + +let wget ?output url = + Http_getter_logger.log + (sprintf "wgetting %s (output: %s)" url + (match output with None -> "default" | Some f -> f)); + match url with + | url when Pcre.pmatch ~rex:file_scheme_RE url -> (* file:// *) + (let src_fname = Pcre.replace ~rex:file_scheme_RE url in + match output with + | Some dst_fname -> cp src_fname dst_fname + | None -> + let dst_fname = Filename.basename src_fname in + if src_fname <> dst_fname then + cp src_fname dst_fname + else (* src and dst are the same: do nothing *) + ()) + | url when Pcre.pmatch ~rex:http_scheme_RE url -> (* http:// *) + (let oc = + open_out (match output with Some f -> f | None -> Filename.basename url) + in + Http_user_agent.get_iter (fun data -> output_string oc data) url; + close_out oc) + | scheme -> (* unsupported scheme *) + failwith ("Http_getter_misc.wget: unsupported scheme: " ^ scheme) + +let gzip ?(keep = false) ?output fname = + let output = match output with None -> fname ^ ".gz" | Some fname -> fname in + Http_getter_logger.log ~level:3 + (sprintf "gzipping %s (keep: %b, output: %s)" fname keep output); + let (ic, oc) = (open_in fname, Gzip.open_out output) in + let buf = String.create bufsiz in + (try + while true do + let bytes = input ic buf 0 bufsiz in + if bytes = 0 then raise End_of_file else Gzip.output oc buf 0 bytes + done + with End_of_file -> ()); + close_in ic; Gzip.close_out oc; + if not keep then Sys.remove fname +;; + +let gunzip ?(keep = false) ?output fname = + (* assumption: given file name ends with ".gz" or output is set *) + let output = + match output with + | None -> + if (Pcre.pmatch ~rex:trailing_dot_gz_RE fname) then + Pcre.replace ~rex:trailing_dot_gz_RE fname + else + failwith + "Http_getter_misc.gunzip: unable to determine output file name" + | Some fname -> fname + in + Http_getter_logger.log ~level:3 + (sprintf "gunzipping %s (keep: %b, output: %s)" fname keep output); + (* Open the zipped file manually since Gzip.open_in may + * leak the descriptor if it raises an exception *) + let zic = open_in fname in + begin + try + let ic = Gzip.open_in_chan zic in + let oc = open_out output in + let buf = String.create bufsiz in + (try + while true do + let bytes = Gzip.input ic buf 0 bufsiz in + if bytes = 0 then raise End_of_file else Pervasives.output oc buf 0 bytes + done + with End_of_file -> ()); + close_out oc; + Gzip.close_in ic + with + e -> close_in zic ; raise e + end ; + if not keep then Sys.remove fname +;; + +let tempfile () = Filename.temp_file "http_getter_" "" + +exception Mkdir_failure of string * string;; (* dirname, failure reason *) +let dir_perm = 0o755 + +let mkdir ?(parents = false) dirname = + let mkdirhier () = + let (pieces, hd) = + let split = Pcre.split ~rex:dir_sep_RE dirname in + if Pcre.pmatch ~rex:heading_slash_RE dirname then + (List.tl split, "/") + else + (split, "") + in + ignore + (List.fold_left + (fun pre dir -> + let next_dir = + sprintf "%s%s%s" pre (match pre with "/" | "" -> "" | _ -> "/") dir + in + (try + (match (Unix.stat next_dir).Unix.st_kind with + | Unix.S_DIR -> () (* dir component already exists, go on! *) + | _ -> (* dir component already exists but isn't a dir, abort! *) + raise + (Mkdir_failure (dirname, + sprintf "'%s' already exists but is not a dir" next_dir))) + with Unix.Unix_error (Unix.ENOENT, "stat", _) -> + (* dir component doesn't exists, create it and go on! *) + Unix.mkdir next_dir dir_perm); + next_dir) + hd pieces) + in + if parents then mkdirhier () else Unix.mkdir dirname dir_perm + +let string_of_proc_status = function + | Unix.WEXITED code -> sprintf "[Exited: %d]" code + | Unix.WSIGNALED sg -> sprintf "[Killed: %d]" sg + | Unix.WSTOPPED sg -> sprintf "[Stopped: %d]" sg + +let http_get url = + if Pcre.pmatch ~rex:file_scheme_RE url then begin + (* file:// URL. Read data from file system *) + let fname = Pcre.replace ~rex:file_scheme_RE url in + try + let size = (Unix.stat fname).Unix.st_size in + let buf = String.create size in + let ic = open_in fname in + really_input ic buf 0 size ; + close_in ic; + Some buf + with Unix.Unix_error (Unix.ENOENT, "stat", _) -> None + end else (* other URL, pass it to Http_user_agent *) + try + Some (Http_user_agent.get url) + with e -> + Http_getter_logger.log (sprintf + "Warning: Http_user_agent failed on url %s with exception: %s" + url (Printexc.to_string e)); + None + +let is_blank_line = + let blank_line_RE = Pcre.regexp "(^#)|(^\\s*$)" in + fun line -> + Pcre.pmatch ~rex:blank_line_RE line + +let normalize_dir s = (* append "/" if missing *) + let len = String.length s in + try + if s.[len - 1] = '/' then s + else s ^ "/" + with Invalid_argument _ -> (* string is empty *) "/" + +let strip_trailing_slash s = + try + let len = String.length s in + if s.[len - 1] = '/' then String.sub s 0 (len - 1) + else s + with Invalid_argument _ -> s + +let strip_suffix ~suffix s = + try + let s_len = String.length s in + let suffix_len = String.length suffix in + let suffix_sub = String.sub s (s_len - suffix_len) suffix_len in + if suffix_sub <> suffix then raise (Invalid_argument "Http_getter_misc.strip_suffix"); + String.sub s 0 (s_len - suffix_len) + with Invalid_argument _ -> + raise (Invalid_argument "Http_getter_misc.strip_suffix") + +let rec list_uniq = function + | [] -> [] + | h::[] -> [h] + | h1::h2::tl when h1 = h2 -> list_uniq (h2 :: tl) + | h1::tl (* when h1 <> h2 *) -> h1 :: list_uniq tl + +let extension s = + try + let idx = String.rindex s '.' in + String.sub s idx (String.length s - idx) + with Not_found -> "" + +let temp_file_of_uri uri = + let flat_string s s' c = + let cs = String.copy s in + for i = 0 to (String.length s) - 1 do + if String.contains s' s.[i] then cs.[i] <- c + done; + cs + in + let user = try Unix.getlogin () with _ -> "" in + Filename.open_temp_file (user ^ flat_string uri ".-=:;!?/&" '_') "" + +let backtick cmd = + let ic = Unix.open_process_in cmd in + let res = input_line ic in + ignore (Unix.close_process_in ic); + res + diff --git a/components/getter/http_getter_misc.mli b/components/getter/http_getter_misc.mli new file mode 100644 index 000000000..e9b013ebd --- /dev/null +++ b/components/getter/http_getter_misc.mli @@ -0,0 +1,102 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** 'mkdir' failed, arguments are: name of the directory to be created and + failure reason *) +exception Mkdir_failure of string * string + + (** @return Some localpart for URI belonging to the "file://" scheme, None for + * other URIs + * removes trailing ".gz", if any + * e.g.: local_url "file:///etc/passwd.gz" = Some "/etc/passwd" + * local_url "http://...." = None *) +val local_url: string -> string option + + (** "fold_left" like function on file lines, trailing newline is not passed to + the given function *) +val fold_file : (string -> 'a -> 'a) -> 'a -> string -> 'a + + (* "iter" like function on file lines, trailing newline is not passed to the + given function *) +val iter_file : (string -> unit) -> string -> unit + + (* "iter" like function on file data chunks of fixed size *) +val iter_file_data: (string -> unit) -> string -> unit + + (** like Hashtbl.fold but keys are processed ordered *) +val hashtbl_sorted_fold : + ('a -> 'b -> 'c -> 'c) -> ('a, 'b) Hashtbl.t -> 'c -> 'c + (** like Hashtbl.iter but keys are processed ordered *) +val hashtbl_sorted_iter : ('a -> 'b -> unit) -> ('a, 'b) Hashtbl.t -> unit + +val list_uniq: 'a list -> 'a list (* uniq unix filter on lists *) + + (** cp frontend *) +val cp: string -> string -> unit + (** wget frontend, if output is given it is the destination file, otherwise + standard wget rules are used. Additionally this function support also the + "file://" scheme for file system addressing *) +val wget: ?output: string -> string -> unit + (** gzip frontend. If keep = true original file will be kept, default is + false. output is the file on which gzipped data will be saved, default is + given file with an added ".gz" suffix *) +val gzip: ?keep: bool -> ?output: string -> string -> unit + (** gunzip frontend. If keep = true original file will be kept, default is + false. output is the file on which gunzipped data will be saved, default is + given file name without trailing ".gz" *) +val gunzip: ?keep: bool -> ?output: string -> string -> unit + (** tempfile frontend, return the name of created file. A special purpose + suffix is used (actually "_http_getter" *) +val tempfile: unit -> string + (** mkdir frontend, if parents = true also parent directories will be created. + If the given directory already exists doesn't act. + parents defaults to false *) +val mkdir: ?parents:bool -> string -> unit + + (** pretty printer for Unix.process_status values *) +val string_of_proc_status : Unix.process_status -> string + + (** raw URL downloader, return Some the contents of downloaded resource or + None if an error occured while downloading. This function support also + "file://" scheme for filesystem resources *) +val http_get: string -> string option + + (** true on blanks-only and #-commented lines, false otherwise *) +val is_blank_line: string -> bool + +val normalize_dir: string -> string (** add trailing "/" if missing *) +val strip_trailing_slash: string -> string +val strip_suffix: suffix:string -> string -> string + +val extension: string -> string (** @return string part after rightmost "." *) + +val temp_file_of_uri: string -> string * out_channel + + (** execute a command and return first line of what it prints on stdout *) +val backtick: string -> string + diff --git a/components/getter/http_getter_storage.ml b/components/getter/http_getter_storage.ml new file mode 100644 index 000000000..c17435f6a --- /dev/null +++ b/components/getter/http_getter_storage.ml @@ -0,0 +1,447 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open Http_getter_misc +open Http_getter_types + +exception Not_found' +exception Resource_not_found of string * string (** method, uri *) + +let index_fname = "INDEX" + +(******************************* HELPERS **************************************) + +let trailing_slash_RE = Pcre.regexp "/$" +let relative_RE_raw = "(^[^/]+(/[^/]+)*/?$)" +let relative_RE = Pcre.regexp relative_RE_raw +let file_scheme_RE_raw = "(^file://)" +let extended_file_scheme_RE = Pcre.regexp "(^file:/+)" +let file_scheme_RE = Pcre.regexp (relative_RE_raw ^ "|" ^ file_scheme_RE_raw) +let http_scheme_RE = Pcre.regexp "^http://" +let newline_RE = Pcre.regexp "\\n" +let cic_scheme_sep_RE = Pcre.regexp ":/" +let gz_suffix = ".gz" +let gz_suffix_len = String.length gz_suffix + + (* file:///bla -> bla, bla -> bla *) +let path_of_file_url url = + assert (Pcre.pmatch ~rex:file_scheme_RE url); + if Pcre.pmatch ~rex:relative_RE url then + url + else (* absolute path, add heading "/" if missing *) + "/" ^ (Pcre.replace ~rex:extended_file_scheme_RE url) + +let strip_gz_suffix fname = + if extension fname = gz_suffix then + String.sub fname 0 (String.length fname - gz_suffix_len) + else + fname + +let normalize_root uri = (* add trailing slash to roots *) + try + if uri.[String.length uri - 1] = ':' then uri ^ "/" + else uri + with Invalid_argument _ -> uri + +let remove_duplicates l = + Http_getter_misc.list_uniq (List.stable_sort Pervasives.compare l) + +let has_rdonly l = List.exists ((=) `Read_only) l +let has_legacy l = List.exists ((=) `Legacy) l +let is_readwrite attrs = (not (has_legacy attrs) && not (has_rdonly attrs)) + +let is_file_schema url = Pcre.pmatch ~rex:file_scheme_RE url +let is_http_schema url = Pcre.pmatch ~rex:http_scheme_RE url + +let is_empty_listing files = + List.for_all + (fun s -> + let len = String.length s in + len < 4 || String.sub s (len - 4) 4 <> ".xml") files + +(************************* GLOBALS PREFIXES **********************************) + + (** associative list regular expressions -> url prefixes + * sorted with longest prefixes first *) +let prefix_map_ref = ref (lazy ( + List.map + (fun (uri_prefix, (url_prefix, attrs)) -> + let uri_prefix = normalize_dir uri_prefix in + let url_prefix = normalize_dir url_prefix in + let regexp = Pcre.regexp ("^(" ^ Pcre.quote uri_prefix ^ ")") in + regexp, strip_trailing_slash uri_prefix, url_prefix, attrs) + (List.rev (Lazy.force Http_getter_env.prefixes)))) + +let prefix_map () = !prefix_map_ref + +let keep_first l = + let cmp (_,x) (_,y) = x = y in + let rec aux prev = function + | [] -> [] + | hd::tl -> if cmp prev hd then hd :: aux prev tl else [] + in + match l with + | hd :: tl -> hd :: aux hd tl + | _ -> assert false +;; + + (** given an uri returns the prefixes for it *) +let lookup uri = + let matches = + HExtlib.filter_map + (fun (rex, _, l, _ as entry) -> + try + let got = Pcre.extract ~full_match:true ~rex uri in + Some (entry, String.length got.(0)) + with Not_found -> None) + (Lazy.force (prefix_map ())) + in + if matches = [] then raise (Unresolvable_URI uri); + List.map fst (keep_first (List.sort (fun (_,l1) (_,l2) -> l2 - l1) matches)) +;; + +let get_attrs uri = List.map (fun (_, _, _, attrs) -> attrs) (lookup uri) + +(*************************** ACTIONS ******************************************) + +let exists_http ~local _ url = + if local then false else + Http_getter_wget.exists (url ^ gz_suffix) || Http_getter_wget.exists url + +let exists_file _ fname = + Sys.file_exists (fname ^ gz_suffix) || Sys.file_exists fname + +let resolve_http ~must_exists ~local _ url = + if local then raise Not_found' else + try + if must_exists then + List.find Http_getter_wget.exists [ url ^ gz_suffix; url ] + else + url + with Not_found -> raise Not_found' + +let resolve_file ~must_exists _ fname = + try + if must_exists then + List.find Sys.file_exists [ fname ^ gz_suffix; fname ] + else + fname + with Not_found -> raise Not_found' + +let ls_file_single _ path_prefix = + let is_dir fname = (Unix.stat fname).Unix.st_kind = Unix.S_DIR in + let is_useless dir = try dir.[0] = '.' with _ -> false in + let entries = ref [] in + try + let dir_handle = Unix.opendir path_prefix in + (try + while true do + let entry = Unix.readdir dir_handle in + if is_useless entry then + () + else if is_dir (path_prefix ^ "/" ^ entry) then + entries := normalize_dir entry :: !entries + else + entries := strip_gz_suffix entry :: !entries + done + with End_of_file -> Unix.closedir dir_handle); + remove_duplicates !entries + with Unix.Unix_error (_, "opendir", _) -> [] + +let ls_http_single ~local _ url_prefix = + if local then raise (Resource_not_found ("get","")) else + let url = normalize_dir url_prefix ^ index_fname in + try + let index = Http_getter_wget.get url in + Pcre.split ~rex:newline_RE index + with Http_client_error _ -> raise (Resource_not_found ("get",url)) +;; + +let get_file _ path = + if Sys.file_exists (path ^ gz_suffix) then + path ^ gz_suffix + else if Sys.file_exists path then + path + else + raise Not_found' + +let get_http ~local uri url = + if local then raise Not_found' else + let scheme, path = + match Pcre.split ~rex:cic_scheme_sep_RE uri with + | [scheme; path] -> scheme, path + | _ -> assert false + in + let cache_name = + sprintf "%s%s/%s" (Lazy.force Http_getter_env.cache_dir) scheme path + in + if Sys.file_exists (cache_name ^ gz_suffix) then + cache_name ^ gz_suffix + else if Sys.file_exists cache_name then + cache_name + else begin (* fill cache *) + Http_getter_misc.mkdir ~parents:true (Filename.dirname cache_name); + (try + Http_getter_wget.get_and_save (url ^ gz_suffix) (cache_name ^ gz_suffix); + cache_name ^ gz_suffix + with Http_client_error _ -> + (try + Http_getter_wget.get_and_save url cache_name; + cache_name + with Http_client_error _ -> + raise Not_found')) + end + +let remove_file _ path = + if Sys.file_exists (path ^ gz_suffix) then Sys.remove (path ^ gz_suffix); + if Sys.file_exists path then Sys.remove path + +let remove_http _ _ = + prerr_endline "Http_getter_storage.remove: not implemented for HTTP scheme"; + assert false + +(**************************** RESOLUTION OF PREFIXES ************************) + +let resolve_prefixes n local write exists uri = + let exists_test new_uri = + if is_file_schema new_uri then + exists_file () (path_of_file_url new_uri) + else if is_http_schema new_uri then + exists_http ~local () new_uri + else false + in + let rec aux n = function + | (rex, _, url_prefix, attrs) :: tl when n > 0-> + (match write, is_readwrite attrs, exists with + | true ,false, _ -> aux n tl + | true ,true ,true + | false,_ ,true -> + let new_uri = (Pcre.replace_first ~rex ~templ:url_prefix uri) in + if exists_test new_uri then new_uri::aux (n-1) tl else aux n tl + | true ,true ,false + | false,_ ,false -> + (Pcre.replace_first ~rex ~templ:url_prefix uri) :: (aux (n-1) tl)) + | _ -> [] + in + aux n (lookup uri) + +let resolve_prefix l w e u = + match resolve_prefixes 1 l w e u with + | hd :: _ -> hd + | [] -> + raise + (Resource_not_found + (Printf.sprintf "resolve_prefix write:%b exists:%b" w e,u)) + +(* uncomment to debug prefix resolution *) +(* +let resolve_prefix w e u = + prerr_endline + ("XXX w=" ^ string_of_bool w ^ " e=" ^ string_of_bool e ^" :" ^ u); + let rc = resolve_prefix w e u in + prerr_endline ("YYY :" ^ rc ^ "\n"); + rc +*) + +(************************* DISPATCHERS ***************************************) + +type 'a storage_method = { + name: string; + write: bool; + exists: bool; + local: bool; + file: string -> string -> 'a; (* unresolved uri, resolved uri *) + http: string -> string -> 'a; (* unresolved uri, resolved uri *) +} + +let invoke_method storage_method uri url = + try + if is_file_schema url then + storage_method.file uri (path_of_file_url url) + else if is_http_schema url then + storage_method.http uri url + else + raise (Unsupported_scheme url) + with Not_found' -> raise (Resource_not_found (storage_method.name, uri)) + +let dispatch_single storage_method uri = + assert (extension uri <> gz_suffix); + let uri = normalize_root uri in + let url = + resolve_prefix + storage_method.local storage_method.write storage_method.exists uri + in + invoke_method storage_method uri url + +let dispatch_multi storage_method uri = + let urls = + resolve_prefixes max_int + storage_method.local storage_method.write storage_method.exists uri + in + let rec aux = function + | [] -> raise (Resource_not_found (storage_method.name, uri)) + | url :: tl -> + (try + invoke_method storage_method uri url + with Resource_not_found _ -> aux tl) + in + aux urls + +let dispatch_all storage_method uri = + let urls = + resolve_prefixes max_int + storage_method.local storage_method.write storage_method.exists uri + in + List.map (fun url -> invoke_method storage_method uri url) urls + +(******************************** EXPORTED FUNCTIONS *************************) + +let exists ~local s = + try + dispatch_single + { write = false; + name = "exists"; + exists = true; + local=local; + file = exists_file; http = exists_http ~local; } s + with Resource_not_found _ -> false + +let resolve ~local ?(must_exists=true) ~writable = + (if must_exists then + dispatch_multi + else + dispatch_single) + { write = writable; + name="resolve"; + exists = must_exists; + local=local; + file = resolve_file ~must_exists; + http = resolve_http ~local ~must_exists; } + +let remove = + dispatch_single + { write = false; + name = "remove"; + exists=true; + local=false; + file = remove_file; http = remove_http; } + +let filename ~local ?(find = false) = + (if find then dispatch_multi else dispatch_single) + { write = false; + name = "filename"; + exists=true; + local=local; + file = get_file; http = get_http ~local ; } + +let ls ~local uri_prefix = + let ls_all s = + try + dispatch_all + { write=false; + name = "ls"; + exists=true; + local=local; + file = ls_file_single; http = ls_http_single ~local; } s + with Resource_not_found _ -> [] + in + let direct_results = List.flatten (ls_all uri_prefix) in + List.fold_left + (fun results (_, uri_prefix', _, _) -> + if Filename.dirname uri_prefix' = strip_trailing_slash uri_prefix then + (Filename.basename uri_prefix' ^ "/") :: results + else + results) + direct_results + (Lazy.force (prefix_map ())) + +let clean_cache () = + ignore (Sys.command + (sprintf "rm -rf %s/" (Lazy.force Http_getter_env.cache_dir))) + +let list_writable_prefixes _ = + HExtlib.filter_map + (fun (_,_,url,attrs) -> + if is_readwrite attrs then + Some url + else + None) + (Lazy.force (prefix_map ())) + +let is_legacy uri = List.for_all has_legacy (get_attrs uri) + +(* implement this in a fast way! *) +let is_empty ~local buri = + let buri = strip_trailing_slash buri ^ "/" in + let files = ls ~local buri in + is_empty_listing files + +let is_read_only uri = + let is_empty_dir path = + let files = + try + if is_file_schema path then + ls_file_single () (path_of_file_url path) + else if is_http_schema path then + ls_http_single ~local:false () path + else + assert false + with Resource_not_found _ -> [] + in + is_empty_listing files + in + let rec aux found_writable = function + | (rex, _, url_prefix, attrs)::tl -> + let new_url = (Pcre.replace_first ~rex ~templ:url_prefix uri) in + let rdonly = has_legacy attrs || has_rdonly attrs in + (match rdonly, is_empty_dir new_url, found_writable with + | true, false, _ -> true + | true, true, _ -> aux found_writable tl + | false, _, _ -> aux true tl) + | [] -> not found_writable (* if found_writable then false else true *) + in + aux false (lookup uri) + +let activate_system_mode () = + let map = Lazy.force (prefix_map ()) in + let map = + HExtlib.filter_map + (fun ((rex, urip, urlp, attrs) as entry) -> + if has_legacy attrs then + Some entry + else if has_rdonly attrs then + Some (rex, urip, urlp, List.filter ((<>) `Read_only) attrs) + else + None) + map + in + let map = map in (* just to remember that ocamlc 'lazy' is a ... *) + prefix_map_ref := (lazy map) + +(* eof *) diff --git a/components/getter/http_getter_storage.mli b/components/getter/http_getter_storage.mli new file mode 100644 index 000000000..cc0ff46c4 --- /dev/null +++ b/components/getter/http_getter_storage.mli @@ -0,0 +1,75 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** Transparent handling of local/remote getter resources. + * Configuration of this module are prefix mappings (see + * Http_getter_env.prefixes). All functions of this module take as input an URI, + * resolve it using mappings and act on the resulting resource which can be + * local (file:/// scheme or relative path) or remote via HTTP (http:// scheme). + * + * Each resource could be either compressed (trailing ".gz") or non-compressed. + * All functions of this module will first loook for the compressed resource + * (i.e. the asked one ^ ".gz"), falling back to the non-compressed one. + * + * All filenames returned by functions of this module exists on the filesystem + * after function's return. + * + * Almost all functions may raise Resource_not_found, the following invariant + * holds: that exception is raised iff exists return false on a given resource + * *) + +exception Resource_not_found of string * string (** method, uri *) + + (** @return a list of string where dir are returned with a trailing "/" *) +val ls: local:bool -> string -> string list + + + (** @return the filename of the resource corresponding to a given uri. Handle + * download and caching for remote resources. + * @param find if set to true all matching prefixes will be searched for the + * asked resource, if not only the best matching prefix will be used. Note + * that the search is performed only if the asked resource is not found in + * cache (i.e. to perform the find again you need to clean the cache). + * Defaults to false *) +val filename: local:bool -> ?find:bool -> string -> string + + (** only works for local resources + * if both compressed and non-compressed versions of a resource exist, both of + * them are removed *) +val remove: string -> unit + +val exists: local:bool -> string -> bool +val resolve: + local:bool -> ?must_exists:bool -> writable:bool -> string -> string + +(* val get_attrs: string -> Http_getter_types.prefix_attr list *) +val is_read_only: string -> bool +val is_legacy: string -> bool +val is_empty: local:bool -> string -> bool + +val clean_cache: unit -> unit + +val activate_system_mode: unit -> unit +val list_writable_prefixes: unit -> string list diff --git a/components/getter/http_getter_types.ml b/components/getter/http_getter_types.ml new file mode 100644 index 000000000..fb0c30e83 --- /dev/null +++ b/components/getter/http_getter_types.ml @@ -0,0 +1,72 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +exception Bad_request of string +exception Unresolvable_URI of string +exception Invalid_URI of string +exception Invalid_URL of string +exception Invalid_RDF_class of string +exception Internal_error of string +exception Cache_failure of string +exception Dtd_not_found of string (* dtd's url *) +exception Key_already_in of string;; +exception Key_not_found of string;; +exception Http_client_error of string * string (* url, error message *) +exception Unsupported_scheme of string (** unsupported url scheme *) + +type encoding = [ `Normal | `Gzipped ] +type answer_format = [ `Text | `Xml ] +type ls_flag = No | Yes | Ann +type ls_object = + { + uri: string; + ann: bool; + types: ls_flag; + body: ls_flag; + proof_tree: ls_flag; + } +type ls_item = + | Ls_section of string + | Ls_object of ls_object + +type xml_uri = + | Cic of string + | Theory of string +type rdf_uri = string * xml_uri +type nuprl_uri = string +type uri = + | Cic_uri of xml_uri + | Nuprl_uri of nuprl_uri + | Rdf_uri of rdf_uri + +module StringSet = Set.Make (String) + +type prefix_attr = [ `Read_only | `Legacy ] + diff --git a/components/getter/http_getter_wget.ml b/components/getter/http_getter_wget.ml new file mode 100644 index 000000000..2052e7bd5 --- /dev/null +++ b/components/getter/http_getter_wget.ml @@ -0,0 +1,70 @@ +(* Copyright (C) 2000-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +open Http_getter_types + +let send cmd = + try + ignore (Http_user_agent.get cmd) + with exn -> raise (Http_client_error (cmd, Printexc.to_string exn)) + +let get url = + try + Http_user_agent.get url + with exn -> raise (Http_client_error (Printexc.to_string exn, url)) + +let get_and_save url dest_filename = + let out_channel = open_out dest_filename in + (try + Http_user_agent.get_iter (output_string out_channel) url; + with exn -> + close_out out_channel; + Sys.remove dest_filename; + raise (Http_client_error (Printexc.to_string exn, url))); + close_out out_channel + +let get_and_save_to_tmp url = + let flat_string s s' c = + let cs = String.copy s in + for i = 0 to (String.length s) - 1 do + if String.contains s' s.[i] then cs.[i] <- c + done; + cs + in + let user = try Unix.getlogin () with _ -> "" in + let tmp_file = + Filename.temp_file (user ^ flat_string url ".-=:;!?/&" '_') "" + in + get_and_save url tmp_file; + tmp_file + +let exists url = + try + ignore (Http_user_agent.head url); + true + with Http_user_agent.Http_error _ -> false + diff --git a/components/getter/http_getter_wget.mli b/components/getter/http_getter_wget.mli new file mode 100644 index 000000000..5d28df185 --- /dev/null +++ b/components/getter/http_getter_wget.mli @@ -0,0 +1,35 @@ +(* Copyright (C) 2000-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + + (** try to guess if an HTTP resource exists using HEAD request + * @return true if HEAD response code = 200 *) +val exists: string -> bool + +val get: string -> string +val get_and_save: string -> string -> unit +val get_and_save_to_tmp: string -> string + +val send: string -> unit + diff --git a/components/getter/mkindexes.pl b/components/getter/mkindexes.pl new file mode 100755 index 000000000..3107846aa --- /dev/null +++ b/components/getter/mkindexes.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl -w +# To be invoked in a directory where a tree of XML files of the HELM library is +# rooted. This script will then creates INDEX files in all directories of the +# tree. +use strict; +my $index_fname = "INDEX"; +sub getcwd() { + my $pwd = `pwd`; + chomp $pwd; + return $pwd; +} +sub add_trailing_slash($) { + my ($dir) = @_; + return $dir if ($dir =~ /\/$/); + return "$dir/"; +} +sub indexable($) { + my ($fname) = @_; + return 1 if ($fname =~ /\.(ind|types|body|var|theory).xml/); + return 0; +} +my @todo = (getcwd()); +while (my $dir = shift @todo) { + print "$dir\n"; + chdir $dir or die "Can't chdir to $dir\n"; + open LS, 'ls | sed \'s/\\.gz//\' | sort | uniq |'; + open INDEX, "> $index_fname" + or die "Can't open $index_fname in " . getcwd() . "\n"; + while (my $entry = ) { + chomp $entry; + if (-d $entry) { + print INDEX add_trailing_slash($entry) . "\n"; + push @todo, getcwd() . "/$entry"; + } else { + print INDEX "$entry\n" if indexable($entry); + } + } + close INDEX; + close LS; +} diff --git a/components/getter/sample.conf.xml b/components/getter/sample.conf.xml new file mode 100644 index 000000000..54cdc2557 --- /dev/null +++ b/components/getter/sample.conf.xml @@ -0,0 +1,50 @@ + +
+ /tmp/helm/cache + /projects/helm/xml/dtd + 58081 + 180 + http_getter.log + + theory:/ file:///projects/helm/library/theories/ + + + xslt:/ file:///projects/helm/xml/stylesheets_ccorn/ + + + xslt:/ file:///projects/helm/xml/stylesheets_hanane/ + + + xslt:/ file:///projects/helm/xml/on-line/xslt/ + + + xslt:/ file:///projects/helm/nuprl/NuPRL/nuprl_stylesheets/ + + + nuprl:/ http://www.cs.uwyo.edu/~nuprl/helm-library/ + + + xslt:/ file:///projects/helm/xml/stylesheets/ + + + xslt:/ file:///projects/helm/xml/stylesheets/generated/ + + + theory:/residual_theory_in_lambda_calculus/ + http://helm.cs.unibo.it/~sacerdot/huet_lambda_calculus_mowgli/residual_theory_in_lambda_calculus/ + + + theory:/IDA/ + http://mowgli.cs.unibo.it/~sacerdot/ida/IDA/ + + + cic:/ file:///projects/helm/library/coq_contribs/ + legacy + + + cic:/matita/ + file:///projects/helm/library/matita/ + ro + +
+
diff --git a/components/getter/test.ml b/components/getter/test.ml new file mode 100644 index 000000000..6fa236fd0 --- /dev/null +++ b/components/getter/test.ml @@ -0,0 +1,12 @@ +(* $Id$ *) + +let _ = Helm_registry.load_from "foo.conf.xml" +let fname = Http_getter.getxml ~format:`Normal ~patch_dtd:true Sys.argv.(1) in +let ic = open_in fname in +(try + while true do + let line = input_line ic in + print_endline line + done +with End_of_file -> ()) + diff --git a/components/grafite/.depend b/components/grafite/.depend new file mode 100644 index 000000000..dc225e221 --- /dev/null +++ b/components/grafite/.depend @@ -0,0 +1,6 @@ +grafiteAstPp.cmi: grafiteAst.cmo +grafiteMarshal.cmi: grafiteAst.cmo +grafiteAstPp.cmo: grafiteAst.cmo grafiteAstPp.cmi +grafiteAstPp.cmx: grafiteAst.cmx grafiteAstPp.cmi +grafiteMarshal.cmo: grafiteAstPp.cmi grafiteAst.cmo grafiteMarshal.cmi +grafiteMarshal.cmx: grafiteAstPp.cmx grafiteAst.cmx grafiteMarshal.cmi diff --git a/components/grafite/.depend.opt b/components/grafite/.depend.opt new file mode 100644 index 000000000..0f64ba789 --- /dev/null +++ b/components/grafite/.depend.opt @@ -0,0 +1,6 @@ +grafiteAstPp.cmi: grafiteAst.cmx +grafiteMarshal.cmi: grafiteAst.cmx +grafiteAstPp.cmo: grafiteAst.cmx grafiteAstPp.cmi +grafiteAstPp.cmx: grafiteAst.cmx grafiteAstPp.cmi +grafiteMarshal.cmo: grafiteAstPp.cmi grafiteAst.cmx grafiteMarshal.cmi +grafiteMarshal.cmx: grafiteAstPp.cmx grafiteAst.cmx grafiteMarshal.cmi diff --git a/components/grafite/Makefile b/components/grafite/Makefile new file mode 100644 index 000000000..6eb3e7a78 --- /dev/null +++ b/components/grafite/Makefile @@ -0,0 +1,14 @@ +PACKAGE = grafite +PREDICATES = + +INTERFACE_FILES = \ + grafiteAstPp.mli \ + grafiteMarshal.mli \ + $(NULL) +IMPLEMENTATION_FILES = \ + grafiteAst.ml \ + $(INTERFACE_FILES:%.mli=%.ml) + + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/grafite/grafiteAst.ml b/components/grafite/grafiteAst.ml new file mode 100644 index 000000000..2b0f4db5f --- /dev/null +++ b/components/grafite/grafiteAst.ml @@ -0,0 +1,187 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type direction = [ `LeftToRight | `RightToLeft ] + +type loc = Stdpp.location + +type ('term, 'lazy_term, 'ident) pattern = + 'lazy_term option * ('ident * 'term) list * 'term option + +type 'lazy_term reduction = + [ `Normalize + | `Reduce + | `Simpl + | `Unfold of 'lazy_term option + | `Whd ] + +type 'ident intros_spec = int option * 'ident option list + +type ('term, 'lazy_term, 'reduction, 'ident) tactic = + (* Higher order tactics (i.e. tacticals) *) + | Do of loc * int * ('term, 'lazy_term, 'reduction, 'ident) tactic + | Repeat of loc * ('term, 'lazy_term, 'reduction, 'ident) tactic + | Seq of loc * ('term, 'lazy_term, 'reduction, 'ident) tactic list + (* sequential composition *) + | Then of loc * ('term, 'lazy_term, 'reduction, 'ident) tactic * + ('term, 'lazy_term, 'reduction, 'ident) tactic list + | First of loc * ('term, 'lazy_term, 'reduction, 'ident) tactic list + (* try a sequence of loc * tactic until one succeeds, fail otherwise *) + | Try of loc * ('term, 'lazy_term, 'reduction, 'ident) tactic + (* try a tactic and mask failures *) + | Solve of loc * ('term, 'lazy_term, 'reduction, 'ident) tactic list + | Progress of loc * ('term, 'lazy_term, 'reduction, 'ident) tactic + (* Real tactics *) + | Absurd of loc * 'term + | Apply of loc * 'term + | ApplyS of loc * 'term * (string * string) list + | Assumption of loc + | AutoBatch of loc * (string * string) list + | Cases of loc * 'term * 'ident intros_spec + | Change of loc * ('term, 'lazy_term, 'ident) pattern * 'lazy_term + | Clear of loc * 'ident list + | ClearBody of loc * 'ident + | Compose of loc * 'term * 'term option * int * 'ident intros_spec + | Constructor of loc * int + | Contradiction of loc + | Cut of loc * 'ident option * 'term + | Decompose of loc * 'ident option list + | Demodulate of loc + | Destruct of loc * 'term list option + | Elim of loc * 'term * 'term option * ('term, 'lazy_term, 'ident) pattern * + 'ident intros_spec + | ElimType of loc * 'term * 'term option * 'ident intros_spec + | Exact of loc * 'term + | Exists of loc + | Fail of loc + | Fold of loc * 'reduction * 'lazy_term * ('term, 'lazy_term, 'ident) pattern + | Fourier of loc + | FwdSimpl of loc * string * 'ident option list + | Generalize of loc * ('term, 'lazy_term, 'ident) pattern * 'ident option + | IdTac of loc + | Intros of loc * 'ident intros_spec + | Inversion of loc * 'term + | LApply of loc * bool * int option * 'term list * 'term * 'ident option + | Left of loc + | LetIn of loc * 'term * 'ident + | Reduce of loc * 'reduction * ('term, 'lazy_term, 'ident) pattern + | Reflexivity of loc + | Replace of loc * ('term, 'lazy_term, 'ident) pattern * 'lazy_term + | Rewrite of loc * direction * 'term * + ('term, 'lazy_term, 'ident) pattern * 'ident option list + | Right of loc + | Ring of loc + | Split of loc + | Symmetry of loc + | Transitivity of loc * 'term + (* Costruttori Aggiunti *) + | Assume of loc * 'ident * 'term + | Suppose of loc * 'term *'ident * 'term option + | By_term_we_proved of loc *'term option * 'term * 'ident option * 'term option + | We_need_to_prove of loc * 'term * 'ident option * 'term option + | Bydone of loc * 'term option + | We_proceed_by_induction_on of loc * 'term * 'term + | We_proceed_by_cases_on of loc * 'term * 'term + | Byinduction of loc * 'term * 'ident + | Thesisbecomes of loc * 'term + | Case of loc * string * (string * 'term) list + | ExistsElim of loc * 'term option * 'ident * 'term * 'ident * 'lazy_term + | AndElim of loc * 'term * 'ident * 'term * 'ident * 'term + | RewritingStep of + loc * (string option * 'term) option * 'term * + [ `Term of 'term | `Auto of (string * string) list | `Proof ] * + bool (* last step*) + +type search_kind = [ `Locate | `Hint | `Match | `Elim ] + +type print_kind = [ `Env | `Coer ] + +type presentation_style = Declarative + | Procedural of int option + +type 'term macro = + (* Whelp's stuff *) + | WHint of loc * 'term + | WMatch of loc * 'term + | WInstance of loc * 'term + | WLocate of loc * string + | WElim of loc * 'term + (* real macros *) + | Check of loc * 'term + | Hint of loc * bool + | AutoInteractive of loc * (string * string) list + | Inline of loc * presentation_style * string * string + (* URI or base-uri, name prefix *) + +(** To be increased each time the command type below changes, used for "safe" + * marshalling *) +let magic = 12 + +type ('term,'obj) command = + | Index of loc * 'term option (* key *) * UriManager.uri (* value *) + | Coercion of loc * UriManager.uri * bool (* add_obj *) * + int (* arity *) * int (* saturations *) + | Default of loc * string * UriManager.uri list + | Drop of loc + | Include of loc * string + | Obj of loc * 'obj + | Relation of + loc * string * 'term * 'term * 'term option * 'term option * 'term option + | Set of loc * string * string + | Print of loc * string + | Qed of loc + +type ('term, 'lazy_term, 'reduction, 'ident) punctuation_tactical = + | Dot of loc + | Semicolon of loc + | Branch of loc + | Shift of loc + | Pos of loc * int list + | Wildcard of loc + | Merge of loc + +type ('term,'lazy_term,'reduction,'ident) non_punctuation_tactical = + | Focus of loc * int list + | Unfocus of loc + | Skip of loc + +type ('term, 'lazy_term, 'reduction, 'obj, 'ident) code = + | Command of loc * ('term, 'obj) command + | Macro of loc * 'term macro + | Tactic of loc * ('term, 'lazy_term, 'reduction, 'ident) tactic option + * ('term, 'lazy_term, 'reduction, 'ident) punctuation_tactical + | NonPunctuationTactical of loc + * ('term, 'lazy_term, 'reduction, 'ident) non_punctuation_tactical + * ('term, 'lazy_term, 'reduction, 'ident) punctuation_tactical + +type ('term, 'lazy_term, 'reduction, 'obj, 'ident) comment = + | Note of loc * string + | Code of loc * ('term, 'lazy_term, 'reduction, 'obj, 'ident) code + +type ('term, 'lazy_term, 'reduction, 'obj, 'ident) statement = + | Executable of loc * ('term, 'lazy_term, 'reduction, 'obj, 'ident) code + | Comment of loc * ('term, 'lazy_term, 'reduction, 'obj, 'ident) comment diff --git a/components/grafite/grafiteAstPp.ml b/components/grafite/grafiteAstPp.ml new file mode 100644 index 000000000..fd3c444b9 --- /dev/null +++ b/components/grafite/grafiteAstPp.ml @@ -0,0 +1,335 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open GrafiteAst + +let tactical_terminator = "" +let tactic_terminator = tactical_terminator +let command_terminator = tactical_terminator + +let pp_idents idents = + let map = function Some s -> s | None -> "_" in + "(" ^ String.concat " " (List.map map idents) ^ ")" +let pp_hyps idents = String.concat " " idents + +let pp_reduction_kind ~term_pp = function + | `Normalize -> "normalize" + | `Reduce -> "reduce" + | `Simpl -> "simplify" + | `Unfold (Some t) -> "unfold " ^ term_pp t + | `Unfold None -> "unfold" + | `Whd -> "whd" + +let pp_tactic_pattern ~map_unicode_to_tex ~term_pp ~lazy_term_pp (what, hyp, goal) = + if what = None && hyp = [] && goal = None then "" else + let what_text = + match what with + | None -> "" + | Some t -> Printf.sprintf "in match (%s) " (lazy_term_pp t) in + let hyp_text = + String.concat " " + (List.map (fun (name, p) -> Printf.sprintf "%s:(%s)" name (term_pp p)) hyp) in + let goal_text = + match goal with + | None -> "" + | Some t -> + let vdash = if map_unicode_to_tex then "\\vdash" else "⊢" in + Printf.sprintf "%s (%s)" vdash (term_pp t) + in + Printf.sprintf "%sin %s%s" what_text hyp_text goal_text + +let pp_intros_specs s = function + | None, [] -> "" + | Some num, [] -> Printf.sprintf " %s%i" s num + | None, idents -> Printf.sprintf " %s%s" s (pp_idents idents) + | Some num, idents -> Printf.sprintf " %s%i %s" s num (pp_idents idents) + +let pp_terms ~term_pp terms = String.concat ", " (List.map term_pp terms) + +let opt_string_pp = function + | None -> "" + | Some what -> what ^ " " + +let rec pp_tactic ~map_unicode_to_tex ~term_pp ~lazy_term_pp = + let pp_terms = pp_terms ~term_pp in + let pp_tactics = pp_tactics ~map_unicode_to_tex ~term_pp ~lazy_term_pp in + let pp_reduction_kind = pp_reduction_kind ~term_pp in + let pp_tactic_pattern = + pp_tactic_pattern ~map_unicode_to_tex ~lazy_term_pp ~term_pp in + let rec pp_tactic = + function + (* Higher order tactics *) + | Do (_, count, tac) -> + Printf.sprintf "do %d %s" count (pp_tactic tac) + | Repeat (_, tac) -> "repeat " ^ pp_tactic tac + | Seq (_, tacs) -> pp_tactics ~sep:"; " tacs + | Then (_, tac, tacs) -> + Printf.sprintf "%s; [%s]" (pp_tactic tac) + (pp_tactics ~sep:" | " tacs) + | First (_, tacs) -> + Printf.sprintf "tries [%s]" (pp_tactics ~sep:" | " tacs) + | Try (_, tac) -> "try " ^ pp_tactic tac + | Solve (_, tac) -> + Printf.sprintf "solve [%s]" (pp_tactics ~sep:" | " tac) + | Progress (_, tac) -> "progress " ^ pp_tactic tac + (* First order tactics *) + | Absurd (_, term) -> "absurd" ^ term_pp term + | Apply (_, term) -> "apply " ^ term_pp term + | ApplyS (_, term, params) -> + "applyS " ^ term_pp term ^ + String.concat " " + (List.map (fun (k,v) -> if v <> "" then k ^ "=" ^ v else k) params) + | AutoBatch (_,params) -> "auto batch " ^ + String.concat " " + (List.map (fun (k,v) -> if v <> "" then k ^ "=" ^ v else k) params) + | Assumption _ -> "assumption" + | Cases (_, term, specs) -> Printf.sprintf "cases " ^ term_pp term ^ + pp_intros_specs "names " specs + | Change (_, where, with_what) -> + Printf.sprintf "change %s with %s" (pp_tactic_pattern where) (lazy_term_pp with_what) + | Clear (_,ids) -> Printf.sprintf "clear %s" (pp_hyps ids) + | ClearBody (_,id) -> Printf.sprintf "clearbody %s" (pp_hyps [id]) + | Constructor (_,n) -> "constructor " ^ string_of_int n + | Compose (_,t1, t2, times, intro_specs) -> + Printf.sprintf "compose %s%s %s%s" + (if times > 0 then string_of_int times ^ " " else "") + (term_pp t1) (match t2 with None -> "" | Some t2 -> "with "^term_pp t2) + (pp_intros_specs " as " intro_specs) + | Contradiction _ -> "contradiction" + | Cut (_, ident, term) -> + "cut " ^ term_pp term ^ + (match ident with None -> "" | Some id -> " as " ^ id) + | Decompose (_, names) -> + Printf.sprintf "decompose%s" + (pp_intros_specs "names " (None, names)) + | Demodulate _ -> "demodulate" + | Destruct (_, None) -> "destruct" + | Destruct (_, Some terms) -> "destruct " ^ pp_terms terms + | Elim (_, what, using, pattern, specs) -> + Printf.sprintf "elim %s%s %s%s" + (term_pp what) + (match using with None -> "" | Some term -> " using " ^ term_pp term) + (pp_tactic_pattern pattern) + (pp_intros_specs "names " specs) + | ElimType (_, term, using, specs) -> + Printf.sprintf "elim type %s%s%s" + (term_pp term) + (match using with None -> "" | Some term -> " using " ^ term_pp term) + (pp_intros_specs "names " specs) + | Exact (_, term) -> "exact " ^ term_pp term + | Exists _ -> "exists" + | Fold (_, kind, term, pattern) -> + Printf.sprintf "fold %s %s %s" (pp_reduction_kind kind) + (lazy_term_pp term) (pp_tactic_pattern pattern) + | FwdSimpl (_, hyp, names) -> + Printf.sprintf "fwd %s%s" hyp (pp_intros_specs "names " (None, names)) + | Generalize (_, pattern, ident) -> + Printf.sprintf "generalize %s%s" (pp_tactic_pattern pattern) + (match ident with None -> "" | Some id -> " as " ^ id) + | Fail _ -> "fail" + | Fourier _ -> "fourier" + | IdTac _ -> "id" + | Intros (_, specs) -> Printf.sprintf "intros%s" (pp_intros_specs "" specs) + | Inversion (_, term) -> "inversion " ^ term_pp term + | LApply (_, linear, level_opt, terms, term, ident_opt) -> + Printf.sprintf "lapply %s%s%s%s%s" + (if linear then " linear " else "") + (match level_opt with None -> "" | Some i -> " depth = " ^ string_of_int i ^ " ") + (term_pp term) + (match terms with [] -> "" | _ -> " to " ^ pp_terms terms) + (match ident_opt with None -> "" | Some ident -> " as " ^ ident) + | Left _ -> "left" + | LetIn (_, term, ident) -> + Printf.sprintf "letin %s \\def %s" ident (term_pp term) + | Reduce (_, kind, pat) -> + Printf.sprintf "%s %s" (pp_reduction_kind kind) (pp_tactic_pattern pat) + | Reflexivity _ -> "reflexivity" + | Replace (_, pattern, t) -> + Printf.sprintf "replace %s with %s" (pp_tactic_pattern pattern) (lazy_term_pp t) + | Rewrite (_, pos, t, pattern, names) -> + Printf.sprintf "rewrite %s %s %s%s" + (if pos = `LeftToRight then ">" else "<") + (term_pp t) + (pp_tactic_pattern pattern) + (if names = [] then "" else " as " ^ pp_idents names) + | Right _ -> "right" + | Ring _ -> "ring" + | Split _ -> "split" + | Symmetry _ -> "symmetry" + | Transitivity (_, term) -> "transitivity " ^ term_pp term + (* Tattiche Aggiunte *) + | Assume (_, ident , term) -> "assume" ^ ident ^ ":" ^ term_pp term + | Suppose (_, term, ident,term1) -> "suppose" ^ term_pp term ^ "(" ^ ident ^ ")" ^ (match term1 with None -> " " | Some term1 -> term_pp term1) + | Bydone (_, term) -> "by" ^ (match term with None -> "_" | Some term -> term_pp term) ^ "done" + | By_term_we_proved (_, term, term1, ident, term2) -> "by" ^ (match term with None -> "_" | Some term -> term_pp term) ^ "we proved" ^ term_pp term1 ^ (match ident with None -> "" | Some ident -> "(" ^ident^ ")") ^ + (match term2 with None -> " " | Some term2 -> term_pp term2) + | We_need_to_prove (_, term, ident, term1) -> "we need to prove" ^ term_pp term ^ (match ident with None -> "" | Some ident -> "(" ^ ident ^ ")") ^ (match term1 with None -> " " | Some term1 -> term_pp term1) + | We_proceed_by_cases_on (_, term, term1) -> "we proceed by cases on" ^ term_pp term ^ "to prove" ^ term_pp term1 + | We_proceed_by_induction_on (_, term, term1) -> "we proceed by induction on" ^ term_pp term ^ "to prove" ^ term_pp term1 + | Byinduction (_, term, ident) -> "by induction hypothesis we know" ^ term_pp term ^ "(" ^ ident ^ ")" + | Thesisbecomes (_, term) -> "the thesis becomes " ^ term_pp term + | ExistsElim (_, term0, ident, term, ident1, term1) -> "by " ^ (match term0 with None -> "_" | Some term -> term_pp term) ^ "let " ^ ident ^ ":" ^ term_pp term ^ "such that " ^ lazy_term_pp term1 ^ "(" ^ ident1 ^ ")" + | AndElim (_, term, ident1, term1, ident2, term2) -> "by " ^ term_pp term ^ "we have " ^ term_pp term1 ^ " (" ^ ident1 ^ ") " ^ "and " ^ term_pp term2 ^ " (" ^ ident2 ^ ")" + | RewritingStep (_, term, term1, term2, cont) -> (match term with None -> " " | Some (None,term) -> "conclude " ^ term_pp term | Some (Some name,term) -> "obtain (" ^ name ^ ") " ^ term_pp term) ^ "=" ^ term_pp term1 ^ " by " ^ (match term2 with `Auto params -> "_" ^ String.concat " " (List.map (fun (k,v) -> if v <> "" then k ^ "=" ^ v else k) params) | `Term term2 -> term_pp term2 | `Proof -> "proof") ^ (if cont then " done" else "") + | Case (_, id, args) -> + "case" ^ id ^ + String.concat " " + (List.map (function (id,term) -> "(" ^ id ^ ": " ^ term_pp term ^ ")") + args) + in pp_tactic + +and pp_tactics ~map_unicode_to_tex ~term_pp ~lazy_term_pp ~sep tacs = + String.concat sep + (List.map (pp_tactic ~map_unicode_to_tex ~lazy_term_pp ~term_pp) tacs) + + let pp_search_kind = function + | `Locate -> "locate" + | `Hint -> "hint" + | `Match -> "match" + | `Elim -> "elim" + | `Instance -> "instance" + +let pp_arg ~term_pp arg = + let s = term_pp arg in + if s = "" || (s.[0] = '(' && s.[String.length s - 1] = ')') then + (* _nice_ heuristic *) + s + else + "(" ^ s ^ ")" + +let pp_macro ~term_pp = + let term_pp = pp_arg ~term_pp in + let style_pp = function + | Declarative -> "" + | Procedural None -> "procedural " + | Procedural (Some i) -> Printf.sprintf "procedural %u " i + in + let prefix_pp prefix = + if prefix = "" then "" else Printf.sprintf " \"%s\"" prefix + in + function + (* Whelp *) + | WInstance (_, term) -> "whelp instance " ^ term_pp term + | WHint (_, t) -> "whelp hint " ^ term_pp t + | WLocate (_, s) -> "whelp locate \"" ^ s ^ "\"" + | WElim (_, t) -> "whelp elim " ^ term_pp t + | WMatch (_, term) -> "whelp match " ^ term_pp term + (* real macros *) + | Check (_, term) -> Printf.sprintf "check %s" (term_pp term) + | Hint (_, true) -> "hint rewrite" + | Hint (_, false) -> "hint" + | AutoInteractive (_,params) -> "auto " ^ + String.concat " " + (List.map (fun (k,v) -> if v <> "" then k ^ "=" ^ v else k) params) + | Inline (_, style, suri, prefix) -> + Printf.sprintf "inline %s\"%s\"%s" (style_pp style) suri (prefix_pp prefix) + +let pp_associativity = function + | Gramext.LeftA -> "left associative" + | Gramext.RightA -> "right associative" + | Gramext.NonA -> "non associative" + +let pp_precedence i = Printf.sprintf "with precedence %d" i + +let pp_dir_opt = function + | None -> "" + | Some `LeftToRight -> "> " + | Some `RightToLeft -> "< " + +let pp_default what uris = + Printf.sprintf "default \"%s\" %s" what + (String.concat " " (List.map UriManager.string_of_uri uris)) + +let pp_coercion uri do_composites arity saturations= + Printf.sprintf "coercion %s %d %d %s" + (UriManager.string_of_uri uri) arity saturations + (if do_composites then "" else "nocomposites") + +let pp_command ~term_pp ~obj_pp = function + | Index (_,_,uri) -> "Indexing " ^ UriManager.string_of_uri uri + | Coercion (_, uri, do_composites, i, j) -> + pp_coercion uri do_composites i j + | Default (_,what,uris) -> pp_default what uris + | Drop _ -> "drop" + | Include (_,path) -> "include \"" ^ path ^ "\"" + | Obj (_,obj) -> obj_pp obj + | Qed _ -> "qed" + | Relation (_,id,a,aeq,refl,sym,trans) -> + "relation " ^ term_pp aeq ^ " on " ^ term_pp a ^ + (match refl with + Some r -> " reflexivity proved by " ^ term_pp r + | None -> "") ^ + (match sym with + Some r -> " symmetry proved by " ^ term_pp r + | None -> "") ^ + (match trans with + Some r -> " transitivity proved by " ^ term_pp r + | None -> "") + | Print (_,s) -> "print " ^ s + | Set (_, name, value) -> Printf.sprintf "set \"%s\" \"%s\"" name value + +let pp_punctuation_tactical ~term_pp ~lazy_term_pp = + function + | Dot _ -> "." + | Semicolon _ -> ";" + | Branch _ -> "[" + | Shift _ -> "|" + | Pos (_, i) -> Printf.sprintf "%s:" (String.concat "," (List.map string_of_int i)) + | Wildcard _ -> "*:" + | Merge _ -> "]" + +let pp_non_punctuation_tactical ~term_pp ~lazy_term_pp = + function + | Focus (_, goals) -> + Printf.sprintf "focus %s" (String.concat " " (List.map string_of_int goals)) + | Unfocus _ -> "unfocus" + | Skip _ -> "skip" + +let pp_executable ~map_unicode_to_tex ~term_pp ~lazy_term_pp ~obj_pp = + function + | Macro (_, macro) -> pp_macro ~term_pp macro ^ "." + | Tactic (_, Some tac, punct) -> + pp_tactic ~map_unicode_to_tex ~lazy_term_pp ~term_pp tac + ^ pp_punctuation_tactical ~lazy_term_pp ~term_pp punct + | Tactic (_, None, punct) -> + pp_punctuation_tactical ~lazy_term_pp ~term_pp punct + | NonPunctuationTactical (_, tac, punct) -> + pp_non_punctuation_tactical ~lazy_term_pp ~term_pp tac + ^ pp_punctuation_tactical ~lazy_term_pp ~term_pp punct + | Command (_, cmd) -> pp_command ~term_pp ~obj_pp cmd ^ "." + +let pp_comment ~map_unicode_to_tex ~term_pp ~lazy_term_pp ~obj_pp = + function + | Note (_,"") -> Printf.sprintf "\n" + | Note (_,str) -> Printf.sprintf "\n(* %s *)" str + | Code (_,code) -> + Printf.sprintf "\n(** %s. **)" (pp_executable ~map_unicode_to_tex ~term_pp ~lazy_term_pp ~obj_pp code) + +let pp_statement ~term_pp ~lazy_term_pp ~obj_pp = + function + | Executable (_, ex) -> pp_executable ~lazy_term_pp ~term_pp ~obj_pp ex + | Comment (_, c) -> pp_comment ~term_pp ~lazy_term_pp ~obj_pp c diff --git a/components/grafite/grafiteAstPp.mli b/components/grafite/grafiteAstPp.mli new file mode 100644 index 000000000..647d38bbe --- /dev/null +++ b/components/grafite/grafiteAstPp.mli @@ -0,0 +1,84 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val pp_tactic: + map_unicode_to_tex:bool -> + term_pp:('term -> string) -> + lazy_term_pp:('lazy_term -> string) -> + ('term, 'lazy_term, 'term GrafiteAst.reduction, string) + GrafiteAst.tactic -> + string + +val pp_tactic_pattern: + map_unicode_to_tex:bool -> + term_pp:('term -> string) -> + lazy_term_pp:('lazy_term -> string) -> + ('term, 'lazy_term, string) GrafiteAst.pattern -> + string + +val pp_reduction_kind: + term_pp:('a -> string) -> + 'a GrafiteAst.reduction -> + string + +val pp_command: + term_pp:('term -> string) -> + obj_pp:('obj -> string) -> + ('term,'obj) GrafiteAst.command -> string +val pp_macro: term_pp:('term -> string) -> 'term GrafiteAst.macro -> string +val pp_comment: + map_unicode_to_tex:bool -> + term_pp:('term -> string) -> + lazy_term_pp:('lazy_term -> string) -> + obj_pp:('obj -> string) -> + ('term, 'lazy_term, 'term GrafiteAst.reduction, 'obj, string) + GrafiteAst.comment -> + string + +val pp_executable: + map_unicode_to_tex:bool -> + term_pp:('term -> string) -> + lazy_term_pp:('lazy_term -> string) -> + obj_pp:('obj -> string) -> + ('term, 'lazy_term, 'term GrafiteAst.reduction, 'obj, string) + GrafiteAst.code -> + string + +val pp_statement: + term_pp:('term -> string) -> + lazy_term_pp:('lazy_term -> string) -> + obj_pp:('obj -> string) -> + ('term, 'lazy_term, 'term GrafiteAst.reduction, 'obj, string) + GrafiteAst.statement -> + map_unicode_to_tex:bool -> + string + +val pp_punctuation_tactical: + term_pp:('term -> string) -> + lazy_term_pp:('lazy_term -> string) -> + ('term, 'lazy_term, 'term GrafiteAst.reduction, string) + GrafiteAst.punctuation_tactical -> + string + diff --git a/components/grafite/grafiteMarshal.ml b/components/grafite/grafiteMarshal.ml new file mode 100644 index 000000000..7731902b4 --- /dev/null +++ b/components/grafite/grafiteMarshal.ml @@ -0,0 +1,63 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type ast_command = (Cic.term,Cic.obj) GrafiteAst.command +type moo = ast_command list + +let format_name = "grafite" + +let save_moo_to_file ~fname moo = + HMarshal.save ~fmt:format_name ~version:GrafiteAst.magic ~fname moo + +let load_moo_from_file ~fname = + let raw = HMarshal.load ~fmt:format_name ~version:GrafiteAst.magic ~fname in + (raw: moo) + +let rehash_cmd_uris = + let rehash_uri uri = + UriManager.uri_of_string (UriManager.string_of_uri uri) in + function + | GrafiteAst.Default (loc, name, uris) -> + let uris = List.map rehash_uri uris in + GrafiteAst.Default (loc, name, uris) + | GrafiteAst.Coercion (loc, uri, close, arity, saturations) -> + GrafiteAst.Coercion (loc, rehash_uri uri, close, arity, saturations) + | GrafiteAst.Index (loc, key, uri) -> + GrafiteAst.Index (loc, HExtlib.map_option CicUtil.rehash_term key, rehash_uri uri) + | cmd -> + prerr_endline "Found a command not expected in a .moo:"; + let term_pp _ = assert false in + let obj_pp _ = assert false in + prerr_endline (GrafiteAstPp.pp_command ~term_pp ~obj_pp cmd); + assert false + +let save_moo ~fname moo = save_moo_to_file ~fname (List.rev moo) + +let load_moo ~fname = + let moo = load_moo_from_file ~fname in + List.map rehash_cmd_uris moo + diff --git a/components/grafite/grafiteMarshal.mli b/components/grafite/grafiteMarshal.mli new file mode 100644 index 000000000..cad7b1187 --- /dev/null +++ b/components/grafite/grafiteMarshal.mli @@ -0,0 +1,33 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type ast_command = (Cic.term,Cic.obj) GrafiteAst.command +type moo = ast_command list + +val save_moo: fname:string -> moo -> unit + + (** @raise Corrupt_moo *) +val load_moo: fname:string -> moo + diff --git a/components/grafite_engine/.depend b/components/grafite_engine/.depend new file mode 100644 index 000000000..b0d4b7048 --- /dev/null +++ b/components/grafite_engine/.depend @@ -0,0 +1,8 @@ +grafiteSync.cmi: grafiteTypes.cmi +grafiteEngine.cmi: grafiteTypes.cmi +grafiteTypes.cmo: grafiteTypes.cmi +grafiteTypes.cmx: grafiteTypes.cmi +grafiteSync.cmo: grafiteTypes.cmi grafiteSync.cmi +grafiteSync.cmx: grafiteTypes.cmx grafiteSync.cmi +grafiteEngine.cmo: grafiteTypes.cmi grafiteSync.cmi grafiteEngine.cmi +grafiteEngine.cmx: grafiteTypes.cmx grafiteSync.cmx grafiteEngine.cmi diff --git a/components/grafite_engine/.depend.opt b/components/grafite_engine/.depend.opt new file mode 100644 index 000000000..b0d4b7048 --- /dev/null +++ b/components/grafite_engine/.depend.opt @@ -0,0 +1,8 @@ +grafiteSync.cmi: grafiteTypes.cmi +grafiteEngine.cmi: grafiteTypes.cmi +grafiteTypes.cmo: grafiteTypes.cmi +grafiteTypes.cmx: grafiteTypes.cmi +grafiteSync.cmo: grafiteTypes.cmi grafiteSync.cmi +grafiteSync.cmx: grafiteTypes.cmx grafiteSync.cmi +grafiteEngine.cmo: grafiteTypes.cmi grafiteSync.cmi grafiteEngine.cmi +grafiteEngine.cmx: grafiteTypes.cmx grafiteSync.cmx grafiteEngine.cmi diff --git a/components/grafite_engine/Makefile b/components/grafite_engine/Makefile new file mode 100644 index 000000000..b6eed1e88 --- /dev/null +++ b/components/grafite_engine/Makefile @@ -0,0 +1,12 @@ +PACKAGE = grafite_engine +PREDICATES = + +INTERFACE_FILES = \ + grafiteTypes.mli \ + grafiteSync.mli \ + grafiteEngine.mli \ + $(NULL) +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/grafite_engine/grafiteEngine.ml b/components/grafite_engine/grafiteEngine.ml new file mode 100644 index 000000000..625b23323 --- /dev/null +++ b/components/grafite_engine/grafiteEngine.ml @@ -0,0 +1,847 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +module PEH = ProofEngineHelpers + +exception Drop +(* mo file name, ma file name *) +exception IncludedFileNotCompiled of string * string +exception Macro of + GrafiteAst.loc * + (Cic.context -> GrafiteTypes.status * Cic.term GrafiteAst.macro) + +type 'a disambiguator_input = string * int * 'a + +type options = { + do_heavy_checks: bool ; + clean_baseuri: bool +} + +(** create a ProofEngineTypes.mk_fresh_name_type function which uses given + * names as long as they are available, then it fallbacks to name generation + * using FreshNamesGenerator module *) +let namer_of names = + let len = List.length names in + let count = ref 0 in + fun metasenv context name ~typ -> + if !count < len then begin + let name = match List.nth names !count with + | Some s -> Cic.Name s + | None -> Cic.Anonymous + in + incr count; + name + end else + FreshNamesGenerator.mk_fresh_name ~subst:[] metasenv context name ~typ + +let rec tactic_of_ast status ast = + let module PET = ProofEngineTypes in + match ast with + (* Higher order tactics *) + | GrafiteAst.Do (loc, n, tactic) -> + Tacticals.do_tactic n (tactic_of_ast status tactic) + | GrafiteAst.Seq (loc, tactics) -> (* tac1; tac2; ... *) + Tacticals.seq (List.map (tactic_of_ast status) tactics) + | GrafiteAst.Repeat (loc, tactic) -> + Tacticals.repeat_tactic (tactic_of_ast status tactic) + | GrafiteAst.Then (loc, tactic, tactics) -> (* tac; [ tac1 | ... ] *) + Tacticals.thens + (tactic_of_ast status tactic) + (List.map (tactic_of_ast status) tactics) + | GrafiteAst.First (loc, tactics) -> + Tacticals.first (List.map (tactic_of_ast status) tactics) + | GrafiteAst.Try (loc, tactic) -> + Tacticals.try_tactic (tactic_of_ast status tactic) + | GrafiteAst.Solve (loc, tactics) -> + Tacticals.solve_tactics (List.map (tactic_of_ast status) tactics) + | GrafiteAst.Progress (loc, tactic) -> + Tacticals.progress_tactic (tactic_of_ast status tactic) + (* First order tactics *) + | GrafiteAst.Absurd (_, term) -> Tactics.absurd term + | GrafiteAst.Apply (_, term) -> Tactics.apply term + | GrafiteAst.ApplyS (_, term, params) -> + Tactics.applyS ~term ~params ~dbd:(LibraryDb.instance ()) + ~universe:status.GrafiteTypes.universe + | GrafiteAst.Assumption _ -> Tactics.assumption + | GrafiteAst.AutoBatch (_,params) -> + Tactics.auto ~params ~dbd:(LibraryDb.instance ()) + ~universe:status.GrafiteTypes.universe + | GrafiteAst.Cases (_, what, (howmany, names)) -> + Tactics.cases_intros ?howmany ~mk_fresh_name_callback:(namer_of names) + what + | GrafiteAst.Change (_, pattern, with_what) -> + Tactics.change ~pattern with_what + | GrafiteAst.Clear (_,id) -> Tactics.clear id + | GrafiteAst.ClearBody (_,id) -> Tactics.clearbody id + | GrafiteAst.Compose (_,t1,t2,times,(howmany, names)) -> + Tactics.compose times t1 t2 ?howmany + ~mk_fresh_name_callback:(namer_of names) + | GrafiteAst.Contradiction _ -> Tactics.contradiction + | GrafiteAst.Constructor (_, n) -> Tactics.constructor n + | GrafiteAst.Cut (_, ident, term) -> + let names = match ident with None -> [] | Some id -> [Some id] in + Tactics.cut ~mk_fresh_name_callback:(namer_of names) term + | GrafiteAst.Decompose (_, names) -> + let mk_fresh_name_callback = namer_of names in + Tactics.decompose ~mk_fresh_name_callback () + | GrafiteAst.Demodulate _ -> + Tactics.demodulate + ~dbd:(LibraryDb.instance ()) ~universe:status.GrafiteTypes.universe + | GrafiteAst.Destruct (_,xterms) -> Tactics.destruct xterms + | GrafiteAst.Elim (_, what, using, pattern, (depth, names)) -> + Tactics.elim_intros ?using ?depth ~mk_fresh_name_callback:(namer_of names) + ~pattern what + | GrafiteAst.ElimType (_, what, using, (depth, names)) -> + Tactics.elim_type ?using ?depth ~mk_fresh_name_callback:(namer_of names) + what + | GrafiteAst.Exact (_, term) -> Tactics.exact term + | GrafiteAst.Exists _ -> Tactics.exists + | GrafiteAst.Fail _ -> Tactics.fail + | GrafiteAst.Fold (_, reduction_kind, term, pattern) -> + let reduction = + match reduction_kind with + | `Normalize -> + PET.const_lazy_reduction + (CicReduction.normalize ~delta:false ~subst:[]) + | `Reduce -> PET.const_lazy_reduction ProofEngineReduction.reduce + | `Simpl -> PET.const_lazy_reduction ProofEngineReduction.simpl + | `Unfold None -> + PET.const_lazy_reduction (ProofEngineReduction.unfold ?what:None) + | `Unfold (Some lazy_term) -> + (fun context metasenv ugraph -> + let what, metasenv, ugraph = lazy_term context metasenv ugraph in + ProofEngineReduction.unfold ~what, metasenv, ugraph) + | `Whd -> + PET.const_lazy_reduction (CicReduction.whd ~delta:false ~subst:[]) + in + Tactics.fold ~reduction ~term ~pattern + | GrafiteAst.Fourier _ -> Tactics.fourier + | GrafiteAst.FwdSimpl (_, hyp, names) -> + Tactics.fwd_simpl ~mk_fresh_name_callback:(namer_of names) + ~dbd:(LibraryDb.instance ()) hyp + | GrafiteAst.Generalize (_,pattern,ident) -> + let names = match ident with None -> [] | Some id -> [Some id] in + Tactics.generalize ~mk_fresh_name_callback:(namer_of names) pattern + | GrafiteAst.IdTac _ -> Tactics.id + | GrafiteAst.Intros (_, (howmany, names)) -> + PrimitiveTactics.intros_tac ?howmany + ~mk_fresh_name_callback:(namer_of names) () + | GrafiteAst.Inversion (_, term) -> + Tactics.inversion term + | GrafiteAst.LApply (_, linear, how_many, to_what, what, ident) -> + let names = match ident with None -> [] | Some id -> [Some id] in + Tactics.lapply ~mk_fresh_name_callback:(namer_of names) + ~linear ?how_many ~to_what what + | GrafiteAst.Left _ -> Tactics.left + | GrafiteAst.LetIn (loc,term,name) -> + Tactics.letin term ~mk_fresh_name_callback:(namer_of [Some name]) + | GrafiteAst.Reduce (_, reduction_kind, pattern) -> + (match reduction_kind with + | `Normalize -> Tactics.normalize ~pattern + | `Reduce -> Tactics.reduce ~pattern + | `Simpl -> Tactics.simpl ~pattern + | `Unfold what -> Tactics.unfold ~pattern what + | `Whd -> Tactics.whd ~pattern) + | GrafiteAst.Reflexivity _ -> Tactics.reflexivity + | GrafiteAst.Replace (_, pattern, with_what) -> + Tactics.replace ~pattern ~with_what + | GrafiteAst.Rewrite (_, direction, t, pattern, names) -> + EqualityTactics.rewrite_tac ~direction ~pattern t +(* to be replaced with ~mk_fresh_name_callback:(namer_of names) *) + (List.map (function Some s -> s | None -> assert false) names) + | GrafiteAst.Right _ -> Tactics.right + | GrafiteAst.Ring _ -> Tactics.ring + | GrafiteAst.Split _ -> Tactics.split + | GrafiteAst.Symmetry _ -> Tactics.symmetry + | GrafiteAst.Transitivity (_, term) -> Tactics.transitivity term + (* Implementazioni Aggiunte *) + | GrafiteAst.Assume (_, id, t) -> Declarative.assume id t + | GrafiteAst.Suppose (_, t, id, t1) -> Declarative.suppose t id t1 + | GrafiteAst.By_term_we_proved (_, t, ty, id, t1) -> + Declarative.by_term_we_proved ~dbd:(LibraryDb.instance()) + ~universe:status.GrafiteTypes.universe t ty id t1 + | GrafiteAst.We_need_to_prove (_, t, id, t2) -> + Declarative.we_need_to_prove t id t2 + | GrafiteAst.Bydone (_, t) -> + Declarative.bydone ~dbd:(LibraryDb.instance()) + ~universe:status.GrafiteTypes.universe t + | GrafiteAst.We_proceed_by_cases_on (_, t, t1) -> + Declarative.we_proceed_by_cases_on t t1 + | GrafiteAst.We_proceed_by_induction_on (_, t, t1) -> + Declarative.we_proceed_by_induction_on t t1 + | GrafiteAst.Byinduction (_, t, id) -> Declarative.byinduction t id + | GrafiteAst.Thesisbecomes (_, t) -> Declarative.thesisbecomes t + | GrafiteAst.ExistsElim (_, t, id1, t1, id2, t2) -> + Declarative.existselim ~dbd:(LibraryDb.instance()) + ~universe:status.GrafiteTypes.universe t id1 t1 id2 t2 + | GrafiteAst.Case (_,id,params) -> Declarative.case id params + | GrafiteAst.AndElim(_,t,id1,t1,id2,t2) -> Declarative.andelim t id1 t1 id2 t2 + | GrafiteAst.RewritingStep (_,termine,t1,t2,cont) -> + Declarative.rewritingstep ~dbd:(LibraryDb.instance ()) + ~universe:status.GrafiteTypes.universe termine t1 t2 cont + +let classify_tactic tactic = + match tactic with + (* tactics that can't close the goal (return a goal we want to "select") *) + | GrafiteAst.Rewrite _ + | GrafiteAst.Split _ + | GrafiteAst.Replace _ + | GrafiteAst.Reduce _ + | GrafiteAst.IdTac _ + | GrafiteAst.Generalize _ + | GrafiteAst.Elim _ + | GrafiteAst.Cut _ + | GrafiteAst.Decompose _ -> true + (* tactics like apply *) + | _ -> false + +let reorder_metasenv start refine tactic goals current_goal always_opens_a_goal= +(* let print_m name metasenv = + prerr_endline (">>>>> " ^ name); + prerr_endline (CicMetaSubst.ppmetasenv [] metasenv) + in *) + (* phase one calculates: + * new_goals_from_refine: goals added by refine + * head_goal: the first goal opened by ythe tactic + * other_goals: other goals opened by the tactic + *) + let new_goals_from_refine = PEH.compare_metasenvs start refine in + let new_goals_from_tactic = PEH.compare_metasenvs refine tactic in + let head_goal, other_goals, goals = + match goals with + | [] -> None,[],goals + | hd::tl -> + (* assert (List.mem hd new_goals_from_tactic); + * invalidato dalla goal_tac + * *) + Some hd, List.filter ((<>) hd) new_goals_from_tactic, List.filter ((<>) + hd) goals + in + let produced_goals = + match head_goal with + | None -> new_goals_from_refine @ other_goals + | Some x -> x :: new_goals_from_refine @ other_goals + in + (* extract the metas generated by refine and tactic *) + let metas_for_tactic_head = + match head_goal with + | None -> [] + | Some head_goal -> List.filter (fun (n,_,_) -> n = head_goal) tactic in + let metas_for_tactic_goals = + List.map + (fun x -> List.find (fun (metano,_,_) -> metano = x) tactic) + goals + in + let metas_for_refine_goals = + List.filter (fun (n,_,_) -> List.mem n new_goals_from_refine) tactic in + let produced_metas, goals = + let produced_metas = + if always_opens_a_goal then + metas_for_tactic_head @ metas_for_refine_goals @ + metas_for_tactic_goals + else begin +(* print_m "metas_for_refine_goals" metas_for_refine_goals; + print_m "metas_for_tactic_head" metas_for_tactic_head; + print_m "metas_for_tactic_goals" metas_for_tactic_goals; *) + metas_for_refine_goals @ metas_for_tactic_head @ + metas_for_tactic_goals + end + in + let goals = List.map (fun (metano, _, _) -> metano) produced_metas in + produced_metas, goals + in + (* residual metas, preserving the original order *) + let before, after = + let rec split e = + function + | [] -> [],[] + | (metano, _, _) :: tl when metano = e -> + [], List.map (fun (x,_,_) -> x) tl + | (metano, _, _) :: tl -> let b, a = split e tl in metano :: b, a + in + let find n metasenv = + try + Some (List.find (fun (metano, _, _) -> metano = n) metasenv) + with Not_found -> None + in + let extract l = + List.fold_right + (fun n acc -> + match find n tactic with + | Some x -> x::acc + | None -> acc + ) l [] in + let before_l, after_l = split current_goal start in + let before_l = + List.filter (fun x -> not (List.mem x produced_goals)) before_l in + let after_l = + List.filter (fun x -> not (List.mem x produced_goals)) after_l in + let before = extract before_l in + let after = extract after_l in + before, after + in +(* |+ DEBUG CODE +| + print_m "BEGIN" start; + prerr_endline ("goal was: " ^ string_of_int current_goal); + prerr_endline ("and metas from refine are:"); + List.iter + (fun t -> prerr_string (" " ^ string_of_int t)) + new_goals_from_refine; + prerr_endline ""; + print_m "before" before; + print_m "metas_for_tactic_head" metas_for_tactic_head; + print_m "metas_for_refine_goals" metas_for_refine_goals; + print_m "metas_for_tactic_goals" metas_for_tactic_goals; + print_m "produced_metas" produced_metas; + print_m "after" after; +|+ FINE DEBUG CODE +| *) + before @ produced_metas @ after, goals + +let apply_tactic ~disambiguate_tactic (text,prefix_len,tactic) (status, goal) = + let starting_metasenv = GrafiteTypes.get_proof_metasenv status in + let before = List.map (fun g, _, _ -> g) starting_metasenv in + let status, tactic = disambiguate_tactic status goal (text,prefix_len,tactic) in + let metasenv_after_refinement = GrafiteTypes.get_proof_metasenv status in + let proof = GrafiteTypes.get_current_proof status in + let proof_status = proof, goal in + let always_opens_a_goal = classify_tactic tactic in + let tactic = tactic_of_ast status tactic in + let (proof, opened) = ProofEngineTypes.apply_tactic tactic proof_status in + let after = ProofEngineTypes.goals_of_proof proof in + let opened_goals, closed_goals = Tacticals.goals_diff ~before ~after ~opened in + let proof, opened_goals = + let uri, metasenv_after_tactic, _subst, t, ty, attrs = proof in + let reordered_metasenv, opened_goals = + reorder_metasenv + starting_metasenv + metasenv_after_refinement metasenv_after_tactic + opened goal always_opens_a_goal + in + let proof' = uri, reordered_metasenv, _subst, t, ty, attrs in + proof', opened_goals + in + let incomplete_proof = + match status.GrafiteTypes.proof_status with + | GrafiteTypes.Incomplete_proof p -> p + | _ -> assert false + in + { status with GrafiteTypes.proof_status = + GrafiteTypes.Incomplete_proof + { incomplete_proof with GrafiteTypes.proof = proof } }, + opened_goals, closed_goals + +let apply_atomic_tactical ~disambiguate_tactic ~patch (text,prefix_len,tactic) (status, goal) = + let starting_metasenv = GrafiteTypes.get_proof_metasenv status in + let before = List.map (fun g, _, _ -> g) starting_metasenv in + let status, tactic = disambiguate_tactic status goal (text,prefix_len,tactic) in + let metasenv_after_refinement = GrafiteTypes.get_proof_metasenv status in + let proof = GrafiteTypes.get_current_proof status in + let proof_status = proof, goal in + let always_opens_a_goal = classify_tactic tactic in + let tactic = tactic_of_ast status tactic in + let tactic = patch tactic in + let (proof, opened) = ProofEngineTypes.apply_tactic tactic proof_status in + let after = ProofEngineTypes.goals_of_proof proof in + let opened_goals, closed_goals = Tacticals.goals_diff ~before ~after ~opened in + let proof, opened_goals = + let uri, metasenv_after_tactic, _subst, t, ty, attrs = proof in + let reordered_metasenv, opened_goals = + reorder_metasenv + starting_metasenv + metasenv_after_refinement metasenv_after_tactic + opened goal always_opens_a_goal + in + let proof' = uri, reordered_metasenv, _subst, t, ty, attrs in + proof', opened_goals + in + let incomplete_proof = + match status.GrafiteTypes.proof_status with + | GrafiteTypes.Incomplete_proof p -> p + | _ -> assert false + in + { status with GrafiteTypes.proof_status = + GrafiteTypes.Incomplete_proof + { incomplete_proof with GrafiteTypes.proof = proof } }, + opened_goals, closed_goals +type eval_ast = + {ea_go: + 'term 'lazy_term 'reduction 'obj 'ident. + disambiguate_tactic: + (GrafiteTypes.status -> + ProofEngineTypes.goal -> + (('term, 'lazy_term, 'reduction, 'ident) GrafiteAst.tactic) + disambiguator_input -> + GrafiteTypes.status * + (Cic.term, Cic.lazy_term, Cic.lazy_term GrafiteAst.reduction, string) GrafiteAst.tactic) -> + + disambiguate_command: + (GrafiteTypes.status -> + (('term,'obj) GrafiteAst.command) disambiguator_input -> + GrafiteTypes.status * (Cic.term,Cic.obj) GrafiteAst.command) -> + + disambiguate_macro: + (GrafiteTypes.status -> + ('term GrafiteAst.macro) disambiguator_input -> + Cic.context -> GrafiteTypes.status * Cic.term GrafiteAst.macro) -> + + ?do_heavy_checks:bool -> + ?clean_baseuri:bool -> + GrafiteTypes.status -> + (('term, 'lazy_term, 'reduction, 'obj, 'ident) GrafiteAst.statement) + disambiguator_input -> + GrafiteTypes.status * UriManager.uri list + } + +type 'a eval_command = + {ec_go: 'term 'obj. + disambiguate_command: + (GrafiteTypes.status -> (('term,'obj) GrafiteAst.command) disambiguator_input -> + GrafiteTypes.status * (Cic.term,Cic.obj) GrafiteAst.command) -> + options -> GrafiteTypes.status -> + (('term,'obj) GrafiteAst.command) disambiguator_input -> + GrafiteTypes.status * UriManager.uri list + } + +type 'a eval_executable = + {ee_go: 'term 'lazy_term 'reduction 'obj 'ident. + disambiguate_tactic: + (GrafiteTypes.status -> + ProofEngineTypes.goal -> + (('term, 'lazy_term, 'reduction, 'ident) GrafiteAst.tactic) + disambiguator_input -> + GrafiteTypes.status * + (Cic.term, Cic.lazy_term, Cic.lazy_term GrafiteAst.reduction, string) GrafiteAst.tactic) -> + + disambiguate_command: + (GrafiteTypes.status -> + (('term,'obj) GrafiteAst.command) disambiguator_input -> + GrafiteTypes.status * (Cic.term,Cic.obj) GrafiteAst.command) -> + + disambiguate_macro: + (GrafiteTypes.status -> + ('term GrafiteAst.macro) disambiguator_input -> + Cic.context -> GrafiteTypes.status * Cic.term GrafiteAst.macro) -> + + options -> + GrafiteTypes.status -> + (('term, 'lazy_term, 'reduction, 'obj, 'ident) GrafiteAst.code) disambiguator_input -> + GrafiteTypes.status * UriManager.uri list + } + +type 'a eval_from_moo = + { efm_go: GrafiteTypes.status -> string -> GrafiteTypes.status } + +let coercion_moo_statement_of (uri,arity, saturations) = + GrafiteAst.Coercion (HExtlib.dummy_floc, uri, false, arity, saturations) + +let refinement_toolkit = { + RefinementTool.type_of_aux' = + (fun ?localization_tbl e c t u -> + let saved = !CicRefine.insert_coercions in + CicRefine.insert_coercions:= false; + let rc = + try + let t, ty, metasenv, ugraph = + CicRefine.type_of_aux' ?localization_tbl e c t u in + RefinementTool.Success (t, ty, metasenv, ugraph) + with + | CicRefine.RefineFailure s + | CicRefine.Uncertain s + | CicRefine.AssertFailure s -> RefinementTool.Exception s + in + CicRefine.insert_coercions := saved; + rc); + RefinementTool.ppsubst = CicMetaSubst.ppsubst; + RefinementTool.apply_subst = CicMetaSubst.apply_subst; + RefinementTool.ppmetasenv = CicMetaSubst.ppmetasenv; + RefinementTool.pack_coercion_obj = CicRefine.pack_coercion_obj; + } + +let eval_coercion status ~add_composites uri arity saturations baseuri = + let status,compounds = + GrafiteSync.add_coercion ~add_composites refinement_toolkit status uri arity + saturations baseuri + in + let moo_content = + List.map coercion_moo_statement_of ((uri,arity,saturations)::compounds) + in + let status = GrafiteTypes.add_moo_content moo_content status in + {status with GrafiteTypes.proof_status = GrafiteTypes.No_proof}, + List.map (fun u,_,_ -> u) compounds + +module MatitaStatus = + struct + type input_status = GrafiteTypes.status * ProofEngineTypes.goal + + type output_status = + GrafiteTypes.status * ProofEngineTypes.goal list * ProofEngineTypes.goal list + + type tactic = input_status -> output_status + + let mk_tactic tac = tac + let apply_tactic tac = tac + let goals (_, opened, closed) = opened, closed + let get_stack (status, _) = GrafiteTypes.get_stack status + + let set_stack stack (status, opened, closed) = + GrafiteTypes.set_stack stack status, opened, closed + + let inject (status, _) = (status, [], []) + let focus goal (status, _, _) = (status, goal) + end + +module MatitaTacticals = Continuationals.Make(MatitaStatus) + +let tactic_of_ast' tac = + MatitaTacticals.Tactical (MatitaTacticals.Tactic (MatitaStatus.mk_tactic tac)) + +let punctuation_tactical_of_ast (text,prefix_len,punct) = + match punct with + | GrafiteAst.Dot _loc -> MatitaTacticals.Dot + | GrafiteAst.Semicolon _loc -> MatitaTacticals.Semicolon + | GrafiteAst.Branch _loc -> MatitaTacticals.Branch + | GrafiteAst.Shift _loc -> MatitaTacticals.Shift + | GrafiteAst.Pos (_loc, i) -> MatitaTacticals.Pos i + | GrafiteAst.Merge _loc -> MatitaTacticals.Merge + | GrafiteAst.Wildcard _loc -> MatitaTacticals.Wildcard + +let non_punctuation_tactical_of_ast (text,prefix_len,punct) = + match punct with + | GrafiteAst.Focus (_loc,goals) -> MatitaTacticals.Focus goals + | GrafiteAst.Unfocus _loc -> MatitaTacticals.Unfocus + | GrafiteAst.Skip _loc -> MatitaTacticals.Tactical MatitaTacticals.Skip + +let eval_tactical status tac = + let status, _, _ = MatitaTacticals.eval tac (status, ~-1) in + let status = (* is proof completed? *) + match status.GrafiteTypes.proof_status with + | GrafiteTypes.Incomplete_proof + { GrafiteTypes.stack = stack; proof = proof } + when Continuationals.Stack.is_empty stack -> + { status with GrafiteTypes.proof_status = GrafiteTypes.Proof proof } + | _ -> status + in + status + +let eval_comment status c = status + +(* since the record syntax allows to declare coercions, we have to put this + * information inside the moo *) +let add_coercions_of_record_to_moo obj lemmas status = + let attributes = CicUtil.attributes_of_obj obj in + let is_record = function `Class (`Record att) -> Some att | _-> None in + match HExtlib.list_findopt is_record attributes with + | None -> status,[] + | Some fields -> + let is_a_coercion uri = + try + let obj,_ = + CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri in + let attrs = CicUtil.attributes_of_obj obj in + try + match List.find + (function `Class (`Coercion _) -> true | _-> false) attrs + with `Class (`Coercion n) -> true,n | _ -> assert false + with Not_found -> false,0 + with Not_found -> assert false + in + let buri, status = GrafiteTypes.get_baseuri status in + (* looking at the fields we can know the 'wanted' coercions, but not the + * actually generated ones. So, only the intersection between the wanted + * and the actual should be in the moo as coercion, while everithing in + * lemmas should go as aliases *) + let wanted_coercions = + HExtlib.filter_map + (function + | (name,true,arity) -> + Some + (arity, UriManager.uri_of_string (buri ^ "/" ^ name ^ ".con" )) + | _ -> None) + fields + in + (*prerr_endline "wanted coercions:"; + List.iter + (fun u -> prerr_endline (UriManager.string_of_uri u)) + wanted_coercions; *) + let coercions, moo_content = + List.split + (HExtlib.filter_map + (fun uri -> + let is_a_wanted_coercion,arity_wanted = + try + let arity,_ = + List.find (fun (n,u) -> UriManager.eq u uri) + wanted_coercions + in + true, arity + with Not_found -> false, 0 + in + let is_a_coercion, arity_coercion = is_a_coercion uri in + if is_a_coercion then + Some (uri, coercion_moo_statement_of (uri,arity_coercion,0)) + else if is_a_wanted_coercion then + Some (uri, coercion_moo_statement_of (uri,arity_wanted,0)) + else + None) + lemmas) + in + (*prerr_endline "actual coercions:"; + List.iter + (fun u -> prerr_endline (UriManager.string_of_uri u)) + coercions; + prerr_endline "lemmas was:"; + List.iter + (fun u -> prerr_endline (UriManager.string_of_uri u)) + lemmas; *) + let status = GrafiteTypes.add_moo_content moo_content status in + {status with + GrafiteTypes.coercions = coercions @ status.GrafiteTypes.coercions}, + lemmas + +let add_obj uri obj status = + let status,lemmas = GrafiteSync.add_obj refinement_toolkit uri obj status in + status, lemmas + +let rec eval_command = {ec_go = fun ~disambiguate_command opts status +(text,prefix_len,cmd) -> + let status,cmd = disambiguate_command status (text,prefix_len,cmd) in + let status,uris = + match cmd with + | GrafiteAst.Index (loc,None,uri) -> + assert false (* TODO: for user input *) + | GrafiteAst.Index (loc,Some key,uri) -> + let universe = Universe.index + status.GrafiteTypes.universe key (CicUtil.term_of_uri uri) in + let status = {status with GrafiteTypes.universe = universe} in +(* debug + let msg = + let candidates = Universe.get_candidates status.GrafiteTypes.universe key in + ("candidates for " ^ (CicPp.ppterm key) ^ " = " ^ + (String.concat "\n" (List.map CicPp.ppterm candidates))) + in + prerr_endline msg; +*) + let status = GrafiteTypes.add_moo_content [cmd] status in + status,[] + | GrafiteAst.Coercion (loc, uri, add_composites, arity, saturations) -> + eval_coercion status ~add_composites uri arity saturations + (GrafiteTypes.get_string_option status "baseuri") + | GrafiteAst.Default (loc, what, uris) as cmd -> + LibraryObjects.set_default what uris; + GrafiteTypes.add_moo_content [cmd] status,[] + | GrafiteAst.Drop loc -> raise Drop + | GrafiteAst.Include (loc, baseuri) -> + let moopath_rw, moopath_r = + LibraryMisc.obj_file_of_baseuri + ~must_exist:false ~baseuri ~writable:true, + LibraryMisc.obj_file_of_baseuri + ~must_exist:false ~baseuri ~writable:false + in + let moopath = + if Sys.file_exists moopath_r then moopath_r else + if Sys.file_exists moopath_rw then moopath_rw else + raise (IncludedFileNotCompiled (moopath_rw,baseuri)) + in + let status = eval_from_moo.efm_go status moopath in +(* debug + let lt_uri = UriManager.uri_of_string "cic:/matita/nat/orders/lt.con" in + let nat_uri = UriManager.uri_of_string "cic:/matita/nat/nat/nat.ind" in + let nat = Cic.MutInd(nat_uri,0,[]) in + let zero = Cic.MutConstruct(nat_uri,0,1,[]) in + let succ = Cic.MutConstruct(nat_uri,0,2,[]) in + let fake= Cic.Meta(-1,[]) in + let term= Cic.Appl [Cic.Const (lt_uri,[]);zero;Cic.Appl[succ;zero]] in let msg = + let candidates = Universe.get_candidates status.GrafiteTypes.universe term in + ("candidates for " ^ (CicPp.ppterm term) ^ " = " ^ + (String.concat "\n" (List.map CicPp.ppterm candidates))) + in + prerr_endline msg; +*) + status,[] + | GrafiteAst.Print (_,"proofterm") -> + let _,_,_,p,_, _ = GrafiteTypes.get_current_proof status in + print_endline (Auto.pp_proofterm p); + status,[] + | GrafiteAst.Print (_,_) -> status,[] + | GrafiteAst.Qed loc -> + let uri, metasenv, _subst, bo, ty, attrs = + match status.GrafiteTypes.proof_status with + | GrafiteTypes.Proof (Some uri, metasenv, subst, body, ty, attrs) -> + uri, metasenv, subst, body, ty, attrs + | GrafiteTypes.Proof (None, metasenv, subst, body, ty, attrs) -> + raise (GrafiteTypes.Command_error + ("Someone allows to start a theorem without giving the "^ + "name/uri. This should be fixed!")) + | _-> + raise + (GrafiteTypes.Command_error "You can't Qed an incomplete theorem") + in + if metasenv <> [] then + raise + (GrafiteTypes.Command_error + "Proof not completed! metasenv is not empty!"); + let name = UriManager.name_of_uri uri in + let obj = Cic.Constant (name,Some bo,ty,[],attrs) in + let status, lemmas = add_obj uri obj status in + {status with + GrafiteTypes.proof_status = GrafiteTypes.No_proof}, + (*CSC: I throw away the arities *) + uri::lemmas + | GrafiteAst.Relation (loc, id, a, aeq, refl, sym, trans) -> + Setoids.add_relation id a aeq refl sym trans; + status, [] (*CSC: TO BE FIXED *) + | GrafiteAst.Set (loc, name, value) -> + GrafiteTypes.set_option status name value,[] + | GrafiteAst.Obj (loc,obj) -> + let ext,name = + match obj with + Cic.Constant (name,_,_,_,_) + | Cic.CurrentProof (name,_,_,_,_,_) -> ".con",name + | Cic.InductiveDefinition (types,_,_,_) -> + ".ind", + (match types with (name,_,_,_)::_ -> name | _ -> assert false) + | _ -> assert false in + let buri, status = GrafiteTypes.get_baseuri status in + let uri = UriManager.uri_of_string (buri ^ "/" ^ name ^ ext) in + let obj = CicRefine.pack_coercion_obj obj in + let metasenv = GrafiteTypes.get_proof_metasenv status in + match obj with + | Cic.CurrentProof (_,metasenv',bo,ty,_, attrs) -> + let name = UriManager.name_of_uri uri in + if not(CicPp.check name ty) then + HLog.warn ("Bad name: " ^ name); + if opts.do_heavy_checks then + begin + let dbd = LibraryDb.instance () in + let similar = Whelp.match_term ~dbd ty in + let similar_len = List.length similar in + if similar_len> 30 then + (HLog.message + ("Duplicate check will compare your theorem with " ^ + string_of_int similar_len ^ + " theorems, this may take a while.")); + let convertible = + List.filter ( + fun u -> + let t = CicUtil.term_of_uri u in + let ty',g = + CicTypeChecker.type_of_aux' + metasenv' [] t CicUniv.empty_ugraph + in + fst(CicReduction.are_convertible [] ty' ty g)) + similar + in + (match convertible with + | [] -> () + | x::_ -> + HLog.warn + ("Theorem already proved: " ^ UriManager.string_of_uri x ^ + "\nPlease use a variant.")); + end; + let _subst = [] in + let initial_proof = (Some uri, metasenv', _subst, bo, ty, attrs) in + let initial_stack = Continuationals.Stack.of_metasenv metasenv' in + { status with GrafiteTypes.proof_status = + GrafiteTypes.Incomplete_proof + { GrafiteTypes.proof = initial_proof; stack = initial_stack } }, + [] + | _ -> + if metasenv <> [] then + raise (GrafiteTypes.Command_error ( + "metasenv not empty while giving a definition with body: " ^ + CicMetaSubst.ppmetasenv [] metasenv)); + let status, lemmas = add_obj uri obj status in + let status,new_lemmas = + add_coercions_of_record_to_moo obj lemmas status + in + {status with GrafiteTypes.proof_status = GrafiteTypes.No_proof}, + uri::new_lemmas@lemmas + in + match status.GrafiteTypes.proof_status with + GrafiteTypes.Intermediate _ -> + {status with GrafiteTypes.proof_status = GrafiteTypes.No_proof},uris + | _ -> status,uris + +} and eval_executable = {ee_go = fun ~disambiguate_tactic ~disambiguate_command +~disambiguate_macro opts status (text,prefix_len,ex) -> + match ex with + | GrafiteAst.Tactic (_, Some tac, punct) -> + let tac = apply_tactic ~disambiguate_tactic (text,prefix_len,tac) in + let status = eval_tactical status (tactic_of_ast' tac) in + eval_tactical status + (punctuation_tactical_of_ast (text,prefix_len,punct)),[] + | GrafiteAst.Tactic (_, None, punct) -> + eval_tactical status + (punctuation_tactical_of_ast (text,prefix_len,punct)),[] + | GrafiteAst.NonPunctuationTactical (_, tac, punct) -> + let status = + eval_tactical status + (non_punctuation_tactical_of_ast (text,prefix_len,tac)) + in + eval_tactical status + (punctuation_tactical_of_ast (text,prefix_len,punct)),[] + | GrafiteAst.Command (_, cmd) -> + eval_command.ec_go ~disambiguate_command opts status (text,prefix_len,cmd) + | GrafiteAst.Macro (loc, macro) -> + raise (Macro (loc,disambiguate_macro status (text,prefix_len,macro))) + +} and eval_from_moo = {efm_go = fun status fname -> + let ast_of_cmd cmd = + ("",0,GrafiteAst.Executable (HExtlib.dummy_floc, + GrafiteAst.Command (HExtlib.dummy_floc, + cmd))) + in + let moo = GrafiteMarshal.load_moo fname in + List.fold_left + (fun status ast -> + let ast = ast_of_cmd ast in + let status,lemmas = + eval_ast.ea_go + ~disambiguate_tactic:(fun status _ (_,_,tactic) -> status,tactic) + ~disambiguate_command:(fun status (_,_,cmd) -> status,cmd) + ~disambiguate_macro:(fun _ _ -> assert false) + status ast + in + assert (lemmas=[]); + status) + status moo +} and eval_ast = {ea_go = fun ~disambiguate_tactic ~disambiguate_command +~disambiguate_macro ?(do_heavy_checks=false) ?(clean_baseuri=true) status +(text,prefix_len,st) +-> + let opts = { + do_heavy_checks = do_heavy_checks ; + clean_baseuri = clean_baseuri } + in + match st with + | GrafiteAst.Executable (_,ex) -> + eval_executable.ee_go ~disambiguate_tactic ~disambiguate_command + ~disambiguate_macro opts status (text,prefix_len,ex) + | GrafiteAst.Comment (_,c) -> eval_comment status (text,prefix_len,c),[] +} + +let eval_ast = eval_ast.ea_go diff --git a/components/grafite_engine/grafiteEngine.mli b/components/grafite_engine/grafiteEngine.mli new file mode 100644 index 000000000..63580ad2e --- /dev/null +++ b/components/grafite_engine/grafiteEngine.mli @@ -0,0 +1,59 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception Drop +exception IncludedFileNotCompiled of string * string +exception Macro of + GrafiteAst.loc * + (Cic.context -> GrafiteTypes.status * Cic.term GrafiteAst.macro) + +type 'a disambiguator_input = string * int * 'a + +val eval_ast : + disambiguate_tactic: + (GrafiteTypes.status -> + ProofEngineTypes.goal -> + (('term, 'lazy_term, 'reduction, 'ident) GrafiteAst.tactic) + disambiguator_input -> + GrafiteTypes.status * + (Cic.term, Cic.lazy_term, Cic.lazy_term GrafiteAst.reduction, string) GrafiteAst.tactic) -> + + disambiguate_command: + (GrafiteTypes.status -> + (('term,'obj) GrafiteAst.command) disambiguator_input -> + GrafiteTypes.status * (Cic.term, Cic.obj) GrafiteAst.command) -> + + disambiguate_macro: + (GrafiteTypes.status -> + ('term GrafiteAst.macro) disambiguator_input -> + Cic.context -> GrafiteTypes.status * Cic.term GrafiteAst.macro) -> + + ?do_heavy_checks:bool -> + ?clean_baseuri:bool -> + GrafiteTypes.status -> + (('term, 'lazy_term, 'reduction, 'obj, 'ident) GrafiteAst.statement) + disambiguator_input -> + (* the new status and generated objects, if any *) + GrafiteTypes.status * UriManager.uri list diff --git a/components/grafite_engine/grafiteSync.ml b/components/grafite_engine/grafiteSync.ml new file mode 100644 index 000000000..133dad2c0 --- /dev/null +++ b/components/grafite_engine/grafiteSync.ml @@ -0,0 +1,148 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let is_a_variant obj = + match obj with + | Cic.Constant(_,_,_,_,attrs) -> + List.exists (fun x -> x = `Flavour `Variant) attrs + | _ -> false + +let uris_for_inductive_type uri obj = + match obj with + | Cic.InductiveDefinition(types,_,_,_) -> + let suri = UriManager.string_of_uri uri in + let uris,_ = + List.fold_left + (fun (acc,i) (_,_,_,constructors)-> + let is = string_of_int i in + let newacc,_ = + List.fold_left + (fun (acc,j) _ -> + let js = string_of_int j in + UriManager.uri_of_string + (suri^"#xpointer(1/"^is^"/"^js^")")::acc,j+1) + (acc,1) constructors + in + newacc,i+1) + ([],1) types + in uris + | _ -> [uri] + +let add_obj refinement_toolkit uri obj status = + let baseuri, status = GrafiteTypes.get_baseuri status in + let lemmas = LibrarySync.add_obj refinement_toolkit uri obj in + let add_to_universe (universe,status) uri = + let term = CicUtil.term_of_uri uri in + let ty,_ = CicTypeChecker.type_of_aux' [] [] term CicUniv.empty_ugraph in +(* prop filtering + let sort,_ = CicTypeChecker.type_of_aux' [] [] ty CicUniv.empty_ugraph in + prerr_endline (CicPp.ppterm term); + prerr_endline (CicPp.ppterm sort); + let tkeys = + if sort = Cic.Sort(Cic.Prop) then Universe.keys [] ty + else [] + in +*) + let tkeys = Universe.keys [] ty in + let index_cmd = + List.map + (fun key -> GrafiteAst.Index(HExtlib.dummy_floc,(Some key),uri)) + tkeys + in +(* prop filtering + let universe = + if sort = Cic.Sort(Cic.Prop) then + Universe.index_term_and_unfolded_term universe [] term ty + else universe +*) + let universe = Universe.index_term_and_unfolded_term universe [] term ty + in + let status = GrafiteTypes.add_moo_content index_cmd status in + (universe,status) + in + let uris_to_index = + if is_a_variant obj then [] + else (uris_for_inductive_type uri obj)@lemmas + in + let universe,status = + List.fold_left add_to_universe + (status.GrafiteTypes.universe,status) + uris_to_index + in + {status with + GrafiteTypes.objects = uri::status.GrafiteTypes.objects; + GrafiteTypes.universe = universe}, + lemmas + +let add_coercion refinement_toolkit ~add_composites status uri arity + saturations baseuri += + let compounds = + LibrarySync.add_coercion ~add_composites refinement_toolkit uri arity + saturations baseuri in + {status with GrafiteTypes.coercions = uri :: status.GrafiteTypes.coercions}, + compounds + +module OrderedUri = +struct + type t = UriManager.uri * string + let compare (u1, _) (u2, _) = UriManager.compare u1 u2 +end + +module UriSet = Set.Make (OrderedUri) + + (** @return l2 \ l1 *) +let uri_list_diff l2 l1 = + let module S = UriManager.UriSet in + let s1 = List.fold_left (fun set uri -> S.add uri set) S.empty l1 in + let s2 = List.fold_left (fun set uri -> S.add uri set) S.empty l2 in + let diff = S.diff s2 s1 in + S.fold (fun uri uris -> uri :: uris) diff [] + +let time_travel ~present ~past = + let objs_to_remove = + uri_list_diff present.GrafiteTypes.objects past.GrafiteTypes.objects in + let coercions_to_remove = + uri_list_diff present.GrafiteTypes.coercions past.GrafiteTypes.coercions + in + List.iter (fun uri -> LibrarySync.remove_coercion uri) coercions_to_remove; + List.iter LibrarySync.remove_obj objs_to_remove + +let init () = + LibrarySync.remove_all_coercions (); + LibraryObjects.reset_defaults (); + { + GrafiteTypes.moo_content_rev = []; + proof_status = GrafiteTypes.No_proof; + options = GrafiteTypes.no_options; + objects = []; + coercions = []; + universe = Universe.empty; + baseuri = None; + } diff --git a/components/grafite_engine/grafiteSync.mli b/components/grafite_engine/grafiteSync.mli new file mode 100644 index 000000000..0a2595430 --- /dev/null +++ b/components/grafite_engine/grafiteSync.mli @@ -0,0 +1,43 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val add_obj: + RefinementTool.kit -> + UriManager.uri -> Cic.obj -> GrafiteTypes.status -> + GrafiteTypes.status * UriManager.uri list + +val add_coercion: + RefinementTool.kit -> + add_composites:bool -> GrafiteTypes.status -> + UriManager.uri -> int -> int -> + string (* baseuri *) -> + GrafiteTypes.status * (UriManager.uri * int * int) list + (* URI, arity, saturations *) + +val time_travel: + present:GrafiteTypes.status -> past:GrafiteTypes.status -> unit + + (* also resets the imperative part of the status *) +val init: unit -> GrafiteTypes.status diff --git a/components/grafite_engine/grafiteTypes.ml b/components/grafite_engine/grafiteTypes.ml new file mode 100644 index 000000000..01fb19c58 --- /dev/null +++ b/components/grafite_engine/grafiteTypes.ml @@ -0,0 +1,198 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +exception Option_error of string * string +exception Statement_error of string +exception Command_error of string + +let command_error msg = raise (Command_error msg) + +type incomplete_proof = { + proof: ProofEngineTypes.proof; + stack: Continuationals.Stack.t; +} + +type proof_status = + | No_proof + | Incomplete_proof of incomplete_proof + | Proof of ProofEngineTypes.proof + | Intermediate of Cic.metasenv + (* Status in which the proof could be while it is being processed by the + * engine. No status entering/exiting the engine could be in it. *) + +module StringMap = Map.Make (String) +type option_value = + | String of string + | Int of int +type options = option_value StringMap.t +let no_options = StringMap.empty + +type status = { + moo_content_rev: GrafiteMarshal.moo; + proof_status: proof_status; + options: options; + objects: UriManager.uri list; + coercions: UriManager.uri list; + universe:Universe.universe; + baseuri: string option; +} + +let get_current_proof status = + match status.proof_status with + | Incomplete_proof { proof = p } -> p + | Proof p -> p + | _ -> raise (Statement_error "no ongoing proof") + +let get_proof_metasenv status = + match status.proof_status with + | No_proof -> [] + | Proof (_, metasenv, _, _, _, _) + | Incomplete_proof { proof = (_, metasenv, _, _, _, _) } + | Intermediate metasenv -> + metasenv + +let get_stack status = + match status.proof_status with + | Incomplete_proof p -> p.stack + | Proof _ -> Continuationals.Stack.empty + | _ -> assert false + +let set_stack stack status = + match status.proof_status with + | Incomplete_proof p -> + { status with proof_status = Incomplete_proof { p with stack = stack } } + | Proof _ -> + assert (Continuationals.Stack.is_empty stack); + status + | _ -> assert false + +let set_metasenv metasenv status = + let proof_status = + match status.proof_status with + | No_proof -> Intermediate metasenv + | Incomplete_proof ({ proof = (uri, _, subst, proof, ty, attrs) } as incomplete_proof) -> + Incomplete_proof + { incomplete_proof with proof = (uri, metasenv, subst, proof, ty, attrs) } + | Intermediate _ -> Intermediate metasenv + | Proof (_, metasenv', _, _, _, _) -> + assert (metasenv = metasenv'); + status.proof_status + in + { status with proof_status = proof_status } + +let get_proof_context status goal = + match status.proof_status with + | Incomplete_proof { proof = (_, metasenv, _, _, _, _) } -> + let (_, context, _) = CicUtil.lookup_meta goal metasenv in + context + | _ -> [] + +let get_proof_conclusion status goal = + match status.proof_status with + | Incomplete_proof { proof = (_, metasenv, _, _, _, _) } -> + let (_, _, conclusion) = CicUtil.lookup_meta goal metasenv in + conclusion + | _ -> raise (Statement_error "no ongoing proof") + +let add_moo_content cmds status = + let content = status.moo_content_rev in + let content' = + List.fold_right + (fun cmd acc -> +(* prerr_endline ("adding to moo command: " ^ GrafiteAstPp.pp_command cmd); *) + match cmd with + | GrafiteAst.Default _ + | GrafiteAst.Index _ + | GrafiteAst.Coercion _ -> + if List.mem cmd content then acc + else cmd :: acc + | _ -> cmd :: acc) + cmds content + in +(* prerr_endline ("new moo content: " ^ String.concat " " (List.map + GrafiteAstPp.pp_command content')); *) + { status with moo_content_rev = content' } + +let get_option status name = + try + StringMap.find name status.options + with Not_found -> raise (Option_error (name, "not found")) + +let get_baseuri status = + match status.baseuri with + | Some b -> b, status + | None -> + let _,baseuri,_ = Librarian.baseuri_of_script (Librarian.filename()) in + baseuri, {status with baseuri = Some baseuri} +;; + +let set_option status name value = + let types = [ (* no set options defined! *) ] in + let ty_and_mangler = + try List.assoc name types + with Not_found -> + command_error (Printf.sprintf "Unknown option \"%s\"" name) + in + let value = + match ty_and_mangler with + | `String, f -> String (f value) + | `Int, f -> + (try + Int (int_of_string (f value)) + with Failure _ -> + command_error (Printf.sprintf "Not an integer value \"%s\"" value)) + in + { status with options = StringMap.add name value status.options } + + +let get_string_option status name = + match get_option status name with + | String s -> s + | _ -> raise (Option_error (name, "not a string value")) + +let dump_status status = + HLog.message "status.aliases:\n"; + HLog.message "status.proof_status:"; + HLog.message + (match status.proof_status with + | No_proof -> "no proof\n" + | Incomplete_proof _ -> "incomplete proof\n" + | Proof _ -> "proof\n" + | Intermediate _ -> "Intermediate\n"); + HLog.message "status.options\n"; + StringMap.iter (fun k v -> + let v = + match v with + | String s -> s + | Int i -> string_of_int i + in + HLog.message (k ^ "::=" ^ v)) status.options; + HLog.message "status.coercions\n"; + HLog.message "status.objects:\n"; + List.iter + (fun u -> HLog.message (UriManager.string_of_uri u)) status.objects + diff --git a/components/grafite_engine/grafiteTypes.mli b/components/grafite_engine/grafiteTypes.mli new file mode 100644 index 000000000..a8eb19ac9 --- /dev/null +++ b/components/grafite_engine/grafiteTypes.mli @@ -0,0 +1,80 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +exception Option_error of string * string +exception Statement_error of string +exception Command_error of string + +val command_error: string -> 'a (** @raise Command_error *) + +type incomplete_proof = { + proof: ProofEngineTypes.proof; + stack: Continuationals.Stack.t; +} + +type proof_status = + No_proof + | Incomplete_proof of incomplete_proof + | Proof of ProofEngineTypes.proof + | Intermediate of Cic.metasenv + +type option_value = + | String of string + | Int of int +type options +val no_options: options + +type status = { + moo_content_rev: GrafiteMarshal.moo; + proof_status: proof_status; (** logical status *) + options: options; + objects: UriManager.uri list; (** in-scope objects *) + coercions: UriManager.uri list; (** defined coercions *) + universe:Universe.universe; (** universe of terms used by auto *) + baseuri: string option; +} + +val dump_status : status -> unit + + (** list is not reversed, head command will be the first emitted *) +val add_moo_content: GrafiteMarshal.ast_command list -> status -> status + +val get_option : status -> string -> option_value +val get_string_option : status -> string -> string +val set_option : status -> string -> string -> status +(* to cache the baseuri of current file *) +val get_baseuri: status -> string * status + +val get_current_proof: status -> ProofEngineTypes.proof +val get_proof_metasenv: status -> Cic.metasenv +val get_stack: status -> Continuationals.Stack.t +val get_proof_context : status -> int -> Cic.context +val get_proof_conclusion : status -> int -> Cic.term + +val set_stack: Continuationals.Stack.t -> status -> status +val set_metasenv: Cic.metasenv -> status -> status + diff --git a/components/grafite_parser/.depend b/components/grafite_parser/.depend new file mode 100644 index 000000000..2dc8a7cab --- /dev/null +++ b/components/grafite_parser/.depend @@ -0,0 +1,13 @@ +grafiteWalker.cmi: grafiteParser.cmi +dependenciesParser.cmo: dependenciesParser.cmi +dependenciesParser.cmx: dependenciesParser.cmi +grafiteParser.cmo: dependenciesParser.cmi grafiteParser.cmi +grafiteParser.cmx: dependenciesParser.cmx grafiteParser.cmi +cicNotation2.cmo: grafiteParser.cmi cicNotation2.cmi +cicNotation2.cmx: grafiteParser.cmx cicNotation2.cmi +grafiteDisambiguator.cmo: grafiteDisambiguator.cmi +grafiteDisambiguator.cmx: grafiteDisambiguator.cmi +grafiteDisambiguate.cmo: grafiteDisambiguator.cmi grafiteDisambiguate.cmi +grafiteDisambiguate.cmx: grafiteDisambiguator.cmx grafiteDisambiguate.cmi +grafiteWalker.cmo: grafiteParser.cmi grafiteWalker.cmi +grafiteWalker.cmx: grafiteParser.cmx grafiteWalker.cmi diff --git a/components/grafite_parser/.depend.opt b/components/grafite_parser/.depend.opt new file mode 100644 index 000000000..2dc8a7cab --- /dev/null +++ b/components/grafite_parser/.depend.opt @@ -0,0 +1,13 @@ +grafiteWalker.cmi: grafiteParser.cmi +dependenciesParser.cmo: dependenciesParser.cmi +dependenciesParser.cmx: dependenciesParser.cmi +grafiteParser.cmo: dependenciesParser.cmi grafiteParser.cmi +grafiteParser.cmx: dependenciesParser.cmx grafiteParser.cmi +cicNotation2.cmo: grafiteParser.cmi cicNotation2.cmi +cicNotation2.cmx: grafiteParser.cmx cicNotation2.cmi +grafiteDisambiguator.cmo: grafiteDisambiguator.cmi +grafiteDisambiguator.cmx: grafiteDisambiguator.cmi +grafiteDisambiguate.cmo: grafiteDisambiguator.cmi grafiteDisambiguate.cmi +grafiteDisambiguate.cmx: grafiteDisambiguator.cmx grafiteDisambiguate.cmi +grafiteWalker.cmo: grafiteParser.cmi grafiteWalker.cmi +grafiteWalker.cmx: grafiteParser.cmx grafiteWalker.cmi diff --git a/components/grafite_parser/Makefile b/components/grafite_parser/Makefile new file mode 100644 index 000000000..eb2f1b1eb --- /dev/null +++ b/components/grafite_parser/Makefile @@ -0,0 +1,48 @@ +PACKAGE = grafite_parser +PREDICATES = + +INTERFACE_FILES = \ + dependenciesParser.mli \ + grafiteParser.mli \ + cicNotation2.mli \ + grafiteDisambiguator.mli \ + grafiteDisambiguate.mli \ + grafiteWalker.mli \ + $(NULL) +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) + +all: test_parser print_grammar test_dep +clean: clean_tests + +# cross compatibility among ocaml 3.09 and ocaml 3.08, to be removed as +# soon as we have ocaml 3.09 everywhere and "loc" occurrences are replaced by +# "_loc" occurrences +UTF8DIR = $(shell $(OCAMLFIND) query helm-syntax_extensions) +ULEXDIR = $(shell $(OCAMLFIND) query ulex08) +MY_SYNTAXOPTIONS = -pp "camlp5o -I $(UTF8DIR) -I $(ULEXDIR) pa_extend.cmo pa_ulex.cma pa_unicode_macro.cma -loc loc" +grafiteParser.cmo: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +grafiteParser.cmx: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +depend: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +depend.opt: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +# +# +grafiteParser.cmo: OCAMLC = $(OCAMLC_P4) +grafiteParser.cmx: OCAMLOPT = $(OCAMLOPT_P4) + +clean_tests: + rm -f test_parser{,.opt} test_dep{,.opt} print_grammar{,.opt} + +LOCAL_LINKOPTS = -package helm-$(PACKAGE) -linkpkg +test: test_parser print_grammar test_dep +test_parser: test_parser.ml $(PACKAGE).cma + @echo " OCAMLC $<" + @$(OCAMLC) $(LOCAL_LINKOPTS) -o $@ $< +print_grammar: print_grammar.ml $(PACKAGE).cma + @echo " OCAMLC $<" + @$(OCAMLC) $(LOCAL_LINKOPTS) -o $@ $< +test_dep: test_dep.ml $(PACKAGE).cma + @echo " OCAMLC $<" + @$(OCAMLC) $(LOCAL_LINKOPTS) -o $@ $< + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/grafite_parser/cicNotation2.ml b/components/grafite_parser/cicNotation2.ml new file mode 100644 index 000000000..b3c8a59cc --- /dev/null +++ b/components/grafite_parser/cicNotation2.ml @@ -0,0 +1,49 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let load_notation ~include_paths fname = + let ic = open_in fname in + let lexbuf = Ulexing.from_utf8_channel ic in + let status = ref LexiconEngine.initial_status in + try + while true do + status := fst (GrafiteParser.parse_statement ~include_paths lexbuf !status) + done; + assert false + with End_of_file -> close_in ic; !status + +let parse_environment ~include_paths str = + let lexbuf = Ulexing.from_utf8_string str in + let status = ref LexiconEngine.initial_status in + try + while true do + status := fst (GrafiteParser.parse_statement ~include_paths lexbuf !status) + done; + assert false + with End_of_file -> + !status.LexiconEngine.aliases, + !status.LexiconEngine.multi_aliases diff --git a/components/grafite_parser/cicNotation2.mli b/components/grafite_parser/cicNotation2.mli new file mode 100644 index 000000000..00f184b3b --- /dev/null +++ b/components/grafite_parser/cicNotation2.mli @@ -0,0 +1,35 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** Note: notation is also loaded, but it cannot be undone since the + notation_ids part of the status is thrown away; + so far this function is useful only in Whelp *) +val parse_environment: + include_paths:string list -> + string -> + DisambiguateTypes.environment * DisambiguateTypes.multiple_environment + +(** @param fname file from which load notation *) +val load_notation: include_paths:string list -> string -> LexiconEngine.status diff --git a/components/grafite_parser/dependenciesParser.ml b/components/grafite_parser/dependenciesParser.ml new file mode 100644 index 000000000..91ba4aed6 --- /dev/null +++ b/components/grafite_parser/dependenciesParser.ml @@ -0,0 +1,79 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +(* FG + * From Cambridge dictionary + * Dependency: + * a country which is supported and governed by another country + * Dependence: + * when you need something or someone all the time, especially in order to + * continue existing or operating + * + * Fate vobis ... + *) + +exception UnableToInclude of string + + (* statements meaningful for matitadep *) +type dependency = + | IncludeDep of string + | BaseuriDep of string + | UriDep of UriManager.uri + +let pp_dependency = function + | IncludeDep str -> "include \"" ^ str ^ "\"" + | BaseuriDep str -> "set \"baseuri\" \"" ^ str ^ "\"" + | UriDep uri -> "uri \"" ^ UriManager.string_of_uri uri ^ "\"" + +let parse_dependencies lexbuf = + let tok_stream,_ = + CicNotationLexer.level2_ast_lexer.Token.tok_func (Obj.magic lexbuf) + in + let rec parse acc = + try + (parser + | [< '("QSTRING", s) >] -> + (* because of alias id qstring = qstring :-( *) + (try + parse (UriDep (UriManager.uri_of_string s) :: acc) + with + UriManager.IllFormedUri _ -> parse acc) + | [< '("URI", u) >] -> + parse (UriDep (UriManager.uri_of_string u) :: acc) + | [< '("IDENT", "include"); '("QSTRING", fname) >] -> + parse (IncludeDep fname :: acc) + | [< '("IDENT", "set"); '("QSTRING", "baseuri"); '("QSTRING", baseuri) >] -> + parse (BaseuriDep baseuri :: acc) + | [< '("EOI", _) >] -> acc + | [< 'tok >] -> parse acc + | [< >] -> acc) tok_stream + with + Stream.Error _ -> parse acc + | CicNotationLexer.Error _ -> parse acc + in + List.rev (parse []) + diff --git a/components/grafite_parser/dependenciesParser.mli b/components/grafite_parser/dependenciesParser.mli new file mode 100644 index 000000000..5445a51ba --- /dev/null +++ b/components/grafite_parser/dependenciesParser.mli @@ -0,0 +1,37 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception UnableToInclude of string + + (* statements meaningful for matitadep *) +type dependency = + | IncludeDep of string + | BaseuriDep of string + | UriDep of UriManager.uri + +val pp_dependency: dependency -> string + + (** @raise End_of_file *) +val parse_dependencies: Ulexing.lexbuf -> dependency list diff --git a/components/grafite_parser/grafiteDisambiguate.ml b/components/grafite_parser/grafiteDisambiguate.ml new file mode 100644 index 000000000..ca3bc0b90 --- /dev/null +++ b/components/grafite_parser/grafiteDisambiguate.ml @@ -0,0 +1,499 @@ +(* + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +exception BaseUriNotSetYet + +type tactic = + (CicNotationPt.term, CicNotationPt.term, + CicNotationPt.term GrafiteAst.reduction, string) + GrafiteAst.tactic + +type lazy_tactic = + (Cic.term, Cic.lazy_term, Cic.lazy_term GrafiteAst.reduction, string) + GrafiteAst.tactic + +let singleton = function + | [x], _ -> x + | _ -> assert false +;; + + (** @param term not meaningful when context is given *) +let disambiguate_term text prefix_len lexicon_status_ref context metasenv term = + let lexicon_status = !lexicon_status_ref in + let (diff, metasenv, cic, _) = + singleton + (GrafiteDisambiguator.disambiguate_term ~dbd:(LibraryDb.instance ()) + ~aliases:lexicon_status.LexiconEngine.aliases + ~universe:(Some lexicon_status.LexiconEngine.multi_aliases) + ~context ~metasenv (text,prefix_len,term)) + in + let lexicon_status = LexiconEngine.set_proof_aliases lexicon_status diff in + lexicon_status_ref := lexicon_status; + metasenv,cic +;; + + (** disambiguate_lazy_term (circa): term -> (unit -> status) * lazy_term + * rationale: lazy_term will be invoked in different context to obtain a term, + * each invocation will disambiguate the term and can add aliases. Once all + * disambiguations have been performed, the first returned function can be + * used to obtain the resulting aliases *) +let disambiguate_lazy_term text prefix_len lexicon_status_ref term = + (fun context metasenv ugraph -> + let lexicon_status = !lexicon_status_ref in + let (diff, metasenv, cic, ugraph) = + singleton + (GrafiteDisambiguator.disambiguate_term ~dbd:(LibraryDb.instance ()) + ~initial_ugraph:ugraph ~aliases:lexicon_status.LexiconEngine.aliases + ~universe:(Some lexicon_status.LexiconEngine.multi_aliases) + ~context ~metasenv + (text,prefix_len,term)) in + let lexicon_status = LexiconEngine.set_proof_aliases lexicon_status diff in + lexicon_status_ref := lexicon_status; + cic, metasenv, ugraph) +;; + +let disambiguate_pattern + text prefix_len lexicon_status_ref (wanted, hyp_paths, goal_path) += + let interp path = Disambiguate.interpretate_path [] path in + let goal_path = HExtlib.map_option interp goal_path in + let hyp_paths = List.map (fun (name, path) -> name, interp path) hyp_paths in + let wanted = + match wanted with + None -> None + | Some wanted -> + let wanted = + disambiguate_lazy_term text prefix_len lexicon_status_ref wanted + in + Some wanted + in + (wanted, hyp_paths, goal_path) +;; + +let disambiguate_reduction_kind text prefix_len lexicon_status_ref = function + | `Unfold (Some t) -> + let t = disambiguate_lazy_term text prefix_len lexicon_status_ref t in + `Unfold (Some t) + | `Normalize + | `Reduce + | `Simpl + | `Unfold None + | `Whd as kind -> kind +;; + +let rec disambiguate_tactic + lexicon_status_ref context metasenv (text,prefix_len,tactic) += + let disambiguate_term = + disambiguate_term text prefix_len lexicon_status_ref in + let disambiguate_pattern = + disambiguate_pattern text prefix_len lexicon_status_ref in + let disambiguate_reduction_kind = + disambiguate_reduction_kind text prefix_len lexicon_status_ref in + let disambiguate_lazy_term = + disambiguate_lazy_term text prefix_len lexicon_status_ref in + let disambiguate_tactic metasenv tac = + disambiguate_tactic lexicon_status_ref context metasenv (text,prefix_len,tac) + in + match tactic with + (* Higher order tactics *) + | GrafiteAst.Progress (loc,tac) -> + let metasenv,tac = disambiguate_tactic metasenv tac in + metasenv,GrafiteAst.Progress (loc,tac) + | GrafiteAst.Solve (loc,tacl) -> + let metasenv,tacl = + List.fold_right + (fun tac (metasenv,tacl) -> + let metasenv,tac = disambiguate_tactic metasenv tac in + metasenv,tac::tacl + ) tacl (metasenv,[]) + in + metasenv,GrafiteAst.Solve (loc,tacl) + | GrafiteAst.Try (loc,tac) -> + let metasenv,tac = disambiguate_tactic metasenv tac in + metasenv,GrafiteAst.Try (loc,tac) + | GrafiteAst.First (loc,tacl) -> + let metasenv,tacl = + List.fold_right + (fun tac (metasenv,tacl) -> + let metasenv,tac = disambiguate_tactic metasenv tac in + metasenv,tac::tacl + ) tacl (metasenv,[]) + in + metasenv,GrafiteAst.First (loc,tacl) + | GrafiteAst.Seq (loc,tacl) -> + let metasenv,tacl = + List.fold_right + (fun tac (metasenv,tacl) -> + let metasenv,tac = disambiguate_tactic metasenv tac in + metasenv,tac::tacl + ) tacl (metasenv,[]) + in + metasenv,GrafiteAst.Seq (loc,tacl) + | GrafiteAst.Repeat (loc,tac) -> + let metasenv,tac = disambiguate_tactic metasenv tac in + metasenv,GrafiteAst.Repeat (loc,tac) + | GrafiteAst.Do (loc,n,tac) -> + let metasenv,tac = disambiguate_tactic metasenv tac in + metasenv,GrafiteAst.Do (loc,n,tac) + | GrafiteAst.Then (loc,tac,tacl) -> + let metasenv,tac = disambiguate_tactic metasenv tac in + let metasenv,tacl = + List.fold_right + (fun tac (metasenv,tacl) -> + let metasenv,tac = disambiguate_tactic metasenv tac in + metasenv,tac::tacl + ) tacl (metasenv,[]) + in + metasenv,GrafiteAst.Then (loc,tac,tacl) + (* First order tactics *) + | GrafiteAst.Absurd (loc, term) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Absurd (loc, cic) + | GrafiteAst.Apply (loc, term) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Apply (loc, cic) + | GrafiteAst.ApplyS (loc, term, params) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,GrafiteAst.ApplyS (loc, cic, params) + | GrafiteAst.Assumption loc -> + metasenv,GrafiteAst.Assumption loc + | GrafiteAst.AutoBatch (loc,params) -> + metasenv,GrafiteAst.AutoBatch (loc,params) + | GrafiteAst.Cases (loc, what, idents) -> + let metasenv,what = disambiguate_term context metasenv what in + metasenv,GrafiteAst.Cases (loc, what, idents) + | GrafiteAst.Change (loc, pattern, with_what) -> + let with_what = disambiguate_lazy_term with_what in + let pattern = disambiguate_pattern pattern in + metasenv,GrafiteAst.Change (loc, pattern, with_what) + | GrafiteAst.Clear (loc,id) -> + metasenv,GrafiteAst.Clear (loc,id) + | GrafiteAst.ClearBody (loc,id) -> + metasenv,GrafiteAst.ClearBody (loc,id) + | GrafiteAst.Compose (loc, t1, t2, times, spec) -> + let metasenv,t1 = disambiguate_term context metasenv t1 in + let metasenv,t2 = + match t2 with + | None -> metasenv, None + | Some t2 -> + let m, t2 = disambiguate_term context metasenv t2 in + m, Some t2 + in + metasenv, GrafiteAst.Compose (loc, t1, t2, times, spec) + | GrafiteAst.Constructor (loc,n) -> + metasenv,GrafiteAst.Constructor (loc,n) + | GrafiteAst.Contradiction loc -> + metasenv,GrafiteAst.Contradiction loc + | GrafiteAst.Cut (loc, ident, term) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Cut (loc, ident, cic) + | GrafiteAst.Decompose (loc, names) -> + metasenv,GrafiteAst.Decompose (loc, names) + | GrafiteAst.Demodulate loc -> + metasenv,GrafiteAst.Demodulate loc + | GrafiteAst.Destruct (loc, Some terms) -> + let map term (metasenv, terms) = + let metasenv, term = disambiguate_term context metasenv term in + metasenv, term :: terms + in + let metasenv, terms = List.fold_right map terms (metasenv, []) in + metasenv, GrafiteAst.Destruct(loc, Some terms) + | GrafiteAst.Destruct (loc, None) -> + metasenv,GrafiteAst.Destruct(loc,None) + | GrafiteAst.Exact (loc, term) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Exact (loc, cic) + | GrafiteAst.Elim (loc, what, Some using, pattern, specs) -> + let metasenv,what = disambiguate_term context metasenv what in + let metasenv,using = disambiguate_term context metasenv using in + let pattern = disambiguate_pattern pattern in + metasenv,GrafiteAst.Elim (loc, what, Some using, pattern, specs) + | GrafiteAst.Elim (loc, what, None, pattern, specs) -> + let metasenv,what = disambiguate_term context metasenv what in + let pattern = disambiguate_pattern pattern in + metasenv,GrafiteAst.Elim (loc, what, None, pattern, specs) + | GrafiteAst.ElimType (loc, what, Some using, specs) -> + let metasenv,what = disambiguate_term context metasenv what in + let metasenv,using = disambiguate_term context metasenv using in + metasenv,GrafiteAst.ElimType (loc, what, Some using, specs) + | GrafiteAst.ElimType (loc, what, None, specs) -> + let metasenv,what = disambiguate_term context metasenv what in + metasenv,GrafiteAst.ElimType (loc, what, None, specs) + | GrafiteAst.Exists loc -> + metasenv,GrafiteAst.Exists loc + | GrafiteAst.Fail loc -> + metasenv,GrafiteAst.Fail loc + | GrafiteAst.Fold (loc,red_kind, term, pattern) -> + let pattern = disambiguate_pattern pattern in + let term = disambiguate_lazy_term term in + let red_kind = disambiguate_reduction_kind red_kind in + metasenv,GrafiteAst.Fold (loc, red_kind, term, pattern) + | GrafiteAst.FwdSimpl (loc, hyp, names) -> + metasenv,GrafiteAst.FwdSimpl (loc, hyp, names) + | GrafiteAst.Fourier loc -> + metasenv,GrafiteAst.Fourier loc + | GrafiteAst.Generalize (loc,pattern,ident) -> + let pattern = disambiguate_pattern pattern in + metasenv,GrafiteAst.Generalize (loc,pattern,ident) + | GrafiteAst.IdTac loc -> + metasenv,GrafiteAst.IdTac loc + | GrafiteAst.Intros (loc, specs) -> + metasenv,GrafiteAst.Intros (loc, specs) + | GrafiteAst.Inversion (loc, term) -> + let metasenv,term = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Inversion (loc, term) + | GrafiteAst.LApply (loc, linear, depth, to_what, what, ident) -> + let f term (metasenv, to_what) = + let metasenv, term = disambiguate_term context metasenv term in + metasenv, term :: to_what + in + let metasenv, to_what = List.fold_right f to_what (metasenv, []) in + let metasenv, what = disambiguate_term context metasenv what in + metasenv,GrafiteAst.LApply (loc, linear, depth, to_what, what, ident) + | GrafiteAst.Left loc -> + metasenv,GrafiteAst.Left loc + | GrafiteAst.LetIn (loc, term, name) -> + let metasenv,term = disambiguate_term context metasenv term in + metasenv,GrafiteAst.LetIn (loc,term,name) + | GrafiteAst.Reduce (loc, red_kind, pattern) -> + let pattern = disambiguate_pattern pattern in + let red_kind = disambiguate_reduction_kind red_kind in + metasenv,GrafiteAst.Reduce(loc, red_kind, pattern) + | GrafiteAst.Reflexivity loc -> + metasenv,GrafiteAst.Reflexivity loc + | GrafiteAst.Replace (loc, pattern, with_what) -> + let pattern = disambiguate_pattern pattern in + let with_what = disambiguate_lazy_term with_what in + metasenv,GrafiteAst.Replace (loc, pattern, with_what) + | GrafiteAst.Rewrite (loc, dir, t, pattern, names) -> + let metasenv,term = disambiguate_term context metasenv t in + let pattern = disambiguate_pattern pattern in + metasenv,GrafiteAst.Rewrite (loc, dir, term, pattern, names) + | GrafiteAst.Right loc -> + metasenv,GrafiteAst.Right loc + | GrafiteAst.Ring loc -> + metasenv,GrafiteAst.Ring loc + | GrafiteAst.Split loc -> + metasenv,GrafiteAst.Split loc + | GrafiteAst.Symmetry loc -> + metasenv,GrafiteAst.Symmetry loc + | GrafiteAst.Transitivity (loc, term) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Transitivity (loc, cic) + (* Nuovi casi *) + | GrafiteAst.Assume (loc, id, term) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Assume (loc, id, cic) + | GrafiteAst.Suppose (loc, term, id, term') -> + let metasenv,cic = disambiguate_term context metasenv term in + let metasenv,cic' = + match term' with + None -> metasenv,None + | Some t -> + let metasenv,t = disambiguate_term context metasenv t in + metasenv,Some t in + metasenv,GrafiteAst.Suppose (loc, cic, id, cic') + | GrafiteAst.Bydone (loc,term) -> + let metasenv,cic = + match term with + None -> metasenv,None + |Some t -> + let metasenv,t = disambiguate_term context metasenv t in + metasenv,Some t in + metasenv,GrafiteAst.Bydone (loc, cic) + | GrafiteAst.We_need_to_prove (loc,term,id,term') -> + let metasenv,cic = disambiguate_term context metasenv term in + let metasenv,cic' = + match term' with + None -> metasenv,None + | Some t -> + let metasenv,t = disambiguate_term context metasenv t in + metasenv,Some t in + metasenv,GrafiteAst.We_need_to_prove (loc,cic,id,cic') + | GrafiteAst.By_term_we_proved (loc,term,term',id,term'') -> + let metasenv,cic = + match term with + None -> metasenv,None + | Some t -> + let metasenv,t = disambiguate_term context metasenv t in + metasenv,Some t in + let metasenv,cic' = disambiguate_term context metasenv term' in + let metasenv,cic'' = + match term'' with + None -> metasenv,None + | Some t -> + let metasenv,t = disambiguate_term context metasenv t in + metasenv,Some t in + metasenv,GrafiteAst.By_term_we_proved (loc,cic,cic',id,cic'') + | GrafiteAst.We_proceed_by_cases_on (loc, term, term') -> + let metasenv,cic = disambiguate_term context metasenv term in + let metasenv,cic' = disambiguate_term context metasenv term' in + metasenv,GrafiteAst.We_proceed_by_cases_on (loc, cic, cic') + | GrafiteAst.We_proceed_by_induction_on (loc, term, term') -> + let metasenv,cic = disambiguate_term context metasenv term in + let metasenv,cic' = disambiguate_term context metasenv term' in + metasenv,GrafiteAst.We_proceed_by_induction_on (loc, cic, cic') + | GrafiteAst.Byinduction (loc, term, id) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Byinduction(loc, cic, id) + | GrafiteAst.Thesisbecomes (loc, term) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Thesisbecomes (loc, cic) + | GrafiteAst.ExistsElim (loc, term, id1, term1, id2, term2) -> + let metasenv,cic = + match term with + None -> metasenv,None + | Some t -> + let metasenv,t = disambiguate_term context metasenv t in + metasenv,Some t in + let metasenv,cic' = disambiguate_term context metasenv term1 in + let cic''= disambiguate_lazy_term term2 in + metasenv,GrafiteAst.ExistsElim(loc, cic, id1, cic', id2, cic'') + | GrafiteAst.AndElim (loc, term, id, term1, id1, term2) -> + let metasenv,cic = disambiguate_term context metasenv term in + let metasenv,cic'= disambiguate_term context metasenv term1 in + let metasenv,cic''= disambiguate_term context metasenv term2 in + metasenv,GrafiteAst.AndElim(loc, cic, id, cic', id1, cic'') + | GrafiteAst.Case (loc, id, params) -> + let metasenv,params' = + List.fold_right + (fun (id,term) (metasenv,params) -> + let metasenv,cic = disambiguate_term context metasenv term in + metasenv,(id,cic)::params + ) params (metasenv,[]) + in + metasenv,GrafiteAst.Case(loc, id, params') + | GrafiteAst.RewritingStep (loc, term1, term2, term3, cont) -> + let metasenv,cic = + match term1 with + None -> metasenv,None + | Some (start,t) -> + let metasenv,t = disambiguate_term context metasenv t in + metasenv,Some (start,t) in + let metasenv,cic'= disambiguate_term context metasenv term2 in + let metasenv,cic'' = + match term3 with + `Auto _ as t -> metasenv,t + | `Term t -> + let metasenv,t = disambiguate_term context metasenv t in + metasenv,`Term t + | `Proof as t -> metasenv,t in + metasenv,GrafiteAst.RewritingStep (loc, cic, cic', cic'', cont) + + +let disambiguate_obj lexicon_status ?baseuri metasenv (text,prefix_len,obj) = + let uri = + match obj with + | CicNotationPt.Inductive (_,(name,_,_,_)::_) + | CicNotationPt.Record (_,name,_,_) -> + (match baseuri with + | Some baseuri -> + Some (UriManager.uri_of_string (baseuri ^ "/" ^ name ^ ".ind")) + | None -> raise BaseUriNotSetYet) + | CicNotationPt.Inductive _ -> assert false + | CicNotationPt.Theorem _ -> None in + let (diff, metasenv, cic, _) = + singleton + (GrafiteDisambiguator.disambiguate_obj ~dbd:(LibraryDb.instance ()) + ~aliases:lexicon_status.LexiconEngine.aliases + ~universe:(Some lexicon_status.LexiconEngine.multi_aliases) ~uri + (text,prefix_len,obj)) in + let lexicon_status = LexiconEngine.set_proof_aliases lexicon_status diff in + lexicon_status, metasenv, cic + +let disambiguate_command lexicon_status ?baseuri metasenv (text,prefix_len,cmd)= + match cmd with + | GrafiteAst.Index(loc,key,uri) -> + let lexicon_status_ref = ref lexicon_status in + let disambiguate_term = + disambiguate_term text prefix_len lexicon_status_ref [] in + let disambiguate_term_option metasenv = + function + None -> metasenv,None + | Some t -> + let metasenv,t = disambiguate_term metasenv t in + metasenv, Some t + in + let metasenv,key = disambiguate_term_option metasenv key in + !lexicon_status_ref, metasenv,GrafiteAst.Index(loc,key,uri) + | GrafiteAst.Coercion _ + | GrafiteAst.Default _ + | GrafiteAst.Drop _ + | GrafiteAst.Include _ + | GrafiteAst.Print _ + | GrafiteAst.Qed _ + | GrafiteAst.Set _ as cmd -> + lexicon_status,metasenv,cmd + | GrafiteAst.Obj (loc,obj) -> + let lexicon_status,metasenv,obj = + disambiguate_obj lexicon_status ?baseuri metasenv (text,prefix_len,obj)in + lexicon_status, metasenv, GrafiteAst.Obj (loc,obj) + | GrafiteAst.Relation (loc,id,a,aeq,refl,sym,trans) -> + let lexicon_status_ref = ref lexicon_status in + let disambiguate_term = + disambiguate_term text prefix_len lexicon_status_ref [] in + let disambiguate_term_option metasenv = + function + None -> metasenv,None + | Some t -> + let metasenv,t = disambiguate_term metasenv t in + metasenv, Some t + in + let metasenv,a = disambiguate_term metasenv a in + let metasenv,aeq = disambiguate_term metasenv aeq in + let metasenv,refl = disambiguate_term_option metasenv refl in + let metasenv,sym = disambiguate_term_option metasenv sym in + let metasenv,trans = disambiguate_term_option metasenv trans in + !lexicon_status_ref, metasenv, + GrafiteAst.Relation (loc,id,a,aeq,refl,sym,trans) + +let disambiguate_macro + lexicon_status_ref metasenv context (text,prefix_len, macro) += + let disambiguate_term = disambiguate_term text prefix_len lexicon_status_ref in + match macro with + | GrafiteAst.WMatch (loc,term) -> + let metasenv,term = disambiguate_term context metasenv term in + metasenv,GrafiteAst.WMatch (loc,term) + | GrafiteAst.WInstance (loc,term) -> + let metasenv,term = disambiguate_term context metasenv term in + metasenv,GrafiteAst.WInstance (loc,term) + | GrafiteAst.WElim (loc,term) -> + let metasenv,term = disambiguate_term context metasenv term in + metasenv,GrafiteAst.WElim (loc,term) + | GrafiteAst.WHint (loc,term) -> + let metasenv,term = disambiguate_term context metasenv term in + metasenv,GrafiteAst.WHint (loc,term) + | GrafiteAst.Check (loc,term) -> + let metasenv,term = disambiguate_term context metasenv term in + metasenv,GrafiteAst.Check (loc,term) + | GrafiteAst.AutoInteractive _ + | GrafiteAst.Hint _ + | GrafiteAst.WLocate _ + | GrafiteAst.Inline _ as macro -> + metasenv,macro diff --git a/components/grafite_parser/grafiteDisambiguate.mli b/components/grafite_parser/grafiteDisambiguate.mli new file mode 100644 index 000000000..798fa75f5 --- /dev/null +++ b/components/grafite_parser/grafiteDisambiguate.mli @@ -0,0 +1,56 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception BaseUriNotSetYet + +type tactic = + (CicNotationPt.term, CicNotationPt.term, + CicNotationPt.term GrafiteAst.reduction, string) + GrafiteAst.tactic + +type lazy_tactic = + (Cic.term, Cic.lazy_term, Cic.lazy_term GrafiteAst.reduction, string) + GrafiteAst.tactic + +val disambiguate_tactic: + LexiconEngine.status ref -> + Cic.context -> + Cic.metasenv -> + tactic Disambiguate.disambiguator_input -> + Cic.metasenv * lazy_tactic + +val disambiguate_command: + LexiconEngine.status -> + ?baseuri:string -> + Cic.metasenv -> + ((CicNotationPt.term,CicNotationPt.term CicNotationPt.obj) GrafiteAst.command) Disambiguate.disambiguator_input -> + LexiconEngine.status * Cic.metasenv * (Cic.term,Cic.obj) GrafiteAst.command + +val disambiguate_macro: + LexiconEngine.status ref -> + Cic.metasenv -> + Cic.context -> + (CicNotationPt.term GrafiteAst.macro) Disambiguate.disambiguator_input -> + Cic.metasenv * Cic.term GrafiteAst.macro diff --git a/components/grafite_parser/grafiteDisambiguator.ml b/components/grafite_parser/grafiteDisambiguator.ml new file mode 100644 index 000000000..8827e709b --- /dev/null +++ b/components/grafite_parser/grafiteDisambiguator.ml @@ -0,0 +1,224 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let debug = false;; +let debug_print s = + if debug then prerr_endline (Lazy.force s);; + +exception Ambiguous_input +(* the integer is an offset to be added to each location *) +exception DisambiguationError of + int * + ((Stdpp.location list * string * string) list * + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Stdpp.location option * string Lazy.t * bool) list list + (** parameters are: option name, error message *) +exception Unbound_identifier of string + +type choose_uris_callback = + id:string -> UriManager.uri list -> UriManager.uri list + +type choose_interp_callback = + string -> int -> + (Stdpp.location list * string * string) list list -> int list + +let mono_uris_callback ~id = + if Helm_registry.get_opt_default Helm_registry.get_bool ~default:true + "matita.auto_disambiguation" + then + function l -> l + else + raise Ambiguous_input + +let mono_interp_callback _ _ _ = raise Ambiguous_input + +let _choose_uris_callback = ref mono_uris_callback +let _choose_interp_callback = ref mono_interp_callback +let set_choose_uris_callback f = _choose_uris_callback := f +let set_choose_interp_callback f = _choose_interp_callback := f + +module Callbacks = + struct + let interactive_user_uri_choice ~selection_mode ?ok + ?(enable_button_for_non_vars = true) ~title ~msg ~id uris = + !_choose_uris_callback ~id uris + + let interactive_interpretation_choice interp = + !_choose_interp_callback interp + + let input_or_locate_uri ~(title:string) ?id () = None + (* Zack: I try to avoid using this callback. I therefore assume that + * the presence of an identifier that can't be resolved via "locate" + * query is a syntax error *) + end + +module Disambiguator = Disambiguate.Make (Callbacks) + +(* implement module's API *) + +let only_one_pass = ref false;; + +let disambiguate_thing ~aliases ~universe + ~(f:?fresh_instances:bool -> + aliases:DisambiguateTypes.environment -> + universe:DisambiguateTypes.multiple_environment option -> + 'a -> 'b) + ~(drop_aliases: ?minimize_instances:bool -> 'b -> 'b) + ~(drop_aliases_and_clear_diff: 'b -> 'b) + (thing: 'a) += + assert (universe <> None); + let library = false, DisambiguateTypes.Environment.empty, None in + let multi_aliases = false, DisambiguateTypes.Environment.empty, universe in + let mono_aliases = true, aliases, Some DisambiguateTypes.Environment.empty in + let passes = (* *) + if !only_one_pass then + [ (true, mono_aliases, false) ] + else + [ (true, mono_aliases, false); + (true, multi_aliases, false); + (true, mono_aliases, true); + (true, multi_aliases, true); + (true, library, false); + (* for demo to reduce the number of interpretations *) + (true, library, true); + ] + in + let try_pass (fresh_instances, (_, aliases, universe), insert_coercions) = + CicRefine.insert_coercions := insert_coercions; + f ~fresh_instances ~aliases ~universe thing + in + let set_aliases (instances,(use_mono_aliases,_,_),_) (_, user_asked as res) = + if use_mono_aliases then + drop_aliases ~minimize_instances:true res (* one shot aliases *) + else if user_asked then + drop_aliases ~minimize_instances:true res (* one shot aliases *) + else + drop_aliases_and_clear_diff res + in + let rec aux i errors passes = + debug_print (lazy ("Pass: " ^ string_of_int i)); + match passes with + [ pass ] -> + (try + set_aliases pass (try_pass pass) + with Disambiguate.NoWellTypedInterpretation (offset,newerrors) -> + raise (DisambiguationError (offset, errors @ [newerrors]))) + | hd :: tl -> + (try + set_aliases hd (try_pass hd) + with Disambiguate.NoWellTypedInterpretation (_offset,newerrors) -> + aux (i+1) (errors @ [newerrors]) tl) + | [] -> assert false + in + let saved_insert_coercions = !CicRefine.insert_coercions in + try + let res = aux 1 [] passes in + CicRefine.insert_coercions := saved_insert_coercions; + res + with exn -> + CicRefine.insert_coercions := saved_insert_coercions; + raise exn + +type disambiguator_thing = + { do_it : + 'a 'b. + aliases:DisambiguateTypes.environment -> + universe:DisambiguateTypes.multiple_environment option -> + f:(?fresh_instances:bool -> + aliases:DisambiguateTypes.environment -> + universe:DisambiguateTypes.multiple_environment option -> + 'a -> 'b * bool) -> + drop_aliases:(?minimize_instances:bool -> 'b * bool -> 'b * bool) -> + drop_aliases_and_clear_diff:('b * bool -> 'b * bool) -> 'a -> 'b * bool + } + +let disambiguate_thing = + let profiler = HExtlib.profile "disambiguate_thing" in + { do_it = + fun ~aliases ~universe ~f ~drop_aliases ~drop_aliases_and_clear_diff thing + -> profiler.HExtlib.profile + (disambiguate_thing ~aliases ~universe ~f ~drop_aliases + ~drop_aliases_and_clear_diff) thing + } + +let drop_aliases ?(minimize_instances=false) (choices, user_asked) = + let module D = DisambiguateTypes in + let minimize d = + if not minimize_instances then + d + else + let rec aux = + function + [] -> [] + | (D.Symbol (s,n),((descr,_) as ci)) as he::tl when n > 0 -> + if + List.for_all + (function + (D.Symbol (s2,_),(descr2,_)) -> s2 <> s || descr = descr2 + | _ -> true + ) d + then + (D.Symbol (s,0),ci)::(aux tl) + else + he::(aux tl) + | (D.Num n,((descr,_) as ci)) as he::tl when n > 0 -> + if + List.for_all + (function (D.Num _,(descr2,_)) -> descr = descr2 | _ -> true) d + then + (D.Num 0,ci)::(aux tl) + else + he::(aux tl) + | he::tl -> he::(aux tl) + in + aux d + in + (List.map (fun (d, a, b, c) -> minimize d, a, b, c) choices), + user_asked + +let drop_aliases_and_clear_diff (choices, user_asked) = + (List.map (fun (_, a, b, c) -> [], a, b, c) choices), + user_asked + +let disambiguate_term ?fresh_instances ~dbd ~context ~metasenv ?initial_ugraph + ~aliases ~universe term + = + assert (fresh_instances = None); + let f = + Disambiguator.disambiguate_term ~dbd ~context ~metasenv ?initial_ugraph + in + disambiguate_thing.do_it ~aliases ~universe ~f ~drop_aliases + ~drop_aliases_and_clear_diff term + +let disambiguate_obj ?fresh_instances ~dbd ~aliases ~universe ~uri obj = + assert (fresh_instances = None); + let f = Disambiguator.disambiguate_obj ~dbd ~uri in + disambiguate_thing.do_it ~aliases ~universe ~f ~drop_aliases + ~drop_aliases_and_clear_diff obj diff --git a/components/grafite_parser/grafiteDisambiguator.mli b/components/grafite_parser/grafiteDisambiguator.mli new file mode 100644 index 000000000..88940c2c3 --- /dev/null +++ b/components/grafite_parser/grafiteDisambiguator.mli @@ -0,0 +1,60 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** raised when ambiguous input is found but not expected (e.g. in the batch + * compiler) *) +exception Ambiguous_input +(* the integer is an offset to be added to each location *) +exception DisambiguationError of + int * + ((Stdpp.location list * string * string) list * + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Stdpp.location option * string Lazy.t * bool) list list + (** parameters are: option name, error message *) + +(** initially false; for debugging only (???) *) +val only_one_pass: bool ref + +type choose_uris_callback = id:string -> UriManager.uri list -> UriManager.uri list +type choose_interp_callback = + string -> int -> (Stdpp.location list * string * string) list list -> + int list + +val set_choose_uris_callback: choose_uris_callback -> unit +val set_choose_interp_callback: choose_interp_callback -> unit + +(** @raise Ambiguous_input if called, default value for internal + * choose_uris_callback if not set otherwise with set_choose_uris_callback + * above *) +val mono_uris_callback: choose_uris_callback + +(** @raise Ambiguous_input if called, default value for internal + * choose_interp_callback if not set otherwise with set_choose_interp_callback + * above *) +val mono_interp_callback: choose_interp_callback + +(** for GUI callbacks see MatitaGui.interactive_{interp,user_uri}_choice *) + +include Disambiguate.Disambiguator diff --git a/components/grafite_parser/grafiteParser.ml b/components/grafite_parser/grafiteParser.ml new file mode 100644 index 000000000..b5d803f9d --- /dev/null +++ b/components/grafite_parser/grafiteParser.ml @@ -0,0 +1,730 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let out = ref ignore +let set_callback f = out := f + +module Ast = CicNotationPt + +type 'a localized_option = + LSome of 'a + | LNone of GrafiteAst.loc + +type ast_statement = + (CicNotationPt.term, CicNotationPt.term, + CicNotationPt.term GrafiteAst.reduction, + CicNotationPt.term CicNotationPt.obj, string) + GrafiteAst.statement + +type statement = + include_paths:string list -> + LexiconEngine.status -> + LexiconEngine.status * ast_statement localized_option + +let grammar = CicNotationParser.level2_ast_grammar + +let term = CicNotationParser.term +let statement = Grammar.Entry.create grammar "statement" + +let add_raw_attribute ~text t = Ast.AttributedTerm (`Raw text, t) + +let default_precedence = 50 +let default_associativity = Gramext.NonA + +type by_continuation = + BYC_done + | BYC_weproved of CicNotationPt.term * string option * CicNotationPt.term option + | BYC_letsuchthat of string * CicNotationPt.term * string * CicNotationPt.term + | BYC_wehaveand of string * CicNotationPt.term * string * CicNotationPt.term + +EXTEND + GLOBAL: term statement; + constructor: [ [ name = IDENT; SYMBOL ":"; typ = term -> (name, typ) ] ]; + tactic_term: [ [ t = term LEVEL "90N" -> t ] ]; + new_name: [ + [ id = IDENT -> Some id + | SYMBOL "_" -> None ] + ]; + ident_list0: [ [ LPAREN; idents = LIST0 new_name; RPAREN -> idents ] ]; + tactic_term_list1: [ + [ tactic_terms = LIST1 tactic_term SEP SYMBOL "," -> tactic_terms ] + ]; + reduction_kind: [ + [ IDENT "normalize" -> `Normalize + | IDENT "reduce" -> `Reduce + | IDENT "simplify" -> `Simpl + | IDENT "unfold"; t = OPT tactic_term -> `Unfold t + | IDENT "whd" -> `Whd ] + ]; + sequent_pattern_spec: [ + [ hyp_paths = + LIST0 + [ id = IDENT ; + path = OPT [SYMBOL ":" ; path = tactic_term -> path ] -> + (id,match path with Some p -> p | None -> Ast.UserInput) ]; + goal_path = OPT [ SYMBOL <:unicode>; term = tactic_term -> term ] -> + let goal_path = + match goal_path, hyp_paths with + None, [] -> Some Ast.UserInput + | None, _::_ -> None + | Some goal_path, _ -> Some goal_path + in + hyp_paths,goal_path + ] + ]; + pattern_spec: [ + [ res = OPT [ + "in"; + wanted_and_sps = + [ "match" ; wanted = tactic_term ; + sps = OPT [ "in"; sps = sequent_pattern_spec -> sps ] -> + Some wanted,sps + | sps = sequent_pattern_spec -> + None,Some sps + ] -> + let wanted,hyp_paths,goal_path = + match wanted_and_sps with + wanted,None -> wanted, [], Some Ast.UserInput + | wanted,Some (hyp_paths,goal_path) -> wanted,hyp_paths,goal_path + in + wanted, hyp_paths, goal_path ] -> + match res with + None -> None,[],Some Ast.UserInput + | Some ps -> ps] + ]; + direction: [ + [ SYMBOL ">" -> `LeftToRight + | SYMBOL "<" -> `RightToLeft ] + ]; + int: [ [ num = NUMBER -> int_of_string num ] ]; + intros_names: [ + [ idents = OPT ident_list0 -> + match idents with None -> [] | Some idents -> idents + ] + ]; + intros_spec: [ + [ OPT [ IDENT "names" ]; + num = OPT [ num = int -> num ]; + idents = intros_names -> + num, idents + ] + ]; + using: [ [ using = OPT [ IDENT "using"; t = tactic_term -> t ] -> using ] ]; + tactic: [ + [ IDENT "absurd"; t = tactic_term -> + GrafiteAst.Absurd (loc, t) + | IDENT "apply"; t = tactic_term -> + GrafiteAst.Apply (loc, t) + | IDENT "applyS"; t = tactic_term ; params = + LIST0 [ i = IDENT -> i,"" | i = IDENT ; SYMBOL "="; v = [ v = int -> + string_of_int v | v = IDENT -> v ] -> i,v ] -> + GrafiteAst.ApplyS (loc, t, params) + | IDENT "assumption" -> + GrafiteAst.Assumption loc + | IDENT "autobatch"; params = auto_params -> + GrafiteAst.AutoBatch (loc,params) + | IDENT "cases"; what = tactic_term; + specs = intros_spec -> + GrafiteAst.Cases (loc, what, specs) + | IDENT "clear"; ids = LIST1 IDENT -> + GrafiteAst.Clear (loc, ids) + | IDENT "clearbody"; id = IDENT -> + GrafiteAst.ClearBody (loc,id) + | IDENT "change"; what = pattern_spec; "with"; t = tactic_term -> + GrafiteAst.Change (loc, what, t) + | IDENT "compose"; times = OPT int; t1 = tactic_term; t2 = + OPT [ "with"; t = tactic_term -> t ]; specs = intros_spec -> + let times = match times with None -> 1 | Some i -> i in + GrafiteAst.Compose (loc, t1, t2, times, specs) + | IDENT "constructor"; n = int -> + GrafiteAst.Constructor (loc, n) + | IDENT "contradiction" -> + GrafiteAst.Contradiction loc + | IDENT "cut"; t = tactic_term; ident = OPT [ "as"; id = IDENT -> id] -> + GrafiteAst.Cut (loc, ident, t) + | IDENT "decompose"; idents = OPT [ "as"; idents = LIST1 new_name -> idents ] -> + let idents = match idents with None -> [] | Some idents -> idents in + GrafiteAst.Decompose (loc, idents) + | IDENT "demodulate" -> GrafiteAst.Demodulate loc + | IDENT "destruct"; xts = OPT [ ts = tactic_term_list1 -> ts ] -> + GrafiteAst.Destruct (loc, xts) + | IDENT "elim"; what = tactic_term; using = using; + pattern = OPT pattern_spec; + (num, idents) = intros_spec -> + let pattern = match pattern with + | None -> None, [], Some Ast.UserInput + | Some pattern -> pattern + in + GrafiteAst.Elim (loc, what, using, pattern, (num, idents)) + | IDENT "elimType"; what = tactic_term; using = using; + (num, idents) = intros_spec -> + GrafiteAst.ElimType (loc, what, using, (num, idents)) + | IDENT "exact"; t = tactic_term -> + GrafiteAst.Exact (loc, t) + | IDENT "exists" -> + GrafiteAst.Exists loc + | IDENT "fail" -> GrafiteAst.Fail loc + | IDENT "fold"; kind = reduction_kind; t = tactic_term; p = pattern_spec -> + let (pt,_,_) = p in + if pt <> None then + raise (HExtlib.Localized (loc, CicNotationParser.Parse_error + ("the pattern cannot specify the term to replace, only its" + ^ " paths in the hypotheses and in the conclusion"))) + else + GrafiteAst.Fold (loc, kind, t, p) + | IDENT "fourier" -> + GrafiteAst.Fourier loc + | IDENT "fwd"; hyp = IDENT; idents = OPT [ "as"; idents = LIST1 new_name -> idents ] -> + let idents = match idents with None -> [] | Some idents -> idents in + GrafiteAst.FwdSimpl (loc, hyp, idents) + | IDENT "generalize"; p=pattern_spec; id = OPT ["as" ; id = IDENT -> id] -> + GrafiteAst.Generalize (loc,p,id) + | IDENT "id" -> GrafiteAst.IdTac loc + | IDENT "intro"; ident = OPT IDENT -> + let idents = match ident with None -> [] | Some id -> [Some id] in + GrafiteAst.Intros (loc, (Some 1, idents)) + | IDENT "intros"; specs = intros_spec -> + GrafiteAst.Intros (loc, specs) + | IDENT "inversion"; t = tactic_term -> + GrafiteAst.Inversion (loc, t) + | IDENT "lapply"; + linear = OPT [ IDENT "linear" ]; + depth = OPT [ IDENT "depth"; SYMBOL "="; i = int -> i ]; + what = tactic_term; + to_what = OPT [ "to" ; t = tactic_term_list1 -> t ]; + ident = OPT [ "as" ; ident = IDENT -> ident ] -> + let linear = match linear with None -> false | Some _ -> true in + let to_what = match to_what with None -> [] | Some to_what -> to_what in + GrafiteAst.LApply (loc, linear, depth, to_what, what, ident) + | IDENT "left" -> GrafiteAst.Left loc + | IDENT "letin"; where = IDENT ; SYMBOL <:unicode> ; t = tactic_term -> + GrafiteAst.LetIn (loc, t, where) + | kind = reduction_kind; p = pattern_spec -> + GrafiteAst.Reduce (loc, kind, p) + | IDENT "reflexivity" -> + GrafiteAst.Reflexivity loc + | IDENT "replace"; p = pattern_spec; "with"; t = tactic_term -> + GrafiteAst.Replace (loc, p, t) + | IDENT "rewrite" ; d = direction; t = tactic_term ; p = pattern_spec; + xnames = OPT [ "as"; n = ident_list0 -> n ] -> + let (pt,_,_) = p in + if pt <> None then + raise + (HExtlib.Localized (loc, + (CicNotationParser.Parse_error + "the pattern cannot specify the term to rewrite, only its paths in the hypotheses and in the conclusion"))) + else + let n = match xnames with None -> [] | Some names -> names in + GrafiteAst.Rewrite (loc, d, t, p, n) + | IDENT "right" -> + GrafiteAst.Right loc + | IDENT "ring" -> + GrafiteAst.Ring loc + | IDENT "split" -> + GrafiteAst.Split loc + | IDENT "symmetry" -> + GrafiteAst.Symmetry loc + | IDENT "transitivity"; t = tactic_term -> + GrafiteAst.Transitivity (loc, t) + (* Produzioni Aggiunte *) + | IDENT "assume" ; id = IDENT ; SYMBOL ":" ; t = tactic_term -> + GrafiteAst.Assume (loc, id, t) + | IDENT "suppose" ; t = tactic_term ; LPAREN ; id = IDENT ; RPAREN ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t' = tactic_term -> t']-> + GrafiteAst.Suppose (loc, t, id, t1) + | IDENT "by" ; t = [t' = tactic_term -> LSome t' | SYMBOL "_" -> LNone loc]; + cont=by_continuation -> + let t' = match t with LNone _ -> None | LSome t -> Some t in + (match cont with + BYC_done -> GrafiteAst.Bydone (loc, t') + | BYC_weproved (ty,id,t1) -> + GrafiteAst.By_term_we_proved(loc, t', ty, id, t1) + | BYC_letsuchthat (id1,t1,id2,t2) -> + (* (match t with + LNone floc -> + raise (HExtlib.Localized + (floc,CicNotationParser.Parse_error + "tactic_term expected here")) + | LSome t ->*) GrafiteAst.ExistsElim (loc, t', id1, t1, id2, t2)(*)*) + | BYC_wehaveand (id1,t1,id2,t2) -> + (match t with + LNone floc -> + raise (HExtlib.Localized + (floc,CicNotationParser.Parse_error + "tactic_term expected here")) + | LSome t -> GrafiteAst.AndElim (loc, t, id1, t1, id2, t2))) + | IDENT "we" ; IDENT "need" ; "to" ; IDENT "prove" ; t = tactic_term ; id = OPT [ LPAREN ; id = IDENT ; RPAREN -> id ] ; t1 = OPT [IDENT "or" ; IDENT "equivalently"; t' = tactic_term -> t']-> + GrafiteAst.We_need_to_prove (loc, t, id, t1) + | IDENT "we" ; IDENT "proceed" ; IDENT "by" ; IDENT "cases" ; "on" ; t=tactic_term ; "to" ; IDENT "prove" ; t1=tactic_term -> + GrafiteAst.We_proceed_by_cases_on (loc, t, t1) + | IDENT "we" ; IDENT "proceed" ; IDENT "by" ; IDENT "induction" ; "on" ; t=tactic_term ; "to" ; IDENT "prove" ; t1=tactic_term -> + GrafiteAst.We_proceed_by_induction_on (loc, t, t1) + | IDENT "by" ; IDENT "induction" ; IDENT "hypothesis" ; IDENT "we" ; IDENT "know" ; t=tactic_term ; LPAREN ; id = IDENT ; RPAREN -> + GrafiteAst.Byinduction(loc, t, id) + | IDENT "the" ; IDENT "thesis" ; IDENT "becomes" ; t=tactic_term -> + GrafiteAst.Thesisbecomes(loc, t) + | IDENT "case" ; id = IDENT ; params=LIST0[LPAREN ; i=IDENT ; + SYMBOL":" ; t=tactic_term ; RPAREN -> i,t] -> + GrafiteAst.Case(loc,id,params) + | start = + [ IDENT "conclude" -> None + | IDENT "obtain" ; name = IDENT -> Some name ] ; + termine = tactic_term ; + SYMBOL "=" ; + t1=tactic_term ; + IDENT "by" ; + t2 = + [ t=tactic_term -> `Term t + | SYMBOL "_" ; params = auto_params' -> `Auto params + | IDENT "proof" -> `Proof] ; + cont = rewriting_step_continuation -> + GrafiteAst.RewritingStep(loc, Some (start,termine), t1, t2, cont) + | SYMBOL "=" ; + t1=tactic_term ; + IDENT "by" ; + t2= + [ t=tactic_term -> `Term t + | SYMBOL "_" ; params = auto_params' -> `Auto params + | IDENT "proof" -> `Proof] ; + cont=rewriting_step_continuation -> + GrafiteAst.RewritingStep(loc, None, t1, t2, cont) + ] +]; + auto_params: [ + [ params = + LIST0 [ i = IDENT -> i,"" | i = IDENT ; SYMBOL "="; v = [ v = int -> + string_of_int v | v = IDENT -> v ] -> i,v ] -> + params + ] +]; + auto_params': [ + [ LPAREN; params = auto_params; RPAREN -> params + | -> [] + ] +]; + by_continuation: [ + [ IDENT "we" ; IDENT "proved" ; ty = tactic_term ; LPAREN ; id = IDENT ; RPAREN ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] -> BYC_weproved (ty,Some id,t1) + | IDENT "we" ; IDENT "proved" ; ty = tactic_term ; t1 = OPT [IDENT "that" ; IDENT "is" ; IDENT "equivalent" ; "to" ; t2 = tactic_term -> t2] ; + IDENT "done" -> BYC_weproved (ty,None,t1) + | IDENT "done" -> BYC_done + | "let" ; id1 = IDENT ; SYMBOL ":" ; t1 = tactic_term ; + IDENT "such" ; IDENT "that" ; t2=tactic_term ; LPAREN ; id2 = IDENT ; RPAREN -> BYC_letsuchthat (id1,t1,id2,t2) + | IDENT "we" ; IDENT "have" ; t1=tactic_term ; LPAREN ; id1=IDENT ; RPAREN ;"and" ; t2=tactic_term ; LPAREN ; id2=IDENT ; RPAREN -> + BYC_wehaveand (id1,t1,id2,t2) + ] +]; + rewriting_step_continuation : [ + [ IDENT "done" -> true + | -> false + ] +]; + atomic_tactical: + [ "sequence" LEFTA + [ t1 = SELF; SYMBOL ";"; t2 = SELF -> + let ts = + match t1 with + | GrafiteAst.Seq (_, l) -> l @ [ t2 ] + | _ -> [ t1; t2 ] + in + GrafiteAst.Seq (loc, ts) + ] + | "then" NONA + [ tac = SELF; SYMBOL ";"; + SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"-> + (GrafiteAst.Then (loc, tac, tacs)) + ] + | "loops" RIGHTA + [ IDENT "do"; count = int; tac = SELF -> + GrafiteAst.Do (loc, count, tac) + | IDENT "repeat"; tac = SELF -> GrafiteAst.Repeat (loc, tac) + ] + | "simple" NONA + [ IDENT "first"; + SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"-> + GrafiteAst.First (loc, tacs) + | IDENT "try"; tac = SELF -> GrafiteAst.Try (loc, tac) + | IDENT "solve"; + SYMBOL "["; tacs = LIST0 SELF SEP SYMBOL "|"; SYMBOL "]"-> + GrafiteAst.Solve (loc, tacs) + | IDENT "progress"; tac = SELF -> GrafiteAst.Progress (loc, tac) + | LPAREN; tac = SELF; RPAREN -> tac + | tac = tactic -> tac + ] + ]; + punctuation_tactical: + [ + [ SYMBOL "[" -> GrafiteAst.Branch loc + | SYMBOL "|" -> GrafiteAst.Shift loc + | i = LIST1 int SEP SYMBOL ","; SYMBOL ":" -> GrafiteAst.Pos (loc, i) + | SYMBOL "*"; SYMBOL ":" -> GrafiteAst.Wildcard loc + | SYMBOL "]" -> GrafiteAst.Merge loc + | SYMBOL ";" -> GrafiteAst.Semicolon loc + | SYMBOL "." -> GrafiteAst.Dot loc + ] + ]; + non_punctuation_tactical: + [ "simple" NONA + [ IDENT "focus"; goals = LIST1 int -> GrafiteAst.Focus (loc, goals) + | IDENT "unfocus" -> GrafiteAst.Unfocus loc + | IDENT "skip" -> GrafiteAst.Skip loc + ] + ]; + theorem_flavour: [ + [ [ IDENT "definition" ] -> `Definition + | [ IDENT "fact" ] -> `Fact + | [ IDENT "lemma" ] -> `Lemma + | [ IDENT "remark" ] -> `Remark + | [ IDENT "theorem" ] -> `Theorem + ] + ]; + inductive_spec: [ [ + fst_name = IDENT; params = LIST0 CicNotationParser.protected_binder_vars; + SYMBOL ":"; fst_typ = term; SYMBOL <:unicode>; OPT SYMBOL "|"; + fst_constructors = LIST0 constructor SEP SYMBOL "|"; + tl = OPT [ "with"; + types = LIST1 [ + name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode>; + OPT SYMBOL "|"; constructors = LIST0 constructor SEP SYMBOL "|" -> + (name, true, typ, constructors) ] SEP "with" -> types + ] -> + let params = + List.fold_right + (fun (names, typ) acc -> + (List.map (fun name -> (name, typ)) names) @ acc) + params [] + in + let fst_ind_type = (fst_name, true, fst_typ, fst_constructors) in + let tl_ind_types = match tl with None -> [] | Some types -> types in + let ind_types = fst_ind_type :: tl_ind_types in + (params, ind_types) + ] ]; + + record_spec: [ [ + name = IDENT; params = LIST0 CicNotationParser.protected_binder_vars ; + SYMBOL ":"; typ = term; SYMBOL <:unicode>; SYMBOL "{" ; + fields = LIST0 [ + name = IDENT ; + coercion = [ + SYMBOL ":" -> false,0 + | SYMBOL ":"; SYMBOL ">" -> true,0 + | SYMBOL ":"; arity = int ; SYMBOL ">" -> true,arity + ]; + ty = term -> + let b,n = coercion in + (name,ty,b,n) + ] SEP SYMBOL ";"; SYMBOL "}" -> + let params = + List.fold_right + (fun (names, typ) acc -> + (List.map (fun name -> (name, typ)) names) @ acc) + params [] + in + (params,name,typ,fields) + ] ]; + + macro: [ + [ [ IDENT "check" ]; t = term -> + GrafiteAst.Check (loc, t) + | [ IDENT "inline"]; + style = OPT [ IDENT "procedural"; depth = OPT int -> depth ]; + suri = QSTRING; prefix = OPT QSTRING -> + let style = match style with + | None -> GrafiteAst.Declarative + | Some depth -> GrafiteAst.Procedural depth + in + let prefix = match prefix with None -> "" | Some prefix -> prefix in + GrafiteAst.Inline (loc,style,suri,prefix) + | [ IDENT "hint" ]; rew = OPT (IDENT "rewrite") -> + if rew = None then GrafiteAst.Hint (loc, false) else GrafiteAst.Hint (loc,true) + | IDENT "auto"; params = auto_params -> + GrafiteAst.AutoInteractive (loc,params) + | [ IDENT "whelp"; "match" ] ; t = term -> + GrafiteAst.WMatch (loc,t) + | [ IDENT "whelp"; IDENT "instance" ] ; t = term -> + GrafiteAst.WInstance (loc,t) + | [ IDENT "whelp"; IDENT "locate" ] ; id = QSTRING -> + GrafiteAst.WLocate (loc,id) + | [ IDENT "whelp"; IDENT "elim" ] ; t = term -> + GrafiteAst.WElim (loc, t) + | [ IDENT "whelp"; IDENT "hint" ] ; t = term -> + GrafiteAst.WHint (loc,t) + ] + ]; + alias_spec: [ + [ IDENT "id"; id = QSTRING; SYMBOL "="; uri = QSTRING -> + let alpha = "[a-zA-Z]" in + let num = "[0-9]+" in + let ident_cont = "\\("^alpha^"\\|"^num^"\\|_\\|\\\\\\)" in + let ident = "\\("^alpha^ident_cont^"*\\|_"^ident_cont^"+\\)" in + let rex = Str.regexp ("^"^ident^"$") in + if Str.string_match rex id 0 then + if (try ignore (UriManager.uri_of_string uri); true + with UriManager.IllFormedUri _ -> false) + then + LexiconAst.Ident_alias (id, uri) + else + raise + (HExtlib.Localized (loc, CicNotationParser.Parse_error (Printf.sprintf "Not a valid uri: %s" uri))) + else + raise (HExtlib.Localized (loc, CicNotationParser.Parse_error ( + Printf.sprintf "Not a valid identifier: %s" id))) + | IDENT "symbol"; symbol = QSTRING; + instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ]; + SYMBOL "="; dsc = QSTRING -> + let instance = + match instance with Some i -> i | None -> 0 + in + LexiconAst.Symbol_alias (symbol, instance, dsc) + | IDENT "num"; + instance = OPT [ LPAREN; IDENT "instance"; n = int; RPAREN -> n ]; + SYMBOL "="; dsc = QSTRING -> + let instance = + match instance with Some i -> i | None -> 0 + in + LexiconAst.Number_alias (instance, dsc) + ] + ]; + argument: [ + [ l = LIST0 [ SYMBOL <:unicode> (* η *); SYMBOL "." -> () ]; + id = IDENT -> + Ast.IdentArg (List.length l, id) + ] + ]; + associativity: [ + [ IDENT "left"; IDENT "associative" -> Gramext.LeftA + | IDENT "right"; IDENT "associative" -> Gramext.RightA + | IDENT "non"; IDENT "associative" -> Gramext.NonA + ] + ]; + precedence: [ + [ "with"; IDENT "precedence"; n = NUMBER -> int_of_string n ] + ]; + notation: [ + [ dir = OPT direction; s = QSTRING; + assoc = OPT associativity; prec = OPT precedence; + IDENT "for"; + p2 = + [ blob = UNPARSED_AST -> + add_raw_attribute ~text:(Printf.sprintf "@{%s}" blob) + (CicNotationParser.parse_level2_ast + (Ulexing.from_utf8_string blob)) + | blob = UNPARSED_META -> + add_raw_attribute ~text:(Printf.sprintf "${%s}" blob) + (CicNotationParser.parse_level2_meta + (Ulexing.from_utf8_string blob)) + ] -> + let assoc = + match assoc with + | None -> default_associativity + | Some assoc -> assoc + in + let prec = + match prec with + | None -> default_precedence + | Some prec -> prec + in + let p1 = + add_raw_attribute ~text:s + (CicNotationParser.parse_level1_pattern + (Ulexing.from_utf8_string s)) + in + (dir, p1, assoc, prec, p2) + ] + ]; + level3_term: [ + [ u = URI -> Ast.UriPattern (UriManager.uri_of_string u) + | id = IDENT -> Ast.VarPattern id + | SYMBOL "_" -> Ast.ImplicitPattern + | LPAREN; terms = LIST1 SELF; RPAREN -> + (match terms with + | [] -> assert false + | [term] -> term + | terms -> Ast.ApplPattern terms) + ] + ]; + interpretation: [ + [ s = CSYMBOL; args = LIST0 argument; SYMBOL "="; t = level3_term -> + (s, args, t) + ] + ]; + + include_command: [ [ + IDENT "include" ; path = QSTRING -> + loc,path,LexiconAst.WithPreferences + | IDENT "include'" ; path = QSTRING -> + loc,path,LexiconAst.WithoutPreferences + ]]; + + grafite_command: [ [ + IDENT "set"; n = QSTRING; v = QSTRING -> + GrafiteAst.Set (loc, n, v) + | IDENT "drop" -> GrafiteAst.Drop loc + | IDENT "print"; s = IDENT -> GrafiteAst.Print (loc,s) + | IDENT "qed" -> GrafiteAst.Qed loc + | IDENT "variant" ; name = IDENT; SYMBOL ":"; + typ = term; SYMBOL <:unicode> ; newname = IDENT -> + GrafiteAst.Obj (loc, + Ast.Theorem + (`Variant,name,typ,Some (Ast.Ident (newname, None)))) + | flavour = theorem_flavour; name = IDENT; SYMBOL ":"; typ = term; + body = OPT [ SYMBOL <:unicode> (* ≝ *); body = term -> body ] -> + GrafiteAst.Obj (loc, Ast.Theorem (flavour, name, typ, body)) + | flavour = theorem_flavour; name = IDENT; SYMBOL <:unicode> (* ≝ *); + body = term -> + GrafiteAst.Obj (loc, + Ast.Theorem (flavour, name, Ast.Implicit, Some body)) + | IDENT "axiom"; name = IDENT; SYMBOL ":"; typ = term -> + GrafiteAst.Obj (loc, Ast.Theorem (`Axiom, name, typ, None)) + | "let"; ind_kind = [ "corec" -> `CoInductive | "rec"-> `Inductive ]; + defs = CicNotationParser.let_defs -> + (* In case of mutual definitions here we produce just + the syntax tree for the first one. The others will be + generated from the completely specified term just before + insertion in the environment. We use the flavour + `MutualDefinition to rememer this. *) + let name,ty = + match defs with + | (params,(Ast.Ident (name, None), Some ty),_,_) :: _ -> + let ty = + List.fold_right + (fun var ty -> Ast.Binder (`Pi,var,ty) + ) params ty + in + name,ty + | (_,(Ast.Ident (name, None), None),_,_) :: _ -> + name, Ast.Implicit + | _ -> assert false + in + let body = Ast.Ident (name,None) in + let flavour = + if List.length defs = 1 then + `Definition + else + `MutualDefinition + in + GrafiteAst.Obj (loc, Ast.Theorem(flavour, name, ty, + Some (Ast.LetRec (ind_kind, defs, body)))) + | IDENT "inductive"; spec = inductive_spec -> + let (params, ind_types) = spec in + GrafiteAst.Obj (loc, Ast.Inductive (params, ind_types)) + | IDENT "coinductive"; spec = inductive_spec -> + let (params, ind_types) = spec in + let ind_types = (* set inductive flags to false (coinductive) *) + List.map (fun (name, _, term, ctors) -> (name, false, term, ctors)) + ind_types + in + GrafiteAst.Obj (loc, Ast.Inductive (params, ind_types)) + | IDENT "coercion" ; suri = URI ; arity = OPT int ; + saturations = OPT int; composites = OPT (IDENT "nocomposites") -> + let arity = match arity with None -> 0 | Some x -> x in + let saturations = match saturations with None -> 0 | Some x -> x in + let composites = match composites with None -> true | Some _ -> false in + GrafiteAst.Coercion + (loc, UriManager.uri_of_string suri, composites, arity, saturations) + | IDENT "record" ; (params,name,ty,fields) = record_spec -> + GrafiteAst.Obj (loc, Ast.Record (params,name,ty,fields)) + | IDENT "default" ; what = QSTRING ; uris = LIST1 URI -> + let uris = List.map UriManager.uri_of_string uris in + GrafiteAst.Default (loc,what,uris) + | IDENT "relation" ; aeq = tactic_term ; "on" ; a = tactic_term ; + refl = OPT [ IDENT "reflexivity" ; IDENT "proved" ; IDENT "by" ; + refl = tactic_term -> refl ] ; + sym = OPT [ IDENT "symmetry" ; IDENT "proved" ; IDENT "by" ; + sym = tactic_term -> sym ] ; + trans = OPT [ IDENT "transitivity" ; IDENT "proved" ; IDENT "by" ; + trans = tactic_term -> trans ] ; + "as" ; id = IDENT -> + GrafiteAst.Relation (loc,id,a,aeq,refl,sym,trans) + ]]; + lexicon_command: [ [ + IDENT "alias" ; spec = alias_spec -> + LexiconAst.Alias (loc, spec) + | IDENT "notation"; (dir, l1, assoc, prec, l2) = notation -> + LexiconAst.Notation (loc, dir, l1, assoc, prec, l2) + | IDENT "interpretation"; id = QSTRING; + (symbol, args, l3) = interpretation -> + LexiconAst.Interpretation (loc, id, (symbol, args), l3) + ]]; + executable: [ + [ cmd = grafite_command; SYMBOL "." -> GrafiteAst.Command (loc, cmd) + | tac = atomic_tactical LEVEL "loops"; punct = punctuation_tactical -> + GrafiteAst.Tactic (loc, Some tac, punct) + | punct = punctuation_tactical -> GrafiteAst.Tactic (loc, None, punct) + | tac = non_punctuation_tactical; punct = punctuation_tactical -> + GrafiteAst.NonPunctuationTactical (loc, tac, punct) + | mac = macro; SYMBOL "." -> GrafiteAst.Macro (loc, mac) + ] + ]; + comment: [ + [ BEGINCOMMENT ; ex = executable ; ENDCOMMENT -> + GrafiteAst.Code (loc, ex) + | str = NOTE -> + GrafiteAst.Note (loc, str) + ] + ]; + statement: [ + [ ex = executable -> + fun ~include_paths status -> status,LSome(GrafiteAst.Executable (loc,ex)) + | com = comment -> + fun ~include_paths status -> status,LSome (GrafiteAst.Comment (loc, com)) + | (iloc,fname,mode) = include_command ; SYMBOL "." -> + fun ~include_paths status -> + let _root, buri, fullpath = + Librarian.baseuri_of_script ~include_paths fname + in + let status = + LexiconEngine.eval_command status + (LexiconAst.Include (iloc,buri,mode,fullpath)) + in + !out fname; + status, + LSome + (GrafiteAst.Executable + (loc,GrafiteAst.Command + (loc,GrafiteAst.Include (iloc,buri)))) + | scom = lexicon_command ; SYMBOL "." -> + fun ~include_paths status -> + let status = LexiconEngine.eval_command status scom in + status,LNone loc + | EOI -> raise End_of_file + ] + ]; +END + +let exc_located_wrapper f = + try + f () + with + | Stdpp.Exc_located (_, End_of_file) -> raise End_of_file + | Stdpp.Exc_located (floc, Stream.Error msg) -> + raise (HExtlib.Localized (floc,CicNotationParser.Parse_error msg)) + | Stdpp.Exc_located (floc, exn) -> + raise + (HExtlib.Localized (floc,CicNotationParser.Parse_error (Printexc.to_string exn))) + +let parse_statement lexbuf = + exc_located_wrapper + (fun () -> (Grammar.Entry.parse statement (Obj.magic lexbuf))) diff --git a/components/grafite_parser/grafiteParser.mli b/components/grafite_parser/grafiteParser.mli new file mode 100644 index 000000000..f8754df0c --- /dev/null +++ b/components/grafite_parser/grafiteParser.mli @@ -0,0 +1,46 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type 'a localized_option = + LSome of 'a + | LNone of GrafiteAst.loc + +type ast_statement = + (CicNotationPt.term, CicNotationPt.term, + CicNotationPt.term GrafiteAst.reduction, + CicNotationPt.term CicNotationPt.obj, string) + GrafiteAst.statement + +type statement = + include_paths:string list -> + LexiconEngine.status -> + LexiconEngine.status * ast_statement localized_option + +val parse_statement: Ulexing.lexbuf -> statement (** @raise End_of_file *) + +val statement: statement Grammar.Entry.e + +(* this callback is called on every include command *) +val set_callback: (string -> unit) -> unit diff --git a/components/grafite_parser/grafiteWalker.ml b/components/grafite_parser/grafiteWalker.ml new file mode 100644 index 000000000..742532113 --- /dev/null +++ b/components/grafite_parser/grafiteWalker.ml @@ -0,0 +1,77 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type statement_test = + GrafiteParser.ast_statement GrafiteParser.localized_option -> bool + +let get_loc = + function + | GrafiteParser.LSome (GrafiteAst.Executable (loc, _)) + | GrafiteParser.LSome (GrafiteAst.Comment (loc, _)) + | GrafiteParser.LNone loc -> + loc + +let grep_statement ?(status = LexiconEngine.initial_status) ?(callback = ignore) + ~fname test += + let include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" in + let content = HExtlib.input_file fname in + let lexbuf = Ulexing.from_utf8_string content in + let parse_fun status = + GrafiteParser.parse_statement lexbuf ~include_paths status in + let rec exaust acc status = (* extract "interesting" statement locations *) + let stm = + try Some (parse_fun status) + with End_of_file -> None in + match stm with + | None -> List.rev acc + | Some (status, stm) when test stm -> (* "interesting" statement *) + let loc_begin, loc_end = HExtlib.loc_of_floc (get_loc stm) in + let raw_statement = + Netconversion.ustring_sub `Enc_utf8 loc_begin (loc_end - loc_begin) + content in + callback raw_statement; + exaust (raw_statement :: acc) status + | Some (status, _stm) -> exaust acc status in + exaust [] status + +let ma_extension_test fname = Filename.check_suffix fname ".ma" + +let rgrep_statement ?status ?callback ?(fname_test = ma_extension_test) + ~dirname test += + let files = HExtlib.find ~test:fname_test dirname in + List.flatten + (List.map + (fun fname -> + let callback = + match callback with + | None -> None + | Some f -> Some (fun s -> f (fname, s)) in + List.map (fun raw -> fname, raw) + (grep_statement ?status ?callback ~fname test)) + files) + diff --git a/components/grafite_parser/grafiteWalker.mli b/components/grafite_parser/grafiteWalker.mli new file mode 100644 index 000000000..b4ca6f0d7 --- /dev/null +++ b/components/grafite_parser/grafiteWalker.mli @@ -0,0 +1,48 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type statement_test = + GrafiteParser.ast_statement GrafiteParser.localized_option -> bool + + (** @param status initial status, defaults to LexiconEngine.initial_status + * @param callback if given it will be invoked as soon as a matching + * statement is found (i.e. it provides incremental notification in case + * grepping takes a while) *) +val grep_statement: + ?status: LexiconEngine.status -> + ?callback: (string -> unit) -> + fname:string -> statement_test -> + string list + + (** As above, but act on all file (recursively) located under directory + * dirname whose name matches fname_test. Default test matches files with + * extension ".ma". + * @return list of pairs , as "grep -H" would do *) +val rgrep_statement: + ?status: LexiconEngine.status -> + ?callback: (string * string -> unit) -> + ?fname_test:(string -> bool) -> dirname:string -> statement_test -> + (string * string) list + diff --git a/components/grafite_parser/print_grammar.ml b/components/grafite_parser/print_grammar.ml new file mode 100644 index 000000000..f05b77a11 --- /dev/null +++ b/components/grafite_parser/print_grammar.ml @@ -0,0 +1,291 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Gramext + +let tex_of_unicode s = +(*CSC: ??????? What's the meaning of this function? + let contractions = ("\\Longrightarrow","=>") :: [] in + if String.length s <= 1 then s + else (* probably an extended unicode symbol *) + let s = Utf8Macro.tex_of_unicode s in + try List.assoc s contractions with Not_found -> s +*) match Utf8Macro.tex_of_unicode s with + Some s -> s + | None -> s + +let needs_brackets t = + let rec count_brothers = function + | Node {brother = brother} -> 1 + count_brothers brother + | _ -> 0 + in + count_brothers t > 1 + +let visit_description desc fmt self = + let skip s = List.mem s [ ] in + let inline s = List.mem s [ "int" ] in + + let rec visit_entry e todo is_son nesting = + let { ename = ename; edesc = desc } = e in + if inline ename then + visit_desc desc todo is_son nesting + else + begin + Format.fprintf fmt "%s " ename; + if skip ename then + todo + else + todo @ [e] + end + + and visit_desc d todo is_son nesting = + match d with + | Dlevels [] -> todo + | Dlevels [lev] -> visit_level lev todo is_son nesting + | Dlevels (lev::levels) -> + let todo = visit_level lev todo is_son nesting in + List.fold_left + (fun acc l -> + Format.fprintf fmt "@ | "; + visit_level l acc is_son nesting) + todo levels; + | _ -> todo + + and visit_level l todo is_son nesting = + let { lsuffix = suff ; lprefix = pref } = l in + let todo = visit_tree suff todo is_son nesting in + visit_tree pref todo is_son nesting + + and visit_tree t todo is_son nesting = + match t with + | Node node -> visit_node node todo is_son nesting + | _ -> todo + + and visit_node n todo is_son nesting = + let is_tree_printable t = + match t with + | Node _ -> true + | _ -> false + in + let { node = symbol; son = son ; brother = brother } = n in + let todo = visit_symbol symbol todo is_son nesting in + let todo = + if is_tree_printable son then + begin + let need_b = needs_brackets son in + if not is_son then + Format.fprintf fmt "@["; + if need_b then + Format.fprintf fmt "( "; + let todo = visit_tree son todo true nesting in + if need_b then + Format.fprintf fmt ")"; + if not is_son then + Format.fprintf fmt "@]"; + todo + end + else + todo + in + if is_tree_printable brother then + begin + Format.fprintf fmt "@ | "; + visit_tree brother todo is_son nesting + end + else + todo + + and visit_symbol s todo is_son nesting = + match s with + | Smeta (name, sl, _) -> + Format.fprintf fmt "%s " name; + List.fold_left ( + fun acc s -> + let todo = visit_symbol s acc is_son nesting in + if is_son then + Format.fprintf fmt "@ "; + todo) + todo sl + | Snterm entry -> visit_entry entry todo is_son nesting + | Snterml (entry,_) -> visit_entry entry todo is_son nesting + | Slist0 symbol -> + Format.fprintf fmt "{@[ "; + let todo = visit_symbol symbol todo is_son (nesting+1) in + Format.fprintf fmt "@]} @ "; + todo + | Slist0sep (symbol,sep) -> + Format.fprintf fmt "[@[ "; + let todo = visit_symbol symbol todo is_son (nesting + 1) in + Format.fprintf fmt "{@[ "; + let todo = visit_symbol sep todo is_son (nesting + 2) in + Format.fprintf fmt " "; + let todo = visit_symbol symbol todo is_son (nesting + 2) in + Format.fprintf fmt "@]} @]] @ "; + todo + | Slist1 symbol -> + Format.fprintf fmt "{@[ "; + let todo = visit_symbol symbol todo is_son (nesting + 1) in + Format.fprintf fmt "@]}+ @ "; + todo + | Slist1sep (symbol,sep) -> + let todo = visit_symbol symbol todo is_son nesting in + Format.fprintf fmt "{@[ "; + let todo = visit_symbol sep todo is_son (nesting + 1) in + let todo = visit_symbol symbol todo is_son (nesting + 1) in + Format.fprintf fmt "@]} @ "; + todo + | Sopt symbol -> + Format.fprintf fmt "[@[ "; + let todo = visit_symbol symbol todo is_son (nesting + 1) in + Format.fprintf fmt "@]] @ "; + todo + | Sself -> Format.fprintf fmt "%s " self; todo + | Snext -> Format.fprintf fmt "next "; todo + | Stoken pattern -> + let constructor, keyword = pattern in + if keyword = "" then + Format.fprintf fmt "`%s' " constructor + else + Format.fprintf fmt "\"%s\" " (tex_of_unicode keyword); + todo + | Stree tree -> + if needs_brackets tree then + begin + Format.fprintf fmt "@[( "; + let todo = visit_tree tree todo is_son (nesting + 1) in + Format.fprintf fmt ")@] @ "; + todo + end + else + visit_tree tree todo is_son (nesting + 1) + in + visit_desc desc [] false 0 +;; + +let rec clean_dummy_desc = function + | Dlevels l -> Dlevels (clean_levels l) + | x -> x + +and clean_levels = function + | [] -> [] + | l :: tl -> clean_level l @ clean_levels tl + +and clean_level = function + | x -> + let pref = clean_tree x.lprefix in + let suff = clean_tree x.lsuffix in + match pref,suff with + | DeadEnd, DeadEnd -> [] + | _ -> [{x with lprefix = pref; lsuffix = suff}] + +and clean_tree = function + | Node n -> clean_node n + | x -> x + +and clean_node = function + | {node=node;son=son;brother=brother} -> + let bn = is_symbol_dummy node in + let bs = is_tree_dummy son in + let bb = is_tree_dummy brother in + let son = if bs then DeadEnd else son in + let brother = if bb then DeadEnd else brother in + if bb && bs && bn then + DeadEnd + else + if bn then + Node {node=Sself;son=son;brother=brother} + else + Node {node=node;son=son;brother=brother} + +and is_level_dummy = function + | {lsuffix=lsuffix;lprefix=lprefix} -> + is_tree_dummy lsuffix && is_tree_dummy lprefix + +and is_desc_dummy = function + | Dlevels l -> List.for_all is_level_dummy l + | Dparser _ -> true + +and is_entry_dummy = function + | {edesc=edesc} -> is_desc_dummy edesc + +and is_symbol_dummy = function + | Stoken ("DUMMY", _) -> true + | Stoken _ -> false + | Smeta (_, lt, _) -> List.for_all is_symbol_dummy lt + | Snterm e | Snterml (e, _) -> is_entry_dummy e + | Slist1 x | Slist0 x -> is_symbol_dummy x + | Slist1sep (x,y) | Slist0sep (x,y) -> is_symbol_dummy x && is_symbol_dummy y + | Sopt x -> is_symbol_dummy x + | Sself | Snext -> false + | Stree t -> is_tree_dummy t + +and is_tree_dummy = function + | Node {node=node} -> is_symbol_dummy node + | _ -> true +;; + + +let rec visit_entries todo pped = + let fmt = Format.std_formatter in + match todo with + | [] -> () + | hd :: tl -> + let todo = + if not (List.memq hd pped) then + begin + let { ename = ename; edesc = desc } = hd in + Format.fprintf fmt "@[%s ::=@ " ename; + let desc = clean_dummy_desc desc in + let todo = visit_description desc fmt ename @ todo in + Format.fprintf fmt "@]"; + Format.pp_print_newline fmt (); + Format.pp_print_newline fmt (); + todo + end + else + todo + in + let clean_todo todo = + let name_of_entry e = e.ename in + let pped = hd :: pped in + let todo = tl @ todo in + let todo = List.filter (fun e -> not(List.memq e pped)) todo in + HExtlib.list_uniq + ~eq:(fun e1 e2 -> (name_of_entry e1) = (name_of_entry e2)) + (List.sort + (fun e1 e2 -> + Pervasives.compare (name_of_entry e1) (name_of_entry e2)) + todo), + pped + in + let todo,pped = clean_todo todo in + visit_entries todo pped +;; + +let _ = + let g_entry = Grammar.Entry.obj GrafiteParser.statement in + visit_entries [g_entry] [] diff --git a/components/grafite_parser/test_dep.ml b/components/grafite_parser/test_dep.ml new file mode 100644 index 000000000..2d0f7813f --- /dev/null +++ b/components/grafite_parser/test_dep.ml @@ -0,0 +1,40 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let _ = + let ic = ref stdin in + let usage = "test_coarse_parser [ file ]" in + let open_file fname = + if !ic <> stdin then close_in !ic; + ic := open_in fname + in + Arg.parse [] open_file usage; + let deps = + DependenciesParser.parse_dependencies (Ulexing.from_utf8_channel !ic) + in + List.iter (fun dep -> print_endline (DependenciesParser.pp_dependency dep)) deps + diff --git a/components/grafite_parser/test_parser.ml b/components/grafite_parser/test_parser.ml new file mode 100644 index 000000000..76c402c19 --- /dev/null +++ b/components/grafite_parser/test_parser.ml @@ -0,0 +1,135 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let _ = Helm_registry.load_from "test_parser.conf.xml" + +let xml_stream_of_markup = + let rec print_box (t: CicNotationPres.boxml_markup) = + Box.box2xml print_mpres t + and print_mpres (t: CicNotationPres.mathml_markup) = + Mpresentation.print_mpres print_box t + in + print_mpres + +let dump_xml t id_to_uri fname = + prerr_endline (sprintf "dumping MathML to %s ..." fname); + flush stdout; + let oc = open_out fname in + let markup = CicNotationPres.render id_to_uri t in + let xml_stream = CicNotationPres.print_xml markup in + Xml.pp_to_outchan xml_stream oc; + close_out oc + +let extract_loc = + function + | GrafiteAst.Executable (loc, _) + | GrafiteAst.Comment (loc, _) -> loc + +let pp_associativity = function + | Gramext.LeftA -> "left" + | Gramext.RightA -> "right" + | Gramext.NonA -> "non" + +let pp_precedence = string_of_int + +(* let last_rule_id = ref None *) + +let process_stream istream = + let char_count = ref 0 in + let module P = CicNotationPt in + let module G = GrafiteAst in + let status = + ref + (CicNotation2.load_notation + ~include_paths:[] (Helm_registry.get "notation.core_file")) + in + try + while true do + try + match + GrafiteParser.parse_statement ~include_paths:[] istream !status + with + newstatus, GrafiteParser.LNone _ -> status := newstatus + | newstatus, GrafiteParser.LSome statement -> + status := newstatus; + let floc = extract_loc statement in + let (_, y) = HExtlib.loc_of_floc floc in + char_count := y + !char_count; + match statement with + (* | G.Executable (_, G.Macro (_, G.Check (_, + P.AttributedTerm (_, P.Ident _)))) -> + prerr_endline "mega hack"; + (match !last_rule_id with + | None -> () + | Some id -> + prerr_endline "removing last notation rule ..."; + CicNotationParser.delete id) *) + | G.Executable (_, G.Macro (_, G.Check (_, t))) -> + prerr_endline (sprintf "ast: %s" (CicNotationPp.pp_term t)); + let t' = TermContentPres.pp_ast t in + prerr_endline (sprintf "rendered ast: %s" + (CicNotationPp.pp_term t')); + let tbl = Hashtbl.create 0 in + dump_xml t' tbl "out.xml" + | statement -> + prerr_endline + ("Unsupported statement: " ^ + GrafiteAstPp.pp_statement + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + ~term_pp:CicNotationPp.pp_term + ~lazy_term_pp:(fun _ -> "_lazy_term_here_") + ~obj_pp:(fun _ -> "_obj_here_") + statement) + with + | End_of_file -> raise End_of_file + | HExtlib.Localized (floc,CicNotationParser.Parse_error msg) -> + let (x, y) = HExtlib.loc_of_floc floc in +(* let before = String.sub line 0 x in + let error = String.sub line x (y - x) in + let after = String.sub line y (String.length line - y) in + eprintf "%s%s%s\n" before error after; + prerr_endline (sprintf "at character %d-%d: %s" x y msg) *) + prerr_endline (sprintf "Parse error at character %d-%d: %s" + (!char_count + x) (!char_count + y) msg) + | exn -> + prerr_endline + (sprintf "TestParser: Uncaught exception: %s" (Printexc.to_string exn)) + done + with End_of_file -> () + +let _ = + let arg_spec = [ ] in + let usage = "" in + Arg.parse arg_spec (fun _ -> raise (Arg.Bad usage)) usage; + print_endline "Loading builtin notation ..."; + print_endline "done."; + flush stdout; + process_stream (Ulexing.from_utf8_channel stdin) + diff --git a/components/hbugs/.depend b/components/hbugs/.depend new file mode 100644 index 000000000..d6a85b905 --- /dev/null +++ b/components/hbugs/.depend @@ -0,0 +1,20 @@ +hbugs_common.cmi: hbugs_types.cmi +hbugs_id_generator.cmi: hbugs_types.cmi +hbugs_messages.cmi: hbugs_types.cmi +hbugs_client.cmi: hbugs_types.cmi +hbugs_misc.cmo: hbugs_misc.cmi +hbugs_misc.cmx: hbugs_misc.cmi +hbugs_common.cmo: hbugs_types.cmi hbugs_common.cmi +hbugs_common.cmx: hbugs_types.cmi hbugs_common.cmi +hbugs_id_generator.cmo: hbugs_id_generator.cmi +hbugs_id_generator.cmx: hbugs_id_generator.cmi +hbugs_messages.cmo: hbugs_types.cmi hbugs_misc.cmi hbugs_messages.cmi +hbugs_messages.cmx: hbugs_types.cmi hbugs_misc.cmx hbugs_messages.cmi +hbugs_client_gui.cmo: hbugs_client_gui.cmi +hbugs_client_gui.cmx: hbugs_client_gui.cmi +hbugs_client.cmo: hbugs_types.cmi hbugs_misc.cmi hbugs_messages.cmi \ + hbugs_id_generator.cmi hbugs_common.cmi hbugs_client_gui.cmi \ + hbugs_client.cmi +hbugs_client.cmx: hbugs_types.cmi hbugs_misc.cmx hbugs_messages.cmx \ + hbugs_id_generator.cmx hbugs_common.cmx hbugs_client_gui.cmx \ + hbugs_client.cmi diff --git a/components/hbugs/Makefile b/components/hbugs/Makefile new file mode 100644 index 000000000..4170d8081 --- /dev/null +++ b/components/hbugs/Makefile @@ -0,0 +1,98 @@ + +# Targets description: +# all (default) -> builds hbugs bytecode library hbugs.cma +# opt -> builds hbugs native library hbugs.cmxa +# daemons -> builds hbugs broker and tutors executables +# +# start -> starts up broker and tutors +# stop -> stop broker and tutors +# +# broker -> builds broker executable +# tutors -> builds tutors executables +# client -> builds hbugs client + +PACKAGE = hbugs + +IMPLEMENTATION_FILES = \ + hbugs_misc.ml \ + hbugs_common.ml \ + hbugs_id_generator.ml \ + hbugs_messages.ml \ + hbugs_client_gui.ml \ + hbugs_client.ml +INTERFACE_FILES = \ + hbugs_types.mli \ + $(patsubst %.ml, %.mli, $(IMPLEMENTATION_FILES)) + +include ../../Makefile.defs +include ../Makefile.common +include .tutors.ml +include .generated_tutors.ml + +.tutors.ml: + echo -n "TUTORS_ML = " > $@ + scripts/ls_tutors.ml | xargs >> $@ +.generated_tutors.ml: + echo -n "GENERATED_TUTORS_ML = " > $@ + scripts/ls_tutors.ml -auto | xargs >> $@ + +TUTORS = $(patsubst %.ml, %, $(TUTORS_ML)) +TUTORS_OPT = $(patsubst %, %.opt, $(TUTORS)) +GENERATED_TUTORS = $(patsubst %.ml, %, $(GENERATED_TUTORS_ML)) + +hbugs_client_gui.ml hbugs_client_gui.mli: hbugs_client_gui.glade + lablgladecc2 $< > hbugs_client_gui.ml + $(OCAMLC) -i hbugs_client_gui.ml > hbugs_client_gui.mli + +clean: clean_mains +.PHONY: clean_mains +clean_mains: + rm -f $(TUTORS) $(TUTORS_OPT) broker{,.opt} client{,.opt} +distclean: clean + rm -f $(GENERATED_TUTORS_ML) hbugs_client_gui.ml{,i} + rm -f .tutors.ml .generated_tutors.ml + +MAINS_DEPS = \ + hbugs_misc.cmo \ + hbugs_messages.cmo \ + hbugs_id_generator.cmo +TUTOR_DEPS = $(MAINS_DEPS) \ + hbugs_tutors.cmo +BROKER_DEPS = $(MAINS_DEPS) \ + hbugs_broker_registry.cmo +CLIENT_DEPS = $(MAINS_DEPS) \ + hbugs_client_gui.cmo \ + hbugs_common.cmo \ + hbugs_client.cmo +TUTOR_DEPS_OPT = $(patsubst %.cmo, %.cmx, $(TUTOR_DEPS)) +BROKER_DEPS_OPT = $(patsubst %.cmo, %.cmx, $(BROKER_DEPS)) +CLIENT_DEPS_OPT = $(patsubst %.cmo, %.cmx, $(CLIENT_DEPS)) +$(GENERATED_TUTORS_ML): scripts/build_tutors.ml data/tutors_index.xml data/hbugs_tutor.TPL.ml + scripts/build_tutors.ml +hbugs_tutors.cmo: hbugs_tutors.cmi +hbugs_broker_registry.cmo: hbugs_broker_registry.cmi +.PHONY: daemons +daemons: tutors broker +.PHONY: tutors +tutors: all $(TUTORS) +%_tutor: $(TUTOR_DEPS) %_tutor.ml + $(OCAMLC) -linkpkg -o $@ $^ +%_tutor.opt: $(TUTOR_DEPS_OPT) %_tutor.ml + $(OCAMLOPT) -linkpkg -o $@ $^ +broker: $(BROKER_DEPS) broker.ml + $(OCAMLC) -linkpkg -o $@ $^ +broker.opt: $(BROKER_DEPS_OPT) broker.ml + $(OCAMLOPT) -linkpkg -o $@ $^ +client: $(CLIENT_DEPS) client.ml + $(OCAMLC) -linkpkg -o $@ $^ +client.opt: $(CLIENT_DEPS_OPT) client.ml + $(OCAMLOPT) -linkpkg -o $@ $^ + +.PHONY: start stop +start: + scripts/brokerctl.sh start + scripts/sabba.sh start +stop: + scripts/brokerctl.sh stop + scripts/sabba.sh stop + diff --git a/components/hbugs/broker.ml b/components/hbugs/broker.ml new file mode 100644 index 000000000..691f9d11a --- /dev/null +++ b/components/hbugs/broker.ml @@ -0,0 +1,293 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Hbugs_types;; +open Printf;; + +let debug = true ;; +let debug_print s = if debug then prerr_endline (Lazy.force s) ;; + +let daemon_name = "H-Bugs Broker" ;; +let default_port = 49081 ;; +let port_env_var = "HELM_HBUGS_BROKER_PORT" ;; +let port = + try + int_of_string (Sys.getenv port_env_var) + with + | Not_found -> default_port + | Failure "int_of_string" -> + prerr_endline "Warning: invalid port, reverting to default"; + default_port +;; +let usage_string = "HBugs Broker: usage string not yet written :-(";; + +exception Unexpected_msg of message;; + +let return_xml_msg body outchan = + Http_daemon.respond ~headers:["Content-Type", "text/xml"] ~body outchan +;; +let parse_musing_id = function + | Musing_started (_, musing_id) -> + prerr_endline ("#### Started musing ID: " ^ musing_id); + musing_id + | Musing_aborted (_, musing_id) -> musing_id + | msg -> + prerr_endline (sprintf "Assertion failed, received msg: %s" + (Hbugs_messages.string_of_msg msg)); + assert false +;; + +let do_critical = + let mutex = Mutex.create () in + fun action -> + try +(* debug_print (lazy "Acquiring lock ..."); *) + Mutex.lock mutex; +(* debug_print (lazy "Lock Acquired!"); *) + let res = Lazy.force action in +(* debug_print (lazy "Releaseing lock ..."); *) + Mutex.unlock mutex; +(* debug_print (lazy "Lock released!"); *) + res + with e -> Mutex.unlock mutex; raise e +;; + + (* registries *) +let clients = new Hbugs_broker_registry.clients in +let tutors = new Hbugs_broker_registry.tutors in +let musings = new Hbugs_broker_registry.musings in +let registries = + [ (clients :> Hbugs_broker_registry.registry); + (tutors :> Hbugs_broker_registry.registry); + (musings :> Hbugs_broker_registry.registry) ] +in + +let my_own_id = Hbugs_id_generator.new_broker_id () in + + (* debugging: dump broker internal status, used by '/dump' method *) +let dump_registries () = + assert debug; + String.concat "\n" (List.map (fun o -> o#dump) registries) +in + +let handle_msg outchan msg = + (* messages from clients *) + (match msg with + + | Help -> + Hbugs_messages.respond_msg (Usage usage_string) outchan + | Register_client (client_id, client_url) -> do_critical (lazy ( + try + clients#register client_id client_url; + Hbugs_messages.respond_msg (Client_registered my_own_id) outchan + with Hbugs_broker_registry.Client_already_in id -> + Hbugs_messages.respond_exc "already_registered" id outchan + )) + | Unregister_client client_id -> do_critical (lazy ( + if clients#isAuthenticated client_id then begin + clients#unregister client_id; + Hbugs_messages.respond_msg (Client_unregistered my_own_id) outchan + end else + Hbugs_messages.respond_exc "forbidden" client_id outchan + )) + | List_tutors client_id -> do_critical (lazy ( + if clients#isAuthenticated client_id then begin + Hbugs_messages.respond_msg + (Tutor_list (my_own_id, tutors#index)) + outchan + end else + Hbugs_messages.respond_exc "forbidden" client_id outchan + )) + | Subscribe (client_id, tutor_ids) -> do_critical (lazy ( + if clients#isAuthenticated client_id then begin + if List.length tutor_ids <> 0 then begin (* at least one tutor id *) + if List.for_all tutors#exists tutor_ids then begin + clients#subscribe client_id tutor_ids; + Hbugs_messages.respond_msg + (Subscribed (my_own_id, tutor_ids)) outchan + end else (* required subscription to at least one unexistent tutor *) + let missing_tutors = + List.filter (fun id -> not (tutors#exists id)) tutor_ids + in + Hbugs_messages.respond_exc + "tutor_not_found" (String.concat " " missing_tutors) outchan + end else (* no tutor id specified *) + Hbugs_messages.respond_exc "no_tutor_specified" "" outchan + end else + Hbugs_messages.respond_exc "forbidden" client_id outchan + )) + | State_change (client_id, new_state) -> do_critical (lazy ( + if clients#isAuthenticated client_id then begin + let active_musings = musings#getByClientId client_id in + prerr_endline (sprintf "ACTIVE MUSINGS: %s" (String.concat ", " active_musings)); + if List.length active_musings = 0 then + prerr_endline ("No active musings for client " ^ client_id); + prerr_endline "CSC: State change!!!" ; + let stop_answers = + List.map (* collect Abort_musing message's responses *) + (fun id -> (* musing id *) + let tutor = snd (musings#getByMusingId id) in + Hbugs_messages.submit_req + ~url:(tutors#getUrl tutor) (Abort_musing (my_own_id, id))) + active_musings + in + let stopped_musing_ids = List.map parse_musing_id stop_answers in + List.iter musings#unregister active_musings; + (match new_state with + | Some new_state -> (* need to start new musings *) + let subscriptions = clients#getSubscription client_id in + if List.length subscriptions = 0 then + prerr_endline ("No subscriptions for client " ^ client_id); + let started_musing_ids = + List.map (* register new musings and collect their ids *) + (fun tutor_id -> + let res = + Hbugs_messages.submit_req + ~url:(tutors#getUrl tutor_id) + (Start_musing (my_own_id, new_state)) + in + let musing_id = parse_musing_id res in + musings#register musing_id client_id tutor_id; + musing_id) + subscriptions + in + Hbugs_messages.respond_msg + (State_accepted (my_own_id, stopped_musing_ids, started_musing_ids)) + outchan + | None -> (* no need to start new musings *) + Hbugs_messages.respond_msg + (State_accepted (my_own_id, stopped_musing_ids, [])) + outchan) + end else + Hbugs_messages.respond_exc "forbidden" client_id outchan + )) + + (* messages from tutors *) + + | Register_tutor (tutor_id, tutor_url, hint_type, dsc) -> do_critical (lazy ( + try + tutors#register tutor_id tutor_url hint_type dsc; + Hbugs_messages.respond_msg (Tutor_registered my_own_id) outchan + with Hbugs_broker_registry.Tutor_already_in id -> + Hbugs_messages.respond_exc "already_registered" id outchan + )) + | Unregister_tutor tutor_id -> do_critical (lazy ( + if tutors#isAuthenticated tutor_id then begin + tutors#unregister tutor_id; + Hbugs_messages.respond_msg (Tutor_unregistered my_own_id) outchan + end else + Hbugs_messages.respond_exc "forbidden" tutor_id outchan + )) + + | Musing_completed (tutor_id, musing_id, result) -> do_critical (lazy ( + if not (tutors#isAuthenticated tutor_id) then begin (* unauthorized *) + Hbugs_messages.respond_exc "forbidden" tutor_id outchan; + end else if not (musings#isActive musing_id) then begin (* too late *) + Hbugs_messages.respond_msg (Too_late (my_own_id, musing_id)) outchan; + end else begin (* all is ok: autorhized and on time *) + (match result with + | Sorry -> () + | Eureka hint -> + let client_url = + clients#getUrl (fst (musings#getByMusingId musing_id)) + in + let res = + Hbugs_messages.submit_req ~url:client_url (Hint (my_own_id, hint)) + in + (match res with + | Wow _ -> () (* ok: client is happy with our hint *) + | unexpected_msg -> + prerr_endline + (sprintf + "Warning: unexpected msg from client: %s\nExpected was: Wow" + (Hbugs_messages.string_of_msg msg)))); + Hbugs_messages.respond_msg (Thanks (my_own_id, musing_id)) outchan; + musings#unregister musing_id + end + )) + + | msg -> (* unexpected message *) + debug_print (lazy "Unknown message!"); + Hbugs_messages.respond_exc + "unexpected_msg" (Hbugs_messages.string_of_msg msg) outchan) +in +(* (* DEBUGGING wrapper around 'handle_msg' *) +let handle_msg outchan = + if debug then + (fun msg -> (* filter handle_msg through a function which dumps input + messages *) + debug_print (lazy (Hbugs_messages.string_of_msg msg)); + handle_msg outchan msg) + else + handle_msg outchan +in +*) + + (* thread action *) +let callback (req: Http_types.request) outchan = + try + debug_print (lazy ("Connection from " ^ req#clientAddr)); + debug_print (lazy ("Received request: " ^ req#path)); + (match req#path with + (* TODO write help message *) + | "/help" -> return_xml_msg " not yet written " outchan + | "/act" -> + let msg = Hbugs_messages.msg_of_string req#body in + handle_msg outchan msg + | "/dump" -> + if debug then + Http_daemon.respond ~body:(dump_registries ()) outchan + else + Http_daemon.respond_error ~code:400 outchan + | _ -> Http_daemon.respond_error ~code:400 outchan); + debug_print (lazy "Done!\n") + with + | Http_types.Param_not_found attr_name -> + Hbugs_messages.respond_exc "missing_parameter" attr_name outchan + | exc -> + Hbugs_messages.respond_exc + "uncaught_exception" (Printexc.to_string exc) outchan +in + + (* thread who cleans up ancient client/tutor/musing registrations *) +let ragman () = + let delay = 3600.0 in (* 1 hour delay *) + while true do + Thread.delay delay; + List.iter (fun o -> o#purge) registries + done +in + + (* start daemon *) +printf "Listening on port %d ...\n" port; +flush stdout; +ignore (Thread.create ragman ()); +Http_daemon.start' ~port ~mode:`Thread callback + diff --git a/components/hbugs/client.ml b/components/hbugs/client.ml new file mode 100644 index 000000000..93114b305 --- /dev/null +++ b/components/hbugs/client.ml @@ -0,0 +1,46 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Hbugs_common;; +open Printf;; + +let client = + new Hbugs_client.hbugsClient + ~use_hint_callback: + (fun hint -> + prerr_endline (sprintf "Using hint: %s" (string_of_hint hint))) + ~describe_hint_callback: + (fun hint -> + prerr_endline (sprintf "Describing hint: %s" (string_of_hint hint))) + () +in +client#show (); +GtkThread.main () + diff --git a/components/hbugs/data/hbugs_tutor.TPL.ml b/components/hbugs/data/hbugs_tutor.TPL.ml new file mode 100644 index 000000000..947e351c7 --- /dev/null +++ b/components/hbugs/data/hbugs_tutor.TPL.ml @@ -0,0 +1,42 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +module TutorDescription = + struct + let addr = "@ADDR@" + let port = @PORT@ + let tactic = @TACTIC@ + let hint = @HINT@ + let hint_type = "@HINT_TYPE@" + let description = "@DESCRIPTION@" + let environment_file = "@ENVIRONMENT_FILE@" + end +;; +module Tutor = Hbugs_tutors.BuildTutor (TutorDescription) ;; +Tutor.start () ;; + diff --git a/components/hbugs/data/tutors_index.xml b/components/hbugs/data/tutors_index.xml new file mode 100644 index 000000000..bd4baad45 --- /dev/null +++ b/components/hbugs/data/tutors_index.xml @@ -0,0 +1,140 @@ + + + + + + + + + 127.0.0.1 + 50001 + Ring.ring_tac + Hbugs_types.Use_ring_Luke + Use Ring Luke + Ring tutor + ring.environment + + + 127.0.0.1 + 50002 + FourierR.fourier_tac + Hbugs_types.Use_fourier_Luke + Use Fourier Luke + Fourier tutor + fourier.environment + + + 127.0.0.1 + 50003 + EqualityTactics.reflexivity_tac + Hbugs_types.Use_reflexivity_Luke + Use Reflexivity Luke + Reflexivity tutor + reflexivity.environment + + + 127.0.0.1 + 50004 + EqualityTactics.symmetry_tac + Hbugs_types.Use_symmetry_Luke + Use Symmetry Luke + Symmetry tutor + symmetry.environment + + + 127.0.0.1 + 50005 + VariousTactics.assumption_tac + Hbugs_types.Use_assumption_Luke + Use Assumption Luke + Assumption tutor + assumption.environment + + + 127.0.0.1 + 50006 + NegationTactics.contradiction_tac + Hbugs_types.Use_contradiction_Luke + Use Contradiction Luke + Contradiction tutor + contradiction.environment + + + 127.0.0.1 + 50007 + IntroductionTactics.exists_tac + Hbugs_types.Use_exists_Luke + Use Exists Luke + Exists tutor + exists.environment + + + 127.0.0.1 + 50008 + IntroductionTactics.split_tac + Hbugs_types.Use_split_Luke + Use Split Luke + Split tutor + split.environment + + + 127.0.0.1 + 50009 + IntroductionTactics.left_tac + Hbugs_types.Use_left_Luke + Use Left Luke + Left tutor + left.environment + + + 127.0.0.1 + 50010 + IntroductionTactics.right_tac + Hbugs_types.Use_right_Luke + Use Right Luke + Right tutor + right.environment + + + + 127.0.0.1 + 50011 + PrimitiveTactics.apply_tac + Hbugs_types.Use_apply_Luke + Use Apply Luke (with argument) + Search pattern apply tutor + search_pattern_apply.environment + + + diff --git a/components/hbugs/doc/hbugs.dia b/components/hbugs/doc/hbugs.dia new file mode 100644 index 0000000000000000000000000000000000000000..b1c4e64e294dfa83da49661e287419060021d95e GIT binary patch literal 1927 zcmV;22YC1&iwFP!000001MOX1Z`(E$eb28j+?NV)W${~Tn-pDvVGk(=Y$^6=$TnkZ zktKtYljdc=ee_3SOP0;pCNH2u0b0Ncb1z999i4k9(Vss5m?fP@sq#2Wue-?eyB(R1 zvT>YFuDjpwet#cyKi^z^8pqKG{cob8Sx5gxnlC?Hcc(=$|IqJ0Jw18Ja~>6$@{)Mr z<+A@@lq6AKH|lq9t~#CF0OP2Lmd7?nqoPppa8bxk8qMT&cNmQxCMsK`qT}KZlDQ1zH#OZz>C8K0L5!eeb#xL`5dWxa@6p8y3%6*DBAIvjVs3

z(+smLkx{zNRH%hKKTkf25(=4PLqX?9zmJO|GxYyHO7gc1V14-Y>N)jFoTzww{6Z|X zI1uG29v9QW4@c9rj{fW@`eU5O!$j8gK28g3;h!%If9ZK%#ABHo&UCrWfk@L$v%YEI z)plcHVbx<9n$uZQ0%4 zZS}o29$$C=^vlyz9gq&D$!BkV=Gp6cBt2Xm?*4f^6nZ$UMpnA-Q94QF3wLtXLtZG@ zN8%CI6WsGLJ1^lVOVfc&$E(i2c}R7?7W}*(s3M#15BTMJ_PsL)riNK@I4n9Z=vYNh zgZpf>*qf;%x15s`j8v8%Pf)ohoOHtH$spBt&gqlP_a>;0h)xQgXA5`1S3Q@J!=7Ih ze0^|DHfOUBx|DrT;FNxl*zykwzzC>3s@mVT6x32sOFmzQ9n(-JJCTm(HWe*%G)GRPN8M)E!CW9qyV3kpIA z`R8?^kU#cL`-_SCmz>0TA=O}%#4;^v9o3U^X&h8@$#gN>Fy8qCFsWnThzuJ5rWRB@ zLT(|9$qKTs5M~7T5QczoWpH&EN7z1wzpkJ=P#Y-Aag$MuAb6Nv&clcR5V3}BnTaV3 z6YmbL9_G|OjBho12gRbuRNiO+6952n8$8Sac$ijrm_zX}Gw?9C58%5cb_a=uaij6e z0Prg;l;YH_8yKRH^~f5&x*FH;6+N~@FX!$Ha%$jT=1>W*D7di*#?%N58vqV05HNQP zV9JR`>??o+pY;R?fXid6ca&Vw?@yqDF*8EL282Tk>%kBr7*|9v1`@&8B!aO65&U-% z6>>0|>Uoe&RuLFN1tSZOG#~*{$MH%X7Xa09!c@lv4j{Z3<|Ey@(fBpO!U}$EEQ+HL zpo|O3WgPaQ%DC`&8Has`_-(e224M#yY~!g82B3p6Eem11G9m=P(;dv9gfVxbB2+P$ zEpq*-$uby2coB%$crHKyxDl9_?Fbw|fVeWcdXziR5#Ltu9pp1~EZ=SM^*p8p(OlY(arR1cil_IYI#{Izq}79bqsP9Wgn>gtex`AqW!) zXBgR7nUtCw0`j+Nx?vLv5j>* zMj@UhCKU!|Kn%>NiGf+`Q5-7n7>F)r7IZP=0J@m5$}1fLNEb71Vq(#H6h~kTvFw3u ztlhD|y+^@B*`r_~kVnCS;~oVITaV(1pnzEPz&6(II0N8fPRm@(IS?0fX5eDZAv_AX zQ1T&av`N7sp3uZr-nJ6}5}EU|MCJjIMCQUEk$KRX6gBV#@z_Ee@C8s6yrL>Nl&atc zRlyyoia+9JZ}-D(XbCN?(s8858ozhTxvJT+%Emi(4x#IN!q-q;?)QTOCO$F`hdk&Z z59!Yq@8Z?nq$_O>ZM42ZR;gVDhLgK&ek&hka$qz6BO7ub+I~Gti@J=<r& literal 0 HcmV?d00001 diff --git a/components/hbugs/hbugs_broker_registry.ml b/components/hbugs/hbugs_broker_registry.ml new file mode 100644 index 000000000..4670b5eca --- /dev/null +++ b/components/hbugs/hbugs_broker_registry.ml @@ -0,0 +1,317 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Hbugs_misc;; +open Hbugs_types;; +open Printf;; + +exception Client_already_in of client_id;; +exception Client_not_found of client_id;; +exception Musing_already_in of musing_id;; +exception Musing_not_found of musing_id;; +exception Tutor_already_in of tutor_id;; +exception Tutor_not_found of tutor_id;; + +class type registry = + object + method dump: string + method purge: unit + end + +let expire_time = 1800. (* 30 minutes *) + +class clients = + object (self) + + inherit ThreadSafe.threadSafe +(* + (* *) + method private doCritical: 'a. 'a lazy_t -> 'a = fun act -> Lazy.force act + method private doWriter: 'a. 'a lazy_t -> 'a = fun act -> Lazy.force act + method private doReader: 'a. 'a lazy_t -> 'a = fun act -> Lazy.force act + (* *) +*) + + val timetable: (client_id, float) Hashtbl.t = Hashtbl.create 17 + val urls: (client_id, string) Hashtbl.t = Hashtbl.create 17 + val subscriptions: (client_id, tutor_id list) Hashtbl.t = Hashtbl.create 17 + + (** INVARIANT: each client registered has an entry in 'urls' hash table + _and_ in 'subscriptions hash table even if it hasn't yet invoked + 'subscribe' method *) + + method register id url = self#doWriter (lazy ( + if Hashtbl.mem urls id then + raise (Client_already_in id) + else begin + Hashtbl.add urls id url; + Hashtbl.add subscriptions id []; + Hashtbl.add timetable id (Unix.time ()) + end + )) + method private remove id = + Hashtbl.remove urls id; + Hashtbl.remove subscriptions id; + Hashtbl.remove timetable id + method unregister id = self#doWriter (lazy ( + if Hashtbl.mem urls id then + self#remove id + else + raise (Client_not_found id) + )) + method isAuthenticated id = self#doReader (lazy ( + Hashtbl.mem urls id + )) + method subscribe client_id tutor_ids = self#doWriter (lazy ( + if Hashtbl.mem urls client_id then + Hashtbl.replace subscriptions client_id tutor_ids + else + raise (Client_not_found client_id) + )) + method getUrl id = self#doReader (lazy ( + if Hashtbl.mem urls id then + Hashtbl.find urls id + else + raise (Client_not_found id) + )) + method getSubscription id = self#doReader (lazy ( + if Hashtbl.mem urls id then + Hashtbl.find subscriptions id + else + raise (Client_not_found id) + )) + + method dump = self#doReader (lazy ( + "\n" ^ + (Hashtbl.fold + (fun id url dump -> + (dump ^ + (sprintf "\n" id url) ^ + "\n" ^ + (String.concat "\n" (* id's subscriptions *) + (List.map + (fun tutor_id -> sprintf "\n" tutor_id) + (Hashtbl.find subscriptions id))) ^ + "\n\n")) + urls "") ^ + "" + )) + method purge = self#doWriter (lazy ( + let now = Unix.time () in + Hashtbl.iter + (fun id birthday -> + if now -. birthday > expire_time then + self#remove id) + timetable + )) + + end + +class tutors = + object (self) + + inherit ThreadSafe.threadSafe +(* + (* *) + method private doCritical: 'a. 'a lazy_t -> 'a = fun act -> Lazy.force act + method private doWriter: 'a. 'a lazy_t -> 'a = fun act -> Lazy.force act + method private doReader: 'a. 'a lazy_t -> 'a = fun act -> Lazy.force act + (* *) +*) + + val timetable: (tutor_id, float) Hashtbl.t = Hashtbl.create 17 + val tbl: (tutor_id, string * hint_type * string) Hashtbl.t = + Hashtbl.create 17 + + method register id url hint_type dsc = self#doWriter (lazy ( + if Hashtbl.mem tbl id then + raise (Tutor_already_in id) + else begin + Hashtbl.add tbl id (url, hint_type, dsc); + Hashtbl.add timetable id (Unix.time ()) + end + )) + method private remove id = + Hashtbl.remove tbl id; + Hashtbl.remove timetable id + method unregister id = self#doWriter (lazy ( + if Hashtbl.mem tbl id then + self#remove id + else + raise (Tutor_not_found id) + )) + method isAuthenticated id = self#doReader (lazy ( + Hashtbl.mem tbl id + )) + method exists id = self#doReader (lazy ( + Hashtbl.mem tbl id + )) + method getTutor id = self#doReader (lazy ( + if Hashtbl.mem tbl id then + Hashtbl.find tbl id + else + raise (Tutor_not_found id) + )) + method getUrl id = + let (url, _, _) = self#getTutor id in + url + method getHintType id = + let (_, hint_type, _) = self#getTutor id in + hint_type + method getDescription id = + let (_, _, dsc) = self#getTutor id in + dsc + method index = self#doReader (lazy ( + Hashtbl.fold + (fun id (url, hint_type, dsc) idx -> (id, dsc) :: idx) tbl [] + )) + + method dump = self#doReader (lazy ( + "\n" ^ + (Hashtbl.fold + (fun id (url, hint_type, dsc) dump -> + dump ^ + (sprintf +"\n%s\n%s\n" + id url hint_type dsc)) + tbl "") ^ + "" + )) + method purge = self#doWriter (lazy ( + let now = Unix.time () in + Hashtbl.iter + (fun id birthday -> + if now -. birthday > expire_time then + self#remove id) + timetable + )) + + end + +class musings = + object (self) + + inherit ThreadSafe.threadSafe +(* + (* *) + method private doCritical: 'a. 'a lazy_t -> 'a = fun act -> Lazy.force act + method private doWriter: 'a. 'a lazy_t -> 'a = fun act -> Lazy.force act + method private doReader: 'a. 'a lazy_t -> 'a = fun act -> Lazy.force act + (* *) +*) + + val timetable: (musing_id, float) Hashtbl.t = Hashtbl.create 17 + val musings: (musing_id, client_id * tutor_id) Hashtbl.t = Hashtbl.create 17 + val clients: (client_id, musing_id list) Hashtbl.t = Hashtbl.create 17 + val tutors: (tutor_id, musing_id list) Hashtbl.t = Hashtbl.create 17 + + (** INVARIANT: each registered musing has + an entry in 'musings' table, an entry in 'clients' (i.e. one of the + musings for client_id is musing_id) table, an entry in 'tutors' table + (i.e. one of the musings for tutor_id is musing_id) and an entry in + 'timetable' table *) + + + method register musing_id client_id tutor_id = self#doWriter (lazy ( + if Hashtbl.mem musings musing_id then + raise (Musing_already_in musing_id) + else begin + Hashtbl.add musings musing_id (client_id, tutor_id); + (* now add this musing as the first one of musings list for client and + tutor *) + Hashtbl.replace clients client_id + (musing_id :: + (try Hashtbl.find clients client_id with Not_found -> [])); + Hashtbl.replace tutors tutor_id + (musing_id :: + (try Hashtbl.find tutors tutor_id with Not_found -> [])); + Hashtbl.add timetable musing_id (Unix.time ()) + end + )) + method private remove id = + (* ASSUMPTION: this method is invoked under a 'writer' lock *) + let (client_id, tutor_id) = self#getByMusingId' id in + Hashtbl.remove musings id; + (* now remove this musing from the list of musings for client and tutor + *) + Hashtbl.replace clients client_id + (List.filter ((<>) id) + (try Hashtbl.find clients client_id with Not_found -> [])); + Hashtbl.replace tutors tutor_id + (List.filter ((<>) id) + (try Hashtbl.find tutors tutor_id with Not_found -> [])); + Hashtbl.remove timetable id + method unregister id = self#doWriter (lazy ( + if Hashtbl.mem musings id then + self#remove id + )) + method private getByMusingId' id = + (* ASSUMPTION: this method is invoked under a 'reader' lock *) + try + Hashtbl.find musings id + with Not_found -> raise (Musing_not_found id) + method getByMusingId id = self#doReader (lazy ( + self#getByMusingId' id + )) + method getByClientId id = self#doReader (lazy ( + try + Hashtbl.find clients id + with Not_found -> [] + )) + method getByTutorId id = self#doReader (lazy ( + try + Hashtbl.find tutors id + with Not_found -> [] + )) + method isActive id = self#doReader (lazy ( + Hashtbl.mem musings id + )) + + method dump = self#doReader (lazy ( + "\n" ^ + (Hashtbl.fold + (fun mid (cid, tid) dump -> + dump ^ + (sprintf "\n" + mid cid tid)) + musings "") ^ + "" + )) + method purge = self#doWriter (lazy ( + let now = Unix.time () in + Hashtbl.iter + (fun id birthday -> + if now -. birthday > expire_time then + self#remove id) + timetable + )) + + end + diff --git a/components/hbugs/hbugs_broker_registry.mli b/components/hbugs/hbugs_broker_registry.mli new file mode 100644 index 000000000..ece9e07cf --- /dev/null +++ b/components/hbugs/hbugs_broker_registry.mli @@ -0,0 +1,87 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Hbugs_types;; + +exception Client_already_in of client_id +exception Client_not_found of client_id +exception Musing_already_in of musing_id +exception Musing_not_found of musing_id +exception Tutor_already_in of tutor_id +exception Tutor_not_found of tutor_id + +class type registry = + object + method dump: string + method purge: unit + end + +class clients: + object + (** 'register client_id client_url' *) + method register: client_id -> string -> unit + method unregister: client_id -> unit + method isAuthenticated: client_id -> bool + (** subcribe a client to a set of tutor removing previous subcriptions *) + method subscribe: client_id -> tutor_id list -> unit + method getUrl: client_id -> string + method getSubscription: client_id -> tutor_id list + + method dump: string + method purge: unit + end + +class tutors: + object + method register: tutor_id -> string -> hint_type -> string -> unit + method unregister: tutor_id -> unit + method isAuthenticated: tutor_id -> bool + method exists: tutor_id -> bool + method getTutor: tutor_id -> string * hint_type * string + method getUrl: tutor_id -> string + method getHintType: tutor_id -> hint_type + method getDescription: tutor_id -> string + method index: tutor_dsc list + + method dump: string + method purge: unit + end + +class musings: + object + method register: musing_id -> client_id -> tutor_id -> unit + method unregister: musing_id -> unit + method getByMusingId: musing_id -> client_id * tutor_id + method getByClientId: client_id -> musing_id list + method getByTutorId: tutor_id -> musing_id list + method isActive: musing_id -> bool + + method dump: string + method purge: unit + end + diff --git a/components/hbugs/hbugs_client.ml b/components/hbugs/hbugs_client.ml new file mode 100644 index 000000000..c7b5fae75 --- /dev/null +++ b/components/hbugs/hbugs_client.ml @@ -0,0 +1,526 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Hbugs_common;; +open Hbugs_types;; +open Printf;; + +exception Invalid_URL of string;; + +let do_nothing _ = ();; + +module SmartHbugs_client_gui = + struct + class ['a] oneColumnCList gtree_view ~column_type ~column_title + = + let obj = + ((Gobject.unsafe_cast gtree_view#as_widget) : Gtk.tree_view Gtk.obj) in + let columns = new GTree.column_list in + let col = columns#add column_type in + let vcol = GTree.view_column ~title:column_title () + ~renderer:(GTree.cell_renderer_text[], ["text",col]) in + let store = GTree.list_store columns in + object(self) + inherit GTree.view obj + method clear = store#clear + method append (v : 'a) = + let row = store#append () in + store#set ~row ~column:col v; + method column = col + initializer + self#set_model (Some (store :> GTree.model)) ; + ignore (self#append_column vcol) + end + + class ['a,'b] twoColumnsCList gtree_view ~column1_type ~column2_type + ~column1_title ~column2_title + = + let obj = + ((Gobject.unsafe_cast gtree_view#as_widget) : Gtk.tree_view Gtk.obj) in + let columns = new GTree.column_list in + let col1 = columns#add column1_type in + let vcol1 = GTree.view_column ~title:column1_title () + ~renderer:(GTree.cell_renderer_text[], ["text",col1]) in + let col2 = columns#add column2_type in + let vcol2 = GTree.view_column ~title:column2_title () + ~renderer:(GTree.cell_renderer_text[], ["text",col2]) in + let store = GTree.list_store columns in + object(self) + inherit GTree.view obj + method clear = store#clear + method append (v1 : 'a) (v2 : 'b) = + let row = store#append () in + store#set ~row ~column:col1 v1; + store#set ~row ~column:col2 v2 + method column1 = col1 + method column2 = col2 + initializer + self#set_model (Some (store :> GTree.model)) ; + ignore (self#append_column vcol1) ; + ignore (self#append_column vcol2) ; + end + + class subscribeWindow () = + object(self) + inherit Hbugs_client_gui.subscribeWindow () + val mutable tutorsSmartCList = None + method tutorsSmartCList = + match tutorsSmartCList with + None -> assert false + | Some w -> w + initializer + tutorsSmartCList <- + Some + (new twoColumnsCList self#tutorsCList + ~column1_type:Gobject.Data.string ~column2_type:Gobject.Data.string + ~column1_title:"Id" ~column2_title:"Description") + end + + class hbugsMainWindow () = + object(self) + inherit Hbugs_client_gui.hbugsMainWindow () + val mutable subscriptionSmartCList = None + val mutable hintsSmartCList = None + method subscriptionSmartCList = + match subscriptionSmartCList with + None -> assert false + | Some w -> w + method hintsSmartCList = + match hintsSmartCList with + None -> assert false + | Some w -> w + initializer + subscriptionSmartCList <- + Some + (new oneColumnCList self#subscriptionCList + ~column_type:Gobject.Data.string ~column_title:"Description") + initializer + hintsSmartCList <- + Some + (new oneColumnCList self#hintsCList + ~column_type:Gobject.Data.string ~column_title:"Description") + end + + end +;; + +class hbugsClient + ?(use_hint_callback: hint -> unit = do_nothing) + ?(describe_hint_callback: hint -> unit = do_nothing) + ?(destroy_callback: unit -> unit = do_nothing) + () + = + + let http_url_RE = Pcre.regexp "^(http://)?(.*):(\\d+)" in + let port_of_http_url url = + try + let subs = Pcre.extract ~rex:http_url_RE url in + int_of_string subs.(3) + with e -> raise (Invalid_URL url) + in + + object (self) + + val mainWindow = new SmartHbugs_client_gui.hbugsMainWindow () + val subscribeWindow = new SmartHbugs_client_gui.subscribeWindow () + val messageDialog = new Hbugs_client_gui.messageDialog () + val myOwnId = Hbugs_id_generator.new_client_id () + val mutable use_hint_callback = use_hint_callback + val mutable myOwnUrl = "localhost:49082" + val mutable brokerUrl = "localhost:49081" + val mutable brokerId: broker_id option = None + (* all available tutors, saved last time a List_tutors message was sent to + broker *) + val mutable availableTutors: tutor_dsc list = [] + val mutable statusContext = None + val mutable subscribeWindowStatusContext = None + val mutable debug = false (* enable/disable debugging buttons *) + val mutable hints = [] (* actually available hints *) + + initializer + self#initGui; + self#startLocalHttpDaemon (); + self#testLocalHttpDaemon (); + self#testBroker (); + self#registerToBroker (); + self#reconfigDebuggingButtons + + method show = mainWindow#hbugsMainWindow#show + method hide = mainWindow#hbugsMainWindow#misc#hide + + method setUseHintCallback callback = + use_hint_callback <- callback + + method private debugButtons = + List.map + (fun (b: GButton.button) -> new GObj.misc_ops b#as_widget) + [ mainWindow#startLocalHttpDaemonButton; + mainWindow#testLocalHttpDaemonButton; mainWindow#testBrokerButton ] + + method private initGui = + + (* GUI: main window *) + + (* ignore delete events so that hbugs window is closable only using + menu; on destroy (e.g. while quitting gTopLevel) self#quit is invoked + *) + + ignore (mainWindow#hbugsMainWindow#event#connect#delete (fun _ -> true)); + ignore (mainWindow#hbugsMainWindow#event#connect#destroy + (fun _ -> self#quit (); false)); + + (* GUI main window's menu *) + mainWindow#toggleDebuggingMenuItem#set_active debug; + ignore (mainWindow#toggleDebuggingMenuItem#connect#toggled + self#toggleDebug); + + (* GUI: local HTTP daemon settings *) + ignore (mainWindow#clientUrlEntry#connect#changed + (fun _ -> myOwnUrl <- mainWindow#clientUrlEntry#text)); + mainWindow#clientUrlEntry#set_text myOwnUrl; + ignore (mainWindow#startLocalHttpDaemonButton#connect#clicked + self#startLocalHttpDaemon); + ignore (mainWindow#testLocalHttpDaemonButton#connect#clicked + self#testLocalHttpDaemon); + + (* GUI: broker choice *) + ignore (mainWindow#brokerUrlEntry#connect#changed + (fun _ -> brokerUrl <- mainWindow#brokerUrlEntry#text)); + mainWindow#brokerUrlEntry#set_text brokerUrl; + ignore (mainWindow#testBrokerButton#connect#clicked self#testBroker); + mainWindow#clientIdLabel#set_text myOwnId; + + (* GUI: client registration *) + ignore (mainWindow#registerClientButton#connect#clicked + self#registerToBroker); + + (* GUI: subscriptions *) + ignore (mainWindow#showSubscriptionWindowButton#connect#clicked + (fun () -> + self#listTutors (); + subscribeWindow#subscribeWindow#show ())); + + let get_selected_row_index () = + match mainWindow#hintsCList#selection#get_selected_rows with + [path] -> + (match GTree.Path.get_indices path with + [|n|] -> n + | _ -> assert false) + | _ -> assert false + in + (* GUI: hints list *) + ignore ( + let event_ops = new GObj.event_ops mainWindow#hintsCList#as_widget in + event_ops#connect#button_press + (fun event -> + if GdkEvent.get_type event = `TWO_BUTTON_PRESS then + use_hint_callback (self#hint (get_selected_row_index ())) ; + false)); + + ignore (mainWindow#hintsCList#selection#connect#changed + (fun () -> + describe_hint_callback (self#hint (get_selected_row_index ())))) ; + + (* GUI: main status bar *) + let ctxt = mainWindow#mainWindowStatusBar#new_context "0" in + statusContext <- Some ctxt; + ignore (ctxt#push "Ready"); + + (* GUI: subscription window *) + subscribeWindow#tutorsCList#selection#set_mode `MULTIPLE; + ignore (subscribeWindow#subscribeWindow#event#connect#delete + (fun _ -> subscribeWindow#subscribeWindow#misc#hide (); true)); + ignore (subscribeWindow#listTutorsButton#connect#clicked self#listTutors); + ignore (subscribeWindow#subscribeButton#connect#clicked + self#subscribeSelected); + ignore (subscribeWindow#subscribeAllButton#connect#clicked + self#subscribeAll); + (subscribeWindow#tutorsCList#get_column 0)#set_visible false; + let ctxt = subscribeWindow#subscribeWindowStatusBar#new_context "0" in + subscribeWindowStatusContext <- Some ctxt; + ignore (ctxt#push "Ready"); + + (* GUI: message dialog *) + ignore (messageDialog#messageDialog#event#connect#delete + (fun _ -> messageDialog#messageDialog#misc#hide (); true)); + ignore (messageDialog#okDialogButton#connect#clicked + (fun _ -> messageDialog#messageDialog#misc#hide ())) + + (* accessory methods *) + + (** pop up a (modal) dialog window showing msg to the user *) + method private showDialog msg = + messageDialog#dialogLabel#set_text msg; + messageDialog#messageDialog#show () + (** use showDialog to display an hbugs message to the user *) + method private showMsgInDialog msg = + self#showDialog (Hbugs_messages.string_of_msg msg) + + (** create a new thread which sends msg to broker, wait for an answer and + invoke callback passing response message as argument *) + method private sendReq ?(wait = false) ~msg callback = + let thread () = + try + callback (Hbugs_messages.submit_req ~url:(brokerUrl ^ "/act") msg) + with + | (Hbugs_messages.Parse_error (subj, reason)) as e -> + self#showDialog + (sprintf +"Parse_error, unable to fullfill request. Details follow. +Request: %s +Error: %s" + (Hbugs_messages.string_of_msg msg) (Printexc.to_string e)); + | (Unix.Unix_error _) as e -> + self#showDialog + (sprintf +"Can't connect to HBugs Broker +Url: %s +Error: %s" + brokerUrl (Printexc.to_string e)) + | e -> + self#showDialog + (sprintf "hbugsClient#sendReq: Uncaught exception: %s" + (Printexc.to_string e)) + in + let th = Thread.create thread () in + if wait then + Thread.join th + else () + + (** check if a broker is authenticated using its broker_id + [ Background: during client registration, client save broker_id of its + broker, further messages from broker are accepted only if they carry the + same broker id ] *) + method private isAuthenticated id = + match brokerId with + | None -> false + | Some broker_id -> (id = broker_id) + + (* actions *) + + method private startLocalHttpDaemon = + (* flatten an hint tree to an hint list *) + let rec flatten_hint = function + | Hints hints -> List.concat (List.map flatten_hint hints) + | hint -> [hint] + in + fun () -> + let callback req outchan = + try + (match Hbugs_messages.msg_of_string req#body with + | Help -> + Hbugs_messages.respond_msg + (Usage "Local Http Daemon up and running!") outchan + | Hint (broker_id, hint) -> + if self#isAuthenticated broker_id then begin + let received_hints = flatten_hint hint in + List.iter + (fun h -> + (match h with Hints _ -> assert false | _ -> ()); + ignore(mainWindow#hintsSmartCList#append(string_of_hint h))) + received_hints; + hints <- hints @ received_hints; + Hbugs_messages.respond_msg (Wow myOwnId) outchan + end else (* msg from unauthorized broker *) + Hbugs_messages.respond_exc "forbidden" broker_id outchan + | msg -> + Hbugs_messages.respond_exc + "unexpected_msg" (Hbugs_messages.string_of_msg msg) outchan) + with (Hbugs_messages.Parse_error _) as e -> + Hbugs_messages.respond_exc + "parse_error" (Printexc.to_string e) outchan + in + let addr = "0.0.0.0" in (* TODO actually user specified "My URL" is used + only as a value to be sent to broker, local HTTP + daemon will listen on "0.0.0.0", port is parsed + from My URL though *) + let httpDaemonThread () = + try + Http_daemon.start' + ~addr ~port:(port_of_http_url myOwnUrl) ~mode:`Single callback + with + | Invalid_URL url -> self#showDialog (sprintf "Invalid URL: \"%s\"" url) + | e -> + self#showDialog (sprintf "Can't start local HTTP daemon: %s" + (Printexc.to_string e)) + in + ignore (Thread.create httpDaemonThread ()) + + method private testLocalHttpDaemon () = + try + let msg = + Hbugs_misc.http_post ~body:(Hbugs_messages.string_of_msg Help) + myOwnUrl + in + ignore msg +(* self#showDialog msg *) + with + | Hbugs_misc.Malformed_URL url -> + self#showDialog + (sprintf + "Handshake with local HTTP daemon failed, Invalid URL: \"%s\"" + url) + | Hbugs_misc.Malformed_HTTP_response res -> + self#showDialog + (sprintf + "Handshake with local HTTP daemon failed, can't parse HTTP response: \"%s\"" + res) + | (Unix.Unix_error _) as e -> + self#showDialog + (sprintf + "Handshake with local HTTP daemon failed, can't connect: \"%s\"" + (Printexc.to_string e)) + + method private testBroker () = + self#sendReq ~msg:Help + (function + | Usage _ -> () + | unexpected_msg -> + self#showDialog + (sprintf + "Handshake with HBugs Broker failed, unexpected message:\n%s" + (Hbugs_messages.string_of_msg unexpected_msg))) + + method registerToBroker () = + (match brokerId with (* undo previous registration, if any *) + | Some id -> self#unregisterFromBroker () + | _ -> ()); + self#sendReq ~msg:(Register_client (myOwnId, myOwnUrl)) + (function + | Client_registered broker_id -> (brokerId <- Some broker_id) + | unexpected_msg -> + self#showDialog + (sprintf "Client NOT registered, unexpected message:\n%s" + (Hbugs_messages.string_of_msg unexpected_msg))) + + method unregisterFromBroker () = + self#sendReq ~wait:true ~msg:(Unregister_client myOwnId) + (function + | Client_unregistered _ -> (brokerId <- None) + | unexpected_msg -> ()) +(* + self#showDialog + (sprintf "Client NOT unregistered, unexpected message:\n%s" + (Hbugs_messages.string_of_msg unexpected_msg))) +*) + + method stateChange new_state = + mainWindow#hintsSmartCList#clear (); + hints <- []; + self#sendReq + ~msg:(State_change (myOwnId, new_state)) + (function + | State_accepted _ -> () + | unexpected_msg -> + self#showDialog + (sprintf "State NOT accepted by Hbugs, unexpected message:\n%s" + (Hbugs_messages.string_of_msg unexpected_msg))) + + method hint = List.nth hints + + method private listTutors () = + (* wait is set to true just to make sure that after invoking listTutors + "availableTutors" is correctly filled *) + self#sendReq ~wait:true ~msg:(List_tutors myOwnId) + (function + | Tutor_list (_, descriptions) -> + availableTutors <- (* sort accordingly to tutor description *) + List.sort (fun (a,b) (c,d) -> compare (b,a) (d,c)) descriptions; + subscribeWindow#tutorsSmartCList#clear (); + List.iter + (fun (id, dsc) -> + ignore (subscribeWindow#tutorsSmartCList#append id dsc)) + availableTutors + | unexpected_msg -> + self#showDialog + (sprintf "Can't list tutors, unexpected message:\n%s" + (Hbugs_messages.string_of_msg unexpected_msg))) + + (* low level used by subscribeSelected and subscribeAll *) + method private subscribe' tutors_id = + self#sendReq ~msg:(Subscribe (myOwnId, tutors_id)) + (function + | (Subscribed (_, subscribedTutors)) as msg -> + let sort = List.sort compare in + mainWindow#subscriptionSmartCList#clear (); + List.iter + (fun tutor_id -> + ignore + (mainWindow#subscriptionSmartCList#append + ( try + List.assoc tutor_id availableTutors + with Not_found -> assert false ))) + tutors_id; + subscribeWindow#subscribeWindow#misc#hide (); + if sort subscribedTutors <> sort tutors_id then + self#showDialog + (sprintf "Subscription mismatch\n: %s" + (Hbugs_messages.string_of_msg msg)) + | unexpected_msg -> + mainWindow#subscriptionSmartCList#clear (); + self#showDialog + (sprintf "Subscription FAILED, unexpected message:\n%s" + (Hbugs_messages.string_of_msg unexpected_msg))) + + method private subscribeSelected () = + let tutorsSmartCList = subscribeWindow#tutorsSmartCList in + let selectedTutors = + List.map + (fun p -> + tutorsSmartCList#model#get + ~row:(tutorsSmartCList#model#get_iter p) + ~column:tutorsSmartCList#column1) + tutorsSmartCList#selection#get_selected_rows + in + self#subscribe' selectedTutors + + method subscribeAll () = + self#listTutors (); (* this fills 'availableTutors' field *) + self#subscribe' (List.map fst availableTutors) + + method private quit () = + self#unregisterFromBroker (); + destroy_callback () + + (** enable/disable debugging *) + method private setDebug value = debug <- value + + method private reconfigDebuggingButtons = + List.iter (* debug value changed, reconfigure buttons *) + (fun (b: GObj.misc_ops) -> if debug then b#show () else b#hide ()) + self#debugButtons; + + method private toggleDebug () = + self#setDebug (not debug); + self#reconfigDebuggingButtons + + end +;; + diff --git a/components/hbugs/hbugs_client.mli b/components/hbugs/hbugs_client.mli new file mode 100644 index 000000000..0c2e93d80 --- /dev/null +++ b/components/hbugs/hbugs_client.mli @@ -0,0 +1,33 @@ + +open Hbugs_types + +exception Invalid_URL of string + + (* + @param use_hint_callback is called when the user double click on a hint + (default: do nothing) + @param describe_hint_callback is called when the user click on a hint + (default: do nothing) + *) +class hbugsClient : + ?use_hint_callback: (hint -> unit) -> + ?describe_hint_callback: (hint -> unit) -> + ?destroy_callback: (unit -> unit) -> + unit -> + object + + method show : unit -> unit + method hide : unit -> unit + + method setUseHintCallback : (hint -> unit) -> unit + method registerToBroker : unit -> unit + method unregisterFromBroker : unit -> unit + method subscribeAll : unit -> unit + + method stateChange : state option -> unit + + (** @return an hint by index *) + method hint : int -> hint + + end + diff --git a/components/hbugs/hbugs_client_gui.glade b/components/hbugs/hbugs_client_gui.glade new file mode 100644 index 000000000..f88a8c388 --- /dev/null +++ b/components/hbugs/hbugs_client_gui.glade @@ -0,0 +1,672 @@ + + + + + + + + Hbugs: your personal proof trainer! + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + + + + True + False + 0 + + + + + + + True + Tools + True + + + + True + + + + True + Debugging + True + False + + + + + + + + + 0 + False + False + + + + + + True + False + 2 + + + + True + My URL: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Local HTTP daemon URL + True + False + True + 0 + + True + * + False + + + 0 + True + True + + + + + + True + Start the local HTTP daemon listening on the specified URL + True + Start! + True + GTK_RELIEF_NORMAL + + + 0 + False + False + + + + + + True + True + Test! + True + GTK_RELIEF_NORMAL + + + 0 + False + False + + + + + 0 + False + False + + + + + + True + False + 0 + + + + True + False + 2 + + + + True + Broker: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + HBugs broker URL + True + False + True + 0 + + True + * + False + + + 0 + True + True + + + + + + True + True + Test! + True + GTK_RELIEF_NORMAL + + + 0 + False + False + + + + + 0 + False + False + + + + + + True + False + 2 + + + + Client ID: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + True + True + + + + + + True + True + (Re)Register + True + GTK_RELIEF_NORMAL + + + 0 + False + False + + + + + 0 + False + False + + + + + 0 + False + True + + + + + + True + 0 + + + + 4 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + False + 2 + + + + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + True + True + + + + + + True + + + + 0 + 0 + True + True + Subscribe ... + True + GTK_RELIEF_NORMAL + + + 0 + 0 + + + + + 0 + False + False + + + + + + + + True + Subscriptions + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + False + False + + + + + + 4 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + False + 0 + + + + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + True + True + + + + + + + + True + Hints + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + True + True + + + + + 0 + True + True + + + + + + True + + + 0 + False + False + + + + + + + + Hbugs: subscribe ... + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + + + + True + False + 0 + + + + True + True + Refresh + True + GTK_RELIEF_NORMAL + + + 0 + False + False + + + + + + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + True + True + + + + + + True + False + 0 + + + + True + True + Subscribe to Selected + True + GTK_RELIEF_NORMAL + + + 0 + True + True + + + + + + True + True + Subscribe to All + True + GTK_RELIEF_NORMAL + + + 0 + True + True + + + + + 0 + False + False + + + + + + True + True + + + 0 + False + False + + + + + + + + Message + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + 220 + 150 + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + OK + True + GTK_RELIEF_NORMAL + 0 + + + + + 0 + False + True + GTK_PACK_END + + + + + + 5 + True + 1 + 1 + False + 0 + 0 + + + + True + + False + False + GTK_JUSTIFY_CENTER + True + False + 0.5 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + + + + + 0 + True + True + + + + + + + diff --git a/components/hbugs/hbugs_common.ml b/components/hbugs/hbugs_common.ml new file mode 100644 index 000000000..fe2ecfcae --- /dev/null +++ b/components/hbugs/hbugs_common.ml @@ -0,0 +1,48 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Hbugs_types;; +open Printf;; + +let rec string_of_hint = function + | Use_ring -> "Use Ring, Luke!" + | Use_fourier -> "Use Fourier, Luke!" + | Use_reflexivity -> "Use reflexivity, Luke!" + | Use_symmetry -> "Use symmetry, Luke!" + | Use_assumption -> "Use assumption, Luke!" + | Use_contradiction -> "Use contradiction, Luke!" + | Use_exists -> "Use exists, Luke!" + | Use_split -> "Use split, Luke!" + | Use_left -> "Use left, Luke!" + | Use_right -> "Use right, Luke!" + | Use_apply term -> sprintf "Apply %s, Luke!" term + | Hints hints -> String.concat "; " (List.map string_of_hint hints) +;; + diff --git a/components/hbugs/hbugs_common.mli b/components/hbugs/hbugs_common.mli new file mode 100644 index 000000000..2d51075f3 --- /dev/null +++ b/components/hbugs/hbugs_common.mli @@ -0,0 +1,32 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Hbugs_types;; + +val string_of_hint: hint -> string + diff --git a/components/hbugs/hbugs_id_generator.ml b/components/hbugs/hbugs_id_generator.ml new file mode 100644 index 000000000..5b1998ac2 --- /dev/null +++ b/components/hbugs/hbugs_id_generator.ml @@ -0,0 +1,67 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let _ = Random.self_init () + +let id_length = 32 +let min_ascii = 33 +let max_ascii = 126 + (* characters forbidden inside an XML attribute value. Well, '>' and ''' + aren't really forbidden, but are listed here ... just to be sure *) +let forbidden_chars = (* i.e. [ '"'; '&'; '\''; '<'; '>' ] *) + [ 34; 38; 39; 60; 62 ] (* assumption: is sorted! *) +let chars_range = max_ascii - min_ascii + 1 - (List.length forbidden_chars) + + (* return a random id char c such that + (min_ascii <= Char.code c) && + (Char.code c <= max_ascii) && + (not (List.mem (Char.code c) forbidden_chars)) + *) +let random_id_char () = + let rec nth_char ascii shifts = function + | [] -> Char.chr (ascii + shifts) + | hd::tl when ascii + shifts < hd -> Char.chr (ascii + shifts) + | hd::tl (* when ascii + shifts >= hd *) -> nth_char ascii (shifts + 1) tl + in + nth_char (Random.int chars_range + min_ascii) 0 forbidden_chars + + (* return a random id string which have length id_length *) +let new_id () = + let str = String.create id_length in + for i = 0 to id_length - 1 do + String.set str i (random_id_char ()) + done; + str + +let new_broker_id = new_id +let new_client_id = new_id +let new_musing_id = new_id +let new_tutor_id = new_id + diff --git a/components/hbugs/hbugs_id_generator.mli b/components/hbugs/hbugs_id_generator.mli new file mode 100644 index 000000000..dad0c9391 --- /dev/null +++ b/components/hbugs/hbugs_id_generator.mli @@ -0,0 +1,35 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Hbugs_types;; + +val new_broker_id: unit -> broker_id +val new_client_id: unit -> client_id +val new_musing_id: unit -> musing_id +val new_tutor_id: unit -> tutor_id + diff --git a/components/hbugs/hbugs_messages.ml b/components/hbugs/hbugs_messages.ml new file mode 100644 index 000000000..4767b2aee --- /dev/null +++ b/components/hbugs/hbugs_messages.ml @@ -0,0 +1,368 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Hbugs_types;; +open Printf;; +open Pxp_document;; +open Pxp_dtd;; +open Pxp_types;; +open Pxp_yacc;; + +let debug = 2;; (* 0 -> no debug + 1 -> waiting for an answer / answer received + 2 -> XML messages dumping + *) + +exception Attribute_not_found of string;; +exception Empty_node;; (** found a node with no _element_ children *) +exception No_element_found of string;; +exception Parse_error of string * string;; (* parsing subject, reason *) +exception Unexpected_message of message;; + +let is_xml_element n = match n#node_type with T_element _ -> true | _ -> false +let get_attr node name = + try + (match node#attribute name with + | Value s -> s + | _ -> raise Not_found) + with Not_found -> raise (Attribute_not_found name) +let assert_element n name = + match n#node_type with + | T_element n when n = name -> + () + | _ -> raise (Parse_error ("", "Expected node: " ^ name)) + + (** given a string representation of a proof asistant state (e.g. the first + child of the XML root of a State_change or Start_musing message), build from + it an HBugs view of a proof assistant state *) +let parse_state (root: ('a node extension as 'a) node) = + if (List.filter is_xml_element root#sub_nodes) = [] then + raise Empty_node; + let buf = Buffer.create 10240 in + let node_to_string (node: ('a node extension as 'a) node) = + Buffer.clear buf; + node#write (`Out_buffer buf) `Enc_utf8; + let res = Buffer.contents buf in + Buffer.clear buf; + res + in + let (goal_node, type_node, body_node) = + try + (find_element "CurrentGoal" root, + find_element "ConstantType" root, + find_element "CurrentProof" root) + with Not_found -> + raise (Parse_error ("", "Malformed HBugs status XML document")) + in + assert_element root "gTopLevelStatus"; + assert_element goal_node "CurrentGoal"; + assert_element type_node "ConstantType"; + assert_element body_node "CurrentProof"; + goal_node#write (`Out_buffer buf) `Enc_utf8; + let (type_string, body_string) = + (node_to_string type_node, node_to_string body_node) + in + let goal = + try + int_of_string (goal_node#data) + with Failure "int_of_string" -> + raise (Parse_error (goal_node#data, "can't parse goal")) + in + (type_string, body_string, goal) + + (** parse an hint from an XML node, XML node should have type 'T_element _' + (the name is ignored), attributes on it are ignored *) +let parse_hint node = + let rec parse_hint_node node = + match node#node_type with + | T_element "ring" -> Use_ring + | T_element "fourier" -> Use_fourier + | T_element "reflexivity" -> Use_reflexivity + | T_element "symmetry" -> Use_symmetry + | T_element "assumption" -> Use_assumption + | T_element "contradiction" -> Use_contradiction + | T_element "exists" -> Use_exists + | T_element "split" -> Use_split + | T_element "left" -> Use_left + | T_element "right" -> Use_right + | T_element "apply" -> Use_apply node#data + | T_element "hints" -> + Hints + (List.map parse_hint_node (List.filter is_xml_element node#sub_nodes)) + | _ -> assert false (* CSC: should this assert false be a raise something? *) + in + match List.filter is_xml_element node#sub_nodes with + [node] -> parse_hint_node node + | _ -> assert false (* CSC: should this assert false be a raise something? *) + +let parse_hint_type n = n#data (* TODO parsare il possibile tipo di suggerimento *) +let parse_tutor_dscs n = + List.map + (fun n -> (get_attr n "id", n#data)) + (List.filter is_xml_element n#sub_nodes) +let parse_tutor_ids node = + List.map + (fun n -> get_attr n "id") (List.filter is_xml_element node#sub_nodes) + +let tutors_sep = Pcre.regexp ",\\s*" + +let pxp_config = PxpHelmConf.pxp_config +let msg_of_string' s = + let root = (* xml tree's root *) + parse_wfcontent_entity pxp_config (from_string s) PxpHelmConf.pxp_spec + in + match root#node_type with + + (* general purpose *) + | T_element "help" -> Help + | T_element "usage" -> Usage root#data + | T_element "exception" -> Exception (get_attr root "name", root#data) + + (* client -> broker *) + | T_element "register_client" -> + Register_client (get_attr root "id", get_attr root "url") + | T_element "unregister_client" -> Unregister_client (get_attr root "id") + | T_element "list_tutors" -> List_tutors (get_attr root "id") + | T_element "subscribe" -> + Subscribe (get_attr root "id", parse_tutor_ids root) + | T_element "state_change" -> + let state_node = + try + Some (find_element ~deeply:false "gTopLevelStatus" root) + with Not_found -> None + in + State_change + (get_attr root "id", + match state_node with + | Some n -> (try Some (parse_state n) with Empty_node -> None) + | None -> None) + | T_element "wow" -> Wow (get_attr root "id") + + (* tutor -> broker *) + | T_element "register_tutor" -> + let hint_node = find_element "hint_type" root in + let dsc_node = find_element "description" root in + Register_tutor + (get_attr root "id", get_attr root "url", + parse_hint_type hint_node, dsc_node#data) + | T_element "unregister_tutor" -> Unregister_tutor (get_attr root "id") + | T_element "musing_started" -> + Musing_started (get_attr root "id", get_attr root "musing_id") + | T_element "musing_aborted" -> + Musing_started (get_attr root "id", get_attr root "musing_id") + | T_element "musing_completed" -> + let main_node = + try + find_element "eureka" root + with Not_found -> find_element "sorry" root + in + Musing_completed + (get_attr root "id", get_attr root "musing_id", + (match main_node#node_type with + | T_element "eureka" -> + Eureka (parse_hint main_node) + | T_element "sorry" -> Sorry + | _ -> assert false)) (* can't be there, see 'find_element' above *) + + (* broker -> client *) + | T_element "client_registered" -> Client_registered (get_attr root "id") + | T_element "client_unregistered" -> Client_unregistered (get_attr root "id") + | T_element "tutor_list" -> + Tutor_list (get_attr root "id", parse_tutor_dscs root) + | T_element "subscribed" -> + Subscribed (get_attr root "id", parse_tutor_ids root) + | T_element "state_accepted" -> + State_accepted + (get_attr root "id", + List.map + (fun n -> get_attr n "id") + (List.filter is_xml_element (find_element "stopped" root)#sub_nodes), + List.map + (fun n -> get_attr n "id") + (List.filter is_xml_element (find_element "started" root)#sub_nodes)) + | T_element "hint" -> Hint (get_attr root "id", parse_hint root) + + (* broker -> tutor *) + | T_element "tutor_registered" -> Tutor_registered (get_attr root "id") + | T_element "tutor_unregistered" -> Tutor_unregistered (get_attr root "id") + | T_element "start_musing" -> + let state_node = + try + find_element ~deeply:false "gTopLevelStatus" root + with Not_found -> raise (No_element_found "gTopLevelStatus") + in + Start_musing (get_attr root "id", parse_state state_node) + | T_element "abort_musing" -> + Abort_musing (get_attr root "id", get_attr root "musing_id") + | T_element "thanks" -> Thanks (get_attr root "id", get_attr root "musing_id") + | T_element "too_late" -> + Too_late (get_attr root "id", get_attr root "musing_id") + + | _ -> raise (No_element_found s) + +let msg_of_string s = + try + msg_of_string' s + with e -> raise (Parse_error (s, Printexc.to_string e)) + +let pp_state = function + | Some (type_string, body_string, goal) -> + (* ASSUMPTION: type_string and body_string are well formed XML document + contents (i.e. they don't contain heading declaration nor + DOCTYPE one *) + "\n" ^ + (sprintf "%d\n" goal) ^ + type_string ^ "\n" ^ + body_string ^ "\n" ^ + "\n" + | None -> "\n" + +let rec pp_hint = function + | Use_ring -> sprintf "" + | Use_fourier -> sprintf "" + | Use_reflexivity -> sprintf "" + | Use_symmetry -> sprintf "" + | Use_assumption -> sprintf "" + | Use_contradiction -> sprintf "" + | Use_exists -> sprintf "" + | Use_split -> sprintf "" + | Use_left -> sprintf "" + | Use_right -> sprintf "" + | Use_apply term -> sprintf "%s" term + | Hints hints -> + sprintf "\n%s\n" + (String.concat "\n" (List.map pp_hint hints)) + +let pp_hint_type s = s (* TODO pretty print hint_type *) +let pp_tutor_dscs = + List.fold_left + (fun s (id, dsc) -> + sprintf "%s%s" s id dsc) + "" +let pp_tutor_ids = + List.fold_left (fun s id -> sprintf "%s" s id) "" + +let string_of_msg = function + | Help -> "" + | Usage usage_string -> sprintf "%s" usage_string + | Exception (name, value) -> + sprintf "%s" name value + | Register_client (id, url) -> + sprintf "" id url + | Unregister_client id -> sprintf "" id + | List_tutors id -> sprintf "" id + | Subscribe (id, tutor_ids) -> + sprintf "%s" + id (pp_tutor_ids tutor_ids) + | State_change (id, state) -> + sprintf "%s" + id (pp_state state) + | Wow id -> sprintf "" id + | Register_tutor (id, url, hint_type, dsc) -> + sprintf +" +%s +%s +" + id url (pp_hint_type hint_type) dsc + | Unregister_tutor id -> sprintf "" id + | Musing_started (id, musing_id) -> + sprintf "" id musing_id + | Musing_aborted (id, musing_id) -> + sprintf "" id musing_id + | Musing_completed (id, musing_id, result) -> + sprintf + "%s" + id musing_id + (match result with + | Sorry -> "" + | Eureka hint -> sprintf "%s" (pp_hint hint)) + | Client_registered id -> sprintf "" id + | Client_unregistered id -> sprintf "" id + | Tutor_list (id, tutor_dscs) -> + sprintf "%s" + id (pp_tutor_dscs tutor_dscs) + | Subscribed (id, tutor_ids) -> + sprintf "%s" + id (pp_tutor_ids tutor_ids) + | State_accepted (id, stop_ids, start_ids) -> + sprintf +" +%s +%s +" + id + (String.concat "" + (List.map (fun id -> sprintf "" id) stop_ids)) + (String.concat "" + (List.map (fun id -> sprintf "" id) start_ids)) + | Hint (id, hint) -> sprintf "%s" id (pp_hint hint) + | Tutor_registered id -> sprintf "" id + | Tutor_unregistered id -> sprintf "" id + | Start_musing (id, state) -> + sprintf "%s" + id (pp_state (Some state)) + | Abort_musing (id, musing_id) -> + sprintf "" id musing_id + | Thanks (id, musing_id) -> + sprintf "" id musing_id + | Too_late (id, musing_id) -> + sprintf "" id musing_id +;; + + (* debugging function that dump on stderr the sent messages *) +let dump_msg msg = + if debug >= 2 then + prerr_endline + (sprintf "\n%s\n" + (match msg with + | State_change _ -> "omissis ..." + | msg -> string_of_msg msg)) +;; + +let submit_req ~url msg = + dump_msg msg; + if debug >= 1 then (prerr_string "Waiting for an answer ... "; flush stderr); + let res = + msg_of_string (Hbugs_misc.http_post ~body:(string_of_msg msg) url) + in + if debug >= 1 then (prerr_string "answer received!\n"; flush stderr); + res +;; +let return_xml_msg body outchan = + Http_daemon.respond ~headers:["Content-Type", "text/xml"] ~body outchan +;; +let respond_msg msg outchan = + dump_msg msg; + return_xml_msg (string_of_msg msg) outchan +(* close_out outchan *) +;; +let respond_exc name value = respond_msg (Exception (name, value));; + diff --git a/components/hbugs/hbugs_messages.mli b/components/hbugs/hbugs_messages.mli new file mode 100644 index 000000000..642c0b0e2 --- /dev/null +++ b/components/hbugs/hbugs_messages.mli @@ -0,0 +1,49 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Hbugs_types;; + +exception Parse_error of string * string (* parsing subject, reason *) +exception Unexpected_message of message;; + +val msg_of_string: string -> message +val string_of_msg: message -> string + +val submit_req: url:string -> message -> message + (** close outchan afterwards *) +val respond_msg: message -> out_channel -> unit + (** close outchan afterwards *) + (* exception_name, exception_value, output_channel *) +val respond_exc: string -> string -> out_channel -> unit + +(* TODO the below functions are for debugging only and shouldn't be exposed *) +val parse_state: + ('a Pxp_document.node Pxp_document.extension as 'a) Pxp_document.node -> + (string * string * int) +val pp_state: (string * string * int) option -> string + diff --git a/components/hbugs/hbugs_misc.ml b/components/hbugs/hbugs_misc.ml new file mode 100644 index 000000000..32b8e8b46 --- /dev/null +++ b/components/hbugs/hbugs_misc.ml @@ -0,0 +1,122 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf;; + +let rec hashtbl_remove_all tbl key = + if Hashtbl.mem tbl key then begin + Hashtbl.remove tbl key; + hashtbl_remove_all tbl key + end else + () + + (** follows cut and paste from zack's Http_client_smart module *) + +exception Malformed_URL of string;; +exception Malformed_HTTP_response of string;; + +let bufsiz = 16384;; +let tcp_bufsiz = 4096;; + +let body_sep_RE = Pcre.regexp "\r\n\r\n";; +let http_scheme_RE = Pcre.regexp ~flags:[`CASELESS] "^http://";; +let url_RE = Pcre.regexp "^([\\w.]+)(:(\\d+))?(/.*)?$";; +let parse_url url = + try + let subs = + Pcre.extract ~rex:url_RE (Pcre.replace ~rex:http_scheme_RE url) + in + (subs.(1), + (if subs.(2) = "" then 80 else int_of_string subs.(3)), + (if subs.(4) = "" then "/" else subs.(4))) + with exc -> raise (Malformed_URL url) +;; +let get_body answer = + match Pcre.split ~rex:body_sep_RE answer with + | [_; body] -> body + | _ -> raise (Malformed_HTTP_response answer) +;; + +let init_socket addr port = + let inet_addr = (Unix.gethostbyname addr).Unix.h_addr_list.(0) in + let sockaddr = Unix.ADDR_INET (inet_addr, port) in + let suck = Unix.socket Unix.PF_INET Unix.SOCK_STREAM 0 in + Unix.connect suck sockaddr; + let outchan = Unix.out_channel_of_descr suck in + let inchan = Unix.in_channel_of_descr suck in + (inchan, outchan) +;; +let rec retrieve inchan buf = + Buffer.add_string buf (input_line inchan ^ "\n"); + retrieve inchan buf +;; + +let http_get_iter_buf ~callback url = + let (address, port, path) = parse_url url in + let buf = String.create tcp_bufsiz in + let (inchan, outchan) = init_socket address port in + output_string outchan (sprintf "GET %s\r\n" path); + flush outchan; + (try + while true do + match input inchan buf 0 tcp_bufsiz with + | 0 -> raise End_of_file + | bytes when bytes = tcp_bufsiz -> (* buffer full, no need to slice it *) + callback buf + | bytes when bytes < tcp_bufsiz -> (* buffer not full, slice it *) + callback (String.sub buf 0 bytes) + | _ -> (* ( bytes < 0 ) || ( bytes > tcp_bufsiz ) *) + assert false + done + with End_of_file -> ()); + close_in inchan (* close also outchan, same fd *) +;; + +let http_get url = + let buf = Buffer.create (tcp_bufsiz * 10) in + http_get_iter_buf (fun data -> Buffer.add_string buf data) url; + get_body (Buffer.contents buf) +;; + +let http_post ?(body = "") url = + let (address, port, path) = parse_url url in + let (inchan, outchan) = init_socket address port in + output_string outchan (sprintf "POST %s HTTP/1.0\r\n" path); + output_string outchan (sprintf "Content-Length: %d\r\n" (String.length body)); + output_string outchan "\r\n"; + output_string outchan body; + flush outchan; + let buf = Buffer.create bufsiz in + (try + retrieve inchan buf + with End_of_file -> close_in inchan); (* close also outchan, same fd *) + get_body (Buffer.contents buf) +;; + diff --git a/components/hbugs/hbugs_misc.mli b/components/hbugs/hbugs_misc.mli new file mode 100644 index 000000000..b0ef59719 --- /dev/null +++ b/components/hbugs/hbugs_misc.mli @@ -0,0 +1,50 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** helpers *) + + (** remove all bindings of a given key from an hash table *) +val hashtbl_remove_all: ('a, 'b) Hashtbl.t -> 'a -> unit + + (** follows cut and paste from zack's Http_client_smart module *) + + (** can't parse an HTTP url *) +exception Malformed_URL of string + (** can't parse an HTTP response *) +exception Malformed_HTTP_response of string + + (** HTTP GET request for a given url, return http response's body *) +val http_get: string -> string + (** HTTP POST request for a given url, return http response's body, + body argument, if specified, is sent as body along with request *) +val http_post: ?body:string -> string -> string + + (** perform an HTTP GET request and apply a given function on each + 'slice' of HTTP response read from server *) +val http_get_iter_buf: callback:(string -> unit) -> string -> unit + diff --git a/components/hbugs/hbugs_tutors.ml b/components/hbugs/hbugs_tutors.ml new file mode 100644 index 000000000..ca6250262 --- /dev/null +++ b/components/hbugs/hbugs_tutors.ml @@ -0,0 +1,266 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Hbugs_types;; +open Printf;; + +let broker_url = "localhost:49081/act";; +let dump_environment_on_exit = false;; + +let init_tutor = Hbugs_id_generator.new_tutor_id;; + + (** register a tutor to broker *) +let register_to_broker id url hint_type dsc = + try + let res = + Hbugs_messages.submit_req + ~url:broker_url (Register_tutor (id, url, hint_type, dsc)) + in + (match res with + | Tutor_registered id -> + prerr_endline (sprintf "Tutor registered, broker id: %s" id); + id + | unexpected_msg -> + raise (Hbugs_messages.Unexpected_message unexpected_msg)) + with e -> + failwith (sprintf "Can't register tutor to broker: uncaught exception: %s" + (Printexc.to_string e)) +;; + (** unregister a tutor from the broker *) +let unregister_from_broker id = + let res = Hbugs_messages.submit_req ~url:broker_url (Unregister_tutor id) in + match res with + | Tutor_unregistered _ -> prerr_endline "Tutor unregistered!" + | unexpected_msg -> + failwith + (sprintf "Can't unregister from broker, received unexpected msg: %s" + (Hbugs_messages.string_of_msg unexpected_msg)) +;; + + (* typecheck a loaded proof *) + (* TODO this is a cut and paste from gTopLevel.ml *) +let typecheck_loaded_proof metasenv bo ty = + let module T = CicTypeChecker in + ignore ( + List.fold_left + (fun metasenv ((_,context,ty) as conj) -> + ignore (T.type_of_aux' metasenv context ty) ; + metasenv @ [conj] + ) [] metasenv) ; + ignore (T.type_of_aux' metasenv [] ty) ; + ignore (T.type_of_aux' metasenv [] bo) +;; + +type xml_kind = Body | Type;; +let mk_dtdname ~ask_dtd_to_the_getter dtd = + if ask_dtd_to_the_getter then + Helm_registry.get "getter.url" ^ "getdtd?uri=" ^ dtd + else + "http://mowgli.cs.unibo.it/dtd/" ^ dtd +;; + (** this function must be the inverse function of GTopLevel.strip_xml_headings + *) +let add_xml_headings ~kind s = + let dtdname = mk_dtdname ~ask_dtd_to_the_getter:true "cic.dtd" in + let root = + match kind with + | Body -> "CurrentProof" + | Type -> "ConstantType" + in + "\n\n" ^ + "\n\n" ^ + s +;; + +let load_state (type_string, body_string, goal) = + prerr_endline "a0"; + let ((tmp1, oc1), (tmp2, oc2)) = + (Filename.open_temp_file "" "", Filename.open_temp_file "" "") + in + prerr_endline "a1"; + output_string oc1 (add_xml_headings ~kind:Type type_string); + output_string oc2 (add_xml_headings ~kind:Body body_string); + close_out oc1; close_out oc2; + prerr_endline (sprintf "Proof Type available in %s" tmp1); + prerr_endline (sprintf "Proof Body available in %s" tmp2); + let (proof, goal) = + prerr_endline "a2"; + (match CicParser.obj_of_xml tmp1 (Some tmp2) with + | Cic.CurrentProof (_,metasenv,bo,ty,attrs) -> (* TODO il primo argomento e' una URI valida o e' casuale? *) + prerr_endline "a3"; + let uri = UriManager.uri_of_string "cic:/foo.con" in + prerr_endline "a4"; + typecheck_loaded_proof metasenv bo ty; + prerr_endline "a5"; + ((uri, metasenv, bo, ty, attrs), goal) + | _ -> assert false) + in + prerr_endline "a6"; + Sys.remove tmp1; Sys.remove tmp2; + (proof, goal) + +(* tutors creation stuff from now on *) + +module type HbugsTutor = + sig + val start: unit -> unit + end + +module type HbugsTutorDescription = + sig + val addr: string + val port: int + val tactic: ProofEngineTypes.tactic + val hint: hint + val hint_type: hint_type + val description: string + val environment_file: string + end + +module BuildTutor (Dsc: HbugsTutorDescription) : HbugsTutor = + struct + let broker_id = ref None + let my_own_id = init_tutor () + let my_own_addr, my_own_port = Dsc.addr, Dsc.port + let my_own_url = sprintf "%s:%d" my_own_addr my_own_port + + let is_authenticated id = + match !broker_id with + | None -> false + | Some broker_id -> id = broker_id + + (* thread who do the dirty work *) + let slave (state, musing_id) = + prerr_endline (sprintf "Hi, I'm the slave for musing %s" musing_id); + let (proof, goal) = load_state state in + let success = + try + ignore (Dsc.tactic (proof, goal)); + true + with e -> false + in + let answer = + Musing_completed + (my_own_id, musing_id, (if success then Eureka Dsc.hint else Sorry)) + in + ignore (Hbugs_messages.submit_req ~url:broker_url answer); + prerr_endline + (sprintf "Bye, I've completed my duties (success = %b)" success) + + let hbugs_callback = + (* hashtbl mapping musings ids to PID of threads doing the related (dirty) + work *) + let slaves = Hashtbl.create 17 in + let forbidden () = + prerr_endline "ignoring request from unauthorized broker"; + Exception ("forbidden", "") + in + function (* _the_ callback *) + | Start_musing (broker_id, state) -> + if is_authenticated broker_id then begin + prerr_endline "received Start_musing"; + let new_musing_id = Hbugs_id_generator.new_musing_id () in + prerr_endline + (sprintf "starting a new musing (id = %s)" new_musing_id); +(* let slave_thread = Thread.create slave (state, new_musing_id) in *) + let slave_thread = + ExtThread.create slave (state, new_musing_id) + in + Hashtbl.add slaves new_musing_id slave_thread; + Musing_started (my_own_id, new_musing_id) + end else (* broker unauthorized *) + forbidden (); + | Abort_musing (broker_id, musing_id) -> + if is_authenticated broker_id then begin + (try (* kill thread responsible for "musing_id" *) + let slave_thread = Hashtbl.find slaves musing_id in + ExtThread.kill slave_thread; + Hashtbl.remove slaves musing_id + with + | ExtThread.Can_t_kill (_, reason) -> + prerr_endline (sprintf "Unable to kill slave: %s" reason) + | Not_found -> + prerr_endline (sprintf + "Can't find slave corresponding to musing %s, can't kill it" + musing_id)); + Musing_aborted (my_own_id, musing_id) + end else (* broker unauthorized *) + forbidden (); + | unexpected_msg -> + Exception ("unexpected_msg", + Hbugs_messages.string_of_msg unexpected_msg) + + let callback (req: Http_types.request) outchan = + try + let req_msg = Hbugs_messages.msg_of_string req#body in + let answer = hbugs_callback req_msg in + Http_daemon.respond ~body:(Hbugs_messages.string_of_msg answer) outchan + with Hbugs_messages.Parse_error (subj, reason) -> + Http_daemon.respond + ~body:(Hbugs_messages.string_of_msg + (Exception ("parse_error", reason))) + outchan + + let restore_environment () = + let ic = open_in Dsc.environment_file in + prerr_endline "Restoring environment ..."; + CicEnvironment.restore_from_channel + ~callback:(fun uri -> prerr_endline uri) ic; + prerr_endline "... done!"; + close_in ic + + let dump_environment () = + let oc = open_out Dsc.environment_file in + prerr_endline "Dumping environment ..."; + CicEnvironment.dump_to_channel + ~callback:(fun uri -> prerr_endline uri) oc; + prerr_endline "... done!"; + close_out oc + + let main () = + try + Sys.catch_break true; + at_exit (fun () -> + if dump_environment_on_exit then + dump_environment (); + unregister_from_broker my_own_id); + broker_id := + Some (register_to_broker + my_own_id my_own_url Dsc.hint_type Dsc.description); + if Sys.file_exists Dsc.environment_file then + restore_environment (); + Http_daemon.start' + ~addr:my_own_addr ~port:my_own_port ~mode:`Thread callback + with Sys.Break -> () (* exit nicely, invoking at_exit functions *) + + let start = main + + end + diff --git a/components/hbugs/hbugs_tutors.mli b/components/hbugs/hbugs_tutors.mli new file mode 100644 index 000000000..43cd99cce --- /dev/null +++ b/components/hbugs/hbugs_tutors.mli @@ -0,0 +1,60 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Hbugs_types;; + +val broker_url: string + +val register_to_broker: + tutor_id -> string -> hint_type -> string -> + broker_id +val unregister_from_broker: tutor_id -> unit + +val init_tutor: unit -> tutor_id +val load_state: + Hbugs_types.state -> + ProofEngineTypes.proof * ProofEngineTypes.goal + +module type HbugsTutor = + sig + val start: unit -> unit + end + +module type HbugsTutorDescription = + sig + val addr: string + val port: int + val tactic: ProofEngineTypes.tactic + val hint: hint + val hint_type: hint_type + val description: string + val environment_file: string + end + +module BuildTutor (Dsc: HbugsTutorDescription) : HbugsTutor + diff --git a/components/hbugs/hbugs_types.mli b/components/hbugs/hbugs_types.mli new file mode 100644 index 000000000..e3067f2e9 --- /dev/null +++ b/components/hbugs/hbugs_types.mli @@ -0,0 +1,104 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type broker_id = string +type client_id = string +type musing_id = string +type tutor_id = string +type tutor_dsc = tutor_id * string (* tutor id, tutor description *) + +type state = (* proof assitant's state: proof type, proof body, goal *) + string * string * int + +type hint = + (* tactics usage related hints *) + | Use_ring + | Use_fourier + | Use_reflexivity + | Use_symmetry + | Use_assumption + | Use_contradiction + | Use_exists + | Use_split + | Use_left + | Use_right + | Use_apply of string (* use apply tactic on embedded term *) + (* hints list *) + | Hints of hint list + +type hint_type = string (* TODO tipo di consiglio per l'utente *) + +type musing_result = + | Eureka of hint (* extra information, if any, parsed depending + on tutor's hint_type *) + | Sorry + + (* for each message, first component is an ID that identify the sender *) +type message = + + (* general purpose *) + | Help (* help request *) + | Usage of string (* help response *) (* usage string *) + | Exception of string * string (* name, value *) + + (* client -> broker *) + | Register_client of client_id * string (* client id, client url *) + | Unregister_client of client_id (* client id *) + | List_tutors of client_id (* client_id *) + | Subscribe of client_id * tutor_id list (* client id, tutor id list *) + | State_change of client_id * state option (* client_id, new state *) + | Wow of client_id (* client_id *) + + (* tutor -> broker *) + | Register_tutor of tutor_id * string * hint_type * string + (* tutor id, tutor url, hint type, + tutor description *) + | Unregister_tutor of tutor_id (* tutor id *) + | Musing_started of tutor_id * musing_id (* tutor id, musing id *) + | Musing_aborted of tutor_id * musing_id (* tutor id, musing id *) + | Musing_completed of tutor_id * musing_id * musing_result + (* tutor id, musing id, result *) + + (* broker -> client *) + | Client_registered of broker_id (* broker id *) + | Client_unregistered of broker_id (* broker id *) + | Tutor_list of broker_id * tutor_dsc list (* broker id, tutor list *) + | Subscribed of broker_id * tutor_id list (* broker id, tutor list *) + | State_accepted of broker_id * musing_id list * musing_id list + (* broker id, stopped musing ids, + started musing ids *) + | Hint of broker_id * hint (* broker id, hint *) + + (* broker -> tutor *) + | Tutor_registered of broker_id (* broker id *) + | Tutor_unregistered of broker_id (* broker id *) + | Start_musing of broker_id * state (* broker id, state *) + | Abort_musing of broker_id * musing_id (* broker id, musing id *) + | Thanks of broker_id * musing_id (* broker id, musing id *) + | Too_late of broker_id * musing_id (* broker id, musing id *) + diff --git a/components/hbugs/scripts/brokerctl.sh b/components/hbugs/scripts/brokerctl.sh new file mode 100755 index 000000000..3da998d6c --- /dev/null +++ b/components/hbugs/scripts/brokerctl.sh @@ -0,0 +1,15 @@ +#!/bin/sh +daemon="broker" +if [ "$1" = "--help" -o "$1" = "" ]; then + echo "ctl.sh { start | stop | --help }" + exit 0 +fi +if [ "$1" = "start" ]; then + echo -n "Starting HBugs broker ... " + ./$daemon &> run/$daemon.log & + echo "done!" +elif [ "$1" = "stop" ]; then + echo -n "Stopping HBugs broker ... " + killall -9 $daemon + echo "done!" +fi diff --git a/components/hbugs/scripts/build_tutors.ml b/components/hbugs/scripts/build_tutors.ml new file mode 100755 index 000000000..9b742d84d --- /dev/null +++ b/components/hbugs/scripts/build_tutors.ml @@ -0,0 +1,112 @@ +#!/usr/bin/ocamlrun /usr/bin/ocaml +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) +#use "topfind" +#require "pcre" +#require "pxp" +open Printf +open Pxp_document +open Pxp_dtd +open Pxp_types +open Pxp_yacc + +let index = "data/tutors_index.xml" +let template = "data/hbugs_tutor.TPL.ml" + + (* apply a set of regexp substitutions specified as a list of pairs + to a string *) +let rec apply_subst ~fill s = + match fill with + | [] -> s + | (pat, templ)::rest -> + apply_subst ~fill:rest (Pcre.replace ~pat ~templ s) + (* fill a ~template file with substitutions specified in ~fill (see + apply_subst) and save output to ~output *) +let fill_template ~template ~fill ~output = + printf "Creating %s ... " output; flush stdout; + let (ic, oc) = (open_in template, open_out output) in + let rec fill_template' () = + output_string oc ((apply_subst ~fill (input_line ic)) ^ "\n"); + fill_template' () + in + try + output_string oc (sprintf +"(* + THIS CODE IS GENERATED - DO NOT MODIFY! + + the source of this code is template \"%s\" + the template was filled with data read from \"%s\" +*)\n" + template index); + fill_template' () + with End_of_file -> + close_in ic; + close_out oc; + printf "done!\n"; flush stdout +let parse_xml fname = + parse_wfdocument_entity default_config (from_file fname) default_spec +let is_tutor node = + match node#node_type with T_element "tutor" -> true | _ -> false +let is_element node = + match node#node_type with T_element _ -> true | _ -> false +let main () = + (parse_xml index)#root#iter_nodes + (fun node -> + try + (match node with + | node when is_tutor node -> + (try (* skip hand-written tutors *) + ignore (find_element "no_auto" node); + raise Exit + with Not_found -> ()); + let output = + try + (match node#attribute "source" with + | Value s -> s + | _ -> assert false) + with Not_found -> assert false + in + let fill = + List.map (* create substitution list from index data *) + (fun node -> + let name = (* node name *) + (match node#node_type with + | T_element s -> s + | _ -> assert false) + in + let value = node#data in (* node value *) + (sprintf "@%s@" (String.uppercase name), (* pattern *) + value)) (* substitution *) + (List.filter is_element node#sub_nodes) + in + fill_template ~fill ~template ~output + | _ -> ()) + with Exit -> ()) + +let _ = main () + diff --git a/components/hbugs/scripts/ls_tutors.ml b/components/hbugs/scripts/ls_tutors.ml new file mode 100755 index 000000000..5fe796ca1 --- /dev/null +++ b/components/hbugs/scripts/ls_tutors.ml @@ -0,0 +1,68 @@ +#!/usr/bin/ocamlrun /usr/bin/ocaml +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* Usage: ls_tutors.ml # lists all tutors + * ls_tutors.ml -auto # lists only generated tutors + *) + +#use "topfind" +#require "pxp" +open Printf +open Pxp_document +open Pxp_dtd +open Pxp_types +open Pxp_yacc + +let index = "data/tutors_index.xml" +let auto_only = + try + (match Sys.argv.(1) with "-auto" -> true | _ -> false) + with Invalid_argument _ -> false +let parse_xml fname = + parse_wfdocument_entity default_config (from_file fname) default_spec +let is_tutor node = + match node#node_type with T_element "tutor" -> true | _ -> false +let main () = + List.iter + (fun tutor -> + try + (match tutor#attribute "source" with + | Value s -> + if not auto_only then + print_endline s + else (* we should print only generated tutors *) + (try + ignore (find_element "no_auto" tutor); + with Not_found -> + print_endline s) + | _ -> assert false) + with Not_found -> assert false) + (List.filter is_tutor (parse_xml index)#root#sub_nodes) +let _ = main () + diff --git a/components/hbugs/scripts/sabba.sh b/components/hbugs/scripts/sabba.sh new file mode 100755 index 000000000..2031e295f --- /dev/null +++ b/components/hbugs/scripts/sabba.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# Copyright (C) 2003: +# Stefano Zacchiroli +# for the HELM Team http://helm.cs.unibo.it/ +# +# This file is part of HELM, an Hypertextual, Electronic +# Library of Mathematics, developed at the Computer Science +# Department, University of Bologna, Italy. +# +# HELM is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# HELM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with HELM; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, +# MA 02111-1307, USA. +# +# For details, see the HELM World-Wide-Web page, +# http://helm.cs.unibo.it/ +if [ "$1" = "--help" -o "$1" = "" ]; then + echo "sabba.sh { start | stop | --help }" + exit 0 +fi + +./scripts/ls_tutors.ml | +while read line; do + tutor=`echo $line | sed 's/\.ml//'` + if [ "$1" = "stop" ]; then + echo -n "Stopping HBugs tutor $tutor ... " + killall -9 $tutor + echo "done!" + elif [ "$1" = "start" ]; then + echo -n "Starting HBugs tutor $tutor ... " + nice -n 19 ./$tutor &> run/$tutor.log & + echo "done!" + else + echo "Uh? Try --help" + exit 1 + fi +done diff --git a/components/hbugs/search_pattern_apply_tutor.ml b/components/hbugs/search_pattern_apply_tutor.ml new file mode 100644 index 000000000..79c94beed --- /dev/null +++ b/components/hbugs/search_pattern_apply_tutor.ml @@ -0,0 +1,147 @@ +(* $Id$ *) + +open Hbugs_types;; +open Printf;; + +exception Empty_must;; + +module MQI = MQueryInterpreter +module MQIC = MQIConn + +let broker_id = ref None +let my_own_id = Hbugs_tutors.init_tutor () +let my_own_addr, my_own_port = "127.0.0.1", 50011 +let my_own_url = sprintf "%s:%d" my_own_addr my_own_port +let environment_file = "search_pattern_apply.environment" +let dump_environment_on_exit = false + +let is_authenticated id = + match !broker_id with + | None -> false + | Some broker_id -> id = broker_id + + (* thread who do the dirty work *) +let slave mqi_handle (state, musing_id) = + try + prerr_endline (sprintf "Hi, I'm the slave for musing %s" musing_id); + let (proof, goal) = Hbugs_tutors.load_state state in + let hint = + try + let choose_must must only = (* euristic: use 2nd precision level + 1st is more precise but is more slow *) + match must with + | [] -> raise Empty_must + | _::hd::tl -> hd + | hd::tl -> hd + in + let uris = + TacticChaser.matchConclusion mqi_handle + ~output_html:prerr_endline ~choose_must () ~status:(proof, goal) + in + if uris = [] then + Sorry + else + Eureka (Hints (List.map (fun uri -> Use_apply uri) uris)) + with Empty_must -> Sorry + in + let answer = Musing_completed (my_own_id, musing_id, hint) in + ignore (Hbugs_messages.submit_req ~url:Hbugs_tutors.broker_url answer); + prerr_endline + (sprintf "Bye, I've completed my duties (success = %b)" (hint <> Sorry)) + with + (Pxp_types.At _) as e -> + let rec unbox_exception = + function + Pxp_types.At (_,e) -> unbox_exception e + | e -> e + in + prerr_endline ("Uncaught PXP exception: " ^ Pxp_types.string_of_exn e) ; + (* e could be the Thread.exit exception; otherwise we will release an *) + (* uncaught exception and the Pxp_types.At was already an uncaught *) + (* exception ==> no additional arm *) + raise (unbox_exception e) + +let hbugs_callback mqi_handle = + let ids = Hashtbl.create 17 in + let forbidden () = + prerr_endline "ignoring request from unauthorized broker"; + Exception ("forbidden", "") + in + function + | Start_musing (broker_id, state) -> + if is_authenticated broker_id then begin + prerr_endline "received Start_musing"; + let new_musing_id = Hbugs_id_generator.new_musing_id () in + let id = ExtThread.create (slave mqi_handle) (state, new_musing_id) in + prerr_endline (sprintf "starting a new musing (id = %s)" new_musing_id); + Hashtbl.add ids new_musing_id id; + (*ignore (Thread.create slave (state, new_musing_id));*) + Musing_started (my_own_id, new_musing_id) + end else (* broker unauthorized *) + forbidden (); + | Abort_musing (broker_id, musing_id) -> + prerr_endline "CSC: Abort_musing received" ; + if is_authenticated broker_id then begin + (* prerr_endline "Ignoring 'Abort_musing' message ..."; *) + (try + ExtThread.kill (Hashtbl.find ids musing_id) ; + Hashtbl.remove ids musing_id ; + with + Not_found + | ExtThread.Can_t_kill _ -> + prerr_endline ("Can not kill slave " ^ musing_id)) ; + Musing_aborted (my_own_id, musing_id) + end else (* broker unauthorized *) + forbidden (); + | unexpected_msg -> + Exception ("unexpected_msg", + Hbugs_messages.string_of_msg unexpected_msg) + +let callback mqi_handle (req: Http_types.request) outchan = + try + let req_msg = Hbugs_messages.msg_of_string req#body in + let answer = hbugs_callback mqi_handle req_msg in + Http_daemon.respond ~body:(Hbugs_messages.string_of_msg answer) outchan + with Hbugs_messages.Parse_error (subj, reason) -> + Http_daemon.respond + ~body:(Hbugs_messages.string_of_msg + (Exception ("parse_error", reason))) + outchan + +let restore_environment () = + let ic = open_in environment_file in + prerr_endline "Restoring environment ..."; + CicEnvironment.restore_from_channel + ~callback:(fun uri -> prerr_endline uri) ic; + prerr_endline "... done!"; + close_in ic + +let dump_environment () = + let oc = open_out environment_file in + prerr_endline "Dumping environment ..."; + CicEnvironment.dump_to_channel + ~callback:(fun uri -> prerr_endline uri) oc; + prerr_endline "... done!"; + close_out oc + +let main () = + try + Sys.catch_break true; + at_exit (fun () -> + if dump_environment_on_exit then + dump_environment (); + Hbugs_tutors.unregister_from_broker my_own_id); + broker_id := + Some (Hbugs_tutors.register_to_broker + my_own_id my_own_url "FOO" "Search_pattern_apply tutor"); + let mqi_handle = MQIC.init ~log:prerr_string () in + if Sys.file_exists environment_file then + restore_environment (); + Http_daemon.start' + ~addr:my_own_addr ~port:my_own_port ~mode:`Thread (callback mqi_handle); + MQIC.close mqi_handle + with Sys.Break -> () (* exit nicely, invoking at_exit functions *) +;; + +main () + diff --git a/components/hbugs/test/HBUGS_MESSAGES.xml b/components/hbugs/test/HBUGS_MESSAGES.xml new file mode 100644 index 000000000..cf15dde3d --- /dev/null +++ b/components/hbugs/test/HBUGS_MESSAGES.xml @@ -0,0 +1,144 @@ + + + + + + + usage string + + corpo dell'exc + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + descrizione del tutor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + description 1 + description 2 + + description N + + + + description 1 + description 2 + + description N + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + diff --git a/components/hbugs/test/Makefile b/components/hbugs/test/Makefile new file mode 100644 index 000000000..0b3debf74 --- /dev/null +++ b/components/hbugs/test/Makefile @@ -0,0 +1,5 @@ +all: test_serialization +test_serialization: test_serialization.ml + OCAMLPATH="../meta" ocamlfind ocamlc -linkpkg -package hbugs-common -o test_serialization test_serialization.ml +clean: + rm -f *.cm[io] test_serialization diff --git a/components/hbugs/test/test_serialization.ml b/components/hbugs/test/test_serialization.ml new file mode 100644 index 000000000..1afd74379 --- /dev/null +++ b/components/hbugs/test/test_serialization.ml @@ -0,0 +1,70 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Pxp_document;; +open Pxp_dtd;; +open Pxp_types;; +open Pxp_yacc;; + +open Printf;; + +let test_data = "HBUGS_MESSAGES.xml" ;; + +let test_message (n:('a Pxp_document.extension as 'b) Pxp_document.node as 'a) = + try + let msg_string = + let buf = Buffer.create 1000 in + n#write (`Out_buffer buf) `Enc_utf8; + Buffer.contents buf + in + let msg = Hbugs_messages.msg_of_string msg_string in + let pp = Hbugs_messages.string_of_msg msg in + let msg' = Hbugs_messages.msg_of_string pp in + if (msg <> msg') then + prerr_endline + (sprintf "Failure with msg %s" + (match n#node_type with T_element name -> name | _ -> assert false)) + with e -> + prerr_endline + (sprintf "Failure with msg %s: uncaught exception %s" + (match n#node_type with T_element name -> name | _ -> assert false) + (Printexc.to_string e)) +;; + +let is_xml_element n = + match n#node_type with T_element _ -> true | _ -> false +;; + +let root = + parse_wfcontent_entity default_config (from_file test_data) default_spec +in +printf "Testing all messages from %s ...\n" test_data; flush stdout; +List.iter test_message (List.filter is_xml_element root#sub_nodes); +printf "Done!\n" +;; + diff --git a/components/hgdome/.depend b/components/hgdome/.depend new file mode 100644 index 000000000..bf9c09af7 --- /dev/null +++ b/components/hgdome/.depend @@ -0,0 +1,4 @@ +domMisc.cmo: domMisc.cmi +domMisc.cmx: domMisc.cmi +xml2Gdome.cmo: xml2Gdome.cmi +xml2Gdome.cmx: xml2Gdome.cmi diff --git a/components/hgdome/.depend.opt b/components/hgdome/.depend.opt new file mode 100644 index 000000000..bf9c09af7 --- /dev/null +++ b/components/hgdome/.depend.opt @@ -0,0 +1,4 @@ +domMisc.cmo: domMisc.cmi +domMisc.cmx: domMisc.cmi +xml2Gdome.cmo: xml2Gdome.cmi +xml2Gdome.cmx: xml2Gdome.cmi diff --git a/components/hgdome/Makefile b/components/hgdome/Makefile new file mode 100644 index 000000000..9630da26a --- /dev/null +++ b/components/hgdome/Makefile @@ -0,0 +1,12 @@ +PACKAGE = hgdome + +# modules which have both a .ml and a .mli +INTERFACE_FILES = \ + domMisc.mli \ + xml2Gdome.mli \ + $(NULL) + +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/hgdome/domMisc.ml b/components/hgdome/domMisc.ml new file mode 100644 index 000000000..97a15b7f8 --- /dev/null +++ b/components/hgdome/domMisc.ml @@ -0,0 +1,43 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(******************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 06/01/2002 *) +(* *) +(* *) +(******************************************************************************) + +(* $Id$ *) + +let domImpl = Gdome.domImplementation () +let helm_ns = Gdome.domString "http://www.cs.unibo.it/helm" +let xlink_ns = Gdome.domString "http://www.w3.org/1999/xlink" +let mathml_ns = Gdome.domString "http://www.w3.org/1998/Math/MathML" +let boxml_ns = Gdome.domString "http://helm.cs.unibo.it/2003/BoxML" + diff --git a/components/hgdome/domMisc.mli b/components/hgdome/domMisc.mli new file mode 100644 index 000000000..25d642bc5 --- /dev/null +++ b/components/hgdome/domMisc.mli @@ -0,0 +1,42 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(******************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 15/01/2003 *) +(* *) +(* *) +(******************************************************************************) + +val domImpl : Gdome.domImplementation + +val helm_ns : Gdome.domString (** HELM namespace *) +val xlink_ns : Gdome.domString (** XLink namespace *) +val mathml_ns : Gdome.domString (** MathML namespace *) +val boxml_ns : Gdome.domString (** BoxML namespace *) + diff --git a/components/hgdome/xml2Gdome.ml b/components/hgdome/xml2Gdome.ml new file mode 100644 index 000000000..eb6a7641c --- /dev/null +++ b/components/hgdome/xml2Gdome.ml @@ -0,0 +1,135 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +let document_of_xml (domImplementation : Gdome.domImplementation) strm = + let module G = Gdome in + let module X = Xml in + let rec update_namespaces ((defaultns,bindings) as namespaces) = + function + [] -> namespaces + | (None,"xmlns",value)::tl -> + update_namespaces (Some (Gdome.domString value),bindings) tl + | (prefix,name,value)::tl when prefix = Some "xmlns" -> + update_namespaces (defaultns,(name,Gdome.domString value)::bindings) tl + | _::tl -> update_namespaces namespaces tl in + let rec namespace_of_prefix (defaultns,bindings) = + function + None -> None + | Some "xmlns" -> Some (Gdome.domString "xml-ns") + | Some p' -> + try + Some (List.assoc p' bindings) + with + Not_found -> + raise + (Failure ("The prefix " ^ p' ^ " is not bound to any namespace")) in + let get_qualified_name p n = + match p with + None -> Gdome.domString n + | Some p' -> Gdome.domString (p' ^ ":" ^ n) in + let root_prefix,root_name,root_attributes,root_content = + ignore (Stream.next strm) ; (* to skip the declaration *) + ignore (Stream.next strm) ; (* to skip the DOCTYPE declaration *) + match Stream.next strm with + X.Empty(p,n,l) -> p,n,l,[<>] + | X.NEmpty(p,n,l,c) -> p,n,l,c + | _ -> assert false + in + let namespaces = update_namespaces (None,[]) root_attributes in + let namespaceURI = namespace_of_prefix namespaces root_prefix in + let document = + domImplementation#createDocument ~namespaceURI + ~qualifiedName:(get_qualified_name root_prefix root_name) + ~doctype:None + in + let rec aux namespaces (node : Gdome.node) = + parser + [< 'X.Str a ; s >] -> + let textnode = document#createTextNode ~data:(Gdome.domString a) in + ignore (node#appendChild ~newChild:(textnode :> Gdome.node)) ; + aux namespaces node s + | [< 'X.Empty(p,n,l) ; s >] -> + let namespaces' = update_namespaces namespaces l in + let namespaceURI = namespace_of_prefix namespaces' p in + let element = + document#createElementNS ~namespaceURI + ~qualifiedName:(get_qualified_name p n) + in + List.iter + (function (p,n,v) -> + if p = None then + element#setAttribute ~name:(Gdome.domString n) + ~value:(Gdome.domString v) + else + let namespaceURI = namespace_of_prefix namespaces' p in + element#setAttributeNS + ~namespaceURI + ~qualifiedName:(get_qualified_name p n) + ~value:(Gdome.domString v) + ) l ; + ignore + (node#appendChild + ~newChild:(element : Gdome.element :> Gdome.node)) ; + aux namespaces node s + | [< 'X.NEmpty(p,n,l,c) ; s >] -> + let namespaces' = update_namespaces namespaces l in + let namespaceURI = namespace_of_prefix namespaces' p in + let element = + document#createElementNS ~namespaceURI + ~qualifiedName:(get_qualified_name p n) + in + List.iter + (function (p,n,v) -> + if p = None then + element#setAttribute ~name:(Gdome.domString n) + ~value:(Gdome.domString v) + else + let namespaceURI = namespace_of_prefix namespaces' p in + element#setAttributeNS ~namespaceURI + ~qualifiedName:(get_qualified_name p n) + ~value:(Gdome.domString v) + ) l ; + ignore (node#appendChild ~newChild:(element :> Gdome.node)) ; + aux namespaces' (element :> Gdome.node) c ; + aux namespaces node s + | [< >] -> () + in + let root = document#get_documentElement in + List.iter + (function (p,n,v) -> + if p = None then + root#setAttribute ~name:(Gdome.domString n) + ~value:(Gdome.domString v) + else + let namespaceURI = namespace_of_prefix namespaces p in + root#setAttributeNS ~namespaceURI + ~qualifiedName:(get_qualified_name p n) + ~value:(Gdome.domString v) + ) root_attributes ; + aux namespaces (root : Gdome.element :> Gdome.node) root_content ; + document +;; diff --git a/components/hgdome/xml2Gdome.mli b/components/hgdome/xml2Gdome.mli new file mode 100644 index 000000000..45d0e9532 --- /dev/null +++ b/components/hgdome/xml2Gdome.mli @@ -0,0 +1,27 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val document_of_xml : + Gdome.domImplementation -> Xml.token Stream.t -> Gdome.document diff --git a/components/hmysql/.depend b/components/hmysql/.depend new file mode 100644 index 000000000..16e6e9da7 --- /dev/null +++ b/components/hmysql/.depend @@ -0,0 +1,2 @@ +hSql.cmo: hSqlite3.cmo hMysql.cmo hSql.cmi +hSql.cmx: hSqlite3.cmx hMysql.cmx hSql.cmi diff --git a/components/hmysql/.depend.opt b/components/hmysql/.depend.opt new file mode 100644 index 000000000..602c901b8 --- /dev/null +++ b/components/hmysql/.depend.opt @@ -0,0 +1,2 @@ +hSql.cmo: hSqlite3.cmx hMysql.cmx hSql.cmi +hSql.cmx: hSqlite3.cmx hMysql.cmx hSql.cmi diff --git a/components/hmysql/Makefile b/components/hmysql/Makefile new file mode 100644 index 000000000..356e6e068 --- /dev/null +++ b/components/hmysql/Makefile @@ -0,0 +1,14 @@ +PACKAGE = hmysql +PREDICATES = + +INTERFACE_FILES = \ + hSql.mli +IMPLEMENTATION_FILES = \ + hSqlite3.ml \ + hMysql.ml \ + $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/hmysql/hMysql.ml b/components/hmysql/hMysql.ml new file mode 100644 index 000000000..b9ace8e83 --- /dev/null +++ b/components/hmysql/hMysql.ml @@ -0,0 +1,92 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +type dbd = Mysql.dbd option +type result = Mysql.result option +type error_code = + | OK + | Table_exists_error + | Dup_keyname + | No_such_table + | No_such_index + | Bad_table_error + | GENERIC_ERROR of string +exception Error of string + +let profiler = HExtlib.profile "mysql" + +let quick_connect ?host ?database ?port ?password ?user () = + profiler.HExtlib.profile + (fun () -> + Some (Mysql.quick_connect ?host ?database ?port ?password ?user ())) + () +;; + +let disconnect = function + | None -> () + | Some dbd -> profiler.HExtlib.profile Mysql.disconnect dbd + +let escape s = + profiler.HExtlib.profile Mysql.escape s + +let exec s dbd = + match dbd with + | None -> None + | Some dbd -> + try + Some (profiler.HExtlib.profile (Mysql.exec dbd) s) + with Mysql.Error s -> raise (Error s) + +let map res ~f = + match res with + | None -> [] + | Some res -> + let map f = Mysql.map res ~f in + profiler.HExtlib.profile map f + +let iter res ~f = + match res with + | None -> () + | Some res -> + let iter f = Mysql.iter res ~f in + profiler.HExtlib.profile iter f + +let errno = function + | None -> GENERIC_ERROR "Mysql.Connection_error" + | Some dbd -> + match Mysql.errno dbd with + | Mysql.No_such_table -> No_such_table + | Mysql.Table_exists_error -> Table_exists_error + | Mysql.Dup_keyname -> Dup_keyname + | Mysql.No_such_index -> No_such_index + | Mysql.Bad_table_error -> Bad_table_error + | _ -> GENERIC_ERROR "Mysql_generic_error" +;; + +let isMysql = true + +let escape_string_for_like = ("ESCAPE \"\\\\\"" : ('a,'b,'c,'a) format4);; diff --git a/components/hmysql/hSql.ml b/components/hmysql/hSql.ml new file mode 100644 index 000000000..329dd2205 --- /dev/null +++ b/components/hmysql/hSql.ml @@ -0,0 +1,175 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type error_code = + | OK + | Table_exists_error + | Dup_keyname + | No_such_table + | No_such_index + | Bad_table_error + | GENERIC_ERROR of string + +exception Error of string + +(* the exceptions raised are from the Mysql module *) + +type dbtype = User | Library | Legacy +type dbimplementation = Mysql of HMysql.dbd | Sqlite of HSqlite3.dbd | FakeMySql +type result = Mysql_rc of HMysql.result | Sqlite_rc of HSqlite3.result | Nothing + + (* host port dbname user password type *) +type dbspec = (string * int option * string * string * string option * dbtype) list +type dbd = (dbtype * dbimplementation) list + +let debug = false;; +let debug_print s = if debug then prerr_endline (Lazy.force s) else ();; + +let pp_dbtype = function + | User -> "User" + | Library -> "Library" + | Legacy -> "Legacy" +;; + +let mk_dbspec l = l;; + +let quick_connect dbspec = + HExtlib.filter_map + (fun (host, port, database, user, password, kind) -> + if Pcre.pmatch ~pat:"^file://" host then + Some (kind, (Sqlite (HSqlite3.quick_connect (kind = Library) + ~host:(Pcre.replace ~pat:"^file://" host) + ?port ~user ~database ?password ()))) + else if Pcre.pmatch ~pat:"^mysql://" host then + Some (kind, (Mysql (HMysql.quick_connect + ~host:(Pcre.replace ~pat:"^mysql://" host) + ?port ~user ~database ?password ()))) + else + None) + dbspec +;; + +let mk f1 f2 = function + | (Sqlite dbd) -> Sqlite_rc (f1 dbd) + | (Mysql dbd) -> Mysql_rc (f2 dbd) + | FakeMySql -> assert false +;; + +let mk_u f1 f2 = function + | (_, (Sqlite dbd)) -> f1 dbd + | (_, (Mysql dbd)) -> f2 dbd + | (_, FakeMySql) -> assert false +;; + +let wrap f x = + try f x with + | HMysql.Error s | HSqlite3.Error s -> raise (Error s) + | Not_found -> raise (Error "Not_found") +;; + +let disconnect dbd = + wrap (List.iter (mk_u HSqlite3.disconnect HMysql.disconnect)) dbd +;; + +let exec (dbtype : dbtype) (dbd : dbd) (query : string) = + try + debug_print (lazy ("EXEC: " ^ pp_dbtype dbtype ^ "|" ^ query)); + let dbd = List.assoc dbtype dbd in + wrap (mk (HSqlite3.exec query) (HMysql.exec query)) dbd + with Not_found -> + if dbtype = Legacy then Nothing else raise (Error "No ro or writable db") +;; + +let map result ~f = + match result with + | Mysql_rc rc -> HMysql.map rc ~f + | Sqlite_rc rc -> HSqlite3.map rc ~f + | Nothing -> [] +;; + +let iter result ~f = + match result with + | Mysql_rc rc -> HMysql.iter rc ~f + | Sqlite_rc rc -> HSqlite3.iter rc ~f + | Nothing -> () +;; + +let sqlite_err = function + | HSqlite3.OK -> OK + | HSqlite3.Table_exists_error -> Table_exists_error + | HSqlite3.Dup_keyname -> Dup_keyname + | HSqlite3.No_such_table -> No_such_table + | HSqlite3.No_such_index -> No_such_index + | HSqlite3.Bad_table_error -> Bad_table_error + | HSqlite3.GENERIC_ERROR s -> GENERIC_ERROR s +;; + +let mysql_err = function + | HMysql.OK -> OK + | HMysql.Table_exists_error -> Table_exists_error + | HMysql.Dup_keyname -> Dup_keyname + | HMysql.No_such_table -> No_such_table + | HMysql.No_such_index -> No_such_index + | HMysql.Bad_table_error -> Bad_table_error + | HMysql.GENERIC_ERROR s -> GENERIC_ERROR s +;; + +let errno dbtype dbd = + wrap + (fun d -> match List.assoc dbtype d with + | Mysql dbd -> mysql_err (HMysql.errno dbd) + | Sqlite dbd -> sqlite_err (HSqlite3.errno dbd) + | FakeMySql -> assert false) + dbd +;; + +let escape dbtype dbd s = + try + match List.assoc dbtype dbd with + | Mysql _ | FakeMySql -> wrap HMysql.escape s + | Sqlite _ -> wrap HSqlite3.escape s + with Not_found -> + if dbtype = Legacy then s else raise (Error "No ro or writable db") +;; + +let escape_string_for_like dbtype dbd = + try + match List.assoc dbtype dbd with + | Mysql _ | FakeMySql -> HMysql.escape_string_for_like + | Sqlite _ -> HSqlite3.escape_string_for_like + with Not_found -> + if dbtype = Legacy then ("ESCAPE \"\\\"" : ('a,'b,'c,'a) format4) + else raise (Error "No ro or writable db") +;; + +let isMysql dbtype dbd = + wrap + (fun d -> match List.assoc dbtype d with Mysql _ -> true | _ -> false) + dbd +;; + +let fake_db_for_mysql dbtype = + [dbtype, FakeMySql] +;; diff --git a/components/hmysql/hSql.mli b/components/hmysql/hSql.mli new file mode 100644 index 000000000..3c7de40cc --- /dev/null +++ b/components/hmysql/hSql.mli @@ -0,0 +1,70 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type dbd +type result +type error_code = + | OK + | Table_exists_error + | Dup_keyname + | No_such_table + | No_such_index + | Bad_table_error + | GENERIC_ERROR of string + +exception Error of string + +(* the exceptions raised are from the Mysql module *) + +type dbtype = User | Library | Legacy + + (* host port dbname user password type *) +type dbspec + +val mk_dbspec : + (string * int option * string * string * string option * dbtype) list -> + dbspec + +val quick_connect : dbspec -> dbd + +val disconnect : dbd -> unit + +val exec: dbtype -> dbd -> string -> result +val map : result -> f:(string option array -> 'a) -> 'a list +val iter : result -> f:(string option array -> unit) -> unit + + +val errno : dbtype -> dbd -> error_code +(* val status : dbd -> Mysql.status *) + +val escape: dbtype -> dbd -> string -> string + +val escape_string_for_like: dbtype -> dbd -> ('a,'b,'c,'a) format4 + +val isMysql : dbtype -> dbd -> bool + +(* this dbd can't do queries, used only in table_creator *) +val fake_db_for_mysql: dbtype -> dbd + diff --git a/components/hmysql/hSqlite3.ml b/components/hmysql/hSqlite3.ml new file mode 100644 index 000000000..b8687c5e9 --- /dev/null +++ b/components/hmysql/hSqlite3.ml @@ -0,0 +1,232 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id: hMysql.ml 5769 2006-01-08 18:00:22Z sacerdot $ *) + +(* +type result = Mysql.result option +*) + + +let debug = false +let debug_print = + if debug then prerr_endline else (fun _ ->()) +;; + +type result = Sqlite3.row list +type dbd = Sqlite3.db option + +type error_code = + | OK + | Table_exists_error + | Dup_keyname + | No_such_table + | No_such_index + | Bad_table_error + | GENERIC_ERROR of string + +exception Error of string + +let profiler = HExtlib.profile "Sqlite3" + +let quick_connect + is_library + ?(host = Helm_registry.get "matita.basedir") + ?(database = "sqlite") ?port ?password ?user () += + let username = Helm_registry.get "user.name" in + let host_mangled = Pcre.replace ~pat:"[/ .]" ~templ:"_" host in + let find_db _ = + let base = "matita.db." ^ username ^ "." ^ host_mangled ^ "." in + let root = "/dev/shm/" in + let files = HExtlib.find ~test:(Pcre.pmatch ~pat:(base^"[0-9]+")) root in + let rec aux = function + | [] -> + debug_print ("HSqlite3: no valid db files found in memory"); + let name = root ^ base ^ string_of_int (Unix.getpid ()) in + debug_print ("HSqlite3: memory db file name: "^name); + name, true + | x::tl -> + debug_print ("HSqlite3: found a .db in memory: " ^ x); + match Array.to_list (Pcre.extract ~pat:"\\.([0-9]+)$" x) with + | [] | _::_::_::_ -> assert false + | [_;p] when HExtlib.is_dir ("/proc/" ^ p) -> + debug_print ("HSqlite3: found valid db file: " ^ x); + x, false + | _ -> + HLog.warn ("HSqlite3: dead process db file found: " ^ x); + HLog.warn ("HSqlite3: removing: " ^ x); + ignore (Sys.command ("rm " ^ x)); + aux tl + in + aux files + in + let db_name = host ^ "/" ^ database in + let db_to_open = + if HExtlib.is_dir "/dev/shm/" && HExtlib.writable_dir "/dev/shm/" + && (not is_library) + then ( + let tmp_db_name, first_time = find_db () in + let cp_to_ram_cmd = "cp " ^ db_name ^ " " ^ tmp_db_name in + if first_time then + if HExtlib.is_regular db_name then ignore (Sys.command cp_to_ram_cmd) + else debug_print ("HSqlite3: no initial db: " ^ db_name) + else debug_print "HSqlite3: not copying the db, already in memory"; + let mv_to_disk_cmd _ = + if first_time then ignore (Sys.command ("mv "^tmp_db_name^" "^db_name)) + else debug_print "HSqlite3: not copying back the db" + in + at_exit mv_to_disk_cmd; + tmp_db_name) + else + db_name + in + let db = Sqlite3.db_open db_to_open in + (* attach the REGEX function *) + Sqlite3.create_fun2 db "REGEXP" + (fun s rex -> + try + match rex, s with + | Sqlite3.Data.TEXT rex, Sqlite3.Data.BLOB s + | Sqlite3.Data.TEXT rex, Sqlite3.Data.TEXT s -> + let r = Str.regexp rex in + if Str.string_match r s 0 then + Sqlite3.Data.INT 1L + else + Sqlite3.Data.INT 0L + | _ -> raise (Error "wrong types to 'REGEXP'") + with exn -> HLog.error (Printexc.to_string exn); raise exn); + Some db +;; + +let disconnect db = + match db with + | None -> () + | Some db -> + let b = Sqlite3.db_close db in + if b=false then debug_print "No Closed DataBase" +;; + +(* XXX hack, sqlite has a print "%q" that should be used, but is not bound *) +let escape s = + let s_escaped = Pcre.replace ~pat:"'" ~templ:"''" s in + (*let s_escaped = Pcre.replace ~pat:"([^'])'([^'])" ~templ:"$1''$2" s in*) + debug_print s; + debug_print s_escaped; + s_escaped +;; + +let string_of_rc = function + |Sqlite3.Rc.OK -> "Sqlite3.Rc.OK" + |Sqlite3.Rc.ERROR -> "Sqlite3.Rc.ERROR" + |Sqlite3.Rc.INTERNAL -> "Sqlite3.Rc.INTERNAL" + |Sqlite3.Rc.PERM -> "Sqlite3.Rc.PERM" + |Sqlite3.Rc.ABORT -> "Sqlite3.Rc.ABORT" + |Sqlite3.Rc.BUSY -> "Sqlite3.Rc.BUSY" + |Sqlite3.Rc.LOCKED -> "Sqlite3.Rc.LOCKED" + |Sqlite3.Rc.NOMEM -> "Sqlite3.Rc.NOMEM" + |Sqlite3.Rc.READONLY -> "Sqlite3.Rc.READONLY" + |Sqlite3.Rc.INTERRUPT -> "Sqlite3.Rc.INTERRUPT" + |Sqlite3.Rc.IOERR -> "Sqlite3.Rc.IOERR" + |Sqlite3.Rc.CORRUPT -> "Sqlite3.Rc.CORRUPT" + |Sqlite3.Rc.NOTFOUND -> "Sqlite3.Rc.NOTFOUND" + |Sqlite3.Rc.FULL -> "Sqlite3.Rc.FULL" + |Sqlite3.Rc.CANTOPEN -> "Sqlite3.Rc.CANTOPEN" + |Sqlite3.Rc.PROTOCOL -> "Sqlite3.Rc.PROTOCOL" + |Sqlite3.Rc.EMPTY -> "Sqlite3.Rc.EMPTY" + |Sqlite3.Rc.SCHEMA -> "Sqlite3.Rc.SCHEMA" + |Sqlite3.Rc.TOOBIG -> "Sqlite3.Rc.TOOBIG" + |Sqlite3.Rc.CONSTRAINT -> "Sqlite3.Rc.CONSTRAINT" + |Sqlite3.Rc.MISMATCH -> "Sqlite3.Rc.MISMATCH" + |Sqlite3.Rc.MISUSE -> "Sqlite3.Rc.MISUSE" + |Sqlite3.Rc.NOFLS -> "Sqlite3.Rc.NOFLS" + |Sqlite3.Rc.AUTH -> "Sqlite3.Rc.AUTH" + |Sqlite3.Rc.FORMAT -> "Sqlite3.Rc.FORMAT" + |Sqlite3.Rc.RANGE -> "Sqlite3.Rc.RANGE" + |Sqlite3.Rc.NOTADB -> "Sqlite3.Rc.NOTADB" + |Sqlite3.Rc.ROW -> "Sqlite3.Rc.ROW" + |Sqlite3.Rc.DONE -> "Sqlite3.Rc.DONE" + |Sqlite3.Rc.UNKNOWN n -> + "Sqlite3.Rc.UNKNOWN " ^ string_of_int (Sqlite3.Rc.int_of_unknown n) +;; + +let pp_rc rc = debug_print (string_of_rc rc);; + +let exec s db = + debug_print s; + let stored_result = ref [] in + let store row = + stored_result := row :: !stored_result + in + match db with + | None -> [] + | Some db -> + let rc = + profiler.HExtlib.profile (Sqlite3.exec_no_headers db ~cb:store) s + in + match rc with + | Sqlite3.Rc.OK -> !stored_result + | _ -> raise (Error (string_of_rc rc ^ ": " ^ Sqlite3.errmsg db )) +;; + +let rec map res ~f = + let map f = List.map f res in + profiler.HExtlib.profile map f +;; + +let iter res ~f = + let iter f = List.iter f res in + profiler.HExtlib.profile iter f +;; + +let errno = function + | None -> OK + | Some db -> + match Sqlite3.errcode db with + |Sqlite3.Rc.OK -> OK + |Sqlite3.Rc.ERROR -> + let errmsg = (Sqlite3.errmsg db) in + if Pcre.pmatch errmsg ~pat:"^table .* already exists" then + Table_exists_error + else + if Pcre.pmatch errmsg ~pat:"^index .* already exists" then Dup_keyname + else if Pcre.pmatch errmsg ~pat:"^no such table: .*" then No_such_table + else if Pcre.pmatch errmsg ~pat:"^no such index: .*" then No_such_index + else GENERIC_ERROR errmsg + |Sqlite3.Rc.INTERNAL |Sqlite3.Rc.PERM |Sqlite3.Rc.ABORT + |Sqlite3.Rc.BUSY |Sqlite3.Rc.LOCKED |Sqlite3.Rc.NOMEM + |Sqlite3.Rc.READONLY |Sqlite3.Rc.INTERRUPT |Sqlite3.Rc.IOERR + |Sqlite3.Rc.CORRUPT |Sqlite3.Rc.NOTFOUND |Sqlite3.Rc.FULL + |Sqlite3.Rc.CANTOPEN |Sqlite3.Rc.PROTOCOL |Sqlite3.Rc.EMPTY + |Sqlite3.Rc.SCHEMA |Sqlite3.Rc.TOOBIG |Sqlite3.Rc.CONSTRAINT + |Sqlite3.Rc.MISMATCH |Sqlite3.Rc.MISUSE |Sqlite3.Rc.NOFLS + |Sqlite3.Rc.AUTH |Sqlite3.Rc.FORMAT |Sqlite3.Rc.RANGE + |Sqlite3.Rc.NOTADB |Sqlite3.Rc.ROW |Sqlite3.Rc.DONE + |Sqlite3.Rc.UNKNOWN _ -> GENERIC_ERROR "Sqlite3_generic_error" +;; + +let isMysql = false + +let escape_string_for_like = ("ESCAPE \"\\\"" : ('a,'b,'c,'a) format4);; diff --git a/components/lexicon/.depend b/components/lexicon/.depend new file mode 100644 index 000000000..452167c72 --- /dev/null +++ b/components/lexicon/.depend @@ -0,0 +1,20 @@ +lexiconAstPp.cmi: lexiconAst.cmo +disambiguatePp.cmi: lexiconAst.cmo +lexiconMarshal.cmi: lexiconAst.cmo +cicNotation.cmi: lexiconAst.cmo +lexiconEngine.cmi: lexiconMarshal.cmi lexiconAst.cmo cicNotation.cmi +lexiconSync.cmi: lexiconEngine.cmi +lexiconAstPp.cmo: lexiconAst.cmo lexiconAstPp.cmi +lexiconAstPp.cmx: lexiconAst.cmx lexiconAstPp.cmi +disambiguatePp.cmo: lexiconAstPp.cmi lexiconAst.cmo disambiguatePp.cmi +disambiguatePp.cmx: lexiconAstPp.cmx lexiconAst.cmx disambiguatePp.cmi +lexiconMarshal.cmo: lexiconAstPp.cmi lexiconAst.cmo lexiconMarshal.cmi +lexiconMarshal.cmx: lexiconAstPp.cmx lexiconAst.cmx lexiconMarshal.cmi +cicNotation.cmo: lexiconAst.cmo cicNotation.cmi +cicNotation.cmx: lexiconAst.cmx cicNotation.cmi +lexiconEngine.cmo: lexiconMarshal.cmi lexiconAst.cmo disambiguatePp.cmi \ + cicNotation.cmi lexiconEngine.cmi +lexiconEngine.cmx: lexiconMarshal.cmx lexiconAst.cmx disambiguatePp.cmx \ + cicNotation.cmx lexiconEngine.cmi +lexiconSync.cmo: lexiconEngine.cmi cicNotation.cmi lexiconSync.cmi +lexiconSync.cmx: lexiconEngine.cmx cicNotation.cmx lexiconSync.cmi diff --git a/components/lexicon/.depend.opt b/components/lexicon/.depend.opt new file mode 100644 index 000000000..7fec1d3b5 --- /dev/null +++ b/components/lexicon/.depend.opt @@ -0,0 +1,20 @@ +lexiconAstPp.cmi: lexiconAst.cmx +disambiguatePp.cmi: lexiconAst.cmx +lexiconMarshal.cmi: lexiconAst.cmx +cicNotation.cmi: lexiconAst.cmx +lexiconEngine.cmi: lexiconMarshal.cmi lexiconAst.cmx cicNotation.cmi +lexiconSync.cmi: lexiconEngine.cmi +lexiconAstPp.cmo: lexiconAst.cmx lexiconAstPp.cmi +lexiconAstPp.cmx: lexiconAst.cmx lexiconAstPp.cmi +disambiguatePp.cmo: lexiconAstPp.cmi lexiconAst.cmx disambiguatePp.cmi +disambiguatePp.cmx: lexiconAstPp.cmx lexiconAst.cmx disambiguatePp.cmi +lexiconMarshal.cmo: lexiconAstPp.cmi lexiconAst.cmx lexiconMarshal.cmi +lexiconMarshal.cmx: lexiconAstPp.cmx lexiconAst.cmx lexiconMarshal.cmi +cicNotation.cmo: lexiconAst.cmx cicNotation.cmi +cicNotation.cmx: lexiconAst.cmx cicNotation.cmi +lexiconEngine.cmo: lexiconMarshal.cmi lexiconAst.cmx disambiguatePp.cmi \ + cicNotation.cmi lexiconEngine.cmi +lexiconEngine.cmx: lexiconMarshal.cmx lexiconAst.cmx disambiguatePp.cmx \ + cicNotation.cmx lexiconEngine.cmi +lexiconSync.cmo: lexiconEngine.cmi cicNotation.cmi lexiconSync.cmi +lexiconSync.cmx: lexiconEngine.cmx cicNotation.cmx lexiconSync.cmi diff --git a/components/lexicon/Makefile b/components/lexicon/Makefile new file mode 100644 index 000000000..b8582baca --- /dev/null +++ b/components/lexicon/Makefile @@ -0,0 +1,18 @@ +PACKAGE = lexicon +PREDICATES = + +INTERFACE_FILES = \ + lexiconAstPp.mli \ + disambiguatePp.mli \ + lexiconMarshal.mli \ + cicNotation.mli \ + lexiconEngine.mli \ + lexiconSync.mli \ + $(NULL) +IMPLEMENTATION_FILES = \ + lexiconAst.ml \ + $(INTERFACE_FILES:%.mli=%.ml) + + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/lexicon/cicNotation.ml b/components/lexicon/cicNotation.ml new file mode 100644 index 000000000..d514c0273 --- /dev/null +++ b/components/lexicon/cicNotation.ml @@ -0,0 +1,98 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open LexiconAst + +type notation_id = + | RuleId of CicNotationParser.rule_id + | InterpretationId of TermAcicContent.interpretation_id + | PrettyPrinterId of TermContentPres.pretty_printer_id + +let parser_ref_counter = RefCounter.create () +let rule_ids_to_items = Hashtbl.create 113 + +let process_notation st = + match st with + | Notation (loc, dir, l1, associativity, precedence, l2) -> + let item = (l1, precedence, associativity, l2) in + let rule_id = ref [] in + let _ = + if dir <> Some `RightToLeft then + let create_cb (l1, precedence, associativity, l2) = + let id = + CicNotationParser.extend l1 ?precedence ?associativity + (fun env loc -> + CicNotationPt.AttributedTerm + (`Loc loc,TermContentPres.instantiate_level2 env l2)) in + rule_id := [ RuleId id ]; + Hashtbl.add rule_ids_to_items id item + in + RefCounter.incr ~create_cb parser_ref_counter item + in + let pp_id = + if dir <> Some `LeftToRight then + [ PrettyPrinterId + (TermContentPres.add_pretty_printer ?precedence ?associativity + l2 l1) ] + else + [] + in + !rule_id @ pp_id + | Interpretation (loc, dsc, l2, l3) -> + let interp_id = TermAcicContent.add_interpretation dsc l2 l3 in + [InterpretationId interp_id] + | st -> [] + +let remove_notation = function + | RuleId id -> + let item = + try + Hashtbl.find rule_ids_to_items id + with Not_found -> assert false in + RefCounter.decr ~delete_cb:(fun _ -> CicNotationParser.delete id) + parser_ref_counter item + | PrettyPrinterId id -> TermContentPres.remove_pretty_printer id + | InterpretationId id -> TermAcicContent.remove_interpretation id + +let get_all_notations () = + List.map + (fun (interp_id, dsc) -> + InterpretationId interp_id, "interpretation: " ^ dsc) + (TermAcicContent.get_all_interpretations ()) + +let get_active_notations () = + List.map (fun id -> InterpretationId id) + (TermAcicContent.get_active_interpretations ()) + +let set_active_notations ids = + let interp_ids = + HExtlib.filter_map + (function InterpretationId interp_id -> Some interp_id | _ -> None) + ids + in + TermAcicContent.set_active_interpretations interp_ids + diff --git a/components/lexicon/cicNotation.mli b/components/lexicon/cicNotation.mli new file mode 100644 index 000000000..944438df8 --- /dev/null +++ b/components/lexicon/cicNotation.mli @@ -0,0 +1,40 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type notation_id + +val process_notation: LexiconAst.command -> notation_id list + +val remove_notation: notation_id -> unit + +(** {2 Notation enabling/disabling} + * Right now, only disabling of notation during pretty printing is supporting. + * If it is useful to disable it also for the input phase is still to be + * understood ... *) + +val get_all_notations: unit -> (notation_id * string) list (* id, dsc *) +val get_active_notations: unit -> notation_id list +val set_active_notations: notation_id list -> unit + diff --git a/components/lexicon/disambiguatePp.ml b/components/lexicon/disambiguatePp.ml new file mode 100644 index 000000000..5f6512477 --- /dev/null +++ b/components/lexicon/disambiguatePp.ml @@ -0,0 +1,53 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open DisambiguateTypes + +let alias_of_domain_and_codomain_items domain_item (dsc,_) = + match domain_item with + Id id -> LexiconAst.Ident_alias (id, dsc) + | Symbol (symb, i) -> LexiconAst.Symbol_alias (symb, i, dsc) + | Num i -> LexiconAst.Number_alias (i, dsc) + +let aliases_of_environment env = + Environment.fold + (fun domain_item codomain_item acc -> + alias_of_domain_and_codomain_items domain_item codomain_item::acc + ) env [] + +let aliases_of_domain_and_codomain_items_list l = + List.fold_left + (fun acc (domain_item,codomain_item) -> + alias_of_domain_and_codomain_items domain_item codomain_item::acc + ) [] l + +let pp_environment env = + let aliases = aliases_of_environment env in + let strings = + List.map (fun alias -> LexiconAstPp.pp_alias alias ^ ".") aliases + in + String.concat "\n" (List.sort compare strings) diff --git a/components/lexicon/disambiguatePp.mli b/components/lexicon/disambiguatePp.mli new file mode 100644 index 000000000..e8d9b94a4 --- /dev/null +++ b/components/lexicon/disambiguatePp.mli @@ -0,0 +1,30 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val aliases_of_domain_and_codomain_items_list: + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list -> + LexiconAst.alias_spec list + +val pp_environment: DisambiguateTypes.environment -> string diff --git a/components/lexicon/lexiconAst.ml b/components/lexicon/lexiconAst.ml new file mode 100644 index 000000000..5a09d590a --- /dev/null +++ b/components/lexicon/lexiconAst.ml @@ -0,0 +1,57 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type direction = [ `LeftToRight | `RightToLeft ] + +type loc = Stdpp.location + +type alias_spec = + | Ident_alias of string * string (* identifier, uri *) + | Symbol_alias of string * int * string (* name, instance no, description *) + | Number_alias of int * string (* instance no, description *) + +(** To be increased each time the command type below changes, used for "safe" + * marshalling *) +let magic = 6 + +type inclusion_mode = WithPreferences | WithoutPreferences (* aka aliases *) + +type command = + | Include of loc * string * inclusion_mode * string (* _,buri,_,path *) + | Alias of loc * alias_spec + (** parameters, name, type, fields *) + | Notation of loc * direction option * CicNotationPt.term * Gramext.g_assoc * + int * CicNotationPt.term + (* direction, l1 pattern, associativity, precedence, l2 pattern *) + | Interpretation of loc * + string * (string * CicNotationPt.argument_pattern list) * + CicNotationPt.cic_appl_pattern + (* description (i.e. id), symbol, arg pattern, appl pattern *) + +(* composed magic: term + command magics. No need to change this value *) +let magic = magic + 10000 * CicNotationPt.magic + diff --git a/components/lexicon/lexiconAstPp.ml b/components/lexicon/lexiconAstPp.ml new file mode 100644 index 000000000..ad317bec7 --- /dev/null +++ b/components/lexicon/lexiconAstPp.ml @@ -0,0 +1,90 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open LexiconAst + +let pp_l1_pattern = CicNotationPp.pp_term +let pp_l2_pattern = CicNotationPp.pp_term + +let pp_alias = function + | Ident_alias (id, uri) -> sprintf "alias id \"%s\" = \"%s\"" id uri + | Symbol_alias (symb, instance, desc) -> + sprintf "alias symbol \"%s\" %s= \"%s\"" + symb + (if instance=0 then "" else "(instance "^ string_of_int instance ^ ") ") + desc + | Number_alias (instance,desc) -> + sprintf "alias num (instance %d) = \"%s\"" instance desc + +let pp_associativity = function + | Gramext.LeftA -> "left associative" + | Gramext.RightA -> "right associative" + | Gramext.NonA -> "non associative" + +let pp_precedence i = sprintf "with precedence %d" i + +let pp_argument_pattern = function + | CicNotationPt.IdentArg (eta_depth, name) -> + let eta_buf = Buffer.create 5 in + for i = 1 to eta_depth do + Buffer.add_string eta_buf "\\eta." + done; + sprintf "%s%s" (Buffer.contents eta_buf) name + +let pp_interpretation dsc symbol arg_patterns cic_appl_pattern = + sprintf "interpretation \"%s\" '%s %s = %s" + dsc symbol + (String.concat " " (List.map pp_argument_pattern arg_patterns)) + (CicNotationPp.pp_cic_appl_pattern cic_appl_pattern) + +let pp_dir_opt = function + | None -> "" + | Some `LeftToRight -> "> " + | Some `RightToLeft -> "< " + +let pp_notation dir_opt l1_pattern assoc prec l2_pattern = + sprintf "notation %s\"%s\" %s %s for %s" + (pp_dir_opt dir_opt) + (pp_l1_pattern l1_pattern) + (pp_associativity assoc) + (pp_precedence prec) + (pp_l2_pattern l2_pattern) + +let pp_command = function + | Include (_,_,mode,path) -> (* not precise, since path is absolute *) + if mode = WithPreferences then + "include \"" ^ path ^ "\".\n" + else + "include' \"" ^ path ^ "\".\n" + | Alias (_,s) -> pp_alias s + | Interpretation (_, dsc, (symbol, arg_patterns), cic_appl_pattern) -> + pp_interpretation dsc symbol arg_patterns cic_appl_pattern + | Notation (_, dir_opt, l1_pattern, assoc, prec, l2_pattern) -> + pp_notation dir_opt l1_pattern assoc prec l2_pattern + diff --git a/components/lexicon/lexiconAstPp.mli b/components/lexicon/lexiconAstPp.mli new file mode 100644 index 000000000..b7ad59f3c --- /dev/null +++ b/components/lexicon/lexiconAstPp.mli @@ -0,0 +1,29 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val pp_command: LexiconAst.command -> string + +val pp_alias: LexiconAst.alias_spec -> string + diff --git a/components/lexicon/lexiconEngine.ml b/components/lexicon/lexiconEngine.ml new file mode 100644 index 000000000..1966251ad --- /dev/null +++ b/components/lexicon/lexiconEngine.ml @@ -0,0 +1,140 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let out = ref ignore + +let set_callback f = out := f + +(* lexicon file name * ma file name *) +exception IncludedFileNotCompiled of string * string +exception MetadataNotFound of string (* file name *) + +type status = { + aliases: DisambiguateTypes.environment; (** disambiguation aliases *) + multi_aliases: DisambiguateTypes.multiple_environment; + lexicon_content_rev: LexiconMarshal.lexicon; + notation_ids: CicNotation.notation_id list; (** in-scope notation ids *) +} + +let initial_status = { + aliases = DisambiguateTypes.Environment.empty; + multi_aliases = DisambiguateTypes.Environment.empty; + lexicon_content_rev = []; + notation_ids = []; +} + +let add_lexicon_content cmds status = + let content = status.lexicon_content_rev in + let content' = + List.fold_right + (fun cmd acc -> cmd :: (List.filter ((<>) cmd) acc)) + cmds content + in +(* prerr_endline ("new lexicon content: " ^ String.concat " " (List.map + LexiconAstPp.pp_command content')); *) + { status with lexicon_content_rev = content' } + +let set_proof_aliases mode status new_aliases = + if mode = LexiconAst.WithoutPreferences then + status + else + let commands_of_aliases = + List.map + (fun alias -> LexiconAst.Alias (HExtlib.dummy_floc, alias)) + in + let aliases = + List.fold_left (fun acc (d,c) -> DisambiguateTypes.Environment.add d c acc) + status.aliases new_aliases in + let multi_aliases = + List.fold_left (fun acc (d,c) -> DisambiguateTypes.Environment.cons d c acc) + status.multi_aliases new_aliases in + let new_status = + { status with multi_aliases = multi_aliases ; aliases = aliases} + in + if new_aliases = [] then + new_status + else + let aliases = + DisambiguatePp.aliases_of_domain_and_codomain_items_list new_aliases + in + let status = + add_lexicon_content (commands_of_aliases aliases) new_status + in + status + + +let rec eval_command ?(mode=LexiconAst.WithPreferences) status cmd = + !out cmd; + let notation_ids' = CicNotation.process_notation cmd in + let status = + { status with notation_ids = notation_ids' @ status.notation_ids } in + match cmd with + | LexiconAst.Include (loc, baseuri, mode, fullpath) -> + let lexiconpath_rw, lexiconpath_r = + LibraryMisc.lexicon_file_of_baseuri + ~must_exist:false ~writable:true ~baseuri, + LibraryMisc.lexicon_file_of_baseuri + ~must_exist:false ~writable:false ~baseuri + in + let lexiconpath = + if Sys.file_exists lexiconpath_rw then lexiconpath_rw else + if Sys.file_exists lexiconpath_r then lexiconpath_r else + raise (IncludedFileNotCompiled (lexiconpath_rw,fullpath)) + in + let lexicon = LexiconMarshal.load_lexicon lexiconpath in + let status = List.fold_left (eval_command ~mode) status lexicon in + status + | LexiconAst.Alias (loc, spec) -> + let diff = + (*CSC: Warning: this code should be factorized with the corresponding + code in DisambiguatePp *) + match spec with + | LexiconAst.Ident_alias (id,uri) -> + [DisambiguateTypes.Id id, + (uri,(fun _ _ _-> CicUtil.term_of_uri(UriManager.uri_of_string uri)))] + | LexiconAst.Symbol_alias (symb, instance, desc) -> + [DisambiguateTypes.Symbol (symb,instance), + DisambiguateChoices.lookup_symbol_by_dsc symb desc] + | LexiconAst.Number_alias (instance,desc) -> + [DisambiguateTypes.Num instance, + DisambiguateChoices.lookup_num_by_dsc desc] + in + set_proof_aliases mode status diff + | LexiconAst.Interpretation (_, dsc, (symbol, _), cic_appl_pattern) as stm -> + let status = add_lexicon_content [stm] status in + let diff = + [DisambiguateTypes.Symbol (symbol, 0), + DisambiguateChoices.lookup_symbol_by_dsc symbol dsc] + in + let status = set_proof_aliases mode status diff in + status + | LexiconAst.Notation _ as stm -> add_lexicon_content [stm] status + +let eval_command = eval_command ?mode:None + +let set_proof_aliases = set_proof_aliases LexiconAst.WithPreferences + diff --git a/components/lexicon/lexiconEngine.mli b/components/lexicon/lexiconEngine.mli new file mode 100644 index 000000000..b69495f4e --- /dev/null +++ b/components/lexicon/lexiconEngine.mli @@ -0,0 +1,45 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception IncludedFileNotCompiled of string * string + +type status = { + aliases: DisambiguateTypes.environment; (** disambiguation aliases *) + multi_aliases: DisambiguateTypes.multiple_environment; + lexicon_content_rev: LexiconMarshal.lexicon; + notation_ids: CicNotation.notation_id list; (** in-scope notation ids *) +} + +val initial_status: status + +val eval_command : status -> LexiconAst.command -> status + +val set_proof_aliases: + status -> + (DisambiguateTypes.Environment.key * DisambiguateTypes.codomain_item) list -> + status + +(* this callback is called on every lexicon command *) +val set_callback: (LexiconAst.command -> unit) -> unit diff --git a/components/lexicon/lexiconMarshal.ml b/components/lexicon/lexiconMarshal.ml new file mode 100644 index 000000000..7b9422db5 --- /dev/null +++ b/components/lexicon/lexiconMarshal.ml @@ -0,0 +1,67 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type lexicon = LexiconAst.command list + +let format_name = "lexicon" + +let save_lexicon_to_file ~fname lexicon = + HMarshal.save ~fmt:format_name ~version:LexiconAst.magic ~fname lexicon + +let load_lexicon_from_file ~fname = + let raw = HMarshal.load ~fmt:format_name ~version:LexiconAst.magic ~fname in + (raw: lexicon) + +let rehash_cmd_uris = + let rehash_uri uri = + UriManager.uri_of_string (UriManager.string_of_uri uri) in + function + | LexiconAst.Interpretation (loc, dsc, args, cic_appl_pattern) -> + let rec aux = + function + | CicNotationPt.UriPattern uri -> + CicNotationPt.UriPattern (rehash_uri uri) + | CicNotationPt.ApplPattern args -> + CicNotationPt.ApplPattern (List.map aux args) + | CicNotationPt.VarPattern _ + | CicNotationPt.ImplicitPattern as pat -> pat + in + let appl_pattern = aux cic_appl_pattern in + LexiconAst.Interpretation (loc, dsc, args, appl_pattern) + | LexiconAst.Notation _ + | LexiconAst.Alias _ as cmd -> cmd + | cmd -> + prerr_endline "Found a command not expected in a .lexicon:"; + prerr_endline (LexiconAstPp.pp_command cmd); + assert false + +let save_lexicon ~fname lexicon = save_lexicon_to_file ~fname (List.rev lexicon) + +let load_lexicon ~fname = + let lexicon = load_lexicon_from_file ~fname in + List.map rehash_cmd_uris lexicon + diff --git a/components/lexicon/lexiconMarshal.mli b/components/lexicon/lexiconMarshal.mli new file mode 100644 index 000000000..930d73f8d --- /dev/null +++ b/components/lexicon/lexiconMarshal.mli @@ -0,0 +1,32 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type lexicon = LexiconAst.command list + +val save_lexicon: fname:string -> lexicon -> unit + + (** @raise HMarshal.* *) +val load_lexicon: fname:string -> lexicon + diff --git a/components/lexicon/lexiconSync.ml b/components/lexicon/lexiconSync.ml new file mode 100644 index 000000000..30031943d --- /dev/null +++ b/components/lexicon/lexiconSync.ml @@ -0,0 +1,111 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let alias_diff ~from status = + let module Map = DisambiguateTypes.Environment in + Map.fold + (fun domain_item (description1,_ as codomain_item) acc -> + try + let description2,_ = Map.find domain_item from.LexiconEngine.aliases in + if description1 <> description2 then + (domain_item,codomain_item)::acc + else + acc + with + Not_found -> + (domain_item,codomain_item)::acc) + status.LexiconEngine.aliases [] + +let alias_diff = + let profiler = HExtlib.profile "alias_diff(conteg. anche in include)" in + fun ~from status -> profiler.HExtlib.profile (alias_diff ~from) status + +(** given a uri and a type list (the contructors types) builds a list of pairs + * (name,uri) that is used to generate automatic aliases **) +let extract_alias types uri = + fst(List.fold_left ( + fun (acc,i) (name, _, _, cl) -> + (name, UriManager.uri_of_uriref uri i None) :: + (fst(List.fold_left ( + fun (acc,j) (name,_) -> + (((name,UriManager.uri_of_uriref uri i + (Some j)) :: acc) , j+1) + ) (acc,1) cl)),i+1 + ) ([],0) types) + +let build_aliases = + List.map + (fun (name,uri) -> + DisambiguateTypes.Id name, + (UriManager.string_of_uri uri, fun _ _ _ -> CicUtil.term_of_uri uri)) + +let add_aliases_for_inductive_def status types uri = + let aliases = build_aliases (extract_alias types uri) in + LexiconEngine.set_proof_aliases status aliases + +let add_alias_for_constant status uri = + let name = UriManager.name_of_uri uri in + let new_env = build_aliases [(name,uri)] in + LexiconEngine.set_proof_aliases status new_env + +let add_aliases_for_object status uri = + function + Cic.InductiveDefinition (types,_,_,_) -> + add_aliases_for_inductive_def status types uri + | Cic.Constant _ -> add_alias_for_constant status uri + | Cic.Variable _ + | Cic.CurrentProof _ -> assert false + +let add_aliases_for_objs = + List.fold_left + (fun status uri -> + let obj,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + add_aliases_for_object status uri obj) + +module OrderedId = +struct + type t = CicNotation.notation_id + let compare = Pervasives.compare +end + +module IdSet = Set.Make (OrderedId) + + (** @return l2 \ l1 *) +let id_list_diff l2 l1 = + let module S = IdSet in + let s1 = List.fold_left (fun set uri -> S.add uri set) S.empty l1 in + let s2 = List.fold_left (fun set uri -> S.add uri set) S.empty l2 in + let diff = S.diff s2 s1 in + S.fold (fun uri uris -> uri :: uris) diff [] + +let time_travel ~present ~past = + let notation_to_remove = + id_list_diff present.LexiconEngine.notation_ids + past.LexiconEngine.notation_ids + in + List.iter CicNotation.remove_notation notation_to_remove + diff --git a/components/lexicon/lexiconSync.mli b/components/lexicon/lexiconSync.mli new file mode 100644 index 000000000..bba152a9f --- /dev/null +++ b/components/lexicon/lexiconSync.mli @@ -0,0 +1,39 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val add_aliases_for_objs: + LexiconEngine.status -> UriManager.uri list -> LexiconEngine.status + +val time_travel: + present:LexiconEngine.status -> past:LexiconEngine.status -> unit + + (** perform a diff between the aliases contained in two statuses, assuming + * that the second one can only have more aliases than the first one + * @return the list of aliases that should be added to aliases of from in + * order to be equal to aliases of the second argument *) +val alias_diff: + from:LexiconEngine.status -> LexiconEngine.status -> + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list + diff --git a/components/library/.depend b/components/library/.depend new file mode 100644 index 000000000..fefbf93ec --- /dev/null +++ b/components/library/.depend @@ -0,0 +1,24 @@ +cicCoercion.cmi: coercDb.cmi +librarySync.cmi: refinementTool.cmo +librarian.cmo: librarian.cmi +librarian.cmx: librarian.cmi +cicElim.cmo: cicElim.cmi +cicElim.cmx: cicElim.cmi +cicRecord.cmo: cicRecord.cmi +cicRecord.cmx: cicRecord.cmi +libraryMisc.cmo: libraryMisc.cmi +libraryMisc.cmx: libraryMisc.cmi +libraryDb.cmo: libraryDb.cmi +libraryDb.cmx: libraryDb.cmi +coercDb.cmo: coercDb.cmi +coercDb.cmx: coercDb.cmi +cicCoercion.cmo: coercDb.cmi cicCoercion.cmi +cicCoercion.cmx: coercDb.cmx cicCoercion.cmi +librarySync.cmo: refinementTool.cmo libraryDb.cmi coercDb.cmi cicRecord.cmi \ + cicElim.cmi cicCoercion.cmi librarySync.cmi +librarySync.cmx: refinementTool.cmx libraryDb.cmx coercDb.cmx cicRecord.cmx \ + cicElim.cmx cicCoercion.cmx librarySync.cmi +libraryClean.cmo: librarySync.cmi libraryMisc.cmi libraryDb.cmi \ + libraryClean.cmi +libraryClean.cmx: librarySync.cmx libraryMisc.cmx libraryDb.cmx \ + libraryClean.cmi diff --git a/components/library/.depend.opt b/components/library/.depend.opt new file mode 100644 index 000000000..190aaf9b7 --- /dev/null +++ b/components/library/.depend.opt @@ -0,0 +1,22 @@ +cicCoercion.cmi: coercDb.cmi +librarySync.cmi: refinementTool.cmx +cicElim.cmo: cicElim.cmi +cicElim.cmx: cicElim.cmi +cicRecord.cmo: cicRecord.cmi +cicRecord.cmx: cicRecord.cmi +libraryMisc.cmo: libraryMisc.cmi +libraryMisc.cmx: libraryMisc.cmi +libraryDb.cmo: libraryDb.cmi +libraryDb.cmx: libraryDb.cmi +coercDb.cmo: coercDb.cmi +coercDb.cmx: coercDb.cmi +cicCoercion.cmo: coercDb.cmi cicCoercion.cmi +cicCoercion.cmx: coercDb.cmx cicCoercion.cmi +librarySync.cmo: refinementTool.cmx libraryDb.cmi coercDb.cmi cicRecord.cmi \ + cicElim.cmi cicCoercion.cmi librarySync.cmi +librarySync.cmx: refinementTool.cmx libraryDb.cmx coercDb.cmx cicRecord.cmx \ + cicElim.cmx cicCoercion.cmx librarySync.cmi +libraryClean.cmo: librarySync.cmi libraryMisc.cmi libraryDb.cmi \ + libraryClean.cmi +libraryClean.cmx: librarySync.cmx libraryMisc.cmx libraryDb.cmx \ + libraryClean.cmi diff --git a/components/library/Makefile b/components/library/Makefile new file mode 100644 index 000000000..e3c921dd7 --- /dev/null +++ b/components/library/Makefile @@ -0,0 +1,20 @@ +PACKAGE = library +PREDICATES = + +INTERFACE_FILES = \ + librarian.mli \ + cicElim.mli \ + cicRecord.mli \ + libraryMisc.mli \ + libraryDb.mli \ + coercDb.mli \ + cicCoercion.mli \ + librarySync.mli \ + libraryClean.mli \ + $(NULL) +IMPLEMENTATION_FILES = \ + refinementTool.ml \ + $(INTERFACE_FILES:%.mli=%.ml) + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/library/cicCoercion.ml b/components/library/cicCoercion.ml new file mode 100644 index 000000000..638c0ce64 --- /dev/null +++ b/components/library/cicCoercion.ml @@ -0,0 +1,39 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let close_coercion_graph_ref = ref + (fun _ _ _ _ _ -> [] : + CoercDb.coerc_carr -> CoercDb.coerc_carr -> UriManager.uri -> int -> + string (* baseuri *) -> + (CoercDb.coerc_carr * CoercDb.coerc_carr * UriManager.uri * int * Cic.obj * int) list) +;; + +let set_close_coercion_graph f = close_coercion_graph_ref := f;; + +let close_coercion_graph c1 c2 u sat s = + !close_coercion_graph_ref c1 c2 u sat s +;; diff --git a/components/library/cicCoercion.mli b/components/library/cicCoercion.mli new file mode 100644 index 000000000..97463b1d6 --- /dev/null +++ b/components/library/cicCoercion.mli @@ -0,0 +1,40 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* This module implements the Coercions transitive closure *) + +val set_close_coercion_graph : + (CoercDb.coerc_carr -> CoercDb.coerc_carr -> UriManager.uri -> int -> + string (* baseuri *) -> + (CoercDb.coerc_carr * CoercDb.coerc_carr * UriManager.uri * + int (* saturations *) * Cic.obj * int (* arity *)) list) + -> unit + +val close_coercion_graph: + CoercDb.coerc_carr -> CoercDb.coerc_carr -> UriManager.uri -> int -> + string (* baseuri *) -> + (CoercDb.coerc_carr * CoercDb.coerc_carr * UriManager.uri * + int (* saturations *) * Cic.obj * int (* arity *) ) list + diff --git a/components/library/cicElim.ml b/components/library/cicElim.ml new file mode 100644 index 000000000..c994a9c53 --- /dev/null +++ b/components/library/cicElim.ml @@ -0,0 +1,422 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +exception Elim_failure of string Lazy.t +exception Can_t_eliminate + +let debug_print = fun _ -> () +(*let debug_print s = prerr_endline (Lazy.force s) *) + +let counter = ref ~-1 ;; + +let fresh_binder () = Cic.Name "matita_dummy" +(* + incr counter; + Cic.Name ("e" ^ string_of_int !counter) *) + + (** verifies if a given inductive type occurs in a term in target position *) +let rec recursive uri typeno = function + | Cic.Prod (_, _, target) -> recursive uri typeno target + | Cic.MutInd (uri', typeno', []) + | Cic.Appl (Cic.MutInd (uri', typeno', []) :: _) -> + UriManager.eq uri uri' && typeno = typeno' + | _ -> false + + (** given a list of constructor types, return true if at least one of them is + * recursive, false otherwise *) +let recursive_type uri typeno constructors = + let rec aux = function + | Cic.Prod (_, src, tgt) -> recursive uri typeno src || aux tgt + | _ -> false + in + List.exists (fun (_, ty) -> aux ty) constructors + +let unfold_appl = function + | Cic.Appl ((Cic.Appl args) :: tl) -> Cic.Appl (args @ tl) + | t -> t + +let rec split l n = + match (l,n) with + (l,0) -> ([], l) + | (he::tl, n) -> let (l1,l2) = split tl (n-1) in (he::l1,l2) + | (_,_) -> assert false + + (** build elimination principle part related to a single constructor + * @param paramsno number of Prod to ignore in this constructor (i.e. number of + * inductive parameters) + * @param dependent true if we are in the dependent case (i.e. sort <> Prop) *) +let rec delta (uri, typeno) dependent paramsno consno t p args = + match t with + | Cic.MutInd (uri', typeno', []) when + UriManager.eq uri uri' && typeno = typeno' -> + if dependent then + (match args with + | [] -> assert false + | [arg] -> unfold_appl (Cic.Appl [p; arg]) + | _ -> unfold_appl (Cic.Appl [p; unfold_appl (Cic.Appl args)])) + else + p + | Cic.Appl (Cic.MutInd (uri', typeno', []) :: tl) when + UriManager.eq uri uri' && typeno = typeno' -> + let (lparams, rparams) = split tl paramsno in + if dependent then + (match args with + | [] -> assert false + | [arg] -> unfold_appl (Cic.Appl (p :: rparams @ [arg])) + | _ -> + unfold_appl (Cic.Appl (p :: + rparams @ [unfold_appl (Cic.Appl args)]))) + else (* non dependent *) + (match rparams with + | [] -> p + | _ -> Cic.Appl (p :: rparams)) + | Cic.Prod (binder, src, tgt) -> + if recursive uri typeno src then + let args = List.map (CicSubstitution.lift 2) args in + let phi = + let src = CicSubstitution.lift 1 src in + delta (uri, typeno) dependent paramsno consno src + (CicSubstitution.lift 1 p) [Cic.Rel 1] + in + let tgt = CicSubstitution.lift 1 tgt in + Cic.Prod (fresh_binder (), src, + Cic.Prod (Cic.Anonymous, phi, + delta (uri, typeno) dependent paramsno consno tgt + (CicSubstitution.lift 2 p) (args @ [Cic.Rel 2]))) + else (* non recursive *) + let args = List.map (CicSubstitution.lift 1) args in + Cic.Prod (fresh_binder (), src, + delta (uri, typeno) dependent paramsno consno tgt + (CicSubstitution.lift 1 p) (args @ [Cic.Rel 1])) + | _ -> assert false + +let rec strip_left_params consno leftno = function + | t when leftno = 0 -> t (* no need to lift, the term is (hopefully) closed *) + | Cic.Prod (_, _, tgt) (* when leftno > 0 *) -> + (* after stripping the parameters we lift of consno. consno is 1 based so, + * the first constructor will be lifted by 1 (for P), the second by 2 (1 + * for P and 1 for the 1st constructor), and so on *) + if leftno = 1 then + CicSubstitution.lift consno tgt + else + strip_left_params consno (leftno - 1) tgt + | _ -> assert false + +let delta (ury, typeno) dependent paramsno consno t p args = + let t = strip_left_params consno paramsno t in + delta (ury, typeno) dependent paramsno consno t p args + +let rec add_params binder indno ty eliminator = + if indno = 0 then + eliminator + else + match ty with + | Cic.Prod (name, src, tgt) -> + let name = + match name with + Cic.Name _ -> name + | Cic.Anonymous -> fresh_binder () + in + binder name src (add_params binder (indno - 1) tgt eliminator) + | _ -> assert false + +let rec mk_rels consno = function + | 0 -> [] + | n -> Cic.Rel (n+consno) :: mk_rels consno (n-1) + +let rec strip_pi = function + | Cic.Prod (_, _, tgt) -> strip_pi tgt + | t -> t + +let rec count_pi = function + | Cic.Prod (_, _, tgt) -> count_pi tgt + 1 + | t -> 0 + +let rec type_of_p sort dependent leftno indty = function + | Cic.Prod (n, src, tgt) when leftno = 0 -> + let n = + if dependent then + match n with + Cic.Name _ -> n + | Cic.Anonymous -> fresh_binder () + else + n + in + Cic.Prod (n, src, type_of_p sort dependent leftno indty tgt) + | Cic.Prod (_, _, tgt) -> type_of_p sort dependent (leftno - 1) indty tgt + | t -> + if dependent then + Cic.Prod (Cic.Anonymous, indty, Cic.Sort sort) + else + Cic.Sort sort + +let rec add_right_pi dependent strip liftno liftfrom rightno indty = function + | Cic.Prod (_, src, tgt) when strip = 0 -> + Cic.Prod (fresh_binder (), + CicSubstitution.lift_from liftfrom liftno src, + add_right_pi dependent strip liftno (liftfrom + 1) rightno indty tgt) + | Cic.Prod (_, _, tgt) -> + add_right_pi dependent (strip - 1) liftno liftfrom rightno indty tgt + | t -> + if dependent then + Cic.Prod (fresh_binder (), + CicSubstitution.lift_from (rightno + 1) liftno indty, + Cic.Appl (Cic.Rel (1 + liftno + rightno) :: mk_rels 0 (rightno + 1))) + else + Cic.Prod (Cic.Anonymous, + CicSubstitution.lift_from (rightno + 1) liftno indty, + if rightno = 0 then + Cic.Rel (1 + liftno + rightno) + else + Cic.Appl (Cic.Rel (1 + liftno + rightno) :: mk_rels 1 rightno)) + +let rec add_right_lambda dependent strip liftno liftfrom rightno indty case = +function + | Cic.Prod (_, src, tgt) when strip = 0 -> + Cic.Lambda (fresh_binder (), + CicSubstitution.lift_from liftfrom liftno src, + add_right_lambda dependent strip liftno (liftfrom + 1) rightno indty + case tgt) + | Cic.Prod (_, _, tgt) -> + add_right_lambda true (strip - 1) liftno liftfrom rightno indty + case tgt + | t -> + Cic.Lambda (fresh_binder (), + CicSubstitution.lift_from (rightno + 1) liftno indty, case) + +let rec branch (uri, typeno) insource paramsno t fix head args = + match t with + | Cic.MutInd (uri', typeno', []) when + UriManager.eq uri uri' && typeno = typeno' -> + if insource then + (match args with + | [arg] -> Cic.Appl (fix :: args) + | _ -> Cic.Appl (head :: [Cic.Appl args])) + else + (match args with + | [] -> head + | _ -> Cic.Appl (head :: args)) + | Cic.Appl (Cic.MutInd (uri', typeno', []) :: tl) when + UriManager.eq uri uri' && typeno = typeno' -> + if insource then + let (lparams, rparams) = split tl paramsno in + match args with + | [arg] -> Cic.Appl (fix :: rparams @ args) + | _ -> Cic.Appl (fix :: rparams @ [Cic.Appl args]) + else + (match args with + | [] -> head + | _ -> Cic.Appl (head :: args)) + | Cic.Prod (binder, src, tgt) -> + if recursive uri typeno src then + let args = List.map (CicSubstitution.lift 1) args in + let phi = + let fix = CicSubstitution.lift 1 fix in + let src = CicSubstitution.lift 1 src in + branch (uri, typeno) true paramsno src fix head [Cic.Rel 1] + in + Cic.Lambda (fresh_binder (), src, + branch (uri, typeno) insource paramsno tgt + (CicSubstitution.lift 1 fix) (CicSubstitution.lift 1 head) + (args @ [Cic.Rel 1; phi])) + else (* non recursive *) + let args = List.map (CicSubstitution.lift 1) args in + Cic.Lambda (fresh_binder (), src, + branch (uri, typeno) insource paramsno tgt + (CicSubstitution.lift 1 fix) (CicSubstitution.lift 1 head) + (args @ [Cic.Rel 1])) + | _ -> assert false + +let branch (uri, typeno) insource liftno paramsno t fix head args = + let t = strip_left_params liftno paramsno t in + branch (uri, typeno) insource paramsno t fix head args + +let elim_of ~sort uri typeno = + counter := ~-1; + let (obj, univ) = (CicEnvironment.get_obj CicUniv.empty_ugraph uri) in + match obj with + | Cic.InductiveDefinition (indTypes, params, leftno, _) -> + let (name, inductive, ty, constructors) = + try + List.nth indTypes typeno + with Failure _ -> assert false + in + let paramsno = count_pi ty in (* number of (left or right) parameters *) + let rightno = paramsno - leftno in + let dependent = (strip_pi ty <> Cic.Sort Cic.Prop) in + let head = + match strip_pi ty with + Cic.Sort s -> s + | _ -> assert false + in + let conslen = List.length constructors in + let consno = ref (conslen + 1) in + if + not + (CicTypeChecker.check_allowed_sort_elimination uri typeno head sort) + then + raise Can_t_eliminate; + let indty = + let indty = Cic.MutInd (uri, typeno, []) in + if paramsno = 0 then + indty + else + Cic.Appl (indty :: mk_rels 0 paramsno) + in + let mk_constructor consno = + let constructor = Cic.MutConstruct (uri, typeno, consno, []) in + if leftno = 0 then + constructor + else + Cic.Appl (constructor :: mk_rels consno leftno) + in + let p_ty = type_of_p sort dependent leftno indty ty in + let final_ty = + add_right_pi dependent leftno (conslen + 1) 1 rightno indty ty + in + let eliminator_type = + let cic = + Cic.Prod (Cic.Name "P", p_ty, + (List.fold_right + (fun (_, constructor) acc -> + decr consno; + let p = Cic.Rel !consno in + Cic.Prod (Cic.Anonymous, + (delta (uri, typeno) dependent leftno !consno + constructor p [mk_constructor !consno]), + acc)) + constructors final_ty)) + in + add_params (fun b s t -> Cic.Prod (b, s, t)) leftno ty cic + in + let consno = ref (conslen + 1) in + let eliminator_body = + let fix = Cic.Rel (rightno + 2) in + let is_recursive = recursive_type uri typeno constructors in + let recshift = if is_recursive then 1 else 0 in + let (_, branches) = + List.fold_right + (fun (_, ty) (shift, branches) -> + let head = Cic.Rel (rightno + shift + 1 + recshift) in + let b = + branch (uri, typeno) false + (rightno + conslen + 2 + recshift) leftno ty fix head [] + in + (shift + 1, b :: branches)) + constructors (1, []) + in + let shiftno = conslen + rightno + 2 + recshift in + let outtype = + if dependent then + Cic.Rel shiftno + else + let head = + if rightno = 0 then + CicSubstitution.lift 1 (Cic.Rel shiftno) + else + Cic.Appl + ((CicSubstitution.lift (rightno + 1) (Cic.Rel shiftno)) :: + mk_rels 1 rightno) + in + add_right_lambda true leftno shiftno 1 rightno indty head ty + in + let mutcase = + Cic.MutCase (uri, typeno, outtype, Cic.Rel 1, branches) + in + let body = + if is_recursive then + let fixfun = + add_right_lambda dependent leftno (conslen + 2) 1 rightno + indty mutcase ty + in + (* rightno is the decreasing argument, i.e. the argument of + * inductive type *) + Cic.Fix (0, ["aux", rightno, final_ty, fixfun]) + else + add_right_lambda dependent leftno (conslen + 1) 1 rightno indty + mutcase ty + in + let cic = + Cic.Lambda (Cic.Name "P", p_ty, + (List.fold_right + (fun (_, constructor) acc -> + decr consno; + let p = Cic.Rel !consno in + Cic.Lambda (fresh_binder (), + (delta (uri, typeno) dependent leftno !consno + constructor p [mk_constructor !consno]), + acc)) + constructors body)) + in + add_params (fun b s t -> Cic.Lambda (b, s, t)) leftno ty cic + in +(* +debug_print (lazy (CicPp.ppterm eliminator_type)); +debug_print (lazy (CicPp.ppterm eliminator_body)); +*) + let eliminator_type = + FreshNamesGenerator.mk_fresh_names [] [] [] eliminator_type in + let eliminator_body = + FreshNamesGenerator.mk_fresh_names [] [] [] eliminator_body in +(* +debug_print (lazy (CicPp.ppterm eliminator_type)); +debug_print (lazy (CicPp.ppterm eliminator_body)); +*) + let (computed_type, ugraph) = + try + CicTypeChecker.type_of_aux' [] [] eliminator_body CicUniv.empty_ugraph + with CicTypeChecker.TypeCheckerFailure msg -> + raise (Elim_failure (lazy (sprintf + "type checker failure while type checking:\n%s\nerror:\n%s" + (CicPp.ppterm eliminator_body) (Lazy.force msg)))) + in + if not (fst (CicReduction.are_convertible [] + eliminator_type computed_type ugraph)) + then + raise (Failure (sprintf + "internal error: type mismatch on eliminator type\n%s\n%s" + (CicPp.ppterm eliminator_type) (CicPp.ppterm computed_type))); + let suffix = + match sort with + | Cic.Prop -> "_ind" + | Cic.Set -> "_rec" + | Cic.Type _ -> "_rect" + | _ -> assert false + in + (* let name = UriManager.name_of_uri uri ^ suffix in *) + let name = name ^ suffix in + let buri = UriManager.buri_of_uri uri in + let uri = UriManager.uri_of_string (buri ^ "/" ^ name ^ ".con") in + let obj_attrs = [`Class (`Elim sort); `Generated] in + uri, + Cic.Constant (name, Some eliminator_body, eliminator_type, [], obj_attrs) + | _ -> + failwith (sprintf "not an inductive definition (%s)" + (UriManager.string_of_uri uri)) + diff --git a/components/library/cicElim.mli b/components/library/cicElim.mli new file mode 100644 index 000000000..f1f84c92e --- /dev/null +++ b/components/library/cicElim.mli @@ -0,0 +1,41 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** can't build the required elimination principle (e.g. elimination from Prop + * to Set *) +exception Can_t_eliminate + + (** internal error while generating elimination principle *) +exception Elim_failure of string Lazy.t + +(** @param sort target sort +* @param uri inductive type uri +* @param typeno inductive type number +* @raise Failure +* @raise Can_t_eliminate +* @return Cic constant corresponding to the required elimination principle +* and its uri +*) +val elim_of: sort:Cic.sort -> UriManager.uri -> int -> UriManager.uri * Cic.obj diff --git a/components/library/cicRecord.ml b/components/library/cicRecord.ml new file mode 100644 index 000000000..775292ccb --- /dev/null +++ b/components/library/cicRecord.ml @@ -0,0 +1,88 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let rec_ty uri leftno = + let rec_ty = Cic.MutInd (uri,0,[]) in + if leftno = 0 then rec_ty else + Cic.Appl (rec_ty :: (CicUtil.mk_rels leftno 0)) + +let generate_one_proj uri params paramsno fields t i = + let mk_lambdas l start = + List.fold_right (fun (name,ty) acc -> + Cic.Lambda (Cic.Name name,ty,acc)) l start in + let recty = rec_ty uri paramsno in + let outtype = Cic.Lambda (Cic.Name "w'", CicSubstitution.lift 1 recty, t) in + (mk_lambdas params + (Cic.Lambda (Cic.Name "w", recty, + Cic.MutCase (uri,0,outtype, Cic.Rel 1, + [mk_lambdas fields (Cic.Rel i)])))) + +let projections_of uri field_names = + let buri = UriManager.buri_of_uri uri in + let obj,ugraph = CicEnvironment.get_cooked_obj CicUniv.empty_ugraph uri in + match obj with + Cic.InductiveDefinition ([_,_,sort,[_,ty]],params,paramsno,_) -> + assert (params = []); (* general case not implemented *) + let leftparams,ty = + let rec aux = + function + 0,ty -> [],ty + | n,Cic.Prod (Cic.Name name,s,t) -> + let leftparams,ty = aux (n - 1,t) in + (name,s)::leftparams,ty + | _,_ -> assert false + in + aux (paramsno,ty) + in + let fields = + let rec aux = + function + Cic.MutInd _, [] + | Cic.Appl _, [] -> [] + | Cic.Prod (_,s,t), name::tl -> (name,s)::aux (t,tl) + | _,_ -> assert false + in + aux ((CicSubstitution.lift 1 ty),field_names) + in + let rec aux i = + function + Cic.MutInd _, [] + | Cic.Appl _, [] -> [] + | Cic.Prod (_,s,t), name::tl -> + let p = generate_one_proj uri leftparams paramsno fields s i in + let puri = UriManager.uri_of_string (buri ^ "/" ^ name ^ ".con") in + (puri,name,p) :: + aux (i - 1) + (CicSubstitution.subst + (Cic.Appl + (Cic.Const (puri,[]) :: + CicUtil.mk_rels paramsno 2 @ [Cic.Rel 1]) + ) t, tl) + | _,_ -> assert false + in + aux (List.length fields) (CicSubstitution.lift 2 ty,field_names) + | _ -> assert false diff --git a/components/library/cicRecord.mli b/components/library/cicRecord.mli new file mode 100644 index 000000000..b966f317c --- /dev/null +++ b/components/library/cicRecord.mli @@ -0,0 +1,28 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** projections_of [uri] returns uri * name * term *) +val projections_of: + UriManager.uri -> string list -> (UriManager.uri * string * Cic.term) list diff --git a/components/library/coercDb.ml b/components/library/coercDb.ml new file mode 100644 index 000000000..0ca40eb1c --- /dev/null +++ b/components/library/coercDb.ml @@ -0,0 +1,192 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type coerc_carr = + | Uri of UriManager.uri + | Sort of Cic.sort + | Term of Cic.term + | Fun of int +;; + +exception EqCarrNotImplemented of string Lazy.t +exception EqCarrOnNonMetaClosed + +let db = ref [] + +let coerc_carr_of_term t = + try + match t with + | Cic.Sort s -> Sort s + | Cic.Prod _ -> Fun 0 + (* BUG: this should be the real arity. The computation + requires menv, context etc.., but since carrs are compared discharging Fun + arity... it works *) + | Cic.Appl (t::_) + | t -> Uri (CicUtil.uri_of_term t) + with Invalid_argument _ -> + Term t +;; + +let uri_of_carr = function + | Uri u -> Some u + | _ -> None + +let rec name_of_carr = function + | Uri u -> UriManager.name_of_uri u + | Sort s -> CicPp.ppsort s + | Term (Cic.Appl ((Cic.Const (uri, _))::_)) + | Term (Cic.Appl ((Cic.MutInd (uri, _, _))::_)) + | Term (Cic.Appl ((Cic.MutConstruct (uri, _, _, _))::_)) -> + UriManager.name_of_uri uri + | Term (Cic.Prod (_,_,t)) -> name_of_carr (Term t) + | Term t -> + prerr_endline ("CoercDb.name_of_carr:" ^ CicPp.ppterm t); + "FixTheNameMangler" + | Fun i -> "FunClass_" ^ string_of_int i +;; + +let eq_carr ?(exact=false) src tgt = + match src, tgt with + | Uri src, Uri tgt -> + let coarse_eq = UriManager.eq src tgt in + let t = CicUtil.term_of_uri src in + let ty,_ = CicTypeChecker.type_of_aux' [] [] t CicUniv.oblivion_ugraph in + (match ty, exact with + | Cic.Prod _, true -> false + | Cic.Prod _, false -> coarse_eq + | _ -> coarse_eq) + | Sort (Cic.Type _), Sort (Cic.Type _) -> true + | Sort src, Sort tgt when src = tgt -> true + | Term t1, Term t2 -> + if t1 = t2 then true + else + if CicUtil.is_meta_closed t1 && CicUtil.is_meta_closed t2 then + raise + (EqCarrNotImplemented + (lazy ("Unsupported carr for coercions: " ^ + CicPp.ppterm t1 ^ " or " ^ CicPp.ppterm t2))) + else raise EqCarrOnNonMetaClosed + | Fun _,Fun _ -> true (* only one Funclass? *) +(* | Fun i,Fun j when i=j -> true *) + | Term t, _ + | _, Term t when not (CicUtil.is_meta_closed t) -> raise EqCarrOnNonMetaClosed + | _, _ -> false +;; + +let to_list () = + List.map (fun (s,t,l) -> s,t,List.map (fun a,_,b -> a,b) l) !db +;; + +let rec myfilter p = function + | [] -> [] + | (s,t,l)::tl -> + let l = + HExtlib.filter_map + (fun (u,n,saturations) -> + if p (s,t,u,saturations) then + if n = 1 then + None + else + Some (u,n-1,saturations) + else + Some (u,n,saturations)) + l + in + if l = [] then myfilter p tl else (s,t,l)::myfilter p tl +;; + +let remove_coercion p = db := myfilter p !db;; + +let find_coercion f = + List.map + (fun uri,_,saturations -> uri,saturations) + (List.flatten + (HExtlib.filter_map (fun (s,t,l) -> if f (s,t) then Some l else None) !db)) +;; + +let get_carr uri = + try + let src, tgt, _ = + List.find + (fun (_,_,xl) -> List.exists (fun (x,_,_) -> UriManager.eq uri x) xl) + !db + in + src, tgt + with Not_found -> assert false (* uri must be a coercion *) +;; + +let is_a_coercion u = + List.exists + (fun (_,_,xl) -> List.exists (fun (x,_,_) -> UriManager.eq u x) xl) + !db +;; + +let is_a_coercion' t = + try + let uri = CicUtil.uri_of_term t in + is_a_coercion uri + with Invalid_argument _ -> false +;; + +let is_a_coercion_to_funclass t = + try + let uri = CicUtil.uri_of_term t in + match snd (get_carr uri) with + | Fun i -> Some i + | _ -> None + with Invalid_argument _ -> None + + +let term_of_carr = function + | Uri u -> CicUtil.term_of_uri u + | Sort s -> Cic.Sort s + | Fun _ -> assert false + | Term _ -> assert false +;; + +let add_coercion (src,tgt,u,saturations) = + let f s t = eq_carr s src && eq_carr t tgt in + let where = List.filter (fun (s,t,_) -> f s t) !db in + let rest = List.filter (fun (s,t,_) -> not (f s t)) !db in + match where with + | [] -> db := (src,tgt,[u,1,saturations]) :: !db + | (src,tgt,l)::tl -> + assert (tl = []); (* not sure, this may be a feature *) + if List.exists (fun (x,_,_) -> UriManager.eq u x) l then + let l' = List.map + (fun (x,n,saturations') -> + if UriManager.eq u x then + (x,n+1,saturations) + else + (x,n,saturations)) + l + in + db := (src,tgt,l')::tl @ rest + else + db := (src,tgt,(u,1,saturations)::l)::tl @ rest + +;; diff --git a/components/library/coercDb.mli b/components/library/coercDb.mli new file mode 100644 index 000000000..e1afd61aa --- /dev/null +++ b/components/library/coercDb.mli @@ -0,0 +1,68 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + + + (** THIS MODULE SHOULD BE USED ONLY BY CoercGraph/CicCoercion/librarySync + * + * and may be merged with CicCoercion... + * + * **) + + + (** XXX WARNING: non-reentrant *) +type coerc_carr = + | Uri of UriManager.uri (* const, mutind, mutconstr *) + | Sort of Cic.sort (* Prop, Set, Type *) + | Term of Cic.term (* nothing supported *) + | Fun of int +;; + +exception EqCarrNotImplemented of string Lazy.t +exception EqCarrOnNonMetaClosed +val eq_carr: ?exact:bool -> coerc_carr -> coerc_carr -> bool +val coerc_carr_of_term: Cic.term -> coerc_carr +val name_of_carr: coerc_carr -> string +val uri_of_carr: coerc_carr -> UriManager.uri option + +val to_list: + unit -> + (coerc_carr * coerc_carr * (UriManager.uri * int) list) list + +val add_coercion: + coerc_carr * coerc_carr * UriManager.uri * int -> unit + +val remove_coercion: + (coerc_carr * coerc_carr * UriManager.uri * int -> bool) -> unit + +val find_coercion: + (coerc_carr * coerc_carr -> bool) -> (UriManager.uri * int) list + +val is_a_coercion: UriManager.uri -> bool +val is_a_coercion': Cic.term -> bool +val is_a_coercion_to_funclass: Cic.term -> int option +val get_carr: UriManager.uri -> coerc_carr * coerc_carr + +val term_of_carr: coerc_carr -> Cic.term + diff --git a/components/library/libraryClean.ml b/components/library/libraryClean.ml new file mode 100644 index 000000000..a1f2a0cfc --- /dev/null +++ b/components/library/libraryClean.ml @@ -0,0 +1,266 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let debug = false +let debug_prerr = if debug then prerr_endline else ignore + +module HGT = Http_getter_types;; +module HG = Http_getter;; +module UM = UriManager;; + +let cache_of_processed_baseuri = Hashtbl.create 1024 + +let one_step_depend suri dbtype dbd = + let buri = + try + UM.buri_of_uri (UM.uri_of_string suri) + with UM.IllFormedUri _ -> suri + in + if Hashtbl.mem cache_of_processed_baseuri buri then + [] + else + begin + Hashtbl.add cache_of_processed_baseuri buri true; + let query = + let buri = buri ^ "/" in + let buri = HSql.escape dbtype dbd buri in + let obj_tbl = MetadataTypes.obj_tbl () in + if HSql.isMysql dbtype dbd then + sprintf ("SELECT source, h_occurrence FROM %s WHERE " + ^^ "h_occurrence REGEXP '^%s[^/]*$'") obj_tbl buri + else + begin + sprintf ("SELECT source, h_occurrence FROM %s WHERE " + ^^ "REGEXP(h_occurrence, '^%s[^/]*$')") obj_tbl buri + (* implementation with vanilla ocaml-sqlite3 + HLog.debug "Warning SELECT without REGEXP"; + sprintf + ("SELECT source, h_occurrence FROM %s WHERE " ^^ + "h_occurrence LIKE '%s%%' " ^^ HSql.escape_string_for_like) + obj_tbl buri*) + end + in + try + let rc = HSql.exec dbtype dbd query in + let l = ref [] in + HSql.iter rc ( + fun row -> + match row.(0), row.(1) with + | Some uri, Some occ when Filename.dirname occ = buri -> + l := uri :: !l + | _ -> ()); + let l = List.sort Pervasives.compare !l in + HExtlib.list_uniq l + with + exn -> raise exn (* no errors should be accepted *) + end + +let safe_buri_of_suri suri = + try + UM.buri_of_uri (UM.uri_of_string suri) + with + UM.IllFormedUri _ -> suri + +let db_uris_of_baseuri buri = + let dbd = LibraryDb.instance () in + let dbtype = + if Helm_registry.get_bool "matita.system" then HSql.Library else HSql.User + in + let query = + let buri = buri ^ "/" in + let buri = HSql.escape dbtype dbd buri in + let obj_tbl = MetadataTypes.name_tbl () in + if HSql.isMysql dbtype dbd then + sprintf ("SELECT source FROM %s WHERE " + ^^ "source REGEXP '^%s[^/]*(#xpointer.*)?$'") obj_tbl buri + else + begin + sprintf ("SELECT source FROM %s WHERE " + ^^ "REGEXP(source, '^%s[^/]*\\(#xpointer.*\\)?$')") obj_tbl buri + end + in + try + let rc = HSql.exec dbtype dbd query in + let strip_xpointer s = Pcre.replace ~pat:"#.*$" s in + let l = ref [] in + HSql.iter rc ( + fun row -> + match row.(0) with + | Some uri when Filename.dirname (strip_xpointer uri) = buri -> + l := uri :: !l + | _ -> + ()); + let l = List.sort Pervasives.compare !l in + HExtlib.list_uniq l + with + exn -> raise exn (* no errors should be accepted *) +;; + +let close_uri_list uri_to_remove = + let dbd = LibraryDb.instance () in + let dbtype = + if Helm_registry.get_bool "matita.system" then HSql.Library else HSql.User + in + (* to remove an uri you have to remove the whole script *) + let buri_to_remove = + HExtlib.list_uniq + (List.fast_sort Pervasives.compare + (List.map safe_buri_of_suri uri_to_remove)) + in + (* cleand the already visided baseuris *) + let buri_to_remove = + List.filter + (fun buri -> + if Hashtbl.mem cache_of_processed_baseuri buri then false + else true) + buri_to_remove + in + (* now calculate the list of objects that belong to these baseuris *) + let uri_to_remove = + try + List.fold_left + (fun acc buri -> + let inhabitants = HG.ls ~local:true (buri ^ "/") in + let inhabitants = List.filter + (function HGT.Ls_object _ -> true | _ -> false) + inhabitants + in + let inhabitants = List.map + (function + | HGT.Ls_object e -> buri ^ "/" ^ e.HGT.uri + | _ -> assert false) + inhabitants + in + inhabitants @ acc) + [] buri_to_remove + with HGT.Invalid_URI u -> + HLog.error ("We were listing an invalid buri: " ^ u); + exit 1 + in + let uri_to_remove_from_db = + List.fold_left + (fun acc buri -> + let dbu = db_uris_of_baseuri buri in + dbu @ acc + ) [] buri_to_remove + in + let uri_to_remove = uri_to_remove @ uri_to_remove_from_db in + let uri_to_remove = + HExtlib.list_uniq (List.sort Pervasives.compare uri_to_remove) in + (* now we want the list of all uri that depend on them *) + let depend = + List.fold_left + (fun acc u -> one_step_depend u dbtype dbd @ acc) [] uri_to_remove + in + let depend = + HExtlib.list_uniq (List.fast_sort Pervasives.compare depend) + in + uri_to_remove, depend + +let rec close_db uris next = + match next with + | [] -> uris + | l -> let uris, next = close_uri_list l in close_db uris next @ uris + +let cleaned_no = ref 0;; + + (** TODO repellent code ... *) +let moo_root_dir = lazy ( + let url = + List.assoc "cic:/matita/" + (List.map + (fun pair -> + match + Str.split (Str.regexp "[ \t\r\n]+") (HExtlib.trim_blanks pair) + with + | a::b::_ -> a, b + | _ -> assert false) + (Helm_registry.get_list Helm_registry.string "getter.prefix")) + in + String.sub url 7 (String.length url - 7) (* remove heading "file:///" *) +) + +let clean_baseuris ?(verbose=true) buris = + let dbd = LibraryDb.instance () in + let dbtype = + if Helm_registry.get_bool "matita.system" then HSql.Library else HSql.User + in + Hashtbl.clear cache_of_processed_baseuri; + let buris = List.map Http_getter_misc.strip_trailing_slash buris in + debug_prerr "clean_baseuris called on:"; + if debug then + List.iter debug_prerr buris; + let l = close_db [] buris in + let l = HExtlib.list_uniq (List.fast_sort Pervasives.compare l) in + let l = List.map UriManager.uri_of_string l in + debug_prerr "clean_baseuri will remove:"; + if debug then + List.iter (fun u -> debug_prerr (UriManager.string_of_uri u)) l; + List.iter + (fun baseuri -> + try + let obj_file = + LibraryMisc.obj_file_of_baseuri ~must_exist:false ~writable:true ~baseuri + in + HExtlib.safe_remove obj_file ; + HExtlib.safe_remove + (LibraryMisc.lexicon_file_of_baseuri + ~must_exist:false ~writable:true ~baseuri) ; + HExtlib.rmdir_descend (Filename.chop_extension obj_file) + with Http_getter_types.Key_not_found _ -> ()) + (HExtlib.list_uniq (List.fast_sort Pervasives.compare + (List.map (UriManager.buri_of_uri) l @ buris))); + List.iter + (let last_baseuri = ref "" in + fun uri -> + let buri = UriManager.buri_of_uri uri in + if buri <> !last_baseuri then + begin + if Helm_registry.get_bool "matita.bench" then + (print_endline ("matitaclean " ^ buri ^ "/");flush stdout) + else + HLog.message ("Removing: " ^ buri ^ "/*"); + last_baseuri := buri + end; + LibrarySync.remove_obj uri + ) l; + if HSql.isMysql dbtype dbd then + begin + cleaned_no := !cleaned_no + List.length l; + if !cleaned_no > 30 && HSql.isMysql dbtype dbd then + begin + cleaned_no := 0; + List.iter + (function table -> + ignore (HSql.exec dbtype dbd ("OPTIMIZE TABLE " ^ table))) + [MetadataTypes.name_tbl (); MetadataTypes.rel_tbl (); + MetadataTypes.sort_tbl (); MetadataTypes.obj_tbl(); + MetadataTypes.count_tbl()] + end + end diff --git a/components/library/libraryClean.mli b/components/library/libraryClean.mli new file mode 100644 index 000000000..4d65cfe38 --- /dev/null +++ b/components/library/libraryClean.mli @@ -0,0 +1,27 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val db_uris_of_baseuri : string -> string list +val clean_baseuris : ?verbose:bool -> string list -> unit diff --git a/components/library/libraryDb.ml b/components/library/libraryDb.ml new file mode 100644 index 000000000..e82e91f97 --- /dev/null +++ b/components/library/libraryDb.ml @@ -0,0 +1,212 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let dbtype_of_string dbtype = + if dbtype = "library" then HSql.Library + else if dbtype = "user" then HSql.User + else if dbtype = "legacy" then HSql.Legacy + else raise (HSql.Error "HSql: wrong config file format") + +let parse_dbd_conf _ = + let metadata = Helm_registry.get_list Helm_registry.string "db.metadata" in + List.map + (fun s -> + match Pcre.split ~pat:"\\s+" s with + | [path;db;user;pwd;dbtype] -> + let dbtype = dbtype_of_string dbtype in + let pwd = if pwd = "none" then None else Some pwd in + (* TODO parse port *) + path, None, db, user, pwd, dbtype + | _ -> raise (HSql.Error "HSql: Bad format in config file")) + metadata +;; + +let parse_dbd_conf _ = + HSql.mk_dbspec (parse_dbd_conf ()) +;; + +let instance = + let dbd = lazy ( + let dbconf = parse_dbd_conf () in + HSql.quick_connect dbconf) + in + fun () -> Lazy.force dbd +;; + +let xpointer_RE = Pcre.regexp "#.*$" +let file_scheme_RE = Pcre.regexp "^file://" + +let clean_owner_environment () = + let dbd = instance () in + let obj_tbl = MetadataTypes.obj_tbl () in + let sort_tbl = MetadataTypes.sort_tbl () in + let rel_tbl = MetadataTypes.rel_tbl () in + let name_tbl = MetadataTypes.name_tbl () in + let count_tbl = MetadataTypes.count_tbl () in + let tbls = [ + (obj_tbl,`RefObj) ; (sort_tbl,`RefSort) ; (rel_tbl,`RefRel) ; + (name_tbl,`ObjectName) ; (count_tbl,`Count) ] + in + let dbtype = + if Helm_registry.get_bool "matita.system" then HSql.Library else HSql.User + in + let statements = + (SqlStatements.drop_tables tbls) @ + (SqlStatements.drop_indexes tbls dbtype dbd) + in + let owned_uris = + try + MetadataDb.clean ~dbd + with (HSql.Error _) as exn -> + match HSql.errno dbtype dbd with + | HSql.No_such_table -> [] + | _ -> raise exn + in + List.iter + (fun uri -> + let uri = Pcre.replace ~rex:xpointer_RE ~templ:"" uri in + List.iter + (fun suffix -> + try + HExtlib.safe_remove + (Http_getter.resolve ~local:true ~writable:true (uri ^ suffix)) + with Http_getter_types.Key_not_found _ -> ()) + [""; ".body"; ".types"]) + owned_uris; + List.iter (fun statement -> + try + ignore (HSql.exec dbtype dbd statement) + with (HSql.Error _) as exn -> + match HSql.errno dbtype dbd with + | HSql.No_such_table + | HSql.Bad_table_error + | HSql.No_such_index -> () + | _ -> raise exn + ) statements; +;; + +let create_owner_environment () = + let dbd = instance () in + let obj_tbl = MetadataTypes.obj_tbl () in + let sort_tbl = MetadataTypes.sort_tbl () in + let rel_tbl = MetadataTypes.rel_tbl () in + let name_tbl = MetadataTypes.name_tbl () in + let count_tbl = MetadataTypes.count_tbl () in + let l_obj_tbl = MetadataTypes.library_obj_tbl in + let l_sort_tbl = MetadataTypes.library_sort_tbl in + let l_rel_tbl = MetadataTypes.library_rel_tbl in + let l_name_tbl = MetadataTypes.library_name_tbl in + let l_count_tbl = MetadataTypes.library_count_tbl in + let tbls = [ + (obj_tbl,`RefObj) ; (sort_tbl,`RefSort) ; (rel_tbl,`RefRel) ; + (name_tbl,`ObjectName) ; (count_tbl,`Count) ] + in + let system_tbls = [ + (l_obj_tbl,`RefObj) ; (l_sort_tbl,`RefSort) ; (l_rel_tbl,`RefRel) ; + (l_name_tbl,`ObjectName) ; (l_count_tbl,`Count) ] + in + let tag tag l = List.map (fun x -> tag, x) l in + let statements = + (tag HSql.Library (SqlStatements.create_tables system_tbls)) @ + (tag HSql.User (SqlStatements.create_tables tbls)) @ + (tag HSql.Library (SqlStatements.create_indexes system_tbls)) @ + (tag HSql.User (SqlStatements.create_indexes tbls)) + in + List.iter + (fun (dbtype, statement) -> + try + ignore (HSql.exec dbtype dbd statement) + with + (HSql.Error _) as exc -> + let status = HSql.errno dbtype dbd in + match status with + | HSql.Table_exists_error -> () + | HSql.Dup_keyname -> () + | HSql.GENERIC_ERROR _ -> + prerr_endline statement; + raise exc + | _ -> ()) + statements +;; + +(* removes uri from the ownerized tables, and returns the list of other objects + * (theyr uris) that ref the one removed. + * AFAIK there is no need to return it, since the MatitaTypes.staus should + * contain all defined objects. but to double check we do not garbage the + * metadata... + *) +let remove_uri uri = + let obj_tbl = MetadataTypes.obj_tbl () in + let sort_tbl = MetadataTypes.sort_tbl () in + let rel_tbl = MetadataTypes.rel_tbl () in + let name_tbl = MetadataTypes.name_tbl () in + (*let conclno_tbl = MetadataTypes.conclno_tbl () in + let conclno_hyp_tbl = MetadataTypes.fullno_tbl () in*) + let count_tbl = MetadataTypes.count_tbl () in + + let dbd = instance () in + let suri = UriManager.string_of_uri uri in + let dbtype = + if Helm_registry.get_bool "matita.system" then HSql.Library else HSql.User + in + let query table suri = + if HSql.isMysql dbtype dbd then + Printf.sprintf "DELETE QUICK LOW_PRIORITY FROM %s WHERE source='%s'" table + (HSql.escape dbtype dbd suri) + else + Printf.sprintf "DELETE FROM %s WHERE source='%s'" table + (HSql.escape dbtype dbd suri) + in + List.iter (fun t -> + try + ignore (HSql.exec dbtype dbd (query t suri)) + with + exn -> raise exn (* no errors should be accepted *) + ) + [obj_tbl;sort_tbl;rel_tbl;name_tbl;(*conclno_tbl;conclno_hyp_tbl*)count_tbl]; +;; + +let xpointers_of_ind uri = + let dbd = instance () in + let name_tbl = MetadataTypes.name_tbl () in + let dbtype = + if Helm_registry.get_bool "matita.system" then HSql.Library else HSql.User + in + let escape s = + Pcre.replace ~pat:"([^\\\\])_" ~templ:"$1\\_" + (HSql.escape dbtype dbd s) + in + let query = Printf.sprintf + ("SELECT source FROM %s WHERE source LIKE '%s#xpointer%%' " + ^^ HSql.escape_string_for_like dbtype dbd) + name_tbl (escape (UriManager.string_of_uri uri)) + in + let rc = HSql.exec dbtype dbd query in + let l = ref [] in + HSql.iter rc (fun a -> match a.(0) with None ->()|Some a -> l := a:: !l); + List.map UriManager.uri_of_string !l + diff --git a/components/library/libraryDb.mli b/components/library/libraryDb.mli new file mode 100644 index 000000000..e608a9c24 --- /dev/null +++ b/components/library/libraryDb.mli @@ -0,0 +1,35 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val dbtype_of_string: string -> HSql.dbtype + +val instance: unit -> HSql.dbd +val parse_dbd_conf: unit -> HSql.dbspec + +val create_owner_environment: unit -> unit +val clean_owner_environment: unit -> unit + +val remove_uri: UriManager.uri -> unit +val xpointers_of_ind: UriManager.uri -> UriManager.uri list diff --git a/components/library/libraryMisc.ml b/components/library/libraryMisc.ml new file mode 100644 index 000000000..7c82e27c4 --- /dev/null +++ b/components/library/libraryMisc.ml @@ -0,0 +1,38 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let resolve ~must_exist ~writable ~local baseuri = + if must_exist then + Http_getter.resolve ~local ~writable baseuri + else + Http_getter.filename ~local ~writable baseuri + +let obj_file_of_baseuri ~must_exist ~writable ~baseuri = + resolve ~must_exist ~writable ~local:true baseuri ^ ".moo" +let lexicon_file_of_baseuri ~must_exist ~writable ~baseuri = + resolve ~must_exist ~writable ~local:true baseuri ^ ".lexicon" + diff --git a/components/library/libraryMisc.mli b/components/library/libraryMisc.mli new file mode 100644 index 000000000..2c6bfd193 --- /dev/null +++ b/components/library/libraryMisc.mli @@ -0,0 +1,30 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* only for local uris *) +val obj_file_of_baseuri: + must_exist:bool -> writable:bool -> baseuri:string -> string +val lexicon_file_of_baseuri: + must_exist:bool -> writable:bool -> baseuri:string -> string diff --git a/components/library/librarySync.ml b/components/library/librarySync.ml new file mode 100644 index 000000000..c36d84c90 --- /dev/null +++ b/components/library/librarySync.ml @@ -0,0 +1,533 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let object_declaration_hook = ref (fun _ _ -> ());; +let set_object_declaration_hook f = + object_declaration_hook := f + +exception AlreadyDefined of UriManager.uri + +let auxiliary_lemmas_hashtbl = UriManager.UriHashtbl.create 29 + +(* uri |--> (derived_coercions_in_the_coercion_DB, derived_coercions_in_lib) + * + * in case of remove_coercion uri, the first component is removed from the + * coercion DB, while the second is passed to remove_obj (and is not [] only if + * add_coercion is called with add_composites + * *) +let coercion_hashtbl = UriManager.UriHashtbl.create 3 + +let uris_of_obj uri = + let innertypesuri = UriManager.innertypesuri_of_uri uri in + let bodyuri = UriManager.bodyuri_of_uri uri in + let univgraphuri = UriManager.univgraphuri_of_uri uri in + innertypesuri,bodyuri,univgraphuri + +let paths_and_uris_of_obj uri = + let resolved = Http_getter.filename' ~local:true ~writable:true uri in + let basepath = Filename.dirname resolved in + let innertypesuri, bodyuri, univgraphuri = uris_of_obj uri in + let innertypesfilename=(UriManager.nameext_of_uri innertypesuri)^".xml.gz"in + let innertypespath = basepath ^ "/" ^ innertypesfilename in + let xmlfilename = (UriManager.nameext_of_uri uri) ^ ".xml.gz" in + let xmlpath = basepath ^ "/" ^ xmlfilename in + let xmlbodyfilename = (UriManager.nameext_of_uri uri) ^ ".body.xml.gz" in + let xmlbodypath = basepath ^ "/" ^ xmlbodyfilename in + let xmlunivgraphfilename=(UriManager.nameext_of_uri univgraphuri)^".xml.gz"in + let xmlunivgraphpath = basepath ^ "/" ^ xmlunivgraphfilename in + xmlpath, xmlbodypath, innertypespath, bodyuri, innertypesuri, + xmlunivgraphpath, univgraphuri + +let save_object_to_disk uri obj ugraph univlist = + let write f x = + if not (Helm_registry.get_opt_default + Helm_registry.bool "matita.nodisk" ~default:false) + then + f x + in + let ensure_path_exists path = + let dir = Filename.dirname path in + HExtlib.mkdir dir + in + (* generate annobj, ids_to_inner_sorts and ids_to_inner_types *) + let annobj, innertypes, ids_to_inner_sorts, generate_attributes = + if Helm_registry.get_bool "matita.system" && + not (Helm_registry.get_bool "matita.noinnertypes") + then + let annobj, _, _, ids_to_inner_sorts, ids_to_inner_types, _, _ = + Cic2acic.acic_object_of_cic_object obj + in + let innertypesxml = + Cic2Xml.print_inner_types + uri ~ids_to_inner_sorts ~ids_to_inner_types ~ask_dtd_to_the_getter:false + in + annobj, Some innertypesxml, Some ids_to_inner_sorts, false + else + let annobj = Cic2acic.plain_acic_object_of_cic_object obj in + annobj, None, None, true + in + (* prepare XML *) + let xml, bodyxml = + Cic2Xml.print_object + uri ?ids_to_inner_sorts ~ask_dtd_to_the_getter:false + ~generate_attributes annobj + in + let xmlpath, xmlbodypath, innertypespath, bodyuri, innertypesuri, + xmlunivgraphpath, univgraphuri = + paths_and_uris_of_obj uri + in + write (List.iter HExtlib.mkdir) (List.map Filename.dirname [xmlpath]); + (* now write to disk *) + write ensure_path_exists xmlpath; + write (Xml.pp ~gzip:true xml) (Some xmlpath); + write (CicUniv.write_xml_of_ugraph xmlunivgraphpath ugraph) univlist; + (* we return a list of uri,path we registered/created *) + (uri,xmlpath) :: + (univgraphuri,xmlunivgraphpath) :: + (* now the optional inner types, both write and register *) + (match innertypes with + | None -> [] + | Some innertypesxml -> + write ensure_path_exists innertypespath; + write (Xml.pp ~gzip:true innertypesxml) (Some innertypespath); + [innertypesuri, innertypespath] + ) @ + (* now the optional body, both write and register *) + (match bodyxml,bodyuri with + None,_ -> [] + | Some bodyxml,Some bodyuri-> + write ensure_path_exists xmlbodypath; + write (Xml.pp ~gzip:true bodyxml) (Some xmlbodypath); + [bodyuri, xmlbodypath] + | _-> assert false) + + +let typecheck_obj = + let profiler = HExtlib.profile "add_obj.typecheck_obj" in + fun uri obj -> profiler.HExtlib.profile (CicTypeChecker.typecheck_obj uri) obj + +let index_obj = + let profiler = HExtlib.profile "add_obj.index_obj" in + fun ~dbd ~uri -> + profiler.HExtlib.profile (fun uri -> MetadataDb.index_obj ~dbd ~uri) uri + +let add_single_obj uri obj refinement_toolkit = + let module RT = RefinementTool in + let obj = + if (*List.mem `Generated (CicUtil.attributes_of_obj obj) &&*) + not (CoercDb.is_a_coercion' (Cic.Const (uri, []))) + then + refinement_toolkit.RT.pack_coercion_obj obj + else + obj + in + let dbd = LibraryDb.instance () in + if CicEnvironment.in_library uri then + raise (AlreadyDefined uri) + else begin + (*CicUniv.reset_spent_time (); + let before = Unix.gettimeofday () in*) + typecheck_obj uri obj; (* 1 *) + (*let after = Unix.gettimeofday () in + let univ_time = CicUniv.get_spent_time () in + let total_time = after -. before in + prerr_endline + (Printf.sprintf "QED: %%univ = %2.5f, total = %2.5f, univ = %2.5f, %s\n" + (univ_time *. 100. /. total_time) (total_time) (univ_time) + (UriManager.name_of_uri uri));*) + let _, ugraph, univlist = + CicEnvironment.get_cooked_obj_with_univlist CicUniv.empty_ugraph uri in + try + index_obj ~dbd ~uri; (* 2 must be in the env *) + try + (*3*) + let new_stuff = save_object_to_disk uri obj ugraph univlist in + (* EXPERIMENTAL: pretty print the object in natural language *) + (try !object_declaration_hook uri obj + with exc -> + prerr_endline "Error: object_declaration_hook failed"); + try + HLog.message + (Printf.sprintf "%s defined" (UriManager.string_of_uri uri)) + with exc -> + List.iter HExtlib.safe_remove (List.map snd new_stuff); (* -3 *) + raise exc + with exc -> + ignore(LibraryDb.remove_uri uri); (* -2 *) + raise exc + with exc -> + CicEnvironment.remove_obj uri; (* -1 *) + raise exc + end + +let remove_single_obj uri = + let derived_uris_of_uri uri = + let innertypesuri, bodyuri, univgraphuri = uris_of_obj uri in + innertypesuri::univgraphuri::(match bodyuri with None -> [] | Some u -> [u]) + in + let uris_to_remove = + if UriManager.uri_is_ind uri then LibraryDb.xpointers_of_ind uri else [uri] + in + let files_to_remove = uri :: derived_uris_of_uri uri in + List.iter + (fun uri -> + (try + let file = Http_getter.resolve' ~local:true ~writable:true uri in + HExtlib.safe_remove file; + HExtlib.rmdir_descend (Filename.dirname file) + with Http_getter_types.Key_not_found _ -> ()); + ) files_to_remove ; + List.iter + (fun uri -> + ignore (LibraryDb.remove_uri uri); + (*CoercGraph.remove_coercion uri;*) + ) uris_to_remove ; + CicEnvironment.remove_obj uri + +(*** GENERATION OF AUXILIARY LEMMAS ***) + +let generate_elimination_principles uri refinement_toolkit = + let uris = ref [] in + let elim i = + let elim sort = + try + let uri,obj = CicElim.elim_of ~sort uri i in + add_single_obj uri obj refinement_toolkit; + uris := uri :: !uris + with CicElim.Can_t_eliminate -> () + in + try + List.iter + elim [ Cic.Prop; Cic.Set; (Cic.Type (CicUniv.fresh ())) ]; + with exn -> + List.iter remove_single_obj !uris; + raise exn + in + let (obj, univ) = (CicEnvironment.get_obj CicUniv.empty_ugraph uri) in + match obj with + | Cic.InductiveDefinition (indTypes, _, _, _) -> + let counter = ref 0 in + List.iter (fun _ -> elim !counter; counter := !counter+1) indTypes; + !uris + | _ -> + failwith (Printf.sprintf "not an inductive definition (%s)" + (UriManager.string_of_uri uri)) + +(* COERCIONS ***********************************************************) + +let remove_all_coercions () = + UriManager.UriHashtbl.clear coercion_hashtbl; + CoercDb.remove_coercion (fun (_,_,_,_) -> true) + +let add_coercion ~add_composites refinement_toolkit uri arity saturations + baseuri += + let coer_ty,_ = + let coer = CicUtil.term_of_uri uri in + CicTypeChecker.type_of_aux' [] [] coer CicUniv.empty_ugraph + in + (* we have to get the source and the tgt type uri + * in Coq syntax we have already their names, but + * since we don't support Funclass and similar I think + * all the coercion should be of the form + * (A:?)(B:?)T1->T2 + * So we should be able to extract them from the coercion type + * + * Currently only (_:T1)T2 is supported. + * should we saturate it with metas in case we insert it? + * + *) + let spine2list ty = + let rec aux = function + | Cic.Prod( _, src, tgt) -> src::aux tgt + | t -> [t] + in + aux ty + in + let src_carr, tgt_carr = + let get_classes arity saturations l = + (* this is the ackerman's function revisited *) + let rec aux = function + 0,0,None,tgt::src::_ -> src,Some (`Class tgt) + | 0,0,target,src::_ -> src,target + | 0,saturations,None,tgt::tl -> aux (0,saturations,Some (`Class tgt),tl) + | 0,saturations,target,_::tl -> aux (0,saturations - 1,target,tl) + | arity,saturations,None,_::tl -> + aux (arity, saturations, Some `Funclass, tl) + | arity,saturations,target,_::tl -> + aux (arity - 1, saturations, target, tl) + | _ -> assert false + in + aux (arity,saturations,None,List.rev l) + in + let types = spine2list coer_ty in + let src,tgt = get_classes arity saturations types in + CoercDb.coerc_carr_of_term (CicReduction.whd ~delta:false [] src), + match tgt with + None -> assert false + | Some `Funclass -> CoercDb.Fun arity + | Some (`Class tgt) -> + CoercDb.coerc_carr_of_term (CicReduction.whd ~delta:false [] tgt) + in + let already_in_obj src_carr tgt_carr uri obj = + List.exists + (fun (s,t,ul) -> + List.exists + (fun u,_ -> + let bo = + match obj with + | Cic.Constant (_, Some bo, _, _, _) -> bo + | _ -> assert false + in + CoercDb.eq_carr s src_carr && + CoercDb.eq_carr t tgt_carr && + if fst (CicReduction.are_convertible [] (CicUtil.term_of_uri u) bo + CicUniv.oblivion_ugraph) + then true else + (HLog.warn + ("Coercions " ^ + UriManager.string_of_uri u ^ " and " ^ UriManager.string_of_uri + uri^" are not convertible, but are between the same nodes.\n"^ + "From now on unification can fail randomly."); + false)) + ul) + (CoercDb.to_list ()) + in + if not add_composites then + (CoercDb.add_coercion (src_carr, tgt_carr, uri, saturations); + UriManager.UriHashtbl.add coercion_hashtbl uri ([],[]); + []) + else + let new_coercions = + CicCoercion.close_coercion_graph src_carr tgt_carr uri saturations + baseuri + in + let new_coercions = + List.filter (fun (s,t,u,_,obj,_) -> not(already_in_obj s t u obj)) + new_coercions + in + let composite_uris = List.map (fun (_,_,uri,_,_,_) -> uri) new_coercions in + (* update the DB *) + List.iter + (fun (src,tgt,uri,saturations,_,_) -> + CoercDb.add_coercion (src,tgt,uri,saturations)) + new_coercions; + CoercDb.add_coercion (src_carr, tgt_carr, uri, saturations); + (* add the composites obj and they eventual lemmas *) + let lemmas = + List.fold_left + (fun acc (_,tgt,uri,saturations,obj,arity) -> + add_single_obj uri obj refinement_toolkit; + (uri,arity,saturations)::acc) + [] new_coercions + in + (* store that composite_uris are related to uri. the first component is + * the stuff in the DB while the second is stuff for remove_obj *) + (* + prerr_endline ("adding: " ^ + string_of_bool add_composites ^ UriManager.string_of_uri uri); + List.iter (fun u -> prerr_endline (UriManager.string_of_uri u)) + composite_uris; + *) + UriManager.UriHashtbl.add + coercion_hashtbl uri (composite_uris,composite_uris); + (* + prerr_endline ("lemmas:"); + List.iter (fun u -> prerr_endline (UriManager.string_of_uri u)) + lemmas; + prerr_endline ("lemmas END");*) + lemmas +;; + +let remove_coercion uri = + try + let (composites_in_db, composites_in_lib) = + UriManager.UriHashtbl.find coercion_hashtbl uri + in + (*prerr_endline ("removing: " ^UriManager.string_of_uri uri); + List.iter (fun u -> prerr_endline (UriManager.string_of_uri u)) + composites_in_db;*) + UriManager.UriHashtbl.remove coercion_hashtbl uri; + CoercDb.remove_coercion + (fun (_,_,u,_) -> UriManager.eq uri u); + (* remove from the DB *) + List.iter + (fun u -> CoercDb.remove_coercion (fun (_,_,u1,_) -> UriManager.eq u u1)) + composites_in_db; + (* remove composites from the lib *) + List.iter remove_single_obj composites_in_lib + with + Not_found -> HLog.warn "Coercion removal raise Not_found" (* mhh..... *) + + +let generate_projections refinement_toolkit uri fields = + let uris = ref [] in + let projections = + CicRecord.projections_of uri + (List.map (fun (x,_,_) -> x) fields) + in + try + List.iter2 + (fun (uri, name, bo) (_name, coercion, arity) -> + let saturations = 0 in + try + let ty, ugraph = + CicTypeChecker.type_of_aux' [] [] bo CicUniv.empty_ugraph in + let attrs = [`Class `Projection; `Generated] in + let obj = Cic.Constant (name,Some bo,ty,[],attrs) in + add_single_obj uri obj refinement_toolkit; + let composites = + if coercion then + begin +(*prerr_endline ("composite for " ^ UriManager.string_of_uri uri);*) + (*CSC: I think there is a bug here. The composite coercions + are not remembered in the .moo file. Thus they are re-generated + every time. Right? *) + let x = + add_coercion ~add_composites:true refinement_toolkit uri arity + saturations (UriManager.buri_of_uri uri) + in +(*prerr_endline ("are: "); + List.iter (fun u -> prerr_endline (UriManager.string_of_uri u)) x; + prerr_endline "---"; +*) + (*CSC: I throw the arity away. See comment above *) + List.map (fun u,_,_ -> u) x + end + else + [] + in + uris := uri :: composites @ !uris + with + CicTypeChecker.TypeCheckerFailure s -> + HLog.message + ("Unable to create projection " ^ name ^ " cause: " ^ Lazy.force s); + | CicEnvironment.Object_not_found uri -> + let depend = UriManager.name_of_uri uri in + HLog.message + ("Unable to create projection " ^ name ^ " because it requires " ^ + depend) + ) projections fields; + !uris + with exn -> + List.iter remove_single_obj !uris; + raise exn + +let build_inversion_principle = ref (fun a b -> assert false);; + +let generate_inversion refinement_toolkit uri obj = + List.map + (fun (ind_uri,ind_obj) -> + add_single_obj ind_uri ind_obj refinement_toolkit;ind_uri) + (!build_inversion_principle uri obj) + +let + generate_sibling_mutual_definitions refinement_toolkit uri attrs name_to_avoid += + function + Cic.Fix (_,funs) -> + snd ( + List.fold_right + (fun (name,idx,ty,bo) (n,uris) -> + if name = name_to_avoid then + (n+1,uris) + else + let uri = + UriManager.uri_of_string + (UriManager.buri_of_uri uri ^ "/" ^ name ^ ".con") in + let bo = Cic.Fix (n,funs) in + let obj = Cic.Constant (name,Some bo,ty,[],attrs) in + add_single_obj uri obj refinement_toolkit; + (n+1,uri::uris) + ) funs (1,[])) + | Cic.CoFix (_,funs) -> + snd ( + List.fold_right + (fun (name,ty,bo) (n,uris) -> + if name = name_to_avoid then + (n+1,uris) + else + let uri = + UriManager.uri_of_string + (UriManager.buri_of_uri uri ^ "/" ^ name ^ ".con") in + let bo = Cic.CoFix (n,funs) in + let obj = Cic.Constant (name,Some bo,ty,[],attrs) in + add_single_obj uri obj refinement_toolkit; + (n+1,uri::uris) + ) funs (1,[])) + | _ -> assert false + +let add_obj refinement_toolkit uri obj = + add_single_obj uri obj refinement_toolkit; + let uris = ref [] in + let not_debug = not (Helm_registry.get_bool "matita.debug") in + try + begin + match obj with + | Cic.Constant (name,Some bo,_,_,attrs) when + List.mem (`Flavour `MutualDefinition) attrs -> + uris := + !uris @ + generate_sibling_mutual_definitions refinement_toolkit uri attrs + name bo + | Cic.Constant _ -> () + | Cic.InductiveDefinition (_,_,_,attrs) -> + uris := !uris @ + generate_elimination_principles uri refinement_toolkit; + uris := !uris @ generate_inversion refinement_toolkit uri obj; + let rec get_record_attrs = + function + | [] -> None + | (`Class (`Record fields))::_ -> Some fields + | _::tl -> get_record_attrs tl + in + (match get_record_attrs attrs with + | None -> () (* not a record *) + | Some fields -> + uris := !uris @ + (generate_projections refinement_toolkit uri fields)) + | Cic.CurrentProof _ + | Cic.Variable _ -> assert false + end; + UriManager.UriHashtbl.add auxiliary_lemmas_hashtbl uri !uris; + !uris + with + | exn when not_debug -> + List.iter remove_single_obj !uris; + raise exn + +let remove_obj uri = + let uris = + try + let res = UriManager.UriHashtbl.find auxiliary_lemmas_hashtbl uri in + UriManager.UriHashtbl.remove auxiliary_lemmas_hashtbl uri; + res + with + Not_found -> [] (*assert false*) + in + List.iter remove_single_obj (uri::uris) + diff --git a/components/library/librarySync.mli b/components/library/librarySync.mli new file mode 100644 index 000000000..d8e432e75 --- /dev/null +++ b/components/library/librarySync.mli @@ -0,0 +1,62 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception AlreadyDefined of UriManager.uri + +val set_object_declaration_hook : (UriManager.uri -> Cic.obj -> unit) -> unit + +(* this is a pointer to the function which builds the inversion principle *) +val build_inversion_principle: (UriManager.uri-> Cic.obj -> (UriManager.uri * Cic.obj) list) ref + +(* adds an object to the library together with all auxiliary lemmas on it *) +(* (e.g. elimination principles, projections, etc.) *) +(* it returns the list of the uris of the auxiliary lemmas generated *) +val add_obj: + RefinementTool.kit -> + UriManager.uri -> Cic.obj -> + UriManager.uri list + +(* inverse of add_obj; *) +(* Warning: it does not remove the dependencies on the object and on its *) +(* auxiliary lemmas! *) +val remove_obj: UriManager.uri -> unit + +(* Informs the library that [uri] is a coercion. *) +(* This can generate some composite coercions that, if [add_composites] *) +(* is true are added to the library. *) +(* The list of added objects is returned. *) +val add_coercion: + add_composites:bool -> + RefinementTool.kit -> UriManager.uri -> int (* arity *) -> + int (* saturations *) -> string (* baseuri *) -> + (UriManager.uri * int * int) list (* URI, arity, saturations *) + +(* inverse of add_coercion, removes both the eventually created composite *) +(* coercions and the information that [uri] and the composites are coercion *) +val remove_coercion: UriManager.uri -> unit + +(* mh... *) +val remove_all_coercions: unit -> unit + diff --git a/components/library/refinementTool.ml b/components/library/refinementTool.ml new file mode 100644 index 000000000..b78246987 --- /dev/null +++ b/components/library/refinementTool.ml @@ -0,0 +1,41 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type type_of_rc = + | Success of Cic.term * Cic.term * Cic.metasenv * CicUniv.universe_graph + | Exception of string Lazy.t + + (* these are the same functions of cic_unification/ (eventually wrapped) *) +type kit = { + type_of_aux': + ?localization_tbl:Stdpp.location Cic.CicHash.t -> + Cic.metasenv -> Cic.context -> Cic.term -> CicUniv.universe_graph -> + type_of_rc; + pack_coercion_obj: Cic.obj -> Cic.obj; + apply_subst: Cic.substitution -> Cic.term -> Cic.term ; + ppsubst: metasenv:Cic.metasenv -> Cic.substitution -> string; + ppmetasenv: Cic.substitution -> Cic.metasenv -> string; +} + diff --git a/components/license b/components/license new file mode 100644 index 000000000..2fb102d9d --- /dev/null +++ b/components/license @@ -0,0 +1,22 @@ +Copyright (C) 1999-2006, HELM Team. + +This file is part of HELM, an Hypertextual, Electronic +Library of Mathematics, developed at the Computer Science +Department, University of Bologna, Italy. + +HELM is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +HELM is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +For details, see the HELM web site: http://helm.cs.unibo.it/ diff --git a/components/logger/.depend b/components/logger/.depend new file mode 100644 index 000000000..28268d29e --- /dev/null +++ b/components/logger/.depend @@ -0,0 +1,2 @@ +helmLogger.cmo: helmLogger.cmi +helmLogger.cmx: helmLogger.cmi diff --git a/components/logger/.depend.opt b/components/logger/.depend.opt new file mode 100644 index 000000000..28268d29e --- /dev/null +++ b/components/logger/.depend.opt @@ -0,0 +1,2 @@ +helmLogger.cmo: helmLogger.cmi +helmLogger.cmx: helmLogger.cmi diff --git a/components/logger/Makefile b/components/logger/Makefile new file mode 100644 index 000000000..39d690084 --- /dev/null +++ b/components/logger/Makefile @@ -0,0 +1,10 @@ + +PACKAGE = logger +INTERFACE_FILES = \ + helmLogger.mli +IMPLEMENTATION_FILES = \ + $(INTERFACE_FILES:%.mli=%.ml) + +include ../../Makefile.defs +include ../Makefile.common + diff --git a/components/logger/helmLogger.ml b/components/logger/helmLogger.ml new file mode 100644 index 000000000..c41674754 --- /dev/null +++ b/components/logger/helmLogger.ml @@ -0,0 +1,62 @@ +(* $Id$ *) + +open Printf + +(* HTML simulator (first in its kind) *) + +type html_tag = + [ `T of string + | `L of html_tag list + | `BR + | `DIV of int * string option * html_tag + ] + +type html_msg = [ `Error of html_tag | `Msg of html_tag ] + +type logger_fun = ?append_NL:bool -> html_msg -> unit + +let rec string_of_html_tag = + let rec aux indent = + let indent_str = String.make indent ' ' in + function + | `T s -> s + | `L msgs -> + String.concat ("\n" ^ indent_str) (List.map (aux indent) msgs) + | `BR -> "\n" ^ indent_str + | `DIV (local_indent, _, tag) -> + "\n" ^ indent_str ^ aux (indent + local_indent) tag + in + aux 0 + +let string_of_html_msg = function + | `Error tag -> "Error: " ^ string_of_html_tag tag + | `Msg tag -> string_of_html_tag tag + +let rec html_of_html_tag = function + | `T s -> s + | `L msgs -> + sprintf "

    \n%s\n
" + (String.concat "\n" + (List.map + (fun msg -> sprintf "
  • %s
  • " (html_of_html_tag msg)) + msgs)) + | `BR -> "
    \n" + | `DIV (indent, color, tag) -> + sprintf "
    \n%s\n
    " + (match color with None -> "" | Some color -> "color: " ^ color ^ "; ") + (float_of_int indent *. 0.5) + (html_of_html_tag tag) + +let html_of_html_msg = + function + | `Error tag -> "Error: " ^ html_of_html_tag tag ^ "" + | `Msg tag -> html_of_html_tag tag + +let log_callbacks = ref [] + +let register_log_callback logger_fun = + log_callbacks := !log_callbacks @ [ logger_fun ] + +let log ?append_NL html_msg = + List.iter (fun logger_fun -> logger_fun ?append_NL html_msg) !log_callbacks + diff --git a/components/logger/helmLogger.mli b/components/logger/helmLogger.mli new file mode 100644 index 000000000..633b5c3ec --- /dev/null +++ b/components/logger/helmLogger.mli @@ -0,0 +1,27 @@ + +type html_tag = + [ `BR + | `L of html_tag list + | `T of string + | `DIV of int * string option * html_tag (* indentation, color, tag *) + ] +type html_msg = [ `Error of html_tag | `Msg of html_tag ] + + (** html_msg to plain text converter *) +val string_of_html_msg: html_msg -> string + + (** html_tag to plain text converter *) +val string_of_html_tag: html_tag -> string + + (** html_msg to html text converter *) +val html_of_html_msg: html_msg -> string + + (** html_tag to html text converter *) +val html_of_html_tag: html_tag -> string + +type logger_fun = ?append_NL:bool -> html_msg -> unit + +val register_log_callback: logger_fun -> unit + +val log: logger_fun + diff --git a/components/metadata/.depend b/components/metadata/.depend new file mode 100644 index 000000000..492a34e3a --- /dev/null +++ b/components/metadata/.depend @@ -0,0 +1,23 @@ +metadataExtractor.cmi: metadataTypes.cmi +metadataPp.cmi: metadataTypes.cmi +metadataConstraints.cmi: metadataTypes.cmi +metadataDb.cmi: metadataTypes.cmi +metadataDeps.cmi: metadataTypes.cmi +sqlStatements.cmo: sqlStatements.cmi +sqlStatements.cmx: sqlStatements.cmi +metadataTypes.cmo: metadataTypes.cmi +metadataTypes.cmx: metadataTypes.cmi +metadataExtractor.cmo: metadataTypes.cmi metadataExtractor.cmi +metadataExtractor.cmx: metadataTypes.cmx metadataExtractor.cmi +metadataPp.cmo: metadataTypes.cmi metadataPp.cmi +metadataPp.cmx: metadataTypes.cmx metadataPp.cmi +metadataConstraints.cmo: metadataTypes.cmi metadataPp.cmi \ + metadataConstraints.cmi +metadataConstraints.cmx: metadataTypes.cmx metadataPp.cmx \ + metadataConstraints.cmi +metadataDb.cmo: metadataTypes.cmi metadataPp.cmi metadataExtractor.cmi \ + metadataConstraints.cmi metadataDb.cmi +metadataDb.cmx: metadataTypes.cmx metadataPp.cmx metadataExtractor.cmx \ + metadataConstraints.cmx metadataDb.cmi +metadataDeps.cmo: sqlStatements.cmi metadataTypes.cmi metadataDeps.cmi +metadataDeps.cmx: sqlStatements.cmx metadataTypes.cmx metadataDeps.cmi diff --git a/components/metadata/.depend.opt b/components/metadata/.depend.opt new file mode 100644 index 000000000..492a34e3a --- /dev/null +++ b/components/metadata/.depend.opt @@ -0,0 +1,23 @@ +metadataExtractor.cmi: metadataTypes.cmi +metadataPp.cmi: metadataTypes.cmi +metadataConstraints.cmi: metadataTypes.cmi +metadataDb.cmi: metadataTypes.cmi +metadataDeps.cmi: metadataTypes.cmi +sqlStatements.cmo: sqlStatements.cmi +sqlStatements.cmx: sqlStatements.cmi +metadataTypes.cmo: metadataTypes.cmi +metadataTypes.cmx: metadataTypes.cmi +metadataExtractor.cmo: metadataTypes.cmi metadataExtractor.cmi +metadataExtractor.cmx: metadataTypes.cmx metadataExtractor.cmi +metadataPp.cmo: metadataTypes.cmi metadataPp.cmi +metadataPp.cmx: metadataTypes.cmx metadataPp.cmi +metadataConstraints.cmo: metadataTypes.cmi metadataPp.cmi \ + metadataConstraints.cmi +metadataConstraints.cmx: metadataTypes.cmx metadataPp.cmx \ + metadataConstraints.cmi +metadataDb.cmo: metadataTypes.cmi metadataPp.cmi metadataExtractor.cmi \ + metadataConstraints.cmi metadataDb.cmi +metadataDb.cmx: metadataTypes.cmx metadataPp.cmx metadataExtractor.cmx \ + metadataConstraints.cmx metadataDb.cmi +metadataDeps.cmo: sqlStatements.cmi metadataTypes.cmi metadataDeps.cmi +metadataDeps.cmx: sqlStatements.cmx metadataTypes.cmx metadataDeps.cmi diff --git a/components/metadata/Makefile b/components/metadata/Makefile new file mode 100644 index 000000000..9943237dd --- /dev/null +++ b/components/metadata/Makefile @@ -0,0 +1,18 @@ +PACKAGE = metadata +PREDICATES = + +INTERFACE_FILES = \ + sqlStatements.mli \ + metadataTypes.mli \ + metadataExtractor.mli \ + metadataPp.mli \ + metadataConstraints.mli \ + metadataDb.mli \ + metadataDeps.mli \ + $(NULL) +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/metadata/metadataConstraints.ml b/components/metadata/metadataConstraints.ml new file mode 100644 index 000000000..73f137a43 --- /dev/null +++ b/components/metadata/metadataConstraints.ml @@ -0,0 +1,693 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf +open MetadataTypes + +let critical_value = 7 +let just_factor = 1 + +module UriManagerSet = UriManager.UriSet +module SetSet = Set.Make (UriManagerSet) + +type term_signature = (UriManager.uri * UriManager.uri list) option * UriManagerSet.t + +type cardinality_condition = + | Eq of int + | Gt of int + | Lt of int + +type rating_criterion = + [ `Hits (** order by number of hits, most used objects first *) + ] + +let default_tables = + (library_obj_tbl,library_rel_tbl,library_sort_tbl,library_count_tbl) + +let current_tables () = + (obj_tbl (),rel_tbl (),sort_tbl (), count_tbl ()) + +let tbln n = "table" ^ string_of_int n + +(* +let add_depth_constr depth_opt cur_tbl where = + match depth_opt with + | None -> where + | Some depth -> (sprintf "%s.h_depth = %d" cur_tbl depth) :: where +*) + +let mk_positions positions cur_tbl = + "(" ^ + String.concat " or " + (List.map + (fun pos -> + let pos_str = MetadataPp.pp_position_tag pos in + match pos with + | `InBody + | `InConclusion + | `InHypothesis + | `MainConclusion None + | `MainHypothesis None -> + sprintf "%s.h_position = \"%s\"" cur_tbl pos_str + | `MainConclusion (Some r) + | `MainHypothesis (Some r) -> + let depth = MetadataPp.pp_relation r in + sprintf "(%s.h_position = \"%s\" and %s.h_depth %s)" + cur_tbl pos_str cur_tbl depth) + (positions :> MetadataTypes.position list)) ^ + ")" + +let explode_card_constr = function + | Eq card -> "=", card + | Gt card -> ">", card + | Lt card -> "<", card + +let add_card_constr tbl col where = function + | None -> where + | Some constr -> + let op, card = explode_card_constr constr in + (* count(_utente).hypothesis = 3 *) + (sprintf "%s.%s %s %d" tbl col op card :: where) + +let add_diff_constr tbl where = function + | None -> where + | Some constr -> + let op, card = explode_card_constr constr in + (sprintf "%s.hypothesis - %s.conclusion %s %d" tbl tbl op card :: where) + +let add_all_constr ?(tbl=library_count_tbl) (n,from,where) concl full diff = + match (concl, full, diff) with + | None, None, None -> (n,from,where) + | _ -> + let cur_tbl = tbln n in + let from = (sprintf "%s as %s" tbl cur_tbl) :: from in + let where = add_card_constr cur_tbl "conclusion" where concl in + let where = add_card_constr cur_tbl "statement" where full in + let where = add_diff_constr cur_tbl where diff in + (n+2,from, + (if n > 0 then + sprintf "table0.source = %s.source" cur_tbl :: where + else + where)) + + +let add_constraint ?(start=0) ?(tables=default_tables) (n,from,where) metadata = + let obj_tbl,rel_tbl,sort_tbl,count_tbl = tables + in + let cur_tbl = tbln n in + let start_table = tbln start in + match metadata with + | `Obj (uri, positions) -> + let from = (sprintf "%s as %s" obj_tbl cur_tbl) :: from in + let where = + (sprintf "(%s.h_occurrence = \"%s\")" cur_tbl (UriManager.string_of_uri uri)) :: + mk_positions positions cur_tbl :: + (if n=start then [] + else [sprintf "%s.source = %s.source" start_table cur_tbl]) @ + where + in + ((n+2), from, where) + | `Rel positions -> + let from = (sprintf "%s as %s" rel_tbl cur_tbl) :: from in + let where = + mk_positions positions cur_tbl :: + (if n=start then [] + else [sprintf "%s.source = %s.source" start_table cur_tbl]) @ + where + in + ((n+2), from, where) + | `Sort (sort, positions) -> + let sort_str = CicPp.ppsort sort in + let from = (sprintf "%s as %s" sort_tbl cur_tbl) :: from in + let where = + (sprintf "%s.h_sort = \"%s\"" cur_tbl sort_str ) :: + mk_positions positions cur_tbl :: + (if n=start then + [] + else + [sprintf "%s.source = %s.source" start_table cur_tbl ]) @ where + in + ((n+2), from, where) + +let exec dbtype ~(dbd:HSql.dbd) ?rating (n,from,where) = + let from = String.concat ", " from in + let where = String.concat " and " where in + let query = + match rating with + | None -> sprintf "select distinct table0.source from %s where %s" from where + | Some `Hits -> + sprintf + ("select distinct table0.source from %s, hits where %s + and table0.source = hits.source order by hits.no desc") + from where + in + (* prerr_endline query; *) + let result = HSql.exec dbtype dbd query in + HSql.map result + ~f:(fun row -> + match row.(0) with Some s -> UriManager.uri_of_string s + | _ -> assert false) +;; + +let at_least dbtype ~(dbd:HSql.dbd) ?concl_card ?full_card ?diff ?rating tables + (metadata: MetadataTypes.constr list) += + let obj_tbl,rel_tbl,sort_tbl, count_tbl = tables in + if (metadata = []) && concl_card = None && full_card = None then + begin + HLog.warn "MetadataConstraints.at_least: no constraints given"; + [] + end + else + let (n,from,where) = + List.fold_left (add_constraint ~tables) (0,[],[]) metadata + in + let (n,from,where) = + add_all_constr ~tbl:count_tbl (n,from,where) concl_card full_card diff + in + exec dbtype ~dbd ?rating (n,from,where) +;; + +let at_least + ~(dbd:HSql.dbd) ?concl_card ?full_card ?diff ?rating + (metadata: MetadataTypes.constr list) += + if are_tables_ownerized () then + at_least + HSql.Library ~dbd ?concl_card ?full_card ?diff ?rating + default_tables metadata + @ + at_least + HSql.Legacy ~dbd ?concl_card ?full_card ?diff ?rating + default_tables metadata + @ + at_least + HSql.User ~dbd ?concl_card ?full_card ?diff ?rating + (current_tables ()) metadata + + else + at_least + HSql.Library ~dbd ?concl_card ?full_card ?diff ?rating + default_tables metadata + @ + at_least + HSql.Legacy ~dbd ?concl_card ?full_card ?diff ?rating + default_tables metadata + + + (** Prefix handling *) + +let filter_by_card n = + SetSet.filter (fun t -> (UriManagerSet.cardinal t) <= n) + +let merge n a b = + let init = SetSet.union a b in + let merge_single_set s1 b = + SetSet.fold + (fun s2 res -> SetSet.add (UriManagerSet.union s1 s2) res) + b SetSet.empty in + let res = + SetSet.fold (fun s1 res -> SetSet.union (merge_single_set s1 b) res) a init + in + filter_by_card n res + +let rec inspect_children n childs = + List.fold_left + (fun res term -> merge n (inspect_conclusion n term) res) + SetSet.empty childs + +and add_root n root childs = + let childunion = inspect_children n childs in + let addroot = UriManagerSet.add root in + SetSet.fold + (fun child newsets -> SetSet.add (addroot child) newsets) + childunion + (SetSet.singleton (UriManagerSet.singleton root)) + +and inspect_conclusion n t = + if n = 0 then SetSet.empty + else match t with + Cic.Rel _ + | Cic.Meta _ + | Cic.Sort _ + | Cic.Implicit _ -> SetSet.empty + | Cic.Var (u,exp_named_subst) -> SetSet.empty + | Cic.Const (u,exp_named_subst) -> + SetSet.singleton (UriManagerSet.singleton u) + | Cic.MutInd (u, t, exp_named_subst) -> + SetSet.singleton (UriManagerSet.singleton + (UriManager.uri_of_uriref u t None)) + | Cic.MutConstruct (u, t, c, exp_named_subst) -> + SetSet.singleton (UriManagerSet.singleton + (UriManager.uri_of_uriref u t (Some c))) + | Cic.Cast (t, _) -> inspect_conclusion n t + | Cic.Prod (_, s, t) -> + merge n (inspect_conclusion n s) (inspect_conclusion n t) + | Cic.Lambda (_, s, t) -> + merge n (inspect_conclusion n s) (inspect_conclusion n t) + | Cic.LetIn (_, s, t) -> + merge n (inspect_conclusion n s) (inspect_conclusion n t) + | Cic.Appl ((Cic.Const (u,exp_named_subst))::l) -> + add_root (n-1) u l + | Cic.Appl ((Cic.MutInd (u, t, exp_named_subst))::l) -> + let uri = UriManager.uri_of_uriref u t None in + add_root (n-1) uri l + | Cic.Appl ((Cic.MutConstruct (u, t, c, exp_named_subst))::l) -> + let suri = UriManager.uri_of_uriref u t (Some c) in + add_root (n-1) suri l + | Cic.Appl l -> + SetSet.empty + | Cic.MutCase (u, t, tt, uu, m) -> + SetSet.empty + | Cic.Fix (_, m) -> + SetSet.empty + | Cic.CoFix (_, m) -> + SetSet.empty + +let rec inspect_term n t = + if n = 0 then + assert false + else + match t with + Cic.Rel _ + | Cic.Meta _ + | Cic.Sort _ + | Cic.Implicit _ -> None, SetSet.empty + | Cic.Var (u,exp_named_subst) -> None, SetSet.empty + | Cic.Const (u,exp_named_subst) -> + Some u, SetSet.empty + | Cic.MutInd (u, t, exp_named_subst) -> + let uri = UriManager.uri_of_uriref u t None in + Some uri, SetSet.empty + | Cic.MutConstruct (u, t, c, exp_named_subst) -> + let uri = UriManager.uri_of_uriref u t (Some c) in + Some uri, SetSet.empty + | Cic.Cast (t, _) -> inspect_term n t + | Cic.Prod (_, _, t) -> inspect_term n t + | Cic.LetIn (_, _, t) -> inspect_term n t + | Cic.Appl ((Cic.Const (u,exp_named_subst))::l) -> + let childunion = inspect_children (n-1) l in + Some u, childunion + | Cic.Appl ((Cic.MutInd (u, t, exp_named_subst))::l) -> + let suri = UriManager.uri_of_uriref u t None in + if u = HelmLibraryObjects.Logic.eq_URI && n>1 then + (* equality is handled in a special way: in particular, + the type, if defined, is always added to the prefix, + and n is not decremented - it should have been n-2 *) + match l with + Cic.Const (u1,exp_named_subst1)::l1 -> + let inconcl = add_root (n-1) u1 l1 in + Some suri, inconcl + | Cic.MutInd (u1, t1, exp_named_subst1)::l1 -> + let suri1 = UriManager.uri_of_uriref u1 t1 None in + let inconcl = add_root (n-1) suri1 l1 in + Some suri, inconcl + | Cic.MutConstruct (u1, t1, c1, exp_named_subst1)::l1 -> + let suri1 = UriManager.uri_of_uriref u1 t1 (Some c1) in + let inconcl = add_root (n-1) suri1 l1 in + Some suri, inconcl + | _ :: _ -> Some suri, SetSet.empty + | _ -> assert false (* args number must be > 0 *) + else + let childunion = inspect_children (n-1) l in + Some suri, childunion + | Cic.Appl ((Cic.MutConstruct (u, t, c, exp_named_subst))::l) -> + let suri = UriManager.uri_of_uriref u t(Some c) in + let childunion = inspect_children (n-1) l in + Some suri, childunion + | _ -> None, SetSet.empty + +let add_cardinality s = + let l = SetSet.elements s in + let res = + List.map + (fun set -> + let el = UriManagerSet.elements set in + (List.length el, el)) l in + (* ordered by descending cardinality *) + List.sort (fun (n,_) (m,_) -> m - n) ((0,[])::res) + +let prefixes n t = + match inspect_term n t with + Some a, set -> Some a, add_cardinality set + | None, set when (SetSet.is_empty set) -> None, [] + | _, _ -> assert false + + +let rec add children = + List.fold_left + (fun acc t -> UriManagerSet.union (signature_concl t) acc) + (UriManagerSet.empty) children + +(* this function creates the set of all different constants appearing in + the conclusion of the term *) +and signature_concl = + function + Cic.Rel _ + | Cic.Meta _ + | Cic.Sort _ + | Cic.Implicit _ -> UriManagerSet.empty + | Cic.Var (u,exp_named_subst) -> + (*CSC: TODO if the var has a body it must be processed *) + UriManagerSet.empty + | Cic.Const (u,exp_named_subst) -> + UriManagerSet.singleton u + | Cic.MutInd (u, t, exp_named_subst) -> + let rec projections_of uris = + List.flatten + (List.map + (fun uri -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + projections_of (CicUtil.projections_of_record o uri)) + uris) + in + let uri = UriManager.uri_of_uriref u t None in + List.fold_right UriManagerSet.add + (projections_of [u]) (UriManagerSet.singleton uri) + | Cic.MutConstruct (u, t, c, exp_named_subst) -> + let uri = UriManager.uri_of_uriref u t (Some c) in + UriManagerSet.singleton uri + | Cic.Cast (t, _) -> signature_concl t + | Cic.Prod (_, s, t) -> + UriManagerSet.union (signature_concl s) (signature_concl t) + | Cic.Lambda (_, s, t) -> + UriManagerSet.union (signature_concl s) (signature_concl t) + | Cic.LetIn (_, s, t) -> + UriManagerSet.union (signature_concl s) (signature_concl t) + | Cic.Appl l -> add l + | Cic.MutCase _ + | Cic.Fix _ + | Cic.CoFix _ -> + UriManagerSet.empty + +let rec signature_of = function + | Cic.Cast (t, _) -> signature_of t + | Cic.Prod (_, _, t) -> signature_of t + | Cic.LetIn (_, _, t) -> signature_of t + | Cic.Appl ((Cic.Const (u,exp_named_subst))::l) -> + Some (u, []), add l + | Cic.Appl ((Cic.MutInd (u, t, exp_named_subst))::l) -> + let suri = UriManager.uri_of_uriref u t None in + if LibraryObjects.is_eq_URI u then + (* equality is handled in a special way: in particular, + the type, if defined, is always added to the prefix, + and n is not decremented - it should have been n-2 *) + match l with + Cic.Const (u1,exp_named_subst1)::l1 -> + let inconcl = UriManagerSet.remove u1 (add l1) in + Some (suri, [u1]), inconcl + | Cic.MutInd (u1, t1, exp_named_subst1)::l1 -> + let suri1 = UriManager.uri_of_uriref u1 t1 None in + let inconcl = UriManagerSet.remove suri1 (add l1) in + Some (suri, [suri1]), inconcl + | Cic.MutConstruct (u1, t1, c1, exp_named_subst1)::l1 -> + let suri1 = UriManager.uri_of_uriref u1 t1 (Some c1) in + let inconcl = UriManagerSet.remove suri1 (add l1) in + Some (suri, [suri1]), inconcl + | _ :: tl -> Some (suri, []), add tl + | _ -> assert false (* args number must be > 0 *) + else + Some (suri, []), add l + | Cic.Appl ((Cic.MutConstruct (u, t, c, exp_named_subst))::l) -> + let suri = UriManager.uri_of_uriref u t (Some c) in + Some (suri, []), add l + | t -> None, signature_concl t + +(* takes a list of lists and returns the list of all elements + without repetitions *) +let union l = + let rec drop_repetitions = function + [] -> [] + | [a] -> [a] + | u1::u2::l when u1 = u2 -> drop_repetitions (u2::l) + | u::l -> u::(drop_repetitions l) in + drop_repetitions (List.sort Pervasives.compare (List.concat l)) + +let must_of_prefix ?(where = `Conclusion) m s = + let positions = + match where with + | `Conclusion -> [`InConclusion] + | `Statement -> [`InConclusion; `InHypothesis; `MainHypothesis None] + in + let positions = + if m = None then `MainConclusion None :: positions else positions in + let s' = List.map (fun (u:UriManager.uri) -> `Obj (u, positions)) s in + match m with + None -> s' + | Some m -> `Obj (m, [`MainConclusion None]) :: s' + +let escape = Str.global_replace (Str.regexp_string "\'") "\\'" + +let get_constants (dbd:HSql.dbd) ~where uri = + let uri = escape (UriManager.string_of_uri uri) in + let positions = + match where with + | `Conclusion -> [ MetadataTypes.mainconcl_pos; MetadataTypes.inconcl_pos ] + | `Statement -> + [ MetadataTypes.mainconcl_pos; MetadataTypes.inconcl_pos; + MetadataTypes.inhyp_pos; MetadataTypes.mainhyp_pos ] + in + let pos_predicate = + String.concat " OR " + (List.map (fun pos -> sprintf "(h_position = \"%s\")" pos) positions) + in + let query tbl = + sprintf "SELECT h_occurrence FROM %s WHERE source=\"%s\" AND (%s)" + tbl uri pos_predicate + in + let db = [ + HSql.Library, MetadataTypes.library_obj_tbl; + HSql.Legacy, MetadataTypes.library_obj_tbl; + HSql.User, MetadataTypes.obj_tbl ()] + in + let set = ref UriManagerSet.empty in + List.iter + (fun (dbtype, table) -> + let result = HSql.exec dbtype dbd (query table) in + HSql.iter result + (fun col -> + match col.(0) with + | Some uri -> + set := UriManagerSet.add (UriManager.uri_of_string uri) !set + | _ -> assert false)) + db; + !set + +let at_most ~(dbd:HSql.dbd) ?(where = `Conclusion) only u = + let inconcl = get_constants dbd ~where u in + UriManagerSet.subset inconcl only + + (* Special handling of equality. The problem is filtering out theorems just + * containing variables (e.g. all the theorems in cic:/Coq/Ring/). Really + * ad-hoc, no better solution found at the moment *) +let myspeciallist_of_facts = + [0,UriManager.uri_of_string "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)"] +let myspeciallist = + [0,UriManager.uri_of_string "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)"; + (* 0,"cic:/Coq/Init/Logic/sym_eq.con"; *) + 0,UriManager.uri_of_string "cic:/Coq/Init/Logic/trans_eq.con"; + 0,UriManager.uri_of_string "cic:/Coq/Init/Logic/f_equal.con"; + 0,UriManager.uri_of_string "cic:/Coq/Init/Logic/f_equal2.con"; + 0,UriManager.uri_of_string "cic:/Coq/Init/Logic/f_equal3.con"] + + +let compute_exactly ~(dbd:HSql.dbd) ?(facts=false) ~where main prefixes = + List.concat + (List.map + (fun (m,s) -> + let is_eq,card = + match main with + None -> false,m + | Some main -> + (m = 0 && + UriManager.eq main + (UriManager.uri_of_string (HelmLibraryObjects.Logic.eq_XURI))), + m+1 + in + if m = 0 && is_eq then + (if facts then myspeciallist_of_facts + else myspeciallist) + else + let res = + (* this gets rid of the ~750 objects of type Set/Prop/Type *) + if card = 0 then [] + else + let must = must_of_prefix ~where main s in + match where with + | `Conclusion -> at_least ~dbd ~concl_card:(Eq card) must + | `Statement -> at_least ~dbd ~full_card:(Eq card) must + in + List.map (fun uri -> (card, uri)) res) + prefixes) + + (* critical value reached, fallback to "only" constraints *) + +let compute_with_only ~(dbd:HSql.dbd) ?(facts=false) ?(where = `Conclusion) + main prefixes constants += + let max_prefix_length = + match prefixes with + | [] -> assert false + | (max,_)::_ -> max in + let maximal_prefixes = + let rec filter res = function + [] -> res + | (n,s)::l when n = max_prefix_length -> filter ((n,s)::res) l + | _::_-> res in + filter [] prefixes in + let greater_than = + let all = + union + (List.map + (fun (m,s) -> + let card = if main = None then m else m + 1 in + let must = must_of_prefix ~where main s in + (let res = + match where with + | `Conclusion -> at_least ~dbd ~concl_card:(Gt card) must + | `Statement -> at_least ~dbd ~full_card:(Gt card) must + in + (* we tag the uri with m+1, for sorting purposes *) + List.map (fun uri -> (card, uri)) res)) + maximal_prefixes) + in +(* Printf.fprintf stderr "all: %d\n" (List.length all);flush_all (); *) +(* + List.filter (function (_,uri) -> + at_most ~dbd ~where constants uri) +*) + all + in + let equal_to = compute_exactly ~dbd ~facts ~where main prefixes in + greater_than @ equal_to + + (* real match query implementation *) + +let cmatch ~(dbd:HSql.dbd) ?(facts=false) t = + let (main, constants) = signature_of t in + match main with + | None -> [] + | Some (main, types) -> + (* the type of eq is not counted in constants_no *) + let types_no = List.length types in + let constants_no = UriManagerSet.cardinal constants in + if (constants_no > critical_value) then + let prefixes = prefixes just_factor t in + (match prefixes with + | Some main, all_concl -> + let all_constants = + List.fold_right UriManagerSet.add types (UriManagerSet.add main constants) + in + compute_with_only ~dbd ~facts (Some main) all_concl all_constants + | _, _ -> []) + else + (* in this case we compute all prefixes, and we do not need + to apply the only constraints *) + let prefixes = + if constants_no = 0 then + (if types_no = 0 then + Some main, [0, []] + else + Some main, [0, []; types_no, types]) + else + prefixes (constants_no+types_no+1) t + in + (match prefixes with + Some main, all_concl -> + compute_exactly ~dbd ~facts ~where:`Conclusion (Some main) all_concl + | _, _ -> []) + +let power_upto upto consts = + let l = UriManagerSet.elements consts in + List.sort (fun (n,_) (m,_) -> m - n) + (List.fold_left + (fun res a -> + let res' = + List.filter (function (n,l) -> n <= upto) + (List.map (function (n,l) -> (n+1,a::l)) res) in + res@res') + [(0,[])] l) + +let power consts = + let l = UriManagerSet.elements consts in + List.sort (fun (n,_) (m,_) -> m - n) + (List.fold_left + (fun res a -> res@(List.map (function (n,l) -> (n+1,a::l)) res)) + [(0,[])] l) + +type where = [ `Conclusion | `Statement ] + +let sigmatch ~(dbd:HSql.dbd) ?(facts=false) ?(where = `Conclusion) + (main, constants) += + let main,types = + match main with + None -> None,[] + | Some (main, types) -> Some main,types + in + let constants_no = UriManagerSet.cardinal constants in + (* prerr_endline (("constants_no: ")^(string_of_int constants_no)); *) + if (constants_no > critical_value) then + let subsets = + let subsets = power_upto just_factor constants in + (* let _ = prerr_endline (("subsets: ")^ + (string_of_int (List.length subsets))) in *) + let types_no = List.length types in + if types_no > 0 then + List.map (function (n,l) -> (n+types_no,types@l)) subsets + else subsets + in + prerr_endline ("critical_value exceded..." ^ string_of_int constants_no); + let all_constants = + let all = match main with None -> types | Some m -> m::types in + List.fold_right UriManagerSet.add all constants + in + compute_with_only ~dbd ~where main subsets all_constants + else + (prerr_endline ("all subsets..." ^ string_of_int constants_no); + let subsets = + let subsets = power constants in + let types_no = List.length types in + if types_no > 0 then + (0,[]) :: List.map (function (n,l) -> (n+types_no,types@l)) subsets + else subsets + in + prerr_endline "fine1"; + compute_exactly ~dbd ~facts ~where main subsets) + + (* match query wrappers *) + +let cmatch'= cmatch + +let cmatch ~dbd ?(facts=false) term = + List.map snd + (List.sort + (fun x y -> Pervasives.compare (fst y) (fst x)) + (cmatch' ~dbd ~facts term)) + +let constants_of = signature_concl + diff --git a/components/metadata/metadataConstraints.mli b/components/metadata/metadataConstraints.mli new file mode 100644 index 000000000..bc83f65d7 --- /dev/null +++ b/components/metadata/metadataConstraints.mli @@ -0,0 +1,112 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +module UriManagerSet : Set.S with type elt = UriManager.uri +module SetSet: Set.S with type elt = UriManagerSet.t + + (** @return + * main: constant in main position and, for polymorphic constants, type + * instantitation + * constants: constants appearing in term *) +type term_signature = (UriManager.uri * UriManager.uri list) option * UriManagerSet.t + +(** {2 Candidates filtering} *) + + (** @return sorted list of theorem URIs, first URIs in the least have higher + * relevance *) +val cmatch: dbd:HSql.dbd -> ?facts:bool -> Cic.term -> UriManager.uri list + + (** as cmatch, but returned list is not sorted but rather tagged with + * relevance information: higher the tag, higher the relevance *) +val cmatch': dbd:HSql.dbd -> ?facts:bool -> Cic.term -> (int * UriManager.uri) list + +type where = [ `Conclusion | `Statement ] (** signature matching extent *) + + (** @param where defaults to `Conclusion *) +val sigmatch: + dbd:HSql.dbd -> + ?facts:bool -> + ?where:where -> + term_signature -> + (int * UriManager.uri) list + +(** {2 Constraint engine} *) + + (** constraing on the number of distinct constants *) +type cardinality_condition = + | Eq of int + | Gt of int + | Lt of int + +type rating_criterion = + [ `Hits (** order by number of hits, most used objects first *) + ] + +val add_constraint: + ?start:int -> + ?tables:string * string * string * string -> + int * string list * string list -> + MetadataTypes.constr -> + int * string list * string list + + (** @param concl_card cardinality condition on conclusion only + * @param full_card cardinality condition on the whole statement + * @param diff required difference between the number of different constants in + * hypothesis and the number of different constants in body + * @return list of URI satisfying given constraints *) + +val at_least: + dbd:HSql.dbd -> + ?concl_card:cardinality_condition -> + ?full_card:cardinality_condition -> + ?diff:cardinality_condition -> + ?rating:rating_criterion -> + MetadataTypes.constr list -> + UriManager.uri list + + (** @param where defaults to `Conclusion *) +val at_most: + dbd:HSql.dbd -> + ?where:where -> UriManagerSet.t -> + (UriManager.uri -> bool) + +val add_all_constr: + ?tbl:string -> + int * string list * string list -> + cardinality_condition option -> + cardinality_condition option -> + cardinality_condition option -> + int * string list * string list + +val exec: + HSql.dbtype -> + dbd:HSql.dbd -> + ?rating:[ `Hits ] -> + int * string list * string list -> + UriManager.uri list + +val signature_of: Cic.term -> term_signature +val constants_of: Cic.term -> UriManagerSet.t + diff --git a/components/metadata/metadataDb.ml b/components/metadata/metadataDb.ml new file mode 100644 index 000000000..844a08347 --- /dev/null +++ b/components/metadata/metadataDb.ml @@ -0,0 +1,224 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open MetadataTypes + +open Printf + +let format_insert dbtype dbd tbl tuples = + if HSql.isMysql dbtype dbd then + [sprintf "INSERT %s VALUES %s;" tbl (String.concat "," tuples)] + else + List.map (fun tup -> + sprintf "INSERT INTO %s VALUES %s;" tbl tup) tuples +;; + +let execute_insert dbd uri (sort_cols, rel_cols, obj_cols) = + let sort_tuples = + List.fold_left (fun s l -> match l with + | [`String a; `String b; `Int c; `String d] -> + sprintf "(\"%s\", \"%s\", %d, \"%s\")" a b c d :: s + | _ -> assert false ) + [] sort_cols + in + let rel_tuples = + List.fold_left (fun s l -> match l with + | [`String a; `String b; `Int c] -> + sprintf "(\"%s\", \"%s\", %d)" a b c :: s + | _ -> assert false) + [] rel_cols + in + let obj_tuples = List.fold_left (fun s l -> match l with + | [`String a; `String b; `String c; `Int d] -> + sprintf "(\"%s\", \"%s\", \"%s\", %d)" a b c d :: s + | [`String a; `String b; `String c; `Null] -> + sprintf "(\"%s\", \"%s\", \"%s\", %s)" a b c "NULL" :: s + | _ -> assert false) + [] obj_cols + in + let dbtype = + if Helm_registry.get_bool "matita.system" then HSql.Library else HSql.User + in + if sort_tuples <> [] then + begin + let query_sort = + format_insert dbtype dbd (sort_tbl ()) sort_tuples + in + List.iter (fun query -> ignore (HSql.exec dbtype dbd query)) query_sort + end; + if rel_tuples <> [] then + begin + let query_rel = + format_insert dbtype dbd (rel_tbl ()) rel_tuples + in + List.iter (fun query -> ignore (HSql.exec dbtype dbd query)) query_rel + end; + if obj_tuples <> [] then + begin + let query_obj = + format_insert dbtype dbd (obj_tbl ()) obj_tuples + in + List.iter (fun query -> ignore (HSql.exec dbtype dbd query)) query_obj + end + + +let count_distinct position l = + MetadataConstraints.UriManagerSet.cardinal + (List.fold_left (fun acc d -> + match position with + | `Conclusion -> + (match d with + | `Obj (name,`InConclusion) + | `Obj (name,`MainConclusion _ ) -> + MetadataConstraints.UriManagerSet.add name acc + | _ -> acc) + | `Hypothesis -> + (match d with + | `Obj (name,`InHypothesis) + | `Obj (name,`MainHypothesis _) -> + MetadataConstraints.UriManagerSet.add name acc + | _ -> acc) + | `Statement -> + (match d with + | `Obj (name,`InBody) -> acc + | `Obj (name,_) -> MetadataConstraints.UriManagerSet.add name acc + | _ -> acc) + ) MetadataConstraints.UriManagerSet.empty l) + +let insert_const_no ~dbd l = + let data = + List.fold_left + (fun acc (uri,_,metadata) -> + let no_concl = count_distinct `Conclusion metadata in + let no_hyp = count_distinct `Hypothesis metadata in + let no_full = count_distinct `Statement metadata in + (sprintf "(\"%s\", %d, %d, %d)" + (UriManager.string_of_uri uri) no_concl no_hyp no_full) :: acc + ) [] l in + let dbtype = + if Helm_registry.get_bool "matita.system" then HSql.Library else HSql.User + in + let insert = + format_insert dbtype dbd (count_tbl ()) data + in + List.iter (fun query -> ignore (HSql.exec dbtype dbd query)) insert + +let insert_name ~dbd l = + let dbtype = + if Helm_registry.get_bool "matita.system" then HSql.Library else HSql.User + in + let data = + List.fold_left + (fun acc (uri,name,_) -> + (sprintf "(\"%s\", \"%s\")" (UriManager.string_of_uri uri) name) :: acc + ) [] l in + let insert = + format_insert dbtype dbd (name_tbl ()) data + in + List.iter (fun query -> ignore (HSql.exec dbtype dbd query)) insert + +type columns = + MetadataPp.t list list * MetadataPp.t list list * MetadataPp.t list list + + (* TODO ZACK: verify if an object has already been indexed *) +let already_indexed _ = false + +(***** TENTATIVE HACK FOR THE DB SLOWDOWN - BEGIN *******) +let analyze_index = ref 0 +let eventually_analyze dbd = + incr analyze_index; + if !analyze_index > 30 then + if HSql.isMysql HSql.User dbd then + begin + let analyze t = "OPTIMIZE TABLE " ^ t ^ ";" in + List.iter + (fun table -> ignore (HSql.exec HSql.User dbd (analyze table))) + [name_tbl (); rel_tbl (); sort_tbl (); obj_tbl(); count_tbl()] + end + +(***** TENTATIVE HACK FOR THE DB SLOWDOWN - END *******) + +let index_obj ~dbd ~uri = + if not (already_indexed uri) then begin + eventually_analyze dbd; + let metadata = MetadataExtractor.compute_obj uri in + let uri = UriManager.string_of_uri uri in + let columns = MetadataPp.columns_of_metadata metadata in + execute_insert dbd uri (columns :> columns); + insert_const_no ~dbd metadata; + insert_name ~dbd metadata + end + + +let tables_to_clean = + [sort_tbl; rel_tbl; obj_tbl; name_tbl; count_tbl] + +let clean ~(dbd:HSql.dbd) = + let owned_uris = (* list of uris in list-of-columns format *) + let query = sprintf "SELECT source FROM %s" (name_tbl ()) in + let result = HSql.exec HSql.User dbd query in + let uris = HSql.map result (fun cols -> + match cols.(0) with + | Some src -> src + | None -> assert false) in + (* and now some stuff to remove #xpointers and duplicates *) + uris + in + let del_from tbl = + let escape s = + Pcre.replace ~pat:"([^\\\\])_" ~templ:"$1\\_" (HSql.escape HSql.User dbd s) + in + let query s = + sprintf + ("DELETE FROM %s WHERE source LIKE \"%s%%\" " ^^ + HSql.escape_string_for_like HSql.User dbd) + (tbl ()) (escape s) + in + List.iter + (fun source_col -> ignore (HSql.exec HSql.User dbd (query source_col))) + owned_uris + in + List.iter del_from tables_to_clean; + owned_uris + +let unindex ~dbd ~uri = + let uri = UriManager.string_of_uri uri in + let del_from tbl = + let escape s = + Pcre.replace + ~pat:"([^\\\\])_" ~templ:"$1\\_" (HSql.escape HSql.User dbd s) + in + let query tbl = + sprintf + ("DELETE FROM %s WHERE source LIKE \"%s%%\" " ^^ + HSql.escape_string_for_like HSql.User dbd) + (tbl ()) (escape uri) + in + ignore (HSql.exec HSql.User dbd (query tbl)) + in + List.iter del_from tables_to_clean + diff --git a/components/metadata/metadataDb.mli b/components/metadata/metadataDb.mli new file mode 100644 index 000000000..b1acc4cbe --- /dev/null +++ b/components/metadata/metadataDb.mli @@ -0,0 +1,41 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + + +val index_obj: dbd:HSql.dbd -> uri:UriManager.uri -> unit + +(* TODO Zack indexing of variables and (perhaps?) incomplete proofs *) + + (** remove from the db all metadata pertaining to a given owner + * @return list of uris removed from the db *) +val clean: dbd:HSql.dbd -> string list + +val unindex: dbd:HSql.dbd -> uri:UriManager.uri -> unit + +val count_distinct: + [`Conclusion | `Hypothesis | `Statement ] -> + MetadataTypes.metadata list -> + int diff --git a/components/metadata/metadataDeps.ml b/components/metadata/metadataDeps.ml new file mode 100644 index 000000000..d34bd1c83 --- /dev/null +++ b/components/metadata/metadataDeps.ml @@ -0,0 +1,305 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Printf + +open MetadataTypes + +module Pp = GraphvizPp.Dot +module UriSet = UriManager.UriSet + +let strip_prefix s = + let prefix_len = String.length position_prefix in + String.sub s prefix_len (String.length s - prefix_len) + +let parse_pos = + function + | Some s, Some d -> + (match strip_prefix s with + | "MainConclusion" -> `MainConclusion (Some (Eq (int_of_string d))) + | "MainHypothesis" -> `MainHypothesis (Some (Eq (int_of_string d))) + | s -> + prerr_endline ("Invalid main position: " ^ s); + assert false) + | Some s, None -> + (match strip_prefix s with + | "InConclusion" -> `InConclusion + | "InHypothesis" -> `InHypothesis + | "InBody" -> `InBody + | s -> + prerr_endline ("Invalid position: " ^ s); + assert false) + | _ -> assert false + +let unbox_row = function `Obj (uri, pos) -> (uri, pos) + +let direct_deps ~dbd uri = + let obj_metadata_of_row = + function + | [| Some _; Some occurrence; pos; depth |] -> + `Obj (UriManager.uri_of_string occurrence, parse_pos (pos, depth)) + | _ -> + prerr_endline "invalid (direct) refObj metadata row"; + assert false + in + let do_query (dbtype, tbl) = + let res = + HSql.exec dbtype dbd (SqlStatements.direct_deps tbl uri dbtype dbd) + in + let deps = + HSql.map res (fun row -> unbox_row (obj_metadata_of_row row)) in + deps + in + do_query (HSql.User, MetadataTypes.obj_tbl ()) + @ do_query (HSql.Library, MetadataTypes.library_obj_tbl) + @ do_query (HSql.Legacy, MetadataTypes.library_obj_tbl) + +let inverse_deps ~dbd uri = + let inv_obj_metadata_of_row = + function + | [| Some src; Some _; pos; depth |] -> + `Obj (UriManager.uri_of_string src, parse_pos (pos, depth)) + | _ -> + prerr_endline "invalid (inverse) refObj metadata row"; + assert false + in + let do_query (dbtype, tbl) = + let res = + HSql.exec dbtype dbd (SqlStatements.inverse_deps tbl uri dbtype dbd) + in + let deps = + HSql.map res (fun row -> unbox_row (inv_obj_metadata_of_row row)) in + deps + in + do_query (HSql.User, MetadataTypes.obj_tbl ()) + @ do_query (HSql.Library, MetadataTypes.library_obj_tbl) + @ do_query (HSql.Legacy, MetadataTypes.library_obj_tbl) + +let topological_sort ~dbd uris = + let module OrderedUri = + struct + type t = UriManager.uri + let compare = UriManager.compare + end in + let module Topo = HTopoSort.Make(OrderedUri) in + Topo.topological_sort uris + (fun uri -> fst (List.split (direct_deps ~dbd uri))) + +let sorted_uris_of_baseuri ~dbd baseuri = + let sql_pat = + Pcre.replace ~pat:"([^\\\\])_" ~templ:"$1\\_" baseuri ^ "%" + in + let query dbtype tbl = + Printf.sprintf + ("SELECT source FROM %s WHERE source LIKE \"%s\" " + ^^ HSql.escape_string_for_like dbtype dbd) + tbl sql_pat + in + let map cols = match cols.(0) with + | Some s -> UriManager.uri_of_string s + | _ -> assert false + in + let uris = + List.fold_left + (fun acc (dbtype, table) -> + let result = HSql.exec dbtype dbd (query dbtype table) in + HSql.map result map @ acc) + [] + [HSql.User, MetadataTypes.name_tbl (); + HSql.Library, MetadataTypes.library_name_tbl; + HSql.Legacy, MetadataTypes.library_name_tbl] + in + let sorted_uris = topological_sort ~dbd uris in + let filter_map uri = + let s = + Pcre.replace ~rex:(Pcre.regexp "#xpointer\\(1/1\\)") ~templ:"" + (UriManager.string_of_uri uri) + in + try ignore (Pcre.exec ~rex:(Pcre.regexp"#xpointer") s); None + with Not_found -> Some (UriManager.uri_of_string s) + in + HExtlib.filter_map filter_map sorted_uris + +module DepGraph = +struct + module UriTbl = UriManager.UriHashtbl + + let fat_value = 20 + let fat_increment = fat_value + let incomplete_attrs = ["style", "dashed"] + let global_node_attrs = ["fontsize", "12"; "width", ".4"; "height", ".4"] + + let label_of_uri uri = UriManager.name_of_uri uri + (*let label_of_uri uri = UriManager.string_of_uri uri*) + + type neighborhood = + { adjacency: UriManager.uri list lazy_t; (* all outgoing edges *) + mutable shown: int (* amount of edges to show *) + } + + (** + * All dependency graph have a single root, it is kept here to have a + * starting point for graph traversals *) + type t = + neighborhood UriTbl.t * UriManager.uri + * (UriManager.uri -> UriManager.uri list) * bool + + let dummy = + UriTbl.create 0, UriManager.uri_of_string "cic:/a.con", + (fun _ -> []), false + + let render fmt (adjlist, root, _f, invert) = + let is_complete uri = + try + let neighbs = UriTbl.find adjlist uri in + Lazy.lazy_is_val neighbs.adjacency + && neighbs.shown >= List.length (Lazy.force neighbs.adjacency) + with Not_found -> + (*eprintf "Node '%s' not found.\n" (UriManager.string_of_uri uri);*) + assert false + in + Pp.header ~graph_type:"strict digraph" ~graph_attrs:["rankdir", "LR"] ~node_attrs:global_node_attrs fmt; + let rec aux = + function + | [] -> () + | uri :: tl -> + let suri = UriManager.string_of_uri uri in + Pp.node suri + ~attrs:([ "href", UriManager.string_of_uri uri; + "label", label_of_uri uri + ] @ (if is_complete uri then [] else incomplete_attrs)) + fmt; + let new_nodes = ref [] in + (try + let neighbs = UriTbl.find adjlist uri in + if Lazy.lazy_is_val neighbs.adjacency then begin + let adjacency, _ = + HExtlib.split_nth neighbs.shown (Lazy.force neighbs.adjacency) + in + List.iter + (fun dest -> + let uri1, uri2 = if invert then dest, uri else uri, dest in + Pp.edge (UriManager.string_of_uri uri1) + (UriManager.string_of_uri uri2) fmt) + adjacency; + new_nodes := adjacency + end; + with Not_found -> ()); + aux (!new_nodes @ tl) + in + aux [root]; + Pp.trailer fmt + + let expand uri (adjlist, _root, f, _invert) = + (*eprintf "expanding uri %s\n%!" (UriManager.string_of_uri uri);*) + try + let neighbs = UriTbl.find adjlist uri in + if not (Lazy.lazy_is_val neighbs.adjacency) then + (* node has never been expanded *) + let adjacency = Lazy.force neighbs.adjacency in + let weight = min (List.length adjacency) fat_value in + List.iter + (fun dest -> + (* perform look ahead of 1 edge to avoid making as expandable nodes + * which have no outgoing edges *) + let next_level = f dest in + let neighborhood = + if List.length next_level = 0 then begin + (* no further outgoing edges, "expand" the node right now *) + let lazy_val = lazy next_level in + ignore (Lazy.force lazy_val); + { adjacency = lazy_val; shown = 0 } + end else + { adjacency = lazy next_level; shown = 0 } + in + (*UriTbl.add adjlist dest { adjacency = lazy (f dest); shown = 0 }*) + UriTbl.add adjlist dest neighborhood) + adjacency; + neighbs.shown <- weight; + fst (HExtlib.split_nth weight adjacency), weight + else begin (* nodes has been expanded at least once *) + let adjacency = Lazy.force neighbs.adjacency in + let total_nodes = List.length adjacency in + if neighbs.shown < total_nodes then begin + (* some more children to show ... *) + let shown_before = neighbs.shown in + neighbs.shown <- min (neighbs.shown + fat_increment) total_nodes; + let new_shown = neighbs.shown - shown_before in + (fst (HExtlib.split_nth new_shown (List.rev adjacency))), new_shown + end else + [], 0 (* all children are already shown *) + end + with Not_found -> + (*eprintf "uri not found: %s\n%!" (UriManager.string_of_uri uri);*) + [], 0 + + let collapse uri (adjlist, _root, f, _invert) = + try + let neighbs = UriTbl.find adjlist uri in + if Lazy.lazy_is_val neighbs.adjacency then + (* do not collapse already collapsed nodes *) + if Lazy.force neighbs.adjacency <> [] then + (* do not collapse nodes with no outgoing edges *) + UriTbl.replace adjlist uri { adjacency = lazy (f uri); shown = 0 } + with Not_found -> + (* do not add a collapsed node if it was not part of the graph *) + () + + let graph_of_fun ?(invert = false) f ~dbd uri = + let f ~dbd uri = + (*eprintf "invoking graph fun on %s...\n%!" (UriManager.string_of_uri uri);*) + let uris = fst (List.split (f ~dbd uri)) in + let uriset = List.fold_right UriSet.add uris UriSet.empty in + let res = UriSet.elements uriset in + (*eprintf "returned uris: %s\n%!"*) + (*(String.concat " " (List.map UriManager.string_of_uri res));*) + res + in + let adjlist = UriTbl.create 17 in + let gen_f = f ~dbd in + UriTbl.add adjlist uri { adjacency = lazy (gen_f uri); shown = 0 }; + let dep_graph = adjlist, uri, gen_f, invert in + let rec rec_expand weight = + function + | [] -> () + | uri :: tl when weight >= fat_value -> () + | uri :: tl -> + let new_nodes, increase = expand uri dep_graph in + rec_expand (weight + increase) (new_nodes @ tl) in + rec_expand 1 [uri]; + dep_graph + + let direct_deps = graph_of_fun direct_deps + let inverse_deps = graph_of_fun ~invert:true inverse_deps + + let expand uri graph = + try + ignore (expand uri graph) + with Not_found -> () +end + diff --git a/components/metadata/metadataDeps.mli b/components/metadata/metadataDeps.mli new file mode 100644 index 000000000..12b502cd0 --- /dev/null +++ b/components/metadata/metadataDeps.mli @@ -0,0 +1,62 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** @return the one step direct dependencies of an object, specified by URI + * (that is, the list of objects on which an given one depends) *) +val direct_deps: + dbd:HSql.dbd -> + UriManager.uri -> (UriManager.uri * MetadataTypes.position) list + + (** @return the one step inverse dependencies of an objects, specified by URI + * (that is, the list of objects which depends on a given object) *) +val inverse_deps: + dbd:HSql.dbd -> + UriManager.uri -> (UriManager.uri * MetadataTypes.position) list + +val topological_sort: + dbd:HSql.dbd -> UriManager.uri list -> UriManager.uri list + +val sorted_uris_of_baseuri: + dbd:HSql.dbd -> string -> UriManager.uri list + + (** Representation of a (lazy) dependency graph. + * Imperative data structure. *) +module DepGraph: +sig + type t + + val dummy: t + + val expand: UriManager.uri -> t -> unit (** ignores uri not found *) + val collapse: UriManager.uri -> t -> unit (** ignores uri not found *) + val render: Format.formatter -> t -> unit + + (** @return the transitive closure of direct_deps *) + val direct_deps: dbd:HSql.dbd -> UriManager.uri -> t + + (** @return the transitive closure of inverse_deps *) + val inverse_deps: dbd:HSql.dbd -> UriManager.uri -> t +end + diff --git a/components/metadata/metadataExtractor.ml b/components/metadata/metadataExtractor.ml new file mode 100644 index 000000000..4fbae1ba7 --- /dev/null +++ b/components/metadata/metadataExtractor.ml @@ -0,0 +1,350 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open MetadataTypes + +let is_main_pos = function + | `MainConclusion _ + | `MainHypothesis _ -> true + | _ -> false + +let main_pos (pos: position): main_position = + match pos with + | `MainConclusion depth -> `MainConclusion depth + | `MainHypothesis depth -> `MainHypothesis depth + | _ -> assert false + +let next_pos = function + | `MainConclusion _ -> `InConclusion + | `MainHypothesis _ -> `InHypothesis + | pos -> pos + +let string_of_uri = UriManager.string_of_uri + +module OrderedMetadata = + struct + type t = MetadataTypes.metadata + let compare m1 m2 = (* ignore universes in Cic.Type sort *) + match (m1, m2) with + | `Sort (Cic.Type _, pos1), `Sort (Cic.Type _, pos2) -> + Pervasives.compare pos1 pos2 + | _ -> Pervasives.compare m1 m2 + end + +module MetadataSet = Set.Make (OrderedMetadata) +module UriManagerSet = UriManager.UriSet + +module S = MetadataSet + +let unopt = function Some x -> x | None -> assert false + +let incr_depth = function + | `MainConclusion (Some (Eq depth)) -> `MainConclusion (Some (Eq (depth + 1))) + | `MainHypothesis (Some (Eq depth)) -> `MainHypothesis (Some (Eq (depth + 1))) + | _ -> assert false + +let var_has_body uri = + match CicEnvironment.get_obj CicUniv.empty_ugraph uri with + | Cic.Variable (_, Some body, _, _, _), _ -> true + | _ -> false + +let compute_term pos term = + let rec aux (pos: position) set = function + | Cic.Var (uri, subst) when var_has_body uri -> + (* handles variables with body as constants *) + aux pos set (Cic.Const (uri, subst)) + | Cic.Rel _ + | Cic.Var _ -> + if is_main_pos pos then + S.add (`Rel (main_pos pos)) set + else + set + | Cic.Meta (_, local_context) -> + List.fold_left + (fun set context -> + match context with + | None -> set + | Some term -> aux (next_pos pos) set term) + set + local_context + | Cic.Sort sort -> + if is_main_pos pos then + S.add (`Sort (sort, main_pos pos)) set + else + set + | Cic.Implicit _ -> assert false + | Cic.Cast (term, ty) -> + (* TODO consider also ty? *) + aux pos set term + | Cic.Prod (_, source, target) -> + (match pos with + | `MainConclusion _ -> + let set = aux (`MainHypothesis (Some (Eq 0))) set source in + aux (incr_depth pos) set target + | `MainHypothesis _ -> + let set = aux `InHypothesis set source in + aux (incr_depth pos) set target + | `InConclusion + | `InHypothesis + | `InBody -> + let set = aux pos set source in + aux pos set target) + | Cic.Lambda (_, source, target) -> + (*assert (not (is_main_pos pos));*) + let set = aux (next_pos pos) set source in + aux (next_pos pos) set target + | Cic.LetIn (_, term, target) -> + if is_main_pos pos then + aux pos set (CicSubstitution.subst term target) + else + let set = aux pos set term in + aux pos set target + | Cic.Appl [] -> assert false + | Cic.Appl (hd :: tl) -> + let set = aux pos set hd in + List.fold_left + (fun set term -> aux (next_pos pos) set term) + set tl + | Cic.Const (uri, subst) -> + let set = S.add (`Obj (uri, pos)) set in + List.fold_left + (fun set (_, term) -> aux (next_pos pos) set term) + set subst + | Cic.MutInd (uri, typeno, subst) -> + let uri = UriManager.uri_of_uriref uri typeno None in + let set = S.add (`Obj (uri, pos)) set in + List.fold_left (fun set (_, term) -> aux (next_pos pos) set term) + set subst + | Cic.MutConstruct (uri, typeno, consno, subst) -> + let uri = UriManager.uri_of_uriref uri typeno (Some consno) in + let set = S.add (`Obj (uri, pos)) set in + List.fold_left (fun set (_, term) -> aux (next_pos pos) set term) + set subst + | Cic.MutCase (uri, _, outtype, term, pats) -> + let pos = next_pos pos in + let set = aux pos set term in + let set = aux pos set outtype in + List.fold_left (fun set term -> aux pos set term) set pats + | Cic.Fix (_, funs) -> + let pos = next_pos pos in + List.fold_left + (fun set (_, _, ty, body) -> + let set = aux pos set ty in + aux pos set body) + set funs + | Cic.CoFix (_, funs) -> + let pos = next_pos pos in + List.fold_left + (fun set (_, ty, body) -> + let set = aux pos set ty in + aux pos set body) + set funs + in + aux pos S.empty term + +module OrderedInt = +struct + type t = int + let compare = Pervasives.compare +end + +module IntSet = Set.Make (OrderedInt) + +let compute_metas term = + let rec aux in_hyp ((concl_metas, hyp_metas) as acc) cic = + match cic with + | Cic.Rel _ + | Cic.Sort _ + | Cic.Var _ -> acc + | Cic.Meta (no, local_context) -> + let acc = + if in_hyp then + (concl_metas, IntSet.add no hyp_metas) + else + (IntSet.add no concl_metas, hyp_metas) + in + List.fold_left + (fun set context -> + match context with + | None -> set + | Some term -> aux in_hyp set term) + acc + local_context + | Cic.Implicit _ -> assert false + | Cic.Cast (term, ty) -> + (* TODO consider also ty? *) + aux in_hyp acc term + | Cic.Prod (_, source, target) -> + if in_hyp then + let acc = aux in_hyp acc source in + aux in_hyp acc target + else + let acc = aux true acc source in + aux in_hyp acc target + | Cic.Lambda (_, source, target) -> + let acc = aux in_hyp acc source in + aux in_hyp acc target + | Cic.LetIn (_, term, target) -> + aux in_hyp acc (CicSubstitution.subst term target) + | Cic.Appl [] -> assert false + | Cic.Appl (hd :: tl) -> + let acc = aux in_hyp acc hd in + List.fold_left (fun acc term -> aux in_hyp acc term) acc tl + | Cic.Const (_, subst) + | Cic.MutInd (_, _, subst) + | Cic.MutConstruct (_, _, _, subst) -> + List.fold_left (fun acc (_, term) -> aux in_hyp acc term) acc subst + | Cic.MutCase (uri, _, outtype, term, pats) -> + let acc = aux in_hyp acc term in + let acc = aux in_hyp acc outtype in + List.fold_left (fun acc term -> aux in_hyp acc term) acc pats + | Cic.Fix (_, funs) -> + List.fold_left + (fun acc (_, _, ty, body) -> + let acc = aux in_hyp acc ty in + aux in_hyp acc body) + acc funs + | Cic.CoFix (_, funs) -> + List.fold_left + (fun acc (_, ty, body) -> + let acc = aux in_hyp acc ty in + aux in_hyp acc body) + acc funs + in + aux false (IntSet.empty, IntSet.empty) term + + (** type of inductiveType *) +let compute_type pos uri typeno (name, _, ty, constructors) = + let consno = ref 0 in + let type_metadata = + (UriManager.uri_of_uriref uri typeno None, name, (compute_term pos ty)) + in + let constructors_metadata = + List.map + (fun (name, term) -> + incr consno; + let uri = UriManager.uri_of_uriref uri typeno (Some !consno) in + (uri, name, (compute_term pos term))) + constructors + in + type_metadata :: constructors_metadata + +let compute_ind pos ~uri ~types = + let idx = ref ~-1 in + List.map (fun ty -> incr idx; compute_type pos uri !idx ty) types + +let compute (pos:position) ~body ~ty = + let type_metadata = compute_term pos ty in + let body_metadata = + match body with + | None -> S.empty + | Some body -> compute_term `InBody body + in + let uris = + S.fold + (fun metadata uris -> + match metadata with + | `Obj (uri, _) -> UriManagerSet.add uri uris + | _ -> uris) + type_metadata UriManagerSet.empty + in + S.union + (S.filter + (function + | `Obj (uri, _) when UriManagerSet.mem uri uris -> false + | _ -> true) + body_metadata) + type_metadata + +let depth_offset params = + let non p x = not (p x) in + List.length (List.filter (non var_has_body) params) + +let rec compute_var pos uri = + let o, _ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + | Cic.Variable (_, Some _, _, _, _) -> S.empty + | Cic.Variable (_, None, ty, params, _) -> + let var_metadata = + List.fold_left + (fun metadata uri -> + S.union metadata (compute_var (next_pos pos) uri)) + S.empty + params + in + (match pos with + | `MainHypothesis (Some (Eq 0)) -> + let pos = `MainHypothesis (Some (Eq (depth_offset params))) in + let ty_metadata = compute_term pos ty in + S.union ty_metadata var_metadata + | `InHypothesis -> + let ty_metadata = compute_term pos ty in + S.union ty_metadata var_metadata + | _ -> assert false) + | _ -> assert false + +let compute_obj uri = + let o, _ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + | Cic.Variable (_, body, ty, params, _) + | Cic.Constant (_, body, ty, params, _) -> + let pos = `MainConclusion (Some (Eq (depth_offset params))) in + let metadata = compute pos ~body ~ty in + let var_metadata = + List.fold_left + (fun metadata uri -> + S.union metadata (compute_var (`MainHypothesis (Some (Eq 0))) uri)) + S.empty + params + in + [ uri, + UriManager.name_of_uri uri, + S.union metadata var_metadata ] + | Cic.InductiveDefinition (types, params, _, _) -> + let pos = `MainConclusion(Some (Eq (depth_offset params))) in + let metadata = compute_ind pos ~uri ~types in + let var_metadata = + List.fold_left + (fun metadata uri -> + S.union metadata (compute_var (`MainHypothesis (Some (Eq 0))) uri)) + S.empty params + in + List.fold_left + (fun acc m -> + (List.map (fun (uri,name,md) -> (uri,name,S.union md var_metadata)) m) + @ acc) + [] metadata + | Cic.CurrentProof _ -> assert false + +let compute_obj uri = + List.map (fun (u, n, md) -> (u, n, S.elements md)) (compute_obj uri) + +let compute ~body ~ty = + S.elements (compute (`MainConclusion (Some (Eq 0))) ~body ~ty) + diff --git a/components/metadata/metadataExtractor.mli b/components/metadata/metadataExtractor.mli new file mode 100644 index 000000000..68af269a9 --- /dev/null +++ b/components/metadata/metadataExtractor.mli @@ -0,0 +1,42 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val compute: + body:Cic.term option -> + ty:Cic.term -> + MetadataTypes.metadata list + + (** @return tuples *) +val compute_obj: + UriManager.uri -> + (UriManager.uri * string * MetadataTypes.metadata list) list + +module IntSet: Set.S with type elt = int + + (** given a term, returns a pair of sets corresponding respectively to the set + * of meta numbers occurring in term's conclusion and the set of meta numbers + * occurring in term's hypotheses *) +val compute_metas: Cic.term -> IntSet.t * IntSet.t + diff --git a/components/metadata/metadataPp.ml b/components/metadata/metadataPp.ml new file mode 100644 index 000000000..373ec540f --- /dev/null +++ b/components/metadata/metadataPp.ml @@ -0,0 +1,117 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open MetadataTypes + +let pp_relation r = + match r with + | Eq i -> sprintf "= %d" i + | Ge i -> sprintf ">= %d" i + | Gt i -> sprintf "> %d" i + | Le i -> sprintf "<= %d" i + | Lt i -> sprintf "< %d" i + +let pp_position = function + | `MainConclusion (Some d) -> sprintf "MainConclusion(%s)" (pp_relation d) + | `MainConclusion None -> sprintf "MainConclusion" + | `MainHypothesis (Some d) -> sprintf "MainHypothesis(%s)" (pp_relation d) + | `MainHypothesis None -> "MainHypothesis" + | `InConclusion -> "InConclusion" + | `InHypothesis -> "InHypothesis" + | `InBody -> "InBody" + +let pp_position_tag = function + | `MainConclusion _ -> mainconcl_pos + | `MainHypothesis _ -> mainhyp_pos + | `InConclusion -> inconcl_pos + | `InHypothesis -> inhyp_pos + | `InBody -> inbody_pos + +let columns_of_position pos = + match pos with + | `MainConclusion (Some (Eq d)) -> `String mainconcl_pos, `Int d + | `MainConclusion None -> `String mainconcl_pos, `Null + | `MainHypothesis (Some (Eq d)) -> `String mainhyp_pos, `Int d + | `MainHypothesis None -> `String mainhyp_pos, `Null + | `InConclusion -> `String inconcl_pos, `Null + | `InHypothesis -> `String inhyp_pos, `Null + | `InBody -> `String inbody_pos, `Null + | _ -> assert false + +(* +let metadata_ns = "http://www.cs.unibo.it/helm/schemas/schema-helm" +let uri_of_pos pos = String.concat "#" [metadata_ns; pp_position pos] +*) + +type t = [ `Int of int | `String of string | `Null ] + +let columns_of_metadata_aux ~about metadata = + let sort s = `String (CicPp.ppsort s) in + let source = `String (UriManager.string_of_uri about) in + let occurrence u = `String (UriManager.string_of_uri u) in + List.fold_left + (fun (sort_cols, rel_cols, obj_cols) metadata -> + match metadata with + | `Sort (s, p) -> + let (p, d) = columns_of_position (p :> position) in + [source; p; d; sort s] :: sort_cols, rel_cols, obj_cols + | `Rel p -> + let (p, d) = columns_of_position (p :> position) in + sort_cols, [source; p; d] :: rel_cols, obj_cols + | `Obj (o, p) -> + let (p, d) = columns_of_position p in + sort_cols, rel_cols, + [source; occurrence o; p; d] :: obj_cols) + ([], [], []) metadata + +let columns_of_metadata metadata = + List.fold_left + (fun (sort_cols, rel_cols, obj_cols) (uri, _, metadata) -> + let (s, r, o) = columns_of_metadata_aux ~about:uri metadata in + (List.append sort_cols s, List.append rel_cols r, List.append obj_cols o)) + ([], [], []) metadata + +let pp_constr = + function + | `Sort (sort, p) -> + sprintf "Sort %s; [%s]" + (CicPp.ppsort sort) (String.concat ";" (List.map pp_position p)) + | `Rel p -> sprintf "Rel [%s]" (String.concat ";" (List.map pp_position p)) + | `Obj (uri, p) -> sprintf "Obj %s; [%s]" + (UriManager.string_of_uri uri) (String.concat ";" (List.map pp_position p)) + +(* +let pp_columns ?(sep = "\n") (sort_cols, rel_cols, obj_cols) = + String.concat sep + ([ "Sort" ] @ List.map Dbi.sdebug (sort_cols :> Dbi.sql_t list list) @ + [ "Rel" ] @ List.map Dbi.sdebug (rel_cols :> Dbi.sql_t list list) @ + [ "Obj" ] @ List.map Dbi.sdebug (obj_cols :> Dbi.sql_t list list)) +*) + + diff --git a/components/metadata/metadataPp.mli b/components/metadata/metadataPp.mli new file mode 100644 index 000000000..cffb24c48 --- /dev/null +++ b/components/metadata/metadataPp.mli @@ -0,0 +1,49 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** metadata -> string *) + +val pp_position: MetadataTypes.position -> string +val pp_position_tag: MetadataTypes.position -> string +val pp_constr: MetadataTypes.constr -> string + +(** Pretty printer and OCamlDBI friendly interface *) + +type t = + [ `Int of int + | `String of string + | `Null ] + + (** @return columns for Sort, Rel, and Obj respectively *) +val columns_of_metadata: + (UriManager.uri * string * MetadataTypes.metadata list) list -> + t list list * t list list * t list list + +(* +val pp_columns: ?sep:string -> t list list * t list list * t list list -> string +*) + +val pp_relation: MetadataTypes.relation -> string + diff --git a/components/metadata/metadataTypes.ml b/components/metadata/metadataTypes.ml new file mode 100644 index 000000000..fd61d717e --- /dev/null +++ b/components/metadata/metadataTypes.ml @@ -0,0 +1,115 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let position_prefix = "http://www.cs.unibo.it/helm/schemas/schema-helm#" +(* let position_prefix = "" *) + +let inconcl_pos = position_prefix ^ "InConclusion" +let mainconcl_pos = position_prefix ^ "MainConclusion" +let mainhyp_pos = position_prefix ^ "MainHypothesis" +let inhyp_pos = position_prefix ^ "InHypothesis" +let inbody_pos = position_prefix ^ "InBody" + +type relation = + | Eq of int + | Le of int + | Lt of int + | Ge of int + | Gt of int + +type main_position = + [ `MainConclusion of relation option (* Pi depth *) + | `MainHypothesis of relation option (* Pi depth *) + ] + +type position = + [ main_position + | `InConclusion + | `InHypothesis + | `InBody + ] + +type pi_depth = int + +type metadata = + [ `Sort of Cic.sort * main_position + | `Rel of main_position + | `Obj of UriManager.uri * position + ] + +type constr = + [ `Sort of Cic.sort * main_position list + | `Rel of main_position list + | `Obj of UriManager.uri * position list + ] + +let constr_of_metadata: metadata -> constr = function + | `Sort (sort, pos) -> `Sort (sort, [pos]) + | `Rel pos -> `Rel [pos] + | `Obj (uri, pos) -> `Obj (uri, [pos]) + + (** the name of the tables in the DB *) +let sort_tbl_original = "refSort" +let rel_tbl_original = "refRel" +let obj_tbl_original = "refObj" +let name_tbl_original = "objectName" +let count_tbl_original = "count" +let hits_tbl_original = "hits" + + (** the names currently used *) +let sort_tbl_real = ref sort_tbl_original +let rel_tbl_real = ref rel_tbl_original +let obj_tbl_real = ref obj_tbl_original +let name_tbl_real = ref name_tbl_original +let count_tbl_real = ref count_tbl_original + + (** the exported symbols *) +let sort_tbl () = ! sort_tbl_real ;; +let rel_tbl () = ! rel_tbl_real ;; +let obj_tbl () = ! obj_tbl_real ;; +let name_tbl () = ! name_tbl_real ;; +let count_tbl () = ! count_tbl_real ;; + + (** to use the owned tables *) +let ownerize_tables owner = + sort_tbl_real := ( sort_tbl_original ^ "_" ^ owner) ; + rel_tbl_real := ( rel_tbl_original ^ "_" ^ owner) ; + obj_tbl_real := ( obj_tbl_original ^ "_" ^ owner) ; + name_tbl_real := ( name_tbl_original ^ "_" ^ owner); + count_tbl_real := ( count_tbl_original ^ "_" ^ owner) +;; + +let library_sort_tbl = sort_tbl_original +let library_rel_tbl = rel_tbl_original +let library_obj_tbl = obj_tbl_original +let library_name_tbl = name_tbl_original +let library_count_tbl = count_tbl_original +let library_hits_tbl = hits_tbl_original + +let are_tables_ownerized () = + sort_tbl () <> library_sort_tbl + diff --git a/components/metadata/metadataTypes.mli b/components/metadata/metadataTypes.mli new file mode 100644 index 000000000..904d837ad --- /dev/null +++ b/components/metadata/metadataTypes.mli @@ -0,0 +1,86 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val position_prefix : string + +val inconcl_pos : string +val mainconcl_pos : string +val mainhyp_pos : string +val inhyp_pos : string +val inbody_pos : string + +type relation = + | Eq of int + | Le of int + | Lt of int + | Ge of int + | Gt of int + +type main_position = + [ `MainConclusion of relation option (* Pi depth *) + | `MainHypothesis of relation option (* Pi depth *) + ] + +type position = + [ main_position + | `InConclusion + | `InHypothesis + | `InBody + ] + +type pi_depth = int + +type metadata = + [ `Sort of Cic.sort * main_position + | `Rel of main_position + | `Obj of UriManager.uri * position + ] + +type constr = + [ `Sort of Cic.sort * main_position list + | `Rel of main_position list + | `Obj of UriManager.uri * position list + ] + +val constr_of_metadata: metadata -> constr + + (** invoke this function to set the current owner. Afterwards the functions + * below will return the name of the table of the set owner *) +val ownerize_tables : string -> unit +val are_tables_ownerized : unit -> bool + +val sort_tbl: unit -> string +val rel_tbl: unit -> string +val obj_tbl: unit -> string +val name_tbl: unit -> string +val count_tbl: unit -> string + +val library_sort_tbl: string +val library_rel_tbl: string +val library_obj_tbl: string +val library_name_tbl: string +val library_count_tbl: string +val library_hits_tbl: string + diff --git a/components/metadata/sqlStatements.ml b/components/metadata/sqlStatements.ml new file mode 100644 index 000000000..f96b877a4 --- /dev/null +++ b/components/metadata/sqlStatements.ml @@ -0,0 +1,221 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf;; +type tbl = [ `RefObj| `RefSort| `RefRel| `ObjectName| `Hits| `Count] + +(* TABLES *) + +let sprintf_refObj_format name = [ +sprintf "CREATE TABLE %s ( + source varchar(255) not null, + h_occurrence varchar(255) not null, + h_position varchar(62) not null, + h_depth integer +);" name] + +let sprintf_refSort_format name = [ +sprintf "CREATE TABLE %s ( + source varchar(255) not null, + h_position varchar(62) not null, + h_depth integer not null, + h_sort varchar(5) not null +);" name] + +let sprintf_refRel_format name = [ +sprintf "CREATE TABLE %s ( + source varchar(255) not null, + h_position varchar(62) not null, + h_depth integer not null +);" name] + +let sprintf_objectName_format name = [ +sprintf "CREATE TABLE %s ( + source varchar(255) not null, + value varchar(255) not null +);" name] + +let sprintf_hits_format name = [ +sprintf "CREATE TABLE %s ( + source varchar(255) not null, + no integer not null +);" name] + +let sprintf_count_format name = [ +sprintf "CREATE TABLE %s ( + source varchar(255) unique not null, + conclusion smallint(6) not null, + hypothesis smallint(6) not null, + statement smallint(6) not null +);" name] + +let sprintf_refObj_drop name = [sprintf "DROP TABLE %s;" name] + +let sprintf_refSort_drop name = [sprintf "DROP TABLE %s;" name] + +let sprintf_refRel_drop name = [sprintf "DROP TABLE %s;" name] + +let sprintf_objectName_drop name = [sprintf "DROP TABLE %s;" name] + +let sprintf_hits_drop name = [sprintf "DROP TABLE %s;" name] + +let sprintf_count_drop name = [sprintf "DROP TABLE %s;" name] + +(* INDEXES *) + +let sprintf_refObj_index name = [ +sprintf "CREATE INDEX %s_index ON %s (source,h_occurrence,h_position);" name name; +(*sprintf "CREATE INDEX %s_index ON %s (source(219),h_occurrence(219),h_position);" name name;*) +sprintf "CREATE INDEX %s_occurrence ON %s (h_occurrence);" name name ] + +let sprintf_refSort_index name = [ +sprintf "CREATE INDEX %s_index ON %s (source,h_sort,h_position,h_depth);" name name] + +let sprintf_objectName_index name = [ +sprintf "CREATE INDEX %s_value ON %s (value);" name name] + +let sprintf_hits_index name = [ +sprintf "CREATE INDEX %s_source ON %s (source);" name name ; +sprintf "CREATE INDEX %s_no ON %s (no);" name name] + +let sprintf_count_index name = [ +sprintf "CREATE INDEX %s_conclusion ON %s (conclusion);" name name; +sprintf "CREATE INDEX %s_hypothesis ON %s (hypothesis);" name name; +sprintf "CREATE INDEX %s_statement ON %s (statement);" name name] + +let sprintf_refRel_index name = [ +sprintf "CREATE INDEX %s_index ON %s (source,h_position,h_depth);" name name] + +let format_drop name sufix dtype dbd = + if HSql.isMysql dtype dbd then + (sprintf "DROP INDEX %s_%s ON %s;" name sufix name) + else + (sprintf "DROP INDEX %s_%s;" name sufix);; + +let sprintf_refObj_index_drop name dtype dbd= [(format_drop name "index" dtype dbd)] + +let sprintf_refSort_index_drop name dtype dbd = [(format_drop name "index" dtype dbd)] + +let sprintf_objectName_index_drop name dtype dbd = [(format_drop name "value" dtype dbd)] + +let sprintf_hits_index_drop name dtype dbd = [ +(format_drop name "source" dtype dbd); +(format_drop name "no" dtype dbd)] + +let sprintf_count_index_drop name dtype dbd = [ +(format_drop name "source" dtype dbd); +(format_drop name "conclusion" dtype dbd); +(format_drop name "hypothesis" dtype dbd); +(format_drop name "statement" dtype dbd)] + +let sprintf_refRel_index_drop name dtype dbd = + [(format_drop name "index" dtype dbd)] + +let sprintf_rename_table oldname newname = [ +sprintf "RENAME TABLE %s TO %s;" oldname newname +] + + +(* FUNCTIONS *) + +let get_table_format t named = + match t with + | `RefObj -> sprintf_refObj_format named + | `RefSort -> sprintf_refSort_format named + | `RefRel -> sprintf_refRel_format named + | `ObjectName -> sprintf_objectName_format named + | `Hits -> sprintf_hits_format named + | `Count -> sprintf_count_format named + +let get_index_format t named = + match t with + | `RefObj -> sprintf_refObj_index named + | `RefSort -> sprintf_refSort_index named + | `RefRel -> sprintf_refRel_index named + | `ObjectName -> sprintf_objectName_index named + | `Hits -> sprintf_hits_index named + | `Count -> sprintf_count_index named + +let get_table_drop t named = + match t with + | `RefObj -> sprintf_refObj_drop named + | `RefSort -> sprintf_refSort_drop named + | `RefRel -> sprintf_refRel_drop named + | `ObjectName -> sprintf_objectName_drop named + | `Hits -> sprintf_hits_drop named + | `Count -> sprintf_count_drop named + +let get_index_drop t named dtype dbd = + match t with + | `RefObj -> sprintf_refObj_index_drop named dtype dbd + | `RefSort -> sprintf_refSort_index_drop named dtype dbd + | `RefRel -> sprintf_refRel_index_drop named dtype dbd + | `ObjectName -> sprintf_objectName_index_drop named dtype dbd + | `Hits -> sprintf_hits_index_drop named dtype dbd + | `Count -> sprintf_count_index_drop named dtype dbd + +let create_tables l = + List.fold_left (fun s (name,table) -> s @ get_table_format table name) [] l + +let create_indexes l = + List.fold_left (fun s (name,table) -> s @ get_index_format table name) [] l + +let drop_tables l = + List.fold_left (fun s (name,table) -> s @ get_table_drop table name) [] l + +let drop_indexes l dtype dbd= + List.fold_left (fun s (name,table) -> s @ get_index_drop table name dtype dbd) [] l + +let rename_tables l = + List.fold_left (fun s (o,n) -> s @ sprintf_rename_table o n) [] l + +let fill_hits refObj hits = + [ sprintf + "INSERT INTO %s + SELECT h_occurrence, COUNT(source) + FROM %s + GROUP BY h_occurrence;" + hits refObj ] + + +let move_content (name1, tbl1) (name2, tbl2) buri dtype dbd = + let escape s = + Pcre.replace ~pat:"([^\\\\])_" ~templ:"$1\\_" (HSql.escape dtype dbd s) + in + assert (tbl1 = tbl2); + sprintf + "INSERT INTRO %s SELECT * FROM %s WHERE source LIKE \"%s%%\";" + name2 name1 (escape buri) + +let direct_deps refObj uri dtype dbd = + sprintf "SELECT * FROM %s WHERE source = \"%s\";" + refObj (HSql.escape dtype dbd (UriManager.string_of_uri uri)) + +let inverse_deps refObj uri dtype dbd = + sprintf "SELECT * FROM %s WHERE h_occurrence = \"%s\";" + refObj (HSql.escape dtype dbd (UriManager.string_of_uri uri)) + diff --git a/components/metadata/sqlStatements.mli b/components/metadata/sqlStatements.mli new file mode 100644 index 000000000..ca780ee15 --- /dev/null +++ b/components/metadata/sqlStatements.mli @@ -0,0 +1,59 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** table shape kinds *) +type tbl = [ `RefObj| `RefSort| `RefRel| `ObjectName| `Hits| `Count] + +(** all functions below return either an SQL statement or a list of SQL + * statements. + * For functions taking as argument (string * tbl) list, the meaning is a list + * of pairs ; where the type specify the desired kind of + * table and name the desired name (e.g. create a `RefObj like table name + * refObj_NEW) *) + +val create_tables: (string * tbl) list -> string list +val create_indexes: (string * tbl) list -> string list +val drop_tables: (string * tbl) list -> string list +val drop_indexes: (string * tbl) list -> HSql.dbtype -> HSql.dbd -> string list +val rename_tables: (string * string) list -> string list + +(** @param refObj name of the refObj table + * @param hits name of the hits table *) +val fill_hits: string -> string -> string list + +(** move content [t1] [t2] [buri] + * moves all the tuples with 'source' that match regex '^buri' from t1 to t2 + * *) +val move_content: (string * tbl) -> (string * tbl) -> string -> HSql.dbtype -> + HSql.dbd -> string + +(** @param refObj name of the refObj table + * @param src uri of the desired 'source' field *) +val direct_deps: string -> UriManager.uri -> HSql.dbtype -> HSql.dbd -> string + +(** @param refObj name of the refObj table + * @param src uri of the desired 'h_occurrence' field *) +val inverse_deps: string -> UriManager.uri -> HSql.dbtype -> HSql.dbd -> string + diff --git a/components/registry/.depend b/components/registry/.depend new file mode 100644 index 000000000..cf4f36b68 --- /dev/null +++ b/components/registry/.depend @@ -0,0 +1,2 @@ +helm_registry.cmo: helm_registry.cmi +helm_registry.cmx: helm_registry.cmi diff --git a/components/registry/.depend.opt b/components/registry/.depend.opt new file mode 100644 index 000000000..cf4f36b68 --- /dev/null +++ b/components/registry/.depend.opt @@ -0,0 +1,2 @@ +helm_registry.cmo: helm_registry.cmi +helm_registry.cmx: helm_registry.cmi diff --git a/components/registry/.ocamlinit b/components/registry/.ocamlinit new file mode 100644 index 000000000..b08e0ebfc --- /dev/null +++ b/components/registry/.ocamlinit @@ -0,0 +1,4 @@ +#use "topfind";; +#require "helm-registry";; +open Helm_registry;; +load_from "tests/sample.xml";; diff --git a/components/registry/Makefile b/components/registry/Makefile new file mode 100644 index 000000000..bb9715ab4 --- /dev/null +++ b/components/registry/Makefile @@ -0,0 +1,8 @@ + +PACKAGE = registry +INTERFACE_FILES = helm_registry.mli +IMPLEMENTATION_FILES = helm_registry.ml + +include ../../Makefile.defs +include ../Makefile.common + diff --git a/components/registry/helm_registry.ml b/components/registry/helm_registry.ml new file mode 100644 index 000000000..fd0df5013 --- /dev/null +++ b/components/registry/helm_registry.ml @@ -0,0 +1,432 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let debug = false +let debug_print s = + if debug then prerr_endline ("Helm_registry debugging: " ^ (Lazy.force s)) + + (** *) + +let list_uniq l = + let rec aux last_element = function + | [] -> [] + | hd :: tl -> + (match last_element with + | Some elt when elt = hd -> aux last_element tl + | _ -> hd :: aux (Some hd) tl) + in + aux None l + +let starts_with prefix = +(* + let rex = Str.regexp (Str.quote prefix) in + fun s -> Str.string_match rex s 0 +*) + let prefix_len = String.length prefix in + fun s -> + try + String.sub s 0 prefix_len = prefix + with Invalid_argument _ -> false + +let hashtbl_keys tbl = Hashtbl.fold (fun k _ acc -> k :: acc) tbl [] +let hashtbl_pairs tbl = Hashtbl.fold (fun k v acc -> (k,v) :: acc) tbl [] + + (** *) + +exception Malformed_key of string +exception Key_not_found of string +exception Cyclic_definition of string +exception Type_error of string (* expected type, value, msg *) +exception Parse_error of string * int * int * string (* file, line, col, msg *) + + (* root XML tag: used by save_to, ignored by load_from *) +let root_tag = "helm_registry" + +let magic_size = 127 + +let backup_registry registry = Hashtbl.copy registry +let restore_registry backup registry = + Hashtbl.clear registry; + Hashtbl.iter (fun key value -> Hashtbl.add registry key value) backup + + (* as \\w but: + * - no sequences of '_' longer than 1 are permitted + *) +let valid_step_rex_raw = "[a-zA-Z0-9]+\\(_[a-z0A-Z-9]+\\)*" +let valid_key_rex_raw = + sprintf "%s\\(\\.%s\\)*" valid_step_rex_raw valid_step_rex_raw +let valid_key_rex = Str.regexp ("^" ^ valid_key_rex_raw ^ "$") +let interpolated_key_rex = Str.regexp ("\\$(" ^ valid_key_rex_raw ^ ")") +let dot_rex = Str.regexp "\\." +let spaces_rex = Str.regexp "[ \t\n\r]+" +let heading_spaces_rex = Str.regexp "^[ \t\n\r]+" +let margin_blanks_rex = + Str.regexp "^\\([ \t\n\r]*\\)\\([^ \t\n\r]*\\)\\([ \t\n\r]*\\)$" + +let strip_blanks s = Str.global_replace margin_blanks_rex "\\2" s + +let split s = + (* trailing blanks are removed per default by split *) + Str.split spaces_rex (Str.global_replace heading_spaces_rex "" s) +let merge l = String.concat " " l + +let handle_type_error f x = + try f x with exn -> raise (Type_error (Printexc.to_string exn)) + + (** marshallers/unmarshallers *) +let string x = x +let int = handle_type_error int_of_string +let float = handle_type_error float_of_string +let bool = handle_type_error bool_of_string +let of_string x = x +let of_int = handle_type_error string_of_int +let of_float = handle_type_error string_of_float +let of_bool = handle_type_error string_of_bool + +(* FG *) +let pair fst_unmarshaller snd_unmarshaller v = + match Str.split spaces_rex v with + | [fst; snd] -> fst_unmarshaller fst, snd_unmarshaller snd + | _ -> raise (Type_error "not a pair") + + (* escapes for xml configuration file *) +let (escape, unescape) = + let (in_enc, out_enc) = (`Enc_utf8, `Enc_utf8) in + (Netencoding.Html.encode ~in_enc ~out_enc (), + Netencoding.Html.decode ~in_enc ~out_enc ~entity_base:`Xml ()) + +let key_is_valid key = + if not (Str.string_match valid_key_rex key 0) then + raise (Malformed_key key) + +let set' ?(replace=false) registry ~key ~value = + debug_print (lazy(sprintf "Setting (replace: %b) %s = %s" replace key value)); + key_is_valid key; + let add_fun = if replace then Hashtbl.replace else Hashtbl.add in + add_fun registry key value + +let unset registry = Hashtbl.remove registry + +let env_var_of_key s = String.uppercase (Str.global_replace dot_rex "_" s) + +let singleton = function + | [] -> + raise (Type_error ("empty list value found where singleton was expected")) + | hd :: _ -> hd + +let get registry key = + let rec aux stack key = + key_is_valid key; + if List.mem key stack then begin + let msg = (String.concat " -> " (List.rev stack)) ^ " -> " ^ key in + raise (Cyclic_definition msg) + end; + (* internal value *) + let registry_values = List.rev (Hashtbl.find_all registry key) in + let env_value = (* environment value *) + try + Some (Sys.getenv (env_var_of_key key)) + with Not_found -> None + in + let values = (* resulting value *) + match registry_values, env_value with + | _, Some env -> [env] + | [], None -> + (try + [ Sys.getenv key ] + with Not_found -> raise (Key_not_found key)) + | values, None -> values + in + List.map (interpolate (key :: stack)) values + and interpolate stack value = + Str.global_substitute interpolated_key_rex + (fun s -> + let matched = Str.matched_string s in + (* "$(var)" -> "var" *) + let key = String.sub matched 2 (String.length matched - 3) in + singleton (aux stack key)) + value + in + List.map strip_blanks (aux [] key) + +let has registry key = Hashtbl.mem registry key + +let get_typed registry unmarshaller key = + let value = singleton (get registry key) in + unmarshaller value + +let set_typed registry marshaller ~key ~value = + set' ~replace:true registry ~key ~value:(marshaller value) + +let get_opt registry unmarshaller key = + try + Some (unmarshaller (singleton (get registry key))) + with Key_not_found _ -> None + +let get_opt_default registry unmarshaller ~default key = + match get_opt registry unmarshaller key with + | None -> default + | Some v -> v + +let set_opt registry marshaller ~key ~value = + match value with + | None -> unset registry key + | Some value -> set' ~replace:true registry ~key ~value:(marshaller value) + +let get_list registry unmarshaller key = + try + let tmp = get registry key in + let rc = List.map unmarshaller tmp in + rc + with Key_not_found _ -> [] + +(* FG *) +let get_pair registry fst_unmarshaller snd_unmarshaller = + get_typed registry (pair fst_unmarshaller snd_unmarshaller) + +let set_list registry marshaller ~key ~value = + (* since ocaml hash table are crazy... *) + while Hashtbl.mem registry key do + Hashtbl.remove registry key + done; + List.iter (fun v -> set' registry ~key ~value:(marshaller v)) value + +type xml_tree = + | Cdata of string + | Element of string * (string * string) list * xml_tree list + +let dot_RE = Str.regexp "\\." + +let xml_tree_of_registry registry = + let has_child name elements = + List.exists + (function + | Element (_, ["name", name'], _) when name = name' -> true + | _ -> false) + elements + in + let rec get_child name = function + | [] -> assert false + | (Element (_, ["name", name'], _) as child) :: tl when name = name' -> + child, tl + | hd :: tl -> + let child, rest = get_child name tl in + child, hd :: rest + in + let rec add_key path value tree = + match path, tree with + | [key], Element (name, attrs, children) -> + Element (name, attrs, + Element ("key", ["name", key], + [Cdata (strip_blanks value)]) :: children) + | dir :: path, Element (name, attrs, children) -> + if has_child dir children then + let child, rest = get_child dir children in + Element (name, attrs, add_key path value child :: rest) + else + Element (name, attrs, + ((add_key path value (Element ("section", ["name", dir], []))) + :: children)) + | _ -> assert false + in + Hashtbl.fold + (fun k v tree -> add_key ((Str.split dot_RE k)) v tree) + registry + (Element (root_tag, [], [])) + +let rec stream_of_xml_tree = function + | Cdata s -> Xml.xml_cdata s + | Element (name, attrs, children) -> + Xml.xml_nempty name + (List.map (fun (n, v) -> (None, n, v)) attrs) + (stream_of_xml_trees children) +and stream_of_xml_trees = function + | [] -> [< >] + | hd :: tl -> [< stream_of_xml_tree hd; stream_of_xml_trees tl >] + +let save_to registry fname = + let token_stream = stream_of_xml_tree (xml_tree_of_registry registry) in + let oc = open_out fname in + Xml.pp_to_outchan token_stream oc; + close_out oc + +let rec load_from_absolute ?path registry fname = + let _path = ref (match path with None -> [] | Some p -> p)in + (*
    elements entered so far *) + let in_key = ref false in (* have we entered a element? *) + let cdata = ref "" in (* collected cdata (inside *) + let push_path name = _path := name :: !_path in + let pop_path () = _path := List.tl !_path in + let start_element tag attrs = + match tag, attrs with + | "section", ["name", name] -> push_path name + | "key", ["name", name] -> in_key := true; push_path name + | "helm_registry", _ -> () + | "include", ["href", fname] -> + debug_print (lazy ("including file " ^ fname)); + load_from_absolute ~path:!_path registry fname + | tag, _ -> + raise (Parse_error (fname, ~-1, ~-1, + (sprintf "unexpected element <%s> or wrong attribute set" tag))) + in + let end_element tag = + match tag with + | "section" -> pop_path () + | "key" -> + let key = String.concat "." (List.rev !_path) in + set' registry ~key ~value:!cdata; + cdata := ""; + in_key := false; + pop_path () + | "include" | "helm_registry" -> () + | _ -> assert false + in + let character_data text = + if !in_key then cdata := !cdata ^ text + in + let callbacks = { + XmlPushParser.default_callbacks with + XmlPushParser.start_element = Some start_element; + XmlPushParser.end_element = Some end_element; + XmlPushParser.character_data = Some character_data; + } in + let xml_parser = XmlPushParser.create_parser callbacks in + let backup = backup_registry registry in +(* if path = None then Hashtbl.clear registry; *) + try + XmlPushParser.parse xml_parser (`File fname) + with exn -> + restore_registry backup registry; + raise exn + +let load_from registry ?path fname = + if Filename.is_relative fname then begin + let no_file_found = ref true in + let path = + match path with + | Some path -> path (* path given as argument *) + | None -> [ Sys.getcwd () ] (* no path given, try with cwd *) + in + List.iter + (fun dir -> + let conffile = dir ^ "/" ^ fname in + if Sys.file_exists conffile then begin + no_file_found := false; + load_from_absolute registry conffile + end) + path; + if !no_file_found then + failwith (sprintf + "Helm_registry.init: no configuration file named %s in [ %s ]" + fname (String.concat "; " path)) + end else + load_from_absolute registry fname + +let fold registry ?prefix ?(interpolate = true) f init = + let value_of k v = + if interpolate then singleton (get registry k) else strip_blanks v + in + match prefix with + | None -> Hashtbl.fold (fun k v acc -> f acc k (value_of k v)) registry init + | Some s -> + let key_matches = starts_with (s ^ ".") in + let rec fold_filter acc = function + | [] -> acc + | (k,v) :: tl when key_matches k -> + fold_filter (f acc k (value_of k v)) tl + | _ :: tl -> fold_filter acc tl + in + fold_filter init (hashtbl_pairs registry) + +let iter registry ?prefix ?interpolate f = + fold registry ?prefix ?interpolate (fun _ k v -> f k v) () +let to_list registry ?prefix ?interpolate () = + fold registry ?prefix ?interpolate (fun acc k v -> (k, v) :: acc) [] + +let ls registry prefix = + let prefix = prefix ^ "." in + let prefix_len = String.length prefix in + let key_matches = starts_with prefix in + let matching_keys = (* collect matching keys' _postfixes_ *) + fold registry + (fun acc key _ -> + if key_matches key then + String.sub key prefix_len (String.length key - prefix_len) :: acc + else + acc) + [] + in + let (sections, keys) = + List.fold_left + (fun (sections, keys) postfix -> + match Str.split dot_rex postfix with + | [key] -> (sections, key :: keys) + | hd_key :: _ -> (* length > 1 => nested section found *) + (hd_key :: sections, keys) + | _ -> assert false) + ([], []) matching_keys + in + (list_uniq (List.sort Pervasives.compare sections), keys) + +(** {2 API implementation} + * functional methods above are wrapped so that they work on a default + * (imperative) registry*) + +let default_registry = Hashtbl.create magic_size + +let get key = singleton (get default_registry key) +let set = set' ~replace:true default_registry +let has = has default_registry +let fold ?prefix ?interpolate f init = + fold default_registry ?prefix ?interpolate f init +let iter = iter default_registry +let to_list = to_list default_registry +let ls = ls default_registry +let get_typed unmarshaller = get_typed default_registry unmarshaller +let get_opt unmarshaller = get_opt default_registry unmarshaller +let get_opt_default unmarshaller = get_opt_default default_registry unmarshaller +let get_list unmarshaller = get_list default_registry unmarshaller +let get_pair unmarshaller = get_pair default_registry unmarshaller +let set_typed marshaller = set_typed default_registry marshaller +let set_opt unmarshaller = set_opt default_registry unmarshaller +let set_list marshaller = set_list default_registry marshaller +let unset = unset default_registry +let save_to = save_to default_registry +let load_from = load_from default_registry +let clear () = Hashtbl.clear default_registry + +let get_string = get_typed string +let get_int = get_typed int +let get_float = get_typed float +let get_bool = get_typed bool +let set_string = set_typed of_string +let set_int = set_typed of_int +let set_float = set_typed of_float +let set_bool = set_typed of_bool + diff --git a/components/registry/helm_registry.mli b/components/registry/helm_registry.mli new file mode 100644 index 000000000..77c6f6cc3 --- /dev/null +++ b/components/registry/helm_registry.mli @@ -0,0 +1,200 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** Configuration repository for HELM applications. + * + * ++ Keys format ++ + * + * key ::= path + * path ::= component ( '.' component )* + * component ::= ( alpha | num | '_' )+ + * # with the only exception that sequences of '_' longer than 1 aren't valid + * # components + * + * Suggested usage .: + * e.g. gTopLevel.prooffile, http_getter.port, ... + * + * ++ Configuration file example ++ + * + * gTopLevel.prooffile = "/home/zack/prooffile" + * http_getter.port = "58080" + * + * ++ Environment variable override ++ + * + * each key has an associated environment variable name. At runtime (i.e. when + * "get" requests are performed) a variable with this name will be looked for, + * if it's defined it will override the value present (or absent) in the + * registry. + * Environment variables are _not_ considered when saving the configuration to + * a configuration file (via "save_to" function below) . + * + * Mapping between keys and environment variables is as follows: + * - each "." is converted to "__" + * E.g.: my.Foo_iSH.Application -> my__Foo_iSH__Application + * + * ++ Variable interpolation ++ + * + * Interpolation is supported with the following syntax: + * + * foo.bar = "quux" + * foo.baz = $(foo.bar)/baz + *) + + (** raised when a looked up key can't be found + * @param key looked up key *) +exception Key_not_found of string + + (** raised when a cyclic definitions is found, e.g. after + * Helm_registry.set "a" "$b" + * Helm_registry.set "b" "$a" + * @param msg brief description of the definition cycle *) +exception Cyclic_definition of string + + (** raised when a looked up key doesn't have the required type, parameter is + * an error message *) +exception Type_error of string + + (** raised when a malformed key is encountered + * @param key malformed key *) +exception Malformed_key of string + + (** raised when an error is encountered while parsing a configuration file + * @param fname file name + * @param line line number + * @param col column number + * @param msg error description + *) +exception Parse_error of string * int * int * string + +(** {2 Generic untyped interface} + * Using the functions below this module could be used as a repository of + * key/value pairs *) + + (** lookup key in registry with environment variable override *) +val get: string -> string +val set: key:string -> value:string -> unit +val has: string -> bool + + (** remove a key from the current environment, next get over this key will + * raise Key_not_found until the key will be redefined *) +val unset: string -> unit + + (** @param interpolate defaults to true *) +val fold: + ?prefix:string -> ?interpolate:bool -> + ('a -> string -> string -> 'a) -> 'a -> 'a + + (** @param interpolate defaults to true *) +val iter: + ?prefix:string -> ?interpolate:bool -> + (string -> string -> unit) -> unit + + (** @param interpolate defaults to true *) +val to_list: + ?prefix:string -> ?interpolate:bool -> + unit -> (string * string) list + + (** @param prefix key representing the section whose contents should be listed + * @return section list * key list *) +val ls: string -> string list * string list + +(** {2 Typed interface} + * Three basic types are supported: strings, int and strings list. Strings + * correspond literally to what is written inside double quotes; int to the + * parsing of an integer number from ; strings list to the splitting at blanks + * of it (heading and trailing blanks are removed before splitting) *) + +(** {3 Unmarshallers} *) + +val string: string -> string +val int: string -> int +val float: string -> float +val bool: string -> bool +val pair: (string -> 'a) -> (string -> 'b) -> string -> 'a * 'b + +(** {3 Typed getters} *) + + (** like get, with an additional unmarshaller + * @param unmarshaller conversion function from string to the desired type. + * Use one of the above unmarshallers *) +val get_typed: (string -> 'a) -> string -> 'a + +val get_opt: (string -> 'a) -> string -> 'a option +val get_opt_default: (string -> 'a) -> default:'a -> string -> 'a + + (** never fails with Key_not_found, instead return the empty list *) +val get_list: (string -> 'a) -> string -> 'a list + + (** decode values which are blank separated list of values, of length 2 *) +val get_pair: (string -> 'a) -> (string -> 'b) -> string -> 'a * 'b + +(** {4 Shorthands} *) + +val get_string: string -> string +val get_int: string -> int +val get_float: string -> float +val get_bool: string -> bool + +(** {3 Marshallers} *) + +val of_string: string -> string +val of_int: int -> string +val of_float: float -> string +val of_bool: bool -> string + +(** {3 Typed setters} *) + + (** like set, with an additional marshaller + * @param marshaller conversion function to string. + * Use one of the above marshallers *) +val set_typed: ('a -> string) -> key:string -> value:'a -> unit + +val set_opt: ('a -> string) -> key:string -> value:'a option -> unit +val set_list: ('a -> string) -> key:string -> value:'a list -> unit + +(** {4 Shorthands} *) + +val set_string: key:string -> value:string -> unit +val set_int: key:string -> value:int -> unit +val set_float: key:string -> value:float -> unit +val set_bool: key:string -> value:bool -> unit + +(** {2 Persistent configuration} *) + + (** @param fname file to which save current configuration *) +val save_to: string -> unit + + (** @param fname file from which load new configuration. If it's an absolute + * file name "path" argument is ignored. + * Otherwise given file name is looked up in each directory member of the + * given path. Each matching file is loaded overriding previous settings. If + * no path is given a default path composed of just the current working + * directory is used. + *) +val load_from: ?path:string list -> string -> unit + + (** removes all keys *) +val clear: unit -> unit + diff --git a/components/registry/test.ml b/components/registry/test.ml new file mode 100644 index 000000000..d0b91a28c --- /dev/null +++ b/components/registry/test.ml @@ -0,0 +1,32 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf;; +Helm_registry.load_from Sys.argv.(1); +Helm_registry.iter ~interpolate:false (fun k v -> printf "%s = %s\n" k v); +Helm_registry.save_to Sys.argv.(2) + diff --git a/components/registry/tests/sample.xml b/components/registry/tests/sample.xml new file mode 100644 index 000000000..b0edbdae0 --- /dev/null +++ b/components/registry/tests/sample.xml @@ -0,0 +1,34 @@ + + +
    + file:///home/zack/miohelm/objects + file:///home/zack/miohelm/objects +
    +
    + remote + http://localhost:58081 +
    +
    + yes +
    +
    + +
    +
    + yes +
    +
    + debian + 1 + false + 2.5 + 11 + 13 + 17 + 19 + 19 23.2 +
    +
    + http://localhost:58080/ +
    +
    diff --git a/components/registry/tests/sample_include.xml b/components/registry/tests/sample_include.xml new file mode 100644 index 000000000..8a6851998 --- /dev/null +++ b/components/registry/tests/sample_include.xml @@ -0,0 +1,15 @@ + +
    + aaa + bbb +
    +
    + quux +
    + /public/helm_library + $(triciclo.basedir)/constanttype + $(triciclo.basedir)/environment + $(triciclo.basedir)/innertypes + $(triciclo.basedir)/currentproof + $(triciclo.basedir)/currentprooftype +
    diff --git a/components/syntax_extensions/.depend b/components/syntax_extensions/.depend new file mode 100644 index 000000000..f3c6a8bd1 --- /dev/null +++ b/components/syntax_extensions/.depend @@ -0,0 +1,2 @@ +utf8Macro.cmo: utf8MacroTable.cmo utf8Macro.cmi +utf8Macro.cmx: utf8MacroTable.cmx utf8Macro.cmi diff --git a/components/syntax_extensions/.depend.opt b/components/syntax_extensions/.depend.opt new file mode 100644 index 000000000..c0cd9c906 --- /dev/null +++ b/components/syntax_extensions/.depend.opt @@ -0,0 +1,2 @@ +utf8Macro.cmo: utf8MacroTable.cmx utf8Macro.cmi +utf8Macro.cmx: utf8MacroTable.cmx utf8Macro.cmi diff --git a/components/syntax_extensions/Makefile b/components/syntax_extensions/Makefile new file mode 100644 index 000000000..5f0065d2f --- /dev/null +++ b/components/syntax_extensions/Makefile @@ -0,0 +1,51 @@ +PACKAGE = utf8_macros +PREDICATES = +MAKE_TABLE_PACKAGES = helm-xml + +# modules which have both a .ml and a .mli +INTERFACE_FILES = utf8Macro.mli +IMPLEMENTATION_FILES = utf8MacroTable.ml $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = + +all: utf8_macros.cma pa_unicode_macro.cma profiling_macros.cma + +make_table: make_table.ml + @echo " OCAMLC $<" + $(H)$(OCAMLFIND) ocamlc -rectypes -package $(MAKE_TABLE_PACKAGES) -linkpkg -o $@ $^ + +utf8MacroTable.ml: + ./make_table $@ $@.txt +utf8MacroTable.cmo: utf8MacroTable.ml + @echo " OCAMLC $<" + $(H)@$(OCAMLFIND) ocamlc -c $< + +pa_unicode_macro.cmo: pa_unicode_macro.ml utf8Macro.cmo + @echo " OCAMLC $<" + $(H)@$(OCAMLFIND) ocamlc -rectypes -package camlp5 -pp "camlp5o q_MLast.cmo pa_extend.cmo -loc loc" -c $< +pa_unicode_macro.cma: utf8MacroTable.cmo utf8Macro.cmo pa_unicode_macro.cmo + @echo " OCAMLC -a $@" + $(H)@$(OCAMLFIND) ocamlc -a -o $@ $^ + +profiling_macros.cmo: profiling_macros.ml + @echo " OCAMLC $<" + $(H)@$(OCAMLFIND) ocamlc -package camlp5 -pp "camlp5o -loc loc" -c $< +profiling_macros.cma:profiling_macros.cmo + @echo " OCAMLC -a $@" + $(H)@$(OCAMLFIND) ocamlc -a -o $@ $^ + + +.PHONY: test +test: test.ml + $(OCAMLFIND) ocamlc -package helm-utf8_macros -syntax camlp5o $< -o $@ + +clean: +distclean: extra_clean +extra_clean: + rm -f make_table test + +STATS_EXCLUDE = utf8MacroTable.ml + +include ../../Makefile.defs +include ../Makefile.common + diff --git a/components/syntax_extensions/README.syntax b/components/syntax_extensions/README.syntax new file mode 100644 index 000000000..eddc7f45b --- /dev/null +++ b/components/syntax_extensions/README.syntax @@ -0,0 +1,15 @@ + +Helm Utf8 macro syntax extension for Camlp4 + +Sample file: + + --- test.ml --- + + prerr_endline <:unicode> + + --------------- + +Compile it with: + + ocamlfind ocamlc -package helm-utf8_macros -syntax camlp5o test.ml + diff --git a/components/syntax_extensions/data/dictionary-tex.xml b/components/syntax_extensions/data/dictionary-tex.xml new file mode 100644 index 000000000..47995454f --- /dev/null +++ b/components/syntax_extensions/data/dictionary-tex.xml @@ -0,0 +1,378 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/syntax_extensions/data/entities-table.xml b/components/syntax_extensions/data/entities-table.xml new file mode 100644 index 000000000..c283631b4 --- /dev/null +++ b/components/syntax_extensions/data/entities-table.xml @@ -0,0 +1,2079 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/syntax_extensions/data/extra-entities.xml b/components/syntax_extensions/data/extra-entities.xml new file mode 100644 index 000000000..73b12ad5e --- /dev/null +++ b/components/syntax_extensions/data/extra-entities.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/components/syntax_extensions/make_table.ml b/components/syntax_extensions/make_table.ml new file mode 100644 index 000000000..59204c6e4 --- /dev/null +++ b/components/syntax_extensions/make_table.ml @@ -0,0 +1,107 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) + + (* source files for tables xml parsing (if unmarshall=false) *) +let xml_tables = [ +(* + `Entities, "/usr/share/gtkmathview/entities-table.xml"; + `Dictionary, "/usr/share/editex/dictionary-tex.xml" +*) + `Entities, "data/entities-table.xml"; + `Dictionary, "data/dictionary-tex.xml"; + `Entities, "data/extra-entities.xml"; + (** extra-entities.xml should be the last one since it is used to override + * previous mappings. Add there overrides as needed. *) +] + +let iter_gen record_tag name_field value_field f fname = + let start_element tag attrs = + if tag = record_tag then + try + let name = List.assoc name_field attrs in + let value = List.assoc value_field attrs in + f name value + with Not_found -> () + in + let callbacks = { + XmlPushParser.default_callbacks with + XmlPushParser.start_element = Some start_element + } in + let xml_parser = XmlPushParser.create_parser callbacks in + XmlPushParser.parse xml_parser (`File fname) + +let iter_entities_file = iter_gen "entity" "name" "value" +let iter_dictionary_file = iter_gen "entry" "name" "val" + +let parse_from_xml () = + let macro2utf8 = Hashtbl.create 2000 in + let add_macro macro utf8 = + debug_print (lazy (sprintf "Adding macro %s = '%s'" macro utf8)); + Hashtbl.replace macro2utf8 macro utf8 + in + let fill_table () = + List.iter + (fun (typ, fname) -> + match typ with + | `Entities -> iter_entities_file add_macro fname + | `Dictionary -> iter_dictionary_file add_macro fname) + xml_tables + in + fill_table (); + macro2utf8 + +let main () = + let oc = open_out Sys.argv.(1) in + let oc_doc = open_out Sys.argv.(2) in + output_string oc "(* GENERATED by make_table: DO NOT EDIT! *)\n"; + output_string oc_doc "(* GENERATED by make_table: DO NOT EDIT! *)\n"; + output_string oc "let macro2utf8 = Hashtbl.create 2000\n"; + output_string oc "let utf82macro = Hashtbl.create 2000\n"; + output_string oc "let data = [\n"; + let macro2utf8 = parse_from_xml () in + Hashtbl.iter + (fun macro utf8 -> + fprintf oc " \"%s\", \"%s\";\n" macro (String.escaped utf8); + fprintf oc_doc "\\%s %s\n" macro utf8) + macro2utf8; + output_string oc " ];;\n"; + output_string oc "let _ =\n"; + output_string oc " List.iter\n"; + output_string oc " (fun (macro, utf8) ->\n"; + output_string oc " Hashtbl.replace macro2utf8 macro utf8;\n"; + output_string oc " Hashtbl.replace utf82macro utf8 macro)\n"; + output_string oc " data;;\n"; + close_out oc; + close_out oc_doc + +let _ = main () + diff --git a/components/syntax_extensions/pa_unicode_macro.ml b/components/syntax_extensions/pa_unicode_macro.ml new file mode 100644 index 000000000..d81ec2131 --- /dev/null +++ b/components/syntax_extensions/pa_unicode_macro.ml @@ -0,0 +1,61 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) + +let loc = Stdpp.make_loc (-1, -1) + +let expand_unicode_macro macro = + debug_print (lazy (Printf.sprintf "Expanding macro '%s' ..." macro)); + let expansion = Utf8Macro.expand macro in + <:expr< $str:expansion$ >> + +let _ = + Quotation.add "unicode" + (Quotation.ExAst (expand_unicode_macro, (fun _ -> assert false))) + +open Pa_extend + +EXTEND + symbol: FIRST + [ + [ x = UIDENT; q = QUOTATION -> + let (quotation, arg) = + let pos = String.index q ':' in + (String.sub q 0 pos, + String.sub q (pos + 1) (String.length q - pos - 1)) + in + debug_print (lazy (Printf.sprintf "QUOTATION = %s; ARG = %s" quotation arg)); + if quotation = "unicode" then + AStok (loc, x, Some (ATexpr (loc, expand_unicode_macro arg))) + else + assert false + ] + ]; +END + diff --git a/components/syntax_extensions/profiling_macros.ml b/components/syntax_extensions/profiling_macros.ml new file mode 100644 index 000000000..9f5034a58 --- /dev/null +++ b/components/syntax_extensions/profiling_macros.ml @@ -0,0 +1,82 @@ +let max_profilers = 20;; +let profiler_no = ref 0;; +let profiler_label2int = Hashtbl.create 3;; +let name = ref "";; + +let banner _ pname = + name := pname; + "(Array.make "^string_of_int max_profilers^" (0,0.)), "^ + "(Array.make "^string_of_int max_profilers^" (0.))" +;; + +let ensure_label_in_table label = + if not (Hashtbl.mem profiler_label2int label) then + begin + if !profiler_no > max_profilers then + raise (Invalid_argument "Too many profilers."); + Hashtbl.add profiler_label2int label !profiler_no; + incr profiler_no; + end +;; + + +let start label = + ensure_label_in_table label; + let id = Hashtbl.find profiler_label2int label in + " ((snd "^ !name^").("^string_of_int id^") <- Unix.gettimeofday()) " +;; + +let stop label extra = + ensure_label_in_table label; + let id = Hashtbl.find profiler_label2int label in + "(let __res = " ^ extra ^ " in ( "^ + "let interval = Unix.gettimeofday () -. "^ + "(snd "^ !name^").("^string_of_int id^") in "^ + "let oldcount,oldval = (fst "^ !name^").("^string_of_int id^") in "^ + "(fst "^ !name^").("^string_of_int id^") <- "^ + "(oldcount+1,interval +. oldval)); __res )" +;; + +let profile_start_stop _ label = + let label,extra = + match Str.bounded_split (Str.regexp "\n") label 2 with + | [label;extra] -> label,extra + | _ -> + raise (Invalid_argument ("Profiler 'stop' with a bad label:" ^ label)) + in + let start = start label in + let stop = stop label extra in + "let _ = " ^ start ^ " in " ^ stop +;; + +let profile_show _ prefix = + (Hashtbl.fold + (fun k v acc -> + acc ^ + "let t = (fst "^ !name^").("^string_of_int v^") in "^ + "let acc = acc ^ Printf.sprintf \"%-15s %25s: %8d %8.4f\\n\" \"" ^ + prefix ^ "\" \"" ^ k ^ + "\" (fst t) (snd t) in ") + profiler_label2int "let acc = \"\" in ") ^ " acc " +;; + +let profile_start _ label = start label ;; +let profile_stop _ label = + let label,extra = + match Str.bounded_split (Str.regexp "\n") label 2 with + | [label;extra] -> label,extra + | [label] -> label,"()" + | _ -> + raise (Invalid_argument ("Profiler 'stop' with a bad label:" ^ label)) + in + stop label extra +;; + +(* +Quotation.add "profiler" (Quotation.ExStr banner);; +Quotation.add "profile" (Quotation.ExStr profile_start_stop);; +Quotation.add "start" (Quotation.ExStr profile_start);; +Quotation.add "stop" (Quotation.ExStr profile_stop);; +Quotation.add "show" (Quotation.ExStr profile_show);; +*) + diff --git a/components/syntax_extensions/test.ml b/components/syntax_extensions/test.ml new file mode 100644 index 000000000..8f98bfd44 --- /dev/null +++ b/components/syntax_extensions/test.ml @@ -0,0 +1,3 @@ +(* $Id$ *) + +prerr_endline <:unicode> diff --git a/components/syntax_extensions/utf8Macro.ml b/components/syntax_extensions/utf8Macro.ml new file mode 100644 index 000000000..36d6b175d --- /dev/null +++ b/components/syntax_extensions/utf8Macro.ml @@ -0,0 +1,50 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +exception Macro_not_found of string +exception Utf8_not_found of string + +let expand macro = + try + Hashtbl.find Utf8MacroTable.macro2utf8 macro + with Not_found -> raise (Macro_not_found macro) + +let unicode_of_tex s = + try + if s.[0] = '\\' then + expand (String.sub s 1 (String.length s - 1)) + else s + with Macro_not_found _ -> s + +let tex_of_unicode s = + (*WARNING: the space below is a nbsp (0x00A0), not a normal space *) + if s = " " then Some "" + else + try + Some ("\\" ^ Hashtbl.find Utf8MacroTable.utf82macro s) + with Not_found -> None + diff --git a/components/syntax_extensions/utf8Macro.mli b/components/syntax_extensions/utf8Macro.mli new file mode 100644 index 000000000..b21ba504f --- /dev/null +++ b/components/syntax_extensions/utf8Macro.mli @@ -0,0 +1,39 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception Macro_not_found of string +exception Utf8_not_found of string + + (** @param macro name + @return utf8 string *) +val expand: string -> string + + (** @param tex TeX like command (e.g. \forall, \lnot, ...) + * @return unicode character corresponding to the command if it exists, or the + * unchanged command if not *) +val unicode_of_tex: string -> string + + (** ... the other way round *) +val tex_of_unicode: string -> string option diff --git a/components/syntax_extensions/utf8MacroTable.ml b/components/syntax_extensions/utf8MacroTable.ml new file mode 100644 index 000000000..eefdcea0f --- /dev/null +++ b/components/syntax_extensions/utf8MacroTable.ml @@ -0,0 +1,2140 @@ +(* GENERATED by make_table: DO NOT EDIT! *) +let macro2utf8 = Hashtbl.create 2000 +let utf82macro = Hashtbl.create 2000 +let data = [ + "nscr", "\240\157\147\131"; + "LJcy", "\208\137"; + "dd", "\226\133\134"; + "Omacr", "\197\140"; + "npreceq", "\226\170\175\204\184"; + "Gcirc", "\196\156"; + "utilde", "\197\169"; + "rdca", "\226\164\183"; + "racute", "\197\149"; + "mstpos", "\226\136\190"; + "supnE", "\226\138\139"; + "NotLessLess", "\226\137\170\204\184\239\184\128"; + "iiint", "\226\136\173"; + "uscr", "\240\157\147\138"; + "Sfr", "\240\157\148\150"; + "nsupseteqq", "\226\138\137"; + "nwarrow", "\226\134\150"; + "twoheadrightarrow", "\226\134\160"; + "sccue", "\226\137\189"; + "NotSquareSuperset", "\226\138\144\204\184"; + "ee", "\226\133\135"; + "boxbox", "\226\167\137"; + "andand", "\226\169\149"; + "LeftVectorBar", "\226\165\146"; + "eg", "\226\170\154"; + "csc", "csc"; + "NotRightTriangleEqual", "\226\139\173"; + "filig", "\239\172\129"; + "atilde", "\195\163"; + "ring", "\203\154"; + "congdot", "\226\169\173"; + "gE", "\226\137\167"; + "rcedil", "\197\151"; + "el", "\226\170\153"; + "HorizontalLine", "\226\148\128"; + "incare", "\226\132\133"; + "hoarr", "\226\135\191"; + "SOFTcy", "\208\172"; + "conint", "\226\136\174"; + "OverParenthesis", "\239\184\181"; + "Uogon", "\197\178"; + "supne", "\226\138\139"; + "num", "#"; + "zcy", "\208\183"; + "Hfr", "\226\132\140"; + "dtri", "\226\150\191"; + "FilledSmallSquare", "\226\151\190"; + "SucceedsEqual", "\226\137\189"; + "leftthreetimes", "\226\139\139"; + "ycirc", "\197\183"; + "sqcup", "\226\138\148"; + "DoubleLeftArrow", "\226\135\144"; + "gtrless", "\226\137\183"; + "ge", "\226\137\165"; + "Product", "\226\136\143"; + "NotExists", "\226\136\132"; + "gg", "\226\137\171"; + "curlyvee", "\226\139\142"; + "ntrianglerighteq", "\226\139\173"; + "Colon", "\226\136\183"; + "rbrke", "\226\166\140"; + "LeftDownVector", "\226\135\131"; + "gl", "\226\137\183"; + "lrcorner", "\226\140\159"; + "mapstodown", "\226\134\167"; + "excl", "!"; + "cdots", "\226\139\175"; + "larr", "\226\134\144"; + "dtdot", "\226\139\177"; + "kgreen", "\196\184"; + "rtri", "\226\150\185"; + "rbarr", "\226\164\141"; + "ocy", "\208\190"; + "gt", ">"; + "DownLeftRightVector", "\226\165\144"; + "cup", "\226\136\170"; + "updownarrow", "\226\134\149"; + "Imacr", "\196\170"; + "cross", "\226\156\151"; + "Acirc", "\195\130"; + "lvertneqq", "\226\137\168\239\184\128"; + "ccaps", "\226\169\141"; + "NotLeftTriangleEqual", "\226\139\172"; + "IJlig", "\196\178"; + "boxplus", "\226\138\158"; + "epsilon", "\207\181"; + "zfr", "\240\157\148\183"; + "late", "\226\170\173"; + "ic", "\226\128\139"; + "lrhar", "\226\135\139"; + "gsim", "\226\137\179"; + "inf", "inf"; + "top", "\226\138\164"; + "odsold", "\226\166\188"; + "circlearrowright", "\226\134\187"; + "rtimes", "\226\139\138"; + "ii", "\226\133\136"; + "DoubleRightTee", "\226\138\168"; + "dcy", "\208\180"; + "boxdL", "\226\149\149"; + "duhar", "\226\165\175"; + "vert", "|"; + "sacute", "\197\155"; + "in", "\226\136\136"; + "Assign", "\226\137\148"; + "nsim", "\226\137\129"; + "boxdR", "\226\149\146"; + "o", "\206\191"; + "radic", "\226\136\154"; + "it", "\226\129\162"; + "int", "\226\136\171"; + "cwint", "\226\136\177"; + "ForAll", "\226\136\128"; + "simplus", "\226\168\164"; + "isindot", "\226\139\181"; + "rightthreetimes", "\226\139\140"; + "supseteqq", "\226\138\135"; + "bnot", "\226\140\144"; + "rppolint", "\226\168\146"; + "def", "\226\137\157"; + "TScy", "\208\166"; + "lE", "\226\137\166"; + "ffilig", "\239\172\131"; + "deg", "deg"; + "{", "{"; + "RightVector", "\226\135\128"; + "ofr", "\240\157\148\172"; + "|", "|"; + "liminf", "liminf"; + "}", "}"; + "LeftUpTeeVector", "\226\165\160"; + "scirc", "\197\157"; + "scedil", "\197\159"; + "ufisht", "\226\165\190"; + "LeftUpDownVector", "\226\165\145"; + "questeq", "\226\137\159"; + "leftarrow", "\226\134\144"; + "Ycy", "\208\171"; + "Coproduct", "\226\136\144"; + "det", "det"; + "boxdl", "\226\148\144"; + "Aopf", "\240\157\148\184"; + "srarr", "\226\134\146\239\184\128"; + "lbrke", "\226\166\139"; + "boxdr", "\226\148\140"; + "Ntilde", "\195\145"; + "gnap", "\226\170\138"; + "Cap", "\226\139\146"; + "swarhk", "\226\164\166"; + "ogt", "\226\167\129"; + "emptyset", "\226\136\133\239\184\128"; + "harrw", "\226\134\173"; + "lbarr", "\226\164\140"; + "Tilde", "\226\136\188"; + "delta", "\206\180"; + "Hopf", "\226\132\141"; + "dfr", "\240\157\148\161"; + "le", "\226\137\164"; + "lg", "lg"; + "ohm", "\226\132\166"; + "Jsercy", "\208\136"; + "quaternions", "\226\132\141"; + "DoubleLongLeftArrow", "\239\149\185"; + "Ncy", "\208\157"; + "nabla", "\226\136\135"; + "ltcir", "\226\169\185"; + "ll", "\226\137\170"; + "ln", "ln"; + "rmoust", "\226\142\177"; + "Oopf", "\240\157\149\134"; + "nbsp", "\194\160"; + "Kcedil", "\196\182"; + "vdots", "\226\139\174"; + "NotLessTilde", "\226\137\180"; + "lt", "<"; + "djcy", "\209\146"; + "DownRightTeeVector", "\226\165\159"; + "Ograve", "\195\146"; + "boxhD", "\226\149\165"; + "nsime", "\226\137\132"; + "egsdot", "\226\170\152"; + "mDDot", "\226\136\186"; + "bigodot", "\226\138\153"; + "Vopf", "\240\157\149\141"; + "looparrowright", "\226\134\172"; + "yucy", "\209\142"; + "trade", "\226\132\162"; + "Yfr", "\240\157\148\156"; + "kjcy", "\209\156"; + "mp", "\226\136\147"; + "leftrightarrows", "\226\135\134"; + "uharl", "\226\134\191"; + "ncap", "\226\169\131"; + "Iogon", "\196\174"; + "NotSubset", "\226\138\132"; + "Bumpeq", "\226\137\142"; + "mu", "\206\188"; + "FilledVerySmallSquare", "\239\150\155"; + "breve", "\203\152"; + "boxhU", "\226\149\168"; + "Sigma", "\206\163"; + "uharr", "\226\134\190"; + "xrArr", "\239\149\186"; + "ne", "\226\137\160"; + "oS", "\226\147\136"; + "xodot", "\226\138\153"; + "ni", "\226\136\139"; + "mdash", "\226\128\148"; + "Verbar", "\226\128\150"; + "die", "\194\168"; + "veebar", "\226\138\187"; + "UpArrowBar", "\226\164\146"; + "Ncaron", "\197\135"; + "RightArrowBar", "\226\135\165"; + "LongLeftArrow", "\239\149\182"; + "rceil", "\226\140\137"; + "LeftDownVectorBar", "\226\165\153"; + "umacr", "\197\171"; + "Hacek", "\203\135"; + "odblac", "\197\145"; + "lmidot", "\197\128"; + "dopf", "\240\157\149\149"; + "boxhd", "\226\148\172"; + "dim", "dim"; + "vnsub", "\226\138\132"; + "Bscr", "\226\132\172"; + "plussim", "\226\168\166"; + "doublebarwedge", "\226\140\134"; + "nu", "\206\189"; + "eqcolon", "\226\137\149"; + "luruhar", "\226\165\166"; + "Nfr", "\240\157\148\145"; + "preceq", "\226\170\175"; + "LeftTee", "\226\138\163"; + "div", "\195\183"; + "nVDash", "\226\138\175"; + "kopf", "\240\157\149\156"; + "Iscr", "\226\132\144"; + "vnsup", "\226\138\133"; + "gneq", "\226\137\169"; + "backepsilon", "\207\182"; + "boxhu", "\226\148\180"; + "ominus", "\226\138\150"; + "or", "\226\136\168"; + "lesdot", "\226\169\191"; + "RightVectorBar", "\226\165\147"; + "tcedil", "\197\163"; + "hstrok", "\196\167"; + "nrarrc", "\226\164\179\204\184"; + "ropf", "\240\157\149\163"; + "diamond", "\226\139\132"; + "smid", "\226\136\163\239\184\128"; + "nltri", "\226\139\170"; + "Pscr", "\240\157\146\171"; + "vartheta", "\207\145"; + "therefore", "\226\136\180"; + "pi", "\207\128"; + "ntrianglelefteq", "\226\139\172"; + "nearrow", "\226\134\151"; + "pm", "\194\177"; + "natural", "\226\153\174"; + "ucy", "\209\131"; + "olt", "\226\167\128"; + "Cfr", "\226\132\173"; + "yopf", "\240\157\149\170"; + "Otilde", "\195\149"; + "ntriangleleft", "\226\139\170"; + "pr", "\226\137\186"; + "Wscr", "\240\157\146\178"; + "midcir", "\226\171\176"; + "Lacute", "\196\185"; + "DoubleDot", "\194\168"; + "Tstrok", "\197\166"; + "nrarrw", "\226\134\157\204\184"; + "uArr", "\226\135\145"; + "nLtv", "\226\137\170\204\184\239\184\128"; + "rangle", "\226\140\170"; + "olcir", "\226\166\190"; + "Auml", "\195\132"; + "Succeeds", "\226\137\187"; + "DoubleLongLeftRightArrow", "\239\149\187"; + "TSHcy", "\208\139"; + "gammad", "\207\156"; + "epsiv", "\201\155"; + "notinva", "\226\136\137\204\184"; + "notinvb", "\226\139\183"; + "eqvparsl", "\226\167\165"; + "notinvc", "\226\139\182"; + "nsubE", "\226\138\136"; + "supplus", "\226\171\128"; + "RightUpDownVector", "\226\165\143"; + "Tab", "\t"; + "Lcedil", "\196\187"; + "backslash", "\\"; + "pointint", "\226\168\149"; + "jcy", "\208\185"; + "iocy", "\209\145"; + "escr", "\226\132\175"; + "submult", "\226\171\129"; + "iiota", "\226\132\169"; + "lceil", "\226\140\136"; + "omacr", "\197\141"; + "gneqq", "\226\137\169"; + "gcirc", "\196\157"; + "dotsquare", "\226\138\161"; + "ccaron", "\196\141"; + "Square", "\226\150\161"; + "RightDownTeeVector", "\226\165\157"; + "Ouml", "\195\150"; + "lurdshar", "\226\165\138"; + "SuchThat", "\226\136\139"; + "setminus", "\226\136\150"; + "lscr", "\226\132\147"; + "LessLess", "\226\170\161"; + "Sub", "\226\139\144"; + "sc", "\226\137\187"; + "rx", "\226\132\158"; + "RightFloor", "\226\140\139"; + "blacksquare", "\226\150\170"; + "ufr", "\240\157\148\178"; + "block", "\226\150\136"; + "dots", "\226\128\166"; + "nvsim", "\226\137\129\204\184"; + "caret", "\226\129\129"; + "demptyv", "\226\166\177"; + "Sum", "\226\136\145"; + "sscr", "\240\157\147\136"; + "nsube", "\226\138\136"; + "Sup", "\226\139\145"; + "ccupssm", "\226\169\144"; + "Because", "\226\136\181"; + "harrcir", "\226\165\136"; + "capbrcup", "\226\169\137"; + "RightUpVectorBar", "\226\165\148"; + "caps", "\226\136\169\239\184\128"; + "ohbar", "\226\166\181"; + "laemptyv", "\226\166\180"; + "uacute", "\195\186"; + "straightphi", "\207\134"; + "RightDoubleBracket", "\227\128\155"; + "zscr", "\240\157\147\143"; + "uogon", "\197\179"; + "Uarr", "\226\134\159"; + "nsucc", "\226\138\129"; + "RBarr", "\226\164\144"; + "NotRightTriangleBar", "\226\167\144\204\184"; + "to", "\226\134\146"; + "rpar", ")"; + "rdsh", "\226\134\179"; + "jfr", "\240\157\148\167"; + "ldquor", "\226\128\158"; + "bsime", "\226\139\141"; + "lAtail", "\226\164\155"; + "Hcirc", "\196\164"; + "aacute", "\195\161"; + "dot", "\203\153"; + "Tcy", "\208\162"; + "nsub", "\226\138\132"; + "kappa", "\206\186"; + "ovbar", "\226\140\189"; + "shcy", "\209\136"; + "kappav", "\207\176"; + "ropar", "\227\128\153"; + "gtcc", "\226\170\167"; + "ecolon", "\226\137\149"; + "circledast", "\226\138\155"; + "colon", ":"; + "timesbar", "\226\168\177"; + "precnsim", "\226\139\168"; + "ord", "\226\169\157"; + "real", "\226\132\156"; + "nexists", "\226\136\132"; + "nsup", "\226\138\133"; + "zhcy", "\208\182"; + "imacr", "\196\171"; + "egrave", "\195\168"; + "acirc", "\195\162"; + "grave", "`"; + "biguplus", "\226\138\142"; + "HumpEqual", "\226\137\143"; + "GreaterSlantEqual", "\226\169\190"; + "capand", "\226\169\132"; + "yuml", "\195\191"; + "orv", "\226\169\155"; + "Icy", "\208\152"; + "rightharpoondown", "\226\135\129"; + "upsilon", "\207\133"; + "preccurlyeq", "\226\137\188"; + "ShortUpArrow", "\226\140\131\239\184\128"; + "searhk", "\226\164\165"; + "commat", "@"; + "Sqrt", "\226\136\154"; + "wp", "\226\132\152"; + "succnapprox", "\226\139\169"; + "wr", "\226\137\128"; + "NotTildeTilde", "\226\137\137"; + "dcaron", "\196\143"; + "Tfr", "\240\157\148\151"; + "bigwedge", "\226\139\128"; + "DScy", "\208\133"; + "nrtrie", "\226\139\173"; + "esim", "\226\137\130"; + "Not", "\226\171\172"; + "xmap", "\239\149\189"; + "rect", "\226\150\173"; + "Fouriertrf", "\226\132\177"; + "xi", "\206\190"; + "NotTilde", "\226\137\129"; + "gbreve", "\196\159"; + "par", "\226\136\165"; + "ddots", "\226\139\177"; + "nhArr", "\226\135\142"; + "lsim", "\226\137\178"; + "RightCeiling", "\226\140\137"; + "nedot", "\226\137\160\239\184\128"; + "thksim", "\226\136\188\239\184\128"; + "lEg", "\226\139\154"; + "Ifr", "\226\132\145"; + "emsp", "\226\128\131"; + "lopar", "\227\128\152"; + "iiiint", "\226\168\140"; + "straightepsilon", "\206\181"; + "intlarhk", "\226\168\151"; + "image", "\226\132\145"; + "sqsubseteq", "\226\138\145"; + "lnapprox", "\226\170\137"; + "Leftrightarrow", "\226\135\148"; + "cemptyv", "\226\166\178"; + "alpha", "\206\177"; + "uml", "\194\168"; + "barwedge", "\226\138\188"; + "KHcy", "\208\165"; + "tilde", "\203\156"; + "Superset", "\226\138\131"; + "gesles", "\226\170\148"; + "bigoplus", "\226\138\149"; + "boxuL", "\226\149\155"; + "rbbrk", "\227\128\149"; + "nrightarrow", "\226\134\155"; + "hkswarow", "\226\164\166"; + "DiacriticalDoubleAcute", "\203\157"; + "nbumpe", "\226\137\143\204\184"; + "uhblk", "\226\150\128"; + "NotSupersetEqual", "\226\138\137"; + "ntgl", "\226\137\185"; + "Fopf", "\240\157\148\189"; + "boxuR", "\226\149\152"; + "swarr", "\226\134\153"; + "nsqsube", "\226\139\162"; + "pluscir", "\226\168\162"; + "pcy", "\208\191"; + "leqslant", "\226\169\189"; + "lnap", "\226\170\137"; + "lthree", "\226\139\139"; + "smte", "\226\170\172"; + "olcross", "\226\166\187"; + "nvrArr", "\226\135\143"; + "andslope", "\226\169\152"; + "MediumSpace", "\226\129\159"; + "boxvH", "\226\149\170"; + "Nacute", "\197\131"; + "nGtv", "\226\137\171\204\184\239\184\128"; + "Mopf", "\240\157\149\132"; + "dfisht", "\226\165\191"; + "boxvL", "\226\149\161"; + "pertenk", "\226\128\177"; + "NotPrecedes", "\226\138\128"; + "profalar", "\226\140\174"; + "roplus", "\226\168\174"; + "boxvR", "\226\149\158"; + "utrif", "\226\150\180"; + "uHar", "\226\165\163"; + "nltrie", "\226\139\172"; + "NotNestedGreaterGreater", "\226\146\162\204\184"; + "smtes", "\226\170\172\239\184\128"; + "LeftAngleBracket", "\226\140\169"; + "iogon", "\196\175"; + "ExponentialE", "\226\133\135"; + "Topf", "\240\157\149\139"; + "GreaterEqual", "\226\137\165"; + "DownTee", "\226\138\164"; + "boxul", "\226\148\152"; + "wreath", "\226\137\128"; + "sigma", "\207\131"; + "ENG", "\197\138"; + "Ncedil", "\197\133"; + "ecy", "\209\141"; + "nsubset", "\226\138\132"; + "LessFullEqual", "\226\137\166"; + "bsolb", "\226\167\133"; + "boxur", "\226\148\148"; + "ThinSpace", "\226\128\137"; + "supdsub", "\226\171\152"; + "colone", "\226\137\148"; + "curren", "\194\164"; + "boxvh", "\226\148\188"; + "ecaron", "\196\155"; + "UnderBrace", "\239\184\184"; + "caron", "\203\135"; + "ultri", "\226\151\184"; + "boxvl", "\226\148\164"; + "scap", "\226\137\191"; + "boxvr", "\226\148\156"; + "bopf", "\240\157\149\147"; + "pfr", "\240\157\148\173"; + "nspar", "\226\136\166\239\184\128"; + "NegativeMediumSpace", "\226\129\159\239\184\128"; + "simgE", "\226\170\160"; + "nvDash", "\226\138\173"; + "NotGreaterFullEqual", "\226\137\176"; + "uparrow", "\226\134\145"; + "nsupset", "\226\138\133"; + "simeq", "\226\137\131"; + "Zcy", "\208\151"; + "RightTriangle", "\226\138\179"; + "Lang", "\227\128\138"; + "Ucirc", "\195\155"; + "iopf", "\240\157\149\154"; + "leftrightsquigarrow", "\226\134\173"; + "Gscr", "\240\157\146\162"; + "lfloor", "\226\140\138"; + "lbbrk", "\227\128\148"; + "bigvee", "\226\139\129"; + "ordf", "\194\170"; + "rsquo", "\226\128\153"; + "parallel", "\226\136\165"; + "half", "\194\189"; + "supseteq", "\226\138\135"; + "ngeqq", "\226\137\177"; + "popf", "\240\157\149\161"; + "NonBreakingSpace", "\194\160"; + "softcy", "\209\140"; + "ordm", "\194\186"; + "Nscr", "\240\157\146\169"; + "owns", "\226\136\139"; + "phi", "\207\149"; + "efr", "\240\157\148\162"; + "nesear", "\226\164\168"; + "marker", "\226\150\174"; + "lneq", "\226\137\168"; + "parallet", "????"; + "ndash", "\226\128\147"; + "DoubleLeftTee", "\226\171\164"; + "lArr", "\226\135\144"; + "becaus", "\226\136\181"; + "RightTee", "\226\138\162"; + "Ocy", "\208\158"; + "ntlg", "\226\137\184"; + "cacute", "\196\135"; + "wopf", "\240\157\149\168"; + "Cup", "\226\139\147"; + "Uscr", "\240\157\146\176"; + "NotHumpEqual", "\226\137\143\204\184"; + "rnmid", "\226\171\174"; + "nsupE", "\226\138\137"; + "bemptyv", "\226\166\176"; + "lsqb", "["; + "nrarr", "\226\134\155"; + "egs", "\226\139\157"; + "reals", "\226\132\157"; + "CupCap", "\226\137\141"; + "Oacute", "\195\147"; + "Zfr", "\226\132\168"; + "ReverseEquilibrium", "\226\135\139"; + "ccedil", "\195\167"; + "bigtriangleup", "\226\150\179"; + "piv", "\207\150"; + "cirscir", "\226\167\130"; + "exists", "\226\136\131"; + "Uarrocir", "\226\165\137"; + "Dcy", "\208\148"; + "cscr", "\240\157\146\184"; + "zcaron", "\197\190"; + "isinE", "\226\139\185"; + "gtcir", "\226\169\186"; + "hookrightarrow", "\226\134\170"; + "Int", "\226\136\172"; + "nsupe", "\226\138\137"; + "dotplus", "\226\136\148"; + "ncup", "\226\169\130"; + "jscr", "\240\157\146\191"; + "angmsdaa", "\226\166\168"; + "Iukcy", "\208\134"; + "flat", "\226\153\173"; + "bNot", "\226\171\173"; + "angmsdab", "\226\166\169"; + "angmsdac", "\226\166\170"; + "xdtri", "\226\150\189"; + "iota", "\206\185"; + "angmsdad", "\226\166\171"; + "angmsdae", "\226\166\172"; + "rightarrowtail", "\226\134\163"; + "angmsdaf", "\226\166\173"; + "Ocirc", "\195\148"; + "angmsdag", "\226\166\174"; + "Ofr", "\240\157\148\146"; + "maltese", "\226\156\160"; + "angmsdah", "\226\166\175"; + "Del", "\226\136\135"; + "Barwed", "\226\140\134"; + "drbkarow", "\226\164\144"; + "qscr", "\240\157\147\134"; + "ETH", "\195\144"; + "operp", "\226\166\185"; + "daleth", "\226\132\184"; + "bull", "\226\128\162"; + "simlE", "\226\170\159"; + "lsquo", "\226\128\152"; + "Larr", "\226\134\158"; + "curarr", "\226\134\183"; + "blacktriangleleft", "\226\151\130"; + "hellip", "\226\128\166"; + "DoubleVerticalBar", "\226\136\165"; + "rBarr", "\226\164\143"; + "chcy", "\209\135"; + "varpi", "\207\150"; + "Cconint", "\226\136\176"; + "xlarr", "\239\149\182"; + "xscr", "\240\157\147\141"; + "DoubleLongRightArrow", "\239\149\186"; + "CounterClockwiseContourIntegral", "\226\136\179"; + "urcrop", "\226\140\142"; + "RightAngleBracket", "\226\140\170"; + "Rcaron", "\197\152"; + "latail", "\226\164\153"; + "pitchfork", "\226\139\148"; + "nvinfin", "\226\167\158"; + "hcirc", "\196\165"; + "nexist", "\226\136\132"; + "checkmark", "\226\156\147"; + "tridot", "\226\151\172"; + "vcy", "\208\178"; + "isins", "\226\139\180"; + "fllig", "\239\172\130"; + "Dfr", "\240\157\148\135"; + "hercon", "\226\138\185"; + "gEl", "\226\139\155"; + "bump", "\226\137\142"; + "aleph", "\226\132\181"; + "Ubreve", "\197\172"; + "isinv", "\226\136\136"; + "smile", "\226\140\163"; + "llcorner", "\226\140\158"; + "boxH", "\226\149\144"; + "ecir", "\226\137\150"; + "varnothing", "\226\136\133"; + "iuml", "\195\175"; + "mlcp", "\226\171\155"; + "leftrightharpoons", "\226\135\139"; + "ncong", "\226\137\135"; + "Vert", "\226\128\150"; + "vee", "\226\136\168"; + "star", "\226\139\134"; + "boxV", "\226\149\145"; + "LeftRightArrow", "\226\134\148"; + "leftrightarrow", "\226\134\148"; + "lstrok", "\197\130"; + "ell", "\226\132\147"; + "VerticalSeparator", "\226\157\152"; + "Ubrcy", "\208\142"; + "NotGreater", "\226\137\175"; + "Abreve", "\196\130"; + "TildeTilde", "\226\137\136"; + "CircleTimes", "\226\138\151"; + "subsetneq", "\226\138\138"; + "ltcc", "\226\170\166"; + "els", "\226\139\156"; + "succneqq", "\226\170\182"; + "kcy", "\208\186"; + "nshortmid", "\226\136\164\239\184\128"; + "mldr", "\226\128\166"; + "harr", "\226\134\148"; + "gimel", "\226\132\183"; + "Otimes", "\226\168\183"; + "vsubnE", "\226\138\138\239\184\128"; + "ltdot", "\226\139\150"; + "boxh", "\226\148\128"; + "notin", "\226\136\137"; + "RuleDelayed", "\226\167\180"; + "sqsube", "\226\138\145"; + "macr", "\194\175"; + "Icirc", "\195\142"; + "comma", ","; + "Cayleys", "\226\132\173"; + "rightleftharpoons", "\226\135\140"; + "Rarrtl", "\226\164\150"; + "SquareSubsetEqual", "\226\138\145"; + "NotGreaterEqual", "\226\137\177\226\131\165"; + "vfr", "\240\157\148\179"; + "utri", "\226\150\181"; + "simne", "\226\137\134"; + "LeftUpVectorBar", "\226\165\152"; + "hksearow", "\226\164\165"; + "boxv", "\226\148\130"; + "curvearrowleft", "\226\134\182"; + "eng", "\197\139"; + "gtrarr", "\226\165\184"; + "iecy", "\208\181"; + "varr", "\226\134\149"; + "lBarr", "\226\164\142"; + "ker", "ker"; + "imath", "\196\177"; + "Dstrok", "\196\144"; + "rlarr", "\226\135\132"; + "leftleftarrows", "\226\135\135"; + "DifferentialD", "\226\133\134"; + "because", "\226\136\181"; + "ulcrop", "\226\140\143"; + "prE", "\226\170\175"; + "oast", "\226\138\155"; + "DotEqual", "\226\137\144"; + "vsubne", "\226\138\138\239\184\128"; + "hbar", "\226\132\143\239\184\128"; + "subset", "\226\138\130"; + "UpTeeArrow", "\226\134\165"; + "LeftFloor", "\226\140\138"; + "kfr", "\240\157\148\168"; + "nisd", "\226\139\186"; + "scnE", "\226\170\182"; + "Ucy", "\208\163"; + "nprec", "\226\138\128"; + "ltrPar", "\226\166\150"; + "Scaron", "\197\160"; + "InvisibleComma", "\226\128\139"; + "SquareUnion", "\226\138\148"; + "ffllig", "\239\172\132"; + "approxeq", "\226\137\138"; + "yacute", "\195\189"; + "pre", "\226\170\175"; + "nsqsupe", "\226\139\163"; + "supset", "\226\138\131"; + "bsolhsub", "\\\226\138\130"; + "nshortparallel", "\226\136\166\239\184\128"; + "lozenge", "\226\151\138"; + "lnot", "\194\172"; + "Dopf", "\240\157\148\187"; + "leftharpoonup", "\226\134\188"; + "Jcy", "\208\153"; + "rightarrow", "\226\134\146"; + "ntriangleright", "\226\139\171"; + "Ccirc", "\196\136"; + "eacute", "\195\169"; + "acute", "\194\180"; + "Precedes", "\226\137\186"; + "middot", "\194\183"; + "lHar", "\226\165\162"; + "eparsl", "\226\167\163"; + "psi", "\207\136"; + "parsl", "\226\136\165\239\184\128"; + "UpperLeftArrow", "\226\134\150"; + "oror", "\226\169\150"; + "Kopf", "\240\157\149\130"; + "apacir", "\226\169\175"; + "dharl", "\226\135\131"; + "nequiv", "\226\137\162"; + "rightleftarrows", "\226\135\132"; + "UnderParenthesis", "\239\184\182"; + "notni", "\226\136\140"; + "dagger", "\226\128\160"; + "dharr", "\226\135\130"; + "twoheadleftarrow", "\226\134\158"; + "frac12", "\194\189"; + "varsubsetneqq", "\226\138\138\239\184\128"; + "frac13", "\226\133\147"; + "Ufr", "\240\157\148\152"; + "NestedLessLess", "\226\137\170"; + "llarr", "\226\135\135"; + "frac14", "\194\188"; + "frac15", "\226\133\149"; + "Ropf", "\226\132\157"; + "frac16", "\226\133\153"; + "lrtri", "\226\138\191"; + "frac18", "\226\133\155"; + "cedil", "\194\184"; + "subsim", "\226\171\135"; + "PrecedesTilde", "\226\137\190"; + "igrave", "\195\172"; + "gjcy", "\209\147"; + "LeftVector", "\226\134\188"; + "notniva", "\226\136\140"; + "notnivb", "\226\139\190"; + "ogon", "\203\155"; + "notnivc", "\226\139\189"; + "Yopf", "\240\157\149\144"; + "there4", "\226\136\180"; + "udarr", "\226\135\133"; + "bkarow", "\226\164\141"; + "frac23", "\226\133\148"; + "frac25", "\226\133\150"; + "njcy", "\209\154"; + "Dashv", "\226\171\164"; + "eta", "\206\183"; + "bcong", "\226\137\140"; + "Ugrave", "\195\153"; + "csube", "\226\171\145"; + "clubs", "\226\153\163"; + "supmult", "\226\171\130"; + "MinusPlus", "\226\136\147"; + "Jfr", "\240\157\148\141"; + "ensp", "\226\128\130"; + "ucirc", "\195\187"; + "supsim", "\226\171\136"; + "eth", "\195\176"; + "OverBrace", "\239\184\183"; + "Dot", "\194\168"; + "xcap", "\226\139\130"; + "vangrt", "\226\138\190"; + "NotSubsetEqual", "\226\138\136"; + "frac34", "\194\190"; + "frac35", "\226\133\151"; + "planck", "\226\132\143\239\184\128"; + "lnsim", "\226\139\166"; + "gopf", "\240\157\149\152"; + "frac38", "\226\133\156"; + "DotDot", "\226\131\156"; + "mapstoup", "\226\134\165"; + "Escr", "\226\132\176"; + "Integral", "\226\136\171"; + "Agrave", "\195\128"; + "longleftarrow", "????;"; + "Tcaron", "\197\164"; + "nopf", "\240\157\149\159"; + "LongLeftRightArrow", "\239\149\184"; + "Emacr", "\196\146"; + "omid", "\226\166\182"; + "spades", "\226\153\160"; + "naturals", "\226\132\149"; + "Lscr", "\226\132\146"; + "udblac", "\197\177"; + "SucceedsTilde", "\226\137\191"; + "frac45", "\226\133\152"; + "clubsuit", "\226\153\163"; + "mumap", "\226\138\184"; + "vltri", "\226\138\178"; + "LeftArrowBar", "\226\135\164"; + "zacute", "\197\186"; + "szlig", "\195\159"; + "suplarr", "\226\165\187"; + "RightDownVector", "\226\135\130"; + "male", "\226\153\130"; + "RightDownVectorBar", "\226\165\149"; + "gdot", "\196\161"; + "nleqq", "\226\137\176"; + "uopf", "\240\157\149\166"; + "YIcy", "\208\135"; + "Sscr", "\240\157\146\174"; + "empty", "\226\136\133\239\184\128"; + "Vdash", "\226\138\169"; + "sqsubset", "\226\138\143"; + "efDot", "\226\137\146"; + "times", "\195\151"; + "Oslash", "\195\152"; + "itilde", "\196\169"; + "frac56", "\226\133\154"; + "numero", "\226\132\150"; + "malt", "\226\156\160"; + "npart", "\226\136\130\204\184"; + "frac58", "\226\133\157"; + "Zscr", "\240\157\146\181"; + "integers", "\226\132\164"; + "CloseCurlyQuote", "\226\128\153"; + "NewLine", "\n"; + "fcy", "\209\132"; + "nwarr", "\226\134\150"; + "thicksim", "\226\136\188\239\184\128"; + "nprcue", "\226\139\160"; + "lcub", "{"; + "forall", "\226\136\128"; + "plusacir", "\226\168\163"; + "ascr", "\240\157\146\182"; + "plustwo", "\226\168\167"; + "Utilde", "\197\168"; + "lambda", "\206\187"; + "odash", "\226\138\157"; + "iukcy", "\209\150"; + "sqsupset", "\226\138\144"; + "Racute", "\197\148"; + "Longleftarrow", "????"; + "capcap", "\226\169\139"; + "ocirc", "\195\180"; + "nless", "\226\137\174"; + "Wedge", "\226\139\128"; + "qfr", "\240\157\148\174"; + "natur", "\226\153\174"; + "hscr", "\240\157\146\189"; + "ldca", "\226\164\182"; + "ClockwiseContourIntegral", "\226\136\178"; + "exp", "exp"; + "RightTeeArrow", "\226\134\166"; + "orarr", "\226\134\187"; + "tanh", "tanh"; + "frac78", "\226\133\158"; + "Atilde", "\195\131"; + "arcsin", "arcsin"; + "Rcedil", "\197\150"; + "oscr", "\226\132\180"; + "InvisibleTimes", "\226\129\162"; + "sime", "\226\137\131"; + "simg", "\226\170\158"; + "Conint", "\226\136\175"; + "Yuml", "\197\184"; + "rlhar", "\226\135\140"; + "rarrbfs", "\226\164\160"; + "siml", "\226\170\157"; + "DownRightVectorBar", "\226\165\151"; + "vscr", "\240\157\147\139"; + "divide", "\195\183"; + "PlusMinus", "\194\177"; + "ffr", "\240\157\148\163"; + "DownLeftTeeVector", "\226\165\158"; + "EmptySmallSquare", "\226\151\189"; + "SHCHcy", "\208\169"; + "cirmid", "\226\171\175"; + "sigmav", "\207\130"; + "csub", "\226\171\143"; + "npar", "\226\136\166"; + "bsemi", "\226\129\143"; + "swArr", "\226\135\153"; + "Pcy", "\208\159"; + "sinh", "sinh"; + "lharul", "\226\165\170"; + "Jukcy", "\208\132"; + "permil", "\226\128\176"; + "ndivides", "\226\136\164"; + "Aring", "\195\133"; + "longmapsto", "????"; + "Esim", "\226\169\179"; + "csup", "\226\171\144"; + "trie", "\226\137\156"; + "ubrcy", "\209\158"; + "NotEqualTilde", "\226\137\130\204\184"; + "dotminus", "\226\136\184"; + "diamondsuit", "\226\153\162"; + "xnis", "\226\139\187"; + "Eogon", "\196\152"; + "cuvee", "\226\139\142"; + "DZcy", "\208\143"; + "nRightarrow", "\226\135\143"; + "sqsupe", "\226\138\146"; + "nsccue", "\226\139\161"; + "drcrop", "\226\140\140"; + "DownBreve", "\204\145"; + "Ecy", "\208\173"; + "rdquor", "\226\128\157"; + "rAtail", "\226\164\156"; + "icirc", "\195\174"; + "gacute", "\199\181"; + "hyphen", "\226\128\144"; + "uuml", "\195\188"; + "thorn", "\195\190"; + "ltri", "\226\151\131"; + "eqslantgtr", "\226\139\157"; + "DoubleContourIntegral", "\226\136\175"; + "lescc", "\226\170\168"; + "DiacriticalGrave", "`"; + "NotPrecedesEqual", "\226\170\175\204\184"; + "RightArrow", "\226\134\146"; + "race", "\226\167\154"; + "topbot", "\226\140\182"; + "Pfr", "\240\157\148\147"; + "napprox", "\226\137\137"; + "Sacute", "\197\154"; + "cupor", "\226\169\133"; + "OverBar", "\194\175"; + "bepsi", "\207\182"; + "plankv", "\226\132\143"; + "lap", "\226\137\178"; + "orslope", "\226\169\151"; + "beta", "\206\178"; + "ShortDownArrow", "\226\140\132\239\184\128"; + "perp", "\226\138\165"; + "lat", "\226\170\171"; + "CenterDot", "\194\183"; + "urcorner", "\226\140\157"; + "models", "\226\138\167"; + "beth", "\226\132\182"; + "subE", "\226\138\134"; + "subnE", "\226\138\138"; + "ldots", "\226\128\166"; + "yacy", "\209\143"; + "udhar", "\226\165\174"; + "Scedil", "\197\158"; + "subsub", "\226\171\149"; + "nvrtrie", "\226\139\173\204\184"; + "Phi", "\206\166"; + "Efr", "\240\157\148\136"; + "larrfs", "\226\164\157"; + "angle", "\226\136\160"; + "TildeFullEqual", "\226\137\133"; + "Jcirc", "\196\180"; + "THORN", "\195\158"; + "acE", "\226\167\155"; + "Longleftrightarrow", "????"; + "xuplus", "\226\138\142"; + "searr", "\226\134\152"; + "gvertneqq", "\226\137\169\239\184\128"; + "subsup", "\226\171\147"; + "NotSucceedsEqual", "\226\170\176\204\184"; + "gtrsim", "\226\137\179"; + "nrArr", "\226\135\143"; + "NotSquareSupersetEqual", "\226\139\163"; + "notindot", "\226\139\182\239\184\128"; + "HARDcy", "\208\170"; + "jmath", "j\239\184\128"; + "aelig", "\195\166"; + "slarr", "\226\134\144\239\184\128"; + "dlcrop", "\226\140\141"; + "sube", "\226\138\134"; + "cuepr", "\226\139\158"; + "supsub", "\226\171\148"; + "trianglelefteq", "\226\138\180"; + "subne", "\226\138\138"; + "between", "\226\137\172"; + "measuredangle", "\226\136\161"; + "swnwar", "\226\164\170"; + "lcy", "\208\187"; + "ccirc", "\196\137"; + "larrhk", "\226\134\169"; + "DiacriticalTilde", "\203\156"; + "brvbar", "\194\166"; + "triangledown", "\226\150\191"; + "dtrif", "\226\150\190"; + "Bopf", "\240\157\148\185"; + "xwedge", "\226\139\128"; + "rightsquigarrow", "\226\134\157"; + "acd", "\226\136\191"; + "supsup", "\226\171\150"; + "UpEquilibrium", "\226\165\174"; + "succ", "\226\137\187"; + "eqslantless", "\226\139\156"; + "coprod", "\226\136\144"; + "OpenCurlyDoubleQuote", "\226\128\156"; + "NotGreaterSlantEqual", "\226\137\177"; + "solb", "\226\167\132"; + "HumpDownHump", "\226\137\142"; + "gtrapprox", "\226\137\179"; + "Iopf", "\240\157\149\128"; + "leg", "\226\139\154"; + "wfr", "\240\157\148\180"; + "mapstoleft", "\226\134\164"; + "gnapprox", "\226\170\138"; + "lgE", "\226\170\145"; + "CloseCurlyDoubleQuote", "\226\128\157"; + "NotNestedLessLess", "\226\146\161\204\184"; + "acy", "\208\176"; + "leq", "\226\137\164"; + "Popf", "\226\132\153"; + "les", "\226\169\189"; + "succcurlyeq", "\226\137\189"; + "heartsuit", "\226\153\161"; + "angmsd", "\226\136\161"; + "cuesc", "\226\139\159"; + "lesseqgtr", "\226\139\154"; + "vartriangleright", "\226\138\179"; + "csupe", "\226\171\146"; + "rthree", "\226\139\140"; + "Idot", "\196\176"; + "gtdot", "\226\139\151"; + "dashv", "\226\138\163"; + "Odblac", "\197\144"; + "Lmidot", "\196\191"; + "andd", "\226\169\156"; + "Wopf", "\240\157\149\142"; + "nvltrie", "\226\139\172\204\184"; + "nhpar", "\226\171\178"; + "geqslant", "\226\169\190"; + "xlArr", "\239\149\185"; + "SquareSubset", "\226\138\143"; + "intcal", "\226\138\186"; + "ljcy", "\209\153"; + "lfr", "\240\157\148\169"; + "gtlPar", "\226\166\149"; + "zigrarr", "\226\135\157"; + "nvap", "\226\137\137\204\184"; + "boxtimes", "\226\138\160"; + "raquo", "\194\187"; + "CircleMinus", "\226\138\150"; + "centerdot", "\194\183"; + "xoplus", "\226\138\149"; + "simdot", "\226\169\170"; + "Vcy", "\208\146"; + "profline", "\226\140\146"; + "ltquest", "\226\169\187"; + "andv", "\226\169\154"; + "lessgtr", "\226\137\182"; + "lesdoto", "\226\170\129"; + "NotSquareSubset", "\226\138\143\204\184"; + "bullet", "\226\128\162"; + "rarrsim", "\226\165\180"; + "Tcedil", "\197\162"; + "Hstrok", "\196\166"; + "eopf", "\240\157\149\150"; + "Theta", "\206\152"; + "Cscr", "\240\157\146\158"; + "emacr", "\196\147"; + "UnionPlus", "\226\138\142"; + "Vee", "\226\139\129"; + "arctan", "arctan"; + "afr", "\240\157\148\158"; + "thinsp", "\226\128\137"; + "bottom", "\226\138\165"; + "lopf", "\240\157\149\157"; + "larrlp", "\226\134\171"; + "lbrace", "{"; + "Jscr", "\240\157\146\165"; + "Kcy", "\208\154"; + "shortparallel", "\226\136\165\239\184\128"; + "hairsp", "\226\128\138"; + "osol", "\226\138\152"; + "lbrack", "["; + "hArr", "\226\135\148"; + "vdash", "\226\138\162"; + "UpDownArrow", "\226\134\149"; + "edot", "\196\151"; + "vzigzag", "\226\166\154"; + "sopf", "\240\157\149\164"; + "NotLessGreater", "\226\137\184"; + "Qscr", "\240\157\146\172"; + "Gammad", "\207\156"; + "SubsetEqual", "\226\138\134"; + "uplus", "\226\138\142"; + "LeftTriangle", "\226\138\178"; + "ange", "\226\166\164"; + "lim", "lim"; + "triangleright", "\226\150\185"; + "angrt", "\226\136\159"; + "rfloor", "\226\140\139"; + "bigtriangledown", "\226\150\189"; + "ofcir", "\226\166\191"; + "Vfr", "\240\157\148\153"; + "zopf", "\240\157\149\171"; + "UpArrowDownArrow", "\226\135\133"; + "Xscr", "\240\157\146\179"; + "digamma", "\207\156"; + "SmallCircle", "\226\136\152"; + "vArr", "\226\135\149"; + "eqsim", "\226\137\130"; + "downharpoonright", "\226\135\130"; + "Ccaron", "\196\140"; + "sdot", "\226\139\133"; + "frown", "\226\140\162"; + "angst", "\226\132\171"; + "lesges", "\226\170\147"; + "iacute", "\195\173"; + "wedge", "\226\136\167"; + "ssetmn", "\226\136\150\239\184\128"; + "rotimes", "\226\168\181"; + "laquo", "\194\171"; + "bigstar", "\226\152\133"; + "Rrightarrow", "\226\135\155"; + "erDot", "\226\137\147"; + "subseteq", "\226\138\134"; + "leftharpoondown", "\226\134\189"; + "infin", "\226\136\158"; + "zdot", "\197\188"; + "solbar", "\226\140\191"; + "Iuml", "\195\143"; + "Kfr", "\240\157\148\142"; + "fscr", "\240\157\146\187"; + "DJcy", "\208\130"; + "veeeq", "\226\137\154"; + "Star", "\226\139\134"; + "lsquor", "\226\128\154"; + "Uacute", "\195\154"; + "weierp", "\226\132\152"; + "rang", "\226\140\170"; + "hamilt", "\226\132\139"; + "angsph", "\226\136\162"; + "YUcy", "\208\174"; + "Wcirc", "\197\180"; + "supsetneq", "\226\138\139"; + "gap", "\226\137\179"; + "mscr", "\240\157\147\130"; + "KJcy", "\208\140"; + "qprime", "\226\129\151"; + "EqualTilde", "\226\137\130"; + "vBar", "\226\171\168"; + "larrpl", "\226\164\185"; + "nvge", "\226\137\177"; + "approx", "\226\137\136"; + "lnE", "\226\137\168"; + "NotGreaterLess", "\226\137\185"; + "epar", "\226\139\149"; + "bigotimes", "\226\138\151"; + "xharr", "\239\149\184"; + "roang", "\239\149\153"; + "xcup", "\226\139\131"; + "tscr", "\240\157\147\137"; + "thkap", "\226\137\136\239\184\128"; + "Aacute", "\195\129"; + "rcy", "\209\128"; + "jukcy", "\209\148"; + "hookleftarrow", "\226\134\169"; + "napid", "\226\137\139\204\184"; + "tscy", "\209\134"; + "nvgt", "\226\137\175"; + "lpar", "("; + "ldsh", "\226\134\178"; + "aring", "\195\165"; + "nGg", "\226\139\153\204\184"; + "LessEqualGreater", "\226\139\154"; + "gcd", "gcd"; + "oplus", "\226\138\149"; + "lcaron", "\196\190"; + "DownArrow", "\226\134\147"; + "xutri", "\226\150\179"; + "Psi", "\206\168"; + "lesssim", "\226\137\178"; + "topcir", "\226\171\177"; + "puncsp", "\226\128\136"; + "origof", "\226\138\182"; + "gnsim", "\226\139\167"; + "eogon", "\196\153"; + "spar", "\226\136\165\239\184\128"; + "LowerRightArrow", "\226\134\152"; + "Lleftarrow", "\226\135\154"; + "nGt", "\226\137\171\204\184"; + "euml", "\195\171"; + "reg", "\194\174"; + "exponentiale", "\226\133\135"; + "qint", "\226\168\140"; + "sqcups", "\226\138\148\239\184\128"; + "lne", "\226\137\168"; + "LessSlantEqual", "\226\169\189"; + "Egrave", "\195\136"; + "orderof", "\226\132\180"; + "cirE", "\226\167\131"; + "nleqslant", "\226\137\176"; + "gcy", "\208\179"; + "curvearrowright", "\226\134\183"; + "ratail", "\226\134\163"; + "emsp13", "\226\128\132"; + "sdotb", "\226\138\161"; + "horbar", "\226\128\149"; + "emsp14", "\226\128\133"; + "npre", "\226\170\175\204\184"; + "rbrksld", "\226\166\142"; + "sdote", "\226\169\166"; + "varsupsetneqq", "\226\138\139\239\184\128"; + "VeryThinSpace", "\226\128\138"; + "DownArrowBar", "\226\164\147"; + "Rightarrow", "\226\135\146"; + "ocir", "\226\138\154"; + "NotHumpDownHump", "\226\137\142\204\184"; + "darr", "\226\134\147"; + "geqq", "\226\137\167"; + "sup1", "\194\185"; + "log", "log"; + "sup2", "\194\178"; + "micro", "\194\181"; + "amp", "&"; + "arccos", "arccos"; + "sup3", "\194\179"; + "GreaterTilde", "\226\137\179"; + "circeq", "\226\137\151"; + "rfr", "\240\157\148\175"; + "dash", "\226\128\144"; + "rbrkslu", "\226\166\144"; + "Dcaron", "\196\142"; + "and", "\226\136\167"; + "Vbar", "\226\171\171"; + "angzarr", "\226\141\188"; + "gel", "\226\139\155"; + "ang", "\226\136\160"; + "lor", "\226\136\168"; + "circ", "\226\136\152"; + "upharpoonright", "\226\134\190"; + "dblac", "\203\157"; + "subsetneqq", "\226\138\138"; + "rhard", "\226\135\129"; + "Intersection", "\226\139\130"; + "cire", "\226\137\151"; + "apE", "\226\137\138"; + "sung", "\226\153\170"; + "geq", "\226\137\165"; + "succsim", "\226\137\191"; + "ges", "\226\169\190"; + "Gbreve", "\196\158"; + "intercal", "\226\138\186"; + "supE", "\226\138\135"; + "NotCupCap", "\226\137\173"; + "loz", "\226\151\138"; + "capcup", "\226\169\135"; + "larrtl", "\226\134\162"; + "AElig", "\195\134"; + "rarr", "\226\134\146"; + "varkappa", "\207\176"; + "upsi", "\207\133"; + "loang", "\239\149\152"; + "looparrowleft", "\226\134\171"; + "IOcy", "\208\129"; + "backprime", "\226\128\181"; + "sstarf", "\226\139\134"; + "rharu", "\226\135\128"; + "gesl", "\226\139\155\239\184\128"; + "xotime", "\226\138\151"; + "minus", "\226\136\146"; + "gvnE", "\226\137\169\239\184\128"; + "gfr", "\240\157\148\164"; + "lfisht", "\226\165\188"; + "jcirc", "\196\181"; + "roarr", "\226\135\190"; + "rho", "\207\129"; + "nvle", "\226\137\176"; + "sect", "\194\167"; + "ggg", "\226\139\153"; + "plusb", "\226\138\158"; + "NotTildeFullEqual", "\226\137\135"; + "NegativeVeryThinSpace", "\226\128\138\239\184\128"; + "ape", "\226\137\138"; + "pluse", "\226\169\178"; + "dollar", "$"; + "divonx", "\226\139\135"; + "partial", "\226\136\130"; + "DoubleLeftRightArrow", "\226\135\148"; + "varepsilon", "\206\181"; + "supe", "\226\138\135"; + "nvlt", "\226\137\174"; + "angrtvb", "\226\166\157\239\184\128"; + "gets", "\226\134\144"; + "nparallel", "\226\136\166"; + "varphi", "\207\134"; + "nsupseteq", "\226\138\137"; + "circledR", "\194\174"; + "circledS", "\226\147\136"; + "primes", "\226\132\153"; + "cuwed", "\226\139\143"; + "cupcap", "\226\169\134"; + "nLl", "\226\139\152\204\184"; + "lozf", "\226\167\171"; + "ShortLeftArrow", "\226\134\144\239\184\128"; + "nLt", "\226\137\170\204\184"; + "lesdotor", "\226\170\131"; + "Fcy", "\208\164"; + "scnsim", "\226\139\169"; + "VerticalLine", "|"; + "nwArr", "\226\135\150"; + "LeftTeeArrow", "\226\134\164"; + "iprod", "\226\168\188"; + "lsh", "\226\134\176"; + "Congruent", "\226\137\161"; + "NotLeftTriangle", "\226\139\170"; + "rdldhar", "\226\165\169"; + "varpropto", "\226\136\157"; + "nvlArr", "\226\135\141"; + "arg", "arg"; + "lhard", "\226\134\189"; + "surd", "????"; + "napos", "\197\137"; + "lparlt", "\226\166\147"; + "hslash", "\226\132\143"; + "Gopf", "\240\157\148\190"; + "SHcy", "\208\168"; + "triangle", "\226\150\181"; + "Qfr", "\240\157\148\148"; + "DiacriticalAcute", "\194\180"; + "tbrk", "\226\142\180"; + "Implies", "\226\135\146"; + "comp", "\226\136\129"; + "ddarr", "\226\135\138"; + "Colone", "\226\169\180"; + "smashp", "\226\168\179"; + "ccups", "\226\169\140"; + "triangleq", "\226\137\156"; + "NotSquareSubsetEqual", "\226\139\162"; + "Nopf", "\226\132\149"; + "ZHcy", "\208\150"; + "map", "\226\134\166"; + "lharu", "\226\134\188"; + "glE", "\226\170\146"; + "cong", "\226\137\133"; + "Ecaron", "\196\154"; + "Uring", "\197\174"; + "blacktriangleright", "\226\150\184"; + "ntilde", "\195\177"; + "max", "max"; + "loarr", "\226\135\189"; + "LeftArrow", "\226\134\144"; + "Gdot", "\196\160"; + "Uopf", "\240\157\149\140"; + "bigsqcup", "\226\138\148"; + "wedgeq", "\226\137\153"; + "RoundImplies", "\226\165\176"; + "prap", "\226\137\190"; + "gescc", "\226\170\169"; + "realine", "\226\132\155"; + "ast", "*"; + "subedot", "\226\171\131"; + "LeftTeeVector", "\226\165\154"; + "female", "\226\153\128"; + "circlearrowleft", "\226\134\186"; + "Ffr", "\240\157\148\137"; + "VDash", "\226\138\171"; + "jsercy", "\209\152"; + "Proportional", "\226\136\157"; + "OverBracket", "\226\142\180"; + "gla", "\226\170\165"; + "NotElement", "\226\136\137"; + "theta", "\206\184"; + "kcedil", "\196\183"; + "smeparsl", "\226\167\164"; + "rarrb", "\226\135\165"; + "rarrc", "\226\164\179"; + "ograve", "\195\178"; + "glj", "\226\170\164"; + "infty", "\226\136\158"; + "gnE", "\226\137\169"; + "copf", "\240\157\149\148"; + "LeftArrowRightArrow", "\226\135\134"; + "cwconint", "\226\136\178"; + "Ascr", "\240\157\146\156"; + "NegativeThinSpace", "\226\128\137\239\184\128"; + "varsubsetneq", "\226\138\138\239\184\128"; + "trisb", "\226\167\141"; + "rightharpoonup", "\226\135\128"; + "imagline", "\226\132\144"; + "mcy", "\208\188"; + "Cacute", "\196\134"; + "bumpeq", "\226\137\143"; + "jopf", "\240\157\149\155"; + "shchcy", "\209\137"; + "rarrw", "\226\134\157"; + "uuarr", "\226\135\136"; + "doteq", "\226\137\144"; + "cudarrl", "\226\164\184"; + "varsigma", "\207\130"; + "Hscr", "\226\132\139"; + "DownArrowUpArrow", "\226\135\181"; + "Ecirc", "\195\138"; + "DD", "\226\133\133"; + "copy", "\194\169"; + "SquareIntersection", "\226\138\147"; + "RightUpVector", "\226\134\190"; + "NotSucceedsSlantEqual", "\226\139\161"; + "cudarrr", "\226\164\181"; + "verbar", "|"; + "ncaron", "\197\136"; + "prurel", "\226\138\176"; + "nearr", "\226\134\151"; + "cdot", "\196\139"; + "qopf", "\240\157\149\162"; + "SucceedsSlantEqual", "\226\137\189"; + "Oscr", "\240\157\146\170"; + "xfr", "\240\157\148\181"; + "gne", "\226\137\169"; + "Ccedil", "\195\135"; + "nlarr", "\226\134\154"; + "inodot", "\196\177"; + "prec", "\226\137\186"; + "percnt", "%"; + "Exists", "\226\136\131"; + "bcy", "\208\177"; + "xopf", "\240\157\149\169"; + "nsimeq", "\226\137\132"; + "nrtri", "\226\139\171"; + "barvee", "\226\138\189"; + "Vscr", "\240\157\146\177"; + "Zcaron", "\197\189"; + "ReverseElement", "\226\136\139"; + "npolint", "\226\168\148"; + "NotGreaterTilde", "\226\137\181"; + "lmoustache", "\226\142\176"; + "forkv", "\226\171\153"; + "rmoustache", "\226\142\177"; + "DownLeftVectorBar", "\226\165\150"; + "cosh", "cosh"; + "mfr", "\240\157\148\170"; + "LessGreater", "\226\137\182"; + "zeetrf", "\226\132\168"; + "DiacriticalDot", "\203\153"; + "Poincareplane", "\226\132\140"; + "curlyeqsucc", "\226\139\159"; + "Equal", "\226\169\181"; + "divides", "\226\136\163"; + "scpolint", "\226\168\147"; + "ngsim", "\226\137\181"; + "larrbfs", "\226\164\159"; + "HilbertSpace", "\226\132\139"; + "otilde", "\195\181"; + "larrb", "\226\135\164"; + "wcirc", "\197\181"; + "dscr", "\240\157\146\185"; + "phmmat", "\226\132\179"; + "lacute", "\196\186"; + "tstrok", "\197\167"; + "NotDoubleVerticalBar", "\226\136\166"; + "lagran", "\226\132\146"; + "NotRightTriangle", "\226\139\171"; + "dscy", "\209\149"; + "rightrightarrows", "\226\135\137"; + "seArr", "\226\135\152"; + "RightTriangleBar", "\226\167\144"; + "coth", "coth"; + "swarrow", "\226\134\153"; + "semi", ";"; + "kscr", "\240\157\147\128"; + "NotLessEqual", "\226\137\176\226\131\165"; + "cularr", "\226\134\182"; + "blacklozenge", "\226\167\171"; + "realpart", "\226\132\156"; + "LeftTriangleEqual", "\226\138\180"; + "bfr", "\240\157\148\159"; + "Uuml", "\195\156"; + "longleftrightarrow", "????"; + "lcedil", "\196\188"; + "complement", "\226\136\129"; + "rscr", "\240\157\147\135"; + "mho", "\226\132\167"; + "mcomma", "\226\168\169"; + "wedbar", "\226\169\159"; + "NotVerticalBar", "\226\136\164"; + "Lcy", "\208\155"; + "tprime", "\226\128\180"; + "precneqq", "\226\170\181"; + "Downarrow", "\226\135\147"; + "rsh", "\226\134\177"; + "mid", "\226\136\163"; + "blank", "\226\144\163"; + "square", "\226\150\161"; + "squarf", "\226\150\170"; + "fflig", "\239\172\128"; + "downdownarrows", "\226\135\138"; + "yscr", "\240\157\147\142"; + "subdot", "\226\170\189"; + "ShortRightArrow", "\226\134\146\239\184\128"; + "NotCongruent", "\226\137\162"; + "Gg", "\226\139\153"; + "Lstrok", "\197\129"; + "min", "max"; + "Laplacetrf", "\226\132\146"; + "rarrap", "\226\165\181"; + "NotLessSlantEqual", "\226\137\176"; + "DoubleRightArrow", "\226\135\146"; + "Wfr", "\240\157\148\154"; + "subrarr", "\226\165\185"; + "numsp", "\226\128\135"; + "khcy", "\209\133"; + "oint", "\226\136\174"; + "vprop", "\226\136\157"; + "hardcy", "\209\138"; + "boxminus", "\226\138\159"; + "GreaterLess", "\226\137\183"; + "thetav", "\207\145"; + "scE", "\226\137\190"; + "Gt", "\226\137\171"; + "Acy", "\208\144"; + "backcong", "\226\137\140"; + "gtquest", "\226\169\188"; + "awint", "\226\168\145"; + "profsurf", "\226\140\147"; + "capdot", "\226\169\128"; + "supdot", "\226\170\190"; + "oelig", "\197\147"; + "doteqdot", "\226\137\145"; + "rharul", "\226\165\172"; + "cylcty", "\226\140\173"; + "epsi", "\206\181"; + "eqcirc", "\226\137\150"; + "nLeftarrow", "\226\135\141"; + "rtrie", "\226\138\181"; + "para", "\194\182"; + "Lfr", "\240\157\148\143"; + "rtrif", "\226\150\184"; + "NotReverseElement", "\226\136\140"; + "emptyv", "\226\136\133"; + "nldr", "\226\128\165"; + "leqq", "\226\137\166"; + "CapitalDifferentialD", "\226\133\133"; + "supsetneqq", "\226\138\139"; + "boxDL", "\226\149\151"; + "Im", "\226\132\145"; + "sce", "\226\137\189"; + "prsim", "\226\137\190"; + "diams", "\226\153\166"; + "gtreqqless", "\226\139\155"; + "boxDR", "\226\149\148"; + "vartriangleleft", "\226\138\178"; + "SupersetEqual", "\226\138\135"; + "Omega", "\206\169"; + "nsubseteqq", "\226\138\136"; + "Subset", "\226\139\144"; + "ncongdot", "\226\169\173\204\184"; + "minusb", "\226\138\159"; + "ltimes", "\226\139\137"; + "seswar", "\226\164\169"; + "part", "\226\136\130"; + "bumpE", "\226\170\174"; + "minusd", "\226\136\184"; + "Amacr", "\196\128"; + "nleq", "\226\137\176"; + "nles", "\226\137\176"; + "NotLess", "\226\137\174"; + "scy", "\209\129"; + "iinfin", "\226\167\156"; + "Afr", "\240\157\148\132"; + "isinsv", "\226\139\179"; + "prnE", "\226\170\181"; + "lesg", "\226\139\154\239\184\128"; + "cups", "\226\136\170\239\184\128"; + "thickapprox", "\226\137\136\239\184\128"; + "RightTeeVector", "\226\165\155"; + "LowerLeftArrow", "\226\134\153"; + "utdot", "\226\139\176"; + "homtht", "\226\136\187"; + "ddotseq", "\226\169\183"; + "bowtie", "\226\139\136"; + "succnsim", "\226\139\169"; + "boxDl", "\226\149\150"; + "quot", "\""; + "lvnE", "\226\137\168\239\184\128"; + "CircleDot", "\226\138\153"; + "lsime", "\226\170\141"; + "Yacute", "\195\157"; + "esdot", "\226\137\144"; + "Supset", "\226\139\145"; + "lsimg", "\226\170\143"; + "eDot", "\226\137\145"; + "sec", "sec"; + "boxDr", "\226\149\147"; + "plus", "+"; + "ddagger", "\226\128\161"; + "Vdashl", "\226\171\166"; + "equest", "\226\137\159"; + "quest", "?"; + "divideontimes", "\226\139\135"; + "nsmid", "\226\136\164\239\184\128"; + "fnof", "\198\146"; + "bumpe", "\226\137\143"; + "lhblk", "\226\150\132"; + "prnap", "\226\139\168"; + "compfn", "\226\136\152"; + "nsucceq", "\226\170\176\204\184"; + "RightArrowLeftArrow", "\226\135\132"; + "sharp", "\226\153\175"; + "CHcy", "\208\167"; + "dwangle", "\226\166\166"; + "angrtvbd", "\226\166\157"; + "period", "."; + "phone", "\226\152\142"; + "Eacute", "\195\137"; + "dzigrarr", "\239\150\162"; + "Ll", "\226\139\152"; + "succapprox", "\226\137\191"; + "rarrfs", "\226\164\158"; + "dbkarow", "\226\164\143"; + "zeta", "\206\182"; + "Lt", "\226\137\170"; + "triminus", "\226\168\186"; + "odiv", "\226\168\184"; + "ltrie", "\226\138\180"; + "Dagger", "\226\128\161"; + "ltrif", "\226\151\130"; + "boxHD", "\226\149\166"; + "timesb", "\226\138\160"; + "check", "\226\156\147"; + "urcorn", "\226\140\157"; + "timesd", "\226\168\176"; + "tshcy", "\209\155"; + "sfr", "\240\157\148\176"; + "lmoust", "\226\142\176"; + "ruluhar", "\226\165\168"; + "bne", "=\226\131\165"; + "prod", "\226\136\143"; + "Eopf", "\240\157\148\188"; + "scsim", "\226\137\191"; + "GreaterEqualLess", "\226\139\155"; + "Igrave", "\195\140"; + "Longrightarrow", "\226\135\146"; + "bigcap", "\226\139\130"; + "boxHU", "\226\149\169"; + "uring", "\197\175"; + "equivDD", "\226\169\184"; + "prop", "\226\136\157"; + "Lopf", "\240\157\149\131"; + "ldrushar", "\226\165\139"; + "rarrhk", "\226\134\170"; + "Leftarrow", "\226\135\144"; + "lltri", "\226\151\186"; + "NestedGreaterGreater", "\226\137\171"; + "GreaterFullEqual", "\226\137\167"; + "robrk", "\227\128\155"; + "larrsim", "\226\165\179"; + "boxHd", "\226\149\164"; + "vDash", "\226\138\168"; + "hfr", "\240\157\148\165"; + "Edot", "\196\150"; + "Vvdash", "\226\138\170"; + "Sopf", "\240\157\149\138"; + "upuparrows", "\226\135\136"; + "RightUpTeeVector", "\226\165\156"; + "DownLeftVector", "\226\134\189"; + "xhArr", "\239\149\187"; + "triplus", "\226\168\185"; + "bot", "\226\138\165"; + "Rcy", "\208\160"; + "eDDot", "\226\169\183"; + "subseteqq", "\226\138\134"; + "cirfnint", "\226\168\144"; + "spadesuit", "\226\153\160"; + "nacute", "\197\132"; + "Zopf", "\226\132\164"; + "upharpoonleft", "\226\134\191"; + "shy", "\194\173"; + "nparsl", "\226\136\165\239\184\128\226\131\165"; + "boxHu", "\226\149\167"; + "ThickSpace", "\226\128\137\226\128\138\226\128\138"; + "Or", "\226\169\148"; + "raemptyv", "\226\166\179"; + "Aogon", "\196\132"; + "IEcy", "\208\149"; + "sim", "\226\136\188"; + "sin", "sin"; + "copysr", "\226\132\151"; + "scnap", "\226\139\169"; + "rdquo", "\226\128\157"; + "aopf", "\240\157\149\146"; + "Pi", "\206\160"; + "Udblac", "\197\176"; + "expectation", "\226\132\176"; + "Zacute", "\197\185"; + "urtri", "\226\151\185"; + "NotTildeEqual", "\226\137\132"; + "ncedil", "\197\134"; + "Gamma", "\206\147"; + "ecirc", "\195\170"; + "dsol", "\226\167\182"; + "Gcy", "\208\147"; + "Pr", "Pr"; + "Zdot", "\197\187"; + "mnplus", "\226\136\147"; + "hopf", "\240\157\149\153"; + "blacktriangledown", "\226\150\190"; + "LeftCeiling", "\226\140\136"; + "ulcorn", "\226\140\156"; + "searrow", "\226\134\152"; + "GreaterGreater", "\226\170\162"; + "Fscr", "\226\132\177"; + "cupcup", "\226\169\138"; + "NotEqual", "\226\137\160"; + "sext", "\226\156\182"; + "CirclePlus", "\226\138\149"; + "erarr", "\226\165\177"; + "dArr", "\226\135\147"; + "PrecedesSlantEqual", "\226\137\188"; + "Itilde", "\196\168"; + "gesdoto", "\226\170\130"; + "Rang", "\227\128\139"; + "nwarhk", "\226\164\163"; + "minusdu", "\226\168\170"; + "oopf", "\240\157\149\160"; + "Mscr", "\226\132\179"; + "Rfr", "\226\132\156"; + "langle", "\226\140\169"; + "And", "\226\169\147"; + "bprime", "\226\128\181"; + "nLeftrightarrow", "\226\135\142"; + "Re", "\226\132\156"; + "OpenCurlyQuote", "\226\128\152"; + "vopf", "\240\157\149\167"; + "ulcorner", "\226\140\156"; + "nap", "\226\137\137"; + "Tscr", "\240\157\146\175"; + "gtreqless", "\226\139\155"; + "rarrlp", "\226\134\172"; + "Lambda", "\206\155"; + "lobrk", "\227\128\154"; + "rbrace", "}"; + "rArr", "\226\135\146"; + "coloneq", "\226\137\148"; + "UpArrow", "\226\134\145"; + "odot", "\226\138\153"; + "LeftDownTeeVector", "\226\165\161"; + "complexes", "\226\132\130"; + "rbrack", "]"; + "DownTeeArrow", "\226\134\167"; + "sqcap", "\226\138\147"; + "Sc", "\226\170\188"; + "ycy", "\209\139"; + "Prime", "\226\128\179"; + "Gfr", "\240\157\148\138"; + "trianglerighteq", "\226\138\181"; + "rangd", "\226\166\146"; + "gtrdot", "\226\139\151"; + "range", "\226\166\165"; + "rsqb", "]"; + "Euml", "\195\139"; + "Therefore", "\226\136\180"; + "nesim", "\226\137\130\204\184"; + "order", "\226\132\180"; + "vsupnE", "\226\138\139\239\184\128"; + "awconint", "\226\136\179"; + "bscr", "\240\157\146\183"; + "lesseqqgtr", "\226\139\154"; + "cap", "\226\136\169"; + "ldquo", "\226\128\156"; + "nsubseteq", "\226\138\136"; + "rhov", "\207\177"; + "xvee", "\226\139\129"; + "olarr", "\226\134\186"; + "nang", "\226\136\160\204\184"; + "uwangle", "\226\166\167"; + "nlsim", "\226\137\180"; + "smt", "\226\170\170"; + "nVdash", "\226\138\174"; + "napE", "\226\169\176\204\184"; + "ngeq", "\226\137\177"; + "iscr", "\240\157\146\190"; + "GJcy", "\208\131"; + "nges", "\226\137\177"; + "exist", "\226\136\131"; + "cent", "\194\162"; + "oacute", "\195\179"; + "Darr", "\226\134\161"; + "yen", "\194\165"; + "bigcirc", "\226\151\175"; + "ncy", "\208\189"; + "midast", "*"; + "UpperRightArrow", "\226\134\151"; + "precnapprox", "\226\139\168"; + "OElig", "\197\146"; + "hybull", "\226\129\131"; + "cupbrcap", "\226\169\136"; + "rationals", "\226\132\154"; + "VerticalTilde", "\226\137\128"; + "pscr", "\240\157\147\133"; + "NJcy", "\208\138"; + "NotSucceedsTilde", "\226\137\191\204\184"; + "vsupne", "\226\138\139\239\184\128"; + "Updownarrow", "\226\135\149"; + "Lsh", "\226\134\176"; + "rAarr", "\226\135\155"; + "precapprox", "\226\137\190"; + "rsquor", "\226\128\153"; + "pound", "\194\163"; + "lbrksld", "\226\166\143"; + "gesdot", "\226\170\128"; + "Element", "\226\136\136"; + "xcirc", "\226\151\175"; + "wscr", "\240\157\147\140"; + "toea", "\226\164\168"; + "setmn", "\226\136\150"; + "neg", "\194\172"; + "sol", "/"; + "yfr", "\240\157\148\182"; + "DoubleDownArrow", "\226\135\147"; + "Rarr", "\226\134\160"; + "ngE", "\226\137\177"; + "Upsi", "\207\146"; + "opar", "\226\166\183"; + "rarrpl", "\226\165\133"; + "auml", "\195\164"; + "bmod", "mod"; + "SquareSuperset", "\226\138\144"; + "neq", "\226\137\160"; + "circleddash", "\226\138\157"; + "xrarr", "\239\149\183"; + "barwed", "\226\138\188"; + "lbrkslu", "\226\166\141"; + "planckh", "\226\132\142"; + "ldrdhar", "\226\165\167"; + "circledcirc", "\226\138\154"; + "ctdot", "\226\139\175"; + "fallingdotseq", "\226\137\146"; + "Map", "\226\164\133"; + "VerticalBar", "\226\136\163"; + "succeq", "\226\137\189"; + "tint", "\226\136\173"; + "imof", "\226\138\183"; + "diam", "\226\139\132"; + "twixt", "\226\137\172"; + "NoBreak", "\239\187\191"; + "langd", "\226\166\145"; + "Bernoullis", "\226\132\172"; + "rcaron", "\197\153"; + "hom", "hom"; + "nfr", "\240\157\148\171"; + "backsimeq", "\226\139\141"; + "target", "\226\140\150"; + "ouml", "\195\182"; + "nge", "\226\137\177\226\131\165"; + "LeftTriangleBar", "\226\167\143"; + "subplus", "\226\170\191"; + "parsim", "\226\171\179"; + "Gcedil", "\196\162"; + "bnequiv", "\226\137\161\226\131\165"; + "ubreve", "\197\173"; + "iexcl", "\194\161"; + "Xi", "\206\158"; + "omega", "\207\137"; + "elsdot", "\226\170\151"; + "propto", "\226\136\157"; + "squ", "\226\150\161"; + "Ycirc", "\197\182"; + "amacr", "\196\129"; + "curlyeqprec", "\226\139\158"; + "ngt", "\226\137\175"; + "plusdo", "\226\136\148"; + "ngeqslant", "\226\137\177"; + "LongRightArrow", "\239\149\183"; + "LeftUpVector", "\226\134\191"; + "asymp", "\226\137\141"; + "imped", "\240\157\149\131"; + "tritime", "\226\168\187"; + "rpargt", "\226\166\148"; + "DDotrahd", "\226\164\145"; + "prnsim", "\226\139\168"; + "plusdu", "\226\168\165"; + "cfr", "\240\157\148\160"; + "abreve", "\196\131"; + "suphsol", "\226\138\131/"; + "NegativeThickSpace", "\226\128\133\239\184\128"; + "Mcy", "\208\156"; + "uarr", "\226\134\145"; + "LeftRightVector", "\226\165\142"; + "lAarr", "\226\135\154"; + "bsim", "\226\136\189"; + "simrarr", "\226\165\178"; + "otimes", "\226\138\151"; + "NotSucceeds", "\226\138\129"; + "Cross", "\226\168\175"; + "downarrow", "\226\134\147"; + "blacktriangle", "\226\150\180"; + "TripleDot", "\226\131\155"; + "smallsetminus", "\226\136\150\239\184\128"; + "supedot", "\226\171\132"; + "NotPrecedesSlantEqual", "\226\139\160"; + "neArr", "\226\135\151"; + "rarrtl", "\226\134\163"; + "isin", "\226\136\136"; + "rrarr", "\226\135\137"; + "Upsilon", "\207\146"; + "sqsub", "\226\138\143"; + "boxUL", "\226\149\157"; + "LessTilde", "\226\137\178"; + "Xfr", "\240\157\148\155"; + "nis", "\226\139\188"; + "chi", "\207\135"; + "DownRightVector", "\226\135\129"; + "niv", "\226\136\139"; + "boxUR", "\226\149\154"; + "nlArr", "\226\135\141"; + "Bcy", "\208\145"; + "tan", "tan"; + "EmptyVerySmallSquare", "\239\150\156"; + "dstrok", "\196\145"; + "rfisht", "\226\165\189"; + "easter", "\226\137\155"; + "nlE", "\226\137\176"; + "Mellintrf", "\226\132\179"; + "lotimes", "\226\168\180"; + "sqsup", "\226\138\144"; + "boxVH", "\226\149\172"; + "bbrk", "\226\142\181"; + "tau", "\207\132"; + "UpTee", "\226\138\165"; + "NotLeftTriangleBar", "\226\167\143\204\184"; + "boxVL", "\226\149\163"; + "Proportion", "\226\136\183"; + "equiv", "\226\137\161"; + "blk12", "\226\150\146"; + "blk14", "\226\150\145"; + "fpartint", "\226\168\141"; + "boxVR", "\226\149\160"; + "starf", "\226\152\133"; + "risingdotseq", "\226\137\147"; + "Equilibrium", "\226\135\140"; + "ijlig", "\196\179"; + "yicy", "\209\151"; + "sum", "\226\136\145"; + "cir", "\226\151\139"; + "telrec", "\226\140\149"; + "Mfr", "\240\157\148\144"; + "dHar", "\226\165\165"; + "boxUl", "\226\149\156"; + "apid", "\226\137\139"; + "nleftarrow", "\226\134\154"; + "curarrm", "\226\164\188"; + "Scirc", "\197\156"; + "Copf", "\226\132\130"; + "RightTriangleEqual", "\226\138\181"; + "boxUr", "\226\149\153"; + "loplus", "\226\168\173"; + "varsupsetneq", "\226\138\139\239\184\128"; + "scaron", "\197\161"; + "Diamond", "\226\139\132"; + "lowast", "\226\136\151"; + "nle", "\226\137\176\226\131\165"; + "phiv", "\207\149"; + "gesdotol", "\226\170\132"; + "boxVh", "\226\149\171"; + "nleftrightarrow", "\226\134\174"; + "Jopf", "\240\157\149\129"; + "boxVl", "\226\149\162"; + "nearhk", "\226\164\164"; + "vBarv", "\226\171\169"; + "rHar", "\226\165\164"; + "boxVr", "\226\149\159"; + "lessdot", "\226\139\150"; + "LeftDoubleBracket", "\227\128\154"; + "Delta", "\206\148"; + "limsup", "limsup"; + "tcy", "\209\130"; + "nlt", "\226\137\174"; + "Cdot", "\196\138"; + "blk34", "\226\150\147"; + "Bfr", "\240\157\148\133"; + "lowbar", "_"; + "lneqq", "\226\137\168"; + "TildeEqual", "\226\137\131"; + "shortmid", "\226\136\163\239\184\128"; + "Qopf", "\226\132\154"; + "drcorn", "\226\140\159"; + "ZeroWidthSpace", "\226\128\139"; + "aogon", "\196\133"; + "Rsh", "\226\134\177"; + "lrarr", "\226\135\134"; + "cupdot", "\226\138\141"; + "Xopf", "\240\157\149\143"; + "Backslash", "\226\136\150"; + "Union", "\226\139\131"; + "ratio", "\226\136\182"; + "duarr", "\226\135\181"; + "lates", "\226\170\173\239\184\128"; + "suphsub", "\226\171\151"; + "squf", "\226\150\170"; + "gamma", "\206\179"; + "lrhard", "\226\165\173"; + "intprod", "\226\168\188"; + "ReverseUpEquilibrium", "\226\165\175"; + "icy", "\208\184"; + "quatint", "\226\168\150"; + "nbump", "\226\137\142\204\184"; + "downharpoonleft", "\226\135\131"; + "otimesas", "\226\168\182"; + "nvHarr", "\226\135\142"; + "ContourIntegral", "\226\136\174"; + "bsol", "\\"; + "DoubleUpDownArrow", "\226\135\149"; + "disin", "\226\139\178"; + "Breve", "\203\152"; + "YAcy", "\208\175"; + "precsim", "\226\137\190"; + "NotGreaterGreater", "\226\137\171\204\184\239\184\128"; + "fopf", "\240\157\149\151"; + "SquareSupersetEqual", "\226\138\146"; + "Dscr", "\240\157\146\159"; + "gsime", "\226\170\142"; + "PartialD", "\226\136\130"; + "Umacr", "\197\170"; + "tfr", "\240\157\148\177"; + "cularrp", "\226\164\189"; + "UnderBracket", "\226\142\181"; + "ugrave", "\195\185"; + "mopf", "\240\157\149\158"; + "gsiml", "\226\170\144"; + "iquest", "\194\191"; + "nmid", "\226\136\164"; + "leftarrowtail", "\226\134\162"; + "not", "\194\172"; + "Kscr", "\240\157\146\166"; + "xsqcup", "\226\138\148"; + "triangleleft", "\226\151\131"; + "amalg", "\226\168\191"; + "prcue", "\226\137\188"; + "ac", "\226\164\143"; + "nharr", "\226\134\174"; + "dzcy", "\209\159"; + "topf", "\240\157\149\165"; + "iff", "\226\135\148"; + "af", "\226\129\161"; + "Uparrow", "\226\135\145"; + "Iacute", "\195\141"; + "Rscr", "\226\132\155"; + "vrtri", "\226\138\179"; + "multimap", "\226\138\184"; + "Hat", "\204\130"; + "rtriltri", "\226\167\142"; + "npr", "\226\138\128"; + "agrave", "\195\160"; + "UnderBar", "\204\178"; + "prime", "\226\128\178"; + "plusmn", "\194\177"; + "eplus", "\226\169\177"; + "ap", "\226\137\136"; + "dlcorn", "\226\140\158"; + "backsim", "\226\136\189"; + "ifr", "\240\157\148\166"; + "bigcup", "\226\139\131"; + "tcaron", "\197\165"; + "sqcaps", "\226\138\147\239\184\128"; + "equals", "="; + "curlywedge", "\226\139\143"; + "Yscr", "\240\157\146\180"; + "longrightarrow", "????"; + "fork", "\226\139\148"; + "cos", "cos"; + "cot", "cot"; + "ImaginaryI", "\226\133\136"; + "Scy", "\208\161"; + "mapsto", "\226\134\166"; + "tdot", "\226\131\155"; + "vellip", "\226\139\174"; + "sqsupseteq", "\226\138\146"; + "nvdash", "\226\138\172"; + "NotSuperset", "\226\138\133"; + "DoubleUpArrow", "\226\135\145"; + "land", "\226\136\167"; + "topfork", "\226\171\154"; + "llhard", "\226\165\171"; + "apos", "'"; + "oslash", "\195\184"; + "lang", "\226\140\169"; + "bernou", "\226\132\172"; + "varrho", "\207\177"; + "rcub", "}"; + "Cedilla", "\194\184"; + "ApplyFunction", "\226\129\161"; + "nsce", "\226\170\176\204\184"; + "gscr", "\226\132\138"; + "imagpart", "\226\132\145"; + "ngtr", "\226\137\175"; + "nsc", "\226\138\129"; + "Barv", "\226\171\167"; + "tosa", "\226\164\169"; + "nwnear", "\226\164\167"; + "ltlarr", "\226\165\182"; + "PrecedesEqual", "\226\170\175"; + "lessapprox", "\226\137\178"; + "Lcaron", "\196\189"; + ];; +let _ = + List.iter + (fun (macro, utf8) -> + Hashtbl.replace macro2utf8 macro utf8; + Hashtbl.replace utf82macro utf8 macro) + data;; diff --git a/components/syntax_extensions/utf8MacroTable.ml.txt b/components/syntax_extensions/utf8MacroTable.ml.txt new file mode 100644 index 000000000..50f62cba9 --- /dev/null +++ b/components/syntax_extensions/utf8MacroTable.ml.txt @@ -0,0 +1,2131 @@ +(* GENERATED by make_table: DO NOT EDIT! *) +\nscr 𝓃 +\LJcy Љ +\dd ⅆ +\Omacr Ō +\npreceq ⪯̸ +\Gcirc Ĝ +\utilde Å© +\rdca ⤷ +\racute ŕ +\mstpos ∾ +\supnE ⊋ +\NotLessLess ≪̸︀ +\iiint ∭ +\uscr 𝓊 +\Sfr 𝔖 +\nsupseteqq ⊉ +\nwarrow ↖ +\twoheadrightarrow ↠ +\sccue ≽ +\NotSquareSuperset ⊐̸ +\ee ⅇ +\boxbox ⧉ +\andand ⩕ +\LeftVectorBar ⥒ +\eg ⪚ +\csc csc +\NotRightTriangleEqual ⋭ +\filig fi +\atilde ã +\ring ˚ +\congdot â©­ +\gE ≧ +\rcedil ŗ +\el ⪙ +\HorizontalLine ─ +\incare ℅ +\hoarr ⇿ +\SOFTcy Ь +\conint ∮ +\OverParenthesis ︵ +\Uogon Ų +\supne ⊋ +\num # +\zcy з +\Hfr ℌ +\dtri ▿ +\FilledSmallSquare ◾ +\SucceedsEqual ≽ +\leftthreetimes ⋋ +\ycirc Å· +\sqcup ⊔ +\DoubleLeftArrow ⇐ +\gtrless ≷ +\ge ≥ +\Product ∏ +\NotExists ∄ +\gg ≫ +\curlyvee ⋎ +\ntrianglerighteq ⋭ +\Colon ∷ +\rbrke ⦌ +\LeftDownVector ⇃ +\gl ≷ +\lrcorner ⌟ +\mapstodown ↧ +\excl ! +\cdots ⋯ +\larr ← +\dtdot ⋱ +\kgreen ĸ +\rtri ▹ +\rbarr ⤍ +\ocy о +\gt > +\DownLeftRightVector ⥐ +\cup ∪ +\updownarrow ↕ +\Imacr Ī +\cross ✗ +\Acirc  +\lvertneqq ≨︀ +\ccaps ⩍ +\NotLeftTriangleEqual ⋬ +\IJlig IJ +\boxplus ⊞ +\epsilon ϵ +\zfr 𝔷 +\late ⪭ +\ic ​ +\lrhar ⇋ +\gsim ≳ +\inf inf +\top ⊤ +\odsold ⦼ +\circlearrowright ↻ +\rtimes ⋊ +\ii ⅈ +\DoubleRightTee ⊨ +\dcy д +\boxdL ╕ +\duhar ⥯ +\vert | +\sacute ś +\in ∈ +\Assign ≔ +\nsim ≁ +\boxdR ╒ +\o ο +\radic √ +\it ⁢ +\int ∫ +\cwint ∱ +\ForAll ∀ +\simplus ⨤ +\isindot ⋵ +\rightthreetimes ⋌ +\supseteqq ⊇ +\bnot ⌐ +\rppolint ⨒ +\def ≝ +\TScy Ц +\lE ≦ +\ffilig ffi +\deg deg +\{ { +\RightVector ⇀ +\ofr 𝔬 +\| | +\liminf liminf +\} } +\LeftUpTeeVector ⥠ +\scirc ŝ +\scedil ş +\ufisht ⥾ +\LeftUpDownVector ⥑ +\questeq ≟ +\leftarrow ← +\Ycy Ы +\Coproduct ∐ +\det det +\boxdl ┐ +\Aopf 𝔸 +\srarr →︀ +\lbrke ⦋ +\boxdr ┌ +\Ntilde Ñ +\gnap ⪊ +\Cap ⋒ +\swarhk ⤦ +\ogt ⧁ +\emptyset ∅︀ +\harrw ↭ +\lbarr ⤌ +\Tilde ∼ +\delta δ +\Hopf ℍ +\dfr 𝔡 +\le ≤ +\lg lg +\ohm Ω +\Jsercy Ј +\quaternions ℍ +\DoubleLongLeftArrow  +\Ncy Н +\nabla ∇ +\ltcir ⩹ +\ll ≪ +\ln ln +\rmoust ⎱ +\Oopf 𝕆 +\nbsp   +\Kcedil Ķ +\vdots ⋮ +\NotLessTilde ≴ +\lt < +\djcy ђ +\DownRightTeeVector ⥟ +\Ograve Ò +\boxhD ╥ +\nsime ≄ +\egsdot ⪘ +\mDDot ∺ +\bigodot ⊙ +\Vopf 𝕍 +\looparrowright ↬ +\yucy ю +\trade ™ +\Yfr 𝔜 +\kjcy ќ +\mp ∓ +\leftrightarrows ⇆ +\uharl ↿ +\ncap ⩃ +\Iogon Ä® +\NotSubset ⊄ +\Bumpeq ≎ +\mu μ +\FilledVerySmallSquare  +\breve ˘ +\boxhU ╨ +\Sigma Σ +\uharr ↾ +\xrArr  +\ne ≠ +\oS Ⓢ +\xodot ⊙ +\ni ∋ +\mdash — +\Verbar ‖ +\die ¨ +\veebar ⊻ +\UpArrowBar ⤒ +\Ncaron Ň +\RightArrowBar ⇥ +\LongLeftArrow  +\rceil ⌉ +\LeftDownVectorBar ⥙ +\umacr Å« +\Hacek ˇ +\odblac ő +\lmidot ŀ +\dopf 𝕕 +\boxhd ┬ +\dim dim +\vnsub ⊄ +\Bscr ℬ +\plussim ⨦ +\doublebarwedge ⌆ +\nu ν +\eqcolon ≕ +\luruhar ⥦ +\Nfr 𝔑 +\preceq ⪯ +\LeftTee ⊣ +\div ÷ +\nVDash ⊯ +\kopf 𝕜 +\Iscr ℐ +\vnsup ⊅ +\gneq ≩ +\backepsilon ϶ +\boxhu ┴ +\ominus ⊖ +\or ∨ +\lesdot â©¿ +\RightVectorBar ⥓ +\tcedil Å£ +\hstrok ħ +\nrarrc ⤳̸ +\ropf 𝕣 +\diamond ⋄ +\smid ∣︀ +\nltri ⋪ +\Pscr 𝒫 +\vartheta ϑ +\therefore ∴ +\pi π +\ntrianglelefteq ⋬ +\nearrow ↗ +\pm ± +\natural ♮ +\ucy у +\olt ⧀ +\Cfr ℭ +\yopf 𝕪 +\Otilde Õ +\ntriangleleft ⋪ +\pr ≺ +\Wscr 𝒲 +\midcir â«° +\Lacute Ĺ +\DoubleDot ¨ +\Tstrok Ŧ +\nrarrw ↝̸ +\uArr ⇑ +\nLtv ≪̸︀ +\rangle 〉 +\olcir ⦾ +\Auml Ä +\Succeeds ≻ +\DoubleLongLeftRightArrow  +\TSHcy Ћ +\gammad Ϝ +\epsiv ɛ +\notinva ∉̸ +\notinvb ⋷ +\eqvparsl ⧥ +\notinvc ⋶ +\nsubE ⊈ +\supplus ⫀ +\RightUpDownVector ⥏ +\Tab +\Lcedil Ä» +\backslash \ +\pointint ⨕ +\jcy й +\iocy ё +\escr ℯ +\submult ⫁ +\iiota ℩ +\lceil ⌈ +\omacr ō +\gneqq ≩ +\gcirc ĝ +\dotsquare ⊡ +\ccaron č +\Square □ +\RightDownTeeVector ⥝ +\Ouml Ö +\lurdshar ⥊ +\SuchThat ∋ +\setminus ∖ +\lscr ℓ +\LessLess ⪡ +\Sub ⋐ +\sc ≻ +\rx ℞ +\RightFloor ⌋ +\blacksquare ▪ +\ufr 𝔲 +\block █ +\dots … +\nvsim ≁̸ +\caret ⁁ +\demptyv ⦱ +\Sum ∑ +\sscr 𝓈 +\nsube ⊈ +\Sup ⋑ +\ccupssm ⩐ +\Because ∵ +\harrcir ⥈ +\capbrcup ⩉ +\RightUpVectorBar ⥔ +\caps ∩︀ +\ohbar ⦵ +\laemptyv ⦴ +\uacute ú +\straightphi φ +\RightDoubleBracket 〛 +\zscr 𝓏 +\uogon ų +\Uarr ↟ +\nsucc ⊁ +\RBarr ⤐ +\NotRightTriangleBar ⧐̸ +\to → +\rpar ) +\rdsh ↳ +\jfr 𝔧 +\ldquor „ +\bsime ⋍ +\lAtail ⤛ +\Hcirc Ĥ +\aacute á +\dot ˙ +\Tcy Т +\nsub ⊄ +\kappa κ +\ovbar ⌽ +\shcy ш +\kappav Ï° +\ropar 〙 +\gtcc ⪧ +\ecolon ≕ +\circledast ⊛ +\colon : +\timesbar ⨱ +\precnsim ⋨ +\ord ⩝ +\real ℜ +\nexists ∄ +\nsup ⊅ +\zhcy ж +\imacr Ä« +\egrave è +\acirc â +\grave ` +\biguplus ⊎ +\HumpEqual ≏ +\GreaterSlantEqual ⩾ +\capand ⩄ +\yuml ÿ +\orv ⩛ +\Icy И +\rightharpoondown ⇁ +\upsilon υ +\preccurlyeq ≼ +\ShortUpArrow ⌃︀ +\searhk ⤥ +\commat @ +\Sqrt √ +\wp ℘ +\succnapprox ⋩ +\wr ≀ +\NotTildeTilde ≉ +\dcaron ď +\Tfr 𝔗 +\bigwedge ⋀ +\DScy Ѕ +\nrtrie ⋭ +\esim ≂ +\Not ⫬ +\xmap  +\rect ▭ +\Fouriertrf ℱ +\xi ξ +\NotTilde ≁ +\gbreve ğ +\par ∥ +\ddots ⋱ +\nhArr ⇎ +\lsim ≲ +\RightCeiling ⌉ +\nedot ≠︀ +\thksim ∼︀ +\lEg ⋚ +\Ifr ℑ +\emsp   +\lopar 〘 +\iiiint ⨌ +\straightepsilon ε +\intlarhk ⨗ +\image ℑ +\sqsubseteq ⊑ +\lnapprox ⪉ +\Leftrightarrow ⇔ +\cemptyv ⦲ +\alpha α +\uml ¨ +\barwedge ⊼ +\KHcy Ð¥ +\tilde ˜ +\Superset ⊃ +\gesles ⪔ +\bigoplus ⊕ +\boxuL ╛ +\rbbrk 〕 +\nrightarrow ↛ +\hkswarow ⤦ +\DiacriticalDoubleAcute ˝ +\nbumpe ≏̸ +\uhblk ▀ +\NotSupersetEqual ⊉ +\ntgl ≹ +\Fopf 𝔽 +\boxuR ╘ +\swarr ↙ +\nsqsube ⋢ +\pluscir ⨢ +\pcy п +\leqslant ⩽ +\lnap ⪉ +\lthree ⋋ +\smte ⪬ +\olcross ⦻ +\nvrArr ⇏ +\andslope ⩘ +\MediumSpace   +\boxvH ╪ +\Nacute Ń +\nGtv ≫̸︀ +\Mopf 𝕄 +\dfisht ⥿ +\boxvL ╡ +\pertenk ‱ +\NotPrecedes ⊀ +\profalar ⌮ +\roplus ⨮ +\boxvR ╞ +\utrif ▴ +\uHar ⥣ +\nltrie ⋬ +\NotNestedGreaterGreater ⒢̸ +\smtes ⪬︀ +\LeftAngleBracket 〈 +\iogon į +\ExponentialE ⅇ +\Topf 𝕋 +\GreaterEqual ≥ +\DownTee ⊤ +\boxul ┘ +\wreath ≀ +\sigma σ +\ENG Ŋ +\Ncedil Ņ +\ecy э +\nsubset ⊄ +\LessFullEqual ≦ +\bsolb ⧅ +\boxur └ +\ThinSpace   +\supdsub ⫘ +\colone ≔ +\curren ¤ +\boxvh ┼ +\ecaron ě +\UnderBrace ︸ +\caron ˇ +\ultri ◸ +\boxvl ┤ +\scap ≿ +\boxvr ├ +\bopf 𝕓 +\pfr 𝔭 +\nspar ∦︀ +\NegativeMediumSpace  ︀ +\simgE ⪠ +\nvDash ⊭ +\NotGreaterFullEqual ≰ +\uparrow ↑ +\nsupset ⊅ +\simeq ≃ +\Zcy З +\RightTriangle ⊳ +\Lang 《 +\Ucirc Û +\iopf 𝕚 +\leftrightsquigarrow ↭ +\Gscr 𝒢 +\lfloor ⌊ +\lbbrk 〔 +\bigvee ⋁ +\ordf ª +\rsquo ’ +\parallel ∥ +\half ½ +\supseteq ⊇ +\ngeqq ≱ +\popf 𝕡 +\NonBreakingSpace   +\softcy ь +\ordm º +\Nscr 𝒩 +\owns ∋ +\phi ϕ +\efr 𝔢 +\nesear ⤨ +\marker ▮ +\lneq ≨ +\parallet ???? +\ndash – +\DoubleLeftTee ⫤ +\lArr ⇐ +\becaus ∵ +\RightTee ⊢ +\Ocy О +\ntlg ≸ +\cacute ć +\wopf 𝕨 +\Cup ⋓ +\Uscr 𝒰 +\NotHumpEqual ≏̸ +\rnmid â«® +\nsupE ⊉ +\bemptyv ⦰ +\lsqb [ +\nrarr ↛ +\egs ⋝ +\reals ℝ +\CupCap ≍ +\Oacute Ó +\Zfr ℨ +\ReverseEquilibrium ⇋ +\ccedil ç +\bigtriangleup △ +\piv ϖ +\cirscir ⧂ +\exists ∃ +\Uarrocir ⥉ +\Dcy Д +\cscr 𝒸 +\zcaron ž +\isinE ⋹ +\gtcir ⩺ +\hookrightarrow ↪ +\Int ∬ +\nsupe ⊉ +\dotplus ∔ +\ncup ⩂ +\jscr 𝒿 +\angmsdaa ⦨ +\Iukcy І +\flat ♭ +\bNot â«­ +\angmsdab ⦩ +\angmsdac ⦪ +\xdtri ▽ +\iota ι +\angmsdad ⦫ +\angmsdae ⦬ +\rightarrowtail ↣ +\angmsdaf ⦭ +\Ocirc Ô +\angmsdag ⦮ +\Ofr 𝔒 +\maltese ✠ +\angmsdah ⦯ +\Del ∇ +\Barwed ⌆ +\drbkarow ⤐ +\qscr 𝓆 +\ETH Ð +\operp ⦹ +\daleth ℸ +\bull • +\simlE ⪟ +\lsquo ‘ +\Larr ↞ +\curarr ↷ +\blacktriangleleft ◂ +\hellip … +\DoubleVerticalBar ∥ +\rBarr ⤏ +\chcy ч +\varpi ϖ +\Cconint ∰ +\xlarr  +\xscr 𝓍 +\DoubleLongRightArrow  +\CounterClockwiseContourIntegral ∳ +\urcrop ⌎ +\RightAngleBracket 〉 +\Rcaron Ř +\latail ⤙ +\pitchfork ⋔ +\nvinfin ⧞ +\hcirc Ä¥ +\nexist ∄ +\checkmark ✓ +\tridot ◬ +\vcy в +\isins ⋴ +\fllig fl +\Dfr 𝔇 +\hercon ⊹ +\gEl ⋛ +\bump ≎ +\aleph ℵ +\Ubreve Ŭ +\isinv ∈ +\smile ⌣ +\llcorner ⌞ +\boxH ═ +\ecir ≖ +\varnothing ∅ +\iuml ï +\mlcp ⫛ +\leftrightharpoons ⇋ +\ncong ≇ +\Vert ‖ +\vee ∨ +\star ⋆ +\boxV ║ +\LeftRightArrow ↔ +\leftrightarrow ↔ +\lstrok ł +\ell ℓ +\VerticalSeparator ❘ +\Ubrcy Ў +\NotGreater ≯ +\Abreve Ă +\TildeTilde ≈ +\CircleTimes ⊗ +\subsetneq ⊊ +\ltcc ⪦ +\els ⋜ +\succneqq ⪶ +\kcy к +\nshortmid ∤︀ +\mldr … +\harr ↔ +\gimel ℷ +\Otimes ⨷ +\vsubnE ⊊︀ +\ltdot ⋖ +\boxh ─ +\notin ∉ +\RuleDelayed ⧴ +\sqsube ⊑ +\macr ¯ +\Icirc Î +\comma , +\Cayleys ℭ +\rightleftharpoons ⇌ +\Rarrtl ⤖ +\SquareSubsetEqual ⊑ +\NotGreaterEqual ≱⃥ +\vfr 𝔳 +\utri ▵ +\simne ≆ +\LeftUpVectorBar ⥘ +\hksearow ⤥ +\boxv │ +\curvearrowleft ↶ +\eng ŋ +\gtrarr ⥸ +\iecy е +\varr ↕ +\lBarr ⤎ +\ker ker +\imath ı +\Dstrok Đ +\rlarr ⇄ +\leftleftarrows ⇇ +\DifferentialD ⅆ +\because ∵ +\ulcrop ⌏ +\prE ⪯ +\oast ⊛ +\DotEqual ≐ +\vsubne ⊊︀ +\hbar ℏ︀ +\subset ⊂ +\UpTeeArrow ↥ +\LeftFloor ⌊ +\kfr 𝔨 +\nisd ⋺ +\scnE ⪶ +\Ucy У +\nprec ⊀ +\ltrPar ⦖ +\Scaron Å  +\InvisibleComma ​ +\SquareUnion ⊔ +\ffllig ffl +\approxeq ≊ +\yacute ý +\pre ⪯ +\nsqsupe ⋣ +\supset ⊃ +\bsolhsub \⊂ +\nshortparallel ∦︀ +\lozenge ◊ +\lnot ¬ +\Dopf 𝔻 +\leftharpoonup ↼ +\Jcy Й +\rightarrow → +\ntriangleright ⋫ +\Ccirc Ĉ +\eacute é +\acute ´ +\Precedes ≺ +\middot · +\lHar ⥢ +\eparsl ⧣ +\psi ψ +\parsl ∥︀ +\UpperLeftArrow ↖ +\oror ⩖ +\Kopf 𝕂 +\apacir ⩯ +\dharl ⇃ +\nequiv ≢ +\rightleftarrows ⇄ +\UnderParenthesis ︶ +\notni ∌ +\dagger † +\dharr ⇂ +\twoheadleftarrow ↞ +\frac12 ½ +\varsubsetneqq ⊊︀ +\frac13 ⅓ +\Ufr 𝔘 +\NestedLessLess ≪ +\llarr ⇇ +\frac14 ¼ +\frac15 ⅕ +\Ropf ℝ +\frac16 ⅙ +\lrtri ⊿ +\frac18 ⅛ +\cedil ¸ +\subsim ⫇ +\PrecedesTilde ≾ +\igrave ì +\gjcy ѓ +\LeftVector ↼ +\notniva ∌ +\notnivb ⋾ +\ogon ˛ +\notnivc ⋽ +\Yopf 𝕐 +\there4 ∴ +\udarr ⇅ +\bkarow ⤍ +\frac23 ⅔ +\frac25 ⅖ +\njcy њ +\Dashv ⫤ +\eta η +\bcong ≌ +\Ugrave Ù +\csube ⫑ +\clubs ♣ +\supmult ⫂ +\MinusPlus ∓ +\Jfr 𝔍 +\ensp   +\ucirc û +\supsim ⫈ +\eth ð +\OverBrace ︷ +\Dot ¨ +\xcap ⋂ +\vangrt ⊾ +\NotSubsetEqual ⊈ +\frac34 ¾ +\frac35 ⅗ +\planck ℏ︀ +\lnsim ⋦ +\gopf 𝕘 +\frac38 ⅜ +\DotDot ⃜ +\mapstoup ↥ +\Escr ℰ +\Integral ∫ +\Agrave À +\longleftarrow ????; +\Tcaron Ť +\nopf 𝕟 +\LongLeftRightArrow  +\Emacr Ē +\omid ⦶ +\spades ♠ +\naturals ℕ +\Lscr ℒ +\udblac ű +\SucceedsTilde ≿ +\frac45 ⅘ +\clubsuit ♣ +\mumap ⊸ +\vltri ⊲ +\LeftArrowBar ⇤ +\zacute ź +\szlig ß +\suplarr ⥻ +\RightDownVector ⇂ +\male ♂ +\RightDownVectorBar ⥕ +\gdot Ä¡ +\nleqq ≰ +\uopf 𝕦 +\YIcy Ї +\Sscr 𝒮 +\empty ∅︀ +\Vdash ⊩ +\sqsubset ⊏ +\efDot ≒ +\times × +\Oslash Ø +\itilde Ä© +\frac56 ⅚ +\numero № +\malt ✠ +\npart ∂̸ +\frac58 ⅝ +\Zscr 𝒵 +\integers ℤ +\CloseCurlyQuote ’ +\NewLine + +\fcy ф +\nwarr ↖ +\thicksim ∼︀ +\nprcue ⋠ +\lcub { +\forall ∀ +\plusacir ⨣ +\ascr 𝒶 +\plustwo ⨧ +\Utilde Ũ +\lambda λ +\odash ⊝ +\iukcy і +\sqsupset ⊐ +\Racute Ŕ +\Longleftarrow ???? +\capcap ⩋ +\ocirc ô +\nless ≮ +\Wedge ⋀ +\qfr 𝔮 +\natur ♮ +\hscr 𝒽 +\ldca ⤶ +\ClockwiseContourIntegral ∲ +\exp exp +\RightTeeArrow ↦ +\orarr ↻ +\tanh tanh +\frac78 ⅞ +\Atilde à +\arcsin arcsin +\Rcedil Ŗ +\oscr ℴ +\InvisibleTimes ⁢ +\sime ≃ +\simg ⪞ +\Conint ∯ +\Yuml Ÿ +\rlhar ⇌ +\rarrbfs ⤠ +\siml ⪝ +\DownRightVectorBar ⥗ +\vscr 𝓋 +\divide ÷ +\PlusMinus ± +\ffr 𝔣 +\DownLeftTeeVector ⥞ +\EmptySmallSquare ◽ +\SHCHcy Щ +\cirmid ⫯ +\sigmav ς +\csub ⫏ +\npar ∦ +\bsemi ⁏ +\swArr ⇙ +\Pcy П +\sinh sinh +\lharul ⥪ +\Jukcy Є +\permil ‰ +\ndivides ∤ +\Aring Å +\longmapsto ???? +\Esim ⩳ +\csup ⫐ +\trie ≜ +\ubrcy ў +\NotEqualTilde ≂̸ +\dotminus ∸ +\diamondsuit ♢ +\xnis ⋻ +\Eogon Ę +\cuvee ⋎ +\DZcy Џ +\nRightarrow ⇏ +\sqsupe ⊒ +\nsccue ⋡ +\drcrop ⌌ +\DownBreve ̑ +\Ecy Э +\rdquor ” +\rAtail ⤜ +\icirc î +\gacute ǵ +\hyphen ‐ +\uuml ü +\thorn þ +\ltri ◃ +\eqslantgtr ⋝ +\DoubleContourIntegral ∯ +\lescc ⪨ +\DiacriticalGrave ` +\NotPrecedesEqual ⪯̸ +\RightArrow → +\race ⧚ +\topbot ⌶ +\Pfr 𝔓 +\napprox ≉ +\Sacute Ś +\cupor ⩅ +\OverBar ¯ +\bepsi ϶ +\plankv ℏ +\lap ≲ +\orslope ⩗ +\beta β +\ShortDownArrow ⌄︀ +\perp ⊥ +\lat ⪫ +\CenterDot · +\urcorner ⌝ +\models ⊧ +\beth ℶ +\subE ⊆ +\subnE ⊊ +\ldots … +\yacy я +\udhar ⥮ +\Scedil Ş +\subsub ⫕ +\nvrtrie ⋭̸ +\Phi Φ +\Efr 𝔈 +\larrfs ⤝ +\angle ∠ +\TildeFullEqual ≅ +\Jcirc Ä´ +\THORN Þ +\acE ⧛ +\Longleftrightarrow ???? +\xuplus ⊎ +\searr ↘ +\gvertneqq ≩︀ +\subsup ⫓ +\NotSucceedsEqual ⪰̸ +\gtrsim ≳ +\nrArr ⇏ +\NotSquareSupersetEqual ⋣ +\notindot ⋶︀ +\HARDcy Ъ +\jmath j︀ +\aelig æ +\slarr ←︀ +\dlcrop ⌍ +\sube ⊆ +\cuepr ⋞ +\supsub ⫔ +\trianglelefteq ⊴ +\subne ⊊ +\between ≬ +\measuredangle ∡ +\swnwar ⤪ +\lcy л +\ccirc ĉ +\larrhk ↩ +\DiacriticalTilde ˜ +\brvbar ¦ +\triangledown ▿ +\dtrif ▾ +\Bopf 𝔹 +\xwedge ⋀ +\rightsquigarrow ↝ +\acd ∿ +\supsup ⫖ +\UpEquilibrium ⥮ +\succ ≻ +\eqslantless ⋜ +\coprod ∐ +\OpenCurlyDoubleQuote “ +\NotGreaterSlantEqual ≱ +\solb ⧄ +\HumpDownHump ≎ +\gtrapprox ≳ +\Iopf 𝕀 +\leg ⋚ +\wfr 𝔴 +\mapstoleft ↤ +\gnapprox ⪊ +\lgE ⪑ +\CloseCurlyDoubleQuote ” +\NotNestedLessLess ⒡̸ +\acy а +\leq ≤ +\Popf ℙ +\les ⩽ +\succcurlyeq ≽ +\heartsuit ♡ +\angmsd ∡ +\cuesc ⋟ +\lesseqgtr ⋚ +\vartriangleright ⊳ +\csupe ⫒ +\rthree ⋌ +\Idot Ä° +\gtdot ⋗ +\dashv ⊣ +\Odblac Ő +\Lmidot Ä¿ +\andd ⩜ +\Wopf 𝕎 +\nvltrie ⋬̸ +\nhpar ⫲ +\geqslant ⩾ +\xlArr  +\SquareSubset ⊏ +\intcal ⊺ +\ljcy љ +\lfr 𝔩 +\gtlPar ⦕ +\zigrarr ⇝ +\nvap ≉̸ +\boxtimes ⊠ +\raquo » +\CircleMinus ⊖ +\centerdot · +\xoplus ⊕ +\simdot ⩪ +\Vcy В +\profline ⌒ +\ltquest â©» +\andv ⩚ +\lessgtr ≶ +\lesdoto ⪁ +\NotSquareSubset ⊏̸ +\bullet • +\rarrsim ⥴ +\Tcedil Å¢ +\Hstrok Ħ +\eopf 𝕖 +\Theta Θ +\Cscr 𝒞 +\emacr ē +\UnionPlus ⊎ +\Vee ⋁ +\arctan arctan +\afr 𝔞 +\thinsp   +\bottom ⊥ +\lopf 𝕝 +\larrlp ↫ +\lbrace { +\Jscr 𝒥 +\Kcy К +\shortparallel ∥︀ +\hairsp   +\osol ⊘ +\lbrack [ +\hArr ⇔ +\vdash ⊢ +\UpDownArrow ↕ +\edot ė +\vzigzag ⦚ +\sopf 𝕤 +\NotLessGreater ≸ +\Qscr 𝒬 +\Gammad Ϝ +\SubsetEqual ⊆ +\uplus ⊎ +\LeftTriangle ⊲ +\ange ⦤ +\lim lim +\triangleright ▹ +\angrt ∟ +\rfloor ⌋ +\bigtriangledown ▽ +\ofcir ⦿ +\Vfr 𝔙 +\zopf 𝕫 +\UpArrowDownArrow ⇅ +\Xscr 𝒳 +\digamma Ϝ +\SmallCircle ∘ +\vArr ⇕ +\eqsim ≂ +\downharpoonright ⇂ +\Ccaron Č +\sdot ⋅ +\frown ⌢ +\angst Å +\lesges ⪓ +\iacute í +\wedge ∧ +\ssetmn ∖︀ +\rotimes ⨵ +\laquo « +\bigstar ★ +\Rrightarrow ⇛ +\erDot ≓ +\subseteq ⊆ +\leftharpoondown ↽ +\infin ∞ +\zdot ż +\solbar ⌿ +\Iuml Ï +\Kfr 𝔎 +\fscr 𝒻 +\DJcy Ђ +\veeeq ≚ +\Star ⋆ +\lsquor ‚ +\Uacute Ú +\weierp ℘ +\rang 〉 +\hamilt ℋ +\angsph ∢ +\YUcy Ю +\Wcirc Å´ +\supsetneq ⊋ +\gap ≳ +\mscr 𝓂 +\KJcy Ќ +\qprime ⁗ +\EqualTilde ≂ +\vBar ⫨ +\larrpl ⤹ +\nvge ≱ +\approx ≈ +\lnE ≨ +\NotGreaterLess ≹ +\epar ⋕ +\bigotimes ⊗ +\xharr  +\roang  +\xcup ⋃ +\tscr 𝓉 +\thkap ≈︀ +\Aacute Á +\rcy р +\jukcy є +\hookleftarrow ↩ +\napid ≋̸ +\tscy ц +\nvgt ≯ +\lpar ( +\ldsh ↲ +\aring Ã¥ +\nGg ⋙̸ +\LessEqualGreater ⋚ +\gcd gcd +\oplus ⊕ +\lcaron ľ +\DownArrow ↓ +\xutri △ +\Psi Ψ +\lesssim ≲ +\topcir ⫱ +\puncsp   +\origof ⊶ +\gnsim ⋧ +\eogon ę +\spar ∥︀ +\LowerRightArrow ↘ +\Lleftarrow ⇚ +\nGt ≫̸ +\euml ë +\reg ® +\exponentiale ⅇ +\qint ⨌ +\sqcups ⊔︀ +\lne ≨ +\LessSlantEqual ⩽ +\Egrave È +\orderof ℴ +\cirE ⧃ +\nleqslant ≰ +\gcy г +\curvearrowright ↷ +\ratail ↣ +\emsp13   +\sdotb ⊡ +\horbar ― +\emsp14   +\npre ⪯̸ +\rbrksld ⦎ +\sdote ⩦ +\varsupsetneqq ⊋︀ +\VeryThinSpace   +\DownArrowBar ⤓ +\Rightarrow ⇒ +\ocir ⊚ +\NotHumpDownHump ≎̸ +\darr ↓ +\geqq ≧ +\sup1 ¹ +\log log +\sup2 ² +\micro µ +\amp & +\arccos arccos +\sup3 ³ +\GreaterTilde ≳ +\circeq ≗ +\rfr 𝔯 +\dash ‐ +\rbrkslu ⦐ +\Dcaron Ď +\and ∧ +\Vbar â«« +\angzarr ⍼ +\gel ⋛ +\ang ∠ +\lor ∨ +\circ ∘ +\upharpoonright ↾ +\dblac ˝ +\subsetneqq ⊊ +\rhard ⇁ +\Intersection ⋂ +\cire ≗ +\apE ≊ +\sung ♪ +\geq ≥ +\succsim ≿ +\ges ⩾ +\Gbreve Ğ +\intercal ⊺ +\supE ⊇ +\NotCupCap ≭ +\loz ◊ +\capcup ⩇ +\larrtl ↢ +\AElig Æ +\rarr → +\varkappa Ï° +\upsi υ +\loang  +\looparrowleft ↫ +\IOcy Ё +\backprime ‵ +\sstarf ⋆ +\rharu ⇀ +\gesl ⋛︀ +\xotime ⊗ +\minus − +\gvnE ≩︀ +\gfr 𝔤 +\lfisht ⥼ +\jcirc ĵ +\roarr ⇾ +\rho ρ +\nvle ≰ +\sect § +\ggg ⋙ +\plusb ⊞ +\NotTildeFullEqual ≇ +\NegativeVeryThinSpace  ︀ +\ape ≊ +\pluse ⩲ +\dollar $ +\divonx ⋇ +\partial ∂ +\DoubleLeftRightArrow ⇔ +\varepsilon ε +\supe ⊇ +\nvlt ≮ +\angrtvb ⦝︀ +\gets ← +\nparallel ∦ +\varphi φ +\nsupseteq ⊉ +\circledR ® +\circledS Ⓢ +\primes ℙ +\cuwed ⋏ +\cupcap ⩆ +\nLl ⋘̸ +\lozf ⧫ +\ShortLeftArrow ←︀ +\nLt ≪̸ +\lesdotor ⪃ +\Fcy Ф +\scnsim ⋩ +\VerticalLine | +\nwArr ⇖ +\LeftTeeArrow ↤ +\iprod ⨼ +\lsh ↰ +\Congruent ≡ +\NotLeftTriangle ⋪ +\rdldhar ⥩ +\varpropto ∝ +\nvlArr ⇍ +\arg arg +\lhard ↽ +\surd ???? +\napos ʼn +\lparlt ⦓ +\hslash ℏ +\Gopf 𝔾 +\SHcy Ш +\triangle ▵ +\Qfr 𝔔 +\DiacriticalAcute ´ +\tbrk ⎴ +\Implies ⇒ +\comp ∁ +\ddarr ⇊ +\Colone â©´ +\smashp ⨳ +\ccups ⩌ +\triangleq ≜ +\NotSquareSubsetEqual ⋢ +\Nopf ℕ +\ZHcy Ж +\map ↦ +\lharu ↼ +\glE ⪒ +\cong ≅ +\Ecaron Ě +\Uring Å® +\blacktriangleright ▸ +\ntilde ñ +\max max +\loarr ⇽ +\LeftArrow ← +\Gdot Ä  +\Uopf 𝕌 +\bigsqcup ⊔ +\wedgeq ≙ +\RoundImplies ⥰ +\prap ≾ +\gescc ⪩ +\realine ℛ +\ast * +\subedot ⫃ +\LeftTeeVector ⥚ +\female ♀ +\circlearrowleft ↺ +\Ffr 𝔉 +\VDash ⊫ +\jsercy ј +\Proportional ∝ +\OverBracket ⎴ +\gla ⪥ +\NotElement ∉ +\theta θ +\kcedil Ä· +\smeparsl ⧤ +\rarrb ⇥ +\rarrc ⤳ +\ograve ò +\glj ⪤ +\infty ∞ +\gnE ≩ +\copf 𝕔 +\LeftArrowRightArrow ⇆ +\cwconint ∲ +\Ascr 𝒜 +\NegativeThinSpace  ︀ +\varsubsetneq ⊊︀ +\trisb ⧍ +\rightharpoonup ⇀ +\imagline ℐ +\mcy м +\Cacute Ć +\bumpeq ≏ +\jopf 𝕛 +\shchcy щ +\rarrw ↝ +\uuarr ⇈ +\doteq ≐ +\cudarrl ⤸ +\varsigma ς +\Hscr ℋ +\DownArrowUpArrow ⇵ +\Ecirc Ê +\DD ⅅ +\copy © +\SquareIntersection ⊓ +\RightUpVector ↾ +\NotSucceedsSlantEqual ⋡ +\cudarrr ⤵ +\verbar | +\ncaron ň +\prurel ⊰ +\nearr ↗ +\cdot ċ +\qopf 𝕢 +\SucceedsSlantEqual ≽ +\Oscr 𝒪 +\xfr 𝔵 +\gne ≩ +\Ccedil Ç +\nlarr ↚ +\inodot ı +\prec ≺ +\percnt % +\Exists ∃ +\bcy б +\xopf 𝕩 +\nsimeq ≄ +\nrtri ⋫ +\barvee ⊽ +\Vscr 𝒱 +\Zcaron Ž +\ReverseElement ∋ +\npolint ⨔ +\NotGreaterTilde ≵ +\lmoustache ⎰ +\forkv ⫙ +\rmoustache ⎱ +\DownLeftVectorBar ⥖ +\cosh cosh +\mfr 𝔪 +\LessGreater ≶ +\zeetrf ℨ +\DiacriticalDot ˙ +\Poincareplane ℌ +\curlyeqsucc ⋟ +\Equal ⩵ +\divides ∣ +\scpolint ⨓ +\ngsim ≵ +\larrbfs ⤟ +\HilbertSpace ℋ +\otilde õ +\larrb ⇤ +\wcirc ŵ +\dscr 𝒹 +\phmmat ℳ +\lacute ĺ +\tstrok ŧ +\NotDoubleVerticalBar ∦ +\lagran ℒ +\NotRightTriangle ⋫ +\dscy ѕ +\rightrightarrows ⇉ +\seArr ⇘ +\RightTriangleBar ⧐ +\coth coth +\swarrow ↙ +\semi ; +\kscr 𝓀 +\NotLessEqual ≰⃥ +\cularr ↶ +\blacklozenge ⧫ +\realpart ℜ +\LeftTriangleEqual ⊴ +\bfr 𝔟 +\Uuml Ü +\longleftrightarrow ???? +\lcedil ļ +\complement ∁ +\rscr 𝓇 +\mho ℧ +\mcomma ⨩ +\wedbar ⩟ +\NotVerticalBar ∤ +\Lcy Л +\tprime ‴ +\precneqq ⪵ +\Downarrow ⇓ +\rsh ↱ +\mid ∣ +\blank ␣ +\square □ +\squarf ▪ +\fflig ff +\downdownarrows ⇊ +\yscr 𝓎 +\subdot ⪽ +\ShortRightArrow →︀ +\NotCongruent ≢ +\Gg ⋙ +\Lstrok Ł +\min max +\Laplacetrf ℒ +\rarrap ⥵ +\NotLessSlantEqual ≰ +\DoubleRightArrow ⇒ +\Wfr 𝔚 +\subrarr ⥹ +\numsp   +\khcy х +\oint ∮ +\vprop ∝ +\hardcy ъ +\boxminus ⊟ +\GreaterLess ≷ +\thetav ϑ +\scE ≾ +\Gt ≫ +\Acy А +\backcong ≌ +\gtquest ⩼ +\awint ⨑ +\profsurf ⌓ +\capdot ⩀ +\supdot ⪾ +\oelig œ +\doteqdot ≑ +\rharul ⥬ +\cylcty ⌭ +\epsi ε +\eqcirc ≖ +\nLeftarrow ⇍ +\rtrie ⊵ +\para ¶ +\Lfr 𝔏 +\rtrif ▸ +\NotReverseElement ∌ +\emptyv ∅ +\nldr ‥ +\leqq ≦ +\CapitalDifferentialD ⅅ +\supsetneqq ⊋ +\boxDL ╗ +\Im ℑ +\sce ≽ +\prsim ≾ +\diams ♦ +\gtreqqless ⋛ +\boxDR ╔ +\vartriangleleft ⊲ +\SupersetEqual ⊇ +\Omega Ω +\nsubseteqq ⊈ +\Subset ⋐ +\ncongdot ⩭̸ +\minusb ⊟ +\ltimes ⋉ +\seswar ⤩ +\part ∂ +\bumpE ⪮ +\minusd ∸ +\Amacr Ā +\nleq ≰ +\nles ≰ +\NotLess ≮ +\scy с +\iinfin ⧜ +\Afr 𝔄 +\isinsv ⋳ +\prnE ⪵ +\lesg ⋚︀ +\cups ∪︀ +\thickapprox ≈︀ +\RightTeeVector ⥛ +\LowerLeftArrow ↙ +\utdot ⋰ +\homtht ∻ +\ddotseq â©· +\bowtie ⋈ +\succnsim ⋩ +\boxDl ╖ +\quot " +\lvnE ≨︀ +\CircleDot ⊙ +\lsime ⪍ +\Yacute Ý +\esdot ≐ +\Supset ⋑ +\lsimg ⪏ +\eDot ≑ +\sec sec +\boxDr ╓ +\plus + +\ddagger ‡ +\Vdashl ⫦ +\equest ≟ +\quest ? +\divideontimes ⋇ +\nsmid ∤︀ +\fnof ƒ +\bumpe ≏ +\lhblk ▄ +\prnap ⋨ +\compfn ∘ +\nsucceq ⪰̸ +\RightArrowLeftArrow ⇄ +\sharp ♯ +\CHcy Ч +\dwangle ⦦ +\angrtvbd ⦝ +\period . +\phone ☎ +\Eacute É +\dzigrarr  +\Ll ⋘ +\succapprox ≿ +\rarrfs ⤞ +\dbkarow ⤏ +\zeta ζ +\Lt ≪ +\triminus ⨺ +\odiv ⨸ +\ltrie ⊴ +\Dagger ‡ +\ltrif ◂ +\boxHD ╦ +\timesb ⊠ +\check ✓ +\urcorn ⌝ +\timesd ⨰ +\tshcy ћ +\sfr 𝔰 +\lmoust ⎰ +\ruluhar ⥨ +\bne =⃥ +\prod ∏ +\Eopf 𝔼 +\scsim ≿ +\GreaterEqualLess ⋛ +\Igrave Ì +\Longrightarrow ⇒ +\bigcap ⋂ +\boxHU ╩ +\uring ů +\equivDD ⩸ +\prop ∝ +\Lopf 𝕃 +\ldrushar ⥋ +\rarrhk ↪ +\Leftarrow ⇐ +\lltri ◺ +\NestedGreaterGreater ≫ +\GreaterFullEqual ≧ +\robrk 〛 +\larrsim ⥳ +\boxHd ╤ +\vDash ⊨ +\hfr 𝔥 +\Edot Ė +\Vvdash ⊪ +\Sopf 𝕊 +\upuparrows ⇈ +\RightUpTeeVector ⥜ +\DownLeftVector ↽ +\xhArr  +\triplus ⨹ +\bot ⊥ +\Rcy Р +\eDDot â©· +\subseteqq ⊆ +\cirfnint ⨐ +\spadesuit ♠ +\nacute ń +\Zopf ℤ +\upharpoonleft ↿ +\shy ­ +\nparsl ∥︀⃥ +\boxHu ╧ +\ThickSpace     +\Or ⩔ +\raemptyv ⦳ +\Aogon Ą +\IEcy Е +\sim ∼ +\sin sin +\copysr ℗ +\scnap ⋩ +\rdquo ” +\aopf 𝕒 +\Pi Π +\Udblac Å° +\expectation ℰ +\Zacute Ź +\urtri ◹ +\NotTildeEqual ≄ +\ncedil ņ +\Gamma Γ +\ecirc ê +\dsol ⧶ +\Gcy Г +\Pr Pr +\Zdot Å» +\mnplus ∓ +\hopf 𝕙 +\blacktriangledown ▾ +\LeftCeiling ⌈ +\ulcorn ⌜ +\searrow ↘ +\GreaterGreater ⪢ +\Fscr ℱ +\cupcup ⩊ +\NotEqual ≠ +\sext ✶ +\CirclePlus ⊕ +\erarr ⥱ +\dArr ⇓ +\PrecedesSlantEqual ≼ +\Itilde Ĩ +\gesdoto ⪂ +\Rang 》 +\nwarhk ⤣ +\minusdu ⨪ +\oopf 𝕠 +\Mscr ℳ +\Rfr ℜ +\langle 〈 +\And ⩓ +\bprime ‵ +\nLeftrightarrow ⇎ +\Re ℜ +\OpenCurlyQuote ‘ +\vopf 𝕧 +\ulcorner ⌜ +\nap ≉ +\Tscr 𝒯 +\gtreqless ⋛ +\rarrlp ↬ +\Lambda Λ +\lobrk 〚 +\rbrace } +\rArr ⇒ +\coloneq ≔ +\UpArrow ↑ +\odot ⊙ +\LeftDownTeeVector ⥡ +\complexes ℂ +\rbrack ] +\DownTeeArrow ↧ +\sqcap ⊓ +\Sc ⪼ +\ycy ы +\Prime ″ +\Gfr 𝔊 +\trianglerighteq ⊵ +\rangd ⦒ +\gtrdot ⋗ +\range ⦥ +\rsqb ] +\Euml Ë +\Therefore ∴ +\nesim ≂̸ +\order ℴ +\vsupnE ⊋︀ +\awconint ∳ +\bscr 𝒷 +\lesseqqgtr ⋚ +\cap ∩ +\ldquo “ +\nsubseteq ⊈ +\rhov ϱ +\xvee ⋁ +\olarr ↺ +\nang ∠̸ +\uwangle ⦧ +\nlsim ≴ +\smt ⪪ +\nVdash ⊮ +\napE ⩰̸ +\ngeq ≱ +\iscr 𝒾 +\GJcy Ѓ +\nges ≱ +\exist ∃ +\cent ¢ +\oacute ó +\Darr ↡ +\yen Â¥ +\bigcirc ◯ +\ncy н +\midast * +\UpperRightArrow ↗ +\precnapprox ⋨ +\OElig Œ +\hybull ⁃ +\cupbrcap ⩈ +\rationals ℚ +\VerticalTilde ≀ +\pscr 𝓅 +\NJcy Њ +\NotSucceedsTilde ≿̸ +\vsupne ⊋︀ +\Updownarrow ⇕ +\Lsh ↰ +\rAarr ⇛ +\precapprox ≾ +\rsquor ’ +\pound £ +\lbrksld ⦏ +\gesdot ⪀ +\Element ∈ +\xcirc ◯ +\wscr 𝓌 +\toea ⤨ +\setmn ∖ +\neg ¬ +\sol / +\yfr 𝔶 +\DoubleDownArrow ⇓ +\Rarr ↠ +\ngE ≱ +\Upsi ϒ +\opar ⦷ +\rarrpl ⥅ +\auml ä +\bmod mod +\SquareSuperset ⊐ +\neq ≠ +\circleddash ⊝ +\xrarr  +\barwed ⊼ +\lbrkslu ⦍ +\planckh ℎ +\ldrdhar ⥧ +\circledcirc ⊚ +\ctdot ⋯ +\fallingdotseq ≒ +\Map ⤅ +\VerticalBar ∣ +\succeq ≽ +\tint ∭ +\imof ⊷ +\diam ⋄ +\twixt ≬ +\NoBreak  +\langd ⦑ +\Bernoullis ℬ +\rcaron ř +\hom hom +\nfr 𝔫 +\backsimeq ⋍ +\target ⌖ +\ouml ö +\nge ≱⃥ +\LeftTriangleBar ⧏ +\subplus ⪿ +\parsim ⫳ +\Gcedil Ä¢ +\bnequiv ≡⃥ +\ubreve Å­ +\iexcl ¡ +\Xi Ξ +\omega ω +\elsdot ⪗ +\propto ∝ +\squ □ +\Ycirc Ŷ +\amacr ā +\curlyeqprec ⋞ +\ngt ≯ +\plusdo ∔ +\ngeqslant ≱ +\LongRightArrow  +\LeftUpVector ↿ +\asymp ≍ +\imped 𝕃 +\tritime ⨻ +\rpargt ⦔ +\DDotrahd ⤑ +\prnsim ⋨ +\plusdu ⨥ +\cfr 𝔠 +\abreve ă +\suphsol ⊃/ +\NegativeThickSpace  ︀ +\Mcy М +\uarr ↑ +\LeftRightVector ⥎ +\lAarr ⇚ +\bsim ∽ +\simrarr ⥲ +\otimes ⊗ +\NotSucceeds ⊁ +\Cross ⨯ +\downarrow ↓ +\blacktriangle ▴ +\TripleDot ⃛ +\smallsetminus ∖︀ +\supedot ⫄ +\NotPrecedesSlantEqual ⋠ +\neArr ⇗ +\rarrtl ↣ +\isin ∈ +\rrarr ⇉ +\Upsilon ϒ +\sqsub ⊏ +\boxUL ╝ +\LessTilde ≲ +\Xfr 𝔛 +\nis ⋼ +\chi χ +\DownRightVector ⇁ +\niv ∋ +\boxUR ╚ +\nlArr ⇍ +\Bcy Б +\tan tan +\EmptyVerySmallSquare  +\dstrok đ +\rfisht ⥽ +\easter ≛ +\nlE ≰ +\Mellintrf ℳ +\lotimes ⨴ +\sqsup ⊐ +\boxVH ╬ +\bbrk ⎵ +\tau τ +\UpTee ⊥ +\NotLeftTriangleBar ⧏̸ +\boxVL ╣ +\Proportion ∷ +\equiv ≡ +\blk12 ▒ +\blk14 ░ +\fpartint ⨍ +\boxVR ╠ +\starf ★ +\risingdotseq ≓ +\Equilibrium ⇌ +\ijlig ij +\yicy ї +\sum ∑ +\cir ○ +\telrec ⌕ +\Mfr 𝔐 +\dHar ⥥ +\boxUl ╜ +\apid ≋ +\nleftarrow ↚ +\curarrm ⤼ +\Scirc Ŝ +\Copf ℂ +\RightTriangleEqual ⊵ +\boxUr ╙ +\loplus ⨭ +\varsupsetneq ⊋︀ +\scaron Å¡ +\Diamond ⋄ +\lowast ∗ +\nle ≰⃥ +\phiv ϕ +\gesdotol ⪄ +\boxVh ╫ +\nleftrightarrow ↮ +\Jopf 𝕁 +\boxVl ╢ +\nearhk ⤤ +\vBarv â«© +\rHar ⥤ +\boxVr ╟ +\lessdot ⋖ +\LeftDoubleBracket 〚 +\Delta Δ +\limsup limsup +\tcy т +\nlt ≮ +\Cdot Ċ +\blk34 ▓ +\Bfr 𝔅 +\lowbar _ +\lneqq ≨ +\TildeEqual ≃ +\shortmid ∣︀ +\Qopf ℚ +\drcorn ⌟ +\ZeroWidthSpace ​ +\aogon ą +\Rsh ↱ +\lrarr ⇆ +\cupdot ⊍ +\Xopf 𝕏 +\Backslash ∖ +\Union ⋃ +\ratio ∶ +\duarr ⇵ +\lates ⪭︀ +\suphsub ⫗ +\squf ▪ +\gamma γ +\lrhard ⥭ +\intprod ⨼ +\ReverseUpEquilibrium ⥯ +\icy и +\quatint ⨖ +\nbump ≎̸ +\downharpoonleft ⇃ +\otimesas ⨶ +\nvHarr ⇎ +\ContourIntegral ∮ +\bsol \ +\DoubleUpDownArrow ⇕ +\disin ⋲ +\Breve ˘ +\YAcy Я +\precsim ≾ +\NotGreaterGreater ≫̸︀ +\fopf 𝕗 +\SquareSupersetEqual ⊒ +\Dscr 𝒟 +\gsime ⪎ +\PartialD ∂ +\Umacr Ū +\tfr 𝔱 +\cularrp ⤽ +\UnderBracket ⎵ +\ugrave ù +\mopf 𝕞 +\gsiml ⪐ +\iquest ¿ +\nmid ∤ +\leftarrowtail ↢ +\not ¬ +\Kscr 𝒦 +\xsqcup ⊔ +\triangleleft ◃ +\amalg ⨿ +\prcue ≼ +\ac ⤏ +\nharr ↮ +\dzcy џ +\topf 𝕥 +\iff ⇔ +\af ⁡ +\Uparrow ⇑ +\Iacute Í +\Rscr ℛ +\vrtri ⊳ +\multimap ⊸ +\Hat ̂ +\rtriltri ⧎ +\npr ⊀ +\agrave à +\UnderBar ̲ +\prime ′ +\plusmn ± +\eplus ⩱ +\ap ≈ +\dlcorn ⌞ +\backsim ∽ +\ifr 𝔦 +\bigcup ⋃ +\tcaron Å¥ +\sqcaps ⊓︀ +\equals = +\curlywedge ⋏ +\Yscr 𝒴 +\longrightarrow ???? +\fork ⋔ +\cos cos +\cot cot +\ImaginaryI ⅈ +\Scy С +\mapsto ↦ +\tdot ⃛ +\vellip ⋮ +\sqsupseteq ⊒ +\nvdash ⊬ +\NotSuperset ⊅ +\DoubleUpArrow ⇑ +\land ∧ +\topfork ⫚ +\llhard ⥫ +\apos ' +\oslash ø +\lang 〈 +\bernou ℬ +\varrho ϱ +\rcub } +\Cedilla ¸ +\ApplyFunction ⁡ +\nsce ⪰̸ +\gscr ℊ +\imagpart ℑ +\ngtr ≯ +\nsc ⊁ +\Barv ⫧ +\tosa ⤩ +\nwnear ⤧ +\ltlarr ⥶ +\PrecedesEqual ⪯ +\lessapprox ≲ +\Lcaron Ľ diff --git a/components/tactics/.depend b/components/tactics/.depend new file mode 100644 index 000000000..579ab17cc --- /dev/null +++ b/components/tactics/.depend @@ -0,0 +1,210 @@ +proofEngineHelpers.cmi: proofEngineTypes.cmi +continuationals.cmi: proofEngineTypes.cmi +tacticals.cmi: proofEngineTypes.cmi +reductionTactics.cmi: proofEngineTypes.cmi +proofEngineStructuralRules.cmi: proofEngineTypes.cmi +primitiveTactics.cmi: proofEngineTypes.cmi +metadataQuery.cmi: proofEngineTypes.cmi +autoTypes.cmi: proofEngineTypes.cmi +paramodulation/equality.cmi: paramodulation/utils.cmi \ + paramodulation/subst.cmi +paramodulation/founif.cmi: paramodulation/subst.cmi +paramodulation/equality_indexing.cmi: paramodulation/utils.cmi \ + paramodulation/equality.cmi +paramodulation/indexing.cmi: paramodulation/utils.cmi \ + paramodulation/subst.cmi paramodulation/equality_indexing.cmi \ + paramodulation/equality.cmi +paramodulation/saturation.cmi: paramodulation/utils.cmi proofEngineTypes.cmi \ + paramodulation/indexing.cmi paramodulation/equality.cmi +variousTactics.cmi: proofEngineTypes.cmi +compose.cmi: proofEngineTypes.cmi +introductionTactics.cmi: proofEngineTypes.cmi +eliminationTactics.cmi: proofEngineTypes.cmi +negationTactics.cmi: proofEngineTypes.cmi +equalityTactics.cmi: proofEngineTypes.cmi +auto.cmi: universe.cmi proofEngineTypes.cmi +destructTactic.cmi: proofEngineTypes.cmi +inversion.cmi: proofEngineTypes.cmi +ring.cmi: proofEngineTypes.cmi +setoids.cmi: proofEngineTypes.cmi +fourierR.cmi: proofEngineTypes.cmi +fwdSimplTactic.cmi: proofEngineTypes.cmi +statefulProofEngine.cmi: proofEngineTypes.cmi +tactics.cmi: universe.cmi tacticals.cmi proofEngineTypes.cmi +declarative.cmi: universe.cmi proofEngineTypes.cmi +proofEngineTypes.cmo: proofEngineTypes.cmi +proofEngineTypes.cmx: proofEngineTypes.cmi +proofEngineHelpers.cmo: proofEngineTypes.cmi proofEngineHelpers.cmi +proofEngineHelpers.cmx: proofEngineTypes.cmx proofEngineHelpers.cmi +proofEngineReduction.cmo: proofEngineTypes.cmi proofEngineHelpers.cmi \ + proofEngineReduction.cmi +proofEngineReduction.cmx: proofEngineTypes.cmx proofEngineHelpers.cmx \ + proofEngineReduction.cmi +continuationals.cmo: proofEngineTypes.cmi continuationals.cmi +continuationals.cmx: proofEngineTypes.cmx continuationals.cmi +tacticals.cmo: proofEngineTypes.cmi continuationals.cmi tacticals.cmi +tacticals.cmx: proofEngineTypes.cmx continuationals.cmx tacticals.cmi +reductionTactics.cmo: proofEngineTypes.cmi proofEngineReduction.cmi \ + proofEngineHelpers.cmi reductionTactics.cmi +reductionTactics.cmx: proofEngineTypes.cmx proofEngineReduction.cmx \ + proofEngineHelpers.cmx reductionTactics.cmi +proofEngineStructuralRules.cmo: proofEngineTypes.cmi \ + proofEngineStructuralRules.cmi +proofEngineStructuralRules.cmx: proofEngineTypes.cmx \ + proofEngineStructuralRules.cmi +primitiveTactics.cmo: tacticals.cmi reductionTactics.cmi proofEngineTypes.cmi \ + proofEngineReduction.cmi proofEngineHelpers.cmi primitiveTactics.cmi +primitiveTactics.cmx: tacticals.cmx reductionTactics.cmx proofEngineTypes.cmx \ + proofEngineReduction.cmx proofEngineHelpers.cmx primitiveTactics.cmi +hashtbl_equiv.cmo: hashtbl_equiv.cmi +hashtbl_equiv.cmx: hashtbl_equiv.cmi +metadataQuery.cmo: proofEngineTypes.cmi primitiveTactics.cmi \ + hashtbl_equiv.cmi metadataQuery.cmi +metadataQuery.cmx: proofEngineTypes.cmx primitiveTactics.cmx \ + hashtbl_equiv.cmx metadataQuery.cmi +universe.cmo: proofEngineTypes.cmi proofEngineReduction.cmi universe.cmi +universe.cmx: proofEngineTypes.cmx proofEngineReduction.cmx universe.cmi +autoTypes.cmo: autoTypes.cmi +autoTypes.cmx: autoTypes.cmi +autoCache.cmo: universe.cmi autoCache.cmi +autoCache.cmx: universe.cmx autoCache.cmi +paramodulation/utils.cmo: proofEngineReduction.cmi paramodulation/utils.cmi +paramodulation/utils.cmx: proofEngineReduction.cmx paramodulation/utils.cmi +closeCoercionGraph.cmo: closeCoercionGraph.cmi +closeCoercionGraph.cmx: closeCoercionGraph.cmi +paramodulation/subst.cmo: paramodulation/subst.cmi +paramodulation/subst.cmx: paramodulation/subst.cmi +paramodulation/equality.cmo: paramodulation/utils.cmi \ + paramodulation/subst.cmi proofEngineTypes.cmi proofEngineReduction.cmi \ + paramodulation/equality.cmi +paramodulation/equality.cmx: paramodulation/utils.cmx \ + paramodulation/subst.cmx proofEngineTypes.cmx proofEngineReduction.cmx \ + paramodulation/equality.cmi +paramodulation/founif.cmo: paramodulation/utils.cmi paramodulation/subst.cmi \ + paramodulation/founif.cmi +paramodulation/founif.cmx: paramodulation/utils.cmx paramodulation/subst.cmx \ + paramodulation/founif.cmi +paramodulation/equality_indexing.cmo: paramodulation/utils.cmi \ + paramodulation/equality.cmi paramodulation/equality_indexing.cmi +paramodulation/equality_indexing.cmx: paramodulation/utils.cmx \ + paramodulation/equality.cmx paramodulation/equality_indexing.cmi +paramodulation/indexing.cmo: paramodulation/utils.cmi \ + paramodulation/subst.cmi paramodulation/founif.cmi \ + paramodulation/equality_indexing.cmi paramodulation/equality.cmi \ + paramodulation/indexing.cmi +paramodulation/indexing.cmx: paramodulation/utils.cmx \ + paramodulation/subst.cmx paramodulation/founif.cmx \ + paramodulation/equality_indexing.cmx paramodulation/equality.cmx \ + paramodulation/indexing.cmi +paramodulation/saturation.cmo: paramodulation/utils.cmi \ + paramodulation/subst.cmi proofEngineTypes.cmi proofEngineHelpers.cmi \ + paramodulation/indexing.cmi paramodulation/founif.cmi \ + paramodulation/equality.cmi paramodulation/saturation.cmi +paramodulation/saturation.cmx: paramodulation/utils.cmx \ + paramodulation/subst.cmx proofEngineTypes.cmx proofEngineHelpers.cmx \ + paramodulation/indexing.cmx paramodulation/founif.cmx \ + paramodulation/equality.cmx paramodulation/saturation.cmi +variousTactics.cmo: tacticals.cmi proofEngineTypes.cmi \ + proofEngineReduction.cmi proofEngineHelpers.cmi primitiveTactics.cmi \ + variousTactics.cmi +variousTactics.cmx: tacticals.cmx proofEngineTypes.cmx \ + proofEngineReduction.cmx proofEngineHelpers.cmx primitiveTactics.cmx \ + variousTactics.cmi +compose.cmo: variousTactics.cmi proofEngineTypes.cmi primitiveTactics.cmi \ + closeCoercionGraph.cmi compose.cmi +compose.cmx: variousTactics.cmx proofEngineTypes.cmx primitiveTactics.cmx \ + closeCoercionGraph.cmx compose.cmi +introductionTactics.cmo: proofEngineTypes.cmi primitiveTactics.cmi \ + introductionTactics.cmi +introductionTactics.cmx: proofEngineTypes.cmx primitiveTactics.cmx \ + introductionTactics.cmi +eliminationTactics.cmo: tacticals.cmi reductionTactics.cmi \ + proofEngineTypes.cmi proofEngineStructuralRules.cmi \ + proofEngineHelpers.cmi primitiveTactics.cmi eliminationTactics.cmi +eliminationTactics.cmx: tacticals.cmx reductionTactics.cmx \ + proofEngineTypes.cmx proofEngineStructuralRules.cmx \ + proofEngineHelpers.cmx primitiveTactics.cmx eliminationTactics.cmi +negationTactics.cmo: variousTactics.cmi tacticals.cmi proofEngineTypes.cmi \ + primitiveTactics.cmi eliminationTactics.cmi negationTactics.cmi +negationTactics.cmx: variousTactics.cmx tacticals.cmx proofEngineTypes.cmx \ + primitiveTactics.cmx eliminationTactics.cmx negationTactics.cmi +equalityTactics.cmo: tacticals.cmi reductionTactics.cmi proofEngineTypes.cmi \ + proofEngineStructuralRules.cmi proofEngineReduction.cmi \ + proofEngineHelpers.cmi primitiveTactics.cmi introductionTactics.cmi \ + equalityTactics.cmi +equalityTactics.cmx: tacticals.cmx reductionTactics.cmx proofEngineTypes.cmx \ + proofEngineStructuralRules.cmx proofEngineReduction.cmx \ + proofEngineHelpers.cmx primitiveTactics.cmx introductionTactics.cmx \ + equalityTactics.cmi +auto.cmo: paramodulation/utils.cmi universe.cmi paramodulation/subst.cmi \ + paramodulation/saturation.cmi proofEngineTypes.cmi \ + proofEngineReduction.cmi proofEngineHelpers.cmi primitiveTactics.cmi \ + metadataQuery.cmi paramodulation/indexing.cmi equalityTactics.cmi \ + paramodulation/equality.cmi autoTypes.cmi autoCache.cmi auto.cmi +auto.cmx: paramodulation/utils.cmx universe.cmx paramodulation/subst.cmx \ + paramodulation/saturation.cmx proofEngineTypes.cmx \ + proofEngineReduction.cmx proofEngineHelpers.cmx primitiveTactics.cmx \ + metadataQuery.cmx paramodulation/indexing.cmx equalityTactics.cmx \ + paramodulation/equality.cmx autoTypes.cmx autoCache.cmx auto.cmi +destructTactic.cmo: tacticals.cmi reductionTactics.cmi proofEngineTypes.cmi \ + proofEngineStructuralRules.cmi proofEngineHelpers.cmi \ + primitiveTactics.cmi introductionTactics.cmi equalityTactics.cmi \ + eliminationTactics.cmi destructTactic.cmi +destructTactic.cmx: tacticals.cmx reductionTactics.cmx proofEngineTypes.cmx \ + proofEngineStructuralRules.cmx proofEngineHelpers.cmx \ + primitiveTactics.cmx introductionTactics.cmx equalityTactics.cmx \ + eliminationTactics.cmx destructTactic.cmi +inversion.cmo: tacticals.cmi reductionTactics.cmi proofEngineTypes.cmi \ + proofEngineReduction.cmi proofEngineHelpers.cmi primitiveTactics.cmi \ + equalityTactics.cmi inversion.cmi +inversion.cmx: tacticals.cmx reductionTactics.cmx proofEngineTypes.cmx \ + proofEngineReduction.cmx proofEngineHelpers.cmx primitiveTactics.cmx \ + equalityTactics.cmx inversion.cmi +inversion_principle.cmo: tacticals.cmi proofEngineTypes.cmi \ + primitiveTactics.cmi inversion.cmi inversion_principle.cmi +inversion_principle.cmx: tacticals.cmx proofEngineTypes.cmx \ + primitiveTactics.cmx inversion.cmx inversion_principle.cmi +ring.cmo: tacticals.cmi proofEngineTypes.cmi proofEngineStructuralRules.cmi \ + primitiveTactics.cmi equalityTactics.cmi eliminationTactics.cmi ring.cmi +ring.cmx: tacticals.cmx proofEngineTypes.cmx proofEngineStructuralRules.cmx \ + primitiveTactics.cmx equalityTactics.cmx eliminationTactics.cmx ring.cmi +setoids.cmo: proofEngineTypes.cmi primitiveTactics.cmi equalityTactics.cmi \ + setoids.cmi +setoids.cmx: proofEngineTypes.cmx primitiveTactics.cmx equalityTactics.cmx \ + setoids.cmi +fourier.cmo: fourier.cmi +fourier.cmx: fourier.cmi +fourierR.cmo: tacticals.cmi ring.cmi reductionTactics.cmi \ + proofEngineTypes.cmi proofEngineHelpers.cmi primitiveTactics.cmi \ + fourier.cmi equalityTactics.cmi fourierR.cmi +fourierR.cmx: tacticals.cmx ring.cmx reductionTactics.cmx \ + proofEngineTypes.cmx proofEngineHelpers.cmx primitiveTactics.cmx \ + fourier.cmx equalityTactics.cmx fourierR.cmi +fwdSimplTactic.cmo: tacticals.cmi proofEngineTypes.cmi \ + proofEngineStructuralRules.cmi proofEngineHelpers.cmi \ + primitiveTactics.cmi fwdSimplTactic.cmi +fwdSimplTactic.cmx: tacticals.cmx proofEngineTypes.cmx \ + proofEngineStructuralRules.cmx proofEngineHelpers.cmx \ + primitiveTactics.cmx fwdSimplTactic.cmi +history.cmo: history.cmi +history.cmx: history.cmi +statefulProofEngine.cmo: proofEngineTypes.cmi history.cmi \ + statefulProofEngine.cmi +statefulProofEngine.cmx: proofEngineTypes.cmx history.cmx \ + statefulProofEngine.cmi +tactics.cmo: variousTactics.cmi tacticals.cmi setoids.cmi ring.cmi \ + reductionTactics.cmi proofEngineStructuralRules.cmi primitiveTactics.cmi \ + negationTactics.cmi inversion.cmi introductionTactics.cmi \ + fwdSimplTactic.cmi fourierR.cmi equalityTactics.cmi \ + eliminationTactics.cmi destructTactic.cmi compose.cmi \ + closeCoercionGraph.cmi auto.cmi tactics.cmi +tactics.cmx: variousTactics.cmx tacticals.cmx setoids.cmx ring.cmx \ + reductionTactics.cmx proofEngineStructuralRules.cmx primitiveTactics.cmx \ + negationTactics.cmx inversion.cmx introductionTactics.cmx \ + fwdSimplTactic.cmx fourierR.cmx equalityTactics.cmx \ + eliminationTactics.cmx destructTactic.cmx compose.cmx \ + closeCoercionGraph.cmx auto.cmx tactics.cmi +declarative.cmo: universe.cmi tactics.cmi tacticals.cmi proofEngineTypes.cmi \ + declarative.cmi +declarative.cmx: universe.cmx tactics.cmx tacticals.cmx proofEngineTypes.cmx \ + declarative.cmi diff --git a/components/tactics/.depend.opt b/components/tactics/.depend.opt new file mode 100644 index 000000000..579ab17cc --- /dev/null +++ b/components/tactics/.depend.opt @@ -0,0 +1,210 @@ +proofEngineHelpers.cmi: proofEngineTypes.cmi +continuationals.cmi: proofEngineTypes.cmi +tacticals.cmi: proofEngineTypes.cmi +reductionTactics.cmi: proofEngineTypes.cmi +proofEngineStructuralRules.cmi: proofEngineTypes.cmi +primitiveTactics.cmi: proofEngineTypes.cmi +metadataQuery.cmi: proofEngineTypes.cmi +autoTypes.cmi: proofEngineTypes.cmi +paramodulation/equality.cmi: paramodulation/utils.cmi \ + paramodulation/subst.cmi +paramodulation/founif.cmi: paramodulation/subst.cmi +paramodulation/equality_indexing.cmi: paramodulation/utils.cmi \ + paramodulation/equality.cmi +paramodulation/indexing.cmi: paramodulation/utils.cmi \ + paramodulation/subst.cmi paramodulation/equality_indexing.cmi \ + paramodulation/equality.cmi +paramodulation/saturation.cmi: paramodulation/utils.cmi proofEngineTypes.cmi \ + paramodulation/indexing.cmi paramodulation/equality.cmi +variousTactics.cmi: proofEngineTypes.cmi +compose.cmi: proofEngineTypes.cmi +introductionTactics.cmi: proofEngineTypes.cmi +eliminationTactics.cmi: proofEngineTypes.cmi +negationTactics.cmi: proofEngineTypes.cmi +equalityTactics.cmi: proofEngineTypes.cmi +auto.cmi: universe.cmi proofEngineTypes.cmi +destructTactic.cmi: proofEngineTypes.cmi +inversion.cmi: proofEngineTypes.cmi +ring.cmi: proofEngineTypes.cmi +setoids.cmi: proofEngineTypes.cmi +fourierR.cmi: proofEngineTypes.cmi +fwdSimplTactic.cmi: proofEngineTypes.cmi +statefulProofEngine.cmi: proofEngineTypes.cmi +tactics.cmi: universe.cmi tacticals.cmi proofEngineTypes.cmi +declarative.cmi: universe.cmi proofEngineTypes.cmi +proofEngineTypes.cmo: proofEngineTypes.cmi +proofEngineTypes.cmx: proofEngineTypes.cmi +proofEngineHelpers.cmo: proofEngineTypes.cmi proofEngineHelpers.cmi +proofEngineHelpers.cmx: proofEngineTypes.cmx proofEngineHelpers.cmi +proofEngineReduction.cmo: proofEngineTypes.cmi proofEngineHelpers.cmi \ + proofEngineReduction.cmi +proofEngineReduction.cmx: proofEngineTypes.cmx proofEngineHelpers.cmx \ + proofEngineReduction.cmi +continuationals.cmo: proofEngineTypes.cmi continuationals.cmi +continuationals.cmx: proofEngineTypes.cmx continuationals.cmi +tacticals.cmo: proofEngineTypes.cmi continuationals.cmi tacticals.cmi +tacticals.cmx: proofEngineTypes.cmx continuationals.cmx tacticals.cmi +reductionTactics.cmo: proofEngineTypes.cmi proofEngineReduction.cmi \ + proofEngineHelpers.cmi reductionTactics.cmi +reductionTactics.cmx: proofEngineTypes.cmx proofEngineReduction.cmx \ + proofEngineHelpers.cmx reductionTactics.cmi +proofEngineStructuralRules.cmo: proofEngineTypes.cmi \ + proofEngineStructuralRules.cmi +proofEngineStructuralRules.cmx: proofEngineTypes.cmx \ + proofEngineStructuralRules.cmi +primitiveTactics.cmo: tacticals.cmi reductionTactics.cmi proofEngineTypes.cmi \ + proofEngineReduction.cmi proofEngineHelpers.cmi primitiveTactics.cmi +primitiveTactics.cmx: tacticals.cmx reductionTactics.cmx proofEngineTypes.cmx \ + proofEngineReduction.cmx proofEngineHelpers.cmx primitiveTactics.cmi +hashtbl_equiv.cmo: hashtbl_equiv.cmi +hashtbl_equiv.cmx: hashtbl_equiv.cmi +metadataQuery.cmo: proofEngineTypes.cmi primitiveTactics.cmi \ + hashtbl_equiv.cmi metadataQuery.cmi +metadataQuery.cmx: proofEngineTypes.cmx primitiveTactics.cmx \ + hashtbl_equiv.cmx metadataQuery.cmi +universe.cmo: proofEngineTypes.cmi proofEngineReduction.cmi universe.cmi +universe.cmx: proofEngineTypes.cmx proofEngineReduction.cmx universe.cmi +autoTypes.cmo: autoTypes.cmi +autoTypes.cmx: autoTypes.cmi +autoCache.cmo: universe.cmi autoCache.cmi +autoCache.cmx: universe.cmx autoCache.cmi +paramodulation/utils.cmo: proofEngineReduction.cmi paramodulation/utils.cmi +paramodulation/utils.cmx: proofEngineReduction.cmx paramodulation/utils.cmi +closeCoercionGraph.cmo: closeCoercionGraph.cmi +closeCoercionGraph.cmx: closeCoercionGraph.cmi +paramodulation/subst.cmo: paramodulation/subst.cmi +paramodulation/subst.cmx: paramodulation/subst.cmi +paramodulation/equality.cmo: paramodulation/utils.cmi \ + paramodulation/subst.cmi proofEngineTypes.cmi proofEngineReduction.cmi \ + paramodulation/equality.cmi +paramodulation/equality.cmx: paramodulation/utils.cmx \ + paramodulation/subst.cmx proofEngineTypes.cmx proofEngineReduction.cmx \ + paramodulation/equality.cmi +paramodulation/founif.cmo: paramodulation/utils.cmi paramodulation/subst.cmi \ + paramodulation/founif.cmi +paramodulation/founif.cmx: paramodulation/utils.cmx paramodulation/subst.cmx \ + paramodulation/founif.cmi +paramodulation/equality_indexing.cmo: paramodulation/utils.cmi \ + paramodulation/equality.cmi paramodulation/equality_indexing.cmi +paramodulation/equality_indexing.cmx: paramodulation/utils.cmx \ + paramodulation/equality.cmx paramodulation/equality_indexing.cmi +paramodulation/indexing.cmo: paramodulation/utils.cmi \ + paramodulation/subst.cmi paramodulation/founif.cmi \ + paramodulation/equality_indexing.cmi paramodulation/equality.cmi \ + paramodulation/indexing.cmi +paramodulation/indexing.cmx: paramodulation/utils.cmx \ + paramodulation/subst.cmx paramodulation/founif.cmx \ + paramodulation/equality_indexing.cmx paramodulation/equality.cmx \ + paramodulation/indexing.cmi +paramodulation/saturation.cmo: paramodulation/utils.cmi \ + paramodulation/subst.cmi proofEngineTypes.cmi proofEngineHelpers.cmi \ + paramodulation/indexing.cmi paramodulation/founif.cmi \ + paramodulation/equality.cmi paramodulation/saturation.cmi +paramodulation/saturation.cmx: paramodulation/utils.cmx \ + paramodulation/subst.cmx proofEngineTypes.cmx proofEngineHelpers.cmx \ + paramodulation/indexing.cmx paramodulation/founif.cmx \ + paramodulation/equality.cmx paramodulation/saturation.cmi +variousTactics.cmo: tacticals.cmi proofEngineTypes.cmi \ + proofEngineReduction.cmi proofEngineHelpers.cmi primitiveTactics.cmi \ + variousTactics.cmi +variousTactics.cmx: tacticals.cmx proofEngineTypes.cmx \ + proofEngineReduction.cmx proofEngineHelpers.cmx primitiveTactics.cmx \ + variousTactics.cmi +compose.cmo: variousTactics.cmi proofEngineTypes.cmi primitiveTactics.cmi \ + closeCoercionGraph.cmi compose.cmi +compose.cmx: variousTactics.cmx proofEngineTypes.cmx primitiveTactics.cmx \ + closeCoercionGraph.cmx compose.cmi +introductionTactics.cmo: proofEngineTypes.cmi primitiveTactics.cmi \ + introductionTactics.cmi +introductionTactics.cmx: proofEngineTypes.cmx primitiveTactics.cmx \ + introductionTactics.cmi +eliminationTactics.cmo: tacticals.cmi reductionTactics.cmi \ + proofEngineTypes.cmi proofEngineStructuralRules.cmi \ + proofEngineHelpers.cmi primitiveTactics.cmi eliminationTactics.cmi +eliminationTactics.cmx: tacticals.cmx reductionTactics.cmx \ + proofEngineTypes.cmx proofEngineStructuralRules.cmx \ + proofEngineHelpers.cmx primitiveTactics.cmx eliminationTactics.cmi +negationTactics.cmo: variousTactics.cmi tacticals.cmi proofEngineTypes.cmi \ + primitiveTactics.cmi eliminationTactics.cmi negationTactics.cmi +negationTactics.cmx: variousTactics.cmx tacticals.cmx proofEngineTypes.cmx \ + primitiveTactics.cmx eliminationTactics.cmx negationTactics.cmi +equalityTactics.cmo: tacticals.cmi reductionTactics.cmi proofEngineTypes.cmi \ + proofEngineStructuralRules.cmi proofEngineReduction.cmi \ + proofEngineHelpers.cmi primitiveTactics.cmi introductionTactics.cmi \ + equalityTactics.cmi +equalityTactics.cmx: tacticals.cmx reductionTactics.cmx proofEngineTypes.cmx \ + proofEngineStructuralRules.cmx proofEngineReduction.cmx \ + proofEngineHelpers.cmx primitiveTactics.cmx introductionTactics.cmx \ + equalityTactics.cmi +auto.cmo: paramodulation/utils.cmi universe.cmi paramodulation/subst.cmi \ + paramodulation/saturation.cmi proofEngineTypes.cmi \ + proofEngineReduction.cmi proofEngineHelpers.cmi primitiveTactics.cmi \ + metadataQuery.cmi paramodulation/indexing.cmi equalityTactics.cmi \ + paramodulation/equality.cmi autoTypes.cmi autoCache.cmi auto.cmi +auto.cmx: paramodulation/utils.cmx universe.cmx paramodulation/subst.cmx \ + paramodulation/saturation.cmx proofEngineTypes.cmx \ + proofEngineReduction.cmx proofEngineHelpers.cmx primitiveTactics.cmx \ + metadataQuery.cmx paramodulation/indexing.cmx equalityTactics.cmx \ + paramodulation/equality.cmx autoTypes.cmx autoCache.cmx auto.cmi +destructTactic.cmo: tacticals.cmi reductionTactics.cmi proofEngineTypes.cmi \ + proofEngineStructuralRules.cmi proofEngineHelpers.cmi \ + primitiveTactics.cmi introductionTactics.cmi equalityTactics.cmi \ + eliminationTactics.cmi destructTactic.cmi +destructTactic.cmx: tacticals.cmx reductionTactics.cmx proofEngineTypes.cmx \ + proofEngineStructuralRules.cmx proofEngineHelpers.cmx \ + primitiveTactics.cmx introductionTactics.cmx equalityTactics.cmx \ + eliminationTactics.cmx destructTactic.cmi +inversion.cmo: tacticals.cmi reductionTactics.cmi proofEngineTypes.cmi \ + proofEngineReduction.cmi proofEngineHelpers.cmi primitiveTactics.cmi \ + equalityTactics.cmi inversion.cmi +inversion.cmx: tacticals.cmx reductionTactics.cmx proofEngineTypes.cmx \ + proofEngineReduction.cmx proofEngineHelpers.cmx primitiveTactics.cmx \ + equalityTactics.cmx inversion.cmi +inversion_principle.cmo: tacticals.cmi proofEngineTypes.cmi \ + primitiveTactics.cmi inversion.cmi inversion_principle.cmi +inversion_principle.cmx: tacticals.cmx proofEngineTypes.cmx \ + primitiveTactics.cmx inversion.cmx inversion_principle.cmi +ring.cmo: tacticals.cmi proofEngineTypes.cmi proofEngineStructuralRules.cmi \ + primitiveTactics.cmi equalityTactics.cmi eliminationTactics.cmi ring.cmi +ring.cmx: tacticals.cmx proofEngineTypes.cmx proofEngineStructuralRules.cmx \ + primitiveTactics.cmx equalityTactics.cmx eliminationTactics.cmx ring.cmi +setoids.cmo: proofEngineTypes.cmi primitiveTactics.cmi equalityTactics.cmi \ + setoids.cmi +setoids.cmx: proofEngineTypes.cmx primitiveTactics.cmx equalityTactics.cmx \ + setoids.cmi +fourier.cmo: fourier.cmi +fourier.cmx: fourier.cmi +fourierR.cmo: tacticals.cmi ring.cmi reductionTactics.cmi \ + proofEngineTypes.cmi proofEngineHelpers.cmi primitiveTactics.cmi \ + fourier.cmi equalityTactics.cmi fourierR.cmi +fourierR.cmx: tacticals.cmx ring.cmx reductionTactics.cmx \ + proofEngineTypes.cmx proofEngineHelpers.cmx primitiveTactics.cmx \ + fourier.cmx equalityTactics.cmx fourierR.cmi +fwdSimplTactic.cmo: tacticals.cmi proofEngineTypes.cmi \ + proofEngineStructuralRules.cmi proofEngineHelpers.cmi \ + primitiveTactics.cmi fwdSimplTactic.cmi +fwdSimplTactic.cmx: tacticals.cmx proofEngineTypes.cmx \ + proofEngineStructuralRules.cmx proofEngineHelpers.cmx \ + primitiveTactics.cmx fwdSimplTactic.cmi +history.cmo: history.cmi +history.cmx: history.cmi +statefulProofEngine.cmo: proofEngineTypes.cmi history.cmi \ + statefulProofEngine.cmi +statefulProofEngine.cmx: proofEngineTypes.cmx history.cmx \ + statefulProofEngine.cmi +tactics.cmo: variousTactics.cmi tacticals.cmi setoids.cmi ring.cmi \ + reductionTactics.cmi proofEngineStructuralRules.cmi primitiveTactics.cmi \ + negationTactics.cmi inversion.cmi introductionTactics.cmi \ + fwdSimplTactic.cmi fourierR.cmi equalityTactics.cmi \ + eliminationTactics.cmi destructTactic.cmi compose.cmi \ + closeCoercionGraph.cmi auto.cmi tactics.cmi +tactics.cmx: variousTactics.cmx tacticals.cmx setoids.cmx ring.cmx \ + reductionTactics.cmx proofEngineStructuralRules.cmx primitiveTactics.cmx \ + negationTactics.cmx inversion.cmx introductionTactics.cmx \ + fwdSimplTactic.cmx fourierR.cmx equalityTactics.cmx \ + eliminationTactics.cmx destructTactic.cmx compose.cmx \ + closeCoercionGraph.cmx auto.cmx tactics.cmi +declarative.cmo: universe.cmi tactics.cmi tacticals.cmi proofEngineTypes.cmi \ + declarative.cmi +declarative.cmx: universe.cmx tactics.cmx tacticals.cmx proofEngineTypes.cmx \ + declarative.cmi diff --git a/components/tactics/Makefile b/components/tactics/Makefile new file mode 100644 index 000000000..7c9f00db5 --- /dev/null +++ b/components/tactics/Makefile @@ -0,0 +1,61 @@ +PACKAGE = tactics + +INTERFACE_FILES = \ + proofEngineTypes.mli \ + proofEngineHelpers.mli proofEngineReduction.mli \ + continuationals.mli \ + tacticals.mli reductionTactics.mli proofEngineStructuralRules.mli \ + primitiveTactics.mli hashtbl_equiv.mli metadataQuery.mli \ + universe.mli \ + autoTypes.mli \ + autoCache.mli \ + paramodulation/utils.mli \ + closeCoercionGraph.mli \ + paramodulation/subst.mli \ + paramodulation/equality.mli\ + paramodulation/founif.mli\ + paramodulation/equality_indexing.mli\ + paramodulation/indexing.mli \ + paramodulation/saturation.mli \ + variousTactics.mli \ + compose.mli \ + introductionTactics.mli eliminationTactics.mli negationTactics.mli \ + equalityTactics.mli \ + auto.mli \ + destructTactic.mli \ + inversion.mli inversion_principle.mli ring.mli setoids.mli \ + fourier.mli fourierR.mli fwdSimplTactic.mli history.mli \ + statefulProofEngine.mli tactics.mli declarative.mli + +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) + + +all: + +# we omit dependencies since it is a pain when distributing +tactics_mli_deps = tactics.ml *Tactics.mli *Tactic.mli fourierR.mli ring.mli paramodulation/indexing.mli +tactics.mli: tactics.ml + $(H)echo " OCAMLC -i $$(tactics_mli_deps) > $@" + $(H)echo "(* GENERATED FILE, DO NOT EDIT. STAMP:`date` *)" > $@ + $(H)$(OCAMLC) -I paramodulation -i tactics.ml >> $@ + +UTF8DIR = $(shell $(OCAMLFIND) query helm-syntax_extensions) +STR=$(shell $(OCAMLFIND) query str) +MY_SYNTAXOPTIONS = -pp "camlp5o -I $(UTF8DIR) -I $(STR) str.cma pa_extend.cmo profiling_macros.cma -loc loc" +paramodulation/%.cmo: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +paramodulation/%.cmo: OCAMLC = $(OCAMLC_P4) +paramodulation/%.cmx: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +paramodulation/%.cmx: OCAMLOPT = $(OCAMLOPT_P4) + +depend: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) +depend.opt: SYNTAXOPTIONS = $(MY_SYNTAXOPTIONS) + +STATS_EXCLUDE = tactics.mli + +include ../../Makefile.defs +include ../Makefile.common + +OCAMLOPTIONS+= -I paramodulation +OCAMLDEPOPTIONS+= -I paramodulation +#PREPROCOPTIONS:= +#OCAML_PROF=p -p a diff --git a/components/tactics/auto.ml b/components/tactics/auto.ml new file mode 100644 index 000000000..ba80608d2 --- /dev/null +++ b/components/tactics/auto.ml @@ -0,0 +1,1839 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +open AutoTypes;; +open AutoCache;; + +let debug = false;; +let debug_print s = + if debug then prerr_endline (Lazy.force s);; + +let elems = ref [] ;; + +(* closing a term w.r.t. its metavariables + very naif version: it does not take dependencies properly into account *) + +let naif_closure ?(prefix_name="xxx_") t metasenv context = + let metasenv = ProofEngineHelpers.sort_metasenv metasenv in + let n = List.length metasenv in + let what = List.map (fun (i,cc,ty) -> Cic.Meta(i,[])) metasenv in + let _,with_what = + List.fold_left + (fun (i,acc) (_,cc,ty) -> (i-1,Cic.Rel i::acc)) + (n,[]) metasenv + in + let t = CicSubstitution.lift n t in + let body = + ProofEngineReduction.replace_lifting + ~equality:(fun c t1 t2 -> + match t1,t2 with + | Cic.Meta(i,_),Cic.Meta(j,_) -> i = j + | _ -> false) + ~context ~what ~with_what ~where:t + in + let _, t = + List.fold_left + (fun (n,t) (_,cc,ty) -> + n-1, Cic.Lambda(Cic.Name (prefix_name^string_of_int n), + CicSubstitution.lift n ty,t)) + (n-1,body) metasenv + in + t +;; + +let lambda_close ?prefix_name t menv ctx = + let t = naif_closure ?prefix_name t menv ctx in + List.fold_left + (fun (t,i) -> function + | None -> CicSubstitution.subst (Cic.Implicit None) t,i (* delift *) + | Some (name, Cic.Decl ty) -> Cic.Lambda (name, ty, t),i+1 + | Some (name, Cic.Def (bo, _)) -> Cic.LetIn (name, bo, t),i+1) + (t,List.length menv) ctx +;; + +(* functions for retrieving theorems *) + +exception FillingFailure of AutoCache.cache * int + +let rec unfold context = function + | Cic.Prod(name,s,t) -> + let t' = unfold ((Some (name,Cic.Decl s))::context) t in + Cic.Prod(name,s,t') + | t -> ProofEngineReduction.unfold context t + +let find_library_theorems dbd proof goal = + let univ = MetadataQuery.universe_of_goal ~dbd false proof goal in + let terms = List.map CicUtil.term_of_uri univ in + List.map + (fun t -> + (t,fst(CicTypeChecker.type_of_aux' [] [] t CicUniv.empty_ugraph))) + terms + +let find_context_theorems context metasenv = + let l,_ = + List.fold_left + (fun (res,i) ctxentry -> + match ctxentry with + | Some (_,Cic.Decl t) -> + (Cic.Rel i, CicSubstitution.lift i t)::res,i+1 + | Some (_,Cic.Def (_,Some t)) -> + (Cic.Rel i, CicSubstitution.lift i t)::res,i+1 + | Some (_,Cic.Def (_,None)) -> + let t = Cic.Rel i in + let ty,_ = + CicTypeChecker.type_of_aux' + metasenv context t CicUniv.empty_ugraph + in + (t,ty)::res,i+1 + | _ -> res,i+1) + ([],1) context + in l + +let rec is_an_equality = function + | Cic.Appl [Cic.MutInd (uri, _, _); _; _; _] + when (LibraryObjects.is_eq_URI uri) -> true + | Cic.Prod (_, _, t) -> is_an_equality t + | _ -> false +;; + +let partition_equalities = + List.partition (fun (_,ty) -> is_an_equality ty) + + +let default_auto maxm _ _ cache _ _ _ _ = [],cache,maxm ;; + + +let is_unit_equation context metasenv oldnewmeta term = + let head, metasenv, args, newmeta = + TermUtil.saturate_term oldnewmeta metasenv context term 0 + in + let propositional_args = + HExtlib.filter_map + (function + | Cic.Meta(i,_) -> + let _,_,mt = CicUtil.lookup_meta i metasenv in + let sort,u = + CicTypeChecker.type_of_aux' metasenv context mt + CicUniv.empty_ugraph + in + let b, _ = + CicReduction.are_convertible ~metasenv context + sort (Cic.Sort Cic.Prop) u + in + if b then Some i else None + | _ -> assert false) + args + in + if propositional_args = [] then + let newmetas = + List.filter (fun (i,_,_) -> i >= oldnewmeta) metasenv + in + Some (args,metasenv,newmetas,head,newmeta) + else None +;; + +let get_candidates universe cache t = + let candidates= + (Universe.get_candidates universe t)@(AutoCache.get_candidates cache t) + in + let debug_msg = + (lazy ("candidates for " ^ (CicPp.ppterm t) ^ " = " ^ + (String.concat "\n" (List.map CicPp.ppterm candidates)))) in + debug_print debug_msg; + candidates +;; + +let only signature context metasenv t = + try + let ty,_ = + CicTypeChecker.type_of_aux' metasenv context t CicUniv.empty_ugraph + in + let consts = MetadataConstraints.constants_of ty in + let b = MetadataConstraints.UriManagerSet.subset consts signature in + if b then b + else + let ty' = unfold context ty in + let consts' = MetadataConstraints.constants_of ty' in + MetadataConstraints.UriManagerSet.subset consts' signature + with + | CicTypeChecker.TypeCheckerFailure _ -> assert false + | ProofEngineTypes.Fail _ -> false (* unfold may fail *) +;; + +let not_default_eq_term t = + try + let uri = CicUtil.uri_of_term t in + not (LibraryObjects.in_eq_URIs uri) + with Invalid_argument _ -> true + +let retrieve_equations dont_filter signature universe cache context metasenv = + match LibraryObjects.eq_URI() with + | None -> [] + | Some eq_uri -> + let eq_uri = UriManager.strip_xpointer eq_uri in + let fake= Cic.Meta(-1,[]) in + let fake_eq = Cic.Appl [Cic.MutInd (eq_uri,0, []);fake;fake;fake] in + let candidates = get_candidates universe cache fake_eq in + if dont_filter then candidates + else + let candidates = List.filter not_default_eq_term candidates in + List.filter (only signature context metasenv) candidates + +let build_equality bag head args proof newmetas maxmeta = + match head with + | Cic.Appl [Cic.MutInd (uri, _, _); ty; t1; t2] -> + let p = + if args = [] then proof else Cic.Appl (proof::args) + in + let o = !Utils.compare_terms t1 t2 in + let stat = (ty,t1,t2,o) in + (* let w = compute_equality_weight stat in *) + let w = 0 in + let proof = Equality.Exact p in + let e = Equality.mk_equality bag (w, proof, stat, newmetas) in + (* to clean the local context of metas *) + Equality.fix_metas bag maxmeta e + | _ -> assert false +;; + +let partition_unit_equalities context metasenv newmeta bag equations = + List.fold_left + (fun (units,other,maxmeta)(t,ty) -> + if not (CicUtil.is_meta_closed t && CicUtil.is_meta_closed ty) then + let _ = + HLog.warn + ("Skipping " ^ CicMetaSubst.ppterm_in_context ~metasenv [] t context + ^ " since it is not meta closed") + in + units,(t,ty)::other,maxmeta + else + match is_unit_equation context metasenv maxmeta ty with + | Some (args,metasenv,newmetas,head,newmeta') -> + let maxmeta,equality = + build_equality bag head args t newmetas newmeta' in + equality::units,other,maxmeta + | None -> + units,(t,ty)::other,maxmeta) + ([],[],newmeta) equations + +let empty_tables = + (Saturation.make_active [], + Saturation.make_passive [], + Equality.mk_equality_bag) + +let init_cache_and_tables + ?dbd use_library paramod use_context dont_filter universe (proof, goal) += + (* the local cache in initially empty *) + let cache = AutoCache.cache_empty in + let _, metasenv, _subst,_, _, _ = proof in + let signature = MetadataQuery.signature_of metasenv goal in + let newmeta = CicMkImplicit.new_meta metasenv [] in + let _,context,_ = CicUtil.lookup_meta goal metasenv in + let ct = if use_context then find_context_theorems context metasenv else [] in + debug_print + (lazy ("ho trovato nel contesto " ^ (string_of_int (List.length ct)))); + let lt = + match use_library, dbd with + | true, Some dbd -> find_library_theorems dbd metasenv goal + | _ -> [] + in + debug_print + (lazy ("ho trovato nella libreria " ^ (string_of_int (List.length lt)))); + let cache = cache_add_list cache context (ct@lt) in + let equations = + retrieve_equations dont_filter signature universe cache context metasenv + in + debug_print + (lazy ("ho trovato equazioni n. "^(string_of_int (List.length equations)))); + let eqs_and_types = + HExtlib.filter_map + (fun t -> + let ty,_ = + CicTypeChecker.type_of_aux' + metasenv context t CicUniv.empty_ugraph + in + (* retrieve_equations could also return flexible terms *) + if is_an_equality ty then Some(t,ty) + else + try + let ty' = unfold context ty in + if is_an_equality ty' then Some(t,ty') else None + with ProofEngineTypes.Fail _ -> None) + equations + in + let bag = Equality.mk_equality_bag () in + let units, other_equalities, newmeta = + partition_unit_equalities context metasenv newmeta bag eqs_and_types + in + (* SIMPLIFICATION STEP + let equalities = + let env = (metasenv, context, CicUniv.empty_ugraph) in + let eq_uri = HExtlib.unopt (LibraryObjects.eq_URI()) in + Saturation.simplify_equalities bag eq_uri env units + in + *) + let passive = Saturation.make_passive units in + let no = List.length units in + let active = Saturation.make_active [] in + let active,passive,newmeta = + if paramod then active,passive,newmeta + else + Saturation.pump_actives + context bag newmeta active passive (no+1) infinity + in + (active,passive,bag),cache,newmeta + +let fill_hypothesis context metasenv oldnewmeta term tables (universe:Universe.universe) cache auto fast = + let head, metasenv, args, newmeta = + TermUtil.saturate_term oldnewmeta metasenv context term 0 + in + let propositional_args = + HExtlib.filter_map + (function + | Cic.Meta(i,_) -> + let _,_,mt = CicUtil.lookup_meta i metasenv in + let sort,u = + CicTypeChecker.type_of_aux' metasenv context mt + CicUniv.empty_ugraph + in + let b, _ = + CicReduction.are_convertible ~metasenv context + sort (Cic.Sort Cic.Prop) u + in + if b then Some i else None + | _ -> assert false) + args + in + let results,cache,newmeta = + if propositional_args = [] then + let newmetas = List.filter (fun (i,_,_) -> i >= oldnewmeta) metasenv in + [args,metasenv,newmetas,head,newmeta],cache,newmeta + else + (* + let proof = + None,metasenv,term,term (* term non e' significativo *) + in *) + let flags = + if fast then + {AutoTypes.default_flags() with + AutoTypes.timeout = Unix.gettimeofday() +. 1.0; + maxwidth = 2;maxdepth = 2; + use_paramod=true;use_only_paramod=false} + else + {AutoTypes.default_flags() with + AutoTypes.timeout = Unix.gettimeofday() +. 1.0; + maxwidth = 2;maxdepth = 4; + use_paramod=true;use_only_paramod=false} + in + match auto newmeta tables universe cache context metasenv propositional_args flags with + | [],cache,newmeta -> raise (FillingFailure (cache,newmeta)) + | substs,cache,newmeta -> + List.map + (fun subst -> + let metasenv = + CicMetaSubst.apply_subst_metasenv subst metasenv + in + let head = CicMetaSubst.apply_subst subst head in + let newmetas = + List.filter (fun (i,_,_) ->i >= oldnewmeta) metasenv + in + let args = List.map (CicMetaSubst.apply_subst subst) args in + let newm = CicMkImplicit.new_meta metasenv subst in + args,metasenv,newmetas,head,max newm newmeta) + substs, cache, newmeta + in + results,cache,newmeta + +let build_equalities auto context metasenv tables universe cache newmeta equations = + List.fold_left + (fun (facts,cache,newmeta) (t,ty) -> + (* in any case we add the equation to the cache *) + let cache = AutoCache.cache_add_list cache context [(t,ty)] in + try + let saturated,cache,newmeta = + fill_hypothesis context metasenv newmeta ty tables universe cache auto true + in + let (active,passive,bag) = tables in + let eqs,bag,newmeta = + List.fold_left + (fun (acc,bag,newmeta) (args,metasenv,newmetas,head,newmeta') -> + let maxmeta,equality = + build_equality bag head args t newmetas newmeta' + in + equality::acc,bag,maxmeta) + ([],bag,newmeta) saturated + in + (eqs@facts, cache, newmeta) + with FillingFailure (cache,newmeta) -> + (* if filling hypothesis fails we add the equation to + the cache *) + (facts,cache,newmeta) + ) + ([],cache,newmeta) equations + +let close_more tables maxmeta context status auto universe cache = + let (active,passive,bag) = tables in + let proof, goalno = status in + let _, metasenv,_subst,_,_, _ = proof in + let signature = MetadataQuery.signature_of metasenv goalno in + let equations = + retrieve_equations false signature universe cache context metasenv + in + let eqs_and_types = + HExtlib.filter_map + (fun t -> + let ty,_ = + CicTypeChecker.type_of_aux' metasenv context t CicUniv.empty_ugraph in + (* retrieve_equations could also return flexible terms *) + if is_an_equality ty then Some(t,ty) else None) + equations in + let units, cache, maxm = + build_equalities auto context metasenv tables universe cache maxmeta eqs_and_types in + debug_print (lazy (">>>>>>> gained from a new context saturation >>>>>>>>>" ^ + string_of_int maxm)); + List.iter + (fun e -> debug_print (lazy (Equality.string_of_equality e))) + units; + debug_print (lazy ">>>>>>>>>>>>>>>>>>>>>>"); + let passive = Saturation.add_to_passive units passive in + let no = List.length units in + debug_print (lazy ("No = " ^ (string_of_int no))); + let active,passive,newmeta = + Saturation.pump_actives context bag maxm active passive (no+1) infinity + in + (active,passive,bag),cache,newmeta + +let find_context_equalities + maxmeta bag context proof (universe:Universe.universe) cache += + let module C = Cic in + let module S = CicSubstitution in + let module T = CicTypeChecker in + let _,metasenv,_subst,_,_, _ = proof in + let newmeta = max (ProofEngineHelpers.new_meta_of_proof ~proof) maxmeta in + (* if use_auto is true, we try to close the hypothesis of equational + statements using auto; a naif, and probably wrong approach *) + let rec aux cache index newmeta = function + | [] -> [], newmeta,cache + | (Some (_, C.Decl (term)))::tl -> + debug_print + (lazy + (Printf.sprintf "Examining: %d (%s)" index (CicPp.ppterm term))); + let do_find context term = + match term with + | C.Prod (name, s, t) when is_an_equality t -> + (try + + let term = S.lift index term in + let saturated,cache,newmeta = + fill_hypothesis context metasenv newmeta term + empty_tables universe cache default_auto false + in + let eqs,newmeta = + List.fold_left + (fun (acc,newmeta) (args,metasenv,newmetas,head,newmeta') -> + let newmeta, equality = + build_equality + bag head args (Cic.Rel index) newmetas (max newmeta newmeta') + in + equality::acc, newmeta + 1) + ([],newmeta) saturated + in + eqs, newmeta, cache + with FillingFailure (cache,newmeta) -> + [],newmeta,cache) + | C.Appl [C.MutInd (uri, _, _); ty; t1; t2] + when LibraryObjects.is_eq_URI uri -> + let term = S.lift index term in + let newmeta, e = + build_equality bag term [] (Cic.Rel index) [] newmeta + in + [e], (newmeta+1),cache + | _ -> [], newmeta, cache + in + let eqs, newmeta, cache = do_find context term in + let rest, newmeta,cache = aux cache (index+1) newmeta tl in + List.map (fun x -> index,x) eqs @ rest, newmeta, cache + | _::tl -> + aux cache (index+1) newmeta tl + in + let il, maxm, cache = + aux cache 1 newmeta context + in + let indexes, equalities = List.split il in + indexes, equalities, maxm, cache +;; + +(***************** applyS *******************) + +let new_metasenv_and_unify_and_t + dbd flags universe proof goal ?tables newmeta' metasenv' + context term' ty termty goal_arity += + let (consthead,newmetasenv,arguments,_) = + TermUtil.saturate_term newmeta' metasenv' context termty goal_arity in + let term'' = + match arguments with [] -> term' | _ -> Cic.Appl (term'::arguments) + in + let proof',oldmetasenv = + let (puri,metasenv,_subst,pbo,pty, attrs) = proof in + (puri,newmetasenv,_subst,pbo,pty, attrs),metasenv + in + let goal_for_paramod = + match LibraryObjects.eq_URI () with + | Some uri -> + Cic.Appl [Cic.MutInd (uri,0,[]); Cic.Sort Cic.Prop; consthead; ty] + | None -> raise (ProofEngineTypes.Fail (lazy "No equality defined")) + in + let newmeta = CicMkImplicit.new_meta newmetasenv (*subst*) [] in + let metasenv_for_paramod = (newmeta,context,goal_for_paramod)::newmetasenv in + let proof'' = + let uri,_,_subst,p,ty, attrs = proof' in + uri,metasenv_for_paramod,_subst,p,ty, attrs + in + let irl = CicMkImplicit.identity_relocation_list_for_metavariable context in + let proof''',goals = + ProofEngineTypes.apply_tactic + (EqualityTactics.rewrite_tac ~direction:`RightToLeft + ~pattern:(ProofEngineTypes.conclusion_pattern None) + (Cic.Meta(newmeta,irl)) []) + (proof'',goal) + in + let goal = match goals with [g] -> g | _ -> assert false in + let proof'''', _ = + ProofEngineTypes.apply_tactic + (PrimitiveTactics.apply_tac term'') + (proof''',goal) + in + match + let (active, passive,bag), cache, maxmeta = + init_cache_and_tables ~dbd flags.use_library true true false universe + (proof'''',newmeta) + in + Saturation.given_clause bag maxmeta (proof'''',newmeta) active passive + max_int max_int flags.timeout + with + | None, _,_,_ -> + raise (ProofEngineTypes.Fail (lazy ("FIXME: propaga le tabelle"))) + | Some (_,proof''''',_), active,passive,_ -> + proof''''', + ProofEngineHelpers.compare_metasenvs ~oldmetasenv + ~newmetasenv:(let _,m,_subst,_,_, _ = proof''''' in m), active, passive +;; + +let rec count_prods context ty = + match CicReduction.whd context ty with + Cic.Prod (n,s,t) -> 1 + count_prods (Some (n,Cic.Decl s)::context) t + | _ -> 0 + +let apply_smart ~dbd ~term ~subst ~universe ?tables flags (proof, goal) = + let module T = CicTypeChecker in + let module R = CicReduction in + let module C = Cic in + let (_,metasenv,_subst,_,_, _) = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let newmeta = CicMkImplicit.new_meta metasenv subst in + let exp_named_subst_diff,newmeta',newmetasenvfragment,term' = + match term with + C.Var (uri,exp_named_subst) -> + let newmeta',newmetasenvfragment,exp_named_subst',exp_named_subst_diff = + PrimitiveTactics.generalize_exp_named_subst_with_fresh_metas context newmeta uri + exp_named_subst + in + exp_named_subst_diff,newmeta',newmetasenvfragment, + C.Var (uri,exp_named_subst') + | C.Const (uri,exp_named_subst) -> + let newmeta',newmetasenvfragment,exp_named_subst',exp_named_subst_diff = + PrimitiveTactics.generalize_exp_named_subst_with_fresh_metas context newmeta uri + exp_named_subst + in + exp_named_subst_diff,newmeta',newmetasenvfragment, + C.Const (uri,exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let newmeta',newmetasenvfragment,exp_named_subst',exp_named_subst_diff = + PrimitiveTactics.generalize_exp_named_subst_with_fresh_metas context newmeta uri + exp_named_subst + in + exp_named_subst_diff,newmeta',newmetasenvfragment, + C.MutInd (uri,tyno,exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let newmeta',newmetasenvfragment,exp_named_subst',exp_named_subst_diff = + PrimitiveTactics.generalize_exp_named_subst_with_fresh_metas context newmeta uri + exp_named_subst + in + exp_named_subst_diff,newmeta',newmetasenvfragment, + C.MutConstruct (uri,tyno,consno,exp_named_subst') + | _ -> [],newmeta,[],term + in + let metasenv' = metasenv@newmetasenvfragment in + let termty,_ = + CicTypeChecker.type_of_aux' metasenv' context term' CicUniv.empty_ugraph + in + let termty = CicSubstitution.subst_vars exp_named_subst_diff termty in + let goal_arity = count_prods context ty in + let proof, gl, active, passive = + new_metasenv_and_unify_and_t dbd flags universe proof goal ?tables + newmeta' metasenv' context term' ty termty goal_arity + in + proof, gl, active, passive +;; + +(****************** AUTO ********************) + +let mk_irl ctx = CicMkImplicit.identity_relocation_list_for_metavariable ctx;; +let ugraph = CicUniv.empty_ugraph;; +let typeof = CicTypeChecker.type_of_aux';; +let ppterm ctx t = + let names = List.map (function None -> None | Some (x,_) -> Some x) ctx in + CicPp.pp t names +;; +let is_in_prop context subst metasenv ty = + let sort,u = typeof ~subst metasenv context ty CicUniv.empty_ugraph in + fst (CicReduction.are_convertible context sort (Cic.Sort Cic.Prop) u) +;; + +let assert_proof_is_valid proof metasenv context goalty = + if debug then + begin + let ty,u = typeof metasenv context proof CicUniv.empty_ugraph in + let b,_ = CicReduction.are_convertible context ty goalty u in + if not b then + begin + let names = + List.map (function None -> None | Some (x,_) -> Some x) context + in + debug_print (lazy ("PROOF:" ^ CicPp.pp proof names)); + debug_print (lazy ("PROOFTY:" ^ CicPp.pp ty names)); + debug_print (lazy ("GOAL:" ^ CicPp.pp goalty names)); + debug_print (lazy ("MENV:" ^ CicMetaSubst.ppmetasenv [] metasenv)); + end; + assert b + end + else () +;; + +let assert_subst_are_disjoint subst subst' = + if debug then + assert(List.for_all + (fun (i,_) -> List.for_all (fun (j,_) -> i<>j) subst') + subst) + else () +;; + +let split_goals_in_prop metasenv subst gl = + List.partition + (fun g -> + let _,context,ty = CicUtil.lookup_meta g metasenv in + try + let sort,u = typeof ~subst metasenv context ty ugraph in + let b,_ = + CicReduction.are_convertible + ~subst ~metasenv context sort (Cic.Sort Cic.Prop) u in + b + with + | CicTypeChecker.AssertFailure s + | CicTypeChecker.TypeCheckerFailure s -> + debug_print + (lazy ("NON TIPA" ^ ppterm context (CicMetaSubst.apply_subst subst ty))); + debug_print s; + false) + (* FIXME... they should type! *) + gl +;; + +let split_goals_with_metas metasenv subst gl = + List.partition + (fun g -> + let _,context,ty = CicUtil.lookup_meta g metasenv in + let ty = CicMetaSubst.apply_subst subst ty in + CicUtil.is_meta_closed ty) + gl +;; + +let order_new_goals metasenv subst open_goals ppterm = + let prop,rest = split_goals_in_prop metasenv subst open_goals in + let closed_prop, open_prop = split_goals_with_metas metasenv subst prop in + let open_goals = + (List.map (fun x -> x,P) (closed_prop @ open_prop)) + @ + (List.map (fun x -> x,T) rest) + in + let tys = + List.map + (fun (i,sort) -> + let _,_,ty = CicUtil.lookup_meta i metasenv in i,ty,sort) open_goals + in + debug_print (lazy (" OPEN: "^ + String.concat "\n" + (List.map + (function + | (i,t,P) -> string_of_int i ^ ":"^ppterm t^ "Prop" + | (i,t,T) -> string_of_int i ^ ":"^ppterm t^ "Type") + tys))); + open_goals +;; + +let is_an_equational_goal = function + | Cic.Appl [Cic.MutInd(u,_,_);_;_;_] when LibraryObjects.is_eq_URI u -> true + | _ -> false +;; + +(* +let prop = function (_,depth,P) -> depth < 9 | _ -> false;; +*) + +let calculate_timeout flags = + if flags.timeout = 0. then + (debug_print (lazy "AUTO WITH NO TIMEOUT"); + {flags with timeout = infinity}) + else + flags +;; +let is_equational_case goalty flags = + let ensure_equational t = + if is_an_equational_goal t then true + else false + (* + let msg="Not an equational goal.\nYou cant use the paramodulation flag"in + raise (ProofEngineTypes.Fail (lazy msg)) + *) + in + (flags.use_paramod && is_an_equational_goal goalty) || + (flags.use_only_paramod && ensure_equational goalty) +;; +(* +let cache_add_success sort cache k v = + if sort = P then cache_add_success cache k v else cache_remove_underinspection + cache k +;; +*) + +type menv = Cic.metasenv +type subst = Cic.substitution +type goal = ProofEngineTypes.goal * int * AutoTypes.sort +let candidate_no = ref 0;; +type candidate = int * Cic.term +type cache = AutoCache.cache +type tables = + Saturation.active_table * Saturation.passive_table * Equality.equality_bag + +type fail = + (* the goal (mainly for depth) and key of the goal *) + goal * AutoCache.cache_key +type op = + (* goal has to be proved *) + | D of goal + (* goal has to be cached as a success obtained using candidate as the first + * step *) + | S of goal * AutoCache.cache_key * candidate * int +type elem = + (* menv, subst, size, operations done (only S), operations to do, failures to cache if any op fails *) + menv * subst * int * op list * op list * fail list +type status = + (* list of computations that may lead to the solution: all op list will + * end with the same (S(g,_)) *) + elem list +type auto_result = + (* menv, subst, alternatives, tables, cache, maxmeta *) + | Proved of menv * subst * elem list * tables * cache * int + | Gaveup of tables * cache * int + + +(* the status exported to the external observer *) +type auto_status = + (* context, (goal,candidate) list, and_list, history *) + Cic.context * (int * Cic.term * bool * int * (int * Cic.term) list) list * + (int * Cic.term * int) list * Cic.term list + +let d_prefix l = + let rec aux acc = function + | (D g)::tl -> aux (acc@[g]) tl + | _ -> acc + in + aux [] l +;; +let prop_only l = + List.filter (function (_,_,P) -> true | _ -> false) l +;; + +let d_goals l = + let rec aux acc = function + | (D g)::tl -> aux (acc@[g]) tl + | (S _)::tl -> aux acc tl + | [] -> acc + in + aux [] l +;; +let calculate_goal_ty (goalno,_,_) s m = + try + let _,cc,goalty = CicUtil.lookup_meta goalno m in + (* XXX applicare la subst al contesto? *) + Some (cc, CicMetaSubst.apply_subst s goalty) + with CicUtil.Meta_not_found i when i = goalno -> None +;; +let calculate_closed_goal_ty (goalno,_,_) s = + try + let cc,_,goalty = List.assoc goalno s in + (* XXX applicare la subst al contesto? *) + Some (cc, CicMetaSubst.apply_subst s goalty) + with Not_found -> None +;; +let pp_status ctx status = + if debug then + let names = Utils.names_of_context ctx in + let pp x = + let x = + ProofEngineReduction.replace + ~equality:(fun a b -> match b with Cic.Meta _ -> true | _ -> false) + ~what:[Cic.Rel 1] ~with_what:[Cic.Implicit None] ~where:x + in + CicPp.pp x names + in + let string_of_do m s (gi,_,_ as g) d = + match calculate_goal_ty g s m with + | Some (_,gty) -> Printf.sprintf "D(%d, %s, %d)" gi (pp gty) d + | None -> Printf.sprintf "D(%d, _, %d)" gi d + in + let string_of_s m su k (ci,ct) gi = + Printf.sprintf "S(%d, %s, %s, %d)" gi (pp k) (pp ct) ci + in + let string_of_ol m su l = + String.concat " | " + (List.map + (function + | D (g,d,s) -> string_of_do m su (g,d,s) d + | S ((gi,_,_),k,c,_) -> string_of_s m su k c gi) + l) + in + let string_of_fl m s fl = + String.concat " | " + (List.map (fun ((i,_,_),ty) -> + Printf.sprintf "(%d, %s)" i (pp ty)) fl) + in + let rec aux = function + | [] -> () + | (m,s,_,_,ol,fl)::tl -> + Printf.eprintf "< [%s] ;;; [%s]>\n" + (string_of_ol m s ol) (string_of_fl m s fl); + aux tl + in + Printf.eprintf "-------------------------- status -------------------\n"; + aux status; + Printf.eprintf "-----------------------------------------------------\n"; +;; + +let auto_status = ref [] ;; +let auto_context = ref [];; +let in_pause = ref false;; +let pause b = in_pause := b;; +let cond = Condition.create ();; +let mutex = Mutex.create ();; +let hint = ref None;; +let prune_hint = ref [];; + +let step _ = Condition.signal cond;; +let give_hint n = hint := Some n;; +let give_prune_hint hint = + prune_hint := hint :: !prune_hint +;; + +let check_pause _ = + if !in_pause then + begin + Mutex.lock mutex; + Condition.wait cond mutex; + Mutex.unlock mutex + end +;; + +let get_auto_status _ = + let status = !auto_status in + let and_list,elems,last = + match status with + | [] -> [],[],[] + | (m,s,_,don,gl,fail)::tl -> + let and_list = + HExtlib.filter_map + (fun (id,d,_ as g) -> + match calculate_goal_ty g s m with + | Some (_,x) -> Some (id,x,d) | None -> None) + (d_goals gl) + in + let rows = + (* these are the S goalsin the or list *) + let orlist = + List.map + (fun (m,s,_,don,gl,fail) -> + HExtlib.filter_map + (function S (g,k,c,_) -> Some (g,k,c) | _ -> None) + (List.rev don @ gl)) + status + in + (* this function eats id from a list l::[id,x] returning x, l *) + let eat_tail_if_eq id l = + let rec aux (s, l) = function + | [] -> s, l + | ((id1,_,_),k1,c)::tl when id = id1 -> + (match s with + | None -> aux (Some c,l) tl + | Some _ -> assert false) + | ((id1,_,_),k1,c as e)::tl -> aux (s, e::l) tl + in + let c, l = aux (None, []) l in + c, List.rev l + in + let eat_in_parallel id l = + let rec aux (b,eaten, new_l as acc) l = + match l with + | [] -> acc + | l::tl -> + match eat_tail_if_eq id l with + | None, l -> aux (b@[false], eaten, new_l@[l]) tl + | Some t,l -> aux (b@[true],eaten@[t], new_l@[l]) tl + in + aux ([],[],[]) l + in + let rec eat_all rows l = + match l with + | [] -> rows + | elem::or_list -> + match List.rev elem with + | ((to_eat,depth,_),k,_)::next_lunch -> + let b, eaten, l = eat_in_parallel to_eat l in + let eaten = HExtlib.list_uniq eaten in + let eaten = List.rev eaten in + let b = true (* List.hd (List.rev b) *) in + let rows = rows @ [to_eat,k,b,depth,eaten] in + eat_all rows l + | [] -> eat_all rows or_list + in + eat_all [] (List.rev orlist) + in + let history = + HExtlib.filter_map + (function (S (_,_,(_,c),_)) -> Some c | _ -> None) + gl + in +(* let rows = List.filter (fun (_,l) -> l <> []) rows in *) + and_list, rows, history + in + !auto_context, elems, and_list, last +;; + +(* Works if there is no dependency over proofs *) +let is_a_green_cut goalty = + CicUtil.is_meta_closed goalty +;; +let rec first_s = function + | (D _)::tl -> first_s tl + | (S (g,k,c,s))::tl -> Some ((g,k,c,s),tl) + | [] -> None +;; +let list_union l1 l2 = + (* TODO ottimizzare compare *) + HExtlib.list_uniq (List.sort compare (l1 @ l1)) +;; +let eat_head todo id fl orlist = + let rec aux acc = function + | [] -> [], acc + | (m, s, _, _, todo1, fl1)::tl as orlist -> + let rec aux1 todo1 = + match first_s todo1 with + | None -> orlist, acc + | Some (((gno,_,_),_,_,_), todo11) -> + (* TODO confronto tra todo da ottimizzare *) + if gno = id && todo11 = todo then + aux (list_union fl1 acc) tl + else + aux1 todo11 + in + aux1 todo1 + in + aux fl orlist +;; +let close_proof p ty menv context = + let metas = + List.map fst (CicUtil.metas_of_term p @ CicUtil.metas_of_term ty) + in + let menv = List.filter (fun (i,_,_) -> List.exists ((=)i) metas) menv in + naif_closure p menv context +;; +(* XXX capire bene quando aggiungere alla cache *) +let add_to_cache_and_del_from_orlist_if_green_cut + g s m cache key todo orlist fl ctx size minsize += + let cache = cache_remove_underinspection cache key in + (* prima per fare la irl usavamo il contesto vero e proprio e non quello + * canonico! XXX *) + match calculate_closed_goal_ty g s with + | None -> assert false + | Some (canonical_ctx , gty) -> + let goalno,depth,sort = g in + let irl = mk_irl canonical_ctx in + let goal = Cic.Meta(goalno, irl) in + let proof = CicMetaSubst.apply_subst s goal in + let green_proof, closed_proof = + let b = is_a_green_cut proof in + if not b then + b, (* close_proof proof gty m ctx *) proof + else + b, proof + in + debug_print (lazy ("TENTATIVE CACHE: " ^ CicPp.ppterm key)); + if is_a_green_cut key then + (* if the initia goal was closed, we cut alternatives *) + let _ = debug_print (lazy ("MANGIO: " ^ string_of_int goalno)) in + let orlist, fl = eat_head todo goalno fl orlist in + let cache = + if size < minsize then + (debug_print (lazy ("NO CACHE: 2 (size <= minsize)"));cache) + else + (* if the proof is closed we cache it *) + if green_proof then cache_add_success cache key proof + else (* cache_add_success cache key closed_proof *) + (debug_print (lazy ("NO CACHE: (no gree proof)"));cache) + in + cache, orlist, fl, true + else + let cache = + debug_print (lazy ("TENTATIVE CACHE: " ^ CicPp.ppterm gty)); + if size < minsize then + (debug_print (lazy ("NO CACHE: (size <= minsize)")); cache) else + (* if the substituted goal and the proof are closed we cache it *) + if is_a_green_cut gty then + if green_proof then cache_add_success cache gty proof + else (* cache_add_success cache gty closed_proof *) + (debug_print (lazy ("NO CACHE: (no green proof (gty))"));cache) + else (* + try + let ty, _ = + CicTypeChecker.type_of_aux' ~subst:s + m ctx closed_proof CicUniv.oblivion_ugraph + in + if is_a_green_cut ty then + cache_add_success cache ty closed_proof + else cache + with + | CicTypeChecker.TypeCheckerFailure _ ->*) + (debug_print (lazy ("NO CACHE: (no green gty )"));cache) + in + cache, orlist, fl, false +;; +let close_failures (fl : fail list) (cache : cache) = + List.fold_left + (fun cache ((gno,depth,_),gty) -> + debug_print (lazy ("FAIL: INDUCED: " ^ string_of_int gno)); + cache_add_failure cache gty depth) + cache fl +;; +let put_in_subst subst metasenv (goalno,_,_) canonical_ctx t ty = + let entry = goalno, (canonical_ctx, t,ty) in + assert_subst_are_disjoint subst [entry]; + let subst = entry :: subst in + let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in + subst, metasenv +;; +let mk_fake_proof metasenv subst (goalno,_,_) goalty context = + None,metasenv,subst ,Cic.Meta(goalno,mk_irl context),goalty, [] +;; +let equational_case + tables maxm cache depth fake_proof goalno goalty subst context + flags += + let active,passive,bag = tables in + let ppterm = ppterm context in + let status = (fake_proof,goalno) in + if flags.use_only_paramod then + begin + debug_print (lazy ("PARAMODULATION SU: " ^ + string_of_int goalno ^ " " ^ ppterm goalty )); + let goal_steps, saturation_steps, timeout = + max_int,max_int,flags.timeout + in + match + Saturation.given_clause bag maxm status active passive + goal_steps saturation_steps timeout + with + | None, active, passive, maxmeta -> + [], (active,passive,bag), cache, maxmeta, flags + | Some(subst',(_,metasenv,_subst,proof,_, _),open_goals),active, + passive,maxmeta -> + assert_subst_are_disjoint subst subst'; + let subst = subst@subst' in + let open_goals = + order_new_goals metasenv subst open_goals ppterm + in + let open_goals = + List.map (fun (x,sort) -> x,depth-1,sort) open_goals + in + incr candidate_no; + [(!candidate_no,proof),metasenv,subst,open_goals], + (active,passive,bag), + cache, maxmeta, flags + end + else + begin + debug_print + (lazy + ("SUBSUMPTION SU: " ^ string_of_int goalno ^ " " ^ ppterm goalty)); + let res, maxmeta = + Saturation.all_subsumed bag maxm status active passive + in + assert (maxmeta >= maxm); + let res' = + List.map + (fun (subst',(_,metasenv,_subst,proof,_, _),open_goals) -> + assert_subst_are_disjoint subst subst'; + let subst = subst@subst' in + let open_goals = + order_new_goals metasenv subst open_goals ppterm + in + let open_goals = + List.map (fun (x,sort) -> x,depth-1,sort) open_goals + in + incr candidate_no; + (!candidate_no,proof),metasenv,subst,open_goals) + res + in + res', (active,passive,bag), cache, maxmeta, flags + end +;; + +let try_candidate + goalty tables maxm subst fake_proof goalno depth context cand += + let ppterm = ppterm context in + try + let subst,((_,metasenv,_,_,_,_), open_goals),maxmeta = + (PrimitiveTactics.apply_with_subst ~subst ~maxmeta:maxm ~term:cand) + (fake_proof,goalno) + in + debug_print (lazy (" OK: " ^ ppterm cand)); + let metasenv = CicRefine.pack_coercion_metasenv metasenv in + let open_goals = order_new_goals metasenv subst open_goals ppterm in + let open_goals = List.map (fun (x,sort) -> x,depth-1,sort) open_goals in + incr candidate_no; + Some ((!candidate_no,cand),metasenv,subst,open_goals), tables , maxmeta + with + | ProofEngineTypes.Fail s -> None,tables, maxm + | CicUnification.Uncertain s -> None,tables, maxm +;; + +let sort_new_elems = + List.sort (fun (_,_,_,l1) (_,_,_,l2) -> + List.length (prop_only l1) - List.length (prop_only l2)) +;; + +let applicative_case + tables maxm depth subst fake_proof goalno goalty metasenv context universe + cache += + let candidates = get_candidates universe cache goalty in + let tables, elems, maxm = + List.fold_left + (fun (tables,elems,maxm) cand -> + match + try_candidate goalty + tables maxm subst fake_proof goalno depth context cand + with + | None, tables,maxm -> tables,elems, maxm + | Some x, tables, maxm -> tables,x::elems, maxm) + (tables,[],maxm) candidates + in + let elems = sort_new_elems elems in + elems, tables, cache, maxm +;; + +let equational_and_applicative_case + universe flags m s g gty tables cache maxm context += + let goalno, depth, sort = g in + let fake_proof = mk_fake_proof m s g gty context in + if is_equational_case gty flags then + let elems,tables,cache,maxm1, flags = + equational_case tables maxm cache + depth fake_proof goalno gty s context flags + in + let maxm = maxm1 in + let more_elems, tables, cache, maxm1 = + if flags.use_only_paramod then + [],tables, cache, maxm + else + applicative_case + tables maxm depth s fake_proof goalno + gty m context universe cache + in + let maxm = maxm1 in + elems@more_elems, tables, cache, maxm, flags + else + let elems, tables, cache, maxm = + applicative_case tables maxm depth s fake_proof goalno + gty m context universe cache + in + elems, tables, cache, maxm, flags +;; +let rec condition_for_hint i = function + | [] -> false + | S (_,_,(j,_),_):: tl -> j <> i (* && condition_for_hint i tl *) + | _::tl -> condition_for_hint i tl +;; +let remove_s_from_fl (id,_,_) (fl : fail list) = + let rec aux = function + | [] -> [] + | ((id1,_,_),_)::tl when id = id1 -> tl + | hd::tl -> hd :: aux tl + in + aux fl +;; + +let prunable_for_size flags s m todo = + let rec aux b = function + | (S _)::tl -> aux b tl + | (D (_,_,T))::tl -> aux b tl + | (D g)::tl -> + (match calculate_goal_ty g s m with + | None -> aux b tl + | Some (canonical_ctx, gty) -> + let gsize, _ = + Utils.weight_of_term + ~consider_metas:false ~count_metas_occurrences:true gty in + let newb = b || gsize > flags.maxgoalsizefactor in + aux newb tl) + | [] -> b + in + aux false todo + +(* +let prunable ty todo = + let rec aux b = function + | (S(_,k,_,_))::tl -> aux (b || Equality.meta_convertibility k ty) tl + | (D (_,_,T))::tl -> aux b tl + | D _::_ -> false + | [] -> b + in + aux false todo +;; +*) + +let prunable menv subst ty todo = + let rec aux = function + | (S(_,k,_,_))::tl -> + (match Equality.meta_convertibility_subst k ty menv with + | None -> aux tl + | Some variant -> + no_progress variant tl (* || aux tl*)) + | (D (_,_,T))::tl -> aux tl + | _ -> false + and no_progress variant = function + | [] -> (*prerr_endline "++++++++++++++++++++++++ no_progress";*) true + | D ((n,_,P) as g)::tl -> + (match calculate_goal_ty g subst menv with + | None -> no_progress variant tl + | Some (_, gty) -> + (match calculate_goal_ty g variant menv with + | None -> assert false + | Some (_, gty') -> + if gty = gty' then + no_progress variant tl + else false)) + | _::tl -> no_progress variant tl + in + aux todo + +;; +let condition_for_prune_hint prune (m, s, size, don, todo, fl) = + let s = + HExtlib.filter_map (function S (_,_,(c,_),_) -> Some c | _ -> None) todo + in + List.for_all (fun i -> List.for_all (fun j -> i<>j) prune) s +;; +let filter_prune_hint l = + let prune = !prune_hint in + prune_hint := []; (* possible race... *) + if prune = [] then l + else List.filter (condition_for_prune_hint prune) l +;; +let auto_main tables maxm context flags universe cache elems = + auto_context := context; + let rec aux tables maxm flags cache (elems : status) = +(* pp_status context elems; *) +(* DEBUGGING CODE: uncomment these two lines to stop execution at each iteration + auto_status := elems; + check_pause (); +*) + let elems = filter_prune_hint elems in + match elems with + | (m, s, size, don, todo, fl)::orlist when !hint <> None -> + (match !hint with + | Some i when condition_for_hint i todo -> + aux tables maxm flags cache orlist + | _ -> + hint := None; + aux tables maxm flags cache elems) + | [] -> + (* complete failure *) + Gaveup (tables, cache, maxm) + | (m, s, _, _, [],_)::orlist -> + (* complete success *) + Proved (m, s, orlist, tables, cache, maxm) + | (m, s, size, don, (D (_,_,T))::todo, fl)::orlist + when not flags.AutoTypes.do_types -> + (* skip since not Prop, don't even check if closed by side-effect *) + aux tables maxm flags cache ((m, s, size, don, todo, fl)::orlist) + | (m, s, size, don, (S(g, key, c,minsize) as op)::todo, fl)::orlist -> + (* partial success, cache g and go on *) + let cache, orlist, fl, sibling_pruned = + add_to_cache_and_del_from_orlist_if_green_cut + g s m cache key todo orlist fl context size minsize + in + debug_print (lazy (AutoCache.cache_print context cache)); + let fl = remove_s_from_fl g fl in + let don = if sibling_pruned then don else op::don in + aux tables maxm flags cache ((m, s, size, don, todo, fl)::orlist) + | (m, s, size, don, todo, fl)::orlist + when List.length(prop_only (d_goals todo)) > flags.maxwidth -> + debug_print (lazy ("FAIL: WIDTH")); + (* too many goals in and generated by last th *) + let cache = close_failures fl cache in + aux tables maxm flags cache orlist + | (m, s, size, don, todo, fl)::orlist when size > flags.maxsize -> + debug_print + (lazy ("FAIL: SIZE: "^string_of_int size ^ + " > " ^ string_of_int flags.maxsize )); + (* we already have a too large proof term *) + let cache = close_failures fl cache in + aux tables maxm flags cache orlist + | _ when Unix.gettimeofday () > flags.timeout -> + (* timeout *) + debug_print (lazy ("FAIL: TIMEOUT")); + Gaveup (tables, cache, maxm) + | (m, s, size, don, (D (gno,depth,_ as g))::todo, fl)::orlist as status -> + (* attack g *) + match calculate_goal_ty g s m with + | None -> + (* closed by side effect *) + debug_print (lazy ("SUCCESS: SIDE EFFECT: " ^ string_of_int gno)); + aux tables maxm flags cache ((m,s,size,don,todo, fl)::orlist) + | Some (canonical_ctx, gty) -> + let gsize, _ = + Utils.weight_of_term ~consider_metas:false ~count_metas_occurrences:true gty + in + if gsize > flags.maxgoalsizefactor then + (debug_print (lazy ("FAIL: SIZE: goal: "^string_of_int gsize)); + aux tables maxm flags cache orlist) + else if prunable_for_size flags s m todo then + (debug_print (lazy ("POTO at depth: "^(string_of_int depth))); + aux tables maxm flags cache orlist) + else + (* still to be proved *) + (debug_print (lazy ("EXAMINE: "^CicPp.ppterm gty)); + match cache_examine cache gty with + | Failed_in d when d >= depth -> + (* fail depth *) + debug_print (lazy ("FAIL: DEPTH (cache): "^string_of_int gno)); + let cache = close_failures fl cache in + aux tables maxm flags cache orlist + | UnderInspection -> + (* fail loop *) + debug_print (lazy ("FAIL: LOOP: " ^ string_of_int gno)); + let cache = close_failures fl cache in + aux tables maxm flags cache orlist + | Succeded t -> + debug_print (lazy ("SUCCESS: CACHE HIT: " ^ string_of_int gno)); + let s, m = put_in_subst s m g canonical_ctx t gty in + aux tables maxm flags cache ((m, s, size, don,todo, fl)::orlist) + | Notfound + | Failed_in _ when depth > 0 -> + ( (* more depth or is the first time we see the goal *) + if prunable m s gty todo then + (debug_print (lazy( + "FAIL: LOOP: one father is equal")); + aux tables maxm flags cache orlist) + else + let cache = cache_add_underinspection cache gty depth in + auto_status := status; + check_pause (); + debug_print + (lazy ("INSPECTING: " ^ + string_of_int gno ^ "("^ string_of_int size ^ "): "^ + CicPp.ppterm gty)); + (* elems are possible computations for proving gty *) + let elems, tables, cache, maxm, flags = + equational_and_applicative_case + universe flags m s g gty tables cache maxm context + in + if elems = [] then + (* this goal has failed *) + let cache = close_failures ((g,gty)::fl) cache in + aux tables maxm flags cache orlist + else + (* elems = (cand,m,s,gl) *) + let size_gl l = List.length + (List.filter (function (_,_,P) -> true | _ -> false) l) + in + let elems = + let inj_gl gl = List.map (fun g -> D g) gl in + let rec map = function + | [] -> assert false + | (cand,m,s,gl)::[] -> + (* in the last one we add the failure *) + let todo = + inj_gl gl @ (S(g,gty,cand,size+1))::todo + in + (* we are the last in OR, we fail on g and + * also on all failures implied by g *) + (m,s, size + size_gl gl, don, todo, (g,gty)::fl) + :: orlist + | (cand,m,s,gl)::tl -> + (* we add the S step after gl and before todo *) + let todo = + inj_gl gl @ (S(g,gty,cand,size+1))::todo + in + (* since we are not the last in OR, we do not + * imply failures *) + (m,s, size + size_gl gl, don, todo, []) :: map tl + in + map elems + in + aux tables maxm flags cache elems) + | _ -> + (* no more depth *) + debug_print (lazy ("FAIL: DEPTH: " ^ string_of_int gno)); + let cache = close_failures fl cache in + aux tables maxm flags cache orlist) + in + (aux tables maxm flags cache elems : auto_result) +;; + + +let + auto_all_solutions maxm tables universe cache context metasenv gl flags += + let goals = order_new_goals metasenv [] gl CicPp.ppterm in + let goals = + List.map + (fun (x,s) -> D (x,flags.maxdepth,s)) goals + in + let elems = [metasenv,[],1,[],goals,[]] in + let rec aux tables maxm solutions cache elems flags = + match auto_main tables maxm context flags universe cache elems with + | Gaveup (tables,cache,maxm) -> + solutions,cache,maxm + | Proved (metasenv,subst,others,tables,cache,maxm) -> + if Unix.gettimeofday () > flags.timeout then + ((subst,metasenv)::solutions), cache, maxm + else + aux tables maxm ((subst,metasenv)::solutions) cache others flags + in + let rc = aux tables maxm [] cache elems flags in + match rc with + | [],cache,maxm -> [],cache,maxm + | solutions,cache,maxm -> + let solutions = + HExtlib.filter_map + (fun (subst,newmetasenv) -> + let opened = + ProofEngineHelpers.compare_metasenvs ~oldmetasenv:metasenv ~newmetasenv + in + if opened = [] then Some subst else None) + solutions + in + solutions,cache,maxm +;; + +(* }}} ****************** AUTO ***************) + +let auto flags metasenv tables universe cache context metasenv gl = + let initial_time = Unix.gettimeofday() in + let goals = order_new_goals metasenv [] gl CicPp.ppterm in + let goals = List.map (fun (x,s) -> D(x,flags.maxdepth,s)) goals in + let elems = [metasenv,[],1,[],goals,[]] in + match auto_main tables 0 context flags universe cache elems with + | Proved (metasenv,subst,_, tables,cache,_) -> + debug_print(lazy + ("TIME:"^string_of_float(Unix.gettimeofday()-.initial_time))); + Some (subst,metasenv), cache + | Gaveup (tables,cache,maxm) -> + debug_print(lazy + ("TIME:"^string_of_float(Unix.gettimeofday()-.initial_time))); + None,cache +;; + +let bool params name default = + try + let s = List.assoc name params in + if s = "" || s = "1" || s = "true" || s = "yes" || s = "on" then true + else if s = "0" || s = "false" || s = "no" || s= "off" then false + else + let msg = "Unrecognized value for parameter "^name^"\n" in + let msg = msg^"Accepted values are 1,true,yes,on and 0,false,no,off" in + raise (ProofEngineTypes.Fail (lazy msg)) + with Not_found -> default +;; + +let string params name default = + try List.assoc name params with + | Not_found -> default +;; + +let int params name default = + try int_of_string (List.assoc name params) with + | Not_found -> default + | Failure _ -> + raise (ProofEngineTypes.Fail (lazy (name ^ " must be an integer"))) +;; + +let flags_of_params params ?(for_applyS=false) () = + let int = int params in + let bool = bool params in + let close_more = bool "close_more" false in + let use_paramod = bool "use_paramod" true in + let use_only_paramod = + if for_applyS then true else bool "paramodulation" false in + let use_library = bool "library" + ((AutoTypes.default_flags()).AutoTypes.use_library) in + let depth = int "depth" ((AutoTypes.default_flags()).AutoTypes.maxdepth) in + let width = int "width" ((AutoTypes.default_flags()).AutoTypes.maxwidth) in + let size = int "size" ((AutoTypes.default_flags()).AutoTypes.maxsize) in + let gsize = int "gsize" ((AutoTypes.default_flags()).AutoTypes.maxgoalsizefactor) in + let do_type = bool "type" false in + let timeout = int "timeout" 0 in + { AutoTypes.maxdepth = + if use_only_paramod then 2 else depth; + AutoTypes.maxwidth = width; + AutoTypes.maxsize = size; + AutoTypes.timeout = + if timeout = 0 then + if for_applyS then Unix.gettimeofday () +. 30.0 + else + infinity + else + Unix.gettimeofday() +. (float_of_int timeout); + AutoTypes.use_library = use_library; + AutoTypes.use_paramod = use_paramod; + AutoTypes.use_only_paramod = use_only_paramod; + AutoTypes.close_more = close_more; + AutoTypes.dont_cache_failures = false; + AutoTypes.maxgoalsizefactor = gsize; + AutoTypes.do_types = do_type; + } + +let applyS_tac ~dbd ~term ~params ~universe = + ProofEngineTypes.mk_tactic + (fun status -> + try + let proof, gl,_,_ = + apply_smart ~dbd ~term ~subst:[] ~universe + (flags_of_params params ~for_applyS:true ()) status + in + proof, gl + with + | CicUnification.UnificationFailure msg + | CicTypeChecker.TypeCheckerFailure msg -> + raise (ProofEngineTypes.Fail msg)) + +(* SUPERPOSITION *) + +(* Syntax: + * auto superposition target = NAME + * [table = NAME_LIST] [demod_table = NAME_LIST] [subterms_only] + * + * - if table is omitted no superposition will be performed + * - if demod_table is omitted no demodulation will be prformed + * - subterms_only is passed to Indexing.superposition_right + * + * lists are coded using _ (example: H_H1_H2) + *) + +let eq_and_ty_of_goal = function + | Cic.Appl [Cic.MutInd(uri,0,_);t;_;_] when LibraryObjects.is_eq_URI uri -> + uri,t + | _ -> raise (ProofEngineTypes.Fail (lazy ("The goal is not an equality "))) +;; + +let rec find_in_ctx i name = function + | [] -> raise (ProofEngineTypes.Fail (lazy ("Hypothesis not found: " ^ name))) + | Some (Cic.Name name', _)::tl when name = name' -> i + | _::tl -> find_in_ctx (i+1) name tl +;; + +let rec position_of i x = function + | [] -> assert false + | j::tl when j <> x -> position_of (i+1) x tl + | _ -> i +;; + + +let superposition_tac ~target ~table ~subterms_only ~demod_table status = + Saturation.reset_refs(); + let proof,goalno = status in + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goalno metasenv in + let eq_uri,tty = eq_and_ty_of_goal ty in + let env = (metasenv, context, CicUniv.empty_ugraph) in + let names = Utils.names_of_context context in + let bag = Equality.mk_equality_bag () in + let eq_index, equalities, maxm,cache = + find_context_equalities 0 bag context proof Universe.empty AutoCache.cache_empty + in + let eq_what = + let what = find_in_ctx 1 target context in + List.nth equalities (position_of 0 what eq_index) + in + let eq_other = + if table <> "" then + let other = + let others = Str.split (Str.regexp "_") table in + List.map (fun other -> find_in_ctx 1 other context) others + in + List.map + (fun other -> List.nth equalities (position_of 0 other eq_index)) + other + else + [] + in + let index = List.fold_left Indexing.index Indexing.empty eq_other in + let maxm, eql = + if table = "" then maxm,[eq_what] else + Indexing.superposition_right bag + ~subterms_only eq_uri maxm env index eq_what + in + debug_print (lazy ("Superposition right:")); + debug_print (lazy ("\n eq: " ^ Equality.string_of_equality eq_what ~env)); + debug_print (lazy ("\n table: ")); + List.iter + (fun e -> + debug_print (lazy (" " ^ Equality.string_of_equality e ~env))) eq_other; + debug_print (lazy ("\n result: ")); + List.iter (fun e -> debug_print (lazy (Equality.string_of_equality e ~env))) eql; + debug_print (lazy ("\n result (cut&paste): ")); + List.iter + (fun e -> + let t = Equality.term_of_equality eq_uri e in + debug_print (lazy (CicPp.pp t names))) + eql; + debug_print (lazy ("\n result proofs: ")); + List.iter (fun e -> + debug_print (lazy (let _,p,_,_,_ = Equality.open_equality e in + let s = match p with Equality.Exact _ -> Subst.empty_subst | Equality.Step (s,_) -> s in + Subst.ppsubst s ^ "\n" ^ + CicPp.pp (Equality.build_proof_term bag eq_uri [] 0 p) names))) eql; + if demod_table <> "" then + begin + let eql = + if eql = [] then [eq_what] else eql + in + let demod = + let demod = Str.split (Str.regexp "_") demod_table in + List.map (fun other -> find_in_ctx 1 other context) demod + in + let eq_demod = + List.map + (fun demod -> List.nth equalities (position_of 0 demod eq_index)) + demod + in + let table = List.fold_left Indexing.index Indexing.empty eq_demod in + let maxm,eql = + List.fold_left + (fun (maxm,acc) e -> + let maxm,eq = + Indexing.demodulation_equality bag eq_uri maxm env table e + in + maxm,eq::acc) + (maxm,[]) eql + in + let eql = List.rev eql in + debug_print (lazy ("\n result [demod]: ")); + List.iter + (fun e -> debug_print (lazy (Equality.string_of_equality e ~env))) eql; + debug_print (lazy ("\n result [demod] (cut&paste): ")); + List.iter + (fun e -> + let t = Equality.term_of_equality eq_uri e in + debug_print (lazy (CicPp.pp t names))) + eql; + end; + proof,[goalno] +;; + +let auto_tac ~(dbd:HSql.dbd) ~params ~universe (proof, goal) = + (* argument parsing *) + let string = string params in + let bool = bool params in + (* hacks to debug paramod *) + let superposition = bool "superposition" false in + let target = string "target" "" in + let table = string "table" "" in + let subterms_only = bool "subterms_only" false in + let demod_table = string "demod_table" "" in + match superposition with + | true -> + (* this is the ugly hack to debug paramod *) + superposition_tac + ~target ~table ~subterms_only ~demod_table (proof,goal) + | false -> + (* this is the real auto *) + let _,metasenv,_subst,_,_, _ = proof in + let _,context,goalty = CicUtil.lookup_meta goal metasenv in + let flags = flags_of_params params () in + (* just for testing *) + let use_library = flags.use_library in + let tables,cache,newmeta = + init_cache_and_tables ~dbd use_library flags.use_only_paramod true + false universe (proof, goal) in + let tables,cache,newmeta = + if flags.close_more then + close_more + tables newmeta context (proof, goal) + auto_all_solutions universe cache + else tables,cache,newmeta in + let initial_time = Unix.gettimeofday() in + let (_,oldmetasenv,_subst,_,_, _) = proof in + hint := None; + let elem = + metasenv,[],1,[],[D (goal,flags.maxdepth,P)],[] + in + match auto_main tables newmeta context flags universe cache [elem] with + | Proved (metasenv,subst,_, tables,cache,_) -> + (*prerr_endline + ("TIME:"^string_of_float(Unix.gettimeofday()-.initial_time));*) + let proof,metasenv = + ProofEngineHelpers.subst_meta_and_metasenv_in_proof + proof goal subst metasenv + in + let opened = + ProofEngineHelpers.compare_metasenvs ~oldmetasenv + ~newmetasenv:metasenv + in + proof,opened + | Gaveup (tables,cache,maxm) -> + debug_print + (lazy ("TIME:"^ + string_of_float(Unix.gettimeofday()-.initial_time))); + raise (ProofEngineTypes.Fail (lazy "Auto gave up")) +;; + +let auto_tac ~dbd ~params ~universe = + ProofEngineTypes.mk_tactic (auto_tac ~params ~dbd ~universe);; + +let eq_of_goal = function + | Cic.Appl [Cic.MutInd(uri,0,_);_;_;_] when LibraryObjects.is_eq_URI uri -> + uri + | _ -> raise (ProofEngineTypes.Fail (lazy ("The goal is not an equality "))) +;; + +(* performs steps of rewrite with the universe, obtaining if possible + * a trivial goal *) +let solve_rewrite_tac ~universe ?(steps=1) (proof,goal as status)= + let _,metasenv,_subst,_,_,_ = proof in + let _,context,ty = CicUtil.lookup_meta goal metasenv in + let eq_uri = eq_of_goal ty in + let (active,passive,bag), cache, maxm = + (* we take the whole universe (no signature filtering) *) + init_cache_and_tables false true false true universe (proof,goal) + in + let initgoal = [], metasenv, ty in + let table = + let equalities = (Saturation.list_of_passive passive) in + (* we demodulate using both actives passives *) + List.fold_left (fun tbl eq -> Indexing.index tbl eq) (snd active) equalities + in + let env = metasenv,context,CicUniv.empty_ugraph in + match Indexing.solve_demodulating bag env table initgoal steps with + | Some (proof, metasenv, newty) -> + let refl = + match newty with + | Cic.Appl[Cic.MutInd _;eq_ty;left;_] -> + Equality.Exact (Equality.refl_proof eq_uri eq_ty left) + | _ -> assert false + in + let proofterm,_ = + Equality.build_goal_proof + bag eq_uri proof refl newty [] context metasenv + in + ProofEngineTypes.apply_tactic + (PrimitiveTactics.apply_tac ~term:proofterm) status + | None -> + raise + (ProofEngineTypes.Fail (lazy + ("Unable to solve with " ^ string_of_int steps ^ " demodulations"))) +;; +let solve_rewrite_tac ~universe ?steps () = + ProofEngineTypes.mk_tactic (solve_rewrite_tac ~universe ?steps) +;; + +(* DEMODULATE *) +let demodulate_tac ~dbd ~universe (proof,goal)= + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let irl = CicMkImplicit.identity_relocation_list_for_metavariable context in + let initgoal = [], metasenv, ty in + let eq_uri = eq_of_goal ty in + let (active,passive,bag), cache, maxm = + init_cache_and_tables + ~dbd false true true false universe (proof,goal) + in + let equalities = (Saturation.list_of_passive passive) in + (* we demodulate using both actives passives *) + let table = + List.fold_left + (fun tbl eq -> Indexing.index tbl eq) + (snd active) equalities + in + let changed,(newproof,newmetasenv, newty) = + Indexing.demodulation_goal bag + (metasenv,context,CicUniv.empty_ugraph) table initgoal + in + if changed then + begin + let opengoal = Equality.Exact (Cic.Meta(maxm,irl)) in + let proofterm,_ = + Equality.build_goal_proof bag + eq_uri newproof opengoal ty [] context metasenv + in + let extended_metasenv = (maxm,context,newty)::metasenv in + let extended_status = + (curi,extended_metasenv,_subst,pbo,pty, attrs),goal in + let (status,newgoals) = + ProofEngineTypes.apply_tactic + (PrimitiveTactics.apply_tac ~term:proofterm) + extended_status in + (status,maxm::newgoals) + end + else (* if newty = ty then *) + raise (ProofEngineTypes.Fail (lazy "no progress")) + (*else ProofEngineTypes.apply_tactic + (ReductionTactics.simpl_tac + ~pattern:(ProofEngineTypes.conclusion_pattern None)) initialstatus*) +;; + +let demodulate_tac ~dbd ~universe = + ProofEngineTypes.mk_tactic (demodulate_tac ~dbd ~universe);; + +let pp_proofterm = Equality.pp_proofterm;; + +let revision = "$Revision$";; +let size_and_depth context metasenv t = 100, 100 diff --git a/components/tactics/auto.mli b/components/tactics/auto.mli new file mode 100644 index 000000000..a40d00fc5 --- /dev/null +++ b/components/tactics/auto.mli @@ -0,0 +1,72 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* stops at the first solution *) +val auto_tac: + dbd:HSql.dbd -> + params:(string * string) list -> + universe:Universe.universe -> + ProofEngineTypes.tactic + +val applyS_tac: + dbd:HSql.dbd -> + term: Cic.term -> + params:(string * string) list -> + universe:Universe.universe -> + ProofEngineTypes.tactic + +val demodulate_tac : + dbd:HSql.dbd -> + universe:Universe.universe -> + ProofEngineTypes.tactic + +val solve_rewrite_tac: + universe:Universe.universe -> + ?steps:int -> + unit -> + ProofEngineTypes.tactic + +type auto_status = + Cic.context * + (* or list: goalno, goaltype, grey, depth, candidates: (goalno, c) *) + (int * Cic.term * bool * int * (int * Cic.term) list) list * + (* and list *) + (int * Cic.term * int) list * + (* last moves *) + Cic.term list + +val get_auto_status : unit -> auto_status +val pause: bool -> unit +val step : unit -> unit +val give_hint : int -> unit +val give_prune_hint : int -> unit + +val lambda_close : + ?prefix_name:string -> Cic.term -> Cic.metasenv -> Cic.context -> Cic.term * + int + +val pp_proofterm: Cic.term -> string +val revision : string (* svn revision *) +val size_and_depth : Cic.context -> Cic.metasenv -> Cic.term -> int * int diff --git a/components/tactics/autoCache.ml b/components/tactics/autoCache.ml new file mode 100644 index 000000000..b12b26c05 --- /dev/null +++ b/components/tactics/autoCache.ml @@ -0,0 +1,151 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type cache_key = Cic.term +type cache_elem = + | Failed_in of int + | Succeded of Cic.term + | UnderInspection + | Notfound +type cache = (Universe.universe * ((cache_key * cache_elem) list));; + +let debug = false;; +let prerr_endline s = + if debug then prerr_endline s else () +;; + +let cache_empty = (Universe.empty,[]);; + +let get_candidates (univ,_) ty = + if Universe.key ty = ty then + Universe.get_candidates univ ty + else + [] +;; + +let index (univ,cache) key term = + Universe.index univ key term,cache +;; + +let index_term_and_unfolded_term (univ,cache) context t ty = + Universe.index_local_term univ context t ty, cache +;; + +let cache_add_list (univ,cache) context terms_and_types = + let univ = + List.fold_left + (fun univ (t,ty) -> + Universe.index_local_term univ context t ty) + univ terms_and_types + in + univ, cache + +let cache_examine (_,oldcache) cache_key = + prerr_endline ("examine : " ^ CicPp.ppterm cache_key); + try List.assoc cache_key oldcache with Not_found -> + prerr_endline "notfound"; + Notfound +;; +let cache_replace (univ,oldcache) key v = + let oldcache = List.filter (fun (i,_) -> i <> key) oldcache in + univ, (key,v)::oldcache +;; +let cache_remove (univ,oldcache) key = + let oldcache = List.filter (fun (i,_) -> i <> key) oldcache in + univ,oldcache +;; +let cache_add_failure cache cache_key depth = + prerr_endline + ("CACHE: ADD FAIL " ^ CicPp.ppterm cache_key ^ + " depth: " ^ string_of_int depth); + match cache_examine cache cache_key with + | Failed_in i when i > depth -> cache + | Notfound + | Failed_in _ + | UnderInspection -> cache_replace cache cache_key (Failed_in depth) + | Succeded t -> cache + (* + prerr_endline (CicPp.ppterm t); + assert false (* if succed it can't fail *) *) +;; +let cache_add_success ((univ,_) as cache) cache_key proof = + let u_key = Universe.key cache_key in + if u_key <> cache_key then + Universe.index univ u_key proof, snd cache + else + univ, + snd + (match cache_examine cache cache_key with + | Failed_in _ -> cache_replace cache cache_key (Succeded proof) + | UnderInspection -> cache_replace cache cache_key (Succeded proof) + | Succeded t -> (* we may decide to keep the smallest proof *) cache + | Notfound -> cache_replace cache cache_key (Succeded proof)) +(* + (if Universe.key cache_key = cache_key then + Universe.index univ cache_key proof + else + univ),snd + (prerr_endline ("CACHE: ADD SUCCESS" ^ CicPp.ppterm cache_key); + match cache_examine cache cache_key with + | Failed_in _ -> cache_replace cache cache_key (Succeded proof) + | UnderInspection -> cache_replace cache cache_key (Succeded proof) + | Succeded t -> (* we may decide to keep the smallest proof *) cache + | Notfound -> cache_replace cache cache_key (Succeded proof)) +;; +*) +let cache_add_underinspection ((univ,oldcache) as cache) cache_key depth = + prerr_endline ("CACHE: ADD INSPECTING" ^ CicPp.ppterm cache_key); + match cache_examine cache cache_key with + | Failed_in i when i < depth -> cache_replace cache cache_key UnderInspection + | Notfound -> univ,(cache_key,UnderInspection)::oldcache + | Failed_in _ + | UnderInspection + | Succeded _ -> assert false (* it must be a new goal *) +;; +let cache_print context (_,oldcache) = + let names = List.map (function None -> None | Some (x,_) -> Some x) context in + String.concat "\n" + (HExtlib.filter_map + (function + | (k,Succeded _) -> Some ("CACHE SUCCESS: " ^ CicPp.pp k names) + | _ -> None) + oldcache) +;; +let cache_remove_underinspection ((univ,oldcache) as cache) cache_key = + prerr_endline ("CACHE: REMOVE INSPECTING" ^ CicPp.ppterm cache_key); + match cache_examine cache cache_key with + | Notfound + | Failed_in _ (* -> assert false *) + | UnderInspection -> cache_remove cache cache_key + | Succeded _ -> cache (* + prerr_endline (CicPp.ppterm cache_key); + assert false (* it must be a new goal *) *) +;; +let cache_size (_,oldcache) = + List.length (List.filter (function (_,Succeded _) -> true | _ -> false) oldcache) +;; +let cache_clean (univ,oldcache) = + univ,List.filter (function (_,Succeded _) -> true | _ -> false) oldcache +;; diff --git a/components/tactics/autoCache.mli b/components/tactics/autoCache.mli new file mode 100644 index 000000000..61c658811 --- /dev/null +++ b/components/tactics/autoCache.mli @@ -0,0 +1,45 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type cache +type cache_key = Cic.term +type cache_elem = + | Failed_in of int + | Succeded of Cic.term + | UnderInspection + | Notfound +val get_candidates: cache -> Cic.term -> Cic.term list +val cache_add_list: + cache -> Cic.context -> (Cic.term*Cic.term) list -> cache +val cache_examine: cache -> cache_key -> cache_elem +val cache_add_failure: cache -> cache_key -> int -> cache +val cache_add_success: cache -> cache_key -> Cic.term -> cache +val cache_add_underinspection: cache -> cache_key -> int -> cache +val cache_remove_underinspection: cache -> cache_key -> cache +val cache_empty: cache +val cache_print: Cic.context -> cache -> string +val cache_size: cache -> int +val cache_clean: cache -> cache + diff --git a/components/tactics/autoTypes.ml b/components/tactics/autoTypes.ml new file mode 100644 index 000000000..874a20dcc --- /dev/null +++ b/components/tactics/autoTypes.ml @@ -0,0 +1,61 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type flags = { + maxwidth: int; + maxsize: int; + maxdepth: int; + maxgoalsizefactor : int; + timeout: float; + use_library: bool; + use_paramod: bool; + use_only_paramod : bool; + close_more : bool; + dont_cache_failures: bool; + do_types: bool; +} + +let default_flags _ = + {maxwidth=3; + maxdepth=3; + maxsize = 6; + maxgoalsizefactor = max_int; + timeout=Unix.gettimeofday() +.3.0; + use_library=false; + use_paramod=true; + use_only_paramod=false; + close_more=false; + dont_cache_failures=false; + do_types=false; +} +;; + +(* (metasenv, subst, (metano,depth)list *) +type sort = P | T;; +type and_elem = (int * Cic.term * Cic.term) * Cic.metasenv * Cic.substitution * (int * int * sort) list +type auto_result = + | Fail of string + | Success of (int * Cic.term * Cic.term) * Cic.metasenv * Cic.substitution * and_elem list + diff --git a/components/tactics/autoTypes.mli b/components/tactics/autoTypes.mli new file mode 100644 index 000000000..ab05564ff --- /dev/null +++ b/components/tactics/autoTypes.mli @@ -0,0 +1,49 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type flags = { + maxwidth: int; + maxsize: int; + maxdepth: int; + maxgoalsizefactor : int; + timeout: float; + use_library: bool; + use_paramod: bool; + use_only_paramod : bool; + close_more : bool; + dont_cache_failures: bool; + do_types: bool; +} + +val default_flags : unit -> flags + +(* (metasenv, subst, (metano,depth)list *) +type sort = P | T;; +type and_elem = + (int * Cic.term * Cic.term) * Cic.metasenv * Cic.substitution * (ProofEngineTypes.goal * int * sort) list +type auto_result = + | Fail of string + | Success of (int * Cic.term * Cic.term) * Cic.metasenv * Cic.substitution * and_elem list + diff --git a/components/tactics/closeCoercionGraph.ml b/components/tactics/closeCoercionGraph.ml new file mode 100644 index 000000000..7ed3c36e6 --- /dev/null +++ b/components/tactics/closeCoercionGraph.ml @@ -0,0 +1,497 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id: cicCoercion.ml 7077 2006-12-05 15:44:54Z fguidi $ *) + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) else () + +(* given the new coercion uri from src to tgt returns the list + * of new coercions to create. the list elements are + * (source, list of coercions to follow, target) + *) +let get_closure_coercions src tgt uri coercions = + let enrich (uri,sat) tgt = + let arity = match tgt with CoercDb.Fun n -> n | _ -> 0 in + uri,sat,arity + in + let uri = enrich uri tgt in + let eq_carr ?exact s t = + debug_print (lazy(CoercDb.name_of_carr s^" VS "^CoercDb.name_of_carr t)); + try + let rc = CoercDb.eq_carr ?exact s t in + debug_print(lazy(string_of_bool rc)); + rc + with + | CoercDb.EqCarrNotImplemented _ | CoercDb.EqCarrOnNonMetaClosed -> + debug_print (lazy("false")); + false + in + match src,tgt with + | CoercDb.Uri _, CoercDb.Uri _ -> + debug_print (lazy ("Uri, Uri4")); + let c_from_tgt = + List.filter + (fun (f,t,_) -> + + debug_print (lazy ("Uri, Uri3")); + eq_carr f tgt (*&& not (eq_carr t src)*)) + coercions + in + let c_to_src = + List.filter + (fun (f,t,_) -> + + debug_print (lazy ("Uri, Uri2")); + eq_carr t src (*&& not (eq_carr f tgt)*)) + coercions + in + (HExtlib.flatten_map + (fun (_,t,ul) -> + if eq_carr ~exact:true src t then [] else + List.map (fun u -> src,[uri; enrich u t],t) ul) c_from_tgt) @ + (HExtlib.flatten_map + (fun (s,t,ul) -> + if eq_carr ~exact:true s tgt then [] else + List.map (fun u -> s,[enrich u t; uri],tgt) ul) c_to_src) @ + (HExtlib.flatten_map + (fun (s,t1,u1l) -> + HExtlib.flatten_map + (fun (_,t,u2l) -> + HExtlib.flatten_map + (fun u1 -> + debug_print (lazy ("Uri, Uri1")); + if eq_carr ~exact:true s t + || eq_carr ~exact:true s tgt + || eq_carr ~exact:true src t + then [] else + List.map + (fun u2 -> (s,[enrich u1 t1;uri;enrich u2 t],t)) + u2l) + u1l) + c_from_tgt) + c_to_src) + | _ -> [] (* do not close in case source or target is not an indty ?? *) +;; + +let obj_attrs n = [`Class (`Coercion n); `Generated] + +exception UnableToCompose + +(* generate_composite (c2 (c1 s)) in the universe graph univ + both living in the same context and metasenv + + c2 ?p2 (c1 ?p1 ?x ?s1) ?s2 + + where: + ?pn + 1 + ?sn = count_pi n - arity n +*) +let generate_composite' (c1,sat1,arity1) (c2,sat2,arity2) context metasenv univ= + let original_metasenv = metasenv in + let c1_ty,univ = CicTypeChecker.type_of_aux' metasenv context c1 univ in + let c2_ty,univ = CicTypeChecker.type_of_aux' metasenv context c2 univ in + let rec mk_implicits = function + | 0 -> [] | n -> (Cic.Implicit None) :: mk_implicits (n-1) + in + let rec mk_lambda_spine c namer = function + | 0 -> c + | n -> + Cic.Lambda + (namer n, + (Cic.Implicit None), + mk_lambda_spine (CicSubstitution.lift 1 c) namer (n-1)) + in + let count_pis t arity = + let rec aux acc n = function + | Cic.Prod (name,src,tgt) -> aux (acc@[name]) (n+1) tgt + | _ -> n,acc + in + let len,names = aux [] 0 t in + let len = len - arity in + List.fold_left + (fun (n,l) x -> if n < len then n+1,l@[x] else n,l) (0,[]) + names + in + let compose c1 nc1 c2 nc2 = + Cic.Appl ((*CicSubstitution.lift 1*) c2 :: mk_implicits (nc2 - sat2 - 1) @ + Cic.Appl ((*CicSubstitution.lift 1*) c1 :: mk_implicits nc1 ) :: + mk_implicits sat2) + in + let rec create_subst_from_metas_to_rels n = function + | [] -> [] + | (metano, ctx, ty)::tl -> + (metano,(ctx,Cic.Rel n,ty)) :: + create_subst_from_metas_to_rels (n-1) tl + in + let split_metasenv metasenv n = + List.partition (fun (_,ctx,_) -> List.length ctx >= n) metasenv + in + let purge_unused_lambdas metasenv t = + let rec aux = function + | Cic.Lambda (_, Cic.Meta (i,_), t) when + List.exists (fun (j,_,_) -> j = i) metasenv -> + aux (CicSubstitution.subst (Cic.Rel ~-100) t) + | Cic.Lambda (name, s, t) -> + Cic.Lambda (name, s, aux t) + | t -> t + in + aux t + in + let order_body_menv term body_metasenv c1_pis c2_pis = + let rec purge_lambdas = function + | Cic.Lambda (_,_,t) -> purge_lambdas t + | t -> t + in + let skip_appl = function | Cic.Appl l -> List.tl l | _ -> assert false in + let rec metas_of_term_and_types t = + let metas = CicUtil.metas_of_term t in + let types = + List.flatten + (List.map + (fun (i,_) -> try + let _,_,ty = CicUtil.lookup_meta i body_metasenv in metas_of_term_and_types ty + with CicUtil.Meta_not_found _ -> []) + metas) + in + metas @ types + in + let sorted_metas_of_term world t = + let metas = metas_of_term_and_types t in + (* this check should be useless *) + let metas = List.filter (fun (i,_)->List.exists (fun (j,_,_) -> j=i) world) metas in + let order_metas metasenv metas = + let module OT = struct type t = int let compare = Pervasives.compare end in + let module S = HTopoSort.Make (OT) in + let dep i = + try + let _,_,ty = List.find (fun (j,_,_) -> j=i) metasenv in + let metas = List.map fst (CicUtil.metas_of_term ty) in + HExtlib.list_uniq (List.sort Pervasives.compare metas) + with Not_found -> [] + in + S.topological_sort (List.map (fun (i,_) -> i) metas) dep + in + order_metas world metas + in + let metas_that_saturate l = + List.fold_left + (fun (acc,n) t -> + let metas = sorted_metas_of_term body_metasenv t in + let metas = + List.filter (fun i -> List.for_all (fun (j,_) -> j<>i) acc) metas in + let metas = List.map (fun i -> i,n) metas in + metas @ acc, n+1) + ([],0) l + in + let l_c2 = skip_appl (purge_lambdas term) in + let l_c2_b,l_c2_a = + try + HExtlib.split_nth (c2_pis - sat2 - 1) l_c2 + with + Failure _ -> assert false in + let l_c1,l_c2_a = + match l_c2_a with + Cic.Appl (_::l_c1)::tl -> l_c1,tl + | _ -> assert false in + let meta_to_be_coerced = + try + match List.nth l_c1 (c1_pis - sat1 - 1) with + | Cic.Meta (i,_) -> Some i + | t -> + debug_print + (lazy("meta_to_be_coerced: " ^ CicPp.ppterm t)); + debug_print + (lazy("c1_pis: " ^ string_of_int c1_pis ^ + " sat1:" ^ string_of_int sat1)); + None + with + Failure _ -> assert false + in + (* BIG HACK ORRIBLE: + * it should be (l_c2_b @ l_c1 @ l_c2_a), but in this case sym (eq_f) gets + * \A,B,f,x,y,Exy and not \B,A,f,x,y,Exy + * as an orrible side effect, the other composites get a type lyke + * \A,x,y,Exy,B,f with 2 saturations + *) + let meta2no = fst (metas_that_saturate (l_c1 @ l_c2_b @ l_c2_a)) in + let sorted = + List.sort + (fun (i,ctx1,ty1) (j,ctx1,ty1) -> + try List.assoc i meta2no - List.assoc j meta2no + with Not_found -> assert false) + body_metasenv + in + let rec position_of n acc = + function + [] -> assert false + | (i,_,_)::_ when i = n -> acc + | _::tl -> position_of n (acc + 1) tl + in + let saturations_res = + match meta_to_be_coerced with + | None -> 0 + | Some meta_to_be_coerced -> + debug_print + (lazy ("META_TO_BE_COERCED: " ^ string_of_int meta_to_be_coerced)); + let position_of_meta_to_be_coerced = + position_of meta_to_be_coerced 0 sorted in + debug_print (lazy ("POSITION_OF_META_TO_BE_COERCED: " ^ + string_of_int position_of_meta_to_be_coerced)); + List.length sorted - position_of_meta_to_be_coerced - 1 + in + debug_print (lazy ("SATURATIONS: " ^ string_of_int saturations_res)); + sorted, saturations_res + in + let namer l n = + let l = List.map (function Cic.Name s -> s | _ -> "A") l in + let l = List.fold_left + (fun acc s -> + let rec add' s = + if List.exists ((=) s) acc then add' (s^"'") else s + in + acc@[add' s]) + [] l + in + let l = List.rev l in + Cic.Name (List.nth l (n-1)) + in + debug_print (lazy ("\nCOMPOSING")); + debug_print (lazy (" c1= "^CicPp.ppterm c1 ^" : "^ CicPp.ppterm c1_ty)); + debug_print (lazy (" c2= "^CicPp.ppterm c2 ^" : "^ CicPp.ppterm c2_ty)); + let c1_pis, names_c1 = count_pis c1_ty arity1 in + let c2_pis, names_c2 = count_pis c2_ty arity2 in + let c = compose c1 c1_pis c2 c2_pis in + let spine_len = c1_pis + c2_pis in + let c = mk_lambda_spine c (namer (names_c1 @ names_c2)) spine_len in + debug_print (lazy ("COMPOSTA: " ^ CicPp.ppterm c)); + let old_insert_coercions = !CicRefine.insert_coercions in + let c, metasenv, univ, saturationsres = + try + CicRefine.insert_coercions := false; + let term, ty, metasenv, ugraph = + CicRefine.type_of_aux' metasenv context c univ + in + debug_print(lazy("COMPOSED REFINED: "^CicPp.ppterm term)); + debug_print(lazy("COMPOSED REFINED (pretty): "^ + CicMetaSubst.ppterm_in_context [] ~metasenv term context)); +(* let metasenv = order_metasenv metasenv in *) +(* debug_print(lazy("ORDERED MENV: "^CicMetaSubst.ppmetasenv [] metasenv)); *) + let body_metasenv, lambdas_metasenv = + split_metasenv metasenv (spine_len + List.length context) + in + debug_print(lazy("B_MENV: "^CicMetaSubst.ppmetasenv [] body_metasenv)); + debug_print(lazy("L_MENV: "^CicMetaSubst.ppmetasenv [] lambdas_metasenv)); + let body_metasenv, saturationsres = + order_body_menv term body_metasenv c1_pis c2_pis + in + debug_print(lazy("ORDERED_B_MENV: "^CicMetaSubst.ppmetasenv [] body_metasenv)); + let subst = create_subst_from_metas_to_rels spine_len body_metasenv in + debug_print (lazy("SUBST: "^CicMetaSubst.ppsubst body_metasenv subst)); + let term = CicMetaSubst.apply_subst subst term in + let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in + debug_print (lazy ("COMPOSED SUBSTITUTED: " ^ CicPp.ppterm term)); + let term, ty, metasenv, ugraph = + CicRefine.type_of_aux' metasenv context term ugraph + in + let body_metasenv, lambdas_metasenv = + split_metasenv metasenv (spine_len + List.length context) + in + let lambdas_metasenv = + List.filter + (fun (i,_,_) -> + List.for_all (fun (j,_,_) -> i <> j) original_metasenv) + lambdas_metasenv + in + let term = purge_unused_lambdas lambdas_metasenv term in + let metasenv = + List.filter + (fun (i,_,_) -> + List.for_all + (fun (j,_,_) -> + i <> j || List.exists (fun (j,_,_) -> j=i) original_metasenv) + lambdas_metasenv) + metasenv + in + debug_print (lazy ("####################")); + debug_print (lazy ("COMPOSED: " ^ CicPp.ppterm term)); + debug_print (lazy ("SATURATIONS: " ^ string_of_int saturationsres)); + debug_print (lazy ("MENV: "^CicMetaSubst.ppmetasenv [] metasenv)); + debug_print (lazy ("####################")); + CicRefine.insert_coercions := old_insert_coercions; + term, metasenv, ugraph, saturationsres + with + | CicRefine.RefineFailure s + | CicRefine.Uncertain s -> debug_print s; + CicRefine.insert_coercions := old_insert_coercions; + raise UnableToCompose + | exn -> + CicRefine.insert_coercions := old_insert_coercions; + raise exn + in + c, metasenv, univ, saturationsres, arity2 +;; + +let build_obj c univ arity = + let c_ty,univ = + try + CicTypeChecker.type_of_aux' [] [] c univ + with CicTypeChecker.TypeCheckerFailure s -> + debug_print (lazy (Printf.sprintf "Generated composite coercion:\n%s\n%s" + (CicPp.ppterm c) (Lazy.force s))); + raise UnableToCompose + in + let cleaned_ty = + FreshNamesGenerator.clean_dummy_dependent_types c_ty + in + let obj = Cic.Constant ("xxxx",Some c,cleaned_ty,[],obj_attrs arity) in + obj,univ +;; + +(* removes from l the coercions that are in !coercions *) +let filter_duplicates l coercions = + List.filter ( + fun (src,l1,tgt) -> + not (List.exists (fun (s,t,l2) -> + CoercDb.eq_carr s src && + CoercDb.eq_carr t tgt && + try + List.for_all2 (fun (u1,_,_) (u2,_) -> UriManager.eq u1 u2) l1 l2 + with + | Invalid_argument "List.for_all2" -> debug_print (lazy("XXX")); false) + coercions)) + l + +let mangle s t l = + (*List.fold_left + (fun s x -> s ^ "_" ^ x) + (s ^ "_OF_" ^ t ^ "_BY" ^ string_of_int (List.length l)) l*) + s ^ "_OF_" ^ t +;; + +exception ManglingFailed of string + +let number_if_already_defined buri name l = + let err () = + raise + (ManglingFailed + ("Unable to give an altenative name to " ^ buri ^ "/" ^ name ^ ".con")) + in + let rec aux n = + let suffix = if n > 0 then string_of_int n else "" in + let suri = buri ^ "/" ^ name ^ suffix ^ ".con" in + let uri = UriManager.uri_of_string suri in + let retry () = + if n < 100 then + begin + HLog.warn ("Uri " ^ suri ^ " already exists."); + aux (n+1) + end + else + err () + in + if List.exists (UriManager.eq uri) l then retry () + else + try + let _ = Http_getter.resolve' ~local:true ~writable:true uri in + if Http_getter.exists' ~local:true uri then retry () else uri + with + | Http_getter_types.Key_not_found _ -> uri + | Http_getter_types.Unresolvable_URI _ -> assert false + in + aux 0 +;; + +(* given a new coercion uri from src to tgt returns + * a list of (new coercion uri, coercion obj, universe graph) + *) +let close_coercion_graph src tgt uri saturations baseuri = + (* check if the coercion already exists *) + let coercions = CoercDb.to_list () in + let todo_list = get_closure_coercions src tgt (uri,saturations) coercions in + debug_print (lazy("composed " ^ string_of_int (List.length todo_list))); + let todo_list = filter_duplicates todo_list coercions in + try + let new_coercions = + List.fold_left + (fun acc (src, l , tgt) -> + try + (match l with + | [] -> assert false + | (he,saturations1,arity1) :: tl -> + let first_step = + Cic.Constant ("", + Some (CoercDb.term_of_carr (CoercDb.Uri he)), + Cic.Sort Cic.Prop, [], obj_attrs arity1), + saturations1, + arity1 + in + let o,_ = + List.fold_left (fun (o,univ) (coer,saturations2,arity2) -> + match o with + | Cic.Constant (_,Some u,_,[],_),saturations1,arity1 -> + let t, menv, univ, saturationsres, arityres = + generate_composite' (u,saturations1,arity1) + (CoercDb.term_of_carr (CoercDb.Uri coer), + saturations2, arity2) [] [] univ + in + if (menv = []) then + HLog.warn "MENV non empty after composing coercions"; + let o,univ = build_obj t univ arityres in + (o,saturationsres,arityres),univ + | _ -> assert false + ) (first_step, CicUniv.empty_ugraph) tl + in + let name_src = CoercDb.name_of_carr src in + let name_tgt = CoercDb.name_of_carr tgt in + let by = List.map (fun u,_,_ -> UriManager.name_of_uri u) l in + let name = mangle name_tgt name_src by in + let c_uri = + number_if_already_defined baseuri name + (List.map (fun (_,_,u,_,_,_) -> u) acc) + in + let named_obj,saturations,arity = + match o with + | Cic.Constant (_,bo,ty,vl,attrs),saturations,arity -> + Cic.Constant (name,bo,ty,vl,attrs),saturations,arity + | _ -> assert false + in + (src,tgt,c_uri,saturations,named_obj,arity))::acc + with UnableToCompose -> acc + ) [] todo_list + in + new_coercions + with ManglingFailed s -> HLog.error s; [] +;; + +CicCoercion.set_close_coercion_graph close_coercion_graph;; + +(* generate_composite (c2 (c1 s)) in the universe graph univ + * both living in the same context and metasenv *) +let generate_composite c1 c2 context metasenv univ sat1 sat2 = + let a,b,c,_,_ = + generate_composite' (c1,sat1,0) (c2,sat2,0) context metasenv univ + in + a,b,c +;; diff --git a/components/tactics/closeCoercionGraph.mli b/components/tactics/closeCoercionGraph.mli new file mode 100644 index 000000000..0d5a2e5be --- /dev/null +++ b/components/tactics/closeCoercionGraph.mli @@ -0,0 +1,40 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* This module implements the Coercions transitive closure *) + +val close_coercion_graph: + CoercDb.coerc_carr -> CoercDb.coerc_carr -> UriManager.uri -> int -> + string (* baseuri *) -> + (CoercDb.coerc_carr * CoercDb.coerc_carr * UriManager.uri * + int (* saturations *) * Cic.obj * int (* arity *)) list + +exception UnableToCompose + +val generate_composite: + Cic.term -> Cic.term (* t2 *) -> Cic.context -> + Cic.metasenv -> CicUniv.universe_graph -> + int -> int (* saturations of t1/t2 *) -> + Cic.term * Cic.metasenv * CicUniv.universe_graph diff --git a/components/tactics/compose.ml b/components/tactics/compose.ml new file mode 100644 index 000000000..6bc3dd0fa --- /dev/null +++ b/components/tactics/compose.ml @@ -0,0 +1,195 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +let debug = false;; +let debug_print = + if not debug then (fun _ -> ()) else (fun s -> prerr_endline (Lazy.force s)) +;; + +let rec count_pi = function Cic.Prod (_,_,t) -> count_pi t + 1 | _ -> 0 ;; + +let compose_core t2 t1 (proof, goal) = + let _,metasenv,_subst,_,_,_ = proof in + let _,context,_ = CicUtil.lookup_meta goal metasenv in + let ty1,_ = + CicTypeChecker.type_of_aux' metasenv context t1 CicUniv.oblivion_ugraph + in + let ty2,_ = + CicTypeChecker.type_of_aux' metasenv context t2 CicUniv.oblivion_ugraph + in + let saturated_ty2, menv_for_saturated_ty2, args_t2 = + let maxm = CicMkImplicit.new_meta metasenv [] in + let ty2, menv, args, _ = + TermUtil.saturate_term ~delta:false maxm metasenv context ty2 0 in + ty2, menv, args + in + let saturations_t2 = + let rec aux n = function + | Cic.Meta (i,_)::tl -> + let _,c,ty = CicUtil.lookup_meta i menv_for_saturated_ty2 in + if fst (CicReduction.are_convertible c ty (Cic.Sort Cic.Prop) + CicUniv.oblivion_ugraph) + then n else aux (n+1) tl + | _::tl -> aux (n+1) tl + | [] -> n+1 + in + List.length args_t2 - aux 0 args_t2 +1 + in + debug_print (lazy("saturated_ty2: "^CicMetaSubst.ppterm_in_context + [] ~metasenv:menv_for_saturated_ty2 saturated_ty2 context ^ + " saturations_t2:" ^ string_of_int saturations_t2)); + (* unifies t with saturated_ty2 and gives back a fresh meta of type t *) + let unif menv t = + let m, menv2 = + let n = CicMkImplicit.new_meta menv [] in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context + in + Cic.Meta (n,irl), ((n,context,t)::menv) + in + try + let _ = + CicUnification.fo_unif menv context t saturated_ty2 + CicUniv.oblivion_ugraph + in + true, menv2, m + with + | CicUnification.UnificationFailure _ + | CicUnification.Uncertain _ -> false, menv2, m + in + (* check which "positions" in the input arrow unifies with saturated_ty2 *) + let rec positions menv cur saturations = function + | Cic.Prod (n,s,t) -> + let b, newmenv, sb = unif menv s in + if b then + (saturations - cur - 1) :: + (positions newmenv (cur + 1) saturations + (CicSubstitution.subst sb t)) + else + positions newmenv (cur + 1) saturations (CicSubstitution.subst sb t) + | _ -> [] + in + (* position is a list of arities, that is if t1 : a -> b -> c and saturations + * is 0 then the computed term will be (t1 ? t2) of type a -> c if saturations + * is 1 then (t1 t2 ?) of type b -> c *) + let rec generate positions menv acc = + match positions with + | [] -> acc, menv + | saturations_t1::tl -> + try + let t, menv1, _ = + CloseCoercionGraph.generate_composite t2 t1 context menv + CicUniv.oblivion_ugraph saturations_t2 saturations_t1 + in + assert (List.length menv1 = List.length menv); + generate tl menv (t::acc) + with + | CloseCoercionGraph.UnableToCompose -> generate tl menv acc + in + let terms, metasenv = + generate (positions menv_for_saturated_ty2 0 (count_pi ty1) ty1) metasenv [] + in + (* the new proof has the resulting metasenv (shouldn't it be the same?) *) + let proof = + let uri, _, _subst, bo, ty, attrs = proof in + uri, metasenv, _subst, bo, ty, attrs + in + (* now we have the terms, we generalize them and intros them *) + let proof, goal = + List.fold_left + (fun (proof,goal) t -> + let lazy_of t = + ProofEngineTypes.const_lazy_term t + in + let proof, gl = + ProofEngineTypes.apply_tactic + (VariousTactics.generalize_tac (Some (lazy_of t), [], None)) + (proof,goal) + in + assert(List.length gl = 1); + proof,List.hd gl) + (proof,goal) terms + in + (proof, goal), List.length terms +;; + +let compose_tac ?howmany ?mk_fresh_name_callback n t1 t2 proofstatus = + let ((proof, goal), k), n = + match t2 with + | Some t2 -> compose_core t1 t2 proofstatus, n-1 + | None -> + let k = + let proof, goal = proofstatus in + let _,metasenv,subst,_,_,_ = proof in + let _,_,ty = CicUtil.lookup_meta goal metasenv in + count_pi (CicMetaSubst.apply_subst subst ty) + in + (proofstatus, k), n + in + let (proof, goal), k = + (* fix iterates n times the composition *) + let rec fix proofstatus k t = function + | 0 -> proofstatus, k + | n -> + let t = CicSubstitution.lift k t in + let proof, gl = + ProofEngineTypes.apply_tactic + (PrimitiveTactics.intros_tac + ~howmany:k ?mk_fresh_name_callback ()) proofstatus + in + assert (List.length gl = 1); + let goal = List.hd gl in + let k, proofstatus = + (* aux compose t with every previous result *) + let rec aux k proofstatus = function + | 0 -> k, proofstatus + | n -> + let (proof, goal), k1 = + compose_core t (Cic.Rel n) proofstatus + in + aux (k+k1) (proof, goal) (n-1) + in + aux 0 (proof, goal) k + in + fix proofstatus k t (n-1) + in + fix (proof, goal) k t1 n + in + let howmany = + match howmany with + | None -> None + | Some i -> + if i - k < 0 then (* we should generalize back and clear *) Some 0 + else Some (i - k) + in + ProofEngineTypes.apply_tactic + (PrimitiveTactics.intros_tac ?howmany ?mk_fresh_name_callback ()) + (proof,goal) +;; + +let compose_tac ?howmany ?mk_fresh_name_callback times t1 t2 = + ProofEngineTypes.mk_tactic + (compose_tac ?howmany ?mk_fresh_name_callback times t1 t2) +;; diff --git a/components/tactics/compose.mli b/components/tactics/compose.mli new file mode 100644 index 000000000..44db74b76 --- /dev/null +++ b/components/tactics/compose.mli @@ -0,0 +1,30 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val compose_tac: + ?howmany:int -> + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + int (* times *) -> + Cic.term -> Cic.term option -> ProofEngineTypes.tactic diff --git a/components/tactics/continuationals.ml b/components/tactics/continuationals.ml new file mode 100644 index 000000000..044fa45c8 --- /dev/null +++ b/components/tactics/continuationals.ml @@ -0,0 +1,365 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) else () + +exception Error of string lazy_t +let fail msg = raise (Error msg) + +type goal = ProofEngineTypes.goal + +module Stack = +struct + type switch = Open of goal | Closed of goal + type locator = int * switch + type tag = [ `BranchTag | `FocusTag | `NoTag ] + type entry = locator list * locator list * locator list * tag + type t = entry list + + let empty = [ [], [], [], `NoTag ] + + let fold ~env ~cont ~todo init stack = + let rec aux acc depth = + function + | [] -> acc + | (locs, todos, conts, tag) :: tl -> + let acc = List.fold_left (fun acc -> env acc depth tag) acc locs in + let acc = List.fold_left (fun acc -> cont acc depth tag) acc conts in + let acc = List.fold_left (fun acc -> todo acc depth tag) acc todos in + aux acc (depth + 1) tl + in + assert (stack <> []); + aux init 0 stack + + let iter ~env ~cont ~todo = + fold ~env:(fun _ -> env) ~cont:(fun _ -> cont) ~todo:(fun _ -> todo) () + + let map ~env ~cont ~todo = + let depth = ref ~-1 in + List.map + (fun (s, t, c, tag) -> + incr depth; + let d = !depth in + env d tag s, todo d tag t, cont d tag c, tag) + + let is_open = function _, Open _ -> true | _ -> false + let close = function n, Open g -> n, Closed g | l -> l + let filter_open = List.filter is_open + let is_fresh = + function n, Open _ when n > 0 -> true | _,Closed _ -> true | _ -> false + let goal_of_loc = function _, Open g | _, Closed g -> g + let goal_of_switch = function Open g | Closed g -> g + let switch_of_loc = snd + + let zero_pos = List.map (fun g -> 0, Open g) + + let init_pos locs = + let pos = ref 0 in (* positions are 1-based *) + List.map (function _, sw -> incr pos; !pos, sw) locs + + let extract_pos i = + let rec aux acc = + function + | [] -> fail (lazy (sprintf "relative position %d not found" i)) + | (i', _) as loc :: tl when i = i' -> loc, (List.rev acc) @ tl + | hd :: tl -> aux (hd :: acc) tl + in + aux [] + + let deep_close gs = + let close _ _ = + List.map (fun l -> if List.mem (goal_of_loc l) gs then close l else l) + in + let rm _ _ = List.filter (fun l -> not (List.mem (goal_of_loc l) gs)) in + map ~env:close ~cont:rm ~todo:rm + + let rec find_goal = + function + | [] -> raise (Failure "Continuationals.find_goal") + | (l :: _, _ , _ , _) :: _ -> goal_of_loc l + | ( _ , _ , l :: _, _) :: _ -> goal_of_loc l + | ( _ , l :: _, _ , _) :: _ -> goal_of_loc l + | _ :: tl -> find_goal tl + + let is_empty = + function + | [] -> assert false + | [ [], [], [], `NoTag ] -> true + | _ -> false + + let of_metasenv metasenv = + let goals = List.map (fun (g, _, _) -> g) metasenv in + [ zero_pos goals, [], [], `NoTag ] + + let head_switches = + function + | (locs, _, _, _) :: _ -> List.map switch_of_loc locs + | [] -> assert false + + let head_goals = + function + | (locs, _, _, _) :: _ -> List.map goal_of_loc locs + | [] -> assert false + + let head_tag = + function + | (_, _, _, tag) :: _ -> tag + | [] -> assert false + + let shift_goals = + function + | _ :: (locs, _, _, _) :: _ -> List.map goal_of_loc locs + | [] -> assert false + | _ -> [] + + let open_goals stack = + let add_open acc _ _ l = if is_open l then goal_of_loc l :: acc else acc in + List.rev (fold ~env:add_open ~cont:add_open ~todo:add_open [] stack) + + let (@+) = (@) (* union *) + + let (@-) s1 s2 = (* difference *) + List.fold_right + (fun e acc -> if List.mem e s2 then acc else e :: acc) + s1 [] + + let (@~-) locs gs = (* remove some goals from a locators list *) + List.fold_right + (fun loc acc -> if List.mem (goal_of_loc loc) gs then acc else loc :: acc) + locs [] + + let pp stack = + let pp_goal = string_of_int in + let pp_switch = + function Open g -> "o" ^ pp_goal g | Closed g -> "c" ^ pp_goal g + in + let pp_loc (i, s) = string_of_int i ^ pp_switch s in + let pp_env env = sprintf "[%s]" (String.concat ";" (List.map pp_loc env)) in + let pp_tag = function `BranchTag -> "B" | `FocusTag -> "F" | `NoTag -> "N" in + let pp_stack_entry (env, todo, cont, tag) = + sprintf "(%s, %s, %s, %s)" (pp_env env) (pp_env todo) (pp_env cont) + (pp_tag tag) + in + String.concat " :: " (List.map pp_stack_entry stack) +end + +module type Status = +sig + type input_status + type output_status + + type tactic + val mk_tactic : (input_status -> output_status) -> tactic + val apply_tactic : tactic -> input_status -> output_status + + val goals : output_status -> goal list * goal list (** opened, closed goals *) + val get_stack : input_status -> Stack.t + val set_stack : Stack.t -> output_status -> output_status + + val inject : input_status -> output_status + val focus : goal -> output_status -> input_status +end + +module type C = +sig + type input_status + type output_status + type tactic + + type tactical = + | Tactic of tactic + | Skip + + type t = + | Dot + | Semicolon + + | Branch + | Shift + | Pos of int list + | Wildcard + | Merge + + | Focus of goal list + | Unfocus + + | Tactical of tactical + + val eval: t -> input_status -> output_status +end + +module Make (S: Status) = +struct + open Stack + + type input_status = S.input_status + type output_status = S.output_status + type tactic = S.tactic + + type tactical = + | Tactic of tactic + | Skip + + type t = + | Dot + | Semicolon + | Branch + | Shift + | Pos of int list + | Wildcard + | Merge + | Focus of goal list + | Unfocus + | Tactical of tactical + + let pp_t = + function + | Dot -> "Dot" + | Semicolon -> "Semicolon" + | Branch -> "Branch" + | Shift -> "Shift" + | Pos i -> "Pos " ^ (String.concat "," (List.map string_of_int i)) + | Wildcard -> "Wildcard" + | Merge -> "Merge" + | Focus gs -> + sprintf "Focus [%s]" (String.concat "; " (List.map string_of_int gs)) + | Unfocus -> "Unfocus" + | Tactical _ -> "Tactical " + + let eval_tactical tactical ostatus switch = + match tactical, switch with + | Tactic tac, Open n -> + let ostatus = S.apply_tactic tac (S.focus n ostatus) in + let opened, closed = S.goals ostatus in + ostatus, opened, closed + | Skip, Closed n -> ostatus, [], [n] + | Tactic _, Closed _ -> fail (lazy "can't apply tactic to a closed goal") + | Skip, Open _ -> fail (lazy "can't skip an open goal") + + let eval cmd istatus = + let stack = S.get_stack istatus in + debug_print (lazy (sprintf "EVAL CONT %s <- %s" (pp_t cmd) (pp stack))); + let new_stack stack = S.inject istatus, stack in + let ostatus, stack = + match cmd, stack with + | _, [] -> assert false + | Tactical tac, (g, t, k, tag) :: s -> +(* COMMENTED OUT TO ALLOW PARAMODULATION TO DO A + * auto paramodulation.try assumption. + * EVEN IF NO GOALS ARE LEFT OPEN BY AUTO. + + if g = [] then fail (lazy "can't apply a tactic to zero goals"); + +*) + debug_print (lazy ("context length " ^string_of_int (List.length g))); + let rec aux s go gc = + function + | [] -> s, go, gc + | loc :: loc_tl -> + debug_print (lazy "inner eval tactical"); + let s, go, gc = + if List.exists ((=) (goal_of_loc loc)) gc then + s, go, gc + else + let s, go', gc' = eval_tactical tac s (switch_of_loc loc) in + s, (go @- gc') @+ go', gc @+ gc' + in + aux s go gc loc_tl + in + let s0, go0, gc0 = S.inject istatus, [], [] in + let sn, gon, gcn = aux s0 go0 gc0 g in + debug_print (lazy ("opened: " + ^ String.concat " " (List.map string_of_int gon))); + debug_print (lazy ("closed: " + ^ String.concat " " (List.map string_of_int gcn))); + let stack = + (zero_pos gon, t @~- gcn, k @~- gcn, tag) :: deep_close gcn s + in + sn, stack + | Dot, ([], _, [], _) :: _ -> + (* backward compatibility: do-nothing-dot *) + new_stack stack + | Dot, (g, t, k, tag) :: s -> + (match filter_open g, k with + | loc :: loc_tl, _ -> new_stack (([ loc ], t, loc_tl @+ k, tag) :: s) + | [], loc :: k -> + assert (is_open loc); + new_stack (([ loc ], t, k, tag) :: s) + | _ -> fail (lazy "can't use \".\" here")) + | Semicolon, _ -> new_stack stack + | Branch, (g, t, k, tag) :: s -> + (match init_pos g with + | [] | [ _ ] -> fail (lazy "too few goals to branch"); + | loc :: loc_tl -> + new_stack + (([ loc ], [], [], `BranchTag) :: (loc_tl, t, k, tag) :: s)) + | Shift, (g, t, k, `BranchTag) :: (g', t', k', tag) :: s -> + (match g' with + | [] -> fail (lazy "no more goals to shift") + | loc :: loc_tl -> + new_stack + (([ loc ], t @+ filter_open g @+ k, [],`BranchTag) + :: (loc_tl, t', k', tag) :: s)) + | Shift, _ -> fail (lazy "can't shift goals here") + | Pos i_s, ([ loc ], t, [],`BranchTag) :: (g', t', k', tag) :: s + when is_fresh loc -> + let l_js = List.filter (fun (i, _) -> List.mem i i_s) ([loc] @+ g') in + new_stack + ((l_js, t , [],`BranchTag) + :: (([ loc ] @+ g') @- l_js, t', k', tag) :: s) + | Pos _, _ -> fail (lazy "can't use relative positioning here") + | Wildcard, ([ loc ] , t, [], `BranchTag) :: (g', t', k', tag) :: s + when is_fresh loc -> + new_stack + (([loc] @+ g', t, [], `BranchTag) + :: ([], t', k', tag) :: s) + | Wildcard, _ -> fail (lazy "can't use wildcard here") + | Merge, (g, t, k,`BranchTag) :: (g', t', k', tag) :: s -> + new_stack ((t @+ filter_open g @+ g' @+ k, t', k', tag) :: s) + | Merge, _ -> fail (lazy "can't merge goals here") + | Focus [], _ -> assert false + | Focus gs, s -> + let stack_locs = + let add_l acc _ _ l = if is_open l then l :: acc else acc in + Stack.fold ~env:add_l ~cont:add_l ~todo:add_l [] s + in + List.iter + (fun g -> + if not (List.exists (fun l -> goal_of_loc l = g) stack_locs) then + fail (lazy (sprintf "goal %d not found (or closed)" g))) + gs; + new_stack ((zero_pos gs, [], [], `FocusTag) :: deep_close gs s) + | Unfocus, ([], [], [], `FocusTag) :: s -> new_stack s + | Unfocus, _ -> fail (lazy "can't unfocus, some goals are still open") + in + debug_print (lazy (sprintf "EVAL CONT %s -> %s" (pp_t cmd) (pp stack))); + S.set_stack stack ostatus +end + diff --git a/components/tactics/continuationals.mli b/components/tactics/continuationals.mli new file mode 100644 index 000000000..277dfe362 --- /dev/null +++ b/components/tactics/continuationals.mli @@ -0,0 +1,125 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception Error of string Lazy.t + +type goal = ProofEngineTypes.goal + +(** {2 Goal stack} *) + +module Stack: +sig + type switch = Open of goal | Closed of goal + type locator = int * switch + type tag = [ `BranchTag | `FocusTag | `NoTag ] + type entry = locator list * locator list * locator list * tag + type t = entry list + + val empty: t + + val find_goal: t -> goal (** find "next" goal *) + val is_empty: t -> bool (** a singleton empty level *) + val of_metasenv: Cic.metasenv -> t + val head_switches: t -> switch list (** top level switches *) + val head_goals: t -> goal list (** top level goals *) + val head_tag: t -> tag (** top level tag *) + val shift_goals: t -> goal list (** second level goals *) + val open_goals: t -> goal list (** all (Open) goals *) + val goal_of_switch: switch -> goal + + (** @param int depth, depth 0 is the top of the stack *) + val fold: + env: ('a -> int -> tag -> locator -> 'a) -> + cont:('a -> int -> tag -> locator -> 'a) -> + todo:('a -> int -> tag -> locator -> 'a) -> + 'a -> t -> 'a + + val iter: (** @param depth as above *) + env: (int -> tag -> locator -> unit) -> + cont:(int -> tag -> locator -> unit) -> + todo:(int -> tag -> locator -> unit) -> + t -> unit + + val map: (** @param depth as above *) + env: (int -> tag -> locator list -> locator list) -> + cont:(int -> tag -> locator list -> locator list) -> + todo:(int -> tag -> locator list -> locator list) -> + t -> t + + val pp: t -> string +end + +(** {2 Functorial interface} *) + +module type Status = +sig + type input_status + type output_status + + type tactic + val mk_tactic : (input_status -> output_status) -> tactic + val apply_tactic : tactic -> input_status -> output_status + + val goals : output_status -> goal list * goal list (** opened, closed goals *) + val get_stack : input_status -> Stack.t + val set_stack : Stack.t -> output_status -> output_status + + val inject : input_status -> output_status + val focus : goal -> output_status -> input_status +end + +module type C = +sig + type input_status + type output_status + type tactic + + type tactical = + | Tactic of tactic + | Skip + + type t = + | Dot + | Semicolon + + | Branch + | Shift + | Pos of int list + | Wildcard + | Merge + + | Focus of goal list + | Unfocus + + | Tactical of tactical + + val eval: t -> input_status -> output_status +end + +module Make (S: Status) : C + with type tactic = S.tactic + and type input_status = S.input_status + and type output_status = S.output_status + diff --git a/components/tactics/declarative.ml b/components/tactics/declarative.ml new file mode 100644 index 000000000..c248d0cad --- /dev/null +++ b/components/tactics/declarative.ml @@ -0,0 +1,308 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +let assume id t = + Tacticals.then_ + ~start: + (Tactics.intros ~howmany:1 + ~mk_fresh_name_callback:(fun _ _ _ ~typ -> Cic.Name id) ()) + ~continuation: + (Tactics.change ~pattern:(None,[id,Cic.Implicit (Some `Hole)],None) + (fun _ metasenv ugraph -> t,metasenv,ugraph)) +;; + +let suppose t id ty = +(*BUG: check on t missing *) + let ty = match ty with None -> t | Some ty -> ty in + Tacticals.then_ + ~start: + (Tactics.intros ~howmany:1 + ~mk_fresh_name_callback:(fun _ _ _ ~typ -> Cic.Name id) ()) + ~continuation: + (Tactics.change ~pattern:(None,[id,Cic.Implicit (Some `Hole)],None) + (fun _ metasenv ugraph -> ty,metasenv,ugraph)) +;; + +let by_term_we_proved ~dbd ~universe t ty id ty' = + let just = + match t with + None -> Tactics.auto ~dbd ~params:[] ~universe + | Some t -> Tactics.apply t + in + match id with + None -> + (match ty' with + None -> assert false + | Some ty' -> + Tacticals.then_ + ~start:(Tactics.change + ~pattern:(ProofEngineTypes.conclusion_pattern None) + (fun _ metasenv ugraph -> ty,metasenv,ugraph)) + ~continuation:just + ) + | Some id -> + let ty',continuation = + match ty' with + None -> ty,just + | Some ty' -> + ty', + Tacticals.then_ + ~start: + (Tactics.change + ~with_cast:true + ~pattern:(None,[id,Cic.Implicit (Some `Hole)],None) + (fun _ metasenv ugraph -> ty,metasenv,ugraph)) + ~continuation:just + in + Tacticals.thens + ~start: + (Tactics.cut ty' + ~mk_fresh_name_callback:(fun _ _ _ ~typ -> Cic.Name id)) + ~continuations:[ Tacticals.id_tac ; continuation ] +;; + +let bydone ~dbd ~universe t = + let just = + match t with + None -> Tactics.auto ~dbd ~params:[] ~universe + | Some t -> Tactics.apply t + in + just +;; + +let we_need_to_prove t id ty = + match id with + None -> + (match ty with + None -> Tacticals.id_tac (*BUG: check missing here *) + | Some ty -> + Tactics.change ~pattern:(ProofEngineTypes.conclusion_pattern None) + (fun _ metasenv ugraph -> ty,metasenv,ugraph)) + | Some id -> + let aux status = + let cont,cutted = + match ty with + None -> Tacticals.id_tac,t + | Some ty -> + Tactics.change ~pattern:(None,[id,Cic.Implicit (Some `Hole)],None) + (fun _ metasenv ugraph -> t,metasenv,ugraph), ty in + let proof,goals = + ProofEngineTypes.apply_tactic + (Tacticals.thens + ~start: + (Tactics.cut cutted + ~mk_fresh_name_callback:(fun _ _ _ ~typ -> Cic.Name id)) + ~continuations:[cont]) + status + in + let goals' = + match goals with + [fst; snd] -> [snd; fst] + | _ -> assert false + in + proof,goals' + in + ProofEngineTypes.mk_tactic aux +;; + +let existselim ~dbd ~universe t id1 t1 id2 t2 = + let aux (proof, goal) = + let (n,metasenv,_subst,bo,ty,attrs) = proof in + let metano,context,_ = CicUtil.lookup_meta goal metasenv in + let t2, metasenv, _ = t2 (Some (Cic.Name id1, Cic.Decl t1) :: context) metasenv CicUniv.oblivion_ugraph in + let proof' = (n,metasenv,_subst,bo,ty,attrs) in + ProofEngineTypes.apply_tactic ( + Tacticals.thens + ~start:(Tactics.cut (Cic.Appl [Cic.MutInd (UriManager.uri_of_string "cic:/matita/logic/connectives/ex.ind", 0, []); t1 ; Cic.Lambda (Cic.Name id1, t1, t2)])) + ~continuations: + [ Tactics.elim_intros (Cic.Rel 1) + ~mk_fresh_name_callback: + (let i = ref 0 in + fun _ _ _ ~typ -> + incr i; + if !i = 1 then Cic.Name id1 else Cic.Name id2) ; + (match t with + None -> Tactics.auto ~dbd ~params:[] ~universe + | Some t -> Tactics.apply t) + ]) (proof', goal) + in + ProofEngineTypes.mk_tactic aux +;; + +let andelim t id1 t1 id2 t2 = + Tactics.elim_intros t + ~mk_fresh_name_callback: + (let i = ref 0 in + fun _ _ _ ~typ -> + incr i; + if !i = 1 then Cic.Name id1 else Cic.Name id2) + +let rewritingstep ~dbd ~universe lhs rhs just last_step = + let aux ((proof,goal) as status) = + let (curi,metasenv,_subst,proofbo,proofty, attrs) = proof in + let _,context,gty = CicUtil.lookup_meta goal metasenv in + let eq,trans = + match LibraryObjects.eq_URI () with + None -> raise (ProofEngineTypes.Fail (lazy "You need to register the default equality first. Please use the \"default\" command")) + | Some uri -> + Cic.MutInd (uri,0,[]), Cic.Const (LibraryObjects.trans_eq_URI ~eq:uri,[]) + in + let ty,_ = + CicTypeChecker.type_of_aux' metasenv context rhs CicUniv.empty_ugraph in + let just' = + match just with + `Auto params -> + let params = + if not (List.exists (fun (k,_) -> k = "timeout") params) then + ("timeout","3")::params + else params + in + let params' = + if not (List.exists (fun (k,_) -> k = "paramodulation") params) then + ("paramodulation","1")::params + else params + in + if params = params' then + Tactics.auto ~dbd ~params ~universe + else + Tacticals.first + [Tactics.auto ~dbd ~params ~universe ; + Tactics.auto ~dbd ~params:params' ~universe] + | `Term just -> + let ty,_ = + CicTypeChecker.type_of_aux' metasenv context just + CicUniv.empty_ugraph + in + Tactics.solve_rewrite + ~universe:(Universe.index Universe.empty + (Universe.key ty) just) ~steps:1 () + (* Tactics.apply just *) + | `Proof -> + Tacticals.id_tac + in + let plhs,prhs,prepare = + match lhs with + None -> + let plhs,prhs = + match gty with + Cic.Appl [_;_;plhs;prhs] -> plhs,prhs + | _ -> assert false + in + plhs,prhs, + (fun continuation -> + ProofEngineTypes.apply_tactic continuation status) + | Some (None,lhs) -> + let plhs,prhs = + match gty with + Cic.Appl [_;_;plhs;prhs] -> plhs,prhs + | _ -> assert false + in + (*CSC: manca check plhs convertibile con lhs *) + plhs,prhs, + (fun continuation -> + ProofEngineTypes.apply_tactic continuation status) + | Some (Some name,lhs) -> + let newmeta = CicMkImplicit.new_meta metasenv [] in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context in + let plhs = lhs in + let prhs = Cic.Meta(newmeta,irl) in + plhs,prhs, + (fun continuation -> + let metasenv = (newmeta, context, ty)::metasenv in + let mk_fresh_name_callback = + fun metasenv context _ ~typ -> + FreshNamesGenerator.mk_fresh_name ~subst:[] metasenv context + (Cic.Name name) ~typ + in + let proof = curi,metasenv,_subst,proofbo,proofty, attrs in + let proof,goals = + ProofEngineTypes.apply_tactic + (Tacticals.thens + ~start:(Tactics.cut ~mk_fresh_name_callback + (Cic.Appl [eq ; ty ; lhs ; prhs])) + ~continuations:[Tacticals.id_tac ; continuation]) (proof,goal) + in + let goals = + match just,goals with + `Proof, [g1;g2;g3] -> [g2;g3;newmeta;g1] + | _, [g1;g2] -> [g2;newmeta;g1] + | _ -> assert false + in + proof,goals) + in + let continuation = + if last_step then + (*CSC:manca controllo sul fatto che rhs sia convertibile con prhs*) + just' + else + Tacticals.thens + ~start:(Tactics.apply ~term:(Cic.Appl [trans;ty;plhs;rhs;prhs])) + ~continuations:[just' ; Tacticals.id_tac] + in + prepare continuation + in + ProofEngineTypes.mk_tactic aux +;; + +let we_proceed_by_cases_on t pat = + (*BUG here: pat unused *) + Tactics.cases_intros t +;; + +let we_proceed_by_induction_on t pat = + let pattern = None, [], Some pat in + Tactics.elim_intros ~depth:0 (*~pattern*) t +;; + +let case id ~params = + (*BUG here: id unused*) + (*BUG here: it does not verify that the previous branch is closed *) + (*BUG here: the params should be parsed telescopically*) + (*BUG here: the tactic_terms should be terms*) + let rec aux ~params ((proof,goal) as status) = + match params with + [] -> proof,[goal] + | (id,t)::tl -> + match ProofEngineTypes.apply_tactic (assume id t) status with + proof,[goal] -> aux tl (proof,goal) + | _ -> assert false + in + ProofEngineTypes.mk_tactic (aux ~params) +;; + +let thesisbecomes t = +let ty = None in + match ty with + None -> + Tactics.change ~pattern:(None,[],Some (Cic.Implicit (Some `Hole))) + (fun _ metasenv ugraph -> t,metasenv,ugraph) + | Some ty -> + (*BUG here: missing check on t *) + Tactics.change ~pattern:(None,[],Some (Cic.Implicit (Some `Hole))) + (fun _ metasenv ugraph -> ty,metasenv,ugraph) +;; + +let byinduction t id = suppose t id None;; diff --git a/components/tactics/declarative.mli b/components/tactics/declarative.mli new file mode 100644 index 000000000..8fd91b0e8 --- /dev/null +++ b/components/tactics/declarative.mli @@ -0,0 +1,61 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val assume : string -> Cic.term -> ProofEngineTypes.tactic + +val suppose : Cic.term -> string -> Cic.term option -> ProofEngineTypes.tactic + +val by_term_we_proved : + dbd:HSql.dbd -> universe:Universe.universe -> Cic.term option -> Cic.term -> + string option -> Cic.term option -> ProofEngineTypes.tactic + +val bydone : dbd:HSql.dbd -> universe:Universe.universe -> Cic.term option -> + ProofEngineTypes.tactic + +val we_need_to_prove : + Cic.term -> string option -> Cic.term option -> ProofEngineTypes.tactic + +val we_proceed_by_cases_on : Cic.term -> Cic.term -> ProofEngineTypes.tactic + +val we_proceed_by_induction_on : Cic.term -> Cic.term -> ProofEngineTypes.tactic + +val byinduction : Cic.term -> string -> ProofEngineTypes.tactic + +val thesisbecomes : Cic.term -> ProofEngineTypes.tactic + +val case : string -> params:(string * Cic.term) list -> ProofEngineTypes.tactic + +val existselim : + dbd:HSql.dbd -> universe:Universe.universe -> + Cic.term option -> string -> Cic.term -> string -> Cic.lazy_term -> ProofEngineTypes.tactic + +val andelim : + Cic.term -> string -> Cic.term -> string -> Cic.term -> ProofEngineTypes.tactic + +val rewritingstep : + dbd:HSql.dbd -> universe:Universe.universe -> + (string option * Cic.term) option -> Cic.term -> + [ `Term of Cic.term | `Auto of (string * string) list | `Proof ] -> + bool (* last step *) -> ProofEngineTypes.tactic diff --git a/components/tactics/destructTactic.ml b/components/tactics/destructTactic.ml new file mode 100644 index 000000000..a8bfc007d --- /dev/null +++ b/components/tactics/destructTactic.ml @@ -0,0 +1,592 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +module C = Cic +module U = UriManager +module P = PrimitiveTactics +module T = Tacticals +module CR = CicReduction +module PST = ProofEngineStructuralRules +module PET = ProofEngineTypes +module CTC = CicTypeChecker +module CU = CicUniv +module S = CicSubstitution +module RT = ReductionTactics +module PEH = ProofEngineHelpers +module ET = EqualityTactics +module DTI = DoubleTypeInference + +let debug = false +let debug_print = + if debug then (fun x -> prerr_endline (Lazy.force x)) else (fun _ -> ()) + +(* term ha tipo t1=t2; funziona solo se t1 e t2 hanno in testa costruttori +diversi *) + +let discriminate_tac ~term = + let true_URI = + match LibraryObjects.true_URI () with + Some uri -> uri + | None -> raise (PET.Fail (lazy "You need to register the default \"true\" definition first. Please use the \"default\" command")) in + let false_URI = + match LibraryObjects.false_URI () with + Some uri -> uri + | None -> raise (PET.Fail (lazy "You need to register the default \"false\" definition first. Please use the \"default\" command")) in + let fail msg = raise (PET.Fail (lazy ("Discriminate: " ^ msg))) in + let find_discriminating_consno t1 t2 = + let rec aux t1 t2 = + match t1, t2 with + | C.MutConstruct _, C.MutConstruct _ when t1 = t2 -> None + | C.Appl ((C.MutConstruct _ as constr1) :: args1), + C.Appl ((C.MutConstruct _ as constr2) :: args2) + when constr1 = constr2 -> + let rec aux_list l1 l2 = + match l1, l2 with + | [], [] -> None + | hd1 :: tl1, hd2 :: tl2 -> + (match aux hd1 hd2 with + | None -> aux_list tl1 tl2 + | Some _ as res -> res) + | _ -> (* same constructor applied to a different number of args *) + assert false + in + aux_list args1 args2 + | ((C.MutConstruct (_,_,consno1,subst1)), + (C.MutConstruct (_,_,consno2,subst2))) + | ((C.MutConstruct (_,_,consno1,subst1)), + (C.Appl ((C.MutConstruct (_,_,consno2,subst2)) :: _))) + | ((C.Appl ((C.MutConstruct (_,_,consno1,subst1)) :: _)), + (C.MutConstruct (_,_,consno2,subst2))) + | ((C.Appl ((C.MutConstruct (_,_,consno1,subst1)) :: _)), + (C.Appl ((C.MutConstruct (_,_,consno2,subst2)) :: _))) + when (consno1 <> consno2) || (subst1 <> subst2) -> + Some consno2 + | _ -> fail "not a discriminable equality" + in + aux t1 t2 + in + let mk_branches_and_outtype turi typeno consno context args = + (* a list of "True" except for the element in position consno which + * is "False" *) + match fst (CicEnvironment.get_obj CU.empty_ugraph turi) with + | C.InductiveDefinition (ind_type_list,_,paramsno,_) -> + let _,_,rty,constructor_list = List.nth ind_type_list typeno in + let false_constr_id,_ = List.nth constructor_list (consno - 1) in + let branches = + List.map + (fun (id,cty) -> + (* dubbio: e' corretto ridurre in questo context ??? *) + let red_ty = CR.whd context cty in + let rec aux t k = + match t with + | C.Prod (_,_,target) when (k <= paramsno) -> + S.subst (List.nth args (k-1)) + (aux target (k+1)) + | C.Prod (binder,source,target) when (k > paramsno) -> + C.Lambda (binder, source, (aux target (k+1))) + | _ -> + if (id = false_constr_id) + then (C.MutInd(false_URI,0,[])) + else (C.MutInd(true_URI,0,[])) + in + (S.lift 1 (aux red_ty 1))) + constructor_list in + let outtype = + let seed = ref 0 in + let rec mk_lambdas rev_left_args = + function + 0, args, C.Prod (_,so,ta) -> + C.Lambda + (C.Name (incr seed; "x" ^ string_of_int !seed), + so, + mk_lambdas rev_left_args (0,args,ta)) + | 0, args, C.Sort _ -> + let rec mk_rels = + function + 0 -> [] + | n -> C.Rel n :: mk_rels (n - 1) in + let argsno = List.length args in + C.Lambda + (C.Name "x", + (if argsno + List.length rev_left_args > 0 then + C.Appl + (C.MutInd (turi, typeno, []) :: + (List.map + (S.lift (argsno + 1)) + (List.rev rev_left_args)) @ + mk_rels argsno) + else + C.MutInd (turi,typeno,[])), + C.Sort C.Prop) + | 0, _, _ -> assert false (* seriously screwed up *) + | n, he::tl, C.Prod (_,_,ta) -> + mk_lambdas (he::rev_left_args)(n-1,tl,S.subst he ta) + | n,_,_ -> + assert false (* we should probably reduce in some context *) + in + mk_lambdas [] (paramsno, args, rty) + in + branches, outtype + | _ -> assert false + in + let discriminate'_tac ~term status = + let (proof, goal) = status in + let _,metasenv,_subst,_,_, _ = proof in + let _,context,_ = CicUtil.lookup_meta goal metasenv in + let termty,_ = + CTC.type_of_aux' metasenv context term CU.empty_ugraph + in + match termty with + | C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2] + when LibraryObjects.is_eq_URI equri -> + let turi,typeno,exp_named_subst,args = + match tty with + | (C.MutInd (turi,typeno,exp_named_subst)) -> + turi,typeno,exp_named_subst,[] + | (C.Appl (C.MutInd (turi,typeno,exp_named_subst)::args)) -> + turi,typeno,exp_named_subst,args + | _ -> fail "not a discriminable equality" + in + let consno = + match find_discriminating_consno t1 t2 with + | Some consno -> consno + | None -> fail "discriminating terms are structurally equal" + in + let branches,outtype = + mk_branches_and_outtype turi typeno consno context args + in + PET.apply_tactic + (T.then_ + ~start:(EliminationTactics.elim_type_tac (C.MutInd (false_URI, 0, []))) + ~continuation: + (T.then_ + ~start: + (RT.change_tac + ~pattern:(PET.conclusion_pattern None) + (fun _ m u -> + C.Appl [ + C.Lambda ( C.Name "x", tty, + C.MutCase (turi, typeno, outtype, (C.Rel 1), branches)); + t2 ], + m, u)) + ~continuation: + (T.then_ + ~start: + (ET.rewrite_simpl_tac + ~direction:`RightToLeft + ~pattern:(PET.conclusion_pattern None) + term []) + ~continuation: + (IntroductionTactics.constructor_tac ~n:1)))) status + | _ -> fail "not an equality" + in + PET.mk_tactic (discriminate'_tac ~term) + +let exn_noneq = + PET.Fail (lazy "Injection: not an equality") +let exn_nothingtodo = + PET.Fail (lazy "Nothing to do") +let exn_discrnonind = + PET.Fail (lazy "Discriminate: object is not an Inductive Definition: it's imposible") +let exn_injwronggoal = + PET.Fail (lazy "Injection: goal after cut is not correct") +let exn_noneqind = + PET.Fail (lazy "Injection: not an equality over elements of an inductive type") + +let pp ctx t = + let names = List.map (function Some (n,_) -> Some n | None -> None) ctx in + CicPp.pp t names + +let clear_term first_time lterm = + let clear_term status = + let (proof, goal) = status in + let _,metasenv,_subst,_,_, _ = proof in + let _,context,_ = CicUtil.lookup_meta goal metasenv in + let term, metasenv, _ugraph = lterm context metasenv CU.empty_ugraph in + debug_print (lazy ("\nclear di: " ^ pp context term)); + debug_print (lazy ("nel contesto:\n" ^ CicPp.ppcontext context)); + let g () = if first_time then raise exn_nothingtodo else T.id_tac in + let tactic = match term with + | C.Rel n -> + begin match List.nth context (pred n) with + | Some (C.Name id, _) -> + T.if_ ~fail:(g ()) ~start:(PST.clear ~hyps:[id]) ~continuation:T.id_tac + | _ -> assert false + end + | _ -> g () + in + PET.apply_tactic tactic status + in + PET.mk_tactic clear_term + +let exists context = function + | C.Rel i -> List.nth context (pred i) <> None + | _ -> true + +let recur_on_child_tac ~before ~after = + let recur_on_child status = + let (proof, goal) = status in + let _, metasenv, _subst, _, _, _ = proof in + let _, context, _ = CicUtil.lookup_meta goal metasenv in + debug_print (lazy ("\nrecur_on_child")); + debug_print (lazy ("nel contesto:\n" ^ CicPp.ppcontext context)); + let mk_lterm term c m ug = + let distance = List.length c - List.length context in + S.lift distance term, m, ug + in + let lterm = mk_lterm (Cic.Rel 1) in + let tactic = T.then_ ~start:before ~continuation:(after lterm) in + PET.apply_tactic tactic status + in + PET.mk_tactic recur_on_child + +let injection_tac ~lterm ~i ~continuation ~recur = + let give_name seed = function + | C.Name _ as name -> name + | C.Anonymous -> C.Name (incr seed; "y" ^ string_of_int !seed) + in + let rec mk_rels = function | 0 -> [] | n -> C.Rel n :: (mk_rels (n - 1)) in + let injection_tac status = + let (proof, goal) = status in + (* precondizione: t1 e t2 hanno in testa lo stesso costruttore ma + * differiscono (o potrebbero differire?) nell'i-esimo parametro + * del costruttore *) + let _,metasenv,_subst,_,_, _ = proof in + let _,context,_ = CicUtil.lookup_meta goal metasenv in + let term, metasenv, _ugraph = lterm context metasenv CU.empty_ugraph in + let termty,_ = + CTC.type_of_aux' metasenv context term CU.empty_ugraph + in + debug_print (lazy ("\ninjection su : " ^ pp context termty)); + match termty with (* an equality *) + | C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2] + when LibraryObjects.is_eq_URI equri -> + let turi,typeno,ens,params = + match tty with (* some inductive type *) + | C.MutInd (turi,typeno,ens) -> turi,typeno,ens,[] + | C.Appl (C.MutInd (turi,typeno,ens)::params) -> turi,typeno,ens,params + | _ -> raise exn_noneqind + in + let t1',t2',consno = (* sono i due sottotermini che differiscono *) + match t1,t2 with + | C.Appl ((C.MutConstruct (uri1,typeno1,consno1,ens1))::applist1), + C.Appl ((C.MutConstruct (uri2,typeno2,consno2,ens2))::applist2) + when (uri1 = uri2) && (typeno1 = typeno2) && + (consno1 = consno2) && (ens1 = ens2) -> + (* controllo ridondante *) + List.nth applist1 (pred i),List.nth applist2 (pred i),consno2 + | _ -> assert false + in + let tty',_ = CTC.type_of_aux' metasenv context t1' CU.empty_ugraph in + let patterns,outtype = + match fst (CicEnvironment.get_obj CU.empty_ugraph turi) with + | C.InductiveDefinition (ind_type_list,_,paramsno,_)-> + let left_params, right_params = HExtlib.split_nth paramsno params in + let _,_,_,constructor_list = List.nth ind_type_list typeno in + let i_constr_id,_ = List.nth constructor_list (consno - 1) in + let patterns = + let seed = ref 0 in + List.map + (function (id,cty) -> + let reduced_cty = CR.whd context cty in + let rec aux k = function + | C.Prod (_,_,tgt) when k <= paramsno -> + let left = List.nth left_params (k-1) in + aux (k+1) (S.subst left tgt) + | C.Prod (binder,source,target) when k > paramsno -> + let binder' = give_name seed binder in + C.Lambda (binder',source,(aux (k+1) target)) + | _ -> + let nr_param_constr = k - paramsno - 1 in + if id = i_constr_id then C.Rel (k - i) + else S.lift nr_param_constr t1' + (* + 1 per liftare anche il lambda aggiunto + * esternamente al case *) + in S.lift 1 (aux 1 reduced_cty)) + constructor_list + in + (* this code should be taken from cases_tac *) + let outtype = + let seed = ref 0 in + let rec to_lambdas te head = + match CR.whd context te with + | C.Prod (binder,so,ta) -> + let binder' = give_name seed binder in + C.Lambda (binder',so,to_lambdas ta head) + | _ -> head + in + let rec skip_prods params te = + match params, CR.whd context te with + | [], _ -> te + | left::tl, C.Prod (_,_,ta) -> + skip_prods tl (S.subst left ta) + | _, _ -> assert false + in + let abstracted_tty = + let tty = + List.fold_left (fun x y -> S.subst y x) tty left_params + in + (* non lift, ma subst coi left! *) + match S.lift 1 tty with + | C.MutInd _ as tty' -> tty' + | C.Appl l -> + let keep,abstract = HExtlib.split_nth (paramsno +1) l in + let keep = List.map (S.lift paramsno) keep in + C.Appl (keep@mk_rels (List.length abstract)) + | _ -> assert false + in + match ind_type_list with + | [] -> assert false + | (_,_,ty,_)::_ -> + (* this is in general wrong, do as in cases_tac *) + to_lambdas (skip_prods left_params ty) + (C.Lambda + (C.Name "cased", abstracted_tty, + (* here we should capture right parameters *) + (* 1 for his Lambda, one for the Lambda outside the match + * and then one for each to_lambda *) + S.lift (2+List.length right_params) tty')) + in + patterns,outtype + | _ -> raise exn_discrnonind + in + let cutted = C.Appl [C.MutInd (equri,0,[]) ; tty' ; t1' ; t2'] in + let changed = + C.Appl [ C.Lambda (C.Name "x", tty, + C.MutCase (turi,typeno,outtype,C.Rel 1,patterns)) ; t1] + in + (* check if cutted and changed are well typed and if t1' ~ changed *) + let go_on = + try + let _,g = CTC.type_of_aux' metasenv context cutted + CU.empty_ugraph + in + let _,g = CTC.type_of_aux' metasenv context changed g in + fst (CR.are_convertible ~metasenv context t1' changed g) + with + | CTC.TypeCheckerFailure _ -> false + in + if not go_on then begin + HLog.warn "destruct: injection failed"; + PET.apply_tactic continuation status + end else + let fill_cut_tac term = + let fill_cut status = + debug_print (lazy "riempio il cut"); + let (proof, goal) = status in + let _,metasenv,_subst,_,_, _ = proof in + let _,context,gty = CicUtil.lookup_meta goal metasenv in + let gty = Unshare.unshare gty in + let new_t1' = match gty with + | (C.Appl (C.MutInd (_,_,_)::_::t::_)) -> t + | _ -> raise exn_injwronggoal + in + debug_print (lazy ("metto: " ^ pp context changed)); + debug_print (lazy ("al posto di: " ^ pp context new_t1')); + debug_print (lazy ("nel goal: " ^ pp context gty)); + debug_print (lazy ("nel contesto:\n" ^ CicPp.ppcontext context)); + debug_print (lazy ("e poi rewrite con: "^pp context term)); + let tac = T.seq ~tactics:[ + RT.change_tac + ~pattern:(None, [], Some (PEH.pattern_of ~term:gty [new_t1'])) + (fun _ m u -> changed,m,u); + ET.rewrite_simpl_tac + ~direction:`LeftToRight + ~pattern:(PET.conclusion_pattern None) + term []; + ET.reflexivity_tac + ] in + PET.apply_tactic tac status + in + PET.mk_tactic fill_cut + in + debug_print (lazy ("CUT: " ^ pp context cutted)); + let tactic = + T.thens ~start: (P.cut_tac cutted) + ~continuations:[ + recur_on_child_tac continuation recur; + fill_cut_tac term + ] + in + PET.apply_tactic tactic status + | _ -> raise exn_noneq + in + PET.mk_tactic injection_tac + +let subst_tac ~lterm ~direction ~where ~continuation ~recur = + let subst_tac status = + let (proof, goal) = status in + let _,metasenv,_subst,_,_, _ = proof in + let _,context,_ = CicUtil.lookup_meta goal metasenv in + let term, metasenv, _ugraph = lterm context metasenv CU.empty_ugraph in + debug_print (lazy ("\nsubst " ^ (match direction with `LeftToRight -> "->" | `RightToLeft -> "<-") ^ " di: " ^ pp context term)); + let tactic = match where with + | None -> + debug_print (lazy ("nella conclusione")); + let pattern = PET.conclusion_pattern None in + let tactic = ET.rewrite_tac ~direction ~pattern term [] in + T.then_ ~start:(T.try_tactic ~tactic) ~continuation + | Some name -> + debug_print (lazy ("nella premessa: " ^ name)); + let pattern = None, [name, PET.hole], None in + let start = ET.rewrite_tac ~direction ~pattern term [] in + let ok_tactic = recur_on_child_tac continuation recur in + T.if_ ~start ~continuation:ok_tactic ~fail:continuation + in + PET.apply_tactic tactic status + in + PET.mk_tactic subst_tac + +let rec destruct ~first_time lterm = + let are_convertible hd1 hd2 metasenv context = + fst (CR.are_convertible ~metasenv context hd1 hd2 CU.empty_ugraph) + in + let recur = destruct ~first_time:false in + let destruct status = + let (proof, goal) = status in + let _,metasenv,_subst, _,_, _ = proof in + let _,context,_ = CicUtil.lookup_meta goal metasenv in + let term, metasenv, _ugraph = lterm context metasenv CU.empty_ugraph in + let tactic = if not (first_time || exists context term) then T.id_tac else begin + debug_print (lazy ("\ndestruct di: " ^ pp context term)); + debug_print (lazy ("nel contesto:\n" ^ CicPp.ppcontext context)); + let termty,_ = CTC.type_of_aux' metasenv context term CU.empty_ugraph in + debug_print (lazy ("\ndestruct su: " ^ pp context termty)); + let mk_lterm term c m ug = + let distance = List.length c - List.length context in + S.lift distance term, m, ug + in + let lterm = mk_lterm term in + let mk_subst_chain direction index with_what what = + let k = match term with C.Rel i -> i | _ -> -1 in + let rec traverse_context first_time j = function + | [] -> + let continuation = + T.seq ~tactics:[ + clear_term first_time lterm; + clear_term false (mk_lterm what); + clear_term false (mk_lterm with_what) + ] + in + subst_tac ~direction ~lterm ~where:None ~continuation ~recur + | Some (C.Name name, _) :: tl when j < index && j <> k -> + debug_print (lazy ("\nsubst programmata: cosa: " ^ string_of_int index ^ ", dove: " ^ string_of_int j)); + subst_tac ~direction ~lterm ~where:(Some name) ~recur + ~continuation:(traverse_context false (succ j) tl) + | _ :: tl -> traverse_context first_time (succ j) tl + in + traverse_context first_time 1 context + in + match termty with + | C.Appl [(C.MutInd (equri, 0, [])) ; tty ; t1 ; t2] + when LibraryObjects.is_eq_URI equri -> + begin match t1,t2 with +(* injection part *) + | C.MutConstruct _, + C.MutConstruct _ + when t1 = t2 -> clear_term first_time lterm + | C.Appl (C.MutConstruct _ as mc1 :: applist1), + C.Appl (C.MutConstruct _ as mc2 :: applist2) + when mc1 = mc2 -> + let rec traverse_list first_time i l1 l2 = + match l1, l2 with + | [], [] -> clear_term first_time lterm + | hd1 :: tl1, hd2 :: tl2 -> + if are_convertible hd1 hd2 metasenv context then + traverse_list first_time (succ i) tl1 tl2 + else + injection_tac ~i ~lterm ~recur ~continuation: + (traverse_list false (succ i) tl1 tl2) + | _ -> assert false + (* i 2 termini hanno in testa lo stesso costruttore, + * ma applicato a un numero diverso di termini *) + in + traverse_list first_time 1 applist1 applist2 +(* discriminate part *) + | C.MutConstruct (_,_,consno1,ens1), + C.MutConstruct (_,_,consno2,ens2) + | C.MutConstruct (_,_,consno1,ens1), + C.Appl ((C.MutConstruct (_,_,consno2,ens2))::_) + | C.Appl ((C.MutConstruct (_,_,consno1,ens1))::_), + C.MutConstruct (_,_,consno2,ens2) + | C.Appl ((C.MutConstruct (_,_,consno1,ens1))::_), + C.Appl ((C.MutConstruct (_,_,consno2,ens2))::_) + when (consno1 <> consno2) || (ens1 <> ens2) -> + discriminate_tac ~term +(* subst part *) + | C.Rel _, C.Rel _ when t1 = t2 -> + T.seq ~tactics:[ + clear_term first_time lterm; + clear_term false (mk_lterm t1) + ] + | C.Rel i1, C.Rel i2 when i1 < i2 -> + mk_subst_chain `LeftToRight i1 t2 t1 + | C.Rel i1, C.Rel i2 when i1 > i2 -> + mk_subst_chain `RightToLeft i2 t1 t2 + | C.Rel i1, _ when DTI.does_not_occur i1 t2 -> + mk_subst_chain `LeftToRight i1 t2 t1 + | _, C.Rel i2 when DTI.does_not_occur i2 t1 -> + mk_subst_chain `RightToLeft i2 t1 t2 +(* else part *) + | _ when first_time -> raise exn_nothingtodo + | _ (* when not first time *) -> T.id_tac + end + | _ when first_time -> raise exn_nothingtodo + | _ (* when not first time *) -> T.id_tac + end in + PET.apply_tactic tactic status + in + PET.mk_tactic destruct + +(* destruct performs either injection or discriminate or subst *) +let destruct_tac xterms = + let destruct status = + let (proof, goal) = status in + let _,metasenv,_subst,_,_, _ = proof in + let _,context,_ = CicUtil.lookup_meta goal metasenv in + let mk_lterm term c m ug = + let distance = List.length c - List.length context in + S.lift distance term, m, ug + in + let tactics = match xterms with + | Some terms -> + let map term = destruct ~first_time:false (mk_lterm term) in + List.map map terms + | None -> + let rec mk_tactics first_time i tacs = function + | [] -> List.rev tacs + | Some _ :: tl -> + let lterm = mk_lterm (C.Rel i) in + let tacs = destruct ~first_time lterm :: tacs in + mk_tactics false (succ i) tacs tl + | _ :: tl -> mk_tactics first_time (succ i) tacs tl + in + mk_tactics false 1 [] context + in + PET.apply_tactic (T.seq ~tactics) status + in + PET.mk_tactic destruct diff --git a/components/tactics/destructTactic.mli b/components/tactics/destructTactic.mli new file mode 100644 index 000000000..cc3f0d5cf --- /dev/null +++ b/components/tactics/destructTactic.mli @@ -0,0 +1,30 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* Performs a recursive comparisons of the two sides of an equation + looking for constructors. If the two sides differ on two constructors, + it closes the current goal. If they differ by other two terms it introduces + an equality. *) +val destruct_tac: Cic.term list option -> ProofEngineTypes.tactic diff --git a/components/tactics/doc/Makefile b/components/tactics/doc/Makefile new file mode 100644 index 000000000..b7d8fb45c --- /dev/null +++ b/components/tactics/doc/Makefile @@ -0,0 +1,124 @@ + +# +# Generic makefile for latex +# +# Author: Stefano Zacchiroli +# +# Created: Sun, 29 Jun 2003 12:00:55 +0200 zack +# Last-Modified: Mon, 10 Oct 2005 15:37:12 +0200 zack +# + +######################################################################## + +# list of .tex _main_ files +TEXS = main.tex + +# number of runs of latex (for table of contents, list of figures, ...) +RUNS = 1 + +# do you need bibtex? +BIBTEX = no + +# would you like to use pdflatex? +PDF_VIA_PDFLATEX = yes + +# which formats generated by default ("all" target)? +# (others will be generated by "world" target) +# see AVAILABLE_FORMATS below +BUILD_FORMATS = dvi + +# which format to be shown on "make show" +SHOW_FORMAT = dvi + +######################################################################## + +AVAILABLE_FORMATS = dvi ps ps.gz pdf html + +ADVI = advi +BIBTEX = bibtex +BROWSER = galeon +DVIPDF = dvipdf +DVIPS = dvips +GV = gv +GZIP = gzip +HEVEA = hevea +ISPELL = ispell +LATEX = latex +PDFLATEX = pdflatex +PRINT = lpr +XDVI = xdvi +XPDF = xpdf + +ALL_FORMATS = $(BUILD_FORMATS) +WORLD_FORMATS = $(AVAILABLE_FORMATS) + +all: $(ALL_FORMATS) +world: $(WORLD_FORMATS) + +DVIS = $(TEXS:.tex=.dvi) +PSS = $(TEXS:.tex=.ps) +PSGZS = $(TEXS:.tex=.ps.gz) +PDFS = $(TEXS:.tex=.pdf) +HTMLS = $(TEXS:.tex=.html) + +dvi: $(DVIS) +ps: $(PSS) +ps.gz: $(PSGZS) +pdf: $(PDFS) +html: $(HTMLS) + +show: show$(SHOW_FORMAT) +showdvi: $(DVIS) + $(XDVI) $< +showps: $(PSS) + $(GV) $< +showpdf: $(PDFS) + $(XPDF) $< +showpsgz: $(PSGZS) + $(GV) $< +showps.gz: showpsgz +showhtml: $(HTMLS) + $(BROWSER) $< + +print: $(PSS) + $(PRINT) $^ + +clean: + rm -f \ + $(TEXS:.tex=.dvi) $(TEXS:.tex=.ps) $(TEXS:.tex=.ps.gz) \ + $(TEXS:.tex=.pdf) $(TEXS:.tex=.aux) $(TEXS:.tex=.log) \ + $(TEXS:.tex=.html) $(TEXS:.tex=.out) $(TEXS:.tex=.haux) \ + $(TEXS:.tex=.htoc) $(TEXS:.tex=.tmp) + +%.dvi: %.tex + $(LATEX) $< + if [ "$(BIBTEX)" = "yes" ]; then $(BIBTEX) $*; fi + if [ "$(RUNS)" -gt 1 ]; then \ + for i in seq 1 `expr $(RUNS) - 1`; do \ + $(LATEX) $<; \ + done; \ + fi +ifeq ($(PDF_VIA_PDFLATEX),yes) +%.pdf: %.tex + $(PDFLATEX) $< + if [ "$(BIBTEX)" = "yes" ]; then $(BIBTEX) $*; fi + if [ "$(RUNS)" -gt 1 ]; then \ + for i in seq 1 `expr $(RUNS) - 1`; do \ + $(PDFLATEX) $<; \ + done; \ + fi +else +%.pdf: %.dvi + $(DVIPDF) $< $@ +endif +%.ps: %.dvi + $(DVIPS) $< +%.ps.gz: %.ps + $(GZIP) -c $< > $@ +%.html: %.tex + $(HEVEA) -fix $< + +.PHONY: all ps pdf html clean + +######################################################################## + diff --git a/components/tactics/doc/body.tex b/components/tactics/doc/body.tex new file mode 100644 index 000000000..8b7bbc9b0 --- /dev/null +++ b/components/tactics/doc/body.tex @@ -0,0 +1,474 @@ + +\section{Tinycals: \MATITA{} tacticals} + +\subsection{Introduction} + +% outline: +% - script + +Most of modern mainstream proof assistants enable input of proofs of +propositions using a textual language. Compilation units written in such +languages are sequence of textual \emph{statements} and are usually called +\emph{scripts} as a whole. Scripts are so entangled with proof assistants that +they drived the design of state of the art of their Graphical User Interfaces +(GUIs). Fig.~\ref{fig:proofgeneral} is a screenshot of Proof General, a generic +proof assistant interface based on Emacs widely used and compatible with systems +like Coq, Isabelle, PhoX, LEGO, and many more. Other system specific GUIs exist +but share the same design, understanding it and they way such GUIs are operated +is relevant to our discussion. + +%\begin{figure}[ht] +% \begin{center} +% \includegraphic{pics/pg-coq-screenshot} +% \caption{Proof General: a generic interface for proof assistants} +% \label{fig:proofgeneral} +% \end{center} +%\end{figure} + +% - modo di lavorare + +The paradigm behind such GUIs is quite simple. The window on the left is an +editable text area containing the script and split in two by an \emph{execution +point} (the point where background color changes). The part starting at the +beginning of the script and ending at the marker (distinguishable for having a +light blue background in the picture) contains the sequence of statements which +have already been fed into the system. We will call this former part +\emph{locked area} since the user is not free to change it as her willing. The +remaining part, which extends until the end of the script, is named +\emph{scratch area} and can be freely modified. The window on the right is +read-only for the user and includes at the top the current proof status, when +some proof is ongoing, and at the bottom a message area used for error messages +or other feedback from the system to the user. The user usually proceed +alternating editing of the scratch area and execution point movements (forward +to evaluate statements and backward to retract statements if she need to change +something in the locked area). + +Execution point movements are not free, but constrained by the structure of the +script language used. The granularity is that of statements. In systems like Coq +or \MATITA{} examples of statements are: inductive definitions, theorems, and +tactics. \emph{Tactics} are the building blocks of proofs. For example, the +following script snippet contains a theorem about a relationship of natural +minus with natural plus, along with its proof (line numbers have been added for +the sake of presentation) as it can be found in the standard library of the +\MATITA{} proof assistant: + +%\begin{example} +%\begin{Verbatim} +%theorem eq_minus_minus_minus_plus: \forall n,m,p:nat. (n-m)-p = n-(m+p). +% intros. +% cut (m+p \le n \or m+p \nleq n). +% elim Hcut. +% symmetry. +% apply plus_to_minus. +% rewrite > assoc_plus. +% rewrite > (sym_plus p). +% rewrite < plus_minus_m_m. +% rewrite > sym_plus. +% rewrite < plus_minus_m_m. +% reflexivity. +% apply (trans_le ? (m+p)). +% rewrite < sym_plus. +% apply le_plus_n. +% assumption. +% apply le_plus_to_minus_r. +% rewrite > sym_plus. +% assumption. +% rewrite > (eq_minus_n_m_O n (m+p)). +% rewrite > (eq_minus_n_m_O (n-m) p). +% reflexivity. +% apply le_plus_to_minus. +% apply lt_to_le. +% rewrite < sym_plus. +% apply not_le_to_lt. +% assumption. +% apply lt_to_le. +% apply not_le_to_lt. +% assumption. +% apply (decidable_le (m+p) n). +%qed. +%\end{Verbatim} +%\end{example} + +The script snippet is made of 32 statements, one per line (but this is not a +requirement of the \MATITA{} script language, namely \emph{Grafite}). The first +statement is the assertion that the user want to prove a proposition with a +given type, specified after the ``\texttt{:}'', its execution will cause +\MATITA{} to enter the proof state showing to the user the list of goals that +still need to be proved to conclude the proof. The last statement (\texttt{Qed}) +is an assertion that the proof is completed. All intertwining statements are +tactic applications. + +Given the constraint we mentioned about execution point, while inserting (or +replaying) the above script, the user may position it at the end of any line, +having feedback about the status of the proof in that point. See for example +Fig.~\ref{fig:matita} where an intermediate proof status is shown. + +%\begin{figure}[ht] +% \begin{center} +% \includegraphic{matita_screenshot} +% \caption{Matita: ongoing proof} +% \label{fig:matita} +% \end{center} +%\end{figure} + +% - script: sorgenti di un linguaggio imperativo, oggetti la loro semantica +% - script = sequenza di comandi + +You can create an analogy among scripts and sources written in an imperative +programming language, seeing proofs as the denotational semantics of that +language. In such analogy the language used in the script of +Fig.~\ref{fig:matita} is rather poor offering as the only programming construct +the sequential composition of tactic application. What enables step by step +execution is the operational semantics of each tactic application (i.e. how it +changes the current proof status). + +% - pro: concisi + +This kind of scripts have both advantages and drawbacks. Among advantages we can +for sure list the effectiveness of the language. In spite of being longer than +the corresponding informal text version of the proof (a gap hardly fillable with +proof assistants~\cite{debrujinfactor}), the script is fast to write in +interactive use, enable cut and paste approaches, and gives a lot of flexibility +(once the syntax is known of course) in tactic application via additional flags +that can be easily passed to them. + +% - cons: non strutturati, hanno senso solo via reply + +Unfortunately, drawbacks are non negligible. Scripts like those of +Fig.~\ref{fig:matita} are completely unstructured and hardly can be assigned a +meaning simply looking at them. Even experienced users, that knows the details +of all involved tactics, can hardly figure what a script mean without replaying +the proof in their heads. This indeed is a key aspect of scripts: they are +meaningful via \emph{reply}. People interested in understanding a formal proof +written as a script usually start the preferred tool and execute it step by +step. A contrasting approach compared to what happens with high level +programming languages where looking at the code is usually enough to understand +its details. + +% - cons: poco robusti (wrt cambiamenti nelle tattiche, nello statement, ...) + +Additionally, scripts are usually not robust against changes, intending with +that term both changes in the statement that need to be proved (e.g. +strenghtening of an inductive hypothesis) and changes in the implementation of +involved tactics. This drawback can force backward compatibility and slow down +systems development. A real-life example in the history of \MATITA{} was the +reordering of goals after tactic application; the total time needed to port the +(tiny at the time) standard library of no more that 30 scripts was 2 days work. +Having the scripts being structured the task could have been done in much less +time and even automated. + +Tacticals are an attempt at solving this drawbacks. + +\subsection{Tacticals} + +% - script = sequenza di comandi + tatticali + +\ldots descrizione dei tatticali \ldots + +% - pro: fattorizzazione + +Tacticals as described above have several advantages with respect to plain +sequential application of tactics. First of all they enable a great amount of +factorization of proofs using the sequential composition ``;'' operator. Think +for example at proofs by induction on inductive types with several constructors, +which are so frequent when formalizing properties from the computer science +field. It is often the case that several, or even all, cases can be dealt with +uniform strategies, which can in turn by coded in a single script snipped which +can appear only once, at the right hand side of a ``;''. + +% - pro: robustezza + +Scripts properly written using the tacticals above are even more robust with +respect to changes. The additional amount of flexibility is given by +``conditional'' constructs like \texttt{try}, \texttt{solve}, and +\texttt{first}. Using them the scripts no longer contain a single way of +proceeding from one status of the proof to another, they can list more. The wise +proof coder may exploit this mechanism providing fallbacks in order to be more +robust to future changes in tactics implementation. Of course she is not +required to! + +% - pro: strutturazione delle prove (via branching) + +Finally, the branching constructs \texttt{[}, \texttt{|}, and \texttt{]} enable +proof structuring. Consider for example an alternative, branching based, version +of the example above: + +%\begin{example} +%\begin{Verbatim} +%... +%\end{Verbatim} +%\end{example} + +Tactic applications are the same of the previous version of the script, but +branching tacticals are used. The above version is highly more readable and +without executing it key points of the proofs like induction cases can be +observed. + +% - tradeoff: utilizzo dei tatticali vs granularita' dell'esecuzione +% (impossibile eseguire passo passo) + +One can now wonder why thus all scripts are not written in a robust, concise and +structured fashion. The reason is the existence of an unfortunate tradeoff +between the need of using tacticals and the impossibility of executing step by +step \emph{inside} them. Indeed, trying to mimic the structured version of the +proof above in GUIs like Proof General or CoqIDE will result in a single macro +step that will bring you from the beginning of the proof directly at the end of +it! + +Tinycals as implemented in \MATITA{} are a solution to this problem, preserving +the usual tacticals semantics, giving meaning to intermediate execution point +inside complex tacticals. + +\subsection{Tinycals} + +\subsection{Tinycals semantics} + +\subsubsection{Language} + +\[ +\begin{array}{rcll} + S & ::= & & \mbox{(\textbf{continuationals})}\\ + & & \TACTIC{T} & \mbox{(tactic)}\\[2ex] + & | & \DOT & \mbox{(dot)} \\ + & | & \SEMICOLON & \mbox{(semicolon)} \\ + & | & \BRANCH & \mbox{(branch)} \\ + & | & \SHIFT & \mbox{(shift)} \\ + & | & \POS{i} & \mbox{(relative positioning)} \\ + & | & \MERGE & \mbox{(merge)} \\[2ex] + & | & \FOCUS{g_1,\dots,g_n} & \mbox{(absolute positioning)} \\ + & | & \UNFOCUS & \mbox{(unfocus)} \\[2ex] + & | & S ~ S & \mbox{(sequential composition)} \\[2ex] + T & : := & & \mbox{(\textbf{tactics})}\\ + & & \SKIP & \mbox{(skip)} \\ + & | & \mathtt{reflexivity} & \\ + & | & \mathtt{apply}~t & \\ + & | & \dots & +\end{array} +\] + +\subsubsection{Status} + +\[ +\begin{array}{rcll} + \xi & & & \mbox{(proof status)} \\ + \mathit{goal} & & & \mbox{(proof goal)} \\[2ex] + + \SWITCH & = & \OPEN~\mathit{goal} ~ | ~ \CLOSED~\mathit{goal} & \\ + \mathit{locator} & = & \INT\times\SWITCH & \\ + \mathit{tag} & = & \BRANCHTAG ~ | ~ \FOCUSTAG \\[2ex] + + \Gamma & = & \mathit{locator}~\LIST & \mbox{(context)} \\ + \tau & = & \mathit{locator}~\LIST & \mbox{(todo)} \\ + \kappa & = & \mathit{locator}~\LIST & \mbox{(dot's future)} \\[2ex] + + \mathit{stack} & = & (\Gamma\times\tau\times\kappa\times\mathit{tag})~\LIST + \\[2ex] + + \mathit{status} & = & \xi\times\mathit{stack} \\ +\end{array} +\] + +\paragraph{Utilities} +\begin{itemize} + \item $\ZEROPOS([g_1;\cdots;g_n]) = + [\langle 0,\OPEN~g_1\rangle;\cdots;\langle 0,\OPEN~g_n\rangle]$ + \item $\INITPOS([\langle i_1,s_1\rangle;\cdots;\langle i_n,s_n\rangle]) = + [\langle 1,s_1\rangle;\cdots;\langle n,s_n\rangle]$ + \item $\ISFRESH(s) = + \left\{ + \begin{array}{ll} + \mathit{true} & \mathrm{if} ~ s = \langle n, \OPEN~g\rangle\land n > 0 \\ + \mathit{false} & \mathrm{otherwise} \\ + \end{array} + \right.$ + \item $\FILTEROPEN(\mathit{locs})= + \left\{ + \begin{array}{ll} + [] & \mathrm{if}~\mathit{locs} = [] \\ + \langle i,\OPEN~g\rangle :: \FILTEROPEN(\mathit{tl}) + & \mathrm{if}~\mathit{locs} = \langle i,\OPEN~g\rangle :: \mathit{tl} \\ + \FILTEROPEN(\mathit{tl}) + & \mathrm{if}~\mathit{locs} = \mathit{hd} :: \mathit{tl} \\ + \end{array} + \right.$ + \item $\REMOVEGOALS(G,\mathit{locs}) = + \left\{ + \begin{array}{ll} + [] & \mathrm{if}~\mathit{locs} = [] \\ + \REMOVEGOALS(G,\mathit{tl}) + & \mathrm{if}~\mathit{locs} = \langle i,\OPEN~g\rangle :: \mathit{tl} + \land g\in G\\ + hd :: \REMOVEGOALS(G,\mathit{tl}) + & \mathrm{if}~\mathit{locs} = \mathit{hd} :: \mathit{tl} \\ + \end{array} + \right.$ + \item $\DEEPCLOSE(G,S)$: (intuition) given a set of goals $G$ and a stack $S$ + it returns a new stack $S'$ identical to the given one with the exceptions + that each locator whose goal is in $G$ is marked as closed in $\Gamma$ stack + components and removed from $\tau$ and $\kappa$ components. + \item $\GOALS(S)$: (inutition) return all goals appearing in whatever position + on a given stack $S$, appearing in an \OPEN{} switch. +\end{itemize} + +\paragraph{Invariants} +\begin{itemize} + \item $\forall~\mathrm{entry}~\ENTRY{\Gamma}{\tau}{\kappa}{t}, \forall s + \in\tau\cup\kappa, \exists g, s = \OPEN~g$ (each locator on the stack in + $\tau$ and $\kappa$ components has an \OPEN~switch). + \item Unless \FOCUS{} is used the stack contains no duplicate goals. + \item $\forall~\mathrm{locator}~l\in\Gamma \mbox{(with the exception of the + top-level $\Gamma$)}, \ISFRESH(l)$. +\end{itemize} + +\subsubsection{Semantics} + +\[ +\begin{array}{rcll} + \SEMOP{\cdot} & : & C -> \mathit{status} -> \mathit{status} & + \mbox{(continuationals semantics)} \\ + \TSEMOP{\cdot} & : & T -> \xi -> \SWITCH -> + \xi\times\GOAL~\LIST\times\GOAL~\LIST & \mbox{(tactics semantics)} \\ +\end{array} +\] + +\[ +\begin{array}{rcl} + \mathit{apply\_tac} & : & T -> \xi -> \GOAL -> + \xi\times\GOAL~\LIST\times\GOAL~\LIST +\end{array} +\] + +\[ +\begin{array}{rlcc} + \TSEM{T}{\xi}{\OPEN~g} & = & \mathit{apply\_tac}(T,\xi,n) & T\neq\SKIP\\ + \TSEM{\SKIP}{\xi}{\CLOSED~g} & = & \langle \xi, [], [g]\rangle & +\end{array} +\] + +\[ +\begin{array}{rcl} + + \SEM{\TACTIC{T}}{\ENTRY{\GIN}{\tau}{\kappa}{t}::S} + & = + & \langle + \xi_n, + \ENTRY{\Gamma'}{\tau'}{\kappa'}{t} +% \ENTRY{\ZEROPOS(G^o_n)}{\tau\setminus G^c_n}{\kappa\setminus G^o_n}{t} + :: \DEEPCLOSE(G^c_n,S) + \rangle + \\[1ex] + \multicolumn{3}{l}{\hspace{\sidecondlen}\mathit{where} ~ n\geq 1} + \\[1ex] + \multicolumn{3}{l}{\hspace{\sidecondlen}\mathit{and} ~ + \Gamma' = \ZEROPOS(G^o_n) + \land \tau' = \REMOVEGOALS(G^c_n,\tau) + \land \kappa' = \REMOVEGOALS(G^o_n,\kappa) + } + \\[1ex] + \multicolumn{3}{l}{\hspace{\sidecondlen}\mathit{and} ~ + \left\{ + \begin{array}{rcll} + \langle\xi_0, G^o_0, G^c_0\rangle & = & \langle\xi, [], []\rangle \\ + \langle\xi_{i+1}, G^o_{i+1}, G^c_{i+1}\rangle + & = + & \langle\xi_i, G^o_i, G^c_i\rangle + & l_{i+1}\in G^c_i \\ + \langle\xi_{i+1}, G^o_{i+1}, G^c_{i+1}\rangle + & = + & \langle\xi, (G^o_i\setminus G^c)\cup G^o, G^c_i\cup G^c\rangle + & l_{i+1}\not\in G^c_i \\[1ex] + & & \mathit{where} ~ \langle\xi,G^o,G^c\rangle=\TSEM{T}{\xi_i}{l_{i+1}} \\ + \end{array} + \right. + } + \\[6ex] + + \SEM{~\DOT~}{\ENTRY{\Gamma}{\tau}{\kappa}{t}::S} + & = + & \langle \xi, \ENTRY{l_1}{\tau}{\GIN[2]\cup\kappa}{t}::S \rangle + \\[1ex] + & & \mathrm{where} ~ \FILTEROPEN(\Gamma)=\GIN \land n\geq 1 + \\[2ex] + + \SEM{~\DOT~}{\ENTRY{\Gamma}{\tau}{l::\kappa}{t}::S} + & = + & \langle \xi, \ENTRY{[l]}{\tau}{\kappa}{t}::S \rangle + \\[1ex] + & & \mathrm{where} ~ \FILTEROPEN(\Gamma)=[] + \\[2ex] + + \SEM{~\SEMICOLON~}{S} & = & \langle \xi, S \rangle \\[1ex] + + \SEM{~\BRANCH~}{\ENTRY{\GIN}{\tau}{\kappa}{t}::S} + \quad + & = + & \langle\xi, \ENTRY{[l_1']}{[]}{[]}{\BRANCHTAG} + ::\ENTRY{[l_2';\cdots;l_n']}{\tau}{\kappa}{t}::S + \\[1ex] + & & \mathrm{where} ~ n\geq 2 ~ \land ~ \INITPOS(\GIN)=[l_1';\cdots;l_n'] + \\[2ex] + + \SEM{~\SHIFT~} + {\ENTRY{\Gamma}{\tau}{\kappa}{\BRANCHTAG}::\ENTRY{\GIN}{\tau'}{\kappa'}{t'} + ::S} + & = + & \langle + \xi, \ENTRY{[l_1]}{\tau\cup\FILTEROPEN(\Gamma)}{[]}{\BRANCHTAG} + ::\ENTRY{\GIN[2]}{\tau'}{\kappa'}{t'}::S + \rangle + \\[1ex] + & & \mathrm{where} ~ n\geq 1 + \\[2ex] + + \SEM{~\POS{i}~} + {\ENTRY{[l]}{[]}{[]}{\BRANCHTAG}::\ENTRY{\Gamma'}{\tau'}{\kappa'}{t'}::S} + & = + & \langle \xi, \ENTRY{[l_i]}{[]}{[]}{\BRANCHTAG} + ::\ENTRY{l :: (\Gamma'\setminus [l_i])}{\tau'}{\kappa'}{t'}::S \rangle + \\[1ex] + & & \mathrm{where} ~ \langle i,l'\rangle = l_i\in \Gamma'~\land~\ISFRESH(l) + \\[2ex] + + \SEM{~\POS{i}~} + {\ENTRY{\Gamma}{\tau}{\kappa}{\BRANCHTAG} + ::\ENTRY{\Gamma'}{\tau'}{\kappa'}{t'}::S} + & = + & \langle \xi, \ENTRY{[l_i]}{[]}{[]}{\BRANCHTAG} + ::\ENTRY{\Gamma'\setminus [l_i]}{\tau'\cup\FILTEROPEN(\Gamma)}{\kappa'}{t'}::S + \rangle + \\[1ex] + & & \mathrm{where} ~ \langle i, l'\rangle = l_i\in \Gamma' + \\[2ex] + + \SEM{~\MERGE~} + {\ENTRY{\Gamma}{\tau}{\kappa}{\BRANCHTAG}::\ENTRY{\Gamma'}{\tau'}{\kappa'}{t'} + ::S} + & = + & \langle \xi, + \ENTRY{\tau\cup\FILTEROPEN(\Gamma)\cup\Gamma'\cup\kappa}{\tau'}{\kappa'}{t'} + :: S + \rangle + \\[2ex] + + \SEM{\FOCUS{g_1,\dots,g_n}}{S} + & = + & \langle \xi, \ENTRY{\ZEROPOS([g_1;\cdots;g_n])}{[]}{[]}{\FOCUSTAG} + ::\DEEPCLOSE(S) + \rangle + \\[1ex] + & & \mathrm{where} ~ + \forall i=1,\dots,n,~g_i\in\GOALS(S) + \\[2ex] + + \SEM{\UNFOCUS}{\ENTRY{[]}{[]}{[]}{\FOCUSTAG}::S} + & = + & \langle \xi, S\rangle \\[2ex] + +\end{array} +\] + +\subsection{Related works} + +In~\cite{fk:strata2003}, Kirchner described a small step semantics for Coq +tacticals and PVS strategies. + diff --git a/components/tactics/doc/infernce.sty b/components/tactics/doc/infernce.sty new file mode 100644 index 000000000..fc4afeaaf --- /dev/null +++ b/components/tactics/doc/infernce.sty @@ -0,0 +1,217 @@ +%% +%% This is file `infernce.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% semantic.dtx (with options: `allOptions,inference') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from infernce.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file semantic.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% semantic.dtx (c)1995--2002 Peter M^^f8ller Neergaard and +%% Arne John Glenstrup +%% +\expandafter\ifx\csname sem@nticsLoader\endcsname\relax + \PackageError{semantic}{% + This file should not be loaded directly} + {% + This file is an option of the semantic package. It should not be + loaded directly\MessageBreak + but by using \protect\usepackage{semantic} in your document + preamble.\MessageBreak + No commands are defined.\MessageBreak + Type to proceed. + }% +\else +\TestForConflict{\@@tempa,\@@tempb,\@adjustPremises,\@inference} +\TestForConflict{\@inferenceBack,\@inferenceFront,\@inferenceOrPremis} +\TestForConflict{\@premises,\@processInference,\@processPremiseLine} +\TestForConflict{\@setLengths,\inference,\predicate,\predicatebegin} +\TestForConflict{\predicateend,\setnamespace,\setpremisesend} +\TestForConflict{\setpremisesspace,\@makeLength,\@@space} +\TestForConflict{\@@aLineBox,\if@@shortDivider} +\newtoks\@@tempa +\newtoks\@@tempb +\newcommand{\@makeLength}[4]{ + \@@tempa=\expandafter{\csname @@#2\endcsname} + \@@tempb=\expandafter{\csname @set#2\endcsname} % + \expandafter \newlength \the\@@tempa + \expandafter \newcommand \the\@@tempb {} + \expandafter \newcommand \csname set#1\endcsname[1]{} + \expandafter \xdef \csname set#1\endcsname##1% + {{\dimen0=##1}% + \noexpand\renewcommand{\the\@@tempb}{% + \noexpand\setlength{\the \@@tempa}{##1 #4}}% + }% + \csname set#1\endcsname{#3} + \@@tempa=\expandafter{\@setLengths} % + \edef\@setLengths{\the\@@tempa \the\@@tempb} % + } + +\newcommand{\@setLengths}{% + \setlength{\baselineskip}{1.166em}% + \setlength{\lineskip}{1pt}% + \setlength{\lineskiplimit}{1pt}} +\@makeLength{premisesspace}{pSpace}{1.5em}{plus 1fil} +\@makeLength{premisesend}{pEnd}{.75em}{plus 0.5fil} +\@makeLength{namespace}{nSpace}{.5em}{} +\newbox\@@aLineBox +\newif\if@@shortDivider +\newcommand{\@@space}{ } +\newcommand{\predicate}[1]{\predicatebegin #1\predicateend} +\newcommand{\predicatebegin}{$} +\newcommand{\predicateend}{$} +\def\inference{% + \@@shortDividerfalse + \expandafter\hbox\bgroup + \@ifstar{\@@shortDividertrue\@inferenceFront}% + \@inferenceFront +} +\def\@inferenceFront{% + \@ifnextchar[% + {\@inferenceFrontName}% + {\@inferenceMiddle}% +} +\def\@inferenceFrontName[#1]{% + \setbox3=\hbox{\footnotesize #1}% + \ifdim \wd3 > \z@ + \unhbox3% + \hskip\@@nSpace + \fi + \@inferenceMiddle +} +\long\def\@inferenceMiddle#1{% + \@setLengths% + \setbox\@@pBox= + \vbox{% + \@premises{#1}% + \unvbox\@@pBox + }% + \@inferenceBack +} +\long\def\@inferenceBack#1{% + \setbox\@@cBox=% + \hbox{\hskip\@@pEnd \predicate{\ignorespaces#1}\unskip\hskip\@@pEnd}% + \setbox1=\hbox{$ $}% + \setbox\@@pBox=\vtop{\unvbox\@@pBox + \vskip 4\fontdimen8\textfont3}% + \setbox\@@cBox=\vbox{\vskip 4\fontdimen8\textfont3% + \box\@@cBox}% + \if@@shortDivider + \ifdim\wd\@@pBox >\wd\@@cBox% + \dimen1=\wd\@@pBox% + \else% + \dimen1=\wd\@@cBox% + \fi% + \dimen0=\wd\@@cBox% + \hbox to \dimen1{% + \hss + $\frac{\hbox to \dimen0{\hss\box\@@pBox\hss}}% + {\box\@@cBox}$% + \hss + }% + \else + $\frac{\box\@@pBox}% + {\box\@@cBox}$% + \fi + \@ifnextchar[% + {\@inferenceBackName}%{}% + {\egroup} +} +\def\@inferenceBackName[#1]{% + \setbox3=\hbox{\footnotesize #1}% + \ifdim \wd3 > \z@ + \hskip\@@nSpace + \unhbox3% + \fi + \egroup +} +\newcommand{\@premises}[1]{% + \setbox\@@pBox=\vbox{}% + \dimen\@@maxwidth=\wd\@@cBox% + \@processPremises #1\\\end% + \@adjustPremises% +} +\newcommand{\@adjustPremises}{% + \setbox\@@pBox=\vbox{% + \@@moreLinestrue % + \loop % + \setbox\@@pBox=\vbox{% + \unvbox\@@pBox % + \global\setbox\@@aLineBox=\lastbox % + }% + \ifvoid\@@aLineBox % + \@@moreLinesfalse % + \else % + \hbox to \dimen\@@maxwidth{\unhbox\@@aLineBox}% + \fi % + \if@@moreLines\repeat% + }% +} +\def\@processPremises#1\\#2\end{% + \setbox\@@pLineBox=\hbox{}% + \@processPremiseLine #1&\end% + \setbox\@@pLineBox=\hbox{\unhbox\@@pLineBox \unskip}% + \ifdim \wd\@@pLineBox > \z@ % + \setbox\@@pLineBox=% + \hbox{\hskip\@@pEnd \unhbox\@@pLineBox \hskip\@@pEnd}% + \ifdim \wd\@@pLineBox > \dimen\@@maxwidth % + \dimen\@@maxwidth=\wd\@@pLineBox % + \fi % + \setbox\@@pBox=\vbox{\box\@@pLineBox\unvbox\@@pBox}% + \fi % + \def\sem@tmp{#2}% + \ifx \sem@tmp\empty \else % + \@ReturnAfterFi{% + \@processPremises #2\end % + }% + \fi% +} +\def\@processPremiseLine#1\end{% + \def\sem@tmp{#1}% + \ifx \sem@tmp\empty \else% + \ifx \sem@tmp\@@space \else% + \setbox\@@pLineBox=% + \hbox{\unhbox\@@pLineBox% + \@inferenceOrPremis #1\inference\end% + \hskip\@@pSpace}% + \fi% + \fi% + \def\sem@tmp{#2}% + \ifx \sem@tmp\empty \else% + \@ReturnAfterFi{% + \@processPremiseLine#2\end% + }% + \fi% +} +\def\@inferenceOrPremis#1\inference{% + \@ifnext \end + {\@dropnext{\predicate{\ignorespaces #1}\unskip}}% + {\@processInference #1\inference}% +} +\def\@processInference#1\inference\end{% + \ignorespaces #1% + \setbox3=\lastbox + \dimen3=\dp3 + \advance\dimen3 by -\fontdimen22\textfont2 + \advance\dimen3 by \fontdimen8\textfont3 + \expandafter\raise\dimen3\box3% +} +\long\def\@ReturnAfterFi#1\fi{\fi#1} +\fi +\endinput +%% +%% End of file `infernce.sty'. diff --git a/components/tactics/doc/ligature.sty b/components/tactics/doc/ligature.sty new file mode 100644 index 000000000..a914d91d1 --- /dev/null +++ b/components/tactics/doc/ligature.sty @@ -0,0 +1,169 @@ +%% +%% This is file `ligature.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% semantic.dtx (with options: `allOptions,ligature') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from ligature.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file semantic.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% semantic.dtx (c)1995--2002 Peter M^^f8ller Neergaard and +%% Arne John Glenstrup +%% +\expandafter\ifx\csname sem@nticsLoader\endcsname\relax + \PackageError{semantic}{% + This file should not be loaded directly} + {% + This file is an option of the semantic package. It should not be + loaded directly\MessageBreak + but by using \protect\usepackage{semantic} in your document + preamble.\MessageBreak + No commands are defined.\MessageBreak + Type to proceed. + }% +\else +\TestForConflict{\@addligto,\@addligtofollowlist,\@def@ligstep} +\TestForConflict{\@@trymathlig,\@defactive,\@defligstep} +\TestForConflict{\@definemathlig,\@domathligfirsts,\@domathligfollows} +\TestForConflict{\@exitmathlig,\@firstmathligs,\@ifactive,\@ifcharacter} +\TestForConflict{\@ifinlist,\@lastvalidmathlig,\@mathliglink} +\TestForConflict{\@mathligredefactive,\@mathligsoff,\@mathligson} +\TestForConflict{\@seentoks,\@setupfirstligchar,\@try@mathlig} +\TestForConflict{\@trymathlig,\if@mathligon,\mathlig,\mathligprotect} +\TestForConflict{\mathligsoff,\mathligson,\@startmathlig,\@pushedtoks} +\newif\if@mathligon +\DeclareRobustCommand\mathlig[1]{\@addligtolists#1\@@ + \if@mathligon\mathligson\fi + \@setupfirstligchar#1\@@ + \@defligstep{}#1\@@} +\def\@mathligson{\if@mathligon\mathligson\fi} +\def\@mathligsoff{\if@mathligon\mathligsoff\@mathligontrue\fi} +\DeclareRobustCommand\mathligprotect[1]{\expandafter + \def\expandafter#1\expandafter{% + \expandafter\@mathligsoff#1\@mathligson}} +\DeclareRobustCommand\mathligson{\def\do##1##2##3{\mathcode`##1="8000}% + \@domathligfirsts\@mathligontrue} +\AtBeginDocument{\mathligson} +\DeclareRobustCommand\mathligsoff{\def\do##1##2##3{\mathcode`##1=##2}% + \@domathligfirsts\@mathligonfalse} +\edef\@mathliglink{Error: \noexpand\verb|\string\@mathliglink| expanded} +{\catcode`\A=11\catcode`\1=12\catcode`\~=13 % Letter, Other and Active +\gdef\@ifcharacter#1{\ifcat A\noexpand#1\let\next\@firstoftwo + \else\ifcat 1\noexpand#1\let\next\@firstoftwo + \else\ifcat \noexpand~\noexpand#1\let\next\@firstoftwo + \else\let\next\@secondoftwo\fi\fi\fi\next}% +\gdef\@ifactive#1{\ifcat \noexpand~\noexpand#1\let\next\@firstoftwo + \else\let\next\@secondoftwo\fi\next}} +\def\@domathligfollows{}\def\@domathligfirsts{} +\def\@makemathligsactive{\mathligson + \def\do##1##2##3{\catcode`##1=12}\@domathligfollows} +\def\@makemathligsnormal{\mathligsoff + \def\do##1##2##3{\catcode`##1=##3}\@domathligfollows} +\def\@ifinlist#1#2{\@tempswafalse + \def\do##1##2##3{\ifnum`##1=`#2\relax\@tempswatrue\fi}#1% + \if@tempswa\let\next\@firstoftwo\else\let\next\@secondoftwo\fi\next} +\def\@addligto#1#2{% + \@ifinlist#1#2{\def\do##1##2##3{\noexpand\do\noexpand##1% + \ifnum`##1=`#2 {\the\mathcode`#2}{\the\catcode`#2}% + \else{##2}{##3}\fi}% + \edef#1{#1}}% + {\def\do##1##2##3{\noexpand\do\noexpand##1% + \ifnum`##1=`#2 {\the\mathcode`#2}{\the\catcode`#2}% + \else{##2}{##3}\fi}% + \edef#1{#1\do#2{\the\mathcode`#2}{\the\catcode`#2}}}} +\def\@addligtolists#1{\expandafter\@addligto + \expandafter\@domathligfirsts + \csname\string#1\endcsname\@addligtofollowlist} +\def\@addligtofollowlist#1{\ifx#1\@@\let\next\relax\else + \def\next{\expandafter\@addligto + \expandafter\@domathligfollows + \csname\string#1\endcsname + \@addligtofollowlist}\fi\next} +\def\@defligstep#1#2{\def\@tempa##1{\ifx##1\endcsname + \expandafter\endcsname\else + \string##1\expandafter\@tempa\fi}% + \expandafter\@def@ligstep\csname @mathlig\@tempa#1#2\endcsname{#1#2}} +\def\@def@ligstep#1#2#3{% + \ifx#3\@@ + \def\next{\def#1}% + \else + \ifx#1\relax + \def\next{\let#1\@mathliglink\@defligstep{#2}#3}% + \else + \def\next{\@defligstep{#2}#3}% + \fi + \fi\next} +\def\@setupfirstligchar#1#2\@@{% + \@ifactive{#1}{% + \expandafter\expandafter\expandafter\@mathligredefactive + \expandafter\string\expandafter#1\expandafter{#1}{#1}}% + {\@defactive#1{\@startmathlig #1}\@namedef{@mathlig#1}{#1}}} +\def\@mathligredefactive#1#2#3{% + \def#3{{}\ifmmode\def\next{\@startmathlig#1}\else + \def\next{#2}\fi\next}% + \@namedef{@mathlig#1}{#2}} +\def\@defactive#1{\@ifundefined{@definemathlig\string#1}% + {\@latex@error{Illegal first character in math ligature} + {You can only use \@firstmathligs\space as the first^^J + character of a math ligature}}% + {\csname @definemathlig\string#1\endcsname}} + +{\def\@firstmathligs{}\def\do#1{\catcode`#1=\active + \expandafter\gdef\expandafter\@firstmathligs + \expandafter{\@firstmathligs\space\string#1}\next} + \def\next#1{\expandafter\gdef\csname + @definemathlig\string#1\endcsname{\def#1}} + \do{"}"\do{@}@\do{/}/\do{(}(\do{)})\do{[}[\do{]}]\do{=}= + \do{?}?\do{!}!\do{`}`\do{'}'\do{|}|\do{~}~\do{<}<\do{>}> + \do{+}+\do{-}-\do{*}*\do{.}.\do{,},\do{:}:\do{;};} +\newtoks\@pushedtoks +\newtoks\@seentoks +\def\@startmathlig{\def\@lastvalidmathlig{}\@pushedtoks{}% + \@seentoks{}\@trymathlig} +\def\@trymathlig{\futurelet\next\@@trymathlig} +\def\@@trymathlig{\@ifcharacter\next{\@try@mathlig}{\@exitmathlig{}}} +\def\@exitmathlig#1{% + \expandafter\@makemathligsnormal\@lastvalidmathlig\mathligson + \the\@pushedtoks#1} +\def\@try@mathlig#1{%\typeout{char: #1 catcode: \the\catcode`#1 + \@ifundefined{@mathlig\the\@seentoks#1}{\@exitmathlig{#1}}% + {\expandafter\ifx + \csname @mathlig\the\@seentoks#1\endcsname + \@mathliglink + \expandafter\@pushedtoks + \expandafter=\expandafter{\the\@pushedtoks#1}% + \else + \expandafter\let\expandafter\@lastvalidmathlig + \csname @mathlig\the\@seentoks#1\endcsname + \@pushedtoks={}% + \fi + \expandafter\@seentoks\expandafter=\expandafter% + {\the\@seentoks#1}\@makemathligsactive\obeyspaces\@trymathlig}} +\edef\patch@newmcodes@{% + \mathcode\number`\'=39 + \mathcode\number`\*=42 + \mathcode\number`\.=\string "613A + \mathchardef\noexpand\std@minus=\the\mathcode`\-\relax + \mathcode\number`\-=45 + \mathcode\number`\/=47 + \mathcode\number`\:=\string "603A\relax +} +\AtBeginDocument{\let\newmcodes@=\patch@newmcodes@} +\fi +\endinput +%% +%% End of file `ligature.sty'. diff --git a/components/tactics/doc/main.tex b/components/tactics/doc/main.tex new file mode 100644 index 000000000..06952d61c --- /dev/null +++ b/components/tactics/doc/main.tex @@ -0,0 +1,70 @@ +\documentclass[a4paper]{article} + +\usepackage{a4wide} +\usepackage{pifont} +\usepackage{semantic} +\usepackage{stmaryrd} +\usepackage{graphicx} + +\newcommand{\MATITA}{\ding{46}\textsf{\textbf{Matita}}} + +\title{Continuationals semantics for \MATITA} +\author{Claudio Sacerdoti Coen \quad Enrico Tassi \quad Stefano Zacchiroli \\ +\small Department of Computer Science, University of Bologna \\ +\small Mura Anteo Zamboni, 7 -- 40127 Bologna, ITALY \\ +\small \{\texttt{sacerdot}, \texttt{tassi}, \texttt{zacchiro}\}\texttt{@cs.unibo.it}} + +\newcommand{\MATHIT}[1]{\ensuremath{\mathit{#1}}} +\newcommand{\MATHTT}[1]{\ensuremath{\mathtt{#1}}} + +\newcommand{\DOT}{\ensuremath{\mbox{\textbf{.}}}} +\newcommand{\SEMICOLON}{\ensuremath{\mbox{\textbf{;}}}} +\newcommand{\BRANCH}{\ensuremath{\mbox{\textbf{[}}}} +\newcommand{\SHIFT}{\ensuremath{\mbox{\textbf{\textbar}}}} +\newcommand{\POS}[1]{\ensuremath{#1\mbox{\textbf{:}}}} +\newcommand{\MERGE}{\ensuremath{\mbox{\textbf{]}}}} +\newcommand{\FOCUS}[1]{\ensuremath{\mathtt{focus}~#1}} +\newcommand{\UNFOCUS}{\ensuremath{\mathtt{unfocus}}} +\newcommand{\SKIP}{\MATHTT{skip}} +\newcommand{\TACTIC}[1]{\ensuremath{\mathtt{tactic}~#1}} + +\newcommand{\APPLY}[1]{\ensuremath{\mathtt{apply}~\mathit{#1}}} + +\newcommand{\GOAL}{\MATHIT{goal}} +\newcommand{\SWITCH}{\MATHIT{switch}} +\newcommand{\LIST}{\MATHTT{list}} +\newcommand{\INT}{\MATHTT{int}} +\newcommand{\OPEN}{\MATHTT{Open}} +\newcommand{\CLOSED}{\MATHTT{Closed}} + +\newcommand{\SEMOP}[1]{|[#1|]} +\newcommand{\TSEMOP}[1]{{}_t|[#1|]} +\newcommand{\SEM}[3][\xi]{\SEMOP{#2}_{{#1},{#3}}} +\newcommand{\ENTRY}[4]{\langle#1,#2,#3,#4\rangle} +\newcommand{\TSEM}[3]{\TSEMOP{#1}_{#2,#3}} + +\newcommand{\GIN}[1][1]{\ensuremath{[l_{#1};\cdots;l_n]}} + +\newcommand{\ZEROPOS}{\MATHIT{zero\_pos}} +\newcommand{\INITPOS}{\MATHIT{init\_pos}} +\newcommand{\ISFRESH}{\MATHIT{is\_fresh}} +\newcommand{\FILTER}{\MATHIT{filter}} +\newcommand{\FILTEROPEN}{\MATHIT{filter\_open}} +\newcommand{\ISOPEN}{\MATHIT{is\_open}} +\newcommand{\DEEPCLOSE}{\MATHIT{deep\_close}} +\newcommand{\REMOVEGOALS}{\MATHIT{remove\_goals}} +\newcommand{\GOALS}{\MATHIT{open\_goals}} + +\newcommand{\BRANCHTAG}{\ensuremath{\mathtt{B}}} +\newcommand{\FOCUSTAG}{\ensuremath{\mathtt{F}}} + +\newlength{\sidecondlen} +\setlength{\sidecondlen}{2cm} + +\begin{document} +\maketitle + +\input{body.tex} + +\end{document} + diff --git a/components/tactics/doc/reserved.sty b/components/tactics/doc/reserved.sty new file mode 100644 index 000000000..c0d56b8aa --- /dev/null +++ b/components/tactics/doc/reserved.sty @@ -0,0 +1,80 @@ +%% +%% This is file `reserved.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% semantic.dtx (with options: `allOptions,reservedWords') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from reserved.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file semantic.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% semantic.dtx (c)1995--2002 Peter M^^f8ller Neergaard and +%% Arne John Glenstrup +%% +\expandafter\ifx\csname sem@nticsLoader\endcsname\relax + \PackageError{semantic}{% + This file should not be loaded directly} + {% + This file is an option of the semantic package. It should not be + loaded directly\MessageBreak + but by using \protect\usepackage{semantic} in your document + preamble.\MessageBreak + No commands are defined.\MessageBreak + Type to proceed. + }% +\else +\TestForConflict{\reservestyle,\@reservestyle,\setreserved,\<} +\TestForConflict{\@parseDefineReserved,\@xparseDefineReserved} +\TestForConflict{\@defineReserved,\@xdefineReserved} +\newcommand{\reservestyle}[3][]{ + \newcommand{#2}{\@parseDefineReserved{#1}{#3}} + \expandafter\expandafter\expandafter\def + \expandafter\csname set\expandafter\@gobble\string#2\endcsname##1% + {#1{#3{##1}}}} +\newtoks\@@spacing +\newtoks\@@formating +\def\@parseDefineReserved#1#2{% + \@ifnextchar[{\@xparseDefineReserved{#2}}% + {\@xparseDefineReserved{#2}[#1]}} +\def\@xparseDefineReserved#1[#2]#3{% + \@@formating{#1}% + \@@spacing{#2}% + \expandafter\@defineReserved#3,\end +} +\def\@defineReserved#1,{% + \@ifnextchar\end + {\@xdefineReserved #1[]\END\@gobble}% + {\@xdefineReserved#1[]\END\@defineReserved}} +\def\@xdefineReserved#1[#2]#3\END{% + \def\reserved@a{#2}% + \ifx \reserved@a\empty \toks0{#1}\else \toks0{#2} \fi + \expandafter\edef\csname\expandafter<#1>\endcsname + {\the\@@formating{\the\@@spacing{\the\toks0}}}} +\def\setreserved#1>{% + \expandafter\let\expandafter\reserved@a\csname<#1>\endcsname + \@ifundefined{reserved@a}{\PackageError{Semantic} + {``#1'' is not defined as a reserved word}% + {Before referring to a name as a reserved word, it % + should be defined\MessageBreak using an appropriate style + definer. A style definer is defined \MessageBreak + using \protect\reservestyle.\MessageBreak% + Type to proceed --- nothing will be set.}}% + {\reserved@a}} +\let\<=\setreserved +\fi +\endinput +%% +%% End of file `reserved.sty'. diff --git a/components/tactics/doc/semantic.sty b/components/tactics/doc/semantic.sty new file mode 100644 index 000000000..98257cab8 --- /dev/null +++ b/components/tactics/doc/semantic.sty @@ -0,0 +1,137 @@ +%% +%% This is file `semantic.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% semantic.dtx (with options: `general') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from semantic.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file semantic.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% semantic.dtx (c)1995--2002 Peter M^^f8ller Neergaard and +%% Arne John Glenstrup +%% +\NeedsTeXFormat{LaTeX2e} +\newcommand{\semanticVersion}{2.0(epsilon)} +\newcommand{\semanticDate}{2003/10/28} +\ProvidesPackage{semantic} + [\semanticDate\space v\semanticVersion\space] +\typeout{Semantic Package v\semanticVersion\space [\semanticDate]} +\typeout{CVSId: $Id$} +\newcounter{@@conflict} +\newcommand{\@semanticNotDefinable}{% + \typeout{Command \@backslashchar\reserved@a\space already defined} + \stepcounter{@@conflict}} +\newcommand{\@oldNotDefinable}{} +\let\@oldNotDefinable=\@notdefinable +\let\@notdefinable=\@semanticNotDefinable +\newcommand{\TestForConflict}{} +\def\TestForConflict#1{\sem@test #1,,} +\newcommand{\sem@test}{} +\newcommand{\sem@tmp}{} +\newcommand{\@@next}{} +\def\sem@test#1,{% + \def\sem@tmp{#1}% + \ifx \sem@tmp\empty \let\@@next=\relax \else + \@ifdefinable{#1}{} \let\@@next=\sem@test \fi + \@@next} +\TestForConflict{\@inputLigature,\@inputInference,\@inputTdiagram} +\TestForConflict{\@inputReservedWords,\@inputShorthand} +\TestForConflict{\@ddInput,\sem@nticsLoader,\lo@d} +\def\@inputLigature{\input{ligature.sty}\message{ math mode ligatures,}% + \let\@inputLigature\relax} +\def\@inputInference{\input{infernce.sty}\message{ inference rules,}% + \let\@inputInference\relax} +\def\@inputTdiagram{\input{tdiagram.sty}\message{ T diagrams,}% + \let\@inputTdiagram\relax} +\def\@inputReservedWords{\input{reserved.sty}\message{ reserved words,}% + \let\@inputReservedWords\relax} +\def\@inputShorthand{\input{shrthand.sty}\message{ short hands,}% + \let\@inputShorthand\relax} +\toks1={} +\newcommand{\@ddInput}[1]{% + \toks1=\expandafter{\the\toks1\noexpand#1}} +\DeclareOption{ligature}{\@ddInput\@inputLigature} +\DeclareOption{inference}{\@ddInput\@inputInference} +\DeclareOption{tdiagram}{\@ddInput\@inputTdiagram} +\DeclareOption{reserved}{\@ddInput\@inputReservedWords} +\DeclareOption{shorthand}{\@ddInput\@inputLigature + \@ddInput\@inputShorthand} +\ProcessOptions* +\typeout{Loading features: } +\def\sem@nticsLoader{} +\edef\lo@d{\the\toks1} +\ifx\lo@d\empty + \@inputLigature + \@inputInference + \@inputTdiagram + \@inputReservedWords + \@inputShorthand +\else + \lo@d +\fi +\typeout{and general definitions.^^J} +\let\@ddInput\relax +\let\@inputInference\relax +\let\@inputLigature\relax +\let\@inputTdiagram\relax +\let\@inputReservedWords\relax +\let\@inputShorthand\relax +\let\sem@nticsLoader\realx +\let\lo@d\relax +\TestForConflict{\@dropnext,\@ifnext,\@ifn,\@ifNextMacro,\@ifnMacro} +\TestForConflict{\@@maxwidth,\@@pLineBox,\if@@Nested,\@@cBox} +\TestForConflict{\if@@moreLines,\@@pBox} +\def\@ifnext#1#2#3{% + \let\reserved@e=#1\def\reserved@a{#2}\def\reserved@b{#3}\futurelet% + \reserved@c\@ifn} +\def\@ifn{% + \ifx \reserved@c \reserved@e\let\reserved@d\reserved@a\else% + \let\reserved@d\reserved@b\fi \reserved@d} +\def\@ifNextMacro#1#2{% + \def\reserved@a{#1}\def\reserved@b{#2}% + \futurelet\reserved@c\@ifnMacro} +\def\@ifnMacro{% + \ifcat\noexpand\reserved@c\noexpand\@ifnMacro + \let\reserved@d\reserved@a + \else \let\reserved@d\reserved@b\fi \reserved@d} +\newcommand{\@dropnext}[2]{#1} +\ifnum \value{@@conflict} > 0 + \PackageError{Semantic} + {The \the@@conflict\space command(s) listed above have been + redefined.\MessageBreak + Please report this to turtle@bu.edu} + {Some of the commands defined in semantic was already defined % + and has\MessageBreak now be redefined. There is a risk that % + these commands will be used\MessageBreak by other packages % + leading to spurious errors.\MessageBreak + \space\space Type and cross your fingers% +}\fi +\let\@notdefinable=\@oldNotDefinable +\let\@semanticNotDefinable=\relax +\let\@oldNotDefinable=\relax +\let\TestForConflict=\relax +\let\@endmark=\relax +\let\sem@test=\relax +\newdimen\@@maxwidth +\newbox\@@pLineBox +\newbox\@@cBox +\newbox\@@pBox +\newif\if@@moreLines +\newif\if@@Nested \@@Nestedfalse +\endinput +%% +%% End of file `semantic.sty'. diff --git a/components/tactics/doc/shrthand.sty b/components/tactics/doc/shrthand.sty new file mode 100644 index 000000000..b73af4470 --- /dev/null +++ b/components/tactics/doc/shrthand.sty @@ -0,0 +1,96 @@ +%% +%% This is file `shrthand.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% semantic.dtx (with options: `allOptions,shorthand') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from shrthand.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file semantic.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% semantic.dtx (c)1995--2002 Peter M^^f8ller Neergaard and +%% Arne John Glenstrup +%% +\expandafter\ifx\csname sem@nticsLoader\endcsname\relax + \PackageError{semantic}{% + This file should not be loaded directly} + {% + This file is an option of the semantic package. It should not be + loaded directly\MessageBreak + but by using \protect\usepackage{semantic} in your document + preamble.\MessageBreak + No commands are defined.\MessageBreak + Type to proceed. + }% +\else +\IfFileExists{DONOTUSEmathbbol.sty}{% + \RequirePackage{mathbbol} + \newcommand{\@bblb}{\textbb{[}} + \newcommand{\@bbrb}{\textbb{]}} + \newcommand{\@mbblb}{\mathopen{\mbox{\textbb{[}}}} + \newcommand{\@mbbrb}{\mathclose{\mbox{\textbb{]}}}} +} +{ \newcommand{\@bblb}{\textnormal{[\kern-.15em[}} + \newcommand{\@bbrb}{\textnormal{]\kern-.15em]}} + \newcommand{\@mbblb}{\mathopen{[\mkern-2.67mu[}} + \newcommand{\@mbbrb}{\mathclose{]\mkern-2.67mu]}} +} +\mathlig{|-}{\vdash} +\mathlig{|=}{\models} +\mathlig{->}{\rightarrow} +\mathlig{->*}{\mathrel{\rightarrow^*}} +\mathlig{->+}{\mathrel{\rightarrow^+}} +\mathlig{-->}{\longrightarrow} +\mathlig{-->*}{\mathrel{\longrightarrow^*}} +\mathlig{-->+}{\mathrel{\longrightarrow^+}} +\mathlig{=>}{\Rightarrow} +\mathlig{=>*}{\mathrel{\Rightarrow^*}} +\mathlig{=>+}{\mathrel{\Rightarrow^+}} +\mathlig{==>}{\Longrightarrow} +\mathlig{==>*}{\mathrel{\Longrightarrow^*}} +\mathlig{==>+}{\mathrel{\Longrightarrow^+}} +\mathlig{<-}{\leftarrow} +\mathlig{*<-}{\mathrel{{}^*\mkern-1mu\mathord\leftarrow}} +\mathlig{+<-}{\mathrel{{}^+\mkern-1mu\mathord\leftarrow}} +\mathlig{<--}{\longleftarrow} +\mathlig{*<--}{\mathrel{{}^*\mkern-1mu\mathord{\longleftarrow}}} +\mathlig{+<--}{\mathrel{{}^+\mkern-1mu\mathord{\longleftarrow}}} +\mathlig{<=}{\Leftarrow} +\mathlig{*<=}{\mathrel{{}^*\mkern-1mu\mathord\Leftarrow}} +\mathlig{+<=}{\mathrel{{}^+\mkern-1mu\mathord\Leftarrow}} +\mathlig{<==}{\Longleftarrow} +\mathlig{*<==}{\mathrel{{}^*\mkern-1mu\mathord{\Longleftarrow}}} +\mathlig{+<==}{\mathrel{{}^+\mkern-1mu\mathord{\Longleftarrow}}} +\mathlig{<->}{\longleftrightarrow} +\mathlig{<=>}{\Longleftrightarrow} +\mathlig{|[}{\@mbblb} +\mathlig{|]}{\@mbbrb} +\newcommand{\evalsymbol}[1][]{\ensuremath{\mathcal{E}^{#1}}} +\newcommand{\compsymbol}[1][]{\ensuremath{\mathcal{C}^{#1}}} +\newcommand{\eval}[3][]% + {\mbox{$\mathcal{E}^{#1}$\@bblb \texttt{#2}\@bbrb}% + \ensuremath{\mathtt{#3}}} +\newcommand{\comp}[3][]% + {\mbox{$\mathcal{C}^{#1}$\@bblb \texttt{#2}\@bbrb}% + \ensuremath{\mathtt{#3}}} +\newcommand{\@exe}[3]{} +\newcommand{\exe}[1]{\@ifnextchar[{\@exe{#1}}{\@exe{#1}[]}} +\def\@exe#1[#2]#3{% + \mbox{\@bblb\texttt{#1}\@bbrb$^\mathtt{#2}\mathtt{(#3)}$}} +\fi +\endinput +%% +%% End of file `shrthand.sty'. diff --git a/components/tactics/doc/tdiagram.sty b/components/tactics/doc/tdiagram.sty new file mode 100644 index 000000000..02202b34a --- /dev/null +++ b/components/tactics/doc/tdiagram.sty @@ -0,0 +1,166 @@ +%% +%% This is file `tdiagram.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% semantic.dtx (with options: `allOptions,Tdiagram') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from tdiagram.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file semantic.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% +%% semantic.dtx (c)1995--2002 Peter M^^f8ller Neergaard and +%% Arne John Glenstrup +%% +\expandafter\ifx\csname sem@nticsLoader\endcsname\relax + \PackageError{semantic}{% + This file should not be loaded directly} + {% + This file is an option of the semantic package. It should not be + loaded directly\MessageBreak + but by using \protect\usepackage{semantic} in your document + preamble.\MessageBreak + No commands are defined.\MessageBreak + Type to proceed. + }% +\else +\TestForConflict{\@getSymbol,\@interpreter,\@parseArg,\@program} +\TestForConflict{\@putSymbol,\@saveBeforeSymbolMacro,\compiler} +\TestForConflict{\interpreter,\machine,\program,\@compiler} +\newif\if@@Left +\newif\if@@Up +\newcount\@@xShift +\newcount\@@yShift +\newtoks\@@symbol +\newtoks\@@tempSymbol +\newcommand{\compiler}[1]{\@compiler#1\end} +\def\@compiler#1,#2,#3\end{% + \if@@Nested % + \if@@Up % + \@@yShift=40 \if@@Left \@@xShift=-50 \else \@@xShift=-30 \fi + \else% + \@@yShift=20 \@@xShift =0 % + \fi% + \else% + \@@yShift=40 \@@xShift=-40% + \fi + \hskip\@@xShift\unitlength\raise \@@yShift\unitlength\hbox{% + \put(0,0){\line(1,0){80}}% + \put(0,-20){\line(1,0){30}}% + \put(50,-20){\line(1,0){30}}% + \put(30,-40){\line(1,0){20}}% + \put(0,0){\line(0,-1){20}}% + \put(80,0){\line(0,-1){20}}% + \put(30,-20){\line(0,-1){20}}% + \put(50,-20){\line(0,-1){20}}% + \put(30,-20){\makebox(20,20){$\rightarrow$}} % + {\@@Uptrue \@@Lefttrue \@parseArg(0,-20)(5,-20)#1\end}% + \if@@Up \else \@@tempSymbol=\expandafter{\the\@@symbol}\fi + {\@@Uptrue \@@Leftfalse \@parseArg(80,-20)(55,-20)#3\end}% + {\@@Upfalse \@@Lefttrue \@parseArg(50,-40)(30,-40)#2\end}% + \if@@Up \@@tempSymbol=\expandafter{\the\@@symbol}\fi + \if@@Nested \global\@@symbol=\expandafter{\the\@@tempSymbol} \fi% + }% +} +\newcommand{\interpreter}[1]{\@interpreter#1\end} +\def\@interpreter#1,#2\end{% + \if@@Nested % + \if@@Up % + \@@yShift=40 \if@@Left \@@xShift=0 \else \@@xShift=20 \fi + \else% + \@@yShift=0 \@@xShift =0 % + \fi% + \else% + \@@yShift=40 \@@xShift=10% + \fi + \hskip\@@xShift\unitlength\raise \@@yShift\unitlength\hbox{% + \put(0,0){\line(-1,0){20}}% + \put(0,-40){\line(-1,0){20}}% + \put(0,0){\line(0,-1){40}}% + \put(-20,0){\line(0,-1){40}}% + {\@@Uptrue \@@Lefttrue \@parseArg(0,0)(-20,-20)#1\end}% + \if@@Up \else \@@tempSymbol=\expandafter{\the\@@symbol}\fi + {\@@Upfalse \@@Lefttrue \@parseArg(0,-40)(-20,-40)#2\end}% + \if@@Up \@@tempSymbol=\expandafter{\the\@@symbol}\fi + \if@@Nested \global\@@symbol=\expandafter{\the\@@tempSymbol} \fi% + }% +} +\newcommand{\program}[1]{\@program#1\end} +\def\@program#1,#2\end{% + \if@@Nested % + \if@@Up % + \@@yShift=0 \if@@Left \@@xShift=0 \else \@@xShift=20 \fi + \else% + \PackageError{semantic}{% + A program cannot be at the bottom} + {% + You have tried to use a \protect\program\space as the + bottom\MessageBreak parameter to \protect\compiler, + \protect\interpreter\space or \protect\program.\MessageBreak + Type to proceed --- Output can be distorted.}% + \fi% + \else% + \@@yShift=0 \@@xShift=10% + \fi + \hskip\@@xShift\unitlength\raise \@@yShift\unitlength\hbox{% + \put(0,0){\line(-1,0){20}}% + \put(0,0){\line(0,1){30}}% + \put(-20,0){\line(0,1){30}}% + \put(-10,30){\oval(20,20)[t]}% + \@putSymbol[#1]{-20,20}% + {\@@Upfalse \@@Lefttrue \@parseArg(0,0)(-20,0)#2\end}% + }% +} +\newcommand{\machine}[1]{% + \if@@Nested % + \if@@Up % + \PackageError{semantic}{% + A machine cannot be at the top} + {% + You have tried to use a \protect\machine\space as a + top\MessageBreak parameter to \protect\compiler or + \protect\interpreter.\MessageBreak + Type to proceed --- Output can be distorted.}% + \else \@@yShift=0 \@@xShift=0 + \fi% + \else% + \@@yShift=20 \@@xShift=10% + \fi + \hskip\@@xShift\unitlength\raise \@@yShift\unitlength\hbox{% + \put(0,0){\line(-1,0){20}} \put(-20,0){\line(3,-5){10}} + \put(0,0){\line(-3,-5){10}}% + {\@@Uptrue \@@Lefttrue \@parseArg(0,0)(-20,-15)#1\end}% + }% +} +\def\@parseArg(#1)(#2){% + \@ifNextMacro{\@doSymbolMacro(#1)(#2)}{\@getSymbol(#2)}} +\def\@getSymbol(#1)#2\end{\@putSymbol[#2]{#1}} +\def\@doSymbolMacro(#1)(#2)#3{% + \@ifnextchar[{\@saveBeforeSymbolMacro(#1)(#2)#3}% + {\@symbolMacro(#1)(#2)#3}} +\def\@saveBeforeSymbolMacro(#1)(#2)#3[#4]#5\end{% + \@@tempSymbol={#4}% + \@@Nestedtrue\put(#1){#3#5}% + \@putSymbol[\the\@@tempSymbol]{#2}} +\def\@symbolMacro(#1)(#2)#3\end{% + \@@Nestedtrue\put(#1){#3}% + \@putSymbol{#2}} +\newcommand{\@putSymbol}[2][\the\@@symbol]{% + \global\@@symbol=\expandafter{#1}% + \put(#2){\makebox(20,20){\texttt{\the\@@symbol}}}} +\fi +\endinput +%% +%% End of file `tdiagram.sty'. diff --git a/components/tactics/eliminationTactics.ml b/components/tactics/eliminationTactics.ml new file mode 100644 index 000000000..29961db38 --- /dev/null +++ b/components/tactics/eliminationTactics.ml @@ -0,0 +1,170 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +module C = Cic +module I = CicInspect +module S = CicSubstitution +module TC = CicTypeChecker +module P = PrimitiveTactics +module T = Tacticals +module PESR = ProofEngineStructuralRules +module F = FreshNamesGenerator +module PET = ProofEngineTypes +module RT = ReductionTactics +module E = CicEnvironment +module R = CicReduction +module Un = CicUniv +module PEH = ProofEngineHelpers + +let premise_pattern what = None, [what, C.Implicit (Some `Hole)], None + +let get_inductive_def uri = + match E.get_obj Un.empty_ugraph uri with + | C.InductiveDefinition (tys, _, lpsno, _), _ -> + lpsno, tys + | _ -> assert false + +let is_not_recursive uri tyno tys = + let map mutinds (_, ty) = +(* FG: we can do much better here *) + let map mutinds (_, t) = I.S.union mutinds (I.get_mutinds_of_uri uri t) in +(**********************************) + let premises, _ = PEH.split_with_whd ([], ty) in + List.fold_left map mutinds (List.tl premises) + in + let msg = "recursiveness check non implemented for mutually inductive types" in + if List.length tys > 1 then raise (PET.Fail (lazy msg)) else + let _, _, _, constructors = List.nth tys tyno in + let mutinds = List.fold_left map I.S.empty constructors in + I.S.is_empty mutinds + +let rec check_type sorts metasenv context t = + match R.whd ~delta:true context t with + | C.MutInd (uri, tyno, _) as t -> + let lpsno, tys = get_inductive_def uri in + let _, inductive, arity, _ = List.nth tys tyno in + let _, psno = PEH.split_with_whd ([], arity) in + let not_relation = (lpsno = psno) in + let not_recursive = is_not_recursive uri tyno tys in + let ty_ty, _ = TC.type_of_aux' metasenv context t Un.empty_ugraph in + let sort = match PEH.split_with_whd (context, ty_ty) with + | (_, C.Sort sort) ::_ , _ -> CicPp.ppsort sort + | (_, C.Meta _) :: _, _ -> CicPp.ppsort (C.Type (Un.fresh ())) + | _ -> assert false + in + let right_sort = List.mem sort sorts in + if not_relation && inductive && not_recursive && right_sort then + begin + HLog.warn (Printf.sprintf "Decomposing %s %u" (UriManager.string_of_uri uri) (succ tyno)); + true + end + else false + | C.Appl (hd :: tl) -> check_type sorts metasenv context hd + | _ -> false + +(* unexported tactics *******************************************************) + +let rec scan_tac ~old_context_length ~index ~tactic = + let scan_tac status = + let (proof, goal) = status in + let _, metasenv, _subst, _, _, _ = proof in + let _, context, _ = CicUtil.lookup_meta goal metasenv in + let context_length = List.length context in + let rec aux index = + match PEH.get_name context index with + | _ when index <= 0 -> (proof, [goal]) + | None -> aux (pred index) + | Some what -> + let tac = T.then_ ~start:(tactic ~what) + ~continuation:(scan_tac ~old_context_length:context_length ~index ~tactic) + in + try PET.apply_tactic tac status + with PET.Fail _ -> aux (pred index) + in aux (index + context_length - old_context_length) + in + PET.mk_tactic scan_tac + +let elim_clear_unfold_tac ~sorts ~mk_fresh_name_callback ~what = + let elim_clear_unfold_tac status = + let (proof, goal) = status in + let _, metasenv, _subst, _, _, _ = proof in + let _, context, _ = CicUtil.lookup_meta goal metasenv in + let index, ty = PEH.lookup_type metasenv context what in + let tac = + if check_type sorts metasenv context (S.lift index ty) then + T.then_ ~start:(P.elim_intros_tac ~mk_fresh_name_callback (C.Rel index)) + ~continuation:(PESR.clear [what]) + else + let msg = "unexported elim_clear: not an decomposable type" in + raise (PET.Fail (lazy msg)) + in + PET.apply_tactic tac status + in + PET.mk_tactic elim_clear_unfold_tac + +(* elim type ****************************************************************) + +let elim_type_tac ?(mk_fresh_name_callback = F.mk_fresh_name ~subst:[]) ?depth + ?using what += + let elim = + P.elim_intros_simpl_tac ?using ?depth ~mk_fresh_name_callback + in + let elim_type_tac status = + let tac = + T.thens ~start: (P.cut_tac what) ~continuations:[elim (C.Rel 1); T.id_tac] + in + PET.apply_tactic tac status + in + PET.mk_tactic elim_type_tac + +(* decompose ****************************************************************) + +(* robaglia --------------------------------------------------------------- *) + + (** perform debugging output? *) +let debug = false +let debug_print = fun _ -> () + + (** debugging print *) +let warn s = debug_print (lazy ("DECOMPOSE: " ^ (Lazy.force s))) + +(* roba seria ------------------------------------------------------------- *) + +let decompose_tac ?(sorts=[CicPp.ppsort C.Prop; CicPp.ppsort C.CProp]) + ?(mk_fresh_name_callback = F.mk_fresh_name ~subst:[]) () = + let decompose_tac status = + let (proof, goal) = status in + let _, metasenv, _subst, _,_, _ = proof in + let _, context, _ = CicUtil.lookup_meta goal metasenv in + let tactic = elim_clear_unfold_tac ~sorts ~mk_fresh_name_callback in + let old_context_length = List.length context in + let tac = scan_tac ~old_context_length ~index:old_context_length ~tactic + in + PET.apply_tactic tac status + in + PET.mk_tactic decompose_tac diff --git a/components/tactics/eliminationTactics.mli b/components/tactics/eliminationTactics.mli new file mode 100644 index 000000000..b203bee22 --- /dev/null +++ b/components/tactics/eliminationTactics.mli @@ -0,0 +1,33 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val elim_type_tac: + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ?depth:int -> ?using:Cic.term -> Cic.term -> ProofEngineTypes.tactic + +val decompose_tac: + ?sorts:string list -> + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + unit -> ProofEngineTypes.tactic diff --git a/components/tactics/equalityTactics.ml b/components/tactics/equalityTactics.ml new file mode 100644 index 000000000..bd73865af --- /dev/null +++ b/components/tactics/equalityTactics.ml @@ -0,0 +1,380 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +module C = Cic +module U = UriManager +module PET = ProofEngineTypes +module PER = ProofEngineReduction +module PEH = ProofEngineHelpers +module PESR = ProofEngineStructuralRules +module P = PrimitiveTactics +module T = Tacticals +module R = CicReduction +module S = CicSubstitution +module TC = CicTypeChecker +module LO = LibraryObjects +module DTI = DoubleTypeInference +module HEL = HExtlib + +let rec rewrite_tac ~direction ~pattern:(wanted,hyps_pat,concl_pat) equality = + let _rewrite_tac status = + assert (wanted = None); (* this should be checked syntactically *) + let proof,goal = status in + let curi, metasenv, _subst, pbo, pty, attrs = proof in + let (metano,context,gty) = CicUtil.lookup_meta goal metasenv in + let gsort,_ = + CicTypeChecker.type_of_aux' metasenv context gty CicUniv.oblivion_ugraph in + match hyps_pat with + he::(_::_ as tl) -> + PET.apply_tactic + (T.then_ + (rewrite_tac ~direction + ~pattern:(None,[he],None) equality) + (rewrite_tac ~direction ~pattern:(None,tl,concl_pat) + (S.lift 1 equality)) + ) status + | [_] as hyps_pat when concl_pat <> None -> + PET.apply_tactic + (T.then_ + (rewrite_tac ~direction + ~pattern:(None,hyps_pat,None) equality) + (rewrite_tac ~direction ~pattern:(None,[],concl_pat) + (S.lift 1 equality)) + ) status + | _ -> + let arg,dir2,tac,concl_pat,gty = + match hyps_pat with + [] -> None,true,(fun ~term _ -> P.exact_tac term),concl_pat,gty + | [name,pat] -> + let rec find_hyp n = + function + [] -> assert false + | Some (Cic.Name s,Cic.Decl ty)::_ when name = s -> + Cic.Rel n, S.lift n ty + | Some (Cic.Name s,Cic.Def _)::_ when name = s -> assert false (*CSC: not implemented yet! But does this make any sense?*) + | _::tl -> find_hyp (n+1) tl + in + let arg,gty = find_hyp 1 context in + let dummy = "dummy" in + Some arg,false, + (fun ~term typ -> + T.seq + ~tactics: + [PESR.rename [name] [dummy]; + P.letin_tac + ~mk_fresh_name_callback:(fun _ _ _ ~typ -> Cic.Name name) term; + PESR.clearbody name; + ReductionTactics.change_tac + ~pattern: + (None,[name,Cic.Implicit (Some `Hole)], None) + (ProofEngineTypes.const_lazy_term typ); + PESR.clear [dummy] + ]), + Some pat,gty + | _::_ -> assert false + in + let if_right_to_left do_not_change a b = + match direction with + | `RightToLeft -> if do_not_change then a else b + | `LeftToRight -> if do_not_change then b else a + in + let ty_eq,ugraph = + CicTypeChecker.type_of_aux' metasenv context equality + CicUniv.empty_ugraph in + let (ty_eq,metasenv',arguments,fresh_meta) = + TermUtil.saturate_term + (ProofEngineHelpers.new_meta_of_proof proof) metasenv context ty_eq 0 in + let equality = + if List.length arguments = 0 then + equality + else + C.Appl (equality :: arguments) in + (* t1x is t2 if we are rewriting in an hypothesis *) + let eq_ind, ty, t1, t2, t1x = + match ty_eq with + | C.Appl [C.MutInd (uri, 0, []); ty; t1; t2] + when LibraryObjects.is_eq_URI uri -> + let ind_uri = + match gsort with + C.Sort C.Prop -> + if_right_to_left dir2 + LibraryObjects.eq_ind_URI LibraryObjects.eq_ind_r_URI + | C.Sort C.Set -> + if_right_to_left dir2 + LibraryObjects.eq_rec_URI LibraryObjects.eq_rec_r_URI + | _ -> + if_right_to_left dir2 + LibraryObjects.eq_rect_URI LibraryObjects.eq_rect_r_URI + in + let eq_ind = C.Const (ind_uri uri,[]) in + if dir2 then + if_right_to_left true (eq_ind,ty,t2,t1,t2) (eq_ind,ty,t1,t2,t1) + else + if_right_to_left true (eq_ind,ty,t1,t2,t2) (eq_ind,ty,t2,t1,t1) + | _ -> raise (PET.Fail (lazy "Rewrite: argument is not a proof of an equality")) in + (* now we always do as if direction was `LeftToRight *) + let fresh_name = + FreshNamesGenerator.mk_fresh_name + ~subst:[] metasenv' context C.Anonymous ~typ:ty in + let lifted_t1 = S.lift 1 t1x in + let lifted_gty = S.lift 1 gty in + let lifted_conjecture = + metano,(Some (fresh_name,Cic.Decl ty))::context,lifted_gty in + let lifted_pattern = + let lifted_concl_pat = + match concl_pat with + | None -> None + | Some term -> Some (S.lift 1 term) in + Some (fun c m u -> + let distance = pred (List.length c - List.length context) in + S.lift distance lifted_t1, m, u),[],lifted_concl_pat + in + let subst,metasenv',ugraph,_,selected_terms_with_context = + ProofEngineHelpers.select + ~metasenv:metasenv' ~ugraph ~conjecture:lifted_conjecture + ~pattern:lifted_pattern in + let metasenv' = CicMetaSubst.apply_subst_metasenv subst metasenv' in + let what,with_what = + (* Note: Rel 1 does not live in the context context_of_t *) + (* The replace_lifting_csc 0 function will take care of lifting it *) + (* to context_of_t *) + List.fold_right + (fun (context_of_t,t) (l1,l2) -> t::l1, Cic.Rel 1::l2) + selected_terms_with_context ([],[]) in + let t1 = CicMetaSubst.apply_subst subst t1 in + let t2 = CicMetaSubst.apply_subst subst t2 in + let ty = CicMetaSubst.apply_subst subst ty in + let pbo = CicMetaSubst.apply_subst subst pbo in + let pty = CicMetaSubst.apply_subst subst pty in + let equality = CicMetaSubst.apply_subst subst equality in + let abstr_gty = + ProofEngineReduction.replace_lifting_csc 0 + ~equality:(==) ~what ~with_what:with_what ~where:lifted_gty in + let abstr_gty = CicMetaSubst.apply_subst subst abstr_gty in + let pred = C.Lambda (fresh_name, ty, abstr_gty) in + (* The argument is either a meta if we are rewriting in the conclusion + or the hypothesis if we are rewriting in an hypothesis *) + let metasenv',arg,newtyp = + match arg with + None -> + let gty' = S.subst t2 abstr_gty in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context in + let metasenv' = (fresh_meta,context,gty')::metasenv' in + metasenv', C.Meta (fresh_meta,irl), Cic.Rel (-1) (* dummy term, never used *) + | Some arg -> + let gty' = S.subst t1 abstr_gty in + metasenv',arg,gty' + in + let exact_proof = + C.Appl [eq_ind ; ty ; t2 ; pred ; arg ; t1 ;equality] + in + try + let (proof',goals) = + PET.apply_tactic + (tac ~term:exact_proof newtyp) ((curi,metasenv',_subst,pbo,pty, attrs),goal) + in + let goals = + goals@(ProofEngineHelpers.compare_metasenvs ~oldmetasenv:metasenv + ~newmetasenv:metasenv') + in + (proof',goals) + with (* FG: this should be PET.Fail _ *) + TC.TypeCheckerFailure _ -> + let msg = lazy "rewrite: nothing to rewrite" in + raise (PET.Fail msg) + in + PET.mk_tactic _rewrite_tac + +let rewrite_tac ~direction ~pattern equality names = + let _, hyps_pat, _ = pattern in + let froms = List.map fst hyps_pat in + let start = rewrite_tac ~direction ~pattern equality in + let continuation = PESR.rename ~froms ~tos:names in + if names = [] then start else T.then_ ~start ~continuation + +let rewrite_simpl_tac ~direction ~pattern equality names = + T.then_ + ~start:(rewrite_tac ~direction ~pattern equality names) + ~continuation: + (ReductionTactics.simpl_tac + ~pattern:(ProofEngineTypes.conclusion_pattern None)) + + +let replace_tac ~(pattern: ProofEngineTypes.lazy_pattern) ~with_what = + let replace_tac ~(pattern: ProofEngineTypes.lazy_pattern) ~with_what status = + let _wanted, hyps_pat, concl_pat = pattern in + let (proof, goal) = status in + let uri,metasenv,_subst,pbo,pty, attrs = proof in + let (_,context,ty) as conjecture = CicUtil.lookup_meta goal metasenv in + assert (hyps_pat = []); (*CSC: not implemented yet *) + let eq_URI = + match LibraryObjects.eq_URI () with + Some uri -> uri + | None -> raise (ProofEngineTypes.Fail (lazy "You need to register the default equality first. Please use the \"default\" command")) + in + let context_len = List.length context in + let subst,metasenv,u,_,selected_terms_with_context = + ProofEngineHelpers.select ~metasenv ~ugraph:CicUniv.empty_ugraph + ~conjecture ~pattern in + let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in + let with_what, metasenv, u = with_what context metasenv u in + let with_what = CicMetaSubst.apply_subst subst with_what in + let pbo = CicMetaSubst.apply_subst subst pbo in + let pty = CicMetaSubst.apply_subst subst pty in + let status = (uri,metasenv,_subst,pbo,pty, attrs),goal in + let ty_of_with_what,u = + CicTypeChecker.type_of_aux' + metasenv context with_what CicUniv.empty_ugraph in + let whats = + match selected_terms_with_context with + [] -> raise (ProofEngineTypes.Fail (lazy "Replace: no term selected")) + | l -> + List.map + (fun (context_of_t,t) -> + let t_in_context = + try + let context_of_t_len = List.length context_of_t in + if context_of_t_len = context_len then t + else + (let t_in_context,subst,metasenv' = + CicMetaSubst.delift_rels [] metasenv + (context_of_t_len - context_len) t + in + assert (subst = []); + assert (metasenv = metasenv'); + t_in_context) + with + CicMetaSubst.DeliftingARelWouldCaptureAFreeVariable -> + (*CSC: we could implement something stronger by completely changing + the semantics of the tactic *) + raise (ProofEngineTypes.Fail + (lazy "Replace: one of the selected terms is not closed")) in + let ty_of_t_in_context,u = (* TASSI: FIXME *) + CicTypeChecker.type_of_aux' metasenv context t_in_context + CicUniv.empty_ugraph in + let b,u = CicReduction.are_convertible ~metasenv context + ty_of_with_what ty_of_t_in_context u in + if b then + let concl_pat_for_t = ProofEngineHelpers.pattern_of ~term:ty [t] in + let pattern_for_t = None,[],Some concl_pat_for_t in + t_in_context,pattern_for_t + else + raise + (ProofEngineTypes.Fail + (lazy "Replace: one of the selected terms and the term to be replaced with have not convertible types")) + ) l in + let rec aux n whats (status : ProofEngineTypes.status) = + match whats with + [] -> ProofEngineTypes.apply_tactic T.id_tac status + | (what,lazy_pattern)::tl -> + let what = S.lift n what in + let with_what = S.lift n with_what in + let ty_of_with_what = S.lift n ty_of_with_what in + ProofEngineTypes.apply_tactic + (T.thens + ~start:( + P.cut_tac + (C.Appl [ + (C.MutInd (eq_URI, 0, [])) ; + ty_of_with_what ; + what ; + with_what])) + ~continuations:[ + T.then_ + ~start:( + rewrite_tac ~direction:`LeftToRight ~pattern:lazy_pattern (C.Rel 1) []) + ~continuation:( + T.then_ + ~start:( + ProofEngineTypes.mk_tactic + (function ((proof,goal) as status) -> + let _,metasenv,_subst,_,_, _ = proof in + let _,context,_ = CicUtil.lookup_meta goal metasenv in + let hyps = + try + match List.hd context with + Some (Cic.Name name,_) -> [name] + | _ -> assert false + with (Failure "hd") -> assert false + in + ProofEngineTypes.apply_tactic + (PESR.clear ~hyps) status)) + ~continuation:(aux_tac (n + 1) tl)); + T.id_tac]) + status + and aux_tac n tl = ProofEngineTypes.mk_tactic (aux n tl) in + aux 0 whats (status : ProofEngineTypes.status) + in + ProofEngineTypes.mk_tactic (replace_tac ~pattern ~with_what) +;; + + +(* All these tacs do is applying the right constructor/theorem *) + +let reflexivity_tac = + IntroductionTactics.constructor_tac ~n:1 +;; + +let symmetry_tac = + let symmetry_tac (proof, goal) = + let (_,metasenv,_subst,_,_, _) = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + match (R.whd context ty) with + (C.Appl [(C.MutInd (uri, 0, [])); _; _; _]) + when LibraryObjects.is_eq_URI uri -> + ProofEngineTypes.apply_tactic + (PrimitiveTactics.apply_tac + ~term: (C.Const (LibraryObjects.sym_eq_URI uri, []))) + (proof,goal) + + | _ -> raise (ProofEngineTypes.Fail (lazy "Symmetry failed")) + in + ProofEngineTypes.mk_tactic symmetry_tac +;; + +let transitivity_tac ~term = + let transitivity_tac ~term status = + let (proof, goal) = status in + let (_,metasenv,_subst,_,_, _) = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + match (R.whd context ty) with + (C.Appl [(C.MutInd (uri, 0, [])); _; _; _]) + when LibraryObjects.is_eq_URI uri -> + ProofEngineTypes.apply_tactic + (T.thens + ~start:(PrimitiveTactics.apply_tac + ~term: (C.Const (LibraryObjects.trans_eq_URI uri, []))) + ~continuations: + [PrimitiveTactics.exact_tac ~term ; T.id_tac ; T.id_tac]) + status + + | _ -> raise (ProofEngineTypes.Fail (lazy "Transitivity failed")) + in + ProofEngineTypes.mk_tactic (transitivity_tac ~term) +;; + diff --git a/components/tactics/equalityTactics.mli b/components/tactics/equalityTactics.mli new file mode 100644 index 000000000..1aa48173c --- /dev/null +++ b/components/tactics/equalityTactics.mli @@ -0,0 +1,42 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val rewrite_tac: + direction:[`LeftToRight | `RightToLeft] -> + pattern:ProofEngineTypes.lazy_pattern -> Cic.term -> string list -> + ProofEngineTypes.tactic + +val rewrite_simpl_tac: + direction:[`LeftToRight | `RightToLeft] -> + pattern:ProofEngineTypes.lazy_pattern -> Cic.term -> string list -> + ProofEngineTypes.tactic + +val replace_tac: + pattern:ProofEngineTypes.lazy_pattern -> + with_what:Cic.lazy_term -> ProofEngineTypes.tactic + +val reflexivity_tac: ProofEngineTypes.tactic +val symmetry_tac: ProofEngineTypes.tactic +val transitivity_tac: term:Cic.term -> ProofEngineTypes.tactic diff --git a/components/tactics/fourier.ml b/components/tactics/fourier.ml new file mode 100644 index 000000000..d7728c0b3 --- /dev/null +++ b/components/tactics/fourier.ml @@ -0,0 +1,244 @@ +(***********************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* match ie.coef with + [] -> raise (Failure "empty ineq") + |(c::r) -> if rinf c r0 + then pop ie lneg + else if rinf r0 c then pop ie lpos + else pop ie lnul) + s; + [!lneg;!lnul;!lpos] +;; +(* initialise les histoires d'une liste d'inéquations données par leurs listes de coefficients et leurs strictitudes (!): +(add_hist [(equation 1, s1);...;(équation n, sn)]) += +[{équation 1, [1;0;...;0], s1}; + {équation 2, [0;1;...;0], s2}; + ... + {équation n, [0;0;...;1], sn}] +*) +let add_hist le = + let n = List.length le in + let i=ref 0 in + List.map (fun (ie,s) -> + let h =ref [] in + for k=1 to (n-(!i)-1) do pop r0 h; done; + pop r1 h; + for k=1 to !i do pop r0 h; done; + i:=!i+1; + {coef=ie;hist=(!h);strict=s}) + le +;; +(* additionne deux inéquations *) +let ie_add ie1 ie2 = {coef=List.map2 rplus ie1.coef ie2.coef; + hist=List.map2 rplus ie1.hist ie2.hist; + strict=ie1.strict || ie2.strict} +;; +(* multiplication d'une inéquation par un rationnel (positif) *) +let ie_emult a ie = {coef=List.map (fun x -> rmult a x) ie.coef; + hist=List.map (fun x -> rmult a x) ie.hist; + strict= ie.strict} +;; +(* on enlève le premier coefficient *) +let ie_tl ie = {coef=List.tl ie.coef;hist=ie.hist;strict=ie.strict} +;; +(* le premier coefficient: "tête" de l'inéquation *) +let hd_coef ie = List.hd ie.coef +;; + +(* calcule toutes les combinaisons entre inéquations de tête négative et inéquations de tête positive qui annulent le premier coefficient. +*) +let deduce_add lneg lpos = + let res=ref [] in + List.iter (fun i1 -> + List.iter (fun i2 -> + let a = rop (hd_coef i1) in + let b = hd_coef i2 in + pop (ie_tl (ie_add (ie_emult b i1) + (ie_emult a i2))) res) + lpos) + lneg; + !res +;; +(* élimination de la première variable à partir d'une liste d'inéquations: +opération qu'on itère dans l'algorithme de Fourier. +*) +let deduce1 s i= + match (partitionne s) with + [lneg;lnul;lpos] -> + let lnew = deduce_add lneg lpos in + (match lneg with [] -> print_string("non posso ridurre "^string_of_int i^"\n")|_->(); + match lpos with [] -> print_string("non posso ridurre "^string_of_int i^"\n")|_->()); + (List.map ie_tl lnul)@lnew + |_->assert false +;; +(* algorithme de Fourier: on élimine successivement toutes les variables. +*) +let deduce lie = + let n = List.length (fst (List.hd lie)) in + let lie=ref (add_hist lie) in + for i=1 to n-1 do + lie:= deduce1 !lie i; + done; + !lie +;; + +(* donne [] si le système a des find solutions, +sinon donne [c,s,lc] +où lc est la combinaison linéaire des inéquations de départ +qui donne 0 < c si s=true + ou 0 <= c sinon +cette inéquation étant absurde. +*) +(** Tryes to find if the system admits solutions. + @param lie the list of inequations + @return a list that can be empty if the system has solutions. Otherwise it returns a + one elements list [\[(c,s,lc)\]]. {b c} is the rational that can be obtained solving the system, + {b s} is true if the inequation that proves that the system is absurd is of type [c < 0], false if + [c <= 0], {b lc} is a list of rational that represents the liear combination to obtain the + absurd inequation *) +let unsolvable lie = + let lr = deduce lie in + let res = ref [] in + (try (List.iter (fun e -> + match e with + {coef=[c];hist=lc;strict=s} -> + if (rinf c r0 && (not s)) || (rinfeq c r0 && s) + then (res := [c,s,lc]; + raise (Failure "contradiction found")) + |_->assert false) + lr) + with _ -> ()); + !res +;; + +(* Exemples: + +let test1=[[r1;r1;r0],true;[rop r1;r1;r1],false;[r0;rop r1;rop r1],false];; +deduce test1;; +unsolvable test1;; + +let test2=[ +[r1;r1;r0;r0;r0],false; +[r0;r1;r1;r0;r0],false; +[r0;r0;r1;r1;r0],false; +[r0;r0;r0;r1;r1],false; +[r1;r0;r0;r0;r1],false; +[rop r1;rop r1;r0;r0;r0],false; +[r0;rop r1;rop r1;r0;r0],false; +[r0;r0;rop r1;rop r1;r0],false; +[r0;r0;r0;rop r1;rop r1],false; +[rop r1;r0;r0;r0;rop r1],false +];; +deduce test2;; +unsolvable test2;; + +*) diff --git a/components/tactics/fourier.mli b/components/tactics/fourier.mli new file mode 100644 index 000000000..8b26bc21a --- /dev/null +++ b/components/tactics/fourier.mli @@ -0,0 +1,27 @@ +type rational = { num : int; den : int; } +val print_rational : rational -> unit +val pgcd : int -> int -> int +val r0 : rational +val r1 : rational +val rnorm : rational -> rational +val rop : rational -> rational +val rplus : rational -> rational -> rational +val rminus : rational -> rational -> rational +val rmult : rational -> rational -> rational +val rinv : rational -> rational +val rdiv : rational -> rational -> rational +val rinf : rational -> rational -> bool +val rinfeq : rational -> rational -> bool +type ineq = { coef : rational list; hist : rational list; strict : bool; } +val pop : 'a -> 'a list ref -> unit +val partitionne : ineq list -> ineq list list +val add_hist : (rational list * bool) list -> ineq list +val ie_add : ineq -> ineq -> ineq +val ie_emult : rational -> ineq -> ineq +val ie_tl : ineq -> ineq +val hd_coef : ineq -> rational +val deduce_add : ineq list -> ineq list -> ineq list +val deduce1 : ineq list -> int -> ineq list +val deduce : (rational list * bool) list -> ineq list +val unsolvable : + (rational list * bool) list -> (rational * bool * rational list) list diff --git a/components/tactics/fourierR.ml b/components/tactics/fourierR.ml new file mode 100644 index 000000000..8e443447a --- /dev/null +++ b/components/tactics/fourierR.ml @@ -0,0 +1,1201 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + + +(******************** THE FOURIER TACTIC ***********************) + +(* La tactique Fourier ne fonctionne de manière sûre que si les coefficients +des inéquations et équations sont entiers. En attendant la tactique Field. +*) + +open Fourier +open ProofEngineTypes + + +let debug x = print_string ("____ "^x) ; flush stdout;; + +let debug_pcontext x = + let str = ref "" in + List.iter (fun y -> match y with Some(Cic.Name(a),_) -> str := !str ^ + a ^ " " | _ ->()) x ; + debug ("contesto : "^ (!str) ^ "\n") +;; + +(****************************************************************************** +Operations on linear combinations. + +Opérations sur les combinaisons linéaires affines. +La partie homogène d'une combinaison linéaire est en fait une table de hash +qui donne le coefficient d'un terme du calcul des constructions, +qui est zéro si le terme n'y est pas. +*) + + + +(** + The type for linear combinations +*) +type flin = {fhom:(Cic.term , rational)Hashtbl.t;fcste:rational} +;; + +(** + @return an empty flin +*) +let flin_zero () = {fhom = Hashtbl.create 50;fcste=r0} +;; + +(** + @param f a flin + @param x a Cic.term + @return the rational associated with x (coefficient) +*) +let flin_coef f x = + try + (Hashtbl.find f.fhom x) + with + _ -> r0 +;; + +(** + Adds c to the coefficient of x + @param f a flin + @param x a Cic.term + @param c a rational + @return the new flin +*) +let flin_add f x c = + match x with + Cic.Rel(n) ->( + let cx = flin_coef f x in + Hashtbl.remove f.fhom x; + Hashtbl.add f.fhom x (rplus cx c); + f) + |_->debug ("Internal error in Fourier! this is not a Rel "^CicPp.ppterm x^"\n"); + let cx = flin_coef f x in + Hashtbl.remove f.fhom x; + Hashtbl.add f.fhom x (rplus cx c); + f +;; +(** + Adds c to f.fcste + @param f a flin + @param c a rational + @return the new flin +*) +let flin_add_cste f c = + {fhom=f.fhom; + fcste=rplus f.fcste c} +;; + +(** + @return a empty flin with r1 in fcste +*) +let flin_one () = flin_add_cste (flin_zero()) r1;; + +(** + Adds two flin +*) +let flin_plus f1 f2 = + let f3 = flin_zero() in + Hashtbl.iter (fun x c -> let _=flin_add f3 x c in ()) f1.fhom; + Hashtbl.iter (fun x c -> let _=flin_add f3 x c in ()) f2.fhom; + flin_add_cste (flin_add_cste f3 f1.fcste) f2.fcste; +;; + +(** + Substracts two flin +*) +let flin_minus f1 f2 = + let f3 = flin_zero() in + Hashtbl.iter (fun x c -> let _=flin_add f3 x c in ()) f1.fhom; + Hashtbl.iter (fun x c -> let _=flin_add f3 x (rop c) in ()) f2.fhom; + flin_add_cste (flin_add_cste f3 f1.fcste) (rop f2.fcste); +;; + +(** + @return a times f +*) +let flin_emult a f = + let f2 = flin_zero() in + Hashtbl.iter (fun x c -> let _=flin_add f2 x (rmult a c) in ()) f.fhom; + flin_add_cste f2 (rmult a f.fcste); +;; + + +(*****************************************************************************) + + +(** + @param t a term + @raise Failure if conversion is impossible + @return rational proiection of t +*) +let rec rational_of_term t = + (* fun to apply f to the first and second rational-term of l *) + let rat_of_binop f l = + let a = List.hd l and + b = List.hd(List.tl l) in + f (rational_of_term a) (rational_of_term b) + in + (* as before, but f is unary *) + let rat_of_unop f l = + f (rational_of_term (List.hd l)) + in + match t with + | Cic.Cast (t1,t2) -> (rational_of_term t1) + | Cic.Appl (t1::next) -> + (match t1 with + Cic.Const (u,boh) -> + if UriManager.eq u HelmLibraryObjects.Reals.ropp_URI then + rat_of_unop rop next + else if UriManager.eq u HelmLibraryObjects.Reals.rinv_URI then + rat_of_unop rinv next + else if UriManager.eq u HelmLibraryObjects.Reals.rmult_URI then + rat_of_binop rmult next + else if UriManager.eq u HelmLibraryObjects.Reals.rdiv_URI then + rat_of_binop rdiv next + else if UriManager.eq u HelmLibraryObjects.Reals.rplus_URI then + rat_of_binop rplus next + else if UriManager.eq u HelmLibraryObjects.Reals.rminus_URI then + rat_of_binop rminus next + else failwith "not a rational" + | _ -> failwith "not a rational") + | Cic.Const (u,boh) -> + if UriManager.eq u HelmLibraryObjects.Reals.r1_URI then r1 + else if UriManager.eq u HelmLibraryObjects.Reals.r0_URI then r0 + else failwith "not a rational" + | _ -> failwith "not a rational" +;; + +(* coq wrapper +let rational_of_const = rational_of_term;; +*) +let fails f a = + try + ignore (f a); + false + with + _-> true + ;; + +let rec flin_of_term t = + let fl_of_binop f l = + let a = List.hd l and + b = List.hd(List.tl l) in + f (flin_of_term a) (flin_of_term b) + in + try( + match t with + | Cic.Cast (t1,t2) -> (flin_of_term t1) + | Cic.Appl (t1::next) -> + begin + match t1 with + Cic.Const (u,boh) -> + begin + if UriManager.eq u HelmLibraryObjects.Reals.ropp_URI then + flin_emult (rop r1) (flin_of_term (List.hd next)) + else if UriManager.eq u HelmLibraryObjects.Reals.rplus_URI then + fl_of_binop flin_plus next + else if UriManager.eq u HelmLibraryObjects.Reals.rminus_URI then + fl_of_binop flin_minus next + else if UriManager.eq u HelmLibraryObjects.Reals.rmult_URI then + begin + let arg1 = (List.hd next) and + arg2 = (List.hd(List.tl next)) + in + if fails rational_of_term arg1 + then + if fails rational_of_term arg2 + then + ( (* prodotto tra 2 incognite ????? impossibile*) + failwith "Sistemi lineari!!!!\n" + ) + else + ( + match arg1 with + Cic.Rel(n) -> (*trasformo al volo*) + (flin_add (flin_zero()) arg1 (rational_of_term arg2)) + |_-> (* test this *) + let tmp = flin_of_term arg1 in + flin_emult (rational_of_term arg2) (tmp) + ) + else + if fails rational_of_term arg2 + then + ( + match arg2 with + Cic.Rel(n) -> (*trasformo al volo*) + (flin_add (flin_zero()) arg2 (rational_of_term arg1)) + |_-> (* test this *) + let tmp = flin_of_term arg2 in + flin_emult (rational_of_term arg1) (tmp) + + ) + else + ( (*prodotto tra razionali*) + (flin_add_cste (flin_zero()) (rmult (rational_of_term arg1) (rational_of_term arg2))) + ) + (*try + begin + (*let a = rational_of_term arg1 in + debug("ho fatto rational of term di "^CicPp.ppterm arg1^ + " e ho ottenuto "^string_of_int a.num^"/"^string_of_int a.den^"\n");*) + let a = flin_of_term arg1 + try + begin + let b = (rational_of_term arg2) in + debug("ho fatto rational of term di "^CicPp.ppterm arg2^ + " e ho ottenuto "^string_of_int b.num^"/"^string_of_int b.den^"\n"); + (flin_add_cste (flin_zero()) (rmult a b)) + end + with + _ -> debug ("ho fallito2 su "^CicPp.ppterm arg2^"\n"); + (flin_add (flin_zero()) arg2 a) + end + with + _-> debug ("ho fallito1 su "^CicPp.ppterm arg1^"\n"); + (flin_add(flin_zero()) arg1 (rational_of_term arg2)) + *) + end + else if UriManager.eq u HelmLibraryObjects.Reals.rinv_URI then + let a=(rational_of_term (List.hd next)) in + flin_add_cste (flin_zero()) (rinv a) + else if UriManager.eq u HelmLibraryObjects.Reals.rdiv_URI then + begin + let b=(rational_of_term (List.hd(List.tl next))) in + try + begin + let a = (rational_of_term (List.hd next)) in + (flin_add_cste (flin_zero()) (rdiv a b)) + end + with + _-> (flin_add (flin_zero()) (List.hd next) (rinv b)) + end + else assert false + end + |_ -> assert false + end + | Cic.Const (u,boh) -> + begin + if UriManager.eq u HelmLibraryObjects.Reals.r1_URI then flin_one () + else if UriManager.eq u HelmLibraryObjects.Reals.r0_URI then flin_zero () + else assert false + end + |_-> assert false) + with _ -> debug("eccezione = "^CicPp.ppterm t^"\n");flin_add (flin_zero()) t r1 +;; + +(* coq wrapper +let flin_of_constr = flin_of_term;; +*) + +(** + Translates a flin to (c,x) list + @param f a flin + @return something like (c1,x1)::(c2,x2)::...::(cn,xn) +*) +let flin_to_alist f = + let res=ref [] in + Hashtbl.iter (fun x c -> res:=(c,x)::(!res)) f; + !res +;; + +(* Représentation des hypothèses qui sont des inéquations ou des équations. +*) + +(** + The structure for ineq +*) +type hineq={hname:Cic.term; (* le nom de l'hypothèse *) + htype:string; (* Rlt, Rgt, Rle, Rge, eqTLR ou eqTRL *) + hleft:Cic.term; + hright:Cic.term; + hflin:flin; + hstrict:bool} +;; + +(* Transforme une hypothese h:t en inéquation flin<0 ou flin<=0 +*) + +let ineq1_of_term (h,t) = + match t with (* match t *) + Cic.Appl (t1::next) -> + let arg1= List.hd next in + let arg2= List.hd(List.tl next) in + (match t1 with (* match t1 *) + Cic.Const (u,boh) -> + if UriManager.eq u HelmLibraryObjects.Reals.rlt_URI then + [{hname=h; + htype="Rlt"; + hleft=arg1; + hright=arg2; + hflin= flin_minus (flin_of_term arg1) + (flin_of_term arg2); + hstrict=true}] + else if UriManager.eq u HelmLibraryObjects.Reals.rgt_URI then + [{hname=h; + htype="Rgt"; + hleft=arg2; + hright=arg1; + hflin= flin_minus (flin_of_term arg2) + (flin_of_term arg1); + hstrict=true}] + else if UriManager.eq u HelmLibraryObjects.Reals.rle_URI then + [{hname=h; + htype="Rle"; + hleft=arg1; + hright=arg2; + hflin= flin_minus (flin_of_term arg1) + (flin_of_term arg2); + hstrict=false}] + else if UriManager.eq u HelmLibraryObjects.Reals.rge_URI then + [{hname=h; + htype="Rge"; + hleft=arg2; + hright=arg1; + hflin= flin_minus (flin_of_term arg2) + (flin_of_term arg1); + hstrict=false}] + else assert false + | Cic.MutInd (u,i,o) -> + if UriManager.eq u HelmLibraryObjects.Logic.eq_URI then + let t0= arg1 in + let arg1= arg2 in + let arg2= List.hd(List.tl (List.tl next)) in + (match t0 with + Cic.Const (u,boh) -> + if UriManager.eq u HelmLibraryObjects.Reals.r_URI then + [{hname=h; + htype="eqTLR"; + hleft=arg1; + hright=arg2; + hflin= flin_minus (flin_of_term arg1) + (flin_of_term arg2); + hstrict=false}; + {hname=h; + htype="eqTRL"; + hleft=arg2; + hright=arg1; + hflin= flin_minus (flin_of_term arg2) + (flin_of_term arg1); + hstrict=false}] + else assert false + |_-> assert false) + else assert false + |_-> assert false)(* match t1 *) + |_-> assert false (* match t *) +;; +(* coq wrapper +let ineq1_of_constr = ineq1_of_term;; +*) + +(* Applique la méthode de Fourier à une liste d'hypothèses (type hineq) +*) + +let rec print_rl l = + match l with + []-> () + | a::next -> Fourier.print_rational a ; print_string " " ; print_rl next +;; + +let rec print_sys l = + match l with + [] -> () + | (a,b)::next -> (print_rl a; + print_string (if b=true then "strict\n"else"\n"); + print_sys next) + ;; + +(*let print_hash h = + Hashtbl.iter (fun x y -> print_string ("("^"-"^","^"-"^")")) h +;;*) + +let fourier_lineq lineq1 = + let nvar=ref (-1) in + let hvar=Hashtbl.create 50 in (* la table des variables des inéquations *) + List.iter (fun f -> + Hashtbl.iter (fun x c -> + try (Hashtbl.find hvar x;()) + with _-> nvar:=(!nvar)+1; + Hashtbl.add hvar x (!nvar); + debug("aggiungo una var "^ + string_of_int !nvar^" per "^ + CicPp.ppterm x^"\n")) + f.hflin.fhom) + lineq1; + (*print_hash hvar;*) + debug("Il numero di incognite e' "^string_of_int (!nvar+1)^"\n"); + let sys= List.map (fun h-> + let v=Array.create ((!nvar)+1) r0 in + Hashtbl.iter (fun x c -> v.(Hashtbl.find hvar x) <- c) + h.hflin.fhom; + ((Array.to_list v)@[rop h.hflin.fcste],h.hstrict)) + lineq1 in + debug ("chiamo unsolvable sul sistema di "^ + string_of_int (List.length sys) ^"\n"); + print_sys sys; + unsolvable sys +;; + +(***************************************************************************** +Construction de la preuve en cas de succès de la méthode de Fourier, +i.e. on obtient une contradiction. +*) + + +let _eqT = Cic.MutInd(HelmLibraryObjects.Logic.eq_URI, 0, []) ;; +let _False = Cic.MutInd (HelmLibraryObjects.Logic.false_URI, 0, []) ;; +let _not = Cic.Const (HelmLibraryObjects.Logic.not_URI,[]);; +let _R0 = Cic.Const (HelmLibraryObjects.Reals.r0_URI,[]);; +let _R1 = Cic.Const (HelmLibraryObjects.Reals.r1_URI,[]);; +let _R = Cic.Const (HelmLibraryObjects.Reals.r_URI,[]);; +let _Rfourier_eqLR_to_le=Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_eqLR_to_le.con"), []) ;; +let _Rfourier_eqRL_to_le=Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_eqRL_to_le.con"), []) ;; +let _Rfourier_ge_to_le =Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_ge_to_le.con"), []) ;; +let _Rfourier_gt_to_lt =Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_gt_to_lt.con"), []) ;; +let _Rfourier_le=Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_le.con"), []) ;; +let _Rfourier_le_le =Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_le_le.con"), []) ;; +let _Rfourier_le_lt =Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_le_lt.con"), []) ;; +let _Rfourier_lt=Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_lt.con"), []) ;; +let _Rfourier_lt_le =Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_lt_le.con"), []) ;; +let _Rfourier_lt_lt =Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_lt_lt.con"), []) ;; +let _Rfourier_not_ge_lt = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_not_ge_lt.con"), []) ;; +let _Rfourier_not_gt_le = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_not_gt_le.con"), []) ;; +let _Rfourier_not_le_gt = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_not_le_gt.con"), []) ;; +let _Rfourier_not_lt_ge = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rfourier_not_lt_ge.con"), []) ;; +let _Rinv = Cic.Const (HelmLibraryObjects.Reals.rinv_URI, []);; +let _Rinv_R1 = Cic.Const(HelmLibraryObjects.Reals.rinv_r1_URI, []);; +let _Rle = Cic.Const (HelmLibraryObjects.Reals.rle_URI, []);; +let _Rle_mult_inv_pos = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rle_mult_inv_pos.con"), []) ;; +let _Rle_not_lt = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rle_not_lt.con"), []) ;; +let _Rle_zero_1 = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rle_zero_1.con"), []) ;; +let _Rle_zero_pos_plus1 = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rle_zero_pos_plus1.con"), []) ;; +let _Rlt = Cic.Const (HelmLibraryObjects.Reals.rlt_URI, []);; +let _Rlt_mult_inv_pos = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rlt_mult_inv_pos.con"), []) ;; +let _Rlt_not_le = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rlt_not_le.con"), []) ;; +let _Rlt_zero_1 = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rlt_zero_1.con"), []) ;; +let _Rlt_zero_pos_plus1 = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rlt_zero_pos_plus1.con"), []) ;; +let _Rminus = Cic.Const (HelmLibraryObjects.Reals.rminus_URI, []);; +let _Rmult = Cic.Const (HelmLibraryObjects.Reals.rmult_URI, []);; +let _Rnot_le_le =Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rnot_le_le.con"), []) ;; +let _Rnot_lt0 = Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rnot_lt0.con"), []) ;; +let _Rnot_lt_lt =Cic.Const ((UriManager.uri_of_string + "cic:/Coq/fourier/Fourier_util/Rnot_lt_lt.con"), []) ;; +let _Ropp = Cic.Const (HelmLibraryObjects.Reals.ropp_URI, []);; +let _Rplus = Cic.Const (HelmLibraryObjects.Reals.rplus_URI, []);; + +(******************************************************************************) + +let is_int x = (x.den)=1 +;; + +(* fraction = couple (num,den) *) +let rec rational_to_fraction x= (x.num,x.den) +;; + +(* traduction -3 -> (Ropp (Rplus R1 (Rplus R1 R1))) +*) + +let rec int_to_real_aux n = + match n with + 0 -> _R0 (* o forse R0 + R0 ????? *) + | 1 -> _R1 + | _ -> Cic.Appl [ _Rplus ; _R1 ; int_to_real_aux (n-1) ] +;; + + +let int_to_real n = + let x = int_to_real_aux (abs n) in + if n < 0 then + Cic.Appl [ _Ropp ; x ] + else + x +;; + + +(* -1/2 -> (Rmult (Ropp R1) (Rinv (Rplus R1 R1))) +*) + +let rational_to_real x = + let (n,d)=rational_to_fraction x in + Cic.Appl [ _Rmult ; int_to_real n ; Cic.Appl [ _Rinv ; int_to_real d ] ] +;; + +(* preuve que 0 + pall "n0" status _Rlt_zero_1 ; + apply_tactic (PrimitiveTactics.apply_tac ~term:_Rlt_zero_1) status )) in + let tacd=ref (mk_tactic (fun status -> + pall "d0" status _Rlt_zero_1 ; + apply_tactic (PrimitiveTactics.apply_tac ~term:_Rlt_zero_1) status )) in + + + for i=1 to n-1 do + tacn:=(Tacticals.then_ + ~start:(mk_tactic (fun status -> + pall ("n"^string_of_int i) status _Rlt_zero_pos_plus1; + apply_tactic + (PrimitiveTactics.apply_tac ~term:_Rlt_zero_pos_plus1) + status)) + ~continuation:!tacn); + done; + for i=1 to d-1 do + tacd:=(Tacticals.then_ + ~start:(mk_tactic (fun status -> + pall "d" status _Rlt_zero_pos_plus1 ; + apply_tactic + (PrimitiveTactics.apply_tac ~term:_Rlt_zero_pos_plus1) status)) + ~continuation:!tacd); + done; + +debug("TAC ZERO INF POS\n"); + apply_tactic + (Tacticals.thens + ~start:(PrimitiveTactics.apply_tac ~term:_Rlt_mult_inv_pos) + ~continuations:[!tacn ;!tacd ] ) + status + in + mk_tactic (tac_zero_inf_pos (n,d)) +;; + + + +(* preuve que 0<=n*1/d +*) + +let tac_zero_infeq_pos gl (n,d) = + let tac_zero_infeq_pos gl (n,d) status = + (*let cste = pf_parse_constr gl in*) + debug("inizio tac_zero_infeq_pos\n"); + let tacn = ref + (*(if n=0 then + (PrimitiveTactics.apply_tac ~term:_Rle_zero_zero ) + else*) + (PrimitiveTactics.apply_tac ~term:_Rle_zero_1 ) + (* ) *) + in + let tacd=ref (PrimitiveTactics.apply_tac ~term:_Rlt_zero_1 ) in + for i=1 to n-1 do + tacn:=(Tacticals.then_ ~start:(PrimitiveTactics.apply_tac + ~term:_Rle_zero_pos_plus1) ~continuation:!tacn); + done; + for i=1 to d-1 do + tacd:=(Tacticals.then_ ~start:(PrimitiveTactics.apply_tac + ~term:_Rlt_zero_pos_plus1) ~continuation:!tacd); + done; + apply_tactic + (Tacticals.thens + ~start:(PrimitiveTactics.apply_tac ~term:_Rle_mult_inv_pos) + ~continuations:[!tacn;!tacd]) status + in + mk_tactic (tac_zero_infeq_pos gl (n,d)) +;; + + + +(* preuve que 0<(-n)*(1/d) => False +*) + +let tac_zero_inf_false gl (n,d) = + let tac_zero_inf_false gl (n,d) status = + if n=0 then + apply_tactic (PrimitiveTactics.apply_tac ~term:_Rnot_lt0) status + else + apply_tactic (Tacticals.then_ + ~start:(mk_tactic (apply_tactic (PrimitiveTactics.apply_tac ~term:_Rle_not_lt))) + ~continuation:(tac_zero_infeq_pos gl (-n,d))) + status + in + mk_tactic (tac_zero_inf_false gl (n,d)) +;; + +(* preuve que 0<=n*(1/d) => False ; n est negatif +*) + +let tac_zero_infeq_false gl (n,d) = + let tac_zero_infeq_false gl (n,d) status = + let (proof, goal) = status in + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + + debug("faccio fold di " ^ CicPp.ppterm + (Cic.Appl + [_Rle ; _R0 ; + Cic.Appl + [_Rmult ; int_to_real n ; Cic.Appl [_Rinv ; int_to_real d]] + ] + ) ^ "\n") ; + debug("apply di _Rlt_not_le a "^ CicPp.ppterm ty ^"\n"); + (*CSC: Patch to undo the over-simplification of RewriteSimpl *) + apply_tactic + (Tacticals.then_ + ~start: + (ReductionTactics.fold_tac + ~reduction:(const_lazy_reduction CicReduction.whd) + ~pattern:(ProofEngineTypes.conclusion_pattern None) + ~term: + (const_lazy_term + (Cic.Appl + [_Rle ; _R0 ; + Cic.Appl + [_Rmult ; int_to_real n ; Cic.Appl [_Rinv ; int_to_real d]]]))) + ~continuation: + (Tacticals.then_ + ~start:(PrimitiveTactics.apply_tac ~term:_Rlt_not_le) + ~continuation:(tac_zero_inf_pos (-n,d)))) + status + in + mk_tactic (tac_zero_infeq_false gl (n,d)) +;; + + +(* *********** ********** ******** ??????????????? *********** **************) + +let apply_type_tac ~cast:t ~applist:al = + let apply_type_tac ~cast:t ~applist:al (proof,goal) = + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let fresh_meta = ProofEngineHelpers.new_meta_of_proof proof in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context in + let metasenv' = (fresh_meta,context,t)::metasenv in + let proof' = curi,metasenv',_subst,pbo,pty, attrs in + let proof'',goals = + apply_tactic + (PrimitiveTactics.apply_tac + (*~term:(Cic.Appl ((Cic.Cast (Cic.Meta (fresh_meta,irl),t))::al)) *) + ~term:(Cic.Appl ((Cic.Meta (fresh_meta,irl))::al))) (* ??? *) + (proof',goal) + in + proof'',fresh_meta::goals + in + mk_tactic (apply_type_tac ~cast:t ~applist:al) +;; + +let my_cut ~term:c = + let my_cut ~term:c (proof,goal) = + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let fresh_meta = ProofEngineHelpers.new_meta_of_proof proof in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context in + let metasenv' = (fresh_meta,context,c)::metasenv in + let proof' = curi,metasenv',_subst,pbo,pty, attrs in + let proof'',goals = + apply_tactic + (apply_type_tac + ~cast:(Cic.Prod(Cic.Name "Anonymous",c,CicSubstitution.lift 1 ty)) + ~applist:[Cic.Meta(fresh_meta,irl)]) + (proof',goal) + in + (* We permute the generated goals to be consistent with Coq *) + match goals with + [] -> assert false + | he::tl -> proof'',he::fresh_meta::tl + in + mk_tactic (my_cut ~term:c) +;; + +let exact = PrimitiveTactics.exact_tac;; + +let tac_use h = + let tac_use h status = + let (proof, goal) = status in + debug("Inizio TC_USE\n"); + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + debug ("hname = "^ CicPp.ppterm h.hname ^"\n"); + debug ("ty = "^ CicPp.ppterm ty^"\n"); + apply_tactic + (match h.htype with + "Rlt" -> exact ~term:h.hname + | "Rle" -> exact ~term:h.hname + | "Rgt" -> (Tacticals.then_ + ~start:(PrimitiveTactics.apply_tac ~term:_Rfourier_gt_to_lt) + ~continuation:(exact ~term:h.hname)) + | "Rge" -> (Tacticals.then_ + ~start:(PrimitiveTactics.apply_tac ~term:_Rfourier_ge_to_le) + ~continuation:(exact ~term:h.hname)) + | "eqTLR" -> (Tacticals.then_ + ~start:(PrimitiveTactics.apply_tac ~term:_Rfourier_eqLR_to_le) + ~continuation:(exact ~term:h.hname)) + | "eqTRL" -> (Tacticals.then_ + ~start:(PrimitiveTactics.apply_tac ~term:_Rfourier_eqRL_to_le) + ~continuation:(exact ~term:h.hname)) + | _->assert false) + status + in + mk_tactic (tac_use h) +;; + +let is_ineq (h,t) = + match t with + Cic.Appl ( Cic.Const(u,boh)::next) -> + (if UriManager.eq u HelmLibraryObjects.Reals.rlt_URI or + UriManager.eq u HelmLibraryObjects.Reals.rgt_URI or + UriManager.eq u HelmLibraryObjects.Reals.rle_URI or + UriManager.eq u HelmLibraryObjects.Reals.rge_URI then true + else if UriManager.eq u HelmLibraryObjects.Logic.eq_URI then + (match (List.hd next) with + Cic.Const (uri,_) when + UriManager.eq uri HelmLibraryObjects.Reals.r_URI + -> true + | _ -> false) + else false) + |_->false +;; + +let list_of_sign s = List.map (fun (x,_,z)->(x,z)) s;; + +let mkAppL a = + Cic.Appl(Array.to_list a) +;; + +(* Résolution d'inéquations linéaires dans R *) +let rec strip_outer_cast c = match c with + | Cic.Cast (c,_) -> strip_outer_cast c + | _ -> c +;; + +(*let find_in_context id context = + let rec find_in_context_aux c n = + match c with + [] -> failwith (id^" not found in context") + | a::next -> (match a with + Some (Cic.Name(name),_) when name = id -> n + (*? magari al posto di _ qualcosaltro?*) + | _ -> find_in_context_aux next (n+1)) + in + find_in_context_aux context 1 +;; + +(* mi sembra quadratico *) +let rec filter_real_hyp context cont = + match context with + [] -> [] + | Some(Cic.Name(h),Cic.Decl(t))::next -> ( + let n = find_in_context h cont in + debug("assegno "^string_of_int n^" a "^CicPp.ppterm t^"\n"); + [(Cic.Rel(n),t)] @ filter_real_hyp next cont) + | a::next -> debug(" no\n"); filter_real_hyp next cont +;;*) + +let filter_real_hyp context _ = + let rec filter_aux context num = + match context with + [] -> [] + | Some(Cic.Name(h),Cic.Decl(t))::next -> + [(Cic.Rel(num),t)] @ filter_aux next (num+1) + | a::next -> filter_aux next (num+1) + in + filter_aux context 1 +;; + + +(* lifts everithing at the conclusion level *) +let rec superlift c n= + match c with + [] -> [] + | Some(name,Cic.Decl(a))::next -> + [Some(name,Cic.Decl(CicSubstitution.lift n a))]@ superlift next (n+1) + | Some(name,Cic.Def(a,None))::next -> + [Some(name,Cic.Def((CicSubstitution.lift n a),None))]@ superlift next (n+1) + | Some(name,Cic.Def(a,Some ty))::next -> + [Some(name, + Cic.Def((CicSubstitution.lift n a),Some (CicSubstitution.lift n ty))) + ] @ superlift next (n+1) + | _::next -> superlift next (n+1) (*?? ??*) + +;; + +let equality_replace a b = + let equality_replace a b status = + debug("inizio EQ\n"); + let module C = Cic in + let proof,goal = status in + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let a_eq_b = C.Appl [ _eqT ; _R ; a ; b ] in + let fresh_meta = ProofEngineHelpers.new_meta_of_proof proof in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context in + let metasenv' = (fresh_meta,context,a_eq_b)::metasenv in + debug("chamo rewrite tac su"^CicPp.ppterm (C.Meta (fresh_meta,irl))); + let (proof,goals) = apply_tactic + (EqualityTactics.rewrite_simpl_tac + ~direction:`LeftToRight + ~pattern:(ProofEngineTypes.conclusion_pattern None) + (C.Meta (fresh_meta,irl)) []) + ((curi,metasenv',_subst,pbo,pty, attrs),goal) + in + let new_goals = fresh_meta::goals in + debug("fine EQ -> goals : "^string_of_int( List.length new_goals) ^" = " + ^string_of_int( List.length goals)^"+ meta\n"); + (proof,new_goals) + in + mk_tactic (equality_replace a b) +;; + +let tcl_fail a (proof,goal) = + match a with + 1 -> raise (ProofEngineTypes.Fail (lazy "fail-tactical")) + | _ -> (proof,[goal]) +;; + +(* Galla: moved in variousTactics.ml +let assumption_tac (proof,goal)= + let curi,metasenv,pbo,pty = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let num = ref 0 in + let tac_list = List.map + ( fun x -> num := !num + 1; + match x with + Some(Cic.Name(nm),t) -> (nm,exact ~term:(Cic.Rel(!num))) + | _ -> ("fake",tcl_fail 1) + ) + context + in + Tacticals.first ~tactics:tac_list (proof,goal) +;; +*) +(* Galla: moved in negationTactics.ml +(* !!!!! fix !!!!!!!!!! *) +let contradiction_tac (proof,goal)= + Tacticals.then_ + (*inutile sia questo che quello prima della chiamata*) + ~start:PrimitiveTactics.intros_tac + ~continuation:(Tacticals.then_ + ~start:(VariousTactics.elim_type_tac ~term:_False) + ~continuation:(assumption_tac)) + (proof,goal) +;; +*) + +(* ********************* TATTICA ******************************** *) + +let rec fourier (s_proof,s_goal)= + let s_curi,s_metasenv,_subst,s_pbo,s_pty, attrs = s_proof in + let s_metano,s_context,s_ty = CicUtil.lookup_meta s_goal s_metasenv in + debug ("invoco fourier_tac sul goal "^string_of_int(s_goal)^" e contesto:\n"); + debug_pcontext s_context; + +(* here we need to negate the thesis, but to do this we need to apply the + right theoreme,so let's parse our thesis *) + + let th_to_appl = ref _Rfourier_not_le_gt in + (match s_ty with + Cic.Appl ( Cic.Const(u,boh)::args) -> + th_to_appl := + (if UriManager.eq u HelmLibraryObjects.Reals.rlt_URI then + _Rfourier_not_ge_lt + else if UriManager.eq u HelmLibraryObjects.Reals.rle_URI then + _Rfourier_not_gt_le + else if UriManager.eq u HelmLibraryObjects.Reals.rgt_URI then + _Rfourier_not_le_gt + else if UriManager.eq u HelmLibraryObjects.Reals.rge_URI then + _Rfourier_not_lt_ge + else failwith "fourier can't be applyed") + |_-> failwith "fourier can't be applyed"); + (* fix maybe strip_outer_cast goes here?? *) + + (* now let's change our thesis applying the th and put it with hp *) + + let proof,gl = apply_tactic + (Tacticals.then_ + ~start:(PrimitiveTactics.apply_tac ~term:!th_to_appl) + ~continuation:(PrimitiveTactics.intros_tac ())) + (s_proof,s_goal) + in + let goal = if List.length gl = 1 then List.hd gl + else failwith "a new goal" in + + debug ("port la tesi sopra e la nego. contesto :\n"); + debug_pcontext s_context; + + (* now we have all the right environment *) + + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + + (* now we want to convert hp to inequations, but first we must lift + everyting to thesis level, so that a variable has the save Rel(n) + in each hp ( needed by ineq1_of_term ) *) + + (* ? fix if None ?????*) + (* fix change superlift with a real name *) + + let l_context = superlift context 1 in + let hyps = filter_real_hyp l_context l_context in + + debug ("trasformo in diseq. "^ string_of_int (List.length hyps)^" ipotesi\n"); + + let lineq =ref [] in + + (* transform hyps into inequations *) + + List.iter (fun h -> try (lineq:=(ineq1_of_term h)@(!lineq)) + with _-> ()) + hyps; + + debug ("applico fourier a "^ string_of_int (List.length !lineq)^ + " disequazioni\n"); + + let res=fourier_lineq (!lineq) in + let tac=ref Tacticals.id_tac in + if res=[] then + (print_string "Tactic Fourier fails.\n";flush stdout; + failwith "fourier_tac fails") + else + ( + match res with (*match res*) + [(cres,sres,lc)]-> + + (* in lc we have the coefficient to "reduce" the system *) + + print_string "Fourier's method can prove the goal...\n";flush stdout; + + debug "I coeff di moltiplicazione rit sono: "; + + let lutil=ref [] in + List.iter + (fun (h,c) -> if c<>r0 then (lutil:=(h,c)::(!lutil); + (* DBG *)Fourier.print_rational(c);print_string " "(* DBG *)) + ) + (List.combine (!lineq) lc); + + print_string (" quindi lutil e' lunga "^ + string_of_int (List.length (!lutil))^"\n"); + + (* on construit la combinaison linéaire des inéquation *) + + (match (!lutil) with (*match (!lutil) *) + (h1,c1)::lutil -> + debug ("elem di lutil ");Fourier.print_rational c1;print_string "\n"; + + let s=ref (h1.hstrict) in + + + let t1 = ref (Cic.Appl [_Rmult;rational_to_real c1;h1.hleft] ) in + let t2 = ref (Cic.Appl [_Rmult;rational_to_real c1;h1.hright]) in + + List.iter (fun (h,c) -> + s:=(!s)||(h.hstrict); + t1:=(Cic.Appl [_Rplus;!t1;Cic.Appl + [_Rmult;rational_to_real c;h.hleft ] ]); + t2:=(Cic.Appl [_Rplus;!t2;Cic.Appl + [_Rmult;rational_to_real c;h.hright] ])) + lutil; + + let ineq=Cic.Appl [(if (!s) then _Rlt else _Rle);!t1;!t2 ] in + let tc=rational_to_real cres in + + +(* ora ho i termini che descrivono i passi di fourier per risolvere il sistema *) + + debug "inizio a costruire tac1\n"; + Fourier.print_rational(c1); + + let tac1=ref ( mk_tactic (fun status -> + apply_tactic + (if h1.hstrict then + (Tacticals.thens + ~start:(mk_tactic (fun status -> + debug ("inizio t1 strict\n"); + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + debug ("th = "^ CicPp.ppterm _Rfourier_lt ^"\n"); + debug ("ty = "^ CicPp.ppterm ty^"\n"); + apply_tactic + (PrimitiveTactics.apply_tac ~term:_Rfourier_lt) status)) + ~continuations:[tac_use h1; + tac_zero_inf_pos (rational_to_fraction c1)]) + else + (Tacticals.thens + ~start:(PrimitiveTactics.apply_tac ~term:_Rfourier_le) + ~continuations:[tac_use h1;tac_zero_inf_pos + (rational_to_fraction c1)])) + status)) + + in + s:=h1.hstrict; + List.iter (fun (h,c) -> + (if (!s) then + (if h.hstrict then + (debug("tac1 1\n"); + tac1:=(Tacticals.thens + ~start:(PrimitiveTactics.apply_tac ~term:_Rfourier_lt_lt) + ~continuations:[!tac1;tac_use h;tac_zero_inf_pos + (rational_to_fraction c)])) + else + (debug("tac1 2\n"); + Fourier.print_rational(c1); + tac1:=(Tacticals.thens + ~start:(mk_tactic (fun status -> + debug("INIZIO TAC 1 2\n"); + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + debug ("th = "^ CicPp.ppterm _Rfourier_lt_le ^"\n"); + debug ("ty = "^ CicPp.ppterm ty^"\n"); + apply_tactic + (PrimitiveTactics.apply_tac ~term:_Rfourier_lt_le) + status)) + ~continuations:[!tac1;tac_use h;tac_zero_inf_pos + (rational_to_fraction c)]))) + else + (if h.hstrict then + (debug("tac1 3\n"); + tac1:=(Tacticals.thens + ~start:(PrimitiveTactics.apply_tac ~term:_Rfourier_le_lt) + ~continuations:[!tac1;tac_use h;tac_zero_inf_pos + (rational_to_fraction c)])) + else + (debug("tac1 4\n"); + tac1:=(Tacticals.thens + ~start:(PrimitiveTactics.apply_tac ~term:_Rfourier_le_le) + ~continuations:[!tac1;tac_use h;tac_zero_inf_pos + (rational_to_fraction c)])))); + s:=(!s)||(h.hstrict)) (* end fun -> *) + lutil;(*end List.iter*) + + let tac2 = + if sres then + tac_zero_inf_false goal (rational_to_fraction cres) + else + tac_zero_infeq_false goal (rational_to_fraction cres) + in + tac:=(Tacticals.thens + ~start:(my_cut ~term:ineq) + ~continuations:[Tacticals.then_ + ~start:( mk_tactic (fun status -> + let (proof, goal) = status in + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + apply_tactic + (ReductionTactics.change_tac + ~pattern:(ProofEngineTypes.conclusion_pattern (Some ty)) + (const_lazy_term (Cic.Appl [ _not; ineq]))) + status)) + ~continuation:(Tacticals.then_ + ~start:(PrimitiveTactics.apply_tac ~term: + (if sres then _Rnot_lt_lt else _Rnot_le_le)) + ~continuation:(Tacticals.thens + ~start:(mk_tactic (fun status -> + debug("t1 ="^CicPp.ppterm !t1 ^"t2 ="^ + CicPp.ppterm !t2 ^"tc="^ CicPp.ppterm tc^"\n"); + let r = apply_tactic + (equality_replace (Cic.Appl [_Rminus;!t2;!t1] ) tc) + status + in + (match r with (p,gl) -> + debug("eq1 ritorna "^string_of_int(List.length gl)^"\n" )); + r)) + ~continuations:[(Tacticals.thens + ~start:(mk_tactic (fun status -> + let r = apply_tactic + (equality_replace (Cic.Appl[_Rinv;_R1]) _R1) + status + in + (match r with (p,gl) -> + debug("eq2 ritorna "^string_of_int(List.length gl)^"\n" )); + r)) + ~continuations: + [PrimitiveTactics.apply_tac ~term:_Rinv_R1; + Tacticals.first + ~tactics:[Ring.ring_tac; Tacticals.id_tac] + ]) + ;(*Tacticals.id_tac*) + Tacticals.then_ + ~start:(mk_tactic (fun status -> + let (proof, goal) = status in + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + (* check if ty is of type *) + let w1 = + debug("qui c'e' gia' l'or "^CicPp.ppterm ty^"\n"); + (match ty with + Cic.Prod (Cic.Anonymous,a,b) -> (Cic.Appl [_not;a]) + |_ -> assert false) + in + let r = apply_tactic + (ReductionTactics.change_tac + ~pattern:(ProofEngineTypes.conclusion_pattern (Some ty)) + (const_lazy_term w1)) status + in + debug("fine MY_CHNGE\n"); + r)) + ~continuation:(*PORTINGTacticals.id_tac*)tac2])) + ;(*Tacticals.id_tac*)!tac1]);(*end tac:=*) + + |_-> assert false)(*match (!lutil) *) + |_-> assert false); (*match res*) + debug ("finalmente applico tac\n"); + ( + let r = apply_tactic !tac (proof,goal) in + debug("\n\n]]]]]]]]]]]]]]]]]) That's all folks ([[[[[[[[[[[[[[[[[[[\n\n");r + + ) +;; + +let fourier_tac = mk_tactic fourier + + diff --git a/components/tactics/fourierR.mli b/components/tactics/fourierR.mli new file mode 100644 index 000000000..e5790ec0f --- /dev/null +++ b/components/tactics/fourierR.mli @@ -0,0 +1,5 @@ +(* +val rewrite_tac: term:Cic.term -> ProofEngineTypes.tactic +val rewrite_simpl_tac: term:Cic.term -> ProofEngineTypes.tactic +*) +val fourier_tac: ProofEngineTypes.tactic diff --git a/components/tactics/fwdSimplTactic.ml b/components/tactics/fwdSimplTactic.ml new file mode 100644 index 000000000..8734837d1 --- /dev/null +++ b/components/tactics/fwdSimplTactic.ml @@ -0,0 +1,173 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +module PEH = ProofEngineHelpers +module U = CicUniv +module TC = CicTypeChecker +module PET = ProofEngineTypes +module S = CicSubstitution +module PT = PrimitiveTactics +module T = Tacticals +module FNG = FreshNamesGenerator +module MI = CicMkImplicit +module PESR = ProofEngineStructuralRules +module HEL = HExtlib + +let fail_msg0 = "unexported clearbody: invalid argument" +let fail_msg2 = "fwd: no applicable simplification" + +let error msg = raise (PET.Fail (lazy msg)) + +(* unexported tactics *******************************************************) + +let id_tac = + let id_tac (proof,goal) = + try + let _, metasenv, _subst, _, _, _ = proof in + let _, _, _ = CicUtil.lookup_meta goal metasenv in + (proof,[goal]) + with CicUtil.Meta_not_found _ -> (proof, []) + in + PET.mk_tactic id_tac + +let clearbody ~index = + let rec find_name index = function + | Some (Cic.Name name, _) :: _ when index = 1 -> name + | _ :: tail when index > 1 -> find_name (pred index) tail + | _ -> error fail_msg0 + in + let clearbody status = + let (proof, goal) = status in + let _, metasenv, _subst, _, _, _ = proof in + let _, context, _ = CicUtil.lookup_meta goal metasenv in + PET.apply_tactic (PESR.clearbody ~hyp:(find_name index context)) status + in + PET.mk_tactic clearbody + +(* lapply *******************************************************************) + +let strip_prods metasenv context ?how_many to_what term = + let irl = MI.identity_relocation_list_for_metavariable context in + let mk_meta metasenv its_type = + let index = MI.new_meta metasenv [] in + let metasenv = [index, context, its_type] @ metasenv in + metasenv, Cic.Meta (index, irl), index + in + let update_counters = function + | None, [] -> None, false, id_tac, [] + | None, to_what :: tail -> None, true, PT.apply_tac ~term:to_what, tail + | Some hm, [] -> Some (pred hm), false, id_tac, [] + | Some hm, to_what :: tail -> Some (pred hm), true, PT.apply_tac ~term:to_what, tail + in + let rec aux metasenv metas conts tw = function + | Some hm, _ when hm <= 0 -> metasenv, metas, conts + | xhm, Cic.Prod (Cic.Name _, t1, t2) -> + let metasenv, meta, index = mk_meta metasenv t1 in + aux metasenv (meta :: metas) (conts @ [id_tac, index]) tw (xhm, (S.subst meta t2)) + | xhm, Cic.Prod (Cic.Anonymous, t1, t2) -> + let xhm, pos, tac, tw = update_counters (xhm, tw) in + let metasenv, meta, index = mk_meta metasenv t1 in + let conts = if pos then (tac, index) :: conts else conts @ [tac, index] in + aux metasenv (meta :: metas) conts tw (xhm, (S.subst meta t2)) + | _, t -> metasenv, metas, conts + in + aux metasenv [] [] to_what (how_many, term) + +let get_clearables context terms = + let aux = function + | Cic.Rel i + | Cic.Appl (Cic.Rel i :: _) -> PEH.get_name context i + | _ -> None + in + HEL.list_rev_map_filter aux terms + +let lapply_tac_aux ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) + (* ?(substs = []) *) ?how_many ?(to_what = []) what = + let letin_tac term = PT.letin_tac ~mk_fresh_name_callback term in + let lapply_tac (proof, goal) = + let xuri, metasenv, _subst, u, t, attrs = proof in + let _, context, _ = CicUtil.lookup_meta goal metasenv in + let lemma, _ = TC.type_of_aux' metasenv context what U.empty_ugraph in + let lemma = FNG.clean_dummy_dependent_types lemma in + let metasenv, metas, conts = strip_prods metasenv context ?how_many to_what lemma in + let conclusion = + match metas with [] -> what | _ -> Cic.Appl (what :: List.rev metas) + in + let tac = + T.then_ ~start:(letin_tac conclusion) + ~continuation:(clearbody ~index:1) + in + let proof = (xuri, metasenv, _subst, u, t, attrs) in + let aux (proof, goals) (tac, goal) = + let proof, new_goals = PET.apply_tactic tac (proof, goal) in + proof, goals @ new_goals + in + List.fold_left aux (proof, []) ((tac, goal) :: conts) + in + PET.mk_tactic lapply_tac + +let lapply_tac ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) + (* ?(substs = []) *) ?(linear = false) ?how_many ?(to_what = []) what = + let lapply_tac status = + let proof, goal = status in + let _, metasenv, _subst, _, _, _ = proof in + let _, context, _ = CicUtil.lookup_meta goal metasenv in + let lapply = lapply_tac_aux ~mk_fresh_name_callback ?how_many ~to_what what in + let tac = + if linear then + let hyps = get_clearables context (what :: to_what) in + T.then_ ~start:lapply + ~continuation:(PESR.clear ~hyps) (* T.try_tactic ~tactic: *) + else + lapply + in + PET.apply_tactic tac status + in + PET.mk_tactic lapply_tac + +(* fwd **********************************************************************) + +let fwd_simpl_tac + ?(mk_fresh_name_callback = FNG.mk_fresh_name ~subst:[]) + ~dbd hyp = + let lapply_tac to_what lemma = + lapply_tac ~mk_fresh_name_callback ~how_many:1 ~to_what:[to_what] lemma + in + let fwd_simpl_tac status = + let (proof, goal) = status in + let _, metasenv, _subst, _, _, _ = proof in + let _, context, ty = CicUtil.lookup_meta goal metasenv in + let index, major = PEH.lookup_type metasenv context hyp in + match FwdQueries.fwd_simpl ~dbd major with + | [] -> error fail_msg2 + | uri :: _ -> + Printf.eprintf "fwd: %s\n" (UriManager.string_of_uri uri); flush stderr; + let start = lapply_tac (Cic.Rel index) (Cic.Const (uri, [])) in + let tac = T.then_ ~start ~continuation:(PESR.clear ~hyps:[hyp]) in + PET.apply_tactic tac status + in + PET.mk_tactic fwd_simpl_tac diff --git a/components/tactics/fwdSimplTactic.mli b/components/tactics/fwdSimplTactic.mli new file mode 100644 index 000000000..f130fe7b4 --- /dev/null +++ b/components/tactics/fwdSimplTactic.mli @@ -0,0 +1,33 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val lapply_tac: + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ?linear:bool -> ?how_many:int -> ?to_what:Cic.term list -> Cic.term -> + ProofEngineTypes.tactic + +val fwd_simpl_tac: + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + dbd:HSql.dbd -> string -> ProofEngineTypes.tactic diff --git a/components/tactics/hashtbl_equiv.ml b/components/tactics/hashtbl_equiv.ml new file mode 100644 index 000000000..86448268c --- /dev/null +++ b/components/tactics/hashtbl_equiv.ml @@ -0,0 +1,190 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*********************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 8/09/2004 *) +(* *) +(* *) +(*********************************************************************) + +(* $Id$ *) + +(* the file contains an hash table of objects of the library + equivalent to some object in the standard subset; it is + mostly used to filter useless cases in auto *) + + +let equivalent_objects = +(* finte costanti; i.e. costanti senza corpo *) +[UriManager.uri_of_string "cic:/Rocq/DEMOS/Demo_AutoRewrite/Ack0.con"(*,"finte costanti"*); + UriManager.uri_of_string "cic:/Rocq/DEMOS/Demo_AutoRewrite/Ac10.con"(*,"finte costanti"*); + UriManager.uri_of_string "cic:/Rocq/DEMOS/Demo_AutoRewrite/Ack2.con"(*,"finte costanti"*) + ]@ +(* inutili mostri *) +[UriManager.uri_of_string "cic:/Rocq/DEMOS/Demo_AutoRewrite/Resg0.con"(*,"useless monster"*); + UriManager.uri_of_string "cic:/Rocq/DEMOS/Demo_AutoRewrite/Resg1.con"(*,"useless monster"*); + UriManager.uri_of_string "cic:/Rocq/DEMOS/Demo_AutoRewrite/ResAck0.con"(*,"useless monster"*) + ]@ +(* istanze *) + (UriManager.uri_of_string "cic:/Coq/Init/Peano/eq_S.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Logic/f_equal.con"*)):: +[ +UriManager.uri_of_string "cic:/Paris/ZF/src/useful/lem_iff_sym.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Logic/iff_sym.con"*); +UriManager.uri_of_string "cic:/Lyon/AUTOMATA/Ensf_types/False_imp_P.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Logic/False_ind.con"*); +UriManager.uri_of_string "cic:/Rocq/TreeAutomata/bases/plus_O_r.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_0_r.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/Rfunctions/sum_f_R0_triangle.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/PartSum/Rabs_triang_gen.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Bertrand/Misc/eq_plus.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_reg_l.con"*); +UriManager.uri_of_string "cic:/Suresnes/BDD/rauzy/algorithme1/Prelude_BDT/deMorgan_not_and.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/or_not_and.con"*); +UriManager.uri_of_string "cic:/Rocq/DEMOS/Sorting/diff_true_false.con"(*,UriManager.uri_of_string "cic:/Coq/Bool/Bool/diff_true_false.con"*); +UriManager.uri_of_string "cic:/CoRN/metrics/CMetricSpaces/nz.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Max/le_max_l.con"*); +UriManager.uri_of_string "cic:/Coq/Logic/Decidable/not_or.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/not_or_and.con"*); +UriManager.uri_of_string "cic:/Coq/Init/Logic/sym_not_equal.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Logic/sym_not_eq.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/R_sqrt/sqrt_sqrt.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/R_sqrt/sqrt_def.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/Rlimit/eps2_Rgt_R0_subproof.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/Rlimit/eps2_Rgt_R0.con"*); +UriManager.uri_of_string "cic:/Coq/Logic/Eqdep_dec/eqT2eq.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Eqdep_dec/eq2eqT.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/R_sqr/Rsqr_eq_0.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/RIneq/Rsqr_0_uniq.con"*); +UriManager.uri_of_string "cic:/Rocq/THREE_GAP/Nat_compl/en_plus.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_0_r.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zabs_10.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zabs/Zabs_pos.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/Rlimit/Rlt_eps4_eps_subproof0.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/Rlimit/Rlt_eps2_eps_subproof.con"*); +UriManager.uri_of_string "cic:/Coq/Arith/Le/le_refl.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Peano/le.ind#xpointer(1/1/1)"*); +UriManager.uri_of_string "cic:/Rocq/TreeAutomata/bases/le_n_n.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Le/le_refl.con"*); +UriManager.uri_of_string "cic:/Coq/ZArith/auxiliary/Zred_factor1.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/BinInt/Zplus_diag_eq_mult_2.con"*); +UriManager.uri_of_string "cic:/Coq/Relations/Newman/caseRxy.con"(*,UriManager.uri_of_string "cic:/Coq/Relations/Newman/Ind_proof.con"*); +UriManager.uri_of_string "cic:/Rocq/TreeAutomata/bases/S_plus_r.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Peano/plus_n_Sm.con"*); +UriManager.uri_of_string "cic:/Eindhoven/POCKLINGTON/lemmas/Zmult_ab0a0b0.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/BinInt/Zmult_integral.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Algebra/Z_group/ax8.con"(*,UriManager.uri_of_string "cic:/Coq/NArith/BinPos/ZC2.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Algebra/Z_group/Zlt_reg_l.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zplus_lt_compat_l.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/MATHS/Z/Nat_complements/mult_neutr.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Mult/mult_1_l.con"*); +UriManager.uri_of_string "cic:/Coq/fourier/Fourier_util/Rlt_zero_1.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/RIneq/Rlt_0_1.con"*); +UriManager.uri_of_string "cic:/Suresnes/BDD/rauzy/algorithme1/Prelude_BDT/Classic.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/NNPP.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/R_sqr/Rsqr_pos_lt.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/RIneq/Rlt_0_sqr.con"*); +UriManager.uri_of_string "cic:/Rocq/THREE_GAP/Nat_compl/lt_minus2.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/ArithProp/lt_minus_O_lt.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/Rtrigo_def/sin_antisym.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/Rtrigo/sin_neg.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Functions_in_ZFC/Functions_in_ZFC/false_implies_everything.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Logic/False_ind.con"*); +UriManager.uri_of_string "cic:/Coq/ring/Setoid_ring_normalize/index_eq_prop.con"(*,UriManager.uri_of_string "cic:/Coq/ring/Ring_normalize/index_eq_prop.con"*); +UriManager.uri_of_string "cic:/CoRN/algebra/Basics/le_pred.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Le/le_pred.con"*); +UriManager.uri_of_string "cic:/Lannion/continuations/FOUnify_cps/nat_complements/le_S_eqP.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Compare/le_le_S_eq.con"*); +UriManager.uri_of_string "cic:/Coq/Sorting/Permutation/permut_right.con"(*,UriManager.uri_of_string "cic:/Coq/Sorting/Permutation/permut_cons.con"*); +UriManager.uri_of_string "cic:/Eindhoven/POCKLINGTON/lemmas/Zlt_mult_l.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zmult_lt_compat_l.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/RIneq/Rplus_lt_0_compat.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/DiscrR/Rplus_lt_pos.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zpower_1_subproof.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/BinInt/Zmult_1_r.con"*); +UriManager.uri_of_string "cic:/CoRN/fta/KeyLemma/lem_1c.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Minus/le_minus.con"*); +UriManager.uri_of_string "cic:/Coq/omega/OmegaLemmas/OMEGA20.con"(*,UriManager.uri_of_string "cic:/Coq/omega/OmegaLemmas/OMEGA17.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/pair_2.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Datatypes/injective_projections.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/Rlimit/Rlt_eps4_eps_subproof.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/Rlimit/Rlt_eps2_eps_subproof.con"*); +UriManager.uri_of_string "cic:/CoRN/algebra/Basics/le_mult_right.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Mult/mult_le_compat_r.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zle_lt_plus_plus.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zplus_le_lt_compat.con"*); +UriManager.uri_of_string "cic:/Rocq/ARITH/Chinese/Nat_complements/lt_minus2.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/ArithProp/lt_minus_O_lt.con"*); +UriManager.uri_of_string "cic:/Rocq/THREE_GAP/Nat_compl/not_gt_le.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Compare_dec/not_gt.con"*); +UriManager.uri_of_string "cic:/Rocq/ARITH/Chinese/Nat_complements/mult_commut.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Mult/mult_comm.con"*); +UriManager.uri_of_string "cic:/CoRN/algebra/Basics/lt_mult_right.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Mult/mult_lt_compat_r.con"*); +UriManager.uri_of_string "cic:/Rocq/ARITH/Chinese/Nat_complements/mult_neutr.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Mult/mult_1_l.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zabs_neg.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zabs/Zabs_non_eq.con"*); +UriManager.uri_of_string "cic:/Lyon/FIRING-SQUAD/bib/plus_S.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Peano/plus_Sn_m.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Qhomographic_Qpositive_to_Qpositive/one_non_negative.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zle_0_1.con"*); +UriManager.uri_of_string "cic:/Coq/fourier/Fourier_util/Rle_zero_1.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/RIneq/Rle_0_1.con"*); +UriManager.uri_of_string "cic:/Coq/Logic/Diaconescu/proof_irrel.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/proof_irrelevance.con"*); +UriManager.uri_of_string "cic:/Coq/Init/Logic/sym_equal.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Logic/sym_eq.con"*); +UriManager.uri_of_string "cic:/Coq/IntMap/Mapiter/pair_sp.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Datatypes/surjective_pairing.con"*); +UriManager.uri_of_string "cic:/Coq/Logic/ProofIrrelevance/proof_irrelevance_cci.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/proof_irrelevance.con"*); +UriManager.uri_of_string "cic:/Suresnes/BDD/rauzy/algorithme1/Prelude_BDT/deMorgan_or_not.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/not_and_or.con"*); +UriManager.uri_of_string "cic:/CoRN/model/structures/Zsec/Zplus_wd0.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/BinInt/Zplus_eq_compat.con"*); +UriManager.uri_of_string "cic:/Coq/ZArith/auxiliary/Zred_factor6.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/BinInt/Zplus_0_r_reverse.con"*); +UriManager.uri_of_string "cic:/Eindhoven/POCKLINGTON/lemmas/S_inj.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Peano/eq_add_S.con"*); +UriManager.uri_of_string "cic:/Coq/ZArith/Wf_Z/Z_of_nat_complete.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/RIneq/IZN.con"*); +UriManager.uri_of_string "cic:/Suresnes/BDD/rauzy/algorithme1/Prelude_BDT/Commutative_orb.con"(*,UriManager.uri_of_string "cic:/Coq/Bool/Bool/orb_comm.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/PartSum/plus_sum.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/Cauchy_prod/sum_plus.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Qpositive/minus_le.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Minus/le_minus.con"*); +UriManager.uri_of_string "cic:/Lyon/FIRING-SQUAD/bib/plus_zero.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_0_r.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Cours-de-Coq/ex1_auto/not_not_converse.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/NNPP.con"*); +UriManager.uri_of_string "cic:/Suresnes/BDD/rauzy/algorithme1/Prelude_BDT/deMorgan_and_not.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/not_or_and.con"*); +UriManager.uri_of_string "cic:/Suresnes/BDD/rauzy/algorithme1/Prelude_BDT/Commutative_andb.con"(*,UriManager.uri_of_string "cic:/Coq/Bool/Bool/andb_comm.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/MATHS/Z/Nat_complements/lt_minus2.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/ArithProp/lt_minus_O_lt.con"*); +UriManager.uri_of_string "cic:/Suresnes/BDD/canonicite/Prelude0/Morgan_and_not.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/not_or_and.con"*); +UriManager.uri_of_string "cic:/Coq/Logic/ClassicalFacts/TrueP.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/ClassicalFacts/FalseP.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zminus_eq.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/BinInt/Zminus_eq.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Cours-de-Coq/ex1/not_not_converse.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/NNPP.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/pair_1.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Datatypes/surjective_pairing.con"*); +UriManager.uri_of_string "cic:/Orsay/Maths/divide/Zabs_ind.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zabs/Zabs_ind.con"*); +UriManager.uri_of_string "cic:/CoRN/algebra/Basics/Zmult_minus_distr_r.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/BinInt/Zmult_minus_distr_l.con"*); +UriManager.uri_of_string "cic:/Coq/fourier/Fourier_util/Rfourier_eqLR_to_le.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/RIneq/Req_le.con"*); +UriManager.uri_of_string "cic:/Rocq/TreeAutomata/bases/Sn_eq_Sm_n_eq_m.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Peano/eq_add_S.con"*); +UriManager.uri_of_string "cic:/Coq/Init/Logic/trans_equal.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Logic/trans_eq.con"*); +UriManager.uri_of_string "cic:/Coq/omega/OmegaLemmas/OMEGA2.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zplus_le_0_compat.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Bertrand/Raux/P_Rmin.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/Rpower/P_Rmin.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/MATHS/Z/Nat_complements/mult_commut.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Mult/mult_comm.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Huffman/Aux/le_minus.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Minus/le_minus.con"*); +UriManager.uri_of_string "cic:/Coq/Init/Peano/plus_O_n.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_0_l.con"*); +UriManager.uri_of_string "cic:/Coq/Logic/Berardi/inv2.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Berardi/AC.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/SeqProp/not_Rlt.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/RIneq/Rnot_lt_ge.con"*); +UriManager.uri_of_string "cic:/Nancy/FOUnify/nat_complements/le_S_eqP.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Compare/le_le_S_eq.con"*); +UriManager.uri_of_string "cic:/Rocq/TreeAutomata/bases/le_mult_l.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Mult/mult_le_compat_r.con"*); +UriManager.uri_of_string "cic:/Eindhoven/POCKLINGTON/natZ/isnat_mult.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zmult_le_0_compat.con"*); +UriManager.uri_of_string "cic:/Coq/fourier/Fourier_util/Rfourier_eqRL_to_le.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/RIneq/Req_le_sym.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zabs_mult.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zabs/Zabs_Zmult.con"*); +UriManager.uri_of_string "cic:/Rocq/TreeAutomata/bases/plus_n_O.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_0_r.con"*); +UriManager.uri_of_string "cic:/Suresnes/BDD/rauzy/algorithme1/Prelude_BDT/excluded_middle.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/classic.con"*); +UriManager.uri_of_string "cic:/Rocq/TreeAutomata/bases/le_mult_mult.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Mult/mult_le_compat.con"*); +UriManager.uri_of_string "cic:/Coq/Bool/Bool/Is_true_eq_true2.con"(*,UriManager.uri_of_string "cic:/Coq/Bool/Bool/Is_true_eq_left.con"*); +UriManager.uri_of_string "cic:/Eindhoven/POCKLINGTON/natZ/isnat_plus.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zplus_le_0_compat.con"*); +UriManager.uri_of_string "cic:/Eindhoven/POCKLINGTON/lemmas/lt_plus_plus.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_lt_compat.con"*); +UriManager.uri_of_string "cic:/Rocq/TreeAutomata/bases/le_mult_r.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Mult/mult_le_compat_l.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Functions_in_ZFC/Functions_in_ZFC/excluded_middle.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/NNPP.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Algebra/Z_group/ax3.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zgt_pos_0.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zabs_plus.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zabs/Zabs_triangle.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Buchberger/Buch/Sdep.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Datatypes/prod_ind.con"*); +UriManager.uri_of_string "cic:/Coq/Reals/PartSum/Rsum_abs.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/PartSum/Rabs_triang_gen.con"*); +UriManager.uri_of_string "cic:/Cachan/SMC/mu/minus_n_m_le_n.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Minus/le_minus.con"*); +UriManager.uri_of_string "cic:/Marseille/GC/lib_arith/lib_S_pred/eqnm_eqSnSm.con"(*,UriManager.uri_of_string "cic:/Coq/Init/Peano/eq_S.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zpower_1_subproof_subproof.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/BinInt/Zmult_1_r.con"*); +UriManager.uri_of_string "cic:/Eindhoven/POCKLINGTON/lemmas/predminus1.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Minus/pred_of_minus.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Bertrand/Raux/Rpower_pow.con"(*,UriManager.uri_of_string "cic:/Coq/Reals/Rpower/Rpower_pow.con"*); +UriManager.uri_of_string "cic:/Lyon/FIRING-SQUAD/bib/lt_plus_plus.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_lt_compat.con"*); +UriManager.uri_of_string "cic:/Eindhoven/POCKLINGTON/lemmas/Zlt_neq.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zlt_not_eq.con"*); +UriManager.uri_of_string "cic:/Coq/Arith/Lt/nat_total_order.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Compare_dec/not_eq.con"*); +UriManager.uri_of_string "cic:/Rocq/TreeAutomata/bases/plus_O_l.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_0_r.con"*); +UriManager.uri_of_string "cic:/Coq/Logic/ClassicalFacts/boolP.ind#xpointer(1/1/2)"(*,UriManager.uri_of_string "cic:/Coq/Logic/ClassicalFacts/boolP.ind#xpointer(1/1/1)"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zmult_pos_pos.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zmult_lt_O_compat.con"*); +UriManager.uri_of_string "cic:/Nijmegen/QArith/Zaux/Zlt_plus_plus.con"(*,UriManager.uri_of_string "cic:/Coq/ZArith/Zorder/Zplus_lt_compat.con"*); +UriManager.uri_of_string "cic:/Coq/Logic/Diaconescu/pred_ext_and_rel_choice_imp_EM.con"(*,UriManager.uri_of_string "cic:/Coq/Logic/Classical_Prop/classic.con"*); +UriManager.uri_of_string "cic:/Sophia-Antipolis/Rsa/MiscRsa/eq_plus.con"(*,UriManager.uri_of_string "cic:/Coq/Arith/Plus/plus_reg_l.con"*) +] +;; + +let equiv_table = Hashtbl.create 503 +;; + +let _ = List.iter (fun a -> Hashtbl.add equiv_table a "") equivalent_objects +;; + +let not_a_duplicate u = + try + ignore(Hashtbl.find equiv_table u); false + with + Not_found -> true +;; diff --git a/components/tactics/hashtbl_equiv.mli b/components/tactics/hashtbl_equiv.mli new file mode 100644 index 000000000..d2608b862 --- /dev/null +++ b/components/tactics/hashtbl_equiv.mli @@ -0,0 +1,38 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*********************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 8/09/2004 *) +(* *) +(* *) +(*********************************************************************) + + +val not_a_duplicate : UriManager.uri -> bool + diff --git a/components/tactics/history.ml b/components/tactics/history.ml new file mode 100644 index 000000000..7559f367e --- /dev/null +++ b/components/tactics/history.ml @@ -0,0 +1,86 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +exception History_failure + +class ['a] history size = + let unsome = function Some x -> x | None -> assert false in + object (self) + + val history_data = Array.create (size + 1) None + + val mutable history_hd = 0 (* rightmost index *) + val mutable history_cur = 0 (* current index *) + val mutable history_tl = 0 (* leftmost index *) + + method private is_empty = history_data.(history_cur) = None + + method push (status: 'a) = + if self#is_empty then + history_data.(history_cur) <- Some status + else begin + history_cur <- (history_cur + 1) mod size; + history_data.(history_cur) <- Some status; + history_hd <- history_cur; (* throw away fake future line *) + if history_hd = history_tl then (* tail overwritten *) + history_tl <- (history_tl + 1) mod size + end + + method undo = function + | 0 -> unsome history_data.(history_cur) + | steps when steps > 0 -> + let max_undo_steps = + if history_cur >= history_tl then + history_cur - history_tl + else + history_cur + (size - history_tl) + in + if steps > max_undo_steps then + raise History_failure; + history_cur <- history_cur - steps; + if history_cur < 0 then (* fix underflow *) + history_cur <- size + history_cur; + unsome history_data.(history_cur) + | steps (* when steps > 0 *) -> self#redo ~-steps + + method redo = function + | 0 -> unsome history_data.(history_cur) + | steps when steps > 0 -> + let max_redo_steps = + if history_hd >= history_cur then + history_hd - history_cur + else + history_hd + (size - history_cur) + in + if steps > max_redo_steps then + raise History_failure; + history_cur <- (history_cur + steps) mod size; + unsome history_data.(history_cur) + | steps (* when steps > 0 *) -> self#undo ~-steps + + end + diff --git a/components/tactics/history.mli b/components/tactics/history.mli new file mode 100644 index 000000000..86bad463f --- /dev/null +++ b/components/tactics/history.mli @@ -0,0 +1,35 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception History_failure + +class ['a] history : + int -> + object + method push : 'a -> unit + method redo : int -> 'a + method undo : int -> 'a + end + diff --git a/components/tactics/introductionTactics.ml b/components/tactics/introductionTactics.ml new file mode 100644 index 000000000..d8caf933b --- /dev/null +++ b/components/tactics/introductionTactics.ml @@ -0,0 +1,49 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +let fake_constructor_tac ~n (proof, goal) = + let module C = Cic in + let module R = CicReduction in + let (_,metasenv,_subst,_,_, _) = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + match (R.whd context ty) with + (C.MutInd (uri, typeno, exp_named_subst)) + | (C.Appl ((C.MutInd (uri, typeno, exp_named_subst))::_)) -> + ProofEngineTypes.apply_tactic ( + PrimitiveTactics.apply_tac + ~term: (C.MutConstruct (uri, typeno, n, exp_named_subst))) + (proof, goal) + | _ -> raise (ProofEngineTypes.Fail (lazy "Constructor: failed")) +;; + +let constructor_tac ~n = ProofEngineTypes.mk_tactic (fake_constructor_tac ~n) + +let exists_tac = ProofEngineTypes.mk_tactic (fake_constructor_tac ~n:1) ;; +let split_tac = ProofEngineTypes.mk_tactic (fake_constructor_tac ~n:1) ;; +let left_tac = ProofEngineTypes.mk_tactic (fake_constructor_tac ~n:1) ;; +let right_tac = ProofEngineTypes.mk_tactic (fake_constructor_tac ~n:2) ;; + diff --git a/components/tactics/introductionTactics.mli b/components/tactics/introductionTactics.mli new file mode 100644 index 000000000..c3a12720b --- /dev/null +++ b/components/tactics/introductionTactics.mli @@ -0,0 +1,31 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val constructor_tac: n:int -> ProofEngineTypes.tactic + +val exists_tac: ProofEngineTypes.tactic +val split_tac: ProofEngineTypes.tactic +val left_tac: ProofEngineTypes.tactic +val right_tac: ProofEngineTypes.tactic diff --git a/components/tactics/inversion.ml b/components/tactics/inversion.ml new file mode 100644 index 000000000..e61021244 --- /dev/null +++ b/components/tactics/inversion.ml @@ -0,0 +1,361 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. +* + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +exception TheTypeOfTheCurrentGoalIsAMetaICannotChooseTheRightElimiantionPrinciple +exception NotAnInductiveTypeToEliminate + +let debug = false;; +let debug_print = + fun msg -> if debug then prerr_endline (Lazy.force msg) else () + + +let inside_obj = function + | Cic.InductiveDefinition (type_list,params, nleft, _) -> + (type_list,params,nleft) + | _ -> raise (Invalid_argument "Errore in inside_obj") + +let term_to_list = function + | Cic.Appl l -> l + | _ -> raise (Invalid_argument "Errore in term_to_list") + + +let rec baseuri_of_term = function + | Cic.Appl l -> baseuri_of_term (List.hd l) + | Cic.MutInd (baseuri, tyno, []) -> baseuri + | _ -> raise (Invalid_argument "baseuri_of_term") + +(* returns DX1 = DX1 -> ... DXn=DXn -> GOALTY *) +let rec foo_cut nleft parameters parameters_ty body uri_of_eq = + if nleft > 0 + then + foo_cut (nleft-1) (List.tl parameters) (List.tl parameters_ty) body + uri_of_eq + else + match parameters with + | hd::tl -> + Cic.Prod ( + Cic.Anonymous, + Cic.Appl[Cic.MutInd (uri_of_eq ,0,[]); + (List.hd parameters_ty) ; hd; hd], + foo_cut nleft (List.map (CicSubstitution.lift 1) tl) + (List.map (CicSubstitution.lift 1) (List.tl parameters_ty)) + (CicSubstitution.lift 1 body) uri_of_eq ) + | [] -> body +;; + +(* from a complex Cic.Prod term, return the list of its components *) +let rec get_sort_type term = + match term with + | Cic.Prod (_,src,tgt) -> (get_sort_type tgt) + | _ -> term +;; + + +let rec cut_first n l = + if n>0 then + match l with + | hd::tl -> cut_first (n-1) tl + | [] -> [] + else l +;; + + +let rec cut_last l = + match l with + | hd::tl when tl != [] -> hd:: (cut_last tl) + | _ -> [] +;; + +(* returns the term to apply*) +let foo_appl nleft nright_consno term uri = + let l = [] in + let a = ref l in + for n = 1 to nleft do + a := !a @ [(Cic.Implicit None)] + done; + a:= !a @ [term]; + for n = 1 to nright_consno do + a := !a @ [(Cic.Implicit None)] + done; + (* apply i_ind ? ... ? H *) + Cic.Appl ([Cic.Const(uri,[])] @ !a @ [Cic.Rel 1]) +;; + + +let rec foo_prod nright right_param_tys rightparameters l2 base_rel goalty + uri_of_eq rightparameters_ termty isSetType term = + match right_param_tys with + | hd::tl -> Cic.Prod ( + Cic.Anonymous, + Cic.Appl + [Cic.MutInd(uri_of_eq,0,[]); hd; (List.hd rightparameters); + Cic.Rel base_rel], + foo_prod (nright-1) + (List.map (CicSubstitution.lift 1) tl) + (List.map (CicSubstitution.lift 1) (List.tl rightparameters)) + (List.map (CicSubstitution.lift 1) l2) + base_rel (CicSubstitution.lift 1 goalty) uri_of_eq + (List.map (CicSubstitution.lift 1) rightparameters_) + (CicSubstitution.lift 1 termty) + isSetType (CicSubstitution.lift 1 term)) + | [] -> ProofEngineReduction.replace_lifting + ~equality:(fun _ -> CicUtil.alpha_equivalence) + ~context:[] + ~what: (if isSetType + then (rightparameters_ @ [term] ) + else (rightparameters_ ) ) + ~with_what: (List.map (CicSubstitution.lift (-1)) l2) + ~where:goalty +(* the same subterm of goalty could be simultaneously sx and dx!*) +;; + +let rec foo_lambda nright right_param_tys nright_ right_param_tys_ + rightparameters created_vars base_rel goalty uri_of_eq rightparameters_ + termty isSetType term = + match right_param_tys with + | hd::tl -> Cic.Lambda ( + (Cic.Name ("lambda" ^ (string_of_int nright))), + hd, (* type *) + foo_lambda (nright-1) + (List.map (CicSubstitution.lift 1) tl) nright_ + (List.map (CicSubstitution.lift 1) right_param_tys_) + (List.map (CicSubstitution.lift 1) rightparameters) + (List.map (CicSubstitution.lift 1) (created_vars @ [Cic.Rel 1])) + base_rel (CicSubstitution.lift 1 goalty) uri_of_eq + (List.map (CicSubstitution.lift 1) rightparameters_) + (CicSubstitution.lift 1 termty) isSetType + (CicSubstitution.lift 1 term)) + | [] when isSetType -> Cic.Lambda ( + (Cic.Name ("lambda" ^ (string_of_int nright))), + (ProofEngineReduction.replace_lifting + ~equality:(fun _ -> CicUtil.alpha_equivalence) + ~context:[] + ~what: (rightparameters_ ) + ~with_what: (List.map (CicSubstitution.lift (-1)) created_vars) + ~where:termty), (* type of H with replaced right parameters *) + foo_prod nright_ (List.map (CicSubstitution.lift 1) right_param_tys_) + (List.map (CicSubstitution.lift 1) rightparameters) + (List.map (CicSubstitution.lift 1) (created_vars @ [Cic.Rel 1])) + (base_rel+1) (CicSubstitution.lift 1 goalty) uri_of_eq + (List.map (CicSubstitution.lift 1) rightparameters_) + (CicSubstitution.lift 1 termty) isSetType + (CicSubstitution.lift 1 term)) + | [] -> foo_prod nright_ right_param_tys_ rightparameters created_vars + base_rel goalty uri_of_eq rightparameters_ + termty isSetType term +;; + +let isSetType paramty = ((Pervasives.compare + (get_sort_type paramty) + (Cic.Sort Cic.Prop)) != 0) + +exception EqualityNotDefinedYet +let private_inversion_tac ~term = + let module T = CicTypeChecker in + let module R = CicReduction in + let module C = Cic in + let module P = PrimitiveTactics in + let module PET = ProofEngineTypes in + let private_inversion_tac ~term (proof, goal) = + + (*DEBUG*) debug_print (lazy ("private inversion begins")); + let _,metasenv,_subst,_,_, _ = proof in + let uri_of_eq = + match LibraryObjects.eq_URI () with + None -> raise EqualityNotDefinedYet + | Some uri -> uri + in + let (_,context,goalty) = CicUtil.lookup_meta goal metasenv in + let termty,_ = T.type_of_aux' metasenv context term CicUniv.empty_ugraph in + let uri = baseuri_of_term termty in + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let (_,_,typeno,_) = + match termty with + C.MutInd (uri,typeno,exp_named_subst) -> (uri,exp_named_subst,typeno,[]) + | C.Appl ((C.MutInd (uri,typeno,exp_named_subst))::args) -> + (uri,exp_named_subst,typeno,args) + | _ -> raise NotAnInductiveTypeToEliminate + in + let buri = UriManager.buri_of_uri uri in + let name,nleft,paramty,cons_list = + match o with + C.InductiveDefinition (tys,_,nleft,_) -> + let (name,_,paramty,cons_list) = List.nth tys typeno in + (name,nleft,paramty,cons_list) + |_ -> assert false + in + let eliminator_uri = + UriManager.uri_of_string (buri ^ "/" ^ name ^ "_ind" ^ ".con") + in + let parameters = (List.tl (term_to_list termty)) in + let parameters_tys = + (List.map + (fun t -> ( + match (T.type_of_aux' metasenv context t CicUniv.empty_ugraph) with + (term,graph) -> term)) + parameters) + in + let consno = List.length cons_list in + let nright= ((List.length parameters)- nleft) in + let isSetType = isSetType paramty in + let cut_term = foo_cut nleft parameters + parameters_tys goalty uri_of_eq in + (*DEBUG*) debug_print (lazy ("cut term " ^ CicPp.ppterm cut_term)); + debug_print (lazy ("CONTEXT before apply HCUT: " ^ + (CicMetaSubst.ppcontext ~metasenv [] context ))); + debug_print (lazy ("termty " ^ CicPp.ppterm termty)); + (* cut DXn=DXn \to GOAL *) + let proof1,gl1 = PET.apply_tactic (P.cut_tac cut_term) (proof,goal) in + (* apply Hcut ; reflexivity *) + let proof2, gl2 = PET.apply_tactic + (Tacticals.then_ + ~start: (P.apply_tac (C.Rel 1)) (* apply Hcut *) + ~continuation: (EqualityTactics.reflexivity_tac) + ) (proof1, (List.hd gl1)) + in + (*DEBUG*) debug_print (lazy ("after apply HCUT;reflexivity + in private inversion")); + (* apply (ledx_ind( lambda x. lambda y, ...)) *) + let t1,metasenv,_subst,t3,t4, attrs = proof2 in + let goal2 = List.hd (List.tl gl1) in + let (_,context,_) = CicUtil.lookup_meta goal2 metasenv in + (* rightparameters type list *) + let rightparam_ty_l = (cut_first nleft parameters_tys) in + (* rightparameters list *) + let rightparameters= cut_first nleft parameters in + let lambda_t = foo_lambda nright rightparam_ty_l nright rightparam_ty_l + rightparameters [] nright goalty uri_of_eq rightparameters termty isSetType + term in + let t = foo_appl nleft (nright+consno) lambda_t eliminator_uri in + debug_print (lazy ("Lambda_t: " ^ (CicPp.ppterm t))); + debug_print (lazy ("Term: " ^ (CicPp.ppterm termty))); + debug_print (lazy ("Body: " ^ (CicPp.ppterm goalty))); + debug_print + (lazy ("Right param: " ^ (CicPp.ppterm (Cic.Appl rightparameters)))); + debug_print (lazy ("CONTEXT before refinement: " ^ + (CicMetaSubst.ppcontext ~metasenv [] context ))); + (*DEBUG*) debug_print (lazy ("private inversion: term before refinement: " ^ + CicPp.ppterm t)); + let (ref_t,_,metasenv'',_) = CicRefine.type_of_aux' metasenv context t + CicUniv.empty_ugraph + in + (*DEBUG*) debug_print (lazy ("private inversion: termine after refinement: " + ^ CicPp.ppterm ref_t)); + let proof2 = (t1,metasenv'',_subst,t3,t4, attrs) in + let my_apply_tac = + let my_apply_tac status = + let proof,goals = + ProofEngineTypes.apply_tactic (P.apply_tac ref_t) status in + let patched_new_goals = + let (_,metasenv''',_subst,_,_, _) = proof in + let new_goals = ProofEngineHelpers.compare_metasenvs + ~oldmetasenv:metasenv ~newmetasenv:metasenv'' + in + List.filter (function i -> List.exists (function (j,_,_) -> j=i) + metasenv''') new_goals @ goals + in + proof,patched_new_goals + in + ProofEngineTypes.mk_tactic my_apply_tac + in + let proof3,gl3 = + PET.apply_tactic + (Tacticals.then_ + ~start:my_apply_tac + ~continuation: + (ReductionTactics.simpl_tac (ProofEngineTypes.conclusion_pattern(None)))) + (proof2,goal2) + in + + (proof3, gl3) +in +ProofEngineTypes.mk_tactic (private_inversion_tac ~term) +;; + + +let inversion_tac ~term = + let module T = CicTypeChecker in + let module R = CicReduction in + let module C = Cic in + let module P = PrimitiveTactics in + let module PET = ProofEngineTypes in + let inversion_tac ~term (proof, goal) = + (*DEBUG*) debug_print (lazy ("inversion begins")); + let _,metasenv,_subst,_,_, _ = proof in + let (_,context,goalty) = CicUtil.lookup_meta goal metasenv in + let termty,_ = T.type_of_aux' metasenv context term CicUniv.empty_ugraph in + let uri, typeno = + match termty with + | Cic.MutInd (uri,typeno,_) + | Cic.Appl(Cic.MutInd (uri,typeno,_)::_) -> uri,typeno + | _ -> assert false + in + (* let uri = baseuri_of_term termty in *) + let obj,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + let name,nleft,arity,cons_list = + match obj with + Cic.InductiveDefinition (tys,_,nleft,_) -> + let (name,_,arity,cons_list) = List.nth tys typeno in + (name,nleft,arity,cons_list) + |_ -> assert false + in + let buri = UriManager.buri_of_uri uri in + let inversor_uri = + UriManager.uri_of_string (buri ^ "/" ^ name ^ "_inv" ^ ".con") in + (* arity length = number of parameters plus 1 *) + let arity_length = (List.length (term_to_list termty)) in + (* Check the existence of any right parameter. *) + assert (arity_length > (nleft + 1)); + let appl_term arity_consno uri = + let l = [] in + let a = ref l in + for n = 1 to arity_consno do + a := (Cic.Implicit None)::(!a) + done; + (* apply i_inv ? ...? H). *) + Cic.Appl ([Cic.Const(uri,[])] @ !a @ [term]) + in + let t = appl_term (arity_length + (List.length cons_list)) inversor_uri in + let (t1,metasenv,_subst,t3,t4, attrs) = proof in + let (ref_t,_,metasenv'',_) = CicRefine.type_of_aux' metasenv context t + CicUniv.empty_ugraph + in + let proof = (t1,metasenv'',_subst,t3,t4, attrs) in + let proof3,gl3 = + ProofEngineTypes.apply_tactic (P.apply_tac ref_t) (proof,goal) in + let patched_new_goals = + let (_,metasenv''',_subst,_,_, _) = proof3 in + let new_goals = ProofEngineHelpers.compare_metasenvs + ~oldmetasenv:metasenv ~newmetasenv:metasenv'' + in + List.filter (function i -> List.exists (function (j,_,_) -> j=i) + metasenv''') new_goals @ gl3 + in + (proof3, patched_new_goals) + in +ProofEngineTypes.mk_tactic (inversion_tac ~term) +;; diff --git a/components/tactics/inversion.mli b/components/tactics/inversion.mli new file mode 100644 index 000000000..2c8b996ff --- /dev/null +++ b/components/tactics/inversion.mli @@ -0,0 +1,29 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val isSetType: Cic.term -> bool +exception EqualityNotDefinedYet (* raised by private_inversion_tac only *) +val private_inversion_tac: term: Cic.term -> ProofEngineTypes.tactic +val inversion_tac: term: Cic.term -> ProofEngineTypes.tactic diff --git a/components/tactics/inversion_principle.ml b/components/tactics/inversion_principle.ml new file mode 100644 index 000000000..f2dd37f9e --- /dev/null +++ b/components/tactics/inversion_principle.ml @@ -0,0 +1,231 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +let debug = false;; +let debug_print = + fun msg -> if debug then prerr_endline (Lazy.force msg) else () + +(* cuts away the last element of a list 'l' *) +let rec cut_last l = + match l with + | hd::tl when tl != [] -> hd:: (cut_last tl) + | _ -> [] +;; + +(* cuts away the first 'n' elements of a list 'l' *) +let rec cut_first n l = + if n>0 then + match l with + | hd::tl -> cut_first (n-1) tl + | [] -> [] + else l +;; + +(* returns the first 'n' elements of a list 'l' *) +let rec takefirst n l = + if n > 0 then + match l with + hd::tl when n > 0 -> hd:: takefirst (n-1) tl + | _ -> assert false + else [] +;; + +(* from a complex Cic.Prod term, returns the list of its components *) +let rec list_of_prod term = + match term with + | Cic.Prod (_,src,tgt) -> src::(list_of_prod tgt) + | _ -> [term] +;; + +let rec build_metas sort cons_list created_vars right_created_vars prop + uri typeno = + match cons_list with + | hd::tl -> + Cic.Prod( + Cic.Anonymous, + Cic.Implicit None, + build_metas sort tl + (List.map (CicSubstitution.lift 1) created_vars) + (List.map (CicSubstitution.lift 1) right_created_vars) + (List.map (CicSubstitution.lift 1) prop) uri typeno) + | [] -> + Cic.Prod( + Cic.Name("H"), (*new name?*) + Cic.Appl([Cic.MutInd(uri, typeno, [])] @ created_vars), + Cic.Appl (( (List.map (CicSubstitution.lift 1) prop) @ + (List.map (CicSubstitution.lift 1 ) right_created_vars) @ + (if Inversion.isSetType sort then [Cic.Rel 1] else [])(*H*)) + )) +;; + +(* computes the type of the abstract P *) +let rec get_prop_arity sort rightparam_tys(*only to name m's*) created_vars_ty + local_rvars left_created_vars nleft uri typeno = + match (created_vars_ty) with + hd::tl when (nleft > 0) -> + get_prop_arity sort rightparam_tys tl local_rvars left_created_vars + (nleft-1) uri typeno + | hd::tl -> + Cic.Prod( + Cic.Name("m" ^ string_of_int(List.length rightparam_tys) ), + hd, + get_prop_arity sort (List.tl rightparam_tys) + (List.map (CicSubstitution.lift 1) tl) + (List.map (CicSubstitution.lift 1) (local_rvars @ [Cic.Rel 1])) + (List.map (CicSubstitution.lift 1) left_created_vars) nleft uri typeno + ) + | [] -> + if Inversion.isSetType sort then + Cic.Prod(Cic.Anonymous, + Cic.Appl([Cic.MutInd(uri, typeno, [])] + @ (List.map (CicSubstitution.lift (-1)) left_created_vars) + @ (List.map (CicSubstitution.lift(-1)) local_rvars) ), + Cic.Sort(Cic.Prop)) + else + Cic.Sort Cic.Prop +;; + +(* created vars is empty at the beginning *) +let rec build_theorem rightparam_tys arity_l (*arity_l only to name p's*) + arity cons_list created_vars created_vars_ty nleft + uri typeno = + match (arity) with + Cic.Prod(_,src,tgt) -> + Cic.Prod( + Cic.Name("p" ^ string_of_int(List.length arity_l)), + src, + build_theorem rightparam_tys + (List.tl arity_l) tgt cons_list + (List.map (CicSubstitution.lift 1) (created_vars @ [Cic.Rel 1])) + (List.map (CicSubstitution.lift 1) (created_vars_ty @ [src])) + nleft uri typeno) + | sort -> + Cic.Prod(Cic.Name("P"), + get_prop_arity sort rightparam_tys created_vars_ty [](*local vars*) + (takefirst nleft created_vars) (*left_created_vars*) nleft uri typeno, + build_metas sort cons_list created_vars (cut_first nleft created_vars) + [(Cic.Rel 1)] uri typeno ) +;; + +let build_inversion uri obj = + (*uri e obj of InductiveDefinition *) + let module PET = ProofEngineTypes in + let build_one typeno name nleft arity cons_list = + (*check if there are right parameters, else return void*) + if List.length (list_of_prod arity) = (nleft + 1) then + None + else + try + let arity_l = cut_last (list_of_prod arity) in + let rightparam_tys = cut_first nleft arity_l in + let theorem = build_theorem rightparam_tys arity_l arity cons_list + [](*created_vars*) [](*created_vars_ty*) nleft uri typeno in + debug_print + (lazy ("theorem prima di refine: " ^ (CicPp.ppterm theorem))); + let (ref_theorem,_,metasenv,_) = CicRefine.type_of_aux' [] [] theorem + CicUniv.empty_ugraph in + (*DEBUG*) debug_print + (lazy ("theorem dopo refine: " ^ (CicPp.ppterm ref_theorem))); + let buri = UriManager.buri_of_uri uri in + let inversor_uri = + UriManager.uri_of_string (buri ^ "/" ^ name ^ "_inv" ^ ".con") in + let goal = CicMkImplicit.new_meta metasenv [] in + let metasenv' = (goal,[],ref_theorem)::metasenv in + let attrs = [`Class (`InversionPrinciple); `Generated] in + let _subst = [] in + let proof= + (Some inversor_uri,metasenv',_subst,Cic.Meta(goal,[]),ref_theorem, attrs) in + let _,applies = + List.fold_right + (fun _ (i,applies) -> + i+1,PrimitiveTactics.apply_tac (Cic.Rel i)::applies) + cons_list (2,[]) + in + let proof1,gl1 = + PET.apply_tactic + (Tacticals.then_ + ~start:(PrimitiveTactics.intros_tac ()) + (*if the number of applies is 1, we cannot use + thens, but then_*) + ~continuation: + (match (List.length applies) with + 0 -> (Inversion.private_inversion_tac (Cic.Rel 1)) + | 1 -> (Tacticals.then_ + ~start:(Inversion.private_inversion_tac + (Cic.Rel 1)) + ~continuation:(PrimitiveTactics.apply_tac + (Cic.Rel 2)) + ) + | _ -> (Tacticals.thens + ~start:(Inversion.private_inversion_tac + (Cic.Rel 1)) + ~continuations:applies + ) + )) + (proof,goal) + in + let metasenv,bo,ty, attrs = + match proof1 with (_,metasenv,_subst,bo,ty, attrs) -> metasenv,bo,ty, attrs + in + assert (metasenv = []); + Some + (inversor_uri, + Cic.Constant + (UriManager.name_of_uri inversor_uri,Some bo,ty,[],[])) + with + Inversion.EqualityNotDefinedYet -> None + | CicRefine.RefineFailure ls -> + HLog.warn + ("CicRefine.RefineFailure during generation of inversion principle: " ^ + Lazy.force ls) ; + None + | CicRefine.Uncertain ls -> + HLog.warn + ("CicRefine.Uncertain during generation of inversion principle: " ^ + Lazy.force ls) ; + None + | CicRefine.AssertFailure ls -> + HLog.warn + ("CicRefine.AssertFailure during generation of inversion principle: " ^ + Lazy.force ls) ; + None + in + match obj with + | Cic.InductiveDefinition (tys,_,nleft,_) -> + let counter = ref (List.length tys) in + List.fold_right + (fun (name,_,arity,cons_list) res -> + counter := !counter-1; + match build_one !counter name nleft arity cons_list with + | None -> res + | Some inv -> inv::res) + tys [] + |_ -> assert false + +;; + +let init () = ();; + +LibrarySync.build_inversion_principle := build_inversion;; diff --git a/components/tactics/inversion_principle.mli b/components/tactics/inversion_principle.mli new file mode 100644 index 000000000..7cdf29c24 --- /dev/null +++ b/components/tactics/inversion_principle.mli @@ -0,0 +1 @@ +val init: unit -> unit diff --git a/components/tactics/metadataQuery.ml b/components/tactics/metadataQuery.ml new file mode 100644 index 000000000..abe192b94 --- /dev/null +++ b/components/tactics/metadataQuery.ml @@ -0,0 +1,524 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let nonvar uri = not (UriManager.uri_is_var uri) + +module Constr = MetadataConstraints + +exception Goal_is_not_an_equation + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) + +let ( ** ) x y = int_of_float ((float_of_int x) ** (float_of_int y)) + +let signature_of_hypothesis context metasenv = + let set, _ = + List.fold_right + (fun hyp (set,current_ctx) -> + match hyp with + | None -> set, hyp::current_ctx + | Some (_, Cic.Decl t) -> + Constr.UriManagerSet.union set (Constr.constants_of t), + hyp::current_ctx + | Some (_, Cic.Def (t, _)) -> + try + let ty,_ = + CicTypeChecker.type_of_aux' + metasenv current_ctx t CicUniv.empty_ugraph + in + let sort,_ = + CicTypeChecker.type_of_aux' + metasenv current_ctx ty CicUniv.empty_ugraph + in + let set = Constr.UriManagerSet.union set(Constr.constants_of ty)in + match sort with + | Cic.Sort Cic.Prop -> set, hyp::current_ctx + | _ -> Constr.UriManagerSet.union set (Constr.constants_of t), + hyp::current_ctx + with + | CicTypeChecker.TypeCheckerFailure _ -> set, hyp::current_ctx) + context (Constr.UriManagerSet.empty,[]) + in + set +;; + +let intersect uris siguris = + let set1 = List.fold_right Constr.UriManagerSet.add uris Constr.UriManagerSet.empty in + let set2 = + List.fold_right Constr.UriManagerSet.add siguris Constr.UriManagerSet.empty + in + let inter = Constr.UriManagerSet.inter set1 set2 in + List.filter (fun s -> Constr.UriManagerSet.mem s inter) uris + +(* Profiling code +let at_most = + let profiler = CicUtil.profile "at_most" in + fun ~dbd ~where uri -> profiler.profile (Constr.at_most ~dbd ~where) uri + +let sigmatch = + let profiler = CicUtil.profile "sigmatch" in + fun ~dbd ~facts ~where signature -> + profiler.profile (MetadataConstraints.sigmatch ~dbd ~facts ~where) signature +*) +let at_most = Constr.at_most +let sigmatch = MetadataConstraints.sigmatch + +let filter_uris_forward ~dbd (main, constants) uris = + let main_uris = + match main with + | None -> [] + | Some (main, types) -> main :: types + in + let full_signature = + List.fold_right Constr.UriManagerSet.add main_uris constants + in + List.filter (at_most ~dbd ~where:`Statement full_signature) uris + +let filter_uris_backward ~dbd ~facts signature uris = + let siguris = + List.map snd + (sigmatch ~dbd ~facts ~where:`Statement signature) + in + intersect uris siguris + +let compare_goal_list proof goal1 goal2 = + let _,metasenv, _subst, _,_, _ = proof in + let (_, ey1, ty1) = CicUtil.lookup_meta goal1 metasenv in + let (_, ey2, ty2) = CicUtil.lookup_meta goal2 metasenv in + let ty_sort1,_ = + CicTypeChecker.type_of_aux' metasenv ey1 ty1 CicUniv.empty_ugraph + in + let ty_sort2,_ = + CicTypeChecker.type_of_aux' metasenv ey2 ty2 CicUniv.empty_ugraph + in + let prop1 = + let b,_ = + CicReduction.are_convertible + ey1 (Cic.Sort Cic.Prop) ty_sort1 CicUniv.empty_ugraph + in + if b then 0 + else 1 + in + let prop2 = + let b,_ = + CicReduction.are_convertible + ey2 (Cic.Sort Cic.Prop) ty_sort2 CicUniv.empty_ugraph + in + if b then 0 + else 1 + in + prop1 - prop2 + +(* experimental_hint is a version of hint for experimental + purposes. It uses auto_tac_verbose instead of auto tac. + Auto_tac verbose also returns a substitution - for the moment + as a function from cic to cic, to be changed into an association + list in the future -. This substitution is used to build a + hash table of the inspected goals with their associated proofs. + The cose is a cut and paste of the previous one: at the end + of the experimentation we shall make a choice. *) + +let close_with_types s metasenv context = + Constr.UriManagerSet.fold + (fun e bag -> + let t = CicUtil.term_of_uri e in + let ty, _ = + CicTypeChecker.type_of_aux' metasenv context t CicUniv.empty_ugraph + in + Constr.UriManagerSet.union bag (Constr.constants_of ty)) + s s + +let close_with_constructors s metasenv context = + Constr.UriManagerSet.fold + (fun e bag -> + let t = CicUtil.term_of_uri e in + match t with + Cic.MutInd (uri,_,_) + | Cic.MutConstruct (uri,_,_,_) -> + (match fst (CicEnvironment.get_obj CicUniv.empty_ugraph uri) with + Cic.InductiveDefinition(tl,_,_,_) -> + snd + (List.fold_left + (fun (i,s) (_,_,_,cl) -> + let _,s = + List.fold_left + (fun (j,s) _ -> + let curi = UriManager.uri_of_uriref uri i (Some j) in + j+1,Constr.UriManagerSet.add curi s) (1,s) cl in + (i+1,s)) (0,bag) tl) + | _ -> assert false) + | _ -> bag) + s s + +(* Profiling code +let apply_tac_verbose = + let profiler = CicUtil.profile "apply_tac_verbose" in + fun ~term status -> profiler.profile (PrimitiveTactics.apply_tac_verbose ~term) status + +let sigmatch = + let profiler = CicUtil.profile "sigmatch" in + fun ~dbd ~facts ?(where=`Conclusion) signature -> profiler.profile (Constr.sigmatch ~dbd ~facts ~where) signature + +let cmatch' = + let profiler = CicUtil.profile "cmatch'" in + fun ~dbd ~facts signature -> profiler.profile (Constr.cmatch' ~dbd ~facts) signature +*) +let apply_tac_verbose = PrimitiveTactics.apply_tac_verbose +let cmatch' = Constr.cmatch' + +(* used only by te old auto *) +let signature_of_goal ~(dbd:HSql.dbd) ((proof, goal) as _status) = + let (_, metasenv, _subst, _, _, _) = proof in + let (_, context, ty) = CicUtil.lookup_meta goal metasenv in + let main, sig_constants = Constr.signature_of ty in + let set = signature_of_hypothesis context metasenv in + let set = + match main with + None -> set + | Some (main,l) -> + List.fold_right Constr.UriManagerSet.add (main::l) set in + let set = Constr.UriManagerSet.union set sig_constants in + let all_constants_closed = close_with_types set metasenv context in + let uris = + sigmatch ~dbd ~facts:false ~where:`Statement (None,all_constants_closed) in + let uris = List.filter nonvar (List.map snd uris) in + let uris = List.filter Hashtbl_equiv.not_a_duplicate uris in + uris + +let is_predicate u = + let ty, _ = + try CicTypeChecker.type_of_aux' [] [] + (CicUtil.term_of_uri u) CicUniv.empty_ugraph + with CicTypeChecker.TypeCheckerFailure _ -> assert false + in + let rec check_last_pi = function + | Cic.Prod (_,_,tgt) -> check_last_pi tgt + | Cic.Sort Cic.Prop -> true + | _ -> false + in + check_last_pi ty +;; + +let only constants uri = + prerr_endline (UriManager.string_of_uri uri); + let t = CicUtil.term_of_uri uri in (* FIXME: write ty_of_term *) + let ty,_ = CicTypeChecker.type_of_aux' [] [] t CicUniv.empty_ugraph in + let consts = Constr.constants_of ty in +(* + prerr_endline ("XXX " ^ UriManager.string_of_uri uri); + Constr.UriManagerSet.iter (fun u -> prerr_endline (" - " ^ + UriManager.string_of_uri u)) consts; + Constr.UriManagerSet.iter (fun u -> prerr_endline (" + " ^ + UriManager.string_of_uri u)) constants;*) + Constr.UriManagerSet.subset consts constants +;; + +let rec types_of_equality = function + | Cic.Appl [Cic.MutInd (uri, _, _); ty; _; _] + when (LibraryObjects.is_eq_URI uri) -> + let uri_set = Constr.constants_of ty in + if Constr.UriManagerSet.equal uri_set Constr.UriManagerSet.empty then + Constr.SetSet.empty + else Constr.SetSet.singleton uri_set + | Cic.Prod (_, s, t) -> + Constr.SetSet.union (types_of_equality s) (types_of_equality t) + | _ -> Constr.SetSet.empty +;; + +let types_for_equality metasenv goal = + let (_, context, ty) = CicUtil.lookup_meta goal metasenv in + let all = types_of_equality ty in + let _, all = + List.fold_left + (fun (i,acc) _ -> + let ty, _ = + CicTypeChecker.type_of_aux' + metasenv context (Cic.Rel i) CicUniv.empty_ugraph in + let newty = types_of_equality ty in + (i+1,Constr.SetSet.union newty acc)) + (1,all) context + in all +;; + +let signature_of metasenv goal = + let (_, context, ty) = CicUtil.lookup_meta goal metasenv in + let ty_set = Constr.constants_of ty in + let hyp_set = signature_of_hypothesis context metasenv in + let set = Constr.UriManagerSet.union ty_set hyp_set in + close_with_types set metasenv context + + +let universe_of_goal ~(dbd:HSql.dbd) apply_only metasenv goal = + let (_, context, ty) = CicUtil.lookup_meta goal metasenv in + let ty_set = Constr.constants_of ty in + let hyp_set = signature_of_hypothesis context metasenv in + let set = Constr.UriManagerSet.union ty_set hyp_set in + let all_constants_closed = close_with_types set metasenv context in + (* we split predicates from the rest *) + let predicates, rest = + Constr.UriManagerSet.partition is_predicate all_constants_closed + in + let uris = + Constr.UriManagerSet.fold + (fun u acc -> + prerr_endline ("processing "^(UriManager.string_of_uri u)); + let set_for_sigmatch = + Constr.UriManagerSet.remove u all_constants_closed in + if LibraryObjects.is_eq_URI (UriManager.strip_xpointer u) then + (* equality has a special treatment *) + (prerr_endline "special treatment"; + let tfe = + Constr.SetSet.elements (types_for_equality metasenv goal) + in + List.fold_left + (fun acc l -> + let tyl = Constr.UriManagerSet.elements l in + prerr_endline ("tyl: "^(String.concat "\n" + (List.map UriManager.string_of_uri tyl))); + let set_for_sigmatch = + Constr.UriManagerSet.diff set_for_sigmatch l in + let uris = + sigmatch ~dbd ~facts:false ~where:`Statement + (Some (u,tyl),set_for_sigmatch) in + acc @ uris) + acc tfe) + else + (prerr_endline "normal treatment"; + let uris = + sigmatch ~dbd ~facts:false ~where:`Statement + (Some (u,[]),set_for_sigmatch) + in + acc @ uris)) + predicates [] + in +(* + let uris = + sigmatch ~dbd ~facts:false ~where:`Statement (None,all_constants_closed) + in +*) + let uris = List.filter nonvar (List.map snd uris) in + let uris = List.filter Hashtbl_equiv.not_a_duplicate uris in + if apply_only then + List.filter (only all_constants_closed) uris + else uris +;; + +let filter_out_predicate set ctx menv = + Constr.UriManagerSet.filter (fun u -> not (is_predicate u)) set +;; + +let equations_for_goal ~(dbd:HSql.dbd) ?signature ((proof, goal) as _status) = +(* + let to_string set = + "{\n" ^ + (String.concat "\n" + (Constr.UriManagerSet.fold + (fun u l -> (" "^UriManager.string_of_uri u)::l) set [])) + ^ "\n}" + in +*) + let (_, metasenv, _subst, _, _, _) = proof in + let (_, context, ty) = CicUtil.lookup_meta goal metasenv in + let main, sig_constants = + match signature with + | None -> Constr.signature_of ty + | Some s -> s + in +(* Printf.printf "\nsig_constants: %s\n\n" (to_string sig_constants); *) +(* match main with *) +(* None -> raise Goal_is_not_an_equation *) +(* | Some (m,l) -> *) + let l = + let eq_URI = + match LibraryObjects.eq_URI () with + None -> None + | Some s -> + Some + (UriManager.uri_of_string + (UriManager.string_of_uri s ^ "#xpointer(1/1)")) + in + match eq_URI,main with + | Some eq_URI, Some (m, l) when UriManager.eq m eq_URI -> m::l + | _ -> [] + in + (*Printf.printf "\nSome (m, l): %s, [%s]\n\n" + (UriManager.string_of_uri (List.hd l)) + (String.concat "; " (List.map UriManager.string_of_uri (List.tl l))); + *) + (* if m == UriManager.uri_of_string HelmLibraryObjects.Logic.eq_XURI then ( *) + let set = signature_of_hypothesis context metasenv in + (* Printf.printf "\nsignature_of_hypothesis: %s\n\n" (to_string set); *) + let set = Constr.UriManagerSet.union set sig_constants in + let set = filter_out_predicate set context metasenv in + let set = close_with_types set metasenv context in + (* Printf.printf "\ndopo close_with_types: %s\n\n" (to_string set); *) + let set = close_with_constructors set metasenv context in + (* Printf.printf "\ndopo close_with_constructors: %s\n\n" (to_string set); *) + let set_for_sigmatch = List.fold_right Constr.UriManagerSet.remove l set in + let uris = + sigmatch ~dbd ~facts:false ~where:`Statement (main,set_for_sigmatch) in + let uris = List.filter nonvar (List.map snd uris) in + let uris = List.filter Hashtbl_equiv.not_a_duplicate uris in + let set = List.fold_right Constr.UriManagerSet.add l set in + let uris = List.filter (only set) uris in + uris + (* ) *) + (* else raise Goal_is_not_an_equation *) + +let experimental_hint + ~(dbd:HSql.dbd) ?(facts=false) ?signature ((proof, goal) as status) = + let (_, metasenv, _subst, _, _, _) = proof in + let (_, context, ty) = CicUtil.lookup_meta goal metasenv in + let (uris, (main, sig_constants)) = + match signature with + | Some signature -> + (sigmatch ~dbd ~facts signature, signature) + | None -> + (cmatch' ~dbd ~facts ty, Constr.signature_of ty) + in + let uris = List.filter nonvar (List.map snd uris) in + let uris = List.filter Hashtbl_equiv.not_a_duplicate uris in + let types_constants = + match main with + | None -> Constr.UriManagerSet.empty + | Some (main, types) -> + List.fold_right Constr.UriManagerSet.add (main :: types) + Constr.UriManagerSet.empty + in + let all_constants = + let hyp_and_sug = + Constr.UriManagerSet.union + (signature_of_hypothesis context metasenv) + sig_constants + in + let main = + match main with + | None -> Constr.UriManagerSet.empty + | Some (main,_) -> + let ty, _ = + CicTypeChecker.type_of_aux' + metasenv context (CicUtil.term_of_uri main) CicUniv.empty_ugraph + in + Constr.constants_of ty + in + Constr.UriManagerSet.union main hyp_and_sug + in +(* Constr.UriManagerSet.iter debug_print hyp_constants; *) + let all_constants_closed = close_with_types all_constants metasenv context in + let other_constants = + Constr.UriManagerSet.diff all_constants_closed types_constants + in + debug_print (lazy "all_constants_closed"); + if debug then Constr.UriManagerSet.iter (fun s -> debug_print (lazy (UriManager.string_of_uri s))) all_constants_closed; + debug_print (lazy "other_constants"); + if debug then Constr.UriManagerSet.iter (fun s -> debug_print (lazy (UriManager.string_of_uri s))) other_constants; + let uris = + let pow = 2 ** (Constr.UriManagerSet.cardinal other_constants) in + if ((List.length uris < pow) or (pow <= 0)) + then begin + debug_print (lazy "MetadataQuery: large sig, falling back to old method"); + filter_uris_forward ~dbd (main, other_constants) uris + end else + filter_uris_backward ~dbd ~facts (main, other_constants) uris + in + let rec aux = function + | [] -> [] + | uri :: tl -> + (let status' = + try + let (subst,(proof, goal_list)) = + (* debug_print (lazy ("STO APPLICANDO" ^ uri)); *) + apply_tac_verbose + ~term:(CicUtil.term_of_uri uri) + status + in + let goal_list = + List.stable_sort (compare_goal_list proof) goal_list + in + Some (uri, (subst,(proof, goal_list))) + with ProofEngineTypes.Fail _ -> None + in + match status' with + | None -> aux tl + | Some status' -> status' :: aux tl) + in + List.stable_sort + (fun (_,(_, (_, goals1))) (_,(_, (_, goals2))) -> + Pervasives.compare (List.length goals1) (List.length goals2)) + (aux uris) + +let new_experimental_hint + ~(dbd:HSql.dbd) ?(facts=false) ?signature ~universe + ((proof, goal) as status) += + let (_, metasenv, _subst, _, _, _) = proof in + let (_, context, ty) = CicUtil.lookup_meta goal metasenv in + let (uris, (main, sig_constants)) = + match signature with + | Some signature -> + (sigmatch ~dbd ~facts signature, signature) + | None -> + (cmatch' ~dbd ~facts ty, Constr.signature_of ty) in + let universe = + List.fold_left + (fun res u -> Constr.UriManagerSet.add u res) + Constr.UriManagerSet.empty universe in + let uris = + List.fold_left + (fun res (_,u) -> Constr.UriManagerSet.add u res) + Constr.UriManagerSet.empty uris in + let uris = Constr.UriManagerSet.inter uris universe in + let uris = Constr.UriManagerSet.elements uris in + let rec aux = function + | [] -> [] + | uri :: tl -> + (let status' = + try + let (subst,(proof, goal_list)) = + (* debug_print (lazy ("STO APPLICANDO" ^ uri)); *) + apply_tac_verbose + ~term:(CicUtil.term_of_uri uri) + status + in + let goal_list = + List.stable_sort (compare_goal_list proof) goal_list + in + Some (uri, (subst,(proof, goal_list))) + with ProofEngineTypes.Fail _ -> None + in + match status' with + | None -> aux tl + | Some status' -> status' :: aux tl) + in + List.stable_sort + (fun (_,(_, (_, goals1))) (_,(_, (_, goals2))) -> + Pervasives.compare (List.length goals1) (List.length goals2)) + (aux uris) + diff --git a/components/tactics/metadataQuery.mli b/components/tactics/metadataQuery.mli new file mode 100644 index 000000000..a1b533601 --- /dev/null +++ b/components/tactics/metadataQuery.mli @@ -0,0 +1,71 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** @param vars if set variables (".var" URIs) are considered. Defaults to + * false + * @param pat shell like pattern matching over object names, a string where "*" + * is interpreted as 0 or more characters and "?" as exactly one character *) + +(* used only by the old auto *) +val signature_of_goal: + dbd:HSql.dbd -> ProofEngineTypes.status -> + UriManager.uri list + +val signature_of: + Cic.metasenv -> + ProofEngineTypes.goal -> + MetadataConstraints.UriManagerSet.t + +val universe_of_goal: + dbd:HSql.dbd -> + bool -> (* apply only or not *) + Cic.metasenv -> + ProofEngineTypes.goal -> + UriManager.uri list + +val equations_for_goal: + dbd:HSql.dbd -> + ?signature:MetadataConstraints.term_signature -> + ProofEngineTypes.status -> UriManager.uri list + +val experimental_hint: + dbd:HSql.dbd -> + ?facts:bool -> + ?signature:MetadataConstraints.term_signature -> + ProofEngineTypes.status -> + (UriManager.uri * + ((Cic.term -> Cic.term) * + (ProofEngineTypes.proof * ProofEngineTypes.goal list))) list + +val new_experimental_hint: + dbd:HSql.dbd -> + ?facts:bool -> + ?signature:MetadataConstraints.term_signature -> + universe:UriManager.uri list -> + ProofEngineTypes.status -> + (UriManager.uri * + ((Cic.term -> Cic.term) * + (ProofEngineTypes.proof * ProofEngineTypes.goal list))) list + diff --git a/components/tactics/negationTactics.ml b/components/tactics/negationTactics.ml new file mode 100644 index 000000000..fb904bf36 --- /dev/null +++ b/components/tactics/negationTactics.ml @@ -0,0 +1,97 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +let absurd_tac ~term = + let absurd_tac ~term status = + let (proof, goal) = status in + let module C = Cic in + let module U = UriManager in + let module P = PrimitiveTactics in + let _,metasenv,_subst,_,_, _ = proof in + let _,context,ty = CicUtil.lookup_meta goal metasenv in + let absurd_URI = + match LibraryObjects.absurd_URI () with + Some uri -> uri + | None -> raise (ProofEngineTypes.Fail (lazy "You need to register the default \"absurd\" theorem first. Please use the \"default\" command")) + in + let ty_term,_ = + CicTypeChecker.type_of_aux' metasenv context term CicUniv.empty_ugraph in + if (ty_term = (C.Sort C.Prop)) (* ma questo controllo serve?? *) + then ProofEngineTypes.apply_tactic + (P.apply_tac + ~term:( + C.Appl [(C.Const (absurd_URI, [] )) ; + term ; ty]) + ) + status + else raise (ProofEngineTypes.Fail (lazy "Absurd: Not a Proposition")) + in + ProofEngineTypes.mk_tactic (absurd_tac ~term) +;; + +(* FG: METTERE I NOMI ANCHE QUI? CSC: in teoria si', per la intros*) +let contradiction_tac = + let contradiction_tac status = + let module C = Cic in + let module U = UriManager in + let module P = PrimitiveTactics in + let module T = Tacticals in + let false_URI = + match LibraryObjects.false_URI () with + Some uri -> uri + | None -> raise (ProofEngineTypes.Fail (lazy "You need to register the default \"false\" definition first. Please use the \"default\" command")) + in + try + ProofEngineTypes.apply_tactic ( + T.then_ + ~start:(P.intros_tac ()) + ~continuation:( + T.then_ + ~start: + (EliminationTactics.elim_type_tac (C.MutInd (false_URI, 0, []))) + ~continuation: VariousTactics.assumption_tac)) + status + with + ProofEngineTypes.Fail msg when Lazy.force msg = "Assumption: No such assumption" -> raise (ProofEngineTypes.Fail (lazy "Contradiction: No such assumption")) + (* sarebbe piu' elegante se Assumtion sollevasse un'eccezione tutta sua che questa cattura, magari con l'aiuto di try_tactics *) + in + ProofEngineTypes.mk_tactic contradiction_tac +;; + +(* Questa era in fourierR.ml +(* !!!!! fix !!!!!!!!!! *) +let contradiction_tac (proof,goal)= + Tacticals.then_ + ~start:(PrimitiveTactics.intros_tac ~name:"bo?" ) (*inutile sia questo che quello prima della chiamata*) + ~continuation:(Tacticals.then_ + ~start:(VariousTactics.elim_type_tac ~term:_False) + ~continuation:(assumption_tac)) + (proof,goal) +;; +*) + + diff --git a/components/tactics/negationTactics.mli b/components/tactics/negationTactics.mli new file mode 100644 index 000000000..bfa3e8d5d --- /dev/null +++ b/components/tactics/negationTactics.mli @@ -0,0 +1,28 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val absurd_tac: term:Cic.term -> ProofEngineTypes.tactic +val contradiction_tac: ProofEngineTypes.tactic + diff --git a/components/tactics/paramodulation/.depend b/components/tactics/paramodulation/.depend new file mode 100644 index 000000000..e69de29bb diff --git a/components/tactics/paramodulation/Makefile b/components/tactics/paramodulation/Makefile new file mode 100644 index 000000000..2f3afa5ab --- /dev/null +++ b/components/tactics/paramodulation/Makefile @@ -0,0 +1,6 @@ +all: + @make -C .. $@ + +%: + @make -C .. $@ + diff --git a/components/tactics/paramodulation/README b/components/tactics/paramodulation/README new file mode 100644 index 000000000..bf484ae16 --- /dev/null +++ b/components/tactics/paramodulation/README @@ -0,0 +1,45 @@ +make saturate per compilare l'eseguibile da riga di comando (make saturate.opt per la versione ottimizzata) + +./saturate -h per vedere una lista di parametri: + +./saturate: unknown option `-h'. +Usage: + -full Enable full mode + -f Enable/disable full-reduction strategy (default: enabled) + -r Weight-Age equality selection ratio (default: 4) + -s symbols-based selection ratio (relative to the weight ratio, default: 0) + -c Configuration file (for the db connection) + -o Term ordering. Possible values are: + kbo: Knuth-Bendix ordering + nr-kbo: Non-recursive variant of kbo (default) + lpo: Lexicographic path ordering + -l Time limit in seconds (default: no limit) + -w Maximal width (default: 3) + -d Maximal depth (default: 3) + -retrieve retrieve only + -help Display this list of options + --help Display this list of options + + +./saturate -l 10 -demod-equalities + +dove -l 10 e` il timeout in secondi. + +Il programma legge da standard input il teorema, per esempio + +\forall n:nat.n + n = 2 * n +\forall n:R.n + n = 2 * n +\forall n:R.n+n=n+n + +l'input termina con una riga vuota (quindi basta un doppio invio alla fine) + +In output, oltre ai vari messaggi di debug, vengono stampati gli insiemi +active e passive alla fine dell'esecuzione. Consiglio di redirigere l'output +su file, per esempio usando tee: + +./saturate -l 10 -demod-equalities | tee output.txt + +Il formato di stampa e` quello per gli oggetti di tipo equality (usa la +funzione Inference.string_of_equality) + + diff --git a/components/tactics/paramodulation/equality.ml b/components/tactics/paramodulation/equality.ml new file mode 100644 index 000000000..7893ecba6 --- /dev/null +++ b/components/tactics/paramodulation/equality.ml @@ -0,0 +1,1363 @@ +(* cOpyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* let _profiler = <:profiler<_profiler>>;; *) + +(* $Id: inference.ml 6245 2006-04-05 12:07:51Z tassi $ *) + +type rule = SuperpositionRight | SuperpositionLeft | Demodulation +type uncomparable = int -> int + +type equality = + uncomparable * (* trick to break structural equality *) + int * (* weight *) + proof * + (Cic.term * (* type *) + Cic.term * (* left side *) + Cic.term * (* right side *) + Utils.comparison) * (* ordering *) + Cic.metasenv * (* environment for metas *) + int (* id *) +and proof = + | Exact of Cic.term + | Step of Subst.substitution * (rule * int*(Utils.pos*int)* Cic.term) + (* subst, (rule,eq1, eq2,predicate) *) +and goal_proof = (rule * Utils.pos * int * Subst.substitution * Cic.term) list +;; +(* the hashtbl eq_id -> proof, max_eq_id *) +type equality_bag = (int,equality) Hashtbl.t * int ref + +type goal = goal_proof * Cic.metasenv * Cic.term + +(* globals *) +let mk_equality_bag () = + Hashtbl.create 1024, ref 0 +;; + +let freshid (_,i) = + incr i; !i +;; + +let add_to_bag (id_to_eq,_) id eq = + Hashtbl.add id_to_eq id eq +;; + +let uncomparable = fun _ -> 0 + +let mk_equality bag (weight,p,(ty,l,r,o),m) = + let id = freshid bag in + let eq = (uncomparable,weight,p,(ty,l,r,o),m,id) in + add_to_bag bag id eq; + eq +;; + +let mk_tmp_equality (weight,(ty,l,r,o),m) = + let id = -1 in + uncomparable,weight,Exact (Cic.Implicit None),(ty,l,r,o),m,id +;; + + +let open_equality (_,weight,proof,(ty,l,r,o),m,id) = + (weight,proof,(ty,l,r,o),m,id) + +let string_of_rule = function + | SuperpositionRight -> "SupR" + | SuperpositionLeft -> "SupL" + | Demodulation -> "Demod" +;; + +let string_of_equality ?env eq = + match env with + | None -> + let w, _, (ty, left, right, o), m , id = open_equality eq in + Printf.sprintf "Id: %d, Weight: %d, {%s}: %s =(%s) %s [%s]" + id w (CicPp.ppterm ty) + (CicPp.ppterm left) + (Utils.string_of_comparison o) (CicPp.ppterm right) + (String.concat ", " (List.map (fun (i,_,_) -> string_of_int i) m)) +(* "..." *) + | Some (_, context, _) -> + let names = Utils.names_of_context context in + let w, _, (ty, left, right, o), m , id = open_equality eq in + Printf.sprintf "Id: %d, Weight: %d, {%s}: %s =(%s) %s [%s]" + id w (CicPp.pp ty names) + (CicPp.pp left names) (Utils.string_of_comparison o) + (CicPp.pp right names) + (String.concat ", " (List.map (fun (i,_,_) -> string_of_int i) m)) +(* "..." *) +;; + +let compare (_,_,_,s1,_,_) (_,_,_,s2,_,_) = + Pervasives.compare s1 s2 +;; + +let rec max_weight_in_proof ((id_to_eq,_) as bag) current = + function + | Exact _ -> current + | Step (_, (_,id1,(_,id2),_)) -> + let eq1 = Hashtbl.find id_to_eq id1 in + let eq2 = Hashtbl.find id_to_eq id2 in + let (w1,p1,(_,_,_,_),_,_) = open_equality eq1 in + let (w2,p2,(_,_,_,_),_,_) = open_equality eq2 in + let current = max current w1 in + let current = max_weight_in_proof bag current p1 in + let current = max current w2 in + max_weight_in_proof bag current p2 + +let max_weight_in_goal_proof ((id_to_eq,_) as bag) = + List.fold_left + (fun current (_,_,id,_,_) -> + let eq = Hashtbl.find id_to_eq id in + let (w,p,(_,_,_,_),_,_) = open_equality eq in + let current = max current w in + max_weight_in_proof bag current p) + +let max_weight bag goal_proof proof = + let current = max_weight_in_proof bag 0 proof in + max_weight_in_goal_proof bag current goal_proof + +let proof_of_id (id_to_eq,_) id = + try + let (_,p,(_,l,r,_),_,_) = open_equality (Hashtbl.find id_to_eq id) in + p,l,r + with + Not_found -> assert false + + +let string_of_proof ?(names=[]) bag p gp = + let str_of_pos = function + | Utils.Left -> "left" + | Utils.Right -> "right" + in + let fst3 (x,_,_) = x in + let rec aux margin name = + let prefix = String.make margin ' ' ^ name ^ ": " in function + | Exact t -> + Printf.sprintf "%sExact (%s)\n" + prefix (CicPp.pp t names) + | Step (subst,(rule,eq1,(pos,eq2),pred)) -> + Printf.sprintf "%s%s(%s|%d with %d dir %s pred %s))\n" + prefix (string_of_rule rule) (Subst.ppsubst ~names subst) eq1 eq2 (str_of_pos pos) + (CicPp.pp pred names)^ + aux (margin+1) (Printf.sprintf "%d" eq1) (fst3 (proof_of_id bag eq1)) ^ + aux (margin+1) (Printf.sprintf "%d" eq2) (fst3 (proof_of_id bag eq2)) + in + aux 0 "" p ^ + String.concat "\n" + (List.map + (fun (r,pos,i,s,t) -> + (Printf.sprintf + "GOAL: %s %s %d %s %s\n" (string_of_rule r) + (str_of_pos pos) i (Subst.ppsubst ~names s) (CicPp.pp t names)) ^ + aux 1 (Printf.sprintf "%d " i) (fst3 (proof_of_id bag i))) + gp) +;; + +let rec depend ((id_to_eq,_) as bag) eq id seen = + let (_,p,(_,_,_,_),_,ideq) = open_equality eq in + if List.mem ideq seen then + false,seen + else + if id = ideq then + true,seen + else + match p with + | Exact _ -> false,seen + | Step (_,(_,id1,(_,id2),_)) -> + let seen = ideq::seen in + let eq1 = Hashtbl.find id_to_eq id1 in + let eq2 = Hashtbl.find id_to_eq id2 in + let b1,seen = depend bag eq1 id seen in + if b1 then b1,seen else depend bag eq2 id seen +;; + +let depend bag eq id = fst (depend bag eq id []);; + +let ppsubst = Subst.ppsubst ~names:[];; + +(* returns an explicit named subst and a list of arguments for sym_eq_URI *) +let build_ens uri termlist = + let obj, _ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match obj with + | Cic.Constant (_, _, _, uris, _) -> + (* assert (List.length uris <= List.length termlist); *) + let rec aux = function + | [], tl -> [], tl + | (uri::uris), (term::tl) -> + let ens, args = aux (uris, tl) in + (uri, term)::ens, args + | _, _ -> assert false + in + aux (uris, termlist) + | _ -> assert false +;; + +let mk_sym uri ty t1 t2 p = + let ens, args = build_ens uri [ty;t1;t2;p] in + Cic.Appl (Cic.Const(uri, ens) :: args) +;; + +let mk_trans uri ty t1 t2 t3 p12 p23 = + let ens, args = build_ens uri [ty;t1;t2;t3;p12;p23] in + Cic.Appl (Cic.Const (uri, ens) :: args) +;; + +let mk_eq_ind uri ty what pred p1 other p2 = + let ens, args = build_ens uri [ty; what; pred; p1; other; p2] in + Cic.Appl (Cic.Const (uri, ens) :: args) +;; + +let p_of_sym ens tl = + let args = List.map snd ens @ tl in + match args with + | [_;_;_;p] -> p + | _ -> assert false +;; + +let open_trans ens tl = + let args = List.map snd ens @ tl in + match args with + | [ty;l;m;r;p1;p2] -> ty,l,m,r,p1,p2 + | _ -> assert false +;; + +let open_sym ens tl = + let args = List.map snd ens @ tl in + match args with + | [ty;l;r;p] -> ty,l,r,p + | _ -> assert false +;; + +let open_eq_ind args = + match args with + | [ty;l;pred;pl;r;pleqr] -> ty,l,pred,pl,r,pleqr + | _ -> assert false +;; + +let open_pred pred = + match pred with + | Cic.Lambda (_,_,(Cic.Appl [Cic.MutInd (uri, 0,_);ty;l;r])) + when LibraryObjects.is_eq_URI uri -> ty,uri,l,r + | _ -> Utils.debug_print (lazy (CicPp.ppterm pred)); assert false +;; + +let is_not_fixed t = + CicSubstitution.subst (Cic.Implicit None) t <> + CicSubstitution.subst (Cic.Rel 1) t +;; + +let canonical t context menv = + let remove_cycles t = + let is_transitive = + function + Cic.Appl (Cic.Const (uri_trans,_)::_) + when LibraryObjects.is_trans_eq_URI uri_trans -> + true + | _ -> false in + let rec collect = + function + Cic.Appl (Cic.Const (uri_trans,ens)::tl) + when LibraryObjects.is_trans_eq_URI uri_trans -> + let ty,l,m,r,p1,p2 = open_trans ens tl in + (if is_transitive p1 then fst (collect p1) else [l,p1]) @ + (if is_transitive p2 then fst (collect p2) else [m,p2]), + (r, uri_trans, ty) + | t -> assert false in + let rec cut_to_last_duplicate l acc = + function + [] -> List.rev acc + | (l',p)::tl when l=l' -> +if acc <> [] then +Utils.debug_print (lazy ("!!! RISPARMIO " ^ string_of_int (List.length acc) ^ " PASSI")); + cut_to_last_duplicate l [l',p] tl + | (l',p)::tl -> + cut_to_last_duplicate l ((l',p)::acc) tl + in + let rec rebuild = + function + (l,_)::_::_ as steps, ((r,uri_trans,ty) as last) -> + (match cut_to_last_duplicate l [] steps with + (l,p1)::((m,_)::_::_ as tl) -> + mk_trans uri_trans ty l m r p1 (rebuild (tl,last)) + | [l,p1 ; m,p2] -> mk_trans uri_trans ty l m r p1 p2 + | [l,p1] -> p1 + | [] -> assert false) + | _ -> assert false + in + if is_transitive t then + rebuild (collect t) + else + t + in + let rec remove_refl t = + match t with + | Cic.Appl (((Cic.Const(uri_trans,ens))::tl) as args) + when LibraryObjects.is_trans_eq_URI uri_trans -> + let ty,l,m,r,p1,p2 = open_trans ens tl in + (match p1,p2 with + | Cic.Appl [Cic.MutConstruct (uri, 0, 1,_);_;_],p2 -> + remove_refl p2 + | p1,Cic.Appl [Cic.MutConstruct (uri, 0, 1,_);_;_] -> + remove_refl p1 + | _ -> Cic.Appl (List.map remove_refl args)) + | Cic.Appl l -> Cic.Appl (List.map remove_refl l) + | Cic.LetIn (name,bo,rest) -> + Cic.LetIn (name,remove_refl bo,remove_refl rest) + | _ -> t + in + let rec canonical_trough_lambda context = function + | Cic.Lambda(name,ty,bo) -> + let context' = (Some (name,Cic.Decl ty))::context in + Cic.Lambda(name,ty,canonical_trough_lambda context' bo) + | t -> canonical context t + + and canonical context t = + match t with + | Cic.LetIn(name,bo,rest) -> + let bo = canonical_trough_lambda context bo in + let context' = (Some (name,Cic.Def (bo,None)))::context in + Cic.LetIn(name,bo,canonical context' rest) + | Cic.Appl (((Cic.Const(uri_sym,ens))::tl) as args) + when LibraryObjects.is_sym_eq_URI uri_sym -> + (match p_of_sym ens tl with + | Cic.Appl ((Cic.Const(uri,ens))::tl) + when LibraryObjects.is_sym_eq_URI uri -> + canonical context (p_of_sym ens tl) + | Cic.Appl ((Cic.Const(uri_trans,ens))::tl) + when LibraryObjects.is_trans_eq_URI uri_trans -> + let ty,l,m,r,p1,p2 = open_trans ens tl in + mk_trans uri_trans ty r m l + (canonical context (mk_sym uri_sym ty m r p2)) + (canonical context (mk_sym uri_sym ty l m p1)) + | Cic.Appl (([Cic.Const(uri_feq,ens);ty1;ty2;f;x;y;p])) + when LibraryObjects.is_eq_f_URI uri_feq -> + let eq = LibraryObjects.eq_URI_of_eq_f_URI uri_feq in + let eq_f_sym = + Cic.Const (LibraryObjects.eq_f_sym_URI ~eq, []) + in + let rc = Cic.Appl [eq_f_sym;ty1;ty2;f;x;y;p] in + Utils.debug_print (lazy ("CANONICAL " ^ CicPp.ppterm rc)); + rc + | Cic.Appl [Cic.MutConstruct (uri, 0, 1,_);_;_] as t + when LibraryObjects.is_eq_URI uri -> t + | _ -> Cic.Appl (List.map (canonical context) args)) + | Cic.Appl l -> Cic.Appl (List.map (canonical context) l) + | _ -> t + in + remove_cycles (remove_refl (canonical context t)) +;; + +let compose_contexts ctx1 ctx2 = + ProofEngineReduction.replace_lifting + ~equality:(fun _ ->(=)) ~context:[] ~what:[Cic.Implicit(Some `Hole)] ~with_what:[ctx2] ~where:ctx1 +;; + +let put_in_ctx ctx t = + ProofEngineReduction.replace_lifting + ~equality:(fun _ -> (=)) ~context:[] ~what:[Cic.Implicit (Some `Hole)] ~with_what:[t] ~where:ctx +;; + +let mk_eq uri ty l r = + let ens, args = build_ens uri [ty; l; r] in + Cic.Appl (Cic.MutInd(uri,0,ens) :: args) +;; + +let mk_refl uri ty t = + let ens, args = build_ens uri [ty; t] in + Cic.Appl (Cic.MutConstruct(uri,0,1,ens) :: args) +;; + +let open_eq = function + | Cic.Appl [Cic.MutInd(uri,0,[]);ty;l;r] when LibraryObjects.is_eq_URI uri -> + uri, ty, l ,r + | _ -> assert false +;; + +let mk_feq uri_feq ty ty1 left pred right t = + let ens, args = build_ens uri_feq [ty;ty1;pred;left;right;t] in + Cic.Appl (Cic.Const(uri_feq,ens) :: args) +;; + +let rec look_ahead aux = function + | Cic.Appl ((Cic.Const(uri_ind,ens))::tl) as t + when LibraryObjects.is_eq_ind_URI uri_ind || + LibraryObjects.is_eq_ind_r_URI uri_ind -> + let ty1,what,pred,p1,other,p2 = open_eq_ind tl in + let ty2,eq,lp,rp = open_pred pred in + let hole = Cic.Implicit (Some `Hole) in + let ty2 = CicSubstitution.subst hole ty2 in + aux ty1 (CicSubstitution.subst other lp) (CicSubstitution.subst other rp) hole ty2 t + | Cic.Lambda (n,s,t) -> Cic.Lambda (n,s,look_ahead aux t) + | t -> t +;; + +let contextualize uri ty left right t = + let hole = Cic.Implicit (Some `Hole) in + (* aux [uri] [ty] [left] [right] [ctx] [ctx_ty] [t] + * + * the parameters validate this invariant + * t: eq(uri) ty left right + * that is used only by the base case + * + * ctx is a term with an hole. Cic.Implicit(Some `Hole) is the empty context + * ctx_ty is the type of ctx + *) + let rec aux uri ty left right ctx_d ctx_ty t = + match t with + | Cic.Appl ((Cic.Const(uri_sym,ens))::tl) + when LibraryObjects.is_sym_eq_URI uri_sym -> + let ty,l,r,p = open_sym ens tl in + mk_sym uri_sym ty l r (aux uri ty l r ctx_d ctx_ty p) + | Cic.LetIn (name,body,rest) -> + Cic.LetIn (name,look_ahead (aux uri) body, aux uri ty left right ctx_d ctx_ty rest) + | Cic.Appl ((Cic.Const(uri_ind,ens))::tl) + when LibraryObjects.is_eq_ind_URI uri_ind || + LibraryObjects.is_eq_ind_r_URI uri_ind -> + let ty1,what,pred,p1,other,p2 = open_eq_ind tl in + let ty2,eq,lp,rp = open_pred pred in + let uri_trans = LibraryObjects.trans_eq_URI ~eq:uri in + let uri_sym = LibraryObjects.sym_eq_URI ~eq:uri in + let is_not_fixed_lp = is_not_fixed lp in + let avoid_eq_ind = LibraryObjects.is_eq_ind_URI uri_ind in + (* extract the context and the fixed term from the predicate *) + let m, ctx_c, ty2 = + let m, ctx_c = if is_not_fixed_lp then rp,lp else lp,rp in + (* they were under a lambda *) + let m = CicSubstitution.subst hole m in + let ctx_c = CicSubstitution.subst hole ctx_c in + let ty2 = CicSubstitution.subst hole ty2 in + m, ctx_c, ty2 + in + (* create the compound context and put the terms under it *) + let ctx_dc = compose_contexts ctx_d ctx_c in + let dc_what = put_in_ctx ctx_dc what in + let dc_other = put_in_ctx ctx_dc other in + (* m is already in ctx_c so it is put in ctx_d only *) + let d_m = put_in_ctx ctx_d m in + (* we also need what in ctx_c *) + let c_what = put_in_ctx ctx_c what in + (* now put the proofs in the compound context *) + let p1 = (* p1: dc_what = d_m *) + if is_not_fixed_lp then + aux uri ty2 c_what m ctx_d ctx_ty p1 + else + mk_sym uri_sym ctx_ty d_m dc_what + (aux uri ty2 m c_what ctx_d ctx_ty p1) + in + let p2 = (* p2: dc_other = dc_what *) + if avoid_eq_ind then + mk_sym uri_sym ctx_ty dc_what dc_other + (aux uri ty1 what other ctx_dc ctx_ty p2) + else + aux uri ty1 other what ctx_dc ctx_ty p2 + in + (* if pred = \x.C[x]=m --> t : C[other]=m --> trans other what m + if pred = \x.m=C[x] --> t : m=C[other] --> trans m what other *) + let a,b,c,paeqb,pbeqc = + if is_not_fixed_lp then + dc_other,dc_what,d_m,p2,p1 + else + d_m,dc_what,dc_other, + (mk_sym uri_sym ctx_ty dc_what d_m p1), + (mk_sym uri_sym ctx_ty dc_other dc_what p2) + in + mk_trans uri_trans ctx_ty a b c paeqb pbeqc + | t when ctx_d = hole -> t + | t -> +(* let uri_sym = LibraryObjects.sym_eq_URI ~eq:uri in *) +(* let uri_ind = LibraryObjects.eq_ind_URI ~eq:uri in *) + + let uri_feq = LibraryObjects.eq_f_URI ~eq:uri in + let pred = +(* let r = CicSubstitution.lift 1 (put_in_ctx ctx_d left) in *) + let l = + let ctx_d = CicSubstitution.lift 1 ctx_d in + put_in_ctx ctx_d (Cic.Rel 1) + in +(* let lty = CicSubstitution.lift 1 ctx_ty in *) +(* Cic.Lambda (Cic.Name "foo",ty,(mk_eq uri lty l r)) *) + Cic.Lambda (Cic.Name "foo",ty,l) + in +(* let d_left = put_in_ctx ctx_d left in *) +(* let d_right = put_in_ctx ctx_d right in *) +(* let refl_eq = mk_refl uri ctx_ty d_left in *) +(* mk_sym uri_sym ctx_ty d_right d_left *) +(* (mk_eq_ind uri_ind ty left pred refl_eq right t) *) + (mk_feq uri_feq ty ctx_ty left pred right t) + in + aux uri ty left right hole ty t +;; + +let contextualize_rewrites t ty = + let eq,ty,l,r = open_eq ty in + contextualize eq ty l r t +;; + +let add_subst subst = + function + | Exact t -> Exact (Subst.apply_subst subst t) + | Step (s,(rule, id1, (pos,id2), pred)) -> + Step (Subst.concat subst s,(rule, id1, (pos,id2), pred)) +;; + +let build_proof_step eq lift subst p1 p2 pos l r pred = + let p1 = Subst.apply_subst_lift lift subst p1 in + let p2 = Subst.apply_subst_lift lift subst p2 in + let l = CicSubstitution.lift lift l in + let l = Subst.apply_subst_lift lift subst l in + let r = CicSubstitution.lift lift r in + let r = Subst.apply_subst_lift lift subst r in + let pred = CicSubstitution.lift lift pred in + let pred = Subst.apply_subst_lift lift subst pred in + let ty,body = + match pred with + | Cic.Lambda (_,ty,body) -> ty,body + | _ -> assert false + in + let what, other = + if pos = Utils.Left then l,r else r,l + in + let p = + match pos with + | Utils.Left -> + mk_eq_ind (LibraryObjects.eq_ind_URI ~eq) ty what pred p1 other p2 + | Utils.Right -> + mk_eq_ind (LibraryObjects.eq_ind_r_URI ~eq) ty what pred p1 other p2 + in + p +;; + +let parametrize_proof p l r = + let uniq l = HExtlib.list_uniq (List.sort (fun (i,_) (j,_) -> Pervasives.compare i j) l) in + let mot = CicUtil.metas_of_term_set in + let parameters = uniq (mot p @ mot l @ mot r) in + (* ?if they are under a lambda? *) +(* + let parameters = + HExtlib.list_uniq (List.sort Pervasives.compare parameters) + in +*) + (* resorts l such that *hopefully* dependencies can be inferred *) + let guess_dependency p l = + match p with + | Cic.Appl ((Cic.Const(uri_ind,ens))::tl) + when LibraryObjects.is_eq_ind_URI uri_ind || + LibraryObjects.is_eq_ind_r_URI uri_ind -> + let ty,_,_,_,_,_ = open_eq_ind tl in + let metas = CicUtil.metas_of_term ty in + let nondep, dep = + List.partition (fun (i,_) -> List.exists (fun (j,_) -> j=i) metas) l + in + nondep@dep + | _ -> l + in + let parameters = guess_dependency p parameters in + let what = List.map (fun (i,l) -> Cic.Meta (i,l)) parameters in + let with_what, lift_no = + List.fold_right (fun _ (acc,n) -> ((Cic.Rel n)::acc),n+1) what ([],1) + in + let p = CicSubstitution.lift (lift_no-1) p in + let p = + ProofEngineReduction.replace_lifting + ~equality:(fun _ t1 t2 -> + match t1,t2 with Cic.Meta (i,_),Cic.Meta(j,_) -> i=j | _ -> false) + ~context:[] + ~what ~with_what ~where:p + in + let ty_of_m _ = Cic.Implicit (Some `Type) in + let args, proof,_ = + List.fold_left + (fun (instance,p,n) m -> + (instance@[m], + Cic.Lambda + (Cic.Name ("X"^string_of_int n), + CicSubstitution.lift (lift_no - n - 1) (ty_of_m m), + p), + n+1)) + ([Cic.Rel 1],p,1) + what + in + let instance = match args with | [x] -> x | _ -> Cic.Appl args in + proof, instance +;; + +let wfo bag goalproof proof id = + let rec aux acc id = + let p,_,_ = proof_of_id bag id in + match p with + | Exact _ -> if (List.mem id acc) then acc else id :: acc + | Step (_,(_,id1, (_,id2), _)) -> + let acc = if not (List.mem id1 acc) then aux acc id1 else acc in + let acc = if not (List.mem id2 acc) then aux acc id2 else acc in + id :: acc + in + let acc = + match proof with + | Exact _ -> [id] + | Step (_,(_,id1, (_,id2), _)) -> aux (aux [id] id1) id2 + in + List.fold_left (fun acc (_,_,id,_,_) -> aux acc id) acc goalproof +;; + +let string_of_id (id_to_eq,_) names id = + if id = 0 then "" else + try + let (_,p,(t,l,r,_),m,_) = open_equality (Hashtbl.find id_to_eq id) in + match p with + | Exact t -> + Printf.sprintf "%d = %s: %s = %s [%s]" id + (CicPp.pp t names) (CicPp.pp l names) (CicPp.pp r names) +(* "..." *) + (String.concat ", " (List.map (fun (i,_,_) -> string_of_int i) m)) + | Step (_,(step,id1, (dir,id2), p) ) -> + Printf.sprintf "%6d: %s %6d %6d %s =(%s) %s [%s]" id + (string_of_rule step) + id1 id2 (CicPp.pp l names) (CicPp.pp t names) (CicPp.pp r names) + (String.concat ", " (List.map (fun (i,_,_) -> string_of_int i) m)) + (*"..."*) + with + Not_found -> assert false + +let pp_proof bag names goalproof proof subst id initial_goal = + String.concat "\n" (List.map (string_of_id bag names) (wfo bag goalproof proof id)) ^ + "\ngoal:\n " ^ + (String.concat "\n " + (fst (List.fold_right + (fun (r,pos,i,s,pred) (acc,g) -> + let _,_,left,right = open_eq g in + let ty = + match pos with + | Utils.Left -> CicReduction.head_beta_reduce (Cic.Appl[pred;right]) + | Utils.Right -> CicReduction.head_beta_reduce (Cic.Appl[pred;left]) + in + let ty = Subst.apply_subst s ty in + ("("^ string_of_rule r ^ " " ^ string_of_int i^") -> " + ^ CicPp.pp ty names) :: acc,ty) goalproof ([],initial_goal)))) ^ + "\nand then subsumed by " ^ string_of_int id ^ " when " ^ Subst.ppsubst subst +;; + +module OT = + struct + type t = int + let compare = Pervasives.compare + end + +module M = Map.Make(OT) + +let rec find_deps bag m i = + if M.mem i m then m + else + let p,_,_ = proof_of_id bag i in + match p with + | Exact _ -> M.add i [] m + | Step (_,(_,id1,(_,id2),_)) -> + let m = find_deps bag m id1 in + let m = find_deps bag m id2 in + (* without the uniq there is a stack overflow doing concatenation *) + let xxx = [id1;id2] @ M.find id1 m @ M.find id2 m in + let xxx = HExtlib.list_uniq (List.sort Pervasives.compare xxx) in + M.add i xxx m +;; + +let topological_sort bag l = + (* build the partial order relation *) + let m = List.fold_left (fun m i -> find_deps bag m i) M.empty l in + let m = (* keep only deps inside l *) + List.fold_left + (fun m' i -> + M.add i (List.filter (fun x -> List.mem x l) (M.find i m)) m') + M.empty l + in + let m = M.map (fun x -> Some x) m in + (* utils *) + let keys m = M.fold (fun i _ acc -> i::acc) m [] in + let split l m = List.filter (fun i -> M.find i m = Some []) l in + let purge l m = + M.mapi + (fun k v -> if List.mem k l then None else + match v with + | None -> None + | Some ll -> Some (List.filter (fun i -> not (List.mem i l)) ll)) + m + in + let rec aux m res = + let keys = keys m in + let ok = split keys m in + let m = purge ok m in + let res = ok @ res in + if ok = [] then res else aux m res + in + let rc = List.rev (aux m []) in + rc +;; + + +(* returns the list of ids that should be factorized *) +let get_duplicate_step_in_wfo bag l p = + let ol = List.rev l in + let h = Hashtbl.create 13 in + (* NOTE: here the n parameter is an approximation of the dependency + between equations. To do things seriously we should maintain a + dependency graph. This approximation is not perfect. *) + let add i = + let p,_,_ = proof_of_id bag i in + match p with + | Exact _ -> true + | _ -> + try + let no = Hashtbl.find h i in + Hashtbl.replace h i (no+1); + false + with Not_found -> Hashtbl.add h i 1;true + in + let rec aux = function + | Exact _ -> () + | Step (_,(_,i1,(_,i2),_)) -> + let go_on_1 = add i1 in + let go_on_2 = add i2 in + if go_on_1 then aux (let p,_,_ = proof_of_id bag i1 in p); + if go_on_2 then aux (let p,_,_ = proof_of_id bag i2 in p) + in + aux p; + List.iter + (fun (_,_,id,_,_) -> aux (let p,_,_ = proof_of_id bag id in p)) + ol; + (* now h is complete *) + let proofs = Hashtbl.fold (fun k count acc-> (k,count)::acc) h [] in + let proofs = List.filter (fun (_,c) -> c > 1) proofs in + let res = topological_sort bag (List.map (fun (i,_) -> i) proofs) in + res +;; + +let build_proof_term bag eq h lift proof = + let proof_of_id aux id = + let p,l,r = proof_of_id bag id in + try List.assoc id h,l,r with Not_found -> aux p, l, r + in + let rec aux = function + | Exact term -> + CicSubstitution.lift lift term + | Step (subst,(rule, id1, (pos,id2), pred)) -> + let p1,_,_ = proof_of_id aux id1 in + let p2,l,r = proof_of_id aux id2 in + let varname = + match rule with + | SuperpositionRight -> Cic.Name ("SupR" ^ Utils.string_of_pos pos) + | Demodulation -> Cic.Name ("DemEq"^ Utils.string_of_pos pos) + | _ -> assert false + in + let pred = + match pred with + | Cic.Lambda (_,a,b) -> Cic.Lambda (varname,a,b) + | _ -> assert false + in + let p = build_proof_step eq lift subst p1 p2 pos l r pred in +(* let cond = (not (List.mem 302 (Utils.metas_of_term p)) || id1 = 8 || id1 = 132) in + if not cond then + prerr_endline ("ERROR " ^ string_of_int id1 ^ " " ^ string_of_int id2); + assert cond;*) + p + in + aux proof +;; + +let build_goal_proof bag eq l initial ty se context menv = + let se = List.map (fun i -> Cic.Meta (i,[])) se in + let lets = get_duplicate_step_in_wfo bag l initial in + let letsno = List.length lets in + let lift_list l = List.map (fun (i,t) -> i,CicSubstitution.lift 1 t) l in + let lets,_,h = + List.fold_left + (fun (acc,n,h) id -> + let p,l,r = proof_of_id bag id in + let cic = build_proof_term bag eq h n p in + let real_cic,instance = + parametrize_proof cic l r + in + let h = (id, instance)::lift_list h in + acc@[id,real_cic],n+1,h) + ([],0,[]) lets + in + let proof,se = + let rec aux se current_proof = function + | [] -> current_proof,se + | (rule,pos,id,subst,pred)::tl -> + let p,l,r = proof_of_id bag id in + let p = build_proof_term bag eq h letsno p in + let pos = if pos = Utils.Left then Utils.Right else Utils.Left in + let varname = + match rule with + | SuperpositionLeft -> Cic.Name ("SupL" ^ Utils.string_of_pos pos) + | Demodulation -> Cic.Name ("DemG"^ Utils.string_of_pos pos) + | _ -> assert false + in + let pred = + match pred with + | Cic.Lambda (_,a,b) -> Cic.Lambda (varname,a,b) + | _ -> assert false + in + let proof = + build_proof_step eq letsno subst current_proof p pos l r pred + in + let proof,se = aux se proof tl in + Subst.apply_subst_lift letsno subst proof, + List.map (fun x -> Subst.apply_subst(*_lift letsno*) subst x) se + in + aux se (build_proof_term bag eq h letsno initial) l + in + let n,proof = + let initial = proof in + List.fold_right + (fun (id,cic) (n,p) -> + n-1, + Cic.LetIn ( + Cic.Name ("H"^string_of_int id), + cic, p)) + lets (letsno-1,initial) + in + canonical + (contextualize_rewrites proof (CicSubstitution.lift letsno ty)) + context menv, + se +;; + +let refl_proof eq_uri ty term = + Cic.Appl [Cic.MutConstruct (eq_uri, 0, 1, []); ty; term] +;; + +let metas_of_proof bag p = + let eq = + match LibraryObjects.eq_URI () with + | Some u -> u + | None -> + raise + (ProofEngineTypes.Fail + (lazy "No default equality defined when calling metas_of_proof")) + in + let p = build_proof_term bag eq [] 0 p in + Utils.metas_of_term p +;; + +let remove_local_context eq = + let w, p, (ty, left, right, o), menv,id = open_equality eq in + let p = Utils.remove_local_context p in + let ty = Utils.remove_local_context ty in + let left = Utils.remove_local_context left in + let right = Utils.remove_local_context right in + w, p, (ty, left, right, o), menv, id +;; + +let relocate newmeta menv to_be_relocated = + let subst, newmetasenv, newmeta = + List.fold_right + (fun i (subst, metasenv, maxmeta) -> + let _,context,ty = CicUtil.lookup_meta i menv in + let irl = [] in + let newmeta = Cic.Meta(maxmeta,irl) in + let newsubst = Subst.buildsubst i context newmeta ty subst in + newsubst, (maxmeta,context,ty)::metasenv, maxmeta+1) + to_be_relocated (Subst.empty_subst, [], newmeta+1) + in + let menv = Subst.apply_subst_metasenv subst menv @ newmetasenv in + subst, menv, newmeta + +let fix_metas_goal newmeta goal = + let (proof, menv, ty) = goal in + let to_be_relocated = + HExtlib.list_uniq (List.sort Pervasives.compare (Utils.metas_of_term ty)) + in + let subst, menv, newmeta = relocate newmeta menv to_be_relocated in + let ty = Subst.apply_subst subst ty in + let proof = + match proof with + | [] -> assert false (* is a nonsense to relocate the initial goal *) + | (r,pos,id,s,p) :: tl -> (r,pos,id,Subst.concat subst s,p) :: tl + in + newmeta+1,(proof, menv, ty) +;; + +let fix_metas bag newmeta eq = + let w, p, (ty, left, right, o), menv,_ = open_equality eq in + let to_be_relocated = +(* List.map (fun i ,_,_ -> i) menv *) + HExtlib.list_uniq + (List.sort Pervasives.compare + (Utils.metas_of_term left @ Utils.metas_of_term right @ + Utils.metas_of_term ty)) + in + let subst, metasenv, newmeta = relocate newmeta menv to_be_relocated in + let ty = Subst.apply_subst subst ty in + let left = Subst.apply_subst subst left in + let right = Subst.apply_subst subst right in + let fix_proof = function + | Exact p -> Exact (Subst.apply_subst subst p) + | Step (s,(r,id1,(pos,id2),pred)) -> + Step (Subst.concat s subst,(r,id1,(pos,id2), pred)) + in + let p = fix_proof p in + let eq' = mk_equality bag (w, p, (ty, left, right, o), metasenv) in + newmeta+1, eq' + +exception NotMetaConvertible;; + +let meta_convertibility_aux table t1 t2 = + let module C = Cic in + let rec aux ((table_l,table_r) as table) t1 t2 = + match t1, t2 with + | C.Meta (m1, tl1), C.Meta (m2, tl2) when m1 = m2 -> table + | C.Meta (m1, tl1), C.Meta (m2, tl2) when m1 < m2 -> aux table t2 t1 + | C.Meta (m1, tl1), C.Meta (m2, tl2) -> + let m1_binding, table_l = + try List.assoc m1 table_l, table_l + with Not_found -> m2, (m1, m2)::table_l + and m2_binding, table_r = + try List.assoc m2 table_r, table_r + with Not_found -> m1, (m2, m1)::table_r + in + if (m1_binding <> m2) || (m2_binding <> m1) then + raise NotMetaConvertible + else table_l,table_r + | C.Var (u1, ens1), C.Var (u2, ens2) + | C.Const (u1, ens1), C.Const (u2, ens2) when (UriManager.eq u1 u2) -> + aux_ens table ens1 ens2 + | C.Cast (s1, t1), C.Cast (s2, t2) + | C.Prod (_, s1, t1), C.Prod (_, s2, t2) + | C.Lambda (_, s1, t1), C.Lambda (_, s2, t2) + | C.LetIn (_, s1, t1), C.LetIn (_, s2, t2) -> + let table = aux table s1 s2 in + aux table t1 t2 + | C.Appl l1, C.Appl l2 -> ( + try List.fold_left2 (fun res t1 t2 -> (aux res t1 t2)) table l1 l2 + with Invalid_argument _ -> raise NotMetaConvertible + ) + | C.MutInd (u1, i1, ens1), C.MutInd (u2, i2, ens2) + when (UriManager.eq u1 u2) && i1 = i2 -> aux_ens table ens1 ens2 + | C.MutConstruct (u1, i1, j1, ens1), C.MutConstruct (u2, i2, j2, ens2) + when (UriManager.eq u1 u2) && i1 = i2 && j1 = j2 -> + aux_ens table ens1 ens2 + | C.MutCase (u1, i1, s1, t1, l1), C.MutCase (u2, i2, s2, t2, l2) + when (UriManager.eq u1 u2) && i1 = i2 -> + let table = aux table s1 s2 in + let table = aux table t1 t2 in ( + try List.fold_left2 (fun res t1 t2 -> (aux res t1 t2)) table l1 l2 + with Invalid_argument _ -> raise NotMetaConvertible + ) + | C.Fix (i1, il1), C.Fix (i2, il2) when i1 = i2 -> ( + try + List.fold_left2 + (fun res (n1, i1, s1, t1) (n2, i2, s2, t2) -> + if i1 <> i2 then raise NotMetaConvertible + else + let res = (aux res s1 s2) in aux res t1 t2) + table il1 il2 + with Invalid_argument _ -> raise NotMetaConvertible + ) + | C.CoFix (i1, il1), C.CoFix (i2, il2) when i1 = i2 -> ( + try + List.fold_left2 + (fun res (n1, s1, t1) (n2, s2, t2) -> + let res = aux res s1 s2 in aux res t1 t2) + table il1 il2 + with Invalid_argument _ -> raise NotMetaConvertible + ) + | t1, t2 when t1 = t2 -> table + | _, _ -> raise NotMetaConvertible + + and aux_ens table ens1 ens2 = + let cmp (u1, t1) (u2, t2) = + Pervasives.compare (UriManager.string_of_uri u1) (UriManager.string_of_uri u2) + in + let ens1 = List.sort cmp ens1 + and ens2 = List.sort cmp ens2 in + try + List.fold_left2 + (fun res (u1, t1) (u2, t2) -> + if not (UriManager.eq u1 u2) then raise NotMetaConvertible + else aux res t1 t2) + table ens1 ens2 + with Invalid_argument _ -> raise NotMetaConvertible + in + aux table t1 t2 +;; + + +let meta_convertibility_eq eq1 eq2 = + let _, _, (ty, left, right, _), _,_ = open_equality eq1 in + let _, _, (ty', left', right', _), _,_ = open_equality eq2 in + if ty <> ty' then + false + else if (left = left') && (right = right') then + true + else if (left = right') && (right = left') then + true + else + try + let table = meta_convertibility_aux ([],[]) left left' in + let _ = meta_convertibility_aux table right right' in + true + with NotMetaConvertible -> + try + let table = meta_convertibility_aux ([],[]) left right' in + let _ = meta_convertibility_aux table right left' in + true + with NotMetaConvertible -> + false +;; + +let meta_convertibility t1 t2 = + if t1 = t2 then + true + else + try + ignore(meta_convertibility_aux ([],[]) t1 t2); + true + with NotMetaConvertible -> + false +;; + +let meta_convertibility_subst t1 t2 menv = + if t1 = t2 then + Some([]) + else + try + let (l,_) = meta_convertibility_aux ([],[]) t1 t2 in + let subst = + List.map + (fun (x,y) -> + try + let (_,c,t) = CicUtil.lookup_meta x menv in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable c in + (y,(c,Cic.Meta(x,irl),t)) + with CicUtil.Meta_not_found _ -> + try + let (_,c,t) = CicUtil.lookup_meta y menv in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable c in + (x,(c,Cic.Meta(y,irl),t)) + with CicUtil.Meta_not_found _ -> assert false) l in + Some subst + with NotMetaConvertible -> + None +;; + +exception TermIsNotAnEquality;; + +let term_is_equality term = + match term with + | Cic.Appl [Cic.MutInd (uri, _, _); _; _; _] + when LibraryObjects.is_eq_URI uri -> true + | _ -> false +;; + +let equality_of_term bag proof term = + match term with + | Cic.Appl [Cic.MutInd (uri, _, _); ty; t1; t2] + when LibraryObjects.is_eq_URI uri -> + let o = !Utils.compare_terms t1 t2 in + let stat = (ty,t1,t2,o) in + let w = Utils.compute_equality_weight stat in + let e = mk_equality bag (w, Exact proof, stat,[]) in + e + | _ -> + raise TermIsNotAnEquality +;; + +let is_weak_identity eq = + let _,_,(_,left, right,_),_,_ = open_equality eq in + left = right + (* doing metaconv here is meaningless *) +;; + +let is_identity (_, context, ugraph) eq = + let _,_,(ty,left,right,_),menv,_ = open_equality eq in + (* doing metaconv here is meaningless *) + left = right +(* fst (CicReduction.are_convertible ~metasenv:menv context left right ugraph) + * *) +;; + + +let term_of_equality eq_uri equality = + let _, _, (ty, left, right, _), menv, _= open_equality equality in + let eq i = function Cic.Meta (j, _) -> i = j | _ -> false in + let argsno = List.length menv in + let t = + CicSubstitution.lift argsno + (Cic.Appl [Cic.MutInd (eq_uri, 0, []); ty; left; right]) + in + snd ( + List.fold_right + (fun (i,_,ty) (n, t) -> + let name = Cic.Name ("X" ^ (string_of_int n)) in + let ty = CicSubstitution.lift (n-1) ty in + let t = + ProofEngineReduction.replace + ~equality:eq ~what:[i] + ~with_what:[Cic.Rel (argsno - (n - 1))] ~where:t + in + (n-1, Cic.Prod (name, ty, t))) + menv (argsno, t)) +;; + +let symmetric bag eq_ty l id uri m = + let eq = Cic.MutInd(uri,0,[]) in + let pred = + Cic.Lambda (Cic.Name "Sym",eq_ty, + Cic.Appl [CicSubstitution.lift 1 eq ; + CicSubstitution.lift 1 eq_ty; + Cic.Rel 1;CicSubstitution.lift 1 l]) + in + let prefl = + Exact (Cic.Appl + [Cic.MutConstruct(uri,0,1,[]);eq_ty;l]) + in + let id1 = + let eq = mk_equality bag (0,prefl,(eq_ty,l,l,Utils.Eq),m) in + let (_,_,_,_,id) = open_equality eq in + id + in + Step(Subst.empty_subst, + (Demodulation,id1,(Utils.Left,id),pred)) +;; + +module IntOT = struct + type t = int + let compare = Pervasives.compare +end + +module IntSet = Set.Make(IntOT);; + +let n_purged = ref 0;; + +let collect ((id_to_eq,_) as bag) alive1 alive2 alive3 = +(* let _ = <:start> in *) + let deps_of id = + let p,_,_ = proof_of_id bag id in + match p with + | Exact _ -> IntSet.empty + | Step (_,(_,id1,(_,id2),_)) -> + IntSet.add id1 (IntSet.add id2 IntSet.empty) + in + let rec close s = + let news = IntSet.fold (fun id s -> IntSet.union (deps_of id) s) s s in + if IntSet.equal news s then s else close news + in + let l_to_s s l = List.fold_left (fun s x -> IntSet.add x s) s l in + let alive_set = l_to_s (l_to_s (l_to_s IntSet.empty alive2) alive1) alive3 in + let closed_alive_set = close alive_set in + let to_purge = + Hashtbl.fold + (fun k _ s -> + if not (IntSet.mem k closed_alive_set) then + k::s else s) id_to_eq [] + in + n_purged := !n_purged + List.length to_purge; + List.iter (Hashtbl.remove id_to_eq) to_purge; +(* let _ = <:stop> in () *) +;; + +let id_of e = + let _,_,_,_,id = open_equality e in id +;; + +let get_stats () = "" +(* + <:show> ^ + "# of purged eq by the collector: " ^ string_of_int !n_purged ^ "\n" +*) +;; + +let rec pp_proofterm name t context = + let rec skip_lambda tys ctx = function + | Cic.Lambda (n,s,t) -> skip_lambda (s::tys) ((Some n)::ctx) t + | t -> ctx,tys,t + in + let rename s name = + match name with + | Cic.Name s1 -> Cic.Name (s ^ s1) + | _ -> assert false + in + let rec skip_letin ctx = function + | Cic.LetIn (n,b,t) -> + pp_proofterm (Some (rename "Lemma " n)) b ctx:: + skip_letin ((Some n)::ctx) t + | t -> + let ppterm t = CicPp.pp t ctx in + let rec pp inner = function + | Cic.Appl [Cic.Const (uri,[]);_;l;m;r;p1;p2] + when Pcre.pmatch ~pat:"trans_eq" (UriManager.string_of_uri uri)-> + if not inner then + (" " ^ ppterm l) :: pp true p1 @ + [ " = " ^ ppterm m ] @ pp true p2 @ + [ " = " ^ ppterm r ] + else + pp true p1 @ + [ " = " ^ ppterm m ] @ pp true p2 + | Cic.Appl [Cic.Const (uri,[]);_;l;m;p] + when Pcre.pmatch ~pat:"sym_eq" (UriManager.string_of_uri uri)-> + pp true p + | Cic.Appl [Cic.Const (uri,[]);_;_;_;_;_;p] + when Pcre.pmatch ~pat:"eq_f" (UriManager.string_of_uri uri)-> + pp true p + | Cic.Appl [Cic.Const (uri,[]);_;_;_;_;_;p] + when Pcre.pmatch ~pat:"eq_OF_eq" (UriManager.string_of_uri uri)-> + pp true p + | Cic.Appl [Cic.MutConstruct (uri,_,_,[]);_;_;t;p] + when Pcre.pmatch ~pat:"ex.ind" (UriManager.string_of_uri uri)-> + [ "witness " ^ ppterm t ] @ pp true p + | Cic.Appl (t::_) ->[ " [by " ^ ppterm t ^ "]"] + | t ->[ " [by " ^ ppterm t ^ "]"] + in + let rec compat = function + | a::b::tl -> (b ^ a) :: compat tl + | h::[] -> [h] + | [] -> [] + in + let compat l = List.hd l :: compat (List.tl l) in + compat (pp false t) @ ["";""] + in + let names, tys, body = skip_lambda [] context t in + let ppname name = (match name with Some (Cic.Name s) -> s | _ -> "") in + ppname name ^ ":\n" ^ + (if context = [] then + let rec pp_l ctx = function + | (t,name)::tl -> + " " ^ ppname name ^ ": " ^ CicPp.pp t ctx ^ "\n" ^ + pp_l (name::ctx) tl + | [] -> "\n\n" + in + pp_l [] (List.rev (List.combine tys names)) + else "") + ^ + String.concat "\n" (skip_letin names body) +;; + +let pp_proofterm t = + "\n\n" ^ + pp_proofterm (Some (Cic.Name "Hypothesis")) t [] +;; + +let initial_nameset_list = [ + "x"; "y"; "z"; "t"; "u"; "v"; "a"; "b"; "c"; "d"; + "e"; "l"; "m"; "n"; "o"; "p"; "q"; "r"; +] + +module S = Set.Make(String) + +let initial_nameset = List.fold_right S.add initial_nameset_list S.empty, [];; + +let freshname (nameset, subst) term = + let m = CicUtil.metas_of_term term in + let nameset, subst = + List.fold_left + (fun (set,rc) (m,_) -> + if List.mem_assoc m rc then set,rc else + let name = S.choose set in + let set = S.remove name set in + set, + (m,Cic.Const(UriManager.uri_of_string + ("cic:/"^name^".con"),[]))::rc) + (nameset,subst) m + in + let term = + ProofEngineReduction.replace + ~equality:(fun i t -> match t with Cic.Meta (j,_) -> i=j| _ -> false) + ~what:(List.map fst subst) + ~with_what:(List.map snd subst) ~where:term + in + (nameset, subst), term +;; + +let remove_names_in_context (set,subst) names = + List.fold_left + (fun s n -> + match n with Some (Cic.Name n) -> S.remove n s | _ -> s) + set names, subst +;; + +let string_of_id2 (id_to_eq,_) names nameset id = + if id = 0 then "" else + try + let (_,_,(_,l,r,_),_,_) = open_equality (Hashtbl.find id_to_eq id) in + let nameset, l = freshname nameset l in + let nameset, r = freshname nameset r in + Printf.sprintf "%s = %s" (CicPp.pp l names) (CicPp.pp r names) + with + Not_found -> assert false +;; + +let draw_proof bag names goal_proof proof id = + let b = Buffer.create 100 in + let fmt = Format.formatter_of_buffer b in + let sint = string_of_int in + let fst3 (x,_,_) = x in + let visited = ref [] in + let nameset = remove_names_in_context initial_nameset names in + let rec fact id = function + | Exact t -> + if not (List.mem id !visited) then + begin + visited := id :: !visited; + let nameset, t = freshname nameset t in + let t = CicPp.pp t names in + GraphvizPp.Dot.node (sint id) + ~attrs:["label",t^":"^string_of_id2 bag names nameset id; + "shape","rectangle"] fmt; + end + | Step (_,(_,id1,(_,id2),_)) -> + GraphvizPp.Dot.edge (sint id) (sint id1) fmt; + GraphvizPp.Dot.edge (sint id) (sint id2) fmt; + let p1,_,_ = proof_of_id bag id1 in + let p2,_,_ = proof_of_id bag id2 in + fact id1 p1; + fact id2 p2; + if not (List.mem id !visited); then + begin + visited := id :: !visited; + GraphvizPp.Dot.node (sint id) + ~attrs:["label",sint id^":"^string_of_id2 bag names nameset id; + "shape","ellipse"] fmt + end + in + let sleft acc (_,_,id,_,_) = + if acc != 0 then GraphvizPp.Dot.edge (sint acc) (sint id) fmt; + fact id (fst3 (proof_of_id bag id)); + id + in + GraphvizPp.Dot.header ~node_attrs:["fontsize","10"; ] fmt; + ignore(List.fold_left sleft id goal_proof); + GraphvizPp.Dot.trailer fmt; + let oc = open_out "/tmp/matita_paramod.dot" in + Buffer.output_buffer oc b; + close_out oc; + Utils.debug_print (lazy "dot!"); + ignore(Unix.system + "dot -Tps -o /tmp/matita_paramod.eps /tmp/matita_paramod.dot" +(* "cat /tmp/matita_paramod.dot| tred | dot -Tps -o /tmp/matita_paramod.eps" *) + ); + ignore(Unix.system "gv /tmp/matita_paramod.eps"); +;; + diff --git a/components/tactics/paramodulation/equality.mli b/components/tactics/paramodulation/equality.mli new file mode 100644 index 000000000..6eb48a036 --- /dev/null +++ b/components/tactics/paramodulation/equality.mli @@ -0,0 +1,147 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type rule = SuperpositionRight | SuperpositionLeft | Demodulation + +(* every equality group has its own bag. the bag contains the infos necessary + * for building the proof. FIXME: should also contain maxmeta! *) +type equality_bag + +val mk_equality_bag: unit -> equality_bag + +type equality + +and proof = + Exact of Cic.term + | Step of Subst.substitution * (rule * int * (Utils.pos * int) * Cic.term) + +and goal_proof = (rule * Utils.pos * int * Subst.substitution * Cic.term) list + +type goal = goal_proof * Cic.metasenv * Cic.term + +val pp_proof: + equality_bag -> + (Cic.name option) list -> goal_proof -> proof -> Subst.substitution -> int -> + Cic.term -> string + +val draw_proof: + equality_bag -> + (Cic.name option) list -> goal_proof -> proof -> int -> unit + +val pp_proofterm: Cic.term -> string + +val mk_equality : + equality_bag -> int * proof * + (Cic.term * Cic.term * Cic.term * Utils.comparison) * + Cic.metasenv -> + equality + +val mk_tmp_equality : + int * (Cic.term * Cic.term * Cic.term * Utils.comparison) * Cic.metasenv -> + equality + +val open_equality : + equality -> + int * proof * + (Cic.term * Cic.term * Cic.term * Utils.comparison) * + Cic.metasenv * int +val depend : equality_bag -> equality -> int -> bool +val compare : equality -> equality -> int +val max_weight_in_proof : equality_bag -> int -> proof -> int +val max_weight : equality_bag -> goal_proof -> proof -> int +val string_of_equality : + ?env:Utils.environment -> equality -> string +val string_of_proof : + ?names:(Cic.name option)list -> equality_bag -> proof -> goal_proof -> string +(* given a proof and a list of meta indexes we are interested in the + * instantiation gives back the cic proof and the list of instantiations *) +(* build_goal_proof [eq_URI] [goal_proof] [initial_proof] [ty] + * [ty] is the type of the goal *) +val build_goal_proof: + equality_bag -> + UriManager.uri -> goal_proof -> proof -> Cic.term-> int list -> + Cic.context -> Cic.metasenv -> + Cic.term * Cic.term list +val build_proof_term : + equality_bag -> + UriManager.uri -> (int * Cic.term) list -> int -> proof -> Cic.term +val refl_proof: UriManager.uri -> Cic.term -> Cic.term -> Cic.term +(** ensures that metavariables in equality are unique *) +val fix_metas_goal: int -> goal -> int * goal +val fix_metas: equality_bag -> int -> equality -> int * equality +val metas_of_proof: equality_bag -> proof -> int list + +(* this should be used _only_ to apply (efficiently) this subst on the + * initial proof passed to build_goal_proof *) +val add_subst : Subst.substitution -> proof -> proof +exception TermIsNotAnEquality;; + +(** + raises TermIsNotAnEquality if term is not an equation. + The first Cic.term is a proof of the equation +*) +val equality_of_term: equality_bag -> Cic.term -> Cic.term -> equality + +(** + Re-builds the term corresponding to this equality +*) +val term_of_equality: UriManager.uri -> equality -> Cic.term +val term_is_equality: Cic.term -> bool + +(** tests a sort of alpha-convertibility between the two terms, but on the + metavariables *) +val meta_convertibility: Cic.term -> Cic.term -> bool + +(** meta convertibility between two equations *) +val meta_convertibility_eq: equality -> equality -> bool +val meta_convertibility_subst: + Cic.term -> Cic.term -> Cic.metasenv -> Cic.substitution option + +val is_weak_identity: equality -> bool +val is_identity: Utils.environment -> equality -> bool + +(* symmetric [eq_ty] [l] [id] [uri] [m] + * + * given an equality (_,p,(_,[l],r,_),[m],[id]) of 'type' l=r + * returns the proof of the symmetric (r=l). + * + * [uri] is the uri of eq + * [eq_ty] the ty of the equality sides + *) +val symmetric: + equality_bag -> Cic.term -> Cic.term -> int -> UriManager.uri -> + Cic.metasenv -> proof + +(* takes 3 lists of alive ids (they are threated the same way, the type is + * funny just to not oblige you to concatenate them) and drops all the dead + * equalities *) +val collect: equality_bag -> int list -> int list -> int list -> unit + +(* given an equality, returns the numerical id *) +val id_of: equality -> int + +(* profiling statistics *) +val get_stats: unit -> string + diff --git a/components/tactics/paramodulation/equality_indexing.ml b/components/tactics/paramodulation/equality_indexing.ml new file mode 100644 index 000000000..85ec40f8a --- /dev/null +++ b/components/tactics/paramodulation/equality_indexing.ml @@ -0,0 +1,129 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +module type EqualityIndex = + sig + module PosEqSet : Set.S with type elt = Utils.pos * Equality.equality + type t = Discrimination_tree.DiscriminationTreeIndexing(PosEqSet).t + val empty : t + val retrieve_generalizations : t -> Cic.term -> PosEqSet.t + val retrieve_unifiables : t -> Cic.term -> PosEqSet.t + val init_index : unit -> unit + val remove_index : t -> Equality.equality -> t + val index : t -> Equality.equality -> t + val in_index : t -> Equality.equality -> bool + end + +module DT = +struct + module OrderedPosEquality = struct + type t = Utils.pos * Equality.equality + let compare (p1,e1) (p2,e2) = + let rc = Pervasives.compare p1 p2 in + if rc = 0 then Equality.compare e1 e2 else rc + end + + module PosEqSet = Set.Make(OrderedPosEquality);; + + include Discrimination_tree.DiscriminationTreeIndexing(PosEqSet) + + + (* DISCRIMINATION TREES *) + let init_index () = () ;; + + let remove_index tree equality = + let _, _, (_, l, r, ordering), _,_ = Equality.open_equality equality in + match ordering with + | Utils.Gt -> remove_index tree l (Utils.Left, equality) + | Utils.Lt -> remove_index tree r (Utils.Right, equality) + | _ -> + let tree = remove_index tree r (Utils.Right, equality) in + remove_index tree l (Utils.Left, equality) + + let index tree equality = + let _, _, (_, l, r, ordering), _,_ = Equality.open_equality equality in + match ordering with + | Utils.Gt -> index tree l (Utils.Left, equality) + | Utils.Lt -> index tree r (Utils.Right, equality) + | _ -> + let tree = index tree r (Utils.Right, equality) in + index tree l (Utils.Left, equality) + + + let in_index tree equality = + let _, _, (_, l, r, ordering), _,_ = Equality.open_equality equality in + let meta_convertibility (pos,equality') = + Equality.meta_convertibility_eq equality equality' + in + in_index tree l meta_convertibility || in_index tree r meta_convertibility + + end + +module PT = + struct + module OrderedPosEquality = struct + type t = Utils.pos * Equality.equality + let compare (p1,e1) (p2,e2) = + let rc = Pervasives.compare p1 p2 in + if rc = 0 then Equality.compare e1 e2 else rc + end + + module PosEqSet = Set.Make(OrderedPosEquality);; + + include Discrimination_tree.DiscriminationTreeIndexing(PosEqSet) + + + (* DISCRIMINATION TREES *) + let init_index () = () ;; + + let remove_index tree equality = + let _, _, (_, l, r, ordering), _,_ = Equality.open_equality equality in + match ordering with + | Utils.Gt -> remove_index tree l (Utils.Left, equality) + | Utils.Lt -> remove_index tree r (Utils.Right, equality) + | _ -> + let tree = remove_index tree r (Utils.Right, equality) in + remove_index tree l (Utils.Left, equality) + + let index tree equality = + let _, _, (_, l, r, ordering), _,_ = Equality.open_equality equality in + match ordering with + | Utils.Gt -> index tree l (Utils.Left, equality) + | Utils.Lt -> index tree r (Utils.Right, equality) + | _ -> + let tree = index tree r (Utils.Right, equality) in + index tree l (Utils.Left, equality) + + + let in_index tree equality = + let _, _, (_, l, r, ordering), _,_ = Equality.open_equality equality in + let meta_convertibility (pos,equality') = + Equality.meta_convertibility_eq equality equality' + in + in_index tree l meta_convertibility || in_index tree r meta_convertibility +end + diff --git a/components/tactics/paramodulation/equality_indexing.mli b/components/tactics/paramodulation/equality_indexing.mli new file mode 100644 index 000000000..f9b51a589 --- /dev/null +++ b/components/tactics/paramodulation/equality_indexing.mli @@ -0,0 +1,41 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +module type EqualityIndex = + sig + module PosEqSet : Set.S with type elt = Utils.pos * Equality.equality + type t = Discrimination_tree.DiscriminationTreeIndexing(PosEqSet).t + val empty : t + val retrieve_generalizations : t -> Cic.term -> PosEqSet.t + val retrieve_unifiables : t -> Cic.term -> PosEqSet.t + val init_index : unit -> unit + val remove_index : t -> Equality.equality -> t + val index : t -> Equality.equality -> t + val in_index : t -> Equality.equality -> bool + end + +module DT : EqualityIndex +module PT : EqualityIndex + diff --git a/components/tactics/paramodulation/founif.ml b/components/tactics/paramodulation/founif.ml new file mode 100644 index 000000000..2a9de5ffa --- /dev/null +++ b/components/tactics/paramodulation/founif.ml @@ -0,0 +1,199 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* let _profiler = <:profiler<_profiler>>;; *) + +(* $Id$ *) + +open Utils;; +open Printf;; + +let debug_print s = ();;(*prerr_endline (Lazy.force s);;*) + +let check_disjoint_invariant subst metasenv msg = + if (List.exists + (fun (i,_,_) -> (Subst.is_in_subst i subst)) metasenv) + then + begin + prerr_endline ("not disjoint: " ^ msg); + assert false + end +;; + +let rec check_irl start = function + | [] -> true + | None::tl -> check_irl (start+1) tl + | (Some (Cic.Rel x))::tl -> + if x = start then check_irl (start+1) tl else false + | _ -> false +;; + +let rec is_simple_term = function + | Cic.Appl ((Cic.Meta _)::_) -> false + | Cic.Appl l -> List.for_all is_simple_term l + | Cic.Meta (i, l) -> let l = [] in check_irl 1 l + | Cic.Rel _ -> true + | Cic.Const _ -> true + | Cic.MutInd (_, _, []) -> true + | Cic.MutConstruct (_, _, _, []) -> true + | _ -> false +;; + +let locked menv i = + List.exists (fun (j,_,_) -> i = j) menv +;; + +let unification_simple locked_menv metasenv context t1 t2 ugraph = + let module C = Cic in + let module M = CicMetaSubst in + let module U = CicUnification in + let lookup = Subst.lookup_subst in + let rec occurs_check subst what where = + match where with + | Cic.Meta(i,_) when i = what -> true + | C.Appl l -> List.exists (occurs_check subst what) l + | C.Meta _ -> + let t = lookup where subst in + if t <> where then occurs_check subst what t else false + | _ -> false + in + let rec unif subst menv s t = + let s = match s with C.Meta _ -> lookup s subst | _ -> s + and t = match t with C.Meta _ -> lookup t subst | _ -> t + + in + match s, t with + | s, t when s = t -> subst, menv + (* sometimes the same meta has different local contexts; this + could create "cyclic" substitutions *) + | C.Meta (i, _), C.Meta (j, _) when i=j -> subst, menv + | C.Meta (i, _), C.Meta (j, _) + when (locked locked_menv i) &&(locked locked_menv j) -> + raise + (U.UnificationFailure (lazy "Inference.unification.unif")) + | C.Meta (i, _), C.Meta (j, _) when (locked locked_menv i) -> + unif subst menv t s + | C.Meta (i, _), C.Meta (j, _) when (i > j) && not (locked locked_menv j) -> + unif subst menv t s + | C.Meta (i,_), t when occurs_check subst i t -> + raise + (U.UnificationFailure (lazy "Inference.unification.unif")) + | C.Meta (i, l), t when (locked locked_menv i) -> + raise + (U.UnificationFailure (lazy "Inference.unification.unif")) + | C.Meta (i, l), t -> ( + try + let _, _, ty = CicUtil.lookup_meta i menv in + let subst = Subst.buildsubst i context t ty subst in + subst, menv + with CicUtil.Meta_not_found m -> + let names = names_of_context context in + (*debug_print + (lazy*) prerr_endline + (Printf.sprintf "Meta_not_found %d!: %s %s\n%s\n\n%s" m + (CicPp.pp t1 names) (CicPp.pp t2 names) + (print_metasenv menv) (print_metasenv metasenv)); + assert false + ) + | _, C.Meta _ -> unif subst menv t s + | C.Appl (hds::_), C.Appl (hdt::_) when hds <> hdt -> + raise (U.UnificationFailure (lazy "Inference.unification.unif")) + | C.Appl (hds::tls), C.Appl (hdt::tlt) -> ( + try + List.fold_left2 + (fun (subst', menv) s t -> unif subst' menv s t) + (subst, menv) tls tlt + with Invalid_argument _ -> + raise (U.UnificationFailure (lazy "Inference.unification.unif")) + ) + | _, _ -> + raise (U.UnificationFailure (lazy "Inference.unification.unif")) + in + let subst, menv = unif Subst.empty_subst metasenv t1 t2 in + let menv = Subst.filter subst menv in + subst, menv, ugraph +;; + +let profiler = HExtlib.profile "P/Inference.unif_simple[flatten]" +let profiler2 = HExtlib.profile "P/Inference.unif_simple[flatten_fast]" +let profiler3 = HExtlib.profile "P/Inference.unif_simple[resolve_meta]" +let profiler4 = HExtlib.profile "P/Inference.unif_simple[filter]" + +let unification_aux b metasenv1 metasenv2 context t1 t2 ugraph = + let metasenv = + HExtlib.list_uniq (List.sort Pervasives.compare (metasenv1 @ metasenv2)) + (* metasenv1 @ metasenv2 *) + in + let subst, menv, ug = + if not (is_simple_term t1) || not (is_simple_term t2) then ( + debug_print + (lazy + (Printf.sprintf "NOT SIMPLE TERMS: %s %s" + (CicPp.ppterm t1) (CicPp.ppterm t2))); + raise (CicUnification.UnificationFailure (lazy "Inference.unification.unif")) + ) else + if b then + (* full unification *) + unification_simple [] metasenv context t1 t2 ugraph + else + (* matching: metasenv1 is locked *) + unification_simple metasenv1 metasenv context t1 t2 ugraph + in + if Utils.debug_res then + ignore(check_disjoint_invariant subst menv "unif"); + (* let flatten subst = + List.map + (fun (i, (context, term, ty)) -> + let context = apply_subst_context subst context in + let term = apply_subst subst term in + let ty = apply_subst subst ty in + (i, (context, term, ty))) subst + in + let flatten subst = profiler.HExtlib.profile flatten subst in + let subst = flatten subst in *) + subst, menv, ug +;; + +exception MatchingFailure;; + +(** matching takes in input the _disjoint_ metasenv of t1 and t2; +it perform unification in the union metasenv, then check that +the first metasenv has not changed *) +let matching metasenv1 metasenv2 context t1 t2 ugraph = + try + unification_aux false metasenv1 metasenv2 context t1 t2 ugraph + with + CicUnification.UnificationFailure _ -> + raise MatchingFailure +;; + +let unification m1 m2 c t1 t2 ug = + try + unification_aux true m1 m2 c t1 t2 ug + with exn -> + raise exn +;; + +let get_stats () = "" (*<:show>*) ;; diff --git a/components/tactics/paramodulation/founif.mli b/components/tactics/paramodulation/founif.mli new file mode 100644 index 000000000..ef1529210 --- /dev/null +++ b/components/tactics/paramodulation/founif.mli @@ -0,0 +1,45 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception MatchingFailure + +(** matching between two terms. Can raise MatchingFailure *) +val matching: + Cic.metasenv -> Cic.metasenv -> Cic.context -> + Cic.term -> Cic.term -> + CicUniv.universe_graph -> + Subst.substitution * Cic.metasenv * CicUniv.universe_graph + +(** + special unification that checks if the two terms are "simple", and in + such case should be significantly faster than CicUnification.fo_unif +*) +val unification: + Cic.metasenv -> Cic.metasenv -> Cic.context -> + Cic.term -> Cic.term -> + CicUniv.universe_graph -> + Subst.substitution * Cic.metasenv * CicUniv.universe_graph + +val get_stats: unit -> string diff --git a/components/tactics/paramodulation/indexing.ml b/components/tactics/paramodulation/indexing.ml new file mode 100644 index 000000000..4e14964ff --- /dev/null +++ b/components/tactics/paramodulation/indexing.ml @@ -0,0 +1,1213 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* let _profiler = <:profiler<_profiler>>;; *) + +(* $Id$ *) + +module Index = Equality_indexing.DT (* discrimination tree based indexing *) +(* +module Index = Equality_indexing.DT (* path tree based indexing *) +*) + +let debug_print = Utils.debug_print;; + +(* +for debugging +let check_equation env equation msg = + let w, proof, (eq_ty, left, right, order), metas, args = equation in + let metasenv, context, ugraph = env + let metasenv' = metasenv @ metas in + try + CicTypeChecker.type_of_aux' metasenv' context left ugraph; + CicTypeChecker.type_of_aux' metasenv' context right ugraph; + () + with + CicUtil.Meta_not_found _ as exn -> + begin + prerr_endline msg; + prerr_endline (CicPp.ppterm left); + prerr_endline (CicPp.ppterm right); + raise exn + end +*) + +type retrieval_mode = Matching | Unification;; + +let string_of_res ?env = + function + None -> "None" + | Some (t, s, m, u, (p,e)) -> + Printf.sprintf "Some: (%s, %s, %s)" + (Utils.string_of_pos p) + (Equality.string_of_equality ?env e) + (CicPp.ppterm t) +;; + +let print_res ?env res = + prerr_endline + (String.concat "\n" + (List.map (string_of_res ?env) res)) +;; + +let print_candidates ?env mode term res = + let _ = + match mode with + | Matching -> + prerr_endline ("| candidates Matching " ^ (CicPp.ppterm term)) + | Unification -> + prerr_endline ("| candidates Unification " ^ (CicPp.ppterm term)) + in + prerr_endline + (String.concat "\n" + (List.map + (fun (p, e) -> + Printf.sprintf "| (%s, %s)" (Utils.string_of_pos p) + (Equality.string_of_equality ?env e)) + res)); +;; + + +let apply_subst = Subst.apply_subst + +let index = Index.index +let remove_index = Index.remove_index +let in_index = Index.in_index +let empty = Index.empty +let init_index = Index.init_index + +let check_disjoint_invariant subst metasenv msg = + if (List.exists + (fun (i,_,_) -> (Subst.is_in_subst i subst)) metasenv) + then + begin + prerr_endline ("not disjoint: " ^ msg); + assert false + end +;; + +let check_for_duplicates metas msg = + if List.length metas <> + List.length (HExtlib.list_uniq (List.sort Pervasives.compare metas)) then + begin + prerr_endline ("DUPLICATI " ^ msg); + prerr_endline (CicMetaSubst.ppmetasenv [] metas); + assert false + end +;; + +let check_res res msg = + match res with + Some (t, subst, menv, ug, eq_found) -> + let eqs = Equality.string_of_equality (snd eq_found) in + check_disjoint_invariant subst menv msg; + check_for_duplicates menv (msg ^ "\nchecking " ^ eqs); + | None -> () +;; + +let check_target bag context target msg = + let w, proof, (eq_ty, left, right, order), metas,_ = + Equality.open_equality target in + (* check that metas does not contains duplicates *) + let eqs = Equality.string_of_equality target in + let _ = check_for_duplicates metas (msg ^ "\nchecking " ^ eqs) in + let actual = (Utils.metas_of_term left)@(Utils.metas_of_term right) + @(Utils.metas_of_term eq_ty)@(Equality.metas_of_proof bag proof) in + let menv = List.filter (fun (i, _, _) -> List.mem i actual) metas in + let _ = if menv <> metas then + begin + prerr_endline ("extra metas " ^ msg); + prerr_endline (CicMetaSubst.ppmetasenv [] metas); + prerr_endline "**********************"; + prerr_endline (CicMetaSubst.ppmetasenv [] menv); + prerr_endline ("left: " ^ (CicPp.ppterm left)); + prerr_endline ("right: " ^ (CicPp.ppterm right)); + prerr_endline ("ty: " ^ (CicPp.ppterm eq_ty)); + assert false + end + else () in () +(* + try + ignore(CicTypeChecker.type_of_aux' + metas context (Founif.build_proof_term proof) CicUniv.empty_ugraph) + with e -> + prerr_endline msg; + prerr_endline (Founif.string_of_proof proof); + prerr_endline (CicPp.ppterm (Founif.build_proof_term proof)); + prerr_endline ("+++++++++++++left: " ^ (CicPp.ppterm left)); + prerr_endline ("+++++++++++++right: " ^ (CicPp.ppterm right)); + raise e +*) + + +(* returns a list of all the equalities in the tree that are in relation + "mode" with the given term, where mode can be either Matching or + Unification. + + Format of the return value: list of tuples in the form: + (position - Left or Right - of the term that matched the given one in this + equality, + equality found) + + Note that if equality is "left = right", if the ordering is left > right, + the position will always be Left, and if the ordering is left < right, + position will be Right. +*) + +let get_candidates ?env mode tree term = + let s = + match mode with + | Matching -> + Index.retrieve_generalizations tree term + | Unification -> + Index.retrieve_unifiables tree term + + in + Index.PosEqSet.elements s +;; + +(* + finds the first equality in the index that matches "term", of type "termty" + termty can be Implicit if it is not needed. The result (one of the sides of + the equality, actually) should be not greater (wrt the term ordering) than + term + + Format of the return value: + + (term to substitute, [Cic.Rel 1 properly lifted - see the various + build_newtarget functions inside the various + demodulation_* functions] + substitution used for the matching, + metasenv, + ugraph, [substitution, metasenv and ugraph have the same meaning as those + returned by CicUnification.fo_unif] + (equality where the matching term was found, [i.e. the equality to use as + rewrite rule] + uri [either eq_ind_URI or eq_ind_r_URI, depending on the direction of + the equality: this is used to build the proof term, again see one of + the build_newtarget functions] + )) +*) +let rec find_matches bag metasenv context ugraph lift_amount term termty = + let module C = Cic in + let module U = Utils in + let module S = CicSubstitution in + let module M = CicMetaSubst in + let module HL = HelmLibraryObjects in + let cmp = !Utils.compare_terms in + let check = match termty with C.Implicit None -> false | _ -> true in + function + | [] -> None + | candidate::tl -> + let pos, equality = candidate in + let (_, proof, (ty, left, right, o), metas,_) = + Equality.open_equality equality + in + if Utils.debug_metas then + ignore(check_target bag context (snd candidate) "find_matches"); + if Utils.debug_res then + begin + let c="eq = "^(Equality.string_of_equality (snd candidate)) ^ "\n"in + let t="t = " ^ (CicPp.ppterm term) ^ "\n" in + let m="metas = " ^ (CicMetaSubst.ppmetasenv [] metas) ^ "\n" in +(* + let p="proof = "^ + (CicPp.ppterm(Equality.build_proof_term proof))^"\n" + in +*) + check_for_duplicates metas "gia nella metas"; + check_for_duplicates (metasenv@metas) ("not disjoint"^c^t^m(*^p*)) + end; + if check && not (fst (CicReduction.are_convertible + ~metasenv context termty ty ugraph)) then ( + find_matches bag metasenv context ugraph lift_amount term termty tl + ) else + let do_match c = + let subst', metasenv', ugraph' = + Founif.matching + metasenv metas context term (S.lift lift_amount c) ugraph + in + Some (Cic.Rel(1+lift_amount),subst',metasenv',ugraph',candidate) + in + let c, other = + if pos = Utils.Left then left, right + else right, left + in + if o <> U.Incomparable then + let res = + try + do_match c + with Founif.MatchingFailure -> + find_matches bag metasenv context ugraph lift_amount term termty tl + in + if Utils.debug_res then ignore (check_res res "find1"); + res + else + let res = + try do_match c + with Founif.MatchingFailure -> None + in + if Utils.debug_res then ignore (check_res res "find2"); + match res with + | Some (_, s, _, _, _) -> + let c' = apply_subst s c in + (* + let other' = U.guarded_simpl context (apply_subst s other) in *) + let other' = apply_subst s other in + let order = cmp c' other' in + if order = U.Gt then + res + else + find_matches bag + metasenv context ugraph lift_amount term termty tl + | None -> + find_matches bag metasenv context ugraph lift_amount term termty tl +;; + +let find_matches metasenv context ugraph lift_amount term termty = + find_matches metasenv context ugraph lift_amount term termty +;; + +(* + as above, but finds all the matching equalities, and the matching condition + can be either Founif.matching or Inference.unification +*) +(* XXX termty unused *) +let rec find_all_matches ?(unif_fun=Founif.unification) + metasenv context ugraph lift_amount term termty = + let module C = Cic in + let module U = Utils in + let module S = CicSubstitution in + let module M = CicMetaSubst in + let module HL = HelmLibraryObjects in + let cmp = !Utils.compare_terms in + function + | [] -> [] + | candidate::tl -> + let pos, equality = candidate in + let (_,_,(ty,left,right,o),metas,_)=Equality.open_equality equality in + let do_match c = + let subst', metasenv', ugraph' = + unif_fun metasenv metas context term (S.lift lift_amount c) ugraph + in + (C.Rel (1+lift_amount),subst',metasenv',ugraph',candidate) + in + let c, other = + if pos = Utils.Left then left, right + else right, left + in + if o <> U.Incomparable then + try + let res = do_match c in + res::(find_all_matches ~unif_fun metasenv context ugraph + lift_amount term termty tl) + with + | Founif.MatchingFailure + | CicUnification.UnificationFailure _ + | CicUnification.Uncertain _ -> + find_all_matches ~unif_fun metasenv context ugraph + lift_amount term termty tl + else + try + let res = do_match c in + match res with + | _, s, _, _, _ -> + let c' = apply_subst s c + and other' = apply_subst s other in + let order = cmp c' other' in + if order <> U.Lt && order <> U.Le then + res::(find_all_matches ~unif_fun metasenv context ugraph + lift_amount term termty tl) + else + find_all_matches ~unif_fun metasenv context ugraph + lift_amount term termty tl + with + | Founif.MatchingFailure + | CicUnification.UnificationFailure _ + | CicUnification.Uncertain _ -> + find_all_matches ~unif_fun metasenv context ugraph + lift_amount term termty tl +;; + +let find_all_matches + ?unif_fun metasenv context ugraph lift_amount term termty l += + find_all_matches + ?unif_fun metasenv context ugraph lift_amount term termty l + (*prerr_endline "CANDIDATES:"; + List.iter (fun (_,x)->prerr_endline (Founif.string_of_equality x)) l; + prerr_endline ("MATCHING:" ^ CicPp.ppterm term ^ " are " ^ string_of_int + (List.length rc));*) +;; +(* + returns true if target is subsumed by some equality in table +*) +(* +let print_res l = + prerr_endline (String.concat "\n" (List.map (fun (_, subst, menv, ug, + ((pos,equation),_)) -> Equality.string_of_equality equation)l)) +;; +*) + +let subsumption_aux use_unification env table target = + let _, _, (ty, left, right, _), tmetas, _ = Equality.open_equality target in + let _, context, ugraph = env in + let metasenv = tmetas in + let predicate, unif_fun = + if use_unification then + Unification, Founif.unification + else + Matching, Founif.matching + in + let leftr = + match left with + | Cic.Meta _ when not use_unification -> [] + | _ -> + let leftc = get_candidates predicate table left in + find_all_matches ~unif_fun + metasenv context ugraph 0 left ty leftc + in + let rec ok what leftorright = function + | [] -> None + | (_, subst, menv, ug, (pos,equation))::tl -> + let _, _, (_, l, r, o), m,_ = Equality.open_equality equation in + try + let other = if pos = Utils.Left then r else l in + let what' = Subst.apply_subst subst what in + let other' = Subst.apply_subst subst other in + let subst', menv', ug' = + unif_fun metasenv m context what' other' ugraph + in + (match Subst.merge_subst_if_possible subst subst' with + | None -> ok what leftorright tl + | Some s -> Some (s, equation, leftorright <> pos )) + with + | Founif.MatchingFailure + | CicUnification.UnificationFailure _ -> ok what leftorright tl + in + match ok right Utils.Left leftr with + | Some _ as res -> res + | None -> + let rightr = + match right with + | Cic.Meta _ when not use_unification -> [] + | _ -> + let rightc = get_candidates predicate table right in + find_all_matches ~unif_fun + metasenv context ugraph 0 right ty rightc + in + ok left Utils.Right rightr +;; + +let subsumption x y z = + subsumption_aux false x y z +;; + +let unification x y z = + subsumption_aux true x y z +;; + +let subsumption_aux_all use_unification env table target = + let _, _, (ty, left, right, _), tmetas, _ = Equality.open_equality target in + let _, context, ugraph = env in + let metasenv = tmetas in + let predicate, unif_fun = + if use_unification then + Unification, Founif.unification + else + Matching, Founif.matching + in + let leftr = + match left with + | Cic.Meta _ when not use_unification -> [] + | _ -> + let leftc = get_candidates predicate table left in + find_all_matches ~unif_fun + metasenv context ugraph 0 left ty leftc + in + let rightr = + match right with + | Cic.Meta _ when not use_unification -> [] + | _ -> + let rightc = get_candidates predicate table right in + find_all_matches ~unif_fun + metasenv context ugraph 0 right ty rightc + in + let rec ok_all what leftorright = function + | [] -> [] + | (_, subst, menv, ug, (pos,equation))::tl -> + let _, _, (_, l, r, o), m,_ = Equality.open_equality equation in + try + let other = if pos = Utils.Left then r else l in + let what' = Subst.apply_subst subst what in + let other' = Subst.apply_subst subst other in + let subst', menv', ug' = + unif_fun metasenv m context what' other' ugraph + in + (match Subst.merge_subst_if_possible subst subst' with + | None -> ok_all what leftorright tl + | Some s -> + (s, equation, leftorright <> pos )::(ok_all what leftorright tl)) + with + | Founif.MatchingFailure + | CicUnification.UnificationFailure _ -> (ok_all what leftorright tl) + in + (ok_all right Utils.Left leftr)@(ok_all left Utils.Right rightr ) +;; + +let subsumption_all x y z = + subsumption_aux_all false x y z +;; + +let unification_all x y z = + subsumption_aux_all true x y z +;; +let rec demodulation_aux bag ?from ?(typecheck=false) + metasenv context ugraph table lift_amount term = +(* Printf.eprintf "term = %s\n" (CicPp.ppterm term);*) + let module C = Cic in + let module S = CicSubstitution in + let module M = CicMetaSubst in + let module HL = HelmLibraryObjects in + let candidates = + get_candidates + ~env:(metasenv,context,ugraph) (* Unification *) Matching table term + in + let res = + match term with + | C.Meta _ -> None + | term -> + let termty, ugraph = + if typecheck then + CicTypeChecker.type_of_aux' metasenv context term ugraph + else + C.Implicit None, ugraph + in + let res = + find_matches bag metasenv context ugraph lift_amount term termty candidates + in + if Utils.debug_res then ignore(check_res res "demod1"); + if res <> None then + res + else + match term with + | C.Appl l -> + let res, ll = + List.fold_left + (fun (res, tl) t -> + if res <> None then + (res, tl @ [S.lift 1 t]) + else + let r = + demodulation_aux bag ~from:"1" metasenv context ugraph table + lift_amount t + in + match r with + | None -> (None, tl @ [S.lift 1 t]) + | Some (rel, _, _, _, _) -> (r, tl @ [rel])) + (None, []) l + in ( + match res with + | None -> None + | Some (_, subst, menv, ug, eq_found) -> + Some (C.Appl ll, subst, menv, ug, eq_found) + ) + | C.Prod (nn, s, t) -> + let r1 = + demodulation_aux bag ~from:"2" + metasenv context ugraph table lift_amount s in ( + match r1 with + | None -> + let r2 = + demodulation_aux bag metasenv + ((Some (nn, C.Decl s))::context) ugraph + table (lift_amount+1) t + in ( + match r2 with + | None -> None + | Some (t', subst, menv, ug, eq_found) -> + Some (C.Prod (nn, (S.lift 1 s), t'), + subst, menv, ug, eq_found) + ) + | Some (s', subst, menv, ug, eq_found) -> + Some (C.Prod (nn, s', (S.lift 1 t)), + subst, menv, ug, eq_found) + ) + | C.Lambda (nn, s, t) -> + let r1 = + demodulation_aux bag + metasenv context ugraph table lift_amount s in ( + match r1 with + | None -> + let r2 = + demodulation_aux bag metasenv + ((Some (nn, C.Decl s))::context) ugraph + table (lift_amount+1) t + in ( + match r2 with + | None -> None + | Some (t', subst, menv, ug, eq_found) -> + Some (C.Lambda (nn, (S.lift 1 s), t'), + subst, menv, ug, eq_found) + ) + | Some (s', subst, menv, ug, eq_found) -> + Some (C.Lambda (nn, s', (S.lift 1 t)), + subst, menv, ug, eq_found) + ) + | t -> + None + in + if Utils.debug_res then ignore(check_res res "demod_aux output"); + res +;; + +exception Foo + +(** demodulation, when target is an equality *) +let rec demodulation_equality bag ?from eq_uri newmeta env table target = + let module C = Cic in + let module S = CicSubstitution in + let module M = CicMetaSubst in + let module HL = HelmLibraryObjects in + let module U = Utils in + let metasenv, context, ugraph = env in + let w, proof, (eq_ty, left, right, order), metas, id = + Equality.open_equality target + in + (* first, we simplify *) +(* let right = U.guarded_simpl context right in *) +(* let left = U.guarded_simpl context left in *) +(* let order = !Utils.compare_terms left right in *) +(* let stat = (eq_ty, left, right, order) in *) +(* let w = Utils.compute_equality_weight stat in*) + (* let target = Equality.mk_equality (w, proof, stat, metas) in *) + if Utils.debug_metas then + ignore(check_target bag context target "demod equalities input"); + let metasenv' = (* metasenv @ *) metas in + let maxmeta = ref newmeta in + + let build_newtarget is_left (t, subst, menv, ug, eq_found) = + + if Utils.debug_metas then + begin + ignore(check_for_duplicates menv "input1"); + ignore(check_disjoint_invariant subst menv "input2"); + let substs = Subst.ppsubst subst in + ignore(check_target bag context (snd eq_found) ("input3" ^ substs)) + end; + let pos, equality = eq_found in + let (_, proof', + (ty, what, other, _), menv',id') = Equality.open_equality equality in + let ty = + try fst (CicTypeChecker.type_of_aux' metasenv context what ugraph) + with CicUtil.Meta_not_found _ -> ty + in + let ty, eq_ty = apply_subst subst ty, apply_subst subst eq_ty in + let what, other = if pos = Utils.Left then what, other else other, what in + let newterm, newproof = + let bo = + Utils.guarded_simpl context (apply_subst subst (S.subst other t)) in +(* let name = C.Name ("x_Demod" ^ (string_of_int !demod_counter)) in*) + let name = C.Name "x" in + let bo' = + let l, r = if is_left then t, S.lift 1 right else S.lift 1 left, t in + C.Appl [C.MutInd (eq_uri, 0, []); S.lift 1 eq_ty; l; r] + in + (bo, (Equality.Step (subst,(Equality.Demodulation, id,(pos,id'), + (Cic.Lambda (name, ty, bo')))))) + in + let newmenv = menv in + let left, right = if is_left then newterm, right else left, newterm in + let ordering = !Utils.compare_terms left right in + let stat = (eq_ty, left, right, ordering) in + let res = + let w = Utils.compute_equality_weight stat in + (Equality.mk_equality bag (w, newproof, stat,newmenv)) + in + if Utils.debug_metas then + ignore(check_target bag context res "buildnew_target output"); + !maxmeta, res + in + + let res = + demodulation_aux bag ~from:"3" metasenv' context ugraph table 0 left + in + if Utils.debug_res then check_res res "demod result"; + let newmeta, newtarget = + match res with + | Some t -> + let newmeta, newtarget = build_newtarget true t in + (* assert (not (Equality.meta_convertibility_eq target newtarget)); *) + if (Equality.is_weak_identity newtarget) (* || *) + (*Equality.meta_convertibility_eq target newtarget*) then + newmeta, newtarget + else + demodulation_equality bag ?from eq_uri newmeta env table newtarget + | None -> + let res = demodulation_aux bag metasenv' context ugraph table 0 right in + if Utils.debug_res then check_res res "demod result 1"; + match res with + | Some t -> + let newmeta, newtarget = build_newtarget false t in + if (Equality.is_weak_identity newtarget) || + (Equality.meta_convertibility_eq target newtarget) then + newmeta, newtarget + else + demodulation_equality bag ?from eq_uri newmeta env table newtarget + | None -> + newmeta, target + in + (* newmeta, newtarget *) + newmeta,newtarget +;; + +(** + Performs the beta expansion of the term "term" w.r.t. "table", + i.e. returns the list of all the terms t s.t. "(t term) = t2", for some t2 + in table. +*) +let rec betaexpand_term + ?(subterms_only=false) metasenv context ugraph table lift_amount term += + let module C = Cic in + let module S = CicSubstitution in + let module M = CicMetaSubst in + let module HL = HelmLibraryObjects in + + let res, lifted_term = + match term with + | C.Meta (i, l) -> + let l = [] in + let l', lifted_l = + List.fold_right + (fun arg (res, lifted_tl) -> + match arg with + | Some arg -> + let arg_res, lifted_arg = + betaexpand_term metasenv context ugraph table + lift_amount arg in + let l1 = + List.map + (fun (t, s, m, ug, eq_found) -> + (Some t)::lifted_tl, s, m, ug, eq_found) + arg_res + in + (l1 @ + (List.map + (fun (l, s, m, ug, eq_found) -> + (Some lifted_arg)::l, s, m, ug, eq_found) + res), + (Some lifted_arg)::lifted_tl) + | None -> + (List.map + (fun (r, s, m, ug, eq_found) -> + None::r, s, m, ug, eq_found) res, + None::lifted_tl) + ) l ([], []) + in + let e = + List.map + (fun (l, s, m, ug, eq_found) -> + (C.Meta (i, l), s, m, ug, eq_found)) l' + in + e, C.Meta (i, lifted_l) + + | C.Rel m -> + [], if m <= lift_amount then C.Rel m else C.Rel (m+1) + + | C.Prod (nn, s, t) -> + let l1, lifted_s = + betaexpand_term metasenv context ugraph table lift_amount s in + let l2, lifted_t = + betaexpand_term metasenv ((Some (nn, C.Decl s))::context) ugraph + table (lift_amount+1) t in + let l1' = + List.map + (fun (t, s, m, ug, eq_found) -> + C.Prod (nn, t, lifted_t), s, m, ug, eq_found) l1 + and l2' = + List.map + (fun (t, s, m, ug, eq_found) -> + C.Prod (nn, lifted_s, t), s, m, ug, eq_found) l2 in + l1' @ l2', C.Prod (nn, lifted_s, lifted_t) + + | C.Lambda (nn, s, t) -> + let l1, lifted_s = + betaexpand_term metasenv context ugraph table lift_amount s in + let l2, lifted_t = + betaexpand_term metasenv ((Some (nn, C.Decl s))::context) ugraph + table (lift_amount+1) t in + let l1' = + List.map + (fun (t, s, m, ug, eq_found) -> + C.Lambda (nn, t, lifted_t), s, m, ug, eq_found) l1 + and l2' = + List.map + (fun (t, s, m, ug, eq_found) -> + C.Lambda (nn, lifted_s, t), s, m, ug, eq_found) l2 in + l1' @ l2', C.Lambda (nn, lifted_s, lifted_t) + + | C.Appl l -> + let l', lifted_l = + List.fold_left + (fun (res, lifted_tl) arg -> + let arg_res, lifted_arg = + betaexpand_term metasenv context ugraph table lift_amount arg + in + let l1 = + List.map + (fun (a, s, m, ug, eq_found) -> + a::lifted_tl, s, m, ug, eq_found) + arg_res + in + (l1 @ + (List.map + (fun (r, s, m, ug, eq_found) -> + lifted_arg::r, s, m, ug, eq_found) + res), + lifted_arg::lifted_tl) + ) ([], []) (List.rev l) + in + (List.map + (fun (l, s, m, ug, eq_found) -> (C.Appl l, s, m, ug, eq_found)) l', + C.Appl lifted_l) + + | t -> [], (S.lift lift_amount t) + in + match term with + | C.Meta (i, l) -> res, lifted_term + | term -> + let termty, ugraph = + C.Implicit None, ugraph +(* CicTypeChecker.type_of_aux' metasenv context term ugraph *) + in + let candidates = get_candidates Unification table term in + let r = + if subterms_only then + [] + else + find_all_matches + metasenv context ugraph lift_amount term termty candidates + in + r @ res, lifted_term +;; + +(** + superposition_right + returns a list of new clauses inferred with a right superposition step + between the positive equation "target" and one in the "table" "newmeta" is + the first free meta index, i.e. the first number above the highest meta + index: its updated value is also returned +*) +let superposition_right bag + ?(subterms_only=false) eq_uri newmeta (metasenv, context, ugraph) table target= + let module C = Cic in + let module S = CicSubstitution in + let module M = CicMetaSubst in + let module HL = HelmLibraryObjects in + let module CR = CicReduction in + let module U = Utils in + let w, eqproof, (eq_ty, left, right, ordering), newmetas,id = + Equality.open_equality target + in + if Utils.debug_metas then + ignore (check_target bag context target "superpositionright"); + let metasenv' = newmetas in + let maxmeta = ref newmeta in + let res1, res2 = + match ordering with + | U.Gt -> + fst (betaexpand_term ~subterms_only metasenv' context ugraph table 0 left), [] + | U.Lt -> + [], fst (betaexpand_term ~subterms_only metasenv' context ugraph table 0 right) + | _ -> + let res l r = + List.filter + (fun (_, subst, _, _, _) -> + let subst = apply_subst subst in + let o = !Utils.compare_terms (subst l) (subst r) in + o <> U.Lt && o <> U.Le) + (fst (betaexpand_term ~subterms_only metasenv' context ugraph table 0 l)) + in + (res left right), (res right left) + in + let build_new ordering (bo, s, m, ug, eq_found) = + if Utils.debug_metas then + ignore (check_target bag context (snd eq_found) "buildnew1" ); + + let pos, equality = eq_found in + let (_, proof', (ty, what, other, _), menv',id') = + Equality.open_equality equality in + let what, other = if pos = Utils.Left then what, other else other, what in + + let ty, eq_ty = apply_subst s ty, apply_subst s eq_ty in + let newgoal, newproof = + (* qua *) + let bo' = + Utils.guarded_simpl context (apply_subst s (S.subst other bo)) + in + let name = C.Name "x" in + let bo'' = + let l, r = + if ordering = U.Gt then bo, S.lift 1 right else S.lift 1 left, bo in + C.Appl [C.MutInd (eq_uri, 0, []); S.lift 1 eq_ty; l; r] + in + bo', + Equality.Step + (s,(Equality.SuperpositionRight, + id,(pos,id'),(Cic.Lambda(name,ty,bo'')))) + in + let newmeta, newequality = + let left, right = + if ordering = U.Gt then newgoal, apply_subst s right + else apply_subst s left, newgoal in + let neworder = !Utils.compare_terms left right in + let newmenv = (* Founif.filter s *) m in + let stat = (eq_ty, left, right, neworder) in + let eq' = + let w = Utils.compute_equality_weight stat in + Equality.mk_equality bag (w, newproof, stat, newmenv) in + if Utils.debug_metas then + ignore (check_target bag context eq' "buildnew3"); + let newm, eq' = Equality.fix_metas bag !maxmeta eq' in + if Utils.debug_metas then + ignore (check_target bag context eq' "buildnew4"); + newm, eq' + in + maxmeta := newmeta; + if Utils.debug_metas then + ignore(check_target bag context newequality "buildnew2"); + newequality + in + let new1 = List.map (build_new U.Gt) res1 + and new2 = List.map (build_new U.Lt) res2 in + let ok e = not (Equality.is_identity (metasenv', context, ugraph) e) in + (!maxmeta, + (List.filter ok (new1 @ new2))) +;; + +(** demodulation, when the target is a theorem *) +let rec demodulation_theorem bag newmeta env table theorem = + let module C = Cic in + let module S = CicSubstitution in + let module M = CicMetaSubst in + let module HL = HelmLibraryObjects in + let metasenv, context, ugraph = env in + let maxmeta = ref newmeta in + let term, termty, metas = theorem in + let metasenv' = metas in + + let build_newtheorem (t, subst, menv, ug, eq_found) = + let pos, equality = eq_found in + let (_, proof', (ty, what, other, _), menv',id) = + Equality.open_equality equality in + let what, other = if pos = Utils.Left then what, other else other, what in + let newterm, newty = + let bo = Utils.guarded_simpl context (apply_subst subst (S.subst other t)) in +(* let bo' = apply_subst subst t in *) +(* let name = C.Name ("x_DemodThm_" ^ (string_of_int !demod_counter)) in*) +(* + let newproofold = + Equality.ProofBlock (subst, eq_URI, (name, ty), bo', eq_found, + Equality.BasicProof (Equality.empty_subst,term)) + in + (Equality.build_proof_term_old newproofold, bo) +*) + (* TODO, not ported to the new proofs *) + if true then assert false; term, bo + in + !maxmeta, (newterm, newty, menv) + in + let res = + demodulation_aux bag (* ~typecheck:true *) metasenv' context ugraph table 0 termty + in + match res with + | Some t -> + let newmeta, newthm = build_newtheorem t in + let newt, newty, _ = newthm in + if Equality.meta_convertibility termty newty then + newmeta, newthm + else + demodulation_theorem bag newmeta env table newthm + | None -> + newmeta, theorem +;; + +(*****************************************************************************) +(** OPERATIONS ON GOALS **) +(** **) +(** DEMODULATION_GOAL & SUPERPOSITION_LEFT **) +(*****************************************************************************) + +let open_goal g = + match g with + | (proof,menv,Cic.Appl[(Cic.MutInd(uri,0,_)) as eq;ty;l;r]) -> + (* assert (LibraryObjects.is_eq_URI uri); *) + proof,menv,eq,ty,l,r + | _ -> assert false +;; + +let ty_of_goal (_,_,ty) = ty ;; + +(* checks if two goals are metaconvertible *) +let goal_metaconvertibility_eq g1 g2 = + Equality.meta_convertibility (ty_of_goal g1) (ty_of_goal g2) +;; + +(* when the betaexpand_term function is called on the left/right side of the + * goal, the predicate has to be fixed + * C[x] ---> (eq ty unchanged C[x]) + * [posu] is the side of the [unchanged] term in the original goal + *) +let fix_expansion goal posu (t, subst, menv, ug, eq_f) = + let _,_,eq,ty,l,r = open_goal goal in + let unchanged = if posu = Utils.Left then l else r in + let unchanged = CicSubstitution.lift 1 unchanged in + let ty = CicSubstitution.lift 1 ty in + let pred = + match posu with + | Utils.Left -> Cic.Appl [eq;ty;unchanged;t] + | Utils.Right -> Cic.Appl [eq;ty;t;unchanged] + in + (pred, subst, menv, ug, eq_f) +;; + +(* ginve the old [goal], the side that has not changed [posu] and the + * expansion builds a new goal *) +let build_newgoal bag context goal posu rule expansion = + let goalproof,_,_,_,_,_ = open_goal goal in + let (t,subst,menv,ug,eq_found) = fix_expansion goal posu expansion in + let pos, equality = eq_found in + let (_, proof', (ty, what, other, _), menv',id) = + Equality.open_equality equality in + let what, other = if pos = Utils.Left then what, other else other, what in + let newterm, newgoalproof = + let bo = + Utils.guarded_simpl context + (apply_subst subst (CicSubstitution.subst other t)) + in + let bo' = apply_subst subst t in + let ty = apply_subst subst ty in + let name = Cic.Name "x" in + let newgoalproofstep = (rule,pos,id,subst,Cic.Lambda (name,ty,bo')) in + bo, (newgoalproofstep::goalproof) + in + let newmetasenv = (* Founif.filter subst *) menv in + (newgoalproof, newmetasenv, newterm) +;; + +(** + superposition_left + returns a list of new clauses inferred with a left superposition step + the negative equation "target" and one of the positive equations in "table" +*) +let superposition_left bag (metasenv, context, ugraph) table goal maxmeta = + let names = Utils.names_of_context context in + let proof,menv,eq,ty,l,r = open_goal goal in + let c = !Utils.compare_terms l r in + let newgoals = + if c = Utils.Incomparable then + begin + let expansionsl, _ = betaexpand_term menv context ugraph table 0 l in + let expansionsr, _ = betaexpand_term menv context ugraph table 0 r in + (* prerr_endline "incomparable"; + prerr_endline (string_of_int (List.length expansionsl)); + prerr_endline (string_of_int (List.length expansionsr)); + *) + List.map (build_newgoal bag context goal Utils.Right Equality.SuperpositionLeft) expansionsl + @ + List.map (build_newgoal bag context goal Utils.Left Equality.SuperpositionLeft) expansionsr + end + else + match c with + | Utils.Gt -> (* prerr_endline "GT"; *) + let big,small,possmall = l,r,Utils.Right in + let expansions, _ = betaexpand_term menv context ugraph table 0 big in + List.map + (build_newgoal bag context goal possmall Equality.SuperpositionLeft) + expansions + | Utils.Lt -> (* prerr_endline "LT"; *) + let big,small,possmall = r,l,Utils.Left in + let expansions, _ = betaexpand_term menv context ugraph table 0 big in + List.map + (build_newgoal bag context goal possmall Equality.SuperpositionLeft) + expansions + | Utils.Eq -> [] + | _ -> + prerr_endline + ("NOT GT, LT NOR EQ : "^CicPp.pp l names^" - "^CicPp.pp r names); + assert false + in + (* rinfresco le meta *) + List.fold_right + (fun g (max,acc) -> + let max,g = Equality.fix_metas_goal max g in max,g::acc) + newgoals (maxmeta,[]) +;; + +(** demodulation, when the target is a goal *) +let rec demodulation_goal bag env table goal = + let goalproof,menv,_,_,left,right = open_goal goal in + let _, context, ugraph = env in +(* let term = Utils.guarded_simpl (~debug:true) context term in*) + let do_right () = + let resright = demodulation_aux bag menv context ugraph table 0 right in + match resright with + | Some t -> + let newg = + build_newgoal bag context goal Utils.Left Equality.Demodulation t + in + if goal_metaconvertibility_eq goal newg then + false, goal + else + true, snd (demodulation_goal bag env table newg) + | None -> false, goal + in + let resleft = demodulation_aux bag menv context ugraph table 0 left in + match resleft with + | Some t -> + let newg = build_newgoal bag context goal Utils.Right Equality.Demodulation t in + if goal_metaconvertibility_eq goal newg then + do_right () + else + true, snd (demodulation_goal bag env table newg) + | None -> do_right () +;; + +type next = L | R +type solved = Yes of Equality.goal | No of Equality.goal list + +(* returns all the 1 step demodulations *) +module C = Cic;; +module S = CicSubstitution;; +let rec demodulation_all_aux + metasenv context ugraph table lift_amount term += + let candidates = + get_candidates ~env:(metasenv,context,ugraph) Matching table term + in + match term with + | C.Meta _ -> [] + | _ -> + let termty, ugraph = C.Implicit None, ugraph in + let res = + find_all_matches + metasenv context ugraph lift_amount term termty candidates + in + match term with + | C.Appl l -> + let res, _, _ = + List.fold_left + (fun (res,l,r) t -> + res @ + List.map + (fun (rel, s, m, ug, c) -> + (Cic.Appl (l@[rel]@List.tl r), s, m, ug, c)) + (demodulation_all_aux + metasenv context ugraph table lift_amount t), + l@[List.hd r], List.tl r) + (res, [], List.map (S.lift 1) l) l + in + res + | C.Prod (nn, s, t) + | C.Lambda (nn, s, t) -> + let context = (Some (nn, C.Decl s))::context in + let mk s t = + match term with + | Cic.Prod _ -> Cic.Prod (nn,s,t) | _ -> Cic.Lambda (nn,s,t) + in + res @ + List.map + (fun (rel, subst, m, ug, c) -> + mk (S.lift 1 s) rel, subst, m, ug, c) + (demodulation_all_aux + metasenv context ugraph table (lift_amount+1) t) + (* we could demodulate also in s, but then t may be badly + * typed... *) + | t -> res +;; + +let solve_demodulating bag env table initgoal steps = + let _, context, ugraph = env in + let solved goal res side = + let newg = build_newgoal bag context goal side Equality.Demodulation res in + match newg with + | (goalproof,m,Cic.Appl[Cic.MutInd(uri,n,ens);eq_ty;left;right]) + when LibraryObjects.is_eq_URI uri -> + (try + let _ = + Founif.unification m m context left right CicUniv.empty_ugraph + in + Yes newg + with CicUnification.UnificationFailure _ -> No [newg]) + | _ -> No [newg] + in + let solved goal res_list side = + let newg = List.map (fun x -> solved goal x side) res_list in + try + List.find (function Yes _ -> true | _ -> false) newg + with Not_found -> + No (List.flatten (List.map (function No s -> s | _-> assert false) newg)) + in + let rec first f l = + match l with + | [] -> None + | x::tl -> + match f x with + | None -> first f tl + | Some x as ok -> ok + in + let rec aux steps next goal = + if steps = 0 then None else + let goalproof,menv,_,_,left,right = open_goal goal in + let do_step t = + demodulation_all_aux menv context ugraph table 0 t + in + match next with + | L -> + (match do_step left with + | _::_ as res -> + (match solved goal res Utils.Right with + | No newgoals -> + (match first (aux (steps - 1) L) newgoals with + | Some g as success -> success + | None -> aux steps R goal) + | Yes newgoal -> Some newgoal) + | [] -> aux steps R goal) + | R -> + (match do_step right with + | _::_ as res -> + (match solved goal res Utils.Left with + | No newgoals -> + (match first (aux (steps - 1) L) newgoals with + | Some g as success -> success + | None -> None) + | Yes newgoal -> Some newgoal) + | [] -> None) + in + aux steps L initgoal +;; + +let get_stats () = "" ;; diff --git a/components/tactics/paramodulation/indexing.mli b/components/tactics/paramodulation/indexing.mli new file mode 100644 index 000000000..7f464d248 --- /dev/null +++ b/components/tactics/paramodulation/indexing.mli @@ -0,0 +1,112 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +module Index : + sig + module PosEqSet : Set.S + with type elt = Utils.pos * Equality.equality + and type t = Equality_indexing.DT.PosEqSet.t + type t = Discrimination_tree.DiscriminationTreeIndexing(PosEqSet).t + end + +val index : Index.t -> Equality.equality -> Index.t +val remove_index : Index.t -> Equality.equality -> Index.t +val in_index : Index.t -> Equality.equality -> bool +val empty : Index.t +val init_index : unit -> unit +val unification : + Cic.metasenv * Cic.context * CicUniv.universe_graph -> + Index.t -> + Equality.equality -> + (Subst.substitution * Equality.equality * bool) option +val subsumption : + Cic.metasenv * Cic.context * CicUniv.universe_graph -> + Index.t -> + Equality.equality -> + (Subst.substitution * Equality.equality * bool) option +val unification_all : + Cic.metasenv * Cic.context * CicUniv.universe_graph -> + Index.t -> + Equality.equality -> + (Subst.substitution * Equality.equality * bool) list +val subsumption_all : + Cic.metasenv * Cic.context * CicUniv.universe_graph -> + Index.t -> + Equality.equality -> + (Subst.substitution * Equality.equality * bool) list +val superposition_left : + Equality.equality_bag -> + Cic.conjecture list * Cic.context * CicUniv.universe_graph -> + Index.t -> Equality.goal -> int -> + int * Equality.goal list + +val superposition_right : + Equality.equality_bag -> + ?subterms_only:bool -> + UriManager.uri -> + int -> + 'a * Cic.context * CicUniv.universe_graph -> + Index.t -> + Equality.equality -> + int * Equality.equality list + +val demodulation_equality : + Equality.equality_bag -> + ?from:string -> + UriManager.uri -> + int -> + Cic.metasenv * Cic.context * CicUniv.universe_graph -> + Index.t -> + Equality.equality -> int * Equality.equality +val demodulation_goal : + Equality.equality_bag -> + Cic.metasenv * Cic.context * CicUniv.universe_graph -> + Index.t -> + Equality.goal -> + bool * Equality.goal +val demodulation_theorem : + Equality.equality_bag -> + 'a -> + Cic.metasenv * Cic.context * CicUniv.universe_graph -> + Index.t -> + Cic.term * Cic.term * Cic.metasenv -> + 'a * (Cic.term * Cic.term * Cic.metasenv) +val check_target: + Equality.equality_bag -> + Cic.context -> + Equality.equality -> string -> unit +val solve_demodulating: + Equality.equality_bag -> + Cic.metasenv * Cic.context * CicUniv.universe_graph -> + Index.t -> + Equality.goal -> + int -> + Equality.goal option + + + (** profiling *) +val get_stats: unit -> string diff --git a/components/tactics/paramodulation/saturation.ml b/components/tactics/paramodulation/saturation.ml new file mode 100644 index 000000000..9739f1ccf --- /dev/null +++ b/components/tactics/paramodulation/saturation.ml @@ -0,0 +1,1665 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* let _profiler = <:profiler<_profiler>>;; *) + +(* $Id$ *) + +(* set to false to disable paramodulation inside auto_tac *) + +let connect_to_auto = true;; + +let debug_print = Utils.debug_print;; + +(* profiling statistics... *) +let infer_time = ref 0.;; +let forward_simpl_time = ref 0.;; +let forward_simpl_new_time = ref 0.;; +let backward_simpl_time = ref 0.;; +let passive_maintainance_time = ref 0.;; + +(* limited-resource-strategy related globals *) +let processed_clauses = ref 0;; (* number of equalities selected so far... *) +let time_limit = ref 0.;; (* in seconds, settable by the user... *) +let start_time = ref 0.;; (* time at which the execution started *) +let elapsed_time = ref 0.;; +(* let maximal_weight = ref None;; *) +let maximal_retained_equality = ref None;; + +(* equality-selection related globals *) +let use_fullred = ref true;; +let weight_age_ratio = ref 6 (* 5 *);; (* settable by the user *) +let weight_age_counter = ref !weight_age_ratio ;; +let symbols_ratio = ref 0 (* 3 *);; +let symbols_counter = ref 0;; + +(* non-recursive Knuth-Bendix term ordering by default *) +(* Utils.compare_terms := Utils.rpo;; *) +(* Utils.compare_terms := Utils.nonrec_kbo;; *) +(* Utils.compare_terms := Utils.ao;; *) + +(* statistics... *) +let derived_clauses = ref 0;; +let kept_clauses = ref 0;; + +(* index of the greatest Cic.Meta created - TODO: find a better way! *) +let maxmeta = ref 0;; + +(* varbiables controlling the search-space *) +let maxdepth = ref 3;; +let maxwidth = ref 3;; + +type theorem = Cic.term * Cic.term * Cic.metasenv;; + +let symbols_of_equality equality = + let (_, _, (_, left, right, _), _,_) = Equality.open_equality equality in + let m1 = Utils.symbols_of_term left in + let m = + Utils.TermMap.fold + (fun k v res -> + try + let c = Utils.TermMap.find k res in + Utils.TermMap.add k (c+v) res + with Not_found -> + Utils.TermMap.add k v res) + (Utils.symbols_of_term right) m1 + in + m +;; + +(* griggio *) +module OrderedEquality = struct + type t = Equality.equality + + let compare eq1 eq2 = + match Equality.meta_convertibility_eq eq1 eq2 with + | true -> 0 + | false -> + let w1, _, (ty,left, right, _), m1,_ = Equality.open_equality eq1 in + let w2, _, (ty',left', right', _), m2,_ = Equality.open_equality eq2 in + match Pervasives.compare w1 w2 with + | 0 -> + let res = (List.length m1) - (List.length m2) in + if res <> 0 then res else + Equality.compare eq1 eq2 + | res -> res +end + +module EqualitySet = Set.Make(OrderedEquality);; + +type passive_table = Equality.equality list * EqualitySet.t +type active_table = Equality.equality list * Indexing.Index.t +type new_proof = + Equality.goal_proof * Equality.proof * int * Subst.substitution * Cic.metasenv +type result = + | ParamodulationFailure of string * active_table * passive_table + | ParamodulationSuccess of new_proof * active_table * passive_table +;; + +let list_of_passive (l,s) = l +;; + +let make_passive eq_list = + let set = + List.fold_left (fun s e -> EqualitySet.add e s) EqualitySet.empty eq_list + in + (*EqualitySet.elements set*) eq_list, set (* see applys.ma *) +;; +let make_empty_active () = [], Indexing.empty ;; +let make_active eq_list = + eq_list, List.fold_left Indexing.index Indexing.empty eq_list +;; + +let size_of_passive (passive_list, _) = List.length passive_list;; +let size_of_active (active_list, _) = List.length active_list;; +let passive_is_empty = function + | [], s when EqualitySet.is_empty s -> true + | [], s -> assert false (* the set and the list should be in sync *) + | _ -> false +;; + +type goals = Equality.goal list * Equality.goal list + +let no_more_passive_goals g = match g with | _,[] -> true | _ -> false;; + + +let age_factor = 0.01;; + +(** + selects one equality from passive. The selection strategy is a combination + of weight, age and goal-similarity +*) + +let rec select env g passive = + processed_clauses := !processed_clauses + 1; +(* + let goal = + match (List.rev goals) with goal::_ -> goal | _ -> assert false + in +*) + let pos_list, pos_set = passive in + let remove eq l = List.filter (fun e -> Equality.compare e eq <> 0) l in + if !weight_age_ratio > 0 then + weight_age_counter := !weight_age_counter - 1; + match !weight_age_counter with + | 0 -> ( + weight_age_counter := !weight_age_ratio; + let skip_giant pos_list pos_set = + match pos_list with + | (hd:EqualitySet.elt)::tl -> + let w,_,_,_,_ = Equality.open_equality hd in + if w < 30 then + hd, (tl, EqualitySet.remove hd pos_set) + else +(* + (prerr_endline + ("+++ skipping giant of size "^string_of_int w^" +++"); +*) + select env g (tl@[hd],pos_set) + | _ -> assert false + in + skip_giant pos_list pos_set) + +(* + let rec skip_giant pos_list pos_set = + match pos_list with + | (hd:EqualitySet.elt)::tl -> + let w,_,_,_,_ = Equality.open_equality hd in + let pos_set = EqualitySet.remove hd pos_set in + if w < 30 then + hd, (tl, pos_set) + else + (prerr_endline + ("+++ skipping giant of size "^string_of_int w^" +++"); + skip_giant tl pos_set) + | _ -> assert false + in + skip_giant pos_list pos_set) + +*) +(* + | _ when (!symbols_counter > 0) -> + (symbols_counter := !symbols_counter - 1; + let cardinality map = + Utils.TermMap.fold (fun k v res -> res + v) map 0 + in + let symbols = + let _, _, term = goal in + Utils.symbols_of_term term + in + let card = cardinality symbols in + let foldfun k v (r1, r2) = + if Utils.TermMap.mem k symbols then + let c = Utils.TermMap.find k symbols in + let c1 = abs (c - v) in + let c2 = v - c1 in + r1 + c2, r2 + c1 + else + r1, r2 + v + in + let f equality (i, e) = + let common, others = + Utils.TermMap.fold foldfun (symbols_of_equality equality) (0, 0) + in + let c = others + (abs (common - card)) in + if c < i then (c, equality) + else (i, e) + in + let e1 = EqualitySet.min_elt pos_set in + let initial = + let common, others = + Utils.TermMap.fold foldfun (symbols_of_equality e1) (0, 0) + in + (others + (abs (common - card))), e1 + in + let _, current = EqualitySet.fold f pos_set initial in + current, + (remove current pos_list, EqualitySet.remove current pos_set)) +*) + | _ -> + symbols_counter := !symbols_ratio; + let my_min e1 e2 = + let w1,_,_,_,_ = Equality.open_equality e1 in + let w2,_,_,_,_ = Equality.open_equality e2 in + if w1 < w2 then e1 else e2 + in + let rec my_min_elt min = function + | [] -> min + | hd::tl -> my_min_elt (my_min hd min) tl + in +(* let current = EqualitySet.min_elt pos_set in *) + let current = my_min_elt (List.hd pos_list) (List.tl pos_list) in + current,(remove current pos_list, EqualitySet.remove current pos_set) +;; + + +let filter_dependent bag passive id = + let pos_list, pos_set = passive in + let passive,no_pruned = + List.fold_right + (fun eq ((list,set),no) -> + if Equality.depend bag eq id then + (list, EqualitySet.remove eq set), no + 1 + else + (eq::list, set), no) + pos_list (([],pos_set),0) + in +(* + if no_pruned > 0 then + prerr_endline ("+++ pruning "^ string_of_int no_pruned ^" passives +++"); +*) + passive +;; + + +(* adds to passive a list of equalities new_pos *) +let add_to_passive passive new_pos preferred = + let pos_list, pos_set = passive in + let ok set equality = not (EqualitySet.mem equality set) in + let pos = List.filter (ok pos_set) new_pos in + let add set equalities = + List.fold_left (fun s e -> EqualitySet.add e s) set equalities + in + let pos_head, pos_tail = + List.partition + (fun e -> List.exists (fun x -> Equality.compare x e = 0) preferred) + pos + in + pos_head @ pos_list @ pos_tail, add pos_set pos +;; + +(* TODO *) +(* removes from passive equalities that are estimated impossible to activate + within the current time limit *) +let prune_passive howmany (active, _) passive = + let (pl, ps), tbl = passive in + let howmany = float_of_int howmany + and ratio = float_of_int !weight_age_ratio in + let round v = + let t = ceil v in + int_of_float (if t -. v < 0.5 then t else v) + in + let in_weight = round (howmany *. ratio /. (ratio +. 1.)) + and in_age = round (howmany /. (ratio +. 1.)) in + Utils.debug_print + (lazy (Printf.sprintf "in_weight: %d, in_age: %d\n" in_weight in_age)); + let counter = ref !symbols_ratio in + let rec pickw w ps = + if w > 0 then + if !counter > 0 then + let _ = + counter := !counter - 1; + if !counter = 0 then counter := !symbols_ratio in + let e = EqualitySet.min_elt ps in + let ps' = pickw (w-1) (EqualitySet.remove e ps) in + EqualitySet.add e ps' + else + let e = EqualitySet.min_elt ps in + let ps' = pickw (w-1) (EqualitySet.remove e ps) in + EqualitySet.add e ps' + else + EqualitySet.empty + in + let ps = pickw in_weight ps in + let rec picka w s l = + if w > 0 then + match l with + | [] -> w, s, [] + | hd::tl when not (EqualitySet.mem hd s) -> + let w, s, l = picka (w-1) s tl in + w, EqualitySet.add hd s, hd::l + | hd::tl -> + let w, s, l = picka w s tl in + w, s, hd::l + else + 0, s, l + in + let _, ps, pl = picka in_age ps pl in + if not (EqualitySet.is_empty ps) then + maximal_retained_equality := Some (EqualitySet.max_elt ps); + let tbl = + EqualitySet.fold + (fun e tbl -> Indexing.index tbl e) ps Indexing.empty + in + (pl, ps), tbl +;; + + +(** inference of new equalities between current and some in active *) +let infer bag eq_uri env current (active_list, active_table) = + let (_,c,_) = env in + if Utils.debug_metas then + (ignore(Indexing.check_target bag c current "infer1"); + ignore(List.map (function current -> Indexing.check_target bag c current "infer2") active_list)); + let new_pos = + let maxm, copy_of_current = Equality.fix_metas bag !maxmeta current in + maxmeta := maxm; + let active_table = Indexing.index active_table copy_of_current in +(* let _ = <:start> in *) + let maxm, res = + Indexing.superposition_right bag eq_uri !maxmeta env active_table current + in +(* let _ = <:stop> in *) + if Utils.debug_metas then + ignore(List.map + (function current -> + Indexing.check_target bag c current "sup0") res); + maxmeta := maxm; + let rec infer_positive table = function + | [] -> [] + | equality::tl -> + let maxm, res = + Indexing.superposition_right bag + ~subterms_only:true eq_uri !maxmeta env table equality + in + maxmeta := maxm; + if Utils.debug_metas then + ignore + (List.map + (function current -> + Indexing.check_target bag c current "sup2") res); + let pos = infer_positive table tl in + res @ pos + in +(* + let maxm, copy_of_current = Equality.fix_metas !maxmeta current in + maxmeta := maxm; +*) + let curr_table = Indexing.index Indexing.empty current in +(* let _ = <:start> in *) + let pos = infer_positive curr_table ((*copy_of_current::*)active_list) in +(* let _ = <:stop> in *) + if Utils.debug_metas then + ignore(List.map + (function current -> + Indexing.check_target bag c current "sup3") pos); + res @ pos + in + derived_clauses := !derived_clauses + (List.length new_pos); + match !maximal_retained_equality with + | None -> new_pos + | Some eq -> + ignore(assert false); + (* if we have a maximal_retained_equality, we can discard all equalities + "greater" than it, as they will never be reached... An equality is + greater than maximal_retained_equality if it is bigger + wrt. OrderedEquality.compare and it is less similar than + maximal_retained_equality to the current goal *) + List.filter (fun e -> OrderedEquality.compare e eq <= 0) new_pos +;; + +let check_for_deep_subsumption env active_table eq = + let _,_,(eq_ty, left, right, order),metas,id = Equality.open_equality eq in + let check_subsumed deep l r = + let eqtmp = + Equality.mk_tmp_equality(0,(eq_ty,l,r,Utils.Incomparable),metas)in + match Indexing.subsumption env active_table eqtmp with + | None -> false + | Some _ -> true + in + let rec aux b (ok_so_far, subsumption_used) t1 t2 = + match t1,t2 with + | t1, t2 when not ok_so_far -> ok_so_far, subsumption_used + | t1, t2 when subsumption_used -> t1 = t2, subsumption_used + | Cic.Appl (h1::l),Cic.Appl (h2::l') -> + let rc = check_subsumed b t1 t2 in + if rc then + true, true + else if h1 = h2 then + (try + List.fold_left2 + (fun (ok_so_far, subsumption_used) t t' -> + aux true (ok_so_far, subsumption_used) t t') + (ok_so_far, subsumption_used) l l' + with Invalid_argument _ -> false,subsumption_used) + else + false, subsumption_used + | _ -> false, subsumption_used + in + fst (aux false (true,false) left right) +;; + +(** simplifies current using active and passive *) +let forward_simplify bag eq_uri env current (active_list, active_table) = + let _, context, _ = env in + let demodulate table current = + let newmeta, newcurrent = + Indexing.demodulation_equality bag eq_uri !maxmeta env table current + in + maxmeta := newmeta; + if Equality.is_identity env newcurrent then None else Some newcurrent + in + let demod current = + if Utils.debug_metas then + ignore (Indexing.check_target bag context current "demod0"); + let res = demodulate active_table current in + if Utils.debug_metas then + ignore ((function None -> () | Some x -> + ignore (Indexing.check_target bag context x "demod1");()) res); + res + in + let res = demod current in + match res with + | None -> None + | Some c -> + if Indexing.in_index active_table c || + check_for_deep_subsumption env active_table c + then + None + else + res +;; + +(** simplifies new using active and passive *) +let forward_simplify_new bag eq_uri env new_pos active = + if Utils.debug_metas then + begin + let m,c,u = env in + ignore(List.map + (fun current -> Indexing.check_target bag c current "forward new pos") + new_pos;) + end; + let active_list, active_table = active in + let demodulate table target = + let newmeta, newtarget = + Indexing.demodulation_equality bag eq_uri !maxmeta env table target + in + maxmeta := newmeta; + newtarget + in + (* we could also demodulate using passive. Currently we don't *) + let new_pos = List.map (demodulate active_table) new_pos in + let new_pos_set = + List.fold_left + (fun s e -> + if not (Equality.is_identity env e) then + EqualitySet.add e s + else s) + EqualitySet.empty new_pos + in + let new_pos = EqualitySet.elements new_pos_set in + + let subs e = Indexing.subsumption env active_table e = None in + let is_duplicate e = not (Indexing.in_index active_table e) in + List.filter subs (List.filter is_duplicate new_pos) +;; + + +(** simplifies a goal with equalities in active and passive *) +let rec simplify_goal bag env goal (active_list, active_table) = + let demodulate table goal = Indexing.demodulation_goal bag env table goal in + let changed, goal = demodulate active_table goal in + changed, + if not changed then + goal + else + snd (simplify_goal bag env goal (active_list, active_table)) +;; + + +let simplify_goals bag env goals active = + let a_goals, p_goals = goals in + let p_goals = List.map (fun g -> snd (simplify_goal bag env g active)) p_goals in + let a_goals = List.map (fun g -> snd (simplify_goal bag env g active)) a_goals in + a_goals, p_goals +;; + + +(** simplifies active usign new *) +let backward_simplify_active + bag eq_uri env new_pos new_table min_weight active += + let active_list, active_table = active in + let active_list, newa, pruned = + List.fold_right + (fun equality (res, newn,pruned) -> + let ew, _, _, _,id = Equality.open_equality equality in + if ew < min_weight then + equality::res, newn,pruned + else + match + forward_simplify bag eq_uri env equality (new_pos, new_table) + with + | None -> res, newn, id::pruned + | Some e -> + if Equality.compare equality e = 0 then + e::res, newn, pruned + else + res, e::newn, pruned) + active_list ([], [],[]) + in + let find eq1 where = + List.exists (Equality.meta_convertibility_eq eq1) where + in + let id_of_eq eq = + let _, _, _, _,id = Equality.open_equality eq in id + in + let ((active1,pruned),tbl), newa = + List.fold_right + (fun eq ((res,pruned), tbl) -> + if List.mem eq res then + (res, (id_of_eq eq)::pruned),tbl + else if (Equality.is_identity env eq) || (find eq res) then ( + (res, (id_of_eq eq)::pruned),tbl + ) + else + (eq::res,pruned), Indexing.index tbl eq) + active_list (([],pruned), Indexing.empty), + List.fold_right + (fun eq p -> + if (Equality.is_identity env eq) then p + else eq::p) + newa [] + in + match newa with + | [] -> (active1,tbl), None, pruned + | _ -> (active1,tbl), Some newa, pruned +;; + + +(** simplifies passive using new *) +let backward_simplify_passive + bag eq_uri env new_pos new_table min_weight passive += + let (pl, ps), passive_table = passive in + let f equality (resl, ress, newn) = + let ew, _, _, _ , _ = Equality.open_equality equality in + if ew < min_weight then + equality::resl, ress, newn + else + match + forward_simplify bag eq_uri env equality (new_pos, new_table) + with + | None -> resl, EqualitySet.remove equality ress, newn + | Some e -> + if equality = e then + equality::resl, ress, newn + else + let ress = EqualitySet.remove equality ress in + resl, ress, e::newn + in + let pl, ps, newp = List.fold_right f pl ([], ps, []) in + let passive_table = + List.fold_left + (fun tbl e -> Indexing.index tbl e) Indexing.empty pl + in + match newp with + | [] -> ((pl, ps), passive_table), None + | _ -> ((pl, ps), passive_table), Some (newp) +;; + +let build_table equations = + List.fold_left + (fun (l, t, w) e -> + let ew, _, _, _ , _ = Equality.open_equality e in + e::l, Indexing.index t e, min ew w) + ([], Indexing.empty, 1000000) equations +;; + + +let backward_simplify bag eq_uri env new' active = + let new_pos, new_table, min_weight = build_table new' in + let active, newa, pruned = + backward_simplify_active bag eq_uri env new_pos new_table min_weight active + in + active, newa, pruned +;; + +let close bag eq_uri env new' given = + let new_pos, new_table, min_weight = + List.fold_left + (fun (l, t, w) e -> + let ew, _, _, _ , _ = Equality.open_equality e in + e::l, Indexing.index t e, min ew w) + ([], Indexing.empty, 1000000) (snd new') + in + List.fold_left + (fun p c -> + let pos = infer bag eq_uri env c (new_pos,new_table) in + pos@p) + [] given +;; + +let is_commutative_law eq = + let w, proof, (eq_ty, left, right, order), metas , _ = + Equality.open_equality eq + in + match left,right with + Cic.Appl[f1;Cic.Meta _ as a1;Cic.Meta _ as b1], + Cic.Appl[f2;Cic.Meta _ as a2;Cic.Meta _ as b2] -> + f1 = f2 && a1 = b2 && a2 = b1 + | _ -> false +;; + +let prova bag eq_uri env new' active = + let given = List.filter is_commutative_law (fst active) in + let _ = + Utils.debug_print + (lazy + (Printf.sprintf "symmetric:\n%s\n" + (String.concat "\n" + (List.map + (fun e -> Equality.string_of_equality ~env e) + given)))) in + close bag eq_uri env new' given +;; + +(* returns an estimation of how many equalities in passive can be activated + within the current time limit *) +let get_selection_estimate () = + elapsed_time := (Unix.gettimeofday ()) -. !start_time; + (* !processed_clauses * (int_of_float (!time_limit /. !elapsed_time)) *) + int_of_float ( + ceil ((float_of_int !processed_clauses) *. + ((!time_limit (* *. 2. *)) /. !elapsed_time -. 1.))) +;; + + +(** initializes the set of goals *) +let make_goals goal = + let active = [] + and passive = [0, [goal]] in + active, passive +;; + +let make_goal_set goal = + ([],[goal]) +;; + +(** initializes the set of theorems *) +let make_theorems theorems = + theorems, [] +;; + + +let activate_goal (active, passive) = + if active = [] then + match passive with + | goal_conj::tl -> true, (goal_conj::active, tl) + | [] -> false, (active, passive) + else + true, (active,passive) +;; + + +let activate_theorem (active, passive) = + match passive with + | theorem::tl -> true, (theorem::active, tl) + | [] -> false, (active, passive) +;; + + + +let simplify_theorems bag env theorems ?passive (active_list, active_table) = + let pl, passive_table = + match passive with + | None -> [], None + | Some ((pn, _), (pp, _), pt) -> pn @ pp, Some pt + in + let a_theorems, p_theorems = theorems in + let demodulate table theorem = + let newmeta, newthm = + Indexing.demodulation_theorem bag !maxmeta env table theorem in + maxmeta := newmeta; + theorem != newthm, newthm + in + let foldfun table (a, p) theorem = + let changed, theorem = demodulate table theorem in + if changed then (a, theorem::p) else (theorem::a, p) + in + let mapfun table theorem = snd (demodulate table theorem) in + match passive_table with + | None -> + let p_theorems = List.map (mapfun active_table) p_theorems in + List.fold_left (foldfun active_table) ([], p_theorems) a_theorems + | Some passive_table -> + let p_theorems = List.map (mapfun active_table) p_theorems in + let p_theorems, a_theorems = + List.fold_left (foldfun active_table) ([], p_theorems) a_theorems in + let p_theorems = List.map (mapfun passive_table) p_theorems in + List.fold_left (foldfun passive_table) ([], p_theorems) a_theorems +;; + + +let rec simpl bag eq_uri env e others others_simpl = + let active = others @ others_simpl in + let tbl = + List.fold_left + (fun t e -> + if Equality.is_identity env e then t else Indexing.index t e) + Indexing.empty active + in + let res = + forward_simplify bag eq_uri env e (active, tbl) + in + match others with + | hd::tl -> ( + match res with + | None -> simpl bag eq_uri env hd tl others_simpl + | Some e -> simpl bag eq_uri env hd tl (e::others_simpl) + ) + | [] -> ( + match res with + | None -> others_simpl + | Some e -> e::others_simpl + ) +;; + +let simplify_equalities bag eq_uri env equalities = + Utils.debug_print + (lazy + (Printf.sprintf "equalities:\n%s\n" + (String.concat "\n" + (List.map Equality.string_of_equality equalities)))); + Utils.debug_print (lazy "SIMPLYFYING EQUALITIES..."); + match equalities with + | [] -> [] + | hd::tl -> + let res = + List.rev (simpl bag eq_uri env hd tl []) + in + Utils.debug_print + (lazy + (Printf.sprintf "equalities AFTER:\n%s\n" + (String.concat "\n" + (List.map Equality.string_of_equality res)))); + res +;; + +let print_goals goals = + (String.concat "\n" + (List.map + (fun (d, gl) -> + let gl' = + List.map + (fun (p, _, t) -> + (* (string_of_proof p) ^ ", " ^ *) (CicPp.ppterm t)) gl + in + Printf.sprintf "%d: %s" d (String.concat "; " gl')) goals)) +;; + +let pp_goal_set msg goals names = + let active_goals, passive_goals = goals in + debug_print (lazy ("////" ^ msg)); + debug_print (lazy ("ACTIVE G: " ^ + (String.concat "\n " (List.map (fun (_,_,g) -> CicPp.pp g names) + active_goals)))); + debug_print (lazy ("PASSIVE G: " ^ + (String.concat "\n " (List.map (fun (_,_,g) -> CicPp.pp g names) + passive_goals)))) +;; + +let check_if_goal_is_subsumed bag ((_,ctx,_) as env) table (goalproof,menv,ty) = +(* let names = Utils.names_of_context ctx in *) + match ty with + | Cic.Appl[Cic.MutInd(uri,_,_);eq_ty;left;right] + when LibraryObjects.is_eq_URI uri -> + (let goal_equation = + Equality.mk_equality bag + (0,Equality.Exact (Cic.Implicit None),(eq_ty,left,right,Utils.Eq),menv) + in +(* match Indexing.subsumption env table goal_equation with*) + match Indexing.unification env table goal_equation with + | Some (subst, equality, swapped ) -> +(* + prerr_endline + ("GOAL SUBSUMED IS: "^Equality.string_of_equality goal_equation ~env); + prerr_endline + ("GOAL IS SUBSUMED BY: "^Equality.string_of_equality equality ~env); + prerr_endline ("SUBST:"^Subst.ppsubst ~names subst); +*) + let (_,p,(ty,l,r,_),m,id) = Equality.open_equality equality in + let cicmenv = Subst.apply_subst_metasenv subst (m @ menv) in + let p = + if swapped then + Equality.symmetric bag eq_ty l id uri m + else + p + in + Some (goalproof, p, id, subst, cicmenv) + | None -> None) + | _ -> None +;; + +let find_all_subsumed bag env table (goalproof,menv,ty) = + match ty with + | Cic.Appl[Cic.MutInd(uri,_,_);eq_ty;left;right] + when LibraryObjects.is_eq_URI uri -> + let goal_equation = + Equality.mk_equality bag + (0,Equality.Exact (Cic.Implicit None),(eq_ty,left,right,Utils.Eq),menv) + in + List.map + (fun (subst, equality, swapped ) -> + let (_,p,(ty,l,r,_),m,id) = Equality.open_equality equality in + let cicmenv = Subst.apply_subst_metasenv subst (m @ menv) in + let p = + if swapped then + Equality.symmetric bag eq_ty l id uri m + else + p + in (goalproof, p, id, subst, cicmenv)) + (Indexing.unification_all env table goal_equation) + | _ -> assert false +;; + + +let check_if_goal_is_identity env = function + | (goalproof,m,Cic.Appl[Cic.MutInd(uri,_,ens);eq_ty;left;right]) + when left = right && LibraryObjects.is_eq_URI uri -> + let reflproof = Equality.Exact (Equality.refl_proof uri eq_ty left) in + Some (goalproof, reflproof, 0, Subst.empty_subst,m) + | (goalproof,m,Cic.Appl[Cic.MutInd(uri,_,ens);eq_ty;left;right]) + when LibraryObjects.is_eq_URI uri -> + (let _,context,_ = env in + try + let s,m,_ = + Founif.unification m m context left right CicUniv.empty_ugraph + in + let reflproof = Equality.Exact (Equality.refl_proof uri eq_ty left) in + let m = Subst.apply_subst_metasenv s m in + Some (goalproof, reflproof, 0, s,m) + with _ -> None) + | _ -> None +;; + +let rec check goal = function + | [] -> None + | f::tl -> + match f goal with + | None -> check goal tl + | (Some p) as ok -> ok +;; + +let simplify_goal_set bag env goals active = + let active_goals, passive_goals = goals in + let find (_,_,g) where = + List.exists (fun (_,_,g1) -> Equality.meta_convertibility g g1) where + in + (* prova:tengo le passive semplificate + let passive_goals = + List.map (fun g -> snd (simplify_goal env g active)) passive_goals + in *) + List.fold_left + (fun (acc_a,acc_p) goal -> + match simplify_goal bag env goal active with + | changed, g -> + if changed then + if find g acc_p then acc_a,acc_p else acc_a,g::acc_p + else + if find g acc_a then acc_a,acc_p else g::acc_a,acc_p) + ([],passive_goals) active_goals +;; + +let check_if_goals_set_is_solved bag env active goals = + let active_goals, passive_goals = goals in + List.fold_left + (fun proof goal -> + match proof with + | Some p -> proof + | None -> + check goal [ + check_if_goal_is_identity env; + check_if_goal_is_subsumed bag env (snd active)]) +(* provare active and passive?*) + None active_goals +;; + +let infer_goal_set bag env active goals = + let active_goals, passive_goals = goals in + let rec aux = function + | [] -> active_goals, [] + | hd::tl -> + let changed,selected = simplify_goal bag env hd active in +(* + if changed then + prerr_endline ("--------------- goal semplificato"); +*) + let (_,_,t1) = selected in + let already_in = + List.exists (fun (_,_,t) -> Equality.meta_convertibility t t1) + active_goals + in + if already_in then + aux tl + else + let passive_goals = tl in + let new_passive_goals = + if Utils.metas_of_term t1 = [] then passive_goals + else + let newmaxmeta,new' = + Indexing.superposition_left bag env (snd active) selected + !maxmeta + in + maxmeta := newmaxmeta; + passive_goals @ new' + in + selected::active_goals, new_passive_goals + in + aux passive_goals +;; + +let infer_goal_set_with_current bag env current goals active = + let active_goals, passive_goals = simplify_goal_set bag env goals active in + let l,table,_ = build_table [current] in + active_goals, + List.fold_left + (fun acc g -> + let newmaxmeta, new' = Indexing.superposition_left bag env table g !maxmeta in + maxmeta := newmaxmeta; + acc @ new') + passive_goals active_goals +;; + +let ids_of_goal g = + let p,_,_ = g in + let ids = List.map (fun _,_,i,_,_ -> i) p in + ids +;; + +let ids_of_goal_set (ga,gp) = + List.flatten (List.map ids_of_goal ga) @ + List.flatten (List.map ids_of_goal gp) +;; + +let size_of_goal_set_a (l,_) = List.length l;; +let size_of_goal_set_p (_,l) = List.length l;; + +let pp_goals label goals context = + let names = Utils.names_of_context context in + List.iter + (fun _,_,g -> + debug_print (lazy + (Printf.sprintf "Current goal: %s = %s\n" label (CicPp.pp g names)))) + (fst goals); + List.iter + (fun _,_,g -> + debug_print (lazy + (Printf.sprintf "PASSIVE goal: %s = %s\n" label (CicPp.pp g names)))) + (snd goals); +;; + +let print_status iterno goals active passive = + debug_print (lazy + (Printf.sprintf "\n%d #ACTIVES: %d #PASSIVES: %d #GOALSET: %d(%d)" + iterno (size_of_active active) (size_of_passive passive) + (size_of_goal_set_a goals) (size_of_goal_set_p goals))) +;; + +(** given-clause algorithm with full reduction strategy: NEW implementation *) +(* here goals is a set of goals in OR *) +let given_clause + bag eq_uri ((_,context,_) as env) goals passive active + goal_steps saturation_steps max_time += + let initial_time = Unix.gettimeofday () in + let iterations_left iterno = + let now = Unix.gettimeofday () in + let time_left = max_time -. now in + let time_spent_until_now = now -. initial_time in + let iteration_medium_cost = + time_spent_until_now /. (float_of_int iterno) + in + let iterations_left = time_left /. iteration_medium_cost in + int_of_float iterations_left + in + let rec step goals passive active g_iterno s_iterno = + if g_iterno > goal_steps && s_iterno > saturation_steps then + (ParamodulationFailure ("No more iterations to spend",active,passive)) + else if Unix.gettimeofday () > max_time then + (ParamodulationFailure ("No more time to spend",active,passive)) + else + let _ = + print_status (max g_iterno s_iterno) goals active passive +(* Printf.eprintf ".%!"; *) + in + (* PRUNING OF PASSIVE THAT WILL NEVER BE PROCESSED *) + let passive = + let selection_estimate = iterations_left (max g_iterno s_iterno) in + let kept = size_of_passive passive in + if kept > selection_estimate then + begin + (*Printf.eprintf "Too many passive equalities: pruning..."; + prune_passive selection_estimate active*) passive + end + else + passive + in + kept_clauses := (size_of_passive passive) + (size_of_active active); + let goals = + if g_iterno < goal_steps then + infer_goal_set bag env active goals + else + goals + in + match check_if_goals_set_is_solved bag env active goals with + | Some p -> + debug_print (lazy + (Printf.sprintf "\nFound a proof in: %f\n" + (Unix.gettimeofday() -. initial_time))); + ParamodulationSuccess (p,active,passive) + | None -> + (* SELECTION *) + if passive_is_empty passive then + if no_more_passive_goals goals then + ParamodulationFailure + ("No more passive equations/goals",active,passive) + (*maybe this is a success! *) + else + step goals passive active (g_iterno+1) (s_iterno+1) + else + begin + (* COLLECTION OF GARBAGED EQUALITIES *) + if max g_iterno s_iterno mod 40 = 0 then + begin + print_status (max g_iterno s_iterno) goals active passive; + let active = List.map Equality.id_of (fst active) in + let passive = List.map Equality.id_of (fst passive) in + let goal = ids_of_goal_set goals in + Equality.collect bag active passive goal + end; + let res, passive = + if s_iterno < saturation_steps then + let current, passive = select env goals passive in + (* SIMPLIFICATION OF CURRENT *) + debug_print (lazy + ("Selected : " ^ + Equality.string_of_equality ~env current)); + forward_simplify bag eq_uri env current active, passive + else + None, passive + in + match res with + | None -> step goals passive active (g_iterno+1) (s_iterno+1) + | Some current -> + (* GENERATION OF NEW EQUATIONS *) +(* prerr_endline "infer"; *) + let new' = infer bag eq_uri env current active in +(* prerr_endline "infer goal"; *) +(* + match check_if_goals_set_is_solved env active goals with + | Some p -> + prerr_endline + (Printf.sprintf "Found a proof in: %f\n" + (Unix.gettimeofday() -. initial_time)); + ParamodulationSuccess p + | None -> +*) + + let active = + let al, tbl = active in + al @ [current], Indexing.index tbl current + in + let goals = + infer_goal_set_with_current bag env current goals active + in + + (* FORWARD AND BACKWARD SIMPLIFICATION *) +(* prerr_endline "fwd/back simpl"; *) + let rec simplify new' active passive = + let new' = + forward_simplify_new bag eq_uri env new' active + in + let active, newa, pruned = + backward_simplify bag eq_uri env new' active + in + let passive = + List.fold_left (filter_dependent bag) passive pruned + in + match newa with + | None -> active, passive, new' + | Some p -> simplify (new' @ p) active passive + in + let active, passive, new' = + simplify new' active passive + in + +(* prerr_endline "simpl goal with new"; *) + let goals = + let a,b,_ = build_table new' in +(* let _ = <:start> in *) + let rc = simplify_goal_set bag env goals (a,b) in +(* let _ = <:stop> in *) + rc + in + let passive = add_to_passive passive new' [] in + step goals passive active (g_iterno+1) (s_iterno+1) + end + in + step goals passive active 1 1 +;; + +let rec saturate_equations bag eq_uri env goal accept_fun passive active = + elapsed_time := Unix.gettimeofday () -. !start_time; + if !elapsed_time > !time_limit then + (active, passive) + else + let current, passive = select env ([goal],[]) passive in + let res = forward_simplify bag eq_uri env current active in + match res with + | None -> + saturate_equations bag eq_uri env goal accept_fun passive active + | Some current -> + Utils.debug_print (lazy (Printf.sprintf "selected: %s" + (Equality.string_of_equality ~env current))); + let new' = infer bag eq_uri env current active in + let active = + if Equality.is_identity env current then active + else + let al, tbl = active in + al @ [current], Indexing.index tbl current + in + (* alla fine new' contiene anche le attive semplificate! + * quindi le aggiungo alle passive insieme alle new *) + let rec simplify new' active passive = + let new' = forward_simplify_new bag eq_uri env new' active in + let active, newa, pruned = + backward_simplify bag eq_uri env new' active in + let passive = + List.fold_left (filter_dependent bag) passive pruned in + match newa with + | None -> active, passive, new' + | Some p -> simplify (new' @ p) active passive + in + let active, passive, new' = simplify new' active passive in + let _ = + Utils.debug_print + (lazy + (Printf.sprintf "active:\n%s\n" + (String.concat "\n" + (List.map + (fun e -> Equality.string_of_equality ~env e) + (fst active))))) + in + let _ = + Utils.debug_print + (lazy + (Printf.sprintf "new':\n%s\n" + (String.concat "\n" + (List.map + (fun e -> "Negative " ^ + (Equality.string_of_equality ~env e)) new')))) + in + let new' = List.filter accept_fun new' in + let passive = add_to_passive passive new' [] in + saturate_equations bag eq_uri env goal accept_fun passive active +;; + +let default_depth = !maxdepth +and default_width = !maxwidth;; + +let reset_refs () = + maxmeta := 0; + symbols_counter := 0; + weight_age_counter := !weight_age_ratio; + processed_clauses := 0; + start_time := 0.; + elapsed_time := 0.; + maximal_retained_equality := None; + infer_time := 0.; + forward_simpl_time := 0.; + forward_simpl_new_time := 0.; + backward_simpl_time := 0.; + passive_maintainance_time := 0.; + derived_clauses := 0; + kept_clauses := 0; +;; + +let eq_of_goal = function + | Cic.Appl [Cic.MutInd(uri,0,_);_;_;_] when LibraryObjects.is_eq_URI uri -> + uri + | _ -> raise (ProofEngineTypes.Fail (lazy ("The goal is not an equality "))) +;; + +let eq_and_ty_of_goal = function + | Cic.Appl [Cic.MutInd(uri,0,_);t;_;_] when LibraryObjects.is_eq_URI uri -> + uri,t + | _ -> raise (ProofEngineTypes.Fail (lazy ("The goal is not an equality "))) +;; + +(* fix proof takes in input a term and try to build a metasenv for it *) + +let fix_proof metasenv context all_implicits p = + let rec aux metasenv n p = + match p with + | Cic.Meta (i,_) -> + if all_implicits then + metasenv,Cic.Implicit None + else + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context + in + let meta = CicSubstitution.lift n (Cic.Meta (i,irl)) in + let metasenv = + try + let _ = CicUtil.lookup_meta i metasenv in metasenv + with CicUtil.Meta_not_found _ -> + debug_print (lazy ("not found: "^(string_of_int i))); + let metasenv,j = CicMkImplicit.mk_implicit_type metasenv [] context in + (i,context,Cic.Meta(j,irl))::metasenv + in + metasenv,meta + | Cic.Appl l -> + let metasenv,l= + List.fold_right + (fun a (metasenv,l) -> + let metasenv,a' = aux metasenv n a in + metasenv,a'::l) + l (metasenv,[]) + in metasenv,Cic.Appl l + | Cic.Lambda(name,s,t) -> + let metasenv,s = aux metasenv n s in + let metasenv,t = aux metasenv (n+1) t in + metasenv,Cic.Lambda(name,s,t) + | Cic.Prod(name,s,t) -> + let metasenv,s = aux metasenv n s in + let metasenv,t = aux metasenv (n+1) t in + metasenv,Cic.Prod(name,s,t) + | Cic.LetIn(name,s,t) -> + let metasenv,s = aux metasenv n s in + let metasenv,t = aux metasenv (n+1) t in + metasenv,Cic.LetIn(name,s,t) + | Cic.Const(uri,ens) -> + let metasenv,ens = + List.fold_right + (fun (v,a) (metasenv,ens) -> + let metasenv,a' = aux metasenv n a in + metasenv,(v,a')::ens) + ens (metasenv,[]) + in + metasenv,Cic.Const(uri,ens) + | t -> metasenv,t + in + aux metasenv 0 p +;; + +let fix_metasenv metasenv = + List.fold_left + (fun m (i,c,t) -> + let m,t = fix_proof m c false t in + let m = List.filter (fun (j,_,_) -> j<>i) m in + (i,c,t)::m) + metasenv metasenv +;; + +(* status: input proof status + * goalproof: forward steps on goal + * newproof: backward steps + * subsumption_id: the equation used if goal is closed by subsumption + * (0 if not closed by subsumption) (DEBUGGING: can be safely removed) + * subsumption_subst: subst to make newproof and goalproof match + * proof_menv: final metasenv + *) + +let build_proof + bag status + goalproof newproof subsumption_id subsumption_subst proof_menv += + if proof_menv = [] then debug_print (lazy "+++++++++++++++VUOTA") + else debug_print (lazy (CicMetaSubst.ppmetasenv [] proof_menv)); + let proof, goalno = status in + let uri, metasenv, _subst, meta_proof, term_to_prove, attrs = proof in + let _, context, type_of_goal = CicUtil.lookup_meta goalno metasenv in + let eq_uri = eq_of_goal type_of_goal in + let names = Utils.names_of_context context in + debug_print (lazy "Proof:"); + debug_print (lazy + (Equality.pp_proof bag names goalproof newproof subsumption_subst + subsumption_id type_of_goal)); +(* + prerr_endline ("max weight: " ^ + (string_of_int (Equality.max_weight goalproof newproof))); +*) + (* generation of the CIC proof *) + (* let metasenv' = List.filter (fun i,_,_ -> i<>goalno) metasenv in *) + let side_effects = + List.filter (fun i -> i <> goalno) + (ProofEngineHelpers.compare_metasenvs + ~newmetasenv:metasenv ~oldmetasenv:proof_menv) in + let goal_proof, side_effects_t = + let initial = Equality.add_subst subsumption_subst newproof in + Equality.build_goal_proof bag + eq_uri goalproof initial type_of_goal side_effects + context proof_menv + in +(* Equality.draw_proof bag names goalproof newproof subsumption_id; *) + let goal_proof = Subst.apply_subst subsumption_subst goal_proof in + let real_menv = fix_metasenv (proof_menv@metasenv) in + let real_menv,goal_proof = + fix_proof real_menv context false goal_proof in +(* + let real_menv,fixed_proof = fix_proof proof_menv context false goal_proof in + (* prerr_endline ("PROOF: " ^ CicPp.pp goal_proof names); *) +*) + let pp_error goal_proof names error exn = + prerr_endline "THE PROOF DOES NOT TYPECHECK! "; + prerr_endline (CicPp.pp goal_proof names); + prerr_endline "THE PROOF DOES NOT TYPECHECK!"; + prerr_endline error; + prerr_endline "THE PROOF DOES NOT TYPECHECK! "; + raise exn + in + let old_insert_coercions = !CicRefine.insert_coercions in + let goal_proof,goal_ty,real_menv,_ = + (* prerr_endline ("parte la refine per: " ^ (CicPp.pp goal_proof names)); *) + try + debug_print (lazy (CicPp.ppterm goal_proof)); + CicRefine.insert_coercions := false; + let res = + CicRefine.type_of_aux' + real_menv context goal_proof CicUniv.empty_ugraph + in + CicRefine.insert_coercions := old_insert_coercions; + res + with + | CicRefine.RefineFailure s + | CicRefine.Uncertain s + | CicRefine.AssertFailure s as exn -> + CicRefine.insert_coercions := old_insert_coercions; + pp_error goal_proof names (Lazy.force s) exn + | CicUtil.Meta_not_found i as exn -> + CicRefine.insert_coercions := old_insert_coercions; + pp_error goal_proof names ("META NOT FOUND: "^string_of_int i) exn + | Invalid_argument "list_fold_left2" as exn -> + CicRefine.insert_coercions := old_insert_coercions; + pp_error goal_proof names "Invalid_argument: list_fold_left2" exn + | exn -> + CicRefine.insert_coercions := old_insert_coercions; + raise exn + in + let subst_side_effects,real_menv,_ = + try + CicUnification.fo_unif_subst [] context real_menv + goal_ty type_of_goal CicUniv.empty_ugraph + with + | CicUnification.UnificationFailure s + | CicUnification.Uncertain s + | CicUnification.AssertFailure s -> assert false + (* fail "Maybe the local context of metas in the goal was not an IRL" s *) + in + Utils.debug_print (lazy "+++++++++++++ FINE UNIF"); + let final_subst = + (goalno,(context,goal_proof,type_of_goal))::subst_side_effects + in +(* + let metas_of_proof = Utils.metas_of_term goal_proof in +*) + let proof, real_metasenv = + ProofEngineHelpers.subst_meta_and_metasenv_in_proof + proof goalno final_subst + (List.filter (fun i,_,_ -> i<>goalno ) real_menv) + in + let open_goals = + (ProofEngineHelpers.compare_metasenvs + ~oldmetasenv:metasenv ~newmetasenv:real_metasenv) in +(* + let open_goals = + List.map (fun i,_,_ -> i) real_metasenv in +*) + final_subst, proof, open_goals + + +(* + + let metas_still_open_in_proof = Utils.metas_of_term goal_proof in + (* prerr_endline (CicPp.pp goal_proof names); *) + let goal_proof = (* Subst.apply_subst subsumption_subst *) goal_proof in + let side_effects_t = + List.map (Subst.apply_subst subsumption_subst) side_effects_t + in + (* replacing fake mets with real ones *) + (* prerr_endline "replacing metas..."; *) + let irl=CicMkImplicit.identity_relocation_list_for_metavariable context in + if proof_menv = [] then prerr_endline "VUOTA"; + CicMetaSubst.ppmetasenv [] proof_menv; + let what, with_what = + List.fold_left + (fun (acc1,acc2) i -> + (Cic.Meta(i,[]))::acc1, (Cic.Implicit None)::acc2) + ([],[]) + metas_still_open_in_proof +(* + (List.filter + (fun (i,_,_) -> + List.mem i metas_still_open_in_proof + (*&& not(List.mem i metas_still_open_in_goal)*)) + proof_menv) +*) + in + let goal_proof_menv = + List.filter + (fun (i,_,_) -> List.mem i metas_still_open_in_proof) + proof_menv + in + let replace where = + (* we need this fake equality since the metas of the hypothesis may be + * with a real local context *) + ProofEngineReduction.replace_lifting + ~equality:(fun x y -> + match x,y with Cic.Meta(i,_),Cic.Meta(j,_) -> i=j | _-> false) + ~what ~with_what ~where + in + let goal_proof = replace goal_proof in + (* ok per le meta libere... ma per quelle che c'erano e sono rimaste? + * what mi pare buono, sostituisce solo le meta farlocche *) + let side_effects_t = List.map replace side_effects_t in + let free_metas = + List.filter (fun i -> i <> goalno) + (ProofEngineHelpers.compare_metasenvs + ~oldmetasenv:metasenv ~newmetasenv:goal_proof_menv) + in + (* prerr_endline + * ("freemetas: " ^ + * String.concat "," (List.map string_of_int free_metas) ); *) + (* check/refine/... build the new proof *) + let replaced_goal = + ProofEngineReduction.replace + ~what:side_effects ~with_what:side_effects_t + ~equality:(fun i t -> match t with Cic.Meta(j,_)->j=i|_->false) + ~where:type_of_goal + in + let goal_proof,goal_ty,real_menv,_ = + prerr_endline "parte la refine"; + try + CicRefine.type_of_aux' metasenv context goal_proof + CicUniv.empty_ugraph + with + | CicUtil.Meta_not_found _ + | CicRefine.RefineFailure _ + | CicRefine.Uncertain _ + | CicRefine.AssertFailure _ + | Invalid_argument "list_fold_left2" as exn -> + prerr_endline "THE PROOF DOES NOT TYPECHECK!"; + prerr_endline (CicPp.pp goal_proof names); + prerr_endline "THE PROOF DOES NOT TYPECHECK!"; + raise exn + in + prerr_endline "+++++++++++++ METASENV"; + prerr_endline + (CicMetaSubst.ppmetasenv [] real_menv); + let subst_side_effects,real_menv,_ = +(* + prerr_endline ("XX type_of_goal " ^ CicPp.ppterm type_of_goal); + prerr_endline ("XX replaced_goal " ^ CicPp.ppterm replaced_goal); + prerr_endline ("XX metasenv " ^ + CicMetaSubst.ppmetasenv [] (metasenv @ free_metas_menv)); +*) + try + CicUnification.fo_unif_subst [] context real_menv + goal_ty type_of_goal CicUniv.empty_ugraph + with + | CicUnification.UnificationFailure s + | CicUnification.Uncertain s + | CicUnification.AssertFailure s -> assert false +(* fail "Maybe the local context of metas in the goal was not an IRL" s *) + in + let final_subst = + (goalno,(context,goal_proof,type_of_goal))::subst_side_effects + in +(* + let metas_of_proof = Utils.metas_of_term goal_proof in +*) + let proof, real_metasenv = + ProofEngineHelpers.subst_meta_and_metasenv_in_proof + proof goalno (CicMetaSubst.apply_subst final_subst) + (List.filter (fun i,_,_ -> i<>goalno ) real_menv) + in + let open_goals = + List.map (fun i,_,_ -> i) real_metasenv in + +(* + HExtlib.list_uniq (List.sort Pervasives.compare metas_of_proof) + in *) +(* + match free_meta with Some(Cic.Meta(m,_)) when m<>goalno ->[m] | _ ->[] + in +*) +(* + Printf.eprintf + "GOALS APERTI: %s\nMETASENV PRIMA:\n%s\nMETASENV DOPO:\n%s\n" + (String.concat ", " (List.map string_of_int open_goals)) + (CicMetaSubst.ppmetasenv [] metasenv) + (CicMetaSubst.ppmetasenv [] real_metasenv); +*) + final_subst, proof, open_goals +;; +*) + +(* **************** HERE ENDS THE PARAMODULATION STUFF ******************** *) + +(* exported functions *) + +let pump_actives context bag maxm active passive saturation_steps max_time = + reset_refs(); + maxmeta := maxm; +(* + let max_l l = + List.fold_left + (fun acc e -> let _,_,_,menv,_ = Equality.open_equality e in + List.fold_left (fun acc (i,_,_) -> max i acc) acc menv) + 0 l in +*) +(* let active_l = fst active in *) +(* let passive_l = fst passive in *) +(* let ma = max_l active_l in *) +(* let mp = max_l passive_l in *) + match LibraryObjects.eq_URI () with + | None -> active, passive, !maxmeta + | Some eq_uri -> + let env = [],context,CicUniv.empty_ugraph in + (match + given_clause bag eq_uri env ([],[]) + passive active 0 saturation_steps max_time + with + | ParamodulationFailure (_,a,p) -> + a, p, !maxmeta + | ParamodulationSuccess _ -> + assert false) +;; + +let all_subsumed bag maxm status active passive = + maxmeta := maxm; + let proof, goalno = status in + let uri, metasenv, _subst, meta_proof, term_to_prove, attrs = proof in + let _, context, type_of_goal = CicUtil.lookup_meta goalno metasenv in + let env = metasenv,context,CicUniv.empty_ugraph in + let cleaned_goal = Utils.remove_local_context type_of_goal in + let goal = [], List.filter (fun (i,_,_)->i<>goalno) metasenv, cleaned_goal in + debug_print (lazy (string_of_int (List.length (fst active)))); + (* we simplify using both actives passives *) + let table = + List.fold_left + (fun (l,tbl) eq -> eq::l,(Indexing.index tbl eq)) + active (list_of_passive passive) in + let _,goal = simplify_goal bag env goal table in + let (_,_,ty) = goal in + debug_print (lazy (CicPp.ppterm ty)); + let subsumed = find_all_subsumed bag env (snd table) goal in + let subsumed_or_id = + match (check_if_goal_is_identity env goal) with + None -> subsumed + | Some id -> id::subsumed in + let res = + List.map + (fun + (goalproof,newproof,subsumption_id,subsumption_subst, proof_menv) -> + build_proof bag + status goalproof newproof subsumption_id subsumption_subst proof_menv) + subsumed_or_id in + res, !maxmeta + + +let given_clause + bag maxm status active passive goal_steps saturation_steps max_time += + reset_refs(); + maxmeta := maxm; + let active_l = fst active in +(* + let max_l l = + List.fold_left + (fun acc e -> let _,_,_,menv,_ = Equality.open_equality e in + List.fold_left (fun acc (i,_,_) -> max i acc) acc menv) + 0 l + in + let passive_l = fst passive in + let ma = max_l active_l in + let mp = max_l passive_l in +*) + let proof, goalno = status in + let uri, metasenv, _subst, meta_proof, term_to_prove, attrs = proof in + let _, context, type_of_goal = CicUtil.lookup_meta goalno metasenv in + let eq_uri = eq_of_goal type_of_goal in + let cleaned_goal = Utils.remove_local_context type_of_goal in + Utils.set_goal_symbols cleaned_goal; (* DISACTIVATED *) + let metasenv' = List.filter (fun (i,_,_)->i<>goalno) metasenv in + let goal = [], metasenv', cleaned_goal in + let env = metasenv,context,CicUniv.empty_ugraph in + debug_print (lazy ">>>>>> ACTIVES >>>>>>>>"); + List.iter (fun e -> debug_print (lazy (Equality.string_of_equality ~env e))) + active_l; + debug_print (lazy ">>>>>>>>>>>>>>"); + let goals = make_goal_set goal in + match +(* given_caluse non prende in input maxm ????? *) + given_clause bag eq_uri env goals passive active + goal_steps saturation_steps max_time + with + | ParamodulationFailure (_,a,p) -> + None, a, p, !maxmeta + | ParamodulationSuccess + ((goalproof,newproof,subsumption_id,subsumption_subst, proof_menv),a,p) -> + let subst, proof, gl = + build_proof bag + status goalproof newproof subsumption_id subsumption_subst proof_menv + in + Some (subst, proof,gl),a,p, !maxmeta +;; + +let add_to_passive eql passives = + add_to_passive passives eql eql +;; + + diff --git a/components/tactics/paramodulation/saturation.mli b/components/tactics/paramodulation/saturation.mli new file mode 100644 index 000000000..20b564f4b --- /dev/null +++ b/components/tactics/paramodulation/saturation.mli @@ -0,0 +1,73 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type passive_table +type active_table = Equality.equality list * Indexing.Index.t + +val reset_refs : unit -> unit + +val make_active: Equality.equality list -> active_table +val make_passive: Equality.equality list -> passive_table +val add_to_passive: Equality.equality list -> passive_table -> passive_table +val list_of_passive: passive_table -> Equality.equality list + +val simplify_equalities : + Equality.equality_bag -> + UriManager.uri -> + Utils.environment -> + Equality.equality list -> + Equality.equality list +val pump_actives : + Cic.context -> + Equality.equality_bag -> + int -> + active_table -> + passive_table -> + int -> + float -> + active_table * passive_table * int +val all_subsumed : + Equality.equality_bag -> + int -> + ProofEngineTypes.status -> + active_table -> + passive_table -> + (Cic.substitution * + ProofEngineTypes.proof * + ProofEngineTypes.goal list) list * int +val given_clause: + Equality.equality_bag -> + int -> (* maxmeta *) + ProofEngineTypes.status -> + active_table -> + passive_table -> + int -> int -> float -> + (Cic.substitution * + ProofEngineTypes.proof * + ProofEngineTypes.goal list) option * + active_table * passive_table * int + diff --git a/components/tactics/paramodulation/subst.ml b/components/tactics/paramodulation/subst.ml new file mode 100644 index 000000000..7e8ab8b18 --- /dev/null +++ b/components/tactics/paramodulation/subst.ml @@ -0,0 +1,217 @@ +(* cOpyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id: inference.ml 6245 2006-04-05 12:07:51Z tassi $ *) + + +(******* CIC substitution ***************************************************) + +type cic_substitution = Cic.substitution +let cic_apply_subst = CicMetaSubst.apply_subst +let cic_apply_subst_metasenv = CicMetaSubst.apply_subst_metasenv +let cic_ppsubst = CicMetaSubst.ppsubst +let cic_buildsubst n context t ty tail = (n,(context,t,ty)) :: tail +let cic_flatten_subst subst = + List.map + (fun (i, (context, term, ty)) -> + let context = (* cic_apply_subst_context subst*) context in + let term = cic_apply_subst subst term in + let ty = cic_apply_subst subst ty in + (i, (context, term, ty))) subst +let rec cic_lookup_subst meta subst = + match meta with + | Cic.Meta (i, _) -> ( + try let _, (_, t, _) = List.find (fun (m, _) -> m = i) subst + in cic_lookup_subst t subst + with Not_found -> meta + ) + | _ -> meta +;; + +let cic_merge_subst_if_possible s1 s2 = + let already_in = Hashtbl.create 13 in + let rec aux acc = function + | ((i,_,x) as s)::tl -> + (try + let x' = Hashtbl.find already_in i in + if x = x' then aux acc tl else None + with + | Not_found -> + Hashtbl.add already_in i x; + aux (s::acc) tl) + | [] -> Some acc + in + aux [] (s1@s2) +;; + +(******** NAIF substitution **************************************************) +(* + * naif version of apply subst; the local context of metas is ignored; + * we assume the substituted term must be lifted according to the nesting + * depth of the meta. + * Alternatively, we could used implicit instead of metas + *) + +type naif_substitution = (int * Cic.term) list + +let naif_apply_subst lift subst term = + let rec aux k t = + match t with + Cic.Rel _ -> t + | Cic.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri, t) -> (uri, aux k t)) exp_named_subst + in + Cic.Var (uri, exp_named_subst') + | Cic.Meta (i, l) -> + (try + aux k (CicSubstitution.lift (k+lift) (List.assoc i subst)) + with Not_found -> t) + | Cic.Sort _ + | Cic.Implicit _ -> t + | Cic.Cast (te,ty) -> Cic.Cast (aux k te, aux k ty) + | Cic.Prod (n,s,t) -> Cic.Prod (n, aux k s, aux (k+1) t) + | Cic.Lambda (n,s,t) -> Cic.Lambda (n, aux k s, aux (k+1) t) + | Cic.LetIn (n,s,t) -> Cic.LetIn (n, aux k s, aux (k+1) t) + | Cic.Appl [] -> assert false + | Cic.Appl l -> Cic.Appl (List.map (aux k) l) + | Cic.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri, t) -> (uri, aux k t)) exp_named_subst + in + if exp_named_subst' != exp_named_subst then + Cic.Const (uri, exp_named_subst') + else + t (* TODO: provare a mantenere il piu' possibile sharing *) + | Cic.MutInd (uri,typeno,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri, t) -> (uri, aux k t)) exp_named_subst + in + Cic.MutInd (uri,typeno,exp_named_subst') + | Cic.MutConstruct (uri,typeno,consno,exp_named_subst) -> + let exp_named_subst' = + List.map (fun (uri, t) -> (uri, aux k t)) exp_named_subst + in + Cic.MutConstruct (uri,typeno,consno,exp_named_subst') + | Cic.MutCase (sp,i,outty,t,pl) -> + let pl' = List.map (aux k) pl in + Cic.MutCase (sp, i, aux k outty, aux k t, pl') + | Cic.Fix (i, fl) -> + let len = List.length fl in + let fl' = + List.map + (fun (name, i, ty, bo) -> (name, i, aux k ty, aux (k+len) bo)) fl + in + Cic.Fix (i, fl') + | Cic.CoFix (i, fl) -> + let len = List.length fl in + let fl' = + List.map (fun (name, ty, bo) -> (name, aux k ty, aux (k+len) bo)) fl + in + Cic.CoFix (i, fl') +in + aux 0 term +;; + +(* naif version of apply_subst_metasenv: we do not apply the +substitution to the context *) + +let naif_apply_subst_metasenv subst metasenv = + List.map + (fun (n, context, ty) -> + (n, context, naif_apply_subst 0 subst ty)) + (List.filter + (fun (i, _, _) -> not (List.mem_assoc i subst)) + metasenv) + +let naif_ppsubst names subst = + "{" ^ String.concat "; " + (List.map + (fun (idx, t) -> + Printf.sprintf "%d:= %s" idx (CicPp.pp t names)) + subst) ^ "}" +;; + +let naif_buildsubst n context t ty tail = (n,t) :: tail ;; + +let naif_flatten_subst subst = + List.map (fun (i,t) -> i, naif_apply_subst 0 subst t ) subst +;; + +let rec naif_lookup_subst meta subst = + match meta with + | Cic.Meta (i, _) -> + (try + naif_lookup_subst (List.assoc i subst) subst + with + Not_found -> meta) + | _ -> meta +;; + +let naif_merge_subst_if_possible s1 s2 = + let already_in = Hashtbl.create 13 in + let rec aux acc = function + | ((i,x) as s)::tl -> + (try + let x' = Hashtbl.find already_in i in + if x = x' then aux acc tl else None + with + | Not_found -> + Hashtbl.add already_in i x; + aux (s::acc) tl) + | [] -> Some acc + in + aux [] (s1@s2) +;; + +(********** ACTUAL SUBSTITUTION IMPLEMENTATION *******************************) + +type substitution = naif_substitution +let apply_subst = naif_apply_subst 0 +let apply_subst_lift = naif_apply_subst +let apply_subst_metasenv = naif_apply_subst_metasenv +let ppsubst ?(names=[]) l = naif_ppsubst names l +let buildsubst = naif_buildsubst +let flatten_subst = naif_flatten_subst +let lookup_subst = naif_lookup_subst + +(* filter out from metasenv the variables in substs *) +let filter subst metasenv = + List.filter + (fun (m, _, _) -> + try let _ = List.find (fun (i, _) -> m = i) subst in false + with Not_found -> true) + metasenv +;; + +let is_in_subst i subst = List.mem_assoc i subst;; + +let merge_subst_if_possible = naif_merge_subst_if_possible;; + +let empty_subst = [];; + +let concat x y = x @ y;; + + diff --git a/components/tactics/paramodulation/subst.mli b/components/tactics/paramodulation/subst.mli new file mode 100644 index 000000000..6627bf067 --- /dev/null +++ b/components/tactics/paramodulation/subst.mli @@ -0,0 +1,43 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type substitution + +val empty_subst : substitution +val apply_subst : substitution -> Cic.term -> Cic.term +val apply_subst_lift : int -> substitution -> Cic.term -> Cic.term +val apply_subst_metasenv : substitution -> Cic.metasenv -> Cic.metasenv +val ppsubst : ?names:(Cic.name option list) -> substitution -> string +val buildsubst : + int -> Cic.context -> Cic.term -> Cic.term -> substitution -> + substitution +val flatten_subst : substitution -> substitution +val lookup_subst : Cic.term -> substitution -> Cic.term +val filter : substitution -> Cic.metasenv -> Cic.metasenv +val is_in_subst : int -> substitution -> bool +val merge_subst_if_possible: + substitution -> substitution -> + substitution option +val concat: substitution -> substitution -> substitution diff --git a/components/tactics/paramodulation/test_indexing.ml b/components/tactics/paramodulation/test_indexing.ml new file mode 100644 index 000000000..02dbf69e0 --- /dev/null +++ b/components/tactics/paramodulation/test_indexing.ml @@ -0,0 +1,253 @@ +(* $Id$ *) + +open Path_indexing + +(* +let build_equality term = + let module C = Cic in + C.Implicit None, (C.Implicit None, term, C.Rel 1, Utils.Gt), [], [] +;; + + +(* + f = Rel 1 + g = Rel 2 + a = Rel 3 + b = Rel 4 + c = Rel 5 +*) +let path_indexing_test () = + let module C = Cic in + let terms = [ + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Rel 3; C.Meta (1, [])]; C.Rel 5]; + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Meta (1, []); C.Rel 4]; C.Meta (1, [])]; + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Rel 3; C.Rel 4]; C.Rel 5]; + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Meta (1, []); C.Rel 5]; C.Rel 4]; + C.Appl [C.Rel 1; C.Meta (1, []); C.Meta (1, [])] + ] in + let path_strings = List.map (path_strings_of_term 0) terms in + let table = + List.fold_left index PSTrie.empty (List.map build_equality terms) in + let query = + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Meta (1, []); C.Rel 4]; C.Rel 5] in + let matches = retrieve_generalizations table query in + let unifications = retrieve_unifiables table query in + let eq1 = build_equality (C.Appl [C.Rel 1; C.Meta (1, []); C.Meta (1, [])]) + and eq2 = build_equality (C.Appl [C.Rel 1; C.Meta (1, []); C.Meta (2, [])]) in + let res1 = in_index table eq1 + and res2 = in_index table eq2 in + let print_results res = + String.concat "\n" + (PosEqSet.fold + (fun (p, e) l -> + let s = + "(" ^ (Utils.string_of_pos p) ^ ", " ^ + (Inference.string_of_equality e) ^ ")" + in + s::l) + res []) + in + Printf.printf "path_strings:\n%s\n\n" + (String.concat "\n" + (List.map + (fun l -> + "{" ^ (String.concat "; " (List.map string_of_path_string l)) ^ "}" + ) path_strings)); + Printf.printf "table:\n%s\n\n" (string_of_pstrie table); + Printf.printf "matches:\n%s\n\n" (print_results matches); + Printf.printf "unifications:\n%s\n\n" (print_results unifications); + Printf.printf "in_index %s: %s\n" + (Inference.string_of_equality eq1) (string_of_bool res1); + Printf.printf "in_index %s: %s\n" + (Inference.string_of_equality eq2) (string_of_bool res2); +;; + + +let differing () = + let module C = Cic in + let t1 = + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Rel 3; C.Meta (1, [])]; C.Rel 5] + and t2 = + C.Appl [C.Rel 1; C.Appl [C.Rel 5; C.Rel 4; C.Meta (1, [])]; C.Rel 5] + in + let res = Inference.extract_differing_subterms t1 t2 in + match res with + | None -> prerr_endline "NO DIFFERING SUBTERMS???" + | Some (t1, t2) -> + Printf.printf "OK: %s, %s\n" (CicPp.ppterm t1) (CicPp.ppterm t2); +;; + + +let next_after () = + let module C = Cic in + let t = + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Rel 3; C.Rel 4]; C.Rel 5] + in + let pos1 = Discrimination_tree.next_t [1] t in + let pos2 = Discrimination_tree.after_t [1] t in + Printf.printf "next_t 1: %s\nafter_t 1: %s\n" + (CicPp.ppterm (Discrimination_tree.subterm_at_pos pos1 t)) + (CicPp.ppterm (Discrimination_tree.subterm_at_pos pos2 t)); +;; + + +let discrimination_tree_test () = + let module C = Cic in + let terms = [ + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Rel 3; C.Meta (1, [])]; C.Rel 5]; + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Meta (1, []); C.Rel 4]; C.Meta (1, [])]; + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Rel 3; C.Rel 4]; C.Rel 5]; + C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Meta (1, []); C.Rel 5]; C.Rel 4]; + C.Appl [C.Rel 10; C.Meta (5, []); C.Rel 11] + ] in + let path_strings = + List.map Discrimination_tree.path_string_of_term terms in + let table = + List.fold_left + Discrimination_tree.index + Discrimination_tree.DiscriminationTree.empty + (List.map build_equality terms) + in +(* let query = *) +(* C.Appl [C.Rel 1; C.Appl [C.Rel 2; C.Meta (1, []); C.Rel 4]; C.Rel 5] in *) + let query = C.Appl [C.Rel 10; C.Meta (14, []); C.Meta (13, [])] in + let matches = Discrimination_tree.retrieve_generalizations table query in + let unifications = Discrimination_tree.retrieve_unifiables table query in + let eq1 = build_equality (C.Appl [C.Rel 1; C.Meta (1, []); C.Meta (1, [])]) + and eq2 = build_equality (C.Appl [C.Rel 1; C.Meta (1, []); C.Meta (2, [])]) in + let res1 = Discrimination_tree.in_index table eq1 + and res2 = Discrimination_tree.in_index table eq2 in + let print_results res = + String.concat "\n" + (Discrimination_tree.PosEqSet.fold + (fun (p, e) l -> + let s = + "(" ^ (Utils.string_of_pos p) ^ ", " ^ + (Inference.string_of_equality e) ^ ")" + in + s::l) + res []) + in + Printf.printf "path_strings:\n%s\n\n" + (String.concat "\n" + (List.map Discrimination_tree.string_of_path_string path_strings)); + Printf.printf "table:\n%s\n\n" + (Discrimination_tree.string_of_discrimination_tree table); + Printf.printf "matches:\n%s\n\n" (print_results matches); + Printf.printf "unifications:\n%s\n\n" (print_results unifications); + Printf.printf "in_index %s: %s\n" + (Inference.string_of_equality eq1) (string_of_bool res1); + Printf.printf "in_index %s: %s\n" + (Inference.string_of_equality eq2) (string_of_bool res2); +;; + + +let test_subst () = + let module C = Cic in + let module M = CicMetaSubst in + let term = C.Appl [ + C.Rel 1; + C.Appl [C.Rel 11; + C.Meta (43, []); + C.Appl [C.Rel 15; C.Rel 12; C.Meta (41, [])]]; + C.Appl [C.Rel 11; + C.Appl [C.Rel 15; C.Meta (10, []); C.Meta (11, [])]; + C.Appl [C.Rel 15; C.Meta (10, []); C.Meta (12, [])]] + ] in + let subst1 = [ + (43, ([], C.Appl [C.Rel 15; C.Meta (10, []); C.Meta (11, [])], C.Rel 16)); + (10, ([], C.Rel 12, C.Rel 16)); + (12, ([], C.Meta (41, []), C.Rel 16)) + ] + and subst2 = [ + (43, ([], C.Appl [C.Rel 15; C.Rel 12; C.Meta (11, [])], C.Rel 16)); + (10, ([], C.Rel 12, C.Rel 16)); + (12, ([], C.Meta (41, []), C.Rel 16)) + ] in + let t1 = M.apply_subst subst1 term + and t2 = M.apply_subst subst2 term in + Printf.printf "t1 = %s\nt2 = %s\n" (CicPp.ppterm t1) (CicPp.ppterm t2); +;; +*) + + +let test_refl () = + let module C = Cic in + let context = [ + Some (C.Name "H", C.Decl ( + C.Prod (C.Name "z", C.Rel 3, + C.Appl [ + C.MutInd (HelmLibraryObjects.Logic.eq_URI, 0, []); + C.Rel 4; C.Rel 3; C.Rel 1]))); + Some (C.Name "x", C.Decl (C.Rel 2)); + Some (C.Name "y", C.Decl (C.Rel 1)); + Some (C.Name "A", C.Decl (C.Sort C.Set)) + ] + in + let term = C.Appl [ + C.Const (HelmLibraryObjects.Logic.eq_ind_URI, []); C.Rel 4; + C.Rel 2; + C.Lambda (C.Name "z", C.Rel 4, + C.Appl [ + C.MutInd (HelmLibraryObjects.Logic.eq_URI, 0, []); + C.Rel 5; C.Rel 1; C.Rel 3 + ]); + C.Appl [C.MutConstruct + (HelmLibraryObjects.Logic.eq_URI, 0, 1, []); (* reflexivity *) + C.Rel 4; C.Rel 2]; + C.Rel 3; +(* C.Appl [C.Const (HelmLibraryObjects.Logic.sym_eq_URI, []); (\* symmetry *\) *) +(* C.Rel 4; C.Appl [C.Rel 1; C.Rel 2]] *) + C.Appl [ + C.Const (HelmLibraryObjects.Logic.eq_ind_URI, []); + C.Rel 4; C.Rel 3; + C.Lambda (C.Name "z", C.Rel 4, + C.Appl [ + C.MutInd (HelmLibraryObjects.Logic.eq_URI, 0, []); + C.Rel 5; C.Rel 1; C.Rel 4 + ]); + C.Appl [C.MutConstruct (HelmLibraryObjects.Logic.eq_URI, 0, 1, []); + C.Rel 4; C.Rel 3]; + C.Rel 2; C.Appl [C.Rel 1; C.Rel 2] + ] + ] in + let ens = [ + (UriManager.uri_of_string "cic:/Coq/Init/Logic/Logic_lemmas/equality/A.var", + C.Rel 4); + (UriManager.uri_of_string "cic:/Coq/Init/Logic/Logic_lemmas/equality/x.var", + C.Rel 3); + (UriManager.uri_of_string "cic:/Coq/Init/Logic/Logic_lemmas/equality/y.var", + C.Rel 2); + ] in + let term2 = C.Appl [ + C.Const (HelmLibraryObjects.Logic.sym_eq_URI, ens); + C.Appl [C.Rel 1; C.Rel 2] + ] in + let ty, ug = + CicTypeChecker.type_of_aux' [] context term CicUniv.empty_ugraph + in + Printf.printf "OK, %s ha tipo %s\n" (CicPp.ppterm term) (CicPp.ppterm ty); + let ty, ug = + CicTypeChecker.type_of_aux' [] context term2 CicUniv.empty_ugraph + in + Printf.printf "OK, %s ha tipo %s\n" (CicPp.ppterm term2) (CicPp.ppterm ty); +;; + + +let test_lib () = + let uri = Sys.argv.(1) in + let t = CicUtil.term_of_uri (UriManager.uri_of_string uri) in + let ty, _ = CicTypeChecker.type_of_aux' [] [] t CicUniv.empty_ugraph in + Printf.printf "Term of %s: %s\n" uri (CicPp.ppterm t); + Printf.printf "type: %s\n" (CicPp.ppterm ty); +;; + + +(* differing ();; *) +(* next_after ();; *) +(* discrimination_tree_test ();; *) +(* path_indexing_test ();; *) +(* test_subst ();; *) +Helm_registry.load_from "../../matita/matita.conf.xml"; +(* test_refl ();; *) +test_lib ();; diff --git a/components/tactics/paramodulation/utils.ml b/components/tactics/paramodulation/utils.ml new file mode 100644 index 000000000..c6e64b898 --- /dev/null +++ b/components/tactics/paramodulation/utils.ml @@ -0,0 +1,772 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +let time = true;; +let debug = false;; +let debug_metas = false;; +let debug_res = false;; + +let debug_print s = if debug then prerr_endline (Lazy.force s);; + +let print_metasenv metasenv = + String.concat "\n--------------------------\n" + (List.map (fun (i, context, term) -> + (string_of_int i) ^ " [\n" ^ (CicPp.ppcontext context) ^ + "\n] " ^ (CicPp.ppterm term)) + metasenv) +;; + + +let print_subst ?(prefix="\n") subst = + String.concat prefix + (List.map + (fun (i, (c, t, ty)) -> + Printf.sprintf "?%d -> %s : %s" i + (CicPp.ppterm t) (CicPp.ppterm ty)) + subst) +;; + +type comparison = Lt | Le | Eq | Ge | Gt | Incomparable;; + +let string_of_comparison = function + | Lt -> "<" + | Le -> "<=" + | Gt -> ">" + | Ge -> ">=" + | Eq -> "=" + | Incomparable -> "I" + +type environment = Cic.metasenv * Cic.context * CicUniv.universe_graph + +module OrderedTerm = +struct + type t = Cic.term + + let compare = Pervasives.compare +end + +module TermSet = Set.Make(OrderedTerm);; +module TermMap = Map.Make(OrderedTerm);; + +let symbols_of_term term = + let module C = Cic in + let rec aux map = function + | C.Meta _ -> map + | C.Appl l -> + List.fold_left (fun res t -> (aux res t)) map l + | t -> + let map = + try + let c = TermMap.find t map in + TermMap.add t (c+1) map + with Not_found -> + TermMap.add t 1 map + in + map + in + aux TermMap.empty term +;; + + +let metas_of_term term = + let module C = Cic in + let rec aux = function + | C.Meta _ as t -> TermSet.singleton t + | C.Appl l -> + List.fold_left (fun res t -> TermSet.union res (aux t)) TermSet.empty l + | C.Lambda(n,s,t) -> + TermSet.union (aux s) (aux t) + | C.Prod(n,s,t) -> + TermSet.union (aux s) (aux t) + | C.LetIn(n,s,t) -> + TermSet.union (aux s) (aux t) + | t -> TermSet.empty (* TODO: maybe add other cases? *) + in + aux term +;; + +let rec remove_local_context = + function + | Cic.Meta (i,_) -> Cic.Meta (i,[]) + | Cic.Appl l -> + Cic.Appl(List.map remove_local_context l) + | t -> t + + +(************************* rpo ********************************) +let number = [ + UriManager.uri_of_string "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)",3; + UriManager.uri_of_string "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)",6; + UriManager.uri_of_string "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)",9; + HelmLibraryObjects.Peano.pred_URI, 12; + HelmLibraryObjects.Peano.plus_URI, 15; + HelmLibraryObjects.Peano.minus_URI, 18; + HelmLibraryObjects.Peano.mult_URI, 21; + UriManager.uri_of_string "cic:/matita/nat/nat/nat.ind#xpointer(1/1)",103; + UriManager.uri_of_string "cic:/matita/nat/nat/nat.ind#xpointer(1/1/1)",106; + UriManager.uri_of_string "cic:/matita/nat/nat/nat.ind#xpointer(1/1/2)",109; + UriManager.uri_of_string "cic:/matita/nat/nat/pred.con",112; + UriManager.uri_of_string "cic:/matita/nat/plus/plus.con",115; + UriManager.uri_of_string "cic:/matita/nat/minus/minus.con",118; + UriManager.uri_of_string "cic:/matita/nat/times/times.con",121; + ] +;; + +let atomic t = + match t with + Cic.Const _ + | Cic.MutInd _ + | Cic.MutConstruct _ + | Cic.Rel _ -> true + | _ -> false + +let sig_order_const t1 t2 = + try + let u1 = CicUtil.uri_of_term t1 in + let u2 = CicUtil.uri_of_term t2 in + let n1 = List.assoc u1 number in + let n2 = List.assoc u2 number in + if n1 < n2 then Lt + else if n1 > n2 then Gt + else + begin + prerr_endline ("t1 = "^(CicPp.ppterm t1)); + prerr_endline ("t2 = "^(CicPp.ppterm t2)); + assert false + end + with + Invalid_argument _ + | Not_found -> Incomparable + +let sig_order t1 t2 = + match t1, t2 with + Cic.Rel n, Cic.Rel m when n < m -> Gt (* inverted order *) + | Cic.Rel n, Cic.Rel m when n = m -> Incomparable + | Cic.Rel n, Cic.Rel m when n > m -> Lt + | Cic.Rel _, _ -> Gt + | _, Cic.Rel _ -> Lt + | _,_ -> sig_order_const t1 t2 + +let rec rpo_lt t1 t2 = + let module C = Cic in + let first_trie = + match t1,t2 with + C.Meta (_, _), C.Meta (_,_) -> false + | C.Meta (_,_) , t2 -> TermSet.mem t1 (metas_of_term t2) + | t1, C.Meta (_,_) -> false + | C.Appl [h1;a1],C.Appl [h2;a2] when h1=h2 -> + rpo_lt a1 a2 + | C.Appl (h1::arg1),C.Appl (h2::arg2) when h1=h2 -> + if lex_lt arg1 arg2 then + check_lt arg1 t2 + else false + | C.Appl (h1::arg1),C.Appl (h2::arg2) -> + (match sig_order h1 h2 with + | Lt -> check_lt arg1 t2 + | _ -> false) + | C.Appl (h1::arg1), t2 when atomic t2 -> + (match sig_order h1 t2 with + | Lt -> check_lt arg1 t2 + | _ -> false) + | t1 , C.Appl (h2::arg2) when atomic t1 -> + (match sig_order t1 h2 with + | Lt -> true + | _ -> false ) + | C.Appl [] , _ -> assert false + | _ , C.Appl [] -> assert false + | t1, t2 when (atomic t1 && atomic t2 && t1<>t2) -> + (match sig_order t1 t2 with + | Lt -> true + | _ -> false) + | _,_ -> false + in + if first_trie then true else + match t2 with + C.Appl (_::args) -> + List.exists (fun a -> t1 = a || rpo_lt t1 a) args + | _ -> false + +and lex_lt l1 l2 = + match l1,l2 with + [],[] -> false + | [],_ -> assert false + | _, [] -> assert false + | a1::l1, a2::l2 when a1 = a2 -> lex_lt l1 l2 + | a1::_, a2::_ -> rpo_lt a1 a2 + +and check_lt l t = + List.fold_left + (fun b a -> b && (rpo_lt a t)) + true l +;; + +let rpo t1 t2 = + if rpo_lt t2 t1 then Gt + else if rpo_lt t1 t2 then Lt + else Incomparable + + +(*********************** fine rpo *****************************) + +(* (weight of constants, [(meta, weight_of_meta)]) *) +type weight = int * (int * int) list;; + +let string_of_weight (cw, mw) = + let s = + String.concat ", " + (List.map (function (m, w) -> Printf.sprintf "(%d,%d)" m w) mw) + in + Printf.sprintf "[%d; %s]" cw s + + +let weight_of_term ?(consider_metas=true) ?(count_metas_occurrences=false) term = + let module C = Cic in + let vars_dict = Hashtbl.create 5 in + let rec aux = function + | C.Meta (metano, _) when consider_metas -> + (try + let oldw = Hashtbl.find vars_dict metano in + Hashtbl.replace vars_dict metano (oldw+1) + with Not_found -> + Hashtbl.add vars_dict metano 1); + if count_metas_occurrences then 1 else 0 + | C.Meta _ -> (* "variables" are lighter than constants and functions...*) + if count_metas_occurrences then 1 else 0 + | C.Var (_, ens) + | C.Const (_, ens) + | C.MutInd (_, _, ens) + | C.MutConstruct (_, _, _, ens) -> + List.fold_left (fun w (u, t) -> (aux t) + w) 1 ens + + | C.Cast (t1, t2) + | C.Lambda (_, t1, t2) + | C.Prod (_, t1, t2) + | C.LetIn (_, t1, t2) -> + let w1 = aux t1 in + let w2 = aux t2 in + w1 + w2 + 1 + + | C.Appl l -> List.fold_left (+) 0 (List.map aux l) + + | C.MutCase (_, _, outt, t, pl) -> + let w1 = aux outt in + let w2 = aux t in + let w3 = List.fold_left (+) 0 (List.map aux pl) in + w1 + w2 + w3 + 1 + + | C.Fix (_, fl) -> + List.fold_left (fun w (n, i, t1, t2) -> (aux t1) + (aux t2) + w) 1 fl + + | C.CoFix (_, fl) -> + List.fold_left (fun w (n, t1, t2) -> (aux t1) + (aux t2) + w) 1 fl + + | _ -> 1 + in + let w = aux term in + let l = + Hashtbl.fold (fun meta metaw resw -> (meta, metaw)::resw) vars_dict [] in + let compare w1 w2 = + match w1, w2 with + | (m1, _), (m2, _) -> m2 - m1 + in + (w, List.sort compare l) (* from the biggest meta to the smallest (0) *) +;; + + +module OrderedInt = struct + type t = int + + let compare = Pervasives.compare +end + +module IntSet = Set.Make(OrderedInt) + +let goal_symbols = ref TermSet.empty + +let set_of_map m = + TermMap.fold (fun k _ s -> TermSet.add k s) m TermSet.empty +;; + +let set_goal_symbols term = + let m = symbols_of_term term in + goal_symbols := (set_of_map m) +;; + +let symbols_of_eq (ty,left,right,_) = + let sty = set_of_map (symbols_of_term ty) in + let sl = set_of_map (symbols_of_term left) in + let sr = set_of_map (symbols_of_term right) in + TermSet.union sty (TermSet.union sl sr) +;; + +let distance sgoal seq = + let s = TermSet.diff seq sgoal in + TermSet.cardinal s +;; + +let compute_equality_weight (ty,left,right,o) = + let factor = 2 in + match o with + | Lt -> + let w, m = (weight_of_term + ~consider_metas:true ~count_metas_occurrences:false right) in + w + (factor * (List.length m)) ; + | Le -> assert false + | Gt -> + let w, m = (weight_of_term + ~consider_metas:true ~count_metas_occurrences:false left) in + w + (factor * (List.length m)) ; + | Ge -> assert false + | Eq + | Incomparable -> + let w1, m1 = (weight_of_term + ~consider_metas:true ~count_metas_occurrences:false right) in + let w2, m2 = (weight_of_term + ~consider_metas:true ~count_metas_occurrences:false left) in + w1 + w2 + (factor * (List.length m1)) + (factor * (List.length m2)) +;; + +let compute_equality_weight e = + let w = compute_equality_weight e in + let d = 0 in (* distance !goal_symbols (symbols_of_eq e) in *) +(* + prerr_endline (Printf.sprintf "dist %s --- %s === %d" + (String.concat ", " (List.map (CicPp.ppterm) (TermSet.elements + !goal_symbols))) + (String.concat ", " (List.map (CicPp.ppterm) (TermSet.elements + (symbols_of_eq e)))) + d + ); +*) + w + d +;; + +(* old +let compute_equality_weight (ty,left,right,o) = + let metasw = ref 0 in + let weight_of t = + let w, m = (weight_of_term + ~consider_metas:true ~count_metas_occurrences:false t) in + metasw := !metasw + (1 * (List.length m)) ; + w + in + (* Warning: the following let cannot be expanded since it forces the + right evaluation order!!!! *) + let w = (weight_of ty) + (weight_of left) + (weight_of right) in + (* let w = weight_of (Cic.Appl [ty;left;right]) in *) + w + !metasw +;; +*) + +(* returns a "normalized" version of the polynomial weight wl (with type + * weight list), i.e. a list sorted ascending by meta number, + * from 0 to maxmeta. wl must be sorted descending by meta number. Example: + * normalize_weight 5 (3, [(3, 2); (1, 1)]) -> + * (3, [(1, 1); (2, 0); (3, 2); (4, 0); (5, 0)]) *) +let normalize_weight maxmeta (cw, wl) = + let rec aux = function + | 0 -> [] + | m -> (m, 0)::(aux (m-1)) + in + let tmpl = aux maxmeta in + let wl = + List.sort + (fun (m, _) (n, _) -> Pervasives.compare m n) + (List.fold_left + (fun res (m, w) -> (m, w)::(List.remove_assoc m res)) tmpl wl) + in + (cw, wl) +;; + + +let normalize_weights (cw1, wl1) (cw2, wl2) = + let rec aux wl1 wl2 = + match wl1, wl2 with + | [], [] -> [], [] + | (m, w)::tl1, (n, w')::tl2 when m = n -> + let res1, res2 = aux tl1 tl2 in + (m, w)::res1, (n, w')::res2 + | (m, w)::tl1, ((n, w')::_ as wl2) when m < n -> + let res1, res2 = aux tl1 wl2 in + (m, w)::res1, (m, 0)::res2 + | ((m, w)::_ as wl1), (n, w')::tl2 when m > n -> + let res1, res2 = aux wl1 tl2 in + (n, 0)::res1, (n, w')::res2 + | [], (n, w)::tl2 -> + let res1, res2 = aux [] tl2 in + (n, 0)::res1, (n, w)::res2 + | (m, w)::tl1, [] -> + let res1, res2 = aux tl1 [] in + (m, w)::res1, (m, 0)::res2 + | _, _ -> assert false + in + let cmp (m, _) (n, _) = compare m n in + let wl1, wl2 = aux (List.sort cmp wl1) (List.sort cmp wl2) in + (cw1, wl1), (cw2, wl2) +;; + + +let compare_weights ?(normalize=false) + ((h1, w1) as weight1) ((h2, w2) as weight2)= + let (h1, w1), (h2, w2) = + if normalize then + normalize_weights weight1 weight2 + else + (h1, w1), (h2, w2) + in + let res, diffs = + try + List.fold_left2 + (fun ((lt, eq, gt), diffs) w1 w2 -> + match w1, w2 with + | (meta1, w1), (meta2, w2) when meta1 = meta2 -> + let diffs = (w1 - w2) + diffs in + let r = compare w1 w2 in + if r < 0 then (lt+1, eq, gt), diffs + else if r = 0 then (lt, eq+1, gt), diffs + else (lt, eq, gt+1), diffs + | (meta1, w1), (meta2, w2) -> + debug_print + (lazy + (Printf.sprintf "HMMM!!!! %s, %s\n" + (string_of_weight weight1) (string_of_weight weight2))); + assert false) + ((0, 0, 0), 0) w1 w2 + with Invalid_argument _ -> + debug_print + (lazy + (Printf.sprintf "Invalid_argument: %s{%s}, %s{%s}, normalize = %s\n" + (string_of_weight (h1, w1)) (string_of_weight weight1) + (string_of_weight (h2, w2)) (string_of_weight weight2) + (string_of_bool normalize))); + assert false + in + let hdiff = h1 - h2 in + match res with + | (0, _, 0) -> + if hdiff < 0 then Lt + else if hdiff > 0 then Gt + else Eq (* Incomparable *) + | (m, _, 0) -> + if hdiff <= 0 then Lt + else if (- diffs) >= hdiff then Le else Incomparable + | (0, _, m) -> + if hdiff >= 0 then Gt + else if diffs >= (- hdiff) then Ge else Incomparable + | (m, _, n) when m > 0 && n > 0 -> + Incomparable + | _ -> assert false +;; + + +let rec aux_ordering ?(recursion=true) t1 t2 = + let module C = Cic in + let compare_uris u1 u2 = + let res = + compare (UriManager.string_of_uri u1) (UriManager.string_of_uri u2) in + if res < 0 then Lt + else if res = 0 then Eq + else Gt + in + match t1, t2 with + | C.Meta _, _ + | _, C.Meta _ -> Incomparable + + | t1, t2 when t1 = t2 -> Eq + + | C.Rel n, C.Rel m -> if n > m then Lt else Gt + | C.Rel _, _ -> Lt + | _, C.Rel _ -> Gt + + | C.Const (u1, _), C.Const (u2, _) -> compare_uris u1 u2 + | C.Const _, _ -> Lt + | _, C.Const _ -> Gt + + | C.MutInd (u1, _, _), C.MutInd (u2, _, _) -> compare_uris u1 u2 + | C.MutInd _, _ -> Lt + | _, C.MutInd _ -> Gt + + | C.MutConstruct (u1, _, _, _), C.MutConstruct (u2, _, _, _) -> + compare_uris u1 u2 + | C.MutConstruct _, _ -> Lt + | _, C.MutConstruct _ -> Gt + + | C.Appl l1, C.Appl l2 when recursion -> + let rec cmp t1 t2 = + match t1, t2 with + | [], [] -> Eq + | _, [] -> Gt + | [], _ -> Lt + | hd1::tl1, hd2::tl2 -> + let o = aux_ordering hd1 hd2 in + if o = Eq then cmp tl1 tl2 + else o + in + cmp l1 l2 + | C.Appl (h1::t1), C.Appl (h2::t2) when not recursion -> + aux_ordering h1 h2 + + | t1, t2 -> + debug_print + (lazy + (Printf.sprintf "These two terms are not comparable:\n%s\n%s\n\n" + (CicPp.ppterm t1) (CicPp.ppterm t2))); + Incomparable +;; + + +(* w1, w2 are the weights, they should already be normalized... *) +let nonrec_kbo_w (t1, w1) (t2, w2) = + match compare_weights w1 w2 with + | Le -> if aux_ordering t1 t2 = Lt then Lt else Incomparable + | Ge -> if aux_ordering t1 t2 = Gt then Gt else Incomparable + | Eq -> aux_ordering t1 t2 + | res -> res +;; + + +let nonrec_kbo t1 t2 = + let w1 = weight_of_term t1 in + let w2 = weight_of_term t2 in + (* + prerr_endline ("weight1 :"^(string_of_weight w1)); + prerr_endline ("weight2 :"^(string_of_weight w2)); + *) + match compare_weights ~normalize:true w1 w2 with + | Le -> if aux_ordering t1 t2 = Lt then Lt else Incomparable + | Ge -> if aux_ordering t1 t2 = Gt then Gt else Incomparable + | Eq -> aux_ordering t1 t2 + | res -> res +;; + + +let rec kbo t1 t2 = + let aux = aux_ordering ~recursion:false in + let w1 = weight_of_term t1 + and w2 = weight_of_term t2 in + let rec cmp t1 t2 = + match t1, t2 with + | [], [] -> Eq + | _, [] -> Gt + | [], _ -> Lt + | hd1::tl1, hd2::tl2 -> + let o = + kbo hd1 hd2 + in + if o = Eq then cmp tl1 tl2 + else o + in + let comparison = compare_weights ~normalize:true w1 w2 in + match comparison with + | Le -> + let r = aux t1 t2 in + if r = Lt then Lt + else if r = Eq then ( + match t1, t2 with + | Cic.Appl (h1::tl1), Cic.Appl (h2::tl2) when h1 = h2 -> + if cmp tl1 tl2 = Lt then Lt else Incomparable + | _, _ -> Incomparable + ) else Incomparable + | Ge -> + let r = aux t1 t2 in + if r = Gt then Gt + else if r = Eq then ( + match t1, t2 with + | Cic.Appl (h1::tl1), Cic.Appl (h2::tl2) when h1 = h2 -> + if cmp tl1 tl2 = Gt then Gt else Incomparable + | _, _ -> Incomparable + ) else Incomparable + | Eq -> + let r = aux t1 t2 in + if r = Eq then ( + match t1, t2 with + | Cic.Appl (h1::tl1), Cic.Appl (h2::tl2) when h1 = h2 -> + cmp tl1 tl2 + | _, _ -> Incomparable + ) else r + | res -> res +;; + +let rec ao t1 t2 = + let get_hd t = + match t with + Cic.MutConstruct(uri,tyno,cno,_) -> Some(uri,tyno,cno) + | Cic.Appl(Cic.MutConstruct(uri,tyno,cno,_)::_) -> + Some(uri,tyno,cno) + | _ -> None in + let aux = aux_ordering ~recursion:false in + let w1 = weight_of_term t1 + and w2 = weight_of_term t2 in + let rec cmp t1 t2 = + match t1, t2 with + | [], [] -> Eq + | _, [] -> Gt + | [], _ -> Lt + | hd1::tl1, hd2::tl2 -> + let o = + ao hd1 hd2 + in + if o = Eq then cmp tl1 tl2 + else o + in + match get_hd t1, get_hd t2 with + Some(_),None -> Lt + | None,Some(_) -> Gt + | _ -> + let comparison = compare_weights ~normalize:true w1 w2 in + match comparison with + | Le -> + let r = aux t1 t2 in + if r = Lt then Lt + else if r = Eq then ( + match t1, t2 with + | Cic.Appl (h1::tl1), Cic.Appl (h2::tl2) when h1 = h2 -> + if cmp tl1 tl2 = Lt then Lt else Incomparable + | _, _ -> Incomparable + ) else Incomparable + | Ge -> + let r = aux t1 t2 in + if r = Gt then Gt + else if r = Eq then ( + match t1, t2 with + | Cic.Appl (h1::tl1), Cic.Appl (h2::tl2) when h1 = h2 -> + if cmp tl1 tl2 = Gt then Gt else Incomparable + | _, _ -> Incomparable + ) else Incomparable + | Eq -> + let r = aux t1 t2 in + if r = Eq then ( + match t1, t2 with + | Cic.Appl (h1::tl1), Cic.Appl (h2::tl2) when h1 = h2 -> + cmp tl1 tl2 + | _, _ -> Incomparable + ) else r + | res -> res +;; + +let names_of_context context = + List.map + (function + | None -> None + | Some (n, e) -> Some n) + context +;; + + +let rec lpo t1 t2 = + let module C = Cic in + match t1, t2 with + | t1, t2 when t1 = t2 -> Eq + | t1, (C.Meta _ as m) -> + if TermSet.mem m (metas_of_term t1) then Gt else Incomparable + | (C.Meta _ as m), t2 -> + if TermSet.mem m (metas_of_term t2) then Lt else Incomparable + | C.Appl (hd1::tl1), C.Appl (hd2::tl2) -> ( + let res = + let f o r t = + if r then true else + match lpo t o with + | Gt | Eq -> true + | _ -> false + in + let res1 = List.fold_left (f t2) false tl1 in + if res1 then Gt + else let res2 = List.fold_left (f t1) false tl2 in + if res2 then Lt + else Incomparable + in + if res <> Incomparable then + res + else + let f o r t = + if not r then false else + match lpo o t with + | Gt -> true + | _ -> false + in + match aux_ordering hd1 hd2 with + | Gt -> + let res = List.fold_left (f t1) false tl2 in + if res then Gt + else Incomparable + | Lt -> + let res = List.fold_left (f t2) false tl1 in + if res then Lt + else Incomparable + | Eq -> ( + let lex_res = + try + List.fold_left2 + (fun r t1 t2 -> if r <> Eq then r else lpo t1 t2) + Eq tl1 tl2 + with Invalid_argument _ -> + Incomparable + in + match lex_res with + | Gt -> + if List.fold_left (f t1) false tl2 then Gt + else Incomparable + | Lt -> + if List.fold_left (f t2) false tl1 then Lt + else Incomparable + | _ -> Incomparable + ) + | _ -> Incomparable + ) + | t1, t2 -> aux_ordering t1 t2 +;; + + +(* settable by the user... *) +let compare_terms = ref nonrec_kbo;; +(* let compare_terms = ref ao;; *) +(* let compare_terms = ref rpo;; *) + +let guarded_simpl ?(debug=false) context t = + if !compare_terms == nonrec_kbo then t + else + let t' = ProofEngineReduction.simpl context t in + if t = t' then t else + begin + let simpl_order = !compare_terms t t' in + debug_print (lazy ("comparing "^(CicPp.ppterm t)^(CicPp.ppterm t'))); + if simpl_order = Gt then (if debug then prerr_endline "GT";t') + else (if debug then prerr_endline "NO_GT";t) + end +;; + +type pos = Left | Right + +let string_of_pos = function + | Left -> "Left" + | Right -> "Right" +;; + +let metas_of_term t = + List.map fst (CicUtil.metas_of_term t) +;; + diff --git a/components/tactics/paramodulation/utils.mli b/components/tactics/paramodulation/utils.mli new file mode 100644 index 000000000..2f25415ac --- /dev/null +++ b/components/tactics/paramodulation/utils.mli @@ -0,0 +1,89 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* (weight of constants, [(meta, weight_of_meta)]) *) + +val time : bool +val debug : bool +val debug_metas: bool +val debug_res: bool + +type weight = int * (int * int) list;; + +type comparison = Lt | Le | Eq | Ge | Gt | Incomparable;; + +type environment = Cic.metasenv * Cic.context * CicUniv.universe_graph + +val print_metasenv: Cic.metasenv -> string + +val print_subst: ?prefix:string -> Cic.substitution -> string + +val string_of_weight: weight -> string + +val weight_of_term: + ?consider_metas:bool -> + ?count_metas_occurrences:bool-> Cic.term -> weight + +val normalize_weight: int -> weight -> weight + +val string_of_comparison: comparison -> string + +val compare_weights: ?normalize:bool -> weight -> weight -> comparison + +val nonrec_kbo: Cic.term -> Cic.term -> comparison + +val rpo: Cic.term -> Cic.term -> comparison + +val nonrec_kbo_w: (Cic.term * weight) -> (Cic.term * weight) -> comparison + +val names_of_context: Cic.context -> (Cic.name option) list + +module TermMap: Map.S with type key = Cic.term + +val symbols_of_term: Cic.term -> int TermMap.t +val set_goal_symbols: Cic.term -> unit + +val lpo: Cic.term -> Cic.term -> comparison + +val kbo: Cic.term -> Cic.term -> comparison + +val ao: Cic.term -> Cic.term -> comparison + +(** term-ordering function settable by the user *) +val compare_terms: (Cic.term -> Cic.term -> comparison) ref + +val guarded_simpl: ?debug:bool -> Cic.context -> Cic.term -> Cic.term + +type pos = Left | Right + +val string_of_pos: pos -> string + +val compute_equality_weight: Cic.term * Cic.term * Cic.term * comparison -> int + +val debug_print: string Lazy.t -> unit + +val metas_of_term: Cic.term -> int list + +val remove_local_context: Cic.term -> Cic.term diff --git a/components/tactics/primitiveTactics.ml b/components/tactics/primitiveTactics.ml new file mode 100644 index 000000000..47acc7c58 --- /dev/null +++ b/components/tactics/primitiveTactics.ml @@ -0,0 +1,894 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +exception TheTypeOfTheCurrentGoalIsAMetaICannotChooseTheRightElimiantionPrinciple +exception NotAnInductiveTypeToEliminate +exception WrongUriToVariable of string +exception NotAnEliminator + +module PET = ProofEngineTypes + +(* lambda_abstract newmeta ty *) +(* returns a triple [bo],[context],[ty'] where *) +(* [ty] = Pi/LetIn [context].[ty'] ([context] is a vector!) *) +(* and [bo] = Lambda/LetIn [context].(Meta [newmeta]) *) +(* So, lambda_abstract is the core of the implementation of *) +(* the Intros tactic. *) +(* howmany = -1 means Intros, howmany > 0 means Intros n *) +let lambda_abstract ?(howmany=(-1)) metasenv context newmeta ty mk_fresh_name = + let module C = Cic in + let rec collect_context context howmany do_whd ty = + match howmany with + | 0 -> + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context + in + context, ty, (C.Meta (newmeta,irl)) + | _ -> + match ty with + C.Cast (te,_) -> collect_context context howmany do_whd te + | C.Prod (n,s,t) -> + let n' = mk_fresh_name metasenv context n ~typ:s in + let (context',ty,bo) = + let entry = match n' with + | C.Name _ -> Some (n',(C.Decl s)) + | C.Anonymous -> None + in + let ctx = entry :: context in + collect_context ctx (howmany - 1) do_whd t + in + (context',ty,C.Lambda(n',s,bo)) + | C.LetIn (n,s,t) -> + let (context',ty,bo) = + collect_context ((Some (n,(C.Def (s,None))))::context) (howmany - 1) do_whd t + in + (context',ty,C.LetIn(n,s,bo)) + | _ as t -> + if howmany <= 0 then + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context + in + context, t, (C.Meta (newmeta,irl)) + else if do_whd then + let t = CicReduction.whd ~delta:true context t in + collect_context context howmany false t + else + raise (PET.Fail (lazy "intro(s): not enough products or let-ins")) + in + collect_context context howmany true ty + +let eta_expand metasenv context t arg = + let module T = CicTypeChecker in + let module S = CicSubstitution in + let module C = Cic in + let rec aux n = + function + t' when t' = S.lift n arg -> C.Rel (1 + n) + | C.Rel m -> if m <= n then C.Rel m else C.Rel (m+1) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = aux_exp_named_subst n exp_named_subst in + C.Var (uri,exp_named_subst') + | C.Meta (i,l) -> + let l' = + List.map (function None -> None | Some t -> Some (aux n t)) l + in + C.Meta (i, l') + | C.Sort _ + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (aux n te, aux n ty) + | C.Prod (nn,s,t) -> C.Prod (nn, aux n s, aux (n+1) t) + | C.Lambda (nn,s,t) -> C.Lambda (nn, aux n s, aux (n+1) t) + | C.LetIn (nn,s,t) -> C.LetIn (nn, aux n s, aux (n+1) t) + | C.Appl l -> C.Appl (List.map (aux n) l) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = aux_exp_named_subst n exp_named_subst in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,i,exp_named_subst) -> + let exp_named_subst' = aux_exp_named_subst n exp_named_subst in + C.MutInd (uri,i,exp_named_subst') + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let exp_named_subst' = aux_exp_named_subst n exp_named_subst in + C.MutConstruct (uri,i,j,exp_named_subst') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,aux n outt, aux n t, + List.map (aux n) pl) + | C.Fix (i,fl) -> + let tylen = List.length fl in + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> (name, i, aux n ty, aux (n+tylen) bo)) + fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let tylen = List.length fl in + let substitutedfl = + List.map + (fun (name,ty,bo) -> (name, aux n ty, aux (n+tylen) bo)) + fl + in + C.CoFix (i, substitutedfl) + and aux_exp_named_subst n = + List.map (function uri,t -> uri,aux n t) + in + let argty,_ = + T.type_of_aux' metasenv context arg CicUniv.empty_ugraph (* TASSI: FIXME *) + in + let fresh_name = + FreshNamesGenerator.mk_fresh_name ~subst:[] + metasenv context (Cic.Name "Heta") ~typ:argty + in + (C.Appl [C.Lambda (fresh_name,argty,aux 0 t) ; arg]) + +(*CSC: ma serve solamente la prima delle new_uninst e l'unione delle due!!! *) +let classify_metas newmeta in_subst_domain subst_in metasenv = + List.fold_right + (fun (i,canonical_context,ty) (old_uninst,new_uninst) -> + if in_subst_domain i then + old_uninst,new_uninst + else + let ty' = subst_in canonical_context ty in + let canonical_context' = + List.fold_right + (fun entry canonical_context' -> + let entry' = + match entry with + Some (n,Cic.Decl s) -> + Some (n,Cic.Decl (subst_in canonical_context' s)) + | Some (n,Cic.Def (s,None)) -> + Some (n,Cic.Def ((subst_in canonical_context' s),None)) + | None -> None + | Some (n,Cic.Def (bo,Some ty)) -> + Some + (n, + Cic.Def + (subst_in canonical_context' bo, + Some (subst_in canonical_context' ty))) + in + entry'::canonical_context' + ) canonical_context [] + in + if i < newmeta then + ((i,canonical_context',ty')::old_uninst),new_uninst + else + old_uninst,((i,canonical_context',ty')::new_uninst) + ) metasenv ([],[]) + +(* Useful only inside apply_tac *) +let + generalize_exp_named_subst_with_fresh_metas context newmeta uri exp_named_subst += + let module C = Cic in + let params = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + CicUtil.params_of_obj o + in + let exp_named_subst_diff,new_fresh_meta,newmetasenvfragment,exp_named_subst'= + let next_fresh_meta = ref newmeta in + let newmetasenvfragment = ref [] in + let exp_named_subst_diff = ref [] in + let rec aux = + function + [],[] -> [] + | uri::tl,[] -> + let ty = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.Variable (_,_,ty,_,_) -> + CicSubstitution.subst_vars !exp_named_subst_diff ty + | _ -> raise (WrongUriToVariable (UriManager.string_of_uri uri)) + in +(* CSC: patch to generate ?1 : ?2 : Type in place of ?1 : Type to simulate ?1 :< Type + (match ty with + C.Sort (C.Type _) as s -> (* TASSI: ?? *) + let fresh_meta = !next_fresh_meta in + let fresh_meta' = fresh_meta + 1 in + next_fresh_meta := !next_fresh_meta + 2 ; + let subst_item = uri,C.Meta (fresh_meta',[]) in + newmetasenvfragment := + (fresh_meta,[],C.Sort (C.Type (CicUniv.fresh()))) :: + (* TASSI: ?? *) + (fresh_meta',[],C.Meta (fresh_meta,[])) :: !newmetasenvfragment ; + exp_named_subst_diff := !exp_named_subst_diff @ [subst_item] ; + subst_item::(aux (tl,[])) + | _ -> +*) + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable context + in + let subst_item = uri,C.Meta (!next_fresh_meta,irl) in + newmetasenvfragment := + (!next_fresh_meta,context,ty)::!newmetasenvfragment ; + exp_named_subst_diff := !exp_named_subst_diff @ [subst_item] ; + incr next_fresh_meta ; + subst_item::(aux (tl,[]))(*)*) + | uri::tl1,((uri',_) as s)::tl2 -> + assert (UriManager.eq uri uri') ; + s::(aux (tl1,tl2)) + | [],_ -> assert false + in + let exp_named_subst' = aux (params,exp_named_subst) in + !exp_named_subst_diff,!next_fresh_meta, + List.rev !newmetasenvfragment, exp_named_subst' + in + new_fresh_meta,newmetasenvfragment,exp_named_subst',exp_named_subst_diff +;; + +let new_metasenv_and_unify_and_t newmeta' metasenv' subst context term' ty termty goal_arity = + let (consthead,newmetasenv,arguments,_) = + TermUtil.saturate_term newmeta' metasenv' context termty + goal_arity in + let subst,newmetasenv',_ = + CicUnification.fo_unif_subst + subst context newmetasenv consthead ty CicUniv.empty_ugraph + in + let t = + if List.length arguments = 0 then term' else Cic.Appl (term'::arguments) + in + subst,newmetasenv',t + +let rec count_prods context ty = + match CicReduction.whd context ty with + Cic.Prod (n,s,t) -> 1 + count_prods (Some (n,Cic.Decl s)::context) t + | _ -> 0 + +let apply_with_subst ~term ~subst ~maxmeta (proof, goal) = + (* Assumption: The term "term" must be closed in the current context *) + let module T = CicTypeChecker in + let module R = CicReduction in + let module C = Cic in + let (_,metasenv,_subst,_,_, _) = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let newmeta = max (CicMkImplicit.new_meta metasenv subst) maxmeta in + let exp_named_subst_diff,newmeta',newmetasenvfragment,term' = + match term with + C.Var (uri,exp_named_subst) -> + let newmeta',newmetasenvfragment,exp_named_subst',exp_named_subst_diff = + generalize_exp_named_subst_with_fresh_metas context newmeta uri + exp_named_subst + in + exp_named_subst_diff,newmeta',newmetasenvfragment, + C.Var (uri,exp_named_subst') + | C.Const (uri,exp_named_subst) -> + let newmeta',newmetasenvfragment,exp_named_subst',exp_named_subst_diff = + generalize_exp_named_subst_with_fresh_metas context newmeta uri + exp_named_subst + in + exp_named_subst_diff,newmeta',newmetasenvfragment, + C.Const (uri,exp_named_subst') + | C.MutInd (uri,tyno,exp_named_subst) -> + let newmeta',newmetasenvfragment,exp_named_subst',exp_named_subst_diff = + generalize_exp_named_subst_with_fresh_metas context newmeta uri + exp_named_subst + in + exp_named_subst_diff,newmeta',newmetasenvfragment, + C.MutInd (uri,tyno,exp_named_subst') + | C.MutConstruct (uri,tyno,consno,exp_named_subst) -> + let newmeta',newmetasenvfragment,exp_named_subst',exp_named_subst_diff = + generalize_exp_named_subst_with_fresh_metas context newmeta uri + exp_named_subst + in + exp_named_subst_diff,newmeta',newmetasenvfragment, + C.MutConstruct (uri,tyno,consno,exp_named_subst') + | _ -> [],newmeta,[],term + in + let metasenv' = metasenv@newmetasenvfragment in + let termty,_ = + CicTypeChecker.type_of_aux' metasenv' context term' CicUniv.empty_ugraph + in + let termty = + CicSubstitution.subst_vars exp_named_subst_diff termty in + let goal_arity = count_prods context ty in + let subst,newmetasenv',t = + let rec add_one_argument n = + try + new_metasenv_and_unify_and_t newmeta' metasenv' subst context term' ty + termty n + with CicUnification.UnificationFailure _ when n > 0 -> + add_one_argument (n - 1) + in + add_one_argument goal_arity + in + let in_subst_domain i = List.exists (function (j,_) -> i=j) subst in + let apply_subst = CicMetaSubst.apply_subst subst in + let old_uninstantiatedmetas,new_uninstantiatedmetas = + (* subst_in doesn't need the context. Hence the underscore. *) + let subst_in _ = CicMetaSubst.apply_subst subst in + classify_metas newmeta in_subst_domain subst_in newmetasenv' + in + let bo' = apply_subst t in + let newmetasenv'' = new_uninstantiatedmetas@old_uninstantiatedmetas in + let subst_in = + (* if we just apply the subtitution, the type is irrelevant: + we may use Implicit, since it will be dropped *) + ((metano,(context,bo',Cic.Implicit None))::subst) + in + let (newproof, newmetasenv''') = + ProofEngineHelpers.subst_meta_and_metasenv_in_proof proof metano subst_in + newmetasenv'' + in + let subst = ((metano,(context,bo',ty))::subst) in + subst, + (newproof, List.map (function (i,_,_) -> i) new_uninstantiatedmetas), + max maxmeta (CicMkImplicit.new_meta newmetasenv''' subst) + + +(* ALB *) +let apply_with_subst ~term ?(subst=[]) ?(maxmeta=0) status = + try +(* apply_tac_verbose ~term status *) + apply_with_subst ~term ~subst ~maxmeta status + (* TODO cacciare anche altre eccezioni? *) + with + | CicUnification.UnificationFailure msg + | CicTypeChecker.TypeCheckerFailure msg -> raise (PET.Fail msg) + +(* ALB *) +let apply_tac_verbose ~term status = + let subst, status, _ = apply_with_subst ~term status in + (CicMetaSubst.apply_subst subst), status + +let apply_tac ~term status = snd (apply_tac_verbose ~term status) + + (* TODO per implementare i tatticali e' necessario che tutte le tattiche + sollevino _solamente_ Fail *) +let apply_tac ~term = + let apply_tac ~term status = + try + apply_tac ~term status + (* TODO cacciare anche altre eccezioni? *) + with + | CicUnification.UnificationFailure msg + | CicTypeChecker.TypeCheckerFailure msg -> + raise (PET.Fail msg) + in + PET.mk_tactic (apply_tac ~term) + +let intros_tac ?howmany ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) ()= + let intros_tac (proof, goal) + = + let module C = Cic in + let module R = CicReduction in + let (_,metasenv,_subst,_,_, _) = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let newmeta = ProofEngineHelpers.new_meta_of_proof ~proof in + let (context',ty',bo') = + lambda_abstract ?howmany metasenv context newmeta ty mk_fresh_name_callback + in + let (newproof, _) = + ProofEngineHelpers.subst_meta_in_proof proof metano bo' + [newmeta,context',ty'] + in + (newproof, [newmeta]) + in + PET.mk_tactic intros_tac + +let cut_tac ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) term = + let cut_tac + ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) + term (proof, goal) + = + let module C = Cic in + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let newmeta1 = ProofEngineHelpers.new_meta_of_proof ~proof in + let newmeta2 = newmeta1 + 1 in + let fresh_name = + mk_fresh_name_callback metasenv context (Cic.Name "Hcut") ~typ:term in + let context_for_newmeta1 = + (Some (fresh_name,C.Decl term))::context in + let irl1 = + CicMkImplicit.identity_relocation_list_for_metavariable + context_for_newmeta1 + in + let irl2 = + CicMkImplicit.identity_relocation_list_for_metavariable context + in + let newmeta1ty = CicSubstitution.lift 1 ty in +(* This is the pre-letin implementation + let bo' = + C.Appl + [C.Lambda (fresh_name,term,C.Meta (newmeta1,irl1)) ; + C.Meta (newmeta2,irl2)] + in +*) + let bo' = + Cic.LetIn (fresh_name, C.Meta (newmeta2,irl2), C.Meta (newmeta1,irl1)) + in + let (newproof, _) = + ProofEngineHelpers.subst_meta_in_proof proof metano bo' + [newmeta2,context,term; newmeta1,context_for_newmeta1,newmeta1ty]; + in + (newproof, [newmeta1 ; newmeta2]) + in + PET.mk_tactic (cut_tac ~mk_fresh_name_callback term) + +let letin_tac ?(mk_fresh_name_callback=FreshNamesGenerator.mk_fresh_name ~subst:[]) term = + let letin_tac + ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) + term (proof, goal) + = + let module C = Cic in + let curi,metasenv,_subst,pbo,pty, attrs = proof in + (* occur check *) + let occur i t = + let m = CicUtil.metas_of_term t in + List.exists (fun (j,_) -> i=j) m + in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + if occur metano term then + raise + (ProofEngineTypes.Fail (lazy + "You can't letin a term containing the current goal")); + let _,_ = + CicTypeChecker.type_of_aux' metasenv context term CicUniv.empty_ugraph in + let newmeta = ProofEngineHelpers.new_meta_of_proof ~proof in + let fresh_name = + mk_fresh_name_callback metasenv context (Cic.Name "Hletin") ~typ:term in + let context_for_newmeta = + (Some (fresh_name,C.Def (term,None)))::context in + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable + context_for_newmeta + in + let newmetaty = CicSubstitution.lift 1 ty in + let bo' = C.LetIn (fresh_name,term,C.Meta (newmeta,irl)) in + let (newproof, _) = + ProofEngineHelpers.subst_meta_in_proof + proof metano bo'[newmeta,context_for_newmeta,newmetaty] + in + (newproof, [newmeta]) + in + PET.mk_tactic (letin_tac ~mk_fresh_name_callback term) + + (** functional part of the "exact" tactic *) +let exact_tac ~term = + let exact_tac ~term (proof, goal) = + (* Assumption: the term bo must be closed in the current context *) + let (_,metasenv,_subst,_,_, _) = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let module T = CicTypeChecker in + let module R = CicReduction in + let ty_term,u = T.type_of_aux' metasenv context term CicUniv.empty_ugraph in + let b,_ = R.are_convertible context ty_term ty u in (* TASSI: FIXME *) + if b then + begin + let (newproof, metasenv') = + ProofEngineHelpers.subst_meta_in_proof proof metano term [] in + (newproof, []) + end + else + raise (PET.Fail (lazy "The type of the provided term is not the one expected.")) + in + PET.mk_tactic (exact_tac ~term) + +(* not really "primitive" tactics .... *) + +module TC = CicTypeChecker +module UM = UriManager +module R = CicReduction +module C = Cic +module PEH = ProofEngineHelpers +module PER = ProofEngineReduction +module MS = CicMetaSubst +module S = CicSubstitution +module T = Tacticals +module RT = ReductionTactics + +let rec args_init n f = + if n <= 0 then [] else f n :: args_init (pred n) f + +let mk_predicate_for_elim + ~context ~metasenv ~ugraph ~goal ~arg ~using ~cpattern ~args_no = + let instantiated_eliminator = + let f n = if n = 1 then arg else C.Implicit None in + C.Appl (using :: args_init args_no f) + in + let _actual_arg, iety, _metasenv', _ugraph = + CicRefine.type_of_aux' metasenv context instantiated_eliminator ugraph + in + let _actual_meta, actual_args = match iety with + | C.Meta (i, _) -> i, [] + | C.Appl (C.Meta (i, _) :: args) -> i, args + | _ -> assert false + in +(* let _, upto = PEH.split_with_whd (List.nth splits pred_pos) in *) + let rec mk_pred metasenv context' pred arg' cpattern' = function + | [] -> metasenv, pred, arg' + | arg :: tail -> +(* FG: we find the predicate for the eliminator as in the rewrite tactic ****) + let argty, _ugraph = TC.type_of_aux' metasenv context arg ugraph in + let argty = CicReduction.whd context argty in + let fresh_name = + FreshNamesGenerator.mk_fresh_name + ~subst:[] metasenv context' C.Anonymous ~typ:argty + in + let hyp = Some (fresh_name, C.Decl argty) in + let lazy_term c m u = + let distance = List.length c - List.length context in + S.lift distance arg, m, u + in + let pattern = Some lazy_term, [], Some cpattern' in + let subst, metasenv, _ugraph, _conjecture, selected_terms = + ProofEngineHelpers.select + ~metasenv ~ugraph ~conjecture:(0, context, pred) ~pattern + in + let metasenv = MS.apply_subst_metasenv subst metasenv in + let map (_context_of_t, t) l = t :: l in + let what = List.fold_right map selected_terms [] in + let arg' = MS.apply_subst subst arg' in + let argty = MS.apply_subst subst argty in + let pred = PER.replace_with_rel_1_from ~equality:(==) ~what 1 pred in + let pred = MS.apply_subst subst pred in + let pred = C.Lambda (fresh_name, argty, pred) in + let cpattern' = C.Lambda (C.Anonymous, C.Implicit None, cpattern') in + mk_pred metasenv (hyp :: context') pred arg' cpattern' tail + in + let metasenv, pred, arg = + mk_pred metasenv context goal arg cpattern (List.rev actual_args) + in + HLog.debug ("PREDICATE: " ^ CicPp.ppterm ~metasenv pred ^ " ARGS: " ^ String.concat " " (List.map (CicPp.ppterm ~metasenv) actual_args)); + metasenv, pred, arg, actual_args + +let beta_after_elim_tac upto predicate = + let beta_after_elim_tac status = + let proof, goal = status in + let _, metasenv, _subst, _, _, _ = proof in + let _, _, ty = CicUtil.lookup_meta goal metasenv in + let mk_pattern ~equality ~upto ~predicate ty = + (* code adapted from ProceduralConversion.generalize *) + let meta = C.Implicit None in + let hole = C.Implicit (Some `Hole) in + let anon = C.Anonymous in + let is_meta = + let map b = function + | C.Implicit None when b -> b + | _ -> false + in + List.fold_left map true + in + let rec gen_fix len k (name, i, ty, bo) = + name, i, gen_term k ty, gen_term (k + len) bo + and gen_cofix len k (name, ty, bo) = + name, gen_term k ty, gen_term (k + len) bo + and gen_term k = function + | C.Sort _ + | C.Implicit _ + | C.Const (_, _) + | C.Var (_, _) + | C.MutInd (_, _, _) + | C.MutConstruct (_, _, _, _) + | C.Meta (_, _) + | C.Rel _ -> meta + | C.Appl (hd :: tl) when equality hd (S.lift k predicate) -> + assert (List.length tl = upto); + hole + | C.Appl ts -> + let ts = List.map (gen_term k) ts in + if is_meta ts then meta else C.Appl ts + | C.Cast (te, ty) -> + let te, ty = gen_term k te, gen_term k ty in + if is_meta [te; ty] then meta else C.Cast (te, ty) + | C.MutCase (sp, i, outty, t, pl) -> + let outty, t, pl = gen_term k outty, gen_term k t, List.map (gen_term k) pl in + if is_meta (outty :: t :: pl) then meta else hole (* C.MutCase (sp, i, outty, t, pl) *) + | C.Prod (_, s, t) -> + let s, t = gen_term k s, gen_term (succ k) t in + if is_meta [s; t] then meta else C.Prod (anon, s, t) + | C.Lambda (_, s, t) -> + let s, t = gen_term k s, gen_term (succ k) t in + if is_meta [s; t] then meta else C.Lambda (anon, s, t) + | C.LetIn (_, s, t) -> + let s, t = gen_term k s, gen_term (succ k) t in + if is_meta [s; t] then meta else C.LetIn (anon, s, t) + | C.Fix (i, fl) -> C.Fix (i, List.map (gen_fix (List.length fl) k) fl) + | C.CoFix (i, fl) -> C.CoFix (i, List.map (gen_cofix (List.length fl) k) fl) + in + None, [], Some (gen_term 0 ty) + in + let equality = CicUtil.alpha_equivalence in + let pattern = mk_pattern ~equality ~upto ~predicate ty in + let tactic = RT.head_beta_reduce_tac ~delta:false ~upto ~pattern in + PET.apply_tactic tactic status + in + PET.mk_tactic beta_after_elim_tac + +let elim_tac ?using ?(pattern = PET.conclusion_pattern None) term = + let elim_tac (proof, goal) = + let cpattern = match pattern with + | None, [], Some cpattern -> cpattern + | _ -> raise (PET.Fail (lazy "not implemented")) + in + let ugraph = CicUniv.empty_ugraph in + let curi, metasenv, _subst, proofbo, proofty, attrs = proof in + let conjecture = CicUtil.lookup_meta goal metasenv in + let metano, context, ty = conjecture in + let termty,_ugraph = TC.type_of_aux' metasenv context term ugraph in + let termty = CicReduction.whd context termty in + let termty, metasenv', arguments, _fresh_meta = + TermUtil.saturate_term + (ProofEngineHelpers.new_meta_of_proof proof) metasenv context termty 0 in + let term = if arguments = [] then term else Cic.Appl (term::arguments) in + let uri, exp_named_subst, typeno, _args = + match termty with + C.MutInd (uri,typeno,exp_named_subst) -> (uri,exp_named_subst,typeno,[]) + | C.Appl ((C.MutInd (uri,typeno,exp_named_subst))::args) -> + (uri,exp_named_subst,typeno,args) + | _ -> raise NotAnInductiveTypeToEliminate + in + let eliminator_uri = + let buri = UM.buri_of_uri uri in + let name = + let o,_ugraph = CicEnvironment.get_obj ugraph uri in + match o with + C.InductiveDefinition (tys,_,_,_) -> + let (name,_,_,_) = List.nth tys typeno in + name + | _ -> assert false + in + let ty_ty,_ugraph = TC.type_of_aux' metasenv' context ty ugraph in + let ext = + match ty_ty with + C.Sort C.Prop -> "_ind" + | C.Sort C.Set -> "_rec" + | C.Sort C.CProp -> "_rec" + | C.Sort (C.Type _)-> "_rect" + | C.Meta (_,_) -> raise TheTypeOfTheCurrentGoalIsAMetaICannotChooseTheRightElimiantionPrinciple + | _ -> assert false + in + UM.uri_of_string (buri ^ "/" ^ name ^ ext ^ ".con") + in + let eliminator_ref = match using with + | None -> C.Const (eliminator_uri, exp_named_subst) + | Some t -> t + in + let ety, _ugraph = + TC.type_of_aux' metasenv' context eliminator_ref ugraph in +(* FG: ADDED PART ***********************************************************) +(* FG: we can not assume eliminator is the default eliminator ***************) + let splits, args_no = PEH.split_with_whd (context, ety) in + let pred_pos = match List.hd splits with + | _, C.Rel i when i > 1 && i <= args_no -> i + | _, C.Appl (C.Rel i :: _) when i > 1 && i <= args_no -> i + | _ -> raise NotAnEliminator + in + let metasenv', pred, term, actual_args = match pattern with + | None, [], Some (C.Implicit (Some `Hole)) -> + metasenv', C.Implicit None, term, [] + | _ -> + mk_predicate_for_elim + ~args_no ~context ~ugraph ~cpattern + ~metasenv:metasenv' ~arg:term ~using:eliminator_ref ~goal:ty + in +(* FG: END OF ADDED PART ****************************************************) + let term_to_refine = + let f n = + if n = pred_pos then pred else + if n = 1 then term else C.Implicit None + in + C.Appl (eliminator_ref :: args_init args_no f) + in + let refined_term,_refined_termty,metasenv'',_ugraph = + CicRefine.type_of_aux' metasenv' context term_to_refine ugraph + in + let new_goals = + ProofEngineHelpers.compare_metasenvs + ~oldmetasenv:metasenv ~newmetasenv:metasenv'' + in + let proof' = curi,metasenv'',_subst,proofbo,proofty, attrs in + let proof'', new_goals' = + PET.apply_tactic (apply_tac ~term:refined_term) (proof',goal) + in + (* The apply_tactic can have closed some of the new_goals *) + let patched_new_goals = + let (_,metasenv''',_subst,_,_, _) = proof'' in + List.filter + (function i -> List.exists (function (j,_,_) -> j=i) metasenv''') + new_goals @ new_goals' + in + let res = proof'', patched_new_goals in + let upto = List.length actual_args in + if upto = 0 then res else + let continuation = beta_after_elim_tac upto pred in + let dummy_status = proof,goal in + PET.apply_tactic + (T.then_ ~start:(PET.mk_tactic (fun _ -> res)) ~continuation) + dummy_status + in + PET.mk_tactic elim_tac +;; + +let cases_intros_tac ?(howmany=(-1)) ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) term = + let cases_tac ~term (proof, goal) = + let module TC = CicTypeChecker in + let module U = UriManager in + let module R = CicReduction in + let module C = Cic in + let (curi,metasenv,_subst, proofbo,proofty, attrs) = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + let termty,_ = TC.type_of_aux' metasenv context term CicUniv.empty_ugraph in + let termty = CicReduction.whd context termty in + let (termty,metasenv',arguments,fresh_meta) = + TermUtil.saturate_term + (ProofEngineHelpers.new_meta_of_proof proof) metasenv context termty 0 in + let term = if arguments = [] then term else Cic.Appl (term::arguments) in + let uri,exp_named_subst,typeno,args = + match termty with + | C.MutInd (uri,typeno,exp_named_subst) -> (uri,exp_named_subst,typeno,[]) + | C.Appl ((C.MutInd (uri,typeno,exp_named_subst))::args) -> + (uri,exp_named_subst,typeno,args) + | _ -> raise NotAnInductiveTypeToEliminate + in + let paramsno,itty,patterns,right_args = + match CicEnvironment.get_obj CicUniv.empty_ugraph uri with + | C.InductiveDefinition (tys,_,paramsno,_),_ -> + let _,left_parameters,right_args = + List.fold_right + (fun x (n,acc1,acc2) -> + if n > 0 then (n-1,acc1,x::acc2) else (n,x::acc1,acc2)) + args (List.length args - paramsno, [],[]) + in + let _,_,itty,cl = List.nth tys typeno in + let rec aux left_parameters context t = + match left_parameters,CicReduction.whd context t with + | [],C.Prod (name,source,target) -> + let fresh_name = + mk_fresh_name_callback metasenv' context name ~typ:source + in + C.Lambda (fresh_name,C.Implicit None, + aux [] (Some (fresh_name,C.Decl source)::context) target) + | hd::tl,C.Prod (name,source,target) -> + (* left parameters instantiation *) + aux tl context (CicSubstitution.subst hd target) + | [],_ -> C.Implicit None + | _ -> assert false + in + paramsno,itty, + List.map (function (_,cty) -> aux left_parameters context cty) cl, + right_args + | _ -> assert false + in + let outtype = + let n_right_args = List.length right_args in + let n_lambdas = n_right_args + 1 in + let lifted_ty = CicSubstitution.lift n_lambdas ty in + let captured_ty = + let what = + List.map (CicSubstitution.lift n_lambdas) (right_args) + in + let with_what meta = + let rec mkargs = function + | 0 -> assert false + | 1 -> [] + | n -> + (if meta then Cic.Implicit None else Cic.Rel n)::(mkargs (n-1)) + in + mkargs n_lambdas + in + let replaced = ref false in + let replace = ProofEngineReduction.replace_lifting + ~equality:(fun _ a b -> let rc = CicUtil.alpha_equivalence a b in + if rc then replaced := true; rc) + ~context:[] + in + let captured = + replace ~what:[CicSubstitution.lift n_lambdas term] + ~with_what:[Cic.Rel 1] ~where:lifted_ty + in + if not !replaced then + (* this means the matched term is not there, + * but maybe right params are: we user rels (to right args lambdas) *) + replace ~what ~with_what:(with_what false) ~where:captured + else + (* since the matched is there, rights should be inferrable *) + replace ~what ~with_what:(with_what true) ~where:captured + in + let captured_term_ty = + let term_ty = CicSubstitution.lift n_right_args termty in + let rec mkrels = function 0 -> []|n -> (Cic.Rel n)::(mkrels (n-1)) in + let rec fstn acc l n = + if n = 0 then acc else fstn (acc@[List.hd l]) (List.tl l) (n-1) + in + match term_ty with + | C.MutInd _ -> term_ty + | C.Appl ((C.MutInd (a,b,c))::args) -> + C.Appl ((C.MutInd (a,b,c)):: + fstn [] args paramsno @ mkrels n_right_args) + | _ -> raise NotAnInductiveTypeToEliminate + in + let rec add_lambdas = function + | 0 -> captured_ty + | 1 -> + C.Lambda (C.Name "matched", captured_term_ty, (add_lambdas 0)) + | n -> + C.Lambda (C.Name ("right_"^(string_of_int (n-1))), + C.Implicit None, (add_lambdas (n-1))) + in + add_lambdas n_lambdas + in + let term_to_refine = C.MutCase (uri,typeno,outtype,term,patterns) in + let refined_term,_,metasenv'',_ = + CicRefine.type_of_aux' metasenv' context term_to_refine + CicUniv.empty_ugraph + in + let new_goals = + ProofEngineHelpers.compare_metasenvs + ~oldmetasenv:metasenv ~newmetasenv:metasenv'' + in + let proof' = curi,metasenv'',_subst,proofbo,proofty, attrs in + let proof'', new_goals' = + PET.apply_tactic (apply_tac ~term:refined_term) (proof',goal) + in + (* The apply_tactic can have closed some of the new_goals *) + let patched_new_goals = + let (_,metasenv''',_subst,_,_,_) = proof'' in + List.filter + (function i -> List.exists (function (j,_,_) -> j=i) metasenv''') + new_goals @ new_goals' + in + proof'', patched_new_goals + in + PET.mk_tactic (cases_tac ~term) +;; + + +let elim_intros_tac ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) + ?depth ?using ?pattern what = + Tacticals.then_ ~start:(elim_tac ?using ?pattern what) + ~continuation:(intros_tac ~mk_fresh_name_callback ?howmany:depth ()) +;; + +(* The simplification is performed only on the conclusion *) +let elim_intros_simpl_tac ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) + ?depth ?using ?pattern what = + Tacticals.then_ ~start:(elim_tac ?using ?pattern what) + ~continuation: + (Tacticals.thens + ~start:(intros_tac ~mk_fresh_name_callback ?howmany:depth ()) + ~continuations: + [ReductionTactics.simpl_tac + ~pattern:(ProofEngineTypes.conclusion_pattern None)]) +;; + +(* FG: insetrts a "hole" in the context (derived from letin_tac) *) + +let letout_tac = + let mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[] in + let term = C.Sort C.Set in + let letout_tac (proof, goal) = + let curi, metasenv, _subst, pbo, pty, attrs = proof in + let metano, context, ty = CicUtil.lookup_meta goal metasenv in + let newmeta = ProofEngineHelpers.new_meta_of_proof ~proof in + let fresh_name = mk_fresh_name_callback metasenv context (Cic.Name "hole") ~typ:term in + let context_for_newmeta = None :: context in + let irl = CicMkImplicit.identity_relocation_list_for_metavariable context_for_newmeta in + let newmetaty = CicSubstitution.lift 1 ty in + let bo' = C.LetIn (fresh_name, term, C.Meta (newmeta,irl)) in + let newproof, _ = ProofEngineHelpers.subst_meta_in_proof proof metano bo'[newmeta,context_for_newmeta,newmetaty] in + newproof, [newmeta] + in + PET.mk_tactic letout_tac diff --git a/components/tactics/primitiveTactics.mli b/components/tactics/primitiveTactics.mli new file mode 100644 index 000000000..890874a89 --- /dev/null +++ b/components/tactics/primitiveTactics.mli @@ -0,0 +1,99 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(**** useful only to implement tactics similar to apply ****) + +val generalize_exp_named_subst_with_fresh_metas : + Cic.context -> + int -> + UriManager.uri -> + (UriManager.uri * Cic.term) list -> + int * Cic.metasenv * + Cic.term Cic.explicit_named_substitution * + Cic.term Cic.explicit_named_substitution + +val classify_metas : + Cic.term -> + (Cic.term -> bool) -> + (Cic.context -> Cic.term -> Cic.term) -> + (Cic.term * Cic.context * Cic.term) list -> + (Cic.term * Cic.context * Cic.term) list * + (Cic.term * Cic.context * Cic.term) list + +(* ALB, needed by the new paramodulation... *) +val apply_with_subst: + term:Cic.term -> ?subst:Cic.substitution -> ?maxmeta:int -> ProofEngineTypes.proof * int -> + Cic.substitution * (ProofEngineTypes.proof * int list) * int + +(* not a real tactic *) +val apply_tac_verbose : + term:Cic.term -> + ProofEngineTypes.proof * int -> + (Cic.term -> Cic.term) * (ProofEngineTypes.proof * int list) + +val apply_tac: + term: Cic.term -> ProofEngineTypes.tactic +val exact_tac: + term: Cic.term -> ProofEngineTypes.tactic +val intros_tac: + ?howmany:int -> + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> unit -> + ProofEngineTypes.tactic +val cut_tac: + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + Cic.term -> + ProofEngineTypes.tactic +val letin_tac: + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + Cic.term -> + ProofEngineTypes.tactic + +val elim_intros_simpl_tac: + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ?depth:int -> ?using:Cic.term -> + ?pattern:ProofEngineTypes.lazy_pattern -> Cic.term -> + ProofEngineTypes.tactic +val elim_intros_tac: + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ?depth:int -> ?using:Cic.term -> + ?pattern:ProofEngineTypes.lazy_pattern -> Cic.term -> + ProofEngineTypes.tactic + +val cases_intros_tac: + ?howmany:int -> + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + Cic.term -> ProofEngineTypes.tactic + +(* FG *) + +(* inserts a hole in the context *) +val letout_tac: + ProofEngineTypes.tactic + +val mk_predicate_for_elim: + context:Cic.context -> metasenv:Cic.metasenv -> + ugraph:CicUniv.universe_graph -> goal:Cic.term -> + arg:Cic.term -> using:Cic.term -> cpattern:Cic.term -> args_no:int -> + Cic.metasenv * Cic.term * Cic.term * Cic.term list diff --git a/components/tactics/proofEngineHelpers.ml b/components/tactics/proofEngineHelpers.ml new file mode 100644 index 000000000..b38512273 --- /dev/null +++ b/components/tactics/proofEngineHelpers.ml @@ -0,0 +1,708 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +exception Bad_pattern of string Lazy.t + +let new_meta_of_proof ~proof:(_, metasenv, _, _, _, _) = + CicMkImplicit.new_meta metasenv [] + +let subst_meta_in_proof proof meta term newmetasenv = + let uri,metasenv,initial_subst,bo,ty, attrs = proof in + (* empty context is ok for term since it wont be used by apply_subst *) + (* hack: since we do not know the context and the type of term, we + create a substitution with cc =[] and type = Implicit; they will be + in any case dropped by apply_subst, but it would be better to rewrite + the code. Cannot we just use apply_subst_metasenv, etc. ?? *) + let subst_in = CicMetaSubst.apply_subst [meta,([], term,Cic.Implicit None)] in + let metasenv' = + newmetasenv @ (List.filter (function (m,_,_) -> m <> meta) metasenv) + in + let metasenv'' = + List.map + (function i,canonical_context,ty -> + let canonical_context' = + List.map + (function + Some (n,Cic.Decl s) -> Some (n,Cic.Decl (subst_in s)) + | Some (n,Cic.Def (s,None)) -> Some (n,Cic.Def (subst_in s,None)) + | None -> None + | Some (n,Cic.Def (bo,Some ty)) -> + Some (n,Cic.Def (subst_in bo,Some (subst_in ty))) + ) canonical_context + in + i,canonical_context',(subst_in ty) + ) metasenv' + in + let bo' = subst_in bo in + (* Metavariables can appear also in the *statement* of the theorem + * since the parser does not reject as statements terms with + * metavariable therein *) + let ty' = subst_in ty in + let newproof = uri,metasenv'',initial_subst,bo',ty', attrs in + (newproof, metasenv'') + +(*CSC: commento vecchio *) +(* refine_meta_with_brand_new_metasenv meta term subst_in newmetasenv *) +(* This (heavy) function must be called when a tactic can instantiate old *) +(* metavariables (i.e. existential variables). It substitues the metasenv *) +(* of the proof with the result of removing [meta] from the domain of *) +(* [newmetasenv]. Then it replaces Cic.Meta [meta] with [term] everywhere *) +(* in the current proof. Finally it applies [apply_subst_replacing] to *) +(* current proof. *) +(*CSC: A questo punto perche' passare un bo' gia' istantiato, se tanto poi *) +(*CSC: ci ripasso sopra apply_subst!!! *) +(*CSC: Attenzione! Ora questa funzione applica anche [subst_in] a *) +(*CSC: [newmetasenv]. *) +let subst_meta_and_metasenv_in_proof proof meta subst newmetasenv = + let (uri,_,initial_subst,bo,ty, attrs) = proof in + let subst_in = CicMetaSubst.apply_subst subst in + let bo' = subst_in bo in + (* Metavariables can appear also in the *statement* of the theorem + * since the parser does not reject as statements terms with + * metavariable therein *) + let ty' = subst_in ty in + let metasenv' = + List.fold_right + (fun metasenv_entry i -> + match metasenv_entry with + (m,canonical_context,ty) when m <> meta -> + let canonical_context' = + List.map + (function + None -> None + | Some (i,Cic.Decl t) -> Some (i,Cic.Decl (subst_in t)) + | Some (i,Cic.Def (t,None)) -> + Some (i,Cic.Def (subst_in t,None)) + | Some (i,Cic.Def (bo,Some ty)) -> + Some (i,Cic.Def (subst_in bo,Some (subst_in ty))) + ) canonical_context + in + (m,canonical_context',subst_in ty)::i + | _ -> i + ) newmetasenv [] + in + (* qui da capire se per la fase transitoria si fa initial_subst @ subst + * oppure subst *) + let newproof = uri,metasenv',subst,bo',ty', attrs in + (newproof, metasenv') + +let compare_metasenvs ~oldmetasenv ~newmetasenv = + List.map (function (i,_,_) -> i) + (List.filter + (function (i,_,_) -> + not (List.exists (fun (j,_,_) -> i=j) oldmetasenv)) newmetasenv) +;; + +(** finds the _pointers_ to subterms that are alpha-equivalent to wanted in t *) +let find_subterms ~subst ~metasenv ~ugraph ~wanted ~context t = + let rec find subst metasenv ugraph context w t = + try + let subst,metasenv,ugraph = + CicUnification.fo_unif_subst subst context metasenv w t ugraph + in + subst,metasenv,ugraph,[context,t] + with + CicUnification.UnificationFailure _ + | CicUnification.Uncertain _ -> + match t with + | Cic.Sort _ + | Cic.Rel _ -> subst,metasenv,ugraph,[] + | Cic.Meta (_, ctx) -> + List.fold_left ( + fun (subst,metasenv,ugraph,acc) e -> + match e with + | None -> subst,metasenv,ugraph,acc + | Some t -> + let subst,metasenv,ugraph,res = + find subst metasenv ugraph context w t + in + subst,metasenv,ugraph, res @ acc + ) (subst,metasenv,ugraph,[]) ctx + | Cic.Lambda (name, t1, t2) + | Cic.Prod (name, t1, t2) -> + let subst,metasenv,ugraph,rest1 = + find subst metasenv ugraph context w t1 in + let subst,metasenv,ugraph,rest2 = + find subst metasenv ugraph (Some (name, Cic.Decl t1)::context) + (CicSubstitution.lift 1 w) t2 + in + subst,metasenv,ugraph,rest1 @ rest2 + | Cic.LetIn (name, t1, t2) -> + let subst,metasenv,ugraph,rest1 = + find subst metasenv ugraph context w t1 in + let subst,metasenv,ugraph,rest2 = + find subst metasenv ugraph (Some (name, Cic.Def (t1,None))::context) + (CicSubstitution.lift 1 w) t2 + in + subst,metasenv,ugraph,rest1 @ rest2 + | Cic.Appl l -> + List.fold_left + (fun (subst,metasenv,ugraph,acc) t -> + let subst,metasenv,ugraph,res = + find subst metasenv ugraph context w t + in + subst,metasenv,ugraph,res @ acc) + (subst,metasenv,ugraph,[]) l + | Cic.Cast (t, ty) -> + let subst,metasenv,ugraph,rest = + find subst metasenv ugraph context w t in + let subst,metasenv,ugraph,resty = + find subst metasenv ugraph context w ty + in + subst,metasenv,ugraph,rest @ resty + | Cic.Implicit _ -> assert false + | Cic.Const (_, esubst) + | Cic.Var (_, esubst) + | Cic.MutInd (_, _, esubst) + | Cic.MutConstruct (_, _, _, esubst) -> + List.fold_left + (fun (subst,metasenv,ugraph,acc) (_, t) -> + let subst,metasenv,ugraph,res = + find subst metasenv ugraph context w t + in + subst,metasenv,ugraph,res @ acc) + (subst,metasenv,ugraph,[]) esubst + | Cic.MutCase (_, _, outty, indterm, patterns) -> + let subst,metasenv,ugraph,resoutty = + find subst metasenv ugraph context w outty in + let subst,metasenv,ugraph,resindterm = + find subst metasenv ugraph context w indterm in + let subst,metasenv,ugraph,respatterns = + List.fold_left + (fun (subst,metasenv,ugraph,acc) p -> + let subst,metaseng,ugraph,res = + find subst metasenv ugraph context w p + in + subst,metasenv,ugraph,res @ acc + ) (subst,metasenv,ugraph,[]) patterns + in + subst,metasenv,ugraph,resoutty @ resindterm @ respatterns + | Cic.Fix (_, funl) -> + let tys = + List.map (fun (n,_,ty,_) -> Some (Cic.Name n,(Cic.Decl ty))) funl + in + List.fold_left ( + fun (subst,metasenv,ugraph,acc) (_, _, ty, bo) -> + let subst,metasenv,ugraph,resty = + find subst metasenv ugraph context w ty in + let subst,metasenv,ugraph,resbo = + find subst metasenv ugraph (tys @ context) w bo + in + subst,metasenv,ugraph, resty @ resbo @ acc + ) (subst,metasenv,ugraph,[]) funl + | Cic.CoFix (_, funl) -> + let tys = + List.map (fun (n,ty,_) -> Some (Cic.Name n,(Cic.Decl ty))) funl + in + List.fold_left ( + fun (subst,metasenv,ugraph,acc) (_, ty, bo) -> + let subst,metasenv,ugraph,resty = + find subst metasenv ugraph context w ty in + let subst,metasenv,ugraph,resbo = + find subst metasenv ugraph (tys @ context) w bo + in + subst,metasenv,ugraph, resty @ resbo @ acc + ) (subst,metasenv,ugraph,[]) funl + in + find subst metasenv ugraph context wanted t + +let select_in_term ~metasenv ~context ~ugraph ~term ~pattern:(wanted,where) = + let add_ctx context name entry = (Some (name, entry)) :: context in + let map2 error_msg f l1 l2 = + try + List.map2 f l1 l2 + with + | Invalid_argument _ -> raise (Bad_pattern (lazy error_msg)) + in + let rec aux context where term = + match (where, term) with + | Cic.Implicit (Some `Hole), t -> [context,t] + | Cic.Implicit (Some `Type), t -> [] + | Cic.Implicit None,_ -> [] + | Cic.Meta (_, ctxt1), Cic.Meta (_, ctxt2) -> + List.concat + (map2 "wrong number of argument in explicit substitution" + (fun t1 t2 -> + (match (t1, t2) with + Some t1, Some t2 -> aux context t1 t2 + | _ -> [])) + ctxt1 ctxt2) + | Cic.Cast (te1, ty1), Cic.Cast (te2, ty2) -> + aux context te1 te2 @ aux context ty1 ty2 + | Cic.Prod (Cic.Anonymous, s1, t1), Cic.Prod (name, s2, t2) + | Cic.Lambda (Cic.Anonymous, s1, t1), Cic.Lambda (name, s2, t2) -> + aux context s1 s2 @ aux (add_ctx context name (Cic.Decl s2)) t1 t2 + | Cic.Prod (Cic.Name n1, s1, t1), + Cic.Prod ((Cic.Name n2) as name , s2, t2) + | Cic.Lambda (Cic.Name n1, s1, t1), + Cic.Lambda ((Cic.Name n2) as name, s2, t2) when n1 = n2-> + aux context s1 s2 @ aux (add_ctx context name (Cic.Decl s2)) t1 t2 + | Cic.Prod (name1, s1, t1), Cic.Prod (name2, s2, t2) + | Cic.Lambda (name1, s1, t1), Cic.Lambda (name2, s2, t2) -> [] + | Cic.LetIn (Cic.Anonymous, s1, t1), Cic.LetIn (name, s2, t2) -> + aux context s1 s2 @ aux (add_ctx context name (Cic.Def (s2,None))) t1 t2 + | Cic.LetIn (Cic.Name n1, s1, t1), + Cic.LetIn ((Cic.Name n2) as name, s2, t2) when n1 = n2-> + aux context s1 s2 @ aux (add_ctx context name (Cic.Def (s2,None))) t1 t2 + | Cic.LetIn (name1, s1, t1), Cic.LetIn (name2, s2, t2) -> [] + | Cic.Appl terms1, Cic.Appl terms2 -> auxs context terms1 terms2 + | Cic.Var (_, subst1), Cic.Var (_, subst2) + | Cic.Const (_, subst1), Cic.Const (_, subst2) + | Cic.MutInd (_, _, subst1), Cic.MutInd (_, _, subst2) + | Cic.MutConstruct (_, _, _, subst1), Cic.MutConstruct (_, _, _, subst2) -> + auxs context (List.map snd subst1) (List.map snd subst2) + | Cic.MutCase (_, _, out1, t1, pat1), Cic.MutCase (_ , _, out2, t2, pat2) -> + aux context out1 out2 @ aux context t1 t2 @ auxs context pat1 pat2 + | Cic.Fix (_, funs1), Cic.Fix (_, funs2) -> + let tys = + List.map (fun (n,_,ty,_) -> Some (Cic.Name n,(Cic.Decl ty))) funs2 + in + List.concat + (map2 "wrong number of mutually recursive functions" + (fun (_, _, ty1, bo1) (_, _, ty2, bo2) -> + aux context ty1 ty2 @ aux (tys @ context) bo1 bo2) + funs1 funs2) + | Cic.CoFix (_, funs1), Cic.CoFix (_, funs2) -> + let tys = + List.map (fun (n,ty,_) -> Some (Cic.Name n,(Cic.Decl ty))) funs2 + in + List.concat + (map2 "wrong number of mutually co-recursive functions" + (fun (_, ty1, bo1) (_, ty2, bo2) -> + aux context ty1 ty2 @ aux (tys @ context) bo1 bo2) + funs1 funs2) + | x,y -> + raise (Bad_pattern + (lazy (Printf.sprintf "Pattern %s versus term %s" + (CicPp.ppterm x) + (CicPp.ppterm y)))) + and auxs context terms1 terms2 = (* as aux for list of terms *) + List.concat (map2 "wrong number of arguments in application" + (fun t1 t2 -> aux context t1 t2) terms1 terms2) + in + let roots = + match where with + | None -> [] + | Some where -> aux context where term + in + match wanted with + None -> [],metasenv,ugraph,roots + | Some wanted -> + let rec find_in_roots = + function + [] -> [],metasenv,ugraph,[] + | (context',where)::tl -> + let subst,metasenv,ugraph,tl' = find_in_roots tl in + let subst,metasenv,ugraph,found = + let wanted, metasenv, ugraph = wanted context' metasenv ugraph in + find_subterms ~subst ~metasenv ~ugraph ~wanted ~context:context' + where + in + subst,metasenv,ugraph,found @ tl' + in + find_in_roots roots + +(** create a pattern from a term and a list of subterms. +* the pattern is granted to have a ? for every subterm that has no selected +* subterms +* @param equality equality function used while walking the term. Defaults to +* physical equality (==) *) +let pattern_of ?(equality=(==)) ~term terms = + let (===) x y = equality x y in + let not_found = false, Cic.Implicit None in + let rec aux t = + match t with + | t when List.exists (fun t' -> t === t') terms -> + true,Cic.Implicit (Some `Hole) + | Cic.Var (uri, subst) -> + let b,subst = aux_subst subst in + if b then + true,Cic.Var (uri, subst) + else + not_found + | Cic.Meta (i, ctxt) -> + let b,ctxt = + List.fold_right + (fun e (b,ctxt) -> + match e with + None -> b,None::ctxt + | Some t -> let bt,t = aux t in b||bt ,Some t::ctxt + ) ctxt (false,[]) + in + if b then + true,Cic.Meta (i, ctxt) + else + not_found + | Cic.Cast (te, ty) -> + let b1,te = aux te in + let b2,ty = aux ty in + if b1||b2 then true,Cic.Cast (te, ty) + else + not_found + | Cic.Prod (_, s, t) -> + let b1,s = aux s in + let b2,t = aux t in + if b1||b2 then + true, Cic.Prod (Cic.Anonymous, s, t) + else + not_found + | Cic.Lambda (_, s, t) -> + let b1,s = aux s in + let b2,t = aux t in + if b1||b2 then + true, Cic.Lambda (Cic.Anonymous, s, t) + else + not_found + | Cic.LetIn (_, s, t) -> + let b1,s = aux s in + let b2,t = aux t in + if b1||b2 then + true, Cic.LetIn (Cic.Anonymous, s, t) + else + not_found + | Cic.Appl terms -> + let b,terms = + List.fold_right + (fun t (b,terms) -> + let bt,t = aux t in + b||bt,t::terms + ) terms (false,[]) + in + if b then + true,Cic.Appl terms + else + not_found + | Cic.Const (uri, subst) -> + let b,subst = aux_subst subst in + if b then + true, Cic.Const (uri, subst) + else + not_found + | Cic.MutInd (uri, tyno, subst) -> + let b,subst = aux_subst subst in + if b then + true, Cic.MutInd (uri, tyno, subst) + else + not_found + | Cic.MutConstruct (uri, tyno, consno, subst) -> + let b,subst = aux_subst subst in + if b then + true, Cic.MutConstruct (uri, tyno, consno, subst) + else + not_found + | Cic.MutCase (uri, tyno, outty, t, pat) -> + let b1,outty = aux outty in + let b2,t = aux t in + let b3,pat = + List.fold_right + (fun t (b,pat) -> + let bt,t = aux t in + bt||b,t::pat + ) pat (false,[]) + in + if b1 || b2 || b3 then + true, Cic.MutCase (uri, tyno, outty, t, pat) + else + not_found + | Cic.Fix (funno, funs) -> + let b,funs = + List.fold_right + (fun (name, i, ty, bo) (b,funs) -> + let b1,ty = aux ty in + let b2,bo = aux bo in + b||b1||b2, (name, i, ty, bo)::funs) funs (false,[]) + in + if b then + true, Cic.Fix (funno, funs) + else + not_found + | Cic.CoFix (funno, funs) -> + let b,funs = + List.fold_right + (fun (name, ty, bo) (b,funs) -> + let b1,ty = aux ty in + let b2,bo = aux bo in + b||b1||b2, (name, ty, bo)::funs) funs (false,[]) + in + if b then + true, Cic.CoFix (funno, funs) + else + not_found + | Cic.Rel _ + | Cic.Sort _ + | Cic.Implicit _ -> not_found + and aux_subst subst = + List.fold_right + (fun (uri, t) (b,subst) -> + let b1,t = aux t in + b||b1,(uri, t)::subst) subst (false,[]) + in + snd (aux term) + +exception Fail of string Lazy.t + + (** select metasenv conjecture pattern + * select all subterms of [conjecture] matching [pattern]. + * It returns the set of matched terms (that can be compared using physical + * equality to the subterms of [conjecture]) together with their contexts. + * The representation of the set mimics the ProofEngineTypes.pattern type: + * a list of hypothesis (names of) together with the list of its matched + * subterms (and their contexts) + the list of matched subterms of the + * with their context conclusion. Note: in the result the list of hypothesis + * has an entry for each entry in the context and in the same order. + * Of course the list of terms (with their context) associated to the + * hypothesis name may be empty. + * + * @raise Bad_pattern + * *) + let select ~metasenv ~ugraph ~conjecture:(_,context,ty) + ~(pattern: (Cic.term, Cic.lazy_term) ProofEngineTypes.pattern) + = + let what, hyp_patterns, goal_pattern = pattern in + let find_pattern_for name = + try Some (snd (List.find (fun (n, pat) -> Cic.Name n = name) hyp_patterns)) + with Not_found -> None in + (* Multiple hypotheses with the same name can be in the context. + In this case we need to pick the last one, but we will perform + a fold_right on the context. Thus we pre-process hyp_patterns. *) + let full_hyp_pattern = + let rec aux blacklist = + function + [] -> [] + | None::tl -> None::aux blacklist tl + | Some (name,_)::tl -> + if List.mem name blacklist then + None::aux blacklist tl + else + find_pattern_for name::aux (name::blacklist) tl + in + aux [] context + in + let subst,metasenv,ugraph,ty_terms = + select_in_term ~metasenv ~context ~ugraph ~term:ty + ~pattern:(what,goal_pattern) in + let subst,metasenv,ugraph,context_terms = + let subst,metasenv,ugraph,res,_ = + (List.fold_right + (fun (pattern,entry) (subst,metasenv,ugraph,res,context) -> + match entry with + None -> subst,metasenv,ugraph,None::res,None::context + | Some (name,Cic.Decl term) -> + (match pattern with + | None -> + subst,metasenv,ugraph,((Some (`Decl []))::res),(entry::context) + | Some pat -> + let subst,metasenv,ugraph,terms = + select_in_term ~metasenv ~context ~ugraph ~term + ~pattern:(what, Some pat) + in + subst,metasenv,ugraph,((Some (`Decl terms))::res), + (entry::context)) + | Some (name,Cic.Def (bo, ty)) -> + (match pattern with + | None -> + let selected_ty=match ty with None -> None | Some _ -> Some [] in + subst,metasenv,ugraph,((Some (`Def ([],selected_ty)))::res), + (entry::context) + | Some pat -> + let subst,metasenv,ugraph,terms_bo = + select_in_term ~metasenv ~context ~ugraph ~term:bo + ~pattern:(what, Some pat) in + let subst,metasenv,ugraph,terms_ty = + match ty with + None -> subst,metasenv,ugraph,None + | Some ty -> + let subst,metasenv,ugraph,res = + select_in_term ~metasenv ~context ~ugraph ~term:ty + ~pattern:(what, Some pat) + in + subst,metasenv,ugraph,Some res + in + subst,metasenv,ugraph,((Some (`Def (terms_bo,terms_ty)))::res), + (entry::context)) + ) (List.combine full_hyp_pattern context) (subst,metasenv,ugraph,[],[])) + in + subst,metasenv,ugraph,res + in + subst,metasenv,ugraph,context_terms, ty_terms + +(** locate_in_term equality what where context +* [what] must match a subterm of [where] according to [equality] +* It returns the matched terms together with their contexts in [where] +* [equality] defaults to physical equality +* [context] must be the context of [where] +*) +let locate_in_term ?(equality=(fun _ -> (==))) what ~where context = + let add_ctx context name entry = + (Some (name, entry)) :: context in + let rec aux context where = + if equality context what where then [context,where] + else + match where with + | Cic.Implicit _ + | Cic.Meta _ + | Cic.Rel _ + | Cic.Sort _ + | Cic.Var _ + | Cic.Const _ + | Cic.MutInd _ + | Cic.MutConstruct _ -> [] + | Cic.Cast (te, ty) -> aux context te @ aux context ty + | Cic.Prod (name, s, t) + | Cic.Lambda (name, s, t) -> + aux context s @ aux (add_ctx context name (Cic.Decl s)) t + | Cic.LetIn (name, s, t) -> + aux context s @ aux (add_ctx context name (Cic.Def (s,None))) t + | Cic.Appl tl -> auxs context tl + | Cic.MutCase (_, _, out, t, pat) -> + aux context out @ aux context t @ auxs context pat + | Cic.Fix (_, funs) -> + let tys = + List.map (fun (n,_,ty,_) -> Some (Cic.Name n,(Cic.Decl ty))) funs + in + List.concat + (List.map + (fun (_, _, ty, bo) -> + aux context ty @ aux (tys @ context) bo) + funs) + | Cic.CoFix (_, funs) -> + let tys = + List.map (fun (n,ty,_) -> Some (Cic.Name n,(Cic.Decl ty))) funs + in + List.concat + (List.map + (fun (_, ty, bo) -> + aux context ty @ aux (tys @ context) bo) + funs) + and auxs context tl = (* as aux for list of terms *) + List.concat (List.map (fun t -> aux context t) tl) + in + aux context where + +(** locate_in_conjecture equality what where context +* [what] must match a subterm of [where] according to [equality] +* It returns the matched terms together with their contexts in [where] +* [equality] defaults to physical equality +* [context] must be the context of [where] +*) +let locate_in_conjecture ?(equality=fun _ -> (==)) what (_,context,ty) = + let context,res = + List.fold_right + (fun entry (context,res) -> + match entry with + None -> entry::context, res + | Some (_, Cic.Decl ty) -> + let res = res @ locate_in_term what ~where:ty context in + let context' = entry::context in + context',res + | Some (_, Cic.Def (bo,ty)) -> + let res = res @ locate_in_term what ~where:bo context in + let res = + match ty with + None -> res + | Some ty -> + res @ locate_in_term what ~where:ty context in + let context' = entry::context in + context',res + ) context ([],[]) + in + res @ locate_in_term what ~where:ty context + +let lookup_type metasenv context hyp = + let rec aux p = function + | Some (Cic.Name name, Cic.Decl t) :: _ when name = hyp -> p, t + | Some (Cic.Name name, Cic.Def (_, Some t)) :: _ when name = hyp -> p, t + | Some (Cic.Name name, Cic.Def (u, _)) :: tail when name = hyp -> + p, fst (CicTypeChecker.type_of_aux' metasenv tail u CicUniv.empty_ugraph) + | _ :: tail -> aux (succ p) tail + | [] -> raise (ProofEngineTypes.Fail (lazy "lookup_type: not premise in the current goal")) + in + aux 1 context + +(* FG: **********************************************************************) + +let get_name context index = + try match List.nth context (pred index) with + | Some (Cic.Name name, _) -> Some name + | _ -> None + with Invalid_argument "List.nth" -> None + +let get_rel context name = + let rec aux i = function + | [] -> None + | Some (Cic.Name s, _) :: _ when s = name -> Some (Cic.Rel i) + | _ :: tl -> aux (succ i) tl + in + aux 1 context + +let split_with_whd (c, t) = + let add s v c = Some (s, Cic.Decl v) :: c in + let rec aux whd a n c = function + | Cic.Prod (s, v, t) -> aux false ((c, v) :: a) (succ n) (add s v c) t + | v when whd -> (c, v) :: a, n + | v -> aux true a n c (CicReduction.whd c v) + in + aux false [] 0 c t + +let split_with_normalize (c, t) = + let add s v c = Some (s, Cic.Decl v) :: c in + let rec aux a n c = function + | Cic.Prod (s, v, t) -> aux ((c, v) :: a) (succ n) (add s v c) t + | v -> (c, v) :: a, n + in + aux [] 0 c (CicReduction.normalize c t) + + (* menv sorting *) +module OT = + struct + type t = Cic.conjecture + let compare (i,_,_) (j,_,_) = Pervasives.compare i j + end +module MS = HTopoSort.Make(OT) +let relations_of_menv m c = + let i, ctx, ty = c in + let m = List.filter (fun (j,_,_) -> j <> i) m in + let m_ty = List.map fst (CicUtil.metas_of_term ty) in + let m_ctx = + List.flatten + (List.map + (function + | None -> [] + | Some (_,Cic.Decl t) + | Some (_,Cic.Def (t,None)) -> + List.map fst (CicUtil.metas_of_term ty) + | Some (_,Cic.Def (t,Some ty)) -> + List.map fst (CicUtil.metas_of_term ty) @ + List.map fst (CicUtil.metas_of_term t)) + ctx) + in + let metas = HExtlib.list_uniq (List.sort compare (m_ty @ m_ctx)) in + List.filter (fun (i,_,_) -> List.exists ((=) i) metas) m +;; +let sort_metasenv (m : Cic.metasenv) = + (MS.topological_sort m (relations_of_menv m) : Cic.metasenv) +;; diff --git a/components/tactics/proofEngineHelpers.mli b/components/tactics/proofEngineHelpers.mli new file mode 100644 index 000000000..39fb69b0d --- /dev/null +++ b/components/tactics/proofEngineHelpers.mli @@ -0,0 +1,130 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception Bad_pattern of string Lazy.t + +(* Returns the first meta whose number is above the *) +(* number of the higher meta. *) +val new_meta_of_proof : proof:ProofEngineTypes.proof -> int + +val subst_meta_in_proof : + ProofEngineTypes.proof -> + int -> Cic.term -> Cic.metasenv -> + ProofEngineTypes.proof * Cic.metasenv +val subst_meta_and_metasenv_in_proof : + ProofEngineTypes.proof -> + int -> Cic.substitution -> Cic.metasenv -> + ProofEngineTypes.proof * Cic.metasenv + +(* returns the list of goals that are in newmetasenv and were not in + oldmetasenv *) +val compare_metasenvs : + oldmetasenv:Cic.metasenv -> newmetasenv:Cic.metasenv -> int list + + +(** { Patterns } + * A pattern is a Cic term in which Cic.Implicit terms annotated with `Hole + * appears *) + +(** create a pattern from a term and a list of subterms. +* the pattern is granted to have a ? for every subterm that has no selected +* subterms +* @param equality equality function used while walking the term. Defaults to +* physical equality (==) *) +val pattern_of: + ?equality:(Cic.term -> Cic.term -> bool) -> term:Cic.term -> Cic.term list -> + Cic.term + + +(** select metasenv conjecture pattern +* select all subterms of [conjecture] matching [pattern]. +* It returns the set of matched terms (that can be compared using physical +* equality to the subterms of [conjecture]) together with their contexts. +* The representation of the set mimics the conjecture type (but for the id): +* a list of (possibly removed) hypothesis (without their names) together with +* the list of its matched subterms (and their contexts) + the list of matched +* subterms of the conclusion with their context. Note: in the result the list +* of hypotheses * has an entry for each entry in the context and in the same +* order. Of course the list of terms (with their context) associated to one +* hypothesis may be empty. +* +* @raise Bad_pattern +* *) +val select: + metasenv:Cic.metasenv -> + ugraph:CicUniv.universe_graph -> + conjecture:Cic.conjecture -> + pattern:ProofEngineTypes.lazy_pattern -> + Cic.substitution * Cic.metasenv * CicUniv.universe_graph * + [ `Decl of (Cic.context * Cic.term) list + | `Def of (Cic.context * Cic.term) list * (Cic.context * Cic.term) list option + ] option list * + (Cic.context * Cic.term) list + +(** locate_in_term equality what where context +* [what] must match a subterm of [where] according to [equality] +* It returns the matched terms together with their contexts in [where] +* [equality] defaults to physical equality +* [context] must be the context of [where] +*) +val locate_in_term: + ?equality:(Cic.context -> Cic.term -> Cic.term -> bool) -> + Cic.term -> where:Cic.term -> Cic.context -> (Cic.context * Cic.term) list + +(** locate_in_conjecture equality what where context +* [what] must match a subterm of [where] according to [equality] +* It returns the matched terms together with their contexts in [where] +* [equality] defaults to physical equality +* [context] must be the context of [where] +*) +val locate_in_conjecture: + ?equality:(Cic.context -> Cic.term -> Cic.term -> bool) -> + Cic.term -> Cic.conjecture -> (Cic.context * Cic.term) list + +(* returns the index and the type of a premise in a context *) +val lookup_type: Cic.metasenv -> Cic.context -> string -> int * Cic.term + +(* orders a metasenv w.r.t. dependency among metas *) +val sort_metasenv: Cic.metasenv -> Cic.metasenv + + +(* FG: some helper functions ************************************************) + +val get_name: Cic.context -> int -> string option + +val get_rel: Cic.context -> string -> Cic.term option + +(* split_with_whd (c, t) takes a type t typed in the context c and returns + [(c_0, t_0); (c_1, t_1); ...; (c_n, t_n)], n where t_0 is the conclusion of + t and t_i is the premise of t accessed by Rel i in t_0. + Performes a whd on the conclusion before giving up. + Each t_i is returned with a context c_i in wich it is typed + split_with_normalize (c, t) normalizes t before operating the split + whd is useless here +*) +val split_with_whd: Cic.context * Cic.term -> + (Cic.context * Cic.term) list * int +val split_with_normalize: Cic.context * Cic.term -> + (Cic.context * Cic.term) list * int diff --git a/components/tactics/proofEngineReduction.ml b/components/tactics/proofEngineReduction.ml new file mode 100644 index 000000000..016a7ba99 --- /dev/null +++ b/components/tactics/proofEngineReduction.ml @@ -0,0 +1,1136 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(******************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 12/04/2002 *) +(* *) +(* *) +(******************************************************************************) + +(* $Id$ *) + +(* The code of this module is derived from the code of CicReduction *) + +exception Impossible of int;; +exception ReferenceToConstant;; +exception ReferenceToVariable;; +exception ReferenceToCurrentProof;; +exception ReferenceToInductiveDefinition;; +exception WrongUriToInductiveDefinition;; +exception WrongUriToConstant;; +exception RelToHiddenHypothesis;; + +module C = Cic +module S = CicSubstitution + +let debug = false +let prerr_endline = + if debug then prerr_endline else (fun x -> ()) +;; + +exception WhatAndWithWhatDoNotHaveTheSameLength;; + +(* Replaces "textually" in "where" every term in "what" with the corresponding + term in "with_what". The terms in "what" ARE NOT lifted when binders are + crossed. The terms in "with_what" ARE NOT lifted when binders are crossed. + Every free variable in "where" IS NOT lifted by nnn. +*) +let replace ~equality ~what ~with_what ~where = + let find_image t = + let rec find_image_aux = + function + [],[] -> raise Not_found + | what::tl1,with_what::tl2 -> + if equality what t then with_what else find_image_aux (tl1,tl2) + | _,_ -> raise WhatAndWithWhatDoNotHaveTheSameLength + in + find_image_aux (what,with_what) + in + let rec aux t = + try + find_image t + with Not_found -> + match t with + C.Rel _ -> t + | C.Var (uri,exp_named_subst) -> + C.Var (uri,List.map (function (uri,t) -> uri, aux t) exp_named_subst) + | C.Meta _ -> t + | C.Sort _ -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (aux te, aux ty) + | C.Prod (n,s,t) -> C.Prod (n, aux s, aux t) + | C.Lambda (n,s,t) -> C.Lambda (n, aux s, aux t) + | C.LetIn (n,s,t) -> C.LetIn (n, aux s, aux t) + | C.Appl l -> + (* Invariant enforced: no application of an application *) + (match List.map aux l with + (C.Appl l')::tl -> C.Appl (l'@tl) + | l' -> C.Appl l') + | C.Const (uri,exp_named_subst) -> + C.Const (uri,List.map (function (uri,t) -> uri, aux t) exp_named_subst) + | C.MutInd (uri,i,exp_named_subst) -> + C.MutInd + (uri,i,List.map (function (uri,t) -> uri, aux t) exp_named_subst) + | C.MutConstruct (uri,i,j,exp_named_subst) -> + C.MutConstruct + (uri,i,j,List.map (function (uri,t) -> uri, aux t) exp_named_subst) + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,aux outt, aux t,List.map aux pl) + | C.Fix (i,fl) -> + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> (name, i, aux ty, aux bo)) + fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let substitutedfl = + List.map + (fun (name,ty,bo) -> (name, aux ty, aux bo)) + fl + in + C.CoFix (i, substitutedfl) + in + aux where +;; + +(* Replaces in "where" every term in "what" with the corresponding + term in "with_what". The terms in "what" ARE lifted when binders are + crossed. The terms in "with_what" ARE lifted when binders are crossed. + Every free variable in "where" IS NOT lifted by nnn. + Thus "replace_lifting_csc 1 ~with_what:[Rel 1; ... ; Rel 1]" is the + inverse of subst up to the fact that free variables in "where" are NOT + lifted. *) +let replace_lifting ~equality ~context ~what ~with_what ~where = + let find_image ctx what t = + let rec find_image_aux = + function + [],[] -> raise Not_found + | what::tl1,with_what::tl2 -> + if equality ctx what t then with_what else find_image_aux (tl1,tl2) + | _,_ -> raise WhatAndWithWhatDoNotHaveTheSameLength + in + find_image_aux (what,with_what) + in + let add_ctx ctx n s = (Some (n, Cic.Decl s))::ctx in + let add_ctx1 ctx n s = (Some (n, Cic.Def (s,None)))::ctx in + let rec substaux k ctx what t = + try + S.lift (k-1) (find_image ctx what t) + with Not_found -> + match t with + C.Rel n as t -> t + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k ctx what t) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (i, l) -> + let l' = + List.map + (function + None -> None + | Some t -> Some (substaux k ctx what t) + ) l + in + C.Meta(i,l') + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (substaux k ctx what te, substaux k ctx what ty) + | C.Prod (n,s,t) -> + C.Prod + (n, substaux k ctx what s, substaux (k + 1) (add_ctx ctx n s) (List.map (S.lift 1) what) t) + | C.Lambda (n,s,t) -> + C.Lambda + (n, substaux k ctx what s, substaux (k + 1) (add_ctx ctx n s) (List.map (S.lift 1) what) t) + | C.LetIn (n,s,t) -> + C.LetIn + (n, substaux k ctx what s, substaux (k + 1) (add_ctx1 ctx n s) (List.map (S.lift 1) what) t) + | C.Appl (he::tl) -> + (* Invariant: no Appl applied to another Appl *) + let tl' = List.map (substaux k ctx what) tl in + begin + match substaux k ctx what he with + C.Appl l -> C.Appl (l@tl') + | _ as he' -> C.Appl (he'::tl') + end + | C.Appl _ -> assert false + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k ctx what t) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,i,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k ctx what t) exp_named_subst + in + C.MutInd (uri,i,exp_named_subst') + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k ctx what t) exp_named_subst + in + C.MutConstruct (uri,i,j,exp_named_subst') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,substaux k ctx what outt, substaux k ctx what t, + List.map (substaux k ctx what) pl) + | C.Fix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> (* WRONG CTX *) + (name, i, substaux k ctx what ty, + substaux (k+len) ctx (List.map (S.lift len) what) bo) + ) fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,ty,bo) -> (* WRONG CTX *) + (name, substaux k ctx what ty, + substaux (k+len) ctx (List.map (S.lift len) what) bo) + ) fl + in + C.CoFix (i, substitutedfl) + in + substaux 1 context what where +;; + +(* Replaces in "where" every term in "what" with the corresponding + term in "with_what". The terms in "what" ARE NOT lifted when binders are + crossed. The terms in "with_what" ARE lifted when binders are crossed. + Every free variable in "where" IS lifted by nnn. + Thus "replace_lifting_csc 1 ~with_what:[Rel 1; ... ; Rel 1]" is the + inverse of subst up to the fact that "what" terms are NOT lifted. *) +let replace_lifting_csc nnn ~equality ~what ~with_what ~where = + let find_image t = + let rec find_image_aux = + function + [],[] -> raise Not_found + | what::tl1,with_what::tl2 -> + if equality what t then with_what else find_image_aux (tl1,tl2) + | _,_ -> raise WhatAndWithWhatDoNotHaveTheSameLength + in + find_image_aux (what,with_what) + in + let rec substaux k t = + try + S.lift (k-1) (find_image t) + with Not_found -> + match t with + C.Rel n -> + if n < k then C.Rel n else C.Rel (n + nnn) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k t) exp_named_subst + in + C.Var (uri,exp_named_subst') + | C.Meta (i, l) -> + let l' = + List.map + (function + None -> None + | Some t -> Some (substaux k t) + ) l + in + C.Meta(i,l') + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> C.Cast (substaux k te, substaux k ty) + | C.Prod (n,s,t) -> + C.Prod (n, substaux k s, substaux (k + 1) t) + | C.Lambda (n,s,t) -> + C.Lambda (n, substaux k s, substaux (k + 1) t) + | C.LetIn (n,s,t) -> + C.LetIn (n, substaux k s, substaux (k + 1) t) + | C.Appl (he::tl) -> + (* Invariant: no Appl applied to another Appl *) + let tl' = List.map (substaux k) tl in + begin + match substaux k he with + C.Appl l -> C.Appl (l@tl') + | _ as he' -> C.Appl (he'::tl') + end + | C.Appl _ -> assert false + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k t) exp_named_subst + in + C.Const (uri,exp_named_subst') + | C.MutInd (uri,i,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k t) exp_named_subst + in + C.MutInd (uri,i,exp_named_subst') + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let exp_named_subst' = + List.map (function (uri,t) -> uri,substaux k t) exp_named_subst + in + C.MutConstruct (uri,i,j,exp_named_subst') + | C.MutCase (sp,i,outt,t,pl) -> + C.MutCase (sp,i,substaux k outt, substaux k t, + List.map (substaux k) pl) + | C.Fix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,i,ty,bo) -> + (name, i, substaux k ty, substaux (k+len) bo)) + fl + in + C.Fix (i, substitutedfl) + | C.CoFix (i,fl) -> + let len = List.length fl in + let substitutedfl = + List.map + (fun (name,ty,bo) -> + (name, substaux k ty, substaux (k+len) bo)) + fl + in + C.CoFix (i, substitutedfl) + in + substaux 1 where +;; + +(* This is like "replace_lifting_csc 1 ~with_what:[Rel 1; ... ; Rel 1]" + up to the fact that the index to start from can be specified *) +let replace_with_rel_1_from ~equality ~what = + let rec find_image t = function + | [] -> false + | hd :: tl -> equality t hd || find_image t tl + in + let rec subst_term k t = + if find_image t what then C.Rel k else inspect_term k t + and inspect_term k = function + | C.Rel i -> if i < k then C.Rel i else C.Rel (succ i) + | C.Sort _ as t -> t + | C.Implicit _ as t -> t + | C.Var (uri, enss) -> + let enss = List.map (subst_ens k) enss in + C.Var (uri, enss) + | C.Const (uri ,enss) -> + let enss = List.map (subst_ens k) enss in + C.Const (uri, enss) + | C.MutInd (uri, tyno, enss) -> + let enss = List.map (subst_ens k) enss in + C.MutInd (uri, tyno, enss) + | C.MutConstruct (uri, tyno, consno, enss) -> + let enss = List.map (subst_ens k) enss in + C.MutConstruct (uri, tyno, consno, enss) + | C.Meta (i, mss) -> + let mss = List.map (subst_ms k) mss in + C.Meta(i, mss) + | C.Cast (t, v) -> C.Cast (subst_term k t, subst_term k v) + | C.Appl ts -> + let ts = List.map (subst_term k) ts in + C.Appl ts + | C.MutCase (uri, tyno, outty, t, cases) -> + let cases = List.map (subst_term k) cases in + C.MutCase (uri, tyno, subst_term k outty, subst_term k t, cases) + | C.Prod (n, v, t) -> + C.Prod (n, subst_term k v, subst_term (succ k) t) + | C.Lambda (n, v, t) -> + C.Lambda (n, subst_term k v, subst_term (succ k) t) + | C.LetIn (n, v, t) -> + C.LetIn (n, subst_term k v, subst_term (succ k) t) + | C.Fix (i, fixes) -> + let fixesno = List.length fixes in + let fixes = List.map (subst_fix fixesno k) fixes in + C.Fix (i, fixes) + | C.CoFix (i, cofixes) -> + let cofixesno = List.length cofixes in + let cofixes = List.map (subst_cofix cofixesno k) cofixes in + C.CoFix (i, cofixes) + and subst_ens k (uri, t) = uri, subst_term k t + and subst_ms k = function + | None -> None + | Some t -> Some (subst_term k t) + and subst_fix fixesno k (n, ind, ty, bo) = + n, ind, subst_term k ty, subst_term (k + fixesno) bo + and subst_cofix cofixesno k (n, ty, bo) = + n, subst_term k ty, subst_term (k + cofixesno) bo +in +subst_term + + + + +(* Takes a well-typed term and fully reduces it. *) +(*CSC: It does not perform reduction in a Case *) +let reduce context = + let rec reduceaux context l = + function + C.Rel n as t -> + (match List.nth context (n-1) with + Some (_,C.Decl _) -> if l = [] then t else C.Appl (t::l) + | Some (_,C.Def (bo,_)) -> reduceaux context l (S.lift n bo) + | None -> raise RelToHiddenHypothesis + ) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + reduceaux_exp_named_subst context l exp_named_subst + in + (let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.Constant _ -> raise ReferenceToConstant + | C.CurrentProof _ -> raise ReferenceToCurrentProof + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + | C.Variable (_,None,_,_,_) -> + let t' = C.Var (uri,exp_named_subst') in + if l = [] then t' else C.Appl (t'::l) + | C.Variable (_,Some body,_,_,_) -> + (reduceaux context l + (CicSubstitution.subst_vars exp_named_subst' body)) + ) + | C.Meta _ as t -> if l = [] then t else C.Appl (t::l) + | C.Sort _ as t -> t (* l should be empty *) + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> + C.Cast (reduceaux context l te, reduceaux context l ty) + | C.Prod (name,s,t) -> + assert (l = []) ; + C.Prod (name, + reduceaux context [] s, + reduceaux ((Some (name,C.Decl s))::context) [] t) + | C.Lambda (name,s,t) -> + (match l with + [] -> + C.Lambda (name, + reduceaux context [] s, + reduceaux ((Some (name,C.Decl s))::context) [] t) + | he::tl -> reduceaux context tl (S.subst he t) + (* when name is Anonimous the substitution should be superfluous *) + ) + | C.LetIn (n,s,t) -> + reduceaux context l (S.subst (reduceaux context [] s) t) + | C.Appl (he::tl) -> + let tl' = List.map (reduceaux context []) tl in + reduceaux context (tl'@l) he + | C.Appl [] -> raise (Impossible 1) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + reduceaux_exp_named_subst context l exp_named_subst + in + (let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.Constant (_,Some body,_,_,_) -> + (reduceaux context l + (CicSubstitution.subst_vars exp_named_subst' body)) + | C.Constant (_,None,_,_,_) -> + let t' = C.Const (uri,exp_named_subst') in + if l = [] then t' else C.Appl (t'::l) + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof (_,_,body,_,_,_) -> + (reduceaux context l + (CicSubstitution.subst_vars exp_named_subst' body)) + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + ) + | C.MutInd (uri,i,exp_named_subst) -> + let exp_named_subst' = + reduceaux_exp_named_subst context l exp_named_subst + in + let t' = C.MutInd (uri,i,exp_named_subst') in + if l = [] then t' else C.Appl (t'::l) + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let exp_named_subst' = + reduceaux_exp_named_subst context l exp_named_subst + in + let t' = C.MutConstruct (uri,i,j,exp_named_subst') in + if l = [] then t' else C.Appl (t'::l) + | C.MutCase (mutind,i,outtype,term,pl) -> + let decofix = + function + C.CoFix (i,fl) -> + let (_,_,body) = List.nth fl i in + let body' = + let counter = ref (List.length fl) in + List.fold_right + (fun _ -> decr counter ; S.subst (C.CoFix (!counter,fl))) + fl + body + in + reduceaux context [] body' + | C.Appl (C.CoFix (i,fl) :: tl) -> + let (_,_,body) = List.nth fl i in + let body' = + let counter = ref (List.length fl) in + List.fold_right + (fun _ -> decr counter ; S.subst (C.CoFix (!counter,fl))) + fl + body + in + let tl' = List.map (reduceaux context []) tl in + reduceaux context tl' body' + | t -> t + in + (match decofix (reduceaux context [] term) with + C.MutConstruct (_,_,j,_) -> reduceaux context l (List.nth pl (j-1)) + | C.Appl (C.MutConstruct (_,_,j,_) :: tl) -> + let (arity, r) = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph mutind in + match o with + C.InductiveDefinition (tl,_,r,_) -> + let (_,_,arity,_) = List.nth tl i in + (arity,r) + | _ -> raise WrongUriToInductiveDefinition + in + let ts = + let rec eat_first = + function + (0,l) -> l + | (n,he::tl) when n > 0 -> eat_first (n - 1, tl) + | _ -> raise (Impossible 5) + in + eat_first (r,tl) + in + reduceaux context (ts@l) (List.nth pl (j-1)) + | C.Cast _ | C.Implicit _ -> + raise (Impossible 2) (* we don't trust our whd ;-) *) + | _ -> + let outtype' = reduceaux context [] outtype in + let term' = reduceaux context [] term in + let pl' = List.map (reduceaux context []) pl in + let res = + C.MutCase (mutind,i,outtype',term',pl') + in + if l = [] then res else C.Appl (res::l) + ) + | C.Fix (i,fl) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + let t' () = + let fl' = + List.map + (function (n,recindex,ty,bo) -> + (n,recindex,reduceaux context [] ty, reduceaux (tys@context) [] bo) + ) fl + in + C.Fix (i, fl') + in + let (_,recindex,_,body) = List.nth fl i in + let recparam = + try + Some (List.nth l recindex) + with + _ -> None + in + (match recparam with + Some recparam -> + (match reduceaux context [] recparam with + C.MutConstruct _ + | C.Appl ((C.MutConstruct _)::_) -> + let body' = + let counter = ref (List.length fl) in + List.fold_right + (fun _ -> decr counter ; S.subst (C.Fix (!counter,fl))) + fl + body + in + (* Possible optimization: substituting whd recparam in l*) + reduceaux context l body' + | _ -> if l = [] then t' () else C.Appl ((t' ())::l) + ) + | None -> if l = [] then t' () else C.Appl ((t' ())::l) + ) + | C.CoFix (i,fl) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + let t' = + let fl' = + List.map + (function (n,ty,bo) -> + (n,reduceaux context [] ty, reduceaux (tys@context) [] bo) + ) fl + in + C.CoFix (i, fl') + in + if l = [] then t' else C.Appl (t'::l) + and reduceaux_exp_named_subst context l = + List.map (function uri,t -> uri,reduceaux context [] t) + in + reduceaux context [] +;; + + +let unfold ?what context where = + let contextlen = List.length context in + let first_is_the_expandable_head_of_second context' t1 t2 = + match t1,t2 with + Cic.Const (uri,_), Cic.Const (uri',_) + | Cic.Var (uri,_), Cic.Var (uri',_) + | Cic.Const (uri,_), Cic.Appl (Cic.Const (uri',_)::_) + | Cic.Var (uri,_), Cic.Appl (Cic.Var (uri',_)::_) -> UriManager.eq uri uri' + | Cic.Const _, _ + | Cic.Var _, _ -> false + | Cic.Rel n, Cic.Rel m + | Cic.Rel n, Cic.Appl (Cic.Rel m::_) -> + n + (List.length context' - contextlen) = m + | Cic.Rel _, _ -> false + | _,_ -> + raise + (ProofEngineTypes.Fail + (lazy "The term to unfold is not a constant, a variable or a bound variable ")) + in + let appl he tl = + if tl = [] then he else Cic.Appl (he::tl) in + let cannot_delta_expand t = + raise + (ProofEngineTypes.Fail + (lazy ("The term " ^ CicPp.ppterm t ^ " cannot be delta-expanded"))) in + let rec hd_delta_beta context tl = + function + Cic.Rel n as t -> + (try + match List.nth context (n-1) with + Some (_,Cic.Decl _) -> cannot_delta_expand t + | Some (_,Cic.Def (bo,_)) -> + CicReduction.head_beta_reduce + (appl (CicSubstitution.lift n bo) tl) + | None -> raise RelToHiddenHypothesis + with + Failure _ -> assert false) + | Cic.Const (uri,exp_named_subst) as t -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + (match o with + Cic.Constant (_,Some body,_,_,_) -> + CicReduction.head_beta_reduce + (appl (CicSubstitution.subst_vars exp_named_subst body) tl) + | Cic.Constant (_,None,_,_,_) -> cannot_delta_expand t + | Cic.Variable _ -> raise ReferenceToVariable + | Cic.CurrentProof _ -> raise ReferenceToCurrentProof + | Cic.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + ) + | Cic.Var (uri,exp_named_subst) as t -> + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + (match o with + Cic.Constant _ -> raise ReferenceToConstant + | Cic.CurrentProof _ -> raise ReferenceToCurrentProof + | Cic.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + | Cic.Variable (_,Some body,_,_,_) -> + CicReduction.head_beta_reduce + (appl (CicSubstitution.subst_vars exp_named_subst body) tl) + | Cic.Variable (_,None,_,_,_) -> cannot_delta_expand t + ) + | Cic.Appl [] -> assert false + | Cic.Appl (he::tl) -> hd_delta_beta context tl he + | t -> cannot_delta_expand t + in + let context_and_matched_term_list = + match what with + None -> [context, where] + | Some what -> + let res = + ProofEngineHelpers.locate_in_term + ~equality:first_is_the_expandable_head_of_second + what ~where context + in + if res = [] then + raise + (ProofEngineTypes.Fail + (lazy ("Term "^ CicPp.ppterm what ^ " not found in " ^ CicPp.ppterm where))) + else + res + in + let reduced_terms = + List.map + (function (context,where) -> hd_delta_beta context [] where) + context_and_matched_term_list in + let whats = List.map snd context_and_matched_term_list in + replace ~equality:(==) ~what:whats ~with_what:reduced_terms ~where +;; + +exception WrongShape;; +exception AlreadySimplified;; + +(* Takes a well-typed term and *) +(* 1) Performs beta-iota-zeta reduction until delta reduction is needed *) +(* 2) Attempts delta-reduction. If the residual is a Fix lambda-abstracted *) +(* w.r.t. zero or more variables and if the Fix can be reductaed, than it*) +(* is reduced, the delta-reduction is succesfull and the whole algorithm *) +(* is applied again to the new redex; Step 3.1) is applied to the result *) +(* of the recursive simplification. Otherwise, if the Fix can not be *) +(* reduced, than the delta-reductions fails and the delta-redex is *) +(* not reduced. Otherwise, if the delta-residual is not the *) +(* lambda-abstraction of a Fix, then it performs step 3.2). *) +(* 3.1) Folds the application of the constant to the arguments that did not *) +(* change in every iteration, i.e. to the actual arguments for the *) +(* lambda-abstractions that precede the Fix. *) +(* 3.2) Computes the head beta-zeta normal form of the term. Then it tries *) +(* reductions. If the reduction cannot be performed, it returns the *) +(* original term (not the head beta-zeta normal form of the definiendum) *) +(*CSC: It does not perform simplification in a Case *) + +let simpl context = + (* a simplified term is active if it can create a redex when used as an *) + (* actual parameter *) + let rec is_active = + function + C.Lambda _ + | C.MutConstruct _ + | C.Appl (C.MutConstruct _::_) + | C.CoFix _ -> true + | C.Cast (bo,_) -> is_active bo + | C.LetIn _ -> assert false + | _ -> false + in + (* reduceaux is equal to the reduceaux locally defined inside *) + (* reduce, but for the const case. *) + (**** Step 1 ****) + let rec reduceaux context l = + function + C.Rel n as t -> + (* we never perform delta expansion automatically *) + if l = [] then t else C.Appl (t::l) + | C.Var (uri,exp_named_subst) -> + let exp_named_subst' = + reduceaux_exp_named_subst context l exp_named_subst + in + (let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.Constant _ -> raise ReferenceToConstant + | C.CurrentProof _ -> raise ReferenceToCurrentProof + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + | C.Variable (_,None,_,_,_) -> + let t' = C.Var (uri,exp_named_subst') in + if l = [] then t' else C.Appl (t'::l) + | C.Variable (_,Some body,_,_,_) -> + reduceaux context l + (CicSubstitution.subst_vars exp_named_subst' body) + ) + | C.Meta _ as t -> if l = [] then t else C.Appl (t::l) + | C.Sort _ as t -> t (* l should be empty *) + | C.Implicit _ as t -> t + | C.Cast (te,ty) -> + C.Cast (reduceaux context l te, reduceaux context [] ty) + | C.Prod (name,s,t) -> + assert (l = []) ; + C.Prod (name, + reduceaux context [] s, + reduceaux ((Some (name,C.Decl s))::context) [] t) + | C.Lambda (name,s,t) -> + (match l with + [] -> + C.Lambda (name, + reduceaux context [] s, + reduceaux ((Some (name,C.Decl s))::context) [] t) + | he::tl -> reduceaux context tl (S.subst he t) + (* when name is Anonimous the substitution should be superfluous *) + ) + | C.LetIn (n,s,t) -> + reduceaux context l (S.subst (reduceaux context [] s) t) + | C.Appl (he::tl) -> + let tl' = List.map (reduceaux context []) tl in + reduceaux context (tl'@l) he + | C.Appl [] -> raise (Impossible 1) + | C.Const (uri,exp_named_subst) -> + let exp_named_subst' = + reduceaux_exp_named_subst context l exp_named_subst + in + (let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + match o with + C.Constant (_,Some body,_,_,_) -> + if List.exists is_active l then + try_delta_expansion context l + (C.Const (uri,exp_named_subst')) + (CicSubstitution.subst_vars exp_named_subst' body) + else + let t' = C.Const (uri,exp_named_subst') in + if l = [] then t' else C.Appl (t'::l) + | C.Constant (_,None,_,_,_) -> + let t' = C.Const (uri,exp_named_subst') in + if l = [] then t' else C.Appl (t'::l) + | C.Variable _ -> raise ReferenceToVariable + | C.CurrentProof (_,_,body,_,_,_) -> reduceaux context l body + | C.InductiveDefinition _ -> raise ReferenceToInductiveDefinition + ) + | C.MutInd (uri,i,exp_named_subst) -> + let exp_named_subst' = + reduceaux_exp_named_subst context l exp_named_subst + in + let t' = C.MutInd (uri,i,exp_named_subst') in + if l = [] then t' else C.Appl (t'::l) + | C.MutConstruct (uri,i,j,exp_named_subst) -> + let exp_named_subst' = + reduceaux_exp_named_subst context l exp_named_subst + in + let t' = C.MutConstruct(uri,i,j,exp_named_subst') in + if l = [] then t' else C.Appl (t'::l) + | C.MutCase (mutind,i,outtype,term,pl) -> + let decofix = + function + C.CoFix (i,fl) -> + let (_,_,body) = List.nth fl i in + let body' = + let counter = ref (List.length fl) in + List.fold_right + (fun _ -> decr counter ; S.subst (C.CoFix (!counter,fl))) + fl + body + in + reduceaux context [] body' + | C.Appl (C.CoFix (i,fl) :: tl) -> + let (_,_,body) = List.nth fl i in + let body' = + let counter = ref (List.length fl) in + List.fold_right + (fun _ -> decr counter ; S.subst (C.CoFix (!counter,fl))) + fl + body + in + let tl' = List.map (reduceaux context []) tl in + reduceaux context tl' body' + | t -> t + in + (match decofix (reduceaux context [] term) (*(CicReduction.whd context term)*) with + C.MutConstruct (_,_,j,_) -> reduceaux context l (List.nth pl (j-1)) + | C.Appl (C.MutConstruct (_,_,j,_) :: tl) -> + let (arity, r) = + let o,_ = CicEnvironment.get_obj CicUniv.empty_ugraph mutind in + match o with + C.InductiveDefinition (tl,ingredients,r,_) -> + let (_,_,arity,_) = List.nth tl i in + (arity,r) + | _ -> raise WrongUriToInductiveDefinition + in + let ts = + let rec eat_first = + function + (0,l) -> l + | (n,he::tl) when n > 0 -> eat_first (n - 1, tl) + | _ -> raise (Impossible 5) + in + eat_first (r,tl) + in + reduceaux context (ts@l) (List.nth pl (j-1)) + | C.Cast _ | C.Implicit _ -> + raise (Impossible 2) (* we don't trust our whd ;-) *) + | _ -> + let outtype' = reduceaux context [] outtype in + let term' = reduceaux context [] term in + let pl' = List.map (reduceaux context []) pl in + let res = + C.MutCase (mutind,i,outtype',term',pl') + in + if l = [] then res else C.Appl (res::l) + ) + | C.Fix (i,fl) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,_,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + let t' () = + let fl' = + List.map + (function (n,recindex,ty,bo) -> + (n,recindex,reduceaux context [] ty, reduceaux (tys@context) [] bo) + ) fl + in + C.Fix (i, fl') + in + let (_,recindex,_,body) = List.nth fl i in + let recparam = + try + Some (List.nth l recindex) + with + _ -> None + in + (match recparam with + Some recparam -> + (match reduceaux context [] recparam with + C.MutConstruct _ + | C.Appl ((C.MutConstruct _)::_) -> + let body' = + let counter = ref (List.length fl) in + List.fold_right + (fun _ -> decr counter ; S.subst (C.Fix (!counter,fl))) + fl + body + in + (* Possible optimization: substituting whd recparam in l*) + reduceaux context l body' + | _ -> if l = [] then t' () else C.Appl ((t' ())::l) + ) + | None -> if l = [] then t' () else C.Appl ((t' ())::l) + ) + | C.CoFix (i,fl) -> + let tys,_ = + List.fold_left + (fun (types,len) (n,ty,_) -> + (Some (C.Name n,(C.Decl (CicSubstitution.lift len ty)))::types, + len+1) + ) ([],0) fl + in + let t' = + let fl' = + List.map + (function (n,ty,bo) -> + (n,reduceaux context [] ty, reduceaux (tys@context) [] bo) + ) fl + in + C.CoFix (i, fl') + in + if l = [] then t' else C.Appl (t'::l) + and reduceaux_exp_named_subst context l = + List.map (function uri,t -> uri,reduceaux context [] t) + (**** Step 2 ****) + and reduce_with_no_hope_to_fold_back t l = + prerr_endline "reduce_with_no_hope_to_fold_back"; + let simplified = reduceaux context l t in + let t' = if l = [] then t else C.Appl (t::l) in + if t' = simplified then + raise AlreadySimplified + else + simplified + + and try_delta_expansion context l term body = + try + let res,constant_args = + let rec aux rev_constant_args l = + function + C.Lambda (name,s,t) -> + begin + match l with + [] -> raise WrongShape + | he::tl -> + (* when name is Anonimous the substitution should *) + (* be superfluous *) + aux (he::rev_constant_args) tl (S.subst he t) + end + | C.LetIn (_,s,t) -> + aux rev_constant_args l (S.subst s t) + | C.Fix (i,fl) -> + let (_,recindex,_,body) = List.nth fl i in + let recparam = + try + List.nth l recindex + with + _ -> raise AlreadySimplified + in + (match reduceaux context [] recparam (*CicReduction.whd context recparam*) with + C.MutConstruct _ + | C.Appl ((C.MutConstruct _)::_) -> + let body' = + let counter = ref (List.length fl) in + List.fold_right + (function _ -> + decr counter ; S.subst (C.Fix (!counter,fl)) + ) fl body + in + (* Possible optimization: substituting whd *) + (* recparam in l *) + reduceaux context l body', + List.rev rev_constant_args + | _ -> raise AlreadySimplified + ) + | _ -> raise WrongShape + in + aux [] l body + in + (**** Step 3.1 ****) + let term_to_fold, delta_expanded_term_to_fold = + match constant_args with + [] -> term,body + | _ -> C.Appl (term::constant_args), C.Appl (body::constant_args) + in + let simplified_term_to_fold = + reduceaux context [] delta_expanded_term_to_fold + in + replace_lifting ~equality:(fun _ x y -> x = y) ~context + ~what:[simplified_term_to_fold] ~with_what:[term_to_fold] ~where:res + with + WrongShape -> + let rec skip_lambda n = function + | Cic.Lambda (_,_,t) -> skip_lambda (n+1) t | t -> t, n + in + let is_fix uri = + match fst(CicEnvironment.get_obj CicUniv.oblivion_ugraph uri) with + | Cic.Constant (_,Some bo, _, _,_) -> + (let t, _ = skip_lambda 0 bo in + match t with | Cic.Fix _ -> true | _ -> false) + | _ -> false + in + let guess_recno uri = + prerr_endline ("GUESS: " ^ UriManager.string_of_uri uri); + match fst(CicEnvironment.get_obj CicUniv.oblivion_ugraph uri) with + | Cic.Constant (_,Some bo, _, _,_ ) -> + let t, n = skip_lambda 0 bo in + (match t with + | Cic.Fix (i,fl) -> + let _,recno,_,_ = List.nth fl i in + prerr_endline ("GUESSED: " ^ string_of_int recno ^ " after " ^ + string_of_int n ^ " lambdas"); + recno + n + | _ -> assert false) + | _ -> assert false + in + let original_args = l in + (**** Step 3.2 ****) + let rec aux l = + function + | C.Lambda (name,s,t) -> + (match l with + | [] -> raise AlreadySimplified + | he::tl -> + (* when name is Anonimous the substitution should *) + (* be superfluous *) + aux tl (S.subst he t)) + | C.LetIn (_,s,t) -> aux l (S.subst s t) + | Cic.Appl (Cic.Const (uri,_) :: args) as t when is_fix uri -> + let recno = + prerr_endline ("cerco : " ^ string_of_int (guess_recno uri) + ^ " in: " ^ String.concat " " + (List.map (fun x -> CicPp.ppterm x) args)); + prerr_endline ("e piglio il rispettivo in :"^String.concat " " + (List.map (fun x -> CicPp.ppterm x) original_args)); + (* look for args[regno] in saved_args *) + let wanted = List.nth (args@l) (guess_recno uri) in + let rec aux n = function + | [] -> n (* DA CAPIRE *) + | t::_ when t = wanted -> n + | _::tl -> aux (n+1) tl + in + aux 0 original_args + in + if recno = List.length original_args then + reduce_with_no_hope_to_fold_back t l + else + let simplified = reduceaux context l t in + let rec mk_implicits = function + | n,_::tl when n = recno -> + Cic.Implicit None :: (mk_implicits (n+1,tl)) + | n,arg::tl -> arg :: (mk_implicits (n+1,tl)) + | _,[] -> [] + in + (* we try to fold back constant that do not expand to Fix *) + let _ = prerr_endline + ("INIZIO (" ^ string_of_int recno ^ ") : " ^ CicPp.ppterm + simplified) in + let term_to_fold = + Cic.Appl (term:: mk_implicits (0,original_args)) + in + (try + let term_to_fold, _, metasenv, _ = + CicRefine.type_of_aux' [] context term_to_fold + CicUniv.oblivion_ugraph + in + let _ = + prerr_endline ("RAFFINA: "^CicPp.ppterm term_to_fold) in + let _ = + prerr_endline + ("RAFFINA: "^CicMetaSubst.ppmetasenv [] metasenv) in + let simplified_term_to_fold = unfold context term_to_fold in + let _ = + prerr_endline ("SEMPLIFICA: " ^ + CicPp.ppterm simplified_term_to_fold) + in + let rec do_n f t = + let t1 = f t in + if t1 = t then t else do_n f t1 + in + do_n + (fun simplified -> + let subst = ref [] in + let myunif ctx t1 t2 = + if !subst <> [] then false + else + try + prerr_endline "MUNIF"; + prerr_endline (CicPp.ppterm t1); + prerr_endline "VS"; + prerr_endline (CicPp.ppterm t2 ^ "\n"); + let subst1, _, _ = + CicUnification.fo_unif metasenv ctx t1 t2 + CicUniv.empty_ugraph + in + prerr_endline "UNIFICANO\n\n\n"; + subst := subst1; + true + with + | CicUnification.UnificationFailure s + | CicUnification.Uncertain s + | CicUnification.AssertFailure s -> + prerr_endline (Lazy.force s); false + | CicUtil.Meta_not_found _ -> false + (* + | _ as exn -> + prerr_endline (Printexc.to_string exn); + false*) + in + let t = + replace_lifting myunif context + [simplified_term_to_fold] [term_to_fold] simplified + in + let _ = prerr_endline "UNIFICA" in + if List.length metasenv <> List.length !subst then + let _ = prerr_endline ("SUBST CORTA " ^ + CicMetaSubst.ppsubst !subst ~metasenv) + in + simplified + else + if t = simplified then + let _ = prerr_endline "NULLA DI FATTO" in + simplified + else + let t = CicMetaSubst.apply_subst !subst t in + prerr_endline ("ECCO: " ^ CicPp.ppterm t); t) + simplified + with + | CicRefine.RefineFailure s + | CicRefine.Uncertain s + | CicRefine.AssertFailure s -> + prerr_endline (Lazy.force s); simplified + (*| exn -> prerr_endline (Printexc.to_string exn); simplified*)) + | t -> reduce_with_no_hope_to_fold_back t l + in + (try aux l body + with + AlreadySimplified -> + if l = [] then term else C.Appl (term::l)) + | AlreadySimplified -> + (* If we performed delta-reduction, we would find a Fix *) + (* not applied to a constructor. So, we refuse to perform *) + (* delta-reduction. *) + if l = [] then term else C.Appl (term::l) + in + reduceaux context [] +;; diff --git a/components/tactics/proofEngineReduction.mli b/components/tactics/proofEngineReduction.mli new file mode 100644 index 000000000..f8cdec89b --- /dev/null +++ b/components/tactics/proofEngineReduction.mli @@ -0,0 +1,74 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception Impossible of int +exception ReferenceToConstant +exception ReferenceToVariable +exception ReferenceToCurrentProof +exception ReferenceToInductiveDefinition +exception WrongUriToInductiveDefinition +exception RelToHiddenHypothesis +exception WrongShape +exception AlreadySimplified +exception WhatAndWithWhatDoNotHaveTheSameLength;; + +(* Replaces "textually" in "where" every term in "what" with the corresponding + term in "with_what". The terms in "what" ARE NOT lifted when binders are + crossed. The terms in "with_what" ARE NOT lifted when binders are crossed. + Every free variable in "where" IS NOT lifted by nnn. *) +val replace : + equality:('a -> Cic.term -> bool) -> + what:'a list -> with_what:Cic.term list -> where:Cic.term -> Cic.term + +(* Replaces in "where" every term in "what" with the corresponding + term in "with_what". The terms in "what" ARE lifted when binders are + crossed. The terms in "with_what" ARE lifted when binders are crossed. + Every free variable in "where" IS NOT lifted by nnn. + Thus "replace_lifting_csc 1 ~with_what:[Rel 1; ... ; Rel 1]" is the + inverse of subst up to the fact that free variables in "where" are NOT + lifted. *) +val replace_lifting : + equality:(Cic.context -> Cic.term -> Cic.term -> bool) -> + context:Cic.context -> + what:Cic.term list -> with_what:Cic.term list -> where:Cic.term -> Cic.term + +(* Replaces in "where" every term in "what" with the corresponding + term in "with_what". The terms in "what" ARE NOT lifted when binders are + crossed. The terms in "with_what" ARE lifted when binders are crossed. + Every free variable in "where" IS lifted by nnn. + Thus "replace_lifting_csc 1 ~with_what:[Rel 1; ... ; Rel 1]" is the + inverse of subst up to the fact that "what" terms are NOT lifted. *) +val replace_lifting_csc : + int -> equality:(Cic.term -> Cic.term -> bool) -> + what:Cic.term list -> with_what:Cic.term list -> where:Cic.term -> Cic.term + +(* This is like "replace_lifting_csc 1 ~with_what:[Rel 1; ... ; Rel 1]" + up to the fact that the index to start from can be specified *) +val replace_with_rel_1_from : + equality:(Cic.term -> Cic.term -> bool) -> + what:Cic.term list -> int -> Cic.term -> Cic.term +val reduce : Cic.context -> Cic.term -> Cic.term +val simpl : Cic.context -> Cic.term -> Cic.term +val unfold : ?what:Cic.term -> Cic.context -> Cic.term -> Cic.term diff --git a/components/tactics/proofEngineStructuralRules.ml b/components/tactics/proofEngineStructuralRules.ml new file mode 100644 index 000000000..ea7586e16 --- /dev/null +++ b/components/tactics/proofEngineStructuralRules.ml @@ -0,0 +1,196 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +module PET = ProofEngineTypes +module C = Cic + +let clearbody ~hyp = + let clearbody (proof, goal) = + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,_,_ = CicUtil.lookup_meta goal metasenv in + let string_of_name = + function + C.Name n -> n + | C.Anonymous -> "_" + in + let metasenv' = + List.map + (function + (m,canonical_context,ty) when m = metano -> + let canonical_context' = + List.fold_right + (fun entry context -> + match entry with + Some (C.Name hyp',C.Def (term,ty)) when hyp = hyp' -> + let cleared_entry = + let ty = + match ty with + Some ty -> ty + | None -> + fst + (CicTypeChecker.type_of_aux' metasenv context term + CicUniv.empty_ugraph) (* TASSI: FIXME *) + in + Some (C.Name hyp, Cic.Decl ty) + in + cleared_entry::context + | None -> None::context + | Some (n,C.Decl t) + | Some (n,C.Def (t,None)) -> + let _,_ = + try + CicTypeChecker.type_of_aux' metasenv context t + CicUniv.empty_ugraph (* TASSI: FIXME *) + with + _ -> + raise + (PET.Fail + (lazy ("The correctness of hypothesis " ^ + string_of_name n ^ + " relies on the body of " ^ hyp) + )) + in + entry::context + | Some (_,Cic.Def (_,Some _)) -> assert false + ) canonical_context [] + in + let _,_ = + try + CicTypeChecker.type_of_aux' metasenv canonical_context' ty + CicUniv.empty_ugraph (* TASSI: FIXME *) + with + _ -> + raise + (PET.Fail + (lazy ("The correctness of the goal relies on the body of " ^ + hyp))) + in + m,canonical_context',ty + | t -> t + ) metasenv + in + (curi,metasenv',_subst,pbo,pty, attrs), [goal] + in + PET.mk_tactic clearbody + +let clear_one ~hyp = + let clear_one (proof, goal) = + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let metano,context,ty = + CicUtil.lookup_meta goal metasenv + in + let string_of_name = + function + C.Name n -> n + | C.Anonymous -> "_" + in + let metasenv' = + List.map + (function + (m,canonical_context,ty) when m = metano -> + let context_changed, canonical_context' = + List.fold_right + (fun entry (b, context) -> + match entry with + Some (Cic.Name hyp',_) when hyp' = hyp -> + (true, None::context) + | None -> (b, None::context) + | Some (n,C.Decl t) + | Some (n,Cic.Def (t,Some _)) + | Some (n,C.Def (t,None)) -> + if b then + let _,_ = + try + CicTypeChecker.type_of_aux' metasenv context t + CicUniv.empty_ugraph + with _ -> + raise + (PET.Fail + (lazy ("Hypothesis " ^ string_of_name n ^ + " uses hypothesis " ^ hyp))) + in + (b, entry::context) + else + (b, entry::context) + ) canonical_context (false, []) + in + if not context_changed then + raise (PET.Fail (lazy ("Hypothesis " ^ hyp ^ " does not exist"))); + let _,_ = + try + CicTypeChecker.type_of_aux' metasenv canonical_context' ty + CicUniv.empty_ugraph + with _ -> + raise (PET.Fail (lazy ("Hypothesis " ^ hyp ^ " occurs in the goal"))) + in + m,canonical_context',ty + | t -> t + ) metasenv + in + (curi,metasenv',_subst,pbo,pty, attrs), [goal] + in + PET.mk_tactic clear_one + +let clear ~hyps = + let clear status = + let aux status hyp = + match PET.apply_tactic (clear_one ~hyp) status with + | proof, [g] -> proof, g + | _ -> raise (PET.Fail (lazy "clear: internal error")) + in + let proof, g = List.fold_left aux status hyps in + proof, [g] + in + PET.mk_tactic clear + +(* Warning: this tactic has no effect on the proof term. + It just changes the name of an hypothesis in the current sequent *) +let rename ~froms ~tos = + let rename (proof, goal) = + let error = "rename: lists of different length" in + let assocs = + try List.combine froms tos + with Invalid_argument _ -> raise (PET.Fail (lazy error)) + in + let curi, metasenv, _subst, pbo, pty, attrs = proof in + let metano, _, _ = CicUtil.lookup_meta goal metasenv in + let rename_map = function + | Some (Cic.Name hyp, decl_or_def) as entry -> + begin try Some (Cic.Name (List.assoc hyp assocs), decl_or_def) + with Not_found -> entry end + | entry -> entry + in + let map = function + | m, canonical_context, ty when m = metano -> + let canonical_context = List.map rename_map canonical_context in + m, canonical_context, ty + | conjecture -> conjecture + in + let metasenv = List.map map metasenv in + (curi, metasenv, _subst, pbo, pty, attrs), [goal] + in + PET.mk_tactic rename diff --git a/components/tactics/proofEngineStructuralRules.mli b/components/tactics/proofEngineStructuralRules.mli new file mode 100644 index 000000000..d8e9ed376 --- /dev/null +++ b/components/tactics/proofEngineStructuralRules.mli @@ -0,0 +1,31 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val clearbody: hyp:string -> ProofEngineTypes.tactic +val clear: hyps:string list -> ProofEngineTypes.tactic + +(* Warning: this tactic has no effect on the proof term. + It just changes the name of an hypothesis in the current sequent *) +val rename: froms:string list -> tos:string list -> ProofEngineTypes.tactic diff --git a/components/tactics/proofEngineTypes.ml b/components/tactics/proofEngineTypes.ml new file mode 100644 index 000000000..93436e799 --- /dev/null +++ b/components/tactics/proofEngineTypes.ml @@ -0,0 +1,111 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + + (** + current proof (proof uri * metas * (in)complete proof * term to be prooved) + *) +type proof = UriManager.uri option * Cic.metasenv * Cic.substitution * Cic.term * Cic.term * Cic.attribute list + (** current goal, integer index *) +type goal = int +type status = proof * goal + +let initial_status ty metasenv attrs = + let rec aux max = function + | [] -> max + 1 + | (idx, _, _) :: tl -> + if idx > max then + aux idx tl + else + aux max tl + in + let newmeta_idx = aux 0 metasenv in + let _subst = [] in + let proof = + None, (newmeta_idx, [], ty) :: metasenv, _subst, Cic.Meta (newmeta_idx, []), ty, attrs + in + (proof, newmeta_idx) + + (** + a tactic: make a transition from one status to another one or, usually, + raise a "Fail" (@see Fail) exception in case of failure + *) + (** an unfinished proof with the optional current goal *) +type tactic = status -> proof * goal list + + (** creates an opaque tactic from a status->proof*goal list function *) +let mk_tactic t = t + +type reduction = Cic.context -> Cic.term -> Cic.term + +let const_lazy_term t = + (fun _ metasenv ugraph -> t, metasenv, ugraph) + +type lazy_reduction = + Cic.context -> Cic.metasenv -> CicUniv.universe_graph -> + reduction * Cic.metasenv * CicUniv.universe_graph + +let const_lazy_reduction red = + (fun _ metasenv ugraph -> red, metasenv, ugraph) + +type ('term, 'lazy_term) pattern = + 'lazy_term option * (string * 'term) list * 'term option + +type lazy_pattern = (Cic.term, Cic.lazy_term) pattern + +let hole = Cic.Implicit (Some `Hole) + +let conclusion_pattern t = + let t' = + match t with + | None -> None + | Some t -> Some (const_lazy_term t) + in + t',[], Some hole + + (** tactic failure *) +exception Fail of string Lazy.t + + (** + calls the opaque tactic on the status + *) +let apply_tactic t status = + let (uri,metasenv,subst,bo,ty, attrs), gl = t status in + match + CicRefine.pack_coercion_obj + (Cic.CurrentProof ("",metasenv,Cic.Rel ~-1,ty,[],attrs)) + with + | Cic.CurrentProof (_,metasenv,_,ty,_, attrs) -> + (uri,metasenv,subst,bo,ty, attrs), gl + | _ -> assert false +;; + + (** constraint: the returned value will always be constructed by Cic.Name **) +type mk_fresh_name_type = + Cic.metasenv -> Cic.context -> Cic.name -> typ:Cic.term -> Cic.name + +let goals_of_proof (_,metasenv,_subst,_,_,_) = List.map (fun (g,_,_) -> g) metasenv + diff --git a/components/tactics/proofEngineTypes.mli b/components/tactics/proofEngineTypes.mli new file mode 100644 index 000000000..7c7b8330e --- /dev/null +++ b/components/tactics/proofEngineTypes.mli @@ -0,0 +1,78 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + + (** + current proof (proof uri * metas * (in)complete proof * term to be prooved) + *) +type proof = + UriManager.uri option * Cic.metasenv * Cic.substitution * Cic.term * Cic.term * Cic.attribute list + (** current goal, integer index *) +type goal = int +type status = proof * goal + + (** @param goal + * @param goal's metasenv + * @return initial proof status for the given goal *) +val initial_status: Cic.term -> Cic.metasenv -> Cic.attribute list -> status + + (** + a tactic: make a transition from one status to another one or, usually, + raise a "Fail" (@see Fail) exception in case of failure + *) + (** an unfinished proof with the optional current goal *) +type tactic +val mk_tactic: (status -> proof * goal list) -> tactic + +type reduction = Cic.context -> Cic.term -> Cic.term + +val const_lazy_term: Cic.term -> Cic.lazy_term + +type lazy_reduction = + Cic.context -> Cic.metasenv -> CicUniv.universe_graph -> + reduction * Cic.metasenv * CicUniv.universe_graph + +val const_lazy_reduction: reduction -> lazy_reduction + + (** what, hypothesis patterns, conclusion pattern *) +type ('term, 'lazy_term) pattern = + 'lazy_term option * (string * 'term) list * 'term option + +type lazy_pattern = (Cic.term, Cic.lazy_term) pattern + + (** conclusion_pattern [t] returns the pattern (t,[],%) *) +val conclusion_pattern : Cic.term option -> lazy_pattern + + (** tactic failure *) +exception Fail of string Lazy.t + +val apply_tactic: tactic -> status -> proof * goal list + + (** constraint: the returned value will always be constructed by Cic.Name **) +type mk_fresh_name_type = + Cic.metasenv -> Cic.context -> Cic.name -> typ:Cic.term -> Cic.name + +val goals_of_proof: proof -> goal list + +val hole: Cic.term diff --git a/components/tactics/reductionTactics.ml b/components/tactics/reductionTactics.ml new file mode 100644 index 000000000..9c39caa6f --- /dev/null +++ b/components/tactics/reductionTactics.ml @@ -0,0 +1,238 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +open ProofEngineTypes + +(* Note: this code is almost identical to change_tac and +* it could be unified by making the change function a callback *) +let reduction_tac ~reduction ~pattern (proof,goal) = + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let (metano,context,ty) as conjecture = CicUtil.lookup_meta goal metasenv in + let change subst where terms metasenv ugraph = + if terms = [] then where, metasenv, ugraph + else + let pairs, metasenv, ugraph = + List.fold_left + (fun (pairs, metasenv, ugraph) (context, t) -> + let reduction, metasenv, ugraph = reduction context metasenv ugraph in + ((t, reduction context t) :: pairs), metasenv, ugraph) + ([], metasenv, ugraph) + terms + in + let terms, terms' = List.split pairs in + let where' = + ProofEngineReduction.replace ~equality:(==) ~what:terms ~with_what:terms' + ~where:where + in + CicMetaSubst.apply_subst subst where', metasenv, ugraph + in + let (subst,metasenv,ugraph,selected_context,selected_ty) = + ProofEngineHelpers.select ~metasenv ~ugraph:CicUniv.empty_ugraph + ~conjecture ~pattern + in + let ty', metasenv, ugraph = change subst ty selected_ty metasenv ugraph in + let context', metasenv, ugraph = + List.fold_right2 + (fun entry selected_entry (context', metasenv, ugraph) -> + match entry,selected_entry with + None,None -> None::context', metasenv, ugraph + | Some (name,Cic.Decl ty),Some (`Decl selected_ty) -> + let ty', metasenv, ugraph = + change subst ty selected_ty metasenv ugraph + in + Some (name,Cic.Decl ty')::context', metasenv, ugraph + | Some (name,Cic.Def (bo,ty)),Some (`Def (selected_bo,selected_ty)) -> + let bo', metasenv, ugraph = + change subst bo selected_bo metasenv ugraph + in + let ty', metasenv, ugraph = + match ty,selected_ty with + None,None -> None, metasenv, ugraph + | Some ty,Some selected_ty -> + let ty', metasenv, ugraph = + change subst ty selected_ty metasenv ugraph + in + Some ty', metasenv, ugraph + | _,_ -> assert false + in + (Some (name,Cic.Def (bo',ty'))::context'), metasenv, ugraph + | _,_ -> assert false + ) context selected_context ([], metasenv, ugraph) in + let metasenv' = + List.map (function + | (n,_,_) when n = metano -> (metano,context',ty') + | _ as t -> t + ) metasenv + in + (curi,metasenv',_subst,pbo,pty, attrs), [metano] +;; + +let simpl_tac ~pattern = + mk_tactic (reduction_tac + ~reduction:(const_lazy_reduction ProofEngineReduction.simpl) ~pattern) + +let reduce_tac ~pattern = + mk_tactic (reduction_tac + ~reduction:(const_lazy_reduction ProofEngineReduction.reduce) ~pattern) + +let unfold_tac what ~pattern = + let reduction = + match what with + | None -> const_lazy_reduction (ProofEngineReduction.unfold ?what:None) + | Some lazy_term -> + (fun context metasenv ugraph -> + let what, metasenv, ugraph = lazy_term context metasenv ugraph in + ProofEngineReduction.unfold ~what, metasenv, ugraph) + in + mk_tactic (reduction_tac ~reduction ~pattern) + +let whd_tac ~pattern = + mk_tactic (reduction_tac + ~reduction:(const_lazy_reduction CicReduction.whd) ~pattern) + +let normalize_tac ~pattern = + mk_tactic (reduction_tac + ~reduction:(const_lazy_reduction CicReduction.normalize) ~pattern) + +let head_beta_reduce_tac ?delta ?upto ~pattern = + mk_tactic (reduction_tac + ~reduction: + (const_lazy_reduction + (fun _context -> CicReduction.head_beta_reduce ?delta ?upto)) ~pattern) + +exception NotConvertible + +(* Note: this code is almost identical to reduction_tac and +* it could be unified by making the change function a callback *) +(* CSC: with_what is parsed in the context of the goal, but it should replace + something that lives in a completely different context. Thus we + perform a delift + lift phase to move it in the right context. However, + in this way the tactic is less powerful than expected: with_what cannot + reference variables that are local to the term that is going to be + replaced. To fix this we should parse with_what in the context of the + term(s) to be replaced. *) +let change_tac ?(with_cast=false) ~pattern with_what = + let change_tac ~pattern ~with_what (proof, goal) = + let curi,metasenv,_subst,pbo,pty, attrs = proof in + let (metano,context,ty) as conjecture = CicUtil.lookup_meta goal metasenv in + let change subst where terms metasenv ugraph = + if terms = [] then where, metasenv, ugraph + else + let pairs, metasenv, ugraph = + List.fold_left + (fun (pairs, metasenv, ugraph) (context_of_t, t) -> + let with_what, metasenv, ugraph = + with_what context_of_t metasenv ugraph + in + let _,u = + CicTypeChecker.type_of_aux' metasenv context_of_t with_what ugraph + in + let b,_ = + CicReduction.are_convertible ~metasenv context_of_t t with_what u + in + if b then + ((t, with_what) :: pairs), metasenv, ugraph + else + raise NotConvertible) + ([], metasenv, ugraph) + terms + in + let terms, terms' = List.split pairs in + let where' = + ProofEngineReduction.replace ~equality:(==) ~what:terms ~with_what:terms' + ~where:where + in + CicMetaSubst.apply_subst subst where', metasenv, ugraph + in + let (subst,metasenv,ugraph,selected_context,selected_ty) = + ProofEngineHelpers.select ~metasenv ~ugraph:CicUniv.empty_ugraph ~conjecture + ~pattern in + let ty', metasenv, ugraph = change subst ty selected_ty metasenv ugraph in + let context', metasenv, ugraph = + List.fold_right2 + (fun entry selected_entry (context', metasenv, ugraph) -> + match entry,selected_entry with + None,None -> (None::context'), metasenv, ugraph + | Some (name,Cic.Decl ty),Some (`Decl selected_ty) -> + let ty', metasenv, ugraph = + change subst ty selected_ty metasenv ugraph + in + (Some (name,Cic.Decl ty')::context'), metasenv, ugraph + | Some (name,Cic.Def (bo,ty)),Some (`Def (selected_bo,selected_ty)) -> + let bo', metasenv, ugraph = + change subst bo selected_bo metasenv ugraph + in + let ty', metasenv, ugraph = + match ty,selected_ty with + None,None -> None, metasenv, ugraph + | Some ty,Some selected_ty -> + let ty', metasenv, ugraph = + change subst ty selected_ty metasenv ugraph + in + Some ty', metasenv, ugraph + | _,_ -> assert false + in + (Some (name,Cic.Def (bo',ty'))::context'), metasenv, ugraph + | _,_ -> assert false + ) context selected_context ([], metasenv, ugraph) in + let metasenv' = + List.map + (function + | (n,_,_) when n = metano -> (metano,context',ty') + | _ as t -> t) + metasenv + in + let proof,goal = (curi,metasenv',_subst,pbo,pty, attrs), metano in + if with_cast then + let metano' = ProofEngineHelpers.new_meta_of_proof ~proof in + let (newproof,_) = + let irl= CicMkImplicit.identity_relocation_list_for_metavariable context' + in + ProofEngineHelpers.subst_meta_in_proof + proof metano + (Cic.Cast (Cic.Meta(metano',irl),ty')) [metano',context',ty'] + in + newproof, [metano'] + else + proof,[goal] + in + mk_tactic (change_tac ~pattern ~with_what) + +let fold_tac ~reduction ~term ~pattern = + let fold_tac ~reduction ~term ~pattern:(wanted,hyps_pat,concl_pat) status = + assert (wanted = None); (* this should be checked syntactically *) + let reduced_term = + (fun context metasenv ugraph -> + let term, metasenv, ugraph = term context metasenv ugraph in + let reduction, metasenv, ugraph = reduction context metasenv ugraph in + reduction context term, metasenv, ugraph) + in + apply_tactic + (change_tac ~pattern:(Some reduced_term,hyps_pat,concl_pat) term) status + in + mk_tactic (fold_tac ~reduction ~term ~pattern) + diff --git a/components/tactics/reductionTactics.mli b/components/tactics/reductionTactics.mli new file mode 100644 index 000000000..f04e7dcac --- /dev/null +++ b/components/tactics/reductionTactics.mli @@ -0,0 +1,49 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val simpl_tac: pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val reduce_tac: pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val whd_tac: pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val normalize_tac: pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val head_beta_reduce_tac: ?delta:bool -> ?upto:int -> pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic + +(* The default of term is the thesis of the goal to be prooved *) +val unfold_tac: + Cic.lazy_term option -> + pattern:ProofEngineTypes.lazy_pattern -> + ProofEngineTypes.tactic + +val change_tac: + ?with_cast:bool -> + pattern:ProofEngineTypes.lazy_pattern -> + Cic.lazy_term -> + ProofEngineTypes.tactic + +val fold_tac: + reduction:ProofEngineTypes.lazy_reduction -> + term:Cic.lazy_term -> + pattern:ProofEngineTypes.lazy_pattern -> + ProofEngineTypes.tactic + diff --git a/components/tactics/ring.ml b/components/tactics/ring.ml new file mode 100644 index 000000000..7695a4ff0 --- /dev/null +++ b/components/tactics/ring.ml @@ -0,0 +1,594 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +open CicReduction +open PrimitiveTactics +open ProofEngineTypes +open UriManager + +(** DEBUGGING *) + + (** perform debugging output? *) +let debug = false +let debug_print = fun _ -> () + + (** debugging print *) +let warn s = debug_print (lazy ("RING WARNING: " ^ (Lazy.force s))) + +(** CIC URIS *) + +(** + Note: For constructors URIs aren't really URIs but rather triples of + the form (uri, typeno, consno). This discrepancy is to preserver an + uniformity of invocation of "mkXXX" functions. +*) + +let equality_is_a_congruence_A = + uri_of_string "cic:/Coq/Init/Logic/Logic_lemmas/equality/A.var" +let equality_is_a_congruence_x = + uri_of_string "cic:/Coq/Init/Logic/Logic_lemmas/equality/x.var" +let equality_is_a_congruence_y = + uri_of_string "cic:/Coq/Init/Logic/Logic_lemmas/equality/y.var" + +let apolynomial_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/apolynomial.ind" +let apvar_uri = (apolynomial_uri, 0, 1) +let ap0_uri = (apolynomial_uri, 0, 2) +let ap1_uri = (apolynomial_uri, 0, 3) +let applus_uri = (apolynomial_uri, 0, 4) +let apmult_uri = (apolynomial_uri, 0, 5) +let apopp_uri = (apolynomial_uri, 0, 6) + +let quote_varmap_A_uri = uri_of_string "cic:/Coq/ring/Quote/variables_map/A.var" +let varmap_uri = uri_of_string "cic:/Coq/ring/Quote/varmap.ind" +let empty_vm_uri = (varmap_uri, 0, 1) +let node_vm_uri = (varmap_uri, 0, 2) +let varmap_find_uri = uri_of_string "cic:/Coq/ring/Quote/varmap_find.con" +let index_uri = uri_of_string "cic:/Coq/ring/Quote/index.ind" +let left_idx_uri = (index_uri, 0, 1) +let right_idx_uri = (index_uri, 0, 2) +let end_idx_uri = (index_uri, 0, 3) + +let abstract_rings_A_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/abstract_rings/A.var" +let abstract_rings_Aplus_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/abstract_rings/Aplus.var" +let abstract_rings_Amult_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/abstract_rings/Amult.var" +let abstract_rings_Aone_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/abstract_rings/Aone.var" +let abstract_rings_Azero_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/abstract_rings/Azero.var" +let abstract_rings_Aopp_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/abstract_rings/Aopp.var" +let abstract_rings_Aeq_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/abstract_rings/Aeq.var" +let abstract_rings_vm_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/abstract_rings/vm.var" +let abstract_rings_T_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/abstract_rings/T.var" +let interp_ap_uri = uri_of_string "cic:/Coq/ring/Ring_abstract/interp_ap.con" +let interp_sacs_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/interp_sacs.con" +let apolynomial_normalize_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/apolynomial_normalize.con" +let apolynomial_normalize_ok_uri = + uri_of_string "cic:/Coq/ring/Ring_abstract/apolynomial_normalize_ok.con" + +(** CIC PREDICATES *) + + (** + check whether a term is a constant or not, if argument "uri" is given and is + not "None" also check if the constant correspond to the given one or not + *) +let cic_is_const ?(uri: uri option = None) term = + match uri with + | None -> + (match term with + | Cic.Const _ -> true + | _ -> false) + | Some realuri -> + (match term with + | Cic.Const (u, _) when (eq u realuri) -> true + | _ -> false) + +(** PROOF AND GOAL ACCESSORS *) + + (** + @param proof a proof + @return the uri of a given proof + *) +let uri_of_proof ~proof:(uri, _, _, _, _, _) = uri + + (** + @param status current proof engine status + @raise Failure if proof is None + @return current goal's metasenv + *) +let metasenv_of_status ((_,m,_,_,_, _), _) = m + + (** + @param status a proof engine status + @raise Failure when proof or goal are None + @return context corresponding to current goal + *) +let context_of_status status = + let (proof, goal) = status in + let metasenv = metasenv_of_status status in + let _, context, _ = CicUtil.lookup_meta goal metasenv in + context + +(** CIC TERM CONSTRUCTORS *) + + (** + Create a Cic term consisting of a constant + @param uri URI of the constant + @proof current proof + @exp_named_subst explicit named substitution + *) +let mkConst ~uri ~exp_named_subst = + Cic.Const (uri, exp_named_subst) + + (** + Create a Cic term consisting of a constructor + @param uri triple where uri is the uri of an inductive + type, typeno is the type number in a mutind structure (0 based), consno is + the constructor number (1 based) + @exp_named_subst explicit named substitution + *) +let mkCtor ~uri:(uri, typeno, consno) ~exp_named_subst = + Cic.MutConstruct (uri, typeno, consno, exp_named_subst) + + (** + Create a Cic term consisting of a type member of a mutual induction + @param uri pair where uri is the uri of a mutual inductive + type and typeno is the type number (0 based) in the mutual induction + @exp_named_subst explicit named substitution + *) +let mkMutInd ~uri:(uri, typeno) ~exp_named_subst = + Cic.MutInd (uri, typeno, exp_named_subst) + +(** EXCEPTIONS *) + + (** + raised when the current goal is not ringable; a goal is ringable when is an + equality on reals (@see r_uri) + *) +exception GoalUnringable + +(** RING's FUNCTIONS LIBRARY *) + + (** + Check whether the ring tactic can be applied on a given term (i.e. that is + an equality on reals) + @param term to be tested + @return true if the term is ringable, false otherwise + *) +let ringable = + let is_equality = function + | Cic.MutInd (uri, 0, []) when (eq uri HelmLibraryObjects.Logic.eq_URI) -> true + | _ -> false + in + let is_real = function + | Cic.Const (uri, _) when (eq uri HelmLibraryObjects.Reals.r_URI) -> true + | _ -> false + in + function + | Cic.Appl (app::set::_::_::[]) when (is_equality app && is_real set) -> + warn (lazy "Goal Ringable!"); + true + | _ -> + warn (lazy "Goal Not Ringable :-(("); + false + + (** + split an equality goal of the form "t1 = t2" in its two subterms t1 and t2 + after checking that the goal is ringable + @param goal the current goal + @return a pair (t1,t2) that are two sides of the equality goal + @raise GoalUnringable if the goal isn't ringable + *) +let split_eq = function + | (Cic.Appl (_::_::t1::t2::[])) as term when ringable term -> + warn (lazy ("" ^ (CicPp.ppterm t1) ^ "")); + warn (lazy ("" ^ (CicPp.ppterm t2) ^ "")); + (t1, t2) + | _ -> raise GoalUnringable + + (** + @param i an integer index representing a 1 based number of node in a binary + search tree counted in a fbs manner (i.e.: 1 is the root, 2 is the left + child of the root (if any), 3 is the right child of the root (if any), 4 is + the left child of the left child of the root (if any), ....) + @param proof the current proof + @return an index representing the same node in a varmap (@see varmap_uri), + the returned index is as defined in index (@see index_uri) + *) +let path_of_int n = + let rec digits_of_int n = + if n=1 then [] else (n mod 2 = 1)::(digits_of_int (n lsr 1)) + in + List.fold_right + (fun digit path -> + Cic.Appl [ + mkCtor (if (digit = true) then right_idx_uri else left_idx_uri) []; + path]) + (List.rev (digits_of_int n)) (* remove leading true (i.e. digit 1) *) + (mkCtor end_idx_uri []) + + (** + Build a variable map (@see varmap_uri) from a variables array. + A variable map is almost a binary tree so this function receiving a var list + like [v;w;x;y;z] will build a varmap of shape: v + / \ + w x + / \ + y z + @param vars variables array + @return a cic term representing the variable map containing vars variables + *) +let btree_of_array ~vars = + let r = HelmLibraryObjects.Reals.r in + let empty_vm_r = mkCtor empty_vm_uri [quote_varmap_A_uri,r] in + let node_vm_r = mkCtor node_vm_uri [quote_varmap_A_uri,r] in + let size = Array.length vars in + let halfsize = size lsr 1 in + let rec aux n = (* build the btree starting from position n *) + (* + n is the position in the vars array _1_based_ in order to access + left and right child using (n*2, n*2+1) trick + *) + if n > size then + empty_vm_r + else if n > halfsize then (* no more children *) + Cic.Appl [node_vm_r; vars.(n-1); empty_vm_r; empty_vm_r] + else (* still children *) + Cic.Appl [node_vm_r; vars.(n-1); aux (n*2); aux (n*2+1)] + in + aux 1 + + (** + abstraction function: + concrete polynoms -----> (abstract polynoms, varmap) + @param terms list of conrete polynoms + @return a pair where aterms is a list of abstract polynoms + and varmap is the variable map needed to interpret them + *) +let abstract_poly ~terms = + let varhash = Hashtbl.create 19 in (* vars hash, to speed up lookup *) + let varlist = ref [] in (* vars list in reverse order *) + let counter = ref 1 in (* index of next new variable *) + let rec aux = function (* TODO not tail recursive *) + (* "bop" -> binary operator | "uop" -> unary operator *) + | Cic.Appl (bop::t1::t2::[]) + when (cic_is_const ~uri:(Some HelmLibraryObjects.Reals.rplus_URI) bop) -> (* +. *) + Cic.Appl [mkCtor applus_uri []; aux t1; aux t2] + | Cic.Appl (bop::t1::t2::[]) + when (cic_is_const ~uri:(Some HelmLibraryObjects.Reals.rmult_URI) bop) -> (* *. *) + Cic.Appl [mkCtor apmult_uri []; aux t1; aux t2] + | Cic.Appl (uop::t::[]) + when (cic_is_const ~uri:(Some HelmLibraryObjects.Reals.ropp_URI) uop) -> (* ~-. *) + Cic.Appl [mkCtor apopp_uri []; aux t] + | t when (cic_is_const ~uri:(Some HelmLibraryObjects.Reals.r0_URI) t) -> (* 0. *) + mkCtor ap0_uri [] + | t when (cic_is_const ~uri:(Some HelmLibraryObjects.Reals.r1_URI) t) -> (* 1. *) + mkCtor ap1_uri [] + | t -> (* variable *) + try + Hashtbl.find varhash t (* use an old var *) + with Not_found -> begin (* create a new var *) + let newvar = + Cic.Appl [mkCtor apvar_uri []; path_of_int !counter] + in + incr counter; + varlist := t :: !varlist; + Hashtbl.add varhash t newvar; + newvar + end + in + let aterms = List.map aux terms in (* abstract vars *) + let varmap = (* build varmap *) + btree_of_array ~vars:(Array.of_list (List.rev !varlist)) + in + (aterms, varmap) + + (** + given a list of abstract terms (i.e. apolynomials) build the ring "segments" + that is triples like (t', t'', t''') where + t' = interp_ap(varmap, at) + t'' = interp_sacs(varmap, (apolynomial_normalize at)) + t''' = apolynomial_normalize_ok(varmap, at) + at is the abstract term built from t, t is a single member of aterms + *) +let build_segments ~terms = + let theory_args_subst varmap = + [abstract_rings_A_uri, HelmLibraryObjects.Reals.r ; + abstract_rings_Aplus_uri, HelmLibraryObjects.Reals.rplus ; + abstract_rings_Amult_uri, HelmLibraryObjects.Reals.rmult ; + abstract_rings_Aone_uri, HelmLibraryObjects.Reals.r1 ; + abstract_rings_Azero_uri, HelmLibraryObjects.Reals.r0 ; + abstract_rings_Aopp_uri, HelmLibraryObjects.Reals.ropp ; + abstract_rings_vm_uri, varmap] in + let theory_args_subst' eq varmap t = + [abstract_rings_A_uri, HelmLibraryObjects.Reals.r ; + abstract_rings_Aplus_uri, HelmLibraryObjects.Reals.rplus ; + abstract_rings_Amult_uri, HelmLibraryObjects.Reals.rmult ; + abstract_rings_Aone_uri, HelmLibraryObjects.Reals.r1 ; + abstract_rings_Azero_uri, HelmLibraryObjects.Reals.r0 ; + abstract_rings_Aopp_uri, HelmLibraryObjects.Reals.ropp ; + abstract_rings_Aeq_uri, eq ; + abstract_rings_vm_uri, varmap ; + abstract_rings_T_uri, t] in + let interp_ap varmap = + mkConst interp_ap_uri (theory_args_subst varmap) in + let interp_sacs varmap = + mkConst interp_sacs_uri (theory_args_subst varmap) in + let apolynomial_normalize = mkConst apolynomial_normalize_uri [] in + let apolynomial_normalize_ok eq varmap t = + mkConst apolynomial_normalize_ok_uri (theory_args_subst' eq varmap t) in + let lxy_false = (** Cic funcion "fun (x,y):R -> false" *) + Cic.Lambda (Cic.Anonymous, HelmLibraryObjects.Reals.r, + Cic.Lambda (Cic.Anonymous, HelmLibraryObjects.Reals.r, HelmLibraryObjects.Datatypes.falseb)) + in + let (aterms, varmap) = abstract_poly ~terms in (* abstract polys *) + List.map (* build ring segments *) + (fun t -> + Cic.Appl [interp_ap varmap ; t], + Cic.Appl ( + [interp_sacs varmap ; Cic.Appl [apolynomial_normalize; t]]), + Cic.Appl [apolynomial_normalize_ok lxy_false varmap HelmLibraryObjects.Reals.rtheory ; t] + ) aterms + + +let status_of_single_goal_tactic_result = + function + proof,[goal] -> proof,goal + | _ -> + raise (Fail (lazy "status_of_single_goal_tactic_result: the tactic did not produce exactly a new goal")) + +(* Galla: spostata in variousTactics.ml + (** + auxiliary tactic "elim_type" + @param status current proof engine status + @param term term to cut + *) +let elim_type_tac ~term status = + warn (lazy "in Ring.elim_type_tac"); + Tacticals.thens ~start:(cut_tac ~term) + ~continuations:[elim_simpl_intros_tac ~term:(Cic.Rel 1) ; Tacticals.id_tac] status +*) + + (** + auxiliary tactic, use elim_type and try to close 2nd subgoal using proof + @param status current proof engine status + @param term term to cut + @param proof term used to prove second subgoal generated by elim_type + *) +(* FG: METTERE I NOMI ANCHE QUI? *) +let elim_type2_tac ~term ~proof = + let elim_type2_tac ~term ~proof status = + let module E = EliminationTactics in + warn (lazy "in Ring.elim_type2"); + ProofEngineTypes.apply_tactic + (Tacticals.thens ~start:(E.elim_type_tac term) + ~continuations:[Tacticals.id_tac ; exact_tac ~term:proof]) status + in + ProofEngineTypes.mk_tactic (elim_type2_tac ~term ~proof) + +(* Galla: spostata in variousTactics.ml + (** + Reflexivity tactic, try to solve current goal using "refl_eqT" + Warning: this isn't equale to the coq's Reflexivity because this one tries + only refl_eqT, coq's one also try "refl_equal" + @param status current proof engine status + *) +let reflexivity_tac (proof, goal) = + warn (lazy "in Ring.reflexivity_tac"); + let refl_eqt = mkCtor ~uri:refl_eqt_uri ~exp_named_subst:[] in + try + apply_tac (proof, goal) ~term:refl_eqt + with (Fail _) as e -> + let e_str = Printexc.to_string e in + raise (Fail ("Reflexivity failed with exception: " ^ e_str)) +*) + + (** lift an 8-uple of debrujins indexes of n *) +let lift ~n (a,b,c,d,e,f,g,h) = + match (List.map (CicSubstitution.lift n) [a;b;c;d;e;f;g;h]) with + | [a;b;c;d;e;f;g;h] -> (a,b,c,d,e,f,g,h) + | _ -> assert false + + (** + remove hypothesis from a given status starting from the last one + @param count number of hypotheses to remove + @param status current proof engine status + *) +let purge_hyps_tac ~count = + let purge_hyps_tac ~count status = + let module S = ProofEngineStructuralRules in + let (proof, goal) = status in + let rec aux n context status = + assert(n>=0); + match (n, context) with + | (0, _) -> status + | (n, hd::tl) -> + let name_of_hyp = + match hd with + None + | Some (Cic.Anonymous,_) -> assert false + | Some (Cic.Name name,_) -> name + in + aux (n-1) tl + (status_of_single_goal_tactic_result + (ProofEngineTypes.apply_tactic (S.clear ~hyps:[name_of_hyp]) status)) + | (_, []) -> failwith "Ring.purge_hyps_tac: no hypotheses left" + in + let (_, metasenv, _subst, _, _, _) = proof in + let (_, context, _) = CicUtil.lookup_meta goal metasenv in + let proof',goal' = aux count context status in + assert (goal = goal') ; + proof',[goal'] + in + ProofEngineTypes.mk_tactic (purge_hyps_tac ~count) + +(** THE TACTIC! *) + + (** + Ring tactic, does associative and commutative rewritings in Reals ring + @param status current proof engine status + *) + +let ring_tac status = + let (proof, goal) = status in + warn (lazy "in Ring tactic"); + let eqt = mkMutInd (HelmLibraryObjects.Logic.eq_URI, 0) [] in + let r = HelmLibraryObjects.Reals.r in + let metasenv = metasenv_of_status status in + let (metano, context, ty) = CicUtil.lookup_meta goal metasenv in + let (t1, t2) = split_eq ty in (* goal like t1 = t2 *) + match (build_segments ~terms:[t1; t2]) with + | (t1', t1'', t1'_eq_t1'')::(t2', t2'', t2'_eq_t2'')::[] -> begin + if debug then + List.iter (* debugging, feel free to remove *) + (fun (descr, term) -> + warn (lazy (descr ^ " " ^ (CicPp.ppterm term)))) + (List.combine + ["t1"; "t1'"; "t1''"; "t1'_eq_t1''"; + "t2"; "t2'"; "t2''"; "t2'_eq_t2''"] + [t1; t1'; t1''; t1'_eq_t1''; + t2; t2'; t2''; t2'_eq_t2'']); + try + let new_hyps = ref 0 in (* number of new hypotheses created *) + ProofEngineTypes.apply_tactic + (Tacticals.first + ~tactics:[ + EqualityTactics.reflexivity_tac ; + exact_tac ~term:t1'_eq_t1'' ; + exact_tac ~term:t2'_eq_t2'' ; + exact_tac + ~term:( + Cic.Appl + [mkConst HelmLibraryObjects.Logic.sym_eq_URI + [equality_is_a_congruence_A, HelmLibraryObjects.Reals.r; + equality_is_a_congruence_x, t1'' ; + equality_is_a_congruence_y, t1 + ] ; + t1'_eq_t1'' + ]) ; + ProofEngineTypes.mk_tactic (fun status -> + let status' = (* status after 1st elim_type use *) + let context = context_of_status status in + let b,_ = (*TASSI : FIXME*) + are_convertible context t1'' t1 CicUniv.empty_ugraph in + if not b then begin + warn (lazy "t1'' and t1 are NOT CONVERTIBLE"); + let newstatus = + ProofEngineTypes.apply_tactic + (elim_type2_tac (* 1st elim_type use *) + ~proof:t1'_eq_t1'' + ~term:(Cic.Appl [eqt; r; t1''; t1])) + status + in + incr new_hyps; (* elim_type add an hyp *) + match newstatus with + (proof,[goal]) -> proof,goal + | _ -> assert false + end else begin + warn (lazy "t1'' and t1 are CONVERTIBLE"); + status + end + in + let (t1,t1',t1'',t1'_eq_t1'',t2,t2',t2'',t2'_eq_t2'') = + lift 1 (t1,t1',t1'',t1'_eq_t1'', t2,t2',t2'',t2'_eq_t2'') + in + let status'' = + ProofEngineTypes.apply_tactic + (Tacticals.first (* try to solve 1st subgoal *) + ~tactics:[ + exact_tac ~term:t2'_eq_t2''; + exact_tac + ~term:( + Cic.Appl + [mkConst HelmLibraryObjects.Logic.sym_eq_URI + [equality_is_a_congruence_A, HelmLibraryObjects.Reals.r; + equality_is_a_congruence_x, t2'' ; + equality_is_a_congruence_y, t2 + ] ; + t2'_eq_t2'' + ]) ; + ProofEngineTypes.mk_tactic (fun status -> + let status' = + let context = context_of_status status in + let b,_ = (* TASSI:FIXME *) + are_convertible context t2'' t2 CicUniv.empty_ugraph + in + if not b then begin + warn (lazy "t2'' and t2 are NOT CONVERTIBLE"); + let newstatus = + ProofEngineTypes.apply_tactic + (elim_type2_tac (* 2nd elim_type use *) + ~proof:t2'_eq_t2'' + ~term:(Cic.Appl [eqt; r; t2''; t2])) + status + in + incr new_hyps; (* elim_type add an hyp *) + match newstatus with + (proof,[goal]) -> proof,goal + | _ -> assert false + end else begin + warn (lazy "t2'' and t2 are CONVERTIBLE"); + status + end + in + try (* try to solve main goal *) + warn (lazy "trying reflexivity ...."); + ProofEngineTypes.apply_tactic + EqualityTactics.reflexivity_tac status' + with (Fail _) -> (* leave conclusion to the user *) + warn (lazy "reflexivity failed, solution's left as an ex :-)"); + ProofEngineTypes.apply_tactic + (purge_hyps_tac ~count:!new_hyps) status')]) + status' + in + status'')]) + status + with (Fail s) -> + raise (Fail (lazy ("Ring failure: " ^ Lazy.force s))) + end + | _ -> (* impossible: we are applying ring exacty to 2 terms *) + assert false + + (* wrap ring_tac catching GoalUnringable and raising Fail *) + +let ring_tac status = + try + ring_tac status + with GoalUnringable -> + raise (Fail (lazy "goal unringable")) + +let ring_tac = ProofEngineTypes.mk_tactic ring_tac + diff --git a/components/tactics/ring.mli b/components/tactics/ring.mli new file mode 100644 index 000000000..b6eb34b69 --- /dev/null +++ b/components/tactics/ring.mli @@ -0,0 +1,12 @@ + + (* ring tactics *) +val ring_tac: ProofEngineTypes.tactic + +(*Galla: spostata in variuosTactics.ml + (* auxiliary tactics *) +val elim_type_tac: term: Cic.term -> ProofEngineTypes.tactic +*) + +(* spostata in variousTactics.ml +val reflexivity_tac: ProofEngineTypes.tactic +*) diff --git a/components/tactics/setoids.ml b/components/tactics/setoids.ml new file mode 100644 index 000000000..7d0e958cc --- /dev/null +++ b/components/tactics/setoids.ml @@ -0,0 +1,1904 @@ +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* uri + | None -> + raise (ProofEngineTypes.Fail (lazy "You need to register the default equality first. Please use the \"default\" command")) + +let replace = ref (fun _ _ -> assert false) +let register_replace f = replace := f + +let general_rewrite = ref (fun _ _ -> assert false) +let register_general_rewrite f = general_rewrite := f + +let prlist_with_sepi sep elem = + let rec aux n = + function + | [] -> "" + | [h] -> elem n h + | h::t -> + let e = elem n h and r = aux (n+1) t in + e ^ sep ^ r + in + aux 1 + +type relation = + { rel_a: Cic.term ; + rel_aeq: Cic.term; + rel_refl: Cic.term option; + rel_sym: Cic.term option; + rel_trans : Cic.term option; + rel_quantifiers_no: int (* it helps unification *); + rel_X_relation_class: Cic.term; + rel_Xreflexive_relation_class: Cic.term + } + +type 'a relation_class = + Relation of 'a (* the rel_aeq of the relation or the relation *) + | Leibniz of Cic.term option (* the carrier (if eq is partially instantiated)*) + +type 'a morphism = + { args : (bool option * 'a relation_class) list; + output : 'a relation_class; + lem : Cic.term; + morphism_theory : Cic.term + } + +type funct = + { f_args : Cic.term list; + f_output : Cic.term + } + +type morphism_class = + ACMorphism of relation morphism + | ACFunction of funct + +let constr_relation_class_of_relation_relation_class = + function + Relation relation -> Relation relation.rel_aeq + | Leibniz t -> Leibniz t + + +(*COQ +let constr_of c = Constrintern.interp_constr Evd.empty (Global.env()) c +*) + +(*COQ +let constant dir s = Coqlib.gen_constant "Setoid_replace" ("Setoids"::dir) s +*) let constant dir s = Cic.Implicit None +(*COQ +let gen_constant dir s = Coqlib.gen_constant "Setoid_replace" dir s +*) let gen_constant dir s = Cic.Implicit None +(*COQ +let reference dir s = Coqlib.gen_reference "Setoid_replace" ("Setoids"::dir) s +let eval_reference dir s = EvalConstRef (destConst (constant dir s)) +*) let eval_reference dir s = Cic.Implicit None +(*COQ +let eval_init_reference dir s = EvalConstRef (destConst (gen_constant ("Init"::dir) s)) +*) + +(*COQ +let current_constant id = + try + global_reference id + with Not_found -> + anomaly ("Setoid: cannot find " ^ id) +*) let current_constant id = assert false + +(* From Setoid.v *) + +let coq_reflexive = + (gen_constant ["Relations"; "Relation_Definitions"] "reflexive") +let coq_symmetric = + (gen_constant ["Relations"; "Relation_Definitions"] "symmetric") +let coq_transitive = + (gen_constant ["Relations"; "Relation_Definitions"] "transitive") +let coq_relation = + (gen_constant ["Relations"; "Relation_Definitions"] "relation") + +let coq_Relation_Class = (constant ["Setoid"] "Relation_Class") +let coq_Argument_Class = (constant ["Setoid"] "Argument_Class") +let coq_Setoid_Theory = (constant ["Setoid"] "Setoid_Theory") +let coq_Morphism_Theory = (constant ["Setoid"] "Morphism_Theory") +let coq_Build_Morphism_Theory= (constant ["Setoid"] "Build_Morphism_Theory") +let coq_Compat = (constant ["Setoid"] "Compat") + +let coq_AsymmetricReflexive = (constant ["Setoid"] "AsymmetricReflexive") +let coq_SymmetricReflexive = (constant ["Setoid"] "SymmetricReflexive") +let coq_SymmetricAreflexive = (constant ["Setoid"] "SymmetricAreflexive") +let coq_AsymmetricAreflexive = (constant ["Setoid"] "AsymmetricAreflexive") +let coq_Leibniz = (constant ["Setoid"] "Leibniz") + +let coq_RAsymmetric = (constant ["Setoid"] "RAsymmetric") +let coq_RSymmetric = (constant ["Setoid"] "RSymmetric") +let coq_RLeibniz = (constant ["Setoid"] "RLeibniz") + +let coq_ASymmetric = (constant ["Setoid"] "ASymmetric") +let coq_AAsymmetric = (constant ["Setoid"] "AAsymmetric") + +let coq_seq_refl = (constant ["Setoid"] "Seq_refl") +let coq_seq_sym = (constant ["Setoid"] "Seq_sym") +let coq_seq_trans = (constant ["Setoid"] "Seq_trans") + +let coq_variance = (constant ["Setoid"] "variance") +let coq_Covariant = (constant ["Setoid"] "Covariant") +let coq_Contravariant = (constant ["Setoid"] "Contravariant") +let coq_Left2Right = (constant ["Setoid"] "Left2Right") +let coq_Right2Left = (constant ["Setoid"] "Right2Left") +let coq_MSNone = (constant ["Setoid"] "MSNone") +let coq_MSCovariant = (constant ["Setoid"] "MSCovariant") +let coq_MSContravariant = (constant ["Setoid"] "MSContravariant") + +let coq_singl = (constant ["Setoid"] "singl") +let coq_cons = (constant ["Setoid"] "cons") + +let coq_equality_morphism_of_asymmetric_areflexive_transitive_relation = + (constant ["Setoid"] + "equality_morphism_of_asymmetric_areflexive_transitive_relation") +let coq_equality_morphism_of_symmetric_areflexive_transitive_relation = + (constant ["Setoid"] + "equality_morphism_of_symmetric_areflexive_transitive_relation") +let coq_equality_morphism_of_asymmetric_reflexive_transitive_relation = + (constant ["Setoid"] + "equality_morphism_of_asymmetric_reflexive_transitive_relation") +let coq_equality_morphism_of_symmetric_reflexive_transitive_relation = + (constant ["Setoid"] + "equality_morphism_of_symmetric_reflexive_transitive_relation") +let coq_make_compatibility_goal = + (constant ["Setoid"] "make_compatibility_goal") +let coq_make_compatibility_goal_eval_ref = + (eval_reference ["Setoid"] "make_compatibility_goal") +let coq_make_compatibility_goal_aux_eval_ref = + (eval_reference ["Setoid"] "make_compatibility_goal_aux") + +let coq_App = (constant ["Setoid"] "App") +let coq_ToReplace = (constant ["Setoid"] "ToReplace") +let coq_ToKeep = (constant ["Setoid"] "ToKeep") +let coq_ProperElementToKeep = (constant ["Setoid"] "ProperElementToKeep") +let coq_fcl_singl = (constant ["Setoid"] "fcl_singl") +let coq_fcl_cons = (constant ["Setoid"] "fcl_cons") + +let coq_setoid_rewrite = (constant ["Setoid"] "setoid_rewrite") +let coq_proj1 = (gen_constant ["Init"; "Logic"] "proj1") +let coq_proj2 = (gen_constant ["Init"; "Logic"] "proj2") +let coq_unit = (gen_constant ["Init"; "Datatypes"] "unit") +let coq_tt = (gen_constant ["Init"; "Datatypes"] "tt") +let coq_eq = (gen_constant ["Init"; "Logic"] "eq") + +let coq_morphism_theory_of_function = + (constant ["Setoid"] "morphism_theory_of_function") +let coq_morphism_theory_of_predicate = + (constant ["Setoid"] "morphism_theory_of_predicate") +let coq_relation_of_relation_class = + (eval_reference ["Setoid"] "relation_of_relation_class") +let coq_directed_relation_of_relation_class = + (eval_reference ["Setoid"] "directed_relation_of_relation_class") +let coq_interp = (eval_reference ["Setoid"] "interp") +let coq_Morphism_Context_rect2 = + (eval_reference ["Setoid"] "Morphism_Context_rect2") +let coq_iff = (gen_constant ["Init";"Logic"] "iff") +let coq_impl = (constant ["Setoid"] "impl") + + +(************************* Table of declared relations **********************) + + +(* Relations are stored in a table which is synchronised with the Reset mechanism. *) + +module Gmap = + Map.Make(struct type t = Cic.term let compare = Pervasives.compare end);; + +let relation_table = ref Gmap.empty + +let relation_table_add (s,th) = relation_table := Gmap.add s th !relation_table +let relation_table_find s = Gmap.find s !relation_table +let relation_table_mem s = Gmap.mem s !relation_table + +let prrelation s = + "(" ^ CicPp.ppterm s.rel_a ^ "," ^ CicPp.ppterm s.rel_aeq ^ ")" + +let prrelation_class = + function + Relation eq -> + (try prrelation (relation_table_find eq) + with Not_found -> + "[[ Error: " ^ CicPp.ppterm eq ^ + " is not registered as a relation ]]") + | Leibniz (Some ty) -> CicPp.ppterm ty + | Leibniz None -> "_" + +let prmorphism_argument_gen prrelation (variance,rel) = + prrelation rel ^ + match variance with + None -> " ==> " + | Some true -> " ++> " + | Some false -> " --> " + +let prargument_class = prmorphism_argument_gen prrelation_class + +let pr_morphism_signature (l,c) = + String.concat "" (List.map (prmorphism_argument_gen CicPp.ppterm) l) ^ + CicPp.ppterm c + +let prmorphism k m = + CicPp.ppterm k ^ ": " ^ + String.concat "" (List.map prargument_class m.args) ^ + prrelation_class m.output + +(* A function that gives back the only relation_class on a given carrier *) +(*CSC: this implementation is really inefficient. I should define a new + map to make it efficient. However, is this really worth of? *) +let default_relation_for_carrier ?(filter=fun _ -> true) a = + let rng = Gmap.fold (fun _ y acc -> y::acc) !relation_table [] in + match List.filter (fun ({rel_a=rel_a} as r) -> rel_a = a && filter r) rng with + [] -> Leibniz (Some a) + | relation::tl -> +(*COQ + if tl <> [] then + prerr_endline + ("Warning: There are several relations on the carrier \"" ^ + CicPp.ppterm a ^ "\". The relation " ^ prrelation relation ^ + " is chosen.") ; +*) + Relation relation + +let find_relation_class rel = + try Relation (relation_table_find rel) + with + Not_found -> + let default_eq = default_eq () in + match CicReduction.whd [] rel with + Cic.Appl [Cic.MutInd(uri,0,[]);ty] + when UriManager.eq uri default_eq -> Leibniz (Some ty) + | Cic.MutInd(uri,0,[]) when UriManager.eq uri default_eq -> Leibniz None + | _ -> raise Not_found + +(*COQ +let coq_iff_relation = lazy (find_relation_class (Lazy.force coq_iff)) +let coq_impl_relation = lazy (find_relation_class (Lazy.force coq_impl)) +*) let coq_iff_relation = Obj.magic 0 let coq_impl_relation = Obj.magic 0 + +let relation_morphism_of_constr_morphism = + let relation_relation_class_of_constr_relation_class = + function + Leibniz t -> Leibniz t + | Relation aeq -> + Relation (try relation_table_find aeq with Not_found -> assert false) + in + function mor -> + let args' = + List.map + (fun (variance,rel) -> + variance, relation_relation_class_of_constr_relation_class rel + ) mor.args in + let output' = relation_relation_class_of_constr_relation_class mor.output in + {mor with args=args' ; output=output'} + +let equiv_list () = + Gmap.fold (fun _ y acc -> y.rel_aeq::acc) !relation_table [] + +(* Declare a new type of object in the environment : "relation-theory". *) + +let relation_to_obj (s, th) = + let th' = + if relation_table_mem s then + begin + let old_relation = relation_table_find s in + let th' = + {th with rel_sym = + match th.rel_sym with + None -> old_relation.rel_sym + | Some t -> Some t} + in + prerr_endline + ("Warning: The relation " ^ prrelation th' ^ + " is redeclared. The new declaration" ^ + (match th'.rel_refl with + None -> "" + | Some t -> " (reflevity proved by " ^ CicPp.ppterm t) ^ + (match th'.rel_sym with + None -> "" + | Some t -> + (if th'.rel_refl = None then " (" else " and ") ^ + "symmetry proved by " ^ CicPp.ppterm t) ^ + (if th'.rel_refl <> None && th'.rel_sym <> None then + ")" else "") ^ + " replaces the old declaration" ^ + (match old_relation.rel_refl with + None -> "" + | Some t -> " (reflevity proved by " ^ CicPp.ppterm t) ^ + (match old_relation.rel_sym with + None -> "" + | Some t -> + (if old_relation.rel_refl = None then + " (" else " and ") ^ + "symmetry proved by " ^ CicPp.ppterm t) ^ + (if old_relation.rel_refl <> None && old_relation.rel_sym <> None + then ")" else "") ^ + "."); + th' + end + else + th + in + relation_table_add (s,th') + +(******************************* Table of declared morphisms ********************) + +(* Setoids are stored in a table which is synchronised with the Reset mechanism. *) + +let morphism_table = ref Gmap.empty + +let morphism_table_find m = Gmap.find m !morphism_table +let morphism_table_add (m,c) = + let old = + try + morphism_table_find m + with + Not_found -> [] + in + try +(*COQ + let old_morph = + List.find + (function mor -> mor.args = c.args && mor.output = c.output) old + in + prerr_endline + ("Warning: The morphism " ^ prmorphism m old_morph ^ + " is redeclared. " ^ + "The new declaration whose compatibility is proved by " ^ + CicPp.ppterm c.lem ^ " replaces the old declaration whose" ^ + " compatibility was proved by " ^ + CicPp.ppterm old_morph.lem ^ ".") +*) () + with + Not_found -> morphism_table := Gmap.add m (c::old) !morphism_table + +let default_morphism ?(filter=fun _ -> true) m = + match List.filter filter (morphism_table_find m) with + [] -> raise Not_found + | m1::ml -> +(*COQ + if ml <> [] then + prerr_endline + ("Warning: There are several morphisms associated to \"" ^ + CicPp.ppterm m ^ "\". Morphism " ^ prmorphism m m1 ^ + " is randomly chosen."); +*) + relation_morphism_of_constr_morphism m1 + +(************************** Printing relations and morphisms **********************) + +let print_setoids () = + Gmap.iter + (fun k relation -> + assert (k=relation.rel_aeq) ; + prerr_endline ("Relation " ^ prrelation relation ^ ";" ^ + (match relation.rel_refl with + None -> "" + | Some t -> " reflexivity proved by " ^ CicPp.ppterm t) ^ + (match relation.rel_sym with + None -> "" + | Some t -> " symmetry proved by " ^ CicPp.ppterm t) ^ + (match relation.rel_trans with + None -> "" + | Some t -> " transitivity proved by " ^ CicPp.ppterm t))) + !relation_table ; + Gmap.iter + (fun k l -> + List.iter + (fun ({lem=lem} as mor) -> + prerr_endline ("Morphism " ^ prmorphism k mor ^ + ". Compatibility proved by " ^ + CicPp.ppterm lem ^ ".")) + l) !morphism_table +;; + +(***************** Adding a morphism to the database ****************************) + +(* We maintain a table of the currently edited proofs of morphism lemma + in order to add them in the morphism_table when the user does Save *) + +let edited = ref Gmap.empty + +let new_edited id m = + edited := Gmap.add id m !edited + +let is_edited id = + Gmap.mem id !edited + +let no_more_edited id = + edited := Gmap.remove id !edited + +let what_edited id = + Gmap.find id !edited + +let list_chop n l = + let rec chop_aux acc = function + | (0, l2) -> (List.rev acc, l2) + | (n, (h::t)) -> chop_aux (h::acc) (pred n, t) + | (_, []) -> assert false + in + chop_aux [] (n,l) + +let compose_thing f l b = + let rec aux = + function + (0, env, b) -> b + | (n, ((v,t)::l), b) -> aux (n-1, l, f v t b) + | _ -> assert false + in + aux (List.length l,l,b) + +let compose_prod = compose_thing (fun v t b -> Cic.Prod (v,t,b)) +let compose_lambda = compose_thing (fun v t b -> Cic.Lambda (v,t,b)) + +(* also returns the triple (args_ty_quantifiers_rev,real_args_ty,real_output) + where the args_ty and the output are delifted *) +let check_is_dependent n args_ty output = + let m = List.length args_ty - n in + let args_ty_quantifiers, args_ty = list_chop n args_ty in + let rec aux m t = + match t with + Cic.Prod (n,s,t) when m > 0 -> + let t' = CicSubstitution.subst (Cic.Implicit None) (* dummy *) t in + if t' <> t then + let args,out = aux (m - 1) t' in s::args,out + else + raise (ProofEngineTypes.Fail (lazy + "The morphism is not a quantified non dependent product.")) + | _ -> [],t + in + let ty = compose_prod (List.rev args_ty) output in + let args_ty, output = aux m ty in + List.rev args_ty_quantifiers, args_ty, output + +let cic_relation_class_of_X_relation typ value = + function + {rel_a=rel_a; rel_aeq=rel_aeq; rel_refl=Some refl; rel_sym=None} -> + Cic.Appl [coq_AsymmetricReflexive ; typ ; value ; rel_a ; rel_aeq; refl] + | {rel_a=rel_a; rel_aeq=rel_aeq; rel_refl=Some refl; rel_sym=Some sym} -> + Cic.Appl [coq_SymmetricReflexive ; typ ; rel_a ; rel_aeq; sym ; refl] + | {rel_a=rel_a; rel_aeq=rel_aeq; rel_refl=None; rel_sym=None} -> + Cic.Appl [coq_AsymmetricAreflexive ; typ ; value ; rel_a ; rel_aeq] + | {rel_a=rel_a; rel_aeq=rel_aeq; rel_refl=None; rel_sym=Some sym} -> + Cic.Appl [coq_SymmetricAreflexive ; typ ; rel_a ; rel_aeq; sym] + +let cic_relation_class_of_X_relation_class typ value = + function + Relation {rel_X_relation_class=x_relation_class} -> + Cic.Appl [x_relation_class ; typ ; value] + | Leibniz (Some t) -> + Cic.Appl [coq_Leibniz ; typ ; t] + | Leibniz None -> assert false + + +let cic_precise_relation_class_of_relation = + function + {rel_a=rel_a; rel_aeq=rel_aeq; rel_refl=Some refl; rel_sym=None} -> + Cic.Appl [coq_RAsymmetric ; rel_a ; rel_aeq; refl] + | {rel_a=rel_a; rel_aeq=rel_aeq; rel_refl=Some refl; rel_sym=Some sym} -> + Cic.Appl [coq_RSymmetric ; rel_a ; rel_aeq; sym ; refl] + | {rel_a=rel_a; rel_aeq=rel_aeq; rel_refl=None; rel_sym=None} -> + Cic.Appl [coq_AAsymmetric ; rel_a ; rel_aeq] + | {rel_a=rel_a; rel_aeq=rel_aeq; rel_refl=None; rel_sym=Some sym} -> + Cic.Appl [coq_ASymmetric ; rel_a ; rel_aeq; sym] + +let cic_precise_relation_class_of_relation_class = + function + Relation + {rel_aeq=rel_aeq; rel_Xreflexive_relation_class=lem; rel_refl=rel_refl } + -> + rel_aeq,lem,not(rel_refl=None) + | Leibniz (Some t) -> + Cic.Appl [coq_eq ; t], Cic.Appl [coq_RLeibniz ; t], true + | Leibniz None -> assert false + +let cic_relation_class_of_relation_class rel = + cic_relation_class_of_X_relation_class + coq_unit coq_tt rel + +let cic_argument_class_of_argument_class (variance,arg) = + let coq_variant_value = + match variance with + None -> coq_Covariant (* dummy value, it won't be used *) + | Some true -> coq_Covariant + | Some false -> coq_Contravariant + in + cic_relation_class_of_X_relation_class coq_variance + coq_variant_value arg + +let cic_arguments_of_argument_class_list args = + let rec aux = + function + [] -> assert false + | [last] -> + Cic.Appl [coq_singl ; coq_Argument_Class ; last] + | he::tl -> + Cic.Appl [coq_cons ; coq_Argument_Class ; he ; aux tl] + in + aux (List.map cic_argument_class_of_argument_class args) + +let gen_compat_lemma_statement quantifiers_rev output args m = + let output = cic_relation_class_of_relation_class output in + let args = cic_arguments_of_argument_class_list args in + args, output, + compose_prod quantifiers_rev + (Cic.Appl [coq_make_compatibility_goal ; args ; output ; m]) + +let morphism_theory_id_of_morphism_proof_id id = + id ^ "_morphism_theory" + +let list_map_i f = + let rec map_i_rec i = function + | [] -> [] + | x::l -> let v = f i x in v :: map_i_rec (i+1) l + in + map_i_rec + +(* apply_to_rels c [l1 ; ... ; ln] returns (c Rel1 ... reln) *) +let apply_to_rels c l = + if l = [] then c + else + let len = List.length l in + Cic.Appl (c::(list_map_i (fun i _ -> Cic.Rel (len - i)) 0 l)) + +let apply_to_relation subst rel = + if subst = [] then rel + else + let new_quantifiers_no = rel.rel_quantifiers_no - List.length subst in + assert (new_quantifiers_no >= 0) ; + { rel_a = Cic.Appl (rel.rel_a :: subst) ; + rel_aeq = Cic.Appl (rel.rel_aeq :: subst) ; + rel_refl = HExtlib.map_option (fun c -> Cic.Appl (c::subst)) rel.rel_refl ; + rel_sym = HExtlib.map_option (fun c -> Cic.Appl (c::subst)) rel.rel_sym; + rel_trans = HExtlib.map_option (fun c -> Cic.Appl (c::subst)) rel.rel_trans; + rel_quantifiers_no = new_quantifiers_no; + rel_X_relation_class = Cic.Appl (rel.rel_X_relation_class::subst); + rel_Xreflexive_relation_class = + Cic.Appl (rel.rel_Xreflexive_relation_class::subst) } + +let add_morphism lemma_infos mor_name (m,quantifiers_rev,args,output) = + let lem = + match lemma_infos with + None -> + (* the Morphism_Theory object has already been created *) + let applied_args = + let len = List.length quantifiers_rev in + let subst = + list_map_i (fun i _ -> Cic.Rel (len - i)) 0 quantifiers_rev + in + List.map + (fun (v,rel) -> + match rel with + Leibniz (Some t) -> + assert (subst=[]); + v, Leibniz (Some t) + | Leibniz None -> + (match subst with + [e] -> v, Leibniz (Some e) + | _ -> assert false) + | Relation rel -> v, Relation (apply_to_relation subst rel)) args + in + compose_lambda quantifiers_rev + (Cic.Appl + [coq_Compat ; + cic_arguments_of_argument_class_list applied_args; + cic_relation_class_of_relation_class output; + apply_to_rels (current_constant mor_name) quantifiers_rev]) + | Some (lem_name,argsconstr,outputconstr) -> + (* only the compatibility has been proved; we need to declare the + Morphism_Theory object *) + let mext = current_constant lem_name in +(*COQ + ignore ( + Declare.declare_internal_constant mor_name + (DefinitionEntry + {const_entry_body = + compose_lambda quantifiers_rev + (Cic.Appl + [coq_Build_Morphism_Theory; + argsconstr; outputconstr; apply_to_rels m quantifiers_rev ; + apply_to_rels mext quantifiers_rev]); + const_entry_boxed = Options.boxed_definitions()}, + IsDefinition Definition)) ; +*)ignore (assert false); + mext + in + let mmor = current_constant mor_name in + let args_constr = + List.map + (fun (variance,arg) -> + variance, constr_relation_class_of_relation_relation_class arg) args in + let output_constr = constr_relation_class_of_relation_relation_class output in +(*COQ + Lib.add_anonymous_leaf + (morphism_to_obj (m, + { args = args_constr; + output = output_constr; + lem = lem; + morphism_theory = mmor })); +*)let _ = mmor,args_constr,output_constr,lem in ignore (assert false); + (*COQ Options.if_verbose prerr_endline (CicPp.ppterm m ^ " is registered as a morphism") *) () + +let list_sub _ _ _ = assert false + +(* first order matching with a bit of conversion *) +let unify_relation_carrier_with_type env rel t = + let raise_error quantifiers_no = + raise (ProofEngineTypes.Fail (lazy + ("One morphism argument or its output has type " ^ CicPp.ppterm t ^ + " but the signature requires an argument of type \"" ^ + CicPp.ppterm rel.rel_a ^ " " ^ String.concat " " (List.map (fun _ -> "?") + (Array.to_list (Array.make quantifiers_no 0))) ^ "\""))) in + let args = + match t with + Cic.Appl (he'::args') -> + let argsno = List.length args' - rel.rel_quantifiers_no in + let args1 = list_sub args' 0 argsno in + let args2 = list_sub args' argsno rel.rel_quantifiers_no in + if fst (CicReduction.are_convertible [] rel.rel_a (Cic.Appl (he'::args1)) CicUniv.empty_ugraph) then + args2 + else + raise_error rel.rel_quantifiers_no + | _ -> + if rel.rel_quantifiers_no = 0 && fst (CicReduction.are_convertible [] rel.rel_a t CicUniv.empty_ugraph) then + [] + else + begin +(*COQ + let evars,args,instantiated_rel_a = + let ty = CicTypeChecker.type_of_aux' [] [] rel.rel_a CicUniv.empty_ugraph in + let evd = Evd.create_evar_defs Evd.empty in + let evars,args,concl = + Clenv.clenv_environments_evars env evd + (Some rel.rel_quantifiers_no) ty + in + evars, args, + nf_betaiota + (match args with [] -> rel.rel_a | _ -> applist (rel.rel_a,args)) + in + let evars' = + w_unify true (*??? or false? *) env Reduction.CONV (*??? or cumul? *) + ~mod_delta:true (*??? or true? *) t instantiated_rel_a evars in + let args' = + List.map (Reductionops.nf_evar (Evd.evars_of evars')) args + in + args' +*) assert false + end + in + apply_to_relation args rel + +let unify_relation_class_carrier_with_type env rel t = + match rel with + Leibniz (Some t') -> + if fst (CicReduction.are_convertible [] t t' CicUniv.empty_ugraph) then + rel + else + raise (ProofEngineTypes.Fail (lazy + ("One morphism argument or its output has type " ^ CicPp.ppterm t ^ + " but the signature requires an argument of type " ^ + CicPp.ppterm t'))) + | Leibniz None -> Leibniz (Some t) + | Relation rel -> Relation (unify_relation_carrier_with_type env rel t) + +exception Impossible + +(*COQ +(* first order matching with a bit of conversion *) +(* Note: the type checking operations performed by the function could *) +(* be done once and for all abstracting the morphism structure using *) +(* the quantifiers. Would the new structure be more suited than the *) +(* existent one for other tasks to? (e.g. pretty printing would expose *) +(* much more information: is it ok or is it too much information?) *) +let unify_morphism_with_arguments gl (c,al) + {args=args; output=output; lem=lem; morphism_theory=morphism_theory} t += + let allen = List.length al in + let argsno = List.length args in + if allen < argsno then raise Impossible; (* partial application *) + let quantifiers,al' = Util.list_chop (allen - argsno) al in + let c' = Cic.Appl (c::quantifiers) in + if dependent t c' then raise Impossible; + (* these are pf_type_of we could avoid *) + let al'_type = List.map (Tacmach.pf_type_of gl) al' in + let args' = + List.map2 + (fun (var,rel) ty -> + var,unify_relation_class_carrier_with_type (pf_env gl) rel ty) + args al'_type in + (* this is another pf_type_of we could avoid *) + let ty = Tacmach.pf_type_of gl (Cic.Appl (c::al)) in + let output' = unify_relation_class_carrier_with_type (pf_env gl) output ty in + let lem' = Cic.Appl (lem::quantifiers) in + let morphism_theory' = Cic.Appl (morphism_theory::quantifiers) in + ({args=args'; output=output'; lem=lem'; morphism_theory=morphism_theory'}, + c',al') +*) let unify_morphism_with_arguments _ _ _ _ = assert false + +let new_morphism m signature id hook = +(*COQ + if Nametab.exists_cci (Lib.make_path id) or is_section_variable id then + raise (ProofEngineTypes.Fail (lazy (pr_id id ^ " already exists"))) + else + let env = Global.env() in + let typeofm = Typing.type_of env Evd.empty m in + let typ = clos_norm_flags Closure.betaiotazeta empty_env Evd.empty typeofm in + let argsrev, output = + match signature with + None -> decompose_prod typ + | Some (_,output') -> + (* the carrier of the relation output' can be a Prod ==> + we must uncurry on the fly output. + E.g: A -> B -> C vs A -> (B -> C) + args output args output + *) + let rel = find_relation_class output' in + let rel_a,rel_quantifiers_no = + match rel with + Relation rel -> rel.rel_a, rel.rel_quantifiers_no + | Leibniz (Some t) -> t, 0 + | Leibniz None -> assert false in + let rel_a_n = + clos_norm_flags Closure.betaiotazeta empty_env Evd.empty rel_a in + try + let _,output_rel_a_n = decompose_lam_n rel_quantifiers_no rel_a_n in + let argsrev,_ = decompose_prod output_rel_a_n in + let n = List.length argsrev in + let argsrev',_ = decompose_prod typ in + let m = List.length argsrev' in + decompose_prod_n (m - n) typ + with UserError(_,_) -> + (* decompose_lam_n failed. This may happen when rel_a is an axiom, + a constructor, an inductive type, etc. *) + decompose_prod typ + in + let args_ty = List.rev argsrev in + let args_ty_len = List.length (args_ty) in + let args_ty_quantifiers_rev,args,args_instance,output,output_instance = + match signature with + None -> + if args_ty = [] then + raise (ProofEngineTypes.Fail (lazy + ("The term " ^ CicPp.ppterm m ^ " has type " ^ + CicPp.ppterm typeofm ^ " that is not a product."))) ; + ignore (check_is_dependent 0 args_ty output) ; + let args = + List.map + (fun (_,ty) -> None,default_relation_for_carrier ty) args_ty in + let output = default_relation_for_carrier output in + [],args,args,output,output + | Some (args,output') -> + assert (args <> []); + let number_of_arguments = List.length args in + let number_of_quantifiers = args_ty_len - number_of_arguments in + if number_of_quantifiers < 0 then + raise (ProofEngineTypes.Fail (lazy + ("The morphism " ^ CicPp.ppterm m ^ " has type " ^ + CicPp.ppterm typeofm ^ " that attends at most " ^ int args_ty_len ^ + " arguments. The signature that you specified requires " ^ + int number_of_arguments ^ " arguments."))) + else + begin + (* the real_args_ty returned are already delifted *) + let args_ty_quantifiers_rev, real_args_ty, real_output = + check_is_dependent number_of_quantifiers args_ty output in + let quantifiers_rel_context = + List.map (fun (n,t) -> n,None,t) args_ty_quantifiers_rev in + let env = push_rel_context quantifiers_rel_context env in + let find_relation_class t real_t = + try + let rel = find_relation_class t in + rel, unify_relation_class_carrier_with_type env rel real_t + with Not_found -> + raise (ProofEngineTypes.Fail (lazy + ("Not a valid signature: " ^ CicPp.ppterm t ^ + " is neither a registered relation nor the Leibniz " ^ + " equality."))) + in + let find_relation_class_v (variance,t) real_t = + let relation,relation_instance = find_relation_class t real_t in + match relation, variance with + Leibniz _, None + | Relation {rel_sym = Some _}, None + | Relation {rel_sym = None}, Some _ -> + (variance, relation), (variance, relation_instance) + | Relation {rel_sym = None},None -> + raise (ProofEngineTypes.Fail (lazy + ("You must specify the variance in each argument " ^ + "whose relation is asymmetric."))) + | Leibniz _, Some _ + | Relation {rel_sym = Some _}, Some _ -> + raise (ProofEngineTypes.Fail (lazy + ("You cannot specify the variance of an argument " ^ + "whose relation is symmetric."))) + in + let args, args_instance = + List.split + (List.map2 find_relation_class_v args real_args_ty) in + let output,output_instance= find_relation_class output' real_output in + args_ty_quantifiers_rev, args, args_instance, output, output_instance + end + in + let argsconstr,outputconstr,lem = + gen_compat_lemma_statement args_ty_quantifiers_rev output_instance + args_instance (apply_to_rels m args_ty_quantifiers_rev) in + (* "unfold make_compatibility_goal" *) + let lem = + Reductionops.clos_norm_flags + (Closure.unfold_red (coq_make_compatibility_goal_eval_ref)) + env Evd.empty lem in + (* "unfold make_compatibility_goal_aux" *) + let lem = + Reductionops.clos_norm_flags + (Closure.unfold_red(coq_make_compatibility_goal_aux_eval_ref)) + env Evd.empty lem in + (* "simpl" *) + let lem = Tacred.nf env Evd.empty lem in + if Lib.is_modtype () then + begin + ignore + (Declare.declare_internal_constant id + (ParameterEntry lem, IsAssumption Logical)) ; + let mor_name = morphism_theory_id_of_morphism_proof_id id in + let lemma_infos = Some (id,argsconstr,outputconstr) in + add_morphism lemma_infos mor_name + (m,args_ty_quantifiers_rev,args,output) + end + else + begin + new_edited id + (m,args_ty_quantifiers_rev,args,argsconstr,output,outputconstr); + Pfedit.start_proof id (Global, Proof Lemma) + (Declare.clear_proofs (Global.named_context ())) + lem hook; + Options.if_verbose msg (Printer.pr_open_subgoals ()); + end +*) assert false + +let morphism_hook _ ref = +(*COQ + let pf_id = id_of_global ref in + let mor_id = morphism_theory_id_of_morphism_proof_id pf_id in + let (m,quantifiers_rev,args,argsconstr,output,outputconstr) = + what_edited pf_id in + if (is_edited pf_id) + then + begin + add_morphism (Some (pf_id,argsconstr,outputconstr)) mor_id + (m,quantifiers_rev,args,output) ; + no_more_edited pf_id + end +*) assert false + +type morphism_signature = + (bool option * Cic.term) list * Cic.term + +let new_named_morphism id m sign = + new_morphism m sign id morphism_hook + +(************************** Adding a relation to the database *********************) + +let check_a a = +(*COQ + let typ = Typing.type_of env Evd.empty a in + let a_quantifiers_rev,_ = Reduction.dest_arity env typ in + a_quantifiers_rev +*) assert false + +let check_eq a_quantifiers_rev a aeq = +(*COQ + let typ = + Sign.it_mkProd_or_LetIn + (Cic.Appl [coq_relation ; apply_to_rels a a_quantifiers_rev]) + a_quantifiers_rev in + if + not + (is_conv env Evd.empty (Typing.type_of env Evd.empty aeq) typ) + then + raise (ProofEngineTypes.Fail (lazy + (CicPp.ppterm aeq ^ " should have type (" ^ CicPp.ppterm typ ^ ")"))) +*) (assert false : unit) + +let check_property a_quantifiers_rev a aeq strprop coq_prop t = +(*COQ + if + not + (is_conv env Evd.empty (Typing.type_of env Evd.empty t) + (Sign.it_mkProd_or_LetIn + (Cic.Appl + [coq_prop ; + apply_to_rels a a_quantifiers_rev ; + apply_to_rels aeq a_quantifiers_rev]) a_quantifiers_rev)) + then + raise (ProofEngineTypes.Fail (lazy + ("Not a valid proof of " ^ strprop ^ "."))) +*) assert false + +let check_refl a_quantifiers_rev a aeq refl = + check_property a_quantifiers_rev a aeq "reflexivity" coq_reflexive refl + +let check_sym a_quantifiers_rev a aeq sym = + check_property a_quantifiers_rev a aeq "symmetry" coq_symmetric sym + +let check_trans a_quantifiers_rev a aeq trans = + check_property a_quantifiers_rev a aeq "transitivity" coq_transitive trans +;; + +let int_add_relation id a aeq refl sym trans = +(*COQ + let env = Global.env () in +*) + let a_quantifiers_rev = check_a a in + check_eq a_quantifiers_rev a aeq ; + HExtlib.iter_option (check_refl a_quantifiers_rev a aeq) refl ; + HExtlib.iter_option (check_sym a_quantifiers_rev a aeq) sym ; + HExtlib.iter_option (check_trans a_quantifiers_rev a aeq) trans ; + let quantifiers_no = List.length a_quantifiers_rev in + let aeq_rel = + { rel_a = a; + rel_aeq = aeq; + rel_refl = refl; + rel_sym = sym; + rel_trans = trans; + rel_quantifiers_no = quantifiers_no; + rel_X_relation_class = Cic.Sort Cic.Prop; (* dummy value, overwritten below *) + rel_Xreflexive_relation_class = Cic.Sort Cic.Prop (* dummy value, overwritten below *) + } in + let x_relation_class = + let subst = + let len = List.length a_quantifiers_rev in + list_map_i (fun i _ -> Cic.Rel (len - i + 2)) 0 a_quantifiers_rev in + cic_relation_class_of_X_relation + (Cic.Rel 2) (Cic.Rel 1) (apply_to_relation subst aeq_rel) in + let _ = +(*COQ + Declare.declare_internal_constant id + (DefinitionEntry + {const_entry_body = + Sign.it_mkLambda_or_LetIn x_relation_class + ([ Name "v",None,Cic.Rel 1; + Name "X",None,Cic.Sort (Cic.Type (CicUniv.fresh ()))] @ + a_quantifiers_rev); + const_entry_type = None; + const_entry_opaque = false; + const_entry_boxed = Options.boxed_definitions()}, + IsDefinition Definition) in +*) () in + let id_precise = id ^ "_precise_relation_class" in + let xreflexive_relation_class = + let subst = + let len = List.length a_quantifiers_rev in + list_map_i (fun i _ -> Cic.Rel (len - i)) 0 a_quantifiers_rev + in + cic_precise_relation_class_of_relation (apply_to_relation subst aeq_rel) in + let _ = +(*COQ + Declare.declare_internal_constant id_precise + (DefinitionEntry + {const_entry_body = + Sign.it_mkLambda_or_LetIn xreflexive_relation_class a_quantifiers_rev; + const_entry_type = None; + const_entry_opaque = false; + const_entry_boxed = Options.boxed_definitions() }, + IsDefinition Definition) in +*) () in + let aeq_rel = + { aeq_rel with + rel_X_relation_class = current_constant id; + rel_Xreflexive_relation_class = current_constant id_precise } in + relation_to_obj (aeq, aeq_rel) ; + prerr_endline (CicPp.ppterm aeq ^ " is registered as a relation"); + match trans with + None -> () + | Some trans -> + let mor_name = id ^ "_morphism" in + let a_instance = apply_to_rels a a_quantifiers_rev in + let aeq_instance = apply_to_rels aeq a_quantifiers_rev in + let sym_instance = + HExtlib.map_option (fun x -> apply_to_rels x a_quantifiers_rev) sym in + let refl_instance = + HExtlib.map_option (fun x -> apply_to_rels x a_quantifiers_rev) refl in + let trans_instance = apply_to_rels trans a_quantifiers_rev in + let aeq_rel_class_and_var1, aeq_rel_class_and_var2, lemma, output = + match sym_instance, refl_instance with + None, None -> + (Some false, Relation aeq_rel), + (Some true, Relation aeq_rel), + Cic.Appl + [coq_equality_morphism_of_asymmetric_areflexive_transitive_relation; + a_instance ; aeq_instance ; trans_instance], + coq_impl_relation + | None, Some refl_instance -> + (Some false, Relation aeq_rel), + (Some true, Relation aeq_rel), + Cic.Appl + [coq_equality_morphism_of_asymmetric_reflexive_transitive_relation; + a_instance ; aeq_instance ; refl_instance ; trans_instance], + coq_impl_relation + | Some sym_instance, None -> + (None, Relation aeq_rel), + (None, Relation aeq_rel), + Cic.Appl + [coq_equality_morphism_of_symmetric_areflexive_transitive_relation; + a_instance ; aeq_instance ; sym_instance ; trans_instance], + coq_iff_relation + | Some sym_instance, Some refl_instance -> + (None, Relation aeq_rel), + (None, Relation aeq_rel), + Cic.Appl + [coq_equality_morphism_of_symmetric_reflexive_transitive_relation; + a_instance ; aeq_instance ; refl_instance ; sym_instance ; + trans_instance], + coq_iff_relation in + let _ = +(*COQ + Declare.declare_internal_constant mor_name + (DefinitionEntry + {const_entry_body = Sign.it_mkLambda_or_LetIn lemma a_quantifiers_rev; + const_entry_type = None; + const_entry_opaque = false; + const_entry_boxed = Options.boxed_definitions()}, + IsDefinition Definition) +*) () + in + let a_quantifiers_rev = + List.map (fun (n,b,t) -> assert (b = None); n,t) a_quantifiers_rev in + add_morphism None mor_name + (aeq,a_quantifiers_rev,[aeq_rel_class_and_var1; aeq_rel_class_and_var2], + output) + +(* The vernac command "Add Relation ..." *) +let add_relation id a aeq refl sym trans = + int_add_relation id a aeq refl sym trans + +(****************************** The tactic itself *******************************) + +type direction = + Left2Right + | Right2Left + +let prdirection = + function + Left2Right -> "->" + | Right2Left -> "<-" + +type constr_with_marks = + | MApp of Cic.term * morphism_class * constr_with_marks list * direction + | ToReplace + | ToKeep of Cic.term * relation relation_class * direction + +let is_to_replace = function + | ToKeep _ -> false + | ToReplace -> true + | MApp _ -> true + +let get_mark a = + List.fold_left (||) false (List.map is_to_replace a) + +let cic_direction_of_direction = + function + Left2Right -> coq_Left2Right + | Right2Left -> coq_Right2Left + +let opposite_direction = + function + Left2Right -> Right2Left + | Right2Left -> Left2Right + +let direction_of_constr_with_marks hole_direction = + function + MApp (_,_,_,dir) -> cic_direction_of_direction dir + | ToReplace -> hole_direction + | ToKeep (_,_,dir) -> cic_direction_of_direction dir + +type argument = + Toapply of Cic.term (* apply the function to the argument *) + | Toexpand of Cic.name * Cic.term (* beta-expand the function w.r.t. an argument + of this type *) +let beta_expand c args_rev = + let rec to_expand = + function + [] -> [] + | (Toapply _)::tl -> to_expand tl + | (Toexpand (name,s))::tl -> (name,s)::(to_expand tl) in + let rec aux n = + function + [] -> [] + | (Toapply arg)::tl -> arg::(aux n tl) + | (Toexpand _)::tl -> (Cic.Rel n)::(aux (n + 1) tl) + in + compose_lambda (to_expand args_rev) + (Cic.Appl (c :: List.rev (aux 1 args_rev))) + +exception Optimize (* used to fall-back on the tactic for Leibniz equality *) + +let rec list_sep_last = function + | [] -> assert false + | hd::[] -> (hd,[]) + | hd::tl -> let (l,tl) = list_sep_last tl in (l,hd::tl) + +let relation_class_that_matches_a_constr caller_name new_goals hypt = + let heq, hargs = + match hypt with + Cic.Appl (heq::hargs) -> heq,hargs + | _ -> hypt,[] + in + let rec get_all_but_last_two = + function + [] + | [_] -> + raise (ProofEngineTypes.Fail (lazy (CicPp.ppterm hypt ^ + " is not a registered relation."))) + | [_;_] -> [] + | he::tl -> he::(get_all_but_last_two tl) in + let all_aeq_args = get_all_but_last_two hargs in + let rec find_relation l subst = + let aeq = Cic.Appl (heq::l) in + try + let rel = find_relation_class aeq in + match rel,new_goals with + Leibniz _,[] -> + assert (subst = []); + raise Optimize (* let's optimize the proof term size *) + | Leibniz (Some _), _ -> + assert (subst = []); + rel + | Leibniz None, _ -> + (* for well-typedness reasons it should have been catched by the + previous guard in the previous iteration. *) + assert false + | Relation rel,_ -> Relation (apply_to_relation subst rel) + with Not_found -> + if l = [] then + raise (ProofEngineTypes.Fail (lazy + (CicPp.ppterm (Cic.Appl (aeq::all_aeq_args)) ^ + " is not a registered relation."))) + else + let last,others = list_sep_last l in + find_relation others (last::subst) + in + find_relation all_aeq_args [] + +(* rel1 is a subrelation of rel2 whenever + forall x1 x2, rel1 x1 x2 -> rel2 x1 x2 + The Coq part of the tactic, however, needs rel1 == rel2. + Hence the third case commented out. + Note: accepting user-defined subtrelations seems to be the last + useful generalization that does not go against the original spirit of + the tactic. +*) +let subrelation gl rel1 rel2 = + match rel1,rel2 with + Relation {rel_aeq=rel_aeq1}, Relation {rel_aeq=rel_aeq2} -> + (*COQ Tacmach.pf_conv_x gl rel_aeq1 rel_aeq2*) assert false + | Leibniz (Some t1), Leibniz (Some t2) -> + (*COQ Tacmach.pf_conv_x gl t1 t2*) assert false + | Leibniz None, _ + | _, Leibniz None -> assert false +(* This is the commented out case (see comment above) + | Leibniz (Some t1), Relation {rel_a=t2; rel_refl = Some _} -> + Tacmach.pf_conv_x gl t1 t2 +*) + | _,_ -> false + +(* this function returns the list of new goals opened by a constr_with_marks *) +let rec collect_new_goals = + function + MApp (_,_,a,_) -> List.concat (List.map collect_new_goals a) + | ToReplace + | ToKeep (_,Leibniz _,_) + | ToKeep (_,Relation {rel_refl=Some _},_) -> [] + | ToKeep (c,Relation {rel_aeq=aeq; rel_refl=None},_) -> [Cic.Appl[aeq;c;c]] + +(* two marked_constr are equivalent if they produce the same set of new goals *) +let marked_constr_equiv_or_more_complex to_marked_constr gl c1 c2 = + let glc1 = collect_new_goals (to_marked_constr c1) in + let glc2 = collect_new_goals (to_marked_constr c2) in + List.for_all (fun c -> List.exists (fun c' -> (*COQ pf_conv_x gl c c'*) assert false) glc1) glc2 + +let pr_new_goals i c = + let glc = collect_new_goals c in + " " ^ string_of_int i ^ ") side conditions:" ^ + (if glc = [] then " no side conditions" + else + ("\n " ^ + String.concat "\n " + (List.map (fun c -> " ... |- " ^ CicPp.ppterm c) glc))) + +(* given a list of constr_with_marks, it returns the list where + constr_with_marks than open more goals than simpler ones in the list + are got rid of *) +let elim_duplicates gl to_marked_constr = + let rec aux = + function + [] -> [] + | he:: tl -> + if List.exists + (marked_constr_equiv_or_more_complex to_marked_constr gl he) tl + then aux tl + else he::aux tl + in + aux + +let filter_superset_of_new_goals gl new_goals l = + List.filter + (fun (_,_,c) -> + List.for_all + (fun g -> List.exists ((*COQ pf_conv_x gl g*)assert false) (collect_new_goals c)) new_goals) l + +(* given the list of lists [ l1 ; ... ; ln ] it returns the list of lists + [ c1 ; ... ; cn ] that is the cartesian product of the sets l1, ..., ln *) +let cartesian_product gl a = + let rec aux = + function + [] -> assert false + | [he] -> List.map (fun e -> [e]) he + | he::tl -> + let tl' = aux tl in + List.flatten + (List.map (function e -> List.map (function l -> e :: l) tl') he) + in + aux (List.map (elim_duplicates gl (fun x -> x)) a) + +let does_not_occur n t = assert false + +let mark_occur gl ~new_goals t in_c input_relation input_direction = + let rec aux output_relation output_direction in_c = + if t = in_c then + if input_direction = output_direction + && subrelation gl input_relation output_relation then + [ToReplace] + else [] + else + match in_c with + | Cic.Appl (c::al) -> + let mors_and_cs_and_als = + let mors_and_cs_and_als = + let morphism_table_find c = + try morphism_table_find c with Not_found -> [] in + let rec aux acc = + function + [] -> + let c' = Cic.Appl (c::acc) in + let al' = [] in + List.map (fun m -> m,c',al') (morphism_table_find c') + | (he::tl) as l -> + let c' = Cic.Appl (c::acc) in + let acc' = acc @ [he] in + (List.map (fun m -> m,c',l) (morphism_table_find c')) @ + (aux acc' tl) + in + aux [] al in + let mors_and_cs_and_als = + List.map + (function (m,c,al) -> + relation_morphism_of_constr_morphism m, c, al) + mors_and_cs_and_als in + let mors_and_cs_and_als = + List.fold_left + (fun l (m,c,al) -> + try (unify_morphism_with_arguments gl (c,al) m t) :: l + with Impossible -> l + ) [] mors_and_cs_and_als + in + List.filter + (fun (mor,_,_) -> subrelation gl mor.output output_relation) + mors_and_cs_and_als + in + (* First we look for well typed morphisms *) + let res_mors = + List.fold_left + (fun res (mor,c,al) -> + let a = + let arguments = mor.args in + let apply_variance_to_direction default_dir = + function + None -> default_dir + | Some true -> output_direction + | Some false -> opposite_direction output_direction + in + List.map2 + (fun a (variance,relation) -> + (aux relation + (apply_variance_to_direction Left2Right variance) a) @ + (aux relation + (apply_variance_to_direction Right2Left variance) a) + ) al arguments + in + let a' = cartesian_product gl a in + (List.map + (function a -> + if not (get_mark a) then + ToKeep (in_c,output_relation,output_direction) + else + MApp (c,ACMorphism mor,a,output_direction)) a') @ res + ) [] mors_and_cs_and_als in + (* Then we look for well typed functions *) + let res_functions = + (* the tactic works only if the function type is + made of non-dependent products only. However, here we + can cheat a bit by partially istantiating c to match + the requirement when the arguments to be replaced are + bound by non-dependent products only. *) + let typeofc = (*COQ Tacmach.pf_type_of gl c*) assert false in + let typ = (*COQ nf_betaiota typeofc*) let _ = typeofc in assert false in + let rec find_non_dependent_function context c c_args_rev typ + f_args_rev a_rev + = + function + [] -> + if a_rev = [] then + [ToKeep (in_c,output_relation,output_direction)] + else + let a' = + cartesian_product gl (List.rev a_rev) + in + List.fold_left + (fun res a -> + if not (get_mark a) then + (ToKeep (in_c,output_relation,output_direction))::res + else + let err = + match output_relation with + Leibniz (Some typ') when (*COQ pf_conv_x gl typ typ'*) assert false -> + false + | Leibniz None -> assert false + | _ when output_relation = coq_iff_relation + -> false + | _ -> true + in + if err then res + else + let mor = + ACFunction{f_args=List.rev f_args_rev;f_output=typ} in + let func = beta_expand c c_args_rev in + (MApp (func,mor,a,output_direction))::res + ) [] a' + | (he::tl) as a-> + let typnf = (*COQ Reduction.whd_betadeltaiota env typ*) assert false in + match typnf with + Cic.Cast (typ,_) -> + find_non_dependent_function context c c_args_rev typ + f_args_rev a_rev a + | Cic.Prod (name,s,t) -> + let context' = Some (name, Cic.Decl s)::context in + let he = + (aux (Leibniz (Some s)) Left2Right he) @ + (aux (Leibniz (Some s)) Right2Left he) in + if he = [] then [] + else + let he0 = List.hd he in + begin + match does_not_occur 1 t, he0 with + _, ToKeep (arg,_,_) -> + (* invariant: if he0 = ToKeep (t,_,_) then every + element in he is = ToKeep (t,_,_) *) + assert + (List.for_all + (function + ToKeep(arg',_,_) when (*COQpf_conv_x gl arg arg'*) assert false -> + true + | _ -> false) he) ; + (* generic product, to keep *) + find_non_dependent_function + context' c ((Toapply arg)::c_args_rev) + (CicSubstitution.subst arg t) f_args_rev a_rev tl + | true, _ -> + (* non-dependent product, to replace *) + find_non_dependent_function + context' c ((Toexpand (name,s))::c_args_rev) + (CicSubstitution.lift 1 t) (s::f_args_rev) (he::a_rev) tl + | false, _ -> + (* dependent product, to replace *) + (* This limitation is due to the reflexive + implementation and it is hard to lift *) + raise (ProofEngineTypes.Fail (lazy + ("Cannot rewrite in the argument of a " ^ + "dependent product. If you need this " ^ + "feature, please report to the author."))) + end + | _ -> assert false + in + find_non_dependent_function (*COQ (Tacmach.pf_env gl) ci vuole il contesto*)(assert false) c [] typ [] [] + al + in + elim_duplicates gl (fun x -> x) (res_functions @ res_mors) + | Cic.Prod (_, c1, c2) -> + if (*COQ (dependent (Cic.Rel 1) c2)*) assert false + then + raise (ProofEngineTypes.Fail (lazy + ("Cannot rewrite in the type of a variable bound " ^ + "in a dependent product."))) + else + let typeofc1 = (*COQ Tacmach.pf_type_of gl c1*) assert false in + if not (*COQ (Tacmach.pf_conv_x gl typeofc1 (Cic.Sort Cic.Prop))*) (assert false) then + (* to avoid this error we should introduce an impl relation + whose first argument is Type instead of Prop. However, + the type of the new impl would be Type -> Prop -> Prop + that is no longer a Relation_Definitions.relation. Thus + the Coq part of the tactic should be heavily modified. *) + raise (ProofEngineTypes.Fail (lazy + ("Rewriting in a product A -> B is possible only when A " ^ + "is a proposition (i.e. A is of type Prop). The type " ^ + CicPp.ppterm c1 ^ " has type " ^ CicPp.ppterm typeofc1 ^ + " that is not convertible to Prop."))) + else + aux output_relation output_direction + (Cic.Appl [coq_impl; c1 ; CicSubstitution.subst (Cic.Rel 1 (*dummy*)) c2]) + | _ -> + if (*COQ occur_term t in_c*) assert false then + raise (ProofEngineTypes.Fail (lazy + ("Trying to replace " ^ CicPp.ppterm t ^ " in " ^ CicPp.ppterm in_c ^ + " that is not an applicative context."))) + else + [ToKeep (in_c,output_relation,output_direction)] + in + let aux2 output_relation output_direction = + List.map + (fun res -> output_relation,output_direction,res) + (aux output_relation output_direction in_c) in + let res = + (aux2 coq_iff_relation Right2Left) @ + (* This is the case of a proposition of signature A ++> iff or B --> iff *) + (aux2 coq_iff_relation Left2Right) @ + (aux2 coq_impl_relation Right2Left) in + let res = elim_duplicates gl (function (_,_,t) -> t) res in + let res' = filter_superset_of_new_goals gl new_goals res in + match res' with + [] when res = [] -> + raise (ProofEngineTypes.Fail (lazy + ("Either the term " ^ CicPp.ppterm t ^ " that must be " ^ + "rewritten occurs in a covariant position or the goal is not " ^ + "made of morphism applications only. You can replace only " ^ + "occurrences that are in a contravariant position and such that " ^ + "the context obtained by abstracting them is made of morphism " ^ + "applications only."))) + | [] -> + raise (ProofEngineTypes.Fail (lazy + ("No generated set of side conditions is a superset of those " ^ + "requested by the user. The generated sets of side conditions " ^ + "are:\n" ^ + prlist_with_sepi "\n" + (fun i (_,_,mc) -> pr_new_goals i mc) res))) + | [he] -> he + | he::_ -> + prerr_endline + ("Warning: The application of the tactic is subject to one of " ^ + "the \nfollowing set of side conditions that the user needs " ^ + "to prove:\n" ^ + prlist_with_sepi "\n" + (fun i (_,_,mc) -> pr_new_goals i mc) res' ^ + "\nThe first set is randomly chosen. Use the syntax " ^ + "\"setoid_rewrite ... generate side conditions ...\" to choose " ^ + "a different set.") ; + he + +let cic_morphism_context_list_of_list hole_relation hole_direction out_direction += + let check = + function + (None,dir,dir') -> + Cic.Appl [coq_MSNone ; dir ; dir'] + | (Some true,dir,dir') -> + assert (dir = dir'); + Cic.Appl [coq_MSCovariant ; dir] + | (Some false,dir,dir') -> + assert (dir <> dir'); + Cic.Appl [coq_MSContravariant ; dir] in + let rec aux = + function + [] -> assert false + | [(variance,out),(value,direction)] -> + Cic.Appl [coq_singl ; coq_Argument_Class ; out], + Cic.Appl + [coq_fcl_singl; + hole_relation; hole_direction ; out ; + direction ; out_direction ; + check (variance,direction,out_direction) ; value] + | ((variance,out),(value,direction))::tl -> + let outtl, valuetl = aux tl in + Cic.Appl + [coq_cons; coq_Argument_Class ; out ; outtl], + Cic.Appl + [coq_fcl_cons; + hole_relation ; hole_direction ; out ; outtl ; + direction ; out_direction ; + check (variance,direction,out_direction) ; + value ; valuetl] + in aux + +let rec cic_type_nelist_of_list = + function + [] -> assert false + | [value] -> + Cic.Appl [coq_singl; Cic.Sort (Cic.Type (CicUniv.fresh ())) ; value] + | value::tl -> + Cic.Appl + [coq_cons; Cic.Sort (Cic.Type (CicUniv.fresh ())); value; + cic_type_nelist_of_list tl] + +let syntactic_but_representation_of_marked_but hole_relation hole_direction = + let rec aux out (rel_out,precise_out,is_reflexive) = + function + MApp (f, m, args, direction) -> + let direction = cic_direction_of_direction direction in + let morphism_theory, relations = + match m with + ACMorphism { args = args ; morphism_theory = morphism_theory } -> + morphism_theory,args + | ACFunction { f_args = f_args ; f_output = f_output } -> + let mt = + if (*COQ eq_constr out (cic_relation_class_of_relation_class + coq_iff_relation)*) assert false + then + Cic.Appl + [coq_morphism_theory_of_predicate; + cic_type_nelist_of_list f_args; f] + else + Cic.Appl + [coq_morphism_theory_of_function; + cic_type_nelist_of_list f_args; f_output; f] + in + mt,List.map (fun x -> None,Leibniz (Some x)) f_args in + let cic_relations = + List.map + (fun (variance,r) -> + variance, + r, + cic_relation_class_of_relation_class r, + cic_precise_relation_class_of_relation_class r + ) relations in + let cic_args_relations,argst = + cic_morphism_context_list_of_list hole_relation hole_direction direction + (List.map2 + (fun (variance,trel,t,precise_t) v -> + (variance,cic_argument_class_of_argument_class (variance,trel)), + (aux t precise_t v, + direction_of_constr_with_marks hole_direction v) + ) cic_relations args) + in + Cic.Appl + [coq_App; + hole_relation ; hole_direction ; + cic_args_relations ; out ; direction ; + morphism_theory ; argst] + | ToReplace -> + Cic.Appl [coq_ToReplace ; hole_relation ; hole_direction] + | ToKeep (c,_,direction) -> + let direction = cic_direction_of_direction direction in + if is_reflexive then + Cic.Appl + [coq_ToKeep ; hole_relation ; hole_direction ; precise_out ; + direction ; c] + else + let c_is_proper = + let typ = Cic.Appl [rel_out ; c ; c] in + Cic.Cast ((*COQ Evarutil.mk_new_meta ()*)assert false, typ) + in + Cic.Appl + [coq_ProperElementToKeep ; + hole_relation ; hole_direction; precise_out ; + direction; c ; c_is_proper] + in aux + +let apply_coq_setoid_rewrite hole_relation prop_relation c1 c2 (direction,h) + prop_direction m += + let hole_relation = cic_relation_class_of_relation_class hole_relation in + let hyp,hole_direction = h,cic_direction_of_direction direction in + let cic_prop_relation = cic_relation_class_of_relation_class prop_relation in + let precise_prop_relation = + cic_precise_relation_class_of_relation_class prop_relation + in + Cic.Appl + [coq_setoid_rewrite; + hole_relation ; hole_direction ; cic_prop_relation ; + prop_direction ; c1 ; c2 ; + syntactic_but_representation_of_marked_but hole_relation hole_direction + cic_prop_relation precise_prop_relation m ; hyp] + +(*COQ +let check_evar_map_of_evars_defs evd = + let metas = Evd.meta_list evd in + let check_freemetas_is_empty rebus = + Evd.Metaset.iter + (fun m -> + if Evd.meta_defined evd m then () else + raise (Logic.RefinerError (Logic.OccurMetaGoal rebus))) + in + List.iter + (fun (_,binding) -> + match binding with + Evd.Cltyp (_,{Evd.rebus=rebus; Evd.freemetas=freemetas}) -> + check_freemetas_is_empty rebus freemetas + | Evd.Clval (_,{Evd.rebus=rebus1; Evd.freemetas=freemetas1}, + {Evd.rebus=rebus2; Evd.freemetas=freemetas2}) -> + check_freemetas_is_empty rebus1 freemetas1 ; + check_freemetas_is_empty rebus2 freemetas2 + ) metas +*) + +(* For a correct meta-aware "rewrite in", we split unification + apart from the actual rewriting (Pierre L, 05/04/06) *) + +(* [unification_rewrite] searchs a match for [c1] in [but] and then + returns the modified objects (in particular [c1] and [c2]) *) + +let unification_rewrite c1 c2 cl but gl = +(*COQ + let (env',c1) = + try + (* ~mod_delta:false to allow to mark occurences that must not be + rewritten simply by replacing them with let-defined definitions + in the context *) + w_unify_to_subterm ~mod_delta:false (pf_env gl) (c1,but) cl.env + with + Pretype_errors.PretypeError _ -> + (* ~mod_delta:true to make Ring work (since it really + exploits conversion) *) + w_unify_to_subterm ~mod_delta:true (pf_env gl) (c1,but) cl.env + in + let cl' = {cl with env = env' } in + let c2 = Clenv.clenv_nf_meta cl' c2 in + check_evar_map_of_evars_defs env' ; + env',Clenv.clenv_value cl', c1, c2 +*) assert false + +(* no unification is performed in this function. [sigma] is the + substitution obtained from an earlier unification. *) + +let relation_rewrite_no_unif c1 c2 hyp ~new_goals sigma gl = + let but = (*COQ pf_concl gl*) assert false in + try + let input_relation = + relation_class_that_matches_a_constr "Setoid_rewrite" + new_goals ((*COQTyping.mtype_of (pf_env gl) sigma (snd hyp)*) assert false) in + let output_relation,output_direction,marked_but = + mark_occur gl ~new_goals c1 but input_relation (fst hyp) in + let cic_output_direction = cic_direction_of_direction output_direction in + let if_output_relation_is_iff gl = + let th = + apply_coq_setoid_rewrite input_relation output_relation c1 c2 hyp + cic_output_direction marked_but + in + let new_but = (*COQ Termops.replace_term c1 c2 but*) assert false in + let hyp1,hyp2,proj = + match output_direction with + Right2Left -> new_but, but, coq_proj1 + | Left2Right -> but, new_but, coq_proj2 + in + let impl1 = Cic.Prod (Cic.Anonymous, hyp2, CicSubstitution.lift 1 hyp1) in + let impl2 = Cic.Prod (Cic.Anonymous, hyp1, CicSubstitution.lift 1 hyp2) in + let th' = Cic.Appl [proj; impl2; impl1; th] in + (*COQ Tactics.refine + (Cic.Appl [th'; mkCast (Evarutil.mk_new_meta(), DEFAULTcast, new_but)]) + gl*) let _ = th' in assert false in + let if_output_relation_is_if gl = + let th = + apply_coq_setoid_rewrite input_relation output_relation c1 c2 hyp + cic_output_direction marked_but + in + let new_but = (*COQ Termops.replace_term c1 c2 but*) assert false in + (*COQ Tactics.refine + (Cic.Appl [th ; mkCast (Evarutil.mk_new_meta(), DEFAULTcast, new_but)]) + gl*) let _ = new_but,th in assert false in + if output_relation = coq_iff_relation then + if_output_relation_is_iff gl + else + if_output_relation_is_if gl + with + Optimize -> + (*COQ !general_rewrite (fst hyp = Left2Right) (snd hyp) gl*) assert false + +let relation_rewrite c1 c2 (input_direction,cl) ~new_goals gl = + let (sigma,cl,c1,c2) = unification_rewrite c1 c2 cl ((*COQ pf_concl gl*) assert false) gl in + relation_rewrite_no_unif c1 c2 (input_direction,cl) ~new_goals sigma gl + +let analyse_hypothesis gl c = + let ctype = (*COQ pf_type_of gl c*) assert false in + let eqclause = (*COQ Clenv.make_clenv_binding gl (c,ctype) Rawterm.NoBindings*) let _ = ctype in assert false in + let (equiv, args) = (*COQ decompose_app (Clenv.clenv_type eqclause)*) assert false in + let rec split_last_two = function + | [c1;c2] -> [],(c1, c2) + | x::y::z -> + let l,res = split_last_two (y::z) in x::l, res + | _ -> raise (ProofEngineTypes.Fail (lazy "The term provided is not an equivalence")) in + let others,(c1,c2) = split_last_two args in + eqclause,Cic.Appl (equiv::others),c1,c2 + +let general_s_rewrite lft2rgt c ~new_goals (*COQgl*) = +(*COQ + let eqclause,_,c1,c2 = analyse_hypothesis gl c in + if lft2rgt then + relation_rewrite c1 c2 (Left2Right,eqclause) ~new_goals gl + else + relation_rewrite c2 c1 (Right2Left,eqclause) ~new_goals gl +*) assert false + +let relation_rewrite_in id c1 c2 (direction,eqclause) ~new_goals gl = + let hyp = (*COQ pf_type_of gl (mkVar id)*) assert false in + (* first, we find a match for c1 in the hyp *) + let (sigma,cl,c1,c2) = unification_rewrite c1 c2 eqclause hyp gl in + (* since we will actually rewrite in the opposite direction, we also need + to replace every occurrence of c2 (resp. c1) in hyp with something that + is convertible but not syntactically equal. To this aim we introduce a + let-in and then we will use the intro tactic to get rid of it. + Quite tricky to do properly since c1 can occur in c2 or vice-versa ! *) + let mangled_new_hyp = + let hyp = CicSubstitution.lift 2 hyp in + (* first, we backup every occurences of c1 in newly allocated (Rel 1) *) + let hyp = (*COQ Termops.replace_term (CicSubstitution.lift 2 c1) (Cic.Rel 1) hyp*) let _ = hyp in assert false in + (* then, we factorize every occurences of c2 into (Rel 2) *) + let hyp = (*COQ Termops.replace_term (CicSubstitution.lift 2 c2) (Cic.Rel 2) hyp*) let _ = hyp in assert false in + (* Now we substitute (Rel 1) (i.e. c1) for c2 *) + let hyp = CicSubstitution.subst (CicSubstitution.lift 1 c2) hyp in + (* Since CicSubstitution.subst has killed Rel 1 and decreased the other Rels, + Rel 1 is now coding for c2, we can build the let-in factorizing c2 *) + Cic.LetIn (Cic.Anonymous,c2,hyp) + in + let new_hyp = (*COQ Termops.replace_term c1 c2 hyp*) assert false in + let oppdir = opposite_direction direction in +(*COQ + cut_replacing id new_hyp + (tclTHENLAST + (tclTHEN (change_in_concl None mangled_new_hyp) + (tclTHEN intro + (relation_rewrite_no_unif c2 c1 (oppdir,cl) ~new_goals sigma)))) + gl +*) let _ = oppdir,new_hyp,mangled_new_hyp in assert false + +let general_s_rewrite_in id lft2rgt c ~new_goals (*COQgl*) = +(*COQ + let eqclause,_,c1,c2 = analyse_hypothesis gl c in + if lft2rgt then + relation_rewrite_in id c1 c2 (Left2Right,eqclause) ~new_goals gl + else + relation_rewrite_in id c2 c1 (Right2Left,eqclause) ~new_goals gl +*) assert false + +let setoid_replace relation c1 c2 ~new_goals (*COQgl*) = + try + let relation = + match relation with + Some rel -> + (try + match find_relation_class rel with + Relation sa -> sa + | Leibniz _ -> raise Optimize + with + Not_found -> + raise (ProofEngineTypes.Fail (lazy + (CicPp.ppterm rel ^ " is not a registered relation.")))) + | None -> + match default_relation_for_carrier ((*COQ pf_type_of gl c1*) assert false) with + Relation sa -> sa + | Leibniz _ -> raise Optimize + in + let eq_left_to_right = Cic.Appl [relation.rel_aeq; c1 ; c2] in + let eq_right_to_left = Cic.Appl [relation.rel_aeq; c2 ; c1] in +(*COQ + let replace dir eq = + tclTHENS (assert_tac false Cic.Anonymous eq) + [onLastHyp (fun id -> + tclTHEN + (general_s_rewrite dir (mkVar id) ~new_goals) + (clear [id])); + Tacticals.tclIDTAC] + in + tclORELSE + (replace true eq_left_to_right) (replace false eq_right_to_left) gl +*) let _ = eq_left_to_right,eq_right_to_left in assert false + with + Optimize -> (*COQ (!replace c1 c2) gl*) assert false + +let setoid_replace_in id relation c1 c2 ~new_goals (*COQgl*) = +(*COQ + let hyp = pf_type_of gl (mkVar id) in + let new_hyp = Termops.replace_term c1 c2 hyp in + cut_replacing id new_hyp + (fun exact -> tclTHENLASTn + (setoid_replace relation c2 c1 ~new_goals) + [| exact; tclIDTAC |]) gl +*) assert false + +(* [setoid_]{reflexivity,symmetry,transitivity} tactics *) + +let setoid_reflexivity_tac = + let tac ((proof,goal) as status) = + let (_,metasenv,_subst,_,_, _) = proof in + let metano,context,ty = CicUtil.lookup_meta goal metasenv in + try + let relation_class = + relation_class_that_matches_a_constr "Setoid_reflexivity" [] ty in + match relation_class with + Leibniz _ -> assert false (* since [] is empty *) + | Relation rel -> + match rel.rel_refl with + None -> + raise (ProofEngineTypes.Fail (lazy + ("The relation " ^ prrelation rel ^ " is not reflexive."))) + | Some refl -> + ProofEngineTypes.apply_tactic (PrimitiveTactics.apply_tac refl) + status + with + Optimize -> + ProofEngineTypes.apply_tactic EqualityTactics.reflexivity_tac status + in + ProofEngineTypes.mk_tactic tac + +let setoid_symmetry = + let tac status = + try + let relation_class = + relation_class_that_matches_a_constr "Setoid_symmetry" + [] ((*COQ pf_concl gl*) assert false) in + match relation_class with + Leibniz _ -> assert false (* since [] is empty *) + | Relation rel -> + match rel.rel_sym with + None -> + raise (ProofEngineTypes.Fail (lazy + ("The relation " ^ prrelation rel ^ " is not symmetric."))) + | Some sym -> (*COQ apply sym gl*) assert false + with + Optimize -> (*COQ symmetry gl*) assert false + in + ProofEngineTypes.mk_tactic tac + +let setoid_symmetry_in id (*COQgl*) = +(*COQ + let new_hyp = + let _,he,c1,c2 = analyse_hypothesis gl (mkVar id) in + Cic.Appl [he ; c2 ; c1] + in + cut_replacing id new_hyp (tclTHEN setoid_symmetry) gl +*) assert false + +let setoid_transitivity c (*COQgl*) = + try + let relation_class = + relation_class_that_matches_a_constr "Setoid_transitivity" + [] ((*COQ pf_concl gl*) assert false) in + match relation_class with + Leibniz _ -> assert false (* since [] is empty *) + | Relation rel -> +(*COQ + let ctyp = pf_type_of gl c in + let rel' = unify_relation_carrier_with_type (pf_env gl) rel ctyp in + match rel'.rel_trans with + None -> + raise (ProofEngineTypes.Fail (lazy + ("The relation " ^ prrelation rel ^ " is not transitive."))) + | Some trans -> + let transty = nf_betaiota (pf_type_of gl trans) in + let argsrev, _ = + Reductionops.decomp_n_prod (pf_env gl) Evd.empty 2 transty in + let binder = + match List.rev argsrev with + _::(Name n2,None,_)::_ -> Rawterm.NamedHyp n2 + | _ -> assert false + in + apply_with_bindings + (trans, Rawterm.ExplicitBindings [ dummy_loc, binder, c ]) gl +*) assert false + with + Optimize -> (*COQ transitivity c gl*) assert false +;; + +(*COQ +Tactics.register_setoid_reflexivity setoid_reflexivity;; +Tactics.register_setoid_symmetry setoid_symmetry;; +Tactics.register_setoid_symmetry_in setoid_symmetry_in;; +Tactics.register_setoid_transitivity setoid_transitivity;; +*) diff --git a/components/tactics/setoids.mli b/components/tactics/setoids.mli new file mode 100644 index 000000000..abe71f4eb --- /dev/null +++ b/components/tactics/setoids.mli @@ -0,0 +1,70 @@ +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* Cic.term -> ProofEngineTypes.tactic) -> unit +val register_general_rewrite : (bool -> Cic.term -> ProofEngineTypes.tactic) -> unit + +val print_setoids : unit -> unit + +val equiv_list : unit -> Cic.term list +val default_relation_for_carrier : + ?filter:(relation -> bool) -> Cic.term -> relation relation_class +(* [default_morphism] raises [Not_found] *) +val default_morphism : + ?filter:(Cic.term morphism -> bool) -> Cic.term -> relation morphism + +val setoid_replace : + Cic.term option -> Cic.term -> Cic.term -> new_goals:Cic.term list -> ProofEngineTypes.tactic +val setoid_replace_in : + string -> Cic.term option -> Cic.term -> Cic.term -> new_goals:Cic.term list -> + ProofEngineTypes.tactic + +val general_s_rewrite : bool -> Cic.term -> new_goals:Cic.term list -> ProofEngineTypes.tactic +val general_s_rewrite_in : + string -> bool -> Cic.term -> new_goals:Cic.term list -> ProofEngineTypes.tactic + +val setoid_reflexivity_tac : ProofEngineTypes.tactic +val setoid_symmetry : ProofEngineTypes.tactic +val setoid_symmetry_in : string -> ProofEngineTypes.tactic +val setoid_transitivity : Cic.term -> ProofEngineTypes.tactic + +val add_relation : + string -> Cic.term -> Cic.term -> Cic.term option -> + Cic.term option -> Cic.term option -> unit + +val new_named_morphism : + string -> Cic.term -> morphism_signature option -> unit + +val relation_table_find : Cic.term -> relation +val relation_table_mem : Cic.term -> bool diff --git a/components/tactics/statefulProofEngine.ml b/components/tactics/statefulProofEngine.ml new file mode 100644 index 000000000..37800187a --- /dev/null +++ b/components/tactics/statefulProofEngine.ml @@ -0,0 +1,216 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let default_history_size = 20 + +exception No_goal_left +exception Uri_redefinition +type event = [ `Proof_changed | `Proof_completed ] +let all_events = [ `Proof_changed; `Proof_completed ] +let default_events: event list = [ `Proof_changed ] + +type proof_status = ProofEngineTypes.proof * ProofEngineTypes.goal option + +type 'a observer = (proof_status * 'a) option -> (proof_status * 'a) -> unit +type observer_id = int + +exception Observer_failures of (observer_id * exn) list +exception Tactic_failure of exn +exception Data_failure of exn + +class ['a] status + ?(history_size = default_history_size) + ?uri ~typ ~body ~metasenv ~attrs init_data compute_data () + = + let next_observer_id = + let next_id = ref 0 in + fun () -> + incr next_id; + !next_id + in + let _subst = ([] : Cic.substitution) in + let initial_proof = ((uri: UriManager.uri option), metasenv, _subst, body, typ, attrs) in + let next_goal (goals, proof) = + match goals, proof with + | goal :: _, _ -> Some goal + | [], (_, (goal, _, _) :: _, _, _, _, _) -> + (* the tactic left no open goal: let's choose the first open goal *) + Some goal + | _, _ -> None + in + let initial_goal = next_goal ([], initial_proof) in + object (self) + + val mutable _proof = initial_proof + val mutable _goal = initial_goal + val mutable _data: 'a = init_data (initial_proof, initial_goal) + + (* event -> (id, observer) list *) + val observers = Hashtbl.create 7 + + (* assumption: all items in history are uncompleted proofs, thus option on + * goal could be ignored and goal are stored as bare integers *) + val history = new History.history history_size + + initializer + history#push self#internal_status + + method proof = _proof + method private status = (_proof, _goal) (* logic status *) + method private set_status (proof, (goal: int option)) = + _proof <- proof; + _goal <- goal + + method goal = + match _goal with + | Some goal -> goal + | None -> raise No_goal_left + + (* what will be kept in history *) + method private internal_status = (self#status, _data) + method private set_internal_status (status, data) = + self#set_status status; + _data <- data + + method set_goal goal = + _goal <- Some goal +(* + let old_internal_status = self#internal_status in + _goal <- Some goal; + try + self#update_data old_internal_status; + history#push self#internal_status; + self#private_notify (Some old_internal_status) + with (Data_failure _) as exn -> + self#set_internal_status old_internal_status; + raise exn +*) + + method uri = let (uri, _, _, _, _, _) = _proof in uri + method metasenv = let (_, metasenv, _, _, _, _) = _proof in metasenv + method body = let (_, _, _, body, _, _) = _proof in body + method typ = let (_, _, _, _, typ, _) = _proof in typ + method attrs = let (_, _, _, _, _, attrs) = _proof in attrs + + method set_metasenv metasenv = + let (uri, _, _subst,body, typ, attes) = _proof in + _proof <- (uri, metasenv, _subst,body, typ, attrs) + + method set_uri uri = + let (old_uri, metasenv, _subst,body, typ, attrs) = _proof in + if old_uri <> None then + raise Uri_redefinition; + _proof <- (Some uri, metasenv, _subst,body, typ, attrs) + + method conjecture goal = + let (_, metasenv, _subst, _, _, _) = _proof in + CicUtil.lookup_meta goal metasenv + + method apply_tactic tactic = + let old_internal_status = self#internal_status in + let (new_proof, new_goals) = + try + ProofEngineTypes.apply_tactic tactic (_proof, self#goal) + with exn -> raise (Tactic_failure exn) + in + _proof <- new_proof; + _goal <- next_goal (new_goals, new_proof); + try + self#update_data old_internal_status; + history#push self#internal_status; + self#private_notify (Some old_internal_status) + with (Data_failure _) as exn -> + self#set_internal_status old_internal_status; + raise exn + + method proof_completed = _goal = None + + method attach_observer ?(interested_in = default_events) observer + = + let id = next_observer_id () in + List.iter + (fun event -> + let prev_observers = + try Hashtbl.find observers event with Not_found -> [] + in + Hashtbl.replace observers event ((id, observer)::prev_observers)) + interested_in; + id + + method detach_observer id = + List.iter + (fun event -> + let prev_observers = + try Hashtbl.find observers event with Not_found -> [] + in + let new_observers = + List.filter (fun (id', _) -> id' <> id) prev_observers + in + Hashtbl.replace observers event new_observers) + all_events + + method private private_notify old_internal_status = + let cur_internal_status = (self#status, _data) in + let exns = ref [] in + let notify (id, observer) = + try + observer old_internal_status cur_internal_status + with exn -> exns := (id, exn) :: !exns + in + List.iter notify + (try Hashtbl.find observers `Proof_changed with Not_found -> []); + if self#proof_completed then + List.iter notify + (try Hashtbl.find observers `Proof_completed with Not_found -> []); + match !exns with + | [] -> () + | exns -> raise (Observer_failures exns) + + method private update_data old_internal_status = + (* invariant: _goal and/or _proof has been changed + * invariant: proof is not yet completed *) + let status = self#status in + try + _data <- compute_data old_internal_status status + with exn -> raise (Data_failure exn) + + method undo ?(steps = 1) () = + let ((proof, goal), data) = history#undo steps in + _proof <- proof; + _goal <- goal; + _data <- data; + self#private_notify None + + method redo ?(steps = 1) () = self#undo ~steps:~-steps () + + method notify = self#private_notify None + + end + +let trivial_status ?uri ~typ ~body ~metasenv ~attrs () = + new status ?uri ~typ ~body ~metasenv ~attrs (fun _ -> ()) (fun _ _ -> ()) () + diff --git a/components/tactics/statefulProofEngine.mli b/components/tactics/statefulProofEngine.mli new file mode 100644 index 000000000..64a394d74 --- /dev/null +++ b/components/tactics/statefulProofEngine.mli @@ -0,0 +1,123 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** Stateful handling of proof status *) + +exception No_goal_left +exception Uri_redefinition + +type event = [ `Proof_changed | `Proof_completed ] + +val all_events: event list + + (** from our point of view a status is the status of an incomplete proof, thus + * we have an optional goal which is None if the proof is not yet completed + * (i.e. some goal is still open) *) +type proof_status = ProofEngineTypes.proof * ProofEngineTypes.goal option + + (** Proof observer. First callback argument is Some extended_status + * when a 'real 'change of the proof happened and None when Proof_changed event + * was triggered by a time travel by the means of undo/redo actions or by an + * external "#notify" invocation. Embedded status is the status _before_ the + * current change. Second status is the status reached _after_ the current + * change. *) +type 'a observer = (proof_status * 'a) option -> (proof_status * 'a) -> unit + + (** needed to detach previously attached observers *) +type observer_id + + (** tactic application failed. @see apply_tactic *) +exception Tactic_failure of exn + + (** one or more observers failed. @see apply_tactic *) +exception Observer_failures of (observer_id * exn) list + + (** failure while updating internal data (: 'a). @see apply_tactic *) +exception Data_failure of exn + +(** {2 OO interface} *) + +class ['a] status: + ?history_size:int -> (** default 20 *) + ?uri:UriManager.uri -> + typ:Cic.term -> body:Cic.term -> metasenv:Cic.metasenv -> + attrs:Cic.attribute list -> + (proof_status -> 'a) -> (* init data *) + (proof_status * 'a -> proof_status -> 'a) -> (* update data *) + unit -> + object + + method proof: ProofEngineTypes.proof + method metasenv: Cic.metasenv + method body: Cic.term + method typ: Cic.term + method attrs: Cic.attribute list + + (** change metasenv _without_ triggering any notification *) + method set_metasenv: Cic.metasenv -> unit + + (** goal -> conjecture + * @raise CicUtil.Meta_not_found *) + method conjecture: int -> Cic.conjecture + + method proof_completed: bool + method goal: int (** @raise No_goal_left *) + method set_goal: int -> unit (** @raise Data_failure *) + + method uri: UriManager.uri option + method set_uri: UriManager.uri -> unit (** @raise Uri_redefinition *) + + (** @raise Tactic_failure + * @raise Observer_failures + * @raise Data_failure + * + * In case of tactic failure, internal status is left unchanged. + * In case of observer failures internal status will be changed and is + * granted that all observer will be invoked collecting their failures. + * In case of data failure, internal status is left unchanged (rolling back + * last tactic application if needed) + *) + method apply_tactic: ProofEngineTypes.tactic -> unit + + method undo: ?steps:int -> unit -> unit + method redo: ?steps:int -> unit -> unit + + method attach_observer: + ?interested_in:(event list) -> 'a observer -> observer_id + + method detach_observer: observer_id -> unit + + (** force a notification to all observer, old status is passed as None *) + method notify: unit + + end + +val trivial_status: + ?uri:UriManager.uri -> + typ:Cic.term -> body:Cic.term -> metasenv:Cic.metasenv -> + attrs:Cic.attribute list -> + unit -> + unit status + diff --git a/components/tactics/tacticChaser.ml b/components/tactics/tacticChaser.ml new file mode 100644 index 000000000..cb700f776 --- /dev/null +++ b/components/tactics/tacticChaser.ml @@ -0,0 +1,259 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(*****************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 18/02/2003 *) +(* *) +(* *) +(*****************************************************************************) + +(* $Id$ *) + +module MQI = MQueryInterpreter +module MQIC = MQIConn +module I = MQueryInterpreter +module U = MQGUtil +module G = MQueryGenerator + + (* search arguments on which Apply tactic doesn't fail *) +let matchConclusion mqi_handle ?(output_html = (fun _ -> ())) ~choose_must() status = + let ((_, metasenv, _, _), metano) = status in + let (_, ey ,ty) = CicUtil.lookup_meta metano metasenv in + let list_of_must, only = CGMatchConclusion.get_constraints metasenv ey ty in +match list_of_must with + [] -> [] +|_ -> + let must = choose_must list_of_must only in + let result = + I.execute mqi_handle + (G.query_of_constraints + (Some CGMatchConclusion.universe) + (must,[],[]) (Some only,None,None)) in + let uris = + List.map + (function uri,_ -> + MQueryMisc.wrong_xpointer_format_from_wrong_xpointer_format' uri + ) result + in + let uris = + (* TODO ristretto per ragioni di efficienza *) + prerr_endline "STO FILTRANDO"; + List.filter (fun uri -> Pcre.pmatch ~pat:"^cic:/Coq/" uri) uris + in + prerr_endline "HO FILTRATO"; + let uris',exc = + let rec filter_out = + function + [] -> [],"" + | uri::tl -> + let tl',exc = filter_out tl in + try + if + let time = Unix.gettimeofday() in + (try + ignore(ProofEngineTypes.apply_tactic + (PrimitiveTactics.apply_tac + ~term:(MQueryMisc.term_of_cic_textual_parser_uri + (MQueryMisc.cic_textual_parser_uri_of_string uri))) + status); + let time1 = Unix.gettimeofday() in + prerr_endline (Printf.sprintf "%1.3f" (time1 -. time) ); + true + with ProofEngineTypes.Fail _ -> + let time1 = Unix.gettimeofday() in + prerr_endline (Printf.sprintf "%1.3f" (time1 -. time)); false) + then + uri::tl',exc + else + tl',exc + with + (ProofEngineTypes.Fail _) as e -> + let exc' = + "

    ^ Exception raised trying to apply " ^ + uri ^ ": " ^ Printexc.to_string e ^ "

    " ^ exc + in + tl',exc' + in + filter_out uris + in + let html' = + "

    Objects that can actually be applied:

    " ^ + String.concat "
    " uris' ^ exc ^ + "

    Number of false matches: " ^ + string_of_int (List.length uris - List.length uris') ^ "

    " ^ + "

    Number of good matches: " ^ + string_of_int (List.length uris') ^ "

    " + in + output_html html' ; + uris' +;; + + +(*matchConclusion modificata per evitare una doppia apply*) +let matchConclusion2 mqi_handle ?(output_html = (fun _ -> ())) ~choose_must() status = + let ((_, metasenv, _, _), metano) = status in + let (_, ey ,ty) = CicUtil.lookup_meta metano metasenv in + let conn = + match mqi_handle.MQIConn.pgc with + MQIConn.MySQL_C conn -> conn + | _ -> assert false in + let uris = Match_concl.cmatch conn ty in + (* List.iter + (fun (n,u) -> prerr_endline ((string_of_int n) ^ " " ^u)) uris; *) + (* delete all .var uris *) + let uris = List.filter UriManager.is_var uris in + (* delete all not "cic:/Coq" uris *) + (* + let uris = + (* TODO ristretto per ragioni di efficienza *) + List.filter (fun _,uri -> Pcre.pmatch ~pat:"^cic:/Coq/" uri) uris in + *) + (* concl_cost are the costants in the conclusion of the proof + while hyp_const are the constants in the hypothesis *) + let (main_concl,concl_const) = NewConstraints.mainandcons ty in + prerr_endline ("Ne sono rimasti" ^ string_of_int (List.length uris)); + let hyp t set = + match t with + Some (_,Cic.Decl t) -> (NewConstraints.StringSet.union set (NewConstraints.constants_concl t)) + | Some (_,Cic.Def (t,_)) -> (NewConstraints.StringSet.union set (NewConstraints.constants_concl t)) + | _ -> set in + let hyp_const = + List.fold_right hyp ey NewConstraints.StringSet.empty in + prerr_endline (NewConstraints.pp_StringSet (NewConstraints.StringSet.union hyp_const concl_const)); + (* uris with new constants in the proof are filtered *) + let all_const = NewConstraints.StringSet.union hyp_const concl_const in + let uris = + if (List.length uris < (Filter_auto.power 2 (List.length (NewConstraints.StringSet.elements all_const)))) + then + (prerr_endline("metodo vecchio");List.filter (Filter_auto.filter_new_constants conn all_const) uris) + else Filter_auto.filter_uris conn all_const uris main_concl in +(* + let uris = + (* ristretto all cache *) + prerr_endline "SOLO CACHE"; + List.filter + (fun uri -> CicEnvironment.in_cache (UriManager.uri_of_string uri)) uris + in + prerr_endline "HO FILTRATO2"; +*) + let uris = + List.map + (fun (n,u) -> + (n,MQueryMisc.wrong_xpointer_format_from_wrong_xpointer_format' u)) + uris in + let uris' = + let rec filter_out = + function + [] -> [] + | (m,uri)::tl -> + let tl' = filter_out tl in + try + prerr_endline ("STO APPLICANDO " ^ uri); + let res = (m, + (ProofEngineTypes.apply_tactic( PrimitiveTactics.apply_tac + ~term:(MQueryMisc.term_of_cic_textual_parser_uri + (MQueryMisc.cic_textual_parser_uri_of_string uri))) + status))::tl' in + prerr_endline ("OK");res + (* with ProofEngineTypes.Fail _ -> tl' *) + (* patch to cover CSC's exportation bug *) + with _ -> prerr_endline ("FAIL");tl' + in + prerr_endline ("Ne sono rimasti 2 " ^ string_of_int (List.length uris)); + filter_out uris + in + prerr_endline ("Ne sono rimasti 3 " ^ string_of_int (List.length uris')); + + uris' +;; + +(*funzione che sceglie il penultimo livello di profondita' dei must*) + +(* +let choose_must list_of_must only= +let n = (List.length list_of_must) - 1 in + List.nth list_of_must n +;;*) + +(* questa prende solo il main *) +let choose_must list_of_must only = + List.nth list_of_must 0 + +(* livello 1 +let choose_must list_of_must only = + try + List.nth list_of_must 1 + with _ -> + List.nth list_of_must 0 *) + +let searchTheorems mqi_handle (proof,goal) = + let subproofs = + matchConclusion2 mqi_handle ~choose_must() (proof, goal) in + let res = + List.sort + (fun (n1,(_,gl1)) (n2,(_,gl2)) -> + let l1 = List.length gl1 in + let l2 = List.length gl2 in + (* if the list of subgoals have the same lenght we use the + prefix tag, where higher tags have precedence *) + if l1 = l2 then n2 - n1 + else l1 - l2) + subproofs + in + (* now we may drop the prefix tag *) + (*let res' = + List.map snd res in*) + let order_goal_list proof goal1 goal2 = + let _,metasenv,_,_ = proof in + let (_, ey1, ty1) = CicUtil.lookup_meta goal1 metasenv in + let (_, ey2, ty2) = CicUtil.lookup_meta goal2 metasenv in +(* + prerr_endline "PRIMA DELLA PRIMA TYPE OF " ; +*) + let ty_sort1,u = (*TASSI: FIXME *) + CicTypeChecker.type_of_aux' metasenv ey1 ty1 CicUniv.empty_ugraph in +(* + prerr_endline (Printf.sprintf "PRIMA DELLA SECONDA TYPE OF %s \n### %s @@@%s " (CicMetaSubst.ppmetasenv metasenv []) (CicMetaSubst.ppcontext [] ey2) (CicMetaSubst.ppterm [] ty2)); +*) + let ty_sort2,u1 = CicTypeChecker.type_of_aux' metasenv ey2 ty2 u in +(* + prerr_endline "DOPO LA SECONDA TYPE OF " ; +*) + let b,u2 = + CicReduction.are_convertible ey1 (Cic.Sort Cic.Prop) ty_sort1 u1 in + let prop1 = if b then 0 else 1 in + let b,_ = CicReduction.are_convertible ey2 (Cic.Sort Cic.Prop) ty_sort2 u2 in + let prop2 = if b then 0 else 1 in + prop1 - prop2 in + List.map ( + fun (level,(proof,goallist)) -> + (proof, (List.stable_sort (order_goal_list proof) goallist)) + ) res +;; + diff --git a/components/tactics/tacticals.ml b/components/tactics/tacticals.ml new file mode 100644 index 000000000..f647ebcca --- /dev/null +++ b/components/tactics/tacticals.ml @@ -0,0 +1,305 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(* open CicReduction +open ProofEngineTypes +open UriManager *) + +(** DEBUGGING *) + + (** perform debugging output? *) +let debug = false +let debug_print = fun _ -> () + + (** debugging print *) +let info s = debug_print (lazy ("TACTICALS INFO: " ^ (Lazy.force s))) + +module PET = ProofEngineTypes + +let id_tac = + let id_tac (proof,goal) = + let _, metasenv, _subst, _, _, _ = proof in + let _, _, _ = CicUtil.lookup_meta goal metasenv in + (proof,[goal]) + in + PET.mk_tactic id_tac + +let fail_tac = + let fail_tac (proof,goal) = + let _, metasenv, _subst, _ , _, _ = proof in + let _, _, _ = CicUtil.lookup_meta goal metasenv in + raise (PET.Fail (lazy "fail tactical")) + in + PET.mk_tactic fail_tac + +type goal = PET.goal + + (** TODO needed until tactics start returning both opened and closed goals + * First part of the function performs a diff among goals ~before tactic + * application and ~after it. Second part will add as both opened and closed + * the goals which are returned as opened by the tactic *) +let goals_diff ~before ~after ~opened = + let sort_opened opened add = + opened @ (List.filter (fun g -> not (List.mem g opened)) add) + in + let remove = + List.fold_left + (fun remove e -> if List.mem e after then remove else e :: remove) + [] before + in + let add = + List.fold_left + (fun add e -> if List.mem e before then add else e :: add) + [] + after + in + let add, remove = (* adds goals which have been both opened _and_ closed *) + List.fold_left + (fun (add, remove) opened_goal -> + if List.mem opened_goal before + then opened_goal :: add, opened_goal :: remove + else add, remove) + (add, remove) + opened + in + sort_opened opened add, remove + +module ProofEngineStatus = +struct + module Stack = Continuationals.Stack + + (* The stack is used and saved only at the very end of the eval function; + it is read only at the beginning of the eval; + we need it just to apply several times in a row this machine to an + initial stack, i.e. to chain several applications of the machine together, + i.e. to dump and restore the state of the machine. + The stack is never used by the tactics: each tactic of type + PET.tactic ignore the stack. To make a tactic from the eval function + of a machine we apply the eval on a fresh stack (via the mk_tactic). *) + type input_status = + PET.status (* (proof, goal) *) * Stack.t + + type output_status = + (PET.proof * goal list * goal list) * Stack.t + + type tactic = PET.tactic + + (* f is an eval function of a machine; + the machine is applied to a fresh stack and the final stack is read + back to obtain the result of the tactic *) + let mk_tactic f = + PET.mk_tactic + (fun ((proof, goal) as pstatus) -> + let stack = [ [ 1, Stack.Open goal ], [], [], `NoTag ] in + let istatus = pstatus, stack in + let (proof, _, _), stack = f istatus in + let opened = Continuationals.Stack.open_goals stack in + proof, opened) + + (* it applies a tactic ignoring (and preserving) the stack *) + let apply_tactic tac ((proof, _) as pstatus, stack) = + let proof', opened = PET.apply_tactic tac pstatus in + let before = PET.goals_of_proof proof in + let after = PET.goals_of_proof proof' in + let opened_goals, closed_goals = goals_diff ~before ~after ~opened in + (proof', opened_goals, closed_goals), stack + + let goals ((_, opened, closed), _) = opened, closed + + (* Done only at the beginning of the eval of the machine *) + let get_stack = snd + (* Done only at the end of the eval of the machine *) + let set_stack stack (opstatus, _) = opstatus, stack + + let inject ((proof, _), stack) = ((proof, [], []), stack) + let focus goal ((proof, _, _), stack) = (proof, goal), stack +end + +module S = ProofEngineStatus +module C = Continuationals.Make (S) + +type tactic = S.tactic + +let fold_eval status ts = + let istatus = + List.fold_left (fun istatus t -> S.focus ~-1 (C.eval t istatus)) status ts + in + S.inject istatus + +(* Tacticals implemented on top of tynycals *) + +let thens ~start ~continuations = + S.mk_tactic + (fun istatus -> + fold_eval istatus + ([ C.Tactical (C.Tactic start); C.Branch ] + @ (HExtlib.list_concat ~sep:[ C.Shift ] + (List.map (fun t -> [ C.Tactical (C.Tactic t) ]) continuations)) + @ [ C.Merge ])) + +let then_ ~start ~continuation = + S.mk_tactic + (fun istatus -> + let ostatus = C.eval (C.Tactical (C.Tactic start)) istatus in + let opened,closed = S.goals ostatus in + match opened with + [] -> ostatus + | _ -> + fold_eval (S.focus ~-1 ostatus) + [ C.Semicolon; + C.Tactical (C.Tactic continuation) ]) + +let seq ~tactics = + S.mk_tactic + (fun istatus -> + fold_eval istatus + (HExtlib.list_concat ~sep:[ C.Semicolon ] + (List.map (fun t -> [ C.Tactical (C.Tactic t) ]) tactics))) + +(* Tacticals that cannot be implemented on top of tynycals *) + +let const_tac res = PET.mk_tactic (fun _ -> res) + +let if_ ~start ~continuation ~fail = + let if_ status = + let xoutput = + try + let result = PET.apply_tactic start status in + info (lazy ("Tacticals.if_: succedeed!!!")); + Some result + with PET.Fail _ -> None + in + let tactic = match xoutput with + | Some res -> then_ ~start:(const_tac res) ~continuation + | None -> fail + in + PET.apply_tactic tactic status + in + PET.mk_tactic if_ + +let ifs ~start ~continuations ~fail = + let ifs status = + let xoutput = + try + let result = PET.apply_tactic start status in + info (lazy ("Tacticals.ifs: succedeed!!!")); + Some result + with PET.Fail _ -> None + in + let tactic = match xoutput with + | Some res -> thens ~start:(const_tac res) ~continuations + | None -> fail + in + PET.apply_tactic tactic status + in + PET.mk_tactic ifs + +let first ~tactics = + let rec first ~(tactics: tactic list) status = + info (lazy "in Tacticals.first"); + match tactics with + [] -> raise (PET.Fail (lazy "first: no tactics left")) + | tac::tactics -> + try + let res = PET.apply_tactic tac status in + info (lazy ("Tacticals.first: succedeed!!!")); + res + with + PET.Fail _ -> first ~tactics status + in + PET.mk_tactic (first ~tactics) + +let rec do_tactic ~n ~tactic = + PET.mk_tactic + (function status -> + if n = 0 then + PET.apply_tactic id_tac status + else + PET.apply_tactic + (then_ ~start:tactic ~continuation:(do_tactic ~n:(n-1) ~tactic)) + status) + +(* This applies tactic and catches its possible failure *) +let try_tactic ~tactic = + let try_tactic status = + try + PET.apply_tactic tactic status + with (PET.Fail _) as e -> + info (lazy ( + "Tacticals.try_tactic failed with exn: " ^ Printexc.to_string e)); + PET.apply_tactic id_tac status + in + PET.mk_tactic try_tactic + +let rec repeat_tactic ~tactic = + ProofEngineTypes.mk_tactic + (fun status -> + ProofEngineTypes.apply_tactic + (then_ ~start:tactic + ~continuation:(try_tactic (repeat_tactic ~tactic))) status) + +(* This tries tactics until one of them solves the goal *) +let solve_tactics ~tactics = + let rec solve_tactics ~(tactics: tactic list) status = + info (lazy "in Tacticals.solve_tactics"); + match tactics with + | currenttactic::moretactics -> + (try + let (proof, opened) as output_status = + PET.apply_tactic currenttactic status + in + match opened with + | [] -> info (lazy ("Tacticals.solve_tactics: solved the goal!!!")); + output_status + | _ -> info (lazy ("Tacticals.solve_tactics: try the next tactic")); + raise (PET.Fail (lazy "Goal not solved")) + with (PET.Fail _) as e -> + info (lazy ( + "Tacticals.solve_tactics: current tactic failed with exn: " + ^ Printexc.to_string e)); + solve_tactics ~tactics:moretactics status) + | [] -> + raise (PET.Fail + (lazy "solve_tactics cannot solve the goal")) + in + PET.mk_tactic (solve_tactics ~tactics) + +let progress_tactic ~tactic = + let msg = lazy "Failed to progress" in + let progress_tactic (((_,metasenv,_subst,_,_,_),_) as istatus) = + let ((_,metasenv',_subst,_,_,_),_) as ostatus = + PET.apply_tactic tactic istatus + in + (*CSC: Warning + If just the index of some metas changes the tactic is recognized + as a progressing one. This is wrong. *) + if metasenv' = metasenv then + raise (PET.Fail msg) + else + ostatus + in + PET.mk_tactic progress_tactic diff --git a/components/tactics/tacticals.mli b/components/tactics/tacticals.mli new file mode 100644 index 000000000..44a6ab4d9 --- /dev/null +++ b/components/tactics/tacticals.mli @@ -0,0 +1,48 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type tactic = ProofEngineTypes.tactic + +val id_tac : tactic +val fail_tac: tactic + +val first: tactics: tactic list -> tactic +val thens: start: tactic -> continuations: tactic list -> tactic +val then_: start: tactic -> continuation: tactic -> tactic +val ifs: start: tactic -> continuations: tactic list -> fail: tactic -> tactic +val if_: start: tactic -> continuation: tactic -> fail: tactic -> tactic +val seq: tactics: tactic list -> tactic (** "folding" of then_ *) +val repeat_tactic: tactic: tactic -> tactic +val do_tactic: n: int -> tactic: tactic -> tactic +val try_tactic: tactic: tactic -> tactic +val solve_tactics: tactics: tactic list -> tactic +val progress_tactic: tactic: tactic -> tactic + +(* TODO temporary *) +val goals_diff: + before:ProofEngineTypes.goal list -> + after:ProofEngineTypes.goal list -> + opened:ProofEngineTypes.goal list -> + ProofEngineTypes.goal list * ProofEngineTypes.goal list diff --git a/components/tactics/tactics.ml b/components/tactics/tactics.ml new file mode 100644 index 000000000..aa2e2bf4f --- /dev/null +++ b/components/tactics/tactics.ml @@ -0,0 +1,77 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +let absurd = NegationTactics.absurd_tac +let apply = PrimitiveTactics.apply_tac +let applyS = Auto.applyS_tac +let assumption = VariousTactics.assumption_tac +let auto = Auto.auto_tac +let cases_intros = PrimitiveTactics.cases_intros_tac +let change = ReductionTactics.change_tac +let clear = ProofEngineStructuralRules.clear +let clearbody = ProofEngineStructuralRules.clearbody +let constructor = IntroductionTactics.constructor_tac +let contradiction = NegationTactics.contradiction_tac +let cut = PrimitiveTactics.cut_tac +let decompose = EliminationTactics.decompose_tac +let demodulate = Auto.demodulate_tac +let destruct = DestructTactic.destruct_tac +let elim_intros = PrimitiveTactics.elim_intros_tac +let elim_intros_simpl = PrimitiveTactics.elim_intros_simpl_tac +let elim_type = EliminationTactics.elim_type_tac +let exact = PrimitiveTactics.exact_tac +let exists = IntroductionTactics.exists_tac +let fail = Tacticals.fail_tac +let fold = ReductionTactics.fold_tac +let fourier = FourierR.fourier_tac +let fwd_simpl = FwdSimplTactic.fwd_simpl_tac +let generalize = VariousTactics.generalize_tac +let id = Tacticals.id_tac +let intros = PrimitiveTactics.intros_tac +let inversion = Inversion.inversion_tac +let lapply = FwdSimplTactic.lapply_tac +let left = IntroductionTactics.left_tac +let letin = PrimitiveTactics.letin_tac +let normalize = ReductionTactics.normalize_tac +let reduce = ReductionTactics.reduce_tac +let reflexivity = Setoids.setoid_reflexivity_tac +let replace = EqualityTactics.replace_tac +let rewrite = EqualityTactics.rewrite_tac +let rewrite_simpl = EqualityTactics.rewrite_simpl_tac +let right = IntroductionTactics.right_tac +let ring = Ring.ring_tac +let simpl = ReductionTactics.simpl_tac +let solve_rewrite = Auto.solve_rewrite_tac +let split = IntroductionTactics.split_tac +let symmetry = EqualityTactics.symmetry_tac +let transitivity = EqualityTactics.transitivity_tac +let unfold = ReductionTactics.unfold_tac +let whd = ReductionTactics.whd_tac +let compose = Compose.compose_tac + +(* keep linked *) +let _ = CloseCoercionGraph.close_coercion_graph;; diff --git a/components/tactics/tactics.mli b/components/tactics/tactics.mli new file mode 100644 index 000000000..8c97039fb --- /dev/null +++ b/components/tactics/tactics.mli @@ -0,0 +1,110 @@ +(* GENERATED FILE, DO NOT EDIT. STAMP:Wed Nov 14 12:07:32 CET 2007 *) +val absurd : term:Cic.term -> ProofEngineTypes.tactic +val apply : term:Cic.term -> ProofEngineTypes.tactic +val applyS : + dbd:HSql.dbd -> + term:Cic.term -> + params:(string * string) list -> + universe:Universe.universe -> ProofEngineTypes.tactic +val assumption : ProofEngineTypes.tactic +val auto : + dbd:HSql.dbd -> + params:(string * string) list -> + universe:Universe.universe -> ProofEngineTypes.tactic +val cases_intros : + ?howmany:int -> + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + Cic.term -> ProofEngineTypes.tactic +val change : + ?with_cast:bool -> + pattern:ProofEngineTypes.lazy_pattern -> + Cic.lazy_term -> ProofEngineTypes.tactic +val clear : hyps:string list -> ProofEngineTypes.tactic +val clearbody : hyp:string -> ProofEngineTypes.tactic +val constructor : n:int -> ProofEngineTypes.tactic +val contradiction : ProofEngineTypes.tactic +val cut : + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + Cic.term -> ProofEngineTypes.tactic +val decompose : + ?sorts:string list -> + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + unit -> ProofEngineTypes.tactic +val demodulate : + dbd:HSql.dbd -> universe:Universe.universe -> ProofEngineTypes.tactic +val destruct : Cic.term list option -> ProofEngineTypes.tactic +val elim_intros : + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ?depth:int -> + ?using:Cic.term -> + ?pattern:ProofEngineTypes.lazy_pattern -> + Cic.term -> ProofEngineTypes.tactic +val elim_intros_simpl : + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ?depth:int -> + ?using:Cic.term -> + ?pattern:ProofEngineTypes.lazy_pattern -> + Cic.term -> ProofEngineTypes.tactic +val elim_type : + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ?depth:int -> ?using:Cic.term -> Cic.term -> ProofEngineTypes.tactic +val exact : term:Cic.term -> ProofEngineTypes.tactic +val exists : ProofEngineTypes.tactic +val fail : Tacticals.tactic +val fold : + reduction:ProofEngineTypes.lazy_reduction -> + term:Cic.lazy_term -> + pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val fourier : ProofEngineTypes.tactic +val fwd_simpl : + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + dbd:HSql.dbd -> string -> ProofEngineTypes.tactic +val generalize : + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val id : Tacticals.tactic +val intros : + ?howmany:int -> + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + unit -> ProofEngineTypes.tactic +val inversion : term:Cic.term -> ProofEngineTypes.tactic +val lapply : + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ?linear:bool -> + ?how_many:int -> + ?to_what:Cic.term list -> Cic.term -> ProofEngineTypes.tactic +val left : ProofEngineTypes.tactic +val letin : + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + Cic.term -> ProofEngineTypes.tactic +val normalize : + pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val reduce : pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val reflexivity : ProofEngineTypes.tactic +val replace : + pattern:ProofEngineTypes.lazy_pattern -> + with_what:Cic.lazy_term -> ProofEngineTypes.tactic +val rewrite : + direction:[ `LeftToRight | `RightToLeft ] -> + pattern:ProofEngineTypes.lazy_pattern -> + Cic.term -> string list -> ProofEngineTypes.tactic +val rewrite_simpl : + direction:[ `LeftToRight | `RightToLeft ] -> + pattern:ProofEngineTypes.lazy_pattern -> + Cic.term -> string list -> ProofEngineTypes.tactic +val right : ProofEngineTypes.tactic +val ring : ProofEngineTypes.tactic +val simpl : pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val solve_rewrite : + universe:Universe.universe -> ?steps:int -> unit -> ProofEngineTypes.tactic +val split : ProofEngineTypes.tactic +val symmetry : ProofEngineTypes.tactic +val transitivity : term:Cic.term -> ProofEngineTypes.tactic +val unfold : + Cic.lazy_term option -> + pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val whd : pattern:ProofEngineTypes.lazy_pattern -> ProofEngineTypes.tactic +val compose : + ?howmany:int -> + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + int -> Cic.term -> Cic.term option -> ProofEngineTypes.tactic diff --git a/components/tactics/universe.ml b/components/tactics/universe.ml new file mode 100644 index 000000000..99041ed1b --- /dev/null +++ b/components/tactics/universe.ml @@ -0,0 +1,167 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +module Codomain = struct + type t = Cic.term + let compare = Pervasives.compare +end +module S = Set.Make(Codomain) +module TI = Discrimination_tree.DiscriminationTreeIndexing(S) +type universe = TI.t + +let empty = TI.empty +;; + +let get_candidates univ ty = + S.elements (TI.retrieve_unifiables univ ty) +;; + +let rec unfold context = function + | Cic.Prod(name,s,t) -> + let t' = unfold ((Some (name,Cic.Decl s))::context) t in + Cic.Prod(name,s,t') + | t -> ProofEngineReduction.unfold context t + +let rec collapse_head_metas t = + match t with + | Cic.Appl([]) -> assert false + | Cic.Appl(a::l) -> + let a' = collapse_head_metas a in + (match a' with + | Cic.Meta(n,m) -> Cic.Meta(n,m) + | t -> + let l' = List.map collapse_head_metas l in + Cic.Appl(t::l')) + | Cic.Rel _ + | Cic.Var _ + | Cic.Meta _ + | Cic.Sort _ + | Cic.Implicit _ + | Cic.Const _ + | Cic.MutInd _ + | Cic.MutConstruct _ -> t + | Cic.LetIn _ + | Cic.Lambda _ + | Cic.Prod _ + | Cic.Cast _ + | Cic.MutCase _ + | Cic.Fix _ + | Cic.CoFix _ -> Cic.Meta(-1,[]) +;; + +let rec dummies_of_coercions = + function + | Cic.Appl (c::l) when CoercDb.is_a_coercion' c -> + Cic.Meta (-1,[]) + | Cic.Appl l -> + let l' = List.map dummies_of_coercions l in Cic.Appl l' + | Cic.Lambda(n,s,t) -> + let s' = dummies_of_coercions s in + let t' = dummies_of_coercions t in + Cic.Lambda (n,s',t') + | Cic.Prod(n,s,t) -> + let s' = dummies_of_coercions s in + let t' = dummies_of_coercions t in + Cic.Prod (n,s',t') + | Cic.LetIn(n,s,t) -> + let s' = dummies_of_coercions s in + let t' = dummies_of_coercions t in + Cic.LetIn (n,s',t') + | Cic.MutCase _ -> Cic.Meta (-1,[]) + | t -> t +;; + + +let rec head remove_coercions t = + let clean_up t = + if remove_coercions then dummies_of_coercions t + else t in + let rec aux = function + | Cic.Prod(_,_,t) -> + CicSubstitution.subst (Cic.Meta (-1,[])) (aux t) + | t -> t + in collapse_head_metas (clean_up (aux t)) +;; + + +let index univ key term = + (* flexible terms are not indexed *) + if key = Cic.Meta(-1,[]) then univ + else + ((*prerr_endline("ADD: "^CicPp.ppterm key^" |-> "^CicPp.ppterm term);*) + TI.index univ key term) +;; + +let keys context ty = + try + [head true ty; head true (unfold context ty)] + with ProofEngineTypes.Fail _ -> [head true ty] + +let key term = head false term + +let index_term_and_unfolded_term univ context t ty = + let key = head true ty in + let univ = index univ key t in + try + let key = head true (unfold context ty) in + index univ key t + with ProofEngineTypes.Fail _ -> univ +;; + +let index_local_term univ context t ty = + let key = head true ty in + let univ = index univ key t in + let key1 = head false ty in + let univ = + if key<>key1 then index univ key1 t else univ in + try + let key = head true (unfold context ty) in + index univ key t + with ProofEngineTypes.Fail _ -> univ +;; + + +let index_list univ context terms_and_types = + List.fold_left + (fun acc (term,ty) -> + index_term_and_unfolded_term acc context term ty) + univ terms_and_types + +;; + +let remove univ context term ty = + let key = head true ty in + let univ = TI.remove_index univ key term in + try + let key = head true (unfold context ty) in + TI.remove_index univ key term + with ProofEngineTypes.Fail _ -> univ + +let remove_uri univ uri = + let term = CicUtil.term_of_uri uri in + let ty,_ = CicTypeChecker.type_of_aux' [] [] term CicUniv.empty_ugraph in + remove univ [] term ty + + diff --git a/components/tactics/universe.mli b/components/tactics/universe.mli new file mode 100644 index 000000000..ee5dc489a --- /dev/null +++ b/components/tactics/universe.mli @@ -0,0 +1,45 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type universe +val empty : universe +val get_candidates: universe -> Cic.term -> Cic.term list +val index: + universe -> + Cic.term -> (* key *) + Cic.term -> (* value *) + universe +val keys: Cic.context -> Cic.term -> Cic.term list +val key: Cic.term -> Cic.term +val index_term_and_unfolded_term: + universe -> Cic.context -> Cic.term -> Cic.term -> universe +val index_local_term: + universe -> Cic.context -> Cic.term -> Cic.term -> universe +val index_list: + universe -> Cic.context -> (Cic.term*Cic.term) list -> universe +val remove: + universe -> Cic.context -> Cic.term -> Cic.term -> universe +val remove_uri: + universe -> UriManager.uri -> universe diff --git a/components/tactics/variousTactics.ml b/components/tactics/variousTactics.ml new file mode 100644 index 000000000..3a3db7db4 --- /dev/null +++ b/components/tactics/variousTactics.ml @@ -0,0 +1,191 @@ +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + + +(* TODO se ce n'e' piu' di una, prende la prima che trova... sarebbe meglio +chiedere: find dovrebbe restituire una lista di hyp (?) da passare all'utonto con una +funzione di callback che restituisce la (sola) hyp da applicare *) + +let assumption_tac = + let module PET = ProofEngineTypes in + let assumption_tac status = + let (proof, goal) = status in + let module C = Cic in + let module R = CicReduction in + let module S = CicSubstitution in + let module PT = PrimitiveTactics in + let _,metasenv,_subst,_,_, _ = proof in + let _,context,ty = CicUtil.lookup_meta goal metasenv in + let rec find n = function + hd::tl -> + (match hd with + (Some (_, C.Decl t)) when + fst (R.are_convertible context (S.lift n t) ty + CicUniv.empty_ugraph) -> n + | (Some (_, C.Def (_,Some ty'))) when + fst (R.are_convertible context (S.lift n ty') ty + CicUniv.empty_ugraph) -> n + | (Some (_, C.Def (t,None))) -> + let ty_t, u = (* TASSI: FIXME *) + CicTypeChecker.type_of_aux' metasenv context (S.lift n t) + CicUniv.empty_ugraph in + let b,_ = R.are_convertible context ty_t ty u in + if b then n else find (n+1) tl + | _ -> find (n+1) tl + ) + | [] -> raise (PET.Fail (lazy "Assumption: No such assumption")) + in PET.apply_tactic (PT.apply_tac ~term:(C.Rel (find 1 context))) status + in + PET.mk_tactic assumption_tac +;; + +(* ANCORA DA DEBUGGARE *) + +exception UnableToDetectTheTermThatMustBeGeneralizedYouMustGiveItExplicitly;; +exception TheSelectedTermsMustLiveInTheGoalContext +exception AllSelectedTermsMustBeConvertible;; +exception GeneralizationInHypothesesNotImplementedYet;; + +let generalize_tac + ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[]) + pattern + = + let module PET = ProofEngineTypes in + let generalize_tac mk_fresh_name_callback + ~pattern:(term,hyps_pat,concl_pat) status + = + if hyps_pat <> [] then raise GeneralizationInHypothesesNotImplementedYet; + let (proof, goal) = status in + let module C = Cic in + let module P = PrimitiveTactics in + let module T = Tacticals in + let uri,metasenv,_subst,pbo,pty, attrs = proof in + let (_,context,ty) as conjecture = CicUtil.lookup_meta goal metasenv in + let subst,metasenv,u,selected_hyps,terms_with_context = + ProofEngineHelpers.select ~metasenv ~ugraph:CicUniv.empty_ugraph + ~conjecture ~pattern in + let context = CicMetaSubst.apply_subst_context subst context in + let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in + let pbo = CicMetaSubst.apply_subst subst pbo in + let pty = CicMetaSubst.apply_subst subst pty in + let term = + match term with + None -> None + | Some term -> + Some (fun context metasenv ugraph -> + let term, metasenv, ugraph = term context metasenv ugraph in + CicMetaSubst.apply_subst subst term, + CicMetaSubst.apply_subst_metasenv subst metasenv, + ugraph) + in + let u,typ,term, metasenv' = + let context_of_t, (t, metasenv, u) = + match terms_with_context, term with + [], None -> + raise + UnableToDetectTheTermThatMustBeGeneralizedYouMustGiveItExplicitly + | [], Some t -> context, t context metasenv u + | (context_of_t, _)::_, Some t -> + context_of_t, t context_of_t metasenv u + | (context_of_t, t)::_, None -> context_of_t, (t, metasenv, u) + in + let t,subst,metasenv' = + try + CicMetaSubst.delift_rels [] metasenv + (List.length context_of_t - List.length context) t + with + CicMetaSubst.DeliftingARelWouldCaptureAFreeVariable -> + raise TheSelectedTermsMustLiveInTheGoalContext + in + (*CSC: I am not sure about the following two assertions; + maybe I need to propagate the new subst and metasenv *) + assert (subst = []); + assert (metasenv' = metasenv); + let typ,u = CicTypeChecker.type_of_aux' ~subst metasenv context t u in + u,typ,t,metasenv + in + (* We need to check: + 1. whether they live in the context of the goal; + if they do they are also well-typed since they are closed subterms + of a well-typed term in the well-typed context of the well-typed + term + 2. whether they are convertible + *) + ignore ( + List.fold_left + (fun u (context_of_t,t) -> + (* 1 *) + let t,subst,metasenv'' = + try + CicMetaSubst.delift_rels [] metasenv' + (List.length context_of_t - List.length context) t + with + CicMetaSubst.DeliftingARelWouldCaptureAFreeVariable -> + raise TheSelectedTermsMustLiveInTheGoalContext in + (*CSC: I am not sure about the following two assertions; + maybe I need to propagate the new subst and metasenv *) + assert (subst = []); + assert (metasenv'' = metasenv'); + (* 2 *) + let b,u1 = CicReduction.are_convertible ~subst context term t u in + if not b then + raise AllSelectedTermsMustBeConvertible + else + u1 + ) u terms_with_context) ; + let status = (uri,metasenv',_subst,pbo,pty, attrs),goal in + let proof,goals = + PET.apply_tactic + (T.thens + ~start: + (P.cut_tac + (C.Prod( + (mk_fresh_name_callback metasenv context C.Anonymous ~typ:typ), + typ, + (ProofEngineReduction.replace_lifting_csc 1 + ~equality:(==) + ~what:(List.map snd terms_with_context) + ~with_what:(List.map (function _ -> C.Rel 1) terms_with_context) + ~where:ty) + ))) + ~continuations: + [(P.apply_tac ~term:(C.Appl [C.Rel 1; CicSubstitution.lift 1 term])) ; + T.id_tac]) + status + in + let _,metasenv'',_subst,_,_, _ = proof in + (* CSC: the following is just a bad approximation since a meta + can be closed and then re-opened! *) + (proof, + goals @ + (List.filter + (fun j -> List.exists (fun (i,_,_) -> i = j) metasenv'') + (ProofEngineHelpers.compare_metasenvs ~oldmetasenv:metasenv + ~newmetasenv:metasenv'))) + in + PET.mk_tactic (generalize_tac mk_fresh_name_callback ~pattern) +;; diff --git a/components/tactics/variousTactics.mli b/components/tactics/variousTactics.mli new file mode 100644 index 000000000..35576326e --- /dev/null +++ b/components/tactics/variousTactics.mli @@ -0,0 +1,35 @@ + +(* Copyright (C) 2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception AllSelectedTermsMustBeConvertible;; + +val assumption_tac: ProofEngineTypes.tactic + +val generalize_tac: + ?mk_fresh_name_callback:ProofEngineTypes.mk_fresh_name_type -> + ProofEngineTypes.lazy_pattern -> + ProofEngineTypes.tactic + diff --git a/components/thread/.depend b/components/thread/.depend new file mode 100644 index 000000000..7759190c6 --- /dev/null +++ b/components/thread/.depend @@ -0,0 +1,4 @@ +threadSafe.cmo: threadSafe.cmi +threadSafe.cmx: threadSafe.cmi +extThread.cmo: extThread.cmi +extThread.cmx: extThread.cmi diff --git a/components/thread/.depend.opt b/components/thread/.depend.opt new file mode 100644 index 000000000..7759190c6 --- /dev/null +++ b/components/thread/.depend.opt @@ -0,0 +1,4 @@ +threadSafe.cmo: threadSafe.cmi +threadSafe.cmx: threadSafe.cmi +extThread.cmo: extThread.cmi +extThread.cmx: extThread.cmi diff --git a/components/thread/Makefile b/components/thread/Makefile new file mode 100644 index 000000000..46f009e07 --- /dev/null +++ b/components/thread/Makefile @@ -0,0 +1,31 @@ + +PACKAGE = thread +INTERFACE_FILES = threadSafe.mli extThread.mli +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) + +all: thread_fake.cma +opt: thread_fake.cmxa + +include ../../Makefile.defs +include ../Makefile.common + +fake/threadSafe.cmi: fake/threadSafe.mli + @echo " OCAMLC $<" + @cd fake/ \ + && ocamlfind ocamlc -c threadSafe.mli +thread_fake.cma: fake/threadSafe.cmi + @echo " OCAMLC -a $@" + @cd fake/ \ + && ocamlfind ocamlc -a -o $@ threadSafe.ml \ + && cp $@ ../ +thread_fake.cmxa: fake/threadSafe.cmi + @echo " OCAMLOPT -a $@" + @cd fake/ \ + && ocamlfind opt -a -o $@ threadSafe.ml \ + && cp $@ ../ + +clean: clean_fake +clean_fake: + rm -f fake/*.cm[aiox] fake/*.cmxa fake/*.[ao] + rm -f thread_fake.cma thread_fake.cmxa + diff --git a/components/thread/extThread.ml b/components/thread/extThread.ml new file mode 100644 index 000000000..d59cccd26 --- /dev/null +++ b/components/thread/extThread.ml @@ -0,0 +1,110 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let debug = true +let debug_print s = if debug then prerr_endline (Lazy.force s) + +exception Can_t_kill of Thread.t * string (* thread, reason *) +exception Thread_not_found of Thread.t + +module OrderedPid = + struct + type t = int + let compare = Pervasives.compare + end +module PidSet = Set.Make (OrderedPid) + + (* perform an action inside a critical section controlled by given mutex *) +let do_critical mutex = + fun action -> + try + Mutex.lock mutex; + let res = Lazy.force action in + Mutex.unlock mutex; + res + with e -> Mutex.unlock mutex; raise e + +let kill_signal = Sys.sigusr2 (* signal used to kill children *) +let chan = Event.new_channel () (* communication channel between threads *) +let creation_mutex = Mutex.create () +let dead_threads_walking = ref PidSet.empty +let pids: (Thread.t, int) Hashtbl.t = Hashtbl.create 17 + + (* given a thread body (i.e. first argument of a Thread.create invocation) + return a new thread body which unblock the kill signal and send its pid to + parent over "chan" *) +let wrap_thread body = + fun arg -> + ignore (Unix.sigprocmask Unix.SIG_UNBLOCK [ kill_signal ]); + Event.sync (Event.send chan (Unix.getpid ())); + body arg + +(* +(* FAKE IMPLEMENTATION *) +let create = Thread.create +let kill _ = () +*) + +let create body arg = + do_critical creation_mutex (lazy ( + let thread_t = Thread.create (wrap_thread body) arg in + let pid = Event.sync (Event.receive chan) in + Hashtbl.add pids thread_t pid; + thread_t + )) + +let kill thread_t = + try + let pid = + try + Hashtbl.find pids thread_t + with Not_found -> raise (Thread_not_found thread_t) + in + dead_threads_walking := PidSet.add pid !dead_threads_walking; + Unix.kill pid kill_signal + with e -> raise (Can_t_kill (thread_t, Printexc.to_string e)) + + (* "kill_signal" handler, check if current process must die, if this is the + case exits with Thread.exit *) +let _ = + ignore (Sys.signal kill_signal (Sys.Signal_handle + (fun signal -> + let myself = Unix.getpid () in + match signal with + | sg when (sg = kill_signal) && + (PidSet.mem myself !dead_threads_walking) -> + dead_threads_walking := PidSet.remove myself !dead_threads_walking; + debug_print (lazy "AYEEEEH!"); + Thread.exit () + | _ -> ()))) + + (* block kill signal in main process *) +let _ = ignore (Unix.sigprocmask Unix.SIG_BLOCK [ kill_signal ]) + diff --git a/components/thread/extThread.mli b/components/thread/extThread.mli new file mode 100644 index 000000000..5fb3bd487 --- /dev/null +++ b/components/thread/extThread.mli @@ -0,0 +1,35 @@ +(* + * Copyright (C) 2003: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 Extended Thread module with killing capabilities} *) + +exception Can_t_kill of Thread.t * string + +val create: ('a -> 'b) -> 'a -> Thread.t +val kill: Thread.t -> unit + diff --git a/components/thread/fake/threadSafe.ml b/components/thread/fake/threadSafe.ml new file mode 100644 index 000000000..b2c427710 --- /dev/null +++ b/components/thread/fake/threadSafe.ml @@ -0,0 +1,35 @@ +(* + * Copyright (C) 2003-2005: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +class threadSafe = + object + method private doCritical: 'a. 'a lazy_t -> 'a = fun a -> Lazy.force a + method private doReader: 'a. 'a lazy_t -> 'a = fun a -> Lazy.force a + method private doWriter: 'a. 'a lazy_t -> 'a = fun a -> Lazy.force a + end + diff --git a/components/thread/fake/threadSafe.mli b/components/thread/fake/threadSafe.mli new file mode 100644 index 000000000..78166abcc --- /dev/null +++ b/components/thread/fake/threadSafe.mli @@ -0,0 +1,44 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +class threadSafe: + object + + (** execute 'action' in mutual exclusion between all other threads *) + method private doCritical: 'a. 'a lazy_t -> 'a + + (** execute 'action' acting as a 'reader' i.e.: multiple readers can act + at the same time but no writer can act until no readers are acting *) + method private doReader: 'a. 'a lazy_t -> 'a + + (** execute 'action' acting as a 'writer' i.e.: when a writer is acting, + no readers or writer can act, beware that writers can starve *) + method private doWriter: 'a. 'a lazy_t -> 'a + + end + diff --git a/components/thread/threadSafe.ml b/components/thread/threadSafe.ml new file mode 100644 index 000000000..afe953370 --- /dev/null +++ b/components/thread/threadSafe.ml @@ -0,0 +1,100 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let debug = false +let debug_print s = if debug then prerr_endline (Lazy.force s) + +class threadSafe = + object (self) + + val mutex = Mutex.create () + + (** condition variable: 'no readers is currently reading' *) + val noReaders = Condition.create () + + (** readers count *) + val mutable readersCount = 0 + + method private incrReadersCount = (* internal, not exported *) + self#doCritical (lazy ( + readersCount <- readersCount + 1 + )) + + method private decrReadersCount = (* internal, not exported *) + self#doCritical (lazy ( + if readersCount > 0 then readersCount <- readersCount - 1; + )) + + method private signalNoReaders = (* internal, not exported *) + self#doCritical (lazy ( + if readersCount = 0 then Condition.signal noReaders + )) + + method private doCritical: 'a. 'a lazy_t -> 'a = + fun action -> + debug_print (lazy ""); + (try + Mutex.lock mutex; + let res = Lazy.force action in + Mutex.unlock mutex; + debug_print (lazy ""); + res + with e -> + Mutex.unlock mutex; + raise e); + + method private doReader: 'a. 'a lazy_t -> 'a = + fun action -> + debug_print (lazy ""); + let cleanup () = + self#decrReadersCount; + self#signalNoReaders + in + self#incrReadersCount; + let res = (try Lazy.force action with e -> (cleanup (); raise e)) in + cleanup (); + debug_print (lazy ""); + res + + (* TODO may starve!!!! is what we want or not? *) + method private doWriter: 'a. 'a lazy_t -> 'a = + fun action -> + debug_print (lazy ""); + self#doCritical (lazy ( + while readersCount > 0 do + Condition.wait noReaders mutex + done; + let res = Lazy.force action in + debug_print (lazy ""); + res + )) + + end + diff --git a/components/thread/threadSafe.mli b/components/thread/threadSafe.mli new file mode 100644 index 000000000..78166abcc --- /dev/null +++ b/components/thread/threadSafe.mli @@ -0,0 +1,44 @@ +(* + * Copyright (C) 2003-2004: + * Stefano Zacchiroli + * for the HELM Team http://helm.cs.unibo.it/ + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +class threadSafe: + object + + (** execute 'action' in mutual exclusion between all other threads *) + method private doCritical: 'a. 'a lazy_t -> 'a + + (** execute 'action' acting as a 'reader' i.e.: multiple readers can act + at the same time but no writer can act until no readers are acting *) + method private doReader: 'a. 'a lazy_t -> 'a + + (** execute 'action' acting as a 'writer' i.e.: when a writer is acting, + no readers or writer can act, beware that writers can starve *) + method private doWriter: 'a. 'a lazy_t -> 'a + + end + diff --git a/components/tptp_grafite/.depend b/components/tptp_grafite/.depend new file mode 100644 index 000000000..bc310327f --- /dev/null +++ b/components/tptp_grafite/.depend @@ -0,0 +1,7 @@ +parser.cmi: ast.cmo +lexer.cmo: parser.cmi +lexer.cmx: parser.cmx +parser.cmo: ast.cmo parser.cmi +parser.cmx: ast.cmx parser.cmi +tptp2grafite.cmo: parser.cmi lexer.cmo ast.cmo tptp2grafite.cmi +tptp2grafite.cmx: parser.cmx lexer.cmx ast.cmx tptp2grafite.cmi diff --git a/components/tptp_grafite/.depend.opt b/components/tptp_grafite/.depend.opt new file mode 100644 index 000000000..c74300207 --- /dev/null +++ b/components/tptp_grafite/.depend.opt @@ -0,0 +1,7 @@ +parser.cmi: ast.cmx +lexer.cmo: parser.cmi +lexer.cmx: parser.cmx +parser.cmo: ast.cmx parser.cmi +parser.cmx: ast.cmx parser.cmi +tptp2grafite.cmo: parser.cmi lexer.cmx ast.cmx tptp2grafite.cmi +tptp2grafite.cmx: parser.cmx lexer.cmx ast.cmx tptp2grafite.cmi diff --git a/components/tptp_grafite/Makefile b/components/tptp_grafite/Makefile new file mode 100644 index 000000000..4e4d31677 --- /dev/null +++ b/components/tptp_grafite/Makefile @@ -0,0 +1,50 @@ +PACKAGE = tptp_grafite +PREDICATES = + +INTERFACE_FILES= parser.mli tptp2grafite.mli + +IMPLEMENTATION_FILES = ast.ml lexer.ml $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = + +TPTPDIR=/home/$(USER)/TPTP-v3.1.1/ + +all: tptp2grafite +clean: clean_tests + +clean_tests: + rm -f tptp2grafite + +parser.mli parser.ml:parser.mly + ocamlyacc parser.mly +lexer.ml: + ocamllex lexer.mll + +LOCAL_LINKOPTS = -package helm-$(PACKAGE) -linkpkg +tptp2grafite: main.ml tptp_grafite.cma + @echo " OCAMLC $<" + @$(OCAMLC) $(LOCAL_LINKOPTS) -o $@ $< + +test: tptp2grafite + +testall: tptp2grafite + for X in `cat unit_equality_problems`; do\ + cat $(TPTPDIR)/$$X | ./tptp2grafite || echo ERROR PARSING $$X;\ + done + +generate-%: + for X in `cat $*`; do\ + ./tptp2grafite -tptppath $(TPTPDIR) $$X.p \ + > ../../matita/tests/TPTP/$$X.ma || echo Failed: $$X; \ + done + +parse-%: + for X in `cat $*`; do\ + echo "Parsing $$X"; \ + ./tptp2grafite -tptppath $(TPTPDIR) $$X.p \ + > /dev/null || echo Failed: $$X; \ + done + +include ../../Makefile.defs +include ../Makefile.common + diff --git a/components/tptp_grafite/ast.ml b/components/tptp_grafite/ast.ml new file mode 100644 index 000000000..b8f855dd1 --- /dev/null +++ b/components/tptp_grafite/ast.ml @@ -0,0 +1,31 @@ +type kinds_of_formulae = + | Axiom | Hypothesis | Definition | Lemma | Theorem | Conjecture + | Lemma_conjecture | Negated_conjecture | Plain | Unknown + +type source = NoSource + +type info = NoInfo + +type term = + | Variable of string + | Constant of string + | Function of string * term list + +type atom = + | Proposition of string + | Predicate of string * term list + | True + | False + | Eq of term * term + | NotEq of term * term + +type formulae = + | Disjunction of formulae * formulae + | NegAtom of atom + | Atom of atom + +type ast = + | Comment of string + | Inclusion of string * (string list) + | AnnotatedFormula of + string * kinds_of_formulae * formulae * source * info list diff --git a/components/tptp_grafite/heq_problems b/components/tptp_grafite/heq_problems new file mode 100644 index 000000000..b45d71ce3 --- /dev/null +++ b/components/tptp_grafite/heq_problems @@ -0,0 +1,142 @@ +ANA003-1 +ANA004-1 +ANA005-1 +CAT018-4 +COL003-10 +COL003-2 +COL003-3 +COL003-4 +COL003-5 +COL003-6 +COL003-7 +COL003-8 +COL003-9 +COL006-2 +COL006-3 +COL006-4 +COL042-2 +COL042-3 +COL042-4 +COL042-5 +COL043-2 +COL044-2 +COL044-3 +COL044-4 +COL044-5 +HWC002-1 +HWC003-1 +HWC003-2 +HWV002-1 +HWV003-1 +HWV004-1 +LAT001-1 +LAT002-1 +LAT041-1 +LCL109-4 +LCL149-1 +LCL150-1 +LCL152-1 +LCL181-3 +LCL191-3 +LCL192-3 +LCL193-3 +LCL194-3 +LCL195-3 +LCL208-3 +LCL213-3 +LCL214-3 +LCL215-3 +LCL216-3 +LCL217-3 +LCL220-3 +LCL221-3 +LCL222-3 +LCL223-3 +LCL224-3 +LCL225-3 +LCL227-3 +LCL229-3 +LCL230-3 +LCL231-3 +LCL242-3 +LCL243-3 +LCL245-3 +LCL246-3 +LCL247-3 +LCL249-3 +LCL251-3 +LCL252-3 +LCL253-3 +LCL254-3 +LCL255-3 +LCL260-3 +LCL262-3 +LCL263-3 +LCL264-3 +LCL265-3 +LCL266-3 +LCL269-3 +LCL270-3 +LCL271-3 +LCL272-3 +LCL273-3 +LCL274-3 +LCL275-3 +LCL276-3 +LCL277-3 +LCL278-3 +LCL281-3 +LCL282-3 +LCL283-3 +LCL284-3 +LCL285-3 +LCL286-3 +LCL289-3 +LCL293-3 +LCL295-3 +LCL298-3 +LCL299-3 +LCL300-3 +LCL302-3 +LCL303-3 +LCL304-3 +LCL305-3 +LCL306-3 +LCL307-3 +LCL308-3 +LCL309-3 +LCL310-3 +LCL311-3 +LCL312-3 +LCL313-3 +LCL314-3 +LCL315-3 +LCL316-3 +LCL319-3 +LCL324-3 +LCL325-3 +LCL327-3 +LCL328-3 +LCL329-3 +LCL330-3 +LCL331-3 +LCL332-3 +LCL334-3 +LCL335-3 +LCL336-3 +LCL337-3 +LCL339-3 +LCL340-3 +LCL341-3 +LCL344-3 +LCL345-3 +LCL346-3 +LCL347-3 +LCL348-3 +LCL349-3 +LCL351-3 +LCL353-3 +LDA004-1 +ROB014-1 +ROB015-2 +ROB018-1 diff --git a/components/tptp_grafite/hne_problems b/components/tptp_grafite/hne_problems new file mode 100644 index 000000000..845ea315f --- /dev/null +++ b/components/tptp_grafite/hne_problems @@ -0,0 +1,90 @@ +ANA003-2 +LCL001-1 +LCL002-1 +LCL005-1 +LCL019-1 +LCL020-1 +LCL021-1 +LCL024-1 +LCL032-1 +LCL037-1 +LCL038-1 +LCL061-1 +LCL062-1 +LCL063-1 +LCL074-1 +LCL084-2 +LCL084-3 +LCL085-1 +LCL105-1 +LCL119-1 +LCL122-1 +LCL124-1 +LCL125-1 +LCL166-1 +LCL167-1 +LCL218-1 +LCL227-1 +LCL230-1 +LCL231-1 +LCL249-1 +LCL253-1 +LCL369-1 +LCL375-1 +LCL377-1 +LCL393-1 +LCL394-1 +LCL395-1 +LCL423-1 +LCL425-1 +NUM017-1 +PLA001-1 +PLA004-1 +PLA004-2 +PLA005-1 +PLA005-2 +PLA007-1 +PLA008-1 +PLA009-1 +PLA009-2 +PLA010-1 +PLA011-1 +PLA011-2 +PLA012-1 +PLA013-1 +PLA014-1 +PLA014-2 +PLA015-1 +PLA016-1 +PLA018-1 +PLA019-1 +PLA021-1 +PLA023-1 +PUZ039-1 +PUZ040-1 +PUZ042-1 +PUZ050-1 +RNG001-2 +RNG004-3 +SWV014-1 +SYN556-1 +SYN598-1 +SYN599-1 +SYN600-1 +SYN614-1 +SYN615-1 +SYN617-1 +SYN628-1 +SYN631-1 +SYN639-1 +SYN640-1 +SYN646-1 +SYN647-1 +SYN649-1 +SYN653-1 +SYN654-1 +SYN655-1 +SYN704-1 +SYN707-1 +SYN708-1 +SYN711-1 diff --git a/components/tptp_grafite/lexer.mll b/components/tptp_grafite/lexer.mll new file mode 100644 index 000000000..273d1b79b --- /dev/null +++ b/components/tptp_grafite/lexer.mll @@ -0,0 +1,57 @@ +{ + open Parser + exception BadToken of string + + let incr_linenum lexbuf = + let pos = lexbuf.Lexing.lex_curr_p in + lexbuf.Lexing.lex_curr_p <- { pos with + Lexing.pos_lnum = pos.Lexing.pos_lnum + 1; + Lexing.pos_bol = pos.Lexing.pos_cnum; + } + ;; + +} + +let dust = ' ' | '\t' +let comment = '%' [^ '\n' ] * '\n' +let lname = + ['a'-'z'] ['a'-'z''A'-'Z''0'-'9''_']* +let uname = + ['A'-'Z'] ['a'-'z''A'-'Z''0'-'9''_']* +let qstring = ''' [^ ''' ]+ ''' +let type_ = + "axiom" | "hypothesis" | "definition" | "lemma" | "theorem" | + "conjecture" | "lemma_conjecture" | "negated_conjecture" | + "plain" | "unknown" + +let ieq = "=" +let peq = "equal" +let nieq = "!=" + +rule yylex = parse + | dust { yylex lexbuf } + | '\n' { incr_linenum lexbuf; yylex lexbuf } + | comment { incr_linenum lexbuf; COMMENT (Lexing.lexeme lexbuf) } + | "include" { INCLUSION } + | type_ { TYPE (Lexing.lexeme lexbuf) } + | "cnf" { CNF } + | "$true" { TRUE } + | "$false" { FALSE } + | "equal" { PEQ } + + | lname { LNAME (Lexing.lexeme lexbuf) } + | uname { UNAME (Lexing.lexeme lexbuf) } + | ['0' - '9']+ { NUM (int_of_string (Lexing.lexeme lexbuf)) } + | ',' { COMMA } + | '.' { DOT } + | '(' { LPAREN } + | ')' { RPAREN } + | '|' { IOR } + | '~' { NOT } + | '=' { IEQ } + | "!=" { NIEQ } + | qstring { QSTRING (Lexing.lexeme lexbuf) } + | eof { EOF } + | _ { raise (BadToken (Lexing.lexeme lexbuf)) } + +{ (* trailer *) } diff --git a/components/tptp_grafite/main.ml b/components/tptp_grafite/main.ml new file mode 100644 index 000000000..e52b77c43 --- /dev/null +++ b/components/tptp_grafite/main.ml @@ -0,0 +1,22 @@ +(* OPTIONS *) +let tptppath = ref "./";; +let spec = [ + ("-tptppath", + Arg.String (fun x -> tptppath := x), + "Where to find the Axioms/ and Problems/ directory") +] + +(* MAIN *) +let _ = + let usage = "Usage: tptp2grafite [options] file" in + let inputfile = ref "" in + Arg.parse spec (fun s -> inputfile := s) usage; + if !inputfile = "" then + begin + prerr_endline usage; + exit 1 + end; + print_endline + (Tptp2grafite.tptp2grafite ~filename:!inputfile ~tptppath:!tptppath ()); + exit 0 + diff --git a/components/tptp_grafite/parser.mly b/components/tptp_grafite/parser.mly new file mode 100644 index 000000000..4fe172144 --- /dev/null +++ b/components/tptp_grafite/parser.mly @@ -0,0 +1,150 @@ +%{ + (* header *) + open Ast + open Parsing + open Lexing + + let parse_error s = Printf.eprintf "%s: " s ;; + let rm_q s = String.sub s 1 (String.length s - 2) ;; + +%} + %token TYPE + %token COMMENT + %token NUM + %token LNAME + %token UNAME + %token QSTRING + %token COMMA + %token INCLUSION + %token LPAREN + %token RPAREN + %token CNF + %token TRUE + %token FALSE + %token IOR + %token NOT + %token NIEQ + %token IEQ + %token PEQ + %token DOT + %token EOF + + %type main + %start main +%% + main: + | tptp_input EOF {[$1]} + | tptp_input main {$1::$2} + | error { + let start_pos = rhs_start_pos 1 in + let end_pos = rhs_end_pos 1 in + Printf.eprintf "from line %d char %d to line %d char %d\n" + start_pos.pos_lnum (start_pos.pos_cnum - start_pos.pos_bol) + end_pos.pos_lnum (end_pos.pos_cnum - end_pos.pos_bol); + exit 1 + } + ; + + tptp_input: + | annot_formula {$1} + | include_ {$1} + | comment {$1} + ; + + annot_formula: + | CNF LPAREN + name COMMA formula_type COMMA formula formula_source_and_infos + RPAREN DOT { + AnnotatedFormula ($3,$5,$7,fst $8,snd $8) + } + ; + + formula_type: + | TYPE { + match $1 with + | "axiom" -> Axiom + | "hypothesis" -> Hypothesis + | "definition" -> Definition + | "lemma" -> Lemma + | "theorem" -> Theorem + | "conjecture" -> Conjecture + | "lemma_conjecture" -> Lemma_conjecture + | "negated_conjecture" -> Negated_conjecture + | "plain" -> Plain + | "unknown" -> Unknown + | _ -> assert false + } + ; + + formula: + | LPAREN disjunction RPAREN {$2} + | disjunction {$1} + ; + + disjunction: + | literal {$1} + | literal IOR disjunction { + Disjunction ($1,$3) + } + ; + + literal: + | NOT atom { NegAtom $2 } + | atom { Atom $1 } + ; + + atom: + | atomic_word LPAREN term_list RPAREN { Predicate ($1,$3) } + | atomic_word { Proposition $1 } + | TRUE { True } + | FALSE { False } + | term IEQ term { Eq ($1,$3) } + | term NIEQ term { NotEq ($1,$3) } + | PEQ LPAREN term COMMA term RPAREN { Eq ($3,$5) } + ; + + term_list: + | term { [$1] } + | term COMMA term_list { $1 :: $3 } + ; + + term: + | upper_word { Variable $1 } + | atomic_word LPAREN term_list RPAREN { Function ($1,$3) } + | atomic_word { Constant $1 } + ; + + upper_word: UNAME { $1 } ; + + atomic_word: + | LNAME { $1 } + | QSTRING { rm_q $1 } + | TYPE { (* workaround! *) + match $1 with + | "theorem" -> "theoremP" + | "axiom" -> "axiomP" + | s -> prerr_endline s;assert false } + ; + + formula_source_and_infos: + | { NoSource, [NoInfo] } + | COMMA { assert false } + ; + + include_: + | INCLUSION LPAREN QSTRING selection_of_formulae RPAREN DOT { + let fname = rm_q $3 in + Inclusion (fname,$4) + } + ; + + selection_of_formulae: + | { [] } + | COMMA name selection_of_formulae { $2::$3 } + ; + + comment: COMMENT {Comment $1} ; + + name: NUM { string_of_int $1} | LNAME { $1 } | UNAME { $1 } ; +%% + (* trailer *) diff --git a/components/tptp_grafite/tptp2grafite.ml b/components/tptp_grafite/tptp2grafite.ml new file mode 100644 index 000000000..667b7e3d6 --- /dev/null +++ b/components/tptp_grafite/tptp2grafite.ml @@ -0,0 +1,383 @@ +module GA = GrafiteAst;; +module LA = LexiconAst;; +module PT = CicNotationPt;; +module A = Ast;; + +type sort = Prop | Univ;; + +let floc = HExtlib.dummy_floc;; + + +let paramod_timeout = ref 600;; +let depth = ref 10;; + +let universe = "Univ" ;; +let prop = "Prop";; + +let kw = [ + "and","myand" +];; + +let mk_ident s = + PT.Ident ((try List.assoc s kw with Not_found -> s),None) +;; + +let rec collect_arities_from_term = function + | A.Constant name -> [name,(0,Univ)] + | A.Variable name -> [name,(0,Univ)] + | A.Function (name,l) -> + (name,(List.length l,Univ)):: + List.flatten (List.map collect_arities_from_term l) +;; + +let rec collect_fv_from_term = function + | A.Constant name -> [] + | A.Variable name -> [name] + | A.Function (_,l) -> + List.flatten (List.map collect_fv_from_term l) +;; + +let collect_arities_from_atom a = + let aux = function + | A.Proposition name -> [name,(0,Prop)] + | A.Predicate (name,args) -> + (name,(List.length args,Prop)) :: + (List.flatten (List.map collect_arities_from_term args)) + | A.True -> [] + | A.False -> [] + | A.Eq (t1,t2) -> + collect_arities_from_term t1 @ collect_arities_from_term t2 + | A.NotEq (t1,t2) -> + collect_arities_from_term t1 @ collect_arities_from_term t2 + in + HExtlib.list_uniq (List.sort compare (List.flatten (List.map aux a))) +;; + +let collect_fv_from_atom a = + let aux = function + | A.Proposition name -> [name] + | A.Predicate (name,args) -> + name :: List.flatten (List.map collect_fv_from_term args) + | A.True -> [] + | A.False -> [] + | A.Eq (t1,t2) -> collect_fv_from_term t1 @ collect_fv_from_term t2 + | A.NotEq (t1,t2) -> collect_fv_from_term t1 @ collect_fv_from_term t2 + in + let rec aux2 = function + | [] -> [] + | hd::tl -> aux hd @ aux2 tl + in + HExtlib.list_uniq (List.sort compare (aux2 a)) +;; + +let rec collect_fv_from_formulae = function + | A.Disjunction (a,b) -> + collect_fv_from_formulae a @ collect_fv_from_formulae b + | A.NegAtom a + | A.Atom a -> collect_fv_from_atom [a] +;; + +let rec convert_term = function + | A.Variable x -> mk_ident x + | A.Constant x -> mk_ident x + | A.Function (name, args) -> + PT.Appl (mk_ident name :: List.map convert_term args) +;; + +let rec atom_of_formula = function + | A.Disjunction (a,b) -> + atom_of_formula a @ atom_of_formula b + | A.NegAtom a -> [a] (* removes the negation *) + | A.Atom a -> [a] +;; + +let rec mk_arrow component tail = function + | 0 -> begin + match tail with + | Prop -> mk_ident prop + | Univ -> mk_ident universe + end + | n -> + PT.Binder + (`Forall, + ((mk_ident "_"),Some (mk_ident component)), + mk_arrow component tail (n-1)) +;; + +let build_ctx_for_arities univesally arities t = + let binder = if univesally then `Forall else `Exists in + let rec aux = function + | [] -> t + | (name,(nargs,sort))::tl -> + PT.Binder + (binder, + (mk_ident name,Some (mk_arrow universe sort nargs)), + aux tl) + in + aux arities +;; + +let convert_atom universally a = + let aux = function + | A.Proposition p -> mk_ident p + | A.Predicate (name,params) -> + PT.Appl ((mk_ident name) :: (List.map convert_term params)) + | A.True -> mk_ident "True" + | A.False -> mk_ident "False" + | A.Eq (l,r) + | A.NotEq (l,r) -> (* removes the negation *) + PT.Appl [mk_ident "eq";mk_ident universe;convert_term l;convert_term r] + in + let rec aux2 = function + | [] -> assert false + | [x] -> aux x + | he::tl -> + if universally then + PT.Binder (`Forall, (mk_ident "_", Some (aux he)), aux2 tl) + else + PT.Appl [mk_ident "And";aux he;aux2 tl] + in + let arities = collect_arities_from_atom a in + let fv = collect_fv_from_atom a in + build_ctx_for_arities universally + (List.filter + (function (x,(0,Univ)) -> List.mem x fv | _-> false) + arities) + (aux2 a) +;; + +let collect_arities atom ctx = + let atoms = atom@(List.flatten (List.map atom_of_formula ctx)) in + collect_arities_from_atom atoms +;; + +let collect_arities_from_formulae f = + let rec collect_arities_from_formulae = function + | A.Disjunction (a,b) -> + collect_arities_from_formulae a @ collect_arities_from_formulae b + | A.NegAtom a + | A.Atom a -> collect_arities_from_atom [a] + in + HExtlib.list_uniq (List.sort compare (collect_arities_from_formulae f)) +;; + +let is_formulae_1eq_negated f = + let atom = atom_of_formula f in + match atom with + | [A.NotEq (l,r)] -> true + | _ -> false +;; + +let collect_fv_1stord_from_formulae f = + let arities = collect_arities_from_formulae f in + let fv = collect_fv_from_formulae f in + List.map fst + (List.filter (function (x,(0,Univ)) -> List.mem x fv | _-> false) arities) +;; + +let rec convert_formula fv no_arities context f = + let atom = atom_of_formula f in + let t = convert_atom (fv = []) atom in + let rec build_ctx n = function + | [] -> t + | hp::tl -> + PT.Binder + (`Forall, + (mk_ident ("H" ^ string_of_int n), + Some (convert_formula [] true [] hp)), + build_ctx (n+1) tl) + in + let arities = if no_arities then [] else collect_arities atom context in + build_ctx_for_arities true arities (build_ctx 0 context) +;; + +let check_if_atom_is_negative = function + | A.True -> false + | A.False -> true + | A.Proposition _ -> false + | A.Predicate _ -> false + | A.Eq _ -> false + | A.NotEq _ -> true +;; + +let rec check_if_formula_is_negative = function + | A.Disjunction (a,b) -> + check_if_formula_is_negative a && check_if_formula_is_negative b + | A.NegAtom a -> not (check_if_atom_is_negative a) + | A.Atom a -> check_if_atom_is_negative a +;; + +let convert_ast statements context = function + | A.Comment s -> + let s = String.sub s 1 (String.length s - 1) in + let s = + if s.[String.length s - 1] = '\n' then + String.sub s 0 (String.length s - 1) + else + s + in + statements @ [GA.Comment (floc,GA.Note (floc,s))], + context + | A.Inclusion (s,_) -> + statements @ [ + GA.Comment ( + floc, GA.Note ( + floc,"Inclusion of: " ^ s))], context + | A.AnnotatedFormula (name,kind,f,_,_) -> + match kind with + | A.Axiom + | A.Hypothesis -> + statements, f::context + | A.Negated_conjecture when not (check_if_formula_is_negative f) -> + statements, f::context + | A.Negated_conjecture -> + let ueq_case = is_formulae_1eq_negated f in + let fv = collect_fv_1stord_from_formulae f in +(* + if fv <> [] then + prerr_endline ("FREE VARIABLES: " ^ String.concat "," fv); +*) + let f = + PT.Binder + (`Forall, + (mk_ident universe,Some (PT.Sort `Set)), + convert_formula fv false context f) + in + let o = PT.Theorem (`Theorem,name,f,None) in + statements @ [ + GA.Executable(floc,GA.Command(floc,GA.Obj(floc,o))); + GA.Executable(floc,GA.Tactic(floc, Some + (GA.Intros (floc,(None,[]))),GA.Dot(floc)))] @ + (if fv <> [] then + (List.flatten + (List.map + (fun _ -> + [GA.Executable(floc,GA.Tactic(floc, Some + (GA.Exists floc),GA.Branch floc)); + GA.Executable(floc,GA.Tactic(floc, None, + (GA.Pos (floc,[2]))))]) + fv)) + else [])@ + [GA.Executable(floc,GA.Tactic(floc, Some ( + if ueq_case then + GA.AutoBatch (floc,["paramodulation",""; + "timeout",string_of_int !paramod_timeout]) + else + GA.AutoBatch (floc,["depth",string_of_int !depth]) + ), + GA.Semicolon(floc))); + GA.Executable(floc,GA.Tactic(floc, Some (GA.Try(floc, + GA.Assumption floc)), GA.Dot(floc))) + ]@ + (if fv <> [] then + (List.flatten + (List.map + (fun _ -> + [GA.Executable(floc,GA.Tactic(floc, None, GA.Shift floc)); + GA.Executable(floc,GA.NonPunctuationTactical(floc, GA.Skip floc, + (GA.Merge floc)))]) + fv)) + else [])@ + [GA.Executable(floc,GA.Command(floc, GA.Print(floc,"proofterm"))); + GA.Executable(floc,GA.Command(floc, GA.Qed(floc)))], + context + | A.Definition + | A.Lemma + | A.Theorem + | A.Conjecture + | A.Lemma_conjecture + | A.Plain + | A.Unknown -> assert false +;; + +(* HELPERS *) +let resolve ~tptppath s = + let resolved_name = + if Filename.check_suffix s ".p" then + (assert (String.length s > 5); + let prefix = String.sub s 0 3 in + tptppath ^ "/Problems/" ^ prefix ^ "/" ^ s) + else + tptppath ^ "/" ^ s + in + if HExtlib.is_regular resolved_name then + resolved_name + else + begin + prerr_endline ("Unable to find " ^ s ^ " (" ^ resolved_name ^ ")"); + exit 1 + end +;; + +(* MAIN *) +let tptp2grafite ?(timeout=600) ?(def_depth=10) ?raw_preamble ~tptppath ~filename () = + paramod_timeout := timeout; + depth := def_depth; + let rec aux = function + | [] -> [] + | ((A.Inclusion (file,_)) as hd) :: tl -> + let file = resolve ~tptppath file in + let lexbuf = Lexing.from_channel (open_in file) in + let statements = Parser.main Lexer.yylex lexbuf in + hd :: aux (statements @ tl) + | hd::tl -> hd :: aux tl + in + let statements = aux [A.Inclusion (filename,[])] in + let grafite_ast_statements,_ = + List.fold_left + (fun (st, ctx) f -> + let newst, ctx = convert_ast st ctx f in + newst, ctx) + ([],[]) statements + in + let pp t = + (* ZACK: setting width to 80 will trigger a bug of BoxPp.render_to_string + * which will show up using the following command line: + * ./tptp2grafite -tptppath ~tassi/TPTP-v3.1.1 GRP170-1 *) + let width = max_int in + let term_pp content_term = + let pres_term = TermContentPres.pp_ast content_term in + let dummy_tbl = Hashtbl.create 1 in + let markup = CicNotationPres.render dummy_tbl pres_term in + let s = BoxPp.render_to_string List.hd width markup ~map_unicode_to_tex:false in + Pcre.substitute + ~pat:"\\\\forall [Ha-z][a-z0-9_]*" ~subst:(fun x -> "\n" ^ x) s + in + CicNotationPp.set_pp_term term_pp; + let lazy_term_pp = fun x -> assert false in + let obj_pp = CicNotationPp.pp_obj CicNotationPp.pp_term in + GrafiteAstPp.pp_statement + ~map_unicode_to_tex:false ~term_pp ~lazy_term_pp ~obj_pp t + in + let buri = Pcre.replace ~pat:"\\.p$" ("cic:/matita/TPTP/" ^ filename) in + let extra_statements_start = [ + GA.Executable(floc,GA.Command(floc, + GA.Set(floc,"baseuri",buri)))] + in + let preamble = + match raw_preamble with + | None -> + pp (GA.Executable(floc, + GA.Command(floc,GA.Include(floc,"logic/equality.ma")))) + | Some s -> s buri + in + let extra_statements_end = [] in + let aliases = [] + (*[("eq","cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)"); + ("trans_eq","cic:/Coq/Init/Logic/trans_eq.con"); + ("eq_ind_r","cic:/Coq/Init/Logic/eq_ind_r.con"); + ("eq_ind","cic:/Coq/Init/Logic/eq_ind.con"); + ("sym_eq","cic:/Coq/Init/Logic/sym_eq.con"); + ("refl_equal","cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)")] *) + in + let s1 = List.map pp extra_statements_start in + let s2 = + List.map + (fun (n,s) -> + LexiconAstPp.pp_command (LA.Alias(floc, LA.Ident_alias(n,s))) ^ ".") + aliases + in + let s3 = List.map pp grafite_ast_statements in + let s4 = List.map pp extra_statements_end in + String.concat "\n" (s1@[preamble]@s2@s3@s4) +;; diff --git a/components/tptp_grafite/tptp2grafite.mli b/components/tptp_grafite/tptp2grafite.mli new file mode 100644 index 000000000..0cebccbe3 --- /dev/null +++ b/components/tptp_grafite/tptp2grafite.mli @@ -0,0 +1,31 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val tptp2grafite: + ?timeout:int -> + ?def_depth:int -> + ?raw_preamble:(string -> string) -> + tptppath:string -> filename:string -> unit -> + string diff --git a/components/tptp_grafite/unit_equality_problems b/components/tptp_grafite/unit_equality_problems new file mode 100644 index 000000000..c394ddd95 --- /dev/null +++ b/components/tptp_grafite/unit_equality_problems @@ -0,0 +1,860 @@ +ALG005-1 +ALG006-1 +ALG007-1 +BOO001-1 +BOO002-1 +BOO002-2 +BOO003-2 +BOO003-4 +BOO004-2 +BOO004-4 +BOO005-2 +BOO005-4 +BOO006-2 +BOO006-4 +BOO007-2 +BOO007-4 +BOO008-2 +BOO008-4 +BOO009-2 +BOO009-4 +BOO010-2 +BOO010-4 +BOO011-2 +BOO011-4 +BOO012-2 +BOO012-4 +BOO013-2 +BOO013-4 +BOO014-2 +BOO014-4 +BOO015-2 +BOO015-4 +BOO016-2 +BOO017-2 +BOO018-4 +BOO019-1 +BOO021-1 +BOO022-1 +BOO023-1 +BOO024-1 +BOO025-1 +BOO026-1 +BOO027-1 +BOO028-1 +BOO029-1 +BOO030-1 +BOO031-1 +BOO032-1 +BOO033-1 +BOO034-1 +BOO036-1 +BOO037-2 +BOO037-3 +BOO067-1 +BOO068-1 +BOO069-1 +BOO070-1 +BOO071-1 +BOO072-1 +BOO073-1 +BOO074-1 +BOO075-1 +BOO076-1 +BOO077-1 +BOO078-1 +BOO079-1 +BOO080-1 +BOO081-1 +BOO082-1 +BOO083-1 +BOO084-1 +BOO085-1 +BOO086-1 +BOO087-1 +BOO088-1 +BOO089-1 +BOO090-1 +BOO091-1 +BOO092-1 +BOO093-1 +BOO094-1 +BOO095-1 +BOO096-1 +BOO097-1 +BOO098-1 +BOO099-1 +BOO100-1 +BOO101-1 +BOO102-1 +BOO103-1 +BOO104-1 +BOO105-1 +BOO106-1 +BOO107-1 +BOO108-1 +COL001-1 +COL001-2 +COL002-1 +COL002-4 +COL002-5 +COL003-1 +COL003-1 +COL003-1 +COL003-1 +COL003-1 +COL003-1 +COL003-1 +COL003-1 +COL003-1 +COL003-2 +COL004-1 +COL004-3 +COL005-1 +COL006-1 +COL006-5 +COL006-6 +COL006-7 +COL007-1 +COL008-1 +COL009-1 +COL010-1 +COL011-1 +COL012-1 +COL013-1 +COL014-1 +COL015-1 +COL016-1 +COL017-1 +COL018-1 +COL019-1 +COL020-1 +COL021-1 +COL022-1 +COL023-1 +COL024-1 +COL025-1 +COL026-1 +COL027-1 +COL029-1 +COL030-1 +COL031-1 +COL032-1 +COL033-1 +COL034-1 +COL035-1 +COL036-1 +COL037-1 +COL038-1 +COL039-1 +COL041-1 +COL042-1 +COL042-6 +COL042-7 +COL042-8 +COL042-9 +COL043-1 +COL043-3 +COL044-1 +COL044-6 +COL044-7 +COL044-8 +COL044-9 +COL045-1 +COL046-1 +COL047-1 +COL048-1 +COL049-1 +COL050-1 +COL051-1 +COL052-1 +COL053-1 +COL056-1 +COL057-1 +COL058-1 +COL058-2 +COL058-3 +COL059-1 +COL060-1 +COL060-2 +COL060-3 +COL061-1 +COL061-2 +COL061-3 +COL062-1 +COL062-2 +COL062-3 +COL063-1 +COL063-2 +COL063-3 +COL063-4 +COL063-5 +COL063-6 +COL064-1 +COL064-2 +COL064-3 +COL064-4 +COL064-5 +COL064-6 +COL064-7 +COL064-8 +COL064-9 +COL064-1 +COL064-1 +COL065-1 +COL066-1 +COL066-2 +COL066-3 +COL067-1 +COL068-1 +COL069-1 +COL070-1 +COL071-1 +COL073-1 +COL075-2 +COL083-1 +COL084-1 +COL085-1 +COL086-1 +COL087-1 +GRP001-2 +GRP001-4 +GRP002-2 +GRP002-3 +GRP002-4 +GRP010-4 +GRP011-4 +GRP012-4 +GRP014-1 +GRP022-2 +GRP023-2 +GRP024-5 +GRP114-1 +GRP115-1 +GRP116-1 +GRP117-1 +GRP118-1 +GRP119-1 +GRP120-1 +GRP121-1 +GRP122-1 +GRP136-1 +GRP137-1 +GRP138-1 +GRP139-1 +GRP140-1 +GRP141-1 +GRP142-1 +GRP143-1 +GRP144-1 +GRP145-1 +GRP146-1 +GRP147-1 +GRP148-1 +GRP149-1 +GRP150-1 +GRP151-1 +GRP152-1 +GRP153-1 +GRP154-1 +GRP155-1 +GRP156-1 +GRP157-1 +GRP158-1 +GRP159-1 +GRP160-1 +GRP161-1 +GRP162-1 +GRP163-1 +GRP164-1 +GRP164-2 +GRP165-1 +GRP165-2 +GRP166-1 +GRP166-2 +GRP166-3 +GRP166-4 +GRP167-1 +GRP167-2 +GRP167-3 +GRP167-4 +GRP167-5 +GRP168-1 +GRP168-2 +GRP169-1 +GRP169-2 +GRP170-1 +GRP170-2 +GRP170-3 +GRP170-4 +GRP171-1 +GRP171-2 +GRP172-1 +GRP172-2 +GRP173-1 +GRP174-1 +GRP175-1 +GRP175-2 +GRP175-3 +GRP175-4 +GRP176-1 +GRP176-2 +GRP177-1 +GRP177-2 +GRP178-1 +GRP178-2 +GRP179-1 +GRP179-2 +GRP179-3 +GRP180-1 +GRP180-2 +GRP181-1 +GRP181-2 +GRP181-3 +GRP181-4 +GRP182-1 +GRP182-2 +GRP182-3 +GRP182-4 +GRP183-1 +GRP183-2 +GRP183-3 +GRP183-4 +GRP184-1 +GRP184-2 +GRP184-3 +GRP184-4 +GRP185-1 +GRP185-2 +GRP185-3 +GRP185-4 +GRP186-1 +GRP186-2 +GRP186-3 +GRP186-4 +GRP187-1 +GRP188-1 +GRP188-2 +GRP189-1 +GRP189-2 +GRP190-1 +GRP190-2 +GRP191-1 +GRP191-2 +GRP192-1 +GRP193-1 +GRP193-2 +GRP195-1 +GRP196-1 +GRP200-1 +GRP201-1 +GRP202-1 +GRP203-1 +GRP204-1 +GRP205-1 +GRP206-1 +GRP207-1 +GRP393-2 +GRP394-3 +GRP399-1 +GRP403-1 +GRP404-1 +GRP405-1 +GRP406-1 +GRP407-1 +GRP408-1 +GRP409-1 +GRP410-1 +GRP411-1 +GRP412-1 +GRP413-1 +GRP414-1 +GRP415-1 +GRP416-1 +GRP417-1 +GRP418-1 +GRP419-1 +GRP420-1 +GRP421-1 +GRP422-1 +GRP423-1 +GRP424-1 +GRP425-1 +GRP426-1 +GRP427-1 +GRP428-1 +GRP429-1 +GRP430-1 +GRP431-1 +GRP432-1 +GRP433-1 +GRP434-1 +GRP435-1 +GRP436-1 +GRP437-1 +GRP438-1 +GRP439-1 +GRP440-1 +GRP441-1 +GRP442-1 +GRP443-1 +GRP444-1 +GRP445-1 +GRP446-1 +GRP447-1 +GRP448-1 +GRP449-1 +GRP450-1 +GRP451-1 +GRP452-1 +GRP453-1 +GRP454-1 +GRP455-1 +GRP456-1 +GRP457-1 +GRP458-1 +GRP459-1 +GRP460-1 +GRP461-1 +GRP462-1 +GRP463-1 +GRP464-1 +GRP465-1 +GRP466-1 +GRP467-1 +GRP468-1 +GRP469-1 +GRP470-1 +GRP471-1 +GRP472-1 +GRP473-1 +GRP474-1 +GRP475-1 +GRP476-1 +GRP477-1 +GRP478-1 +GRP479-1 +GRP480-1 +GRP481-1 +GRP482-1 +GRP483-1 +GRP484-1 +GRP485-1 +GRP486-1 +GRP487-1 +GRP488-1 +GRP489-1 +GRP490-1 +GRP491-1 +GRP492-1 +GRP493-1 +GRP494-1 +GRP495-1 +GRP496-1 +GRP497-1 +GRP498-1 +GRP499-1 +GRP500-1 +GRP501-1 +GRP502-1 +GRP503-1 +GRP504-1 +GRP505-1 +GRP506-1 +GRP507-1 +GRP508-1 +GRP509-1 +GRP510-1 +GRP511-1 +GRP512-1 +GRP513-1 +GRP514-1 +GRP515-1 +GRP516-1 +GRP517-1 +GRP518-1 +GRP519-1 +GRP520-1 +GRP521-1 +GRP522-1 +GRP523-1 +GRP524-1 +GRP525-1 +GRP526-1 +GRP527-1 +GRP528-1 +GRP529-1 +GRP530-1 +GRP531-1 +GRP532-1 +GRP533-1 +GRP534-1 +GRP535-1 +GRP536-1 +GRP537-1 +GRP538-1 +GRP539-1 +GRP540-1 +GRP541-1 +GRP542-1 +GRP543-1 +GRP544-1 +GRP545-1 +GRP546-1 +GRP547-1 +GRP548-1 +GRP549-1 +GRP550-1 +GRP551-1 +GRP552-1 +GRP553-1 +GRP554-1 +GRP555-1 +GRP556-1 +GRP557-1 +GRP558-1 +GRP559-1 +GRP560-1 +GRP561-1 +GRP562-1 +GRP563-1 +GRP564-1 +GRP565-1 +GRP566-1 +GRP567-1 +GRP568-1 +GRP569-1 +GRP570-1 +GRP571-1 +GRP572-1 +GRP573-1 +GRP574-1 +GRP575-1 +GRP576-1 +GRP577-1 +GRP578-1 +GRP579-1 +GRP580-1 +GRP581-1 +GRP582-1 +GRP583-1 +GRP584-1 +GRP585-1 +GRP586-1 +GRP587-1 +GRP588-1 +GRP589-1 +GRP590-1 +GRP591-1 +GRP592-1 +GRP593-1 +GRP594-1 +GRP595-1 +GRP596-1 +GRP597-1 +GRP598-1 +GRP599-1 +GRP600-1 +GRP601-1 +GRP602-1 +GRP603-1 +GRP604-1 +GRP605-1 +GRP606-1 +GRP607-1 +GRP608-1 +GRP609-1 +GRP610-1 +GRP611-1 +GRP612-1 +GRP613-1 +GRP614-1 +GRP615-1 +GRP616-1 +HWC004-1 +HWC004-2 +LAT006-1 +LAT007-1 +LAT008-1 +LAT009-1 +LAT010-1 +LAT011-1 +LAT012-1 +LAT013-1 +LAT014-1 +LAT016-1 +LAT017-1 +LAT018-1 +LAT019-1 +LAT020-1 +LAT021-1 +LAT022-1 +LAT023-1 +LAT024-1 +LAT025-1 +LAT026-1 +LAT027-1 +LAT028-1 +LAT031-1 +LAT032-1 +LAT033-1 +LAT034-1 +LAT038-1 +LAT039-1 +LAT039-2 +LAT040-1 +LAT042-1 +LAT043-1 +LAT044-1 +LAT045-1 +LAT046-1 +LAT047-1 +LAT048-1 +LAT049-1 +LAT050-1 +LAT051-1 +LAT052-1 +LAT053-1 +LAT054-1 +LAT055-2 +LAT059-1 +LAT060-1 +LAT061-1 +LAT062-1 +LAT063-1 +LAT070-1 +LAT071-1 +LAT072-1 +LAT073-1 +LAT074-1 +LAT075-1 +LAT076-1 +LAT077-1 +LAT078-1 +LAT079-1 +LAT080-1 +LAT081-1 +LAT082-1 +LAT083-1 +LAT084-1 +LAT085-1 +LAT086-1 +LAT087-1 +LAT088-1 +LAT089-1 +LAT090-1 +LAT091-1 +LAT092-1 +LAT093-1 +LAT094-1 +LAT095-1 +LAT096-1 +LAT097-1 +LAT098-1 +LAT099-1 +LAT100-1 +LAT101-1 +LAT102-1 +LAT103-1 +LAT104-1 +LAT105-1 +LAT106-1 +LAT107-1 +LAT108-1 +LAT109-1 +LAT110-1 +LAT111-1 +LAT112-1 +LAT113-1 +LAT114-1 +LAT115-1 +LAT116-1 +LAT117-1 +LAT118-1 +LAT119-1 +LAT120-1 +LAT121-1 +LAT122-1 +LAT123-1 +LAT124-1 +LAT125-1 +LAT126-1 +LAT127-1 +LAT128-1 +LAT129-1 +LAT130-1 +LAT131-1 +LAT132-1 +LAT133-1 +LAT134-1 +LAT135-1 +LAT136-1 +LAT137-1 +LAT138-1 +LAT139-1 +LAT140-1 +LAT141-1 +LAT142-1 +LAT143-1 +LAT144-1 +LAT145-1 +LAT146-1 +LAT147-1 +LAT148-1 +LAT149-1 +LAT150-1 +LAT151-1 +LAT152-1 +LAT153-1 +LAT154-1 +LAT155-1 +LAT156-1 +LAT157-1 +LAT158-1 +LAT159-1 +LAT160-1 +LAT161-1 +LAT162-1 +LAT163-1 +LAT164-1 +LAT165-1 +LAT166-1 +LAT167-1 +LAT168-1 +LAT169-1 +LAT170-1 +LAT171-1 +LAT172-1 +LAT173-1 +LAT174-1 +LAT175-1 +LAT176-1 +LAT177-1 +LCL109-2 +LCL109-6 +LCL110-2 +LCL111-2 +LCL112-2 +LCL113-2 +LCL114-2 +LCL115-2 +LCL116-2 +LCL132-1 +LCL133-1 +LCL134-1 +LCL135-1 +LCL136-1 +LCL137-1 +LCL138-1 +LCL139-1 +LCL140-1 +LCL141-1 +LCL153-1 +LCL154-1 +LCL155-1 +LCL156-1 +LCL157-1 +LCL158-1 +LCL159-1 +LCL160-1 +LCL161-1 +LCL162-1 +LCL163-1 +LCL164-1 +LCL165-1 +LCL407-1 +LCL407-2 +LCL409-1 +LCL410-1 +LDA001-1 +LDA002-1 +LDA007-3 +RNG007-4 +RNG008-3 +RNG008-4 +RNG008-7 +RNG009-5 +RNG009-7 +RNG010-5 +RNG010-6 +RNG010-7 +RNG011-5 +RNG012-6 +RNG013-6 +RNG014-6 +RNG015-6 +RNG016-6 +RNG017-6 +RNG018-6 +RNG019-6 +RNG019-7 +RNG020-6 +RNG020-7 +RNG021-6 +RNG021-7 +RNG023-6 +RNG023-7 +RNG024-6 +RNG024-7 +RNG025-4 +RNG025-5 +RNG025-6 +RNG025-7 +RNG025-8 +RNG025-9 +RNG026-6 +RNG026-7 +RNG027-5 +RNG027-7 +RNG027-8 +RNG027-9 +RNG028-5 +RNG028-7 +RNG028-8 +RNG028-9 +RNG029-5 +RNG029-6 +RNG029-7 +RNG030-6 +RNG030-7 +RNG031-6 +RNG031-7 +RNG032-6 +RNG032-7 +RNG033-6 +RNG033-7 +RNG033-8 +RNG033-9 +RNG035-7 +RNG036-7 +RNG042-2 +RNG042-3 +RNG043-1 +ROB001-1 +ROB002-1 +ROB003-1 +ROB004-1 +ROB005-1 +ROB006-1 +ROB006-2 +ROB007-1 +ROB007-2 +ROB008-1 +ROB009-1 +ROB010-1 +ROB013-1 +ROB020-1 +ROB020-2 +ROB022-1 +ROB023-1 +ROB024-1 +ROB026-1 +ROB027-1 +ROB028-1 +ROB030-1 +ROB031-1 +ROB032-1 +SYN080-1 +SYN083-1 +SYN305-1 +SYN552-1 diff --git a/components/urimanager/.depend b/components/urimanager/.depend new file mode 100644 index 000000000..482148423 --- /dev/null +++ b/components/urimanager/.depend @@ -0,0 +1,2 @@ +uriManager.cmo: uriManager.cmi +uriManager.cmx: uriManager.cmi diff --git a/components/urimanager/.depend.opt b/components/urimanager/.depend.opt new file mode 100644 index 000000000..482148423 --- /dev/null +++ b/components/urimanager/.depend.opt @@ -0,0 +1,2 @@ +uriManager.cmo: uriManager.cmi +uriManager.cmx: uriManager.cmi diff --git a/components/urimanager/Makefile b/components/urimanager/Makefile new file mode 100644 index 000000000..592c0854e --- /dev/null +++ b/components/urimanager/Makefile @@ -0,0 +1,10 @@ +PACKAGE = urimanager +PREDICATES = + +INTERFACE_FILES = uriManager.mli +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/urimanager/uriManager.ml b/components/urimanager/uriManager.ml new file mode 100644 index 000000000..c0da8eb4b --- /dev/null +++ b/components/urimanager/uriManager.ml @@ -0,0 +1,245 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +(* + * "cic:/a/b/c.con" => ("cic:/a/b/c.con", id ) + * "cic:/a/b/c.ind#xpointer(1/1)" => ("cic:/a/b/c.con#xpointer(1/1)", id) + * "cic:/a/b/c.ind#xpointer(1/1/1)" => ("cic:/a/b/c.con#xpointer(1/1/1)", id) + *) + +let fresh_id = + let id = ref 0 in + function () -> + incr id; + !id + +(* (uriwithxpointer, uniqueid) + * where uniqueid is used to build a set of uri *) +type uri = string * int;; + +let eq uri1 uri2 = + uri1 == uri2 +;; + +let string_of_uri (uri,_) = + uri + +let name_of_uri (uri, _) = + let xpointer_offset = + try String.rindex uri '#' with Not_found -> String.length uri - 1 + in + let index1 = String.rindex_from uri xpointer_offset '/' + 1 in + let index2 = String.rindex uri '.' in + String.sub uri index1 (index2 - index1) + +let nameext_of_uri (uri, _) = + let xpointer_offset, mah = + try String.rindex uri '#', 0 with Not_found -> String.length uri - 1, 1 + in + let index1 = String.rindex_from uri xpointer_offset '/' + 1 in + String.sub uri index1 (xpointer_offset - index1 + mah) + +let buri_of_uri (uri,_) = + let xpointer_offset = + try String.rindex uri '#' with Not_found -> String.length uri - 1 + in + let index = String.rindex_from uri xpointer_offset '/' in + String.sub uri 0 index + +module OrderedStrings = + struct + type t = string + let compare (s1 : t) (s2 : t) = compare s1 s2 + end +;; + +module MapStringsToUri = Map.Make(OrderedStrings);; + +(* Invariant: the map is the identity function, + * i.e. + * let str' = (MapStringsToUri.find str !set_of_uri) in + * str' == (MapStringsToUri.find str' !set_of_uri) + *) +let set_of_uri = ref MapStringsToUri.empty;; + +exception IllFormedUri of string;; + +let _dottypes = ".types" +let _types = "types",5 +let _dotuniv = ".univ" +let _univ = "univ",4 +let _dotann = ".ann" +let _ann = "ann",3 +let _var = "var",3 +let _dotbody = ".body" +let _con = "con",3 +let _ind = "ind",3 +let _xpointer = "#xpointer(1/" +let _con3 = "con" +let _var3 = "var" +let _ind3 = "ind" +let _ann3 = "ann" +let _univ4 = "univ" +let _types5 = "types" +let _xpointer8 = "xpointer" +let _cic5 = "cic:/" + +let is_malformed suri = + try + if String.sub suri 0 5 <> _cic5 then true + else + let len = String.length suri - 5 in + let last5 = String.sub suri len 5 in + let last4 = String.sub last5 1 4 in + let last3 = String.sub last5 2 3 in + if last3 = _con3 || last3 = _var3 || last3 = _ind3 || + last3 = _ann3 || last5 = _types5 || last5 = _dotbody || + last4 = _univ4 then + false + else + try + let index = String.rindex suri '#' + 1 in + let xptr = String.sub suri index 8 in + if xptr = _xpointer8 then + false + else + true + with Not_found -> true + with Invalid_argument _ -> true + +(* hash conses an uri *) +let uri_of_string suri = + try + MapStringsToUri.find suri !set_of_uri + with Not_found -> + if is_malformed suri then + raise (IllFormedUri suri) + else + let new_uri = suri, fresh_id () in + set_of_uri := MapStringsToUri.add suri new_uri !set_of_uri; + new_uri + + +let strip_xpointer ((uri,_) as olduri) = + try + let index = String.rindex uri '#' in + let no_xpointer = String.sub uri 0 index in + uri_of_string no_xpointer + with + Not_found -> olduri + +let clear_suffix uri ?(pat2="",0) pat1 = + try + let index = String.rindex uri '.' in + let index' = index + 1 in + let suffix = String.sub uri index' (String.length uri - index') in + if fst pat1 = suffix || fst pat2 = suffix then + String.sub uri 0 index + else + uri + with + Not_found -> assert false + +let has_suffix uri (pat,n) = + try + let suffix = String.sub uri (String.length uri - n) n in + pat = suffix + with + Not_found -> assert false + + +let cicuri_of_uri (uri, _) = uri_of_string (clear_suffix uri ~pat2:_types _ann) + +let annuri_of_uri (uri , _) = uri_of_string ((clear_suffix uri _ann) ^ _dotann) + +let uri_is_annuri (uri, _) = has_suffix uri _ann + +let uri_is_var (uri, _) = has_suffix uri _var + +let uri_is_con (uri, _) = has_suffix uri _con + +let uri_is_ind (uri, _) = has_suffix uri _ind + +let bodyuri_of_uri (uri, _) = + if has_suffix uri _con then + Some (uri_of_string (uri ^ _dotbody)) + else + None +;; + +(* these are bugged! + * we should remove _types, _univ, _ann all toghether *) +let innertypesuri_of_uri (uri, _) = + uri_of_string ((clear_suffix uri _types) ^ _dottypes) +;; +let univgraphuri_of_uri (uri,_) = + uri_of_string ((clear_suffix uri _univ) ^ _dotuniv) +;; + + +let uri_of_uriref (uri, _) typeno consno = + let typeno = typeno + 1 in + let suri = + match consno with + | None -> Printf.sprintf "%s%s%d)" uri _xpointer typeno + | Some n -> Printf.sprintf "%s%s%d/%d)" uri _xpointer typeno n + in + uri_of_string suri + +let compare (_,id1) (_,id2) = id1 - id2 + +module OrderedUri = +struct + type t = uri + let compare = compare (* the one above, not Pervasives.compare *) +end + +module UriSet = Set.Make (OrderedUri) + +(* +module OrderedUriPair = +struct + type t = uri * uri + let compare (u11, u12) (u21, u22) = + match compare u11 u21 with + | 0 -> compare u12 u22 + | x -> x +end + +module UriPairSet = Set.Make (OrderedUriPair) +*) + +module HashedUri = +struct + type t = uri + let equal = eq + let hash = snd +end + +module UriHashtbl = Hashtbl.Make (HashedUri) + + diff --git a/components/urimanager/uriManager.mli b/components/urimanager/uriManager.mli new file mode 100644 index 000000000..0d4fcb419 --- /dev/null +++ b/components/urimanager/uriManager.mli @@ -0,0 +1,73 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +exception IllFormedUri of string;; + +type uri + +val eq : uri -> uri -> bool +val compare : uri -> uri -> int + +val uri_of_string : string -> uri + +val string_of_uri : uri -> string (* complete uri *) +val name_of_uri : uri -> string (* name only (without extension)*) +val nameext_of_uri : uri -> string (* name only (with extension)*) +val buri_of_uri : uri -> string (* base uri only, without trailing '/' *) + +(* given an uri, returns the uri of the corresponding cic file, *) +(* i.e. removes the [.types][.ann] suffix *) +val cicuri_of_uri : uri -> uri + +val strip_xpointer: uri -> uri (* remove trailing #xpointer..., if any *) + +(* given an uri, returns the uri of the corresponding annotation file, *) +(* i.e. adds the .ann suffix if not already present *) +val annuri_of_uri : uri -> uri + +val uri_is_annuri : uri -> bool +val uri_is_var : uri -> bool +val uri_is_con : uri -> bool +val uri_is_ind : uri -> bool + +(* given an uri of a constant, it gives back the uri of its body *) +(* it gives back None if the uri refers to a Variable or MutualInductiveType *) +val bodyuri_of_uri : uri -> uri option + +(* given an uri, it gives back the uri of its inner types *) +val innertypesuri_of_uri : uri -> uri +(* given an uri, it gives back the uri of its univgraph *) +val univgraphuri_of_uri : uri -> uri + +(* builder for MutInd and MutConstruct URIs + * [uri] -> [typeno] -> [consno option] + *) +val uri_of_uriref : uri -> int -> int option -> uri + +module UriSet: Set.S with type elt = uri +(*module UriPairSet: Set.S with type elt = uri * uri*) + +module UriHashtbl : Hashtbl.S with type key = uri + diff --git a/components/whelp/.depend b/components/whelp/.depend new file mode 100644 index 000000000..39f37dfa9 --- /dev/null +++ b/components/whelp/.depend @@ -0,0 +1,4 @@ +whelp.cmo: whelp.cmi +whelp.cmx: whelp.cmi +fwdQueries.cmo: fwdQueries.cmi +fwdQueries.cmx: fwdQueries.cmi diff --git a/components/whelp/.depend.opt b/components/whelp/.depend.opt new file mode 100644 index 000000000..39f37dfa9 --- /dev/null +++ b/components/whelp/.depend.opt @@ -0,0 +1,4 @@ +whelp.cmo: whelp.cmi +whelp.cmx: whelp.cmi +fwdQueries.cmo: fwdQueries.cmi +fwdQueries.cmx: fwdQueries.cmi diff --git a/components/whelp/Makefile b/components/whelp/Makefile new file mode 100644 index 000000000..6d8d3958f --- /dev/null +++ b/components/whelp/Makefile @@ -0,0 +1,11 @@ +PACKAGE = whelp + +INTERFACE_FILES = \ + whelp.mli \ + fwdQueries.mli \ + $(NULL) + +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/whelp/fwdQueries.ml b/components/whelp/fwdQueries.ml new file mode 100644 index 000000000..5453c544e --- /dev/null +++ b/components/whelp/fwdQueries.ml @@ -0,0 +1,115 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +(* fwd_simpl ****************************************************************) + +let rec filter_map_n f n = function + | [] -> [] + | hd :: tl -> + match f n hd with + | None -> filter_map_n f (succ n) tl + | Some hd -> hd :: filter_map_n f (succ n) tl + +let get_uri t = + let aux = function + | Cic.Appl (hd :: tl) -> Some (CicUtil.uri_of_term hd, tl) + | hd -> Some (CicUtil.uri_of_term hd, []) + in + try aux t with + | Invalid_argument "uri_of_term" -> None + +let get_metadata t = + let f n t = + match get_uri t with + | None -> None + | Some (uri, _) -> Some (n, uri) + in + match get_uri t with + | None -> None + | Some (uri, args) -> Some (uri, filter_map_n f 1 args) + +let debug_metadata = function + | None -> () + | Some (outer, inners) -> + let f (n, uri) = Printf.eprintf "%s: %i %s\n" "fwd" n (UriManager.string_of_uri uri) in + Printf.eprintf "\n%s: %s\n" "fwd" (UriManager.string_of_uri outer); + List.iter f inners; prerr_newline () + +let fwd_simpl ~dbd t = + let map inners row = + match row.(0), row.(1), row.(2) with + | Some source, Some inner, Some index -> + source, + List.mem + (int_of_string index, (UriManager.uri_of_string inner)) inners + | _ -> "", false + in + let rec rank ranks (source, ok) = + match ranks, ok with + | [], false -> [source, 0] + | [], true -> [source, 1] + | (uri, i) :: tl, false when uri = source -> (uri, 0) :: tl + | (uri, 0) :: tl, true when uri = source -> (uri, 0) :: tl + | (uri, i) :: tl, true when uri = source -> (uri, succ i) :: tl + | hd :: tl, _ -> hd :: rank tl (source, ok) + in + let compare (_, x) (_, y) = compare x y in + let filter n (uri, rank) = + if rank > 0 then Some (UriManager.uri_of_string uri) else None + in + let metadata = get_metadata t in debug_metadata metadata; + match metadata with + | None -> [] + | Some (outer, inners) -> + let select = "source, h_inner, h_index" in + let from = "genLemma" in + let where = + Printf.sprintf "h_outer = \"%s\"" + (HSql.escape HSql.Library dbd (UriManager.string_of_uri outer)) in + let query = Printf.sprintf "SELECT %s FROM %s WHERE %s" select from where in + let result = HSql.exec HSql.Library dbd query in + let lemmas = HSql.map ~f:(map inners) result in + let ranked = List.fold_left rank [] lemmas in + let ordered = List.rev (List.fast_sort compare ranked) in + filter_map_n filter 0 ordered + +(* get_decomposables ********************************************************) + +let decomposables ~dbd = + let map row = match row.(0) with + | None -> None + | Some str -> + match CicUtil.term_of_uri (UriManager.uri_of_string str) with + | Cic.MutInd (uri, typeno, _) -> Some (uri, Some typeno) + | Cic.Const (uri, _) -> Some (uri, None) + | _ -> + raise (UriManager.IllFormedUri str) + in + let select, from = "source", "decomposables" in + let query = Printf.sprintf "SELECT %s FROM %s" select from in + let decomposables = HSql.map ~f:map (HSql.exec HSql.Library dbd query) in + filter_map_n (fun _ x -> x) 0 decomposables diff --git a/components/whelp/fwdQueries.mli b/components/whelp/fwdQueries.mli new file mode 100644 index 000000000..3e4936dec --- /dev/null +++ b/components/whelp/fwdQueries.mli @@ -0,0 +1,28 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val fwd_simpl: dbd:HSql.dbd -> Cic.term -> UriManager.uri list +val decomposables: dbd:HSql.dbd -> (UriManager.uri * int option) list + diff --git a/components/whelp/whelp.ml b/components/whelp/whelp.ml new file mode 100644 index 000000000..ef544f850 --- /dev/null +++ b/components/whelp/whelp.ml @@ -0,0 +1,232 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let nonvar uri = not (UriManager.uri_is_var uri) + + (** maps a shell like pattern (which uses '*' and '?') to a sql pattern for + * the "like" operator (which uses '%' and '_'). Does not support escaping. *) +let sqlpat_of_shellglob = + let star_RE, qmark_RE, percent_RE, uscore_RE = + Pcre.regexp "\\*", Pcre.regexp "\\?", Pcre.regexp "%", Pcre.regexp "_" + in + fun shellglob -> + Pcre.replace ~rex:star_RE ~templ:"%" + (Pcre.replace ~rex:qmark_RE ~templ:"_" + (Pcre.replace ~rex:percent_RE ~templ:"\\%" + (Pcre.replace ~rex:uscore_RE ~templ:"\\_" + shellglob))) + +let locate ~(dbd:HSql.dbd) ?(vars = false) pat = + let escape dbtype dbd s = HSql.escape dbtype dbd s in + let sql_pat = sqlpat_of_shellglob pat in + let query dbtype tbl = + sprintf + ("SELECT source FROM %s WHERE value LIKE \"%s\" " + ^^ HSql.escape_string_for_like dbtype dbd) + tbl (escape dbtype dbd sql_pat) + in + let tbls = + [HSql.User, MetadataTypes.name_tbl (); + HSql.Library, MetadataTypes.library_name_tbl; + HSql.Legacy, MetadataTypes.library_name_tbl] + in + let map cols = + match cols.(0) with + | Some s -> UriManager.uri_of_string s | _ -> assert false + in + let result = + List.fold_left + (fun acc (dbtype,tbl) -> + acc @ HSql.map ~f:map (HSql.exec dbtype dbd (query dbtype tbl))) + [] tbls + in + List.filter nonvar result + +let match_term ~(dbd:HSql.dbd) ty = +(* debug_print (lazy (CicPp.ppterm ty)); *) + let metadata = MetadataExtractor.compute ~body:None ~ty in + let constants_no = + MetadataConstraints.UriManagerSet.cardinal (MetadataConstraints.constants_of ty) + in + let full_card, diff = + if CicUtil.is_meta_closed ty then + Some (MetadataConstraints.Eq constants_no), None + else + let diff_no = + let (hyp_constants, concl_constants) = + (* collect different constants in hypotheses and conclusions *) + List.fold_left + (fun ((hyp, concl) as acc) metadata -> + match (metadata: MetadataTypes.metadata) with + | `Sort _ | `Rel _ -> acc + | `Obj (uri, `InConclusion) | `Obj (uri, `MainConclusion _) + when not (List.mem uri concl) -> (hyp, uri :: concl) + | `Obj (uri, `InHypothesis) | `Obj (uri, `MainHypothesis _) + when not (List.mem uri hyp) -> (uri :: hyp, concl) + | `Obj _ -> acc) + ([], []) + metadata + in + List.length hyp_constants - List.length concl_constants + in + let (concl_metas, hyp_metas) = MetadataExtractor.compute_metas ty in + let diff = + if MetadataExtractor.IntSet.equal concl_metas hyp_metas then + Some (MetadataConstraints.Eq diff_no) + else if MetadataExtractor.IntSet.subset concl_metas hyp_metas then + Some (MetadataConstraints.Gt (diff_no - 1)) + else if MetadataExtractor.IntSet.subset hyp_metas concl_metas then + Some (MetadataConstraints.Lt (diff_no + 1)) + else + None + in + None, diff + in + let constraints = List.map MetadataTypes.constr_of_metadata metadata in + MetadataConstraints.at_least ~dbd ?full_card ?diff constraints + +let fill_with_dummy_constants t = + let rec aux i types = + function + Cic.Lambda (n,s,t) -> + let dummy_uri = + UriManager.uri_of_string ("cic:/dummy_"^(string_of_int i)^".con") in + (aux (i+1) (s::types) + (CicSubstitution.subst (Cic.Const(dummy_uri,[])) t)) + | t -> t,types + in + let t,types = aux 0 [] t in + t, List.rev types + +let instance ~dbd t = + let t',types = fill_with_dummy_constants t in + let metadata = MetadataExtractor.compute ~body:None ~ty:t' in +(* List.iter + (fun x -> + debug_print + (lazy (MetadataPp.pp_constr (MetadataTypes.constr_of_metadata x)))) + metadata; *) + let no_concl = MetadataDb.count_distinct `Conclusion metadata in + let no_hyp = MetadataDb.count_distinct `Hypothesis metadata in + let no_full = MetadataDb.count_distinct `Statement metadata in + let is_dummy = function + | `Obj(s, _) -> (String.sub (UriManager.string_of_uri s) 0 10) <> "cic:/dummy" + | _ -> true + in + let rec look_for_dummy_main = function + | [] -> None + | `Obj(s,`MainConclusion (Some (MetadataTypes.Eq d)))::_ + when (String.sub (UriManager.string_of_uri s) 0 10 = "cic:/dummy") -> + let s = UriManager.string_of_uri s in + let len = String.length s in + let dummy_index = int_of_string (String.sub s 11 (len-15)) in + let dummy_type = List.nth types dummy_index in + Some (d,dummy_type) + | _::l -> look_for_dummy_main l + in + match (look_for_dummy_main metadata) with + | None-> +(* debug_print (lazy "Caso None"); *) + (* no dummy in main position *) + let metadata = List.filter is_dummy metadata in + let constraints = List.map MetadataTypes.constr_of_metadata metadata in + let concl_card = Some (MetadataConstraints.Eq no_concl) in + let full_card = Some (MetadataConstraints.Eq no_full) in + let diff = Some (MetadataConstraints.Eq (no_hyp - no_concl)) in + MetadataConstraints.at_least ~dbd ?concl_card ?full_card ?diff + constraints + | Some (depth, dummy_type) -> +(* debug_print + (lazy (sprintf "Caso Some %d %s" depth (CicPp.ppterm dummy_type))); *) + (* a dummy in main position *) + let metadata_for_dummy_type = + MetadataExtractor.compute ~body:None ~ty:dummy_type in + (* Let us skip this for the moment + let main_of_dummy_type = + look_for_dummy_main metadata_for_dummy_type in *) + let metadata = List.filter is_dummy metadata in + let constraints = List.map MetadataTypes.constr_of_metadata metadata in + let metadata_for_dummy_type = + List.filter is_dummy metadata_for_dummy_type in + let metadata_for_dummy_type, depth' = + (* depth' = the depth of the A -> A -> Prop *) + List.fold_left (fun (acc,dep) c -> + match c with + | `Sort (s,`MainConclusion (Some (MetadataTypes.Eq i))) -> + (`Sort (s,`MainConclusion (Some (MetadataTypes.Ge i))))::acc, i + | `Obj (s,`MainConclusion (Some (MetadataTypes.Eq i))) -> + (`Obj (s,`MainConclusion (Some (MetadataTypes.Ge i))))::acc, i + | `Rel (`MainConclusion (Some (MetadataTypes.Eq i))) -> + (`Rel (`MainConclusion (Some (MetadataTypes.Ge i))))::acc, i + | _ -> (c::acc,dep)) ([],0) metadata_for_dummy_type + in + let constraints_for_dummy_type = + List.map MetadataTypes.constr_of_metadata metadata_for_dummy_type in + (* start with the dummy constant in main conlusion *) + let from = ["refObj as table0"] in (* XXX table hardcoded *) + let where = + [sprintf "table0.h_position = \"%s\"" MetadataTypes.mainconcl_pos; + sprintf "table0.h_depth >= %d" depth] in + let (n,from,where) = + List.fold_left + (MetadataConstraints.add_constraint ~start:2) + (2,from,where) constraints in + let concl_card = Some (MetadataConstraints.Eq no_concl) in + let full_card = Some (MetadataConstraints.Eq no_full) in + let diff = Some (MetadataConstraints.Eq (no_hyp - no_concl)) in + let (n,from,where) = + MetadataConstraints.add_all_constr + (n,from,where) concl_card full_card diff in + (* join with the constraints over the type of the constant *) + let where = + (sprintf "table0.h_occurrence = table%d.source" n)::where in + let where = + sprintf "table0.h_depth - table%d.h_depth = %d" + n (depth - depth')::where + in + (* XXX performed only in library and legacy not user *) + let (m,from,where) = + List.fold_left + (MetadataConstraints.add_constraint ~start:n) + (n,from,where) constraints_for_dummy_type + in + MetadataConstraints.exec HSql.Library ~dbd (m,from,where) + @ + MetadataConstraints.exec HSql.Legacy ~dbd (m,from,where) + +let elim ~dbd uri = + let constraints = + [`Rel [`MainConclusion None]; + `Sort (Cic.Prop,[`MainHypothesis (Some (MetadataTypes.Ge 1))]); + `Obj (uri,[`MainHypothesis (Some (MetadataTypes.Eq 0))]); + `Obj (uri,[`InHypothesis]); + ] + in + MetadataConstraints.at_least ~rating:`Hits ~dbd constraints + diff --git a/components/whelp/whelp.mli b/components/whelp/whelp.mli new file mode 100644 index 000000000..80c4d6522 --- /dev/null +++ b/components/whelp/whelp.mli @@ -0,0 +1,30 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val locate: dbd:HSql.dbd -> ?vars:bool -> string -> UriManager.uri list +val elim: dbd:HSql.dbd -> UriManager.uri -> UriManager.uri list +val instance: dbd:HSql.dbd -> Cic.term -> UriManager.uri list +val match_term: dbd:HSql.dbd -> Cic.term -> UriManager.uri list + diff --git a/components/xml/.depend b/components/xml/.depend new file mode 100644 index 000000000..5ef59bdc9 --- /dev/null +++ b/components/xml/.depend @@ -0,0 +1,4 @@ +xml.cmo: xml.cmi +xml.cmx: xml.cmi +xmlPushParser.cmo: xmlPushParser.cmi +xmlPushParser.cmx: xmlPushParser.cmi diff --git a/components/xml/.depend.opt b/components/xml/.depend.opt new file mode 100644 index 000000000..5ef59bdc9 --- /dev/null +++ b/components/xml/.depend.opt @@ -0,0 +1,4 @@ +xml.cmo: xml.cmi +xml.cmx: xml.cmi +xmlPushParser.cmo: xmlPushParser.cmi +xmlPushParser.cmx: xmlPushParser.cmi diff --git a/components/xml/Makefile b/components/xml/Makefile new file mode 100644 index 000000000..7948435aa --- /dev/null +++ b/components/xml/Makefile @@ -0,0 +1,12 @@ +PACKAGE = xml +PREDICATES = + +INTERFACE_FILES = \ + xml.mli \ + xmlPushParser.mli +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/xml/test.ml b/components/xml/test.ml new file mode 100644 index 000000000..84c042e28 --- /dev/null +++ b/components/xml/test.ml @@ -0,0 +1,60 @@ +(* $Id$ *) + +(* Parsing test: + * - XmlPushParser version *) +open Printf +open XmlPushParser + +let print s = print_endline s; flush stdout + +let callbacks = + { default_callbacks with + start_element = + Some (fun tag attrs -> + let length = List.length attrs in + print (sprintf "opening %s [%s]" + tag (String.concat ";" (List.map fst attrs)))); + end_element = Some (fun tag -> print ("closing " ^ tag)); + character_data = Some (fun data -> print "character data ..."); + } + +let xml_parser = create_parser callbacks + +let is_gzip f = + try + let len = String.length f in + String.sub f (len - 3) 3 = ".gz" + with Invalid_argument _ -> false + +let _ = + let xml_source = + if is_gzip Sys.argv.(1) then + `Gzip_file Sys.argv.(1) + else + `File Sys.argv.(1) + in + parse xml_parser xml_source + +(* Parsing test: + * - Pure expat version (without XmlPushParser mediation). + * Originally written only to test if XmlPushParser mediation caused overhead. + * That was not the case. *) + +(*let _ =*) +(* let ic = open_in Sys.argv.(1) in*) +(* let expat_parser = Expat.parser_create ~encoding:None in*) +(* Expat.set_start_element_handler expat_parser*) +(* (fun tag attrs ->*) +(* let length = List.length attrs in*) +(* print (sprintf "opening %s [%d attribute%s]"*) +(* tag length (if length = 1 then "" else "s")));*) +(* Expat.set_end_element_handler expat_parser*) +(* (fun tag -> print ("closing " ^ tag));*) +(* Expat.set_character_data_handler expat_parser*) +(* (fun data -> print "character data ...");*) +(* try*) +(* while true do*) +(* Expat.parse expat_parser (input_line ic ^ "\n")*) +(* done*) +(* with End_of_file -> Expat.final expat_parser*) + diff --git a/components/xml/xml.ml b/components/xml/xml.ml new file mode 100644 index 000000000..0e3a4bcc2 --- /dev/null +++ b/components/xml/xml.ml @@ -0,0 +1,181 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(******************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* A tactic to print Coq objects in XML *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 18/10/2000 *) +(* *) +(* This module defines a pretty-printer and the stream of commands to the pp *) +(* *) +(******************************************************************************) + +(* $Id$ *) + + +(* the type token for XML cdata, empty elements and not-empty elements *) +(* Usage: *) +(* Str cdata *) +(* Empty (prefix, element_name, *) +(* [prefix1, attrname1, value1 ; ... ; prefixn, attrnamen, valuen] *) +(* NEmpty (prefix, element_name, *) +(* [prefix1, attrname1, value1 ; ... ; prefixn, attrnamen, valuen], *) +(* content *) +type token = + Str of string + | Empty of string option * string * (string option * string * string) list + | NEmpty of string option * string * (string option * string * string) list * + token Stream.t +;; + +(* currified versions of the constructors make the code more readable *) +let xml_empty ?prefix name attrs = + [< 'Empty(prefix,name,attrs) >] +let xml_nempty ?prefix name attrs content = + [< 'NEmpty(prefix,name,attrs,content) >] +let xml_cdata str = + [< 'Str str >] + +(** low level for other PPs: pretty print each token of strm applying 'f' to a +canonical string representation of each token *) +let pp_gen f strm = + let pprefix = + function + None -> "" + | Some p -> p ^ ":" in + let rec pp_r m = + parser + | [< 'Str a ; s >] -> + print_spaces m ; + f (a ^ "\n") ; + pp_r m s + | [< 'Empty(p,n,l) ; s >] -> + print_spaces m ; + f ("<" ^ (pprefix p) ^ n) ; + List.iter (fun (p,n,v) -> f (" " ^ (pprefix p) ^ n ^ "=\"" ^ v ^ "\"")) l; + f "/>\n" ; + pp_r m s + | [< 'NEmpty(p,n,l,c) ; s >] -> + print_spaces m ; + f ("<" ^ (pprefix p) ^ n) ; + List.iter (fun (p,n,v) -> f (" " ^ (pprefix p) ^ n ^ "=\"" ^ v ^ "\"")) l; + f ">\n" ; + pp_r (m+1) c ; + print_spaces m ; + f ("\n") ; + pp_r m s + | [< >] -> () + and print_spaces m = + for i = 1 to m do f " " done + in + pp_r 0 strm +;; + +(** pretty printer on output channels *) +let pp_to_outchan strm oc = + pp_gen (fun s -> output_string oc s) strm; + flush oc +;; + +let pp_to_gzipchan strm oc = + pp_gen (fun s -> Gzip.output oc s 0 (String.length s)) strm +;; + +(** pretty printer to string *) +let pp_to_string strm = + let buf = Buffer.create 10240 in + pp_gen (Buffer.add_string buf) strm; + Buffer.contents buf +;; + +(** pretty printer to file *) +(* Usage: *) +(* pp tokens None pretty prints the output on stdout *) +(* pp tokens (Some filename) pretty prints the output on the file filename *) +let pp ?(gzip=false) strm fn = + if gzip then + match fn with + | Some filename -> + let outchan = Gzip.open_out filename in + begin try + pp_to_gzipchan strm outchan; + with e -> + Gzip.close_out outchan; + raise e + end; + Gzip.close_out outchan; + HExtlib.chmod 0o664 filename; + | None -> failwith "Can't sent gzipped output to stdout" + else + match fn with + | Some filename -> + let outchan = open_out filename in + begin try + pp_to_outchan strm outchan; + with e -> + close_out outchan; + raise e + end; + close_out outchan; + HExtlib.chmod 0o664 filename + | None -> pp_to_outchan strm stdout +;; + +let pp = + let profiler = HExtlib.profile "Xml.pp" in + fun ?gzip strm fn -> + profiler.HExtlib.profile (pp ?gzip strm) fn +;; + +let add_xml_declaration stream = + let box_prefix = "b" in + [< + xml_cdata "\n" ; + xml_cdata "\n"; + xml_nempty ~prefix:box_prefix "box" + [ Some "xmlns","m","http://www.w3.org/1998/Math/MathML" ; + Some "xmlns","b","http://helm.cs.unibo.it/2003/BoxML" ; + Some "xmlns","helm","http://www.cs.unibo.it/helm" ; + Some "xmlns","xlink","http://www.w3.org/1999/xlink" + ] stream + >] + + (* TODO BRRRRR .... *) + (** strip first 4 line of a string, used to strip xml declaration and doctype + declaration from XML strings generated by Xml.pp_to_string *) +let strip_xml_headings s = + let rec aux n pos = + if n = 0 + then String.sub s pos (String.length s - pos) + else aux (n - 1) (String.index_from s pos '\n' + 1) + in + try + aux 4 0 + with Not_found -> s + diff --git a/components/xml/xml.mli b/components/xml/xml.mli new file mode 100644 index 000000000..4feca7503 --- /dev/null +++ b/components/xml/xml.mli @@ -0,0 +1,75 @@ +(* Copyright (C) 2000, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(******************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* A tactic to print Coq objects in XML *) +(* *) +(* Claudio Sacerdoti Coen *) +(* 18/10/2000 *) +(* *) +(* This module defines a pretty-printer and the stream of commands to the pp *) +(* *) +(******************************************************************************) + +(* Tokens for XML cdata, empty elements and not-empty elements *) +(* Usage: *) +(* Str cdata *) +(* Empty (prefix, element_name, *) +(* [prefix1, attrname1, value1 ; ... ; prefixn, attrnamen, valuen] *) +(* NEmpty (prefix, element_name, *) +(* [prefix1, attrname1, value1 ; ... ; prefixn, attrnamen, valuen], *) +(* content *) +type token = + Str of string + | Empty of string option * string * (string option * string * string) list + | NEmpty of string option * string * (string option * string * string) list * + token Stream.t +;; + +(* currified versions of the token constructors make the code more readable *) +val xml_empty : + ?prefix:string -> string -> (string option * string * string) list -> + token Stream.t +val xml_nempty : + ?prefix:string -> string -> (string option * string * string) list -> + token Stream.t -> token Stream.t +val xml_cdata : string -> token Stream.t + +(* The pretty printer for streams of token *) +(* Usage: *) +(* pp tokens None pretty prints the output on stdout *) +(* pp tokens (Some filename) pretty prints the output on the file filename +* @param gzip if set to true files are gzipped. Defaults to false *) +val pp : ?gzip:bool -> token Stream.t -> string option -> unit +val pp_to_outchan : token Stream.t -> out_channel -> unit +val pp_to_string : token Stream.t -> string + +val add_xml_declaration: token Stream.t -> token Stream.t + +val strip_xml_headings: string -> string + diff --git a/components/xml/xmlPushParser.ml b/components/xml/xmlPushParser.ml new file mode 100644 index 000000000..4f57e1242 --- /dev/null +++ b/components/xml/xmlPushParser.ml @@ -0,0 +1,118 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let gzip_bufsize = 10240 + +type callbacks = { + start_element: (string -> (string * string) list -> unit) option; + end_element: (string -> unit) option; + character_data: (string -> unit) option; + processing_instruction: (string -> string -> unit) option; + comment: (string -> unit) option; +} + +let default_callbacks = { + start_element = None; + end_element = None; + character_data = None; + processing_instruction = None; + comment = None; +} + +type xml_source = + [ `Channel of in_channel + | `File of string + | `Gzip_channel of Gzip.in_channel + | `Gzip_file of string + | `String of string + ] + +type position = int * int + +type xml_parser = Expat.expat_parser + +exception Parse_error of string + +let create_parser callbacks = + let expat_parser = Expat.parser_create ~encoding:None in + (match callbacks.start_element with + | Some f -> Expat.set_start_element_handler expat_parser f + | _ -> ()); + (match callbacks.end_element with + | Some f -> Expat.set_end_element_handler expat_parser f + | _ -> ()); + (match callbacks.character_data with + | Some f -> Expat.set_character_data_handler expat_parser f + | _ -> ()); + (match callbacks.processing_instruction with + | Some f -> Expat.set_processing_instruction_handler expat_parser f + | _ -> ()); + (match callbacks.comment with + | Some f -> Expat.set_comment_handler expat_parser f + | _ -> ()); + expat_parser + +let final = Expat.final + +let get_position expat_parser = + (Expat.get_current_line_number expat_parser, + Expat.get_current_column_number expat_parser) + +let parse expat_parser = + let parse_fun = Expat.parse expat_parser in + let rec aux = function + | `Channel ic -> + (try + while true do parse_fun (input_line ic ^ "\n") done + with End_of_file -> final expat_parser) + | `File fname -> + let ic = open_in fname in + aux (`Channel ic); + close_in ic + | `Gzip_channel ic -> + let buf = String.create gzip_bufsize in + (try + while true do + let bytes = Gzip.input ic buf 0 gzip_bufsize in + if bytes = 0 then raise End_of_file; + parse_fun (String.sub buf 0 bytes) + done + with End_of_file -> final expat_parser) + | `Gzip_file fname -> + let ic = Gzip.open_in fname in + aux (`Gzip_channel ic); + Gzip.close_in ic + | `String s -> parse_fun s + in + aux + +let parse expat_parser xml_source = + try + parse expat_parser xml_source + with Expat.Expat_error xml_error -> + raise (Parse_error (Expat.xml_error_to_string xml_error)) + diff --git a/components/xml/xmlPushParser.mli b/components/xml/xmlPushParser.mli new file mode 100644 index 000000000..c13481c91 --- /dev/null +++ b/components/xml/xmlPushParser.mli @@ -0,0 +1,78 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 XLM push parser generic interface} + * Do not depend on CIC *) + + (** callbacks needed to instantiate a parser *) +type callbacks = { + start_element: + (string -> (string * string) list -> unit) option; (* tag, attr list *) + end_element: (string -> unit) option; (* tag *) + character_data: (string -> unit) option; (* data *) + processing_instruction: + (string -> string -> unit) option; (* target, value *) + comment: (string -> unit) option; (* value *) +} + + (** do nothing callbacks (all set to None) *) +val default_callbacks: callbacks + + (** source from which parse an XML file *) +type xml_source = + [ `Channel of in_channel + | `File of string + | `Gzip_channel of Gzip.in_channel + | `Gzip_file of string + | `String of string + ] + + (** source position in a XML source. + * A position is a pair *) +type position = int * int + +type xml_parser + + (** raised when a parse error occurs, argument is an error message. + * This exception carries no position information, but it should be get using + * get_position below *) +exception Parse_error of string + + (** Create a push parser which invokes the given callbacks *) +val create_parser: callbacks -> xml_parser + + (** Parse XML data from a given source with a given parser + * @raise Parse_error *) +val parse: xml_parser -> xml_source -> unit + + (** Inform the parser that parsing is completed, needed only when source is + * `String, for other sources it is automatically invoked when the end of file + * is reached + * @raise Parse_error *) +val final: xml_parser -> unit + + (** @return current pair *) +val get_position: xml_parser -> position + diff --git a/components/xmldiff/.depend b/components/xmldiff/.depend new file mode 100644 index 000000000..e2832de33 --- /dev/null +++ b/components/xmldiff/.depend @@ -0,0 +1,2 @@ +xmlDiff.cmo: xmlDiff.cmi +xmlDiff.cmx: xmlDiff.cmi diff --git a/components/xmldiff/.depend.opt b/components/xmldiff/.depend.opt new file mode 100644 index 000000000..e2832de33 --- /dev/null +++ b/components/xmldiff/.depend.opt @@ -0,0 +1,2 @@ +xmlDiff.cmo: xmlDiff.cmi +xmlDiff.cmx: xmlDiff.cmi diff --git a/components/xmldiff/Makefile b/components/xmldiff/Makefile new file mode 100644 index 000000000..afffaeefb --- /dev/null +++ b/components/xmldiff/Makefile @@ -0,0 +1,10 @@ +PACKAGE = xmldiff +PREDICATES = + +INTERFACE_FILES = xmlDiff.mli +IMPLEMENTATION_FILES = $(INTERFACE_FILES:%.mli=%.ml) +EXTRA_OBJECTS_TO_INSTALL = +EXTRA_OBJECTS_TO_CLEAN = + +include ../../Makefile.defs +include ../Makefile.common diff --git a/components/xmldiff/xmlDiff.ml b/components/xmldiff/xmlDiff.ml new file mode 100644 index 000000000..6f68438e9 --- /dev/null +++ b/components/xmldiff/xmlDiff.ml @@ -0,0 +1,345 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +let mathmlns = "http://www.w3.org/1998/Math/MathML";; +let xmldiffns = "http://helm.cs.unibo.it/XmlDiff";; +let helmns = "http://www.cs.unibo.it/helm";; + +let ds_selection = Gdome.domString "selection";; +let ds_2 = Gdome.domString "2";; +let ds_mathmlns = Gdome.domString mathmlns;; +let ds_m_style = Gdome.domString "m:mstyle";; +let ds_mathbackground = Gdome.domString "mathbackground";; +let ds_xmldiffns = Gdome.domString xmldiffns;; +let ds_xmldiff_type = Gdome.domString "xmldiff:type";; +let ds_fake = Gdome.domString "fake";; +let ds_helmns = Gdome.domString helmns;; +let ds_xref = Gdome.domString "xref";; +let ds_type = Gdome.domString "type";; +let ds_yellow = Gdome.domString "yellow";; +let ds_green = Gdome.domString "#00ff00";; +let ds_maction = Gdome.domString "maction";; +let ds_mtr = Gdome.domString "mtr";; +let ds_mtd = Gdome.domString "mtd";; + +type highlighted_nodes = Gdome.node list;; + +let rec make_visible (n: Gdome.node) = + match n#get_parentNode with + None -> () + | Some p -> + match p#get_namespaceURI, p#get_localName with + Some nu, Some ln when + nu#equals ds_mathmlns && ln#equals ds_maction -> + (new Gdome.element_of_node p)#setAttribute + ~name:ds_selection + ~value:ds_2 ; + make_visible p + | _,_ -> make_visible p +;; + +let highlight_node_total_time = ref 0.0;; + +let highlight_node ?(color=ds_yellow) (doc: Gdome.document) (n: Gdome.node) = + let highlight (n: Gdome.node) = + let highlighter = + doc#createElementNS + ~namespaceURI:(Some ds_mathmlns) + ~qualifiedName:ds_m_style + in + highlighter#setAttribute ~name:ds_mathbackground ~value:color ; + highlighter#setAttributeNS + ~namespaceURI:(Some ds_xmldiffns) + ~qualifiedName:ds_xmldiff_type + ~value:ds_fake ; + let parent = + match n#get_parentNode with + None -> assert false + | Some p -> p + in + ignore + (parent#replaceChild ~oldChild:n ~newChild:(highlighter :> Gdome.node)) ; + ignore (highlighter#appendChild n) ; + (highlighter :> Gdome.node) + in + let rec find_mstylable_node n = + match n#get_namespaceURI, n#get_localName with + Some nu, Some ln when + nu#equals ds_mathmlns && + (not (ln#equals ds_mtr)) && (not (ln#equals ds_mtd)) -> n + | Some nu, Some ln when + nu#equals ds_mathmlns && + ln#equals ds_mtr || ln#equals ds_mtd -> + let true_child = + match n#get_firstChild with + None -> assert false + | Some n -> n + in + find_mstylable_node true_child + | _,_ -> + match n#get_parentNode with + None -> assert false + | Some p -> find_mstylable_node p + in + let highlighter = highlight (find_mstylable_node n) in + make_visible highlighter ; + highlighter +;; + +let iter_children ~f (n:Gdome.node) = + let rec aux = + function + None -> () + | Some n -> + let sibling = n#get_nextSibling in + (f n) ; + aux sibling + in + aux n#get_firstChild +;; + +let highlight_nodes ~xrefs (doc:Gdome.document) = + let highlighted = ref [] in + let rec aux (n:Gdome.element) = + let attributeNS = + (n#getAttributeNS ~namespaceURI:ds_helmns + ~localName:ds_xref)#to_string in + if List.mem attributeNS xrefs then + highlighted := + (highlight_node ~color:ds_green doc (n :> Gdome.node)):: + !highlighted ; + iter_children (n :> Gdome.node) + ~f:(function n -> + if n#get_nodeType = GdomeNodeTypeT.ELEMENT_NODE then + aux (new Gdome.element_of_node n)) + in + aux doc#get_documentElement ; + !highlighted +;; + +let dim_nodes = + List.iter + (function (n : Gdome.node) -> + assert + (n#get_nodeType = GdomeNodeTypeT.ELEMENT_NODE && + ((new Gdome.element_of_node n)#getAttributeNS + ~namespaceURI:ds_xmldiffns + ~localName:ds_type)#equals ds_fake) ; + let true_child = + match n#get_firstChild with + None -> assert false + | Some n -> n in + let p = + match n#get_parentNode with + None -> assert false + | Some n -> n + in + ignore (p#replaceChild ~oldChild:n ~newChild:true_child) + ) +;; + +let update_dom ~(from : Gdome.document) (d : Gdome.document) = + let rec aux (p: Gdome.node) (f: Gdome.node) (t: Gdome.node) = + let replace t1 = + if + t1 = GdomeNodeTypeT.ELEMENT_NODE && + ((new Gdome.element_of_node f)#getAttributeNS + ~namespaceURI:ds_xmldiffns + ~localName:ds_type)#equals ds_fake + then + let true_child = + match f#get_firstChild with + None -> assert false + | Some n -> n + in + begin + ignore (p#replaceChild ~oldChild:f ~newChild:true_child) ; + aux p true_child t + end + else + let t' = from#importNode t true in + ignore (p#replaceChild ~newChild:t' ~oldChild:f) ; + (* ignore (highlight_node from t') *) + in + match + f#get_nodeType,t#get_nodeType + with + GdomeNodeTypeT.TEXT_NODE,GdomeNodeTypeT.TEXT_NODE -> + (match f#get_nodeValue, t#get_nodeValue with + Some v, Some v' when v#equals v' -> () + | Some _, (Some _ as v') -> f#set_nodeValue v' + | _,_ -> assert false) + | GdomeNodeTypeT.ELEMENT_NODE as t1,GdomeNodeTypeT.ELEMENT_NODE -> + (match + f#get_namespaceURI,t#get_namespaceURI,f#get_localName,t#get_localName + with + Some nu, Some nu', Some ln, Some ln' when + ln#equals ln' && nu#equals nu' -> + begin + match f#get_attributes, t#get_attributes with + Some fattrs, Some tattrs -> + let flen = fattrs#get_length in + let tlen = tattrs#get_length in + let processed = ref [] in + for i = 0 to flen -1 do + match fattrs#item i with + None -> () (* CSC: sigh, togliere un nodo rompe fa decrescere la lunghezza ==> passare a un while *) + | Some attr -> + match attr#get_namespaceURI with + None -> + (* Back to DOM Level 1 ;-( *) + begin + let name = attr#get_nodeName in + match tattrs#getNamedItem ~name with + None -> + ignore (fattrs#removeNamedItem ~name) + | Some attr' -> + processed := + (None,Some name)::!processed ; + match attr#get_nodeValue, attr'#get_nodeValue with + Some v1, Some v2 when + v1#equals v2 + || (name#equals ds_selection && + nu#equals ds_mathmlns && + ln#equals ds_maction) + -> + () + | Some v1, Some v2 -> + let attr'' = from#importNode attr' true in + ignore (fattrs#setNamedItem attr'') + | _,_ -> assert false + end + | Some namespaceURI -> + let localName = + match attr#get_localName with + Some v -> v + | None -> assert false + in + match + tattrs#getNamedItemNS ~namespaceURI ~localName + with + None -> + ignore + (fattrs#removeNamedItemNS + ~namespaceURI ~localName) + | Some attr' -> + processed := + (Some namespaceURI,Some localName)::!processed ; + match attr#get_nodeValue, attr'#get_nodeValue with + Some v1, Some v2 when + v1#equals v2 -> + () + | Some _, Some _ -> + let attr'' = from#importNode attr' true in + ignore (fattrs#setNamedItem attr'') + | _,_ -> assert false + done ; + for i = 0 to tlen -1 do + match tattrs#item i with + None -> assert false + | Some attr -> + let namespaceURI,localName = + match attr#get_namespaceURI with + None -> + None,attr#get_nodeName + | Some namespaceURI as v -> + v, match attr#get_localName with + None -> assert false + | Some v -> v + in + if + not + (List.exists + (function + None,Some localName' -> + (match namespaceURI with + None -> + localName#equals localName' + | Some _ -> false) + | Some namespaceURI', Some localName' -> + (match namespaceURI with + None -> false + | Some namespaceURI -> + localName#equals localName' && + namespaceURI#equals namespaceURI' + ) + | _,_ -> assert false + ) !processed) + then + let attr' = from#importNode attr false in + ignore (fattrs#setNamedItem attr') + done + | _,_ -> assert false + end ; + let rec dumb_diff = + function + [],[] -> () + | he1::tl1,he2::tl2 -> + aux f he1 he2 ; + dumb_diff (tl1,tl2) + | [],tl2 -> + List.iter + (function n -> + let n' = from#importNode n true in + ignore (f#appendChild n') ; + (* ignore (highlight_node from n') *) + () + ) tl2 + | tl1,[] -> + List.iter (function n -> ignore (f#removeChild n)) tl1 + in + let node_list_of_nodeList n = + let rec aux = + function + None -> [] + | Some n when + n#get_nodeType = GdomeNodeTypeT.ELEMENT_NODE + or n#get_nodeType = GdomeNodeTypeT.TEXT_NODE -> + n::(aux n#get_nextSibling) + | Some n -> + aux n#get_nextSibling + in + aux n#get_firstChild + in + dumb_diff + (node_list_of_nodeList f, node_list_of_nodeList t) + | _,_,_,_ -> replace t1 + ) + | t1,t2 when + (t1 = GdomeNodeTypeT.ELEMENT_NODE || t1 = GdomeNodeTypeT.TEXT_NODE) && + (t2 = GdomeNodeTypeT.ELEMENT_NODE || t2 = GdomeNodeTypeT.TEXT_NODE) -> + replace t1 + | _,_ -> assert false + in + try + aux (d :> Gdome.node) + (from#get_documentElement :> Gdome.node) + (d#get_documentElement :> Gdome.node) + with + (GdomeInit.DOMException (e,msg) as ex) -> raise ex + | e -> raise e +;; diff --git a/components/xmldiff/xmlDiff.mli b/components/xmldiff/xmlDiff.mli new file mode 100644 index 000000000..cf084af94 --- /dev/null +++ b/components/xmldiff/xmlDiff.mli @@ -0,0 +1,30 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +val update_dom: from: Gdome.document -> Gdome.document -> unit + +type highlighted_nodes +val highlight_nodes: xrefs:(string list) -> Gdome.document -> highlighted_nodes +val dim_nodes: highlighted_nodes -> unit diff --git a/configure.ac b/configure.ac new file mode 100644 index 000000000..f985336ca --- /dev/null +++ b/configure.ac @@ -0,0 +1,194 @@ +AC_INIT(matita/matitaTypes.ml) + +# Distribution settings +# (i.e. settings (automatically) manipulated before a release) +DEBUG_DEFAULT="true" +DEFAULT_DBHOST="mysql://mowgli.cs.unibo.it" +RT_BASE_DIR_DEFAULT="`pwd`/matita" +MATITA_VERSION="0.4.98" +DISTRIBUTED="no" # "yes" for distributed tarballs +# End of distribution settings + +SRCROOT=`pwd` +AC_CHECK_PROG(HAVE_OCAMLC, ocamlc, yes, no) +if test $HAVE_OCAMLC = "no"; then + AC_MSG_ERROR(could not find ocamlc) +fi +AC_CHECK_PROG(HAVE_OCAMLOPT, ocamlopt, yes, no) +if test $HAVE_OCAMLOPT = "no"; then + AC_MSG_WARN(could not find ocamlopt: native code compilation disabled) +fi +AC_CHECK_PROG(HAVE_OCAMLFIND, ocamlfind, yes, no) +if test $HAVE_OCAMLFIND = "yes"; then + OCAMLFIND="ocamlfind" +else + AC_MSG_ERROR(could not find ocamlfind) +fi +AC_CHECK_PROG(HAVE_LABLGLADECC, lablgladecc2, yes, no) +if test $HAVE_LABLGLADECC = "yes"; then + LABLGLADECC="lablgladecc2" +else + AC_MSG_ERROR(could not find lablgladecc2) +fi +AC_CHECK_PROG(HAVE_CAMLP5O, camlp5o, yes, no) +if test $HAVE_CAMLP5O = "yes"; then + CAMLP5O="camlp5o" +else + AC_MSG_ERROR(could not find camlp5o) +fi + +# look for METAS dir + +LIBSPATH="`pwd`/components" +OCAMLPATH="$LIBSPATH/METAS" + +# creating META.* + +echo -n "creating METAs ... " +for f in $OCAMLPATH/meta.*.src; do + basename=`basename $f` + metaname=`echo $basename | sed 's/meta\.\(.*\)\.src/\1/'` + dirname=`echo $metaname | sed 's/^helm-//'` + metafile="$OCAMLPATH/META.$metaname" + cp $f $metafile + echo "directory=\"$LIBSPATH/$dirname\"" >> $metafile +done +echo "done" + +# (libs) findlib requisites + +FINDLIB_LIBSREQUIRES="\ +expat \ +gdome2 \ +http \ +lablgtk2 \ +lablgtksourceview.gtksourceview \ +lablgtkmathview \ +mysql \ +netstring \ +ulex08 \ +zip \ +" + +# (Matita) findlib requisites + +FINDLIB_COMREQUIRES="\ +helm-cic_disambiguation \ +helm-grafite \ +helm-grafite_engine \ +helm-tptp_grafite \ +helm-grafite_parser \ +helm-acic_procedural \ +helm-content_pres \ +helm-hgdome \ +helm-tactics \ +helm-cic_exportation \ +" +FINDLIB_CREQUIRES=" \ +$FINDLIB_COMREQUIRES \ +" +FINDLIB_REQUIRES="\ +$FINDLIB_CREQUIRES \ +lablgtk2.glade \ +lablgtkmathview \ +lablgtksourceview.gtksourceview \ +helm-xmldiff \ +" +for r in $FINDLIB_LIBSREQUIRES $FINDLIB_REQUIRES +do + AC_MSG_CHECKING(for $r ocaml library) + if OCAMLPATH=$OCAMLPATH $OCAMLFIND query $r &> /dev/null; then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR(could not find $r ocaml library) + fi +done + +OCAMLFIND_COMMANDS="" +# AC_CHECK_PROG(HAVE_OCAMLC_OPT, ocamlc.opt, yes, no) +# if test $HAVE_OCAMLC_OPT = "yes"; then +# if test "$OCAMLFIND_COMMANDS" = ""; then +# OCAMLFIND_COMMANDS="ocamlc=ocamlc.opt" +# else +# OCAMLFIND_COMMANDS="$OCAMLFIND_COMMANDS ocamlc=ocamlc.opt" +# fi +# fi +# AC_CHECK_PROG(HAVE_OCAMLOPT_OPT, ocamlopt.opt, yes, no) +# if test $HAVE_OCAMLOPT_OPT = "yes"; then +# if test "$OCAMLFIND_COMMANDS" = ""; then +# OCAMLFIND_COMMANDS="ocamlopt=ocamlopt.opt" +# else +# OCAMLFIND_COMMANDS="$OCAMLFIND_COMMANDS ocamlopt=ocamlopt.opt" +# fi +# fi +if test "$OCAMLFIND_COMMANDS" != ""; then + OCAMLFIND="OCAMLFIND_COMMANDS='$OCAMLFIND_COMMANDS' $OCAMLFIND" +fi + +AC_MSG_CHECKING(--enable-debug argument) +AC_ARG_ENABLE(debug, + [ --enable-debug Turn on debugging], + [GIVEN="yes"; + case "${enableval}" in + yes) DEBUG=true ;; + no) DEBUG=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; + esac], + [GIVEN="no"; DEBUG="$DEBUG_DEFAULT"]) +MSG=$GIVEN +if test "$DEBUG" = "true"; then + MSG="$MSG, debugging enabled." +else + MSG="$MSG, debugging disabled." +fi +AC_MSG_RESULT($MSG) + +AC_MSG_CHECKING(--with-runtime-dir argument) +AC_ARG_WITH(runtime-dir, + [ --with-runtime-dir Runtime directory (current working directory if not given)], + [ RT_BASE_DIR="${withval}" ], + [ RT_BASE_DIR="$RT_BASE_DIR_DEFAULT" ]) +MSG="$RT_BASE_DIR" +if test "yes" = "$RT_BASE_DIR"; then + MSG=" +** error: ** +** empty --with-runtime-dir argument, please use --with-runtime-dir=value **" +fi +AC_MSG_RESULT($MSG) + +AC_MSG_CHECKING(--with-dbhost argument) +AC_ARG_WITH(dbhost, + [ --with-dbhost SQL database hostname], + [ DBHOST="${withval}" ], + [ DBHOST="$DEFAULT_DBHOST" ]) +MSG="$DBHOST" +if test "yes" = "$DBHOST"; then + MSG=" +** error: ** +** empty --with-dbhost argument, please use --with-dbhost=value **" +fi +AC_MSG_RESULT($MSG) + +AC_SUBST(CAMLP5O) +AC_SUBST(DBHOST) +AC_SUBST(DEBUG) +AC_SUBST(DISTRIBUTED) +AC_SUBST(FINDLIB_CREQUIRES) +AC_SUBST(FINDLIB_REQUIRES) +AC_SUBST(HAVE_OCAMLOPT) +AC_SUBST(LABLGLADECC) +AC_SUBST(MATITA_VERSION) +AC_SUBST(OCAMLFIND) +AC_SUBST(OCAMLPATH) +AC_SUBST(RT_BASE_DIR) +AC_SUBST(SRCROOT) +AC_SUBST(TRANSFORMER_MODULE) + +AC_OUTPUT([ + components/extlib/componentsConf.ml + matita/matita.conf.xml + matita/buildTimeConf.ml + matita/gtkmathview.matita.conf.xml + matita/help/C/version.txt + Makefile.defs +]) diff --git a/make/main.ml b/make/main.ml new file mode 100644 index 000000000..df20a35f2 --- /dev/null +++ b/make/main.ml @@ -0,0 +1,34 @@ + +module F = struct + type source_object = string + type target_object = string + let string_of_source_object s = s + let string_of_target_object s = s + let target_of s = s ^ ".o" + let build t = + print_string ("build "^t^"\n"); flush stdout; + ignore(Unix.system ("touch "^target_of t)) + ;; + let mtime_of_source_object s = + try Some (Unix.stat s).Unix.st_mtime + with Unix.Unix_error (Unix.ENOENT, "stat", f) when f = s -> + prerr_endline ("Source file not found: "^s);assert false + ;; + let mtime_of_target_object t = + try Some (Unix.stat t).Unix.st_mtime + with Unix.Unix_error (Unix.ENOENT, "stat", f) when f = t -> None + ;; +end + +module M = Make.Make(F) + +let deps = [ + "a.c", [ "b.c"; "d.c" ]; + "b.c", [ "c.c"; "d.c" ]; + "c.c", []; + "d.c", ["e.c"]; + "e.c", []; + ] +;; + +M.make deps;; diff --git a/make/make.ml b/make/make.ml new file mode 100644 index 000000000..c243d7935 --- /dev/null +++ b/make/make.ml @@ -0,0 +1,103 @@ + +module type Format = sig + + type source_object + type target_object + + val target_of : source_object -> target_object + val string_of_source_object : source_object -> string + val string_of_target_object : target_object -> string + + val build : source_object -> unit + + val mtime_of_source_object : source_object -> float option + val mtime_of_target_object : target_object -> float option +end + +module Make = functor (F:Format) -> struct + + let prerr_endline _ = ();; + + let younger_s_t a b = + match F.mtime_of_source_object a, F.mtime_of_target_object b with + | Some a, Some b -> a < b + | _ -> false (* XXX check if correct *) + ;; + let younger_t_t a b = + match F.mtime_of_target_object a, F.mtime_of_target_object b with + | Some a, Some b -> a < b + | _ -> false (* XXX check if correct *) + ;; + + let is_built t = younger_s_t t (F.target_of t);; + + let rec needs_build deps compiled (t,dependencies) = + prerr_endline ("Checking if "^F.string_of_source_object t^" needs to be built"); + if List.mem t compiled then + (prerr_endline "already compiled"; + false) + else + if not (is_built t) then + (prerr_endline (F.string_of_source_object t^ + " is not built, thus needs to be built"); + true) + else + try + let unsat = + List.find + (needs_build deps compiled) + (List.map (fun x -> x, List.assoc x deps) dependencies) + in + prerr_endline + (F.string_of_source_object t^" depends on "^F.string_of_source_object (fst unsat)^ + " that needs to be built, thus needs to be built"); + true + with Not_found -> + try + let unsat = + List.find (younger_t_t (F.target_of t)) (List.map F.target_of dependencies) + in + prerr_endline + (F.string_of_source_object t^" depends on "^F.string_of_target_object + unsat^" and "^F.string_of_source_object t^".o is younger than "^ + F.string_of_target_object unsat^", thus needs to be built"); + true + with Not_found -> false + ;; + + let is_buildable compiled deps (t,dependencies) = + prerr_endline ("Checking if "^F.string_of_source_object t^" is buildable"); + let b = needs_build deps compiled (t,dependencies) in + if not b then + (prerr_endline (F.string_of_source_object t^ + " does not need to be built, thus it not buildable"); + false) + else + try + let unsat = + List.find (needs_build deps compiled) + (List.map (fun x -> x, List.assoc x deps) dependencies) + in + prerr_endline + (F.string_of_source_object t^" depends on "^ + F.string_of_source_object (fst unsat)^ + " that needs build, thus is not buildable"); + false + with Not_found -> + prerr_endline + ("None of "^F.string_of_source_object t^ + " dependencies needs to be built, thus it is buildable"); + true + ;; + + let rec make compiled deps = + let todo = List.filter (is_buildable compiled deps) deps in + if todo <> [] then + (List.iter F.build (List.map fst todo); + make (compiled@List.map fst todo) deps) + ;; + + let make deps = make [] deps + +end + diff --git a/make/make.mli b/make/make.mli new file mode 100644 index 000000000..8830a8319 --- /dev/null +++ b/make/make.mli @@ -0,0 +1,18 @@ + +module type Format = + sig + type source_object + type target_object + val target_of : source_object -> target_object + val string_of_source_object : source_object -> string + val string_of_target_object : target_object -> string + val build : source_object -> unit + val mtime_of_source_object : source_object -> float option + val mtime_of_target_object : target_object -> float option + end + +module Make : + functor (F : Format) -> + sig + val make : (F.source_object * F.source_object list) list -> unit + end diff --git a/make/test/a.c b/make/test/a.c new file mode 100644 index 000000000..e69de29bb diff --git a/make/test/b.c b/make/test/b.c new file mode 100644 index 000000000..e69de29bb diff --git a/make/test/c.c b/make/test/c.c new file mode 100644 index 000000000..e69de29bb diff --git a/make/test/d.c b/make/test/d.c new file mode 100644 index 000000000..e69de29bb diff --git a/make/test/e.c b/make/test/e.c new file mode 100644 index 000000000..e69de29bb diff --git a/matita/.depend b/matita/.depend new file mode 100644 index 000000000..b0d8efc5b --- /dev/null +++ b/matita/.depend @@ -0,0 +1,87 @@ +applyTransformation.cmo: applyTransformation.cmi +applyTransformation.cmx: applyTransformation.cmi +dump_moo.cmo: buildTimeConf.cmo +dump_moo.cmx: buildTimeConf.cmx +gragrep.cmo: matitaInit.cmi buildTimeConf.cmo gragrep.cmi +gragrep.cmx: matitaInit.cmx buildTimeConf.cmx gragrep.cmi +lablGraphviz.cmo: lablGraphviz.cmi +lablGraphviz.cmx: lablGraphviz.cmi +matitaAutoGui.cmo: matitaGeneratedGui.cmo applyTransformation.cmi \ + matitaAutoGui.cmi +matitaAutoGui.cmx: matitaGeneratedGui.cmx applyTransformation.cmx \ + matitaAutoGui.cmi +matitaclean.cmo: matitaMisc.cmi matitaInit.cmi matitaclean.cmi +matitaclean.cmx: matitaMisc.cmx matitaInit.cmx matitaclean.cmi +matitacLib.cmo: matitamakeLib.cmi matitaMisc.cmi matitaInit.cmi \ + matitaExcPp.cmi matitaEngine.cmi buildTimeConf.cmo \ + applyTransformation.cmi matitacLib.cmi +matitacLib.cmx: matitamakeLib.cmx matitaMisc.cmx matitaInit.cmx \ + matitaExcPp.cmx matitaEngine.cmx buildTimeConf.cmx \ + applyTransformation.cmx matitacLib.cmi +matitac.cmo: matitaprover.cmi matitamake.cmi matitadep.cmi matitaclean.cmi \ + matitacLib.cmi matitaWiki.cmo matitaInit.cmi matitaEngine.cmi gragrep.cmi +matitac.cmx: matitaprover.cmx matitamake.cmx matitadep.cmx matitaclean.cmx \ + matitacLib.cmx matitaWiki.cmx matitaInit.cmx matitaEngine.cmx gragrep.cmx +matitadep.cmo: matitaInit.cmi matitadep.cmi +matitadep.cmx: matitaInit.cmx matitadep.cmi +matitaEngine.cmo: matitaEngine.cmi +matitaEngine.cmx: matitaEngine.cmi +matitaExcPp.cmo: matitaExcPp.cmi +matitaExcPp.cmx: matitaExcPp.cmi +matitaGtkMisc.cmo: matitaTypes.cmi matitaGeneratedGui.cmo buildTimeConf.cmo \ + matitaGtkMisc.cmi +matitaGtkMisc.cmx: matitaTypes.cmx matitaGeneratedGui.cmx buildTimeConf.cmx \ + matitaGtkMisc.cmi +matitaGui.cmo: matitaprover.cmi matitamakeLib.cmi matitaTypes.cmi \ + matitaScript.cmi matitaMisc.cmi matitaMathView.cmi matitaGtkMisc.cmi \ + matitaGeneratedGui.cmo matitaExcPp.cmi matitaAutoGui.cmi \ + buildTimeConf.cmo matitaGui.cmi +matitaGui.cmx: matitaprover.cmx matitamakeLib.cmx matitaTypes.cmx \ + matitaScript.cmx matitaMisc.cmx matitaMathView.cmx matitaGtkMisc.cmx \ + matitaGeneratedGui.cmx matitaExcPp.cmx matitaAutoGui.cmx \ + buildTimeConf.cmx matitaGui.cmi +matitaInit.cmo: matitamakeLib.cmi matitaExcPp.cmi buildTimeConf.cmo \ + matitaInit.cmi +matitaInit.cmx: matitamakeLib.cmx matitaExcPp.cmx buildTimeConf.cmx \ + matitaInit.cmi +matitamakeLib.cmo: buildTimeConf.cmo matitamakeLib.cmi +matitamakeLib.cmx: buildTimeConf.cmx matitamakeLib.cmi +matitamake.cmo: matitamakeLib.cmi matitaInit.cmi matitamake.cmi +matitamake.cmx: matitamakeLib.cmx matitaInit.cmx matitamake.cmi +matitaMathView.cmo: matitamakeLib.cmi matitaTypes.cmi matitaScript.cmi \ + matitaMisc.cmi matitaGuiTypes.cmi matitaGtkMisc.cmi matitaExcPp.cmi \ + lablGraphviz.cmi buildTimeConf.cmo applyTransformation.cmi \ + matitaMathView.cmi +matitaMathView.cmx: matitamakeLib.cmx matitaTypes.cmx matitaScript.cmx \ + matitaMisc.cmx matitaGuiTypes.cmi matitaGtkMisc.cmx matitaExcPp.cmx \ + lablGraphviz.cmx buildTimeConf.cmx applyTransformation.cmx \ + matitaMathView.cmi +matitaMisc.cmo: buildTimeConf.cmo matitaMisc.cmi +matitaMisc.cmx: buildTimeConf.cmx matitaMisc.cmi +matita.cmo: matitaTypes.cmi matitaScript.cmi matitaMathView.cmi \ + matitaInit.cmi matitaGui.cmi matitaGtkMisc.cmi matitaAutoGui.cmi \ + buildTimeConf.cmo applyTransformation.cmi +matita.cmx: matitaTypes.cmx matitaScript.cmx matitaMathView.cmx \ + matitaInit.cmx matitaGui.cmx matitaGtkMisc.cmx matitaAutoGui.cmx \ + buildTimeConf.cmx applyTransformation.cmx +matitaprover.cmo: matitaInit.cmi matitaExcPp.cmi matitaEngine.cmi \ + buildTimeConf.cmo matitaprover.cmi +matitaprover.cmx: matitaInit.cmx matitaExcPp.cmx matitaEngine.cmx \ + buildTimeConf.cmx matitaprover.cmi +matitaScript.cmo: matitamakeLib.cmi matitaTypes.cmi matitaMisc.cmi \ + matitaGtkMisc.cmi matitaEngine.cmi buildTimeConf.cmo \ + applyTransformation.cmi matitaScript.cmi +matitaScript.cmx: matitamakeLib.cmx matitaTypes.cmx matitaMisc.cmx \ + matitaGtkMisc.cmx matitaEngine.cmx buildTimeConf.cmx \ + applyTransformation.cmx matitaScript.cmi +matitaTypes.cmo: matitaTypes.cmi +matitaTypes.cmx: matitaTypes.cmi +matitaWiki.cmo: matitaInit.cmi matitaExcPp.cmi matitaEngine.cmi \ + buildTimeConf.cmo applyTransformation.cmi +matitaWiki.cmx: matitaInit.cmx matitaExcPp.cmx matitaEngine.cmx \ + buildTimeConf.cmx applyTransformation.cmx +matitaGtkMisc.cmi: matitaGeneratedGui.cmo +matitaGui.cmi: matitaGuiTypes.cmi +matitaGuiTypes.cmi: matitaTypes.cmi matitaGeneratedGui.cmo +matitaMathView.cmi: matitaTypes.cmi matitaGuiTypes.cmi +matitaScript.cmi: matitaTypes.cmi diff --git a/matita/.depend.opt b/matita/.depend.opt new file mode 100644 index 000000000..933d2bb51 --- /dev/null +++ b/matita/.depend.opt @@ -0,0 +1,85 @@ +applyTransformation.cmo: applyTransformation.cmi +applyTransformation.cmx: applyTransformation.cmi +dump_moo.cmo: buildTimeConf.cmx +dump_moo.cmx: buildTimeConf.cmx +gragrep.cmo: matitaInit.cmi buildTimeConf.cmx gragrep.cmi +gragrep.cmx: matitaInit.cmx buildTimeConf.cmx gragrep.cmi +lablGraphviz.cmo: lablGraphviz.cmi +lablGraphviz.cmx: lablGraphviz.cmi +matitaAutoGui.cmo: matitaGeneratedGui.cmx matitaAutoGui.cmi +matitaAutoGui.cmx: matitaGeneratedGui.cmx matitaAutoGui.cmi +matitaclean.cmo: matitaMisc.cmi matitaInit.cmi matitaclean.cmi +matitaclean.cmx: matitaMisc.cmx matitaInit.cmx matitaclean.cmi +matitacLib.cmo: matitamakeLib.cmi matitaMisc.cmi matitaInit.cmi \ + matitaExcPp.cmi matitaEngine.cmi buildTimeConf.cmx \ + applyTransformation.cmi matitacLib.cmi +matitacLib.cmx: matitamakeLib.cmx matitaMisc.cmx matitaInit.cmx \ + matitaExcPp.cmx matitaEngine.cmx buildTimeConf.cmx \ + applyTransformation.cmx matitacLib.cmi +matitac.cmo: matitaprover.cmi matitamake.cmi matitadep.cmi matitaclean.cmi \ + matitacLib.cmi matitaWiki.cmx matitaInit.cmi matitaEngine.cmi gragrep.cmi +matitac.cmx: matitaprover.cmx matitamake.cmx matitadep.cmx matitaclean.cmx \ + matitacLib.cmx matitaWiki.cmx matitaInit.cmx matitaEngine.cmx gragrep.cmx +matitadep.cmo: matitaInit.cmi matitadep.cmi +matitadep.cmx: matitaInit.cmx matitadep.cmi +matitaEngine.cmo: matitaEngine.cmi +matitaEngine.cmx: matitaEngine.cmi +matitaExcPp.cmo: matitaExcPp.cmi +matitaExcPp.cmx: matitaExcPp.cmi +matitaGtkMisc.cmo: matitaTypes.cmi matitaGeneratedGui.cmx buildTimeConf.cmx \ + matitaGtkMisc.cmi +matitaGtkMisc.cmx: matitaTypes.cmx matitaGeneratedGui.cmx buildTimeConf.cmx \ + matitaGtkMisc.cmi +matitaGui.cmo: matitaprover.cmi matitamakeLib.cmi matitaTypes.cmi \ + matitaScript.cmi matitaMisc.cmi matitaMathView.cmi matitaGtkMisc.cmi \ + matitaGeneratedGui.cmx matitaExcPp.cmi matitaAutoGui.cmi \ + buildTimeConf.cmx matitaGui.cmi +matitaGui.cmx: matitaprover.cmx matitamakeLib.cmx matitaTypes.cmx \ + matitaScript.cmx matitaMisc.cmx matitaMathView.cmx matitaGtkMisc.cmx \ + matitaGeneratedGui.cmx matitaExcPp.cmx matitaAutoGui.cmx \ + buildTimeConf.cmx matitaGui.cmi +matitaInit.cmo: matitamakeLib.cmi matitaExcPp.cmi buildTimeConf.cmx \ + matitaInit.cmi +matitaInit.cmx: matitamakeLib.cmx matitaExcPp.cmx buildTimeConf.cmx \ + matitaInit.cmi +matitamakeLib.cmo: buildTimeConf.cmx matitamakeLib.cmi +matitamakeLib.cmx: buildTimeConf.cmx matitamakeLib.cmi +matitamake.cmo: matitamakeLib.cmi matitaInit.cmi matitamake.cmi +matitamake.cmx: matitamakeLib.cmx matitaInit.cmx matitamake.cmi +matitaMathView.cmo: matitamakeLib.cmi matitaTypes.cmi matitaScript.cmi \ + matitaMisc.cmi matitaGuiTypes.cmi matitaGtkMisc.cmi matitaExcPp.cmi \ + lablGraphviz.cmi buildTimeConf.cmx applyTransformation.cmi \ + matitaMathView.cmi +matitaMathView.cmx: matitamakeLib.cmx matitaTypes.cmx matitaScript.cmx \ + matitaMisc.cmx matitaGuiTypes.cmi matitaGtkMisc.cmx matitaExcPp.cmx \ + lablGraphviz.cmx buildTimeConf.cmx applyTransformation.cmx \ + matitaMathView.cmi +matitaMisc.cmo: buildTimeConf.cmx matitaMisc.cmi +matitaMisc.cmx: buildTimeConf.cmx matitaMisc.cmi +matita.cmo: matitaTypes.cmi matitaScript.cmi matitaMathView.cmi \ + matitaInit.cmi matitaGui.cmi matitaGtkMisc.cmi matitaAutoGui.cmi \ + buildTimeConf.cmx applyTransformation.cmi +matita.cmx: matitaTypes.cmx matitaScript.cmx matitaMathView.cmx \ + matitaInit.cmx matitaGui.cmx matitaGtkMisc.cmx matitaAutoGui.cmx \ + buildTimeConf.cmx applyTransformation.cmx +matitaprover.cmo: matitaInit.cmi matitaExcPp.cmi matitaEngine.cmi \ + buildTimeConf.cmx matitaprover.cmi +matitaprover.cmx: matitaInit.cmx matitaExcPp.cmx matitaEngine.cmx \ + buildTimeConf.cmx matitaprover.cmi +matitaScript.cmo: matitamakeLib.cmi matitaTypes.cmi matitaMisc.cmi \ + matitaGtkMisc.cmi matitaEngine.cmi buildTimeConf.cmx \ + applyTransformation.cmi matitaScript.cmi +matitaScript.cmx: matitamakeLib.cmx matitaTypes.cmx matitaMisc.cmx \ + matitaGtkMisc.cmx matitaEngine.cmx buildTimeConf.cmx \ + applyTransformation.cmx matitaScript.cmi +matitaTypes.cmo: matitaTypes.cmi +matitaTypes.cmx: matitaTypes.cmi +matitaWiki.cmo: matitaInit.cmi matitaExcPp.cmi matitaEngine.cmi \ + buildTimeConf.cmx applyTransformation.cmi +matitaWiki.cmx: matitaInit.cmx matitaExcPp.cmx matitaEngine.cmx \ + buildTimeConf.cmx applyTransformation.cmx +matitaGtkMisc.cmi: matitaGeneratedGui.cmx +matitaGui.cmi: matitaGuiTypes.cmi +matitaGuiTypes.cmi: matitaTypes.cmi matitaGeneratedGui.cmx +matitaMathView.cmi: matitaTypes.cmi matitaGuiTypes.cmi +matitaScript.cmi: matitaTypes.cmi diff --git a/matita/.ocamlinit b/matita/.ocamlinit new file mode 100644 index 000000000..d936ad579 --- /dev/null +++ b/matita/.ocamlinit @@ -0,0 +1,45 @@ +(* directories *) +#directory "../components/cic" +#directory "../components/cic_notation" +#directory "../components/cic_omdoc" +#directory "../components/cic_proof_checking" +#directory "../components/cic_textual_parser2" +#directory "../components/cic_transformations" +#directory "../components/cic_unification" +#directory "../components/getter" +#directory "../components/hbugs" +#directory "../components/mathql" +#directory "../components/mathql_generator" +#directory "../components/mathql_interpreter" +#directory "../components/metadata" +#directory "../components/paramodulation" +#directory "../components/registry" +#directory "../components/tactics" +#directory "../components/thread" +#directory "../components/urimanager" +#directory "../components/xml" +#directory "../components/xmldiff" + +(* custom printers *) +let fppuri ppf uri = + let s = UriManager.string_of_uri uri in + Format.pp_print_string ppf s +;; + +#install_printer CicMetaSubst.fppsubst;; +#install_printer CicMetaSubst.fppterm;; +#install_printer CicMetaSubst.fppmetasenv;; +#install_printer fppuri;; + +(* utility functions *) +let go = MatitacLib.interactive_loop;; + +(* let's go! *) +let _ = + at_exit (fun () -> MatitacLib.clean_exit None); + MatitaInit.initialize_all () ; + if Array.length Sys.argv > 1 then + MatitacLib.main `TOPLEVEL + else + MatitacLib.go () +;; diff --git a/matita/AUTHORS b/matita/AUTHORS new file mode 100644 index 000000000..2b999b173 --- /dev/null +++ b/matita/AUTHORS @@ -0,0 +1,6 @@ +Andrea Asperti +Ferruccio Guidi +Luca Padovani +Enrico Tassi +Claudio Sacerdoti Coen +Stefano Zacchiroli diff --git a/matita/LICENSE b/matita/LICENSE new file mode 100644 index 000000000..9e2c40cfe --- /dev/null +++ b/matita/LICENSE @@ -0,0 +1,24 @@ +Copyright (C) 2000-2006, HELM Team. + +Matita is part of HELM, an Hypertextual, Electronic +Library of Mathematics, developed at the Computer Science +Department, University of Bologna, Italy. + +HELM is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +HELM is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with HELM; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +02110-1301 USA + +For details, see the HELM World-Wide-Web page, +http://helm.cs.unibo.it/ + diff --git a/matita/Makefile b/matita/Makefile new file mode 100644 index 000000000..6595af73e --- /dev/null +++ b/matita/Makefile @@ -0,0 +1,468 @@ +export SHELL=/bin/bash + +include ../Makefile.defs + +NULL = +H=@ + +OCAML_FLAGS = -pp $(CAMLP5O) -rectypes +OCAMLDEP_FLAGS = -pp $(CAMLP5O) +PKGS = -package "$(MATITA_REQUIRES)" +CPKGS = -package "$(MATITA_CREQUIRES)" +OCAML_THREADS_FLAGS = -thread +OCAML_DEBUG_FLAGS = -g +#OCAML_PROF=p -p a +#OCAMLOPT_DEBUG_FLAGS = -p +OCAMLC_FLAGS = $(OCAML_FLAGS) $(OCAML_THREADS_FLAGS) +OCAMLC = $(OCAMLFIND) ocamlc$(OCAML_PROF) $(OCAMLC_FLAGS) $(OCAML_DEBUG_FLAGS) +OCAMLOPT = $(OCAMLFIND) opt $(OCAMLC_FLAGS) $(OCAMLOPT_DEBUG_FLAGS) +OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAMLDEP_FLAGS) +INSTALL_PROGRAMS= matita matitac +INSTALL_PROGRAMS_LINKS_MATITA= cicbrowser +INSTALL_PROGRAMS_LINKS_MATITAC= matitadep matitamake matitaclean matitaprover matitawiki + +MATITA_FLAGS = -noprofile +NODB=false +ifeq ($(NODB),true) + MATITA_FLAGS += -nodb +endif + +MLI = \ + lablGraphviz.mli \ + matitaTypes.mli \ + matitaMisc.mli \ + matitamakeLib.mli \ + matitaExcPp.mli \ + matitaInit.mli \ + matitaEngine.mli \ + applyTransformation.mli \ + matitaAutoGui.mli \ + matitacLib.mli \ + matitaprover.mli \ + matitaGtkMisc.mli \ + matitaScript.mli \ + matitaMathView.mli \ + matitaGui.mli \ + $(NULL) +CMLI = \ + matitaTypes.mli \ + matitaMisc.mli \ + matitamakeLib.mli \ + matitaExcPp.mli \ + matitaInit.mli \ + matitaEngine.mli \ + applyTransformation.mli \ + matitacLib.mli \ + matitaWiki.mli \ + matitaprover.mli \ + $(NULL) +MAINCMLI = \ + matitadep.mli \ + matitaclean.mli \ + matitamake.mli \ + gragrep.mli \ + $(NULL) +# objects for matita (GTK GUI) +ML = buildTimeConf.ml matitaGeneratedGui.ml $(MLI:%.mli=%.ml) +# objects for matitac (batch compiler) +CML = buildTimeConf.ml $(CMLI:%.mli=%.ml) +MAINCML = $(MAINCMLI:%.mli=%.ml) + +PROGRAMS_BYTE = \ + matita matitac cicbrowser matitadep matitaclean \ + matitamake matitaprover matitawiki +PROGRAMS = $(PROGRAMS_BYTE) matitatop +PROGRAMS_OPT = $(patsubst %,%.opt,$(PROGRAMS_BYTE)) +NOINST_PROGRAMS = dump_moo gragrep +NOINST_PROGRAMS_OPT = $(patsubst %,%.opt,$(EXTRA_PROGRAMS)) + +.PHONY: all +all: $(PROGRAMS) $(NOINST_PROGRAMS) + +CMOS = $(ML:%.ml=%.cmo) +CCMOS = $(CML:%.ml=%.cmo) +MAINCMOS = $(MAINCML:%.ml=%.cmo) +CMXS = $(patsubst %.cmo,%.cmx,$(CMOS)) +CCMXS = $(patsubst %.cmo,%.cmx,$(CCMOS)) +MAINCMXS = $(patsubst %.cmo,%.cmx,$(MAINCMOS)) +$(CMOS) : $(LIB_DEPS) +$(CMXOS): $(LIBX_DEPS) + +LIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_REQUIRES)) +LIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_REQUIRES)) +CLIB_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "byte" -format "%d/%a" $(MATITA_CREQUIRES)) +CLIBX_DEPS := $(shell $(OCAMLFIND) query -recursive -predicates "native" -format "%d/%a" $(MATITA_CREQUIRES)) +opt: $(PROGRAMS_OPT) $(NOINST_PROGRAMS_OPT) +upx: $(PROGRAMS_UPX) +.PHONY: opt upx + +ifeq ($(HAVE_OCAMLOPT),yes) +world: depend.opt opt links +else +world: depend all +endif + +#links %.opt -> % +links: + $(H)for X in $(INSTALL_PROGRAMS_LINKS_MATITAC) \ + $(INSTALL_PROGRAMS_LINKS_MATITA); do\ + ln -sf $$X.opt $$X;\ + done + $(H)ln -sf matita.opt matita + $(H)ln -sf matitac.opt matitac + +linkonly: + $(H)echo " OCAMLC matita.ml" + $(H)$(OCAMLC) $(PKGS) -linkpkg -o matita $(CMOS) matita.ml + $(H)echo " OCAMLC matitac.ml" + $(H)$(OCAMLC) $(CPKGS) -linkpkg -o matitac $(CCMOS) $(MAINCMOS) matitac.ml +.PHONY: linkonly +matita: matita.ml $(LIB_DEPS) $(CMOS) + $(H)echo " OCAMLC $<" + $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ $(CMOS) matita.ml +matita.opt: matita.ml $(LIBX_DEPS) $(CMXS) + $(H)echo " OCAMLOPT $<" + $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml + +dump_moo: dump_moo.ml buildTimeConf.cmo + $(H)echo " OCAMLC $<" + $(H)$(OCAMLC) $(PKGS) -linkpkg -o $@ buildTimeConf.cmo $< +dump_moo.opt: dump_moo.ml buildTimeConf.cmx + $(H)echo "OCAMLOPT $<" + $(H)$(OCAMLOPT) $(PKGS) -linkpkg -o $@ buildTimeConf.cmx $< + +matitac: matitac.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS) + $(H)echo " OCAMLC $<" + $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ $(CCMOS) $(MAINCMOS) matitac.ml +matitac.opt: matitac.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) + $(H)echo " OCAMLOPT $<" + $(H)$(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml + +rottener: rottener.ml $(CLIB_DEPS) $(CCMOS) $(MAINCMOS) + $(H)echo " OCAMLC $<" + $(H)$(OCAMLC) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMOS) $(MAINCMOS) rottener.ml +rottener.opt: rottener.ml $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) + $(H)echo " OCAMLOPT $<" + $(H)$(OCAMLOPT) $(CPKGS) -package lablgtk2 -linkpkg -o $@ $(CCMXS) $(MAINCMXS) rottener.ml +clean-rottened: + find . -type f -name "*.ma.*.rottened" -exec rm {} \; + +matitatop: matitatop.ml $(CLIB_DEPS) $(CCMOS) + $(H)echo " OCAMLC $<" + $(H)$(OCAMLC) $(CPKGS) -linkpkg -o $@ toplevellib.cma $(CCMOS) $< + +matitaprover: matitac + $(H)test -f $@ || ln -s $< $@ +matitaprover.opt: matitac.opt + $(H)test -f $@ || ln -s $< $@ + +matitadep: matitac + $(H)test -f $@ || ln -s $< $@ +matitadep.opt: matitac.opt + $(H)test -f $@ || ln -s $< $@ + +matitawiki: matitac + $(H)test -f $@ || ln -s $< $@ +matitawiki.opt: matitac.opt + $(H)test -f $@ || ln -s $< $@ + +matitaclean: matitac + $(H)test -f $@ || ln -s $< $@ +matitaclean.opt: matitac.opt + $(H)test -f $@ || ln -s $< $@ + +matitamake: matitac + $(H)test -f $@ || ln -s $< $@ +matitamake.opt: matitac.opt + $(H)test -f $@ || ln -s $< $@ + +gragrep: matitac + $(H)test -f $@ || ln -s $< $@ +gragrep.opt: matitac.opt + $(H)test -f $@ || ln -s $< $@ + +cicbrowser: matita + $(H)test -f $@ || ln -s $< $@ +cicbrowser.opt: matita.opt + $(H)test -f $@ || ln -s $< $@ + +matitaGeneratedGui.ml: matita.glade + $(H)$(LABLGLADECC) -embed $< > matitaGeneratedGui.ml + +.PHONY: clean +clean: + $(H)rm -rf *.cma *.cmo *.cmi *.cmx *.cmxa *.a *.o \ + $(PROGRAMS) $(PROGRAMS_OPT) \ + rottener rottener.opt \ + $(NOINST_PROGRAMS) $(NOINST_PROGRAMS_OPT) \ + $(PROGRAMS_STATIC) \ + $(PROGRAMS_UPX) \ + *.stamp \ + $(NULL) + +.PHONY: distclean +distclean: clean + $(H)$(MAKE) -C dist/ clean + $(H)rm -f matitaGeneratedGui.ml matitaGeneratedGui.mli + $(H)rm -f buildTimeConf.ml + $(H)rm -f matita.glade.bak matita.gladep.bak + $(H)rm -f matita.conf.xml.sample + $(H)rm -rf .matita + +TEST_DIRS = \ + legacy \ + library \ + tests \ + dama \ + contribs/CoRN \ + contribs/RELATIONAL \ + contribs/LOGIC \ + contribs/LAMBDA-TYPES \ + contribs/PREDICATIVE-TOPOLOGY \ + $(NULL) + +# library_auto +TEST_DIRS_OPT = \ + $(TEST_DIRS) \ + $(NULL) + +.PHONY: tests tests.opt cleantests cleantests.opt +tests: $(foreach d,$(TEST_DIRS),$(d)-test) +tests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-test-opt) +cleantests: $(foreach d,$(TEST_DIRS),$(d)-cleantests) +cleantests.opt: $(foreach d,$(TEST_DIRS_OPT),$(d)-cleantests-opt) + +%-test: matitac matitadep matitaclean + -cd $* && make -k clean all +%-test-opt: matitac.opt matitadep.opt matitaclean.opt + -cd $* && make -k clean.opt opt +%-cleantests: matitaclean + -cd $* && make clean +%-cleantests-opt: matitaclean.opt + -cd $* && make clean.opt + +# {{{ Distribution stuff + +ifeq ($(DISTRIBUTED),yes) + + +dist_library: install_preliminaries dist_library@standard-library +dist_library@%: + $(H)echo "MATITAMAKE init $*" + $(H)(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitamake init $* $(WHERE)/ma/$*) + $(H)echo "MATITAMAKE publish $*" + $(H)(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitamake publish $*) + $(H)echo "MATITAMAKE destroy $*" + $(H)(HOME=$(WHERE) USER=builder MATITA_RT_BASE_DIR=$(WHERE) MATITA_FLAGS='$(MATITA_CFLAGS)' $(WHERE)/matitamake destroy $*) + # sqlite3 only + $(H)cp $(WHERE)/.matita/matita.db $(WHERE)/metadata.db || true + #$(H)rm -rf $(WHERE)/.matita/ + touch $@ + +endif + +dist_pre: matitaGeneratedGui.ml + $(MAKE) -C dist/ dist_pre + +WHERE = $(DESTDIR)/$(RT_BASE_DIR) +INSTALL_STUFF = \ + icons/ \ + help/ \ + matita.gtkrc \ + matita.lang \ + matita.ma.templ \ + core_notation.moo \ + matita.conf.xml \ + closed.xml \ + gtkmathview.matita.conf.xml \ + template_makefile.in \ + AUTHORS \ + LICENSE \ + $(NULL) + +ifeq ($(HAVE_OCAMLOPT),yes) +INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS:%=%.opt) +else +INSTALL_STUFF_BIN = $(INSTALL_PROGRAMS) +endif + +install-arch: install_preliminaries +install-indep: dist_library + +install_preliminaries : install_preliminaries.stamp + +install_preliminaries.stamp: + $(H)install -d $(WHERE)/ma/ + $(H)cp -a $(INSTALL_STUFF) $(WHERE) +ifeq ($(HAVE_OCAMLOPT),yes) + $(H)install -s $(INSTALL_STUFF_BIN) $(WHERE) + $(H)for p in $(INSTALL_PROGRAMS); do ln -fs $$p.opt $(WHERE)/$$p; done +else + $(H)install $(INSTALL_STUFF_BIN) $(WHERE) +endif + $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITAC); do \ + ln -fs matitac $(WHERE)/$$p;\ + done + $(H)for p in $(INSTALL_PROGRAMS_LINKS_MATITA); do \ + ln -fs matita $(WHERE)/$$p;\ + done + $(H)cp -a library/ $(WHERE)/ma/standard-library + #$(H)cp -a contribs/ $(WHERE)/ma/ + $(H)touch install_preliminaries.stamp + +uninstall: + $(H)rm -rf $(WHERE) + +STATIC_LINK = dist/static_link/static_link +# for matita +STATIC_LIBS = \ + t1 t1x \ + gtkmathview_gmetadom mathview mathview_backend_gtk mathview_frontend_gmetadom \ + gtksourceview-1.0 \ + gdome gmetadom_gdome_cpp_smart \ + stdc++ \ + mysqlclient \ + expat \ + $(NULL) +STATIC_EXTRA_LIBS = -cclib -lt1x -cclib -lstdc++ +# for matitac & co +STATIC_CLIBS = \ + gdome \ + mysqlclient \ + $(NULL) +STATIC_CLIBS_PROVER = \ + $(STATIC_CLIBS) \ + z \ + pcre \ + expat \ + xml2 \ + glib-2.0 \ + $(NULL) +STATIC_EXTRA_CLIBS = +PROGRAMS_STATIC = $(patsubst %,%.static,$(PROGRAMS_OPT)) +PROGRAMS_UPX = $(patsubst %,%.upx,$(PROGRAMS_STATIC)) + +ifeq ($(HAVE_OCAMLOPT),yes) +static: $(STATIC_LINK) $(PROGRAMS_STATIC) +else +upx: + $(H)echo "Native code compilation is disabled" +static: + $(H)echo "Native code compilation is disabled" +endif + +$(STATIC_LINK): + $(MAKE) -C dist/ $(STATIC_LINK) + +matita.opt.static: $(STATIC_LINK) $(LIBX_DEPS) $(CMXS) matita.ml + $(STATIC_LINK) $(STATIC_LIBS) -- \ + $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $(CMXS) matita.ml \ + $(STATIC_EXTRA_LIBS) + strip $@ +dump_moo.opt.static: $(STATIC_LINK) buildTimeConf.cmx dump_moo.ml + $(STATIC_LINK) $(STATIC_CLIBS) -- \ + $(OCAMLOPT) $(PKGS) -linkpkg -o $@ $^ \ + $(STATIC_EXTRA_CLIBS) + strip $@ +matitac.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml + $(STATIC_LINK) $(STATIC_CLIBS) -- \ + $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \ + $(STATIC_EXTRA_CLIBS) + strip $@ +matitaprover.opt.static: $(STATIC_LINK) $(CLIBX_DEPS) $(CCMXS) $(MAINCMXS) matitac.ml + $(STATIC_LINK) $(STATIC_CLIBS_PROVER) -- \ + $(OCAMLOPT) $(CPKGS) -linkpkg -o $@ $(CCMXS) $(MAINCMXS) matitac.ml \ + $(STATIC_EXTRA_CLIBS); + strip $@ +matitadep.opt.static: matitac.opt.static + $(H)test -f $@ || ln -s $< $@ +matitaclean.opt.static: matitac.opt.static + $(H)test -f $@ || ln -s $< $@ +matitawiki.opt.static: matitac.opt.static + $(H)test -f $@ || ln -s $< $@ +matitamake.opt.static: matitac.opt.static + $(H)test -f $@ || ln -s $< $@ +cicbrowser.opt.static: matita.opt.static + $(H)test -f $@ || ln -s $< $@ +cicbrowser.opt.static.upx: matita.opt.static.upx + $(H)test -f $@ || ln -s $< $@ + +%.upx: % + cp $< $@ + strip $@ + upx $@ + +# }}} End of distribution stuff + +# {{{ Deps and automatic rules +tags: TAGS +.PHONY: TAGS +TAGS: + $(H)cd ..; otags -vi -r components/ matita/ + +.PHONY: depend + +depend: + $(H)echo " OCAMLDEP" + $(H)$(OCAMLDEP) *.ml *.mli > .depend +depend.opt: + $(H)echo " OCAMLDEP -native" + $(H)$(OCAMLDEP) -native *.ml *.mli > .depend.opt + +# this should be sligtly better, since should work with 'make all opt' +MAKECMDGOALS_DELIM=$(addprefix _x_,$(addsuffix _x_,$(MAKECMDGOALS))) +ifneq (,$(findstring _x_all_x_,$(MAKECMDGOALS_DELIM))) + # if we 'make all opt' the deps for 'all' should be fine also for opt + # if we 'make opt all' it should not work... + INCLUDE_MANDATORY=yes + TO_INCLUDE+=.depend + TO_DEPEND_ON=$(LIB_DEPS) +else ifneq (,$(findstring _x_opt_x_,$(MAKECMDGOALS_DELIM))) + INCLUDE_MANDATORY=yes + TO_INCLUDE+=.depend.opt + TO_DEPEND_ON=$(LIBX_DEPS) +else ifneq (,$(findstring _x_world_x_,$(MAKECMDGOALS_DELIM))) + ifeq ($(HAVE_OCAMLOPT),yes) + INCLUDE_MANDATORY=yes + TO_INCLUDE+=.depend.opt + TO_DEPEND_ON=$(LIBX_DEPS) + else + INCLUDE_MANDATORY=yes + TO_INCLUDE+=.depend + TO_DEPEND_ON=$(LIB_DEPS) + endif +else + TO_INCLUDE+=.depend + INCLUDE_MANDATORY=no + TO_DEPEND_ON=$(LIB_DEPS) +endif + +$(MLI:%.mli=%.cmi) $(ML:%.ml=%.cmo) $(ML:%.ml=%.cmx): $(TO_DEPEND_ON) + +ifeq (no,$(INCLUDE_MANDATORY)) + -include $(TO_INCLUDE) +else + include $(TO_INCLUDE) +endif + +%.cmi: %.mli + $(H)echo " OCAMLC $<" + $(H)$(OCAMLC) $(PKGS) -c $< +%.cmo %.cmi: %.ml + $(H)echo " OCAMLC $<" + $(H)$(OCAMLC) $(PKGS) -c $< +%.cmx: %.ml + $(H)echo " OCAMLOPT $<" + $(H)$(OCAMLOPT) $(PKGS) -c $< +%.annot: %.ml + $(H)echo " OCAMLC -dtypes $<" + $(H)$(OCAMLC) -dtypes $(PKGS) -c $< + +deps.ps: deps.dot + dot -Tps -o $@ $< +deps.dot: .depend + ./dep2dot.rb < $< | tred > $@ + +# }}} End of deps and automatic rules + +# vim: set foldmethod=marker: diff --git a/matita/applyTransformation.ml b/matita/applyTransformation.ml new file mode 100644 index 000000000..0309cf593 --- /dev/null +++ b/matita/applyTransformation.ml @@ -0,0 +1,224 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(***************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 21/11/2003 *) +(* *) +(* *) +(***************************************************************************) + +(* $Id$ *) + +module G = GrafiteAst + +let mpres_document pres_box = + Xml.add_xml_declaration (CicNotationPres.print_box pres_box) + +let mml_of_cic_sequent metasenv sequent = + let unsh_sequent,(asequent,ids_to_terms, + ids_to_father_ids,ids_to_inner_sorts,ids_to_hypotheses) + = + Cic2acic.asequent_of_sequent metasenv sequent + in + let content_sequent = Acic2content.map_sequent asequent in + let pres_sequent = + Sequent2pres.sequent2pres ~ids_to_inner_sorts content_sequent in + let xmlpres = mpres_document pres_sequent in + (Xml2Gdome.document_of_xml DomMisc.domImpl xmlpres, + unsh_sequent, + (asequent, + (ids_to_terms,ids_to_father_ids,ids_to_hypotheses,ids_to_inner_sorts))) + +let mml_of_cic_object obj = + let (annobj, ids_to_terms, ids_to_father_ids, ids_to_inner_sorts, + ids_to_inner_types, ids_to_conjectures, ids_to_hypotheses) + = + Cic2acic.acic_object_of_cic_object obj + in + let content = + Acic2content.annobj2content ~ids_to_inner_sorts ~ids_to_inner_types annobj + in + let pres = Content2pres.content2pres ~ids_to_inner_sorts content in + let xmlpres = mpres_document pres in + let mathml = Xml2Gdome.document_of_xml DomMisc.domImpl xmlpres in + (mathml,(annobj, + (ids_to_terms, ids_to_father_ids, ids_to_conjectures, ids_to_hypotheses, + ids_to_inner_sorts,ids_to_inner_types))) + +let txt_of_cic_sequent ~map_unicode_to_tex size metasenv sequent = + let unsh_sequent,(asequent,ids_to_terms, + ids_to_father_ids,ids_to_inner_sorts,ids_to_hypotheses) + = + Cic2acic.asequent_of_sequent metasenv sequent + in + let content_sequent = Acic2content.map_sequent asequent in + let pres_sequent = + CicNotationPres.mpres_of_box + (Sequent2pres.sequent2pres ~ids_to_inner_sorts content_sequent) + in + BoxPp.render_to_string ~map_unicode_to_tex + (function x::_ -> x | _ -> assert false) size pres_sequent + +let txt_of_cic_sequent_conclusion ~map_unicode_to_tex ~output_type size + metasenv sequent = + let _,(asequent,_,_,ids_to_inner_sorts,_) = + Cic2acic.asequent_of_sequent metasenv sequent + in + let _,_,_,t = Acic2content.map_sequent asequent in + let t, ids_to_uris = + TermAcicContent.ast_of_acic ~output_type ids_to_inner_sorts t in + let t = TermContentPres.pp_ast t in + let t = CicNotationPres.render ids_to_uris t in + BoxPp.render_to_string ~map_unicode_to_tex + (function x::_ -> x | _ -> assert false) size t + +let txt_of_cic_term ~map_unicode_to_tex size metasenv context t = + let fake_sequent = (-1,context,t) in + txt_of_cic_sequent_conclusion ~map_unicode_to_tex ~output_type:`Term size + metasenv fake_sequent +;; + +ignore ( + CicMetaSubst.set_ppterm_in_context + (fun ~metasenv subst term context -> + try + let context' = CicMetaSubst.apply_subst_context subst context in + let metasenv = CicMetaSubst.apply_subst_metasenv subst metasenv in + let term' = CicMetaSubst.apply_subst subst term in + let res = + txt_of_cic_term + ~map_unicode_to_tex:(Helm_registry.get_bool "matita.paste_unicode_as_tex") + 30 metasenv context' term' in + if String.contains res '\n' then + "\n" ^ res ^ "\n" + else + res + with + Sys.Break as exn -> raise exn + | exn -> + "[[ Exception raised during pretty-printing: " ^ + (try + Printexc.to_string exn + with + Sys.Break as exn -> raise exn + | _ -> "<>" + ) ^ " ]] " ^ + (CicMetaSubst.use_low_level_ppterm_in_context := true; + try + let res = + CicMetaSubst.ppterm_in_context ~metasenv subst term context + in + CicMetaSubst.use_low_level_ppterm_in_context := false; + res + with + exc -> + CicMetaSubst.use_low_level_ppterm_in_context := false; + raise exc)) +);; + +(****************************************************************************) +(* txt_of_cic_object: IMPROVE ME *) + +let remove_closed_substs s = + Pcre.replace ~pat:"{...}" ~templ:"" s + +let term2pres ~map_unicode_to_tex n ids_to_inner_sorts annterm = + let ast, ids_to_uris = + TermAcicContent.ast_of_acic ~output_type:`Term ids_to_inner_sorts annterm in + let bobj = + CicNotationPres.box_of_mpres ( + CicNotationPres.render ~prec:90 ids_to_uris + (TermContentPres.pp_ast ast)) in + let render = function _::x::_ -> x | _ -> assert false in + let mpres = CicNotationPres.mpres_of_box bobj in + let s = BoxPp.render_to_string ~map_unicode_to_tex render n mpres in + remove_closed_substs s + +let txt_of_cic_object + ~map_unicode_to_tex ?skip_thm_and_qed ?skip_initial_lambdas n style prefix obj += + let get_aobj obj = + try + let aobj,_,_,ids_to_inner_sorts,ids_to_inner_types,_,_ = + Cic2acic.acic_object_of_cic_object obj + in + aobj, ids_to_inner_sorts, ids_to_inner_types + with e -> + let msg = "txt_of_cic_object: " ^ Printexc.to_string e in + failwith msg + in + match style with + | G.Declarative -> + let aobj, ids_to_inner_sorts, ids_to_inner_types = get_aobj obj in + let cobj = + Acic2content.annobj2content + ids_to_inner_sorts ids_to_inner_types aobj + in + let bobj = + Content2pres.content2pres + ?skip_initial_lambdas ?skip_thm_and_qed ~ids_to_inner_sorts cobj + in + remove_closed_substs ("\n\n" ^ + BoxPp.render_to_string ~map_unicode_to_tex + (function _::x::_ -> x | _ -> assert false) n + (CicNotationPres.mpres_of_box bobj) + ) + | G.Procedural depth -> + let obj = ProceduralOptimizer.optimize_obj obj in + let aobj, ids_to_inner_sorts, ids_to_inner_types = get_aobj obj in + let term_pp = term2pres ~map_unicode_to_tex (n - 8) ids_to_inner_sorts in + let lazy_term_pp = term_pp in + let obj_pp = CicNotationPp.pp_obj term_pp in + let aux = GrafiteAstPp.pp_statement + ~map_unicode_to_tex ~term_pp ~lazy_term_pp ~obj_pp in + let script = + Acic2Procedural.acic2procedural + ~ids_to_inner_sorts ~ids_to_inner_types ?depth ?skip_thm_and_qed prefix aobj + in + String.concat "" (List.map aux script) ^ "\n\n" + +let txt_of_inline_macro ~map_unicode_to_tex style suri prefix = + let print_exc = function + | ProofEngineHelpers.Bad_pattern s as e -> + Printexc.to_string e ^ " " ^ Lazy.force s + | e -> Printexc.to_string e + in + let dbd = LibraryDb.instance () in + let sorted_uris = MetadataDeps.sorted_uris_of_baseuri ~dbd suri in + let map uri = + try + txt_of_cic_object + ~map_unicode_to_tex 78 style prefix + (fst (CicEnvironment.get_obj CicUniv.empty_ugraph uri)) + with + | e -> + Printf.sprintf "\n(* ERRORE IN STAMPA DI %s\nEXCEPTION: %s *)\n" + (UriManager.string_of_uri uri) (print_exc e) + in + String.concat "" (List.map map sorted_uris) diff --git a/matita/applyTransformation.mli b/matita/applyTransformation.mli new file mode 100644 index 000000000..788ef6810 --- /dev/null +++ b/matita/applyTransformation.mli @@ -0,0 +1,79 @@ +(* Copyright (C) 2000-2002, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(***************************************************************************) +(* *) +(* PROJECT HELM *) +(* *) +(* Andrea Asperti *) +(* 21/11/2003 *) +(* *) +(* *) +(***************************************************************************) + +val mml_of_cic_sequent: + Cic.metasenv -> (* metasenv *) + Cic.conjecture -> (* sequent *) + Gdome.document * (* Math ML *) + Cic.conjecture * (* unshared sequent *) + (Cic.annconjecture * (* annsequent *) + ((Cic.id, Cic.term) Hashtbl.t * (* id -> term *) + (Cic.id, Cic.id option) Hashtbl.t * (* id -> father id *) + (Cic.id, Cic.hypothesis) Hashtbl.t * (* id -> hypothesis *) + (Cic.id, Cic2acic.sort_kind) Hashtbl.t)) (* ids_to_inner_sorts *) + +val mml_of_cic_object: + Cic.obj -> (* object *) + Gdome.document * (* Math ML *) + (Cic.annobj * (* annobj *) + ((Cic.id, Cic.term) Hashtbl.t * (* id -> term *) + (Cic.id, Cic.id option) Hashtbl.t * (* id -> father id *) + (Cic.id, Cic.conjecture) Hashtbl.t * (* id -> conjecture *) + (Cic.id, Cic.hypothesis) Hashtbl.t * (* id -> hypothesis *) + (Cic.id, Cic2acic.sort_kind) Hashtbl.t * (* ids_to_inner_sorts *) + (Cic.id, Cic2acic.anntypes) Hashtbl.t)) (* ids_to_inner_types *) + +val txt_of_cic_term: + map_unicode_to_tex:bool -> int -> Cic.metasenv -> Cic.context -> Cic.term -> + string +val txt_of_cic_sequent: + map_unicode_to_tex:bool -> int -> Cic.metasenv -> Cic.conjecture -> string +val txt_of_cic_sequent_conclusion: + map_unicode_to_tex:bool -> output_type:[`Pattern | `Term] -> int -> + Cic.metasenv -> Cic.conjecture -> string + +(* columns, rendering style, name prefix, object *) +val txt_of_cic_object: + map_unicode_to_tex:bool -> + ?skip_thm_and_qed:bool -> + ?skip_initial_lambdas:int -> + int -> GrafiteAst.presentation_style -> string -> + Cic.obj -> + string + +(* presentation_style, uri or baseuri, name prefix *) +val txt_of_inline_macro: + map_unicode_to_tex:bool -> + GrafiteAst.presentation_style -> string -> string -> string diff --git a/matita/bench_disamberrors b/matita/bench_disamberrors new file mode 100755 index 000000000..87ece78ee --- /dev/null +++ b/matita/bench_disamberrors @@ -0,0 +1,90 @@ +#!/bin/bash +#set -x +TEMP=`getopt -o c:d:m: -- "$@"` +libdir="`pwd`/library" +matitac="`pwd`/matitac.opt" +devel="library" +matitadep="./matitadep.opt" +eval set -- "$TEMP" +while true ; do + case "$1" in + -d) libdir="$2"; shift 2 ;; + -c) matitac="$2"; shift 2 ;; + -m) devel="$2"; shift 2 ;; + --) shift; break ;; + *) echo "Usage: errors_bench [-c MATITAC_PATH] [-d LIBRARY_DIR] [-m MATITAMAKE_DEVEL]"; exit 1 ;; + esac +done +if ! [ -d "$libdir" ] ; then + echo "Can't find library directory '$libdir'" + exit 2 +fi +if ! [ -x "$matitac" ] ; then + echo "Can't find executable Matita compiler '$matitac'" + exit 2 +fi + +ma_s=$(find $libdir -name "*.ma" -type f) +sorted_ma_s=$($matitadep -order $ma_s) + +log="bench_disamberrors.txt" +rm -f "$log" +echo -e "# FILENAME\tOUTCOME\tEXPECTED_ERROR\tERRORS\tSPURIOUS_ERRORS" > $log +# format: tab-separated fields: +# FILENAME OUTCOME EXPECTED_ERROR ERRORS SPURIOUS_ERRORS +# field descriptions: +# OUTCOME is one of {"OK","KO","UNKNOWN(n)"}, n is an exit code +# EXPECTED_ERROR is FROM-TO, where FROM and TO are character counts +# ERRORS, same format as above (FROM-TO) +# SPURIOUS_ERRORS, same format as above (FROM-TO) +log_outcome () +{ + echo -e "$1|$2|$3|$4|$5" >> "$log" +} + +for ma in $sorted_ma_s ; do + mo=`echo $ma | sed 's/\.ma$/.mo/'` + make -C $libdir $mo # ensure deps for $mo have been built + rotten_mas=$(ls $libdir/$ma.*.rottened) + for rotten_ma in $rotten_mas ; do + rotten_ma=$(echo $rotten_ma | sed s@^$(pwd)/@@) # prettier names + echo "$rotten_ma ..." + tmp="bench_disamberrors.tmp" + $matitac $rotten_ma &> $tmp + outcome=$? + if [ "$outcome" = 3 ] ; then + outcome="KO" + elif [ "$outcome" = 0 ] ; then + outcome="OK" + else + outcome="UNKNOWN($outcome)" + fi + supposed_error=$(grep ^error-at: $rotten_ma | cut -f 2 -d' ') + errors="" + spurious_errors="" + error_pass="" + error_loc="" + while read e ; do + if echo "$e" | grep -q "Error at" && [ -n "$error_pass" ] ; then + # this is an error location line + if echo "$e" | grep -q "Spurious" ; then + loc=$(echo "$e" | sed 's/:.*$//' | cut -f 4 -d ' ') + if ! echo "$spurious_errors" | grep -q "$loc"; then + if ! [ -z "$spurious_errors" ] ; then spurious_errors="$spurious_errors," ; fi + spurious_errors="$spurious_errors$loc" + fi + else + loc=$(echo "$e" | sed 's/:.*$//' | cut -f 3 -d ' ') + if ! echo "$errors" | grep -q "$loc"; then + if ! [ -z "$errors" ] ; then errors="$errors," ; fi + errors="$errors$loc" + fi + fi + fi + error_pass=$(echo "$e" | grep "during phases " | sed 's/:.*$//' | cut -f 6 -d' ' | grep "4\|6") + done < $tmp + log_outcome $rotten_ma $outcome $supposed_error $errors $spurious_errors + done +done + +echo "See $log for benchmark results" diff --git a/matita/bench_summary.py b/matita/bench_summary.py new file mode 100755 index 000000000..32df4b017 --- /dev/null +++ b/matita/bench_summary.py @@ -0,0 +1,75 @@ +#!/usr/bin/python +import sys + +stats = {} +stats['total'] = [] +stats['precise'] = [] +stats['imprecise'] = [] +stats['false-positives'] = [] +stats['undetected'] = [] + +for line in open(sys.argv[1]): + line = line.rstrip() + if line[0] == '#': + continue + cols = line.split('|') + name = cols[0] + if cols[1] != 'KO': + print "Warning: outcome of %s is %s, skipping it" % (name, cols[1]) + continue + expected_error = cols[2] + real_errors = cols[3].split(',') + spurious_errors = cols[4].split(',') + + stats['total'].append((name,real_errors)) + if set([expected_error]) == set(real_errors): + if expected_error in spurious_errors: + stats['false-positives'].append((name,real_errors)) + else: + stats['precise'].append((name,real_errors)) + elif expected_error in real_errors: + if expected_error in spurious_errors: + stats['false-positives'].append((name,real_errors)) + else: + stats['imprecise'].append((name,real_errors)) + else: + if expected_error in spurious_errors: + stats['false-positives'].append((name,real_errors)) + else: + stats['undetected'].append((name,real_errors)) + +for field in ['undetected', 'imprecise', 'false-positives']: + print "====================" + print "%s:" % field + for name,_ in stats[field]: + print " %s" % name + +def average(l): + if not(len(l)): + return "N/A" + else: + return "%6.1f" % (reduce(lambda acc,x: acc+x,l,0)/float(len(l))) + +def mymax(l): + if not(len(l)): + return 0 + else: + return max(l) + +def format_stat(field): + global stats + lista = stats[field] + errors = map(lambda x: len(x[1]),lista) + locations = map(lambda x: len(set(x[1])),lista) + return r'%-15s & %6d & %6s & %6d & %6s & %6d & %6.1f\%% \\' % \ + (field, len(lista), average(locations),mymax(locations), + average(errors),mymax(errors),float(len(lista)) / + len(stats['total']) * 100) + +print "\n" +print format_stat('precise') +print format_stat('imprecise') +print format_stat('false-positives') +print format_stat('undetected') +print r'\hline' +print format_stat('total') diff --git a/matita/buildTimeConf.ml.in b/matita/buildTimeConf.ml.in new file mode 100644 index 000000000..ec01152c4 --- /dev/null +++ b/matita/buildTimeConf.ml.in @@ -0,0 +1,59 @@ +(* Copyright (C) 2004, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +let debug = @DEBUG@;; +let version = "@MATITA_VERSION@";; +let undo_history_size = 10;; +let console_history_size = 100;; +let browser_history_size = 100;; +let base_uri = "cic:/matita";; +let phrase_sep = ".";; +let blank_uri = "about:blank";; +let current_proof_uri = "about:current_proof";; +let default_font_size = 10;; +let script_font = "Monospace";; + + (** may be overridden with MATITA_RT_BASE_DIR environment variable, useful for + * binary distribution installed in user home directories *) +let runtime_base_dir = + try + Sys.getenv "MATITA_RT_BASE_DIR" + with Not_found -> "@RT_BASE_DIR@";; + +let images_dir = runtime_base_dir ^ "/icons" +let gtkrc_file = runtime_base_dir ^ "/matita.gtkrc" +let lang_file = runtime_base_dir ^ "/matita.lang" +let script_template = runtime_base_dir ^ "/matita.ma.templ" +let core_notation_script = runtime_base_dir ^ "/core_notation.moo" +let matita_conf = runtime_base_dir ^ "/matita.conf.xml" +let closed_xml = runtime_base_dir ^ "/closed.xml" +let gtkmathview_conf = runtime_base_dir ^ "/gtkmathview.matita.conf.xml" +let matitamake_makefile_template = runtime_base_dir ^ "/template_makefile.in" +let matitamake_makefile_template_devel = + runtime_base_dir ^ "/template_makefile_devel.in" +let stdlib_dir_devel = runtime_base_dir ^ "/library" +let stdlib_dir_installed = runtime_base_dir ^ "/ma/standard-library" +let help_dir = runtime_base_dir ^ "/help" + diff --git a/matita/closed.xml b/matita/closed.xml new file mode 100644 index 000000000..d3125efb7 --- /dev/null +++ b/matita/closed.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + This goal has already been closed. + Use the "skip" command to throw it away. + + + + diff --git a/matita/contribs/CoRN-Decl/CoRN.ma b/matita/contribs/CoRN-Decl/CoRN.ma new file mode 100644 index 000000000..7a39a0e59 --- /dev/null +++ b/matita/contribs/CoRN-Decl/CoRN.ma @@ -0,0 +1,733 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/CoRN". + +include "preamble.ma". + +(* From algebra/Basics ****************************************************) + +(* NOTATION +Notation Pair := (pair (B:=_)). +*) + +(* NOTATION +Notation Proj1 := (proj1 (B:=_)). +*) + +(* NOTATION +Notation Proj2 := (proj2 (B:=_)). +*) + +coercion cic:/Coq/ZArith/BinInt/Z_of_nat.con 0 (* compounds *). + +(* From algebra/CAbGroups *************************************************) + +coercion cic:/CoRN/algebra/CAbGroups/cag_crr.con 0 (* compounds *). + +(* From algebra/CAbMonoids ************************************************) + +coercion cic:/CoRN/algebra/CAbMonoids/cam_crr.con 0 (* compounds *). + +(* From algebra/CFields ***************************************************) + +coercion cic:/CoRN/algebra/CFields/cf_crr.con 0 (* compounds *). + +(* NOTATION +Notation "x [/] y [//] Hy" := (cf_div x y Hy) (at level 80). +*) + +(* NOTATION +Notation "{1/} x" := (Frecip x) (at level 2, right associativity). +*) + +(* NOTATION +Infix "{/}" := Fdiv (at level 41, no associativity). +*) + +(* From algebra/CGroups ***************************************************) + +coercion cic:/CoRN/algebra/CGroups/cg_crr.con 0 (* compounds *). + +(* NOTATION +Notation "[--] x" := (cg_inv x) (at level 2, right associativity). +*) + +(* NOTATION +Infix "[-]" := cg_minus (at level 50, left associativity). +*) + +(* NOTATION +Notation "{--} x" := (Finv x) (at level 2, right associativity). +*) + +(* NOTATION +Infix "{-}" := Fminus (at level 50, left associativity). +*) + +(* From algebra/CLogic ****************************************************) + +(* NOTATION +Infix "IFF" := Iff (at level 60, right associativity). +*) + +(* NOTATION +Infix "or" := COr (at level 85, right associativity). +*) + +(* NOTATION +Infix "and" := CAnd (at level 80, right associativity). +*) + +(* NOTATION +Notation "{ x : A | P }" := (sigT (fun x : A => P):CProp) + (at level 0, x at level 99) : type_scope. +*) + +(* NOTATION +Notation "{ x : A | P | Q }" := + (sig2T A (fun x : A => P) (fun x : A => Q)) (at level 0, x at level 99) : + type_scope. +*) + +(* NOTATION +Notation ProjT1 := (proj1_sigT _ _). +*) + +(* NOTATION +Notation ProjT2 := (proj2_sigT _ _). +*) + +(* From algebra/CMonoids **************************************************) + +coercion cic:/CoRN/algebra/CMonoids/cm_crr.con 0 (* compounds *). + +(* NOTATION +Notation Zero := (cm_unit _). +*) + +(* From algebra/COrdAbs ***************************************************) + +(* NOTATION +Notation ZeroR := (Zero:R). +*) + +(* NOTATION +Notation AbsBig := (absBig _). +*) + +(* From algebra/COrdCauchy ************************************************) + +coercion cic:/CoRN/algebra/COrdCauchy/CS_seq.con 0 (* compounds *). + +(* From algebra/COrdFields ************************************************) + +coercion cic:/CoRN/algebra/COrdFields/cof_crr.con 0 (* compounds *). + +(* NOTATION +Infix "[<]" := cof_less (at level 70, no associativity). +*) + +(* NOTATION +Infix "[>]" := greater (at level 70, no associativity). +*) + +(* NOTATION +Infix "[<=]" := leEq (at level 70, no associativity). +*) + +(* NOTATION +Notation " x [/]OneNZ" := (x[/] One[//]ring_non_triv _) (at level 20). +*) + +(* NOTATION +Notation " x [/]TwoNZ" := (x[/] Two[//]two_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]ThreeNZ" := (x[/] Three[//]three_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]FourNZ" := (x[/] Four[//]four_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]SixNZ" := (x[/] Six[//]six_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]EightNZ" := (x[/] Eight[//]eight_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]NineNZ" := (x[/] Nine[//]nine_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]TwelveNZ" := (x[/] Twelve[//]twelve_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]SixteenNZ" := (x[/] Sixteen[//]sixteen_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]EighteenNZ" := (x[/] Eighteen[//]eighteen_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]TwentyFourNZ" := (x[/] TwentyFour[//]twentyfour_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]FortyEightNZ" := (x[/] FortyEight[//]fortyeight_ap_zero _) (at level 20). +*) + +(* From algebra/COrdFields2 ***********************************************) + +(* NOTATION +Notation ZeroR := (Zero:R). +*) + +(* NOTATION +Notation OneR := (One:R). +*) + +(* From algebra/CPoly_ApZero **********************************************) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* From algebra/CPoly_Degree **********************************************) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* NOTATION +Notation FX := (cpoly_cring F). +*) + +(* From algebra/CPoly_NthCoeff ********************************************) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* From algebra/CPolynomials **********************************************) + +(* NOTATION +Infix "[+X*]" := cpoly_linear_fun' (at level 50, left associativity). +*) + +(* NOTATION +Notation RX := (cpoly_cring CR). +*) + +(* NOTATION +Infix "!" := cpoly_apply_fun (at level 1, no associativity). +*) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* NOTATION +Notation Cpoly := (cpoly CR). +*) + +(* NOTATION +Notation Cpoly_zero := (cpoly_zero CR). +*) + +(* NOTATION +Notation Cpoly_linear := (cpoly_linear CR). +*) + +(* NOTATION +Notation Cpoly_cring := (cpoly_cring CR). +*) + +(* From algebra/CRings ****************************************************) + +coercion cic:/CoRN/algebra/CRings/cr_crr.con 0 (* compounds *). + +(* NOTATION +Notation One := (cr_one _). +*) + +(* NOTATION +Infix "[*]" := cr_mult (at level 40, left associativity). +*) + +(* NOTATION +Notation "x [^] n" := (nexp_op _ n x) (at level 20). +*) + +(* NOTATION +Notation Two := (nring 2). +*) + +(* NOTATION +Notation Three := (nring 3). +*) + +(* NOTATION +Notation Four := (nring 4). +*) + +(* NOTATION +Notation Six := (nring 6). +*) + +(* NOTATION +Notation Eight := (nring 8). +*) + +(* NOTATION +Notation Twelve := (nring 12). +*) + +(* NOTATION +Notation Sixteen := (nring 16). +*) + +(* NOTATION +Notation Nine := (nring 9). +*) + +(* NOTATION +Notation Eighteen := (nring 18). +*) + +(* NOTATION +Notation TwentyFour := (nring 24). +*) + +(* NOTATION +Notation FortyEight := (nring 48). +*) + +(* NOTATION +Infix "{*}" := Fmult (at level 40, left associativity). +*) + +(* NOTATION +Infix "{**}" := Fscalmult (at level 40, left associativity). +*) + +(* NOTATION +Infix "{^}" := Fnth (at level 30, right associativity). +*) + +(* From algebra/CSemiGroups ***********************************************) + +coercion cic:/CoRN/algebra/CSemiGroups/csg_crr.con 0 (* compounds *). + +(* NOTATION +Infix "[+]" := csg_op (at level 50, left associativity). +*) + +(* NOTATION +Infix "{+}" := Fplus (at level 50, left associativity). +*) + +(* From algebra/CSetoidFun ************************************************) + +(* NOTATION +Notation Conj := (conjP _). +*) + +coercion cic:/CoRN/algebra/CSetoidFun/bpfpfun.con 0 (* compounds *). + +(* NOTATION +Notation BDom := (bpfdom _ _). +*) + +coercion cic:/CoRN/algebra/CSetoidFun/pfpfun.con 0 (* compounds *). + +(* NOTATION +Notation Dom := (pfdom _). +*) + +(* NOTATION +Notation Part := (pfpfun _). +*) + +(* NOTATION +Notation "[-C-] x" := (Fconst x) (at level 2, right associativity). +*) + +(* NOTATION +Notation FId := (Fid _). +*) + +(* NOTATION +Infix "[o]" := Fcomp (at level 65, no associativity). +*) + +(* NOTATION +Notation Prj1 := (prj1 _ _ _ _). +*) + +(* NOTATION +Notation Prj2 := (prj2 _ _ _ _). +*) + +(* From algebra/CSetoids **************************************************) + +coercion cic:/CoRN/algebra/CSetoids/cs_crr.con 0 (* compounds *). + +(* NOTATION +Infix "[=]" := cs_eq (at level 70, no associativity). +*) + +(* NOTATION +Infix "[#]" := cs_ap (at level 70, no associativity). +*) + +(* NOTATION +Infix "[~=]" := cs_neq (at level 70, no associativity). +*) + +coercion cic:/CoRN/algebra/CSetoids/csp_pred.con 0 (* compounds *). + +coercion cic:/CoRN/algebra/CSetoids/csp'_pred.con 0 (* compounds *). + +coercion cic:/CoRN/algebra/CSetoids/csr_rel.con 0 (* compounds *). + +coercion cic:/CoRN/algebra/CSetoids/Ccsr_rel.con 0 (* compounds *). + +coercion cic:/CoRN/algebra/CSetoids/csf_fun.con 0 (* compounds *). + +coercion cic:/CoRN/algebra/CSetoids/csbf_fun.con 0 (* compounds *). + +coercion cic:/CoRN/algebra/CSetoids/un_op_fun.con 0 (* compounds *). + +coercion cic:/CoRN/algebra/CSetoids/bin_op_bin_fun.con 0 (* compounds *). + +coercion cic:/CoRN/algebra/CSetoids/outer_op_bin_fun.con 0 (* compounds *). + +coercion cic:/CoRN/algebra/CSetoids/scs_elem.con 0 (* compounds *). + +(* From algebra/CVectorSpace **********************************************) + +coercion cic:/CoRN/algebra/CVectorSpace/vs_vs.con 0 (* compounds *). + +(* NOTATION +Infix "[']" := vs_op (at level 30, no associativity). +*) + +(* From algebra/Expon *****************************************************) + +(* NOTATION +Notation "( x [//] Hx ) [^^] n" := (zexp x Hx n) (at level 0). +*) + +(* From complex/CComplex **************************************************) + +(* NOTATION +Notation CCX := (cpoly_cring CC). +*) + +(* NOTATION +Infix "[+I*]" := cc_set_CC (at level 48, no associativity). +*) + +(* From fta/CC_Props ******************************************************) + +coercion cic:/CoRN/fta/CC_Props/CC_seq.con 0 (* compounds *). + +(* From fta/FTAreg ********************************************************) + +coercion cic:/CoRN/fta/FTAreg/z_el.con 0 (* compounds *). + +coercion cic:/CoRN/fta/FTAreg/Kntup.con 0 (* compounds *). + +(* From ftc/FTC ***********************************************************) + +(* NOTATION +Notation "[-S-] F" := (Fprim F) (at level 20). +*) + +(* From ftc/Integral ******************************************************) + +(* NOTATION +Notation Integral := (integral _ _ Hab). +*) + +(* From ftc/MoreIntervals *************************************************) + +coercion cic:/CoRN/ftc/MoreIntervals/iprop.con 0 (* compounds *). + +(* From ftc/Partitions ****************************************************) + +coercion cic:/CoRN/ftc/Partitions/Pts.con 0 (* compounds *). + +(* From ftc/RefLemma ******************************************************) + +(* NOTATION +Notation g := RL_g. +*) + +(* NOTATION +Notation h := RL_h. +*) + +(* NOTATION +Notation just1 := (incF _ (Pts_part_lemma _ _ _ _ _ _ HfP _ _)). +*) + +(* NOTATION +Notation just2 := (incF _ (Pts_part_lemma _ _ _ _ _ _ HfQ _ _)). +*) + +(* NOTATION +Notation just := (fun z => incF _ (Pts_part_lemma _ _ _ _ _ _ z _ _)). +*) + +(* From ftc/RefSeparated **************************************************) + +(* NOTATION +Notation just1 := (incF _ (Pts_part_lemma _ _ _ _ _ _ gP _ _)). +*) + +(* NOTATION +Notation just2 := + (incF _ (Pts_part_lemma _ _ _ _ _ _ sep__sep_points_lemma _ _)). +*) + +(* From ftc/RefSeparating *************************************************) + +(* NOTATION +Notation m := RS'_m. +*) + +(* NOTATION +Notation h := RS'_h. +*) + +(* NOTATION +Notation just1 := (incF _ (Pts_part_lemma _ _ _ _ _ _ gP _ _)). +*) + +(* NOTATION +Notation just2 := + (incF _ (Pts_part_lemma _ _ _ _ _ _ sep__part_pts_in_Partition _ _)). +*) + +(* From ftc/Rolle *********************************************************) + +(* NOTATION +Notation cp := (compact_part a b Hab' d Hd). +*) + +(* From ftc/TaylorLemma ***************************************************) + +(* NOTATION +Notation A := (Build_subcsetoid_crr IR _ _ TL_compact_a). +*) + +(* NOTATION +Notation B := (Build_subcsetoid_crr IR _ _ TL_compact_b). +*) + +(* From ftc/WeakIVT *******************************************************) + +(* NOTATION +Infix "**" := prodT (at level 20). +*) + +(* From metrics/CMetricSpaces *********************************************) + +coercion cic:/CoRN/metrics/CMetricSpaces/scms_crr.con 0 (* compounds *). + +(* From metrics/CPseudoMSpaces ********************************************) + +coercion cic:/CoRN/metrics/CPseudoMSpaces/cms_crr.con 0 (* compounds *). + +(* NOTATION +Infix "[-d]" := cms_d (at level 68, left associativity). +*) + +(* From model/structures/Nsec *********************************************) + +(* NOTATION +Infix "{#N}" := ap_nat (no associativity, at level 90). +*) + +(* From model/structures/Qsec *********************************************) + +(* NOTATION +Infix "{=Q}" := Qeq (no associativity, at level 90). +*) + +(* NOTATION +Infix "{#Q}" := Qap (no associativity, at level 90). +*) + +(* NOTATION +Infix "{N# *) + +(*#* printing Z %\ensuremath{\mathbb Z}% #Z# *) + +include "algebra/ListType.ma". + +(*#* *Basics +This is random stuff that should be in the Coq basic library. +*) + +inline "cic:/CoRN/algebra/Basics/lt_le_dec.con". + +inline "cic:/CoRN/algebra/Basics/lt_z_two.con". + +inline "cic:/CoRN/algebra/Basics/le_pred.con". + +inline "cic:/CoRN/algebra/Basics/lt_mult_right.con". + +inline "cic:/CoRN/algebra/Basics/le_mult_right.con". + +(*#* The power function does not exist in the standard library *) + +inline "cic:/CoRN/algebra/Basics/power.con". + +(*#* Factorial function. Does not exist in Arith. +Needed for special operations on polynomials. *) + +inline "cic:/CoRN/algebra/Basics/fac.con". + +inline "cic:/CoRN/algebra/Basics/nat_fac_gtzero.con". + +(* needed for computational behavior of "Inversion" tactic *) + +(* UNEXPORTED +Transparent sym_eq. +*) + +(* UNEXPORTED +Transparent f_equal. +*) + +(* NOTATION +Notation Pair := (pair (B:=_)). +*) + +(* NOTATION +Notation Proj1 := (proj1 (B:=_)). +*) + +(* NOTATION +Notation Proj2 := (proj2 (B:=_)). +*) + +(* Following only needed in finite, but tha's now obsolete + +Lemma deMorgan_or_and: (A,B,X:Prop)((A\/B)->X)->(A->X)/\(B->X). +Tauto. +Qed. + +Lemma deMorgan_and_or: (A,B,X:Prop)(A->X)/\(B->X)->(A\/B->X). +Tauto. +Qed. + +Lemma deMorgan_ex_all: + (A:Set)(P:A->Prop)(X:Prop)((Ex P)->X)->(a:A)(P a)->X. +Intros. Apply H; Exists a; Assumption. +Qed. + +Lemma deMorgan_all_ex: + (A:Set)(P:A->Prop)(X:Prop)((a:A)(P a)->X)->(Ex P)->X. +Intros. Elim H0; Assumption. +Qed. + +Implicit Arguments Off. + +Three lemmas for proving properties about definitions made with case +distinction to a sumbool, i.e. [{A} + {B}]. + +Lemma sumbool_rec_or : (A,B:Prop)(S:Set)(l,r:S)(s:{A}+{B}) + (sumbool_rec A B [_:{A}+{B}]S [x:A]l [x:B]r s) = l \/ + (sumbool_rec A B [_:{A}+{B}]S [x:A]l [x:B]r s) = r. +Intros. Elim s. +Intros. Left. Reflexivity. +Intros. Right. Reflexivity. +Qed. +*) + +inline "cic:/CoRN/algebra/Basics/not_r_sumbool_rec.con". + +inline "cic:/CoRN/algebra/Basics/not_l_sumbool_rec.con". + +(* begin hide *) + +(* UNEXPORTED +Set Implicit Arguments. +*) + +(* UNEXPORTED +Unset Strict Implicit. +*) + +(* end hide *) + +(*#* **Some results about [Z] + +We consider the injection [inject_nat] from [nat] to [Z] as a +coercion. *) + +(* begin hide *) + +coercion cic:/Coq/ZArith/BinInt/Z_of_nat.con 0 (* compounds *). + +(* end hide *) + +inline "cic:/CoRN/algebra/Basics/POS_anti_convert.con". + +inline "cic:/CoRN/algebra/Basics/NEG_anti_convert.con". + +inline "cic:/CoRN/algebra/Basics/lt_O_positive_to_nat.con". + +inline "cic:/CoRN/algebra/Basics/anti_convert_pred_convert.con". + +inline "cic:/CoRN/algebra/Basics/p_is_some_anti_convert.con". + +inline "cic:/CoRN/algebra/Basics/convert_is_POS.con". + +inline "cic:/CoRN/algebra/Basics/min_convert_is_NEG.con". + +inline "cic:/CoRN/algebra/Basics/inject_nat_convert.con". + +inline "cic:/CoRN/algebra/Basics/Z_exh.con". + +inline "cic:/CoRN/algebra/Basics/nats_Z_ind.con". + +inline "cic:/CoRN/algebra/Basics/pred_succ_Z_ind.con". + +inline "cic:/CoRN/algebra/Basics/Zmult_minus_distr_r.con". + +inline "cic:/CoRN/algebra/Basics/Zodd_Zeven_min1.con". + +(* begin hide *) + +(* UNEXPORTED +Set Implicit Arguments. +*) + +(* UNEXPORTED +Unset Strict Implicit. +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/Basics/caseZ_diff.con". + +(* begin hide *) + +(* UNEXPORTED +Set Strict Implicit. +*) + +(* UNEXPORTED +Unset Implicit Arguments. +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/Basics/caseZ_diff_O.con". + +inline "cic:/CoRN/algebra/Basics/caseZ_diff_Pos.con". + +inline "cic:/CoRN/algebra/Basics/caseZ_diff_Neg.con". + +inline "cic:/CoRN/algebra/Basics/proper_caseZ_diff.con". + +inline "cic:/CoRN/algebra/Basics/diff_Z_ind.con". + +inline "cic:/CoRN/algebra/Basics/Zlt_reg_mult_l.con". + +inline "cic:/CoRN/algebra/Basics/Zlt_opp.con". + +inline "cic:/CoRN/algebra/Basics/Zlt_conv_mult_l.con". + +inline "cic:/CoRN/algebra/Basics/Zgt_not_eq.con". + +inline "cic:/CoRN/algebra/Basics/Zmult_absorb.con". + +(* UNEXPORTED +Section Well_foundedT +*) + +alias id "A" = "cic:/CoRN/algebra/Basics/Well_foundedT/A.var". + +alias id "R" = "cic:/CoRN/algebra/Basics/Well_foundedT/R.var". + +(*#* The accessibility predicate is defined to be non-informative *) + +inline "cic:/CoRN/algebra/Basics/Acc.ind". + +(* UNEXPORTED +End Well_foundedT +*) + +(* UNEXPORTED +Section AccT +*) + +alias id "A" = "cic:/CoRN/algebra/Basics/AccT/A.var". + +inline "cic:/CoRN/algebra/Basics/well_founded.con". + +(* UNEXPORTED +End AccT +*) + +(* UNEXPORTED +Implicit Arguments Acc [A]. +*) + +(* UNEXPORTED +Section IndT +*) + +alias id "A" = "cic:/CoRN/algebra/Basics/IndT/A.var". + +alias id "R" = "cic:/CoRN/algebra/Basics/IndT/R.var". + +(* UNEXPORTED +Section AccIter +*) + +alias id "P" = "cic:/CoRN/algebra/Basics/IndT/AccIter/P.var". + +alias id "F" = "cic:/CoRN/algebra/Basics/IndT/AccIter/F.var". + +inline "cic:/CoRN/algebra/Basics/Acc_inv.con". + +inline "cic:/CoRN/algebra/Basics/Acc_iter.con". + +(* UNEXPORTED +End AccIter +*) + +alias id "Rwf" = "cic:/CoRN/algebra/Basics/IndT/Rwf.var". + +inline "cic:/CoRN/algebra/Basics/well_founded_induction_type.con". + +(* UNEXPORTED +End IndT +*) + +(* UNEXPORTED +Section InductionT +*) + +alias id "A" = "cic:/CoRN/algebra/Basics/InductionT/A.var". + +alias id "f" = "cic:/CoRN/algebra/Basics/InductionT/f.var". + +inline "cic:/CoRN/algebra/Basics/ltof.con". + +inline "cic:/CoRN/algebra/Basics/well_founded_ltof.con". + +inline "cic:/CoRN/algebra/Basics/induction_ltof2T.con". + +(* UNEXPORTED +End InductionT +*) + +(* UNEXPORTED +Section InductionTT +*) + +inline "cic:/CoRN/algebra/Basics/lt_wf_rect.con". + +(* UNEXPORTED +End InductionTT +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CAbGroups.ma b/matita/contribs/CoRN-Decl/algebra/CAbGroups.ma new file mode 100644 index 000000000..5548ff0a6 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CAbGroups.ma @@ -0,0 +1,304 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CAbGroups". + +include "CoRN.ma". + +include "algebra/CGroups.ma". + +(* UNEXPORTED +Section Abelian_Groups +*) + +(*#* +* Abelian Groups +Now we introduce commutativity and add some results. +*) + +inline "cic:/CoRN/algebra/CAbGroups/is_CAbGroup.con". + +inline "cic:/CoRN/algebra/CAbGroups/CAbGroup.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CAbGroups/cag_crr.con 0 (* compounds *). + +(* UNEXPORTED +Section AbGroup_Axioms +*) + +alias id "G" = "cic:/CoRN/algebra/CAbGroups/Abelian_Groups/AbGroup_Axioms/G.var". + +(*#* +%\begin{convention}% Let [G] be an Abelian Group. +%\end{convention}% +*) + +inline "cic:/CoRN/algebra/CAbGroups/CAbGroup_is_CAbGroup.con". + +inline "cic:/CoRN/algebra/CAbGroups/cag_commutes.con". + +inline "cic:/CoRN/algebra/CAbGroups/cag_commutes_unfolded.con". + +(* UNEXPORTED +End AbGroup_Axioms +*) + +(* UNEXPORTED +Section SubCAbGroups +*) + +(*#* +** Subgroups of an Abelian Group +*) + +alias id "G" = "cic:/CoRN/algebra/CAbGroups/Abelian_Groups/SubCAbGroups/G.var". + +alias id "P" = "cic:/CoRN/algebra/CAbGroups/Abelian_Groups/SubCAbGroups/P.var". + +alias id "Punit" = "cic:/CoRN/algebra/CAbGroups/Abelian_Groups/SubCAbGroups/Punit.var". + +alias id "op_pres_P" = "cic:/CoRN/algebra/CAbGroups/Abelian_Groups/SubCAbGroups/op_pres_P.var". + +alias id "inv_pres_P" = "cic:/CoRN/algebra/CAbGroups/Abelian_Groups/SubCAbGroups/inv_pres_P.var". + +(*#* +%\begin{convention}% +Let [G] be an Abelian Group and [P] be a ([CProp]-valued) predicate on [G] +that contains [Zero] and is closed under [[+]] and [[--]]. +%\end{convention}% +*) + +inline "cic:/CoRN/algebra/CAbGroups/Abelian_Groups/SubCAbGroups/subcrr.con" "Abelian_Groups__SubCAbGroups__". + +inline "cic:/CoRN/algebra/CAbGroups/isabgrp_scrr.con". + +inline "cic:/CoRN/algebra/CAbGroups/Build_SubCAbGroup.con". + +(* UNEXPORTED +End SubCAbGroups +*) + +(* UNEXPORTED +Section Various +*) + +(*#* +** Basic properties of Abelian groups +*) + +(* UNEXPORTED +Hint Resolve cag_commutes_unfolded: algebra. +*) + +alias id "G" = "cic:/CoRN/algebra/CAbGroups/Abelian_Groups/Various/G.var". + +(*#* +%\begin{convention}% Let [G] be an Abelian Group. +%\end{convention}% +*) + +inline "cic:/CoRN/algebra/CAbGroups/cag_op_inv.con". + +(* UNEXPORTED +Hint Resolve cag_op_inv: algebra. +*) + +inline "cic:/CoRN/algebra/CAbGroups/assoc_1.con". + +inline "cic:/CoRN/algebra/CAbGroups/minus_plus.con". + +inline "cic:/CoRN/algebra/CAbGroups/op_lft_resp_ap.con". + +inline "cic:/CoRN/algebra/CAbGroups/cag_ap_cancel_lft.con". + +inline "cic:/CoRN/algebra/CAbGroups/plus_cancel_ap_lft.con". + +(* UNEXPORTED +End Various +*) + +(* UNEXPORTED +End Abelian_Groups +*) + +(* UNEXPORTED +Hint Resolve cag_commutes_unfolded: algebra. +*) + +(* UNEXPORTED +Hint Resolve cag_op_inv assoc_1 zero_minus minus_plus op_lft_resp_ap: algebra. +*) + +(* UNEXPORTED +Section Nice_Char +*) + +(*#* +** Building an abelian group + +In order to actually define concrete abelian groups, +it is not in general practical to construct first a semigroup, +then a monoid, then a group and finally an abelian group. The +presence of commutativity, for example, makes many of the monoid +proofs trivial. In this section, we provide a constructor that +will allow us to go directly from a setoid to an abelian group. + +We start from a setoid S with an element [unit], a +commutative and associative binary operation [plus] which +is strongly extensional in its first argument and admits [unit] +as a left unit, and a unary setoid +function [inv] which inverts elements respective to [plus]. +*) + +alias id "S" = "cic:/CoRN/algebra/CAbGroups/Nice_Char/S.var". + +alias id "unit" = "cic:/CoRN/algebra/CAbGroups/Nice_Char/unit.var". + +alias id "plus" = "cic:/CoRN/algebra/CAbGroups/Nice_Char/plus.var". + +(*#* +%\begin{convention}% +Let [S] be a Setoid and [unit:S], [plus:S->S->S] and [inv] a unary +setoid operation on [S]. +Assume that [plus] is commutative, associative and `left-strongly-extensional +([(plus x z) [#] (plus y z) -> x [#] y]), that [unit] is a left-unit +for [plus] and [(inv x)] is a right-inverse of [x] w.r.t.%\% [plus]. +%\end{convention}% +*) + +alias id "plus_lext" = "cic:/CoRN/algebra/CAbGroups/Nice_Char/plus_lext.var". + +alias id "plus_lunit" = "cic:/CoRN/algebra/CAbGroups/Nice_Char/plus_lunit.var". + +alias id "plus_comm" = "cic:/CoRN/algebra/CAbGroups/Nice_Char/plus_comm.var". + +alias id "plus_assoc" = "cic:/CoRN/algebra/CAbGroups/Nice_Char/plus_assoc.var". + +alias id "inv" = "cic:/CoRN/algebra/CAbGroups/Nice_Char/inv.var". + +alias id "inv_inv" = "cic:/CoRN/algebra/CAbGroups/Nice_Char/inv_inv.var". + +inline "cic:/CoRN/algebra/CAbGroups/plus_rext.con". + +inline "cic:/CoRN/algebra/CAbGroups/plus_runit.con". + +inline "cic:/CoRN/algebra/CAbGroups/plus_is_fun.con". + +inline "cic:/CoRN/algebra/CAbGroups/inv_inv'.con". + +inline "cic:/CoRN/algebra/CAbGroups/plus_fun.con". + +inline "cic:/CoRN/algebra/CAbGroups/Build_CSemiGroup'.con". + +inline "cic:/CoRN/algebra/CAbGroups/Build_CMonoid'.con". + +inline "cic:/CoRN/algebra/CAbGroups/Build_CGroup'.con". + +inline "cic:/CoRN/algebra/CAbGroups/Build_CAbGroup'.con". + +(* UNEXPORTED +End Nice_Char +*) + +(*#* ** Iteration + +For reflection the following is needed; hopefully it is also useful. +*) + +(* UNEXPORTED +Section Group_Extras +*) + +alias id "G" = "cic:/CoRN/algebra/CAbGroups/Group_Extras/G.var". + +inline "cic:/CoRN/algebra/CAbGroups/nmult.con". + +inline "cic:/CoRN/algebra/CAbGroups/nmult_wd.con". + +inline "cic:/CoRN/algebra/CAbGroups/nmult_one.con". + +inline "cic:/CoRN/algebra/CAbGroups/nmult_Zero.con". + +inline "cic:/CoRN/algebra/CAbGroups/nmult_plus.con". + +inline "cic:/CoRN/algebra/CAbGroups/nmult_mult.con". + +inline "cic:/CoRN/algebra/CAbGroups/nmult_inv.con". + +inline "cic:/CoRN/algebra/CAbGroups/nmult_plus'.con". + +(* UNEXPORTED +Hint Resolve nmult_wd nmult_Zero nmult_inv nmult_plus nmult_plus': algebra. +*) + +inline "cic:/CoRN/algebra/CAbGroups/zmult.con". + +(* +Lemma Zeq_imp_nat_eq : forall m n:nat, m = n -> m = n. +auto. +intro m; induction m. +intro n; induction n; auto. + +intro; induction n. +intro. inversion H. +intros. +rewrite (IHm n). +auto. +repeat rewrite inj_S in H. +auto with zarith. +Qed. +*) + +inline "cic:/CoRN/algebra/CAbGroups/zmult_char.con". + +inline "cic:/CoRN/algebra/CAbGroups/zmult_wd.con". + +inline "cic:/CoRN/algebra/CAbGroups/zmult_one.con". + +inline "cic:/CoRN/algebra/CAbGroups/zmult_min_one.con". + +inline "cic:/CoRN/algebra/CAbGroups/zmult_zero.con". + +inline "cic:/CoRN/algebra/CAbGroups/zmult_Zero.con". + +(* UNEXPORTED +Hint Resolve zmult_zero: algebra. +*) + +inline "cic:/CoRN/algebra/CAbGroups/zmult_plus.con". + +inline "cic:/CoRN/algebra/CAbGroups/zmult_mult.con". + +inline "cic:/CoRN/algebra/CAbGroups/zmult_plus'.con". + +(* UNEXPORTED +End Group_Extras +*) + +(* UNEXPORTED +Hint Resolve nmult_wd nmult_one nmult_Zero nmult_plus nmult_inv nmult_mult + nmult_plus' zmult_wd zmult_one zmult_min_one zmult_zero zmult_Zero + zmult_plus zmult_mult zmult_plus': algebra. +*) + +(* UNEXPORTED +Implicit Arguments nmult [G]. +*) + +(* UNEXPORTED +Implicit Arguments zmult [G]. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CAbMonoids.ma b/matita/contribs/CoRN-Decl/algebra/CAbMonoids.ma new file mode 100644 index 000000000..716750a78 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CAbMonoids.ma @@ -0,0 +1,99 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CAbMonoids". + +include "CoRN.ma". + +include "algebra/CMonoids.ma". + +(* UNEXPORTED +Section Abelian_Monoids +*) + +(*#* +* Abelian Monoids +Now we introduce commutativity and add some results. +*) + +inline "cic:/CoRN/algebra/CAbMonoids/is_CAbMonoid.con". + +inline "cic:/CoRN/algebra/CAbMonoids/CAbMonoid.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CAbMonoids/cam_crr.con 0 (* compounds *). + +(* UNEXPORTED +Section AbMonoid_Axioms +*) + +alias id "M" = "cic:/CoRN/algebra/CAbMonoids/Abelian_Monoids/AbMonoid_Axioms/M.var". + +(*#* +%\begin{convention}% Let [M] be an abelian monoid. +%\end{convention}% +*) + +inline "cic:/CoRN/algebra/CAbMonoids/CAbMonoid_is_CAbMonoid.con". + +inline "cic:/CoRN/algebra/CAbMonoids/cam_commutes.con". + +inline "cic:/CoRN/algebra/CAbMonoids/cam_commutes_unfolded.con". + +(* UNEXPORTED +End AbMonoid_Axioms +*) + +(* UNEXPORTED +Section SubCAbMonoids +*) + +(*#* +** Subgroups of an Abelian Monoid +*) + +alias id "M" = "cic:/CoRN/algebra/CAbMonoids/Abelian_Monoids/SubCAbMonoids/M.var". + +alias id "P" = "cic:/CoRN/algebra/CAbMonoids/Abelian_Monoids/SubCAbMonoids/P.var". + +alias id "Punit" = "cic:/CoRN/algebra/CAbMonoids/Abelian_Monoids/SubCAbMonoids/Punit.var". + +alias id "op_pres_P" = "cic:/CoRN/algebra/CAbMonoids/Abelian_Monoids/SubCAbMonoids/op_pres_P.var". + +(*#* +%\begin{convention}% +Let [M] be an Abelian Monoid and [P] be a ([CProp]-valued) predicate on [M] +that contains [Zero] and is closed under [[+]] and [[--]]. +%\end{convention}% +*) + +inline "cic:/CoRN/algebra/CAbMonoids/Abelian_Monoids/SubCAbMonoids/subcrr.con" "Abelian_Monoids__SubCAbMonoids__". + +inline "cic:/CoRN/algebra/CAbMonoids/isabgrp_scrr.con". + +inline "cic:/CoRN/algebra/CAbMonoids/Build_SubCAbMonoid.con". + +(* UNEXPORTED +End SubCAbMonoids +*) + +(* UNEXPORTED +End Abelian_Monoids +*) + +(* UNEXPORTED +Hint Resolve cam_commutes_unfolded: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CFields.ma b/matita/contribs/CoRN-Decl/algebra/CFields.ma new file mode 100644 index 000000000..8f9f5b7a0 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CFields.ma @@ -0,0 +1,585 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CFields". + +include "CoRN.ma". + +(* $Id: CFields.v,v 1.12 2004/04/23 10:00:52 lcf Exp $ *) + +(*#* printing [/] %\ensuremath{/}% #/# *) + +(*#* printing [//] %\ensuremath\ddagger% #‡# *) + +(*#* printing {/} %\ensuremath{/}% #/# *) + +(*#* printing {1/} %\ensuremath{\frac1\cdot}% #1/# *) + +(*#* printing [/]?[//] %\ensuremath{/?\ddagger}% #/?‡# *) + +include "algebra/CRings.ma". + +(* UNEXPORTED +Transparent sym_eq. +*) + +(* UNEXPORTED +Transparent f_equal. +*) + +(* UNEXPORTED +Transparent cs_crr. +*) + +(* UNEXPORTED +Transparent csg_crr. +*) + +(* UNEXPORTED +Transparent cm_crr. +*) + +(* UNEXPORTED +Transparent cg_crr. +*) + +(* UNEXPORTED +Transparent cr_crr. +*) + +(* UNEXPORTED +Transparent csf_fun. +*) + +(* UNEXPORTED +Transparent csbf_fun. +*) + +(* UNEXPORTED +Transparent csr_rel. +*) + +(* UNEXPORTED +Transparent cs_eq. +*) + +(* UNEXPORTED +Transparent cs_neq. +*) + +(* UNEXPORTED +Transparent cs_ap. +*) + +(* UNEXPORTED +Transparent cm_unit. +*) + +(* UNEXPORTED +Transparent csg_op. +*) + +(* UNEXPORTED +Transparent cg_inv. +*) + +(* UNEXPORTED +Transparent cg_minus. +*) + +(* UNEXPORTED +Transparent cr_one. +*) + +(* UNEXPORTED +Transparent cr_mult. +*) + +(* UNEXPORTED +Transparent nexp_op. +*) + +(* Begin_SpecReals *) + +(* FIELDS *) + +(*#* +* Fields %\label{section:fields}% +** Definition of the notion Field +*) + +inline "cic:/CoRN/algebra/CFields/is_CField.con". + +inline "cic:/CoRN/algebra/CFields/CField.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CFields/cf_crr.con 0 (* compounds *). + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CFields/f_rcpcl'.con". + +inline "cic:/CoRN/algebra/CFields/f_rcpcl.con". + +(* UNEXPORTED +Implicit Arguments f_rcpcl [F]. +*) + +(*#* +[cf_div] is the division in a field. It is defined in terms of +multiplication and the reciprocal. [x[/]y] is only defined if +we have a proof of [y [#] Zero]. +*) + +inline "cic:/CoRN/algebra/CFields/cf_div.con". + +(* UNEXPORTED +Implicit Arguments cf_div [F]. +*) + +(* NOTATION +Notation "x [/] y [//] Hy" := (cf_div x y Hy) (at level 80). +*) + +(*#* +%\begin{convention}\label{convention:div-form}% +- Division in fields is a (type dependent) ternary function: [(cf_div x y Hy)] is denoted infix by [x [/] y [//] Hy]. +- In lemmas, a hypothesis that [t [#] Zero] will be named [t_]. +- We do not use [NonZeros], but write the condition [ [#] Zero] separately. +- In each lemma, we use only variables for proof objects, and these variables + are universally quantified. +For example, the informal lemma +$\frac{1}{x}\cdot\frac{1}{y} = \frac{1}{x\cdot y}$ +#(1/x).(1/y) = 1/(x.y)# for all [x] and [y]is formalized as +[[ +forall (x y : F) x_ y_ xy_, (1[/]x[//]x_) [*] (1[/]y[//]y_) [=] 1[/] (x[*]y)[//]xy_ +]] +and not as +[[ +forall (x y : F) x_ y_, (1[/]x[//]x_) [*] (1[/]y[//]y_) [=] 1[/] (x[*]y)[//](prod_nz x y x_ y_) +]] +We have made this choice to make it easier to apply lemmas; this can +be quite awkward if we would use the last formulation. +- So every division occurring in the formulation of a lemma is of the +form [e[/]e'[//]H] where [H] is a variable. Only exceptions: we may +write [e[/] (Snring n)] and [e[/]TwoNZ], [e[/]ThreeNZ] and so on. +(Constants like [TwoNZ] will be defined later on.) + +%\end{convention}% + +** Field axioms +%\begin{convention}% Let [F] be a field. +%\end{convention}% +*) + +(* UNEXPORTED +Section Field_axioms +*) + +alias id "F" = "cic:/CoRN/algebra/CFields/Field_axioms/F.var". + +inline "cic:/CoRN/algebra/CFields/CField_is_CField.con". + +inline "cic:/CoRN/algebra/CFields/rcpcl_is_inverse.con". + +(* UNEXPORTED +End Field_axioms +*) + +(* UNEXPORTED +Section Field_basics +*) + +(*#* ** Field basics +%\begin{convention}% Let [F] be a field. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/algebra/CFields/Field_basics/F.var". + +inline "cic:/CoRN/algebra/CFields/rcpcl_is_inverse_unfolded.con". + +inline "cic:/CoRN/algebra/CFields/field_mult_inv.con". + +(* UNEXPORTED +Hint Resolve field_mult_inv: algebra. +*) + +inline "cic:/CoRN/algebra/CFields/field_mult_inv_op.con". + +(* UNEXPORTED +End Field_basics +*) + +(* UNEXPORTED +Hint Resolve field_mult_inv field_mult_inv_op: algebra. +*) + +(* UNEXPORTED +Section Field_multiplication +*) + +(*#* +** Properties of multiplication +%\begin{convention}% Let [F] be a field. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/algebra/CFields/Field_multiplication/F.var". + +inline "cic:/CoRN/algebra/CFields/mult_resp_ap_zero.con". + +inline "cic:/CoRN/algebra/CFields/mult_lft_resp_ap.con". + +inline "cic:/CoRN/algebra/CFields/mult_rht_resp_ap.con". + +inline "cic:/CoRN/algebra/CFields/mult_resp_neq_zero.con". + +inline "cic:/CoRN/algebra/CFields/mult_resp_neq.con". + +inline "cic:/CoRN/algebra/CFields/mult_eq_zero.con". + +inline "cic:/CoRN/algebra/CFields/mult_cancel_lft.con". + +inline "cic:/CoRN/algebra/CFields/mult_cancel_rht.con". + +inline "cic:/CoRN/algebra/CFields/square_eq_aux.con". + +inline "cic:/CoRN/algebra/CFields/square_eq_weak.con". + +inline "cic:/CoRN/algebra/CFields/cond_square_eq.con". + +(* UNEXPORTED +End Field_multiplication +*) + +(* UNEXPORTED +Section x_square +*) + +inline "cic:/CoRN/algebra/CFields/x_xminone.con". + +inline "cic:/CoRN/algebra/CFields/square_id.con". + +(* UNEXPORTED +End x_square +*) + +(* UNEXPORTED +Hint Resolve mult_resp_ap_zero: algebra. +*) + +(* UNEXPORTED +Section Rcpcl_properties +*) + +(*#* +** Properties of reciprocal +%\begin{convention}% Let [F] be a field. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/algebra/CFields/Rcpcl_properties/F.var". + +inline "cic:/CoRN/algebra/CFields/inv_one.con". + +inline "cic:/CoRN/algebra/CFields/f_rcpcl_wd.con". + +inline "cic:/CoRN/algebra/CFields/f_rcpcl_mult.con". + +inline "cic:/CoRN/algebra/CFields/f_rcpcl_resp_ap_zero.con". + +inline "cic:/CoRN/algebra/CFields/f_rcpcl_f_rcpcl.con". + +(* UNEXPORTED +End Rcpcl_properties +*) + +(* UNEXPORTED +Section MultipGroup +*) + +(*#* +** The multiplicative group of nonzeros of a field. +%\begin{convention}% Let [F] be a field +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/algebra/CFields/MultipGroup/F.var". + +(*#* +The multiplicative monoid of NonZeros. +*) + +inline "cic:/CoRN/algebra/CFields/NonZeroMonoid.con". + +inline "cic:/CoRN/algebra/CFields/fmg_cs_inv.con". + +inline "cic:/CoRN/algebra/CFields/plus_nonzeros_eq_mult_dom.con". + +inline "cic:/CoRN/algebra/CFields/cfield_to_mult_cgroup.con". + +(* UNEXPORTED +End MultipGroup +*) + +(* UNEXPORTED +Section Div_properties +*) + +(*#* +** Properties of division +%\begin{convention}% Let [F] be a field. +%\end{convention}% + +%\begin{nameconvention}% +In the names of lemmas, we denote [[/]] by [div], and +[One[/]] by [recip]. +%\end{nameconvention}% +*) + +alias id "F" = "cic:/CoRN/algebra/CFields/Div_properties/F.var". + +inline "cic:/CoRN/algebra/CFields/div_prop.con". + +inline "cic:/CoRN/algebra/CFields/div_1.con". + +inline "cic:/CoRN/algebra/CFields/div_1'.con". + +inline "cic:/CoRN/algebra/CFields/div_1''.con". + +(* UNEXPORTED +Hint Resolve div_1: algebra. +*) + +inline "cic:/CoRN/algebra/CFields/x_div_x.con". + +(* UNEXPORTED +Hint Resolve x_div_x: algebra. +*) + +inline "cic:/CoRN/algebra/CFields/x_div_one.con". + +(*#* +The next lemma says $x\cdot\frac{y}{z} = \frac{x\cdot y}{z}$ +#x.(y/z) = (x.y)/z#. +*) + +inline "cic:/CoRN/algebra/CFields/x_mult_y_div_z.con". + +(* UNEXPORTED +Hint Resolve x_mult_y_div_z: algebra. +*) + +inline "cic:/CoRN/algebra/CFields/div_wd.con". + +(* UNEXPORTED +Hint Resolve div_wd: algebra_c. +*) + +(*#* +The next lemma says $\frac{\frac{x}{y}}{z} = \frac{x}{y\cdot z}$ +#[(x/y)/z = x/(y.z)]# +*) + +inline "cic:/CoRN/algebra/CFields/div_div.con". + +inline "cic:/CoRN/algebra/CFields/div_resp_ap_zero_rev.con". + +inline "cic:/CoRN/algebra/CFields/div_resp_ap_zero.con". + +(*#* +The next lemma says $\frac{x}{\frac{y}{z}} = \frac{x\cdot z}{y}$ +#[x/(y/z) = (x.z)/y]# +*) + +inline "cic:/CoRN/algebra/CFields/div_div2.con". + +(*#* +The next lemma says $\frac{x\cdot p}{y\cdot q} = \frac{x}{y}\cdot \frac{p}{q}$ +#[(x.p)/(y.q) = (x/y).(p/q)]# +*) + +inline "cic:/CoRN/algebra/CFields/mult_of_divs.con". + +inline "cic:/CoRN/algebra/CFields/div_dist.con". + +inline "cic:/CoRN/algebra/CFields/div_dist'.con". + +inline "cic:/CoRN/algebra/CFields/div_semi_sym.con". + +(* UNEXPORTED +Hint Resolve div_semi_sym: algebra. +*) + +inline "cic:/CoRN/algebra/CFields/eq_div.con". + +inline "cic:/CoRN/algebra/CFields/div_strext.con". + +(* UNEXPORTED +End Div_properties +*) + +(* UNEXPORTED +Hint Resolve div_1 div_1' div_1'' div_wd x_div_x x_div_one div_div div_div2 + mult_of_divs x_mult_y_div_z mult_of_divs div_dist div_dist' div_semi_sym + div_prop: algebra. +*) + +(*#* +** Cancellation laws for apartness and multiplication +%\begin{convention}% Let [F] be a field +%\end{convention}% +*) + +(* UNEXPORTED +Section Mult_Cancel_Ap_Zero +*) + +alias id "F" = "cic:/CoRN/algebra/CFields/Mult_Cancel_Ap_Zero/F.var". + +inline "cic:/CoRN/algebra/CFields/mult_cancel_ap_zero_lft.con". + +inline "cic:/CoRN/algebra/CFields/mult_cancel_ap_zero_rht.con". + +inline "cic:/CoRN/algebra/CFields/recip_ap_zero.con". + +inline "cic:/CoRN/algebra/CFields/recip_resp_ap.con". + +(* UNEXPORTED +End Mult_Cancel_Ap_Zero +*) + +(* UNEXPORTED +Section CField_Ops +*) + +(*#* +** Functional Operations + +We now move on to lifting these operations to functions. As we are +dealing with %\emph{partial}% #partial# functions, we don't +have to worry explicitly about the function by which we are dividing +being non-zero everywhere; this will simply be encoded in its domain. + +%\begin{convention}% +Let [X] be a Field and [F,G:(PartFunct X)] have domains respectively +[P] and [Q]. +%\end{convention}% +*) + +alias id "X" = "cic:/CoRN/algebra/CFields/CField_Ops/X.var". + +alias id "F" = "cic:/CoRN/algebra/CFields/CField_Ops/F.var". + +alias id "G" = "cic:/CoRN/algebra/CFields/CField_Ops/G.var". + +(* begin hide *) + +inline "cic:/CoRN/algebra/CFields/CField_Ops/P.con" "CField_Ops__". + +inline "cic:/CoRN/algebra/CFields/CField_Ops/Q.con" "CField_Ops__". + +(* end hide *) + +(* UNEXPORTED +Section Part_Function_Recip +*) + +(*#* +Some auxiliary notions are helpful in defining the domain. +*) + +inline "cic:/CoRN/algebra/CFields/CField_Ops/Part_Function_Recip/R.con" "CField_Ops__Part_Function_Recip__". + +inline "cic:/CoRN/algebra/CFields/CField_Ops/Part_Function_Recip/Ext2R.con" "CField_Ops__Part_Function_Recip__". + +inline "cic:/CoRN/algebra/CFields/part_function_recip_strext.con". + +inline "cic:/CoRN/algebra/CFields/part_function_recip_pred_wd.con". + +inline "cic:/CoRN/algebra/CFields/Frecip.con". + +(* UNEXPORTED +End Part_Function_Recip +*) + +(* UNEXPORTED +Section Part_Function_Div +*) + +(*#* +For division things work out almost in the same way. +*) + +inline "cic:/CoRN/algebra/CFields/CField_Ops/Part_Function_Div/R.con" "CField_Ops__Part_Function_Div__". + +inline "cic:/CoRN/algebra/CFields/CField_Ops/Part_Function_Div/Ext2R.con" "CField_Ops__Part_Function_Div__". + +inline "cic:/CoRN/algebra/CFields/part_function_div_strext.con". + +inline "cic:/CoRN/algebra/CFields/part_function_div_pred_wd.con". + +inline "cic:/CoRN/algebra/CFields/Fdiv.con". + +(* UNEXPORTED +End Part_Function_Div +*) + +(*#* +%\begin{convention}% Let [R:X->CProp]. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CFields/CField_Ops/R.var". + +inline "cic:/CoRN/algebra/CFields/included_FRecip.con". + +inline "cic:/CoRN/algebra/CFields/included_FRecip'.con". + +inline "cic:/CoRN/algebra/CFields/included_FDiv.con". + +inline "cic:/CoRN/algebra/CFields/included_FDiv'.con". + +inline "cic:/CoRN/algebra/CFields/included_FDiv''.con". + +(* UNEXPORTED +End CField_Ops +*) + +(* UNEXPORTED +Implicit Arguments Frecip [X]. +*) + +(* NOTATION +Notation "{1/} x" := (Frecip x) (at level 2, right associativity). +*) + +(* UNEXPORTED +Implicit Arguments Fdiv [X]. +*) + +(* NOTATION +Infix "{/}" := Fdiv (at level 41, no associativity). +*) + +(* UNEXPORTED +Hint Resolve included_FRecip included_FDiv : included. +*) + +(* UNEXPORTED +Hint Immediate included_FRecip' included_FDiv' included_FDiv'' : included. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CGroups.ma b/matita/contribs/CoRN-Decl/algebra/CGroups.ma new file mode 100644 index 000000000..67d508c12 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CGroups.ma @@ -0,0 +1,407 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CGroups". + +include "CoRN.ma". + +(* $Id: CGroups.v,v 1.9 2004/04/23 10:00:52 lcf Exp $ *) + +(*#* printing [-] %\ensuremath-% #−# *) + +(*#* printing [--] %\ensuremath-% #−# *) + +(*#* printing {-} %\ensuremath-% #−# *) + +(*#* printing {--} %\ensuremath-% #−# *) + +include "algebra/CMonoids.ma". + +(* Begin_SpecReals *) + +(*#* +* Groups +** Definition of the notion of Group +*) + +inline "cic:/CoRN/algebra/CGroups/is_inverse.con". + +(* UNEXPORTED +Implicit Arguments is_inverse [S]. +*) + +inline "cic:/CoRN/algebra/CGroups/is_CGroup.con". + +inline "cic:/CoRN/algebra/CGroups/CGroup.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CGroups/cg_crr.con 0 (* compounds *). + +(* End_SpecReals *) + +(* Begin_SpecReals *) + +(* UNEXPORTED +Implicit Arguments cg_inv [c]. +*) + +(* NOTATION +Notation "[--] x" := (cg_inv x) (at level 2, right associativity). +*) + +inline "cic:/CoRN/algebra/CGroups/cg_minus.con". + +(*#* +%\begin{nameconvention}% +In the names of lemmas, we will denote [[--] ] with [inv], +and [ [-] ] with [minus]. +%\end{nameconvention}% +*) + +(* UNEXPORTED +Implicit Arguments cg_minus [G]. +*) + +(* NOTATION +Infix "[-]" := cg_minus (at level 50, left associativity). +*) + +(* End_SpecReals *) + +(*#* +** Group axioms +%\begin{convention}% Let [G] be a group. +%\end{convention}% +*) + +(* UNEXPORTED +Section CGroup_axioms +*) + +alias id "G" = "cic:/CoRN/algebra/CGroups/CGroup_axioms/G.var". + +inline "cic:/CoRN/algebra/CGroups/cg_inverse.con". + +(* UNEXPORTED +End CGroup_axioms +*) + +(*#* +** Group basics +General properties of groups. +%\begin{convention}% Let [G] be a group. +%\end{convention}% +*) + +(* UNEXPORTED +Section CGroup_basics +*) + +alias id "G" = "cic:/CoRN/algebra/CGroups/CGroup_basics/G.var". + +inline "cic:/CoRN/algebra/CGroups/cg_rht_inv_unfolded.con". + +inline "cic:/CoRN/algebra/CGroups/cg_lft_inv_unfolded.con". + +inline "cic:/CoRN/algebra/CGroups/cg_minus_correct.con". + +(* UNEXPORTED +Hint Resolve cg_rht_inv_unfolded cg_lft_inv_unfolded cg_minus_correct: + algebra. +*) + +inline "cic:/CoRN/algebra/CGroups/cg_inverse'.con". + +(* Hints for Auto *) + +inline "cic:/CoRN/algebra/CGroups/cg_minus_unfolded.con". + +(* UNEXPORTED +Hint Resolve cg_minus_unfolded: algebra. +*) + +inline "cic:/CoRN/algebra/CGroups/cg_minus_wd.con". + +(* UNEXPORTED +Hint Resolve cg_minus_wd: algebra_c. +*) + +inline "cic:/CoRN/algebra/CGroups/cg_minus_strext.con". + +inline "cic:/CoRN/algebra/CGroups/cg_minus_is_csetoid_bin_op.con". + +inline "cic:/CoRN/algebra/CGroups/grp_inv_assoc.con". + +(* UNEXPORTED +Hint Resolve grp_inv_assoc: algebra. +*) + +inline "cic:/CoRN/algebra/CGroups/cg_inv_unique.con". + +inline "cic:/CoRN/algebra/CGroups/cg_inv_inv.con". + +(* UNEXPORTED +Hint Resolve cg_inv_inv: algebra. +*) + +inline "cic:/CoRN/algebra/CGroups/cg_cancel_lft.con". + +inline "cic:/CoRN/algebra/CGroups/cg_cancel_rht.con". + +inline "cic:/CoRN/algebra/CGroups/cg_inv_unique'.con". + +inline "cic:/CoRN/algebra/CGroups/cg_inv_unique_2.con". + +inline "cic:/CoRN/algebra/CGroups/cg_zero_inv.con". + +(* UNEXPORTED +Hint Resolve cg_zero_inv: algebra. +*) + +inline "cic:/CoRN/algebra/CGroups/cg_inv_zero.con". + +inline "cic:/CoRN/algebra/CGroups/cg_inv_op.con". + +(*#* +Useful for interactive proof development. +*) + +inline "cic:/CoRN/algebra/CGroups/x_minus_x.con". + +(*#* +** Sub-groups +%\begin{convention}% Let [P] be a predicate on [G] containing +[Zero] and closed under [[+]] and [[--] ]. +%\end{convention}% +*) + +(* UNEXPORTED +Section SubCGroups +*) + +alias id "P" = "cic:/CoRN/algebra/CGroups/CGroup_basics/SubCGroups/P.var". + +alias id "Punit" = "cic:/CoRN/algebra/CGroups/CGroup_basics/SubCGroups/Punit.var". + +alias id "op_pres_P" = "cic:/CoRN/algebra/CGroups/CGroup_basics/SubCGroups/op_pres_P.var". + +alias id "inv_pres_P" = "cic:/CoRN/algebra/CGroups/CGroup_basics/SubCGroups/inv_pres_P.var". + +inline "cic:/CoRN/algebra/CGroups/CGroup_basics/SubCGroups/subcrr.con" "CGroup_basics__SubCGroups__". + +inline "cic:/CoRN/algebra/CGroups/CGroup_basics/SubCGroups/subinv.con" "CGroup_basics__SubCGroups__". + +inline "cic:/CoRN/algebra/CGroups/isgrp_scrr.con". + +inline "cic:/CoRN/algebra/CGroups/Build_SubCGroup.con". + +(* UNEXPORTED +End SubCGroups +*) + +(* UNEXPORTED +End CGroup_basics +*) + +(* UNEXPORTED +Hint Resolve cg_rht_inv_unfolded cg_lft_inv_unfolded: algebra. +*) + +(* UNEXPORTED +Hint Resolve cg_inv_inv cg_minus_correct cg_zero_inv cg_inv_zero: algebra. +*) + +(* UNEXPORTED +Hint Resolve cg_minus_unfolded grp_inv_assoc cg_inv_op: algebra. +*) + +(* UNEXPORTED +Hint Resolve cg_minus_wd: algebra_c. +*) + +(*#* +** Associative properties of groups +%\begin{convention}% Let [G] be a group. +%\end{convention}% +*) + +(* UNEXPORTED +Section Assoc_properties +*) + +alias id "G" = "cic:/CoRN/algebra/CGroups/Assoc_properties/G.var". + +inline "cic:/CoRN/algebra/CGroups/assoc_2.con". + +inline "cic:/CoRN/algebra/CGroups/zero_minus.con". + +inline "cic:/CoRN/algebra/CGroups/cg_cancel_mixed.con". + +inline "cic:/CoRN/algebra/CGroups/plus_resp_eq.con". + +(* UNEXPORTED +End Assoc_properties +*) + +(* UNEXPORTED +Hint Resolve assoc_2 minus_plus zero_minus cg_cancel_mixed plus_resp_eq: + algebra. +*) + +(*#* +** Apartness in Constructive Groups +Specific properties of apartness. +%\begin{convention}% Let [G] be a group. +%\end{convention}% +*) + +(* UNEXPORTED +Section cgroups_apartness +*) + +alias id "G" = "cic:/CoRN/algebra/CGroups/cgroups_apartness/G.var". + +inline "cic:/CoRN/algebra/CGroups/cg_add_ap_zero.con". + +inline "cic:/CoRN/algebra/CGroups/op_rht_resp_ap.con". + +inline "cic:/CoRN/algebra/CGroups/cg_ap_cancel_rht.con". + +inline "cic:/CoRN/algebra/CGroups/plus_cancel_ap_rht.con". + +inline "cic:/CoRN/algebra/CGroups/minus_ap_zero.con". + +inline "cic:/CoRN/algebra/CGroups/zero_minus_apart.con". + +inline "cic:/CoRN/algebra/CGroups/inv_resp_ap_zero.con". + +inline "cic:/CoRN/algebra/CGroups/inv_resp_ap.con". + +inline "cic:/CoRN/algebra/CGroups/minus_resp_ap_rht.con". + +inline "cic:/CoRN/algebra/CGroups/minus_resp_ap_lft.con". + +inline "cic:/CoRN/algebra/CGroups/minus_cancel_ap_rht.con". + +(* UNEXPORTED +End cgroups_apartness +*) + +(* UNEXPORTED +Hint Resolve op_rht_resp_ap: algebra. +*) + +(* UNEXPORTED +Hint Resolve minus_ap_zero zero_minus_apart inv_resp_ap_zero: algebra. +*) + +(* UNEXPORTED +Section CGroup_Ops +*) + +(*#* +** Functional operations + +As before, we lift our group operations to the function space of the group. + +%\begin{convention}% +Let [G] be a group and [F,F':(PartFunct G)] with domains given respectively +by [P] and [Q]. +%\end{convention}% +*) + +alias id "G" = "cic:/CoRN/algebra/CGroups/CGroup_Ops/G.var". + +alias id "F" = "cic:/CoRN/algebra/CGroups/CGroup_Ops/F.var". + +alias id "F'" = "cic:/CoRN/algebra/CGroups/CGroup_Ops/F'.var". + +(* begin hide *) + +inline "cic:/CoRN/algebra/CGroups/CGroup_Ops/P.con" "CGroup_Ops__". + +inline "cic:/CoRN/algebra/CGroups/CGroup_Ops/Q.con" "CGroup_Ops__". + +(* end hide *) + +(* UNEXPORTED +Section Part_Function_Inv +*) + +inline "cic:/CoRN/algebra/CGroups/part_function_inv_strext.con". + +inline "cic:/CoRN/algebra/CGroups/Finv.con". + +(* UNEXPORTED +End Part_Function_Inv +*) + +(* UNEXPORTED +Section Part_Function_Minus +*) + +inline "cic:/CoRN/algebra/CGroups/part_function_minus_strext.con". + +inline "cic:/CoRN/algebra/CGroups/Fminus.con". + +(* UNEXPORTED +End Part_Function_Minus +*) + +(*#* +%\begin{convention}% Let [R:G->CProp]. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CGroups/CGroup_Ops/R.var". + +inline "cic:/CoRN/algebra/CGroups/included_FInv.con". + +inline "cic:/CoRN/algebra/CGroups/included_FInv'.con". + +inline "cic:/CoRN/algebra/CGroups/included_FMinus.con". + +inline "cic:/CoRN/algebra/CGroups/included_FMinus'.con". + +inline "cic:/CoRN/algebra/CGroups/included_FMinus''.con". + +(* UNEXPORTED +End CGroup_Ops +*) + +(* UNEXPORTED +Implicit Arguments Finv [G]. +*) + +(* NOTATION +Notation "{--} x" := (Finv x) (at level 2, right associativity). +*) + +(* UNEXPORTED +Implicit Arguments Fminus [G]. +*) + +(* NOTATION +Infix "{-}" := Fminus (at level 50, left associativity). +*) + +(* UNEXPORTED +Hint Resolve included_FInv included_FMinus : included. +*) + +(* UNEXPORTED +Hint Immediate included_FInv' included_FMinus' included_FMinus'' : included. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CLogic.ma b/matita/contribs/CoRN-Decl/algebra/CLogic.ma new file mode 100644 index 000000000..b1d55aa9a --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CLogic.ma @@ -0,0 +1,623 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CLogic". + +include "CoRN.ma". + +(* $Id: CLogic.v,v 1.10 2004/04/09 15:58:31 lcf Exp $ *) + +(*#* printing Not %\ensuremath\neg% #~# *) + +(*#* printing CNot %\ensuremath\neg% #~# *) + +(*#* printing Iff %\ensuremath\Leftrightarrow% #⇔# *) + +(*#* printing CFalse %\ensuremath\bot% #⊥# *) + +(*#* printing False %\ensuremath\bot% #⊥# *) + +(*#* printing CTrue %\ensuremath\top% *) + +(*#* printing True %\ensuremath\top% *) + +(*#* printing or %\ensuremath{\mathrel\vee}% *) + +(*#* printing and %\ensuremath{\mathrel\wedge}% *) + +include "algebra/Basics.ma". + +(*#* *Extending the Coq Logic +Because notions of apartness and order have computational meaning, we +will have to define logical connectives in [Type]. In order to +keep a syntactic distinction between types of terms, we define [CProp] +as an alias for [Type], to be used as type of (computationally meaningful) +propositions. + +Falsehood and negation will typically not be needed in [CProp], as +they are used to refer to negative statements, which carry no +computational meaning. Therefore, we will simply define a negation +operator from [Type] to [Prop] . + +Conjunction, disjunction and existential quantification will have to come in +multiple varieties. For conjunction, we will need four operators of type +[s1->s2->s3], where [s3] is [Prop] if both [s1] and [s2] +are [Prop] and [CProp] otherwise. +We here take advantage of the inclusion of [Prop] in [Type]. + +Disjunction is slightly different, as it will always return a value in [CProp] even +if both arguments are propositions. This is because in general +it may be computationally important to know which of the two branches of the +disjunction actually holds. + +Existential quantification will similarly always return a value in [CProp]. + +- [CProp]-valued conjuction will be denoted as [and]; +- [Crop]-valued conjuction will be denoted as [or]; +- Existential quantification will be written as [{x:A & B}] or [{x:A | B}], +according to whether [B] is respectively of type [CProp] or [Prop]. + +In a few specific situations we do need truth, false and negation in [CProp], +so we will also introduce them; this should be a temporary option. + +Finally, for other formulae that might occur in our [CProp]-valued +propositions, such as [(le m n)], we have to introduce a [CProp]-valued +version. +*) + +inline "cic:/CoRN/algebra/CLogic/CProp.con". + +(* UNEXPORTED +Section Basics +*) + +(*#* ** Basics +Here we treat conversion from [Prop] to [CProp] and vice versa, +and some basic connectives in [CProp]. +*) + +inline "cic:/CoRN/algebra/CLogic/Not.con". + +inline "cic:/CoRN/algebra/CLogic/CAnd.ind". + +inline "cic:/CoRN/algebra/CLogic/Iff.con". + +inline "cic:/CoRN/algebra/CLogic/CFalse.ind". + +inline "cic:/CoRN/algebra/CLogic/CTrue.ind". + +inline "cic:/CoRN/algebra/CLogic/proj1_sigT.con". + +inline "cic:/CoRN/algebra/CLogic/proj2_sigT.con". + +inline "cic:/CoRN/algebra/CLogic/sig2T.ind". + +inline "cic:/CoRN/algebra/CLogic/proj1_sig2T.con". + +inline "cic:/CoRN/algebra/CLogic/proj2a_sig2T.con". + +inline "cic:/CoRN/algebra/CLogic/proj2b_sig2T.con". + +inline "cic:/CoRN/algebra/CLogic/toCProp.ind". + +inline "cic:/CoRN/algebra/CLogic/toCProp_e.con". + +inline "cic:/CoRN/algebra/CLogic/CNot.con". + +inline "cic:/CoRN/algebra/CLogic/Ccontrapos'.con". + +inline "cic:/CoRN/algebra/CLogic/COr.ind". + +(*#* +Some lemmas to make it possible to use [Step] when reasoning with +biimplications.*) + +(* NOTATION +Infix "IFF" := Iff (at level 60, right associativity). +*) + +inline "cic:/CoRN/algebra/CLogic/Iff_left.con". + +inline "cic:/CoRN/algebra/CLogic/Iff_right.con". + +inline "cic:/CoRN/algebra/CLogic/Iff_refl.con". + +inline "cic:/CoRN/algebra/CLogic/Iff_sym.con". + +inline "cic:/CoRN/algebra/CLogic/Iff_trans.con". + +inline "cic:/CoRN/algebra/CLogic/Iff_imp_imp.con". + +(* UNEXPORTED +Declare Right Step Iff_right. +*) + +(* UNEXPORTED +Declare Left Step Iff_left. +*) + +(* UNEXPORTED +Hint Resolve Iff_trans Iff_sym Iff_refl Iff_right Iff_left Iff_imp_imp : algebra. +*) + +(* UNEXPORTED +End Basics +*) + +(* begin hide *) + +(* NOTATION +Infix "or" := COr (at level 85, right associativity). +*) + +(* NOTATION +Infix "and" := CAnd (at level 80, right associativity). +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/CLogic/not_r_cor_rect.con". + +inline "cic:/CoRN/algebra/CLogic/not_l_cor_rect.con". + +(* begin hide *) + +(* NOTATION +Notation "{ x : A | P }" := (sigT (fun x : A => P):CProp) + (at level 0, x at level 99) : type_scope. +*) + +(* NOTATION +Notation "{ x : A | P | Q }" := + (sig2T A (fun x : A => P) (fun x : A => Q)) (at level 0, x at level 99) : + type_scope. +*) + +(* end hide *) + +(* +Section test. + +Variable A:Type. +Variables P,Q:A->Prop. +Variables X,Y:A->CProp. + +Check {x:A | (P x)}. +Check {x:A |(X x)}. +Check {x:A | (X x) | (Y x)}. +Check {x:A | (P x) | (Q x)}. +Check {x:A | (P x) | (X x)}. +Check {x:A | (X x) | (P x)}. + +End test. +*) + +(* UNEXPORTED +Hint Resolve CI CAnd_intro Cinleft Cinright existT exist2T: core. +*) + +(* UNEXPORTED +Section Choice +*) + +(* **Choice +Let [P] be a predicate on $\NN^2$#N times N#. +*) + +alias id "P" = "cic:/CoRN/algebra/CLogic/Choice/P.var". + +inline "cic:/CoRN/algebra/CLogic/choice.con". + +(* UNEXPORTED +End Choice +*) + +(* UNEXPORTED +Section Logical_Remarks +*) + +(*#* We prove a few logical results which are helpful to have as lemmas +when [A], [B] and [C] are non trivial. +*) + +inline "cic:/CoRN/algebra/CLogic/CNot_Not_or.con". + +inline "cic:/CoRN/algebra/CLogic/CdeMorgan_ex_all.con". + +(* UNEXPORTED +End Logical_Remarks +*) + +(* UNEXPORTED +Section CRelation_Definition +*) + +(*#* ** [CProp]-valued Relations +Similar to Relations.v in Coq's standard library. + +%\begin{convention}% Let [A:Type] and [R:Crelation]. +%\end{convention}% +*) + +alias id "A" = "cic:/CoRN/algebra/CLogic/CRelation_Definition/A.var". + +inline "cic:/CoRN/algebra/CLogic/Crelation.con". + +alias id "R" = "cic:/CoRN/algebra/CLogic/CRelation_Definition/R.var". + +inline "cic:/CoRN/algebra/CLogic/Creflexive.con". + +inline "cic:/CoRN/algebra/CLogic/Ctransitive.con". + +inline "cic:/CoRN/algebra/CLogic/Csymmetric.con". + +inline "cic:/CoRN/algebra/CLogic/Cequiv.con". + +(* UNEXPORTED +End CRelation_Definition +*) + +(* UNEXPORTED +Section TRelation_Definition +*) + +(*#* ** [Prop]-valued Relations +Analogous. + +%\begin{convention}% Let [A:Type] and [R:Trelation]. +%\end{convention}% +*) + +alias id "A" = "cic:/CoRN/algebra/CLogic/TRelation_Definition/A.var". + +inline "cic:/CoRN/algebra/CLogic/Trelation.con". + +alias id "R" = "cic:/CoRN/algebra/CLogic/TRelation_Definition/R.var". + +inline "cic:/CoRN/algebra/CLogic/Treflexive.con". + +inline "cic:/CoRN/algebra/CLogic/Ttransitive.con". + +inline "cic:/CoRN/algebra/CLogic/Tsymmetric.con". + +inline "cic:/CoRN/algebra/CLogic/Tequiv.con". + +(* UNEXPORTED +End TRelation_Definition +*) + +inline "cic:/CoRN/algebra/CLogic/eqs.ind". + +(* UNEXPORTED +Section le_odd +*) + +(*#* ** The relation [le], [lt], [odd] and [even] in [CProp] +*) + +inline "cic:/CoRN/algebra/CLogic/Cle.ind". + +inline "cic:/CoRN/algebra/CLogic/Cnat_double_ind.con". + +inline "cic:/CoRN/algebra/CLogic/my_Cle_ind.con". + +inline "cic:/CoRN/algebra/CLogic/Cle_n_S.con". + +inline "cic:/CoRN/algebra/CLogic/toCle.con". + +(* UNEXPORTED +Hint Resolve toCle. +*) + +inline "cic:/CoRN/algebra/CLogic/Cle_to.con". + +inline "cic:/CoRN/algebra/CLogic/Clt.con". + +inline "cic:/CoRN/algebra/CLogic/toCProp_lt.con". + +inline "cic:/CoRN/algebra/CLogic/Clt_to.con". + +inline "cic:/CoRN/algebra/CLogic/Cle_le_S_eq.con". + +inline "cic:/CoRN/algebra/CLogic/Cnat_total_order.con". + +inline "cic:/CoRN/algebra/CLogic/Codd.ind". + +inline "cic:/CoRN/algebra/CLogic/Codd_even_to.con". + +inline "cic:/CoRN/algebra/CLogic/Codd_to.con". + +inline "cic:/CoRN/algebra/CLogic/Ceven_to.con". + +inline "cic:/CoRN/algebra/CLogic/to_Codd_even.con". + +inline "cic:/CoRN/algebra/CLogic/to_Codd.con". + +inline "cic:/CoRN/algebra/CLogic/to_Ceven.con". + +(* UNEXPORTED +End le_odd +*) + +(* UNEXPORTED +Section Misc +*) + +(*#* **Miscellaneous +*) + +inline "cic:/CoRN/algebra/CLogic/CZ_exh.con". + +inline "cic:/CoRN/algebra/CLogic/Cnats_Z_ind.con". + +inline "cic:/CoRN/algebra/CLogic/Cdiff_Z_ind.con". + +inline "cic:/CoRN/algebra/CLogic/Cpred_succ_Z_ind.con". + +inline "cic:/CoRN/algebra/CLogic/not_r_sum_rec.con". + +inline "cic:/CoRN/algebra/CLogic/not_l_sum_rec.con". + +(* UNEXPORTED +End Misc +*) + +(*#* **Results about the natural numbers + +We now define a class of predicates on a finite subset of natural +numbers that will be important throughout all our work. Essentially, +these are simply setoid predicates, but for clarity we will never +write them in that form but we will single out the preservation of the +setoid equality. +*) + +inline "cic:/CoRN/algebra/CLogic/nat_less_n_pred.con". + +inline "cic:/CoRN/algebra/CLogic/nat_less_n_pred'.con". + +(* UNEXPORTED +Implicit Arguments nat_less_n_pred [n]. +*) + +(* UNEXPORTED +Implicit Arguments nat_less_n_pred' [n]. +*) + +(* UNEXPORTED +Section Odd_and_Even +*) + +(*#* +For our work we will many times need to distinguish cases between even or odd numbers. +We begin by proving that this case distinction is decidable. +Next, we prove the usual results about sums of even and odd numbers: +*) + +inline "cic:/CoRN/algebra/CLogic/even_plus_n_n.con". + +inline "cic:/CoRN/algebra/CLogic/even_or_odd_plus.con". + +(*#* Finally, we prove that an arbitrary natural number can be written in some canonical way. +*) + +inline "cic:/CoRN/algebra/CLogic/even_or_odd_plus_gt.con". + +(* UNEXPORTED +End Odd_and_Even +*) + +(* UNEXPORTED +Hint Resolve even_plus_n_n: arith. +*) + +(* UNEXPORTED +Hint Resolve toCle: core. +*) + +(* UNEXPORTED +Section Natural_Numbers +*) + +(*#* **Algebraic Properties + +We now present a series of trivial things proved with [Omega] that are +stated as lemmas to make proofs shorter and to aid in auxiliary +definitions. Giving a name to these results allows us to use them in +definitions keeping conciseness. +*) + +inline "cic:/CoRN/algebra/CLogic/Clt_le_weak.con". + +inline "cic:/CoRN/algebra/CLogic/lt_5.con". + +inline "cic:/CoRN/algebra/CLogic/lt_8.con". + +inline "cic:/CoRN/algebra/CLogic/pred_lt.con". + +inline "cic:/CoRN/algebra/CLogic/lt_10.con". + +inline "cic:/CoRN/algebra/CLogic/lt_pred'.con". + +inline "cic:/CoRN/algebra/CLogic/le_1.con". + +inline "cic:/CoRN/algebra/CLogic/le_2.con". + +inline "cic:/CoRN/algebra/CLogic/plus_eq_one_imp_eq_zero.con". + +inline "cic:/CoRN/algebra/CLogic/not_not_lt.con". + +inline "cic:/CoRN/algebra/CLogic/plus_pred_pred_plus.con". + +(*#* We now prove some properties of functions on the natural numbers. + +%\begin{convention}% Let [H:nat->nat]. +%\end{convention}% +*) + +alias id "h" = "cic:/CoRN/algebra/CLogic/Natural_Numbers/h.var". + +(*#* +First we characterize monotonicity by a local condition: if [h(n) < h(n+1)] +for every natural number [n] then [h] is monotonous. An analogous result +holds for weak monotonicity. +*) + +inline "cic:/CoRN/algebra/CLogic/nat_local_mon_imp_mon.con". + +inline "cic:/CoRN/algebra/CLogic/nat_local_mon_imp_mon_le.con". + +(*#* A strictly increasing function is injective: *) + +inline "cic:/CoRN/algebra/CLogic/nat_mon_imp_inj.con". + +(*#* And (not completely trivial) a function that preserves [lt] also preserves [le]. *) + +inline "cic:/CoRN/algebra/CLogic/nat_mon_imp_mon'.con". + +(*#* +The last lemmas in this section state that a monotonous function in the + natural numbers completely covers the natural numbers, that is, for every +natural number [n] there is an [i] such that [h(i) <= n<(n+1) <= h(i+1)]. +These are useful for integration. +*) + +inline "cic:/CoRN/algebra/CLogic/mon_fun_covers.con". + +inline "cic:/CoRN/algebra/CLogic/weird_mon_covers.con". + +(* UNEXPORTED +End Natural_Numbers +*) + +(*#* +Useful for the Fundamental Theorem of Algebra. +*) + +inline "cic:/CoRN/algebra/CLogic/kseq_prop.con". + +(* UNEXPORTED +Section Predicates_to_CProp +*) + +(*#* **Logical Properties + +This section contains lemmas that aid in logical reasoning with +natural numbers. First, we present some principles of induction, both +for [CProp]- and [Prop]-valued predicates. We begin by presenting the +results for [CProp]-valued predicates: +*) + +inline "cic:/CoRN/algebra/CLogic/even_induction.con". + +inline "cic:/CoRN/algebra/CLogic/odd_induction.con". + +inline "cic:/CoRN/algebra/CLogic/four_induction.con". + +inline "cic:/CoRN/algebra/CLogic/nat_complete_double_induction.con". + +inline "cic:/CoRN/algebra/CLogic/odd_double_ind.con". + +(*#* For subsetoid predicates in the natural numbers we can eliminate +disjunction (and existential quantification) as follows. +*) + +inline "cic:/CoRN/algebra/CLogic/finite_or_elim.con". + +inline "cic:/CoRN/algebra/CLogic/str_finite_or_elim.con". + +(* UNEXPORTED +End Predicates_to_CProp +*) + +(* UNEXPORTED +Section Predicates_to_Prop +*) + +(*#* Finally, analogous results for [Prop]-valued predicates are presented for +completeness's sake. +*) + +inline "cic:/CoRN/algebra/CLogic/even_ind.con". + +inline "cic:/CoRN/algebra/CLogic/odd_ind.con". + +inline "cic:/CoRN/algebra/CLogic/nat_complete_double_ind.con". + +inline "cic:/CoRN/algebra/CLogic/four_ind.con". + +(* UNEXPORTED +End Predicates_to_Prop +*) + +(*#* **Integers + +Similar results for integers. +*) + +(* begin hide *) + +(* UNEXPORTED +Tactic Notation "ElimCompare" constr(c) constr(d) := elim_compare c d. +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/CLogic/Zlts.con". + +inline "cic:/CoRN/algebra/CLogic/toCProp_Zlt.con". + +inline "cic:/CoRN/algebra/CLogic/CZlt_to.con". + +inline "cic:/CoRN/algebra/CLogic/Zsgn_1.con". + +inline "cic:/CoRN/algebra/CLogic/Zsgn_2.con". + +inline "cic:/CoRN/algebra/CLogic/Zsgn_3.con". + +(*#* The following have unusual names, in line with the series of lemmata in +fast_integers.v. +*) + +inline "cic:/CoRN/algebra/CLogic/ZL4'.con". + +inline "cic:/CoRN/algebra/CLogic/ZL9.con". + +inline "cic:/CoRN/algebra/CLogic/Zsgn_4.con". + +inline "cic:/CoRN/algebra/CLogic/Zsgn_5.con". + +inline "cic:/CoRN/algebra/CLogic/nat_nat_pos.con". + +inline "cic:/CoRN/algebra/CLogic/S_predn.con". + +inline "cic:/CoRN/algebra/CLogic/absolu_1.con". + +inline "cic:/CoRN/algebra/CLogic/absolu_2.con". + +inline "cic:/CoRN/algebra/CLogic/Zgt_mult_conv_absorb_l.con". + +inline "cic:/CoRN/algebra/CLogic/Zgt_mult_reg_absorb_l.con". + +inline "cic:/CoRN/algebra/CLogic/Zmult_Sm_Sn.con". + +(* NOTATION +Notation ProjT1 := (proj1_sigT _ _). +*) + +(* NOTATION +Notation ProjT2 := (proj2_sigT _ _). +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CMonoids.ma b/matita/contribs/CoRN-Decl/algebra/CMonoids.ma new file mode 100644 index 000000000..d7a0d53ab --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CMonoids.ma @@ -0,0 +1,175 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CMonoids". + +include "CoRN.ma". + +(* $Id: CMonoids.v,v 1.3 2004/04/07 15:07:57 lcf Exp $ *) + +(*#* printing Zero %\ensuremath{\mathbf0}% #0# *) + +include "algebra/CSemiGroups.ma". + +(* Begin_SpecReals *) + +(*#* +* Monoids %\label{section:monoids}% +** Definition of monoids +*) + +inline "cic:/CoRN/algebra/CMonoids/is_rht_unit.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CMonoids/is_lft_unit.con". + +(* UNEXPORTED +Implicit Arguments is_lft_unit [S]. +*) + +(* Begin_SpecReals *) + +(* UNEXPORTED +Implicit Arguments is_rht_unit [S]. +*) + +inline "cic:/CoRN/algebra/CMonoids/is_CMonoid.ind". + +inline "cic:/CoRN/algebra/CMonoids/CMonoid.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CMonoids/cm_crr.con 0 (* compounds *). + +(*#* +%\begin{nameconvention}% +In the names of lemmas, we will denote [Zero] with [zero]. +We denote [ [#] Zero] in the names of lemmas by [ap_zero] +(and not, e.g.%\% [nonzero]). +%\end{nameconvention}% +*) + +(* Begin_SpecReals *) + +(*#* +The predicate "non-zero" is defined. +In lemmas we will continue to write [x [#] Zero], rather than +[(nonZeroP x)], but the predicate is useful for some high-level definitions, +e.g. for the setoid of non-zeros. +*) + +(* NOTATION +Notation Zero := (cm_unit _). +*) + +inline "cic:/CoRN/algebra/CMonoids/nonZeroP.con". + +(* End_SpecReals *) + +(* UNEXPORTED +Implicit Arguments nonZeroP [M]. +*) + +(*#* +** Monoid axioms +%\begin{convention}% Let [M] be a monoid. +%\end{convention}% +*) + +(* UNEXPORTED +Section CMonoid_axioms +*) + +alias id "M" = "cic:/CoRN/algebra/CMonoids/CMonoid_axioms/M.var". + +inline "cic:/CoRN/algebra/CMonoids/CMonoid_is_CMonoid.con". + +inline "cic:/CoRN/algebra/CMonoids/cm_rht_unit.con". + +inline "cic:/CoRN/algebra/CMonoids/cm_lft_unit.con". + +(* UNEXPORTED +End CMonoid_axioms +*) + +(*#* +** Monoid basics +%\begin{convention}% Let [M] be a monoid. +%\end{convention}% +*) + +(* UNEXPORTED +Section CMonoid_basics +*) + +alias id "M" = "cic:/CoRN/algebra/CMonoids/CMonoid_basics/M.var". + +inline "cic:/CoRN/algebra/CMonoids/cm_rht_unit_unfolded.con". + +inline "cic:/CoRN/algebra/CMonoids/cm_lft_unit_unfolded.con". + +(* UNEXPORTED +Hint Resolve cm_rht_unit_unfolded cm_lft_unit_unfolded: algebra. +*) + +inline "cic:/CoRN/algebra/CMonoids/cm_unit_unique_lft.con". + +inline "cic:/CoRN/algebra/CMonoids/cm_unit_unique_rht.con". + +(* Begin_SpecReals *) + +(*#* +The proof component of the monoid is irrelevant. +*) + +inline "cic:/CoRN/algebra/CMonoids/is_CMonoid_proof_irr.con". + +(* End_SpecReals *) + +(*#* +** Submonoids +%\begin{convention}% +Let [P] a predicate on [M] containing [Zero] and closed under [[+]]. +%\end{convention}% +*) + +(* UNEXPORTED +Section SubCMonoids +*) + +alias id "P" = "cic:/CoRN/algebra/CMonoids/CMonoid_basics/SubCMonoids/P.var". + +alias id "Punit" = "cic:/CoRN/algebra/CMonoids/CMonoid_basics/SubCMonoids/Punit.var". + +alias id "op_pres_P" = "cic:/CoRN/algebra/CMonoids/CMonoid_basics/SubCMonoids/op_pres_P.var". + +inline "cic:/CoRN/algebra/CMonoids/CMonoid_basics/SubCMonoids/subcrr.con" "CMonoid_basics__SubCMonoids__". + +inline "cic:/CoRN/algebra/CMonoids/ismon_scrr.con". + +inline "cic:/CoRN/algebra/CMonoids/Build_SubCMonoid.con". + +(* UNEXPORTED +End SubCMonoids +*) + +(* UNEXPORTED +End CMonoid_basics +*) + +(* UNEXPORTED +Hint Resolve cm_rht_unit_unfolded cm_lft_unit_unfolded: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/COrdAbs.ma b/matita/contribs/CoRN-Decl/algebra/COrdAbs.ma new file mode 100644 index 000000000..5f3481689 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/COrdAbs.ma @@ -0,0 +1,160 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/COrdAbs". + +include "CoRN.ma". + +include "algebra/COrdFields2.ma". + +(*#* +** Properties of [AbsSmall] +*) + +(* Begin_SpecReals *) + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall.con". + +(* UNEXPORTED +Implicit Arguments AbsSmall [R]. +*) + +(* End_SpecReals *) + +(* UNEXPORTED +Section AbsSmall_properties +*) + +(*#* +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/COrdAbs/AbsSmall_properties/R.var". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_wdr.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_wdr_unfolded.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_wdl.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_wdl_unfolded.con". + +(* UNEXPORTED +Declare Left Step AbsSmall_wdl_unfolded. +*) + +(* UNEXPORTED +Declare Right Step AbsSmall_wdr_unfolded. +*) + +(* begin hide *) + +(* NOTATION +Notation ZeroR := (Zero:R). +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_leEq_trans.con". + +inline "cic:/CoRN/algebra/COrdAbs/zero_AbsSmall.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_trans.con". + +inline "cic:/CoRN/algebra/COrdAbs/leEq_imp_AbsSmall.con". + +inline "cic:/CoRN/algebra/COrdAbs/inv_resp_AbsSmall.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_minus.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_plus.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_eps_div_two.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_x_plus_delta.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_x_minus_delta.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_x_plus_eps_div2.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_x_minus_eps_div2.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_intermediate.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_eps_div2.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_nonneg.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_mult.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_cancel_mult.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsSmall_approach_zero.con". + +(* UNEXPORTED +End AbsSmall_properties +*) + +(* UNEXPORTED +Declare Left Step AbsSmall_wdl_unfolded. +*) + +(* UNEXPORTED +Declare Right Step AbsSmall_wdr_unfolded. +*) + +(*#* ** Properties of [AbsBig] *) + +inline "cic:/CoRN/algebra/COrdAbs/absBig.con". + +(* NOTATION +Notation AbsBig := (absBig _). +*) + +inline "cic:/CoRN/algebra/COrdAbs/AbsBigSmall_minus.con". + +(* UNEXPORTED +Section absBig_wd_properties +*) + +(*#* +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/COrdAbs/absBig_wd_properties/R.var". + +inline "cic:/CoRN/algebra/COrdAbs/AbsBig_wdr.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsBig_wdl.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsBig_wdr_unfolded.con". + +inline "cic:/CoRN/algebra/COrdAbs/AbsBig_wdl_unfolded.con". + +(* UNEXPORTED +End absBig_wd_properties +*) + +(* UNEXPORTED +Declare Left Step AbsBig_wdl_unfolded. +*) + +(* UNEXPORTED +Declare Right Step AbsBig_wdr_unfolded. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/COrdCauchy.ma b/matita/contribs/CoRN-Decl/algebra/COrdCauchy.ma new file mode 100644 index 000000000..14f20ea02 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/COrdCauchy.ma @@ -0,0 +1,284 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/COrdCauchy". + +include "CoRN.ma". + +include "algebra/COrdAbs.ma". + +(* Begin_SpecReals *) + +(* UNEXPORTED +Section OrdField_Cauchy +*) + +(*#* **Cauchy sequences +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/COrdCauchy/OrdField_Cauchy/R.var". + +(* begin hide *) + +(* UNEXPORTED +Set Implicit Arguments. +*) + +(* UNEXPORTED +Unset Strict Implicit. +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/COrdCauchy/Cauchy_prop.con". + +(* begin hide *) + +(* UNEXPORTED +Set Strict Implicit. +*) + +(* UNEXPORTED +Unset Implicit Arguments. +*) + +(* end hide *) + +(* Def. CauchyP, Build_CauchyP *) + +(* Should be defined in terms of CauchyP *) + +(*#* +Implicit arguments turned off, because Coq makes a mess of it in combination +with the coercions +*) + +inline "cic:/CoRN/algebra/COrdCauchy/CauchySeq.ind". + +coercion cic:/matita/CoRN-Decl/algebra/COrdCauchy/CS_seq.con 0 (* compounds *). + +inline "cic:/CoRN/algebra/COrdCauchy/SeqLimit.con". + +(* End_SpecReals *) + +(*#* +We now prove that the property of being a Cauchy sequence is preserved +through the usual algebraic operations (addition, subtraction and +multiplication -- and division, provided some additional conditions +hold). + +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +inline "cic:/CoRN/algebra/COrdCauchy/CS_seq_bounded.con". + +inline "cic:/CoRN/algebra/COrdCauchy/CS_seq_const.con". + +(*#* +%\begin{convention}% Assume [f] and [g] are Cauchy sequences on [R]. +%\end{convention}% +*) + +alias id "f" = "cic:/CoRN/algebra/COrdCauchy/OrdField_Cauchy/f.var". + +alias id "g" = "cic:/CoRN/algebra/COrdCauchy/OrdField_Cauchy/g.var". + +alias id "Hf" = "cic:/CoRN/algebra/COrdCauchy/OrdField_Cauchy/Hf.var". + +alias id "Hg" = "cic:/CoRN/algebra/COrdCauchy/OrdField_Cauchy/Hg.var". + +inline "cic:/CoRN/algebra/COrdCauchy/CS_seq_plus.con". + +inline "cic:/CoRN/algebra/COrdCauchy/CS_seq_inv.con". + +inline "cic:/CoRN/algebra/COrdCauchy/CS_seq_mult.con". + +(*#* +We now assume that [f] is, from some point onwards, greater than +some positive number. The sequence of reciprocals is defined as +being constantly one up to that point, and the sequence of +reciprocals from then onwards. + +%\begin{convention}% +Let [e] be a postive element of [R] and let [N:nat] be such that from +[N] onwards, [(f n) [#] Zero] +%\end{convention}% +*) + +alias id "e" = "cic:/CoRN/algebra/COrdCauchy/OrdField_Cauchy/e.var". + +alias id "He" = "cic:/CoRN/algebra/COrdCauchy/OrdField_Cauchy/He.var". + +alias id "N" = "cic:/CoRN/algebra/COrdCauchy/OrdField_Cauchy/N.var". + +alias id "f_bnd" = "cic:/CoRN/algebra/COrdCauchy/OrdField_Cauchy/f_bnd.var". + +inline "cic:/CoRN/algebra/COrdCauchy/CS_seq_recip_def.con". + +inline "cic:/CoRN/algebra/COrdCauchy/CS_seq_recip_seq.con". + +inline "cic:/CoRN/algebra/COrdCauchy/CS_seq_recip.con". + +(* UNEXPORTED +End OrdField_Cauchy +*) + +(* UNEXPORTED +Implicit Arguments SeqLimit [R]. +*) + +(*#* +The following lemma does not require the sequence to be Cauchy, but it fits +well here anyway. +*) + +inline "cic:/CoRN/algebra/COrdCauchy/maj_upto_eps.con". + +(* UNEXPORTED +Section Mult_AbsSmall +*) + +alias id "R" = "cic:/CoRN/algebra/COrdCauchy/Mult_AbsSmall/R.var". + +(*#* +** [AbsSmall] revisited +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +inline "cic:/CoRN/algebra/COrdCauchy/mult_AbsSmall'_rht.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mult_AbsSmall_rht.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mult_AbsSmall_lft.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mult_AbsSmall.con". + +(* UNEXPORTED +End Mult_AbsSmall +*) + +(* UNEXPORTED +Section Mult_Continuous +*) + +alias id "R" = "cic:/CoRN/algebra/COrdCauchy/Mult_Continuous/R.var". + +(*#* +** Multiplication is continuous +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +inline "cic:/CoRN/algebra/COrdCauchy/smaller.con". + +inline "cic:/CoRN/algebra/COrdCauchy/estimate_abs.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mult_contin.con". + +(*#* Addition is also continuous. *) + +inline "cic:/CoRN/algebra/COrdCauchy/plus_contin.con". + +(* UNEXPORTED +End Mult_Continuous +*) + +(* UNEXPORTED +Section Monotonous_functions +*) + +(*#* +** Monotonous Functions + +Finally, we study several properties of monotonous functions and +characterize them in some way. + +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/COrdCauchy/Monotonous_functions/R.var". + +(*#* +We begin by characterizing the preservation of less (less or equal) +in terms of preservation of less or equal (less). +*) + +inline "cic:/CoRN/algebra/COrdCauchy/resp_less_char'.con". + +inline "cic:/CoRN/algebra/COrdCauchy/resp_less_char.con". + +inline "cic:/CoRN/algebra/COrdCauchy/resp_leEq_char'.con". + +inline "cic:/CoRN/algebra/COrdCauchy/resp_leEq_char.con". + +(*#* +Next, we see different characterizations of monotonous functions from +some subset of the natural numbers into [R]. Mainly, these +amount (for different types of functions) to proving that a function +is monotonous iff [f(i) [<] f(i+1)] for every [i]. + +Also, strictly monotonous functions are injective. +*) + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon_imp_mon.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon_imp_mon'.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon'_imp_mon'.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mon_imp_mon'.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mon_imp_inj.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon_imp_mon_lt.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon_imp_mon'_lt.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon'_imp_mon'_lt.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon'_imp_mon'2_lt.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mon_imp_mon'_lt.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mon_imp_inj_lt.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon_imp_mon_le.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon_imp_mon'_le.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon'_imp_mon'_le.con". + +inline "cic:/CoRN/algebra/COrdCauchy/local_mon'_imp_mon'2_le.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mon_imp_mon'_le.con". + +inline "cic:/CoRN/algebra/COrdCauchy/mon_imp_inj_le.con". + +(*#* +A similar result for %{\em %partial%}% functions. +*) + +inline "cic:/CoRN/algebra/COrdCauchy/part_mon_imp_mon'.con". + +(* UNEXPORTED +End Monotonous_functions +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/COrdFields.ma b/matita/contribs/CoRN-Decl/algebra/COrdFields.ma new file mode 100644 index 000000000..cb6476676 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/COrdFields.ma @@ -0,0 +1,743 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/COrdFields". + +include "CoRN.ma". + +(* $Id: COrdFields.v,v 1.6 2004/04/23 10:00:52 lcf Exp $ *) + +(*#* printing [<] %\ensuremath<% #<# *) + +(*#* printing [<=] %\ensuremath{\leq}% #≤# *) + +(*#* printing [>] %\ensuremath>% #># *) + +(*#* printing OneNZ %\ensuremath{\mathbf1}% #1# *) + +(*#* printing TwoNZ %\ensuremath{\mathbf2}% #2# *) + +(*#* printing ThreeNZ %\ensuremath{\mathbf3}% #3# *) + +(*#* printing FourNZ %\ensuremath{\mathbf4}% #4# *) + +(*#* printing SixNZ %\ensuremath{\mathbf6}% #6# *) + +(*#* printing EightNZ %\ensuremath{\mathbf8}% #8# *) + +(*#* printing NineNZ %\ensuremath{\mathbf9}% #9# *) + +(*#* printing TwelveNZ %\ensuremath{\mathbf{12}}% #12# *) + +(*#* printing SixteenNZ %\ensuremath{\mathbf{16}}% #16# *) + +(*#* printing EighteenNZ %\ensuremath{\mathbf{18}}% #18# *) + +(*#* printing TwentyFourNZ %\ensuremath{\mathbf{24}}% #24# *) + +(*#* printing FortyEightNZ %\ensuremath{\mathbf{48}}% #48# *) + +include "tactics/FieldReflection.ma". + +(* ORDERED FIELDS *) + +(*#* +* Ordered Fields +** Definition of the notion of ordered field +*) + +(* Begin_SpecReals *) + +inline "cic:/CoRN/algebra/COrdFields/strictorder.ind". + +(* UNEXPORTED +Implicit Arguments strictorder [A]. +*) + +(* UNEXPORTED +Implicit Arguments Build_strictorder [A R]. +*) + +(* UNEXPORTED +Implicit Arguments so_trans [A R]. +*) + +(* UNEXPORTED +Implicit Arguments so_asym [A R]. +*) + +inline "cic:/CoRN/algebra/COrdFields/is_COrdField.ind". + +inline "cic:/CoRN/algebra/COrdFields/COrdField.ind". + +coercion cic:/matita/CoRN-Decl/algebra/COrdFields/cof_crr.con 0 (* compounds *). + +(*#* +%\begin{nameconvention}% +In the names of lemmas, [ [<] ] is written as [less] and "[Zero [<] ]" +is written as [pos]. +%\end{nameconvention}% +*) + +(* UNEXPORTED +Implicit Arguments cof_less [c]. +*) + +(* NOTATION +Infix "[<]" := cof_less (at level 70, no associativity). +*) + +inline "cic:/CoRN/algebra/COrdFields/greater.con". + +(* UNEXPORTED +Implicit Arguments greater [F]. +*) + +(* NOTATION +Infix "[>]" := greater (at level 70, no associativity). +*) + +(* End_SpecReals *) + +(*#* +Less or equal is defined as ``not greater than''. +*) + +inline "cic:/CoRN/algebra/COrdFields/leEq.con". + +(*#* +%\begin{nameconvention}% +In the names of lemmas, [ [<=] ] is written as [leEq] and +[Zero [<=] ] is written as [nonneg]. +%\end{nameconvention}% +*) + +(* UNEXPORTED +Implicit Arguments leEq [F]. +*) + +(* NOTATION +Infix "[<=]" := leEq (at level 70, no associativity). +*) + +(* UNEXPORTED +Section COrdField_axioms +*) + +(*#* +** Ordered field axioms +%\begin{convention}% +Let [F] be a field. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/algebra/COrdFields/COrdField_axioms/F.var". + +inline "cic:/CoRN/algebra/COrdFields/COrdField_is_COrdField.con". + +inline "cic:/CoRN/algebra/COrdFields/less_strorder.con". + +inline "cic:/CoRN/algebra/COrdFields/less_transitive_unfolded.con". + +inline "cic:/CoRN/algebra/COrdFields/less_antisymmetric_unfolded.con". + +inline "cic:/CoRN/algebra/COrdFields/less_irreflexive.con". + +inline "cic:/CoRN/algebra/COrdFields/less_irreflexive_unfolded.con". + +inline "cic:/CoRN/algebra/COrdFields/plus_resp_less_rht.con". + +inline "cic:/CoRN/algebra/COrdFields/mult_resp_pos.con". + +inline "cic:/CoRN/algebra/COrdFields/less_conf_ap.con". + +inline "cic:/CoRN/algebra/COrdFields/less_wdr.con". + +inline "cic:/CoRN/algebra/COrdFields/less_wdl.con". + +(* UNEXPORTED +End COrdField_axioms +*) + +(* UNEXPORTED +Declare Left Step less_wdl. +*) + +(* UNEXPORTED +Declare Right Step less_wdr. +*) + +(* UNEXPORTED +Section OrdField_basics +*) + +(*#* +** Basics +*) + +(*#* +%\begin{convention}% +Let in the rest of this section (and all subsections) +[R] be an ordered field +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/COrdFields/OrdField_basics/R.var". + +inline "cic:/CoRN/algebra/COrdFields/less_imp_ap.con". + +inline "cic:/CoRN/algebra/COrdFields/Greater_imp_ap.con". + +inline "cic:/CoRN/algebra/COrdFields/ap_imp_less.con". + +(*#* +Now properties which can be derived. +*) + +inline "cic:/CoRN/algebra/COrdFields/less_cotransitive.con". + +inline "cic:/CoRN/algebra/COrdFields/less_cotransitive_unfolded.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_ap_zero.con". + +(* Main characterization of less *) + +inline "cic:/CoRN/algebra/COrdFields/leEq_not_eq.con". + +(* UNEXPORTED +End OrdField_basics +*) + +(*#**********************************) + +(* UNEXPORTED +Section Basic_Properties_of_leEq +*) + +(*#**********************************) + +(*#* ** Basic properties of [ [<=] ] +*) + +alias id "R" = "cic:/CoRN/algebra/COrdFields/Basic_Properties_of_leEq/R.var". + +inline "cic:/CoRN/algebra/COrdFields/leEq_wdr.con". + +inline "cic:/CoRN/algebra/COrdFields/leEq_wdl.con". + +inline "cic:/CoRN/algebra/COrdFields/leEq_reflexive.con". + +(* UNEXPORTED +Declare Left Step leEq_wdl. +*) + +(* UNEXPORTED +Declare Right Step leEq_wdr. +*) + +inline "cic:/CoRN/algebra/COrdFields/eq_imp_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields/leEq_imp_eq.con". + +inline "cic:/CoRN/algebra/COrdFields/lt_equiv_imp_eq.con". + +inline "cic:/CoRN/algebra/COrdFields/less_leEq_trans.con". + +inline "cic:/CoRN/algebra/COrdFields/leEq_less_trans.con". + +inline "cic:/CoRN/algebra/COrdFields/leEq_transitive.con". + +inline "cic:/CoRN/algebra/COrdFields/less_leEq.con". + +(* UNEXPORTED +End Basic_Properties_of_leEq +*) + +(* UNEXPORTED +Declare Left Step leEq_wdl. +*) + +(* UNEXPORTED +Declare Right Step leEq_wdr. +*) + +(* UNEXPORTED +Section infinity_of_cordfields +*) + +(*#* +** Infinity of ordered fields + +In an ordered field we have that [One[+]One] and +[One[+]One[+]One] and so on are all apart from zero. +We first show this, so that we can define [TwoNZ], [ThreeNZ] +and so on. These are elements of [NonZeros], so that we can write +e.g.%\% [x[/]TwoNZ]. +*) + +alias id "R" = "cic:/CoRN/algebra/COrdFields/infinity_of_cordfields/R.var". + +inline "cic:/CoRN/algebra/COrdFields/pos_one.con". + +inline "cic:/CoRN/algebra/COrdFields/nring_less_succ.con". + +inline "cic:/CoRN/algebra/COrdFields/nring_less.con". + +inline "cic:/CoRN/algebra/COrdFields/nring_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields/nring_apart.con". + +inline "cic:/CoRN/algebra/COrdFields/nring_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/nring_ap_zero'.con". + +inline "cic:/CoRN/algebra/COrdFields/nring_ap_zero_imp.con". + +inline "cic:/CoRN/algebra/COrdFields/Snring.con". + +include "tactics/Transparent_algebra.ma". + +inline "cic:/CoRN/algebra/COrdFields/pos_Snring.con". + +inline "cic:/CoRN/algebra/COrdFields/nringS_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/nring_fac_ap_zero.con". + +include "tactics/Opaque_algebra.ma". + +(* UNEXPORTED +Section up_to_four +*) + +(*#* +*** Properties of one up to four +%\begin{nameconvention}% +In the names of lemmas, we denote the numbers 0,1,2,3,4 and so on, by +[zero], [one], [two] etc. +%\end{nameconvention}% +*) + +inline "cic:/CoRN/algebra/COrdFields/less_plusOne.con". + +inline "cic:/CoRN/algebra/COrdFields/zero_lt_posplus1.con". + +inline "cic:/CoRN/algebra/COrdFields/plus_one_ext_less.con". + +inline "cic:/CoRN/algebra/COrdFields/one_less_two.con". + +inline "cic:/CoRN/algebra/COrdFields/two_less_three.con". + +inline "cic:/CoRN/algebra/COrdFields/three_less_four.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_two.con". + +inline "cic:/CoRN/algebra/COrdFields/one_less_three.con". + +inline "cic:/CoRN/algebra/COrdFields/two_less_four.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_three.con". + +inline "cic:/CoRN/algebra/COrdFields/one_less_four.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_four.con". + +inline "cic:/CoRN/algebra/COrdFields/two_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/three_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/four_ap_zero.con". + +(* UNEXPORTED +End up_to_four +*) + +(* UNEXPORTED +Section More_than_four +*) + +(*#* *** Properties of some other numbers *) + +inline "cic:/CoRN/algebra/COrdFields/pos_six.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_eight.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_nine.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_twelve.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_sixteen.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_eighteen.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_twentyfour.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_fortyeight.con". + +inline "cic:/CoRN/algebra/COrdFields/six_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/eight_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/nine_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/twelve_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/sixteen_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/eighteen_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/twentyfour_ap_zero.con". + +inline "cic:/CoRN/algebra/COrdFields/fortyeight_ap_zero.con". + +(* UNEXPORTED +End More_than_four +*) + +(* UNEXPORTED +End infinity_of_cordfields +*) + +(* UNEXPORTED +Declare Left Step leEq_wdl. +*) + +(* UNEXPORTED +Declare Right Step leEq_wdr. +*) + +(* NOTATION +Notation " x [/]OneNZ" := (x[/] One[//]ring_non_triv _) (at level 20). +*) + +(* NOTATION +Notation " x [/]TwoNZ" := (x[/] Two[//]two_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]ThreeNZ" := (x[/] Three[//]three_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]FourNZ" := (x[/] Four[//]four_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]SixNZ" := (x[/] Six[//]six_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]EightNZ" := (x[/] Eight[//]eight_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]NineNZ" := (x[/] Nine[//]nine_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]TwelveNZ" := (x[/] Twelve[//]twelve_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]SixteenNZ" := (x[/] Sixteen[//]sixteen_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]EighteenNZ" := (x[/] Eighteen[//]eighteen_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]TwentyFourNZ" := (x[/] TwentyFour[//]twentyfour_ap_zero _) (at level 20). +*) + +(* NOTATION +Notation " x [/]FortyEightNZ" := (x[/] FortyEight[//]fortyeight_ap_zero _) (at level 20). +*) + +(* UNEXPORTED +Section consequences_of_infinity +*) + +(*#* +*** Consequences of infinity +*) + +alias id "F" = "cic:/CoRN/algebra/COrdFields/consequences_of_infinity/F.var". + +inline "cic:/CoRN/algebra/COrdFields/square_eq.con". + +(*#* +Ordered fields have characteristic zero. +*) + +inline "cic:/CoRN/algebra/COrdFields/char0_OrdField.con". + +(* UNEXPORTED +End consequences_of_infinity +*) + +(*#**********************************) + +(* UNEXPORTED +Section Properties_of_Ordering +*) + +(*#**********************************) + +(*#* +** Properties of [[<]] +*) + +alias id "R" = "cic:/CoRN/algebra/COrdFields/Properties_of_Ordering/R.var". + +(*#* +We do not use a special predicate for positivity, +(e.g.%\% [PosP]), but just write [Zero [<] x]. +Reasons: it is more natural; in ordinary mathematics we also write [Zero [<] x] +(or [x [>] Zero]). + +*) + +(* UNEXPORTED +Section addition +*) + +(*#* +*** Addition and subtraction%\label{section:less_plus_minus}% + +*) + +inline "cic:/CoRN/algebra/COrdFields/plus_resp_less_lft.con". + +inline "cic:/CoRN/algebra/COrdFields/inv_resp_less.con". + +(* UNEXPORTED +Transparent cg_minus. +*) + +inline "cic:/CoRN/algebra/COrdFields/minus_resp_less.con". + +(* UNEXPORTED +Transparent cg_minus. +*) + +inline "cic:/CoRN/algebra/COrdFields/minus_resp_less_rht.con". + +inline "cic:/CoRN/algebra/COrdFields/plus_resp_less_both.con". + +(*#* +For versions of [plus_resp_less_both] where one [ [<] ] in the +assumption is replaced by [ [<=] ]%, see +Section~\ref{section:leEq-plus-minus}%. + +Cancellation laws +*) + +inline "cic:/CoRN/algebra/COrdFields/plus_cancel_less.con". + +inline "cic:/CoRN/algebra/COrdFields/inv_cancel_less.con". + +(*#* + +Lemmas where an operation is transformed into the inverse operation on +the other side of an inequality are called laws for shifting. +%\begin{nameconvention}% +The names of laws for shifting start with [shift_], and then come +the operation and the inequality, in the order in which they occur in the +conclusion. +If the shifted operand changes sides w.r.t.%\% the operation and its inverse, +the name gets a prime. +%\end{nameconvention}% + +It would be nicer to write the laws for shifting as bi-implications, +However, it is impractical to use these in +Coq%(see the Coq shortcoming in Section~\ref{section:setoid-basics})%. +*) + +inline "cic:/CoRN/algebra/COrdFields/shift_less_plus.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_less_plus'.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_less_minus.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_less_minus'.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_plus_less.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_plus_less'.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_minus_less.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_minus_less'.con". + +(*#* +Some special cases of laws for shifting. +*) + +inline "cic:/CoRN/algebra/COrdFields/shift_zero_less_minus.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_zero_less_minus'.con". + +inline "cic:/CoRN/algebra/COrdFields/qltone.con". + +(* UNEXPORTED +End addition +*) + +(* UNEXPORTED +Section multiplication +*) + +(*#* +*** Multiplication and division +By Convention%~\ref{convention:div-form}% +in CFields% (Section~\ref{section:fields})%, we often have redundant premises +in lemmas. E.g.%\% the informal statement +``for all [x,y : R] with [Zero [<] x] and [Zero [<] y] +we have [Zero [<] y[/]x]'' +is formalized as follows. +[[ +forall (x y : R) x_, (Zero [<] x) -> (Zero [<] y) -> (Zero [<] y[/]x[//]H) +]] +We do this to keep it easy to use such lemmas. + +*) + +inline "cic:/CoRN/algebra/COrdFields/mult_resp_less.con". + +inline "cic:/CoRN/algebra/COrdFields/recip_resp_pos.con". + +inline "cic:/CoRN/algebra/COrdFields/div_resp_less_rht.con". + +inline "cic:/CoRN/algebra/COrdFields/div_resp_pos.con". + +inline "cic:/CoRN/algebra/COrdFields/mult_resp_less_lft.con". + +inline "cic:/CoRN/algebra/COrdFields/mult_resp_less_both.con". + +inline "cic:/CoRN/algebra/COrdFields/recip_resp_less.con". + +inline "cic:/CoRN/algebra/COrdFields/div_resp_less.con". + +(*#* Cancellation laws +*) + +inline "cic:/CoRN/algebra/COrdFields/mult_cancel_less.con". + +(*#* +Laws for shifting + +%For namegiving, see the Section~\ref{section:less_plus_minus} +on plus and minus.% +*) + +inline "cic:/CoRN/algebra/COrdFields/shift_div_less.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_div_less'.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_less_div.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_less_mult.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_less_mult'.con". + +inline "cic:/CoRN/algebra/COrdFields/shift_mult_less.con". + +(*#* Other properties of multiplication and division +*) + +inline "cic:/CoRN/algebra/COrdFields/minusOne_less.con". + +inline "cic:/CoRN/algebra/COrdFields/swap_div.con". + +inline "cic:/CoRN/algebra/COrdFields/eps_div_less_eps.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_two.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_two'.con". + +(* +Apply mult_cancel_less with (Two::R). +Apply pos_two. +rstepl eps[+]Zero; rstepr eps[+]eps. +Apply plus_resp_less_lft. +Auto. +Qed. +*) + +inline "cic:/CoRN/algebra/COrdFields/pos_div_three.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_three'.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_four.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_four'.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_six.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_eight.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_nine.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_twelve.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_sixteen.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_eighteen.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_twentyfour.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_div_fortyeight.con". + +(* UNEXPORTED +End multiplication +*) + +(* UNEXPORTED +Section misc +*) + +(*#* +*** Miscellaneous properties +*) + +inline "cic:/CoRN/algebra/COrdFields/nring_pos.con". + +inline "cic:/CoRN/algebra/COrdFields/less_nring.con". + +inline "cic:/CoRN/algebra/COrdFields/pos_nring_fac.con". + +inline "cic:/CoRN/algebra/COrdFields/Smallest_less_Average.con". + +inline "cic:/CoRN/algebra/COrdFields/Average_less_Greatest.con". + +inline "cic:/CoRN/algebra/COrdFields/Sum_resp_less.con". + +inline "cic:/CoRN/algebra/COrdFields/Sumx_resp_less.con". + +inline "cic:/CoRN/algebra/COrdFields/positive_Sum_two.con". + +inline "cic:/CoRN/algebra/COrdFields/positive_Sumx.con". + +inline "cic:/CoRN/algebra/COrdFields/negative_Sumx.con". + +(* UNEXPORTED +End misc +*) + +(* UNEXPORTED +End Properties_of_Ordering +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/COrdFields2.ma b/matita/contribs/CoRN-Decl/algebra/COrdFields2.ma new file mode 100644 index 000000000..655f7554d --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/COrdFields2.ma @@ -0,0 +1,372 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/COrdFields2". + +include "CoRN.ma". + +include "algebra/COrdFields.ma". + +(*#* printing one_div_succ %\ensuremath{\frac1{\cdot+1}}% *) + +(*#* printing Half %\ensuremath{\frac12}% #½# *) + +(*#**********************************) + +(* UNEXPORTED +Section Properties_of_leEq +*) + +(*#**********************************) + +(*#* +** Properties of [[<=]] +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/COrdFields2/Properties_of_leEq/R.var". + +(* UNEXPORTED +Section addition +*) + +(*#* +*** Addition and subtraction%\label{section:leEq-plus-minus}% +*) + +inline "cic:/CoRN/algebra/COrdFields2/plus_resp_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/plus_resp_leEq_lft.con". + +inline "cic:/CoRN/algebra/COrdFields2/minus_resp_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/inv_resp_leEq.con". + +(* UNEXPORTED +Transparent cg_minus. +*) + +inline "cic:/CoRN/algebra/COrdFields2/minus_resp_leEq_rht.con". + +inline "cic:/CoRN/algebra/COrdFields2/plus_resp_leEq_both.con". + +inline "cic:/CoRN/algebra/COrdFields2/plus_resp_less_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/plus_resp_leEq_less.con". + +inline "cic:/CoRN/algebra/COrdFields2/minus_resp_less_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/minus_resp_leEq_both.con". + +(*#* Cancellation properties +*) + +inline "cic:/CoRN/algebra/COrdFields2/plus_cancel_leEq_rht.con". + +inline "cic:/CoRN/algebra/COrdFields2/inv_cancel_leEq.con". + +(*#* Laws for shifting +*) + +inline "cic:/CoRN/algebra/COrdFields2/shift_plus_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_leEq_plus.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_plus_leEq'.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_leEq_plus'.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_leEq_rht.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_leEq_lft.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_minus_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_leEq_minus.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_leEq_minus'.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_zero_leEq_minus.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_zero_leEq_minus'.con". + +(* UNEXPORTED +End addition +*) + +(* UNEXPORTED +Section multiplication +*) + +(*#* +*** Multiplication and division + +Multiplication and division respect [[<=]] +*) + +inline "cic:/CoRN/algebra/COrdFields2/mult_resp_leEq_rht.con". + +inline "cic:/CoRN/algebra/COrdFields2/mult_resp_leEq_lft.con". + +inline "cic:/CoRN/algebra/COrdFields2/mult_resp_leEq_both.con". + +inline "cic:/CoRN/algebra/COrdFields2/recip_resp_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/div_resp_leEq.con". + +(* UNEXPORTED +Hint Resolve recip_resp_leEq: algebra. +*) + +(*#* Cancellation properties +*) + +inline "cic:/CoRN/algebra/COrdFields2/mult_cancel_leEq.con". + +(*#* Laws for shifting +*) + +inline "cic:/CoRN/algebra/COrdFields2/shift_mult_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_mult_leEq'.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_leEq_mult'.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_div_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_div_leEq'.con". + +inline "cic:/CoRN/algebra/COrdFields2/shift_leEq_div.con". + +(* UNEXPORTED +Hint Resolve shift_leEq_div: algebra. +*) + +inline "cic:/CoRN/algebra/COrdFields2/eps_div_leEq_eps.con". + +inline "cic:/CoRN/algebra/COrdFields2/nonneg_div_two.con". + +inline "cic:/CoRN/algebra/COrdFields2/nonneg_div_two'.con". + +inline "cic:/CoRN/algebra/COrdFields2/nonneg_div_three.con". + +inline "cic:/CoRN/algebra/COrdFields2/nonneg_div_three'.con". + +inline "cic:/CoRN/algebra/COrdFields2/nonneg_div_four.con". + +inline "cic:/CoRN/algebra/COrdFields2/nonneg_div_four'.con". + +(* UNEXPORTED +End multiplication +*) + +(* UNEXPORTED +Section misc +*) + +(*#* +*** Miscellaneous Properties +*) + +inline "cic:/CoRN/algebra/COrdFields2/sqr_nonneg.con". + +inline "cic:/CoRN/algebra/COrdFields2/nring_nonneg.con". + +inline "cic:/CoRN/algebra/COrdFields2/suc_leEq_dub.con". + +inline "cic:/CoRN/algebra/COrdFields2/leEq_nring.con". + +inline "cic:/CoRN/algebra/COrdFields2/cc_abs_aid.con". + +include "tactics/Transparent_algebra.ma". + +inline "cic:/CoRN/algebra/COrdFields2/nexp_resp_pos.con". + +include "tactics/Opaque_algebra.ma". + +inline "cic:/CoRN/algebra/COrdFields2/mult_resp_nonneg.con". + +include "tactics/Transparent_algebra.ma". + +inline "cic:/CoRN/algebra/COrdFields2/nexp_resp_nonneg.con". + +inline "cic:/CoRN/algebra/COrdFields2/power_resp_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/nexp_resp_less.con". + +inline "cic:/CoRN/algebra/COrdFields2/power_cancel_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/power_cancel_less.con". + +inline "cic:/CoRN/algebra/COrdFields2/nat_less_bin_nexp.con". + +inline "cic:/CoRN/algebra/COrdFields2/Sum_resp_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/Sumx_resp_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/Sum2_resp_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/approach_zero.con". + +inline "cic:/CoRN/algebra/COrdFields2/approach_zero_weak.con". + +(* UNEXPORTED +End misc +*) + +inline "cic:/CoRN/algebra/COrdFields2/equal_less_leEq.con". + +(* UNEXPORTED +End Properties_of_leEq +*) + +(*#**********************************) + +(* UNEXPORTED +Section PosP_properties +*) + +(*#**********************************) + +(*#* +** Properties of positive numbers +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/COrdFields2/PosP_properties/R.var". + +(* begin hide *) + +(* NOTATION +Notation ZeroR := (Zero:R). +*) + +(* NOTATION +Notation OneR := (One:R). +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/COrdFields2/mult_pos_imp.con". + +inline "cic:/CoRN/algebra/COrdFields2/plus_resp_pos_nonneg.con". + +inline "cic:/CoRN/algebra/COrdFields2/plus_resp_nonneg_pos.con". + +inline "cic:/CoRN/algebra/COrdFields2/pos_square.con". + +inline "cic:/CoRN/algebra/COrdFields2/mult_cancel_pos_rht.con". + +inline "cic:/CoRN/algebra/COrdFields2/mult_cancel_pos_lft.con". + +inline "cic:/CoRN/algebra/COrdFields2/pos_wd.con". + +inline "cic:/CoRN/algebra/COrdFields2/even_power_pos.con". + +inline "cic:/CoRN/algebra/COrdFields2/odd_power_cancel_pos.con". + +inline "cic:/CoRN/algebra/COrdFields2/plus_resp_pos.con". + +inline "cic:/CoRN/algebra/COrdFields2/pos_nring_S.con". + +inline "cic:/CoRN/algebra/COrdFields2/square_eq_pos.con". + +inline "cic:/CoRN/algebra/COrdFields2/square_eq_neg.con". + +(* UNEXPORTED +End PosP_properties +*) + +(* UNEXPORTED +Hint Resolve mult_resp_nonneg. +*) + +(*#* +** Properties of one over successor +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +inline "cic:/CoRN/algebra/COrdFields2/one_div_succ.con". + +(* UNEXPORTED +Implicit Arguments one_div_succ [R]. +*) + +(* UNEXPORTED +Section One_div_succ_properties +*) + +alias id "R" = "cic:/CoRN/algebra/COrdFields2/One_div_succ_properties/R.var". + +inline "cic:/CoRN/algebra/COrdFields2/one_div_succ_resp_leEq.con". + +inline "cic:/CoRN/algebra/COrdFields2/one_div_succ_pos.con". + +inline "cic:/CoRN/algebra/COrdFields2/one_div_succ_resp_less.con". + +(* UNEXPORTED +End One_div_succ_properties +*) + +(*#* +** Properties of [Half] +*) + +inline "cic:/CoRN/algebra/COrdFields2/Half.con". + +(* UNEXPORTED +Implicit Arguments Half [R]. +*) + +(* UNEXPORTED +Section Half_properties +*) + +(*#* +%\begin{convention}% +Let [R] be an ordered field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/COrdFields2/Half_properties/R.var". + +inline "cic:/CoRN/algebra/COrdFields2/half_1.con". + +(* UNEXPORTED +Hint Resolve half_1: algebra. +*) + +inline "cic:/CoRN/algebra/COrdFields2/pos_half.con". + +inline "cic:/CoRN/algebra/COrdFields2/half_1'.con". + +inline "cic:/CoRN/algebra/COrdFields2/half_2.con". + +inline "cic:/CoRN/algebra/COrdFields2/half_lt1.con". + +inline "cic:/CoRN/algebra/COrdFields2/half_3.con". + +(* UNEXPORTED +End Half_properties +*) + +(* UNEXPORTED +Hint Resolve half_1 half_1' half_2: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CPoly_ApZero.ma b/matita/contribs/CoRN-Decl/algebra/CPoly_ApZero.ma new file mode 100644 index 000000000..9a72ec02a --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CPoly_ApZero.ma @@ -0,0 +1,194 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CPoly_ApZero". + +include "CoRN.ma". + +(* $Id: CPoly_ApZero.v,v 1.3 2004/04/23 10:00:53 lcf Exp $ *) + +include "algebra/CPoly_Degree.ma". + +include "algebra/COrdFields2.ma". + +(*#* * Polynomials apart from zero *) + +inline "cic:/CoRN/algebra/CPoly_ApZero/distinct1.con". + +(* UNEXPORTED +Implicit Arguments distinct1 [A]. +*) + +(* UNEXPORTED +Section Poly_Representation +*) + +(*#* +** Representation of polynomials +%\begin{convention}% Let [R] be a field, [RX] the ring of polynomials +over [R], [a_ : nat->R] with [(distinct1 a_)] and let [f] be a +polynomial over [R], [n] a natural with [(degree_le n f)], i.e. [f] +has degree at most [n]. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CPoly_ApZero/Poly_Representation/R.var". + +alias id "a_" = "cic:/CoRN/algebra/CPoly_ApZero/Poly_Representation/a_.var". + +alias id "distinct_a_" = "cic:/CoRN/algebra/CPoly_ApZero/Poly_Representation/distinct_a_.var". + +alias id "f" = "cic:/CoRN/algebra/CPoly_ApZero/Poly_Representation/f.var". + +alias id "n" = "cic:/CoRN/algebra/CPoly_ApZero/Poly_Representation/n.var". + +alias id "degree_f" = "cic:/CoRN/algebra/CPoly_ApZero/Poly_Representation/degree_f.var". + +(* begin hide *) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* end hide *) + +include "tactics/Transparent_algebra.ma". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_linear_shifted.con". + +include "tactics/Opaque_algebra.ma". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_linear_factor.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/zero_poly.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/identical_poly.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_factor'.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_factor'_degree.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_factor'_zero.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_factor'_apzero.con". + +(* UNEXPORTED +Hint Resolve poly_01_factor'_zero. +*) + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_factor.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_factor_degree.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_factor_zero.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_factor_one.con". + +(* UNEXPORTED +Hint Resolve poly_01_factor_zero poly_01_factor_one: algebra. +*) + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_degree'.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_degree.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_zero.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_01_one.con". + +(* UNEXPORTED +Hint Resolve poly_01_zero poly_01_one: algebra. +*) + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_representation''.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_representation'.con". + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_representation.con". + +(* UNEXPORTED +Hint Resolve poly_representation: algebra. +*) + +inline "cic:/CoRN/algebra/CPoly_ApZero/Cpoly_choose_apzero.con". + +(* UNEXPORTED +End Poly_Representation +*) + +(* UNEXPORTED +Section Characteristic_zero +*) + +(*#* +If we are in a field of characteristic zero, the previous result can be +strengthened. +*) + +alias id "R" = "cic:/CoRN/algebra/CPoly_ApZero/Characteristic_zero/R.var". + +(* begin show *) + +alias id "H" = "cic:/CoRN/algebra/CPoly_ApZero/Characteristic_zero/H.var". + +(* end show *) + +(* begin hide *) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_apzero.con". + +(*#* +Also, in this situation polynomials are extensional functions. +*) + +inline "cic:/CoRN/algebra/CPoly_ApZero/poly_extensional.con". + +(* UNEXPORTED +End Characteristic_zero +*) + +(*#* +** Polynomials are nonzero on any interval +*) + +(* UNEXPORTED +Section Poly_ApZero_Interval +*) + +alias id "R" = "cic:/CoRN/algebra/CPoly_ApZero/Poly_ApZero_Interval/R.var". + +(* begin hide *) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/CPoly_ApZero/Cpoly_apzero_interval.con". + +(* UNEXPORTED +End Poly_ApZero_Interval +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CPoly_Degree.ma b/matita/contribs/CoRN-Decl/algebra/CPoly_Degree.ma new file mode 100644 index 000000000..79ec88e17 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CPoly_Degree.ma @@ -0,0 +1,246 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CPoly_Degree". + +include "CoRN.ma". + +(* $Id: CPoly_Degree.v,v 1.5 2004/04/23 10:00:53 lcf Exp $ *) + +include "algebra/CPoly_NthCoeff.ma". + +include "algebra/CFields.ma". + +(*#* *Degrees of Polynomials +** Degrees of polynomials over a ring +%\begin{convention}% +Let [R] be a ring and write [RX] for the ring of polynomials +over [R]. +%\end{convention}% +*) + +(* UNEXPORTED +Section Degree_def +*) + +alias id "R" = "cic:/CoRN/algebra/CPoly_Degree/Degree_def/R.var". + +(* begin hide *) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* end hide *) + +(*#* +The length of a polynomial is the number of its coefficients. This is +a syntactical property, as the highest coefficient may be [0]. Note that +the `zero' polynomial [cpoly_zero] has length [0], +a constant polynomial has length [1] and so forth. So the length +is always [1] higher than the `degree' (assuming that the highest +coefficient is [[#]Zero])! +*) + +inline "cic:/CoRN/algebra/CPoly_Degree/lth_of_poly.con". + +(*#* +When dealing with constructive polynomials, notably over the reals or +complex numbers, the degree may be unknown, as we can not decide +whether the highest coefficient is [[#]Zero]. Hence, +degree is a relation between polynomials and natural numbers; if the +degree is unknown for polynomial [p], degree(n,p) doesn't hold for +any [n]. If we don't know the degree of [p], we may still +know it to be below or above a certain number. E.g. for the polynomial +$p_0 +p_1 X +\cdots + p_{n-1} X^{n-1}$#p0 +p1 X + ... + p(n-1) +X^(n-1)#, if $p_i \mathrel{\#}0$#pi apart from 0#, we can say that the +`degree is at least [i]' and if $p_{j+1} = \ldots =p_n =0$#p(j+1) += ... =pn =0# (with [n] the length of the polynomial), we can say +that the `degree is at most [j]'. +*) + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/odd_cpoly.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/even_cpoly.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/regular.con". + +(* UNEXPORTED +End Degree_def +*) + +(* UNEXPORTED +Implicit Arguments degree_le [R]. +*) + +(* UNEXPORTED +Implicit Arguments degree [R]. +*) + +(* UNEXPORTED +Implicit Arguments monic [R]. +*) + +(* UNEXPORTED +Implicit Arguments lth_of_poly [R]. +*) + +(* UNEXPORTED +Section Degree_props +*) + +alias id "R" = "cic:/CoRN/algebra/CPoly_Degree/Degree_props/R.var". + +(* begin hide *) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_wd.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_wd.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_wd.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_imp_degree_le.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_c_.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_c_.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_c_one.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_x_.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_x_.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_x_.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_mon.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_inv.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_plus.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_minus.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/Sum_degree_le.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_inv.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_plus_rht.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_minus_lft.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_plus.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_minus.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_mult.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_mult_aux.con". + +(* UNEXPORTED +Hint Resolve degree_mult_aux: algebra. +*) + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_mult.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_nexp.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_nexp.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/lt_i_lth_of_poly.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/poly_degree_lth.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/Cpoly_ex_degree.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/poly_as_sum''.con". + +(* UNEXPORTED +Hint Resolve poly_as_sum'': algebra. +*) + +inline "cic:/CoRN/algebra/CPoly_Degree/poly_as_sum'.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/poly_as_sum.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_zero.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_1_imp.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_cpoly_linear.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_cpoly_linear.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_one.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/monic_apzero.con". + +(* UNEXPORTED +End Degree_props +*) + +(* UNEXPORTED +Hint Resolve poly_as_sum'' poly_as_sum' poly_as_sum: algebra. +*) + +(* UNEXPORTED +Hint Resolve degree_mult_aux: algebra. +*) + +(* UNEXPORTED +Section degree_props_Field +*) + +(*#* ** Degrees of polynomials over a field +%\begin{convention}% Let [F] be a field and write [FX] for the ring of +polynomials over [F]. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/algebra/CPoly_Degree/degree_props_Field/F.var". + +(* begin hide *) + +(* NOTATION +Notation FX := (cpoly_cring F). +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_mult.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_nexp.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_le_mult_imp.con". + +inline "cic:/CoRN/algebra/CPoly_Degree/degree_mult_imp.con". + +(* UNEXPORTED +End degree_props_Field +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CPoly_NthCoeff.ma b/matita/contribs/CoRN-Decl/algebra/CPoly_NthCoeff.ma new file mode 100644 index 000000000..c72a7aee6 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CPoly_NthCoeff.ma @@ -0,0 +1,212 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CPoly_NthCoeff". + +include "CoRN.ma". + +(* $Id: CPoly_NthCoeff.v,v 1.6 2004/04/23 10:00:53 lcf Exp $ *) + +include "algebra/CPolynomials.ma". + +(*#* +* Polynomials: Nth Coefficient +%\begin{convention}% Let [R] be a ring and write [RX] for the ring of +polynomials over [R]. +%\end{convention}% + +** Definitions +*) + +(* UNEXPORTED +Section NthCoeff_def +*) + +alias id "R" = "cic:/CoRN/algebra/CPoly_NthCoeff/NthCoeff_def/R.var". + +(* begin hide *) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* end hide *) + +(*#* +The [n]-th coefficient of a polynomial. The default value is +[Zero:CR] e.g. if the [n] is higher than the length. For the +polynomial $a_0 +a_1 X +a_2 X^2 + \cdots + a_n X^n$ #a0 +a1 X +a2 X^2 ++ ... + an X^n#, the [Zero]-th coefficient is $a_0$#a0#, the first +is $a_1$#a1# etcetera. *) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_strext.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_wd.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_fun.con". + +(*#* +%\begin{shortcoming}% +We would like to use [nth_coeff_fun n] all the time. +However, Coq's coercion mechanism doesn't support this properly: +the term +[(nth_coeff_fun n p)] won't get parsed, and has to be written as +[((nth_coeff_fun n) p)] instead. + +So, in the names of lemmas, we write [(nth_coeff n p)], +which always (e.g. in proofs) can be converted +to [((nth_coeff_fun n) p)]. +%\end{shortcoming}% +*) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nonConst.con". + +(*#* +The following is probably NOT needed. These functions are +NOT extensional, that is, they are not CSetoid functions. +*) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_ok.con". + +(* The in_coeff predicate*) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/in_coeff.con". + +(*#* +The [cpoly_zero] case should be [c [=] Zero] in order to be extensional. +*) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_S.con". + +(* UNEXPORTED +End NthCoeff_def +*) + +(* UNEXPORTED +Implicit Arguments nth_coeff [R]. +*) + +(* UNEXPORTED +Implicit Arguments nth_coeff_fun [R]. +*) + +(* UNEXPORTED +Hint Resolve nth_coeff_wd: algebra_c. +*) + +(* UNEXPORTED +Section NthCoeff_props +*) + +(*#* ** Properties of [nth_coeff] *) + +alias id "R" = "cic:/CoRN/algebra/CPoly_NthCoeff/NthCoeff_props/R.var". + +(* begin hide *) + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_zero.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/coeff_O_lin.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/coeff_Sm_lin.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/coeff_O_c_.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/coeff_O_x_mult.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/coeff_Sm_x_mult.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/coeff_Sm_mult_x_.con". + +(* UNEXPORTED +Hint Resolve nth_coeff_zero coeff_O_lin coeff_Sm_lin coeff_O_c_ + coeff_O_x_mult coeff_Sm_x_mult coeff_Sm_mult_x_: algebra. +*) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_ap_zero_imp.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_plus.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_inv.con". + +(* UNEXPORTED +Hint Resolve nth_coeff_inv: algebra. +*) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_c_mult_p.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_p_mult_c_.con". + +(* UNEXPORTED +Hint Resolve nth_coeff_c_mult_p nth_coeff_p_mult_c_ nth_coeff_plus: algebra. +*) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_complicated.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/all_nth_coeff_eq_imp.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/poly_at_zero.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_inv'.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_minus.con". + +(* UNEXPORTED +Hint Resolve nth_coeff_minus: algebra. +*) + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_sum0.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_sum.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_nexp_eq.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_nexp_neq.con". + +inline "cic:/CoRN/algebra/CPoly_NthCoeff/nth_coeff_mult.con". + +(* UNEXPORTED +End NthCoeff_props +*) + +(* UNEXPORTED +Hint Resolve nth_coeff_wd: algebra_c. +*) + +(* UNEXPORTED +Hint Resolve nth_coeff_complicated poly_at_zero nth_coeff_inv: algebra. +*) + +(* UNEXPORTED +Hint Resolve nth_coeff_inv' nth_coeff_c_mult_p nth_coeff_mult: algebra. +*) + +(* UNEXPORTED +Hint Resolve nth_coeff_zero nth_coeff_plus nth_coeff_minus: algebra. +*) + +(* UNEXPORTED +Hint Resolve nth_coeff_nexp_eq nth_coeff_nexp_neq: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CPolynomials.ma b/matita/contribs/CoRN-Decl/algebra/CPolynomials.ma new file mode 100644 index 000000000..bd621debb --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CPolynomials.ma @@ -0,0 +1,643 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CPolynomials". + +include "CoRN.ma". + +(* $Id: CPolynomials.v,v 1.9 2004/04/23 10:00:53 lcf Exp $ *) + +(*#* printing _X_ %\ensuremath{x}% *) + +(*#* printing _C_ %\ensuremath\diamond% *) + +(*#* printing [+X*] %\ensuremath{+x\times}% #+x×# *) + +(*#* printing RX %\ensuremath{R[x]}% #R[x]# *) + +(*#* printing FX %\ensuremath{F[x]}% #F[x]# *) + +include "tactics/RingReflection.ma". + +(*#* * Polynomials +The first section only proves the polynomials form a ring, and nothing more +interesting. +Section%~\ref{section:poly-equality}% gives some basic properties of +equality and induction of polynomials. +** Definition of polynomials; they form a ring +%\label{section:poly-ring}% +*) + +(* UNEXPORTED +Section CPoly_CRing +*) + +(*#* +%\begin{convention}% Let [CR] be a ring. +%\end{convention}% +*) + +alias id "CR" = "cic:/CoRN/algebra/CPolynomials/CPoly_CRing/CR.var". + +(*#* +The intuition behind the type [cpoly] is the following +- [(cpoly CR)] is $CR[X]$ #CR[X]#; +- [cpoly_zero] is the `empty' polynomial with no coefficients; +- [(cpoly_linear c p)] is [c[+]X[*]p] + +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly.ind". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_constant.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_one.con". + +(*#* +Some useful induction lemmas for doubly quantified propositions. +*) + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_double_ind0.con". + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_double_sym_ind0.con". + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_double_ind0'.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_double_ind0.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_double_sym_ind0.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_double_ind0'.con". + +(*#* *** The polynomials form a setoid +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_eq_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_eq.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_eq_p_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_ap_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_ap.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_ap_p_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/irreflexive_cpoly_ap.con". + +inline "cic:/CoRN/algebra/CPolynomials/symmetric_cpoly_ap.con". + +inline "cic:/CoRN/algebra/CPolynomials/cotransitive_cpoly_ap.con". + +inline "cic:/CoRN/algebra/CPolynomials/tight_apart_cpoly_ap.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_is_CSetoid.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_csetoid.con". + +(*#* +Now that we know that the polynomials form a setoid, we can use the +notation with [ [#] ] and [ [=] ]. In order to use this notation, +we introduce [cpoly_zero_cs] and [cpoly_linear_cs], so that Coq +recognizes we are talking about a setoid. +We formulate the induction properties and +the most basic properties of equality and apartness +in terms of these generators. +*) + +inline "cic:/CoRN/algebra/CPolynomials/CPoly_CRing/cpoly_zero_cs.con" "CPoly_CRing__". + +inline "cic:/CoRN/algebra/CPolynomials/CPoly_CRing/cpoly_linear_cs.con" "CPoly_CRing__". + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_ind_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_double_ind0_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_double_sym_ind0_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_ind_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_double_ind0_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_double_sym_ind0_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin_eq_zero_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_cpoly_lin_eq_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_zero_eq_lin_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_cpoly_zero_eq_lin.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin_eq_lin_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_cpoly_lin_eq_lin.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin_ap_zero_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_cpoly_lin_ap_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin_ap_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_zero_ap_lin_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_cpoly_zero_ap_lin.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_zero_ap_lin.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin_ap_lin_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_cpoly_lin_ap_lin.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin_ap_lin.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_linear_strext.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_linear_wd.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_linear_fun.con". + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_double_comp_ind.con". + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_triple_comp_ind.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_double_comp_ind.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_triple_comp_ind.con". + +(*#* +*** The polynomials form a semi-group and a monoid +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_plus.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_plus_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_zero_plus.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_plus_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin_plus_lin.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_plus_commutative.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_plus_q_ap_q.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_p_plus_ap_p.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_ap_zero_plus.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_plus_op_strext.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_plus_op_wd.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_plus_op.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_plus_associative.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_csemi_grp.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_cm_proof.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_cmonoid.con". + +(*#* *** The polynomials form a group +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_inv.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_inv_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_inv_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_inv_lin.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_inv_op_strext.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_inv_op_wd.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_inv_op.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_cg_proof.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_cgroup.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_cag_proof.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_cabgroup.con". + +(*#* *** The polynomials form a ring +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cr.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cr_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_zero_mult_cr.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin_mult_cr.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cr_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cr_strext.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cr_wd.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cs.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_zero_mult.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin_mult.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_op_strext.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_op_wd.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_op.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cr_dist.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_cr_dist.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cr_assoc_mult_cr.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cr_assoc_mult.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_lin.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_commutative.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_dist_rht.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_assoc.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_cr_one.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_one_mult.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_one.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_mult_monoid.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_cr_non_triv.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_is_CRing.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_cring.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_constant_strext.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_constant_wd.con". + +inline "cic:/CoRN/algebra/CPolynomials/_C_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_X_.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_x_minus_c.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_x_minus_c_strext.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_x_minus_c_wd.con". + +(* UNEXPORTED +End CPoly_CRing +*) + +(* UNEXPORTED +Implicit Arguments _C_ [CR]. +*) + +(* UNEXPORTED +Implicit Arguments _X_ [CR]. +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_linear_fun'.con". + +(* UNEXPORTED +Implicit Arguments cpoly_linear_fun' [CR]. +*) + +(* NOTATION +Infix "[+X*]" := cpoly_linear_fun' (at level 50, left associativity). +*) + +(*#* ** Apartness, equality, and induction +%\label{section:poly-equality}% +*) + +(* UNEXPORTED +Section CPoly_CRing_ctd +*) + +(*#* +%\begin{convention}% +Let [CR] be a ring, [p] and [q] polynomials over that ring, and [c] and [d] +elements of the ring. +%\end{convention}% +*) + +alias id "CR" = "cic:/CoRN/algebra/CPolynomials/CPoly_CRing_ctd/CR.var". + +(* NOTATION +Notation RX := (cpoly_cring CR). +*) + +(* UNEXPORTED +Section helpful_section +*) + +alias id "p" = "cic:/CoRN/algebra/CPolynomials/CPoly_CRing_ctd/helpful_section/p.var". + +alias id "q" = "cic:/CoRN/algebra/CPolynomials/CPoly_CRing_ctd/helpful_section/q.var". + +alias id "c" = "cic:/CoRN/algebra/CPolynomials/CPoly_CRing_ctd/helpful_section/c.var". + +alias id "d" = "cic:/CoRN/algebra/CPolynomials/CPoly_CRing_ctd/helpful_section/d.var". + +inline "cic:/CoRN/algebra/CPolynomials/linear_eq_zero_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_linear_eq_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/zero_eq_linear_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_zero_eq_linear.con". + +inline "cic:/CoRN/algebra/CPolynomials/linear_eq_linear_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_linear_eq_linear.con". + +inline "cic:/CoRN/algebra/CPolynomials/linear_ap_zero_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_linear_ap_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/linear_ap_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/zero_ap_linear_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_zero_ap_linear.con". + +inline "cic:/CoRN/algebra/CPolynomials/zero_ap_linear.con". + +inline "cic:/CoRN/algebra/CPolynomials/linear_ap_linear_.con". + +inline "cic:/CoRN/algebra/CPolynomials/_linear_ap_linear.con". + +inline "cic:/CoRN/algebra/CPolynomials/linear_ap_linear.con". + +(* UNEXPORTED +End helpful_section +*) + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_induc.con". + +inline "cic:/CoRN/algebra/CPolynomials/Ccpoly_double_sym_ind.con". + +inline "cic:/CoRN/algebra/CPolynomials/Cpoly_double_comp_ind.con". + +inline "cic:/CoRN/algebra/CPolynomials/Cpoly_triple_comp_ind.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_induc.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_double_sym_ind.con". + +inline "cic:/CoRN/algebra/CPolynomials/poly_double_comp_ind.con". + +inline "cic:/CoRN/algebra/CPolynomials/poly_triple_comp_ind.con". + +(* UNEXPORTED +Transparent cpoly_cring. +*) + +(* UNEXPORTED +Transparent cpoly_cgroup. +*) + +(* UNEXPORTED +Transparent cpoly_csetoid. +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_apply.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_apply_strext.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_apply_wd.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_apply_fun.con". + +(* UNEXPORTED +End CPoly_CRing_ctd +*) + +(*#* +%\begin{convention}% +[cpoly_apply_fun] is denoted infix by [!] +The first argument is left implicit, so the application of +polynomial [f] (seen as a function) to argument [x] can be written as [f!x]. +In the names of lemmas, we write [apply]. +%\end{convention}% +*) + +(* UNEXPORTED +Implicit Arguments cpoly_apply_fun [CR]. +*) + +(* NOTATION +Infix "!" := cpoly_apply_fun (at level 1, no associativity). +*) + +(*#* +** Basic properties of polynomials +%\begin{convention}% +Let [R] be a ring and write [RX] for the ring of polynomials over [R]. +%\end{convention}% +*) + +(* UNEXPORTED +Section Poly_properties +*) + +alias id "R" = "cic:/CoRN/algebra/CPolynomials/Poly_properties/R.var". + +(* NOTATION +Notation RX := (cpoly_cring R). +*) + +(*#* +*** Constant and identity +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_X_.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_C_.con". + +(* UNEXPORTED +Hint Resolve cpoly_X_ cpoly_C_: algebra. +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_const_eq.con". + +inline "cic:/CoRN/algebra/CPolynomials/_c_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/_c_one.con". + +inline "cic:/CoRN/algebra/CPolynomials/_c_mult.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_lin.con". + +(* UNEXPORTED +Hint Resolve cpoly_lin: algebra. +*) + +(* SUPERFLUOUS *) + +inline "cic:/CoRN/algebra/CPolynomials/poly_linear.con". + +(* UNEXPORTED +Hint Resolve _c_zero: algebra. +*) + +inline "cic:/CoRN/algebra/CPolynomials/poly_c_apzero.con". + +inline "cic:/CoRN/algebra/CPolynomials/_c_mult_lin.con". + +(* SUPERFLUOUS ? *) + +inline "cic:/CoRN/algebra/CPolynomials/lin_mult.con". + +(* UNEXPORTED +Hint Resolve lin_mult: algebra. +*) + +(*#* *** Application of polynomials +*) + +inline "cic:/CoRN/algebra/CPolynomials/poly_eq_zero.con". + +inline "cic:/CoRN/algebra/CPolynomials/apply_wd.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpolyap_pres_eq.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpolyap_strext.con". + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_csetoid_op.con". + +inline "cic:/CoRN/algebra/CPolynomials/_c_apply.con". + +inline "cic:/CoRN/algebra/CPolynomials/_x_apply.con". + +inline "cic:/CoRN/algebra/CPolynomials/plus_apply.con". + +inline "cic:/CoRN/algebra/CPolynomials/inv_apply.con". + +(* UNEXPORTED +Hint Resolve plus_apply inv_apply: algebra. +*) + +inline "cic:/CoRN/algebra/CPolynomials/minus_apply.con". + +inline "cic:/CoRN/algebra/CPolynomials/_c_mult_apply.con". + +(* UNEXPORTED +Hint Resolve _c_mult_apply: algebra. +*) + +inline "cic:/CoRN/algebra/CPolynomials/mult_apply.con". + +(* UNEXPORTED +Hint Resolve mult_apply: algebra. +*) + +inline "cic:/CoRN/algebra/CPolynomials/one_apply.con". + +(* UNEXPORTED +Hint Resolve one_apply: algebra. +*) + +inline "cic:/CoRN/algebra/CPolynomials/nexp_apply.con". + +(* SUPERFLUOUS *) + +inline "cic:/CoRN/algebra/CPolynomials/poly_inv_apply.con". + +inline "cic:/CoRN/algebra/CPolynomials/Sum0_cpoly_ap.con". + +inline "cic:/CoRN/algebra/CPolynomials/Sum_cpoly_ap.con". + +(* UNEXPORTED +End Poly_properties +*) + +(*#* ** Induction properties of polynomials for [Prop] +*) + +(* UNEXPORTED +Section Poly_Prop_Induction +*) + +alias id "CR" = "cic:/CoRN/algebra/CPolynomials/Poly_Prop_Induction/CR.var". + +(* NOTATION +Notation Cpoly := (cpoly CR). +*) + +(* NOTATION +Notation Cpoly_zero := (cpoly_zero CR). +*) + +(* NOTATION +Notation Cpoly_linear := (cpoly_linear CR). +*) + +(* NOTATION +Notation Cpoly_cring := (cpoly_cring CR). +*) + +inline "cic:/CoRN/algebra/CPolynomials/cpoly_double_ind.con". + +(* UNEXPORTED +End Poly_Prop_Induction +*) + +(* UNEXPORTED +Hint Resolve poly_linear cpoly_lin: algebra. +*) + +(* UNEXPORTED +Hint Resolve apply_wd cpoly_const_eq: algebra_c. +*) + +(* UNEXPORTED +Hint Resolve _c_apply _x_apply inv_apply plus_apply minus_apply mult_apply + nexp_apply: algebra. +*) + +(* UNEXPORTED +Hint Resolve one_apply _c_zero _c_one _c_mult: algebra. +*) + +(* UNEXPORTED +Hint Resolve poly_inv_apply: algebra. +*) + +(* UNEXPORTED +Hint Resolve _c_mult_lin: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CRings.ma b/matita/contribs/CoRN-Decl/algebra/CRings.ma new file mode 100644 index 000000000..2aa33c7d2 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CRings.ma @@ -0,0 +1,1013 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CRings". + +include "CoRN.ma". + +(* $Id: CRings.v,v 1.8 2004/04/23 10:00:53 lcf Exp $ *) + +(*#* printing [*] %\ensuremath\times% #×# *) + +(*#* printing [^] %\ensuremath{\hat{\ }}% #^# *) + +(*#* printing {*} %\ensuremath\times% #×# *) + +(*#* printing {**} %\ensuremath\ast% #∗# *) + +(*#* printing {^} %\ensuremath{\hat{\ }}% #^# *) + +(*#* printing One %\ensuremath{\mathbf1}% #1# *) + +(*#* printing Two %\ensuremath{\mathbf2}% #2# *) + +(*#* printing Three %\ensuremath{\mathbf3}% #3# *) + +(*#* printing Four %\ensuremath{\mathbf4}% #4# *) + +(*#* printing Six %\ensuremath{\mathbf6}% #6# *) + +(*#* printing Eight %\ensuremath{\mathbf8}% #8# *) + +(*#* printing Nine %\ensuremath{\mathbf9}% #9# *) + +(*#* printing Twelve %\ensuremath{\mathbf{12}}% #12# *) + +(*#* printing Sixteen %\ensuremath{\mathbf{16}}% #16# *) + +(*#* printing Eighteen %\ensuremath{\mathbf{18}}% #18# *) + +(*#* printing TwentyFour %\ensuremath{\mathbf{24}}% #24# *) + +(*#* printing FortyEight %\ensuremath{\mathbf{48}}% #48# *) + +include "algebra/CSums.ma". + +(* UNEXPORTED +Transparent sym_eq. +*) + +(* UNEXPORTED +Transparent f_equal. +*) + +(* Begin_SpecReals *) + +(* Constructive RINGS *) + +(*#* * Rings +We actually define commutative rings with identity. +** Definition of the notion of Ring +*) + +inline "cic:/CoRN/algebra/CRings/distributive.con". + +(* UNEXPORTED +Implicit Arguments distributive [S]. +*) + +inline "cic:/CoRN/algebra/CRings/is_CRing.ind". + +inline "cic:/CoRN/algebra/CRings/CRing.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CRings/cr_crr.con 0 (* compounds *). + +inline "cic:/CoRN/algebra/CRings/cr_plus.con". + +inline "cic:/CoRN/algebra/CRings/cr_inv.con". + +inline "cic:/CoRN/algebra/CRings/cr_minus.con". + +(* NOTATION +Notation One := (cr_one _). +*) + +(* End_SpecReals *) + +(* Begin_SpecReals *) + +(*#* +%\begin{nameconvention}% +In the names of lemmas, we will denote [One] with [one], +and [[*]] with [mult]. +%\end{nameconvention}% +*) + +(* UNEXPORTED +Implicit Arguments cr_mult [c]. +*) + +(* NOTATION +Infix "[*]" := cr_mult (at level 40, left associativity). +*) + +(* UNEXPORTED +Section CRing_axioms +*) + +(*#* +** Ring axioms +%\begin{convention}% Let [R] be a ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/CRing_axioms/R.var". + +inline "cic:/CoRN/algebra/CRings/CRing_is_CRing.con". + +inline "cic:/CoRN/algebra/CRings/mult_assoc.con". + +inline "cic:/CoRN/algebra/CRings/mult_commutes.con". + +inline "cic:/CoRN/algebra/CRings/mult_mon.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CRings/dist.con". + +inline "cic:/CoRN/algebra/CRings/ring_non_triv.con". + +inline "cic:/CoRN/algebra/CRings/mult_wd.con". + +inline "cic:/CoRN/algebra/CRings/mult_wdl.con". + +inline "cic:/CoRN/algebra/CRings/mult_wdr.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End CRing_axioms +*) + +(* UNEXPORTED +Section Ring_constructions +*) + +(*#* +** Ring constructions +%\begin{convention}% +Let [R] be a ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/Ring_constructions/R.var". + +(*#* +The multiplicative monoid of a ring is defined as follows. +*) + +inline "cic:/CoRN/algebra/CRings/Build_multCMonoid.con". + +(* UNEXPORTED +End Ring_constructions +*) + +(* End_SpecReals *) + +(* UNEXPORTED +Section Ring_unfolded +*) + +(*#* +** Ring unfolded +%\begin{convention}% Let [R] be a ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/Ring_unfolded/R.var". + +(* begin hide *) + +inline "cic:/CoRN/algebra/CRings/Ring_unfolded/mmR.con" "Ring_unfolded__". + +(* end hide *) + +inline "cic:/CoRN/algebra/CRings/mult_assoc_unfolded.con". + +inline "cic:/CoRN/algebra/CRings/mult_commut_unfolded.con". + +(* UNEXPORTED +Hint Resolve mult_commut_unfolded: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/mult_one.con". + +inline "cic:/CoRN/algebra/CRings/one_mult.con". + +inline "cic:/CoRN/algebra/CRings/ring_dist_unfolded.con". + +(* UNEXPORTED +Hint Resolve ring_dist_unfolded: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/ring_distl_unfolded.con". + +(* UNEXPORTED +End Ring_unfolded +*) + +(* UNEXPORTED +Hint Resolve mult_assoc_unfolded: algebra. +*) + +(* UNEXPORTED +Hint Resolve ring_non_triv mult_one one_mult mult_commut_unfolded: algebra. +*) + +(* UNEXPORTED +Hint Resolve ring_dist_unfolded ring_distl_unfolded: algebra. +*) + +(* UNEXPORTED +Section Ring_basics +*) + +(*#* +** Ring basics +%\begin{convention}% Let [R] be a ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/Ring_basics/R.var". + +inline "cic:/CoRN/algebra/CRings/one_ap_zero.con". + +inline "cic:/CoRN/algebra/CRings/is_zero_rht.con". + +inline "cic:/CoRN/algebra/CRings/is_zero_lft.con". + +(* UNEXPORTED +Implicit Arguments is_zero_rht [S]. +*) + +(* UNEXPORTED +Implicit Arguments is_zero_lft [S]. +*) + +inline "cic:/CoRN/algebra/CRings/cring_mult_zero.con". + +(* UNEXPORTED +Hint Resolve cring_mult_zero: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/x_mult_zero.con". + +inline "cic:/CoRN/algebra/CRings/cring_mult_zero_op.con". + +(* UNEXPORTED +Hint Resolve cring_mult_zero_op: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/cring_inv_mult_lft.con". + +(* UNEXPORTED +Hint Resolve cring_inv_mult_lft: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/cring_inv_mult_rht.con". + +(* UNEXPORTED +Hint Resolve cring_inv_mult_rht: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/cring_mult_ap_zero.con". + +inline "cic:/CoRN/algebra/CRings/cring_mult_ap_zero_op.con". + +inline "cic:/CoRN/algebra/CRings/inv_mult_invol.con". + +inline "cic:/CoRN/algebra/CRings/ring_dist_minus.con". + +(* UNEXPORTED +Hint Resolve ring_dist_minus: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/ring_distl_minus.con". + +(* UNEXPORTED +Hint Resolve ring_distl_minus: algebra. +*) + +(* UNEXPORTED +End Ring_basics +*) + +(* UNEXPORTED +Hint Resolve cring_mult_zero cring_mult_zero_op: algebra. +*) + +(* UNEXPORTED +Hint Resolve inv_mult_invol: algebra. +*) + +(* UNEXPORTED +Hint Resolve cring_inv_mult_lft cring_inv_mult_rht: algebra. +*) + +(* UNEXPORTED +Hint Resolve ring_dist_minus: algebra. +*) + +(* UNEXPORTED +Hint Resolve ring_distl_minus: algebra. +*) + +(* Begin_SpecReals *) + +(*#* +** Ring Definitions +Some auxiliary functions and operations over a ring; +especially geared towards CReals. +*) + +(* UNEXPORTED +Section exponentiation +*) + +(*#* +*** Exponentiation +%\begin{convention}% +Let [R] be a ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/exponentiation/R.var". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CRings/nexp.con". + +inline "cic:/CoRN/algebra/CRings/nexp_well_def.con". + +inline "cic:/CoRN/algebra/CRings/nexp_strong_ext.con". + +inline "cic:/CoRN/algebra/CRings/nexp_op.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End exponentiation +*) + +(* End_SpecReals *) + +(* NOTATION +Notation "x [^] n" := (nexp_op _ n x) (at level 20). +*) + +(* UNEXPORTED +Implicit Arguments nexp_op [R]. +*) + +(* Begin_SpecReals *) + +(* UNEXPORTED +Section nat_injection +*) + +(*#* +*** The injection of natural numbers into a ring +%\begin{convention}% Let [R] be a ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/nat_injection/R.var". + +(*#* +The injection of Coq natural numbers into a ring is called [nring]. +Note that this need not really be an injection; when it is, the ring is said +to have characteristic [0]. +*) + +inline "cic:/CoRN/algebra/CRings/nring.con". + +inline "cic:/CoRN/algebra/CRings/Char0.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CRings/nring_comm_plus.con". + +inline "cic:/CoRN/algebra/CRings/nring_comm_mult.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End nat_injection +*) + +(* End_SpecReals *) + +(* UNEXPORTED +Hint Resolve nring_comm_plus nring_comm_mult: algebra. +*) + +(* Begin_SpecReals *) + +(* UNEXPORTED +Implicit Arguments nring [R]. +*) + +(* End_SpecReals *) + +(* NOTATION +Notation Two := (nring 2). +*) + +(* NOTATION +Notation Three := (nring 3). +*) + +(* NOTATION +Notation Four := (nring 4). +*) + +(* NOTATION +Notation Six := (nring 6). +*) + +(* NOTATION +Notation Eight := (nring 8). +*) + +(* NOTATION +Notation Twelve := (nring 12). +*) + +(* NOTATION +Notation Sixteen := (nring 16). +*) + +(* NOTATION +Notation Nine := (nring 9). +*) + +(* NOTATION +Notation Eighteen := (nring 18). +*) + +(* NOTATION +Notation TwentyFour := (nring 24). +*) + +(* NOTATION +Notation FortyEight := (nring 48). +*) + +inline "cic:/CoRN/algebra/CRings/one_plus_one.con". + +inline "cic:/CoRN/algebra/CRings/x_plus_x.con". + +(* UNEXPORTED +Hint Resolve one_plus_one x_plus_x: algebra. +*) + +(*#* +In a ring of characteristic zero, [nring] is really an injection. +*) + +inline "cic:/CoRN/algebra/CRings/nring_different.con". + +(* UNEXPORTED +Section int_injection +*) + +(*#* +*** The injection of integers into a ring +%\begin{convention}% +Let [R] be a ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/int_injection/R.var". + +(*#* +The injection of Coq integers into a ring is called [zring]. Again, +this need not really be an injection. + +The first definition is now obsolete, having been replaced by a more efficient +one. It is kept to avoid having to redo all the proofs. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old.con". + +inline "cic:/CoRN/algebra/CRings/zring_old_zero.con". + +(* UNEXPORTED +Hint Resolve zring_old_zero: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old_diff.con". + +(* UNEXPORTED +Hint Resolve zring_old_diff. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old_plus_nat.con". + +(* UNEXPORTED +Hint Resolve zring_old_plus_nat: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old_inv_nat.con". + +(* UNEXPORTED +Hint Resolve zring_old_inv_nat: algebra. +*) + +(* UNEXPORTED +Hint Resolve zring_old_diff: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old_plus.con". + +(* UNEXPORTED +Hint Resolve zring_old_plus: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old_inv.con". + +(* UNEXPORTED +Hint Resolve zring_old_inv: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old_minus.con". + +(* UNEXPORTED +Hint Resolve zring_old_minus: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old_mult.con". + +(* UNEXPORTED +Hint Resolve zring_old_mult: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old_one.con". + +(* UNEXPORTED +Hint Resolve zring_old_one: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_old_inv_one.con". + +(*#************** new def of zring. ***********************) + +(*#* The [zring] function can be defined directly. This is done here. +*) + +inline "cic:/CoRN/algebra/CRings/pring_aux.con". + +inline "cic:/CoRN/algebra/CRings/pring.con". + +inline "cic:/CoRN/algebra/CRings/zring.con". + +inline "cic:/CoRN/algebra/CRings/pring_aux_lemma.con". + +inline "cic:/CoRN/algebra/CRings/double_nring.con". + +(* UNEXPORTED +Hint Resolve pring_aux_lemma double_nring: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/pring_aux_nring.con". + +(* UNEXPORTED +Hint Resolve pring_aux_nring: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/pring_convert.con". + +(* UNEXPORTED +Hint Resolve pring_convert: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_zring_old.con". + +(* UNEXPORTED +Hint Resolve zring_zring_old: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zring_zero.con". + +inline "cic:/CoRN/algebra/CRings/zring_diff.con". + +inline "cic:/CoRN/algebra/CRings/zring_plus_nat.con". + +inline "cic:/CoRN/algebra/CRings/zring_inv_nat.con". + +inline "cic:/CoRN/algebra/CRings/zring_plus.con". + +inline "cic:/CoRN/algebra/CRings/zring_inv.con". + +inline "cic:/CoRN/algebra/CRings/zring_minus.con". + +inline "cic:/CoRN/algebra/CRings/zring_mult.con". + +inline "cic:/CoRN/algebra/CRings/zring_one.con". + +inline "cic:/CoRN/algebra/CRings/zring_inv_one.con". + +(* UNEXPORTED +End int_injection +*) + +(* UNEXPORTED +Implicit Arguments zring [R]. +*) + +(* UNEXPORTED +Hint Resolve pring_convert zring_zero zring_diff zring_plus_nat zring_inv_nat + zring_plus zring_inv zring_minus zring_mult zring_one zring_inv_one: + algebra. +*) + +(* UNEXPORTED +Section Ring_sums +*) + +(*#* +** Ring sums +%\begin{convention}% Let [R] be a ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/Ring_sums/R.var". + +(*#* +*** Infinite Ring sums +*) + +(* UNEXPORTED +Section infinite_ring_sums +*) + +inline "cic:/CoRN/algebra/CRings/Sum_upto.con". + +inline "cic:/CoRN/algebra/CRings/sum_upto_O.con". + +inline "cic:/CoRN/algebra/CRings/Sum_from_upto.con". + +(*#* +Here's an alternative def of [Sum_from_upto], with a lemma that +it's equivalent to the original. +*) + +inline "cic:/CoRN/algebra/CRings/seq_from.con". + +inline "cic:/CoRN/algebra/CRings/Sum_from_upto_alt.con". + +(* UNEXPORTED +End infinite_ring_sums +*) + +(* UNEXPORTED +Section ring_sums_over_lists +*) + +(*#* *** Ring Sums over Lists +*) + +inline "cic:/CoRN/algebra/CRings/RList_Mem.con". + +inline "cic:/CoRN/algebra/CRings/List_Sum_upto.con". + +inline "cic:/CoRN/algebra/CRings/list_sum_upto_O.con". + +inline "cic:/CoRN/algebra/CRings/List_Sum_from_upto.con". + +(* UNEXPORTED +End ring_sums_over_lists +*) + +(* UNEXPORTED +End Ring_sums +*) + +(*#* +** Distribution properties +%\begin{convention}% +Let [R] be a ring. +%\end{convention}% +*) + +(* UNEXPORTED +Section Dist_properties +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/Dist_properties/R.var". + +inline "cic:/CoRN/algebra/CRings/dist_1b.con". + +(* UNEXPORTED +Hint Resolve dist_1b: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/dist_2a.con". + +(* UNEXPORTED +Hint Resolve dist_2a: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/dist_2b.con". + +(* UNEXPORTED +Hint Resolve dist_2b: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/mult_distr_sum0_lft.con". + +(* UNEXPORTED +Hint Resolve mult_distr_sum0_lft. +*) + +inline "cic:/CoRN/algebra/CRings/mult_distr_sum_lft.con". + +(* UNEXPORTED +Hint Resolve mult_distr_sum_lft: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/mult_distr_sum_rht.con". + +inline "cic:/CoRN/algebra/CRings/sumx_const.con". + +(* UNEXPORTED +End Dist_properties +*) + +(* UNEXPORTED +Hint Resolve dist_1b dist_2a dist_2b mult_distr_sum_lft mult_distr_sum_rht + sumx_const: algebra. +*) + +(*#* +** Properties of exponentiation (with the exponent in [nat]) +%\begin{convention}% +Let [R] be a ring. +%\end{convention}% +*) + +(* UNEXPORTED +Section NExp_properties +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/NExp_properties/R.var". + +inline "cic:/CoRN/algebra/CRings/nexp_wd.con". + +inline "cic:/CoRN/algebra/CRings/nexp_strext.con". + +inline "cic:/CoRN/algebra/CRings/nexp_Sn.con". + +(* UNEXPORTED +Hint Resolve nexp_wd nexp_Sn: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/nexp_plus.con". + +(* UNEXPORTED +Hint Resolve nexp_plus: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/one_nexp.con". + +(* UNEXPORTED +Hint Resolve one_nexp: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/mult_nexp.con". + +(* UNEXPORTED +Hint Resolve mult_nexp: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/nexp_mult.con". + +(* UNEXPORTED +Hint Resolve nexp_mult: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/zero_nexp.con". + +(* UNEXPORTED +Hint Resolve zero_nexp: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/inv_nexp_even.con". + +(* UNEXPORTED +Hint Resolve inv_nexp_even: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/inv_nexp_two.con". + +(* UNEXPORTED +Hint Resolve inv_nexp_two: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/inv_nexp_odd.con". + +(* UNEXPORTED +Hint Resolve inv_nexp_odd: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/nexp_one.con". + +(* UNEXPORTED +Hint Resolve nexp_one: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/nexp_two.con". + +(* UNEXPORTED +Hint Resolve nexp_two: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/inv_one_even_nexp.con". + +(* UNEXPORTED +Hint Resolve inv_one_even_nexp: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/inv_one_odd_nexp.con". + +(* UNEXPORTED +Hint Resolve inv_one_odd_nexp: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/square_plus.con". + +inline "cic:/CoRN/algebra/CRings/square_minus.con". + +inline "cic:/CoRN/algebra/CRings/nexp_funny.con". + +(* UNEXPORTED +Hint Resolve nexp_funny: algebra. +*) + +inline "cic:/CoRN/algebra/CRings/nexp_funny'.con". + +(* UNEXPORTED +Hint Resolve nexp_funny': algebra. +*) + +(* UNEXPORTED +End NExp_properties +*) + +(* UNEXPORTED +Hint Resolve nexp_wd nexp_Sn nexp_plus one_nexp mult_nexp nexp_mult zero_nexp + inv_nexp_even inv_nexp_two inv_nexp_odd nexp_one nexp_two nexp_funny + inv_one_even_nexp inv_one_odd_nexp nexp_funny' one_nexp square_plus + square_minus: algebra. +*) + +(* UNEXPORTED +Section CRing_Ops +*) + +(*#* +** Functional Operations + +Now for partial functions. + +%\begin{convention}% +Let [R] be a ring and let [F,G:(PartFunct R)] with predicates +respectively [P] and [Q]. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/CRing_Ops/R.var". + +alias id "F" = "cic:/CoRN/algebra/CRings/CRing_Ops/F.var". + +alias id "G" = "cic:/CoRN/algebra/CRings/CRing_Ops/G.var". + +(* begin hide *) + +inline "cic:/CoRN/algebra/CRings/CRing_Ops/P.con" "CRing_Ops__". + +inline "cic:/CoRN/algebra/CRings/CRing_Ops/Q.con" "CRing_Ops__". + +(* end hide *) + +(* UNEXPORTED +Section Part_Function_Mult +*) + +inline "cic:/CoRN/algebra/CRings/part_function_mult_strext.con". + +inline "cic:/CoRN/algebra/CRings/Fmult.con". + +(* UNEXPORTED +End Part_Function_Mult +*) + +(* UNEXPORTED +Section Part_Function_Nth_Power +*) + +alias id "n" = "cic:/CoRN/algebra/CRings/CRing_Ops/Part_Function_Nth_Power/n.var". + +inline "cic:/CoRN/algebra/CRings/part_function_nth_strext.con". + +inline "cic:/CoRN/algebra/CRings/Fnth.con". + +(* UNEXPORTED +End Part_Function_Nth_Power +*) + +(*#* +%\begin{convention}% Let [R':R->CProp]. +%\end{convention}% +*) + +alias id "R'" = "cic:/CoRN/algebra/CRings/CRing_Ops/R'.var". + +inline "cic:/CoRN/algebra/CRings/included_FMult.con". + +inline "cic:/CoRN/algebra/CRings/included_FMult'.con". + +inline "cic:/CoRN/algebra/CRings/included_FMult''.con". + +alias id "n" = "cic:/CoRN/algebra/CRings/CRing_Ops/n.var". + +inline "cic:/CoRN/algebra/CRings/included_FNth.con". + +inline "cic:/CoRN/algebra/CRings/included_FNth'.con". + +(* UNEXPORTED +End CRing_Ops +*) + +inline "cic:/CoRN/algebra/CRings/Fscalmult.con". + +(* UNEXPORTED +Implicit Arguments Fmult [R]. +*) + +(* NOTATION +Infix "{*}" := Fmult (at level 40, left associativity). +*) + +(* UNEXPORTED +Implicit Arguments Fscalmult [R]. +*) + +(* NOTATION +Infix "{**}" := Fscalmult (at level 40, left associativity). +*) + +(* UNEXPORTED +Implicit Arguments Fnth [R]. +*) + +(* NOTATION +Infix "{^}" := Fnth (at level 30, right associativity). +*) + +(* UNEXPORTED +Section ScalarMultiplication +*) + +alias id "R" = "cic:/CoRN/algebra/CRings/ScalarMultiplication/R.var". + +alias id "F" = "cic:/CoRN/algebra/CRings/ScalarMultiplication/F.var". + +(* begin hide *) + +inline "cic:/CoRN/algebra/CRings/ScalarMultiplication/P.con" "ScalarMultiplication__". + +(* end hide *) + +alias id "R'" = "cic:/CoRN/algebra/CRings/ScalarMultiplication/R'.var". + +inline "cic:/CoRN/algebra/CRings/included_FScalMult.con". + +inline "cic:/CoRN/algebra/CRings/included_FScalMult'.con". + +(* UNEXPORTED +End ScalarMultiplication +*) + +(* UNEXPORTED +Hint Resolve included_FMult included_FScalMult included_FNth : included. +*) + +(* UNEXPORTED +Hint Immediate included_FMult' included_FMult'' included_FScalMult' + included_FNth' : included. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CSemiGroups.ma b/matita/contribs/CoRN-Decl/algebra/CSemiGroups.ma new file mode 100644 index 000000000..e107fad24 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CSemiGroups.ma @@ -0,0 +1,199 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CSemiGroups". + +include "CoRN.ma". + +(* $Id: CSemiGroups.v,v 1.8 2004/04/22 14:49:43 lcf Exp $ *) + +(*#* printing [+] %\ensuremath+% #+# *) + +(*#* printing {+} %\ensuremath+% #+# *) + +include "algebra/CSetoidInc.ma". + +(* Begin_SpecReals *) + +(*#* *Semigroups + +**Definition of the notion of semigroup +*) + +inline "cic:/CoRN/algebra/CSemiGroups/is_CSemiGroup.con". + +inline "cic:/CoRN/algebra/CSemiGroups/CSemiGroup.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSemiGroups/csg_crr.con 0 (* compounds *). + +(*#* +%\begin{nameconvention}% +In the %{\em %names%}% of lemmas, we will denote [[+]] with [plus]. +%\end{nameconvention}% +*) + +(* UNEXPORTED +Implicit Arguments csg_op [c]. +*) + +(* NOTATION +Infix "[+]" := csg_op (at level 50, left associativity). +*) + +(* End_SpecReals *) + +(*#* **Semigroup axioms +The axiomatic properties of a semi group. + +%\begin{convention}% Let [G] be a semi-group. +%\end{convention}% +*) + +(* UNEXPORTED +Section CSemiGroup_axioms +*) + +alias id "G" = "cic:/CoRN/algebra/CSemiGroups/CSemiGroup_axioms/G.var". + +inline "cic:/CoRN/algebra/CSemiGroups/CSemiGroup_is_CSemiGroup.con". + +inline "cic:/CoRN/algebra/CSemiGroups/plus_assoc.con". + +(* UNEXPORTED +End CSemiGroup_axioms +*) + +(* Begin_SpecReals *) + +(*#* **Semigroup basics + +%\begin{convention}% +Let [G] be a semi-group. +%\end{convention}% +*) + +(* UNEXPORTED +Section CSemiGroup_basics +*) + +alias id "G" = "cic:/CoRN/algebra/CSemiGroups/CSemiGroup_basics/G.var". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSemiGroups/plus_assoc_unfolded.con". + +(* UNEXPORTED +End CSemiGroup_basics +*) + +(* End_SpecReals *) + +(* UNEXPORTED +Hint Resolve plus_assoc_unfolded: algebra. +*) + +(*#* **Functional operations +We can also define a similar addition operator, which will be denoted by [{+}], on partial functions. + +%\begin{convention}% Whenever possible, we will denote the functional construction corresponding to an algebraic operation by the same symbol enclosed in curly braces. +%\end{convention}% + +At this stage, we will always consider automorphisms; we %{\em %could%}% treat this in a more general setting, but we feel that it wouldn't really be a useful effort. + +%\begin{convention}% Let [G:CSemiGroup] and [F,F':(PartFunct G)] and denote by [P] and [Q], respectively, the predicates characterizing their domains. +%\end{convention}% +*) + +(* UNEXPORTED +Section Part_Function_Plus +*) + +alias id "G" = "cic:/CoRN/algebra/CSemiGroups/Part_Function_Plus/G.var". + +alias id "F" = "cic:/CoRN/algebra/CSemiGroups/Part_Function_Plus/F.var". + +alias id "F'" = "cic:/CoRN/algebra/CSemiGroups/Part_Function_Plus/F'.var". + +(* begin hide *) + +inline "cic:/CoRN/algebra/CSemiGroups/Part_Function_Plus/P.con" "Part_Function_Plus__". + +inline "cic:/CoRN/algebra/CSemiGroups/Part_Function_Plus/Q.con" "Part_Function_Plus__". + +(* end hide *) + +inline "cic:/CoRN/algebra/CSemiGroups/part_function_plus_strext.con". + +inline "cic:/CoRN/algebra/CSemiGroups/Fplus.con". + +(*#* +%\begin{convention}% Let [R:G->CProp]. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/algebra/CSemiGroups/Part_Function_Plus/R.var". + +inline "cic:/CoRN/algebra/CSemiGroups/included_FPlus.con". + +inline "cic:/CoRN/algebra/CSemiGroups/included_FPlus'.con". + +inline "cic:/CoRN/algebra/CSemiGroups/included_FPlus''.con". + +(* UNEXPORTED +End Part_Function_Plus +*) + +(* UNEXPORTED +Implicit Arguments Fplus [G]. +*) + +(* NOTATION +Infix "{+}" := Fplus (at level 50, left associativity). +*) + +(* UNEXPORTED +Hint Resolve included_FPlus : included. +*) + +(* UNEXPORTED +Hint Immediate included_FPlus' included_FPlus'' : included. +*) + +(*#* **Subsemigroups +%\begin{convention}% +Let [csg] a semi-group and [P] a non-empty +predicate on the semi-group which is preserved by [[+]]. +%\end{convention}% +*) + +(* UNEXPORTED +Section SubCSemiGroups +*) + +alias id "csg" = "cic:/CoRN/algebra/CSemiGroups/SubCSemiGroups/csg.var". + +alias id "P" = "cic:/CoRN/algebra/CSemiGroups/SubCSemiGroups/P.var". + +alias id "op_pres_P" = "cic:/CoRN/algebra/CSemiGroups/SubCSemiGroups/op_pres_P.var". + +inline "cic:/CoRN/algebra/CSemiGroups/SubCSemiGroups/subcrr.con" "SubCSemiGroups__". + +inline "cic:/CoRN/algebra/CSemiGroups/Build_SubCSemiGroup.con". + +(* UNEXPORTED +End SubCSemiGroups +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CSetoidFun.ma b/matita/contribs/CoRN-Decl/algebra/CSetoidFun.ma new file mode 100644 index 000000000..f025d8a94 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CSetoidFun.ma @@ -0,0 +1,619 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CSetoidFun". + +include "CoRN.ma". + +(* $Id: CSetoidFun.v,v 1.10 2004/04/23 10:00:53 lcf Exp $ *) + +include "algebra/CSetoids.ma". + +(* UNEXPORTED +Section unary_function_composition +*) + +(*#* ** Composition of Setoid functions + +Let [S1], [S2] and [S3] be setoids, [f] a +setoid function from [S1] to [S2], and [g] from [S2] +to [S3] in the following definition of composition. *) + +alias id "S1" = "cic:/CoRN/algebra/CSetoidFun/unary_function_composition/S1.var". + +alias id "S2" = "cic:/CoRN/algebra/CSetoidFun/unary_function_composition/S2.var". + +alias id "S3" = "cic:/CoRN/algebra/CSetoidFun/unary_function_composition/S3.var". + +alias id "f" = "cic:/CoRN/algebra/CSetoidFun/unary_function_composition/f.var". + +alias id "g" = "cic:/CoRN/algebra/CSetoidFun/unary_function_composition/g.var". + +inline "cic:/CoRN/algebra/CSetoidFun/compose_CSetoid_fun.con". + +(* UNEXPORTED +End unary_function_composition +*) + +(* UNEXPORTED +Section unary_and_binary_function_composition +*) + +inline "cic:/CoRN/algebra/CSetoidFun/compose_CSetoid_bin_un_fun.con". + +inline "cic:/CoRN/algebra/CSetoidFun/compose_CSetoid_bin_fun.con". + +inline "cic:/CoRN/algebra/CSetoidFun/compose_CSetoid_un_bin_fun.con". + +(* UNEXPORTED +End unary_and_binary_function_composition +*) + +(*#* ***Projections +*) + +(* UNEXPORTED +Section function_projection +*) + +inline "cic:/CoRN/algebra/CSetoidFun/proj_bin_fun.con". + +inline "cic:/CoRN/algebra/CSetoidFun/projected_bin_fun.con". + +(* UNEXPORTED +End function_projection +*) + +(* UNEXPORTED +Section BinProj +*) + +alias id "S" = "cic:/CoRN/algebra/CSetoidFun/BinProj/S.var". + +inline "cic:/CoRN/algebra/CSetoidFun/binproj1.con". + +inline "cic:/CoRN/algebra/CSetoidFun/binproj1_strext.con". + +inline "cic:/CoRN/algebra/CSetoidFun/cs_binproj1.con". + +(* UNEXPORTED +End BinProj +*) + +(*#* **Combining operations +%\begin{convention}% Let [S1], [S2] and [S3] be setoids. +%\end{convention}% +*) + +(* UNEXPORTED +Section CombiningOperations +*) + +alias id "S1" = "cic:/CoRN/algebra/CSetoidFun/CombiningOperations/S1.var". + +alias id "S2" = "cic:/CoRN/algebra/CSetoidFun/CombiningOperations/S2.var". + +alias id "S3" = "cic:/CoRN/algebra/CSetoidFun/CombiningOperations/S3.var". + +(*#* +In the following definition, we assume [f] is a setoid function from +[S1] to [S2], and [op] is an unary operation on [S2]. +Then [opOnFun] is the composition [op] after [f]. +*) + +(* UNEXPORTED +Section CombiningUnaryOperations +*) + +alias id "f" = "cic:/CoRN/algebra/CSetoidFun/CombiningOperations/CombiningUnaryOperations/f.var". + +alias id "op" = "cic:/CoRN/algebra/CSetoidFun/CombiningOperations/CombiningUnaryOperations/op.var". + +inline "cic:/CoRN/algebra/CSetoidFun/opOnFun.con". + +(* UNEXPORTED +End CombiningUnaryOperations +*) + +(* UNEXPORTED +End CombiningOperations +*) + +(*#* **Partial Functions + +In this section we define a concept of partial function for an +arbitrary setoid. Essentially, a partial function is what would be +expected---a predicate on the setoid in question and a total function +from the set of points satisfying that predicate to the setoid. There +is one important limitations to this approach: first, the record we +obtain has type [Type], meaning that we can't use, for instance, +elimination of existential quantifiers. + +Furthermore, for reasons we will explain ahead, partial functions will +not be defined via the [CSetoid_fun] record, but the whole structure +will be incorporated in a new record. + +Finally, notice that to be completely general the domains of the +functions have to be characterized by a [CProp]-valued predicate; +otherwise, the use you can make of a function will be %\emph{%##a +priori##%}% restricted at the moment it is defined. + +Before we state our definitions we need to do some work on domains. +*) + +(* UNEXPORTED +Section SubSets_of_G +*) + +(*#* ***Subsets of Setoids + +Subsets of a setoid will be identified with predicates from the +carrier set of the setoid into [CProp]. At this stage, we do not make +any assumptions about these predicates. + +We will begin by defining elementary operations on predicates, along +with their basic properties. In particular, we will work with well +defined predicates, so we will prove that these operations preserve +welldefinedness. + +%\begin{convention}% Let [S:CSetoid] and [P,Q:S->CProp]. +%\end{convention}% +*) + +alias id "S" = "cic:/CoRN/algebra/CSetoidFun/SubSets_of_G/S.var". + +(* UNEXPORTED +Section Conjunction +*) + +alias id "P" = "cic:/CoRN/algebra/CSetoidFun/SubSets_of_G/Conjunction/P.var". + +alias id "Q" = "cic:/CoRN/algebra/CSetoidFun/SubSets_of_G/Conjunction/Q.var". + +inline "cic:/CoRN/algebra/CSetoidFun/conjP.con". + +inline "cic:/CoRN/algebra/CSetoidFun/prj1.con". + +inline "cic:/CoRN/algebra/CSetoidFun/prj2.con". + +inline "cic:/CoRN/algebra/CSetoidFun/conj_wd.con". + +(* UNEXPORTED +End Conjunction +*) + +(* UNEXPORTED +Section Disjunction +*) + +alias id "P" = "cic:/CoRN/algebra/CSetoidFun/SubSets_of_G/Disjunction/P.var". + +alias id "Q" = "cic:/CoRN/algebra/CSetoidFun/SubSets_of_G/Disjunction/Q.var". + +(*#* +Although at this stage we never use it, for completeness's sake we also treat disjunction (corresponding to union of subsets). +*) + +inline "cic:/CoRN/algebra/CSetoidFun/disj.con". + +inline "cic:/CoRN/algebra/CSetoidFun/inj1.con". + +inline "cic:/CoRN/algebra/CSetoidFun/inj2.con". + +inline "cic:/CoRN/algebra/CSetoidFun/disj_wd.con". + +(* UNEXPORTED +End Disjunction +*) + +(* UNEXPORTED +Section Extension +*) + +(*#* +The next definition is a bit tricky, and is useful for choosing among the elements that satisfy a predicate [P] those that also satisfy [R] in the case where [R] is only defined for elements satisfying [P]---consider [R] to be a condition on the image of an object via a function with domain [P]. We chose to call this operation [extension]. +*) + +alias id "P" = "cic:/CoRN/algebra/CSetoidFun/SubSets_of_G/Extension/P.var". + +alias id "R" = "cic:/CoRN/algebra/CSetoidFun/SubSets_of_G/Extension/R.var". + +inline "cic:/CoRN/algebra/CSetoidFun/extend.con". + +inline "cic:/CoRN/algebra/CSetoidFun/ext1.con". + +inline "cic:/CoRN/algebra/CSetoidFun/ext2_a.con". + +inline "cic:/CoRN/algebra/CSetoidFun/ext2.con". + +inline "cic:/CoRN/algebra/CSetoidFun/extension_wd.con". + +(* UNEXPORTED +End Extension +*) + +(* UNEXPORTED +End SubSets_of_G +*) + +(* NOTATION +Notation Conj := (conjP _). +*) + +(* UNEXPORTED +Implicit Arguments disj [S]. +*) + +(* UNEXPORTED +Implicit Arguments extend [S]. +*) + +(* UNEXPORTED +Implicit Arguments ext1 [S P R x]. +*) + +(* UNEXPORTED +Implicit Arguments ext2 [S P R x]. +*) + +(*#* ***Operations + +We are now ready to define the concept of partial function between arbitrary setoids. +*) + +inline "cic:/CoRN/algebra/CSetoidFun/BinPartFunct.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoidFun/bpfpfun.con 0 (* compounds *). + +(* NOTATION +Notation BDom := (bpfdom _ _). +*) + +(* UNEXPORTED +Implicit Arguments bpfpfun [S1 S2]. +*) + +(*#* +The next lemma states that every partial function is well defined. +*) + +inline "cic:/CoRN/algebra/CSetoidFun/bpfwdef.con". + +(*#* Similar for automorphisms. *) + +inline "cic:/CoRN/algebra/CSetoidFun/PartFunct.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoidFun/pfpfun.con 0 (* compounds *). + +(* NOTATION +Notation Dom := (pfdom _). +*) + +(* NOTATION +Notation Part := (pfpfun _). +*) + +(* UNEXPORTED +Implicit Arguments pfpfun [S]. +*) + +(*#* +The next lemma states that every partial function is well defined. +*) + +inline "cic:/CoRN/algebra/CSetoidFun/pfwdef.con". + +(*#* +A few characteristics of this definition should be explained: + - The domain of the partial function is characterized by a predicate +that is required to be well defined but not strongly extensional. The +motivation for this choice comes from two facts: first, one very +important subset of real numbers is the compact interval +[[a,b]]---characterized by the predicate [ fun x : IR => a [<=] x /\ x +[<=] b], which is not strongly extensional; on the other hand, if we +can apply a function to an element [s] of a setoid [S] it seems +reasonable (and at some point we do have to do it) to apply that same +function to any element [s'] which is equal to [s] from the point of +view of the setoid equality. + - The last two conditions state that [pfpfun] is really a subsetoid +function. The reason why we do not write it that way is the +following: when applying a partial function [f] to an element [s] of +[S] we also need a proof object [H]; with this definition the object +we get is [f(s,H)], where the proof is kept separate from the object. +Using subsetoid notation, we would get $f(\langle +s,H\rangle)$#f(⟨s,H⟩)#; from this we need to apply two +projections to get either the original object or the proof, and we +need to apply an extra constructor to get $f(\langle +s,H\rangle)$#f(⟨s,H⟩)# from [s] and [H]. This amounts +to spending more resources when actually working with these objects. + - This record has type [Type], which is very unfortunate, because it +means in particular that we cannot use the well behaved set +existential quantification over partial functions; however, later on +we will manage to avoid this problem in a way that also justifies that +we don't really need to use that kind of quantification. Another +approach to this definition that completely avoid this complication +would be to make [PartFunct] a dependent type, receiving the predicate +as an argument. This does work in that it allows us to give +[PartFunct] type [Set] and do some useful stuff with it; however, we +are not able to define something as simple as an operator that gets a +function and returns its domain (because of the restrictions in the +type elimination rules). This sounds very unnatural, and soon gets us +into strange problems that yield very unlikely definitions, which is +why we chose to altogether do away with this approach. + +%\begin{convention}% All partial functions will henceforth be denoted by capital letters. +%\end{convention}% + +We now present some methods for defining partial functions. +*) + +(* UNEXPORTED +Hint Resolve CI: core. +*) + +(* UNEXPORTED +Section CSetoid_Ops +*) + +alias id "S" = "cic:/CoRN/algebra/CSetoidFun/CSetoid_Ops/S.var". + +(*#* +To begin with, we want to be able to ``see'' each total function as a partial function. +*) + +inline "cic:/CoRN/algebra/CSetoidFun/total_eq_part.con". + +(* UNEXPORTED +Section Part_Function_Const +*) + +(*#* +In any setoid we can also define constant functions (one for each element of the setoid) and an identity function: + +%\begin{convention}% Let [c:S]. +%\end{convention}% +*) + +alias id "c" = "cic:/CoRN/algebra/CSetoidFun/CSetoid_Ops/Part_Function_Const/c.var". + +inline "cic:/CoRN/algebra/CSetoidFun/Fconst.con". + +(* UNEXPORTED +End Part_Function_Const +*) + +(* UNEXPORTED +Section Part_Function_Id +*) + +inline "cic:/CoRN/algebra/CSetoidFun/Fid.con". + +(* UNEXPORTED +End Part_Function_Id +*) + +(*#* +(These happen to be always total functions, but that is more or less obvious, as we have no information on the setoid; however, we will be able to define partial functions just applying other operators to these ones.) + +If we have two setoid functions [F] and [G] we can always compose them. The domain of our new function will be the set of points [s] in the domain of [F] for which [F(s)] is in the domain of [G]#. #%\footnote{%Notice that the use of extension here is essential.%}.% The inversion in the order of the variables is done to maintain uniformity with the usual mathematical notation. + +%\begin{convention}% Let [G,F:(PartFunct S)] and denote by [Q] and [P], respectively, the predicates characterizing their domains. +%\end{convention}% +*) + +(* UNEXPORTED +Section Part_Function_Composition +*) + +alias id "G" = "cic:/CoRN/algebra/CSetoidFun/CSetoid_Ops/Part_Function_Composition/G.var". + +alias id "F" = "cic:/CoRN/algebra/CSetoidFun/CSetoid_Ops/Part_Function_Composition/F.var". + +(* begin hide *) + +inline "cic:/CoRN/algebra/CSetoidFun/CSetoid_Ops/Part_Function_Composition/P.con" "CSetoid_Ops__Part_Function_Composition__". + +inline "cic:/CoRN/algebra/CSetoidFun/CSetoid_Ops/Part_Function_Composition/Q.con" "CSetoid_Ops__Part_Function_Composition__". + +(* end hide *) + +inline "cic:/CoRN/algebra/CSetoidFun/CSetoid_Ops/Part_Function_Composition/R.con" "CSetoid_Ops__Part_Function_Composition__". + +inline "cic:/CoRN/algebra/CSetoidFun/part_function_comp_strext.con". + +inline "cic:/CoRN/algebra/CSetoidFun/part_function_comp_dom_wd.con". + +inline "cic:/CoRN/algebra/CSetoidFun/Fcomp.con". + +(* UNEXPORTED +End Part_Function_Composition +*) + +(* UNEXPORTED +End CSetoid_Ops +*) + +(*#* +%\begin{convention}% Let [F:(BinPartFunct S1 S2)] and [G:(PartFunct S2 S3)], and denote by [Q] and [P], respectively, the predicates characterizing their domains. +%\end{convention}% +*) + +(* UNEXPORTED +Section BinPart_Function_Composition +*) + +alias id "S1" = "cic:/CoRN/algebra/CSetoidFun/BinPart_Function_Composition/S1.var". + +alias id "S2" = "cic:/CoRN/algebra/CSetoidFun/BinPart_Function_Composition/S2.var". + +alias id "S3" = "cic:/CoRN/algebra/CSetoidFun/BinPart_Function_Composition/S3.var". + +alias id "G" = "cic:/CoRN/algebra/CSetoidFun/BinPart_Function_Composition/G.var". + +alias id "F" = "cic:/CoRN/algebra/CSetoidFun/BinPart_Function_Composition/F.var". + +(* begin hide *) + +inline "cic:/CoRN/algebra/CSetoidFun/BinPart_Function_Composition/P.con" "BinPart_Function_Composition__". + +inline "cic:/CoRN/algebra/CSetoidFun/BinPart_Function_Composition/Q.con" "BinPart_Function_Composition__". + +(* end hide *) + +inline "cic:/CoRN/algebra/CSetoidFun/BinPart_Function_Composition/R.con" "BinPart_Function_Composition__". + +inline "cic:/CoRN/algebra/CSetoidFun/bin_part_function_comp_strext.con". + +inline "cic:/CoRN/algebra/CSetoidFun/bin_part_function_comp_dom_wd.con". + +inline "cic:/CoRN/algebra/CSetoidFun/BinFcomp.con". + +(* UNEXPORTED +End BinPart_Function_Composition +*) + +(* Different tokens for compatibility with coqdoc *) + +(* UNEXPORTED +Implicit Arguments Fconst [S]. +*) + +(* NOTATION +Notation "[-C-] x" := (Fconst x) (at level 2, right associativity). +*) + +(* NOTATION +Notation FId := (Fid _). +*) + +(* UNEXPORTED +Implicit Arguments Fcomp [S]. +*) + +(* NOTATION +Infix "[o]" := Fcomp (at level 65, no associativity). +*) + +(* UNEXPORTED +Hint Resolve pfwdef bpfwdef: algebra. +*) + +(* UNEXPORTED +Section bijections +*) + +(*#* **Bijections *) + +inline "cic:/CoRN/algebra/CSetoidFun/injective.con". + +inline "cic:/CoRN/algebra/CSetoidFun/injective_weak.con". + +inline "cic:/CoRN/algebra/CSetoidFun/surjective.con". + +(* UNEXPORTED +Implicit Arguments injective [A B]. +*) + +(* UNEXPORTED +Implicit Arguments injective_weak [A B]. +*) + +(* UNEXPORTED +Implicit Arguments surjective [A B]. +*) + +inline "cic:/CoRN/algebra/CSetoidFun/injective_imp_injective_weak.con". + +inline "cic:/CoRN/algebra/CSetoidFun/bijective.con". + +(* UNEXPORTED +Implicit Arguments bijective [A B]. +*) + +inline "cic:/CoRN/algebra/CSetoidFun/id_is_bij.con". + +inline "cic:/CoRN/algebra/CSetoidFun/comp_resp_bij.con". + +inline "cic:/CoRN/algebra/CSetoidFun/inv.con". + +(* UNEXPORTED +Implicit Arguments inv [A B]. +*) + +inline "cic:/CoRN/algebra/CSetoidFun/invfun.con". + +(* UNEXPORTED +Implicit Arguments invfun [A B]. +*) + +inline "cic:/CoRN/algebra/CSetoidFun/inv1.con". + +inline "cic:/CoRN/algebra/CSetoidFun/inv2.con". + +inline "cic:/CoRN/algebra/CSetoidFun/inv_strext.con". + +inline "cic:/CoRN/algebra/CSetoidFun/Inv.con". + +(* UNEXPORTED +Implicit Arguments Inv [A B]. +*) + +inline "cic:/CoRN/algebra/CSetoidFun/Inv_bij.con". + +(* UNEXPORTED +End bijections +*) + +(* UNEXPORTED +Implicit Arguments bijective [A B]. +*) + +(* UNEXPORTED +Implicit Arguments injective [A B]. +*) + +(* UNEXPORTED +Implicit Arguments injective_weak [A B]. +*) + +(* UNEXPORTED +Implicit Arguments surjective [A B]. +*) + +(* UNEXPORTED +Implicit Arguments inv [A B]. +*) + +(* UNEXPORTED +Implicit Arguments invfun [A B]. +*) + +(* UNEXPORTED +Implicit Arguments Inv [A B]. +*) + +(* UNEXPORTED +Implicit Arguments conj_wd [S P Q]. +*) + +(* NOTATION +Notation Prj1 := (prj1 _ _ _ _). +*) + +(* NOTATION +Notation Prj2 := (prj2 _ _ _ _). +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CSetoidInc.ma b/matita/contribs/CoRN-Decl/algebra/CSetoidInc.ma new file mode 100644 index 000000000..380219a81 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CSetoidInc.ma @@ -0,0 +1,108 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CSetoidInc". + +include "CoRN.ma". + +(* $Id: CSetoidInc.v,v 1.3 2004/04/22 14:49:43 lcf Exp $ *) + +(*#* printing included %\ensuremath{\subseteq}% #⊆# *) + +include "algebra/CSetoidFun.ma". + +(* UNEXPORTED +Section inclusion +*) + +(*#* ** Inclusion + +Let [S] be a setoid, and [P], [Q], [R] be predicates on [S]. *) + +alias id "S" = "cic:/CoRN/algebra/CSetoidInc/inclusion/S.var". + +inline "cic:/CoRN/algebra/CSetoidInc/included.con". + +(* UNEXPORTED +Section Basics +*) + +alias id "P" = "cic:/CoRN/algebra/CSetoidInc/inclusion/Basics/P.var". + +alias id "Q" = "cic:/CoRN/algebra/CSetoidInc/inclusion/Basics/Q.var". + +alias id "R" = "cic:/CoRN/algebra/CSetoidInc/inclusion/Basics/R.var". + +inline "cic:/CoRN/algebra/CSetoidInc/included_refl.con". + +inline "cic:/CoRN/algebra/CSetoidInc/included_trans.con". + +inline "cic:/CoRN/algebra/CSetoidInc/included_conj.con". + +inline "cic:/CoRN/algebra/CSetoidInc/included_conj'.con". + +inline "cic:/CoRN/algebra/CSetoidInc/included_conj''.con". + +inline "cic:/CoRN/algebra/CSetoidInc/included_conj_lft.con". + +inline "cic:/CoRN/algebra/CSetoidInc/included_conj_rht.con". + +inline "cic:/CoRN/algebra/CSetoidInc/included_extend.con". + +(* UNEXPORTED +End Basics +*) + +(*#* +%\begin{convention}% Let [I,R:S->CProp] and [F G:(PartFunct S)], and denote +by [P] and [Q], respectively, the domains of [F] and [G]. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/algebra/CSetoidInc/inclusion/F.var". + +alias id "G" = "cic:/CoRN/algebra/CSetoidInc/inclusion/G.var". + +(* begin hide *) + +inline "cic:/CoRN/algebra/CSetoidInc/inclusion/P.con" "inclusion__". + +inline "cic:/CoRN/algebra/CSetoidInc/inclusion/Q.con" "inclusion__". + +(* end hide *) + +alias id "R" = "cic:/CoRN/algebra/CSetoidInc/inclusion/R.var". + +inline "cic:/CoRN/algebra/CSetoidInc/included_FComp.con". + +inline "cic:/CoRN/algebra/CSetoidInc/included_FComp'.con". + +(* UNEXPORTED +End inclusion +*) + +(* UNEXPORTED +Implicit Arguments included [S]. +*) + +(* UNEXPORTED +Hint Resolve included_refl included_FComp : included. +*) + +(* UNEXPORTED +Hint Immediate included_trans included_FComp' : included. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CSetoids.ma b/matita/contribs/CoRN-Decl/algebra/CSetoids.ma new file mode 100644 index 000000000..a11ee1229 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CSetoids.ma @@ -0,0 +1,974 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CSetoids". + +include "CoRN.ma". + +(* $Id.v,v 1.18 2002/11/25 14:43:42 lcf Exp $ *) + +(*#* printing [=] %\ensuremath{\equiv}% #≡# *) + +(*#* printing [~=] %\ensuremath{\mathrel{\not\equiv}}% #≠# *) + +(*#* printing [#] %\ensuremath{\mathrel\#}% *) + +(*#* printing ex_unq %\ensuremath{\exists^1}% #∃1# *) + +(*#* printing [o] %\ensuremath\circ% #⋅# *) + +(*#* printing [-C-] %\ensuremath\diamond% *) + +(* Begin_SpecReals *) + +(*#* *Setoids +Definition of a constructive setoid with apartness, +i.e.%\% a set with an equivalence relation and an apartness relation compatible with it. +*) + +include "algebra/CLogic.ma". + +include "tactics/Step.ma". + +inline "cic:/CoRN/algebra/CSetoids/Relation.con". + +(* End_SpecReals *) + +(* UNEXPORTED +Implicit Arguments Treflexive [A]. +*) + +(* UNEXPORTED +Implicit Arguments Creflexive [A]. +*) + +(* Begin_SpecReals *) + +(* UNEXPORTED +Implicit Arguments Tsymmetric [A]. +*) + +(* UNEXPORTED +Implicit Arguments Csymmetric [A]. +*) + +(* UNEXPORTED +Implicit Arguments Ttransitive [A]. +*) + +(* UNEXPORTED +Implicit Arguments Ctransitive [A]. +*) + +(* begin hide *) + +(* UNEXPORTED +Set Implicit Arguments. +*) + +(* UNEXPORTED +Unset Strict Implicit. +*) + +(* end hide *) + +(*#* **Relations necessary for Setoids +%\begin{convention}% Let [A:Type]. +%\end{convention}% + +Notice that their type depends on the main logical connective. +*) + +(* UNEXPORTED +Section Properties_of_relations +*) + +alias id "A" = "cic:/CoRN/algebra/CSetoids/Properties_of_relations/A.var". + +inline "cic:/CoRN/algebra/CSetoids/irreflexive.con". + +inline "cic:/CoRN/algebra/CSetoids/cotransitive.con". + +inline "cic:/CoRN/algebra/CSetoids/tight_apart.con". + +inline "cic:/CoRN/algebra/CSetoids/antisymmetric.con". + +(* UNEXPORTED +End Properties_of_relations +*) + +(* begin hide *) + +(* UNEXPORTED +Set Strict Implicit. +*) + +(* UNEXPORTED +Unset Implicit Arguments. +*) + +(* end hide *) + +(*#* **Definition of Setoid + +Apartness, being the main relation, needs to be [CProp]-valued. Equality, +as it is characterized by a negative statement, lives in [Prop]. *) + +inline "cic:/CoRN/algebra/CSetoids/is_CSetoid.ind". + +inline "cic:/CoRN/algebra/CSetoids/CSetoid.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/cs_crr.con 0 (* compounds *). + +(* UNEXPORTED +Implicit Arguments cs_eq [c]. +*) + +(* UNEXPORTED +Implicit Arguments cs_ap [c]. +*) + +(* NOTATION +Infix "[=]" := cs_eq (at level 70, no associativity). +*) + +(* NOTATION +Infix "[#]" := cs_ap (at level 70, no associativity). +*) + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/cs_neq.con". + +(* UNEXPORTED +Implicit Arguments cs_neq [S]. +*) + +(* NOTATION +Infix "[~=]" := cs_neq (at level 70, no associativity). +*) + +(*#* +%\begin{nameconvention}% +In the names of lemmas, we refer to [ [=] ] by [eq], [ [~=] ] by +[neq], and [ [#] ] by [ap]. +%\end{nameconvention}% + +** Setoid axioms +We want concrete lemmas that state the axiomatic properties of a setoid. +%\begin{convention}% +Let [S] be a setoid. +%\end{convention}% +*) + +(* Begin_SpecReals *) + +(* UNEXPORTED +Section CSetoid_axioms +*) + +alias id "S" = "cic:/CoRN/algebra/CSetoids/CSetoid_axioms/S.var". + +inline "cic:/CoRN/algebra/CSetoids/CSetoid_is_CSetoid.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_irreflexive.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_symmetric.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_cotransitive.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_tight.con". + +(* UNEXPORTED +End CSetoid_axioms +*) + +(* End_SpecReals *) + +(*#* **Setoid basics%\label{section:setoid-basics}% +%\begin{convention}% Let [S] be a setoid. +%\end{convention}% +*) + +(* Begin_SpecReals *) + +(* UNEXPORTED +Section CSetoid_basics +*) + +alias id "S" = "cic:/CoRN/algebra/CSetoids/CSetoid_basics/S.var". + +(* End_SpecReals *) + +(*#* +In `there exists a unique [a:S] such that %\ldots%#...#', we now mean unique with respect to the setoid equality. We use [ex_unq] to denote unique existence. +*) + +inline "cic:/CoRN/algebra/CSetoids/ex_unq.con". + +inline "cic:/CoRN/algebra/CSetoids/eq_reflexive.con". + +inline "cic:/CoRN/algebra/CSetoids/eq_symmetric.con". + +inline "cic:/CoRN/algebra/CSetoids/eq_transitive.con". + +(*#* +%\begin{shortcoming}% +The lemma [eq_reflexive] above is convertible to +[eq_reflexive_unfolded] below. We need the second version too, +because the first cannot be applied when an instance of reflexivity is needed. +(``I have complained bitterly about this.'' RP) +%\end{shortcoming}% + +%\begin{nameconvention}% +If lemma [a] is just an unfolding of lemma [b], the name of [a] is the name +[b] with the suffix ``[_unfolded]''. +%\end{nameconvention}% +*) + +inline "cic:/CoRN/algebra/CSetoids/eq_reflexive_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/eq_symmetric_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/eq_transitive_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/eq_wdl.con". + +(* Begin_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/ap_irreflexive_unfolded.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/ap_cotransitive_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_symmetric_unfolded.con". + +(*#* +%\begin{shortcoming}% +We would like to write +[[ +Lemma eq_equiv_not_ap : forall (x y:S), x [=] y Iff ~(x [#] y). +]] +In Coq, however, this lemma cannot be easily applied. +Therefore we have to split the lemma into the following two lemmas [eq_imp_not_ap] and [not_ap_imp_eq]. +%\end{shortcoming}% +*) + +inline "cic:/CoRN/algebra/CSetoids/eq_imp_not_ap.con". + +inline "cic:/CoRN/algebra/CSetoids/not_ap_imp_eq.con". + +inline "cic:/CoRN/algebra/CSetoids/neq_imp_notnot_ap.con". + +inline "cic:/CoRN/algebra/CSetoids/notnot_ap_imp_neq.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_imp_neq.con". + +inline "cic:/CoRN/algebra/CSetoids/not_neq_imp_eq.con". + +inline "cic:/CoRN/algebra/CSetoids/eq_imp_not_neq.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End CSetoid_basics +*) + +(* End_SpecReals *) + +(* UNEXPORTED +Section product_csetoid +*) + +(*#* **The product of setoids *) + +inline "cic:/CoRN/algebra/CSetoids/prod_ap.con". + +inline "cic:/CoRN/algebra/CSetoids/prod_eq.con". + +inline "cic:/CoRN/algebra/CSetoids/prodcsetoid_is_CSetoid.con". + +inline "cic:/CoRN/algebra/CSetoids/ProdCSetoid.con". + +(* UNEXPORTED +End product_csetoid +*) + +(* UNEXPORTED +Implicit Arguments ex_unq [S]. +*) + +(* UNEXPORTED +Hint Resolve eq_reflexive_unfolded: algebra_r. +*) + +(* UNEXPORTED +Hint Resolve eq_symmetric_unfolded: algebra_s. +*) + +(* UNEXPORTED +Declare Left Step eq_wdl. +*) + +(* UNEXPORTED +Declare Right Step eq_transitive_unfolded. +*) + +(* Begin_SpecReals *) + +(*#* **Relations and predicates +Here we define the notions of well-definedness and strong extensionality +on predicates and relations. + +%\begin{convention}% Let [S] be a setoid. +%\end{convention}% + +%\begin{nameconvention}% +- ``well-defined'' is abbreviated to [well_def] (or [wd]). +- ``strongly extensional'' is abbreviated to [strong_ext] (or [strext]). + +%\end{nameconvention}% +*) + +(* UNEXPORTED +Section CSetoid_relations_and_predicates +*) + +alias id "S" = "cic:/CoRN/algebra/CSetoids/CSetoid_relations_and_predicates/S.var". + +(* End_SpecReals *) + +(*#* ***Predicates + +At this stage, we consider [CProp]- and [Prop]-valued predicates on setoids. + +%\begin{convention}% Let [P] be a predicate on (the carrier of) [S]. +%\end{convention}% +*) + +(* UNEXPORTED +Section CSetoidPredicates +*) + +alias id "P" = "cic:/CoRN/algebra/CSetoids/CSetoid_relations_and_predicates/CSetoidPredicates/P.var". + +inline "cic:/CoRN/algebra/CSetoids/pred_strong_ext.con". + +inline "cic:/CoRN/algebra/CSetoids/pred_wd.con". + +(* UNEXPORTED +End CSetoidPredicates +*) + +inline "cic:/CoRN/algebra/CSetoids/CSetoid_predicate.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/csp_pred.con 0 (* compounds *). + +inline "cic:/CoRN/algebra/CSetoids/csp_wd.con". + +(*#* Similar, with [Prop] instead of [CProp]. *) + +(* UNEXPORTED +Section CSetoidPPredicates +*) + +alias id "P" = "cic:/CoRN/algebra/CSetoids/CSetoid_relations_and_predicates/CSetoidPPredicates/P.var". + +inline "cic:/CoRN/algebra/CSetoids/pred_strong_ext'.con". + +inline "cic:/CoRN/algebra/CSetoids/pred_wd'.con". + +(* UNEXPORTED +End CSetoidPPredicates +*) + +(*#* ***Definition of a setoid predicate *) + +inline "cic:/CoRN/algebra/CSetoids/CSetoid_predicate'.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/csp'_pred.con 0 (* compounds *). + +inline "cic:/CoRN/algebra/CSetoids/csp'_wd.con". + +(* Begin_SpecReals *) + +(*#* ***Relations +%\begin{convention}% +Let [R] be a relation on (the carrier of) [S]. +%\end{convention}% *) + +(* UNEXPORTED +Section CsetoidRelations +*) + +alias id "R" = "cic:/CoRN/algebra/CSetoids/CSetoid_relations_and_predicates/CsetoidRelations/R.var". + +inline "cic:/CoRN/algebra/CSetoids/rel_wdr.con". + +inline "cic:/CoRN/algebra/CSetoids/rel_wdl.con". + +inline "cic:/CoRN/algebra/CSetoids/rel_strext.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/rel_strext_lft.con". + +inline "cic:/CoRN/algebra/CSetoids/rel_strext_rht.con". + +inline "cic:/CoRN/algebra/CSetoids/rel_strext_imp_lftarg.con". + +inline "cic:/CoRN/algebra/CSetoids/rel_strext_imp_rhtarg.con". + +inline "cic:/CoRN/algebra/CSetoids/rel_strextarg_imp_strext.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End CsetoidRelations +*) + +(*#* ***Definition of a setoid relation +The type of relations over a setoid. *) + +inline "cic:/CoRN/algebra/CSetoids/CSetoid_relation.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/csr_rel.con 0 (* compounds *). + +(*#* ***[CProp] Relations +%\begin{convention}% +Let [R] be a relation on (the carrier of) [S]. +%\end{convention}% +*) + +(* UNEXPORTED +Section CCsetoidRelations +*) + +alias id "R" = "cic:/CoRN/algebra/CSetoids/CSetoid_relations_and_predicates/CCsetoidRelations/R.var". + +inline "cic:/CoRN/algebra/CSetoids/Crel_wdr.con". + +inline "cic:/CoRN/algebra/CSetoids/Crel_wdl.con". + +inline "cic:/CoRN/algebra/CSetoids/Crel_strext.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/Crel_strext_lft.con". + +inline "cic:/CoRN/algebra/CSetoids/Crel_strext_rht.con". + +inline "cic:/CoRN/algebra/CSetoids/Crel_strext_imp_lftarg.con". + +inline "cic:/CoRN/algebra/CSetoids/Crel_strext_imp_rhtarg.con". + +inline "cic:/CoRN/algebra/CSetoids/Crel_strextarg_imp_strext.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End CCsetoidRelations +*) + +(*#* ***Definition of a [CProp] setoid relation + +The type of relations over a setoid. *) + +inline "cic:/CoRN/algebra/CSetoids/CCSetoid_relation.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/Ccsr_rel.con 0 (* compounds *). + +inline "cic:/CoRN/algebra/CSetoids/Ccsr_wdr.con". + +inline "cic:/CoRN/algebra/CSetoids/Ccsr_wdl.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/ap_wdr.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_wdl.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_wdr_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_wdl_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/ap_strext.con". + +inline "cic:/CoRN/algebra/CSetoids/predS_well_def.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End CSetoid_relations_and_predicates +*) + +(* UNEXPORTED +Declare Left Step ap_wdl_unfolded. +*) + +(* UNEXPORTED +Declare Right Step ap_wdr_unfolded. +*) + +(* End_SpecReals *) + +(*#* **Functions between setoids +Such functions must preserve the setoid equality +and be strongly extensional w.r.t.%\% the apartness, i.e.%\% +if [f(x,y) [#] f(x1,y1)], then [x [#] x1 + y [#] y1]. +For every arity this has to be defined separately. +%\begin{convention}% +Let [S1], [S2] and [S3] be setoids. +%\end{convention}% + +First we consider unary functions. *) + +(* Begin_SpecReals *) + +(* UNEXPORTED +Section CSetoid_functions +*) + +alias id "S1" = "cic:/CoRN/algebra/CSetoids/CSetoid_functions/S1.var". + +alias id "S2" = "cic:/CoRN/algebra/CSetoids/CSetoid_functions/S2.var". + +alias id "S3" = "cic:/CoRN/algebra/CSetoids/CSetoid_functions/S3.var". + +(* UNEXPORTED +Section unary_functions +*) + +(*#* +In the following two definitions, +[f] is a function from (the carrier of) [S1] to +(the carrier of) [S2]. *) + +alias id "f" = "cic:/CoRN/algebra/CSetoids/CSetoid_functions/unary_functions/f.var". + +inline "cic:/CoRN/algebra/CSetoids/fun_wd.con". + +inline "cic:/CoRN/algebra/CSetoids/fun_strext.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/fun_strext_imp_wd.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End unary_functions +*) + +inline "cic:/CoRN/algebra/CSetoids/CSetoid_fun.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/csf_fun.con 0 (* compounds *). + +inline "cic:/CoRN/algebra/CSetoids/csf_wd.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/Const_CSetoid_fun.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +Section binary_functions +*) + +(*#* +Now we consider binary functions. +In the following two definitions, +[f] is a function from [S1] and [S2] to [S3]. +*) + +alias id "f" = "cic:/CoRN/algebra/CSetoids/CSetoid_functions/binary_functions/f.var". + +inline "cic:/CoRN/algebra/CSetoids/bin_fun_wd.con". + +inline "cic:/CoRN/algebra/CSetoids/bin_fun_strext.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/bin_fun_strext_imp_wd.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End binary_functions +*) + +inline "cic:/CoRN/algebra/CSetoids/CSetoid_bin_fun.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/csbf_fun.con 0 (* compounds *). + +inline "cic:/CoRN/algebra/CSetoids/csbf_wd.con". + +inline "cic:/CoRN/algebra/CSetoids/csf_wd_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/csf_strext_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/csbf_wd_unfolded.con". + +(* UNEXPORTED +End CSetoid_functions +*) + +(* End_SpecReals *) + +(* UNEXPORTED +Hint Resolve csf_wd_unfolded csbf_wd_unfolded: algebra_c. +*) + +(* UNEXPORTED +Implicit Arguments fun_wd [S1 S2]. +*) + +(* UNEXPORTED +Implicit Arguments fun_strext [S1 S2]. +*) + +(* Begin_SpecReals *) + +(*#* **The unary and binary (inner) operations on a csetoid +An operation is a function with domain(s) and co-domain equal. + +%\begin{nameconvention}% +The word ``unary operation'' is abbreviated to [un_op]; +``binary operation'' is abbreviated to [bin_op]. +%\end{nameconvention}% + +%\begin{convention}% +Let [S] be a setoid. +%\end{convention}% +*) + +(* UNEXPORTED +Section csetoid_inner_ops +*) + +alias id "S" = "cic:/CoRN/algebra/CSetoids/csetoid_inner_ops/S.var". + +(*#* Properties of binary operations *) + +inline "cic:/CoRN/algebra/CSetoids/commutes.con". + +inline "cic:/CoRN/algebra/CSetoids/associative.con". + +(*#* Well-defined unary operations on a setoid. *) + +inline "cic:/CoRN/algebra/CSetoids/un_op_wd.con". + +inline "cic:/CoRN/algebra/CSetoids/un_op_strext.con". + +inline "cic:/CoRN/algebra/CSetoids/CSetoid_un_op.con". + +inline "cic:/CoRN/algebra/CSetoids/Build_CSetoid_un_op.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/id_strext.con". + +inline "cic:/CoRN/algebra/CSetoids/id_pres_eq.con". + +inline "cic:/CoRN/algebra/CSetoids/id_un_op.con". + +(* begin hide *) + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/un_op_fun.con 0 (* compounds *). + +(* end hide *) + +(* Begin_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/cs_un_op_strext.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/un_op_wd_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/un_op_strext_unfolded.con". + +(*#* Well-defined binary operations on a setoid. *) + +inline "cic:/CoRN/algebra/CSetoids/bin_op_wd.con". + +inline "cic:/CoRN/algebra/CSetoids/bin_op_strext.con". + +(* Begin_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/CSetoid_bin_op.con". + +inline "cic:/CoRN/algebra/CSetoids/Build_CSetoid_bin_op.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/cs_bin_op_wd.con". + +inline "cic:/CoRN/algebra/CSetoids/cs_bin_op_strext.con". + +(* Begin_SpecReals *) + +(* begin hide *) + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/bin_op_bin_fun.con 0 (* compounds *). + +(* end hide *) + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/bin_op_wd_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/bin_op_strext_unfolded.con". + +inline "cic:/CoRN/algebra/CSetoids/bin_op_is_wd_un_op_lft.con". + +inline "cic:/CoRN/algebra/CSetoids/bin_op_is_wd_un_op_rht.con". + +inline "cic:/CoRN/algebra/CSetoids/bin_op_is_strext_un_op_lft.con". + +inline "cic:/CoRN/algebra/CSetoids/bin_op_is_strext_un_op_rht.con". + +inline "cic:/CoRN/algebra/CSetoids/bin_op2un_op_rht.con". + +inline "cic:/CoRN/algebra/CSetoids/bin_op2un_op_lft.con". + +(* Begin_SpecReals *) + +(* UNEXPORTED +End csetoid_inner_ops +*) + +(* End_SpecReals *) + +(* UNEXPORTED +Implicit Arguments commutes [S]. +*) + +(* Begin_SpecReals *) + +(* UNEXPORTED +Implicit Arguments associative [S]. +*) + +(* End_SpecReals *) + +(* UNEXPORTED +Hint Resolve bin_op_wd_unfolded un_op_wd_unfolded: algebra_c. +*) + +(*#* **The binary outer operations on a csetoid +%\begin{convention}% +Let [S1] and [S2] be setoids. +%\end{convention}% +*) + +(* UNEXPORTED +Section csetoid_outer_ops +*) + +alias id "S1" = "cic:/CoRN/algebra/CSetoids/csetoid_outer_ops/S1.var". + +alias id "S2" = "cic:/CoRN/algebra/CSetoids/csetoid_outer_ops/S2.var". + +(*#* +Well-defined outer operations on a setoid. +*) + +inline "cic:/CoRN/algebra/CSetoids/outer_op_well_def.con". + +inline "cic:/CoRN/algebra/CSetoids/outer_op_strext.con". + +inline "cic:/CoRN/algebra/CSetoids/CSetoid_outer_op.con". + +inline "cic:/CoRN/algebra/CSetoids/Build_CSetoid_outer_op.con". + +inline "cic:/CoRN/algebra/CSetoids/csoo_wd.con". + +inline "cic:/CoRN/algebra/CSetoids/csoo_strext.con". + +(* begin hide *) + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/outer_op_bin_fun.con 0 (* compounds *). + +(* end hide *) + +inline "cic:/CoRN/algebra/CSetoids/csoo_wd_unfolded.con". + +(* UNEXPORTED +End csetoid_outer_ops +*) + +(* UNEXPORTED +Hint Resolve csoo_wd_unfolded: algebra_c. +*) + +(* Begin_SpecReals *) + +(*#* **Subsetoids +%\begin{convention}% +Let [S] be a setoid, and [P] a predicate on the carrier of [S]. +%\end{convention}% +*) + +(* UNEXPORTED +Section SubCSetoids +*) + +alias id "S" = "cic:/CoRN/algebra/CSetoids/SubCSetoids/S.var". + +alias id "P" = "cic:/CoRN/algebra/CSetoids/SubCSetoids/P.var". + +inline "cic:/CoRN/algebra/CSetoids/subcsetoid_crr.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CSetoids/scs_elem.con 0 (* compounds *). + +(*#* Though [scs_elem] is declared as a coercion, it does not satisfy the +uniform inheritance condition and will not be inserted. However it will +also not be printed, which is handy. +*) + +inline "cic:/CoRN/algebra/CSetoids/restrict_relation.con". + +inline "cic:/CoRN/algebra/CSetoids/Crestrict_relation.con". + +inline "cic:/CoRN/algebra/CSetoids/subcsetoid_eq.con". + +inline "cic:/CoRN/algebra/CSetoids/subcsetoid_ap.con". + +(* End_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/subcsetoid_equiv.con". + +(* Begin_SpecReals *) + +inline "cic:/CoRN/algebra/CSetoids/subcsetoid_is_CSetoid.con". + +inline "cic:/CoRN/algebra/CSetoids/Build_SubCSetoid.con". + +(* End_SpecReals *) + +(*#* ***Subsetoid unary operations +%\begin{convention}% +Let [f] be a unary setoid operation on [S]. +%\end{convention}% +*) + +(* UNEXPORTED +Section SubCSetoid_unary_operations +*) + +alias id "f" = "cic:/CoRN/algebra/CSetoids/SubCSetoids/SubCSetoid_unary_operations/f.var". + +inline "cic:/CoRN/algebra/CSetoids/un_op_pres_pred.con". + +(*#* +%\begin{convention}% +Assume [pr:un_op_pres_pred]. +%\end{convention}% *) + +alias id "pr" = "cic:/CoRN/algebra/CSetoids/SubCSetoids/SubCSetoid_unary_operations/pr.var". + +inline "cic:/CoRN/algebra/CSetoids/restr_un_op.con". + +inline "cic:/CoRN/algebra/CSetoids/restr_un_op_wd.con". + +inline "cic:/CoRN/algebra/CSetoids/restr_un_op_strext.con". + +inline "cic:/CoRN/algebra/CSetoids/Build_SubCSetoid_un_op.con". + +(* UNEXPORTED +End SubCSetoid_unary_operations +*) + +(*#* ***Subsetoid binary operations +%\begin{convention}% +Let [f] be a binary setoid operation on [S]. +%\end{convention}% +*) + +(* UNEXPORTED +Section SubCSetoid_binary_operations +*) + +alias id "f" = "cic:/CoRN/algebra/CSetoids/SubCSetoids/SubCSetoid_binary_operations/f.var". + +inline "cic:/CoRN/algebra/CSetoids/bin_op_pres_pred.con". + +(*#* +%\begin{convention}% +Assume [bin_op_pres_pred]. +%\end{convention}% +*) + +alias id "pr" = "cic:/CoRN/algebra/CSetoids/SubCSetoids/SubCSetoid_binary_operations/pr.var". + +inline "cic:/CoRN/algebra/CSetoids/restr_bin_op.con". + +inline "cic:/CoRN/algebra/CSetoids/restr_bin_op_well_def.con". + +inline "cic:/CoRN/algebra/CSetoids/restr_bin_op_strext.con". + +inline "cic:/CoRN/algebra/CSetoids/Build_SubCSetoid_bin_op.con". + +inline "cic:/CoRN/algebra/CSetoids/restr_f_assoc.con". + +(* UNEXPORTED +End SubCSetoid_binary_operations +*) + +(* Begin_SpecReals *) + +(* UNEXPORTED +End SubCSetoids +*) + +(* End_SpecReals *) + +(* begin hide *) + +(* UNEXPORTED +Ltac Step_final x := apply eq_transitive_unfolded with x; Algebra. +*) + +(* end hide *) + +(* UNEXPORTED +Tactic Notation "Step_final" constr(c) := Step_final c. +*) + +(*#* **Miscellaneous +*) + +inline "cic:/CoRN/algebra/CSetoids/proper_caseZ_diff_CS.con". + +(*#* +Finally, we characterize functions defined on the natural numbers also as setoid functions, similarly to what we already did for predicates. +*) + +inline "cic:/CoRN/algebra/CSetoids/nat_less_n_fun.con". + +inline "cic:/CoRN/algebra/CSetoids/nat_less_n_fun'.con". + +(* UNEXPORTED +Implicit Arguments nat_less_n_fun [S n]. +*) + +(* UNEXPORTED +Implicit Arguments nat_less_n_fun' [S n]. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CSums.ma b/matita/contribs/CoRN-Decl/algebra/CSums.ma new file mode 100644 index 000000000..3930cbf9f --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CSums.ma @@ -0,0 +1,244 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CSums". + +include "CoRN.ma". + +(* $Id: CSums.v,v 1.8 2004/04/23 10:00:54 lcf Exp $ *) + +(*#* printing Sum0 %\ensuremath{\sum_0}% #∑0# *) + +(*#* printing Sum1 %\ensuremath{\sum_1}% #∑1# *) + +(*#* printing Sum2 %\ensuremath{\sum_2}% #∑2# *) + +(*#* printing Sum %\ensuremath{\sum}% #∑# *) + +(*#* printing Sumx %\ensuremath{\sum'}% #∑'&*) + +include "algebra/CAbGroups.ma". + +(*#* * Sums + +%\begin{convention}% Let [G] be an abelian group. +%\end{convention}% +*) + +(* UNEXPORTED +Section Sums +*) + +alias id "G" = "cic:/CoRN/algebra/CSums/Sums/G.var". + +(* Sum1 and Sum use subtraction *) + +inline "cic:/CoRN/algebra/CSums/Sumlist.con". + +inline "cic:/CoRN/algebra/CSums/Sumx.con". + +(*#* +It is sometimes useful to view a function defined on $\{0,\ldots,i-1\}$ +#{0, ... i-1}# as a function on the natural numbers which evaluates to +[Zero] when the input is greater than or equal to [i]. +*) + +inline "cic:/CoRN/algebra/CSums/part_tot_nat_fun.con". + +inline "cic:/CoRN/algebra/CSums/part_tot_nat_fun_ch1.con". + +inline "cic:/CoRN/algebra/CSums/part_tot_nat_fun_ch2.con". + +(*#* [Sum0] defines the sum for [i=0..(n-1)] *) + +inline "cic:/CoRN/algebra/CSums/Sum0.con". + +(*#* [Sum1] defines the sum for [i=m..(n-1)] *) + +inline "cic:/CoRN/algebra/CSums/Sum1.con". + +inline "cic:/CoRN/algebra/CSums/Sum.con". + +(* Sum i=m..n *) + +(*#* [Sum2] is similar to [Sum1], but does not require the summand to be +defined outside where it is being added. *) + +inline "cic:/CoRN/algebra/CSums/Sum2.con". + +inline "cic:/CoRN/algebra/CSums/Sum_one.con". + +(* UNEXPORTED +Hint Resolve Sum_one: algebra. +*) + +inline "cic:/CoRN/algebra/CSums/Sum_empty.con". + +(* UNEXPORTED +Hint Resolve Sum_empty: algebra. +*) + +inline "cic:/CoRN/algebra/CSums/Sum_Sum.con". + +(* UNEXPORTED +Hint Resolve Sum_Sum: algebra. +*) + +inline "cic:/CoRN/algebra/CSums/Sum_first.con". + +inline "cic:/CoRN/algebra/CSums/Sum_last.con". + +(* UNEXPORTED +Hint Resolve Sum_last: algebra. +*) + +inline "cic:/CoRN/algebra/CSums/Sum_last'.con". + +(*#* +We add some extensionality results which will be quite useful +when working with integration. +*) + +inline "cic:/CoRN/algebra/CSums/Sum0_strext.con". + +inline "cic:/CoRN/algebra/CSums/Sum_strext.con". + +inline "cic:/CoRN/algebra/CSums/Sumx_strext.con". + +inline "cic:/CoRN/algebra/CSums/Sum0_strext'.con". + +inline "cic:/CoRN/algebra/CSums/Sum_strext'.con". + +inline "cic:/CoRN/algebra/CSums/Sum0_wd.con". + +inline "cic:/CoRN/algebra/CSums/Sum_wd.con". + +inline "cic:/CoRN/algebra/CSums/Sumx_wd.con". + +inline "cic:/CoRN/algebra/CSums/Sum_wd'.con". + +inline "cic:/CoRN/algebra/CSums/Sum2_wd.con". + +inline "cic:/CoRN/algebra/CSums/Sum0_plus_Sum0.con". + +(* UNEXPORTED +Hint Resolve Sum0_plus_Sum0: algebra. +*) + +inline "cic:/CoRN/algebra/CSums/Sum_plus_Sum.con". + +inline "cic:/CoRN/algebra/CSums/Sumx_plus_Sumx.con". + +inline "cic:/CoRN/algebra/CSums/Sum2_plus_Sum2.con". + +inline "cic:/CoRN/algebra/CSums/inv_Sum0.con". + +(* UNEXPORTED +Hint Resolve inv_Sum0: algebra. +*) + +inline "cic:/CoRN/algebra/CSums/inv_Sum.con". + +(* UNEXPORTED +Hint Resolve inv_Sum: algebra. +*) + +inline "cic:/CoRN/algebra/CSums/inv_Sumx.con". + +inline "cic:/CoRN/algebra/CSums/inv_Sum2.con". + +inline "cic:/CoRN/algebra/CSums/Sum_minus_Sum.con". + +(* UNEXPORTED +Hint Resolve Sum_minus_Sum: algebra. +*) + +inline "cic:/CoRN/algebra/CSums/Sumx_minus_Sumx.con". + +inline "cic:/CoRN/algebra/CSums/Sum2_minus_Sum2.con". + +inline "cic:/CoRN/algebra/CSums/Sum_apzero.con". + +inline "cic:/CoRN/algebra/CSums/Sum_zero.con". + +inline "cic:/CoRN/algebra/CSums/Sum_term.con". + +inline "cic:/CoRN/algebra/CSums/Sum0_shift.con". + +(* UNEXPORTED +Hint Resolve Sum0_shift: algebra. +*) + +inline "cic:/CoRN/algebra/CSums/Sum_shift.con". + +inline "cic:/CoRN/algebra/CSums/Sum_big_shift.con". + +inline "cic:/CoRN/algebra/CSums/Sumx_Sum0.con". + +(* UNEXPORTED +End Sums +*) + +(* UNEXPORTED +Implicit Arguments Sum [G]. +*) + +(* UNEXPORTED +Implicit Arguments Sum0 [G]. +*) + +(* UNEXPORTED +Implicit Arguments Sumx [G n]. +*) + +(* UNEXPORTED +Implicit Arguments Sum2 [G m n]. +*) + +(*#* +The next results are useful for calculating some special sums, +often referred to as ``Mengolli Sums''. +%\begin{convention}% Let [G] be an abelian group. +%\end{convention}% +*) + +(* UNEXPORTED +Section More_Sums +*) + +alias id "G" = "cic:/CoRN/algebra/CSums/More_Sums/G.var". + +inline "cic:/CoRN/algebra/CSums/Mengolli_Sum.con". + +inline "cic:/CoRN/algebra/CSums/Mengolli_Sum_gen.con". + +inline "cic:/CoRN/algebra/CSums/str_Mengolli_Sum_gen.con". + +inline "cic:/CoRN/algebra/CSums/Sumx_to_Sum.con". + +(* UNEXPORTED +End More_Sums +*) + +(* UNEXPORTED +Hint Resolve Sum_one Sum_Sum Sum_first Sum_last Sum_last' Sum_wd + Sum_plus_Sum: algebra. +*) + +(* UNEXPORTED +Hint Resolve Sum_minus_Sum inv_Sum inv_Sum0: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/CVectorSpace.ma b/matita/contribs/CoRN-Decl/algebra/CVectorSpace.ma new file mode 100644 index 000000000..7c3b81250 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/CVectorSpace.ma @@ -0,0 +1,128 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/CVectorSpace". + +include "CoRN.ma". + +(* $Id: CVectorSpace.v,v 1.4 2004/04/23 10:00:54 lcf Exp $ *) + +(*#* printing ['] %{'}% #'# *) + +include "algebra/CFields.ma". + +(*#* +* Vector Spaces + +Obsolete but maintained. +*) + +(* begin hide *) + +(* UNEXPORTED +Set Implicit Arguments. +*) + +(* UNEXPORTED +Unset Strict Implicit. +*) + +(* end hide *) + +inline "cic:/CoRN/algebra/CVectorSpace/VSpace.ind". + +coercion cic:/matita/CoRN-Decl/algebra/CVectorSpace/vs_vs.con 0 (* compounds *). + +(* begin hide *) + +(* UNEXPORTED +Set Strict Implicit. +*) + +(* UNEXPORTED +Unset Implicit Arguments. +*) + +(* end hide *) + +(* UNEXPORTED +Hint Resolve vs_assoc vs_unit vs_distl vs_distr: algebra. +*) + +(* UNEXPORTED +Implicit Arguments vs_op [F v]. +*) + +(* NOTATION +Infix "[']" := vs_op (at level 30, no associativity). +*) + +(*#* +%\begin{convention}% +Let [F] be a fiels and let [V] be a vector space over [F] +%\end{convention}% +*) + +(* UNEXPORTED +Section VS_basics +*) + +alias id "F" = "cic:/CoRN/algebra/CVectorSpace/VS_basics/F.var". + +alias id "V" = "cic:/CoRN/algebra/CVectorSpace/VS_basics/V.var". + +inline "cic:/CoRN/algebra/CVectorSpace/vs_op_zero.con". + +inline "cic:/CoRN/algebra/CVectorSpace/zero_vs_op.con". + +(* UNEXPORTED +Hint Resolve vs_op_zero zero_vs_op: algebra. +*) + +inline "cic:/CoRN/algebra/CVectorSpace/vs_op_inv_V.con". + +inline "cic:/CoRN/algebra/CVectorSpace/vs_op_inv_S.con". + +(* UNEXPORTED +Hint Resolve vs_op_inv_V vs_op_inv_S: algebra. +*) + +inline "cic:/CoRN/algebra/CVectorSpace/vs_inv_assoc.con". + +(* UNEXPORTED +Hint Resolve vs_inv_assoc: algebra. +*) + +inline "cic:/CoRN/algebra/CVectorSpace/ap_zero_vs_op_l.con". + +inline "cic:/CoRN/algebra/CVectorSpace/ap_zero_vs_op_r.con". + +(* note this is the same proof as mult_resp_ap_zero *) + +inline "cic:/CoRN/algebra/CVectorSpace/vs_op_resp_ap_rht.con". + +inline "cic:/CoRN/algebra/CVectorSpace/vs_op_resp_ap_zero.con". + +inline "cic:/CoRN/algebra/CVectorSpace/vs_op_resp_ap_lft.con". + +(* UNEXPORTED +End VS_basics +*) + +(* UNEXPORTED +Hint Resolve vs_op_zero zero_vs_op: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/Cauchy_COF.ma b/matita/contribs/CoRN-Decl/algebra/Cauchy_COF.ma new file mode 100644 index 000000000..bbf6cda59 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/Cauchy_COF.ma @@ -0,0 +1,244 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/Cauchy_COF". + +include "CoRN.ma". + +(* $Id: Cauchy_COF.v,v 1.8 2004/04/23 10:00:54 lcf Exp $ *) + +include "algebra/COrdCauchy.ma". + +include "tactics/RingReflection.ma". + +(*#* +* The Field of Cauchy Sequences + +In this chapter we will prove that whenever we start from an ordered +field [F], we can define a new ordered field of Cauchy sequences over [F]. + +%\begin{convention}% Let [F] be an ordered field. +%\end{convention}% +*) + +(* UNEXPORTED +Section Structure +*) + +alias id "F" = "cic:/CoRN/algebra/Cauchy_COF/Structure/F.var". + +(*#* +** Setoid Structure + +[R_Set] is the setoid of Cauchy sequences over [F]; given two sequences +[x,y] over [F], we say that [x] is smaller than [y] if from some point +onwards [(y n) [-] (x n)] is greater than some fixed, positive +[e]. Apartness of two sequences means that one of them is smaller +than the other, equality is the negation of the apartness. +*) + +inline "cic:/CoRN/algebra/Cauchy_COF/R_Set.con". + +(* UNEXPORTED +Section CSetoid_Structure +*) + +inline "cic:/CoRN/algebra/Cauchy_COF/R_lt.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_ap.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_eq.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_lt_cotrans.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_ap_cotrans.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_ap_symmetric.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_lt_irreflexive.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_ap_irreflexive.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_ap_eq_tight.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_CSetoid.con". + +(* UNEXPORTED +End CSetoid_Structure +*) + +(* UNEXPORTED +Section Group_Structure +*) + +(*#* +** Group Structure +The group structure is just the expected one; the lemmas which +are specifically proved are just the necessary ones to get the group axioms. +*) + +inline "cic:/CoRN/algebra/Cauchy_COF/R_plus.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_zero.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_plus_lft_ext.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_plus_assoc.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_zero_lft_unit.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_plus_comm.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_inv.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_inv_is_inv.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_inv_ext.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/Rinv.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_CAbGroup.con". + +(* UNEXPORTED +End Group_Structure +*) + +(* UNEXPORTED +Section Ring_Structure +*) + +(*#* ** Ring Structure +Same comments as previously. +*) + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_one.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_one_ap_zero.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult_dist_plus.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult_dist_minus.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_one_rht_unit.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult_comm.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult_ap_zero'.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult_lft_ext.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult_rht_ext.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult_strext.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/Rmult.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult_assoc.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_one_lft_unit.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_CRing.con". + +(* UNEXPORTED +End Ring_Structure +*) + +(* UNEXPORTED +Section Field_Structure +*) + +(*#* ** Field Structure +For the field structure, it is technically easier to first prove +that our ring is actually an integral domain. The rest then follows +quite straightforwardly. +*) + +inline "cic:/CoRN/algebra/Cauchy_COF/R_integral_domain.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_recip.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_recip_inverse.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_recip_strext.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_recip_inverse'.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_CField.con". + +(* UNEXPORTED +End Field_Structure +*) + +(* UNEXPORTED +Section Order +*) + +(*#* ** Order Structure +Finally, we extend the field structure with the ordering we +defined at the beginning. +*) + +inline "cic:/CoRN/algebra/Cauchy_COF/R_lt_strext.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/Rlt.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/Rlt_transitive.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/Rlt_strict.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_plus_resp_lt.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_mult_resp_lt.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_COrdField.con". + +(* UNEXPORTED +End Order +*) + +(*#* +** Other Results +Auxiliary characterizations of the main relations on [R_Set]. +*) + +(* UNEXPORTED +Section Auxiliary +*) + +inline "cic:/CoRN/algebra/Cauchy_COF/Rlt_alt_1.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/Rlt_alt_2.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_ap_alt_1.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/Eq_alt_1.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/R_ap_alt_2.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/Eq_alt_2_1.con". + +inline "cic:/CoRN/algebra/Cauchy_COF/Eq_alt_2_2.con". + +(* UNEXPORTED +End Auxiliary +*) + +(* UNEXPORTED +End Structure +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/Expon.ma b/matita/contribs/CoRN-Decl/algebra/Expon.ma new file mode 100644 index 000000000..29bc341c7 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/Expon.ma @@ -0,0 +1,288 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/Expon". + +include "CoRN.ma". + +(* $Id: Expon.v,v 1.5 2004/04/23 10:00:54 lcf Exp $ *) + +(*#* printing [^^] %\ensuremath{\hat{\ }}% #^# *) + +include "algebra/COrdCauchy.ma". + +include "tactics/Transparent_algebra.ma". + +(*#* *Exponentiation +**More properties about [nexp] +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +(* UNEXPORTED +Section More_Nexp +*) + +alias id "R" = "cic:/CoRN/algebra/Expon/More_Nexp/R.var". + +inline "cic:/CoRN/algebra/Expon/nexp_resp_ap_zero.con". + +(* UNEXPORTED +Hint Resolve nexp_resp_ap_zero: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/nexp_distr_div.con". + +inline "cic:/CoRN/algebra/Expon/nexp_distr_div'.con". + +inline "cic:/CoRN/algebra/Expon/small_nexp_resp_lt.con". + +inline "cic:/CoRN/algebra/Expon/great_nexp_resp_lt.con". + +inline "cic:/CoRN/algebra/Expon/small_nexp_resp_le.con". + +inline "cic:/CoRN/algebra/Expon/great_nexp_resp_le.con". + +inline "cic:/CoRN/algebra/Expon/nexp_resp_leEq.con". + +inline "cic:/CoRN/algebra/Expon/nexp_resp_leEq_one.con". + +inline "cic:/CoRN/algebra/Expon/nexp_resp_leEq_neg_even.con". + +inline "cic:/CoRN/algebra/Expon/nexp_resp_leEq_neg_odd.con". + +inline "cic:/CoRN/algebra/Expon/nexp_distr_recip.con". + +(* UNEXPORTED +Hint Resolve nexp_distr_recip: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/nexp_even_nonneg.con". + +inline "cic:/CoRN/algebra/Expon/nexp_resp_le'.con". + +inline "cic:/CoRN/algebra/Expon/nexp_resp_le.con". + +inline "cic:/CoRN/algebra/Expon/bin_less_un.con". + +(* UNEXPORTED +End More_Nexp +*) + +(* UNEXPORTED +Hint Resolve nexp_distr_div nexp_distr_recip: algebra. +*) + +(* UNEXPORTED +Implicit Arguments nexp_resp_ap_zero [R x]. +*) + +(*#* **Definition of [zexp]: integer exponentiation +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +(* UNEXPORTED +Section Zexp_def +*) + +alias id "R" = "cic:/CoRN/algebra/Expon/Zexp_def/R.var". + +(*#* +It would be nicer to define [zexp] using [caseZdiff], but we already +have most properties now. +*) + +inline "cic:/CoRN/algebra/Expon/zexp.con". + +(* UNEXPORTED +End Zexp_def +*) + +(* UNEXPORTED +Implicit Arguments zexp [R]. +*) + +(* NOTATION +Notation "( x [//] Hx ) [^^] n" := (zexp x Hx n) (at level 0). +*) + +(*#* **Properties of [zexp] +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +(* UNEXPORTED +Section Zexp_properties +*) + +alias id "R" = "cic:/CoRN/algebra/Expon/Zexp_properties/R.var". + +inline "cic:/CoRN/algebra/Expon/zexp_zero.con". + +(* UNEXPORTED +Hint Resolve zexp_zero: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_nexp.con". + +(* UNEXPORTED +Hint Resolve zexp_nexp: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_inv_nexp.con". + +(* UNEXPORTED +Hint Resolve zexp_inv_nexp: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_inv_nexp'.con". + +(* UNEXPORTED +Hint Resolve zexp_inv_nexp': algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_strext.con". + +inline "cic:/CoRN/algebra/Expon/zexp_wd.con". + +(* UNEXPORTED +Hint Resolve zexp_wd: algebra_c. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_plus1.con". + +(* UNEXPORTED +Hint Resolve zexp_plus1: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_resp_ap_zero.con". + +(* UNEXPORTED +Hint Resolve zexp_resp_ap_zero: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_inv.con". + +(* UNEXPORTED +Hint Resolve zexp_inv: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_inv1.con". + +(* UNEXPORTED +Hint Resolve zexp_inv1: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_plus.con". + +(* UNEXPORTED +Hint Resolve zexp_plus: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_minus.con". + +(* UNEXPORTED +Hint Resolve zexp_minus: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/one_zexp.con". + +(* UNEXPORTED +Hint Resolve one_zexp: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/mult_zexp.con". + +(* UNEXPORTED +Hint Resolve mult_zexp: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_mult.con". + +(* UNEXPORTED +Hint Resolve zexp_mult: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_two.con". + +(* UNEXPORTED +Hint Resolve zexp_two: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/inv_zexp_even.con". + +(* UNEXPORTED +Hint Resolve inv_zexp_even: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/inv_zexp_two.con". + +(* UNEXPORTED +Hint Resolve inv_zexp_two: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/inv_zexp_odd.con". + +inline "cic:/CoRN/algebra/Expon/zexp_one.con". + +(* UNEXPORTED +Hint Resolve zexp_one: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_funny.con". + +(* UNEXPORTED +Hint Resolve zexp_funny: algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_funny'.con". + +(* UNEXPORTED +Hint Resolve zexp_funny': algebra. +*) + +inline "cic:/CoRN/algebra/Expon/zexp_pos.con". + +(* UNEXPORTED +End Zexp_properties +*) + +(* UNEXPORTED +Hint Resolve nexp_resp_ap_zero zexp_zero zexp_nexp zexp_inv_nexp + zexp_inv_nexp' zexp_plus1 zexp_resp_ap_zero zexp_inv zexp_inv1 zexp_plus + zexp_minus one_zexp mult_zexp zexp_mult zexp_two inv_zexp_even inv_zexp_two + zexp_one zexp_funny zexp_funny': algebra. +*) + +(* UNEXPORTED +Hint Resolve zexp_wd: algebra_c. +*) + +(* UNEXPORTED +Section Root_Unique +*) + +alias id "R" = "cic:/CoRN/algebra/Expon/Root_Unique/R.var". + +inline "cic:/CoRN/algebra/Expon/root_unique.con". + +inline "cic:/CoRN/algebra/Expon/root_one.con". + +(* UNEXPORTED +End Root_Unique +*) + diff --git a/matita/contribs/CoRN-Decl/algebra/ListType.ma b/matita/contribs/CoRN-Decl/algebra/ListType.ma new file mode 100644 index 000000000..f97dfd9d0 --- /dev/null +++ b/matita/contribs/CoRN-Decl/algebra/ListType.ma @@ -0,0 +1,245 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/algebra/ListType". + +include "CoRN.ma". + +(* begin hide *) + +(*#**********************************************************************) + +(* v * The Coq Proof Assistant / The Coq Development Team *) + +(* C# *) + +(*#* printing II %\ensuremath{\imath}% #i# *) + +(*#* printing [+I*] %\ensuremath{+\imath}% *) + +(*#* printing AbsCC %\ensuremath{|\cdot|_{\mathbb C}}% *) + +(*#* printing CCX %\ensuremath{\mathbb C[X]}% #C[X]# *) + +include "reals/NRootIR.ma". + +(*#* * Complex Numbers +** Algebraic structure +*) + +(* UNEXPORTED +Section Complex_Numbers +*) + +inline "cic:/CoRN/complex/CComplex/CC_set.ind". + +inline "cic:/CoRN/complex/CComplex/cc_ap.con". + +inline "cic:/CoRN/complex/CComplex/cc_eq.con". + +inline "cic:/CoRN/complex/CComplex/cc_is_CSetoid.con". + +inline "cic:/CoRN/complex/CComplex/cc_csetoid.con". + +inline "cic:/CoRN/complex/CComplex/cc_plus.con". + +inline "cic:/CoRN/complex/CComplex/cc_mult.con". + +inline "cic:/CoRN/complex/CComplex/cc_zero.con". + +inline "cic:/CoRN/complex/CComplex/cc_one.con". + +inline "cic:/CoRN/complex/CComplex/cc_i.con". + +inline "cic:/CoRN/complex/CComplex/cc_inv.con". + +(* not needed anymore +Lemma cc_plus_op_proof : (bin_op_wd cc_csetoid cc_plus). +Unfold bin_op_wd. Unfold bin_fun_wd. +Intros x1 x2 y1 y2. Elim x1. Elim x2. Elim y1. Elim y2. +Simpl. Unfold cc_eq. Simpl. Intros. +Elim H. Clear H. Intros. Elim H0. Clear H0. Intros. +Split; Algebra. +Qed. + +Lemma cc_mult_op_proof : (bin_op_wd cc_csetoid cc_mult). +Unfold bin_op_wd. Unfold bin_fun_wd. +Intros x1 x2 y1 y2. Elim x1. Elim x2. Elim y1. Elim y2. +Simpl. Unfold cc_eq. Simpl. Intros. +Elim H. Clear H. Intros. Elim H0. Clear H0. Intros. +Split; Algebra. +Qed. + +Lemma cc_inv_op_proof : (un_op_wd cc_csetoid cc_inv). +Unfold un_op_wd. Unfold fun_wd. +Intros x y. Elim x. Elim y. +Simpl. Unfold cc_eq. Simpl. Intros. +Elim H. Clear H. Intros. +Split; Algebra. +Qed. +*) + +inline "cic:/CoRN/complex/CComplex/cc_inv_strext.con". + +inline "cic:/CoRN/complex/CComplex/cc_plus_strext.con". + +inline "cic:/CoRN/complex/CComplex/cc_mult_strext.con". + +inline "cic:/CoRN/complex/CComplex/cc_inv_op.con". + +inline "cic:/CoRN/complex/CComplex/cc_plus_op.con". + +inline "cic:/CoRN/complex/CComplex/cc_mult_op.con". + +inline "cic:/CoRN/complex/CComplex/cc_csg_associative.con". + +inline "cic:/CoRN/complex/CComplex/cc_cr_mult_associative.con". + +inline "cic:/CoRN/complex/CComplex/cc_csemi_grp.con". + +inline "cic:/CoRN/complex/CComplex/cc_cm_proof.con". + +inline "cic:/CoRN/complex/CComplex/cc_cmonoid.con". + +inline "cic:/CoRN/complex/CComplex/cc_cg_proof.con". + +inline "cic:/CoRN/complex/CComplex/cc_cr_dist.con". + +inline "cic:/CoRN/complex/CComplex/cc_cr_non_triv.con". + +inline "cic:/CoRN/complex/CComplex/cc_cgroup.con". + +inline "cic:/CoRN/complex/CComplex/cc_cabgroup.con". + +inline "cic:/CoRN/complex/CComplex/cc_cr_mult_mon.con". + +inline "cic:/CoRN/complex/CComplex/cc_mult_commutes.con". + +inline "cic:/CoRN/complex/CComplex/cc_isCRing.con". + +inline "cic:/CoRN/complex/CComplex/cc_cring.con". + +inline "cic:/CoRN/complex/CComplex/cc_ap_zero.con". + +inline "cic:/CoRN/complex/CComplex/cc_inv_aid.con". + +(*#* +If [x [~=] Zero] or [y [~=] Zero], then [x [/] x[^]2 [+] y[^]2 [~=] Zero] or +[[--]y[/]x[^]2[+]y[^]2 [~=] Zero]. +*) + +inline "cic:/CoRN/complex/CComplex/cc_inv_aid2.con". + +(* +REMARK KEPT FOR SENTIMENTAL REASONS... + +This definition seems clever. Even though we *cannot* construct an +element of (NonZeros cc_cring) (a Set) by deciding which part of the +input (Re or Im) is NonZero (a Prop), we manage to construct the +actual function. +*) + +inline "cic:/CoRN/complex/CComplex/cc_recip.con". + +inline "cic:/CoRN/complex/CComplex/cc_cfield_proof.con". + +inline "cic:/CoRN/complex/CComplex/cc_Recip_proof.con". + +(* UNEXPORTED +Opaque cc_recip. +*) + +(* UNEXPORTED +Opaque cc_inv. +*) + +inline "cic:/CoRN/complex/CComplex/cc_cfield.con". + +inline "cic:/CoRN/complex/CComplex/CC.con". + +(*#* +Maps from reals to complex and vice-versa are defined, as well as conjugate, +absolute value and the imaginary unit [I] *) + +inline "cic:/CoRN/complex/CComplex/cc_set_CC.con". + +inline "cic:/CoRN/complex/CComplex/cc_IR.con". + +inline "cic:/CoRN/complex/CComplex/CC_conj.con". + +(* old def +Definition CC_conj' : CC->CC := [z:CC_set] (CC_set_rec [_:CC_set]CC_set [Re0,Im0:IR] (Build_CC_set Re0 [--]Im0) z). +*) + +inline "cic:/CoRN/complex/CComplex/AbsCC.con". + +inline "cic:/CoRN/complex/CComplex/TwoCC_ap_zero.con". + +(* UNEXPORTED +End Complex_Numbers +*) + +(* begin hide *) + +(* NOTATION +Notation CCX := (cpoly_cring CC). +*) + +(* end hide *) + +inline "cic:/CoRN/complex/CComplex/II.con". + +(* NOTATION +Infix "[+I*]" := cc_set_CC (at level 48, no associativity). +*) + +(*#* ** Properties of [II] *) + +(* UNEXPORTED +Section I_properties +*) + +inline "cic:/CoRN/complex/CComplex/I_square.con". + +(* UNEXPORTED +Hint Resolve I_square: algebra. +*) + +inline "cic:/CoRN/complex/CComplex/I_square'.con". + +inline "cic:/CoRN/complex/CComplex/I_recip_lft.con". + +inline "cic:/CoRN/complex/CComplex/I_recip_rht.con". + +inline "cic:/CoRN/complex/CComplex/mult_I.con". + +inline "cic:/CoRN/complex/CComplex/I_wd.con". + +(*#* ** Properties of [Re] and [Im] *) + +inline "cic:/CoRN/complex/CComplex/calculate_norm.con". + +inline "cic:/CoRN/complex/CComplex/calculate_Re.con". + +inline "cic:/CoRN/complex/CComplex/calculate_Im.con". + +inline "cic:/CoRN/complex/CComplex/Re_wd.con". + +inline "cic:/CoRN/complex/CComplex/Im_wd.con". + +inline "cic:/CoRN/complex/CComplex/Re_resp_plus.con". + +inline "cic:/CoRN/complex/CComplex/Re_resp_inv.con". + +inline "cic:/CoRN/complex/CComplex/Im_resp_plus.con". + +inline "cic:/CoRN/complex/CComplex/Im_resp_inv.con". + +inline "cic:/CoRN/complex/CComplex/cc_calculate_square.con". + +(* UNEXPORTED +End I_properties +*) + +(* UNEXPORTED +Hint Resolve I_square I_square' I_recip_lft I_recip_rht mult_I calculate_norm + cc_calculate_square: algebra. +*) + +(* UNEXPORTED +Hint Resolve I_wd Re_wd Im_wd: algebra_c. +*) + +(*#* ** Properties of conjugation *) + +(* UNEXPORTED +Section Conj_properties +*) + +inline "cic:/CoRN/complex/CComplex/CC_conj_plus.con". + +inline "cic:/CoRN/complex/CComplex/CC_conj_mult.con". + +(* UNEXPORTED +Hint Resolve CC_conj_mult: algebra. +*) + +inline "cic:/CoRN/complex/CComplex/CC_conj_strext.con". + +inline "cic:/CoRN/complex/CComplex/CC_conj_conj.con". + +inline "cic:/CoRN/complex/CComplex/CC_conj_zero.con". + +inline "cic:/CoRN/complex/CComplex/CC_conj_one.con". + +(* UNEXPORTED +Hint Resolve CC_conj_one: algebra. +*) + +inline "cic:/CoRN/complex/CComplex/CC_conj_nexp.con". + +(* UNEXPORTED +End Conj_properties +*) + +(* UNEXPORTED +Hint Resolve CC_conj_plus CC_conj_mult CC_conj_nexp CC_conj_conj + CC_conj_zero: algebra. +*) + +(*#* ** Properties of the real axis *) + +(* UNEXPORTED +Section cc_IR_properties +*) + +inline "cic:/CoRN/complex/CComplex/Re_cc_IR.con". + +inline "cic:/CoRN/complex/CComplex/Im_cc_IR.con". + +inline "cic:/CoRN/complex/CComplex/cc_IR_wd.con". + +(* UNEXPORTED +Hint Resolve cc_IR_wd: algebra_c. +*) + +inline "cic:/CoRN/complex/CComplex/cc_IR_resp_ap.con". + +inline "cic:/CoRN/complex/CComplex/cc_IR_mult.con". + +(* UNEXPORTED +Hint Resolve cc_IR_mult: algebra. +*) + +inline "cic:/CoRN/complex/CComplex/cc_IR_mult_lft.con". + +inline "cic:/CoRN/complex/CComplex/cc_IR_mult_rht.con". + +inline "cic:/CoRN/complex/CComplex/cc_IR_plus.con". + +(* UNEXPORTED +Hint Resolve cc_IR_plus: algebra. +*) + +inline "cic:/CoRN/complex/CComplex/cc_IR_minus.con". + +inline "cic:/CoRN/complex/CComplex/cc_IR_zero.con". + +(* UNEXPORTED +Hint Resolve cc_IR_zero: algebra. +*) + +inline "cic:/CoRN/complex/CComplex/cc_IR_one.con". + +(* UNEXPORTED +Hint Resolve cc_IR_one: algebra. +*) + +inline "cic:/CoRN/complex/CComplex/cc_IR_nring.con". + +inline "cic:/CoRN/complex/CComplex/cc_IR_nexp.con". + +(* UNEXPORTED +End cc_IR_properties +*) + +(* UNEXPORTED +Hint Resolve Re_cc_IR Im_cc_IR: algebra. +*) + +(* UNEXPORTED +Hint Resolve cc_IR_wd: algebra_c. +*) + +(* UNEXPORTED +Hint Resolve cc_IR_mult cc_IR_nexp cc_IR_mult_lft cc_IR_mult_rht cc_IR_plus + cc_IR_minus: algebra. +*) + +(* UNEXPORTED +Hint Resolve cc_IR_nring cc_IR_zero: algebra. +*) + +(*#* ** [CC] has characteristic zero *) + +include "tactics/Transparent_algebra.ma". + +inline "cic:/CoRN/complex/CComplex/char0_CC.con". + +include "tactics/Opaque_algebra.ma". + +inline "cic:/CoRN/complex/CComplex/poly_apzero_CC.con". + +inline "cic:/CoRN/complex/CComplex/poly_CC_extensional.con". + diff --git a/matita/contribs/CoRN-Decl/complex/Complex_Exponential.ma b/matita/contribs/CoRN-Decl/complex/Complex_Exponential.ma new file mode 100644 index 000000000..228a19f5a --- /dev/null +++ b/matita/contribs/CoRN-Decl/complex/Complex_Exponential.ma @@ -0,0 +1,104 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/complex/Complex_Exponential". + +include "CoRN.ma". + +(* $Id: Complex_Exponential.v,v 1.4 2004/04/23 10:00:55 lcf Exp $ *) + +(*#* printing ExpCC %\ensuremath{\exp_{\mathbb C}}% *) + +include "complex/AbsCC.ma". + +include "transc/Exponential.ma". + +include "transc/Pi.ma". + +(*#* ** The Complex Exponential *) + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC.con". + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_wd.con". + +(* begin hide *) + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_equation_aid_1.con". + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_equation_aid_2.con". + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_equation_aid_3.con". + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_equation_aid_4.con". + +(* end hide *) + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_plus.con". + +(* UNEXPORTED +Hint Resolve ExpCC_plus: algebra. +*) + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_Zero.con". + +(* UNEXPORTED +Hint Resolve ExpCC_Zero: algebra. +*) + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_inv_aid.con". + +(* UNEXPORTED +Hint Resolve ExpCC_inv_aid: algebra. +*) + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_ap_zero.con". + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_inv.con". + +(* UNEXPORTED +Hint Resolve ExpCC_inv: algebra. +*) + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_pow.con". + +(* UNEXPORTED +Hint Resolve ExpCC_pow: algebra. +*) + +inline "cic:/CoRN/complex/Complex_Exponential/AbsCC_ExpCC.con". + +(* UNEXPORTED +Hint Resolve AbsCC_ExpCC: algebra. +*) + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_Periodic.con". + +(* UNEXPORTED +Hint Resolve ExpCC_Periodic: algebra. +*) + +inline "cic:/CoRN/complex/Complex_Exponential/ExpCC_Exp.con". + +(* UNEXPORTED +Hint Resolve ExpCC_Exp: algebra. +*) + +(* UNEXPORTED +Opaque Sin Cos Exp. +*) + +inline "cic:/CoRN/complex/Complex_Exponential/Euler.con". + diff --git a/matita/contribs/CoRN-Decl/complex/NRootCC.ma b/matita/contribs/CoRN-Decl/complex/NRootCC.ma new file mode 100644 index 000000000..988c7f763 --- /dev/null +++ b/matita/contribs/CoRN-Decl/complex/NRootCC.ma @@ -0,0 +1,576 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/complex/NRootCC". + +include "CoRN.ma". + +(* $Id: NRootCC.v,v 1.9 2004/04/23 10:00:55 lcf Exp $ *) + +(*#* printing sqrt_Half %\ensuremath{\sqrt{\frac12}}% *) + +(*#* printing sqrt_I %\ensuremath{\sqrt{\imath}}% *) + +(*#* printing nroot_I %\ensuremath{\sqrt[n]{\imath}}% *) + +(*#* printing nroot_minus_I %\ensuremath{\sqrt[n]{-\imath}}% *) + +include "complex/CComplex.ma". + +(*#* * Roots of Complex Numbers + +Properties of non-zero complex numbers +*) + +(* UNEXPORTED +Section CC_ap_zero +*) + +inline "cic:/CoRN/complex/NRootCC/cc_ap_zero.con". + +inline "cic:/CoRN/complex/NRootCC/C_cc_ap_zero.con". + +(* UNEXPORTED +End CC_ap_zero +*) + +(*#* Weird lemma. *) + +(* UNEXPORTED +Section Imag_to_Real +*) + +inline "cic:/CoRN/complex/NRootCC/imag_to_real.con". + +(* UNEXPORTED +End Imag_to_Real +*) + +(*#* ** Roots of the imaginary unit *) + +(* UNEXPORTED +Section NRootI +*) + +inline "cic:/CoRN/complex/NRootCC/sqrt_Half.con". + +inline "cic:/CoRN/complex/NRootCC/sqrt_I.con". + +inline "cic:/CoRN/complex/NRootCC/sqrt_I_nexp.con". + +inline "cic:/CoRN/complex/NRootCC/nroot_I_nexp_aux.con". + +inline "cic:/CoRN/complex/NRootCC/nroot_I.con". + +inline "cic:/CoRN/complex/NRootCC/nroot_I_nexp.con". + +(* UNEXPORTED +Hint Resolve nroot_I_nexp: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nroot_minus_I.con". + +inline "cic:/CoRN/complex/NRootCC/nroot_minus_I_nexp.con". + +(* UNEXPORTED +End NRootI +*) + +(*#* ** Roots of complex numbers *) + +(* UNEXPORTED +Section NRootCC_1 +*) + +(*#* We define the nth root of a complex number with a non zero imaginary part. +*) + +(* UNEXPORTED +Section NRootCC_1_ap_real +*) + +(*#* +%\begin{convention}% Let [a,b : IR] and [b_ : (b [#] Zero)]. +Define [c2 := a[^]2[+]b[^]2], [c := sqrt c2], [a'2 := (c[+]a) [*]Half], +[a' := sqrt a'2], [b'2 := (c[-]a) [*]Half] and [b' := sqrt b'2]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_real/a.var". + +alias id "b" = "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_real/b.var". + +alias id "b_" = "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_real/b_.var". + +(* begin hide *) + +inline "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_real/c2.con" "NRootCC_1__NRootCC_1_ap_real__". + +(* end hide *) + +inline "cic:/CoRN/complex/NRootCC/nrCC1_c2pos.con". + +(* begin hide *) + +inline "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_real/c.con" "NRootCC_1__NRootCC_1_ap_real__". + +inline "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_real/a'2.con" "NRootCC_1__NRootCC_1_ap_real__". + +(* end hide *) + +inline "cic:/CoRN/complex/NRootCC/nrCC1_a'2pos.con". + +(* begin hide *) + +inline "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_real/a'.con" "NRootCC_1__NRootCC_1_ap_real__". + +inline "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_real/b'2.con" "NRootCC_1__NRootCC_1_ap_real__". + +(* end hide *) + +inline "cic:/CoRN/complex/NRootCC/nrCC1_b'2pos.con". + +(* begin hide *) + +inline "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_real/b'.con" "NRootCC_1__NRootCC_1_ap_real__". + +(* end hide *) + +inline "cic:/CoRN/complex/NRootCC/nrCC1_a3.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC1_a4.con". + +(* UNEXPORTED +Hint Resolve nrCC1_a4: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrCC1_a5.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC1_a6.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC1_a6'.con". + +(* UNEXPORTED +Hint Resolve nrCC1_a5: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrCC1_a7_upper.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC1_a7_lower.con". + +(* UNEXPORTED +Hint Resolve nrCC1_a3 nrCC1_a7_upper nrCC1_a7_lower: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrootCC_1_upper.con". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_1_lower.con". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_1_ap_real.con". + +(* UNEXPORTED +End NRootCC_1_ap_real +*) + +(*#* We now define the nth root of a complex number with a non zero real part. +*) + +(* UNEXPORTED +Section NRootCC_1_ap_imag +*) + +(*#* +%\begin{convention}% Let [a,b : IR] and [a_ : (a [#] Zero)] and define +[c' := (a[+I*]b) [*][--]II := a'[+I*]b']. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_imag/a.var". + +alias id "b" = "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_imag/b.var". + +alias id "a_" = "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_imag/a_.var". + +(* begin hide *) + +inline "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_imag/c'.con" "NRootCC_1__NRootCC_1_ap_imag__". + +inline "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_imag/a'.con" "NRootCC_1__NRootCC_1_ap_imag__". + +inline "cic:/CoRN/complex/NRootCC/NRootCC_1/NRootCC_1_ap_imag/b'.con" "NRootCC_1__NRootCC_1_ap_imag__". + +(* end hide *) + +(* UNEXPORTED +Hint Resolve sqrt_I_nexp: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrootCC_1_ap_imag.con". + +(* UNEXPORTED +End NRootCC_1_ap_imag +*) + +(*#* We now define the roots of arbitrary non zero complex numbers. *) + +inline "cic:/CoRN/complex/NRootCC/nrootCC_1.con". + +(* UNEXPORTED +End NRootCC_1 +*) + +(* UNEXPORTED +Section NRootCC_2 +*) + +(*#* +%\begin{convention}% Let [n : nat] and [c,z : CC] and [c_:(c [#] Zero)]. +%\end{convention}% +*) + +alias id "n" = "cic:/CoRN/complex/NRootCC/NRootCC_2/n.var". + +alias id "c" = "cic:/CoRN/complex/NRootCC/NRootCC_2/c.var". + +alias id "z" = "cic:/CoRN/complex/NRootCC/NRootCC_2/z.var". + +alias id "c_" = "cic:/CoRN/complex/NRootCC/NRootCC_2/c_.var". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_2'.con". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_2.con". + +(* UNEXPORTED +End NRootCC_2 +*) + +(* UNEXPORTED +Section NRootCC_3 +*) + +inline "cic:/CoRN/complex/NRootCC/Im_poly.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC3_a1.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC3_a2.con". + +(*#* +%\begin{convention}% Let [a,b : IR], [b_ : (b [#] Zero)] and [n : nat]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/complex/NRootCC/NRootCC_3/a.var". + +alias id "b" = "cic:/CoRN/complex/NRootCC/NRootCC_3/b.var". + +alias id "b_" = "cic:/CoRN/complex/NRootCC/NRootCC_3/b_.var". + +alias id "n" = "cic:/CoRN/complex/NRootCC/NRootCC_3/n.var". + +inline "cic:/CoRN/complex/NRootCC/nrCC3_poly''.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC3_a3.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC3_a4.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC3_a5.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC3_a6.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC3_poly'.con". + +(* UNEXPORTED +Hint Resolve nrCC3_a3: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrCC3_a7.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC3_a8.con". + +(* UNEXPORTED +Hint Resolve nth_coeff_p_mult_c_: algebra. +*) + +(* UNEXPORTED +Hint Resolve nrCC3_a6: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrCC3_a9.con". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_3_poly.con". + +(* UNEXPORTED +Hint Resolve nrCC3_a1 nrCC3_a7: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrootCC_3_.con". + +(* UNEXPORTED +Hint Resolve nrootCC_3_: algebra. +*) + +(* UNEXPORTED +Hint Resolve calculate_Im: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrootCC_3.con". + +(* UNEXPORTED +Hint Resolve nrCC3_a2: algebra. +*) + +(* UNEXPORTED +Hint Resolve nrCC3_a9: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrootCC_3_degree.con". + +(* UNEXPORTED +End NRootCC_3 +*) + +(* UNEXPORTED +Section NRootCC_3' +*) + +(*#* +%\begin{convention}% Let [c:IR], [n:nat] and [n_:(lt (0) n)]. +%\end{convention}% +*) + +alias id "c" = "cic:/CoRN/complex/NRootCC/NRootCC_3'/c.var". + +alias id "n" = "cic:/CoRN/complex/NRootCC/NRootCC_3'/n.var". + +alias id "n_" = "cic:/CoRN/complex/NRootCC/NRootCC_3'/n_.var". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_3'_poly.con". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_3'.con". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_3'_degree.con". + +(* UNEXPORTED +End NRootCC_3' +*) + +(* UNEXPORTED +Section NRootCC_4 +*) + +(* UNEXPORTED +Section NRootCC_4_ap_real +*) + +(*#* +%\begin{convention}% Let [a,b : IR], [b_ : (b [#] Zero)], [n : nat] and +[n_:(odd n)]; define [c := a[+I*]b]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/a.var". + +alias id "b" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/b.var". + +alias id "b_" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/b_.var". + +alias id "n" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/n.var". + +alias id "n_" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/n_.var". + +(* begin hide *) + +inline "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/c.con" "NRootCC_4__NRootCC_4_ap_real__". + +(* end hide *) + +(* UNEXPORTED +Section NRootCC_4_solutions +*) + +(* UNEXPORTED +Hint Resolve nrootCC_3: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a1.con". + +(*#* +%\begin{convention}% Let [r2',c2 : IR] and [r2'_ : (r2' [#] Zero)]. +%\end{convention}% +*) + +alias id "r2'" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_solutions/r2'.var". + +alias id "c2" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_solutions/c2.var". + +alias id "r2'_" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_solutions/r2'_.var". + +(* UNEXPORTED +Hint Resolve nrootCC_3': algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a1'.con". + +(* UNEXPORTED +End NRootCC_4_solutions +*) + +(* UNEXPORTED +Section NRootCC_4_equations +*) + +(*#* +%\begin{convention}% Let [r,y2 : IR] be such that +[(r[+I*]One) [^]n[*] (CC_conj c) [-] (r[+I*][--]One) [^]n[*]c [=] Zero] +and [(y2[*] (r[^] (2) [+]One)) [^]n [=] a[^] (2) [+]b[^] (2)]. +%\end{convention}% +*) + +alias id "r" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_equations/r.var". + +alias id "r_property" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_equations/r_property.var". + +alias id "y2" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_equations/y2.var". + +alias id "y2_property" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_equations/y2_property.var". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a2.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a3.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a4.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_y.con". + +inline "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_equations/y.con" "NRootCC_4__NRootCC_4_ap_real__NRootCC_4_equations__". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_x.con". + +inline "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_equations/x.con" "NRootCC_4__NRootCC_4_ap_real__NRootCC_4_equations__". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a5.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a6.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_z.con". + +inline "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_real/NRootCC_4_equations/z.con" "NRootCC_4__NRootCC_4_ap_real__NRootCC_4_equations__". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a7.con". + +(* UNEXPORTED +Hint Resolve nrCC4_a6: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a8.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a9.con". + +(* UNEXPORTED +End NRootCC_4_equations +*) + +inline "cic:/CoRN/complex/NRootCC/nrCC4_a10.con". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_4_ap_real.con". + +(* UNEXPORTED +End NRootCC_4_ap_real +*) + +(* UNEXPORTED +Section NRootCC_4_ap_imag +*) + +(*#* +%\begin{convention}% Let [a,b : IR] and [n : nat] with [a [#] Zero] +and [(odd n)]; define [c' := (a[+I*]b) [*]II := a'[+I*]b']. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_imag/a.var". + +alias id "b" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_imag/b.var". + +alias id "a_" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_imag/a_.var". + +alias id "n" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_imag/n.var". + +alias id "n_" = "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_imag/n_.var". + +(* begin hide *) + +inline "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_imag/c'.con" "NRootCC_4__NRootCC_4_ap_imag__". + +inline "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_imag/a'.con" "NRootCC_4__NRootCC_4_ap_imag__". + +inline "cic:/CoRN/complex/NRootCC/NRootCC_4/NRootCC_4_ap_imag/b'.con" "NRootCC_4__NRootCC_4_ap_imag__". + +(* end hide *) + +inline "cic:/CoRN/complex/NRootCC/nrootCC_4_ap_real'.con". + +(* UNEXPORTED +Hint Resolve nroot_minus_I_nexp: algebra. +*) + +inline "cic:/CoRN/complex/NRootCC/nrootCC_4_ap_imag.con". + +(* UNEXPORTED +End NRootCC_4_ap_imag +*) + +inline "cic:/CoRN/complex/NRootCC/nrootCC_4.con". + +(* UNEXPORTED +End NRootCC_4 +*) + +(*#* Finally, the general definition of nth root. *) + +(* UNEXPORTED +Section NRootCC_5 +*) + +inline "cic:/CoRN/complex/NRootCC/nrCC_5a2.con". + +inline "cic:/CoRN/complex/NRootCC/nrCC_5a3.con". + +(* UNEXPORTED +Hint Resolve nrCC_5a3: algebra. +*) + +(*#* +%\begin{convention}% Let [c : CC] with [c [#] Zero]. +%\end{convention}% +*) + +alias id "c" = "cic:/CoRN/complex/NRootCC/NRootCC_5/c.var". + +alias id "c_" = "cic:/CoRN/complex/NRootCC/NRootCC_5/c_.var". + +inline "cic:/CoRN/complex/NRootCC/nrCC_5a4.con". + +inline "cic:/CoRN/complex/NRootCC/nrootCC_5.con". + +(* UNEXPORTED +End NRootCC_5 +*) + +(*#* Final definition *) + +inline "cic:/CoRN/complex/NRootCC/CnrootCC.con". + diff --git a/matita/contribs/CoRN-Decl/devel/loeb/IDA/Ch6.ma b/matita/contribs/CoRN-Decl/devel/loeb/IDA/Ch6.ma new file mode 100644 index 000000000..fe7031a98 --- /dev/null +++ b/matita/contribs/CoRN-Decl/devel/loeb/IDA/Ch6.ma @@ -0,0 +1,627 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/devel/loeb/IDA/Ch6". + +include "CoRN.ma". + +include "algebra/CSemiGroups.ma". + +(* Remark blz 65 1 *) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/is_nullary_operation.con". + +include "model/setoids/Zsetoid.ma". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/is_nullary_operation_Z_0.con". + +(* Remark blz 65 2 *) + +include "devel/loeb/per/csetfun.ma". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/n_ary_operation.con". + +include "model/setoids/Nsetoid.ma". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/plus1.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/to_plus1_strext.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/plus2.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/to_plus2_strext.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/plus3.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/on.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/ex_3_ary.con" "__". + +(* blz 65 Example 1 *) + +(* Print Zopp_is_fun.*) + +(* Print Inv_as_un_op. +Geen goed voorbeeld: monoids komen hier al in voor en het is een heel onoverzichtelijk bewijs *) + +(* blz 65 Example 2 *) + +(* Print plus_is_bin_fun.*) + +(* Print mult_as_bin_fun.*) + +(* blz 66 Example 1 *) + +(* Print plus_is_assoc.*) + +(* Print Zplus_is_assoc.*) + +(* Print Zmult_is_assoc.*) + +include "model/setoids/Qsetoid.ma". + +(* Print Qplus_is_assoc.*) + +(* Print Qmult_is_assoc.*) + +(* blz 66 Examples 2 *) + +(* UNEXPORTED +Section p66E2 +*) + +alias id "X" = "cic:/CoRN/devel/loeb/IDA/Ch6/p66E2/X.var". + +alias id "f" = "cic:/CoRN/devel/loeb/IDA/Ch6/p66E2/f.var". + +alias id "g" = "cic:/CoRN/devel/loeb/IDA/Ch6/p66E2/g.var". + +alias id "h" = "cic:/CoRN/devel/loeb/IDA/Ch6/p66E2/h.var". + +(* Check comp_as_bin_op.*) + +(* Check assoc_comp.*) + +(* UNEXPORTED +End p66E2 +*) + +(* blz 66 Example 2eblok 1 *) + +include "model/semigroups/Zsemigroup.ma". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/Zplus_is_CSemiGroup.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/Zmult_is_CSemiGroup.con". + +(* blz 66 Example % 3 *) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/FS_is_CSemiGroup.con". + +(* blz 66 Example % 4 *) + +(* UNEXPORTED +Section p66E2b4 +*) + +alias id "A" = "cic:/CoRN/devel/loeb/IDA/Ch6/p66E2b4/A.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/Astar.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/empty_word.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/app.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/eq_fm.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/ap_fm.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/ap_fm_irreflexive.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/ap_fm_symmetric.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/ap_fm_cotransitive.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/ap_fm_tight.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/free_csetoid_is_CSetoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/free_csetoid_as_csetoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/app_strext.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/app_as_csb_fun.con". + +include "algebra/CSemiGroups.ma". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/eq_fm_reflexive.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/Astar_is_CSemiGroup.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/Astar_as_CSemiGroup.con". + +(* UNEXPORTED +End p66E2b4 +*) + +(* Definition 5 *) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/is_unit.con". + +(* blz 67 Remark 1 *) + +include "model/monoids/Zmonoid.ma". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/is_unit_Z_0.con". + +(* blz 67 Remark 2 *) + +(* UNEXPORTED +Section p67R2 +*) + +alias id "X" = "cic:/CoRN/devel/loeb/IDA/Ch6/p67R2/X.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/is_unit_FS_id.con". + +(* UNEXPORTED +End p67R2 +*) + +(* blz 67 Remark 3 *) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/is_unit_Astar_empty_word.con". + +(* Lemma 6 *) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/unique_unit.con". + +(* blz 67 Example 1 *) + +include "model/monoids/Nmonoid.ma". + +(* Print nat_is_CMonoid.*) + +include "model/monoids/Zmonoid.ma". + +(* Print Z_is_CMonoid.*) + +(* Print Z_mul_is_CMonoid.*) + +(* blz 67 Example 3 *) + +(* Print FS_is_CMonoid.*) + +(* blz 68 Example blok1 1 *) + +(* UNEXPORTED +Section p68E1b1 +*) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1.ind". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_eq.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_ap.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_ap_irreflexive.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_ap_symmetric.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_ap_cotransitive.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_eq_dec.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/is_e1.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/not_M1_eq_e1_u.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_ap_tight.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_is_CSetoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_as_CSetoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_mult.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_CS_mult.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_CS_mult_strext.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_mult_as_bin_fun.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_is_CSemiGroup.con". + +include "algebra/CMonoids.ma". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/e1_is_lft_unit.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/e1_is_rht_unit.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_as_CSemiGroup.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_is_CMonoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_as_CMonoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M2_mult.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M2_CS_mult.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M2_CS_mult_strext.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M2_mult_as_bin_fun.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M2_is_CSemiGroup.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M2_as_CSemiGroup.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/e1_is_lft_unit_M2.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/e1_is_rht_unit_M2.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M2_is_CMonoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M2_as_CMonoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/two_element_CMonoids.con". + +(* UNEXPORTED +End p68E1b1 +*) + +(* blz 68 Example blok2 1 *) + +(* Print Zplus_is_commut.*) + +(* Print Zmult_is_commut. *) + +(* Print Qplus_is_commut1. *) + +(* Print Qmult_is_commut. *) + +(* Definition 9 *) + +include "algebra/CMonoids.ma". + +(* UNEXPORTED +Section D9S +*) + +alias id "M1" = "cic:/CoRN/devel/loeb/IDA/Ch6/D9S/M1.var". + +alias id "M2" = "cic:/CoRN/devel/loeb/IDA/Ch6/D9S/M2.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/dprod.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/dprod_strext.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/dprod_as_csb_fun.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/direct_product_is_CSemiGroup.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/direct_product_as_CSemiGroup.con". + +(* UNEXPORTED +End D9S +*) + +(* UNEXPORTED +Section D9M +*) + +alias id "M1" = "cic:/CoRN/devel/loeb/IDA/Ch6/D9M/M1.var". + +alias id "M2" = "cic:/CoRN/devel/loeb/IDA/Ch6/D9M/M2.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/e1e2_is_rht_unit.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/e1e2_is_lft_unit.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/direct_product_is_CMonoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/direct_product_as_CMonoid.con". + +(* UNEXPORTED +End D9M +*) + +(* blz 69 Example *) + +(* UNEXPORTED +Section p69E1 +*) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/p69E1/PM1M2.con" "p69E1__". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/p69E1/uu.con" "p69E1__". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/p69E1/e1u.con" "p69E1__". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/ex_69.con". + +(* UNEXPORTED +End p69E1 +*) + +(* Theorem 11 *) + +(* UNEXPORTED +Section Th11 +*) + +alias id "M" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th11/M.var". + +alias id "I" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th11/I.var". + +alias id "C" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th11/C.var". + +alias id "Cunit" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th11/Cunit.var". + +alias id "op_pres_C" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th11/op_pres_C.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/K.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/op_pres_K.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/K_is_Monoid.con". + +(* UNEXPORTED +End Th11 +*) + +(* Theorem 12 *) + +(* UNEXPORTED +Section Th12 +*) + +alias id "A" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th12/A.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/nil_is_rht_unit.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/nil_is_lft_unit.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/free_monoid_is_CMonoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/free_monoid_as_CMonoid.con". + +(* UNEXPORTED +End Th12 +*) + +(* blz 70 text *) + +(* UNEXPORTED +Section p70text +*) + +include "devel/loeb/per/lst2fun.ma". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/p70text/A.con" "p70text__". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/ZerolessOne.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/to_word.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/to_word'.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/to_word'_strext.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/to_word_as_CSetoid_fun.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/to_word_bijective.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/pres_plus_to_word.con". + +(* UNEXPORTED +End p70text +*) + +(* Definition 13 *) + +(* UNEXPORTED +Section Th13 +*) + +alias id "M1" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th13/M1.var". + +alias id "M2" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th13/M2.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/morphism.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/isomorphism.con". + +(* UNEXPORTED +End Th13 +*) + +(* blz 71 Example 1 *) + +(* UNEXPORTED +Section p71E1 +*) + +alias id "M" = "cic:/CoRN/devel/loeb/IDA/Ch6/p71E1/M.var". + +alias id "c" = "cic:/CoRN/devel/loeb/IDA/Ch6/p71E1/c.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/power_CMonoid.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/power_CMonoid_CSetoid.con". + +alias id "is_generated_by" = "cic:/CoRN/devel/loeb/IDA/Ch6/p71E1/is_generated_by.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/p71E1/f.con" "p71E1__". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/f_strext.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/f_as_CSetoid_fun.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/surjective_f.con". + +(* UNEXPORTED +End p71E1 +*) + +(* UNEXPORTED +Section p71E1' +*) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/M1_is_generated_by_u.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/not_injective_f.con". + +(* UNEXPORTED +End p71E1' +*) + +(* Print to_word_bijective.*) + +(* UNEXPORTED +Section p71E2 +*) + +alias id "A" = "cic:/CoRN/devel/loeb/IDA/Ch6/p71E2/A.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/p71E2/L.con" "p71E2__". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/L_strext.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/L_as_CSetoid_fun.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/L_is_morphism.con". + +(* UNEXPORTED +End p71E2 +*) + +(* blz 71 Remark 1 *) + +(* UNEXPORTED +Section p71R1 +*) + +alias id "S1" = "cic:/CoRN/devel/loeb/IDA/Ch6/p71R1/S1.var". + +alias id "S2" = "cic:/CoRN/devel/loeb/IDA/Ch6/p71R1/S2.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/morphism_of_CSemiGroups.con". + +(* UNEXPORTED +End p71R1 +*) + +(* UNEXPORTED +Section p71R2 +*) + +alias id "M" = "cic:/CoRN/devel/loeb/IDA/Ch6/p71R2/M.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/automorphism.con". + +(* UNEXPORTED +End p71R2 +*) + +(* Theorem 14 *) + +(* UNEXPORTED +Section Th14 +*) + +alias id "M1" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th14/M1.var". + +alias id "M2" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th14/M2.var". + +alias id "f" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th14/f.var". + +alias id "isof" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th14/isof.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/iso_imp_bij.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/iso_inv.con". + +(* UNEXPORTED +End Th14 +*) + +(* blz 71 Examples 2eblok 1 *) + +(* UNEXPORTED +Section p71E2b1 +*) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/isomorphic.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/not_isomorphic_M1_M2.con". + +(* UNEXPORTED +End p71E2b1 +*) + +(* UNEXPORTED +Section p71E2b2 +*) + +alias id "M1" = "cic:/CoRN/devel/loeb/IDA/Ch6/p71E2b2/M1.var". + +alias id "M2" = "cic:/CoRN/devel/loeb/IDA/Ch6/p71E2b2/M2.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/p71E2b2/f.con" "p71E2b2__". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/f_strext'.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/f_as_CSetoid_fun'.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/isomorphic_PM1M2_PM2M1.con". + +(* UNEXPORTED +End p71E2b2 +*) + +(* UNEXPORTED +Section Th15 +*) + +alias id "M" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th15/M.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/cm_Sum.con". + +alias id "D" = "cic:/CoRN/devel/loeb/IDA/Ch6/Th15/D.var". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/member.con". + +(* UNEXPORTED +Implicit Arguments member [A]. +*) + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/Dbrack.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/Dbrack_unit.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/member_app.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/cm_Sum_app.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/op_pres_Dbrack.con". + +inline "cic:/CoRN/devel/loeb/IDA/Ch6/Dbrack_as_CMonoid.con". + +(* UNEXPORTED +End Th15 +*) + diff --git a/matita/contribs/CoRN-Decl/devel/loeb/per/csetfun.ma b/matita/contribs/CoRN-Decl/devel/loeb/per/csetfun.ma new file mode 100644 index 000000000..88fcfbeb9 --- /dev/null +++ b/matita/contribs/CoRN-Decl/devel/loeb/per/csetfun.ma @@ -0,0 +1,134 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/devel/loeb/per/csetfun". + +include "CoRN.ma". + +include "algebra/CSetoids.ma". + +include "algebra/CSetoidFun.ma". + +inline "cic:/CoRN/devel/loeb/per/csetfun/ap_fun.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/eq_fun.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/irrefl_apfun.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/cotrans_apfun.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/ta_apfun.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/sym_apfun.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/FS_is_CSetoid.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/FS_as_CSetoid.con". + +(* UNEXPORTED +Print associative. +*) + +inline "cic:/CoRN/devel/loeb/per/csetfun/comp.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/comp_as_bin_op.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/assoc_comp.con". + +include "algebra/CSemiGroups.ma". + +inline "cic:/CoRN/devel/loeb/per/csetfun/FS_as_CSemiGroup.con". + +include "algebra/CMonoids.ma". + +inline "cic:/CoRN/devel/loeb/per/csetfun/FS_id.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/id_is_rht_unit.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/id_is_lft_unit.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/FS_is_CMonoid.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/FS_as_CMonoid.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/PS_as_CMonoid.con". + +include "algebra/CGroups.ma". + +inline "cic:/CoRN/devel/loeb/per/csetfun/Inv_is_bij.con". + +(* Lemma Inv_is_bij : + forall (A B : CSetoid) (f : CSetoid_fun A B) (H : bijective f), + bijective (Inv f H). +intros A B f. +case f. +unfold fun_strext in |- *. +intros f0 H5. +unfold bijective in |- *. +intro H. +elim H. +clear H. +unfold injective in |- *. +unfold surjective in |- *. +intros H0 H1. +split. +unfold Inv in |- *. +simpl in |- *. +unfold invfun in |- *. +simpl in |- *. +unfold sigT_rect in |- *. +intros a0 a1 H2. +case H1. +case (H1 a1). +intros x H3 y H4. +simpl in H3. +simpl in H4. +simpl in H0. +simpl in H1. +apply H5. +astepl a0. +astepr a1. +exact H2. + +simpl in |- *. +unfold invfun in |- *. +simpl in |- *. +unfold sigT_rect in |- *. +intros b. +exists (f0 b). +case (H1 (f0 b)). +simpl in |- *. +intros x H2. +simpl in H0. +simpl in H1. +apply not_ap_imp_eq. +red in |- *. +intro H3. +set (H4 := H0 x b H3) in *. +set (H6 := ap_imp_neq B (f0 x) (f0 b) H4) in *. +intuition. +Qed.*) + +inline "cic:/CoRN/devel/loeb/per/csetfun/PS_Inv.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/Inv_as_un_op.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/PS_is_CGroup.con". + +inline "cic:/CoRN/devel/loeb/per/csetfun/PS_as_CGroup.con". + +(* In het algemeen niet Abels! *) + diff --git a/matita/contribs/CoRN-Decl/devel/loeb/per/lst2fun.ma b/matita/contribs/CoRN-Decl/devel/loeb/per/lst2fun.ma new file mode 100644 index 000000000..e41d74f18 --- /dev/null +++ b/matita/contribs/CoRN-Decl/devel/loeb/per/lst2fun.ma @@ -0,0 +1,52 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/devel/loeb/per/lst2fun". + +include "CoRN.ma". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/F'.con". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/F.ind". + +coercion cic:/matita/CoRN-Decl/devel/loeb/per/lst2fun/F_crr.con 0 (* compounds *). + +inline "cic:/CoRN/devel/loeb/per/lst2fun/to_nat.con". + +(* UNEXPORTED +Implicit Arguments to_nat [n]. +*) + +coercion cic:/matita/CoRN-Decl/devel/loeb/per/lst2fun/to_nat.con 0 (* compounds *). + +include "algebra/CSetoids.ma". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/Feq.con". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/Fap.con". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/Fap_irreflexive.con". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/Fap_symmetric.con". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/Fap_cotransitive.con". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/Fap_tight.con". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/less.con". + +inline "cic:/CoRN/devel/loeb/per/lst2fun/CSetoid_of_less.con". + diff --git a/matita/contribs/CoRN-Decl/fta/CC_Props.ma b/matita/contribs/CoRN-Decl/fta/CC_Props.ma new file mode 100644 index 000000000..3dad80b8e --- /dev/null +++ b/matita/contribs/CoRN-Decl/fta/CC_Props.ma @@ -0,0 +1,101 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/fta/CC_Props". + +include "CoRN.ma". + +(* $Id: CC_Props.v,v 1.3 2004/04/23 10:00:56 lcf Exp $ *) + +include "complex/AbsCC.ma". + +(*#* * More properties of complex numbers +** Sequences and limits *) + +(* UNEXPORTED +Hint Resolve AbsIR_sqrt_sqr: algebra. +*) + +inline "cic:/CoRN/fta/CC_Props/absCC_absIR_re.con". + +inline "cic:/CoRN/fta/CC_Props/absCC_absIR_im.con". + +inline "cic:/CoRN/fta/CC_Props/seq_re.con". + +inline "cic:/CoRN/fta/CC_Props/seq_im.con". + +inline "cic:/CoRN/fta/CC_Props/CC_Cauchy_prop.con". + +inline "cic:/CoRN/fta/CC_Props/CC_CauchySeq.ind". + +coercion cic:/matita/CoRN-Decl/fta/CC_Props/CC_seq.con 0 (* compounds *). + +inline "cic:/CoRN/fta/CC_Props/re_is_Cauchy.con". + +inline "cic:/CoRN/fta/CC_Props/im_is_Cauchy.con". + +inline "cic:/CoRN/fta/CC_Props/CC_Cauchy2re.con". + +inline "cic:/CoRN/fta/CC_Props/CC_Cauchy2im.con". + +inline "cic:/CoRN/fta/CC_Props/LimCC.con". + +inline "cic:/CoRN/fta/CC_Props/CC_SeqLimit.con". + +inline "cic:/CoRN/fta/CC_Props/AbsSmall_sqr.con". + +inline "cic:/CoRN/fta/CC_Props/AbsSmall_AbsCC.con". + +inline "cic:/CoRN/fta/CC_Props/LimCC_is_lim.con". + +inline "cic:/CoRN/fta/CC_Props/CC_SeqLimit_uniq.con". + +inline "cic:/CoRN/fta/CC_Props/CC_SeqLimit_unq.con". + +(*#* ** Continuity for [CC] +*) + +(* UNEXPORTED +Section Continuity_for_CC +*) + +(*#* +%\begin{convention}% Let [f : CC->CC]. +%\end{convention}% +*) + +alias id "f" = "cic:/CoRN/fta/CC_Props/Continuity_for_CC/f.var". + +(* (CSetoid_un_op CC). *) + +inline "cic:/CoRN/fta/CC_Props/CCfunLim.con". + +inline "cic:/CoRN/fta/CC_Props/CCcontinAt.con". + +inline "cic:/CoRN/fta/CC_Props/CCcontin.con". + +inline "cic:/CoRN/fta/CC_Props/CCfunLim_SeqLimit.con". + +inline "cic:/CoRN/fta/CC_Props/f_seq.con". + +inline "cic:/CoRN/fta/CC_Props/poly_pres_lim.con". + +(* UNEXPORTED +End Continuity_for_CC +*) + +inline "cic:/CoRN/fta/CC_Props/seq_yields_zero.con". + diff --git a/matita/contribs/CoRN-Decl/fta/CPoly_Contin1.ma b/matita/contribs/CoRN-Decl/fta/CPoly_Contin1.ma new file mode 100644 index 000000000..d4110c62e --- /dev/null +++ b/matita/contribs/CoRN-Decl/fta/CPoly_Contin1.ma @@ -0,0 +1,60 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/fta/CPoly_Contin1". + +include "CoRN.ma". + +(* $Id: CPoly_Contin1.v,v 1.3 2004/04/23 10:00:56 lcf Exp $ *) + +include "fta/CC_Props.ma". + +(*#* * Continuity of complex polynomials +*) + +(* UNEXPORTED +Section Mult_CC_Continuous +*) + +inline "cic:/CoRN/fta/CPoly_Contin1/mult_absCC.con". + +inline "cic:/CoRN/fta/CPoly_Contin1/estimate_absCC.con". + +inline "cic:/CoRN/fta/CPoly_Contin1/mult_CC_contin.con". + +(* UNEXPORTED +End Mult_CC_Continuous +*) + +(* UNEXPORTED +Section CPoly_CC_Continuous +*) + +(*#* +%\begin{convention}% Let [g] be a polynomial over the complex numbers. +%\end{convention}% +*) + +alias id "g" = "cic:/CoRN/fta/CPoly_Contin1/CPoly_CC_Continuous/g.var". + +inline "cic:/CoRN/fta/CPoly_Contin1/cpoly_CC_contin.con". + +inline "cic:/CoRN/fta/CPoly_Contin1/contin_polyCC.con". + +(* UNEXPORTED +End CPoly_CC_Continuous +*) + diff --git a/matita/contribs/CoRN-Decl/fta/CPoly_Rev.ma b/matita/contribs/CoRN-Decl/fta/CPoly_Rev.ma new file mode 100644 index 000000000..1cf9ca622 --- /dev/null +++ b/matita/contribs/CoRN-Decl/fta/CPoly_Rev.ma @@ -0,0 +1,179 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/fta/CPoly_Rev". + +include "CoRN.ma". + +(* $Id: CPoly_Rev.v,v 1.3 2004/04/23 10:00:56 lcf Exp $ *) + +include "algebra/CPoly_Degree.ma". + +(*#* * Reverse of polynomials +*) + +(* UNEXPORTED +Section Monomials +*) + +(*#* +%\begin{convention}% Let [R] be a ring, and let [RX] be the +polynomials over this ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/fta/CPoly_Rev/Monomials/R.var". + +(* begin hide *) + +inline "cic:/CoRN/fta/CPoly_Rev/Monomials/RX.con" "Monomials__". + +(* end hide *) + +inline "cic:/CoRN/fta/CPoly_Rev/monom.con". + +inline "cic:/CoRN/fta/CPoly_Rev/monom_coeff.con". + +inline "cic:/CoRN/fta/CPoly_Rev/monom_coeff'.con". + +(* UNEXPORTED +Hint Resolve monom_coeff monom_coeff': algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/monom_degree.con". + +inline "cic:/CoRN/fta/CPoly_Rev/monom_S.con". + +(* UNEXPORTED +Hint Resolve monom_S: algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/monom_wd_lft.con". + +(* UNEXPORTED +Hint Resolve monom_wd_lft: algebra_c. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/monom_mult'.con". + +(* UNEXPORTED +Hint Resolve monom_mult': algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/monom_mult.con". + +inline "cic:/CoRN/fta/CPoly_Rev/monom_sum.con". + +(* UNEXPORTED +End Monomials +*) + +(* UNEXPORTED +Hint Resolve monom_coeff monom_coeff' monom_mult monom_sum: algebra. +*) + +(* UNEXPORTED +Implicit Arguments monom [R]. +*) + +(* UNEXPORTED +Section Poly_Reverse +*) + +alias id "R" = "cic:/CoRN/fta/CPoly_Rev/Poly_Reverse/R.var". + +(* begin hide *) + +inline "cic:/CoRN/fta/CPoly_Rev/Poly_Reverse/RX.con" "Poly_Reverse__". + +(* end hide *) + +inline "cic:/CoRN/fta/CPoly_Rev/Rev.con". + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_coeff.con". + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_coeff'.con". + +(* UNEXPORTED +Hint Resolve Rev_coeff Rev_coeff': algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_wd.con". + +(* UNEXPORTED +Hint Resolve Rev_wd: algebra_c. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_rev.con". + +(* UNEXPORTED +Hint Resolve Rev_rev: algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_degree_le.con". + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_degree.con". + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_monom.con". + +(* UNEXPORTED +Hint Resolve Rev_monom: algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_zero.con". + +(* UNEXPORTED +Hint Resolve Rev_zero: algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_plus.con". + +(* UNEXPORTED +Hint Resolve Rev_plus: algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_minus.con". + +(* UNEXPORTED +Hint Resolve Rev_minus: algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_sum0.con". + +(* UNEXPORTED +Hint Resolve Rev_sum0: algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_sum.con". + +inline "cic:/CoRN/fta/CPoly_Rev/Rev_mult.con". + +(* UNEXPORTED +End Poly_Reverse +*) + +(* UNEXPORTED +Hint Resolve Rev_wd: algebra_c. +*) + +(* UNEXPORTED +Hint Resolve Rev_rev Rev_mult: algebra. +*) + +(* UNEXPORTED +Implicit Arguments Rev [R]. +*) + diff --git a/matita/contribs/CoRN-Decl/fta/CPoly_Shift.ma b/matita/contribs/CoRN-Decl/fta/CPoly_Shift.ma new file mode 100644 index 000000000..86a438522 --- /dev/null +++ b/matita/contribs/CoRN-Decl/fta/CPoly_Shift.ma @@ -0,0 +1,64 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/fta/CPoly_Shift". + +include "CoRN.ma". + +(* $Id: CPoly_Shift.v,v 1.4 2004/04/23 10:00:56 lcf Exp $ *) + +include "complex/CComplex.ma". + +(*#* * Shifting polynomials +This can be done for [CRings] in general, but we do it here +only for [CC] because extensionality makes everything much easier, +and we only need it for [CC]. +*) + +(* UNEXPORTED +Section Poly_Shifted +*) + +inline "cic:/CoRN/fta/CPoly_Shift/Shift.con". + +inline "cic:/CoRN/fta/CPoly_Shift/Shift_apply.con". + +(* UNEXPORTED +Hint Resolve Shift_apply: algebra. +*) + +inline "cic:/CoRN/fta/CPoly_Shift/Shift_wdr.con". + +inline "cic:/CoRN/fta/CPoly_Shift/Shift_shift.con". + +inline "cic:/CoRN/fta/CPoly_Shift/Shift_mult.con". + +inline "cic:/CoRN/fta/CPoly_Shift/Shift_degree_le.con". + +inline "cic:/CoRN/fta/CPoly_Shift/Shift_monic.con". + +(* UNEXPORTED +End Poly_Shifted +*) + +(* UNEXPORTED +Hint Resolve Shift_wdr: algebra_c. +*) + +(* UNEXPORTED +Hint Resolve Shift_apply Shift_shift Shift_mult: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/fta/FTA.ma b/matita/contribs/CoRN-Decl/fta/FTA.ma new file mode 100644 index 000000000..5b97159c0 --- /dev/null +++ b/matita/contribs/CoRN-Decl/fta/FTA.ma @@ -0,0 +1,97 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/fta/FTA". + +include "CoRN.ma". + +(* $Id: FTA.v,v 1.6 2004/04/23 10:00:57 lcf Exp $ *) + +include "fta/CPoly_Rev.ma". + +include "fta/FTAreg.ma". + +(*#* * Fundamental Theorem of Algebra +%\begin{convention}% Let [n:nat] and [f] be a complex polynomial of +degree [(S n)]. +%\end{convention}% +*) + +(* UNEXPORTED +Section FTA_reg' +*) + +alias id "f" = "cic:/CoRN/fta/FTA/FTA_reg'/f.var". + +alias id "n" = "cic:/CoRN/fta/FTA/FTA_reg'/n.var". + +alias id "f_degree" = "cic:/CoRN/fta/FTA/FTA_reg'/f_degree.var". + +inline "cic:/CoRN/fta/FTA/FTA_reg'.con". + +(* UNEXPORTED +End FTA_reg' +*) + +(*#* +%\begin{convention}% Let [n:nat], [f] be a complex polynomial of degree +less than or equal to [(S n)] and [c] be a complex number such that +[f!c [#] Zero]. +%\end{convention}% +*) + +(* UNEXPORTED +Section FTA_1 +*) + +alias id "f" = "cic:/CoRN/fta/FTA/FTA_1/f.var". + +alias id "n" = "cic:/CoRN/fta/FTA/FTA_1/n.var". + +alias id "f_degree" = "cic:/CoRN/fta/FTA/FTA_1/f_degree.var". + +alias id "c" = "cic:/CoRN/fta/FTA/FTA_1/c.var". + +alias id "f_c" = "cic:/CoRN/fta/FTA/FTA_1/f_c.var". + +inline "cic:/CoRN/fta/FTA/FTA_1a.con". + +inline "cic:/CoRN/fta/FTA/FTA_1/g.con" "FTA_1__". + +inline "cic:/CoRN/fta/FTA/FTA_1b.con". + +inline "cic:/CoRN/fta/FTA/FTA_1.con". + +inline "cic:/CoRN/fta/FTA/FTA_1'.con". + +(* UNEXPORTED +End FTA_1 +*) + +(* UNEXPORTED +Section Fund_Thm_Alg +*) + +inline "cic:/CoRN/fta/FTA/FTA'.con". + +inline "cic:/CoRN/fta/FTA/FTA.con". + +inline "cic:/CoRN/fta/FTA/FTA_a_la_Henk.con". + +(* UNEXPORTED +End Fund_Thm_Alg +*) + diff --git a/matita/contribs/CoRN-Decl/fta/FTAreg.ma b/matita/contribs/CoRN-Decl/fta/FTAreg.ma new file mode 100644 index 000000000..c4522f456 --- /dev/null +++ b/matita/contribs/CoRN-Decl/fta/FTAreg.ma @@ -0,0 +1,219 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/fta/FTAreg". + +include "CoRN.ma". + +(* $Id: FTAreg.v,v 1.4 2004/04/23 10:00:57 lcf Exp $ *) + +include "fta/KneserLemma.ma". + +include "fta/CPoly_Shift.ma". + +include "fta/CPoly_Contin1.ma". + +(*#* * FTA for regular polynomials +** The Kneser sequence +%\begin{convention}% Let [n] be a positive natural number. +%\end{convention}% +*) + +(* UNEXPORTED +Section Seq_Exists +*) + +alias id "n" = "cic:/CoRN/fta/FTAreg/Seq_Exists/n.var". + +alias id "lt0n" = "cic:/CoRN/fta/FTAreg/Seq_Exists/lt0n.var". + +(*#* +%\begin{convention}% Let [qK] be a real between 0 and 1, with +[[ +forall (p : CCX), (monic n p) -> forall (c : IR), ((AbsCC (p!Zero)) [<] c) -> + {z:CC | ((AbsCC z) [^]n [<] c) | ((AbsCC (p!z)) [<] qK[*]c)}. +]] +Let [p] be a monic polynomial over the complex numbers with degree +[n], and let [c0] be such that [(AbsCC (p!Zero)) [<] c0]. +%\end{convention}% +*) + +(* UNEXPORTED +Section Kneser_Sequence +*) + +alias id "qK" = "cic:/CoRN/fta/FTAreg/Seq_Exists/Kneser_Sequence/qK.var". + +alias id "zltq" = "cic:/CoRN/fta/FTAreg/Seq_Exists/Kneser_Sequence/zltq.var". + +alias id "qlt1" = "cic:/CoRN/fta/FTAreg/Seq_Exists/Kneser_Sequence/qlt1.var". + +alias id "q_prop" = "cic:/CoRN/fta/FTAreg/Seq_Exists/Kneser_Sequence/q_prop.var". + +alias id "p" = "cic:/CoRN/fta/FTAreg/Seq_Exists/Kneser_Sequence/p.var". + +alias id "mp" = "cic:/CoRN/fta/FTAreg/Seq_Exists/Kneser_Sequence/mp.var". + +alias id "c0" = "cic:/CoRN/fta/FTAreg/Seq_Exists/Kneser_Sequence/c0.var". + +alias id "p0ltc0" = "cic:/CoRN/fta/FTAreg/Seq_Exists/Kneser_Sequence/p0ltc0.var". + +inline "cic:/CoRN/fta/FTAreg/Knes_tup.ind". + +coercion cic:/matita/CoRN-Decl/fta/FTAreg/z_el.con 0 (* compounds *). + +inline "cic:/CoRN/fta/FTAreg/Knes_tupp.ind". + +coercion cic:/matita/CoRN-Decl/fta/FTAreg/Kntup.con 0 (* compounds *). + +inline "cic:/CoRN/fta/FTAreg/Knes_fun.con". + +inline "cic:/CoRN/fta/FTAreg/Knes_fun_it.con". + +inline "cic:/CoRN/fta/FTAreg/sK.con". + +inline "cic:/CoRN/fta/FTAreg/sK_c.con". + +inline "cic:/CoRN/fta/FTAreg/sK_c0.con". + +inline "cic:/CoRN/fta/FTAreg/sK_prop1.con". + +inline "cic:/CoRN/fta/FTAreg/sK_it.con". + +inline "cic:/CoRN/fta/FTAreg/sK_prop2.con". + +(* UNEXPORTED +End Kneser_Sequence +*) + +(* UNEXPORTED +Section Seq_Exists_Main +*) + +(*#* **Main results +*) + +inline "cic:/CoRN/fta/FTAreg/seq_exists.con". + +(* UNEXPORTED +End Seq_Exists_Main +*) + +(* UNEXPORTED +End Seq_Exists +*) + +(* UNEXPORTED +Section N_Exists +*) + +alias id "n" = "cic:/CoRN/fta/FTAreg/N_Exists/n.var". + +alias id "lt0n" = "cic:/CoRN/fta/FTAreg/N_Exists/lt0n.var". + +alias id "q" = "cic:/CoRN/fta/FTAreg/N_Exists/q.var". + +alias id "zleq" = "cic:/CoRN/fta/FTAreg/N_Exists/zleq.var". + +alias id "qlt1" = "cic:/CoRN/fta/FTAreg/N_Exists/qlt1.var". + +alias id "c" = "cic:/CoRN/fta/FTAreg/N_Exists/c.var". + +alias id "zltc" = "cic:/CoRN/fta/FTAreg/N_Exists/zltc.var". + +(* begin hide *) + +inline "cic:/CoRN/fta/FTAreg/N_Exists/q_.con" "N_Exists__". + +(* end hide *) + +alias id "e" = "cic:/CoRN/fta/FTAreg/N_Exists/e.var". + +alias id "zlte" = "cic:/CoRN/fta/FTAreg/N_Exists/zlte.var". + +inline "cic:/CoRN/fta/FTAreg/N_exists.con". + +(* UNEXPORTED +End N_Exists +*) + +(* UNEXPORTED +Section Seq_is_CC_CAuchy +*) + +(*#* ** The Kneser sequence is Cauchy in [CC] *) + +alias id "n" = "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/n.var". + +alias id "lt0n" = "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/lt0n.var". + +alias id "q" = "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/q.var". + +alias id "zleq" = "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/zleq.var". + +alias id "qlt1" = "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/qlt1.var". + +alias id "c" = "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/c.var". + +alias id "zltc" = "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/zltc.var". + +(*#* %\begin{convention}% Let: + - [q_] prove [q[-]One [#] Zero] + - [nrtq := NRoot q n] + - [nrtc := Nroot c n] + - [nrtqlt1] prove [nrtq [<] One] + - [nrtq_] prove [nrtq[-]One [#] Zero] + +%\end{convention}% *) + +(* begin hide *) + +inline "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/q_.con" "Seq_is_CC_CAuchy__". + +inline "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/nrtq.con" "Seq_is_CC_CAuchy__". + +inline "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/nrtc.con" "Seq_is_CC_CAuchy__". + +inline "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/nrtqlt1.con" "Seq_is_CC_CAuchy__". + +inline "cic:/CoRN/fta/FTAreg/Seq_is_CC_CAuchy/nrtq_.con" "Seq_is_CC_CAuchy__". + +(* end hide *) + +inline "cic:/CoRN/fta/FTAreg/zlt_nrtq.con". + +inline "cic:/CoRN/fta/FTAreg/zlt_nrtc.con". + +inline "cic:/CoRN/fta/FTAreg/nrt_pow.con". + +inline "cic:/CoRN/fta/FTAreg/abs_pow_ltRe.con". + +inline "cic:/CoRN/fta/FTAreg/abs_pow_ltIm.con". + +inline "cic:/CoRN/fta/FTAreg/SublemmaRe.con". + +inline "cic:/CoRN/fta/FTAreg/SublemmaIm.con". + +inline "cic:/CoRN/fta/FTAreg/seq_is_CC_Cauchy.con". + +(* UNEXPORTED +End Seq_is_CC_CAuchy +*) + +inline "cic:/CoRN/fta/FTAreg/FTA_monic.con". + +inline "cic:/CoRN/fta/FTAreg/FTA_reg.con". + diff --git a/matita/contribs/CoRN-Decl/fta/KeyLemma.ma b/matita/contribs/CoRN-Decl/fta/KeyLemma.ma new file mode 100644 index 000000000..e3c5ba6f3 --- /dev/null +++ b/matita/contribs/CoRN-Decl/fta/KeyLemma.ma @@ -0,0 +1,167 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/fta/KeyLemma". + +include "CoRN.ma". + +(* $Id: KeyLemma.v,v 1.5 2004/04/23 10:00:57 lcf Exp $ *) + +include "reals/NRootIR.ma". + +(*#* printing p3m %\ensuremath{\frac13\hat{\ }}% *) + +(*#* printing Halfeps %\ensuremath{\frac\varepsilon2}% *) + +(*#* * Technical lemmas for the FTA +** Key Lemma +*) + +(* UNEXPORTED +Section Key_Lemma +*) + +(*#* +%\begin{convention}% Let [a:nat->IR] and [n:nat] such that [0 < n], +[forall (k : nat) (Zero [<=] (a k))], [(a n) [=] One] and [a_0 : IR], +and [eps : IR] such that [(Zero [<] eps)] and [(eps [<=] a_0)]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/fta/KeyLemma/Key_Lemma/a.var". + +alias id "n" = "cic:/CoRN/fta/KeyLemma/Key_Lemma/n.var". + +alias id "gt_n_0" = "cic:/CoRN/fta/KeyLemma/Key_Lemma/gt_n_0.var". + +alias id "eps" = "cic:/CoRN/fta/KeyLemma/Key_Lemma/eps.var". + +alias id "eps_pos" = "cic:/CoRN/fta/KeyLemma/Key_Lemma/eps_pos.var". + +alias id "a_nonneg" = "cic:/CoRN/fta/KeyLemma/Key_Lemma/a_nonneg.var". + +alias id "a_n_1" = "cic:/CoRN/fta/KeyLemma/Key_Lemma/a_n_1.var". + +alias id "a_0" = "cic:/CoRN/fta/KeyLemma/Key_Lemma/a_0.var". + +alias id "eps_le_a_0" = "cic:/CoRN/fta/KeyLemma/Key_Lemma/eps_le_a_0.var". + +inline "cic:/CoRN/fta/KeyLemma/a_0_eps_nonneg.con". + +inline "cic:/CoRN/fta/KeyLemma/a_0_eps_fuzz.con". + +inline "cic:/CoRN/fta/KeyLemma/lem_1a.con". + +inline "cic:/CoRN/fta/KeyLemma/lem_1b.con". + +inline "cic:/CoRN/fta/KeyLemma/lem_1c.con". + +inline "cic:/CoRN/fta/KeyLemma/lem_1.con". + +inline "cic:/CoRN/fta/KeyLemma/p3m.con". + +inline "cic:/CoRN/fta/KeyLemma/p3m_pos.con". + +inline "cic:/CoRN/fta/KeyLemma/p3m_S.con". + +(* UNEXPORTED +Hint Resolve p3m_S: algebra. +*) + +inline "cic:/CoRN/fta/KeyLemma/p3m_P.con". + +inline "cic:/CoRN/fta/KeyLemma/p3m_aux.con". + +inline "cic:/CoRN/fta/KeyLemma/p3m_pow.con". + +(* UNEXPORTED +Hint Resolve p3m_aux: algebra. +*) + +inline "cic:/CoRN/fta/KeyLemma/p3m_0.con". + +(* UNEXPORTED +Hint Resolve p3m_0: algebra. +*) + +inline "cic:/CoRN/fta/KeyLemma/third_pos.con". + +(* UNEXPORTED +Hint Resolve third_pos: algebra. +*) + +inline "cic:/CoRN/fta/KeyLemma/third_less_one.con". + +(* UNEXPORTED +Hint Resolve third_less_one: algebra. +*) + +inline "cic:/CoRN/fta/KeyLemma/p3m_mon.con". + +inline "cic:/CoRN/fta/KeyLemma/p3m_mon'.con". + +inline "cic:/CoRN/fta/KeyLemma/p3m_small.con". + +inline "cic:/CoRN/fta/KeyLemma/p3m_smaller.con". + +inline "cic:/CoRN/fta/KeyLemma/chfun.con". + +inline "cic:/CoRN/fta/KeyLemma/chfun_1.con". + +inline "cic:/CoRN/fta/KeyLemma/chfun_2.con". + +inline "cic:/CoRN/fta/KeyLemma/chfun_3.con". + +inline "cic:/CoRN/fta/KeyLemma/chfun_4.con". + +inline "cic:/CoRN/fta/KeyLemma/Halfeps.con". + +inline "cic:/CoRN/fta/KeyLemma/Halfeps_pos.con". + +inline "cic:/CoRN/fta/KeyLemma/Halfeps_Halfeps.con". + +(* UNEXPORTED +Hint Resolve Halfeps_Halfeps: algebra. +*) + +inline "cic:/CoRN/fta/KeyLemma/Halfeps_eps.con". + +inline "cic:/CoRN/fta/KeyLemma/Halfeps_trans.con". + +inline "cic:/CoRN/fta/KeyLemma/Key_1a.con". + +(* UNEXPORTED +Hint Resolve Key_1a: algebra. +*) + +inline "cic:/CoRN/fta/KeyLemma/Key_1b.con". + +inline "cic:/CoRN/fta/KeyLemma/Key_1.con". + +inline "cic:/CoRN/fta/KeyLemma/Key_2.con". + +inline "cic:/CoRN/fta/KeyLemma/Key.con". + +(* end hide *) + +(* UNEXPORTED +End Key_Lemma +*) + +(* UNEXPORTED +Hint Resolve p3m_S p3m_P p3m_pow: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/fta/KneserLemma.ma b/matita/contribs/CoRN-Decl/fta/KneserLemma.ma new file mode 100644 index 000000000..66d4a7500 --- /dev/null +++ b/matita/contribs/CoRN-Decl/fta/KneserLemma.ma @@ -0,0 +1,145 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/fta/KneserLemma". + +include "CoRN.ma". + +(* $Id: KneserLemma.v,v 1.7 2004/04/23 10:00:57 lcf Exp $ *) + +(*#* printing Smallest %\ensuremath{\frac13^{2n^2+n}}% *) + +(*#* printing eta_0 %\ensuremath{\eta_0}% #η0# *) + +include "complex/NRootCC.ma". + +include "complex/AbsCC.ma". + +include "fta/MainLemma.ma". + +(*#* ** Kneser Lemma *) + +(* UNEXPORTED +Section Kneser_Lemma +*) + +(*#* +%\begin{convention}% Let [b : nat->CC], [n : nat] and [c : IR] +such that [0 < n], [b_0 := b 0], [b_n := (b n) [=] One] and +[(AbsCC b_0) [<] c]. +%\end{convention}% +*) + +alias id "b" = "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/b.var". + +alias id "n" = "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/n.var". + +alias id "gt_n_0" = "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/gt_n_0.var". + +(* begin hide *) + +inline "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/b_0.con" "Kneser_Lemma__". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/b_n.con" "Kneser_Lemma__". + +(* end hide *) + +alias id "b_n_1" = "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/b_n_1.var". + +alias id "c" = "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/c.var". + +alias id "b_0_lt_c" = "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/b_0_lt_c.var". + +(*#* +%\begin{convention}% We define the following local abbreviations: + - [two_n := 2 * n] + - [Small := p3m n] + - [Smaller := p3m (two_n * n)] + - [Smallest := Small[*]Smaller] + - [q := One[-]Smallest] + - [a i := AbsCC (b i)] + +%\end{convention}% +*) + +(* begin hide *) + +inline "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/two_n.con" "Kneser_Lemma__". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/Small.con" "Kneser_Lemma__". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/Smaller.con" "Kneser_Lemma__". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/Smallest.con" "Kneser_Lemma__". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/q.con" "Kneser_Lemma__". + +(* end hide *) + +inline "cic:/CoRN/fta/KneserLemma/b_0'_exists.con". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/eta_0.con" "Kneser_Lemma__". + +inline "cic:/CoRN/fta/KneserLemma/eta_0_pos.con". + +inline "cic:/CoRN/fta/KneserLemma/eta_exists.con". + +inline "cic:/CoRN/fta/KneserLemma/eps_exists_1.con". + +(* less_cotransitive_unfolded on + {Zero [<] y[/]x[//]H3[-]Half[*]eps} + + {y[/]x[//]H3[-]Half[*]eps [<] Half[*]eps}. *) + +inline "cic:/CoRN/fta/KneserLemma/eps_exists.con". + +(* begin hide *) + +inline "cic:/CoRN/fta/KneserLemma/Kneser_Lemma/a.con" "Kneser_Lemma__". + +(* end hide *) + +inline "cic:/CoRN/fta/KneserLemma/z_exists.con". + +(* end hide *) + +inline "cic:/CoRN/fta/KneserLemma/Kneser_1'.con". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_1''.con". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_1.con". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_2a.con". + +inline "cic:/CoRN/fta/KneserLemma/Kneser_2b.con". + +(* end hide *) + +inline "cic:/CoRN/fta/KneserLemma/Kneser_2c.con". + +(* end hide *) + +inline "cic:/CoRN/fta/KneserLemma/Kneser_2.con". + +(* end hide *) + +inline "cic:/CoRN/fta/KneserLemma/Kneser_3.con". + +(* UNEXPORTED +End Kneser_Lemma +*) + +inline "cic:/CoRN/fta/KneserLemma/Kneser.con". + diff --git a/matita/contribs/CoRN-Decl/fta/MainLemma.ma b/matita/contribs/CoRN-Decl/fta/MainLemma.ma new file mode 100644 index 000000000..385a37eff --- /dev/null +++ b/matita/contribs/CoRN-Decl/fta/MainLemma.ma @@ -0,0 +1,128 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/fta/MainLemma". + +include "CoRN.ma". + +(* $Id: MainLemma.v,v 1.3 2004/04/23 10:00:57 lcf Exp $ *) + +(*#* printing two_n %\ensuremath{2n}% #2n# *) + +(*#* printing Small %\ensuremath{\frac13^n}% *) + +(*#* printing Smaller %\ensuremath{\frac13^{2n^2}}% *) + +include "reals/CSumsReals.ma". + +include "fta/KeyLemma.ma". + +(*#* ** Main Lemma +*) + +(* UNEXPORTED +Section Main_Lemma +*) + +(*#* +%\begin{convention}% +Let [a : nat->IR], [n : nat], [a_0 : IR] and [eps : IR] such that [0 < n], +[(Zero [<] eps)], [forall (k : nat)(Zero [<=] (a k))], [(a n) [=] One], and +[(eps [<=] a_0)]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/fta/MainLemma/Main_Lemma/a.var". + +alias id "n" = "cic:/CoRN/fta/MainLemma/Main_Lemma/n.var". + +alias id "gt_n_0" = "cic:/CoRN/fta/MainLemma/Main_Lemma/gt_n_0.var". + +alias id "eps" = "cic:/CoRN/fta/MainLemma/Main_Lemma/eps.var". + +alias id "eps_pos" = "cic:/CoRN/fta/MainLemma/Main_Lemma/eps_pos.var". + +alias id "a_nonneg" = "cic:/CoRN/fta/MainLemma/Main_Lemma/a_nonneg.var". + +alias id "a_n_1" = "cic:/CoRN/fta/MainLemma/Main_Lemma/a_n_1.var". + +alias id "a_0" = "cic:/CoRN/fta/MainLemma/Main_Lemma/a_0.var". + +alias id "eps_le_a_0" = "cic:/CoRN/fta/MainLemma/Main_Lemma/eps_le_a_0.var". + +inline "cic:/CoRN/fta/MainLemma/a_0_pos.con". + +(*#* +%\begin{convention}% We define the following local abbreviations: + - [two_n := 2 * n] + - [Small := p3m n] + - [Smaller := p3m (two_n * n)] + +%\end{convention}% +*) + +(* begin hide *) + +inline "cic:/CoRN/fta/MainLemma/Main_Lemma/two_n.con" "Main_Lemma__". + +inline "cic:/CoRN/fta/MainLemma/Main_Lemma/Small.con" "Main_Lemma__". + +inline "cic:/CoRN/fta/MainLemma/Main_Lemma/Smaller.con" "Main_Lemma__". + +(* end hide *) + +inline "cic:/CoRN/fta/MainLemma/Main_1a'.con". + +(* end hide *) + +inline "cic:/CoRN/fta/MainLemma/Main_1b'.con". + +(* end hide *) + +inline "cic:/CoRN/fta/MainLemma/Main_1a.con". + +(* end hide *) + +inline "cic:/CoRN/fta/MainLemma/Main_1b.con". + +(* end hide *) + +inline "cic:/CoRN/fta/MainLemma/Main_1.con". + +(* end hide *) + +inline "cic:/CoRN/fta/MainLemma/Main_2'.con". + +inline "cic:/CoRN/fta/MainLemma/Main_2.con". + +(* end hide *) + +inline "cic:/CoRN/fta/MainLemma/Main_3a.con". + +(* end hide *) + +inline "cic:/CoRN/fta/MainLemma/Main_3.con". + +(* end hide *) + +inline "cic:/CoRN/fta/MainLemma/Main.con". + +(* end hide *) + +(* UNEXPORTED +End Main_Lemma +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/COrdLemmas.ma b/matita/contribs/CoRN-Decl/ftc/COrdLemmas.ma new file mode 100644 index 000000000..c3701c29f --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/COrdLemmas.ma @@ -0,0 +1,123 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/COrdLemmas". + +include "CoRN.ma". + +(* $Id: COrdLemmas.v,v 1.2 2004/04/23 10:00:57 lcf Exp $ *) + +include "algebra/COrdCauchy.ma". + +(* UNEXPORTED +Section Lemmas +*) + +(*#* *Lemmas for Integration + +Here we include several lemmas valid in any ordered field [F] which +are useful for integration. + +** Merging orders + +We first prove that any two strictly ordered sets of points which have +an empty intersection can be ordered as one (this will be the core of +the proof that any two partitions with no common point have a common +refinement). +*) + +alias id "F" = "cic:/CoRN/ftc/COrdLemmas/Lemmas/F.var". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_lt.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_1.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_2a.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_2.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_3a.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_3b.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_4a.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_4b.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_4c.con". + +inline "cic:/CoRN/ftc/COrdLemmas/om_fun_4d.con". + +(* begin hide *) + +alias id "f" = "cic:/CoRN/ftc/COrdLemmas/Lemmas/f.var". + +alias id "f0" = "cic:/CoRN/ftc/COrdLemmas/Lemmas/f0.var". + +alias id "f_mon" = "cic:/CoRN/ftc/COrdLemmas/Lemmas/f_mon.var". + +alias id "h" = "cic:/CoRN/ftc/COrdLemmas/Lemmas/h.var". + +(* end hide *) + +(*#* ** Summations +Also, some technical stuff on sums. The first lemma relates two +different kinds of sums; the other two ones are variations, where the +structure of the arguments is analyzed in more detail. +*) + +(* begin show *) + +inline "cic:/CoRN/ftc/COrdLemmas/Sumx_Sum_Sum + (* end show *) + (* begin hide *).con". + +(* end hide *) + +(* begin show *) + +inline "cic:/CoRN/ftc/COrdLemmas/str_Sumx_Sum_Sum + (* end show *) + (* begin hide *).con". + +(* UNEXPORTED +End Lemmas +*) + +(* UNEXPORTED +Section More_Lemmas +*) + +inline "cic:/CoRN/ftc/COrdLemmas/More_Lemmas/f'.con" "More_Lemmas__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/COrdLemmas/More_Lemmas/F.var". + +(* begin show *) + +inline "cic:/CoRN/ftc/COrdLemmas/str_Sumx_Sum_Sum' + (* end show *) + (* begin hide *).con". + +(* end hide *) + +(* UNEXPORTED +End More_Lemmas +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/CalculusTheorems.ma b/matita/contribs/CoRN-Decl/ftc/CalculusTheorems.ma new file mode 100644 index 000000000..375104975 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/CalculusTheorems.ma @@ -0,0 +1,123 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/CalculusTheorems". + +include "CoRN.ma". + +(* $Id: CalculusTheorems.v,v 1.6 2004/04/23 10:00:57 lcf Exp $ *) + +include "ftc/Rolle.ma". + +include "tactics/DiffTactics3.ma". + +(* UNEXPORTED +Opaque Min Max. +*) + +(* UNEXPORTED +Section Various_Theorems +*) + +(*#* *Calculus Theorems + +This file is intended to present a collection of miscellaneous, mostly +technical results in differential calculus that are interesting or +useful in future work. + +We begin with some properties of continuous functions. Every +continuous function commutes with the limit of a numerical sequence +(sometimes called Heine continuity). +*) + +inline "cic:/CoRN/ftc/CalculusTheorems/Continuous_imp_comm_Lim.con". + +(*#* +This is a tricky result: if [F] is continuous and positive in both [[a,b]] +and [(b,c]], then it is positive in [[a,c]]. +*) + +inline "cic:/CoRN/ftc/CalculusTheorems/Continuous_imp_pos.con". + +(*#* +Similar results for increasing functions: +*) + +inline "cic:/CoRN/ftc/CalculusTheorems/strict_inc_glues.con". + +inline "cic:/CoRN/ftc/CalculusTheorems/strict_inc_glues'.con". + +inline "cic:/CoRN/ftc/CalculusTheorems/strict_dec_glues.con". + +inline "cic:/CoRN/ftc/CalculusTheorems/strict_dec_glues'.con". + +(*#* More on glueing intervals. *) + +inline "cic:/CoRN/ftc/CalculusTheorems/olor_pos_clor_nonneg.con". + +inline "cic:/CoRN/ftc/CalculusTheorems/olor_pos_olcr_nonneg.con". + +inline "cic:/CoRN/ftc/CalculusTheorems/olor_pos_clcr_nonneg.con". + +(*#* +Any function that has the null function as its derivative must be constant. +*) + +inline "cic:/CoRN/ftc/CalculusTheorems/FConst_prop.con". + +(*#* As a corollary, two functions with the same derivative must differ +by a constant. +*) + +inline "cic:/CoRN/ftc/CalculusTheorems/Feq_crit_with_const.con". + +(*#* This yields the following known result: any differential equation +of the form [f'=g] with initial condition [f(a) [=] b] has a unique solution. +*) + +inline "cic:/CoRN/ftc/CalculusTheorems/Feq_criterium.con". + +(*#* +Finally, a well known result: any function with a (strictly) positive +derivative is (strictly) increasing. Although the two lemmas look +quite similar the proofs are completely different, both from the +formalization and from the mathematical point of view. +*) + +inline "cic:/CoRN/ftc/CalculusTheorems/Derivative_imp_resp_less.con". + +inline "cic:/CoRN/ftc/CalculusTheorems/Derivative_imp_resp_leEq.con". + +inline "cic:/CoRN/ftc/CalculusTheorems/Derivative_imp_resp_less'.con". + +(*#* From these results we can finally prove that exponentiation to a +real power preserves the less or equal than relation! +*) + +(* UNEXPORTED +Opaque nring. +*) + +(* UNEXPORTED +Transparent nring. +*) + +inline "cic:/CoRN/ftc/CalculusTheorems/nexp_resp_leEq_odd.con". + +(* UNEXPORTED +End Various_Theorems +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/Composition.ma b/matita/contribs/CoRN-Decl/ftc/Composition.ma new file mode 100644 index 000000000..e5ae78e35 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/Composition.ma @@ -0,0 +1,403 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/Composition". + +include "CoRN.ma". + +(* $Id: Composition.v,v 1.4 2004/04/23 10:00:58 lcf Exp $ *) + +include "ftc/MoreFunctions.ma". + +(* UNEXPORTED +Section Maps_into_Compacts +*) + +(* UNEXPORTED +Section Part_Funct +*) + +(*#* *Composition + +Preservation results for functional composition are treated in this +separate file. We start by defining some auxiliary predicates, and +then prove the preservation of continuity through composition and the +chain rule for differentiation, both for compact and arbitrary +intervals. + +%\begin{convention}% Throughout this section: +- [a, b : IR] and [I] will denote [[a,b]]; +- [c, d : IR] and [J] will denote [[c,d]]; +- [F, F', G, G'] will be partial functions. + +%\end{convention}% + +** Maps into Compacts + +Both continuity and differentiability proofs require extra hypothesis +on the functions involved---namely, that every compact interval is +mapped into another compact interval. We define this concept for +partial functions, and prove some trivial results. +*) + +alias id "F" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/F.var". + +alias id "G" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/G.var". + +alias id "a" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/a.var". + +alias id "b" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/Hab.var". + +alias id "c" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/c.var". + +alias id "d" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/d.var". + +alias id "Hcd" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/Hcd.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/I.con" "Maps_into_Compacts__Part_Funct__". + +(* end hide *) + +(* begin show *) + +alias id "Hf" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/Hf.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Composition/maps_into_compacts.con". + +(* begin show *) + +alias id "maps" = "cic:/CoRN/ftc/Composition/Maps_into_Compacts/Part_Funct/maps.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Composition/maps_lemma'.con". + +inline "cic:/CoRN/ftc/Composition/maps_lemma.con". + +inline "cic:/CoRN/ftc/Composition/maps_lemma_less.con". + +inline "cic:/CoRN/ftc/Composition/maps_lemma_inc.con". + +(* UNEXPORTED +End Part_Funct +*) + +(* UNEXPORTED +End Maps_into_Compacts +*) + +(* UNEXPORTED +Section Mapping +*) + +(*#* +As was the case for division of partial functions, this condition +completely characterizes the domain of the composite function. +*) + +alias id "F" = "cic:/CoRN/ftc/Composition/Mapping/F.var". + +alias id "G" = "cic:/CoRN/ftc/Composition/Mapping/G.var". + +alias id "a" = "cic:/CoRN/ftc/Composition/Mapping/a.var". + +alias id "b" = "cic:/CoRN/ftc/Composition/Mapping/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Composition/Mapping/Hab.var". + +alias id "c" = "cic:/CoRN/ftc/Composition/Mapping/c.var". + +alias id "d" = "cic:/CoRN/ftc/Composition/Mapping/d.var". + +alias id "Hcd" = "cic:/CoRN/ftc/Composition/Mapping/Hcd.var". + +(* begin show *) + +alias id "Hf" = "cic:/CoRN/ftc/Composition/Mapping/Hf.var". + +alias id "Hg" = "cic:/CoRN/ftc/Composition/Mapping/Hg.var". + +alias id "maps" = "cic:/CoRN/ftc/Composition/Mapping/maps.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Composition/included_comp.con". + +(* UNEXPORTED +End Mapping +*) + +(* UNEXPORTED +Section Interval_Continuity +*) + +(*#* **Continuity + +We now prove that the composition of two continuous partial functions is continuous. +*) + +alias id "a" = "cic:/CoRN/ftc/Composition/Interval_Continuity/a.var". + +alias id "b" = "cic:/CoRN/ftc/Composition/Interval_Continuity/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Composition/Interval_Continuity/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Composition/Interval_Continuity/I.con" "Interval_Continuity__". + +(* end hide *) + +alias id "c" = "cic:/CoRN/ftc/Composition/Interval_Continuity/c.var". + +alias id "d" = "cic:/CoRN/ftc/Composition/Interval_Continuity/d.var". + +alias id "Hcd" = "cic:/CoRN/ftc/Composition/Interval_Continuity/Hcd.var". + +alias id "F" = "cic:/CoRN/ftc/Composition/Interval_Continuity/F.var". + +alias id "G" = "cic:/CoRN/ftc/Composition/Interval_Continuity/G.var". + +(* begin show *) + +alias id "contF" = "cic:/CoRN/ftc/Composition/Interval_Continuity/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/Composition/Interval_Continuity/contG.var". + +alias id "Hmap" = "cic:/CoRN/ftc/Composition/Interval_Continuity/Hmap.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Composition/Continuous_I_comp.con". + +(* UNEXPORTED +End Interval_Continuity +*) + +(* UNEXPORTED +Section Derivative +*) + +(*#* **Derivative + +We now work with the derivative relation and prove the chain rule for partial functions. +*) + +alias id "F" = "cic:/CoRN/ftc/Composition/Derivative/F.var". + +alias id "F'" = "cic:/CoRN/ftc/Composition/Derivative/F'.var". + +alias id "G" = "cic:/CoRN/ftc/Composition/Derivative/G.var". + +alias id "G'" = "cic:/CoRN/ftc/Composition/Derivative/G'.var". + +alias id "a" = "cic:/CoRN/ftc/Composition/Derivative/a.var". + +alias id "b" = "cic:/CoRN/ftc/Composition/Derivative/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Composition/Derivative/Hab'.var". + +alias id "c" = "cic:/CoRN/ftc/Composition/Derivative/c.var". + +alias id "d" = "cic:/CoRN/ftc/Composition/Derivative/d.var". + +alias id "Hcd'" = "cic:/CoRN/ftc/Composition/Derivative/Hcd'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Composition/Derivative/Hab.con" "Derivative__". + +inline "cic:/CoRN/ftc/Composition/Derivative/Hcd.con" "Derivative__". + +inline "cic:/CoRN/ftc/Composition/Derivative/I.con" "Derivative__". + +(* end hide *) + +(* begin show *) + +alias id "derF" = "cic:/CoRN/ftc/Composition/Derivative/derF.var". + +alias id "derG" = "cic:/CoRN/ftc/Composition/Derivative/derG.var". + +alias id "Hmap" = "cic:/CoRN/ftc/Composition/Derivative/Hmap.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Composition/included_comp'.con". + +inline "cic:/CoRN/ftc/Composition/maps'.con". + +inline "cic:/CoRN/ftc/Composition/Derivative_I_comp.con". + +(*#* +The next lemma will be useful when we move on to differentiability. +*) + +inline "cic:/CoRN/ftc/Composition/Diffble_I_comp_aux.con". + +(* UNEXPORTED +End Derivative +*) + +(* UNEXPORTED +Section Differentiability +*) + +(*#* **Differentiability + +Finally, we move on to differentiability. +*) + +alias id "F" = "cic:/CoRN/ftc/Composition/Differentiability/F.var". + +alias id "G" = "cic:/CoRN/ftc/Composition/Differentiability/G.var". + +alias id "a" = "cic:/CoRN/ftc/Composition/Differentiability/a.var". + +alias id "b" = "cic:/CoRN/ftc/Composition/Differentiability/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Composition/Differentiability/Hab'.var". + +alias id "c" = "cic:/CoRN/ftc/Composition/Differentiability/c.var". + +alias id "d" = "cic:/CoRN/ftc/Composition/Differentiability/d.var". + +alias id "Hcd'" = "cic:/CoRN/ftc/Composition/Differentiability/Hcd'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Composition/Differentiability/Hab.con" "Differentiability__". + +inline "cic:/CoRN/ftc/Composition/Differentiability/Hcd.con" "Differentiability__". + +inline "cic:/CoRN/ftc/Composition/Differentiability/I.con" "Differentiability__". + +(* end hide *) + +(* begin show *) + +alias id "diffF" = "cic:/CoRN/ftc/Composition/Differentiability/diffF.var". + +alias id "diffG" = "cic:/CoRN/ftc/Composition/Differentiability/diffG.var". + +alias id "Hmap" = "cic:/CoRN/ftc/Composition/Differentiability/Hmap.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Composition/Diffble_I_comp.con". + +(* UNEXPORTED +End Differentiability +*) + +(* UNEXPORTED +Section Generalized_Intervals +*) + +(*#* **Generalizations + +We now generalize this results to arbitrary intervals. We begin by generalizing the notion of mapping compacts into compacts. + +%\begin{convention}% We assume [I,J] to be proper intervals. +%\end{convention}% +*) + +alias id "I" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/I.var". + +alias id "J" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/J.var". + +alias id "pI" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/pI.var". + +alias id "pJ" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/pJ.var". + +inline "cic:/CoRN/ftc/Composition/maps_compacts_into.con". + +(*#* +Now everything comes naturally: +*) + +inline "cic:/CoRN/ftc/Composition/comp_inc_lemma.con". + +alias id "F" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/F.var". + +alias id "F'" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/F'.var". + +alias id "G" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/G.var". + +alias id "G'" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/G'.var". + +(* begin show *) + +alias id "Hmap" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/Hmap.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Composition/Continuous_comp.con". + +(* begin show *) + +alias id "Hmap'" = "cic:/CoRN/ftc/Composition/Generalized_Intervals/Hmap'.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Composition/Derivative_comp.con". + +(* UNEXPORTED +End Generalized_Intervals +*) + +(* UNEXPORTED +Section Corollaries +*) + +(*#* +Finally, some criteria to prove that a function with a specific domain maps compacts into compacts: +*) + +inline "cic:/CoRN/ftc/Composition/positive_fun.con". + +inline "cic:/CoRN/ftc/Composition/negative_fun.con". + +inline "cic:/CoRN/ftc/Composition/positive_imp_maps_compacts_into.con". + +inline "cic:/CoRN/ftc/Composition/negative_imp_maps_compacts_into.con". + +inline "cic:/CoRN/ftc/Composition/Continuous_imp_maps_compacts_into.con". + +(*#* +As a corollary, we get the generalization of differentiability property. +*) + +inline "cic:/CoRN/ftc/Composition/Diffble_comp.con". + +(* UNEXPORTED +End Corollaries +*) + +(* UNEXPORTED +Hint Immediate included_comp: included. +*) + +(* UNEXPORTED +Hint Immediate Continuous_I_comp Continuous_comp: continuous. +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/Continuity.ma b/matita/contribs/CoRN-Decl/ftc/Continuity.ma new file mode 100644 index 000000000..6f884860a --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/Continuity.ma @@ -0,0 +1,407 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/Continuity". + +include "CoRN.ma". + +(* $Id: Continuity.v,v 1.6 2004/04/23 10:00:58 lcf Exp $ *) + +(*#* printing Norm_Funct %\ensuremath{\|\cdot\|}% *) + +include "reals/NRootIR.ma". + +include "ftc/FunctSums.ma". + +(* UNEXPORTED +Section Definitions_and_Basic_Results +*) + +(*#* *Continuity + +Constructively, continuity is the most fundamental property of any +function---so strongly that no example is known of a constructive +function that is not continuous. However, the classical definition of +continuity is not good for our purposes, as it is not true, for +example, that a function which is continuous in a compact interval is +uniformly continuous in that same interval (for a discussion of this +see Bishop 1967). Thus, our notion of continuity will be the uniform +one#. #%\footnote{%Similar remarks apply to convergence of sequences +of functions, which we will define ahead, and elsewhere; we will +refrain from discussing this issue at those places.%}.% + +%\begin{convention}% Throughout this section, [a] and [b] will be real +numbers, [I] will denote the compact interval [[a,b]] and +[F, G, H] will denote arbitrary partial functions with domains +respectively [P, Q] and [R]. +%\end{convention}% + +** Definitions and Basic Results + +Here we define continuity and prove some basic properties of continuous functions. +*) + +alias id "a" = "cic:/CoRN/ftc/Continuity/Definitions_and_Basic_Results/a.var". + +alias id "b" = "cic:/CoRN/ftc/Continuity/Definitions_and_Basic_Results/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Continuity/Definitions_and_Basic_Results/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Continuity/Definitions_and_Basic_Results/I.con" "Definitions_and_Basic_Results__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/Continuity/Definitions_and_Basic_Results/F.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Continuity/Definitions_and_Basic_Results/P.con" "Definitions_and_Basic_Results__". + +(* end hide *) + +inline "cic:/CoRN/ftc/Continuity/Continuous_I.con". + +(*#* +For convenience, we distinguish the two properties of continuous functions. +*) + +inline "cic:/CoRN/ftc/Continuity/contin_imp_inc.con". + +inline "cic:/CoRN/ftc/Continuity/contin_prop.con". + +(*#* +Assume [F] to be continuous in [I]. Then it has a least upper bound and a greater lower bound on [I]. +*) + +alias id "contF" = "cic:/CoRN/ftc/Continuity/Definitions_and_Basic_Results/contF.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Continuity/Definitions_and_Basic_Results/Hinc'.con" "Definitions_and_Basic_Results__". + +(* end hide *) + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_imp_tb_image.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_imp_lub.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_imp_glb.con". + +(*#* +We now make this glb and lub into operators. +*) + +inline "cic:/CoRN/ftc/Continuity/lub_funct.con". + +inline "cic:/CoRN/ftc/Continuity/glb_funct.con". + +(*#* +These operators have the expected properties. +*) + +inline "cic:/CoRN/ftc/Continuity/lub_is_lub.con". + +inline "cic:/CoRN/ftc/Continuity/glb_is_glb.con". + +inline "cic:/CoRN/ftc/Continuity/glb_prop.con". + +inline "cic:/CoRN/ftc/Continuity/lub_prop.con". + +(*#* +The norm of a function is defined as being the supremum of its absolute value; that is equivalent to the following definition (which is often more convenient to use). +*) + +inline "cic:/CoRN/ftc/Continuity/Norm_Funct.con". + +(*#* +The norm effectively bounds the absolute value of a function. +*) + +inline "cic:/CoRN/ftc/Continuity/norm_bnd_AbsIR.con". + +(*#* +The following is another way of characterizing the norm: +*) + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_imp_abs_lub.con". + +(*#* +We now prove some basic properties of the norm---namely that it is positive, and that it provides a least upper bound for the absolute value of its argument. +*) + +inline "cic:/CoRN/ftc/Continuity/positive_norm.con". + +inline "cic:/CoRN/ftc/Continuity/norm_fun_lub.con". + +inline "cic:/CoRN/ftc/Continuity/leEq_Norm_Funct.con". + +inline "cic:/CoRN/ftc/Continuity/less_Norm_Funct.con". + +(* UNEXPORTED +End Definitions_and_Basic_Results +*) + +(* UNEXPORTED +Implicit Arguments Continuous_I [a b]. +*) + +(* UNEXPORTED +Implicit Arguments Norm_Funct [a b Hab F]. +*) + +(* UNEXPORTED +Section Local_Results +*) + +(*#* **Algebraic Properties + +We now state and prove some results about continuous functions. Assume that [I] is included in the domain of both [F] and [G]. +*) + +alias id "a" = "cic:/CoRN/ftc/Continuity/Local_Results/a.var". + +alias id "b" = "cic:/CoRN/ftc/Continuity/Local_Results/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Continuity/Local_Results/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Continuity/Local_Results/I.con" "Local_Results__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/Continuity/Local_Results/F.var". + +alias id "G" = "cic:/CoRN/ftc/Continuity/Local_Results/G.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Continuity/Local_Results/P.con" "Local_Results__". + +inline "cic:/CoRN/ftc/Continuity/Local_Results/Q.con" "Local_Results__". + +(* end hide *) + +alias id "incF" = "cic:/CoRN/ftc/Continuity/Local_Results/incF.var". + +alias id "incG" = "cic:/CoRN/ftc/Continuity/Local_Results/incG.var". + +(*#* +The first result does not require the function to be continuous; however, its preconditions are easily verified by continuous functions, which justifies its inclusion in this section. +*) + +inline "cic:/CoRN/ftc/Continuity/cont_no_sign_change.con". + +inline "cic:/CoRN/ftc/Continuity/cont_no_sign_change_pos.con". + +inline "cic:/CoRN/ftc/Continuity/cont_no_sign_change_neg.con". + +(*#* +Being continuous is an extensional property. +*) + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_wd.con". + +(*#* +A continuous function remains continuous if you restrict its domain. +*) + +inline "cic:/CoRN/ftc/Continuity/included_imp_contin.con". + +(*#* +Constant functions and identity are continuous. +*) + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_const.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_id.con". + +(*#* +Assume [F] and [G] are continuous in [I]. Then functions derived from these through algebraic operations are also continuous, provided (in the case of reciprocal and division) some extra conditions are met. +*) + +alias id "contF" = "cic:/CoRN/ftc/Continuity/Local_Results/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/Continuity/Local_Results/contG.var". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_plus.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_inv.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_mult.con". + +(* UNEXPORTED +Opaque AbsIR Max. +*) + +(* UNEXPORTED +Transparent AbsIR Max. +*) + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_max.con". + +(* begin show *) + +alias id "Hg'" = "cic:/CoRN/ftc/Continuity/Local_Results/Hg'.var". + +alias id "Hg''" = "cic:/CoRN/ftc/Continuity/Local_Results/Hg''.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_recip.con". + +(* UNEXPORTED +End Local_Results +*) + +(* UNEXPORTED +Hint Resolve contin_imp_inc: included. +*) + +(* UNEXPORTED +Section Corolaries +*) + +alias id "a" = "cic:/CoRN/ftc/Continuity/Corolaries/a.var". + +alias id "b" = "cic:/CoRN/ftc/Continuity/Corolaries/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Continuity/Corolaries/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Continuity/Corolaries/I.con" "Corolaries__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/Continuity/Corolaries/F.var". + +alias id "G" = "cic:/CoRN/ftc/Continuity/Corolaries/G.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Continuity/Corolaries/P.con" "Corolaries__". + +inline "cic:/CoRN/ftc/Continuity/Corolaries/Q.con" "Corolaries__". + +(* end hide *) + +alias id "contF" = "cic:/CoRN/ftc/Continuity/Corolaries/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/Continuity/Corolaries/contG.var". + +(*#* +The corresponding properties for subtraction, division and +multiplication by a scalar are easily proved as corollaries; +exponentiation is proved by induction, appealing to the results on +product and constant functions. +*) + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_minus.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_scal.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_nth.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_min.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_abs.con". + +alias id "Hg'" = "cic:/CoRN/ftc/Continuity/Corolaries/Hg'.var". + +alias id "Hg''" = "cic:/CoRN/ftc/Continuity/Corolaries/Hg''.var". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_div.con". + +(* UNEXPORTED +End Corolaries +*) + +(* UNEXPORTED +Section Other +*) + +(* UNEXPORTED +Section Sums +*) + +(*#* +We finally prove that the sum of an arbitrary family of continuous functions is still a continuous function. +*) + +alias id "a" = "cic:/CoRN/ftc/Continuity/Other/Sums/a.var". + +alias id "b" = "cic:/CoRN/ftc/Continuity/Other/Sums/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Continuity/Other/Sums/Hab.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Continuity/Other/Sums/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Continuity/Other/Sums/I.con" "Other__Sums__". + +(* end hide *) + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_Sum0.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_Sumx.con". + +inline "cic:/CoRN/ftc/Continuity/Continuous_I_Sum.con". + +(* UNEXPORTED +End Sums +*) + +(*#* +For practical purposes, these characterization results are useful: +*) + +inline "cic:/CoRN/ftc/Continuity/lub_charact.con". + +inline "cic:/CoRN/ftc/Continuity/glb_charact.con". + +(*#* +The following result is also extremely useful, as it allows us to set a lower bound on the glb of a function. +*) + +inline "cic:/CoRN/ftc/Continuity/leEq_glb.con". + +(*#* +The norm is also an extensional property. +*) + +inline "cic:/CoRN/ftc/Continuity/Norm_Funct_wd.con". + +(*#* +The value of the norm is covariant with the length of the interval. +*) + +inline "cic:/CoRN/ftc/Continuity/included_imp_norm_leEq.con". + +(* UNEXPORTED +End Other +*) + +(* UNEXPORTED +Hint Resolve Continuous_I_const Continuous_I_id Continuous_I_plus + Continuous_I_inv Continuous_I_minus Continuous_I_mult Continuous_I_scal + Continuous_I_recip Continuous_I_max Continuous_I_min Continuous_I_div + Continuous_I_nth Continuous_I_abs: continuous. +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/Derivative.ma b/matita/contribs/CoRN-Decl/ftc/Derivative.ma new file mode 100644 index 000000000..8c983b129 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/Derivative.ma @@ -0,0 +1,180 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/Derivative". + +include "CoRN.ma". + +(* $Id: Derivative.v,v 1.7 2004/04/23 10:00:58 lcf Exp $ *) + +include "ftc/Continuity.ma". + +(* UNEXPORTED +Section Definitions +*) + +(*#* *Derivatives + +We will now proceed toward the development of differential calculus. +To begin with, the main notion is that of derivative. + +At this stage we will not define a notion of differentiable function, +mainly because the natural definition (that of being a function which +has some derivative) poses some technical problems; thus, we will +postpone that part of our work to a subsequent stage. + +Derivative is a binary relation in the type of partial functions, +dependent (once again) on a compact interval with distinct +endpoints#. #%\footnote{%As before, we do not define pointwise +differentiability, mainly for coherence reasons. See Bishop [1967] +for a discussion on the relative little interest of that concept.%}.% +The reason for requiring the endpoints to be apart is mainly to be +able to derive the usual properties of the derivative +relation---namely, that any two derivatives of the same function must +coincide. + +%\begin{convention}% Let [a,b:IR] with [a [<] b] and denote by [I] the +interval [[a,b]]. Throughout this chapter, [F, F', G, G'] and [H] +will be partial functions with domains respectively [P, P', Q, Q'] and +[R]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/Derivative/Definitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/Derivative/Definitions/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Derivative/Definitions/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Derivative/Definitions/Hab.con" "Definitions__". + +inline "cic:/CoRN/ftc/Derivative/Definitions/I.con" "Definitions__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/Derivative/Definitions/F.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Derivative/Definitions/P.con" "Definitions__". + +(* end hide *) + +inline "cic:/CoRN/ftc/Derivative/Derivative_I.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Implicit Arguments Derivative_I [a b]. +*) + +(* UNEXPORTED +Section Basic_Properties +*) + +(*#* **Basic Properties +*) + +alias id "a" = "cic:/CoRN/ftc/Derivative/Basic_Properties/a.var". + +alias id "b" = "cic:/CoRN/ftc/Derivative/Basic_Properties/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Derivative/Basic_Properties/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Derivative/Basic_Properties/Hab.con" "Basic_Properties__". + +inline "cic:/CoRN/ftc/Derivative/Basic_Properties/I.con" "Basic_Properties__". + +(* end hide *) + +(*#* +Like we did for equality, we begin by stating a lemma that makes proofs of derivation easier in practice. +*) + +inline "cic:/CoRN/ftc/Derivative/Derivative_I_char.con". + +(* end hide *) + +(*#* +Derivative is a well defined relation; we will make this explicit for both arguments: +*) + +alias id "F" = "cic:/CoRN/ftc/Derivative/Basic_Properties/F.var". + +alias id "G" = "cic:/CoRN/ftc/Derivative/Basic_Properties/G.var". + +alias id "H" = "cic:/CoRN/ftc/Derivative/Basic_Properties/H.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Derivative/Basic_Properties/P.con" "Basic_Properties__". + +inline "cic:/CoRN/ftc/Derivative/Basic_Properties/Q.con" "Basic_Properties__". + +inline "cic:/CoRN/ftc/Derivative/Basic_Properties/R.con" "Basic_Properties__". + +(* end hide *) + +inline "cic:/CoRN/ftc/Derivative/Derivative_I_wdl.con". + +inline "cic:/CoRN/ftc/Derivative/Derivative_I_wdr.con". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Derivative/Basic_Properties/Derivative_I_unique_lemma.con" "Basic_Properties__". + +(* end hide *) + +(*#* +Derivative is unique. +*) + +inline "cic:/CoRN/ftc/Derivative/Derivative_I_unique.con". + +(*#* +Finally, the set where we are considering the relation is included in the domain of both functions. +*) + +inline "cic:/CoRN/ftc/Derivative/derivative_imp_inc.con". + +inline "cic:/CoRN/ftc/Derivative/derivative_imp_inc'.con". + +(*#* +Any function that is or has a derivative is continuous. +*) + +alias id "Hab''" = "cic:/CoRN/ftc/Derivative/Basic_Properties/Hab''.var". + +inline "cic:/CoRN/ftc/Derivative/deriv_imp_contin'_I.con". + +inline "cic:/CoRN/ftc/Derivative/deriv_imp_contin_I.con". + +(* UNEXPORTED +End Basic_Properties +*) + +(*#* +If [G] is the derivative of [F] in a given interval, then [G] is also the derivative of [F] in any smaller interval. +*) + +inline "cic:/CoRN/ftc/Derivative/included_imp_deriv.con". + diff --git a/matita/contribs/CoRN-Decl/ftc/DerivativeOps.ma b/matita/contribs/CoRN-Decl/ftc/DerivativeOps.ma new file mode 100644 index 000000000..bd3023428 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/DerivativeOps.ma @@ -0,0 +1,235 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/DerivativeOps". + +include "CoRN.ma". + +(* $Id: DerivativeOps.v,v 1.3 2004/04/23 10:00:58 lcf Exp $ *) + +include "ftc/Derivative.ma". + +(* UNEXPORTED +Section Lemmas +*) + +(*#* **Algebraic Operations + +We will now prove the main results about deriving functions built from +the algebraic operators#. #%\footnote{%Composition presents some +tricky questions, and is therefore discussed in a separated +context.%}.% + +[F'] and [G'] will be the derivatives, respectively, of [F] and [G]. + +We begin with some technical stuff that will be necessary for division. +*) + +alias id "a" = "cic:/CoRN/ftc/DerivativeOps/Lemmas/a.var". + +alias id "b" = "cic:/CoRN/ftc/DerivativeOps/Lemmas/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/DerivativeOps/Lemmas/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/DerivativeOps/Lemmas/I.con" "Lemmas__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/DerivativeOps/Lemmas/F.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/DerivativeOps/Lemmas/P.con" "Lemmas__". + +(* end hide *) + +(* begin show *) + +alias id "Fbnd" = "cic:/CoRN/ftc/DerivativeOps/Lemmas/Fbnd.var". + +(* end show *) + +inline "cic:/CoRN/ftc/DerivativeOps/bnd_away_zero_square.con". + +(* UNEXPORTED +End Lemmas +*) + +(* UNEXPORTED +Hint Resolve bnd_away_zero_square: included. +*) + +(* UNEXPORTED +Section Local_Results +*) + +(*#* **Local Results + +We can now derive all the usual rules for deriving constant and identity functions, sums, inverses and products of functions with a known derivative. +*) + +alias id "a" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/a.var". + +alias id "b" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/DerivativeOps/Local_Results/Hab.con" "Local_Results__". + +inline "cic:/CoRN/ftc/DerivativeOps/Local_Results/I.con" "Local_Results__". + +(* end hide *) + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_const.con". + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_id.con". + +alias id "F" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/F.var". + +alias id "F'" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/F'.var". + +alias id "G" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/G.var". + +alias id "G'" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/G'.var". + +alias id "derF" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/derF.var". + +alias id "derG" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/derG.var". + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_plus.con". + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_inv.con". + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_mult.con". + +(*#* +As was the case for continuity, the rule for the reciprocal function has a side condition. +*) + +(* begin show *) + +alias id "Fbnd" = "cic:/CoRN/ftc/DerivativeOps/Local_Results/Fbnd.var". + +(* end show *) + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_recip.con". + +(* UNEXPORTED +End Local_Results +*) + +(* UNEXPORTED +Hint Immediate derivative_imp_inc derivative_imp_inc': included. +*) + +(* UNEXPORTED +Hint Resolve Derivative_I_const Derivative_I_id Derivative_I_plus + Derivative_I_inv Derivative_I_mult Derivative_I_recip: derivate. +*) + +(* UNEXPORTED +Section Corolaries +*) + +alias id "a" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/a.var". + +alias id "b" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/DerivativeOps/Corolaries/Hab.con" "Corolaries__". + +inline "cic:/CoRN/ftc/DerivativeOps/Corolaries/I.con" "Corolaries__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/F.var". + +alias id "F'" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/F'.var". + +alias id "G" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/G.var". + +alias id "G'" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/G'.var". + +alias id "derF" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/derF.var". + +alias id "derG" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/derG.var". + +(*#* +From this lemmas the rules for the other algebraic operations follow directly. +*) + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_minus.con". + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_scal.con". + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_nth.con". + +alias id "Gbnd" = "cic:/CoRN/ftc/DerivativeOps/Corolaries/Gbnd.var". + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_div.con". + +(* UNEXPORTED +End Corolaries +*) + +(* UNEXPORTED +Hint Resolve Derivative_I_minus Derivative_I_nth Derivative_I_scal + Derivative_I_div: derivate. +*) + +(* UNEXPORTED +Section Derivative_Sums +*) + +(*#* The derivation rules for families of functions are easily proved by +induction using the constant and addition rules. +*) + +alias id "a" = "cic:/CoRN/ftc/DerivativeOps/Derivative_Sums/a.var". + +alias id "b" = "cic:/CoRN/ftc/DerivativeOps/Derivative_Sums/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/DerivativeOps/Derivative_Sums/Hab.var". + +alias id "Hab'" = "cic:/CoRN/ftc/DerivativeOps/Derivative_Sums/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_Sums/I.con" "Derivative_Sums__". + +(* end hide *) + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_Sum0.con". + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_Sumx.con". + +inline "cic:/CoRN/ftc/DerivativeOps/Derivative_I_Sum.con". + +(* UNEXPORTED +End Derivative_Sums +*) + +(* UNEXPORTED +Hint Resolve Derivative_I_Sum0 Derivative_I_Sum Derivative_I_Sumx: derivate. +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/Differentiability.ma b/matita/contribs/CoRN-Decl/ftc/Differentiability.ma new file mode 100644 index 000000000..812a91e02 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/Differentiability.ma @@ -0,0 +1,275 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/Differentiability". + +include "CoRN.ma". + +(* $Id: Differentiability.v,v 1.5 2004/04/20 22:38:49 hinderer Exp $ *) + +include "ftc/PartInterval.ma". + +include "ftc/DerivativeOps.ma". + +(* UNEXPORTED +Section Definitions +*) + +(*#* *Differentiability + +We will now use our work on derivatives to define a notion of +differentiable function and prove its main properties. + +%\begin{convention}% Throughout this section, [a,b] will be real +numbers with [a [<] b], [I] will denote the interval [[a,b]] +and [F,G,H] will be differentiable functions. +%\end{convention}% + +Usually a function [F] is said to be differentiable in a proper +compact interval [[a,b]] if there exists another function [F'] +such that [F'] is a derivative of [F] in that interval. There is a +problem in formalizing this definition, as we pointed out earlier on, +which is that if we simply write it down as is we are not able to get +such a function [F'] from a hypothesis that [F] is differentiable. + +However, it turns out that this is not altogether the best definition +for the following reason: if we say that [F] is differentiable in +[[a,b]], we mean that there is a partial function [F'] which is +defined in [[a,b]] and satisfies a certain condition in that +interval but nothing is required of the behaviour of the function +outside [[a,b]]. Thus we can argue that, from a mathematical +point of view, the [F'] that we get eliminating a hypothesis of +differentiability should be defined exactly on that interval. If we +do this, we can quantify over the set of setoid functions in that +interval and eliminate the existencial quantifier without any +problems. +*) + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Implicit Arguments Diffble_I [a b]. +*) + +(* UNEXPORTED +Section Local_Properties +*) + +(*#* +From this point on, we just prove results analogous to the ones for derivability. + +A function differentiable in [[a,b]] is differentiable in every proper compact subinterval of [[a,b]]. +*) + +inline "cic:/CoRN/ftc/Differentiability/included_imp_diffble.con". + +(*#* +A function differentiable in an interval is everywhere defined in that interval. +*) + +alias id "a" = "cic:/CoRN/ftc/Differentiability/Local_Properties/a.var". + +alias id "b" = "cic:/CoRN/ftc/Differentiability/Local_Properties/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Differentiability/Local_Properties/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Differentiability/Local_Properties/Hab.con" "Local_Properties__". + +inline "cic:/CoRN/ftc/Differentiability/Local_Properties/I.con" "Local_Properties__". + +(* end hide *) + +inline "cic:/CoRN/ftc/Differentiability/diffble_imp_inc.con". + +(*#* +If a function has a derivative in an interval then it is differentiable in that interval. +*) + +inline "cic:/CoRN/ftc/Differentiability/deriv_imp_Diffble_I.con". + +(* UNEXPORTED +End Local_Properties +*) + +(* UNEXPORTED +Hint Resolve diffble_imp_inc: included. +*) + +(* UNEXPORTED +Section Operations +*) + +(*#* +All the algebraic results carry on. +*) + +alias id "a" = "cic:/CoRN/ftc/Differentiability/Operations/a.var". + +alias id "b" = "cic:/CoRN/ftc/Differentiability/Operations/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Differentiability/Operations/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Differentiability/Operations/Hab.con" "Operations__". + +inline "cic:/CoRN/ftc/Differentiability/Operations/I.con" "Operations__". + +(* end hide *) + +(* UNEXPORTED +Section Constants +*) + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_const.con". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_id.con". + +(* UNEXPORTED +End Constants +*) + +(* UNEXPORTED +Section Well_Definedness +*) + +alias id "F" = "cic:/CoRN/ftc/Differentiability/Operations/Well_Definedness/F.var". + +alias id "H" = "cic:/CoRN/ftc/Differentiability/Operations/Well_Definedness/H.var". + +alias id "diffF" = "cic:/CoRN/ftc/Differentiability/Operations/Well_Definedness/diffF.var". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_wd.con". + +(* UNEXPORTED +End Well_Definedness +*) + +alias id "F" = "cic:/CoRN/ftc/Differentiability/Operations/F.var". + +alias id "G" = "cic:/CoRN/ftc/Differentiability/Operations/G.var". + +alias id "diffF" = "cic:/CoRN/ftc/Differentiability/Operations/diffF.var". + +alias id "diffG" = "cic:/CoRN/ftc/Differentiability/Operations/diffG.var". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_plus.con". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_inv.con". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_mult.con". + +(* begin show *) + +alias id "Gbnd" = "cic:/CoRN/ftc/Differentiability/Operations/Gbnd.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_recip.con". + +(* UNEXPORTED +End Operations +*) + +(* UNEXPORTED +Section Corollaries +*) + +alias id "a" = "cic:/CoRN/ftc/Differentiability/Corollaries/a.var". + +alias id "b" = "cic:/CoRN/ftc/Differentiability/Corollaries/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Differentiability/Corollaries/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Differentiability/Corollaries/Hab.con" "Corollaries__". + +inline "cic:/CoRN/ftc/Differentiability/Corollaries/I.con" "Corollaries__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/Differentiability/Corollaries/F.var". + +alias id "G" = "cic:/CoRN/ftc/Differentiability/Corollaries/G.var". + +alias id "diffF" = "cic:/CoRN/ftc/Differentiability/Corollaries/diffF.var". + +alias id "diffG" = "cic:/CoRN/ftc/Differentiability/Corollaries/diffG.var". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_minus.con". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_scal.con". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_nth.con". + +alias id "Gbnd" = "cic:/CoRN/ftc/Differentiability/Corollaries/Gbnd.var". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_div.con". + +(* UNEXPORTED +End Corollaries +*) + +(* UNEXPORTED +Section Other_Properties +*) + +(*#* +Differentiability of families of functions is proved by +induction using the constant and addition rules. +*) + +alias id "a" = "cic:/CoRN/ftc/Differentiability/Other_Properties/a.var". + +alias id "b" = "cic:/CoRN/ftc/Differentiability/Other_Properties/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Differentiability/Other_Properties/Hab'.var". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_Sum0.con". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_Sumx.con". + +inline "cic:/CoRN/ftc/Differentiability/Diffble_I_Sum.con". + +(* UNEXPORTED +End Other_Properties +*) + +(*#* +Finally, a differentiable function is continuous. + +%\begin{convention}% Let [F] be a partial function with derivative [F'] on [I]. +%\end{convention}% +*) + +inline "cic:/CoRN/ftc/Differentiability/diffble_imp_contin_I.con". + +(* UNEXPORTED +Hint Immediate included_imp_contin deriv_imp_contin_I deriv_imp_contin'_I + diffble_imp_contin_I: continuous. +*) + +(* UNEXPORTED +Hint Immediate included_imp_deriv: derivate. +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/FTC.ma b/matita/contribs/CoRN-Decl/ftc/FTC.ma new file mode 100644 index 000000000..481eb2b3b --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/FTC.ma @@ -0,0 +1,373 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/FTC". + +include "CoRN.ma". + +(* $Id: FTC.v,v 1.5 2004/04/23 10:00:58 lcf Exp $ *) + +(*#* printing [-S-] %\ensuremath{\int}% #∫# *) + +include "ftc/MoreIntegrals.ma". + +include "ftc/CalculusTheorems.ma". + +(* UNEXPORTED +Opaque Min. +*) + +(* UNEXPORTED +Section Indefinite_Integral +*) + +(*#* *The Fundamental Theorem of Calculus + +Finally we can prove the fundamental theorem of calculus and its most +important corollaries, which are the main tools to formalize most of +real analysis. + +**Indefinite Integrals + +We define the indefinite integral of a function in a proper interval +in the obvious way; we just need to state a first lemma so that the +continuity proofs become unnecessary. + +%\begin{convention}% Let [I : interval], [F : PartIR] be continuous in [I] +and [a] be a point in [I]. +%\end{convention}% +*) + +alias id "I" = "cic:/CoRN/ftc/FTC/Indefinite_Integral/I.var". + +alias id "F" = "cic:/CoRN/ftc/FTC/Indefinite_Integral/F.var". + +alias id "contF" = "cic:/CoRN/ftc/FTC/Indefinite_Integral/contF.var". + +alias id "a" = "cic:/CoRN/ftc/FTC/Indefinite_Integral/a.var". + +alias id "Ha" = "cic:/CoRN/ftc/FTC/Indefinite_Integral/Ha.var". + +inline "cic:/CoRN/ftc/FTC/prim_lemma.con". + +inline "cic:/CoRN/ftc/FTC/Fprim_strext.con". + +inline "cic:/CoRN/ftc/FTC/Fprim.con". + +(* UNEXPORTED +End Indefinite_Integral +*) + +(* UNEXPORTED +Implicit Arguments Fprim [I F]. +*) + +(* NOTATION +Notation "[-S-] F" := (Fprim F) (at level 20). +*) + +(* UNEXPORTED +Section FTC +*) + +(*#* **The FTC + +We can now prove our main theorem. We begin by remarking that the +primitive function is always continuous. + +%\begin{convention}% Assume that [J : interval], [F : PartIR] is +continuous in [J] and [x0] is a point in [J]. Denote by [G] the +indefinite integral of [F] from [x0]. +%\end{convention}% +*) + +alias id "J" = "cic:/CoRN/ftc/FTC/FTC/J.var". + +alias id "F" = "cic:/CoRN/ftc/FTC/FTC/F.var". + +alias id "contF" = "cic:/CoRN/ftc/FTC/FTC/contF.var". + +alias id "x0" = "cic:/CoRN/ftc/FTC/FTC/x0.var". + +alias id "Hx0" = "cic:/CoRN/ftc/FTC/FTC/Hx0.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FTC/FTC/G.con" "FTC__". + +(* end hide *) + +inline "cic:/CoRN/ftc/FTC/Continuous_prim.con". + +(*#* +The derivative of [G] is simply [F]. +*) + +alias id "pJ" = "cic:/CoRN/ftc/FTC/FTC/pJ.var". + +inline "cic:/CoRN/ftc/FTC/FTC1.con". + +(*#* +Any other function [G0] with derivative [F] must differ from [G] by a constant. +*) + +alias id "G0" = "cic:/CoRN/ftc/FTC/FTC/G0.var". + +alias id "derG0" = "cic:/CoRN/ftc/FTC/FTC/derG0.var". + +inline "cic:/CoRN/ftc/FTC/FTC2.con". + +(*#* +The following is another statement of the Fundamental Theorem of Calculus, also known as Barrow's rule. +*) + +(* begin hide *) + +inline "cic:/CoRN/ftc/FTC/FTC/G0_inc.con" "FTC__". + +(* end hide *) + +(* UNEXPORTED +Opaque G. +*) + +inline "cic:/CoRN/ftc/FTC/Barrow.con". + +(* end hide *) + +(* UNEXPORTED +End FTC +*) + +(* UNEXPORTED +Hint Resolve Continuous_prim: continuous. +*) + +(* UNEXPORTED +Hint Resolve FTC1: derivate. +*) + +(* UNEXPORTED +Section Limit_of_Integral_Seq +*) + +(*#* **Corollaries + +With these tools in our hand, we can prove several useful results. + +%\begin{convention}% From this point onwards: + - [J : interval]; + - [f : nat->PartIR] is a sequence of continuous functions (in [J]); + - [F : PartIR] is continuous in [J]. + +%\end{convention}% + +In the first place, if a sequence of continuous functions converges +then the sequence of their primitives also converges, and the limit +commutes with the indefinite integral. +*) + +alias id "J" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/J.var". + +alias id "f" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/f.var". + +alias id "F" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/F.var". + +alias id "contf" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/contf.var". + +alias id "contF" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/contF.var". + +(* UNEXPORTED +Section Compact +*) + +(*#* +We need to prove this result first for compact intervals. + +%\begin{convention}% Assume that [a, b, x0 : IR] with [(f n)] and [F] +continuous in [[a,b]], $x0\in[a,b]$#x0∈[a,b]#; denote by +[(g n)] and [G] the indefinite integrals respectively of [(f n)] and +[F] with origin [x0]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/a.var". + +alias id "b" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/Hab.var". + +alias id "contIf" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/contIf.var". + +alias id "contIF" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/contIF.var". + +(* begin show *) + +alias id "convF" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/convF.var". + +(* end show *) + +alias id "x0" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/x0.var". + +alias id "Hx0" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/Hx0.var". + +alias id "Hx0'" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/Hx0'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/g.con" "Limit_of_Integral_Seq__Compact__". + +inline "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/G.con" "Limit_of_Integral_Seq__Compact__". + +(* end hide *) + +(* begin show *) + +alias id "contg" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/contg.var". + +alias id "contG" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/Compact/contG.var". + +(* end show *) + +inline "cic:/CoRN/ftc/FTC/fun_lim_seq_integral.con". + +(* UNEXPORTED +End Compact +*) + +(*#* +And now we can generalize it step by step. +*) + +inline "cic:/CoRN/ftc/FTC/limit_of_integral.con". + +inline "cic:/CoRN/ftc/FTC/limit_of_Integral.con". + +(* UNEXPORTED +Section General +*) + +(*#* +Finally, with [x0, g, G] as before, +*) + +(* begin show *) + +alias id "convF" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/General/convF.var". + +(* end show *) + +alias id "x0" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/General/x0.var". + +alias id "Hx0" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/General/Hx0.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/General/g.con" "Limit_of_Integral_Seq__General__". + +inline "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/General/G.con" "Limit_of_Integral_Seq__General__". + +(* end hide *) + +alias id "contg" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/General/contg.var". + +alias id "contG" = "cic:/CoRN/ftc/FTC/Limit_of_Integral_Seq/General/contG.var". + +inline "cic:/CoRN/ftc/FTC/fun_lim_seq_integral_IR.con". + +(* UNEXPORTED +End General +*) + +(* UNEXPORTED +End Limit_of_Integral_Seq +*) + +(* UNEXPORTED +Section Limit_of_Derivative_Seq +*) + +(*#* +Similar results hold for the sequence of derivatives of a converging sequence; this time the proof is easier, as we can do it directly for any kind of interval. + +%\begin{convention}% Let [g] be the sequence of derivatives of [f] and [G] be the derivative of [F]. +%\end{convention}% +*) + +alias id "J" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/J.var". + +alias id "pJ" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/pJ.var". + +alias id "f" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/f.var". + +alias id "g" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/g.var". + +alias id "F" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/F.var". + +alias id "G" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/G.var". + +alias id "contf" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/contf.var". + +alias id "contF" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/contF.var". + +alias id "convF" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/convF.var". + +alias id "contg" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/contg.var". + +alias id "contG" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/contG.var". + +alias id "convG" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/convG.var". + +alias id "derf" = "cic:/CoRN/ftc/FTC/Limit_of_Derivative_Seq/derf.var". + +inline "cic:/CoRN/ftc/FTC/fun_lim_seq_derivative.con". + +(* UNEXPORTED +End Limit_of_Derivative_Seq +*) + +(* UNEXPORTED +Section Derivative_Series +*) + +(*#* +As a very important case of this result, we get a rule for deriving series. +*) + +alias id "J" = "cic:/CoRN/ftc/FTC/Derivative_Series/J.var". + +alias id "pJ" = "cic:/CoRN/ftc/FTC/Derivative_Series/pJ.var". + +alias id "f" = "cic:/CoRN/ftc/FTC/Derivative_Series/f.var". + +alias id "g" = "cic:/CoRN/ftc/FTC/Derivative_Series/g.var". + +(* begin show *) + +alias id "convF" = "cic:/CoRN/ftc/FTC/Derivative_Series/convF.var". + +alias id "convG" = "cic:/CoRN/ftc/FTC/Derivative_Series/convG.var". + +(* end show *) + +alias id "derF" = "cic:/CoRN/ftc/FTC/Derivative_Series/derF.var". + +inline "cic:/CoRN/ftc/FTC/Derivative_FSeries.con". + +(* UNEXPORTED +End Derivative_Series +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/FunctSequence.ma b/matita/contribs/CoRN-Decl/ftc/FunctSequence.ma new file mode 100644 index 000000000..34bd794f4 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/FunctSequence.ma @@ -0,0 +1,506 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/FunctSequence". + +include "CoRN.ma". + +(* $Id: FunctSequence.v,v 1.5 2004/04/23 10:00:58 lcf Exp $ *) + +include "ftc/Continuity.ma". + +include "ftc/PartInterval.ma". + +(* UNEXPORTED +Section Definitions +*) + +(*#* *Sequences of Functions + +In this file we define some more operators on functions, namely +sequences and limits. These concepts are defined only for continuous +functions. + +%\begin{convention}% Throughout this section: + - [a] and [b] will be real numbers and the interval [[a,b]] +will be denoted by [I]; + - [f, g] and [h] will denote sequences of continuous functions; + - [F, G] and [H] will denote continuous functions. + +%\end{convention}% + +**Definitions + +A sequence of functions is simply an object of type [nat->PartIR]. +However, we will be interested mostly in convergent and Cauchy +sequences. Several definitions of these concepts will be formalized; +they mirror the several different ways in which a Cauchy sequence can +be defined. For a discussion on the different notions of convergent +see Bishop 1967. +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSequence/Definitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSequence/Definitions/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSequence/Definitions/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSequence/Definitions/I.con" "Definitions__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSequence/Definitions/f.var". + +alias id "F" = "cic:/CoRN/ftc/FunctSequence/Definitions/F.var". + +alias id "contf" = "cic:/CoRN/ftc/FunctSequence/Definitions/contf.var". + +alias id "contF" = "cic:/CoRN/ftc/FunctSequence/Definitions/contF.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSequence/Definitions/incf.con" "Definitions__". + +inline "cic:/CoRN/ftc/FunctSequence/Definitions/incF.con" "Definitions__". + +(* end hide *) + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_seq'.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_norm_fun_seq.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq1.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq'.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq2.con". + +(*#* +These definitions are all shown to be equivalent. +*) + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq_seq'.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq'_seq.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_Cauchy_fun_seq'.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq_seq2.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq2_seq.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_seq'_norm.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_norm_seq.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq1_seq'.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq'_seq1.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq_seq1.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq1_seq.con". + +(*#* +A Cauchy sequence of functions is pointwise a Cauchy sequence. +*) + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_real.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Section More_Definitions +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSequence/More_Definitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSequence/More_Definitions/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSequence/More_Definitions/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSequence/More_Definitions/I.con" "More_Definitions__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSequence/More_Definitions/f.var". + +alias id "contf" = "cic:/CoRN/ftc/FunctSequence/More_Definitions/contf.var". + +(*#* +We can also say that [f] is simply convergent if it converges to some +continuous function. Notice that we do not quantify directly over +partial functions, for reasons which were already explained. +*) + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_seq.con". + +(*#* +It is useful to extract the limit as a partial function: +*) + +(* begin show *) + +alias id "H" = "cic:/CoRN/ftc/FunctSequence/More_Definitions/H.var". + +(* end show *) + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq_Lim.con". + +(* UNEXPORTED +End More_Definitions +*) + +(* UNEXPORTED +Section Irrelevance_of_Proofs +*) + +(*#* **Irrelevance of Proofs + +This section contains a number of technical results stating mainly that being a Cauchy sequence or converging to some limit is a property of the sequence itself and independent of the proofs we supply of its continuity or the continuity of its limit. +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/I.con" "Irrelevance_of_Proofs__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/f.var". + +(* begin show *) + +alias id "contf" = "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/contf.var". + +alias id "contf0" = "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/contf0.var". + +(* end show *) + +alias id "F" = "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/F.var". + +(* begin show *) + +alias id "contF" = "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/contF.var". + +alias id "contF0" = "cic:/CoRN/ftc/FunctSequence/Irrelevance_of_Proofs/contF0.var". + +(* end show *) + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_seq'_wd.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq'_wd.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq2_wd.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_norm_fun_seq_wd.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq1_wd.con". + +(* UNEXPORTED +End Irrelevance_of_Proofs +*) + +(* UNEXPORTED +Section More_Proof_Irrelevance +*) + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_seq_wd.con". + +(* UNEXPORTED +End More_Proof_Irrelevance +*) + +(* UNEXPORTED +Section More_Properties +*) + +(*#* **Other Properties + +Still more technical details---a convergent sequence converges to its +limit; the limit is a continuous function; and convergence is well +defined with respect to functional equality in the interval [[a,b]]. +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSequence/More_Properties/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSequence/More_Properties/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSequence/More_Properties/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSequence/More_Properties/I.con" "More_Properties__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSequence/More_Properties/f.var". + +alias id "g" = "cic:/CoRN/ftc/FunctSequence/More_Properties/g.var". + +(* begin show *) + +alias id "contf" = "cic:/CoRN/ftc/FunctSequence/More_Properties/contf.var". + +alias id "contf0" = "cic:/CoRN/ftc/FunctSequence/More_Properties/contf0.var". + +alias id "contg" = "cic:/CoRN/ftc/FunctSequence/More_Properties/contg.var". + +alias id "contg0" = "cic:/CoRN/ftc/FunctSequence/More_Properties/contg0.var". + +(* end show *) + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_conv_fun_seq'.con". + +alias id "F" = "cic:/CoRN/ftc/FunctSequence/More_Properties/F.var". + +alias id "G" = "cic:/CoRN/ftc/FunctSequence/More_Properties/G.var". + +(* begin show *) + +alias id "contF" = "cic:/CoRN/ftc/FunctSequence/More_Properties/contF.var". + +alias id "contF0" = "cic:/CoRN/ftc/FunctSequence/More_Properties/contF0.var". + +alias id "contG" = "cic:/CoRN/ftc/FunctSequence/More_Properties/contG.var". + +alias id "contG0" = "cic:/CoRN/ftc/FunctSequence/More_Properties/contG0.var". + +(* end show *) + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_seq'_wdl.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_seq'_wdr.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_seq'_wdl'.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_fun_seq'_wdr'.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_fun_seq_wd.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_cont_Lim.con". + +inline "cic:/CoRN/ftc/FunctSequence/Cauchy_conv_fun_seq.con". + +inline "cic:/CoRN/ftc/FunctSequence/conv_Cauchy_fun_seq.con". + +(*#* +More interesting is the fact that a convergent sequence of functions converges pointwise as a sequence of real numbers. +*) + +inline "cic:/CoRN/ftc/FunctSequence/fun_conv_imp_seq_conv.con". + +(*#* +And a sequence of real numbers converges iff the corresponding sequence of constant functions converges to the corresponding constant function. +*) + +inline "cic:/CoRN/ftc/FunctSequence/seq_conv_imp_fun_conv.con". + +(* UNEXPORTED +End More_Properties +*) + +(* UNEXPORTED +Hint Resolve Cauchy_cont_Lim: continuous. +*) + +(* UNEXPORTED +Section Algebraic_Properties +*) + +(*#* **Algebraic Properties + +We now study how convergence is affected by algebraic operations, and some algebraic properties of the limit function. +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/I.con" "Algebraic_Properties__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/f.var". + +alias id "g" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/g.var". + +alias id "contf" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/contf.var". + +alias id "contg" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/contg.var". + +(*#* +First, the limit function is unique. +*) + +inline "cic:/CoRN/ftc/FunctSequence/FLim_unique.con". + +(*#* Constant sequences (not sequences of constant functions!) always converge. +*) + +inline "cic:/CoRN/ftc/FunctSequence/fun_Lim_seq_const.con". + +inline "cic:/CoRN/ftc/FunctSequence/fun_Cauchy_prop_const.con". + +(*#* +We now prove that if two sequences converge than their sum (difference, product) also converge to the sum (difference, product) of their limits. +*) + +alias id "F" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/F.var". + +alias id "G" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/G.var". + +alias id "contF" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/contG.var". + +(* begin show *) + +alias id "convF" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/convF.var". + +alias id "convG" = "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/convG.var". + +(* end show *) + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/incf.con" "Algebraic_Properties__". + +inline "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/incg.con" "Algebraic_Properties__". + +inline "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/incF.con" "Algebraic_Properties__". + +inline "cic:/CoRN/ftc/FunctSequence/Algebraic_Properties/incG.con" "Algebraic_Properties__". + +(* end hide *) + +inline "cic:/CoRN/ftc/FunctSequence/fun_Lim_seq_plus'.con". + +inline "cic:/CoRN/ftc/FunctSequence/fun_Lim_seq_minus'.con". + +inline "cic:/CoRN/ftc/FunctSequence/fun_Lim_seq_mult'.con". + +(* UNEXPORTED +End Algebraic_Properties +*) + +(* UNEXPORTED +Section More_Algebraic_Properties +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/I.con" "More_Algebraic_Properties__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/f.var". + +alias id "g" = "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/g.var". + +alias id "contf" = "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/contf.var". + +alias id "contg" = "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/contg.var". + +(*#* +The same is true if we don't make the limits explicit. +*) + +(* begin hide *) + +alias id "Hf" = "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/Hf.var". + +alias id "Hg" = "cic:/CoRN/ftc/FunctSequence/More_Algebraic_Properties/Hg.var". + +(* end hide *) + +inline "cic:/CoRN/ftc/FunctSequence/fun_Lim_seq_plus.con". + +inline "cic:/CoRN/ftc/FunctSequence/fun_Cauchy_prop_plus.con". + +inline "cic:/CoRN/ftc/FunctSequence/fun_Lim_seq_minus.con". + +inline "cic:/CoRN/ftc/FunctSequence/fun_Cauchy_prop_minus.con". + +inline "cic:/CoRN/ftc/FunctSequence/fun_Lim_seq_mult.con". + +inline "cic:/CoRN/ftc/FunctSequence/fun_Cauchy_prop_mult.con". + +(* UNEXPORTED +End More_Algebraic_Properties +*) + +(* UNEXPORTED +Section Still_More_Algebraic_Properties +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSequence/Still_More_Algebraic_Properties/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSequence/Still_More_Algebraic_Properties/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSequence/Still_More_Algebraic_Properties/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSequence/Still_More_Algebraic_Properties/I.con" "Still_More_Algebraic_Properties__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSequence/Still_More_Algebraic_Properties/f.var". + +alias id "contf" = "cic:/CoRN/ftc/FunctSequence/Still_More_Algebraic_Properties/contf.var". + +alias id "Hf" = "cic:/CoRN/ftc/FunctSequence/Still_More_Algebraic_Properties/Hf.var". + +(*#* +As a corollary, we get the analogous property for the sequence of algebraic inverse functions. +*) + +inline "cic:/CoRN/ftc/FunctSequence/fun_Lim_seq_inv.con". + +inline "cic:/CoRN/ftc/FunctSequence/fun_Cauchy_prop_inv.con". + +(* UNEXPORTED +End Still_More_Algebraic_Properties +*) + +(* UNEXPORTED +Hint Resolve Continuous_I_Sum Continuous_I_Sumx Continuous_I_Sum0: continuous. +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/FunctSeries.ma b/matita/contribs/CoRN-Decl/ftc/FunctSeries.ma new file mode 100644 index 000000000..917cbe2bc --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/FunctSeries.ma @@ -0,0 +1,366 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/FunctSeries". + +include "CoRN.ma". + +(* $Id: FunctSeries.v,v 1.6 2004/04/23 10:00:58 lcf Exp $ *) + +include "ftc/FunctSequence.ma". + +include "reals/Series.ma". + +(*#* printing fun_seq_part_sum %\ensuremath{\sum^n}% #∑n# *) + +(*#* printing Fun_Series_Sum %\ensuremath{\sum_0^{\infty}}% #∑0# *) + +(* UNEXPORTED +Section Definitions +*) + +(*#* *Series of Functions + +We now turn our attention to series of functions. Like it was already +the case for sequences, we will mainly rewrite the results we proved +for series of real numbers in a different way. + +%\begin{convention}% Throughout this section: + - [a] and [b] will be real numbers and the interval [[a,b]] will be denoted +by [I]; + - [f, g] and [h] will denote sequences of continuous functions; + - [F, G] and [H] will denote continuous functions. + +%\end{convention}% + +** Definitions + +As before, we will consider only sequences of continuous functions +defined in a compact interval. For this, partial sums are defined and +convergence is simply the convergence of the sequence of partial sums. +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSeries/Definitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSeries/Definitions/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSeries/Definitions/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSeries/Definitions/I.con" "Definitions__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSeries/Definitions/f.var". + +inline "cic:/CoRN/ftc/FunctSeries/fun_seq_part_sum.con". + +inline "cic:/CoRN/ftc/FunctSeries/fun_seq_part_sum_cont.con". + +inline "cic:/CoRN/ftc/FunctSeries/fun_series_convergent.con". + +(*#* +For what comes up next we need to know that the convergence of a +series of functions implies pointwise convergence of the corresponding +real number series. +*) + +inline "cic:/CoRN/ftc/FunctSeries/fun_series_conv_imp_conv.con". + +(*#* We then define the sum of the series as being the pointwise sum of +the corresponding series. +*) + +(* begin show *) + +alias id "H" = "cic:/CoRN/ftc/FunctSeries/Definitions/H.var". + +(* end show *) + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSeries/Definitions/contf.con" "Definitions__". + +inline "cic:/CoRN/ftc/FunctSeries/Definitions/incf.con" "Definitions__". + +(* end hide *) + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_strext.con". + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Implicit Arguments Fun_Series_Sum [a b Hab f]. +*) + +(* UNEXPORTED +Hint Resolve fun_seq_part_sum_cont: continuous. +*) + +(* UNEXPORTED +Section More_Definitions +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSeries/More_Definitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSeries/More_Definitions/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSeries/More_Definitions/Hab.var". + +alias id "f" = "cic:/CoRN/ftc/FunctSeries/More_Definitions/f.var". + +(*#* A series can also be absolutely convergent. *) + +inline "cic:/CoRN/ftc/FunctSeries/fun_series_abs_convergent.con". + +(* UNEXPORTED +End More_Definitions +*) + +(* UNEXPORTED +Section Operations +*) + +(* **Algebraic Properties + +All of these are analogous to the properties for series of real numbers, so we won't comment much about them. +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSeries/Operations/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSeries/Operations/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSeries/Operations/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSeries/Operations/I.con" "Operations__". + +(* end hide *) + +inline "cic:/CoRN/ftc/FunctSeries/fun_seq_part_sum_n.con". + +inline "cic:/CoRN/ftc/FunctSeries/conv_fun_const_series.con". + +inline "cic:/CoRN/ftc/FunctSeries/fun_const_series_sum.con". + +inline "cic:/CoRN/ftc/FunctSeries/conv_zero_fun_series.con". + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_zero.con". + +(* begin show *) + +alias id "f" = "cic:/CoRN/ftc/FunctSeries/Operations/f.var". + +alias id "g" = "cic:/CoRN/ftc/FunctSeries/Operations/g.var". + +(* end show *) + +inline "cic:/CoRN/ftc/FunctSeries/fun_series_convergent_wd.con". + +(* begin show *) + +alias id "convF" = "cic:/CoRN/ftc/FunctSeries/Operations/convF.var". + +alias id "convG" = "cic:/CoRN/ftc/FunctSeries/Operations/convG.var". + +(* end show *) + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_wd'.con". + +inline "cic:/CoRN/ftc/FunctSeries/conv_fun_series_plus.con". + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_plus.con". + +inline "cic:/CoRN/ftc/FunctSeries/conv_fun_series_minus.con". + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_min.con". + +(*#* +%\begin{convention}% Let [c:IR]. +%\end{convention}% +*) + +alias id "c" = "cic:/CoRN/ftc/FunctSeries/Operations/c.var". + +alias id "H" = "cic:/CoRN/ftc/FunctSeries/Operations/H.var". + +alias id "contH" = "cic:/CoRN/ftc/FunctSeries/Operations/contH.var". + +inline "cic:/CoRN/ftc/FunctSeries/conv_fun_series_scal.con". + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_scal.con". + +(* UNEXPORTED +End Operations +*) + +(* UNEXPORTED +Section More_Operations +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSeries/More_Operations/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSeries/More_Operations/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSeries/More_Operations/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSeries/More_Operations/I.con" "More_Operations__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSeries/More_Operations/f.var". + +alias id "convF" = "cic:/CoRN/ftc/FunctSeries/More_Operations/convF.var". + +inline "cic:/CoRN/ftc/FunctSeries/conv_fun_series_inv.con". + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_inv.con". + +(* UNEXPORTED +End More_Operations +*) + +(* UNEXPORTED +Section Other_Results +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSeries/Other_Results/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSeries/Other_Results/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSeries/Other_Results/Hab.var". + +alias id "f" = "cic:/CoRN/ftc/FunctSeries/Other_Results/f.var". + +alias id "convF" = "cic:/CoRN/ftc/FunctSeries/Other_Results/convF.var". + +(*#* +The following relate the sum series with the limit of the sequence of +partial sums; as a corollary we get the continuity of the sum of the +series. +*) + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_char'.con". + +inline "cic:/CoRN/ftc/FunctSeries/fun_series_conv.con". + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_cont.con". + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_char.con". + +inline "cic:/CoRN/ftc/FunctSeries/Fun_Series_Sum_as_Lim.con". + +(* UNEXPORTED +End Other_Results +*) + +(* UNEXPORTED +Hint Resolve Fun_Series_Sum_cont: continuous. +*) + +(* UNEXPORTED +Section Convergence_Criteria +*) + +(*#* **Convergence Criteria + +Most of the convergence criteria for series of real numbers carry over to series of real-valued functions, so again we just present them without comments. +*) + +alias id "a" = "cic:/CoRN/ftc/FunctSeries/Convergence_Criteria/a.var". + +alias id "b" = "cic:/CoRN/ftc/FunctSeries/Convergence_Criteria/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/FunctSeries/Convergence_Criteria/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/FunctSeries/Convergence_Criteria/I.con" "Convergence_Criteria__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/FunctSeries/Convergence_Criteria/f.var". + +alias id "contF" = "cic:/CoRN/ftc/FunctSeries/Convergence_Criteria/contF.var". + +(* UNEXPORTED +Opaque Frestr. +*) + +(* UNEXPORTED +Transparent Frestr. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +(* UNEXPORTED +Opaque fun_seq_part_sum. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent fun_seq_part_sum. +*) + +(* UNEXPORTED +Opaque fun_seq_part_sum. +*) + +inline "cic:/CoRN/ftc/FunctSeries/fun_str_comparison.con". + +(* UNEXPORTED +Transparent FAbs. +*) + +inline "cic:/CoRN/ftc/FunctSeries/fun_comparison.con". + +inline "cic:/CoRN/ftc/FunctSeries/abs_imp_conv.con". + +(* UNEXPORTED +Opaque FAbs. +*) + +inline "cic:/CoRN/ftc/FunctSeries/fun_ratio_test_conv.con". + +(* UNEXPORTED +End Convergence_Criteria +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/FunctSums.ma b/matita/contribs/CoRN-Decl/ftc/FunctSums.ma new file mode 100644 index 000000000..aeed9200c --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/FunctSums.ma @@ -0,0 +1,165 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/FunctSums". + +include "CoRN.ma". + +(* $Id: FunctSums.v,v 1.5 2004/04/23 10:00:59 lcf Exp $ *) + +(*#* printing FSum0 %\ensuremath{\sum_0}% #∑0# *) + +(*#* printing FSum %\ensuremath{\sum}% #∑# *) + +(*#* printing FSumx %\ensuremath{\sum'}% #∑'&*) + +include "reals/CSumsReals.ma". + +include "ftc/PartFunEquality.ma". + +(*#* *Sums of Functions + +In this file we define sums are defined of arbitrary families of +partial functions. + +Given a countable family of functions, their sum is defined on the +intersection of all the domains. As is the case for groups, we will +define three different kinds of sums. + +We will first consider the case of a family +$\{f_i\}_{i\in\NN}$#{fi}# of functions; we can both define +$\sum_{i=0}^{n-1}f_i$#the sum of the first n functions# ( [FSum0]) or +$\sum_{i=m}^nf_i$#the sum of fm through fn# +( [FSum]). +*) + +inline "cic:/CoRN/ftc/FunctSums/FSum0.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum.con". + +(*#* +Although [FSum] is here defined directly, it has the same relationship +to the [FSum0] operator as [Sum] has to [Sum0]. Also, all the results +for [Sum] and [Sum0] hold when these operators are replaced by their +functional equivalents. This is an immediate consequence of the fact +that the partial functions form a group; however, as we already +mentioned, their forming too big a type makes it impossible to use +those results. +*) + +inline "cic:/CoRN/ftc/FunctSums/FSum_FSum0.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum0_wd.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_one.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_FSum.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_first.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_last.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_last'.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_wd.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_plus_FSum.con". + +inline "cic:/CoRN/ftc/FunctSums/inv_FSum.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_minus_FSum.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_wd'.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_resp_less.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_resp_leEq.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_comm_scal.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_comm_scal'.con". + +(*#* +Also important is the case when we have a finite family +$\{f_i\}_{i=0}^{n-1}$ of #exactly n# functions; in this case we need +to use the [FSumx] operator. +*) + +inline "cic:/CoRN/ftc/FunctSums/FSumx.con". + +(*#* +This operator is well defined, as expected. +*) + +inline "cic:/CoRN/ftc/FunctSums/FSumx_wd.con". + +inline "cic:/CoRN/ftc/FunctSums/FSumx_wd'.con". + +(*#* +As was already the case for [Sumx], in many cases we will need to +explicitly assume that $f_i$#f1# is independent of the proof that +[i [<] n]. This holds both for the value and the domain of the partial +function $f_i$#fi#. +*) + +inline "cic:/CoRN/ftc/FunctSums/ext_fun_seq.con". + +inline "cic:/CoRN/ftc/FunctSums/ext_fun_seq'.con". + +(* UNEXPORTED +Implicit Arguments ext_fun_seq [n]. +*) + +(* UNEXPORTED +Implicit Arguments ext_fun_seq' [n]. +*) + +(*#* +Under these assumptions, we can characterize the domain and the value of the sum function from the domains and values of the summands: +*) + +inline "cic:/CoRN/ftc/FunctSums/FSumx_pred.con". + +inline "cic:/CoRN/ftc/FunctSums/FSumx_pred'.con". + +inline "cic:/CoRN/ftc/FunctSums/FSumx_char.con". + +(*#* +As we did for arbitrary groups, it is often useful to rewrite this sums as ordinary sums. +*) + +inline "cic:/CoRN/ftc/FunctSums/FSumx_to_FSum.con". + +inline "cic:/CoRN/ftc/FunctSums/FSumx_lt.con". + +inline "cic:/CoRN/ftc/FunctSums/FSumx_le.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_FSumx_to_FSum.con". + +(*#* +Some useful lemmas follow. +*) + +inline "cic:/CoRN/ftc/FunctSums/FSum0_0.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum0_S.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_0.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_S.con". + +inline "cic:/CoRN/ftc/FunctSums/FSum_FSum0'.con". + diff --git a/matita/contribs/CoRN-Decl/ftc/Integral.ma b/matita/contribs/CoRN-Decl/ftc/Integral.ma new file mode 100644 index 000000000..4a8a41688 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/Integral.ma @@ -0,0 +1,496 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/Integral". + +include "CoRN.ma". + +(* $Id: Integral.v,v 1.10 2004/04/23 10:00:59 lcf Exp $ *) + +include "ftc/RefLemma.ma". + +(*#* printing integral %\ensuremath{\int_I}% #∫I# *) + +(*#* printing Integral %\ensuremath{\int_I}% #∫I# *) + +(* begin hide *) + +(* UNEXPORTED +Section Lemmas +*) + +inline "cic:/CoRN/ftc/Integral/Lemmas/Sumx_wd_weird.con" "Lemmas__". + +inline "cic:/CoRN/ftc/Integral/Sumx_weird_lemma.con". + +(* UNEXPORTED +End Lemmas +*) + +(* end hide *) + +(* UNEXPORTED +Section Integral +*) + +(*#* *Integral + +Having proved the main properties of partitions and refinements, we +will define the integral of a continuous function [F] in the interval +[[a,b]] as the limit of the sequence of Sums of $F$ for even +partitions of increasing number of points. + +%\begin{convention}% All throughout, [a,b] will be real numbers, the +interval [[a,b]] will be denoted by [I] and [F,G] will be +continuous functions in [I]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/Integral/Integral/a.var". + +alias id "b" = "cic:/CoRN/ftc/Integral/Integral/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Integral/Integral/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Integral/Integral/I.con" "Integral__". + +alias id "F" = "cic:/CoRN/ftc/Integral/Integral/F.var". + +alias id "contF" = "cic:/CoRN/ftc/Integral/Integral/contF.var". + +inline "cic:/CoRN/ftc/Integral/Integral/contF'.con" "Integral__". + +(* end hide *) + +(* UNEXPORTED +Section Darboux_Sum +*) + +inline "cic:/CoRN/ftc/Integral/integral_seq.con". + +inline "cic:/CoRN/ftc/Integral/Cauchy_Darboux_Seq.con". + +inline "cic:/CoRN/ftc/Integral/integral.con". + +(* UNEXPORTED +End Darboux_Sum +*) + +(* UNEXPORTED +Section Integral_Thm +*) + +(*#* +The following shows that in fact the integral of [F] is the limit of +any sequence of partitions of mesh converging to 0. + +%\begin{convention}% Let [e] be a positive real number and [P] be a +partition of [I] with [n] points and mesh smaller than the +modulus of continuity of [F] for [e]. Let [fP] be a choice of points +respecting [P]. +%\end{convention}% +*) + +alias id "n" = "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/n.var". + +alias id "P" = "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/P.var". + +alias id "e" = "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/e.var". + +alias id "He" = "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/He.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/d.con" "Integral__Integral_Thm__". + +(* end hide *) + +alias id "HmeshP" = "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/HmeshP.var". + +alias id "fP" = "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/fP.var". + +alias id "HfP" = "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/HfP.var". + +alias id "HfP'" = "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/HfP'.var". + +alias id "incF" = "cic:/CoRN/ftc/Integral/Integral/Integral_Thm/incF.var". + +inline "cic:/CoRN/ftc/Integral/partition_Sum_conv_integral.con". + +(* UNEXPORTED +End Integral_Thm +*) + +(* UNEXPORTED +End Integral +*) + +(* UNEXPORTED +Section Basic_Properties +*) + +(*#* +The usual extensionality and strong extensionality results hold. +*) + +alias id "a" = "cic:/CoRN/ftc/Integral/Basic_Properties/a.var". + +alias id "b" = "cic:/CoRN/ftc/Integral/Basic_Properties/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Integral/Basic_Properties/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Integral/Basic_Properties/I.con" "Basic_Properties__". + +(* end hide *) + +(* NOTATION +Notation Integral := (integral _ _ Hab). +*) + +(* UNEXPORTED +Section Well_Definedness +*) + +alias id "F" = "cic:/CoRN/ftc/Integral/Basic_Properties/Well_Definedness/F.var". + +alias id "G" = "cic:/CoRN/ftc/Integral/Basic_Properties/Well_Definedness/G.var". + +alias id "contF" = "cic:/CoRN/ftc/Integral/Basic_Properties/Well_Definedness/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/Integral/Basic_Properties/Well_Definedness/contG.var". + +inline "cic:/CoRN/ftc/Integral/integral_strext.con". + +inline "cic:/CoRN/ftc/Integral/integral_strext'.con". + +inline "cic:/CoRN/ftc/Integral/integral_wd.con". + +inline "cic:/CoRN/ftc/Integral/integral_wd'.con". + +(* UNEXPORTED +End Well_Definedness +*) + +(* UNEXPORTED +Section Linearity_and_Monotonicity +*) + +(* UNEXPORTED +Opaque Even_Partition. +*) + +(*#* +The integral is a linear and monotonous function; in order to prove these facts we also need the important equalities $\int_a^bdx=b-a$#∫abdx=b-a# and $\int_a^af(x)dx=0$#∫aa=0#. +*) + +inline "cic:/CoRN/ftc/Integral/integral_one.con". + +alias id "F" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity/F.var". + +alias id "G" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity/G.var". + +alias id "contF" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity/contG.var". + +inline "cic:/CoRN/ftc/Integral/integral_comm_scal.con". + +inline "cic:/CoRN/ftc/Integral/integral_plus.con". + +(* UNEXPORTED +Transparent Even_Partition. +*) + +inline "cic:/CoRN/ftc/Integral/integral_empty.con". + +(* UNEXPORTED +End Linearity_and_Monotonicity +*) + +(* UNEXPORTED +Section Linearity_and_Monotonicity' +*) + +alias id "F" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity'/F.var". + +alias id "G" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity'/G.var". + +alias id "contF" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity'/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity'/contG.var". + +(*#* +%\begin{convention}% Let [alpha, beta : IR] and assume that +[h := alpha{**}F{+}beta{**}G] is continuous. +%\end{convention}% +*) + +alias id "alpha" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity'/alpha.var". + +alias id "beta" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity'/beta.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity'/h.con" "Basic_Properties__Linearity_and_Monotonicity'__". + +(* end hide *) + +alias id "contH" = "cic:/CoRN/ftc/Integral/Basic_Properties/Linearity_and_Monotonicity'/contH.var". + +inline "cic:/CoRN/ftc/Integral/linear_integral.con". + +(* UNEXPORTED +Opaque nring. +*) + +inline "cic:/CoRN/ftc/Integral/monotonous_integral.con". + +(* UNEXPORTED +Transparent nring. +*) + +(* UNEXPORTED +End Linearity_and_Monotonicity' +*) + +(* UNEXPORTED +Section Corollaries +*) + +alias id "F" = "cic:/CoRN/ftc/Integral/Basic_Properties/Corollaries/F.var". + +alias id "G" = "cic:/CoRN/ftc/Integral/Basic_Properties/Corollaries/G.var". + +alias id "contF" = "cic:/CoRN/ftc/Integral/Basic_Properties/Corollaries/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/Integral/Basic_Properties/Corollaries/contG.var". + +(*#* +As corollaries we can calculate integrals of group operations applied to functions. +*) + +inline "cic:/CoRN/ftc/Integral/integral_const.con". + +inline "cic:/CoRN/ftc/Integral/integral_minus.con". + +inline "cic:/CoRN/ftc/Integral/integral_inv.con". + +(*#* +We can also bound integrals by bounding the integrated functions. +*) + +inline "cic:/CoRN/ftc/Integral/lb_integral.con". + +inline "cic:/CoRN/ftc/Integral/ub_integral.con". + +inline "cic:/CoRN/ftc/Integral/integral_leEq_norm.con". + +(* UNEXPORTED +End Corollaries +*) + +(* UNEXPORTED +Section Integral_Sum +*) + +(*#* +We now relate the sum of integrals in adjoining intervals to the +integral over the union of those intervals. + +%\begin{convention}% Let [c] be a real number such that +$c\in[a,b]$#c∈[a,b]#. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/F.var". + +alias id "c" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/c.var". + +alias id "Hac" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Hac.var". + +alias id "Hcb" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Hcb.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Hab'.var". + +alias id "Hac'" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Hac'.var". + +alias id "Hcb'" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Hcb'.var". + +(* UNEXPORTED +Section Partition_Join +*) + +(*#* +We first prove that every pair of partitions, one of [[a,c]] +and another of [[c,b]] defines a partition of [[a,b]] the mesh +of which is less or equal to the maximum of the mesh of the original +partitions (actually it is equal, but we don't need the other +inequality). + +%\begin{convention}% Let [P,Q] be partitions respectively of +[[a,c]] and [[c,b]] with [n] and [m] points. +%\end{convention}% +*) + +alias id "n" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/n.var". + +alias id "m" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/m.var". + +alias id "P" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/P.var". + +alias id "Q" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/Q.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Integral/partition_join_aux.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/Integral/partition_join_fun.con". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Integral/pjf_1.con". + +inline "cic:/CoRN/ftc/Integral/pjf_2.con". + +inline "cic:/CoRN/ftc/Integral/pjf_2'.con". + +inline "cic:/CoRN/ftc/Integral/pjf_3.con". + +inline "cic:/CoRN/ftc/Integral/partition_join_prf1.con". + +inline "cic:/CoRN/ftc/Integral/partition_join_prf2.con". + +inline "cic:/CoRN/ftc/Integral/partition_join_start.con". + +inline "cic:/CoRN/ftc/Integral/partition_join_finish.con". + +inline "cic:/CoRN/ftc/Integral/partition_join.con". + +(* end hide *) + +(*#* +%\begin{convention}% [fP, fQ] are choices of points respecting [P] and [Q]. +%\end{convention}% +*) + +alias id "fP" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/fP.var". + +alias id "HfP" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/HfP.var". + +alias id "HfP'" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/HfP'.var". + +alias id "fQ" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/fQ.var". + +alias id "HfQ" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/HfQ.var". + +alias id "HfQ'" = "cic:/CoRN/ftc/Integral/Basic_Properties/Integral_Sum/Partition_Join/HfQ'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Integral/partition_join_aux'.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/Integral/partition_join_pts.con". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Integral/pjp_1.con". + +inline "cic:/CoRN/ftc/Integral/pjp_2.con". + +inline "cic:/CoRN/ftc/Integral/pjp_3.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/Integral/partition_join_Pts_in_partition.con". + +inline "cic:/CoRN/ftc/Integral/partition_join_Pts_wd.con". + +(* UNEXPORTED +Opaque partition_join. +*) + +(* UNEXPORTED +Transparent partition_join. +*) + +(* UNEXPORTED +Opaque minus. +*) + +(* UNEXPORTED +Transparent minus. +*) + +(* UNEXPORTED +Opaque minus. +*) + +(* UNEXPORTED +Transparent minus. +*) + +inline "cic:/CoRN/ftc/Integral/partition_join_Sum_lemma.con". + +inline "cic:/CoRN/ftc/Integral/partition_join_mesh.con". + +(* UNEXPORTED +End Partition_Join +*) + +(*#* +With these results in mind, the following is a trivial consequence: +*) + +(* UNEXPORTED +Opaque Even_Partition. +*) + +inline "cic:/CoRN/ftc/Integral/integral_plus_integral.con". + +(* UNEXPORTED +End Integral_Sum +*) + +(* UNEXPORTED +Transparent Even_Partition. +*) + +(* UNEXPORTED +End Basic_Properties +*) + +(*#* +The following are simple consequences of this result and of previous ones. +*) + +inline "cic:/CoRN/ftc/Integral/integral_less_norm.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/Integral/integral_gt_zero.con". + +(* end hide *) + +(*#* remove printing Integral *) + diff --git a/matita/contribs/CoRN-Decl/ftc/IntervalFunct.ma b/matita/contribs/CoRN-Decl/ftc/IntervalFunct.ma new file mode 100644 index 000000000..b08ef762b --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/IntervalFunct.ma @@ -0,0 +1,270 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/IntervalFunct". + +include "CoRN.ma". + +(* $Id: IntervalFunct.v,v 1.5 2004/04/08 15:28:06 lcf Exp $ *) + +include "ftc/PartFunEquality.ma". + +(* UNEXPORTED +Section Operations +*) + +(*#* * Functions with compact domain + +In this section we concern ourselves with defining operations on the +set of functions from an arbitrary interval [[a,b]] to [IR]. +Although these are a particular kind of partial function, they have +the advantage that, given [a] and [b], they have type [Set] and can +thus be quantified over and extracted from existential hypothesis. +This will be important when we want to define concepts like +differentiability, which involve the existence of an object satisfying +some given properties. + +Throughout this section we will focus on a compact interval and define +operators analogous to those we already have for arbitrary partial +functions. + +%\begin{convention}% Let [a,b] be real numbers and denote by [I] the +compact interval [[a,b]]. Let [f, g] be setoid functions of +type [I -> IR]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/IntervalFunct/Operations/a.var". + +alias id "b" = "cic:/CoRN/ftc/IntervalFunct/Operations/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/IntervalFunct/Operations/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/IntervalFunct/Operations/I.con" "Operations__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/IntervalFunct/Operations/f.var". + +alias id "g" = "cic:/CoRN/ftc/IntervalFunct/Operations/g.var". + +(* UNEXPORTED +Section Const +*) + +(*#* +Constant and identity functions are defined. + +%\begin{convention}% Let [c:IR]. +%\end{convention}% +*) + +alias id "c" = "cic:/CoRN/ftc/IntervalFunct/Operations/Const/c.var". + +inline "cic:/CoRN/ftc/IntervalFunct/IConst_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IConst.con". + +(* UNEXPORTED +End Const +*) + +inline "cic:/CoRN/ftc/IntervalFunct/IId_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IId.con". + +(*#* +Next, we define addition, algebraic inverse, subtraction and product of functions. +*) + +inline "cic:/CoRN/ftc/IntervalFunct/IPlus_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IPlus.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IInv_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IInv.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IMinus_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IMinus.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IMult_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IMult.con". + +(* UNEXPORTED +Section Nth_Power +*) + +(*#* +Exponentiation to a natural power [n] is also useful. +*) + +alias id "n" = "cic:/CoRN/ftc/IntervalFunct/Operations/Nth_Power/n.var". + +inline "cic:/CoRN/ftc/IntervalFunct/INth_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/INth.con". + +(* UNEXPORTED +End Nth_Power +*) + +(*#* +If a function is non-zero in all the interval then we can define its multiplicative inverse. +*) + +(* UNEXPORTED +Section Recip_Div +*) + +(* begin show *) + +alias id "Hg" = "cic:/CoRN/ftc/IntervalFunct/Operations/Recip_Div/Hg.var". + +(* end show *) + +inline "cic:/CoRN/ftc/IntervalFunct/IRecip_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IRecip.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IDiv_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IDiv.con". + +(* UNEXPORTED +End Recip_Div +*) + +(*#* +Absolute value will also be needed at some point. +*) + +inline "cic:/CoRN/ftc/IntervalFunct/IAbs_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IAbs.con". + +(* UNEXPORTED +End Operations +*) + +(*#* +The set of these functions form a ring with relation to the operations +of sum and multiplication. As they actually form a set, this fact can +be proved in Coq for this class of functions; unfortunately, due to a +problem with the coercions, we are not able to use it (Coq will not +recognize the elements of that ring as functions which can be applied +to elements of [[a,b]]), so we merely state this fact here as a +curiosity. + +Finally, we define composition; for this we need two functions with +different domains. + +%\begin{convention}% [a',b'] be real numbers and denote by [I'] the +compact interval [[a',b']], and let [g] be a setoid function of type +[I' -> IR]. +%\end{convention}% +*) + +(* UNEXPORTED +Section Composition +*) + +alias id "a" = "cic:/CoRN/ftc/IntervalFunct/Composition/a.var". + +alias id "b" = "cic:/CoRN/ftc/IntervalFunct/Composition/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/IntervalFunct/Composition/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/IntervalFunct/Composition/I.con" "Composition__". + +(* end hide *) + +alias id "a'" = "cic:/CoRN/ftc/IntervalFunct/Composition/a'.var". + +alias id "b'" = "cic:/CoRN/ftc/IntervalFunct/Composition/b'.var". + +alias id "Hab'" = "cic:/CoRN/ftc/IntervalFunct/Composition/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/IntervalFunct/Composition/I'.con" "Composition__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/IntervalFunct/Composition/f.var". + +alias id "g" = "cic:/CoRN/ftc/IntervalFunct/Composition/g.var". + +alias id "Hfg" = "cic:/CoRN/ftc/IntervalFunct/Composition/Hfg.var". + +inline "cic:/CoRN/ftc/IntervalFunct/IComp_strext.con". + +inline "cic:/CoRN/ftc/IntervalFunct/IComp.con". + +(* UNEXPORTED +End Composition +*) + +(* UNEXPORTED +Implicit Arguments IConst [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments IId [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments IPlus [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments IInv [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments IMinus [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments IMult [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments INth [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments IRecip [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments IDiv [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments IAbs [a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments IComp [a b Hab a' b' Hab']. +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/MoreFunSeries.ma b/matita/contribs/CoRN-Decl/ftc/MoreFunSeries.ma new file mode 100644 index 000000000..18f5f6ebb --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/MoreFunSeries.ma @@ -0,0 +1,571 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/MoreFunSeries". + +include "CoRN.ma". + +(* $Id: MoreFunSeries.v,v 1.4 2004/04/23 10:00:59 lcf Exp $ *) + +include "ftc/FunctSeries.ma". + +include "ftc/MoreFunctions.ma". + +(*#* printing FSeries_Sum %\ensuremath{\sum_{\infty}}% #∑'# *) + +(* UNEXPORTED +Section Definitions +*) + +(*#* *More on Sequences and Series + +We will now extend our convergence definitions and results for +sequences and series of functions defined in compact intervals to +arbitrary intervals. + +%\begin{convention}% Throughout this file, [J] will be an interval, +[f, g] will be sequences of continuous (in [J]) functions and [F,G] +will be continuous (in [J]) functions. +%\end{convention}% + +**Sequences + +First we will consider the case of sequences. + +***Definitions + +Some of the definitions do not make sense in this more general setting +(for instance, because the norm of a function is no longer defined), +but the ones which do we simply adapt in the usual way. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/Definitions/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/Definitions/f.var". + +alias id "F" = "cic:/CoRN/ftc/MoreFunSeries/Definitions/F.var". + +alias id "contf" = "cic:/CoRN/ftc/MoreFunSeries/Definitions/contf.var". + +alias id "contF" = "cic:/CoRN/ftc/MoreFunSeries/Definitions/contF.var". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_fun_seq_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_fun_seq_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_fun_seq'_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_fun_seq2_IR.con". + +(*#* +The equivalences between these definitions still hold. +*) + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_Cauchy_fun_seq'_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_fun_seq_seq2_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_fun_seq2_seq_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_fun_real_IR.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Section More_Definitions +*) + +(*#* +Limit is defined and works in the same way as before. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/More_Definitions/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/More_Definitions/f.var". + +alias id "contf" = "cic:/CoRN/ftc/MoreFunSeries/More_Definitions/contf.var". + +(* begin show *) + +alias id "conv" = "cic:/CoRN/ftc/MoreFunSeries/More_Definitions/conv.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_fun_seq_Lim_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_fun_seq_Lim_char.con". + +(* UNEXPORTED +End More_Definitions +*) + +(* UNEXPORTED +Section Irrelevance_of_Proofs +*) + +(*#* ***Basic Properties + +Proofs are irrelevant as before---they just have to be present. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/Irrelevance_of_Proofs/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/Irrelevance_of_Proofs/f.var". + +(* begin show *) + +alias id "contf" = "cic:/CoRN/ftc/MoreFunSeries/Irrelevance_of_Proofs/contf.var". + +alias id "contf0" = "cic:/CoRN/ftc/MoreFunSeries/Irrelevance_of_Proofs/contf0.var". + +(* end show *) + +alias id "F" = "cic:/CoRN/ftc/MoreFunSeries/Irrelevance_of_Proofs/F.var". + +(* begin show *) + +alias id "contF" = "cic:/CoRN/ftc/MoreFunSeries/Irrelevance_of_Proofs/contF.var". + +alias id "contF0" = "cic:/CoRN/ftc/MoreFunSeries/Irrelevance_of_Proofs/contF0.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_fun_seq'_wd_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_fun_seq2_wd_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_fun_seq_wd_IR.con". + +(* UNEXPORTED +End Irrelevance_of_Proofs +*) + +(* UNEXPORTED +Opaque Cauchy_fun_seq_Lim_IR. +*) + +(* UNEXPORTED +Section More_Properties +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/f.var". + +alias id "g" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/g.var". + +(* begin show *) + +alias id "contf" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/contf.var". + +alias id "contf0" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/contf0.var". + +alias id "contg" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/contg.var". + +alias id "contg0" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/contg0.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_conv_fun_seq'_IR.con". + +alias id "F" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/F.var". + +alias id "G" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/G.var". + +(* begin show *) + +alias id "contF" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/contF.var". + +alias id "contF0" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/contF0.var". + +alias id "contG" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/contG.var". + +alias id "contG0" = "cic:/CoRN/ftc/MoreFunSeries/More_Properties/contG0.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_fun_seq'_wdl_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_fun_seq'_wdr_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_fun_seq'_wdl'_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_fun_seq'_wdr'_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_cont_Lim_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_conv_fun_seq_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_Cauchy_fun_seq_IR.con". + +(* UNEXPORTED +End More_Properties +*) + +(* UNEXPORTED +Hint Resolve Cauchy_cont_Lim_IR: continuous. +*) + +(* UNEXPORTED +Section Algebraic_Properties +*) + +(*#* ***Algebraic Properties + +Algebraic operations still work well. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/f.var". + +alias id "g" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/g.var". + +alias id "contf" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/contf.var". + +alias id "contg" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/contg.var". + +inline "cic:/CoRN/ftc/MoreFunSeries/FLim_unique_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Cauchy_fun_seq_wd_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Lim_seq_const_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Cauchy_prop_const_IR.con". + +alias id "F" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/F.var". + +alias id "G" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/G.var". + +alias id "contF" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/contG.var". + +(* begin show *) + +alias id "convF" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/convF.var". + +alias id "convG" = "cic:/CoRN/ftc/MoreFunSeries/Algebraic_Properties/convG.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Lim_seq_plus'_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Lim_seq_minus'_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Lim_seq_mult'_IR.con". + +(* UNEXPORTED +End Algebraic_Properties +*) + +(* UNEXPORTED +Section More_Algebraic_Properties +*) + +(*#* +If we work with the limit function things fit in just as well. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/More_Algebraic_Properties/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/More_Algebraic_Properties/f.var". + +alias id "g" = "cic:/CoRN/ftc/MoreFunSeries/More_Algebraic_Properties/g.var". + +alias id "contf" = "cic:/CoRN/ftc/MoreFunSeries/More_Algebraic_Properties/contf.var". + +alias id "contg" = "cic:/CoRN/ftc/MoreFunSeries/More_Algebraic_Properties/contg.var". + +(* begin show *) + +alias id "Hf" = "cic:/CoRN/ftc/MoreFunSeries/More_Algebraic_Properties/Hf.var". + +alias id "Hg" = "cic:/CoRN/ftc/MoreFunSeries/More_Algebraic_Properties/Hg.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Lim_seq_plus_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Cauchy_prop_plus.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Lim_seq_inv_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Cauchy_prop_inv.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Lim_seq_minus_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Cauchy_prop_minus.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Lim_seq_mult_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_Cauchy_prop_mult.con". + +(* UNEXPORTED +End More_Algebraic_Properties +*) + +(* UNEXPORTED +Section Other +*) + +(*#* ***Miscellaneous + +Finally, we define a mapping between sequences of real numbers and sequences of (constant) functions and prove that convergence is preserved. +*) + +inline "cic:/CoRN/ftc/MoreFunSeries/seq_to_funseq.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/funseq_conv.con". + +(*#* +Another interesting fact: if a sequence of constant functions converges then it must converge to a constant function. +*) + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_const_Lim.con". + +(* UNEXPORTED +End Other +*) + +(* UNEXPORTED +Section Series_Definitions +*) + +(*#* **Series + +We now consider series of functions defined in arbitrary intervals. + +Convergence is defined as expected---through convergence in every compact interval. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/Series_Definitions/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/Series_Definitions/f.var". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_series_convergent_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_series_conv_imp_conv_IR.con". + +(* begin show *) + +alias id "H" = "cic:/CoRN/ftc/MoreFunSeries/Series_Definitions/H.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_series_inc_IR.con". + +(*#* Assume [h(x)] is the pointwise series of [f(x)] *) + +(* begin hide *) + +inline "cic:/CoRN/ftc/MoreFunSeries/Series_Definitions/h.con" "Series_Definitions__". + +(* end hide *) + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_strext_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_char.con". + +(* UNEXPORTED +End Series_Definitions +*) + +(* UNEXPORTED +Implicit Arguments FSeries_Sum [J f]. +*) + +(* UNEXPORTED +Section More_Series_Definitions +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/More_Series_Definitions/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/More_Series_Definitions/f.var". + +(*#* +Absolute convergence still exists. +*) + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_series_abs_convergent_IR.con". + +(* UNEXPORTED +End More_Series_Definitions +*) + +(* UNEXPORTED +Section Convergence_Results +*) + +(*#* +As before, any series converges to its sum. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/Convergence_Results/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/Convergence_Results/f.var". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_conv.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/convergent_imp_inc.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/convergent_imp_Continuous.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/Continuous_FSeries_Sum.con". + +(* UNEXPORTED +End Convergence_Results +*) + +(* UNEXPORTED +Hint Resolve convergent_imp_inc: included. +*) + +(* UNEXPORTED +Hint Resolve convergent_imp_Continuous Continuous_FSeries_Sum: continuous. +*) + +(* UNEXPORTED +Section Operations +*) + +(*#* **Algebraic Operations + +Convergence is well defined and preserved by operations. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/Operations/J.var". + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_fun_const_series_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_const_series_Sum_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/conv_zero_fun_series_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_zero_IR.con". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/Operations/f.var". + +alias id "g" = "cic:/CoRN/ftc/MoreFunSeries/Operations/g.var". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_series_convergent_wd_IR.con". + +(* begin show *) + +alias id "convF" = "cic:/CoRN/ftc/MoreFunSeries/Operations/convF.var". + +alias id "convG" = "cic:/CoRN/ftc/MoreFunSeries/Operations/convG.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_wd'.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_plus_conv.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_plus.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_inv_conv.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_inv.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_minus_conv.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_minus.con". + +(*#* +%\begin{convention}% Let [c:IR] and [H:PartIR] be continuous in [J]. +%\end{convention}% +*) + +alias id "c" = "cic:/CoRN/ftc/MoreFunSeries/Operations/c.var". + +alias id "H" = "cic:/CoRN/ftc/MoreFunSeries/Operations/H.var". + +alias id "contH" = "cic:/CoRN/ftc/MoreFunSeries/Operations/contH.var". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_scal_conv.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/FSeries_Sum_scal.con". + +(* UNEXPORTED +End Operations +*) + +(* UNEXPORTED +Section Convergence_Criteria +*) + +(*#* ***Convergence Criteria + +The most important tests for convergence of series still apply: the +comparison test (in both versions) and the ratio test. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/Convergence_Criteria/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/Convergence_Criteria/f.var". + +alias id "contF" = "cic:/CoRN/ftc/MoreFunSeries/Convergence_Criteria/contF.var". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_str_comparison_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_comparison_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/abs_imp_conv_IR.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/fun_ratio_test_conv_IR.con". + +(* UNEXPORTED +End Convergence_Criteria +*) + +(* UNEXPORTED +Section Insert_Series +*) + +(*#* ***Translation + +When working in particular with power series and Taylor series, it is +sometimes useful to ``shift'' all the terms in the series one position +forward, that is, replacing each $f_{i+1}$#fi+1# with +$f_i$#fi# and inserting the null function in the first +position. This does not affect convergence or the sum of the series. +*) + +alias id "J" = "cic:/CoRN/ftc/MoreFunSeries/Insert_Series/J.var". + +alias id "f" = "cic:/CoRN/ftc/MoreFunSeries/Insert_Series/f.var". + +alias id "convF" = "cic:/CoRN/ftc/MoreFunSeries/Insert_Series/convF.var". + +inline "cic:/CoRN/ftc/MoreFunSeries/insert_series.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/insert_series_cont.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/insert_series_sum_char.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/insert_series_conv.con". + +inline "cic:/CoRN/ftc/MoreFunSeries/insert_series_sum.con". + +(* UNEXPORTED +End Insert_Series +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/MoreFunctions.ma b/matita/contribs/CoRN-Decl/ftc/MoreFunctions.ma new file mode 100644 index 000000000..4d7622ba2 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/MoreFunctions.ma @@ -0,0 +1,650 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/MoreFunctions". + +include "CoRN.ma". + +(* $Id: MoreFunctions.v,v 1.5 2004/04/20 22:38:50 hinderer Exp $ *) + +(*#* printing FNorm %\ensuremath{\|\cdot\|_{\infty}}% *) + +include "ftc/MoreIntervals.ma". + +(* UNEXPORTED +Opaque Min Max. +*) + +(* UNEXPORTED +Section Basic_Results +*) + +(*#* *More about Functions + +Here we state all the main results about properties of functions that +we already proved for compact intervals in the more general setting of +arbitrary intervals. + +%\begin{convention}% Let [I:interval] and [F,F',G,G'] be partial functions. +%\end{convention}% + +**Continuity +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/Basic_Results/I.var". + +(*#* +Trivial stuff. +*) + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_imp_inc.con". + +(*#* +%\begin{convention}% Assume that [I] is compact and [F] is continuous in [I]. +%\end{convention}% +*) + +alias id "cI" = "cic:/CoRN/ftc/MoreFunctions/Basic_Results/cI.var". + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/Basic_Results/F.var". + +alias id "contF" = "cic:/CoRN/ftc/MoreFunctions/Basic_Results/contF.var". + +inline "cic:/CoRN/ftc/MoreFunctions/continuous_compact.con". + +(* begin show *) + +alias id "Hinc" = "cic:/CoRN/ftc/MoreFunctions/Basic_Results/Hinc.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_I_imp_tb_image.con". + +inline "cic:/CoRN/ftc/MoreFunctions/FNorm.con". + +inline "cic:/CoRN/ftc/MoreFunctions/FNorm_bnd_AbsIR.con". + +(* UNEXPORTED +End Basic_Results +*) + +(* UNEXPORTED +Hint Resolve Continuous_imp_inc: included. +*) + +(* UNEXPORTED +Section Other_Results +*) + +(*#* +The usual stuff. +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/Other_Results/I.var". + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/Other_Results/F.var". + +alias id "G" = "cic:/CoRN/ftc/MoreFunctions/Other_Results/G.var". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_wd.con". + +(* begin show *) + +alias id "contF" = "cic:/CoRN/ftc/MoreFunctions/Other_Results/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/MoreFunctions/Other_Results/contG.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunctions/included_imp_Continuous.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Included_imp_Continuous.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_const.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_id.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_plus.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_inv.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_minus.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_mult.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_nth.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_scal.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_abs.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_recip.con". + +(* UNEXPORTED +End Other_Results +*) + +(* UNEXPORTED +Hint Resolve continuous_compact Continuous_const Continuous_id + Continuous_plus Continuous_inv Continuous_minus Continuous_mult + Continuous_scal Continuous_nth Continuous_recip Continuous_abs: continuous. +*) + +(* UNEXPORTED +Hint Immediate included_imp_Continuous Included_imp_Continuous: continuous. +*) + +(* UNEXPORTED +Section Corollaries +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/Corollaries/I.var". + +alias id "cI" = "cic:/CoRN/ftc/MoreFunctions/Corollaries/cI.var". + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/Corollaries/F.var". + +alias id "G" = "cic:/CoRN/ftc/MoreFunctions/Corollaries/G.var". + +alias id "contF" = "cic:/CoRN/ftc/MoreFunctions/Corollaries/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/MoreFunctions/Corollaries/contG.var". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_div.con". + +inline "cic:/CoRN/ftc/MoreFunctions/FNorm_wd.con". + +(* UNEXPORTED +End Corollaries +*) + +(* UNEXPORTED +Hint Resolve Continuous_div: continuous. +*) + +(* UNEXPORTED +Section Sums +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/Sums/I.var". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_Sumx.con". + +(*#* +%\begin{convention}% Assume [f] is a sequence of continuous functions. +%\end{convention}% +*) + +alias id "f" = "cic:/CoRN/ftc/MoreFunctions/Sums/f.var". + +alias id "contF" = "cic:/CoRN/ftc/MoreFunctions/Sums/contF.var". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_Sum0.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Continuous_Sum.con". + +(* UNEXPORTED +End Sums +*) + +(* UNEXPORTED +Hint Resolve Continuous_Sum0 Continuous_Sumx Continuous_Sum: continuous. +*) + +(* UNEXPORTED +Section Basic_Properties +*) + +(*#* **Derivative + +Derivative is not that much different. + +%\begin{convention}% From this point on we assume [I] to be proper. +%\end{convention}% +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/Basic_Properties/I.var". + +alias id "pI" = "cic:/CoRN/ftc/MoreFunctions/Basic_Properties/pI.var". + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/Basic_Properties/F.var". + +alias id "G" = "cic:/CoRN/ftc/MoreFunctions/Basic_Properties/G.var". + +alias id "H" = "cic:/CoRN/ftc/MoreFunctions/Basic_Properties/H.var". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_wdl.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_wdr.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_unique.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_imp_inc.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_imp_inc'.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_imp_Continuous.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_imp_Continuous'.con". + +(* UNEXPORTED +End Basic_Properties +*) + +(* UNEXPORTED +Hint Immediate Derivative_imp_inc Derivative_imp_inc': included. +*) + +(* UNEXPORTED +Hint Immediate Derivative_imp_Continuous Derivative_imp_Continuous': + continuous. +*) + +(* UNEXPORTED +Section More_Results +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/More_Results/I.var". + +alias id "pI" = "cic:/CoRN/ftc/MoreFunctions/More_Results/pI.var". + +(*#* +%\begin{convention}% Assume that [F'] and [G'] are derivatives of [F] and [G], respectively, in [I]. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/More_Results/F.var". + +alias id "F'" = "cic:/CoRN/ftc/MoreFunctions/More_Results/F'.var". + +alias id "G" = "cic:/CoRN/ftc/MoreFunctions/More_Results/G.var". + +alias id "G'" = "cic:/CoRN/ftc/MoreFunctions/More_Results/G'.var". + +alias id "derF" = "cic:/CoRN/ftc/MoreFunctions/More_Results/derF.var". + +alias id "derG" = "cic:/CoRN/ftc/MoreFunctions/More_Results/derG.var". + +inline "cic:/CoRN/ftc/MoreFunctions/included_imp_Derivative.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Included_imp_Derivative.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_const.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_id.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_plus.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_inv.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_minus.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_mult.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_scal.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_nth.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_recip.con". + +(* UNEXPORTED +End More_Results +*) + +(* UNEXPORTED +Section More_Corollaries +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/More_Corollaries/I.var". + +alias id "pI" = "cic:/CoRN/ftc/MoreFunctions/More_Corollaries/pI.var". + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/More_Corollaries/F.var". + +alias id "F'" = "cic:/CoRN/ftc/MoreFunctions/More_Corollaries/F'.var". + +alias id "G" = "cic:/CoRN/ftc/MoreFunctions/More_Corollaries/G.var". + +alias id "G'" = "cic:/CoRN/ftc/MoreFunctions/More_Corollaries/G'.var". + +alias id "derF" = "cic:/CoRN/ftc/MoreFunctions/More_Corollaries/derF.var". + +alias id "derG" = "cic:/CoRN/ftc/MoreFunctions/More_Corollaries/derG.var". + +(* begin show *) + +alias id "Gbnd" = "cic:/CoRN/ftc/MoreFunctions/More_Corollaries/Gbnd.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_div.con". + +(* UNEXPORTED +End More_Corollaries +*) + +(* UNEXPORTED +Section More_Sums +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/More_Sums/I.var". + +alias id "pI" = "cic:/CoRN/ftc/MoreFunctions/More_Sums/pI.var". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_Sumx.con". + +(* begin show *) + +alias id "f" = "cic:/CoRN/ftc/MoreFunctions/More_Sums/f.var". + +alias id "f'" = "cic:/CoRN/ftc/MoreFunctions/More_Sums/f'.var". + +alias id "derF" = "cic:/CoRN/ftc/MoreFunctions/More_Sums/derF.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_Sum0.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_Sum.con". + +(* UNEXPORTED +End More_Sums +*) + +(* UNEXPORTED +Section Diffble_Basic_Properties +*) + +(*#* **Differentiability + +Mutatis mutandis for differentiability. +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Basic_Properties/I.var". + +alias id "pI" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Basic_Properties/pI.var". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_imp_inc.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_imp_Diffble.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_wd.con". + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Basic_Properties/F.var". + +alias id "G" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Basic_Properties/G.var". + +alias id "diffF" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Basic_Properties/diffF.var". + +alias id "diffG" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Basic_Properties/diffG.var". + +(*#* +%\begin{convention}% Assume [F] and [G] are differentiable in [I]. +%\end{convention}% +*) + +inline "cic:/CoRN/ftc/MoreFunctions/included_imp_Diffble.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Included_imp_Diffble.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_const.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_id.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_plus.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_inv.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_minus.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_mult.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_nth.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_scal.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_recip.con". + +(* UNEXPORTED +End Diffble_Basic_Properties +*) + +(* UNEXPORTED +Hint Immediate Diffble_imp_inc: included. +*) + +(* UNEXPORTED +Section Diffble_Corollaries +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Corollaries/I.var". + +alias id "pI" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Corollaries/pI.var". + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Corollaries/F.var". + +alias id "G" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Corollaries/G.var". + +alias id "diffF" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Corollaries/diffF.var". + +alias id "diffG" = "cic:/CoRN/ftc/MoreFunctions/Diffble_Corollaries/diffG.var". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_div.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_Sum0.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_Sumx.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_Sum.con". + +(* UNEXPORTED +End Diffble_Corollaries +*) + +(* UNEXPORTED +Section Nth_Derivative +*) + +(*#* **Nth Derivative + +Higher order derivatives pose more interesting problems. It turns out that it really becomes necessary to generalize our [n_deriv] operator to any interval. +*) + +alias id "I" = "cic:/CoRN/ftc/MoreFunctions/Nth_Derivative/I.var". + +alias id "pI" = "cic:/CoRN/ftc/MoreFunctions/Nth_Derivative/pI.var". + +(* UNEXPORTED +Section Definitions +*) + +(*#* +%\begin{convention}% Let [n:nat], [F:PartIR] and assume that [F] is n-times differentiable in [I]. +%\end{convention}% +*) + +alias id "n" = "cic:/CoRN/ftc/MoreFunctions/Nth_Derivative/Definitions/n.var". + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/Nth_Derivative/Definitions/F.var". + +alias id "diffF" = "cic:/CoRN/ftc/MoreFunctions/Nth_Derivative/Definitions/diffF.var". + +inline "cic:/CoRN/ftc/MoreFunctions/N_Deriv_fun.con". + +inline "cic:/CoRN/ftc/MoreFunctions/N_Deriv_char + (* begin hide *).con". + +(* end hide *) + +inline "cic:/CoRN/ftc/MoreFunctions/N_Deriv_strext.con". + +inline "cic:/CoRN/ftc/MoreFunctions/N_Deriv_wd.con". + +inline "cic:/CoRN/ftc/MoreFunctions/N_Deriv.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Section Basic_Results +*) + +(*#* +All the usual results hold. +*) + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_n_wd.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_wdr.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_wdl.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_unique.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_n_imp_Diffble.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_imp_Diffble.con". + +inline "cic:/CoRN/ftc/MoreFunctions/le_imp_Diffble_n.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_n_imp_le.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_n_imp_inc.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_imp_Diffble_n.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_imp_inc.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_imp_inc'.con". + +inline "cic:/CoRN/ftc/MoreFunctions/included_imp_Derivative_n.con". + +inline "cic:/CoRN/ftc/MoreFunctions/included_imp_Diffble_n.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Included_imp_Derivative_n.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Included_imp_Diffble_n.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_plus.con". + +(* UNEXPORTED +End Basic_Results +*) + +(* UNEXPORTED +Section More_Results +*) + +(*#* +Some new results hold, too: +*) + +inline "cic:/CoRN/ftc/MoreFunctions/N_Deriv_Feq.con". + +inline "cic:/CoRN/ftc/MoreFunctions/N_Deriv_lemma.con". + +inline "cic:/CoRN/ftc/MoreFunctions/N_Deriv_S.con". + +inline "cic:/CoRN/ftc/MoreFunctions/N_Deriv_plus.con". + +(*#* +Some useful characterization results. +*) + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_O.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_Sn.con". + +(* UNEXPORTED +End More_Results +*) + +(* UNEXPORTED +Section Derivating_Diffble +*) + +(*#* +As a special case we get a differentiation operator%\ldots%#...# +*) + +alias id "F" = "cic:/CoRN/ftc/MoreFunctions/Nth_Derivative/Derivating_Diffble/F.var". + +(* begin show *) + +alias id "diffF" = "cic:/CoRN/ftc/MoreFunctions/Nth_Derivative/Derivating_Diffble/diffF.var". + +(* end show *) + +inline "cic:/CoRN/ftc/MoreFunctions/Diffble_imp_Diffble_n.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Deriv.con". + +(* UNEXPORTED +End Derivating_Diffble +*) + +(* UNEXPORTED +Section Corollaries +*) + +(*#* +%\ldots%#...# for which the expected property also holds. +*) + +inline "cic:/CoRN/ftc/MoreFunctions/Deriv_lemma.con". + +(*#* +Some more interesting properties. +*) + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_1.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_chain.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_imp_Continuous.con". + +inline "cic:/CoRN/ftc/MoreFunctions/Derivative_n_imp_Continuous'.con". + +(* UNEXPORTED +End Corollaries +*) + +(* UNEXPORTED +End Nth_Derivative +*) + +(* UNEXPORTED +Hint Resolve Derivative_const Derivative_id Derivative_plus Derivative_inv + Derivative_minus Derivative_mult Derivative_scal Derivative_nth + Derivative_recip Derivative_div Derivative_Sumx Derivative_Sum0 + Derivative_Sum: derivate. +*) + +(* UNEXPORTED +Hint Immediate Derivative_n_imp_inc Derivative_n_imp_inc' Diffble_n_imp_inc: + included. +*) + +(* UNEXPORTED +Hint Resolve Deriv_lemma N_Deriv_lemma: derivate. +*) + +(* UNEXPORTED +Hint Immediate Derivative_n_imp_Continuous Derivative_n_imp_Continuous': + continuous. +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/MoreIntegrals.ma b/matita/contribs/CoRN-Decl/ftc/MoreIntegrals.ma new file mode 100644 index 000000000..88fff5d7a --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/MoreIntegrals.ma @@ -0,0 +1,302 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/MoreIntegrals". + +include "CoRN.ma". + +(* $Id: MoreIntegrals.v,v 1.6 2004/04/23 10:00:59 lcf Exp $ *) + +include "ftc/Integral.ma". + +include "ftc/MoreFunctions.ma". + +(* UNEXPORTED +Section Lemmas +*) + +(*#* printing Integral %\ensuremath{\int}% #∫# *) + +(*#* printing integral' %\ensuremath{\int}% #∫# *) + +(*#* *The generalized integral + +In this file we extend the definition of integral to allow for +arbitrary integration domains (that is, not requiring that the lower +endpoint of integration be less or equal than the upper endpoint) and +we prove the fundamental properties of the new operator. + +%\begin{convention}% Let [a, b : IR] and assume that [F] and [G] are two +partial functions continuous in [[Min(a,b),Max(a,b)]]. +%\end{convention}% + +** Definitions + +Before we define the new integral we need to some trivial interval inclusions. +*) + +alias id "a" = "cic:/CoRN/ftc/MoreIntegrals/Lemmas/a.var". + +alias id "b" = "cic:/CoRN/ftc/MoreIntegrals/Lemmas/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/MoreIntegrals/Lemmas/Hab.var". + +inline "cic:/CoRN/ftc/MoreIntegrals/compact_inc_Min_lft.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/compact_inc_Min_rht.con". + +(* UNEXPORTED +End Lemmas +*) + +(* UNEXPORTED +Section Definitions +*) + +(*#* +The integral is defined by the formula +$\int_a^bf=\int_{\min(a,b)}^bf-\int_{\min(a,b)}^af$#∫abf=∫min(a,b)bf-∫min(a,b)af#, +inspired by the domain union rule; obviously it coincides with the +classical definition, and it collapses to the old one in the case [a + [<=] b]. +*) + +alias id "a" = "cic:/CoRN/ftc/MoreIntegrals/Definitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/MoreIntegrals/Definitions/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/MoreIntegrals/Definitions/Hab.var". + +alias id "F" = "cic:/CoRN/ftc/MoreIntegrals/Definitions/F.var". + +alias id "HF" = "cic:/CoRN/ftc/MoreIntegrals/Definitions/HF.var". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_inc1.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_inc2.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_integral.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Implicit Arguments Integral [a b Hab F]. +*) + +(* UNEXPORTED +Section Properties_of_Integral +*) + +(*#* **Properties of the Integral + +All our old properties carry over to this new definition---and some +new ones, too. We begin with (strong) extensionality. +*) + +alias id "a" = "cic:/CoRN/ftc/MoreIntegrals/Properties_of_Integral/a.var". + +alias id "b" = "cic:/CoRN/ftc/MoreIntegrals/Properties_of_Integral/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/MoreIntegrals/Properties_of_Integral/Hab.var". + +alias id "F" = "cic:/CoRN/ftc/MoreIntegrals/Properties_of_Integral/F.var". + +alias id "G" = "cic:/CoRN/ftc/MoreIntegrals/Properties_of_Integral/G.var". + +alias id "contF" = "cic:/CoRN/ftc/MoreIntegrals/Properties_of_Integral/contF.var". + +alias id "contG" = "cic:/CoRN/ftc/MoreIntegrals/Properties_of_Integral/contG.var". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_strext.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_strext'.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_wd.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_wd'.con". + +(*#* +The integral is a linear operator. +*) + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_const.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_comm_scal.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_plus.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_inv.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_minus.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/linear_Integral.con". + +(*#* +If the endpoints are equal then the integral vanishes. +*) + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_empty.con". + +(*#* +And the norm provides an upper bound for the absolute value of the integral. +*) + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_leEq_norm.con". + +(* UNEXPORTED +End Properties_of_Integral +*) + +(* UNEXPORTED +Section More_Properties +*) + +(*#* +Two other ways of stating the addition law for domains. +*) + +inline "cic:/CoRN/ftc/MoreIntegrals/integral_plus_Integral.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/integral_plus_integral'.con". + +(*#* +And now we can prove the addition law for domains with our general operator. + +%\begin{convention}% Assume [c : IR]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/a.var". + +alias id "b" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/b.var". + +alias id "c" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/c.var". + +(* begin show *) + +alias id "Hab'" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Hab'.var". + +alias id "Hac'" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Hac'.var". + +alias id "Hcb'" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Hcb'.var". + +alias id "Habc'" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Habc'.var". + +(* end show *) + +alias id "F" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/F.var". + +(* begin show *) + +alias id "Hab" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Hab.var". + +alias id "Hac" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Hac.var". + +alias id "Hcb" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Hcb.var". + +alias id "Habc" = "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Habc.var". + +(* end show *) + +(* begin hide *) + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_abc_ab.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_abc_ac.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_abc_cb.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_abc_a.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_abc_b.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_abc_c.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_ab_a.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_cb_c.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_ac_a.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_ab_b.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_cb_b.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/le_ac_c.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Habc_abc.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Habc_ab.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Habc_ac.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Habc_cb.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Habc_a.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Habc_b.con" "More_Properties__". + +inline "cic:/CoRN/ftc/MoreIntegrals/More_Properties/Habc_c.con" "More_Properties__". + +(* end hide *) + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_plus_Integral.con". + +(*#* +Notice that, unlike in the classical case, an extra hypothesis (the +continuity of [F] in the interval [[Min(a,b,c),Max(a,b,c)]]) must be assumed. +*) + +(* UNEXPORTED +End More_Properties +*) + +(* UNEXPORTED +Section Corollaries +*) + +alias id "a" = "cic:/CoRN/ftc/MoreIntegrals/Corollaries/a.var". + +alias id "b" = "cic:/CoRN/ftc/MoreIntegrals/Corollaries/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/MoreIntegrals/Corollaries/Hab.var". + +alias id "F" = "cic:/CoRN/ftc/MoreIntegrals/Corollaries/F.var". + +alias id "contF" = "cic:/CoRN/ftc/MoreIntegrals/Corollaries/contF.var". + +(*#* As a corollary, we get the following rule: *) + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_op.con". + +(*#* Finally, some miscellaneous results: *) + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_less_norm.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/ub_Integral.con". + +(* UNEXPORTED +End Corollaries +*) + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_ap_zero.con". + +inline "cic:/CoRN/ftc/MoreIntegrals/Integral_eq_zero.con". + diff --git a/matita/contribs/CoRN-Decl/ftc/MoreIntervals.ma b/matita/contribs/CoRN-Decl/ftc/MoreIntervals.ma new file mode 100644 index 000000000..30bf4b423 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/MoreIntervals.ma @@ -0,0 +1,460 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/MoreIntervals". + +include "CoRN.ma". + +(* $Id: MoreIntervals.v,v 1.6 2004/04/23 10:00:59 lcf Exp $ *) + +include "ftc/NthDerivative.ma". + +(* UNEXPORTED +Opaque Min Max. +*) + +(* UNEXPORTED +Section Intervals +*) + +(*#* printing realline %\ensuremath{\RR}% #(-∞,+∞)# *) + +(*#* printing openl %\ensuremath{(\cdot,+\infty)}% #(⋅,+∞)# *) + +(*#* printing openr %\ensuremath{(-\infty,\cdot)}% #(-∞,⋅)# *) + +(*#* printing closel %\ensuremath{[\cdot,+\infty)}% #[⋅,+∞)# *) + +(*#* printing closer %\ensuremath{(-\infty,\cdot]}% #(-∞,⋅]# *) + +(*#* printing olor %\ensuremath{(\cdot,\cdot)}% #(⋅,⋅)# *) + +(*#* printing clor %\ensuremath{[\cdot,\cdot)}% #[⋅,⋅)# *) + +(*#* printing olcr %\ensuremath{(\cdot,\cdot]}% #(⋅,⋅]# *) + +(*#* printing clcr %\ensuremath{[\cdot,\cdot]}% #[⋅,⋅]# *) + +(*#* *Generalized Intervals + +At this stage we have enough material to begin generalizing our +concepts in preparation for the fundamental theorem of calculus and +the definition of the main (non-polynomial) functions of analysis. + +In order to define functions via power series (or any other kind of +series) we need to formalize a notion of convergence more general than +the one we already have on compact intervals. This is necessary for +practical reasons: we want to define a single exponential function +with domain [IR], not several exponential functions defined on compact +intervals which we prove to be the same wherever their domains +overlap. In a similar way, we want to define indefinite integrals on +infinite domains and not only on compact intervals. + +Unfortunately, proceeding in a way analogous to how we defined the +concept of global continuity will lead us nowhere; the concept turns +out to be to general, and the behaviour on too small domains +(typically intervals [[a,a']] where [a [=] a'] is neither +provably true nor provably false) will be unsatisfactory. + +There is a special family of sets, however, where this problems can be +avoided: intervals. Intervals have some nice properties that allow us +to prove good results, namely the facts that if [a] and [b] are +elements of an interval [I] then so are [Min(a,b)] and +[Max(a,b)] (which is in general not true) and also the +compact interval [[a,b]] is included in [I]. Furthermore, all +intervals are characterized by simple, well defined predicates, and +the nonempty and proper concepts become very easy to define. + +**Definitions and Basic Results + +We define an inductive type of intervals with nine constructors, +corresponding to the nine basic types of intervals. The reason why so +many constructors are needed is that we do not have a notion of real +line, for many reasons which we will not discuss here. Also it seems +simple to directly define finite intervals than to define then later +as intersections of infinite intervals, as it would only mess things +up. + +The compact interval which we will define here is obviously the same +that we have been working with all the way through; why, then, the +different formulation? The reason is simple: if we had worked with +intervals from the beginning we would have had case definitions at +every spot, and our lemmas and proofs would have been very awkward. +Also, it seems more natural to characterize a compact interval by two +real numbers (and a proof) than as a particular case of a more general +concept which doesn't have an intuitive interpretation. Finally, the +definitions we will make here will have the elegant consequence that +from this point on we can work with any kind of intervals in exactly +the same way. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/interval.ind". + +(*#* +To each interval a predicate (set) is assigned by the following map: +*) + +inline "cic:/CoRN/ftc/MoreIntervals/iprop.con". + +(* begin hide *) + +coercion cic:/matita/CoRN-Decl/ftc/MoreIntervals/iprop.con 0 (* compounds *). + +(* end hide *) + +(*#* +This map is made into a coercion, so that intervals +%\emph{%##are%}%## really subsets of reals. + +We now define what it means for an interval to be nonvoid, proper, +finite and compact in the obvious way. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/nonvoid.con". + +inline "cic:/CoRN/ftc/MoreIntervals/proper.con". + +inline "cic:/CoRN/ftc/MoreIntervals/finite.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_.con". + +(*#* Finite intervals have a left end and a right end. *) + +inline "cic:/CoRN/ftc/MoreIntervals/left_end.con". + +inline "cic:/CoRN/ftc/MoreIntervals/right_end.con". + +(*#* +Some trivia: compact intervals are finite; proper intervals are nonvoid; an interval is nonvoid iff it contains some point. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/compact_finite.con". + +inline "cic:/CoRN/ftc/MoreIntervals/proper_nonvoid.con". + +inline "cic:/CoRN/ftc/MoreIntervals/nonvoid_point.con". + +inline "cic:/CoRN/ftc/MoreIntervals/nonvoid_char.con". + +(*#* +For practical reasons it helps to define left end and right end of compact intervals. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/Lend.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Rend.con". + +(*#* In a compact interval, the left end is always less than or equal +to the right end. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/Lend_leEq_Rend.con". + +(*#* +Some nice characterizations of inclusion: +*) + +inline "cic:/CoRN/ftc/MoreIntervals/compact_included.con". + +inline "cic:/CoRN/ftc/MoreIntervals/included_interval'.con". + +inline "cic:/CoRN/ftc/MoreIntervals/included_interval.con". + +(*#* +A weirder inclusion result. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/included3_interval.con". + +(*#* +Finally, all intervals are characterized by well defined predicates. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_wd.con". + +(* UNEXPORTED +End Intervals +*) + +(* UNEXPORTED +Implicit Arguments Lend [I]. +*) + +(* UNEXPORTED +Implicit Arguments Rend [I]. +*) + +(* UNEXPORTED +Section Compact_Constructions +*) + +(* UNEXPORTED +Section Single_Compact_Interval +*) + +(*#* **Constructions with Compact Intervals + +Several important constructions are now discussed. + +We begin by defining the compact interval [[x,x]]. + +%\begin{convention}% Let [P:IR->CProp] be well defined, and [x:IR] +such that [P(x)] holds. +%\end{convention}% +*) + +alias id "P" = "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Single_Compact_Interval/P.var". + +alias id "wdP" = "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Single_Compact_Interval/wdP.var". + +alias id "x" = "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Single_Compact_Interval/x.var". + +alias id "Hx" = "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Single_Compact_Interval/Hx.var". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_single.con". + +(*#* +This interval contains [x] and only (elements equal to) [x]; furthermore, for every (well-defined) [P], if $x\in P$#x∈P# then $[x,x]\subseteq P$#[x,x]⊆P#. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/compact_single_prop.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_single_pt.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_single_inc.con". + +(* UNEXPORTED +End Single_Compact_Interval +*) + +(*#* +The special case of intervals is worth singling out, as one of the hypothesis becomes a theorem. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/compact_single_iprop.con". + +(*#* +Now for more interesting and important results. + +Let [I] be a proper interval and [x] be a point of [I]. Then there is +a proper compact interval [[a,b]] such that $x\in[a,b]\subseteq +I$#x∈[a,b]⊆I#. +*) + +(* UNEXPORTED +Section Proper_Compact_with_One_or_Two_Points +*) + +(* begin hide *) + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip1'.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip1''.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip1'''.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip1''''.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip2.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip2'.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip2''.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip2'''.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip3.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip3'.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip3''.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +inline "cic:/CoRN/ftc/MoreIntervals/Compact_Constructions/Proper_Compact_with_One_or_Two_Points/cip3'''.con" "Compact_Constructions__Proper_Compact_with_One_or_Two_Points__". + +(* end hide *) + +inline "cic:/CoRN/ftc/MoreIntervals/compact_in_interval.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_compact_in_interval.con". + +inline "cic:/CoRN/ftc/MoreIntervals/proper_compact_in_interval.con". + +inline "cic:/CoRN/ftc/MoreIntervals/proper_compact_in_interval'.con". + +inline "cic:/CoRN/ftc/MoreIntervals/included_compact_in_interval.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval'.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval_inc1.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval_inc2.con". + +(*#* +If [x [=] y] then the construction yields the same interval whether we +use [x] or [y] in its definition. This property is required at some +stage, which is why we formalized this result as a functional +definition rather than as an existential formula. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/compact_in_interval_wd1.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_in_interval_wd2.con". + +(*#* +We can make an analogous construction for two points. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/compact_in_interval2.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_compact_in_interval2.con". + +inline "cic:/CoRN/ftc/MoreIntervals/proper_compact_in_interval2.con". + +inline "cic:/CoRN/ftc/MoreIntervals/proper_compact_in_interval2'.con". + +inline "cic:/CoRN/ftc/MoreIntervals/included_compact_in_interval2.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval2x.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval2y.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval2x'.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval2y'.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval2_inc1.con". + +inline "cic:/CoRN/ftc/MoreIntervals/iprop_compact_in_interval2_inc2.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_in_interval_x_lft.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_in_interval_y_lft.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_in_interval_x_rht.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_in_interval_y_rht.con". + +(* UNEXPORTED +End Proper_Compact_with_One_or_Two_Points +*) + +(*#* +Compact intervals are exactly compact intervals(!). +*) + +inline "cic:/CoRN/ftc/MoreIntervals/interval_compact_inc.con". + +inline "cic:/CoRN/ftc/MoreIntervals/compact_interval_inc.con". + +(*#* +A generalization of the previous results: if $[a,b]\subseteq J$#[a,b]⊆J# +and [J] is proper, then we can find a proper interval [[a',b']] such that +$[a,b]\subseteq[a',b']\subseteq J$#[a,b]⊆[a',b']⊆J#. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/compact_proper_in_interval.con". + +(* UNEXPORTED +End Compact_Constructions +*) + +(* UNEXPORTED +Section Functions +*) + +(*#* **Properties of Functions in Intervals + +We now define notions of continuity, differentiability and so on on +arbitrary intervals. As expected, a function [F] has property [P] in +the (proper) interval [I] iff it has property [P] in every compact +interval included in [I]. We can formalize this in a nice way using +previously defined concepts. + +%\begin{convention}% Let [n:nat] and [I:interval]. +%\end{convention}% +*) + +alias id "n" = "cic:/CoRN/ftc/MoreIntervals/Functions/n.var". + +alias id "I" = "cic:/CoRN/ftc/MoreIntervals/Functions/I.var". + +inline "cic:/CoRN/ftc/MoreIntervals/Continuous.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Derivative.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Diffble.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Derivative_n.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Diffble_n.con". + +(* UNEXPORTED +End Functions +*) + +(* UNEXPORTED +Section Reflexivity_Properties +*) + +(*#* +In the case of compact intervals, this definitions collapse to the old ones. +*) + +inline "cic:/CoRN/ftc/MoreIntervals/Continuous_Int.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Int_Continuous.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Derivative_Int.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Int_Derivative.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Diffble_Int.con". + +inline "cic:/CoRN/ftc/MoreIntervals/Int_Diffble.con". + +(* UNEXPORTED +End Reflexivity_Properties +*) + +(* UNEXPORTED +Section Lemmas +*) + +(*#* +Interestingly, inclusion and equality in an interval are also characterizable in a similar way: +*) + +inline "cic:/CoRN/ftc/MoreIntervals/included_imp_inc.con". + +inline "cic:/CoRN/ftc/MoreIntervals/included_Feq''.con". + +inline "cic:/CoRN/ftc/MoreIntervals/included_Feq'.con". + +(* UNEXPORTED +End Lemmas +*) + +(* UNEXPORTED +Hint Resolve included_interval included_interval' included3_interval + compact_single_inc compact_single_iprop included_compact_in_interval + iprop_compact_in_interval_inc1 iprop_compact_in_interval_inc2 + included_compact_in_interval2 iprop_compact_in_interval2_inc1 + iprop_compact_in_interval2_inc2 interval_compact_inc compact_interval_inc + iprop_wd: included. +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/NthDerivative.ma b/matita/contribs/CoRN-Decl/ftc/NthDerivative.ma new file mode 100644 index 000000000..180d8a7a2 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/NthDerivative.ma @@ -0,0 +1,302 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/NthDerivative". + +include "CoRN.ma". + +(* $Id: NthDerivative.v,v 1.5 2004/04/20 22:38:50 hinderer Exp $ *) + +include "ftc/Differentiability.ma". + +(* UNEXPORTED +Section Nth_Derivative +*) + +(*#* *Nth Derivative + +We now study higher order differentiability. + +%\begin{convention}% Throughout this section: + - [a, b] will be real numbers with [a [<] b]; + - [I] will denote the compact interval [[a,b]]; + - [F, G, H] will denote partial functions. + +%\end{convention}% + +**Definitions + +We first define what we mean by the derivative of order [n] of a function. +*) + +alias id "a" = "cic:/CoRN/ftc/NthDerivative/Nth_Derivative/a.var". + +alias id "b" = "cic:/CoRN/ftc/NthDerivative/Nth_Derivative/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/NthDerivative/Nth_Derivative/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/NthDerivative/Nth_Derivative/Hab.con" "Nth_Derivative__". + +inline "cic:/CoRN/ftc/NthDerivative/Nth_Derivative/I.con" "Nth_Derivative__". + +(* end hide *) + +inline "cic:/CoRN/ftc/NthDerivative/Derivative_I_n.con". + +(*#* +Unlike first order differentiability, for our definition to be +workable it is better to define directly what it means for a function +to be [n] times differentiable instead of quantifying over the +[Derivative_I_n] relation. +*) + +inline "cic:/CoRN/ftc/NthDerivative/Diffble_I_n.con". + +(* UNEXPORTED +End Nth_Derivative +*) + +(* UNEXPORTED +Implicit Arguments Derivative_I_n [a b]. +*) + +(* UNEXPORTED +Implicit Arguments Diffble_I_n [a b]. +*) + +(* UNEXPORTED +Section Trivia +*) + +(*#* **Trivia + +These are the expected extensionality and uniqueness results. +*) + +alias id "a" = "cic:/CoRN/ftc/NthDerivative/Trivia/a.var". + +alias id "b" = "cic:/CoRN/ftc/NthDerivative/Trivia/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/NthDerivative/Trivia/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/NthDerivative/Trivia/Hab.con" "Trivia__". + +inline "cic:/CoRN/ftc/NthDerivative/Trivia/I.con" "Trivia__". + +(* end hide *) + +inline "cic:/CoRN/ftc/NthDerivative/Diffble_I_n_wd.con". + +inline "cic:/CoRN/ftc/NthDerivative/Derivative_I_n_wdr.con". + +inline "cic:/CoRN/ftc/NthDerivative/Derivative_I_n_wdl.con". + +inline "cic:/CoRN/ftc/NthDerivative/Derivative_I_n_unique.con". + +(* UNEXPORTED +End Trivia +*) + +(* UNEXPORTED +Section Basic_Results +*) + +(*#* **Basic Results + +We now explore the concept of [n] times differentiability. Notice +that, unlike the first order case, we do not pay so much attention to +the relation of [n] times derivative, but focus rather on the +definition of [Diffble_I_n]. +*) + +alias id "a" = "cic:/CoRN/ftc/NthDerivative/Basic_Results/a.var". + +alias id "b" = "cic:/CoRN/ftc/NthDerivative/Basic_Results/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/NthDerivative/Basic_Results/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/NthDerivative/Basic_Results/Hab.con" "Basic_Results__". + +inline "cic:/CoRN/ftc/NthDerivative/Basic_Results/I.con" "Basic_Results__". + +(* end hide *) + +(*#* +We begin by showing that having a higher order derivative implies being differentiable. +*) + +inline "cic:/CoRN/ftc/NthDerivative/Diffble_I_n_imp_diffble.con". + +inline "cic:/CoRN/ftc/NthDerivative/deriv_n_imp_diffble.con". + +(*#* +If a function is [n] times differentiable then it is also [m] times differentiable for every [m] less or equal than [n]. +*) + +inline "cic:/CoRN/ftc/NthDerivative/le_imp_Diffble_I.con". + +(*#* +The next result consolidates our intuition that a function is [n] +times differentiable if we can build from it a chain of [n] +derivatives. +*) + +inline "cic:/CoRN/ftc/NthDerivative/Diffble_I_imp_le.con". + +(*#* +As expected, an [n] times differentiable in [[a,b]] function must be +defined in that interval. +*) + +inline "cic:/CoRN/ftc/NthDerivative/Diffble_I_n_imp_inc.con". + +(*#* +Also, the notions of derivative and differentiability are related as expected. +*) + +inline "cic:/CoRN/ftc/NthDerivative/Diffble_I_n_imp_deriv_n.con". + +inline "cic:/CoRN/ftc/NthDerivative/deriv_n_imp_Diffble_I_n.con". + +(*#* +From this we can prove that if [F] has an nth order derivative in +[[a,b]] then both [F] and its derivative are defined in that interval. +*) + +inline "cic:/CoRN/ftc/NthDerivative/Derivative_I_n_imp_inc.con". + +inline "cic:/CoRN/ftc/NthDerivative/Derivative_I_n_imp_inc'.con". + +(* UNEXPORTED +Section aux +*) + +(*#* +First order differentiability is just a special case. +*) + +(* begin show *) + +alias id "F" = "cic:/CoRN/ftc/NthDerivative/Basic_Results/aux/F.var". + +alias id "diffF" = "cic:/CoRN/ftc/NthDerivative/Basic_Results/aux/diffF.var". + +alias id "diffFn" = "cic:/CoRN/ftc/NthDerivative/Basic_Results/aux/diffFn.var". + +(* end show *) + +inline "cic:/CoRN/ftc/NthDerivative/deriv_1_deriv.con". + +inline "cic:/CoRN/ftc/NthDerivative/deriv_1_deriv'.con". + +(* UNEXPORTED +End aux +*) + +(*#* +As usual, nth order derivability is preserved by shrinking the interval. +*) + +inline "cic:/CoRN/ftc/NthDerivative/included_imp_deriv_n.con". + +inline "cic:/CoRN/ftc/NthDerivative/included_imp_diffble_n.con". + +(*#* +And finally we have an addition rule for the order of the derivative. +*) + +inline "cic:/CoRN/ftc/NthDerivative/Derivative_I_n_plus.con". + +(* UNEXPORTED +End Basic_Results +*) + +(* UNEXPORTED +Section More_Results +*) + +alias id "a" = "cic:/CoRN/ftc/NthDerivative/More_Results/a.var". + +alias id "b" = "cic:/CoRN/ftc/NthDerivative/More_Results/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/NthDerivative/More_Results/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/NthDerivative/More_Results/Hab.con" "More_Results__". + +inline "cic:/CoRN/ftc/NthDerivative/More_Results/I.con" "More_Results__". + +(* end hide *) + +(*#* **The Nth Derivative + +We now define an operator that returns an nth order derivative of an +n-times differentiable function. This is analogous to the quantifier +elimination which we would get if we had defined nth differentiability +as an existential quantification of the nth derivative relation. +*) + +inline "cic:/CoRN/ftc/NthDerivative/n_deriv_I.con". + +(*#* +This operator is well defined and works as expected. +*) + +inline "cic:/CoRN/ftc/NthDerivative/n_deriv_I_wd.con". + +inline "cic:/CoRN/ftc/NthDerivative/n_deriv_lemma.con". + +inline "cic:/CoRN/ftc/NthDerivative/n_deriv_inc.con". + +inline "cic:/CoRN/ftc/NthDerivative/n_deriv_inc'.con". + +(*#* +Some basic properties of this operation. +*) + +inline "cic:/CoRN/ftc/NthDerivative/n_Sn_deriv.con". + +inline "cic:/CoRN/ftc/NthDerivative/n_deriv_plus.con". + +(* UNEXPORTED +End More_Results +*) + +(* UNEXPORTED +Section More_on_n_deriv +*) + +(*#* +Some not so basic properties of this operation (needed in rather specific situations). +*) + +inline "cic:/CoRN/ftc/NthDerivative/n_deriv_I_wd'.con". + +inline "cic:/CoRN/ftc/NthDerivative/n_deriv_I_wd''.con". + +inline "cic:/CoRN/ftc/NthDerivative/n_deriv_I_strext'.con". + +(* UNEXPORTED +End More_on_n_deriv +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/PartFunEquality.ma b/matita/contribs/CoRN-Decl/ftc/PartFunEquality.ma new file mode 100644 index 000000000..9771d16f2 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/PartFunEquality.ma @@ -0,0 +1,417 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/PartFunEquality". + +include "CoRN.ma". + +(* $Id: PartFunEquality.v,v 1.8 2004/04/23 10:00:59 lcf Exp $ *) + +(*#* printing Feq %\ensuremath{\approx}% #≈# *) + +include "reals/Intervals.ma". + +include "tactics/DiffTactics1.ma". + +(* UNEXPORTED +Section Definitions +*) + +(*#* *Equality of Partial Functions + +** Definitions + +In some contexts (namely when quantifying over partial functions) we +need to refer explicitly to the subsetoid of elements satisfying a +given predicate rather than to the predicate itself. The following +definition makes this possible. +*) + +inline "cic:/CoRN/ftc/PartFunEquality/subset.con". + +(*#* +The core of our work will revolve around the following fundamental +notion: two functions are equal in a given domain (predicate) iff they +coincide on every point of that domain#. #%\footnote{%Notice that, +according to our definition of partial function, it is equivalent to +prove the equality for every proof or for a specific proof. Typically +it is easier to consider a generic case%.}%. This file is concerned +with proving the main properties of this equality relation. +*) + +inline "cic:/CoRN/ftc/PartFunEquality/Feq.con". + +(*#* +Notice that, because the quantification over the proofs is universal, +we must require explicitly that the predicate be included in the +domain of each function; otherwise the basic properties of equality +(like, for example, transitivity) would fail to hold#. #%\footnote{%To +see this it is enough to realize that the empty function would be +equal to every other function in every domain.%}.% The way to +circumvent this would be to quantify existentially over the proofs; +this, however, would have two major disadvantages: first, proofs of +equality would become very cumbersome and clumsy; secondly (and most +important), we often need to prove the inclusions from an equality +hypothesis, and this definition allows us to do it in a very easy way. +Also, the pointwise equality is much nicer to use from this definition +than in an existentially quantified one. +*) + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Section Equality_Results +*) + +(*#* **Properties of Inclusion + +We will now prove the main properties of the equality relation. + +%\begin{convention}% Let [I,R:IR->CProp] and [F,G:PartIR], and denote +by [P] and [Q], respectively, the domains of [F] and [G]. +%\end{convention}% +*) + +alias id "I" = "cic:/CoRN/ftc/PartFunEquality/Equality_Results/I.var". + +alias id "F" = "cic:/CoRN/ftc/PartFunEquality/Equality_Results/F.var". + +alias id "G" = "cic:/CoRN/ftc/PartFunEquality/Equality_Results/G.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/PartFunEquality/Equality_Results/P.con" "Equality_Results__". + +inline "cic:/CoRN/ftc/PartFunEquality/Equality_Results/Q.con" "Equality_Results__". + +(* end hide *) + +alias id "R" = "cic:/CoRN/ftc/PartFunEquality/Equality_Results/R.var". + +(*#* +We start with two lemmas which make it much easier to prove and use +this definition: +*) + +inline "cic:/CoRN/ftc/PartFunEquality/eq_imp_Feq.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_imp_eq.con". + +inline "cic:/CoRN/ftc/PartFunEquality/included_IR.con". + +(* UNEXPORTED +End Equality_Results +*) + +(* UNEXPORTED +Hint Resolve included_IR : included. +*) + +(* UNEXPORTED +Section Some_More +*) + +(*#* +If two function coincide on a given subset then they coincide in any smaller subset. +*) + +inline "cic:/CoRN/ftc/PartFunEquality/included_Feq.con". + +(* UNEXPORTED +End Some_More +*) + +(* UNEXPORTED +Section Away_from_Zero +*) + +(* UNEXPORTED +Section Definitions +*) + +(*#* **Away from Zero + +Before we prove our main results about the equality we have to do some +work on division. A function is said to be bounded away from zero in +a set if there exists a positive lower bound for the set of absolute +values of its image of that set. + +%\begin{convention}% Let [I : IR->CProp], [F : PartIR] and denote by [P] +the domain of [F]. +%\end{convention}% +*) + +alias id "I" = "cic:/CoRN/ftc/PartFunEquality/Away_from_Zero/Definitions/I.var". + +alias id "F" = "cic:/CoRN/ftc/PartFunEquality/Away_from_Zero/Definitions/F.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/PartFunEquality/Away_from_Zero/Definitions/P.con" "Away_from_Zero__Definitions__". + +(* end hide *) + +inline "cic:/CoRN/ftc/PartFunEquality/bnd_away_zero.con". + +(*#* +If [F] is bounded away from zero in [I] then [F] is necessarily apart from zero in [I]; also this means that [I] is included in the domain of [{1/}F]. +*) + +(* begin show *) + +alias id "Hf" = "cic:/CoRN/ftc/PartFunEquality/Away_from_Zero/Definitions/Hf.var". + +(* end show *) + +inline "cic:/CoRN/ftc/PartFunEquality/bnd_imp_ap_zero.con". + +inline "cic:/CoRN/ftc/PartFunEquality/bnd_imp_inc_recip.con". + +inline "cic:/CoRN/ftc/PartFunEquality/bnd_imp_inc_div.con". + +(* UNEXPORTED +End Definitions +*) + +(*#* +Boundedness away from zero is preserved through restriction of the set. + +%\begin{convention}% Let [F] be a partial function and [P, Q] be predicates. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/ftc/PartFunEquality/Away_from_Zero/F.var". + +alias id "P" = "cic:/CoRN/ftc/PartFunEquality/Away_from_Zero/P.var". + +alias id "Q" = "cic:/CoRN/ftc/PartFunEquality/Away_from_Zero/Q.var". + +inline "cic:/CoRN/ftc/PartFunEquality/included_imp_bnd.con". + +inline "cic:/CoRN/ftc/PartFunEquality/FRestr_bnd.con". + +(*#* +A function is said to be bounded away from zero everywhere if it is bounded away from zero in every compact subinterval of its domain; a similar definition is made for arbitrary sets, which will be necessary for future work. +*) + +inline "cic:/CoRN/ftc/PartFunEquality/bnd_away_zero_everywhere.con". + +inline "cic:/CoRN/ftc/PartFunEquality/bnd_away_zero_in_P.con". + +(*#* +An immediate consequence: +*) + +inline "cic:/CoRN/ftc/PartFunEquality/bnd_in_P_imp_ap_zero.con". + +inline "cic:/CoRN/ftc/PartFunEquality/FRestr_bnd'.con". + +(* UNEXPORTED +End Away_from_Zero +*) + +(* UNEXPORTED +Hint Resolve bnd_imp_inc_recip bnd_imp_inc_div: included. +*) + +(* UNEXPORTED +Hint Immediate bnd_in_P_imp_ap_zero: included. +*) + +(*#* ** The [FEQ] tactic +This tactic splits a goal of the form [Feq I F G] into the three subgoals +[included I (Dom F)], [included I (Dom G)] and [forall x, F x [=] G x] +and applies [Included] to the first two and [rational] to the third. +*) + +(* begin hide *) + +(* UNEXPORTED +Ltac FEQ := apply eq_imp_Feq; + [ Included | Included | intros; try (simpl in |- *; rational) ]. +*) + +(* end hide *) + +(* UNEXPORTED +Section More_on_Equality +*) + +(*#* **Properties of Equality + +We are now finally able to prove the main properties of the equality relation. We begin by showing it to be an equivalence relation. + +%\begin{convention}% Let [I] be a predicate and [F, F', G, G', H] be +partial functions. +%\end{convention}% +*) + +alias id "I" = "cic:/CoRN/ftc/PartFunEquality/More_on_Equality/I.var". + +(* UNEXPORTED +Section Feq_Equivalence +*) + +alias id "F" = "cic:/CoRN/ftc/PartFunEquality/More_on_Equality/Feq_Equivalence/F.var". + +alias id "G" = "cic:/CoRN/ftc/PartFunEquality/More_on_Equality/Feq_Equivalence/G.var". + +alias id "H" = "cic:/CoRN/ftc/PartFunEquality/More_on_Equality/Feq_Equivalence/H.var". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_reflexive.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_symmetric.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_transitive.con". + +(* UNEXPORTED +End Feq_Equivalence +*) + +(* UNEXPORTED +Section Operations +*) + +(*#* +Also it is preserved through application of functional constructors and restriction. +*) + +alias id "F" = "cic:/CoRN/ftc/PartFunEquality/More_on_Equality/Operations/F.var". + +alias id "F'" = "cic:/CoRN/ftc/PartFunEquality/More_on_Equality/Operations/F'.var". + +alias id "G" = "cic:/CoRN/ftc/PartFunEquality/More_on_Equality/Operations/G.var". + +alias id "G'" = "cic:/CoRN/ftc/PartFunEquality/More_on_Equality/Operations/G'.var". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_plus.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_inv.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_minus.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_mult.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_nth.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_recip.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_recip'.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_div.con". + +inline "cic:/CoRN/ftc/PartFunEquality/Feq_div'.con". + +(*#* +Notice that in the case of division we only need to require boundedness away from zero for one of the functions (as they are equal); thus the two last lemmas are stated in two different ways, as according to the context one or the other condition may be easier to prove. + +The restriction of a function is well defined. +*) + +inline "cic:/CoRN/ftc/PartFunEquality/FRestr_wd.con". + +(*#* +The image of a set is extensional. +*) + +inline "cic:/CoRN/ftc/PartFunEquality/fun_image_wd.con". + +(* UNEXPORTED +End Operations +*) + +(* UNEXPORTED +End More_on_Equality +*) + +(* UNEXPORTED +Section Nth_Power +*) + +(*#* **Nth Power + +We finish this group of lemmas with characterization results for the +power function (similar to those already proved for arbitrary rings). +The characterization is done at first pointwise and later using the +equality relation. + +%\begin{convention}% Let [F] be a partial function with domain [P] and +[Q] be a predicate on the real numbers assumed to be included in [P]. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/ftc/PartFunEquality/Nth_Power/F.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/PartFunEquality/Nth_Power/P.con" "Nth_Power__". + +(* end hide *) + +alias id "Q" = "cic:/CoRN/ftc/PartFunEquality/Nth_Power/Q.var". + +alias id "H" = "cic:/CoRN/ftc/PartFunEquality/Nth_Power/H.var". + +alias id "Hf" = "cic:/CoRN/ftc/PartFunEquality/Nth_Power/Hf.var". + +inline "cic:/CoRN/ftc/PartFunEquality/FNth_zero.con". + +alias id "n" = "cic:/CoRN/ftc/PartFunEquality/Nth_Power/n.var". + +alias id "H'" = "cic:/CoRN/ftc/PartFunEquality/Nth_Power/H'.var". + +inline "cic:/CoRN/ftc/PartFunEquality/FNth_mult.con". + +(* UNEXPORTED +End Nth_Power +*) + +(* UNEXPORTED +Section Strong_Nth_Power +*) + +(*#* +%\begin{convention}% Let [a,b] be real numbers such that [I := [a,b]] +is included in the domain of [F]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/PartFunEquality/Strong_Nth_Power/a.var". + +alias id "b" = "cic:/CoRN/ftc/PartFunEquality/Strong_Nth_Power/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/PartFunEquality/Strong_Nth_Power/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/PartFunEquality/Strong_Nth_Power/I.con" "Strong_Nth_Power__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/PartFunEquality/Strong_Nth_Power/F.var". + +alias id "incF" = "cic:/CoRN/ftc/PartFunEquality/Strong_Nth_Power/incF.var". + +inline "cic:/CoRN/ftc/PartFunEquality/FNth_zero'.con". + +inline "cic:/CoRN/ftc/PartFunEquality/FNth_mult'.con". + +(* UNEXPORTED +End Strong_Nth_Power +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/PartInterval.ma b/matita/contribs/CoRN-Decl/ftc/PartInterval.ma new file mode 100644 index 000000000..a46add4bc --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/PartInterval.ma @@ -0,0 +1,195 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/PartInterval". + +include "CoRN.ma". + +(* $Id: PartInterval.v,v 1.6 2004/04/23 10:01:00 lcf Exp $ *) + +include "ftc/IntervalFunct.ma". + +(* UNEXPORTED +Section Conversion +*) + +(*#* *Correspondence + +In this file we prove that there are mappings going in both ways +between the set of partial functions whose domain contains +[[a,b]] and the set of real-valued functions with domain on +that interval. These mappings form an adjunction, and thus they have +all the good properties for preservation results. + +**Mappings + +We begin by defining the map from partial functions to setoid +functions as simply being the restriction of the partial function to +the interval [[a,b]]. + +%\begin{convention}% Let [F] be a partial function and [a,b:IR] such +that [I [=] [a,b]] is included in the domain of [F]. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/ftc/PartInterval/Conversion/F.var". + +alias id "a" = "cic:/CoRN/ftc/PartInterval/Conversion/a.var". + +alias id "b" = "cic:/CoRN/ftc/PartInterval/Conversion/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/PartInterval/Conversion/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/PartInterval/Conversion/I.con" "Conversion__". + +(* end hide *) + +alias id "Hf" = "cic:/CoRN/ftc/PartInterval/Conversion/Hf.var". + +inline "cic:/CoRN/ftc/PartInterval/IntPartIR_strext.con". + +inline "cic:/CoRN/ftc/PartInterval/IntPartIR.con". + +(* UNEXPORTED +End Conversion +*) + +(* UNEXPORTED +Implicit Arguments IntPartIR [F a b Hab]. +*) + +(* UNEXPORTED +Section AntiConversion +*) + +(*#* +To go the other way around, we simply take a setoid function [f] with +domain [[a,b]] and build the corresponding partial function. +*) + +alias id "a" = "cic:/CoRN/ftc/PartInterval/AntiConversion/a.var". + +alias id "b" = "cic:/CoRN/ftc/PartInterval/AntiConversion/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/PartInterval/AntiConversion/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/PartInterval/AntiConversion/I.con" "AntiConversion__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/PartInterval/AntiConversion/f.var". + +inline "cic:/CoRN/ftc/PartInterval/PartInt_strext.con". + +inline "cic:/CoRN/ftc/PartInterval/PartInt.con". + +(* UNEXPORTED +End AntiConversion +*) + +(* UNEXPORTED +Implicit Arguments PartInt [a b Hab]. +*) + +(* UNEXPORTED +Section Inverses +*) + +(*#* +In one direction these operators are inverses. +*) + +inline "cic:/CoRN/ftc/PartInterval/int_part_int.con". + +(* UNEXPORTED +End Inverses +*) + +(* UNEXPORTED +Section Equivalences +*) + +(*#* **Mappings Preserve Operations + +We now prove that all the operations we have defined on both sets are +preserved by [PartInt]. + +%\begin{convention}% Let [F,G] be partial functions and [a,b:IR] and +denote by [I] the interval [[a,b]]. Let [f,g] be setoid functions of +type [I->IR] equal respectively to [F] and [G] in [I]. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/ftc/PartInterval/Equivalences/F.var". + +alias id "G" = "cic:/CoRN/ftc/PartInterval/Equivalences/G.var". + +alias id "a" = "cic:/CoRN/ftc/PartInterval/Equivalences/a.var". + +alias id "b" = "cic:/CoRN/ftc/PartInterval/Equivalences/b.var". + +alias id "c" = "cic:/CoRN/ftc/PartInterval/Equivalences/c.var". + +alias id "Hab" = "cic:/CoRN/ftc/PartInterval/Equivalences/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/PartInterval/Equivalences/I.con" "Equivalences__". + +(* end hide *) + +alias id "f" = "cic:/CoRN/ftc/PartInterval/Equivalences/f.var". + +alias id "g" = "cic:/CoRN/ftc/PartInterval/Equivalences/g.var". + +alias id "Ff" = "cic:/CoRN/ftc/PartInterval/Equivalences/Ff.var". + +alias id "Gg" = "cic:/CoRN/ftc/PartInterval/Equivalences/Gg.var". + +inline "cic:/CoRN/ftc/PartInterval/part_int_const.con". + +inline "cic:/CoRN/ftc/PartInterval/part_int_id.con". + +inline "cic:/CoRN/ftc/PartInterval/part_int_plus.con". + +inline "cic:/CoRN/ftc/PartInterval/part_int_inv.con". + +inline "cic:/CoRN/ftc/PartInterval/part_int_minus.con". + +inline "cic:/CoRN/ftc/PartInterval/part_int_mult.con". + +inline "cic:/CoRN/ftc/PartInterval/part_int_nth.con". + +(* begin show *) + +alias id "HG" = "cic:/CoRN/ftc/PartInterval/Equivalences/HG.var". + +alias id "Hg" = "cic:/CoRN/ftc/PartInterval/Equivalences/Hg.var". + +(* end show *) + +inline "cic:/CoRN/ftc/PartInterval/part_int_recip.con". + +inline "cic:/CoRN/ftc/PartInterval/part_int_div.con". + +(* UNEXPORTED +End Equivalences +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/Partitions.ma b/matita/contribs/CoRN-Decl/ftc/Partitions.ma new file mode 100644 index 000000000..b303160d1 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/Partitions.ma @@ -0,0 +1,488 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/Partitions". + +include "CoRN.ma". + +(* $Id: Partitions.v,v 1.7 2004/04/23 10:01:00 lcf Exp $ *) + +include "ftc/Continuity.ma". + +(*#* printing Partition_Sum %\ensuremath{\sum_P}% #∑P# *) + +(* UNEXPORTED +Section Definitions +*) + +(*#* *Partitions + +We now begin to lay the way for the definition of Riemann integral. This will +be done through the definition of a sequence of +sums that is proved to be convergent; in order to do that, we first +need to do a bit of work on partitions. + +**Definitions + +A partition is defined as a record type. For each compact interval [[a,b]] +and each natural number [n], a partition of [[a,b]] with [n+1] points is a +choice of real numbers [a [=] a0 [<=] a1 [<=] an [=] b]; the following +specification works as follows: + - [Pts] is the function that chooses the points (it is declared as a +coercion); + - [prf1] states that [Pts] is a setoid function; + - [prf2] states that the points are ordered; + - [start] requires that [a0 [=] a] and + - [finish] requires that [an [=] b]. + +*) + +inline "cic:/CoRN/ftc/Partitions/Partition.ind". + +coercion cic:/matita/CoRN-Decl/ftc/Partitions/Pts.con 0 (* compounds *). + +(*#* Two immediate consequences of this are that [ai [<=] aj] whenever +[i < j] and that [ai] is in [[a,b]] for all [i]. +*) + +inline "cic:/CoRN/ftc/Partitions/Partition_mon.con". + +inline "cic:/CoRN/ftc/Partitions/Partition_in_compact.con". + +(*#* +Each partition of [[a,b]] implies a partition of the interval +$[a,a_{n-1}]$#[a,an-1]#. This partition will play an +important role in much of our future work, so we take some care to +define it. +*) + +inline "cic:/CoRN/ftc/Partitions/part_pred_lemma.con". + +inline "cic:/CoRN/ftc/Partitions/Partition_Dom.con". + +(*#* +The mesh of a partition is the greatest distance between two +consecutive points. For convenience's sake we also define the dual +concept, which is very helpful in some situations. In order to do +this, we begin by building a list with all the distances between +consecutive points; next we only need to extract the maximum and the +minimum of this list. Notice that this list is nonempty except in the +case when [a [=] b] and [n = 0]; this means that the convention we took +of defining the minimum and maximum of the empty list to be [0] actually +helps us in this case. +*) + +inline "cic:/CoRN/ftc/Partitions/Part_Mesh_List.con". + +inline "cic:/CoRN/ftc/Partitions/Mesh.con". + +inline "cic:/CoRN/ftc/Partitions/AntiMesh.con". + +(*#* +Even partitions (partitions where all the points are evenly spaced) +will also play a central role in our work; the first two lemmas are +presented simply to make the definition of even partition lighter. +*) + +inline "cic:/CoRN/ftc/Partitions/even_part_1.con". + +inline "cic:/CoRN/ftc/Partitions/even_part_2.con". + +inline "cic:/CoRN/ftc/Partitions/Even_Partition.con". + +(* UNEXPORTED +Section Refinements +*) + +alias id "a" = "cic:/CoRN/ftc/Partitions/Definitions/Refinements/a.var". + +alias id "b" = "cic:/CoRN/ftc/Partitions/Definitions/Refinements/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Partitions/Definitions/Refinements/Hab.var". + +alias id "m" = "cic:/CoRN/ftc/Partitions/Definitions/Refinements/m.var". + +alias id "n" = "cic:/CoRN/ftc/Partitions/Definitions/Refinements/n.var". + +alias id "P" = "cic:/CoRN/ftc/Partitions/Definitions/Refinements/P.var". + +alias id "Q" = "cic:/CoRN/ftc/Partitions/Definitions/Refinements/Q.var". + +(*#* +We now define what it means for a partition [Q] to be a refinement of +[P] and prove the main property of refinements. +*) + +inline "cic:/CoRN/ftc/Partitions/Refinement.con". + +inline "cic:/CoRN/ftc/Partitions/Refinement_prop.con". + +(*#* +We will also need to consider arbitrary sums %of the form +\[\sum_{i=0}^{n-1}f(x_i)(a_{i+1}-a_i)\]%#of +f(xi)(ai+1-ai)# where +$x_i\in[a_i,a_{i+1}]$#xi∈[ai,ai+1]#. +For this, we again need a choice function [x] which has to satisfy +some condition. We define the condition and the sum for a fixed [P]: +*) + +inline "cic:/CoRN/ftc/Partitions/Points_in_Partition.con". + +inline "cic:/CoRN/ftc/Partitions/Pts_part_lemma.con". + +inline "cic:/CoRN/ftc/Partitions/Partition_Sum.con". + +(* UNEXPORTED +End Refinements +*) + +(* UNEXPORTED +Implicit Arguments Points_in_Partition [a b Hab n]. +*) + +(* UNEXPORTED +Implicit Arguments Partition_Sum [a b Hab n P g F]. +*) + +(*#* **Constructions + +We now formalize some trivial and helpful constructions. + +%\begin{convention}% We will assume a fixed compact interval [[a,b]], denoted by [I]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/Partitions/Definitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/Partitions/Definitions/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Partitions/Definitions/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Partitions/Definitions/I.con" "Definitions__". + +(* end hide *) + +(* UNEXPORTED +Section Getting_Points +*) + +(*#* +From a partition we always have a canonical choice of points at which +to evaluate a function: just take all but the last points of the +partition. + +%\begin{convention}% Let [Q] be a partition of [I] with [m] points. +%\end{convention}% +*) + +alias id "m" = "cic:/CoRN/ftc/Partitions/Definitions/Getting_Points/m.var". + +alias id "Q" = "cic:/CoRN/ftc/Partitions/Definitions/Getting_Points/Q.var". + +inline "cic:/CoRN/ftc/Partitions/Partition_imp_points.con". + +inline "cic:/CoRN/ftc/Partitions/Partition_imp_points_1.con". + +inline "cic:/CoRN/ftc/Partitions/Partition_imp_points_2.con". + +(* UNEXPORTED +End Getting_Points +*) + +(*#* +As a corollary, given any continuous function [F] and a natural number we have an immediate choice of a sum of [F] in [[a,b]]. +*) + +alias id "F" = "cic:/CoRN/ftc/Partitions/Definitions/F.var". + +alias id "contF" = "cic:/CoRN/ftc/Partitions/Definitions/contF.var". + +inline "cic:/CoRN/ftc/Partitions/Even_Partition_Sum.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Implicit Arguments Partition [a b]. +*) + +(* UNEXPORTED +Implicit Arguments Partition_Dom [a b Hab n]. +*) + +(* UNEXPORTED +Implicit Arguments Mesh [a b Hab n]. +*) + +(* UNEXPORTED +Implicit Arguments AntiMesh [a b Hab n]. +*) + +(* UNEXPORTED +Implicit Arguments Pts [a b Hab lng]. +*) + +(* UNEXPORTED +Implicit Arguments Part_Mesh_List [n a b Hab]. +*) + +(* UNEXPORTED +Implicit Arguments Points_in_Partition [a b Hab n]. +*) + +(* UNEXPORTED +Implicit Arguments Partition_Sum [a b Hab n P g F]. +*) + +(* UNEXPORTED +Implicit Arguments Even_Partition [a b]. +*) + +(* UNEXPORTED +Implicit Arguments Even_Partition_Sum [a b]. +*) + +(* UNEXPORTED +Implicit Arguments Refinement [a b Hab n m]. +*) + +(* UNEXPORTED +Hint Resolve start finish: algebra. +*) + +(* UNEXPORTED +Section Lemmas +*) + +(*#* ** Properties of the mesh + +If a partition has more than one point then its mesh list is nonempty. +*) + +inline "cic:/CoRN/ftc/Partitions/length_Part_Mesh_List.con". + +(*#* +Any element of the auxiliary list defined to calculate the mesh of a partition has a very specific form. +*) + +inline "cic:/CoRN/ftc/Partitions/Part_Mesh_List_lemma.con". + +(*#* +Mesh and antimesh are always nonnegative. +*) + +inline "cic:/CoRN/ftc/Partitions/Mesh_nonneg.con". + +inline "cic:/CoRN/ftc/Partitions/AntiMesh_nonneg.con". + +(*#* +Most important, [AntiMesh] and [Mesh] provide lower and upper bounds +for the distance between any two consecutive points in a partition. + +%\begin{convention}% Let [I] be [[a,b]] and [P] be a partition of [I] +with [n] points. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/Partitions/Lemmas/a.var". + +alias id "b" = "cic:/CoRN/ftc/Partitions/Lemmas/b.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Partitions/Lemmas/I.con" "Lemmas__". + +(* end hide *) + +alias id "Hab" = "cic:/CoRN/ftc/Partitions/Lemmas/Hab.var". + +alias id "n" = "cic:/CoRN/ftc/Partitions/Lemmas/n.var". + +alias id "P" = "cic:/CoRN/ftc/Partitions/Lemmas/P.var". + +inline "cic:/CoRN/ftc/Partitions/Mesh_lemma.con". + +inline "cic:/CoRN/ftc/Partitions/AntiMesh_lemma.con". + +inline "cic:/CoRN/ftc/Partitions/Mesh_leEq.con". + +(* UNEXPORTED +End Lemmas +*) + +(* UNEXPORTED +Section Even_Partitions +*) + +(*#* More technical stuff. Two equal partitions have the same mesh. +*) + +inline "cic:/CoRN/ftc/Partitions/Mesh_wd.con". + +inline "cic:/CoRN/ftc/Partitions/Mesh_wd'.con". + +(*#* +The mesh of an even partition is easily calculated. +*) + +inline "cic:/CoRN/ftc/Partitions/even_partition_Mesh.con". + +(*#* ** Miscellaneous +%\begin{convention}% Throughout this section, let [a,b:IR] and [I] be [[a,b]]. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/Partitions/Even_Partitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/Partitions/Even_Partitions/b.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Partitions/Even_Partitions/I.con" "Even_Partitions__". + +(* end hide *) + +alias id "Hab" = "cic:/CoRN/ftc/Partitions/Even_Partitions/Hab.var". + +(*#* +An interesting property: in a partition, if [ai [<] aj] then [i < j]. +*) + +inline "cic:/CoRN/ftc/Partitions/Partition_Points_mon.con". + +inline "cic:/CoRN/ftc/Partitions/refinement_resp_mult.con". + +(*#* +%\begin{convention}% Assume [m,n] are positive natural numbers and +denote by [P] and [Q] the even partitions with, respectively, [m] and +[n] points. +%\end{convention}% + +Even partitions always have a common refinement. +*) + +alias id "m" = "cic:/CoRN/ftc/Partitions/Even_Partitions/m.var". + +alias id "n" = "cic:/CoRN/ftc/Partitions/Even_Partitions/n.var". + +alias id "Hm" = "cic:/CoRN/ftc/Partitions/Even_Partitions/Hm.var". + +alias id "Hn" = "cic:/CoRN/ftc/Partitions/Even_Partitions/Hn.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Partitions/Even_Partitions/P.con" "Even_Partitions__". + +inline "cic:/CoRN/ftc/Partitions/Even_Partitions/Q.con" "Even_Partitions__". + +(* end hide *) + +inline "cic:/CoRN/ftc/Partitions/even_partition_refinement.con". + +(* UNEXPORTED +End Even_Partitions +*) + +(* UNEXPORTED +Section More_Definitions +*) + +(*#* ** Separation + +Some auxiliary definitions. A partition is said to be separated if all its points are distinct. +*) + +alias id "a" = "cic:/CoRN/ftc/Partitions/More_Definitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/Partitions/More_Definitions/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/Partitions/More_Definitions/Hab.var". + +inline "cic:/CoRN/ftc/Partitions/_Separated.con". + +(*#* +Two partitions are said to be (mutually) separated if they are both +separated and all their points are distinct (except for the +endpoints). + +%\begin{convention}% Let [P,Q] be partitions of [I] with, +respectively, [n] and [m] points. +%\end{convention}% +*) + +alias id "n" = "cic:/CoRN/ftc/Partitions/More_Definitions/n.var". + +alias id "m" = "cic:/CoRN/ftc/Partitions/More_Definitions/m.var". + +alias id "P" = "cic:/CoRN/ftc/Partitions/More_Definitions/P.var". + +alias id "Q" = "cic:/CoRN/ftc/Partitions/More_Definitions/Q.var". + +inline "cic:/CoRN/ftc/Partitions/Separated.con". + +(* UNEXPORTED +End More_Definitions +*) + +(* UNEXPORTED +Implicit Arguments _Separated [a b Hab n]. +*) + +(* UNEXPORTED +Implicit Arguments Separated [a b Hab n m]. +*) + +(* UNEXPORTED +Section Sep_Partitions +*) + +alias id "a" = "cic:/CoRN/ftc/Partitions/Sep_Partitions/a.var". + +alias id "b" = "cic:/CoRN/ftc/Partitions/Sep_Partitions/b.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Partitions/Sep_Partitions/I.con" "Sep_Partitions__". + +(* end hide *) + +alias id "Hab" = "cic:/CoRN/ftc/Partitions/Sep_Partitions/Hab.var". + +(*#* +The antimesh of a separated partition is always positive. +*) + +inline "cic:/CoRN/ftc/Partitions/pos_AntiMesh.con". + +(*#* +A partition can have only one point iff the endpoints of the interval +are the same; moreover, if the partition is separated and the +endpoints of the interval are the same then it must have one point. +*) + +inline "cic:/CoRN/ftc/Partitions/partition_length_zero.con". + +inline "cic:/CoRN/ftc/Partitions/_Separated_imp_length_zero.con". + +inline "cic:/CoRN/ftc/Partitions/partition_less_imp_gt_zero.con". + +(* UNEXPORTED +End Sep_Partitions +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/RefLemma.ma b/matita/contribs/CoRN-Decl/ftc/RefLemma.ma new file mode 100644 index 000000000..6034e5361 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/RefLemma.ma @@ -0,0 +1,567 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/RefLemma". + +include "CoRN.ma". + +(* $Id: RefLemma.v,v 1.7 2004/04/23 10:01:00 lcf Exp $ *) + +include "ftc/RefSeparating.ma". + +include "ftc/RefSeparated.ma". + +include "ftc/RefSepRef.ma". + +(* UNEXPORTED +Section Refinement_Lemma +*) + +(*#* *The Refinement Lemmas + +Here we resume the results proved in four different files. The aim is to prove the following result (last part of Theorem 2.9 of Bishop 1967): + +%\noindent\textbf{%##Theorem##%}% Let [f] be a continuous function on a +compact interval [[a,b]] with modulus of continuity%\footnote{%# (#From our +point of view, the modulus of continuity is simply the proof that [f] is +continuous.#)#%}% [omega]. +Let [P] be a partition of [[a,b]] and [eps [>] Zero] be such that +[mesh(P) [<] omega(eps)]. +Then +%\[\left|S(f,P)-\int_a^bf(x)dx\right|\leq\varepsilon(b-a),\]%#|S(f,P)-∫f(x)dx|≤ε(b-a)# +where [S(f,P)] denotes any sum of the function [f] respecting the partition +[P] (as previously defined). + +The proof of this theorem relies on the fact that for any two partitions [P] +and [R] of [[a,b]] it is possible to define a partition [Q] which is +``almost'' a common refinement of [P] and [R]---that is, given [eps [>] Zero] +it is possible to define [Q] such that for every point [x] of either [P] or +[R] there is a point [y] of [Q] such that [|x[-]y| [<] eps]. +This requires three separate constructions (done in three separate files) +which are then properly combined to give the final result. We recommend the +reader to ignore this technical constructions. + +First we prove that if [P] and [R] are both +separated (though not necessarily separated from each other) then we can +define a partition [P'] arbitrarily close to [P] (that is, such that given +[alpha [>] Zero] and [xi [>] Zero] [P'] satisfies both +[mesh(P') [<] mesh(P) [+] xi] and for every choice of points [x_i] respecting +[P] there is a choice of points [x'_i] respecting [P'] such that +[|S(f,P)-S(f,P')| [<] alpha]) that is separated from [R]. + +Then we prove that given any partition [P] +and assuming [a [#] b] we can define a partition [P'] arbitrarily close to +[P] (in the same sense as above) which is separated. + +Finally we prove that every two separated +partitions [P] and [R] have a common refinement---as every two points in [P] +and [R] are apart, we can decide which one is smaller. We use here the +technical results about ordering that we proved in the file [IntegralLemmas.v]. + +Using the results from these files, we prove our main lemma in several steps +(and versions). + +%\begin{convention}% Throughout this section: + - [a,b:IR] and [I] denotes [[a,b]]; + - [F] is a partial function continuous in [I]. + +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/a.var". + +alias id "b" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/I.con" "Refinement_Lemma__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/F.var". + +alias id "contF" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/contF.var". + +alias id "incF" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/incF.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/contF'.con" "Refinement_Lemma__". + +(* end hide *) + +(* UNEXPORTED +Section First_Refinement_Lemma +*) + +(*#* +This is the first part of the proof of Theorem 2.9. + +%\begin{convention}% + - [P, Q] are partitions of [I] with, respectively, [n] and [m] points; + - [Q] is a refinement of [P]; + - [e] is a positive real number; + - [d] is the modulus of continuity of [F] for [e]; + - the mesh of [P] is less or equal to [d]; + - [fP] and [fQ] are choices of points respecting the partitions [P] and [Q], +respectively. + +%\end{convention}% +*) + +alias id "e" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/e.var". + +alias id "He" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/He.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/d.con" "Refinement_Lemma__First_Refinement_Lemma__". + +(* end hide *) + +alias id "m" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/m.var". + +alias id "n" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/n.var". + +alias id "P" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/P.var". + +alias id "HMesh" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/HMesh.var". + +alias id "Q" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/Q.var". + +alias id "Href" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/Href.var". + +alias id "fP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/fP.var". + +alias id "HfP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/HfP.var". + +alias id "HfP'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/HfP'.var". + +alias id "fQ" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/fQ.var". + +alias id "HfQ" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/HfQ.var". + +alias id "HfQ'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/HfQ'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/sub.con" "Refinement_Lemma__First_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_sub_0.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_sub_n.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_sub_mon.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_sub_mon'.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_sub_hyp.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_sub_S.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/H.con" "Refinement_Lemma__First_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/H'.con" "Refinement_Lemma__First_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/First_Refinement_Lemma/H0.con" "Refinement_Lemma__First_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_sub_SS.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_h.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_g.con". + +(* NOTATION +Notation g := RL_g. +*) + +(* NOTATION +Notation h := RL_h. +*) + +inline "cic:/CoRN/ftc/RefLemma/ref_calc1.con". + +(* NOTATION +Notation just1 := (incF _ (Pts_part_lemma _ _ _ _ _ _ HfP _ _)). +*) + +(* NOTATION +Notation just2 := (incF _ (Pts_part_lemma _ _ _ _ _ _ HfQ _ _)). +*) + +inline "cic:/CoRN/ftc/RefLemma/ref_calc2.con". + +inline "cic:/CoRN/ftc/RefLemma/ref_calc3.con". + +inline "cic:/CoRN/ftc/RefLemma/ref_calc4.con". + +inline "cic:/CoRN/ftc/RefLemma/ref_calc5.con". + +inline "cic:/CoRN/ftc/RefLemma/ref_calc6.con". + +inline "cic:/CoRN/ftc/RefLemma/ref_calc7.con". + +inline "cic:/CoRN/ftc/RefLemma/ref_calc8.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/RefLemma/first_refinement_lemma.con". + +(* UNEXPORTED +End First_Refinement_Lemma +*) + +(* UNEXPORTED +Section Second_Refinement_Lemma +*) + +(*#* +This is inequality (2.6.7). + +%\begin{convention}% + - [P, Q, R] are partitions of [I] with, respectively, [j, n] and [k] points; + - [Q] is a common refinement of [P] and [R]; + - [e, e'] are positive real numbers; + - [d, d'] are the moduli of continuity of [F] for [e, e']; + - the Mesh of [P] is less or equal to [d]; + - the Mesh of [R] is less or equal to [d']; + - [fP, fQ] and [fR] are choices of points respecting the partitions [P, Q] +and [R], respectively. + +%\end{convention}% +*) + +alias id "n" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/n.var". + +alias id "j" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/j.var". + +alias id "k" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/k.var". + +alias id "P" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/P.var". + +alias id "Q" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/Q.var". + +alias id "R" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/R.var". + +alias id "HrefP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/HrefP.var". + +alias id "HrefR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/HrefR.var". + +alias id "e" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/e.var". + +alias id "e'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/e'.var". + +alias id "He" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/He.var". + +alias id "He'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/He'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/d.con" "Refinement_Lemma__Second_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/d'.con" "Refinement_Lemma__Second_Refinement_Lemma__". + +(* end hide *) + +alias id "HMeshP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/HMeshP.var". + +alias id "HMeshR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/HMeshR.var". + +alias id "fP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/fP.var". + +alias id "HfP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/HfP.var". + +alias id "HfP'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/HfP'.var". + +alias id "fR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/fR.var". + +alias id "HfR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/HfR.var". + +alias id "HfR'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Second_Refinement_Lemma/HfR'.var". + +inline "cic:/CoRN/ftc/RefLemma/second_refinement_lemma.con". + +(* UNEXPORTED +End Second_Refinement_Lemma +*) + +(* UNEXPORTED +Section Third_Refinement_Lemma +*) + +(*#* +This is an approximation of inequality (2.6.7), but without assuming the existence of a common refinement of [P] and [R]. + +%\begin{convention}% + - [P, R] are partitions of [I] with, respectively, [n] and [m] points; + - [e, e'] are positive real numbers; + - [d, d'] are the moduli of continuity of [F] for [e, e']; + - the Mesh of [P] is less than [d]; + - the Mesh of [R] is less than [d']; + - [fP] and [fR] are choices of points respecting the partitions [P] and [R], +respectively; + - [beta] is a positive real number. + +%\end{convention}% +*) + +alias id "n" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/n.var". + +alias id "m" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/m.var". + +alias id "P" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/P.var". + +alias id "R" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/R.var". + +alias id "e" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/e.var". + +alias id "e'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/e'.var". + +alias id "He" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/He.var". + +alias id "He'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/He'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/d.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/d'.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +(* end hide *) + +alias id "HMeshP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/HMeshP.var". + +alias id "HMeshR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/HMeshR.var". + +alias id "fP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/fP.var". + +alias id "HfP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/HfP.var". + +alias id "HfP'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/HfP'.var". + +alias id "fR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/fR.var". + +alias id "HfR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/HfR.var". + +alias id "HfR'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/HfR'.var". + +alias id "Hab'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/Hab'.var". + +alias id "beta" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/beta.var". + +alias id "Hbeta" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/Hbeta.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/alpha.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_alpha.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/csi1.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_csi1.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/delta1.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_delta1.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/P'.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_P'_sep.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_P'_Mesh.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/fP'.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_fP'_in_P'.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_P'_P_sum.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/csi2.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_csi2.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/delta2.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_delta2.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/R'.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_R'_sep.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_R'_Mesh.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/fR'.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_fR'_in_R'.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_R'_R_sum.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/csi3.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_csi3.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/Q.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_Q_Mesh.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_Q_sep.con". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Third_Refinement_Lemma/fQ.con" "Refinement_Lemma__Third_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/RL_fQ_in_Q.con". + +inline "cic:/CoRN/ftc/RefLemma/RL_Q_P'_sum.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/RefLemma/third_refinement_lemma.con". + +(* UNEXPORTED +End Third_Refinement_Lemma +*) + +(* UNEXPORTED +Section Fourth_Refinement_Lemma +*) + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/Fa.con" "Refinement_Lemma__Fourth_Refinement_Lemma__". + +(* NOTATION +Notation just := (fun z => incF _ (Pts_part_lemma _ _ _ _ _ _ z _ _)). +*) + +inline "cic:/CoRN/ftc/RefLemma/RL_sum_lemma_aux.con". + +(* end hide *) + +(*#* +Finally, this is inequality (2.6.7) exactly as stated (same conventions as +above) +*) + +alias id "n" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/n.var". + +alias id "m" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/m.var". + +alias id "P" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/P.var". + +alias id "R" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/R.var". + +alias id "e" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/e.var". + +alias id "e'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/e'.var". + +alias id "He" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/He.var". + +alias id "He'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/He'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/d.con" "Refinement_Lemma__Fourth_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/d'.con" "Refinement_Lemma__Fourth_Refinement_Lemma__". + +(* end hide *) + +alias id "HMeshP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/HMeshP.var". + +alias id "HMeshR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/HMeshR.var". + +alias id "fP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/fP.var". + +alias id "HfP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/HfP.var". + +alias id "HfP'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/HfP'.var". + +alias id "fR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/fR.var". + +alias id "HfR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/HfR.var". + +alias id "HfR'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/HfR'.var". + +(* begin show *) + +alias id "Hab'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Fourth_Refinement_Lemma/Hab'.var". + +(* end show *) + +inline "cic:/CoRN/ftc/RefLemma/fourth_refinement_lemma.con". + +(* UNEXPORTED +End Fourth_Refinement_Lemma +*) + +(* UNEXPORTED +Section Main_Refinement_Lemma +*) + +(*#* We finish by presenting Theorem 9. *) + +alias id "n" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/n.var". + +alias id "m" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/m.var". + +alias id "P" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/P.var". + +alias id "R" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/R.var". + +alias id "e" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/e.var". + +alias id "e'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/e'.var". + +alias id "He" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/He.var". + +alias id "He'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/He'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/d.con" "Refinement_Lemma__Main_Refinement_Lemma__". + +inline "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/d'.con" "Refinement_Lemma__Main_Refinement_Lemma__". + +(* end hide *) + +alias id "HMeshP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/HMeshP.var". + +alias id "HMeshR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/HMeshR.var". + +alias id "fP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/fP.var". + +alias id "HfP" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/HfP.var". + +alias id "HfP'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/HfP'.var". + +alias id "fR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/fR.var". + +alias id "HfR" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/HfR.var". + +alias id "HfR'" = "cic:/CoRN/ftc/RefLemma/Refinement_Lemma/Main_Refinement_Lemma/HfR'.var". + +inline "cic:/CoRN/ftc/RefLemma/refinement_lemma.con". + +(* UNEXPORTED +End Main_Refinement_Lemma +*) + +(* UNEXPORTED +End Refinement_Lemma +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/RefSepRef.ma b/matita/contribs/CoRN-Decl/ftc/RefSepRef.ma new file mode 100644 index 000000000..7a2680244 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/RefSepRef.ma @@ -0,0 +1,148 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/RefSepRef". + +include "CoRN.ma". + +(* $Id: RefSepRef.v,v 1.6 2004/04/23 10:01:00 lcf Exp $ *) + +(* begin hide *) + +include "ftc/COrdLemmas.ma". + +include "ftc/Partitions.ma". + +(* UNEXPORTED +Section Refining_Separated +*) + +alias id "a" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/a.var". + +alias id "b" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/Hab.var". + +inline "cic:/CoRN/ftc/RefSepRef/Refining_Separated/I.con" "Refining_Separated__". + +alias id "F" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/F.var". + +alias id "contF" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/contF.var". + +alias id "incF" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/incF.var". + +alias id "m" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/m.var". + +alias id "n" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/n.var". + +alias id "P" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/P.var". + +alias id "R" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/R.var". + +alias id "HPR" = "cic:/CoRN/ftc/RefSepRef/Refining_Separated/HPR.var". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_HP.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_HP'.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_HR.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_HR'.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_mn0.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_nm0.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_H'.con". + +inline "cic:/CoRN/ftc/RefSepRef/Refining_Separated/f'.con" "Refining_Separated__". + +inline "cic:/CoRN/ftc/RefSepRef/Refining_Separated/g'.con" "Refining_Separated__". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_f'_nlnf.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_g'_nlnf.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_f'_mon.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_g'_mon.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_f'_ap_g'.con". + +inline "cic:/CoRN/ftc/RefSepRef/Refining_Separated/h.con" "Refining_Separated__". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_h_nlnf.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_h_mon.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_h_mon'.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_h_f'.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_h_g'.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_h_PropAll.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_h_PropEx.con". + +inline "cic:/CoRN/ftc/RefSepRef/Separated_Refinement_fun.con". + +inline "cic:/CoRN/ftc/RefSepRef/Separated_Refinement_lemma1.con". + +inline "cic:/CoRN/ftc/RefSepRef/Separated_Refinement_lemma3.con". + +inline "cic:/CoRN/ftc/RefSepRef/Separated_Refinement_lemma4.con". + +inline "cic:/CoRN/ftc/RefSepRef/Separated_Refinement_lemma2.con". + +inline "cic:/CoRN/ftc/RefSepRef/Separated_Refinement.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxP.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxR.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxP_lemma0.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_h_inj.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxP_lemmai.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxP_lemman.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxP_lemma1.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxP_lemma2.con". + +inline "cic:/CoRN/ftc/RefSepRef/Separated_Refinement_lft.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxR_lemma0.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxR_lemmai.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxR_lemmam.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxR_lemma1.con". + +inline "cic:/CoRN/ftc/RefSepRef/RSR_auxR_lemma2.con". + +inline "cic:/CoRN/ftc/RefSepRef/Separated_Refinement_rht.con". + +(* UNEXPORTED +End Refining_Separated +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/ftc/RefSeparated.ma b/matita/contribs/CoRN-Decl/ftc/RefSeparated.ma new file mode 100644 index 000000000..5aee670ee --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/RefSeparated.ma @@ -0,0 +1,181 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/RefSeparated". + +include "CoRN.ma". + +(* $Id: RefSeparated.v,v 1.8 2004/04/23 10:01:00 lcf Exp $ *) + +(* begin hide *) + +include "ftc/COrdLemmas.ma". + +include "ftc/Partitions.ma". + +(* UNEXPORTED +Section Separating__Separated +*) + +alias id "a" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/a.var". + +alias id "b" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Hab.var". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/I.con" "Separating__Separated__". + +alias id "F" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/F.var". + +alias id "contF" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/contF.var". + +alias id "incF" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/incF.var". + +alias id "Hab'" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Hab'.var". + +alias id "m" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/m.var". + +alias id "n" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/n.var". + +alias id "P" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/P.var". + +alias id "R" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/R.var". + +alias id "HP" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/HP.var". + +alias id "HR" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/HR.var". + +inline "cic:/CoRN/ftc/RefSeparated/RS_pos_n.con". + +inline "cic:/CoRN/ftc/RefSeparated/RS_pos_m.con". + +alias id "alpha" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/alpha.var". + +alias id "Halpha" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Halpha.var". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/e.con" "Separating__Separated__". + +inline "cic:/CoRN/ftc/RefSeparated/RS_He.con". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/contF'.con" "Separating__Separated__". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/d.con" "Separating__Separated__". + +inline "cic:/CoRN/ftc/RefSeparated/RS_Hd.con". + +inline "cic:/CoRN/ftc/RefSeparated/RS_Hd'.con". + +alias id "csi" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/csi.var". + +alias id "Hcsi" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Hcsi.var". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/M.con" "Separating__Separated__". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/deltaP.con" "Separating__Separated__". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/deltaR.con" "Separating__Separated__". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/delta.con" "Separating__Separated__". + +inline "cic:/CoRN/ftc/RefSeparated/RS_delta_deltaP.con". + +inline "cic:/CoRN/ftc/RefSeparated/RS_delta_deltaR.con". + +inline "cic:/CoRN/ftc/RefSeparated/RS_delta_csi.con". + +inline "cic:/CoRN/ftc/RefSeparated/RS_delta_d.con". + +inline "cic:/CoRN/ftc/RefSeparated/RS_delta_pos.con". + +(* UNEXPORTED +Section Defining_ai' +*) + +alias id "i" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Defining_ai'/i.var". + +alias id "Hi" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Defining_ai'/Hi.var". + +inline "cic:/CoRN/ftc/RefSeparated/separation_conseq.con". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Defining_ai'/pred1.con" "Separating__Separated__Defining_ai'__". + +inline "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Defining_ai'/pred2.con" "Separating__Separated__Defining_ai'__". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_aux_lemma.con". + +alias id "Hi0" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Defining_ai'/Hi0.var". + +alias id "Hin" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/Defining_ai'/Hin.var". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_fun_i.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_leEq.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_less.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_ap.con". + +(* UNEXPORTED +End Defining_ai' +*) + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_fun.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_fun_i_delta.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_fun_delta.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_mon_i.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_mon.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_fun_i_wd.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_fun_wd.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_part.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_lemma.con". + +alias id "g" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/g.var". + +alias id "gP" = "cic:/CoRN/ftc/RefSeparated/Separating__Separated/gP.var". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_points.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_points_lemma.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_aux.con". + +(* NOTATION +Notation just1 := (incF _ (Pts_part_lemma _ _ _ _ _ _ gP _ _)). +*) + +(* NOTATION +Notation just2 := + (incF _ (Pts_part_lemma _ _ _ _ _ _ sep__sep_points_lemma _ _)). +*) + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_Sum.con". + +inline "cic:/CoRN/ftc/RefSeparated/sep__sep_Mesh.con". + +(* UNEXPORTED +End Separating__Separated +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/ftc/RefSeparating.ma b/matita/contribs/CoRN-Decl/ftc/RefSeparating.ma new file mode 100644 index 000000000..da18b29e9 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/RefSeparating.ma @@ -0,0 +1,185 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/RefSeparating". + +include "CoRN.ma". + +(* $Id: RefSeparating.v,v 1.7 2004/04/23 10:01:01 lcf Exp $ *) + +(* begin hide *) + +include "ftc/COrdLemmas.ma". + +include "ftc/Partitions.ma". + +(* UNEXPORTED +Section Separating_Partition +*) + +alias id "a" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/a.var". + +alias id "b" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/Hab.var". + +inline "cic:/CoRN/ftc/RefSeparating/Separating_Partition/I.con" "Separating_Partition__". + +alias id "F" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/F.var". + +alias id "contF" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/contF.var". + +alias id "incF" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/incF.var". + +alias id "Hab'" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/Hab'.var". + +alias id "n" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/n.var". + +alias id "P" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/P.var". + +alias id "alpha" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/alpha.var". + +alias id "Halpha" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/Halpha.var". + +alias id "csi" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/csi.var". + +alias id "Hcsi" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/Hcsi.var". + +inline "cic:/CoRN/ftc/RefSeparating/Separating_Partition/M.con" "Separating_Partition__". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_pos_n.con". + +inline "cic:/CoRN/ftc/RefSeparating/SPap_n.con". + +inline "cic:/CoRN/ftc/RefSeparating/Separating_Partition/delta.con" "Separating_Partition__". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_delta_pos.con". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_delta_csi.con". + +alias id "Hab''" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/Hab''.var". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_lemma.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_h.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_h_bnd.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_h_mon_1.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_h_mon_2.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_h_mon_3.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_app_n.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_h_lemma.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_h_lemma2.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_h_lemma3.con". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_delta2_delta4.con". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_m1.con". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_m.con". + +(* NOTATION +Notation m := RS'_m. +*) + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_length.con". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_m_m1.con". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_pos_m.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun_bnd.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun_0.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun_i.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun_m.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun_i'.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun_bnd'.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun_wd.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun_mon.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_fun_mon_pts.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_mon.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_mon_Mesh.con". + +alias id "g" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/g.var". + +alias id "gP" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/gP.var". + +alias id "gP'" = "cic:/CoRN/ftc/RefSeparating/Separating_Partition/gP'.var". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_pts.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_pts_lemma.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_pts_in_Partition.con". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_Hsep_S.con". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_Hsep.con". + +inline "cic:/CoRN/ftc/RefSeparating/RS'_h.con". + +(* NOTATION +Notation h := RS'_h. +*) + +(* NOTATION +Notation just1 := (incF _ (Pts_part_lemma _ _ _ _ _ _ gP _ _)). +*) + +(* NOTATION +Notation just2 := + (incF _ (Pts_part_lemma _ _ _ _ _ _ sep__part_pts_in_Partition _ _)). +*) + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_suRS'_m1.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_Sum2.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_Sum3.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_Sum4.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_aux.con". + +inline "cic:/CoRN/ftc/RefSeparating/sep__part_Sum.con". + +(* UNEXPORTED +End Separating_Partition +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/ftc/Rolle.ma b/matita/contribs/CoRN-Decl/ftc/Rolle.ma new file mode 100644 index 000000000..01273b08a --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/Rolle.ma @@ -0,0 +1,286 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/Rolle". + +include "CoRN.ma". + +(* $Id: Rolle.v,v 1.6 2004/04/23 10:01:01 lcf Exp $ *) + +include "tactics/DiffTactics2.ma". + +include "ftc/MoreFunctions.ma". + +(* UNEXPORTED +Section Rolle +*) + +(*#* *Rolle's Theorem + +We now begin to work with partial functions. We begin by stating and proving Rolle's theorem in various forms and some of its corollaries. + +%\begin{convention}% Assume that: + - [a,b:IR] with [a [<] b] and denote by [I] the interval [[a,b]]; + - [F,F'] are partial functions such that [F'] is the derivative of [F] in [I]; + - [e] is a positive real number. + +%\end{convention}% +*) + +(* begin hide *) + +alias id "a" = "cic:/CoRN/ftc/Rolle/Rolle/a.var". + +alias id "b" = "cic:/CoRN/ftc/Rolle/Rolle/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Rolle/Rolle/Hab'.var". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hab.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/I.con" "Rolle__". + +alias id "F" = "cic:/CoRN/ftc/Rolle/Rolle/F.var". + +alias id "F'" = "cic:/CoRN/ftc/Rolle/Rolle/F'.var". + +alias id "derF" = "cic:/CoRN/ftc/Rolle/Rolle/derF.var". + +alias id "Ha" = "cic:/CoRN/ftc/Rolle/Rolle/Ha.var". + +alias id "Hb" = "cic:/CoRN/ftc/Rolle/Rolle/Hb.var". + +(* end hide *) + +(* begin show *) + +alias id "Fab" = "cic:/CoRN/ftc/Rolle/Rolle/Fab.var". + +(* end show *) + +(* begin hide *) + +alias id "e" = "cic:/CoRN/ftc/Rolle/Rolle/e.var". + +alias id "He" = "cic:/CoRN/ftc/Rolle/Rolle/He.var". + +inline "cic:/CoRN/ftc/Rolle/Rolle/contF'.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/derivF.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma2.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/df.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hdf.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hf.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma3.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/df'.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hdf'.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hf'.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/d.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hd.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/incF.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/n.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/fcp.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma1.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/incF'.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/fcp'.con" "Rolle__". + +(* NOTATION +Notation cp := (compact_part a b Hab' d Hd). +*) + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma4.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma5.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma6.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma7.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/j.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hj.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hj'.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/k.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hk.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Hk'.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma8.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma9.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma10.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma11.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma12.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma13.con" "Rolle__". + +inline "cic:/CoRN/ftc/Rolle/Rolle/Rolle_lemma15.con" "Rolle__". + +(* end hide *) + +inline "cic:/CoRN/ftc/Rolle/Rolle.con". + +(* UNEXPORTED +End Rolle +*) + +(* UNEXPORTED +Section Law_of_the_Mean +*) + +(*#* +The following is a simple corollary: +*) + +alias id "a" = "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/a.var". + +alias id "b" = "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/Hab.con" "Law_of_the_Mean__". + +inline "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/I.con" "Law_of_the_Mean__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/F.var". + +alias id "F'" = "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/F'.var". + +alias id "HF" = "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/HF.var". + +(* begin show *) + +alias id "HA" = "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/HA.var". + +alias id "HB" = "cic:/CoRN/ftc/Rolle/Law_of_the_Mean/HB.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Rolle/Law_of_the_Mean_I.con". + +(* UNEXPORTED +End Law_of_the_Mean +*) + +(* UNEXPORTED +Section Corollaries +*) + +(*#* +We can also state these theorems without expliciting the derivative of [F]. +*) + +alias id "a" = "cic:/CoRN/ftc/Rolle/Corollaries/a.var". + +alias id "b" = "cic:/CoRN/ftc/Rolle/Corollaries/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/Rolle/Corollaries/Hab'.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Rolle/Corollaries/Hab.con" "Corollaries__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/Rolle/Corollaries/F.var". + +(* begin show *) + +alias id "HF" = "cic:/CoRN/ftc/Rolle/Corollaries/HF.var". + +(* end show *) + +inline "cic:/CoRN/ftc/Rolle/Rolle'.con". + +inline "cic:/CoRN/ftc/Rolle/Law_of_the_Mean'_I.con". + +(* UNEXPORTED +End Corollaries +*) + +(* UNEXPORTED +Section Generalizations +*) + +(*#* +The mean law is more useful if we abstract [a] and [b] from the +context---allowing them in particular to be equal. In the case where +[F(a) [=] F(b)] we get Rolle's theorem again, so there is no need to +state it also in this form. + +%\begin{convention}% Assume [I] is a proper interval, [F,F':PartIR]. +%\end{convention}% +*) + +alias id "I" = "cic:/CoRN/ftc/Rolle/Generalizations/I.var". + +alias id "pI" = "cic:/CoRN/ftc/Rolle/Generalizations/pI.var". + +alias id "F" = "cic:/CoRN/ftc/Rolle/Generalizations/F.var". + +alias id "F'" = "cic:/CoRN/ftc/Rolle/Generalizations/F'.var". + +(* begin show *) + +alias id "derF" = "cic:/CoRN/ftc/Rolle/Generalizations/derF.var". + +(* end show *) + +(* begin hide *) + +inline "cic:/CoRN/ftc/Rolle/Generalizations/incF.con" "Generalizations__". + +inline "cic:/CoRN/ftc/Rolle/Generalizations/incF'.con" "Generalizations__". + +(* end hide *) + +inline "cic:/CoRN/ftc/Rolle/Law_of_the_Mean.con". + +(*#* +We further generalize the mean law by writing as an explicit bound. +*) + +inline "cic:/CoRN/ftc/Rolle/Law_of_the_Mean_ineq.con". + +(* UNEXPORTED +End Generalizations +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/StrongIVT.ma b/matita/contribs/CoRN-Decl/ftc/StrongIVT.ma new file mode 100644 index 000000000..fd99ff05a --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/StrongIVT.ma @@ -0,0 +1,164 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/StrongIVT". + +include "CoRN.ma". + +(* $Id: StrongIVT.v,v 1.5 2004/04/23 10:01:01 lcf Exp $ *) + +include "ftc/WeakIVT.ma". + +include "ftc/CalculusTheorems.ma". + +(* UNEXPORTED +Section IVT' +*) + +(*#* ** Strong IVT for partial functions + +The IVT can be generalized to arbitrary partial functions; in the first +part, we will simply do that, repeating the previous construction. + +The same notations and conventions apply as before. +*) + +alias id "a" = "cic:/CoRN/ftc/StrongIVT/IVT'/a.var". + +alias id "b" = "cic:/CoRN/ftc/StrongIVT/IVT'/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/StrongIVT/IVT'/Hab'.var". + +alias id "Hab" = "cic:/CoRN/ftc/StrongIVT/IVT'/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/StrongIVT/IVT'/I.con" "IVT'__". + +inline "cic:/CoRN/ftc/StrongIVT/IVT'/I'.con" "IVT'__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/StrongIVT/IVT'/F.var". + +alias id "contF" = "cic:/CoRN/ftc/StrongIVT/IVT'/contF.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/StrongIVT/IVT'/incF.con" "IVT'__". + +(* end hide *) + +(* begin show *) + +alias id "incrF" = "cic:/CoRN/ftc/StrongIVT/IVT'/incrF.var". + +(* end show *) + +(* begin hide *) + +inline "cic:/CoRN/ftc/StrongIVT/IVT'/Ha.con" "IVT'__". + +inline "cic:/CoRN/ftc/StrongIVT/IVT'/Hb.con" "IVT'__". + +inline "cic:/CoRN/ftc/StrongIVT/IVT'/HFab'.con" "IVT'__". + +(* end hide *) + +(* begin show *) + +alias id "z" = "cic:/CoRN/ftc/StrongIVT/IVT'/z.var". + +alias id "Haz" = "cic:/CoRN/ftc/StrongIVT/IVT'/Haz.var". + +alias id "Hzb" = "cic:/CoRN/ftc/StrongIVT/IVT'/Hzb.var". + +(* end show *) + +inline "cic:/CoRN/ftc/StrongIVT/IVT'_seq_lemma.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/StrongIVT/IVT'_aux_seq_type.ind". + +inline "cic:/CoRN/ftc/StrongIVT/IVT'_iter.con". + +inline "cic:/CoRN/ftc/StrongIVT/IVT'_seq.con". + +inline "cic:/CoRN/ftc/StrongIVT/a'_seq.con". + +inline "cic:/CoRN/ftc/StrongIVT/b'_seq.con". + +inline "cic:/CoRN/ftc/StrongIVT/a'_seq_I.con". + +inline "cic:/CoRN/ftc/StrongIVT/b'_seq_I.con". + +inline "cic:/CoRN/ftc/StrongIVT/a'_seq_less_b'_seq.con". + +inline "cic:/CoRN/ftc/StrongIVT/a'_seq_less_z.con". + +inline "cic:/CoRN/ftc/StrongIVT/z_less_b'_seq.con". + +inline "cic:/CoRN/ftc/StrongIVT/a'_seq_mon.con". + +inline "cic:/CoRN/ftc/StrongIVT/b'_seq_mon.con". + +inline "cic:/CoRN/ftc/StrongIVT/a'_seq_b'_seq_dist_n.con". + +inline "cic:/CoRN/ftc/StrongIVT/a'_seq_b'_seq_dist.con". + +inline "cic:/CoRN/ftc/StrongIVT/a'_seq_Cauchy.con". + +inline "cic:/CoRN/ftc/StrongIVT/b'_seq_Cauchy.con". + +inline "cic:/CoRN/ftc/StrongIVT/IVT'/xa.con" "IVT'__". + +inline "cic:/CoRN/ftc/StrongIVT/IVT'/xb.con" "IVT'__". + +inline "cic:/CoRN/ftc/StrongIVT/a'_seq_b'_seq_lim.con". + +inline "cic:/CoRN/ftc/StrongIVT/xa'_in_interval.con". + +inline "cic:/CoRN/ftc/StrongIVT/IVT'_I.con". + +(* UNEXPORTED +End IVT' +*) + +(*#* **Other formulations + +We now generalize the various statements of the intermediate value +theorem to more widely applicable forms. +*) + +inline "cic:/CoRN/ftc/StrongIVT/Weak_IVT.con". + +inline "cic:/CoRN/ftc/StrongIVT/IVT_inc.con". + +(* UNEXPORTED +Transparent Min. +*) + +inline "cic:/CoRN/ftc/StrongIVT/IVT_dec.con". + +inline "cic:/CoRN/ftc/StrongIVT/IVT'_inc.con". + +(* UNEXPORTED +Transparent Min. +*) + +inline "cic:/CoRN/ftc/StrongIVT/IVT'_dec.con". + diff --git a/matita/contribs/CoRN-Decl/ftc/Taylor.ma b/matita/contribs/CoRN-Decl/ftc/Taylor.ma new file mode 100644 index 000000000..43eefa390 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/Taylor.ma @@ -0,0 +1,156 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/Taylor". + +include "CoRN.ma". + +(* $Id: Taylor.v,v 1.10 2004/04/23 10:01:01 lcf Exp $ *) + +include "ftc/TaylorLemma.ma". + +(* UNEXPORTED +Opaque Min Max N_Deriv. +*) + +(* UNEXPORTED +Section More_Taylor_Defs +*) + +(*#* **General case + +The generalization to arbitrary intervals just needs a few more definitions. + +%\begin{convention}% Let [I] be a proper interval, [F:PartIR] and +[a,b:IR] be points of [I]. +%\end{convention}% +*) + +alias id "I" = "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/I.var". + +alias id "pI" = "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/pI.var". + +alias id "F" = "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/F.var". + +(* begin show *) + +inline "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/deriv_Sn.con" "More_Taylor_Defs__". + +(* end show *) + +alias id "a" = "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/a.var". + +alias id "b" = "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/b.var". + +alias id "Ha" = "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/Ha.var". + +alias id "Hb" = "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/Hb.var". + +(* begin show *) + +inline "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/fi.con" "More_Taylor_Defs__". + +inline "cic:/CoRN/ftc/Taylor/More_Taylor_Defs/funct_i.con" "More_Taylor_Defs__". + +(* end show *) + +inline "cic:/CoRN/ftc/Taylor/Taylor_Seq'.con". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Taylor/TaylorB.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/Taylor/Taylor_Rem.con". + +(* begin hide *) + +inline "cic:/CoRN/ftc/Taylor/Taylor_Sumx_lemma.con". + +inline "cic:/CoRN/ftc/Taylor/Taylor_lemma_ap.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/Taylor/Taylor'.con". + +(* UNEXPORTED +End More_Taylor_Defs +*) + +(* UNEXPORTED +Section Taylor_Theorem +*) + +(*#* +And finally the ``nice'' version, when we know the expression of the +derivatives of [F]. + +%\begin{convention}% Let [f] be the sequence of derivatives of [F] of +order up to [n] and [F'] be the nth-derivative of [F]. +%\end{convention}% +*) + +alias id "I" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/I.var". + +alias id "pI" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/pI.var". + +alias id "F" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/F.var". + +alias id "n" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/n.var". + +alias id "f" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/f.var". + +alias id "goodF" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/goodF.var". + +alias id "goodF'" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/goodF'.var". + +alias id "derF" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/derF.var". + +alias id "F'" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/F'.var". + +alias id "derF'" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/derF'.var". + +alias id "a" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/a.var". + +alias id "b" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/b.var". + +alias id "Ha" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/Ha.var". + +alias id "Hb" = "cic:/CoRN/ftc/Taylor/Taylor_Theorem/Hb.var". + +(* begin show *) + +inline "cic:/CoRN/ftc/Taylor/Taylor_Theorem/funct_i.con" "Taylor_Theorem__". + +inline "cic:/CoRN/ftc/Taylor/Taylor_Seq.con". + +inline "cic:/CoRN/ftc/Taylor/Taylor_Theorem/deriv_Sn.con" "Taylor_Theorem__". + +(* end show *) + +inline "cic:/CoRN/ftc/Taylor/Taylor_aux.con". + +(* UNEXPORTED +Transparent N_Deriv. +*) + +inline "cic:/CoRN/ftc/Taylor/Taylor.con". + +(* UNEXPORTED +End Taylor_Theorem +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/TaylorLemma.ma b/matita/contribs/CoRN-Decl/ftc/TaylorLemma.ma new file mode 100644 index 000000000..a8f1b2149 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/TaylorLemma.ma @@ -0,0 +1,330 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/TaylorLemma". + +include "CoRN.ma". + +(* $Id: TaylorLemma.v,v 1.8 2004/04/23 10:01:01 lcf Exp $ *) + +include "ftc/Rolle.ma". + +(* UNEXPORTED +Opaque Min. +*) + +(* UNEXPORTED +Section Taylor_Defs +*) + +(*#* *Taylor's Theorem + +We now prove Taylor's theorem for the remainder of the Taylor +series. This proof is done in two steps: first, we prove the lemma +for a proper compact interval; next we generalize the result to two +arbitrary (eventually equal) points in a proper interval. + +** First case + +We assume two different points [a] and [b] in the domain of [F] and +define the nth order derivative of [F] in the interval +[[Min(a,b),Max(a,b)]]. +*) + +alias id "a" = "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/a.var". + +alias id "b" = "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/b.var". + +alias id "Hap" = "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/Hap.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/Hab'.con" "Taylor_Defs__". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/Hab.con" "Taylor_Defs__". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/I.con" "Taylor_Defs__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/F.var". + +alias id "Ha" = "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/Ha.var". + +alias id "Hb" = "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/Hb.var". + +(* begin show *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/fi.con" "Taylor_Defs__". + +(* end show *) + +(*#* +This last local definition is simply: +$f_i=f^{(i)}$#fi=f(i)#. +*) + +(* begin hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma1.con". + +(* end hide *) + +(*#* +Now we can define the Taylor sequence around [a]. The auxiliary +definition gives, for any [i], the function expressed by the rule +%\[g(x)=\frac{f^{(i)} +(a)}{i!}*(x-a)^i.\]%#g(x)=f(i)(a)/i!*(x-a)i.# +We denote by [A] and [B] the elements of [[Min(a,b),Max(a,b)]] +corresponding to [a] and [b]. +*) + +(* begin hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/TL_compact_a.con" "Taylor_Defs__". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/TL_compact_b.con" "Taylor_Defs__". + +(* NOTATION +Notation A := (Build_subcsetoid_crr IR _ _ TL_compact_a). +*) + +(* NOTATION +Notation B := (Build_subcsetoid_crr IR _ _ TL_compact_b). +*) + +(* end hide *) + +(* begin show *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/funct_i.con" "Taylor_Defs__". + +(* end show *) + +(* begin hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/funct_i'.con" "Taylor_Defs__". + +inline "cic:/CoRN/ftc/TaylorLemma/TL_a_i.con". + +inline "cic:/CoRN/ftc/TaylorLemma/TL_b_i.con". + +inline "cic:/CoRN/ftc/TaylorLemma/TL_x_i.con". + +inline "cic:/CoRN/ftc/TaylorLemma/TL_a_i'.con". + +inline "cic:/CoRN/ftc/TaylorLemma/TL_b_i'.con". + +inline "cic:/CoRN/ftc/TaylorLemma/TL_x_i'.con". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma2.con". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma2'.con". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma3.con". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma3'.con". + +(* end hide *) + +(*#* +Adding the previous expressions up to a given bound [n] gives us the +Taylor sum of order [n]. +*) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_seq'.con". + +(* begin hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/Taylor_seq'_aux.con" "Taylor_Defs__". + +inline "cic:/CoRN/ftc/TaylorLemma/TL_lemma_a.con". + +(* end hide *) + +(*#* +It is easy to show that [b] is in the domain of this series, which allows us to write down the Taylor remainder around [b]. +*) + +inline "cic:/CoRN/ftc/TaylorLemma/TL_lemma_b.con". + +(* begin hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/TL_lemma_a'.con". + +inline "cic:/CoRN/ftc/TaylorLemma/TL_lemma_b'.con". + +(* end hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_rem.con". + +(* begin hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/g.con" "Taylor_Defs__". + +(* UNEXPORTED +Opaque Taylor_seq'_aux Taylor_rem. +*) + +(* UNEXPORTED +Transparent Taylor_rem. +*) + +(* UNEXPORTED +Opaque Taylor_seq'. +*) + +(* UNEXPORTED +Transparent Taylor_seq' Taylor_seq'_aux. +*) + +(* UNEXPORTED +Opaque funct_i'. +*) + +(* UNEXPORTED +Opaque funct_i. +*) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma4.con". + +(* UNEXPORTED +Transparent funct_i funct_i'. +*) + +(* UNEXPORTED +Opaque Taylor_seq'_aux. +*) + +(* UNEXPORTED +Transparent Taylor_seq'_aux. +*) + +(* UNEXPORTED +Opaque FSumx. +*) + +(* UNEXPORTED +Opaque funct_i'. +*) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma5.con". + +(* UNEXPORTED +Transparent funct_i' FSumx. +*) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/funct_aux.con" "Taylor_Defs__". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma6.con". + +(* UNEXPORTED +Ltac Lazy_Included := + repeat first + [ apply included_IR + | apply included_FPlus + | apply included_FInv + | apply included_FMinus + | apply included_FMult + | apply included_FNth + | apply included_refl ]. +*) + +(* UNEXPORTED +Ltac Lazy_Eq := + repeat first + [ apply bin_op_wd_unfolded + | apply un_op_wd_unfolded + | apply cg_minus_wd + | apply div_wd + | apply csf_wd_unfolded ]; Algebra. +*) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma7.con". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma8.con". + +(* UNEXPORTED +Opaque funct_aux. +*) + +(* UNEXPORTED +Transparent funct_aux. +*) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma9.con". + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/g'.con" "Taylor_Defs__". + +(* UNEXPORTED +Opaque Taylor_rem funct_aux. +*) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma10.con". + +(* UNEXPORTED +Transparent Taylor_rem funct_aux. +*) + +(* end hide *) + +(*#* +Now Taylor's theorem. + +%\begin{convention}% Let [e] be a positive real number. +%\end{convention}% +*) + +alias id "e" = "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/e.var". + +alias id "He" = "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/He.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma11.con". + +(* end hide *) + +(* begin show *) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_Defs/deriv_Sn'.con" "Taylor_Defs__". + +(* end show *) + +(* begin hide *) + +inline "cic:/CoRN/ftc/TaylorLemma/TLH.con". + +(* end hide *) + +(* UNEXPORTED +Opaque funct_aux. +*) + +(* UNEXPORTED +Opaque Taylor_rem. +*) + +(* UNEXPORTED +Transparent Taylor_rem funct_aux. +*) + +inline "cic:/CoRN/ftc/TaylorLemma/Taylor_lemma.con". + +(* UNEXPORTED +End Taylor_Defs +*) + diff --git a/matita/contribs/CoRN-Decl/ftc/WeakIVT.ma b/matita/contribs/CoRN-Decl/ftc/WeakIVT.ma new file mode 100644 index 000000000..e22afe085 --- /dev/null +++ b/matita/contribs/CoRN-Decl/ftc/WeakIVT.ma @@ -0,0 +1,237 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/ftc/WeakIVT". + +include "CoRN.ma". + +(* $Id: WeakIVT.v,v 1.9 2004/04/23 10:01:01 lcf Exp $ *) + +(*#* printing ** %\ensuremath\times% #×# *) + +(* begin hide *) + +(* NOTATION +Infix "**" := prodT (at level 20). +*) + +(* end hide *) + +include "ftc/Continuity.ma". + +(*#* *IVT for Partial Functions + +In general, we cannot prove the classically valid Intermediate Value +Theorem for arbitrary partial functions, which states that in any +interval [[a,b]], for any value [z] between [f(a)] and [f(b)] +there exists $x\in[a,b]$#x∈[a,b]# such that [f(x) [=] z]. + +However, as is usually the case, there are some good aproximation results. We +will prove them here. +*) + +(* UNEXPORTED +Section Lemma1 +*) + +alias id "a" = "cic:/CoRN/ftc/WeakIVT/Lemma1/a.var". + +alias id "b" = "cic:/CoRN/ftc/WeakIVT/Lemma1/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/WeakIVT/Lemma1/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/WeakIVT/Lemma1/I.con" "Lemma1__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/WeakIVT/Lemma1/F.var". + +alias id "contF" = "cic:/CoRN/ftc/WeakIVT/Lemma1/contF.var". + +(*#* **First Lemmas + +%\begin{convention}% Let [a, b : IR] and [Hab : a [<=] b] and denote by [I] +the interval [[a,b]]. Let [F] be a continuous function on [I]. +%\end{convention}% + +We begin by proving that, if [f(a) [<] f(b)], then for every [y] in +[[f(a),f(b)]] there is an $x\in[a,b]$#x∈[a,b]# such that [f(x)] is close +enough to [z]. +*) + +inline "cic:/CoRN/ftc/WeakIVT/Weak_IVT_ap_lft.con". + +(* UNEXPORTED +End Lemma1 +*) + +(* UNEXPORTED +Section Lemma2 +*) + +alias id "a" = "cic:/CoRN/ftc/WeakIVT/Lemma2/a.var". + +alias id "b" = "cic:/CoRN/ftc/WeakIVT/Lemma2/b.var". + +alias id "Hab" = "cic:/CoRN/ftc/WeakIVT/Lemma2/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/WeakIVT/Lemma2/I.con" "Lemma2__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/WeakIVT/Lemma2/F.var". + +alias id "contF" = "cic:/CoRN/ftc/WeakIVT/Lemma2/contF.var". + +(*#* +If [f(b) [<] f(a)], a similar result holds: +*) + +inline "cic:/CoRN/ftc/WeakIVT/Weak_IVT_ap_rht.con". + +(* UNEXPORTED +End Lemma2 +*) + +(* UNEXPORTED +Section IVT +*) + +(*#* **The IVT + +We will now assume that [a [<] b] and that [F] is not only +continuous, but also strictly increasing in [I]. Under +these assumptions, we can build two sequences of values which +converge to [x0] such that [f(x0) [=] z]. +*) + +alias id "a" = "cic:/CoRN/ftc/WeakIVT/IVT/a.var". + +alias id "b" = "cic:/CoRN/ftc/WeakIVT/IVT/b.var". + +alias id "Hab'" = "cic:/CoRN/ftc/WeakIVT/IVT/Hab'.var". + +alias id "Hab" = "cic:/CoRN/ftc/WeakIVT/IVT/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/WeakIVT/IVT/I.con" "IVT__". + +(* end hide *) + +alias id "F" = "cic:/CoRN/ftc/WeakIVT/IVT/F.var". + +alias id "contF" = "cic:/CoRN/ftc/WeakIVT/IVT/contF.var". + +(* begin hide *) + +inline "cic:/CoRN/ftc/WeakIVT/IVT/incF.con" "IVT__". + +(* end hide *) + +(* begin show *) + +alias id "incrF" = "cic:/CoRN/ftc/WeakIVT/IVT/incrF.var". + +(* end show *) + +(* begin hide *) + +inline "cic:/CoRN/ftc/WeakIVT/IVT/Ha.con" "IVT__". + +inline "cic:/CoRN/ftc/WeakIVT/IVT/Hb.con" "IVT__". + +inline "cic:/CoRN/ftc/WeakIVT/IVT/HFab'.con" "IVT__". + +(* end hide *) + +(* begin show *) + +alias id "z" = "cic:/CoRN/ftc/WeakIVT/IVT/z.var". + +alias id "Haz" = "cic:/CoRN/ftc/WeakIVT/IVT/Haz.var". + +alias id "Hzb" = "cic:/CoRN/ftc/WeakIVT/IVT/Hzb.var". + +(* end show *) + +(*#* Given any two points [x [<] y] in [[a,b]] such that [x [<=] z [<=] y], +we can find [x' [<] y'] such that $|x'-y'|=\frac23|x-y|$#|x'-y'|=2/3|x-y|# +and [x' [<=] z [<=] y']. +*) + +inline "cic:/CoRN/ftc/WeakIVT/IVT_seq_lemma.con". + +(* end hide *) + +(*#* +We now iterate this construction. +*) + +inline "cic:/CoRN/ftc/WeakIVT/IVT_aux_seq_type.ind". + +inline "cic:/CoRN/ftc/WeakIVT/IVT_iter.con". + +inline "cic:/CoRN/ftc/WeakIVT/IVT_seq.con". + +(*#* +We now define the sequences built from this iteration, starting with [a] and [b]. +*) + +inline "cic:/CoRN/ftc/WeakIVT/a_seq.con". + +inline "cic:/CoRN/ftc/WeakIVT/b_seq.con". + +inline "cic:/CoRN/ftc/WeakIVT/a_seq_I.con". + +inline "cic:/CoRN/ftc/WeakIVT/b_seq_I.con". + +inline "cic:/CoRN/ftc/WeakIVT/a_seq_less_b_seq.con". + +inline "cic:/CoRN/ftc/WeakIVT/a_seq_leEq_z.con". + +inline "cic:/CoRN/ftc/WeakIVT/z_leEq_b_seq.con". + +inline "cic:/CoRN/ftc/WeakIVT/a_seq_mon.con". + +inline "cic:/CoRN/ftc/WeakIVT/b_seq_mon.con". + +inline "cic:/CoRN/ftc/WeakIVT/a_seq_b_seq_dist_n.con". + +inline "cic:/CoRN/ftc/WeakIVT/a_seq_b_seq_dist.con". + +inline "cic:/CoRN/ftc/WeakIVT/a_seq_Cauchy.con". + +inline "cic:/CoRN/ftc/WeakIVT/b_seq_Cauchy.con". + +inline "cic:/CoRN/ftc/WeakIVT/IVT/xa.con" "IVT__". + +inline "cic:/CoRN/ftc/WeakIVT/IVT/xb.con" "IVT__". + +inline "cic:/CoRN/ftc/WeakIVT/a_seq_b_seq_lim.con". + +inline "cic:/CoRN/ftc/WeakIVT/xa_in_interval.con". + +inline "cic:/CoRN/ftc/WeakIVT/IVT_I.con". + +(* UNEXPORTED +End IVT +*) + diff --git a/matita/contribs/CoRN-Decl/makefile b/matita/contribs/CoRN-Decl/makefile new file mode 100644 index 000000000..e5ac91fc8 --- /dev/null +++ b/matita/contribs/CoRN-Decl/makefile @@ -0,0 +1,39 @@ +H=@ + +RT_BASEDIR=../../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/contribs/CoRN-Decl/metrics/CMetricSpaces.ma b/matita/contribs/CoRN-Decl/metrics/CMetricSpaces.ma new file mode 100644 index 000000000..45f6ff0c6 --- /dev/null +++ b/matita/contribs/CoRN-Decl/metrics/CMetricSpaces.ma @@ -0,0 +1,205 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/metrics/CMetricSpaces". + +include "CoRN.ma". + +(* $Id: CMetricSpaces.v,v 1.4 2004/04/23 10:01:01 lcf Exp $ *) + +include "metrics/Prod_Sub.ma". + +include "metrics/Equiv.ma". + +(* UNEXPORTED +Section Definition_MS +*) + +(*#* **Definition of Metric Space +*) + +inline "cic:/CoRN/metrics/CMetricSpaces/CMetricSpace.ind". + +coercion cic:/matita/CoRN-Decl/metrics/CMetricSpaces/scms_crr.con 0 (* compounds *). + +(* UNEXPORTED +End Definition_MS +*) + +(* UNEXPORTED +Section MS_basics +*) + +(*#* **Metric Space basics +*) + +inline "cic:/CoRN/metrics/CMetricSpaces/d_CMetricSpace_apdiag_imp_grzero.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/d_zero_imp_eq.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/is_CMetricSpace_diag_zero.con". + +(* UNEXPORTED +End MS_basics +*) + +(* UNEXPORTED +Section prodandsub +*) + +(*#* **Product-Metric-Spaces and Sub-Metric-Spaces +*) + +(*#* +The product of two metric spaces is again a metric space. +*) + +inline "cic:/CoRN/metrics/CMetricSpaces/Prod0CMetricSpaces_apdiag_grzero.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Prod0CMetricSpace.con". + +(*#* +A subspace of a metric space is again a metric space. +*) + +(* UNEXPORTED +Implicit Arguments SubPsMetricSpace [X]. +*) + +inline "cic:/CoRN/metrics/CMetricSpaces/SubMetricSpace_apdiag_grzero.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/SubMetricSpace.con". + +(* UNEXPORTED +Implicit Arguments SubMetricSpace [X]. +*) + +(* UNEXPORTED +End prodandsub +*) + +(* UNEXPORTED +Section Zeroff +*) + +(*#* **Pseudo Metric Spaces vs Metric Spaces +*) + +(*#* +Not all pseudo metric spaces are a metric space: +*) + +inline "cic:/CoRN/metrics/CMetricSpaces/zf_nis_CMetricSpace.con". + +(*#* +But a pseudo metric space induces a metric space: +*) + +inline "cic:/CoRN/metrics/CMetricSpaces/metric_ap.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/metric_eq.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/metric_ap_irreflexive.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/metric_ap_symmetric.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/metric_ap_cotransitive.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/metric_ap_tight.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Metric_CSet_is_CSetoid.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Metric_CSetoid.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/metric_d.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/metric_d_strext.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Metric_d.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Metric_d_com.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Metric_d_nneg.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Metric_d_pos_imp_ap.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Metric_d_tri_ineq.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/QuotientCSetoid_is_CPsMetricSpace.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/QuotientCPsMetricSpace.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Metric_d_apdiag_grzero.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/QuotientCMetricSpace.con". + +(*#* +Some pseudo metric spaces already are a metric space: +*) + +inline "cic:/CoRN/metrics/CMetricSpaces/dIR_apdiag_grzero.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/IR_as_CMetricSpace.con". + +(*#* +In that case the induced metric space is equivalent to the original one: +*) + +inline "cic:/CoRN/metrics/CMetricSpaces/emb.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/emb_strext.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Emb.con". + +inline "cic:/CoRN/metrics/CMetricSpaces/Quotient_pres_CMetricSpace.con". + +(* UNEXPORTED +End Zeroff +*) + +(* UNEXPORTED +Section Limitt +*) + +(*#* **Limit +*) + +(*#* +A sequence in a metric space has at most one limit. +*) + +(* UNEXPORTED +Implicit Arguments MSseqLimit [X]. +*) + +(* begin hide *) + +inline "cic:/CoRN/metrics/CMetricSpaces/nz.con". + +(* end hide *) + +(* begin hide *) + +inline "cic:/CoRN/metrics/CMetricSpaces/d_wd.con". + +(* end hide *) + +inline "cic:/CoRN/metrics/CMetricSpaces/unique_MSseqLim.con". + +(* UNEXPORTED +End Limitt +*) + diff --git a/matita/contribs/CoRN-Decl/metrics/CPMSTheory.ma b/matita/contribs/CoRN-Decl/metrics/CPMSTheory.ma new file mode 100644 index 000000000..50786005f --- /dev/null +++ b/matita/contribs/CoRN-Decl/metrics/CPMSTheory.ma @@ -0,0 +1,228 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/metrics/CPMSTheory". + +include "CoRN.ma". + +(* $Id: CPMSTheory.v,v 1.6 2004/04/23 10:01:02 lcf Exp $ *) + +include "metrics/Prod_Sub.ma". + +(* UNEXPORTED +Section lists +*) + +(*#* **Lists +*) + +(*#* + List and membership of lists are used in the definition of +%''totally bounded''% #"totally bounded"#. Note that we use the Leibniz equality in the definition +of [MSmember], and not the setoid equality. So we are really talking about +finite sets of representants, instead of finite subsetoids. This seems to make + the proofs a bit easier. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/MSmember.con". + +(* UNEXPORTED +Implicit Arguments MSmember [X]. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/to_IR.con". + +inline "cic:/CoRN/metrics/CPMSTheory/from_IR.con". + +inline "cic:/CoRN/metrics/CPMSTheory/list_IR.con". + +inline "cic:/CoRN/metrics/CPMSTheory/is_P.con". + +(*#* +If a real number is element of a list in the above defined sense, +it is an element of the list in the sense of [member], +that uses the setoid equality. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/member1.con". + +(*#* +The image under a certain mapping of an element of a list $l$ #l# is member +of the list of images of elements of $l$ #l#. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/map_member.con". + +(* UNEXPORTED +End lists +*) + +(* UNEXPORTED +Section loc_and_bound +*) + +(*#* **Pseudo Metric Space theory +*) + +inline "cic:/CoRN/metrics/CPMSTheory/Re_co_do.con". + +inline "cic:/CoRN/metrics/CPMSTheory/Re_co_do_strext.con". + +inline "cic:/CoRN/metrics/CPMSTheory/re_co_do.con". + +inline "cic:/CoRN/metrics/CPMSTheory/re_co_do_well_def.con". + +(* UNEXPORTED +Implicit Arguments MSmember [X]. +*) + +(*#* +Again we see that the image under a certain mapping of an element of a list $l$ +#l# is member of the list of images of elements of $l$ #l#. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/map_member'.con". + +inline "cic:/CoRN/metrics/CPMSTheory/bounded.con". + +inline "cic:/CoRN/metrics/CPMSTheory/MStotally_bounded.con". + +(*#* +Total boundedness is preserved under uniformly continuous mappings. +*) + +(* UNEXPORTED +Implicit Arguments SubPsMetricSpace [X]. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/unicon_resp_totallybounded.con". + +inline "cic:/CoRN/metrics/CPMSTheory/MStotallybounded_totallybounded.con". + +(*#* +Every image under an uniformly continuous function of an totally bounded +pseudo metric space has an infimum and a supremum. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/infimum_exists.con". + +inline "cic:/CoRN/metrics/CPMSTheory/supremum_exists.con". + +(*#* +A subspace $P$#P# of a pseudo metric space $X$#X# is said to be located if for all +elements $x$#x# of $X$#X# there exists an infimum for the distance +between $x$#x# and the elements of $P$#P#. +*) + +(* UNEXPORTED +Implicit Arguments dsub'_as_cs_fun [X]. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/located.con". + +(* UNEXPORTED +Implicit Arguments located [X]. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/located'.con". + +(* UNEXPORTED +Implicit Arguments located' [X]. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/located_imp_located'.con". + +(*#* +Every totally bounded pseudo metric space is located. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/MStotally_bounded_imp_located.con". + +(*#* +For all $x$#x# in a pseudo metric space $X$#X#, for all located subspaces $P$#P# of $X$#X#, +[Floc] chooses for a given natural number $n$#n# an $y$#y# in $P$#P# such that: +$d(x,y)\leq \mbox{inf}\{d(x,p)|p \in P\}+(n+1)^{-1}$ +#d(x,y) ≤ inf{d(x,p)| pϵP} + (n+1)-1#. +[Flocfun] does (almost) the same, but has a different type. This enables +one to use the latter as an argument of [map]. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/Floc.con". + +inline "cic:/CoRN/metrics/CPMSTheory/Flocfun.con". + +(*#* +A located subset $P$#P# of a totally bounded pseudo metric space $X$ +#X# is totally +bounded. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/locatedsub_totallybounded_imp_totallyboundedsub.con". + +(*#* +Here are some definitions that could come in handy: +*) + +inline "cic:/CoRN/metrics/CPMSTheory/MSCauchy_seq.con". + +(* UNEXPORTED +Implicit Arguments MSseqLimit' [X]. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/MSComplete.con". + +(*#* +A compact pseudo metric space is a pseudo metric space which is complete and +totally bounded. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/MSCompact.con". + +(*#* +A subset $P$#P# is %\emph{open}%#open# if for all $x$#x# in $P$#P# there exists an open sphere +with centre $x$#x# that is contained in $P$#P#. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/open.con". + +(* UNEXPORTED +Implicit Arguments open [X]. +*) + +(*#* +The operator [infima] gives the infimum for the distance between an +element $x$#x# of a located pseudo metric space $X$#X# and the elements of a +subspace $P$#P# of $X$#X#. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/infima.con". + +(* UNEXPORTED +Implicit Arguments infima [X]. +*) + +(*#* +A non-empty totally bounded sub-pseudo-metric-space $P$#P# is said to be +%\emph{well contained}% #well contained# in an open sub-pseudo-metric-space $Q$#Q# if $Q$#Q# contains +all points that are in some sense close to $P$#P#. +*) + +inline "cic:/CoRN/metrics/CPMSTheory/well_contained.con". + +(* UNEXPORTED +End loc_and_bound +*) + diff --git a/matita/contribs/CoRN-Decl/metrics/CPseudoMSpaces.ma b/matita/contribs/CoRN-Decl/metrics/CPseudoMSpaces.ma new file mode 100644 index 000000000..7b64208ff --- /dev/null +++ b/matita/contribs/CoRN-Decl/metrics/CPseudoMSpaces.ma @@ -0,0 +1,192 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/metrics/CPseudoMSpaces". + +include "CoRN.ma". + +(* $Id: CPseudoMSpaces.v,v 1.3 2004/04/23 10:01:02 lcf Exp $ *) + +include "reals/Intervals.ma". + +(*#* *Metric Spaces +*) + +(* UNEXPORTED +Section Relations +*) + +(*#* **Relations necessary for Pseudo Metric Spaces and Metric Spaces +%\begin{convention}% +Let [A : CSetoid], [d : (CSetoid_bin_fun A A IR)]. +%\end{convention}% +*) + +alias id "A" = "cic:/CoRN/metrics/CPseudoMSpaces/Relations/A.var". + +alias id "d" = "cic:/CoRN/metrics/CPseudoMSpaces/Relations/d.var". + +(* UNEXPORTED +Set Implicit Arguments. +*) + +(* UNEXPORTED +Unset Strict Implicit. +*) + +inline "cic:/CoRN/metrics/CPseudoMSpaces/com.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/nneg.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/pos_imp_ap.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/tri_ineq.con". + +(* UNEXPORTED +Set Strict Implicit. +*) + +(* UNEXPORTED +Unset Implicit Arguments. +*) + +inline "cic:/CoRN/metrics/CPseudoMSpaces/diag_zero.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/apdiag_imp_grzero.con". + +(* UNEXPORTED +End Relations +*) + +(* UNEXPORTED +Section Definition_PsMS0 +*) + +(*#* **Definition of Pseudo Metric Space +*) + +(*#* +A pseudo metric space consists of a setoid and a %''pseudo metric''% #"pseudo metric"#, also called +%''distance''% #"distance"#, a binairy function that fulfils certain properties. +*) + +inline "cic:/CoRN/metrics/CPseudoMSpaces/is_CPsMetricSpace.ind". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/CPsMetricSpace.ind". + +coercion cic:/matita/CoRN-Decl/metrics/CPseudoMSpaces/cms_crr.con 0 (* compounds *). + +(* UNEXPORTED +End Definition_PsMS0 +*) + +(* UNEXPORTED +Implicit Arguments cms_d [c]. +*) + +(* NOTATION +Infix "[-d]" := cms_d (at level 68, left associativity). +*) + +(* UNEXPORTED +Section PsMS_axioms +*) + +(*#* **Pseudo Metric Space axioms +%\begin{convention}% +Let [A] be a pseudo metric space. +%\end{convention}% +*) + +alias id "A" = "cic:/CoRN/metrics/CPseudoMSpaces/PsMS_axioms/A.var". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/CPsMetricSpace_is_CPsMetricSpace.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/d_com.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/d_nneg.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/d_pos_imp_ap.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/d_tri_ineq.con". + +(* UNEXPORTED +End PsMS_axioms +*) + +(* UNEXPORTED +Section PsMS_basics +*) + +(*#* **Pseudo Metric Space basics +%\begin{convention}% +Let [Y] be a pseudo metric space. +%\end{convention}% +*) + +alias id "Y" = "cic:/CoRN/metrics/CPseudoMSpaces/PsMS_basics/Y.var". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/rev_tri_ineq.con". + +(*#* +Instead of taking [pos_imp_ap] as axiom, +we could as well have taken [diag_zero]. +*) + +inline "cic:/CoRN/metrics/CPseudoMSpaces/diag_zero_imp_pos_imp_ap.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/pos_imp_ap_imp_diag_zero.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/is_CPsMetricSpace_diag_zero.con". + +(* UNEXPORTED +End PsMS_basics +*) + +(* UNEXPORTED +Section Zerof +*) + +(*#* **Zero function +*) + +(*#* +Every setoid forms with the binary function that always returns zero, +a pseudo metric space. +*) + +inline "cic:/CoRN/metrics/CPseudoMSpaces/zero_fun.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/zero_fun_strext.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/Zero_fun.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/zero_fun_com.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/zero_fun_nneg.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/zero_fun_pos_imp_ap.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/zero_fun_tri_ineq.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/zf_is_CPsMetricSpace.con". + +inline "cic:/CoRN/metrics/CPseudoMSpaces/zf_as_CPsMetricSpace.con". + +(* UNEXPORTED +End Zerof +*) + diff --git a/matita/contribs/CoRN-Decl/metrics/ContFunctions.ma b/matita/contribs/CoRN-Decl/metrics/ContFunctions.ma new file mode 100644 index 000000000..504a7d7a0 --- /dev/null +++ b/matita/contribs/CoRN-Decl/metrics/ContFunctions.ma @@ -0,0 +1,248 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/metrics/ContFunctions". + +include "CoRN.ma". + +(* $Id: ContFunctions.v,v 1.3 2004/04/23 10:01:02 lcf Exp $ *) + +include "metrics/CPseudoMSpaces.ma". + +(* UNEXPORTED +Section Continuous_functions +*) + +(*#* **Continuous functions, uniformly continuous functions and Lipschitz functions +%\begin{convention}% +Let [A] and [B] be pseudo metric spaces. +%\end{convention}% +*) + +alias id "A" = "cic:/CoRN/metrics/ContFunctions/Continuous_functions/A.var". + +alias id "B" = "cic:/CoRN/metrics/ContFunctions/Continuous_functions/B.var". + +(*#* +We will look at some notions of continuous functions. +*) + +inline "cic:/CoRN/metrics/ContFunctions/continuous.con". + +inline "cic:/CoRN/metrics/ContFunctions/continuous'.con". + +inline "cic:/CoRN/metrics/ContFunctions/uni_continuous.con". + +inline "cic:/CoRN/metrics/ContFunctions/uni_continuous'.con". + +inline "cic:/CoRN/metrics/ContFunctions/uni_continuous''.con". + +inline "cic:/CoRN/metrics/ContFunctions/lipschitz.con". + +inline "cic:/CoRN/metrics/ContFunctions/lipschitz'.con". + +(* UNEXPORTED +End Continuous_functions +*) + +(* UNEXPORTED +Implicit Arguments continuous [A B]. +*) + +(* UNEXPORTED +Implicit Arguments uni_continuous [A B]. +*) + +(* UNEXPORTED +Implicit Arguments lipschitz [A B]. +*) + +(* UNEXPORTED +Implicit Arguments continuous' [A B]. +*) + +(* UNEXPORTED +Implicit Arguments uni_continuous' [A B]. +*) + +(* UNEXPORTED +Implicit Arguments uni_continuous'' [A B]. +*) + +(* UNEXPORTED +Implicit Arguments lipschitz' [A B]. +*) + +(* UNEXPORTED +Section Lemmas +*) + +(* begin hide *) + +inline "cic:/CoRN/metrics/ContFunctions/nexp_power.con". + +(* end hide *) + +inline "cic:/CoRN/metrics/ContFunctions/continuous_imp_continuous'.con". + +inline "cic:/CoRN/metrics/ContFunctions/continuous'_imp_continuous.con". + +inline "cic:/CoRN/metrics/ContFunctions/uni_continuous_imp_uni_continuous'.con". + +inline "cic:/CoRN/metrics/ContFunctions/uni_continuous'_imp_uni_continuous.con". + +inline "cic:/CoRN/metrics/ContFunctions/uni_continuous'_imp_uni_continuous''.con". + +inline "cic:/CoRN/metrics/ContFunctions/lipschitz_imp_lipschitz'.con". + +inline "cic:/CoRN/metrics/ContFunctions/lipschitz'_imp_lipschitz.con". + +(*#* +Every uniformly continuous function is continuous and +every Lipschitz function is uniformly continuous. +*) + +inline "cic:/CoRN/metrics/ContFunctions/uni_continuous_imp_continuous.con". + +inline "cic:/CoRN/metrics/ContFunctions/lipschitz_imp_uni_continuous.con". + +(* UNEXPORTED +End Lemmas +*) + +(* UNEXPORTED +Section Identity +*) + +(*#* **Identity +*) + +(*#* +The identity function is Lipschitz. +Hence it is uniformly continuous and continuous. +*) + +inline "cic:/CoRN/metrics/ContFunctions/id_is_lipschitz.con". + +inline "cic:/CoRN/metrics/ContFunctions/id_is_uni_continuous.con". + +inline "cic:/CoRN/metrics/ContFunctions/id_is_continuous.con". + +(* UNEXPORTED +End Identity +*) + +(* UNEXPORTED +Section Constant +*) + +(*#* **Constant functions +%\begin{convention}% +Let [B] and [X] be pseudo metric spaces. +%\end{convention}% +*) + +(*#* +Any constant function is Lipschitz. +Hence it is uniformly continuous and continuous. +*) + +alias id "B" = "cic:/CoRN/metrics/ContFunctions/Constant/B.var". + +alias id "X" = "cic:/CoRN/metrics/ContFunctions/Constant/X.var". + +inline "cic:/CoRN/metrics/ContFunctions/const_fun_is_lipschitz.con". + +inline "cic:/CoRN/metrics/ContFunctions/const_fun_is_uni_continuous.con". + +inline "cic:/CoRN/metrics/ContFunctions/const_fun_is_continuous.con". + +(* UNEXPORTED +End Constant +*) + +(* UNEXPORTED +Section Composition +*) + +(*#* **Composition +%\begin{convention}% +Let [B],[C] and [X] be pseudo metric spaces. +Let [f : (CSetoid_fun X B)] and +[g : (CSetoid_fun B C)]. +%\end{convention}% +*) + +(*#* +The composition of two Lipschitz/uniformly continous/continuous functions is +again Lipschitz/uniformly continuous/continuous. +*) + +alias id "X" = "cic:/CoRN/metrics/ContFunctions/Composition/X.var". + +alias id "B" = "cic:/CoRN/metrics/ContFunctions/Composition/B.var". + +alias id "f" = "cic:/CoRN/metrics/ContFunctions/Composition/f.var". + +alias id "C" = "cic:/CoRN/metrics/ContFunctions/Composition/C.var". + +alias id "g" = "cic:/CoRN/metrics/ContFunctions/Composition/g.var". + +inline "cic:/CoRN/metrics/ContFunctions/comp_resp_lipschitz.con". + +inline "cic:/CoRN/metrics/ContFunctions/comp_resp_uni_continuous.con". + +inline "cic:/CoRN/metrics/ContFunctions/comp_resp_continuous.con". + +(* UNEXPORTED +End Composition +*) + +(* UNEXPORTED +Section Limit +*) + +(*#* **Limit +*) + +inline "cic:/CoRN/metrics/ContFunctions/MSseqLimit.con". + +(* UNEXPORTED +Implicit Arguments MSseqLimit [X]. +*) + +inline "cic:/CoRN/metrics/ContFunctions/MSseqLimit'.con". + +(* UNEXPORTED +Implicit Arguments MSseqLimit' [X]. +*) + +inline "cic:/CoRN/metrics/ContFunctions/MSseqLimit_imp_MSseqLimit'.con". + +inline "cic:/CoRN/metrics/ContFunctions/MSseqLimit'_imp_MSseqLimit.con". + +inline "cic:/CoRN/metrics/ContFunctions/seqcontinuous'.con". + +(* UNEXPORTED +Implicit Arguments seqcontinuous' [A B]. +*) + +inline "cic:/CoRN/metrics/ContFunctions/continuous'_imp_seqcontinuous'.con". + +(* UNEXPORTED +End Limit +*) + diff --git a/matita/contribs/CoRN-Decl/metrics/Equiv.ma b/matita/contribs/CoRN-Decl/metrics/Equiv.ma new file mode 100644 index 000000000..22f6da216 --- /dev/null +++ b/matita/contribs/CoRN-Decl/metrics/Equiv.ma @@ -0,0 +1,66 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/metrics/Equiv". + +include "CoRN.ma". + +(* $Id: Equiv.v,v 1.4 2004/04/23 10:01:02 lcf Exp $ *) + +include "metrics/IR_CPMSpace.ma". + +(* UNEXPORTED +Section equivalent +*) + +(*#* **Equivalent Pseudo Metric Spaces +*) + +(*#* +We say that two pseudo metric spaces are equivalent, when there exists a +bijective, structure-preserving function between them. +*) + +inline "cic:/CoRN/metrics/Equiv/equivalent_psmetric.con". + +inline "cic:/CoRN/metrics/Equiv/isopsmetry.con". + +(* UNEXPORTED +Implicit Arguments isopsmetry [X Y]. +*) + +inline "cic:/CoRN/metrics/Equiv/isopsmetry_imp_bij.con". + +inline "cic:/CoRN/metrics/Equiv/isopsmetry_imp_lipschitz.con". + +inline "cic:/CoRN/metrics/Equiv/id_is_isopsmetry.con". + +inline "cic:/CoRN/metrics/Equiv/comp_resp_isopsmetry.con". + +inline "cic:/CoRN/metrics/Equiv/inv_isopsmetry.con". + +inline "cic:/CoRN/metrics/Equiv/MSequivalent.con". + +(*#* +Not all pseudo metric spaces are equivalent: +*) + +inline "cic:/CoRN/metrics/Equiv/MSequivalent_discr.con". + +(* UNEXPORTED +End equivalent +*) + diff --git a/matita/contribs/CoRN-Decl/metrics/IR_CPMSpace.ma b/matita/contribs/CoRN-Decl/metrics/IR_CPMSpace.ma new file mode 100644 index 000000000..fd53f0838 --- /dev/null +++ b/matita/contribs/CoRN-Decl/metrics/IR_CPMSpace.ma @@ -0,0 +1,105 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/metrics/IR_CPMSpace". + +include "CoRN.ma". + +(* $Id: IR_CPMSpace.v,v 1.4 2004/04/23 10:01:02 lcf Exp $ *) + +include "metrics/ContFunctions.ma". + +(* UNEXPORTED +Section Reals +*) + +(*#* **Real numbers +*) + +(*#* +%\begin{convention}% +Let [X] be a pseudo metric space. +%\end{convention}% +*) + +(*#* +The real numbers with the usual distance form a pseudo metric space. +*) + +inline "cic:/CoRN/metrics/IR_CPMSpace/dIR.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/bin_fun_strext_dIR.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/dIR_as_CSetoid_fun.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/dIR_nneg.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/dIR_com.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/dIR_pos_imp_ap.con". + +(* begin hide *) + +inline "cic:/CoRN/metrics/IR_CPMSpace/IR_tri_ineq.con". + +(* end hide *) + +inline "cic:/CoRN/metrics/IR_CPMSpace/dIR_tri_ineq.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/IR_dIR_is_CPsMetricSpace.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/IR_as_CPsMetricSpace.con". + +alias id "X" = "cic:/CoRN/metrics/IR_CPMSpace/Reals/X.var". + +inline "cic:/CoRN/metrics/IR_CPMSpace/rev_tri_ineq'.con". + +(*#* +A pseudo metric is Lipschitz. Hence it is uniformly continuous and continuous. +*) + +inline "cic:/CoRN/metrics/IR_CPMSpace/d_is_lipschitz.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/d_is_uni_continuous.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/d_is_continuous.con". + +(* UNEXPORTED +End Reals +*) + +(* UNEXPORTED +Section Addition +*) + +(*#* **Addition of continuous functions +*) + +(*#* +The sum of two Lipschitz/uniformly continous/continuous functions is again +Lipschitz/uniformly continuous/continuous. +*) + +inline "cic:/CoRN/metrics/IR_CPMSpace/plus_resp_lipschitz.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/plus_resp_uni_continuous.con". + +inline "cic:/CoRN/metrics/IR_CPMSpace/plus_resp_continuous.con". + +(* UNEXPORTED +End Addition +*) + diff --git a/matita/contribs/CoRN-Decl/metrics/Prod_Sub.ma b/matita/contribs/CoRN-Decl/metrics/Prod_Sub.ma new file mode 100644 index 000000000..46746e6f4 --- /dev/null +++ b/matita/contribs/CoRN-Decl/metrics/Prod_Sub.ma @@ -0,0 +1,131 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/metrics/Prod_Sub". + +include "CoRN.ma". + +(* $Id: Prod_Sub.v,v 1.4 2004/04/23 10:01:02 lcf Exp $ *) + +include "metrics/IR_CPMSpace.ma". + +(* UNEXPORTED +Section prodpsmetrics +*) + +(*#* **Product-Pseudo-Metric-Spaces +*) + +(*#* +The product metric here defined is: +$ d_{prod}((a_1,b_1),(a_2,b_2)):= d_A(a_1,a_2)+d_B(b_1,b_2)$ +# dprod((a1,b1),(a2,b2)):= dA(a1,b1)+dB(b1,b2)#. +This is %\emph{not}% #not# the one used to make the metric of +$\RR^{2}$ #IR2# out of the metric of $\RR$ #IR#. +*) + +inline "cic:/CoRN/metrics/Prod_Sub/dprod0.con". + +inline "cic:/CoRN/metrics/Prod_Sub/dprod0_strext.con". + +inline "cic:/CoRN/metrics/Prod_Sub/d_prod0.con". + +inline "cic:/CoRN/metrics/Prod_Sub/prod0cpsmetricspace_is_CPsMetricSpace.con". + +inline "cic:/CoRN/metrics/Prod_Sub/Prod0CPsMetricSpace.con". + +(* UNEXPORTED +End prodpsmetrics +*) + +(* UNEXPORTED +Section subpsmetrics +*) + +(*#* **Sub-Pseudo-Metric-Spaces +*) + +(*#* +The pseudo metric on a subspace $Y$ #Y# of a pseudo metric space $X$ #X# is +the pseudo metric on $X$ #X# restricted to $Y$ #Y#. +*) + +inline "cic:/CoRN/metrics/Prod_Sub/restr_bin_fun.con". + +(* UNEXPORTED +Implicit Arguments restr_bin_fun [X]. +*) + +inline "cic:/CoRN/metrics/Prod_Sub/restr_bin_fun'.con". + +(* UNEXPORTED +Implicit Arguments restr_bin_fun' [X]. +*) + +inline "cic:/CoRN/metrics/Prod_Sub/restr_bin_fun_strext.con". + +inline "cic:/CoRN/metrics/Prod_Sub/Build_SubCSetoid_bin_fun.con". + +inline "cic:/CoRN/metrics/Prod_Sub/dsub.con". + +(* UNEXPORTED +Implicit Arguments dsub [X]. +*) + +inline "cic:/CoRN/metrics/Prod_Sub/dsub_com.con". + +inline "cic:/CoRN/metrics/Prod_Sub/dsub_nneg.con". + +inline "cic:/CoRN/metrics/Prod_Sub/dsub_pos_imp_ap.con". + +inline "cic:/CoRN/metrics/Prod_Sub/dsub_tri_ineq.con". + +inline "cic:/CoRN/metrics/Prod_Sub/is_SubPsMetricSpace.con". + +inline "cic:/CoRN/metrics/Prod_Sub/SubPsMetricSpace.con". + +(* UNEXPORTED +Implicit Arguments SubPsMetricSpace [X]. +*) + +inline "cic:/CoRN/metrics/Prod_Sub/from_SubPsMetricSpace.con". + +(*#* +The function [dsub'] is used in the definition of %''located''% #"located"#. +It enables one to speak about a distance between an element of a +pseudo metric space and a certain subspace. +*) + +inline "cic:/CoRN/metrics/Prod_Sub/dsub'.con". + +(* UNEXPORTED +Implicit Arguments dsub' [X]. +*) + +inline "cic:/CoRN/metrics/Prod_Sub/dsub'_strext.con". + +inline "cic:/CoRN/metrics/Prod_Sub/dsub'_as_cs_fun.con". + +(* UNEXPORTED +Implicit Arguments dsub'_as_cs_fun [X]. +*) + +inline "cic:/CoRN/metrics/Prod_Sub/dsub'_uni_continuous''.con". + +(* UNEXPORTED +End subpsmetrics +*) + diff --git a/matita/contribs/CoRN-Decl/model/abgroups/QSposabgroup.ma b/matita/contribs/CoRN-Decl/model/abgroups/QSposabgroup.ma new file mode 100644 index 000000000..4e6f57e8c --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/abgroups/QSposabgroup.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/abgroups/QSposabgroup". + +include "CoRN.ma". + +(* $Id: QSposabgroup.v,v 1.5 2004/04/08 08:20:31 lcf Exp $ *) + +include "model/groups/QSposgroup.ma". + +include "algebra/CAbGroups.ma". + +(*#* **Example of an abelian group: $\langle$#⟨#[Qpos],$(x,y) \mapsto xy/2$ #(x,y) ↦ xy/2#$\rangle$#⟩# +The positive rational numbers form with the operation $(x,y) \mapsto xy/2$ #(x,y) ↦ xy/2# an abelian group. +*) + +inline "cic:/CoRN/model/abgroups/QSposabgroup/Qpos_multdiv2_is_CAbGroup.con". + +inline "cic:/CoRN/model/abgroups/QSposabgroup/Qpos_multdiv2_as_CAbGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/abgroups/Qabgroup.ma b/matita/contribs/CoRN-Decl/model/abgroups/Qabgroup.ma new file mode 100644 index 000000000..57c6da7d6 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/abgroups/Qabgroup.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/abgroups/Qabgroup". + +include "CoRN.ma". + +(* $Id: Qabgroup.v,v 1.5 2004/04/08 08:20:31 lcf Exp $ *) + +include "model/groups/Qgroup.ma". + +include "algebra/CAbGroups.ma". + +(*#* **Example of an abelian group: $\langle$#⟨#[Q],[[+]]$\rangle$#⟩# +*) + +(*#* Addition is commutative, so the rationals form with the addition a +CAbGroup. +*) + +inline "cic:/CoRN/model/abgroups/Qabgroup/Q_is_CAbGroup.con". + +inline "cic:/CoRN/model/abgroups/Qabgroup/Q_as_CAbGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/abgroups/Qposabgroup.ma b/matita/contribs/CoRN-Decl/model/abgroups/Qposabgroup.ma new file mode 100644 index 000000000..4c5f2b2d9 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/abgroups/Qposabgroup.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/abgroups/Qposabgroup". + +include "CoRN.ma". + +(* $Id: Qposabgroup.v,v 1.6 2004/04/08 08:20:31 lcf Exp $ *) + +include "model/groups/Qposgroup.ma". + +include "algebra/CAbGroups.ma". + +(*#* **Example of an abelian group: $\langle$#⟨#[Qpos],[[*]]$\rangle$#⟩# +The positive rationals form with the multiplication a CAbgroup. +*) + +inline "cic:/CoRN/model/abgroups/Qposabgroup/Qpos_mult_is_CAbGroup.con". + +inline "cic:/CoRN/model/abgroups/Qposabgroup/Qpos_mult_as_CAbGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/abgroups/Zabgroup.ma b/matita/contribs/CoRN-Decl/model/abgroups/Zabgroup.ma new file mode 100644 index 000000000..0cfc20cca --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/abgroups/Zabgroup.ma @@ -0,0 +1,35 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/abgroups/Zabgroup". + +include "CoRN.ma". + +(* $Id: Zabgroup.v,v 1.5 2004/04/08 08:20:32 lcf Exp $ *) + +include "model/groups/Zgroup.ma". + +include "algebra/CAbGroups.ma". + +(*#* **Example of an abelian group: $\langle$#⟨#[Z],[[+]]$\rangle$#⟩# +*) + +inline "cic:/CoRN/model/abgroups/Zabgroup/Z_is_CAbGroup.con". + +inline "cic:/CoRN/model/abgroups/Zabgroup/Z_as_CAbGroup.con". + +(*#* The term [Z_as_CAbGroup] is of type [CAbGroup]. Hence we have proven that [Z] is a constructive Abelian group. *) + diff --git a/matita/contribs/CoRN-Decl/model/fields/Qfield.ma b/matita/contribs/CoRN-Decl/model/fields/Qfield.ma new file mode 100644 index 000000000..8024b79f3 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/fields/Qfield.ma @@ -0,0 +1,35 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/fields/Qfield". + +include "CoRN.ma". + +(* $Id: Qfield.v,v 1.8 2004/04/08 08:20:32 lcf Exp $ *) + +include "model/rings/Qring.ma". + +include "algebra/CFields.ma". + +(*#* **Example of a field: $\langle$#⟨#[Q],[[+]],[[*]]$\rangle$#⟩# +As we have seen, there is a inverse for the multiplication for non-zeroes. +So, [Q] not only forms a ring, but even a field. +*) + +inline "cic:/CoRN/model/fields/Qfield/Q_is_CField.con". + +inline "cic:/CoRN/model/fields/Qfield/Q_as_CField.con". + diff --git a/matita/contribs/CoRN-Decl/model/groups/QSposgroup.ma b/matita/contribs/CoRN-Decl/model/groups/QSposgroup.ma new file mode 100644 index 000000000..99993bd80 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/groups/QSposgroup.ma @@ -0,0 +1,35 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/groups/QSposgroup". + +include "CoRN.ma". + +(* $Id: QSposgroup.v,v 1.6 2004/04/08 08:20:32 lcf Exp $ *) + +include "model/monoids/QSposmonoid.ma". + +include "algebra/CGroups.ma". + +(*#* **Example of a group: $\langle$#⟨#[Qpos],$(x,y) \mapsto xy/2$ #(x,y) ↦ xy/2#$\rangle$#⟩# +The positive rationals form with the operation $(x,y) \mapsto xy/2$ +#(x,y) ↦ xy/2# a CGroup. +*) + +inline "cic:/CoRN/model/groups/QSposgroup/Qpos_multdiv2_is_CGroup.con". + +inline "cic:/CoRN/model/groups/QSposgroup/Qpos_multdiv2_as_CGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/groups/Qgroup.ma b/matita/contribs/CoRN-Decl/model/groups/Qgroup.ma new file mode 100644 index 000000000..e508583d6 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/groups/Qgroup.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/groups/Qgroup". + +include "CoRN.ma". + +(* $Id: Qgroup.v,v 1.5 2004/04/08 08:20:32 lcf Exp $ *) + +include "model/monoids/Qmonoid.ma". + +include "algebra/CGroups.ma". + +(*#* **Example of a group: $\langle$#⟨#[Q],[[+]]$\rangle$#⟩# +The rational numbers with addition form a group. The inverse function is taking the opposite. +*) + +inline "cic:/CoRN/model/groups/Qgroup/Q_is_CGroup.con". + +inline "cic:/CoRN/model/groups/Qgroup/Q_as_CGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/groups/Qposgroup.ma b/matita/contribs/CoRN-Decl/model/groups/Qposgroup.ma new file mode 100644 index 000000000..02e0b6c33 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/groups/Qposgroup.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/groups/Qposgroup". + +include "CoRN.ma". + +(* $Id: Qposgroup.v,v 1.6 2004/04/08 08:20:32 lcf Exp $ *) + +include "model/monoids/Qposmonoid.ma". + +include "algebra/CGroups.ma". + +(*#* **Example of a group: $\langle$#⟨#[Qpos],[[*]]$\rangle$#⟩# +The positive rational numbers form a multiplicative group. +*) + +inline "cic:/CoRN/model/groups/Qposgroup/Qpos_is_CGroup.con". + +inline "cic:/CoRN/model/groups/Qposgroup/Qpos_as_CGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/groups/Zgroup.ma b/matita/contribs/CoRN-Decl/model/groups/Zgroup.ma new file mode 100644 index 000000000..3f5430193 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/groups/Zgroup.ma @@ -0,0 +1,35 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/groups/Zgroup". + +include "CoRN.ma". + +(* $Id: Zgroup.v,v 1.5 2004/04/08 08:20:32 lcf Exp $ *) + +include "model/monoids/Zmonoid.ma". + +include "algebra/CGroups.ma". + +(*#* **Example of a group: $\langle$#⟨#[Z],[[+]]$\rangle$#⟩# +*) + +inline "cic:/CoRN/model/groups/Zgroup/Z_is_CGroup.con". + +inline "cic:/CoRN/model/groups/Zgroup/Z_as_CGroup.con". + +(*#* The term [Z_as_CGroup] is of type [CGroup]. Hence we have proven that [Z] is a constructive group. *) + diff --git a/matita/contribs/CoRN-Decl/model/monoids/Nmonoid.ma b/matita/contribs/CoRN-Decl/model/monoids/Nmonoid.ma new file mode 100644 index 000000000..4eac5c0c6 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/monoids/Nmonoid.ma @@ -0,0 +1,42 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/monoids/Nmonoid". + +include "CoRN.ma". + +(* $Id: Nmonoid.v,v 1.5 2004/04/08 08:20:32 lcf Exp $ *) + +include "model/semigroups/Nsemigroup.ma". + +include "algebra/CMonoids.ma". + +(*#* **Example of a monoid: $\langle$#⟨#[nat],[[+]]$\rangle$#⟩# +Zero is an unit for the addition. +*) + +inline "cic:/CoRN/model/monoids/Nmonoid/O_as_rht_unit.con". + +inline "cic:/CoRN/model/monoids/Nmonoid/O_as_lft_unit.con". + +inline "cic:/CoRN/model/monoids/Nmonoid/nat_is_CMonoid.con". + +(*#* + Whence we can define ##%\emph{%the monoid of natural numbers%}%##: +*) + +inline "cic:/CoRN/model/monoids/Nmonoid/nat_as_CMonoid.con". + diff --git a/matita/contribs/CoRN-Decl/model/monoids/Nposmonoid.ma b/matita/contribs/CoRN-Decl/model/monoids/Nposmonoid.ma new file mode 100644 index 000000000..1d23f7d4a --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/monoids/Nposmonoid.ma @@ -0,0 +1,42 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/monoids/Nposmonoid". + +include "CoRN.ma". + +(* $Id: Nposmonoid.v,v 1.6 2004/04/08 08:20:33 lcf Exp $ *) + +include "model/semigroups/Npossemigroup.ma". + +include "algebra/CMonoids.ma". + +(*#* **Example of a monoid: $\langle$#⟨#[Npos],[[*]]$\rangle$#⟩# +One is the right unit as well as the left unit of the multiplication on the +positive natural numbers. +*) + +inline "cic:/CoRN/model/monoids/Nposmonoid/rhtunitNpos.con". + +inline "cic:/CoRN/model/monoids/Nposmonoid/lftunitNpos.con". + +(*#* So, the positive natural numbers with multiplication form a CMonoid. +*) + +inline "cic:/CoRN/model/monoids/Nposmonoid/Nposmult_is_CMonoid.con". + +inline "cic:/CoRN/model/monoids/Nposmonoid/Nposmult_as_CMonoid.con". + diff --git a/matita/contribs/CoRN-Decl/model/monoids/QSposmonoid.ma b/matita/contribs/CoRN-Decl/model/monoids/QSposmonoid.ma new file mode 100644 index 000000000..0ec63cd7b --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/monoids/QSposmonoid.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/monoids/QSposmonoid". + +include "CoRN.ma". + +(* $Id: QSposmonoid.v,v 1.5 2004/04/08 08:20:33 lcf Exp $ *) + +include "model/semigroups/QSpossemigroup.ma". + +include "algebra/CMonoids.ma". + +(*#* **Example of a monoid: $\langle$#⟨#[Qpos],$(x,y) \mapsto xy/2$ #(x,y) ↦ xy/2#$\rangle$#⟩# +Two is the unit of the operation $(x,y) \mapsto xy/2$ #(x,y) + ↦ xy/2# on the positive rationals. So we have another monoid structure on the positive rational numbers. +*) + +inline "cic:/CoRN/model/monoids/QSposmonoid/QTWOpos_is_rht_unit.con". + +inline "cic:/CoRN/model/monoids/QSposmonoid/QTWOpos_is_lft_unit.con". + +inline "cic:/CoRN/model/monoids/QSposmonoid/Qpos_multdiv2_is_CMonoid.con". + +inline "cic:/CoRN/model/monoids/QSposmonoid/Qpos_multdiv2_as_CMonoid.con". + diff --git a/matita/contribs/CoRN-Decl/model/monoids/Qmonoid.ma b/matita/contribs/CoRN-Decl/model/monoids/Qmonoid.ma new file mode 100644 index 000000000..e19460778 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/monoids/Qmonoid.ma @@ -0,0 +1,51 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/monoids/Qmonoid". + +include "CoRN.ma". + +(* $Id: Qmonoid.v,v 1.7 2004/04/08 08:20:33 lcf Exp $ *) + +include "model/semigroups/Qsemigroup.ma". + +include "algebra/CMonoids.ma". + +(*#* **Examples of a monoid: $\langle$#⟨#[Q],[[+]]$\rangle$#⟩# and $\langle$#⟨#[Q],[[*]]$\rangle$#⟩# +***$\langle$#⟨#[Q],[[+]]$\rangle$#⟩# +The rational numbers form with addition a CMonoid. [QZERO] is the unit. +*) + +inline "cic:/CoRN/model/monoids/Qmonoid/ZEROQ_as_rht_unit3.con". + +inline "cic:/CoRN/model/monoids/Qmonoid/ZEROQ_as_lft_unit3.con". + +inline "cic:/CoRN/model/monoids/Qmonoid/Q_is_CMonoid.con". + +inline "cic:/CoRN/model/monoids/Qmonoid/Q_as_CMonoid.con". + +(*#* ***$\langle$#⟨#[Q],[[*]]$\rangle$#⟩# +Also with multiplication Q forms a CMonoid. Here, the unit is [QONE]. +*) + +inline "cic:/CoRN/model/monoids/Qmonoid/ONEQ_as_rht_unit.con". + +inline "cic:/CoRN/model/monoids/Qmonoid/ONEQ_as_lft_unit.con". + +inline "cic:/CoRN/model/monoids/Qmonoid/Q_mul_is_CMonoid.con". + +inline "cic:/CoRN/model/monoids/Qmonoid/Q_mul_as_CMonoid.con". + diff --git a/matita/contribs/CoRN-Decl/model/monoids/Qposmonoid.ma b/matita/contribs/CoRN-Decl/model/monoids/Qposmonoid.ma new file mode 100644 index 000000000..e8f9f96ee --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/monoids/Qposmonoid.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/monoids/Qposmonoid". + +include "CoRN.ma". + +(* $Id: Qposmonoid.v,v 1.7 2004/04/08 08:20:33 lcf Exp $ *) + +include "model/semigroups/Qpossemigroup.ma". + +include "algebra/CMonoids.ma". + +(*#* **Example of a monoid: $\langle$#⟨#[Qpos],[[*]]$\rangle$#⟩# +One is the unit for multiplication on positive integers. Therefore the positive rational numbers together with the multiplication are a CMonoid. +*) + +inline "cic:/CoRN/model/monoids/Qposmonoid/QONEpos_is_rht_unit.con". + +inline "cic:/CoRN/model/monoids/Qposmonoid/QONEpos_is_lft_unit.con". + +inline "cic:/CoRN/model/monoids/Qposmonoid/Qpos_mult_is_CMonoid.con". + +inline "cic:/CoRN/model/monoids/Qposmonoid/Qpos_mult_as_CMonoid.con". + diff --git a/matita/contribs/CoRN-Decl/model/monoids/Zmonoid.ma b/matita/contribs/CoRN-Decl/model/monoids/Zmonoid.ma new file mode 100644 index 000000000..d6b0ddea4 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/monoids/Zmonoid.ma @@ -0,0 +1,57 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/monoids/Zmonoid". + +include "CoRN.ma". + +(* $Id: Zmonoid.v,v 1.6 2004/04/08 08:20:33 lcf Exp $ *) + +include "model/semigroups/Zsemigroup.ma". + +include "algebra/CMonoids.ma". + +(*#* **Examples of monoids: $\langle$#⟨#[Z],[[+]]$\rangle$#⟩# and $\langle$#⟨#[Z],[[*]]$\rangle$#⟩# +***$\langle$#⟨#[Z],[[+]]$\rangle$#⟩# +We use the addition [ZERO] (defined in the standard library) as the +unit of monoid: +*) + +inline "cic:/CoRN/model/monoids/Zmonoid/ZERO_as_rht_unit.con". + +inline "cic:/CoRN/model/monoids/Zmonoid/ZERO_as_lft_unit.con". + +inline "cic:/CoRN/model/monoids/Zmonoid/Z_is_CMonoid.con". + +inline "cic:/CoRN/model/monoids/Zmonoid/Z_as_CMonoid.con". + +(*#* The term [Z_as_CMonoid] is of type [CMonoid]. Hence we have proven that [Z] is a constructive monoid. + +***$\langle$#⟨#[Z],[[*]]$\rangle$#⟩# +As the multiplicative unit we should use [`1`], which is [(POS xH)] in +the representation we have for integers. +*) + +inline "cic:/CoRN/model/monoids/Zmonoid/ONE_as_rht_unit.con". + +inline "cic:/CoRN/model/monoids/Zmonoid/ONE_as_lft_unit.con". + +inline "cic:/CoRN/model/monoids/Zmonoid/Z_mul_is_CMonoid.con". + +inline "cic:/CoRN/model/monoids/Zmonoid/Z_mul_as_CMonoid.con". + +(*#* The term [Z_mul_as_CMonoid] is another term of type [CMonoid]. *) + diff --git a/matita/contribs/CoRN-Decl/model/non_examples/N_no_group.ma b/matita/contribs/CoRN-Decl/model/non_examples/N_no_group.ma new file mode 100644 index 000000000..260cc8d68 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/non_examples/N_no_group.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/non_examples/N_no_group". + +include "CoRN.ma". + +(* $Id: N_no_group.v,v 1.5 2004/04/08 08:20:33 lcf Exp $ *) + +include "model/monoids/Nmonoid.ma". + +include "algebra/CGroups.ma". + +(*#* **Non-example of a group: $\langle$#⟨#[nat],[[+]]$\rangle$#⟩# +There is no inverse function for the natural numbers with addition. +*) + +inline "cic:/CoRN/model/non_examples/N_no_group/no_inverse_nat_plus.con". + +(*#* Hence they do not form a CGroup. +*) + +inline "cic:/CoRN/model/non_examples/N_no_group/no_group_nat_plus.con". + diff --git a/matita/contribs/CoRN-Decl/model/non_examples/Npos_no_group.ma b/matita/contribs/CoRN-Decl/model/non_examples/Npos_no_group.ma new file mode 100644 index 000000000..7f86667be --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/non_examples/Npos_no_group.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/non_examples/Npos_no_group". + +include "CoRN.ma". + +(* $Id: Npos_no_group.v,v 1.6 2004/04/08 08:20:33 lcf Exp $ *) + +include "algebra/CGroups.ma". + +include "model/monoids/Nposmonoid.ma". + +(*#* **Non-example of a group: $\langle$#⟨#[Npos],[[+]]$\rangle$#⟩# +There is no inverse for multiplication on the positive natural numbers. +*) + +inline "cic:/CoRN/model/non_examples/Npos_no_group/no_inverse_Nposmult.con". + +(*#* Hence the natural numbers with multiplication do not form a group. +*) + +inline "cic:/CoRN/model/non_examples/Npos_no_group/no_group_Nposmult.con". + diff --git a/matita/contribs/CoRN-Decl/model/non_examples/Npos_no_monoid.ma b/matita/contribs/CoRN-Decl/model/non_examples/Npos_no_monoid.ma new file mode 100644 index 000000000..7dbff7050 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/non_examples/Npos_no_monoid.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/non_examples/Npos_no_monoid". + +include "CoRN.ma". + +(* $Id: Npos_no_monoid.v,v 1.5 2004/04/08 08:20:34 lcf Exp $ *) + +include "model/semigroups/Npossemigroup.ma". + +include "algebra/CMonoids.ma". + +(*#* **Non-example of a monoid: $\langle$#⟨#[Npos],[[+]]$\rangle$#⟩# +There is no right unit for the addition on the positive natural numbers. +*) + +inline "cic:/CoRN/model/non_examples/Npos_no_monoid/no_rht_unit_Npos.con". + +(*#* Therefore the set of positive natural numbers doesn't form a group with +addition. +*) + +inline "cic:/CoRN/model/non_examples/Npos_no_monoid/no_monoid_Npos.con". + diff --git a/matita/contribs/CoRN-Decl/model/ordfields/Qordfield.ma b/matita/contribs/CoRN-Decl/model/ordfields/Qordfield.ma new file mode 100644 index 000000000..0729946f3 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/ordfields/Qordfield.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/ordfields/Qordfield". + +include "CoRN.ma". + +(* $Id: Qordfield.v,v 1.9 2004/04/23 10:01:03 lcf Exp $ *) + +include "model/fields/Qfield.ma". + +include "algebra/COrdFields.ma". + +(*#* **Example of an ordered field: $\langle$#⟨#[Q],[[+]],[[*]],[[<]]$\rangle$#⟩# + [Q] is an archemaedian ordered field. +*) + +inline "cic:/CoRN/model/ordfields/Qordfield/Qlt_is_strict_order.con". + +inline "cic:/CoRN/model/ordfields/Qordfield/Q_is_COrdField.con". + +inline "cic:/CoRN/model/ordfields/Qordfield/Q_as_COrdField.con". + +inline "cic:/CoRN/model/ordfields/Qordfield/Q_is_archemaedian.con". + diff --git a/matita/contribs/CoRN-Decl/model/reals/Cauchy_IR.ma b/matita/contribs/CoRN-Decl/model/reals/Cauchy_IR.ma new file mode 100644 index 000000000..a355fe3ed --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/reals/Cauchy_IR.ma @@ -0,0 +1,36 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/reals/Cauchy_IR". + +include "CoRN.ma". + +(* $Id: Cauchy_IR.v,v 1.2 2004/04/06 15:46:03 lcf Exp $ *) + +include "model/ordfields/Qordfield.ma". + +include "reals/Cauchy_CReals.ma". + +(*#* * Cauchy Real Numbers +Earlier we defined a construction of a real number structure from an +arbitrary archimedian ordered field. Plugging in [Q] we get the model +of the real numbers as Cauchy sequences of rationals. +*) + +inline "cic:/CoRN/model/reals/Cauchy_IR/Cauchy_IR.con". + +(*#* The term [Cauchy_IR] is of type [CReals]. *) + diff --git a/matita/contribs/CoRN-Decl/model/rings/Qring.ma b/matita/contribs/CoRN-Decl/model/rings/Qring.ma new file mode 100644 index 000000000..5a1723d1c --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/rings/Qring.ma @@ -0,0 +1,48 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/rings/Qring". + +include "CoRN.ma". + +(* $Id: Qring.v,v 1.8 2004/04/23 10:01:03 lcf Exp $ *) + +include "model/abgroups/Qabgroup.ma". + +include "algebra/CRings.ma". + +include "model/rings/Zring.ma". + +(*#* **Example of a ring: $\langle$#⟨#[Q],[[+]],[[*]]$\rangle$#⟩# +Because [Q] forms an abelian group with addition, a monoid with +multiplication and it satisfies the distributive law, it is a ring. +*) + +inline "cic:/CoRN/model/rings/Qring/Q_mult_plus_is_dist.con". + +inline "cic:/CoRN/model/rings/Qring/Q_is_CRing.con". + +inline "cic:/CoRN/model/rings/Qring/Q_as_CRing.con". + +(*#* The following lemmas are used in the proof that [Q] is Archimeadian. +*) + +inline "cic:/CoRN/model/rings/Qring/injz_Nring.con". + +inline "cic:/CoRN/model/rings/Qring/injZ_eq.con". + +inline "cic:/CoRN/model/rings/Qring/nring_Q.con". + diff --git a/matita/contribs/CoRN-Decl/model/rings/Zring.ma b/matita/contribs/CoRN-Decl/model/rings/Zring.ma new file mode 100644 index 000000000..3927f4332 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/rings/Zring.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/rings/Zring". + +include "CoRN.ma". + +(* $Id: Zring.v,v 1.6 2004/04/08 08:20:34 lcf Exp $ *) + +include "model/abgroups/Zabgroup.ma". + +include "algebra/CRings.ma". + +(*#* **Example of a ring: $\langle$#⟨#[Z],[[+]],[[*]]$\rangle$#⟩# + +The multiplication and the addition are distributive. +*) + +inline "cic:/CoRN/model/rings/Zring/Z_mult_plus_is_dist.con". + +inline "cic:/CoRN/model/rings/Zring/Z_is_CRing.con". + +inline "cic:/CoRN/model/rings/Zring/Z_as_CRing.con". + +(*#* The term [Z_as_CRing] is of type [CRing]. Hence we have proven that [Z] is a constructive ring. *) + diff --git a/matita/contribs/CoRN-Decl/model/semigroups/Npossemigroup.ma b/matita/contribs/CoRN-Decl/model/semigroups/Npossemigroup.ma new file mode 100644 index 000000000..466677d04 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/semigroups/Npossemigroup.ma @@ -0,0 +1,44 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/semigroups/Npossemigroup". + +include "CoRN.ma". + +(* $Id: Npossemigroup.v,v 1.6 2004/04/08 08:20:34 lcf Exp $ *) + +include "algebra/CSemiGroups.ma". + +include "model/semigroups/Nsemigroup.ma". + +include "model/setoids/Npossetoid.ma". + +(*#* **Examples of semi-groups: $\langle$#⟨#[Npos],[[+]]$\rangle$#⟩# and $\langle$#⟨#[Npos],[[*]]$\rangle$#⟩# +***$\langle$#⟨#[Npos],[[+]]$\rangle$#⟩# +The positive natural numbers form together with addition a subsemigroup + of the semigroup of the natural numbers with addition. +*) + +inline "cic:/CoRN/model/semigroups/Npossemigroup/Npos_as_CSemiGroup.con". + +(*#* ***$\langle$#⟨#[Npos],[[*]]$\rangle$#⟩# +Also together with multiplication, the positive numbers form a semigroup. +*) + +inline "cic:/CoRN/model/semigroups/Npossemigroup/Nposmult_is_CSemiGroup.con". + +inline "cic:/CoRN/model/semigroups/Npossemigroup/Nposmult_as_CSemiGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/semigroups/Nsemigroup.ma b/matita/contribs/CoRN-Decl/model/semigroups/Nsemigroup.ma new file mode 100644 index 000000000..393e00359 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/semigroups/Nsemigroup.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/semigroups/Nsemigroup". + +include "CoRN.ma". + +(* $Id: Nsemigroup.v,v 1.6 2004/04/08 08:20:34 lcf Exp $ *) + +include "model/setoids/Nsetoid.ma". + +include "algebra/CSemiGroups.ma". + +(*#* **Example of a semi-group: $\langle$#⟨#[nat],[[+]]$\rangle$#⟩# +*) + +(*#* Because addition is associative, the natural numbers form a CSemiGroup. +*) + +inline "cic:/CoRN/model/semigroups/Nsemigroup/nat_as_CSemiGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/semigroups/QSpossemigroup.ma b/matita/contribs/CoRN-Decl/model/semigroups/QSpossemigroup.ma new file mode 100644 index 000000000..54eb20c11 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/semigroups/QSpossemigroup.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/semigroups/QSpossemigroup". + +include "CoRN.ma". + +(* $Id: QSpossemigroup.v,v 1.5 2004/04/08 08:20:35 lcf Exp $ *) + +include "model/setoids/Qpossetoid.ma". + +include "algebra/CSemiGroups.ma". + +(*#* **Example of a semi-group: $\langle$#⟨#[Qpos],$(x,y) \mapsto xy/2$#(x,y) ↦ xy/2#$\rangle$#⟩# +The positive rationals form with the operation +$(x,y) \mapsto xy/2$#(x,y) ↦ xy/2# a CSemiGroup. +*) + +inline "cic:/CoRN/model/semigroups/QSpossemigroup/Qpos_multdiv2_as_CSemiGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/semigroups/Qpossemigroup.ma b/matita/contribs/CoRN-Decl/model/semigroups/Qpossemigroup.ma new file mode 100644 index 000000000..f4336222a --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/semigroups/Qpossemigroup.ma @@ -0,0 +1,32 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/semigroups/Qpossemigroup". + +include "CoRN.ma". + +(* $Id: Qpossemigroup.v,v 1.6 2004/04/08 08:20:35 lcf Exp $ *) + +include "model/setoids/Qpossetoid.ma". + +include "algebra/CSemiGroups.ma". + +(*#* **Example of a semi-group: $\langle$#⟨#[Qpos],[[*]]$\rangle$#⟩# +The positive rationals form with the multiplication a CSemiGroup. +*) + +inline "cic:/CoRN/model/semigroups/Qpossemigroup/Qpos_mult_as_CSemiGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/semigroups/Qsemigroup.ma b/matita/contribs/CoRN-Decl/model/semigroups/Qsemigroup.ma new file mode 100644 index 000000000..09fbc4aca --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/semigroups/Qsemigroup.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/semigroups/Qsemigroup". + +include "CoRN.ma". + +(* $Id: Qsemigroup.v,v 1.6 2004/04/08 08:20:35 lcf Exp $ *) + +include "model/setoids/Qsetoid.ma". + +include "algebra/CSemiGroups.ma". + +(*#* **Examples of semi-groups: $\langle$#⟨#[Q],[[+]]$\rangle$#⟩# and $\langle$#⟨#[Q],[[*]]$\rangle$#⟩# +***$\langle$#⟨#[Q],[[+]]$\rangle$#⟩# +*) + +inline "cic:/CoRN/model/semigroups/Qsemigroup/Q_as_CSemiGroup.con". + +(*#* ***$\langle$#⟨#[Q],[[*]]$\rangle$#⟩# +*) + +inline "cic:/CoRN/model/semigroups/Qsemigroup/Q_mul_as_CSemiGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/semigroups/Zsemigroup.ma b/matita/contribs/CoRN-Decl/model/semigroups/Zsemigroup.ma new file mode 100644 index 000000000..4ec6a0ac6 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/semigroups/Zsemigroup.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/semigroups/Zsemigroup". + +include "CoRN.ma". + +(* $Id: Zsemigroup.v,v 1.6 2004/04/08 08:20:35 lcf Exp $ *) + +include "model/setoids/Zsetoid.ma". + +include "algebra/CSemiGroups.ma". + +(*#* **Examples of semi-groups: $\langle$#⟨#[Z],[[+]]$\rangle$#⟩# and $\langle$#⟨#[Z],[[*]]$\rangle$#⟩# +***$\langle$#⟨#[Z],[[+]]$\rangle$#⟩# +*) + +inline "cic:/CoRN/model/semigroups/Zsemigroup/Z_as_CSemiGroup.con". + +(*#* The term [Z_as_CSemiGroup] is of type [CSemiGroup]. Hence we have proven that [Z] is a constructive semi-group. *) + +(*#* ***$\langle$#⟨#[Z],[[*]]$\rangle$#⟩# +*) + +inline "cic:/CoRN/model/semigroups/Zsemigroup/Z_mul_as_CSemiGroup.con". + diff --git a/matita/contribs/CoRN-Decl/model/setoids/Npossetoid.ma b/matita/contribs/CoRN-Decl/model/setoids/Npossetoid.ma new file mode 100644 index 000000000..23363a170 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/setoids/Npossetoid.ma @@ -0,0 +1,70 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/setoids/Npossetoid". + +include "CoRN.ma". + +(* $Id: Npossetoid.v,v 1.3 2004/04/06 15:46:04 lcf Exp $ *) + +include "model/setoids/Nsetoid.ma". + +include "model/structures/Npossec.ma". + +include "algebra/CSetoidFun.ma". + +(*#* **Example of a setoid: [Npos] + +*** Setoid +The positive natural numbers [Npos] will be defined as a subsetoid of the +natural numbers. +*) + +inline "cic:/CoRN/model/setoids/Npossetoid/Npos.con". + +inline "cic:/CoRN/model/setoids/Npossetoid/NposP.con". + +(*#* One and two are elements of it. +*) + +inline "cic:/CoRN/model/setoids/Npossetoid/ONEpos.con". + +inline "cic:/CoRN/model/setoids/Npossetoid/TWOpos.con". + +(*#* ***Addition and multiplication +Because addition and multiplication preserve positivity, we can define +them on this subsetoid. +*) + +inline "cic:/CoRN/model/setoids/Npossetoid/plus_resp_Npos.con". + +inline "cic:/CoRN/model/setoids/Npossetoid/Npos_plus.con". + +inline "cic:/CoRN/model/setoids/Npossetoid/mult_resp_Npos.con". + +inline "cic:/CoRN/model/setoids/Npossetoid/Npos_mult.con". + +(*#* The addition has no right unit on this set. +*) + +inline "cic:/CoRN/model/setoids/Npossetoid/no_rht_unit_Npos1.con". + +(*#* And the multiplication doesn't have an inverse, because there can't be an +inverse for 2. +*) + +inline "cic:/CoRN/model/setoids/Npossetoid/no_inverse_Nposmult1.con". + diff --git a/matita/contribs/CoRN-Decl/model/setoids/Nsetoid.ma b/matita/contribs/CoRN-Decl/model/setoids/Nsetoid.ma new file mode 100644 index 000000000..b3bf1fc3d --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/setoids/Nsetoid.ma @@ -0,0 +1,66 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/setoids/Nsetoid". + +include "CoRN.ma". + +(* $Id: Nsetoid.v,v 1.4 2004/04/06 15:46:04 lcf Exp $ *) + +include "model/structures/Nsec.ma". + +include "algebra/CSetoidFun.ma". + +(*#* **Example of a setoid: [nat] + +We will show that the natural numbers form a CSetoid. +*) + +inline "cic:/CoRN/model/setoids/Nsetoid/ap_nat_irreflexive.con". + +inline "cic:/CoRN/model/setoids/Nsetoid/ap_nat_symmetric.con". + +inline "cic:/CoRN/model/setoids/Nsetoid/ap_nat_cotransitive.con". + +inline "cic:/CoRN/model/setoids/Nsetoid/ap_nat_tight.con". + +inline "cic:/CoRN/model/setoids/Nsetoid/ap_nat_is_apartness.con". + +inline "cic:/CoRN/model/setoids/Nsetoid/nat_as_CSetoid.con". + +(*#* ***Addition +*) + +inline "cic:/CoRN/model/setoids/Nsetoid/plus_wd.con". + +inline "cic:/CoRN/model/setoids/Nsetoid/plus_strext.con". + +inline "cic:/CoRN/model/setoids/Nsetoid/plus_is_bin_fun.con". + +(*#* It is associative and commutative. +*) + +inline "cic:/CoRN/model/setoids/Nsetoid/plus_is_assoc.con". + +inline "cic:/CoRN/model/setoids/Nsetoid/plus_is_commut.con". + +(*#* ***Multiplication +*) + +inline "cic:/CoRN/model/setoids/Nsetoid/mult_strext.con". + +inline "cic:/CoRN/model/setoids/Nsetoid/mult_as_bin_fun.con". + diff --git a/matita/contribs/CoRN-Decl/model/setoids/Qpossetoid.ma b/matita/contribs/CoRN-Decl/model/setoids/Qpossetoid.ma new file mode 100644 index 000000000..9557dc175 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/setoids/Qpossetoid.ma @@ -0,0 +1,99 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/setoids/Qpossetoid". + +include "CoRN.ma". + +(* $Id: Qpossetoid.v,v 1.4 2004/04/06 15:46:05 lcf Exp $ *) + +include "model/setoids/Qsetoid.ma". + +include "algebra/CSetoidFun.ma". + +include "model/structures/Qpossec.ma". + +(*#* **Example of a setoid: [Qpos] +***Setoid +We will examine the subsetoid of positive rationals of the setoid of +rational numbers. +*) + +inline "cic:/CoRN/model/setoids/Qpossetoid/Qpos.con". + +inline "cic:/CoRN/model/setoids/Qpossetoid/QposP.con". + +(*#* One, two and four are elements of it. +*) + +inline "cic:/CoRN/model/setoids/Qpossetoid/QONEpos.con". + +inline "cic:/CoRN/model/setoids/Qpossetoid/QTWOpos.con". + +inline "cic:/CoRN/model/setoids/Qpossetoid/QFOURpos.con". + +(*#* ***Multiplication +As we have seen, multiplication preserves positivity, so we can restrict it + to the positive rationals. We see that this restricted multiplication has some + nice properties. +*) + +inline "cic:/CoRN/model/setoids/Qpossetoid/Qmult_pres_pos1.con". + +inline "cic:/CoRN/model/setoids/Qpossetoid/Qpos_mult.con". + +inline "cic:/CoRN/model/setoids/Qpossetoid/associative_Qpos_mult.con". + +(*#* ***Inverse +We restrict the domain of the inverse to the set of positive rationals. +*) + +inline "cic:/CoRN/model/setoids/Qpossetoid/Qpos_inv.con". + +(*#* The restricted inverse preserves positivity. +*) + +inline "cic:/CoRN/model/setoids/Qpossetoid/inv_pres_pos1.con". + +(*#* Now, we can also restrict the co-domain. +*) + +inline "cic:/CoRN/model/setoids/Qpossetoid/Qpos_Qpos_inv.con". + +(*#* This restricted inverse map appears a setoid function. +*) + +inline "cic:/CoRN/model/setoids/Qpossetoid/Qpos_Qpos_inv_strong_ext.con". + +inline "cic:/CoRN/model/setoids/Qpossetoid/Qpos_Qpos_inv_op.con". + +(*#* ***Special multiplication and inverse +We define [multdiv2]: $(x,y) \mapsto xy/2$ #(x,y) ↦ xy/2#. +*) + +inline "cic:/CoRN/model/setoids/Qpossetoid/Qpos_div2.con". + +inline "cic:/CoRN/model/setoids/Qpossetoid/multdiv2.con". + +inline "cic:/CoRN/model/setoids/Qpossetoid/associative_multdiv2.con". + +(*#* And its inverse [multdiv4]: $x \mapsto 4/x$ #x ↦ 4/x#. +*) + +inline "cic:/CoRN/model/setoids/Qpossetoid/mult4.con". + +inline "cic:/CoRN/model/setoids/Qpossetoid/divmult4.con". + diff --git a/matita/contribs/CoRN-Decl/model/setoids/Qsetoid.ma b/matita/contribs/CoRN-Decl/model/setoids/Qsetoid.ma new file mode 100644 index 000000000..71cdafa4a --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/setoids/Qsetoid.ma @@ -0,0 +1,90 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/setoids/Qsetoid". + +include "CoRN.ma". + +(* $Id: Qsetoid.v,v 1.6 2004/04/06 15:46:05 lcf Exp $ *) + +include "model/structures/Qsec.ma". + +include "algebra/CSetoidFun.ma". + +(*#* **Example of a setoid: [Q] +***Setoid +*) + +inline "cic:/CoRN/model/setoids/Qsetoid/ap_Q_irreflexive1.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/ap_Q_symmetric1.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/ap_Q_cotransitive1.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/ap_Q_tight1.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/ap_Q_is_apartness.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Q_as_CSetoid.con". + +(*#* ***Addition +*) + +inline "cic:/CoRN/model/setoids/Qsetoid/Qplus_wd.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Qplus_strext1.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Qplus_is_bin_fun.con". + +(*#* It is associative and commutative. +*) + +inline "cic:/CoRN/model/setoids/Qsetoid/Qplus_is_assoc.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Qplus_is_commut1.con". + +(*#* ***Opposite +*) + +inline "cic:/CoRN/model/setoids/Qsetoid/Qopp_wd.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Qopp_strext.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Qopp_is_fun.con". + +(*#* ***Multiplication +*) + +inline "cic:/CoRN/model/setoids/Qsetoid/Qmult_wd.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Qmult_strext1.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Qmult_is_bin_fun.con". + +(*#* It is associative and commutative. +*) + +inline "cic:/CoRN/model/setoids/Qsetoid/Qmult_is_assoc.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Qmult_is_commut.con". + +(*#* ***Less-than +*) + +inline "cic:/CoRN/model/setoids/Qsetoid/Qlt_strext.con". + +inline "cic:/CoRN/model/setoids/Qsetoid/Qlt_is_CSetoid_relation.con". + diff --git a/matita/contribs/CoRN-Decl/model/setoids/Zsetoid.ma b/matita/contribs/CoRN-Decl/model/setoids/Zsetoid.ma new file mode 100644 index 000000000..84541c4db --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/setoids/Zsetoid.ma @@ -0,0 +1,84 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/setoids/Zsetoid". + +include "CoRN.ma". + +(* $Id: Zsetoid.v,v 1.5 2004/04/07 15:08:08 lcf Exp $ *) + +include "model/structures/Zsec.ma". + +include "algebra/CSetoidFun.ma". + +(*#* **Example of a setoid: [Z] +*** [Z] +*) + +inline "cic:/CoRN/model/setoids/Zsetoid/ap_Z_irreflexive.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/ap_Z_symmetric.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/ap_Z_cotransitive.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/ap_Z_tight.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/ap_Z_is_apartness.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Z_as_CSetoid.con". + +(*#* The term [Z_as_CSetoid] is of type [CSetoid]. Hence we have proven that [Z] is a constructive setoid. +***Addition +We will prove now that the addition on the integers is a setoid function. +*) + +inline "cic:/CoRN/model/setoids/Zsetoid/Zplus_wd.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Zplus_strext.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Zplus_is_bin_fun.con". + +(*#* What's more: the addition is also associative and commutative. +*) + +inline "cic:/CoRN/model/setoids/Zsetoid/Zplus_is_assoc.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Zplus_is_commut.con". + +(*#* ***Opposite +Taking the opposite of an integer is a setoid function. +*) + +inline "cic:/CoRN/model/setoids/Zsetoid/Zopp_wd.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Zopp_strext.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Zopp_is_fun.con". + +(*#* ***Multiplication +Finally the multiplication is a setoid function and is associative and commutative. +*) + +inline "cic:/CoRN/model/setoids/Zsetoid/Zmult_wd.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Zmult_strext.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Zmult_is_bin_fun.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Zmult_is_assoc.con". + +inline "cic:/CoRN/model/setoids/Zsetoid/Zmult_is_commut.con". + diff --git a/matita/contribs/CoRN-Decl/model/structures/Npossec.ma b/matita/contribs/CoRN-Decl/model/structures/Npossec.ma new file mode 100644 index 000000000..7a47323f6 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/structures/Npossec.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/structures/Npossec". + +include "CoRN.ma". + +(* $Id: Npossec.v,v 1.3 2004/04/06 15:46:05 lcf Exp $ *) + +(*#* printing Npos $\mathbb{N}^{+}$ #N+# *) + +include "model/structures/Nsec.ma". + +(*#* **[Npos] +The positive natural numbers have some nice properties. Addition as well +as multiplication preserve the feature of being positive. +*) + +inline "cic:/CoRN/model/structures/Npossec/plus_resp_Npos0.con". + +inline "cic:/CoRN/model/structures/Npossec/Npos_is_suc.con". + +inline "cic:/CoRN/model/structures/Npossec/mult_resp_Npos0.con". + diff --git a/matita/contribs/CoRN-Decl/model/structures/Nsec.ma b/matita/contribs/CoRN-Decl/model/structures/Nsec.ma new file mode 100644 index 000000000..084be106c --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/structures/Nsec.ma @@ -0,0 +1,68 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/structures/Nsec". + +include "CoRN.ma". + +(* $Id: Nsec.v,v 1.6 2004/04/06 15:46:05 lcf Exp $ *) + +(*#* printing {#N} $\ensuremath{\mathrel\#_{\mathbb N}}$ *) + +include "algebra/CLogic.ma". + +(*#* *[nat] +**About [nat] + +We prove some basic lemmas of the natural numbers. + +A variant of [0_S] from the standard library +*) + +inline "cic:/CoRN/model/structures/Nsec/S_O.con". + +(*#* ***Apartness +*) + +inline "cic:/CoRN/model/structures/Nsec/ap_nat.con". + +(* NOTATION +Infix "{#N}" := ap_nat (no associativity, at level 90). +*) + +inline "cic:/CoRN/model/structures/Nsec/ap_nat_irreflexive0.con". + +inline "cic:/CoRN/model/structures/Nsec/ap_nat_symmetric0.con". + +inline "cic:/CoRN/model/structures/Nsec/ap_nat_cotransitive0.con". + +inline "cic:/CoRN/model/structures/Nsec/ap_nat_tight0.con". + +(*#* ***Addition +*) + +inline "cic:/CoRN/model/structures/Nsec/plus_strext0.con". + +(*#* There is no inverse for addition, because every candidate will fail for 2 +*) + +inline "cic:/CoRN/model/structures/Nsec/no_inverse0.con". + +(*#* ***Multiplication +*) + +inline "cic:/CoRN/model/structures/Nsec/mult_strext0.con". + diff --git a/matita/contribs/CoRN-Decl/model/structures/Qpossec.ma b/matita/contribs/CoRN-Decl/model/structures/Qpossec.ma new file mode 100644 index 000000000..38f43ac38 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/structures/Qpossec.ma @@ -0,0 +1,70 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/structures/Qpossec". + +include "CoRN.ma". + +(* $Id: Qpossec.v,v 1.5 2004/04/06 15:46:05 lcf Exp $ *) + +(*#* printing Qpos $\mathbb{Q}^{+}$ #Q+# *) + +include "model/structures/Qsec.ma". + +include "algebra/CLogic.ma". + +(*#* **About [Qpos] +We will prove some lemmas concerning rationals bigger than 0. + +***Constants +One, two and four are all bigger than zero. +*) + +inline "cic:/CoRN/model/structures/Qpossec/pos_QONE.con". + +inline "cic:/CoRN/model/structures/Qpossec/pos_QTWO.con". + +inline "cic:/CoRN/model/structures/Qpossec/pos_QFOUR.con". + +(*#* A positive rational is not zero. +*) + +inline "cic:/CoRN/model/structures/Qpossec/pos_imp_nonzero.con". + +(*#* ***Multiplication +The product of two positive rationals is again positive. +*) + +inline "cic:/CoRN/model/structures/Qpossec/Qmult_pres_pos0.con". + +(*#* ***Inverse +The inverse of a positive rational is again positive. +*) + +inline "cic:/CoRN/model/structures/Qpossec/inv_pres_pos0.con". + +(*#* ***Special multiplication +Now we will investigate the function $(x,y) \mapsto xy/2$#(x,y) +↦ xy/2#. We will see that its unit is 2. Its inverse map is $x +\mapsto 4/x$ #x ↦ 4/x#. +*) + +inline "cic:/CoRN/model/structures/Qpossec/QTWOpos_is_rht_unit0.con". + +inline "cic:/CoRN/model/structures/Qpossec/QTWOpos_is_left_unit0.con". + +inline "cic:/CoRN/model/structures/Qpossec/multdiv2_is_inv.con". + diff --git a/matita/contribs/CoRN-Decl/model/structures/Qsec.ma b/matita/contribs/CoRN-Decl/model/structures/Qsec.ma new file mode 100644 index 000000000..42d6e5671 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/structures/Qsec.ma @@ -0,0 +1,266 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/structures/Qsec". + +include "CoRN.ma". + +(* $Id: Qsec.v,v 1.7 2004/04/08 08:20:35 lcf Exp $ *) + +(*#* printing Q %\ensuremath{\mathbb{Q}}% *) + +(*#* printing QZERO %\ensuremath{0_\mathbb{Q}}% #0Q# *) + +(*#* printing QONE %\ensuremath{1_\mathbb{Q}}% #1Q# *) + +(*#* printing QTWO %\ensuremath{2_\mathbb{Q}}% #2Q# *) + +(*#* printing QFOUR %\ensuremath{4_\mathbb{Q}}% #4Q# *) + +include "algebra/CLogic.ma". + +include "model/structures/Zsec.ma". + +(*#* *[Q] +**About [Q] +We define the structure of rational numbers as follows. First of all, +it consists of the set of rational numbers, defined as the set of +pairs $\langle a,n\rangle$#⟨a,n⟩# with [a:Z] and +[n:positive]. Intuitively, $\langle a,n\rangle$#⟨a,n⟩# +represents the rational number [a[/]n]. Then there is the equality on +[Q]: $\langle a,m\rangle=\langle +b,n\rangle$#⟨a,m⟩=⟨b,n⟩# iff [an [=] bm]. We +also define apartness, order, addition, multiplication, opposite, +inverse an de constants 0 and 1. *) + +(* UNEXPORTED +Section Q +*) + +inline "cic:/CoRN/model/structures/Qsec/Q.ind". + +inline "cic:/CoRN/model/structures/Qsec/Qeq.con". + +inline "cic:/CoRN/model/structures/Qsec/Qap.con". + +inline "cic:/CoRN/model/structures/Qsec/Qlt.con". + +inline "cic:/CoRN/model/structures/Qsec/Qplus.con". + +inline "cic:/CoRN/model/structures/Qsec/Qmult.con". + +inline "cic:/CoRN/model/structures/Qsec/Qopp.con". + +inline "cic:/CoRN/model/structures/Qsec/QZERO.con". + +inline "cic:/CoRN/model/structures/Qsec/QONE.con". + +inline "cic:/CoRN/model/structures/Qsec/Qinv.con". + +(* UNEXPORTED +End Q +*) + +(* NOTATION +Infix "{=Q}" := Qeq (no associativity, at level 90). +*) + +(* NOTATION +Infix "{#Q}" := Qap (no associativity, at level 90). +*) + +(* NOTATION +Infix "{#%\emph{%not equal%}%## to [QZERO]: +*) + +inline "cic:/CoRN/model/structures/Qsec/ONEQ_neq_ZEROQ.con". + +inline "cic:/CoRN/model/structures/Qsec/refl_Qeq.con". + +inline "cic:/CoRN/model/structures/Qsec/sym_Qeq.con". + +inline "cic:/CoRN/model/structures/Qsec/trans_Qeq.con". + +(*#* + The equality is decidable: +*) + +inline "cic:/CoRN/model/structures/Qsec/dec_Qeq.con". + +(*#* ***Apartness +*) + +inline "cic:/CoRN/model/structures/Qsec/Q_non_zero.con". + +inline "cic:/CoRN/model/structures/Qsec/ap_Q_irreflexive0.con". + +inline "cic:/CoRN/model/structures/Qsec/ap_Q_symmetric0.con". + +inline "cic:/CoRN/model/structures/Qsec/ap_Q_cotransitive0.con". + +inline "cic:/CoRN/model/structures/Qsec/ap_Q_tight0.con". + +(*#* ***Addition +*) + +inline "cic:/CoRN/model/structures/Qsec/Qplus_simpl.con". + +(*#* + Addition is associative: +*) + +inline "cic:/CoRN/model/structures/Qsec/Qplus_assoc.con". + +(*#* + [QZERO] as the neutral element for addition: +*) + +inline "cic:/CoRN/model/structures/Qsec/QZERO_right.con". + +(*#* + Commutativity of addition: +*) + +inline "cic:/CoRN/model/structures/Qsec/Qplus_sym.con". + +inline "cic:/CoRN/model/structures/Qsec/Qplus_strext0.con". + +inline "cic:/CoRN/model/structures/Qsec/ZEROQ_as_rht_unit0.con". + +inline "cic:/CoRN/model/structures/Qsec/ZEROQ_as_lft_unit0.con". + +inline "cic:/CoRN/model/structures/Qsec/Qplus_is_commut0.con". + +(*#* ***Opposite + [{-Q}] is a well defined unary operation: +*) + +inline "cic:/CoRN/model/structures/Qsec/Qopp_simpl.con". + +(*#* + The group equation for [{-Q}] +*) + +inline "cic:/CoRN/model/structures/Qsec/Qplus_inverse_r.con". + +(*#* ***Multiplication +Next we shall prove the properties of multiplication. First we prove +that [{*Q}] is well-defined +*) + +inline "cic:/CoRN/model/structures/Qsec/Qmult_simpl.con". + +(*#* + and it is associative: +*) + +inline "cic:/CoRN/model/structures/Qsec/Qmult_assoc.con". + +(*#* + [QONE] is the neutral element for multiplication: +*) + +inline "cic:/CoRN/model/structures/Qsec/Qmult_n_1.con". + +(*#* + The commutativity for [{*Q}]: +*) + +inline "cic:/CoRN/model/structures/Qsec/Qmult_sym.con". + +inline "cic:/CoRN/model/structures/Qsec/Qmult_plus_distr_r.con". + +(*#* + And a property of multiplication which says if [x [~=] Zero] and [xy [=] Zero] then [y [=] Zero]: +*) + +inline "cic:/CoRN/model/structures/Qsec/Qmult_eq.con". + +inline "cic:/CoRN/model/structures/Qsec/Qmult_strext0.con". + +inline "cic:/CoRN/model/structures/Qsec/nonZero.con". + +(*#* ***Inverse +*) + +inline "cic:/CoRN/model/structures/Qsec/Qinv_strext.con". + +inline "cic:/CoRN/model/structures/Qsec/Qinv_is_inv.con". + +(*#* ***Less-than +*) + +inline "cic:/CoRN/model/structures/Qsec/Qlt_wd_right.con". + +inline "cic:/CoRN/model/structures/Qsec/Qlt_wd_left.con". + +inline "cic:/CoRN/model/structures/Qsec/Qlt_eq_gt_dec.con". + +inline "cic:/CoRN/model/structures/Qsec/Qlt_is_transitive_unfolded.con". + +inline "cic:/CoRN/model/structures/Qsec/Qlt_strext_unfolded.con". + +inline "cic:/CoRN/model/structures/Qsec/Qlt_is_irreflexive_unfolded.con". + +inline "cic:/CoRN/model/structures/Qsec/Qlt_is_antisymmetric_unfolded.con". + +inline "cic:/CoRN/model/structures/Qsec/Qplus_resp_Qlt.con". + +inline "cic:/CoRN/model/structures/Qsec/Qmult_resp_pos_Qlt.con". + +inline "cic:/CoRN/model/structures/Qsec/Qlt_gives_apartness.con". + +(*#* ***Miscellaneous +We consider the injection [inject_Z] from [Z] to [Q] as a coercion. +*) + +inline "cic:/CoRN/model/structures/Qsec/inject_Z.con". + +coercion cic:/matita/CoRN-Decl/model/structures/Qsec/inject_Z.con 0 (* compounds *). + +inline "cic:/CoRN/model/structures/Qsec/injz_plus.con". + +inline "cic:/CoRN/model/structures/Qsec/injZ_One.con". + +(*#* We can always find a natural number that is bigger than a given rational +number. +*) + +inline "cic:/CoRN/model/structures/Qsec/Q_is_archemaedian0.con". + diff --git a/matita/contribs/CoRN-Decl/model/structures/Zsec.ma b/matita/contribs/CoRN-Decl/model/structures/Zsec.ma new file mode 100644 index 000000000..b7aa226b1 --- /dev/null +++ b/matita/contribs/CoRN-Decl/model/structures/Zsec.ma @@ -0,0 +1,100 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/model/structures/Zsec". + +include "CoRN.ma". + +(* $Id: Zsec.v,v 1.5 2004/04/06 15:46:05 lcf Exp $ *) + +(*#* printing {#Z} %\ensuremath{\mathrel\#_{\mathbb Z}}% *) + +include "algebra/CLogic.ma". + +(*#* *[Z] +** About [Z] +We consider the implementation of integers as signed binary sequences (the +datatype [Z] as defined in [ZArith], in the standard library). + +***Apartness +We define the apartness as the negation of the Leibniz equality: +*) + +inline "cic:/CoRN/model/structures/Zsec/ap_Z.con". + +(* NOTATION +Infix "{#Z}" := ap_Z (no associativity, at level 90). +*) + +(*#* Some properties of apartness: +*) + +inline "cic:/CoRN/model/structures/Zsec/ap_Z_irreflexive0.con". + +inline "cic:/CoRN/model/structures/Zsec/ap_Z_symmetric0.con". + +inline "cic:/CoRN/model/structures/Zsec/ap_Z_cotransitive0.con". + +inline "cic:/CoRN/model/structures/Zsec/ap_Z_tight0.con". + +inline "cic:/CoRN/model/structures/Zsec/ONE_neq_O.con". + +(*#* ***Addition +Some properties of the addition. [Zplus] is also defined in the standard +library. +*) + +inline "cic:/CoRN/model/structures/Zsec/Zplus_wd0.con". + +inline "cic:/CoRN/model/structures/Zsec/Zplus_strext0.con". + +(*#* ***Multiplication +The multiplication is extensional: +*) + +inline "cic:/CoRN/model/structures/Zsec/Zmult_strext0.con". + +(*#* ***Miscellaneous +*) + +inline "cic:/CoRN/model/structures/Zsec/Zpos.con". + +(* begin hide *) + +coercion cic:/Coq/ZArith/BinInt/Z.ind#xpointer(1/1/2) 0 (* compounds *). + +(* end hide *) + +inline "cic:/CoRN/model/structures/Zsec/a_very_specific_lemma1.con". + +inline "cic:/CoRN/model/structures/Zsec/a_very_specific_lemma2.con". + +inline "cic:/CoRN/model/structures/Zsec/a_very_specific_lemma3.con". + +inline "cic:/CoRN/model/structures/Zsec/a_very_specific_lemma4.con". + +inline "cic:/CoRN/model/structures/Zsec/a_very_specific_lemma5.con". + +inline "cic:/CoRN/model/structures/Zsec/Zpos_pos.con". + +inline "cic:/CoRN/model/structures/Zsec/Zpos_neg.con". + +inline "cic:/CoRN/model/structures/Zsec/Zpos_Zsgn.con". + +inline "cic:/CoRN/model/structures/Zsec/Zpos_Zsgn2.con". + +inline "cic:/CoRN/model/structures/Zsec/a_very_specific_lemma5'.con". + diff --git a/matita/contribs/CoRN-Decl/ordine_compilazione.txt b/matita/contribs/CoRN-Decl/ordine_compilazione.txt new file mode 100644 index 000000000..27709031b --- /dev/null +++ b/matita/contribs/CoRN-Decl/ordine_compilazione.txt @@ -0,0 +1,157 @@ +CoRN.ma OK +algebra/ListType.ma +algebra/Basics.ma +algebra/CLogic.ma +tactics/Step.ma +algebra/CSetoids.ma +algebra/CSetoidFun.ma +algebra/CSetoidInc.ma +algebra/CSemiGroups.ma +algebra/CMonoids.ma +algebra/CGroups.ma +algebra/CAbGroups.ma +algebra/CAbMonoids.ma +algebra/CSums.ma +algebra/CRings.ma +algebra/CFields.ma +tactics/AlgReflection.ma +tactics/Opaque_algebra.ma +tactics/FieldReflection.ma +tactics/Transparent_algebra.ma +algebra/COrdFields.ma +algebra/COrdFields2.ma +algebra/COrdAbs.ma +algebra/COrdCauchy.ma +tactics/RingReflection.ma +algebra/CPolynomials.ma +algebra/CPoly_NthCoeff.ma +algebra/CPoly_Degree.ma +algebra/CPoly_ApZero.ma +algebra/CVectorSpace.ma +algebra/Cauchy_COF.ma +algebra/Expon.ma +reals/CReals.ma +reals/CauchySeq.ma +reals/Max_AbsIR.ma +reals/CReals1.ma +reals/RealFuncts.ma +reals/CPoly_Contin.ma +reals/IVT.ma +reals/OddPolyRootIR.ma +reals/NRootIR.ma +complex/CComplex.ma +complex/AbsCC.ma +reals/RealLists.ma +reals/Intervals.ma +tactics/DiffTactics1.ma +ftc/PartFunEquality.ma +reals/CSumsReals.ma +ftc/FunctSums.ma +ftc/Continuity.ma +ftc/Derivative.ma +ftc/DerivativeOps.ma +ftc/IntervalFunct.ma +ftc/PartInterval.ma +ftc/Differentiability.ma +ftc/NthDerivative.ma +ftc/MoreIntervals.ma +ftc/MoreFunctions.ma +tactics/DiffTactics2.ma +ftc/Rolle.ma +ftc/TaylorLemma.ma +ftc/Taylor.ma +ftc/Composition.ma +ftc/FunctSequence.ma +reals/Series.ma +ftc/FunctSeries.ma +ftc/MoreFunSeries.ma +tactics/DiffTactics3.ma +ftc/CalculusTheorems.ma +ftc/COrdLemmas.ma +ftc/Partitions.ma +ftc/RefSepRef.ma +ftc/RefSeparated.ma +ftc/RefSeparating.ma +ftc/RefLemma.ma +ftc/Integral.ma +ftc/MoreIntegrals.ma +ftc/FTC.ma +transc/PowerSeries.ma +transc/TaylorSeries.ma +transc/Exponential.ma +transc/Trigonometric.ma +transc/SinCos.ma +transc/Pi.ma +complex/Complex_Exponential.ma +complex/NRootCC.ma +devel/loeb/per/csetfun.ma +devel/loeb/per/lst2fun.ma +model/structures/Nsec.ma +model/setoids/Nsetoid.ma +model/semigroups/Nsemigroup.ma +model/monoids/Nmonoid.ma +model/structures/Zsec.ma +model/setoids/Zsetoid.ma +model/semigroups/Zsemigroup.ma +model/monoids/Zmonoid.ma +model/structures/Qsec.ma +model/setoids/Qsetoid.ma +devel/loeb/IDA/Ch6.ma +fta/CC_Props.ma +fta/CPoly_Contin1.ma +fta/CPoly_Rev.ma +fta/CPoly_Shift.ma +fta/KeyLemma.ma +fta/MainLemma.ma +fta/KneserLemma.ma +fta/FTAreg.ma +fta/FTA.ma +ftc/WeakIVT.ma +ftc/StrongIVT.ma +metrics/CPseudoMSpaces.ma +metrics/ContFunctions.ma +metrics/IR_CPMSpace.ma +metrics/Equiv.ma +metrics/Prod_Sub.ma +metrics/CMetricSpaces.ma +metrics/CPMSTheory.ma +model/structures/Qpossec.ma +model/setoids/Qpossetoid.ma +model/semigroups/QSpossemigroup.ma +model/monoids/QSposmonoid.ma +model/groups/QSposgroup.ma +model/abgroups/QSposabgroup.ma +model/semigroups/Qsemigroup.ma +model/monoids/Qmonoid.ma +model/groups/Qgroup.ma +model/abgroups/Qabgroup.ma +model/semigroups/Qpossemigroup.ma +model/monoids/Qposmonoid.ma +model/groups/Qposgroup.ma +model/abgroups/Qposabgroup.ma +model/groups/Zgroup.ma +model/abgroups/Zabgroup.ma +model/rings/Zring.ma +model/rings/Qring.ma +model/fields/Qfield.ma +model/structures/Npossec.ma +model/setoids/Npossetoid.ma +model/semigroups/Npossemigroup.ma +model/monoids/Nposmonoid.ma +model/non_examples/N_no_group.ma +model/non_examples/Npos_no_group.ma +model/non_examples/Npos_no_monoid.ma +model/ordfields/Qordfield.ma +reals/Cauchy_CReals.ma +model/reals/Cauchy_IR.ma +reals/Q_in_CReals.ma +reals/Q_dense.ma +reals/R_morphism.ma +reals/iso_CReals.ma +reals/Bridges_LUB.ma +reals/Bridges_iso.ma +reals/CMetricFields.ma +tactics/GroupReflection.ma +transc/RealPowers.ma +transc/TrigMon.ma +transc/InvTrigonom.ma diff --git a/matita/contribs/CoRN-Decl/preamble.ma b/matita/contribs/CoRN-Decl/preamble.ma new file mode 100644 index 000000000..9d7d5533a --- /dev/null +++ b/matita/contribs/CoRN-Decl/preamble.ma @@ -0,0 +1,23 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/CoRN-Decl/preamble". + +include "../../legacy/coq.ma". + +alias id "refl_equal" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)". +alias id "False" = "cic:/Coq/Init/Logic/False.ind#xpointer(1/1)". +alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)". +alias id "I" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1/1)". +alias id "sym_eq" = "cic:/Coq/Init/Logic/sym_eq.con". diff --git a/matita/contribs/CoRN-Decl/reals/Bridges_LUB.ma b/matita/contribs/CoRN-Decl/reals/Bridges_LUB.ma new file mode 100644 index 000000000..52059ccee --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/Bridges_LUB.ma @@ -0,0 +1,220 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/Bridges_LUB". + +include "CoRN.ma". + +(* begin hide *) + +(* file : least_upper_bound_principle.v *) + +(* version : 1.50 - 03/05/2001 *) + +(* version : 1.00 - 27/02/2001 *) + +(* author : Milad Niqui *) + +(* language : coq 7.0beta26feb *) + +(* dependency : iso_CReals.v , Expon.v *) + +(* description : proof of the Bridges' least upper bound principle *) + +include "reals/iso_CReals.ma". + +include "algebra/Expon.ma". + +(* UNEXPORTED +Section LUBP +*) + +alias id "R1" = "cic:/CoRN/reals/Bridges_LUB/LUBP/R1.var". + +(* SUBSECTION ON GENRAL DEFINITIONS *) + +(* UNEXPORTED +Section lub_definitions +*) + +alias id "OF" = "cic:/CoRN/reals/Bridges_LUB/LUBP/lub_definitions/OF.var". + +alias id "SS" = "cic:/CoRN/reals/Bridges_LUB/LUBP/lub_definitions/SS.var". + +inline "cic:/CoRN/reals/Bridges_LUB/member.con". + +inline "cic:/CoRN/reals/Bridges_LUB/Pmember.con". + +inline "cic:/CoRN/reals/Bridges_LUB/is_upper_bound.con". + +inline "cic:/CoRN/reals/Bridges_LUB/l_u_b.con". + +inline "cic:/CoRN/reals/Bridges_LUB/supremum.con". + +inline "cic:/CoRN/reals/Bridges_LUB/Psupremum.con". + +(* the following definitions are not used in *) + +(* this file but later we will need them *) + +inline "cic:/CoRN/reals/Bridges_LUB/is_lower_bound.con". + +inline "cic:/CoRN/reals/Bridges_LUB/g_l_b.con". + +inline "cic:/CoRN/reals/Bridges_LUB/infimum.con". + +inline "cic:/CoRN/reals/Bridges_LUB/Pinfimum.con". + +(* UNEXPORTED +End lub_definitions +*) + +(* MAIN SECTION *) + +(* UNEXPORTED +Section upper_bound_sequence +*) + +alias id "A" = "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/A.var". + +alias id "is_inhabitted" = "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/is_inhabitted.var". + +alias id "bounded_above" = "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/bounded_above.var". + +alias id "located" = "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/located.var". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/s.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/Ps.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/b0.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/Pb0.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/b0_is_upper_bound.con". + +inline "cic:/CoRN/reals/Bridges_LUB/s_inhabits_A.con". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/dstart_l.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/dstart_r.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/dl_less_dr.con". + +inline "cic:/CoRN/reals/Bridges_LUB/shrink23d.con". + +inline "cic:/CoRN/reals/Bridges_LUB/shrink13d.con". + +inline "cic:/CoRN/reals/Bridges_LUB/shrink24d.con". + +inline "cic:/CoRN/reals/Bridges_LUB/Real_Interval.con". + +inline "cic:/CoRN/reals/Bridges_LUB/dcotrans_analyze.con". + +inline "cic:/CoRN/reals/Bridges_LUB/dcotrans_analyze_strong.con". + +(* NOTATION +Notation "( p , q )" := (pairT p q). +*) + +inline "cic:/CoRN/reals/Bridges_LUB/dif_cotrans.con". + +inline "cic:/CoRN/reals/Bridges_LUB/dif_cotrans_strong.con". + +inline "cic:/CoRN/reals/Bridges_LUB/dIntrvl.con". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/U.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/V.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/W.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/delta_dIntrvl.con". + +inline "cic:/CoRN/reals/Bridges_LUB/Length_dIntrvl.con". + +inline "cic:/CoRN/reals/Bridges_LUB/dIntrvl_inside_l_n.con". + +inline "cic:/CoRN/reals/Bridges_LUB/dIntrvl_inside_r_n.con". + +inline "cic:/CoRN/reals/Bridges_LUB/V_increase.con". + +inline "cic:/CoRN/reals/Bridges_LUB/W_decrease.con". + +inline "cic:/CoRN/reals/Bridges_LUB/U_m_n_V.con". + +inline "cic:/CoRN/reals/Bridges_LUB/U_m_n_W.con". + +(* These lemma are *very* similar to those in *) + +(* Cauchy_rationals_approach_reals.v *) + +inline "cic:/CoRN/reals/Bridges_LUB/a_familiar_simple_inequality.con". + +inline "cic:/CoRN/reals/Bridges_LUB/U_conversion_rate2.con". + +inline "cic:/CoRN/reals/Bridges_LUB/CS_seq_U.con". + +inline "cic:/CoRN/reals/Bridges_LUB/U_as_CauchySeq.con". + +inline "cic:/CoRN/reals/Bridges_LUB/LUBP/upper_bound_sequence/B.con" "LUBP__upper_bound_sequence__". + +inline "cic:/CoRN/reals/Bridges_LUB/U_minus_V.con". + +inline "cic:/CoRN/reals/Bridges_LUB/U_minus_W.con". + +inline "cic:/CoRN/reals/Bridges_LUB/U_V_upper.con". + +inline "cic:/CoRN/reals/Bridges_LUB/U_W_lower.con". + +inline "cic:/CoRN/reals/Bridges_LUB/AbsSmall_U_V.con". + +inline "cic:/CoRN/reals/Bridges_LUB/AbsSmall_U_W.con". + +(* Two properties of exponentiation in COrdFields *) + +inline "cic:/CoRN/reals/Bridges_LUB/nexp_resp_great_One.con". + +inline "cic:/CoRN/reals/Bridges_LUB/very_weak_binomial.con". + +(* A consequence of Archimedean property - *) + +(* the every basis of definition of e=lim(1+1/n)^n *) + +inline "cic:/CoRN/reals/Bridges_LUB/nexp_resp_Two.con". + +inline "cic:/CoRN/reals/Bridges_LUB/twisted_archimedean.con". + +inline "cic:/CoRN/reals/Bridges_LUB/B_limit_V.con". + +inline "cic:/CoRN/reals/Bridges_LUB/B_limit_W.con". + +inline "cic:/CoRN/reals/Bridges_LUB/W_n_is_upper.con". + +inline "cic:/CoRN/reals/Bridges_LUB/A_bounds_V_n.con". + +inline "cic:/CoRN/reals/Bridges_LUB/cauchy_gives_lub.con". + +(* UNEXPORTED +End upper_bound_sequence +*) + +(* UNEXPORTED +End LUBP +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/reals/Bridges_iso.ma b/matita/contribs/CoRN-Decl/reals/Bridges_iso.ma new file mode 100644 index 000000000..99cd76b71 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/Bridges_iso.ma @@ -0,0 +1,311 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/Bridges_iso". + +include "CoRN.ma". + +(* begin hide *) + +(* file : bridges_gives_our.v *) + +(* version : 1.50 - 09/05/2001 *) + +(* version : 1.00 - 09/03/2001 *) + +(* author : Milad Niqui *) + +(* language : coq7.0bet26feb *) + +(* dependency : least_upper_bound_principle *) + +(* description : Bridges' proof of Cauchy completeness in TCS-219 *) + +include "reals/Bridges_LUB.ma". + +(* This lemma comes from lemmas.v of Martijn Oostdijk *) + +inline "cic:/CoRN/reals/Bridges_iso/le_witness_informative.con". + +(* UNEXPORTED +Section bridges_axioms_imply_ours +*) + +alias id "OF" = "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/OF.var". + +alias id "lubp" = "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/lubp.var". + +alias id "is_Archimedes" = "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/is_Archimedes.var". + +inline "cic:/CoRN/reals/Bridges_iso/is_Archimedes'.con". + +(* UNEXPORTED +Section proofs_in_TCS +*) + +inline "cic:/CoRN/reals/Bridges_iso/leEq_geEq.con". + +inline "cic:/CoRN/reals/Bridges_iso/glbp.con". + +(* UNEXPORTED +Section supremum +*) + +alias id "P" = "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/supremum/P.var". + +inline "cic:/CoRN/reals/Bridges_iso/inequality1.con". + +inline "cic:/CoRN/reals/Bridges_iso/inequality2.con". + +inline "cic:/CoRN/reals/Bridges_iso/inequality3.con". + +inline "cic:/CoRN/reals/Bridges_iso/inequality4.con". + +inline "cic:/CoRN/reals/Bridges_iso/Hum.con". + +inline "cic:/CoRN/reals/Bridges_iso/bound_tk1.con". + +inline "cic:/CoRN/reals/Bridges_iso/bound_tk2.con". + +inline "cic:/CoRN/reals/Bridges_iso/trick.con". + +inline "cic:/CoRN/reals/Bridges_iso/trick'.con". + +inline "cic:/CoRN/reals/Bridges_iso/up_bound_for_n_element.con". + +inline "cic:/CoRN/reals/Bridges_iso/low_bound_for_n_element.con". + +inline "cic:/CoRN/reals/Bridges_iso/saghf.con". + +inline "cic:/CoRN/reals/Bridges_iso/Psaghf.con". + +inline "cic:/CoRN/reals/Bridges_iso/kaf.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pkaf.con". + +alias id "is_finite_P" = "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/supremum/is_finite_P.var". + +inline "cic:/CoRN/reals/Bridges_iso/card.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pcard1.con". + +inline "cic:/CoRN/reals/Bridges_iso/seq.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pseq1.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pseq1_unfolded.con". + +inline "cic:/CoRN/reals/Bridges_iso/indeks.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pindeks.con". + +alias id "is_onto_seq_P" = "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/supremum/is_onto_seq_P.var". + +inline "cic:/CoRN/reals/Bridges_iso/P_is_inhabited.con". + +(* +Lemma bounded_quantifier:(N:nat;phi,psi:nat->Prop) + ((m:nat)(le m N)->(phi m)\/(psi m))-> + ((m:nat)(le m N)->(phi m))\/(Ex [j:nat](le j N)/\(psi j)). +Proof. + Intros. + Induction N. + Cut (phi O)\/(psi O). + Intro. + Case H0. + Intros. + Left. + Intros. + Rewrite <- (le_n_O_eq m H2). + Assumption. + Intro. + Right. + Exists O. + Split. + Constructor. + Assumption. + Apply H. + Constructor.*) + +(* n=(S n0) *) + +(* Case HrecN. + Intros. + Apply H. + Apply le_trans with m:=N. + Assumption. + Apply le_n_Sn. + Intro. + Case (H (S N)). + Apply le_n. + Intros. + Left. + Intros. + Case (le_lt_eq_dec m (S N)). + Assumption. + Intros. + Apply H0. + Apply (lt_n_Sm_le m N). + Assumption. + Intro. + Rewrite e. + Assumption. + Intro. + Right. + Exists (S N). + Split. + Apply le_n. + Assumption. + Intro. + Right. + Case H0. + Intro j. + Intros. + Exists j. + Elim H1. + Intros. + Split. + Apply le_trans with m:=N. + Assumption. + Apply le_n_Sn. + Assumption. +Qed. +*) + +inline "cic:/CoRN/reals/Bridges_iso/bounded_quantifier_informative.con". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_lemma1a.con". + +alias id "P_is_strongly_extensional" = "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/supremum/P_is_strongly_extensional.var". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_lemma1b.con". + +(* UNEXPORTED +End supremum +*) + +(*#**********************************) + +(*#**********************************) + +(*#**********************************) + +(*#**********************************) + +(* UNEXPORTED +Section Every_Cauchy_Sequence_is_bounded +*) + +inline "cic:/CoRN/reals/Bridges_iso/seq2set.con". + +alias id "g" = "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/Every_Cauchy_Sequence_is_bounded/g.var". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/Every_Cauchy_Sequence_is_bounded/g_.con" "bridges_axioms_imply_ours__proofs_in_TCS__Every_Cauchy_Sequence_is_bounded__". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/Every_Cauchy_Sequence_is_bounded/pg.con" "bridges_axioms_imply_ours__proofs_in_TCS__Every_Cauchy_Sequence_is_bounded__". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/Every_Cauchy_Sequence_is_bounded/P.con" "bridges_axioms_imply_ours__proofs_in_TCS__Every_Cauchy_Sequence_is_bounded__". + +inline "cic:/CoRN/reals/Bridges_iso/fin_is_fin.con". + +inline "cic:/CoRN/reals/Bridges_iso/card_fin.con". + +inline "cic:/CoRN/reals/Bridges_iso/finite_seq.con". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_lemma2a.con". + +inline "cic:/CoRN/reals/Bridges_iso/sup.con". + +inline "cic:/CoRN/reals/Bridges_iso/Psup.con". + +inline "cic:/CoRN/reals/Bridges_iso/Psup_proj1.con". + +inline "cic:/CoRN/reals/Bridges_iso/Psup_unfolded1.con". + +inline "cic:/CoRN/reals/Bridges_iso/Psup_unfolded2.con". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_lemma2b.con". + +inline "cic:/CoRN/reals/Bridges_iso/inf.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pinf.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pinf_proj1.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pinf_unfolded1.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pinf_unfolded2.con". + +(* I tried very much not to mention this lemma! *) + +inline "cic:/CoRN/reals/Bridges_iso/sup_leEq.con". + +inline "cic:/CoRN/reals/Bridges_iso/inf_geEq.con". + +inline "cic:/CoRN/reals/Bridges_iso/tail_is_Cauchy.con". + +inline "cic:/CoRN/reals/Bridges_iso/tail_seq.con". + +(* UNEXPORTED +End Every_Cauchy_Sequence_is_bounded +*) + +alias id "g" = "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/g.var". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/g_.con" "bridges_axioms_imply_ours__proofs_in_TCS__". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/pg.con" "bridges_axioms_imply_ours__proofs_in_TCS__". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/sup_tail.con" "bridges_axioms_imply_ours__proofs_in_TCS__". + +inline "cic:/CoRN/reals/Bridges_iso/sup_tail_leEq.con". + +inline "cic:/CoRN/reals/Bridges_iso/sup_tail_is_Cauchy.con". + +inline "cic:/CoRN/reals/Bridges_iso/sup_tail_as_Cauchy.con". + +inline "cic:/CoRN/reals/Bridges_iso/bridges_axioms_imply_ours/proofs_in_TCS/L.con" "bridges_axioms_imply_ours__proofs_in_TCS__". + +inline "cic:/CoRN/reals/Bridges_iso/sup_tail_decrease.con". + +inline "cic:/CoRN/reals/Bridges_iso/L_less_sup_n.con". + +inline "cic:/CoRN/reals/Bridges_iso/Psup_unfolded2_informative.con". + +inline "cic:/CoRN/reals/Bridges_iso/Pinf_unfolded2_informative.con". + +inline "cic:/CoRN/reals/Bridges_iso/convergent_subseq.con". + +(* very elegant proof almost as short as text version! *) + +inline "cic:/CoRN/reals/Bridges_iso/lubp_gives_Cauchy.con". + +(* UNEXPORTED +End proofs_in_TCS +*) + +inline "cic:/CoRN/reals/Bridges_iso/Bridges_R_is_CReals.con". + +inline "cic:/CoRN/reals/Bridges_iso/Bridges_R_as_CReals.con". + +(* UNEXPORTED +End bridges_axioms_imply_ours +*) + +(* end hide *) + +(*#* remove printing Q *) + diff --git a/matita/contribs/CoRN-Decl/reals/CMetricFields.ma b/matita/contribs/CoRN-Decl/reals/CMetricFields.ma new file mode 100644 index 000000000..db445d670 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/CMetricFields.ma @@ -0,0 +1,89 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/CMetricFields". + +include "CoRN.ma". + +(* $Id: CMetricFields.v,v 1.6 2004/04/23 10:01:03 lcf Exp $ *) + +include "reals/CReals1.ma". + +(* UNEXPORTED +Section CMetric_Fields +*) + +(*#* *Metric Fields *) + +inline "cic:/CoRN/reals/CMetricFields/is_CMetricField.ind". + +inline "cic:/CoRN/reals/CMetricFields/CMetricField.ind". + +coercion cic:/matita/CoRN-Decl/reals/CMetricFields/cmf_crr.con 0 (* compounds *). + +(* UNEXPORTED +End CMetric_Fields +*) + +(* NOTATION +Notation MAbs := (cmf_abs _). +*) + +(* UNEXPORTED +Section basics +*) + +inline "cic:/CoRN/reals/CMetricFields/MAbs_one.con". + +inline "cic:/CoRN/reals/CMetricFields/Hulp.con". + +inline "cic:/CoRN/reals/CMetricFields/MAbs_one_recip_one.con". + +(* end hide *) + +(* UNEXPORTED +End basics +*) + +(* UNEXPORTED +Section CMetric_Field_Cauchy +*) + +alias id "F" = "cic:/CoRN/reals/CMetricFields/CMetric_Field_Cauchy/F.var". + +(*#* +%\begin{convention}% Let [F:CMetricField]. +%\end{convention}% +*) + +inline "cic:/CoRN/reals/CMetricFields/MCauchy_prop.con". + +inline "cic:/CoRN/reals/CMetricFields/MCauchySeq.ind". + +coercion cic:/matita/CoRN-Decl/reals/CMetricFields/MCS_seq.con 0 (* compounds *). + +inline "cic:/CoRN/reals/CMetricFields/MseqLimit.con". + +inline "cic:/CoRN/reals/CMetricFields/is_MCauchyCompl.con". + +(* UNEXPORTED +End CMetric_Field_Cauchy +*) + +(* UNEXPORTED +Implicit Arguments MseqLimit [F]. +*) + diff --git a/matita/contribs/CoRN-Decl/reals/CPoly_Contin.ma b/matita/contribs/CoRN-Decl/reals/CPoly_Contin.ma new file mode 100644 index 000000000..0c8b3653a --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/CPoly_Contin.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/CPoly_Contin". + +include "CoRN.ma". + +(* $Id: CPoly_Contin.v,v 1.6 2004/04/23 10:01:03 lcf Exp $ *) + +(*#* * Continuity of polynomials *) + +include "reals/RealFuncts.ma". + +inline "cic:/CoRN/reals/CPoly_Contin/plus_op_contin.con". + +inline "cic:/CoRN/reals/CPoly_Contin/mult_op_contin.con". + +inline "cic:/CoRN/reals/CPoly_Contin/linear_op_contin.con". + +inline "cic:/CoRN/reals/CPoly_Contin/cpoly_op_contin.con". + diff --git a/matita/contribs/CoRN-Decl/reals/CReals.ma b/matita/contribs/CoRN-Decl/reals/CReals.ma new file mode 100644 index 000000000..a43dcfcfd --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/CReals.ma @@ -0,0 +1,51 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/CReals". + +include "CoRN.ma". + +(* $Id: CReals.v,v 1.2 2004/04/05 11:35:38 lcf Exp $ *) + +(*#* printing Lim %\ensuremath{\lim}% *) + +include "algebra/COrdCauchy.ma". + +(*#* * Definition of the notion of reals +The reals are defined as a Cauchy-closed Archimedean constructive +ordered field in which we have a maximum function. The maximum +function is definable, using countable choice, but in a rather tricky +way. Cauchy completeness is stated by assuming a function [lim] +that returns a real number for every Cauchy sequence together with a +proof that this number is the limit. +*) + +(* Begin_SpecReals *) + +inline "cic:/CoRN/reals/CReals/is_CReals.ind". + +inline "cic:/CoRN/reals/CReals/CReals.ind". + +coercion cic:/matita/CoRN-Decl/reals/CReals/crl_crr.con 0 (* compounds *). + +(* End_SpecReals *) + +inline "cic:/CoRN/reals/CReals/Lim.con". + +(* UNEXPORTED +Implicit Arguments Lim [IR]. +*) + diff --git a/matita/contribs/CoRN-Decl/reals/CReals1.ma b/matita/contribs/CoRN-Decl/reals/CReals1.ma new file mode 100644 index 000000000..f8d973b23 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/CReals1.ma @@ -0,0 +1,168 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/CReals1". + +include "CoRN.ma". + +(* $Id: CReals1.v,v 1.4 2004/04/23 10:01:04 lcf Exp $ *) + +include "reals/Max_AbsIR.ma". + +include "algebra/Expon.ma". + +include "algebra/CPoly_ApZero.ma". + +(* UNEXPORTED +Section More_Cauchy_Props +*) + +(*#* **Miscellaneous +*** More properties of Cauchy sequences +We will now define some special Cauchy sequences and prove some +more useful properties about them. + +The sequence defined by $x_n=\frac2{n+1}$#x(n)=2/(n+1)#. +*) + +inline "cic:/CoRN/reals/CReals1/twice_inv_seq_Lim.con". + +inline "cic:/CoRN/reals/CReals1/twice_inv_seq.con". + +(*#* +Next, we prove that the sequence of absolute values of a Cauchy +sequence is also Cauchy. +*) + +inline "cic:/CoRN/reals/CReals1/Cauchy_Lim_abs.con". + +inline "cic:/CoRN/reals/CReals1/Cauchy_abs.con". + +inline "cic:/CoRN/reals/CReals1/Lim_abs.con". + +(* UNEXPORTED +End More_Cauchy_Props +*) + +(* UNEXPORTED +Section Subsequences +*) + +(*#* *** Subsequences +We will now examine (although without formalizing it) the concept +of subsequence and some of its properties. + +%\begin{convention}% Let [seq1,seq2:nat->IR]. +%\end{convention}% + +In order for [seq1] to be a subsequence of [seq2], there must be an +increasing function [f] growing to infinity such that +[forall (n :nat), (seq1 n) [=] (seq2 (f n))]. We assume [f] to be such a +function. + +Finally, for some of our results it is important to assume that +[seq2] is monotonous. +*) + +alias id "seq1" = "cic:/CoRN/reals/CReals1/Subsequences/seq1.var". + +alias id "seq2" = "cic:/CoRN/reals/CReals1/Subsequences/seq2.var". + +alias id "f" = "cic:/CoRN/reals/CReals1/Subsequences/f.var". + +alias id "monF" = "cic:/CoRN/reals/CReals1/Subsequences/monF.var". + +alias id "crescF" = "cic:/CoRN/reals/CReals1/Subsequences/crescF.var". + +alias id "subseq" = "cic:/CoRN/reals/CReals1/Subsequences/subseq.var". + +alias id "mon_seq2" = "cic:/CoRN/reals/CReals1/Subsequences/mon_seq2.var". + +inline "cic:/CoRN/reals/CReals1/unbnd_f.con". + +(* begin hide *) + +inline "cic:/CoRN/reals/CReals1/Subsequences/mon_F'.con" "Subsequences__". + +(* end hide *) + +inline "cic:/CoRN/reals/CReals1/conv_subseq_imp_conv_seq.con". + +inline "cic:/CoRN/reals/CReals1/Cprop2_seq_imp_Cprop2_subseq.con". + +inline "cic:/CoRN/reals/CReals1/conv_seq_imp_conv_subseq.con". + +inline "cic:/CoRN/reals/CReals1/Cprop2_subseq_imp_Cprop2_seq.con". + +(* UNEXPORTED +End Subsequences +*) + +(* UNEXPORTED +Section Cauchy_Subsequences +*) + +alias id "seq1" = "cic:/CoRN/reals/CReals1/Cauchy_Subsequences/seq1.var". + +alias id "seq2" = "cic:/CoRN/reals/CReals1/Cauchy_Subsequences/seq2.var". + +alias id "f" = "cic:/CoRN/reals/CReals1/Cauchy_Subsequences/f.var". + +alias id "monF" = "cic:/CoRN/reals/CReals1/Cauchy_Subsequences/monF.var". + +alias id "crescF" = "cic:/CoRN/reals/CReals1/Cauchy_Subsequences/crescF.var". + +alias id "subseq" = "cic:/CoRN/reals/CReals1/Cauchy_Subsequences/subseq.var". + +alias id "mon_seq2" = "cic:/CoRN/reals/CReals1/Cauchy_Subsequences/mon_seq2.var". + +inline "cic:/CoRN/reals/CReals1/Lim_seq_eq_Lim_subseq.con". + +inline "cic:/CoRN/reals/CReals1/Lim_subseq_eq_Lim_seq.con". + +(* UNEXPORTED +End Cauchy_Subsequences +*) + +(* UNEXPORTED +Section Properties_of_Exponentiation +*) + +(*#* *** More properties of Exponentiation + +Finally, we prove that [x[^]n] grows to infinity if [x [>] One]. +*) + +inline "cic:/CoRN/reals/CReals1/power_big'.con". + +inline "cic:/CoRN/reals/CReals1/power_big.con". + +inline "cic:/CoRN/reals/CReals1/qi_yields_zero.con". + +inline "cic:/CoRN/reals/CReals1/qi_lim_zero.con". + +(* UNEXPORTED +End Properties_of_Exponentiation +*) + +(*#* *** [IR] has characteristic zero *) + +inline "cic:/CoRN/reals/CReals1/char0_IR.con". + +inline "cic:/CoRN/reals/CReals1/poly_apzero_IR.con". + +inline "cic:/CoRN/reals/CReals1/poly_IR_extensional.con". + diff --git a/matita/contribs/CoRN-Decl/reals/CSumsReals.ma b/matita/contribs/CoRN-Decl/reals/CSumsReals.ma new file mode 100644 index 000000000..552fce459 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/CSumsReals.ma @@ -0,0 +1,94 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/CSumsReals". + +include "CoRN.ma". + +(* $Id: CSumsReals.v,v 1.5 2004/04/23 10:01:04 lcf Exp $ *) + +include "reals/CReals1.ma". + +(*#* * Sums over Reals + +%\begin{convention}% Let [c] be a real. +%\end{convention}% + +Here we prove that +$\Sigma_{m\leq i \leq n}~c^k = \frac{c^{n+1}-c^m}{c-1}.$ +#sum_(m≤ i ≤ n) c^k = frac (c^(n+1) -c^m) (c-1)# +*) + +(* UNEXPORTED +Section Sums_over_Reals +*) + +alias id "c" = "cic:/CoRN/reals/CSumsReals/Sums_over_Reals/c.var". + +inline "cic:/CoRN/reals/CSumsReals/Sum0_c_exp.con". + +(* UNEXPORTED +Hint Resolve Sum0_c_exp. +*) + +inline "cic:/CoRN/reals/CSumsReals/Sum_c_exp.con". + +(* UNEXPORTED +Hint Resolve Sum_c_exp. +*) + +(*#* The following formulation is often more useful if [c [<] 1]. *) + +inline "cic:/CoRN/reals/CSumsReals/Sum_c_exp'.con". + +(* UNEXPORTED +Hint Resolve Sum_c_exp'. +*) + +(* UNEXPORTED +End Sums_over_Reals +*) + +(* UNEXPORTED +Hint Resolve Sum0_c_exp Sum_c_exp Sum_c_exp': algebra. +*) + +inline "cic:/CoRN/reals/CSumsReals/diff_is_Sum0.con". + +inline "cic:/CoRN/reals/CSumsReals/diff_is_sum.con". + +inline "cic:/CoRN/reals/CSumsReals/Sum0_pres_less.con". + +inline "cic:/CoRN/reals/CSumsReals/Sum_pres_less.con". + +inline "cic:/CoRN/reals/CSumsReals/Sum_pres_leEq.con". + +inline "cic:/CoRN/reals/CSumsReals/Sum0_comm_scal.con". + +(* UNEXPORTED +Hint Resolve Sum0_comm_scal: algebra. +*) + +inline "cic:/CoRN/reals/CSumsReals/Sum_comm_scal.con". + +inline "cic:/CoRN/reals/CSumsReals/Sum0_comm_scal'.con". + +inline "cic:/CoRN/reals/CSumsReals/Sum_comm_scal'.con". + +inline "cic:/CoRN/reals/CSumsReals/Sumx_comm_scal'.con". + +inline "cic:/CoRN/reals/CSumsReals/Sum2_comm_scal'.con". + diff --git a/matita/contribs/CoRN-Decl/reals/CauchySeq.ma b/matita/contribs/CoRN-Decl/reals/CauchySeq.ma new file mode 100644 index 000000000..4bc6c7aa1 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/CauchySeq.ma @@ -0,0 +1,315 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/CauchySeq". + +include "CoRN.ma". + +(* $Id: CauchySeq.v,v 1.8 2004/04/23 10:01:04 lcf Exp $ *) + +(*#* printing IR %\ensuremath{\mathbb R}% *) + +(*#* printing PartIR %\ensuremath{\mathbb R\!\not\rightarrow\!\mathbb R}% *) + +(*#* printing ZeroR %\ensuremath{\mathbf0}% #0# *) + +(*#* printing OneR %\ensuremath{\mathbf1}% #1# *) + +(*#* printing AbsIR %\ensuremath{|\cdot|_{\mathbb R}}% *) + +include "reals/CReals.ma". + +(*#* *Real Number Structures +%\begin{convention}% Let [IR] be a structure for real numbers. +%\end{convention}% +*) + +(* +Require Export R_CReals. +Definition IR : CReals := Concrete_R. +Opaque IR. +*) + +alias id "IR" = "cic:/CoRN/reals/CauchySeq/IR.var". + +(* NOTATION +Notation PartIR := (PartFunct IR). +*) + +(* NOTATION +Notation ProjIR1 := (prj1 IR _ _ _). +*) + +(* NOTATION +Notation ProjIR2 := (prj2 IR _ _ _). +*) + +include "tactics/Transparent_algebra.ma". + +(* begin hide *) + +(* NOTATION +Notation ZeroR := (Zero:IR). +*) + +(* NOTATION +Notation OneR := (One:IR). +*) + +(* end hide *) + +(* UNEXPORTED +Section CReals_axioms +*) + +(*#* ** [CReals] axioms *) + +inline "cic:/CoRN/reals/CauchySeq/CReals_is_CReals.con". + +(*#* First properties which follow trivially from the axioms. *) + +inline "cic:/CoRN/reals/CauchySeq/Lim_Cauchy.con". + +inline "cic:/CoRN/reals/CauchySeq/Archimedes.con". + +inline "cic:/CoRN/reals/CauchySeq/Archimedes'.con". + +(*#* A stronger version, which often comes in useful. *) + +inline "cic:/CoRN/reals/CauchySeq/str_Archimedes.con". + +inline "cic:/CoRN/reals/CauchySeq/CauchySeqR.con". + +(* UNEXPORTED +End CReals_axioms +*) + +(* UNEXPORTED +Section Cauchy_Defs +*) + +(*#* ** Cauchy sequences +*** Alternative definitions +This section gives several definitions of Cauchy sequences. There +are no lemmas in this section. + +The current definition of Cauchy ([Cauchy_prop]) is: + +%\[\forall \epsilon>0. \exists N. \forall m\geq N. |seq_m - seq_N|\leq\varepsilon\]% +#for all e>0 there exists N such that for all m≥ N |seqm-seqN|≤ e# + +Variant 1 of Cauchy ([Cauchy_prop1]) is: + +%\[\forall k. \exists N. \forall m \geq N. |seq_m - seq_N|\leq1/(k+1)\]% +#for all k there exists N such that for all m ≥ N |seqm-seqN| ≤ 1/(k+1)# + +In all of the following variants the limit occurs in the definition. +Therefore it is useful to define an auxiliary predicate +[Cauchy_Lim_prop?], in terms of which [Cauchy_prop?] is defined. + +Variant 2 of Cauchy ([Cauchy_prop2]) is [exists y, (Cauchy_Lim_prop2 seq y)] +where +[[ +Cauchy_Lim_prop2 seq y := forall eps [>] Zero, exists N, forall m >= N, (AbsIR seq m - y) [<=] eps +]] + +Note that [Cauchy_Lim_prop2] equals [seqLimit]. + +Variant 3 of Cauchy ([Cauchy_prop3]) reads [exists y, (Cauchy_Lim_prop3 seq y)] +where +[[ +Cauchy_Lim_prop3 seq y := forall k, exists N, forall m >= N, (AbsIR seq m - y) [<=] One[/] (k[+]1) +]] + +The following variant is more restricted. + +Variant 4 of Cauchy ([Cauchy_prop4]): [exists y, (Cauchy_Lim_prop4 seq y)] +where +[[ +Cauchy_Lim_prop4 seq y := forall k, (AbsIR seq m - y) [<=] One[/] (k[+]1) +]] + +So +[[ +Cauchy_prop4 -> Cauchy_prop3 Iff Cauchy_prop2 Iff Cauchy_prop1 Iff Cauchy_prop +]] +Note: we don't know which formulations are useful. + +The inequalities are stated with [[<=]] rather than with [<] for the +following reason: both formulations are equivalent, as is well known; +and [[<=]] being a negative statement, this makes proofs +sometimes easier and program extraction much more efficient. +*) + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop1.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_prop2.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop2.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_prop3.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop3.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_prop4.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop4.con". + +(* UNEXPORTED +End Cauchy_Defs +*) + +(* UNEXPORTED +Section Inequalities +*) + +(*#* *** Inequalities of Limits + +The next lemma is equal to lemma [Lim_Cauchy]. *) + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_complete.con". + +inline "cic:/CoRN/reals/CauchySeq/less_Lim_so_less_seq.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_less_so_seq_less.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_less_Lim_so_seq_less_seq.con". + +(*#* The next lemma follows from [less_Lim_so_less_seq] with [y := (y[+] (Lim seq)) [/]TwoNZ]. *) + +inline "cic:/CoRN/reals/CauchySeq/less_Lim_so.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_less_so.con". + +inline "cic:/CoRN/reals/CauchySeq/leEq_seq_so_leEq_Lim.con". + +inline "cic:/CoRN/reals/CauchySeq/str_leEq_seq_so_leEq_Lim.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_leEq_Lim.con". + +inline "cic:/CoRN/reals/CauchySeq/seq_leEq_so_Lim_leEq.con". + +inline "cic:/CoRN/reals/CauchySeq/str_seq_leEq_so_Lim_leEq.con". + +inline "cic:/CoRN/reals/CauchySeq/Limits_unique.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_wd.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_strext.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_ap_imp_seq_ap.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_ap_imp_seq_ap'.con". + +(* UNEXPORTED +End Inequalities +*) + +(* UNEXPORTED +Section Equiv_Cauchy +*) + +(*#* *** Equivalence of formulations of Cauchy *) + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop1_prop.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop2_prop.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_prop3_prop2.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop3_prop2.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop3_prop.con". + +inline "cic:/CoRN/reals/CauchySeq/Build_CauchySeq1.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_prop4_prop3.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_prop4_prop2.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop4_prop3.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop4_prop.con". + +inline "cic:/CoRN/reals/CauchySeq/Build_CauchySeq4.con". + +inline "cic:/CoRN/reals/CauchySeq/Build_CauchySeq4_y.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_CauchySeq4.con". + +inline "cic:/CoRN/reals/CauchySeq/Build_CauchySeq2.con". + +inline "cic:/CoRN/reals/CauchySeq/Build_CauchySeq2_y.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_CauchySeq2.con". + +(*#* Well definedness. *) + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_prop_wd.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_prop2_wd.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_wd'.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_unique.con". + +(* UNEXPORTED +End Equiv_Cauchy +*) + +(* UNEXPORTED +Section Cauchy_props +*) + +(*#* *** Properties of Cauchy sequences + +Some of these lemmas are now obsolete, because they were reproved for arbitrary ordered fields$\ldots$#...# + +We begin by defining the constant sequence and proving that it is Cauchy with the expected limit. +*) + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_const.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_const.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_plus.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_plus.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_plus.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_inv.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_inv.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_inv.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_minus.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_minus.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_minus.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_Lim_mult.con". + +inline "cic:/CoRN/reals/CauchySeq/Cauchy_mult.con". + +inline "cic:/CoRN/reals/CauchySeq/Lim_mult.con". + +(* UNEXPORTED +End Cauchy_props +*) + diff --git a/matita/contribs/CoRN-Decl/reals/Cauchy_CReals.ma b/matita/contribs/CoRN-Decl/reals/Cauchy_CReals.ma new file mode 100644 index 000000000..2fb5a06c3 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/Cauchy_CReals.ma @@ -0,0 +1,136 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/Cauchy_CReals". + +include "CoRN.ma". + +(* $Id: Cauchy_CReals.v,v 1.5 2004/04/23 10:01:04 lcf Exp $ *) + +include "algebra/Cauchy_COF.ma". + +include "reals/CReals.ma". + +(* UNEXPORTED +Section R_CReals +*) + +(*#* * The Real Number Structure + +We will now apply our Cauchy sequence construction to an archimedean ordered field in order to obtain a model of the real numbers. + +** Injection of [Q] + +We start by showing how to inject the rational numbers in the field of Cauchy sequences; this embedding preserves the algebraic operations. + +%\begin{convention}% Let [F] be an ordered field. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/reals/Cauchy_CReals/R_CReals/F.var". + +(* NOTATION +Notation "'R_COrdField''" := (R_COrdField F). +*) + +inline "cic:/CoRN/reals/Cauchy_CReals/inject_Q.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_eq.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_plus.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_min.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_lt.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_ap.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_cancel_eq.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_cancel_less.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_le.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_cancel_leEq.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_cancel_AbsSmall.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_One.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_nring'.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_nring.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_mult.con". + +(* UNEXPORTED +Opaque R_COrdField. +*) + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_div_three.con". + +(* UNEXPORTED +Transparent R_COrdField. +*) + +inline "cic:/CoRN/reals/Cauchy_CReals/ing_n.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/expand_Q_R.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/conv_modulus.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/R_CReals/T.con" "R_CReals__". + +(*#* We now assume our original field is archimedean and prove that the +resulting one is, too. +*) + +alias id "F_is_archemaedian" = "cic:/CoRN/reals/Cauchy_CReals/R_CReals/F_is_archemaedian.var". + +inline "cic:/CoRN/reals/Cauchy_CReals/R_is_archemaedian.con". + +(* begin hide *) + +inline "cic:/CoRN/reals/Cauchy_CReals/R_CReals/PT.con" "R_CReals__". + +(* end hide *) + +inline "cic:/CoRN/reals/Cauchy_CReals/modulus_property.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/modulus_property_2.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/expand_Q_R_2.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/CS_seq_diagonal.con". + +(*#* ** Cauchy Completeness +We can also define a limit operator. +*) + +inline "cic:/CoRN/reals/Cauchy_CReals/Q_dense_in_R.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/LimR_CauchySeq.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/R_is_complete.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/R_is_CReals.con". + +inline "cic:/CoRN/reals/Cauchy_CReals/R_as_CReals.con". + +(* UNEXPORTED +End R_CReals +*) + diff --git a/matita/contribs/CoRN-Decl/reals/IVT.ma b/matita/contribs/CoRN-Decl/reals/IVT.ma new file mode 100644 index 000000000..19dacb67a --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/IVT.ma @@ -0,0 +1,236 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/IVT". + +include "CoRN.ma". + +(* $Id: IVT.v,v 1.5 2004/04/23 10:01:04 lcf Exp $ *) + +include "reals/CPoly_Contin.ma". + +(* UNEXPORTED +Section Nested_Intervals +*) + +(*#* * Intermediate Value Theorem + +** Nested intervals + +%\begin{convention}% Let [a,b:nat->IR] be sequences such that: +- [a] is increasing; +- [b] is decreasing; +- [forall (i:nat), (a i) [<] (b i)]; +- for every positive real number [eps], there is an [i] such that [(b i) [<] (a i) [+]eps]. + +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/reals/IVT/Nested_Intervals/a.var". + +alias id "b" = "cic:/CoRN/reals/IVT/Nested_Intervals/b.var". + +alias id "a_mon" = "cic:/CoRN/reals/IVT/Nested_Intervals/a_mon.var". + +alias id "b_mon" = "cic:/CoRN/reals/IVT/Nested_Intervals/b_mon.var". + +alias id "a_b" = "cic:/CoRN/reals/IVT/Nested_Intervals/a_b.var". + +alias id "b_a" = "cic:/CoRN/reals/IVT/Nested_Intervals/b_a.var". + +inline "cic:/CoRN/reals/IVT/a_mon'.con". + +inline "cic:/CoRN/reals/IVT/b_mon'.con". + +inline "cic:/CoRN/reals/IVT/a_b'.con". + +inline "cic:/CoRN/reals/IVT/intervals_cauchy.con". + +(* begin hide *) + +inline "cic:/CoRN/reals/IVT/Nested_Intervals/a'.con" "Nested_Intervals__". + +(* end hide *) + +inline "cic:/CoRN/reals/IVT/Cnested_intervals_limit.con". + +(*#* %\begin{convention}% Let [f] be a continuous real function. +%\end{convention}% +*) + +alias id "f" = "cic:/CoRN/reals/IVT/Nested_Intervals/f.var". + +alias id "f_contin" = "cic:/CoRN/reals/IVT/Nested_Intervals/f_contin.var". + +inline "cic:/CoRN/reals/IVT/f_contin_pos.con". + +inline "cic:/CoRN/reals/IVT/f_contin_neg.con". + +(*#* Assume also that [forall i, f (a i) [<=] Zero [<=] f (b i)]. *) + +alias id "f_a" = "cic:/CoRN/reals/IVT/Nested_Intervals/f_a.var". + +alias id "f_b" = "cic:/CoRN/reals/IVT/Nested_Intervals/f_b.var". + +inline "cic:/CoRN/reals/IVT/Cnested_intervals_zero.con". + +(* UNEXPORTED +End Nested_Intervals +*) + +(* UNEXPORTED +Section Bisection +*) + +(*#* ** Bissections *) + +alias id "f" = "cic:/CoRN/reals/IVT/Bisection/f.var". + +alias id "f_apzero_interval" = "cic:/CoRN/reals/IVT/Bisection/f_apzero_interval.var". + +alias id "a" = "cic:/CoRN/reals/IVT/Bisection/a.var". + +alias id "b" = "cic:/CoRN/reals/IVT/Bisection/b.var". + +alias id "a_b" = "cic:/CoRN/reals/IVT/Bisection/a_b.var". + +alias id "f_a" = "cic:/CoRN/reals/IVT/Bisection/f_a.var". + +alias id "f_b" = "cic:/CoRN/reals/IVT/Bisection/f_b.var". + +(*#* +%\begin{convention}% Let [Small] denote [Two[/]ThreeNZ], [lft] be [(Two[*]a[+]b) [/]ThreeNZ] and [rht] be [(a[+]Two[*]b) [/]ThreeNZ]. +%\end{convention}% +*) + +(* begin hide *) + +inline "cic:/CoRN/reals/IVT/Bisection/Small.con" "Bisection__". + +inline "cic:/CoRN/reals/IVT/Bisection/lft.con" "Bisection__". + +inline "cic:/CoRN/reals/IVT/Bisection/rht.con" "Bisection__". + +(* end hide *) + +inline "cic:/CoRN/reals/IVT/a_lft.con". + +inline "cic:/CoRN/reals/IVT/rht_b.con". + +inline "cic:/CoRN/reals/IVT/lft_rht.con". + +inline "cic:/CoRN/reals/IVT/smaller_lft.con". + +inline "cic:/CoRN/reals/IVT/smaller_rht.con". + +(* UNEXPORTED +Hint Resolve smaller_lft smaller_rht: algebra. +*) + +inline "cic:/CoRN/reals/IVT/Cbisect'.con". + +(* UNEXPORTED +End Bisection +*) + +(* UNEXPORTED +Section Bisect_Interval +*) + +alias id "f" = "cic:/CoRN/reals/IVT/Bisect_Interval/f.var". + +alias id "C_f_apzero_interval" = "cic:/CoRN/reals/IVT/Bisect_Interval/C_f_apzero_interval.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/IVT/Bisect_Interval/Small.con" "Bisect_Interval__". + +(* end hide *) + +inline "cic:/CoRN/reals/IVT/bisect_interval.ind". + +inline "cic:/CoRN/reals/IVT/Cbisect_exists.con". + +inline "cic:/CoRN/reals/IVT/bisect.con". + +inline "cic:/CoRN/reals/IVT/bisect_prop.con". + +(* UNEXPORTED +End Bisect_Interval +*) + +(* UNEXPORTED +Section IVT_Op +*) + +(*#* ** IVT for operations +Same conventions as before. +*) + +alias id "f" = "cic:/CoRN/reals/IVT/IVT_Op/f.var". + +alias id "f_contin" = "cic:/CoRN/reals/IVT/IVT_Op/f_contin.var". + +alias id "f_apzero_interval" = "cic:/CoRN/reals/IVT/IVT_Op/f_apzero_interval.var". + +alias id "a" = "cic:/CoRN/reals/IVT/IVT_Op/a.var". + +alias id "b" = "cic:/CoRN/reals/IVT/IVT_Op/b.var". + +alias id "a_b" = "cic:/CoRN/reals/IVT/IVT_Op/a_b.var". + +alias id "f_a" = "cic:/CoRN/reals/IVT/IVT_Op/f_a.var". + +alias id "f_b" = "cic:/CoRN/reals/IVT/IVT_Op/f_b.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/IVT/IVT_Op/Small.con" "IVT_Op__". + +(* end hide *) + +inline "cic:/CoRN/reals/IVT/interval_sequence.con". + +inline "cic:/CoRN/reals/IVT/IVT_Op/a_.con" "IVT_Op__". + +inline "cic:/CoRN/reals/IVT/IVT_Op/b_.con" "IVT_Op__". + +inline "cic:/CoRN/reals/IVT/intervals_smaller.con". + +inline "cic:/CoRN/reals/IVT/intervals_small''.con". + +inline "cic:/CoRN/reals/IVT/intervals_small'.con". + +inline "cic:/CoRN/reals/IVT/intervals_small.con". + +inline "cic:/CoRN/reals/IVT/Civt_op.con". + +(* UNEXPORTED +End IVT_Op +*) + +(* UNEXPORTED +Section IVT_Poly +*) + +(*#* ** IVT for polynomials *) + +inline "cic:/CoRN/reals/IVT/Civt_poly.con". + +(* UNEXPORTED +End IVT_Poly +*) + diff --git a/matita/contribs/CoRN-Decl/reals/Intervals.ma b/matita/contribs/CoRN-Decl/reals/Intervals.ma new file mode 100644 index 000000000..356ae30a1 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/Intervals.ma @@ -0,0 +1,313 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/Intervals". + +include "CoRN.ma". + +(* $Id: Intervals.v,v 1.10 2004/04/23 10:01:04 lcf Exp $ *) + +include "algebra/CSetoidInc.ma". + +include "reals/RealLists.ma". + +(* UNEXPORTED +Section Intervals +*) + +(*#* * Intervals +In this section we define (compact) intervals of the real line and +some useful functions to work with them. + +** Definitions + +We start by defining the compact interval [[a,b]] as being the set of +points less or equal than [b] and greater or equal than [a]. We +require [a [<=] b], as we want to work only in nonempty intervals. +*) + +inline "cic:/CoRN/reals/Intervals/compact.con". + +(*#* +%\begin{convention}% Let [a,b : IR] and [Hab : a [<=] b]. +%\end{convention}% + +As expected, both [a] and [b] are members of [[a,b]]. Also they are +members of the interval [[Min(a,b),Max(a,b)]]. +*) + +alias id "a" = "cic:/CoRN/reals/Intervals/Intervals/a.var". + +alias id "b" = "cic:/CoRN/reals/Intervals/Intervals/b.var". + +alias id "Hab" = "cic:/CoRN/reals/Intervals/Intervals/Hab.var". + +inline "cic:/CoRN/reals/Intervals/compact_inc_lft.con". + +inline "cic:/CoRN/reals/Intervals/compact_inc_rht.con". + +inline "cic:/CoRN/reals/Intervals/compact_Min_lft.con". + +inline "cic:/CoRN/reals/Intervals/compact_Min_rht.con". + +(*#* +As we will be interested in taking functions with domain in a compact +interval, we want this predicate to be well defined. +*) + +inline "cic:/CoRN/reals/Intervals/compact_wd.con". + +(*#* +Also, it will sometimes be necessary to rewrite the endpoints of an interval. +*) + +inline "cic:/CoRN/reals/Intervals/compact_wd'.con". + +(*#* +As we identify subsets with predicates, inclusion is simply implication. +*) + +(*#* +Finally, we define a restriction operator that takes a function [F] +and a well defined predicate [P] included in the domain of [F] and +returns the restriction $F|_P$# of F to P#. +*) + +inline "cic:/CoRN/reals/Intervals/Frestr.con". + +(* UNEXPORTED +End Intervals +*) + +(* NOTATION +Notation Compact := (compact _ _). +*) + +(* UNEXPORTED +Implicit Arguments Frestr [F P]. +*) + +(* NOTATION +Notation FRestr := (Frestr (compact_wd _ _ _)). +*) + +(* UNEXPORTED +Section More_Intervals +*) + +inline "cic:/CoRN/reals/Intervals/included_refl'.con". + +(*#* We prove some inclusions of compact intervals. *) + +inline "cic:/CoRN/reals/Intervals/compact_map1.con". + +inline "cic:/CoRN/reals/Intervals/compact_map2.con". + +inline "cic:/CoRN/reals/Intervals/compact_map3.con". + +(* UNEXPORTED +End More_Intervals +*) + +(* UNEXPORTED +Hint Resolve included_refl' compact_map1 compact_map2 compact_map3 : included. +*) + +(* UNEXPORTED +Section Totally_Bounded +*) + +(*#* ** Totally Bounded + +Totally bounded sets will play an important role in what is +to come. The definition (equivalent to the classical one) states that +[P] is totally bounded iff +%\[\forall_{\varepsilon>0}\exists_{x_1,\ldots,x_n}\forall_{y\in P} +\exists_{1\leq i\leq n}|y-x_i|<\varepsilon\]%#∀e>0 +∃x1,...,xn∀y∈P∃ +1≤i≤n.|y-xi|<e#. + +Notice the use of lists for quantification. +*) + +inline "cic:/CoRN/reals/Intervals/totally_bounded.con". + +(*#* +This definition is classically, but not constructively, equivalent to +the definition of compact (if completeness is assumed); the next +result, classically equivalent to the Heine-Borel theorem, justifies +that we take the definition of totally bounded to be the relevant one +and that we defined compacts as we did. +*) + +inline "cic:/CoRN/reals/Intervals/compact_is_totally_bounded.con". + +(*#* +Suprema and infima will be needed throughout; we define them here both +for arbitrary subsets of [IR] and for images of functions. +*) + +inline "cic:/CoRN/reals/Intervals/set_glb_IR.con". + +inline "cic:/CoRN/reals/Intervals/set_lub_IR.con". + +inline "cic:/CoRN/reals/Intervals/fun_image.con". + +inline "cic:/CoRN/reals/Intervals/fun_glb_IR.con". + +inline "cic:/CoRN/reals/Intervals/fun_lub_IR.con". + +(* begin hide *) + +inline "cic:/CoRN/reals/Intervals/Totally_Bounded/aux_seq_lub.con" "Totally_Bounded__". + +inline "cic:/CoRN/reals/Intervals/Totally_Bounded/aux_seq_lub_prop.con" "Totally_Bounded__". + +(* end hide *) + +(*#* +The following are probably the most important results in this section. +*) + +inline "cic:/CoRN/reals/Intervals/totally_bounded_has_lub.con". + +(* begin hide *) + +inline "cic:/CoRN/reals/Intervals/Totally_Bounded/aux_seq_glb.con" "Totally_Bounded__". + +inline "cic:/CoRN/reals/Intervals/Totally_Bounded/aux_seq_glb_prop.con" "Totally_Bounded__". + +(* end hide *) + +inline "cic:/CoRN/reals/Intervals/totally_bounded_has_glb.con". + +(* UNEXPORTED +End Totally_Bounded +*) + +(* UNEXPORTED +Section Compact +*) + +(*#* ** Compact sets + +In this section we dwell a bit farther into the definition of compactness +and explore some of its properties. + +The following characterization of inclusion can be very useful: +*) + +inline "cic:/CoRN/reals/Intervals/included_compact.con". + +(*#* +At several points in our future development of a theory we will need +to partition a compact interval in subintervals of length smaller than +some predefined value [eps]. Although this seems a +consequence of every compact interval being totally bounded, it is in +fact a stronger property. In this section we perform that +construction (requiring the endpoints of the interval to be distinct) +and prove some of its good properties. + +%\begin{convention}% Let [a,b : IR], [Hab : (a [<=] b)] and denote by [I] +the compact interval [[a,b]]. Also assume that [a [<] b], and let [e] be +a positive real number. +%\end{convention}% +*) + +alias id "a" = "cic:/CoRN/reals/Intervals/Compact/a.var". + +alias id "b" = "cic:/CoRN/reals/Intervals/Compact/b.var". + +alias id "Hab" = "cic:/CoRN/reals/Intervals/Compact/Hab.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/Intervals/Compact/I.con" "Compact__". + +(* end hide *) + +alias id "Hab'" = "cic:/CoRN/reals/Intervals/Compact/Hab'.var". + +alias id "e" = "cic:/CoRN/reals/Intervals/Compact/e.var". + +alias id "He" = "cic:/CoRN/reals/Intervals/Compact/He.var". + +(*#* +We start by finding a natural number [n] such that [(b[-]a) [/] n [<] e]. +*) + +inline "cic:/CoRN/reals/Intervals/compact_nat.con". + +(*#* Obviously such an [n] must be greater than zero.*) + +inline "cic:/CoRN/reals/Intervals/pos_compact_nat.con". + +(*#* +We now define a sequence on [n] points in [[a,b]] by +[x_i [=] Min(a,b) [+]i[*] (b[-]a) [/]n] and +prove that all of its points are really in that interval. +*) + +inline "cic:/CoRN/reals/Intervals/compact_part.con". + +inline "cic:/CoRN/reals/Intervals/compact_part_hyp.con". + +(*#* +This sequence is strictly increasing and each two consecutive points +are apart by less than [e].*) + +inline "cic:/CoRN/reals/Intervals/compact_less.con". + +inline "cic:/CoRN/reals/Intervals/compact_leEq.con". + +(*#* When we proceed to integration, this lemma will also be useful: *) + +inline "cic:/CoRN/reals/Intervals/compact_partition_lemma.con". + +(*#* The next lemma provides an upper bound for the distance between two points in an interval: *) + +inline "cic:/CoRN/reals/Intervals/compact_elements.con". + +(* UNEXPORTED +Opaque Min Max. +*) + +(*#* The following is a variation on the previous lemma: *) + +inline "cic:/CoRN/reals/Intervals/compact_elements'.con". + +(*#* The following lemma is a bit more specific: it shows that we can +also estimate the distance from the center of a compact interval to +any of its points. *) + +inline "cic:/CoRN/reals/Intervals/compact_bnd_AbsIR.con". + +(*#* Finally, two more useful lemmas to prove inclusion of compact +intervals. They will be necessary for the definition and proof of the +elementary properties of the integral. *) + +inline "cic:/CoRN/reals/Intervals/included2_compact.con". + +inline "cic:/CoRN/reals/Intervals/included3_compact.con". + +(* UNEXPORTED +End Compact +*) + +(* UNEXPORTED +Hint Resolve included_compact included2_compact included3_compact : included. +*) + diff --git a/matita/contribs/CoRN-Decl/reals/Max_AbsIR.ma b/matita/contribs/CoRN-Decl/reals/Max_AbsIR.ma new file mode 100644 index 000000000..de927363f --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/Max_AbsIR.ma @@ -0,0 +1,413 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/Max_AbsIR". + +include "CoRN.ma". + +(* $Id: Max_AbsIR.v,v 1.13 2004/04/23 10:01:04 lcf Exp $ *) + +(*#* printing Max %\ensuremath{\max}% *) + +(*#* printing Min %\ensuremath{\min}% *) + +include "reals/CauchySeq.ma". + +(* UNEXPORTED +Section Maximum +*) + +(* UNEXPORTED +Section Max_function +*) + +(*#* ** Maximum, Minimum and Absolute Value + +%\begin{convention}% +Let [x] and [y] be reals +(we will define the maximum of [x] and [y]). +%\end{convention}% +*) + +alias id "x" = "cic:/CoRN/reals/Max_AbsIR/Maximum/Max_function/x.var". + +alias id "y" = "cic:/CoRN/reals/Max_AbsIR/Maximum/Max_function/y.var". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_seq.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_seq_char.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Cauchy_Max_seq.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_CauchySeq.con". + +inline "cic:/CoRN/reals/Max_AbsIR/MAX.con". + +(*#* +Constructively, the elementary properties of the maximum function are: +- [x [<=] Max (x,y)], +- [x [<=] Max (y,x)], +- [z [<] Max(x,y) -> z [<] x or z [<] y]. + +(This can be more concisely expressed as +[z [<] Max(x,y) Iff z [<] x or z [<] y]). +From these elementary properties we can prove all other properties, including +strong extensionality. +With strong extensionality, we can make the binary operation [Max]. +(So [Max] is [MAX] coupled with some proofs.) +*) + +inline "cic:/CoRN/reals/Max_AbsIR/lft_leEq_MAX.con". + +inline "cic:/CoRN/reals/Max_AbsIR/rht_leEq_MAX.con". + +inline "cic:/CoRN/reals/Max_AbsIR/less_MAX_imp.con". + +(* UNEXPORTED +End Max_function +*) + +inline "cic:/CoRN/reals/Max_AbsIR/MAX_strext.con". + +inline "cic:/CoRN/reals/Max_AbsIR/MAX_wd.con". + +(* UNEXPORTED +Section properties_of_Max +*) + +(*#* *** Maximum *) + +inline "cic:/CoRN/reals/Max_AbsIR/Max.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_wd_unfolded.con". + +inline "cic:/CoRN/reals/Max_AbsIR/lft_leEq_Max.con". + +inline "cic:/CoRN/reals/Max_AbsIR/rht_leEq_Max.con". + +inline "cic:/CoRN/reals/Max_AbsIR/less_Max_imp.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_leEq.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_less.con". + +inline "cic:/CoRN/reals/Max_AbsIR/equiv_imp_eq_max.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_id.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_comm.con". + +inline "cic:/CoRN/reals/Max_AbsIR/leEq_imp_Max_is_rht.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_is_rht_imp_leEq.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Max_minus_eps_leEq.con". + +inline "cic:/CoRN/reals/Max_AbsIR/max_one_ap_zero.con". + +inline "cic:/CoRN/reals/Max_AbsIR/pos_max_one.con". + +inline "cic:/CoRN/reals/Max_AbsIR/x_div_Max_leEq_x.con". + +(* UNEXPORTED +End properties_of_Max +*) + +(* UNEXPORTED +End Maximum +*) + +(* UNEXPORTED +Hint Resolve Max_id: algebra. +*) + +(* UNEXPORTED +Section Minimum +*) + +(*#* *** Mininum + +The minimum is defined by the formula +[Min(x,y) [=] [--]Max( [--]x,[--]y)]. +*) + +inline "cic:/CoRN/reals/Max_AbsIR/MIN.con". + +inline "cic:/CoRN/reals/Max_AbsIR/MIN_wd.con". + +inline "cic:/CoRN/reals/Max_AbsIR/MIN_strext.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_wd_unfolded.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_strext_unfolded.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_leEq_lft.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_leEq_rht.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_less_imp.con". + +inline "cic:/CoRN/reals/Max_AbsIR/leEq_Min.con". + +inline "cic:/CoRN/reals/Max_AbsIR/less_Min.con". + +inline "cic:/CoRN/reals/Max_AbsIR/equiv_imp_eq_min.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_id.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_comm.con". + +inline "cic:/CoRN/reals/Max_AbsIR/leEq_imp_Min_is_lft.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_is_lft_imp_leEq.con". + +inline "cic:/CoRN/reals/Max_AbsIR/leEq_Min_plus_eps.con". + +alias id "a" = "cic:/CoRN/reals/Max_AbsIR/Minimum/a.var". + +alias id "b" = "cic:/CoRN/reals/Max_AbsIR/Minimum/b.var". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_leEq_Max.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_leEq_Max'.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min3_leEq_Max3.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_less_Max.con". + +inline "cic:/CoRN/reals/Max_AbsIR/ap_imp_Min_less_Max.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Min_less_Max_imp_ap.con". + +(* UNEXPORTED +End Minimum +*) + +(*#**********************************) + +(* UNEXPORTED +Section Absolute +*) + +(*#**********************************) + +(*#* *** Absolute value *) + +inline "cic:/CoRN/reals/Max_AbsIR/ABSIR.con". + +inline "cic:/CoRN/reals/Max_AbsIR/ABSIR_strext.con". + +inline "cic:/CoRN/reals/Max_AbsIR/ABSIR_wd.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_wd.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_wdl.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_wdr.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIRz_isz.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_nonneg.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_pos.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_cancel_ap_zero.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_resp_ap_zero.con". + +inline "cic:/CoRN/reals/Max_AbsIR/leEq_AbsIR.con". + +inline "cic:/CoRN/reals/Max_AbsIR/inv_leEq_AbsIR.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsSmall_e.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsSmall_imp_AbsIR.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_eq_AbsSmall.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_imp_AbsSmall.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsSmall_transitive.con". + +inline "cic:/CoRN/reals/Max_AbsIR/zero_less_AbsIR_plus_one.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_inv.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_minus.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_eq_x.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_eq_inv_x.con". + +inline "cic:/CoRN/reals/Max_AbsIR/less_AbsIR.con". + +inline "cic:/CoRN/reals/Max_AbsIR/leEq_distr_AbsIR.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_approach_zero.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_eq_zero.con". + +inline "cic:/CoRN/reals/Max_AbsIR/Abs_Max.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_str_bnd.con". + +inline "cic:/CoRN/reals/Max_AbsIR/AbsIR_bnd.con". + +(* UNEXPORTED +End Absolute +*) + +(* UNEXPORTED +Hint Resolve AbsIRz_isz: algebra. +*) + +(* UNEXPORTED +Section Part_Function_Max +*) + +(*#* *** Functional Operators + +The existence of these operators allows us to lift them to functions. We will define the maximum, minimum and absolute value of two partial functions. + +%\begin{convention}% +Let [F,G:PartIR] and denote by [P] and [Q] their respective domains. +%\end{convention}% +*) + +alias id "F" = "cic:/CoRN/reals/Max_AbsIR/Part_Function_Max/F.var". + +alias id "G" = "cic:/CoRN/reals/Max_AbsIR/Part_Function_Max/G.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/Max_AbsIR/Part_Function_Max/P.con" "Part_Function_Max__". + +inline "cic:/CoRN/reals/Max_AbsIR/Part_Function_Max/Q.con" "Part_Function_Max__". + +(* end hide *) + +inline "cic:/CoRN/reals/Max_AbsIR/part_function_Max_strext.con". + +inline "cic:/CoRN/reals/Max_AbsIR/FMax.con". + +(* UNEXPORTED +End Part_Function_Max +*) + +(* UNEXPORTED +Section Part_Function_Abs +*) + +alias id "F" = "cic:/CoRN/reals/Max_AbsIR/Part_Function_Abs/F.var". + +alias id "G" = "cic:/CoRN/reals/Max_AbsIR/Part_Function_Abs/G.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/Max_AbsIR/Part_Function_Abs/P.con" "Part_Function_Abs__". + +inline "cic:/CoRN/reals/Max_AbsIR/Part_Function_Abs/Q.con" "Part_Function_Abs__". + +(* end hide *) + +inline "cic:/CoRN/reals/Max_AbsIR/FMin.con". + +inline "cic:/CoRN/reals/Max_AbsIR/FAbs.con". + +(* UNEXPORTED +Opaque Max. +*) + +inline "cic:/CoRN/reals/Max_AbsIR/FMin_char.con". + +(* UNEXPORTED +Transparent Max. +*) + +inline "cic:/CoRN/reals/Max_AbsIR/FAbs_char.con". + +(* UNEXPORTED +End Part_Function_Abs +*) + +(* UNEXPORTED +Hint Resolve FAbs_char: algebra. +*) + +inline "cic:/CoRN/reals/Max_AbsIR/FAbs_char'.con". + +inline "cic:/CoRN/reals/Max_AbsIR/FAbs_nonneg.con". + +(* UNEXPORTED +Hint Resolve FAbs_char': algebra. +*) + +(* UNEXPORTED +Section Inclusion +*) + +alias id "F" = "cic:/CoRN/reals/Max_AbsIR/Inclusion/F.var". + +alias id "G" = "cic:/CoRN/reals/Max_AbsIR/Inclusion/G.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/Max_AbsIR/Inclusion/P.con" "Inclusion__". + +inline "cic:/CoRN/reals/Max_AbsIR/Inclusion/Q.con" "Inclusion__". + +(* end hide *) + +(*#* +%\begin{convention}% Let [R:IR->CProp]. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/reals/Max_AbsIR/Inclusion/R.var". + +inline "cic:/CoRN/reals/Max_AbsIR/included_FMax.con". + +inline "cic:/CoRN/reals/Max_AbsIR/included_FMax'.con". + +inline "cic:/CoRN/reals/Max_AbsIR/included_FMax''.con". + +inline "cic:/CoRN/reals/Max_AbsIR/included_FMin.con". + +inline "cic:/CoRN/reals/Max_AbsIR/included_FMin'.con". + +inline "cic:/CoRN/reals/Max_AbsIR/included_FMin''.con". + +inline "cic:/CoRN/reals/Max_AbsIR/included_FAbs.con". + +inline "cic:/CoRN/reals/Max_AbsIR/included_FAbs'.con". + +(* UNEXPORTED +End Inclusion +*) + +(* UNEXPORTED +Hint Resolve included_FMax included_FMin included_FAbs : included. +*) + +(* UNEXPORTED +Hint Immediate included_FMax' included_FMin' included_FAbs' + included_FMax'' included_FMin'' : included. +*) + diff --git a/matita/contribs/CoRN-Decl/reals/NRootIR.ma b/matita/contribs/CoRN-Decl/reals/NRootIR.ma new file mode 100644 index 000000000..0f976d765 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/NRootIR.ma @@ -0,0 +1,269 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/NRootIR". + +include "CoRN.ma". + +(* $Id: NRootIR.v,v 1.5 2004/04/23 10:01:05 lcf Exp $ *) + +(*#* printing NRoot %\ensuremath{\sqrt[n]{\cdot}}% *) + +(*#* printing sqrt %\ensuremath{\sqrt{\cdot}}% *) + +include "reals/OddPolyRootIR.ma". + +(*#* * Roots of Real Numbers *) + +(* UNEXPORTED +Section NRoot +*) + +(*#* ** Existence of roots + +%\begin{convention}% Let [n] be a natural number and [c] a nonnegative real. +[p] is the auxiliary polynomial [_X_[^]n[-] (_C_ c)]. +%\end{convention}% +*) + +alias id "n" = "cic:/CoRN/reals/NRootIR/NRoot/n.var". + +alias id "n_pos" = "cic:/CoRN/reals/NRootIR/NRoot/n_pos.var". + +alias id "c" = "cic:/CoRN/reals/NRootIR/NRoot/c.var". + +alias id "c_nonneg" = "cic:/CoRN/reals/NRootIR/NRoot/c_nonneg.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/NRootIR/NRoot/p.con" "NRoot__". + +(* end hide *) + +inline "cic:/CoRN/reals/NRootIR/CnrootIR.con". + +(* UNEXPORTED +End NRoot +*) + +(*#* We define the root of order [n] for any nonnegative real number and +prove its main properties: + - $\left(\sqrt[n]x\right)^n=x$#(sqrt(n) x)^n =x#; + - $0\leq\sqrt[n]x$#0≤sqrt(n)x#; + - if [Zero [<] x] then $0<\sqrt[n]x$#0<sqrt(n)x#; + - $\sqrt[n]{x^n}=x$#sqrt(n) x^n =x#; + - the nth root is monotonous; + - in particular, if [x [<] One] then $\sqrt[n]x<1$#sqrt(n) x<1#. + +[(nroot ??)] will be written as [NRoot]. +*) + +(* UNEXPORTED +Section Nth_Root +*) + +inline "cic:/CoRN/reals/NRootIR/nroot.con". + +inline "cic:/CoRN/reals/NRootIR/NRoot.con". + +inline "cic:/CoRN/reals/NRootIR/NRoot_power.con". + +(* UNEXPORTED +Hint Resolve NRoot_power: algebra. +*) + +inline "cic:/CoRN/reals/NRootIR/NRoot_nonneg.con". + +inline "cic:/CoRN/reals/NRootIR/NRoot_pos.con". + +inline "cic:/CoRN/reals/NRootIR/NRoot_power'.con". + +inline "cic:/CoRN/reals/NRootIR/NRoot_pres_less.con". + +inline "cic:/CoRN/reals/NRootIR/NRoot_less_one.con". + +inline "cic:/CoRN/reals/NRootIR/NRoot_cancel.con". + +(*#* %\begin{convention}% Let [x,y] be nonnegative real numbers. +%\end{convention}% *) + +alias id "x" = "cic:/CoRN/reals/NRootIR/Nth_Root/x.var". + +alias id "y" = "cic:/CoRN/reals/NRootIR/Nth_Root/y.var". + +alias id "Hx" = "cic:/CoRN/reals/NRootIR/Nth_Root/Hx.var". + +alias id "Hy" = "cic:/CoRN/reals/NRootIR/Nth_Root/Hy.var". + +inline "cic:/CoRN/reals/NRootIR/NRoot_wd.con". + +inline "cic:/CoRN/reals/NRootIR/NRoot_unique.con". + +(* UNEXPORTED +End Nth_Root +*) + +(* UNEXPORTED +Implicit Arguments NRoot [x n]. +*) + +(* UNEXPORTED +Hint Resolve NRoot_power NRoot_power': algebra. +*) + +inline "cic:/CoRN/reals/NRootIR/NRoot_resp_leEq.con". + +(*#**********************************) + +(* UNEXPORTED +Section Square_root +*) + +(*#**********************************) + +(*#* ** Square root *) + +inline "cic:/CoRN/reals/NRootIR/sqrt.con". + +inline "cic:/CoRN/reals/NRootIR/sqrt_sqr.con". + +(* UNEXPORTED +Hint Resolve sqrt_sqr: algebra. +*) + +inline "cic:/CoRN/reals/NRootIR/sqrt_nonneg.con". + +inline "cic:/CoRN/reals/NRootIR/sqrt_wd.con". + +(* UNEXPORTED +Hint Resolve sqrt_wd: algebra_c. +*) + +inline "cic:/CoRN/reals/NRootIR/sqrt_to_nonneg.con". + +inline "cic:/CoRN/reals/NRootIR/sqrt_to_nonpos.con". + +inline "cic:/CoRN/reals/NRootIR/sqrt_mult.con". + +(* UNEXPORTED +Hint Resolve sqrt_mult: algebra. +*) + +inline "cic:/CoRN/reals/NRootIR/sqrt_mult_wd.con". + +inline "cic:/CoRN/reals/NRootIR/sqrt_less.con". + +inline "cic:/CoRN/reals/NRootIR/sqrt_less'.con". + +inline "cic:/CoRN/reals/NRootIR/sqrt_resp_leEq.con". + +inline "cic:/CoRN/reals/NRootIR/sqrt_resp_less.con". + +(* UNEXPORTED +End Square_root +*) + +(* UNEXPORTED +Hint Resolve sqrt_wd: algebra_c. +*) + +(* UNEXPORTED +Hint Resolve sqrt_sqr sqrt_mult: algebra. +*) + +(* UNEXPORTED +Section Absolute_Props +*) + +(*#* ** More on absolute value + +With the help of square roots, we can prove some more properties of absolute +values in [IR]. +*) + +inline "cic:/CoRN/reals/NRootIR/AbsIR_sqrt_sqr.con". + +(* UNEXPORTED +Hint Resolve AbsIR_sqrt_sqr: algebra. +*) + +inline "cic:/CoRN/reals/NRootIR/AbsIR_resp_mult.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_mult_pos.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_mult_pos'.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_nexp.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_nexp_op.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_less_square.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_leEq_square.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_division.con". + +(*#* Some special cases. *) + +inline "cic:/CoRN/reals/NRootIR/AbsIR_recip.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_div_two.con". + +(*#* Cauchy-Schwartz for IR and variants on that subject. *) + +inline "cic:/CoRN/reals/NRootIR/triangle_IR.con". + +inline "cic:/CoRN/reals/NRootIR/triangle_SumIR.con". + +inline "cic:/CoRN/reals/NRootIR/triangle_IR_minus.con". + +inline "cic:/CoRN/reals/NRootIR/weird_triangleIR.con". + +inline "cic:/CoRN/reals/NRootIR/triangle_IR_minus'.con". + +inline "cic:/CoRN/reals/NRootIR/triangle_SumxIR.con". + +inline "cic:/CoRN/reals/NRootIR/triangle_Sum2IR.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_str_bnd_AbsIR.con". + +inline "cic:/CoRN/reals/NRootIR/AbsIR_bnd_AbsIR.con". + +(* UNEXPORTED +End Absolute_Props +*) + +(* UNEXPORTED +Section Consequences +*) + +(*#* **Cauchy sequences + +With these results, we can also prove that the sequence of reciprocals of a +Cauchy sequence that is never zero and whose Limit is not zero is also a +Cauchy sequence. +*) + +inline "cic:/CoRN/reals/NRootIR/Cauchy_Lim_recip.con". + +inline "cic:/CoRN/reals/NRootIR/Cauchy_recip.con". + +inline "cic:/CoRN/reals/NRootIR/Lim_recip.con". + +(* UNEXPORTED +End Consequences +*) + diff --git a/matita/contribs/CoRN-Decl/reals/OddPolyRootIR.ma b/matita/contribs/CoRN-Decl/reals/OddPolyRootIR.ma new file mode 100644 index 000000000..ebcef6dac --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/OddPolyRootIR.ma @@ -0,0 +1,166 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/OddPolyRootIR". + +include "CoRN.ma". + +(* $Id: OddPolyRootIR.v,v 1.5 2004/04/23 10:01:05 lcf Exp $ *) + +include "reals/IVT.ma". + +(*#* * Roots of polynomials of odd degree *) + +(* UNEXPORTED +Section CPoly_Big +*) + +(*#* ** Monic polynomials are positive near infinity +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/reals/OddPolyRootIR/CPoly_Big/R.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/OddPolyRootIR/CPoly_Big/RX.con" "CPoly_Big__". + +(* end hide *) + +inline "cic:/CoRN/reals/OddPolyRootIR/Cbigger.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/Ccpoly_big.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/cpoly_pos.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/Ccpoly_pos'.con". + +(* UNEXPORTED +End CPoly_Big +*) + +(* UNEXPORTED +Section Flip_Poly +*) + +(*#* **Flipping a polynomial +%\begin{convention}% Let [R] be a ring. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/reals/OddPolyRootIR/Flip_Poly/R.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/OddPolyRootIR/Flip_Poly/RX.con" "Flip_Poly__". + +(* end hide *) + +inline "cic:/CoRN/reals/OddPolyRootIR/flip.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/flip_poly.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/flip_coefficient.con". + +(* UNEXPORTED +Hint Resolve flip_coefficient: algebra. +*) + +inline "cic:/CoRN/reals/OddPolyRootIR/flip_odd.con". + +(* UNEXPORTED +End Flip_Poly +*) + +(* UNEXPORTED +Hint Resolve flip_poly: algebra. +*) + +(* UNEXPORTED +Section OddPoly_Signs +*) + +(*#* ** Sign of a polynomial of odd degree +%\begin{convention}% Let [R] be an ordered field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/reals/OddPolyRootIR/OddPoly_Signs/R.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/OddPolyRootIR/OddPoly_Signs/RX.con" "OddPoly_Signs__". + +(* end hide *) + +inline "cic:/CoRN/reals/OddPolyRootIR/oddpoly_pos.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/oddpoly_pos'.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/oddpoly_neg.con". + +(* UNEXPORTED +End OddPoly_Signs +*) + +(* UNEXPORTED +Section Poly_Norm +*) + +(*#* ** The norm of a polynomial +%\begin{convention}% Let [R] be a field, and [RX] the polynomials over +this field. +%\end{convention}% +*) + +alias id "R" = "cic:/CoRN/reals/OddPolyRootIR/Poly_Norm/R.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/OddPolyRootIR/Poly_Norm/RX.con" "Poly_Norm__". + +(* end hide *) + +inline "cic:/CoRN/reals/OddPolyRootIR/poly_norm_aux.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/poly_norm.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/poly_norm_monic.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/poly_norm_apply.con". + +(* UNEXPORTED +End Poly_Norm +*) + +(* UNEXPORTED +Section OddPoly_Root +*) + +(*#* ** Roots of polynomials of odd degree +Polynomials of odd degree over the reals always have a root. *) + +inline "cic:/CoRN/reals/OddPolyRootIR/oddpoly_root'.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/oddpoly_root.con". + +inline "cic:/CoRN/reals/OddPolyRootIR/realpolyn_oddhaszero.con". + +(* UNEXPORTED +End OddPoly_Root +*) + diff --git a/matita/contribs/CoRN-Decl/reals/Q_dense.ma b/matita/contribs/CoRN-Decl/reals/Q_dense.ma new file mode 100644 index 000000000..2b12a73bc --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/Q_dense.ma @@ -0,0 +1,169 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/Q_dense". + +include "CoRN.ma". + +(* begin hide *) + +include "reals/Q_in_CReals.ma". + +(*#***** Opaque_algebra.v will be loaded in line 151 ******) + +inline "cic:/CoRN/reals/Q_dense/or_not_and.con". + +(* UNEXPORTED +Section Interval_definition +*) + +alias id "OF" = "cic:/CoRN/reals/Q_dense/Interval_definition/OF.var". + +inline "cic:/CoRN/reals/Q_dense/Interval.ind". + +coercion cic:/matita/CoRN-Decl/reals/Q_dense/pair_crr.con 0 (* compounds *). + +inline "cic:/CoRN/reals/Q_dense/Length.con". + +(* UNEXPORTED +End Interval_definition +*) + +inline "cic:/CoRN/reals/Q_dense/Rat_Interval.con". + +(* we have this in Q_COrdField... *) + +inline "cic:/CoRN/reals/Q_dense/Qlt_eq_gt_dec'.con". + +(* +Lemma ex_informative_on_Q:(P:Q_as_COrdField->Prop)(Ex [q:Q_as_COrdField](P q)) + ->{q:Q_as_COrdField | (P q)}. +Proof. + Intro. + Intro. + Apply ex_informative. + Assumption. +Qed. +*) + +(* UNEXPORTED +Section COrdField_extra +*) + +alias id "OF" = "cic:/CoRN/reals/Q_dense/COrdField_extra/OF.var". + +inline "cic:/CoRN/reals/Q_dense/AbsSmall_pos_reflexive.con". + +inline "cic:/CoRN/reals/Q_dense/AbsSmall_neg_reflexive.con". + +inline "cic:/CoRN/reals/Q_dense/AbsSmall_subinterval.con". + +(* UNEXPORTED +End COrdField_extra +*) + +(* UNEXPORTED +Section Rational_sequence +*) + +include "tactics/Opaque_algebra.ma". + +(*#*** WARNING: A file is being loaded *****) + +alias id "R1" = "cic:/CoRN/reals/Q_dense/Rational_sequence/R1.var". + +inline "cic:/CoRN/reals/Q_dense/start_l.con". + +inline "cic:/CoRN/reals/Q_dense/start_of_sequence2.con". + +inline "cic:/CoRN/reals/Q_dense/start_r.con". + +inline "cic:/CoRN/reals/Q_dense/start_of_sequence_property.con". + +inline "cic:/CoRN/reals/Q_dense/l_less_r.con". + +inline "cic:/CoRN/reals/Q_dense/shrink23.con". + +inline "cic:/CoRN/reals/Q_dense/shrink13.con". + +inline "cic:/CoRN/reals/Q_dense/shrink24.con". + +inline "cic:/CoRN/reals/Q_dense/cotrans_analyze.con". + +inline "cic:/CoRN/reals/Q_dense/cotrans_analyze_strong.con". + +inline "cic:/CoRN/reals/Q_dense/trichotomy.con". + +inline "cic:/CoRN/reals/Q_dense/trichotomy_strong1.con". + +(* NOTATION +Notation "( A , B )" := (pairT A B). +*) + +inline "cic:/CoRN/reals/Q_dense/if_cotrans.con". + +inline "cic:/CoRN/reals/Q_dense/if_cotrans_strong.con". + +inline "cic:/CoRN/reals/Q_dense/Intrvl.con". + +inline "cic:/CoRN/reals/Q_dense/G.con". + +(* UNEXPORTED +Opaque Q_as_CField. +*) + +inline "cic:/CoRN/reals/Q_dense/delta_Intrvl.con". + +inline "cic:/CoRN/reals/Q_dense/Length_Intrvl.con". + +inline "cic:/CoRN/reals/Q_dense/Intrvl_inside_l_n.con". + +inline "cic:/CoRN/reals/Q_dense/Intrvl_inside_r_n.con". + +inline "cic:/CoRN/reals/Q_dense/G_m_n_lower.con". + +inline "cic:/CoRN/reals/Q_dense/G_m_n_upper.con". + +(* UNEXPORTED +Opaque Q_as_COrdField. +*) + +inline "cic:/CoRN/reals/Q_dense/a_simple_inequality.con". + +inline "cic:/CoRN/reals/Q_dense/G_conversion_rate2.con". + +inline "cic:/CoRN/reals/Q_dense/CS_seq_G.con". + +inline "cic:/CoRN/reals/Q_dense/G_as_CauchySeq.con". + +inline "cic:/CoRN/reals/Q_dense/CS_seq_inj_Q_G.con". + +inline "cic:/CoRN/reals/Q_dense/inj_Q_G_as_CauchySeq.con". + +inline "cic:/CoRN/reals/Q_dense/x_in_Intrvl_l.con". + +inline "cic:/CoRN/reals/Q_dense/x_in_Intrvl_r.con". + +inline "cic:/CoRN/reals/Q_dense/G_conversion_rate_resp_x.con". + +inline "cic:/CoRN/reals/Q_dense/x_is_SeqLimit_G.con". + +(* UNEXPORTED +End Rational_sequence +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/reals/Q_in_CReals.ma b/matita/contribs/CoRN-Decl/reals/Q_in_CReals.ma new file mode 100644 index 000000000..0a4f30216 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/Q_in_CReals.ma @@ -0,0 +1,170 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/Q_in_CReals". + +include "CoRN.ma". + +(* $Id: Q_in_CReals.v,v 1.10 2004/04/23 10:01:05 lcf Exp $ *) + +(*#* * On density of the image of [Q] in an arbitrary real number structure +In this file we introduce the image of the concrete rational numbers +(as defined earlier) in an arbitrary structure of type +[CReals]. At the end of this file we assign to any real number two +rational numbers for which the real number lies betwen image of them; +in other words we will prove that the image of rational numbers in +dense in any real number structure. *) + +include "model/reals/Cauchy_IR.ma". + +include "model/monoids/Nmonoid.ma". + +include "model/rings/Zring.ma". + +(* UNEXPORTED +Section Rational_sequence_prelogue +*) + +(*#* +%\begin{convention}% Let [R1] be a real number structure. +%\end{convention}% +*) + +alias id "R1" = "cic:/CoRN/reals/Q_in_CReals/Rational_sequence_prelogue/R1.var". + +(* We clone these proofs from CReals1.v just because there IR is an axiom *) + +(* begin hide *) + +inline "cic:/CoRN/reals/Q_in_CReals/CReals_is_CReals.con". + +inline "cic:/CoRN/reals/Q_in_CReals/Lim_Cauchy.con". + +inline "cic:/CoRN/reals/Q_in_CReals/Archimedes.con". + +inline "cic:/CoRN/reals/Q_in_CReals/Archimedes'.con". + +(*#**************************************) + +coercion cic:/Coq/NArith/BinPos/nat_of_P.con 0 (* compounds *). + +(* end hide *) + +(*#* +** Injection from [Q] to an arbitrary real number structure + First we need to define the injection from [Q] to [R1]. Note that in [Cauchy_CReals] we defined [inject_Q] from an arbitray field [F] to [(R_COrdField F)] which was the set of Cauchy sequences of that field. But since [R1] is an %\emph{arbitrary}%#arbitrary# real number structure we can not use [inject_Q]. + + To define the injection we need one elemntary lemma about the denominator: +*) + +inline "cic:/CoRN/reals/Q_in_CReals/den_is_nonzero.con". + +(*#* And we define the injection in the natural way, using [zring] and [nring]. We call this [inj_Q], in contrast with [inject_Q] defined in [Cauchy_CReals]. *) + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q.con". + +(*#* Next we need some properties of [nring], on the setoid of natural numbers: *) + +inline "cic:/CoRN/reals/Q_in_CReals/nring_strext.con". + +inline "cic:/CoRN/reals/Q_in_CReals/nring_wd.con". + +inline "cic:/CoRN/reals/Q_in_CReals/nring_eq.con". + +inline "cic:/CoRN/reals/Q_in_CReals/nring_leEq.con". + +(* begin hide *) + +(* UNEXPORTED +Unset Printing Coercions. +*) + +(* end hide *) + +(*#* Similarly we prove some properties of [zring] on the ring of integers: *) + +inline "cic:/CoRN/reals/Q_in_CReals/zring_strext.con". + +inline "cic:/CoRN/reals/Q_in_CReals/zring_wd.con". + +inline "cic:/CoRN/reals/Q_in_CReals/zring_less.con". + +(*#* Using the above lemmata we prove the basic properties of [inj_Q], i.e.%\% it is a setoid function and preserves the ring operations and oreder operation. *) + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_strext.con". + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_wd.con". + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_plus.con". + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_mult.con". + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_less.con". + +inline "cic:/CoRN/reals/Q_in_CReals/less_inj_Q.con". + +inline "cic:/CoRN/reals/Q_in_CReals/leEq_inj_Q.con". + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_leEq.con". + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_min.con". + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_minus.con". + +(*#* Moreover, and as expected, the [AbsSmall] predicate is also +preserved under the [inj_Q] *) + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_AbsSmall.con". + +inline "cic:/CoRN/reals/Q_in_CReals/AbsSmall_inj_Q.con". + +(*#* ** Injection preserves Cauchy property +We apply the above lemmata to obtain following theorem, which says +that a Cauchy sequence of elemnts of [Q] will be Cauchy in [R1]. +*) + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_Cauchy.con". + +(*#* Furthermore we prove that applying [nring] (which is adding the +ring unit [n] times) is the same whether we do it in [Q] or in [R1]: +*) + +inline "cic:/CoRN/reals/Q_in_CReals/inj_Q_nring.con". + +(*#* ** Injection of [Q] is dense +Finally we are able to prove the density of image of [Q] in [R1]. We +state this fact in two different ways. Both of them have their +specific use. + +The first theorem states the fact that any real number can be bound by +the image of two rational numbers. This is called [start_of_sequence] +because it can be used as an starting point for the typical "interval +trisection" argument, which is ubiquitous in constructive analysis. +*) + +inline "cic:/CoRN/reals/Q_in_CReals/start_of_sequence.con". + +(*#* The second version of the density of [Q] in [R1] states that given +any positive real number, there is a rational number between it and +zero. This lemma can be used to prove the more general fact that there +is a rational number between any two real numbers. *) + +inline "cic:/CoRN/reals/Q_in_CReals/Q_dense_in_CReals.con". + +(* UNEXPORTED +End Rational_sequence_prelogue +*) + diff --git a/matita/contribs/CoRN-Decl/reals/R_morphism.ma b/matita/contribs/CoRN-Decl/reals/R_morphism.ma new file mode 100644 index 000000000..5ce1b103c --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/R_morphism.ma @@ -0,0 +1,298 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/R_morphism". + +include "CoRN.ma". + +(* begin hide *) + +(* In this file a notion of morphism between two arbitrary real number + structures, is introduced together with te proofs that this notion of + morphism preserves the basic algebraic structure. *) + +include "reals/CReals.ma". + +(* This comes from CReals1.v *) + +inline "cic:/CoRN/reals/R_morphism/Cauchy_Lim_prop2.con". + +(* UNEXPORTED +Section morphism +*) + +alias id "R1" = "cic:/CoRN/reals/R_morphism/morphism/R1.var". + +alias id "R2" = "cic:/CoRN/reals/R_morphism/morphism/R2.var". + +(* UNEXPORTED +Section morphism_details +*) + +alias id "phi" = "cic:/CoRN/reals/R_morphism/morphism/morphism_details/phi.var". + +alias id "p1" = "cic:/CoRN/reals/R_morphism/morphism/morphism_details/p1.var". + +alias id "p2" = "cic:/CoRN/reals/R_morphism/morphism/morphism_details/p2.var". + +alias id "f1" = "cic:/CoRN/reals/R_morphism/morphism/morphism_details/f1.var". + +alias id "f2" = "cic:/CoRN/reals/R_morphism/morphism/morphism_details/f2.var". + +alias id "g1" = "cic:/CoRN/reals/R_morphism/morphism/morphism_details/g1.var". + +alias id "g2" = "cic:/CoRN/reals/R_morphism/morphism/morphism_details/g2.var". + +inline "cic:/CoRN/reals/R_morphism/fun_pres_relation.con". + +inline "cic:/CoRN/reals/R_morphism/fun_pres_un_fun.con". + +inline "cic:/CoRN/reals/R_morphism/fun_pres_bin_fun.con". + +(* +Definition fun_pres_partial_fun:=(x:R1;H1:x[#]Zero;H2:(phi x)[#]Zero) +(phi (nzinj R1 (i1 (nzpro R1 x H1))))[=](nzinj R2 (i2 (nzpro R2 (phi x) H2))). +*) + +inline "cic:/CoRN/reals/R_morphism/fun_pres_Lim.con". + +(* UNEXPORTED +End morphism_details +*) + +inline "cic:/CoRN/reals/R_morphism/Homomorphism.ind". + +coercion cic:/matita/CoRN-Decl/reals/R_morphism/map.con 0 (* compounds *). + +(* This might be useful later... +Definition Homo_as_CSetoid_fun:= + [f:Homomorphism] + (Build_CSetoid_fun R1 R2 f + (fun_strext_imp_wd R1 R2 f (!map_strext f)) + (!map_strext f) + ). +*****************) + +inline "cic:/CoRN/reals/R_morphism/map_strext_unfolded.con". + +inline "cic:/CoRN/reals/R_morphism/map_wd_unfolded.con". + +inline "cic:/CoRN/reals/R_morphism/map_pres_less_unfolded.con". + +inline "cic:/CoRN/reals/R_morphism/map_pres_plus_unfolded.con". + +inline "cic:/CoRN/reals/R_morphism/map_pres_mult_unfolded.con". + +(* Now we start to derive some useful properties of a Homomorphism *) + +inline "cic:/CoRN/reals/R_morphism/map_pres_zero.con". + +inline "cic:/CoRN/reals/R_morphism/map_pres_zero_unfolded.con". + +inline "cic:/CoRN/reals/R_morphism/map_pres_minus.con". + +inline "cic:/CoRN/reals/R_morphism/map_pres_minus_unfolded.con". + +inline "cic:/CoRN/reals/R_morphism/map_pres_apartness.con". + +(* Merely a useful special case *) + +inline "cic:/CoRN/reals/R_morphism/map_pres_ap_zero.con". + +inline "cic:/CoRN/reals/R_morphism/map_pres_one.con". + +inline "cic:/CoRN/reals/R_morphism/map_pres_one_unfolded.con". + +(* I will not use the following lemma *) + +inline "cic:/CoRN/reals/R_morphism/map_pres_inv_unfolded.con". + +(* UNEXPORTED +End morphism +*) + +(* UNEXPORTED +Section composition +*) + +alias id "R1" = "cic:/CoRN/reals/R_morphism/composition/R1.var". + +alias id "R2" = "cic:/CoRN/reals/R_morphism/composition/R2.var". + +alias id "R3" = "cic:/CoRN/reals/R_morphism/composition/R3.var". + +alias id "f" = "cic:/CoRN/reals/R_morphism/composition/f.var". + +alias id "g" = "cic:/CoRN/reals/R_morphism/composition/g.var". + +inline "cic:/CoRN/reals/R_morphism/compose.con". + +inline "cic:/CoRN/reals/R_morphism/compose_strext.con". + +inline "cic:/CoRN/reals/R_morphism/compose_pres_less.con". + +inline "cic:/CoRN/reals/R_morphism/compose_pres_plus.con". + +inline "cic:/CoRN/reals/R_morphism/compose_pres_mult.con". + +inline "cic:/CoRN/reals/R_morphism/compose_pres_Lim.con". + +inline "cic:/CoRN/reals/R_morphism/Compose.con". + +(* UNEXPORTED +End composition +*) + +(* UNEXPORTED +Section isomorphism +*) + +alias id "R1" = "cic:/CoRN/reals/R_morphism/isomorphism/R1.var". + +alias id "R2" = "cic:/CoRN/reals/R_morphism/isomorphism/R2.var". + +(* UNEXPORTED +Section identity_map +*) + +alias id "R3" = "cic:/CoRN/reals/R_morphism/isomorphism/identity_map/R3.var". + +alias id "f" = "cic:/CoRN/reals/R_morphism/isomorphism/identity_map/f.var". + +inline "cic:/CoRN/reals/R_morphism/map_is_id.con". + +(* UNEXPORTED +End identity_map +*) + +inline "cic:/CoRN/reals/R_morphism/Isomorphism.ind". + +(* UNEXPORTED +End isomorphism +*) + +(* UNEXPORTED +Section surjective_map +*) + +alias id "R1" = "cic:/CoRN/reals/R_morphism/surjective_map/R1.var". + +alias id "R2" = "cic:/CoRN/reals/R_morphism/surjective_map/R2.var". + +alias id "f" = "cic:/CoRN/reals/R_morphism/surjective_map/f.var". + +inline "cic:/CoRN/reals/R_morphism/map_is_surjective.con". + +(* UNEXPORTED +End surjective_map +*) + +(* UNEXPORTED +Section simplification +*) + +alias id "R1" = "cic:/CoRN/reals/R_morphism/simplification/R1.var". + +alias id "R2" = "cic:/CoRN/reals/R_morphism/simplification/R2.var". + +alias id "f" = "cic:/CoRN/reals/R_morphism/simplification/f.var". + +alias id "H1" = "cic:/CoRN/reals/R_morphism/simplification/H1.var". + +inline "cic:/CoRN/reals/R_morphism/f_well_def.con". + +(* UNEXPORTED +Section with_less +*) + +alias id "H2" = "cic:/CoRN/reals/R_morphism/simplification/with_less/H2.var". + +inline "cic:/CoRN/reals/R_morphism/less_pres_f.con". + +inline "cic:/CoRN/reals/R_morphism/leEq_pres_f.con". + +inline "cic:/CoRN/reals/R_morphism/f_pres_leEq.con". + +inline "cic:/CoRN/reals/R_morphism/f_pres_apartness.con". + +(* UNEXPORTED +End with_less +*) + +(* UNEXPORTED +Section with_plus +*) + +alias id "H3" = "cic:/CoRN/reals/R_morphism/simplification/with_plus/H3.var". + +inline "cic:/CoRN/reals/R_morphism/f_pres_Zero.con". + +inline "cic:/CoRN/reals/R_morphism/f_pres_minus.con". + +inline "cic:/CoRN/reals/R_morphism/f_pres_min.con". + +(* UNEXPORTED +End with_plus +*) + +(* UNEXPORTED +Section with_plus_less +*) + +alias id "H2" = "cic:/CoRN/reals/R_morphism/simplification/with_plus_less/H2.var". + +alias id "H3" = "cic:/CoRN/reals/R_morphism/simplification/with_plus_less/H3.var". + +inline "cic:/CoRN/reals/R_morphism/f_pres_ap_zero.con". + +(* UNEXPORTED +Section surjectivity_helps +*) + +alias id "f_surj" = "cic:/CoRN/reals/R_morphism/simplification/with_plus_less/surjectivity_helps/f_surj.var". + +inline "cic:/CoRN/reals/R_morphism/f_pres_Lim.con". + +(* UNEXPORTED +End surjectivity_helps +*) + +(* UNEXPORTED +Section with_mult_plus_less +*) + +alias id "H4" = "cic:/CoRN/reals/R_morphism/simplification/with_plus_less/with_mult_plus_less/H4.var". + +inline "cic:/CoRN/reals/R_morphism/f_pres_one.con". + +inline "cic:/CoRN/reals/R_morphism/f_pres_inv.con". + +inline "cic:/CoRN/reals/R_morphism/simplified_Homomorphism.con". + +(* UNEXPORTED +End with_mult_plus_less +*) + +(* UNEXPORTED +End with_plus_less +*) + +(* UNEXPORTED +End simplification +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/reals/RealFuncts.ma b/matita/contribs/CoRN-Decl/reals/RealFuncts.ma new file mode 100644 index 000000000..aa6ba337e --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/RealFuncts.ma @@ -0,0 +1,264 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/RealFuncts". + +include "CoRN.ma". + +(* $Id: RealFuncts.v,v 1.4 2004/04/07 15:08:10 lcf Exp $ *) + +include "reals/CReals1.ma". + +(*#* * Continuity of Functions on Reals +*) + +(* begin hide *) + +(* UNEXPORTED +Set Implicit Arguments. +*) + +(* UNEXPORTED +Unset Strict Implicit. +*) + +(* end hide *) + +(* UNEXPORTED +Section Continuity +*) + +alias id "f" = "cic:/CoRN/reals/RealFuncts/Continuity/f.var". + +alias id "f2" = "cic:/CoRN/reals/RealFuncts/Continuity/f2.var". + +(*#* +Let [f] be a unary setoid operation on [IR] and +let [f2] be a binary setoid operation on [IR]. + +We use the following notations for intervals. [Intclr a b] for the +closed interval [[a,b]], [Intolr a b] for the +open interval [(a,b)], [Intcl a] for the +left-closed interval $[a,\infty)$#[a,∞)#, [Intol a] for the +left-open interval $(a,\infty)$#(a,∞)#, [Intcr b] for the +right-closed interval $(-\infty,b]$#(-∞,b]#. + +Intervals like $[a,b]$#[a,b]# are defined for arbitrary reals [a,b] (being +$\emptyset$#∅# for [a [>] b]). +*) + +inline "cic:/CoRN/reals/RealFuncts/Intclr.con". + +inline "cic:/CoRN/reals/RealFuncts/Intolr.con". + +inline "cic:/CoRN/reals/RealFuncts/Intol.con". + +inline "cic:/CoRN/reals/RealFuncts/Intcl.con". + +inline "cic:/CoRN/reals/RealFuncts/Intcr.con". + +(*#* The limit of [f(x)] as [x] goes to [p = l], for both unary and binary +functions: + +The limit of [f] in [p] is [l] if +[[ +forall e [>] Zero, exists d [>] Zero, forall (x : IR) +( [--]d [<] p[-]x [<] d) -> ( [--]e [<] [--]f(x) [<] e) +]] +*) + +inline "cic:/CoRN/reals/RealFuncts/funLim.con". + +(*#* The definition of limit of [f] in [p] using Cauchy sequences. *) + +inline "cic:/CoRN/reals/RealFuncts/funLim_Cauchy.con". + +(*#* The first definition implies the second one. *) + +(* + Ax_iom funLim_prop1 :(p,l:IR)(funLim p l)->(funLim_Cauchy p l). +Intros. Unfold funLim_Cauchy. Unfold funLim in H. Intros. +Elim (H e H1). Intros. +Elim s. Intros s_seq s_proof. +Decompose [and] H2. +Cut (Zero [<] x[/]TwoNZ). +Intro Hx2. +Elim (s_proof (x[/]TwoNZ) Hx2). +Intros N HN. +Exists N. +Intros. +Apply AbsSmall_minus. +Apply H5. +Generalize (HN m H3). +Intro HmN. +*) + +(*#* The limit of [f] in [(p,p')] is [l] if +[[ +forall e [>] Zero, exists d [>] Zero, forall (x : IR) +( [--]d [<] p[-]x [<] d) -> ( [--]d' [<] p'[-]y [<] d') -> ( [--]e [<] l[-]f(x,y) [<] e +]] +*) + +inline "cic:/CoRN/reals/RealFuncts/funLim2.con". + +(*#* The function [f] is continuous at [p] if the limit of [f(x)] as +[x] goes to [p] is [f(p)]. This is the [eps [/] delta] definition. +We also give the definition with limits of Cauchy sequences. +*) + +inline "cic:/CoRN/reals/RealFuncts/continAt.con". + +inline "cic:/CoRN/reals/RealFuncts/continAtCauchy.con". + +inline "cic:/CoRN/reals/RealFuncts/continAt2.con". + +(* +Ax_iom continAt_prop1 :(p:IR)(continAt p)->(continAtCauchy p). +*) + +inline "cic:/CoRN/reals/RealFuncts/contin.con". + +inline "cic:/CoRN/reals/RealFuncts/continCauchy.con". + +inline "cic:/CoRN/reals/RealFuncts/contin2.con". + +(*#* +Continuous on a closed, resp.%\% open, resp.%\% left open, resp.%\% left closed +interval *) + +inline "cic:/CoRN/reals/RealFuncts/continOnc.con". + +inline "cic:/CoRN/reals/RealFuncts/continOno.con". + +inline "cic:/CoRN/reals/RealFuncts/continOnol.con". + +inline "cic:/CoRN/reals/RealFuncts/continOncl.con". + +(* +Section Sequence_and_function_limits. + +_** +If $\lim_{x->p} (f x) = l$, then for every sequence $p_n$ whose +limit is $p$, $\lim_{n->\infty} f (p_n) =l$. + *_ + +Lemma funLim_SeqLimit: + (p,l:IR)(fl:(funLim p l)) + (pn:nat->IR)(sl:(SeqLimit pn p)) (SeqLimit ( [n:nat] (f (pn n))) l). +Proof. +Intros; Unfold seqLimit. +Intros eps epos. +Elim (fl ? epos); Intros del dh; Elim dh; Intros H0 H1. +Elim (sl ? H0); Intros N Nh. +Exists N. Intros m leNm. +Apply AbsSmall_minus. +Apply H1. +Apply AbsSmall_minus. +Apply (Nh ? leNm). +Qed. + +_**** Is the converse constructively provable? ** +Lemma SeqLimit_funLim: + (p,l:IR)((pn:nat->IR)(sl:(SeqLimit pn p)) (SeqLimit ( [n:nat] (f (pn n))) l))-> + (funLim p l). +****_ + +_** +Now the same Lemma in terms of Cauchy sequences: if $\lim_{x->p} (f x) = l$, +then for every Cauchy sequence $s_n$ whose +limit is $p$, $\lim_{n->\infty} f (s_n) =l$. + *_ + +Ax_iom funLim_isCauchy: + (p,l:IR)(funLim p l)->(s:CauchySeqR)((Lim s) [=] p)-> + (e:IR)(Zero [<] e)->(Ex [N:nat] (m:nat)(le N m) + ->(AbsSmall e ((s m) [-] (s N)))). + +End Sequence_and_function_limits. + +Section Monotonic_functions. + +Definition str_monot := (x,y:IR)(x [<] y)->((f x) [<] (f y)). + +Definition str_monotOnc := [a,b:IR] + (x,y:IR)(Intclr a b x)->(Intclr a b y) + ->(x [<] y)->((f x) [<] (f y)). + +Definition str_monotOncl := [a:IR] + (x,y:IR)(Intcl a x)->(Intcl a y) + ->(x [<] y)->((f x) [<] (f y)). + +Definition str_monotOnol := [a:IR] + (x,y:IR)(Intol a x)->(Intol a y) + ->(x [<] y)->((f x) [<] (f y)). + +_** Following probably not needed for the FTA proof; +it stated that strong monotonicity on a closed interval implies that the +intermediate value theorem holds on this interval. For FTA we need IVT on +$[0,\infty>$. +*_ + +Ax_iom strmonc_imp_ivt :(a,b:IR)(str_monotOnc a b) + ->(x,y:IR)(x [<] y)->(Intclr a b x)->(Intclr a b y) + ->((f x) [<] Zero)->(Zero [<] (f y)) + ->(EX z:IR | (Intclr x y z)/\((f z) [=] Zero)). +_** +$\forall c\in\RR (f\mbox{ strongly monotonic on }[c,\infty>) +\rightarrow \forall a,b\in\RR(c + (a,b:IR)(Intcl c a)->(Intcl c b)->((f a) [<] Zero)->(Zero [<] (f b)) + ->(x,y:IR)(Intclr a b x)->(Intclr a b y)->(x [<] y) + ->(EX z:IR | (Intclr x y z)/\((f z) [#] Zero)). + +_** The following is lemma 5.8 from the skeleton + +$\forall c\in\RR (f\mbox{ strongly monotonic on }[c,\infty>) +\rightarrow \forall a,b\in\RR(a(a,b:IR)(a [<] b)->(Intcl c a)->(Intcl c b) + ->((f a) [<] Zero)->(Zero [<] (f b)) + ->(EX z:IR | (Intclr a b z)/\ ((f z) [=] Zero)). +End Monotonic_functions. + +*) + +(* UNEXPORTED +End Continuity +*) + +(* begin hide *) + +(* UNEXPORTED +Set Strict Implicit. +*) + +(* UNEXPORTED +Unset Implicit Arguments. +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/reals/RealLists.ma b/matita/contribs/CoRN-Decl/reals/RealLists.ma new file mode 100644 index 000000000..322b20456 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/RealLists.ma @@ -0,0 +1,106 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/RealLists". + +include "CoRN.ma". + +(* $Id: RealLists.v,v 1.4 2004/04/23 10:01:05 lcf Exp $ *) + +include "reals/CReals1.ma". + +(* UNEXPORTED +Section Lists +*) + +(*#* * Lists of Real Numbers + +In some contexts we will need to work with nested existential quantified formulas of the form $\exists_{n\in\NN}\exists_{x_1,\ldots,x_n}P(x_1,\ldots,x_n)$#exists n exists x1,...,xn P(x1,..,xn)#. One way of formalizing this kind of statement is through quantifying over lists. In this file we provide some tools for manipulating lists. + +Notice that some of the properties listed below only make sense in the context within which we are working. Unlike in the other lemma files, no care has been taken here to state the lemmas in their most general form, as that would make them very unpractical to use. + +%\bigskip% + +We start by defining maximum and minimum of lists of reals and two membership predicates. The value of these functions for the empty list is arbitrarily set to 0, but it will be irrelevant, as we will never work with empty lists. +*) + +inline "cic:/CoRN/reals/RealLists/maxlist.con". + +inline "cic:/CoRN/reals/RealLists/minlist.con". + +inline "cic:/CoRN/reals/RealLists/member.con". + +(*#* +Sometimes the length of the list has to be restricted; the next definition provides an easy way to do that. *) + +inline "cic:/CoRN/reals/RealLists/length_leEq.con". + +(*#* Length is preserved by mapping. *) + +(* UNEXPORTED +Implicit Arguments map [A B]. +*) + +inline "cic:/CoRN/reals/RealLists/map_pres_length.con". + +(*#* +Often we want to map partial functions through a list; this next operator provides a way to do that, and is proved to be correct. *) + +(* UNEXPORTED +Implicit Arguments cons [A]. +*) + +inline "cic:/CoRN/reals/RealLists/map2.con". + +inline "cic:/CoRN/reals/RealLists/map2_wd.con". + +inline "cic:/CoRN/reals/RealLists/map2_pres_member.con". + +(*#* +As [maxlist] and [minlist] are generalizations of [Max] and [Min] to finite sets of real numbers, they have the expected properties: *) + +inline "cic:/CoRN/reals/RealLists/maxlist_greater.con". + +(* begin hide *) + +inline "cic:/CoRN/reals/RealLists/Lists/maxlist_aux.con" "Lists__". + +(* end hide *) + +inline "cic:/CoRN/reals/RealLists/maxlist_leEq_eps.con". + +inline "cic:/CoRN/reals/RealLists/maxlist_less.con". + +inline "cic:/CoRN/reals/RealLists/maxlist_leEq.con". + +inline "cic:/CoRN/reals/RealLists/minlist_smaller.con". + +(* begin hide *) + +inline "cic:/CoRN/reals/RealLists/Lists/minlist_aux.con" "Lists__". + +(* end hide *) + +inline "cic:/CoRN/reals/RealLists/minlist_leEq_eps.con". + +inline "cic:/CoRN/reals/RealLists/less_minlist.con". + +inline "cic:/CoRN/reals/RealLists/leEq_minlist.con". + +(* UNEXPORTED +End Lists +*) + diff --git a/matita/contribs/CoRN-Decl/reals/Series.ma b/matita/contribs/CoRN-Decl/reals/Series.ma new file mode 100644 index 000000000..40315e117 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/Series.ma @@ -0,0 +1,382 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/Series". + +include "CoRN.ma". + +(* $Id: Series.v,v 1.6 2004/04/23 10:01:05 lcf Exp $ *) + +(*#* printing seq_part_sum %\ensuremath{\sum^n}% #∑n# *) + +(*#* printing series_sum %\ensuremath{\sum_0^{\infty}}% #∑0# *) + +(*#* printing pi %\ensuremath{\pi}% #π *) + +include "reals/CSumsReals.ma". + +include "reals/NRootIR.ma". + +(* UNEXPORTED +Section Definitions +*) + +(*#* *Series of Real Numbers +In this file we develop a theory of series of real numbers. +** Definitions + +A series is simply a sequence from the natural numbers into the reals. +To each such sequence we can assign a sequence of partial sums. + +%\begin{convention}% Let [x:nat->IR]. +%\end{convention}% +*) + +alias id "x" = "cic:/CoRN/reals/Series/Definitions/x.var". + +inline "cic:/CoRN/reals/Series/seq_part_sum.con". + +(*#* +For subsequent purposes it will be very useful to be able to write the +difference between two arbitrary elements of the sequence of partial +sums as a sum of elements of the original sequence. +*) + +inline "cic:/CoRN/reals/Series/seq_part_sum_n.con". + +(*#* A series is convergent iff its sequence of partial Sums is a +Cauchy sequence. To each convergent series we can assign a Sum. +*) + +inline "cic:/CoRN/reals/Series/convergent.con". + +inline "cic:/CoRN/reals/Series/series_sum.con". + +(*#* Divergence can be characterized in a positive way, which will sometimes +be useful. We thus define divergence of sequences and series and prove the +obvious fact that no sequence can be both convergent and divergent, whether + considered either as a sequence or as a series. +*) + +inline "cic:/CoRN/reals/Series/divergent_seq.con". + +inline "cic:/CoRN/reals/Series/divergent.con". + +inline "cic:/CoRN/reals/Series/conv_imp_not_div.con". + +inline "cic:/CoRN/reals/Series/div_imp_not_conv.con". + +inline "cic:/CoRN/reals/Series/convergent_imp_not_divergent.con". + +inline "cic:/CoRN/reals/Series/divergent_imp_not_convergent.con". + +(*#* Finally we have the well known fact that every convergent series converges +to zero as a sequence. +*) + +inline "cic:/CoRN/reals/Series/series_seq_Lim.con". + +inline "cic:/CoRN/reals/Series/series_seq_Lim'.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Section More_Definitions +*) + +alias id "x" = "cic:/CoRN/reals/Series/More_Definitions/x.var". + +(*#* We also define absolute convergence. *) + +inline "cic:/CoRN/reals/Series/abs_convergent.con". + +(* UNEXPORTED +End More_Definitions +*) + +(* UNEXPORTED +Section Power_Series +*) + +(*#* **Power Series + +Power series are an important special case. +*) + +inline "cic:/CoRN/reals/Series/power_series.con". + +(*#* +Specially important is the case when [c] is a positive real number +less than 1; in this case not only the power series is convergent, but +we can also compute its sum. + +%\begin{convention}% Let [c] be a real number between 0 and 1. +%\end{convention}% +*) + +alias id "c" = "cic:/CoRN/reals/Series/Power_Series/c.var". + +alias id "H0c" = "cic:/CoRN/reals/Series/Power_Series/H0c.var". + +alias id "Hc1" = "cic:/CoRN/reals/Series/Power_Series/Hc1.var". + +inline "cic:/CoRN/reals/Series/c_exp_Lim.con". + +inline "cic:/CoRN/reals/Series/power_series_Lim1.con". + +inline "cic:/CoRN/reals/Series/power_series_conv.con". + +inline "cic:/CoRN/reals/Series/power_series_sum.con". + +(* UNEXPORTED +End Power_Series +*) + +(* UNEXPORTED +Section Operations +*) + +(*#* **Operations + +Some operations with series preserve convergence. We start by defining +the series that is zero everywhere. +*) + +inline "cic:/CoRN/reals/Series/conv_zero_series.con". + +inline "cic:/CoRN/reals/Series/series_sum_zero.con". + +(*#* Next we consider extensionality, as well as the sum and difference +of two convergent series. + +%\begin{convention}% Let [x,y:nat->IR] be convergent series. +%\end{convention}% +*) + +alias id "x" = "cic:/CoRN/reals/Series/Operations/x.var". + +alias id "y" = "cic:/CoRN/reals/Series/Operations/y.var". + +alias id "convX" = "cic:/CoRN/reals/Series/Operations/convX.var". + +alias id "convY" = "cic:/CoRN/reals/Series/Operations/convY.var". + +inline "cic:/CoRN/reals/Series/convergent_wd.con". + +inline "cic:/CoRN/reals/Series/series_sum_wd.con". + +inline "cic:/CoRN/reals/Series/conv_series_plus.con". + +inline "cic:/CoRN/reals/Series/series_sum_plus.con". + +inline "cic:/CoRN/reals/Series/conv_series_minus.con". + +inline "cic:/CoRN/reals/Series/series_sum_minus.con". + +(*#* Multiplication by a scalar [c] is also permitted. *) + +alias id "c" = "cic:/CoRN/reals/Series/Operations/c.var". + +inline "cic:/CoRN/reals/Series/conv_series_mult_scal.con". + +inline "cic:/CoRN/reals/Series/series_sum_mult_scal.con". + +(* UNEXPORTED +End Operations +*) + +(* UNEXPORTED +Section More_Operations +*) + +alias id "x" = "cic:/CoRN/reals/Series/More_Operations/x.var". + +alias id "convX" = "cic:/CoRN/reals/Series/More_Operations/convX.var". + +(*#* As a corollary, we get the series of the inverses. *) + +inline "cic:/CoRN/reals/Series/conv_series_inv.con". + +inline "cic:/CoRN/reals/Series/series_sum_inv.con". + +(* UNEXPORTED +End More_Operations +*) + +(* UNEXPORTED +Section Almost_Everywhere +*) + +(*#* ** Almost Everywhere + +In this section we strengthen some of the convergence results for sequences +and derive an important corollary for series. + +Let [x,y : nat->IR] be equal after some natural number. +*) + +alias id "x" = "cic:/CoRN/reals/Series/Almost_Everywhere/x.var". + +alias id "y" = "cic:/CoRN/reals/Series/Almost_Everywhere/y.var". + +inline "cic:/CoRN/reals/Series/aew_eq.con". + +alias id "aew_equal" = "cic:/CoRN/reals/Series/Almost_Everywhere/aew_equal.var". + +inline "cic:/CoRN/reals/Series/aew_Cauchy.con". + +inline "cic:/CoRN/reals/Series/aew_Cauchy2.con". + +inline "cic:/CoRN/reals/Series/aew_series_conv.con". + +(* UNEXPORTED +End Almost_Everywhere +*) + +(* UNEXPORTED +Section Cauchy_Almost_Everywhere +*) + +(*#* Suppose furthermore that [x,y] are Cauchy sequences. *) + +alias id "x" = "cic:/CoRN/reals/Series/Cauchy_Almost_Everywhere/x.var". + +alias id "y" = "cic:/CoRN/reals/Series/Cauchy_Almost_Everywhere/y.var". + +alias id "aew_equal" = "cic:/CoRN/reals/Series/Cauchy_Almost_Everywhere/aew_equal.var". + +inline "cic:/CoRN/reals/Series/aew_Lim.con". + +(* UNEXPORTED +End Cauchy_Almost_Everywhere +*) + +(* UNEXPORTED +Section Convergence_Criteria +*) + +(*#* **Convergence Criteria + +%\begin{convention}% Let [x:nat->IR]. +%\end{convention}% +*) + +alias id "x" = "cic:/CoRN/reals/Series/Convergence_Criteria/x.var". + +(*#* We include the comparison test for series, both in a strong and in a less +general (but simpler) form. +*) + +inline "cic:/CoRN/reals/Series/str_comparison.con". + +inline "cic:/CoRN/reals/Series/comparison.con". + +(*#* As a corollary, we get that every absolutely convergent series converges. *) + +inline "cic:/CoRN/reals/Series/abs_imp_conv.con". + +(*#* Next we have the ratio test, both as a positive and negative result. *) + +inline "cic:/CoRN/reals/Series/divergent_crit.con". + +inline "cic:/CoRN/reals/Series/tail_series.con". + +inline "cic:/CoRN/reals/Series/join_series.con". + +(* UNEXPORTED +End Convergence_Criteria +*) + +(* UNEXPORTED +Section More_CC +*) + +alias id "x" = "cic:/CoRN/reals/Series/More_CC/x.var". + +inline "cic:/CoRN/reals/Series/ratio_test_conv.con". + +inline "cic:/CoRN/reals/Series/ratio_test_div.con". + +(* UNEXPORTED +End More_CC +*) + +(* UNEXPORTED +Section Alternate_Series +*) + +(*#* **Alternate Series + +Alternate series are a special case. Suppose that [x] is nonnegative and +decreasing convergent to 0. +*) + +alias id "x" = "cic:/CoRN/reals/Series/Alternate_Series/x.var". + +alias id "pos_x" = "cic:/CoRN/reals/Series/Alternate_Series/pos_x.var". + +alias id "Lim_x" = "cic:/CoRN/reals/Series/Alternate_Series/Lim_x.var". + +alias id "mon_x" = "cic:/CoRN/reals/Series/Alternate_Series/mon_x.var". + +(* begin hide *) + +inline "cic:/CoRN/reals/Series/Alternate_Series/y.con" "Alternate_Series__". + +inline "cic:/CoRN/reals/Series/Alternate_Series/alternate_lemma1.con" "Alternate_Series__". + +inline "cic:/CoRN/reals/Series/Alternate_Series/alternate_lemma2.con" "Alternate_Series__". + +inline "cic:/CoRN/reals/Series/Alternate_Series/alternate_lemma3.con" "Alternate_Series__". + +inline "cic:/CoRN/reals/Series/Alternate_Series/alternate_lemma4.con" "Alternate_Series__". + +(* end hide *) + +inline "cic:/CoRN/reals/Series/alternate_series_conv.con". + +(* UNEXPORTED +End Alternate_Series +*) + +(* UNEXPORTED +Section Important_Numbers +*) + +(*#* **Important Numbers + +We end this chapter by defining two important numbers in mathematics: [pi] +and $e$#e#, both as sums of convergent series. +*) + +inline "cic:/CoRN/reals/Series/e_series.con". + +inline "cic:/CoRN/reals/Series/e_series_conv.con". + +inline "cic:/CoRN/reals/Series/E.con". + +inline "cic:/CoRN/reals/Series/pi_series.con". + +inline "cic:/CoRN/reals/Series/pi_series_conv.con". + +inline "cic:/CoRN/reals/Series/pi.con". + +(* UNEXPORTED +End Important_Numbers +*) + diff --git a/matita/contribs/CoRN-Decl/reals/iso_CReals.ma b/matita/contribs/CoRN-Decl/reals/iso_CReals.ma new file mode 100644 index 000000000..40fc12b20 --- /dev/null +++ b/matita/contribs/CoRN-Decl/reals/iso_CReals.ma @@ -0,0 +1,125 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/reals/iso_CReals". + +include "CoRN.ma". + +(* begin hide *) + +(* in this file the concrete canonical isomorphism -in te sense of + R_morphisms.v - between two arbitrary model of real numbers is built *) + +include "reals/Q_dense.ma". + +include "reals/R_morphism.ma". + +inline "cic:/CoRN/reals/iso_CReals/less_pres_Lim.con". + +inline "cic:/CoRN/reals/iso_CReals/Lim_pres_less.con". + +inline "cic:/CoRN/reals/iso_CReals/inj_seq_less.con". + +inline "cic:/CoRN/reals/iso_CReals/less_inj_seq.con". + +inline "cic:/CoRN/reals/iso_CReals/SeqLimit_unique.con". + +inline "cic:/CoRN/reals/iso_CReals/Lim_well_def.con". + +inline "cic:/CoRN/reals/iso_CReals/Lim_one_one.con". + +inline "cic:/CoRN/reals/iso_CReals/inj_seq_well_def.con". + +inline "cic:/CoRN/reals/iso_CReals/inj_Q_one_one.con". + +inline "cic:/CoRN/reals/iso_CReals/Lim_pres_plus.con". + +inline "cic:/CoRN/reals/iso_CReals/G_pres_plus.con". + +(* This theorem can be avoided but it is interesting *) + +inline "cic:/CoRN/reals/iso_CReals/nonarchemaedian_bound_for_Lim.con". + +inline "cic:/CoRN/reals/iso_CReals/Lim_pres_mult.con". + +inline "cic:/CoRN/reals/iso_CReals/G_pres_mult.con". + +(* UNEXPORTED +Section Concrete_iso_between_Creals +*) + +alias id "R1" = "cic:/CoRN/reals/iso_CReals/Concrete_iso_between_Creals/R1.var". + +alias id "R2" = "cic:/CoRN/reals/iso_CReals/Concrete_iso_between_Creals/R2.var". + +inline "cic:/CoRN/reals/iso_CReals/image_Cauchy12.con". + +inline "cic:/CoRN/reals/iso_CReals/image_Cauchy21.con". + +inline "cic:/CoRN/reals/iso_CReals/image_G_as_CauchySeq12.con". + +inline "cic:/CoRN/reals/iso_CReals/image_G_as_CauchySeq21.con". + +inline "cic:/CoRN/reals/iso_CReals/f12.con". + +inline "cic:/CoRN/reals/iso_CReals/g21.con". + +(*#****** ISO FROM R1 TO R2 ********) + +inline "cic:/CoRN/reals/iso_CReals/f12_is_inverse_g21.con". + +inline "cic:/CoRN/reals/iso_CReals/f12_is_surjective.con". + +inline "cic:/CoRN/reals/iso_CReals/f12_strong_ext.con". + +inline "cic:/CoRN/reals/iso_CReals/f12_pres_less.con". + +inline "cic:/CoRN/reals/iso_CReals/f12_pres_plus.con". + +inline "cic:/CoRN/reals/iso_CReals/f12_pres_mult.con". + +(*#********* ISO FROM R2 TO R1 **********) + +inline "cic:/CoRN/reals/iso_CReals/g21_is_inverse_f12.con". + +inline "cic:/CoRN/reals/iso_CReals/g21_is_surjective.con". + +inline "cic:/CoRN/reals/iso_CReals/g21_strong_ext.con". + +inline "cic:/CoRN/reals/iso_CReals/g21_pres_less.con". + +inline "cic:/CoRN/reals/iso_CReals/g21_pres_plus.con". + +inline "cic:/CoRN/reals/iso_CReals/g21_pres_mult.con". + +(*#** Building Homomorphisms out of f12 and g21 ***) + +inline "cic:/CoRN/reals/iso_CReals/f12_as_Homomorphism.con". + +inline "cic:/CoRN/reals/iso_CReals/g21_as_Homomorphism.con". + +inline "cic:/CoRN/reals/iso_CReals/f12_inverse_lft.con". + +inline "cic:/CoRN/reals/iso_CReals/g21_inverse_rht.con". + +inline "cic:/CoRN/reals/iso_CReals/Canonic_Isomorphism_between_CReals.con". + +(* UNEXPORTED +End Concrete_iso_between_Creals +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/tactics/AlgReflection.ma b/matita/contribs/CoRN-Decl/tactics/AlgReflection.ma new file mode 100644 index 000000000..51ba402fa --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/AlgReflection.ma @@ -0,0 +1,132 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/AlgReflection". + +include "CoRN.ma". + +(* $Id: AlgReflection.v,v 1.2 2004/03/26 16:07:03 lcf Exp $ *) + +(* begin hide *) + +include "algebra/CLogic.ma". + +(* UNEXPORTED +Section Syntactic_Expressions +*) + +inline "cic:/CoRN/tactics/AlgReflection/varindex.con". + +inline "cic:/CoRN/tactics/AlgReflection/pfunindex.con". + +inline "cic:/CoRN/tactics/AlgReflection/unopindex.con". + +inline "cic:/CoRN/tactics/AlgReflection/binopindex.con". + +inline "cic:/CoRN/tactics/AlgReflection/expr.ind". + +inline "cic:/CoRN/tactics/AlgReflection/expr_zero.con". + +inline "cic:/CoRN/tactics/AlgReflection/expr_one.con". + +inline "cic:/CoRN/tactics/AlgReflection/expr_nat.con". + +inline "cic:/CoRN/tactics/AlgReflection/expr_inv.con". + +inline "cic:/CoRN/tactics/AlgReflection/expr_minus.con". + +inline "cic:/CoRN/tactics/AlgReflection/expr_power.con". + +(* UNEXPORTED +End Syntactic_Expressions +*) + +(* UNEXPORTED +Section Normalization_Function +*) + +inline "cic:/CoRN/tactics/AlgReflection/eq_nat.con". + +inline "cic:/CoRN/tactics/AlgReflection/lt_nat.con". + +inline "cic:/CoRN/tactics/AlgReflection/le_nat.con". + +inline "cic:/CoRN/tactics/AlgReflection/eq_int.con". + +inline "cic:/CoRN/tactics/AlgReflection/lt_int.con". + +inline "cic:/CoRN/tactics/AlgReflection/le_int.con". + +inline "cic:/CoRN/tactics/AlgReflection/eq_expr.con". + +inline "cic:/CoRN/tactics/AlgReflection/lt_expr.con". + +inline "cic:/CoRN/tactics/AlgReflection/le_expr.con". + +inline "cic:/CoRN/tactics/AlgReflection/eq_monom.con". + +inline "cic:/CoRN/tactics/AlgReflection/lt_monom.con". + +inline "cic:/CoRN/tactics/AlgReflection/MI_mult.con". + +inline "cic:/CoRN/tactics/AlgReflection/MV_mult.con". + +inline "cic:/CoRN/tactics/AlgReflection/MM_mult.con". + +inline "cic:/CoRN/tactics/AlgReflection/MM_plus.con". + +inline "cic:/CoRN/tactics/AlgReflection/PM_plus.con". + +inline "cic:/CoRN/tactics/AlgReflection/PP_plus.con". + +inline "cic:/CoRN/tactics/AlgReflection/PM_mult.con". + +inline "cic:/CoRN/tactics/AlgReflection/PP_mult.con". + +inline "cic:/CoRN/tactics/AlgReflection/FF_plus.con". + +inline "cic:/CoRN/tactics/AlgReflection/FF_mult.con". + +inline "cic:/CoRN/tactics/AlgReflection/FF_div.con". + +inline "cic:/CoRN/tactics/AlgReflection/NormR.con". + +inline "cic:/CoRN/tactics/AlgReflection/NormG.con". + +inline "cic:/CoRN/tactics/AlgReflection/NormF.con". + +inline "cic:/CoRN/tactics/AlgReflection/expr_is_zero.con". + +(* UNEXPORTED +End Normalization_Function +*) + +(* UNEXPORTED +Section Correctness_Results +*) + +inline "cic:/CoRN/tactics/AlgReflection/eq_nat_corr.con". + +inline "cic:/CoRN/tactics/AlgReflection/eq_int_corr.con". + +inline "cic:/CoRN/tactics/AlgReflection/eq_expr_corr.con". + +(* UNEXPORTED +End Correctness_Results +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/tactics/DiffTactics1.ma b/matita/contribs/CoRN-Decl/tactics/DiffTactics1.ma new file mode 100644 index 000000000..a0457f8f7 --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/DiffTactics1.ma @@ -0,0 +1,41 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/DiffTactics1". + +include "CoRN.ma". + +(* begin hide *) + +(* UNEXPORTED +Ltac Contin := auto with continuous included. +*) + +(* UNEXPORTED +Ltac Deriv := eauto with derivate continuous included. +*) + +(* end hide *) + +(*#* *Search tactics for reasoning in Real Analysis + +The following tactics are defined: + - [Contin] will solve [(Continuous_I H F)] + - [Deriv] will solve [(Derivative_I H F F')]. + +All these tactics are defined using [eauto]. +*) + diff --git a/matita/contribs/CoRN-Decl/tactics/DiffTactics2.ma b/matita/contribs/CoRN-Decl/tactics/DiffTactics2.ma new file mode 100644 index 000000000..6a3212bf9 --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/DiffTactics2.ma @@ -0,0 +1,236 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/DiffTactics2". + +include "CoRN.ma". + +(* $Id: DiffTactics2.v,v 1.1.1.1 2004/02/05 16:25:45 lionelm Exp $ *) + +(* begin hide *) + +include "ftc/Differentiability.ma". + +(* UNEXPORTED +Section Automatizing_Continuity +*) + +alias id "a" = "cic:/CoRN/tactics/DiffTactics2/Automatizing_Continuity/a.var". + +alias id "b" = "cic:/CoRN/tactics/DiffTactics2/Automatizing_Continuity/b.var". + +inline "cic:/CoRN/tactics/DiffTactics2/cont_function.ind". + +inline "cic:/CoRN/tactics/DiffTactics2/cont_to_pfunct.con". + +inline "cic:/CoRN/tactics/DiffTactics2/continuous_cont.con". + +(* UNEXPORTED +End Automatizing_Continuity +*) + +(* UNEXPORTED +Ltac pfunct_to_cont a b f := + match constr:f with + | ([-C-]?X3) => constr:(cconst a b X3) + | FId => constr:(cid a b) + | (?X3{+}?X4) => + let t1 := pfunct_to_cont a b X3 with t2 := pfunct_to_cont a b X4 in + constr:(cplus a b t1 t2) + | ({--}?X3) => + let t1 := pfunct_to_cont a b X3 in + constr:(cinv a b t1) + | (?X3{-}?X4) => + let t1 := pfunct_to_cont a b X3 with t2 := pfunct_to_cont a b X4 in + constr:(cminus a b t1 t2) + | (?X3{*}?X4) => + let t1 := pfunct_to_cont a b X3 with t2 := pfunct_to_cont a b X4 in + constr:(cmult a b t1 t2) + | (?X3{**}?X4) => + let t := pfunct_to_cont a b X4 in + constr:(cscalmult a b X3 t) + | (?X3{^}?X4) => + let t1 := pfunct_to_cont a b X3 in + constr:(cnth a b t1 X4) + | (FAbs ?X3) => let t1 := pfunct_to_cont a b X3 in + constr:(cabs a b t1) + | ?X3 => + let t := constr:X3 in + match goal with + | Hab:_,H:(Continuous_I (a:=a) (b:=b) ?X1 t) |- _ => + constr:(hyp_c a b X1 t H) + | H:(Derivative_I (a:=a) (b:=b) ?X1 t ?X4) |- _ => + constr:(hyp_d a b X1 t X4 H) + | H:(Derivative_I (a:=a) (b:=b) ?X1 ?X4 t) |- _ => + constr:(hyp_d' a b X1 X4 t H) + | H:(Diffble_I (a:=a) (b:=b) ?X1 t) |- _ => + constr:(hyp_diff a b X1 t H) + end + end. +*) + +(* UNEXPORTED +Ltac New_Contin := + match goal with + | |- (Continuous_I (a:=?X1) (b:=?X2) ?X4 ?X3) => + let r := pfunct_to_cont X1 X2 X3 in + let a := constr:X1 in + let b := constr:X2 in + (apply Continuous_I_wd with (cont_to_pfunct a b r); + [ unfold cont_to_pfunct in |- * | apply continuous_cont ]) + end. +*) + +(* UNEXPORTED +Section Automatizing_Derivatives +*) + +alias id "a" = "cic:/CoRN/tactics/DiffTactics2/Automatizing_Derivatives/a.var". + +alias id "b" = "cic:/CoRN/tactics/DiffTactics2/Automatizing_Derivatives/b.var". + +inline "cic:/CoRN/tactics/DiffTactics2/deriv_function.ind". + +inline "cic:/CoRN/tactics/DiffTactics2/deriv_to_pfunct.con". + +inline "cic:/CoRN/tactics/DiffTactics2/deriv_deriv.con". + +inline "cic:/CoRN/tactics/DiffTactics2/deriv_restr.con". + +inline "cic:/CoRN/tactics/DiffTactics2/diffble_restr.con". + +(* UNEXPORTED +End Automatizing_Derivatives +*) + +(* UNEXPORTED +Ltac pfunct_to_restr a b f := + match constr:f with + | ([-C-]?X3) => constr:(const a b X3) + | FId => constr:(id a b) + | (?X3{+}?X4) => + let t1 := pfunct_to_restr a b X3 with t2 := pfunct_to_restr a b X4 in + constr:(rplus a b t1 t2) + | ({--}?X3) => + let t1 := pfunct_to_restr a b X3 in + constr:(rinv a b t1) + | (?X3{-}?X4) => + let t1 := pfunct_to_restr a b X3 with t2 := pfunct_to_restr a b X4 in + constr:(rminus a b t1 t2) + | (?X3{*}?X4) => + let t1 := pfunct_to_restr a b X3 with t2 := pfunct_to_restr a b X4 in + constr:(rmult a b t1 t2) + | (?X3{**}?X4) => + let t := pfunct_to_restr a b X4 in + constr:(rscalmult a b X3 t) + | (?X3{^}?X4) => + let t1 := pfunct_to_restr a b X3 in + constr:(rnth a b t1 X4) + | ?X3 => + let t := constr:X3 in + match goal with + | H:(Derivative_I (a:=a) (b:=b) ?X1 t ?X4) |- _ => + constr:(hyp a b X1 t X4 H) + | H:(Diffble_I (a:=a) (b:=b) ?X1 t) |- _ => constr:( + hyp' a b X1 t H) + end + end. +*) + +(* UNEXPORTED +Ltac New_Deriv := + match goal with + | |- (Derivative_I (a:=?X1) (b:=?X2) _ ?X3 ?X4) => + let r := pfunct_to_restr X1 X2 X3 in + (apply Derivative_I_wdl with (deriv_to_pfunct X1 X2 r); + [ unfold deriv_to_pfunct in |- * + | apply Derivative_I_wdr with (deriv_deriv X1 X2 r); + [ unfold deriv_deriv, deriv_to_pfunct in |- * + | apply deriv_restr ] ]) + end. +*) + +(* UNEXPORTED +Ltac Differentiate := + match goal with + | |- (Diffble_I (a:=?X1) (b:=?X2) _ ?X3) => + let r := pfunct_to_restr X1 X2 X3 in + (apply Diffble_I_wd with (deriv_to_pfunct X1 X2 r); + [ apply diffble_restr | unfold deriv_deriv, deriv_to_pfunct in |- * ]) + end. +*) + +(* UNEXPORTED +Ltac derivative_of f := + match constr:f with + | ([-C-]?X3) => constr:([-C-]ZeroR) + | FId => constr:([-C-]OneR) + | (?X3{+}?X4) => + let t1 := derivative_of X3 with t2 := derivative_of X4 in + constr:(t1{+}t2) + | ({--}?X3) => let t1 := derivative_of X3 in + constr:({--}t1) + | (?X3{-}?X4) => + let t1 := derivative_of X3 with t2 := derivative_of X4 in + constr:(t1{-}t2) + | (?X3{*}?X4) => + let t1 := derivative_of X3 + with t2 := derivative_of X4 + with t3 := constr:X3 + with t4 := constr:X4 in + constr:(t3{*}t2{+}t1{*}t4) + | (?X3{**}?X4) => + let t1 := derivative_of X4 with t2 := constr:X3 in + constr:(t2{**}t1) + | (?X3{^}0) => constr:([-C-]ZeroR) + | (?X3{^}S ?X4) => + let t1 := derivative_of X3 with t2 := constr:X3 with t3 := constr:X4 in + constr:(nring _ (S t3){**}(t1{*}t2{^}t3)) + | ({1/}?X3) => + let t1 := derivative_of X3 with t2 := constr:X3 in + constr:({--}(t1{/}t2{*}t2)) + | (?X3{/}?X4) => + let t1 := derivative_of X3 + with t2 := derivative_of X4 + with t3 := constr:X3 + with t4 := constr:X4 in + constr:((t1{*}t4{-}t3{*}t2){/}t4{*}t4) + | (?X3[o]?X4) => + let t1 := derivative_of X3 + with t2 := derivative_of X4 + with t3 := constr:X3 in + constr:((t3[o]t2){*}t1) + | ?X3 => + let t := constr:X3 in + match goal with + | H:(Derivative_I (b:=t) ?X4) |- _ => + let t1 := constr:X4 in + constr:t1 + end + end. +*) + +(* UNEXPORTED +Ltac Deriv_I_substR := + match goal with + | |- (Derivative_I _ ?X1 _) => + let t := derivative_of X1 in + apply Derivative_I_wdr with t + end. +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/tactics/DiffTactics3.ma b/matita/contribs/CoRN-Decl/tactics/DiffTactics3.ma new file mode 100644 index 000000000..11c2e5504 --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/DiffTactics3.ma @@ -0,0 +1,106 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/DiffTactics3". + +include "CoRN.ma". + +(* $Id: DiffTactics3.v,v 1.1.1.1 2004/02/05 16:25:44 lionelm Exp $ *) + +(* begin hide *) + +include "ftc/MoreFunSeries.ma". + +include "ftc/Composition.ma". + +include "tactics/DiffTactics2.ma". + +(* UNEXPORTED +Ltac Deriv_substR := + match goal with + | |- (Derivative ?X1 _) => + let t := derivative_of X1 in + apply Derivative_wdr with t + end. +*) + +inline "cic:/CoRN/tactics/DiffTactics3/symbPF.ind". + +(* + | ssum0 : nat->(nat->symbPF)->symbPF + | ssumx : (n:nat)((i:nat)(lt i n)->symbPF)->symbPF + | ssum : nat->nat->(nat->symbPF)->symbPF +*) + +inline "cic:/CoRN/tactics/DiffTactics3/symb_to_PartIR.con". + +inline "cic:/CoRN/tactics/DiffTactics3/symbPF_deriv.con". + +(* UNEXPORTED +Ltac PartIR_to_symbPF f := + match constr:f with + | ([-C-]?X3) => constr:(sconst X3) + | FId => constr:sid + | (?X3{+}?X4) => + let t1 := PartIR_to_symbPF X3 with t2 := PartIR_to_symbPF X4 in + constr:(splus t1 t2) + | ({--}?X3) => + let t1 := PartIR_to_symbPF X3 in + constr:(sinv t1) + | (?X3{-}?X4) => + let t1 := PartIR_to_symbPF X3 with t2 := PartIR_to_symbPF X4 in + constr:(sminus t1 t2) + | (?X3{*}?X4) => + let t1 := PartIR_to_symbPF X3 with t2 := PartIR_to_symbPF X4 in + constr:(smult t1 t2) + | (?X3{**}?X4) => + let t := PartIR_to_symbPF X4 in + constr:(sscalmult X3 t) + | (?X3{^}?X4) => + let t1 := PartIR_to_symbPF X3 in + constr:(snth t1 X4) + | ({1/}?X3) => + let t1 := PartIR_to_symbPF X3 in + constr:(srecip t1) + | (?X3{/}?X4) => + let t1 := PartIR_to_symbPF X3 with t2 := PartIR_to_symbPF X4 in + constr:(sdiv t1 t2) + | (?X3[o]?X4) => + let t1 := PartIR_to_symbPF X3 with t2 := PartIR_to_symbPF X4 in + constr:(scomp t1 t2) + | ?X3 => + let t := constr:X3 in + match goal with + | H:(Derivative ?X1 ?X2 t ?X4) |- _ => + constr:(shyp X1 X2 t X4 H) + | H:(Diffble ?X1 ?X2 t) |- _ => constr:(shyp' X1 X2 t H) + end + end. +*) + +(* UNEXPORTED +Ltac Derivative_Help := + match goal with + | |- (Derivative ?X1 ?X2 ?X3 ?X4) => + let r := PartIR_to_symbPF X3 in + (apply Derivative_wdr with (symbPF_deriv r); + [ unfold symbPF_deriv, symb_to_PartIR in |- * + | simpl in |- *; Deriv ]) + end. +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/tactics/FieldReflection.ma b/matita/contribs/CoRN-Decl/tactics/FieldReflection.ma new file mode 100644 index 000000000..a3041e0e6 --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/FieldReflection.ma @@ -0,0 +1,218 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/FieldReflection". + +include "CoRN.ma". + +(* $Id: FieldReflection.v,v 1.4 2004/04/23 10:01:06 lcf Exp $ *) + +(* begin hide *) + +include "algebra/CFields.ma". + +include "tactics/AlgReflection.ma". + +(* UNEXPORTED +Section Field_Interpretation_Function +*) + +alias id "F" = "cic:/CoRN/tactics/FieldReflection/Field_Interpretation_Function/F.var". + +alias id "val" = "cic:/CoRN/tactics/FieldReflection/Field_Interpretation_Function/val.var". + +alias id "unop" = "cic:/CoRN/tactics/FieldReflection/Field_Interpretation_Function/unop.var". + +alias id "binop" = "cic:/CoRN/tactics/FieldReflection/Field_Interpretation_Function/binop.var". + +alias id "pfun" = "cic:/CoRN/tactics/FieldReflection/Field_Interpretation_Function/pfun.var". + +inline "cic:/CoRN/tactics/FieldReflection/interpF.ind". + +inline "cic:/CoRN/tactics/FieldReflection/wfF.con". + +inline "cic:/CoRN/tactics/FieldReflection/xexprF.ind". + +inline "cic:/CoRN/tactics/FieldReflection/xforgetF.con". + +inline "cic:/CoRN/tactics/FieldReflection/xinterpF.con". + +inline "cic:/CoRN/tactics/FieldReflection/xexprF2interpF.con". + +inline "cic:/CoRN/tactics/FieldReflection/xexprF_diagram_commutes.con". + +inline "cic:/CoRN/tactics/FieldReflection/xexprF2wfF.con". + +inline "cic:/CoRN/tactics/FieldReflection/fexprF.ind". + +inline "cic:/CoRN/tactics/FieldReflection/fexprF_var.con". + +inline "cic:/CoRN/tactics/FieldReflection/fexprF_int.con". + +inline "cic:/CoRN/tactics/FieldReflection/fexprF_plus.con". + +inline "cic:/CoRN/tactics/FieldReflection/fexprF_mult.con". + +inline "cic:/CoRN/tactics/FieldReflection/fforgetF.con". + +inline "cic:/CoRN/tactics/FieldReflection/fexprF2interpF.con". + +inline "cic:/CoRN/tactics/FieldReflection/fexprF2wfF.con". + +include "tactics/Opaque_algebra.ma". + +inline "cic:/CoRN/tactics/FieldReflection/refl_interpF.con". + +inline "cic:/CoRN/tactics/FieldReflection/interpF_wd.con". + +(* UNEXPORTED +End Field_Interpretation_Function +*) + +(* UNEXPORTED +Section Field_NormCorrect +*) + +alias id "F" = "cic:/CoRN/tactics/FieldReflection/Field_NormCorrect/F.var". + +alias id "val" = "cic:/CoRN/tactics/FieldReflection/Field_NormCorrect/val.var". + +alias id "unop" = "cic:/CoRN/tactics/FieldReflection/Field_NormCorrect/unop.var". + +alias id "binop" = "cic:/CoRN/tactics/FieldReflection/Field_NormCorrect/binop.var". + +alias id "pfun" = "cic:/CoRN/tactics/FieldReflection/Field_NormCorrect/pfun.var". + +(* NOTATION +Notation II := (interpF F val unop binop pfun). +*) + +(* +four kinds of exprs: + + I (expr_int _) + V (expr_var _) + M (expr_mult V M) + I + P (expr_plus M P) + I + +M: sorted on V +P: sorted on M, all M's not an I +*) + +(* UNEXPORTED +Opaque Zmult. +*) + +inline "cic:/CoRN/tactics/FieldReflection/MI_mult_corr_F.con". + +(* UNEXPORTED +Transparent Zmult. +*) + +(* UNEXPORTED +Opaque MI_mult. +*) + +inline "cic:/CoRN/tactics/FieldReflection/MV_mult_corr_F.con". + +(* UNEXPORTED +Transparent MI_mult. +*) + +(* UNEXPORTED +Opaque MV_mult MI_mult. +*) + +inline "cic:/CoRN/tactics/FieldReflection/MM_mult_corr_F.con". + +(* UNEXPORTED +Transparent MV_mult MI_mult. +*) + +(* UNEXPORTED +Opaque MV_mult. +*) + +inline "cic:/CoRN/tactics/FieldReflection/MM_plus_corr_F.con". + +(* UNEXPORTED +Transparent MV_mult. +*) + +(* UNEXPORTED +Opaque MM_plus. +*) + +inline "cic:/CoRN/tactics/FieldReflection/PM_plus_corr_F.con". + +(* UNEXPORTED +Transparent MM_plus. +*) + +(* UNEXPORTED +Opaque PM_plus. +*) + +inline "cic:/CoRN/tactics/FieldReflection/PP_plus_corr_F.con". + +(* UNEXPORTED +Transparent PM_plus. +*) + +(* UNEXPORTED +Opaque PM_plus MM_mult MI_mult. +*) + +inline "cic:/CoRN/tactics/FieldReflection/PM_mult_corr_F.con". + +(* UNEXPORTED +Opaque PM_mult. +*) + +inline "cic:/CoRN/tactics/FieldReflection/PP_mult_corr_F.con". + +(* UNEXPORTED +Transparent PP_plus PM_mult PP_mult PM_plus MI_mult. +*) + +inline "cic:/CoRN/tactics/FieldReflection/FF_plus_corr_F.con". + +inline "cic:/CoRN/tactics/FieldReflection/FF_mult_corr_F.con". + +(* UNEXPORTED +Transparent FF_div. +*) + +inline "cic:/CoRN/tactics/FieldReflection/FF_div_corr_F.con". + +inline "cic:/CoRN/tactics/FieldReflection/NormF_corr.con". + +inline "cic:/CoRN/tactics/FieldReflection/Norm_wfF.con". + +inline "cic:/CoRN/tactics/FieldReflection/expr_is_zero_corr_F.con". + +inline "cic:/CoRN/tactics/FieldReflection/Tactic_lemma_zero_F.con". + +inline "cic:/CoRN/tactics/FieldReflection/Tactic_lemmaF.con". + +(* UNEXPORTED +End Field_NormCorrect +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/tactics/GroupReflection.ma b/matita/contribs/CoRN-Decl/tactics/GroupReflection.ma new file mode 100644 index 000000000..e47a4cf2e --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/GroupReflection.ma @@ -0,0 +1,246 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/GroupReflection". + +include "CoRN.ma". + +(* $Id: GroupReflection.v,v 1.3 2004/04/23 10:01:06 lcf Exp $ *) + +(* begin hide *) + +include "algebra/CAbGroups.ma". + +include "tactics/AlgReflection.ma". + +(* UNEXPORTED +Section Group_Interpretation_Function +*) + +alias id "G" = "cic:/CoRN/tactics/GroupReflection/Group_Interpretation_Function/G.var". + +alias id "val" = "cic:/CoRN/tactics/GroupReflection/Group_Interpretation_Function/val.var". + +alias id "unop" = "cic:/CoRN/tactics/GroupReflection/Group_Interpretation_Function/unop.var". + +alias id "binop" = "cic:/CoRN/tactics/GroupReflection/Group_Interpretation_Function/binop.var". + +alias id "pfun" = "cic:/CoRN/tactics/GroupReflection/Group_Interpretation_Function/pfun.var". + +inline "cic:/CoRN/tactics/GroupReflection/interpG.ind". + +inline "cic:/CoRN/tactics/GroupReflection/wfG.con". + +inline "cic:/CoRN/tactics/GroupReflection/xexprG.ind". + +inline "cic:/CoRN/tactics/GroupReflection/xforgetG.con". + +inline "cic:/CoRN/tactics/GroupReflection/xinterpG.con". + +inline "cic:/CoRN/tactics/GroupReflection/xexprG2interpG.con". + +inline "cic:/CoRN/tactics/GroupReflection/xexprG_diagram_commutes.con". + +inline "cic:/CoRN/tactics/GroupReflection/xexprG2wfG.con". + +inline "cic:/CoRN/tactics/GroupReflection/fexprG.ind". + +inline "cic:/CoRN/tactics/GroupReflection/fexprG_var.con". + +inline "cic:/CoRN/tactics/GroupReflection/fexprG_zero.con". + +inline "cic:/CoRN/tactics/GroupReflection/fexprG_plus.con". + +inline "cic:/CoRN/tactics/GroupReflection/fexprG_mult_int.con". + +inline "cic:/CoRN/tactics/GroupReflection/fforgetG.con". + +inline "cic:/CoRN/tactics/GroupReflection/fexprG2interp.con". + +inline "cic:/CoRN/tactics/GroupReflection/fexprG2wf.con". + +(* UNEXPORTED +Opaque csg_crr. +*) + +(* UNEXPORTED +Opaque cm_crr. +*) + +(* UNEXPORTED +Opaque cg_crr. +*) + +(* UNEXPORTED +Opaque csf_fun. +*) + +(* UNEXPORTED +Opaque csbf_fun. +*) + +(* UNEXPORTED +Opaque csr_rel. +*) + +(* UNEXPORTED +Opaque cs_eq. +*) + +(* UNEXPORTED +Opaque cs_neq. +*) + +(* UNEXPORTED +Opaque cs_ap. +*) + +(* UNEXPORTED +Opaque cm_unit. +*) + +(* UNEXPORTED +Opaque csg_op. +*) + +(* UNEXPORTED +Opaque cg_inv. +*) + +(* UNEXPORTED +Opaque cg_minus. +*) + +inline "cic:/CoRN/tactics/GroupReflection/refl_interpG.con". + +inline "cic:/CoRN/tactics/GroupReflection/interpG_wd.con". + +(* UNEXPORTED +End Group_Interpretation_Function +*) + +(* UNEXPORTED +Section Group_NormCorrect +*) + +alias id "G" = "cic:/CoRN/tactics/GroupReflection/Group_NormCorrect/G.var". + +alias id "val" = "cic:/CoRN/tactics/GroupReflection/Group_NormCorrect/val.var". + +alias id "unop" = "cic:/CoRN/tactics/GroupReflection/Group_NormCorrect/unop.var". + +alias id "binop" = "cic:/CoRN/tactics/GroupReflection/Group_NormCorrect/binop.var". + +alias id "pfun" = "cic:/CoRN/tactics/GroupReflection/Group_NormCorrect/pfun.var". + +(* NOTATION +Notation II := (interpG G val unop binop pfun). +*) + +(* +four kinds of exprs: + + I (expr_int _) + V (expr_var _) + M (expr_mult V M) + I + P (expr_plus M P) + I + +M: sorted on V +P: sorted on M, all M's not an I +*) + +inline "cic:/CoRN/tactics/GroupReflection/MI_mult_comm_int.con". + +(* UNEXPORTED +Opaque Zmult. +*) + +inline "cic:/CoRN/tactics/GroupReflection/MI_mult_corr_G.con". + +(* UNEXPORTED +Transparent Zmult. +*) + +(* UNEXPORTED +Opaque MI_mult. +*) + +inline "cic:/CoRN/tactics/GroupReflection/MV_mult_corr_G.con". + +(* UNEXPORTED +Opaque MV_mult. +*) + +inline "cic:/CoRN/tactics/GroupReflection/MM_mult_corr_G.con". + +(* UNEXPORTED +Transparent MV_mult MI_mult. +*) + +(* UNEXPORTED +Opaque MV_mult. +*) + +inline "cic:/CoRN/tactics/GroupReflection/MM_plus_corr_G.con". + +(* UNEXPORTED +Transparent MV_mult. +*) + +(* UNEXPORTED +Opaque MM_plus. +*) + +inline "cic:/CoRN/tactics/GroupReflection/PM_plus_corr_G.con". + +(* UNEXPORTED +Transparent MM_plus. +*) + +(* UNEXPORTED +Opaque PM_plus. +*) + +inline "cic:/CoRN/tactics/GroupReflection/PP_plus_corr_G.con". + +(* UNEXPORTED +Transparent PM_plus. +*) + +(* UNEXPORTED +Opaque PM_plus MM_mult MI_mult. +*) + +inline "cic:/CoRN/tactics/GroupReflection/PM_mult_corr_G.con". + +(* UNEXPORTED +Opaque PM_mult. +*) + +inline "cic:/CoRN/tactics/GroupReflection/PP_mult_corr_G.con". + +inline "cic:/CoRN/tactics/GroupReflection/NormG_corr_G.con". + +inline "cic:/CoRN/tactics/GroupReflection/Tactic_lemmaG.con". + +(* UNEXPORTED +End Group_NormCorrect +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/tactics/Opaque_algebra.ma b/matita/contribs/CoRN-Decl/tactics/Opaque_algebra.ma new file mode 100644 index 000000000..f614cbdac --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/Opaque_algebra.ma @@ -0,0 +1,100 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/Opaque_algebra". + +include "CoRN.ma". + +(* $Id: Opaque_algebra.v,v 1.1 2004/02/11 10:56:57 lcf Exp $ *) + +(* Opaque cs_crr. *) + +(* UNEXPORTED +Opaque csg_crr. +*) + +(* UNEXPORTED +Opaque cm_crr. +*) + +(* UNEXPORTED +Opaque cg_crr. +*) + +(* UNEXPORTED +Opaque cr_crr. +*) + +(* UNEXPORTED +Opaque cf_crr. +*) + +(* UNEXPORTED +Opaque csf_fun. +*) + +(* UNEXPORTED +Opaque csbf_fun. +*) + +(* UNEXPORTED +Opaque csr_rel. +*) + +(* UNEXPORTED +Opaque cs_eq. +*) + +(* UNEXPORTED +Opaque cs_neq. +*) + +(* UNEXPORTED +Opaque cs_ap. +*) + +(* UNEXPORTED +Opaque cm_unit. +*) + +(* UNEXPORTED +Opaque csg_op. +*) + +(* UNEXPORTED +Opaque cg_inv. +*) + +(* UNEXPORTED +Opaque cg_minus. +*) + +(* UNEXPORTED +Opaque cr_one. +*) + +(* UNEXPORTED +Opaque cr_mult. +*) + +(* UNEXPORTED +Opaque nexp_op. +*) + +(* UNEXPORTED +Opaque cf_div. +*) + diff --git a/matita/contribs/CoRN-Decl/tactics/RingReflection.ma b/matita/contribs/CoRN-Decl/tactics/RingReflection.ma new file mode 100644 index 000000000..84a076ad9 --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/RingReflection.ma @@ -0,0 +1,324 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/RingReflection". + +include "CoRN.ma". + +(* $Id: RingReflection.v,v 1.4 2004/04/23 10:01:06 lcf Exp $ *) + +(* begin hide *) + +include "algebra/CRings.ma". + +include "tactics/AlgReflection.ma". + +(* UNEXPORTED +Section Ring_Interpretation_Function +*) + +alias id "R" = "cic:/CoRN/tactics/RingReflection/Ring_Interpretation_Function/R.var". + +alias id "val" = "cic:/CoRN/tactics/RingReflection/Ring_Interpretation_Function/val.var". + +alias id "unop" = "cic:/CoRN/tactics/RingReflection/Ring_Interpretation_Function/unop.var". + +alias id "binop" = "cic:/CoRN/tactics/RingReflection/Ring_Interpretation_Function/binop.var". + +alias id "pfun" = "cic:/CoRN/tactics/RingReflection/Ring_Interpretation_Function/pfun.var". + +inline "cic:/CoRN/tactics/RingReflection/interpR.ind". + +inline "cic:/CoRN/tactics/RingReflection/wfR.con". + +inline "cic:/CoRN/tactics/RingReflection/xexprR.ind". + +inline "cic:/CoRN/tactics/RingReflection/xforgetR.con". + +inline "cic:/CoRN/tactics/RingReflection/xinterpR.con". + +inline "cic:/CoRN/tactics/RingReflection/xexprR2interpR.con". + +inline "cic:/CoRN/tactics/RingReflection/xexprR_diagram_commutes.con". + +inline "cic:/CoRN/tactics/RingReflection/xexprR2wfR.con". + +inline "cic:/CoRN/tactics/RingReflection/fexprR.ind". + +inline "cic:/CoRN/tactics/RingReflection/fexprR_var.con". + +inline "cic:/CoRN/tactics/RingReflection/fexprR_int.con". + +inline "cic:/CoRN/tactics/RingReflection/fexprR_plus.con". + +inline "cic:/CoRN/tactics/RingReflection/fexprR_mult.con". + +inline "cic:/CoRN/tactics/RingReflection/fforgetR.con". + +inline "cic:/CoRN/tactics/RingReflection/fexprR2interp.con". + +inline "cic:/CoRN/tactics/RingReflection/fexprR2wf.con". + +(* UNEXPORTED +Opaque csg_crr. +*) + +(* UNEXPORTED +Opaque cm_crr. +*) + +(* UNEXPORTED +Opaque cg_crr. +*) + +(* UNEXPORTED +Opaque cr_crr. +*) + +(* UNEXPORTED +Opaque csf_fun. +*) + +(* UNEXPORTED +Opaque csbf_fun. +*) + +(* UNEXPORTED +Opaque csr_rel. +*) + +(* UNEXPORTED +Opaque cs_eq. +*) + +(* UNEXPORTED +Opaque cs_neq. +*) + +(* UNEXPORTED +Opaque cs_ap. +*) + +(* UNEXPORTED +Opaque cm_unit. +*) + +(* UNEXPORTED +Opaque csg_op. +*) + +(* UNEXPORTED +Opaque cg_inv. +*) + +(* UNEXPORTED +Opaque cg_minus. +*) + +(* UNEXPORTED +Opaque cr_one. +*) + +(* UNEXPORTED +Opaque cr_mult. +*) + +(* UNEXPORTED +Opaque nexp_op. +*) + +inline "cic:/CoRN/tactics/RingReflection/refl_interpR.con". + +inline "cic:/CoRN/tactics/RingReflection/interpR_wd.con". + +(* UNEXPORTED +End Ring_Interpretation_Function +*) + +(* UNEXPORTED +Section Ring_NormCorrect +*) + +alias id "R" = "cic:/CoRN/tactics/RingReflection/Ring_NormCorrect/R.var". + +alias id "val" = "cic:/CoRN/tactics/RingReflection/Ring_NormCorrect/val.var". + +alias id "unop" = "cic:/CoRN/tactics/RingReflection/Ring_NormCorrect/unop.var". + +alias id "binop" = "cic:/CoRN/tactics/RingReflection/Ring_NormCorrect/binop.var". + +alias id "pfun" = "cic:/CoRN/tactics/RingReflection/Ring_NormCorrect/pfun.var". + +(* NOTATION +Notation II := (interpR R val unop binop pfun). +*) + +(* +four kinds of exprs: + + I (expr_int _) + V (expr_var _) + M (expr_mult V M) + I + P (expr_plus M P) + I + +M: sorted on V +P: sorted on M, all M's not an I +*) + +(* UNEXPORTED +Opaque Zmult. +*) + +inline "cic:/CoRN/tactics/RingReflection/MI_mult_corr_R.con". + +(* UNEXPORTED +Transparent Zmult. +*) + +(* UNEXPORTED +Opaque MI_mult. +*) + +inline "cic:/CoRN/tactics/RingReflection/MV_mult_corr_R.con". + +(* UNEXPORTED +Transparent MI_mult. +*) + +(* UNEXPORTED +Opaque MV_mult MI_mult. +*) + +inline "cic:/CoRN/tactics/RingReflection/MM_mult_corr_R.con". + +(* UNEXPORTED +Transparent MV_mult MI_mult. +*) + +(* UNEXPORTED +Opaque MV_mult. +*) + +inline "cic:/CoRN/tactics/RingReflection/MM_plus_corr_R.con". + +(* UNEXPORTED +Transparent MV_mult. +*) + +(* UNEXPORTED +Opaque MM_plus. +*) + +inline "cic:/CoRN/tactics/RingReflection/PM_plus_corr_R.con". + +(* UNEXPORTED +Transparent MM_plus. +*) + +(* UNEXPORTED +Opaque PM_plus. +*) + +inline "cic:/CoRN/tactics/RingReflection/PP_plus_corr_R.con". + +(* UNEXPORTED +Transparent PM_plus. +*) + +(* UNEXPORTED +Opaque PM_plus MM_mult MI_mult. +*) + +inline "cic:/CoRN/tactics/RingReflection/PM_mult_corr_R.con". + +(* UNEXPORTED +Opaque PM_mult. +*) + +inline "cic:/CoRN/tactics/RingReflection/PP_mult_corr_R.con". + +(* +Transparent PP_plus PM_mult PP_mult PM_plus MI_mult. +Lemma FF_plus_corr_R : (e,f:expr; x,y:R) + (II e x)->(II f y)->(II (FF_plus e f) x[+]y). +Cut (e1,e2,f1,f2:expr; x,y:R) + (II (expr_div e1 e2) x) + ->(II (expr_div f1 f2) y) + ->(II + (expr_div (PP_plus (PP_mult e1 f2) (PP_mult e2 f1)) + (PP_mult e2 f2)) x[+]y). +Cut (e,f:expr; x,y:R)(II e x)->(II f y)->(II (expr_plus e f) x[+]y). +Intros H H0 e f. +Elim e; Elim f; Intros; Simpl; Auto. +Intros. Apply interpR_plus with x y; Algebra. +Intros. Inversion H. Inversion H0. +Apply interpR_div_one with x[+]y. +Algebra. +Apply interpR_wd with x0[*]One[+]One[*]x1. +Apply PP_plus_corr_R; Apply PP_mult_corr_R; Auto; + Apply interpR_int with k:=`1`; Algebra. +Step_final x0[+]x1. +Apply interpR_wd with (One::R)[*]One; Algebra. +Apply PP_mult_corr_R; Auto. +Qed. + +Lemma FF_mult_corr_R : (e,f:expr; x,y:R) + (II e x)->(II f y)->(II (FF_mult e f) x[*]y). +Cut (e1,e2,f1,f2:expr; x,y:R) + (II (expr_div e1 e2) x) + ->(II (expr_div f1 f2) y) + ->(II (expr_div (PP_mult e1 f1) (PP_mult e2 f2)) x[*]y). +Cut (e,f:expr; x,y:R)(II e x)->(II f y)->(II (expr_mult e f) x[*]y). +Intros H H0 e f. +Elim e; Elim f; Intros; Simpl; Auto. +Intros. Apply interpR_mult with x y; Algebra. +Intros. Inversion H. Inversion H0. +Apply interpR_div_one with x0[*]x1. +Algebra. +Apply PP_mult_corr_R; Auto. +Apply interpR_wd with (One::R)[*]One; Algebra. +Apply PP_mult_corr_R; Auto. +Qed. + +Transparent FF_div. +Lemma FF_div_corr_R : (e,f:expr; x:R) + (II (expr_div e f) x)->(II (FF_div e f) x). +Intro e; Case e; Simpl; Auto. +Intros e0 e1 f; Case f; Simpl; Auto. +Intros. +Inversion H; Simpl. +Inversion H3; Inversion H5. +Apply interpR_div_one with x1[*]One. +astepl x1. Step_final x0. +Apply PP_mult_corr_R; Auto. +Apply interpR_wd with One[*]x2. +Apply PP_mult_corr_R; Auto. +Step_final x2. +Qed. +*) + +inline "cic:/CoRN/tactics/RingReflection/NormR_corr.con". + +inline "cic:/CoRN/tactics/RingReflection/Tactic_lemmaR.con". + +(* UNEXPORTED +End Ring_NormCorrect +*) + +(* end hide *) + diff --git a/matita/contribs/CoRN-Decl/tactics/Step.ma b/matita/contribs/CoRN-Decl/tactics/Step.ma new file mode 100644 index 000000000..4b922027a --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/Step.ma @@ -0,0 +1,76 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/Step". + +include "CoRN.ma". + +(* begin hide *) + +(* UNEXPORTED +Declare ML Module "rational". +*) + +(* UNEXPORTED +Ltac Algebra := auto with algebra_r algebra algebra_c algebra_s. +*) + +(* UNEXPORTED +Ltac astepl x := stepl x; [idtac | Algebra]. +*) + +(* UNEXPORTED +Ltac astepr x := stepr x; [idtac | Algebra]. +*) + +(* UNEXPORTED +Tactic Notation "astepl" constr(c) := astepl c. +*) + +(* UNEXPORTED +Tactic Notation "astepr" constr(c) := astepr c. +*) + +(* UNEXPORTED +Ltac rstepl x := stepl x; [idtac | rational]. +*) + +(* UNEXPORTED +Ltac rstepr x := stepr x; [idtac | rational]. +*) + +(* UNEXPORTED +Tactic Notation "rstepl" constr(c) := rstepl c. +*) + +(* UNEXPORTED +Tactic Notation "rstepr" constr(c) := rstepr c. +*) + +(* UNEXPORTED +Ltac Included := eauto with included. +*) + +(* end hide *) + +(*#* * [algebra] and [step] +These tactics simplify equational reasoning. See the references for a +description. + +* [Included] +[Included] will solve goals of the form [(included A (dom F))]. +*) + diff --git a/matita/contribs/CoRN-Decl/tactics/Transparent_algebra.ma b/matita/contribs/CoRN-Decl/tactics/Transparent_algebra.ma new file mode 100644 index 000000000..25fdc7e60 --- /dev/null +++ b/matita/contribs/CoRN-Decl/tactics/Transparent_algebra.ma @@ -0,0 +1,102 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/tactics/Transparent_algebra". + +include "CoRN.ma". + +(* $Id: Transparent_algebra.v,v 1.1 2004/02/11 10:56:58 lcf Exp $ *) + +(* UNEXPORTED +Transparent cs_crr. +*) + +(* UNEXPORTED +Transparent csg_crr. +*) + +(* UNEXPORTED +Transparent cm_crr. +*) + +(* UNEXPORTED +Transparent cg_crr. +*) + +(* UNEXPORTED +Transparent cr_crr. +*) + +(* UNEXPORTED +Transparent cf_crr. +*) + +(* UNEXPORTED +Transparent csf_fun. +*) + +(* UNEXPORTED +Transparent csbf_fun. +*) + +(* UNEXPORTED +Transparent csr_rel. +*) + +(* UNEXPORTED +Transparent cs_eq. +*) + +(* UNEXPORTED +Transparent cs_neq. +*) + +(* UNEXPORTED +Transparent cs_ap. +*) + +(* UNEXPORTED +Transparent cm_unit. +*) + +(* UNEXPORTED +Transparent csg_op. +*) + +(* UNEXPORTED +Transparent cg_inv. +*) + +(* UNEXPORTED +Transparent cg_minus. +*) + +(* UNEXPORTED +Transparent cr_one. +*) + +(* UNEXPORTED +Transparent cr_mult. +*) + +(* UNEXPORTED +Transparent nexp_op. +*) + +(* UNEXPORTED +Transparent cf_div. +*) + diff --git a/matita/contribs/CoRN-Decl/transc/Exponential.ma b/matita/contribs/CoRN-Decl/transc/Exponential.ma new file mode 100644 index 000000000..434241caa --- /dev/null +++ b/matita/contribs/CoRN-Decl/transc/Exponential.ma @@ -0,0 +1,310 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/transc/Exponential". + +include "CoRN.ma". + +(* $Id: Exponential.v,v 1.7 2004/04/23 10:01:07 lcf Exp $ *) + +include "transc/TaylorSeries.ma". + +(* UNEXPORTED +Opaque Min Max. +*) + +(*#* *Exponential and Logarithmic Functions + +The main properties of the exponential and logarithmic functions. + +**Properties of Exponential + +Exponential is strongly extensional and well defined. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_strext.con". + +inline "cic:/CoRN/transc/Exponential/Exp_wd.con". + +(* UNEXPORTED +Hint Resolve Exp_wd: algebra. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_zero.con". + +(*#* $e^1=e$#e1=e#, where [e] was defined a long time ago. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_one.con". + +(* UNEXPORTED +Hint Resolve Exp_zero Exp_one: algebra. +*) + +(*#* +The exponential function is its own derivative, and continuous. +*) + +inline "cic:/CoRN/transc/Exponential/Derivative_Exp.con". + +(* UNEXPORTED +Hint Resolve Derivative_Exp: derivate. +*) + +inline "cic:/CoRN/transc/Exponential/Continuous_Exp.con". + +(* UNEXPORTED +Hint Resolve Continuous_Exp: continuous. +*) + +(*#* +Negative numbers are projected into the interval [[0,1]]. +*) + +inline "cic:/CoRN/transc/Exponential/One_less_Exp.con". + +inline "cic:/CoRN/transc/Exponential/One_leEq_Exp.con". + +inline "cic:/CoRN/transc/Exponential/Exp_pos'.con". + +(*#* +Exponential is the unique function which evaluates to 1 at 0 and is +its own derivative. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_unique_lemma.con". + +inline "cic:/CoRN/transc/Exponential/Exp_bnd.con". + +(* UNEXPORTED +Opaque Expon. +*) + +(* UNEXPORTED +Transparent Expon. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_unique.con". + +(* UNEXPORTED +Opaque Expon. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_plus_pos.con". + +(*#* The usual rules for computing the exponential of a sum. *) + +inline "cic:/CoRN/transc/Exponential/Exp_plus.con". + +(* UNEXPORTED +Hint Resolve Exp_plus: algebra. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_plus'.con". + +inline "cic:/CoRN/transc/Exponential/Exp_inv_char.con". + +(* UNEXPORTED +Hint Resolve Exp_inv_char: algebra. +*) + +(*#* The exponential of any number is always positive---and thus apart +from zero. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_pos.con". + +inline "cic:/CoRN/transc/Exponential/Exp_ap_zero.con". + +(*#* +And the rules for the exponential of differences. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_inv.con". + +(* UNEXPORTED +Hint Resolve Exp_inv: algebra. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_minus.con". + +(* UNEXPORTED +Hint Resolve Exp_minus: algebra. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_inv'.con". + +inline "cic:/CoRN/transc/Exponential/Exp_minus'.con". + +(*#* Exponential is a monotonous function. *) + +inline "cic:/CoRN/transc/Exponential/Exp_less_One.con". + +inline "cic:/CoRN/transc/Exponential/Exp_leEq_One.con". + +inline "cic:/CoRN/transc/Exponential/Exp_resp_less.con". + +inline "cic:/CoRN/transc/Exponential/Exp_resp_leEq.con". + +(*#* **Properties of Logarithm + +The logarithm is a continuous function with derivative [One[/]x]. +*) + +inline "cic:/CoRN/transc/Exponential/Derivative_Log.con". + +(* UNEXPORTED +Hint Resolve Derivative_Log: derivate. +*) + +inline "cic:/CoRN/transc/Exponential/Continuous_Log.con". + +(* UNEXPORTED +Hint Resolve Continuous_Log: continuous. +*) + +(*#* Logarithm of [One]. *) + +inline "cic:/CoRN/transc/Exponential/Log_one.con". + +(* UNEXPORTED +Hint Resolve Log_one: algebra. +*) + +(*#* The logarithm is (strongly) extensional. *) + +inline "cic:/CoRN/transc/Exponential/Log_strext.con". + +inline "cic:/CoRN/transc/Exponential/Log_wd.con". + +(* UNEXPORTED +Hint Resolve Log_wd: algebra. +*) + +(*#* The rule for the logarithm of the product. *) + +(* UNEXPORTED +Opaque Logarithm. +*) + +(* UNEXPORTED +Transparent Logarithm. +*) + +inline "cic:/CoRN/transc/Exponential/Log_mult.con". + +(* UNEXPORTED +Hint Resolve Log_mult: algebra. +*) + +inline "cic:/CoRN/transc/Exponential/Log_mult'.con". + +(*#* A characterization of the domain of the logarithm. *) + +inline "cic:/CoRN/transc/Exponential/Log_domain.con". + +(* UNEXPORTED +Opaque Expon Logarithm. +*) + +(*#* $\log(e^x)=x$#log(ex)=x# for all [x], both as a +numerical and as a functional equation. +*) + +inline "cic:/CoRN/transc/Exponential/Log_Exp_inv.con". + +inline "cic:/CoRN/transc/Exponential/Log_Exp.con". + +(* UNEXPORTED +Transparent Logarithm. +*) + +(* UNEXPORTED +Hint Resolve Log_Exp: algebra. +*) + +inline "cic:/CoRN/transc/Exponential/Exp_Log_lemma.con". + +(*#* The converse expression. *) + +inline "cic:/CoRN/transc/Exponential/Exp_Log.con". + +(* UNEXPORTED +Hint Resolve Exp_Log: algebra. +*) + +(*#* Exponential and logarithm are injective. *) + +inline "cic:/CoRN/transc/Exponential/Exp_cancel.con". + +inline "cic:/CoRN/transc/Exponential/Log_cancel.con". + +(* UNEXPORTED +Opaque Logarithm. +*) + +(*#* And the final characterization as inverse functions. *) + +inline "cic:/CoRN/transc/Exponential/Exp_Log_inv.con". + +inline "cic:/CoRN/transc/Exponential/Log_E.con". + +(* UNEXPORTED +Hint Resolve Log_E: algebra. +*) + +(*#* Several rules regarding inequalities. *) + +inline "cic:/CoRN/transc/Exponential/Log_cancel_less.con". + +inline "cic:/CoRN/transc/Exponential/Log_cancel_leEq.con". + +inline "cic:/CoRN/transc/Exponential/Log_resp_less.con". + +inline "cic:/CoRN/transc/Exponential/Log_resp_leEq.con". + +inline "cic:/CoRN/transc/Exponential/Exp_cancel_less.con". + +inline "cic:/CoRN/transc/Exponential/Exp_cancel_leEq.con". + +inline "cic:/CoRN/transc/Exponential/Log_less_Zero.con". + +inline "cic:/CoRN/transc/Exponential/Log_leEq_Zero.con". + +inline "cic:/CoRN/transc/Exponential/Zero_less_Log.con". + +inline "cic:/CoRN/transc/Exponential/Zero_leEq_Log.con". + +(*#* Finally, rules for logarithm of quotients. *) + +inline "cic:/CoRN/transc/Exponential/Log_recip_char.con". + +inline "cic:/CoRN/transc/Exponential/Log_recip.con". + +(* UNEXPORTED +Hint Resolve Log_recip: algebra. +*) + +inline "cic:/CoRN/transc/Exponential/Log_recip'.con". + +inline "cic:/CoRN/transc/Exponential/Log_div.con". + +(* UNEXPORTED +Hint Resolve Log_div: algebra. +*) + +inline "cic:/CoRN/transc/Exponential/Log_div'.con". + diff --git a/matita/contribs/CoRN-Decl/transc/InvTrigonom.ma b/matita/contribs/CoRN-Decl/transc/InvTrigonom.ma new file mode 100644 index 000000000..73a386b02 --- /dev/null +++ b/matita/contribs/CoRN-Decl/transc/InvTrigonom.ma @@ -0,0 +1,296 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/transc/InvTrigonom". + +include "CoRN.ma". + +(* $Id: InvTrigonom.v,v 1.9 2004/04/23 10:01:07 lcf Exp $ *) + +include "transc/RealPowers.ma". + +include "transc/TrigMon.ma". + +include "ftc/StrongIVT.ma". + +(*#* printing ArcSin %\ensuremath{\arcsin}% *) + +(*#* printing ArcCos %\ensuremath{\arccos}% *) + +(*#* printing ArcTan %\ensuremath{\arctan}% *) + +(*#* *Inverse Trigonometric Functions + +**Definitions + +We will now define arcsine, arccosine and arctangent as indefinite +integrals and prove their main properties. We begin by proving that +the appropriate indefinite integrals can be defined, then prove the +main properties of the function. + +Arccosine is defined in terms of arcsine by the relation +[ArcCos(x)=Pi[/]Two-ArcSin(x)]. + +***Arcsine +*) + +(* UNEXPORTED +Opaque Sine Cosine Expon Logarithm. +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcSin_def_lemma.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcSin_def_zero.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcSin.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcSin_domain.con". + +inline "cic:/CoRN/transc/InvTrigonom/Continuous_ArcSin.con". + +inline "cic:/CoRN/transc/InvTrigonom/Derivative_ArcSin.con". + +(* UNEXPORTED +Hint Resolve Derivative_ArcSin: derivate. +*) + +(* UNEXPORTED +Hint Resolve Continuous_ArcSin: continuous. +*) + +(*#* ***Arccosine +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcCos.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcCos_domain.con". + +inline "cic:/CoRN/transc/InvTrigonom/Continuous_ArcCos.con". + +inline "cic:/CoRN/transc/InvTrigonom/Derivative_ArcCos.con". + +(*#* ***Arctangent +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcTan_def_lemma.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcTang.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcTan_domain.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcTan.con". + +inline "cic:/CoRN/transc/InvTrigonom/Continuous_ArcTan.con". + +inline "cic:/CoRN/transc/InvTrigonom/Derivative_ArcTan.con". + +(* UNEXPORTED +Hint Resolve Derivative_ArcCos Derivative_ArcTan: derivate. +*) + +(* UNEXPORTED +Hint Resolve Continuous_ArcCos Continuous_ArcTan: continuous. +*) + +(* UNEXPORTED +Section Inverses +*) + +(*#* **Composition properties + +We now prove that this functions are in fact inverses to the corresponding trigonometric functions. + +***Sine and Arcsine +*) + +inline "cic:/CoRN/transc/InvTrigonom/maps_Sin.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcSin_Sin_inv.con". + +(* UNEXPORTED +Opaque ArcSin. +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcSin_Sin.con". + +(* UNEXPORTED +Transparent ArcSin. +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcSin_range.con". + +(* UNEXPORTED +Transparent ArcSin. +*) + +inline "cic:/CoRN/transc/InvTrigonom/Sin_ArcSin.con". + +inline "cic:/CoRN/transc/InvTrigonom/Sin_ArcSin_inv.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcSin_resp_leEq.con". + +(*#* ***Cosine and Arcosine +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcCos_Cos.con". + +inline "cic:/CoRN/transc/InvTrigonom/Cos_ArcCos.con". + +inline "cic:/CoRN/transc/InvTrigonom/ArcCos_Cos_inv.con". + +inline "cic:/CoRN/transc/InvTrigonom/Cos_ArcCos_inv.con". + +(* UNEXPORTED +Opaque ArcSin. +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcCos_resp_leEq.con". + +(*#* ***Tangent and Arctangent +*) + +inline "cic:/CoRN/transc/InvTrigonom/maps_Tan.con". + +(* UNEXPORTED +Opaque Tang. +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcTan_Tan_inv.con". + +(* UNEXPORTED +Transparent Tang. +*) + +(* UNEXPORTED +Opaque ArcTang. +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcTan_Tan.con". + +(* UNEXPORTED +Opaque iprop. +*) + +(* UNEXPORTED +Transparent iprop. +*) + +(* UNEXPORTED +Opaque Cos. +*) + +inline "cic:/CoRN/transc/InvTrigonom/Tan_ilim.con". + +(* UNEXPORTED +Opaque Min. +*) + +(* UNEXPORTED +Transparent Cos. +*) + +(* UNEXPORTED +Section ArcTan_Range +*) + +alias id "x" = "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/x.var". + +(* begin hide *) + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/min.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/max.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/min1.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/min2.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/min3.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/min4.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/max1.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/max2.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/max3.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/max4.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/min5.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/min6.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/max5.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/max6.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/a.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/a1.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/a2.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/a3.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/a4.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/a5.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/b.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/b1.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/b2.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/b3.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/b4.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/b5.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/Inverses/ArcTan_Range/ab.con" "Inverses__ArcTan_Range__". + +inline "cic:/CoRN/transc/InvTrigonom/ArcTan_range_lemma.con". + +(* end hide *) + +(* UNEXPORTED +Transparent ArcTang. +*) + +inline "cic:/CoRN/transc/InvTrigonom/ArcTan_range.con". + +(* UNEXPORTED +End ArcTan_Range +*) + +(* UNEXPORTED +Transparent ArcTang. +*) + +inline "cic:/CoRN/transc/InvTrigonom/Tan_ArcTan.con". + +(* UNEXPORTED +Opaque ArcTang. +*) + +inline "cic:/CoRN/transc/InvTrigonom/Tan_ArcTan_inv.con". + +(* UNEXPORTED +End Inverses +*) + diff --git a/matita/contribs/CoRN-Decl/transc/Pi.ma b/matita/contribs/CoRN-Decl/transc/Pi.ma new file mode 100644 index 000000000..af134caa1 --- /dev/null +++ b/matita/contribs/CoRN-Decl/transc/Pi.ma @@ -0,0 +1,287 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/transc/Pi". + +include "CoRN.ma". + +include "transc/SinCos.ma". + +(* UNEXPORTED +Section Properties_of_Pi +*) + +(*#* printing Pi %\ensuremath{\pi}% #π# *) + +(*#* **Definition of Pi + +[Pi] is defined as twice the first positive zero of the cosine. In order to do this, we follow the construction described in Bishop 1969, section 7. +*) + +inline "cic:/CoRN/transc/Pi/pi_seq.con". + +(* UNEXPORTED +Opaque Cosine. +*) + +(* begin hide *) + +(* UNEXPORTED +Opaque Sine. +*) + +inline "cic:/CoRN/transc/Pi/pi_seq_lemma.con". + +(* end hide *) + +(*#* +This sequence is nonnegative and the cosine of any number between +[Zero] and any of its values is strictly positive; therefore the +sequence is strictly increasing. +*) + +inline "cic:/CoRN/transc/Pi/pi_seq_nonneg.con". + +inline "cic:/CoRN/transc/Pi/cos_pi_seq_pos.con". + +inline "cic:/CoRN/transc/Pi/pi_seq_incr.con". + +(*#* Trivial---but useful---consequences. *) + +inline "cic:/CoRN/transc/Pi/sin_pi_seq_mon.con". + +inline "cic:/CoRN/transc/Pi/sin_pi_seq_nonneg.con". + +inline "cic:/CoRN/transc/Pi/sin_pi_seq_gt_one.con". + +inline "cic:/CoRN/transc/Pi/cos_pi_seq_mon.con". + +(* begin hide *) + +inline "cic:/CoRN/transc/Pi/pi_seq_gt_one.con". + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +inline "cic:/CoRN/transc/Pi/pi_seq_bnd.con". + +inline "cic:/CoRN/transc/Pi/pi_seq_bnd'.con". + +inline "cic:/CoRN/transc/Pi/pi_seq_bnd''.con". + +(* end hide *) + +(*#* An auxiliary result. *) + +inline "cic:/CoRN/transc/Pi/Sin_One_pos.con". + +(*#* We can now prove that this is a Cauchy sequence. We define [Pi] as +twice its limit. +*) + +inline "cic:/CoRN/transc/Pi/pi_seq_Cauchy.con". + +inline "cic:/CoRN/transc/Pi/Pi.con". + +(*#* +For $x\in[0,\frac{\pi}2)$#x∈[0,π/2)#, [(Cos x) [>] 0]; +$\cos(\frac{pi}2)=0$#cos(π/2)=0#. +*) + +inline "cic:/CoRN/transc/Pi/pos_cos.con". + +inline "cic:/CoRN/transc/Pi/Cos_HalfPi.con". + +(*#* Convergence to [Pi [/] Two] is increasing; therefore, [Pi] is positive. *) + +inline "cic:/CoRN/transc/Pi/HalfPi_gt_pi_seq.con". + +inline "cic:/CoRN/transc/Pi/pos_Pi.con". + +(* UNEXPORTED +End Properties_of_Pi +*) + +(* UNEXPORTED +Hint Resolve Cos_HalfPi: algebra. +*) + +(* UNEXPORTED +Section Pi_and_Order +*) + +(*#* **Properties of Pi + +The following are trivial ordering properties of multiples of [Pi] +that will be used so often that it is convenient to state as lemmas; +also, we define a hint database that automatically tries to apply this +lemmas, to make proof development easier. + +A summary of what is being proved is simply: +[[ +[--]Pi [<] [--]Pi[/]Two [<] [--] Pi[/]Four [<] Zero [<] Pi[/]Four [<] Pi[/]Two [<] Pi +]] + +[PiSolve] will prove any of these inequalities. +*) + +inline "cic:/CoRN/transc/Pi/pos_HalfPi.con". + +inline "cic:/CoRN/transc/Pi/pos_QuarterPi.con". + +inline "cic:/CoRN/transc/Pi/QuarterPi_less_HalfPi.con". + +inline "cic:/CoRN/transc/Pi/HalfPi_less_Pi.con". + +inline "cic:/CoRN/transc/Pi/QuarterPi_less_Pi.con". + +inline "cic:/CoRN/transc/Pi/neg_invPi.con". + +inline "cic:/CoRN/transc/Pi/neg_invHalfPi.con". + +inline "cic:/CoRN/transc/Pi/neg_invQuarterPi.con". + +inline "cic:/CoRN/transc/Pi/invHalfPi_less_invQuarterPi.con". + +inline "cic:/CoRN/transc/Pi/invPi_less_invHalfPi.con". + +inline "cic:/CoRN/transc/Pi/invPi_less_invQuarterPi.con". + +inline "cic:/CoRN/transc/Pi/invPi_less_Pi.con". + +inline "cic:/CoRN/transc/Pi/invPi_less_HalfPi.con". + +inline "cic:/CoRN/transc/Pi/invPi_less_QuarterPi.con". + +inline "cic:/CoRN/transc/Pi/invHalfPi_less_Pi.con". + +inline "cic:/CoRN/transc/Pi/invHalfPi_less_HalfPi.con". + +inline "cic:/CoRN/transc/Pi/invHalfPi_less_QuarterPi.con". + +inline "cic:/CoRN/transc/Pi/invQuarterPi_less_Pi.con". + +inline "cic:/CoRN/transc/Pi/invQuarterPi_less_HalfPi.con". + +inline "cic:/CoRN/transc/Pi/invQuarterPi_less_QuarterPi.con". + +(* UNEXPORTED +End Pi_and_Order +*) + +(* UNEXPORTED +Hint Resolve pos_Pi pos_HalfPi pos_QuarterPi QuarterPi_less_HalfPi + HalfPi_less_Pi QuarterPi_less_Pi neg_invPi neg_invHalfPi neg_invQuarterPi + invHalfPi_less_invQuarterPi invPi_less_invHalfPi invPi_less_invQuarterPi + invPi_less_Pi invPi_less_HalfPi invPi_less_QuarterPi invHalfPi_less_Pi + invHalfPi_less_HalfPi invHalfPi_less_QuarterPi invQuarterPi_less_Pi + invQuarterPi_less_HalfPi invQuarterPi_less_QuarterPi: piorder. +*) + +(* begin hide *) + +(* UNEXPORTED +Ltac PiSolve := try apply less_leEq; auto with piorder. +*) + +(* end hide *) + +(* UNEXPORTED +Section Sin_And_Cos +*) + +(*#* **More formulas + +We now move back to trigonometric identities: sine, cosine and tangent of +the double. +*) + +inline "cic:/CoRN/transc/Pi/Cos_double.con". + +inline "cic:/CoRN/transc/Pi/Sin_double.con". + +inline "cic:/CoRN/transc/Pi/Tan_double.con". + +(* begin hide *) + +inline "cic:/CoRN/transc/Pi/sqrt_lemma.con". + +(* end hide *) + +(*#* Value of trigonometric functions at [Pi[/]Four]. *) + +inline "cic:/CoRN/transc/Pi/Cos_QuarterPi.con". + +inline "cic:/CoRN/transc/Pi/Sin_QuarterPi.con". + +(* UNEXPORTED +Hint Resolve Sin_QuarterPi Cos_QuarterPi: algebra. +*) + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +inline "cic:/CoRN/transc/Pi/Tan_QuarterPi.con". + +(*#* Shifting sine and cosine by [Pi[/]Two] and [Pi]. *) + +inline "cic:/CoRN/transc/Pi/Sin_HalfPi.con". + +(* UNEXPORTED +Hint Resolve Sin_HalfPi: algebra. +*) + +inline "cic:/CoRN/transc/Pi/Sin_plus_HalfPi.con". + +inline "cic:/CoRN/transc/Pi/Sin_HalfPi_minus.con". + +inline "cic:/CoRN/transc/Pi/Cos_plus_HalfPi.con". + +inline "cic:/CoRN/transc/Pi/Cos_HalfPi_minus.con". + +inline "cic:/CoRN/transc/Pi/Sin_Pi.con". + +inline "cic:/CoRN/transc/Pi/Cos_Pi.con". + +inline "cic:/CoRN/transc/Pi/Sin_plus_Pi.con". + +inline "cic:/CoRN/transc/Pi/Cos_plus_Pi.con". + +(* UNEXPORTED +Hint Resolve Sin_plus_Pi Cos_plus_Pi: algebra. +*) + +(*#* Sine and cosine have period [Two Pi], tangent has period [Pi]. *) + +inline "cic:/CoRN/transc/Pi/Sin_periodic.con". + +inline "cic:/CoRN/transc/Pi/Cos_periodic.con". + +inline "cic:/CoRN/transc/Pi/Tan_periodic.con". + +(* UNEXPORTED +End Sin_And_Cos +*) + +(* UNEXPORTED +Hint Resolve Cos_double Sin_double Tan_double Cos_QuarterPi Sin_QuarterPi + Tan_QuarterPi Sin_Pi Cos_Pi Sin_HalfPi Sin_plus_HalfPi Sin_HalfPi_minus + Cos_plus_HalfPi Cos_HalfPi_minus Sin_plus_Pi Cos_plus_Pi Sin_periodic + Cos_periodic Tan_periodic: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/transc/PowerSeries.ma b/matita/contribs/CoRN-Decl/transc/PowerSeries.ma new file mode 100644 index 000000000..2bb43ffc2 --- /dev/null +++ b/matita/contribs/CoRN-Decl/transc/PowerSeries.ma @@ -0,0 +1,242 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/transc/PowerSeries". + +include "CoRN.ma". + +(* $Id: PowerSeries.v,v 1.8 2004/04/23 10:01:08 lcf Exp $ *) + +(*#* printing Exp %\ensuremath{\exp}% *) + +(*#* printing Sin %\ensuremath{\sin}% *) + +(*#* printing Cos %\ensuremath{\cos}% *) + +(*#* printing Log %\ensuremath{\log}% *) + +(*#* printing Tan %\ensuremath{\tan}% *) + +include "ftc/FTC.ma". + +(*#* *More on Power Series + +We will now formally define an operator that defines a function as the +sum of some series given a number sequence. Along with it, we will +prove some important properties of these entities. +*) + +(* UNEXPORTED +Section Power_Series +*) + +(*#* **General results + +%\begin{convention}% Let [J : interval] and [x0 : IR] be a point of [J]. +Let [a : nat -> IR]. +%\end{convention}% +*) + +alias id "J" = "cic:/CoRN/transc/PowerSeries/Power_Series/J.var". + +alias id "x0" = "cic:/CoRN/transc/PowerSeries/Power_Series/x0.var". + +alias id "Hx0" = "cic:/CoRN/transc/PowerSeries/Power_Series/Hx0.var". + +alias id "a" = "cic:/CoRN/transc/PowerSeries/Power_Series/a.var". + +inline "cic:/CoRN/transc/PowerSeries/FPowerSeries.con". + +(*#* +The most important convergence criterium specifically for power series +is the Dirichlet criterium. +*) + +(* begin show *) + +alias id "Ha" = "cic:/CoRN/transc/PowerSeries/Power_Series/Ha.var". + +inline "cic:/CoRN/transc/PowerSeries/Power_Series/r.con" "Power_Series__". + +inline "cic:/CoRN/transc/PowerSeries/Power_Series/Hr.con" "Power_Series__". + +(* end show *) + +inline "cic:/CoRN/transc/PowerSeries/Dirichlet_crit.con". + +(*#* +When defining a function using its Taylor series as a motivation, the following operator can be of use. +*) + +inline "cic:/CoRN/transc/PowerSeries/FPowerSeries'.con". + +(*#* +This function is also continuous and has a good convergence ratio. +*) + +inline "cic:/CoRN/transc/PowerSeries/FPowerSeries'_cont.con". + +inline "cic:/CoRN/transc/PowerSeries/included_FPowerSeries'.con". + +(* begin show *) + +alias id "Ha'" = "cic:/CoRN/transc/PowerSeries/Power_Series/Ha'.var". + +(* end show *) + +inline "cic:/CoRN/transc/PowerSeries/FPowerSeries'_conv'.con". + +inline "cic:/CoRN/transc/PowerSeries/FPowerSeries'_conv.con". + +(* UNEXPORTED +End Power_Series +*) + +(* UNEXPORTED +Hint Resolve FPowerSeries'_cont: continuous. +*) + +(* UNEXPORTED +Section More_on_PowerSeries +*) + +(*#* +%\begin{convention}% Let [F] and [G] be the power series defined +respectively by [a] and by [fun n => (a (S n))]. +%\end{convention}% +*) + +alias id "x0" = "cic:/CoRN/transc/PowerSeries/More_on_PowerSeries/x0.var". + +alias id "a" = "cic:/CoRN/transc/PowerSeries/More_on_PowerSeries/a.var". + +(* begin hide *) + +inline "cic:/CoRN/transc/PowerSeries/More_on_PowerSeries/F.con" "More_on_PowerSeries__". + +inline "cic:/CoRN/transc/PowerSeries/More_on_PowerSeries/G.con" "More_on_PowerSeries__". + +(* end hide *) + +(* begin show *) + +alias id "Hf" = "cic:/CoRN/transc/PowerSeries/More_on_PowerSeries/Hf.var". + +alias id "Hf'" = "cic:/CoRN/transc/PowerSeries/More_on_PowerSeries/Hf'.var". + +alias id "Hg" = "cic:/CoRN/transc/PowerSeries/More_on_PowerSeries/Hg.var". + +(* end show *) + +(*#* We get a comparison test for power series. *) + +inline "cic:/CoRN/transc/PowerSeries/FPowerSeries'_comp.con". + +(*#* And a rule for differentiation. *) + +(* UNEXPORTED +Opaque nring fac. +*) + +inline "cic:/CoRN/transc/PowerSeries/Derivative_FPowerSeries1'.con". + +(* UNEXPORTED +End More_on_PowerSeries +*) + +(* UNEXPORTED +Section Definitions +*) + +(*#* **Function definitions through power series + +We now define the exponential, sine and cosine functions as power +series, and prove their convergence. Tangent is defined as the +quotient of sine over cosine. +*) + +inline "cic:/CoRN/transc/PowerSeries/Exp_ps.con". + +inline "cic:/CoRN/transc/PowerSeries/sin_seq.con". + +inline "cic:/CoRN/transc/PowerSeries/sin_ps.con". + +inline "cic:/CoRN/transc/PowerSeries/cos_seq.con". + +inline "cic:/CoRN/transc/PowerSeries/cos_ps.con". + +inline "cic:/CoRN/transc/PowerSeries/Exp_conv'.con". + +inline "cic:/CoRN/transc/PowerSeries/Exp_conv.con". + +inline "cic:/CoRN/transc/PowerSeries/sin_conv.con". + +inline "cic:/CoRN/transc/PowerSeries/cos_conv.con". + +inline "cic:/CoRN/transc/PowerSeries/Expon.con". + +inline "cic:/CoRN/transc/PowerSeries/Sine.con". + +inline "cic:/CoRN/transc/PowerSeries/Cosine.con". + +inline "cic:/CoRN/transc/PowerSeries/Tang.con". + +(*#* +Some auxiliary domain results. +*) + +inline "cic:/CoRN/transc/PowerSeries/Exp_domain.con". + +inline "cic:/CoRN/transc/PowerSeries/sin_domain.con". + +inline "cic:/CoRN/transc/PowerSeries/cos_domain.con". + +inline "cic:/CoRN/transc/PowerSeries/included_Exp.con". + +inline "cic:/CoRN/transc/PowerSeries/included_Sin.con". + +inline "cic:/CoRN/transc/PowerSeries/included_Cos.con". + +(*#* +Definition of the logarithm. +*) + +inline "cic:/CoRN/transc/PowerSeries/log_defn_lemma.con". + +inline "cic:/CoRN/transc/PowerSeries/Logarithm.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Hint Resolve included_Exp included_Sin included_Cos: included. +*) + +(*#* +As most of these functions are total, it makes sense to treat them as setoid functions on the reals. In the case of logarithm and tangent, this is not possible; however, we still define some abbreviations for aesthetical reasons. +*) + +inline "cic:/CoRN/transc/PowerSeries/Exp.con". + +inline "cic:/CoRN/transc/PowerSeries/Sin.con". + +inline "cic:/CoRN/transc/PowerSeries/Cos.con". + +inline "cic:/CoRN/transc/PowerSeries/Log.con". + +inline "cic:/CoRN/transc/PowerSeries/Tan.con". + diff --git a/matita/contribs/CoRN-Decl/transc/RealPowers.ma b/matita/contribs/CoRN-Decl/transc/RealPowers.ma new file mode 100644 index 000000000..fd081416a --- /dev/null +++ b/matita/contribs/CoRN-Decl/transc/RealPowers.ma @@ -0,0 +1,197 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/transc/RealPowers". + +include "CoRN.ma". + +(* $Id: RealPowers.v,v 1.5 2004/04/23 10:01:08 lcf Exp $ *) + +(*#* printing [!] %\ensuremath{\hat{\ }}% #^# *) + +(*#* printing {!} %\ensuremath{\hat{\ }}% #^# *) + +include "transc/Exponential.ma". + +(* UNEXPORTED +Opaque Expon. +*) + +(*#* *Arbitrary Real Powers + +**Powers of Real Numbers + +We now define +$x^y=e^{y\times\log(x)}$#xy=ey*log(x)#, whenever +[x [>] 0], inspired by the rules for manipulating these expressions. +*) + +inline "cic:/CoRN/transc/RealPowers/power.con". + +(* NOTATION +Notation "x [!] y [//] Hy" := (power x y Hy) (at level 20). +*) + +(*#* +This definition yields a well defined, strongly extensional function +which extends the algebraic exponentiation to an integer power and +still has all the good properties of that operation; when [x [=] e] it +coincides with the exponential function. +*) + +inline "cic:/CoRN/transc/RealPowers/power_wd.con". + +inline "cic:/CoRN/transc/RealPowers/power_strext.con". + +inline "cic:/CoRN/transc/RealPowers/power_plus.con". + +inline "cic:/CoRN/transc/RealPowers/power_inv.con". + +(* UNEXPORTED +Hint Resolve power_wd power_plus power_inv: algebra. +*) + +inline "cic:/CoRN/transc/RealPowers/power_minus.con". + +inline "cic:/CoRN/transc/RealPowers/power_nat.con". + +(* UNEXPORTED +Hint Resolve power_minus power_nat: algebra. +*) + +inline "cic:/CoRN/transc/RealPowers/power_zero.con". + +inline "cic:/CoRN/transc/RealPowers/power_one.con". + +(* UNEXPORTED +Hint Resolve power_zero power_one: algebra. +*) + +(* UNEXPORTED +Opaque nexp_op. +*) + +inline "cic:/CoRN/transc/RealPowers/power_int.con". + +(* UNEXPORTED +Hint Resolve power_int: algebra. +*) + +inline "cic:/CoRN/transc/RealPowers/Exp_power.con". + +inline "cic:/CoRN/transc/RealPowers/mult_power.con". + +inline "cic:/CoRN/transc/RealPowers/recip_power.con". + +(* UNEXPORTED +Hint Resolve Exp_power mult_power recip_power: algebra. +*) + +inline "cic:/CoRN/transc/RealPowers/div_power.con". + +(* UNEXPORTED +Hint Resolve div_power: algebra. +*) + +inline "cic:/CoRN/transc/RealPowers/power_ap_zero.con". + +inline "cic:/CoRN/transc/RealPowers/power_mult.con". + +inline "cic:/CoRN/transc/RealPowers/power_pos.con". + +(* UNEXPORTED +Hint Resolve power_mult: algebra. +*) + +inline "cic:/CoRN/transc/RealPowers/power_recip.con". + +(* UNEXPORTED +Hint Resolve power_recip: algebra. +*) + +inline "cic:/CoRN/transc/RealPowers/power_div.con". + +(* UNEXPORTED +Hint Resolve power_div: algebra. +*) + +(* UNEXPORTED +Section Power_Function +*) + +(*#* **Power Function + +This operation on real numbers gives birth to an analogous operation +on partial functions which preserves continuity. + +%\begin{convention}% Let [F, G : PartIR]. +%\end{convention}% +*) + +alias id "J" = "cic:/CoRN/transc/RealPowers/Power_Function/J.var". + +alias id "F" = "cic:/CoRN/transc/RealPowers/Power_Function/F.var". + +alias id "G" = "cic:/CoRN/transc/RealPowers/Power_Function/G.var". + +inline "cic:/CoRN/transc/RealPowers/FPower.con". + +inline "cic:/CoRN/transc/RealPowers/FPower_domain.con". + +inline "cic:/CoRN/transc/RealPowers/Continuous_power.con". + +(* UNEXPORTED +End Power_Function +*) + +(* NOTATION +Notation "F {!} G" := (FPower F G) (at level 20). +*) + +(* UNEXPORTED +Section More_on_Power_Function +*) + +(* UNEXPORTED +Opaque Expon Logarithm. +*) + +(*#* From global continuity we can obviously get local continuity: *) + +inline "cic:/CoRN/transc/RealPowers/continuous_I_power.con". + +(*#* The rule for differentiation is a must. *) + +(* UNEXPORTED +Transparent Logarithm. +*) + +(* UNEXPORTED +Opaque Logarithm. +*) + +inline "cic:/CoRN/transc/RealPowers/Derivative_power.con". + +inline "cic:/CoRN/transc/RealPowers/Diffble_power.con". + +(* UNEXPORTED +End More_on_Power_Function +*) + +(* UNEXPORTED +Hint Resolve Derivative_power: derivate. +*) + diff --git a/matita/contribs/CoRN-Decl/transc/SinCos.ma b/matita/contribs/CoRN-Decl/transc/SinCos.ma new file mode 100644 index 000000000..314d0f5fa --- /dev/null +++ b/matita/contribs/CoRN-Decl/transc/SinCos.ma @@ -0,0 +1,176 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/transc/SinCos". + +include "CoRN.ma". + +(* $Id: SinCos.v,v 1.6 2004/04/23 10:01:08 lcf Exp $ *) + +include "transc/Trigonometric.ma". + +(* UNEXPORTED +Section Sum_and_so_on +*) + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +(* begin hide *) + +inline "cic:/CoRN/transc/SinCos/Sum_and_so_on/F.con" "Sum_and_so_on__". + +inline "cic:/CoRN/transc/SinCos/Sum_and_so_on/G.con" "Sum_and_so_on__". + +inline "cic:/CoRN/transc/SinCos/Sum_and_so_on/F'.con" "Sum_and_so_on__". + +inline "cic:/CoRN/transc/SinCos/Sum_and_so_on/G'.con" "Sum_and_so_on__". + +(* end hide *) + +inline "cic:/CoRN/transc/SinCos/Sin_plus.con". + +inline "cic:/CoRN/transc/SinCos/Cos_plus.con". + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +(* UNEXPORTED +Hint Resolve Cos_plus Sin_plus: algebra. +*) + +(*#* As a corollary we get the rule for the tangent of the sum. *) + +inline "cic:/CoRN/transc/SinCos/Tan_plus.con". + +(* UNEXPORTED +Transparent Sine Cosine. +*) + +(*#* Sine, cosine and tangent of [[--]x]. *) + +inline "cic:/CoRN/transc/SinCos/Cos_inv.con". + +inline "cic:/CoRN/transc/SinCos/Sin_inv.con". + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +(* UNEXPORTED +Hint Resolve Cos_inv Sin_inv: algebra. +*) + +inline "cic:/CoRN/transc/SinCos/Tan_inv.con". + +(* UNEXPORTED +Transparent Sine Cosine. +*) + +(*#* +The fundamental formulas of trigonometry: $\cos(x)^2+\sin(x)^2=1$#cos(x)2+sin(x)2=1# and, equivalently, $1+\tan(x)^2=\frac1{\cos(x)^2}$#1+tan(x)2=1/(cos(x)2)#. +*) + +(* UNEXPORTED +Hint Resolve Cos_zero: algebra. +*) + +inline "cic:/CoRN/transc/SinCos/FFT.con". + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +(* UNEXPORTED +Hint Resolve FFT: algebra. +*) + +inline "cic:/CoRN/transc/SinCos/FFT'.con". + +(* UNEXPORTED +End Sum_and_so_on +*) + +(* UNEXPORTED +Hint Resolve Derivative_Sin Derivative_Cos: derivate. +*) + +(* UNEXPORTED +Hint Resolve Continuous_Sin Continuous_Cos: continuous. +*) + +(* UNEXPORTED +Hint Resolve Sin_zero Cos_zero Tan_zero Sin_plus Cos_plus Tan_plus Sin_inv + Cos_inv Tan_inv FFT FFT': algebra. +*) + +(* UNEXPORTED +Opaque Min Sine Cosine. +*) + +(* UNEXPORTED +Section Basic_Properties +*) + +(*#* **Basic properties + +We now prove most of the usual trigonometric (in)equalities. + +Sine, cosine and tangent are strongly extensional and well defined. +*) + +inline "cic:/CoRN/transc/SinCos/Sin_strext.con". + +inline "cic:/CoRN/transc/SinCos/Cos_strext.con". + +inline "cic:/CoRN/transc/SinCos/Tan_strext.con". + +inline "cic:/CoRN/transc/SinCos/Sin_wd.con". + +inline "cic:/CoRN/transc/SinCos/Cos_wd.con". + +inline "cic:/CoRN/transc/SinCos/Tan_wd.con". + +(*#* +The sine and cosine produce values in [[-1,1]]. +*) + +inline "cic:/CoRN/transc/SinCos/AbsIR_Sin_leEq_One.con". + +inline "cic:/CoRN/transc/SinCos/AbsIR_Cos_leEq_One.con". + +inline "cic:/CoRN/transc/SinCos/Sin_leEq_One.con". + +inline "cic:/CoRN/transc/SinCos/Cos_leEq_One.con". + +(*#* +If the cosine is positive then the sine is in [(-1,1)]. +*) + +inline "cic:/CoRN/transc/SinCos/Sin_less_One.con". + +inline "cic:/CoRN/transc/SinCos/AbsIR_Sin_less_One.con". + +(* UNEXPORTED +End Basic_Properties +*) + +(* UNEXPORTED +Hint Resolve Sin_wd Cos_wd Tan_wd: algebra. +*) + diff --git a/matita/contribs/CoRN-Decl/transc/TaylorSeries.ma b/matita/contribs/CoRN-Decl/transc/TaylorSeries.ma new file mode 100644 index 000000000..7e00f92c8 --- /dev/null +++ b/matita/contribs/CoRN-Decl/transc/TaylorSeries.ma @@ -0,0 +1,258 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/transc/TaylorSeries". + +include "CoRN.ma". + +(* $Id: TaylorSeries.v,v 1.7 2004/04/23 10:01:08 lcf Exp $ *) + +include "transc/PowerSeries.ma". + +include "ftc/Taylor.ma". + +(*#* *Taylor Series + +We now generalize our work on Taylor's theorem to define the Taylor +series of an infinitely many times differentiable function as a power +series. We prove convergence (always) of the Taylor series and give +criteria for when the sum of this series is the original function. + +**Definitions + +%\begin{convention}% Let [J] be a proper interval and [F] an +infinitely many times differentiable function in [J]. Let [a] be a +point of [J]. +%\end{convention}% +*) + +(* UNEXPORTED +Section Definitions +*) + +alias id "J" = "cic:/CoRN/transc/TaylorSeries/Definitions/J.var". + +alias id "pJ" = "cic:/CoRN/transc/TaylorSeries/Definitions/pJ.var". + +alias id "F" = "cic:/CoRN/transc/TaylorSeries/Definitions/F.var". + +alias id "diffF" = "cic:/CoRN/transc/TaylorSeries/Definitions/diffF.var". + +alias id "a" = "cic:/CoRN/transc/TaylorSeries/Definitions/a.var". + +alias id "Ha" = "cic:/CoRN/transc/TaylorSeries/Definitions/Ha.var". + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Series'.con". + +(*#* +%\begin{convention}% Assume also that [f] is the sequence of +derivatives of [F]. +%\end{convention}% +*) + +alias id "f" = "cic:/CoRN/transc/TaylorSeries/Definitions/f.var". + +alias id "derF" = "cic:/CoRN/transc/TaylorSeries/Definitions/derF.var". + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Series.con". + +(* UNEXPORTED +Opaque N_Deriv. +*) + +(*#* Characterizations of the Taylor remainder. *) + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Rem_char.con". + +inline "cic:/CoRN/transc/TaylorSeries/abs_Taylor_Rem_char.con". + +(* UNEXPORTED +End Definitions +*) + +(* UNEXPORTED +Section Convergence_in_IR +*) + +(*#* **Convergence + +Our interval is now the real line. We begin by proving some helpful +continuity properties, then define a boundedness condition for the +derivatives of [F] that guarantees convergence of its Taylor series to +[F]. +*) + +alias id "H" = "cic:/CoRN/transc/TaylorSeries/Convergence_in_IR/H.var". + +alias id "F" = "cic:/CoRN/transc/TaylorSeries/Convergence_in_IR/F.var". + +alias id "a" = "cic:/CoRN/transc/TaylorSeries/Convergence_in_IR/a.var". + +alias id "Ha" = "cic:/CoRN/transc/TaylorSeries/Convergence_in_IR/Ha.var". + +alias id "f" = "cic:/CoRN/transc/TaylorSeries/Convergence_in_IR/f.var". + +alias id "derF" = "cic:/CoRN/transc/TaylorSeries/Convergence_in_IR/derF.var". + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Series_imp_cont.con". + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Series_lemma_cont.con". + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_bnd.con". + +(* begin show *) + +alias id "bndf" = "cic:/CoRN/transc/TaylorSeries/Convergence_in_IR/bndf.var". + +(* end show *) + +(* UNEXPORTED +Opaque nexp_op fac. +*) + +(* begin hide *) + +inline "cic:/CoRN/transc/TaylorSeries/Convergence_in_IR/H1.con" "Convergence_in_IR__". + +(* UNEXPORTED +Transparent nexp_op. +*) + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Series_conv_lemma1.con". + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Series_conv_lemma2.con". + +(* end hide *) + +(*#* The Taylor series always converges on the realline. *) + +(* UNEXPORTED +Transparent nexp_op. +*) + +(* UNEXPORTED +Opaque nexp_op. +*) + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Series_conv_IR.con". + +(* begin hide *) + +(* UNEXPORTED +Transparent nexp_op. +*) + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_majoration_lemma.con". + +(* UNEXPORTED +Opaque N_Deriv fac. +*) + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Series_conv_lemma3.con". + +(* end hide *) + +(*#* +We now prove that, under our assumptions, it actually converges to the +original function. For generality and also usability, however, we +will separately assume convergence. +*) + +(* begin show *) + +alias id "Hf" = "cic:/CoRN/transc/TaylorSeries/Convergence_in_IR/Hf.var". + +(* end show *) + +(* UNEXPORTED +Transparent fac. +*) + +(* UNEXPORTED +Opaque mult. +*) + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_Series_conv_to_fun.con". + +(* UNEXPORTED +End Convergence_in_IR +*) + +(* UNEXPORTED +Section Other_Results +*) + +(*#* +The condition for the previous lemma is not very easy to prove. We +give some helpful lemmas. +*) + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_bnd_trans.con". + +(* begin hide *) + +(* UNEXPORTED +Opaque nexp_op. +*) + +inline "cic:/CoRN/transc/TaylorSeries/convergence_lemma.con". + +(* end hide *) + +inline "cic:/CoRN/transc/TaylorSeries/bnd_imp_Taylor_bnd.con". + +(*#* +Finally, a uniqueness criterium: two functions [F] and [G] are equal, +provided that their derivatives coincide at a given point and their +Taylor series converge to themselves. +*) + +alias id "F" = "cic:/CoRN/transc/TaylorSeries/Other_Results/F.var". + +alias id "G" = "cic:/CoRN/transc/TaylorSeries/Other_Results/G.var". + +alias id "a" = "cic:/CoRN/transc/TaylorSeries/Other_Results/a.var". + +alias id "f" = "cic:/CoRN/transc/TaylorSeries/Other_Results/f.var". + +alias id "g" = "cic:/CoRN/transc/TaylorSeries/Other_Results/g.var". + +alias id "derF" = "cic:/CoRN/transc/TaylorSeries/Other_Results/derF.var". + +alias id "derG" = "cic:/CoRN/transc/TaylorSeries/Other_Results/derG.var". + +alias id "bndf" = "cic:/CoRN/transc/TaylorSeries/Other_Results/bndf.var". + +alias id "bndg" = "cic:/CoRN/transc/TaylorSeries/Other_Results/bndg.var". + +(* begin show *) + +alias id "Heq" = "cic:/CoRN/transc/TaylorSeries/Other_Results/Heq.var". + +(* end show *) + +(* begin hide *) + +inline "cic:/CoRN/transc/TaylorSeries/Other_Results/Hf.con" "Other_Results__". + +(* end hide *) + +inline "cic:/CoRN/transc/TaylorSeries/Taylor_unique_crit.con". + +(* UNEXPORTED +End Other_Results +*) + diff --git a/matita/contribs/CoRN-Decl/transc/TrigMon.ma b/matita/contribs/CoRN-Decl/transc/TrigMon.ma new file mode 100644 index 000000000..a80658438 --- /dev/null +++ b/matita/contribs/CoRN-Decl/transc/TrigMon.ma @@ -0,0 +1,103 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/transc/TrigMon". + +include "CoRN.ma". + +(* $Id: TrigMon.v,v 1.9 2004/04/23 10:01:08 lcf Exp $ *) + +include "transc/Pi.ma". + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +(*#* +Sign properties: cosine is positive in +$(-\frac{\pi}2,\frac{\pi}2)$#(-π/2,π/2)#, sine in +$(0,\pi)$#(0,π)# and tangent in $(0,\frac{\pi}2)$#0,π/2)#. +*) + +inline "cic:/CoRN/transc/TrigMon/Cos_pos.con". + +inline "cic:/CoRN/transc/TrigMon/Sin_pos.con". + +inline "cic:/CoRN/transc/TrigMon/Tan_pos.con". + +inline "cic:/CoRN/transc/TrigMon/Cos_nonneg.con". + +inline "cic:/CoRN/transc/TrigMon/Sin_nonneg.con". + +(*#* Consequences. *) + +inline "cic:/CoRN/transc/TrigMon/Abs_Sin_less_One.con". + +inline "cic:/CoRN/transc/TrigMon/Abs_Cos_less_One.con". + +(*#* +Sine is (strictly) increasing in [[ [--]Pi[/]Two,Pi[/]Two]]; cosine +is (strictly) decreasing in [[Zero,Pi]]. +*) + +inline "cic:/CoRN/transc/TrigMon/Sin_resp_leEq.con". + +inline "cic:/CoRN/transc/TrigMon/Cos_resp_leEq.con". + +(* begin hide *) + +inline "cic:/CoRN/transc/TrigMon/Cos_resp_less_aux.con". + +inline "cic:/CoRN/transc/TrigMon/Cos_resp_less_aux'.con". + +(* end hide *) + +inline "cic:/CoRN/transc/TrigMon/Cos_resp_less.con". + +inline "cic:/CoRN/transc/TrigMon/Sin_resp_less.con". + +(* UNEXPORTED +Section Tangent +*) + +(*#* **Derivative of Tangent + +Finally, two formulas for the derivative of the tangent function and +monotonicity properties. +*) + +inline "cic:/CoRN/transc/TrigMon/bnd_Cos.con". + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +inline "cic:/CoRN/transc/TrigMon/Derivative_Tan_1.con". + +inline "cic:/CoRN/transc/TrigMon/Derivative_Tan_2.con". + +inline "cic:/CoRN/transc/TrigMon/Tan_resp_less.con". + +inline "cic:/CoRN/transc/TrigMon/Tan_resp_leEq.con". + +(* UNEXPORTED +End Tangent +*) + +(* UNEXPORTED +Hint Resolve Derivative_Tan_1 Derivative_Tan_2: derivate. +*) + diff --git a/matita/contribs/CoRN-Decl/transc/Trigonometric.ma b/matita/contribs/CoRN-Decl/transc/Trigonometric.ma new file mode 100644 index 000000000..b4f59a9a8 --- /dev/null +++ b/matita/contribs/CoRN-Decl/transc/Trigonometric.ma @@ -0,0 +1,216 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/CoRN-Decl/transc/Trigonometric". + +include "CoRN.ma". + +(* $Id: Trigonometric.v,v 1.5 2004/04/23 10:01:08 lcf Exp $ *) + +include "transc/TaylorSeries.ma". + +(*#* *The Trigonometric Functions + +In this section, we explore the properties of the trigonometric functions which we previously defined. +*) + +(* UNEXPORTED +Section Lemmas +*) + +(*#* First, we need a lemma on mappings. *) + +inline "cic:/CoRN/transc/Trigonometric/maps_translation.con". + +(* UNEXPORTED +End Lemmas +*) + +(* UNEXPORTED +Section Sine_and_Cosine +*) + +(*#* Sine, cosine and tangent at [Zero]. *) + +inline "cic:/CoRN/transc/Trigonometric/Sin_zero.con". + +inline "cic:/CoRN/transc/Trigonometric/Cos_zero.con". + +(* UNEXPORTED +Hint Resolve Sin_zero Cos_zero: algebra. +*) + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +inline "cic:/CoRN/transc/Trigonometric/Tan_zero.con". + +(* UNEXPORTED +Transparent Sine Cosine. +*) + +(*#* +Continuity of sine and cosine are trivial. +*) + +inline "cic:/CoRN/transc/Trigonometric/Continuous_Sin.con". + +inline "cic:/CoRN/transc/Trigonometric/Continuous_Cos.con". + +(*#* +The rules for the derivative of the sine and cosine function; we begin by proving that their defining sequences can be expressed in terms of one another. +*) + +inline "cic:/CoRN/transc/Trigonometric/cos_sin_seq.con". + +inline "cic:/CoRN/transc/Trigonometric/sin_cos_seq.con". + +inline "cic:/CoRN/transc/Trigonometric/Derivative_Sin.con". + +inline "cic:/CoRN/transc/Trigonometric/Derivative_Cos.con". + +(* UNEXPORTED +Hint Resolve Derivative_Sin Derivative_Cos: derivate. +*) + +(* UNEXPORTED +Hint Resolve Continuous_Sin Continuous_Cos: continuous. +*) + +(* UNEXPORTED +Section Sine_of_Sum +*) + +(*#* +We now prove the rule for the sine and cosine of the sum. These rules +have to be proved first as functional equalities, which is why we also +state the results in a function form (which we won't do in other +situations). + +%\begin{convention}% Let: + - [F := fun y => Sine[o] (FId{+} [-C-]y)]; + - [G := fun y => (Sine{*} [-C-] (Cos y)) {+} (Cosine{*} [-C-] (Sin y))]. + +%\end{convention}% +*) + +(* begin hide *) + +inline "cic:/CoRN/transc/Trigonometric/Sine_and_Cosine/Sine_of_Sum/F.con" "Sine_and_Cosine__Sine_of_Sum__". + +inline "cic:/CoRN/transc/Trigonometric/Sine_and_Cosine/Sine_of_Sum/G.con" "Sine_and_Cosine__Sine_of_Sum__". + +inline "cic:/CoRN/transc/Trigonometric/Sine_and_Cosine/Sine_of_Sum/F'.con" "Sine_and_Cosine__Sine_of_Sum__". + +inline "cic:/CoRN/transc/Trigonometric/Sine_and_Cosine/Sine_of_Sum/G'.con" "Sine_and_Cosine__Sine_of_Sum__". + +(* end hide *) + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +inline "cic:/CoRN/transc/Trigonometric/Sin_plus_Taylor_bnd_lft.con". + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +(* UNEXPORTED +Opaque FAbs. +*) + +(* UNEXPORTED +Transparent FAbs. +*) + +inline "cic:/CoRN/transc/Trigonometric/Sin_plus_Taylor_bnd_rht.con". + +inline "cic:/CoRN/transc/Trigonometric/Sin_plus_eq.con". + +inline "cic:/CoRN/transc/Trigonometric/Sin_plus_der_lft.con". + +inline "cic:/CoRN/transc/Trigonometric/Sin_plus_der_rht.con". + +inline "cic:/CoRN/transc/Trigonometric/Sin_plus_fun.con". + +(* UNEXPORTED +End Sine_of_Sum +*) + +(* UNEXPORTED +Opaque Sine Cosine. +*) + +inline "cic:/CoRN/transc/Trigonometric/Cos_plus_fun.con". + +(* UNEXPORTED +End Sine_and_Cosine +*) + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/blt/defs.ma b/matita/contribs/LAMBDA-TYPES/Base-1/blt/defs.ma new file mode 100644 index 000000000..4864a2c86 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/blt/defs.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/blt/defs". + +include "preamble.ma". + +definition blt: + nat \to (nat \to bool) +\def + let rec blt (m: nat) (n: nat) on n: bool \def (match n with [O \Rightarrow +false | (S n0) \Rightarrow (match m with [O \Rightarrow true | (S m0) +\Rightarrow (blt m0 n0)])]) in blt. + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/blt/props.ma b/matita/contribs/LAMBDA-TYPES/Base-1/blt/props.ma new file mode 100644 index 000000000..c7952ebd2 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/blt/props.ma @@ -0,0 +1,102 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/blt/props". + +include "blt/defs.ma". + +theorem lt_blt: + \forall (x: nat).(\forall (y: nat).((lt y x) \to (eq bool (blt y x) true))) +\def + \lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (y: nat).((lt y n) \to +(eq bool (blt y n) true)))) (\lambda (y: nat).(\lambda (H: (lt y O)).(let H0 +\def (match H in le return (\lambda (n: nat).(\lambda (_: (le ? n)).((eq nat +n O) \to (eq bool (blt y O) true)))) with [le_n \Rightarrow (\lambda (H0: (eq +nat (S y) O)).(let H1 \def (eq_ind nat (S y) (\lambda (e: nat).(match e in +nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H0) in (False_ind (eq bool (blt y O) true) H1))) | +(le_S m H0) \Rightarrow (\lambda (H1: (eq nat (S m) O)).((let H2 \def (eq_ind +nat (S m) (\lambda (e: nat).(match e in nat return (\lambda (_: nat).Prop) +with [O \Rightarrow False | (S _) \Rightarrow True])) I O H1) in (False_ind +((le (S y) m) \to (eq bool (blt y O) true)) H2)) H0))]) in (H0 (refl_equal +nat O))))) (\lambda (n: nat).(\lambda (H: ((\forall (y: nat).((lt y n) \to +(eq bool (blt y n) true))))).(\lambda (y: nat).(nat_ind (\lambda (n0: +nat).((lt n0 (S n)) \to (eq bool (blt n0 (S n)) true))) (\lambda (_: (lt O (S +n))).(refl_equal bool true)) (\lambda (n0: nat).(\lambda (_: (((lt n0 (S n)) +\to (eq bool (match n0 with [O \Rightarrow true | (S m) \Rightarrow (blt m +n)]) true)))).(\lambda (H1: (lt (S n0) (S n))).(H n0 (le_S_n (S n0) n H1))))) +y)))) x). + +theorem le_bge: + \forall (x: nat).(\forall (y: nat).((le x y) \to (eq bool (blt y x) false))) +\def + \lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (y: nat).((le n y) \to +(eq bool (blt y n) false)))) (\lambda (y: nat).(\lambda (_: (le O +y)).(refl_equal bool false))) (\lambda (n: nat).(\lambda (H: ((\forall (y: +nat).((le n y) \to (eq bool (blt y n) false))))).(\lambda (y: nat).(nat_ind +(\lambda (n0: nat).((le (S n) n0) \to (eq bool (blt n0 (S n)) false))) +(\lambda (H0: (le (S n) O)).(let H1 \def (match H0 in le return (\lambda (n0: +nat).(\lambda (_: (le ? n0)).((eq nat n0 O) \to (eq bool (blt O (S n)) +false)))) with [le_n \Rightarrow (\lambda (H1: (eq nat (S n) O)).(let H2 \def +(eq_ind nat (S n) (\lambda (e: nat).(match e in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H1) in +(False_ind (eq bool (blt O (S n)) false) H2))) | (le_S m H1) \Rightarrow +(\lambda (H2: (eq nat (S m) O)).((let H3 \def (eq_ind nat (S m) (\lambda (e: +nat).(match e in nat return (\lambda (_: nat).Prop) with [O \Rightarrow False +| (S _) \Rightarrow True])) I O H2) in (False_ind ((le (S n) m) \to (eq bool +(blt O (S n)) false)) H3)) H1))]) in (H1 (refl_equal nat O)))) (\lambda (n0: +nat).(\lambda (_: (((le (S n) n0) \to (eq bool (blt n0 (S n)) +false)))).(\lambda (H1: (le (S n) (S n0))).(H n0 (le_S_n n n0 H1))))) y)))) +x). + +theorem blt_lt: + \forall (x: nat).(\forall (y: nat).((eq bool (blt y x) true) \to (lt y x))) +\def + \lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (y: nat).((eq bool (blt +y n) true) \to (lt y n)))) (\lambda (y: nat).(\lambda (H: (eq bool (blt y O) +true)).(let H0 \def (match H in eq return (\lambda (b: bool).(\lambda (_: (eq +? ? b)).((eq bool b true) \to (lt y O)))) with [refl_equal \Rightarrow +(\lambda (H0: (eq bool (blt y O) true)).(let H1 \def (eq_ind bool (blt y O) +(\lambda (e: bool).(match e in bool return (\lambda (_: bool).Prop) with +[true \Rightarrow False | false \Rightarrow True])) I true H0) in (False_ind +(lt y O) H1)))]) in (H0 (refl_equal bool true))))) (\lambda (n: nat).(\lambda +(H: ((\forall (y: nat).((eq bool (blt y n) true) \to (lt y n))))).(\lambda +(y: nat).(nat_ind (\lambda (n0: nat).((eq bool (blt n0 (S n)) true) \to (lt +n0 (S n)))) (\lambda (_: (eq bool true true)).(le_S_n (S O) (S n) (le_n_S (S +O) (S n) (le_n_S O n (le_O_n n))))) (\lambda (n0: nat).(\lambda (_: (((eq +bool (match n0 with [O \Rightarrow true | (S m) \Rightarrow (blt m n)]) true) +\to (lt n0 (S n))))).(\lambda (H1: (eq bool (blt n0 n) true)).(lt_le_S (S n0) +(S n) (lt_n_S n0 n (H n0 H1)))))) y)))) x). + +theorem bge_le: + \forall (x: nat).(\forall (y: nat).((eq bool (blt y x) false) \to (le x y))) +\def + \lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (y: nat).((eq bool (blt +y n) false) \to (le n y)))) (\lambda (y: nat).(\lambda (_: (eq bool (blt y O) +false)).(le_O_n y))) (\lambda (n: nat).(\lambda (H: ((\forall (y: nat).((eq +bool (blt y n) false) \to (le n y))))).(\lambda (y: nat).(nat_ind (\lambda +(n0: nat).((eq bool (blt n0 (S n)) false) \to (le (S n) n0))) (\lambda (H0: +(eq bool (blt O (S n)) false)).(let H1 \def (match H0 in eq return (\lambda +(b: bool).(\lambda (_: (eq ? ? b)).((eq bool b false) \to (le (S n) O)))) +with [refl_equal \Rightarrow (\lambda (H1: (eq bool (blt O (S n)) +false)).(let H2 \def (eq_ind bool (blt O (S n)) (\lambda (e: bool).(match e +in bool return (\lambda (_: bool).Prop) with [true \Rightarrow True | false +\Rightarrow False])) I false H1) in (False_ind (le (S n) O) H2)))]) in (H1 +(refl_equal bool false)))) (\lambda (n0: nat).(\lambda (_: (((eq bool (blt n0 +(S n)) false) \to (le (S n) n0)))).(\lambda (H1: (eq bool (blt (S n0) (S n)) +false)).(le_S_n (S n) (S n0) (le_n_S (S n) (S n0) (le_n_S n n0 (H n0 +H1))))))) y)))) x). + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/definitions.ma b/matita/contribs/LAMBDA-TYPES/Base-1/definitions.ma new file mode 100644 index 000000000..ec3212d25 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/definitions.ma @@ -0,0 +1,24 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/definitions". + +include "types/defs.ma". + +include "blt/defs.ma". + +include "plist/defs.ma". + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/ext/arith.ma b/matita/contribs/LAMBDA-TYPES/Base-1/ext/arith.ma new file mode 100644 index 000000000..e8a076513 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/ext/arith.ma @@ -0,0 +1,613 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith". + +include "preamble.ma". + +theorem nat_dec: + \forall (n1: nat).(\forall (n2: nat).(or (eq nat n1 n2) ((eq nat n1 n2) \to +(\forall (P: Prop).P)))) +\def + \lambda (n1: nat).(nat_ind (\lambda (n: nat).(\forall (n2: nat).(or (eq nat +n n2) ((eq nat n n2) \to (\forall (P: Prop).P))))) (\lambda (n2: +nat).(nat_ind (\lambda (n: nat).(or (eq nat O n) ((eq nat O n) \to (\forall +(P: Prop).P)))) (or_introl (eq nat O O) ((eq nat O O) \to (\forall (P: +Prop).P)) (refl_equal nat O)) (\lambda (n: nat).(\lambda (_: (or (eq nat O n) +((eq nat O n) \to (\forall (P: Prop).P)))).(or_intror (eq nat O (S n)) ((eq +nat O (S n)) \to (\forall (P: Prop).P)) (\lambda (H0: (eq nat O (S +n))).(\lambda (P: Prop).(let H1 \def (eq_ind nat O (\lambda (ee: nat).(match +ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) +\Rightarrow False])) I (S n) H0) in (False_ind P H1))))))) n2)) (\lambda (n: +nat).(\lambda (H: ((\forall (n2: nat).(or (eq nat n n2) ((eq nat n n2) \to +(\forall (P: Prop).P)))))).(\lambda (n2: nat).(nat_ind (\lambda (n0: nat).(or +(eq nat (S n) n0) ((eq nat (S n) n0) \to (\forall (P: Prop).P)))) (or_intror +(eq nat (S n) O) ((eq nat (S n) O) \to (\forall (P: Prop).P)) (\lambda (H0: +(eq nat (S n) O)).(\lambda (P: Prop).(let H1 \def (eq_ind nat (S n) (\lambda +(ee: nat).(match ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +False | (S _) \Rightarrow True])) I O H0) in (False_ind P H1))))) (\lambda +(n0: nat).(\lambda (H0: (or (eq nat (S n) n0) ((eq nat (S n) n0) \to (\forall +(P: Prop).P)))).(or_ind (eq nat n n0) ((eq nat n n0) \to (\forall (P: +Prop).P)) (or (eq nat (S n) (S n0)) ((eq nat (S n) (S n0)) \to (\forall (P: +Prop).P))) (\lambda (H1: (eq nat n n0)).(let H2 \def (eq_ind_r nat n0 +(\lambda (n3: nat).(or (eq nat (S n) n3) ((eq nat (S n) n3) \to (\forall (P: +Prop).P)))) H0 n H1) in (eq_ind nat n (\lambda (n3: nat).(or (eq nat (S n) (S +n3)) ((eq nat (S n) (S n3)) \to (\forall (P: Prop).P)))) (or_introl (eq nat +(S n) (S n)) ((eq nat (S n) (S n)) \to (\forall (P: Prop).P)) (refl_equal nat +(S n))) n0 H1))) (\lambda (H1: (((eq nat n n0) \to (\forall (P: +Prop).P)))).(or_intror (eq nat (S n) (S n0)) ((eq nat (S n) (S n0)) \to +(\forall (P: Prop).P)) (\lambda (H2: (eq nat (S n) (S n0))).(\lambda (P: +Prop).(let H3 \def (f_equal nat nat (\lambda (e: nat).(match e in nat return +(\lambda (_: nat).nat) with [O \Rightarrow n | (S n3) \Rightarrow n3])) (S n) +(S n0) H2) in (let H4 \def (eq_ind_r nat n0 (\lambda (n3: nat).((eq nat n n3) +\to (\forall (P0: Prop).P0))) H1 n H3) in (let H5 \def (eq_ind_r nat n0 +(\lambda (n3: nat).(or (eq nat (S n) n3) ((eq nat (S n) n3) \to (\forall (P0: +Prop).P0)))) H0 n H3) in (H4 (refl_equal nat n) P)))))))) (H n0)))) n2)))) +n1). + +theorem simpl_plus_r: + \forall (n: nat).(\forall (m: nat).(\forall (p: nat).((eq nat (plus m n) +(plus p n)) \to (eq nat m p)))) +\def + \lambda (n: nat).(\lambda (m: nat).(\lambda (p: nat).(\lambda (H: (eq nat +(plus m n) (plus p n))).(plus_reg_l n m p (eq_ind_r nat (plus m n) (\lambda +(n0: nat).(eq nat n0 (plus n p))) (eq_ind_r nat (plus p n) (\lambda (n0: +nat).(eq nat n0 (plus n p))) (sym_eq nat (plus n p) (plus p n) (plus_comm n +p)) (plus m n) H) (plus n m) (plus_comm n m)))))). + +theorem minus_plus_r: + \forall (m: nat).(\forall (n: nat).(eq nat (minus (plus m n) n) m)) +\def + \lambda (m: nat).(\lambda (n: nat).(eq_ind_r nat (plus n m) (\lambda (n0: +nat).(eq nat (minus n0 n) m)) (minus_plus n m) (plus m n) (plus_comm m n))). + +theorem plus_permute_2_in_3: + \forall (x: nat).(\forall (y: nat).(\forall (z: nat).(eq nat (plus (plus x +y) z) (plus (plus x z) y)))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (z: nat).(eq_ind_r nat (plus x +(plus y z)) (\lambda (n: nat).(eq nat n (plus (plus x z) y))) (eq_ind_r nat +(plus z y) (\lambda (n: nat).(eq nat (plus x n) (plus (plus x z) y))) (eq_ind +nat (plus (plus x z) y) (\lambda (n: nat).(eq nat n (plus (plus x z) y))) +(refl_equal nat (plus (plus x z) y)) (plus x (plus z y)) (plus_assoc_reverse +x z y)) (plus y z) (plus_comm y z)) (plus (plus x y) z) (plus_assoc_reverse x +y z)))). + +theorem plus_permute_2_in_3_assoc: + \forall (n: nat).(\forall (h: nat).(\forall (k: nat).(eq nat (plus (plus n +h) k) (plus n (plus k h))))) +\def + \lambda (n: nat).(\lambda (h: nat).(\lambda (k: nat).(eq_ind_r nat (plus +(plus n k) h) (\lambda (n0: nat).(eq nat n0 (plus n (plus k h)))) (eq_ind_r +nat (plus (plus n k) h) (\lambda (n0: nat).(eq nat (plus (plus n k) h) n0)) +(refl_equal nat (plus (plus n k) h)) (plus n (plus k h)) (plus_assoc n k h)) +(plus (plus n h) k) (plus_permute_2_in_3 n h k)))). + +theorem plus_O: + \forall (x: nat).(\forall (y: nat).((eq nat (plus x y) O) \to (land (eq nat +x O) (eq nat y O)))) +\def + \lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (y: nat).((eq nat (plus +n y) O) \to (land (eq nat n O) (eq nat y O))))) (\lambda (y: nat).(\lambda +(H: (eq nat (plus O y) O)).(conj (eq nat O O) (eq nat y O) (refl_equal nat O) +H))) (\lambda (n: nat).(\lambda (_: ((\forall (y: nat).((eq nat (plus n y) O) +\to (land (eq nat n O) (eq nat y O)))))).(\lambda (y: nat).(\lambda (H0: (eq +nat (plus (S n) y) O)).(let H1 \def (match H0 in eq return (\lambda (n0: +nat).(\lambda (_: (eq ? ? n0)).((eq nat n0 O) \to (land (eq nat (S n) O) (eq +nat y O))))) with [refl_equal \Rightarrow (\lambda (H1: (eq nat (plus (S n) +y) O)).(let H2 \def (eq_ind nat (plus (S n) y) (\lambda (e: nat).(match e in +nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H1) in (False_ind (land (eq nat (S n) O) (eq nat y +O)) H2)))]) in (H1 (refl_equal nat O))))))) x). + +theorem minus_Sx_SO: + \forall (x: nat).(eq nat (minus (S x) (S O)) x) +\def + \lambda (x: nat).(eq_ind nat x (\lambda (n: nat).(eq nat n x)) (refl_equal +nat x) (minus x O) (minus_n_O x)). + +theorem eq_nat_dec: + \forall (i: nat).(\forall (j: nat).(or (not (eq nat i j)) (eq nat i j))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (j: nat).(or (not (eq +nat n j)) (eq nat n j)))) (\lambda (j: nat).(nat_ind (\lambda (n: nat).(or +(not (eq nat O n)) (eq nat O n))) (or_intror (not (eq nat O O)) (eq nat O O) +(refl_equal nat O)) (\lambda (n: nat).(\lambda (_: (or (not (eq nat O n)) (eq +nat O n))).(or_introl (not (eq nat O (S n))) (eq nat O (S n)) (O_S n)))) j)) +(\lambda (n: nat).(\lambda (H: ((\forall (j: nat).(or (not (eq nat n j)) (eq +nat n j))))).(\lambda (j: nat).(nat_ind (\lambda (n0: nat).(or (not (eq nat +(S n) n0)) (eq nat (S n) n0))) (or_introl (not (eq nat (S n) O)) (eq nat (S +n) O) (sym_not_eq nat O (S n) (O_S n))) (\lambda (n0: nat).(\lambda (_: (or +(not (eq nat (S n) n0)) (eq nat (S n) n0))).(or_ind (not (eq nat n n0)) (eq +nat n n0) (or (not (eq nat (S n) (S n0))) (eq nat (S n) (S n0))) (\lambda +(H1: (not (eq nat n n0))).(or_introl (not (eq nat (S n) (S n0))) (eq nat (S +n) (S n0)) (not_eq_S n n0 H1))) (\lambda (H1: (eq nat n n0)).(or_intror (not +(eq nat (S n) (S n0))) (eq nat (S n) (S n0)) (f_equal nat nat S n n0 H1))) (H +n0)))) j)))) i). + +theorem neq_eq_e: + \forall (i: nat).(\forall (j: nat).(\forall (P: Prop).((((not (eq nat i j)) +\to P)) \to ((((eq nat i j) \to P)) \to P)))) +\def + \lambda (i: nat).(\lambda (j: nat).(\lambda (P: Prop).(\lambda (H: (((not +(eq nat i j)) \to P))).(\lambda (H0: (((eq nat i j) \to P))).(let o \def +(eq_nat_dec i j) in (or_ind (not (eq nat i j)) (eq nat i j) P H H0 o)))))). + +theorem le_false: + \forall (m: nat).(\forall (n: nat).(\forall (P: Prop).((le m n) \to ((le (S +n) m) \to P)))) +\def + \lambda (m: nat).(nat_ind (\lambda (n: nat).(\forall (n0: nat).(\forall (P: +Prop).((le n n0) \to ((le (S n0) n) \to P))))) (\lambda (n: nat).(\lambda (P: +Prop).(\lambda (_: (le O n)).(\lambda (H0: (le (S n) O)).(let H1 \def (match +H0 in le return (\lambda (n0: nat).(\lambda (_: (le ? n0)).((eq nat n0 O) \to +P))) with [le_n \Rightarrow (\lambda (H1: (eq nat (S n) O)).(let H2 \def +(eq_ind nat (S n) (\lambda (e: nat).(match e in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H1) in +(False_ind P H2))) | (le_S m0 H1) \Rightarrow (\lambda (H2: (eq nat (S m0) +O)).((let H3 \def (eq_ind nat (S m0) (\lambda (e: nat).(match e in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) +I O H2) in (False_ind ((le (S n) m0) \to P) H3)) H1))]) in (H1 (refl_equal +nat O))))))) (\lambda (n: nat).(\lambda (H: ((\forall (n0: nat).(\forall (P: +Prop).((le n n0) \to ((le (S n0) n) \to P)))))).(\lambda (n0: nat).(nat_ind +(\lambda (n1: nat).(\forall (P: Prop).((le (S n) n1) \to ((le (S n1) (S n)) +\to P)))) (\lambda (P: Prop).(\lambda (H0: (le (S n) O)).(\lambda (_: (le (S +O) (S n))).(let H2 \def (match H0 in le return (\lambda (n1: nat).(\lambda +(_: (le ? n1)).((eq nat n1 O) \to P))) with [le_n \Rightarrow (\lambda (H2: +(eq nat (S n) O)).(let H3 \def (eq_ind nat (S n) (\lambda (e: nat).(match e +in nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H2) in (False_ind P H3))) | (le_S m0 H2) \Rightarrow +(\lambda (H3: (eq nat (S m0) O)).((let H4 \def (eq_ind nat (S m0) (\lambda +(e: nat).(match e in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +False | (S _) \Rightarrow True])) I O H3) in (False_ind ((le (S n) m0) \to P) +H4)) H2))]) in (H2 (refl_equal nat O)))))) (\lambda (n1: nat).(\lambda (_: +((\forall (P: Prop).((le (S n) n1) \to ((le (S n1) (S n)) \to P))))).(\lambda +(P: Prop).(\lambda (H1: (le (S n) (S n1))).(\lambda (H2: (le (S (S n1)) (S +n))).(H n1 P (le_S_n n n1 H1) (le_S_n (S n1) n H2))))))) n0)))) m). + +theorem le_Sx_x: + \forall (x: nat).((le (S x) x) \to (\forall (P: Prop).P)) +\def + \lambda (x: nat).(\lambda (H: (le (S x) x)).(\lambda (P: Prop).(let H0 \def +le_Sn_n in (False_ind P (H0 x H))))). + +theorem le_n_pred: + \forall (n: nat).(\forall (m: nat).((le n m) \to (le (pred n) (pred m)))) +\def + \lambda (n: nat).(\lambda (m: nat).(\lambda (H: (le n m)).(le_ind n (\lambda +(n0: nat).(le (pred n) (pred n0))) (le_n (pred n)) (\lambda (m0: +nat).(\lambda (_: (le n m0)).(\lambda (H1: (le (pred n) (pred m0))).(le_trans +(pred n) (pred m0) m0 H1 (le_pred_n m0))))) m H))). + +theorem minus_le: + \forall (x: nat).(\forall (y: nat).(le (minus x y) x)) +\def + \lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (y: nat).(le (minus n +y) n))) (\lambda (_: nat).(le_n O)) (\lambda (n: nat).(\lambda (H: ((\forall +(y: nat).(le (minus n y) n)))).(\lambda (y: nat).(nat_ind (\lambda (n0: +nat).(le (minus (S n) n0) (S n))) (le_n (S n)) (\lambda (n0: nat).(\lambda +(_: (le (match n0 with [O \Rightarrow (S n) | (S l) \Rightarrow (minus n l)]) +(S n))).(le_S (minus n n0) n (H n0)))) y)))) x). + +theorem le_plus_minus_sym: + \forall (n: nat).(\forall (m: nat).((le n m) \to (eq nat m (plus (minus m n) +n)))) +\def + \lambda (n: nat).(\lambda (m: nat).(\lambda (H: (le n m)).(eq_ind_r nat +(plus n (minus m n)) (\lambda (n0: nat).(eq nat m n0)) (le_plus_minus n m H) +(plus (minus m n) n) (plus_comm (minus m n) n)))). + +theorem le_minus_minus: + \forall (x: nat).(\forall (y: nat).((le x y) \to (\forall (z: nat).((le y z) +\to (le (minus y x) (minus z x)))))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (H: (le x y)).(\lambda (z: +nat).(\lambda (H0: (le y z)).(plus_le_reg_l x (minus y x) (minus z x) +(eq_ind_r nat y (\lambda (n: nat).(le n (plus x (minus z x)))) (eq_ind_r nat +z (\lambda (n: nat).(le y n)) H0 (plus x (minus z x)) (le_plus_minus_r x z +(le_trans x y z H H0))) (plus x (minus y x)) (le_plus_minus_r x y H))))))). + +theorem le_minus_plus: + \forall (z: nat).(\forall (x: nat).((le z x) \to (\forall (y: nat).(eq nat +(minus (plus x y) z) (plus (minus x z) y))))) +\def + \lambda (z: nat).(nat_ind (\lambda (n: nat).(\forall (x: nat).((le n x) \to +(\forall (y: nat).(eq nat (minus (plus x y) n) (plus (minus x n) y)))))) +(\lambda (x: nat).(\lambda (H: (le O x)).(let H0 \def (match H in le return +(\lambda (n: nat).(\lambda (_: (le ? n)).((eq nat n x) \to (\forall (y: +nat).(eq nat (minus (plus x y) O) (plus (minus x O) y)))))) with [le_n +\Rightarrow (\lambda (H0: (eq nat O x)).(eq_ind nat O (\lambda (n: +nat).(\forall (y: nat).(eq nat (minus (plus n y) O) (plus (minus n O) y)))) +(\lambda (y: nat).(sym_eq nat (plus (minus O O) y) (minus (plus O y) O) +(minus_n_O (plus O y)))) x H0)) | (le_S m H0) \Rightarrow (\lambda (H1: (eq +nat (S m) x)).(eq_ind nat (S m) (\lambda (n: nat).((le O m) \to (\forall (y: +nat).(eq nat (minus (plus n y) O) (plus (minus n O) y))))) (\lambda (_: (le O +m)).(\lambda (y: nat).(refl_equal nat (plus (minus (S m) O) y)))) x H1 H0))]) +in (H0 (refl_equal nat x))))) (\lambda (z0: nat).(\lambda (H: ((\forall (x: +nat).((le z0 x) \to (\forall (y: nat).(eq nat (minus (plus x y) z0) (plus +(minus x z0) y))))))).(\lambda (x: nat).(nat_ind (\lambda (n: nat).((le (S +z0) n) \to (\forall (y: nat).(eq nat (minus (plus n y) (S z0)) (plus (minus n +(S z0)) y))))) (\lambda (H0: (le (S z0) O)).(\lambda (y: nat).(let H1 \def +(match H0 in le return (\lambda (n: nat).(\lambda (_: (le ? n)).((eq nat n O) +\to (eq nat (minus (plus O y) (S z0)) (plus (minus O (S z0)) y))))) with +[le_n \Rightarrow (\lambda (H1: (eq nat (S z0) O)).(let H2 \def (eq_ind nat +(S z0) (\lambda (e: nat).(match e in nat return (\lambda (_: nat).Prop) with +[O \Rightarrow False | (S _) \Rightarrow True])) I O H1) in (False_ind (eq +nat (minus (plus O y) (S z0)) (plus (minus O (S z0)) y)) H2))) | (le_S m H1) +\Rightarrow (\lambda (H2: (eq nat (S m) O)).((let H3 \def (eq_ind nat (S m) +(\lambda (e: nat).(match e in nat return (\lambda (_: nat).Prop) with [O +\Rightarrow False | (S _) \Rightarrow True])) I O H2) in (False_ind ((le (S +z0) m) \to (eq nat (minus (plus O y) (S z0)) (plus (minus O (S z0)) y))) H3)) +H1))]) in (H1 (refl_equal nat O))))) (\lambda (n: nat).(\lambda (_: (((le (S +z0) n) \to (\forall (y: nat).(eq nat (minus (plus n y) (S z0)) (plus (minus n +(S z0)) y)))))).(\lambda (H1: (le (S z0) (S n))).(\lambda (y: nat).(H n +(le_S_n z0 n H1) y))))) x)))) z). + +theorem le_minus: + \forall (x: nat).(\forall (z: nat).(\forall (y: nat).((le (plus x y) z) \to +(le x (minus z y))))) +\def + \lambda (x: nat).(\lambda (z: nat).(\lambda (y: nat).(\lambda (H: (le (plus +x y) z)).(eq_ind nat (minus (plus x y) y) (\lambda (n: nat).(le n (minus z +y))) (le_minus_minus y (plus x y) (le_plus_r x y) z H) x (minus_plus_r x +y))))). + +theorem le_trans_plus_r: + \forall (x: nat).(\forall (y: nat).(\forall (z: nat).((le (plus x y) z) \to +(le y z)))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (z: nat).(\lambda (H: (le (plus +x y) z)).(le_trans y (plus x y) z (le_plus_r x y) H)))). + +theorem lt_x_O: + \forall (x: nat).((lt x O) \to (\forall (P: Prop).P)) +\def + \lambda (x: nat).(\lambda (H: (le (S x) O)).(\lambda (P: Prop).(let H_y \def +(le_n_O_eq (S x) H) in (let H0 \def (eq_ind nat O (\lambda (ee: nat).(match +ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) +\Rightarrow False])) I (S x) H_y) in (False_ind P H0))))). + +theorem le_gen_S: + \forall (m: nat).(\forall (x: nat).((le (S m) x) \to (ex2 nat (\lambda (n: +nat).(eq nat x (S n))) (\lambda (n: nat).(le m n))))) +\def + \lambda (m: nat).(\lambda (x: nat).(\lambda (H: (le (S m) x)).(let H0 \def +(match H in le return (\lambda (n: nat).(\lambda (_: (le ? n)).((eq nat n x) +\to (ex2 nat (\lambda (n0: nat).(eq nat x (S n0))) (\lambda (n0: nat).(le m +n0)))))) with [le_n \Rightarrow (\lambda (H0: (eq nat (S m) x)).(eq_ind nat +(S m) (\lambda (n: nat).(ex2 nat (\lambda (n0: nat).(eq nat n (S n0))) +(\lambda (n0: nat).(le m n0)))) (ex_intro2 nat (\lambda (n: nat).(eq nat (S +m) (S n))) (\lambda (n: nat).(le m n)) m (refl_equal nat (S m)) (le_n m)) x +H0)) | (le_S m0 H0) \Rightarrow (\lambda (H1: (eq nat (S m0) x)).(eq_ind nat +(S m0) (\lambda (n: nat).((le (S m) m0) \to (ex2 nat (\lambda (n0: nat).(eq +nat n (S n0))) (\lambda (n0: nat).(le m n0))))) (\lambda (H2: (le (S m) +m0)).(ex_intro2 nat (\lambda (n: nat).(eq nat (S m0) (S n))) (\lambda (n: +nat).(le m n)) m0 (refl_equal nat (S m0)) (le_S_n m m0 (le_S (S m) m0 H2)))) +x H1 H0))]) in (H0 (refl_equal nat x))))). + +theorem lt_x_plus_x_Sy: + \forall (x: nat).(\forall (y: nat).(lt x (plus x (S y)))) +\def + \lambda (x: nat).(\lambda (y: nat).(eq_ind_r nat (plus (S y) x) (\lambda (n: +nat).(lt x n)) (le_S_n (S x) (S (plus y x)) (le_n_S (S x) (S (plus y x)) +(le_n_S x (plus y x) (le_plus_r y x)))) (plus x (S y)) (plus_comm x (S y)))). + +theorem simpl_lt_plus_r: + \forall (p: nat).(\forall (n: nat).(\forall (m: nat).((lt (plus n p) (plus m +p)) \to (lt n m)))) +\def + \lambda (p: nat).(\lambda (n: nat).(\lambda (m: nat).(\lambda (H: (lt (plus +n p) (plus m p))).(plus_lt_reg_l n m p (let H0 \def (eq_ind nat (plus n p) +(\lambda (n0: nat).(lt n0 (plus m p))) H (plus p n) (plus_comm n p)) in (let +H1 \def (eq_ind nat (plus m p) (\lambda (n0: nat).(lt (plus p n) n0)) H0 +(plus p m) (plus_comm m p)) in H1)))))). + +theorem minus_x_Sy: + \forall (x: nat).(\forall (y: nat).((lt y x) \to (eq nat (minus x y) (S +(minus x (S y)))))) +\def + \lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (y: nat).((lt y n) \to +(eq nat (minus n y) (S (minus n (S y))))))) (\lambda (y: nat).(\lambda (H: +(lt y O)).(let H0 \def (match H in le return (\lambda (n: nat).(\lambda (_: +(le ? n)).((eq nat n O) \to (eq nat (minus O y) (S (minus O (S y))))))) with +[le_n \Rightarrow (\lambda (H0: (eq nat (S y) O)).(let H1 \def (eq_ind nat (S +y) (\lambda (e: nat).(match e in nat return (\lambda (_: nat).Prop) with [O +\Rightarrow False | (S _) \Rightarrow True])) I O H0) in (False_ind (eq nat +(minus O y) (S (minus O (S y)))) H1))) | (le_S m H0) \Rightarrow (\lambda +(H1: (eq nat (S m) O)).((let H2 \def (eq_ind nat (S m) (\lambda (e: +nat).(match e in nat return (\lambda (_: nat).Prop) with [O \Rightarrow False +| (S _) \Rightarrow True])) I O H1) in (False_ind ((le (S y) m) \to (eq nat +(minus O y) (S (minus O (S y))))) H2)) H0))]) in (H0 (refl_equal nat O))))) +(\lambda (n: nat).(\lambda (H: ((\forall (y: nat).((lt y n) \to (eq nat +(minus n y) (S (minus n (S y)))))))).(\lambda (y: nat).(nat_ind (\lambda (n0: +nat).((lt n0 (S n)) \to (eq nat (minus (S n) n0) (S (minus (S n) (S n0)))))) +(\lambda (_: (lt O (S n))).(eq_ind nat n (\lambda (n0: nat).(eq nat (S n) (S +n0))) (refl_equal nat (S n)) (minus n O) (minus_n_O n))) (\lambda (n0: +nat).(\lambda (_: (((lt n0 (S n)) \to (eq nat (minus (S n) n0) (S (minus (S +n) (S n0))))))).(\lambda (H1: (lt (S n0) (S n))).(let H2 \def (le_S_n (S n0) +n H1) in (H n0 H2))))) y)))) x). + +theorem lt_plus_minus: + \forall (x: nat).(\forall (y: nat).((lt x y) \to (eq nat y (S (plus x (minus +y (S x))))))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (H: (lt x y)).(le_plus_minus (S +x) y H))). + +theorem lt_plus_minus_r: + \forall (x: nat).(\forall (y: nat).((lt x y) \to (eq nat y (S (plus (minus y +(S x)) x))))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (H: (lt x y)).(eq_ind_r nat +(plus x (minus y (S x))) (\lambda (n: nat).(eq nat y (S n))) (lt_plus_minus x +y H) (plus (minus y (S x)) x) (plus_comm (minus y (S x)) x)))). + +theorem minus_x_SO: + \forall (x: nat).((lt O x) \to (eq nat x (S (minus x (S O))))) +\def + \lambda (x: nat).(\lambda (H: (lt O x)).(eq_ind nat (minus x O) (\lambda (n: +nat).(eq nat x n)) (eq_ind nat x (\lambda (n: nat).(eq nat x n)) (refl_equal +nat x) (minus x O) (minus_n_O x)) (S (minus x (S O))) (minus_x_Sy x O H))). + +theorem le_x_pred_y: + \forall (y: nat).(\forall (x: nat).((lt x y) \to (le x (pred y)))) +\def + \lambda (y: nat).(nat_ind (\lambda (n: nat).(\forall (x: nat).((lt x n) \to +(le x (pred n))))) (\lambda (x: nat).(\lambda (H: (lt x O)).(let H0 \def +(match H in le return (\lambda (n: nat).(\lambda (_: (le ? n)).((eq nat n O) +\to (le x O)))) with [le_n \Rightarrow (\lambda (H0: (eq nat (S x) O)).(let +H1 \def (eq_ind nat (S x) (\lambda (e: nat).(match e in nat return (\lambda +(_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H0) +in (False_ind (le x O) H1))) | (le_S m H0) \Rightarrow (\lambda (H1: (eq nat +(S m) O)).((let H2 \def (eq_ind nat (S m) (\lambda (e: nat).(match e in nat +return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow +True])) I O H1) in (False_ind ((le (S x) m) \to (le x O)) H2)) H0))]) in (H0 +(refl_equal nat O))))) (\lambda (n: nat).(\lambda (_: ((\forall (x: nat).((lt +x n) \to (le x (pred n)))))).(\lambda (x: nat).(\lambda (H0: (lt x (S +n))).(le_S_n x n H0))))) y). + +theorem lt_le_minus: + \forall (x: nat).(\forall (y: nat).((lt x y) \to (le x (minus y (S O))))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (H: (lt x y)).(le_minus x y (S +O) (eq_ind_r nat (plus (S O) x) (\lambda (n: nat).(le n y)) H (plus x (S O)) +(plus_comm x (S O)))))). + +theorem lt_le_e: + \forall (n: nat).(\forall (d: nat).(\forall (P: Prop).((((lt n d) \to P)) +\to ((((le d n) \to P)) \to P)))) +\def + \lambda (n: nat).(\lambda (d: nat).(\lambda (P: Prop).(\lambda (H: (((lt n +d) \to P))).(\lambda (H0: (((le d n) \to P))).(let H1 \def (le_or_lt d n) in +(or_ind (le d n) (lt n d) P H0 H H1)))))). + +theorem lt_eq_e: + \forall (x: nat).(\forall (y: nat).(\forall (P: Prop).((((lt x y) \to P)) +\to ((((eq nat x y) \to P)) \to ((le x y) \to P))))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (P: Prop).(\lambda (H: (((lt x +y) \to P))).(\lambda (H0: (((eq nat x y) \to P))).(\lambda (H1: (le x +y)).(or_ind (lt x y) (eq nat x y) P H H0 (le_lt_or_eq x y H1))))))). + +theorem lt_eq_gt_e: + \forall (x: nat).(\forall (y: nat).(\forall (P: Prop).((((lt x y) \to P)) +\to ((((eq nat x y) \to P)) \to ((((lt y x) \to P)) \to P))))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (P: Prop).(\lambda (H: (((lt x +y) \to P))).(\lambda (H0: (((eq nat x y) \to P))).(\lambda (H1: (((lt y x) +\to P))).(lt_le_e x y P H (\lambda (H2: (le y x)).(lt_eq_e y x P H1 (\lambda +(H3: (eq nat y x)).(H0 (sym_eq nat y x H3))) H2)))))))). + +theorem lt_gen_xS: + \forall (x: nat).(\forall (n: nat).((lt x (S n)) \to (or (eq nat x O) (ex2 +nat (\lambda (m: nat).(eq nat x (S m))) (\lambda (m: nat).(lt m n)))))) +\def + \lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (n0: nat).((lt n (S +n0)) \to (or (eq nat n O) (ex2 nat (\lambda (m: nat).(eq nat n (S m))) +(\lambda (m: nat).(lt m n0))))))) (\lambda (n: nat).(\lambda (_: (lt O (S +n))).(or_introl (eq nat O O) (ex2 nat (\lambda (m: nat).(eq nat O (S m))) +(\lambda (m: nat).(lt m n))) (refl_equal nat O)))) (\lambda (n: nat).(\lambda +(_: ((\forall (n0: nat).((lt n (S n0)) \to (or (eq nat n O) (ex2 nat (\lambda +(m: nat).(eq nat n (S m))) (\lambda (m: nat).(lt m n0)))))))).(\lambda (n0: +nat).(\lambda (H0: (lt (S n) (S n0))).(or_intror (eq nat (S n) O) (ex2 nat +(\lambda (m: nat).(eq nat (S n) (S m))) (\lambda (m: nat).(lt m n0))) +(ex_intro2 nat (\lambda (m: nat).(eq nat (S n) (S m))) (\lambda (m: nat).(lt +m n0)) n (refl_equal nat (S n)) (le_S_n (S n) n0 H0))))))) x). + +theorem le_lt_false: + \forall (x: nat).(\forall (y: nat).((le x y) \to ((lt y x) \to (\forall (P: +Prop).P)))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (H: (le x y)).(\lambda (H0: (lt +y x)).(\lambda (P: Prop).(False_ind P (le_not_lt x y H H0)))))). + +theorem lt_neq: + \forall (x: nat).(\forall (y: nat).((lt x y) \to (not (eq nat x y)))) +\def + \lambda (x: nat).(\lambda (y: nat).(\lambda (H: (lt x y)).(\lambda (H0: (eq +nat x y)).(let H1 \def (eq_ind nat x (\lambda (n: nat).(lt n y)) H y H0) in +(lt_irrefl y H1))))). + +theorem arith0: + \forall (h2: nat).(\forall (d2: nat).(\forall (n: nat).((le (plus d2 h2) n) +\to (\forall (h1: nat).(le (plus d2 h1) (minus (plus n h1) h2)))))) +\def + \lambda (h2: nat).(\lambda (d2: nat).(\lambda (n: nat).(\lambda (H: (le +(plus d2 h2) n)).(\lambda (h1: nat).(eq_ind nat (minus (plus h2 (plus d2 h1)) +h2) (\lambda (n0: nat).(le n0 (minus (plus n h1) h2))) (le_minus_minus h2 +(plus h2 (plus d2 h1)) (le_plus_l h2 (plus d2 h1)) (plus n h1) (eq_ind_r nat +(plus (plus h2 d2) h1) (\lambda (n0: nat).(le n0 (plus n h1))) (eq_ind_r nat +(plus d2 h2) (\lambda (n0: nat).(le (plus n0 h1) (plus n h1))) (le_S_n (plus +(plus d2 h2) h1) (plus n h1) (lt_le_S (plus (plus d2 h2) h1) (S (plus n h1)) +(le_lt_n_Sm (plus (plus d2 h2) h1) (plus n h1) (plus_le_compat (plus d2 h2) n +h1 h1 H (le_n h1))))) (plus h2 d2) (plus_comm h2 d2)) (plus h2 (plus d2 h1)) +(plus_assoc h2 d2 h1))) (plus d2 h1) (minus_plus h2 (plus d2 h1))))))). + +theorem O_minus: + \forall (x: nat).(\forall (y: nat).((le x y) \to (eq nat (minus x y) O))) +\def + \lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (y: nat).((le n y) \to +(eq nat (minus n y) O)))) (\lambda (y: nat).(\lambda (_: (le O +y)).(refl_equal nat O))) (\lambda (x0: nat).(\lambda (H: ((\forall (y: +nat).((le x0 y) \to (eq nat (minus x0 y) O))))).(\lambda (y: nat).(nat_ind +(\lambda (n: nat).((le (S x0) n) \to (eq nat (match n with [O \Rightarrow (S +x0) | (S l) \Rightarrow (minus x0 l)]) O))) (\lambda (H0: (le (S x0) +O)).(ex2_ind nat (\lambda (n: nat).(eq nat O (S n))) (\lambda (n: nat).(le x0 +n)) (eq nat (S x0) O) (\lambda (x1: nat).(\lambda (H1: (eq nat O (S +x1))).(\lambda (_: (le x0 x1)).(let H3 \def (eq_ind nat O (\lambda (ee: +nat).(match ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow True +| (S _) \Rightarrow False])) I (S x1) H1) in (False_ind (eq nat (S x0) O) +H3))))) (le_gen_S x0 O H0))) (\lambda (n: nat).(\lambda (_: (((le (S x0) n) +\to (eq nat (match n with [O \Rightarrow (S x0) | (S l) \Rightarrow (minus x0 +l)]) O)))).(\lambda (H1: (le (S x0) (S n))).(H n (le_S_n x0 n H1))))) y)))) +x). + +theorem minus_minus: + \forall (z: nat).(\forall (x: nat).(\forall (y: nat).((le z x) \to ((le z y) +\to ((eq nat (minus x z) (minus y z)) \to (eq nat x y)))))) +\def + \lambda (z: nat).(nat_ind (\lambda (n: nat).(\forall (x: nat).(\forall (y: +nat).((le n x) \to ((le n y) \to ((eq nat (minus x n) (minus y n)) \to (eq +nat x y))))))) (\lambda (x: nat).(\lambda (y: nat).(\lambda (_: (le O +x)).(\lambda (_: (le O y)).(\lambda (H1: (eq nat (minus x O) (minus y +O))).(let H2 \def (eq_ind_r nat (minus x O) (\lambda (n: nat).(eq nat n +(minus y O))) H1 x (minus_n_O x)) in (let H3 \def (eq_ind_r nat (minus y O) +(\lambda (n: nat).(eq nat x n)) H2 y (minus_n_O y)) in H3))))))) (\lambda +(z0: nat).(\lambda (IH: ((\forall (x: nat).(\forall (y: nat).((le z0 x) \to +((le z0 y) \to ((eq nat (minus x z0) (minus y z0)) \to (eq nat x +y)))))))).(\lambda (x: nat).(nat_ind (\lambda (n: nat).(\forall (y: nat).((le +(S z0) n) \to ((le (S z0) y) \to ((eq nat (minus n (S z0)) (minus y (S z0))) +\to (eq nat n y)))))) (\lambda (y: nat).(\lambda (H: (le (S z0) O)).(\lambda +(_: (le (S z0) y)).(\lambda (_: (eq nat (minus O (S z0)) (minus y (S +z0)))).(ex2_ind nat (\lambda (n: nat).(eq nat O (S n))) (\lambda (n: nat).(le +z0 n)) (eq nat O y) (\lambda (x0: nat).(\lambda (H2: (eq nat O (S +x0))).(\lambda (_: (le z0 x0)).(let H4 \def (eq_ind nat O (\lambda (ee: +nat).(match ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow True +| (S _) \Rightarrow False])) I (S x0) H2) in (False_ind (eq nat O y) H4))))) +(le_gen_S z0 O H)))))) (\lambda (x0: nat).(\lambda (_: ((\forall (y: +nat).((le (S z0) x0) \to ((le (S z0) y) \to ((eq nat (minus x0 (S z0)) (minus +y (S z0))) \to (eq nat x0 y))))))).(\lambda (y: nat).(nat_ind (\lambda (n: +nat).((le (S z0) (S x0)) \to ((le (S z0) n) \to ((eq nat (minus (S x0) (S +z0)) (minus n (S z0))) \to (eq nat (S x0) n))))) (\lambda (_: (le (S z0) (S +x0))).(\lambda (H0: (le (S z0) O)).(\lambda (_: (eq nat (minus (S x0) (S z0)) +(minus O (S z0)))).(ex2_ind nat (\lambda (n: nat).(eq nat O (S n))) (\lambda +(n: nat).(le z0 n)) (eq nat (S x0) O) (\lambda (x1: nat).(\lambda (H2: (eq +nat O (S x1))).(\lambda (_: (le z0 x1)).(let H4 \def (eq_ind nat O (\lambda +(ee: nat).(match ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +True | (S _) \Rightarrow False])) I (S x1) H2) in (False_ind (eq nat (S x0) +O) H4))))) (le_gen_S z0 O H0))))) (\lambda (y0: nat).(\lambda (_: (((le (S +z0) (S x0)) \to ((le (S z0) y0) \to ((eq nat (minus (S x0) (S z0)) (minus y0 +(S z0))) \to (eq nat (S x0) y0)))))).(\lambda (H: (le (S z0) (S +x0))).(\lambda (H0: (le (S z0) (S y0))).(\lambda (H1: (eq nat (minus (S x0) +(S z0)) (minus (S y0) (S z0)))).(f_equal nat nat S x0 y0 (IH x0 y0 (le_S_n z0 +x0 H) (le_S_n z0 y0 H0) H1))))))) y)))) x)))) z). + +theorem plus_plus: + \forall (z: nat).(\forall (x1: nat).(\forall (x2: nat).(\forall (y1: +nat).(\forall (y2: nat).((le x1 z) \to ((le x2 z) \to ((eq nat (plus (minus z +x1) y1) (plus (minus z x2) y2)) \to (eq nat (plus x1 y2) (plus x2 y1))))))))) +\def + \lambda (z: nat).(nat_ind (\lambda (n: nat).(\forall (x1: nat).(\forall (x2: +nat).(\forall (y1: nat).(\forall (y2: nat).((le x1 n) \to ((le x2 n) \to ((eq +nat (plus (minus n x1) y1) (plus (minus n x2) y2)) \to (eq nat (plus x1 y2) +(plus x2 y1)))))))))) (\lambda (x1: nat).(\lambda (x2: nat).(\lambda (y1: +nat).(\lambda (y2: nat).(\lambda (H: (le x1 O)).(\lambda (H0: (le x2 +O)).(\lambda (H1: (eq nat y1 y2)).(eq_ind nat y1 (\lambda (n: nat).(eq nat +(plus x1 n) (plus x2 y1))) (let H_y \def (le_n_O_eq x2 H0) in (eq_ind nat O +(\lambda (n: nat).(eq nat (plus x1 y1) (plus n y1))) (let H_y0 \def +(le_n_O_eq x1 H) in (eq_ind nat O (\lambda (n: nat).(eq nat (plus n y1) (plus +O y1))) (refl_equal nat (plus O y1)) x1 H_y0)) x2 H_y)) y2 H1)))))))) +(\lambda (z0: nat).(\lambda (IH: ((\forall (x1: nat).(\forall (x2: +nat).(\forall (y1: nat).(\forall (y2: nat).((le x1 z0) \to ((le x2 z0) \to +((eq nat (plus (minus z0 x1) y1) (plus (minus z0 x2) y2)) \to (eq nat (plus +x1 y2) (plus x2 y1))))))))))).(\lambda (x1: nat).(nat_ind (\lambda (n: +nat).(\forall (x2: nat).(\forall (y1: nat).(\forall (y2: nat).((le n (S z0)) +\to ((le x2 (S z0)) \to ((eq nat (plus (minus (S z0) n) y1) (plus (minus (S +z0) x2) y2)) \to (eq nat (plus n y2) (plus x2 y1))))))))) (\lambda (x2: +nat).(nat_ind (\lambda (n: nat).(\forall (y1: nat).(\forall (y2: nat).((le O +(S z0)) \to ((le n (S z0)) \to ((eq nat (plus (minus (S z0) O) y1) (plus +(minus (S z0) n) y2)) \to (eq nat (plus O y2) (plus n y1)))))))) (\lambda +(y1: nat).(\lambda (y2: nat).(\lambda (_: (le O (S z0))).(\lambda (_: (le O +(S z0))).(\lambda (H1: (eq nat (S (plus z0 y1)) (S (plus z0 y2)))).(let H_y +\def (IH O O) in (let H2 \def (eq_ind_r nat (minus z0 O) (\lambda (n: +nat).(\forall (y3: nat).(\forall (y4: nat).((le O z0) \to ((le O z0) \to ((eq +nat (plus n y3) (plus n y4)) \to (eq nat y4 y3))))))) H_y z0 (minus_n_O z0)) +in (H2 y1 y2 (le_O_n z0) (le_O_n z0) (H2 (plus z0 y2) (plus z0 y1) (le_O_n +z0) (le_O_n z0) (f_equal nat nat (plus z0) (plus z0 y2) (plus z0 y1) (sym_eq +nat (plus z0 y1) (plus z0 y2) (eq_add_S (plus z0 y1) (plus z0 y2) +H1)))))))))))) (\lambda (x3: nat).(\lambda (_: ((\forall (y1: nat).(\forall +(y2: nat).((le O (S z0)) \to ((le x3 (S z0)) \to ((eq nat (S (plus z0 y1)) +(plus (match x3 with [O \Rightarrow (S z0) | (S l) \Rightarrow (minus z0 l)]) +y2)) \to (eq nat y2 (plus x3 y1))))))))).(\lambda (y1: nat).(\lambda (y2: +nat).(\lambda (_: (le O (S z0))).(\lambda (H0: (le (S x3) (S z0))).(\lambda +(H1: (eq nat (S (plus z0 y1)) (plus (minus z0 x3) y2))).(let H_y \def (IH O +x3 (S y1)) in (let H2 \def (eq_ind_r nat (minus z0 O) (\lambda (n: +nat).(\forall (y3: nat).((le O z0) \to ((le x3 z0) \to ((eq nat (plus n (S +y1)) (plus (minus z0 x3) y3)) \to (eq nat y3 (plus x3 (S y1)))))))) H_y z0 +(minus_n_O z0)) in (let H3 \def (eq_ind_r nat (plus z0 (S y1)) (\lambda (n: +nat).(\forall (y3: nat).((le O z0) \to ((le x3 z0) \to ((eq nat n (plus +(minus z0 x3) y3)) \to (eq nat y3 (plus x3 (S y1)))))))) H2 (S (plus z0 y1)) +(plus_n_Sm z0 y1)) in (let H4 \def (eq_ind_r nat (plus x3 (S y1)) (\lambda +(n: nat).(\forall (y3: nat).((le O z0) \to ((le x3 z0) \to ((eq nat (S (plus +z0 y1)) (plus (minus z0 x3) y3)) \to (eq nat y3 n)))))) H3 (S (plus x3 y1)) +(plus_n_Sm x3 y1)) in (H4 y2 (le_O_n z0) (le_S_n x3 z0 H0) H1)))))))))))) +x2)) (\lambda (x2: nat).(\lambda (_: ((\forall (x3: nat).(\forall (y1: +nat).(\forall (y2: nat).((le x2 (S z0)) \to ((le x3 (S z0)) \to ((eq nat +(plus (minus (S z0) x2) y1) (plus (minus (S z0) x3) y2)) \to (eq nat (plus x2 +y2) (plus x3 y1)))))))))).(\lambda (x3: nat).(nat_ind (\lambda (n: +nat).(\forall (y1: nat).(\forall (y2: nat).((le (S x2) (S z0)) \to ((le n (S +z0)) \to ((eq nat (plus (minus (S z0) (S x2)) y1) (plus (minus (S z0) n) y2)) +\to (eq nat (plus (S x2) y2) (plus n y1)))))))) (\lambda (y1: nat).(\lambda +(y2: nat).(\lambda (H: (le (S x2) (S z0))).(\lambda (_: (le O (S +z0))).(\lambda (H1: (eq nat (plus (minus z0 x2) y1) (S (plus z0 y2)))).(let +H_y \def (IH x2 O y1 (S y2)) in (let H2 \def (eq_ind_r nat (minus z0 O) +(\lambda (n: nat).((le x2 z0) \to ((le O z0) \to ((eq nat (plus (minus z0 x2) +y1) (plus n (S y2))) \to (eq nat (plus x2 (S y2)) y1))))) H_y z0 (minus_n_O +z0)) in (let H3 \def (eq_ind_r nat (plus z0 (S y2)) (\lambda (n: nat).((le x2 +z0) \to ((le O z0) \to ((eq nat (plus (minus z0 x2) y1) n) \to (eq nat (plus +x2 (S y2)) y1))))) H2 (S (plus z0 y2)) (plus_n_Sm z0 y2)) in (let H4 \def +(eq_ind_r nat (plus x2 (S y2)) (\lambda (n: nat).((le x2 z0) \to ((le O z0) +\to ((eq nat (plus (minus z0 x2) y1) (S (plus z0 y2))) \to (eq nat n y1))))) +H3 (S (plus x2 y2)) (plus_n_Sm x2 y2)) in (H4 (le_S_n x2 z0 H) (le_O_n z0) +H1)))))))))) (\lambda (x4: nat).(\lambda (_: ((\forall (y1: nat).(\forall +(y2: nat).((le (S x2) (S z0)) \to ((le x4 (S z0)) \to ((eq nat (plus (minus +z0 x2) y1) (plus (match x4 with [O \Rightarrow (S z0) | (S l) \Rightarrow +(minus z0 l)]) y2)) \to (eq nat (S (plus x2 y2)) (plus x4 +y1))))))))).(\lambda (y1: nat).(\lambda (y2: nat).(\lambda (H: (le (S x2) (S +z0))).(\lambda (H0: (le (S x4) (S z0))).(\lambda (H1: (eq nat (plus (minus z0 +x2) y1) (plus (minus z0 x4) y2))).(f_equal nat nat S (plus x2 y2) (plus x4 +y1) (IH x2 x4 y1 y2 (le_S_n x2 z0 H) (le_S_n x4 z0 H0) H1))))))))) x3)))) +x1)))) z). + +theorem le_S_minus: + \forall (d: nat).(\forall (h: nat).(\forall (n: nat).((le (plus d h) n) \to +(le d (S (minus n h)))))) +\def + \lambda (d: nat).(\lambda (h: nat).(\lambda (n: nat).(\lambda (H: (le (plus +d h) n)).(let H0 \def (le_trans d (plus d h) n (le_plus_l d h) H) in (let H1 +\def (eq_ind nat n (\lambda (n0: nat).(le d n0)) H0 (plus (minus n h) h) +(le_plus_minus_sym h n (le_trans_plus_r d h n H))) in (le_S d (minus n h) +(le_minus d n h H))))))). + +theorem lt_x_pred_y: + \forall (x: nat).(\forall (y: nat).((lt x (pred y)) \to (lt (S x) y))) +\def + \lambda (x: nat).(\lambda (y: nat).(nat_ind (\lambda (n: nat).((lt x (pred +n)) \to (lt (S x) n))) (\lambda (H: (lt x O)).(lt_x_O x H (lt (S x) O))) +(\lambda (n: nat).(\lambda (_: (((lt x (pred n)) \to (lt (S x) n)))).(\lambda +(H0: (lt x n)).(le_S_n (S (S x)) (S n) (le_n_S (S (S x)) (S n) (le_n_S (S x) +n H0)))))) y)). + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/ext/tactics.ma b/matita/contribs/LAMBDA-TYPES/Base-1/ext/tactics.ma new file mode 100644 index 000000000..4a7946c68 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/ext/tactics.ma @@ -0,0 +1,42 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/ext/tactics". + +include "preamble.ma". + +theorem insert_eq: + \forall (S: Set).(\forall (x: S).(\forall (P: ((S \to Prop))).(\forall (G: +Prop).(((\forall (y: S).((P y) \to ((eq S y x) \to G)))) \to ((P x) \to G))))) +\def + \lambda (S: Set).(\lambda (x: S).(\lambda (P: ((S \to Prop))).(\lambda (G: +Prop).(\lambda (H: ((\forall (y: S).((P y) \to ((eq S y x) \to +G))))).(\lambda (H0: (P x)).(H x H0 (refl_equal S x))))))). + +theorem unintro: + \forall (A: Set).(\forall (a: A).(\forall (P: ((A \to Prop))).(((\forall (x: +A).(P x))) \to (P a)))) +\def + \lambda (A: Set).(\lambda (a: A).(\lambda (P: ((A \to Prop))).(\lambda (H: +((\forall (x: A).(P x)))).(H a)))). + +theorem xinduction: + \forall (A: Set).(\forall (t: A).(\forall (P: ((A \to Prop))).(((\forall (x: +A).((eq A t x) \to (P x)))) \to (P t)))) +\def + \lambda (A: Set).(\lambda (t: A).(\lambda (P: ((A \to Prop))).(\lambda (H: +((\forall (x: A).((eq A t x) \to (P x))))).(H t (refl_equal A t))))). + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/makefile b/matita/contribs/LAMBDA-TYPES/Base-1/makefile new file mode 100644 index 000000000..3198e94cf --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/makefile @@ -0,0 +1,39 @@ +H= @ + +RT_BASEDIR=../../../ +OPTIONS=-bench -onepass -system +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/plist/defs.ma b/matita/contribs/LAMBDA-TYPES/Base-1/plist/defs.ma new file mode 100644 index 000000000..1ca1142d9 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/plist/defs.ma @@ -0,0 +1,45 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/plist/defs". + +include "preamble.ma". + +inductive PList: Set \def +| PNil: PList +| PCons: nat \to (nat \to (PList \to PList)). + +definition PConsTail: + PList \to (nat \to (nat \to PList)) +\def + let rec PConsTail (hds: PList) on hds: (nat \to (nat \to PList)) \def +(\lambda (h0: nat).(\lambda (d0: nat).(match hds with [PNil \Rightarrow +(PCons h0 d0 PNil) | (PCons h d hds0) \Rightarrow (PCons h d (PConsTail hds0 +h0 d0))]))) in PConsTail. + +definition Ss: + PList \to PList +\def + let rec Ss (hds: PList) on hds: PList \def (match hds with [PNil \Rightarrow +PNil | (PCons h d hds0) \Rightarrow (PCons h (S d) (Ss hds0))]) in Ss. + +definition papp: + PList \to (PList \to PList) +\def + let rec papp (a: PList) on a: (PList \to PList) \def (\lambda (b: +PList).(match a with [PNil \Rightarrow b | (PCons h d a0) \Rightarrow (PCons +h d (papp a0 b))])) in papp. + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/plist/props.ma b/matita/contribs/LAMBDA-TYPES/Base-1/plist/props.ma new file mode 100644 index 000000000..7338262f1 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/plist/props.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/plist/props". + +include "plist/defs.ma". + +theorem papp_ss: + \forall (is1: PList).(\forall (is2: PList).(eq PList (papp (Ss is1) (Ss +is2)) (Ss (papp is1 is2)))) +\def + \lambda (is1: PList).(PList_ind (\lambda (p: PList).(\forall (is2: +PList).(eq PList (papp (Ss p) (Ss is2)) (Ss (papp p is2))))) (\lambda (is2: +PList).(refl_equal PList (Ss is2))) (\lambda (n: nat).(\lambda (n0: +nat).(\lambda (p: PList).(\lambda (H: ((\forall (is2: PList).(eq PList (papp +(Ss p) (Ss is2)) (Ss (papp p is2)))))).(\lambda (is2: PList).(eq_ind_r PList +(Ss (papp p is2)) (\lambda (p0: PList).(eq PList (PCons n (S n0) p0) (PCons n +(S n0) (Ss (papp p is2))))) (refl_equal PList (PCons n (S n0) (Ss (papp p +is2)))) (papp (Ss p) (Ss is2)) (H is2))))))) is1). + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/preamble.ma b/matita/contribs/LAMBDA-TYPES/Base-1/preamble.ma new file mode 100644 index 000000000..f5ad380c9 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/preamble.ma @@ -0,0 +1,112 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/preamble". + +include' "../../../legacy/coq.ma". + +alias symbol "eq" = "Coq's leibnitz's equality". +alias symbol "leq" = "Coq's natural 'less or equal to'". +alias symbol "neq" = "Coq's not equal to (leibnitz)". +alias symbol "plus" = "Coq's natural plus". + +alias id "bool" = "cic:/Coq/Init/Datatypes/bool.ind#xpointer(1/1)". +alias id "conj" = "cic:/Coq/Init/Logic/and.ind#xpointer(1/1/1)". +alias id "eq_add_S" = "cic:/Coq/Init/Peano/eq_add_S.con". +alias id "eq" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)". +alias id "eq_ind" = "cic:/Coq/Init/Logic/eq_ind.con". +alias id "eq_ind_r" = "cic:/Coq/Init/Logic/eq_ind_r.con". +alias id "ex2" = "cic:/Coq/Init/Logic/ex2.ind#xpointer(1/1)". +alias id "ex2_ind" = "cic:/Coq/Init/Logic/ex2_ind.con". +alias id "ex_intro2" = "cic:/Coq/Init/Logic/ex2.ind#xpointer(1/1/1)". +alias id "false" = "cic:/Coq/Init/Datatypes/bool.ind#xpointer(1/1/2)". +alias id "False" = "cic:/Coq/Init/Logic/False.ind#xpointer(1/1)". +alias id "False_ind" = "cic:/Coq/Init/Logic/False_ind.con". +alias id "I" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1/1)". +alias id "land" = "cic:/Coq/Init/Logic/and.ind#xpointer(1/1)". +alias id "le" = "cic:/Coq/Init/Peano/le.ind#xpointer(1/1)". +alias id "le_ind" = "cic:/Coq/Init/Peano/le_ind.con". +alias id "le_lt_n_Sm" = "cic:/Coq/Arith/Lt/le_lt_n_Sm.con". +alias id "le_lt_or_eq" = "cic:/Coq/Arith/Lt/le_lt_or_eq.con". +alias id "le_n" = "cic:/Coq/Init/Peano/le.ind#xpointer(1/1/1)". +alias id "le_n_O_eq" = "cic:/Coq/Arith/Le/le_n_O_eq.con". +alias id "le_not_lt" = "cic:/Coq/Arith/Lt/le_not_lt.con". +alias id "le_n_S" = "cic:/Coq/Arith/Le/le_n_S.con". +alias id "le_O_n" = "cic:/Coq/Arith/Le/le_O_n.con". +alias id "le_or_lt" = "cic:/Coq/Arith/Lt/le_or_lt.con". +alias id "le_plus_l" = "cic:/Coq/Arith/Plus/le_plus_l.con". +alias id "le_plus_minus" = "cic:/Coq/Arith/Minus/le_plus_minus.con". +alias id "le_plus_minus_r" = "cic:/Coq/Arith/Minus/le_plus_minus_r.con". +alias id "le_plus_r" = "cic:/Coq/Arith/Plus/le_plus_r.con". +alias id "le_pred_n" = "cic:/Coq/Arith/Le/le_pred_n.con". +alias id "le_S" = "cic:/Coq/Init/Peano/le.ind#xpointer(1/1/2)". +alias id "le_S_n" = "cic:/Coq/Arith/Le/le_S_n.con". +alias id "le_Sn_n" = "cic:/Coq/Arith/Le/le_Sn_n.con". +alias id "le_trans" = "cic:/Coq/Arith/Le/le_trans.con". +alias id "lt" = "cic:/Coq/Init/Peano/lt.con". +alias id "lt_irrefl" = "cic:/Coq/Arith/Lt/lt_irrefl.con". +alias id "lt_le_S" = "cic:/Coq/Arith/Lt/lt_le_S.con". +alias id "lt_n_S" = "cic:/Coq/Arith/Lt/lt_n_S.con". +alias id "minus" = "cic:/Coq/Init/Peano/minus.con". +alias id "minus_n_O" = "cic:/Coq/Arith/Minus/minus_n_O.con". +alias id "minus_plus" = "cic:/Coq/Arith/Minus/minus_plus.con". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "nat_ind" = "cic:/Coq/Init/Datatypes/nat_ind.con". +alias id "not" = "cic:/Coq/Init/Logic/not.con". +alias id "not_eq_S" = "cic:/Coq/Init/Peano/not_eq_S.con". +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". +alias id "or" = "cic:/Coq/Init/Logic/or.ind#xpointer(1/1)". +alias id "or_ind" = "cic:/Coq/Init/Logic/or_ind.con". +alias id "or_introl" = "cic:/Coq/Init/Logic/or.ind#xpointer(1/1/1)". +alias id "or_intror" = "cic:/Coq/Init/Logic/or.ind#xpointer(1/1/2)". +alias id "O_S" = "cic:/Coq/Init/Peano/O_S.con". +alias id "plus_assoc" = "cic:/Coq/Arith/Plus/plus_assoc.con". +alias id "plus_assoc_reverse" = "cic:/Coq/Arith/Plus/plus_assoc_reverse.con". +alias id "plus" = "cic:/Coq/Init/Peano/plus.con". +alias id "plus_comm" = "cic:/Coq/Arith/Plus/plus_comm.con". +alias id "plus_le_compat" = "cic:/Coq/Arith/Plus/plus_le_compat.con". +alias id "plus_le_reg_l" = "cic:/Coq/Arith/Plus/plus_le_reg_l.con". +alias id "plus_lt_reg_l" = "cic:/Coq/Arith/Plus/plus_lt_reg_l.con". +alias id "plus_n_Sm" = "cic:/Coq/Init/Peano/plus_n_Sm.con". +alias id "plus_reg_l" = "cic:/Coq/Arith/Plus/plus_reg_l.con". +alias id "pred" = "cic:/Coq/Init/Peano/pred.con". +alias id "refl_equal" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". +alias id "true" = "cic:/Coq/Init/Datatypes/bool.ind#xpointer(1/1/1)". +alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)". + +theorem f_equal: \forall A,B:Type. \forall f:A \to B. + \forall x,y:A. x = y \to f x = f y. + intros. elim H. reflexivity. +qed. + +theorem sym_eq: \forall A:Type. \forall x,y:A. x = y \to y = x. + intros. rewrite > H. reflexivity. +qed. + +theorem sym_not_eq: \forall A:Type. \forall x,y:A. x \neq y \to y \neq x. + unfold not. intros. apply H. symmetry. assumption. +qed. + +theorem trans_eq : \forall A:Type. \forall x,y,z:A. x=y \to y=z \to x=z. + intros. transitivity y; assumption. +qed. + +theorem plus_reg_l: \forall n,m,p. n + m = n + p \to m = p. + intros. apply plus_reg_l; autobatch. +qed. + +theorem plus_le_reg_l: \forall p,n,m. p + n <= p + m \to n <= m. + intros. apply plus_le_reg_l; autobatch. +qed. diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/spare.ma b/matita/contribs/LAMBDA-TYPES/Base-1/spare.ma new file mode 100644 index 000000000..e19f961cc --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/spare.ma @@ -0,0 +1,174 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/spare". + +include "theory.ma". +(* +inductive pr: Set \def +| pr_zero: pr +| pr_succ: pr +| pr_proj: nat \to pr +| pr_comp: ((nat \to pr)) \to (pr \to pr) +| pr_prec: pr \to (pr \to pr). + +definition pr_type: + Set +\def + ((nat \to nat)) \to nat. + +definition prec_appl: + pr_type \to (pr_type \to (nat \to pr_type)) +\def + let rec prec_appl (f: pr_type) (g: pr_type) (n: nat) on n: pr_type \def +(match n with [O \Rightarrow f | (S m) \Rightarrow (\lambda (ns: ((nat \to +nat))).(g (\lambda (i: nat).(match i with [O \Rightarrow (prec_appl f g m ns) +| (S n0) \Rightarrow (match n0 with [O \Rightarrow m | (S j) \Rightarrow (ns +j)])]))))]) in prec_appl. + +definition pr_appl: + pr \to pr_type +\def + let rec pr_appl (h: pr) on h: pr_type \def (match h with [pr_zero +\Rightarrow (\lambda (_: ((nat \to nat))).O) | pr_succ \Rightarrow (\lambda +(ns: ((nat \to nat))).(S (ns O))) | (pr_proj i) \Rightarrow (\lambda (ns: +((nat \to nat))).(ns i)) | (pr_comp fs g) \Rightarrow (\lambda (ns: ((nat \to +nat))).(pr_appl g (\lambda (i: nat).(pr_appl (fs i) ns)))) | (pr_prec f g) +\Rightarrow (\lambda (ns: ((nat \to nat))).(prec_appl (pr_appl f) (pr_appl g) +(ns O) (\lambda (i: nat).(ns (S i)))))]) in pr_appl. + +inductive pr_arity: pr \to (nat \to Prop) \def +| pr_arity_zero: \forall (n: nat).(pr_arity pr_zero n) +| pr_arity_succ: \forall (n: nat).((lt O n) \to (pr_arity pr_succ n)) +| pr_arity_proj: \forall (n: nat).(\forall (i: nat).((lt i n) \to (pr_arity +(pr_proj i) n))) +| pr_arity_comp: \forall (n: nat).(\forall (m: nat).(\forall (fs: ((nat \to +pr))).(\forall (g: pr).((pr_arity g m) \to (((\forall (i: nat).((lt i m) \to +(pr_arity (fs i) n)))) \to (pr_arity (pr_comp fs g) n)))))) +| pr_arity_prec: \forall (n: nat).(\forall (f: pr).(\forall (g: pr).((lt O n) +\to ((pr_arity f (pred n)) \to ((pr_arity g (S n)) \to (pr_arity (pr_prec f +g) n)))))). + +theorem pr_arity_le: + \forall (h: pr).(\forall (m: nat).((pr_arity h m) \to (\forall (n: nat).((le +m n) \to (pr_arity h n))))) +\def + \lambda (h: pr).(\lambda (m: nat).(\lambda (H: (pr_arity h m)).(pr_arity_ind +(\lambda (p: pr).(\lambda (n: nat).(\forall (n0: nat).((le n n0) \to +(pr_arity p n0))))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda (_: (le n +n0)).(pr_arity_zero n0)))) (\lambda (n: nat).(\lambda (H0: (lt O n)).(\lambda +(n0: nat).(\lambda (H1: (le n n0)).(pr_arity_succ n0 (lt_le_trans O n n0 H0 +H1)))))) (\lambda (n: nat).(\lambda (i: nat).(\lambda (H0: (lt i n)).(\lambda +(n0: nat).(\lambda (H1: (le n n0)).(pr_arity_proj n0 i (lt_le_trans i n n0 H0 +H1))))))) (\lambda (n: nat).(\lambda (m0: nat).(\lambda (fs: ((nat \to +pr))).(\lambda (g: pr).(\lambda (H0: (pr_arity g m0)).(\lambda (_: ((\forall +(n0: nat).((le m0 n0) \to (pr_arity g n0))))).(\lambda (_: ((\forall (i: +nat).((lt i m0) \to (pr_arity (fs i) n))))).(\lambda (H3: ((\forall (i: +nat).((lt i m0) \to (\forall (n0: nat).((le n n0) \to (pr_arity (fs i) +n0))))))).(\lambda (n0: nat).(\lambda (H4: (le n n0)).(pr_arity_comp n0 m0 fs +g H0 (\lambda (i: nat).(\lambda (H5: (lt i m0)).(H3 i H5 n0 H4)))))))))))))) +(\lambda (n: nat).(\lambda (f: pr).(\lambda (g: pr).(\lambda (H0: (lt O +n)).(\lambda (_: (pr_arity f (pred n))).(\lambda (H2: ((\forall (n0: +nat).((le (pred n) n0) \to (pr_arity f n0))))).(\lambda (_: (pr_arity g (S +n))).(\lambda (H4: ((\forall (n0: nat).((le (S n) n0) \to (pr_arity g +n0))))).(\lambda (n0: nat).(\lambda (H5: (le n n0)).(pr_arity_prec n0 f g +(lt_le_trans O n n0 H0 H5) (H2 (pred n0) (le_n_pred n n0 H5)) (H4 (S n0) +(le_n_S n n0 H5))))))))))))) h m H))). + +theorem pr_arity_appl: + \forall (h: pr).(\forall (n: nat).((pr_arity h n) \to (\forall (ns: ((nat +\to nat))).(\forall (ms: ((nat \to nat))).(((\forall (i: nat).((lt i n) \to +(eq nat (ns i) (ms i))))) \to (eq nat (pr_appl h ns) (pr_appl h ms))))))) +\def + \lambda (h: pr).(\lambda (n: nat).(\lambda (H: (pr_arity h n)).(pr_arity_ind +(\lambda (p: pr).(\lambda (n0: nat).(\forall (ns: ((nat \to nat))).(\forall +(ms: ((nat \to nat))).(((\forall (i: nat).((lt i n0) \to (eq nat (ns i) (ms +i))))) \to (eq nat (pr_appl p ns) (pr_appl p ms))))))) (\lambda (n0: +nat).(\lambda (ns: ((nat \to nat))).(\lambda (ms: ((nat \to nat))).(\lambda +(_: ((\forall (i: nat).((lt i n0) \to (eq nat (ns i) (ms i)))))).(refl_equal +nat O))))) (\lambda (n0: nat).(\lambda (H0: (lt O n0)).(\lambda (ns: ((nat +\to nat))).(\lambda (ms: ((nat \to nat))).(\lambda (H1: ((\forall (i: +nat).((lt i n0) \to (eq nat (ns i) (ms i)))))).(f_equal nat nat S (ns O) (ms +O) (H1 O H0))))))) (\lambda (n0: nat).(\lambda (i: nat).(\lambda (H0: (lt i +n0)).(\lambda (ns: ((nat \to nat))).(\lambda (ms: ((nat \to nat))).(\lambda +(H1: ((\forall (i0: nat).((lt i0 n0) \to (eq nat (ns i0) (ms i0)))))).(H1 i +H0))))))) (\lambda (n0: nat).(\lambda (m: nat).(\lambda (fs: ((nat \to +pr))).(\lambda (g: pr).(\lambda (_: (pr_arity g m)).(\lambda (H1: ((\forall +(ns: ((nat \to nat))).(\forall (ms: ((nat \to nat))).(((\forall (i: nat).((lt +i m) \to (eq nat (ns i) (ms i))))) \to (eq nat (pr_appl g ns) (pr_appl g +ms))))))).(\lambda (_: ((\forall (i: nat).((lt i m) \to (pr_arity (fs i) +n0))))).(\lambda (H3: ((\forall (i: nat).((lt i m) \to (\forall (ns: ((nat +\to nat))).(\forall (ms: ((nat \to nat))).(((\forall (i0: nat).((lt i0 n0) +\to (eq nat (ns i0) (ms i0))))) \to (eq nat (pr_appl (fs i) ns) (pr_appl (fs +i) ms))))))))).(\lambda (ns: ((nat \to nat))).(\lambda (ms: ((nat \to +nat))).(\lambda (H4: ((\forall (i: nat).((lt i n0) \to (eq nat (ns i) (ms +i)))))).(H1 (\lambda (i: nat).(pr_appl (fs i) ns)) (\lambda (i: nat).(pr_appl +(fs i) ms)) (\lambda (i: nat).(\lambda (H5: (lt i m)).(H3 i H5 ns ms +H4))))))))))))))) (\lambda (n0: nat).(\lambda (f: pr).(\lambda (g: +pr).(\lambda (H0: (lt O n0)).(\lambda (_: (pr_arity f (pred n0))).(\lambda +(H2: ((\forall (ns: ((nat \to nat))).(\forall (ms: ((nat \to +nat))).(((\forall (i: nat).((lt i (pred n0)) \to (eq nat (ns i) (ms i))))) +\to (eq nat (pr_appl f ns) (pr_appl f ms))))))).(\lambda (_: (pr_arity g (S +n0))).(\lambda (H4: ((\forall (ns: ((nat \to nat))).(\forall (ms: ((nat \to +nat))).(((\forall (i: nat).((lt i (S n0)) \to (eq nat (ns i) (ms i))))) \to +(eq nat (pr_appl g ns) (pr_appl g ms))))))).(\lambda (ns: ((nat \to +nat))).(\lambda (ms: ((nat \to nat))).(\lambda (H5: ((\forall (i: nat).((lt i +n0) \to (eq nat (ns i) (ms i)))))).(eq_ind nat (ns O) (\lambda (n1: nat).(eq +nat (prec_appl (pr_appl f) (pr_appl g) (ns O) (\lambda (i: nat).(ns (S i)))) +(prec_appl (pr_appl f) (pr_appl g) n1 (\lambda (i: nat).(ms (S i)))))) (let +n1 \def (ns O) in (nat_ind (\lambda (n2: nat).(eq nat (prec_appl (pr_appl f) +(pr_appl g) n2 (\lambda (i: nat).(ns (S i)))) (prec_appl (pr_appl f) (pr_appl +g) n2 (\lambda (i: nat).(ms (S i)))))) (H2 (\lambda (i: nat).(ns (S i))) +(\lambda (i: nat).(ms (S i))) (\lambda (i: nat).(\lambda (H6: (lt i (pred +n0))).(H5 (S i) (lt_x_pred_y i n0 H6))))) (\lambda (n2: nat).(\lambda (IHn0: +(eq nat (prec_appl (pr_appl f) (pr_appl g) n2 (\lambda (i: nat).(ns (S i)))) +(prec_appl (pr_appl f) (pr_appl g) n2 (\lambda (i: nat).(ms (S i)))))).(H4 +(\lambda (i: nat).(match i with [O \Rightarrow (prec_appl (pr_appl f) +(pr_appl g) n2 (\lambda (i0: nat).(ns (S i0)))) | (S n3) \Rightarrow (match +n3 with [O \Rightarrow n2 | (S j) \Rightarrow (ns (S j))])])) (\lambda (i: +nat).(match i with [O \Rightarrow (prec_appl (pr_appl f) (pr_appl g) n2 +(\lambda (i0: nat).(ms (S i0)))) | (S n3) \Rightarrow (match n3 with [O +\Rightarrow n2 | (S j) \Rightarrow (ms (S j))])])) (\lambda (i: nat).(\lambda +(H6: (lt i (S n0))).(nat_ind (\lambda (n3: nat).((lt n3 (S n0)) \to (eq nat +(match n3 with [O \Rightarrow (prec_appl (pr_appl f) (pr_appl g) n2 (\lambda +(i0: nat).(ns (S i0)))) | (S n4) \Rightarrow (match n4 with [O \Rightarrow n2 +| (S j) \Rightarrow (ns (S j))])]) (match n3 with [O \Rightarrow (prec_appl +(pr_appl f) (pr_appl g) n2 (\lambda (i0: nat).(ms (S i0)))) | (S n4) +\Rightarrow (match n4 with [O \Rightarrow n2 | (S j) \Rightarrow (ms (S +j))])])))) (\lambda (_: (lt O (S n0))).IHn0) (\lambda (i0: nat).(\lambda (_: +(((lt i0 (S n0)) \to (eq nat (match i0 with [O \Rightarrow (prec_appl +(pr_appl f) (pr_appl g) n2 (\lambda (i1: nat).(ns (S i1)))) | (S n3) +\Rightarrow (match n3 with [O \Rightarrow n2 | (S j) \Rightarrow (ns (S +j))])]) (match i0 with [O \Rightarrow (prec_appl (pr_appl f) (pr_appl g) n2 +(\lambda (i1: nat).(ms (S i1)))) | (S n3) \Rightarrow (match n3 with [O +\Rightarrow n2 | (S j) \Rightarrow (ms (S j))])]))))).(\lambda (H7: (lt (S +i0) (S n0))).(let H_y \def (H5 i0 (lt_S_n i0 n0 H7)) in (nat_ind (\lambda +(n3: nat).((eq nat (ns n3) (ms n3)) \to (eq nat (match n3 with [O \Rightarrow +n2 | (S j) \Rightarrow (ns (S j))]) (match n3 with [O \Rightarrow n2 | (S j) +\Rightarrow (ms (S j))])))) (\lambda (_: (eq nat (ns O) (ms O))).(refl_equal +nat n2)) (\lambda (i1: nat).(\lambda (_: (((eq nat (ns i1) (ms i1)) \to (eq +nat (match i1 with [O \Rightarrow n2 | (S j) \Rightarrow (ns (S j))]) (match +i1 with [O \Rightarrow n2 | (S j) \Rightarrow (ms (S j))]))))).(\lambda (H8: +(eq nat (ns (S i1)) (ms (S i1)))).H8))) i0 H_y))))) i H6)))))) n1)) (ms O) +(H5 O H0))))))))))))) h n H))). + +theorem pr_arity_comp_proj_zero: + \forall (n: nat).(pr_arity (pr_comp pr_proj pr_zero) n) +\def + \lambda (n: nat).(pr_arity_comp n n pr_proj pr_zero (pr_arity_zero n) +(\lambda (i: nat).(\lambda (H: (lt i n)).(pr_arity_proj n i H)))). + +*) diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/theory.ma b/matita/contribs/LAMBDA-TYPES/Base-1/theory.ma new file mode 100644 index 000000000..d89a21858 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/theory.ma @@ -0,0 +1,28 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/theory". + +include "ext/tactics.ma". + +include "ext/arith.ma". + +include "types/props.ma". + +include "blt/props.ma". + +include "plist/props.ma". + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/types/defs.ma b/matita/contribs/LAMBDA-TYPES/Base-1/types/defs.ma new file mode 100644 index 000000000..638fd2e49 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/types/defs.ma @@ -0,0 +1,153 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/types/defs". + +include "preamble.ma". + +inductive and3 (P0: Prop) (P1: Prop) (P2: Prop): Prop \def +| and3_intro: P0 \to (P1 \to (P2 \to (and3 P0 P1 P2))). + +inductive and4 (P0: Prop) (P1: Prop) (P2: Prop) (P3: Prop): Prop \def +| and4_intro: P0 \to (P1 \to (P2 \to (P3 \to (and4 P0 P1 P2 P3)))). + +inductive or3 (P0: Prop) (P1: Prop) (P2: Prop): Prop \def +| or3_intro0: P0 \to (or3 P0 P1 P2) +| or3_intro1: P1 \to (or3 P0 P1 P2) +| or3_intro2: P2 \to (or3 P0 P1 P2). + +inductive or4 (P0: Prop) (P1: Prop) (P2: Prop) (P3: Prop): Prop \def +| or4_intro0: P0 \to (or4 P0 P1 P2 P3) +| or4_intro1: P1 \to (or4 P0 P1 P2 P3) +| or4_intro2: P2 \to (or4 P0 P1 P2 P3) +| or4_intro3: P3 \to (or4 P0 P1 P2 P3). + +inductive ex3 (A0: Set) (P0: A0 \to Prop) (P1: A0 \to Prop) (P2: A0 \to +Prop): Prop \def +| ex3_intro: \forall (x0: A0).((P0 x0) \to ((P1 x0) \to ((P2 x0) \to (ex3 A0 +P0 P1 P2)))). + +inductive ex4 (A0: Set) (P0: A0 \to Prop) (P1: A0 \to Prop) (P2: A0 \to Prop) +(P3: A0 \to Prop): Prop \def +| ex4_intro: \forall (x0: A0).((P0 x0) \to ((P1 x0) \to ((P2 x0) \to ((P3 x0) +\to (ex4 A0 P0 P1 P2 P3))))). + +inductive ex_2 (A0: Set) (A1: Set) (P0: A0 \to (A1 \to Prop)): Prop \def +| ex_2_intro: \forall (x0: A0).(\forall (x1: A1).((P0 x0 x1) \to (ex_2 A0 A1 +P0))). + +inductive ex2_2 (A0: Set) (A1: Set) (P0: A0 \to (A1 \to Prop)) (P1: A0 \to +(A1 \to Prop)): Prop \def +| ex2_2_intro: \forall (x0: A0).(\forall (x1: A1).((P0 x0 x1) \to ((P1 x0 x1) +\to (ex2_2 A0 A1 P0 P1)))). + +inductive ex3_2 (A0: Set) (A1: Set) (P0: A0 \to (A1 \to Prop)) (P1: A0 \to +(A1 \to Prop)) (P2: A0 \to (A1 \to Prop)): Prop \def +| ex3_2_intro: \forall (x0: A0).(\forall (x1: A1).((P0 x0 x1) \to ((P1 x0 x1) +\to ((P2 x0 x1) \to (ex3_2 A0 A1 P0 P1 P2))))). + +inductive ex4_2 (A0: Set) (A1: Set) (P0: A0 \to (A1 \to Prop)) (P1: A0 \to +(A1 \to Prop)) (P2: A0 \to (A1 \to Prop)) (P3: A0 \to (A1 \to Prop)): Prop +\def +| ex4_2_intro: \forall (x0: A0).(\forall (x1: A1).((P0 x0 x1) \to ((P1 x0 x1) +\to ((P2 x0 x1) \to ((P3 x0 x1) \to (ex4_2 A0 A1 P0 P1 P2 P3)))))). + +inductive ex_3 (A0: Set) (A1: Set) (A2: Set) (P0: A0 \to (A1 \to (A2 \to +Prop))): Prop \def +| ex_3_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).((P0 x0 x1 +x2) \to (ex_3 A0 A1 A2 P0)))). + +inductive ex2_3 (A0: Set) (A1: Set) (A2: Set) (P0: A0 \to (A1 \to (A2 \to +Prop))) (P1: A0 \to (A1 \to (A2 \to Prop))): Prop \def +| ex2_3_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).((P0 x0 +x1 x2) \to ((P1 x0 x1 x2) \to (ex2_3 A0 A1 A2 P0 P1))))). + +inductive ex3_3 (A0: Set) (A1: Set) (A2: Set) (P0: A0 \to (A1 \to (A2 \to +Prop))) (P1: A0 \to (A1 \to (A2 \to Prop))) (P2: A0 \to (A1 \to (A2 \to +Prop))): Prop \def +| ex3_3_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).((P0 x0 +x1 x2) \to ((P1 x0 x1 x2) \to ((P2 x0 x1 x2) \to (ex3_3 A0 A1 A2 P0 P1 +P2)))))). + +inductive ex4_3 (A0: Set) (A1: Set) (A2: Set) (P0: A0 \to (A1 \to (A2 \to +Prop))) (P1: A0 \to (A1 \to (A2 \to Prop))) (P2: A0 \to (A1 \to (A2 \to +Prop))) (P3: A0 \to (A1 \to (A2 \to Prop))): Prop \def +| ex4_3_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).((P0 x0 +x1 x2) \to ((P1 x0 x1 x2) \to ((P2 x0 x1 x2) \to ((P3 x0 x1 x2) \to (ex4_3 A0 +A1 A2 P0 P1 P2 P3))))))). + +inductive ex3_4 (A0: Set) (A1: Set) (A2: Set) (A3: Set) (P0: A0 \to (A1 \to +(A2 \to (A3 \to Prop)))) (P1: A0 \to (A1 \to (A2 \to (A3 \to Prop)))) (P2: A0 +\to (A1 \to (A2 \to (A3 \to Prop)))): Prop \def +| ex3_4_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).(\forall +(x3: A3).((P0 x0 x1 x2 x3) \to ((P1 x0 x1 x2 x3) \to ((P2 x0 x1 x2 x3) \to +(ex3_4 A0 A1 A2 A3 P0 P1 P2))))))). + +inductive ex4_4 (A0: Set) (A1: Set) (A2: Set) (A3: Set) (P0: A0 \to (A1 \to +(A2 \to (A3 \to Prop)))) (P1: A0 \to (A1 \to (A2 \to (A3 \to Prop)))) (P2: A0 +\to (A1 \to (A2 \to (A3 \to Prop)))) (P3: A0 \to (A1 \to (A2 \to (A3 \to +Prop)))): Prop \def +| ex4_4_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).(\forall +(x3: A3).((P0 x0 x1 x2 x3) \to ((P1 x0 x1 x2 x3) \to ((P2 x0 x1 x2 x3) \to +((P3 x0 x1 x2 x3) \to (ex4_4 A0 A1 A2 A3 P0 P1 P2 P3)))))))). + +inductive ex4_5 (A0: Set) (A1: Set) (A2: Set) (A3: Set) (A4: Set) (P0: A0 \to +(A1 \to (A2 \to (A3 \to (A4 \to Prop))))) (P1: A0 \to (A1 \to (A2 \to (A3 \to +(A4 \to Prop))))) (P2: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to Prop))))) (P3: +A0 \to (A1 \to (A2 \to (A3 \to (A4 \to Prop))))): Prop \def +| ex4_5_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).(\forall +(x3: A3).(\forall (x4: A4).((P0 x0 x1 x2 x3 x4) \to ((P1 x0 x1 x2 x3 x4) \to +((P2 x0 x1 x2 x3 x4) \to ((P3 x0 x1 x2 x3 x4) \to (ex4_5 A0 A1 A2 A3 A4 P0 P1 +P2 P3))))))))). + +inductive ex5_5 (A0: Set) (A1: Set) (A2: Set) (A3: Set) (A4: Set) (P0: A0 \to +(A1 \to (A2 \to (A3 \to (A4 \to Prop))))) (P1: A0 \to (A1 \to (A2 \to (A3 \to +(A4 \to Prop))))) (P2: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to Prop))))) (P3: +A0 \to (A1 \to (A2 \to (A3 \to (A4 \to Prop))))) (P4: A0 \to (A1 \to (A2 \to +(A3 \to (A4 \to Prop))))): Prop \def +| ex5_5_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).(\forall +(x3: A3).(\forall (x4: A4).((P0 x0 x1 x2 x3 x4) \to ((P1 x0 x1 x2 x3 x4) \to +((P2 x0 x1 x2 x3 x4) \to ((P3 x0 x1 x2 x3 x4) \to ((P4 x0 x1 x2 x3 x4) \to +(ex5_5 A0 A1 A2 A3 A4 P0 P1 P2 P3 P4)))))))))). + +inductive ex6_6 (A0: Set) (A1: Set) (A2: Set) (A3: Set) (A4: Set) (A5: Set) +(P0: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to (A5 \to Prop)))))) (P1: A0 \to +(A1 \to (A2 \to (A3 \to (A4 \to (A5 \to Prop)))))) (P2: A0 \to (A1 \to (A2 +\to (A3 \to (A4 \to (A5 \to Prop)))))) (P3: A0 \to (A1 \to (A2 \to (A3 \to +(A4 \to (A5 \to Prop)))))) (P4: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to (A5 +\to Prop)))))) (P5: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to (A5 \to +Prop)))))): Prop \def +| ex6_6_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).(\forall +(x3: A3).(\forall (x4: A4).(\forall (x5: A5).((P0 x0 x1 x2 x3 x4 x5) \to ((P1 +x0 x1 x2 x3 x4 x5) \to ((P2 x0 x1 x2 x3 x4 x5) \to ((P3 x0 x1 x2 x3 x4 x5) +\to ((P4 x0 x1 x2 x3 x4 x5) \to ((P5 x0 x1 x2 x3 x4 x5) \to (ex6_6 A0 A1 A2 +A3 A4 A5 P0 P1 P2 P3 P4 P5)))))))))))). + +inductive ex6_7 (A0: Set) (A1: Set) (A2: Set) (A3: Set) (A4: Set) (A5: Set) +(A6: Set) (P0: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to (A5 \to (A6 \to +Prop))))))) (P1: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to (A5 \to (A6 \to +Prop))))))) (P2: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to (A5 \to (A6 \to +Prop))))))) (P3: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to (A5 \to (A6 \to +Prop))))))) (P4: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to (A5 \to (A6 \to +Prop))))))) (P5: A0 \to (A1 \to (A2 \to (A3 \to (A4 \to (A5 \to (A6 \to +Prop))))))): Prop \def +| ex6_7_intro: \forall (x0: A0).(\forall (x1: A1).(\forall (x2: A2).(\forall +(x3: A3).(\forall (x4: A4).(\forall (x5: A5).(\forall (x6: A6).((P0 x0 x1 x2 +x3 x4 x5 x6) \to ((P1 x0 x1 x2 x3 x4 x5 x6) \to ((P2 x0 x1 x2 x3 x4 x5 x6) +\to ((P3 x0 x1 x2 x3 x4 x5 x6) \to ((P4 x0 x1 x2 x3 x4 x5 x6) \to ((P5 x0 x1 +x2 x3 x4 x5 x6) \to (ex6_7 A0 A1 A2 A3 A4 A5 A6 P0 P1 P2 P3 P4 +P5))))))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/Base-1/types/props.ma b/matita/contribs/LAMBDA-TYPES/Base-1/types/props.ma new file mode 100644 index 000000000..1c9b499bb --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-1/types/props.ma @@ -0,0 +1,32 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-1/types/props". + +include "types/defs.ma". + +theorem ex2_sym: + \forall (A: Set).(\forall (P: ((A \to Prop))).(\forall (Q: ((A \to +Prop))).((ex2 A (\lambda (x: A).(P x)) (\lambda (x: A).(Q x))) \to (ex2 A +(\lambda (x: A).(Q x)) (\lambda (x: A).(P x)))))) +\def + \lambda (A: Set).(\lambda (P: ((A \to Prop))).(\lambda (Q: ((A \to +Prop))).(\lambda (H: (ex2 A (\lambda (x: A).(P x)) (\lambda (x: A).(Q +x)))).(ex2_ind A (\lambda (x: A).(P x)) (\lambda (x: A).(Q x)) (ex2 A +(\lambda (x: A).(Q x)) (\lambda (x: A).(P x))) (\lambda (x: A).(\lambda (H0: +(P x)).(\lambda (H1: (Q x)).(ex_intro2 A (\lambda (x0: A).(Q x0)) (\lambda +(x0: A).(P x0)) x H1 H0)))) H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/blt/defs.mma b/matita/contribs/LAMBDA-TYPES/Base-2/blt/defs.mma new file mode 100644 index 000000000..12438b398 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/blt/defs.mma @@ -0,0 +1,23 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/blt/defs". + +include "preamble.ma". + + +(* object blt not inlined *) + diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/blt/props.mma b/matita/contribs/LAMBDA-TYPES/Base-2/blt/props.mma new file mode 100644 index 000000000..d24466394 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/blt/props.mma @@ -0,0 +1,28 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/blt/props". + +include "blt/defs.ma". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/blt/props/lt_blt.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/blt/props/le_bge.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/blt/props/blt_lt.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/blt/props/bge_le.con". + diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/depend b/matita/contribs/LAMBDA-TYPES/Base-2/depend new file mode 100644 index 000000000..4ac4a61a6 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/depend @@ -0,0 +1,9 @@ +theory.ma: theory.mma ext/tactics.ma ext/arith.ma types/props.ma blt/props.ma plist/props.ma | ext/tactics.mo.opt ext/arith.mo.opt types/props.mo.opt blt/props.mo.opt plist/props.mo.opt +ext/tactics.ma: ext/tactics.mma preamble.ma | preamble.mo.opt +ext/arith.ma: ext/arith.mma preamble.ma | preamble.mo.opt +types/defs.ma: types/defs.mma preamble.ma | preamble.mo.opt +types/props.ma: types/props.mma types/defs.ma | types/defs.mo.opt +blt/defs.ma: blt/defs.mma preamble.ma | preamble.mo.opt +blt/props.ma: blt/props.mma blt/defs.ma | blt/defs.mo.opt +plist/defs.ma: plist/defs.mma preamble.ma | preamble.mo.opt +plist/props.ma: plist/props.mma plist/defs.ma | plist/defs.mo.opt diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/ext/arith.mma b/matita/contribs/LAMBDA-TYPES/Base-2/ext/arith.mma new file mode 100644 index 000000000..ee4663a51 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/ext/arith.mma @@ -0,0 +1,112 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/ext/arith". + +include "preamble.ma". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/nat_dec.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/simpl_plus_r.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/minus_plus_r.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/plus_permute_2_in_3.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/plus_permute_2_in_3_assoc.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/plus_O.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/minus_Sx_SO.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/eq_nat_dec.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/neq_eq_e.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_false.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_Sx_x.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_n_pred.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/minus_le.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_plus_minus_sym.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_minus_minus.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_minus_plus.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_minus.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_trans_plus_r.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_x_O.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_gen_S.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_x_plus_x_Sy.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/simpl_lt_plus_r.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/minus_x_Sy.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_plus_minus.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_plus_minus_r.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/minus_x_SO.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_x_pred_y.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_le_minus.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_le_e.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_eq_e.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_eq_gt_e.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_gen_xS.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_lt_false.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_neq.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/arith0.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/O_minus.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/minus_minus.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/plus_plus.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/le_S_minus.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/arith/lt_x_pred_y.con". + diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/ext/tactics.mma b/matita/contribs/LAMBDA-TYPES/Base-2/ext/tactics.mma new file mode 100644 index 000000000..18de7f71a --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/ext/tactics.mma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/ext/tactics". + +include "preamble.ma". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/tactics/insert_eq.con". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/ext/tactics/unintro.con". + +inline procedural +"cic:/matita/LAMBDA-TYPES/Base-1/ext/tactics/xinduction.con". + diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/log.txt b/matita/contribs/LAMBDA-TYPES/Base-2/log.txt new file mode 100644 index 000000000..2c20deb94 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/log.txt @@ -0,0 +1,744 @@ +Info: execution of blt/defs.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/blt ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./blt/defs.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of blt/defs.mma completed in 1''. +Info: execution of blt/props.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/blt ...'' +Info: baseuri cic:/matita/LAMBDA-TYPES/Base-2/blt/props is not empty +Info: cleaning baseuri cic:/matita/LAMBDA-TYPES/Base-2/blt/props +Info: Removing: cic:/matita/LAMBDA-TYPES/Base-2/blt/props/* +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./blt/defs.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/blt/defs" ...'' +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_blt +Pre Nodes : 257 +nat +nat +nat +nat +Warn: Optimizer: remove 3 +Warn: Optimizer: swap 2 +Warn: Optimizer: nested application +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.((lt y n)\to (eq bool (blt y n) true)))) (\lambda y:nat.(\lambda H:(lt y O). let H0 \def (le_ind (S y) (\lambda n:nat.((eq nat n O)\to (eq bool (blt y O) true))) (\lambda H0:(eq nat (S y) O). let H1 \def (eq_ind nat (S y) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H0) in (False_ind (eq bool (blt y O) true) H1)) (\lambda m:nat.(\lambda H0:(le (S y) m).(\lambda _:((eq nat m O)\to (eq bool (blt y O) true)).(\lambda H1:(eq nat (S m) O). let H2 \def (eq_ind nat (S m) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H1) in let DEFINED \def (False_ind ((le (S y) m)\to (eq bool (blt y O) true)) H2) in (DEFINED H0))))) O H) in (H0 (refl_equal nat O)))) (\lambda n:nat.(\lambda H:(\forall y:nat.((lt y n)\to (eq bool (blt y n) true))).(\lambda y:nat.(nat_ind (\lambda n0:nat.((lt n0 (S n))\to (eq bool (blt n0 (S n)) true))) (\lambda _:(lt O (S n)).(refl_equal bool true)) (\lambda n0:nat.(\lambda _:((lt n0 (S n))\to (eq bool +match n0 return (\lambda n1:nat.bool) with + [ O => true + | (S (m:nat)) => (blt m n) +] true)).(\lambda H1:(lt (S n0) (S n)).(H n0 (le_S_n (S n0) n H1))))) y)))) x)) +Post Nodes: 272 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_bge +Pre Nodes : 255 +nat +nat +nat +nat +Warn: Optimizer: remove 3 +Warn: Optimizer: swap 2 +Warn: Optimizer: nested application +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.((le n y)\to (eq bool (blt y n) false)))) (\lambda y:nat.(\lambda _:(le O y).(refl_equal bool false))) (\lambda n:nat.(\lambda H:(\forall y:nat.((le n y)\to (eq bool (blt y n) false))).(\lambda y:nat.(nat_ind (\lambda n0:nat.((le (S n) n0)\to (eq bool (blt n0 (S n)) false))) (\lambda H0:(le (S n) O). let H1 \def (le_ind (S n) (\lambda n0:nat.((eq nat n0 O)\to (eq bool (blt O (S n)) false))) (\lambda H1:(eq nat (S n) O). let H2 \def (eq_ind nat (S n) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H1) in (False_ind (eq bool (blt O (S n)) false) H2)) (\lambda m:nat.(\lambda H1:(le (S n) m).(\lambda _:((eq nat m O)\to (eq bool (blt O (S n)) false)).(\lambda H2:(eq nat (S m) O). let H3 \def (eq_ind nat (S m) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H2) in let DEFINED \def (False_ind ((le (S n) m)\to (eq bool (blt O (S n)) false)) H3) in (DEFINED H1))))) O H0) in (H1 (refl_equal nat O))) (\lambda n0:nat.(\lambda _:((le (S n) n0)\to (eq bool (blt n0 (S n)) false)).(\lambda H1:(le (S n) (S n0)).(H n0 (le_S_n n n0 H1))))) y)))) x)) +Post Nodes: 272 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: blt_lt +Pre Nodes : 221 +bool +bool +Warn: Optimizer: remove 3 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.((eq bool (blt y n) true)\to (lt y n)))) (\lambda y:nat.(\lambda H:(eq bool (blt y O) true). let H0 \def (eq_ind bool (blt y O) (\lambda b:bool.((eq bool b true)\to (lt y O))) (\lambda H0:(eq bool (blt y O) true). let H1 \def (eq_ind bool (blt y O) (\lambda e:bool. +match e return (\lambda _:bool.Prop) with + [ true => False + | false => True +]) I true H0) in (False_ind (lt y O) H1)) true H) in (H0 (refl_equal bool true)))) (\lambda n:nat.(\lambda H:(\forall y:nat.((eq bool (blt y n) true)\to (lt y n))).(\lambda y:nat.(nat_ind (\lambda n0:nat.((eq bool (blt n0 (S n)) true)\to (lt n0 (S n)))) (\lambda _:(eq bool true true).(le_S_n (S O) (S n) (le_n_S (S O) (S n) (le_n_S O n (le_O_n n))))) (\lambda n0:nat.(\lambda _:((eq bool +match n0 return (\lambda n1:nat.bool) with + [ O => true + | (S (m:nat)) => (blt m n) +] true)\to (lt n0 (S n))).(\lambda H1:(eq bool (blt n0 n) true).(lt_le_S (S n0) (S n) (lt_n_S n0 n (H n0 H1)))))) y)))) x)) +Post Nodes: 219 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: bge_le +Pre Nodes : 222 +bool +bool +Warn: Optimizer: remove 3 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.((eq bool (blt y n) false)\to (le n y)))) (\lambda y:nat.(\lambda _:(eq bool (blt y O) false).(le_O_n y))) (\lambda n:nat.(\lambda H:(\forall y:nat.((eq bool (blt y n) false)\to (le n y))).(\lambda y:nat.(nat_ind (\lambda n0:nat.((eq bool (blt n0 (S n)) false)\to (le (S n) n0))) (\lambda H0:(eq bool (blt O (S n)) false). let H1 \def (eq_ind bool (blt O (S n)) (\lambda b:bool.((eq bool b false)\to (le (S n) O))) (\lambda H1:(eq bool (blt O (S n)) false). let H2 \def (eq_ind bool (blt O (S n)) (\lambda e:bool. +match e return (\lambda _:bool.Prop) with + [ true => True + | false => False +]) I false H1) in (False_ind (le (S n) O) H2)) false H0) in (H1 (refl_equal bool false))) (\lambda n0:nat.(\lambda _:((eq bool (blt n0 (S n)) false)\to (le (S n) n0)).(\lambda H1:(eq bool (blt (S n0) (S n)) false).(le_S_n (S n) (S n0) (le_n_S (S n) (S n0) (le_n_S n n0 (H n0 H1))))))) y)))) x)) +Post Nodes: 220 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./blt/props.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of blt/props.mma completed in 7''. +Info: execution of ext/arith.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/ext ...'' +Info: baseuri cic:/matita/LAMBDA-TYPES/Base-2/ext/arith is not empty +Info: cleaning baseuri cic:/matita/LAMBDA-TYPES/Base-2/ext/arith +Info: Removing: cic:/matita/LAMBDA-TYPES/Base-2/ext/arith/* +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...'' +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: nat_dec +Pre Nodes : 474 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda n1:nat.(nat_ind (\lambda n:nat.(\forall n2:nat.(or (eq nat n n2) ((eq nat n n2)\to (\forall P:Prop.P))))) (\lambda n2:nat.(nat_ind (\lambda n:nat.(or (eq nat O n) ((eq nat O n)\to (\forall P:Prop.P)))) (or_introl (eq nat O O) ((eq nat O O)\to (\forall P:Prop.P)) (refl_equal nat O)) (\lambda n3:nat.(\lambda _:(or (eq nat O n3) ((eq nat O n3)\to (\forall P:Prop.P))).(or_intror (eq nat O (S n3)) ((eq nat O (S n3))\to (\forall P:Prop.P)) (\lambda H0:(eq nat O (S n3)).(\lambda P:Prop. let H1 \def (eq_ind nat O (\lambda ee:nat. +match ee return (\lambda _:nat.Prop) with + [ O => True + | (S (_:nat)) => False +]) I (S n3) H0) in (False_ind P H1)))))) n2)) (\lambda n2:nat.(\lambda H:(\forall n2:nat.(or (eq nat n2 n2) ((eq nat n2 n2)\to (\forall P:Prop.P)))).(\lambda n3:nat.(nat_ind (\lambda n0:nat.(or (eq nat (S n2) n0) ((eq nat (S n2) n0)\to (\forall P:Prop.P)))) (or_intror (eq nat (S n2) O) ((eq nat (S n2) O)\to (\forall P:Prop.P)) (\lambda H0:(eq nat (S n2) O).(\lambda P:Prop. let H1 \def (eq_ind nat (S n2) (\lambda ee:nat. +match ee return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H0) in (False_ind P H1)))) (\lambda n4:nat.(\lambda H0:(or (eq nat (S n2) n4) ((eq nat (S n2) n4)\to (\forall P:Prop.P))). let DEFINED \def (H n4) in (or_ind (eq nat n2 n4) ((eq nat n2 n4)\to (\forall P:Prop.P)) (or (eq nat (S n2) (S n4)) ((eq nat (S n2) (S n4))\to (\forall P:Prop.P))) (\lambda H1:(eq nat n2 n4).(eq_ind nat n2 (\lambda n3:nat.(or (eq nat (S n2) (S n3)) ((eq nat (S n2) (S n3))\to (\forall P:Prop.P)))) (or_introl (eq nat (S n2) (S n2)) ((eq nat (S n2) (S n2))\to (\forall P:Prop.P)) (refl_equal nat (S n2))) n4 H1)) (\lambda H1:((eq nat n2 n4)\to (\forall P:Prop.P)).(or_intror (eq nat (S n2) (S n4)) ((eq nat (S n2) (S n4))\to (\forall P:Prop.P)) (\lambda H2:(eq nat (S n2) (S n4)).(\lambda P:Prop. let H3 \def (f_equal nat nat (\lambda e:nat. +match e return (\lambda _:nat.nat) with + [ O => n2 + | (S (n3:nat)) => n3 +]) (S n2) (S n4) H2) in let H4 \def (eq_ind_r nat n4 (\lambda n3:nat.((eq nat n2 n3)\to (\forall P0:Prop.P0))) H1 n2 H3) in (H4 (refl_equal nat n2) P))))) DEFINED))) n3)))) n1)) +Post Nodes: 476 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: simpl_plus_r +Pre Nodes : 85 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda n:nat.(\lambda m:nat.(\lambda p:nat.(\lambda H:(eq nat (plus m n) (plus p n)). let DEFINED \def (plus_comm n m) in (plus_reg_l n m p (eq_ind_r nat (plus m n) (\lambda n0:nat.(eq nat n0 (plus n p))) (eq_ind_r nat (plus p n) (\lambda n0:nat.(eq nat n0 (plus n p))) (sym_eq nat (plus n p) (plus p n) (plus_comm n p)) (plus m n) H) (plus n m) DEFINED)))))) +Post Nodes: 87 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: minus_plus_r +Pre Nodes : 33 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda m:nat.(\lambda n:nat. let DEFINED \def (plus_comm m n) in (eq_ind_r nat (plus n m) (\lambda n0:nat.(eq nat (minus n0 n) m)) (minus_plus n m) (plus m n) DEFINED))) +Post Nodes: 35 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: plus_permute_2_in_3 +Pre Nodes : 117 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda z:nat. let DEFINED \def (plus_assoc_reverse x z y) in let DEFINED0 \def (plus_comm y z) in let DEFINED1 \def (plus_assoc_reverse x y z) in (eq_ind_r nat (plus x (plus y z)) (\lambda n:nat.(eq nat n (plus (plus x z) y))) (eq_ind_r nat (plus z y) (\lambda n:nat.(eq nat (plus x n) (plus (plus x z) y))) (eq_ind nat (plus (plus x z) y) (\lambda n:nat.(eq nat n (plus (plus x z) y))) (refl_equal nat (plus (plus x z) y)) (plus x (plus z y)) DEFINED) (plus y z) DEFINED0) (plus (plus x y) z) DEFINED1)))) +Post Nodes: 123 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: plus_permute_2_in_3_assoc +Pre Nodes : 86 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda n:nat.(\lambda h:nat.(\lambda k:nat. let DEFINED \def (plus_assoc n k h) in let DEFINED0 \def (plus_permute_2_in_3 n h k) in (eq_ind_r nat (plus (plus n k) h) (\lambda n0:nat.(eq nat n0 (plus n (plus k h)))) (eq_ind_r nat (plus (plus n k) h) (\lambda n0:nat.(eq nat (plus (plus n k) h) n0)) (refl_equal nat (plus (plus n k) h)) (plus n (plus k h)) DEFINED) (plus (plus n h) k) DEFINED0)))) +Post Nodes: 90 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: plus_O +Pre Nodes : 191 +nat +nat +Warn: Optimizer: remove 3 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.((eq nat (plus n y) O)\to (and (eq nat n O) (eq nat y O))))) (\lambda y:nat.(\lambda H:(eq nat (plus O y) O).(conj (eq nat O O) (eq nat y O) (refl_equal nat O) H))) (\lambda n:nat.(\lambda _:(\forall y:nat.((eq nat (plus n y) O)\to (and (eq nat n O) (eq nat y O)))).(\lambda y:nat.(\lambda H0:(eq nat (plus (S n) y) O). let H1 \def (eq_ind nat (plus (S n) y) (\lambda n0:nat.((eq nat n0 O)\to (and (eq nat (S n) O) (eq nat y O)))) (\lambda H1:(eq nat (plus (S n) y) O). let H2 \def (eq_ind nat (plus (S n) y) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H1) in (False_ind (and (eq nat (S n) O) (eq nat y O)) H2)) O H0) in (H1 (refl_equal nat O)))))) x)) +Post Nodes: 189 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: minus_Sx_SO +Pre Nodes : 24 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat. let DEFINED \def (minus_n_O x) in (eq_ind nat x (\lambda n:nat.(eq nat n x)) (refl_equal nat x) (minus x O) DEFINED)) +Post Nodes: 26 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: eq_nat_dec +Pre Nodes : 303 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda i:nat.(nat_ind (\lambda n:nat.(\forall j:nat.(or (not (eq nat n j)) (eq nat n j)))) (\lambda j:nat.(nat_ind (\lambda n:nat.(or (not (eq nat O n)) (eq nat O n))) (or_intror (not (eq nat O O)) (eq nat O O) (refl_equal nat O)) (\lambda n:nat.(\lambda _:(or (not (eq nat O n)) (eq nat O n)).(or_introl (not (eq nat O (S n))) (eq nat O (S n)) (O_S n)))) j)) (\lambda n:nat.(\lambda H:(\forall j:nat.(or (not (eq nat n j)) (eq nat n j))).(\lambda j:nat.(nat_ind (\lambda n0:nat.(or (not (eq nat (S n) n0)) (eq nat (S n) n0))) (or_introl (not (eq nat (S n) O)) (eq nat (S n) O) (sym_not_eq nat O (S n) (O_S n))) (\lambda n0:nat.(\lambda _:(or (not (eq nat (S n) n0)) (eq nat (S n) n0)). let DEFINED \def (H n0) in (or_ind (not (eq nat n n0)) (eq nat n n0) (or (not (eq nat (S n) (S n0))) (eq nat (S n) (S n0))) (\lambda H1:(not (eq nat n n0)).(or_introl (not (eq nat (S n) (S n0))) (eq nat (S n) (S n0)) (not_eq_S n n0 H1))) (\lambda H1:(eq nat n n0).(or_intror (not (eq nat (S n) (S n0))) (eq nat (S n) (S n0)) (f_equal nat nat S n n0 H1))) DEFINED))) j)))) i)) +Post Nodes: 305 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: neq_eq_e +Pre Nodes : 47 +Optimized : (\lambda i:nat.(\lambda j:nat.(\lambda P:Prop.(\lambda H:((not (eq nat i j))\to P).(\lambda H0:((eq nat i j)\to P). let o \def (eq_nat_dec i j) in (or_ind (not (eq nat i j)) (eq nat i j) P H H0 o)))))) +Post Nodes: 47 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_false +Pre Nodes : 382 +nat +nat +nat +nat +Warn: Optimizer: remove 3 +Warn: Optimizer: swap 2 +Warn: Optimizer: nested application +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +nat +nat +nat +nat +Warn: Optimizer: remove 3 +Warn: Optimizer: swap 2 +Warn: Optimizer: nested application +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda m:nat.(nat_ind (\lambda n:nat.(\forall n0:nat.(\forall P:Prop.((le n n0)\to ((le (S n0) n)\to P))))) (\lambda n:nat.(\lambda P:Prop.(\lambda _:(le O n).(\lambda H0:(le (S n) O). let H1 \def (le_ind (S n) (\lambda n0:nat.((eq nat n0 O)\to P)) (\lambda H1:(eq nat (S n) O). let H2 \def (eq_ind nat (S n) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H1) in (False_ind P H2)) (\lambda m0:nat.(\lambda H1:(le (S n) m0).(\lambda _:((eq nat m0 O)\to P).(\lambda H2:(eq nat (S m0) O). let H3 \def (eq_ind nat (S m0) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H2) in let DEFINED \def (False_ind ((le (S n) m0)\to P) H3) in (DEFINED H1))))) O H0) in (H1 (refl_equal nat O)))))) (\lambda n:nat.(\lambda H:(\forall n0:nat.(\forall P:Prop.((le n n0)\to ((le (S n0) n)\to P)))).(\lambda n0:nat.(nat_ind (\lambda n1:nat.(\forall P:Prop.((le (S n) n1)\to ((le (S n1) (S n))\to P)))) (\lambda P:Prop.(\lambda H0:(le (S n) O).(\lambda _:(le (S O) (S n)). let H2 \def (le_ind (S n) (\lambda n1:nat.((eq nat n1 O)\to P)) (\lambda H2:(eq nat (S n) O). let H3 \def (eq_ind nat (S n) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H2) in (False_ind P H3)) (\lambda m0:nat.(\lambda H2:(le (S n) m0).(\lambda _:((eq nat m0 O)\to P).(\lambda H3:(eq nat (S m0) O). let H4 \def (eq_ind nat (S m0) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H3) in let DEFINED \def (False_ind ((le (S n) m0)\to P) H4) in (DEFINED H2))))) O H0) in (H2 (refl_equal nat O))))) (\lambda n1:nat.(\lambda _:(\forall P:Prop.((le (S n) n1)\to ((le (S n1) (S n))\to P))).(\lambda P:Prop.(\lambda H1:(le (S n) (S n1)).(\lambda H2:(le (S (S n1)) (S n)). let DEFINED \def (le_S_n (S n1) n H2) in (H n1 P (le_S_n n n1 H1) DEFINED)))))) n0)))) m)) +Post Nodes: 400 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_Sx_x +Pre Nodes : 20 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda H:(le (S x) x).(\lambda P:Prop. let H0 \def le_Sn_n in let DEFINED \def (H0 x H) in (False_ind P DEFINED)))) +Post Nodes: 22 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: minus_le +Pre Nodes : 88 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.(le (minus n y) n))) (\lambda _:nat.(le_n O)) (\lambda n:nat.(\lambda H:(\forall y:nat.(le (minus n y) n)).(\lambda y:nat.(nat_ind (\lambda n0:nat.(le (minus (S n) n0) (S n))) (le_n (S n)) (\lambda n0:nat.(\lambda _:(le +match n0 return (\lambda n1:nat.nat) with + [ O => (S n) + | (S (l:nat)) => (minus n l) +] (S n)).(le_S (minus n n0) n (H n0)))) y)))) x)) +Post Nodes: 88 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_plus_minus_sym +Pre Nodes : 45 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda n:nat.(\lambda m:nat.(\lambda H:(le n m). let DEFINED \def (plus_comm (minus m n) n) in (eq_ind_r nat (plus n (minus m n)) (\lambda n0:nat.(eq nat m n0)) (le_plus_minus n m H) (plus (minus m n) n) DEFINED)))) +Post Nodes: 47 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_minus_minus +Pre Nodes : 84 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda H:(le x y).(\lambda z:nat.(\lambda H0:(le y z). let DEFINED \def (le_plus_minus_r x z (le_trans x y z H H0)) in let DEFINED0 \def (le_plus_minus_r x y H) in (plus_le_reg_l x (minus y x) (minus z x) (eq_ind_r nat y (\lambda n:nat.(le n (plus x (minus z x)))) (eq_ind_r nat z (\lambda n:nat.(le y n)) H0 (plus x (minus z x)) DEFINED) (plus x (minus y x)) DEFINED0))))))) +Post Nodes: 88 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_minus_plus +Pre Nodes : 505 +Warn: Optimizer: remove 3 +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +nat +nat +nat +nat +Warn: Optimizer: remove 3 +Warn: Optimizer: swap 2 +Warn: Optimizer: nested application +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +Optimized : (\lambda z:nat.(nat_ind (\lambda n:nat.(\forall x:nat.((le n x)\to (\forall y:nat.(eq nat (minus (plus x y) n) (plus (minus x n) y)))))) (\lambda x:nat.(\lambda H:(le O x). let H0 \def (le_ind O (\lambda n:nat.((eq nat n x)\to (\forall y:nat.(eq nat (minus (plus x y) O) (plus (minus x O) y))))) (\lambda H0:(eq nat O x).(eq_ind nat O (\lambda n:nat.(\forall y:nat.(eq nat (minus (plus n y) O) (plus (minus n O) y)))) (\lambda y:nat.(sym_eq nat (plus (minus O O) y) (minus (plus O y) O) (minus_n_O (plus O y)))) x H0)) (\lambda m:nat.(\lambda H0:(le O m).(\lambda _:((eq nat m x)\to (\forall y:nat.(eq nat (minus (plus x y) O) (plus (minus x O) y)))).(\lambda H1:(eq nat (S m) x). let DEFINED \def (eq_ind nat (S m) (\lambda n:nat.((le O m)\to (\forall y:nat.(eq nat (minus (plus n y) O) (plus (minus n O) y))))) (\lambda _:(le O m).(\lambda y:nat.(refl_equal nat (plus (minus (S m) O) y)))) x H1) in (DEFINED H0))))) x H) in (H0 (refl_equal nat x)))) (\lambda z0:nat.(\lambda H:(\forall x:nat.((le z0 x)\to (\forall y:nat.(eq nat (minus (plus x y) z0) (plus (minus x z0) y))))).(\lambda x:nat.(nat_ind (\lambda n:nat.((le (S z0) n)\to (\forall y:nat.(eq nat (minus (plus n y) (S z0)) (plus (minus n (S z0)) y))))) (\lambda H0:(le (S z0) O).(\lambda y:nat. let H1 \def (le_ind (S z0) (\lambda n:nat.((eq nat n O)\to (eq nat (minus (plus O y) (S z0)) (plus (minus O (S z0)) y)))) (\lambda H1:(eq nat (S z0) O). let H2 \def (eq_ind nat (S z0) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H1) in (False_ind (eq nat (minus (plus O y) (S z0)) (plus (minus O (S z0)) y)) H2)) (\lambda m:nat.(\lambda H1:(le (S z0) m).(\lambda _:((eq nat m O)\to (eq nat (minus (plus O y) (S z0)) (plus (minus O (S z0)) y))).(\lambda H2:(eq nat (S m) O). let H3 \def (eq_ind nat (S m) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H2) in let DEFINED \def (False_ind ((le (S z0) m)\to (eq nat (minus (plus O y) (S z0)) (plus (minus O (S z0)) y))) H3) in (DEFINED H1))))) O H0) in (H1 (refl_equal nat O)))) (\lambda n:nat.(\lambda _:((le (S z0) n)\to (\forall y:nat.(eq nat (minus (plus n y) (S z0)) (plus (minus n (S z0)) y)))).(\lambda H1:(le (S z0) (S n)).(\lambda y:nat.(H n (le_S_n z0 n H1) y))))) x)))) z)) +Post Nodes: 560 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_minus +Pre Nodes : 51 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda z:nat.(\lambda y:nat.(\lambda H:(le (plus x y) z). let DEFINED \def (minus_plus_r x y) in (eq_ind nat (minus (plus x y) y) (\lambda n:nat.(le n (minus z y))) (le_minus_minus y (plus x y) (le_plus_r x y) z H) x DEFINED))))) +Post Nodes: 53 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_trans_plus_r +Pre Nodes : 27 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda z:nat.(\lambda H:(le (plus x y) z).(le_trans y (plus x y) z (le_plus_r x y) H))))) +Post Nodes: 27 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_gen_S +Pre Nodes : 217 +Warn: Optimizer: remove 3 +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +Optimized : (\lambda m:nat.(\lambda x:nat.(\lambda H:(le (S m) x). let H0 \def (le_ind (S m) (\lambda n:nat.((eq nat n x)\to (ex2 nat (\lambda n0:nat.(eq nat x (S n0))) (\lambda n0:nat.(le m n0))))) (\lambda H0:(eq nat (S m) x).(eq_ind nat (S m) (\lambda n:nat.(ex2 nat (\lambda n0:nat.(eq nat n (S n0))) (\lambda n0:nat.(le m n0)))) (ex_intro2 nat (\lambda n:nat.(eq nat (S m) (S n))) (\lambda n:nat.(le m n)) m (refl_equal nat (S m)) (le_n m)) x H0)) (\lambda m0:nat.(\lambda H0:(le (S m) m0).(\lambda _:((eq nat m0 x)\to (ex2 nat (\lambda n0:nat.(eq nat x (S n0))) (\lambda n0:nat.(le m n0)))).(\lambda H1:(eq nat (S m0) x). let DEFINED \def (eq_ind nat (S m0) (\lambda n:nat.((le (S m) m0)\to (ex2 nat (\lambda n0:nat.(eq nat n (S n0))) (\lambda n0:nat.(le m n0))))) (\lambda H2:(le (S m) m0).(ex_intro2 nat (\lambda n:nat.(eq nat (S m0) (S n))) (\lambda n:nat.(le m n)) m0 (refl_equal nat (S m0)) (le_S_n m m0 (le_S (S m) m0 H2)))) x H1) in (DEFINED H0))))) x H) in (H0 (refl_equal nat x))))) +Post Nodes: 243 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_x_plus_x_Sy +Pre Nodes : 64 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda y:nat. let DEFINED \def (plus_comm x (S y)) in (eq_ind_r nat (plus (S y) x) (\lambda n:nat.(lt x n)) (le_S_n (S x) (S (plus y x)) (le_n_S (S x) (S (plus y x)) (le_n_S x (plus y x) (le_plus_r y x)))) (plus x (S y)) DEFINED))) +Post Nodes: 66 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: simpl_lt_plus_r +Pre Nodes : 75 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda p:nat.(\lambda n:nat.(\lambda m:nat.(\lambda H:(lt (plus n p) (plus m p)). let DEFINED \def (plus_comm n p) in let H0 \def (eq_ind nat (plus n p) (\lambda n0:nat.(lt n0 (plus m p))) H (plus p n) DEFINED) in let DEFINED0 \def (plus_comm m p) in let H1 \def (eq_ind nat (plus m p) (\lambda n0:nat.(lt (plus p n) n0)) H0 (plus p m) DEFINED0) in (plus_lt_reg_l n m p H1))))) +Post Nodes: 79 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: minus_x_Sy +Pre Nodes : 330 +nat +nat +nat +nat +Warn: Optimizer: remove 3 +Warn: Optimizer: swap 2 +Warn: Optimizer: nested application +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.((lt y n)\to (eq nat (minus n y) (S (minus n (S y))))))) (\lambda y:nat.(\lambda H:(lt y O). let H0 \def (le_ind (S y) (\lambda n:nat.((eq nat n O)\to (eq nat (minus O y) (S (minus O (S y)))))) (\lambda H0:(eq nat (S y) O). let H1 \def (eq_ind nat (S y) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H0) in (False_ind (eq nat (minus O y) (S (minus O (S y)))) H1)) (\lambda m:nat.(\lambda H0:(le (S y) m).(\lambda _:((eq nat m O)\to (eq nat (minus O y) (S (minus O (S y))))).(\lambda H1:(eq nat (S m) O). let H2 \def (eq_ind nat (S m) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H1) in let DEFINED \def (False_ind ((le (S y) m)\to (eq nat (minus O y) (S (minus O (S y))))) H2) in (DEFINED H0))))) O H) in (H0 (refl_equal nat O)))) (\lambda n:nat.(\lambda H:(\forall y:nat.((lt y n)\to (eq nat (minus n y) (S (minus n (S y)))))).(\lambda y:nat.(nat_ind (\lambda n0:nat.((lt n0 (S n))\to (eq nat (minus (S n) n0) (S (minus (S n) (S n0)))))) (\lambda _:(lt O (S n)). let DEFINED \def (minus_n_O n) in (eq_ind nat n (\lambda n0:nat.(eq nat (S n) (S n0))) (refl_equal nat (S n)) (minus n O) DEFINED)) (\lambda n0:nat.(\lambda _:((lt n0 (S n))\to (eq nat (minus (S n) n0) (S (minus (S n) (S n0))))).(\lambda H1:(lt (S n0) (S n)). let H2 \def (le_S_n (S n0) n H1) in (H n0 H2)))) y)))) x)) +Post Nodes: 354 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_plus_minus +Pre Nodes : 16 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda H:(lt x y).(le_plus_minus (S x) y H)))) +Post Nodes: 16 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_plus_minus_r +Pre Nodes : 53 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda H:(lt x y). let DEFINED \def (plus_comm (minus y (S x)) x) in (eq_ind_r nat (plus x (minus y (S x))) (\lambda n:nat.(eq nat y (S n))) (lt_plus_minus x y H) (plus (minus y (S x)) x) DEFINED)))) +Post Nodes: 55 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: minus_x_SO +Pre Nodes : 56 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda H:(lt O x). let DEFINED \def (minus_n_O x) in let DEFINED0 \def (minus_x_Sy x O H) in (eq_ind nat (minus x O) (\lambda n:nat.(eq nat x n)) (eq_ind nat x (\lambda n:nat.(eq nat x n)) (refl_equal nat x) (minus x O) DEFINED) (S (minus x (S O))) DEFINED0))) +Post Nodes: 60 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_x_pred_y +Pre Nodes : 175 +nat +nat +nat +nat +Warn: Optimizer: remove 3 +Warn: Optimizer: swap 2 +Warn: Optimizer: nested application +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +Optimized : (\lambda y:nat.(nat_ind (\lambda n:nat.(\forall x:nat.((lt x n)\to (le x (pred n))))) (\lambda x:nat.(\lambda H:(lt x O). let H0 \def (le_ind (S x) (\lambda n:nat.((eq nat n O)\to (le x O))) (\lambda H0:(eq nat (S x) O). let H1 \def (eq_ind nat (S x) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H0) in (False_ind (le x O) H1)) (\lambda m:nat.(\lambda H0:(le (S x) m).(\lambda _:((eq nat m O)\to (le x O)).(\lambda H1:(eq nat (S m) O). let H2 \def (eq_ind nat (S m) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H1) in let DEFINED \def (False_ind ((le (S x) m)\to (le x O)) H2) in (DEFINED H0))))) O H) in (H0 (refl_equal nat O)))) (\lambda n:nat.(\lambda _:(\forall x:nat.((lt x n)\to (le x (pred n)))).(\lambda x:nat.(\lambda H0:(lt x (S n)).(le_S_n x n H0))))) y)) +Post Nodes: 186 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_le_minus +Pre Nodes : 44 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda H:(lt x y). let DEFINED \def (plus_comm x (S O)) in (le_minus x y (S O) (eq_ind_r nat (plus (S O) x) (\lambda n:nat.(le n y)) H (plus x (S O)) DEFINED))))) +Post Nodes: 46 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_le_e +Pre Nodes : 39 +Optimized : (\lambda n:nat.(\lambda d:nat.(\lambda P:Prop.(\lambda H:((lt n d)\to P).(\lambda H0:((le d n)\to P). let H1 \def (le_or_lt d n) in (or_ind (le d n) (lt n d) P H0 H H1)))))) +Post Nodes: 39 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_eq_e +Pre Nodes : 45 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda P:Prop.(\lambda H:((lt x y)\to P).(\lambda H0:((eq nat x y)\to P).(\lambda H1:(le x y). let DEFINED \def (le_lt_or_eq x y H1) in (or_ind (lt x y) (eq nat x y) P H H0 DEFINED))))))) +Post Nodes: 47 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_eq_gt_e +Pre Nodes : 60 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda P:Prop.(\lambda H:((lt x y)\to P).(\lambda H0:((eq nat x y)\to P).(\lambda H1:((lt y x)\to P).(lt_le_e x y P H (\lambda H2:(le y x).(lt_eq_e y x P H1 (\lambda H3:(eq nat y x).(H0 (sym_eq nat y x H3))) H2))))))))) +Post Nodes: 60 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_gen_xS +Pre Nodes : 190 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall n0:nat.((lt n (S n0))\to (or (eq nat n O) (ex2 nat (\lambda m:nat.(eq nat n (S m))) (\lambda m:nat.(lt m n0))))))) (\lambda n:nat.(\lambda _:(lt O (S n)).(or_introl (eq nat O O) (ex2 nat (\lambda m:nat.(eq nat O (S m))) (\lambda m:nat.(lt m n))) (refl_equal nat O)))) (\lambda n:nat.(\lambda _:(\forall n0:nat.((lt n (S n0))\to (or (eq nat n O) (ex2 nat (\lambda m:nat.(eq nat n (S m))) (\lambda m:nat.(lt m n0)))))).(\lambda n0:nat.(\lambda H0:(lt (S n) (S n0)).(or_intror (eq nat (S n) O) (ex2 nat (\lambda m:nat.(eq nat (S n) (S m))) (\lambda m:nat.(lt m n0))) (ex_intro2 nat (\lambda m:nat.(eq nat (S n) (S m))) (\lambda m:nat.(lt m n0)) n (refl_equal nat (S n)) (le_S_n (S n) n0 H0))))))) x)) +Post Nodes: 190 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_lt_false +Pre Nodes : 25 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda H:(le x y).(\lambda H0:(lt y x).(\lambda P:Prop. let DEFINED \def (le_not_lt x y H H0) in (False_ind P DEFINED)))))) +Post Nodes: 27 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: lt_neq +Pre Nodes : 33 +Optimized : (\lambda x:nat.(\lambda y:nat.(\lambda H:(lt x y).(\lambda H0:(eq nat x y). let H1 \def (eq_ind nat x (\lambda n:nat.(lt n y)) H y H0) in (lt_irrefl y H1))))) +Post Nodes: 33 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: arith0 +Pre Nodes : 185 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda h2:nat.(\lambda d2:nat.(\lambda n:nat.(\lambda H:(le (plus d2 h2) n).(\lambda h3:nat. let DEFINED \def (plus_comm h2 d2) in let DEFINED0 \def (plus_assoc h2 d2 h3) in let DEFINED1 \def (minus_plus h2 (plus d2 h3)) in (eq_ind nat (minus (plus h2 (plus d2 h3)) h2) (\lambda n0:nat.(le n0 (minus (plus n h3) h2))) (le_minus_minus h2 (plus h2 (plus d2 h3)) (le_plus_l h2 (plus d2 h3)) (plus n h3) (eq_ind_r nat (plus (plus h2 d2) h3) (\lambda n0:nat.(le n0 (plus n h3))) (eq_ind_r nat (plus d2 h2) (\lambda n0:nat.(le (plus n0 h3) (plus n h3))) (le_S_n (plus (plus d2 h2) h3) (plus n h3) (lt_le_S (plus (plus d2 h2) h3) (S (plus n h3)) (le_lt_n_Sm (plus (plus d2 h2) h3) (plus n h3) (plus_le_compat (plus d2 h2) n h3 h3 H (le_n h3))))) (plus h2 d2) DEFINED) (plus h2 (plus d2 h3)) DEFINED0)) (plus d2 h3) DEFINED1)))))) +Post Nodes: 191 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: O_minus +Pre Nodes : 211 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.((le n y)\to (eq nat (minus n y) O)))) (\lambda y:nat.(\lambda _:(le O y).(refl_equal nat O))) (\lambda x0:nat.(\lambda H:(\forall y:nat.((le x0 y)\to (eq nat (minus x0 y) O))).(\lambda y:nat.(nat_ind (\lambda n:nat.((le (S x0) n)\to (eq nat +match n return (\lambda n1:nat.nat) with + [ O => (S x0) + | (S (l:nat)) => (minus x0 l) +] O))) (\lambda H0:(le (S x0) O). let DEFINED \def (le_gen_S x0 O H0) in (ex2_ind nat (\lambda n:nat.(eq nat O (S n))) (\lambda n:nat.(le x0 n)) (eq nat (S x0) O) (\lambda x1:nat.(\lambda H1:(eq nat O (S x1)).(\lambda _:(le x0 x1). let H3 \def (eq_ind nat O (\lambda ee:nat. +match ee return (\lambda _:nat.Prop) with + [ O => True + | (S (_:nat)) => False +]) I (S x1) H1) in (False_ind (eq nat (S x0) O) H3)))) DEFINED)) (\lambda n:nat.(\lambda _:((le (S x0) n)\to (eq nat +match n return (\lambda n1:nat.nat) with + [ O => (S x0) + | (S (l:nat)) => (minus x0 l) +] O)).(\lambda H1:(le (S x0) (S n)).(H n (le_S_n x0 n H1))))) y)))) x)) +Post Nodes: 213 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: minus_minus +Pre Nodes : 592 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda z:nat.(nat_ind (\lambda n:nat.(\forall x:nat.(\forall y:nat.((le n x)\to ((le n y)\to ((eq nat (minus x n) (minus y n))\to (eq nat x y))))))) (\lambda x:nat.(\lambda y:nat.(\lambda _:(le O x).(\lambda _:(le O y).(\lambda H1:(eq nat (minus x O) (minus y O)). let DEFINED \def (minus_n_O x) in let H2 \def (eq_ind_r nat (minus x O) (\lambda n:nat.(eq nat n (minus y O))) H1 x DEFINED) in let DEFINED0 \def (minus_n_O y) in let H3 \def (eq_ind_r nat (minus y O) (\lambda n:nat.(eq nat x n)) H2 y DEFINED0) in H3))))) (\lambda z0:nat.(\lambda IH:(\forall x:nat.(\forall y:nat.((le z0 x)\to ((le z0 y)\to ((eq nat (minus x z0) (minus y z0))\to (eq nat x y)))))).(\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.((le (S z0) n)\to ((le (S z0) y)\to ((eq nat (minus n (S z0)) (minus y (S z0)))\to (eq nat n y)))))) (\lambda y:nat.(\lambda H:(le (S z0) O).(\lambda _:(le (S z0) y).(\lambda _:(eq nat (minus O (S z0)) (minus y (S z0))). let DEFINED \def (le_gen_S z0 O H) in (ex2_ind nat (\lambda n:nat.(eq nat O (S n))) (\lambda n:nat.(le z0 n)) (eq nat O y) (\lambda x0:nat.(\lambda H2:(eq nat O (S x0)).(\lambda _:(le z0 x0). let H4 \def (eq_ind nat O (\lambda ee:nat. +match ee return (\lambda _:nat.Prop) with + [ O => True + | (S (_:nat)) => False +]) I (S x0) H2) in (False_ind (eq nat O y) H4)))) DEFINED))))) (\lambda x0:nat.(\lambda _:(\forall y:nat.((le (S z0) x0)\to ((le (S z0) y)\to ((eq nat (minus x0 (S z0)) (minus y (S z0)))\to (eq nat x0 y))))).(\lambda y:nat.(nat_ind (\lambda n:nat.((le (S z0) (S x0))\to ((le (S z0) n)\to ((eq nat (minus (S x0) (S z0)) (minus n (S z0)))\to (eq nat (S x0) n))))) (\lambda _:(le (S z0) (S x0)).(\lambda H0:(le (S z0) O).(\lambda _:(eq nat (minus (S x0) (S z0)) (minus O (S z0))). let DEFINED \def (le_gen_S z0 O H0) in (ex2_ind nat (\lambda n:nat.(eq nat O (S n))) (\lambda n:nat.(le z0 n)) (eq nat (S x0) O) (\lambda x1:nat.(\lambda H2:(eq nat O (S x1)).(\lambda _:(le z0 x1). let H4 \def (eq_ind nat O (\lambda ee:nat. +match ee return (\lambda _:nat.Prop) with + [ O => True + | (S (_:nat)) => False +]) I (S x1) H2) in (False_ind (eq nat (S x0) O) H4)))) DEFINED)))) (\lambda y0:nat.(\lambda _:((le (S z0) (S x0))\to ((le (S z0) y0)\to ((eq nat (minus (S x0) (S z0)) (minus y0 (S z0)))\to (eq nat (S x0) y0)))).(\lambda H:(le (S z0) (S x0)).(\lambda H0:(le (S z0) (S y0)).(\lambda H1:(eq nat (minus (S x0) (S z0)) (minus (S y0) (S z0))).(f_equal nat nat S x0 y0 (IH x0 y0 (le_S_n z0 x0 H) (le_S_n z0 y0 H0) H1))))))) y)))) x)))) z)) +Post Nodes: 600 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: plus_plus +Pre Nodes : 1222 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Warn: Optimizer: swap 1 +Optimized : (\lambda z:nat.(nat_ind (\lambda n:nat.(\forall x1:nat.(\forall x2:nat.(\forall y1:nat.(\forall y2:nat.((le x1 n)\to ((le x2 n)\to ((eq nat (plus (minus n x1) y1) (plus (minus n x2) y2))\to (eq nat (plus x1 y2) (plus x2 y1)))))))))) (\lambda x1:nat.(\lambda x2:nat.(\lambda y1:nat.(\lambda y2:nat.(\lambda H:(le x1 O).(\lambda H0:(le x2 O).(\lambda H1:(eq nat y1 y2). let H_y \def (le_n_O_eq x2 H0) in let H_y0 \def (le_n_O_eq x1 H) in (eq_ind nat y1 (\lambda n:nat.(eq nat (plus x1 n) (plus x2 y1))) (eq_ind nat O (\lambda n:nat.(eq nat (plus x1 y1) (plus n y1))) (eq_ind nat O (\lambda n:nat.(eq nat (plus n y1) (plus O y1))) (refl_equal nat (plus O y1)) x1 H_y0) x2 H_y) y2 H1)))))))) (\lambda z0:nat.(\lambda IH:(\forall x1:nat.(\forall x2:nat.(\forall y1:nat.(\forall y2:nat.((le x1 z0)\to ((le x2 z0)\to ((eq nat (plus (minus z0 x1) y1) (plus (minus z0 x2) y2))\to (eq nat (plus x1 y2) (plus x2 y1))))))))).(\lambda x1:nat.(nat_ind (\lambda n:nat.(\forall x2:nat.(\forall y1:nat.(\forall y2:nat.((le n (S z0))\to ((le x2 (S z0))\to ((eq nat (plus (minus (S z0) n) y1) (plus (minus (S z0) x2) y2))\to (eq nat (plus n y2) (plus x2 y1))))))))) (\lambda x2:nat.(nat_ind (\lambda n:nat.(\forall y1:nat.(\forall y2:nat.((le O (S z0))\to ((le n (S z0))\to ((eq nat (plus (minus (S z0) O) y1) (plus (minus (S z0) n) y2))\to (eq nat (plus O y2) (plus n y1)))))))) (\lambda y1:nat.(\lambda y2:nat.(\lambda _:(le O (S z0)).(\lambda _:(le O (S z0)).(\lambda H1:(eq nat (S (plus z0 y1)) (S (plus z0 y2))). let H_y \def (IH O O) in let DEFINED \def (minus_n_O z0) in let H2 \def (eq_ind_r nat (minus z0 O) (\lambda n:nat.(\forall y3:nat.(\forall y4:nat.((le O z0)\to ((le O z0)\to ((eq nat (plus n y3) (plus n y4))\to (eq nat y4 y3))))))) H_y z0 DEFINED) in (H2 y1 y2 (le_O_n z0) (le_O_n z0) (H2 (plus z0 y2) (plus z0 y1) (le_O_n z0) (le_O_n z0) (f_equal nat nat (plus z0) (plus z0 y2) (plus z0 y1) (sym_eq nat (plus z0 y1) (plus z0 y2) (eq_add_S (plus z0 y1) (plus z0 y2) H1)))))))))) (\lambda x3:nat.(\lambda _:(\forall y1:nat.(\forall y2:nat.((le O (S z0))\to ((le x3 (S z0))\to ((eq nat (S (plus z0 y1)) (plus +match x3 return (\lambda n:nat.nat) with + [ O => (S z0) + | (S (l:nat)) => (minus z0 l) +] y2))\to (eq nat y2 (plus x3 y1))))))).(\lambda y1:nat.(\lambda y2:nat.(\lambda _:(le O (S z0)).(\lambda H0:(le (S x3) (S z0)).(\lambda H1:(eq nat (S (plus z0 y1)) (plus (minus z0 x3) y2)). let H_y \def (IH O x3 (S y1)) in let DEFINED \def (minus_n_O z0) in let H2 \def (eq_ind_r nat (minus z0 O) (\lambda n:nat.(\forall y3:nat.((le O z0)\to ((le x3 z0)\to ((eq nat (plus n (S y1)) (plus (minus z0 x3) y3))\to (eq nat y3 (plus x3 (S y1)))))))) H_y z0 DEFINED) in let DEFINED0 \def (plus_n_Sm z0 y1) in let H3 \def (eq_ind_r nat (plus z0 (S y1)) (\lambda n:nat.(\forall y3:nat.((le O z0)\to ((le x3 z0)\to ((eq nat n (plus (minus z0 x3) y3))\to (eq nat y3 (plus x3 (S y1)))))))) H2 (S (plus z0 y1)) DEFINED0) in let DEFINED1 \def (plus_n_Sm x3 y1) in let H4 \def (eq_ind_r nat (plus x3 (S y1)) (\lambda n:nat.(\forall y3:nat.((le O z0)\to ((le x3 z0)\to ((eq nat (S (plus z0 y1)) (plus (minus z0 x3) y3))\to (eq nat y3 n)))))) H3 (S (plus x3 y1)) DEFINED1) in (H4 y2 (le_O_n z0) (le_S_n x3 z0 H0) H1)))))))) x2)) (\lambda x2:nat.(\lambda _:(\forall x3:nat.(\forall y1:nat.(\forall y2:nat.((le x2 (S z0))\to ((le x3 (S z0))\to ((eq nat (plus (minus (S z0) x2) y1) (plus (minus (S z0) x3) y2))\to (eq nat (plus x2 y2) (plus x3 y1)))))))).(\lambda x3:nat.(nat_ind (\lambda n:nat.(\forall y1:nat.(\forall y2:nat.((le (S x2) (S z0))\to ((le n (S z0))\to ((eq nat (plus (minus (S z0) (S x2)) y1) (plus (minus (S z0) n) y2))\to (eq nat (plus (S x2) y2) (plus n y1)))))))) (\lambda y1:nat.(\lambda y2:nat.(\lambda H:(le (S x2) (S z0)).(\lambda _:(le O (S z0)).(\lambda H1:(eq nat (plus (minus z0 x2) y1) (S (plus z0 y2))). let H_y \def (IH x2 O y1 (S y2)) in let DEFINED \def (minus_n_O z0) in let H2 \def (eq_ind_r nat (minus z0 O) (\lambda n:nat.((le x2 z0)\to ((le O z0)\to ((eq nat (plus (minus z0 x2) y1) (plus n (S y2)))\to (eq nat (plus x2 (S y2)) y1))))) H_y z0 DEFINED) in let DEFINED0 \def (plus_n_Sm z0 y2) in let H3 \def (eq_ind_r nat (plus z0 (S y2)) (\lambda n:nat.((le x2 z0)\to ((le O z0)\to ((eq nat (plus (minus z0 x2) y1) n)\to (eq nat (plus x2 (S y2)) y1))))) H2 (S (plus z0 y2)) DEFINED0) in let DEFINED1 \def (plus_n_Sm x2 y2) in let H4 \def (eq_ind_r nat (plus x2 (S y2)) (\lambda n:nat.((le x2 z0)\to ((le O z0)\to ((eq nat (plus (minus z0 x2) y1) (S (plus z0 y2)))\to (eq nat n y1))))) H3 (S (plus x2 y2)) DEFINED1) in (H4 (le_S_n x2 z0 H) (le_O_n z0) H1)))))) (\lambda x4:nat.(\lambda _:(\forall y1:nat.(\forall y2:nat.((le (S x2) (S z0))\to ((le x4 (S z0))\to ((eq nat (plus (minus z0 x2) y1) (plus +match x4 return (\lambda n:nat.nat) with + [ O => (S z0) + | (S (l:nat)) => (minus z0 l) +] y2))\to (eq nat (S (plus x2 y2)) (plus x4 y1))))))).(\lambda y1:nat.(\lambda y2:nat.(\lambda H:(le (S x2) (S z0)).(\lambda H0:(le (S x4) (S z0)).(\lambda H1:(eq nat (plus (minus z0 x2) y1) (plus (minus z0 x4) y2)).(f_equal nat nat S (plus x2 y2) (plus x4 y1) (IH x2 x4 y1 y2 (le_S_n x2 z0 H) (le_S_n x4 z0 H0) H1))))))))) x3)))) x1)))) z)) +Post Nodes: 1236 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: le_S_minus +Pre Nodes : 41 +Warn: Optimizer: remove 1 +Optimized : (\lambda d:nat.(\lambda h:nat.(\lambda n:nat.(\lambda H:(le (plus d h) n).(le_S d (minus n h) (le_minus d n h H)))))) +Post Nodes: 27 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./ext/arith.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of ext/arith.mma completed in 44''. +Info: execution of ext/tactics.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/ext ...'' +Info: baseuri cic:/matita/LAMBDA-TYPES/Base-2/ext/tactics is not empty +Info: cleaning baseuri cic:/matita/LAMBDA-TYPES/Base-2/ext/tactics +Info: Removing: cic:/matita/LAMBDA-TYPES/Base-2/ext/tactics/* +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...'' +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: insert_eq +Pre Nodes : 36 +Optimized : (\lambda S:Set.(\lambda x:S.(\lambda P:(S\to Prop).(\lambda G:Prop.(\lambda H:(\forall y:S.((P y)\to ((eq S y x)\to G))).(\lambda H0:(P x).(H x H0 (refl_equal S x)))))))) +Post Nodes: 36 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: unintro +Pre Nodes : 17 +Optimized : (\lambda A:Set.(\lambda a:A.(\lambda P:(A\to Prop).(\lambda H:(\forall x:A.(P x)).(H a))))) +Post Nodes: 17 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: xinduction +Pre Nodes : 27 +Optimized : (\lambda A:Set.(\lambda t:A.(\lambda P:(A\to Prop).(\lambda H:(\forall x:A.((eq A t x)\to (P x))).(H t (refl_equal A t)))))) +Post Nodes: 27 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./ext/tactics.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of ext/tactics.mma completed in 4''. +Info: execution of pippo.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/pip ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...'' +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: minus_x_Sy +Pre Nodes : 330 +nat +nat +nat +nat +Warn: Optimizer: remove 3 +Warn: Optimizer: swap 2 +Warn: Optimizer: nested application +Warn: Optimizer: anticipate 2 +Warn: Optimizer: swap 2 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda x:nat.(nat_ind (\lambda n:nat.(\forall y:nat.((lt y n)\to (eq nat (minus n y) (S (minus n (S y))))))) (\lambda y:nat.(\lambda H:(lt y O). let H0 \def (le_ind (S y) (\lambda n:nat.((eq nat n O)\to (eq nat (minus O y) (S (minus O (S y)))))) (\lambda H0:(eq nat (S y) O). let H1 \def (eq_ind nat (S y) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H0) in (False_ind (eq nat (minus O y) (S (minus O (S y)))) H1)) (\lambda m:nat.(\lambda H0:(le (S y) m).(\lambda _:((eq nat m O)\to (eq nat (minus O y) (S (minus O (S y))))).(\lambda H1:(eq nat (S m) O). let H2 \def (eq_ind nat (S m) (\lambda e:nat. +match e return (\lambda _:nat.Prop) with + [ O => False + | (S (_:nat)) => True +]) I O H1) in let DEFINED \def (False_ind ((le (S y) m)\to (eq nat (minus O y) (S (minus O (S y))))) H2) in (DEFINED H0))))) O H) in (H0 (refl_equal nat O)))) (\lambda n:nat.(\lambda H:(\forall y:nat.((lt y n)\to (eq nat (minus n y) (S (minus n (S y)))))).(\lambda y:nat.(nat_ind (\lambda n0:nat.((lt n0 (S n))\to (eq nat (minus (S n) n0) (S (minus (S n) (S n0)))))) (\lambda _:(lt O (S n)). let DEFINED \def (minus_n_O n) in (eq_ind nat n (\lambda n0:nat.(eq nat (S n) (S n0))) (refl_equal nat (S n)) (minus n O) DEFINED)) (\lambda n0:nat.(\lambda _:((lt n0 (S n))\to (eq nat (minus (S n) n0) (S (minus (S n) (S n0))))).(\lambda H1:(lt (S n0) (S n)). let H2 \def (le_S_n (S n0) n H1) in (H n0 H2)))) y)))) x)) +Post Nodes: 354 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./pippo.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of pippo.mma completed in 2''. +Info: execution of plist/defs.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/pli ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./plist/defs.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of plist/defs.mma completed in 1''. +Info: execution of plist/props.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/pli ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./plist/defs.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/plist/def ...'' +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: papp_ss +Pre Nodes : 121 +Warn: Optimizer: anticipate 3 +Warn: Optimizer: swap 3 +Optimized : (\lambda is1:PList.(PList_ind (\lambda p:PList.(\forall is2:PList.(eq PList (papp (Ss p) (Ss is2)) (Ss (papp p is2))))) (\lambda is2:PList.(refl_equal PList (Ss is2))) (\lambda n:nat.(\lambda n0:nat.(\lambda p:PList.(\lambda H:(\forall is2:PList.(eq PList (papp (Ss p) (Ss is2)) (Ss (papp p is2)))).(\lambda is2:PList. let DEFINED \def (H is2) in (eq_ind_r PList (Ss (papp p is2)) (\lambda p0:PList.(eq PList (PCons n (S n0) p0) (PCons n (S n0) (Ss (papp p is2))))) (refl_equal PList (PCons n (S n0) (Ss (papp p is2)))) (papp (Ss p) (Ss is2)) DEFINED)))))) is1)) +Post Nodes: 123 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./plist/props.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of plist/props.mma completed in 2''. +Info: execution of types/defs.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/typ ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./types/defs.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of types/defs.mma completed in 0''. +Info: execution of types/props.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/typ ...'' +Info: baseuri cic:/matita/LAMBDA-TYPES/Base-2/types/props is not empty +Info: cleaning baseuri cic:/matita/LAMBDA-TYPES/Base-2/types/props +Info: Removing: cic:/matita/LAMBDA-TYPES/Base-2/types/props/* +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./types/defs.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/types/def ...'' +Debug: Executing: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...'' +BEGIN: ex2_sym +Pre Nodes : 77 +Optimized : (\lambda A:Set.(\lambda P:(A\to Prop).(\lambda Q:(A\to Prop).(\lambda H:(ex2 A (\lambda x:A.(P x)) (\lambda x:A.(Q x))).(ex2_ind A (\lambda x:A.(P x)) (\lambda x:A.(Q x)) (ex2 A (\lambda x:A.(Q x)) (\lambda x:A.(P x))) (\lambda x:A.(\lambda H0:(P x).(\lambda H1:(Q x).(ex_intro2 A (\lambda x0:A.(Q x0)) (\lambda x0:A.(P x0)) x H1 H0)))) H))))) +Post Nodes: 77 +Debug: Procedural: level 2 transformation +Debug: Procedural: grafite rendering +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./types/props.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of types/props.mma completed in 2''. +Info: execution of theory.mma started: +Debug: Executing: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/the ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./ext/tactics.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/ext/tacti ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./ext/arith.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/ext/arith ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./types/props.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/types/pro ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./blt/props.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/blt/props ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./plist/props.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Debug: Executing: ``include "cic:/matita/LAMBDA-TYPES/Base-2/plist/pro ...'' +Debug: Including /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./theory.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/. +Info: execution of theory.mma completed in 1''. diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/makefile b/matita/contribs/LAMBDA-TYPES/Base-2/makefile new file mode 100644 index 000000000..f20e608d8 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/makefile @@ -0,0 +1,58 @@ +H=@ + +RT_BASEDIR=../../../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: build_mas preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: clean_mas preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: clean_mas preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: build_mas preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: clean_mas preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: clean_mas preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) + +# FG: added part ############################################################ + +MATITAC = $(RT_BASEDIR)/matitac.opt + +MMAS = $(shell find -name "*.mma") +MAS = $(MMAS:%.mma=%.ma) + +build_mas: preall.opt $(MAS) + +clean_mas: + $(H)rm -f $(MAS) + +%.ma: %.mma + $(H)$(MATITAC) -dump $@ $< $(OPTIONS) + +include depend + +.DELETE_ON_ERROR: diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/plist/defs.mma b/matita/contribs/LAMBDA-TYPES/Base-2/plist/defs.mma new file mode 100644 index 000000000..3dc03da0b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/plist/defs.mma @@ -0,0 +1,32 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/plist/defs". + +include "preamble.ma". + + +(* object PList not inlined *) + + +(* object PConsTail not inlined *) + + +(* object Ss not inlined *) + + +(* object papp not inlined *) + diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/plist/props.mma b/matita/contribs/LAMBDA-TYPES/Base-2/plist/props.mma new file mode 100644 index 000000000..29357a88a --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/plist/props.mma @@ -0,0 +1,22 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/plist/props". + +include "plist/defs.ma". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/plist/props/papp_ss.con". + diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/preamble.ma b/matita/contribs/LAMBDA-TYPES/Base-2/preamble.ma new file mode 100644 index 000000000..f04df2037 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/preamble.ma @@ -0,0 +1,30 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/preamble". + +include "../Base-1/definitions.ma". + +default "equality" + cic:/Coq/Init/Logic/eq.ind + cic:/matita/LAMBDA-TYPES/Base-1/preamble/sym_eq.con + cic:/matita/LAMBDA-TYPES/Base-1/preamble/trans_eq.con + cic:/Coq/Init/Logic/eq_ind.con + cic:/Coq/Init/Logic/eq_ind_r.con + cic:/Coq/Init/Logic/eq_rec.con + cic:/Coq/Init/Logic/eq_rec_r.con + cic:/Coq/Init/Logic/eq_rect.con + cic:/Coq/Init/Logic/eq_rect_r.con + cic:/matita/LAMBDA-TYPES/Base-1/preamble/f_equal.con + cic:/matita/legacy/coq/f_equal1.con. diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/theory.mma b/matita/contribs/LAMBDA-TYPES/Base-2/theory.mma new file mode 100644 index 000000000..1adab3e2b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/theory.mma @@ -0,0 +1,28 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/theory". + +include "ext/tactics.ma". + +include "ext/arith.ma". + +include "types/props.ma". + +include "blt/props.ma". + +include "plist/props.ma". + diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/types/defs.mma b/matita/contribs/LAMBDA-TYPES/Base-2/types/defs.mma new file mode 100644 index 000000000..000f283aa --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/types/defs.mma @@ -0,0 +1,80 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/types/defs". + +include "preamble.ma". + + +(* object and3 not inlined *) + + +(* object and4 not inlined *) + + +(* object or3 not inlined *) + + +(* object or4 not inlined *) + + +(* object ex3 not inlined *) + + +(* object ex4 not inlined *) + + +(* object ex_2 not inlined *) + + +(* object ex2_2 not inlined *) + + +(* object ex3_2 not inlined *) + + +(* object ex4_2 not inlined *) + + +(* object ex_3 not inlined *) + + +(* object ex2_3 not inlined *) + + +(* object ex3_3 not inlined *) + + +(* object ex4_3 not inlined *) + + +(* object ex3_4 not inlined *) + + +(* object ex4_4 not inlined *) + + +(* object ex4_5 not inlined *) + + +(* object ex5_5 not inlined *) + + +(* object ex6_6 not inlined *) + + +(* object ex6_7 not inlined *) + diff --git a/matita/contribs/LAMBDA-TYPES/Base-2/types/props.mma b/matita/contribs/LAMBDA-TYPES/Base-2/types/props.mma new file mode 100644 index 000000000..d79bfc46b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Base-2/types/props.mma @@ -0,0 +1,22 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/types/props". + +include "types/defs.ma". + +inline procedural "cic:/matita/LAMBDA-TYPES/Base-1/types/props/ex2_sym.con". + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/A/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/A/defs.ma new file mode 100644 index 000000000..1c592efd2 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/A/defs.ma @@ -0,0 +1,24 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/A/defs". + +include "preamble.ma". + +inductive A: Set \def +| ASort: nat \to (nat \to A) +| AHead: A \to (A \to A). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/defs.ma new file mode 100644 index 000000000..0022395ce --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/defs.ma @@ -0,0 +1,47 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/C/defs". + +include "T/defs.ma". + +inductive C: Set \def +| CSort: nat \to C +| CHead: C \to (K \to (T \to C)). + +definition cweight: + C \to nat +\def + let rec cweight (c: C) on c: nat \def (match c with [(CSort _) \Rightarrow O +| (CHead c0 _ t) \Rightarrow (plus (cweight c0) (tweight t))]) in cweight. + +definition clt: + C \to (C \to Prop) +\def + \lambda (c1: C).(\lambda (c2: C).(lt (cweight c1) (cweight c2))). + +definition cle: + C \to (C \to Prop) +\def + \lambda (c1: C).(\lambda (c2: C).(le (cweight c1) (cweight c2))). + +definition CTail: + K \to (T \to (C \to C)) +\def + let rec CTail (k: K) (t: T) (c: C) on c: C \def (match c with [(CSort n) +\Rightarrow (CHead (CSort n) k t) | (CHead d h u) \Rightarrow (CHead (CTail k +t d) h u)]) in CTail. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/props.ma new file mode 100644 index 000000000..30901423e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/props.ma @@ -0,0 +1,120 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/C/props". + +include "C/defs.ma". + +include "T/props.ma". + +theorem clt_cong: + \forall (c: C).(\forall (d: C).((clt c d) \to (\forall (k: K).(\forall (t: +T).(clt (CHead c k t) (CHead d k t)))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (H: (lt (cweight c) (cweight +d))).(\lambda (_: K).(\lambda (t: T).(plus_lt_compat_r (cweight c) (cweight +d) (tweight t) H))))). + +theorem clt_head: + \forall (k: K).(\forall (c: C).(\forall (u: T).(clt c (CHead c k u)))) +\def + \lambda (_: K).(\lambda (c: C).(\lambda (u: T).(eq_ind_r nat (plus (cweight +c) O) (\lambda (n: nat).(lt n (plus (cweight c) (tweight u)))) +(plus_le_lt_compat (cweight c) (cweight c) O (tweight u) (le_n (cweight c)) +(tweight_lt u)) (cweight c) (plus_n_O (cweight c))))). + +theorem clt_wf__q_ind: + \forall (P: ((C \to Prop))).(((\forall (n: nat).((\lambda (P0: ((C \to +Prop))).(\lambda (n0: nat).(\forall (c: C).((eq nat (cweight c) n0) \to (P0 +c))))) P n))) \to (\forall (c: C).(P c))) +\def + let Q \def (\lambda (P: ((C \to Prop))).(\lambda (n: nat).(\forall (c: +C).((eq nat (cweight c) n) \to (P c))))) in (\lambda (P: ((C \to +Prop))).(\lambda (H: ((\forall (n: nat).(\forall (c: C).((eq nat (cweight c) +n) \to (P c)))))).(\lambda (c: C).(H (cweight c) c (refl_equal nat (cweight +c)))))). + +theorem clt_wf_ind: + \forall (P: ((C \to Prop))).(((\forall (c: C).(((\forall (d: C).((clt d c) +\to (P d)))) \to (P c)))) \to (\forall (c: C).(P c))) +\def + let Q \def (\lambda (P: ((C \to Prop))).(\lambda (n: nat).(\forall (c: +C).((eq nat (cweight c) n) \to (P c))))) in (\lambda (P: ((C \to +Prop))).(\lambda (H: ((\forall (c: C).(((\forall (d: C).((lt (cweight d) +(cweight c)) \to (P d)))) \to (P c))))).(\lambda (c: C).(clt_wf__q_ind +(\lambda (c0: C).(P c0)) (\lambda (n: nat).(lt_wf_ind n (Q (\lambda (c0: +C).(P c0))) (\lambda (n0: nat).(\lambda (H0: ((\forall (m: nat).((lt m n0) +\to (Q (\lambda (c0: C).(P c0)) m))))).(\lambda (c0: C).(\lambda (H1: (eq nat +(cweight c0) n0)).(let H2 \def (eq_ind_r nat n0 (\lambda (n1: nat).(\forall +(m: nat).((lt m n1) \to (\forall (c1: C).((eq nat (cweight c1) m) \to (P +c1)))))) H0 (cweight c0) H1) in (H c0 (\lambda (d: C).(\lambda (H3: (lt +(cweight d) (cweight c0))).(H2 (cweight d) H3 d (refl_equal nat (cweight +d))))))))))))) c)))). + +theorem chead_ctail: + \forall (c: C).(\forall (t: T).(\forall (k: K).(ex_3 K C T (\lambda (h: +K).(\lambda (d: C).(\lambda (u: T).(eq C (CHead c k t) (CTail h u d)))))))) +\def + \lambda (c: C).(C_ind (\lambda (c0: C).(\forall (t: T).(\forall (k: K).(ex_3 +K C T (\lambda (h: K).(\lambda (d: C).(\lambda (u: T).(eq C (CHead c0 k t) +(CTail h u d))))))))) (\lambda (n: nat).(\lambda (t: T).(\lambda (k: +K).(ex_3_intro K C T (\lambda (h: K).(\lambda (d: C).(\lambda (u: T).(eq C +(CHead (CSort n) k t) (CTail h u d))))) k (CSort n) t (refl_equal C (CHead +(CSort n) k t)))))) (\lambda (c0: C).(\lambda (H: ((\forall (t: T).(\forall +(k: K).(ex_3 K C T (\lambda (h: K).(\lambda (d: C).(\lambda (u: T).(eq C +(CHead c0 k t) (CTail h u d)))))))))).(\lambda (k: K).(\lambda (t: +T).(\lambda (t0: T).(\lambda (k0: K).(let H_x \def (H t k) in (let H0 \def +H_x in (ex_3_ind K C T (\lambda (h: K).(\lambda (d: C).(\lambda (u: T).(eq C +(CHead c0 k t) (CTail h u d))))) (ex_3 K C T (\lambda (h: K).(\lambda (d: +C).(\lambda (u: T).(eq C (CHead (CHead c0 k t) k0 t0) (CTail h u d)))))) +(\lambda (x0: K).(\lambda (x1: C).(\lambda (x2: T).(\lambda (H1: (eq C (CHead +c0 k t) (CTail x0 x2 x1))).(eq_ind_r C (CTail x0 x2 x1) (\lambda (c1: +C).(ex_3 K C T (\lambda (h: K).(\lambda (d: C).(\lambda (u: T).(eq C (CHead +c1 k0 t0) (CTail h u d))))))) (ex_3_intro K C T (\lambda (h: K).(\lambda (d: +C).(\lambda (u: T).(eq C (CHead (CTail x0 x2 x1) k0 t0) (CTail h u d))))) x0 +(CHead x1 k0 t0) x2 (refl_equal C (CHead (CTail x0 x2 x1) k0 t0))) (CHead c0 +k t) H1))))) H0))))))))) c). + +theorem clt_thead: + \forall (k: K).(\forall (u: T).(\forall (c: C).(clt c (CTail k u c)))) +\def + \lambda (k: K).(\lambda (u: T).(\lambda (c: C).(C_ind (\lambda (c0: C).(clt +c0 (CTail k u c0))) (\lambda (n: nat).(clt_head k (CSort n) u)) (\lambda (c0: +C).(\lambda (H: (clt c0 (CTail k u c0))).(\lambda (k0: K).(\lambda (t: +T).(clt_cong c0 (CTail k u c0) H k0 t))))) c))). + +theorem c_tail_ind: + \forall (P: ((C \to Prop))).(((\forall (n: nat).(P (CSort n)))) \to +(((\forall (c: C).((P c) \to (\forall (k: K).(\forall (t: T).(P (CTail k t +c))))))) \to (\forall (c: C).(P c)))) +\def + \lambda (P: ((C \to Prop))).(\lambda (H: ((\forall (n: nat).(P (CSort +n))))).(\lambda (H0: ((\forall (c: C).((P c) \to (\forall (k: K).(\forall (t: +T).(P (CTail k t c)))))))).(\lambda (c: C).(clt_wf_ind (\lambda (c0: C).(P +c0)) (\lambda (c0: C).(C_ind (\lambda (c1: C).(((\forall (d: C).((clt d c1) +\to (P d)))) \to (P c1))) (\lambda (n: nat).(\lambda (_: ((\forall (d: +C).((clt d (CSort n)) \to (P d))))).(H n))) (\lambda (c1: C).(\lambda (_: +((((\forall (d: C).((clt d c1) \to (P d)))) \to (P c1)))).(\lambda (k: +K).(\lambda (t: T).(\lambda (H2: ((\forall (d: C).((clt d (CHead c1 k t)) \to +(P d))))).(let H_x \def (chead_ctail c1 t k) in (let H3 \def H_x in (ex_3_ind +K C T (\lambda (h: K).(\lambda (d: C).(\lambda (u: T).(eq C (CHead c1 k t) +(CTail h u d))))) (P (CHead c1 k t)) (\lambda (x0: K).(\lambda (x1: +C).(\lambda (x2: T).(\lambda (H4: (eq C (CHead c1 k t) (CTail x0 x2 +x1))).(eq_ind_r C (CTail x0 x2 x1) (\lambda (c2: C).(P c2)) (let H5 \def +(eq_ind C (CHead c1 k t) (\lambda (c2: C).(\forall (d: C).((clt d c2) \to (P +d)))) H2 (CTail x0 x2 x1) H4) in (H0 x1 (H5 x1 (clt_thead x0 x2 x1)) x0 x2)) +(CHead c1 k t) H4))))) H3)))))))) c0)) c)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/G/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/G/defs.ma new file mode 100644 index 000000000..d66873d06 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/G/defs.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/G/defs". + +include "preamble.ma". + +record G : Set \def { + next: (nat \to nat); + next_lt: (\forall (n: nat).(lt n (next n))) +}. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/dec.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/dec.ma new file mode 100644 index 000000000..0d05ba97f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/dec.ma @@ -0,0 +1,427 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/dec". + +include "T/defs.ma". + +theorem terms_props__bind_dec: + \forall (b1: B).(\forall (b2: B).(or (eq B b1 b2) ((eq B b1 b2) \to (\forall +(P: Prop).P)))) +\def + \lambda (b1: B).(B_ind (\lambda (b: B).(\forall (b2: B).(or (eq B b b2) ((eq +B b b2) \to (\forall (P: Prop).P))))) (\lambda (b2: B).(B_ind (\lambda (b: +B).(or (eq B Abbr b) ((eq B Abbr b) \to (\forall (P: Prop).P)))) (or_introl +(eq B Abbr Abbr) ((eq B Abbr Abbr) \to (\forall (P: Prop).P)) (refl_equal B +Abbr)) (or_intror (eq B Abbr Abst) ((eq B Abbr Abst) \to (\forall (P: +Prop).P)) (\lambda (H: (eq B Abbr Abst)).(\lambda (P: Prop).(let H0 \def +(eq_ind B Abbr (\lambda (ee: B).(match ee in B return (\lambda (_: B).Prop) +with [Abbr \Rightarrow True | Abst \Rightarrow False | Void \Rightarrow +False])) I Abst H) in (False_ind P H0))))) (or_intror (eq B Abbr Void) ((eq B +Abbr Void) \to (\forall (P: Prop).P)) (\lambda (H: (eq B Abbr Void)).(\lambda +(P: Prop).(let H0 \def (eq_ind B Abbr (\lambda (ee: B).(match ee in B return +(\lambda (_: B).Prop) with [Abbr \Rightarrow True | Abst \Rightarrow False | +Void \Rightarrow False])) I Void H) in (False_ind P H0))))) b2)) (\lambda +(b2: B).(B_ind (\lambda (b: B).(or (eq B Abst b) ((eq B Abst b) \to (\forall +(P: Prop).P)))) (or_intror (eq B Abst Abbr) ((eq B Abst Abbr) \to (\forall +(P: Prop).P)) (\lambda (H: (eq B Abst Abbr)).(\lambda (P: Prop).(let H0 \def +(eq_ind B Abst (\lambda (ee: B).(match ee in B return (\lambda (_: B).Prop) +with [Abbr \Rightarrow False | Abst \Rightarrow True | Void \Rightarrow +False])) I Abbr H) in (False_ind P H0))))) (or_introl (eq B Abst Abst) ((eq B +Abst Abst) \to (\forall (P: Prop).P)) (refl_equal B Abst)) (or_intror (eq B +Abst Void) ((eq B Abst Void) \to (\forall (P: Prop).P)) (\lambda (H: (eq B +Abst Void)).(\lambda (P: Prop).(let H0 \def (eq_ind B Abst (\lambda (ee: +B).(match ee in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow False | +Abst \Rightarrow True | Void \Rightarrow False])) I Void H) in (False_ind P +H0))))) b2)) (\lambda (b2: B).(B_ind (\lambda (b: B).(or (eq B Void b) ((eq B +Void b) \to (\forall (P: Prop).P)))) (or_intror (eq B Void Abbr) ((eq B Void +Abbr) \to (\forall (P: Prop).P)) (\lambda (H: (eq B Void Abbr)).(\lambda (P: +Prop).(let H0 \def (eq_ind B Void (\lambda (ee: B).(match ee in B return +(\lambda (_: B).Prop) with [Abbr \Rightarrow False | Abst \Rightarrow False | +Void \Rightarrow True])) I Abbr H) in (False_ind P H0))))) (or_intror (eq B +Void Abst) ((eq B Void Abst) \to (\forall (P: Prop).P)) (\lambda (H: (eq B +Void Abst)).(\lambda (P: Prop).(let H0 \def (eq_ind B Void (\lambda (ee: +B).(match ee in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow False | +Abst \Rightarrow False | Void \Rightarrow True])) I Abst H) in (False_ind P +H0))))) (or_introl (eq B Void Void) ((eq B Void Void) \to (\forall (P: +Prop).P)) (refl_equal B Void)) b2)) b1). + +theorem bind_dec_not: + \forall (b1: B).(\forall (b2: B).(or (eq B b1 b2) (not (eq B b1 b2)))) +\def + \lambda (b1: B).(\lambda (b2: B).(let H_x \def (terms_props__bind_dec b1 b2) +in (let H \def H_x in (or_ind (eq B b1 b2) ((eq B b1 b2) \to (\forall (P: +Prop).P)) (or (eq B b1 b2) ((eq B b1 b2) \to False)) (\lambda (H0: (eq B b1 +b2)).(or_introl (eq B b1 b2) ((eq B b1 b2) \to False) H0)) (\lambda (H0: +(((eq B b1 b2) \to (\forall (P: Prop).P)))).(or_intror (eq B b1 b2) ((eq B b1 +b2) \to False) (\lambda (H1: (eq B b1 b2)).(H0 H1 False)))) H)))). + +theorem terms_props__flat_dec: + \forall (f1: F).(\forall (f2: F).(or (eq F f1 f2) ((eq F f1 f2) \to (\forall +(P: Prop).P)))) +\def + \lambda (f1: F).(F_ind (\lambda (f: F).(\forall (f2: F).(or (eq F f f2) ((eq +F f f2) \to (\forall (P: Prop).P))))) (\lambda (f2: F).(F_ind (\lambda (f: +F).(or (eq F Appl f) ((eq F Appl f) \to (\forall (P: Prop).P)))) (or_introl +(eq F Appl Appl) ((eq F Appl Appl) \to (\forall (P: Prop).P)) (refl_equal F +Appl)) (or_intror (eq F Appl Cast) ((eq F Appl Cast) \to (\forall (P: +Prop).P)) (\lambda (H: (eq F Appl Cast)).(\lambda (P: Prop).(let H0 \def +(eq_ind F Appl (\lambda (ee: F).(match ee in F return (\lambda (_: F).Prop) +with [Appl \Rightarrow True | Cast \Rightarrow False])) I Cast H) in +(False_ind P H0))))) f2)) (\lambda (f2: F).(F_ind (\lambda (f: F).(or (eq F +Cast f) ((eq F Cast f) \to (\forall (P: Prop).P)))) (or_intror (eq F Cast +Appl) ((eq F Cast Appl) \to (\forall (P: Prop).P)) (\lambda (H: (eq F Cast +Appl)).(\lambda (P: Prop).(let H0 \def (eq_ind F Cast (\lambda (ee: F).(match +ee in F return (\lambda (_: F).Prop) with [Appl \Rightarrow False | Cast +\Rightarrow True])) I Appl H) in (False_ind P H0))))) (or_introl (eq F Cast +Cast) ((eq F Cast Cast) \to (\forall (P: Prop).P)) (refl_equal F Cast)) f2)) +f1). + +theorem terms_props__kind_dec: + \forall (k1: K).(\forall (k2: K).(or (eq K k1 k2) ((eq K k1 k2) \to (\forall +(P: Prop).P)))) +\def + \lambda (k1: K).(K_ind (\lambda (k: K).(\forall (k2: K).(or (eq K k k2) ((eq +K k k2) \to (\forall (P: Prop).P))))) (\lambda (b: B).(\lambda (k2: K).(K_ind +(\lambda (k: K).(or (eq K (Bind b) k) ((eq K (Bind b) k) \to (\forall (P: +Prop).P)))) (\lambda (b0: B).(let H_x \def (terms_props__bind_dec b b0) in +(let H \def H_x in (or_ind (eq B b b0) ((eq B b b0) \to (\forall (P: +Prop).P)) (or (eq K (Bind b) (Bind b0)) ((eq K (Bind b) (Bind b0)) \to +(\forall (P: Prop).P))) (\lambda (H0: (eq B b b0)).(eq_ind B b (\lambda (b1: +B).(or (eq K (Bind b) (Bind b1)) ((eq K (Bind b) (Bind b1)) \to (\forall (P: +Prop).P)))) (or_introl (eq K (Bind b) (Bind b)) ((eq K (Bind b) (Bind b)) \to +(\forall (P: Prop).P)) (refl_equal K (Bind b))) b0 H0)) (\lambda (H0: (((eq B +b b0) \to (\forall (P: Prop).P)))).(or_intror (eq K (Bind b) (Bind b0)) ((eq +K (Bind b) (Bind b0)) \to (\forall (P: Prop).P)) (\lambda (H1: (eq K (Bind b) +(Bind b0))).(\lambda (P: Prop).(let H2 \def (f_equal K B (\lambda (e: +K).(match e in K return (\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | +(Flat _) \Rightarrow b])) (Bind b) (Bind b0) H1) in (let H3 \def (eq_ind_r B +b0 (\lambda (b1: B).((eq B b b1) \to (\forall (P0: Prop).P0))) H0 b H2) in +(H3 (refl_equal B b) P))))))) H)))) (\lambda (f: F).(or_intror (eq K (Bind b) +(Flat f)) ((eq K (Bind b) (Flat f)) \to (\forall (P: Prop).P)) (\lambda (H: +(eq K (Bind b) (Flat f))).(\lambda (P: Prop).(let H0 \def (eq_ind K (Bind b) +(\lambda (ee: K).(match ee in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])) I (Flat f) H) in (False_ind +P H0)))))) k2))) (\lambda (f: F).(\lambda (k2: K).(K_ind (\lambda (k: K).(or +(eq K (Flat f) k) ((eq K (Flat f) k) \to (\forall (P: Prop).P)))) (\lambda +(b: B).(or_intror (eq K (Flat f) (Bind b)) ((eq K (Flat f) (Bind b)) \to +(\forall (P: Prop).P)) (\lambda (H: (eq K (Flat f) (Bind b))).(\lambda (P: +Prop).(let H0 \def (eq_ind K (Flat f) (\lambda (ee: K).(match ee in K return +(\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])) I (Bind b) H) in (False_ind P H0)))))) (\lambda (f0: F).(let H_x \def +(terms_props__flat_dec f f0) in (let H \def H_x in (or_ind (eq F f f0) ((eq F +f f0) \to (\forall (P: Prop).P)) (or (eq K (Flat f) (Flat f0)) ((eq K (Flat +f) (Flat f0)) \to (\forall (P: Prop).P))) (\lambda (H0: (eq F f f0)).(eq_ind +F f (\lambda (f1: F).(or (eq K (Flat f) (Flat f1)) ((eq K (Flat f) (Flat f1)) +\to (\forall (P: Prop).P)))) (or_introl (eq K (Flat f) (Flat f)) ((eq K (Flat +f) (Flat f)) \to (\forall (P: Prop).P)) (refl_equal K (Flat f))) f0 H0)) +(\lambda (H0: (((eq F f f0) \to (\forall (P: Prop).P)))).(or_intror (eq K +(Flat f) (Flat f0)) ((eq K (Flat f) (Flat f0)) \to (\forall (P: Prop).P)) +(\lambda (H1: (eq K (Flat f) (Flat f0))).(\lambda (P: Prop).(let H2 \def +(f_equal K F (\lambda (e: K).(match e in K return (\lambda (_: K).F) with +[(Bind _) \Rightarrow f | (Flat f1) \Rightarrow f1])) (Flat f) (Flat f0) H1) +in (let H3 \def (eq_ind_r F f0 (\lambda (f1: F).((eq F f f1) \to (\forall +(P0: Prop).P0))) H0 f H2) in (H3 (refl_equal F f) P))))))) H)))) k2))) k1). + +theorem term_dec: + \forall (t1: T).(\forall (t2: T).(or (eq T t1 t2) ((eq T t1 t2) \to (\forall +(P: Prop).P)))) +\def + \lambda (t1: T).(T_ind (\lambda (t: T).(\forall (t2: T).(or (eq T t t2) ((eq +T t t2) \to (\forall (P: Prop).P))))) (\lambda (n: nat).(\lambda (t2: +T).(T_ind (\lambda (t: T).(or (eq T (TSort n) t) ((eq T (TSort n) t) \to +(\forall (P: Prop).P)))) (\lambda (n0: nat).(let H_x \def (nat_dec n n0) in +(let H \def H_x in (or_ind (eq nat n n0) ((eq nat n n0) \to (\forall (P: +Prop).P)) (or (eq T (TSort n) (TSort n0)) ((eq T (TSort n) (TSort n0)) \to +(\forall (P: Prop).P))) (\lambda (H0: (eq nat n n0)).(eq_ind nat n (\lambda +(n1: nat).(or (eq T (TSort n) (TSort n1)) ((eq T (TSort n) (TSort n1)) \to +(\forall (P: Prop).P)))) (or_introl (eq T (TSort n) (TSort n)) ((eq T (TSort +n) (TSort n)) \to (\forall (P: Prop).P)) (refl_equal T (TSort n))) n0 H0)) +(\lambda (H0: (((eq nat n n0) \to (\forall (P: Prop).P)))).(or_intror (eq T +(TSort n) (TSort n0)) ((eq T (TSort n) (TSort n0)) \to (\forall (P: Prop).P)) +(\lambda (H1: (eq T (TSort n) (TSort n0))).(\lambda (P: Prop).(let H2 \def +(f_equal T nat (\lambda (e: T).(match e in T return (\lambda (_: T).nat) with +[(TSort n1) \Rightarrow n1 | (TLRef _) \Rightarrow n | (THead _ _ _) +\Rightarrow n])) (TSort n) (TSort n0) H1) in (let H3 \def (eq_ind_r nat n0 +(\lambda (n1: nat).((eq nat n n1) \to (\forall (P0: Prop).P0))) H0 n H2) in +(H3 (refl_equal nat n) P))))))) H)))) (\lambda (n0: nat).(or_intror (eq T +(TSort n) (TLRef n0)) ((eq T (TSort n) (TLRef n0)) \to (\forall (P: Prop).P)) +(\lambda (H: (eq T (TSort n) (TLRef n0))).(\lambda (P: Prop).(let H0 \def +(eq_ind T (TSort n) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow False])) I (TLRef n0) H) in (False_ind P H0)))))) +(\lambda (k: K).(\lambda (t: T).(\lambda (_: (or (eq T (TSort n) t) ((eq T +(TSort n) t) \to (\forall (P: Prop).P)))).(\lambda (t0: T).(\lambda (_: (or +(eq T (TSort n) t0) ((eq T (TSort n) t0) \to (\forall (P: +Prop).P)))).(or_intror (eq T (TSort n) (THead k t t0)) ((eq T (TSort n) +(THead k t t0)) \to (\forall (P: Prop).P)) (\lambda (H1: (eq T (TSort n) +(THead k t t0))).(\lambda (P: Prop).(let H2 \def (eq_ind T (TSort n) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +False])) I (THead k t t0) H1) in (False_ind P H2)))))))))) t2))) (\lambda (n: +nat).(\lambda (t2: T).(T_ind (\lambda (t: T).(or (eq T (TLRef n) t) ((eq T +(TLRef n) t) \to (\forall (P: Prop).P)))) (\lambda (n0: nat).(or_intror (eq T +(TLRef n) (TSort n0)) ((eq T (TLRef n) (TSort n0)) \to (\forall (P: Prop).P)) +(\lambda (H: (eq T (TLRef n) (TSort n0))).(\lambda (P: Prop).(let H0 \def +(eq_ind T (TLRef n) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (TSort n0) H) in (False_ind P H0)))))) +(\lambda (n0: nat).(let H_x \def (nat_dec n n0) in (let H \def H_x in (or_ind +(eq nat n n0) ((eq nat n n0) \to (\forall (P: Prop).P)) (or (eq T (TLRef n) +(TLRef n0)) ((eq T (TLRef n) (TLRef n0)) \to (\forall (P: Prop).P))) (\lambda +(H0: (eq nat n n0)).(eq_ind nat n (\lambda (n1: nat).(or (eq T (TLRef n) +(TLRef n1)) ((eq T (TLRef n) (TLRef n1)) \to (\forall (P: Prop).P)))) +(or_introl (eq T (TLRef n) (TLRef n)) ((eq T (TLRef n) (TLRef n)) \to +(\forall (P: Prop).P)) (refl_equal T (TLRef n))) n0 H0)) (\lambda (H0: (((eq +nat n n0) \to (\forall (P: Prop).P)))).(or_intror (eq T (TLRef n) (TLRef n0)) +((eq T (TLRef n) (TLRef n0)) \to (\forall (P: Prop).P)) (\lambda (H1: (eq T +(TLRef n) (TLRef n0))).(\lambda (P: Prop).(let H2 \def (f_equal T nat +(\lambda (e: T).(match e in T return (\lambda (_: T).nat) with [(TSort _) +\Rightarrow n | (TLRef n1) \Rightarrow n1 | (THead _ _ _) \Rightarrow n])) +(TLRef n) (TLRef n0) H1) in (let H3 \def (eq_ind_r nat n0 (\lambda (n1: +nat).((eq nat n n1) \to (\forall (P0: Prop).P0))) H0 n H2) in (H3 (refl_equal +nat n) P))))))) H)))) (\lambda (k: K).(\lambda (t: T).(\lambda (_: (or (eq T +(TLRef n) t) ((eq T (TLRef n) t) \to (\forall (P: Prop).P)))).(\lambda (t0: +T).(\lambda (_: (or (eq T (TLRef n) t0) ((eq T (TLRef n) t0) \to (\forall (P: +Prop).P)))).(or_intror (eq T (TLRef n) (THead k t t0)) ((eq T (TLRef n) +(THead k t t0)) \to (\forall (P: Prop).P)) (\lambda (H1: (eq T (TLRef n) +(THead k t t0))).(\lambda (P: Prop).(let H2 \def (eq_ind T (TLRef n) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow +False])) I (THead k t t0) H1) in (False_ind P H2)))))))))) t2))) (\lambda (k: +K).(\lambda (t: T).(\lambda (H: ((\forall (t2: T).(or (eq T t t2) ((eq T t +t2) \to (\forall (P: Prop).P)))))).(\lambda (t0: T).(\lambda (H0: ((\forall +(t2: T).(or (eq T t0 t2) ((eq T t0 t2) \to (\forall (P: +Prop).P)))))).(\lambda (t2: T).(T_ind (\lambda (t3: T).(or (eq T (THead k t +t0) t3) ((eq T (THead k t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (n: +nat).(or_intror (eq T (THead k t t0) (TSort n)) ((eq T (THead k t t0) (TSort +n)) \to (\forall (P: Prop).P)) (\lambda (H1: (eq T (THead k t t0) (TSort +n))).(\lambda (P: Prop).(let H2 \def (eq_ind T (THead k t t0) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I +(TSort n) H1) in (False_ind P H2)))))) (\lambda (n: nat).(or_intror (eq T +(THead k t t0) (TLRef n)) ((eq T (THead k t t0) (TLRef n)) \to (\forall (P: +Prop).P)) (\lambda (H1: (eq T (THead k t t0) (TLRef n))).(\lambda (P: +Prop).(let H2 \def (eq_ind T (THead k t t0) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n) H1) in +(False_ind P H2)))))) (\lambda (k0: K).(\lambda (t3: T).(\lambda (H1: (or (eq +T (THead k t t0) t3) ((eq T (THead k t t0) t3) \to (\forall (P: +Prop).P)))).(\lambda (t4: T).(\lambda (H2: (or (eq T (THead k t t0) t4) ((eq +T (THead k t t0) t4) \to (\forall (P: Prop).P)))).(let H_x \def (H t3) in +(let H3 \def H_x in (or_ind (eq T t t3) ((eq T t t3) \to (\forall (P: +Prop).P)) (or (eq T (THead k t t0) (THead k0 t3 t4)) ((eq T (THead k t t0) +(THead k0 t3 t4)) \to (\forall (P: Prop).P))) (\lambda (H4: (eq T t t3)).(let +H5 \def (eq_ind_r T t3 (\lambda (t5: T).(or (eq T (THead k t t0) t5) ((eq T +(THead k t t0) t5) \to (\forall (P: Prop).P)))) H1 t H4) in (eq_ind T t +(\lambda (t5: T).(or (eq T (THead k t t0) (THead k0 t5 t4)) ((eq T (THead k t +t0) (THead k0 t5 t4)) \to (\forall (P: Prop).P)))) (let H_x0 \def (H0 t4) in +(let H6 \def H_x0 in (or_ind (eq T t0 t4) ((eq T t0 t4) \to (\forall (P: +Prop).P)) (or (eq T (THead k t t0) (THead k0 t t4)) ((eq T (THead k t t0) +(THead k0 t t4)) \to (\forall (P: Prop).P))) (\lambda (H7: (eq T t0 t4)).(let +H8 \def (eq_ind_r T t4 (\lambda (t5: T).(or (eq T (THead k t t0) t5) ((eq T +(THead k t t0) t5) \to (\forall (P: Prop).P)))) H2 t0 H7) in (eq_ind T t0 +(\lambda (t5: T).(or (eq T (THead k t t0) (THead k0 t t5)) ((eq T (THead k t +t0) (THead k0 t t5)) \to (\forall (P: Prop).P)))) (let H_x1 \def +(terms_props__kind_dec k k0) in (let H9 \def H_x1 in (or_ind (eq K k k0) ((eq +K k k0) \to (\forall (P: Prop).P)) (or (eq T (THead k t t0) (THead k0 t t0)) +((eq T (THead k t t0) (THead k0 t t0)) \to (\forall (P: Prop).P))) (\lambda +(H10: (eq K k k0)).(eq_ind K k (\lambda (k1: K).(or (eq T (THead k t t0) +(THead k1 t t0)) ((eq T (THead k t t0) (THead k1 t t0)) \to (\forall (P: +Prop).P)))) (or_introl (eq T (THead k t t0) (THead k t t0)) ((eq T (THead k t +t0) (THead k t t0)) \to (\forall (P: Prop).P)) (refl_equal T (THead k t t0))) +k0 H10)) (\lambda (H10: (((eq K k k0) \to (\forall (P: Prop).P)))).(or_intror +(eq T (THead k t t0) (THead k0 t t0)) ((eq T (THead k t t0) (THead k0 t t0)) +\to (\forall (P: Prop).P)) (\lambda (H11: (eq T (THead k t t0) (THead k0 t +t0))).(\lambda (P: Prop).(let H12 \def (f_equal T K (\lambda (e: T).(match e +in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k1 _ _) \Rightarrow k1])) (THead k t t0) (THead k0 t +t0) H11) in (let H13 \def (eq_ind_r K k0 (\lambda (k1: K).((eq K k k1) \to +(\forall (P0: Prop).P0))) H10 k H12) in (H13 (refl_equal K k) P))))))) H9))) +t4 H7))) (\lambda (H7: (((eq T t0 t4) \to (\forall (P: Prop).P)))).(or_intror +(eq T (THead k t t0) (THead k0 t t4)) ((eq T (THead k t t0) (THead k0 t t4)) +\to (\forall (P: Prop).P)) (\lambda (H8: (eq T (THead k t t0) (THead k0 t +t4))).(\lambda (P: Prop).(let H9 \def (f_equal T K (\lambda (e: T).(match e +in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k1 _ _) \Rightarrow k1])) (THead k t t0) (THead k0 t +t4) H8) in ((let H10 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 +| (THead _ _ t5) \Rightarrow t5])) (THead k t t0) (THead k0 t t4) H8) in +(\lambda (_: (eq K k k0)).(let H12 \def (eq_ind_r T t4 (\lambda (t5: T).((eq +T t0 t5) \to (\forall (P0: Prop).P0))) H7 t0 H10) in (let H13 \def (eq_ind_r +T t4 (\lambda (t5: T).(or (eq T (THead k t t0) t5) ((eq T (THead k t t0) t5) +\to (\forall (P0: Prop).P0)))) H2 t0 H10) in (H12 (refl_equal T t0) P))))) +H9)))))) H6))) t3 H4))) (\lambda (H4: (((eq T t t3) \to (\forall (P: +Prop).P)))).(or_intror (eq T (THead k t t0) (THead k0 t3 t4)) ((eq T (THead k +t t0) (THead k0 t3 t4)) \to (\forall (P: Prop).P)) (\lambda (H5: (eq T (THead +k t t0) (THead k0 t3 t4))).(\lambda (P: Prop).(let H6 \def (f_equal T K +(\lambda (e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) +\Rightarrow k | (TLRef _) \Rightarrow k | (THead k1 _ _) \Rightarrow k1])) +(THead k t t0) (THead k0 t3 t4) H5) in ((let H7 \def (f_equal T T (\lambda +(e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t +| (TLRef _) \Rightarrow t | (THead _ t5 _) \Rightarrow t5])) (THead k t t0) +(THead k0 t3 t4) H5) in ((let H8 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) +\Rightarrow t0 | (THead _ _ t5) \Rightarrow t5])) (THead k t t0) (THead k0 t3 +t4) H5) in (\lambda (H9: (eq T t t3)).(\lambda (_: (eq K k k0)).(let H11 \def +(eq_ind_r T t4 (\lambda (t5: T).(or (eq T (THead k t t0) t5) ((eq T (THead k +t t0) t5) \to (\forall (P0: Prop).P0)))) H2 t0 H8) in (let H12 \def (eq_ind_r +T t3 (\lambda (t5: T).((eq T t t5) \to (\forall (P0: Prop).P0))) H4 t H9) in +(let H13 \def (eq_ind_r T t3 (\lambda (t5: T).(or (eq T (THead k t t0) t5) +((eq T (THead k t t0) t5) \to (\forall (P0: Prop).P0)))) H1 t H9) in (H12 +(refl_equal T t) P))))))) H7)) H6)))))) H3)))))))) t2))))))) t1). + +theorem binder_dec: + \forall (t: T).(or (ex_3 B T T (\lambda (b: B).(\lambda (w: T).(\lambda (u: +T).(eq T t (THead (Bind b) w u)))))) (\forall (b: B).(\forall (w: T).(\forall +(u: T).((eq T t (THead (Bind b) w u)) \to (\forall (P: Prop).P)))))) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(or (ex_3 B T T (\lambda (b: +B).(\lambda (w: T).(\lambda (u: T).(eq T t0 (THead (Bind b) w u)))))) +(\forall (b: B).(\forall (w: T).(\forall (u: T).((eq T t0 (THead (Bind b) w +u)) \to (\forall (P: Prop).P))))))) (\lambda (n: nat).(or_intror (ex_3 B T T +(\lambda (b: B).(\lambda (w: T).(\lambda (u: T).(eq T (TSort n) (THead (Bind +b) w u)))))) (\forall (b: B).(\forall (w: T).(\forall (u: T).((eq T (TSort n) +(THead (Bind b) w u)) \to (\forall (P: Prop).P))))) (\lambda (b: B).(\lambda +(w: T).(\lambda (u: T).(\lambda (H: (eq T (TSort n) (THead (Bind b) w +u))).(\lambda (P: Prop).(let H0 \def (eq_ind T (TSort n) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow False])) I +(THead (Bind b) w u) H) in (False_ind P H0))))))))) (\lambda (n: +nat).(or_intror (ex_3 B T T (\lambda (b: B).(\lambda (w: T).(\lambda (u: +T).(eq T (TLRef n) (THead (Bind b) w u)))))) (\forall (b: B).(\forall (w: +T).(\forall (u: T).((eq T (TLRef n) (THead (Bind b) w u)) \to (\forall (P: +Prop).P))))) (\lambda (b: B).(\lambda (w: T).(\lambda (u: T).(\lambda (H: (eq +T (TLRef n) (THead (Bind b) w u))).(\lambda (P: Prop).(let H0 \def (eq_ind T +(TLRef n) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) +\Rightarrow False])) I (THead (Bind b) w u) H) in (False_ind P H0))))))))) +(\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (t0: T).((or (ex_3 B T T +(\lambda (b: B).(\lambda (w: T).(\lambda (u: T).(eq T t0 (THead (Bind b) w +u)))))) (\forall (b: B).(\forall (w: T).(\forall (u: T).((eq T t0 (THead +(Bind b) w u)) \to (\forall (P: Prop).P)))))) \to (\forall (t1: T).((or (ex_3 +B T T (\lambda (b: B).(\lambda (w: T).(\lambda (u: T).(eq T t1 (THead (Bind +b) w u)))))) (\forall (b: B).(\forall (w: T).(\forall (u: T).((eq T t1 (THead +(Bind b) w u)) \to (\forall (P: Prop).P)))))) \to (or (ex_3 B T T (\lambda +(b: B).(\lambda (w: T).(\lambda (u: T).(eq T (THead k0 t0 t1) (THead (Bind b) +w u)))))) (\forall (b: B).(\forall (w: T).(\forall (u: T).((eq T (THead k0 t0 +t1) (THead (Bind b) w u)) \to (\forall (P: Prop).P))))))))))) (\lambda (b: +B).(\lambda (t0: T).(\lambda (_: (or (ex_3 B T T (\lambda (b0: B).(\lambda +(w: T).(\lambda (u: T).(eq T t0 (THead (Bind b0) w u)))))) (\forall (b0: +B).(\forall (w: T).(\forall (u: T).((eq T t0 (THead (Bind b0) w u)) \to +(\forall (P: Prop).P))))))).(\lambda (t1: T).(\lambda (_: (or (ex_3 B T T +(\lambda (b0: B).(\lambda (w: T).(\lambda (u: T).(eq T t1 (THead (Bind b0) w +u)))))) (\forall (b0: B).(\forall (w: T).(\forall (u: T).((eq T t1 (THead +(Bind b0) w u)) \to (\forall (P: Prop).P))))))).(or_introl (ex_3 B T T +(\lambda (b0: B).(\lambda (w: T).(\lambda (u: T).(eq T (THead (Bind b) t0 t1) +(THead (Bind b0) w u)))))) (\forall (b0: B).(\forall (w: T).(\forall (u: +T).((eq T (THead (Bind b) t0 t1) (THead (Bind b0) w u)) \to (\forall (P: +Prop).P))))) (ex_3_intro B T T (\lambda (b0: B).(\lambda (w: T).(\lambda (u: +T).(eq T (THead (Bind b) t0 t1) (THead (Bind b0) w u))))) b t0 t1 (refl_equal +T (THead (Bind b) t0 t1))))))))) (\lambda (f: F).(\lambda (t0: T).(\lambda +(_: (or (ex_3 B T T (\lambda (b: B).(\lambda (w: T).(\lambda (u: T).(eq T t0 +(THead (Bind b) w u)))))) (\forall (b: B).(\forall (w: T).(\forall (u: +T).((eq T t0 (THead (Bind b) w u)) \to (\forall (P: Prop).P))))))).(\lambda +(t1: T).(\lambda (_: (or (ex_3 B T T (\lambda (b: B).(\lambda (w: T).(\lambda +(u: T).(eq T t1 (THead (Bind b) w u)))))) (\forall (b: B).(\forall (w: +T).(\forall (u: T).((eq T t1 (THead (Bind b) w u)) \to (\forall (P: +Prop).P))))))).(or_intror (ex_3 B T T (\lambda (b: B).(\lambda (w: +T).(\lambda (u: T).(eq T (THead (Flat f) t0 t1) (THead (Bind b) w u)))))) +(\forall (b: B).(\forall (w: T).(\forall (u: T).((eq T (THead (Flat f) t0 t1) +(THead (Bind b) w u)) \to (\forall (P: Prop).P))))) (\lambda (b: B).(\lambda +(w: T).(\lambda (u: T).(\lambda (H1: (eq T (THead (Flat f) t0 t1) (THead +(Bind b) w u))).(\lambda (P: Prop).(let H2 \def (eq_ind T (THead (Flat f) t0 +t1) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k0 _ _) +\Rightarrow (match k0 in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind b) w u) H1) +in (False_ind P H2))))))))))))) k)) t). + +theorem abst_dec: + \forall (u: T).(\forall (v: T).(or (ex T (\lambda (t: T).(eq T u (THead +(Bind Abst) v t)))) (\forall (t: T).((eq T u (THead (Bind Abst) v t)) \to +(\forall (P: Prop).P))))) +\def + \lambda (u: T).(T_ind (\lambda (t: T).(\forall (v: T).(or (ex T (\lambda +(t0: T).(eq T t (THead (Bind Abst) v t0)))) (\forall (t0: T).((eq T t (THead +(Bind Abst) v t0)) \to (\forall (P: Prop).P)))))) (\lambda (n: nat).(\lambda +(v: T).(or_intror (ex T (\lambda (t: T).(eq T (TSort n) (THead (Bind Abst) v +t)))) (\forall (t: T).((eq T (TSort n) (THead (Bind Abst) v t)) \to (\forall +(P: Prop).P))) (\lambda (t: T).(\lambda (H: (eq T (TSort n) (THead (Bind +Abst) v t))).(\lambda (P: Prop).(let H0 \def (eq_ind T (TSort n) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +False])) I (THead (Bind Abst) v t) H) in (False_ind P H0)))))))) (\lambda (n: +nat).(\lambda (v: T).(or_intror (ex T (\lambda (t: T).(eq T (TLRef n) (THead +(Bind Abst) v t)))) (\forall (t: T).((eq T (TLRef n) (THead (Bind Abst) v t)) +\to (\forall (P: Prop).P))) (\lambda (t: T).(\lambda (H: (eq T (TLRef n) +(THead (Bind Abst) v t))).(\lambda (P: Prop).(let H0 \def (eq_ind T (TLRef n) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow +False])) I (THead (Bind Abst) v t) H) in (False_ind P H0)))))))) (\lambda (k: +K).(\lambda (t: T).(\lambda (_: ((\forall (v: T).(or (ex T (\lambda (t0: +T).(eq T t (THead (Bind Abst) v t0)))) (\forall (t0: T).((eq T t (THead (Bind +Abst) v t0)) \to (\forall (P: Prop).P))))))).(\lambda (t0: T).(\lambda (_: +((\forall (v: T).(or (ex T (\lambda (t1: T).(eq T t0 (THead (Bind Abst) v +t1)))) (\forall (t1: T).((eq T t0 (THead (Bind Abst) v t1)) \to (\forall (P: +Prop).P))))))).(\lambda (v: T).(let H_x \def (terms_props__kind_dec k (Bind +Abst)) in (let H1 \def H_x in (or_ind (eq K k (Bind Abst)) ((eq K k (Bind +Abst)) \to (\forall (P: Prop).P)) (or (ex T (\lambda (t1: T).(eq T (THead k t +t0) (THead (Bind Abst) v t1)))) (\forall (t1: T).((eq T (THead k t t0) (THead +(Bind Abst) v t1)) \to (\forall (P: Prop).P)))) (\lambda (H2: (eq K k (Bind +Abst))).(eq_ind_r K (Bind Abst) (\lambda (k0: K).(or (ex T (\lambda (t1: +T).(eq T (THead k0 t t0) (THead (Bind Abst) v t1)))) (\forall (t1: T).((eq T +(THead k0 t t0) (THead (Bind Abst) v t1)) \to (\forall (P: Prop).P))))) (let +H_x0 \def (term_dec t v) in (let H3 \def H_x0 in (or_ind (eq T t v) ((eq T t +v) \to (\forall (P: Prop).P)) (or (ex T (\lambda (t1: T).(eq T (THead (Bind +Abst) t t0) (THead (Bind Abst) v t1)))) (\forall (t1: T).((eq T (THead (Bind +Abst) t t0) (THead (Bind Abst) v t1)) \to (\forall (P: Prop).P)))) (\lambda +(H4: (eq T t v)).(eq_ind T t (\lambda (t1: T).(or (ex T (\lambda (t2: T).(eq +T (THead (Bind Abst) t t0) (THead (Bind Abst) t1 t2)))) (\forall (t2: T).((eq +T (THead (Bind Abst) t t0) (THead (Bind Abst) t1 t2)) \to (\forall (P: +Prop).P))))) (or_introl (ex T (\lambda (t1: T).(eq T (THead (Bind Abst) t t0) +(THead (Bind Abst) t t1)))) (\forall (t1: T).((eq T (THead (Bind Abst) t t0) +(THead (Bind Abst) t t1)) \to (\forall (P: Prop).P))) (ex_intro T (\lambda +(t1: T).(eq T (THead (Bind Abst) t t0) (THead (Bind Abst) t t1))) t0 +(refl_equal T (THead (Bind Abst) t t0)))) v H4)) (\lambda (H4: (((eq T t v) +\to (\forall (P: Prop).P)))).(or_intror (ex T (\lambda (t1: T).(eq T (THead +(Bind Abst) t t0) (THead (Bind Abst) v t1)))) (\forall (t1: T).((eq T (THead +(Bind Abst) t t0) (THead (Bind Abst) v t1)) \to (\forall (P: Prop).P))) +(\lambda (t1: T).(\lambda (H5: (eq T (THead (Bind Abst) t t0) (THead (Bind +Abst) v t1))).(\lambda (P: Prop).(let H6 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t | +(TLRef _) \Rightarrow t | (THead _ t2 _) \Rightarrow t2])) (THead (Bind Abst) +t t0) (THead (Bind Abst) v t1) H5) in ((let H7 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | +(TLRef _) \Rightarrow t0 | (THead _ _ t2) \Rightarrow t2])) (THead (Bind +Abst) t t0) (THead (Bind Abst) v t1) H5) in (\lambda (H8: (eq T t v)).(H4 H8 +P))) H6))))))) H3))) k H2)) (\lambda (H2: (((eq K k (Bind Abst)) \to (\forall +(P: Prop).P)))).(or_intror (ex T (\lambda (t1: T).(eq T (THead k t t0) (THead +(Bind Abst) v t1)))) (\forall (t1: T).((eq T (THead k t t0) (THead (Bind +Abst) v t1)) \to (\forall (P: Prop).P))) (\lambda (t1: T).(\lambda (H3: (eq T +(THead k t t0) (THead (Bind Abst) v t1))).(\lambda (P: Prop).(let H4 \def +(f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) with +[(TSort _) \Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) +\Rightarrow k0])) (THead k t t0) (THead (Bind Abst) v t1) H3) in ((let H5 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t | (TLRef _) \Rightarrow t | (THead _ t2 _) +\Rightarrow t2])) (THead k t t0) (THead (Bind Abst) v t1) H3) in ((let H6 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t2) +\Rightarrow t2])) (THead k t t0) (THead (Bind Abst) v t1) H3) in (\lambda (_: +(eq T t v)).(\lambda (H8: (eq K k (Bind Abst))).(H2 H8 P)))) H5)) H4))))))) +H1))))))))) u). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/defs.ma new file mode 100644 index 000000000..236063dcf --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/defs.ma @@ -0,0 +1,45 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/defs". + +include "preamble.ma". + +inductive B: Set \def +| Abbr: B +| Abst: B +| Void: B. + +inductive F: Set \def +| Appl: F +| Cast: F. + +inductive K: Set \def +| Bind: B \to K +| Flat: F \to K. + +inductive T: Set \def +| TSort: nat \to T +| TLRef: nat \to T +| THead: K \to (T \to (T \to T)). + +definition tweight: + T \to nat +\def + let rec tweight (t: T) on t: nat \def (match t with [(TSort _) \Rightarrow +(S O) | (TLRef _) \Rightarrow (S O) | (THead _ u t0) \Rightarrow (S (plus +(tweight u) (tweight t0)))]) in tweight. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/props.ma new file mode 100644 index 000000000..1c661524e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/props.ma @@ -0,0 +1,79 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/props". + +include "T/defs.ma". + +theorem not_abbr_abst: + not (eq B Abbr Abst) +\def + \lambda (H: (eq B Abbr Abst)).(let H0 \def (eq_ind B Abbr (\lambda (ee: +B).(match ee in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow True | +Abst \Rightarrow False | Void \Rightarrow False])) I Abst H) in (False_ind +False H0)). + +theorem not_void_abst: + not (eq B Void Abst) +\def + \lambda (H: (eq B Void Abst)).(let H0 \def (eq_ind B Void (\lambda (ee: +B).(match ee in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow False | +Abst \Rightarrow False | Void \Rightarrow True])) I Abst H) in (False_ind +False H0)). + +theorem thead_x_y_y: + \forall (k: K).(\forall (v: T).(\forall (t: T).((eq T (THead k v t) t) \to +(\forall (P: Prop).P)))) +\def + \lambda (k: K).(\lambda (v: T).(\lambda (t: T).(T_ind (\lambda (t0: T).((eq +T (THead k v t0) t0) \to (\forall (P: Prop).P))) (\lambda (n: nat).(\lambda +(H: (eq T (THead k v (TSort n)) (TSort n))).(\lambda (P: Prop).(let H0 \def +(eq_ind T (THead k v (TSort n)) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n) H) in +(False_ind P H0))))) (\lambda (n: nat).(\lambda (H: (eq T (THead k v (TLRef +n)) (TLRef n))).(\lambda (P: Prop).(let H0 \def (eq_ind T (THead k v (TLRef +n)) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TLRef n) H) in (False_ind P H0))))) (\lambda (k0: +K).(\lambda (t0: T).(\lambda (_: (((eq T (THead k v t0) t0) \to (\forall (P: +Prop).P)))).(\lambda (t1: T).(\lambda (H0: (((eq T (THead k v t1) t1) \to +(\forall (P: Prop).P)))).(\lambda (H1: (eq T (THead k v (THead k0 t0 t1)) +(THead k0 t0 t1))).(\lambda (P: Prop).(let H2 \def (f_equal T K (\lambda (e: +T).(match e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | +(TLRef _) \Rightarrow k | (THead k1 _ _) \Rightarrow k1])) (THead k v (THead +k0 t0 t1)) (THead k0 t0 t1) H1) in ((let H3 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow v | +(TLRef _) \Rightarrow v | (THead _ t2 _) \Rightarrow t2])) (THead k v (THead +k0 t0 t1)) (THead k0 t0 t1) H1) in ((let H4 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow (THead +k0 t0 t1) | (TLRef _) \Rightarrow (THead k0 t0 t1) | (THead _ _ t2) +\Rightarrow t2])) (THead k v (THead k0 t0 t1)) (THead k0 t0 t1) H1) in +(\lambda (H5: (eq T v t0)).(\lambda (H6: (eq K k k0)).(let H7 \def (eq_ind T +v (\lambda (t2: T).((eq T (THead k t2 t1) t1) \to (\forall (P0: Prop).P0))) +H0 t0 H5) in (let H8 \def (eq_ind K k (\lambda (k1: K).((eq T (THead k1 t0 +t1) t1) \to (\forall (P0: Prop).P0))) H7 k0 H6) in (H8 H4 P)))))) H3)) +H2))))))))) t))). + +theorem tweight_lt: + \forall (t: T).(lt O (tweight t)) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(lt O (tweight t0))) (\lambda (_: +nat).(le_n (S O))) (\lambda (_: nat).(le_n (S O))) (\lambda (_: K).(\lambda +(t0: T).(\lambda (H: (lt O (tweight t0))).(\lambda (t1: T).(\lambda (_: (lt O +(tweight t1))).(le_S (S O) (plus (tweight t0) (tweight t1)) (le_plus_trans (S +O) (tweight t0) (tweight t1) H))))))) t). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/defs.ma new file mode 100644 index 000000000..0a1c35ea2 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/defs.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/aplus/defs". + +include "asucc/defs.ma". + +definition aplus: + G \to (A \to (nat \to A)) +\def + let rec aplus (g: G) (a: A) (n: nat) on n: A \def (match n with [O +\Rightarrow a | (S n0) \Rightarrow (asucc g (aplus g a n0))]) in aplus. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/props.ma new file mode 100644 index 000000000..16adef5c3 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/props.ma @@ -0,0 +1,251 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/aplus/props". + +include "aplus/defs.ma". + +include "next_plus/props.ma". + +theorem aplus_reg_r: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).(\forall (h1: nat).(\forall +(h2: nat).((eq A (aplus g a1 h1) (aplus g a2 h2)) \to (\forall (h: nat).(eq A +(aplus g a1 (plus h h1)) (aplus g a2 (plus h h2))))))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (h1: nat).(\lambda +(h2: nat).(\lambda (H: (eq A (aplus g a1 h1) (aplus g a2 h2))).(\lambda (h: +nat).(nat_ind (\lambda (n: nat).(eq A (aplus g a1 (plus n h1)) (aplus g a2 +(plus n h2)))) H (\lambda (n: nat).(\lambda (H0: (eq A (aplus g a1 (plus n +h1)) (aplus g a2 (plus n h2)))).(f_equal2 G A A asucc g g (aplus g a1 (plus n +h1)) (aplus g a2 (plus n h2)) (refl_equal G g) H0))) h))))))). + +theorem aplus_assoc: + \forall (g: G).(\forall (a: A).(\forall (h1: nat).(\forall (h2: nat).(eq A +(aplus g (aplus g a h1) h2) (aplus g a (plus h1 h2)))))) +\def + \lambda (g: G).(\lambda (a: A).(\lambda (h1: nat).(nat_ind (\lambda (n: +nat).(\forall (h2: nat).(eq A (aplus g (aplus g a n) h2) (aplus g a (plus n +h2))))) (\lambda (h2: nat).(refl_equal A (aplus g a h2))) (\lambda (n: +nat).(\lambda (_: ((\forall (h2: nat).(eq A (aplus g (aplus g a n) h2) (aplus +g a (plus n h2)))))).(\lambda (h2: nat).(nat_ind (\lambda (n0: nat).(eq A +(aplus g (asucc g (aplus g a n)) n0) (asucc g (aplus g a (plus n n0))))) +(eq_ind nat n (\lambda (n0: nat).(eq A (asucc g (aplus g a n)) (asucc g +(aplus g a n0)))) (refl_equal A (asucc g (aplus g a n))) (plus n O) (plus_n_O +n)) (\lambda (n0: nat).(\lambda (H0: (eq A (aplus g (asucc g (aplus g a n)) +n0) (asucc g (aplus g a (plus n n0))))).(eq_ind nat (S (plus n n0)) (\lambda +(n1: nat).(eq A (asucc g (aplus g (asucc g (aplus g a n)) n0)) (asucc g +(aplus g a n1)))) (f_equal2 G A A asucc g g (aplus g (asucc g (aplus g a n)) +n0) (asucc g (aplus g a (plus n n0))) (refl_equal G g) H0) (plus n (S n0)) +(plus_n_Sm n n0)))) h2)))) h1))). + +theorem aplus_asucc: + \forall (g: G).(\forall (h: nat).(\forall (a: A).(eq A (aplus g (asucc g a) +h) (asucc g (aplus g a h))))) +\def + \lambda (g: G).(\lambda (h: nat).(\lambda (a: A).(eq_ind_r A (aplus g a +(plus (S O) h)) (\lambda (a0: A).(eq A a0 (asucc g (aplus g a h)))) +(refl_equal A (asucc g (aplus g a h))) (aplus g (aplus g a (S O)) h) +(aplus_assoc g a (S O) h)))). + +theorem aplus_sort_O_S_simpl: + \forall (g: G).(\forall (n: nat).(\forall (k: nat).(eq A (aplus g (ASort O +n) (S k)) (aplus g (ASort O (next g n)) k)))) +\def + \lambda (g: G).(\lambda (n: nat).(\lambda (k: nat).(eq_ind A (aplus g (asucc +g (ASort O n)) k) (\lambda (a: A).(eq A a (aplus g (ASort O (next g n)) k))) +(refl_equal A (aplus g (ASort O (next g n)) k)) (asucc g (aplus g (ASort O n) +k)) (aplus_asucc g k (ASort O n))))). + +theorem aplus_sort_S_S_simpl: + \forall (g: G).(\forall (n: nat).(\forall (h: nat).(\forall (k: nat).(eq A +(aplus g (ASort (S h) n) (S k)) (aplus g (ASort h n) k))))) +\def + \lambda (g: G).(\lambda (n: nat).(\lambda (h: nat).(\lambda (k: nat).(eq_ind +A (aplus g (asucc g (ASort (S h) n)) k) (\lambda (a: A).(eq A a (aplus g +(ASort h n) k))) (refl_equal A (aplus g (ASort h n) k)) (asucc g (aplus g +(ASort (S h) n) k)) (aplus_asucc g k (ASort (S h) n)))))). + +theorem aplus_asort_O_simpl: + \forall (g: G).(\forall (h: nat).(\forall (n: nat).(eq A (aplus g (ASort O +n) h) (ASort O (next_plus g n h))))) +\def + \lambda (g: G).(\lambda (h: nat).(nat_ind (\lambda (n: nat).(\forall (n0: +nat).(eq A (aplus g (ASort O n0) n) (ASort O (next_plus g n0 n))))) (\lambda +(n: nat).(refl_equal A (ASort O n))) (\lambda (n: nat).(\lambda (H: ((\forall +(n0: nat).(eq A (aplus g (ASort O n0) n) (ASort O (next_plus g n0 +n)))))).(\lambda (n0: nat).(eq_ind A (aplus g (asucc g (ASort O n0)) n) +(\lambda (a: A).(eq A a (ASort O (next g (next_plus g n0 n))))) (eq_ind nat +(next_plus g (next g n0) n) (\lambda (n1: nat).(eq A (aplus g (ASort O (next +g n0)) n) (ASort O n1))) (H (next g n0)) (next g (next_plus g n0 n)) +(next_plus_next g n0 n)) (asucc g (aplus g (ASort O n0) n)) (aplus_asucc g n +(ASort O n0)))))) h)). + +theorem aplus_asort_le_simpl: + \forall (g: G).(\forall (h: nat).(\forall (k: nat).(\forall (n: nat).((le h +k) \to (eq A (aplus g (ASort k n) h) (ASort (minus k h) n)))))) +\def + \lambda (g: G).(\lambda (h: nat).(nat_ind (\lambda (n: nat).(\forall (k: +nat).(\forall (n0: nat).((le n k) \to (eq A (aplus g (ASort k n0) n) (ASort +(minus k n) n0)))))) (\lambda (k: nat).(\lambda (n: nat).(\lambda (_: (le O +k)).(eq_ind nat k (\lambda (n0: nat).(eq A (ASort k n) (ASort n0 n))) +(refl_equal A (ASort k n)) (minus k O) (minus_n_O k))))) (\lambda (h0: +nat).(\lambda (H: ((\forall (k: nat).(\forall (n: nat).((le h0 k) \to (eq A +(aplus g (ASort k n) h0) (ASort (minus k h0) n))))))).(\lambda (k: +nat).(nat_ind (\lambda (n: nat).(\forall (n0: nat).((le (S h0) n) \to (eq A +(asucc g (aplus g (ASort n n0) h0)) (ASort (minus n (S h0)) n0))))) (\lambda +(n: nat).(\lambda (H0: (le (S h0) O)).(ex2_ind nat (\lambda (n0: nat).(eq nat +O (S n0))) (\lambda (n0: nat).(le h0 n0)) (eq A (asucc g (aplus g (ASort O n) +h0)) (ASort (minus O (S h0)) n)) (\lambda (x: nat).(\lambda (H1: (eq nat O (S +x))).(\lambda (_: (le h0 x)).(let H3 \def (eq_ind nat O (\lambda (ee: +nat).(match ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow True +| (S _) \Rightarrow False])) I (S x) H1) in (False_ind (eq A (asucc g (aplus +g (ASort O n) h0)) (ASort (minus O (S h0)) n)) H3))))) (le_gen_S h0 O H0)))) +(\lambda (n: nat).(\lambda (_: ((\forall (n0: nat).((le (S h0) n) \to (eq A +(asucc g (aplus g (ASort n n0) h0)) (ASort (minus n (S h0)) n0)))))).(\lambda +(n0: nat).(\lambda (H1: (le (S h0) (S n))).(eq_ind A (aplus g (asucc g (ASort +(S n) n0)) h0) (\lambda (a: A).(eq A a (ASort (minus (S n) (S h0)) n0))) (H n +n0 (le_S_n h0 n H1)) (asucc g (aplus g (ASort (S n) n0) h0)) (aplus_asucc g +h0 (ASort (S n) n0))))))) k)))) h)). + +theorem aplus_asort_simpl: + \forall (g: G).(\forall (h: nat).(\forall (k: nat).(\forall (n: nat).(eq A +(aplus g (ASort k n) h) (ASort (minus k h) (next_plus g n (minus h k))))))) +\def + \lambda (g: G).(\lambda (h: nat).(\lambda (k: nat).(\lambda (n: +nat).(lt_le_e k h (eq A (aplus g (ASort k n) h) (ASort (minus k h) (next_plus +g n (minus h k)))) (\lambda (H: (lt k h)).(eq_ind_r nat (plus k (minus h k)) +(\lambda (n0: nat).(eq A (aplus g (ASort k n) n0) (ASort (minus k h) +(next_plus g n (minus h k))))) (eq_ind A (aplus g (aplus g (ASort k n) k) +(minus h k)) (\lambda (a: A).(eq A a (ASort (minus k h) (next_plus g n (minus +h k))))) (eq_ind_r A (ASort (minus k k) n) (\lambda (a: A).(eq A (aplus g a +(minus h k)) (ASort (minus k h) (next_plus g n (minus h k))))) (eq_ind nat O +(\lambda (n0: nat).(eq A (aplus g (ASort n0 n) (minus h k)) (ASort (minus k +h) (next_plus g n (minus h k))))) (eq_ind_r nat O (\lambda (n0: nat).(eq A +(aplus g (ASort O n) (minus h k)) (ASort n0 (next_plus g n (minus h k))))) +(aplus_asort_O_simpl g (minus h k) n) (minus k h) (O_minus k h (le_S_n k h +(le_S (S k) h H)))) (minus k k) (minus_n_n k)) (aplus g (ASort k n) k) +(aplus_asort_le_simpl g k k n (le_n k))) (aplus g (ASort k n) (plus k (minus +h k))) (aplus_assoc g (ASort k n) k (minus h k))) h (le_plus_minus k h +(le_S_n k h (le_S (S k) h H))))) (\lambda (H: (le h k)).(eq_ind_r A (ASort +(minus k h) n) (\lambda (a: A).(eq A a (ASort (minus k h) (next_plus g n +(minus h k))))) (eq_ind_r nat O (\lambda (n0: nat).(eq A (ASort (minus k h) +n) (ASort (minus k h) (next_plus g n n0)))) (refl_equal A (ASort (minus k h) +(next_plus g n O))) (minus h k) (O_minus h k H)) (aplus g (ASort k n) h) +(aplus_asort_le_simpl g h k n H))))))). + +theorem aplus_ahead_simpl: + \forall (g: G).(\forall (h: nat).(\forall (a1: A).(\forall (a2: A).(eq A +(aplus g (AHead a1 a2) h) (AHead a1 (aplus g a2 h)))))) +\def + \lambda (g: G).(\lambda (h: nat).(nat_ind (\lambda (n: nat).(\forall (a1: +A).(\forall (a2: A).(eq A (aplus g (AHead a1 a2) n) (AHead a1 (aplus g a2 +n)))))) (\lambda (a1: A).(\lambda (a2: A).(refl_equal A (AHead a1 a2)))) +(\lambda (n: nat).(\lambda (H: ((\forall (a1: A).(\forall (a2: A).(eq A +(aplus g (AHead a1 a2) n) (AHead a1 (aplus g a2 n))))))).(\lambda (a1: +A).(\lambda (a2: A).(eq_ind A (aplus g (asucc g (AHead a1 a2)) n) (\lambda +(a: A).(eq A a (AHead a1 (asucc g (aplus g a2 n))))) (eq_ind A (aplus g +(asucc g a2) n) (\lambda (a: A).(eq A (aplus g (asucc g (AHead a1 a2)) n) +(AHead a1 a))) (H a1 (asucc g a2)) (asucc g (aplus g a2 n)) (aplus_asucc g n +a2)) (asucc g (aplus g (AHead a1 a2) n)) (aplus_asucc g n (AHead a1 a2))))))) +h)). + +theorem aplus_asucc_false: + \forall (g: G).(\forall (a: A).(\forall (h: nat).((eq A (aplus g (asucc g a) +h) a) \to (\forall (P: Prop).P)))) +\def + \lambda (g: G).(\lambda (a: A).(A_ind (\lambda (a0: A).(\forall (h: +nat).((eq A (aplus g (asucc g a0) h) a0) \to (\forall (P: Prop).P)))) +(\lambda (n: nat).(\lambda (n0: nat).(\lambda (h: nat).(\lambda (H: (eq A +(aplus g (match n with [O \Rightarrow (ASort O (next g n0)) | (S h0) +\Rightarrow (ASort h0 n0)]) h) (ASort n n0))).(\lambda (P: Prop).(nat_ind +(\lambda (n1: nat).((eq A (aplus g (match n1 with [O \Rightarrow (ASort O +(next g n0)) | (S h0) \Rightarrow (ASort h0 n0)]) h) (ASort n1 n0)) \to P)) +(\lambda (H0: (eq A (aplus g (ASort O (next g n0)) h) (ASort O n0))).(let H1 +\def (eq_ind A (aplus g (ASort O (next g n0)) h) (\lambda (a0: A).(eq A a0 +(ASort O n0))) H0 (ASort (minus O h) (next_plus g (next g n0) (minus h O))) +(aplus_asort_simpl g h O (next g n0))) in (let H2 \def (f_equal A nat +(\lambda (e: A).(match e in A return (\lambda (_: A).nat) with [(ASort _ n1) +\Rightarrow n1 | (AHead _ _) \Rightarrow ((let rec next_plus (g0: G) (n1: +nat) (i: nat) on i: nat \def (match i with [O \Rightarrow n1 | (S i0) +\Rightarrow (next g0 (next_plus g0 n1 i0))]) in next_plus) g (next g n0) +(minus h O))])) (ASort (minus O h) (next_plus g (next g n0) (minus h O))) +(ASort O n0) H1) in (let H3 \def (eq_ind_r nat (minus h O) (\lambda (n1: +nat).(eq nat (next_plus g (next g n0) n1) n0)) H2 h (minus_n_O h)) in +(le_lt_false (next_plus g (next g n0) h) n0 (eq_ind nat (next_plus g (next g +n0) h) (\lambda (n1: nat).(le (next_plus g (next g n0) h) n1)) (le_n +(next_plus g (next g n0) h)) n0 H3) (next_plus_lt g h n0) P))))) (\lambda +(n1: nat).(\lambda (_: (((eq A (aplus g (match n1 with [O \Rightarrow (ASort +O (next g n0)) | (S h0) \Rightarrow (ASort h0 n0)]) h) (ASort n1 n0)) \to +P))).(\lambda (H0: (eq A (aplus g (ASort n1 n0) h) (ASort (S n1) n0))).(let +H1 \def (eq_ind A (aplus g (ASort n1 n0) h) (\lambda (a0: A).(eq A a0 (ASort +(S n1) n0))) H0 (ASort (minus n1 h) (next_plus g n0 (minus h n1))) +(aplus_asort_simpl g h n1 n0)) in (let H2 \def (f_equal A nat (\lambda (e: +A).(match e in A return (\lambda (_: A).nat) with [(ASort n2 _) \Rightarrow +n2 | (AHead _ _) \Rightarrow ((let rec minus (n2: nat) on n2: (nat \to nat) +\def (\lambda (m: nat).(match n2 with [O \Rightarrow O | (S k) \Rightarrow +(match m with [O \Rightarrow (S k) | (S l) \Rightarrow (minus k l)])])) in +minus) n1 h)])) (ASort (minus n1 h) (next_plus g n0 (minus h n1))) (ASort (S +n1) n0) H1) in ((let H3 \def (f_equal A nat (\lambda (e: A).(match e in A +return (\lambda (_: A).nat) with [(ASort _ n2) \Rightarrow n2 | (AHead _ _) +\Rightarrow ((let rec next_plus (g0: G) (n2: nat) (i: nat) on i: nat \def +(match i with [O \Rightarrow n2 | (S i0) \Rightarrow (next g0 (next_plus g0 +n2 i0))]) in next_plus) g n0 (minus h n1))])) (ASort (minus n1 h) (next_plus +g n0 (minus h n1))) (ASort (S n1) n0) H1) in (\lambda (H4: (eq nat (minus n1 +h) (S n1))).(le_Sx_x n1 (eq_ind nat (minus n1 h) (\lambda (n2: nat).(le n2 +n1)) (minus_le n1 h) (S n1) H4) P))) H2)))))) n H)))))) (\lambda (a0: +A).(\lambda (_: ((\forall (h: nat).((eq A (aplus g (asucc g a0) h) a0) \to +(\forall (P: Prop).P))))).(\lambda (a1: A).(\lambda (H0: ((\forall (h: +nat).((eq A (aplus g (asucc g a1) h) a1) \to (\forall (P: +Prop).P))))).(\lambda (h: nat).(\lambda (H1: (eq A (aplus g (AHead a0 (asucc +g a1)) h) (AHead a0 a1))).(\lambda (P: Prop).(let H2 \def (eq_ind A (aplus g +(AHead a0 (asucc g a1)) h) (\lambda (a2: A).(eq A a2 (AHead a0 a1))) H1 +(AHead a0 (aplus g (asucc g a1) h)) (aplus_ahead_simpl g h a0 (asucc g a1))) +in (let H3 \def (f_equal A A (\lambda (e: A).(match e in A return (\lambda +(_: A).A) with [(ASort _ _) \Rightarrow ((let rec aplus (g0: G) (a2: A) (n: +nat) on n: A \def (match n with [O \Rightarrow a2 | (S n0) \Rightarrow (asucc +g0 (aplus g0 a2 n0))]) in aplus) g (asucc g a1) h) | (AHead _ a2) \Rightarrow +a2])) (AHead a0 (aplus g (asucc g a1) h)) (AHead a0 a1) H2) in (H0 h H3 +P)))))))))) a)). + +theorem aplus_inj: + \forall (g: G).(\forall (h1: nat).(\forall (h2: nat).(\forall (a: A).((eq A +(aplus g a h1) (aplus g a h2)) \to (eq nat h1 h2))))) +\def + \lambda (g: G).(\lambda (h1: nat).(nat_ind (\lambda (n: nat).(\forall (h2: +nat).(\forall (a: A).((eq A (aplus g a n) (aplus g a h2)) \to (eq nat n +h2))))) (\lambda (h2: nat).(nat_ind (\lambda (n: nat).(\forall (a: A).((eq A +(aplus g a O) (aplus g a n)) \to (eq nat O n)))) (\lambda (a: A).(\lambda (_: +(eq A a a)).(refl_equal nat O))) (\lambda (n: nat).(\lambda (_: ((\forall (a: +A).((eq A a (aplus g a n)) \to (eq nat O n))))).(\lambda (a: A).(\lambda (H0: +(eq A a (asucc g (aplus g a n)))).(let H1 \def (eq_ind_r A (asucc g (aplus g +a n)) (\lambda (a0: A).(eq A a a0)) H0 (aplus g (asucc g a) n) (aplus_asucc g +n a)) in (aplus_asucc_false g a n (sym_eq A a (aplus g (asucc g a) n) H1) (eq +nat O (S n)))))))) h2)) (\lambda (n: nat).(\lambda (H: ((\forall (h2: +nat).(\forall (a: A).((eq A (aplus g a n) (aplus g a h2)) \to (eq nat n +h2)))))).(\lambda (h2: nat).(nat_ind (\lambda (n0: nat).(\forall (a: A).((eq +A (aplus g a (S n)) (aplus g a n0)) \to (eq nat (S n) n0)))) (\lambda (a: +A).(\lambda (H0: (eq A (asucc g (aplus g a n)) a)).(let H1 \def (eq_ind_r A +(asucc g (aplus g a n)) (\lambda (a0: A).(eq A a0 a)) H0 (aplus g (asucc g a) +n) (aplus_asucc g n a)) in (aplus_asucc_false g a n H1 (eq nat (S n) O))))) +(\lambda (n0: nat).(\lambda (_: ((\forall (a: A).((eq A (asucc g (aplus g a +n)) (aplus g a n0)) \to (eq nat (S n) n0))))).(\lambda (a: A).(\lambda (H1: +(eq A (asucc g (aplus g a n)) (asucc g (aplus g a n0)))).(let H2 \def +(eq_ind_r A (asucc g (aplus g a n)) (\lambda (a0: A).(eq A a0 (asucc g (aplus +g a n0)))) H1 (aplus g (asucc g a) n) (aplus_asucc g n a)) in (let H3 \def +(eq_ind_r A (asucc g (aplus g a n0)) (\lambda (a0: A).(eq A (aplus g (asucc g +a) n) a0)) H2 (aplus g (asucc g a) n0) (aplus_asucc g n0 a)) in (f_equal nat +nat S n n0 (H n0 (asucc g a) H3)))))))) h2)))) h1)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/defs.ma new file mode 100644 index 000000000..258037275 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/defs.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/aprem/defs". + +include "A/defs.ma". + +inductive aprem: nat \to (A \to (A \to Prop)) \def +| aprem_zero: \forall (a1: A).(\forall (a2: A).(aprem O (AHead a1 a2) a1)) +| aprem_succ: \forall (a2: A).(\forall (a: A).(\forall (i: nat).((aprem i a2 +a) \to (\forall (a1: A).(aprem (S i) (AHead a1 a2) a))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/props.ma new file mode 100644 index 000000000..60264bca2 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/props.ma @@ -0,0 +1,151 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/aprem/props". + +include "aprem/defs.ma". + +include "leq/defs.ma". + +theorem aprem_repl: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((leq g a1 a2) \to (\forall +(i: nat).(\forall (b2: A).((aprem i a2 b2) \to (ex2 A (\lambda (b1: A).(leq g +b1 b2)) (\lambda (b1: A).(aprem i a1 b1))))))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (H: (leq g a1 +a2)).(leq_ind g (\lambda (a: A).(\lambda (a0: A).(\forall (i: nat).(\forall +(b2: A).((aprem i a0 b2) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda +(b1: A).(aprem i a b1)))))))) (\lambda (h1: nat).(\lambda (h2: nat).(\lambda +(n1: nat).(\lambda (n2: nat).(\lambda (k: nat).(\lambda (_: (eq A (aplus g +(ASort h1 n1) k) (aplus g (ASort h2 n2) k))).(\lambda (i: nat).(\lambda (b2: +A).(\lambda (H1: (aprem i (ASort h2 n2) b2)).(let H2 \def (match H1 in aprem +return (\lambda (n: nat).(\lambda (a: A).(\lambda (a0: A).(\lambda (_: (aprem +n a a0)).((eq nat n i) \to ((eq A a (ASort h2 n2)) \to ((eq A a0 b2) \to (ex2 +A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem i (ASort h1 n1) +b1)))))))))) with [(aprem_zero a0 a3) \Rightarrow (\lambda (H2: (eq nat O +i)).(\lambda (H3: (eq A (AHead a0 a3) (ASort h2 n2))).(\lambda (H4: (eq A a0 +b2)).(eq_ind nat O (\lambda (n: nat).((eq A (AHead a0 a3) (ASort h2 n2)) \to +((eq A a0 b2) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: +A).(aprem n (ASort h1 n1) b1)))))) (\lambda (H5: (eq A (AHead a0 a3) (ASort +h2 n2))).(let H6 \def (eq_ind A (AHead a0 a3) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ +_) \Rightarrow True])) I (ASort h2 n2) H5) in (False_ind ((eq A a0 b2) \to +(ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem O (ASort h1 +n1) b1)))) H6))) i H2 H3 H4)))) | (aprem_succ a0 a i0 H2 a3) \Rightarrow +(\lambda (H3: (eq nat (S i0) i)).(\lambda (H4: (eq A (AHead a3 a0) (ASort h2 +n2))).(\lambda (H5: (eq A a b2)).(eq_ind nat (S i0) (\lambda (n: nat).((eq A +(AHead a3 a0) (ASort h2 n2)) \to ((eq A a b2) \to ((aprem i0 a0 a) \to (ex2 A +(\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem n (ASort h1 n1) +b1))))))) (\lambda (H6: (eq A (AHead a3 a0) (ASort h2 n2))).(let H7 \def +(eq_ind A (AHead a3 a0) (\lambda (e: A).(match e in A return (\lambda (_: +A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow +True])) I (ASort h2 n2) H6) in (False_ind ((eq A a b2) \to ((aprem i0 a0 a) +\to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem (S i0) +(ASort h1 n1) b1))))) H7))) i H3 H4 H5 H2))))]) in (H2 (refl_equal nat i) +(refl_equal A (ASort h2 n2)) (refl_equal A b2)))))))))))) (\lambda (a0: +A).(\lambda (a3: A).(\lambda (H0: (leq g a0 a3)).(\lambda (_: ((\forall (i: +nat).(\forall (b2: A).((aprem i a3 b2) \to (ex2 A (\lambda (b1: A).(leq g b1 +b2)) (\lambda (b1: A).(aprem i a0 b1)))))))).(\lambda (a4: A).(\lambda (a5: +A).(\lambda (_: (leq g a4 a5)).(\lambda (H3: ((\forall (i: nat).(\forall (b2: +A).((aprem i a5 b2) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: +A).(aprem i a4 b1)))))))).(\lambda (i: nat).(\lambda (b2: A).(\lambda (H4: +(aprem i (AHead a3 a5) b2)).(nat_ind (\lambda (n: nat).((aprem n (AHead a3 +a5) b2) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem n +(AHead a0 a4) b1))))) (\lambda (H5: (aprem O (AHead a3 a5) b2)).(let H6 \def +(match H5 in aprem return (\lambda (n: nat).(\lambda (a: A).(\lambda (a6: +A).(\lambda (_: (aprem n a a6)).((eq nat n O) \to ((eq A a (AHead a3 a5)) \to +((eq A a6 b2) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: +A).(aprem O (AHead a0 a4) b1)))))))))) with [(aprem_zero a6 a7) \Rightarrow +(\lambda (_: (eq nat O O)).(\lambda (H7: (eq A (AHead a6 a7) (AHead a3 +a5))).(\lambda (H8: (eq A a6 b2)).((let H9 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a7 | +(AHead _ a) \Rightarrow a])) (AHead a6 a7) (AHead a3 a5) H7) in ((let H10 +\def (f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) +with [(ASort _ _) \Rightarrow a6 | (AHead a _) \Rightarrow a])) (AHead a6 a7) +(AHead a3 a5) H7) in (eq_ind A a3 (\lambda (a: A).((eq A a7 a5) \to ((eq A a +b2) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem O +(AHead a0 a4) b1)))))) (\lambda (H11: (eq A a7 a5)).(eq_ind A a5 (\lambda (_: +A).((eq A a3 b2) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: +A).(aprem O (AHead a0 a4) b1))))) (\lambda (H12: (eq A a3 b2)).(eq_ind A b2 +(\lambda (_: A).(ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: +A).(aprem O (AHead a0 a4) b1)))) (eq_ind A a3 (\lambda (a: A).(ex2 A (\lambda +(b1: A).(leq g b1 a)) (\lambda (b1: A).(aprem O (AHead a0 a4) b1)))) +(ex_intro2 A (\lambda (b1: A).(leq g b1 a3)) (\lambda (b1: A).(aprem O (AHead +a0 a4) b1)) a0 H0 (aprem_zero a0 a4)) b2 H12) a3 (sym_eq A a3 b2 H12))) a7 +(sym_eq A a7 a5 H11))) a6 (sym_eq A a6 a3 H10))) H9)) H8)))) | (aprem_succ a6 +a i0 H6 a7) \Rightarrow (\lambda (H7: (eq nat (S i0) O)).(\lambda (H8: (eq A +(AHead a7 a6) (AHead a3 a5))).(\lambda (H9: (eq A a b2)).((let H10 \def +(eq_ind nat (S i0) (\lambda (e: nat).(match e in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H7) in +(False_ind ((eq A (AHead a7 a6) (AHead a3 a5)) \to ((eq A a b2) \to ((aprem +i0 a6 a) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem O +(AHead a0 a4) b1)))))) H10)) H8 H9 H6))))]) in (H6 (refl_equal nat O) +(refl_equal A (AHead a3 a5)) (refl_equal A b2)))) (\lambda (i0: nat).(\lambda +(_: (((aprem i0 (AHead a3 a5) b2) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) +(\lambda (b1: A).(aprem i0 (AHead a0 a4) b1)))))).(\lambda (H5: (aprem (S i0) +(AHead a3 a5) b2)).(let H6 \def (match H5 in aprem return (\lambda (n: +nat).(\lambda (a: A).(\lambda (a6: A).(\lambda (_: (aprem n a a6)).((eq nat n +(S i0)) \to ((eq A a (AHead a3 a5)) \to ((eq A a6 b2) \to (ex2 A (\lambda +(b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem (S i0) (AHead a0 a4) +b1)))))))))) with [(aprem_zero a6 a7) \Rightarrow (\lambda (H6: (eq nat O (S +i0))).(\lambda (H7: (eq A (AHead a6 a7) (AHead a3 a5))).(\lambda (H8: (eq A +a6 b2)).((let H9 \def (eq_ind nat O (\lambda (e: nat).(match e in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) +I (S i0) H6) in (False_ind ((eq A (AHead a6 a7) (AHead a3 a5)) \to ((eq A a6 +b2) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem (S i0) +(AHead a0 a4) b1))))) H9)) H7 H8)))) | (aprem_succ a6 a i1 H6 a7) \Rightarrow +(\lambda (H7: (eq nat (S i1) (S i0))).(\lambda (H8: (eq A (AHead a7 a6) +(AHead a3 a5))).(\lambda (H9: (eq A a b2)).((let H10 \def (f_equal nat nat +(\lambda (e: nat).(match e in nat return (\lambda (_: nat).nat) with [O +\Rightarrow i1 | (S n) \Rightarrow n])) (S i1) (S i0) H7) in (eq_ind nat i0 +(\lambda (n: nat).((eq A (AHead a7 a6) (AHead a3 a5)) \to ((eq A a b2) \to +((aprem n a6 a) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: +A).(aprem (S i0) (AHead a0 a4) b1))))))) (\lambda (H11: (eq A (AHead a7 a6) +(AHead a3 a5))).(let H12 \def (f_equal A A (\lambda (e: A).(match e in A +return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a6 | (AHead _ a8) +\Rightarrow a8])) (AHead a7 a6) (AHead a3 a5) H11) in ((let H13 \def (f_equal +A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) +\Rightarrow a7 | (AHead a8 _) \Rightarrow a8])) (AHead a7 a6) (AHead a3 a5) +H11) in (eq_ind A a3 (\lambda (_: A).((eq A a6 a5) \to ((eq A a b2) \to +((aprem i0 a6 a) \to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: +A).(aprem (S i0) (AHead a0 a4) b1))))))) (\lambda (H14: (eq A a6 a5)).(eq_ind +A a5 (\lambda (a8: A).((eq A a b2) \to ((aprem i0 a8 a) \to (ex2 A (\lambda +(b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem (S i0) (AHead a0 a4) b1)))))) +(\lambda (H15: (eq A a b2)).(eq_ind A b2 (\lambda (a8: A).((aprem i0 a5 a8) +\to (ex2 A (\lambda (b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem (S i0) +(AHead a0 a4) b1))))) (\lambda (H16: (aprem i0 a5 b2)).(let H_x \def (H3 i0 +b2 H16) in (let H17 \def H_x in (ex2_ind A (\lambda (b1: A).(leq g b1 b2)) +(\lambda (b1: A).(aprem i0 a4 b1)) (ex2 A (\lambda (b1: A).(leq g b1 b2)) +(\lambda (b1: A).(aprem (S i0) (AHead a0 a4) b1))) (\lambda (x: A).(\lambda +(H18: (leq g x b2)).(\lambda (H19: (aprem i0 a4 x)).(ex_intro2 A (\lambda +(b1: A).(leq g b1 b2)) (\lambda (b1: A).(aprem (S i0) (AHead a0 a4) b1)) x +H18 (aprem_succ a4 x i0 H19 a0))))) H17)))) a (sym_eq A a b2 H15))) a6 +(sym_eq A a6 a5 H14))) a7 (sym_eq A a7 a3 H13))) H12))) i1 (sym_eq nat i1 i0 +H10))) H8 H9 H6))))]) in (H6 (refl_equal nat (S i0)) (refl_equal A (AHead a3 +a5)) (refl_equal A b2)))))) i H4)))))))))))) a1 a2 H)))). + +theorem aprem_asucc: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).(\forall (i: nat).((aprem i +a1 a2) \to (aprem i (asucc g a1) a2))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (i: nat).(\lambda +(H: (aprem i a1 a2)).(aprem_ind (\lambda (n: nat).(\lambda (a: A).(\lambda +(a0: A).(aprem n (asucc g a) a0)))) (\lambda (a0: A).(\lambda (a3: +A).(aprem_zero a0 (asucc g a3)))) (\lambda (a0: A).(\lambda (a: A).(\lambda +(i0: nat).(\lambda (_: (aprem i0 a0 a)).(\lambda (H1: (aprem i0 (asucc g a0) +a)).(\lambda (a3: A).(aprem_succ (asucc g a0) a i0 H1 a3))))))) i a1 a2 +H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/aprem.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/aprem.ma new file mode 100644 index 000000000..e3a36f11c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/aprem.ma @@ -0,0 +1,357 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/arity/aprem". + +include "arity/props.ma". + +include "arity/cimp.ma". + +include "aprem/props.ma". + +theorem arity_aprem: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (a: A).((arity g c t +a) \to (\forall (i: nat).(\forall (b: A).((aprem i a b) \to (ex2_3 C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d c)))) +(\lambda (d: C).(\lambda (u: T).(\lambda (_: nat).(arity g d u (asucc g +b))))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c t a)).(arity_ind g (\lambda (c0: C).(\lambda (_: T).(\lambda (a0: +A).(\forall (i: nat).(\forall (b: A).((aprem i a0 b) \to (ex2_3 C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d c0)))) +(\lambda (d: C).(\lambda (u: T).(\lambda (_: nat).(arity g d u (asucc g +b)))))))))))) (\lambda (c0: C).(\lambda (n: nat).(\lambda (i: nat).(\lambda +(b: A).(\lambda (H0: (aprem i (ASort O n) b)).(let H1 \def (match H0 in aprem +return (\lambda (n0: nat).(\lambda (a0: A).(\lambda (a1: A).(\lambda (_: +(aprem n0 a0 a1)).((eq nat n0 i) \to ((eq A a0 (ASort O n)) \to ((eq A a1 b) +\to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop +(plus i j) O d c0)))) (\lambda (d: C).(\lambda (u: T).(\lambda (_: +nat).(arity g d u (asucc g b))))))))))))) with [(aprem_zero a1 a2) +\Rightarrow (\lambda (H1: (eq nat O i)).(\lambda (H2: (eq A (AHead a1 a2) +(ASort O n))).(\lambda (H3: (eq A a1 b)).(eq_ind nat O (\lambda (n0: +nat).((eq A (AHead a1 a2) (ASort O n)) \to ((eq A a1 b) \to (ex2_3 C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus n0 j) O d +c0)))) (\lambda (d: C).(\lambda (u: T).(\lambda (_: nat).(arity g d u (asucc +g b))))))))) (\lambda (H4: (eq A (AHead a1 a2) (ASort O n))).(let H5 \def +(eq_ind A (AHead a1 a2) (\lambda (e: A).(match e in A return (\lambda (_: +A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow +True])) I (ASort O n) H4) in (False_ind ((eq A a1 b) \to (ex2_3 C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus O j) O d c0)))) +(\lambda (d: C).(\lambda (u: T).(\lambda (_: nat).(arity g d u (asucc g +b))))))) H5))) i H1 H2 H3)))) | (aprem_succ a2 a0 i0 H1 a1) \Rightarrow +(\lambda (H2: (eq nat (S i0) i)).(\lambda (H3: (eq A (AHead a1 a2) (ASort O +n))).(\lambda (H4: (eq A a0 b)).(eq_ind nat (S i0) (\lambda (n0: nat).((eq A +(AHead a1 a2) (ASort O n)) \to ((eq A a0 b) \to ((aprem i0 a2 a0) \to (ex2_3 +C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus n0 j) O +d c0)))) (\lambda (d: C).(\lambda (u: T).(\lambda (_: nat).(arity g d u +(asucc g b)))))))))) (\lambda (H5: (eq A (AHead a1 a2) (ASort O n))).(let H6 +\def (eq_ind A (AHead a1 a2) (\lambda (e: A).(match e in A return (\lambda +(_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow +True])) I (ASort O n) H5) in (False_ind ((eq A a0 b) \to ((aprem i0 a2 a0) +\to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop +(plus (S i0) j) O d c0)))) (\lambda (d: C).(\lambda (u: T).(\lambda (_: +nat).(arity g d u (asucc g b)))))))) H6))) i H2 H3 H4 H1))))]) in (H1 +(refl_equal nat i) (refl_equal A (ASort O n)) (refl_equal A b)))))))) +(\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H0: (getl i c0 (CHead d (Bind Abbr) u))).(\lambda (a0: A).(\lambda (_: +(arity g d u a0)).(\lambda (H2: ((\forall (i0: nat).(\forall (b: A).((aprem +i0 a0 b) \to (ex2_3 C T nat (\lambda (d0: C).(\lambda (_: T).(\lambda (j: +nat).(drop (plus i0 j) O d0 d)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda +(_: nat).(arity g d0 u0 (asucc g b))))))))))).(\lambda (i0: nat).(\lambda (b: +A).(\lambda (H3: (aprem i0 a0 b)).(let H_x \def (H2 i0 b H3) in (let H4 \def +H_x in (ex2_3_ind C T nat (\lambda (d0: C).(\lambda (_: T).(\lambda (j: +nat).(drop (plus i0 j) O d0 d)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda +(_: nat).(arity g d0 u0 (asucc g b))))) (ex2_3 C T nat (\lambda (d0: +C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i0 j) O d0 c0)))) (\lambda +(d0: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d0 u0 (asucc g b)))))) +(\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: nat).(\lambda (H5: (drop +(plus i0 x2) O x0 d)).(\lambda (H6: (arity g x0 x1 (asucc g b))).(let H_x0 +\def (getl_drop_conf_rev (plus i0 x2) x0 d H5 Abbr c0 u i H0) in (let H7 \def +H_x0 in (ex2_ind C (\lambda (c1: C).(drop (plus i0 x2) O c1 c0)) (\lambda +(c1: C).(drop (S i) (plus i0 x2) c1 x0)) (ex2_3 C T nat (\lambda (d0: +C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i0 j) O d0 c0)))) (\lambda +(d0: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d0 u0 (asucc g b)))))) +(\lambda (x: C).(\lambda (H8: (drop (plus i0 x2) O x c0)).(\lambda (H9: (drop +(S i) (plus i0 x2) x x0)).(ex2_3_intro C T nat (\lambda (d0: C).(\lambda (_: +T).(\lambda (j: nat).(drop (plus i0 j) O d0 c0)))) (\lambda (d0: C).(\lambda +(u0: T).(\lambda (_: nat).(arity g d0 u0 (asucc g b))))) x (lift (S i) (plus +i0 x2) x1) x2 H8 (arity_lift g x0 x1 (asucc g b) H6 x (S i) (plus i0 x2) +H9))))) H7)))))))) H4)))))))))))))) (\lambda (c0: C).(\lambda (d: C).(\lambda +(u: T).(\lambda (i: nat).(\lambda (H0: (getl i c0 (CHead d (Bind Abst) +u))).(\lambda (a0: A).(\lambda (_: (arity g d u (asucc g a0))).(\lambda (H2: +((\forall (i0: nat).(\forall (b: A).((aprem i0 (asucc g a0) b) \to (ex2_3 C T +nat (\lambda (d0: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i0 j) O d0 +d)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d0 u0 +(asucc g b))))))))))).(\lambda (i0: nat).(\lambda (b: A).(\lambda (H3: (aprem +i0 a0 b)).(let H4 \def (H2 i0 b (aprem_asucc g a0 b i0 H3)) in (ex2_3_ind C T +nat (\lambda (d0: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i0 j) O d0 +d)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d0 u0 +(asucc g b))))) (ex2_3 C T nat (\lambda (d0: C).(\lambda (_: T).(\lambda (j: +nat).(drop (plus i0 j) O d0 c0)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda +(_: nat).(arity g d0 u0 (asucc g b)))))) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (x2: nat).(\lambda (H5: (drop (plus i0 x2) O x0 d)).(\lambda (H6: +(arity g x0 x1 (asucc g b))).(let H_x \def (getl_drop_conf_rev (plus i0 x2) +x0 d H5 Abst c0 u i H0) in (let H7 \def H_x in (ex2_ind C (\lambda (c1: +C).(drop (plus i0 x2) O c1 c0)) (\lambda (c1: C).(drop (S i) (plus i0 x2) c1 +x0)) (ex2_3 C T nat (\lambda (d0: C).(\lambda (_: T).(\lambda (j: nat).(drop +(plus i0 j) O d0 c0)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda (_: +nat).(arity g d0 u0 (asucc g b)))))) (\lambda (x: C).(\lambda (H8: (drop +(plus i0 x2) O x c0)).(\lambda (H9: (drop (S i) (plus i0 x2) x +x0)).(ex2_3_intro C T nat (\lambda (d0: C).(\lambda (_: T).(\lambda (j: +nat).(drop (plus i0 j) O d0 c0)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda +(_: nat).(arity g d0 u0 (asucc g b))))) x (lift (S i) (plus i0 x2) x1) x2 H8 +(arity_lift g x0 x1 (asucc g b) H6 x (S i) (plus i0 x2) H9))))) H7)))))))) +H4))))))))))))) (\lambda (b: B).(\lambda (_: (not (eq B b Abst))).(\lambda +(c0: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u +a1)).(\lambda (_: ((\forall (i: nat).(\forall (b0: A).((aprem i a1 b0) \to +(ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus +i j) O d c0)))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d +u0 (asucc g b0))))))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: +(arity g (CHead c0 (Bind b) u) t0 a2)).(\lambda (H4: ((\forall (i: +nat).(\forall (b0: A).((aprem i a2 b0) \to (ex2_3 C T nat (\lambda (d: +C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d (CHead c0 (Bind b) +u))))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 +(asucc g b0))))))))))).(\lambda (i: nat).(\lambda (b0: A).(\lambda (H5: +(aprem i a2 b0)).(let H_x \def (H4 i b0 H5) in (let H6 \def H_x in (ex2_3_ind +C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O +d (CHead c0 (Bind b) u))))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: +nat).(arity g d u0 (asucc g b0))))) (ex2_3 C T nat (\lambda (d: C).(\lambda +(_: T).(\lambda (j: nat).(drop (plus i j) O d c0)))) (\lambda (d: C).(\lambda +(u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b0)))))) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (x2: nat).(\lambda (H7: (drop (plus i x2) O x0 +(CHead c0 (Bind b) u))).(\lambda (H8: (arity g x0 x1 (asucc g b0))).(let H9 +\def (eq_ind nat (S (plus i x2)) (\lambda (n: nat).(drop n O x0 c0)) (drop_S +b x0 c0 u (plus i x2) H7) (plus i (S x2)) (plus_n_Sm i x2)) in (ex2_3_intro C +T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d +c0)))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 +(asucc g b0))))) x0 x1 (S x2) H9 H8))))))) H6))))))))))))))))) (\lambda (c0: +C).(\lambda (u: T).(\lambda (a1: A).(\lambda (H0: (arity g c0 u (asucc g +a1))).(\lambda (_: ((\forall (i: nat).(\forall (b: A).((aprem i (asucc g a1) +b) \to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop +(plus i j) O d c0)))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: +nat).(arity g d u0 (asucc g b))))))))))).(\lambda (t0: T).(\lambda (a2: +A).(\lambda (_: (arity g (CHead c0 (Bind Abst) u) t0 a2)).(\lambda (H3: +((\forall (i: nat).(\forall (b: A).((aprem i a2 b) \to (ex2_3 C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d (CHead +c0 (Bind Abst) u))))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: +nat).(arity g d u0 (asucc g b))))))))))).(\lambda (i: nat).(\lambda (b: +A).(\lambda (H4: (aprem i (AHead a1 a2) b)).(nat_ind (\lambda (n: +nat).((aprem n (AHead a1 a2) b) \to (ex2_3 C T nat (\lambda (d: C).(\lambda +(_: T).(\lambda (j: nat).(drop (plus n j) O d c0)))) (\lambda (d: C).(\lambda +(u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b)))))))) (\lambda (H5: +(aprem O (AHead a1 a2) b)).(let H6 \def (match H5 in aprem return (\lambda +(n: nat).(\lambda (a0: A).(\lambda (a3: A).(\lambda (_: (aprem n a0 a3)).((eq +nat n O) \to ((eq A a0 (AHead a1 a2)) \to ((eq A a3 b) \to (ex2_3 C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus O j) O d c0)))) +(\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g +b))))))))))))) with [(aprem_zero a0 a3) \Rightarrow (\lambda (_: (eq nat O +O)).(\lambda (H7: (eq A (AHead a0 a3) (AHead a1 a2))).(\lambda (H8: (eq A a0 +b)).((let H9 \def (f_equal A A (\lambda (e: A).(match e in A return (\lambda +(_: A).A) with [(ASort _ _) \Rightarrow a3 | (AHead _ a4) \Rightarrow a4])) +(AHead a0 a3) (AHead a1 a2) H7) in ((let H10 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a0 | +(AHead a4 _) \Rightarrow a4])) (AHead a0 a3) (AHead a1 a2) H7) in (eq_ind A +a1 (\lambda (a4: A).((eq A a3 a2) \to ((eq A a4 b) \to (ex2_3 C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus O j) O d c0)))) +(\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g +b))))))))) (\lambda (H11: (eq A a3 a2)).(eq_ind A a2 (\lambda (_: A).((eq A +a1 b) \to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: +nat).(drop (plus O j) O d c0)))) (\lambda (d: C).(\lambda (u0: T).(\lambda +(_: nat).(arity g d u0 (asucc g b)))))))) (\lambda (H12: (eq A a1 b)).(eq_ind +A b (\lambda (_: A).(ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda +(j: nat).(drop (plus O j) O d c0)))) (\lambda (d: C).(\lambda (u0: +T).(\lambda (_: nat).(arity g d u0 (asucc g b))))))) (eq_ind A a1 (\lambda +(a4: A).(ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: +nat).(drop (plus O j) O d c0)))) (\lambda (d: C).(\lambda (u0: T).(\lambda +(_: nat).(arity g d u0 (asucc g a4))))))) (ex2_3_intro C T nat (\lambda (d: +C).(\lambda (_: T).(\lambda (j: nat).(drop (plus O j) O d c0)))) (\lambda (d: +C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g a1))))) c0 u O +(drop_refl c0) H0) b H12) a1 (sym_eq A a1 b H12))) a3 (sym_eq A a3 a2 H11))) +a0 (sym_eq A a0 a1 H10))) H9)) H8)))) | (aprem_succ a0 a3 i0 H6 a4) +\Rightarrow (\lambda (H7: (eq nat (S i0) O)).(\lambda (H8: (eq A (AHead a4 +a0) (AHead a1 a2))).(\lambda (H9: (eq A a3 b)).((let H10 \def (eq_ind nat (S +i0) (\lambda (e: nat).(match e in nat return (\lambda (_: nat).Prop) with [O +\Rightarrow False | (S _) \Rightarrow True])) I O H7) in (False_ind ((eq A +(AHead a4 a0) (AHead a1 a2)) \to ((eq A a3 b) \to ((aprem i0 a0 a3) \to +(ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus +O j) O d c0)))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d +u0 (asucc g b))))))))) H10)) H8 H9 H6))))]) in (H6 (refl_equal nat O) +(refl_equal A (AHead a1 a2)) (refl_equal A b)))) (\lambda (i0: nat).(\lambda +(_: (((aprem i0 (AHead a1 a2) b) \to (ex2_3 C T nat (\lambda (d: C).(\lambda +(_: T).(\lambda (j: nat).(drop (plus i0 j) O d c0)))) (\lambda (d: +C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g +b))))))))).(\lambda (H5: (aprem (S i0) (AHead a1 a2) b)).(let H6 \def (match +H5 in aprem return (\lambda (n: nat).(\lambda (a0: A).(\lambda (a3: +A).(\lambda (_: (aprem n a0 a3)).((eq nat n (S i0)) \to ((eq A a0 (AHead a1 +a2)) \to ((eq A a3 b) \to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: +T).(\lambda (j: nat).(drop (plus (S i0) j) O d c0)))) (\lambda (d: +C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b))))))))))))) +with [(aprem_zero a0 a3) \Rightarrow (\lambda (H6: (eq nat O (S +i0))).(\lambda (H7: (eq A (AHead a0 a3) (AHead a1 a2))).(\lambda (H8: (eq A +a0 b)).((let H9 \def (eq_ind nat O (\lambda (e: nat).(match e in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) +I (S i0) H6) in (False_ind ((eq A (AHead a0 a3) (AHead a1 a2)) \to ((eq A a0 +b) \to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop +(plus (S i0) j) O d c0)))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: +nat).(arity g d u0 (asucc g b)))))))) H9)) H7 H8)))) | (aprem_succ a0 a3 i1 +H6 a4) \Rightarrow (\lambda (H7: (eq nat (S i1) (S i0))).(\lambda (H8: (eq A +(AHead a4 a0) (AHead a1 a2))).(\lambda (H9: (eq A a3 b)).((let H10 \def +(f_equal nat nat (\lambda (e: nat).(match e in nat return (\lambda (_: +nat).nat) with [O \Rightarrow i1 | (S n) \Rightarrow n])) (S i1) (S i0) H7) +in (eq_ind nat i0 (\lambda (n: nat).((eq A (AHead a4 a0) (AHead a1 a2)) \to +((eq A a3 b) \to ((aprem n a0 a3) \to (ex2_3 C T nat (\lambda (d: C).(\lambda +(_: T).(\lambda (j: nat).(drop (plus (S i0) j) O d c0)))) (\lambda (d: +C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b)))))))))) +(\lambda (H11: (eq A (AHead a4 a0) (AHead a1 a2))).(let H12 \def (f_equal A A +(\lambda (e: A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) +\Rightarrow a0 | (AHead _ a5) \Rightarrow a5])) (AHead a4 a0) (AHead a1 a2) +H11) in ((let H13 \def (f_equal A A (\lambda (e: A).(match e in A return +(\lambda (_: A).A) with [(ASort _ _) \Rightarrow a4 | (AHead a5 _) +\Rightarrow a5])) (AHead a4 a0) (AHead a1 a2) H11) in (eq_ind A a1 (\lambda +(_: A).((eq A a0 a2) \to ((eq A a3 b) \to ((aprem i0 a0 a3) \to (ex2_3 C T +nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus (S i0) j) O +d c0)))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 +(asucc g b)))))))))) (\lambda (H14: (eq A a0 a2)).(eq_ind A a2 (\lambda (a5: +A).((eq A a3 b) \to ((aprem i0 a5 a3) \to (ex2_3 C T nat (\lambda (d: +C).(\lambda (_: T).(\lambda (j: nat).(drop (plus (S i0) j) O d c0)))) +(\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g +b))))))))) (\lambda (H15: (eq A a3 b)).(eq_ind A b (\lambda (a5: A).((aprem +i0 a2 a5) \to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: +nat).(drop (plus (S i0) j) O d c0)))) (\lambda (d: C).(\lambda (u0: +T).(\lambda (_: nat).(arity g d u0 (asucc g b)))))))) (\lambda (H16: (aprem +i0 a2 b)).(let H_x \def (H3 i0 b H16) in (let H17 \def H_x in (ex2_3_ind C T +nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i0 j) O d +(CHead c0 (Bind Abst) u))))) (\lambda (d: C).(\lambda (u0: T).(\lambda (_: +nat).(arity g d u0 (asucc g b))))) (ex2_3 C T nat (\lambda (d: C).(\lambda +(_: T).(\lambda (j: nat).(drop (plus (S i0) j) O d c0)))) (\lambda (d: +C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b)))))) (\lambda +(x0: C).(\lambda (x1: T).(\lambda (x2: nat).(\lambda (H18: (drop (plus i0 x2) +O x0 (CHead c0 (Bind Abst) u))).(\lambda (H19: (arity g x0 x1 (asucc g +b))).(ex2_3_intro C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: +nat).(drop (plus (S i0) j) O d c0)))) (\lambda (d: C).(\lambda (u0: +T).(\lambda (_: nat).(arity g d u0 (asucc g b))))) x0 x1 x2 (drop_S Abst x0 +c0 u (plus i0 x2) H18) H19)))))) H17)))) a3 (sym_eq A a3 b H15))) a0 (sym_eq +A a0 a2 H14))) a4 (sym_eq A a4 a1 H13))) H12))) i1 (sym_eq nat i1 i0 H10))) +H8 H9 H6))))]) in (H6 (refl_equal nat (S i0)) (refl_equal A (AHead a1 a2)) +(refl_equal A b)))))) i H4))))))))))))) (\lambda (c0: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c0 u a1)).(\lambda (_: ((\forall +(i: nat).(\forall (b: A).((aprem i a1 b) \to (ex2_3 C T nat (\lambda (d: +C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d c0)))) (\lambda (d: +C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g +b))))))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity g c0 t0 +(AHead a1 a2))).(\lambda (H3: ((\forall (i: nat).(\forall (b: A).((aprem i +(AHead a1 a2) b) \to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda +(j: nat).(drop (plus i j) O d c0)))) (\lambda (d: C).(\lambda (u0: +T).(\lambda (_: nat).(arity g d u0 (asucc g b))))))))))).(\lambda (i: +nat).(\lambda (b: A).(\lambda (H4: (aprem i a2 b)).(let H5 \def (H3 (S i) b +(aprem_succ a2 b i H4 a1)) in (ex2_3_ind C T nat (\lambda (d: C).(\lambda (_: +T).(\lambda (j: nat).(drop (S (plus i j)) O d c0)))) (\lambda (d: C).(\lambda +(u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b))))) (ex2_3 C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d c0)))) +(\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g +b)))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: nat).(\lambda (H6: +(drop (S (plus i x2)) O x0 c0)).(\lambda (H7: (arity g x0 x1 (asucc g +b))).(C_ind (\lambda (c1: C).((drop (S (plus i x2)) O c1 c0) \to ((arity g c1 +x1 (asucc g b)) \to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda +(j: nat).(drop (plus i j) O d c0)))) (\lambda (d: C).(\lambda (u0: +T).(\lambda (_: nat).(arity g d u0 (asucc g b))))))))) (\lambda (n: +nat).(\lambda (H8: (drop (S (plus i x2)) O (CSort n) c0)).(\lambda (_: (arity +g (CSort n) x1 (asucc g b))).(and3_ind (eq C c0 (CSort n)) (eq nat (S (plus i +x2)) O) (eq nat O O) (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda +(j: nat).(drop (plus i j) O d c0)))) (\lambda (d: C).(\lambda (u0: +T).(\lambda (_: nat).(arity g d u0 (asucc g b)))))) (\lambda (_: (eq C c0 +(CSort n))).(\lambda (H11: (eq nat (S (plus i x2)) O)).(\lambda (_: (eq nat O +O)).(let H13 \def (eq_ind nat (S (plus i x2)) (\lambda (ee: nat).(match ee in +nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H11) in (False_ind (ex2_3 C T nat (\lambda (d: +C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d c0)))) (\lambda (d: +C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b)))))) H13))))) +(drop_gen_sort n (S (plus i x2)) O c0 H8))))) (\lambda (d: C).(\lambda (IHd: +(((drop (S (plus i x2)) O d c0) \to ((arity g d x1 (asucc g b)) \to (ex2_3 C +T nat (\lambda (d0: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O +d0 c0)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d0 u0 +(asucc g b)))))))))).(\lambda (k: K).(\lambda (t1: T).(\lambda (H8: (drop (S +(plus i x2)) O (CHead d k t1) c0)).(\lambda (H9: (arity g (CHead d k t1) x1 +(asucc g b))).(K_ind (\lambda (k0: K).((arity g (CHead d k0 t1) x1 (asucc g +b)) \to ((drop (r k0 (plus i x2)) O d c0) \to (ex2_3 C T nat (\lambda (d0: +C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d0 c0)))) (\lambda +(d0: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d0 u0 (asucc g b))))))))) +(\lambda (b0: B).(\lambda (H10: (arity g (CHead d (Bind b0) t1) x1 (asucc g +b))).(\lambda (H11: (drop (r (Bind b0) (plus i x2)) O d c0)).(ex2_3_intro C T +nat (\lambda (d0: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d0 +c0)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d0 u0 +(asucc g b))))) (CHead d (Bind b0) t1) x1 (S x2) (eq_ind nat (S (plus i x2)) +(\lambda (n: nat).(drop n O (CHead d (Bind b0) t1) c0)) (drop_drop (Bind b0) +(plus i x2) d c0 H11 t1) (plus i (S x2)) (plus_n_Sm i x2)) H10)))) (\lambda +(f: F).(\lambda (H10: (arity g (CHead d (Flat f) t1) x1 (asucc g +b))).(\lambda (H11: (drop (r (Flat f) (plus i x2)) O d c0)).(let H12 \def +(IHd H11 (arity_cimp_conf g (CHead d (Flat f) t1) x1 (asucc g b) H10 d +(cimp_flat_sx f d t1))) in (ex2_3_ind C T nat (\lambda (d0: C).(\lambda (_: +T).(\lambda (j: nat).(drop (plus i j) O d0 c0)))) (\lambda (d0: C).(\lambda +(u0: T).(\lambda (_: nat).(arity g d0 u0 (asucc g b))))) (ex2_3 C T nat +(\lambda (d0: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d0 +c0)))) (\lambda (d0: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d0 u0 +(asucc g b)))))) (\lambda (x3: C).(\lambda (x4: T).(\lambda (x5: +nat).(\lambda (H13: (drop (plus i x5) O x3 c0)).(\lambda (H14: (arity g x3 x4 +(asucc g b))).(ex2_3_intro C T nat (\lambda (d0: C).(\lambda (_: T).(\lambda +(j: nat).(drop (plus i j) O d0 c0)))) (\lambda (d0: C).(\lambda (u0: +T).(\lambda (_: nat).(arity g d0 u0 (asucc g b))))) x3 x4 x5 H13 H14)))))) +H12))))) k H9 (drop_gen_drop k d c0 t1 (plus i x2) H8)))))))) x0 H6 H7)))))) +H5)))))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda (a0: A).(\lambda +(_: (arity g c0 u (asucc g a0))).(\lambda (_: ((\forall (i: nat).(\forall (b: +A).((aprem i (asucc g a0) b) \to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: +T).(\lambda (j: nat).(drop (plus i j) O d c0)))) (\lambda (d: C).(\lambda +(u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b))))))))))).(\lambda (t0: +T).(\lambda (_: (arity g c0 t0 a0)).(\lambda (H3: ((\forall (i: nat).(\forall +(b: A).((aprem i a0 b) \to (ex2_3 C T nat (\lambda (d: C).(\lambda (_: +T).(\lambda (j: nat).(drop (plus i j) O d c0)))) (\lambda (d: C).(\lambda +(u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b))))))))))).(\lambda (i: +nat).(\lambda (b: A).(\lambda (H4: (aprem i a0 b)).(let H_x \def (H3 i b H4) +in (let H5 \def H_x in (ex2_3_ind C T nat (\lambda (d: C).(\lambda (_: +T).(\lambda (j: nat).(drop (plus i j) O d c0)))) (\lambda (d: C).(\lambda +(u0: T).(\lambda (_: nat).(arity g d u0 (asucc g b))))) (ex2_3 C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d c0)))) +(\lambda (d: C).(\lambda (u0: T).(\lambda (_: nat).(arity g d u0 (asucc g +b)))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: nat).(\lambda (H6: +(drop (plus i x2) O x0 c0)).(\lambda (H7: (arity g x0 x1 (asucc g +b))).(ex2_3_intro C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: +nat).(drop (plus i j) O d c0)))) (\lambda (d: C).(\lambda (u0: T).(\lambda +(_: nat).(arity g d u0 (asucc g b))))) x0 x1 x2 H6 H7)))))) H5)))))))))))))) +(\lambda (c0: C).(\lambda (t0: T).(\lambda (a1: A).(\lambda (_: (arity g c0 +t0 a1)).(\lambda (H1: ((\forall (i: nat).(\forall (b: A).((aprem i a1 b) \to +(ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus +i j) O d c0)))) (\lambda (d: C).(\lambda (u: T).(\lambda (_: nat).(arity g d +u (asucc g b))))))))))).(\lambda (a2: A).(\lambda (H2: (leq g a1 +a2)).(\lambda (i: nat).(\lambda (b: A).(\lambda (H3: (aprem i a2 b)).(let H_x +\def (aprem_repl g a1 a2 H2 i b H3) in (let H4 \def H_x in (ex2_ind A +(\lambda (b1: A).(leq g b1 b)) (\lambda (b1: A).(aprem i a1 b1)) (ex2_3 C T +nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d +c0)))) (\lambda (d: C).(\lambda (u: T).(\lambda (_: nat).(arity g d u (asucc +g b)))))) (\lambda (x: A).(\lambda (H5: (leq g x b)).(\lambda (H6: (aprem i +a1 x)).(let H_x0 \def (H1 i x H6) in (let H7 \def H_x0 in (ex2_3_ind C T nat +(\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop (plus i j) O d c0)))) +(\lambda (d: C).(\lambda (u: T).(\lambda (_: nat).(arity g d u (asucc g +x))))) (ex2_3 C T nat (\lambda (d: C).(\lambda (_: T).(\lambda (j: nat).(drop +(plus i j) O d c0)))) (\lambda (d: C).(\lambda (u: T).(\lambda (_: +nat).(arity g d u (asucc g b)))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda +(x2: nat).(\lambda (H8: (drop (plus i x2) O x0 c0)).(\lambda (H9: (arity g x0 +x1 (asucc g x))).(ex2_3_intro C T nat (\lambda (d: C).(\lambda (_: +T).(\lambda (j: nat).(drop (plus i j) O d c0)))) (\lambda (d: C).(\lambda (u: +T).(\lambda (_: nat).(arity g d u (asucc g b))))) x0 x1 x2 H8 (arity_repl g +x0 x1 (asucc g x) H9 (asucc g b) (asucc_repl g x b H5)))))))) H7)))))) +H4))))))))))))) c t a H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/cimp.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/cimp.ma new file mode 100644 index 000000000..2af721d15 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/cimp.ma @@ -0,0 +1,101 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/arity/cimp". + +include "arity/defs.ma". + +include "cimp/props.ma". + +theorem arity_cimp_conf: + \forall (g: G).(\forall (c1: C).(\forall (t: T).(\forall (a: A).((arity g c1 +t a) \to (\forall (c2: C).((cimp c1 c2) \to (arity g c2 t a))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c1 t a)).(arity_ind g (\lambda (c: C).(\lambda (t0: T).(\lambda (a0: +A).(\forall (c2: C).((cimp c c2) \to (arity g c2 t0 a0)))))) (\lambda (c: +C).(\lambda (n: nat).(\lambda (c2: C).(\lambda (_: (cimp c c2)).(arity_sort g +c2 n))))) (\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: +nat).(\lambda (H0: (getl i c (CHead d (Bind Abbr) u))).(\lambda (a0: +A).(\lambda (_: (arity g d u a0)).(\lambda (H2: ((\forall (c2: C).((cimp d +c2) \to (arity g c2 u a0))))).(\lambda (c2: C).(\lambda (H3: (cimp c +c2)).(let H_x \def (H3 Abbr d u i H0) in (let H4 \def H_x in (ex_ind C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u))) (arity g c2 (TLRef i) +a0) (\lambda (x: C).(\lambda (H5: (getl i c2 (CHead x (Bind Abbr) u))).(let +H_x0 \def (cimp_getl_conf c c2 H3 Abbr d u i H0) in (let H6 \def H_x0 in +(ex2_ind C (\lambda (d2: C).(cimp d d2)) (\lambda (d2: C).(getl i c2 (CHead +d2 (Bind Abbr) u))) (arity g c2 (TLRef i) a0) (\lambda (x0: C).(\lambda (H7: +(cimp d x0)).(\lambda (H8: (getl i c2 (CHead x0 (Bind Abbr) u))).(let H9 \def +(eq_ind C (CHead x (Bind Abbr) u) (\lambda (c0: C).(getl i c2 c0)) H5 (CHead +x0 (Bind Abbr) u) (getl_mono c2 (CHead x (Bind Abbr) u) i H5 (CHead x0 (Bind +Abbr) u) H8)) in (let H10 \def (f_equal C C (\lambda (e: C).(match e in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow x | (CHead c0 _ _) +\Rightarrow c0])) (CHead x (Bind Abbr) u) (CHead x0 (Bind Abbr) u) (getl_mono +c2 (CHead x (Bind Abbr) u) i H5 (CHead x0 (Bind Abbr) u) H8)) in (let H11 +\def (eq_ind_r C x0 (\lambda (c0: C).(getl i c2 (CHead c0 (Bind Abbr) u))) H9 +x H10) in (let H12 \def (eq_ind_r C x0 (\lambda (c0: C).(cimp d c0)) H7 x +H10) in (arity_abbr g c2 x u i H11 a0 (H2 x H12))))))))) H6))))) +H4))))))))))))) (\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: +nat).(\lambda (H0: (getl i c (CHead d (Bind Abst) u))).(\lambda (a0: +A).(\lambda (_: (arity g d u (asucc g a0))).(\lambda (H2: ((\forall (c2: +C).((cimp d c2) \to (arity g c2 u (asucc g a0)))))).(\lambda (c2: C).(\lambda +(H3: (cimp c c2)).(let H_x \def (H3 Abst d u i H0) in (let H4 \def H_x in +(ex_ind C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u))) (arity g c2 +(TLRef i) a0) (\lambda (x: C).(\lambda (H5: (getl i c2 (CHead x (Bind Abst) +u))).(let H_x0 \def (cimp_getl_conf c c2 H3 Abst d u i H0) in (let H6 \def +H_x0 in (ex2_ind C (\lambda (d2: C).(cimp d d2)) (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abst) u))) (arity g c2 (TLRef i) a0) (\lambda (x0: +C).(\lambda (H7: (cimp d x0)).(\lambda (H8: (getl i c2 (CHead x0 (Bind Abst) +u))).(let H9 \def (eq_ind C (CHead x (Bind Abst) u) (\lambda (c0: C).(getl i +c2 c0)) H5 (CHead x0 (Bind Abst) u) (getl_mono c2 (CHead x (Bind Abst) u) i +H5 (CHead x0 (Bind Abst) u) H8)) in (let H10 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow x | +(CHead c0 _ _) \Rightarrow c0])) (CHead x (Bind Abst) u) (CHead x0 (Bind +Abst) u) (getl_mono c2 (CHead x (Bind Abst) u) i H5 (CHead x0 (Bind Abst) u) +H8)) in (let H11 \def (eq_ind_r C x0 (\lambda (c0: C).(getl i c2 (CHead c0 +(Bind Abst) u))) H9 x H10) in (let H12 \def (eq_ind_r C x0 (\lambda (c0: +C).(cimp d c0)) H7 x H10) in (arity_abst g c2 x u i H11 a0 (H2 x H12))))))))) +H6))))) H4))))))))))))) (\lambda (b: B).(\lambda (H0: (not (eq B b +Abst))).(\lambda (c: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (_: (arity +g c u a1)).(\lambda (H2: ((\forall (c2: C).((cimp c c2) \to (arity g c2 u +a1))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c +(Bind b) u) t0 a2)).(\lambda (H4: ((\forall (c2: C).((cimp (CHead c (Bind b) +u) c2) \to (arity g c2 t0 a2))))).(\lambda (c2: C).(\lambda (H5: (cimp c +c2)).(arity_bind g b H0 c2 u a1 (H2 c2 H5) t0 a2 (H4 (CHead c2 (Bind b) u) +(cimp_bind c c2 H5 b u)))))))))))))))) (\lambda (c: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c u (asucc g a1))).(\lambda (H1: +((\forall (c2: C).((cimp c c2) \to (arity g c2 u (asucc g a1)))))).(\lambda +(t0: T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c (Bind Abst) u) t0 +a2)).(\lambda (H3: ((\forall (c2: C).((cimp (CHead c (Bind Abst) u) c2) \to +(arity g c2 t0 a2))))).(\lambda (c2: C).(\lambda (H4: (cimp c +c2)).(arity_head g c2 u a1 (H1 c2 H4) t0 a2 (H3 (CHead c2 (Bind Abst) u) +(cimp_bind c c2 H4 Abst u)))))))))))))) (\lambda (c: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c u a1)).(\lambda (H1: ((\forall +(c2: C).((cimp c c2) \to (arity g c2 u a1))))).(\lambda (t0: T).(\lambda (a2: +A).(\lambda (_: (arity g c t0 (AHead a1 a2))).(\lambda (H3: ((\forall (c2: +C).((cimp c c2) \to (arity g c2 t0 (AHead a1 a2)))))).(\lambda (c2: +C).(\lambda (H4: (cimp c c2)).(arity_appl g c2 u a1 (H1 c2 H4) t0 a2 (H3 c2 +H4))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (a0: A).(\lambda (_: +(arity g c u (asucc g a0))).(\lambda (H1: ((\forall (c2: C).((cimp c c2) \to +(arity g c2 u (asucc g a0)))))).(\lambda (t0: T).(\lambda (_: (arity g c t0 +a0)).(\lambda (H3: ((\forall (c2: C).((cimp c c2) \to (arity g c2 t0 +a0))))).(\lambda (c2: C).(\lambda (H4: (cimp c c2)).(arity_cast g c2 u a0 (H1 +c2 H4) t0 (H3 c2 H4)))))))))))) (\lambda (c: C).(\lambda (t0: T).(\lambda +(a1: A).(\lambda (_: (arity g c t0 a1)).(\lambda (H1: ((\forall (c2: +C).((cimp c c2) \to (arity g c2 t0 a1))))).(\lambda (a2: A).(\lambda (H2: +(leq g a1 a2)).(\lambda (c2: C).(\lambda (H3: (cimp c c2)).(arity_repl g c2 +t0 a1 (H1 c2 H3) a2 H2)))))))))) c1 t a H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/defs.ma new file mode 100644 index 000000000..410400d5f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/defs.ma @@ -0,0 +1,47 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/arity/defs". + +include "leq/defs.ma". + +include "getl/defs.ma". + +inductive arity (g: G): C \to (T \to (A \to Prop)) \def +| arity_sort: \forall (c: C).(\forall (n: nat).(arity g c (TSort n) (ASort O +n))) +| arity_abbr: \forall (c: C).(\forall (d: C).(\forall (u: T).(\forall (i: +nat).((getl i c (CHead d (Bind Abbr) u)) \to (\forall (a: A).((arity g d u a) +\to (arity g c (TLRef i) a))))))) +| arity_abst: \forall (c: C).(\forall (d: C).(\forall (u: T).(\forall (i: +nat).((getl i c (CHead d (Bind Abst) u)) \to (\forall (a: A).((arity g d u +(asucc g a)) \to (arity g c (TLRef i) a))))))) +| arity_bind: \forall (b: B).((not (eq B b Abst)) \to (\forall (c: +C).(\forall (u: T).(\forall (a1: A).((arity g c u a1) \to (\forall (t: +T).(\forall (a2: A).((arity g (CHead c (Bind b) u) t a2) \to (arity g c +(THead (Bind b) u t) a2))))))))) +| arity_head: \forall (c: C).(\forall (u: T).(\forall (a1: A).((arity g c u +(asucc g a1)) \to (\forall (t: T).(\forall (a2: A).((arity g (CHead c (Bind +Abst) u) t a2) \to (arity g c (THead (Bind Abst) u t) (AHead a1 a2)))))))) +| arity_appl: \forall (c: C).(\forall (u: T).(\forall (a1: A).((arity g c u +a1) \to (\forall (t: T).(\forall (a2: A).((arity g c t (AHead a1 a2)) \to +(arity g c (THead (Flat Appl) u t) a2))))))) +| arity_cast: \forall (c: C).(\forall (u: T).(\forall (a: A).((arity g c u +(asucc g a)) \to (\forall (t: T).((arity g c t a) \to (arity g c (THead (Flat +Cast) u t) a)))))) +| arity_repl: \forall (c: C).(\forall (t: T).(\forall (a1: A).((arity g c t +a1) \to (\forall (a2: A).((leq g a1 a2) \to (arity g c t a2)))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/fwd.ma new file mode 100644 index 000000000..fbdcd3848 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/fwd.ma @@ -0,0 +1,1140 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/arity/fwd". + +include "arity/defs.ma". + +include "leq/asucc.ma". + +include "leq/fwd.ma". + +include "getl/drop.ma". + +theorem arity_gen_sort: + \forall (g: G).(\forall (c: C).(\forall (n: nat).(\forall (a: A).((arity g c +(TSort n) a) \to (leq g a (ASort O n)))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (n: nat).(\lambda (a: A).(\lambda +(H: (arity g c (TSort n) a)).(insert_eq T (TSort n) (\lambda (t: T).(arity g +c t a)) (leq g a (ASort O n)) (\lambda (y: T).(\lambda (H0: (arity g c y +a)).(arity_ind g (\lambda (_: C).(\lambda (t: T).(\lambda (a0: A).((eq T t +(TSort n)) \to (leq g a0 (ASort O n)))))) (\lambda (_: C).(\lambda (n0: +nat).(\lambda (H1: (eq T (TSort n0) (TSort n))).(let H2 \def (f_equal T nat +(\lambda (e: T).(match e in T return (\lambda (_: T).nat) with [(TSort n1) +\Rightarrow n1 | (TLRef _) \Rightarrow n0 | (THead _ _ _) \Rightarrow n0])) +(TSort n0) (TSort n) H1) in (eq_ind_r nat n (\lambda (n1: nat).(leq g (ASort +O n1) (ASort O n))) (leq_refl g (ASort O n)) n0 H2))))) (\lambda (c0: +C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (_: (getl i c0 +(CHead d (Bind Abbr) u))).(\lambda (a0: A).(\lambda (_: (arity g d u +a0)).(\lambda (_: (((eq T u (TSort n)) \to (leq g a0 (ASort O n))))).(\lambda +(H4: (eq T (TLRef i) (TSort n))).(let H5 \def (eq_ind T (TLRef i) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow +False])) I (TSort n) H4) in (False_ind (leq g a0 (ASort O n)) H5))))))))))) +(\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(_: (getl i c0 (CHead d (Bind Abst) u))).(\lambda (a0: A).(\lambda (_: (arity +g d u (asucc g a0))).(\lambda (_: (((eq T u (TSort n)) \to (leq g (asucc g +a0) (ASort O n))))).(\lambda (H4: (eq T (TLRef i) (TSort n))).(let H5 \def +(eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (TSort n) H4) in (False_ind (leq g a0 +(ASort O n)) H5))))))))))) (\lambda (b: B).(\lambda (_: (not (eq B b +Abst))).(\lambda (c0: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (_: (arity +g c0 u a1)).(\lambda (_: (((eq T u (TSort n)) \to (leq g a1 (ASort O +n))))).(\lambda (t: T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c0 (Bind +b) u) t a2)).(\lambda (_: (((eq T t (TSort n)) \to (leq g a2 (ASort O +n))))).(\lambda (H6: (eq T (THead (Bind b) u t) (TSort n))).(let H7 \def +(eq_ind T (THead (Bind b) u t) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n) H6) in +(False_ind (leq g a2 (ASort O n)) H7)))))))))))))) (\lambda (c0: C).(\lambda +(u: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u (asucc g a1))).(\lambda +(_: (((eq T u (TSort n)) \to (leq g (asucc g a1) (ASort O n))))).(\lambda (t: +T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c0 (Bind Abst) u) t +a2)).(\lambda (_: (((eq T t (TSort n)) \to (leq g a2 (ASort O n))))).(\lambda +(H5: (eq T (THead (Bind Abst) u t) (TSort n))).(let H6 \def (eq_ind T (THead +(Bind Abst) u t) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ +_) \Rightarrow True])) I (TSort n) H5) in (False_ind (leq g (AHead a1 a2) +(ASort O n)) H6)))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda (a1: +A).(\lambda (_: (arity g c0 u a1)).(\lambda (_: (((eq T u (TSort n)) \to (leq +g a1 (ASort O n))))).(\lambda (t: T).(\lambda (a2: A).(\lambda (_: (arity g +c0 t (AHead a1 a2))).(\lambda (_: (((eq T t (TSort n)) \to (leq g (AHead a1 +a2) (ASort O n))))).(\lambda (H5: (eq T (THead (Flat Appl) u t) (TSort +n))).(let H6 \def (eq_ind T (THead (Flat Appl) u t) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n) +H5) in (False_ind (leq g a2 (ASort O n)) H6)))))))))))) (\lambda (c0: +C).(\lambda (u: T).(\lambda (a0: A).(\lambda (_: (arity g c0 u (asucc g +a0))).(\lambda (_: (((eq T u (TSort n)) \to (leq g (asucc g a0) (ASort O +n))))).(\lambda (t: T).(\lambda (_: (arity g c0 t a0)).(\lambda (_: (((eq T t +(TSort n)) \to (leq g a0 (ASort O n))))).(\lambda (H5: (eq T (THead (Flat +Cast) u t) (TSort n))).(let H6 \def (eq_ind T (THead (Flat Cast) u t) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +True])) I (TSort n) H5) in (False_ind (leq g a0 (ASort O n)) H6))))))))))) +(\lambda (c0: C).(\lambda (t: T).(\lambda (a1: A).(\lambda (H1: (arity g c0 t +a1)).(\lambda (H2: (((eq T t (TSort n)) \to (leq g a1 (ASort O +n))))).(\lambda (a2: A).(\lambda (H3: (leq g a1 a2)).(\lambda (H4: (eq T t +(TSort n))).(let H5 \def (f_equal T T (\lambda (e: T).e) t (TSort n) H4) in +(let H6 \def (eq_ind T t (\lambda (t0: T).((eq T t0 (TSort n)) \to (leq g a1 +(ASort O n)))) H2 (TSort n) H5) in (let H7 \def (eq_ind T t (\lambda (t0: +T).(arity g c0 t0 a1)) H1 (TSort n) H5) in (leq_trans g a2 a1 (leq_sym g a1 +a2 H3) (ASort O n) (H6 (refl_equal T (TSort n))))))))))))))) c y a H0))) +H))))). + +theorem arity_gen_lref: + \forall (g: G).(\forall (c: C).(\forall (i: nat).(\forall (a: A).((arity g c +(TLRef i) a) \to (or (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c +(CHead d (Bind Abbr) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u a)))) +(ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c (CHead d (Bind Abst) +u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u (asucc g a)))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (i: nat).(\lambda (a: A).(\lambda +(H: (arity g c (TLRef i) a)).(insert_eq T (TLRef i) (\lambda (t: T).(arity g +c t a)) (or (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c (CHead d +(Bind Abbr) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u a)))) (ex2_2 C +T (\lambda (d: C).(\lambda (u: T).(getl i c (CHead d (Bind Abst) u)))) +(\lambda (d: C).(\lambda (u: T).(arity g d u (asucc g a)))))) (\lambda (y: +T).(\lambda (H0: (arity g c y a)).(arity_ind g (\lambda (c0: C).(\lambda (t: +T).(\lambda (a0: A).((eq T t (TLRef i)) \to (or (ex2_2 C T (\lambda (d: +C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abbr) u)))) (\lambda (d: +C).(\lambda (u: T).(arity g d u a0)))) (ex2_2 C T (\lambda (d: C).(\lambda +(u: T).(getl i c0 (CHead d (Bind Abst) u)))) (\lambda (d: C).(\lambda (u: +T).(arity g d u (asucc g a0)))))))))) (\lambda (c0: C).(\lambda (n: +nat).(\lambda (H1: (eq T (TSort n) (TLRef i))).(let H2 \def (eq_ind T (TSort +n) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +False])) I (TLRef i) H1) in (False_ind (or (ex2_2 C T (\lambda (d: +C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abbr) u)))) (\lambda (d: +C).(\lambda (u: T).(arity g d u (ASort O n))))) (ex2_2 C T (\lambda (d: +C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abst) u)))) (\lambda (d: +C).(\lambda (u: T).(arity g d u (asucc g (ASort O n))))))) H2))))) (\lambda +(c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i0: nat).(\lambda (H1: +(getl i0 c0 (CHead d (Bind Abbr) u))).(\lambda (a0: A).(\lambda (H2: (arity g +d u a0)).(\lambda (_: (((eq T u (TLRef i)) \to (or (ex2_2 C T (\lambda (d0: +C).(\lambda (u0: T).(getl i d (CHead d0 (Bind Abbr) u0)))) (\lambda (d0: +C).(\lambda (u0: T).(arity g d0 u0 a0)))) (ex2_2 C T (\lambda (d0: +C).(\lambda (u0: T).(getl i d (CHead d0 (Bind Abst) u0)))) (\lambda (d0: +C).(\lambda (u0: T).(arity g d0 u0 (asucc g a0))))))))).(\lambda (H4: (eq T +(TLRef i0) (TLRef i))).(let H5 \def (f_equal T nat (\lambda (e: T).(match e +in T return (\lambda (_: T).nat) with [(TSort _) \Rightarrow i0 | (TLRef n) +\Rightarrow n | (THead _ _ _) \Rightarrow i0])) (TLRef i0) (TLRef i) H4) in +(let H6 \def (eq_ind nat i0 (\lambda (n: nat).(getl n c0 (CHead d (Bind Abbr) +u))) H1 i H5) in (or_introl (ex2_2 C T (\lambda (d0: C).(\lambda (u0: +T).(getl i c0 (CHead d0 (Bind Abbr) u0)))) (\lambda (d0: C).(\lambda (u0: +T).(arity g d0 u0 a0)))) (ex2_2 C T (\lambda (d0: C).(\lambda (u0: T).(getl i +c0 (CHead d0 (Bind Abst) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g d0 +u0 (asucc g a0))))) (ex2_2_intro C T (\lambda (d0: C).(\lambda (u0: T).(getl +i c0 (CHead d0 (Bind Abbr) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g +d0 u0 a0))) d u H6 H2))))))))))))) (\lambda (c0: C).(\lambda (d: C).(\lambda +(u: T).(\lambda (i0: nat).(\lambda (H1: (getl i0 c0 (CHead d (Bind Abst) +u))).(\lambda (a0: A).(\lambda (H2: (arity g d u (asucc g a0))).(\lambda (_: +(((eq T u (TLRef i)) \to (or (ex2_2 C T (\lambda (d0: C).(\lambda (u0: +T).(getl i d (CHead d0 (Bind Abbr) u0)))) (\lambda (d0: C).(\lambda (u0: +T).(arity g d0 u0 (asucc g a0))))) (ex2_2 C T (\lambda (d0: C).(\lambda (u0: +T).(getl i d (CHead d0 (Bind Abst) u0)))) (\lambda (d0: C).(\lambda (u0: +T).(arity g d0 u0 (asucc g (asucc g a0)))))))))).(\lambda (H4: (eq T (TLRef +i0) (TLRef i))).(let H5 \def (f_equal T nat (\lambda (e: T).(match e in T +return (\lambda (_: T).nat) with [(TSort _) \Rightarrow i0 | (TLRef n) +\Rightarrow n | (THead _ _ _) \Rightarrow i0])) (TLRef i0) (TLRef i) H4) in +(let H6 \def (eq_ind nat i0 (\lambda (n: nat).(getl n c0 (CHead d (Bind Abst) +u))) H1 i H5) in (or_intror (ex2_2 C T (\lambda (d0: C).(\lambda (u0: +T).(getl i c0 (CHead d0 (Bind Abbr) u0)))) (\lambda (d0: C).(\lambda (u0: +T).(arity g d0 u0 a0)))) (ex2_2 C T (\lambda (d0: C).(\lambda (u0: T).(getl i +c0 (CHead d0 (Bind Abst) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g d0 +u0 (asucc g a0))))) (ex2_2_intro C T (\lambda (d0: C).(\lambda (u0: T).(getl +i c0 (CHead d0 (Bind Abst) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g +d0 u0 (asucc g a0)))) d u H6 H2))))))))))))) (\lambda (b: B).(\lambda (_: +(not (eq B b Abst))).(\lambda (c0: C).(\lambda (u: T).(\lambda (a1: +A).(\lambda (_: (arity g c0 u a1)).(\lambda (_: (((eq T u (TLRef i)) \to (or +(ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i c0 (CHead d (Bind Abbr) +u0)))) (\lambda (d: C).(\lambda (u0: T).(arity g d u0 a1)))) (ex2_2 C T +(\lambda (d: C).(\lambda (u0: T).(getl i c0 (CHead d (Bind Abst) u0)))) +(\lambda (d: C).(\lambda (u0: T).(arity g d u0 (asucc g a1))))))))).(\lambda +(t: T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c0 (Bind b) u) t +a2)).(\lambda (_: (((eq T t (TLRef i)) \to (or (ex2_2 C T (\lambda (d: +C).(\lambda (u0: T).(getl i (CHead c0 (Bind b) u) (CHead d (Bind Abbr) u0)))) +(\lambda (d: C).(\lambda (u0: T).(arity g d u0 a2)))) (ex2_2 C T (\lambda (d: +C).(\lambda (u0: T).(getl i (CHead c0 (Bind b) u) (CHead d (Bind Abst) u0)))) +(\lambda (d: C).(\lambda (u0: T).(arity g d u0 (asucc g a2))))))))).(\lambda +(H6: (eq T (THead (Bind b) u t) (TLRef i))).(let H7 \def (eq_ind T (THead +(Bind b) u t) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ +_) \Rightarrow True])) I (TLRef i) H6) in (False_ind (or (ex2_2 C T (\lambda +(d: C).(\lambda (u0: T).(getl i c0 (CHead d (Bind Abbr) u0)))) (\lambda (d: +C).(\lambda (u0: T).(arity g d u0 a2)))) (ex2_2 C T (\lambda (d: C).(\lambda +(u0: T).(getl i c0 (CHead d (Bind Abst) u0)))) (\lambda (d: C).(\lambda (u0: +T).(arity g d u0 (asucc g a2)))))) H7)))))))))))))) (\lambda (c0: C).(\lambda +(u: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u (asucc g a1))).(\lambda +(_: (((eq T u (TLRef i)) \to (or (ex2_2 C T (\lambda (d: C).(\lambda (u0: +T).(getl i c0 (CHead d (Bind Abbr) u0)))) (\lambda (d: C).(\lambda (u0: +T).(arity g d u0 (asucc g a1))))) (ex2_2 C T (\lambda (d: C).(\lambda (u0: +T).(getl i c0 (CHead d (Bind Abst) u0)))) (\lambda (d: C).(\lambda (u0: +T).(arity g d u0 (asucc g (asucc g a1)))))))))).(\lambda (t: T).(\lambda (a2: +A).(\lambda (_: (arity g (CHead c0 (Bind Abst) u) t a2)).(\lambda (_: (((eq T +t (TLRef i)) \to (or (ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i +(CHead c0 (Bind Abst) u) (CHead d (Bind Abbr) u0)))) (\lambda (d: C).(\lambda +(u0: T).(arity g d u0 a2)))) (ex2_2 C T (\lambda (d: C).(\lambda (u0: +T).(getl i (CHead c0 (Bind Abst) u) (CHead d (Bind Abst) u0)))) (\lambda (d: +C).(\lambda (u0: T).(arity g d u0 (asucc g a2))))))))).(\lambda (H5: (eq T +(THead (Bind Abst) u t) (TLRef i))).(let H6 \def (eq_ind T (THead (Bind Abst) +u t) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TLRef i) H5) in (False_ind (or (ex2_2 C T (\lambda (d: +C).(\lambda (u0: T).(getl i c0 (CHead d (Bind Abbr) u0)))) (\lambda (d: +C).(\lambda (u0: T).(arity g d u0 (AHead a1 a2))))) (ex2_2 C T (\lambda (d: +C).(\lambda (u0: T).(getl i c0 (CHead d (Bind Abst) u0)))) (\lambda (d: +C).(\lambda (u0: T).(arity g d u0 (asucc g (AHead a1 a2))))))) H6)))))))))))) +(\lambda (c0: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u +a1)).(\lambda (_: (((eq T u (TLRef i)) \to (or (ex2_2 C T (\lambda (d: +C).(\lambda (u0: T).(getl i c0 (CHead d (Bind Abbr) u0)))) (\lambda (d: +C).(\lambda (u0: T).(arity g d u0 a1)))) (ex2_2 C T (\lambda (d: C).(\lambda +(u0: T).(getl i c0 (CHead d (Bind Abst) u0)))) (\lambda (d: C).(\lambda (u0: +T).(arity g d u0 (asucc g a1))))))))).(\lambda (t: T).(\lambda (a2: +A).(\lambda (_: (arity g c0 t (AHead a1 a2))).(\lambda (_: (((eq T t (TLRef +i)) \to (or (ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i c0 (CHead d +(Bind Abbr) u0)))) (\lambda (d: C).(\lambda (u0: T).(arity g d u0 (AHead a1 +a2))))) (ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i c0 (CHead d (Bind +Abst) u0)))) (\lambda (d: C).(\lambda (u0: T).(arity g d u0 (asucc g (AHead +a1 a2)))))))))).(\lambda (H5: (eq T (THead (Flat Appl) u t) (TLRef i))).(let +H6 \def (eq_ind T (THead (Flat Appl) u t) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef i) H5) in +(False_ind (or (ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i c0 (CHead +d (Bind Abbr) u0)))) (\lambda (d: C).(\lambda (u0: T).(arity g d u0 a2)))) +(ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i c0 (CHead d (Bind Abst) +u0)))) (\lambda (d: C).(\lambda (u0: T).(arity g d u0 (asucc g a2)))))) +H6)))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda (a0: A).(\lambda (_: +(arity g c0 u (asucc g a0))).(\lambda (_: (((eq T u (TLRef i)) \to (or (ex2_2 +C T (\lambda (d: C).(\lambda (u0: T).(getl i c0 (CHead d (Bind Abbr) u0)))) +(\lambda (d: C).(\lambda (u0: T).(arity g d u0 (asucc g a0))))) (ex2_2 C T +(\lambda (d: C).(\lambda (u0: T).(getl i c0 (CHead d (Bind Abst) u0)))) +(\lambda (d: C).(\lambda (u0: T).(arity g d u0 (asucc g (asucc g +a0)))))))))).(\lambda (t: T).(\lambda (_: (arity g c0 t a0)).(\lambda (_: +(((eq T t (TLRef i)) \to (or (ex2_2 C T (\lambda (d: C).(\lambda (u0: +T).(getl i c0 (CHead d (Bind Abbr) u0)))) (\lambda (d: C).(\lambda (u0: +T).(arity g d u0 a0)))) (ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i +c0 (CHead d (Bind Abst) u0)))) (\lambda (d: C).(\lambda (u0: T).(arity g d u0 +(asucc g a0))))))))).(\lambda (H5: (eq T (THead (Flat Cast) u t) (TLRef +i))).(let H6 \def (eq_ind T (THead (Flat Cast) u t) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef i) +H5) in (False_ind (or (ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i c0 +(CHead d (Bind Abbr) u0)))) (\lambda (d: C).(\lambda (u0: T).(arity g d u0 +a0)))) (ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i c0 (CHead d (Bind +Abst) u0)))) (\lambda (d: C).(\lambda (u0: T).(arity g d u0 (asucc g a0)))))) +H6))))))))))) (\lambda (c0: C).(\lambda (t: T).(\lambda (a1: A).(\lambda (H1: +(arity g c0 t a1)).(\lambda (H2: (((eq T t (TLRef i)) \to (or (ex2_2 C T +(\lambda (d: C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abbr) u)))) +(\lambda (d: C).(\lambda (u: T).(arity g d u a1)))) (ex2_2 C T (\lambda (d: +C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abst) u)))) (\lambda (d: +C).(\lambda (u: T).(arity g d u (asucc g a1))))))))).(\lambda (a2: +A).(\lambda (H3: (leq g a1 a2)).(\lambda (H4: (eq T t (TLRef i))).(let H5 +\def (f_equal T T (\lambda (e: T).e) t (TLRef i) H4) in (let H6 \def (eq_ind +T t (\lambda (t0: T).((eq T t0 (TLRef i)) \to (or (ex2_2 C T (\lambda (d: +C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abbr) u)))) (\lambda (d: +C).(\lambda (u: T).(arity g d u a1)))) (ex2_2 C T (\lambda (d: C).(\lambda +(u: T).(getl i c0 (CHead d (Bind Abst) u)))) (\lambda (d: C).(\lambda (u: +T).(arity g d u (asucc g a1)))))))) H2 (TLRef i) H5) in (let H7 \def (eq_ind +T t (\lambda (t0: T).(arity g c0 t0 a1)) H1 (TLRef i) H5) in (let H8 \def (H6 +(refl_equal T (TLRef i))) in (or_ind (ex2_2 C T (\lambda (d: C).(\lambda (u: +T).(getl i c0 (CHead d (Bind Abbr) u)))) (\lambda (d: C).(\lambda (u: +T).(arity g d u a1)))) (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c0 +(CHead d (Bind Abst) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u +(asucc g a1))))) (or (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c0 +(CHead d (Bind Abbr) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u +a2)))) (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c0 (CHead d (Bind +Abst) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u (asucc g a2)))))) +(\lambda (H9: (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c0 (CHead d +(Bind Abbr) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u +a1))))).(ex2_2_ind C T (\lambda (d: C).(\lambda (u: T).(getl i c0 (CHead d +(Bind Abbr) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u a1))) (or +(ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abbr) +u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u a2)))) (ex2_2 C T (\lambda +(d: C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abst) u)))) (\lambda (d: +C).(\lambda (u: T).(arity g d u (asucc g a2)))))) (\lambda (x0: C).(\lambda +(x1: T).(\lambda (H10: (getl i c0 (CHead x0 (Bind Abbr) x1))).(\lambda (H11: +(arity g x0 x1 a1)).(or_introl (ex2_2 C T (\lambda (d: C).(\lambda (u: +T).(getl i c0 (CHead d (Bind Abbr) u)))) (\lambda (d: C).(\lambda (u: +T).(arity g d u a2)))) (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c0 +(CHead d (Bind Abst) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u +(asucc g a2))))) (ex2_2_intro C T (\lambda (d: C).(\lambda (u: T).(getl i c0 +(CHead d (Bind Abbr) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u a2))) +x0 x1 H10 (arity_repl g x0 x1 a1 H11 a2 H3))))))) H9)) (\lambda (H9: (ex2_2 C +T (\lambda (d: C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abst) u)))) +(\lambda (d: C).(\lambda (u: T).(arity g d u (asucc g a1)))))).(ex2_2_ind C T +(\lambda (d: C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abst) u)))) +(\lambda (d: C).(\lambda (u: T).(arity g d u (asucc g a1)))) (or (ex2_2 C T +(\lambda (d: C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abbr) u)))) +(\lambda (d: C).(\lambda (u: T).(arity g d u a2)))) (ex2_2 C T (\lambda (d: +C).(\lambda (u: T).(getl i c0 (CHead d (Bind Abst) u)))) (\lambda (d: +C).(\lambda (u: T).(arity g d u (asucc g a2)))))) (\lambda (x0: C).(\lambda +(x1: T).(\lambda (H10: (getl i c0 (CHead x0 (Bind Abst) x1))).(\lambda (H11: +(arity g x0 x1 (asucc g a1))).(or_intror (ex2_2 C T (\lambda (d: C).(\lambda +(u: T).(getl i c0 (CHead d (Bind Abbr) u)))) (\lambda (d: C).(\lambda (u: +T).(arity g d u a2)))) (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i c0 +(CHead d (Bind Abst) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u +(asucc g a2))))) (ex2_2_intro C T (\lambda (d: C).(\lambda (u: T).(getl i c0 +(CHead d (Bind Abst) u)))) (\lambda (d: C).(\lambda (u: T).(arity g d u +(asucc g a2)))) x0 x1 H10 (arity_repl g x0 x1 (asucc g a1) H11 (asucc g a2) +(asucc_repl g a1 a2 H3)))))))) H9)) H8))))))))))))) c y a H0))) H))))). + +theorem arity_gen_bind: + \forall (b: B).((not (eq B b Abst)) \to (\forall (g: G).(\forall (c: +C).(\forall (u: T).(\forall (t: T).(\forall (a2: A).((arity g c (THead (Bind +b) u t) a2) \to (ex2 A (\lambda (a1: A).(arity g c u a1)) (\lambda (_: +A).(arity g (CHead c (Bind b) u) t a2)))))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda (g: G).(\lambda +(c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (a2: A).(\lambda (H0: (arity +g c (THead (Bind b) u t) a2)).(insert_eq T (THead (Bind b) u t) (\lambda (t0: +T).(arity g c t0 a2)) (ex2 A (\lambda (a1: A).(arity g c u a1)) (\lambda (_: +A).(arity g (CHead c (Bind b) u) t a2))) (\lambda (y: T).(\lambda (H1: (arity +g c y a2)).(arity_ind g (\lambda (c0: C).(\lambda (t0: T).(\lambda (a: +A).((eq T t0 (THead (Bind b) u t)) \to (ex2 A (\lambda (a1: A).(arity g c0 u +a1)) (\lambda (_: A).(arity g (CHead c0 (Bind b) u) t a))))))) (\lambda (c0: +C).(\lambda (n: nat).(\lambda (H2: (eq T (TSort n) (THead (Bind b) u +t))).(let H3 \def (eq_ind T (TSort n) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow False])) I (THead (Bind b) u t) +H2) in (False_ind (ex2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (_: +A).(arity g (CHead c0 (Bind b) u) t (ASort O n)))) H3))))) (\lambda (c0: +C).(\lambda (d: C).(\lambda (u0: T).(\lambda (i: nat).(\lambda (_: (getl i c0 +(CHead d (Bind Abbr) u0))).(\lambda (a: A).(\lambda (_: (arity g d u0 +a)).(\lambda (_: (((eq T u0 (THead (Bind b) u t)) \to (ex2 A (\lambda (a1: +A).(arity g d u a1)) (\lambda (_: A).(arity g (CHead d (Bind b) u) t +a)))))).(\lambda (H5: (eq T (TLRef i) (THead (Bind b) u t))).(let H6 \def +(eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead (Bind b) u t) H5) in (False_ind +(ex2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (_: A).(arity g (CHead c0 +(Bind b) u) t a))) H6))))))))))) (\lambda (c0: C).(\lambda (d: C).(\lambda +(u0: T).(\lambda (i: nat).(\lambda (_: (getl i c0 (CHead d (Bind Abst) +u0))).(\lambda (a: A).(\lambda (_: (arity g d u0 (asucc g a))).(\lambda (_: +(((eq T u0 (THead (Bind b) u t)) \to (ex2 A (\lambda (a1: A).(arity g d u +a1)) (\lambda (_: A).(arity g (CHead d (Bind b) u) t (asucc g +a))))))).(\lambda (H5: (eq T (TLRef i) (THead (Bind b) u t))).(let H6 \def +(eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead (Bind b) u t) H5) in (False_ind +(ex2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (_: A).(arity g (CHead c0 +(Bind b) u) t a))) H6))))))))))) (\lambda (b0: B).(\lambda (H2: (not (eq B b0 +Abst))).(\lambda (c0: C).(\lambda (u0: T).(\lambda (a1: A).(\lambda (H3: +(arity g c0 u0 a1)).(\lambda (H4: (((eq T u0 (THead (Bind b) u t)) \to (ex2 A +(\lambda (a3: A).(arity g c0 u a3)) (\lambda (_: A).(arity g (CHead c0 (Bind +b) u) t a1)))))).(\lambda (t0: T).(\lambda (a0: A).(\lambda (H5: (arity g +(CHead c0 (Bind b0) u0) t0 a0)).(\lambda (H6: (((eq T t0 (THead (Bind b) u +t)) \to (ex2 A (\lambda (a3: A).(arity g (CHead c0 (Bind b0) u0) u a3)) +(\lambda (_: A).(arity g (CHead (CHead c0 (Bind b0) u0) (Bind b) u) t +a0)))))).(\lambda (H7: (eq T (THead (Bind b0) u0 t0) (THead (Bind b) u +t))).(let H8 \def (f_equal T B (\lambda (e: T).(match e in T return (\lambda +(_: T).B) with [(TSort _) \Rightarrow b0 | (TLRef _) \Rightarrow b0 | (THead +k _ _) \Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b1) +\Rightarrow b1 | (Flat _) \Rightarrow b0])])) (THead (Bind b0) u0 t0) (THead +(Bind b) u t) H7) in ((let H9 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) +\Rightarrow u0 | (THead _ t1 _) \Rightarrow t1])) (THead (Bind b0) u0 t0) +(THead (Bind b) u t) H7) in ((let H10 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | +(TLRef _) \Rightarrow t0 | (THead _ _ t1) \Rightarrow t1])) (THead (Bind b0) +u0 t0) (THead (Bind b) u t) H7) in (\lambda (H11: (eq T u0 u)).(\lambda (H12: +(eq B b0 b)).(let H13 \def (eq_ind T t0 (\lambda (t1: T).((eq T t1 (THead +(Bind b) u t)) \to (ex2 A (\lambda (a3: A).(arity g (CHead c0 (Bind b0) u0) u +a3)) (\lambda (_: A).(arity g (CHead (CHead c0 (Bind b0) u0) (Bind b) u) t +a0))))) H6 t H10) in (let H14 \def (eq_ind T t0 (\lambda (t1: T).(arity g +(CHead c0 (Bind b0) u0) t1 a0)) H5 t H10) in (let H15 \def (eq_ind T u0 +(\lambda (t1: T).((eq T t (THead (Bind b) u t)) \to (ex2 A (\lambda (a3: +A).(arity g (CHead c0 (Bind b0) t1) u a3)) (\lambda (_: A).(arity g (CHead +(CHead c0 (Bind b0) t1) (Bind b) u) t a0))))) H13 u H11) in (let H16 \def +(eq_ind T u0 (\lambda (t1: T).(arity g (CHead c0 (Bind b0) t1) t a0)) H14 u +H11) in (let H17 \def (eq_ind T u0 (\lambda (t1: T).((eq T t1 (THead (Bind b) +u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u a3)) (\lambda (_: A).(arity g +(CHead c0 (Bind b) u) t a1))))) H4 u H11) in (let H18 \def (eq_ind T u0 +(\lambda (t1: T).(arity g c0 t1 a1)) H3 u H11) in (let H19 \def (eq_ind B b0 +(\lambda (b1: B).((eq T t (THead (Bind b) u t)) \to (ex2 A (\lambda (a3: +A).(arity g (CHead c0 (Bind b1) u) u a3)) (\lambda (_: A).(arity g (CHead +(CHead c0 (Bind b1) u) (Bind b) u) t a0))))) H15 b H12) in (let H20 \def +(eq_ind B b0 (\lambda (b1: B).(arity g (CHead c0 (Bind b1) u) t a0)) H16 b +H12) in (let H21 \def (eq_ind B b0 (\lambda (b1: B).(not (eq B b1 Abst))) H2 +b H12) in (ex_intro2 A (\lambda (a3: A).(arity g c0 u a3)) (\lambda (_: +A).(arity g (CHead c0 (Bind b) u) t a0)) a1 H18 H20))))))))))))) H9)) +H8)))))))))))))) (\lambda (c0: C).(\lambda (u0: T).(\lambda (a1: A).(\lambda +(H2: (arity g c0 u0 (asucc g a1))).(\lambda (H3: (((eq T u0 (THead (Bind b) u +t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u a3)) (\lambda (_: A).(arity g +(CHead c0 (Bind b) u) t (asucc g a1))))))).(\lambda (t0: T).(\lambda (a0: +A).(\lambda (H4: (arity g (CHead c0 (Bind Abst) u0) t0 a0)).(\lambda (H5: +(((eq T t0 (THead (Bind b) u t)) \to (ex2 A (\lambda (a3: A).(arity g (CHead +c0 (Bind Abst) u0) u a3)) (\lambda (_: A).(arity g (CHead (CHead c0 (Bind +Abst) u0) (Bind b) u) t a0)))))).(\lambda (H6: (eq T (THead (Bind Abst) u0 +t0) (THead (Bind b) u t))).(let H7 \def (f_equal T B (\lambda (e: T).(match e +in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow Abst | (TLRef _) +\Rightarrow Abst | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow Abst])])) +(THead (Bind Abst) u0 t0) (THead (Bind b) u t) H6) in ((let H8 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t1 _) \Rightarrow t1])) +(THead (Bind Abst) u0 t0) (THead (Bind b) u t) H6) in ((let H9 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t1) \Rightarrow t1])) +(THead (Bind Abst) u0 t0) (THead (Bind b) u t) H6) in (\lambda (H10: (eq T u0 +u)).(\lambda (H11: (eq B Abst b)).(let H12 \def (eq_ind T t0 (\lambda (t1: +T).((eq T t1 (THead (Bind b) u t)) \to (ex2 A (\lambda (a3: A).(arity g +(CHead c0 (Bind Abst) u0) u a3)) (\lambda (_: A).(arity g (CHead (CHead c0 +(Bind Abst) u0) (Bind b) u) t a0))))) H5 t H9) in (let H13 \def (eq_ind T t0 +(\lambda (t1: T).(arity g (CHead c0 (Bind Abst) u0) t1 a0)) H4 t H9) in (let +H14 \def (eq_ind T u0 (\lambda (t1: T).((eq T t (THead (Bind b) u t)) \to +(ex2 A (\lambda (a3: A).(arity g (CHead c0 (Bind Abst) t1) u a3)) (\lambda +(_: A).(arity g (CHead (CHead c0 (Bind Abst) t1) (Bind b) u) t a0))))) H12 u +H10) in (let H15 \def (eq_ind T u0 (\lambda (t1: T).(arity g (CHead c0 (Bind +Abst) t1) t a0)) H13 u H10) in (let H16 \def (eq_ind T u0 (\lambda (t1: +T).((eq T t1 (THead (Bind b) u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u +a3)) (\lambda (_: A).(arity g (CHead c0 (Bind b) u) t (asucc g a1)))))) H3 u +H10) in (let H17 \def (eq_ind T u0 (\lambda (t1: T).(arity g c0 t1 (asucc g +a1))) H2 u H10) in (let H18 \def (eq_ind_r B b (\lambda (b0: B).((eq T t +(THead (Bind b0) u t)) \to (ex2 A (\lambda (a3: A).(arity g (CHead c0 (Bind +Abst) u) u a3)) (\lambda (_: A).(arity g (CHead (CHead c0 (Bind Abst) u) +(Bind b0) u) t a0))))) H14 Abst H11) in (let H19 \def (eq_ind_r B b (\lambda +(b0: B).((eq T u (THead (Bind b0) u t)) \to (ex2 A (\lambda (a3: A).(arity g +c0 u a3)) (\lambda (_: A).(arity g (CHead c0 (Bind b0) u) t (asucc g a1)))))) +H16 Abst H11) in (let H20 \def (eq_ind_r B b (\lambda (b0: B).(not (eq B b0 +Abst))) H Abst H11) in (eq_ind B Abst (\lambda (b0: B).(ex2 A (\lambda (a3: +A).(arity g c0 u a3)) (\lambda (_: A).(arity g (CHead c0 (Bind b0) u) t +(AHead a1 a0))))) (let H21 \def (match (H20 (refl_equal B Abst)) in False +return (\lambda (_: False).(ex2 A (\lambda (a3: A).(arity g c0 u a3)) +(\lambda (_: A).(arity g (CHead c0 (Bind Abst) u) t (AHead a1 a0))))) with +[]) in H21) b H11))))))))))))) H8)) H7)))))))))))) (\lambda (c0: C).(\lambda +(u0: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u0 a1)).(\lambda (_: (((eq +T u0 (THead (Bind b) u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u a3)) +(\lambda (_: A).(arity g (CHead c0 (Bind b) u) t a1)))))).(\lambda (t0: +T).(\lambda (a0: A).(\lambda (_: (arity g c0 t0 (AHead a1 a0))).(\lambda (_: +(((eq T t0 (THead (Bind b) u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u +a3)) (\lambda (_: A).(arity g (CHead c0 (Bind b) u) t (AHead a1 +a0))))))).(\lambda (H6: (eq T (THead (Flat Appl) u0 t0) (THead (Bind b) u +t))).(let H7 \def (eq_ind T (THead (Flat Appl) u0 t0) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind b) u t) H6) in (False_ind (ex2 A (\lambda (a3: +A).(arity g c0 u a3)) (\lambda (_: A).(arity g (CHead c0 (Bind b) u) t a0))) +H7)))))))))))) (\lambda (c0: C).(\lambda (u0: T).(\lambda (a: A).(\lambda (_: +(arity g c0 u0 (asucc g a))).(\lambda (_: (((eq T u0 (THead (Bind b) u t)) +\to (ex2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (_: A).(arity g +(CHead c0 (Bind b) u) t (asucc g a))))))).(\lambda (t0: T).(\lambda (_: +(arity g c0 t0 a)).(\lambda (_: (((eq T t0 (THead (Bind b) u t)) \to (ex2 A +(\lambda (a1: A).(arity g c0 u a1)) (\lambda (_: A).(arity g (CHead c0 (Bind +b) u) t a)))))).(\lambda (H6: (eq T (THead (Flat Cast) u0 t0) (THead (Bind b) +u t))).(let H7 \def (eq_ind T (THead (Flat Cast) u0 t0) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind b) u t) H6) in (False_ind (ex2 A +(\lambda (a1: A).(arity g c0 u a1)) (\lambda (_: A).(arity g (CHead c0 (Bind +b) u) t a))) H7))))))))))) (\lambda (c0: C).(\lambda (t0: T).(\lambda (a1: +A).(\lambda (H2: (arity g c0 t0 a1)).(\lambda (H3: (((eq T t0 (THead (Bind b) +u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u a3)) (\lambda (_: A).(arity g +(CHead c0 (Bind b) u) t a1)))))).(\lambda (a0: A).(\lambda (H4: (leq g a1 +a0)).(\lambda (H5: (eq T t0 (THead (Bind b) u t))).(let H6 \def (f_equal T T +(\lambda (e: T).e) t0 (THead (Bind b) u t) H5) in (let H7 \def (eq_ind T t0 +(\lambda (t1: T).((eq T t1 (THead (Bind b) u t)) \to (ex2 A (\lambda (a3: +A).(arity g c0 u a3)) (\lambda (_: A).(arity g (CHead c0 (Bind b) u) t +a1))))) H3 (THead (Bind b) u t) H6) in (let H8 \def (eq_ind T t0 (\lambda +(t1: T).(arity g c0 t1 a1)) H2 (THead (Bind b) u t) H6) in (let H9 \def (H7 +(refl_equal T (THead (Bind b) u t))) in (ex2_ind A (\lambda (a3: A).(arity g +c0 u a3)) (\lambda (_: A).(arity g (CHead c0 (Bind b) u) t a1)) (ex2 A +(\lambda (a3: A).(arity g c0 u a3)) (\lambda (_: A).(arity g (CHead c0 (Bind +b) u) t a0))) (\lambda (x: A).(\lambda (H10: (arity g c0 u x)).(\lambda (H11: +(arity g (CHead c0 (Bind b) u) t a1)).(ex_intro2 A (\lambda (a3: A).(arity g +c0 u a3)) (\lambda (_: A).(arity g (CHead c0 (Bind b) u) t a0)) x H10 +(arity_repl g (CHead c0 (Bind b) u) t a1 H11 a0 H4))))) H9))))))))))))) c y +a2 H1))) H0)))))))). + +theorem arity_gen_abst: + \forall (g: G).(\forall (c: C).(\forall (u: T).(\forall (t: T).(\forall (a: +A).((arity g c (THead (Bind Abst) u t) a) \to (ex3_2 A A (\lambda (a1: +A).(\lambda (a2: A).(eq A a (AHead a1 a2)))) (\lambda (a1: A).(\lambda (_: +A).(arity g c u (asucc g a1)))) (\lambda (_: A).(\lambda (a2: A).(arity g +(CHead c (Bind Abst) u) t a2))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (a: +A).(\lambda (H: (arity g c (THead (Bind Abst) u t) a)).(insert_eq T (THead +(Bind Abst) u t) (\lambda (t0: T).(arity g c t0 a)) (ex3_2 A A (\lambda (a1: +A).(\lambda (a2: A).(eq A a (AHead a1 a2)))) (\lambda (a1: A).(\lambda (_: +A).(arity g c u (asucc g a1)))) (\lambda (_: A).(\lambda (a2: A).(arity g +(CHead c (Bind Abst) u) t a2)))) (\lambda (y: T).(\lambda (H0: (arity g c y +a)).(arity_ind g (\lambda (c0: C).(\lambda (t0: T).(\lambda (a0: A).((eq T t0 +(THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda (a1: A).(\lambda (a2: A).(eq +A a0 (AHead a1 a2)))) (\lambda (a1: A).(\lambda (_: A).(arity g c0 u (asucc g +a1)))) (\lambda (_: A).(\lambda (a2: A).(arity g (CHead c0 (Bind Abst) u) t +a2)))))))) (\lambda (c0: C).(\lambda (n: nat).(\lambda (H1: (eq T (TSort n) +(THead (Bind Abst) u t))).(let H2 \def (eq_ind T (TSort n) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow False])) I +(THead (Bind Abst) u t) H1) in (False_ind (ex3_2 A A (\lambda (a1: +A).(\lambda (a2: A).(eq A (ASort O n) (AHead a1 a2)))) (\lambda (a1: +A).(\lambda (_: A).(arity g c0 u (asucc g a1)))) (\lambda (_: A).(\lambda +(a2: A).(arity g (CHead c0 (Bind Abst) u) t a2)))) H2))))) (\lambda (c0: +C).(\lambda (d: C).(\lambda (u0: T).(\lambda (i: nat).(\lambda (_: (getl i c0 +(CHead d (Bind Abbr) u0))).(\lambda (a0: A).(\lambda (_: (arity g d u0 +a0)).(\lambda (_: (((eq T u0 (THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda +(a1: A).(\lambda (a2: A).(eq A a0 (AHead a1 a2)))) (\lambda (a1: A).(\lambda +(_: A).(arity g d u (asucc g a1)))) (\lambda (_: A).(\lambda (a2: A).(arity g +(CHead d (Bind Abst) u) t a2))))))).(\lambda (H4: (eq T (TLRef i) (THead +(Bind Abst) u t))).(let H5 \def (eq_ind T (TLRef i) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead +(Bind Abst) u t) H4) in (False_ind (ex3_2 A A (\lambda (a1: A).(\lambda (a2: +A).(eq A a0 (AHead a1 a2)))) (\lambda (a1: A).(\lambda (_: A).(arity g c0 u +(asucc g a1)))) (\lambda (_: A).(\lambda (a2: A).(arity g (CHead c0 (Bind +Abst) u) t a2)))) H5))))))))))) (\lambda (c0: C).(\lambda (d: C).(\lambda +(u0: T).(\lambda (i: nat).(\lambda (_: (getl i c0 (CHead d (Bind Abst) +u0))).(\lambda (a0: A).(\lambda (_: (arity g d u0 (asucc g a0))).(\lambda (_: +(((eq T u0 (THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda (a1: A).(\lambda +(a2: A).(eq A (asucc g a0) (AHead a1 a2)))) (\lambda (a1: A).(\lambda (_: +A).(arity g d u (asucc g a1)))) (\lambda (_: A).(\lambda (a2: A).(arity g +(CHead d (Bind Abst) u) t a2))))))).(\lambda (H4: (eq T (TLRef i) (THead +(Bind Abst) u t))).(let H5 \def (eq_ind T (TLRef i) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead +(Bind Abst) u t) H4) in (False_ind (ex3_2 A A (\lambda (a1: A).(\lambda (a2: +A).(eq A a0 (AHead a1 a2)))) (\lambda (a1: A).(\lambda (_: A).(arity g c0 u +(asucc g a1)))) (\lambda (_: A).(\lambda (a2: A).(arity g (CHead c0 (Bind +Abst) u) t a2)))) H5))))))))))) (\lambda (b: B).(\lambda (H1: (not (eq B b +Abst))).(\lambda (c0: C).(\lambda (u0: T).(\lambda (a1: A).(\lambda (H2: +(arity g c0 u0 a1)).(\lambda (H3: (((eq T u0 (THead (Bind Abst) u t)) \to +(ex3_2 A A (\lambda (a2: A).(\lambda (a3: A).(eq A a1 (AHead a2 a3)))) +(\lambda (a2: A).(\lambda (_: A).(arity g c0 u (asucc g a2)))) (\lambda (_: +A).(\lambda (a3: A).(arity g (CHead c0 (Bind Abst) u) t a3))))))).(\lambda +(t0: T).(\lambda (a2: A).(\lambda (H4: (arity g (CHead c0 (Bind b) u0) t0 +a2)).(\lambda (H5: (((eq T t0 (THead (Bind Abst) u t)) \to (ex3_2 A A +(\lambda (a3: A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) (\lambda (a3: +A).(\lambda (_: A).(arity g (CHead c0 (Bind b) u0) u (asucc g a3)))) (\lambda +(_: A).(\lambda (a4: A).(arity g (CHead (CHead c0 (Bind b) u0) (Bind Abst) u) +t a4))))))).(\lambda (H6: (eq T (THead (Bind b) u0 t0) (THead (Bind Abst) u +t))).(let H7 \def (f_equal T B (\lambda (e: T).(match e in T return (\lambda +(_: T).B) with [(TSort _) \Rightarrow b | (TLRef _) \Rightarrow b | (THead k +_ _) \Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow b])])) (THead (Bind b) u0 t0) (THead +(Bind Abst) u t) H6) in ((let H8 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) +\Rightarrow u0 | (THead _ t1 _) \Rightarrow t1])) (THead (Bind b) u0 t0) +(THead (Bind Abst) u t) H6) in ((let H9 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | +(TLRef _) \Rightarrow t0 | (THead _ _ t1) \Rightarrow t1])) (THead (Bind b) +u0 t0) (THead (Bind Abst) u t) H6) in (\lambda (H10: (eq T u0 u)).(\lambda +(H11: (eq B b Abst)).(let H12 \def (eq_ind T t0 (\lambda (t1: T).((eq T t1 +(THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq +A a2 (AHead a3 a4)))) (\lambda (a3: A).(\lambda (_: A).(arity g (CHead c0 +(Bind b) u0) u (asucc g a3)))) (\lambda (_: A).(\lambda (a4: A).(arity g +(CHead (CHead c0 (Bind b) u0) (Bind Abst) u) t a4)))))) H5 t H9) in (let H13 +\def (eq_ind T t0 (\lambda (t1: T).(arity g (CHead c0 (Bind b) u0) t1 a2)) H4 +t H9) in (let H14 \def (eq_ind T u0 (\lambda (t1: T).((eq T t (THead (Bind +Abst) u t)) \to (ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq A a2 (AHead +a3 a4)))) (\lambda (a3: A).(\lambda (_: A).(arity g (CHead c0 (Bind b) t1) u +(asucc g a3)))) (\lambda (_: A).(\lambda (a4: A).(arity g (CHead (CHead c0 +(Bind b) t1) (Bind Abst) u) t a4)))))) H12 u H10) in (let H15 \def (eq_ind T +u0 (\lambda (t1: T).(arity g (CHead c0 (Bind b) t1) t a2)) H13 u H10) in (let +H16 \def (eq_ind T u0 (\lambda (t1: T).((eq T t1 (THead (Bind Abst) u t)) \to +(ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq A a1 (AHead a3 a4)))) +(\lambda (a3: A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) (\lambda (_: +A).(\lambda (a4: A).(arity g (CHead c0 (Bind Abst) u) t a4)))))) H3 u H10) in +(let H17 \def (eq_ind T u0 (\lambda (t1: T).(arity g c0 t1 a1)) H2 u H10) in +(let H18 \def (eq_ind B b (\lambda (b0: B).((eq T t (THead (Bind Abst) u t)) +\to (ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) +(\lambda (a3: A).(\lambda (_: A).(arity g (CHead c0 (Bind b0) u) u (asucc g +a3)))) (\lambda (_: A).(\lambda (a4: A).(arity g (CHead (CHead c0 (Bind b0) +u) (Bind Abst) u) t a4)))))) H14 Abst H11) in (let H19 \def (eq_ind B b +(\lambda (b0: B).(arity g (CHead c0 (Bind b0) u) t a2)) H15 Abst H11) in (let +H20 \def (eq_ind B b (\lambda (b0: B).(not (eq B b0 Abst))) H1 Abst H11) in +(let H21 \def (match (H20 (refl_equal B Abst)) in False return (\lambda (_: +False).(ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) +(\lambda (a3: A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) (\lambda (_: +A).(\lambda (a4: A).(arity g (CHead c0 (Bind Abst) u) t a4))))) with []) in +H21))))))))))))) H8)) H7)))))))))))))) (\lambda (c0: C).(\lambda (u0: +T).(\lambda (a1: A).(\lambda (H1: (arity g c0 u0 (asucc g a1))).(\lambda (H2: +(((eq T u0 (THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda (a2: A).(\lambda +(a3: A).(eq A (asucc g a1) (AHead a2 a3)))) (\lambda (a2: A).(\lambda (_: +A).(arity g c0 u (asucc g a2)))) (\lambda (_: A).(\lambda (a3: A).(arity g +(CHead c0 (Bind Abst) u) t a3))))))).(\lambda (t0: T).(\lambda (a2: +A).(\lambda (H3: (arity g (CHead c0 (Bind Abst) u0) t0 a2)).(\lambda (H4: +(((eq T t0 (THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda (a3: A).(\lambda +(a4: A).(eq A a2 (AHead a3 a4)))) (\lambda (a3: A).(\lambda (_: A).(arity g +(CHead c0 (Bind Abst) u0) u (asucc g a3)))) (\lambda (_: A).(\lambda (a4: +A).(arity g (CHead (CHead c0 (Bind Abst) u0) (Bind Abst) u) t +a4))))))).(\lambda (H5: (eq T (THead (Bind Abst) u0 t0) (THead (Bind Abst) u +t))).(let H6 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda +(_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead +_ t1 _) \Rightarrow t1])) (THead (Bind Abst) u0 t0) (THead (Bind Abst) u t) +H5) in ((let H7 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 +| (THead _ _ t1) \Rightarrow t1])) (THead (Bind Abst) u0 t0) (THead (Bind +Abst) u t) H5) in (\lambda (H8: (eq T u0 u)).(let H9 \def (eq_ind T t0 +(\lambda (t1: T).((eq T t1 (THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda +(a3: A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) (\lambda (a3: A).(\lambda +(_: A).(arity g (CHead c0 (Bind Abst) u0) u (asucc g a3)))) (\lambda (_: +A).(\lambda (a4: A).(arity g (CHead (CHead c0 (Bind Abst) u0) (Bind Abst) u) +t a4)))))) H4 t H7) in (let H10 \def (eq_ind T t0 (\lambda (t1: T).(arity g +(CHead c0 (Bind Abst) u0) t1 a2)) H3 t H7) in (let H11 \def (eq_ind T u0 +(\lambda (t1: T).((eq T t (THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda +(a3: A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) (\lambda (a3: A).(\lambda +(_: A).(arity g (CHead c0 (Bind Abst) t1) u (asucc g a3)))) (\lambda (_: +A).(\lambda (a4: A).(arity g (CHead (CHead c0 (Bind Abst) t1) (Bind Abst) u) +t a4)))))) H9 u H8) in (let H12 \def (eq_ind T u0 (\lambda (t1: T).(arity g +(CHead c0 (Bind Abst) t1) t a2)) H10 u H8) in (let H13 \def (eq_ind T u0 +(\lambda (t1: T).((eq T t1 (THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda +(a3: A).(\lambda (a4: A).(eq A (asucc g a1) (AHead a3 a4)))) (\lambda (a3: +A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) (\lambda (_: A).(\lambda +(a4: A).(arity g (CHead c0 (Bind Abst) u) t a4)))))) H2 u H8) in (let H14 +\def (eq_ind T u0 (\lambda (t1: T).(arity g c0 t1 (asucc g a1))) H1 u H8) in +(ex3_2_intro A A (\lambda (a3: A).(\lambda (a4: A).(eq A (AHead a1 a2) (AHead +a3 a4)))) (\lambda (a3: A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) +(\lambda (_: A).(\lambda (a4: A).(arity g (CHead c0 (Bind Abst) u) t a4))) a1 +a2 (refl_equal A (AHead a1 a2)) H14 H12))))))))) H6)))))))))))) (\lambda (c0: +C).(\lambda (u0: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u0 +a1)).(\lambda (_: (((eq T u0 (THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda +(a2: A).(\lambda (a3: A).(eq A a1 (AHead a2 a3)))) (\lambda (a2: A).(\lambda +(_: A).(arity g c0 u (asucc g a2)))) (\lambda (_: A).(\lambda (a3: A).(arity +g (CHead c0 (Bind Abst) u) t a3))))))).(\lambda (t0: T).(\lambda (a2: +A).(\lambda (_: (arity g c0 t0 (AHead a1 a2))).(\lambda (_: (((eq T t0 (THead +(Bind Abst) u t)) \to (ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq A +(AHead a1 a2) (AHead a3 a4)))) (\lambda (a3: A).(\lambda (_: A).(arity g c0 u +(asucc g a3)))) (\lambda (_: A).(\lambda (a4: A).(arity g (CHead c0 (Bind +Abst) u) t a4))))))).(\lambda (H5: (eq T (THead (Flat Appl) u0 t0) (THead +(Bind Abst) u t))).(let H6 \def (eq_ind T (THead (Flat Appl) u0 t0) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | +(Flat _) \Rightarrow True])])) I (THead (Bind Abst) u t) H5) in (False_ind +(ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) +(\lambda (a3: A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) (\lambda (_: +A).(\lambda (a4: A).(arity g (CHead c0 (Bind Abst) u) t a4)))) H6)))))))))))) +(\lambda (c0: C).(\lambda (u0: T).(\lambda (a0: A).(\lambda (_: (arity g c0 +u0 (asucc g a0))).(\lambda (_: (((eq T u0 (THead (Bind Abst) u t)) \to (ex3_2 +A A (\lambda (a1: A).(\lambda (a2: A).(eq A (asucc g a0) (AHead a1 a2)))) +(\lambda (a1: A).(\lambda (_: A).(arity g c0 u (asucc g a1)))) (\lambda (_: +A).(\lambda (a2: A).(arity g (CHead c0 (Bind Abst) u) t a2))))))).(\lambda +(t0: T).(\lambda (_: (arity g c0 t0 a0)).(\lambda (_: (((eq T t0 (THead (Bind +Abst) u t)) \to (ex3_2 A A (\lambda (a1: A).(\lambda (a2: A).(eq A a0 (AHead +a1 a2)))) (\lambda (a1: A).(\lambda (_: A).(arity g c0 u (asucc g a1)))) +(\lambda (_: A).(\lambda (a2: A).(arity g (CHead c0 (Bind Abst) u) t +a2))))))).(\lambda (H5: (eq T (THead (Flat Cast) u0 t0) (THead (Bind Abst) u +t))).(let H6 \def (eq_ind T (THead (Flat Cast) u0 t0) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind Abst) u t) H5) in (False_ind (ex3_2 A A (\lambda +(a1: A).(\lambda (a2: A).(eq A a0 (AHead a1 a2)))) (\lambda (a1: A).(\lambda +(_: A).(arity g c0 u (asucc g a1)))) (\lambda (_: A).(\lambda (a2: A).(arity +g (CHead c0 (Bind Abst) u) t a2)))) H6))))))))))) (\lambda (c0: C).(\lambda +(t0: T).(\lambda (a1: A).(\lambda (H1: (arity g c0 t0 a1)).(\lambda (H2: +(((eq T t0 (THead (Bind Abst) u t)) \to (ex3_2 A A (\lambda (a2: A).(\lambda +(a3: A).(eq A a1 (AHead a2 a3)))) (\lambda (a2: A).(\lambda (_: A).(arity g +c0 u (asucc g a2)))) (\lambda (_: A).(\lambda (a3: A).(arity g (CHead c0 +(Bind Abst) u) t a3))))))).(\lambda (a2: A).(\lambda (H3: (leq g a1 +a2)).(\lambda (H4: (eq T t0 (THead (Bind Abst) u t))).(let H5 \def (f_equal T +T (\lambda (e: T).e) t0 (THead (Bind Abst) u t) H4) in (let H6 \def (eq_ind T +t0 (\lambda (t1: T).((eq T t1 (THead (Bind Abst) u t)) \to (ex3_2 A A +(\lambda (a3: A).(\lambda (a4: A).(eq A a1 (AHead a3 a4)))) (\lambda (a3: +A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) (\lambda (_: A).(\lambda +(a4: A).(arity g (CHead c0 (Bind Abst) u) t a4)))))) H2 (THead (Bind Abst) u +t) H5) in (let H7 \def (eq_ind T t0 (\lambda (t1: T).(arity g c0 t1 a1)) H1 +(THead (Bind Abst) u t) H5) in (let H8 \def (H6 (refl_equal T (THead (Bind +Abst) u t))) in (ex3_2_ind A A (\lambda (a3: A).(\lambda (a4: A).(eq A a1 +(AHead a3 a4)))) (\lambda (a3: A).(\lambda (_: A).(arity g c0 u (asucc g +a3)))) (\lambda (_: A).(\lambda (a4: A).(arity g (CHead c0 (Bind Abst) u) t +a4))) (ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) +(\lambda (a3: A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) (\lambda (_: +A).(\lambda (a4: A).(arity g (CHead c0 (Bind Abst) u) t a4)))) (\lambda (x0: +A).(\lambda (x1: A).(\lambda (H9: (eq A a1 (AHead x0 x1))).(\lambda (H10: +(arity g c0 u (asucc g x0))).(\lambda (H11: (arity g (CHead c0 (Bind Abst) u) +t x1)).(let H12 \def (eq_ind A a1 (\lambda (a0: A).(leq g a0 a2)) H3 (AHead +x0 x1) H9) in (let H13 \def (eq_ind A a1 (\lambda (a0: A).(arity g c0 (THead +(Bind Abst) u t) a0)) H7 (AHead x0 x1) H9) in (let H_x \def (leq_gen_head g +x0 x1 a2 H12) in (let H14 \def H_x in (ex3_2_ind A A (\lambda (a3: +A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) (\lambda (a3: A).(\lambda (_: +A).(leq g x0 a3))) (\lambda (_: A).(\lambda (a4: A).(leq g x1 a4))) (ex3_2 A +A (\lambda (a3: A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) (\lambda (a3: +A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) (\lambda (_: A).(\lambda +(a4: A).(arity g (CHead c0 (Bind Abst) u) t a4)))) (\lambda (x2: A).(\lambda +(x3: A).(\lambda (H15: (eq A a2 (AHead x2 x3))).(\lambda (H16: (leq g x0 +x2)).(\lambda (H17: (leq g x1 x3)).(eq_ind_r A (AHead x2 x3) (\lambda (a0: +A).(ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq A a0 (AHead a3 a4)))) +(\lambda (a3: A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) (\lambda (_: +A).(\lambda (a4: A).(arity g (CHead c0 (Bind Abst) u) t a4))))) (ex3_2_intro +A A (\lambda (a3: A).(\lambda (a4: A).(eq A (AHead x2 x3) (AHead a3 a4)))) +(\lambda (a3: A).(\lambda (_: A).(arity g c0 u (asucc g a3)))) (\lambda (_: +A).(\lambda (a4: A).(arity g (CHead c0 (Bind Abst) u) t a4))) x2 x3 +(refl_equal A (AHead x2 x3)) (arity_repl g c0 u (asucc g x0) H10 (asucc g x2) +(asucc_repl g x0 x2 H16)) (arity_repl g (CHead c0 (Bind Abst) u) t x1 H11 x3 +H17)) a2 H15)))))) H14)))))))))) H8))))))))))))) c y a H0))) H)))))). + +theorem arity_gen_appl: + \forall (g: G).(\forall (c: C).(\forall (u: T).(\forall (t: T).(\forall (a2: +A).((arity g c (THead (Flat Appl) u t) a2) \to (ex2 A (\lambda (a1: A).(arity +g c u a1)) (\lambda (a1: A).(arity g c t (AHead a1 a2))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (a2: +A).(\lambda (H: (arity g c (THead (Flat Appl) u t) a2)).(insert_eq T (THead +(Flat Appl) u t) (\lambda (t0: T).(arity g c t0 a2)) (ex2 A (\lambda (a1: +A).(arity g c u a1)) (\lambda (a1: A).(arity g c t (AHead a1 a2)))) (\lambda +(y: T).(\lambda (H0: (arity g c y a2)).(arity_ind g (\lambda (c0: C).(\lambda +(t0: T).(\lambda (a: A).((eq T t0 (THead (Flat Appl) u t)) \to (ex2 A +(\lambda (a1: A).(arity g c0 u a1)) (\lambda (a1: A).(arity g c0 t (AHead a1 +a)))))))) (\lambda (c0: C).(\lambda (n: nat).(\lambda (H1: (eq T (TSort n) +(THead (Flat Appl) u t))).(let H2 \def (eq_ind T (TSort n) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow False])) I +(THead (Flat Appl) u t) H1) in (False_ind (ex2 A (\lambda (a1: A).(arity g c0 +u a1)) (\lambda (a1: A).(arity g c0 t (AHead a1 (ASort O n))))) H2))))) +(\lambda (c0: C).(\lambda (d: C).(\lambda (u0: T).(\lambda (i: nat).(\lambda +(_: (getl i c0 (CHead d (Bind Abbr) u0))).(\lambda (a: A).(\lambda (_: (arity +g d u0 a)).(\lambda (_: (((eq T u0 (THead (Flat Appl) u t)) \to (ex2 A +(\lambda (a1: A).(arity g d u a1)) (\lambda (a1: A).(arity g d t (AHead a1 +a))))))).(\lambda (H4: (eq T (TLRef i) (THead (Flat Appl) u t))).(let H5 \def +(eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead (Flat Appl) u t) H4) in +(False_ind (ex2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (a1: A).(arity +g c0 t (AHead a1 a)))) H5))))))))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (u0: T).(\lambda (i: nat).(\lambda (_: (getl i c0 (CHead d (Bind +Abst) u0))).(\lambda (a: A).(\lambda (_: (arity g d u0 (asucc g a))).(\lambda +(_: (((eq T u0 (THead (Flat Appl) u t)) \to (ex2 A (\lambda (a1: A).(arity g +d u a1)) (\lambda (a1: A).(arity g d t (AHead a1 (asucc g a)))))))).(\lambda +(H4: (eq T (TLRef i) (THead (Flat Appl) u t))).(let H5 \def (eq_ind T (TLRef +i) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow +False])) I (THead (Flat Appl) u t) H4) in (False_ind (ex2 A (\lambda (a1: +A).(arity g c0 u a1)) (\lambda (a1: A).(arity g c0 t (AHead a1 a)))) +H5))))))))))) (\lambda (b: B).(\lambda (_: (not (eq B b Abst))).(\lambda (c0: +C).(\lambda (u0: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u0 +a1)).(\lambda (_: (((eq T u0 (THead (Flat Appl) u t)) \to (ex2 A (\lambda +(a3: A).(arity g c0 u a3)) (\lambda (a3: A).(arity g c0 t (AHead a3 +a1))))))).(\lambda (t0: T).(\lambda (a0: A).(\lambda (_: (arity g (CHead c0 +(Bind b) u0) t0 a0)).(\lambda (_: (((eq T t0 (THead (Flat Appl) u t)) \to +(ex2 A (\lambda (a3: A).(arity g (CHead c0 (Bind b) u0) u a3)) (\lambda (a3: +A).(arity g (CHead c0 (Bind b) u0) t (AHead a3 a0))))))).(\lambda (H6: (eq T +(THead (Bind b) u0 t0) (THead (Flat Appl) u t))).(let H7 \def (eq_ind T +(THead (Bind b) u0 t0) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat +Appl) u t) H6) in (False_ind (ex2 A (\lambda (a3: A).(arity g c0 u a3)) +(\lambda (a3: A).(arity g c0 t (AHead a3 a0)))) H7)))))))))))))) (\lambda +(c0: C).(\lambda (u0: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u0 (asucc +g a1))).(\lambda (_: (((eq T u0 (THead (Flat Appl) u t)) \to (ex2 A (\lambda +(a3: A).(arity g c0 u a3)) (\lambda (a3: A).(arity g c0 t (AHead a3 (asucc g +a1)))))))).(\lambda (t0: T).(\lambda (a0: A).(\lambda (_: (arity g (CHead c0 +(Bind Abst) u0) t0 a0)).(\lambda (_: (((eq T t0 (THead (Flat Appl) u t)) \to +(ex2 A (\lambda (a3: A).(arity g (CHead c0 (Bind Abst) u0) u a3)) (\lambda +(a3: A).(arity g (CHead c0 (Bind Abst) u0) t (AHead a3 a0))))))).(\lambda +(H5: (eq T (THead (Bind Abst) u0 t0) (THead (Flat Appl) u t))).(let H6 \def +(eq_ind T (THead (Bind Abst) u0 t0) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow True | (Flat _) \Rightarrow +False])])) I (THead (Flat Appl) u t) H5) in (False_ind (ex2 A (\lambda (a3: +A).(arity g c0 u a3)) (\lambda (a3: A).(arity g c0 t (AHead a3 (AHead a1 +a0))))) H6)))))))))))) (\lambda (c0: C).(\lambda (u0: T).(\lambda (a1: +A).(\lambda (H1: (arity g c0 u0 a1)).(\lambda (H2: (((eq T u0 (THead (Flat +Appl) u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u a3)) (\lambda (a3: +A).(arity g c0 t (AHead a3 a1))))))).(\lambda (t0: T).(\lambda (a0: +A).(\lambda (H3: (arity g c0 t0 (AHead a1 a0))).(\lambda (H4: (((eq T t0 +(THead (Flat Appl) u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u a3)) +(\lambda (a3: A).(arity g c0 t (AHead a3 (AHead a1 a0)))))))).(\lambda (H5: +(eq T (THead (Flat Appl) u0 t0) (THead (Flat Appl) u t))).(let H6 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t1 _) +\Rightarrow t1])) (THead (Flat Appl) u0 t0) (THead (Flat Appl) u t) H5) in +((let H7 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ +t1) \Rightarrow t1])) (THead (Flat Appl) u0 t0) (THead (Flat Appl) u t) H5) +in (\lambda (H8: (eq T u0 u)).(let H9 \def (eq_ind T t0 (\lambda (t1: T).((eq +T t1 (THead (Flat Appl) u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u a3)) +(\lambda (a3: A).(arity g c0 t (AHead a3 (AHead a1 a0))))))) H4 t H7) in (let +H10 \def (eq_ind T t0 (\lambda (t1: T).(arity g c0 t1 (AHead a1 a0))) H3 t +H7) in (let H11 \def (eq_ind T u0 (\lambda (t1: T).((eq T t1 (THead (Flat +Appl) u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u a3)) (\lambda (a3: +A).(arity g c0 t (AHead a3 a1)))))) H2 u H8) in (let H12 \def (eq_ind T u0 +(\lambda (t1: T).(arity g c0 t1 a1)) H1 u H8) in (ex_intro2 A (\lambda (a3: +A).(arity g c0 u a3)) (\lambda (a3: A).(arity g c0 t (AHead a3 a0))) a1 H12 +H10))))))) H6)))))))))))) (\lambda (c0: C).(\lambda (u0: T).(\lambda (a: +A).(\lambda (_: (arity g c0 u0 (asucc g a))).(\lambda (_: (((eq T u0 (THead +(Flat Appl) u t)) \to (ex2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda +(a1: A).(arity g c0 t (AHead a1 (asucc g a)))))))).(\lambda (t0: T).(\lambda +(_: (arity g c0 t0 a)).(\lambda (_: (((eq T t0 (THead (Flat Appl) u t)) \to +(ex2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (a1: A).(arity g c0 t +(AHead a1 a))))))).(\lambda (H5: (eq T (THead (Flat Cast) u0 t0) (THead (Flat +Appl) u t))).(let H6 \def (eq_ind T (THead (Flat Cast) u0 t0) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat f) +\Rightarrow (match f in F return (\lambda (_: F).Prop) with [Appl \Rightarrow +False | Cast \Rightarrow True])])])) I (THead (Flat Appl) u t) H5) in +(False_ind (ex2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (a1: A).(arity +g c0 t (AHead a1 a)))) H6))))))))))) (\lambda (c0: C).(\lambda (t0: +T).(\lambda (a1: A).(\lambda (H1: (arity g c0 t0 a1)).(\lambda (H2: (((eq T +t0 (THead (Flat Appl) u t)) \to (ex2 A (\lambda (a3: A).(arity g c0 u a3)) +(\lambda (a3: A).(arity g c0 t (AHead a3 a1))))))).(\lambda (a0: A).(\lambda +(H3: (leq g a1 a0)).(\lambda (H4: (eq T t0 (THead (Flat Appl) u t))).(let H5 +\def (f_equal T T (\lambda (e: T).e) t0 (THead (Flat Appl) u t) H4) in (let +H6 \def (eq_ind T t0 (\lambda (t1: T).((eq T t1 (THead (Flat Appl) u t)) \to +(ex2 A (\lambda (a3: A).(arity g c0 u a3)) (\lambda (a3: A).(arity g c0 t +(AHead a3 a1)))))) H2 (THead (Flat Appl) u t) H5) in (let H7 \def (eq_ind T +t0 (\lambda (t1: T).(arity g c0 t1 a1)) H1 (THead (Flat Appl) u t) H5) in +(let H8 \def (H6 (refl_equal T (THead (Flat Appl) u t))) in (ex2_ind A +(\lambda (a3: A).(arity g c0 u a3)) (\lambda (a3: A).(arity g c0 t (AHead a3 +a1))) (ex2 A (\lambda (a3: A).(arity g c0 u a3)) (\lambda (a3: A).(arity g c0 +t (AHead a3 a0)))) (\lambda (x: A).(\lambda (H9: (arity g c0 u x)).(\lambda +(H10: (arity g c0 t (AHead x a1))).(ex_intro2 A (\lambda (a3: A).(arity g c0 +u a3)) (\lambda (a3: A).(arity g c0 t (AHead a3 a0))) x H9 (arity_repl g c0 t +(AHead x a1) H10 (AHead x a0) (leq_head g x x (leq_refl g x) a1 a0 H3)))))) +H8))))))))))))) c y a2 H0))) H)))))). + +theorem arity_gen_cast: + \forall (g: G).(\forall (c: C).(\forall (u: T).(\forall (t: T).(\forall (a: +A).((arity g c (THead (Flat Cast) u t) a) \to (land (arity g c u (asucc g a)) +(arity g c t a))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (a: +A).(\lambda (H: (arity g c (THead (Flat Cast) u t) a)).(insert_eq T (THead +(Flat Cast) u t) (\lambda (t0: T).(arity g c t0 a)) (land (arity g c u (asucc +g a)) (arity g c t a)) (\lambda (y: T).(\lambda (H0: (arity g c y +a)).(arity_ind g (\lambda (c0: C).(\lambda (t0: T).(\lambda (a0: A).((eq T t0 +(THead (Flat Cast) u t)) \to (land (arity g c0 u (asucc g a0)) (arity g c0 t +a0)))))) (\lambda (c0: C).(\lambda (n: nat).(\lambda (H1: (eq T (TSort n) +(THead (Flat Cast) u t))).(let H2 \def (eq_ind T (TSort n) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow False])) I +(THead (Flat Cast) u t) H1) in (False_ind (land (arity g c0 u (asucc g (ASort +O n))) (arity g c0 t (ASort O n))) H2))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (u0: T).(\lambda (i: nat).(\lambda (_: (getl i c0 (CHead d (Bind +Abbr) u0))).(\lambda (a0: A).(\lambda (_: (arity g d u0 a0)).(\lambda (_: +(((eq T u0 (THead (Flat Cast) u t)) \to (land (arity g d u (asucc g a0)) +(arity g d t a0))))).(\lambda (H4: (eq T (TLRef i) (THead (Flat Cast) u +t))).(let H5 \def (eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead (Flat Cast) u +t) H4) in (False_ind (land (arity g c0 u (asucc g a0)) (arity g c0 t a0)) +H5))))))))))) (\lambda (c0: C).(\lambda (d: C).(\lambda (u0: T).(\lambda (i: +nat).(\lambda (_: (getl i c0 (CHead d (Bind Abst) u0))).(\lambda (a0: +A).(\lambda (_: (arity g d u0 (asucc g a0))).(\lambda (_: (((eq T u0 (THead +(Flat Cast) u t)) \to (land (arity g d u (asucc g (asucc g a0))) (arity g d t +(asucc g a0)))))).(\lambda (H4: (eq T (TLRef i) (THead (Flat Cast) u +t))).(let H5 \def (eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead (Flat Cast) u +t) H4) in (False_ind (land (arity g c0 u (asucc g a0)) (arity g c0 t a0)) +H5))))))))))) (\lambda (b: B).(\lambda (_: (not (eq B b Abst))).(\lambda (c0: +C).(\lambda (u0: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u0 +a1)).(\lambda (_: (((eq T u0 (THead (Flat Cast) u t)) \to (land (arity g c0 u +(asucc g a1)) (arity g c0 t a1))))).(\lambda (t0: T).(\lambda (a2: +A).(\lambda (_: (arity g (CHead c0 (Bind b) u0) t0 a2)).(\lambda (_: (((eq T +t0 (THead (Flat Cast) u t)) \to (land (arity g (CHead c0 (Bind b) u0) u +(asucc g a2)) (arity g (CHead c0 (Bind b) u0) t a2))))).(\lambda (H6: (eq T +(THead (Bind b) u0 t0) (THead (Flat Cast) u t))).(let H7 \def (eq_ind T +(THead (Bind b) u0 t0) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat +Cast) u t) H6) in (False_ind (land (arity g c0 u (asucc g a2)) (arity g c0 t +a2)) H7)))))))))))))) (\lambda (c0: C).(\lambda (u0: T).(\lambda (a1: +A).(\lambda (_: (arity g c0 u0 (asucc g a1))).(\lambda (_: (((eq T u0 (THead +(Flat Cast) u t)) \to (land (arity g c0 u (asucc g (asucc g a1))) (arity g c0 +t (asucc g a1)))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity g +(CHead c0 (Bind Abst) u0) t0 a2)).(\lambda (_: (((eq T t0 (THead (Flat Cast) +u t)) \to (land (arity g (CHead c0 (Bind Abst) u0) u (asucc g a2)) (arity g +(CHead c0 (Bind Abst) u0) t a2))))).(\lambda (H5: (eq T (THead (Bind Abst) u0 +t0) (THead (Flat Cast) u t))).(let H6 \def (eq_ind T (THead (Bind Abst) u0 +t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat Cast) u t) +H5) in (False_ind (land (arity g c0 u (asucc g (AHead a1 a2))) (arity g c0 t +(AHead a1 a2))) H6)))))))))))) (\lambda (c0: C).(\lambda (u0: T).(\lambda +(a1: A).(\lambda (_: (arity g c0 u0 a1)).(\lambda (_: (((eq T u0 (THead (Flat +Cast) u t)) \to (land (arity g c0 u (asucc g a1)) (arity g c0 t +a1))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity g c0 t0 (AHead +a1 a2))).(\lambda (_: (((eq T t0 (THead (Flat Cast) u t)) \to (land (arity g +c0 u (asucc g (AHead a1 a2))) (arity g c0 t (AHead a1 a2)))))).(\lambda (H5: +(eq T (THead (Flat Appl) u0 t0) (THead (Flat Cast) u t))).(let H6 \def +(eq_ind T (THead (Flat Appl) u0 t0) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat f) \Rightarrow (match f +in F return (\lambda (_: F).Prop) with [Appl \Rightarrow True | Cast +\Rightarrow False])])])) I (THead (Flat Cast) u t) H5) in (False_ind (land +(arity g c0 u (asucc g a2)) (arity g c0 t a2)) H6)))))))))))) (\lambda (c0: +C).(\lambda (u0: T).(\lambda (a0: A).(\lambda (H1: (arity g c0 u0 (asucc g +a0))).(\lambda (H2: (((eq T u0 (THead (Flat Cast) u t)) \to (land (arity g c0 +u (asucc g (asucc g a0))) (arity g c0 t (asucc g a0)))))).(\lambda (t0: +T).(\lambda (H3: (arity g c0 t0 a0)).(\lambda (H4: (((eq T t0 (THead (Flat +Cast) u t)) \to (land (arity g c0 u (asucc g a0)) (arity g c0 t +a0))))).(\lambda (H5: (eq T (THead (Flat Cast) u0 t0) (THead (Flat Cast) u +t))).(let H6 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda +(_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead +_ t1 _) \Rightarrow t1])) (THead (Flat Cast) u0 t0) (THead (Flat Cast) u t) +H5) in ((let H7 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 +| (THead _ _ t1) \Rightarrow t1])) (THead (Flat Cast) u0 t0) (THead (Flat +Cast) u t) H5) in (\lambda (H8: (eq T u0 u)).(let H9 \def (eq_ind T t0 +(\lambda (t1: T).((eq T t1 (THead (Flat Cast) u t)) \to (land (arity g c0 u +(asucc g a0)) (arity g c0 t a0)))) H4 t H7) in (let H10 \def (eq_ind T t0 +(\lambda (t1: T).(arity g c0 t1 a0)) H3 t H7) in (let H11 \def (eq_ind T u0 +(\lambda (t1: T).((eq T t1 (THead (Flat Cast) u t)) \to (land (arity g c0 u +(asucc g (asucc g a0))) (arity g c0 t (asucc g a0))))) H2 u H8) in (let H12 +\def (eq_ind T u0 (\lambda (t1: T).(arity g c0 t1 (asucc g a0))) H1 u H8) in +(conj (arity g c0 u (asucc g a0)) (arity g c0 t a0) H12 H10))))))) +H6))))))))))) (\lambda (c0: C).(\lambda (t0: T).(\lambda (a1: A).(\lambda +(H1: (arity g c0 t0 a1)).(\lambda (H2: (((eq T t0 (THead (Flat Cast) u t)) +\to (land (arity g c0 u (asucc g a1)) (arity g c0 t a1))))).(\lambda (a2: +A).(\lambda (H3: (leq g a1 a2)).(\lambda (H4: (eq T t0 (THead (Flat Cast) u +t))).(let H5 \def (f_equal T T (\lambda (e: T).e) t0 (THead (Flat Cast) u t) +H4) in (let H6 \def (eq_ind T t0 (\lambda (t1: T).((eq T t1 (THead (Flat +Cast) u t)) \to (land (arity g c0 u (asucc g a1)) (arity g c0 t a1)))) H2 +(THead (Flat Cast) u t) H5) in (let H7 \def (eq_ind T t0 (\lambda (t1: +T).(arity g c0 t1 a1)) H1 (THead (Flat Cast) u t) H5) in (let H8 \def (H6 +(refl_equal T (THead (Flat Cast) u t))) in (and_ind (arity g c0 u (asucc g +a1)) (arity g c0 t a1) (land (arity g c0 u (asucc g a2)) (arity g c0 t a2)) +(\lambda (H9: (arity g c0 u (asucc g a1))).(\lambda (H10: (arity g c0 t +a1)).(conj (arity g c0 u (asucc g a2)) (arity g c0 t a2) (arity_repl g c0 u +(asucc g a1) H9 (asucc g a2) (asucc_repl g a1 a2 H3)) (arity_repl g c0 t a1 +H10 a2 H3)))) H8))))))))))))) c y a H0))) H)))))). + +theorem arity_gen_appls: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (vs: TList).(\forall +(a2: A).((arity g c (THeads (Flat Appl) vs t) a2) \to (ex A (\lambda (a: +A).(arity g c t a)))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (vs: +TList).(TList_ind (\lambda (t0: TList).(\forall (a2: A).((arity g c (THeads +(Flat Appl) t0 t) a2) \to (ex A (\lambda (a: A).(arity g c t a)))))) (\lambda +(a2: A).(\lambda (H: (arity g c t a2)).(ex_intro A (\lambda (a: A).(arity g c +t a)) a2 H))) (\lambda (t0: T).(\lambda (t1: TList).(\lambda (H: ((\forall +(a2: A).((arity g c (THeads (Flat Appl) t1 t) a2) \to (ex A (\lambda (a: +A).(arity g c t a))))))).(\lambda (a2: A).(\lambda (H0: (arity g c (THead +(Flat Appl) t0 (THeads (Flat Appl) t1 t)) a2)).(let H1 \def (arity_gen_appl g +c t0 (THeads (Flat Appl) t1 t) a2 H0) in (ex2_ind A (\lambda (a1: A).(arity g +c t0 a1)) (\lambda (a1: A).(arity g c (THeads (Flat Appl) t1 t) (AHead a1 +a2))) (ex A (\lambda (a: A).(arity g c t a))) (\lambda (x: A).(\lambda (_: +(arity g c t0 x)).(\lambda (H3: (arity g c (THeads (Flat Appl) t1 t) (AHead x +a2))).(let H_x \def (H (AHead x a2) H3) in (let H4 \def H_x in (ex_ind A +(\lambda (a: A).(arity g c t a)) (ex A (\lambda (a: A).(arity g c t a))) +(\lambda (x0: A).(\lambda (H5: (arity g c t x0)).(ex_intro A (\lambda (a: +A).(arity g c t a)) x0 H5))) H4)))))) H1))))))) vs)))). + +theorem arity_gen_lift: + \forall (g: G).(\forall (c1: C).(\forall (t: T).(\forall (a: A).(\forall (h: +nat).(\forall (d: nat).((arity g c1 (lift h d t) a) \to (\forall (c2: +C).((drop h d c1 c2) \to (arity g c2 t a))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t: T).(\lambda (a: A).(\lambda (h: +nat).(\lambda (d: nat).(\lambda (H: (arity g c1 (lift h d t) a)).(insert_eq T +(lift h d t) (\lambda (t0: T).(arity g c1 t0 a)) (\forall (c2: C).((drop h d +c1 c2) \to (arity g c2 t a))) (\lambda (y: T).(\lambda (H0: (arity g c1 y +a)).(unintro T t (\lambda (t0: T).((eq T y (lift h d t0)) \to (\forall (c2: +C).((drop h d c1 c2) \to (arity g c2 t0 a))))) (unintro nat d (\lambda (n: +nat).(\forall (x: T).((eq T y (lift h n x)) \to (\forall (c2: C).((drop h n +c1 c2) \to (arity g c2 x a)))))) (arity_ind g (\lambda (c: C).(\lambda (t0: +T).(\lambda (a0: A).(\forall (x: nat).(\forall (x0: T).((eq T t0 (lift h x +x0)) \to (\forall (c2: C).((drop h x c c2) \to (arity g c2 x0 a0))))))))) +(\lambda (c: C).(\lambda (n: nat).(\lambda (x: nat).(\lambda (x0: T).(\lambda +(H1: (eq T (TSort n) (lift h x x0))).(\lambda (c2: C).(\lambda (_: (drop h x +c c2)).(eq_ind_r T (TSort n) (\lambda (t0: T).(arity g c2 t0 (ASort O n))) +(arity_sort g c2 n) x0 (lift_gen_sort h x n x0 H1))))))))) (\lambda (c: +C).(\lambda (d0: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H1: (getl i c +(CHead d0 (Bind Abbr) u))).(\lambda (a0: A).(\lambda (H2: (arity g d0 u +a0)).(\lambda (H3: ((\forall (x: nat).(\forall (x0: T).((eq T u (lift h x +x0)) \to (\forall (c2: C).((drop h x d0 c2) \to (arity g c2 x0 +a0)))))))).(\lambda (x: nat).(\lambda (x0: T).(\lambda (H4: (eq T (TLRef i) +(lift h x x0))).(\lambda (c2: C).(\lambda (H5: (drop h x c c2)).(let H_x \def +(lift_gen_lref x0 x h i H4) in (let H6 \def H_x in (or_ind (land (lt i x) (eq +T x0 (TLRef i))) (land (le (plus x h) i) (eq T x0 (TLRef (minus i h)))) +(arity g c2 x0 a0) (\lambda (H7: (land (lt i x) (eq T x0 (TLRef +i)))).(and_ind (lt i x) (eq T x0 (TLRef i)) (arity g c2 x0 a0) (\lambda (H8: +(lt i x)).(\lambda (H9: (eq T x0 (TLRef i))).(eq_ind_r T (TLRef i) (\lambda +(t0: T).(arity g c2 t0 a0)) (let H10 \def (eq_ind nat x (\lambda (n: +nat).(drop h n c c2)) H5 (S (plus i (minus x (S i)))) (lt_plus_minus i x H8)) +in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h (minus x (S +i)) v)))) (\lambda (v: T).(\lambda (e0: C).(getl i c2 (CHead e0 (Bind Abbr) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h (minus x (S i)) d0 e0))) +(arity g c2 (TLRef i) a0) (\lambda (x1: T).(\lambda (x2: C).(\lambda (H11: +(eq T u (lift h (minus x (S i)) x1))).(\lambda (H12: (getl i c2 (CHead x2 +(Bind Abbr) x1))).(\lambda (H13: (drop h (minus x (S i)) d0 x2)).(let H14 +\def (eq_ind T u (\lambda (t0: T).(\forall (x3: nat).(\forall (x4: T).((eq T +t0 (lift h x3 x4)) \to (\forall (c3: C).((drop h x3 d0 c3) \to (arity g c3 x4 +a0))))))) H3 (lift h (minus x (S i)) x1) H11) in (let H15 \def (eq_ind T u +(\lambda (t0: T).(arity g d0 t0 a0)) H2 (lift h (minus x (S i)) x1) H11) in +(arity_abbr g c2 x2 x1 i H12 a0 (H14 (minus x (S i)) x1 (refl_equal T (lift h +(minus x (S i)) x1)) x2 H13))))))))) (getl_drop_conf_lt Abbr c d0 u i H1 c2 h +(minus x (S i)) H10))) x0 H9))) H7)) (\lambda (H7: (land (le (plus x h) i) +(eq T x0 (TLRef (minus i h))))).(and_ind (le (plus x h) i) (eq T x0 (TLRef +(minus i h))) (arity g c2 x0 a0) (\lambda (H8: (le (plus x h) i)).(\lambda +(H9: (eq T x0 (TLRef (minus i h)))).(eq_ind_r T (TLRef (minus i h)) (\lambda +(t0: T).(arity g c2 t0 a0)) (arity_abbr g c2 d0 u (minus i h) +(getl_drop_conf_ge i (CHead d0 (Bind Abbr) u) c H1 c2 h x H5 H8) a0 H2) x0 +H9))) H7)) H6)))))))))))))))) (\lambda (c: C).(\lambda (d0: C).(\lambda (u: +T).(\lambda (i: nat).(\lambda (H1: (getl i c (CHead d0 (Bind Abst) +u))).(\lambda (a0: A).(\lambda (H2: (arity g d0 u (asucc g a0))).(\lambda +(H3: ((\forall (x: nat).(\forall (x0: T).((eq T u (lift h x x0)) \to (\forall +(c2: C).((drop h x d0 c2) \to (arity g c2 x0 (asucc g a0))))))))).(\lambda +(x: nat).(\lambda (x0: T).(\lambda (H4: (eq T (TLRef i) (lift h x +x0))).(\lambda (c2: C).(\lambda (H5: (drop h x c c2)).(let H_x \def +(lift_gen_lref x0 x h i H4) in (let H6 \def H_x in (or_ind (land (lt i x) (eq +T x0 (TLRef i))) (land (le (plus x h) i) (eq T x0 (TLRef (minus i h)))) +(arity g c2 x0 a0) (\lambda (H7: (land (lt i x) (eq T x0 (TLRef +i)))).(and_ind (lt i x) (eq T x0 (TLRef i)) (arity g c2 x0 a0) (\lambda (H8: +(lt i x)).(\lambda (H9: (eq T x0 (TLRef i))).(eq_ind_r T (TLRef i) (\lambda +(t0: T).(arity g c2 t0 a0)) (let H10 \def (eq_ind nat x (\lambda (n: +nat).(drop h n c c2)) H5 (S (plus i (minus x (S i)))) (lt_plus_minus i x H8)) +in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h (minus x (S +i)) v)))) (\lambda (v: T).(\lambda (e0: C).(getl i c2 (CHead e0 (Bind Abst) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h (minus x (S i)) d0 e0))) +(arity g c2 (TLRef i) a0) (\lambda (x1: T).(\lambda (x2: C).(\lambda (H11: +(eq T u (lift h (minus x (S i)) x1))).(\lambda (H12: (getl i c2 (CHead x2 +(Bind Abst) x1))).(\lambda (H13: (drop h (minus x (S i)) d0 x2)).(let H14 +\def (eq_ind T u (\lambda (t0: T).(\forall (x3: nat).(\forall (x4: T).((eq T +t0 (lift h x3 x4)) \to (\forall (c3: C).((drop h x3 d0 c3) \to (arity g c3 x4 +(asucc g a0)))))))) H3 (lift h (minus x (S i)) x1) H11) in (let H15 \def +(eq_ind T u (\lambda (t0: T).(arity g d0 t0 (asucc g a0))) H2 (lift h (minus +x (S i)) x1) H11) in (arity_abst g c2 x2 x1 i H12 a0 (H14 (minus x (S i)) x1 +(refl_equal T (lift h (minus x (S i)) x1)) x2 H13))))))))) (getl_drop_conf_lt +Abst c d0 u i H1 c2 h (minus x (S i)) H10))) x0 H9))) H7)) (\lambda (H7: +(land (le (plus x h) i) (eq T x0 (TLRef (minus i h))))).(and_ind (le (plus x +h) i) (eq T x0 (TLRef (minus i h))) (arity g c2 x0 a0) (\lambda (H8: (le +(plus x h) i)).(\lambda (H9: (eq T x0 (TLRef (minus i h)))).(eq_ind_r T +(TLRef (minus i h)) (\lambda (t0: T).(arity g c2 t0 a0)) (arity_abst g c2 d0 +u (minus i h) (getl_drop_conf_ge i (CHead d0 (Bind Abst) u) c H1 c2 h x H5 +H8) a0 H2) x0 H9))) H7)) H6)))))))))))))))) (\lambda (b: B).(\lambda (H1: +(not (eq B b Abst))).(\lambda (c: C).(\lambda (u: T).(\lambda (a1: +A).(\lambda (H2: (arity g c u a1)).(\lambda (H3: ((\forall (x: nat).(\forall +(x0: T).((eq T u (lift h x x0)) \to (\forall (c2: C).((drop h x c c2) \to +(arity g c2 x0 a1)))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (H4: +(arity g (CHead c (Bind b) u) t0 a2)).(\lambda (H5: ((\forall (x: +nat).(\forall (x0: T).((eq T t0 (lift h x x0)) \to (\forall (c2: C).((drop h +x (CHead c (Bind b) u) c2) \to (arity g c2 x0 a2)))))))).(\lambda (x: +nat).(\lambda (x0: T).(\lambda (H6: (eq T (THead (Bind b) u t0) (lift h x +x0))).(\lambda (c2: C).(\lambda (H7: (drop h x c c2)).(ex3_2_ind T T (\lambda +(y0: T).(\lambda (z: T).(eq T x0 (THead (Bind b) y0 z)))) (\lambda (y0: +T).(\lambda (_: T).(eq T u (lift h x y0)))) (\lambda (_: T).(\lambda (z: +T).(eq T t0 (lift h (S x) z)))) (arity g c2 x0 a2) (\lambda (x1: T).(\lambda +(x2: T).(\lambda (H8: (eq T x0 (THead (Bind b) x1 x2))).(\lambda (H9: (eq T u +(lift h x x1))).(\lambda (H10: (eq T t0 (lift h (S x) x2))).(eq_ind_r T +(THead (Bind b) x1 x2) (\lambda (t1: T).(arity g c2 t1 a2)) (let H11 \def +(eq_ind T t0 (\lambda (t1: T).(\forall (x3: nat).(\forall (x4: T).((eq T t1 +(lift h x3 x4)) \to (\forall (c3: C).((drop h x3 (CHead c (Bind b) u) c3) \to +(arity g c3 x4 a2))))))) H5 (lift h (S x) x2) H10) in (let H12 \def (eq_ind T +t0 (\lambda (t1: T).(arity g (CHead c (Bind b) u) t1 a2)) H4 (lift h (S x) +x2) H10) in (let H13 \def (eq_ind T u (\lambda (t1: T).(arity g (CHead c +(Bind b) t1) (lift h (S x) x2) a2)) H12 (lift h x x1) H9) in (let H14 \def +(eq_ind T u (\lambda (t1: T).(\forall (x3: nat).(\forall (x4: T).((eq T (lift +h (S x) x2) (lift h x3 x4)) \to (\forall (c3: C).((drop h x3 (CHead c (Bind +b) t1) c3) \to (arity g c3 x4 a2))))))) H11 (lift h x x1) H9) in (let H15 +\def (eq_ind T u (\lambda (t1: T).(\forall (x3: nat).(\forall (x4: T).((eq T +t1 (lift h x3 x4)) \to (\forall (c3: C).((drop h x3 c c3) \to (arity g c3 x4 +a1))))))) H3 (lift h x x1) H9) in (let H16 \def (eq_ind T u (\lambda (t1: +T).(arity g c t1 a1)) H2 (lift h x x1) H9) in (arity_bind g b H1 c2 x1 a1 +(H15 x x1 (refl_equal T (lift h x x1)) c2 H7) x2 a2 (H14 (S x) x2 (refl_equal +T (lift h (S x) x2)) (CHead c2 (Bind b) x1) (drop_skip_bind h x c c2 H7 b +x1))))))))) x0 H8)))))) (lift_gen_bind b u t0 x0 h x H6)))))))))))))))))) +(\lambda (c: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (H1: (arity g c u +(asucc g a1))).(\lambda (H2: ((\forall (x: nat).(\forall (x0: T).((eq T u +(lift h x x0)) \to (\forall (c2: C).((drop h x c c2) \to (arity g c2 x0 +(asucc g a1))))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (H3: (arity g +(CHead c (Bind Abst) u) t0 a2)).(\lambda (H4: ((\forall (x: nat).(\forall +(x0: T).((eq T t0 (lift h x x0)) \to (\forall (c2: C).((drop h x (CHead c +(Bind Abst) u) c2) \to (arity g c2 x0 a2)))))))).(\lambda (x: nat).(\lambda +(x0: T).(\lambda (H5: (eq T (THead (Bind Abst) u t0) (lift h x x0))).(\lambda +(c2: C).(\lambda (H6: (drop h x c c2)).(ex3_2_ind T T (\lambda (y0: +T).(\lambda (z: T).(eq T x0 (THead (Bind Abst) y0 z)))) (\lambda (y0: +T).(\lambda (_: T).(eq T u (lift h x y0)))) (\lambda (_: T).(\lambda (z: +T).(eq T t0 (lift h (S x) z)))) (arity g c2 x0 (AHead a1 a2)) (\lambda (x1: +T).(\lambda (x2: T).(\lambda (H7: (eq T x0 (THead (Bind Abst) x1 +x2))).(\lambda (H8: (eq T u (lift h x x1))).(\lambda (H9: (eq T t0 (lift h (S +x) x2))).(eq_ind_r T (THead (Bind Abst) x1 x2) (\lambda (t1: T).(arity g c2 +t1 (AHead a1 a2))) (let H10 \def (eq_ind T t0 (\lambda (t1: T).(\forall (x3: +nat).(\forall (x4: T).((eq T t1 (lift h x3 x4)) \to (\forall (c3: C).((drop h +x3 (CHead c (Bind Abst) u) c3) \to (arity g c3 x4 a2))))))) H4 (lift h (S x) +x2) H9) in (let H11 \def (eq_ind T t0 (\lambda (t1: T).(arity g (CHead c +(Bind Abst) u) t1 a2)) H3 (lift h (S x) x2) H9) in (let H12 \def (eq_ind T u +(\lambda (t1: T).(arity g (CHead c (Bind Abst) t1) (lift h (S x) x2) a2)) H11 +(lift h x x1) H8) in (let H13 \def (eq_ind T u (\lambda (t1: T).(\forall (x3: +nat).(\forall (x4: T).((eq T (lift h (S x) x2) (lift h x3 x4)) \to (\forall +(c3: C).((drop h x3 (CHead c (Bind Abst) t1) c3) \to (arity g c3 x4 a2))))))) +H10 (lift h x x1) H8) in (let H14 \def (eq_ind T u (\lambda (t1: T).(\forall +(x3: nat).(\forall (x4: T).((eq T t1 (lift h x3 x4)) \to (\forall (c3: +C).((drop h x3 c c3) \to (arity g c3 x4 (asucc g a1)))))))) H2 (lift h x x1) +H8) in (let H15 \def (eq_ind T u (\lambda (t1: T).(arity g c t1 (asucc g +a1))) H1 (lift h x x1) H8) in (arity_head g c2 x1 a1 (H14 x x1 (refl_equal T +(lift h x x1)) c2 H6) x2 a2 (H13 (S x) x2 (refl_equal T (lift h (S x) x2)) +(CHead c2 (Bind Abst) x1) (drop_skip_bind h x c c2 H6 Abst x1))))))))) x0 +H7)))))) (lift_gen_bind Abst u t0 x0 h x H5)))))))))))))))) (\lambda (c: +C).(\lambda (u: T).(\lambda (a1: A).(\lambda (H1: (arity g c u a1)).(\lambda +(H2: ((\forall (x: nat).(\forall (x0: T).((eq T u (lift h x x0)) \to (\forall +(c2: C).((drop h x c c2) \to (arity g c2 x0 a1)))))))).(\lambda (t0: +T).(\lambda (a2: A).(\lambda (H3: (arity g c t0 (AHead a1 a2))).(\lambda (H4: +((\forall (x: nat).(\forall (x0: T).((eq T t0 (lift h x x0)) \to (\forall +(c2: C).((drop h x c c2) \to (arity g c2 x0 (AHead a1 a2))))))))).(\lambda +(x: nat).(\lambda (x0: T).(\lambda (H5: (eq T (THead (Flat Appl) u t0) (lift +h x x0))).(\lambda (c2: C).(\lambda (H6: (drop h x c c2)).(ex3_2_ind T T +(\lambda (y0: T).(\lambda (z: T).(eq T x0 (THead (Flat Appl) y0 z)))) +(\lambda (y0: T).(\lambda (_: T).(eq T u (lift h x y0)))) (\lambda (_: +T).(\lambda (z: T).(eq T t0 (lift h x z)))) (arity g c2 x0 a2) (\lambda (x1: +T).(\lambda (x2: T).(\lambda (H7: (eq T x0 (THead (Flat Appl) x1 +x2))).(\lambda (H8: (eq T u (lift h x x1))).(\lambda (H9: (eq T t0 (lift h x +x2))).(eq_ind_r T (THead (Flat Appl) x1 x2) (\lambda (t1: T).(arity g c2 t1 +a2)) (let H10 \def (eq_ind T t0 (\lambda (t1: T).(\forall (x3: nat).(\forall +(x4: T).((eq T t1 (lift h x3 x4)) \to (\forall (c3: C).((drop h x3 c c3) \to +(arity g c3 x4 (AHead a1 a2)))))))) H4 (lift h x x2) H9) in (let H11 \def +(eq_ind T t0 (\lambda (t1: T).(arity g c t1 (AHead a1 a2))) H3 (lift h x x2) +H9) in (let H12 \def (eq_ind T u (\lambda (t1: T).(\forall (x3: nat).(\forall +(x4: T).((eq T t1 (lift h x3 x4)) \to (\forall (c3: C).((drop h x3 c c3) \to +(arity g c3 x4 a1))))))) H2 (lift h x x1) H8) in (let H13 \def (eq_ind T u +(\lambda (t1: T).(arity g c t1 a1)) H1 (lift h x x1) H8) in (arity_appl g c2 +x1 a1 (H12 x x1 (refl_equal T (lift h x x1)) c2 H6) x2 a2 (H10 x x2 +(refl_equal T (lift h x x2)) c2 H6)))))) x0 H7)))))) (lift_gen_flat Appl u t0 +x0 h x H5)))))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (a0: +A).(\lambda (H1: (arity g c u (asucc g a0))).(\lambda (H2: ((\forall (x: +nat).(\forall (x0: T).((eq T u (lift h x x0)) \to (\forall (c2: C).((drop h x +c c2) \to (arity g c2 x0 (asucc g a0))))))))).(\lambda (t0: T).(\lambda (H3: +(arity g c t0 a0)).(\lambda (H4: ((\forall (x: nat).(\forall (x0: T).((eq T +t0 (lift h x x0)) \to (\forall (c2: C).((drop h x c c2) \to (arity g c2 x0 +a0)))))))).(\lambda (x: nat).(\lambda (x0: T).(\lambda (H5: (eq T (THead +(Flat Cast) u t0) (lift h x x0))).(\lambda (c2: C).(\lambda (H6: (drop h x c +c2)).(ex3_2_ind T T (\lambda (y0: T).(\lambda (z: T).(eq T x0 (THead (Flat +Cast) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T u (lift h x y0)))) +(\lambda (_: T).(\lambda (z: T).(eq T t0 (lift h x z)))) (arity g c2 x0 a0) +(\lambda (x1: T).(\lambda (x2: T).(\lambda (H7: (eq T x0 (THead (Flat Cast) +x1 x2))).(\lambda (H8: (eq T u (lift h x x1))).(\lambda (H9: (eq T t0 (lift h +x x2))).(eq_ind_r T (THead (Flat Cast) x1 x2) (\lambda (t1: T).(arity g c2 t1 +a0)) (let H10 \def (eq_ind T t0 (\lambda (t1: T).(\forall (x3: nat).(\forall +(x4: T).((eq T t1 (lift h x3 x4)) \to (\forall (c3: C).((drop h x3 c c3) \to +(arity g c3 x4 a0))))))) H4 (lift h x x2) H9) in (let H11 \def (eq_ind T t0 +(\lambda (t1: T).(arity g c t1 a0)) H3 (lift h x x2) H9) in (let H12 \def +(eq_ind T u (\lambda (t1: T).(\forall (x3: nat).(\forall (x4: T).((eq T t1 +(lift h x3 x4)) \to (\forall (c3: C).((drop h x3 c c3) \to (arity g c3 x4 +(asucc g a0)))))))) H2 (lift h x x1) H8) in (let H13 \def (eq_ind T u +(\lambda (t1: T).(arity g c t1 (asucc g a0))) H1 (lift h x x1) H8) in +(arity_cast g c2 x1 a0 (H12 x x1 (refl_equal T (lift h x x1)) c2 H6) x2 (H10 +x x2 (refl_equal T (lift h x x2)) c2 H6)))))) x0 H7)))))) (lift_gen_flat Cast +u t0 x0 h x H5))))))))))))))) (\lambda (c: C).(\lambda (t0: T).(\lambda (a1: +A).(\lambda (_: (arity g c t0 a1)).(\lambda (H2: ((\forall (x: nat).(\forall +(x0: T).((eq T t0 (lift h x x0)) \to (\forall (c2: C).((drop h x c c2) \to +(arity g c2 x0 a1)))))))).(\lambda (a2: A).(\lambda (H3: (leq g a1 +a2)).(\lambda (x: nat).(\lambda (x0: T).(\lambda (H4: (eq T t0 (lift h x +x0))).(\lambda (c2: C).(\lambda (H5: (drop h x c c2)).(arity_repl g c2 x0 a1 +(H2 x x0 H4 c2 H5) a2 H3))))))))))))) c1 y a H0))))) H))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/lift1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/lift1.ma new file mode 100644 index 000000000..46e4c8c86 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/lift1.ma @@ -0,0 +1,88 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/arity/lift1". + +include "arity/props.ma". + +include "drop1/defs.ma". + +theorem arity_lift1: + \forall (g: G).(\forall (a: A).(\forall (c2: C).(\forall (hds: +PList).(\forall (c1: C).(\forall (t: T).((drop1 hds c1 c2) \to ((arity g c2 t +a) \to (arity g c1 (lift1 hds t) a)))))))) +\def + \lambda (g: G).(\lambda (a: A).(\lambda (c2: C).(\lambda (hds: +PList).(PList_ind (\lambda (p: PList).(\forall (c1: C).(\forall (t: +T).((drop1 p c1 c2) \to ((arity g c2 t a) \to (arity g c1 (lift1 p t) a)))))) +(\lambda (c1: C).(\lambda (t: T).(\lambda (H: (drop1 PNil c1 c2)).(\lambda +(H0: (arity g c2 t a)).(let H1 \def (match H in drop1 return (\lambda (p: +PList).(\lambda (c: C).(\lambda (c0: C).(\lambda (_: (drop1 p c c0)).((eq +PList p PNil) \to ((eq C c c1) \to ((eq C c0 c2) \to (arity g c1 t a)))))))) +with [(drop1_nil c) \Rightarrow (\lambda (_: (eq PList PNil PNil)).(\lambda +(H2: (eq C c c1)).(\lambda (H3: (eq C c c2)).(eq_ind C c1 (\lambda (c0: +C).((eq C c0 c2) \to (arity g c1 t a))) (\lambda (H4: (eq C c1 c2)).(eq_ind C +c2 (\lambda (c0: C).(arity g c0 t a)) H0 c1 (sym_eq C c1 c2 H4))) c (sym_eq C +c c1 H2) H3)))) | (drop1_cons c0 c3 h d H1 c4 hds0 H2) \Rightarrow (\lambda +(H3: (eq PList (PCons h d hds0) PNil)).(\lambda (H4: (eq C c0 c1)).(\lambda +(H5: (eq C c4 c2)).((let H6 \def (eq_ind PList (PCons h d hds0) (\lambda (e: +PList).(match e in PList return (\lambda (_: PList).Prop) with [PNil +\Rightarrow False | (PCons _ _ _) \Rightarrow True])) I PNil H3) in +(False_ind ((eq C c0 c1) \to ((eq C c4 c2) \to ((drop h d c0 c3) \to ((drop1 +hds0 c3 c4) \to (arity g c1 t a))))) H6)) H4 H5 H1 H2))))]) in (H1 +(refl_equal PList PNil) (refl_equal C c1) (refl_equal C c2))))))) (\lambda +(n: nat).(\lambda (n0: nat).(\lambda (p: PList).(\lambda (H: ((\forall (c1: +C).(\forall (t: T).((drop1 p c1 c2) \to ((arity g c2 t a) \to (arity g c1 +(lift1 p t) a))))))).(\lambda (c1: C).(\lambda (t: T).(\lambda (H0: (drop1 +(PCons n n0 p) c1 c2)).(\lambda (H1: (arity g c2 t a)).(let H2 \def (match H0 +in drop1 return (\lambda (p0: PList).(\lambda (c: C).(\lambda (c0: +C).(\lambda (_: (drop1 p0 c c0)).((eq PList p0 (PCons n n0 p)) \to ((eq C c +c1) \to ((eq C c0 c2) \to (arity g c1 (lift n n0 (lift1 p t)) a)))))))) with +[(drop1_nil c) \Rightarrow (\lambda (H2: (eq PList PNil (PCons n n0 +p))).(\lambda (H3: (eq C c c1)).(\lambda (H4: (eq C c c2)).((let H5 \def +(eq_ind PList PNil (\lambda (e: PList).(match e in PList return (\lambda (_: +PList).Prop) with [PNil \Rightarrow True | (PCons _ _ _) \Rightarrow False])) +I (PCons n n0 p) H2) in (False_ind ((eq C c c1) \to ((eq C c c2) \to (arity g +c1 (lift n n0 (lift1 p t)) a))) H5)) H3 H4)))) | (drop1_cons c0 c3 h d H2 c4 +hds0 H3) \Rightarrow (\lambda (H4: (eq PList (PCons h d hds0) (PCons n n0 +p))).(\lambda (H5: (eq C c0 c1)).(\lambda (H6: (eq C c4 c2)).((let H7 \def +(f_equal PList PList (\lambda (e: PList).(match e in PList return (\lambda +(_: PList).PList) with [PNil \Rightarrow hds0 | (PCons _ _ p0) \Rightarrow +p0])) (PCons h d hds0) (PCons n n0 p) H4) in ((let H8 \def (f_equal PList nat +(\lambda (e: PList).(match e in PList return (\lambda (_: PList).nat) with +[PNil \Rightarrow d | (PCons _ n1 _) \Rightarrow n1])) (PCons h d hds0) +(PCons n n0 p) H4) in ((let H9 \def (f_equal PList nat (\lambda (e: +PList).(match e in PList return (\lambda (_: PList).nat) with [PNil +\Rightarrow h | (PCons n1 _ _) \Rightarrow n1])) (PCons h d hds0) (PCons n n0 +p) H4) in (eq_ind nat n (\lambda (n1: nat).((eq nat d n0) \to ((eq PList hds0 +p) \to ((eq C c0 c1) \to ((eq C c4 c2) \to ((drop n1 d c0 c3) \to ((drop1 +hds0 c3 c4) \to (arity g c1 (lift n n0 (lift1 p t)) a)))))))) (\lambda (H10: +(eq nat d n0)).(eq_ind nat n0 (\lambda (n1: nat).((eq PList hds0 p) \to ((eq +C c0 c1) \to ((eq C c4 c2) \to ((drop n n1 c0 c3) \to ((drop1 hds0 c3 c4) \to +(arity g c1 (lift n n0 (lift1 p t)) a))))))) (\lambda (H11: (eq PList hds0 +p)).(eq_ind PList p (\lambda (p0: PList).((eq C c0 c1) \to ((eq C c4 c2) \to +((drop n n0 c0 c3) \to ((drop1 p0 c3 c4) \to (arity g c1 (lift n n0 (lift1 p +t)) a)))))) (\lambda (H12: (eq C c0 c1)).(eq_ind C c1 (\lambda (c: C).((eq C +c4 c2) \to ((drop n n0 c c3) \to ((drop1 p c3 c4) \to (arity g c1 (lift n n0 +(lift1 p t)) a))))) (\lambda (H13: (eq C c4 c2)).(eq_ind C c2 (\lambda (c: +C).((drop n n0 c1 c3) \to ((drop1 p c3 c) \to (arity g c1 (lift n n0 (lift1 p +t)) a)))) (\lambda (H14: (drop n n0 c1 c3)).(\lambda (H15: (drop1 p c3 +c2)).(arity_lift g c3 (lift1 p t) a (H c3 t H15 H1) c1 n n0 H14))) c4 (sym_eq +C c4 c2 H13))) c0 (sym_eq C c0 c1 H12))) hds0 (sym_eq PList hds0 p H11))) d +(sym_eq nat d n0 H10))) h (sym_eq nat h n H9))) H8)) H7)) H5 H6 H2 H3))))]) +in (H2 (refl_equal PList (PCons n n0 p)) (refl_equal C c1) (refl_equal C +c2))))))))))) hds)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/pr3.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/pr3.ma new file mode 100644 index 000000000..7b60c2af4 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/pr3.ma @@ -0,0 +1,625 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/arity/pr3". + +include "csuba/arity.ma". + +include "pr3/defs.ma". + +include "pr1/defs.ma". + +include "wcpr0/getl.ma". + +include "pr0/fwd.ma". + +include "arity/subst0.ma". + +theorem arity_sred_wcpr0_pr0: + \forall (g: G).(\forall (c1: C).(\forall (t1: T).(\forall (a: A).((arity g +c1 t1 a) \to (\forall (c2: C).((wcpr0 c1 c2) \to (\forall (t2: T).((pr0 t1 +t2) \to (arity g c2 t2 a))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t1: T).(\lambda (a: A).(\lambda +(H: (arity g c1 t1 a)).(arity_ind g (\lambda (c: C).(\lambda (t: T).(\lambda +(a0: A).(\forall (c2: C).((wcpr0 c c2) \to (\forall (t2: T).((pr0 t t2) \to +(arity g c2 t2 a0)))))))) (\lambda (c: C).(\lambda (n: nat).(\lambda (c2: +C).(\lambda (_: (wcpr0 c c2)).(\lambda (t2: T).(\lambda (H1: (pr0 (TSort n) +t2)).(eq_ind_r T (TSort n) (\lambda (t: T).(arity g c2 t (ASort O n))) +(arity_sort g c2 n) t2 (pr0_gen_sort t2 n H1)))))))) (\lambda (c: C).(\lambda +(d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i c (CHead d +(Bind Abbr) u))).(\lambda (a0: A).(\lambda (_: (arity g d u a0)).(\lambda +(H2: ((\forall (c2: C).((wcpr0 d c2) \to (\forall (t2: T).((pr0 u t2) \to +(arity g c2 t2 a0))))))).(\lambda (c2: C).(\lambda (H3: (wcpr0 c +c2)).(\lambda (t2: T).(\lambda (H4: (pr0 (TLRef i) t2)).(eq_ind_r T (TLRef i) +(\lambda (t: T).(arity g c2 t a0)) (ex3_2_ind C T (\lambda (e2: C).(\lambda +(u2: T).(getl i c2 (CHead e2 (Bind Abbr) u2)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 d e2))) (\lambda (_: C).(\lambda (u2: T).(pr0 u u2))) (arity g c2 +(TLRef i) a0) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H5: (getl i c2 +(CHead x0 (Bind Abbr) x1))).(\lambda (H6: (wcpr0 d x0)).(\lambda (H7: (pr0 u +x1)).(arity_abbr g c2 x0 x1 i H5 a0 (H2 x0 H6 x1 H7))))))) (wcpr0_getl c c2 +H3 i d u (Bind Abbr) H0)) t2 (pr0_gen_lref t2 i H4)))))))))))))) (\lambda (c: +C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i c +(CHead d (Bind Abst) u))).(\lambda (a0: A).(\lambda (_: (arity g d u (asucc g +a0))).(\lambda (H2: ((\forall (c2: C).((wcpr0 d c2) \to (\forall (t2: +T).((pr0 u t2) \to (arity g c2 t2 (asucc g a0)))))))).(\lambda (c2: +C).(\lambda (H3: (wcpr0 c c2)).(\lambda (t2: T).(\lambda (H4: (pr0 (TLRef i) +t2)).(eq_ind_r T (TLRef i) (\lambda (t: T).(arity g c2 t a0)) (ex3_2_ind C T +(\lambda (e2: C).(\lambda (u2: T).(getl i c2 (CHead e2 (Bind Abst) u2)))) +(\lambda (e2: C).(\lambda (_: T).(wcpr0 d e2))) (\lambda (_: C).(\lambda (u2: +T).(pr0 u u2))) (arity g c2 (TLRef i) a0) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (H5: (getl i c2 (CHead x0 (Bind Abst) x1))).(\lambda (H6: (wcpr0 +d x0)).(\lambda (H7: (pr0 u x1)).(arity_abst g c2 x0 x1 i H5 a0 (H2 x0 H6 x1 +H7))))))) (wcpr0_getl c c2 H3 i d u (Bind Abst) H0)) t2 (pr0_gen_lref t2 i +H4)))))))))))))) (\lambda (b: B).(\lambda (H0: (not (eq B b Abst))).(\lambda +(c: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (_: (arity g c u +a1)).(\lambda (H2: ((\forall (c2: C).((wcpr0 c c2) \to (\forall (t2: T).((pr0 +u t2) \to (arity g c2 t2 a1))))))).(\lambda (t: T).(\lambda (a2: A).(\lambda +(H3: (arity g (CHead c (Bind b) u) t a2)).(\lambda (H4: ((\forall (c2: +C).((wcpr0 (CHead c (Bind b) u) c2) \to (\forall (t2: T).((pr0 t t2) \to +(arity g c2 t2 a2))))))).(\lambda (c2: C).(\lambda (H5: (wcpr0 c +c2)).(\lambda (t2: T).(\lambda (H6: (pr0 (THead (Bind b) u t) t2)).(insert_eq +T (THead (Bind b) u t) (\lambda (t0: T).(pr0 t0 t2)) (arity g c2 t2 a2) +(\lambda (y: T).(\lambda (H7: (pr0 y t2)).(pr0_ind (\lambda (t0: T).(\lambda +(t3: T).((eq T t0 (THead (Bind b) u t)) \to (arity g c2 t3 a2)))) (\lambda +(t0: T).(\lambda (H8: (eq T t0 (THead (Bind b) u t))).(let H9 \def (f_equal T +T (\lambda (e: T).e) t0 (THead (Bind b) u t) H8) in (eq_ind_r T (THead (Bind +b) u t) (\lambda (t3: T).(arity g c2 t3 a2)) (arity_bind g b H0 c2 u a1 (H2 +c2 H5 u (pr0_refl u)) t a2 (H4 (CHead c2 (Bind b) u) (wcpr0_comp c c2 H5 u u +(pr0_refl u) (Bind b)) t (pr0_refl t))) t0 H9)))) (\lambda (u1: T).(\lambda +(u2: T).(\lambda (H8: (pr0 u1 u2)).(\lambda (H9: (((eq T u1 (THead (Bind b) u +t)) \to (arity g c2 u2 a2)))).(\lambda (t3: T).(\lambda (t4: T).(\lambda +(H10: (pr0 t3 t4)).(\lambda (H11: (((eq T t3 (THead (Bind b) u t)) \to (arity +g c2 t4 a2)))).(\lambda (k: K).(\lambda (H12: (eq T (THead k u1 t3) (THead +(Bind b) u t))).(let H13 \def (f_equal T K (\lambda (e: T).(match e in T +return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k u1 t3) (THead (Bind +b) u t) H12) in ((let H14 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | (TLRef _) +\Rightarrow u1 | (THead _ t0 _) \Rightarrow t0])) (THead k u1 t3) (THead +(Bind b) u t) H12) in ((let H15 \def (f_equal T T (\lambda (e: T).(match e in +T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) +\Rightarrow t3 | (THead _ _ t0) \Rightarrow t0])) (THead k u1 t3) (THead +(Bind b) u t) H12) in (\lambda (H16: (eq T u1 u)).(\lambda (H17: (eq K k +(Bind b))).(eq_ind_r K (Bind b) (\lambda (k0: K).(arity g c2 (THead k0 u2 t4) +a2)) (let H18 \def (eq_ind T t3 (\lambda (t0: T).((eq T t0 (THead (Bind b) u +t)) \to (arity g c2 t4 a2))) H11 t H15) in (let H19 \def (eq_ind T t3 +(\lambda (t0: T).(pr0 t0 t4)) H10 t H15) in (let H20 \def (eq_ind T u1 +(\lambda (t0: T).((eq T t0 (THead (Bind b) u t)) \to (arity g c2 u2 a2))) H9 +u H16) in (let H21 \def (eq_ind T u1 (\lambda (t0: T).(pr0 t0 u2)) H8 u H16) +in (arity_bind g b H0 c2 u2 a1 (H2 c2 H5 u2 H21) t4 a2 (H4 (CHead c2 (Bind b) +u2) (wcpr0_comp c c2 H5 u u2 H21 (Bind b)) t4 H19)))))) k H17)))) H14)) +H13)))))))))))) (\lambda (u0: T).(\lambda (v1: T).(\lambda (v2: T).(\lambda +(_: (pr0 v1 v2)).(\lambda (_: (((eq T v1 (THead (Bind b) u t)) \to (arity g +c2 v2 a2)))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (_: (pr0 t3 +t4)).(\lambda (_: (((eq T t3 (THead (Bind b) u t)) \to (arity g c2 t4 +a2)))).(\lambda (H12: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) u0 t3)) +(THead (Bind b) u t))).(let H13 \def (eq_ind T (THead (Flat Appl) v1 (THead +(Bind Abst) u0 t3)) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind +b) u t) H12) in (False_ind (arity g c2 (THead (Bind Abbr) v2 t4) a2) +H13)))))))))))) (\lambda (b0: B).(\lambda (_: (not (eq B b0 Abst))).(\lambda +(v1: T).(\lambda (v2: T).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (((eq T v1 +(THead (Bind b) u t)) \to (arity g c2 v2 a2)))).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (_: (pr0 u1 u2)).(\lambda (_: (((eq T u1 (THead (Bind b) u +t)) \to (arity g c2 u2 a2)))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (_: +(pr0 t3 t4)).(\lambda (_: (((eq T t3 (THead (Bind b) u t)) \to (arity g c2 t4 +a2)))).(\lambda (H15: (eq T (THead (Flat Appl) v1 (THead (Bind b0) u1 t3)) +(THead (Bind b) u t))).(let H16 \def (eq_ind T (THead (Flat Appl) v1 (THead +(Bind b0) u1 t3)) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind +b) u t) H15) in (False_ind (arity g c2 (THead (Bind b0) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) a2) H16))))))))))))))))) (\lambda (u1: T).(\lambda +(u2: T).(\lambda (H8: (pr0 u1 u2)).(\lambda (H9: (((eq T u1 (THead (Bind b) u +t)) \to (arity g c2 u2 a2)))).(\lambda (t3: T).(\lambda (t4: T).(\lambda +(H10: (pr0 t3 t4)).(\lambda (H11: (((eq T t3 (THead (Bind b) u t)) \to (arity +g c2 t4 a2)))).(\lambda (w: T).(\lambda (H12: (subst0 O u2 t4 w)).(\lambda +(H13: (eq T (THead (Bind Abbr) u1 t3) (THead (Bind b) u t))).(let H14 \def +(f_equal T B (\lambda (e: T).(match e in T return (\lambda (_: T).B) with +[(TSort _) \Rightarrow Abbr | (TLRef _) \Rightarrow Abbr | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (THead (Bind Abbr) u1 t3) +(THead (Bind b) u t) H13) in ((let H15 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | +(TLRef _) \Rightarrow u1 | (THead _ t0 _) \Rightarrow t0])) (THead (Bind +Abbr) u1 t3) (THead (Bind b) u t) H13) in ((let H16 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t0) \Rightarrow t0])) +(THead (Bind Abbr) u1 t3) (THead (Bind b) u t) H13) in (\lambda (H17: (eq T +u1 u)).(\lambda (H18: (eq B Abbr b)).(let H19 \def (eq_ind T t3 (\lambda (t0: +T).((eq T t0 (THead (Bind b) u t)) \to (arity g c2 t4 a2))) H11 t H16) in +(let H20 \def (eq_ind T t3 (\lambda (t0: T).(pr0 t0 t4)) H10 t H16) in (let +H21 \def (eq_ind T u1 (\lambda (t0: T).((eq T t0 (THead (Bind b) u t)) \to +(arity g c2 u2 a2))) H9 u H17) in (let H22 \def (eq_ind T u1 (\lambda (t0: +T).(pr0 t0 u2)) H8 u H17) in (let H23 \def (eq_ind_r B b (\lambda (b0: +B).((eq T t (THead (Bind b0) u t)) \to (arity g c2 t4 a2))) H19 Abbr H18) in +(let H24 \def (eq_ind_r B b (\lambda (b0: B).((eq T u (THead (Bind b0) u t)) +\to (arity g c2 u2 a2))) H21 Abbr H18) in (let H25 \def (eq_ind_r B b +(\lambda (b0: B).(\forall (c3: C).((wcpr0 (CHead c (Bind b0) u) c3) \to +(\forall (t5: T).((pr0 t t5) \to (arity g c3 t5 a2)))))) H4 Abbr H18) in (let +H26 \def (eq_ind_r B b (\lambda (b0: B).(arity g (CHead c (Bind b0) u) t a2)) +H3 Abbr H18) in (let H27 \def (eq_ind_r B b (\lambda (b0: B).(not (eq B b0 +Abst))) H0 Abbr H18) in (arity_bind g Abbr H27 c2 u2 a1 (H2 c2 H5 u2 H22) w +a2 (arity_subst0 g (CHead c2 (Bind Abbr) u2) t4 a2 (H25 (CHead c2 (Bind Abbr) +u2) (wcpr0_comp c c2 H5 u u2 H22 (Bind Abbr)) t4 H20) c2 u2 O (getl_refl Abbr +c2 u2) w H12)))))))))))))) H15)) H14))))))))))))) (\lambda (b0: B).(\lambda +(H8: (not (eq B b0 Abst))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H9: +(pr0 t3 t4)).(\lambda (H10: (((eq T t3 (THead (Bind b) u t)) \to (arity g c2 +t4 a2)))).(\lambda (u0: T).(\lambda (H11: (eq T (THead (Bind b0) u0 (lift (S +O) O t3)) (THead (Bind b) u t))).(let H12 \def (f_equal T B (\lambda (e: +T).(match e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b0 | +(TLRef _) \Rightarrow b0 | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) \Rightarrow +b0])])) (THead (Bind b0) u0 (lift (S O) O t3)) (THead (Bind b) u t) H11) in +((let H13 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t0 +_) \Rightarrow t0])) (THead (Bind b0) u0 (lift (S O) O t3)) (THead (Bind b) u +t) H11) in ((let H14 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map (f: ((nat +\to nat))) (d: nat) (t0: T) on t0: T \def (match t0 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u1 t5) +\Rightarrow (THead k (lref_map f d u1) (lref_map f (s k d) t5))]) in +lref_map) (\lambda (x: nat).(plus x (S O))) O t3) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match +t0 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k u1 t5) \Rightarrow (THead k (lref_map f d u1) (lref_map f (s k d) +t5))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t3) | (THead _ _ t0) +\Rightarrow t0])) (THead (Bind b0) u0 (lift (S O) O t3)) (THead (Bind b) u t) +H11) in (\lambda (_: (eq T u0 u)).(\lambda (H16: (eq B b0 b)).(let H17 \def +(eq_ind B b0 (\lambda (b1: B).(not (eq B b1 Abst))) H8 b H16) in (let H18 +\def (eq_ind_r T t (\lambda (t0: T).((eq T t3 (THead (Bind b) u t0)) \to +(arity g c2 t4 a2))) H10 (lift (S O) O t3) H14) in (let H19 \def (eq_ind_r T +t (\lambda (t0: T).(\forall (c3: C).((wcpr0 (CHead c (Bind b) u) c3) \to +(\forall (t5: T).((pr0 t0 t5) \to (arity g c3 t5 a2)))))) H4 (lift (S O) O +t3) H14) in (let H20 \def (eq_ind_r T t (\lambda (t0: T).(arity g (CHead c +(Bind b) u) t0 a2)) H3 (lift (S O) O t3) H14) in (arity_gen_lift g (CHead c2 +(Bind b) u) t4 a2 (S O) O (H19 (CHead c2 (Bind b) u) (wcpr0_comp c c2 H5 u u +(pr0_refl u) (Bind b)) (lift (S O) O t4) (pr0_lift t3 t4 H9 (S O) O)) c2 +(drop_drop (Bind b) O c2 c2 (drop_refl c2) u))))))))) H13)) H12)))))))))) +(\lambda (t3: T).(\lambda (t4: T).(\lambda (_: (pr0 t3 t4)).(\lambda (_: +(((eq T t3 (THead (Bind b) u t)) \to (arity g c2 t4 a2)))).(\lambda (u0: +T).(\lambda (H10: (eq T (THead (Flat Cast) u0 t3) (THead (Bind b) u t))).(let +H11 \def (eq_ind T (THead (Flat Cast) u0 t3) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind b) u t) H10) in (False_ind (arity g c2 t4 a2) +H11)))))))) y t2 H7))) H6)))))))))))))))) (\lambda (c: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c u (asucc g a1))).(\lambda (H1: +((\forall (c2: C).((wcpr0 c c2) \to (\forall (t2: T).((pr0 u t2) \to (arity g +c2 t2 (asucc g a1)))))))).(\lambda (t: T).(\lambda (a2: A).(\lambda (H2: +(arity g (CHead c (Bind Abst) u) t a2)).(\lambda (H3: ((\forall (c2: +C).((wcpr0 (CHead c (Bind Abst) u) c2) \to (\forall (t2: T).((pr0 t t2) \to +(arity g c2 t2 a2))))))).(\lambda (c2: C).(\lambda (H4: (wcpr0 c +c2)).(\lambda (t2: T).(\lambda (H5: (pr0 (THead (Bind Abst) u t) +t2)).(insert_eq T (THead (Bind Abst) u t) (\lambda (t0: T).(pr0 t0 t2)) +(arity g c2 t2 (AHead a1 a2)) (\lambda (y: T).(\lambda (H6: (pr0 y +t2)).(pr0_ind (\lambda (t0: T).(\lambda (t3: T).((eq T t0 (THead (Bind Abst) +u t)) \to (arity g c2 t3 (AHead a1 a2))))) (\lambda (t0: T).(\lambda (H7: (eq +T t0 (THead (Bind Abst) u t))).(let H8 \def (f_equal T T (\lambda (e: T).e) +t0 (THead (Bind Abst) u t) H7) in (eq_ind_r T (THead (Bind Abst) u t) +(\lambda (t3: T).(arity g c2 t3 (AHead a1 a2))) (arity_head g c2 u a1 (H1 c2 +H4 u (pr0_refl u)) t a2 (H3 (CHead c2 (Bind Abst) u) (wcpr0_comp c c2 H4 u u +(pr0_refl u) (Bind Abst)) t (pr0_refl t))) t0 H8)))) (\lambda (u1: +T).(\lambda (u2: T).(\lambda (H7: (pr0 u1 u2)).(\lambda (H8: (((eq T u1 +(THead (Bind Abst) u t)) \to (arity g c2 u2 (AHead a1 a2))))).(\lambda (t3: +T).(\lambda (t4: T).(\lambda (H9: (pr0 t3 t4)).(\lambda (H10: (((eq T t3 +(THead (Bind Abst) u t)) \to (arity g c2 t4 (AHead a1 a2))))).(\lambda (k: +K).(\lambda (H11: (eq T (THead k u1 t3) (THead (Bind Abst) u t))).(let H12 +\def (f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) +with [(TSort _) \Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) +\Rightarrow k0])) (THead k u1 t3) (THead (Bind Abst) u t) H11) in ((let H13 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ t0 _) +\Rightarrow t0])) (THead k u1 t3) (THead (Bind Abst) u t) H11) in ((let H14 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t0) +\Rightarrow t0])) (THead k u1 t3) (THead (Bind Abst) u t) H11) in (\lambda +(H15: (eq T u1 u)).(\lambda (H16: (eq K k (Bind Abst))).(eq_ind_r K (Bind +Abst) (\lambda (k0: K).(arity g c2 (THead k0 u2 t4) (AHead a1 a2))) (let H17 +\def (eq_ind T t3 (\lambda (t0: T).((eq T t0 (THead (Bind Abst) u t)) \to +(arity g c2 t4 (AHead a1 a2)))) H10 t H14) in (let H18 \def (eq_ind T t3 +(\lambda (t0: T).(pr0 t0 t4)) H9 t H14) in (let H19 \def (eq_ind T u1 +(\lambda (t0: T).((eq T t0 (THead (Bind Abst) u t)) \to (arity g c2 u2 (AHead +a1 a2)))) H8 u H15) in (let H20 \def (eq_ind T u1 (\lambda (t0: T).(pr0 t0 +u2)) H7 u H15) in (arity_head g c2 u2 a1 (H1 c2 H4 u2 H20) t4 a2 (H3 (CHead +c2 (Bind Abst) u2) (wcpr0_comp c c2 H4 u u2 H20 (Bind Abst)) t4 H18)))))) k +H16)))) H13)) H12)))))))))))) (\lambda (u0: T).(\lambda (v1: T).(\lambda (v2: +T).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (((eq T v1 (THead (Bind Abst) u t)) +\to (arity g c2 v2 (AHead a1 a2))))).(\lambda (t3: T).(\lambda (t4: +T).(\lambda (_: (pr0 t3 t4)).(\lambda (_: (((eq T t3 (THead (Bind Abst) u t)) +\to (arity g c2 t4 (AHead a1 a2))))).(\lambda (H11: (eq T (THead (Flat Appl) +v1 (THead (Bind Abst) u0 t3)) (THead (Bind Abst) u t))).(let H12 \def (eq_ind +T (THead (Flat Appl) v1 (THead (Bind Abst) u0 t3)) (\lambda (ee: T).(match ee +in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef +_) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind Abst) u t) H11) in (False_ind (arity g c2 (THead +(Bind Abbr) v2 t4) (AHead a1 a2)) H12)))))))))))) (\lambda (b: B).(\lambda +(_: (not (eq B b Abst))).(\lambda (v1: T).(\lambda (v2: T).(\lambda (_: (pr0 +v1 v2)).(\lambda (_: (((eq T v1 (THead (Bind Abst) u t)) \to (arity g c2 v2 +(AHead a1 a2))))).(\lambda (u1: T).(\lambda (u2: T).(\lambda (_: (pr0 u1 +u2)).(\lambda (_: (((eq T u1 (THead (Bind Abst) u t)) \to (arity g c2 u2 +(AHead a1 a2))))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (_: (pr0 t3 +t4)).(\lambda (_: (((eq T t3 (THead (Bind Abst) u t)) \to (arity g c2 t4 +(AHead a1 a2))))).(\lambda (H14: (eq T (THead (Flat Appl) v1 (THead (Bind b) +u1 t3)) (THead (Bind Abst) u t))).(let H15 \def (eq_ind T (THead (Flat Appl) +v1 (THead (Bind b) u1 t3)) (\lambda (ee: T).(match ee in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False +| (THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind +Abst) u t) H14) in (False_ind (arity g c2 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) (AHead a1 a2)) H15))))))))))))))))) (\lambda +(u1: T).(\lambda (u2: T).(\lambda (_: (pr0 u1 u2)).(\lambda (_: (((eq T u1 +(THead (Bind Abst) u t)) \to (arity g c2 u2 (AHead a1 a2))))).(\lambda (t3: +T).(\lambda (t4: T).(\lambda (_: (pr0 t3 t4)).(\lambda (_: (((eq T t3 (THead +(Bind Abst) u t)) \to (arity g c2 t4 (AHead a1 a2))))).(\lambda (w: +T).(\lambda (_: (subst0 O u2 t4 w)).(\lambda (H12: (eq T (THead (Bind Abbr) +u1 t3) (THead (Bind Abst) u t))).(let H13 \def (eq_ind T (THead (Bind Abbr) +u1 t3) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +True | Abst \Rightarrow False | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (THead (Bind Abst) u t) H12) in (False_ind (arity g +c2 (THead (Bind Abbr) u2 w) (AHead a1 a2)) H13))))))))))))) (\lambda (b: +B).(\lambda (H7: (not (eq B b Abst))).(\lambda (t3: T).(\lambda (t4: +T).(\lambda (_: (pr0 t3 t4)).(\lambda (H9: (((eq T t3 (THead (Bind Abst) u +t)) \to (arity g c2 t4 (AHead a1 a2))))).(\lambda (u0: T).(\lambda (H10: (eq +T (THead (Bind b) u0 (lift (S O) O t3)) (THead (Bind Abst) u t))).(let H11 +\def (f_equal T B (\lambda (e: T).(match e in T return (\lambda (_: T).B) +with [(TSort _) \Rightarrow b | (TLRef _) \Rightarrow b | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow b])])) (THead (Bind b) u0 (lift (S O) O +t3)) (THead (Bind Abst) u t) H10) in ((let H12 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | +(TLRef _) \Rightarrow u0 | (THead _ t0 _) \Rightarrow t0])) (THead (Bind b) +u0 (lift (S O) O t3)) (THead (Bind Abst) u t) H10) in ((let H13 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t0: T) on t0: T +\def (match t0 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k u1 t5) \Rightarrow (THead k (lref_map f d u1) (lref_map f (s k d) +t5))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t3) | (TLRef _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t0: T) on t0: T +\def (match t0 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k u1 t5) \Rightarrow (THead k (lref_map f d u1) (lref_map f (s k d) +t5))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t3) | (THead _ _ t0) +\Rightarrow t0])) (THead (Bind b) u0 (lift (S O) O t3)) (THead (Bind Abst) u +t) H10) in (\lambda (_: (eq T u0 u)).(\lambda (H15: (eq B b Abst)).(let H16 +\def (eq_ind B b (\lambda (b0: B).(not (eq B b0 Abst))) H7 Abst H15) in (let +H17 \def (eq_ind_r T t (\lambda (t0: T).((eq T t3 (THead (Bind Abst) u t0)) +\to (arity g c2 t4 (AHead a1 a2)))) H9 (lift (S O) O t3) H13) in (let H18 +\def (eq_ind_r T t (\lambda (t0: T).(\forall (c3: C).((wcpr0 (CHead c (Bind +Abst) u) c3) \to (\forall (t5: T).((pr0 t0 t5) \to (arity g c3 t5 a2)))))) H3 +(lift (S O) O t3) H13) in (let H19 \def (eq_ind_r T t (\lambda (t0: T).(arity +g (CHead c (Bind Abst) u) t0 a2)) H2 (lift (S O) O t3) H13) in (let H20 \def +(match (H16 (refl_equal B Abst)) in False return (\lambda (_: False).(arity g +c2 t4 (AHead a1 a2))) with []) in H20)))))))) H12)) H11)))))))))) (\lambda +(t3: T).(\lambda (t4: T).(\lambda (_: (pr0 t3 t4)).(\lambda (_: (((eq T t3 +(THead (Bind Abst) u t)) \to (arity g c2 t4 (AHead a1 a2))))).(\lambda (u0: +T).(\lambda (H9: (eq T (THead (Flat Cast) u0 t3) (THead (Bind Abst) u +t))).(let H10 \def (eq_ind T (THead (Flat Cast) u0 t3) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind Abst) u t) H9) in (False_ind (arity g c2 +t4 (AHead a1 a2)) H10)))))))) y t2 H6))) H5)))))))))))))) (\lambda (c: +C).(\lambda (u: T).(\lambda (a1: A).(\lambda (_: (arity g c u a1)).(\lambda +(H1: ((\forall (c2: C).((wcpr0 c c2) \to (\forall (t2: T).((pr0 u t2) \to +(arity g c2 t2 a1))))))).(\lambda (t: T).(\lambda (a2: A).(\lambda (H2: +(arity g c t (AHead a1 a2))).(\lambda (H3: ((\forall (c2: C).((wcpr0 c c2) +\to (\forall (t2: T).((pr0 t t2) \to (arity g c2 t2 (AHead a1 +a2)))))))).(\lambda (c2: C).(\lambda (H4: (wcpr0 c c2)).(\lambda (t2: +T).(\lambda (H5: (pr0 (THead (Flat Appl) u t) t2)).(insert_eq T (THead (Flat +Appl) u t) (\lambda (t0: T).(pr0 t0 t2)) (arity g c2 t2 a2) (\lambda (y: +T).(\lambda (H6: (pr0 y t2)).(pr0_ind (\lambda (t0: T).(\lambda (t3: T).((eq +T t0 (THead (Flat Appl) u t)) \to (arity g c2 t3 a2)))) (\lambda (t0: +T).(\lambda (H7: (eq T t0 (THead (Flat Appl) u t))).(let H8 \def (f_equal T T +(\lambda (e: T).e) t0 (THead (Flat Appl) u t) H7) in (eq_ind_r T (THead (Flat +Appl) u t) (\lambda (t3: T).(arity g c2 t3 a2)) (arity_appl g c2 u a1 (H1 c2 +H4 u (pr0_refl u)) t a2 (H3 c2 H4 t (pr0_refl t))) t0 H8)))) (\lambda (u1: +T).(\lambda (u2: T).(\lambda (H7: (pr0 u1 u2)).(\lambda (H8: (((eq T u1 +(THead (Flat Appl) u t)) \to (arity g c2 u2 a2)))).(\lambda (t3: T).(\lambda +(t4: T).(\lambda (H9: (pr0 t3 t4)).(\lambda (H10: (((eq T t3 (THead (Flat +Appl) u t)) \to (arity g c2 t4 a2)))).(\lambda (k: K).(\lambda (H11: (eq T +(THead k u1 t3) (THead (Flat Appl) u t))).(let H12 \def (f_equal T K (\lambda +(e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k +| (TLRef _) \Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k u1 t3) +(THead (Flat Appl) u t) H11) in ((let H13 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | +(TLRef _) \Rightarrow u1 | (THead _ t0 _) \Rightarrow t0])) (THead k u1 t3) +(THead (Flat Appl) u t) H11) in ((let H14 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | +(TLRef _) \Rightarrow t3 | (THead _ _ t0) \Rightarrow t0])) (THead k u1 t3) +(THead (Flat Appl) u t) H11) in (\lambda (H15: (eq T u1 u)).(\lambda (H16: +(eq K k (Flat Appl))).(eq_ind_r K (Flat Appl) (\lambda (k0: K).(arity g c2 +(THead k0 u2 t4) a2)) (let H17 \def (eq_ind T t3 (\lambda (t0: T).((eq T t0 +(THead (Flat Appl) u t)) \to (arity g c2 t4 a2))) H10 t H14) in (let H18 \def +(eq_ind T t3 (\lambda (t0: T).(pr0 t0 t4)) H9 t H14) in (let H19 \def (eq_ind +T u1 (\lambda (t0: T).((eq T t0 (THead (Flat Appl) u t)) \to (arity g c2 u2 +a2))) H8 u H15) in (let H20 \def (eq_ind T u1 (\lambda (t0: T).(pr0 t0 u2)) +H7 u H15) in (arity_appl g c2 u2 a1 (H1 c2 H4 u2 H20) t4 a2 (H3 c2 H4 t4 +H18)))))) k H16)))) H13)) H12)))))))))))) (\lambda (u0: T).(\lambda (v1: +T).(\lambda (v2: T).(\lambda (H7: (pr0 v1 v2)).(\lambda (H8: (((eq T v1 +(THead (Flat Appl) u t)) \to (arity g c2 v2 a2)))).(\lambda (t3: T).(\lambda +(t4: T).(\lambda (H9: (pr0 t3 t4)).(\lambda (H10: (((eq T t3 (THead (Flat +Appl) u t)) \to (arity g c2 t4 a2)))).(\lambda (H11: (eq T (THead (Flat Appl) +v1 (THead (Bind Abst) u0 t3)) (THead (Flat Appl) u t))).(let H12 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow v1 | (TLRef _) \Rightarrow v1 | (THead _ t0 _) +\Rightarrow t0])) (THead (Flat Appl) v1 (THead (Bind Abst) u0 t3)) (THead +(Flat Appl) u t) H11) in ((let H13 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow (THead (Bind Abst) +u0 t3) | (TLRef _) \Rightarrow (THead (Bind Abst) u0 t3) | (THead _ _ t0) +\Rightarrow t0])) (THead (Flat Appl) v1 (THead (Bind Abst) u0 t3)) (THead +(Flat Appl) u t) H11) in (\lambda (H14: (eq T v1 u)).(let H15 \def (eq_ind T +v1 (\lambda (t0: T).((eq T t0 (THead (Flat Appl) u t)) \to (arity g c2 v2 +a2))) H8 u H14) in (let H16 \def (eq_ind T v1 (\lambda (t0: T).(pr0 t0 v2)) +H7 u H14) in (let H17 \def (eq_ind_r T t (\lambda (t0: T).((eq T t3 (THead +(Flat Appl) u t0)) \to (arity g c2 t4 a2))) H10 (THead (Bind Abst) u0 t3) +H13) in (let H18 \def (eq_ind_r T t (\lambda (t0: T).((eq T u (THead (Flat +Appl) u t0)) \to (arity g c2 v2 a2))) H15 (THead (Bind Abst) u0 t3) H13) in +(let H19 \def (eq_ind_r T t (\lambda (t0: T).(\forall (c3: C).((wcpr0 c c3) +\to (\forall (t5: T).((pr0 t0 t5) \to (arity g c3 t5 (AHead a1 a2))))))) H3 +(THead (Bind Abst) u0 t3) H13) in (let H20 \def (eq_ind_r T t (\lambda (t0: +T).(arity g c t0 (AHead a1 a2))) H2 (THead (Bind Abst) u0 t3) H13) in (let +H21 \def (H1 c2 H4 v2 H16) in (let H22 \def (H19 c2 H4 (THead (Bind Abst) u0 +t4) (pr0_comp u0 u0 (pr0_refl u0) t3 t4 H9 (Bind Abst))) in (let H23 \def +(arity_gen_abst g c2 u0 t4 (AHead a1 a2) H22) in (ex3_2_ind A A (\lambda (a3: +A).(\lambda (a4: A).(eq A (AHead a1 a2) (AHead a3 a4)))) (\lambda (a3: +A).(\lambda (_: A).(arity g c2 u0 (asucc g a3)))) (\lambda (_: A).(\lambda +(a4: A).(arity g (CHead c2 (Bind Abst) u0) t4 a4))) (arity g c2 (THead (Bind +Abbr) v2 t4) a2) (\lambda (x0: A).(\lambda (x1: A).(\lambda (H24: (eq A +(AHead a1 a2) (AHead x0 x1))).(\lambda (H25: (arity g c2 u0 (asucc g +x0))).(\lambda (H26: (arity g (CHead c2 (Bind Abst) u0) t4 x1)).(let H27 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a1 | (AHead a0 _) \Rightarrow a0])) (AHead a1 a2) +(AHead x0 x1) H24) in ((let H28 \def (f_equal A A (\lambda (e: A).(match e in +A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a2 | (AHead _ a0) +\Rightarrow a0])) (AHead a1 a2) (AHead x0 x1) H24) in (\lambda (H29: (eq A a1 +x0)).(let H30 \def (eq_ind_r A x1 (\lambda (a0: A).(arity g (CHead c2 (Bind +Abst) u0) t4 a0)) H26 a2 H28) in (let H31 \def (eq_ind_r A x0 (\lambda (a0: +A).(arity g c2 u0 (asucc g a0))) H25 a1 H29) in (arity_bind g Abbr +not_abbr_abst c2 v2 a1 H21 t4 a2 (csuba_arity g (CHead c2 (Bind Abst) u0) t4 +a2 H30 (CHead c2 (Bind Abbr) v2) (csuba_abst g c2 c2 (csuba_refl g c2) u0 a1 +H31 v2 H21))))))) H27))))))) H23)))))))))))) H12)))))))))))) (\lambda (b: +B).(\lambda (H7: (not (eq B b Abst))).(\lambda (v1: T).(\lambda (v2: +T).(\lambda (H8: (pr0 v1 v2)).(\lambda (H9: (((eq T v1 (THead (Flat Appl) u +t)) \to (arity g c2 v2 a2)))).(\lambda (u1: T).(\lambda (u2: T).(\lambda +(H10: (pr0 u1 u2)).(\lambda (H11: (((eq T u1 (THead (Flat Appl) u t)) \to +(arity g c2 u2 a2)))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H12: (pr0 +t3 t4)).(\lambda (H13: (((eq T t3 (THead (Flat Appl) u t)) \to (arity g c2 t4 +a2)))).(\lambda (H14: (eq T (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) +(THead (Flat Appl) u t))).(let H15 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow v1 | (TLRef _) +\Rightarrow v1 | (THead _ t0 _) \Rightarrow t0])) (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) (THead (Flat Appl) u t) H14) in ((let H16 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow (THead (Bind b) u1 t3) | (TLRef _) \Rightarrow (THead +(Bind b) u1 t3) | (THead _ _ t0) \Rightarrow t0])) (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) (THead (Flat Appl) u t) H14) in (\lambda (H17: (eq T +v1 u)).(let H18 \def (eq_ind T v1 (\lambda (t0: T).((eq T t0 (THead (Flat +Appl) u t)) \to (arity g c2 v2 a2))) H9 u H17) in (let H19 \def (eq_ind T v1 +(\lambda (t0: T).(pr0 t0 v2)) H8 u H17) in (let H20 \def (eq_ind_r T t +(\lambda (t0: T).((eq T t3 (THead (Flat Appl) u t0)) \to (arity g c2 t4 a2))) +H13 (THead (Bind b) u1 t3) H16) in (let H21 \def (eq_ind_r T t (\lambda (t0: +T).((eq T u1 (THead (Flat Appl) u t0)) \to (arity g c2 u2 a2))) H11 (THead +(Bind b) u1 t3) H16) in (let H22 \def (eq_ind_r T t (\lambda (t0: T).((eq T u +(THead (Flat Appl) u t0)) \to (arity g c2 v2 a2))) H18 (THead (Bind b) u1 t3) +H16) in (let H23 \def (eq_ind_r T t (\lambda (t0: T).(\forall (c3: C).((wcpr0 +c c3) \to (\forall (t5: T).((pr0 t0 t5) \to (arity g c3 t5 (AHead a1 +a2))))))) H3 (THead (Bind b) u1 t3) H16) in (let H24 \def (eq_ind_r T t +(\lambda (t0: T).(arity g c t0 (AHead a1 a2))) H2 (THead (Bind b) u1 t3) H16) +in (let H25 \def (H1 c2 H4 v2 H19) in (let H26 \def (H23 c2 H4 (THead (Bind +b) u2 t4) (pr0_comp u1 u2 H10 t3 t4 H12 (Bind b))) in (let H27 \def +(arity_gen_bind b H7 g c2 u2 t4 (AHead a1 a2) H26) in (ex2_ind A (\lambda +(a3: A).(arity g c2 u2 a3)) (\lambda (_: A).(arity g (CHead c2 (Bind b) u2) +t4 (AHead a1 a2))) (arity g c2 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) a2) (\lambda (x: A).(\lambda (H28: (arity g c2 u2 x)).(\lambda +(H29: (arity g (CHead c2 (Bind b) u2) t4 (AHead a1 a2))).(arity_bind g b H7 +c2 u2 x H28 (THead (Flat Appl) (lift (S O) O v2) t4) a2 (arity_appl g (CHead +c2 (Bind b) u2) (lift (S O) O v2) a1 (arity_lift g c2 v2 a1 H25 (CHead c2 +(Bind b) u2) (S O) O (drop_drop (Bind b) O c2 c2 (drop_refl c2) u2)) t4 a2 +H29))))) H27))))))))))))) H15))))))))))))))))) (\lambda (u1: T).(\lambda (u2: +T).(\lambda (_: (pr0 u1 u2)).(\lambda (_: (((eq T u1 (THead (Flat Appl) u t)) +\to (arity g c2 u2 a2)))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (_: (pr0 +t3 t4)).(\lambda (_: (((eq T t3 (THead (Flat Appl) u t)) \to (arity g c2 t4 +a2)))).(\lambda (w: T).(\lambda (_: (subst0 O u2 t4 w)).(\lambda (H12: (eq T +(THead (Bind Abbr) u1 t3) (THead (Flat Appl) u t))).(let H13 \def (eq_ind T +(THead (Bind Abbr) u1 t3) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat +Appl) u t) H12) in (False_ind (arity g c2 (THead (Bind Abbr) u2 w) a2) +H13))))))))))))) (\lambda (b: B).(\lambda (_: (not (eq B b Abst))).(\lambda +(t3: T).(\lambda (t4: T).(\lambda (_: (pr0 t3 t4)).(\lambda (_: (((eq T t3 +(THead (Flat Appl) u t)) \to (arity g c2 t4 a2)))).(\lambda (u0: T).(\lambda +(H10: (eq T (THead (Bind b) u0 (lift (S O) O t3)) (THead (Flat Appl) u +t))).(let H11 \def (eq_ind T (THead (Bind b) u0 (lift (S O) O t3)) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | +(Flat _) \Rightarrow False])])) I (THead (Flat Appl) u t) H10) in (False_ind +(arity g c2 t4 a2) H11)))))))))) (\lambda (t3: T).(\lambda (t4: T).(\lambda +(_: (pr0 t3 t4)).(\lambda (_: (((eq T t3 (THead (Flat Appl) u t)) \to (arity +g c2 t4 a2)))).(\lambda (u0: T).(\lambda (H9: (eq T (THead (Flat Cast) u0 t3) +(THead (Flat Appl) u t))).(let H10 \def (eq_ind T (THead (Flat Cast) u0 t3) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | +(Flat f) \Rightarrow (match f in F return (\lambda (_: F).Prop) with [Appl +\Rightarrow False | Cast \Rightarrow True])])])) I (THead (Flat Appl) u t) +H9) in (False_ind (arity g c2 t4 a2) H10)))))))) y t2 H6))) H5)))))))))))))) +(\lambda (c: C).(\lambda (u: T).(\lambda (a0: A).(\lambda (_: (arity g c u +(asucc g a0))).(\lambda (H1: ((\forall (c2: C).((wcpr0 c c2) \to (\forall +(t2: T).((pr0 u t2) \to (arity g c2 t2 (asucc g a0)))))))).(\lambda (t: +T).(\lambda (_: (arity g c t a0)).(\lambda (H3: ((\forall (c2: C).((wcpr0 c +c2) \to (\forall (t2: T).((pr0 t t2) \to (arity g c2 t2 a0))))))).(\lambda +(c2: C).(\lambda (H4: (wcpr0 c c2)).(\lambda (t2: T).(\lambda (H5: (pr0 +(THead (Flat Cast) u t) t2)).(insert_eq T (THead (Flat Cast) u t) (\lambda +(t0: T).(pr0 t0 t2)) (arity g c2 t2 a0) (\lambda (y: T).(\lambda (H6: (pr0 y +t2)).(pr0_ind (\lambda (t0: T).(\lambda (t3: T).((eq T t0 (THead (Flat Cast) +u t)) \to (arity g c2 t3 a0)))) (\lambda (t0: T).(\lambda (H7: (eq T t0 +(THead (Flat Cast) u t))).(let H8 \def (f_equal T T (\lambda (e: T).e) t0 +(THead (Flat Cast) u t) H7) in (eq_ind_r T (THead (Flat Cast) u t) (\lambda +(t3: T).(arity g c2 t3 a0)) (arity_cast g c2 u a0 (H1 c2 H4 u (pr0_refl u)) t +(H3 c2 H4 t (pr0_refl t))) t0 H8)))) (\lambda (u1: T).(\lambda (u2: +T).(\lambda (H7: (pr0 u1 u2)).(\lambda (H8: (((eq T u1 (THead (Flat Cast) u +t)) \to (arity g c2 u2 a0)))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H9: +(pr0 t3 t4)).(\lambda (H10: (((eq T t3 (THead (Flat Cast) u t)) \to (arity g +c2 t4 a0)))).(\lambda (k: K).(\lambda (H11: (eq T (THead k u1 t3) (THead +(Flat Cast) u t))).(let H12 \def (f_equal T K (\lambda (e: T).(match e in T +return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k u1 t3) (THead (Flat +Cast) u t) H11) in ((let H13 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | (TLRef _) +\Rightarrow u1 | (THead _ t0 _) \Rightarrow t0])) (THead k u1 t3) (THead +(Flat Cast) u t) H11) in ((let H14 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) +\Rightarrow t3 | (THead _ _ t0) \Rightarrow t0])) (THead k u1 t3) (THead +(Flat Cast) u t) H11) in (\lambda (H15: (eq T u1 u)).(\lambda (H16: (eq K k +(Flat Cast))).(eq_ind_r K (Flat Cast) (\lambda (k0: K).(arity g c2 (THead k0 +u2 t4) a0)) (let H17 \def (eq_ind T t3 (\lambda (t0: T).((eq T t0 (THead +(Flat Cast) u t)) \to (arity g c2 t4 a0))) H10 t H14) in (let H18 \def +(eq_ind T t3 (\lambda (t0: T).(pr0 t0 t4)) H9 t H14) in (let H19 \def (eq_ind +T u1 (\lambda (t0: T).((eq T t0 (THead (Flat Cast) u t)) \to (arity g c2 u2 +a0))) H8 u H15) in (let H20 \def (eq_ind T u1 (\lambda (t0: T).(pr0 t0 u2)) +H7 u H15) in (arity_cast g c2 u2 a0 (H1 c2 H4 u2 H20) t4 (H3 c2 H4 t4 +H18)))))) k H16)))) H13)) H12)))))))))))) (\lambda (u0: T).(\lambda (v1: +T).(\lambda (v2: T).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (((eq T v1 (THead +(Flat Cast) u t)) \to (arity g c2 v2 a0)))).(\lambda (t3: T).(\lambda (t4: +T).(\lambda (_: (pr0 t3 t4)).(\lambda (_: (((eq T t3 (THead (Flat Cast) u t)) +\to (arity g c2 t4 a0)))).(\lambda (H11: (eq T (THead (Flat Appl) v1 (THead +(Bind Abst) u0 t3)) (THead (Flat Cast) u t))).(let H12 \def (eq_ind T (THead +(Flat Appl) v1 (THead (Bind Abst) u0 t3)) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat f) \Rightarrow (match f +in F return (\lambda (_: F).Prop) with [Appl \Rightarrow True | Cast +\Rightarrow False])])])) I (THead (Flat Cast) u t) H11) in (False_ind (arity +g c2 (THead (Bind Abbr) v2 t4) a0) H12)))))))))))) (\lambda (b: B).(\lambda +(_: (not (eq B b Abst))).(\lambda (v1: T).(\lambda (v2: T).(\lambda (_: (pr0 +v1 v2)).(\lambda (_: (((eq T v1 (THead (Flat Cast) u t)) \to (arity g c2 v2 +a0)))).(\lambda (u1: T).(\lambda (u2: T).(\lambda (_: (pr0 u1 u2)).(\lambda +(_: (((eq T u1 (THead (Flat Cast) u t)) \to (arity g c2 u2 a0)))).(\lambda +(t3: T).(\lambda (t4: T).(\lambda (_: (pr0 t3 t4)).(\lambda (_: (((eq T t3 +(THead (Flat Cast) u t)) \to (arity g c2 t4 a0)))).(\lambda (H14: (eq T +(THead (Flat Appl) v1 (THead (Bind b) u1 t3)) (THead (Flat Cast) u t))).(let +H15 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | +(Flat f) \Rightarrow (match f in F return (\lambda (_: F).Prop) with [Appl +\Rightarrow True | Cast \Rightarrow False])])])) I (THead (Flat Cast) u t) +H14) in (False_ind (arity g c2 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) a0) H15))))))))))))))))) (\lambda (u1: T).(\lambda (u2: +T).(\lambda (_: (pr0 u1 u2)).(\lambda (_: (((eq T u1 (THead (Flat Cast) u t)) +\to (arity g c2 u2 a0)))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (_: (pr0 +t3 t4)).(\lambda (_: (((eq T t3 (THead (Flat Cast) u t)) \to (arity g c2 t4 +a0)))).(\lambda (w: T).(\lambda (_: (subst0 O u2 t4 w)).(\lambda (H12: (eq T +(THead (Bind Abbr) u1 t3) (THead (Flat Cast) u t))).(let H13 \def (eq_ind T +(THead (Bind Abbr) u1 t3) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat +Cast) u t) H12) in (False_ind (arity g c2 (THead (Bind Abbr) u2 w) a0) +H13))))))))))))) (\lambda (b: B).(\lambda (_: (not (eq B b Abst))).(\lambda +(t3: T).(\lambda (t4: T).(\lambda (_: (pr0 t3 t4)).(\lambda (_: (((eq T t3 +(THead (Flat Cast) u t)) \to (arity g c2 t4 a0)))).(\lambda (u0: T).(\lambda +(H10: (eq T (THead (Bind b) u0 (lift (S O) O t3)) (THead (Flat Cast) u +t))).(let H11 \def (eq_ind T (THead (Bind b) u0 (lift (S O) O t3)) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | +(Flat _) \Rightarrow False])])) I (THead (Flat Cast) u t) H10) in (False_ind +(arity g c2 t4 a0) H11)))))))))) (\lambda (t3: T).(\lambda (t4: T).(\lambda +(H7: (pr0 t3 t4)).(\lambda (H8: (((eq T t3 (THead (Flat Cast) u t)) \to +(arity g c2 t4 a0)))).(\lambda (u0: T).(\lambda (H9: (eq T (THead (Flat Cast) +u0 t3) (THead (Flat Cast) u t))).(let H10 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | +(TLRef _) \Rightarrow u0 | (THead _ t0 _) \Rightarrow t0])) (THead (Flat +Cast) u0 t3) (THead (Flat Cast) u t) H9) in ((let H11 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t0) \Rightarrow t0])) +(THead (Flat Cast) u0 t3) (THead (Flat Cast) u t) H9) in (\lambda (_: (eq T +u0 u)).(let H13 \def (eq_ind T t3 (\lambda (t0: T).((eq T t0 (THead (Flat +Cast) u t)) \to (arity g c2 t4 a0))) H8 t H11) in (let H14 \def (eq_ind T t3 +(\lambda (t0: T).(pr0 t0 t4)) H7 t H11) in (H3 c2 H4 t4 H14))))) H10)))))))) +y t2 H6))) H5))))))))))))) (\lambda (c: C).(\lambda (t: T).(\lambda (a1: +A).(\lambda (_: (arity g c t a1)).(\lambda (H1: ((\forall (c2: C).((wcpr0 c +c2) \to (\forall (t2: T).((pr0 t t2) \to (arity g c2 t2 a1))))))).(\lambda +(a2: A).(\lambda (H2: (leq g a1 a2)).(\lambda (c2: C).(\lambda (H3: (wcpr0 c +c2)).(\lambda (t2: T).(\lambda (H4: (pr0 t t2)).(arity_repl g c2 t2 a1 (H1 c2 +H3 t2 H4) a2 H2)))))))))))) c1 t1 a H))))). + +theorem arity_sred_wcpr0_pr1: + \forall (t1: T).(\forall (t2: T).((pr1 t1 t2) \to (\forall (g: G).(\forall +(c1: C).(\forall (a: A).((arity g c1 t1 a) \to (\forall (c2: C).((wcpr0 c1 +c2) \to (arity g c2 t2 a))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr1 t1 t2)).(pr1_ind (\lambda +(t: T).(\lambda (t0: T).(\forall (g: G).(\forall (c1: C).(\forall (a: +A).((arity g c1 t a) \to (\forall (c2: C).((wcpr0 c1 c2) \to (arity g c2 t0 +a))))))))) (\lambda (t: T).(\lambda (g: G).(\lambda (c1: C).(\lambda (a: +A).(\lambda (H0: (arity g c1 t a)).(\lambda (c2: C).(\lambda (H1: (wcpr0 c1 +c2)).(arity_sred_wcpr0_pr0 g c1 t a H0 c2 H1 t (pr0_refl t))))))))) (\lambda +(t3: T).(\lambda (t4: T).(\lambda (H0: (pr0 t4 t3)).(\lambda (t5: T).(\lambda +(_: (pr1 t3 t5)).(\lambda (H2: ((\forall (g: G).(\forall (c1: C).(\forall (a: +A).((arity g c1 t3 a) \to (\forall (c2: C).((wcpr0 c1 c2) \to (arity g c2 t5 +a))))))))).(\lambda (g: G).(\lambda (c1: C).(\lambda (a: A).(\lambda (H3: +(arity g c1 t4 a)).(\lambda (c2: C).(\lambda (H4: (wcpr0 c1 c2)).(H2 g c2 a +(arity_sred_wcpr0_pr0 g c1 t4 a H3 c2 H4 t3 H0) c2 (wcpr0_refl +c2)))))))))))))) t1 t2 H))). + +theorem arity_sred_pr2: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall +(g: G).(\forall (a: A).((arity g c t1 a) \to (arity g c t2 a))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c t1 +t2)).(pr2_ind (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\forall (g: +G).(\forall (a: A).((arity g c0 t a) \to (arity g c0 t0 a))))))) (\lambda +(c0: C).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H0: (pr0 t3 t4)).(\lambda +(g: G).(\lambda (a: A).(\lambda (H1: (arity g c0 t3 a)).(arity_sred_wcpr0_pr0 +g c0 t3 a H1 c0 (wcpr0_refl c0) t4 H0)))))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i c0 (CHead d (Bind +Abbr) u))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H1: (pr0 t3 +t4)).(\lambda (t: T).(\lambda (H2: (subst0 i u t4 t)).(\lambda (g: +G).(\lambda (a: A).(\lambda (H3: (arity g c0 t3 a)).(arity_subst0 g c0 t4 a +(arity_sred_wcpr0_pr0 g c0 t3 a H3 c0 (wcpr0_refl c0) t4 H1) d u i H0 t +H2)))))))))))))) c t1 t2 H)))). + +theorem arity_sred_pr3: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t1 t2) \to (\forall +(g: G).(\forall (a: A).((arity g c t1 a) \to (arity g c t2 a))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c t1 +t2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (g: G).(\forall (a: +A).((arity g c t a) \to (arity g c t0 a)))))) (\lambda (t: T).(\lambda (g: +G).(\lambda (a: A).(\lambda (H0: (arity g c t a)).H0)))) (\lambda (t3: +T).(\lambda (t4: T).(\lambda (H0: (pr2 c t4 t3)).(\lambda (t5: T).(\lambda +(_: (pr3 c t3 t5)).(\lambda (H2: ((\forall (g: G).(\forall (a: A).((arity g c +t3 a) \to (arity g c t5 a)))))).(\lambda (g: G).(\lambda (a: A).(\lambda (H3: +(arity g c t4 a)).(H2 g a (arity_sred_pr2 c t4 t3 H0 g a H3))))))))))) t1 t2 +H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/props.ma new file mode 100644 index 000000000..6c9662aeb --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/props.ma @@ -0,0 +1,415 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/arity/props". + +include "arity/fwd.ma". + +theorem node_inh: + \forall (g: G).(\forall (n: nat).(\forall (k: nat).(ex_2 C T (\lambda (c: +C).(\lambda (t: T).(arity g c t (ASort k n))))))) +\def + \lambda (g: G).(\lambda (n: nat).(\lambda (k: nat).(nat_ind (\lambda (n0: +nat).(ex_2 C T (\lambda (c: C).(\lambda (t: T).(arity g c t (ASort n0 n)))))) +(ex_2_intro C T (\lambda (c: C).(\lambda (t: T).(arity g c t (ASort O n)))) +(CSort O) (TSort n) (arity_sort g (CSort O) n)) (\lambda (n0: nat).(\lambda +(H: (ex_2 C T (\lambda (c: C).(\lambda (t: T).(arity g c t (ASort n0 +n)))))).(let H0 \def H in (ex_2_ind C T (\lambda (c: C).(\lambda (t: +T).(arity g c t (ASort n0 n)))) (ex_2 C T (\lambda (c: C).(\lambda (t: +T).(arity g c t (ASort (S n0) n))))) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (H1: (arity g x0 x1 (ASort n0 n))).(ex_2_intro C T (\lambda (c: +C).(\lambda (t: T).(arity g c t (ASort (S n0) n)))) (CHead x0 (Bind Abst) x1) +(TLRef O) (arity_abst g (CHead x0 (Bind Abst) x1) x0 x1 O (getl_refl Abst x0 +x1) (ASort (S n0) n) H1))))) H0)))) k))). + +theorem arity_lift: + \forall (g: G).(\forall (c2: C).(\forall (t: T).(\forall (a: A).((arity g c2 +t a) \to (\forall (c1: C).(\forall (h: nat).(\forall (d: nat).((drop h d c1 +c2) \to (arity g c1 (lift h d t) a))))))))) +\def + \lambda (g: G).(\lambda (c2: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c2 t a)).(arity_ind g (\lambda (c: C).(\lambda (t0: T).(\lambda (a0: +A).(\forall (c1: C).(\forall (h: nat).(\forall (d: nat).((drop h d c1 c) \to +(arity g c1 (lift h d t0) a0)))))))) (\lambda (c: C).(\lambda (n: +nat).(\lambda (c1: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (_: (drop +h d c1 c)).(eq_ind_r T (TSort n) (\lambda (t0: T).(arity g c1 t0 (ASort O +n))) (arity_sort g c1 n) (lift h d (TSort n)) (lift_sort n h d)))))))) +(\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H0: (getl i c (CHead d (Bind Abbr) u))).(\lambda (a0: A).(\lambda (H1: +(arity g d u a0)).(\lambda (H2: ((\forall (c1: C).(\forall (h: nat).(\forall +(d0: nat).((drop h d0 c1 d) \to (arity g c1 (lift h d0 u) a0))))))).(\lambda +(c1: C).(\lambda (h: nat).(\lambda (d0: nat).(\lambda (H3: (drop h d0 c1 +c)).(lt_le_e i d0 (arity g c1 (lift h d0 (TLRef i)) a0) (\lambda (H4: (lt i +d0)).(eq_ind_r T (TLRef i) (\lambda (t0: T).(arity g c1 t0 a0)) (let H5 \def +(drop_getl_trans_le i d0 (le_S_n i d0 (le_S (S i) d0 H4)) c1 c h H3 (CHead d +(Bind Abbr) u) H0) in (ex3_2_ind C C (\lambda (e0: C).(\lambda (_: C).(drop i +O c1 e0))) (\lambda (e0: C).(\lambda (e1: C).(drop h (minus d0 i) e0 e1))) +(\lambda (_: C).(\lambda (e1: C).(clear e1 (CHead d (Bind Abbr) u)))) (arity +g c1 (TLRef i) a0) (\lambda (x0: C).(\lambda (x1: C).(\lambda (H6: (drop i O +c1 x0)).(\lambda (H7: (drop h (minus d0 i) x0 x1)).(\lambda (H8: (clear x1 +(CHead d (Bind Abbr) u))).(let H9 \def (eq_ind nat (minus d0 i) (\lambda (n: +nat).(drop h n x0 x1)) H7 (S (minus d0 (S i))) (minus_x_Sy d0 i H4)) in (let +H10 \def (drop_clear_S x1 x0 h (minus d0 (S i)) H9 Abbr d u H8) in (ex2_ind C +(\lambda (c3: C).(clear x0 (CHead c3 (Bind Abbr) (lift h (minus d0 (S i)) +u)))) (\lambda (c3: C).(drop h (minus d0 (S i)) c3 d)) (arity g c1 (TLRef i) +a0) (\lambda (x: C).(\lambda (H11: (clear x0 (CHead x (Bind Abbr) (lift h +(minus d0 (S i)) u)))).(\lambda (H12: (drop h (minus d0 (S i)) x +d)).(arity_abbr g c1 x (lift h (minus d0 (S i)) u) i (getl_intro i c1 (CHead +x (Bind Abbr) (lift h (minus d0 (S i)) u)) x0 H6 H11) a0 (H2 x h (minus d0 (S +i)) H12))))) H10)))))))) H5)) (lift h d0 (TLRef i)) (lift_lref_lt i h d0 +H4))) (\lambda (H4: (le d0 i)).(eq_ind_r T (TLRef (plus i h)) (\lambda (t0: +T).(arity g c1 t0 a0)) (arity_abbr g c1 d u (plus i h) (drop_getl_trans_ge i +c1 c d0 h H3 (CHead d (Bind Abbr) u) H0 H4) a0 H1) (lift h d0 (TLRef i)) +(lift_lref_ge i h d0 H4)))))))))))))))) (\lambda (c: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i c (CHead d (Bind +Abst) u))).(\lambda (a0: A).(\lambda (H1: (arity g d u (asucc g +a0))).(\lambda (H2: ((\forall (c1: C).(\forall (h: nat).(\forall (d0: +nat).((drop h d0 c1 d) \to (arity g c1 (lift h d0 u) (asucc g +a0)))))))).(\lambda (c1: C).(\lambda (h: nat).(\lambda (d0: nat).(\lambda +(H3: (drop h d0 c1 c)).(lt_le_e i d0 (arity g c1 (lift h d0 (TLRef i)) a0) +(\lambda (H4: (lt i d0)).(eq_ind_r T (TLRef i) (\lambda (t0: T).(arity g c1 +t0 a0)) (let H5 \def (drop_getl_trans_le i d0 (le_S_n i d0 (le_S (S i) d0 +H4)) c1 c h H3 (CHead d (Bind Abst) u) H0) in (ex3_2_ind C C (\lambda (e0: +C).(\lambda (_: C).(drop i O c1 e0))) (\lambda (e0: C).(\lambda (e1: C).(drop +h (minus d0 i) e0 e1))) (\lambda (_: C).(\lambda (e1: C).(clear e1 (CHead d +(Bind Abst) u)))) (arity g c1 (TLRef i) a0) (\lambda (x0: C).(\lambda (x1: +C).(\lambda (H6: (drop i O c1 x0)).(\lambda (H7: (drop h (minus d0 i) x0 +x1)).(\lambda (H8: (clear x1 (CHead d (Bind Abst) u))).(let H9 \def (eq_ind +nat (minus d0 i) (\lambda (n: nat).(drop h n x0 x1)) H7 (S (minus d0 (S i))) +(minus_x_Sy d0 i H4)) in (let H10 \def (drop_clear_S x1 x0 h (minus d0 (S i)) +H9 Abst d u H8) in (ex2_ind C (\lambda (c3: C).(clear x0 (CHead c3 (Bind +Abst) (lift h (minus d0 (S i)) u)))) (\lambda (c3: C).(drop h (minus d0 (S +i)) c3 d)) (arity g c1 (TLRef i) a0) (\lambda (x: C).(\lambda (H11: (clear x0 +(CHead x (Bind Abst) (lift h (minus d0 (S i)) u)))).(\lambda (H12: (drop h +(minus d0 (S i)) x d)).(arity_abst g c1 x (lift h (minus d0 (S i)) u) i +(getl_intro i c1 (CHead x (Bind Abst) (lift h (minus d0 (S i)) u)) x0 H6 H11) +a0 (H2 x h (minus d0 (S i)) H12))))) H10)))))))) H5)) (lift h d0 (TLRef i)) +(lift_lref_lt i h d0 H4))) (\lambda (H4: (le d0 i)).(eq_ind_r T (TLRef (plus +i h)) (\lambda (t0: T).(arity g c1 t0 a0)) (arity_abst g c1 d u (plus i h) +(drop_getl_trans_ge i c1 c d0 h H3 (CHead d (Bind Abst) u) H0 H4) a0 H1) +(lift h d0 (TLRef i)) (lift_lref_ge i h d0 H4)))))))))))))))) (\lambda (b: +B).(\lambda (H0: (not (eq B b Abst))).(\lambda (c: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c u a1)).(\lambda (H2: ((\forall +(c1: C).(\forall (h: nat).(\forall (d: nat).((drop h d c1 c) \to (arity g c1 +(lift h d u) a1))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity +g (CHead c (Bind b) u) t0 a2)).(\lambda (H4: ((\forall (c1: C).(\forall (h: +nat).(\forall (d: nat).((drop h d c1 (CHead c (Bind b) u)) \to (arity g c1 +(lift h d t0) a2))))))).(\lambda (c1: C).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H5: (drop h d c1 c)).(eq_ind_r T (THead (Bind b) (lift h d u) +(lift h (s (Bind b) d) t0)) (\lambda (t1: T).(arity g c1 t1 a2)) (arity_bind +g b H0 c1 (lift h d u) a1 (H2 c1 h d H5) (lift h (s (Bind b) d) t0) a2 (H4 +(CHead c1 (Bind b) (lift h d u)) h (s (Bind b) d) (drop_skip_bind h d c1 c H5 +b u))) (lift h d (THead (Bind b) u t0)) (lift_head (Bind b) u t0 h +d))))))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (a1: A).(\lambda +(_: (arity g c u (asucc g a1))).(\lambda (H1: ((\forall (c1: C).(\forall (h: +nat).(\forall (d: nat).((drop h d c1 c) \to (arity g c1 (lift h d u) (asucc g +a1)))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c +(Bind Abst) u) t0 a2)).(\lambda (H3: ((\forall (c1: C).(\forall (h: +nat).(\forall (d: nat).((drop h d c1 (CHead c (Bind Abst) u)) \to (arity g c1 +(lift h d t0) a2))))))).(\lambda (c1: C).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H4: (drop h d c1 c)).(eq_ind_r T (THead (Bind Abst) (lift h d +u) (lift h (s (Bind Abst) d) t0)) (\lambda (t1: T).(arity g c1 t1 (AHead a1 +a2))) (arity_head g c1 (lift h d u) a1 (H1 c1 h d H4) (lift h (s (Bind Abst) +d) t0) a2 (H3 (CHead c1 (Bind Abst) (lift h d u)) h (s (Bind Abst) d) +(drop_skip_bind h d c1 c H4 Abst u))) (lift h d (THead (Bind Abst) u t0)) +(lift_head (Bind Abst) u t0 h d))))))))))))))) (\lambda (c: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c u a1)).(\lambda (H1: ((\forall +(c1: C).(\forall (h: nat).(\forall (d: nat).((drop h d c1 c) \to (arity g c1 +(lift h d u) a1))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity +g c t0 (AHead a1 a2))).(\lambda (H3: ((\forall (c1: C).(\forall (h: +nat).(\forall (d: nat).((drop h d c1 c) \to (arity g c1 (lift h d t0) (AHead +a1 a2)))))))).(\lambda (c1: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda +(H4: (drop h d c1 c)).(eq_ind_r T (THead (Flat Appl) (lift h d u) (lift h (s +(Flat Appl) d) t0)) (\lambda (t1: T).(arity g c1 t1 a2)) (arity_appl g c1 +(lift h d u) a1 (H1 c1 h d H4) (lift h (s (Flat Appl) d) t0) a2 (H3 c1 h (s +(Flat Appl) d) H4)) (lift h d (THead (Flat Appl) u t0)) (lift_head (Flat +Appl) u t0 h d))))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (a0: +A).(\lambda (_: (arity g c u (asucc g a0))).(\lambda (H1: ((\forall (c1: +C).(\forall (h: nat).(\forall (d: nat).((drop h d c1 c) \to (arity g c1 (lift +h d u) (asucc g a0)))))))).(\lambda (t0: T).(\lambda (_: (arity g c t0 +a0)).(\lambda (H3: ((\forall (c1: C).(\forall (h: nat).(\forall (d: +nat).((drop h d c1 c) \to (arity g c1 (lift h d t0) a0))))))).(\lambda (c1: +C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H4: (drop h d c1 +c)).(eq_ind_r T (THead (Flat Cast) (lift h d u) (lift h (s (Flat Cast) d) +t0)) (\lambda (t1: T).(arity g c1 t1 a0)) (arity_cast g c1 (lift h d u) a0 +(H1 c1 h d H4) (lift h (s (Flat Cast) d) t0) (H3 c1 h (s (Flat Cast) d) H4)) +(lift h d (THead (Flat Cast) u t0)) (lift_head (Flat Cast) u t0 h +d)))))))))))))) (\lambda (c: C).(\lambda (t0: T).(\lambda (a1: A).(\lambda +(_: (arity g c t0 a1)).(\lambda (H1: ((\forall (c1: C).(\forall (h: +nat).(\forall (d: nat).((drop h d c1 c) \to (arity g c1 (lift h d t0) +a1))))))).(\lambda (a2: A).(\lambda (H2: (leq g a1 a2)).(\lambda (c1: +C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H3: (drop h d c1 +c)).(arity_repl g c1 (lift h d t0) a1 (H1 c1 h d H3) a2 H2)))))))))))) c2 t a +H))))). + +theorem arity_mono: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (a1: A).((arity g c +t a1) \to (\forall (a2: A).((arity g c t a2) \to (leq g a1 a2))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (a1: A).(\lambda (H: +(arity g c t a1)).(arity_ind g (\lambda (c0: C).(\lambda (t0: T).(\lambda (a: +A).(\forall (a2: A).((arity g c0 t0 a2) \to (leq g a a2)))))) (\lambda (c0: +C).(\lambda (n: nat).(\lambda (a2: A).(\lambda (H0: (arity g c0 (TSort n) +a2)).(leq_sym g a2 (ASort O n) (arity_gen_sort g c0 n a2 H0)))))) (\lambda +(c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl +i c0 (CHead d (Bind Abbr) u))).(\lambda (a: A).(\lambda (_: (arity g d u +a)).(\lambda (H2: ((\forall (a2: A).((arity g d u a2) \to (leq g a +a2))))).(\lambda (a2: A).(\lambda (H3: (arity g c0 (TLRef i) a2)).(let H4 +\def (arity_gen_lref g c0 i a2 H3) in (or_ind (ex2_2 C T (\lambda (d0: +C).(\lambda (u0: T).(getl i c0 (CHead d0 (Bind Abbr) u0)))) (\lambda (d0: +C).(\lambda (u0: T).(arity g d0 u0 a2)))) (ex2_2 C T (\lambda (d0: +C).(\lambda (u0: T).(getl i c0 (CHead d0 (Bind Abst) u0)))) (\lambda (d0: +C).(\lambda (u0: T).(arity g d0 u0 (asucc g a2))))) (leq g a a2) (\lambda +(H5: (ex2_2 C T (\lambda (d0: C).(\lambda (u0: T).(getl i c0 (CHead d0 (Bind +Abbr) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g d0 u0 +a2))))).(ex2_2_ind C T (\lambda (d0: C).(\lambda (u0: T).(getl i c0 (CHead d0 +(Bind Abbr) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g d0 u0 a2))) +(leq g a a2) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H6: (getl i c0 +(CHead x0 (Bind Abbr) x1))).(\lambda (H7: (arity g x0 x1 a2)).(let H8 \def +(eq_ind C (CHead d (Bind Abbr) u) (\lambda (c1: C).(getl i c0 c1)) H0 (CHead +x0 (Bind Abbr) x1) (getl_mono c0 (CHead d (Bind Abbr) u) i H0 (CHead x0 (Bind +Abbr) x1) H6)) in (let H9 \def (f_equal C C (\lambda (e: C).(match e in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c1 _ _) +\Rightarrow c1])) (CHead d (Bind Abbr) u) (CHead x0 (Bind Abbr) x1) +(getl_mono c0 (CHead d (Bind Abbr) u) i H0 (CHead x0 (Bind Abbr) x1) H6)) in +((let H10 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: +C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead +d (Bind Abbr) u) (CHead x0 (Bind Abbr) x1) (getl_mono c0 (CHead d (Bind Abbr) +u) i H0 (CHead x0 (Bind Abbr) x1) H6)) in (\lambda (H11: (eq C d x0)).(let +H12 \def (eq_ind_r T x1 (\lambda (t0: T).(getl i c0 (CHead x0 (Bind Abbr) +t0))) H8 u H10) in (let H13 \def (eq_ind_r T x1 (\lambda (t0: T).(arity g x0 +t0 a2)) H7 u H10) in (let H14 \def (eq_ind_r C x0 (\lambda (c1: C).(getl i c0 +(CHead c1 (Bind Abbr) u))) H12 d H11) in (let H15 \def (eq_ind_r C x0 +(\lambda (c1: C).(arity g c1 u a2)) H13 d H11) in (H2 a2 H15))))))) H9))))))) +H5)) (\lambda (H5: (ex2_2 C T (\lambda (d0: C).(\lambda (u0: T).(getl i c0 +(CHead d0 (Bind Abst) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g d0 u0 +(asucc g a2)))))).(ex2_2_ind C T (\lambda (d0: C).(\lambda (u0: T).(getl i c0 +(CHead d0 (Bind Abst) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g d0 u0 +(asucc g a2)))) (leq g a a2) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H6: +(getl i c0 (CHead x0 (Bind Abst) x1))).(\lambda (_: (arity g x0 x1 (asucc g +a2))).(let H8 \def (eq_ind C (CHead d (Bind Abbr) u) (\lambda (c1: C).(getl i +c0 c1)) H0 (CHead x0 (Bind Abst) x1) (getl_mono c0 (CHead d (Bind Abbr) u) i +H0 (CHead x0 (Bind Abst) x1) H6)) in (let H9 \def (eq_ind C (CHead d (Bind +Abbr) u) (\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with +[(CSort _) \Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind b) \Rightarrow (match b in B return +(\lambda (_: B).Prop) with [Abbr \Rightarrow True | Abst \Rightarrow False | +Void \Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead x0 (Bind +Abst) x1) (getl_mono c0 (CHead d (Bind Abbr) u) i H0 (CHead x0 (Bind Abst) +x1) H6)) in (False_ind (leq g a a2) H9))))))) H5)) H4)))))))))))) (\lambda +(c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl +i c0 (CHead d (Bind Abst) u))).(\lambda (a: A).(\lambda (_: (arity g d u +(asucc g a))).(\lambda (H2: ((\forall (a2: A).((arity g d u a2) \to (leq g +(asucc g a) a2))))).(\lambda (a2: A).(\lambda (H3: (arity g c0 (TLRef i) +a2)).(let H4 \def (arity_gen_lref g c0 i a2 H3) in (or_ind (ex2_2 C T +(\lambda (d0: C).(\lambda (u0: T).(getl i c0 (CHead d0 (Bind Abbr) u0)))) +(\lambda (d0: C).(\lambda (u0: T).(arity g d0 u0 a2)))) (ex2_2 C T (\lambda +(d0: C).(\lambda (u0: T).(getl i c0 (CHead d0 (Bind Abst) u0)))) (\lambda +(d0: C).(\lambda (u0: T).(arity g d0 u0 (asucc g a2))))) (leq g a a2) +(\lambda (H5: (ex2_2 C T (\lambda (d0: C).(\lambda (u0: T).(getl i c0 (CHead +d0 (Bind Abbr) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g d0 u0 +a2))))).(ex2_2_ind C T (\lambda (d0: C).(\lambda (u0: T).(getl i c0 (CHead d0 +(Bind Abbr) u0)))) (\lambda (d0: C).(\lambda (u0: T).(arity g d0 u0 a2))) +(leq g a a2) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H6: (getl i c0 +(CHead x0 (Bind Abbr) x1))).(\lambda (_: (arity g x0 x1 a2)).(let H8 \def +(eq_ind C (CHead d (Bind Abst) u) (\lambda (c1: C).(getl i c0 c1)) H0 (CHead +x0 (Bind Abbr) x1) (getl_mono c0 (CHead d (Bind Abst) u) i H0 (CHead x0 (Bind +Abbr) x1) H6)) in (let H9 \def (eq_ind C (CHead d (Bind Abst) u) (\lambda +(ee: C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind b) \Rightarrow (match b in B return (\lambda (_: +B).Prop) with [Abbr \Rightarrow False | Abst \Rightarrow True | Void +\Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead x0 (Bind Abbr) +x1) (getl_mono c0 (CHead d (Bind Abst) u) i H0 (CHead x0 (Bind Abbr) x1) H6)) +in (False_ind (leq g a a2) H9))))))) H5)) (\lambda (H5: (ex2_2 C T (\lambda +(d0: C).(\lambda (u0: T).(getl i c0 (CHead d0 (Bind Abst) u0)))) (\lambda +(d0: C).(\lambda (u0: T).(arity g d0 u0 (asucc g a2)))))).(ex2_2_ind C T +(\lambda (d0: C).(\lambda (u0: T).(getl i c0 (CHead d0 (Bind Abst) u0)))) +(\lambda (d0: C).(\lambda (u0: T).(arity g d0 u0 (asucc g a2)))) (leq g a a2) +(\lambda (x0: C).(\lambda (x1: T).(\lambda (H6: (getl i c0 (CHead x0 (Bind +Abst) x1))).(\lambda (H7: (arity g x0 x1 (asucc g a2))).(let H8 \def (eq_ind +C (CHead d (Bind Abst) u) (\lambda (c1: C).(getl i c0 c1)) H0 (CHead x0 (Bind +Abst) x1) (getl_mono c0 (CHead d (Bind Abst) u) i H0 (CHead x0 (Bind Abst) +x1) H6)) in (let H9 \def (f_equal C C (\lambda (e: C).(match e in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c1 _ _) \Rightarrow +c1])) (CHead d (Bind Abst) u) (CHead x0 (Bind Abst) x1) (getl_mono c0 (CHead +d (Bind Abst) u) i H0 (CHead x0 (Bind Abst) x1) H6)) in ((let H10 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead d (Bind +Abst) u) (CHead x0 (Bind Abst) x1) (getl_mono c0 (CHead d (Bind Abst) u) i H0 +(CHead x0 (Bind Abst) x1) H6)) in (\lambda (H11: (eq C d x0)).(let H12 \def +(eq_ind_r T x1 (\lambda (t0: T).(getl i c0 (CHead x0 (Bind Abst) t0))) H8 u +H10) in (let H13 \def (eq_ind_r T x1 (\lambda (t0: T).(arity g x0 t0 (asucc g +a2))) H7 u H10) in (let H14 \def (eq_ind_r C x0 (\lambda (c1: C).(getl i c0 +(CHead c1 (Bind Abst) u))) H12 d H11) in (let H15 \def (eq_ind_r C x0 +(\lambda (c1: C).(arity g c1 u (asucc g a2))) H13 d H11) in (asucc_inj g a a2 +(H2 (asucc g a2) H15)))))))) H9))))))) H5)) H4)))))))))))) (\lambda (b: +B).(\lambda (H0: (not (eq B b Abst))).(\lambda (c0: C).(\lambda (u: +T).(\lambda (a2: A).(\lambda (_: (arity g c0 u a2)).(\lambda (_: ((\forall +(a3: A).((arity g c0 u a3) \to (leq g a2 a3))))).(\lambda (t0: T).(\lambda +(a3: A).(\lambda (_: (arity g (CHead c0 (Bind b) u) t0 a3)).(\lambda (H4: +((\forall (a4: A).((arity g (CHead c0 (Bind b) u) t0 a4) \to (leq g a3 +a4))))).(\lambda (a0: A).(\lambda (H5: (arity g c0 (THead (Bind b) u t0) +a0)).(let H6 \def (arity_gen_bind b H0 g c0 u t0 a0 H5) in (ex2_ind A +(\lambda (a4: A).(arity g c0 u a4)) (\lambda (_: A).(arity g (CHead c0 (Bind +b) u) t0 a0)) (leq g a3 a0) (\lambda (x: A).(\lambda (_: (arity g c0 u +x)).(\lambda (H8: (arity g (CHead c0 (Bind b) u) t0 a0)).(H4 a0 H8)))) +H6))))))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda (a2: A).(\lambda +(_: (arity g c0 u (asucc g a2))).(\lambda (H1: ((\forall (a3: A).((arity g c0 +u a3) \to (leq g (asucc g a2) a3))))).(\lambda (t0: T).(\lambda (a3: +A).(\lambda (_: (arity g (CHead c0 (Bind Abst) u) t0 a3)).(\lambda (H3: +((\forall (a4: A).((arity g (CHead c0 (Bind Abst) u) t0 a4) \to (leq g a3 +a4))))).(\lambda (a0: A).(\lambda (H4: (arity g c0 (THead (Bind Abst) u t0) +a0)).(let H5 \def (arity_gen_abst g c0 u t0 a0 H4) in (ex3_2_ind A A (\lambda +(a4: A).(\lambda (a5: A).(eq A a0 (AHead a4 a5)))) (\lambda (a4: A).(\lambda +(_: A).(arity g c0 u (asucc g a4)))) (\lambda (_: A).(\lambda (a5: A).(arity +g (CHead c0 (Bind Abst) u) t0 a5))) (leq g (AHead a2 a3) a0) (\lambda (x0: +A).(\lambda (x1: A).(\lambda (H6: (eq A a0 (AHead x0 x1))).(\lambda (H7: +(arity g c0 u (asucc g x0))).(\lambda (H8: (arity g (CHead c0 (Bind Abst) u) +t0 x1)).(eq_ind_r A (AHead x0 x1) (\lambda (a: A).(leq g (AHead a2 a3) a)) +(leq_head g a2 x0 (asucc_inj g a2 x0 (H1 (asucc g x0) H7)) a3 x1 (H3 x1 H8)) +a0 H6)))))) H5))))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda (a2: +A).(\lambda (_: (arity g c0 u a2)).(\lambda (_: ((\forall (a3: A).((arity g +c0 u a3) \to (leq g a2 a3))))).(\lambda (t0: T).(\lambda (a3: A).(\lambda (_: +(arity g c0 t0 (AHead a2 a3))).(\lambda (H3: ((\forall (a4: A).((arity g c0 +t0 a4) \to (leq g (AHead a2 a3) a4))))).(\lambda (a0: A).(\lambda (H4: (arity +g c0 (THead (Flat Appl) u t0) a0)).(let H5 \def (arity_gen_appl g c0 u t0 a0 +H4) in (ex2_ind A (\lambda (a4: A).(arity g c0 u a4)) (\lambda (a4: A).(arity +g c0 t0 (AHead a4 a0))) (leq g a3 a0) (\lambda (x: A).(\lambda (_: (arity g +c0 u x)).(\lambda (H7: (arity g c0 t0 (AHead x a0))).(ahead_inj_snd g a2 a3 x +a0 (H3 (AHead x a0) H7))))) H5))))))))))))) (\lambda (c0: C).(\lambda (u: +T).(\lambda (a: A).(\lambda (_: (arity g c0 u (asucc g a))).(\lambda (_: +((\forall (a2: A).((arity g c0 u a2) \to (leq g (asucc g a) a2))))).(\lambda +(t0: T).(\lambda (_: (arity g c0 t0 a)).(\lambda (H3: ((\forall (a2: +A).((arity g c0 t0 a2) \to (leq g a a2))))).(\lambda (a2: A).(\lambda (H4: +(arity g c0 (THead (Flat Cast) u t0) a2)).(let H5 \def (arity_gen_cast g c0 u +t0 a2 H4) in (and_ind (arity g c0 u (asucc g a2)) (arity g c0 t0 a2) (leq g a +a2) (\lambda (_: (arity g c0 u (asucc g a2))).(\lambda (H7: (arity g c0 t0 +a2)).(H3 a2 H7))) H5)))))))))))) (\lambda (c0: C).(\lambda (t0: T).(\lambda +(a2: A).(\lambda (_: (arity g c0 t0 a2)).(\lambda (H1: ((\forall (a3: +A).((arity g c0 t0 a3) \to (leq g a2 a3))))).(\lambda (a3: A).(\lambda (H2: +(leq g a2 a3)).(\lambda (a0: A).(\lambda (H3: (arity g c0 t0 a0)).(leq_trans +g a3 a2 (leq_sym g a2 a3 H2) a0 (H1 a0 H3))))))))))) c t a1 H))))). + +theorem arity_repellent: + \forall (g: G).(\forall (c: C).(\forall (w: T).(\forall (t: T).(\forall (a1: +A).((arity g (CHead c (Bind Abst) w) t a1) \to (\forall (a2: A).((arity g c +(THead (Bind Abst) w t) a2) \to ((leq g a1 a2) \to (\forall (P: +Prop).P))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (w: T).(\lambda (t: T).(\lambda (a1: +A).(\lambda (H: (arity g (CHead c (Bind Abst) w) t a1)).(\lambda (a2: +A).(\lambda (H0: (arity g c (THead (Bind Abst) w t) a2)).(\lambda (H1: (leq g +a1 a2)).(\lambda (P: Prop).(let H_y \def (arity_repl g (CHead c (Bind Abst) +w) t a1 H a2 H1) in (let H2 \def (arity_gen_abst g c w t a2 H0) in (ex3_2_ind +A A (\lambda (a3: A).(\lambda (a4: A).(eq A a2 (AHead a3 a4)))) (\lambda (a3: +A).(\lambda (_: A).(arity g c w (asucc g a3)))) (\lambda (_: A).(\lambda (a4: +A).(arity g (CHead c (Bind Abst) w) t a4))) P (\lambda (x0: A).(\lambda (x1: +A).(\lambda (H3: (eq A a2 (AHead x0 x1))).(\lambda (_: (arity g c w (asucc g +x0))).(\lambda (H5: (arity g (CHead c (Bind Abst) w) t x1)).(let H6 \def +(eq_ind A a2 (\lambda (a: A).(arity g (CHead c (Bind Abst) w) t a)) H_y +(AHead x0 x1) H3) in (leq_ahead_false_2 g x1 x0 (arity_mono g (CHead c (Bind +Abst) w) t (AHead x0 x1) H6 x1 H5) P))))))) H2)))))))))))). + +theorem arity_appls_cast: + \forall (g: G).(\forall (c: C).(\forall (u: T).(\forall (t: T).(\forall (vs: +TList).(\forall (a: A).((arity g c (THeads (Flat Appl) vs u) (asucc g a)) \to +((arity g c (THeads (Flat Appl) vs t) a) \to (arity g c (THeads (Flat Appl) +vs (THead (Flat Cast) u t)) a)))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (vs: +TList).(TList_ind (\lambda (t0: TList).(\forall (a: A).((arity g c (THeads +(Flat Appl) t0 u) (asucc g a)) \to ((arity g c (THeads (Flat Appl) t0 t) a) +\to (arity g c (THeads (Flat Appl) t0 (THead (Flat Cast) u t)) a))))) +(\lambda (a: A).(\lambda (H: (arity g c u (asucc g a))).(\lambda (H0: (arity +g c t a)).(arity_cast g c u a H t H0)))) (\lambda (t0: T).(\lambda (t1: +TList).(\lambda (H: ((\forall (a: A).((arity g c (THeads (Flat Appl) t1 u) +(asucc g a)) \to ((arity g c (THeads (Flat Appl) t1 t) a) \to (arity g c +(THeads (Flat Appl) t1 (THead (Flat Cast) u t)) a)))))).(\lambda (a: +A).(\lambda (H0: (arity g c (THead (Flat Appl) t0 (THeads (Flat Appl) t1 u)) +(asucc g a))).(\lambda (H1: (arity g c (THead (Flat Appl) t0 (THeads (Flat +Appl) t1 t)) a)).(let H2 \def (arity_gen_appl g c t0 (THeads (Flat Appl) t1 +t) a H1) in (ex2_ind A (\lambda (a1: A).(arity g c t0 a1)) (\lambda (a1: +A).(arity g c (THeads (Flat Appl) t1 t) (AHead a1 a))) (arity g c (THead +(Flat Appl) t0 (THeads (Flat Appl) t1 (THead (Flat Cast) u t))) a) (\lambda +(x: A).(\lambda (H3: (arity g c t0 x)).(\lambda (H4: (arity g c (THeads (Flat +Appl) t1 t) (AHead x a))).(let H5 \def (arity_gen_appl g c t0 (THeads (Flat +Appl) t1 u) (asucc g a) H0) in (ex2_ind A (\lambda (a1: A).(arity g c t0 a1)) +(\lambda (a1: A).(arity g c (THeads (Flat Appl) t1 u) (AHead a1 (asucc g +a)))) (arity g c (THead (Flat Appl) t0 (THeads (Flat Appl) t1 (THead (Flat +Cast) u t))) a) (\lambda (x0: A).(\lambda (H6: (arity g c t0 x0)).(\lambda +(H7: (arity g c (THeads (Flat Appl) t1 u) (AHead x0 (asucc g +a)))).(arity_appl g c t0 x H3 (THeads (Flat Appl) t1 (THead (Flat Cast) u t)) +a (H (AHead x a) (arity_repl g c (THeads (Flat Appl) t1 u) (AHead x (asucc g +a)) (arity_repl g c (THeads (Flat Appl) t1 u) (AHead x0 (asucc g a)) H7 +(AHead x (asucc g a)) (leq_head g x0 x (arity_mono g c t0 x0 H6 x H3) (asucc +g a) (asucc g a) (leq_refl g (asucc g a)))) (asucc g (AHead x a)) (leq_refl g +(asucc g (AHead x a)))) H4))))) H5))))) H2)))))))) vs))))). + +theorem arity_appls_abbr: + \forall (g: G).(\forall (c: C).(\forall (d: C).(\forall (v: T).(\forall (i: +nat).((getl i c (CHead d (Bind Abbr) v)) \to (\forall (vs: TList).(\forall +(a: A).((arity g c (THeads (Flat Appl) vs (lift (S i) O v)) a) \to (arity g c +(THeads (Flat Appl) vs (TLRef i)) a))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: +nat).(\lambda (H: (getl i c (CHead d (Bind Abbr) v))).(\lambda (vs: +TList).(TList_ind (\lambda (t: TList).(\forall (a: A).((arity g c (THeads +(Flat Appl) t (lift (S i) O v)) a) \to (arity g c (THeads (Flat Appl) t +(TLRef i)) a)))) (\lambda (a: A).(\lambda (H0: (arity g c (lift (S i) O v) +a)).(arity_abbr g c d v i H a (arity_gen_lift g c v a (S i) O H0 d (getl_drop +Abbr c d v i H))))) (\lambda (t: T).(\lambda (t0: TList).(\lambda (H0: +((\forall (a: A).((arity g c (THeads (Flat Appl) t0 (lift (S i) O v)) a) \to +(arity g c (THeads (Flat Appl) t0 (TLRef i)) a))))).(\lambda (a: A).(\lambda +(H1: (arity g c (THead (Flat Appl) t (THeads (Flat Appl) t0 (lift (S i) O +v))) a)).(let H2 \def (arity_gen_appl g c t (THeads (Flat Appl) t0 (lift (S +i) O v)) a H1) in (ex2_ind A (\lambda (a1: A).(arity g c t a1)) (\lambda (a1: +A).(arity g c (THeads (Flat Appl) t0 (lift (S i) O v)) (AHead a1 a))) (arity +g c (THead (Flat Appl) t (THeads (Flat Appl) t0 (TLRef i))) a) (\lambda (x: +A).(\lambda (H3: (arity g c t x)).(\lambda (H4: (arity g c (THeads (Flat +Appl) t0 (lift (S i) O v)) (AHead x a))).(arity_appl g c t x H3 (THeads (Flat +Appl) t0 (TLRef i)) a (H0 (AHead x a) H4))))) H2))))))) vs))))))). + +theorem arity_appls_bind: + \forall (g: G).(\forall (b: B).((not (eq B b Abst)) \to (\forall (c: +C).(\forall (v: T).(\forall (a1: A).((arity g c v a1) \to (\forall (t: +T).(\forall (vs: TList).(\forall (a2: A).((arity g (CHead c (Bind b) v) +(THeads (Flat Appl) (lifts (S O) O vs) t) a2) \to (arity g c (THeads (Flat +Appl) vs (THead (Bind b) v t)) a2))))))))))) +\def + \lambda (g: G).(\lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda +(c: C).(\lambda (v: T).(\lambda (a1: A).(\lambda (H0: (arity g c v +a1)).(\lambda (t: T).(\lambda (vs: TList).(TList_ind (\lambda (t0: +TList).(\forall (a2: A).((arity g (CHead c (Bind b) v) (THeads (Flat Appl) +(lifts (S O) O t0) t) a2) \to (arity g c (THeads (Flat Appl) t0 (THead (Bind +b) v t)) a2)))) (\lambda (a2: A).(\lambda (H1: (arity g (CHead c (Bind b) v) +t a2)).(arity_bind g b H c v a1 H0 t a2 H1))) (\lambda (t0: T).(\lambda (t1: +TList).(\lambda (H1: ((\forall (a2: A).((arity g (CHead c (Bind b) v) (THeads +(Flat Appl) (lifts (S O) O t1) t) a2) \to (arity g c (THeads (Flat Appl) t1 +(THead (Bind b) v t)) a2))))).(\lambda (a2: A).(\lambda (H2: (arity g (CHead +c (Bind b) v) (THead (Flat Appl) (lift (S O) O t0) (THeads (Flat Appl) (lifts +(S O) O t1) t)) a2)).(let H3 \def (arity_gen_appl g (CHead c (Bind b) v) +(lift (S O) O t0) (THeads (Flat Appl) (lifts (S O) O t1) t) a2 H2) in +(ex2_ind A (\lambda (a3: A).(arity g (CHead c (Bind b) v) (lift (S O) O t0) +a3)) (\lambda (a3: A).(arity g (CHead c (Bind b) v) (THeads (Flat Appl) +(lifts (S O) O t1) t) (AHead a3 a2))) (arity g c (THead (Flat Appl) t0 +(THeads (Flat Appl) t1 (THead (Bind b) v t))) a2) (\lambda (x: A).(\lambda +(H4: (arity g (CHead c (Bind b) v) (lift (S O) O t0) x)).(\lambda (H5: (arity +g (CHead c (Bind b) v) (THeads (Flat Appl) (lifts (S O) O t1) t) (AHead x +a2))).(arity_appl g c t0 x (arity_gen_lift g (CHead c (Bind b) v) t0 x (S O) +O H4 c (drop_drop (Bind b) O c c (drop_refl c) v)) (THeads (Flat Appl) t1 +(THead (Bind b) v t)) a2 (H1 (AHead x a2) H5))))) H3))))))) vs))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/subst0.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/subst0.ma new file mode 100644 index 000000000..4592f394a --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/subst0.ma @@ -0,0 +1,1129 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/arity/subst0". + +include "arity/props.ma". + +include "fsubst0/fwd.ma". + +include "csubst0/getl.ma". + +include "csubst0/props.ma". + +include "subst0/dec.ma". + +include "subst0/fwd.ma". + +include "getl/getl.ma". + +theorem arity_gen_cvoid_subst0: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (a: A).((arity g c t +a) \to (\forall (d: C).(\forall (u: T).(\forall (i: nat).((getl i c (CHead d +(Bind Void) u)) \to (\forall (w: T).(\forall (v: T).((subst0 i w t v) \to +(\forall (P: Prop).P)))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c t a)).(arity_ind g (\lambda (c0: C).(\lambda (t0: T).(\lambda (_: +A).(\forall (d: C).(\forall (u: T).(\forall (i: nat).((getl i c0 (CHead d +(Bind Void) u)) \to (\forall (w: T).(\forall (v: T).((subst0 i w t0 v) \to +(\forall (P: Prop).P))))))))))) (\lambda (c0: C).(\lambda (n: nat).(\lambda +(d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (_: (getl i c0 (CHead d +(Bind Void) u))).(\lambda (w: T).(\lambda (v: T).(\lambda (H1: (subst0 i w +(TSort n) v)).(\lambda (P: Prop).(subst0_gen_sort w v i n H1 P))))))))))) +(\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H0: (getl i c0 (CHead d (Bind Abbr) u))).(\lambda (a0: A).(\lambda (_: +(arity g d u a0)).(\lambda (_: ((\forall (d0: C).(\forall (u0: T).(\forall +(i0: nat).((getl i0 d (CHead d0 (Bind Void) u0)) \to (\forall (w: T).(\forall +(v: T).((subst0 i0 w u v) \to (\forall (P: Prop).P)))))))))).(\lambda (d0: +C).(\lambda (u0: T).(\lambda (i0: nat).(\lambda (H3: (getl i0 c0 (CHead d0 +(Bind Void) u0))).(\lambda (w: T).(\lambda (v: T).(\lambda (H4: (subst0 i0 w +(TLRef i) v)).(\lambda (P: Prop).(and_ind (eq nat i i0) (eq T v (lift (S i) O +w)) P (\lambda (H5: (eq nat i i0)).(\lambda (_: (eq T v (lift (S i) O +w))).(let H7 \def (eq_ind_r nat i0 (\lambda (n: nat).(getl n c0 (CHead d0 +(Bind Void) u0))) H3 i H5) in (let H8 \def (eq_ind C (CHead d (Bind Abbr) u) +(\lambda (c1: C).(getl i c0 c1)) H0 (CHead d0 (Bind Void) u0) (getl_mono c0 +(CHead d (Bind Abbr) u) i H0 (CHead d0 (Bind Void) u0) H7)) in (let H9 \def +(eq_ind C (CHead d (Bind Abbr) u) (\lambda (ee: C).(match ee in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +True | Abst \Rightarrow False | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead d0 (Bind Void) u0) (getl_mono c0 (CHead d +(Bind Abbr) u) i H0 (CHead d0 (Bind Void) u0) H7)) in (False_ind P H9)))))) +(subst0_gen_lref w v i0 i H4)))))))))))))))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i c0 (CHead d (Bind +Abst) u))).(\lambda (a0: A).(\lambda (_: (arity g d u (asucc g a0))).(\lambda +(_: ((\forall (d0: C).(\forall (u0: T).(\forall (i0: nat).((getl i0 d (CHead +d0 (Bind Void) u0)) \to (\forall (w: T).(\forall (v: T).((subst0 i0 w u v) +\to (\forall (P: Prop).P)))))))))).(\lambda (d0: C).(\lambda (u0: T).(\lambda +(i0: nat).(\lambda (H3: (getl i0 c0 (CHead d0 (Bind Void) u0))).(\lambda (w: +T).(\lambda (v: T).(\lambda (H4: (subst0 i0 w (TLRef i) v)).(\lambda (P: +Prop).(and_ind (eq nat i i0) (eq T v (lift (S i) O w)) P (\lambda (H5: (eq +nat i i0)).(\lambda (_: (eq T v (lift (S i) O w))).(let H7 \def (eq_ind_r nat +i0 (\lambda (n: nat).(getl n c0 (CHead d0 (Bind Void) u0))) H3 i H5) in (let +H8 \def (eq_ind C (CHead d (Bind Abst) u) (\lambda (c1: C).(getl i c0 c1)) H0 +(CHead d0 (Bind Void) u0) (getl_mono c0 (CHead d (Bind Abst) u) i H0 (CHead +d0 (Bind Void) u0) H7)) in (let H9 \def (eq_ind C (CHead d (Bind Abst) u) +(\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind b) \Rightarrow (match b in B return (\lambda (_: +B).Prop) with [Abbr \Rightarrow False | Abst \Rightarrow True | Void +\Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead d0 (Bind Void) +u0) (getl_mono c0 (CHead d (Bind Abst) u) i H0 (CHead d0 (Bind Void) u0) H7)) +in (False_ind P H9)))))) (subst0_gen_lref w v i0 i H4)))))))))))))))))) +(\lambda (b: B).(\lambda (_: (not (eq B b Abst))).(\lambda (c0: C).(\lambda +(u: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u a1)).(\lambda (H2: +((\forall (d: C).(\forall (u0: T).(\forall (i: nat).((getl i c0 (CHead d +(Bind Void) u0)) \to (\forall (w: T).(\forall (v: T).((subst0 i w u v) \to +(\forall (P: Prop).P)))))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: +(arity g (CHead c0 (Bind b) u) t0 a2)).(\lambda (H4: ((\forall (d: +C).(\forall (u0: T).(\forall (i: nat).((getl i (CHead c0 (Bind b) u) (CHead d +(Bind Void) u0)) \to (\forall (w: T).(\forall (v: T).((subst0 i w t0 v) \to +(\forall (P: Prop).P)))))))))).(\lambda (d: C).(\lambda (u0: T).(\lambda (i: +nat).(\lambda (H5: (getl i c0 (CHead d (Bind Void) u0))).(\lambda (w: +T).(\lambda (v: T).(\lambda (H6: (subst0 i w (THead (Bind b) u t0) +v)).(\lambda (P: Prop).(or3_ind (ex2 T (\lambda (u2: T).(eq T v (THead (Bind +b) u2 t0))) (\lambda (u2: T).(subst0 i w u u2))) (ex2 T (\lambda (t2: T).(eq +T v (THead (Bind b) u t2))) (\lambda (t2: T).(subst0 (s (Bind b) i) w t0 +t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T v (THead (Bind b) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i w u u2))) (\lambda (_: +T).(\lambda (t2: T).(subst0 (s (Bind b) i) w t0 t2)))) P (\lambda (H7: (ex2 T +(\lambda (u2: T).(eq T v (THead (Bind b) u2 t0))) (\lambda (u2: T).(subst0 i +w u u2)))).(ex2_ind T (\lambda (u2: T).(eq T v (THead (Bind b) u2 t0))) +(\lambda (u2: T).(subst0 i w u u2)) P (\lambda (x: T).(\lambda (_: (eq T v +(THead (Bind b) x t0))).(\lambda (H9: (subst0 i w u x)).(H2 d u0 i H5 w x H9 +P)))) H7)) (\lambda (H7: (ex2 T (\lambda (t2: T).(eq T v (THead (Bind b) u +t2))) (\lambda (t2: T).(subst0 (s (Bind b) i) w t0 t2)))).(ex2_ind T (\lambda +(t2: T).(eq T v (THead (Bind b) u t2))) (\lambda (t2: T).(subst0 (s (Bind b) +i) w t0 t2)) P (\lambda (x: T).(\lambda (_: (eq T v (THead (Bind b) u +x))).(\lambda (H9: (subst0 (s (Bind b) i) w t0 x)).(H4 d u0 (S i) +(getl_clear_bind b (CHead c0 (Bind b) u) c0 u (clear_bind b c0 u) (CHead d +(Bind Void) u0) i H5) w x H9 P)))) H7)) (\lambda (H7: (ex3_2 T T (\lambda +(u2: T).(\lambda (t2: T).(eq T v (THead (Bind b) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i w u u2))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s (Bind b) i) w t0 t2))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t2: T).(eq T v (THead (Bind b) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i w u u2))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s (Bind b) i) w t0 t2))) P (\lambda (x0: T).(\lambda (x1: +T).(\lambda (_: (eq T v (THead (Bind b) x0 x1))).(\lambda (H9: (subst0 i w u +x0)).(\lambda (_: (subst0 (s (Bind b) i) w t0 x1)).(H2 d u0 i H5 w x0 H9 +P)))))) H7)) (subst0_gen_head (Bind b) w u t0 v i H6))))))))))))))))))))) +(\lambda (c0: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (_: (arity g c0 u +(asucc g a1))).(\lambda (H1: ((\forall (d: C).(\forall (u0: T).(\forall (i: +nat).((getl i c0 (CHead d (Bind Void) u0)) \to (\forall (w: T).(\forall (v: +T).((subst0 i w u v) \to (\forall (P: Prop).P)))))))))).(\lambda (t0: +T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c0 (Bind Abst) u) t0 +a2)).(\lambda (H3: ((\forall (d: C).(\forall (u0: T).(\forall (i: nat).((getl +i (CHead c0 (Bind Abst) u) (CHead d (Bind Void) u0)) \to (\forall (w: +T).(\forall (v: T).((subst0 i w t0 v) \to (\forall (P: +Prop).P)))))))))).(\lambda (d: C).(\lambda (u0: T).(\lambda (i: nat).(\lambda +(H4: (getl i c0 (CHead d (Bind Void) u0))).(\lambda (w: T).(\lambda (v: +T).(\lambda (H5: (subst0 i w (THead (Bind Abst) u t0) v)).(\lambda (P: +Prop).(or3_ind (ex2 T (\lambda (u2: T).(eq T v (THead (Bind Abst) u2 t0))) +(\lambda (u2: T).(subst0 i w u u2))) (ex2 T (\lambda (t2: T).(eq T v (THead +(Bind Abst) u t2))) (\lambda (t2: T).(subst0 (s (Bind Abst) i) w t0 t2))) +(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T v (THead (Bind Abst) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i w u u2))) (\lambda (_: +T).(\lambda (t2: T).(subst0 (s (Bind Abst) i) w t0 t2)))) P (\lambda (H6: +(ex2 T (\lambda (u2: T).(eq T v (THead (Bind Abst) u2 t0))) (\lambda (u2: +T).(subst0 i w u u2)))).(ex2_ind T (\lambda (u2: T).(eq T v (THead (Bind +Abst) u2 t0))) (\lambda (u2: T).(subst0 i w u u2)) P (\lambda (x: T).(\lambda +(_: (eq T v (THead (Bind Abst) x t0))).(\lambda (H8: (subst0 i w u x)).(H1 d +u0 i H4 w x H8 P)))) H6)) (\lambda (H6: (ex2 T (\lambda (t2: T).(eq T v +(THead (Bind Abst) u t2))) (\lambda (t2: T).(subst0 (s (Bind Abst) i) w t0 +t2)))).(ex2_ind T (\lambda (t2: T).(eq T v (THead (Bind Abst) u t2))) +(\lambda (t2: T).(subst0 (s (Bind Abst) i) w t0 t2)) P (\lambda (x: +T).(\lambda (_: (eq T v (THead (Bind Abst) u x))).(\lambda (H8: (subst0 (s +(Bind Abst) i) w t0 x)).(H3 d u0 (S i) (getl_clear_bind Abst (CHead c0 (Bind +Abst) u) c0 u (clear_bind Abst c0 u) (CHead d (Bind Void) u0) i H4) w x H8 +P)))) H6)) (\lambda (H6: (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T v +(THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i w u +u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s (Bind Abst) i) w t0 +t2))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t2: T).(eq T v (THead (Bind +Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i w u u2))) (\lambda +(_: T).(\lambda (t2: T).(subst0 (s (Bind Abst) i) w t0 t2))) P (\lambda (x0: +T).(\lambda (x1: T).(\lambda (_: (eq T v (THead (Bind Abst) x0 x1))).(\lambda +(H8: (subst0 i w u x0)).(\lambda (_: (subst0 (s (Bind Abst) i) w t0 x1)).(H1 +d u0 i H4 w x0 H8 P)))))) H6)) (subst0_gen_head (Bind Abst) w u t0 v i +H5))))))))))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda (a1: +A).(\lambda (_: (arity g c0 u a1)).(\lambda (H1: ((\forall (d: C).(\forall +(u0: T).(\forall (i: nat).((getl i c0 (CHead d (Bind Void) u0)) \to (\forall +(w: T).(\forall (v: T).((subst0 i w u v) \to (\forall (P: +Prop).P)))))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity g c0 +t0 (AHead a1 a2))).(\lambda (H3: ((\forall (d: C).(\forall (u0: T).(\forall +(i: nat).((getl i c0 (CHead d (Bind Void) u0)) \to (\forall (w: T).(\forall +(v: T).((subst0 i w t0 v) \to (\forall (P: Prop).P)))))))))).(\lambda (d: +C).(\lambda (u0: T).(\lambda (i: nat).(\lambda (H4: (getl i c0 (CHead d (Bind +Void) u0))).(\lambda (w: T).(\lambda (v: T).(\lambda (H5: (subst0 i w (THead +(Flat Appl) u t0) v)).(\lambda (P: Prop).(or3_ind (ex2 T (\lambda (u2: T).(eq +T v (THead (Flat Appl) u2 t0))) (\lambda (u2: T).(subst0 i w u u2))) (ex2 T +(\lambda (t2: T).(eq T v (THead (Flat Appl) u t2))) (\lambda (t2: T).(subst0 +(s (Flat Appl) i) w t0 t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq +T v (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i w +u u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s (Flat Appl) i) w t0 +t2)))) P (\lambda (H6: (ex2 T (\lambda (u2: T).(eq T v (THead (Flat Appl) u2 +t0))) (\lambda (u2: T).(subst0 i w u u2)))).(ex2_ind T (\lambda (u2: T).(eq T +v (THead (Flat Appl) u2 t0))) (\lambda (u2: T).(subst0 i w u u2)) P (\lambda +(x: T).(\lambda (_: (eq T v (THead (Flat Appl) x t0))).(\lambda (H8: (subst0 +i w u x)).(H1 d u0 i H4 w x H8 P)))) H6)) (\lambda (H6: (ex2 T (\lambda (t2: +T).(eq T v (THead (Flat Appl) u t2))) (\lambda (t2: T).(subst0 (s (Flat Appl) +i) w t0 t2)))).(ex2_ind T (\lambda (t2: T).(eq T v (THead (Flat Appl) u t2))) +(\lambda (t2: T).(subst0 (s (Flat Appl) i) w t0 t2)) P (\lambda (x: +T).(\lambda (_: (eq T v (THead (Flat Appl) u x))).(\lambda (H8: (subst0 (s +(Flat Appl) i) w t0 x)).(H3 d u0 i H4 w x H8 P)))) H6)) (\lambda (H6: (ex3_2 +T T (\lambda (u2: T).(\lambda (t2: T).(eq T v (THead (Flat Appl) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i w u u2))) (\lambda (_: T).(\lambda +(t2: T).(subst0 (s (Flat Appl) i) w t0 t2))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t2: T).(eq T v (THead (Flat Appl) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i w u u2))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s (Flat Appl) i) w t0 t2))) P (\lambda (x0: T).(\lambda (x1: +T).(\lambda (_: (eq T v (THead (Flat Appl) x0 x1))).(\lambda (H8: (subst0 i w +u x0)).(\lambda (_: (subst0 (s (Flat Appl) i) w t0 x1)).(H1 d u0 i H4 w x0 H8 +P)))))) H6)) (subst0_gen_head (Flat Appl) w u t0 v i H5))))))))))))))))))) +(\lambda (c0: C).(\lambda (u: T).(\lambda (a0: A).(\lambda (_: (arity g c0 u +(asucc g a0))).(\lambda (H1: ((\forall (d: C).(\forall (u0: T).(\forall (i: +nat).((getl i c0 (CHead d (Bind Void) u0)) \to (\forall (w: T).(\forall (v: +T).((subst0 i w u v) \to (\forall (P: Prop).P)))))))))).(\lambda (t0: +T).(\lambda (_: (arity g c0 t0 a0)).(\lambda (H3: ((\forall (d: C).(\forall +(u0: T).(\forall (i: nat).((getl i c0 (CHead d (Bind Void) u0)) \to (\forall +(w: T).(\forall (v: T).((subst0 i w t0 v) \to (\forall (P: +Prop).P)))))))))).(\lambda (d: C).(\lambda (u0: T).(\lambda (i: nat).(\lambda +(H4: (getl i c0 (CHead d (Bind Void) u0))).(\lambda (w: T).(\lambda (v: +T).(\lambda (H5: (subst0 i w (THead (Flat Cast) u t0) v)).(\lambda (P: +Prop).(or3_ind (ex2 T (\lambda (u2: T).(eq T v (THead (Flat Cast) u2 t0))) +(\lambda (u2: T).(subst0 i w u u2))) (ex2 T (\lambda (t2: T).(eq T v (THead +(Flat Cast) u t2))) (\lambda (t2: T).(subst0 (s (Flat Cast) i) w t0 t2))) +(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T v (THead (Flat Cast) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i w u u2))) (\lambda (_: +T).(\lambda (t2: T).(subst0 (s (Flat Cast) i) w t0 t2)))) P (\lambda (H6: +(ex2 T (\lambda (u2: T).(eq T v (THead (Flat Cast) u2 t0))) (\lambda (u2: +T).(subst0 i w u u2)))).(ex2_ind T (\lambda (u2: T).(eq T v (THead (Flat +Cast) u2 t0))) (\lambda (u2: T).(subst0 i w u u2)) P (\lambda (x: T).(\lambda +(_: (eq T v (THead (Flat Cast) x t0))).(\lambda (H8: (subst0 i w u x)).(H1 d +u0 i H4 w x H8 P)))) H6)) (\lambda (H6: (ex2 T (\lambda (t2: T).(eq T v +(THead (Flat Cast) u t2))) (\lambda (t2: T).(subst0 (s (Flat Cast) i) w t0 +t2)))).(ex2_ind T (\lambda (t2: T).(eq T v (THead (Flat Cast) u t2))) +(\lambda (t2: T).(subst0 (s (Flat Cast) i) w t0 t2)) P (\lambda (x: +T).(\lambda (_: (eq T v (THead (Flat Cast) u x))).(\lambda (H8: (subst0 (s +(Flat Cast) i) w t0 x)).(H3 d u0 i H4 w x H8 P)))) H6)) (\lambda (H6: (ex3_2 +T T (\lambda (u2: T).(\lambda (t2: T).(eq T v (THead (Flat Cast) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i w u u2))) (\lambda (_: T).(\lambda +(t2: T).(subst0 (s (Flat Cast) i) w t0 t2))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t2: T).(eq T v (THead (Flat Cast) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i w u u2))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s (Flat Cast) i) w t0 t2))) P (\lambda (x0: T).(\lambda (x1: +T).(\lambda (_: (eq T v (THead (Flat Cast) x0 x1))).(\lambda (H8: (subst0 i w +u x0)).(\lambda (_: (subst0 (s (Flat Cast) i) w t0 x1)).(H1 d u0 i H4 w x0 H8 +P)))))) H6)) (subst0_gen_head (Flat Cast) w u t0 v i H5)))))))))))))))))) +(\lambda (c0: C).(\lambda (t0: T).(\lambda (a1: A).(\lambda (_: (arity g c0 +t0 a1)).(\lambda (H1: ((\forall (d: C).(\forall (u: T).(\forall (i: +nat).((getl i c0 (CHead d (Bind Void) u)) \to (\forall (w: T).(\forall (v: +T).((subst0 i w t0 v) \to (\forall (P: Prop).P)))))))))).(\lambda (a2: +A).(\lambda (_: (leq g a1 a2)).(\lambda (d: C).(\lambda (u: T).(\lambda (i: +nat).(\lambda (H3: (getl i c0 (CHead d (Bind Void) u))).(\lambda (w: +T).(\lambda (v: T).(\lambda (H4: (subst0 i w t0 v)).(\lambda (P: Prop).(H1 d +u i H3 w v H4 P)))))))))))))))) c t a H))))). + +theorem arity_gen_cvoid: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (a: A).((arity g c t +a) \to (\forall (d: C).(\forall (u: T).(\forall (i: nat).((getl i c (CHead d +(Bind Void) u)) \to (ex T (\lambda (v: T).(eq T t (lift (S O) i v)))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c t a)).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H0: (getl i c (CHead d (Bind Void) u))).(let H_x \def (dnf_dec u t i) in +(let H1 \def H_x in (ex_ind T (\lambda (v: T).(or (subst0 i u t (lift (S O) i +v)) (eq T t (lift (S O) i v)))) (ex T (\lambda (v: T).(eq T t (lift (S O) i +v)))) (\lambda (x: T).(\lambda (H2: (or (subst0 i u t (lift (S O) i x)) (eq T +t (lift (S O) i x)))).(or_ind (subst0 i u t (lift (S O) i x)) (eq T t (lift +(S O) i x)) (ex T (\lambda (v: T).(eq T t (lift (S O) i v)))) (\lambda (H3: +(subst0 i u t (lift (S O) i x))).(arity_gen_cvoid_subst0 g c t a H d u i H0 u +(lift (S O) i x) H3 (ex T (\lambda (v: T).(eq T t (lift (S O) i v)))))) +(\lambda (H3: (eq T t (lift (S O) i x))).(let H4 \def (eq_ind T t (\lambda +(t0: T).(arity g c t0 a)) H (lift (S O) i x) H3) in (eq_ind_r T (lift (S O) i +x) (\lambda (t0: T).(ex T (\lambda (v: T).(eq T t0 (lift (S O) i v))))) +(ex_intro T (\lambda (v: T).(eq T (lift (S O) i x) (lift (S O) i v))) x +(refl_equal T (lift (S O) i x))) t H3))) H2))) H1))))))))))). + +theorem arity_fsubst0: + \forall (g: G).(\forall (c1: C).(\forall (t1: T).(\forall (a: A).((arity g +c1 t1 a) \to (\forall (d1: C).(\forall (u: T).(\forall (i: nat).((getl i c1 +(CHead d1 (Bind Abbr) u)) \to (\forall (c2: C).(\forall (t2: T).((fsubst0 i u +c1 t1 c2 t2) \to (arity g c2 t2 a)))))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t1: T).(\lambda (a: A).(\lambda +(H: (arity g c1 t1 a)).(arity_ind g (\lambda (c: C).(\lambda (t: T).(\lambda +(a0: A).(\forall (d1: C).(\forall (u: T).(\forall (i: nat).((getl i c (CHead +d1 (Bind Abbr) u)) \to (\forall (c2: C).(\forall (t2: T).((fsubst0 i u c t c2 +t2) \to (arity g c2 t2 a0))))))))))) (\lambda (c: C).(\lambda (n: +nat).(\lambda (d1: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (_: (getl i +c (CHead d1 (Bind Abbr) u))).(\lambda (c2: C).(\lambda (t2: T).(\lambda (H1: +(fsubst0 i u c (TSort n) c2 t2)).(let H2 \def (fsubst0_gen_base c c2 (TSort +n) t2 u i H1) in (or3_ind (land (eq C c c2) (subst0 i u (TSort n) t2)) (land +(eq T (TSort n) t2) (csubst0 i u c c2)) (land (subst0 i u (TSort n) t2) +(csubst0 i u c c2)) (arity g c2 t2 (ASort O n)) (\lambda (H3: (land (eq C c +c2) (subst0 i u (TSort n) t2))).(and_ind (eq C c c2) (subst0 i u (TSort n) +t2) (arity g c2 t2 (ASort O n)) (\lambda (H4: (eq C c c2)).(\lambda (H5: +(subst0 i u (TSort n) t2)).(eq_ind C c (\lambda (c0: C).(arity g c0 t2 (ASort +O n))) (subst0_gen_sort u t2 i n H5 (arity g c t2 (ASort O n))) c2 H4))) H3)) +(\lambda (H3: (land (eq T (TSort n) t2) (csubst0 i u c c2))).(and_ind (eq T +(TSort n) t2) (csubst0 i u c c2) (arity g c2 t2 (ASort O n)) (\lambda (H4: +(eq T (TSort n) t2)).(\lambda (_: (csubst0 i u c c2)).(eq_ind T (TSort n) +(\lambda (t: T).(arity g c2 t (ASort O n))) (arity_sort g c2 n) t2 H4))) H3)) +(\lambda (H3: (land (subst0 i u (TSort n) t2) (csubst0 i u c c2))).(and_ind +(subst0 i u (TSort n) t2) (csubst0 i u c c2) (arity g c2 t2 (ASort O n)) +(\lambda (H4: (subst0 i u (TSort n) t2)).(\lambda (_: (csubst0 i u c +c2)).(subst0_gen_sort u t2 i n H4 (arity g c2 t2 (ASort O n))))) H3)) +H2))))))))))) (\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: +nat).(\lambda (H0: (getl i c (CHead d (Bind Abbr) u))).(\lambda (a0: +A).(\lambda (H1: (arity g d u a0)).(\lambda (H2: ((\forall (d1: C).(\forall +(u0: T).(\forall (i0: nat).((getl i0 d (CHead d1 (Bind Abbr) u0)) \to +(\forall (c2: C).(\forall (t2: T).((fsubst0 i0 u0 d u c2 t2) \to (arity g c2 +t2 a0)))))))))).(\lambda (d1: C).(\lambda (u0: T).(\lambda (i0: nat).(\lambda +(H3: (getl i0 c (CHead d1 (Bind Abbr) u0))).(\lambda (c2: C).(\lambda (t2: +T).(\lambda (H4: (fsubst0 i0 u0 c (TLRef i) c2 t2)).(let H5 \def +(fsubst0_gen_base c c2 (TLRef i) t2 u0 i0 H4) in (or3_ind (land (eq C c c2) +(subst0 i0 u0 (TLRef i) t2)) (land (eq T (TLRef i) t2) (csubst0 i0 u0 c c2)) +(land (subst0 i0 u0 (TLRef i) t2) (csubst0 i0 u0 c c2)) (arity g c2 t2 a0) +(\lambda (H6: (land (eq C c c2) (subst0 i0 u0 (TLRef i) t2))).(and_ind (eq C +c c2) (subst0 i0 u0 (TLRef i) t2) (arity g c2 t2 a0) (\lambda (H7: (eq C c +c2)).(\lambda (H8: (subst0 i0 u0 (TLRef i) t2)).(eq_ind C c (\lambda (c0: +C).(arity g c0 t2 a0)) (and_ind (eq nat i i0) (eq T t2 (lift (S i) O u0)) +(arity g c t2 a0) (\lambda (H9: (eq nat i i0)).(\lambda (H10: (eq T t2 (lift +(S i) O u0))).(eq_ind_r T (lift (S i) O u0) (\lambda (t: T).(arity g c t a0)) +(let H11 \def (eq_ind_r nat i0 (\lambda (n: nat).(getl n c (CHead d1 (Bind +Abbr) u0))) H3 i H9) in (let H12 \def (eq_ind C (CHead d (Bind Abbr) u) +(\lambda (c0: C).(getl i c c0)) H0 (CHead d1 (Bind Abbr) u0) (getl_mono c +(CHead d (Bind Abbr) u) i H0 (CHead d1 (Bind Abbr) u0) H11)) in (let H13 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow d | (CHead c0 _ _) \Rightarrow c0])) (CHead d (Bind +Abbr) u) (CHead d1 (Bind Abbr) u0) (getl_mono c (CHead d (Bind Abbr) u) i H0 +(CHead d1 (Bind Abbr) u0) H11)) in ((let H14 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | +(CHead _ _ t) \Rightarrow t])) (CHead d (Bind Abbr) u) (CHead d1 (Bind Abbr) +u0) (getl_mono c (CHead d (Bind Abbr) u) i H0 (CHead d1 (Bind Abbr) u0) H11)) +in (\lambda (H15: (eq C d d1)).(let H16 \def (eq_ind_r T u0 (\lambda (t: +T).(getl i c (CHead d1 (Bind Abbr) t))) H12 u H14) in (eq_ind T u (\lambda +(t: T).(arity g c (lift (S i) O t) a0)) (let H17 \def (eq_ind_r C d1 (\lambda +(c0: C).(getl i c (CHead c0 (Bind Abbr) u))) H16 d H15) in (arity_lift g d u +a0 H1 c (S i) O (getl_drop Abbr c d u i H17))) u0 H14)))) H13)))) t2 H10))) +(subst0_gen_lref u0 t2 i0 i H8)) c2 H7))) H6)) (\lambda (H6: (land (eq T +(TLRef i) t2) (csubst0 i0 u0 c c2))).(and_ind (eq T (TLRef i) t2) (csubst0 i0 +u0 c c2) (arity g c2 t2 a0) (\lambda (H7: (eq T (TLRef i) t2)).(\lambda (H8: +(csubst0 i0 u0 c c2)).(eq_ind T (TLRef i) (\lambda (t: T).(arity g c2 t a0)) +(lt_le_e i i0 (arity g c2 (TLRef i) a0) (\lambda (H9: (lt i i0)).(let H10 +\def (csubst0_getl_lt i0 i H9 c c2 u0 H8 (CHead d (Bind Abbr) u) H0) in +(or4_ind (getl i c2 (CHead d (Bind Abbr) u)) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind +Abbr) u) (CHead e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(getl i c2 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u1: T).(getl i c2 (CHead e2 (Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) +u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(getl i c2 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))) +(arity g c2 (TLRef i) a0) (\lambda (H11: (getl i c2 (CHead d (Bind Abbr) +u))).(let H12 \def (eq_ind nat (minus i0 i) (\lambda (n: nat).(getl n (CHead +d (Bind Abbr) u) (CHead d1 (Bind Abbr) u0))) (getl_conf_le i0 (CHead d1 (Bind +Abbr) u0) c H3 (CHead d (Bind Abbr) u) i H0 (le_S_n i i0 (le_S (S i) i0 H9))) +(S (minus i0 (S i))) (minus_x_Sy i0 i H9)) in (arity_abbr g c2 d u i H11 a0 +H1))) (\lambda (H11: (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda +(u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e0 (Bind b) +u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl i c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) u0 u1 +w))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e0 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl i c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (w: T).(subst0 (minus i0 (S i)) u0 u1 w))))) (arity g c2 (TLRef +i) a0) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (H12: (eq C (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x2))).(\lambda (H13: (getl i c2 (CHead x1 (Bind x0) x3))).(\lambda (H14: +(subst0 (minus i0 (S i)) u0 x2 x3)).(let H15 \def (eq_ind nat (minus i0 i) +(\lambda (n: nat).(getl n (CHead d (Bind Abbr) u) (CHead d1 (Bind Abbr) u0))) +(getl_conf_le i0 (CHead d1 (Bind Abbr) u0) c H3 (CHead d (Bind Abbr) u) i H0 +(le_S_n i i0 (le_S (S i) i0 H9))) (S (minus i0 (S i))) (minus_x_Sy i0 i H9)) +in (let H16 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) \Rightarrow c0])) +(CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x2) H12) in ((let H17 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abbr | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b) \Rightarrow b | (Flat _) \Rightarrow +Abbr])])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x2) H12) in ((let H18 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow t])) (CHead d (Bind +Abbr) u) (CHead x1 (Bind x0) x2) H12) in (\lambda (H19: (eq B Abbr +x0)).(\lambda (H20: (eq C d x1)).(let H21 \def (eq_ind_r T x2 (\lambda (t: +T).(subst0 (minus i0 (S i)) u0 t x3)) H14 u H18) in (let H22 \def (eq_ind_r C +x1 (\lambda (c0: C).(getl i c2 (CHead c0 (Bind x0) x3))) H13 d H20) in (let +H23 \def (eq_ind_r B x0 (\lambda (b: B).(getl i c2 (CHead d (Bind b) x3))) +H22 Abbr H19) in (arity_abbr g c2 d x3 i H23 a0 (H2 d1 u0 (r (Bind Abbr) +(minus i0 (S i))) (getl_gen_S (Bind Abbr) d (CHead d1 (Bind Abbr) u0) u +(minus i0 (S i)) H15) d x3 (fsubst0_snd (r (Bind Abbr) (minus i0 (S i))) u0 d +u x3 H21))))))))) H17)) H16)))))))))) H11)) (\lambda (H11: (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C +(CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c2 (CHead e2 (Bind b) +u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))).(ex3_4_ind B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind +Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u1: T).(getl i c2 (CHead e2 (Bind b) u1)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (S +i)) u0 e1 e2))))) (arity g c2 (TLRef i) a0) (\lambda (x0: B).(\lambda (x1: +C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H12: (eq C (CHead d (Bind +Abbr) u) (CHead x1 (Bind x0) x3))).(\lambda (H13: (getl i c2 (CHead x2 (Bind +x0) x3))).(\lambda (H14: (csubst0 (minus i0 (S i)) u0 x1 x2)).(let H15 \def +(eq_ind nat (minus i0 i) (\lambda (n: nat).(getl n (CHead d (Bind Abbr) u) +(CHead d1 (Bind Abbr) u0))) (getl_conf_le i0 (CHead d1 (Bind Abbr) u0) c H3 +(CHead d (Bind Abbr) u) i H0 (le_S_n i i0 (le_S (S i) i0 H9))) (S (minus i0 +(S i))) (minus_x_Sy i0 i H9)) in (let H16 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c0 _ _) \Rightarrow c0])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3) H12) in ((let H17 \def (f_equal C B (\lambda (e: C).(match e in C return +(\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3) H12) in ((let H18 \def (f_equal C T (\lambda (e: C).(match e +in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t) +\Rightarrow t])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H12) in +(\lambda (H19: (eq B Abbr x0)).(\lambda (H20: (eq C d x1)).(let H21 \def +(eq_ind_r T x3 (\lambda (t: T).(getl i c2 (CHead x2 (Bind x0) t))) H13 u H18) +in (let H22 \def (eq_ind_r C x1 (\lambda (c0: C).(csubst0 (minus i0 (S i)) u0 +c0 x2)) H14 d H20) in (let H23 \def (eq_ind_r B x0 (\lambda (b: B).(getl i c2 +(CHead x2 (Bind b) u))) H21 Abbr H19) in (arity_abbr g c2 x2 u i H23 a0 (H2 +d1 u0 (r (Bind Abbr) (minus i0 (S i))) (getl_gen_S (Bind Abbr) d (CHead d1 +(Bind Abbr) u0) u (minus i0 (S i)) H15) x2 u (fsubst0_fst (r (Bind Abbr) +(minus i0 (S i))) u0 d u x2 H22))))))))) H17)) H16)))))))))) H11)) (\lambda +(H11: (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c2 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 +e2)))))))).(ex4_5_ind B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c2 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) +(arity g c2 (TLRef i) a0) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: +C).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H12: (eq C (CHead d (Bind +Abbr) u) (CHead x1 (Bind x0) x3))).(\lambda (H13: (getl i c2 (CHead x2 (Bind +x0) x4))).(\lambda (H14: (subst0 (minus i0 (S i)) u0 x3 x4)).(\lambda (H15: +(csubst0 (minus i0 (S i)) u0 x1 x2)).(let H16 \def (eq_ind nat (minus i0 i) +(\lambda (n: nat).(getl n (CHead d (Bind Abbr) u) (CHead d1 (Bind Abbr) u0))) +(getl_conf_le i0 (CHead d1 (Bind Abbr) u0) c H3 (CHead d (Bind Abbr) u) i H0 +(le_S_n i i0 (le_S (S i) i0 H9))) (S (minus i0 (S i))) (minus_x_Sy i0 i H9)) +in (let H17 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) \Rightarrow c0])) +(CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H12) in ((let H18 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abbr | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b) \Rightarrow b | (Flat _) \Rightarrow +Abbr])])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H12) in ((let H19 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow t])) (CHead d (Bind +Abbr) u) (CHead x1 (Bind x0) x3) H12) in (\lambda (H20: (eq B Abbr +x0)).(\lambda (H21: (eq C d x1)).(let H22 \def (eq_ind_r T x3 (\lambda (t: +T).(subst0 (minus i0 (S i)) u0 t x4)) H14 u H19) in (let H23 \def (eq_ind_r C +x1 (\lambda (c0: C).(csubst0 (minus i0 (S i)) u0 c0 x2)) H15 d H21) in (let +H24 \def (eq_ind_r B x0 (\lambda (b: B).(getl i c2 (CHead x2 (Bind b) x4))) +H13 Abbr H20) in (arity_abbr g c2 x2 x4 i H24 a0 (H2 d1 u0 (r (Bind Abbr) +(minus i0 (S i))) (getl_gen_S (Bind Abbr) d (CHead d1 (Bind Abbr) u0) u +(minus i0 (S i)) H16) x2 x4 (fsubst0_both (r (Bind Abbr) (minus i0 (S i))) u0 +d u x4 H22 x2 H23))))))))) H18)) H17)))))))))))) H11)) H10))) (\lambda (H9: +(le i0 i)).(arity_abbr g c2 d u i (csubst0_getl_ge i0 i H9 c c2 u0 H8 (CHead +d (Bind Abbr) u) H0) a0 H1))) t2 H7))) H6)) (\lambda (H6: (land (subst0 i0 u0 +(TLRef i) t2) (csubst0 i0 u0 c c2))).(and_ind (subst0 i0 u0 (TLRef i) t2) +(csubst0 i0 u0 c c2) (arity g c2 t2 a0) (\lambda (H7: (subst0 i0 u0 (TLRef i) +t2)).(\lambda (H8: (csubst0 i0 u0 c c2)).(and_ind (eq nat i i0) (eq T t2 +(lift (S i) O u0)) (arity g c2 t2 a0) (\lambda (H9: (eq nat i i0)).(\lambda +(H10: (eq T t2 (lift (S i) O u0))).(eq_ind_r T (lift (S i) O u0) (\lambda (t: +T).(arity g c2 t a0)) (let H11 \def (eq_ind_r nat i0 (\lambda (n: +nat).(csubst0 n u0 c c2)) H8 i H9) in (let H12 \def (eq_ind_r nat i0 (\lambda +(n: nat).(getl n c (CHead d1 (Bind Abbr) u0))) H3 i H9) in (let H13 \def +(eq_ind C (CHead d (Bind Abbr) u) (\lambda (c0: C).(getl i c c0)) H0 (CHead +d1 (Bind Abbr) u0) (getl_mono c (CHead d (Bind Abbr) u) i H0 (CHead d1 (Bind +Abbr) u0) H12)) in (let H14 \def (f_equal C C (\lambda (e: C).(match e in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) +\Rightarrow c0])) (CHead d (Bind Abbr) u) (CHead d1 (Bind Abbr) u0) +(getl_mono c (CHead d (Bind Abbr) u) i H0 (CHead d1 (Bind Abbr) u0) H12)) in +((let H15 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: +C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow t])) (CHead d +(Bind Abbr) u) (CHead d1 (Bind Abbr) u0) (getl_mono c (CHead d (Bind Abbr) u) +i H0 (CHead d1 (Bind Abbr) u0) H12)) in (\lambda (H16: (eq C d d1)).(let H17 +\def (eq_ind_r T u0 (\lambda (t: T).(getl i c (CHead d1 (Bind Abbr) t))) H13 +u H15) in (let H18 \def (eq_ind_r T u0 (\lambda (t: T).(csubst0 i t c c2)) +H11 u H15) in (eq_ind T u (\lambda (t: T).(arity g c2 (lift (S i) O t) a0)) +(let H19 \def (eq_ind_r C d1 (\lambda (c0: C).(getl i c (CHead c0 (Bind Abbr) +u))) H17 d H16) in (arity_lift g d u a0 H1 c2 (S i) O (getl_drop Abbr c2 d u +i (csubst0_getl_ge i i (le_n i) c c2 u H18 (CHead d (Bind Abbr) u) H19)))) u0 +H15))))) H14))))) t2 H10))) (subst0_gen_lref u0 t2 i0 i H7)))) H6)) +H5))))))))))))))))) (\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda +(i: nat).(\lambda (H0: (getl i c (CHead d (Bind Abst) u))).(\lambda (a0: +A).(\lambda (H1: (arity g d u (asucc g a0))).(\lambda (H2: ((\forall (d1: +C).(\forall (u0: T).(\forall (i0: nat).((getl i0 d (CHead d1 (Bind Abbr) u0)) +\to (\forall (c2: C).(\forall (t2: T).((fsubst0 i0 u0 d u c2 t2) \to (arity g +c2 t2 (asucc g a0))))))))))).(\lambda (d1: C).(\lambda (u0: T).(\lambda (i0: +nat).(\lambda (H3: (getl i0 c (CHead d1 (Bind Abbr) u0))).(\lambda (c2: +C).(\lambda (t2: T).(\lambda (H4: (fsubst0 i0 u0 c (TLRef i) c2 t2)).(let H5 +\def (fsubst0_gen_base c c2 (TLRef i) t2 u0 i0 H4) in (or3_ind (land (eq C c +c2) (subst0 i0 u0 (TLRef i) t2)) (land (eq T (TLRef i) t2) (csubst0 i0 u0 c +c2)) (land (subst0 i0 u0 (TLRef i) t2) (csubst0 i0 u0 c c2)) (arity g c2 t2 +a0) (\lambda (H6: (land (eq C c c2) (subst0 i0 u0 (TLRef i) t2))).(and_ind +(eq C c c2) (subst0 i0 u0 (TLRef i) t2) (arity g c2 t2 a0) (\lambda (H7: (eq +C c c2)).(\lambda (H8: (subst0 i0 u0 (TLRef i) t2)).(eq_ind C c (\lambda (c0: +C).(arity g c0 t2 a0)) (and_ind (eq nat i i0) (eq T t2 (lift (S i) O u0)) +(arity g c t2 a0) (\lambda (H9: (eq nat i i0)).(\lambda (H10: (eq T t2 (lift +(S i) O u0))).(eq_ind_r T (lift (S i) O u0) (\lambda (t: T).(arity g c t a0)) +(let H11 \def (eq_ind_r nat i0 (\lambda (n: nat).(getl n c (CHead d1 (Bind +Abbr) u0))) H3 i H9) in (let H12 \def (eq_ind C (CHead d (Bind Abst) u) +(\lambda (c0: C).(getl i c c0)) H0 (CHead d1 (Bind Abbr) u0) (getl_mono c +(CHead d (Bind Abst) u) i H0 (CHead d1 (Bind Abbr) u0) H11)) in (let H13 \def +(eq_ind C (CHead d (Bind Abst) u) (\lambda (ee: C).(match ee in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead d1 (Bind Abbr) u0) (getl_mono c (CHead d +(Bind Abst) u) i H0 (CHead d1 (Bind Abbr) u0) H11)) in (False_ind (arity g c +(lift (S i) O u0) a0) H13)))) t2 H10))) (subst0_gen_lref u0 t2 i0 i H8)) c2 +H7))) H6)) (\lambda (H6: (land (eq T (TLRef i) t2) (csubst0 i0 u0 c +c2))).(and_ind (eq T (TLRef i) t2) (csubst0 i0 u0 c c2) (arity g c2 t2 a0) +(\lambda (H7: (eq T (TLRef i) t2)).(\lambda (H8: (csubst0 i0 u0 c +c2)).(eq_ind T (TLRef i) (\lambda (t: T).(arity g c2 t a0)) (lt_le_e i i0 +(arity g c2 (TLRef i) a0) (\lambda (H9: (lt i i0)).(let H10 \def +(csubst0_getl_lt i0 i H9 c c2 u0 H8 (CHead d (Bind Abst) u) H0) in (or4_ind +(getl i c2 (CHead d (Bind Abst) u)) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abst) u) (CHead +e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl i c2 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) +u0 u1 w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(eq C (CHead d (Bind Abst) u) (CHead e1 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c2 +(CHead e2 (Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C (CHead d (Bind Abst) u) (CHead e1 (Bind b) u1))))))) (\lambda +(b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl +i c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) u0 u1 w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))) (arity g c2 (TLRef i) a0) +(\lambda (H11: (getl i c2 (CHead d (Bind Abst) u))).(let H12 \def (eq_ind nat +(minus i0 i) (\lambda (n: nat).(getl n (CHead d (Bind Abst) u) (CHead d1 +(Bind Abbr) u0))) (getl_conf_le i0 (CHead d1 (Bind Abbr) u0) c H3 (CHead d +(Bind Abst) u) i H0 (le_S_n i i0 (le_S (S i) i0 H9))) (S (minus i0 (S i))) +(minus_x_Sy i0 i H9)) in (arity_abst g c2 d u i H11 a0 H1))) (\lambda (H11: +(ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(eq C (CHead d (Bind Abst) u) (CHead e0 (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl i c2 (CHead e0 +(Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda +(w: T).(subst0 (minus i0 (S i)) u0 u1 w))))))).(ex3_4_ind B C T T (\lambda +(b: B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind +Abst) u) (CHead e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(getl i c2 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w))))) (arity g c2 (TLRef i) a0) (\lambda (x0: +B).(\lambda (x1: C).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H12: (eq C +(CHead d (Bind Abst) u) (CHead x1 (Bind x0) x2))).(\lambda (H13: (getl i c2 +(CHead x1 (Bind x0) x3))).(\lambda (H14: (subst0 (minus i0 (S i)) u0 x2 +x3)).(let H15 \def (eq_ind nat (minus i0 i) (\lambda (n: nat).(getl n (CHead +d (Bind Abst) u) (CHead d1 (Bind Abbr) u0))) (getl_conf_le i0 (CHead d1 (Bind +Abbr) u0) c H3 (CHead d (Bind Abst) u) i H0 (le_S_n i i0 (le_S (S i) i0 H9))) +(S (minus i0 (S i))) (minus_x_Sy i0 i H9)) in (let H16 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow d | (CHead c0 _ _) \Rightarrow c0])) (CHead d (Bind Abst) u) +(CHead x1 (Bind x0) x2) H12) in ((let H17 \def (f_equal C B (\lambda (e: +C).(match e in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abst | +(CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind +b) \Rightarrow b | (Flat _) \Rightarrow Abst])])) (CHead d (Bind Abst) u) +(CHead x1 (Bind x0) x2) H12) in ((let H18 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | +(CHead _ _ t) \Rightarrow t])) (CHead d (Bind Abst) u) (CHead x1 (Bind x0) +x2) H12) in (\lambda (H19: (eq B Abst x0)).(\lambda (H20: (eq C d x1)).(let +H21 \def (eq_ind_r T x2 (\lambda (t: T).(subst0 (minus i0 (S i)) u0 t x3)) +H14 u H18) in (let H22 \def (eq_ind_r C x1 (\lambda (c0: C).(getl i c2 (CHead +c0 (Bind x0) x3))) H13 d H20) in (let H23 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c2 (CHead d (Bind b) x3))) H22 Abst H19) in (arity_abst g c2 d x3 +i H23 a0 (H2 d1 u0 (r (Bind Abst) (minus i0 (S i))) (getl_gen_S (Bind Abst) d +(CHead d1 (Bind Abbr) u0) u (minus i0 (S i)) H15) d x3 (fsubst0_snd (r (Bind +Abst) (minus i0 (S i))) u0 d u x3 H21))))))))) H17)) H16)))))))))) H11)) +(\lambda (H11: (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(eq C (CHead d (Bind Abst) u) (CHead e1 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c2 +(CHead e2 (Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))).(ex3_4_ind B C C +T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C +(CHead d (Bind Abst) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c2 (CHead e2 (Bind b) +u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (S i)) u0 e1 e2))))) (arity g c2 (TLRef i) a0) (\lambda +(x0: B).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H12: (eq +C (CHead d (Bind Abst) u) (CHead x1 (Bind x0) x3))).(\lambda (H13: (getl i c2 +(CHead x2 (Bind x0) x3))).(\lambda (H14: (csubst0 (minus i0 (S i)) u0 x1 +x2)).(let H15 \def (eq_ind nat (minus i0 i) (\lambda (n: nat).(getl n (CHead +d (Bind Abst) u) (CHead d1 (Bind Abbr) u0))) (getl_conf_le i0 (CHead d1 (Bind +Abbr) u0) c H3 (CHead d (Bind Abst) u) i H0 (le_S_n i i0 (le_S (S i) i0 H9))) +(S (minus i0 (S i))) (minus_x_Sy i0 i H9)) in (let H16 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow d | (CHead c0 _ _) \Rightarrow c0])) (CHead d (Bind Abst) u) +(CHead x1 (Bind x0) x3) H12) in ((let H17 \def (f_equal C B (\lambda (e: +C).(match e in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abst | +(CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind +b) \Rightarrow b | (Flat _) \Rightarrow Abst])])) (CHead d (Bind Abst) u) +(CHead x1 (Bind x0) x3) H12) in ((let H18 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | +(CHead _ _ t) \Rightarrow t])) (CHead d (Bind Abst) u) (CHead x1 (Bind x0) +x3) H12) in (\lambda (H19: (eq B Abst x0)).(\lambda (H20: (eq C d x1)).(let +H21 \def (eq_ind_r T x3 (\lambda (t: T).(getl i c2 (CHead x2 (Bind x0) t))) +H13 u H18) in (let H22 \def (eq_ind_r C x1 (\lambda (c0: C).(csubst0 (minus +i0 (S i)) u0 c0 x2)) H14 d H20) in (let H23 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c2 (CHead x2 (Bind b) u))) H21 Abst H19) in (arity_abst g c2 x2 u +i H23 a0 (H2 d1 u0 (r (Bind Abst) (minus i0 (S i))) (getl_gen_S (Bind Abst) d +(CHead d1 (Bind Abbr) u0) u (minus i0 (S i)) H15) x2 u (fsubst0_fst (r (Bind +Abst) (minus i0 (S i))) u0 d u x2 H22))))))))) H17)) H16)))))))))) H11)) +(\lambda (H11: (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abst) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c2 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 +e2)))))))).(ex4_5_ind B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abst) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c2 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) +(arity g c2 (TLRef i) a0) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: +C).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H12: (eq C (CHead d (Bind +Abst) u) (CHead x1 (Bind x0) x3))).(\lambda (H13: (getl i c2 (CHead x2 (Bind +x0) x4))).(\lambda (H14: (subst0 (minus i0 (S i)) u0 x3 x4)).(\lambda (H15: +(csubst0 (minus i0 (S i)) u0 x1 x2)).(let H16 \def (eq_ind nat (minus i0 i) +(\lambda (n: nat).(getl n (CHead d (Bind Abst) u) (CHead d1 (Bind Abbr) u0))) +(getl_conf_le i0 (CHead d1 (Bind Abbr) u0) c H3 (CHead d (Bind Abst) u) i H0 +(le_S_n i i0 (le_S (S i) i0 H9))) (S (minus i0 (S i))) (minus_x_Sy i0 i H9)) +in (let H17 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) \Rightarrow c0])) +(CHead d (Bind Abst) u) (CHead x1 (Bind x0) x3) H12) in ((let H18 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abst | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b) \Rightarrow b | (Flat _) \Rightarrow +Abst])])) (CHead d (Bind Abst) u) (CHead x1 (Bind x0) x3) H12) in ((let H19 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow t])) (CHead d (Bind +Abst) u) (CHead x1 (Bind x0) x3) H12) in (\lambda (H20: (eq B Abst +x0)).(\lambda (H21: (eq C d x1)).(let H22 \def (eq_ind_r T x3 (\lambda (t: +T).(subst0 (minus i0 (S i)) u0 t x4)) H14 u H19) in (let H23 \def (eq_ind_r C +x1 (\lambda (c0: C).(csubst0 (minus i0 (S i)) u0 c0 x2)) H15 d H21) in (let +H24 \def (eq_ind_r B x0 (\lambda (b: B).(getl i c2 (CHead x2 (Bind b) x4))) +H13 Abst H20) in (arity_abst g c2 x2 x4 i H24 a0 (H2 d1 u0 (r (Bind Abst) +(minus i0 (S i))) (getl_gen_S (Bind Abst) d (CHead d1 (Bind Abbr) u0) u +(minus i0 (S i)) H16) x2 x4 (fsubst0_both (r (Bind Abst) (minus i0 (S i))) u0 +d u x4 H22 x2 H23))))))))) H18)) H17)))))))))))) H11)) H10))) (\lambda (H9: +(le i0 i)).(arity_abst g c2 d u i (csubst0_getl_ge i0 i H9 c c2 u0 H8 (CHead +d (Bind Abst) u) H0) a0 H1))) t2 H7))) H6)) (\lambda (H6: (land (subst0 i0 u0 +(TLRef i) t2) (csubst0 i0 u0 c c2))).(and_ind (subst0 i0 u0 (TLRef i) t2) +(csubst0 i0 u0 c c2) (arity g c2 t2 a0) (\lambda (H7: (subst0 i0 u0 (TLRef i) +t2)).(\lambda (H8: (csubst0 i0 u0 c c2)).(and_ind (eq nat i i0) (eq T t2 +(lift (S i) O u0)) (arity g c2 t2 a0) (\lambda (H9: (eq nat i i0)).(\lambda +(H10: (eq T t2 (lift (S i) O u0))).(eq_ind_r T (lift (S i) O u0) (\lambda (t: +T).(arity g c2 t a0)) (let H11 \def (eq_ind_r nat i0 (\lambda (n: +nat).(csubst0 n u0 c c2)) H8 i H9) in (let H12 \def (eq_ind_r nat i0 (\lambda +(n: nat).(getl n c (CHead d1 (Bind Abbr) u0))) H3 i H9) in (let H13 \def +(eq_ind C (CHead d (Bind Abst) u) (\lambda (c0: C).(getl i c c0)) H0 (CHead +d1 (Bind Abbr) u0) (getl_mono c (CHead d (Bind Abst) u) i H0 (CHead d1 (Bind +Abbr) u0) H12)) in (let H14 \def (eq_ind C (CHead d (Bind Abst) u) (\lambda +(ee: C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind b) \Rightarrow (match b in B return (\lambda (_: +B).Prop) with [Abbr \Rightarrow False | Abst \Rightarrow True | Void +\Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead d1 (Bind Abbr) +u0) (getl_mono c (CHead d (Bind Abst) u) i H0 (CHead d1 (Bind Abbr) u0) H12)) +in (False_ind (arity g c2 (lift (S i) O u0) a0) H14))))) t2 H10))) +(subst0_gen_lref u0 t2 i0 i H7)))) H6)) H5))))))))))))))))) (\lambda (b: +B).(\lambda (H0: (not (eq B b Abst))).(\lambda (c: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (H1: (arity g c u a1)).(\lambda (H2: ((\forall +(d1: C).(\forall (u0: T).(\forall (i: nat).((getl i c (CHead d1 (Bind Abbr) +u0)) \to (\forall (c2: C).(\forall (t2: T).((fsubst0 i u0 c u c2 t2) \to +(arity g c2 t2 a1)))))))))).(\lambda (t: T).(\lambda (a2: A).(\lambda (_: +(arity g (CHead c (Bind b) u) t a2)).(\lambda (H4: ((\forall (d1: C).(\forall +(u0: T).(\forall (i: nat).((getl i (CHead c (Bind b) u) (CHead d1 (Bind Abbr) +u0)) \to (\forall (c2: C).(\forall (t2: T).((fsubst0 i u0 (CHead c (Bind b) +u) t c2 t2) \to (arity g c2 t2 a2)))))))))).(\lambda (d1: C).(\lambda (u0: +T).(\lambda (i: nat).(\lambda (H5: (getl i c (CHead d1 (Bind Abbr) +u0))).(\lambda (c2: C).(\lambda (t2: T).(\lambda (H6: (fsubst0 i u0 c (THead +(Bind b) u t) c2 t2)).(let H7 \def (fsubst0_gen_base c c2 (THead (Bind b) u +t) t2 u0 i H6) in (or3_ind (land (eq C c c2) (subst0 i u0 (THead (Bind b) u +t) t2)) (land (eq T (THead (Bind b) u t) t2) (csubst0 i u0 c c2)) (land +(subst0 i u0 (THead (Bind b) u t) t2) (csubst0 i u0 c c2)) (arity g c2 t2 a2) +(\lambda (H8: (land (eq C c c2) (subst0 i u0 (THead (Bind b) u t) +t2))).(and_ind (eq C c c2) (subst0 i u0 (THead (Bind b) u t) t2) (arity g c2 +t2 a2) (\lambda (H9: (eq C c c2)).(\lambda (H10: (subst0 i u0 (THead (Bind b) +u t) t2)).(eq_ind C c (\lambda (c0: C).(arity g c0 t2 a2)) (or3_ind (ex2 T +(\lambda (u2: T).(eq T t2 (THead (Bind b) u2 t))) (\lambda (u2: T).(subst0 i +u0 u u2))) (ex2 T (\lambda (t3: T).(eq T t2 (THead (Bind b) u t3))) (\lambda +(t3: T).(subst0 (s (Bind b) i) u0 t t3))) (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind b) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind b) i) u0 t t3)))) (arity g c t2 a2) (\lambda (H11: (ex2 T +(\lambda (u2: T).(eq T t2 (THead (Bind b) u2 t))) (\lambda (u2: T).(subst0 i +u0 u u2)))).(ex2_ind T (\lambda (u2: T).(eq T t2 (THead (Bind b) u2 t))) +(\lambda (u2: T).(subst0 i u0 u u2)) (arity g c t2 a2) (\lambda (x: +T).(\lambda (H12: (eq T t2 (THead (Bind b) x t))).(\lambda (H13: (subst0 i u0 +u x)).(eq_ind_r T (THead (Bind b) x t) (\lambda (t0: T).(arity g c t0 a2)) +(arity_bind g b H0 c x a1 (H2 d1 u0 i H5 c x (fsubst0_snd i u0 c u x H13)) t +a2 (H4 d1 u0 (S i) (getl_clear_bind b (CHead c (Bind b) u) c u (clear_bind b +c u) (CHead d1 (Bind Abbr) u0) i H5) (CHead c (Bind b) x) t (fsubst0_fst (S +i) u0 (CHead c (Bind b) u) t (CHead c (Bind b) x) (csubst0_snd_bind b i u0 u +x H13 c)))) t2 H12)))) H11)) (\lambda (H11: (ex2 T (\lambda (t3: T).(eq T t2 +(THead (Bind b) u t3))) (\lambda (t3: T).(subst0 (s (Bind b) i) u0 t +t3)))).(ex2_ind T (\lambda (t3: T).(eq T t2 (THead (Bind b) u t3))) (\lambda +(t3: T).(subst0 (s (Bind b) i) u0 t t3)) (arity g c t2 a2) (\lambda (x: +T).(\lambda (H12: (eq T t2 (THead (Bind b) u x))).(\lambda (H13: (subst0 (s +(Bind b) i) u0 t x)).(eq_ind_r T (THead (Bind b) u x) (\lambda (t0: T).(arity +g c t0 a2)) (arity_bind g b H0 c u a1 H1 x a2 (H4 d1 u0 (S i) +(getl_clear_bind b (CHead c (Bind b) u) c u (clear_bind b c u) (CHead d1 +(Bind Abbr) u0) i H5) (CHead c (Bind b) u) x (fsubst0_snd (S i) u0 (CHead c +(Bind b) u) t x H13))) t2 H12)))) H11)) (\lambda (H11: (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind b) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind b) i) u0 t t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind b) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind b) i) u0 t t3))) (arity g c t2 a2) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H12: (eq T t2 (THead (Bind b) x0 x1))).(\lambda +(H13: (subst0 i u0 u x0)).(\lambda (H14: (subst0 (s (Bind b) i) u0 t +x1)).(eq_ind_r T (THead (Bind b) x0 x1) (\lambda (t0: T).(arity g c t0 a2)) +(arity_bind g b H0 c x0 a1 (H2 d1 u0 i H5 c x0 (fsubst0_snd i u0 c u x0 H13)) +x1 a2 (H4 d1 u0 (S i) (getl_clear_bind b (CHead c (Bind b) u) c u (clear_bind +b c u) (CHead d1 (Bind Abbr) u0) i H5) (CHead c (Bind b) x0) x1 (fsubst0_both +(S i) u0 (CHead c (Bind b) u) t x1 H14 (CHead c (Bind b) x0) +(csubst0_snd_bind b i u0 u x0 H13 c)))) t2 H12)))))) H11)) (subst0_gen_head +(Bind b) u0 u t t2 i H10)) c2 H9))) H8)) (\lambda (H8: (land (eq T (THead +(Bind b) u t) t2) (csubst0 i u0 c c2))).(and_ind (eq T (THead (Bind b) u t) +t2) (csubst0 i u0 c c2) (arity g c2 t2 a2) (\lambda (H9: (eq T (THead (Bind +b) u t) t2)).(\lambda (H10: (csubst0 i u0 c c2)).(eq_ind T (THead (Bind b) u +t) (\lambda (t0: T).(arity g c2 t0 a2)) (arity_bind g b H0 c2 u a1 (H2 d1 u0 +i H5 c2 u (fsubst0_fst i u0 c u c2 H10)) t a2 (H4 d1 u0 (S i) +(getl_clear_bind b (CHead c (Bind b) u) c u (clear_bind b c u) (CHead d1 +(Bind Abbr) u0) i H5) (CHead c2 (Bind b) u) t (fsubst0_fst (S i) u0 (CHead c +(Bind b) u) t (CHead c2 (Bind b) u) (csubst0_fst_bind b i c c2 u0 H10 u)))) +t2 H9))) H8)) (\lambda (H8: (land (subst0 i u0 (THead (Bind b) u t) t2) +(csubst0 i u0 c c2))).(and_ind (subst0 i u0 (THead (Bind b) u t) t2) (csubst0 +i u0 c c2) (arity g c2 t2 a2) (\lambda (H9: (subst0 i u0 (THead (Bind b) u t) +t2)).(\lambda (H10: (csubst0 i u0 c c2)).(or3_ind (ex2 T (\lambda (u2: T).(eq +T t2 (THead (Bind b) u2 t))) (\lambda (u2: T).(subst0 i u0 u u2))) (ex2 T +(\lambda (t3: T).(eq T t2 (THead (Bind b) u t3))) (\lambda (t3: T).(subst0 (s +(Bind b) i) u0 t t3))) (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 +(THead (Bind b) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u +u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Bind b) i) u0 t t3)))) +(arity g c2 t2 a2) (\lambda (H11: (ex2 T (\lambda (u2: T).(eq T t2 (THead +(Bind b) u2 t))) (\lambda (u2: T).(subst0 i u0 u u2)))).(ex2_ind T (\lambda +(u2: T).(eq T t2 (THead (Bind b) u2 t))) (\lambda (u2: T).(subst0 i u0 u u2)) +(arity g c2 t2 a2) (\lambda (x: T).(\lambda (H12: (eq T t2 (THead (Bind b) x +t))).(\lambda (H13: (subst0 i u0 u x)).(eq_ind_r T (THead (Bind b) x t) +(\lambda (t0: T).(arity g c2 t0 a2)) (arity_bind g b H0 c2 x a1 (H2 d1 u0 i +H5 c2 x (fsubst0_both i u0 c u x H13 c2 H10)) t a2 (H4 d1 u0 (S i) +(getl_clear_bind b (CHead c (Bind b) u) c u (clear_bind b c u) (CHead d1 +(Bind Abbr) u0) i H5) (CHead c2 (Bind b) x) t (fsubst0_fst (S i) u0 (CHead c +(Bind b) u) t (CHead c2 (Bind b) x) (csubst0_both_bind b i u0 u x H13 c c2 +H10)))) t2 H12)))) H11)) (\lambda (H11: (ex2 T (\lambda (t3: T).(eq T t2 +(THead (Bind b) u t3))) (\lambda (t3: T).(subst0 (s (Bind b) i) u0 t +t3)))).(ex2_ind T (\lambda (t3: T).(eq T t2 (THead (Bind b) u t3))) (\lambda +(t3: T).(subst0 (s (Bind b) i) u0 t t3)) (arity g c2 t2 a2) (\lambda (x: +T).(\lambda (H12: (eq T t2 (THead (Bind b) u x))).(\lambda (H13: (subst0 (s +(Bind b) i) u0 t x)).(eq_ind_r T (THead (Bind b) u x) (\lambda (t0: T).(arity +g c2 t0 a2)) (arity_bind g b H0 c2 u a1 (H2 d1 u0 i H5 c2 u (fsubst0_fst i u0 +c u c2 H10)) x a2 (H4 d1 u0 (S i) (getl_clear_bind b (CHead c (Bind b) u) c u +(clear_bind b c u) (CHead d1 (Bind Abbr) u0) i H5) (CHead c2 (Bind b) u) x +(fsubst0_both (S i) u0 (CHead c (Bind b) u) t x H13 (CHead c2 (Bind b) u) +(csubst0_fst_bind b i c c2 u0 H10 u)))) t2 H12)))) H11)) (\lambda (H11: +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind b) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind b) i) u0 t t3))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind b) u2 t3)))) (\lambda +(u2: T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind b) i) u0 t t3))) (arity g c2 t2 a2) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H12: (eq T t2 (THead (Bind b) x0 x1))).(\lambda +(H13: (subst0 i u0 u x0)).(\lambda (H14: (subst0 (s (Bind b) i) u0 t +x1)).(eq_ind_r T (THead (Bind b) x0 x1) (\lambda (t0: T).(arity g c2 t0 a2)) +(arity_bind g b H0 c2 x0 a1 (H2 d1 u0 i H5 c2 x0 (fsubst0_both i u0 c u x0 +H13 c2 H10)) x1 a2 (H4 d1 u0 (S i) (getl_clear_bind b (CHead c (Bind b) u) c +u (clear_bind b c u) (CHead d1 (Bind Abbr) u0) i H5) (CHead c2 (Bind b) x0) +x1 (fsubst0_both (S i) u0 (CHead c (Bind b) u) t x1 H14 (CHead c2 (Bind b) +x0) (csubst0_both_bind b i u0 u x0 H13 c c2 H10)))) t2 H12)))))) H11)) +(subst0_gen_head (Bind b) u0 u t t2 i H9)))) H8)) H7)))))))))))))))))))) +(\lambda (c: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (H0: (arity g c u +(asucc g a1))).(\lambda (H1: ((\forall (d1: C).(\forall (u0: T).(\forall (i: +nat).((getl i c (CHead d1 (Bind Abbr) u0)) \to (\forall (c2: C).(\forall (t2: +T).((fsubst0 i u0 c u c2 t2) \to (arity g c2 t2 (asucc g +a1))))))))))).(\lambda (t: T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c +(Bind Abst) u) t a2)).(\lambda (H3: ((\forall (d1: C).(\forall (u0: +T).(\forall (i: nat).((getl i (CHead c (Bind Abst) u) (CHead d1 (Bind Abbr) +u0)) \to (\forall (c2: C).(\forall (t2: T).((fsubst0 i u0 (CHead c (Bind +Abst) u) t c2 t2) \to (arity g c2 t2 a2)))))))))).(\lambda (d1: C).(\lambda +(u0: T).(\lambda (i: nat).(\lambda (H4: (getl i c (CHead d1 (Bind Abbr) +u0))).(\lambda (c2: C).(\lambda (t2: T).(\lambda (H5: (fsubst0 i u0 c (THead +(Bind Abst) u t) c2 t2)).(let H6 \def (fsubst0_gen_base c c2 (THead (Bind +Abst) u t) t2 u0 i H5) in (or3_ind (land (eq C c c2) (subst0 i u0 (THead +(Bind Abst) u t) t2)) (land (eq T (THead (Bind Abst) u t) t2) (csubst0 i u0 c +c2)) (land (subst0 i u0 (THead (Bind Abst) u t) t2) (csubst0 i u0 c c2)) +(arity g c2 t2 (AHead a1 a2)) (\lambda (H7: (land (eq C c c2) (subst0 i u0 +(THead (Bind Abst) u t) t2))).(and_ind (eq C c c2) (subst0 i u0 (THead (Bind +Abst) u t) t2) (arity g c2 t2 (AHead a1 a2)) (\lambda (H8: (eq C c +c2)).(\lambda (H9: (subst0 i u0 (THead (Bind Abst) u t) t2)).(eq_ind C c +(\lambda (c0: C).(arity g c0 t2 (AHead a1 a2))) (or3_ind (ex2 T (\lambda (u2: +T).(eq T t2 (THead (Bind Abst) u2 t))) (\lambda (u2: T).(subst0 i u0 u u2))) +(ex2 T (\lambda (t3: T).(eq T t2 (THead (Bind Abst) u t3))) (\lambda (t3: +T).(subst0 (s (Bind Abst) i) u0 t t3))) (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T t2 (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Bind +Abst) i) u0 t t3)))) (arity g c t2 (AHead a1 a2)) (\lambda (H10: (ex2 T +(\lambda (u2: T).(eq T t2 (THead (Bind Abst) u2 t))) (\lambda (u2: T).(subst0 +i u0 u u2)))).(ex2_ind T (\lambda (u2: T).(eq T t2 (THead (Bind Abst) u2 t))) +(\lambda (u2: T).(subst0 i u0 u u2)) (arity g c t2 (AHead a1 a2)) (\lambda +(x: T).(\lambda (H11: (eq T t2 (THead (Bind Abst) x t))).(\lambda (H12: +(subst0 i u0 u x)).(eq_ind_r T (THead (Bind Abst) x t) (\lambda (t0: +T).(arity g c t0 (AHead a1 a2))) (arity_head g c x a1 (H1 d1 u0 i H4 c x +(fsubst0_snd i u0 c u x H12)) t a2 (H3 d1 u0 (S i) (getl_clear_bind Abst +(CHead c (Bind Abst) u) c u (clear_bind Abst c u) (CHead d1 (Bind Abbr) u0) i +H4) (CHead c (Bind Abst) x) t (fsubst0_fst (S i) u0 (CHead c (Bind Abst) u) t +(CHead c (Bind Abst) x) (csubst0_snd_bind Abst i u0 u x H12 c)))) t2 H11)))) +H10)) (\lambda (H10: (ex2 T (\lambda (t3: T).(eq T t2 (THead (Bind Abst) u +t3))) (\lambda (t3: T).(subst0 (s (Bind Abst) i) u0 t t3)))).(ex2_ind T +(\lambda (t3: T).(eq T t2 (THead (Bind Abst) u t3))) (\lambda (t3: T).(subst0 +(s (Bind Abst) i) u0 t t3)) (arity g c t2 (AHead a1 a2)) (\lambda (x: +T).(\lambda (H11: (eq T t2 (THead (Bind Abst) u x))).(\lambda (H12: (subst0 +(s (Bind Abst) i) u0 t x)).(eq_ind_r T (THead (Bind Abst) u x) (\lambda (t0: +T).(arity g c t0 (AHead a1 a2))) (arity_head g c u a1 H0 x a2 (H3 d1 u0 (S i) +(getl_clear_bind Abst (CHead c (Bind Abst) u) c u (clear_bind Abst c u) +(CHead d1 (Bind Abbr) u0) i H4) (CHead c (Bind Abst) u) x (fsubst0_snd (S i) +u0 (CHead c (Bind Abst) u) t x H12))) t2 H11)))) H10)) (\lambda (H10: (ex3_2 +T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abst) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Abst) i) u0 t t3))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abst) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Abst) i) u0 t t3))) (arity g c t2 (AHead +a1 a2)) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H11: (eq T t2 (THead +(Bind Abst) x0 x1))).(\lambda (H12: (subst0 i u0 u x0)).(\lambda (H13: +(subst0 (s (Bind Abst) i) u0 t x1)).(eq_ind_r T (THead (Bind Abst) x0 x1) +(\lambda (t0: T).(arity g c t0 (AHead a1 a2))) (arity_head g c x0 a1 (H1 d1 +u0 i H4 c x0 (fsubst0_snd i u0 c u x0 H12)) x1 a2 (H3 d1 u0 (S i) +(getl_clear_bind Abst (CHead c (Bind Abst) u) c u (clear_bind Abst c u) +(CHead d1 (Bind Abbr) u0) i H4) (CHead c (Bind Abst) x0) x1 (fsubst0_both (S +i) u0 (CHead c (Bind Abst) u) t x1 H13 (CHead c (Bind Abst) x0) +(csubst0_snd_bind Abst i u0 u x0 H12 c)))) t2 H11)))))) H10)) +(subst0_gen_head (Bind Abst) u0 u t t2 i H9)) c2 H8))) H7)) (\lambda (H7: +(land (eq T (THead (Bind Abst) u t) t2) (csubst0 i u0 c c2))).(and_ind (eq T +(THead (Bind Abst) u t) t2) (csubst0 i u0 c c2) (arity g c2 t2 (AHead a1 a2)) +(\lambda (H8: (eq T (THead (Bind Abst) u t) t2)).(\lambda (H9: (csubst0 i u0 +c c2)).(eq_ind T (THead (Bind Abst) u t) (\lambda (t0: T).(arity g c2 t0 +(AHead a1 a2))) (arity_head g c2 u a1 (H1 d1 u0 i H4 c2 u (fsubst0_fst i u0 c +u c2 H9)) t a2 (H3 d1 u0 (S i) (getl_clear_bind Abst (CHead c (Bind Abst) u) +c u (clear_bind Abst c u) (CHead d1 (Bind Abbr) u0) i H4) (CHead c2 (Bind +Abst) u) t (fsubst0_fst (S i) u0 (CHead c (Bind Abst) u) t (CHead c2 (Bind +Abst) u) (csubst0_fst_bind Abst i c c2 u0 H9 u)))) t2 H8))) H7)) (\lambda +(H7: (land (subst0 i u0 (THead (Bind Abst) u t) t2) (csubst0 i u0 c +c2))).(and_ind (subst0 i u0 (THead (Bind Abst) u t) t2) (csubst0 i u0 c c2) +(arity g c2 t2 (AHead a1 a2)) (\lambda (H8: (subst0 i u0 (THead (Bind Abst) u +t) t2)).(\lambda (H9: (csubst0 i u0 c c2)).(or3_ind (ex2 T (\lambda (u2: +T).(eq T t2 (THead (Bind Abst) u2 t))) (\lambda (u2: T).(subst0 i u0 u u2))) +(ex2 T (\lambda (t3: T).(eq T t2 (THead (Bind Abst) u t3))) (\lambda (t3: +T).(subst0 (s (Bind Abst) i) u0 t t3))) (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T t2 (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Bind +Abst) i) u0 t t3)))) (arity g c2 t2 (AHead a1 a2)) (\lambda (H10: (ex2 T +(\lambda (u2: T).(eq T t2 (THead (Bind Abst) u2 t))) (\lambda (u2: T).(subst0 +i u0 u u2)))).(ex2_ind T (\lambda (u2: T).(eq T t2 (THead (Bind Abst) u2 t))) +(\lambda (u2: T).(subst0 i u0 u u2)) (arity g c2 t2 (AHead a1 a2)) (\lambda +(x: T).(\lambda (H11: (eq T t2 (THead (Bind Abst) x t))).(\lambda (H12: +(subst0 i u0 u x)).(eq_ind_r T (THead (Bind Abst) x t) (\lambda (t0: +T).(arity g c2 t0 (AHead a1 a2))) (arity_head g c2 x a1 (H1 d1 u0 i H4 c2 x +(fsubst0_both i u0 c u x H12 c2 H9)) t a2 (H3 d1 u0 (S i) (getl_clear_bind +Abst (CHead c (Bind Abst) u) c u (clear_bind Abst c u) (CHead d1 (Bind Abbr) +u0) i H4) (CHead c2 (Bind Abst) x) t (fsubst0_fst (S i) u0 (CHead c (Bind +Abst) u) t (CHead c2 (Bind Abst) x) (csubst0_both_bind Abst i u0 u x H12 c c2 +H9)))) t2 H11)))) H10)) (\lambda (H10: (ex2 T (\lambda (t3: T).(eq T t2 +(THead (Bind Abst) u t3))) (\lambda (t3: T).(subst0 (s (Bind Abst) i) u0 t +t3)))).(ex2_ind T (\lambda (t3: T).(eq T t2 (THead (Bind Abst) u t3))) +(\lambda (t3: T).(subst0 (s (Bind Abst) i) u0 t t3)) (arity g c2 t2 (AHead a1 +a2)) (\lambda (x: T).(\lambda (H11: (eq T t2 (THead (Bind Abst) u +x))).(\lambda (H12: (subst0 (s (Bind Abst) i) u0 t x)).(eq_ind_r T (THead +(Bind Abst) u x) (\lambda (t0: T).(arity g c2 t0 (AHead a1 a2))) (arity_head +g c2 u a1 (H1 d1 u0 i H4 c2 u (fsubst0_fst i u0 c u c2 H9)) x a2 (H3 d1 u0 (S +i) (getl_clear_bind Abst (CHead c (Bind Abst) u) c u (clear_bind Abst c u) +(CHead d1 (Bind Abbr) u0) i H4) (CHead c2 (Bind Abst) u) x (fsubst0_both (S +i) u0 (CHead c (Bind Abst) u) t x H12 (CHead c2 (Bind Abst) u) +(csubst0_fst_bind Abst i c c2 u0 H9 u)))) t2 H11)))) H10)) (\lambda (H10: +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abst) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Abst) i) u0 t t3))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abst) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Abst) i) u0 t t3))) (arity g c2 t2 +(AHead a1 a2)) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H11: (eq T t2 +(THead (Bind Abst) x0 x1))).(\lambda (H12: (subst0 i u0 u x0)).(\lambda (H13: +(subst0 (s (Bind Abst) i) u0 t x1)).(eq_ind_r T (THead (Bind Abst) x0 x1) +(\lambda (t0: T).(arity g c2 t0 (AHead a1 a2))) (arity_head g c2 x0 a1 (H1 d1 +u0 i H4 c2 x0 (fsubst0_both i u0 c u x0 H12 c2 H9)) x1 a2 (H3 d1 u0 (S i) +(getl_clear_bind Abst (CHead c (Bind Abst) u) c u (clear_bind Abst c u) +(CHead d1 (Bind Abbr) u0) i H4) (CHead c2 (Bind Abst) x0) x1 (fsubst0_both (S +i) u0 (CHead c (Bind Abst) u) t x1 H13 (CHead c2 (Bind Abst) x0) +(csubst0_both_bind Abst i u0 u x0 H12 c c2 H9)))) t2 H11)))))) H10)) +(subst0_gen_head (Bind Abst) u0 u t t2 i H8)))) H7)) H6)))))))))))))))))) +(\lambda (c: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (H0: (arity g c u +a1)).(\lambda (H1: ((\forall (d1: C).(\forall (u0: T).(\forall (i: +nat).((getl i c (CHead d1 (Bind Abbr) u0)) \to (\forall (c2: C).(\forall (t2: +T).((fsubst0 i u0 c u c2 t2) \to (arity g c2 t2 a1)))))))))).(\lambda (t: +T).(\lambda (a2: A).(\lambda (H2: (arity g c t (AHead a1 a2))).(\lambda (H3: +((\forall (d1: C).(\forall (u0: T).(\forall (i: nat).((getl i c (CHead d1 +(Bind Abbr) u0)) \to (\forall (c2: C).(\forall (t2: T).((fsubst0 i u0 c t c2 +t2) \to (arity g c2 t2 (AHead a1 a2))))))))))).(\lambda (d1: C).(\lambda (u0: +T).(\lambda (i: nat).(\lambda (H4: (getl i c (CHead d1 (Bind Abbr) +u0))).(\lambda (c2: C).(\lambda (t2: T).(\lambda (H5: (fsubst0 i u0 c (THead +(Flat Appl) u t) c2 t2)).(let H6 \def (fsubst0_gen_base c c2 (THead (Flat +Appl) u t) t2 u0 i H5) in (or3_ind (land (eq C c c2) (subst0 i u0 (THead +(Flat Appl) u t) t2)) (land (eq T (THead (Flat Appl) u t) t2) (csubst0 i u0 c +c2)) (land (subst0 i u0 (THead (Flat Appl) u t) t2) (csubst0 i u0 c c2)) +(arity g c2 t2 a2) (\lambda (H7: (land (eq C c c2) (subst0 i u0 (THead (Flat +Appl) u t) t2))).(and_ind (eq C c c2) (subst0 i u0 (THead (Flat Appl) u t) +t2) (arity g c2 t2 a2) (\lambda (H8: (eq C c c2)).(\lambda (H9: (subst0 i u0 +(THead (Flat Appl) u t) t2)).(eq_ind C c (\lambda (c0: C).(arity g c0 t2 a2)) +(or3_ind (ex2 T (\lambda (u2: T).(eq T t2 (THead (Flat Appl) u2 t))) (\lambda +(u2: T).(subst0 i u0 u u2))) (ex2 T (\lambda (t3: T).(eq T t2 (THead (Flat +Appl) u t3))) (\lambda (t3: T).(subst0 (s (Flat Appl) i) u0 t t3))) (ex3_2 T +T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Flat Appl) i) u0 t t3)))) (arity g c t2 a2) +(\lambda (H10: (ex2 T (\lambda (u2: T).(eq T t2 (THead (Flat Appl) u2 t))) +(\lambda (u2: T).(subst0 i u0 u u2)))).(ex2_ind T (\lambda (u2: T).(eq T t2 +(THead (Flat Appl) u2 t))) (\lambda (u2: T).(subst0 i u0 u u2)) (arity g c t2 +a2) (\lambda (x: T).(\lambda (H11: (eq T t2 (THead (Flat Appl) x +t))).(\lambda (H12: (subst0 i u0 u x)).(eq_ind_r T (THead (Flat Appl) x t) +(\lambda (t0: T).(arity g c t0 a2)) (arity_appl g c x a1 (H1 d1 u0 i H4 c x +(fsubst0_snd i u0 c u x H12)) t a2 H2) t2 H11)))) H10)) (\lambda (H10: (ex2 T +(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u t3))) (\lambda (t3: T).(subst0 +(s (Flat Appl) i) u0 t t3)))).(ex2_ind T (\lambda (t3: T).(eq T t2 (THead +(Flat Appl) u t3))) (\lambda (t3: T).(subst0 (s (Flat Appl) i) u0 t t3)) +(arity g c t2 a2) (\lambda (x: T).(\lambda (H11: (eq T t2 (THead (Flat Appl) +u x))).(\lambda (H12: (subst0 (s (Flat Appl) i) u0 t x)).(eq_ind_r T (THead +(Flat Appl) u x) (\lambda (t0: T).(arity g c t0 a2)) (arity_appl g c u a1 H0 +x a2 (H3 d1 u0 i H4 c x (fsubst0_snd i u0 c t x H12))) t2 H11)))) H10)) +(\lambda (H10: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) +(\lambda (_: T).(\lambda (t3: T).(subst0 (s (Flat Appl) i) u0 t +t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) +(\lambda (_: T).(\lambda (t3: T).(subst0 (s (Flat Appl) i) u0 t t3))) (arity +g c t2 a2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H11: (eq T t2 (THead +(Flat Appl) x0 x1))).(\lambda (H12: (subst0 i u0 u x0)).(\lambda (H13: +(subst0 (s (Flat Appl) i) u0 t x1)).(eq_ind_r T (THead (Flat Appl) x0 x1) +(\lambda (t0: T).(arity g c t0 a2)) (arity_appl g c x0 a1 (H1 d1 u0 i H4 c x0 +(fsubst0_snd i u0 c u x0 H12)) x1 a2 (H3 d1 u0 i H4 c x1 (fsubst0_snd i u0 c +t x1 H13))) t2 H11)))))) H10)) (subst0_gen_head (Flat Appl) u0 u t t2 i H9)) +c2 H8))) H7)) (\lambda (H7: (land (eq T (THead (Flat Appl) u t) t2) (csubst0 +i u0 c c2))).(and_ind (eq T (THead (Flat Appl) u t) t2) (csubst0 i u0 c c2) +(arity g c2 t2 a2) (\lambda (H8: (eq T (THead (Flat Appl) u t) t2)).(\lambda +(H9: (csubst0 i u0 c c2)).(eq_ind T (THead (Flat Appl) u t) (\lambda (t0: +T).(arity g c2 t0 a2)) (arity_appl g c2 u a1 (H1 d1 u0 i H4 c2 u (fsubst0_fst +i u0 c u c2 H9)) t a2 (H3 d1 u0 i H4 c2 t (fsubst0_fst i u0 c t c2 H9))) t2 +H8))) H7)) (\lambda (H7: (land (subst0 i u0 (THead (Flat Appl) u t) t2) +(csubst0 i u0 c c2))).(and_ind (subst0 i u0 (THead (Flat Appl) u t) t2) +(csubst0 i u0 c c2) (arity g c2 t2 a2) (\lambda (H8: (subst0 i u0 (THead +(Flat Appl) u t) t2)).(\lambda (H9: (csubst0 i u0 c c2)).(or3_ind (ex2 T +(\lambda (u2: T).(eq T t2 (THead (Flat Appl) u2 t))) (\lambda (u2: T).(subst0 +i u0 u u2))) (ex2 T (\lambda (t3: T).(eq T t2 (THead (Flat Appl) u t3))) +(\lambda (t3: T).(subst0 (s (Flat Appl) i) u0 t t3))) (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Flat Appl) i) u0 t t3)))) (arity g c2 t2 a2) (\lambda (H10: +(ex2 T (\lambda (u2: T).(eq T t2 (THead (Flat Appl) u2 t))) (\lambda (u2: +T).(subst0 i u0 u u2)))).(ex2_ind T (\lambda (u2: T).(eq T t2 (THead (Flat +Appl) u2 t))) (\lambda (u2: T).(subst0 i u0 u u2)) (arity g c2 t2 a2) +(\lambda (x: T).(\lambda (H11: (eq T t2 (THead (Flat Appl) x t))).(\lambda +(H12: (subst0 i u0 u x)).(eq_ind_r T (THead (Flat Appl) x t) (\lambda (t0: +T).(arity g c2 t0 a2)) (arity_appl g c2 x a1 (H1 d1 u0 i H4 c2 x +(fsubst0_both i u0 c u x H12 c2 H9)) t a2 (H3 d1 u0 i H4 c2 t (fsubst0_fst i +u0 c t c2 H9))) t2 H11)))) H10)) (\lambda (H10: (ex2 T (\lambda (t3: T).(eq T +t2 (THead (Flat Appl) u t3))) (\lambda (t3: T).(subst0 (s (Flat Appl) i) u0 t +t3)))).(ex2_ind T (\lambda (t3: T).(eq T t2 (THead (Flat Appl) u t3))) +(\lambda (t3: T).(subst0 (s (Flat Appl) i) u0 t t3)) (arity g c2 t2 a2) +(\lambda (x: T).(\lambda (H11: (eq T t2 (THead (Flat Appl) u x))).(\lambda +(H12: (subst0 (s (Flat Appl) i) u0 t x)).(eq_ind_r T (THead (Flat Appl) u x) +(\lambda (t0: T).(arity g c2 t0 a2)) (arity_appl g c2 u a1 (H1 d1 u0 i H4 c2 +u (fsubst0_fst i u0 c u c2 H9)) x a2 (H3 d1 u0 i H4 c2 x (fsubst0_both i u0 c +t x H12 c2 H9))) t2 H11)))) H10)) (\lambda (H10: (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Flat Appl) i) u0 t t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Flat Appl) i) u0 t t3))) (arity g c2 t2 a2) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H11: (eq T t2 (THead (Flat Appl) x0 +x1))).(\lambda (H12: (subst0 i u0 u x0)).(\lambda (H13: (subst0 (s (Flat +Appl) i) u0 t x1)).(eq_ind_r T (THead (Flat Appl) x0 x1) (\lambda (t0: +T).(arity g c2 t0 a2)) (arity_appl g c2 x0 a1 (H1 d1 u0 i H4 c2 x0 +(fsubst0_both i u0 c u x0 H12 c2 H9)) x1 a2 (H3 d1 u0 i H4 c2 x1 +(fsubst0_both i u0 c t x1 H13 c2 H9))) t2 H11)))))) H10)) (subst0_gen_head +(Flat Appl) u0 u t t2 i H8)))) H7)) H6)))))))))))))))))) (\lambda (c: +C).(\lambda (u: T).(\lambda (a0: A).(\lambda (H0: (arity g c u (asucc g +a0))).(\lambda (H1: ((\forall (d1: C).(\forall (u0: T).(\forall (i: +nat).((getl i c (CHead d1 (Bind Abbr) u0)) \to (\forall (c2: C).(\forall (t2: +T).((fsubst0 i u0 c u c2 t2) \to (arity g c2 t2 (asucc g +a0))))))))))).(\lambda (t: T).(\lambda (H2: (arity g c t a0)).(\lambda (H3: +((\forall (d1: C).(\forall (u0: T).(\forall (i: nat).((getl i c (CHead d1 +(Bind Abbr) u0)) \to (\forall (c2: C).(\forall (t2: T).((fsubst0 i u0 c t c2 +t2) \to (arity g c2 t2 a0)))))))))).(\lambda (d1: C).(\lambda (u0: +T).(\lambda (i: nat).(\lambda (H4: (getl i c (CHead d1 (Bind Abbr) +u0))).(\lambda (c2: C).(\lambda (t2: T).(\lambda (H5: (fsubst0 i u0 c (THead +(Flat Cast) u t) c2 t2)).(let H6 \def (fsubst0_gen_base c c2 (THead (Flat +Cast) u t) t2 u0 i H5) in (or3_ind (land (eq C c c2) (subst0 i u0 (THead +(Flat Cast) u t) t2)) (land (eq T (THead (Flat Cast) u t) t2) (csubst0 i u0 c +c2)) (land (subst0 i u0 (THead (Flat Cast) u t) t2) (csubst0 i u0 c c2)) +(arity g c2 t2 a0) (\lambda (H7: (land (eq C c c2) (subst0 i u0 (THead (Flat +Cast) u t) t2))).(and_ind (eq C c c2) (subst0 i u0 (THead (Flat Cast) u t) +t2) (arity g c2 t2 a0) (\lambda (H8: (eq C c c2)).(\lambda (H9: (subst0 i u0 +(THead (Flat Cast) u t) t2)).(eq_ind C c (\lambda (c0: C).(arity g c0 t2 a0)) +(or3_ind (ex2 T (\lambda (u2: T).(eq T t2 (THead (Flat Cast) u2 t))) (\lambda +(u2: T).(subst0 i u0 u u2))) (ex2 T (\lambda (t3: T).(eq T t2 (THead (Flat +Cast) u t3))) (\lambda (t3: T).(subst0 (s (Flat Cast) i) u0 t t3))) (ex3_2 T +T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Cast) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Flat Cast) i) u0 t t3)))) (arity g c t2 a0) +(\lambda (H10: (ex2 T (\lambda (u2: T).(eq T t2 (THead (Flat Cast) u2 t))) +(\lambda (u2: T).(subst0 i u0 u u2)))).(ex2_ind T (\lambda (u2: T).(eq T t2 +(THead (Flat Cast) u2 t))) (\lambda (u2: T).(subst0 i u0 u u2)) (arity g c t2 +a0) (\lambda (x: T).(\lambda (H11: (eq T t2 (THead (Flat Cast) x +t))).(\lambda (H12: (subst0 i u0 u x)).(eq_ind_r T (THead (Flat Cast) x t) +(\lambda (t0: T).(arity g c t0 a0)) (arity_cast g c x a0 (H1 d1 u0 i H4 c x +(fsubst0_snd i u0 c u x H12)) t H2) t2 H11)))) H10)) (\lambda (H10: (ex2 T +(\lambda (t3: T).(eq T t2 (THead (Flat Cast) u t3))) (\lambda (t3: T).(subst0 +(s (Flat Cast) i) u0 t t3)))).(ex2_ind T (\lambda (t3: T).(eq T t2 (THead +(Flat Cast) u t3))) (\lambda (t3: T).(subst0 (s (Flat Cast) i) u0 t t3)) +(arity g c t2 a0) (\lambda (x: T).(\lambda (H11: (eq T t2 (THead (Flat Cast) +u x))).(\lambda (H12: (subst0 (s (Flat Cast) i) u0 t x)).(eq_ind_r T (THead +(Flat Cast) u x) (\lambda (t0: T).(arity g c t0 a0)) (arity_cast g c u a0 H0 +x (H3 d1 u0 i H4 c x (fsubst0_snd i u0 c t x H12))) t2 H11)))) H10)) (\lambda +(H10: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat +Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) +(\lambda (_: T).(\lambda (t3: T).(subst0 (s (Flat Cast) i) u0 t +t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) +(\lambda (_: T).(\lambda (t3: T).(subst0 (s (Flat Cast) i) u0 t t3))) (arity +g c t2 a0) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H11: (eq T t2 (THead +(Flat Cast) x0 x1))).(\lambda (H12: (subst0 i u0 u x0)).(\lambda (H13: +(subst0 (s (Flat Cast) i) u0 t x1)).(eq_ind_r T (THead (Flat Cast) x0 x1) +(\lambda (t0: T).(arity g c t0 a0)) (arity_cast g c x0 a0 (H1 d1 u0 i H4 c x0 +(fsubst0_snd i u0 c u x0 H12)) x1 (H3 d1 u0 i H4 c x1 (fsubst0_snd i u0 c t +x1 H13))) t2 H11)))))) H10)) (subst0_gen_head (Flat Cast) u0 u t t2 i H9)) c2 +H8))) H7)) (\lambda (H7: (land (eq T (THead (Flat Cast) u t) t2) (csubst0 i +u0 c c2))).(and_ind (eq T (THead (Flat Cast) u t) t2) (csubst0 i u0 c c2) +(arity g c2 t2 a0) (\lambda (H8: (eq T (THead (Flat Cast) u t) t2)).(\lambda +(H9: (csubst0 i u0 c c2)).(eq_ind T (THead (Flat Cast) u t) (\lambda (t0: +T).(arity g c2 t0 a0)) (arity_cast g c2 u a0 (H1 d1 u0 i H4 c2 u (fsubst0_fst +i u0 c u c2 H9)) t (H3 d1 u0 i H4 c2 t (fsubst0_fst i u0 c t c2 H9))) t2 +H8))) H7)) (\lambda (H7: (land (subst0 i u0 (THead (Flat Cast) u t) t2) +(csubst0 i u0 c c2))).(and_ind (subst0 i u0 (THead (Flat Cast) u t) t2) +(csubst0 i u0 c c2) (arity g c2 t2 a0) (\lambda (H8: (subst0 i u0 (THead +(Flat Cast) u t) t2)).(\lambda (H9: (csubst0 i u0 c c2)).(or3_ind (ex2 T +(\lambda (u2: T).(eq T t2 (THead (Flat Cast) u2 t))) (\lambda (u2: T).(subst0 +i u0 u u2))) (ex2 T (\lambda (t3: T).(eq T t2 (THead (Flat Cast) u t3))) +(\lambda (t3: T).(subst0 (s (Flat Cast) i) u0 t t3))) (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Flat Cast) i) u0 t t3)))) (arity g c2 t2 a0) (\lambda (H10: +(ex2 T (\lambda (u2: T).(eq T t2 (THead (Flat Cast) u2 t))) (\lambda (u2: +T).(subst0 i u0 u u2)))).(ex2_ind T (\lambda (u2: T).(eq T t2 (THead (Flat +Cast) u2 t))) (\lambda (u2: T).(subst0 i u0 u u2)) (arity g c2 t2 a0) +(\lambda (x: T).(\lambda (H11: (eq T t2 (THead (Flat Cast) x t))).(\lambda +(H12: (subst0 i u0 u x)).(eq_ind_r T (THead (Flat Cast) x t) (\lambda (t0: +T).(arity g c2 t0 a0)) (arity_cast g c2 x a0 (H1 d1 u0 i H4 c2 x +(fsubst0_both i u0 c u x H12 c2 H9)) t (H3 d1 u0 i H4 c2 t (fsubst0_fst i u0 +c t c2 H9))) t2 H11)))) H10)) (\lambda (H10: (ex2 T (\lambda (t3: T).(eq T t2 +(THead (Flat Cast) u t3))) (\lambda (t3: T).(subst0 (s (Flat Cast) i) u0 t +t3)))).(ex2_ind T (\lambda (t3: T).(eq T t2 (THead (Flat Cast) u t3))) +(\lambda (t3: T).(subst0 (s (Flat Cast) i) u0 t t3)) (arity g c2 t2 a0) +(\lambda (x: T).(\lambda (H11: (eq T t2 (THead (Flat Cast) u x))).(\lambda +(H12: (subst0 (s (Flat Cast) i) u0 t x)).(eq_ind_r T (THead (Flat Cast) u x) +(\lambda (t0: T).(arity g c2 t0 a0)) (arity_cast g c2 u a0 (H1 d1 u0 i H4 c2 +u (fsubst0_fst i u0 c u c2 H9)) x (H3 d1 u0 i H4 c2 x (fsubst0_both i u0 c t +x H12 c2 H9))) t2 H11)))) H10)) (\lambda (H10: (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Flat Cast) i) u0 t t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Flat Cast) i) u0 t t3))) (arity g c2 t2 a0) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H11: (eq T t2 (THead (Flat Cast) x0 +x1))).(\lambda (H12: (subst0 i u0 u x0)).(\lambda (H13: (subst0 (s (Flat +Cast) i) u0 t x1)).(eq_ind_r T (THead (Flat Cast) x0 x1) (\lambda (t0: +T).(arity g c2 t0 a0)) (arity_cast g c2 x0 a0 (H1 d1 u0 i H4 c2 x0 +(fsubst0_both i u0 c u x0 H12 c2 H9)) x1 (H3 d1 u0 i H4 c2 x1 (fsubst0_both i +u0 c t x1 H13 c2 H9))) t2 H11)))))) H10)) (subst0_gen_head (Flat Cast) u0 u t +t2 i H8)))) H7)) H6))))))))))))))))) (\lambda (c: C).(\lambda (t: T).(\lambda +(a1: A).(\lambda (_: (arity g c t a1)).(\lambda (H1: ((\forall (d1: +C).(\forall (u: T).(\forall (i: nat).((getl i c (CHead d1 (Bind Abbr) u)) \to +(\forall (c2: C).(\forall (t2: T).((fsubst0 i u c t c2 t2) \to (arity g c2 t2 +a1)))))))))).(\lambda (a2: A).(\lambda (H2: (leq g a1 a2)).(\lambda (d1: +C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H3: (getl i c (CHead d1 (Bind +Abbr) u))).(\lambda (c2: C).(\lambda (t2: T).(\lambda (H4: (fsubst0 i u c t +c2 t2)).(let H5 \def (fsubst0_gen_base c c2 t t2 u i H4) in (or3_ind (land +(eq C c c2) (subst0 i u t t2)) (land (eq T t t2) (csubst0 i u c c2)) (land +(subst0 i u t t2) (csubst0 i u c c2)) (arity g c2 t2 a2) (\lambda (H6: (land +(eq C c c2) (subst0 i u t t2))).(and_ind (eq C c c2) (subst0 i u t t2) (arity +g c2 t2 a2) (\lambda (H7: (eq C c c2)).(\lambda (H8: (subst0 i u t +t2)).(eq_ind C c (\lambda (c0: C).(arity g c0 t2 a2)) (arity_repl g c t2 a1 +(H1 d1 u i H3 c t2 (fsubst0_snd i u c t t2 H8)) a2 H2) c2 H7))) H6)) (\lambda +(H6: (land (eq T t t2) (csubst0 i u c c2))).(and_ind (eq T t t2) (csubst0 i u +c c2) (arity g c2 t2 a2) (\lambda (H7: (eq T t t2)).(\lambda (H8: (csubst0 i +u c c2)).(eq_ind T t (\lambda (t0: T).(arity g c2 t0 a2)) (arity_repl g c2 t +a1 (H1 d1 u i H3 c2 t (fsubst0_fst i u c t c2 H8)) a2 H2) t2 H7))) H6)) +(\lambda (H6: (land (subst0 i u t t2) (csubst0 i u c c2))).(and_ind (subst0 i +u t t2) (csubst0 i u c c2) (arity g c2 t2 a2) (\lambda (H7: (subst0 i u t +t2)).(\lambda (H8: (csubst0 i u c c2)).(arity_repl g c2 t2 a1 (H1 d1 u i H3 +c2 t2 (fsubst0_both i u c t t2 H7 c2 H8)) a2 H2))) H6)) H5)))))))))))))))) c1 +t1 a H))))). + +theorem arity_subst0: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (a: A).((arity g c +t1 a) \to (\forall (d: C).(\forall (u: T).(\forall (i: nat).((getl i c (CHead +d (Bind Abbr) u)) \to (\forall (t2: T).((subst0 i u t1 t2) \to (arity g c t2 +a))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (a: A).(\lambda (H: +(arity g c t1 a)).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H0: (getl i c (CHead d (Bind Abbr) u))).(\lambda (t2: T).(\lambda (H1: +(subst0 i u t1 t2)).(arity_fsubst0 g c t1 a H d u i H0 c t2 (fsubst0_snd i u +c t1 t2 H1)))))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/defs.ma new file mode 100644 index 000000000..ae2233051 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/defs.ma @@ -0,0 +1,30 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/asucc/defs". + +include "A/defs.ma". + +include "G/defs.ma". + +definition asucc: + G \to (A \to A) +\def + let rec asucc (g: G) (l: A) on l: A \def (match l with [(ASort n0 n) +\Rightarrow (match n0 with [O \Rightarrow (ASort O (next g n)) | (S h) +\Rightarrow (ASort h n)]) | (AHead a1 a2) \Rightarrow (AHead a1 (asucc g +a2))]) in asucc. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/fwd.ma new file mode 100644 index 000000000..d2c77132e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/fwd.ma @@ -0,0 +1,95 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/asucc/fwd". + +include "asucc/defs.ma". + +theorem asucc_gen_sort: + \forall (g: G).(\forall (h: nat).(\forall (n: nat).(\forall (a: A).((eq A +(ASort h n) (asucc g a)) \to (ex_2 nat nat (\lambda (h0: nat).(\lambda (n0: +nat).(eq A a (ASort h0 n0))))))))) +\def + \lambda (g: G).(\lambda (h: nat).(\lambda (n: nat).(\lambda (a: A).(A_ind +(\lambda (a0: A).((eq A (ASort h n) (asucc g a0)) \to (ex_2 nat nat (\lambda +(h0: nat).(\lambda (n0: nat).(eq A a0 (ASort h0 n0))))))) (\lambda (n0: +nat).(\lambda (n1: nat).(\lambda (H: (eq A (ASort h n) (asucc g (ASort n0 +n1)))).(let H0 \def (f_equal A A (\lambda (e: A).e) (ASort h n) (match n0 +with [O \Rightarrow (ASort O (next g n1)) | (S h0) \Rightarrow (ASort h0 +n1)]) H) in (ex_2_intro nat nat (\lambda (h0: nat).(\lambda (n2: nat).(eq A +(ASort n0 n1) (ASort h0 n2)))) n0 n1 (refl_equal A (ASort n0 n1))))))) +(\lambda (a0: A).(\lambda (_: (((eq A (ASort h n) (asucc g a0)) \to (ex_2 nat +nat (\lambda (h0: nat).(\lambda (n0: nat).(eq A a0 (ASort h0 +n0)))))))).(\lambda (a1: A).(\lambda (_: (((eq A (ASort h n) (asucc g a1)) +\to (ex_2 nat nat (\lambda (h0: nat).(\lambda (n0: nat).(eq A a1 (ASort h0 +n0)))))))).(\lambda (H1: (eq A (ASort h n) (asucc g (AHead a0 a1)))).(let H2 +\def (eq_ind A (ASort h n) (\lambda (ee: A).(match ee in A return (\lambda +(_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) \Rightarrow +False])) I (asucc g (AHead a0 a1)) H1) in (False_ind (ex_2 nat nat (\lambda +(h0: nat).(\lambda (n0: nat).(eq A (AHead a0 a1) (ASort h0 n0))))) H2))))))) +a)))). + +theorem asucc_gen_head: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).(\forall (a: A).((eq A +(AHead a1 a2) (asucc g a)) \to (ex2 A (\lambda (a0: A).(eq A a (AHead a1 +a0))) (\lambda (a0: A).(eq A a2 (asucc g a0)))))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (a: A).(A_ind +(\lambda (a0: A).((eq A (AHead a1 a2) (asucc g a0)) \to (ex2 A (\lambda (a3: +A).(eq A a0 (AHead a1 a3))) (\lambda (a3: A).(eq A a2 (asucc g a3)))))) +(\lambda (n: nat).(\lambda (n0: nat).(\lambda (H: (eq A (AHead a1 a2) (asucc +g (ASort n n0)))).(nat_ind (\lambda (n1: nat).((eq A (AHead a1 a2) (asucc g +(ASort n1 n0))) \to (ex2 A (\lambda (a0: A).(eq A (ASort n1 n0) (AHead a1 +a0))) (\lambda (a0: A).(eq A a2 (asucc g a0)))))) (\lambda (H0: (eq A (AHead +a1 a2) (asucc g (ASort O n0)))).(let H1 \def (eq_ind A (AHead a1 a2) (\lambda +(ee: A).(match ee in A return (\lambda (_: A).Prop) with [(ASort _ _) +\Rightarrow False | (AHead _ _) \Rightarrow True])) I (ASort O (next g n0)) +H0) in (False_ind (ex2 A (\lambda (a0: A).(eq A (ASort O n0) (AHead a1 a0))) +(\lambda (a0: A).(eq A a2 (asucc g a0)))) H1))) (\lambda (n1: nat).(\lambda +(_: (((eq A (AHead a1 a2) (asucc g (ASort n1 n0))) \to (ex2 A (\lambda (a0: +A).(eq A (ASort n1 n0) (AHead a1 a0))) (\lambda (a0: A).(eq A a2 (asucc g +a0))))))).(\lambda (H0: (eq A (AHead a1 a2) (asucc g (ASort (S n1) +n0)))).(let H1 \def (eq_ind A (AHead a1 a2) (\lambda (ee: A).(match ee in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ +_) \Rightarrow True])) I (ASort n1 n0) H0) in (False_ind (ex2 A (\lambda (a0: +A).(eq A (ASort (S n1) n0) (AHead a1 a0))) (\lambda (a0: A).(eq A a2 (asucc g +a0)))) H1))))) n H)))) (\lambda (a0: A).(\lambda (H: (((eq A (AHead a1 a2) +(asucc g a0)) \to (ex2 A (\lambda (a3: A).(eq A a0 (AHead a1 a3))) (\lambda +(a3: A).(eq A a2 (asucc g a3))))))).(\lambda (a3: A).(\lambda (H0: (((eq A +(AHead a1 a2) (asucc g a3)) \to (ex2 A (\lambda (a4: A).(eq A a3 (AHead a1 +a4))) (\lambda (a4: A).(eq A a2 (asucc g a4))))))).(\lambda (H1: (eq A (AHead +a1 a2) (asucc g (AHead a0 a3)))).(let H2 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a1 | +(AHead a4 _) \Rightarrow a4])) (AHead a1 a2) (AHead a0 (asucc g a3)) H1) in +((let H3 \def (f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: +A).A) with [(ASort _ _) \Rightarrow a2 | (AHead _ a4) \Rightarrow a4])) +(AHead a1 a2) (AHead a0 (asucc g a3)) H1) in (\lambda (H4: (eq A a1 a0)).(let +H5 \def (eq_ind_r A a0 (\lambda (a4: A).((eq A (AHead a1 a2) (asucc g a4)) +\to (ex2 A (\lambda (a5: A).(eq A a4 (AHead a1 a5))) (\lambda (a5: A).(eq A +a2 (asucc g a5)))))) H a1 H4) in (eq_ind A a1 (\lambda (a4: A).(ex2 A +(\lambda (a5: A).(eq A (AHead a4 a3) (AHead a1 a5))) (\lambda (a5: A).(eq A +a2 (asucc g a5))))) (let H6 \def (eq_ind A a2 (\lambda (a4: A).((eq A (AHead +a1 a4) (asucc g a3)) \to (ex2 A (\lambda (a5: A).(eq A a3 (AHead a1 a5))) +(\lambda (a5: A).(eq A a4 (asucc g a5)))))) H0 (asucc g a3) H3) in (let H7 +\def (eq_ind A a2 (\lambda (a4: A).((eq A (AHead a1 a4) (asucc g a1)) \to +(ex2 A (\lambda (a5: A).(eq A a1 (AHead a1 a5))) (\lambda (a5: A).(eq A a4 +(asucc g a5)))))) H5 (asucc g a3) H3) in (eq_ind_r A (asucc g a3) (\lambda +(a4: A).(ex2 A (\lambda (a5: A).(eq A (AHead a1 a3) (AHead a1 a5))) (\lambda +(a5: A).(eq A a4 (asucc g a5))))) (ex_intro2 A (\lambda (a4: A).(eq A (AHead +a1 a3) (AHead a1 a4))) (\lambda (a4: A).(eq A (asucc g a3) (asucc g a4))) a3 +(refl_equal A (AHead a1 a3)) (refl_equal A (asucc g a3))) a2 H3))) a0 H4)))) +H2))))))) a)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/defs.ma new file mode 100644 index 000000000..c5390f97b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/defs.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/cimp/defs". + +include "getl/defs.ma". + +definition cimp: + C \to (C \to Prop) +\def + \lambda (c1: C).(\lambda (c2: C).(\forall (b: B).(\forall (d1: C).(\forall +(w: T).(\forall (h: nat).((getl h c1 (CHead d1 (Bind b) w)) \to (ex C +(\lambda (d2: C).(getl h c2 (CHead d2 (Bind b) w)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/props.ma new file mode 100644 index 000000000..ae0f6a567 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/props.ma @@ -0,0 +1,127 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/cimp/props". + +include "cimp/defs.ma". + +include "getl/getl.ma". + +theorem cimp_flat_sx: + \forall (f: F).(\forall (c: C).(\forall (v: T).(cimp (CHead c (Flat f) v) +c))) +\def + \lambda (f: F).(\lambda (c: C).(\lambda (v: T).(\lambda (b: B).(\lambda (d1: +C).(\lambda (w: T).(\lambda (h: nat).(\lambda (H: (getl h (CHead c (Flat f) +v) (CHead d1 (Bind b) w))).(nat_ind (\lambda (n: nat).((getl n (CHead c (Flat +f) v) (CHead d1 (Bind b) w)) \to (ex C (\lambda (d2: C).(getl n c (CHead d2 +(Bind b) w)))))) (\lambda (H0: (getl O (CHead c (Flat f) v) (CHead d1 (Bind +b) w))).(ex_intro C (\lambda (d2: C).(getl O c (CHead d2 (Bind b) w))) d1 +(getl_intro O c (CHead d1 (Bind b) w) c (drop_refl c) (clear_gen_flat f c +(CHead d1 (Bind b) w) v (getl_gen_O (CHead c (Flat f) v) (CHead d1 (Bind b) +w) H0))))) (\lambda (h0: nat).(\lambda (_: (((getl h0 (CHead c (Flat f) v) +(CHead d1 (Bind b) w)) \to (ex C (\lambda (d2: C).(getl h0 c (CHead d2 (Bind +b) w))))))).(\lambda (H0: (getl (S h0) (CHead c (Flat f) v) (CHead d1 (Bind +b) w))).(ex_intro C (\lambda (d2: C).(getl (S h0) c (CHead d2 (Bind b) w))) +d1 (getl_gen_S (Flat f) c (CHead d1 (Bind b) w) v h0 H0))))) h H)))))))). + +theorem cimp_flat_dx: + \forall (f: F).(\forall (c: C).(\forall (v: T).(cimp c (CHead c (Flat f) +v)))) +\def + \lambda (f: F).(\lambda (c: C).(\lambda (v: T).(\lambda (b: B).(\lambda (d1: +C).(\lambda (w: T).(\lambda (h: nat).(\lambda (H: (getl h c (CHead d1 (Bind +b) w))).(ex_intro C (\lambda (d2: C).(getl h (CHead c (Flat f) v) (CHead d2 +(Bind b) w))) d1 (getl_flat c (CHead d1 (Bind b) w) h H f v))))))))). + +theorem cimp_bind: + \forall (c1: C).(\forall (c2: C).((cimp c1 c2) \to (\forall (b: B).(\forall +(v: T).(cimp (CHead c1 (Bind b) v) (CHead c2 (Bind b) v)))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: ((\forall (b: B).(\forall (d1: +C).(\forall (w: T).(\forall (h: nat).((getl h c1 (CHead d1 (Bind b) w)) \to +(ex C (\lambda (d2: C).(getl h c2 (CHead d2 (Bind b) w))))))))))).(\lambda +(b: B).(\lambda (v: T).(\lambda (b0: B).(\lambda (d1: C).(\lambda (w: +T).(\lambda (h: nat).(\lambda (H0: (getl h (CHead c1 (Bind b) v) (CHead d1 +(Bind b0) w))).(nat_ind (\lambda (n: nat).((getl n (CHead c1 (Bind b) v) +(CHead d1 (Bind b0) w)) \to (ex C (\lambda (d2: C).(getl n (CHead c2 (Bind b) +v) (CHead d2 (Bind b0) w)))))) (\lambda (H1: (getl O (CHead c1 (Bind b) v) +(CHead d1 (Bind b0) w))).(let H2 \def (f_equal C C (\lambda (e: C).(match e +in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d1 | (CHead c _ _) +\Rightarrow c])) (CHead d1 (Bind b0) w) (CHead c1 (Bind b) v) (clear_gen_bind +b c1 (CHead d1 (Bind b0) w) v (getl_gen_O (CHead c1 (Bind b) v) (CHead d1 +(Bind b0) w) H1))) in ((let H3 \def (f_equal C B (\lambda (e: C).(match e in +C return (\lambda (_: C).B) with [(CSort _) \Rightarrow b0 | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b1) +\Rightarrow b1 | (Flat _) \Rightarrow b0])])) (CHead d1 (Bind b0) w) (CHead +c1 (Bind b) v) (clear_gen_bind b c1 (CHead d1 (Bind b0) w) v (getl_gen_O +(CHead c1 (Bind b) v) (CHead d1 (Bind b0) w) H1))) in ((let H4 \def (f_equal +C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow w | (CHead _ _ t) \Rightarrow t])) (CHead d1 (Bind b0) w) (CHead +c1 (Bind b) v) (clear_gen_bind b c1 (CHead d1 (Bind b0) w) v (getl_gen_O +(CHead c1 (Bind b) v) (CHead d1 (Bind b0) w) H1))) in (\lambda (H5: (eq B b0 +b)).(\lambda (_: (eq C d1 c1)).(eq_ind_r T v (\lambda (t: T).(ex C (\lambda +(d2: C).(getl O (CHead c2 (Bind b) v) (CHead d2 (Bind b0) t))))) (eq_ind_r B +b (\lambda (b1: B).(ex C (\lambda (d2: C).(getl O (CHead c2 (Bind b) v) +(CHead d2 (Bind b1) v))))) (ex_intro C (\lambda (d2: C).(getl O (CHead c2 +(Bind b) v) (CHead d2 (Bind b) v))) c2 (getl_refl b c2 v)) b0 H5) w H4)))) +H3)) H2))) (\lambda (h0: nat).(\lambda (_: (((getl h0 (CHead c1 (Bind b) v) +(CHead d1 (Bind b0) w)) \to (ex C (\lambda (d2: C).(getl h0 (CHead c2 (Bind +b) v) (CHead d2 (Bind b0) w))))))).(\lambda (H1: (getl (S h0) (CHead c1 (Bind +b) v) (CHead d1 (Bind b0) w))).(let H_x \def (H b0 d1 w (r (Bind b) h0) +(getl_gen_S (Bind b) c1 (CHead d1 (Bind b0) w) v h0 H1)) in (let H2 \def H_x +in (ex_ind C (\lambda (d2: C).(getl (r (Bind b) h0) c2 (CHead d2 (Bind b0) +w))) (ex C (\lambda (d2: C).(getl (S h0) (CHead c2 (Bind b) v) (CHead d2 +(Bind b0) w)))) (\lambda (x: C).(\lambda (H3: (getl (r (Bind b) h0) c2 (CHead +x (Bind b0) w))).(ex_intro C (\lambda (d2: C).(getl (S h0) (CHead c2 (Bind b) +v) (CHead d2 (Bind b0) w))) x (getl_head (Bind b) h0 c2 (CHead x (Bind b0) w) +H3 v)))) H2)))))) h H0)))))))))). + +theorem cimp_getl_conf: + \forall (c1: C).(\forall (c2: C).((cimp c1 c2) \to (\forall (b: B).(\forall +(d1: C).(\forall (w: T).(\forall (i: nat).((getl i c1 (CHead d1 (Bind b) w)) +\to (ex2 C (\lambda (d2: C).(cimp d1 d2)) (\lambda (d2: C).(getl i c2 (CHead +d2 (Bind b) w))))))))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: ((\forall (b: B).(\forall (d1: +C).(\forall (w: T).(\forall (h: nat).((getl h c1 (CHead d1 (Bind b) w)) \to +(ex C (\lambda (d2: C).(getl h c2 (CHead d2 (Bind b) w))))))))))).(\lambda +(b: B).(\lambda (d1: C).(\lambda (w: T).(\lambda (i: nat).(\lambda (H0: (getl +i c1 (CHead d1 (Bind b) w))).(let H_x \def (H b d1 w i H0) in (let H1 \def +H_x in (ex_ind C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind b) w))) (ex2 C +(\lambda (d2: C).(\forall (b0: B).(\forall (d3: C).(\forall (w0: T).(\forall +(h: nat).((getl h d1 (CHead d3 (Bind b0) w0)) \to (ex C (\lambda (d4: +C).(getl h d2 (CHead d4 (Bind b0) w0)))))))))) (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind b) w)))) (\lambda (x: C).(\lambda (H2: (getl i c2 (CHead x +(Bind b) w))).(ex_intro2 C (\lambda (d2: C).(\forall (b0: B).(\forall (d3: +C).(\forall (w0: T).(\forall (h: nat).((getl h d1 (CHead d3 (Bind b0) w0)) +\to (ex C (\lambda (d4: C).(getl h d2 (CHead d4 (Bind b0) w0)))))))))) +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind b) w))) x (\lambda (b0: +B).(\lambda (d0: C).(\lambda (w0: T).(\lambda (h: nat).(\lambda (H3: (getl h +d1 (CHead d0 (Bind b0) w0))).(let H_y \def (getl_trans (S h) c1 (CHead d1 +(Bind b) w) i H0) in (let H_x0 \def (H b0 d0 w0 (plus (S h) i) (H_y (CHead d0 +(Bind b0) w0) (getl_head (Bind b) h d1 (CHead d0 (Bind b0) w0) H3 w))) in +(let H4 \def H_x0 in (ex_ind C (\lambda (d2: C).(getl (plus (S h) i) c2 +(CHead d2 (Bind b0) w0))) (ex C (\lambda (d2: C).(getl h x (CHead d2 (Bind +b0) w0)))) (\lambda (x0: C).(\lambda (H5: (getl (plus (S h) i) c2 (CHead x0 +(Bind b0) w0))).(let H_y0 \def (getl_conf_le (plus (S h) i) (CHead x0 (Bind +b0) w0) c2 H5 (CHead x (Bind b) w) i H2) in (let H6 \def (eq_ind nat (minus +(plus (S h) i) i) (\lambda (n: nat).(getl n (CHead x (Bind b) w) (CHead x0 +(Bind b0) w0))) (H_y0 (le_plus_r (S h) i)) (S h) (minus_plus_r (S h) i)) in +(ex_intro C (\lambda (d2: C).(getl h x (CHead d2 (Bind b0) w0))) x0 +(getl_gen_S (Bind b) x (CHead x0 (Bind b0) w0) w h H6)))))) H4))))))))) H2))) +H1)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/defs.ma new file mode 100644 index 000000000..118dc7ccf --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/defs.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/clear/defs". + +include "C/defs.ma". + +inductive clear: C \to (C \to Prop) \def +| clear_bind: \forall (b: B).(\forall (e: C).(\forall (u: T).(clear (CHead e +(Bind b) u) (CHead e (Bind b) u)))) +| clear_flat: \forall (e: C).(\forall (c: C).((clear e c) \to (\forall (f: +F).(\forall (u: T).(clear (CHead e (Flat f) u) c))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/drop.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/drop.ma new file mode 100644 index 000000000..2cfcaa874 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/drop.ma @@ -0,0 +1,174 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/clear/drop". + +include "clear/fwd.ma". + +include "drop/fwd.ma". + +theorem drop_clear: + \forall (c1: C).(\forall (c2: C).(\forall (i: nat).((drop (S i) O c1 c2) \to +(ex2_3 B C T (\lambda (b: B).(\lambda (e: C).(\lambda (v: T).(clear c1 (CHead +e (Bind b) v))))) (\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop i O e +c2)))))))) +\def + \lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: C).(\forall (i: +nat).((drop (S i) O c c2) \to (ex2_3 B C T (\lambda (b: B).(\lambda (e: +C).(\lambda (v: T).(clear c (CHead e (Bind b) v))))) (\lambda (_: B).(\lambda +(e: C).(\lambda (_: T).(drop i O e c2))))))))) (\lambda (n: nat).(\lambda +(c2: C).(\lambda (i: nat).(\lambda (H: (drop (S i) O (CSort n) c2)).(and3_ind +(eq C c2 (CSort n)) (eq nat (S i) O) (eq nat O O) (ex2_3 B C T (\lambda (b: +B).(\lambda (e: C).(\lambda (v: T).(clear (CSort n) (CHead e (Bind b) v))))) +(\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop i O e c2))))) (\lambda +(_: (eq C c2 (CSort n))).(\lambda (H1: (eq nat (S i) O)).(\lambda (_: (eq nat +O O)).(let H3 \def (eq_ind nat (S i) (\lambda (ee: nat).(match ee in nat +return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow +True])) I O H1) in (False_ind (ex2_3 B C T (\lambda (b: B).(\lambda (e: +C).(\lambda (v: T).(clear (CSort n) (CHead e (Bind b) v))))) (\lambda (_: +B).(\lambda (e: C).(\lambda (_: T).(drop i O e c2))))) H3))))) (drop_gen_sort +n (S i) O c2 H)))))) (\lambda (c: C).(\lambda (H: ((\forall (c2: C).(\forall +(i: nat).((drop (S i) O c c2) \to (ex2_3 B C T (\lambda (b: B).(\lambda (e: +C).(\lambda (v: T).(clear c (CHead e (Bind b) v))))) (\lambda (_: B).(\lambda +(e: C).(\lambda (_: T).(drop i O e c2)))))))))).(\lambda (k: K).(\lambda (t: +T).(\lambda (c2: C).(\lambda (i: nat).(\lambda (H0: (drop (S i) O (CHead c k +t) c2)).(K_ind (\lambda (k0: K).((drop (r k0 i) O c c2) \to (ex2_3 B C T +(\lambda (b: B).(\lambda (e: C).(\lambda (v: T).(clear (CHead c k0 t) (CHead +e (Bind b) v))))) (\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop i O e +c2))))))) (\lambda (b: B).(\lambda (H1: (drop (r (Bind b) i) O c +c2)).(ex2_3_intro B C T (\lambda (b0: B).(\lambda (e: C).(\lambda (v: +T).(clear (CHead c (Bind b) t) (CHead e (Bind b0) v))))) (\lambda (_: +B).(\lambda (e: C).(\lambda (_: T).(drop i O e c2)))) b c t (clear_bind b c +t) H1))) (\lambda (f: F).(\lambda (H1: (drop (r (Flat f) i) O c c2)).(let H2 +\def (H c2 i H1) in (ex2_3_ind B C T (\lambda (b: B).(\lambda (e: C).(\lambda +(v: T).(clear c (CHead e (Bind b) v))))) (\lambda (_: B).(\lambda (e: +C).(\lambda (_: T).(drop i O e c2)))) (ex2_3 B C T (\lambda (b: B).(\lambda +(e: C).(\lambda (v: T).(clear (CHead c (Flat f) t) (CHead e (Bind b) v))))) +(\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop i O e c2))))) (\lambda +(x0: B).(\lambda (x1: C).(\lambda (x2: T).(\lambda (H3: (clear c (CHead x1 +(Bind x0) x2))).(\lambda (H4: (drop i O x1 c2)).(ex2_3_intro B C T (\lambda +(b: B).(\lambda (e: C).(\lambda (v: T).(clear (CHead c (Flat f) t) (CHead e +(Bind b) v))))) (\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop i O e +c2)))) x0 x1 x2 (clear_flat c (CHead x1 (Bind x0) x2) H3 f t) H4)))))) H2)))) +k (drop_gen_drop k c c2 t i H0))))))))) c1). + +theorem drop_clear_O: + \forall (b: B).(\forall (c: C).(\forall (e1: C).(\forall (u: T).((clear c +(CHead e1 (Bind b) u)) \to (\forall (e2: C).(\forall (i: nat).((drop i O e1 +e2) \to (drop (S i) O c e2)))))))) +\def + \lambda (b: B).(\lambda (c: C).(C_ind (\lambda (c0: C).(\forall (e1: +C).(\forall (u: T).((clear c0 (CHead e1 (Bind b) u)) \to (\forall (e2: +C).(\forall (i: nat).((drop i O e1 e2) \to (drop (S i) O c0 e2)))))))) +(\lambda (n: nat).(\lambda (e1: C).(\lambda (u: T).(\lambda (H: (clear (CSort +n) (CHead e1 (Bind b) u))).(\lambda (e2: C).(\lambda (i: nat).(\lambda (_: +(drop i O e1 e2)).(clear_gen_sort (CHead e1 (Bind b) u) n H (drop (S i) O +(CSort n) e2))))))))) (\lambda (c0: C).(\lambda (H: ((\forall (e1: +C).(\forall (u: T).((clear c0 (CHead e1 (Bind b) u)) \to (\forall (e2: +C).(\forall (i: nat).((drop i O e1 e2) \to (drop (S i) O c0 +e2))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (e1: C).(\lambda (u: +T).(\lambda (H0: (clear (CHead c0 k t) (CHead e1 (Bind b) u))).(\lambda (e2: +C).(\lambda (i: nat).(\lambda (H1: (drop i O e1 e2)).(K_ind (\lambda (k0: +K).((clear (CHead c0 k0 t) (CHead e1 (Bind b) u)) \to (drop (S i) O (CHead c0 +k0 t) e2))) (\lambda (b0: B).(\lambda (H2: (clear (CHead c0 (Bind b0) t) +(CHead e1 (Bind b) u))).(let H3 \def (f_equal C C (\lambda (e: C).(match e in +C return (\lambda (_: C).C) with [(CSort _) \Rightarrow e1 | (CHead c1 _ _) +\Rightarrow c1])) (CHead e1 (Bind b) u) (CHead c0 (Bind b0) t) +(clear_gen_bind b0 c0 (CHead e1 (Bind b) u) t H2)) in ((let H4 \def (f_equal +C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with [(CSort _) +\Rightarrow b | (CHead _ k0 _) \Rightarrow (match k0 in K return (\lambda (_: +K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) \Rightarrow b])])) (CHead e1 +(Bind b) u) (CHead c0 (Bind b0) t) (clear_gen_bind b0 c0 (CHead e1 (Bind b) +u) t H2)) in ((let H5 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow +t0])) (CHead e1 (Bind b) u) (CHead c0 (Bind b0) t) (clear_gen_bind b0 c0 +(CHead e1 (Bind b) u) t H2)) in (\lambda (H6: (eq B b b0)).(\lambda (H7: (eq +C e1 c0)).(let H8 \def (eq_ind C e1 (\lambda (c1: C).(drop i O c1 e2)) H1 c0 +H7) in (eq_ind B b (\lambda (b1: B).(drop (S i) O (CHead c0 (Bind b1) t) e2)) +(drop_drop (Bind b) i c0 e2 H8 t) b0 H6))))) H4)) H3)))) (\lambda (f: +F).(\lambda (H2: (clear (CHead c0 (Flat f) t) (CHead e1 (Bind b) +u))).(drop_drop (Flat f) i c0 e2 (H e1 u (clear_gen_flat f c0 (CHead e1 (Bind +b) u) t H2) e2 i H1) t))) k H0))))))))))) c)). + +theorem drop_clear_S: + \forall (x2: C).(\forall (x1: C).(\forall (h: nat).(\forall (d: nat).((drop +h (S d) x1 x2) \to (\forall (b: B).(\forall (c2: C).(\forall (u: T).((clear +x2 (CHead c2 (Bind b) u)) \to (ex2 C (\lambda (c1: C).(clear x1 (CHead c1 +(Bind b) (lift h d u)))) (\lambda (c1: C).(drop h d c1 c2))))))))))) +\def + \lambda (x2: C).(C_ind (\lambda (c: C).(\forall (x1: C).(\forall (h: +nat).(\forall (d: nat).((drop h (S d) x1 c) \to (\forall (b: B).(\forall (c2: +C).(\forall (u: T).((clear c (CHead c2 (Bind b) u)) \to (ex2 C (\lambda (c1: +C).(clear x1 (CHead c1 (Bind b) (lift h d u)))) (\lambda (c1: C).(drop h d c1 +c2)))))))))))) (\lambda (n: nat).(\lambda (x1: C).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (_: (drop h (S d) x1 (CSort n))).(\lambda (b: B).(\lambda +(c2: C).(\lambda (u: T).(\lambda (H0: (clear (CSort n) (CHead c2 (Bind b) +u))).(clear_gen_sort (CHead c2 (Bind b) u) n H0 (ex2 C (\lambda (c1: +C).(clear x1 (CHead c1 (Bind b) (lift h d u)))) (\lambda (c1: C).(drop h d c1 +c2))))))))))))) (\lambda (c: C).(\lambda (H: ((\forall (x1: C).(\forall (h: +nat).(\forall (d: nat).((drop h (S d) x1 c) \to (\forall (b: B).(\forall (c2: +C).(\forall (u: T).((clear c (CHead c2 (Bind b) u)) \to (ex2 C (\lambda (c1: +C).(clear x1 (CHead c1 (Bind b) (lift h d u)))) (\lambda (c1: C).(drop h d c1 +c2))))))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (x1: C).(\lambda (h: +nat).(\lambda (d: nat).(\lambda (H0: (drop h (S d) x1 (CHead c k +t))).(\lambda (b: B).(\lambda (c2: C).(\lambda (u: T).(\lambda (H1: (clear +(CHead c k t) (CHead c2 (Bind b) u))).(ex2_ind C (\lambda (e: C).(eq C x1 +(CHead e k (lift h (r k d) t)))) (\lambda (e: C).(drop h (r k d) e c)) (ex2 C +(\lambda (c1: C).(clear x1 (CHead c1 (Bind b) (lift h d u)))) (\lambda (c1: +C).(drop h d c1 c2))) (\lambda (x: C).(\lambda (H2: (eq C x1 (CHead x k (lift +h (r k d) t)))).(\lambda (H3: (drop h (r k d) x c)).(eq_ind_r C (CHead x k +(lift h (r k d) t)) (\lambda (c0: C).(ex2 C (\lambda (c1: C).(clear c0 (CHead +c1 (Bind b) (lift h d u)))) (\lambda (c1: C).(drop h d c1 c2)))) (K_ind +(\lambda (k0: K).((clear (CHead c k0 t) (CHead c2 (Bind b) u)) \to ((drop h +(r k0 d) x c) \to (ex2 C (\lambda (c1: C).(clear (CHead x k0 (lift h (r k0 d) +t)) (CHead c1 (Bind b) (lift h d u)))) (\lambda (c1: C).(drop h d c1 c2)))))) +(\lambda (b0: B).(\lambda (H4: (clear (CHead c (Bind b0) t) (CHead c2 (Bind +b) u))).(\lambda (H5: (drop h (r (Bind b0) d) x c)).(let H6 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow c2 | (CHead c0 _ _) \Rightarrow c0])) (CHead c2 (Bind b) u) +(CHead c (Bind b0) t) (clear_gen_bind b0 c (CHead c2 (Bind b) u) t H4)) in +((let H7 \def (f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: +C).B) with [(CSort _) \Rightarrow b | (CHead _ k0 _) \Rightarrow (match k0 in +K return (\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) +\Rightarrow b])])) (CHead c2 (Bind b) u) (CHead c (Bind b0) t) +(clear_gen_bind b0 c (CHead c2 (Bind b) u) t H4)) in ((let H8 \def (f_equal C +T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead c2 (Bind b) u) (CHead +c (Bind b0) t) (clear_gen_bind b0 c (CHead c2 (Bind b) u) t H4)) in (\lambda +(H9: (eq B b b0)).(\lambda (H10: (eq C c2 c)).(eq_ind_r T t (\lambda (t0: +T).(ex2 C (\lambda (c1: C).(clear (CHead x (Bind b0) (lift h (r (Bind b0) d) +t)) (CHead c1 (Bind b) (lift h d t0)))) (\lambda (c1: C).(drop h d c1 c2)))) +(eq_ind_r C c (\lambda (c0: C).(ex2 C (\lambda (c1: C).(clear (CHead x (Bind +b0) (lift h (r (Bind b0) d) t)) (CHead c1 (Bind b) (lift h d t)))) (\lambda +(c1: C).(drop h d c1 c0)))) (eq_ind_r B b0 (\lambda (b1: B).(ex2 C (\lambda +(c1: C).(clear (CHead x (Bind b0) (lift h (r (Bind b0) d) t)) (CHead c1 (Bind +b1) (lift h d t)))) (\lambda (c1: C).(drop h d c1 c)))) (ex_intro2 C (\lambda +(c1: C).(clear (CHead x (Bind b0) (lift h (r (Bind b0) d) t)) (CHead c1 (Bind +b0) (lift h d t)))) (\lambda (c1: C).(drop h d c1 c)) x (clear_bind b0 x +(lift h d t)) H5) b H9) c2 H10) u H8)))) H7)) H6))))) (\lambda (f: +F).(\lambda (H4: (clear (CHead c (Flat f) t) (CHead c2 (Bind b) u))).(\lambda +(H5: (drop h (r (Flat f) d) x c)).(let H6 \def (H x h d H5 b c2 u +(clear_gen_flat f c (CHead c2 (Bind b) u) t H4)) in (ex2_ind C (\lambda (c1: +C).(clear x (CHead c1 (Bind b) (lift h d u)))) (\lambda (c1: C).(drop h d c1 +c2)) (ex2 C (\lambda (c1: C).(clear (CHead x (Flat f) (lift h (r (Flat f) d) +t)) (CHead c1 (Bind b) (lift h d u)))) (\lambda (c1: C).(drop h d c1 c2))) +(\lambda (x0: C).(\lambda (H7: (clear x (CHead x0 (Bind b) (lift h d +u)))).(\lambda (H8: (drop h d x0 c2)).(ex_intro2 C (\lambda (c1: C).(clear +(CHead x (Flat f) (lift h (r (Flat f) d) t)) (CHead c1 (Bind b) (lift h d +u)))) (\lambda (c1: C).(drop h d c1 c2)) x0 (clear_flat x (CHead x0 (Bind b) +(lift h d u)) H7 f (lift h (r (Flat f) d) t)) H8)))) H6))))) k H1 H3) x1 +H2)))) (drop_gen_skip_r c x1 t h d k H0)))))))))))))) x2). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/fwd.ma new file mode 100644 index 000000000..4749583de --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/fwd.ma @@ -0,0 +1,159 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/clear/fwd". + +include "clear/defs.ma". + +theorem clear_gen_sort: + \forall (x: C).(\forall (n: nat).((clear (CSort n) x) \to (\forall (P: +Prop).P))) +\def + \lambda (x: C).(\lambda (n: nat).(\lambda (H: (clear (CSort n) x)).(\lambda +(P: Prop).(let H0 \def (match H in clear return (\lambda (c: C).(\lambda (c0: +C).(\lambda (_: (clear c c0)).((eq C c (CSort n)) \to ((eq C c0 x) \to P))))) +with [(clear_bind b e u) \Rightarrow (\lambda (H0: (eq C (CHead e (Bind b) u) +(CSort n))).(\lambda (H1: (eq C (CHead e (Bind b) u) x)).((let H2 \def +(eq_ind C (CHead e (Bind b) u) (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ _ _) +\Rightarrow True])) I (CSort n) H0) in (False_ind ((eq C (CHead e (Bind b) u) +x) \to P) H2)) H1))) | (clear_flat e c H0 f u) \Rightarrow (\lambda (H1: (eq +C (CHead e (Flat f) u) (CSort n))).(\lambda (H2: (eq C c x)).((let H3 \def +(eq_ind C (CHead e (Flat f) u) (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ _ _) +\Rightarrow True])) I (CSort n) H1) in (False_ind ((eq C c x) \to ((clear e +c) \to P)) H3)) H2 H0)))]) in (H0 (refl_equal C (CSort n)) (refl_equal C +x)))))). + +theorem clear_gen_bind: + \forall (b: B).(\forall (e: C).(\forall (x: C).(\forall (u: T).((clear +(CHead e (Bind b) u) x) \to (eq C x (CHead e (Bind b) u)))))) +\def + \lambda (b: B).(\lambda (e: C).(\lambda (x: C).(\lambda (u: T).(\lambda (H: +(clear (CHead e (Bind b) u) x)).(let H0 \def (match H in clear return +(\lambda (c: C).(\lambda (c0: C).(\lambda (_: (clear c c0)).((eq C c (CHead e +(Bind b) u)) \to ((eq C c0 x) \to (eq C x (CHead e (Bind b) u))))))) with +[(clear_bind b0 e0 u0) \Rightarrow (\lambda (H0: (eq C (CHead e0 (Bind b0) +u0) (CHead e (Bind b) u))).(\lambda (H1: (eq C (CHead e0 (Bind b0) u0) +x)).((let H2 \def (f_equal C T (\lambda (e1: C).(match e1 in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | (CHead _ _ t) \Rightarrow +t])) (CHead e0 (Bind b0) u0) (CHead e (Bind b) u) H0) in ((let H3 \def +(f_equal C B (\lambda (e1: C).(match e1 in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow b0 | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) \Rightarrow +b0])])) (CHead e0 (Bind b0) u0) (CHead e (Bind b) u) H0) in ((let H4 \def +(f_equal C C (\lambda (e1: C).(match e1 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow e0 | (CHead c _ _) \Rightarrow c])) (CHead e0 (Bind +b0) u0) (CHead e (Bind b) u) H0) in (eq_ind C e (\lambda (c: C).((eq B b0 b) +\to ((eq T u0 u) \to ((eq C (CHead c (Bind b0) u0) x) \to (eq C x (CHead e +(Bind b) u)))))) (\lambda (H5: (eq B b0 b)).(eq_ind B b (\lambda (b1: B).((eq +T u0 u) \to ((eq C (CHead e (Bind b1) u0) x) \to (eq C x (CHead e (Bind b) +u))))) (\lambda (H6: (eq T u0 u)).(eq_ind T u (\lambda (t: T).((eq C (CHead e +(Bind b) t) x) \to (eq C x (CHead e (Bind b) u)))) (\lambda (H7: (eq C (CHead +e (Bind b) u) x)).(eq_ind C (CHead e (Bind b) u) (\lambda (c: C).(eq C c +(CHead e (Bind b) u))) (refl_equal C (CHead e (Bind b) u)) x H7)) u0 (sym_eq +T u0 u H6))) b0 (sym_eq B b0 b H5))) e0 (sym_eq C e0 e H4))) H3)) H2)) H1))) +| (clear_flat e0 c H0 f u0) \Rightarrow (\lambda (H1: (eq C (CHead e0 (Flat +f) u0) (CHead e (Bind b) u))).(\lambda (H2: (eq C c x)).((let H3 \def (eq_ind +C (CHead e0 (Flat f) u0) (\lambda (e1: C).(match e1 in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) \Rightarrow (match +k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat +_) \Rightarrow True])])) I (CHead e (Bind b) u) H1) in (False_ind ((eq C c x) +\to ((clear e0 c) \to (eq C x (CHead e (Bind b) u)))) H3)) H2 H0)))]) in (H0 +(refl_equal C (CHead e (Bind b) u)) (refl_equal C x))))))). + +theorem clear_gen_flat: + \forall (f: F).(\forall (e: C).(\forall (x: C).(\forall (u: T).((clear +(CHead e (Flat f) u) x) \to (clear e x))))) +\def + \lambda (f: F).(\lambda (e: C).(\lambda (x: C).(\lambda (u: T).(\lambda (H: +(clear (CHead e (Flat f) u) x)).(let H0 \def (match H in clear return +(\lambda (c: C).(\lambda (c0: C).(\lambda (_: (clear c c0)).((eq C c (CHead e +(Flat f) u)) \to ((eq C c0 x) \to (clear e x)))))) with [(clear_bind b e0 u0) +\Rightarrow (\lambda (H0: (eq C (CHead e0 (Bind b) u0) (CHead e (Flat f) +u))).(\lambda (H1: (eq C (CHead e0 (Bind b) u0) x)).((let H2 \def (eq_ind C +(CHead e0 (Bind b) u0) (\lambda (e1: C).(match e1 in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) \Rightarrow (match +k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | (Flat +_) \Rightarrow False])])) I (CHead e (Flat f) u) H0) in (False_ind ((eq C +(CHead e0 (Bind b) u0) x) \to (clear e x)) H2)) H1))) | (clear_flat e0 c H0 +f0 u0) \Rightarrow (\lambda (H1: (eq C (CHead e0 (Flat f0) u0) (CHead e (Flat +f) u))).(\lambda (H2: (eq C c x)).((let H3 \def (f_equal C T (\lambda (e1: +C).(match e1 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | +(CHead _ _ t) \Rightarrow t])) (CHead e0 (Flat f0) u0) (CHead e (Flat f) u) +H1) in ((let H4 \def (f_equal C F (\lambda (e1: C).(match e1 in C return +(\lambda (_: C).F) with [(CSort _) \Rightarrow f0 | (CHead _ k _) \Rightarrow +(match k in K return (\lambda (_: K).F) with [(Bind _) \Rightarrow f0 | (Flat +f1) \Rightarrow f1])])) (CHead e0 (Flat f0) u0) (CHead e (Flat f) u) H1) in +((let H5 \def (f_equal C C (\lambda (e1: C).(match e1 in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow e0 | (CHead c0 _ _) \Rightarrow c0])) +(CHead e0 (Flat f0) u0) (CHead e (Flat f) u) H1) in (eq_ind C e (\lambda (c0: +C).((eq F f0 f) \to ((eq T u0 u) \to ((eq C c x) \to ((clear c0 c) \to (clear +e x)))))) (\lambda (H6: (eq F f0 f)).(eq_ind F f (\lambda (_: F).((eq T u0 u) +\to ((eq C c x) \to ((clear e c) \to (clear e x))))) (\lambda (H7: (eq T u0 +u)).(eq_ind T u (\lambda (_: T).((eq C c x) \to ((clear e c) \to (clear e +x)))) (\lambda (H8: (eq C c x)).(eq_ind C x (\lambda (c0: C).((clear e c0) +\to (clear e x))) (\lambda (H9: (clear e x)).H9) c (sym_eq C c x H8))) u0 +(sym_eq T u0 u H7))) f0 (sym_eq F f0 f H6))) e0 (sym_eq C e0 e H5))) H4)) +H3)) H2 H0)))]) in (H0 (refl_equal C (CHead e (Flat f) u)) (refl_equal C +x))))))). + +theorem clear_gen_flat_r: + \forall (f: F).(\forall (x: C).(\forall (e: C).(\forall (u: T).((clear x +(CHead e (Flat f) u)) \to (\forall (P: Prop).P))))) +\def + \lambda (f: F).(\lambda (x: C).(\lambda (e: C).(\lambda (u: T).(\lambda (H: +(clear x (CHead e (Flat f) u))).(\lambda (P: Prop).(insert_eq C (CHead e +(Flat f) u) (\lambda (c: C).(clear x c)) P (\lambda (y: C).(\lambda (H0: +(clear x y)).(clear_ind (\lambda (_: C).(\lambda (c0: C).((eq C c0 (CHead e +(Flat f) u)) \to P))) (\lambda (b: B).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (H1: (eq C (CHead e0 (Bind b) u0) (CHead e (Flat f) u))).(let H2 +\def (eq_ind C (CHead e0 (Bind b) u0) (\lambda (ee: C).(match ee in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (CHead e (Flat f) u) H1) +in (False_ind P H2)))))) (\lambda (e0: C).(\lambda (c: C).(\lambda (H1: +(clear e0 c)).(\lambda (H2: (((eq C c (CHead e (Flat f) u)) \to P))).(\lambda +(_: F).(\lambda (_: T).(\lambda (H3: (eq C c (CHead e (Flat f) u))).(let H4 +\def (eq_ind C c (\lambda (c0: C).((eq C c0 (CHead e (Flat f) u)) \to P)) H2 +(CHead e (Flat f) u) H3) in (let H5 \def (eq_ind C c (\lambda (c0: C).(clear +e0 c0)) H1 (CHead e (Flat f) u) H3) in (H4 (refl_equal C (CHead e (Flat f) +u)))))))))))) x y H0))) H)))))). + +theorem clear_gen_all: + \forall (c1: C).(\forall (c2: C).((clear c1 c2) \to (ex_3 B C T (\lambda (b: +B).(\lambda (e: C).(\lambda (u: T).(eq C c2 (CHead e (Bind b) u)))))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: (clear c1 c2)).(clear_ind +(\lambda (_: C).(\lambda (c0: C).(ex_3 B C T (\lambda (b: B).(\lambda (e: +C).(\lambda (u: T).(eq C c0 (CHead e (Bind b) u)))))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (u: T).(ex_3_intro B C T (\lambda (b0: +B).(\lambda (e0: C).(\lambda (u0: T).(eq C (CHead e (Bind b) u) (CHead e0 +(Bind b0) u0))))) b e u (refl_equal C (CHead e (Bind b) u)))))) (\lambda (e: +C).(\lambda (c: C).(\lambda (H0: (clear e c)).(\lambda (H1: (ex_3 B C T +(\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(eq C c (CHead e0 (Bind b) +u))))))).(\lambda (_: F).(\lambda (_: T).(let H2 \def H1 in (ex_3_ind B C T +(\lambda (b: B).(\lambda (e0: C).(\lambda (u0: T).(eq C c (CHead e0 (Bind b) +u0))))) (ex_3 B C T (\lambda (b: B).(\lambda (e0: C).(\lambda (u0: T).(eq C c +(CHead e0 (Bind b) u0)))))) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: +T).(\lambda (H3: (eq C c (CHead x1 (Bind x0) x2))).(let H4 \def (eq_ind C c +(\lambda (c0: C).(clear e c0)) H0 (CHead x1 (Bind x0) x2) H3) in (eq_ind_r C +(CHead x1 (Bind x0) x2) (\lambda (c0: C).(ex_3 B C T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u0: T).(eq C c0 (CHead e0 (Bind b) u0))))))) (ex_3_intro B +C T (\lambda (b: B).(\lambda (e0: C).(\lambda (u0: T).(eq C (CHead x1 (Bind +x0) x2) (CHead e0 (Bind b) u0))))) x0 x1 x2 (refl_equal C (CHead x1 (Bind x0) +x2))) c H3)))))) H2)))))))) c1 c2 H))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/props.ma new file mode 100644 index 000000000..a1880711d --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/props.ma @@ -0,0 +1,139 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/clear/props". + +include "clear/fwd.ma". + +theorem clear_clear: + \forall (c1: C).(\forall (c2: C).((clear c1 c2) \to (clear c2 c2))) +\def + \lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: C).((clear c c2) \to +(clear c2 c2)))) (\lambda (n: nat).(\lambda (c2: C).(\lambda (H: (clear +(CSort n) c2)).(clear_gen_sort c2 n H (clear c2 c2))))) (\lambda (c: +C).(\lambda (H: ((\forall (c2: C).((clear c c2) \to (clear c2 +c2))))).(\lambda (k: K).(\lambda (t: T).(\lambda (c2: C).(\lambda (H0: (clear +(CHead c k t) c2)).(K_ind (\lambda (k0: K).((clear (CHead c k0 t) c2) \to +(clear c2 c2))) (\lambda (b: B).(\lambda (H1: (clear (CHead c (Bind b) t) +c2)).(eq_ind_r C (CHead c (Bind b) t) (\lambda (c0: C).(clear c0 c0)) +(clear_bind b c t) c2 (clear_gen_bind b c c2 t H1)))) (\lambda (f: +F).(\lambda (H1: (clear (CHead c (Flat f) t) c2)).(H c2 (clear_gen_flat f c +c2 t H1)))) k H0))))))) c1). + +theorem clear_mono: + \forall (c: C).(\forall (c1: C).((clear c c1) \to (\forall (c2: C).((clear c +c2) \to (eq C c1 c2))))) +\def + \lambda (c: C).(C_ind (\lambda (c0: C).(\forall (c1: C).((clear c0 c1) \to +(\forall (c2: C).((clear c0 c2) \to (eq C c1 c2)))))) (\lambda (n: +nat).(\lambda (c1: C).(\lambda (_: (clear (CSort n) c1)).(\lambda (c2: +C).(\lambda (H0: (clear (CSort n) c2)).(clear_gen_sort c2 n H0 (eq C c1 +c2))))))) (\lambda (c0: C).(\lambda (H: ((\forall (c1: C).((clear c0 c1) \to +(\forall (c2: C).((clear c0 c2) \to (eq C c1 c2))))))).(\lambda (k: +K).(\lambda (t: T).(\lambda (c1: C).(\lambda (H0: (clear (CHead c0 k t) +c1)).(\lambda (c2: C).(\lambda (H1: (clear (CHead c0 k t) c2)).(K_ind +(\lambda (k0: K).((clear (CHead c0 k0 t) c1) \to ((clear (CHead c0 k0 t) c2) +\to (eq C c1 c2)))) (\lambda (b: B).(\lambda (H2: (clear (CHead c0 (Bind b) +t) c1)).(\lambda (H3: (clear (CHead c0 (Bind b) t) c2)).(eq_ind_r C (CHead c0 +(Bind b) t) (\lambda (c3: C).(eq C c1 c3)) (eq_ind_r C (CHead c0 (Bind b) t) +(\lambda (c3: C).(eq C c3 (CHead c0 (Bind b) t))) (refl_equal C (CHead c0 +(Bind b) t)) c1 (clear_gen_bind b c0 c1 t H2)) c2 (clear_gen_bind b c0 c2 t +H3))))) (\lambda (f: F).(\lambda (H2: (clear (CHead c0 (Flat f) t) +c1)).(\lambda (H3: (clear (CHead c0 (Flat f) t) c2)).(H c1 (clear_gen_flat f +c0 c1 t H2) c2 (clear_gen_flat f c0 c2 t H3))))) k H0 H1))))))))) c). + +theorem clear_trans: + \forall (c1: C).(\forall (c: C).((clear c1 c) \to (\forall (c2: C).((clear c +c2) \to (clear c1 c2))))) +\def + \lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c0: C).((clear c c0) \to +(\forall (c2: C).((clear c0 c2) \to (clear c c2)))))) (\lambda (n: +nat).(\lambda (c: C).(\lambda (H: (clear (CSort n) c)).(\lambda (c2: +C).(\lambda (_: (clear c c2)).(clear_gen_sort c n H (clear (CSort n) +c2))))))) (\lambda (c: C).(\lambda (H: ((\forall (c0: C).((clear c c0) \to +(\forall (c2: C).((clear c0 c2) \to (clear c c2))))))).(\lambda (k: +K).(\lambda (t: T).(\lambda (c0: C).(\lambda (H0: (clear (CHead c k t) +c0)).(\lambda (c2: C).(\lambda (H1: (clear c0 c2)).(K_ind (\lambda (k0: +K).((clear (CHead c k0 t) c0) \to (clear (CHead c k0 t) c2))) (\lambda (b: +B).(\lambda (H2: (clear (CHead c (Bind b) t) c0)).(let H3 \def (eq_ind C c0 +(\lambda (c3: C).(clear c3 c2)) H1 (CHead c (Bind b) t) (clear_gen_bind b c +c0 t H2)) in (eq_ind_r C (CHead c (Bind b) t) (\lambda (c3: C).(clear (CHead +c (Bind b) t) c3)) (clear_bind b c t) c2 (clear_gen_bind b c c2 t H3))))) +(\lambda (f: F).(\lambda (H2: (clear (CHead c (Flat f) t) c0)).(clear_flat c +c2 (H c0 (clear_gen_flat f c c0 t H2) c2 H1) f t))) k H0))))))))) c1). + +theorem clear_ctail: + \forall (b: B).(\forall (c1: C).(\forall (c2: C).(\forall (u2: T).((clear c1 +(CHead c2 (Bind b) u2)) \to (\forall (k: K).(\forall (u1: T).(clear (CTail k +u1 c1) (CHead (CTail k u1 c2) (Bind b) u2)))))))) +\def + \lambda (b: B).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: +C).(\forall (u2: T).((clear c (CHead c2 (Bind b) u2)) \to (\forall (k: +K).(\forall (u1: T).(clear (CTail k u1 c) (CHead (CTail k u1 c2) (Bind b) +u2)))))))) (\lambda (n: nat).(\lambda (c2: C).(\lambda (u2: T).(\lambda (H: +(clear (CSort n) (CHead c2 (Bind b) u2))).(\lambda (k: K).(\lambda (u1: +T).(K_ind (\lambda (k0: K).(clear (CHead (CSort n) k0 u1) (CHead (CTail k0 u1 +c2) (Bind b) u2))) (\lambda (b0: B).(clear_gen_sort (CHead c2 (Bind b) u2) n +H (clear (CHead (CSort n) (Bind b0) u1) (CHead (CTail (Bind b0) u1 c2) (Bind +b) u2)))) (\lambda (f: F).(clear_gen_sort (CHead c2 (Bind b) u2) n H (clear +(CHead (CSort n) (Flat f) u1) (CHead (CTail (Flat f) u1 c2) (Bind b) u2)))) +k))))))) (\lambda (c: C).(\lambda (H: ((\forall (c2: C).(\forall (u2: +T).((clear c (CHead c2 (Bind b) u2)) \to (\forall (k: K).(\forall (u1: +T).(clear (CTail k u1 c) (CHead (CTail k u1 c2) (Bind b) u2))))))))).(\lambda +(k: K).(\lambda (t: T).(\lambda (c2: C).(\lambda (u2: T).(\lambda (H0: (clear +(CHead c k t) (CHead c2 (Bind b) u2))).(\lambda (k0: K).(\lambda (u1: +T).(K_ind (\lambda (k1: K).((clear (CHead c k1 t) (CHead c2 (Bind b) u2)) \to +(clear (CHead (CTail k0 u1 c) k1 t) (CHead (CTail k0 u1 c2) (Bind b) u2)))) +(\lambda (b0: B).(\lambda (H1: (clear (CHead c (Bind b0) t) (CHead c2 (Bind +b) u2))).(let H2 \def (f_equal C C (\lambda (e: C).(match e in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow c2 | (CHead c0 _ _) +\Rightarrow c0])) (CHead c2 (Bind b) u2) (CHead c (Bind b0) t) +(clear_gen_bind b0 c (CHead c2 (Bind b) u2) t H1)) in ((let H3 \def (f_equal +C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with [(CSort _) +\Rightarrow b | (CHead _ k1 _) \Rightarrow (match k1 in K return (\lambda (_: +K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) \Rightarrow b])])) (CHead c2 +(Bind b) u2) (CHead c (Bind b0) t) (clear_gen_bind b0 c (CHead c2 (Bind b) +u2) t H1)) in ((let H4 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u2 | (CHead _ _ t0) +\Rightarrow t0])) (CHead c2 (Bind b) u2) (CHead c (Bind b0) t) +(clear_gen_bind b0 c (CHead c2 (Bind b) u2) t H1)) in (\lambda (H5: (eq B b +b0)).(\lambda (H6: (eq C c2 c)).(eq_ind_r T t (\lambda (t0: T).(clear (CHead +(CTail k0 u1 c) (Bind b0) t) (CHead (CTail k0 u1 c2) (Bind b) t0))) (eq_ind_r +C c (\lambda (c0: C).(clear (CHead (CTail k0 u1 c) (Bind b0) t) (CHead (CTail +k0 u1 c0) (Bind b) t))) (eq_ind B b (\lambda (b1: B).(clear (CHead (CTail k0 +u1 c) (Bind b1) t) (CHead (CTail k0 u1 c) (Bind b) t))) (clear_bind b (CTail +k0 u1 c) t) b0 H5) c2 H6) u2 H4)))) H3)) H2)))) (\lambda (f: F).(\lambda (H1: +(clear (CHead c (Flat f) t) (CHead c2 (Bind b) u2))).(clear_flat (CTail k0 u1 +c) (CHead (CTail k0 u1 c2) (Bind b) u2) (H c2 u2 (clear_gen_flat f c (CHead +c2 (Bind b) u2) t H1) k0 u1) f t))) k H0)))))))))) c1)). + +theorem clear_cle: + \forall (c1: C).(\forall (c2: C).((clear c1 c2) \to (cle c2 c1))) +\def + \lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: C).((clear c c2) \to +(le (cweight c2) (cweight c))))) (\lambda (n: nat).(\lambda (c2: C).(\lambda +(H: (clear (CSort n) c2)).(clear_gen_sort c2 n H (le (cweight c2) O))))) +(\lambda (c: C).(\lambda (H: ((\forall (c2: C).((clear c c2) \to (le (cweight +c2) (cweight c)))))).(\lambda (k: K).(\lambda (t: T).(\lambda (c2: +C).(\lambda (H0: (clear (CHead c k t) c2)).(K_ind (\lambda (k0: K).((clear +(CHead c k0 t) c2) \to (le (cweight c2) (plus (cweight c) (tweight t))))) +(\lambda (b: B).(\lambda (H1: (clear (CHead c (Bind b) t) c2)).(eq_ind_r C +(CHead c (Bind b) t) (\lambda (c0: C).(le (cweight c0) (plus (cweight c) +(tweight t)))) (le_n (plus (cweight c) (tweight t))) c2 (clear_gen_bind b c +c2 t H1)))) (\lambda (f: F).(\lambda (H1: (clear (CHead c (Flat f) t) +c2)).(le_plus_trans (cweight c2) (cweight c) (tweight t) (H c2 +(clear_gen_flat f c c2 t H1))))) k H0))))))) c1). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/defs.ma new file mode 100644 index 000000000..2885518ea --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/defs.ma @@ -0,0 +1,28 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/clen/defs". + +include "C/defs.ma". + +include "s/defs.ma". + +definition clen: + C \to nat +\def + let rec clen (c: C) on c: nat \def (match c with [(CSort _) \Rightarrow O | +(CHead c0 k _) \Rightarrow (s k (clen c0))]) in clen. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/getl.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/getl.ma new file mode 100644 index 000000000..8773297ca --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/getl.ma @@ -0,0 +1,357 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/clen/getl". + +include "clen/defs.ma". + +include "getl/props.ma". + +theorem getl_ctail_clen: + \forall (b: B).(\forall (t: T).(\forall (c: C).(ex nat (\lambda (n: +nat).(getl (clen c) (CTail (Bind b) t c) (CHead (CSort n) (Bind b) t)))))) +\def + \lambda (b: B).(\lambda (t: T).(\lambda (c: C).(C_ind (\lambda (c0: C).(ex +nat (\lambda (n: nat).(getl (clen c0) (CTail (Bind b) t c0) (CHead (CSort n) +(Bind b) t))))) (\lambda (n: nat).(ex_intro nat (\lambda (n0: nat).(getl O +(CHead (CSort n) (Bind b) t) (CHead (CSort n0) (Bind b) t))) n (getl_refl b +(CSort n) t))) (\lambda (c0: C).(\lambda (H: (ex nat (\lambda (n: nat).(getl +(clen c0) (CTail (Bind b) t c0) (CHead (CSort n) (Bind b) t))))).(\lambda (k: +K).(\lambda (t0: T).(let H0 \def H in (ex_ind nat (\lambda (n: nat).(getl +(clen c0) (CTail (Bind b) t c0) (CHead (CSort n) (Bind b) t))) (ex nat +(\lambda (n: nat).(getl (s k (clen c0)) (CHead (CTail (Bind b) t c0) k t0) +(CHead (CSort n) (Bind b) t)))) (\lambda (x: nat).(\lambda (H1: (getl (clen +c0) (CTail (Bind b) t c0) (CHead (CSort x) (Bind b) t))).(K_ind (\lambda (k0: +K).(ex nat (\lambda (n: nat).(getl (s k0 (clen c0)) (CHead (CTail (Bind b) t +c0) k0 t0) (CHead (CSort n) (Bind b) t))))) (\lambda (b0: B).(ex_intro nat +(\lambda (n: nat).(getl (S (clen c0)) (CHead (CTail (Bind b) t c0) (Bind b0) +t0) (CHead (CSort n) (Bind b) t))) x (getl_head (Bind b0) (clen c0) (CTail +(Bind b) t c0) (CHead (CSort x) (Bind b) t) H1 t0))) (\lambda (f: +F).(ex_intro nat (\lambda (n: nat).(getl (clen c0) (CHead (CTail (Bind b) t +c0) (Flat f) t0) (CHead (CSort n) (Bind b) t))) x (getl_flat (CTail (Bind b) +t c0) (CHead (CSort x) (Bind b) t) (clen c0) H1 f t0))) k))) H0)))))) c))). + +theorem getl_gen_tail: + \forall (k: K).(\forall (b: B).(\forall (u1: T).(\forall (u2: T).(\forall +(c2: C).(\forall (c1: C).(\forall (i: nat).((getl i (CTail k u1 c1) (CHead c2 +(Bind b) u2)) \to (or (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) +(\lambda (e: C).(getl i c1 (CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: +nat).(eq nat i (clen c1))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: +nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c2 (CSort n)))))))))))) +\def + \lambda (k: K).(\lambda (b: B).(\lambda (u1: T).(\lambda (u2: T).(\lambda +(c2: C).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (i: nat).((getl i +(CTail k u1 c) (CHead c2 (Bind b) u2)) \to (or (ex2 C (\lambda (e: C).(eq C +c2 (CTail k u1 e))) (\lambda (e: C).(getl i c (CHead e (Bind b) u2)))) (ex4 +nat (\lambda (_: nat).(eq nat i (clen c))) (\lambda (_: nat).(eq K k (Bind +b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c2 (CSort +n)))))))) (\lambda (n: nat).(\lambda (i: nat).(nat_ind (\lambda (n0: +nat).((getl n0 (CTail k u1 (CSort n)) (CHead c2 (Bind b) u2)) \to (or (ex2 C +(\lambda (e: C).(eq C c2 (CTail k u1 e))) (\lambda (e: C).(getl n0 (CSort n) +(CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat n0 (clen (CSort +n)))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) +(\lambda (n1: nat).(eq C c2 (CSort n1))))))) (\lambda (H: (getl O (CHead +(CSort n) k u1) (CHead c2 (Bind b) u2))).(K_ind (\lambda (k0: K).((clear +(CHead (CSort n) k0 u1) (CHead c2 (Bind b) u2)) \to (or (ex2 C (\lambda (e: +C).(eq C c2 (CTail k0 u1 e))) (\lambda (e: C).(getl O (CSort n) (CHead e +(Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat O O)) (\lambda (_: +nat).(eq K k0 (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: +nat).(eq C c2 (CSort n0))))))) (\lambda (b0: B).(\lambda (H0: (clear (CHead +(CSort n) (Bind b0) u1) (CHead c2 (Bind b) u2))).(let H1 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow c2 | (CHead c _ _) \Rightarrow c])) (CHead c2 (Bind b) u2) (CHead +(CSort n) (Bind b0) u1) (clear_gen_bind b0 (CSort n) (CHead c2 (Bind b) u2) +u1 H0)) in ((let H2 \def (f_equal C B (\lambda (e: C).(match e in C return +(\lambda (_: C).B) with [(CSort _) \Rightarrow b | (CHead _ k0 _) \Rightarrow +(match k0 in K return (\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | +(Flat _) \Rightarrow b])])) (CHead c2 (Bind b) u2) (CHead (CSort n) (Bind b0) +u1) (clear_gen_bind b0 (CSort n) (CHead c2 (Bind b) u2) u1 H0)) in ((let H3 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u2 | (CHead _ _ t) \Rightarrow t])) (CHead c2 +(Bind b) u2) (CHead (CSort n) (Bind b0) u1) (clear_gen_bind b0 (CSort n) +(CHead c2 (Bind b) u2) u1 H0)) in (\lambda (H4: (eq B b b0)).(\lambda (H5: +(eq C c2 (CSort n))).(eq_ind_r C (CSort n) (\lambda (c: C).(or (ex2 C +(\lambda (e: C).(eq C c (CTail (Bind b0) u1 e))) (\lambda (e: C).(getl O +(CSort n) (CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat O O)) +(\lambda (_: nat).(eq K (Bind b0) (Bind b))) (\lambda (_: nat).(eq T u1 u2)) +(\lambda (n0: nat).(eq C c (CSort n0)))))) (eq_ind_r T u1 (\lambda (t: T).(or +(ex2 C (\lambda (e: C).(eq C (CSort n) (CTail (Bind b0) u1 e))) (\lambda (e: +C).(getl O (CSort n) (CHead e (Bind b) t)))) (ex4 nat (\lambda (_: nat).(eq +nat O O)) (\lambda (_: nat).(eq K (Bind b0) (Bind b))) (\lambda (_: nat).(eq +T u1 t)) (\lambda (n0: nat).(eq C (CSort n) (CSort n0)))))) (eq_ind_r B b0 +(\lambda (b1: B).(or (ex2 C (\lambda (e: C).(eq C (CSort n) (CTail (Bind b0) +u1 e))) (\lambda (e: C).(getl O (CSort n) (CHead e (Bind b1) u1)))) (ex4 nat +(\lambda (_: nat).(eq nat O O)) (\lambda (_: nat).(eq K (Bind b0) (Bind b1))) +(\lambda (_: nat).(eq T u1 u1)) (\lambda (n0: nat).(eq C (CSort n) (CSort +n0)))))) (or_intror (ex2 C (\lambda (e: C).(eq C (CSort n) (CTail (Bind b0) +u1 e))) (\lambda (e: C).(getl O (CSort n) (CHead e (Bind b0) u1)))) (ex4 nat +(\lambda (_: nat).(eq nat O O)) (\lambda (_: nat).(eq K (Bind b0) (Bind b0))) +(\lambda (_: nat).(eq T u1 u1)) (\lambda (n0: nat).(eq C (CSort n) (CSort +n0)))) (ex4_intro nat (\lambda (_: nat).(eq nat O O)) (\lambda (_: nat).(eq K +(Bind b0) (Bind b0))) (\lambda (_: nat).(eq T u1 u1)) (\lambda (n0: nat).(eq +C (CSort n) (CSort n0))) n (refl_equal nat O) (refl_equal K (Bind b0)) +(refl_equal T u1) (refl_equal C (CSort n)))) b H4) u2 H3) c2 H5)))) H2)) +H1)))) (\lambda (f: F).(\lambda (H0: (clear (CHead (CSort n) (Flat f) u1) +(CHead c2 (Bind b) u2))).(clear_gen_sort (CHead c2 (Bind b) u2) n +(clear_gen_flat f (CSort n) (CHead c2 (Bind b) u2) u1 H0) (or (ex2 C (\lambda +(e: C).(eq C c2 (CTail (Flat f) u1 e))) (\lambda (e: C).(getl O (CSort n) +(CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat O O)) (\lambda +(_: nat).(eq K (Flat f) (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda +(n0: nat).(eq C c2 (CSort n0)))))))) k (getl_gen_O (CHead (CSort n) k u1) +(CHead c2 (Bind b) u2) H))) (\lambda (n0: nat).(\lambda (_: (((getl n0 (CHead +(CSort n) k u1) (CHead c2 (Bind b) u2)) \to (or (ex2 C (\lambda (e: C).(eq C +c2 (CTail k u1 e))) (\lambda (e: C).(getl n0 (CSort n) (CHead e (Bind b) +u2)))) (ex4 nat (\lambda (_: nat).(eq nat n0 O)) (\lambda (_: nat).(eq K k +(Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n1: nat).(eq C c2 (CSort +n1)))))))).(\lambda (H0: (getl (S n0) (CHead (CSort n) k u1) (CHead c2 (Bind +b) u2))).(getl_gen_sort n (r k n0) (CHead c2 (Bind b) u2) (getl_gen_S k +(CSort n) (CHead c2 (Bind b) u2) u1 n0 H0) (or (ex2 C (\lambda (e: C).(eq C +c2 (CTail k u1 e))) (\lambda (e: C).(getl (S n0) (CSort n) (CHead e (Bind b) +u2)))) (ex4 nat (\lambda (_: nat).(eq nat (S n0) O)) (\lambda (_: nat).(eq K +k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n1: nat).(eq C c2 +(CSort n1))))))))) i))) (\lambda (c: C).(\lambda (H: ((\forall (i: +nat).((getl i (CTail k u1 c) (CHead c2 (Bind b) u2)) \to (or (ex2 C (\lambda +(e: C).(eq C c2 (CTail k u1 e))) (\lambda (e: C).(getl i c (CHead e (Bind b) +u2)))) (ex4 nat (\lambda (_: nat).(eq nat i (clen c))) (\lambda (_: nat).(eq +K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c2 +(CSort n))))))))).(\lambda (k0: K).(\lambda (t: T).(\lambda (i: nat).(nat_ind +(\lambda (n: nat).((getl n (CTail k u1 (CHead c k0 t)) (CHead c2 (Bind b) +u2)) \to (or (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) (\lambda (e: +C).(getl n (CHead c k0 t) (CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: +nat).(eq nat n (clen (CHead c k0 t)))) (\lambda (_: nat).(eq K k (Bind b))) +(\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C c2 (CSort n0))))))) +(\lambda (H0: (getl O (CHead (CTail k u1 c) k0 t) (CHead c2 (Bind b) +u2))).(K_ind (\lambda (k1: K).((clear (CHead (CTail k u1 c) k1 t) (CHead c2 +(Bind b) u2)) \to (or (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) +(\lambda (e: C).(getl O (CHead c k1 t) (CHead e (Bind b) u2)))) (ex4 nat +(\lambda (_: nat).(eq nat O (s k1 (clen c)))) (\lambda (_: nat).(eq K k (Bind +b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c2 (CSort +n))))))) (\lambda (b0: B).(\lambda (H1: (clear (CHead (CTail k u1 c) (Bind +b0) t) (CHead c2 (Bind b) u2))).(let H2 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c2 | +(CHead c0 _ _) \Rightarrow c0])) (CHead c2 (Bind b) u2) (CHead (CTail k u1 c) +(Bind b0) t) (clear_gen_bind b0 (CTail k u1 c) (CHead c2 (Bind b) u2) t H1)) +in ((let H3 \def (f_equal C B (\lambda (e: C).(match e in C return (\lambda +(_: C).B) with [(CSort _) \Rightarrow b | (CHead _ k1 _) \Rightarrow (match +k1 in K return (\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) +\Rightarrow b])])) (CHead c2 (Bind b) u2) (CHead (CTail k u1 c) (Bind b0) t) +(clear_gen_bind b0 (CTail k u1 c) (CHead c2 (Bind b) u2) t H1)) in ((let H4 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u2 | (CHead _ _ t0) \Rightarrow t0])) (CHead c2 +(Bind b) u2) (CHead (CTail k u1 c) (Bind b0) t) (clear_gen_bind b0 (CTail k +u1 c) (CHead c2 (Bind b) u2) t H1)) in (\lambda (H5: (eq B b b0)).(\lambda +(H6: (eq C c2 (CTail k u1 c))).(eq_ind T u2 (\lambda (t0: T).(or (ex2 C +(\lambda (e: C).(eq C c2 (CTail k u1 e))) (\lambda (e: C).(getl O (CHead c +(Bind b0) t0) (CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat O +(s (Bind b0) (clen c)))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: +nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c2 (CSort n)))))) (eq_ind B b +(\lambda (b1: B).(or (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) +(\lambda (e: C).(getl O (CHead c (Bind b1) u2) (CHead e (Bind b) u2)))) (ex4 +nat (\lambda (_: nat).(eq nat O (s (Bind b1) (clen c)))) (\lambda (_: +nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq +C c2 (CSort n)))))) (let H7 \def (eq_ind C c2 (\lambda (c0: C).(\forall (i0: +nat).((getl i0 (CTail k u1 c) (CHead c0 (Bind b) u2)) \to (or (ex2 C (\lambda +(e: C).(eq C c0 (CTail k u1 e))) (\lambda (e: C).(getl i0 c (CHead e (Bind b) +u2)))) (ex4 nat (\lambda (_: nat).(eq nat i0 (clen c))) (\lambda (_: nat).(eq +K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c0 +(CSort n)))))))) H (CTail k u1 c) H6) in (eq_ind_r C (CTail k u1 c) (\lambda +(c0: C).(or (ex2 C (\lambda (e: C).(eq C c0 (CTail k u1 e))) (\lambda (e: +C).(getl O (CHead c (Bind b) u2) (CHead e (Bind b) u2)))) (ex4 nat (\lambda +(_: nat).(eq nat O (s (Bind b) (clen c)))) (\lambda (_: nat).(eq K k (Bind +b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c0 (CSort +n)))))) (or_introl (ex2 C (\lambda (e: C).(eq C (CTail k u1 c) (CTail k u1 +e))) (\lambda (e: C).(getl O (CHead c (Bind b) u2) (CHead e (Bind b) u2)))) +(ex4 nat (\lambda (_: nat).(eq nat O (s (Bind b) (clen c)))) (\lambda (_: +nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq +C (CTail k u1 c) (CSort n)))) (ex_intro2 C (\lambda (e: C).(eq C (CTail k u1 +c) (CTail k u1 e))) (\lambda (e: C).(getl O (CHead c (Bind b) u2) (CHead e +(Bind b) u2))) c (refl_equal C (CTail k u1 c)) (getl_refl b c u2))) c2 H6)) +b0 H5) t H4)))) H3)) H2)))) (\lambda (f: F).(\lambda (H1: (clear (CHead +(CTail k u1 c) (Flat f) t) (CHead c2 (Bind b) u2))).(let H2 \def (H O +(getl_intro O (CTail k u1 c) (CHead c2 (Bind b) u2) (CTail k u1 c) (drop_refl +(CTail k u1 c)) (clear_gen_flat f (CTail k u1 c) (CHead c2 (Bind b) u2) t +H1))) in (or_ind (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) (\lambda +(e: C).(getl O c (CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat +O (clen c))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 +u2)) (\lambda (n: nat).(eq C c2 (CSort n)))) (or (ex2 C (\lambda (e: C).(eq C +c2 (CTail k u1 e))) (\lambda (e: C).(getl O (CHead c (Flat f) t) (CHead e +(Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat O (s (Flat f) (clen c)))) +(\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda +(n: nat).(eq C c2 (CSort n))))) (\lambda (H3: (ex2 C (\lambda (e: C).(eq C c2 +(CTail k u1 e))) (\lambda (e: C).(getl O c (CHead e (Bind b) u2))))).(ex2_ind +C (\lambda (e: C).(eq C c2 (CTail k u1 e))) (\lambda (e: C).(getl O c (CHead +e (Bind b) u2))) (or (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) +(\lambda (e: C).(getl O (CHead c (Flat f) t) (CHead e (Bind b) u2)))) (ex4 +nat (\lambda (_: nat).(eq nat O (s (Flat f) (clen c)))) (\lambda (_: nat).(eq +K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c2 +(CSort n))))) (\lambda (x: C).(\lambda (H4: (eq C c2 (CTail k u1 +x))).(\lambda (H5: (getl O c (CHead x (Bind b) u2))).(eq_ind_r C (CTail k u1 +x) (\lambda (c0: C).(or (ex2 C (\lambda (e: C).(eq C c0 (CTail k u1 e))) +(\lambda (e: C).(getl O (CHead c (Flat f) t) (CHead e (Bind b) u2)))) (ex4 +nat (\lambda (_: nat).(eq nat O (s (Flat f) (clen c)))) (\lambda (_: nat).(eq +K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c0 +(CSort n)))))) (or_introl (ex2 C (\lambda (e: C).(eq C (CTail k u1 x) (CTail +k u1 e))) (\lambda (e: C).(getl O (CHead c (Flat f) t) (CHead e (Bind b) +u2)))) (ex4 nat (\lambda (_: nat).(eq nat O (s (Flat f) (clen c)))) (\lambda +(_: nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n: +nat).(eq C (CTail k u1 x) (CSort n)))) (ex_intro2 C (\lambda (e: C).(eq C +(CTail k u1 x) (CTail k u1 e))) (\lambda (e: C).(getl O (CHead c (Flat f) t) +(CHead e (Bind b) u2))) x (refl_equal C (CTail k u1 x)) (getl_flat c (CHead x +(Bind b) u2) O H5 f t))) c2 H4)))) H3)) (\lambda (H3: (ex4 nat (\lambda (_: +nat).(eq nat O (clen c))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: +nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c2 (CSort n))))).(ex4_ind nat +(\lambda (_: nat).(eq nat O (clen c))) (\lambda (_: nat).(eq K k (Bind b))) +(\lambda (_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c2 (CSort n))) (or +(ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) (\lambda (e: C).(getl O +(CHead c (Flat f) t) (CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq +nat O (s (Flat f) (clen c)))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda +(_: nat).(eq T u1 u2)) (\lambda (n: nat).(eq C c2 (CSort n))))) (\lambda (x0: +nat).(\lambda (H4: (eq nat O (clen c))).(\lambda (H5: (eq K k (Bind +b))).(\lambda (H6: (eq T u1 u2)).(\lambda (H7: (eq C c2 (CSort +x0))).(eq_ind_r C (CSort x0) (\lambda (c0: C).(or (ex2 C (\lambda (e: C).(eq +C c0 (CTail k u1 e))) (\lambda (e: C).(getl O (CHead c (Flat f) t) (CHead e +(Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat O (s (Flat f) (clen c)))) +(\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda +(n: nat).(eq C c0 (CSort n)))))) (eq_ind T u1 (\lambda (t0: T).(or (ex2 C +(\lambda (e: C).(eq C (CSort x0) (CTail k u1 e))) (\lambda (e: C).(getl O +(CHead c (Flat f) t) (CHead e (Bind b) t0)))) (ex4 nat (\lambda (_: nat).(eq +nat O (s (Flat f) (clen c)))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda +(_: nat).(eq T u1 t0)) (\lambda (n: nat).(eq C (CSort x0) (CSort n)))))) +(eq_ind_r K (Bind b) (\lambda (k1: K).(or (ex2 C (\lambda (e: C).(eq C (CSort +x0) (CTail k1 u1 e))) (\lambda (e: C).(getl O (CHead c (Flat f) t) (CHead e +(Bind b) u1)))) (ex4 nat (\lambda (_: nat).(eq nat O (s (Flat f) (clen c)))) +(\lambda (_: nat).(eq K k1 (Bind b))) (\lambda (_: nat).(eq T u1 u1)) +(\lambda (n: nat).(eq C (CSort x0) (CSort n)))))) (or_intror (ex2 C (\lambda +(e: C).(eq C (CSort x0) (CTail (Bind b) u1 e))) (\lambda (e: C).(getl O +(CHead c (Flat f) t) (CHead e (Bind b) u1)))) (ex4 nat (\lambda (_: nat).(eq +nat O (s (Flat f) (clen c)))) (\lambda (_: nat).(eq K (Bind b) (Bind b))) +(\lambda (_: nat).(eq T u1 u1)) (\lambda (n: nat).(eq C (CSort x0) (CSort +n)))) (ex4_intro nat (\lambda (_: nat).(eq nat O (s (Flat f) (clen c)))) +(\lambda (_: nat).(eq K (Bind b) (Bind b))) (\lambda (_: nat).(eq T u1 u1)) +(\lambda (n: nat).(eq C (CSort x0) (CSort n))) x0 H4 (refl_equal K (Bind b)) +(refl_equal T u1) (refl_equal C (CSort x0)))) k H5) u2 H6) c2 H7)))))) H3)) +H2)))) k0 (getl_gen_O (CHead (CTail k u1 c) k0 t) (CHead c2 (Bind b) u2) +H0))) (\lambda (n: nat).(\lambda (H0: (((getl n (CHead (CTail k u1 c) k0 t) +(CHead c2 (Bind b) u2)) \to (or (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 +e))) (\lambda (e: C).(getl n (CHead c k0 t) (CHead e (Bind b) u2)))) (ex4 nat +(\lambda (_: nat).(eq nat n (s k0 (clen c)))) (\lambda (_: nat).(eq K k (Bind +b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C c2 (CSort +n0)))))))).(\lambda (H1: (getl (S n) (CHead (CTail k u1 c) k0 t) (CHead c2 +(Bind b) u2))).(let H_x \def (H (r k0 n) (getl_gen_S k0 (CTail k u1 c) (CHead +c2 (Bind b) u2) t n H1)) in (let H2 \def H_x in (or_ind (ex2 C (\lambda (e: +C).(eq C c2 (CTail k u1 e))) (\lambda (e: C).(getl (r k0 n) c (CHead e (Bind +b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat (r k0 n) (clen c))) (\lambda (_: +nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: +nat).(eq C c2 (CSort n0)))) (or (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 +e))) (\lambda (e: C).(getl (S n) (CHead c k0 t) (CHead e (Bind b) u2)))) (ex4 +nat (\lambda (_: nat).(eq nat (S n) (s k0 (clen c)))) (\lambda (_: nat).(eq K +k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C c2 +(CSort n0))))) (\lambda (H3: (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) +(\lambda (e: C).(getl (r k0 n) c (CHead e (Bind b) u2))))).(ex2_ind C +(\lambda (e: C).(eq C c2 (CTail k u1 e))) (\lambda (e: C).(getl (r k0 n) c +(CHead e (Bind b) u2))) (or (ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) +(\lambda (e: C).(getl (S n) (CHead c k0 t) (CHead e (Bind b) u2)))) (ex4 nat +(\lambda (_: nat).(eq nat (S n) (s k0 (clen c)))) (\lambda (_: nat).(eq K k +(Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C c2 (CSort +n0))))) (\lambda (x: C).(\lambda (H4: (eq C c2 (CTail k u1 x))).(\lambda (H5: +(getl (r k0 n) c (CHead x (Bind b) u2))).(let H6 \def (eq_ind C c2 (\lambda +(c0: C).(getl (r k0 n) (CTail k u1 c) (CHead c0 (Bind b) u2))) (getl_gen_S k0 +(CTail k u1 c) (CHead c2 (Bind b) u2) t n H1) (CTail k u1 x) H4) in (let H7 +\def (eq_ind C c2 (\lambda (c0: C).((getl n (CHead (CTail k u1 c) k0 t) +(CHead c0 (Bind b) u2)) \to (or (ex2 C (\lambda (e: C).(eq C c0 (CTail k u1 +e))) (\lambda (e: C).(getl n (CHead c k0 t) (CHead e (Bind b) u2)))) (ex4 nat +(\lambda (_: nat).(eq nat n (s k0 (clen c)))) (\lambda (_: nat).(eq K k (Bind +b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C c0 (CSort +n0))))))) H0 (CTail k u1 x) H4) in (eq_ind_r C (CTail k u1 x) (\lambda (c0: +C).(or (ex2 C (\lambda (e: C).(eq C c0 (CTail k u1 e))) (\lambda (e: C).(getl +(S n) (CHead c k0 t) (CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq +nat (S n) (s k0 (clen c)))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: +nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C c0 (CSort n0)))))) (or_introl +(ex2 C (\lambda (e: C).(eq C (CTail k u1 x) (CTail k u1 e))) (\lambda (e: +C).(getl (S n) (CHead c k0 t) (CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: +nat).(eq nat (S n) (s k0 (clen c)))) (\lambda (_: nat).(eq K k (Bind b))) +(\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C (CTail k u1 x) +(CSort n0)))) (ex_intro2 C (\lambda (e: C).(eq C (CTail k u1 x) (CTail k u1 +e))) (\lambda (e: C).(getl (S n) (CHead c k0 t) (CHead e (Bind b) u2))) x +(refl_equal C (CTail k u1 x)) (getl_head k0 n c (CHead x (Bind b) u2) H5 t))) +c2 H4)))))) H3)) (\lambda (H3: (ex4 nat (\lambda (_: nat).(eq nat (r k0 n) +(clen c))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 +u2)) (\lambda (n0: nat).(eq C c2 (CSort n0))))).(ex4_ind nat (\lambda (_: +nat).(eq nat (r k0 n) (clen c))) (\lambda (_: nat).(eq K k (Bind b))) +(\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C c2 (CSort n0))) (or +(ex2 C (\lambda (e: C).(eq C c2 (CTail k u1 e))) (\lambda (e: C).(getl (S n) +(CHead c k0 t) (CHead e (Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat (S +n) (s k0 (clen c)))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: +nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C c2 (CSort n0))))) (\lambda (x0: +nat).(\lambda (H4: (eq nat (r k0 n) (clen c))).(\lambda (H5: (eq K k (Bind +b))).(\lambda (H6: (eq T u1 u2)).(\lambda (H7: (eq C c2 (CSort x0))).(let H8 +\def (eq_ind C c2 (\lambda (c0: C).(getl (r k0 n) (CTail k u1 c) (CHead c0 +(Bind b) u2))) (getl_gen_S k0 (CTail k u1 c) (CHead c2 (Bind b) u2) t n H1) +(CSort x0) H7) in (let H9 \def (eq_ind C c2 (\lambda (c0: C).((getl n (CHead +(CTail k u1 c) k0 t) (CHead c0 (Bind b) u2)) \to (or (ex2 C (\lambda (e: +C).(eq C c0 (CTail k u1 e))) (\lambda (e: C).(getl n (CHead c k0 t) (CHead e +(Bind b) u2)))) (ex4 nat (\lambda (_: nat).(eq nat n (s k0 (clen c)))) +(\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda +(n0: nat).(eq C c0 (CSort n0))))))) H0 (CSort x0) H7) in (eq_ind_r C (CSort +x0) (\lambda (c0: C).(or (ex2 C (\lambda (e: C).(eq C c0 (CTail k u1 e))) +(\lambda (e: C).(getl (S n) (CHead c k0 t) (CHead e (Bind b) u2)))) (ex4 nat +(\lambda (_: nat).(eq nat (S n) (s k0 (clen c)))) (\lambda (_: nat).(eq K k +(Bind b))) (\lambda (_: nat).(eq T u1 u2)) (\lambda (n0: nat).(eq C c0 (CSort +n0)))))) (let H10 \def (eq_ind_r T u2 (\lambda (t0: T).((getl n (CHead (CTail +k u1 c) k0 t) (CHead (CSort x0) (Bind b) t0)) \to (or (ex2 C (\lambda (e: +C).(eq C (CSort x0) (CTail k u1 e))) (\lambda (e: C).(getl n (CHead c k0 t) +(CHead e (Bind b) t0)))) (ex4 nat (\lambda (_: nat).(eq nat n (s k0 (clen +c)))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: nat).(eq T u1 t0)) +(\lambda (n0: nat).(eq C (CSort x0) (CSort n0))))))) H9 u1 H6) in (let H11 +\def (eq_ind_r T u2 (\lambda (t0: T).(getl (r k0 n) (CTail k u1 c) (CHead +(CSort x0) (Bind b) t0))) H8 u1 H6) in (eq_ind T u1 (\lambda (t0: T).(or (ex2 +C (\lambda (e: C).(eq C (CSort x0) (CTail k u1 e))) (\lambda (e: C).(getl (S +n) (CHead c k0 t) (CHead e (Bind b) t0)))) (ex4 nat (\lambda (_: nat).(eq nat +(S n) (s k0 (clen c)))) (\lambda (_: nat).(eq K k (Bind b))) (\lambda (_: +nat).(eq T u1 t0)) (\lambda (n0: nat).(eq C (CSort x0) (CSort n0)))))) (let +H12 \def (eq_ind K k (\lambda (k1: K).((getl n (CHead (CTail k1 u1 c) k0 t) +(CHead (CSort x0) (Bind b) u1)) \to (or (ex2 C (\lambda (e: C).(eq C (CSort +x0) (CTail k1 u1 e))) (\lambda (e: C).(getl n (CHead c k0 t) (CHead e (Bind +b) u1)))) (ex4 nat (\lambda (_: nat).(eq nat n (s k0 (clen c)))) (\lambda (_: +nat).(eq K k1 (Bind b))) (\lambda (_: nat).(eq T u1 u1)) (\lambda (n0: +nat).(eq C (CSort x0) (CSort n0))))))) H10 (Bind b) H5) in (let H13 \def +(eq_ind K k (\lambda (k1: K).(getl (r k0 n) (CTail k1 u1 c) (CHead (CSort x0) +(Bind b) u1))) H11 (Bind b) H5) in (eq_ind_r K (Bind b) (\lambda (k1: K).(or +(ex2 C (\lambda (e: C).(eq C (CSort x0) (CTail k1 u1 e))) (\lambda (e: +C).(getl (S n) (CHead c k0 t) (CHead e (Bind b) u1)))) (ex4 nat (\lambda (_: +nat).(eq nat (S n) (s k0 (clen c)))) (\lambda (_: nat).(eq K k1 (Bind b))) +(\lambda (_: nat).(eq T u1 u1)) (\lambda (n0: nat).(eq C (CSort x0) (CSort +n0)))))) (eq_ind nat (r k0 n) (\lambda (n0: nat).(or (ex2 C (\lambda (e: +C).(eq C (CSort x0) (CTail (Bind b) u1 e))) (\lambda (e: C).(getl (S n) +(CHead c k0 t) (CHead e (Bind b) u1)))) (ex4 nat (\lambda (_: nat).(eq nat (S +n) (s k0 n0))) (\lambda (_: nat).(eq K (Bind b) (Bind b))) (\lambda (_: +nat).(eq T u1 u1)) (\lambda (n1: nat).(eq C (CSort x0) (CSort n1)))))) +(eq_ind_r nat (S n) (\lambda (n0: nat).(or (ex2 C (\lambda (e: C).(eq C +(CSort x0) (CTail (Bind b) u1 e))) (\lambda (e: C).(getl (S n) (CHead c k0 t) +(CHead e (Bind b) u1)))) (ex4 nat (\lambda (_: nat).(eq nat (S n) n0)) +(\lambda (_: nat).(eq K (Bind b) (Bind b))) (\lambda (_: nat).(eq T u1 u1)) +(\lambda (n1: nat).(eq C (CSort x0) (CSort n1)))))) (or_intror (ex2 C +(\lambda (e: C).(eq C (CSort x0) (CTail (Bind b) u1 e))) (\lambda (e: +C).(getl (S n) (CHead c k0 t) (CHead e (Bind b) u1)))) (ex4 nat (\lambda (_: +nat).(eq nat (S n) (S n))) (\lambda (_: nat).(eq K (Bind b) (Bind b))) +(\lambda (_: nat).(eq T u1 u1)) (\lambda (n0: nat).(eq C (CSort x0) (CSort +n0)))) (ex4_intro nat (\lambda (_: nat).(eq nat (S n) (S n))) (\lambda (_: +nat).(eq K (Bind b) (Bind b))) (\lambda (_: nat).(eq T u1 u1)) (\lambda (n0: +nat).(eq C (CSort x0) (CSort n0))) x0 (refl_equal nat (S n)) (refl_equal K +(Bind b)) (refl_equal T u1) (refl_equal C (CSort x0)))) (s k0 (r k0 n)) (s_r +k0 n)) (clen c) H4) k H5))) u2 H6))) c2 H7)))))))) H3)) H2)))))) i)))))) +c1)))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/defs.ma new file mode 100644 index 000000000..f9b4334e1 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/defs.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/cnt/defs". + +include "T/defs.ma". + +inductive cnt: T \to Prop \def +| cnt_sort: \forall (n: nat).(cnt (TSort n)) +| cnt_head: \forall (t: T).((cnt t) \to (\forall (k: K).(\forall (v: T).(cnt +(THead k v t))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/props.ma new file mode 100644 index 000000000..81620ce9e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/props.ma @@ -0,0 +1,36 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/cnt/props". + +include "cnt/defs.ma". + +include "lift/fwd.ma". + +theorem cnt_lift: + \forall (t: T).((cnt t) \to (\forall (i: nat).(\forall (d: nat).(cnt (lift i +d t))))) +\def + \lambda (t: T).(\lambda (H: (cnt t)).(cnt_ind (\lambda (t0: T).(\forall (i: +nat).(\forall (d: nat).(cnt (lift i d t0))))) (\lambda (n: nat).(\lambda (i: +nat).(\lambda (d: nat).(eq_ind_r T (TSort n) (\lambda (t0: T).(cnt t0)) +(cnt_sort n) (lift i d (TSort n)) (lift_sort n i d))))) (\lambda (t0: +T).(\lambda (_: (cnt t0)).(\lambda (H1: ((\forall (i: nat).(\forall (d: +nat).(cnt (lift i d t0)))))).(\lambda (k: K).(\lambda (v: T).(\lambda (i: +nat).(\lambda (d: nat).(eq_ind_r T (THead k (lift i d v) (lift i (s k d) t0)) +(\lambda (t1: T).(cnt t1)) (cnt_head (lift i (s k d) t0) (H1 i (s k d)) k +(lift i d v)) (lift i d (THead k v t0)) (lift_head k v t0 i d))))))))) t H)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/arity.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/arity.ma new file mode 100644 index 000000000..ff9d01c9e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/arity.ma @@ -0,0 +1,219 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csuba/arity". + +include "csuba/getl.ma". + +include "csuba/props.ma". + +include "arity/props.ma". + +include "T/props.ma". + +theorem csuba_arity: + \forall (g: G).(\forall (c1: C).(\forall (t: T).(\forall (a: A).((arity g c1 +t a) \to (\forall (c2: C).((csuba g c1 c2) \to (arity g c2 t a))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c1 t a)).(arity_ind g (\lambda (c: C).(\lambda (t0: T).(\lambda (a0: +A).(\forall (c2: C).((csuba g c c2) \to (arity g c2 t0 a0)))))) (\lambda (c: +C).(\lambda (n: nat).(\lambda (c2: C).(\lambda (_: (csuba g c +c2)).(arity_sort g c2 n))))) (\lambda (c: C).(\lambda (d: C).(\lambda (u: +T).(\lambda (i: nat).(\lambda (H0: (getl i c (CHead d (Bind Abbr) +u))).(\lambda (a0: A).(\lambda (_: (arity g d u a0)).(\lambda (H2: ((\forall +(c2: C).((csuba g d c2) \to (arity g c2 u a0))))).(\lambda (c2: C).(\lambda +(H3: (csuba g c c2)).(let H4 \def (csuba_getl_abbr g c d u i H0 c2 H3) in +(ex2_ind C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u))) (\lambda +(d2: C).(csuba g d d2)) (arity g c2 (TLRef i) a0) (\lambda (x: C).(\lambda +(H5: (getl i c2 (CHead x (Bind Abbr) u))).(\lambda (H6: (csuba g d +x)).(arity_abbr g c2 x u i H5 a0 (H2 x H6))))) H4)))))))))))) (\lambda (c: +C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i c +(CHead d (Bind Abst) u))).(\lambda (a0: A).(\lambda (H1: (arity g d u (asucc +g a0))).(\lambda (H2: ((\forall (c2: C).((csuba g d c2) \to (arity g c2 u +(asucc g a0)))))).(\lambda (c2: C).(\lambda (H3: (csuba g c c2)).(let H4 \def +(csuba_getl_abst g c d u i H0 c2 H3) in (or_ind (ex2 C (\lambda (d2: C).(getl +i c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d d2))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a1: A).(arity g d u (asucc +g a1))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a1: A).(arity g d2 u2 +a1))))) (arity g c2 (TLRef i) a0) (\lambda (H5: (ex2 C (\lambda (d2: C).(getl +i c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d d2)))).(ex2_ind C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: +C).(csuba g d d2)) (arity g c2 (TLRef i) a0) (\lambda (x: C).(\lambda (H6: +(getl i c2 (CHead x (Bind Abst) u))).(\lambda (H7: (csuba g d x)).(arity_abst +g c2 x u i H6 a0 (H2 x H7))))) H5)) (\lambda (H5: (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a1: A).(arity g d u (asucc g a1))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a1: A).(arity g d2 u2 +a1)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(getl i c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a1: A).(arity g d u (asucc g a1))))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a1: A).(arity g d2 u2 a1)))) (arity g c2 (TLRef i) a0) (\lambda +(x0: C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H6: (getl i c2 (CHead x0 +(Bind Abbr) x1))).(\lambda (_: (csuba g d x0)).(\lambda (H8: (arity g d u +(asucc g x2))).(\lambda (H9: (arity g x0 x1 x2)).(arity_repl g c2 (TLRef i) +x2 (arity_abbr g c2 x0 x1 i H6 x2 H9) a0 (asucc_inj g x2 a0 (arity_mono g d u +(asucc g x2) H8 (asucc g a0) H1)))))))))) H5)) H4)))))))))))) (\lambda (b: +B).(\lambda (H0: (not (eq B b Abst))).(\lambda (c: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c u a1)).(\lambda (H2: ((\forall +(c2: C).((csuba g c c2) \to (arity g c2 u a1))))).(\lambda (t0: T).(\lambda +(a2: A).(\lambda (_: (arity g (CHead c (Bind b) u) t0 a2)).(\lambda (H4: +((\forall (c2: C).((csuba g (CHead c (Bind b) u) c2) \to (arity g c2 t0 +a2))))).(\lambda (c2: C).(\lambda (H5: (csuba g c c2)).(arity_bind g b H0 c2 +u a1 (H2 c2 H5) t0 a2 (H4 (CHead c2 (Bind b) u) (csuba_head g c c2 H5 (Bind +b) u)))))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (a1: +A).(\lambda (_: (arity g c u (asucc g a1))).(\lambda (H1: ((\forall (c2: +C).((csuba g c c2) \to (arity g c2 u (asucc g a1)))))).(\lambda (t0: +T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c (Bind Abst) u) t0 +a2)).(\lambda (H3: ((\forall (c2: C).((csuba g (CHead c (Bind Abst) u) c2) +\to (arity g c2 t0 a2))))).(\lambda (c2: C).(\lambda (H4: (csuba g c +c2)).(arity_head g c2 u a1 (H1 c2 H4) t0 a2 (H3 (CHead c2 (Bind Abst) u) +(csuba_head g c c2 H4 (Bind Abst) u)))))))))))))) (\lambda (c: C).(\lambda +(u: T).(\lambda (a1: A).(\lambda (_: (arity g c u a1)).(\lambda (H1: +((\forall (c2: C).((csuba g c c2) \to (arity g c2 u a1))))).(\lambda (t0: +T).(\lambda (a2: A).(\lambda (_: (arity g c t0 (AHead a1 a2))).(\lambda (H3: +((\forall (c2: C).((csuba g c c2) \to (arity g c2 t0 (AHead a1 +a2)))))).(\lambda (c2: C).(\lambda (H4: (csuba g c c2)).(arity_appl g c2 u a1 +(H1 c2 H4) t0 a2 (H3 c2 H4))))))))))))) (\lambda (c: C).(\lambda (u: +T).(\lambda (a0: A).(\lambda (_: (arity g c u (asucc g a0))).(\lambda (H1: +((\forall (c2: C).((csuba g c c2) \to (arity g c2 u (asucc g +a0)))))).(\lambda (t0: T).(\lambda (_: (arity g c t0 a0)).(\lambda (H3: +((\forall (c2: C).((csuba g c c2) \to (arity g c2 t0 a0))))).(\lambda (c2: +C).(\lambda (H4: (csuba g c c2)).(arity_cast g c2 u a0 (H1 c2 H4) t0 (H3 c2 +H4)))))))))))) (\lambda (c: C).(\lambda (t0: T).(\lambda (a1: A).(\lambda (_: +(arity g c t0 a1)).(\lambda (H1: ((\forall (c2: C).((csuba g c c2) \to (arity +g c2 t0 a1))))).(\lambda (a2: A).(\lambda (H2: (leq g a1 a2)).(\lambda (c2: +C).(\lambda (H3: (csuba g c c2)).(arity_repl g c2 t0 a1 (H1 c2 H3) a2 +H2)))))))))) c1 t a H))))). + +theorem csuba_arity_rev: + \forall (g: G).(\forall (c1: C).(\forall (t: T).(\forall (a: A).((arity g c1 +t a) \to (\forall (c2: C).((csuba g c2 c1) \to (arity g c2 t a))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c1 t a)).(arity_ind g (\lambda (c: C).(\lambda (t0: T).(\lambda (a0: +A).(\forall (c2: C).((csuba g c2 c) \to (arity g c2 t0 a0)))))) (\lambda (c: +C).(\lambda (n: nat).(\lambda (c2: C).(\lambda (_: (csuba g c2 +c)).(arity_sort g c2 n))))) (\lambda (c: C).(\lambda (d: C).(\lambda (u: +T).(\lambda (i: nat).(\lambda (H0: (getl i c (CHead d (Bind Abbr) +u))).(\lambda (a0: A).(\lambda (H1: (arity g d u a0)).(\lambda (H2: ((\forall +(c2: C).((csuba g c2 d) \to (arity g c2 u a0))))).(\lambda (c2: C).(\lambda +(H3: (csuba g c2 c)).(let H4 \def (csuba_getl_abbr_rev g c d u i H0 c2 H3) in +(or_ind (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u))) +(\lambda (d2: C).(csuba g d2 d))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a1: A).(arity g d2 u2 (asucc g a1))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a1: A).(arity g d u a1))))) (arity g c2 +(TLRef i) a0) (\lambda (H5: (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 +(Bind Abbr) u))) (\lambda (d2: C).(csuba g d2 d)))).(ex2_ind C (\lambda (d2: +C).(getl i c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d2 d)) +(arity g c2 (TLRef i) a0) (\lambda (x: C).(\lambda (H6: (getl i c2 (CHead x +(Bind Abbr) u))).(\lambda (H7: (csuba g x d)).(arity_abbr g c2 x u i H6 a0 +(H2 x H7))))) H5)) (\lambda (H5: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a1: A).(arity g d2 u2 (asucc g a1))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a1: A).(arity g d u a1)))))).(ex4_3_ind C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a1: A).(arity g d2 u2 +(asucc g a1))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a1: A).(arity g d +u a1)))) (arity g c2 (TLRef i) a0) (\lambda (x0: C).(\lambda (x1: T).(\lambda +(x2: A).(\lambda (H6: (getl i c2 (CHead x0 (Bind Abst) x1))).(\lambda (_: +(csuba g x0 d)).(\lambda (H8: (arity g x0 x1 (asucc g x2))).(\lambda (H9: +(arity g d u x2)).(arity_repl g c2 (TLRef i) x2 (arity_abst g c2 x0 x1 i H6 +x2 H8) a0 (arity_mono g d u x2 H9 a0 H1))))))))) H5)) H4)))))))))))) (\lambda +(c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl +i c (CHead d (Bind Abst) u))).(\lambda (a0: A).(\lambda (_: (arity g d u +(asucc g a0))).(\lambda (H2: ((\forall (c2: C).((csuba g c2 d) \to (arity g +c2 u (asucc g a0)))))).(\lambda (c2: C).(\lambda (H3: (csuba g c2 c)).(let H4 +\def (csuba_getl_abst_rev g c d u i H0 c2 H3) in (ex2_ind C (\lambda (d2: +C).(getl i c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d)) +(arity g c2 (TLRef i) a0) (\lambda (x: C).(\lambda (H5: (getl i c2 (CHead x +(Bind Abst) u))).(\lambda (H6: (csuba g x d)).(arity_abst g c2 x u i H5 a0 +(H2 x H6))))) H4)))))))))))) (\lambda (b: B).(\lambda (H0: (not (eq B b +Abst))).(\lambda (c: C).(\lambda (u: T).(\lambda (a1: A).(\lambda (_: (arity +g c u a1)).(\lambda (H2: ((\forall (c2: C).((csuba g c2 c) \to (arity g c2 u +a1))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c +(Bind b) u) t0 a2)).(\lambda (H4: ((\forall (c2: C).((csuba g c2 (CHead c +(Bind b) u)) \to (arity g c2 t0 a2))))).(\lambda (c2: C).(\lambda (H5: (csuba +g c2 c)).(arity_bind g b H0 c2 u a1 (H2 c2 H5) t0 a2 (H4 (CHead c2 (Bind b) +u) (csuba_head g c2 c H5 (Bind b) u)))))))))))))))) (\lambda (c: C).(\lambda +(u: T).(\lambda (a1: A).(\lambda (_: (arity g c u (asucc g a1))).(\lambda +(H1: ((\forall (c2: C).((csuba g c2 c) \to (arity g c2 u (asucc g +a1)))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c +(Bind Abst) u) t0 a2)).(\lambda (H3: ((\forall (c2: C).((csuba g c2 (CHead c +(Bind Abst) u)) \to (arity g c2 t0 a2))))).(\lambda (c2: C).(\lambda (H4: +(csuba g c2 c)).(arity_head g c2 u a1 (H1 c2 H4) t0 a2 (H3 (CHead c2 (Bind +Abst) u) (csuba_head g c2 c H4 (Bind Abst) u)))))))))))))) (\lambda (c: +C).(\lambda (u: T).(\lambda (a1: A).(\lambda (_: (arity g c u a1)).(\lambda +(H1: ((\forall (c2: C).((csuba g c2 c) \to (arity g c2 u a1))))).(\lambda +(t0: T).(\lambda (a2: A).(\lambda (_: (arity g c t0 (AHead a1 a2))).(\lambda +(H3: ((\forall (c2: C).((csuba g c2 c) \to (arity g c2 t0 (AHead a1 +a2)))))).(\lambda (c2: C).(\lambda (H4: (csuba g c2 c)).(arity_appl g c2 u a1 +(H1 c2 H4) t0 a2 (H3 c2 H4))))))))))))) (\lambda (c: C).(\lambda (u: +T).(\lambda (a0: A).(\lambda (_: (arity g c u (asucc g a0))).(\lambda (H1: +((\forall (c2: C).((csuba g c2 c) \to (arity g c2 u (asucc g +a0)))))).(\lambda (t0: T).(\lambda (_: (arity g c t0 a0)).(\lambda (H3: +((\forall (c2: C).((csuba g c2 c) \to (arity g c2 t0 a0))))).(\lambda (c2: +C).(\lambda (H4: (csuba g c2 c)).(arity_cast g c2 u a0 (H1 c2 H4) t0 (H3 c2 +H4)))))))))))) (\lambda (c: C).(\lambda (t0: T).(\lambda (a1: A).(\lambda (_: +(arity g c t0 a1)).(\lambda (H1: ((\forall (c2: C).((csuba g c2 c) \to (arity +g c2 t0 a1))))).(\lambda (a2: A).(\lambda (H2: (leq g a1 a2)).(\lambda (c2: +C).(\lambda (H3: (csuba g c2 c)).(arity_repl g c2 t0 a1 (H1 c2 H3) a2 +H2)))))))))) c1 t a H))))). + +theorem arity_appls_appl: + \forall (g: G).(\forall (c: C).(\forall (v: T).(\forall (a1: A).((arity g c +v a1) \to (\forall (u: T).((arity g c u (asucc g a1)) \to (\forall (t: +T).(\forall (vs: TList).(\forall (a2: A).((arity g c (THeads (Flat Appl) vs +(THead (Bind Abbr) v t)) a2) \to (arity g c (THeads (Flat Appl) vs (THead +(Flat Appl) v (THead (Bind Abst) u t))) a2))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (v: T).(\lambda (a1: A).(\lambda (H: +(arity g c v a1)).(\lambda (u: T).(\lambda (H0: (arity g c u (asucc g +a1))).(\lambda (t: T).(\lambda (vs: TList).(TList_ind (\lambda (t0: +TList).(\forall (a2: A).((arity g c (THeads (Flat Appl) t0 (THead (Bind Abbr) +v t)) a2) \to (arity g c (THeads (Flat Appl) t0 (THead (Flat Appl) v (THead +(Bind Abst) u t))) a2)))) (\lambda (a2: A).(\lambda (H1: (arity g c (THead +(Bind Abbr) v t) a2)).(let H_x \def (arity_gen_bind Abbr (\lambda (H2: (eq B +Abbr Abst)).(not_abbr_abst H2)) g c v t a2 H1) in (let H2 \def H_x in +(ex2_ind A (\lambda (a3: A).(arity g c v a3)) (\lambda (_: A).(arity g (CHead +c (Bind Abbr) v) t a2)) (arity g c (THead (Flat Appl) v (THead (Bind Abst) u +t)) a2) (\lambda (x: A).(\lambda (_: (arity g c v x)).(\lambda (H4: (arity g +(CHead c (Bind Abbr) v) t a2)).(arity_appl g c v a1 H (THead (Bind Abst) u t) +a2 (arity_head g c u a1 H0 t a2 (csuba_arity_rev g (CHead c (Bind Abbr) v) t +a2 H4 (CHead c (Bind Abst) u) (csuba_abst g c c (csuba_refl g c) u a1 H0 v +H))))))) H2))))) (\lambda (t0: T).(\lambda (t1: TList).(\lambda (H1: +((\forall (a2: A).((arity g c (THeads (Flat Appl) t1 (THead (Bind Abbr) v t)) +a2) \to (arity g c (THeads (Flat Appl) t1 (THead (Flat Appl) v (THead (Bind +Abst) u t))) a2))))).(\lambda (a2: A).(\lambda (H2: (arity g c (THead (Flat +Appl) t0 (THeads (Flat Appl) t1 (THead (Bind Abbr) v t))) a2)).(let H3 \def +(arity_gen_appl g c t0 (THeads (Flat Appl) t1 (THead (Bind Abbr) v t)) a2 H2) +in (ex2_ind A (\lambda (a3: A).(arity g c t0 a3)) (\lambda (a3: A).(arity g c +(THeads (Flat Appl) t1 (THead (Bind Abbr) v t)) (AHead a3 a2))) (arity g c +(THead (Flat Appl) t0 (THeads (Flat Appl) t1 (THead (Flat Appl) v (THead +(Bind Abst) u t)))) a2) (\lambda (x: A).(\lambda (H4: (arity g c t0 +x)).(\lambda (H5: (arity g c (THeads (Flat Appl) t1 (THead (Bind Abbr) v t)) +(AHead x a2))).(arity_appl g c t0 x H4 (THeads (Flat Appl) t1 (THead (Flat +Appl) v (THead (Bind Abst) u t))) a2 (H1 (AHead x a2) H5))))) H3))))))) +vs))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/clear.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/clear.ma new file mode 100644 index 000000000..036ca2882 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/clear.ma @@ -0,0 +1,104 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csuba/clear". + +include "csuba/defs.ma". + +include "clear/fwd.ma". + +theorem csuba_clear_conf: + \forall (g: G).(\forall (c1: C).(\forall (c2: C).((csuba g c1 c2) \to +(\forall (e1: C).((clear c1 e1) \to (ex2 C (\lambda (e2: C).(csuba g e1 e2)) +(\lambda (e2: C).(clear c2 e2)))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (csuba g c1 +c2)).(csuba_ind g (\lambda (c: C).(\lambda (c0: C).(\forall (e1: C).((clear c +e1) \to (ex2 C (\lambda (e2: C).(csuba g e1 e2)) (\lambda (e2: C).(clear c0 +e2))))))) (\lambda (n: nat).(\lambda (e1: C).(\lambda (H0: (clear (CSort n) +e1)).(clear_gen_sort e1 n H0 (ex2 C (\lambda (e2: C).(csuba g e1 e2)) +(\lambda (e2: C).(clear (CSort n) e2))))))) (\lambda (c3: C).(\lambda (c4: +C).(\lambda (H0: (csuba g c3 c4)).(\lambda (H1: ((\forall (e1: C).((clear c3 +e1) \to (ex2 C (\lambda (e2: C).(csuba g e1 e2)) (\lambda (e2: C).(clear c4 +e2))))))).(\lambda (k: K).(\lambda (u: T).(\lambda (e1: C).(\lambda (H2: +(clear (CHead c3 k u) e1)).(K_ind (\lambda (k0: K).((clear (CHead c3 k0 u) +e1) \to (ex2 C (\lambda (e2: C).(csuba g e1 e2)) (\lambda (e2: C).(clear +(CHead c4 k0 u) e2))))) (\lambda (b: B).(\lambda (H3: (clear (CHead c3 (Bind +b) u) e1)).(eq_ind_r C (CHead c3 (Bind b) u) (\lambda (c: C).(ex2 C (\lambda +(e2: C).(csuba g c e2)) (\lambda (e2: C).(clear (CHead c4 (Bind b) u) e2)))) +(ex_intro2 C (\lambda (e2: C).(csuba g (CHead c3 (Bind b) u) e2)) (\lambda +(e2: C).(clear (CHead c4 (Bind b) u) e2)) (CHead c4 (Bind b) u) (csuba_head g +c3 c4 H0 (Bind b) u) (clear_bind b c4 u)) e1 (clear_gen_bind b c3 e1 u H3)))) +(\lambda (f: F).(\lambda (H3: (clear (CHead c3 (Flat f) u) e1)).(let H4 \def +(H1 e1 (clear_gen_flat f c3 e1 u H3)) in (ex2_ind C (\lambda (e2: C).(csuba g +e1 e2)) (\lambda (e2: C).(clear c4 e2)) (ex2 C (\lambda (e2: C).(csuba g e1 +e2)) (\lambda (e2: C).(clear (CHead c4 (Flat f) u) e2))) (\lambda (x: +C).(\lambda (H5: (csuba g e1 x)).(\lambda (H6: (clear c4 x)).(ex_intro2 C +(\lambda (e2: C).(csuba g e1 e2)) (\lambda (e2: C).(clear (CHead c4 (Flat f) +u) e2)) x H5 (clear_flat c4 x H6 f u))))) H4)))) k H2))))))))) (\lambda (c3: +C).(\lambda (c4: C).(\lambda (H0: (csuba g c3 c4)).(\lambda (_: ((\forall +(e1: C).((clear c3 e1) \to (ex2 C (\lambda (e2: C).(csuba g e1 e2)) (\lambda +(e2: C).(clear c4 e2))))))).(\lambda (t: T).(\lambda (a: A).(\lambda (H2: +(arity g c3 t (asucc g a))).(\lambda (u: T).(\lambda (H3: (arity g c4 u +a)).(\lambda (e1: C).(\lambda (H4: (clear (CHead c3 (Bind Abst) t) +e1)).(eq_ind_r C (CHead c3 (Bind Abst) t) (\lambda (c: C).(ex2 C (\lambda +(e2: C).(csuba g c e2)) (\lambda (e2: C).(clear (CHead c4 (Bind Abbr) u) +e2)))) (ex_intro2 C (\lambda (e2: C).(csuba g (CHead c3 (Bind Abst) t) e2)) +(\lambda (e2: C).(clear (CHead c4 (Bind Abbr) u) e2)) (CHead c4 (Bind Abbr) +u) (csuba_abst g c3 c4 H0 t a H2 u H3) (clear_bind Abbr c4 u)) e1 +(clear_gen_bind Abst c3 e1 t H4))))))))))))) c1 c2 H)))). + +theorem csuba_clear_trans: + \forall (g: G).(\forall (c1: C).(\forall (c2: C).((csuba g c2 c1) \to +(\forall (e1: C).((clear c1 e1) \to (ex2 C (\lambda (e2: C).(csuba g e2 e1)) +(\lambda (e2: C).(clear c2 e2)))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (csuba g c2 +c1)).(csuba_ind g (\lambda (c: C).(\lambda (c0: C).(\forall (e1: C).((clear +c0 e1) \to (ex2 C (\lambda (e2: C).(csuba g e2 e1)) (\lambda (e2: C).(clear c +e2))))))) (\lambda (n: nat).(\lambda (e1: C).(\lambda (H0: (clear (CSort n) +e1)).(clear_gen_sort e1 n H0 (ex2 C (\lambda (e2: C).(csuba g e2 e1)) +(\lambda (e2: C).(clear (CSort n) e2))))))) (\lambda (c3: C).(\lambda (c4: +C).(\lambda (H0: (csuba g c3 c4)).(\lambda (H1: ((\forall (e1: C).((clear c4 +e1) \to (ex2 C (\lambda (e2: C).(csuba g e2 e1)) (\lambda (e2: C).(clear c3 +e2))))))).(\lambda (k: K).(\lambda (u: T).(\lambda (e1: C).(\lambda (H2: +(clear (CHead c4 k u) e1)).(K_ind (\lambda (k0: K).((clear (CHead c4 k0 u) +e1) \to (ex2 C (\lambda (e2: C).(csuba g e2 e1)) (\lambda (e2: C).(clear +(CHead c3 k0 u) e2))))) (\lambda (b: B).(\lambda (H3: (clear (CHead c4 (Bind +b) u) e1)).(eq_ind_r C (CHead c4 (Bind b) u) (\lambda (c: C).(ex2 C (\lambda +(e2: C).(csuba g e2 c)) (\lambda (e2: C).(clear (CHead c3 (Bind b) u) e2)))) +(ex_intro2 C (\lambda (e2: C).(csuba g e2 (CHead c4 (Bind b) u))) (\lambda +(e2: C).(clear (CHead c3 (Bind b) u) e2)) (CHead c3 (Bind b) u) (csuba_head g +c3 c4 H0 (Bind b) u) (clear_bind b c3 u)) e1 (clear_gen_bind b c4 e1 u H3)))) +(\lambda (f: F).(\lambda (H3: (clear (CHead c4 (Flat f) u) e1)).(let H4 \def +(H1 e1 (clear_gen_flat f c4 e1 u H3)) in (ex2_ind C (\lambda (e2: C).(csuba g +e2 e1)) (\lambda (e2: C).(clear c3 e2)) (ex2 C (\lambda (e2: C).(csuba g e2 +e1)) (\lambda (e2: C).(clear (CHead c3 (Flat f) u) e2))) (\lambda (x: +C).(\lambda (H5: (csuba g x e1)).(\lambda (H6: (clear c3 x)).(ex_intro2 C +(\lambda (e2: C).(csuba g e2 e1)) (\lambda (e2: C).(clear (CHead c3 (Flat f) +u) e2)) x H5 (clear_flat c3 x H6 f u))))) H4)))) k H2))))))))) (\lambda (c3: +C).(\lambda (c4: C).(\lambda (H0: (csuba g c3 c4)).(\lambda (_: ((\forall +(e1: C).((clear c4 e1) \to (ex2 C (\lambda (e2: C).(csuba g e2 e1)) (\lambda +(e2: C).(clear c3 e2))))))).(\lambda (t: T).(\lambda (a: A).(\lambda (H2: +(arity g c3 t (asucc g a))).(\lambda (u: T).(\lambda (H3: (arity g c4 u +a)).(\lambda (e1: C).(\lambda (H4: (clear (CHead c4 (Bind Abbr) u) +e1)).(eq_ind_r C (CHead c4 (Bind Abbr) u) (\lambda (c: C).(ex2 C (\lambda +(e2: C).(csuba g e2 c)) (\lambda (e2: C).(clear (CHead c3 (Bind Abst) t) +e2)))) (ex_intro2 C (\lambda (e2: C).(csuba g e2 (CHead c4 (Bind Abbr) u))) +(\lambda (e2: C).(clear (CHead c3 (Bind Abst) t) e2)) (CHead c3 (Bind Abst) +t) (csuba_abst g c3 c4 H0 t a H2 u H3) (clear_bind Abst c3 t)) e1 +(clear_gen_bind Abbr c4 e1 u H4))))))))))))) c2 c1 H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/defs.ma new file mode 100644 index 000000000..1b8612a2f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/defs.ma @@ -0,0 +1,29 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csuba/defs". + +include "arity/defs.ma". + +inductive csuba (g: G): C \to (C \to Prop) \def +| csuba_sort: \forall (n: nat).(csuba g (CSort n) (CSort n)) +| csuba_head: \forall (c1: C).(\forall (c2: C).((csuba g c1 c2) \to (\forall +(k: K).(\forall (u: T).(csuba g (CHead c1 k u) (CHead c2 k u)))))) +| csuba_abst: \forall (c1: C).(\forall (c2: C).((csuba g c1 c2) \to (\forall +(t: T).(\forall (a: A).((arity g c1 t (asucc g a)) \to (\forall (u: +T).((arity g c2 u a) \to (csuba g (CHead c1 (Bind Abst) t) (CHead c2 (Bind +Abbr) u))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/drop.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/drop.ma new file mode 100644 index 000000000..003b18a5e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/drop.ma @@ -0,0 +1,1608 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csuba/drop". + +include "csuba/fwd.ma". + +include "drop/fwd.ma". + +theorem csuba_drop_abbr: + \forall (i: nat).(\forall (c1: C).(\forall (d1: C).(\forall (u: T).((drop i +O c1 (CHead d1 (Bind Abbr) u)) \to (\forall (g: G).(\forall (c2: C).((csuba g +c1 c2) \to (ex2 C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind Abbr) u))) +(\lambda (d2: C).(csuba g d1 d2)))))))))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (c1: C).(\forall (d1: +C).(\forall (u: T).((drop n O c1 (CHead d1 (Bind Abbr) u)) \to (\forall (g: +G).(\forall (c2: C).((csuba g c1 c2) \to (ex2 C (\lambda (d2: C).(drop n O c2 +(CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))))))))))) +(\lambda (c1: C).(\lambda (d1: C).(\lambda (u: T).(\lambda (H: (drop O O c1 +(CHead d1 (Bind Abbr) u))).(\lambda (g: G).(\lambda (c2: C).(\lambda (H0: +(csuba g c1 c2)).(let H1 \def (eq_ind C c1 (\lambda (c: C).(csuba g c c2)) H0 +(CHead d1 (Bind Abbr) u) (drop_gen_refl c1 (CHead d1 (Bind Abbr) u) H)) in +(let H_x \def (csuba_gen_abbr g d1 c2 u H1) in (let H2 \def H_x in (ex2_ind C +(\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba +g d1 d2)) (ex2 C (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abbr) u))) +(\lambda (d2: C).(csuba g d1 d2))) (\lambda (x: C).(\lambda (H3: (eq C c2 +(CHead x (Bind Abbr) u))).(\lambda (H4: (csuba g d1 x)).(eq_ind_r C (CHead x +(Bind Abbr) u) (\lambda (c: C).(ex2 C (\lambda (d2: C).(drop O O c (CHead d2 +(Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)))) (ex_intro2 C (\lambda +(d2: C).(drop O O (CHead x (Bind Abbr) u) (CHead d2 (Bind Abbr) u))) (\lambda +(d2: C).(csuba g d1 d2)) x (drop_refl (CHead x (Bind Abbr) u)) H4) c2 H3)))) +H2))))))))))) (\lambda (n: nat).(\lambda (H: ((\forall (c1: C).(\forall (d1: +C).(\forall (u: T).((drop n O c1 (CHead d1 (Bind Abbr) u)) \to (\forall (g: +G).(\forall (c2: C).((csuba g c1 c2) \to (ex2 C (\lambda (d2: C).(drop n O c2 +(CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 +d2)))))))))))).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (d1: +C).(\forall (u: T).((drop (S n) O c (CHead d1 (Bind Abbr) u)) \to (\forall +(g: G).(\forall (c2: C).((csuba g c c2) \to (ex2 C (\lambda (d2: C).(drop (S +n) O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)))))))))) +(\lambda (n0: nat).(\lambda (d1: C).(\lambda (u: T).(\lambda (H0: (drop (S n) +O (CSort n0) (CHead d1 (Bind Abbr) u))).(\lambda (g: G).(\lambda (c2: +C).(\lambda (_: (csuba g (CSort n0) c2)).(and3_ind (eq C (CHead d1 (Bind +Abbr) u) (CSort n0)) (eq nat (S n) O) (eq nat O O) (ex2 C (\lambda (d2: +C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 +d2))) (\lambda (H2: (eq C (CHead d1 (Bind Abbr) u) (CSort n0))).(\lambda (_: +(eq nat (S n) O)).(\lambda (_: (eq nat O O)).(let H5 \def (match H2 in eq +return (\lambda (c: C).(\lambda (_: (eq ? ? c)).((eq C c (CSort n0)) \to (ex2 +C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2)))))) with [refl_equal \Rightarrow (\lambda (H5: (eq C +(CHead d1 (Bind Abbr) u) (CSort n0))).(let H6 \def (eq_ind C (CHead d1 (Bind +Abbr) u) (\lambda (e: C).(match e in C return (\lambda (_: C).Prop) with +[(CSort _) \Rightarrow False | (CHead _ _ _) \Rightarrow True])) I (CSort n0) +H5) in (False_ind (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) H6)))]) in (H5 (refl_equal C +(CSort n0))))))) (drop_gen_sort n0 (S n) O (CHead d1 (Bind Abbr) u) +H0))))))))) (\lambda (c: C).(\lambda (H0: ((\forall (d1: C).(\forall (u: +T).((drop (S n) O c (CHead d1 (Bind Abbr) u)) \to (\forall (g: G).(\forall +(c2: C).((csuba g c c2) \to (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead +d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))))))))))).(\lambda (k: +K).(\lambda (t: T).(\lambda (d1: C).(\lambda (u: T).(\lambda (H1: (drop (S n) +O (CHead c k t) (CHead d1 (Bind Abbr) u))).(\lambda (g: G).(\lambda (c2: +C).(\lambda (H2: (csuba g (CHead c k t) c2)).(K_ind (\lambda (k0: K).((csuba +g (CHead c k0 t) c2) \to ((drop (r k0 n) O c (CHead d1 (Bind Abbr) u)) \to +(ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u))) (\lambda +(d2: C).(csuba g d1 d2)))))) (\lambda (b: B).(\lambda (H3: (csuba g (CHead c +(Bind b) t) c2)).(\lambda (H4: (drop (r (Bind b) n) O c (CHead d1 (Bind Abbr) +u))).(B_ind (\lambda (b0: B).((csuba g (CHead c (Bind b0) t) c2) \to ((drop +(r (Bind b0) n) O c (CHead d1 (Bind Abbr) u)) \to (ex2 C (\lambda (d2: +C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 +d2)))))) (\lambda (H5: (csuba g (CHead c (Bind Abbr) t) c2)).(\lambda (H6: +(drop (r (Bind Abbr) n) O c (CHead d1 (Bind Abbr) u))).(let H_x \def +(csuba_gen_abbr g c c2 t H5) in (let H7 \def H_x in (ex2_ind C (\lambda (d2: +C).(eq C c2 (CHead d2 (Bind Abbr) t))) (\lambda (d2: C).(csuba g c d2)) (ex2 +C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2))) (\lambda (x: C).(\lambda (H8: (eq C c2 (CHead x (Bind +Abbr) t))).(\lambda (H9: (csuba g c x)).(eq_ind_r C (CHead x (Bind Abbr) t) +(\lambda (c0: C).(ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)))) (let H10 \def (H c d1 u H6 g x +H9) in (ex2_ind C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abbr) u))) +(\lambda (d2: C).(csuba g d1 d2)) (ex2 C (\lambda (d2: C).(drop (S n) O +(CHead x (Bind Abbr) t) (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g +d1 d2))) (\lambda (x0: C).(\lambda (H11: (drop n O x (CHead x0 (Bind Abbr) +u))).(\lambda (H12: (csuba g d1 x0)).(let H13 \def (refl_equal nat (r (Bind +Abbr) n)) in (let H14 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x +(CHead x0 (Bind Abbr) u))) H11 (r (Bind Abbr) n) H13) in (ex_intro2 C +(\lambda (d2: C).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind Abbr) +u))) (\lambda (d2: C).(csuba g d1 d2)) x0 (drop_drop (Bind Abbr) n x (CHead +x0 (Bind Abbr) u) H14 t) H12)))))) H10)) c2 H8)))) H7))))) (\lambda (H5: +(csuba g (CHead c (Bind Abst) t) c2)).(\lambda (H6: (drop (r (Bind Abst) n) O +c (CHead d1 (Bind Abbr) u))).(let H_x \def (csuba_gen_abst g c c2 t H5) in +(let H7 \def H_x in (or_ind (ex2 C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind +Abst) t))) (\lambda (d2: C).(csuba g c d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g c d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g c t (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2))) (\lambda (H8: (ex2 C (\lambda (d2: C).(eq C c2 (CHead d2 +(Bind Abst) t))) (\lambda (d2: C).(csuba g c d2)))).(ex2_ind C (\lambda (d2: +C).(eq C c2 (CHead d2 (Bind Abst) t))) (\lambda (d2: C).(csuba g c d2)) (ex2 +C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2))) (\lambda (x: C).(\lambda (H9: (eq C c2 (CHead x (Bind +Abst) t))).(\lambda (H10: (csuba g c x)).(eq_ind_r C (CHead x (Bind Abst) t) +(\lambda (c0: C).(ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)))) (let H11 \def (H c d1 u H6 g x +H10) in (ex2_ind C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abbr) u))) +(\lambda (d2: C).(csuba g d1 d2)) (ex2 C (\lambda (d2: C).(drop (S n) O +(CHead x (Bind Abst) t) (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g +d1 d2))) (\lambda (x0: C).(\lambda (H12: (drop n O x (CHead x0 (Bind Abbr) +u))).(\lambda (H13: (csuba g d1 x0)).(let H14 \def (refl_equal nat (r (Bind +Abbr) n)) in (let H15 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x +(CHead x0 (Bind Abbr) u))) H12 (r (Bind Abbr) n) H14) in (ex_intro2 C +(\lambda (d2: C).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abbr) +u))) (\lambda (d2: C).(csuba g d1 d2)) x0 (drop_drop (Bind Abst) n x (CHead +x0 (Bind Abbr) u) H15 t) H13)))))) H11)) c2 H9)))) H8)) (\lambda (H8: (ex4_3 +C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +c d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g c t (asucc +g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(eq C c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g c d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g c t (asucc g a))))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 a)))) (ex2 C (\lambda (d2: C).(drop (S n) O +c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) (\lambda +(x0: C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H9: (eq C c2 (CHead x0 +(Bind Abbr) x1))).(\lambda (H10: (csuba g c x0)).(\lambda (_: (arity g c t +(asucc g x2))).(\lambda (_: (arity g x0 x1 x2)).(eq_ind_r C (CHead x0 (Bind +Abbr) x1) (\lambda (c0: C).(ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead d2 +(Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)))) (let H13 \def (H c d1 u +H6 g x0 H10) in (ex2_ind C (\lambda (d2: C).(drop n O x0 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)) (ex2 C (\lambda (d2: C).(drop (S +n) O (CHead x0 (Bind Abbr) x1) (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2))) (\lambda (x: C).(\lambda (H14: (drop n O x0 (CHead x +(Bind Abbr) u))).(\lambda (H15: (csuba g d1 x)).(let H16 \def (refl_equal nat +(r (Bind Abbr) n)) in (let H17 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 +O x0 (CHead x (Bind Abbr) u))) H14 (r (Bind Abbr) n) H16) in (ex_intro2 C +(\lambda (d2: C).(drop (S n) O (CHead x0 (Bind Abbr) x1) (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)) x (drop_drop (Bind Abbr) n x0 +(CHead x (Bind Abbr) u) H17 x1) H15)))))) H13)) c2 H9)))))))) H8)) H7))))) +(\lambda (H5: (csuba g (CHead c (Bind Void) t) c2)).(\lambda (H6: (drop (r +(Bind Void) n) O c (CHead d1 (Bind Abbr) u))).(let H_x \def (csuba_gen_void g +c c2 t H5) in (let H7 \def H_x in (ex2_ind C (\lambda (d2: C).(eq C c2 (CHead +d2 (Bind Void) t))) (\lambda (d2: C).(csuba g c d2)) (ex2 C (\lambda (d2: +C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 +d2))) (\lambda (x: C).(\lambda (H8: (eq C c2 (CHead x (Bind Void) +t))).(\lambda (H9: (csuba g c x)).(eq_ind_r C (CHead x (Bind Void) t) +(\lambda (c0: C).(ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)))) (let H10 \def (H c d1 u H6 g x +H9) in (ex2_ind C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abbr) u))) +(\lambda (d2: C).(csuba g d1 d2)) (ex2 C (\lambda (d2: C).(drop (S n) O +(CHead x (Bind Void) t) (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g +d1 d2))) (\lambda (x0: C).(\lambda (H11: (drop n O x (CHead x0 (Bind Abbr) +u))).(\lambda (H12: (csuba g d1 x0)).(let H13 \def (refl_equal nat (r (Bind +Abbr) n)) in (let H14 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x +(CHead x0 (Bind Abbr) u))) H11 (r (Bind Abbr) n) H13) in (ex_intro2 C +(\lambda (d2: C).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abbr) +u))) (\lambda (d2: C).(csuba g d1 d2)) x0 (drop_drop (Bind Void) n x (CHead +x0 (Bind Abbr) u) H14 t) H12)))))) H10)) c2 H8)))) H7))))) b H3 H4)))) +(\lambda (f: F).(\lambda (H3: (csuba g (CHead c (Flat f) t) c2)).(\lambda +(H4: (drop (r (Flat f) n) O c (CHead d1 (Bind Abbr) u))).(let H_x \def +(csuba_gen_flat g c c2 t f H3) in (let H5 \def H_x in (ex2_2_ind C T (\lambda +(d2: C).(\lambda (u2: T).(eq C c2 (CHead d2 (Flat f) u2)))) (\lambda (d2: +C).(\lambda (_: T).(csuba g c d2))) (ex2 C (\lambda (d2: C).(drop (S n) O c2 +(CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (H6: (eq C c2 (CHead x0 (Flat f) x1))).(\lambda +(H7: (csuba g c x0)).(eq_ind_r C (CHead x0 (Flat f) x1) (\lambda (c0: C).(ex2 +C (\lambda (d2: C).(drop (S n) O c0 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2)))) (let H8 \def (H0 d1 u H4 g x0 H7) in (ex2_ind C +(\lambda (d2: C).(drop (S n) O x0 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2)) (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Flat f) +x1) (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) (\lambda +(x: C).(\lambda (H9: (drop (S n) O x0 (CHead x (Bind Abbr) u))).(\lambda +(H10: (csuba g d1 x)).(ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead x0 +(Flat f) x1) (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)) x +(drop_drop (Flat f) n x0 (CHead x (Bind Abbr) u) H9 x1) H10)))) H8)) c2 +H6))))) H5)))))) k H2 (drop_gen_drop k c (CHead d1 (Bind Abbr) u) t n +H1)))))))))))) c1)))) i). + +theorem csuba_drop_abst: + \forall (i: nat).(\forall (c1: C).(\forall (d1: C).(\forall (u1: T).((drop i +O c1 (CHead d1 (Bind Abst) u1)) \to (\forall (g: G).(\forall (c2: C).((csuba +g c1 c2) \to (or (ex2 C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind Abst) +u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop i O c2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))))))))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (c1: C).(\forall (d1: +C).(\forall (u1: T).((drop n O c1 (CHead d1 (Bind Abst) u1)) \to (\forall (g: +G).(\forall (c2: C).((csuba g c1 c2) \to (or (ex2 C (\lambda (d2: C).(drop n +O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O c2 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))))))))))))) (\lambda (c1: C).(\lambda (d1: C).(\lambda (u1: +T).(\lambda (H: (drop O O c1 (CHead d1 (Bind Abst) u1))).(\lambda (g: +G).(\lambda (c2: C).(\lambda (H0: (csuba g c1 c2)).(let H1 \def (eq_ind C c1 +(\lambda (c: C).(csuba g c c2)) H0 (CHead d1 (Bind Abst) u1) (drop_gen_refl +c1 (CHead d1 (Bind Abst) u1) H)) in (let H_x \def (csuba_gen_abst g d1 c2 u1 +H1) in (let H2 \def H_x in (or_ind (ex2 C (\lambda (d2: C).(eq C c2 (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))) (or (ex2 C (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop O O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (H3: +(ex2 C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2)))).(ex2_ind C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) (or (ex2 C (\lambda (d2: +C).(drop O O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O +O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: +A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda +(a: A).(arity g d2 u2 a)))))) (\lambda (x: C).(\lambda (H4: (eq C c2 (CHead x +(Bind Abst) u1))).(\lambda (H5: (csuba g d1 x)).(eq_ind_r C (CHead x (Bind +Abst) u1) (\lambda (c: C).(or (ex2 C (\lambda (d2: C).(drop O O c (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O O c (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))) (or_introl (ex2 C (\lambda (d2: C).(drop O O (CHead x (Bind Abst) +u1) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O O (CHead x (Bind +Abst) u1) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex_intro2 C (\lambda (d2: +C).(drop O O (CHead x (Bind Abst) u1) (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2)) x (drop_refl (CHead x (Bind Abst) u1)) H5)) c2 +H4)))) H3)) (\lambda (H3: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))).(ex4_3_ind C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))) (or (ex2 C (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop O O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H4: (eq C c2 (CHead x0 (Bind +Abbr) x1))).(\lambda (H5: (csuba g d1 x0)).(\lambda (H6: (arity g d1 u1 +(asucc g x2))).(\lambda (H7: (arity g x0 x1 x2)).(eq_ind_r C (CHead x0 (Bind +Abbr) x1) (\lambda (c: C).(or (ex2 C (\lambda (d2: C).(drop O O c (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O O c (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))) (or_intror (ex2 C (\lambda (d2: C).(drop O O (CHead x0 (Bind Abbr) +x1) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O O (CHead x0 (Bind +Abbr) x1) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex4_3_intro C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O O (CHead x0 (Bind Abbr) x1) +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a)))) x0 x1 x2 (drop_refl (CHead x0 (Bind Abbr) x1)) H5 H6 +H7)) c2 H4)))))))) H3)) H2))))))))))) (\lambda (n: nat).(\lambda (H: +((\forall (c1: C).(\forall (d1: C).(\forall (u1: T).((drop n O c1 (CHead d1 +(Bind Abst) u1)) \to (\forall (g: G).(\forall (c2: C).((csuba g c1 c2) \to +(or (ex2 C (\lambda (d2: C).(drop n O c2 (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop n O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))))))))))).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (d1: +C).(\forall (u1: T).((drop (S n) O c (CHead d1 (Bind Abst) u1)) \to (\forall +(g: G).(\forall (c2: C).((csuba g c c2) \to (or (ex2 C (\lambda (d2: C).(drop +(S n) O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: +A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda +(a: A).(arity g d2 u2 a))))))))))))) (\lambda (n0: nat).(\lambda (d1: +C).(\lambda (u1: T).(\lambda (H0: (drop (S n) O (CSort n0) (CHead d1 (Bind +Abst) u1))).(\lambda (g: G).(\lambda (c2: C).(\lambda (_: (csuba g (CSort n0) +c2)).(and3_ind (eq C (CHead d1 (Bind Abst) u1) (CSort n0)) (eq nat (S n) O) +(eq nat O O) (or (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (H2: (eq C (CHead d1 (Bind Abst) u1) (CSort n0))).(\lambda +(_: (eq nat (S n) O)).(\lambda (_: (eq nat O O)).(let H5 \def (match H2 in eq +return (\lambda (c: C).(\lambda (_: (eq ? ? c)).((eq C c (CSort n0)) \to (or +(ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))))))) with +[refl_equal \Rightarrow (\lambda (H5: (eq C (CHead d1 (Bind Abst) u1) (CSort +n0))).(let H6 \def (eq_ind C (CHead d1 (Bind Abst) u1) (\lambda (e: C).(match +e in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | +(CHead _ _ _) \Rightarrow True])) I (CSort n0) H5) in (False_ind (or (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) H6)))]) in +(H5 (refl_equal C (CSort n0))))))) (drop_gen_sort n0 (S n) O (CHead d1 (Bind +Abst) u1) H0))))))))) (\lambda (c: C).(\lambda (H0: ((\forall (d1: +C).(\forall (u1: T).((drop (S n) O c (CHead d1 (Bind Abst) u1)) \to (\forall +(g: G).(\forall (c2: C).((csuba g c c2) \to (or (ex2 C (\lambda (d2: C).(drop +(S n) O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: +A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda +(a: A).(arity g d2 u2 a)))))))))))))).(\lambda (k: K).(\lambda (t: +T).(\lambda (d1: C).(\lambda (u1: T).(\lambda (H1: (drop (S n) O (CHead c k +t) (CHead d1 (Bind Abst) u1))).(\lambda (g: G).(\lambda (c2: C).(\lambda (H2: +(csuba g (CHead c k t) c2)).(K_ind (\lambda (k0: K).((csuba g (CHead c k0 t) +c2) \to ((drop (r k0 n) O c (CHead d1 (Bind Abst) u1)) \to (or (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))))))) (\lambda +(b: B).(\lambda (H3: (csuba g (CHead c (Bind b) t) c2)).(\lambda (H4: (drop +(r (Bind b) n) O c (CHead d1 (Bind Abst) u1))).(B_ind (\lambda (b0: +B).((csuba g (CHead c (Bind b0) t) c2) \to ((drop (r (Bind b0) n) O c (CHead +d1 (Bind Abst) u1)) \to (or (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead +d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 (Bind +Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 +d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc +g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))))) (\lambda (H5: (csuba g (CHead c (Bind Abbr) t) c2)).(\lambda (H6: +(drop (r (Bind Abbr) n) O c (CHead d1 (Bind Abst) u1))).(let H_x \def +(csuba_gen_abbr g c c2 t H5) in (let H7 \def H_x in (ex2_ind C (\lambda (d2: +C).(eq C c2 (CHead d2 (Bind Abbr) t))) (\lambda (d2: C).(csuba g c d2)) (or +(ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (x: +C).(\lambda (H8: (eq C c2 (CHead x (Bind Abbr) t))).(\lambda (H9: (csuba g c +x)).(eq_ind_r C (CHead x (Bind Abbr) t) (\lambda (c0: C).(or (ex2 C (\lambda +(d2: C).(drop (S n) O c0 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba +g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop (S n) O c0 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda +(_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))))) (let H10 \def (H c d1 u1 H6 g +x H9) in (or_ind (ex2 C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abst) +u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop n O x (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (or +(ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Abbr) t) +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a)))))) (\lambda (H11: (ex2 C (\lambda (d2: C).(drop n O x +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)))).(ex2_ind C +(\lambda (d2: C).(drop n O x (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2)) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind +Abbr) t) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +(CHead x (Bind Abbr) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (x0: +C).(\lambda (H12: (drop n O x (CHead x0 (Bind Abst) u1))).(\lambda (H13: +(csuba g d1 x0)).(let H14 \def (refl_equal nat (r (Bind Abbr) n)) in (let H15 +\def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x (CHead x0 (Bind Abst) +u1))) H12 (r (Bind Abbr) n) H14) in (or_introl (ex2 C (\lambda (d2: C).(drop +(S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) +(ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) x0 (drop_drop (Bind Abbr) +n x (CHead x0 (Bind Abst) u1) H15 t) H13))))))) H11)) (\lambda (H11: (ex4_3 C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O x (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop n O x (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) (or (ex2 C (\lambda (d2: +C).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind +Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 +d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc +g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H12: +(drop n O x (CHead x0 (Bind Abbr) x1))).(\lambda (H13: (csuba g d1 +x0)).(\lambda (H14: (arity g d1 u1 (asucc g x2))).(\lambda (H15: (arity g x0 +x1 x2)).(let H16 \def (refl_equal nat (r (Bind Abbr) n)) in (let H17 \def +(eq_ind nat n (\lambda (n0: nat).(drop n0 O x (CHead x0 (Bind Abbr) x1))) H12 +(r (Bind Abbr) n) H16) in (or_intror (ex2 C (\lambda (d2: C).(drop (S n) O +(CHead x (Bind Abbr) t) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g +d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop +(S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex4_3_intro C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x +(Bind Abbr) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) x0 x1 x2 (drop_drop (Bind Abbr) +n x (CHead x0 (Bind Abbr) x1) H17 t) H13 H14 H15))))))))))) H11)) H10)) c2 +H8)))) H7))))) (\lambda (H5: (csuba g (CHead c (Bind Abst) t) c2)).(\lambda +(H6: (drop (r (Bind Abst) n) O c (CHead d1 (Bind Abst) u1))).(let H_x \def +(csuba_gen_abst g c c2 t H5) in (let H7 \def H_x in (or_ind (ex2 C (\lambda +(d2: C).(eq C c2 (CHead d2 (Bind Abst) t))) (\lambda (d2: C).(csuba g c d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g c d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g +c t (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity +g d2 u2 a))))) (or (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (H8: (ex2 C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abst) +t))) (\lambda (d2: C).(csuba g c d2)))).(ex2_ind C (\lambda (d2: C).(eq C c2 +(CHead d2 (Bind Abst) t))) (\lambda (d2: C).(csuba g c d2)) (or (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (x: +C).(\lambda (H9: (eq C c2 (CHead x (Bind Abst) t))).(\lambda (H10: (csuba g c +x)).(eq_ind_r C (CHead x (Bind Abst) t) (\lambda (c0: C).(or (ex2 C (\lambda +(d2: C).(drop (S n) O c0 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba +g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop (S n) O c0 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda +(_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))))) (let H11 \def (H c d1 u1 H6 g +x H10) in (or_ind (ex2 C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abst) +u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop n O x (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (or +(ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Abst) t) +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a)))))) (\lambda (H12: (ex2 C (\lambda (d2: C).(drop n O x +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)))).(ex2_ind C +(\lambda (d2: C).(drop n O x (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2)) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind +Abst) t) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +(CHead x (Bind Abst) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (x0: +C).(\lambda (H13: (drop n O x (CHead x0 (Bind Abst) u1))).(\lambda (H14: +(csuba g d1 x0)).(let H15 \def (refl_equal nat (r (Bind Abbr) n)) in (let H16 +\def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x (CHead x0 (Bind Abst) +u1))) H13 (r (Bind Abbr) n) H15) in (or_introl (ex2 C (\lambda (d2: C).(drop +(S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) +(ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) x0 (drop_drop (Bind Abst) +n x (CHead x0 (Bind Abst) u1) H16 t) H14))))))) H12)) (\lambda (H12: (ex4_3 C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O x (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop n O x (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) (or (ex2 C (\lambda (d2: +C).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind +Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 +d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc +g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H13: +(drop n O x (CHead x0 (Bind Abbr) x1))).(\lambda (H14: (csuba g d1 +x0)).(\lambda (H15: (arity g d1 u1 (asucc g x2))).(\lambda (H16: (arity g x0 +x1 x2)).(let H17 \def (refl_equal nat (r (Bind Abbr) n)) in (let H18 \def +(eq_ind nat n (\lambda (n0: nat).(drop n0 O x (CHead x0 (Bind Abbr) x1))) H13 +(r (Bind Abbr) n) H17) in (or_intror (ex2 C (\lambda (d2: C).(drop (S n) O +(CHead x (Bind Abst) t) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g +d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop +(S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex4_3_intro C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x +(Bind Abst) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) x0 x1 x2 (drop_drop (Bind Abst) +n x (CHead x0 (Bind Abbr) x1) H18 t) H14 H15 H16))))))))))) H12)) H11)) c2 +H9)))) H8)) (\lambda (H8: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g c d2)))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g c t (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))))).(ex4_3_ind C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g c d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g c t (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))) (or (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H9: (eq C c2 (CHead x0 (Bind +Abbr) x1))).(\lambda (H10: (csuba g c x0)).(\lambda (_: (arity g c t (asucc g +x2))).(\lambda (_: (arity g x0 x1 x2)).(eq_ind_r C (CHead x0 (Bind Abbr) x1) +(\lambda (c0: C).(or (ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c0 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))) (let H13 \def (H c d1 u1 H6 g x0 H10) in (or_ind (ex2 C (\lambda +(d2: C).(drop n O x0 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n +O x0 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: +A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda +(a: A).(arity g d2 u2 a))))) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead +x0 (Bind Abbr) x1) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S +n) O (CHead x0 (Bind Abbr) x1) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda +(H14: (ex2 C (\lambda (d2: C).(drop n O x0 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2)))).(ex2_ind C (\lambda (d2: C).(drop n O x0 +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) (or (ex2 C +(\lambda (d2: C).(drop (S n) O (CHead x0 (Bind Abbr) x1) (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 (Bind Abbr) x1) +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a)))))) (\lambda (x: C).(\lambda (H15: (drop n O x0 (CHead +x (Bind Abst) u1))).(\lambda (H16: (csuba g d1 x)).(let H17 \def (refl_equal +nat (r (Bind Abbr) n)) in (let H18 \def (eq_ind nat n (\lambda (n0: +nat).(drop n0 O x0 (CHead x (Bind Abst) u1))) H15 (r (Bind Abbr) n) H17) in +(or_introl (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Bind Abbr) x1) +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 +(Bind Abbr) x1) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex_intro2 C (\lambda (d2: +C).(drop (S n) O (CHead x0 (Bind Abbr) x1) (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2)) x (drop_drop (Bind Abbr) n x0 (CHead x +(Bind Abst) u1) H18 x1) H16))))))) H14)) (\lambda (H14: (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O x0 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop n O x0 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) (or (ex2 C (\lambda (d2: +C).(drop (S n) O (CHead x0 (Bind Abbr) x1) (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 (Bind Abbr) x1) (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))))) (\lambda (x3: C).(\lambda (x4: T).(\lambda (x5: A).(\lambda (H15: +(drop n O x0 (CHead x3 (Bind Abbr) x4))).(\lambda (H16: (csuba g d1 +x3)).(\lambda (H17: (arity g d1 u1 (asucc g x5))).(\lambda (H18: (arity g x3 +x4 x5)).(let H19 \def (refl_equal nat (r (Bind Abbr) n)) in (let H20 \def +(eq_ind nat n (\lambda (n0: nat).(drop n0 O x0 (CHead x3 (Bind Abbr) x4))) +H15 (r (Bind Abbr) n) H19) in (or_intror (ex2 C (\lambda (d2: C).(drop (S n) +O (CHead x0 (Bind Abbr) x1) (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x0 (Bind Abbr) x1) (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) +(ex4_3_intro C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S +n) O (CHead x0 (Bind Abbr) x1) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))) x3 x4 x5 +(drop_drop (Bind Abbr) n x0 (CHead x3 (Bind Abbr) x4) H20 x1) H16 H17 +H18))))))))))) H14)) H13)) c2 H9)))))))) H8)) H7))))) (\lambda (H5: (csuba g +(CHead c (Bind Void) t) c2)).(\lambda (H6: (drop (r (Bind Void) n) O c (CHead +d1 (Bind Abst) u1))).(let H_x \def (csuba_gen_void g c c2 t H5) in (let H7 +\def H_x in (ex2_ind C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind Void) t))) +(\lambda (d2: C).(csuba g c d2)) (or (ex2 C (\lambda (d2: C).(drop (S n) O c2 +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))))) (\lambda (x: C).(\lambda (H8: (eq C c2 (CHead x (Bind Void) +t))).(\lambda (H9: (csuba g c x)).(eq_ind_r C (CHead x (Bind Void) t) +(\lambda (c0: C).(or (ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c0 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))) (let H10 \def (H c d1 u1 H6 g x H9) in (or_ind (ex2 C (\lambda (d2: +C).(drop n O x (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O x +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a))))) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x +(Bind Void) t) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +(CHead x (Bind Void) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda +(H11: (ex2 C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2)))).(ex2_ind C (\lambda (d2: C).(drop n O x +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) (or (ex2 C +(\lambda (d2: C).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abst) +u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Void) t) +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a)))))) (\lambda (x0: C).(\lambda (H12: (drop n O x (CHead +x0 (Bind Abst) u1))).(\lambda (H13: (csuba g d1 x0)).(let H14 \def +(refl_equal nat (r (Bind Abbr) n)) in (let H15 \def (eq_ind nat n (\lambda +(n0: nat).(drop n0 O x (CHead x0 (Bind Abst) u1))) H12 (r (Bind Abbr) n) H14) +in (or_introl (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Void) t) +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x +(Bind Void) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex_intro2 C (\lambda (d2: +C).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2)) x0 (drop_drop (Bind Void) n x (CHead x0 (Bind Abst) +u1) H15 t) H13))))))) H11)) (\lambda (H11: (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop n O x (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop n O x (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) (or (ex2 C (\lambda (d2: +C).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind +Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 +d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc +g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H12: +(drop n O x (CHead x0 (Bind Abbr) x1))).(\lambda (H13: (csuba g d1 +x0)).(\lambda (H14: (arity g d1 u1 (asucc g x2))).(\lambda (H15: (arity g x0 +x1 x2)).(let H16 \def (refl_equal nat (r (Bind Abbr) n)) in (let H17 \def +(eq_ind nat n (\lambda (n0: nat).(drop n0 O x (CHead x0 (Bind Abbr) x1))) H12 +(r (Bind Abbr) n) H16) in (or_intror (ex2 C (\lambda (d2: C).(drop (S n) O +(CHead x (Bind Void) t) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g +d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop +(S n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex4_3_intro C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x +(Bind Void) t) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) x0 x1 x2 (drop_drop (Bind Void) +n x (CHead x0 (Bind Abbr) x1) H17 t) H13 H14 H15))))))))))) H11)) H10)) c2 +H8)))) H7))))) b H3 H4)))) (\lambda (f: F).(\lambda (H3: (csuba g (CHead c +(Flat f) t) c2)).(\lambda (H4: (drop (r (Flat f) n) O c (CHead d1 (Bind Abst) +u1))).(let H_x \def (csuba_gen_flat g c c2 t f H3) in (let H5 \def H_x in +(ex2_2_ind C T (\lambda (d2: C).(\lambda (u2: T).(eq C c2 (CHead d2 (Flat f) +u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g c d2))) (or (ex2 C (\lambda +(d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba +g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop (S n) O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda +(_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (H6: (eq C c2 (CHead x0 (Flat f) x1))).(\lambda (H7: (csuba g c +x0)).(eq_ind_r C (CHead x0 (Flat f) x1) (\lambda (c0: C).(or (ex2 C (\lambda +(d2: C).(drop (S n) O c0 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba +g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop (S n) O c0 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda +(_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))))) (let H8 \def (H0 d1 u1 H4 g +x0 H7) in (or_ind (ex2 C (\lambda (d2: C).(drop (S n) O x0 (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O x0 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Flat f) x1) +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 +(Flat f) x1) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (H9: (ex2 C (\lambda +(d2: C).(drop (S n) O x0 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba +g d1 d2)))).(ex2_ind C (\lambda (d2: C).(drop (S n) O x0 (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) (or (ex2 C (\lambda (d2: +C).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (x: C).(\lambda (H10: (drop (S n) O x0 (CHead x (Bind Abst) +u1))).(\lambda (H11: (csuba g d1 x)).(or_introl (ex2 C (\lambda (d2: C).(drop +(S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) +(ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) x (drop_drop (Flat f) n +x0 (CHead x (Bind Abst) u1) H10 x1) H11))))) H9)) (\lambda (H9: (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O x0 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop (S n) O x0 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda +(_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) (or (ex2 C (\lambda (d2: +C).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: A).(\lambda (H10: +(drop (S n) O x0 (CHead x2 (Bind Abbr) x3))).(\lambda (H11: (csuba g d1 +x2)).(\lambda (H12: (arity g d1 u1 (asucc g x4))).(\lambda (H13: (arity g x2 +x3 x4)).(or_intror (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Flat f) +x1) (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 +(Flat f) x1) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex4_3_intro C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 (Flat f) x1) +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a)))) x2 x3 x4 (drop_drop (Flat f) n x0 (CHead x2 (Bind +Abbr) x3) H10 x1) H11 H12 H13))))))))) H9)) H8)) c2 H6))))) H5)))))) k H2 +(drop_gen_drop k c (CHead d1 (Bind Abst) u1) t n H1)))))))))))) c1)))) i). + +theorem csuba_drop_abst_rev: + \forall (i: nat).(\forall (c1: C).(\forall (d1: C).(\forall (u: T).((drop i +O c1 (CHead d1 (Bind Abst) u)) \to (\forall (g: G).(\forall (c2: C).((csuba g +c2 c1) \to (ex2 C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind Abst) u))) +(\lambda (d2: C).(csuba g d2 d1)))))))))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (c1: C).(\forall (d1: +C).(\forall (u: T).((drop n O c1 (CHead d1 (Bind Abst) u)) \to (\forall (g: +G).(\forall (c2: C).((csuba g c2 c1) \to (ex2 C (\lambda (d2: C).(drop n O c2 +(CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))))))))))) +(\lambda (c1: C).(\lambda (d1: C).(\lambda (u: T).(\lambda (H: (drop O O c1 +(CHead d1 (Bind Abst) u))).(\lambda (g: G).(\lambda (c2: C).(\lambda (H0: +(csuba g c2 c1)).(let H1 \def (eq_ind C c1 (\lambda (c: C).(csuba g c2 c)) H0 +(CHead d1 (Bind Abst) u) (drop_gen_refl c1 (CHead d1 (Bind Abst) u) H)) in +(let H_x \def (csuba_gen_abst_rev g d1 c2 u H1) in (let H2 \def H_x in +(ex2_ind C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: +C).(csuba g d2 d1)) (ex2 C (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (x: C).(\lambda (H3: +(eq C c2 (CHead x (Bind Abst) u))).(\lambda (H4: (csuba g x d1)).(eq_ind_r C +(CHead x (Bind Abst) u) (\lambda (c: C).(ex2 C (\lambda (d2: C).(drop O O c +(CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)))) (ex_intro2 C +(\lambda (d2: C).(drop O O (CHead x (Bind Abst) u) (CHead d2 (Bind Abst) u))) +(\lambda (d2: C).(csuba g d2 d1)) x (drop_refl (CHead x (Bind Abst) u)) H4) +c2 H3)))) H2))))))))))) (\lambda (n: nat).(\lambda (H: ((\forall (c1: +C).(\forall (d1: C).(\forall (u: T).((drop n O c1 (CHead d1 (Bind Abst) u)) +\to (\forall (g: G).(\forall (c2: C).((csuba g c2 c1) \to (ex2 C (\lambda +(d2: C).(drop n O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 +d1)))))))))))).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (d1: +C).(\forall (u: T).((drop (S n) O c (CHead d1 (Bind Abst) u)) \to (\forall +(g: G).(\forall (c2: C).((csuba g c2 c) \to (ex2 C (\lambda (d2: C).(drop (S +n) O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)))))))))) +(\lambda (n0: nat).(\lambda (d1: C).(\lambda (u: T).(\lambda (H0: (drop (S n) +O (CSort n0) (CHead d1 (Bind Abst) u))).(\lambda (g: G).(\lambda (c2: +C).(\lambda (_: (csuba g c2 (CSort n0))).(and3_ind (eq C (CHead d1 (Bind +Abst) u) (CSort n0)) (eq nat (S n) O) (eq nat O O) (ex2 C (\lambda (d2: +C).(drop (S n) O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 +d1))) (\lambda (H2: (eq C (CHead d1 (Bind Abst) u) (CSort n0))).(\lambda (_: +(eq nat (S n) O)).(\lambda (_: (eq nat O O)).(let H5 \def (match H2 in eq +return (\lambda (c: C).(\lambda (_: (eq ? ? c)).((eq C c (CSort n0)) \to (ex2 +C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: +C).(csuba g d2 d1)))))) with [refl_equal \Rightarrow (\lambda (H5: (eq C +(CHead d1 (Bind Abst) u) (CSort n0))).(let H6 \def (eq_ind C (CHead d1 (Bind +Abst) u) (\lambda (e: C).(match e in C return (\lambda (_: C).Prop) with +[(CSort _) \Rightarrow False | (CHead _ _ _) \Rightarrow True])) I (CSort n0) +H5) in (False_ind (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) H6)))]) in (H5 (refl_equal C +(CSort n0))))))) (drop_gen_sort n0 (S n) O (CHead d1 (Bind Abst) u) +H0))))))))) (\lambda (c: C).(\lambda (H0: ((\forall (d1: C).(\forall (u: +T).((drop (S n) O c (CHead d1 (Bind Abst) u)) \to (\forall (g: G).(\forall +(c2: C).((csuba g c2 c) \to (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead +d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))))))))))).(\lambda (k: +K).(\lambda (t: T).(\lambda (d1: C).(\lambda (u: T).(\lambda (H1: (drop (S n) +O (CHead c k t) (CHead d1 (Bind Abst) u))).(\lambda (g: G).(\lambda (c2: +C).(\lambda (H2: (csuba g c2 (CHead c k t))).(K_ind (\lambda (k0: K).((csuba +g c2 (CHead c k0 t)) \to ((drop (r k0 n) O c (CHead d1 (Bind Abst) u)) \to +(ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u))) (\lambda +(d2: C).(csuba g d2 d1)))))) (\lambda (b: B).(\lambda (H3: (csuba g c2 (CHead +c (Bind b) t))).(\lambda (H4: (drop (r (Bind b) n) O c (CHead d1 (Bind Abst) +u))).(B_ind (\lambda (b0: B).((csuba g c2 (CHead c (Bind b0) t)) \to ((drop +(r (Bind b0) n) O c (CHead d1 (Bind Abst) u)) \to (ex2 C (\lambda (d2: +C).(drop (S n) O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 +d1)))))) (\lambda (H5: (csuba g c2 (CHead c (Bind Abbr) t))).(\lambda (H6: +(drop (r (Bind Abbr) n) O c (CHead d1 (Bind Abst) u))).(let H_x \def +(csuba_gen_abbr_rev g c c2 t H5) in (let H7 \def H_x in (or_ind (ex2 C +(\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abbr) t))) (\lambda (d2: C).(csuba +g d2 c))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq +C c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 c)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g c t a))))) (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 +(Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (H8: (ex2 C +(\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abbr) t))) (\lambda (d2: C).(csuba +g d2 c)))).(ex2_ind C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abbr) t))) +(\lambda (d2: C).(csuba g d2 c)) (ex2 C (\lambda (d2: C).(drop (S n) O c2 +(CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (x: +C).(\lambda (H9: (eq C c2 (CHead x (Bind Abbr) t))).(\lambda (H10: (csuba g x +c)).(eq_ind_r C (CHead x (Bind Abbr) t) (\lambda (c0: C).(ex2 C (\lambda (d2: +C).(drop (S n) O c0 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 +d1)))) (let H11 \def (H c d1 u H6 g x H10) in (ex2_ind C (\lambda (d2: +C).(drop n O x (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) +(ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (x0: C).(\lambda (H12: +(drop n O x (CHead x0 (Bind Abst) u))).(\lambda (H13: (csuba g x0 d1)).(let +H14 \def (refl_equal nat (r (Bind Abst) n)) in (let H15 \def (eq_ind nat n +(\lambda (n0: nat).(drop n0 O x (CHead x0 (Bind Abst) u))) H12 (r (Bind Abst) +n) H14) in (ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abbr) +t) (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) x0 (drop_drop +(Bind Abbr) n x (CHead x0 (Bind Abst) u) H15 t) H13)))))) H11)) c2 H9)))) +H8)) (\lambda (H8: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(eq C c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 c)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g c t a)))))).(ex4_3_ind C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 c)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g c t a)))) (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: +C).(csuba g d2 d1))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: +A).(\lambda (H9: (eq C c2 (CHead x0 (Bind Abst) x1))).(\lambda (H10: (csuba g +x0 c)).(\lambda (_: (arity g x0 x1 (asucc g x2))).(\lambda (_: (arity g c t +x2)).(eq_ind_r C (CHead x0 (Bind Abst) x1) (\lambda (c0: C).(ex2 C (\lambda +(d2: C).(drop (S n) O c0 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g +d2 d1)))) (let H13 \def (H c d1 u H6 g x0 H10) in (ex2_ind C (\lambda (d2: +C).(drop n O x0 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) +(ex2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Bind Abst) x1) (CHead d2 +(Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (x: C).(\lambda +(H14: (drop n O x0 (CHead x (Bind Abst) u))).(\lambda (H15: (csuba g x +d1)).(let H16 \def (refl_equal nat (r (Bind Abst) n)) in (let H17 \def +(eq_ind nat n (\lambda (n0: nat).(drop n0 O x0 (CHead x (Bind Abst) u))) H14 +(r (Bind Abst) n) H16) in (ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead +x0 (Bind Abst) x1) (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 +d1)) x (drop_drop (Bind Abst) n x0 (CHead x (Bind Abst) u) H17 x1) H15)))))) +H13)) c2 H9)))))))) H8)) H7))))) (\lambda (H5: (csuba g c2 (CHead c (Bind +Abst) t))).(\lambda (H6: (drop (r (Bind Abst) n) O c (CHead d1 (Bind Abst) +u))).(let H_x \def (csuba_gen_abst_rev g c c2 t H5) in (let H7 \def H_x in +(ex2_ind C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abst) t))) (\lambda (d2: +C).(csuba g d2 c)) (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (x: C).(\lambda (H8: +(eq C c2 (CHead x (Bind Abst) t))).(\lambda (H9: (csuba g x c)).(eq_ind_r C +(CHead x (Bind Abst) t) (\lambda (c0: C).(ex2 C (\lambda (d2: C).(drop (S n) +O c0 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)))) (let H10 +\def (H c d1 u H6 g x H9) in (ex2_ind C (\lambda (d2: C).(drop n O x (CHead +d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) (ex2 C (\lambda (d2: +C).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abst) u))) (\lambda +(d2: C).(csuba g d2 d1))) (\lambda (x0: C).(\lambda (H11: (drop n O x (CHead +x0 (Bind Abst) u))).(\lambda (H12: (csuba g x0 d1)).(let H13 \def (refl_equal +nat (r (Bind Abst) n)) in (let H14 \def (eq_ind nat n (\lambda (n0: +nat).(drop n0 O x (CHead x0 (Bind Abst) u))) H11 (r (Bind Abst) n) H13) in +(ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 +(Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) x0 (drop_drop (Bind Abst) +n x (CHead x0 (Bind Abst) u) H14 t) H12)))))) H10)) c2 H8)))) H7))))) +(\lambda (H5: (csuba g c2 (CHead c (Bind Void) t))).(\lambda (H6: (drop (r +(Bind Void) n) O c (CHead d1 (Bind Abst) u))).(let H_x \def +(csuba_gen_void_rev g c c2 t H5) in (let H7 \def H_x in (ex2_ind C (\lambda +(d2: C).(eq C c2 (CHead d2 (Bind Void) t))) (\lambda (d2: C).(csuba g d2 c)) +(ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abst) u))) (\lambda +(d2: C).(csuba g d2 d1))) (\lambda (x: C).(\lambda (H8: (eq C c2 (CHead x +(Bind Void) t))).(\lambda (H9: (csuba g x c)).(eq_ind_r C (CHead x (Bind +Void) t) (\lambda (c0: C).(ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead d2 +(Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)))) (let H10 \def (H c d1 u +H6 g x H9) in (ex2_ind C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abst) +u))) (\lambda (d2: C).(csuba g d2 d1)) (ex2 C (\lambda (d2: C).(drop (S n) O +(CHead x (Bind Void) t) (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g +d2 d1))) (\lambda (x0: C).(\lambda (H11: (drop n O x (CHead x0 (Bind Abst) +u))).(\lambda (H12: (csuba g x0 d1)).(let H13 \def (refl_equal nat (r (Bind +Abst) n)) in (let H14 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x +(CHead x0 (Bind Abst) u))) H11 (r (Bind Abst) n) H13) in (ex_intro2 C +(\lambda (d2: C).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abst) +u))) (\lambda (d2: C).(csuba g d2 d1)) x0 (drop_drop (Bind Void) n x (CHead +x0 (Bind Abst) u) H14 t) H12)))))) H10)) c2 H8)))) H7))))) b H3 H4)))) +(\lambda (f: F).(\lambda (H3: (csuba g c2 (CHead c (Flat f) t))).(\lambda +(H4: (drop (r (Flat f) n) O c (CHead d1 (Bind Abst) u))).(let H_x \def +(csuba_gen_flat_rev g c c2 t f H3) in (let H5 \def H_x in (ex2_2_ind C T +(\lambda (d2: C).(\lambda (u2: T).(eq C c2 (CHead d2 (Flat f) u2)))) (\lambda +(d2: C).(\lambda (_: T).(csuba g d2 c))) (ex2 C (\lambda (d2: C).(drop (S n) +O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda +(x0: C).(\lambda (x1: T).(\lambda (H6: (eq C c2 (CHead x0 (Flat f) +x1))).(\lambda (H7: (csuba g x0 c)).(eq_ind_r C (CHead x0 (Flat f) x1) +(\lambda (c0: C).(ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1)))) (let H8 \def (H0 d1 u H4 g x0 +H7) in (ex2_ind C (\lambda (d2: C).(drop (S n) O x0 (CHead d2 (Bind Abst) +u))) (\lambda (d2: C).(csuba g d2 d1)) (ex2 C (\lambda (d2: C).(drop (S n) O +(CHead x0 (Flat f) x1) (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g +d2 d1))) (\lambda (x: C).(\lambda (H9: (drop (S n) O x0 (CHead x (Bind Abst) +u))).(\lambda (H10: (csuba g x d1)).(ex_intro2 C (\lambda (d2: C).(drop (S n) +O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g +d2 d1)) x (drop_drop (Flat f) n x0 (CHead x (Bind Abst) u) H9 x1) H10)))) +H8)) c2 H6))))) H5)))))) k H2 (drop_gen_drop k c (CHead d1 (Bind Abst) u) t n +H1)))))))))))) c1)))) i). + +theorem csuba_drop_abbr_rev: + \forall (i: nat).(\forall (c1: C).(\forall (d1: C).(\forall (u1: T).((drop i +O c1 (CHead d1 (Bind Abbr) u1)) \to (\forall (g: G).(\forall (c2: C).((csuba +g c2 c1) \to (or (ex2 C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop i O c2 (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +a))))))))))))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (c1: C).(\forall (d1: +C).(\forall (u1: T).((drop n O c1 (CHead d1 (Bind Abbr) u1)) \to (\forall (g: +G).(\forall (c2: C).((csuba g c2 c1) \to (or (ex2 C (\lambda (d2: C).(drop n +O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O c2 (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))))))))))) (\lambda (c1: C).(\lambda (d1: C).(\lambda (u1: +T).(\lambda (H: (drop O O c1 (CHead d1 (Bind Abbr) u1))).(\lambda (g: +G).(\lambda (c2: C).(\lambda (H0: (csuba g c2 c1)).(let H1 \def (eq_ind C c1 +(\lambda (c: C).(csuba g c2 c)) H0 (CHead d1 (Bind Abbr) u1) (drop_gen_refl +c1 (CHead d1 (Bind Abbr) u1) H)) in (let H_x \def (csuba_gen_abbr_rev g d1 c2 +u1 H1) in (let H2 \def H_x in (or_ind (ex2 C (\lambda (d2: C).(eq C c2 (CHead +d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) +(or (ex2 C (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abbr) u1))) (\lambda +(d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop O O c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (H3: +(ex2 C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1)))).(ex2_ind C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)) (or (ex2 C (\lambda (d2: +C).(drop O O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O +O c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (x: C).(\lambda (H4: (eq C c2 (CHead x +(Bind Abbr) u1))).(\lambda (H5: (csuba g x d1)).(eq_ind_r C (CHead x (Bind +Abbr) u1) (\lambda (c: C).(or (ex2 C (\lambda (d2: C).(drop O O c (CHead d2 +(Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O O c (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +a))))))) (or_introl (ex2 C (\lambda (d2: C).(drop O O (CHead x (Bind Abbr) +u1) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O O (CHead x (Bind +Abbr) u1) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a))))) (ex_intro2 C (\lambda (d2: +C).(drop O O (CHead x (Bind Abbr) u1) (CHead d2 (Bind Abbr) u1))) (\lambda +(d2: C).(csuba g d2 d1)) x (drop_refl (CHead x (Bind Abbr) u1)) H5)) c2 +H4)))) H3)) (\lambda (H3: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))).(ex4_3_ind C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))) (or (ex2 C (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop O O c2 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H4: (eq C c2 (CHead x0 (Bind +Abst) x1))).(\lambda (H5: (csuba g x0 d1)).(\lambda (H6: (arity g x0 x1 +(asucc g x2))).(\lambda (H7: (arity g d1 u1 x2)).(eq_ind_r C (CHead x0 (Bind +Abst) x1) (\lambda (c: C).(or (ex2 C (\lambda (d2: C).(drop O O c (CHead d2 +(Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O O c (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +a))))))) (or_intror (ex2 C (\lambda (d2: C).(drop O O (CHead x0 (Bind Abst) +x1) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop O O (CHead x0 (Bind +Abst) x1) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a))))) (ex4_3_intro C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop O O (CHead x0 (Bind Abst) x1) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))) x0 x1 x2 (drop_refl (CHead x0 (Bind Abst) x1)) H5 +H6 H7)) c2 H4)))))))) H3)) H2))))))))))) (\lambda (n: nat).(\lambda (H: +((\forall (c1: C).(\forall (d1: C).(\forall (u1: T).((drop n O c1 (CHead d1 +(Bind Abbr) u1)) \to (\forall (g: G).(\forall (c2: C).((csuba g c2 c1) \to +(or (ex2 C (\lambda (d2: C).(drop n O c2 (CHead d2 (Bind Abbr) u1))) (\lambda +(d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop n O c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +a))))))))))))))).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (d1: +C).(\forall (u1: T).((drop (S n) O c (CHead d1 (Bind Abbr) u1)) \to (\forall +(g: G).(\forall (c2: C).((csuba g c2 c) \to (or (ex2 C (\lambda (d2: C).(drop +(S n) O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))))))))))) (\lambda (n0: nat).(\lambda (d1: +C).(\lambda (u1: T).(\lambda (H0: (drop (S n) O (CSort n0) (CHead d1 (Bind +Abbr) u1))).(\lambda (g: G).(\lambda (c2: C).(\lambda (_: (csuba g c2 (CSort +n0))).(and3_ind (eq C (CHead d1 (Bind Abbr) u1) (CSort n0)) (eq nat (S n) O) +(eq nat O O) (or (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) +(\lambda (H2: (eq C (CHead d1 (Bind Abbr) u1) (CSort n0))).(\lambda (_: (eq +nat (S n) O)).(\lambda (_: (eq nat O O)).(let H5 \def (match H2 in eq return +(\lambda (c: C).(\lambda (_: (eq ? ? c)).((eq C c (CSort n0)) \to (or (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))))))) with +[refl_equal \Rightarrow (\lambda (H5: (eq C (CHead d1 (Bind Abbr) u1) (CSort +n0))).(let H6 \def (eq_ind C (CHead d1 (Bind Abbr) u1) (\lambda (e: C).(match +e in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | +(CHead _ _ _) \Rightarrow True])) I (CSort n0) H5) in (False_ind (or (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) H6)))]) in (H5 +(refl_equal C (CSort n0))))))) (drop_gen_sort n0 (S n) O (CHead d1 (Bind +Abbr) u1) H0))))))))) (\lambda (c: C).(\lambda (H0: ((\forall (d1: +C).(\forall (u1: T).((drop (S n) O c (CHead d1 (Bind Abbr) u1)) \to (\forall +(g: G).(\forall (c2: C).((csuba g c2 c) \to (or (ex2 C (\lambda (d2: C).(drop +(S n) O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))))))))))).(\lambda (k: K).(\lambda (t: +T).(\lambda (d1: C).(\lambda (u1: T).(\lambda (H1: (drop (S n) O (CHead c k +t) (CHead d1 (Bind Abbr) u1))).(\lambda (g: G).(\lambda (c2: C).(\lambda (H2: +(csuba g c2 (CHead c k t))).(K_ind (\lambda (k0: K).((csuba g c2 (CHead c k0 +t)) \to ((drop (r k0 n) O c (CHead d1 (Bind Abbr) u1)) \to (or (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))))))) (\lambda (b: +B).(\lambda (H3: (csuba g c2 (CHead c (Bind b) t))).(\lambda (H4: (drop (r +(Bind b) n) O c (CHead d1 (Bind Abbr) u1))).(B_ind (\lambda (b0: B).((csuba g +c2 (CHead c (Bind b0) t)) \to ((drop (r (Bind b0) n) O c (CHead d1 (Bind +Abbr) u1)) \to (or (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +a))))))))) (\lambda (H5: (csuba g c2 (CHead c (Bind Abbr) t))).(\lambda (H6: +(drop (r (Bind Abbr) n) O c (CHead d1 (Bind Abbr) u1))).(let H_x \def +(csuba_gen_abbr_rev g c c2 t H5) in (let H7 \def H_x in (or_ind (ex2 C +(\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abbr) t))) (\lambda (d2: C).(csuba +g d2 c))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq +C c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 c)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g c t a))))) (or (ex2 C (\lambda (d2: C).(drop (S n) O c2 +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))) (\lambda (H8: (ex2 C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind +Abbr) t))) (\lambda (d2: C).(csuba g d2 c)))).(ex2_ind C (\lambda (d2: C).(eq +C c2 (CHead d2 (Bind Abbr) t))) (\lambda (d2: C).(csuba g d2 c)) (or (ex2 C +(\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (x: +C).(\lambda (H9: (eq C c2 (CHead x (Bind Abbr) t))).(\lambda (H10: (csuba g x +c)).(eq_ind_r C (CHead x (Bind Abbr) t) (\lambda (c0: C).(or (ex2 C (\lambda +(d2: C).(drop (S n) O c0 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba +g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop (S n) O c0 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda +(_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a))))))) (let H11 \def (H c d1 u1 H6 g +x H10) in (or_ind (ex2 C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop n O x (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) (or +(ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Abbr) t) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (H12: (ex2 C (\lambda (d2: C).(drop n +O x (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)))).(ex2_ind +C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1)) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind +Abbr) t) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +(CHead x (Bind Abbr) t) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (x0: +C).(\lambda (H13: (drop n O x (CHead x0 (Bind Abbr) u1))).(\lambda (H14: +(csuba g x0 d1)).(let H15 \def (refl_equal nat (r (Bind Abst) n)) in (let H16 +\def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x (CHead x0 (Bind Abbr) +u1))) H13 (r (Bind Abst) n) H15) in (or_introl (ex2 C (\lambda (d2: C).(drop +(S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) +(ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 +(Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)) x0 (drop_drop (Bind Abbr) +n x (CHead x0 (Bind Abbr) u1) H16 t) H14))))))) H12)) (\lambda (H12: (ex4_3 C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O x (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop n O x (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))) (or (ex2 C (\lambda (d2: C).(drop +(S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x (Bind Abbr) t) (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) +(\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H13: (drop n O x +(CHead x0 (Bind Abst) x1))).(\lambda (H14: (csuba g x0 d1)).(\lambda (H15: +(arity g x0 x1 (asucc g x2))).(\lambda (H16: (arity g d1 u1 x2)).(let H17 +\def (refl_equal nat (r (Bind Abst) n)) in (let H18 \def (eq_ind nat n +(\lambda (n0: nat).(drop n0 O x (CHead x0 (Bind Abst) x1))) H13 (r (Bind +Abst) n) H17) in (or_intror (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x +(Bind Abbr) t) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +(CHead x (Bind Abbr) t) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) (ex4_3_intro C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x +(Bind Abbr) t) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))) x0 x1 x2 (drop_drop (Bind Abbr) n +x (CHead x0 (Bind Abst) x1) H18 t) H14 H15 H16))))))))))) H12)) H11)) c2 +H9)))) H8)) (\lambda (H8: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 c)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g c t a)))))).(ex4_3_ind C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c2 (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +c)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc +g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g c t a)))) +(or (ex2 C (\lambda (d2: C).(drop (S n) O c2 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) +(\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: A).(\lambda (H9: (eq C c2 +(CHead x0 (Bind Abst) x1))).(\lambda (H10: (csuba g x0 c)).(\lambda (_: +(arity g x0 x1 (asucc g x2))).(\lambda (_: (arity g c t x2)).(eq_ind_r C +(CHead x0 (Bind Abst) x1) (\lambda (c0: C).(or (ex2 C (\lambda (d2: C).(drop +(S n) O c0 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +c0 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))))) (let H13 \def (H c d1 u1 H6 g x0 H10) in +(or_ind (ex2 C (\lambda (d2: C).(drop n O x0 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop n O x0 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) (or (ex2 C +(\lambda (d2: C).(drop (S n) O (CHead x0 (Bind Abst) x1) (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 (Bind Abst) x1) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (H14: (ex2 C (\lambda (d2: C).(drop n +O x0 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)))).(ex2_ind +C (\lambda (d2: C).(drop n O x0 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1)) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Bind +Abst) x1) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O +(CHead x0 (Bind Abst) x1) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (x: +C).(\lambda (H15: (drop n O x0 (CHead x (Bind Abbr) u1))).(\lambda (H16: +(csuba g x d1)).(let H17 \def (refl_equal nat (r (Bind Abst) n)) in (let H18 +\def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x0 (CHead x (Bind Abbr) +u1))) H15 (r (Bind Abst) n) H17) in (or_introl (ex2 C (\lambda (d2: C).(drop +(S n) O (CHead x0 (Bind Abst) x1) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x0 (Bind Abst) x1) (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) +(ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Bind Abst) x1) (CHead +d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)) x (drop_drop (Bind +Abst) n x0 (CHead x (Bind Abbr) u1) H18 x1) H16))))))) H14)) (\lambda (H14: +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O x0 +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop n O x0 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))) (or (ex2 C +(\lambda (d2: C).(drop (S n) O (CHead x0 (Bind Abst) x1) (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 (Bind Abst) x1) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (x3: C).(\lambda (x4: T).(\lambda (x5: +A).(\lambda (H15: (drop n O x0 (CHead x3 (Bind Abst) x4))).(\lambda (H16: +(csuba g x3 d1)).(\lambda (H17: (arity g x3 x4 (asucc g x5))).(\lambda (H18: +(arity g d1 u1 x5)).(let H19 \def (refl_equal nat (r (Bind Abst) n)) in (let +H20 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x0 (CHead x3 (Bind Abst) +x4))) H15 (r (Bind Abst) n) H19) in (or_intror (ex2 C (\lambda (d2: C).(drop +(S n) O (CHead x0 (Bind Abst) x1) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x0 (Bind Abst) x1) (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) +(ex4_3_intro C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S +n) O (CHead x0 (Bind Abst) x1) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))) x3 x4 x5 +(drop_drop (Bind Abst) n x0 (CHead x3 (Bind Abst) x4) H20 x1) H16 H17 +H18))))))))))) H14)) H13)) c2 H9)))))))) H8)) H7))))) (\lambda (H5: (csuba g +c2 (CHead c (Bind Abst) t))).(\lambda (H6: (drop (r (Bind Abst) n) O c (CHead +d1 (Bind Abbr) u1))).(let H_x \def (csuba_gen_abst_rev g c c2 t H5) in (let +H7 \def H_x in (ex2_ind C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind Abst) +t))) (\lambda (d2: C).(csuba g d2 c)) (or (ex2 C (\lambda (d2: C).(drop (S n) +O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead +d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (x: C).(\lambda (H8: (eq C c2 (CHead x +(Bind Abst) t))).(\lambda (H9: (csuba g x c)).(eq_ind_r C (CHead x (Bind +Abst) t) (\lambda (c0: C).(or (ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead +d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c0 (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a))))))) (let H10 \def (H c d1 u1 H6 g x H9) in (or_ind (ex2 C (\lambda +(d2: C).(drop n O x (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n +O x (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead +x (Bind Abst) t) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S +n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (H11: +(ex2 C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1)))).(ex2_ind C (\lambda (d2: C).(drop n O x (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)) (or (ex2 C (\lambda (d2: +C).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abbr) u1))) (\lambda +(d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))) (\lambda (x0: C).(\lambda (H12: (drop n O x (CHead x0 (Bind Abbr) +u1))).(\lambda (H13: (csuba g x0 d1)).(let H14 \def (refl_equal nat (r (Bind +Abst) n)) in (let H15 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x +(CHead x0 (Bind Abbr) u1))) H12 (r (Bind Abst) n) H14) in (or_introl (ex2 C +(\lambda (d2: C).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Abst) t) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))) (ex_intro2 C (\lambda (d2: C).(drop (S n) O +(CHead x (Bind Abst) t) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g +d2 d1)) x0 (drop_drop (Bind Abst) n x (CHead x0 (Bind Abbr) u1) H15 t) +H13))))))) H11)) (\lambda (H11: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop n O x (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))).(ex4_3_ind C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O x (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Abst) t) +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x +(Bind Abst) t) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (x2: A).(\lambda (H12: (drop n O x (CHead x0 (Bind Abst) +x1))).(\lambda (H13: (csuba g x0 d1)).(\lambda (H14: (arity g x0 x1 (asucc g +x2))).(\lambda (H15: (arity g d1 u1 x2)).(let H16 \def (refl_equal nat (r +(Bind Abst) n)) in (let H17 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 O +x (CHead x0 (Bind Abst) x1))) H12 (r (Bind Abst) n) H16) in (or_intror (ex2 C +(\lambda (d2: C).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Abst) t) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))) (ex4_3_intro C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Abst) t) (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))) x0 x1 x2 (drop_drop (Bind Abst) n x (CHead x0 (Bind Abst) x1) H17 t) +H13 H14 H15))))))))))) H11)) H10)) c2 H8)))) H7))))) (\lambda (H5: (csuba g +c2 (CHead c (Bind Void) t))).(\lambda (H6: (drop (r (Bind Void) n) O c (CHead +d1 (Bind Abbr) u1))).(let H_x \def (csuba_gen_void_rev g c c2 t H5) in (let +H7 \def H_x in (ex2_ind C (\lambda (d2: C).(eq C c2 (CHead d2 (Bind Void) +t))) (\lambda (d2: C).(csuba g d2 c)) (or (ex2 C (\lambda (d2: C).(drop (S n) +O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead +d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (x: C).(\lambda (H8: (eq C c2 (CHead x +(Bind Void) t))).(\lambda (H9: (csuba g x c)).(eq_ind_r C (CHead x (Bind +Void) t) (\lambda (c0: C).(or (ex2 C (\lambda (d2: C).(drop (S n) O c0 (CHead +d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c0 (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a))))))) (let H10 \def (H c d1 u1 H6 g x H9) in (or_ind (ex2 C (\lambda +(d2: C).(drop n O x (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n +O x (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead +x (Bind Void) t) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S +n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (H11: +(ex2 C (\lambda (d2: C).(drop n O x (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1)))).(ex2_ind C (\lambda (d2: C).(drop n O x (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)) (or (ex2 C (\lambda (d2: +C).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abbr) u1))) (\lambda +(d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))) (\lambda (x0: C).(\lambda (H12: (drop n O x (CHead x0 (Bind Abbr) +u1))).(\lambda (H13: (csuba g x0 d1)).(let H14 \def (refl_equal nat (r (Bind +Abst) n)) in (let H15 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 O x +(CHead x0 (Bind Abbr) u1))) H12 (r (Bind Abst) n) H14) in (or_introl (ex2 C +(\lambda (d2: C).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Void) t) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))) (ex_intro2 C (\lambda (d2: C).(drop (S n) O +(CHead x (Bind Void) t) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g +d2 d1)) x0 (drop_drop (Bind Void) n x (CHead x0 (Bind Abbr) u1) H15 t) +H13))))))) H11)) (\lambda (H11: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop n O x (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))).(ex4_3_ind C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop n O x (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))) (or (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x (Bind Void) t) +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x +(Bind Void) t) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (x2: A).(\lambda (H12: (drop n O x (CHead x0 (Bind Abst) +x1))).(\lambda (H13: (csuba g x0 d1)).(\lambda (H14: (arity g x0 x1 (asucc g +x2))).(\lambda (H15: (arity g d1 u1 x2)).(let H16 \def (refl_equal nat (r +(Bind Abst) n)) in (let H17 \def (eq_ind nat n (\lambda (n0: nat).(drop n0 O +x (CHead x0 (Bind Abst) x1))) H12 (r (Bind Abst) n) H16) in (or_intror (ex2 C +(\lambda (d2: C).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Void) t) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))) (ex4_3_intro C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop (S n) O (CHead x (Bind Void) t) (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))) x0 x1 x2 (drop_drop (Bind Void) n x (CHead x0 (Bind Abst) x1) H17 t) +H13 H14 H15))))))))))) H11)) H10)) c2 H8)))) H7))))) b H3 H4)))) (\lambda (f: +F).(\lambda (H3: (csuba g c2 (CHead c (Flat f) t))).(\lambda (H4: (drop (r +(Flat f) n) O c (CHead d1 (Bind Abbr) u1))).(let H_x \def (csuba_gen_flat_rev +g c c2 t f H3) in (let H5 \def H_x in (ex2_2_ind C T (\lambda (d2: +C).(\lambda (u2: T).(eq C c2 (CHead d2 (Flat f) u2)))) (\lambda (d2: +C).(\lambda (_: T).(csuba g d2 c))) (or (ex2 C (\lambda (d2: C).(drop (S n) O +c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c2 (CHead +d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H6: +(eq C c2 (CHead x0 (Flat f) x1))).(\lambda (H7: (csuba g x0 c)).(eq_ind_r C +(CHead x0 (Flat f) x1) (\lambda (c0: C).(or (ex2 C (\lambda (d2: C).(drop (S +n) O c0 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 +C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O c0 +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))))) (let H8 \def (H0 d1 u1 H4 g x0 H7) in (or_ind +(ex2 C (\lambda (d2: C).(drop (S n) O x0 (CHead d2 (Bind Abbr) u1))) (\lambda +(d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop (S n) O x0 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) (or (ex2 C +(\lambda (d2: C).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 (Flat f) x1) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (H9: (ex2 C (\lambda (d2: C).(drop (S +n) O x0 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1)))).(ex2_ind C (\lambda (d2: C).(drop (S n) O x0 (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1)) (or (ex2 C (\lambda (d2: C).(drop (S +n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) +(\lambda (x: C).(\lambda (H10: (drop (S n) O x0 (CHead x (Bind Abbr) +u1))).(\lambda (H11: (csuba g x d1)).(or_introl (ex2 C (\lambda (d2: C).(drop +(S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) +(ex_intro2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 +(Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)) x (drop_drop (Flat f) n +x0 (CHead x (Bind Abbr) u1) H10 x1) H11))))) H9)) (\lambda (H9: (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O x0 (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(drop (S n) O x0 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda +(_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))) (or (ex2 C (\lambda (d2: C).(drop +(S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(drop (S n) O (CHead x0 (Flat f) x1) (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) +(\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: A).(\lambda (H10: (drop (S n) +O x0 (CHead x2 (Bind Abst) x3))).(\lambda (H11: (csuba g x2 d1)).(\lambda +(H12: (arity g x2 x3 (asucc g x4))).(\lambda (H13: (arity g d1 u1 +x4)).(or_intror (ex2 C (\lambda (d2: C).(drop (S n) O (CHead x0 (Flat f) x1) +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 +(Flat f) x1) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a))))) (ex4_3_intro C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(drop (S n) O (CHead x0 (Flat f) x1) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))) x2 x3 x4 (drop_drop (Flat f) n x0 (CHead x2 (Bind +Abst) x3) H10 x1) H11 H12 H13))))))))) H9)) H8)) c2 H6))))) H5)))))) k H2 +(drop_gen_drop k c (CHead d1 (Bind Abbr) u1) t n H1)))))))))))) c1)))) i). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/fwd.ma new file mode 100644 index 000000000..2b56bc7a0 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/fwd.ma @@ -0,0 +1,843 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csuba/fwd". + +include "csuba/defs.ma". + +theorem csuba_gen_abbr: + \forall (g: G).(\forall (d1: C).(\forall (c: C).(\forall (u: T).((csuba g +(CHead d1 (Bind Abbr) u) c) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 +(Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))))))) +\def + \lambda (g: G).(\lambda (d1: C).(\lambda (c: C).(\lambda (u: T).(\lambda (H: +(csuba g (CHead d1 (Bind Abbr) u) c)).(let H0 \def (match H in csuba return +(\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csuba ? c0 c1)).((eq C c0 +(CHead d1 (Bind Abbr) u)) \to ((eq C c1 c) \to (ex2 C (\lambda (d2: C).(eq C +c (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)))))))) with +[(csuba_sort n) \Rightarrow (\lambda (H0: (eq C (CSort n) (CHead d1 (Bind +Abbr) u))).(\lambda (H1: (eq C (CSort n) c)).((let H2 \def (eq_ind C (CSort +n) (\lambda (e: C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow True | (CHead _ _ _) \Rightarrow False])) I (CHead d1 (Bind Abbr) +u) H0) in (False_ind ((eq C (CSort n) c) \to (ex2 C (\lambda (d2: C).(eq C c +(CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)))) H2)) H1))) | +(csuba_head c1 c2 H0 k u0) \Rightarrow (\lambda (H1: (eq C (CHead c1 k u0) +(CHead d1 (Bind Abbr) u))).(\lambda (H2: (eq C (CHead c2 k u0) c)).((let H3 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u0 | (CHead _ _ t) \Rightarrow t])) (CHead c1 k +u0) (CHead d1 (Bind Abbr) u) H1) in ((let H4 \def (f_equal C K (\lambda (e: +C).(match e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | +(CHead _ k0 _) \Rightarrow k0])) (CHead c1 k u0) (CHead d1 (Bind Abbr) u) H1) +in ((let H5 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow c1 | (CHead c0 _ _) \Rightarrow c0])) +(CHead c1 k u0) (CHead d1 (Bind Abbr) u) H1) in (eq_ind C d1 (\lambda (c0: +C).((eq K k (Bind Abbr)) \to ((eq T u0 u) \to ((eq C (CHead c2 k u0) c) \to +((csuba g c0 c2) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 (Bind Abbr) +u))) (\lambda (d2: C).(csuba g d1 d2)))))))) (\lambda (H6: (eq K k (Bind +Abbr))).(eq_ind K (Bind Abbr) (\lambda (k0: K).((eq T u0 u) \to ((eq C (CHead +c2 k0 u0) c) \to ((csuba g d1 c2) \to (ex2 C (\lambda (d2: C).(eq C c (CHead +d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))))))) (\lambda (H7: (eq +T u0 u)).(eq_ind T u (\lambda (t: T).((eq C (CHead c2 (Bind Abbr) t) c) \to +((csuba g d1 c2) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 (Bind Abbr) +u))) (\lambda (d2: C).(csuba g d1 d2)))))) (\lambda (H8: (eq C (CHead c2 +(Bind Abbr) u) c)).(eq_ind C (CHead c2 (Bind Abbr) u) (\lambda (c0: +C).((csuba g d1 c2) \to (ex2 C (\lambda (d2: C).(eq C c0 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))))) (\lambda (H9: (csuba g d1 +c2)).(ex_intro2 C (\lambda (d2: C).(eq C (CHead c2 (Bind Abbr) u) (CHead d2 +(Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)) c2 (refl_equal C (CHead c2 +(Bind Abbr) u)) H9)) c H8)) u0 (sym_eq T u0 u H7))) k (sym_eq K k (Bind Abbr) +H6))) c1 (sym_eq C c1 d1 H5))) H4)) H3)) H2 H0))) | (csuba_abst c1 c2 H0 t a +H1 u0 H2) \Rightarrow (\lambda (H3: (eq C (CHead c1 (Bind Abst) t) (CHead d1 +(Bind Abbr) u))).(\lambda (H4: (eq C (CHead c2 (Bind Abbr) u0) c)).((let H5 +\def (eq_ind C (CHead c1 (Bind Abst) t) (\lambda (e: C).(match e in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead d1 (Bind Abbr) u) H3) in (False_ind ((eq C +(CHead c2 (Bind Abbr) u0) c) \to ((csuba g c1 c2) \to ((arity g c1 t (asucc g +a)) \to ((arity g c2 u0 a) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 +(Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))))))) H5)) H4 H0 H1 H2)))]) +in (H0 (refl_equal C (CHead d1 (Bind Abbr) u)) (refl_equal C c))))))). + +theorem csuba_gen_void: + \forall (g: G).(\forall (d1: C).(\forall (c: C).(\forall (u: T).((csuba g +(CHead d1 (Bind Void) u) c) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 +(Bind Void) u))) (\lambda (d2: C).(csuba g d1 d2))))))) +\def + \lambda (g: G).(\lambda (d1: C).(\lambda (c: C).(\lambda (u: T).(\lambda (H: +(csuba g (CHead d1 (Bind Void) u) c)).(let H0 \def (match H in csuba return +(\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csuba ? c0 c1)).((eq C c0 +(CHead d1 (Bind Void) u)) \to ((eq C c1 c) \to (ex2 C (\lambda (d2: C).(eq C +c (CHead d2 (Bind Void) u))) (\lambda (d2: C).(csuba g d1 d2)))))))) with +[(csuba_sort n) \Rightarrow (\lambda (H0: (eq C (CSort n) (CHead d1 (Bind +Void) u))).(\lambda (H1: (eq C (CSort n) c)).((let H2 \def (eq_ind C (CSort +n) (\lambda (e: C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow True | (CHead _ _ _) \Rightarrow False])) I (CHead d1 (Bind Void) +u) H0) in (False_ind ((eq C (CSort n) c) \to (ex2 C (\lambda (d2: C).(eq C c +(CHead d2 (Bind Void) u))) (\lambda (d2: C).(csuba g d1 d2)))) H2)) H1))) | +(csuba_head c1 c2 H0 k u0) \Rightarrow (\lambda (H1: (eq C (CHead c1 k u0) +(CHead d1 (Bind Void) u))).(\lambda (H2: (eq C (CHead c2 k u0) c)).((let H3 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u0 | (CHead _ _ t) \Rightarrow t])) (CHead c1 k +u0) (CHead d1 (Bind Void) u) H1) in ((let H4 \def (f_equal C K (\lambda (e: +C).(match e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | +(CHead _ k0 _) \Rightarrow k0])) (CHead c1 k u0) (CHead d1 (Bind Void) u) H1) +in ((let H5 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow c1 | (CHead c0 _ _) \Rightarrow c0])) +(CHead c1 k u0) (CHead d1 (Bind Void) u) H1) in (eq_ind C d1 (\lambda (c0: +C).((eq K k (Bind Void)) \to ((eq T u0 u) \to ((eq C (CHead c2 k u0) c) \to +((csuba g c0 c2) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 (Bind Void) +u))) (\lambda (d2: C).(csuba g d1 d2)))))))) (\lambda (H6: (eq K k (Bind +Void))).(eq_ind K (Bind Void) (\lambda (k0: K).((eq T u0 u) \to ((eq C (CHead +c2 k0 u0) c) \to ((csuba g d1 c2) \to (ex2 C (\lambda (d2: C).(eq C c (CHead +d2 (Bind Void) u))) (\lambda (d2: C).(csuba g d1 d2))))))) (\lambda (H7: (eq +T u0 u)).(eq_ind T u (\lambda (t: T).((eq C (CHead c2 (Bind Void) t) c) \to +((csuba g d1 c2) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 (Bind Void) +u))) (\lambda (d2: C).(csuba g d1 d2)))))) (\lambda (H8: (eq C (CHead c2 +(Bind Void) u) c)).(eq_ind C (CHead c2 (Bind Void) u) (\lambda (c0: +C).((csuba g d1 c2) \to (ex2 C (\lambda (d2: C).(eq C c0 (CHead d2 (Bind +Void) u))) (\lambda (d2: C).(csuba g d1 d2))))) (\lambda (H9: (csuba g d1 +c2)).(ex_intro2 C (\lambda (d2: C).(eq C (CHead c2 (Bind Void) u) (CHead d2 +(Bind Void) u))) (\lambda (d2: C).(csuba g d1 d2)) c2 (refl_equal C (CHead c2 +(Bind Void) u)) H9)) c H8)) u0 (sym_eq T u0 u H7))) k (sym_eq K k (Bind Void) +H6))) c1 (sym_eq C c1 d1 H5))) H4)) H3)) H2 H0))) | (csuba_abst c1 c2 H0 t a +H1 u0 H2) \Rightarrow (\lambda (H3: (eq C (CHead c1 (Bind Abst) t) (CHead d1 +(Bind Void) u))).(\lambda (H4: (eq C (CHead c2 (Bind Abbr) u0) c)).((let H5 +\def (eq_ind C (CHead c1 (Bind Abst) t) (\lambda (e: C).(match e in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead d1 (Bind Void) u) H3) in (False_ind ((eq C +(CHead c2 (Bind Abbr) u0) c) \to ((csuba g c1 c2) \to ((arity g c1 t (asucc g +a)) \to ((arity g c2 u0 a) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 +(Bind Void) u))) (\lambda (d2: C).(csuba g d1 d2))))))) H5)) H4 H0 H1 H2)))]) +in (H0 (refl_equal C (CHead d1 (Bind Void) u)) (refl_equal C c))))))). + +theorem csuba_gen_abst: + \forall (g: G).(\forall (d1: C).(\forall (c: C).(\forall (u1: T).((csuba g +(CHead d1 (Bind Abst) u1) c) \to (or (ex2 C (\lambda (d2: C).(eq C c (CHead +d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))))))) +\def + \lambda (g: G).(\lambda (d1: C).(\lambda (c: C).(\lambda (u1: T).(\lambda +(H: (csuba g (CHead d1 (Bind Abst) u1) c)).(let H0 \def (match H in csuba +return (\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csuba ? c0 c1)).((eq C +c0 (CHead d1 (Bind Abst) u1)) \to ((eq C c1 c) \to (or (ex2 C (\lambda (d2: +C).(eq C c (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c (CHead +d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a))))))))))) with [(csuba_sort n) \Rightarrow (\lambda (H0: +(eq C (CSort n) (CHead d1 (Bind Abst) u1))).(\lambda (H1: (eq C (CSort n) +c)).((let H2 \def (eq_ind C (CSort n) (\lambda (e: C).(match e in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) +\Rightarrow False])) I (CHead d1 (Bind Abst) u1) H0) in (False_ind ((eq C +(CSort n) c) \to (or (ex2 C (\lambda (d2: C).(eq C c (CHead d2 (Bind Abst) +u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(eq C c (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))))) +H2)) H1))) | (csuba_head c1 c2 H0 k u) \Rightarrow (\lambda (H1: (eq C (CHead +c1 k u) (CHead d1 (Bind Abst) u1))).(\lambda (H2: (eq C (CHead c2 k u) +c)).((let H3 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda +(_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow t])) +(CHead c1 k u) (CHead d1 (Bind Abst) u1) H1) in ((let H4 \def (f_equal C K +(\lambda (e: C).(match e in C return (\lambda (_: C).K) with [(CSort _) +\Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) (CHead c1 k u) (CHead d1 +(Bind Abst) u1) H1) in ((let H5 \def (f_equal C C (\lambda (e: C).(match e in +C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c1 | (CHead c0 _ _) +\Rightarrow c0])) (CHead c1 k u) (CHead d1 (Bind Abst) u1) H1) in (eq_ind C +d1 (\lambda (c0: C).((eq K k (Bind Abst)) \to ((eq T u u1) \to ((eq C (CHead +c2 k u) c) \to ((csuba g c0 c2) \to (or (ex2 C (\lambda (d2: C).(eq C c +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c (CHead d2 (Bind +Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 +d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc +g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))))))) (\lambda (H6: (eq K k (Bind Abst))).(eq_ind K (Bind Abst) +(\lambda (k0: K).((eq T u u1) \to ((eq C (CHead c2 k0 u) c) \to ((csuba g d1 +c2) \to (or (ex2 C (\lambda (d2: C).(eq C c (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(eq C c (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))))))) (\lambda +(H7: (eq T u u1)).(eq_ind T u1 (\lambda (t: T).((eq C (CHead c2 (Bind Abst) +t) c) \to ((csuba g d1 c2) \to (or (ex2 C (\lambda (d2: C).(eq C c (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))))) (\lambda (H8: (eq C (CHead c2 (Bind Abst) u1) c)).(eq_ind C (CHead +c2 (Bind Abst) u1) (\lambda (c0: C).((csuba g d1 c2) \to (or (ex2 C (\lambda +(d2: C).(eq C c0 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c0 +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a)))))))) (\lambda (H9: (csuba g d1 c2)).(or_introl (ex2 C +(\lambda (d2: C).(eq C (CHead c2 (Bind Abst) u1) (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(eq C (CHead c2 (Bind Abst) u1) (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))) (ex_intro2 C (\lambda (d2: C).(eq C (CHead c2 (Bind Abst) u1) (CHead +d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) c2 (refl_equal C +(CHead c2 (Bind Abst) u1)) H9))) c H8)) u (sym_eq T u u1 H7))) k (sym_eq K k +(Bind Abst) H6))) c1 (sym_eq C c1 d1 H5))) H4)) H3)) H2 H0))) | (csuba_abst +c1 c2 H0 t a H1 u H2) \Rightarrow (\lambda (H3: (eq C (CHead c1 (Bind Abst) +t) (CHead d1 (Bind Abst) u1))).(\lambda (H4: (eq C (CHead c2 (Bind Abbr) u) +c)).((let H5 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda +(_: C).T) with [(CSort _) \Rightarrow t | (CHead _ _ t0) \Rightarrow t0])) +(CHead c1 (Bind Abst) t) (CHead d1 (Bind Abst) u1) H3) in ((let H6 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c1 | (CHead c0 _ _) \Rightarrow c0])) (CHead c1 (Bind +Abst) t) (CHead d1 (Bind Abst) u1) H3) in (eq_ind C d1 (\lambda (c0: C).((eq +T t u1) \to ((eq C (CHead c2 (Bind Abbr) u) c) \to ((csuba g c0 c2) \to +((arity g c0 t (asucc g a)) \to ((arity g c2 u a) \to (or (ex2 C (\lambda +(d2: C).(eq C c (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a0: A).(arity +g d1 u1 (asucc g a0))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a0: +A).(arity g d2 u2 a0)))))))))))) (\lambda (H7: (eq T t u1)).(eq_ind T u1 +(\lambda (t0: T).((eq C (CHead c2 (Bind Abbr) u) c) \to ((csuba g d1 c2) \to +((arity g d1 t0 (asucc g a)) \to ((arity g c2 u a) \to (or (ex2 C (\lambda +(d2: C).(eq C c (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a0: A).(arity +g d1 u1 (asucc g a0))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a0: +A).(arity g d2 u2 a0))))))))))) (\lambda (H8: (eq C (CHead c2 (Bind Abbr) u) +c)).(eq_ind C (CHead c2 (Bind Abbr) u) (\lambda (c0: C).((csuba g d1 c2) \to +((arity g d1 u1 (asucc g a)) \to ((arity g c2 u a) \to (or (ex2 C (\lambda +(d2: C).(eq C c0 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c0 +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a0: A).(arity +g d1 u1 (asucc g a0))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a0: +A).(arity g d2 u2 a0)))))))))) (\lambda (H9: (csuba g d1 c2)).(\lambda (H10: +(arity g d1 u1 (asucc g a))).(\lambda (H11: (arity g c2 u a)).(or_intror (ex2 +C (\lambda (d2: C).(eq C (CHead c2 (Bind Abbr) u) (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(eq C (CHead c2 (Bind Abbr) u) (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a0: A).(arity g d1 u1 (asucc g +a0))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a0: A).(arity g d2 u2 +a0))))) (ex4_3_intro C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(eq C (CHead c2 (Bind Abbr) u) (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a0: A).(arity g d1 u1 (asucc g a0))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a0: A).(arity g d2 u2 a0)))) c2 u a +(refl_equal C (CHead c2 (Bind Abbr) u)) H9 H10 H11))))) c H8)) t (sym_eq T t +u1 H7))) c1 (sym_eq C c1 d1 H6))) H5)) H4 H0 H1 H2)))]) in (H0 (refl_equal C +(CHead d1 (Bind Abst) u1)) (refl_equal C c))))))). + +theorem csuba_gen_flat: + \forall (g: G).(\forall (d1: C).(\forall (c: C).(\forall (u1: T).(\forall +(f: F).((csuba g (CHead d1 (Flat f) u1) c) \to (ex2_2 C T (\lambda (d2: +C).(\lambda (u2: T).(eq C c (CHead d2 (Flat f) u2)))) (\lambda (d2: +C).(\lambda (_: T).(csuba g d1 d2))))))))) +\def + \lambda (g: G).(\lambda (d1: C).(\lambda (c: C).(\lambda (u1: T).(\lambda +(f: F).(\lambda (H: (csuba g (CHead d1 (Flat f) u1) c)).(let H0 \def (match H +in csuba return (\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csuba ? c0 +c1)).((eq C c0 (CHead d1 (Flat f) u1)) \to ((eq C c1 c) \to (ex2_2 C T +(\lambda (d2: C).(\lambda (u2: T).(eq C c (CHead d2 (Flat f) u2)))) (\lambda +(d2: C).(\lambda (_: T).(csuba g d1 d2))))))))) with [(csuba_sort n) +\Rightarrow (\lambda (H0: (eq C (CSort n) (CHead d1 (Flat f) u1))).(\lambda +(H1: (eq C (CSort n) c)).((let H2 \def (eq_ind C (CSort n) (\lambda (e: +C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow +True | (CHead _ _ _) \Rightarrow False])) I (CHead d1 (Flat f) u1) H0) in +(False_ind ((eq C (CSort n) c) \to (ex2_2 C T (\lambda (d2: C).(\lambda (u2: +T).(eq C c (CHead d2 (Flat f) u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba +g d1 d2))))) H2)) H1))) | (csuba_head c1 c2 H0 k u) \Rightarrow (\lambda (H1: +(eq C (CHead c1 k u) (CHead d1 (Flat f) u1))).(\lambda (H2: (eq C (CHead c2 k +u) c)).((let H3 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow +t])) (CHead c1 k u) (CHead d1 (Flat f) u1) H1) in ((let H4 \def (f_equal C K +(\lambda (e: C).(match e in C return (\lambda (_: C).K) with [(CSort _) +\Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) (CHead c1 k u) (CHead d1 +(Flat f) u1) H1) in ((let H5 \def (f_equal C C (\lambda (e: C).(match e in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow c1 | (CHead c0 _ _) +\Rightarrow c0])) (CHead c1 k u) (CHead d1 (Flat f) u1) H1) in (eq_ind C d1 +(\lambda (c0: C).((eq K k (Flat f)) \to ((eq T u u1) \to ((eq C (CHead c2 k +u) c) \to ((csuba g c0 c2) \to (ex2_2 C T (\lambda (d2: C).(\lambda (u2: +T).(eq C c (CHead d2 (Flat f) u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba +g d1 d2))))))))) (\lambda (H6: (eq K k (Flat f))).(eq_ind K (Flat f) (\lambda +(k0: K).((eq T u u1) \to ((eq C (CHead c2 k0 u) c) \to ((csuba g d1 c2) \to +(ex2_2 C T (\lambda (d2: C).(\lambda (u2: T).(eq C c (CHead d2 (Flat f) +u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g d1 d2)))))))) (\lambda (H7: +(eq T u u1)).(eq_ind T u1 (\lambda (t: T).((eq C (CHead c2 (Flat f) t) c) \to +((csuba g d1 c2) \to (ex2_2 C T (\lambda (d2: C).(\lambda (u2: T).(eq C c +(CHead d2 (Flat f) u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g d1 +d2))))))) (\lambda (H8: (eq C (CHead c2 (Flat f) u1) c)).(eq_ind C (CHead c2 +(Flat f) u1) (\lambda (c0: C).((csuba g d1 c2) \to (ex2_2 C T (\lambda (d2: +C).(\lambda (u2: T).(eq C c0 (CHead d2 (Flat f) u2)))) (\lambda (d2: +C).(\lambda (_: T).(csuba g d1 d2)))))) (\lambda (H9: (csuba g d1 +c2)).(ex2_2_intro C T (\lambda (d2: C).(\lambda (u2: T).(eq C (CHead c2 (Flat +f) u1) (CHead d2 (Flat f) u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g d1 +d2))) c2 u1 (refl_equal C (CHead c2 (Flat f) u1)) H9)) c H8)) u (sym_eq T u +u1 H7))) k (sym_eq K k (Flat f) H6))) c1 (sym_eq C c1 d1 H5))) H4)) H3)) H2 +H0))) | (csuba_abst c1 c2 H0 t a H1 u H2) \Rightarrow (\lambda (H3: (eq C +(CHead c1 (Bind Abst) t) (CHead d1 (Flat f) u1))).(\lambda (H4: (eq C (CHead +c2 (Bind Abbr) u) c)).((let H5 \def (eq_ind C (CHead c1 (Bind Abst) t) +(\lambda (e: C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow True | (Flat _) \Rightarrow +False])])) I (CHead d1 (Flat f) u1) H3) in (False_ind ((eq C (CHead c2 (Bind +Abbr) u) c) \to ((csuba g c1 c2) \to ((arity g c1 t (asucc g a)) \to ((arity +g c2 u a) \to (ex2_2 C T (\lambda (d2: C).(\lambda (u2: T).(eq C c (CHead d2 +(Flat f) u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g d1 d2)))))))) H5)) +H4 H0 H1 H2)))]) in (H0 (refl_equal C (CHead d1 (Flat f) u1)) (refl_equal C +c)))))))). + +theorem csuba_gen_bind: + \forall (g: G).(\forall (b1: B).(\forall (e1: C).(\forall (c2: C).(\forall +(v1: T).((csuba g (CHead e1 (Bind b1) v1) c2) \to (ex2_3 B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 e2)))))))))) +\def + \lambda (g: G).(\lambda (b1: B).(\lambda (e1: C).(\lambda (c2: C).(\lambda +(v1: T).(\lambda (H: (csuba g (CHead e1 (Bind b1) v1) c2)).(let H0 \def +(match H in csuba return (\lambda (c: C).(\lambda (c0: C).(\lambda (_: (csuba +? c c0)).((eq C c (CHead e1 (Bind b1) v1)) \to ((eq C c0 c2) \to (ex2_3 B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind +b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 +e2)))))))))) with [(csuba_sort n) \Rightarrow (\lambda (H0: (eq C (CSort n) +(CHead e1 (Bind b1) v1))).(\lambda (H1: (eq C (CSort n) c2)).((let H2 \def +(eq_ind C (CSort n) (\lambda (e: C).(match e in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow +False])) I (CHead e1 (Bind b1) v1) H0) in (False_ind ((eq C (CSort n) c2) \to +(ex2_3 B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 +(CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: +T).(csuba g e1 e2)))))) H2)) H1))) | (csuba_head c1 c0 H0 k u) \Rightarrow +(\lambda (H1: (eq C (CHead c1 k u) (CHead e1 (Bind b1) v1))).(\lambda (H2: +(eq C (CHead c0 k u) c2)).((let H3 \def (f_equal C T (\lambda (e: C).(match e +in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t) +\Rightarrow t])) (CHead c1 k u) (CHead e1 (Bind b1) v1) H1) in ((let H4 \def +(f_equal C K (\lambda (e: C).(match e in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) (CHead c1 k u) +(CHead e1 (Bind b1) v1) H1) in ((let H5 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c1 | +(CHead c _ _) \Rightarrow c])) (CHead c1 k u) (CHead e1 (Bind b1) v1) H1) in +(eq_ind C e1 (\lambda (c: C).((eq K k (Bind b1)) \to ((eq T u v1) \to ((eq C +(CHead c0 k u) c2) \to ((csuba g c c0) \to (ex2_3 B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 e2)))))))))) +(\lambda (H6: (eq K k (Bind b1))).(eq_ind K (Bind b1) (\lambda (k0: K).((eq T +u v1) \to ((eq C (CHead c0 k0 u) c2) \to ((csuba g e1 c0) \to (ex2_3 B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind +b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 +e2))))))))) (\lambda (H7: (eq T u v1)).(eq_ind T v1 (\lambda (t: T).((eq C +(CHead c0 (Bind b1) t) c2) \to ((csuba g e1 c0) \to (ex2_3 B C T (\lambda +(b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind b2) +v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 +e2)))))))) (\lambda (H8: (eq C (CHead c0 (Bind b1) v1) c2)).(eq_ind C (CHead +c0 (Bind b1) v1) (\lambda (c: C).((csuba g e1 c0) \to (ex2_3 B C T (\lambda +(b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 e2))))))) +(\lambda (H9: (csuba g e1 c0)).(let H10 \def (eq_ind_r C c2 (\lambda (c: +C).(csuba g (CHead e1 (Bind b1) v1) c)) H (CHead c0 (Bind b1) v1) H8) in +(ex2_3_intro B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C +(CHead c0 (Bind b1) v1) (CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda +(e2: C).(\lambda (_: T).(csuba g e1 e2)))) b1 c0 v1 (refl_equal C (CHead c0 +(Bind b1) v1)) H9))) c2 H8)) u (sym_eq T u v1 H7))) k (sym_eq K k (Bind b1) +H6))) c1 (sym_eq C c1 e1 H5))) H4)) H3)) H2 H0))) | (csuba_abst c1 c0 H0 t a +H1 u H2) \Rightarrow (\lambda (H3: (eq C (CHead c1 (Bind Abst) t) (CHead e1 +(Bind b1) v1))).(\lambda (H4: (eq C (CHead c0 (Bind Abbr) u) c2)).((let H5 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow t | (CHead _ _ t0) \Rightarrow t0])) (CHead c1 +(Bind Abst) t) (CHead e1 (Bind b1) v1) H3) in ((let H6 \def (f_equal C B +(\lambda (e: C).(match e in C return (\lambda (_: C).B) with [(CSort _) +\Rightarrow Abst | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).B) with [(Bind b) \Rightarrow b | (Flat _) \Rightarrow Abst])])) +(CHead c1 (Bind Abst) t) (CHead e1 (Bind b1) v1) H3) in ((let H7 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c1 | (CHead c _ _) \Rightarrow c])) (CHead c1 (Bind +Abst) t) (CHead e1 (Bind b1) v1) H3) in (eq_ind C e1 (\lambda (c: C).((eq B +Abst b1) \to ((eq T t v1) \to ((eq C (CHead c0 (Bind Abbr) u) c2) \to ((csuba +g c c0) \to ((arity g c t (asucc g a)) \to ((arity g c0 u a) \to (ex2_3 B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind +b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 +e2)))))))))))) (\lambda (H8: (eq B Abst b1)).(eq_ind B Abst (\lambda (_: +B).((eq T t v1) \to ((eq C (CHead c0 (Bind Abbr) u) c2) \to ((csuba g e1 c0) +\to ((arity g e1 t (asucc g a)) \to ((arity g c0 u a) \to (ex2_3 B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind +b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 +e2))))))))))) (\lambda (H9: (eq T t v1)).(eq_ind T v1 (\lambda (t0: T).((eq C +(CHead c0 (Bind Abbr) u) c2) \to ((csuba g e1 c0) \to ((arity g e1 t0 (asucc +g a)) \to ((arity g c0 u a) \to (ex2_3 B C T (\lambda (b2: B).(\lambda (e2: +C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind b2) v2))))) (\lambda (_: +B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 e2)))))))))) (\lambda (H10: +(eq C (CHead c0 (Bind Abbr) u) c2)).(eq_ind C (CHead c0 (Bind Abbr) u) +(\lambda (c: C).((csuba g e1 c0) \to ((arity g e1 v1 (asucc g a)) \to ((arity +g c0 u a) \to (ex2_3 B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: +T).(eq C c (CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: +C).(\lambda (_: T).(csuba g e1 e2))))))))) (\lambda (H11: (csuba g e1 +c0)).(\lambda (_: (arity g e1 v1 (asucc g a))).(\lambda (_: (arity g c0 u +a)).(let H14 \def (eq_ind_r C c2 (\lambda (c: C).(csuba g (CHead e1 (Bind b1) +v1) c)) H (CHead c0 (Bind Abbr) u) H10) in (let H15 \def (eq_ind_r B b1 +(\lambda (b: B).(csuba g (CHead e1 (Bind b) v1) (CHead c0 (Bind Abbr) u))) +H14 Abst H8) in (ex2_3_intro B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda +(v2: T).(eq C (CHead c0 (Bind Abbr) u) (CHead e2 (Bind b2) v2))))) (\lambda +(_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e1 e2)))) Abbr c0 u +(refl_equal C (CHead c0 (Bind Abbr) u)) H11)))))) c2 H10)) t (sym_eq T t v1 +H9))) b1 H8)) c1 (sym_eq C c1 e1 H7))) H6)) H5)) H4 H0 H1 H2)))]) in (H0 +(refl_equal C (CHead e1 (Bind b1) v1)) (refl_equal C c2)))))))). + +theorem csuba_gen_abst_rev: + \forall (g: G).(\forall (d1: C).(\forall (c: C).(\forall (u: T).((csuba g c +(CHead d1 (Bind Abst) u)) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1))))))) +\def + \lambda (g: G).(\lambda (d1: C).(\lambda (c: C).(\lambda (u: T).(\lambda (H: +(csuba g c (CHead d1 (Bind Abst) u))).(let H0 \def (match H in csuba return +(\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csuba ? c0 c1)).((eq C c0 c) +\to ((eq C c1 (CHead d1 (Bind Abst) u)) \to (ex2 C (\lambda (d2: C).(eq C c +(CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)))))))) with +[(csuba_sort n) \Rightarrow (\lambda (H0: (eq C (CSort n) c)).(\lambda (H1: +(eq C (CSort n) (CHead d1 (Bind Abst) u))).(eq_ind C (CSort n) (\lambda (c0: +C).((eq C (CSort n) (CHead d1 (Bind Abst) u)) \to (ex2 C (\lambda (d2: C).(eq +C c0 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))))) (\lambda +(H2: (eq C (CSort n) (CHead d1 (Bind Abst) u))).(let H3 \def (eq_ind C (CSort +n) (\lambda (e: C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow True | (CHead _ _ _) \Rightarrow False])) I (CHead d1 (Bind Abst) +u) H2) in (False_ind (ex2 C (\lambda (d2: C).(eq C (CSort n) (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) H3))) c H0 H1))) | (csuba_head +c1 c2 H0 k u0) \Rightarrow (\lambda (H1: (eq C (CHead c1 k u0) c)).(\lambda +(H2: (eq C (CHead c2 k u0) (CHead d1 (Bind Abst) u))).(eq_ind C (CHead c1 k +u0) (\lambda (c0: C).((eq C (CHead c2 k u0) (CHead d1 (Bind Abst) u)) \to +((csuba g c1 c2) \to (ex2 C (\lambda (d2: C).(eq C c0 (CHead d2 (Bind Abst) +u))) (\lambda (d2: C).(csuba g d2 d1)))))) (\lambda (H3: (eq C (CHead c2 k +u0) (CHead d1 (Bind Abst) u))).(let H4 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | +(CHead _ _ t) \Rightarrow t])) (CHead c2 k u0) (CHead d1 (Bind Abst) u) H3) +in ((let H5 \def (f_equal C K (\lambda (e: C).(match e in C return (\lambda +(_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) +(CHead c2 k u0) (CHead d1 (Bind Abst) u) H3) in ((let H6 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow c2 | (CHead c0 _ _) \Rightarrow c0])) (CHead c2 k u0) (CHead d1 +(Bind Abst) u) H3) in (eq_ind C d1 (\lambda (c0: C).((eq K k (Bind Abst)) \to +((eq T u0 u) \to ((csuba g c1 c0) \to (ex2 C (\lambda (d2: C).(eq C (CHead c1 +k u0) (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))))))) +(\lambda (H7: (eq K k (Bind Abst))).(eq_ind K (Bind Abst) (\lambda (k0: +K).((eq T u0 u) \to ((csuba g c1 d1) \to (ex2 C (\lambda (d2: C).(eq C (CHead +c1 k0 u0) (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)))))) +(\lambda (H8: (eq T u0 u)).(eq_ind T u (\lambda (t: T).((csuba g c1 d1) \to +(ex2 C (\lambda (d2: C).(eq C (CHead c1 (Bind Abst) t) (CHead d2 (Bind Abst) +u))) (\lambda (d2: C).(csuba g d2 d1))))) (\lambda (H9: (csuba g c1 +d1)).(ex_intro2 C (\lambda (d2: C).(eq C (CHead c1 (Bind Abst) u) (CHead d2 +(Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) c1 (refl_equal C (CHead c1 +(Bind Abst) u)) H9)) u0 (sym_eq T u0 u H8))) k (sym_eq K k (Bind Abst) H7))) +c2 (sym_eq C c2 d1 H6))) H5)) H4))) c H1 H2 H0))) | (csuba_abst c1 c2 H0 t a +H1 u0 H2) \Rightarrow (\lambda (H3: (eq C (CHead c1 (Bind Abst) t) +c)).(\lambda (H4: (eq C (CHead c2 (Bind Abbr) u0) (CHead d1 (Bind Abst) +u))).(eq_ind C (CHead c1 (Bind Abst) t) (\lambda (c0: C).((eq C (CHead c2 +(Bind Abbr) u0) (CHead d1 (Bind Abst) u)) \to ((csuba g c1 c2) \to ((arity g +c1 t (asucc g a)) \to ((arity g c2 u0 a) \to (ex2 C (\lambda (d2: C).(eq C c0 +(CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)))))))) (\lambda +(H5: (eq C (CHead c2 (Bind Abbr) u0) (CHead d1 (Bind Abst) u))).(let H6 \def +(eq_ind C (CHead c2 (Bind Abbr) u0) (\lambda (e: C).(match e in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +True | Abst \Rightarrow False | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead d1 (Bind Abst) u) H5) in (False_ind ((csuba g +c1 c2) \to ((arity g c1 t (asucc g a)) \to ((arity g c2 u0 a) \to (ex2 C +(\lambda (d2: C).(eq C (CHead c1 (Bind Abst) t) (CHead d2 (Bind Abst) u))) +(\lambda (d2: C).(csuba g d2 d1)))))) H6))) c H3 H4 H0 H1 H2)))]) in (H0 +(refl_equal C c) (refl_equal C (CHead d1 (Bind Abst) u)))))))). + +theorem csuba_gen_void_rev: + \forall (g: G).(\forall (d1: C).(\forall (c: C).(\forall (u: T).((csuba g c +(CHead d1 (Bind Void) u)) \to (ex2 C (\lambda (d2: C).(eq C c (CHead d2 (Bind +Void) u))) (\lambda (d2: C).(csuba g d2 d1))))))) +\def + \lambda (g: G).(\lambda (d1: C).(\lambda (c: C).(\lambda (u: T).(\lambda (H: +(csuba g c (CHead d1 (Bind Void) u))).(let H0 \def (match H in csuba return +(\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csuba ? c0 c1)).((eq C c0 c) +\to ((eq C c1 (CHead d1 (Bind Void) u)) \to (ex2 C (\lambda (d2: C).(eq C c +(CHead d2 (Bind Void) u))) (\lambda (d2: C).(csuba g d2 d1)))))))) with +[(csuba_sort n) \Rightarrow (\lambda (H0: (eq C (CSort n) c)).(\lambda (H1: +(eq C (CSort n) (CHead d1 (Bind Void) u))).(eq_ind C (CSort n) (\lambda (c0: +C).((eq C (CSort n) (CHead d1 (Bind Void) u)) \to (ex2 C (\lambda (d2: C).(eq +C c0 (CHead d2 (Bind Void) u))) (\lambda (d2: C).(csuba g d2 d1))))) (\lambda +(H2: (eq C (CSort n) (CHead d1 (Bind Void) u))).(let H3 \def (eq_ind C (CSort +n) (\lambda (e: C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow True | (CHead _ _ _) \Rightarrow False])) I (CHead d1 (Bind Void) +u) H2) in (False_ind (ex2 C (\lambda (d2: C).(eq C (CSort n) (CHead d2 (Bind +Void) u))) (\lambda (d2: C).(csuba g d2 d1))) H3))) c H0 H1))) | (csuba_head +c1 c2 H0 k u0) \Rightarrow (\lambda (H1: (eq C (CHead c1 k u0) c)).(\lambda +(H2: (eq C (CHead c2 k u0) (CHead d1 (Bind Void) u))).(eq_ind C (CHead c1 k +u0) (\lambda (c0: C).((eq C (CHead c2 k u0) (CHead d1 (Bind Void) u)) \to +((csuba g c1 c2) \to (ex2 C (\lambda (d2: C).(eq C c0 (CHead d2 (Bind Void) +u))) (\lambda (d2: C).(csuba g d2 d1)))))) (\lambda (H3: (eq C (CHead c2 k +u0) (CHead d1 (Bind Void) u))).(let H4 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | +(CHead _ _ t) \Rightarrow t])) (CHead c2 k u0) (CHead d1 (Bind Void) u) H3) +in ((let H5 \def (f_equal C K (\lambda (e: C).(match e in C return (\lambda +(_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) +(CHead c2 k u0) (CHead d1 (Bind Void) u) H3) in ((let H6 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow c2 | (CHead c0 _ _) \Rightarrow c0])) (CHead c2 k u0) (CHead d1 +(Bind Void) u) H3) in (eq_ind C d1 (\lambda (c0: C).((eq K k (Bind Void)) \to +((eq T u0 u) \to ((csuba g c1 c0) \to (ex2 C (\lambda (d2: C).(eq C (CHead c1 +k u0) (CHead d2 (Bind Void) u))) (\lambda (d2: C).(csuba g d2 d1))))))) +(\lambda (H7: (eq K k (Bind Void))).(eq_ind K (Bind Void) (\lambda (k0: +K).((eq T u0 u) \to ((csuba g c1 d1) \to (ex2 C (\lambda (d2: C).(eq C (CHead +c1 k0 u0) (CHead d2 (Bind Void) u))) (\lambda (d2: C).(csuba g d2 d1)))))) +(\lambda (H8: (eq T u0 u)).(eq_ind T u (\lambda (t: T).((csuba g c1 d1) \to +(ex2 C (\lambda (d2: C).(eq C (CHead c1 (Bind Void) t) (CHead d2 (Bind Void) +u))) (\lambda (d2: C).(csuba g d2 d1))))) (\lambda (H9: (csuba g c1 +d1)).(ex_intro2 C (\lambda (d2: C).(eq C (CHead c1 (Bind Void) u) (CHead d2 +(Bind Void) u))) (\lambda (d2: C).(csuba g d2 d1)) c1 (refl_equal C (CHead c1 +(Bind Void) u)) H9)) u0 (sym_eq T u0 u H8))) k (sym_eq K k (Bind Void) H7))) +c2 (sym_eq C c2 d1 H6))) H5)) H4))) c H1 H2 H0))) | (csuba_abst c1 c2 H0 t a +H1 u0 H2) \Rightarrow (\lambda (H3: (eq C (CHead c1 (Bind Abst) t) +c)).(\lambda (H4: (eq C (CHead c2 (Bind Abbr) u0) (CHead d1 (Bind Void) +u))).(eq_ind C (CHead c1 (Bind Abst) t) (\lambda (c0: C).((eq C (CHead c2 +(Bind Abbr) u0) (CHead d1 (Bind Void) u)) \to ((csuba g c1 c2) \to ((arity g +c1 t (asucc g a)) \to ((arity g c2 u0 a) \to (ex2 C (\lambda (d2: C).(eq C c0 +(CHead d2 (Bind Void) u))) (\lambda (d2: C).(csuba g d2 d1)))))))) (\lambda +(H5: (eq C (CHead c2 (Bind Abbr) u0) (CHead d1 (Bind Void) u))).(let H6 \def +(eq_ind C (CHead c2 (Bind Abbr) u0) (\lambda (e: C).(match e in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +True | Abst \Rightarrow False | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead d1 (Bind Void) u) H5) in (False_ind ((csuba g +c1 c2) \to ((arity g c1 t (asucc g a)) \to ((arity g c2 u0 a) \to (ex2 C +(\lambda (d2: C).(eq C (CHead c1 (Bind Abst) t) (CHead d2 (Bind Void) u))) +(\lambda (d2: C).(csuba g d2 d1)))))) H6))) c H3 H4 H0 H1 H2)))]) in (H0 +(refl_equal C c) (refl_equal C (CHead d1 (Bind Void) u)))))))). + +theorem csuba_gen_abbr_rev: + \forall (g: G).(\forall (d1: C).(\forall (c: C).(\forall (u1: T).((csuba g c +(CHead d1 (Bind Abbr) u1)) \to (or (ex2 C (\lambda (d2: C).(eq C c (CHead d2 +(Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +a)))))))))) +\def + \lambda (g: G).(\lambda (d1: C).(\lambda (c: C).(\lambda (u1: T).(\lambda +(H: (csuba g c (CHead d1 (Bind Abbr) u1))).(let H0 \def (match H in csuba +return (\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csuba ? c0 c1)).((eq C +c0 c) \to ((eq C c1 (CHead d1 (Bind Abbr) u1)) \to (or (ex2 C (\lambda (d2: +C).(eq C c (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C c (CHead +d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))))))))) with [(csuba_sort n) \Rightarrow (\lambda +(H0: (eq C (CSort n) c)).(\lambda (H1: (eq C (CSort n) (CHead d1 (Bind Abbr) +u1))).(eq_ind C (CSort n) (\lambda (c0: C).((eq C (CSort n) (CHead d1 (Bind +Abbr) u1)) \to (or (ex2 C (\lambda (d2: C).(eq C c0 (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(eq C c0 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))))) +(\lambda (H2: (eq C (CSort n) (CHead d1 (Bind Abbr) u1))).(let H3 \def +(eq_ind C (CSort n) (\lambda (e: C).(match e in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow +False])) I (CHead d1 (Bind Abbr) u1) H2) in (False_ind (or (ex2 C (\lambda +(d2: C).(eq C (CSort n) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g +d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C +(CSort n) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))))) H3))) c H0 H1))) | (csuba_head +c1 c2 H0 k u) \Rightarrow (\lambda (H1: (eq C (CHead c1 k u) c)).(\lambda +(H2: (eq C (CHead c2 k u) (CHead d1 (Bind Abbr) u1))).(eq_ind C (CHead c1 k +u) (\lambda (c0: C).((eq C (CHead c2 k u) (CHead d1 (Bind Abbr) u1)) \to +((csuba g c1 c2) \to (or (ex2 C (\lambda (d2: C).(eq C c0 (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(eq C c0 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))))))) +(\lambda (H3: (eq C (CHead c2 k u) (CHead d1 (Bind Abbr) u1))).(let H4 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow t])) (CHead c2 k u) +(CHead d1 (Bind Abbr) u1) H3) in ((let H5 \def (f_equal C K (\lambda (e: +C).(match e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | +(CHead _ k0 _) \Rightarrow k0])) (CHead c2 k u) (CHead d1 (Bind Abbr) u1) H3) +in ((let H6 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow c2 | (CHead c0 _ _) \Rightarrow c0])) +(CHead c2 k u) (CHead d1 (Bind Abbr) u1) H3) in (eq_ind C d1 (\lambda (c0: +C).((eq K k (Bind Abbr)) \to ((eq T u u1) \to ((csuba g c1 c0) \to (or (ex2 C +(\lambda (d2: C).(eq C (CHead c1 k u) (CHead d2 (Bind Abbr) u1))) (\lambda +(d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(eq C (CHead c1 k u) (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))))))) +(\lambda (H7: (eq K k (Bind Abbr))).(eq_ind K (Bind Abbr) (\lambda (k0: +K).((eq T u u1) \to ((csuba g c1 d1) \to (or (ex2 C (\lambda (d2: C).(eq C +(CHead c1 k0 u) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C +(CHead c1 k0 u) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a))))))))) (\lambda (H8: (eq T u +u1)).(eq_ind T u1 (\lambda (t: T).((csuba g c1 d1) \to (or (ex2 C (\lambda +(d2: C).(eq C (CHead c1 (Bind Abbr) t) (CHead d2 (Bind Abbr) u1))) (\lambda +(d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(eq C (CHead c1 (Bind Abbr) t) (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +a)))))))) (\lambda (H9: (csuba g c1 d1)).(or_introl (ex2 C (\lambda (d2: +C).(eq C (CHead c1 (Bind Abbr) u1) (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(eq C (CHead c1 (Bind Abbr) u1) (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) (ex_intro2 C +(\lambda (d2: C).(eq C (CHead c1 (Bind Abbr) u1) (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1)) c1 (refl_equal C (CHead c1 (Bind Abbr) u1)) +H9))) u (sym_eq T u u1 H8))) k (sym_eq K k (Bind Abbr) H7))) c2 (sym_eq C c2 +d1 H6))) H5)) H4))) c H1 H2 H0))) | (csuba_abst c1 c2 H0 t a H1 u H2) +\Rightarrow (\lambda (H3: (eq C (CHead c1 (Bind Abst) t) c)).(\lambda (H4: +(eq C (CHead c2 (Bind Abbr) u) (CHead d1 (Bind Abbr) u1))).(eq_ind C (CHead +c1 (Bind Abst) t) (\lambda (c0: C).((eq C (CHead c2 (Bind Abbr) u) (CHead d1 +(Bind Abbr) u1)) \to ((csuba g c1 c2) \to ((arity g c1 t (asucc g a)) \to +((arity g c2 u a) \to (or (ex2 C (\lambda (d2: C).(eq C c0 (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(eq C c0 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a0: A).(arity g d2 u2 (asucc g a0))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a0: A).(arity g d1 u1 a0))))))))))) +(\lambda (H5: (eq C (CHead c2 (Bind Abbr) u) (CHead d1 (Bind Abbr) u1))).(let +H6 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead c2 +(Bind Abbr) u) (CHead d1 (Bind Abbr) u1) H5) in ((let H7 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow c2 | (CHead c0 _ _) \Rightarrow c0])) (CHead c2 (Bind Abbr) u) +(CHead d1 (Bind Abbr) u1) H5) in (eq_ind C d1 (\lambda (c0: C).((eq T u u1) +\to ((csuba g c1 c0) \to ((arity g c1 t (asucc g a)) \to ((arity g c0 u a) +\to (or (ex2 C (\lambda (d2: C).(eq C (CHead c1 (Bind Abst) t) (CHead d2 +(Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C (CHead c1 (Bind Abst) t) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a0: +A).(arity g d2 u2 (asucc g a0))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a0: A).(arity g d1 u1 a0))))))))))) (\lambda (H8: (eq T u u1)).(eq_ind T u1 +(\lambda (t0: T).((csuba g c1 d1) \to ((arity g c1 t (asucc g a)) \to ((arity +g d1 t0 a) \to (or (ex2 C (\lambda (d2: C).(eq C (CHead c1 (Bind Abst) t) +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C (CHead c1 (Bind Abst) +t) (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a0: +A).(arity g d2 u2 (asucc g a0))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a0: A).(arity g d1 u1 a0)))))))))) (\lambda (H9: (csuba g c1 d1)).(\lambda +(H10: (arity g c1 t (asucc g a))).(\lambda (H11: (arity g d1 u1 +a)).(or_intror (ex2 C (\lambda (d2: C).(eq C (CHead c1 (Bind Abst) t) (CHead +d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C (CHead c1 (Bind Abst) t) +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a0: +A).(arity g d2 u2 (asucc g a0))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a0: A).(arity g d1 u1 a0))))) (ex4_3_intro C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(eq C (CHead c1 (Bind Abst) t) (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a0: A).(arity g d2 u2 (asucc g +a0))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a0: A).(arity g d1 u1 +a0)))) c1 t a (refl_equal C (CHead c1 (Bind Abst) t)) H9 H10 H11))))) u +(sym_eq T u u1 H8))) c2 (sym_eq C c2 d1 H7))) H6))) c H3 H4 H0 H1 H2)))]) in +(H0 (refl_equal C c) (refl_equal C (CHead d1 (Bind Abbr) u1)))))))). + +theorem csuba_gen_flat_rev: + \forall (g: G).(\forall (d1: C).(\forall (c: C).(\forall (u1: T).(\forall +(f: F).((csuba g c (CHead d1 (Flat f) u1)) \to (ex2_2 C T (\lambda (d2: +C).(\lambda (u2: T).(eq C c (CHead d2 (Flat f) u2)))) (\lambda (d2: +C).(\lambda (_: T).(csuba g d2 d1))))))))) +\def + \lambda (g: G).(\lambda (d1: C).(\lambda (c: C).(\lambda (u1: T).(\lambda +(f: F).(\lambda (H: (csuba g c (CHead d1 (Flat f) u1))).(let H0 \def (match H +in csuba return (\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csuba ? c0 +c1)).((eq C c0 c) \to ((eq C c1 (CHead d1 (Flat f) u1)) \to (ex2_2 C T +(\lambda (d2: C).(\lambda (u2: T).(eq C c (CHead d2 (Flat f) u2)))) (\lambda +(d2: C).(\lambda (_: T).(csuba g d2 d1))))))))) with [(csuba_sort n) +\Rightarrow (\lambda (H0: (eq C (CSort n) c)).(\lambda (H1: (eq C (CSort n) +(CHead d1 (Flat f) u1))).(eq_ind C (CSort n) (\lambda (c0: C).((eq C (CSort +n) (CHead d1 (Flat f) u1)) \to (ex2_2 C T (\lambda (d2: C).(\lambda (u2: +T).(eq C c0 (CHead d2 (Flat f) u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba +g d2 d1)))))) (\lambda (H2: (eq C (CSort n) (CHead d1 (Flat f) u1))).(let H3 +\def (eq_ind C (CSort n) (\lambda (e: C).(match e in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow +False])) I (CHead d1 (Flat f) u1) H2) in (False_ind (ex2_2 C T (\lambda (d2: +C).(\lambda (u2: T).(eq C (CSort n) (CHead d2 (Flat f) u2)))) (\lambda (d2: +C).(\lambda (_: T).(csuba g d2 d1)))) H3))) c H0 H1))) | (csuba_head c1 c2 H0 +k u) \Rightarrow (\lambda (H1: (eq C (CHead c1 k u) c)).(\lambda (H2: (eq C +(CHead c2 k u) (CHead d1 (Flat f) u1))).(eq_ind C (CHead c1 k u) (\lambda +(c0: C).((eq C (CHead c2 k u) (CHead d1 (Flat f) u1)) \to ((csuba g c1 c2) +\to (ex2_2 C T (\lambda (d2: C).(\lambda (u2: T).(eq C c0 (CHead d2 (Flat f) +u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g d2 d1))))))) (\lambda (H3: +(eq C (CHead c2 k u) (CHead d1 (Flat f) u1))).(let H4 \def (f_equal C T +(\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u | (CHead _ _ t) \Rightarrow t])) (CHead c2 k u) (CHead d1 (Flat +f) u1) H3) in ((let H5 \def (f_equal C K (\lambda (e: C).(match e in C return +(\lambda (_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k0 _) \Rightarrow +k0])) (CHead c2 k u) (CHead d1 (Flat f) u1) H3) in ((let H6 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow c2 | (CHead c0 _ _) \Rightarrow c0])) (CHead c2 k u) (CHead d1 +(Flat f) u1) H3) in (eq_ind C d1 (\lambda (c0: C).((eq K k (Flat f)) \to ((eq +T u u1) \to ((csuba g c1 c0) \to (ex2_2 C T (\lambda (d2: C).(\lambda (u2: +T).(eq C (CHead c1 k u) (CHead d2 (Flat f) u2)))) (\lambda (d2: C).(\lambda +(_: T).(csuba g d2 d1)))))))) (\lambda (H7: (eq K k (Flat f))).(eq_ind K +(Flat f) (\lambda (k0: K).((eq T u u1) \to ((csuba g c1 d1) \to (ex2_2 C T +(\lambda (d2: C).(\lambda (u2: T).(eq C (CHead c1 k0 u) (CHead d2 (Flat f) +u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g d2 d1))))))) (\lambda (H8: +(eq T u u1)).(eq_ind T u1 (\lambda (t: T).((csuba g c1 d1) \to (ex2_2 C T +(\lambda (d2: C).(\lambda (u2: T).(eq C (CHead c1 (Flat f) t) (CHead d2 (Flat +f) u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g d2 d1)))))) (\lambda (H9: +(csuba g c1 d1)).(ex2_2_intro C T (\lambda (d2: C).(\lambda (u2: T).(eq C +(CHead c1 (Flat f) u1) (CHead d2 (Flat f) u2)))) (\lambda (d2: C).(\lambda +(_: T).(csuba g d2 d1))) c1 u1 (refl_equal C (CHead c1 (Flat f) u1)) H9)) u +(sym_eq T u u1 H8))) k (sym_eq K k (Flat f) H7))) c2 (sym_eq C c2 d1 H6))) +H5)) H4))) c H1 H2 H0))) | (csuba_abst c1 c2 H0 t a H1 u H2) \Rightarrow +(\lambda (H3: (eq C (CHead c1 (Bind Abst) t) c)).(\lambda (H4: (eq C (CHead +c2 (Bind Abbr) u) (CHead d1 (Flat f) u1))).(eq_ind C (CHead c1 (Bind Abst) t) +(\lambda (c0: C).((eq C (CHead c2 (Bind Abbr) u) (CHead d1 (Flat f) u1)) \to +((csuba g c1 c2) \to ((arity g c1 t (asucc g a)) \to ((arity g c2 u a) \to +(ex2_2 C T (\lambda (d2: C).(\lambda (u2: T).(eq C c0 (CHead d2 (Flat f) +u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g d2 d1))))))))) (\lambda (H5: +(eq C (CHead c2 (Bind Abbr) u) (CHead d1 (Flat f) u1))).(let H6 \def (eq_ind +C (CHead c2 (Bind Abbr) u) (\lambda (e: C).(match e in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) \Rightarrow (match +k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | (Flat +_) \Rightarrow False])])) I (CHead d1 (Flat f) u1) H5) in (False_ind ((csuba +g c1 c2) \to ((arity g c1 t (asucc g a)) \to ((arity g c2 u a) \to (ex2_2 C T +(\lambda (d2: C).(\lambda (u2: T).(eq C (CHead c1 (Bind Abst) t) (CHead d2 +(Flat f) u2)))) (\lambda (d2: C).(\lambda (_: T).(csuba g d2 d1))))))) H6))) +c H3 H4 H0 H1 H2)))]) in (H0 (refl_equal C c) (refl_equal C (CHead d1 (Flat +f) u1))))))))). + +theorem csuba_gen_bind_rev: + \forall (g: G).(\forall (b1: B).(\forall (e1: C).(\forall (c2: C).(\forall +(v1: T).((csuba g c2 (CHead e1 (Bind b1) v1)) \to (ex2_3 B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 e1)))))))))) +\def + \lambda (g: G).(\lambda (b1: B).(\lambda (e1: C).(\lambda (c2: C).(\lambda +(v1: T).(\lambda (H: (csuba g c2 (CHead e1 (Bind b1) v1))).(let H0 \def +(match H in csuba return (\lambda (c: C).(\lambda (c0: C).(\lambda (_: (csuba +? c c0)).((eq C c c2) \to ((eq C c0 (CHead e1 (Bind b1) v1)) \to (ex2_3 B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind +b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 +e1)))))))))) with [(csuba_sort n) \Rightarrow (\lambda (H0: (eq C (CSort n) +c2)).(\lambda (H1: (eq C (CSort n) (CHead e1 (Bind b1) v1))).(eq_ind C (CSort +n) (\lambda (c: C).((eq C (CSort n) (CHead e1 (Bind b1) v1)) \to (ex2_3 B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c (CHead e2 (Bind +b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 +e1))))))) (\lambda (H2: (eq C (CSort n) (CHead e1 (Bind b1) v1))).(let H3 +\def (eq_ind C (CSort n) (\lambda (e: C).(match e in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow +False])) I (CHead e1 (Bind b1) v1) H2) in (False_ind (ex2_3 B C T (\lambda +(b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C (CSort n) (CHead e2 (Bind b2) +v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 e1))))) +H3))) c2 H0 H1))) | (csuba_head c1 c0 H0 k u) \Rightarrow (\lambda (H1: (eq C +(CHead c1 k u) c2)).(\lambda (H2: (eq C (CHead c0 k u) (CHead e1 (Bind b1) +v1))).(eq_ind C (CHead c1 k u) (\lambda (c: C).((eq C (CHead c0 k u) (CHead +e1 (Bind b1) v1)) \to ((csuba g c1 c0) \to (ex2_3 B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C c (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 e1)))))))) +(\lambda (H3: (eq C (CHead c0 k u) (CHead e1 (Bind b1) v1))).(let H4 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow t])) (CHead c0 k u) +(CHead e1 (Bind b1) v1) H3) in ((let H5 \def (f_equal C K (\lambda (e: +C).(match e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | +(CHead _ k0 _) \Rightarrow k0])) (CHead c0 k u) (CHead e1 (Bind b1) v1) H3) +in ((let H6 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) +(CHead c0 k u) (CHead e1 (Bind b1) v1) H3) in (eq_ind C e1 (\lambda (c: +C).((eq K k (Bind b1)) \to ((eq T u v1) \to ((csuba g c1 c) \to (ex2_3 B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C (CHead c1 k u) +(CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: +T).(csuba g e2 e1))))))))) (\lambda (H7: (eq K k (Bind b1))).(eq_ind K (Bind +b1) (\lambda (k0: K).((eq T u v1) \to ((csuba g c1 e1) \to (ex2_3 B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C (CHead c1 k0 u) +(CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: +T).(csuba g e2 e1)))))))) (\lambda (H8: (eq T u v1)).(eq_ind T v1 (\lambda +(t: T).((csuba g c1 e1) \to (ex2_3 B C T (\lambda (b2: B).(\lambda (e2: +C).(\lambda (v2: T).(eq C (CHead c1 (Bind b1) t) (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 e1))))))) +(\lambda (H9: (csuba g c1 e1)).(let H10 \def (eq_ind T u (\lambda (t: T).(eq +C (CHead c1 k t) c2)) H1 v1 H8) in (let H11 \def (eq_ind K k (\lambda (k0: +K).(eq C (CHead c1 k0 v1) c2)) H10 (Bind b1) H7) in (let H12 \def (eq_ind_r C +c2 (\lambda (c: C).(csuba g c (CHead e1 (Bind b1) v1))) H (CHead c1 (Bind b1) +v1) H11) in (ex2_3_intro B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda +(v2: T).(eq C (CHead c1 (Bind b1) v1) (CHead e2 (Bind b2) v2))))) (\lambda +(_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 e1)))) b1 c1 v1 +(refl_equal C (CHead c1 (Bind b1) v1)) H9))))) u (sym_eq T u v1 H8))) k +(sym_eq K k (Bind b1) H7))) c0 (sym_eq C c0 e1 H6))) H5)) H4))) c2 H1 H2 +H0))) | (csuba_abst c1 c0 H0 t a H1 u H2) \Rightarrow (\lambda (H3: (eq C +(CHead c1 (Bind Abst) t) c2)).(\lambda (H4: (eq C (CHead c0 (Bind Abbr) u) +(CHead e1 (Bind b1) v1))).(eq_ind C (CHead c1 (Bind Abst) t) (\lambda (c: +C).((eq C (CHead c0 (Bind Abbr) u) (CHead e1 (Bind b1) v1)) \to ((csuba g c1 +c0) \to ((arity g c1 t (asucc g a)) \to ((arity g c0 u a) \to (ex2_3 B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c (CHead e2 (Bind +b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 +e1)))))))))) (\lambda (H5: (eq C (CHead c0 (Bind Abbr) u) (CHead e1 (Bind b1) +v1))).(let H6 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda +(_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) +(CHead c0 (Bind Abbr) u) (CHead e1 (Bind b1) v1) H5) in ((let H7 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abbr | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b) \Rightarrow b | (Flat _) \Rightarrow +Abbr])])) (CHead c0 (Bind Abbr) u) (CHead e1 (Bind b1) v1) H5) in ((let H8 +\def (f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) +with [(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) (CHead c0 +(Bind Abbr) u) (CHead e1 (Bind b1) v1) H5) in (eq_ind C e1 (\lambda (c: +C).((eq B Abbr b1) \to ((eq T u v1) \to ((csuba g c1 c) \to ((arity g c1 t +(asucc g a)) \to ((arity g c u a) \to (ex2_3 B C T (\lambda (b2: B).(\lambda +(e2: C).(\lambda (v2: T).(eq C (CHead c1 (Bind Abst) t) (CHead e2 (Bind b2) +v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 +e1))))))))))) (\lambda (H9: (eq B Abbr b1)).(eq_ind B Abbr (\lambda (_: +B).((eq T u v1) \to ((csuba g c1 e1) \to ((arity g c1 t (asucc g a)) \to +((arity g e1 u a) \to (ex2_3 B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda +(v2: T).(eq C (CHead c1 (Bind Abst) t) (CHead e2 (Bind b2) v2))))) (\lambda +(_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 e1)))))))))) (\lambda +(H10: (eq T u v1)).(eq_ind T v1 (\lambda (t0: T).((csuba g c1 e1) \to ((arity +g c1 t (asucc g a)) \to ((arity g e1 t0 a) \to (ex2_3 B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C (CHead c1 (Bind Abst) t) (CHead e2 +(Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g +e2 e1))))))))) (\lambda (H11: (csuba g c1 e1)).(\lambda (_: (arity g c1 t +(asucc g a))).(\lambda (_: (arity g e1 v1 a)).(let H14 \def (eq_ind_r C c2 +(\lambda (c: C).(csuba g c (CHead e1 (Bind b1) v1))) H (CHead c1 (Bind Abst) +t) H3) in (let H15 \def (eq_ind_r B b1 (\lambda (b: B).(csuba g (CHead c1 +(Bind Abst) t) (CHead e1 (Bind b) v1))) H14 Abbr H9) in (ex2_3_intro B C T +(\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C (CHead c1 (Bind +Abst) t) (CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: +C).(\lambda (_: T).(csuba g e2 e1)))) Abst c1 t (refl_equal C (CHead c1 (Bind +Abst) t)) H11)))))) u (sym_eq T u v1 H10))) b1 H9)) c0 (sym_eq C c0 e1 H8))) +H7)) H6))) c2 H3 H4 H0 H1 H2)))]) in (H0 (refl_equal C c2) (refl_equal C +(CHead e1 (Bind b1) v1))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/getl.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/getl.ma new file mode 100644 index 000000000..d93e4d618 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/getl.ma @@ -0,0 +1,924 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csuba/getl". + +include "csuba/drop.ma". + +include "csuba/clear.ma". + +include "getl/clear.ma". + +theorem csuba_getl_abbr: + \forall (g: G).(\forall (c1: C).(\forall (d1: C).(\forall (u: T).(\forall +(i: nat).((getl i c1 (CHead d1 (Bind Abbr) u)) \to (\forall (c2: C).((csuba g +c1 c2) \to (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u))) +(\lambda (d2: C).(csuba g d1 d2)))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (d1: C).(\lambda (u: T).(\lambda +(i: nat).(\lambda (H: (getl i c1 (CHead d1 (Bind Abbr) u))).(let H0 \def +(getl_gen_all c1 (CHead d1 (Bind Abbr) u) i H) in (ex2_ind C (\lambda (e: +C).(drop i O c1 e)) (\lambda (e: C).(clear e (CHead d1 (Bind Abbr) u))) +(\forall (c2: C).((csuba g c1 c2) \to (ex2 C (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))))) (\lambda (x: +C).(\lambda (H1: (drop i O c1 x)).(\lambda (H2: (clear x (CHead d1 (Bind +Abbr) u))).(C_ind (\lambda (c: C).((drop i O c1 c) \to ((clear c (CHead d1 +(Bind Abbr) u)) \to (\forall (c2: C).((csuba g c1 c2) \to (ex2 C (\lambda +(d2: C).(getl i c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 +d2)))))))) (\lambda (n: nat).(\lambda (_: (drop i O c1 (CSort n))).(\lambda +(H4: (clear (CSort n) (CHead d1 (Bind Abbr) u))).(clear_gen_sort (CHead d1 +(Bind Abbr) u) n H4 (\forall (c2: C).((csuba g c1 c2) \to (ex2 C (\lambda +(d2: C).(getl i c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 +d2))))))))) (\lambda (x0: C).(\lambda (_: (((drop i O c1 x0) \to ((clear x0 +(CHead d1 (Bind Abbr) u)) \to (\forall (c2: C).((csuba g c1 c2) \to (ex2 C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (H3: +(drop i O c1 (CHead x0 k t))).(\lambda (H4: (clear (CHead x0 k t) (CHead d1 +(Bind Abbr) u))).(K_ind (\lambda (k0: K).((drop i O c1 (CHead x0 k0 t)) \to +((clear (CHead x0 k0 t) (CHead d1 (Bind Abbr) u)) \to (\forall (c2: +C).((csuba g c1 c2) \to (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)))))))) (\lambda (b: B).(\lambda +(H5: (drop i O c1 (CHead x0 (Bind b) t))).(\lambda (H6: (clear (CHead x0 +(Bind b) t) (CHead d1 (Bind Abbr) u))).(let H7 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d1 | +(CHead c _ _) \Rightarrow c])) (CHead d1 (Bind Abbr) u) (CHead x0 (Bind b) t) +(clear_gen_bind b x0 (CHead d1 (Bind Abbr) u) t H6)) in ((let H8 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abbr | (CHead _ k0 _) \Rightarrow (match k0 in K +return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow Abbr])])) (CHead d1 (Bind Abbr) u) (CHead x0 (Bind b) t) +(clear_gen_bind b x0 (CHead d1 (Bind Abbr) u) t H6)) in ((let H9 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead d1 (Bind +Abbr) u) (CHead x0 (Bind b) t) (clear_gen_bind b x0 (CHead d1 (Bind Abbr) u) +t H6)) in (\lambda (H10: (eq B Abbr b)).(\lambda (H11: (eq C d1 x0)).(\lambda +(c2: C).(\lambda (H12: (csuba g c1 c2)).(let H13 \def (eq_ind_r T t (\lambda +(t0: T).(drop i O c1 (CHead x0 (Bind b) t0))) H5 u H9) in (let H14 \def +(eq_ind_r B b (\lambda (b0: B).(drop i O c1 (CHead x0 (Bind b0) u))) H13 Abbr +H10) in (let H15 \def (eq_ind_r C x0 (\lambda (c: C).(drop i O c1 (CHead c +(Bind Abbr) u))) H14 d1 H11) in (let H16 \def (csuba_drop_abbr i c1 d1 u H15 +g c2 H12) in (ex2_ind C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind Abbr) +u))) (\lambda (d2: C).(csuba g d1 d2)) (ex2 C (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) (\lambda (x1: +C).(\lambda (H17: (drop i O c2 (CHead x1 (Bind Abbr) u))).(\lambda (H18: +(csuba g d1 x1)).(ex_intro2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)) x1 (getl_intro i c2 (CHead x1 +(Bind Abbr) u) (CHead x1 (Bind Abbr) u) H17 (clear_bind Abbr x1 u)) H18)))) +H16)))))))))) H8)) H7))))) (\lambda (f: F).(\lambda (H5: (drop i O c1 (CHead +x0 (Flat f) t))).(\lambda (H6: (clear (CHead x0 (Flat f) t) (CHead d1 (Bind +Abbr) u))).(let H7 \def H5 in (unintro C c1 (\lambda (c: C).((drop i O c +(CHead x0 (Flat f) t)) \to (\forall (c2: C).((csuba g c c2) \to (ex2 C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2))))))) (nat_ind (\lambda (n: nat).(\forall (x1: C).((drop n +O x1 (CHead x0 (Flat f) t)) \to (\forall (c2: C).((csuba g x1 c2) \to (ex2 C +(\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2)))))))) (\lambda (x1: C).(\lambda (H8: (drop O O x1 (CHead +x0 (Flat f) t))).(\lambda (c2: C).(\lambda (H9: (csuba g x1 c2)).(let H10 +\def (eq_ind C x1 (\lambda (c: C).(csuba g c c2)) H9 (CHead x0 (Flat f) t) +(drop_gen_refl x1 (CHead x0 (Flat f) t) H8)) in (let H_y \def (clear_flat x0 +(CHead d1 (Bind Abbr) u) (clear_gen_flat f x0 (CHead d1 (Bind Abbr) u) t H6) +f t) in (let H11 \def (csuba_clear_conf g (CHead x0 (Flat f) t) c2 H10 (CHead +d1 (Bind Abbr) u) H_y) in (ex2_ind C (\lambda (e2: C).(csuba g (CHead d1 +(Bind Abbr) u) e2)) (\lambda (e2: C).(clear c2 e2)) (ex2 C (\lambda (d2: +C).(getl O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) +(\lambda (x2: C).(\lambda (H12: (csuba g (CHead d1 (Bind Abbr) u) +x2)).(\lambda (H13: (clear c2 x2)).(let H_x \def (csuba_gen_abbr g d1 x2 u +H12) in (let H14 \def H_x in (ex2_ind C (\lambda (d2: C).(eq C x2 (CHead d2 +(Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)) (ex2 C (\lambda (d2: +C).(getl O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) +(\lambda (x3: C).(\lambda (H15: (eq C x2 (CHead x3 (Bind Abbr) u))).(\lambda +(H16: (csuba g d1 x3)).(let H17 \def (eq_ind C x2 (\lambda (c: C).(clear c2 +c)) H13 (CHead x3 (Bind Abbr) u) H15) in (ex_intro2 C (\lambda (d2: C).(getl +O c2 (CHead d2 (Bind Abbr) u))) (\lambda (d2: C).(csuba g d1 d2)) x3 +(getl_intro O c2 (CHead x3 (Bind Abbr) u) c2 (drop_refl c2) H17) H16))))) +H14)))))) H11)))))))) (\lambda (n: nat).(\lambda (H8: ((\forall (x1: +C).((drop n O x1 (CHead x0 (Flat f) t)) \to (\forall (c2: C).((csuba g x1 c2) +\to (ex2 C (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) u))) (\lambda +(d2: C).(csuba g d1 d2))))))))).(\lambda (x1: C).(\lambda (H9: (drop (S n) O +x1 (CHead x0 (Flat f) t))).(\lambda (c2: C).(\lambda (H10: (csuba g x1 +c2)).(let H11 \def (drop_clear x1 (CHead x0 (Flat f) t) n H9) in (ex2_3_ind B +C T (\lambda (b: B).(\lambda (e: C).(\lambda (v: T).(clear x1 (CHead e (Bind +b) v))))) (\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop n O e (CHead +x0 (Flat f) t))))) (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) (\lambda (x2: B).(\lambda (x3: +C).(\lambda (x4: T).(\lambda (H12: (clear x1 (CHead x3 (Bind x2) +x4))).(\lambda (H13: (drop n O x3 (CHead x0 (Flat f) t))).(let H14 \def +(csuba_clear_conf g x1 c2 H10 (CHead x3 (Bind x2) x4) H12) in (ex2_ind C +(\lambda (e2: C).(csuba g (CHead x3 (Bind x2) x4) e2)) (\lambda (e2: +C).(clear c2 e2)) (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) (\lambda (x5: C).(\lambda (H15: +(csuba g (CHead x3 (Bind x2) x4) x5)).(\lambda (H16: (clear c2 x5)).(let H_x +\def (csuba_gen_bind g x2 x3 x5 x4 H15) in (let H17 \def H_x in (ex2_3_ind B +C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C x5 (CHead e2 +(Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csuba g +x3 e2)))) (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abbr) u))) +(\lambda (d2: C).(csuba g d1 d2))) (\lambda (x6: B).(\lambda (x7: C).(\lambda +(x8: T).(\lambda (H18: (eq C x5 (CHead x7 (Bind x6) x8))).(\lambda (H19: +(csuba g x3 x7)).(let H20 \def (eq_ind C x5 (\lambda (c: C).(clear c2 c)) H16 +(CHead x7 (Bind x6) x8) H18) in (let H21 \def (H8 x3 H13 x7 H19) in (ex2_ind +C (\lambda (d2: C).(getl n x7 (CHead d2 (Bind Abbr) u))) (\lambda (d2: +C).(csuba g d1 d2)) (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind +Abbr) u))) (\lambda (d2: C).(csuba g d1 d2))) (\lambda (x9: C).(\lambda (H22: +(getl n x7 (CHead x9 (Bind Abbr) u))).(\lambda (H23: (csuba g d1 +x9)).(ex_intro2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abbr) u))) +(\lambda (d2: C).(csuba g d1 d2)) x9 (getl_clear_bind x6 c2 x7 x8 H20 (CHead +x9 (Bind Abbr) u) n H22) H23)))) H21)))))))) H17)))))) H14))))))) H11)))))))) +i) H7))))) k H3 H4))))))) x H1 H2)))) H0))))))). + +theorem csuba_getl_abst: + \forall (g: G).(\forall (c1: C).(\forall (d1: C).(\forall (u1: T).(\forall +(i: nat).((getl i c1 (CHead d1 (Bind Abst) u1)) \to (\forall (c2: C).((csuba +g c1 c2) \to (or (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) +u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (d1: C).(\lambda (u1: T).(\lambda +(i: nat).(\lambda (H: (getl i c1 (CHead d1 (Bind Abst) u1))).(let H0 \def +(getl_gen_all c1 (CHead d1 (Bind Abst) u1) i H) in (ex2_ind C (\lambda (e: +C).(drop i O c1 e)) (\lambda (e: C).(clear e (CHead d1 (Bind Abst) u1))) +(\forall (c2: C).((csuba g c1 c2) \to (or (ex2 C (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind +Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 +d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc +g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))))) (\lambda (x: C).(\lambda (H1: (drop i O c1 x)).(\lambda (H2: (clear +x (CHead d1 (Bind Abst) u1))).(C_ind (\lambda (c: C).((drop i O c1 c) \to +((clear c (CHead d1 (Bind Abst) u1)) \to (\forall (c2: C).((csuba g c1 c2) +\to (or (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))))))))) (\lambda +(n: nat).(\lambda (_: (drop i O c1 (CSort n))).(\lambda (H4: (clear (CSort n) +(CHead d1 (Bind Abst) u1))).(clear_gen_sort (CHead d1 (Bind Abst) u1) n H4 +(\forall (c2: C).((csuba g c1 c2) \to (or (ex2 C (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind +Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 +d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc +g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))))))))) (\lambda (x0: C).(\lambda (_: (((drop i O c1 x0) \to ((clear x0 +(CHead d1 (Bind Abst) u1)) \to (\forall (c2: C).((csuba g c1 c2) \to (or (ex2 +C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(getl i c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))))))))))).(\lambda (k: K).(\lambda +(t: T).(\lambda (H3: (drop i O c1 (CHead x0 k t))).(\lambda (H4: (clear +(CHead x0 k t) (CHead d1 (Bind Abst) u1))).(K_ind (\lambda (k0: K).((drop i O +c1 (CHead x0 k0 t)) \to ((clear (CHead x0 k0 t) (CHead d1 (Bind Abst) u1)) +\to (\forall (c2: C).((csuba g c1 c2) \to (or (ex2 C (\lambda (d2: C).(getl i +c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a))))))))))) (\lambda (b: B).(\lambda (H5: (drop i O c1 (CHead x0 (Bind b) +t))).(\lambda (H6: (clear (CHead x0 (Bind b) t) (CHead d1 (Bind Abst) +u1))).(let H7 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow d1 | (CHead c _ _) \Rightarrow c])) +(CHead d1 (Bind Abst) u1) (CHead x0 (Bind b) t) (clear_gen_bind b x0 (CHead +d1 (Bind Abst) u1) t H6)) in ((let H8 \def (f_equal C B (\lambda (e: +C).(match e in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abst | +(CHead _ k0 _) \Rightarrow (match k0 in K return (\lambda (_: K).B) with +[(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow Abst])])) (CHead d1 (Bind +Abst) u1) (CHead x0 (Bind b) t) (clear_gen_bind b x0 (CHead d1 (Bind Abst) +u1) t H6)) in ((let H9 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u1 | (CHead _ _ t0) +\Rightarrow t0])) (CHead d1 (Bind Abst) u1) (CHead x0 (Bind b) t) +(clear_gen_bind b x0 (CHead d1 (Bind Abst) u1) t H6)) in (\lambda (H10: (eq B +Abst b)).(\lambda (H11: (eq C d1 x0)).(\lambda (c2: C).(\lambda (H12: (csuba +g c1 c2)).(let H13 \def (eq_ind_r T t (\lambda (t0: T).(drop i O c1 (CHead x0 +(Bind b) t0))) H5 u1 H9) in (let H14 \def (eq_ind_r B b (\lambda (b0: +B).(drop i O c1 (CHead x0 (Bind b0) u1))) H13 Abst H10) in (let H15 \def +(eq_ind_r C x0 (\lambda (c: C).(drop i O c1 (CHead c (Bind Abst) u1))) H14 d1 +H11) in (let H16 \def (csuba_drop_abst i c1 d1 u1 H15 g c2 H12) in (or_ind +(ex2 C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(drop i O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (or (ex2 C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(getl i c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (H17: (ex2 C (\lambda +(d2: C).(drop i O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2)))).(ex2_ind C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2)) (or (ex2 C (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind +Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 +d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc +g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (x1: C).(\lambda (H18: (drop i O c2 (CHead x1 (Bind Abst) +u1))).(\lambda (H19: (csuba g d1 x1)).(or_introl (ex2 C (\lambda (d2: +C).(getl i c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a))))) (ex_intro2 C (\lambda (d2: C).(getl i c2 (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) x1 (getl_intro i c2 +(CHead x1 (Bind Abst) u1) (CHead x1 (Bind Abst) u1) H18 (clear_bind Abst x1 +u1)) H19))))) H17)) (\lambda (H17: (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop i O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))).(ex4_3_ind C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop i O c2 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))) (or (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (x1: +C).(\lambda (x2: T).(\lambda (x3: A).(\lambda (H18: (drop i O c2 (CHead x1 +(Bind Abbr) x2))).(\lambda (H19: (csuba g d1 x1)).(\lambda (H20: (arity g d1 +u1 (asucc g x3))).(\lambda (H21: (arity g x1 x2 x3)).(or_intror (ex2 C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(getl i c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex4_3_intro C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))) +x1 x2 x3 (getl_intro i c2 (CHead x1 (Bind Abbr) x2) (CHead x1 (Bind Abbr) x2) +H18 (clear_bind Abbr x1 x2)) H19 H20 H21))))))))) H17)) H16)))))))))) H8)) +H7))))) (\lambda (f: F).(\lambda (H5: (drop i O c1 (CHead x0 (Flat f) +t))).(\lambda (H6: (clear (CHead x0 (Flat f) t) (CHead d1 (Bind Abst) +u1))).(let H7 \def H5 in (unintro C c1 (\lambda (c: C).((drop i O c (CHead x0 +(Flat f) t)) \to (\forall (c2: C).((csuba g c c2) \to (or (ex2 C (\lambda +(d2: C).(getl i c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i +c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: +A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda +(a: A).(arity g d2 u2 a)))))))))) (nat_ind (\lambda (n: nat).(\forall (x1: +C).((drop n O x1 (CHead x0 (Flat f) t)) \to (\forall (c2: C).((csuba g x1 c2) +\to (or (ex2 C (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl n c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))))))))) (\lambda +(x1: C).(\lambda (H8: (drop O O x1 (CHead x0 (Flat f) t))).(\lambda (c2: +C).(\lambda (H9: (csuba g x1 c2)).(let H10 \def (eq_ind C x1 (\lambda (c: +C).(csuba g c c2)) H9 (CHead x0 (Flat f) t) (drop_gen_refl x1 (CHead x0 (Flat +f) t) H8)) in (let H_y \def (clear_flat x0 (CHead d1 (Bind Abst) u1) +(clear_gen_flat f x0 (CHead d1 (Bind Abst) u1) t H6) f t) in (let H11 \def +(csuba_clear_conf g (CHead x0 (Flat f) t) c2 H10 (CHead d1 (Bind Abst) u1) +H_y) in (ex2_ind C (\lambda (e2: C).(csuba g (CHead d1 (Bind Abst) u1) e2)) +(\lambda (e2: C).(clear c2 e2)) (or (ex2 C (\lambda (d2: C).(getl O c2 (CHead +d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(getl O c2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (x2: C).(\lambda (H12: (csuba g (CHead d1 (Bind Abst) u1) +x2)).(\lambda (H13: (clear c2 x2)).(let H_x \def (csuba_gen_abst g d1 x2 u1 +H12) in (let H14 \def H_x in (or_ind (ex2 C (\lambda (d2: C).(eq C x2 (CHead +d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C x2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))) (or (ex2 C (\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda +(H15: (ex2 C (\lambda (d2: C).(eq C x2 (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2)))).(ex2_ind C (\lambda (d2: C).(eq C x2 (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) (or (ex2 C (\lambda (d2: +C).(getl O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl O c2 +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a)))))) (\lambda (x3: C).(\lambda (H16: (eq C x2 (CHead x3 +(Bind Abst) u1))).(\lambda (H17: (csuba g d1 x3)).(let H18 \def (eq_ind C x2 +(\lambda (c: C).(clear c2 c)) H13 (CHead x3 (Bind Abst) u1) H16) in +(or_introl (ex2 C (\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex_intro2 C +(\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2)) x3 (getl_intro O c2 (CHead x3 (Bind Abst) u1) c2 +(drop_refl c2) H18) H17)))))) H15)) (\lambda (H15: (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(eq C x2 (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(eq C x2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) (or (ex2 C (\lambda (d2: +C).(getl O c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl O c2 +(CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity +g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 a)))))) (\lambda (x3: C).(\lambda (x4: T).(\lambda (x5: +A).(\lambda (H16: (eq C x2 (CHead x3 (Bind Abbr) x4))).(\lambda (H17: (csuba +g d1 x3)).(\lambda (H18: (arity g d1 u1 (asucc g x5))).(\lambda (H19: (arity +g x3 x4 x5)).(let H20 \def (eq_ind C x2 (\lambda (c: C).(clear c2 c)) H13 +(CHead x3 (Bind Abbr) x4) H16) in (or_intror (ex2 C (\lambda (d2: C).(getl O +c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl O c2 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a))))) (ex4_3_intro C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(getl O c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) x3 x4 x5 (getl_intro O c2 (CHead +x3 (Bind Abbr) x4) c2 (drop_refl c2) H20) H17 H18 H19)))))))))) H15)) +H14)))))) H11)))))))) (\lambda (n: nat).(\lambda (H8: ((\forall (x1: +C).((drop n O x1 (CHead x0 (Flat f) t)) \to (\forall (c2: C).((csuba g x1 c2) +\to (or (ex2 C (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) u1))) +(\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl n c2 (CHead d2 (Bind Abbr) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))))))))).(\lambda (x1: C).(\lambda (H9: (drop (S n) O x1 (CHead x0 (Flat +f) t))).(\lambda (c2: C).(\lambda (H10: (csuba g x1 c2)).(let H11 \def +(drop_clear x1 (CHead x0 (Flat f) t) n H9) in (ex2_3_ind B C T (\lambda (b: +B).(\lambda (e: C).(\lambda (v: T).(clear x1 (CHead e (Bind b) v))))) +(\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop n O e (CHead x0 (Flat +f) t))))) (or (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abst) +u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl (S n) c2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (x2: B).(\lambda (x3: C).(\lambda (x4: T).(\lambda (H12: +(clear x1 (CHead x3 (Bind x2) x4))).(\lambda (H13: (drop n O x3 (CHead x0 +(Flat f) t))).(let H14 \def (csuba_clear_conf g x1 c2 H10 (CHead x3 (Bind x2) +x4) H12) in (ex2_ind C (\lambda (e2: C).(csuba g (CHead x3 (Bind x2) x4) e2)) +(\lambda (e2: C).(clear c2 e2)) (or (ex2 C (\lambda (d2: C).(getl (S n) c2 +(CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl (S n) c2 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))))) (\lambda (x5: C).(\lambda (H15: (csuba g (CHead x3 (Bind x2) x4) +x5)).(\lambda (H16: (clear c2 x5)).(let H_x \def (csuba_gen_bind g x2 x3 x5 +x4 H15) in (let H17 \def H_x in (ex2_3_ind B C T (\lambda (b2: B).(\lambda +(e2: C).(\lambda (v2: T).(eq C x5 (CHead e2 (Bind b2) v2))))) (\lambda (_: +B).(\lambda (e2: C).(\lambda (_: T).(csuba g x3 e2)))) (or (ex2 C (\lambda +(d2: C).(getl (S n) c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g +d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl +(S n) c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda (x6: B).(\lambda (x7: +C).(\lambda (x8: T).(\lambda (H18: (eq C x5 (CHead x7 (Bind x6) +x8))).(\lambda (H19: (csuba g x3 x7)).(let H20 \def (eq_ind C x5 (\lambda (c: +C).(clear c2 c)) H16 (CHead x7 (Bind x6) x8) H18) in (let H21 \def (H8 x3 H13 +x7 H19) in (or_ind (ex2 C (\lambda (d2: C).(getl n x7 (CHead d2 (Bind Abst) +u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl n x7 (CHead d2 (Bind Abbr) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (or +(ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(getl (S n) c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))) (\lambda +(H22: (ex2 C (\lambda (d2: C).(getl n x7 (CHead d2 (Bind Abst) u1))) (\lambda +(d2: C).(csuba g d1 d2)))).(ex2_ind C (\lambda (d2: C).(getl n x7 (CHead d2 +(Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 d2)) (or (ex2 C (\lambda (d2: +C).(getl (S n) c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl (S +n) c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: +A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda +(a: A).(arity g d2 u2 a)))))) (\lambda (x9: C).(\lambda (H23: (getl n x7 +(CHead x9 (Bind Abst) u1))).(\lambda (H24: (csuba g d1 x9)).(or_introl (ex2 C +(\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: +C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(getl (S n) c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda +(_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a))))) (ex_intro2 C (\lambda (d2: +C).(getl (S n) c2 (CHead d2 (Bind Abst) u1))) (\lambda (d2: C).(csuba g d1 +d2)) x9 (getl_clear_bind x6 c2 x7 x8 H20 (CHead x9 (Bind Abst) u1) n H23) +H24))))) H22)) (\lambda (H22: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(getl n x7 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 a)))))).(ex4_3_ind C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl n x7 (CHead d2 +(Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d1 d2)))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +(asucc g a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 +u2 a)))) (or (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abst) +u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl (S n) c2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a)))))) (\lambda (x9: C).(\lambda (x10: T).(\lambda (x11: A).(\lambda (H23: +(getl n x7 (CHead x9 (Bind Abbr) x10))).(\lambda (H24: (csuba g d1 +x9)).(\lambda (H25: (arity g d1 u1 (asucc g x11))).(\lambda (H26: (arity g x9 +x10 x11)).(or_intror (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind +Abst) u1))) (\lambda (d2: C).(csuba g d1 d2))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl (S n) c2 (CHead d2 (Bind Abbr) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d1 d2)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 (asucc g +a))))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +a))))) (ex4_3_intro C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(getl (S n) c2 (CHead d2 (Bind Abbr) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d1 d2)))) (\lambda (_: C).(\lambda (_: +T).(\lambda (a: A).(arity g d1 u1 (asucc g a))))) (\lambda (d2: C).(\lambda +(u2: T).(\lambda (a: A).(arity g d2 u2 a)))) x9 x10 x11 (getl_clear_bind x6 +c2 x7 x8 H20 (CHead x9 (Bind Abbr) x10) n H23) H24 H25 H26))))))))) H22)) +H21)))))))) H17)))))) H14))))))) H11)))))))) i) H7))))) k H3 H4))))))) x H1 +H2)))) H0))))))). + +theorem csuba_getl_abst_rev: + \forall (g: G).(\forall (c1: C).(\forall (d1: C).(\forall (u: T).(\forall +(i: nat).((getl i c1 (CHead d1 (Bind Abst) u)) \to (\forall (c2: C).((csuba g +c2 c1) \to (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u))) +(\lambda (d2: C).(csuba g d2 d1)))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (d1: C).(\lambda (u: T).(\lambda +(i: nat).(\lambda (H: (getl i c1 (CHead d1 (Bind Abst) u))).(let H0 \def +(getl_gen_all c1 (CHead d1 (Bind Abst) u) i H) in (ex2_ind C (\lambda (e: +C).(drop i O c1 e)) (\lambda (e: C).(clear e (CHead d1 (Bind Abst) u))) +(\forall (c2: C).((csuba g c2 c1) \to (ex2 C (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))))) (\lambda (x: +C).(\lambda (H1: (drop i O c1 x)).(\lambda (H2: (clear x (CHead d1 (Bind +Abst) u))).(C_ind (\lambda (c: C).((drop i O c1 c) \to ((clear c (CHead d1 +(Bind Abst) u)) \to (\forall (c2: C).((csuba g c2 c1) \to (ex2 C (\lambda +(d2: C).(getl i c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 +d1)))))))) (\lambda (n: nat).(\lambda (_: (drop i O c1 (CSort n))).(\lambda +(H4: (clear (CSort n) (CHead d1 (Bind Abst) u))).(clear_gen_sort (CHead d1 +(Bind Abst) u) n H4 (\forall (c2: C).((csuba g c2 c1) \to (ex2 C (\lambda +(d2: C).(getl i c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 +d1))))))))) (\lambda (x0: C).(\lambda (_: (((drop i O c1 x0) \to ((clear x0 +(CHead d1 (Bind Abst) u)) \to (\forall (c2: C).((csuba g c2 c1) \to (ex2 C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: +C).(csuba g d2 d1))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (H3: +(drop i O c1 (CHead x0 k t))).(\lambda (H4: (clear (CHead x0 k t) (CHead d1 +(Bind Abst) u))).(K_ind (\lambda (k0: K).((drop i O c1 (CHead x0 k0 t)) \to +((clear (CHead x0 k0 t) (CHead d1 (Bind Abst) u)) \to (\forall (c2: +C).((csuba g c2 c1) \to (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1)))))))) (\lambda (b: B).(\lambda +(H5: (drop i O c1 (CHead x0 (Bind b) t))).(\lambda (H6: (clear (CHead x0 +(Bind b) t) (CHead d1 (Bind Abst) u))).(let H7 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d1 | +(CHead c _ _) \Rightarrow c])) (CHead d1 (Bind Abst) u) (CHead x0 (Bind b) t) +(clear_gen_bind b x0 (CHead d1 (Bind Abst) u) t H6)) in ((let H8 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abst | (CHead _ k0 _) \Rightarrow (match k0 in K +return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow Abst])])) (CHead d1 (Bind Abst) u) (CHead x0 (Bind b) t) +(clear_gen_bind b x0 (CHead d1 (Bind Abst) u) t H6)) in ((let H9 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead d1 (Bind +Abst) u) (CHead x0 (Bind b) t) (clear_gen_bind b x0 (CHead d1 (Bind Abst) u) +t H6)) in (\lambda (H10: (eq B Abst b)).(\lambda (H11: (eq C d1 x0)).(\lambda +(c2: C).(\lambda (H12: (csuba g c2 c1)).(let H13 \def (eq_ind_r T t (\lambda +(t0: T).(drop i O c1 (CHead x0 (Bind b) t0))) H5 u H9) in (let H14 \def +(eq_ind_r B b (\lambda (b0: B).(drop i O c1 (CHead x0 (Bind b0) u))) H13 Abst +H10) in (let H15 \def (eq_ind_r C x0 (\lambda (c: C).(drop i O c1 (CHead c +(Bind Abst) u))) H14 d1 H11) in (let H16 \def (csuba_drop_abst_rev i c1 d1 u +H15 g c2 H12) in (ex2_ind C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) (ex2 C (\lambda (d2: C).(getl i +c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda +(x1: C).(\lambda (H17: (drop i O c2 (CHead x1 (Bind Abst) u))).(\lambda (H18: +(csuba g x1 d1)).(ex_intro2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) x1 (getl_intro i c2 (CHead x1 +(Bind Abst) u) (CHead x1 (Bind Abst) u) H17 (clear_bind Abst x1 u)) H18)))) +H16)))))))))) H8)) H7))))) (\lambda (f: F).(\lambda (H5: (drop i O c1 (CHead +x0 (Flat f) t))).(\lambda (H6: (clear (CHead x0 (Flat f) t) (CHead d1 (Bind +Abst) u))).(let H7 \def H5 in (unintro C c1 (\lambda (c: C).((drop i O c +(CHead x0 (Flat f) t)) \to (\forall (c2: C).((csuba g c2 c) \to (ex2 C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: +C).(csuba g d2 d1))))))) (nat_ind (\lambda (n: nat).(\forall (x1: C).((drop n +O x1 (CHead x0 (Flat f) t)) \to (\forall (c2: C).((csuba g c2 x1) \to (ex2 C +(\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: +C).(csuba g d2 d1)))))))) (\lambda (x1: C).(\lambda (H8: (drop O O x1 (CHead +x0 (Flat f) t))).(\lambda (c2: C).(\lambda (H9: (csuba g c2 x1)).(let H10 +\def (eq_ind C x1 (\lambda (c: C).(csuba g c2 c)) H9 (CHead x0 (Flat f) t) +(drop_gen_refl x1 (CHead x0 (Flat f) t) H8)) in (let H_y \def (clear_flat x0 +(CHead d1 (Bind Abst) u) (clear_gen_flat f x0 (CHead d1 (Bind Abst) u) t H6) +f t) in (let H11 \def (csuba_clear_trans g (CHead x0 (Flat f) t) c2 H10 +(CHead d1 (Bind Abst) u) H_y) in (ex2_ind C (\lambda (e2: C).(csuba g e2 +(CHead d1 (Bind Abst) u))) (\lambda (e2: C).(clear c2 e2)) (ex2 C (\lambda +(d2: C).(getl O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 +d1))) (\lambda (x2: C).(\lambda (H12: (csuba g x2 (CHead d1 (Bind Abst) +u))).(\lambda (H13: (clear c2 x2)).(let H_x \def (csuba_gen_abst_rev g d1 x2 +u H12) in (let H14 \def H_x in (ex2_ind C (\lambda (d2: C).(eq C x2 (CHead d2 +(Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) (ex2 C (\lambda (d2: +C).(getl O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) +(\lambda (x3: C).(\lambda (H15: (eq C x2 (CHead x3 (Bind Abst) u))).(\lambda +(H16: (csuba g x3 d1)).(let H17 \def (eq_ind C x2 (\lambda (c: C).(clear c2 +c)) H13 (CHead x3 (Bind Abst) u) H15) in (ex_intro2 C (\lambda (d2: C).(getl +O c2 (CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1)) x3 +(getl_intro O c2 (CHead x3 (Bind Abst) u) c2 (drop_refl c2) H17) H16))))) +H14)))))) H11)))))))) (\lambda (n: nat).(\lambda (H8: ((\forall (x1: +C).((drop n O x1 (CHead x0 (Flat f) t)) \to (\forall (c2: C).((csuba g c2 x1) +\to (ex2 C (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) u))) (\lambda +(d2: C).(csuba g d2 d1))))))))).(\lambda (x1: C).(\lambda (H9: (drop (S n) O +x1 (CHead x0 (Flat f) t))).(\lambda (c2: C).(\lambda (H10: (csuba g c2 +x1)).(let H11 \def (drop_clear x1 (CHead x0 (Flat f) t) n H9) in (ex2_3_ind B +C T (\lambda (b: B).(\lambda (e: C).(\lambda (v: T).(clear x1 (CHead e (Bind +b) v))))) (\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop n O e (CHead +x0 (Flat f) t))))) (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (x2: B).(\lambda (x3: +C).(\lambda (x4: T).(\lambda (H12: (clear x1 (CHead x3 (Bind x2) +x4))).(\lambda (H13: (drop n O x3 (CHead x0 (Flat f) t))).(let H14 \def +(csuba_clear_trans g x1 c2 H10 (CHead x3 (Bind x2) x4) H12) in (ex2_ind C +(\lambda (e2: C).(csuba g e2 (CHead x3 (Bind x2) x4))) (\lambda (e2: +C).(clear c2 e2)) (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (x5: C).(\lambda (H15: +(csuba g x5 (CHead x3 (Bind x2) x4))).(\lambda (H16: (clear c2 x5)).(let H_x +\def (csuba_gen_bind_rev g x2 x3 x5 x4 H15) in (let H17 \def H_x in +(ex2_3_ind B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C x5 +(CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: +T).(csuba g e2 x3)))) (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind +Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (x6: B).(\lambda (x7: +C).(\lambda (x8: T).(\lambda (H18: (eq C x5 (CHead x7 (Bind x6) +x8))).(\lambda (H19: (csuba g x7 x3)).(let H20 \def (eq_ind C x5 (\lambda (c: +C).(clear c2 c)) H16 (CHead x7 (Bind x6) x8) H18) in (let H21 \def (H8 x3 H13 +x7 H19) in (ex2_ind C (\lambda (d2: C).(getl n x7 (CHead d2 (Bind Abst) u))) +(\lambda (d2: C).(csuba g d2 d1)) (ex2 C (\lambda (d2: C).(getl (S n) c2 +(CHead d2 (Bind Abst) u))) (\lambda (d2: C).(csuba g d2 d1))) (\lambda (x9: +C).(\lambda (H22: (getl n x7 (CHead x9 (Bind Abst) u))).(\lambda (H23: (csuba +g x9 d1)).(ex_intro2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abst) +u))) (\lambda (d2: C).(csuba g d2 d1)) x9 (getl_clear_bind x6 c2 x7 x8 H20 +(CHead x9 (Bind Abst) u) n H22) H23)))) H21)))))))) H17)))))) H14))))))) +H11)))))))) i) H7))))) k H3 H4))))))) x H1 H2)))) H0))))))). + +theorem csuba_getl_abbr_rev: + \forall (g: G).(\forall (c1: C).(\forall (d1: C).(\forall (u1: T).(\forall +(i: nat).((getl i c1 (CHead d1 (Bind Abbr) u1)) \to (\forall (c2: C).((csuba +g c2 c1) \to (or (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (d1: C).(\lambda (u1: T).(\lambda +(i: nat).(\lambda (H: (getl i c1 (CHead d1 (Bind Abbr) u1))).(let H0 \def +(getl_gen_all c1 (CHead d1 (Bind Abbr) u1) i H) in (ex2_ind C (\lambda (e: +C).(drop i O c1 e)) (\lambda (e: C).(clear e (CHead d1 (Bind Abbr) u1))) +(\forall (c2: C).((csuba g c2 c1) \to (or (ex2 C (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))))) (\lambda (x: C).(\lambda (H1: (drop i O c1 x)).(\lambda (H2: +(clear x (CHead d1 (Bind Abbr) u1))).(C_ind (\lambda (c: C).((drop i O c1 c) +\to ((clear c (CHead d1 (Bind Abbr) u1)) \to (\forall (c2: C).((csuba g c2 +c1) \to (or (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))))))))) (\lambda +(n: nat).(\lambda (_: (drop i O c1 (CSort n))).(\lambda (H4: (clear (CSort n) +(CHead d1 (Bind Abbr) u1))).(clear_gen_sort (CHead d1 (Bind Abbr) u1) n H4 +(\forall (c2: C).((csuba g c2 c1) \to (or (ex2 C (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))))))))) (\lambda (x0: C).(\lambda (_: (((drop i O c1 x0) \to ((clear +x0 (CHead d1 (Bind Abbr) u1)) \to (\forall (c2: C).((csuba g c2 c1) \to (or +(ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(getl i c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))))))))))).(\lambda (k: K).(\lambda +(t: T).(\lambda (H3: (drop i O c1 (CHead x0 k t))).(\lambda (H4: (clear +(CHead x0 k t) (CHead d1 (Bind Abbr) u1))).(K_ind (\lambda (k0: K).((drop i O +c1 (CHead x0 k0 t)) \to ((clear (CHead x0 k0 t) (CHead d1 (Bind Abbr) u1)) +\to (\forall (c2: C).((csuba g c2 c1) \to (or (ex2 C (\lambda (d2: C).(getl i +c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a))))))))))) (\lambda (b: B).(\lambda (H5: (drop i O c1 (CHead x0 (Bind b) +t))).(\lambda (H6: (clear (CHead x0 (Bind b) t) (CHead d1 (Bind Abbr) +u1))).(let H7 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow d1 | (CHead c _ _) \Rightarrow c])) +(CHead d1 (Bind Abbr) u1) (CHead x0 (Bind b) t) (clear_gen_bind b x0 (CHead +d1 (Bind Abbr) u1) t H6)) in ((let H8 \def (f_equal C B (\lambda (e: +C).(match e in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | +(CHead _ k0 _) \Rightarrow (match k0 in K return (\lambda (_: K).B) with +[(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (CHead d1 (Bind +Abbr) u1) (CHead x0 (Bind b) t) (clear_gen_bind b x0 (CHead d1 (Bind Abbr) +u1) t H6)) in ((let H9 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u1 | (CHead _ _ t0) +\Rightarrow t0])) (CHead d1 (Bind Abbr) u1) (CHead x0 (Bind b) t) +(clear_gen_bind b x0 (CHead d1 (Bind Abbr) u1) t H6)) in (\lambda (H10: (eq B +Abbr b)).(\lambda (H11: (eq C d1 x0)).(\lambda (c2: C).(\lambda (H12: (csuba +g c2 c1)).(let H13 \def (eq_ind_r T t (\lambda (t0: T).(drop i O c1 (CHead x0 +(Bind b) t0))) H5 u1 H9) in (let H14 \def (eq_ind_r B b (\lambda (b0: +B).(drop i O c1 (CHead x0 (Bind b0) u1))) H13 Abbr H10) in (let H15 \def +(eq_ind_r C x0 (\lambda (c: C).(drop i O c1 (CHead c (Bind Abbr) u1))) H14 d1 +H11) in (let H16 \def (csuba_drop_abbr_rev i c1 d1 u1 H15 g c2 H12) in +(or_ind (ex2 C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop i O c2 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) (or (ex2 C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(getl i c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (H17: (ex2 C (\lambda +(d2: C).(drop i O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1)))).(ex2_ind C (\lambda (d2: C).(drop i O c2 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1)) (or (ex2 C (\lambda (d2: C).(getl i c2 +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))) (\lambda (x1: C).(\lambda (H18: (drop i O c2 (CHead x1 (Bind Abbr) +u1))).(\lambda (H19: (csuba g x1 d1)).(or_introl (ex2 C (\lambda (d2: +C).(getl i c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a))))) (ex_intro2 C (\lambda (d2: C).(getl i c2 (CHead +d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)) x1 (getl_intro i c2 +(CHead x1 (Bind Abbr) u1) (CHead x1 (Bind Abbr) u1) H18 (clear_bind Abbr x1 +u1)) H19))))) H17)) (\lambda (H17: (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(drop i O c2 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))).(ex4_3_ind C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(drop i O c2 (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))) (or (ex2 C (\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (x1: +C).(\lambda (x2: T).(\lambda (x3: A).(\lambda (H18: (drop i O c2 (CHead x1 +(Bind Abst) x2))).(\lambda (H19: (csuba g x1 d1)).(\lambda (H20: (arity g x1 +x2 (asucc g x3))).(\lambda (H21: (arity g d1 u1 x3)).(or_intror (ex2 C +(\lambda (d2: C).(getl i c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(getl i c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a))))) (ex4_3_intro C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl i c2 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))) x1 x2 x3 +(getl_intro i c2 (CHead x1 (Bind Abst) x2) (CHead x1 (Bind Abst) x2) H18 +(clear_bind Abst x1 x2)) H19 H20 H21))))))))) H17)) H16)))))))))) H8)) +H7))))) (\lambda (f: F).(\lambda (H5: (drop i O c1 (CHead x0 (Flat f) +t))).(\lambda (H6: (clear (CHead x0 (Flat f) t) (CHead d1 (Bind Abbr) +u1))).(let H7 \def H5 in (unintro C c1 (\lambda (c: C).((drop i O c (CHead x0 +(Flat f) t)) \to (\forall (c2: C).((csuba g c2 c) \to (or (ex2 C (\lambda +(d2: C).(getl i c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl i +c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))))))) (nat_ind (\lambda (n: nat).(\forall (x1: +C).((drop n O x1 (CHead x0 (Flat f) t)) \to (\forall (c2: C).((csuba g c2 x1) +\to (or (ex2 C (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl n c2 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))))))))) (\lambda +(x1: C).(\lambda (H8: (drop O O x1 (CHead x0 (Flat f) t))).(\lambda (c2: +C).(\lambda (H9: (csuba g c2 x1)).(let H10 \def (eq_ind C x1 (\lambda (c: +C).(csuba g c2 c)) H9 (CHead x0 (Flat f) t) (drop_gen_refl x1 (CHead x0 (Flat +f) t) H8)) in (let H_y \def (clear_flat x0 (CHead d1 (Bind Abbr) u1) +(clear_gen_flat f x0 (CHead d1 (Bind Abbr) u1) t H6) f t) in (let H11 \def +(csuba_clear_trans g (CHead x0 (Flat f) t) c2 H10 (CHead d1 (Bind Abbr) u1) +H_y) in (ex2_ind C (\lambda (e2: C).(csuba g e2 (CHead d1 (Bind Abbr) u1))) +(\lambda (e2: C).(clear c2 e2)) (or (ex2 C (\lambda (d2: C).(getl O c2 (CHead +d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda +(d2: C).(\lambda (u2: T).(\lambda (_: A).(getl O c2 (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) +(\lambda (x2: C).(\lambda (H12: (csuba g x2 (CHead d1 (Bind Abbr) +u1))).(\lambda (H13: (clear c2 x2)).(let H_x \def (csuba_gen_abbr_rev g d1 x2 +u1 H12) in (let H14 \def H_x in (or_ind (ex2 C (\lambda (d2: C).(eq C x2 +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(eq C x2 (CHead d2 (Bind +Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 +d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a))))) (or (ex2 C (\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl O c2 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (H15: +(ex2 C (\lambda (d2: C).(eq C x2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1)))).(ex2_ind C (\lambda (d2: C).(eq C x2 (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)) (or (ex2 C (\lambda (d2: +C).(getl O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) +(ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl O c2 +(CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: +A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (x3: C).(\lambda (H16: (eq C x2 (CHead +x3 (Bind Abbr) u1))).(\lambda (H17: (csuba g x3 d1)).(let H18 \def (eq_ind C +x2 (\lambda (c: C).(clear c2 c)) H13 (CHead x3 (Bind Abbr) u1) H16) in +(or_introl (ex2 C (\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abbr) u1))) +(\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda +(u2: T).(\lambda (_: A).(getl O c2 (CHead d2 (Bind Abst) u2))))) (\lambda +(d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) (ex_intro2 C +(\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1)) x3 (getl_intro O c2 (CHead x3 (Bind Abbr) u1) c2 +(drop_refl c2) H18) H17)))))) H15)) (\lambda (H15: (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(eq C x2 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 +a)))))).(ex4_3_ind C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: +A).(eq C x2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))) (or (ex2 C (\lambda (d2: C).(getl +O c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C +T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl O c2 (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))) (\lambda (x3: C).(\lambda (x4: T).(\lambda (x5: A).(\lambda (H16: +(eq C x2 (CHead x3 (Bind Abst) x4))).(\lambda (H17: (csuba g x3 d1)).(\lambda +(H18: (arity g x3 x4 (asucc g x5))).(\lambda (H19: (arity g d1 u1 x5)).(let +H20 \def (eq_ind C x2 (\lambda (c: C).(clear c2 c)) H13 (CHead x3 (Bind Abst) +x4) H16) in (or_intror (ex2 C (\lambda (d2: C).(getl O c2 (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl O c2 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) +(ex4_3_intro C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl O +c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))) x3 x4 x5 (getl_intro O c2 (CHead x3 (Bind Abst) +x4) c2 (drop_refl c2) H20) H17 H18 H19)))))))))) H15)) H14)))))) H11)))))))) +(\lambda (n: nat).(\lambda (H8: ((\forall (x1: C).((drop n O x1 (CHead x0 +(Flat f) t)) \to (\forall (c2: C).((csuba g c2 x1) \to (or (ex2 C (\lambda +(d2: C).(getl n c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl n +c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))))))))).(\lambda (x1: C).(\lambda (H9: (drop (S +n) O x1 (CHead x0 (Flat f) t))).(\lambda (c2: C).(\lambda (H10: (csuba g c2 +x1)).(let H11 \def (drop_clear x1 (CHead x0 (Flat f) t) n H9) in (ex2_3_ind B +C T (\lambda (b: B).(\lambda (e: C).(\lambda (v: T).(clear x1 (CHead e (Bind +b) v))))) (\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop n O e (CHead +x0 (Flat f) t))))) (or (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl (S n) c2 (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) +(\lambda (x2: B).(\lambda (x3: C).(\lambda (x4: T).(\lambda (H12: (clear x1 +(CHead x3 (Bind x2) x4))).(\lambda (H13: (drop n O x3 (CHead x0 (Flat f) +t))).(let H14 \def (csuba_clear_trans g x1 c2 H10 (CHead x3 (Bind x2) x4) +H12) in (ex2_ind C (\lambda (e2: C).(csuba g e2 (CHead x3 (Bind x2) x4))) +(\lambda (e2: C).(clear c2 e2)) (or (ex2 C (\lambda (d2: C).(getl (S n) c2 +(CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A +(\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl (S n) c2 (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))))) (\lambda (x5: C).(\lambda (H15: (csuba g x5 (CHead x3 (Bind x2) +x4))).(\lambda (H16: (clear c2 x5)).(let H_x \def (csuba_gen_bind_rev g x2 x3 +x5 x4 H15) in (let H17 \def H_x in (ex2_3_ind B C T (\lambda (b2: B).(\lambda +(e2: C).(\lambda (v2: T).(eq C x5 (CHead e2 (Bind b2) v2))))) (\lambda (_: +B).(\lambda (e2: C).(\lambda (_: T).(csuba g e2 x3)))) (or (ex2 C (\lambda +(d2: C).(getl (S n) c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g +d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl +(S n) c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: +T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (x6: B).(\lambda (x7: +C).(\lambda (x8: T).(\lambda (H18: (eq C x5 (CHead x7 (Bind x6) +x8))).(\lambda (H19: (csuba g x7 x3)).(let H20 \def (eq_ind C x5 (\lambda (c: +C).(clear c2 c)) H16 (CHead x7 (Bind x6) x8) H18) in (let H21 \def (H8 x3 H13 +x7 H19) in (or_ind (ex2 C (\lambda (d2: C).(getl n x7 (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl n x7 (CHead d2 (Bind Abst) u2))))) +(\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda +(d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) +(\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) (or +(ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abbr) u1))) (\lambda +(d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(getl (S n) c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) (\lambda (H22: +(ex2 C (\lambda (d2: C).(getl n x7 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1)))).(ex2_ind C (\lambda (d2: C).(getl n x7 (CHead d2 (Bind +Abbr) u1))) (\lambda (d2: C).(csuba g d2 d1)) (or (ex2 C (\lambda (d2: +C).(getl (S n) c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl (S +n) c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))))) (\lambda (x9: C).(\lambda (H23: (getl n x7 +(CHead x9 (Bind Abbr) u1))).(\lambda (H24: (csuba g x9 d1)).(or_introl (ex2 C +(\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: +C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda +(_: A).(getl (S n) c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda +(_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: +T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda +(_: T).(\lambda (a: A).(arity g d1 u1 a))))) (ex_intro2 C (\lambda (d2: +C).(getl (S n) c2 (CHead d2 (Bind Abbr) u1))) (\lambda (d2: C).(csuba g d2 +d1)) x9 (getl_clear_bind x6 c2 x7 x8 H20 (CHead x9 (Bind Abbr) u1) n H23) +H24))))) H22)) (\lambda (H22: (ex4_3 C T A (\lambda (d2: C).(\lambda (u2: +T).(\lambda (_: A).(getl n x7 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: +C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) (\lambda (d2: +C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g a))))) (\lambda +(_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))).(ex4_3_ind C T +A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl n x7 (CHead d2 +(Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g +d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 +(asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 +u1 a)))) (or (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl (S n) c2 (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a)))))) +(\lambda (x9: C).(\lambda (x10: T).(\lambda (x11: A).(\lambda (H23: (getl n +x7 (CHead x9 (Bind Abst) x10))).(\lambda (H24: (csuba g x9 d1)).(\lambda +(H25: (arity g x9 x10 (asucc g x11))).(\lambda (H26: (arity g d1 u1 +x11)).(or_intror (ex2 C (\lambda (d2: C).(getl (S n) c2 (CHead d2 (Bind Abbr) +u1))) (\lambda (d2: C).(csuba g d2 d1))) (ex4_3 C T A (\lambda (d2: +C).(\lambda (u2: T).(\lambda (_: A).(getl (S n) c2 (CHead d2 (Bind Abst) +u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda (_: A).(csuba g d2 d1)))) +(\lambda (d2: C).(\lambda (u2: T).(\lambda (a: A).(arity g d2 u2 (asucc g +a))))) (\lambda (_: C).(\lambda (_: T).(\lambda (a: A).(arity g d1 u1 a))))) +(ex4_3_intro C T A (\lambda (d2: C).(\lambda (u2: T).(\lambda (_: A).(getl (S +n) c2 (CHead d2 (Bind Abst) u2))))) (\lambda (d2: C).(\lambda (_: T).(\lambda +(_: A).(csuba g d2 d1)))) (\lambda (d2: C).(\lambda (u2: T).(\lambda (a: +A).(arity g d2 u2 (asucc g a))))) (\lambda (_: C).(\lambda (_: T).(\lambda +(a: A).(arity g d1 u1 a)))) x9 x10 x11 (getl_clear_bind x6 c2 x7 x8 H20 +(CHead x9 (Bind Abst) x10) n H23) H24 H25 H26))))))))) H22)) H21)))))))) +H17)))))) H14))))))) H11)))))))) i) H7))))) k H3 H4))))))) x H1 H2)))) +H0))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/props.ma new file mode 100644 index 000000000..62e10c095 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/props.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csuba/props". + +include "csuba/defs.ma". + +theorem csuba_refl: + \forall (g: G).(\forall (c: C).(csuba g c c)) +\def + \lambda (g: G).(\lambda (c: C).(C_ind (\lambda (c0: C).(csuba g c0 c0)) +(\lambda (n: nat).(csuba_sort g n)) (\lambda (c0: C).(\lambda (H: (csuba g c0 +c0)).(\lambda (k: K).(\lambda (t: T).(csuba_head g c0 c0 H k t))))) c)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/arity.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/arity.ma new file mode 100644 index 000000000..d697f1257 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/arity.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubc/arity". + +include "csubc/csuba.ma". + +include "arity/defs.ma". + +theorem csubc_arity_conf: + \forall (g: G).(\forall (c1: C).(\forall (c2: C).((csubc g c1 c2) \to +(\forall (t: T).(\forall (a: A).((arity g c1 t a) \to (arity g c2 t a))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (csubc g c1 +c2)).(\lambda (t: T).(\lambda (a: A).(\lambda (H0: (arity g c1 t +a)).(csuba_arity g c1 t a H0 c2 (csubc_csuba g c1 c2 H)))))))). + +theorem csubc_arity_trans: + \forall (g: G).(\forall (c1: C).(\forall (c2: C).((csubc g c1 c2) \to +(\forall (t: T).(\forall (a: A).((arity g c2 t a) \to (arity g c1 t a))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (csubc g c1 +c2)).(\lambda (t: T).(\lambda (a: A).(\lambda (H0: (arity g c2 t +a)).(csuba_arity_rev g c2 t a H0 c1 (csubc_csuba g c1 c2 H)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/clear.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/clear.ma new file mode 100644 index 000000000..059c359ab --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/clear.ma @@ -0,0 +1,149 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubc/clear". + +include "csubc/defs.ma". + +theorem csubc_clear_conf: + \forall (g: G).(\forall (c1: C).(\forall (e1: C).((clear c1 e1) \to (\forall +(c2: C).((csubc g c1 c2) \to (ex2 C (\lambda (e2: C).(clear c2 e2)) (\lambda +(e2: C).(csubc g e1 e2)))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (e1: C).(\lambda (H: (clear c1 +e1)).(clear_ind (\lambda (c: C).(\lambda (c0: C).(\forall (c2: C).((csubc g c +c2) \to (ex2 C (\lambda (e2: C).(clear c2 e2)) (\lambda (e2: C).(csubc g c0 +e2))))))) (\lambda (b: B).(\lambda (e: C).(\lambda (u: T).(\lambda (c2: +C).(\lambda (H0: (csubc g (CHead e (Bind b) u) c2)).(let H1 \def (match H0 in +csubc return (\lambda (c: C).(\lambda (c0: C).(\lambda (_: (csubc ? c +c0)).((eq C c (CHead e (Bind b) u)) \to ((eq C c0 c2) \to (ex2 C (\lambda +(e2: C).(clear c2 e2)) (\lambda (e2: C).(csubc g (CHead e (Bind b) u) +e2)))))))) with [(csubc_sort n) \Rightarrow (\lambda (H1: (eq C (CSort n) +(CHead e (Bind b) u))).(\lambda (H2: (eq C (CSort n) c2)).((let H3 \def +(eq_ind C (CSort n) (\lambda (e0: C).(match e0 in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow +False])) I (CHead e (Bind b) u) H1) in (False_ind ((eq C (CSort n) c2) \to +(ex2 C (\lambda (e2: C).(clear c2 e2)) (\lambda (e2: C).(csubc g (CHead e +(Bind b) u) e2)))) H3)) H2))) | (csubc_head c0 c3 H1 k v) \Rightarrow +(\lambda (H2: (eq C (CHead c0 k v) (CHead e (Bind b) u))).(\lambda (H3: (eq C +(CHead c3 k v) c2)).((let H4 \def (f_equal C T (\lambda (e0: C).(match e0 in +C return (\lambda (_: C).T) with [(CSort _) \Rightarrow v | (CHead _ _ t) +\Rightarrow t])) (CHead c0 k v) (CHead e (Bind b) u) H2) in ((let H5 \def +(f_equal C K (\lambda (e0: C).(match e0 in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) (CHead c0 k v) +(CHead e (Bind b) u) H2) in ((let H6 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | +(CHead c _ _) \Rightarrow c])) (CHead c0 k v) (CHead e (Bind b) u) H2) in +(eq_ind C e (\lambda (c: C).((eq K k (Bind b)) \to ((eq T v u) \to ((eq C +(CHead c3 k v) c2) \to ((csubc g c c3) \to (ex2 C (\lambda (e2: C).(clear c2 +e2)) (\lambda (e2: C).(csubc g (CHead e (Bind b) u) e2)))))))) (\lambda (H7: +(eq K k (Bind b))).(eq_ind K (Bind b) (\lambda (k0: K).((eq T v u) \to ((eq C +(CHead c3 k0 v) c2) \to ((csubc g e c3) \to (ex2 C (\lambda (e2: C).(clear c2 +e2)) (\lambda (e2: C).(csubc g (CHead e (Bind b) u) e2))))))) (\lambda (H8: +(eq T v u)).(eq_ind T u (\lambda (t: T).((eq C (CHead c3 (Bind b) t) c2) \to +((csubc g e c3) \to (ex2 C (\lambda (e2: C).(clear c2 e2)) (\lambda (e2: +C).(csubc g (CHead e (Bind b) u) e2)))))) (\lambda (H9: (eq C (CHead c3 (Bind +b) u) c2)).(eq_ind C (CHead c3 (Bind b) u) (\lambda (c: C).((csubc g e c3) +\to (ex2 C (\lambda (e2: C).(clear c e2)) (\lambda (e2: C).(csubc g (CHead e +(Bind b) u) e2))))) (\lambda (H10: (csubc g e c3)).(ex_intro2 C (\lambda (e2: +C).(clear (CHead c3 (Bind b) u) e2)) (\lambda (e2: C).(csubc g (CHead e (Bind +b) u) e2)) (CHead c3 (Bind b) u) (clear_bind b c3 u) (csubc_head g e c3 H10 +(Bind b) u))) c2 H9)) v (sym_eq T v u H8))) k (sym_eq K k (Bind b) H7))) c0 +(sym_eq C c0 e H6))) H5)) H4)) H3 H1))) | (csubc_abst c0 c3 H1 v a H2 w H3) +\Rightarrow (\lambda (H4: (eq C (CHead c0 (Bind Abst) v) (CHead e (Bind b) +u))).(\lambda (H5: (eq C (CHead c3 (Bind Abbr) w) c2)).((let H6 \def (f_equal +C T (\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow v | (CHead _ _ t) \Rightarrow t])) (CHead c0 (Bind Abst) v) +(CHead e (Bind b) u) H4) in ((let H7 \def (f_equal C B (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abst +| (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).B) with +[(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow Abst])])) (CHead c0 (Bind +Abst) v) (CHead e (Bind b) u) H4) in ((let H8 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | +(CHead c _ _) \Rightarrow c])) (CHead c0 (Bind Abst) v) (CHead e (Bind b) u) +H4) in (eq_ind C e (\lambda (c: C).((eq B Abst b) \to ((eq T v u) \to ((eq C +(CHead c3 (Bind Abbr) w) c2) \to ((csubc g c c3) \to ((sc3 g (asucc g a) c v) +\to ((sc3 g a c3 w) \to (ex2 C (\lambda (e2: C).(clear c2 e2)) (\lambda (e2: +C).(csubc g (CHead e (Bind b) u) e2)))))))))) (\lambda (H9: (eq B Abst +b)).(eq_ind B Abst (\lambda (b0: B).((eq T v u) \to ((eq C (CHead c3 (Bind +Abbr) w) c2) \to ((csubc g e c3) \to ((sc3 g (asucc g a) e v) \to ((sc3 g a +c3 w) \to (ex2 C (\lambda (e2: C).(clear c2 e2)) (\lambda (e2: C).(csubc g +(CHead e (Bind b0) u) e2))))))))) (\lambda (H10: (eq T v u)).(eq_ind T u +(\lambda (t: T).((eq C (CHead c3 (Bind Abbr) w) c2) \to ((csubc g e c3) \to +((sc3 g (asucc g a) e t) \to ((sc3 g a c3 w) \to (ex2 C (\lambda (e2: +C).(clear c2 e2)) (\lambda (e2: C).(csubc g (CHead e (Bind Abst) u) +e2)))))))) (\lambda (H11: (eq C (CHead c3 (Bind Abbr) w) c2)).(eq_ind C +(CHead c3 (Bind Abbr) w) (\lambda (c: C).((csubc g e c3) \to ((sc3 g (asucc g +a) e u) \to ((sc3 g a c3 w) \to (ex2 C (\lambda (e2: C).(clear c e2)) +(\lambda (e2: C).(csubc g (CHead e (Bind Abst) u) e2))))))) (\lambda (H12: +(csubc g e c3)).(\lambda (H13: (sc3 g (asucc g a) e u)).(\lambda (H14: (sc3 g +a c3 w)).(ex_intro2 C (\lambda (e2: C).(clear (CHead c3 (Bind Abbr) w) e2)) +(\lambda (e2: C).(csubc g (CHead e (Bind Abst) u) e2)) (CHead c3 (Bind Abbr) +w) (clear_bind Abbr c3 w) (csubc_abst g e c3 H12 u a H13 w H14))))) c2 H11)) +v (sym_eq T v u H10))) b H9)) c0 (sym_eq C c0 e H8))) H7)) H6)) H5 H1 H2 +H3)))]) in (H1 (refl_equal C (CHead e (Bind b) u)) (refl_equal C c2)))))))) +(\lambda (e: C).(\lambda (c: C).(\lambda (_: (clear e c)).(\lambda (H1: +((\forall (c2: C).((csubc g e c2) \to (ex2 C (\lambda (e2: C).(clear c2 e2)) +(\lambda (e2: C).(csubc g c e2))))))).(\lambda (f: F).(\lambda (u: +T).(\lambda (c2: C).(\lambda (H2: (csubc g (CHead e (Flat f) u) c2)).(let H3 +\def (match H2 in csubc return (\lambda (c0: C).(\lambda (c3: C).(\lambda (_: +(csubc ? c0 c3)).((eq C c0 (CHead e (Flat f) u)) \to ((eq C c3 c2) \to (ex2 C +(\lambda (e2: C).(clear c2 e2)) (\lambda (e2: C).(csubc g c e2)))))))) with +[(csubc_sort n) \Rightarrow (\lambda (H3: (eq C (CSort n) (CHead e (Flat f) +u))).(\lambda (H4: (eq C (CSort n) c2)).((let H5 \def (eq_ind C (CSort n) +(\lambda (e0: C).(match e0 in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow True | (CHead _ _ _) \Rightarrow False])) I (CHead e (Flat f) u) +H3) in (False_ind ((eq C (CSort n) c2) \to (ex2 C (\lambda (e2: C).(clear c2 +e2)) (\lambda (e2: C).(csubc g c e2)))) H5)) H4))) | (csubc_head c0 c3 H3 k +v) \Rightarrow (\lambda (H4: (eq C (CHead c0 k v) (CHead e (Flat f) +u))).(\lambda (H5: (eq C (CHead c3 k v) c2)).((let H6 \def (f_equal C T +(\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow v | (CHead _ _ t) \Rightarrow t])) (CHead c0 k v) (CHead e (Flat +f) u) H4) in ((let H7 \def (f_equal C K (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k0 _) +\Rightarrow k0])) (CHead c0 k v) (CHead e (Flat f) u) H4) in ((let H8 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c4 _ _) \Rightarrow c4])) (CHead c0 k v) +(CHead e (Flat f) u) H4) in (eq_ind C e (\lambda (c4: C).((eq K k (Flat f)) +\to ((eq T v u) \to ((eq C (CHead c3 k v) c2) \to ((csubc g c4 c3) \to (ex2 C +(\lambda (e2: C).(clear c2 e2)) (\lambda (e2: C).(csubc g c e2)))))))) +(\lambda (H9: (eq K k (Flat f))).(eq_ind K (Flat f) (\lambda (k0: K).((eq T v +u) \to ((eq C (CHead c3 k0 v) c2) \to ((csubc g e c3) \to (ex2 C (\lambda +(e2: C).(clear c2 e2)) (\lambda (e2: C).(csubc g c e2))))))) (\lambda (H10: +(eq T v u)).(eq_ind T u (\lambda (t: T).((eq C (CHead c3 (Flat f) t) c2) \to +((csubc g e c3) \to (ex2 C (\lambda (e2: C).(clear c2 e2)) (\lambda (e2: +C).(csubc g c e2)))))) (\lambda (H11: (eq C (CHead c3 (Flat f) u) +c2)).(eq_ind C (CHead c3 (Flat f) u) (\lambda (c4: C).((csubc g e c3) \to +(ex2 C (\lambda (e2: C).(clear c4 e2)) (\lambda (e2: C).(csubc g c e2))))) +(\lambda (H12: (csubc g e c3)).(let H_x \def (H1 c3 H12) in (let H13 \def H_x +in (ex2_ind C (\lambda (e2: C).(clear c3 e2)) (\lambda (e2: C).(csubc g c +e2)) (ex2 C (\lambda (e2: C).(clear (CHead c3 (Flat f) u) e2)) (\lambda (e2: +C).(csubc g c e2))) (\lambda (x: C).(\lambda (H14: (clear c3 x)).(\lambda +(H15: (csubc g c x)).(ex_intro2 C (\lambda (e2: C).(clear (CHead c3 (Flat f) +u) e2)) (\lambda (e2: C).(csubc g c e2)) x (clear_flat c3 x H14 f u) H15)))) +H13)))) c2 H11)) v (sym_eq T v u H10))) k (sym_eq K k (Flat f) H9))) c0 +(sym_eq C c0 e H8))) H7)) H6)) H5 H3))) | (csubc_abst c0 c3 H3 v a H4 w H5) +\Rightarrow (\lambda (H6: (eq C (CHead c0 (Bind Abst) v) (CHead e (Flat f) +u))).(\lambda (H7: (eq C (CHead c3 (Bind Abbr) w) c2)).((let H8 \def (eq_ind +C (CHead c0 (Bind Abst) v) (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | +(Flat _) \Rightarrow False])])) I (CHead e (Flat f) u) H6) in (False_ind ((eq +C (CHead c3 (Bind Abbr) w) c2) \to ((csubc g c0 c3) \to ((sc3 g (asucc g a) +c0 v) \to ((sc3 g a c3 w) \to (ex2 C (\lambda (e2: C).(clear c2 e2)) (\lambda +(e2: C).(csubc g c e2))))))) H8)) H7 H3 H4 H5)))]) in (H3 (refl_equal C +(CHead e (Flat f) u)) (refl_equal C c2))))))))))) c1 e1 H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/csuba.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/csuba.ma new file mode 100644 index 000000000..646247a79 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/csuba.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubc/csuba". + +include "csubc/defs.ma". + +include "sc3/props.ma". + +include "csuba/defs.ma". + +theorem csubc_csuba: + \forall (g: G).(\forall (c1: C).(\forall (c2: C).((csubc g c1 c2) \to (csuba +g c1 c2)))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (csubc g c1 +c2)).(csubc_ind g (\lambda (c: C).(\lambda (c0: C).(csuba g c c0))) (\lambda +(n: nat).(csuba_refl g (CSort n))) (\lambda (c3: C).(\lambda (c4: C).(\lambda +(_: (csubc g c3 c4)).(\lambda (H1: (csuba g c3 c4)).(\lambda (k: K).(\lambda +(v: T).(csuba_head g c3 c4 H1 k v))))))) (\lambda (c3: C).(\lambda (c4: +C).(\lambda (_: (csubc g c3 c4)).(\lambda (H1: (csuba g c3 c4)).(\lambda (v: +T).(\lambda (a: A).(\lambda (H2: (sc3 g (asucc g a) c3 v)).(\lambda (w: +T).(\lambda (H3: (sc3 g a c4 w)).(csuba_abst g c3 c4 H1 v a (sc3_arity_gen g +c3 v (asucc g a) H2) w (sc3_arity_gen g c4 w a H3))))))))))) c1 c2 H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/defs.ma new file mode 100644 index 000000000..6348a632b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/defs.ma @@ -0,0 +1,29 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubc/defs". + +include "sc3/defs.ma". + +inductive csubc (g: G): C \to (C \to Prop) \def +| csubc_sort: \forall (n: nat).(csubc g (CSort n) (CSort n)) +| csubc_head: \forall (c1: C).(\forall (c2: C).((csubc g c1 c2) \to (\forall +(k: K).(\forall (v: T).(csubc g (CHead c1 k v) (CHead c2 k v)))))) +| csubc_abst: \forall (c1: C).(\forall (c2: C).((csubc g c1 c2) \to (\forall +(v: T).(\forall (a: A).((sc3 g (asucc g a) c1 v) \to (\forall (w: T).((sc3 g +a c2 w) \to (csubc g (CHead c1 (Bind Abst) v) (CHead c2 (Bind Abbr) +w))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop.ma new file mode 100644 index 000000000..301cba935 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop.ma @@ -0,0 +1,450 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubc/drop". + +include "csubc/defs.ma". + +include "sc3/props.ma". + +theorem csubc_drop_conf_O: + \forall (g: G).(\forall (c1: C).(\forall (e1: C).(\forall (h: nat).((drop h +O c1 e1) \to (\forall (c2: C).((csubc g c1 c2) \to (ex2 C (\lambda (e2: +C).(drop h O c2 e2)) (\lambda (e2: C).(csubc g e1 e2))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (e1: +C).(\forall (h: nat).((drop h O c e1) \to (\forall (c2: C).((csubc g c c2) +\to (ex2 C (\lambda (e2: C).(drop h O c2 e2)) (\lambda (e2: C).(csubc g e1 +e2))))))))) (\lambda (n: nat).(\lambda (e1: C).(\lambda (h: nat).(\lambda (H: +(drop h O (CSort n) e1)).(\lambda (c2: C).(\lambda (H0: (csubc g (CSort n) +c2)).(and3_ind (eq C e1 (CSort n)) (eq nat h O) (eq nat O O) (ex2 C (\lambda +(e2: C).(drop h O c2 e2)) (\lambda (e2: C).(csubc g e1 e2))) (\lambda (H1: +(eq C e1 (CSort n))).(\lambda (H2: (eq nat h O)).(\lambda (_: (eq nat O +O)).(eq_ind_r nat O (\lambda (n0: nat).(ex2 C (\lambda (e2: C).(drop n0 O c2 +e2)) (\lambda (e2: C).(csubc g e1 e2)))) (eq_ind_r C (CSort n) (\lambda (c: +C).(ex2 C (\lambda (e2: C).(drop O O c2 e2)) (\lambda (e2: C).(csubc g c +e2)))) (ex_intro2 C (\lambda (e2: C).(drop O O c2 e2)) (\lambda (e2: +C).(csubc g (CSort n) e2)) c2 (drop_refl c2) H0) e1 H1) h H2)))) +(drop_gen_sort n h O e1 H)))))))) (\lambda (c: C).(\lambda (H: ((\forall (e1: +C).(\forall (h: nat).((drop h O c e1) \to (\forall (c2: C).((csubc g c c2) +\to (ex2 C (\lambda (e2: C).(drop h O c2 e2)) (\lambda (e2: C).(csubc g e1 +e2)))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (e1: C).(\lambda (h: +nat).(nat_ind (\lambda (n: nat).((drop n O (CHead c k t) e1) \to (\forall +(c2: C).((csubc g (CHead c k t) c2) \to (ex2 C (\lambda (e2: C).(drop n O c2 +e2)) (\lambda (e2: C).(csubc g e1 e2))))))) (\lambda (H0: (drop O O (CHead c +k t) e1)).(\lambda (c2: C).(\lambda (H1: (csubc g (CHead c k t) c2)).(eq_ind +C (CHead c k t) (\lambda (c0: C).(ex2 C (\lambda (e2: C).(drop O O c2 e2)) +(\lambda (e2: C).(csubc g c0 e2)))) (ex_intro2 C (\lambda (e2: C).(drop O O +c2 e2)) (\lambda (e2: C).(csubc g (CHead c k t) e2)) c2 (drop_refl c2) H1) e1 +(drop_gen_refl (CHead c k t) e1 H0))))) (\lambda (n: nat).(\lambda (H0: +(((drop n O (CHead c k t) e1) \to (\forall (c2: C).((csubc g (CHead c k t) +c2) \to (ex2 C (\lambda (e2: C).(drop n O c2 e2)) (\lambda (e2: C).(csubc g +e1 e2)))))))).(\lambda (H1: (drop (S n) O (CHead c k t) e1)).(\lambda (c2: +C).(\lambda (H2: (csubc g (CHead c k t) c2)).(let H3 \def (match H2 in csubc +return (\lambda (c0: C).(\lambda (c3: C).(\lambda (_: (csubc ? c0 c3)).((eq C +c0 (CHead c k t)) \to ((eq C c3 c2) \to (ex2 C (\lambda (e2: C).(drop (S n) O +c2 e2)) (\lambda (e2: C).(csubc g e1 e2)))))))) with [(csubc_sort n0) +\Rightarrow (\lambda (H3: (eq C (CSort n0) (CHead c k t))).(\lambda (H4: (eq +C (CSort n0) c2)).((let H5 \def (eq_ind C (CSort n0) (\lambda (e: C).(match e +in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow True | (CHead _ +_ _) \Rightarrow False])) I (CHead c k t) H3) in (False_ind ((eq C (CSort n0) +c2) \to (ex2 C (\lambda (e2: C).(drop (S n) O c2 e2)) (\lambda (e2: C).(csubc +g e1 e2)))) H5)) H4))) | (csubc_head c0 c3 H3 k0 v) \Rightarrow (\lambda (H4: +(eq C (CHead c0 k0 v) (CHead c k t))).(\lambda (H5: (eq C (CHead c3 k0 v) +c2)).((let H6 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda +(_: C).T) with [(CSort _) \Rightarrow v | (CHead _ _ t0) \Rightarrow t0])) +(CHead c0 k0 v) (CHead c k t) H4) in ((let H7 \def (f_equal C K (\lambda (e: +C).(match e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | +(CHead _ k1 _) \Rightarrow k1])) (CHead c0 k0 v) (CHead c k t) H4) in ((let +H8 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) +with [(CSort _) \Rightarrow c0 | (CHead c4 _ _) \Rightarrow c4])) (CHead c0 +k0 v) (CHead c k t) H4) in (eq_ind C c (\lambda (c4: C).((eq K k0 k) \to ((eq +T v t) \to ((eq C (CHead c3 k0 v) c2) \to ((csubc g c4 c3) \to (ex2 C +(\lambda (e2: C).(drop (S n) O c2 e2)) (\lambda (e2: C).(csubc g e1 +e2)))))))) (\lambda (H9: (eq K k0 k)).(eq_ind K k (\lambda (k1: K).((eq T v +t) \to ((eq C (CHead c3 k1 v) c2) \to ((csubc g c c3) \to (ex2 C (\lambda +(e2: C).(drop (S n) O c2 e2)) (\lambda (e2: C).(csubc g e1 e2))))))) (\lambda +(H10: (eq T v t)).(eq_ind T t (\lambda (t0: T).((eq C (CHead c3 k t0) c2) \to +((csubc g c c3) \to (ex2 C (\lambda (e2: C).(drop (S n) O c2 e2)) (\lambda +(e2: C).(csubc g e1 e2)))))) (\lambda (H11: (eq C (CHead c3 k t) c2)).(eq_ind +C (CHead c3 k t) (\lambda (c4: C).((csubc g c c3) \to (ex2 C (\lambda (e2: +C).(drop (S n) O c4 e2)) (\lambda (e2: C).(csubc g e1 e2))))) (\lambda (H12: +(csubc g c c3)).(let H_x \def (H e1 (r k n) (drop_gen_drop k c e1 t n H1) c3 +H12) in (let H13 \def H_x in (ex2_ind C (\lambda (e2: C).(drop (r k n) O c3 +e2)) (\lambda (e2: C).(csubc g e1 e2)) (ex2 C (\lambda (e2: C).(drop (S n) O +(CHead c3 k t) e2)) (\lambda (e2: C).(csubc g e1 e2))) (\lambda (x: +C).(\lambda (H14: (drop (r k n) O c3 x)).(\lambda (H15: (csubc g e1 +x)).(ex_intro2 C (\lambda (e2: C).(drop (S n) O (CHead c3 k t) e2)) (\lambda +(e2: C).(csubc g e1 e2)) x (drop_drop k n c3 x H14 t) H15)))) H13)))) c2 +H11)) v (sym_eq T v t H10))) k0 (sym_eq K k0 k H9))) c0 (sym_eq C c0 c H8))) +H7)) H6)) H5 H3))) | (csubc_abst c0 c3 H3 v a H4 w H5) \Rightarrow (\lambda +(H6: (eq C (CHead c0 (Bind Abst) v) (CHead c k t))).(\lambda (H7: (eq C +(CHead c3 (Bind Abbr) w) c2)).((let H8 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow v | +(CHead _ _ t0) \Rightarrow t0])) (CHead c0 (Bind Abst) v) (CHead c k t) H6) +in ((let H9 \def (f_equal C K (\lambda (e: C).(match e in C return (\lambda +(_: C).K) with [(CSort _) \Rightarrow (Bind Abst) | (CHead _ k0 _) +\Rightarrow k0])) (CHead c0 (Bind Abst) v) (CHead c k t) H6) in ((let H10 +\def (f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) +with [(CSort _) \Rightarrow c0 | (CHead c4 _ _) \Rightarrow c4])) (CHead c0 +(Bind Abst) v) (CHead c k t) H6) in (eq_ind C c (\lambda (c4: C).((eq K (Bind +Abst) k) \to ((eq T v t) \to ((eq C (CHead c3 (Bind Abbr) w) c2) \to ((csubc +g c4 c3) \to ((sc3 g (asucc g a) c4 v) \to ((sc3 g a c3 w) \to (ex2 C +(\lambda (e2: C).(drop (S n) O c2 e2)) (\lambda (e2: C).(csubc g e1 +e2)))))))))) (\lambda (H11: (eq K (Bind Abst) k)).(eq_ind K (Bind Abst) +(\lambda (_: K).((eq T v t) \to ((eq C (CHead c3 (Bind Abbr) w) c2) \to +((csubc g c c3) \to ((sc3 g (asucc g a) c v) \to ((sc3 g a c3 w) \to (ex2 C +(\lambda (e2: C).(drop (S n) O c2 e2)) (\lambda (e2: C).(csubc g e1 +e2))))))))) (\lambda (H12: (eq T v t)).(eq_ind T t (\lambda (t0: T).((eq C +(CHead c3 (Bind Abbr) w) c2) \to ((csubc g c c3) \to ((sc3 g (asucc g a) c +t0) \to ((sc3 g a c3 w) \to (ex2 C (\lambda (e2: C).(drop (S n) O c2 e2)) +(\lambda (e2: C).(csubc g e1 e2)))))))) (\lambda (H13: (eq C (CHead c3 (Bind +Abbr) w) c2)).(eq_ind C (CHead c3 (Bind Abbr) w) (\lambda (c4: C).((csubc g c +c3) \to ((sc3 g (asucc g a) c t) \to ((sc3 g a c3 w) \to (ex2 C (\lambda (e2: +C).(drop (S n) O c4 e2)) (\lambda (e2: C).(csubc g e1 e2))))))) (\lambda +(H14: (csubc g c c3)).(\lambda (_: (sc3 g (asucc g a) c t)).(\lambda (_: (sc3 +g a c3 w)).(let H17 \def (eq_ind_r K k (\lambda (k0: K).(drop (r k0 n) O c +e1)) (drop_gen_drop k c e1 t n H1) (Bind Abst) H11) in (let H18 \def +(eq_ind_r K k (\lambda (k0: K).((drop n O (CHead c k0 t) e1) \to (\forall +(c4: C).((csubc g (CHead c k0 t) c4) \to (ex2 C (\lambda (e2: C).(drop n O c4 +e2)) (\lambda (e2: C).(csubc g e1 e2))))))) H0 (Bind Abst) H11) in (let H_x +\def (H e1 (r (Bind Abst) n) H17 c3 H14) in (let H19 \def H_x in (ex2_ind C +(\lambda (e2: C).(drop (r (Bind Abst) n) O c3 e2)) (\lambda (e2: C).(csubc g +e1 e2)) (ex2 C (\lambda (e2: C).(drop (S n) O (CHead c3 (Bind Abbr) w) e2)) +(\lambda (e2: C).(csubc g e1 e2))) (\lambda (x: C).(\lambda (H20: (drop (r +(Bind Abst) n) O c3 x)).(\lambda (H21: (csubc g e1 x)).(ex_intro2 C (\lambda +(e2: C).(drop (S n) O (CHead c3 (Bind Abbr) w) e2)) (\lambda (e2: C).(csubc g +e1 e2)) x (drop_drop (Bind Abbr) n c3 x H20 w) H21)))) H19)))))))) c2 H13)) v +(sym_eq T v t H12))) k H11)) c0 (sym_eq C c0 c H10))) H9)) H8)) H7 H3 H4 +H5)))]) in (H3 (refl_equal C (CHead c k t)) (refl_equal C c2)))))))) h))))))) +c1)). + +theorem drop_csubc_trans: + \forall (g: G).(\forall (c2: C).(\forall (e2: C).(\forall (d: nat).(\forall +(h: nat).((drop h d c2 e2) \to (\forall (e1: C).((csubc g e2 e1) \to (ex2 C +(\lambda (c1: C).(drop h d c1 e1)) (\lambda (c1: C).(csubc g c2 c1)))))))))) +\def + \lambda (g: G).(\lambda (c2: C).(C_ind (\lambda (c: C).(\forall (e2: +C).(\forall (d: nat).(\forall (h: nat).((drop h d c e2) \to (\forall (e1: +C).((csubc g e2 e1) \to (ex2 C (\lambda (c1: C).(drop h d c1 e1)) (\lambda +(c1: C).(csubc g c c1)))))))))) (\lambda (n: nat).(\lambda (e2: C).(\lambda +(d: nat).(\lambda (h: nat).(\lambda (H: (drop h d (CSort n) e2)).(\lambda +(e1: C).(\lambda (H0: (csubc g e2 e1)).(and3_ind (eq C e2 (CSort n)) (eq nat +h O) (eq nat d O) (ex2 C (\lambda (c1: C).(drop h d c1 e1)) (\lambda (c1: +C).(csubc g (CSort n) c1))) (\lambda (H1: (eq C e2 (CSort n))).(\lambda (H2: +(eq nat h O)).(\lambda (H3: (eq nat d O)).(eq_ind_r nat O (\lambda (n0: +nat).(ex2 C (\lambda (c1: C).(drop n0 d c1 e1)) (\lambda (c1: C).(csubc g +(CSort n) c1)))) (eq_ind_r nat O (\lambda (n0: nat).(ex2 C (\lambda (c1: +C).(drop O n0 c1 e1)) (\lambda (c1: C).(csubc g (CSort n) c1)))) (let H4 \def +(eq_ind C e2 (\lambda (c: C).(csubc g c e1)) H0 (CSort n) H1) in (ex_intro2 C +(\lambda (c1: C).(drop O O c1 e1)) (\lambda (c1: C).(csubc g (CSort n) c1)) +e1 (drop_refl e1) H4)) d H3) h H2)))) (drop_gen_sort n h d e2 H))))))))) +(\lambda (c: C).(\lambda (H: ((\forall (e2: C).(\forall (d: nat).(\forall (h: +nat).((drop h d c e2) \to (\forall (e1: C).((csubc g e2 e1) \to (ex2 C +(\lambda (c1: C).(drop h d c1 e1)) (\lambda (c1: C).(csubc g c +c1))))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (e2: C).(\lambda (d: +nat).(nat_ind (\lambda (n: nat).(\forall (h: nat).((drop h n (CHead c k t) +e2) \to (\forall (e1: C).((csubc g e2 e1) \to (ex2 C (\lambda (c1: C).(drop h +n c1 e1)) (\lambda (c1: C).(csubc g (CHead c k t) c1)))))))) (\lambda (h: +nat).(nat_ind (\lambda (n: nat).((drop n O (CHead c k t) e2) \to (\forall +(e1: C).((csubc g e2 e1) \to (ex2 C (\lambda (c1: C).(drop n O c1 e1)) +(\lambda (c1: C).(csubc g (CHead c k t) c1))))))) (\lambda (H0: (drop O O +(CHead c k t) e2)).(\lambda (e1: C).(\lambda (H1: (csubc g e2 e1)).(let H2 +\def (eq_ind_r C e2 (\lambda (c0: C).(csubc g c0 e1)) H1 (CHead c k t) +(drop_gen_refl (CHead c k t) e2 H0)) in (ex_intro2 C (\lambda (c1: C).(drop O +O c1 e1)) (\lambda (c1: C).(csubc g (CHead c k t) c1)) e1 (drop_refl e1) +H2))))) (\lambda (n: nat).(\lambda (_: (((drop n O (CHead c k t) e2) \to +(\forall (e1: C).((csubc g e2 e1) \to (ex2 C (\lambda (c1: C).(drop n O c1 +e1)) (\lambda (c1: C).(csubc g (CHead c k t) c1)))))))).(\lambda (H1: (drop +(S n) O (CHead c k t) e2)).(\lambda (e1: C).(\lambda (H2: (csubc g e2 +e1)).(let H_x \def (H e2 O (r k n) (drop_gen_drop k c e2 t n H1) e1 H2) in +(let H3 \def H_x in (ex2_ind C (\lambda (c1: C).(drop (r k n) O c1 e1)) +(\lambda (c1: C).(csubc g c c1)) (ex2 C (\lambda (c1: C).(drop (S n) O c1 +e1)) (\lambda (c1: C).(csubc g (CHead c k t) c1))) (\lambda (x: C).(\lambda +(H4: (drop (r k n) O x e1)).(\lambda (H5: (csubc g c x)).(ex_intro2 C +(\lambda (c1: C).(drop (S n) O c1 e1)) (\lambda (c1: C).(csubc g (CHead c k +t) c1)) (CHead x k t) (drop_drop k n x e1 H4 t) (csubc_head g c x H5 k t))))) +H3)))))))) h)) (\lambda (n: nat).(\lambda (H0: ((\forall (h: nat).((drop h n +(CHead c k t) e2) \to (\forall (e1: C).((csubc g e2 e1) \to (ex2 C (\lambda +(c1: C).(drop h n c1 e1)) (\lambda (c1: C).(csubc g (CHead c k t) +c1))))))))).(\lambda (h: nat).(\lambda (H1: (drop h (S n) (CHead c k t) +e2)).(\lambda (e1: C).(\lambda (H2: (csubc g e2 e1)).(ex3_2_ind C T (\lambda +(e: C).(\lambda (v: T).(eq C e2 (CHead e k v)))) (\lambda (_: C).(\lambda (v: +T).(eq T t (lift h (r k n) v)))) (\lambda (e: C).(\lambda (_: T).(drop h (r k +n) c e))) (ex2 C (\lambda (c1: C).(drop h (S n) c1 e1)) (\lambda (c1: +C).(csubc g (CHead c k t) c1))) (\lambda (x0: C).(\lambda (x1: T).(\lambda +(H3: (eq C e2 (CHead x0 k x1))).(\lambda (H4: (eq T t (lift h (r k n) +x1))).(\lambda (H5: (drop h (r k n) c x0)).(let H6 \def (eq_ind C e2 (\lambda +(c0: C).(csubc g c0 e1)) H2 (CHead x0 k x1) H3) in (let H7 \def (eq_ind C e2 +(\lambda (c0: C).(\forall (h0: nat).((drop h0 n (CHead c k t) c0) \to +(\forall (e3: C).((csubc g c0 e3) \to (ex2 C (\lambda (c1: C).(drop h0 n c1 +e3)) (\lambda (c1: C).(csubc g (CHead c k t) c1)))))))) H0 (CHead x0 k x1) +H3) in (let H8 \def (eq_ind T t (\lambda (t0: T).(\forall (h0: nat).((drop h0 +n (CHead c k t0) (CHead x0 k x1)) \to (\forall (e3: C).((csubc g (CHead x0 k +x1) e3) \to (ex2 C (\lambda (c1: C).(drop h0 n c1 e3)) (\lambda (c1: +C).(csubc g (CHead c k t0) c1)))))))) H7 (lift h (r k n) x1) H4) in (eq_ind_r +T (lift h (r k n) x1) (\lambda (t0: T).(ex2 C (\lambda (c1: C).(drop h (S n) +c1 e1)) (\lambda (c1: C).(csubc g (CHead c k t0) c1)))) (let H9 \def (match +H6 in csubc return (\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csubc ? c0 +c1)).((eq C c0 (CHead x0 k x1)) \to ((eq C c1 e1) \to (ex2 C (\lambda (c3: +C).(drop h (S n) c3 e1)) (\lambda (c3: C).(csubc g (CHead c k (lift h (r k n) +x1)) c3)))))))) with [(csubc_sort n0) \Rightarrow (\lambda (H9: (eq C (CSort +n0) (CHead x0 k x1))).(\lambda (H10: (eq C (CSort n0) e1)).((let H11 \def +(eq_ind C (CSort n0) (\lambda (e: C).(match e in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow +False])) I (CHead x0 k x1) H9) in (False_ind ((eq C (CSort n0) e1) \to (ex2 C +(\lambda (c1: C).(drop h (S n) c1 e1)) (\lambda (c1: C).(csubc g (CHead c k +(lift h (r k n) x1)) c1)))) H11)) H10))) | (csubc_head c1 c0 H9 k0 v) +\Rightarrow (\lambda (H10: (eq C (CHead c1 k0 v) (CHead x0 k x1))).(\lambda +(H11: (eq C (CHead c0 k0 v) e1)).((let H12 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow v | +(CHead _ _ t0) \Rightarrow t0])) (CHead c1 k0 v) (CHead x0 k x1) H10) in +((let H13 \def (f_equal C K (\lambda (e: C).(match e in C return (\lambda (_: +C).K) with [(CSort _) \Rightarrow k0 | (CHead _ k1 _) \Rightarrow k1])) +(CHead c1 k0 v) (CHead x0 k x1) H10) in ((let H14 \def (f_equal C C (\lambda +(e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c1 +| (CHead c3 _ _) \Rightarrow c3])) (CHead c1 k0 v) (CHead x0 k x1) H10) in +(eq_ind C x0 (\lambda (c3: C).((eq K k0 k) \to ((eq T v x1) \to ((eq C (CHead +c0 k0 v) e1) \to ((csubc g c3 c0) \to (ex2 C (\lambda (c4: C).(drop h (S n) +c4 e1)) (\lambda (c4: C).(csubc g (CHead c k (lift h (r k n) x1)) c4)))))))) +(\lambda (H15: (eq K k0 k)).(eq_ind K k (\lambda (k1: K).((eq T v x1) \to +((eq C (CHead c0 k1 v) e1) \to ((csubc g x0 c0) \to (ex2 C (\lambda (c3: +C).(drop h (S n) c3 e1)) (\lambda (c3: C).(csubc g (CHead c k (lift h (r k n) +x1)) c3))))))) (\lambda (H16: (eq T v x1)).(eq_ind T x1 (\lambda (t0: T).((eq +C (CHead c0 k t0) e1) \to ((csubc g x0 c0) \to (ex2 C (\lambda (c3: C).(drop +h (S n) c3 e1)) (\lambda (c3: C).(csubc g (CHead c k (lift h (r k n) x1)) +c3)))))) (\lambda (H17: (eq C (CHead c0 k x1) e1)).(eq_ind C (CHead c0 k x1) +(\lambda (c3: C).((csubc g x0 c0) \to (ex2 C (\lambda (c4: C).(drop h (S n) +c4 c3)) (\lambda (c4: C).(csubc g (CHead c k (lift h (r k n) x1)) c4))))) +(\lambda (H18: (csubc g x0 c0)).(let H_x \def (H x0 (r k n) h H5 c0 H18) in +(let H19 \def H_x in (ex2_ind C (\lambda (c3: C).(drop h (r k n) c3 c0)) +(\lambda (c3: C).(csubc g c c3)) (ex2 C (\lambda (c3: C).(drop h (S n) c3 +(CHead c0 k x1))) (\lambda (c3: C).(csubc g (CHead c k (lift h (r k n) x1)) +c3))) (\lambda (x: C).(\lambda (H20: (drop h (r k n) x c0)).(\lambda (H21: +(csubc g c x)).(ex_intro2 C (\lambda (c3: C).(drop h (S n) c3 (CHead c0 k +x1))) (\lambda (c3: C).(csubc g (CHead c k (lift h (r k n) x1)) c3)) (CHead x +k (lift h (r k n) x1)) (drop_skip k h n x c0 H20 x1) (csubc_head g c x H21 k +(lift h (r k n) x1)))))) H19)))) e1 H17)) v (sym_eq T v x1 H16))) k0 (sym_eq +K k0 k H15))) c1 (sym_eq C c1 x0 H14))) H13)) H12)) H11 H9))) | (csubc_abst +c1 c0 H9 v a H10 w H11) \Rightarrow (\lambda (H12: (eq C (CHead c1 (Bind +Abst) v) (CHead x0 k x1))).(\lambda (H13: (eq C (CHead c0 (Bind Abbr) w) +e1)).((let H14 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow v | (CHead _ _ t0) \Rightarrow +t0])) (CHead c1 (Bind Abst) v) (CHead x0 k x1) H12) in ((let H15 \def +(f_equal C K (\lambda (e: C).(match e in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow (Bind Abst) | (CHead _ k0 _) \Rightarrow k0])) (CHead +c1 (Bind Abst) v) (CHead x0 k x1) H12) in ((let H16 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow c1 | (CHead c3 _ _) \Rightarrow c3])) (CHead c1 (Bind Abst) v) +(CHead x0 k x1) H12) in (eq_ind C x0 (\lambda (c3: C).((eq K (Bind Abst) k) +\to ((eq T v x1) \to ((eq C (CHead c0 (Bind Abbr) w) e1) \to ((csubc g c3 c0) +\to ((sc3 g (asucc g a) c3 v) \to ((sc3 g a c0 w) \to (ex2 C (\lambda (c4: +C).(drop h (S n) c4 e1)) (\lambda (c4: C).(csubc g (CHead c k (lift h (r k n) +x1)) c4)))))))))) (\lambda (H17: (eq K (Bind Abst) k)).(eq_ind K (Bind Abst) +(\lambda (k0: K).((eq T v x1) \to ((eq C (CHead c0 (Bind Abbr) w) e1) \to +((csubc g x0 c0) \to ((sc3 g (asucc g a) x0 v) \to ((sc3 g a c0 w) \to (ex2 C +(\lambda (c3: C).(drop h (S n) c3 e1)) (\lambda (c3: C).(csubc g (CHead c k0 +(lift h (r k0 n) x1)) c3))))))))) (\lambda (H18: (eq T v x1)).(eq_ind T x1 +(\lambda (t0: T).((eq C (CHead c0 (Bind Abbr) w) e1) \to ((csubc g x0 c0) \to +((sc3 g (asucc g a) x0 t0) \to ((sc3 g a c0 w) \to (ex2 C (\lambda (c3: +C).(drop h (S n) c3 e1)) (\lambda (c3: C).(csubc g (CHead c (Bind Abst) (lift +h (r (Bind Abst) n) x1)) c3)))))))) (\lambda (H19: (eq C (CHead c0 (Bind +Abbr) w) e1)).(eq_ind C (CHead c0 (Bind Abbr) w) (\lambda (c3: C).((csubc g +x0 c0) \to ((sc3 g (asucc g a) x0 x1) \to ((sc3 g a c0 w) \to (ex2 C (\lambda +(c4: C).(drop h (S n) c4 c3)) (\lambda (c4: C).(csubc g (CHead c (Bind Abst) +(lift h (r (Bind Abst) n) x1)) c4))))))) (\lambda (H20: (csubc g x0 +c0)).(\lambda (H21: (sc3 g (asucc g a) x0 x1)).(\lambda (H22: (sc3 g a c0 +w)).(let H23 \def (eq_ind_r K k (\lambda (k0: K).(\forall (h0: nat).((drop h0 +n (CHead c k0 (lift h (r k0 n) x1)) (CHead x0 k0 x1)) \to (\forall (e3: +C).((csubc g (CHead x0 k0 x1) e3) \to (ex2 C (\lambda (c3: C).(drop h0 n c3 +e3)) (\lambda (c3: C).(csubc g (CHead c k0 (lift h (r k0 n) x1)) c3)))))))) +H8 (Bind Abst) H17) in (let H24 \def (eq_ind_r K k (\lambda (k0: K).(drop h +(r k0 n) c x0)) H5 (Bind Abst) H17) in (let H_x \def (H x0 (r (Bind Abst) n) +h H24 c0 H20) in (let H25 \def H_x in (ex2_ind C (\lambda (c3: C).(drop h (r +(Bind Abst) n) c3 c0)) (\lambda (c3: C).(csubc g c c3)) (ex2 C (\lambda (c3: +C).(drop h (S n) c3 (CHead c0 (Bind Abbr) w))) (\lambda (c3: C).(csubc g +(CHead c (Bind Abst) (lift h (r (Bind Abst) n) x1)) c3))) (\lambda (x: +C).(\lambda (H26: (drop h (r (Bind Abst) n) x c0)).(\lambda (H27: (csubc g c +x)).(ex_intro2 C (\lambda (c3: C).(drop h (S n) c3 (CHead c0 (Bind Abbr) w))) +(\lambda (c3: C).(csubc g (CHead c (Bind Abst) (lift h (r (Bind Abst) n) x1)) +c3)) (CHead x (Bind Abbr) (lift h n w)) (drop_skip_bind h n x c0 H26 Abbr w) +(csubc_abst g c x H27 (lift h (r (Bind Abst) n) x1) a (sc3_lift g (asucc g a) +x0 x1 H21 c h (r (Bind Abst) n) H24) (lift h n w) (sc3_lift g a c0 w H22 x h +n H26)))))) H25)))))))) e1 H19)) v (sym_eq T v x1 H18))) k H17)) c1 (sym_eq C +c1 x0 H16))) H15)) H14)) H13 H9 H10 H11)))]) in (H9 (refl_equal C (CHead x0 k +x1)) (refl_equal C e1))) t H4))))))))) (drop_gen_skip_l c e2 t h n k +H1)))))))) d))))))) c2)). + +theorem csubc_drop_conf_rev: + \forall (g: G).(\forall (c2: C).(\forall (e2: C).(\forall (d: nat).(\forall +(h: nat).((drop h d c2 e2) \to (\forall (e1: C).((csubc g e1 e2) \to (ex2 C +(\lambda (c1: C).(drop h d c1 e1)) (\lambda (c1: C).(csubc g c1 c2)))))))))) +\def + \lambda (g: G).(\lambda (c2: C).(C_ind (\lambda (c: C).(\forall (e2: +C).(\forall (d: nat).(\forall (h: nat).((drop h d c e2) \to (\forall (e1: +C).((csubc g e1 e2) \to (ex2 C (\lambda (c1: C).(drop h d c1 e1)) (\lambda +(c1: C).(csubc g c1 c)))))))))) (\lambda (n: nat).(\lambda (e2: C).(\lambda +(d: nat).(\lambda (h: nat).(\lambda (H: (drop h d (CSort n) e2)).(\lambda +(e1: C).(\lambda (H0: (csubc g e1 e2)).(and3_ind (eq C e2 (CSort n)) (eq nat +h O) (eq nat d O) (ex2 C (\lambda (c1: C).(drop h d c1 e1)) (\lambda (c1: +C).(csubc g c1 (CSort n)))) (\lambda (H1: (eq C e2 (CSort n))).(\lambda (H2: +(eq nat h O)).(\lambda (H3: (eq nat d O)).(eq_ind_r nat O (\lambda (n0: +nat).(ex2 C (\lambda (c1: C).(drop n0 d c1 e1)) (\lambda (c1: C).(csubc g c1 +(CSort n))))) (eq_ind_r nat O (\lambda (n0: nat).(ex2 C (\lambda (c1: +C).(drop O n0 c1 e1)) (\lambda (c1: C).(csubc g c1 (CSort n))))) (let H4 \def +(eq_ind C e2 (\lambda (c: C).(csubc g e1 c)) H0 (CSort n) H1) in (ex_intro2 C +(\lambda (c1: C).(drop O O c1 e1)) (\lambda (c1: C).(csubc g c1 (CSort n))) +e1 (drop_refl e1) H4)) d H3) h H2)))) (drop_gen_sort n h d e2 H))))))))) +(\lambda (c: C).(\lambda (H: ((\forall (e2: C).(\forall (d: nat).(\forall (h: +nat).((drop h d c e2) \to (\forall (e1: C).((csubc g e1 e2) \to (ex2 C +(\lambda (c1: C).(drop h d c1 e1)) (\lambda (c1: C).(csubc g c1 +c))))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (e2: C).(\lambda (d: +nat).(nat_ind (\lambda (n: nat).(\forall (h: nat).((drop h n (CHead c k t) +e2) \to (\forall (e1: C).((csubc g e1 e2) \to (ex2 C (\lambda (c1: C).(drop h +n c1 e1)) (\lambda (c1: C).(csubc g c1 (CHead c k t))))))))) (\lambda (h: +nat).(nat_ind (\lambda (n: nat).((drop n O (CHead c k t) e2) \to (\forall +(e1: C).((csubc g e1 e2) \to (ex2 C (\lambda (c1: C).(drop n O c1 e1)) +(\lambda (c1: C).(csubc g c1 (CHead c k t)))))))) (\lambda (H0: (drop O O +(CHead c k t) e2)).(\lambda (e1: C).(\lambda (H1: (csubc g e1 e2)).(let H2 +\def (eq_ind_r C e2 (\lambda (c0: C).(csubc g e1 c0)) H1 (CHead c k t) +(drop_gen_refl (CHead c k t) e2 H0)) in (ex_intro2 C (\lambda (c1: C).(drop O +O c1 e1)) (\lambda (c1: C).(csubc g c1 (CHead c k t))) e1 (drop_refl e1) +H2))))) (\lambda (n: nat).(\lambda (_: (((drop n O (CHead c k t) e2) \to +(\forall (e1: C).((csubc g e1 e2) \to (ex2 C (\lambda (c1: C).(drop n O c1 +e1)) (\lambda (c1: C).(csubc g c1 (CHead c k t))))))))).(\lambda (H1: (drop +(S n) O (CHead c k t) e2)).(\lambda (e1: C).(\lambda (H2: (csubc g e1 +e2)).(let H_x \def (H e2 O (r k n) (drop_gen_drop k c e2 t n H1) e1 H2) in +(let H3 \def H_x in (ex2_ind C (\lambda (c1: C).(drop (r k n) O c1 e1)) +(\lambda (c1: C).(csubc g c1 c)) (ex2 C (\lambda (c1: C).(drop (S n) O c1 +e1)) (\lambda (c1: C).(csubc g c1 (CHead c k t)))) (\lambda (x: C).(\lambda +(H4: (drop (r k n) O x e1)).(\lambda (H5: (csubc g x c)).(ex_intro2 C +(\lambda (c1: C).(drop (S n) O c1 e1)) (\lambda (c1: C).(csubc g c1 (CHead c +k t))) (CHead x k t) (drop_drop k n x e1 H4 t) (csubc_head g x c H5 k t))))) +H3)))))))) h)) (\lambda (n: nat).(\lambda (H0: ((\forall (h: nat).((drop h n +(CHead c k t) e2) \to (\forall (e1: C).((csubc g e1 e2) \to (ex2 C (\lambda +(c1: C).(drop h n c1 e1)) (\lambda (c1: C).(csubc g c1 (CHead c k +t)))))))))).(\lambda (h: nat).(\lambda (H1: (drop h (S n) (CHead c k t) +e2)).(\lambda (e1: C).(\lambda (H2: (csubc g e1 e2)).(ex3_2_ind C T (\lambda +(e: C).(\lambda (v: T).(eq C e2 (CHead e k v)))) (\lambda (_: C).(\lambda (v: +T).(eq T t (lift h (r k n) v)))) (\lambda (e: C).(\lambda (_: T).(drop h (r k +n) c e))) (ex2 C (\lambda (c1: C).(drop h (S n) c1 e1)) (\lambda (c1: +C).(csubc g c1 (CHead c k t)))) (\lambda (x0: C).(\lambda (x1: T).(\lambda +(H3: (eq C e2 (CHead x0 k x1))).(\lambda (H4: (eq T t (lift h (r k n) +x1))).(\lambda (H5: (drop h (r k n) c x0)).(let H6 \def (eq_ind C e2 (\lambda +(c0: C).(csubc g e1 c0)) H2 (CHead x0 k x1) H3) in (let H7 \def (eq_ind C e2 +(\lambda (c0: C).(\forall (h0: nat).((drop h0 n (CHead c k t) c0) \to +(\forall (e3: C).((csubc g e3 c0) \to (ex2 C (\lambda (c1: C).(drop h0 n c1 +e3)) (\lambda (c1: C).(csubc g c1 (CHead c k t))))))))) H0 (CHead x0 k x1) +H3) in (let H8 \def (eq_ind T t (\lambda (t0: T).(\forall (h0: nat).((drop h0 +n (CHead c k t0) (CHead x0 k x1)) \to (\forall (e3: C).((csubc g e3 (CHead x0 +k x1)) \to (ex2 C (\lambda (c1: C).(drop h0 n c1 e3)) (\lambda (c1: C).(csubc +g c1 (CHead c k t0))))))))) H7 (lift h (r k n) x1) H4) in (eq_ind_r T (lift h +(r k n) x1) (\lambda (t0: T).(ex2 C (\lambda (c1: C).(drop h (S n) c1 e1)) +(\lambda (c1: C).(csubc g c1 (CHead c k t0))))) (let H9 \def (match H6 in +csubc return (\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (csubc ? c0 +c1)).((eq C c0 e1) \to ((eq C c1 (CHead x0 k x1)) \to (ex2 C (\lambda (c3: +C).(drop h (S n) c3 e1)) (\lambda (c3: C).(csubc g c3 (CHead c k (lift h (r k +n) x1)))))))))) with [(csubc_sort n0) \Rightarrow (\lambda (H9: (eq C (CSort +n0) e1)).(\lambda (H10: (eq C (CSort n0) (CHead x0 k x1))).(eq_ind C (CSort +n0) (\lambda (c0: C).((eq C (CSort n0) (CHead x0 k x1)) \to (ex2 C (\lambda +(c1: C).(drop h (S n) c1 c0)) (\lambda (c1: C).(csubc g c1 (CHead c k (lift h +(r k n) x1))))))) (\lambda (H11: (eq C (CSort n0) (CHead x0 k x1))).(let H12 +\def (eq_ind C (CSort n0) (\lambda (e: C).(match e in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow +False])) I (CHead x0 k x1) H11) in (False_ind (ex2 C (\lambda (c1: C).(drop h +(S n) c1 (CSort n0))) (\lambda (c1: C).(csubc g c1 (CHead c k (lift h (r k n) +x1))))) H12))) e1 H9 H10))) | (csubc_head c1 c0 H9 k0 v) \Rightarrow (\lambda +(H10: (eq C (CHead c1 k0 v) e1)).(\lambda (H11: (eq C (CHead c0 k0 v) (CHead +x0 k x1))).(eq_ind C (CHead c1 k0 v) (\lambda (c3: C).((eq C (CHead c0 k0 v) +(CHead x0 k x1)) \to ((csubc g c1 c0) \to (ex2 C (\lambda (c4: C).(drop h (S +n) c4 c3)) (\lambda (c4: C).(csubc g c4 (CHead c k (lift h (r k n) x1)))))))) +(\lambda (H12: (eq C (CHead c0 k0 v) (CHead x0 k x1))).(let H13 \def (f_equal +C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow v | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 k0 v) (CHead x0 k +x1) H12) in ((let H14 \def (f_equal C K (\lambda (e: C).(match e in C return +(\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | (CHead _ k1 _) +\Rightarrow k1])) (CHead c0 k0 v) (CHead x0 k x1) H12) in ((let H15 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c3 _ _) \Rightarrow c3])) (CHead c0 k0 v) +(CHead x0 k x1) H12) in (eq_ind C x0 (\lambda (c3: C).((eq K k0 k) \to ((eq T +v x1) \to ((csubc g c1 c3) \to (ex2 C (\lambda (c4: C).(drop h (S n) c4 +(CHead c1 k0 v))) (\lambda (c4: C).(csubc g c4 (CHead c k (lift h (r k n) +x1))))))))) (\lambda (H16: (eq K k0 k)).(eq_ind K k (\lambda (k1: K).((eq T v +x1) \to ((csubc g c1 x0) \to (ex2 C (\lambda (c3: C).(drop h (S n) c3 (CHead +c1 k1 v))) (\lambda (c3: C).(csubc g c3 (CHead c k (lift h (r k n) x1)))))))) +(\lambda (H17: (eq T v x1)).(eq_ind T x1 (\lambda (t0: T).((csubc g c1 x0) +\to (ex2 C (\lambda (c3: C).(drop h (S n) c3 (CHead c1 k t0))) (\lambda (c3: +C).(csubc g c3 (CHead c k (lift h (r k n) x1))))))) (\lambda (H18: (csubc g +c1 x0)).(let H19 \def (eq_ind T v (\lambda (t0: T).(eq C (CHead c1 k0 t0) +e1)) H10 x1 H17) in (let H20 \def (eq_ind K k0 (\lambda (k1: K).(eq C (CHead +c1 k1 x1) e1)) H19 k H16) in (let H_x \def (H x0 (r k n) h H5 c1 H18) in (let +H21 \def H_x in (ex2_ind C (\lambda (c3: C).(drop h (r k n) c3 c1)) (\lambda +(c3: C).(csubc g c3 c)) (ex2 C (\lambda (c3: C).(drop h (S n) c3 (CHead c1 k +x1))) (\lambda (c3: C).(csubc g c3 (CHead c k (lift h (r k n) x1))))) +(\lambda (x: C).(\lambda (H22: (drop h (r k n) x c1)).(\lambda (H23: (csubc g +x c)).(ex_intro2 C (\lambda (c3: C).(drop h (S n) c3 (CHead c1 k x1))) +(\lambda (c3: C).(csubc g c3 (CHead c k (lift h (r k n) x1)))) (CHead x k +(lift h (r k n) x1)) (drop_skip k h n x c1 H22 x1) (csubc_head g x c H23 k +(lift h (r k n) x1)))))) H21)))))) v (sym_eq T v x1 H17))) k0 (sym_eq K k0 k +H16))) c0 (sym_eq C c0 x0 H15))) H14)) H13))) e1 H10 H11 H9))) | (csubc_abst +c1 c0 H9 v a H10 w H11) \Rightarrow (\lambda (H12: (eq C (CHead c1 (Bind +Abst) v) e1)).(\lambda (H13: (eq C (CHead c0 (Bind Abbr) w) (CHead x0 k +x1))).(eq_ind C (CHead c1 (Bind Abst) v) (\lambda (c3: C).((eq C (CHead c0 +(Bind Abbr) w) (CHead x0 k x1)) \to ((csubc g c1 c0) \to ((sc3 g (asucc g a) +c1 v) \to ((sc3 g a c0 w) \to (ex2 C (\lambda (c4: C).(drop h (S n) c4 c3)) +(\lambda (c4: C).(csubc g c4 (CHead c k (lift h (r k n) x1)))))))))) (\lambda +(H14: (eq C (CHead c0 (Bind Abbr) w) (CHead x0 k x1))).(let H15 \def (f_equal +C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow w | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 (Bind Abbr) w) +(CHead x0 k x1) H14) in ((let H16 \def (f_equal C K (\lambda (e: C).(match e +in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow (Bind Abbr) | +(CHead _ k0 _) \Rightarrow k0])) (CHead c0 (Bind Abbr) w) (CHead x0 k x1) +H14) in ((let H17 \def (f_equal C C (\lambda (e: C).(match e in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c3 _ _) +\Rightarrow c3])) (CHead c0 (Bind Abbr) w) (CHead x0 k x1) H14) in (eq_ind C +x0 (\lambda (c3: C).((eq K (Bind Abbr) k) \to ((eq T w x1) \to ((csubc g c1 +c3) \to ((sc3 g (asucc g a) c1 v) \to ((sc3 g a c3 w) \to (ex2 C (\lambda +(c4: C).(drop h (S n) c4 (CHead c1 (Bind Abst) v))) (\lambda (c4: C).(csubc g +c4 (CHead c k (lift h (r k n) x1))))))))))) (\lambda (H18: (eq K (Bind Abbr) +k)).(eq_ind K (Bind Abbr) (\lambda (k0: K).((eq T w x1) \to ((csubc g c1 x0) +\to ((sc3 g (asucc g a) c1 v) \to ((sc3 g a x0 w) \to (ex2 C (\lambda (c3: +C).(drop h (S n) c3 (CHead c1 (Bind Abst) v))) (\lambda (c3: C).(csubc g c3 +(CHead c k0 (lift h (r k0 n) x1)))))))))) (\lambda (H19: (eq T w x1)).(eq_ind +T x1 (\lambda (t0: T).((csubc g c1 x0) \to ((sc3 g (asucc g a) c1 v) \to +((sc3 g a x0 t0) \to (ex2 C (\lambda (c3: C).(drop h (S n) c3 (CHead c1 (Bind +Abst) v))) (\lambda (c3: C).(csubc g c3 (CHead c (Bind Abbr) (lift h (r (Bind +Abbr) n) x1))))))))) (\lambda (H20: (csubc g c1 x0)).(\lambda (H21: (sc3 g +(asucc g a) c1 v)).(\lambda (H22: (sc3 g a x0 x1)).(let H23 \def (eq_ind_r K +k (\lambda (k0: K).(\forall (h0: nat).((drop h0 n (CHead c k0 (lift h (r k0 +n) x1)) (CHead x0 k0 x1)) \to (\forall (e3: C).((csubc g e3 (CHead x0 k0 x1)) +\to (ex2 C (\lambda (c3: C).(drop h0 n c3 e3)) (\lambda (c3: C).(csubc g c3 +(CHead c k0 (lift h (r k0 n) x1)))))))))) H8 (Bind Abbr) H18) in (let H24 +\def (eq_ind_r K k (\lambda (k0: K).(drop h (r k0 n) c x0)) H5 (Bind Abbr) +H18) in (let H_x \def (H x0 (r (Bind Abbr) n) h H24 c1 H20) in (let H25 \def +H_x in (ex2_ind C (\lambda (c3: C).(drop h (r (Bind Abbr) n) c3 c1)) (\lambda +(c3: C).(csubc g c3 c)) (ex2 C (\lambda (c3: C).(drop h (S n) c3 (CHead c1 +(Bind Abst) v))) (\lambda (c3: C).(csubc g c3 (CHead c (Bind Abbr) (lift h (r +(Bind Abbr) n) x1))))) (\lambda (x: C).(\lambda (H26: (drop h (r (Bind Abbr) +n) x c1)).(\lambda (H27: (csubc g x c)).(ex_intro2 C (\lambda (c3: C).(drop h +(S n) c3 (CHead c1 (Bind Abst) v))) (\lambda (c3: C).(csubc g c3 (CHead c +(Bind Abbr) (lift h (r (Bind Abbr) n) x1)))) (CHead x (Bind Abst) (lift h n +v)) (drop_skip_bind h n x c1 H26 Abst v) (csubc_abst g x c H27 (lift h n v) a +(sc3_lift g (asucc g a) c1 v H21 x h n H26) (lift h (r (Bind Abbr) n) x1) +(sc3_lift g a x0 x1 H22 c h (r (Bind Abbr) n) H24)))))) H25)))))))) w (sym_eq +T w x1 H19))) k H18)) c0 (sym_eq C c0 x0 H17))) H16)) H15))) e1 H12 H13 H9 +H10 H11)))]) in (H9 (refl_equal C e1) (refl_equal C (CHead x0 k x1)))) t +H4))))))))) (drop_gen_skip_l c e2 t h n k H1)))))))) d))))))) c2)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop1.ma new file mode 100644 index 000000000..75651a172 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop1.ma @@ -0,0 +1,198 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubc/drop1". + +include "csubc/drop.ma". + +theorem drop1_csubc_trans: + \forall (g: G).(\forall (hds: PList).(\forall (c2: C).(\forall (e2: +C).((drop1 hds c2 e2) \to (\forall (e1: C).((csubc g e2 e1) \to (ex2 C +(\lambda (c1: C).(drop1 hds c1 e1)) (\lambda (c1: C).(csubc g c2 c1))))))))) +\def + \lambda (g: G).(\lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall +(c2: C).(\forall (e2: C).((drop1 p c2 e2) \to (\forall (e1: C).((csubc g e2 +e1) \to (ex2 C (\lambda (c1: C).(drop1 p c1 e1)) (\lambda (c1: C).(csubc g c2 +c1))))))))) (\lambda (c2: C).(\lambda (e2: C).(\lambda (H: (drop1 PNil c2 +e2)).(\lambda (e1: C).(\lambda (H0: (csubc g e2 e1)).(let H1 \def (match H in +drop1 return (\lambda (p: PList).(\lambda (c: C).(\lambda (c0: C).(\lambda +(_: (drop1 p c c0)).((eq PList p PNil) \to ((eq C c c2) \to ((eq C c0 e2) \to +(ex2 C (\lambda (c1: C).(drop1 PNil c1 e1)) (\lambda (c1: C).(csubc g c2 +c1)))))))))) with [(drop1_nil c) \Rightarrow (\lambda (_: (eq PList PNil +PNil)).(\lambda (H2: (eq C c c2)).(\lambda (H3: (eq C c e2)).(eq_ind C c2 +(\lambda (c0: C).((eq C c0 e2) \to (ex2 C (\lambda (c1: C).(drop1 PNil c1 +e1)) (\lambda (c1: C).(csubc g c2 c1))))) (\lambda (H4: (eq C c2 e2)).(eq_ind +C e2 (\lambda (c0: C).(ex2 C (\lambda (c1: C).(drop1 PNil c1 e1)) (\lambda +(c1: C).(csubc g c0 c1)))) (let H5 \def (eq_ind_r C e2 (\lambda (c0: +C).(csubc g c0 e1)) H0 c2 H4) in (eq_ind C c2 (\lambda (c0: C).(ex2 C +(\lambda (c1: C).(drop1 PNil c1 e1)) (\lambda (c1: C).(csubc g c0 c1)))) +(ex_intro2 C (\lambda (c1: C).(drop1 PNil c1 e1)) (\lambda (c1: C).(csubc g +c2 c1)) e1 (drop1_nil e1) H5) e2 H4)) c2 (sym_eq C c2 e2 H4))) c (sym_eq C c +c2 H2) H3)))) | (drop1_cons c1 c0 h d H1 c3 hds0 H2) \Rightarrow (\lambda +(H3: (eq PList (PCons h d hds0) PNil)).(\lambda (H4: (eq C c1 c2)).(\lambda +(H5: (eq C c3 e2)).((let H6 \def (eq_ind PList (PCons h d hds0) (\lambda (e: +PList).(match e in PList return (\lambda (_: PList).Prop) with [PNil +\Rightarrow False | (PCons _ _ _) \Rightarrow True])) I PNil H3) in +(False_ind ((eq C c1 c2) \to ((eq C c3 e2) \to ((drop h d c1 c0) \to ((drop1 +hds0 c0 c3) \to (ex2 C (\lambda (c4: C).(drop1 PNil c4 e1)) (\lambda (c4: +C).(csubc g c2 c4))))))) H6)) H4 H5 H1 H2))))]) in (H1 (refl_equal PList +PNil) (refl_equal C c2) (refl_equal C e2)))))))) (\lambda (n: nat).(\lambda +(n0: nat).(\lambda (p: PList).(\lambda (H: ((\forall (c2: C).(\forall (e2: +C).((drop1 p c2 e2) \to (\forall (e1: C).((csubc g e2 e1) \to (ex2 C (\lambda +(c1: C).(drop1 p c1 e1)) (\lambda (c1: C).(csubc g c2 c1)))))))))).(\lambda +(c2: C).(\lambda (e2: C).(\lambda (H0: (drop1 (PCons n n0 p) c2 e2)).(\lambda +(e1: C).(\lambda (H1: (csubc g e2 e1)).(let H2 \def (match H0 in drop1 return +(\lambda (p0: PList).(\lambda (c: C).(\lambda (c0: C).(\lambda (_: (drop1 p0 +c c0)).((eq PList p0 (PCons n n0 p)) \to ((eq C c c2) \to ((eq C c0 e2) \to +(ex2 C (\lambda (c1: C).(drop1 (PCons n n0 p) c1 e1)) (\lambda (c1: C).(csubc +g c2 c1)))))))))) with [(drop1_nil c) \Rightarrow (\lambda (H2: (eq PList +PNil (PCons n n0 p))).(\lambda (H3: (eq C c c2)).(\lambda (H4: (eq C c +e2)).((let H5 \def (eq_ind PList PNil (\lambda (e: PList).(match e in PList +return (\lambda (_: PList).Prop) with [PNil \Rightarrow True | (PCons _ _ _) +\Rightarrow False])) I (PCons n n0 p) H2) in (False_ind ((eq C c c2) \to ((eq +C c e2) \to (ex2 C (\lambda (c1: C).(drop1 (PCons n n0 p) c1 e1)) (\lambda +(c1: C).(csubc g c2 c1))))) H5)) H3 H4)))) | (drop1_cons c1 c0 h d H2 c3 hds0 +H3) \Rightarrow (\lambda (H4: (eq PList (PCons h d hds0) (PCons n n0 +p))).(\lambda (H5: (eq C c1 c2)).(\lambda (H6: (eq C c3 e2)).((let H7 \def +(f_equal PList PList (\lambda (e: PList).(match e in PList return (\lambda +(_: PList).PList) with [PNil \Rightarrow hds0 | (PCons _ _ p0) \Rightarrow +p0])) (PCons h d hds0) (PCons n n0 p) H4) in ((let H8 \def (f_equal PList nat +(\lambda (e: PList).(match e in PList return (\lambda (_: PList).nat) with +[PNil \Rightarrow d | (PCons _ n1 _) \Rightarrow n1])) (PCons h d hds0) +(PCons n n0 p) H4) in ((let H9 \def (f_equal PList nat (\lambda (e: +PList).(match e in PList return (\lambda (_: PList).nat) with [PNil +\Rightarrow h | (PCons n1 _ _) \Rightarrow n1])) (PCons h d hds0) (PCons n n0 +p) H4) in (eq_ind nat n (\lambda (n1: nat).((eq nat d n0) \to ((eq PList hds0 +p) \to ((eq C c1 c2) \to ((eq C c3 e2) \to ((drop n1 d c1 c0) \to ((drop1 +hds0 c0 c3) \to (ex2 C (\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) +(\lambda (c4: C).(csubc g c2 c4)))))))))) (\lambda (H10: (eq nat d +n0)).(eq_ind nat n0 (\lambda (n1: nat).((eq PList hds0 p) \to ((eq C c1 c2) +\to ((eq C c3 e2) \to ((drop n n1 c1 c0) \to ((drop1 hds0 c0 c3) \to (ex2 C +(\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) (\lambda (c4: C).(csubc g c2 +c4))))))))) (\lambda (H11: (eq PList hds0 p)).(eq_ind PList p (\lambda (p0: +PList).((eq C c1 c2) \to ((eq C c3 e2) \to ((drop n n0 c1 c0) \to ((drop1 p0 +c0 c3) \to (ex2 C (\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) (\lambda +(c4: C).(csubc g c2 c4)))))))) (\lambda (H12: (eq C c1 c2)).(eq_ind C c2 +(\lambda (c: C).((eq C c3 e2) \to ((drop n n0 c c0) \to ((drop1 p c0 c3) \to +(ex2 C (\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) (\lambda (c4: C).(csubc +g c2 c4))))))) (\lambda (H13: (eq C c3 e2)).(eq_ind C e2 (\lambda (c: +C).((drop n n0 c2 c0) \to ((drop1 p c0 c) \to (ex2 C (\lambda (c4: C).(drop1 +(PCons n n0 p) c4 e1)) (\lambda (c4: C).(csubc g c2 c4)))))) (\lambda (H14: +(drop n n0 c2 c0)).(\lambda (H15: (drop1 p c0 e2)).(let H_x \def (H c0 e2 H15 +e1 H1) in (let H16 \def H_x in (ex2_ind C (\lambda (c4: C).(drop1 p c4 e1)) +(\lambda (c4: C).(csubc g c0 c4)) (ex2 C (\lambda (c4: C).(drop1 (PCons n n0 +p) c4 e1)) (\lambda (c4: C).(csubc g c2 c4))) (\lambda (x: C).(\lambda (H17: +(drop1 p x e1)).(\lambda (H18: (csubc g c0 x)).(let H_x0 \def +(drop_csubc_trans g c2 c0 n0 n H14 x H18) in (let H19 \def H_x0 in (ex2_ind C +(\lambda (c4: C).(drop n n0 c4 x)) (\lambda (c4: C).(csubc g c2 c4)) (ex2 C +(\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) (\lambda (c4: C).(csubc g c2 +c4))) (\lambda (x0: C).(\lambda (H20: (drop n n0 x0 x)).(\lambda (H21: (csubc +g c2 x0)).(ex_intro2 C (\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) +(\lambda (c4: C).(csubc g c2 c4)) x0 (drop1_cons x0 x n n0 H20 e1 p H17) +H21)))) H19)))))) H16))))) c3 (sym_eq C c3 e2 H13))) c1 (sym_eq C c1 c2 +H12))) hds0 (sym_eq PList hds0 p H11))) d (sym_eq nat d n0 H10))) h (sym_eq +nat h n H9))) H8)) H7)) H5 H6 H2 H3))))]) in (H2 (refl_equal PList (PCons n +n0 p)) (refl_equal C c2) (refl_equal C e2)))))))))))) hds)). + +theorem csubc_drop1_conf_rev: + \forall (g: G).(\forall (hds: PList).(\forall (c2: C).(\forall (e2: +C).((drop1 hds c2 e2) \to (\forall (e1: C).((csubc g e1 e2) \to (ex2 C +(\lambda (c1: C).(drop1 hds c1 e1)) (\lambda (c1: C).(csubc g c1 c2))))))))) +\def + \lambda (g: G).(\lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall +(c2: C).(\forall (e2: C).((drop1 p c2 e2) \to (\forall (e1: C).((csubc g e1 +e2) \to (ex2 C (\lambda (c1: C).(drop1 p c1 e1)) (\lambda (c1: C).(csubc g c1 +c2))))))))) (\lambda (c2: C).(\lambda (e2: C).(\lambda (H: (drop1 PNil c2 +e2)).(\lambda (e1: C).(\lambda (H0: (csubc g e1 e2)).(let H1 \def (match H in +drop1 return (\lambda (p: PList).(\lambda (c: C).(\lambda (c0: C).(\lambda +(_: (drop1 p c c0)).((eq PList p PNil) \to ((eq C c c2) \to ((eq C c0 e2) \to +(ex2 C (\lambda (c1: C).(drop1 PNil c1 e1)) (\lambda (c1: C).(csubc g c1 +c2)))))))))) with [(drop1_nil c) \Rightarrow (\lambda (_: (eq PList PNil +PNil)).(\lambda (H2: (eq C c c2)).(\lambda (H3: (eq C c e2)).(eq_ind C c2 +(\lambda (c0: C).((eq C c0 e2) \to (ex2 C (\lambda (c1: C).(drop1 PNil c1 +e1)) (\lambda (c1: C).(csubc g c1 c2))))) (\lambda (H4: (eq C c2 e2)).(eq_ind +C e2 (\lambda (c0: C).(ex2 C (\lambda (c1: C).(drop1 PNil c1 e1)) (\lambda +(c1: C).(csubc g c1 c0)))) (let H5 \def (eq_ind_r C e2 (\lambda (c0: +C).(csubc g e1 c0)) H0 c2 H4) in (eq_ind C c2 (\lambda (c0: C).(ex2 C +(\lambda (c1: C).(drop1 PNil c1 e1)) (\lambda (c1: C).(csubc g c1 c0)))) +(ex_intro2 C (\lambda (c1: C).(drop1 PNil c1 e1)) (\lambda (c1: C).(csubc g +c1 c2)) e1 (drop1_nil e1) H5) e2 H4)) c2 (sym_eq C c2 e2 H4))) c (sym_eq C c +c2 H2) H3)))) | (drop1_cons c1 c0 h d H1 c3 hds0 H2) \Rightarrow (\lambda +(H3: (eq PList (PCons h d hds0) PNil)).(\lambda (H4: (eq C c1 c2)).(\lambda +(H5: (eq C c3 e2)).((let H6 \def (eq_ind PList (PCons h d hds0) (\lambda (e: +PList).(match e in PList return (\lambda (_: PList).Prop) with [PNil +\Rightarrow False | (PCons _ _ _) \Rightarrow True])) I PNil H3) in +(False_ind ((eq C c1 c2) \to ((eq C c3 e2) \to ((drop h d c1 c0) \to ((drop1 +hds0 c0 c3) \to (ex2 C (\lambda (c4: C).(drop1 PNil c4 e1)) (\lambda (c4: +C).(csubc g c4 c2))))))) H6)) H4 H5 H1 H2))))]) in (H1 (refl_equal PList +PNil) (refl_equal C c2) (refl_equal C e2)))))))) (\lambda (n: nat).(\lambda +(n0: nat).(\lambda (p: PList).(\lambda (H: ((\forall (c2: C).(\forall (e2: +C).((drop1 p c2 e2) \to (\forall (e1: C).((csubc g e1 e2) \to (ex2 C (\lambda +(c1: C).(drop1 p c1 e1)) (\lambda (c1: C).(csubc g c1 c2)))))))))).(\lambda +(c2: C).(\lambda (e2: C).(\lambda (H0: (drop1 (PCons n n0 p) c2 e2)).(\lambda +(e1: C).(\lambda (H1: (csubc g e1 e2)).(let H2 \def (match H0 in drop1 return +(\lambda (p0: PList).(\lambda (c: C).(\lambda (c0: C).(\lambda (_: (drop1 p0 +c c0)).((eq PList p0 (PCons n n0 p)) \to ((eq C c c2) \to ((eq C c0 e2) \to +(ex2 C (\lambda (c1: C).(drop1 (PCons n n0 p) c1 e1)) (\lambda (c1: C).(csubc +g c1 c2)))))))))) with [(drop1_nil c) \Rightarrow (\lambda (H2: (eq PList +PNil (PCons n n0 p))).(\lambda (H3: (eq C c c2)).(\lambda (H4: (eq C c +e2)).((let H5 \def (eq_ind PList PNil (\lambda (e: PList).(match e in PList +return (\lambda (_: PList).Prop) with [PNil \Rightarrow True | (PCons _ _ _) +\Rightarrow False])) I (PCons n n0 p) H2) in (False_ind ((eq C c c2) \to ((eq +C c e2) \to (ex2 C (\lambda (c1: C).(drop1 (PCons n n0 p) c1 e1)) (\lambda +(c1: C).(csubc g c1 c2))))) H5)) H3 H4)))) | (drop1_cons c1 c0 h d H2 c3 hds0 +H3) \Rightarrow (\lambda (H4: (eq PList (PCons h d hds0) (PCons n n0 +p))).(\lambda (H5: (eq C c1 c2)).(\lambda (H6: (eq C c3 e2)).((let H7 \def +(f_equal PList PList (\lambda (e: PList).(match e in PList return (\lambda +(_: PList).PList) with [PNil \Rightarrow hds0 | (PCons _ _ p0) \Rightarrow +p0])) (PCons h d hds0) (PCons n n0 p) H4) in ((let H8 \def (f_equal PList nat +(\lambda (e: PList).(match e in PList return (\lambda (_: PList).nat) with +[PNil \Rightarrow d | (PCons _ n1 _) \Rightarrow n1])) (PCons h d hds0) +(PCons n n0 p) H4) in ((let H9 \def (f_equal PList nat (\lambda (e: +PList).(match e in PList return (\lambda (_: PList).nat) with [PNil +\Rightarrow h | (PCons n1 _ _) \Rightarrow n1])) (PCons h d hds0) (PCons n n0 +p) H4) in (eq_ind nat n (\lambda (n1: nat).((eq nat d n0) \to ((eq PList hds0 +p) \to ((eq C c1 c2) \to ((eq C c3 e2) \to ((drop n1 d c1 c0) \to ((drop1 +hds0 c0 c3) \to (ex2 C (\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) +(\lambda (c4: C).(csubc g c4 c2)))))))))) (\lambda (H10: (eq nat d +n0)).(eq_ind nat n0 (\lambda (n1: nat).((eq PList hds0 p) \to ((eq C c1 c2) +\to ((eq C c3 e2) \to ((drop n n1 c1 c0) \to ((drop1 hds0 c0 c3) \to (ex2 C +(\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) (\lambda (c4: C).(csubc g c4 +c2))))))))) (\lambda (H11: (eq PList hds0 p)).(eq_ind PList p (\lambda (p0: +PList).((eq C c1 c2) \to ((eq C c3 e2) \to ((drop n n0 c1 c0) \to ((drop1 p0 +c0 c3) \to (ex2 C (\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) (\lambda +(c4: C).(csubc g c4 c2)))))))) (\lambda (H12: (eq C c1 c2)).(eq_ind C c2 +(\lambda (c: C).((eq C c3 e2) \to ((drop n n0 c c0) \to ((drop1 p c0 c3) \to +(ex2 C (\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) (\lambda (c4: C).(csubc +g c4 c2))))))) (\lambda (H13: (eq C c3 e2)).(eq_ind C e2 (\lambda (c: +C).((drop n n0 c2 c0) \to ((drop1 p c0 c) \to (ex2 C (\lambda (c4: C).(drop1 +(PCons n n0 p) c4 e1)) (\lambda (c4: C).(csubc g c4 c2)))))) (\lambda (H14: +(drop n n0 c2 c0)).(\lambda (H15: (drop1 p c0 e2)).(let H_x \def (H c0 e2 H15 +e1 H1) in (let H16 \def H_x in (ex2_ind C (\lambda (c4: C).(drop1 p c4 e1)) +(\lambda (c4: C).(csubc g c4 c0)) (ex2 C (\lambda (c4: C).(drop1 (PCons n n0 +p) c4 e1)) (\lambda (c4: C).(csubc g c4 c2))) (\lambda (x: C).(\lambda (H17: +(drop1 p x e1)).(\lambda (H18: (csubc g x c0)).(let H_x0 \def +(csubc_drop_conf_rev g c2 c0 n0 n H14 x H18) in (let H19 \def H_x0 in +(ex2_ind C (\lambda (c4: C).(drop n n0 c4 x)) (\lambda (c4: C).(csubc g c4 +c2)) (ex2 C (\lambda (c4: C).(drop1 (PCons n n0 p) c4 e1)) (\lambda (c4: +C).(csubc g c4 c2))) (\lambda (x0: C).(\lambda (H20: (drop n n0 x0 +x)).(\lambda (H21: (csubc g x0 c2)).(ex_intro2 C (\lambda (c4: C).(drop1 +(PCons n n0 p) c4 e1)) (\lambda (c4: C).(csubc g c4 c2)) x0 (drop1_cons x0 x +n n0 H20 e1 p H17) H21)))) H19)))))) H16))))) c3 (sym_eq C c3 e2 H13))) c1 +(sym_eq C c1 c2 H12))) hds0 (sym_eq PList hds0 p H11))) d (sym_eq nat d n0 +H10))) h (sym_eq nat h n H9))) H8)) H7)) H5 H6 H2 H3))))]) in (H2 (refl_equal +PList (PCons n n0 p)) (refl_equal C c2) (refl_equal C e2)))))))))))) hds)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/getl.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/getl.ma new file mode 100644 index 000000000..dd2a0397c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/getl.ma @@ -0,0 +1,44 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubc/getl". + +include "csubc/drop.ma". + +include "csubc/clear.ma". + +theorem csubc_getl_conf: + \forall (g: G).(\forall (c1: C).(\forall (e1: C).(\forall (i: nat).((getl i +c1 e1) \to (\forall (c2: C).((csubc g c1 c2) \to (ex2 C (\lambda (e2: +C).(getl i c2 e2)) (\lambda (e2: C).(csubc g e1 e2))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (e1: C).(\lambda (i: nat).(\lambda +(H: (getl i c1 e1)).(\lambda (c2: C).(\lambda (H0: (csubc g c1 c2)).(let H1 +\def (getl_gen_all c1 e1 i H) in (ex2_ind C (\lambda (e: C).(drop i O c1 e)) +(\lambda (e: C).(clear e e1)) (ex2 C (\lambda (e2: C).(getl i c2 e2)) +(\lambda (e2: C).(csubc g e1 e2))) (\lambda (x: C).(\lambda (H2: (drop i O c1 +x)).(\lambda (H3: (clear x e1)).(let H_x \def (csubc_drop_conf_O g c1 x i H2 +c2 H0) in (let H4 \def H_x in (ex2_ind C (\lambda (e2: C).(drop i O c2 e2)) +(\lambda (e2: C).(csubc g x e2)) (ex2 C (\lambda (e2: C).(getl i c2 e2)) +(\lambda (e2: C).(csubc g e1 e2))) (\lambda (x0: C).(\lambda (H5: (drop i O +c2 x0)).(\lambda (H6: (csubc g x x0)).(let H_x0 \def (csubc_clear_conf g x e1 +H3 x0 H6) in (let H7 \def H_x0 in (ex2_ind C (\lambda (e2: C).(clear x0 e2)) +(\lambda (e2: C).(csubc g e1 e2)) (ex2 C (\lambda (e2: C).(getl i c2 e2)) +(\lambda (e2: C).(csubc g e1 e2))) (\lambda (x1: C).(\lambda (H8: (clear x0 +x1)).(\lambda (H9: (csubc g e1 x1)).(ex_intro2 C (\lambda (e2: C).(getl i c2 +e2)) (\lambda (e2: C).(csubc g e1 e2)) x1 (getl_intro i c2 x1 x0 H5 H8) +H9)))) H7)))))) H4)))))) H1)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/props.ma new file mode 100644 index 000000000..d13d2b09f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/props.ma @@ -0,0 +1,29 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubc/props". + +include "csubc/defs.ma". + +include "sc3/props.ma". + +theorem csubc_refl: + \forall (g: G).(\forall (c: C).(csubc g c c)) +\def + \lambda (g: G).(\lambda (c: C).(C_ind (\lambda (c0: C).(csubc g c0 c0)) +(\lambda (n: nat).(csubc_sort g n)) (\lambda (c0: C).(\lambda (H: (csubc g c0 +c0)).(\lambda (k: K).(\lambda (t: T).(csubc_head g c0 c0 H k t))))) c)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/clear.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/clear.ma new file mode 100644 index 000000000..fb9fdf5a5 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/clear.ma @@ -0,0 +1,1029 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst0/clear". + +include "csubst0/fwd.ma". + +include "clear/fwd.ma". + +theorem csubst0_clear_O: + \forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 O v c1 c2) \to +(\forall (c: C).((clear c1 c) \to (clear c2 c)))))) +\def + \lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: C).(\forall (v: +T).((csubst0 O v c c2) \to (\forall (c0: C).((clear c c0) \to (clear c2 +c0))))))) (\lambda (n: nat).(\lambda (c2: C).(\lambda (v: T).(\lambda (H: +(csubst0 O v (CSort n) c2)).(\lambda (c: C).(\lambda (_: (clear (CSort n) +c)).(csubst0_gen_sort c2 v O n H (clear c2 c)))))))) (\lambda (c: C).(\lambda +(H: ((\forall (c2: C).(\forall (v: T).((csubst0 O v c c2) \to (\forall (c0: +C).((clear c c0) \to (clear c2 c0)))))))).(\lambda (k: K).(\lambda (t: +T).(\lambda (c2: C).(\lambda (v: T).(\lambda (H0: (csubst0 O v (CHead c k t) +c2)).(\lambda (c0: C).(\lambda (H1: (clear (CHead c k t) c0)).(or3_ind (ex3_2 +T nat (\lambda (_: T).(\lambda (j: nat).(eq nat O (s k j)))) (\lambda (u2: +T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v t u2)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat O (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k +t)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c c3)))) (ex4_3 T C nat +(\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat O (s k j))))) +(\lambda (u2: T).(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k +u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v t +u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c +c3))))) (clear c2 c0) (\lambda (H2: (ex3_2 T nat (\lambda (_: T).(\lambda (j: +nat).(eq nat O (s k j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 (CHead +c k u2)))) (\lambda (u2: T).(\lambda (j: nat).(subst0 j v t +u2))))).(ex3_2_ind T nat (\lambda (_: T).(\lambda (j: nat).(eq nat O (s k +j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda +(u2: T).(\lambda (j: nat).(subst0 j v t u2))) (clear c2 c0) (\lambda (x0: +T).(\lambda (x1: nat).(\lambda (H3: (eq nat O (s k x1))).(\lambda (H4: (eq C +c2 (CHead c k x0))).(\lambda (H5: (subst0 x1 v t x0)).(eq_ind_r C (CHead c k +x0) (\lambda (c3: C).(clear c3 c0)) (K_ind (\lambda (k0: K).((clear (CHead c +k0 t) c0) \to ((eq nat O (s k0 x1)) \to (clear (CHead c k0 x0) c0)))) +(\lambda (b: B).(\lambda (_: (clear (CHead c (Bind b) t) c0)).(\lambda (H7: +(eq nat O (s (Bind b) x1))).(let H8 \def (eq_ind nat O (\lambda (ee: +nat).(match ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow True +| (S _) \Rightarrow False])) I (S x1) H7) in (False_ind (clear (CHead c (Bind +b) x0) c0) H8))))) (\lambda (f: F).(\lambda (H6: (clear (CHead c (Flat f) t) +c0)).(\lambda (H7: (eq nat O (s (Flat f) x1))).(let H8 \def (eq_ind_r nat x1 +(\lambda (n: nat).(subst0 n v t x0)) H5 O H7) in (clear_flat c c0 +(clear_gen_flat f c c0 t H6) f x0))))) k H1 H3) c2 H4)))))) H2)) (\lambda +(H2: (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq nat O (s k j)))) +(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k t)))) (\lambda (c3: +C).(\lambda (j: nat).(csubst0 j v c c3))))).(ex3_2_ind C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat O (s k j)))) (\lambda (c3: C).(\lambda (_: +nat).(eq C c2 (CHead c3 k t)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j +v c c3))) (clear c2 c0) (\lambda (x0: C).(\lambda (x1: nat).(\lambda (H3: (eq +nat O (s k x1))).(\lambda (H4: (eq C c2 (CHead x0 k t))).(\lambda (H5: +(csubst0 x1 v c x0)).(eq_ind_r C (CHead x0 k t) (\lambda (c3: C).(clear c3 +c0)) (K_ind (\lambda (k0: K).((clear (CHead c k0 t) c0) \to ((eq nat O (s k0 +x1)) \to (clear (CHead x0 k0 t) c0)))) (\lambda (b: B).(\lambda (_: (clear +(CHead c (Bind b) t) c0)).(\lambda (H7: (eq nat O (s (Bind b) x1))).(let H8 +\def (eq_ind nat O (\lambda (ee: nat).(match ee in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) I (S x1) H7) +in (False_ind (clear (CHead x0 (Bind b) t) c0) H8))))) (\lambda (f: +F).(\lambda (H6: (clear (CHead c (Flat f) t) c0)).(\lambda (H7: (eq nat O (s +(Flat f) x1))).(let H8 \def (eq_ind_r nat x1 (\lambda (n: nat).(csubst0 n v c +x0)) H5 O H7) in (clear_flat x0 c0 (H x0 v H8 c0 (clear_gen_flat f c c0 t +H6)) f t))))) k H1 H3) c2 H4)))))) H2)) (\lambda (H2: (ex4_3 T C nat (\lambda +(_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat O (s k j))))) (\lambda (u2: +T).(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda +(u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c c3)))))).(ex4_3_ind T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat O (s k j))))) +(\lambda (u2: T).(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k +u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v t +u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c +c3)))) (clear c2 c0) (\lambda (x0: T).(\lambda (x1: C).(\lambda (x2: +nat).(\lambda (H3: (eq nat O (s k x2))).(\lambda (H4: (eq C c2 (CHead x1 k +x0))).(\lambda (H5: (subst0 x2 v t x0)).(\lambda (H6: (csubst0 x2 v c +x1)).(eq_ind_r C (CHead x1 k x0) (\lambda (c3: C).(clear c3 c0)) (K_ind +(\lambda (k0: K).((clear (CHead c k0 t) c0) \to ((eq nat O (s k0 x2)) \to +(clear (CHead x1 k0 x0) c0)))) (\lambda (b: B).(\lambda (_: (clear (CHead c +(Bind b) t) c0)).(\lambda (H8: (eq nat O (s (Bind b) x2))).(let H9 \def +(eq_ind nat O (\lambda (ee: nat).(match ee in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) I (S x2) H8) +in (False_ind (clear (CHead x1 (Bind b) x0) c0) H9))))) (\lambda (f: +F).(\lambda (H7: (clear (CHead c (Flat f) t) c0)).(\lambda (H8: (eq nat O (s +(Flat f) x2))).(let H9 \def (eq_ind_r nat x2 (\lambda (n: nat).(csubst0 n v c +x1)) H6 O H8) in (let H10 \def (eq_ind_r nat x2 (\lambda (n: nat).(subst0 n v +t x0)) H5 O H8) in (clear_flat x1 c0 (H x1 v H9 c0 (clear_gen_flat f c c0 t +H7)) f x0)))))) k H1 H3) c2 H4)))))))) H2)) (csubst0_gen_head k c c2 t v O +H0))))))))))) c1). + +theorem csubst0_clear_O_back: + \forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 O v c1 c2) \to +(\forall (c: C).((clear c2 c) \to (clear c1 c)))))) +\def + \lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: C).(\forall (v: +T).((csubst0 O v c c2) \to (\forall (c0: C).((clear c2 c0) \to (clear c +c0))))))) (\lambda (n: nat).(\lambda (c2: C).(\lambda (v: T).(\lambda (H: +(csubst0 O v (CSort n) c2)).(\lambda (c: C).(\lambda (_: (clear c2 +c)).(csubst0_gen_sort c2 v O n H (clear (CSort n) c)))))))) (\lambda (c: +C).(\lambda (H: ((\forall (c2: C).(\forall (v: T).((csubst0 O v c c2) \to +(\forall (c0: C).((clear c2 c0) \to (clear c c0)))))))).(\lambda (k: +K).(\lambda (t: T).(\lambda (c2: C).(\lambda (v: T).(\lambda (H0: (csubst0 O +v (CHead c k t) c2)).(\lambda (c0: C).(\lambda (H1: (clear c2 c0)).(or3_ind +(ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat O (s k j)))) (\lambda +(u2: T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda (u2: +T).(\lambda (j: nat).(subst0 j v t u2)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat O (s k j)))) (\lambda (c3: C).(\lambda (_: +nat).(eq C c2 (CHead c3 k t)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j +v c c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: +nat).(eq nat O (s k j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: +nat).(eq C c2 (CHead c3 k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda +(j: nat).(subst0 j v t u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c c3))))) (clear (CHead c k t) c0) (\lambda (H2: (ex3_2 T +nat (\lambda (_: T).(\lambda (j: nat).(eq nat O (s k j)))) (\lambda (u2: +T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v t u2))))).(ex3_2_ind T nat (\lambda (_: T).(\lambda (j: +nat).(eq nat O (s k j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 (CHead +c k u2)))) (\lambda (u2: T).(\lambda (j: nat).(subst0 j v t u2))) (clear +(CHead c k t) c0) (\lambda (x0: T).(\lambda (x1: nat).(\lambda (H3: (eq nat O +(s k x1))).(\lambda (H4: (eq C c2 (CHead c k x0))).(\lambda (H5: (subst0 x1 v +t x0)).(let H6 \def (eq_ind C c2 (\lambda (c3: C).(clear c3 c0)) H1 (CHead c +k x0) H4) in (K_ind (\lambda (k0: K).((eq nat O (s k0 x1)) \to ((clear (CHead +c k0 x0) c0) \to (clear (CHead c k0 t) c0)))) (\lambda (b: B).(\lambda (H7: +(eq nat O (s (Bind b) x1))).(\lambda (_: (clear (CHead c (Bind b) x0) +c0)).(let H9 \def (eq_ind nat O (\lambda (ee: nat).(match ee in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) +I (S x1) H7) in (False_ind (clear (CHead c (Bind b) t) c0) H9))))) (\lambda +(f: F).(\lambda (H7: (eq nat O (s (Flat f) x1))).(\lambda (H8: (clear (CHead +c (Flat f) x0) c0)).(let H9 \def (eq_ind_r nat x1 (\lambda (n: nat).(subst0 n +v t x0)) H5 O H7) in (clear_flat c c0 (clear_gen_flat f c c0 x0 H8) f t))))) +k H3 H6))))))) H2)) (\lambda (H2: (ex3_2 C nat (\lambda (_: C).(\lambda (j: +nat).(eq nat O (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead +c3 k t)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c +c3))))).(ex3_2_ind C nat (\lambda (_: C).(\lambda (j: nat).(eq nat O (s k +j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k t)))) (\lambda +(c3: C).(\lambda (j: nat).(csubst0 j v c c3))) (clear (CHead c k t) c0) +(\lambda (x0: C).(\lambda (x1: nat).(\lambda (H3: (eq nat O (s k +x1))).(\lambda (H4: (eq C c2 (CHead x0 k t))).(\lambda (H5: (csubst0 x1 v c +x0)).(let H6 \def (eq_ind C c2 (\lambda (c3: C).(clear c3 c0)) H1 (CHead x0 k +t) H4) in (K_ind (\lambda (k0: K).((eq nat O (s k0 x1)) \to ((clear (CHead x0 +k0 t) c0) \to (clear (CHead c k0 t) c0)))) (\lambda (b: B).(\lambda (H7: (eq +nat O (s (Bind b) x1))).(\lambda (_: (clear (CHead x0 (Bind b) t) c0)).(let +H9 \def (eq_ind nat O (\lambda (ee: nat).(match ee in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) I (S x1) H7) +in (False_ind (clear (CHead c (Bind b) t) c0) H9))))) (\lambda (f: +F).(\lambda (H7: (eq nat O (s (Flat f) x1))).(\lambda (H8: (clear (CHead x0 +(Flat f) t) c0)).(let H9 \def (eq_ind_r nat x1 (\lambda (n: nat).(csubst0 n v +c x0)) H5 O H7) in (clear_flat c c0 (H x0 v H9 c0 (clear_gen_flat f x0 c0 t +H8)) f t))))) k H3 H6))))))) H2)) (\lambda (H2: (ex4_3 T C nat (\lambda (_: +T).(\lambda (_: C).(\lambda (j: nat).(eq nat O (s k j))))) (\lambda (u2: +T).(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda +(u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c c3)))))).(ex4_3_ind T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat O (s k j))))) +(\lambda (u2: T).(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k +u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v t +u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c +c3)))) (clear (CHead c k t) c0) (\lambda (x0: T).(\lambda (x1: C).(\lambda +(x2: nat).(\lambda (H3: (eq nat O (s k x2))).(\lambda (H4: (eq C c2 (CHead x1 +k x0))).(\lambda (H5: (subst0 x2 v t x0)).(\lambda (H6: (csubst0 x2 v c +x1)).(let H7 \def (eq_ind C c2 (\lambda (c3: C).(clear c3 c0)) H1 (CHead x1 k +x0) H4) in (K_ind (\lambda (k0: K).((eq nat O (s k0 x2)) \to ((clear (CHead +x1 k0 x0) c0) \to (clear (CHead c k0 t) c0)))) (\lambda (b: B).(\lambda (H8: +(eq nat O (s (Bind b) x2))).(\lambda (_: (clear (CHead x1 (Bind b) x0) +c0)).(let H10 \def (eq_ind nat O (\lambda (ee: nat).(match ee in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) +I (S x2) H8) in (False_ind (clear (CHead c (Bind b) t) c0) H10))))) (\lambda +(f: F).(\lambda (H8: (eq nat O (s (Flat f) x2))).(\lambda (H9: (clear (CHead +x1 (Flat f) x0) c0)).(let H10 \def (eq_ind_r nat x2 (\lambda (n: +nat).(csubst0 n v c x1)) H6 O H8) in (let H11 \def (eq_ind_r nat x2 (\lambda +(n: nat).(subst0 n v t x0)) H5 O H8) in (clear_flat c c0 (H x1 v H10 c0 +(clear_gen_flat f x1 c0 x0 H9)) f t)))))) k H3 H7))))))))) H2)) +(csubst0_gen_head k c c2 t v O H0))))))))))) c1). + +theorem csubst0_clear_S: + \forall (c1: C).(\forall (c2: C).(\forall (v: T).(\forall (i: nat).((csubst0 +(S i) v c1 c2) \to (\forall (c: C).((clear c1 c) \to (or4 (clear c2 c) (ex3_4 +B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq +C c (CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: +T).(\lambda (u2: T).(clear c2 (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear c2 (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c (CHead e1 (Bind b) u1))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(clear c2 (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 i v e1 e2)))))))))))))) +\def + \lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: C).(\forall (v: +T).(\forall (i: nat).((csubst0 (S i) v c c2) \to (\forall (c0: C).((clear c +c0) \to (or4 (clear c2 c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear c2 +(CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear c2 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear c2 (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))))))))))) (\lambda (n: nat).(\lambda (c2: C).(\lambda (v: T).(\lambda +(i: nat).(\lambda (H: (csubst0 (S i) v (CSort n) c2)).(\lambda (c: +C).(\lambda (_: (clear (CSort n) c)).(csubst0_gen_sort c2 v (S i) n H (or4 +(clear c2 c) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c (CHead e (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear c2 (CHead e (Bind +b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear c2 +(CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear c2 (CHead e2 (Bind b) u2))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2)))))))))))))))) +(\lambda (c: C).(\lambda (H: ((\forall (c2: C).(\forall (v: T).(\forall (i: +nat).((csubst0 (S i) v c c2) \to (\forall (c0: C).((clear c c0) \to (or4 +(clear c2 c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear c2 (CHead e (Bind +b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear c2 +(CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear c2 (CHead e2 (Bind b) u2))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))))))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (c2: C).(\lambda +(v: T).(\lambda (i: nat).(\lambda (H0: (csubst0 (S i) v (CHead c k t) +c2)).(\lambda (c0: C).(\lambda (H1: (clear (CHead c k t) c0)).(or3_ind (ex3_2 +T nat (\lambda (_: T).(\lambda (j: nat).(eq nat (S i) (s k j)))) (\lambda +(u2: T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda (u2: +T).(\lambda (j: nat).(subst0 j v t u2)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat (S i) (s k j)))) (\lambda (c3: C).(\lambda (_: +nat).(eq C c2 (CHead c3 k t)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j +v c c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: +nat).(eq nat (S i) (s k j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: +nat).(eq C c2 (CHead c3 k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda +(j: nat).(subst0 j v t u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c c3))))) (or4 (clear c2 c0) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind +b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: +T).(clear c2 (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear +c2 (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +i v e1 e2)))))))) (\lambda (H2: (ex3_2 T nat (\lambda (_: T).(\lambda (j: +nat).(eq nat (S i) (s k j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 +(CHead c k u2)))) (\lambda (u2: T).(\lambda (j: nat).(subst0 j v t +u2))))).(ex3_2_ind T nat (\lambda (_: T).(\lambda (j: nat).(eq nat (S i) (s k +j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda +(u2: T).(\lambda (j: nat).(subst0 j v t u2))) (or4 (clear c2 c0) (ex3_4 B C T +T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: +T).(\lambda (u2: T).(clear c2 (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear c2 (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(clear c2 (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 i v e1 e2)))))))) (\lambda (x0: T).(\lambda (x1: +nat).(\lambda (H3: (eq nat (S i) (s k x1))).(\lambda (H4: (eq C c2 (CHead c k +x0))).(\lambda (H5: (subst0 x1 v t x0)).(eq_ind_r C (CHead c k x0) (\lambda +(c3: C).(or4 (clear c3 c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear c3 +(CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear c3 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear c3 (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))))) (K_ind (\lambda (k0: K).((clear (CHead c k0 t) c0) \to ((eq nat +(S i) (s k0 x1)) \to (or4 (clear (CHead c k0 x0) c0) (ex3_4 B C T T (\lambda +(b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e +(Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda +(u2: T).(clear (CHead c k0 x0) (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead c k0 x0) (CHead e2 (Bind b) +u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind +b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(clear (CHead c k0 x0) (CHead e2 (Bind b) u2))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))))))) +(\lambda (b: B).(\lambda (H6: (clear (CHead c (Bind b) t) c0)).(\lambda (H7: +(eq nat (S i) (s (Bind b) x1))).(let H8 \def (f_equal nat nat (\lambda (e: +nat).(match e in nat return (\lambda (_: nat).nat) with [O \Rightarrow i | (S +n) \Rightarrow n])) (S i) (S x1) H7) in (let H9 \def (eq_ind_r nat x1 +(\lambda (n: nat).(subst0 n v t x0)) H5 i H8) in (eq_ind_r C (CHead c (Bind +b) t) (\lambda (c3: C).(or4 (clear (CHead c (Bind b) x0) c3) (ex3_4 B C T T +(\lambda (b0: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c3 +(CHead e (Bind b0) u1)))))) (\lambda (b0: B).(\lambda (e: C).(\lambda (_: +T).(\lambda (u2: T).(clear (CHead c (Bind b) x0) (CHead e (Bind b0) u2)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v +u1 u2)))))) (ex3_4 B C C T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c3 (CHead e1 (Bind b0) u)))))) (\lambda (b0: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead c (Bind b) +x0) (CHead e2 (Bind b0) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda +(b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq +C c3 (CHead e1 (Bind b0) u1))))))) (\lambda (b0: B).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead c (Bind b) x0) (CHead +e2 (Bind b0) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +i v e1 e2))))))))) (or4_intro1 (clear (CHead c (Bind b) x0) (CHead c (Bind b) +t)) (ex3_4 B C T T (\lambda (b0: B).(\lambda (e: C).(\lambda (u1: T).(\lambda +(_: T).(eq C (CHead c (Bind b) t) (CHead e (Bind b0) u1)))))) (\lambda (b0: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead c (Bind b) +x0) (CHead e (Bind b0) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b0: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead c (Bind b) +t) (CHead e1 (Bind b0) u)))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead c (Bind b) x0) (CHead e2 (Bind b0) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead c (Bind b) t) (CHead e1 +(Bind b0) u1))))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead c (Bind b) x0) (CHead e2 +(Bind b0) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))) (ex3_4_intro B C T T (\lambda (b0: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C (CHead c (Bind b) t) (CHead e (Bind b0) u1)))))) +(\lambda (b0: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead c (Bind b) x0) (CHead e (Bind b0) u2)))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2))))) b c t x0 +(refl_equal C (CHead c (Bind b) t)) (clear_bind b c x0) H9)) c0 +(clear_gen_bind b c c0 t H6))))))) (\lambda (f: F).(\lambda (H6: (clear +(CHead c (Flat f) t) c0)).(\lambda (H7: (eq nat (S i) (s (Flat f) x1))).(let +H8 \def (f_equal nat nat (\lambda (e: nat).e) (S i) (s (Flat f) x1) H7) in +(let H9 \def (eq_ind_r nat x1 (\lambda (n: nat).(subst0 n v t x0)) H5 (S i) +H8) in (or4_intro0 (clear (CHead c (Flat f) x0) c0) (ex3_4 B C T T (\lambda +(b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e +(Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda +(u2: T).(clear (CHead c (Flat f) x0) (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead c (Flat f) x0) (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(clear (CHead c (Flat f) x0) (CHead e2 (Bind b) +u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))) +(clear_flat c c0 (clear_gen_flat f c c0 t H6) f x0))))))) k H1 H3) c2 +H4)))))) H2)) (\lambda (H2: (ex3_2 C nat (\lambda (_: C).(\lambda (j: +nat).(eq nat (S i) (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 +(CHead c3 k t)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c +c3))))).(ex3_2_ind C nat (\lambda (_: C).(\lambda (j: nat).(eq nat (S i) (s k +j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k t)))) (\lambda +(c3: C).(\lambda (j: nat).(csubst0 j v c c3))) (or4 (clear c2 c0) (ex3_4 B C +T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: +T).(\lambda (u2: T).(clear c2 (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear c2 (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(clear c2 (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 i v e1 e2)))))))) (\lambda (x0: C).(\lambda (x1: +nat).(\lambda (H3: (eq nat (S i) (s k x1))).(\lambda (H4: (eq C c2 (CHead x0 +k t))).(\lambda (H5: (csubst0 x1 v c x0)).(eq_ind_r C (CHead x0 k t) (\lambda +(c3: C).(or4 (clear c3 c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear c3 +(CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear c3 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear c3 (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))))) (K_ind (\lambda (k0: K).((clear (CHead c k0 t) c0) \to ((eq nat +(S i) (s k0 x1)) \to (or4 (clear (CHead x0 k0 t) c0) (ex3_4 B C T T (\lambda +(b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e +(Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda +(u2: T).(clear (CHead x0 k0 t) (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x0 k0 t) (CHead e2 (Bind b) +u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind +b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(clear (CHead x0 k0 t) (CHead e2 (Bind b) u2))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))))))) +(\lambda (b: B).(\lambda (H6: (clear (CHead c (Bind b) t) c0)).(\lambda (H7: +(eq nat (S i) (s (Bind b) x1))).(let H8 \def (f_equal nat nat (\lambda (e: +nat).(match e in nat return (\lambda (_: nat).nat) with [O \Rightarrow i | (S +n) \Rightarrow n])) (S i) (S x1) H7) in (let H9 \def (eq_ind_r nat x1 +(\lambda (n: nat).(csubst0 n v c x0)) H5 i H8) in (eq_ind_r C (CHead c (Bind +b) t) (\lambda (c3: C).(or4 (clear (CHead x0 (Bind b) t) c3) (ex3_4 B C T T +(\lambda (b0: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c3 +(CHead e (Bind b0) u1)))))) (\lambda (b0: B).(\lambda (e: C).(\lambda (_: +T).(\lambda (u2: T).(clear (CHead x0 (Bind b) t) (CHead e (Bind b0) u2)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v +u1 u2)))))) (ex3_4 B C C T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c3 (CHead e1 (Bind b0) u)))))) (\lambda (b0: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x0 (Bind b) +t) (CHead e2 (Bind b0) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b0: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c3 +(CHead e1 (Bind b0) u1))))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x0 (Bind b) t) (CHead e2 +(Bind b0) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))))) (or4_intro2 (clear (CHead x0 (Bind b) t) (CHead c (Bind b) t)) +(ex3_4 B C T T (\lambda (b0: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: +T).(eq C (CHead c (Bind b) t) (CHead e (Bind b0) u1)))))) (\lambda (b0: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x0 (Bind b) +t) (CHead e (Bind b0) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b0: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead c (Bind b) +t) (CHead e1 (Bind b0) u)))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead x0 (Bind b) t) (CHead e2 (Bind b0) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead c (Bind b) t) (CHead e1 +(Bind b0) u1))))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x0 (Bind b) t) (CHead e2 +(Bind b0) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))) (ex3_4_intro B C C T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C (CHead c (Bind b) t) (CHead e1 (Bind b0) u)))))) +(\lambda (b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear +(CHead x0 (Bind b) t) (CHead e2 (Bind b0) u)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2))))) b c x0 t +(refl_equal C (CHead c (Bind b) t)) (clear_bind b x0 t) H9)) c0 +(clear_gen_bind b c c0 t H6))))))) (\lambda (f: F).(\lambda (H6: (clear +(CHead c (Flat f) t) c0)).(\lambda (H7: (eq nat (S i) (s (Flat f) x1))).(let +H8 \def (f_equal nat nat (\lambda (e: nat).e) (S i) (s (Flat f) x1) H7) in +(let H9 \def (eq_ind_r nat x1 (\lambda (n: nat).(csubst0 n v c x0)) H5 (S i) +H8) in (let H10 \def (H x0 v i H9 c0 (clear_gen_flat f c c0 t H6)) in +(or4_ind (clear x0 c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear x0 +(CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear x0 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear x0 (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))) (or4 (clear (CHead x0 (Flat f) t) c0) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind +b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: +T).(clear (CHead x0 (Flat f) t) (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x0 (Flat f) t) (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(clear (CHead x0 (Flat f) t) (CHead e2 (Bind b) +u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))))) (\lambda (H11: (clear x0 c0)).(or4_intro0 (clear (CHead x0 (Flat +f) t) c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x0 (Flat f) +t) (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear (CHead x0 (Flat f) t) (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x0 (Flat f) t) (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 +u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 i v e1 e2))))))) (clear_flat x0 c0 H11 f t))) +(\lambda (H11: (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear x0 (CHead e (Bind +b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear x0 +(CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2))))) (or4 (clear (CHead x0 (Flat f) t) +c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x0 (Flat f) t) (CHead e +(Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear +(CHead x0 (Flat f) t) (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C +C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x0 (Flat f) t) (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 +u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 i v e1 e2)))))))) (\lambda (x2: B).(\lambda (x3: +C).(\lambda (x4: T).(\lambda (x5: T).(\lambda (H12: (eq C c0 (CHead x3 (Bind +x2) x4))).(\lambda (H13: (clear x0 (CHead x3 (Bind x2) x5))).(\lambda (H14: +(subst0 i v x4 x5)).(or4_intro1 (clear (CHead x0 (Flat f) t) c0) (ex3_4 B C T +T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: +T).(\lambda (u2: T).(clear (CHead x0 (Flat f) t) (CHead e (Bind b) u2)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v +u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x0 (Flat f) +t) (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x0 (Flat f) t) (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))) (ex3_4_intro B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x0 (Flat f) +t) (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2))))) x2 x3 x4 x5 H12 (clear_flat x0 +(CHead x3 (Bind x2) x5) H13 f t) H14))))))))) H11)) (\lambda (H11: (ex3_4 B C +C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear x0 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 +e2))))))).(ex3_4_ind B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear x0 (CHead e2 (Bind +b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 i v e1 e2))))) (or4 (clear (CHead x0 (Flat f) t) c0) (ex3_4 B C T +T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: +T).(\lambda (u2: T).(clear (CHead x0 (Flat f) t) (CHead e (Bind b) u2)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v +u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x0 (Flat f) +t) (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x0 (Flat f) t) (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))))) (\lambda (x2: B).(\lambda (x3: C).(\lambda (x4: C).(\lambda (x5: +T).(\lambda (H12: (eq C c0 (CHead x3 (Bind x2) x5))).(\lambda (H13: (clear x0 +(CHead x4 (Bind x2) x5))).(\lambda (H14: (csubst0 i v x3 x4)).(or4_intro2 +(clear (CHead x0 (Flat f) t) c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x0 (Flat f) t) (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead x0 (Flat f) t) (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(clear (CHead x0 (Flat f) t) (CHead e2 (Bind b) u2))))))) (\lambda +(_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))) (ex3_4_intro B C +C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead x0 (Flat f) t) (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2))))) x2 x3 x4 x5 H12 (clear_flat x0 (CHead x4 (Bind x2) x5) H13 f t) +H14))))))))) H11)) (\lambda (H11: (ex4_5 B C C T T (\lambda (b: B).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(clear x0 (CHead e2 (Bind b) u2))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 i v e1 e2)))))))).(ex4_5_ind B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear x0 (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))) (or4 (clear (CHead x0 (Flat f) t) c0) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind +b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: +T).(clear (CHead x0 (Flat f) t) (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x0 (Flat f) t) (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(clear (CHead x0 (Flat f) t) (CHead e2 (Bind b) +u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))))) (\lambda (x2: B).(\lambda (x3: C).(\lambda (x4: C).(\lambda (x5: +T).(\lambda (x6: T).(\lambda (H12: (eq C c0 (CHead x3 (Bind x2) +x5))).(\lambda (H13: (clear x0 (CHead x4 (Bind x2) x6))).(\lambda (H14: +(subst0 i v x5 x6)).(\lambda (H15: (csubst0 i v x3 x4)).(or4_intro3 (clear +(CHead x0 (Flat f) t) c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x0 (Flat f) t) (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead x0 (Flat f) t) (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(clear (CHead x0 (Flat f) t) (CHead e2 (Bind b) u2))))))) (\lambda +(_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))) (ex4_5_intro B C +C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x0 (Flat f) t) (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 +u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 i v e1 e2)))))) x2 x3 x4 x5 x6 H12 (clear_flat x0 +(CHead x4 (Bind x2) x6) H13 f t) H14 H15))))))))))) H11)) H10))))))) k H1 H3) +c2 H4)))))) H2)) (\lambda (H2: (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat (S i) (s k j))))) (\lambda (u2: T).(\lambda (c3: +C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda (u2: T).(\lambda +(_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: T).(\lambda (c3: +C).(\lambda (j: nat).(csubst0 j v c c3)))))).(ex4_3_ind T C nat (\lambda (_: +T).(\lambda (_: C).(\lambda (j: nat).(eq nat (S i) (s k j))))) (\lambda (u2: +T).(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda +(u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c c3)))) (or4 (clear c2 +c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: +C).(\lambda (_: T).(\lambda (u2: T).(clear c2 (CHead e (Bind b) u2)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v +u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear c2 (CHead e2 (Bind +b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind +b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(clear c2 (CHead e2 (Bind b) u2))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 i v e1 e2)))))))) (\lambda (x0: T).(\lambda +(x1: C).(\lambda (x2: nat).(\lambda (H3: (eq nat (S i) (s k x2))).(\lambda +(H4: (eq C c2 (CHead x1 k x0))).(\lambda (H5: (subst0 x2 v t x0)).(\lambda +(H6: (csubst0 x2 v c x1)).(eq_ind_r C (CHead x1 k x0) (\lambda (c3: C).(or4 +(clear c3 c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear c3 (CHead e (Bind +b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear c3 +(CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear c3 (CHead e2 (Bind b) u2))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))))) (K_ind +(\lambda (k0: K).((clear (CHead c k0 t) c0) \to ((eq nat (S i) (s k0 x2)) \to +(or4 (clear (CHead x1 k0 x0) c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x1 k0 x0) (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead x1 k0 x0) (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(clear (CHead x1 k0 x0) (CHead e2 (Bind b) u2))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))))))) (\lambda (b: B).(\lambda +(H7: (clear (CHead c (Bind b) t) c0)).(\lambda (H8: (eq nat (S i) (s (Bind b) +x2))).(let H9 \def (f_equal nat nat (\lambda (e: nat).(match e in nat return +(\lambda (_: nat).nat) with [O \Rightarrow i | (S n) \Rightarrow n])) (S i) +(S x2) H8) in (let H10 \def (eq_ind_r nat x2 (\lambda (n: nat).(csubst0 n v c +x1)) H6 i H9) in (let H11 \def (eq_ind_r nat x2 (\lambda (n: nat).(subst0 n v +t x0)) H5 i H9) in (eq_ind_r C (CHead c (Bind b) t) (\lambda (c3: C).(or4 +(clear (CHead x1 (Bind b) x0) c3) (ex3_4 B C T T (\lambda (b0: B).(\lambda +(e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c3 (CHead e (Bind b0) u1)))))) +(\lambda (b0: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x1 (Bind b) x0) (CHead e (Bind b0) u2)))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C +T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c3 +(CHead e1 (Bind b0) u)))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead x1 (Bind b) x0) (CHead e2 (Bind b0) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c3 (CHead e1 (Bind b0) u1))))))) +(\lambda (b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(clear (CHead x1 (Bind b) x0) (CHead e2 (Bind b0) u2))))))) (\lambda +(_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))))) (or4_intro3 +(clear (CHead x1 (Bind b) x0) (CHead c (Bind b) t)) (ex3_4 B C T T (\lambda +(b0: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead c (Bind +b) t) (CHead e (Bind b0) u1)))))) (\lambda (b0: B).(\lambda (e: C).(\lambda +(_: T).(\lambda (u2: T).(clear (CHead x1 (Bind b) x0) (CHead e (Bind b0) +u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b0: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead c (Bind b) t) (CHead e1 (Bind +b0) u)))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear (CHead x1 (Bind b) x0) (CHead e2 (Bind b0) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(eq C (CHead c (Bind b) t) (CHead e1 (Bind b0) +u1))))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(clear (CHead x1 (Bind b) x0) (CHead e2 (Bind b0) +u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))) +(ex4_5_intro B C C T T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead c (Bind b) t) (CHead e1 +(Bind b0) u1))))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x1 (Bind b) x0) (CHead e2 +(Bind b0) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))) b c x1 t x0 (refl_equal C (CHead c (Bind b) t)) (clear_bind b x1 x0) +H11 H10)) c0 (clear_gen_bind b c c0 t H7)))))))) (\lambda (f: F).(\lambda +(H7: (clear (CHead c (Flat f) t) c0)).(\lambda (H8: (eq nat (S i) (s (Flat f) +x2))).(let H9 \def (f_equal nat nat (\lambda (e: nat).e) (S i) (s (Flat f) +x2) H8) in (let H10 \def (eq_ind_r nat x2 (\lambda (n: nat).(csubst0 n v c +x1)) H6 (S i) H9) in (let H11 \def (eq_ind_r nat x2 (\lambda (n: nat).(subst0 +n v t x0)) H5 (S i) H9) in (let H12 \def (H x1 v i H10 c0 (clear_gen_flat f c +c0 t H7)) in (or4_ind (clear x1 c0) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear x1 +(CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear x1 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear x1 (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))) (or4 (clear (CHead x1 (Flat f) x0) c0) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind +b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: +T).(clear (CHead x1 (Flat f) x0) (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x1 (Flat f) x0) (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(clear (CHead x1 (Flat f) x0) (CHead e2 (Bind b) +u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))))) (\lambda (H13: (clear x1 c0)).(or4_intro0 (clear (CHead x1 (Flat +f) x0) c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x1 (Flat f) +x0) (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear (CHead x1 (Flat f) x0) (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x1 (Flat f) x0) (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 +u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 i v e1 e2))))))) (clear_flat x1 c0 H13 f x0))) +(\lambda (H13: (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear x1 (CHead e (Bind +b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear x1 +(CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2))))) (or4 (clear (CHead x1 (Flat f) x0) +c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x1 (Flat f) x0) (CHead e +(Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear +(CHead x1 (Flat f) x0) (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C +C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x1 (Flat f) x0) (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 +u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 i v e1 e2)))))))) (\lambda (x3: B).(\lambda (x4: +C).(\lambda (x5: T).(\lambda (x6: T).(\lambda (H14: (eq C c0 (CHead x4 (Bind +x3) x5))).(\lambda (H15: (clear x1 (CHead x4 (Bind x3) x6))).(\lambda (H16: +(subst0 i v x5 x6)).(or4_intro1 (clear (CHead x1 (Flat f) x0) c0) (ex3_4 B C +T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: +T).(\lambda (u2: T).(clear (CHead x1 (Flat f) x0) (CHead e (Bind b) u2)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v +u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x1 (Flat f) +x0) (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x1 (Flat f) x0) (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2))))))) (ex3_4_intro B C T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x1 (Flat f) +x0) (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2))))) x3 x4 x5 x6 H14 (clear_flat x1 +(CHead x4 (Bind x3) x6) H15 f x0) H16))))))))) H13)) (\lambda (H13: (ex3_4 B +C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C +c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear x1 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i v e1 +e2))))))).(ex3_4_ind B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear x1 (CHead e2 (Bind +b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 i v e1 e2))))) (or4 (clear (CHead x1 (Flat f) x0) c0) (ex3_4 B C +T T (\lambda (b: B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e (Bind b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: +T).(\lambda (u2: T).(clear (CHead x1 (Flat f) x0) (CHead e (Bind b) u2)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v +u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x1 (Flat f) +x0) (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear (CHead x1 (Flat f) x0) (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))))) (\lambda (x3: B).(\lambda (x4: C).(\lambda (x5: C).(\lambda (x6: +T).(\lambda (H14: (eq C c0 (CHead x4 (Bind x3) x6))).(\lambda (H15: (clear x1 +(CHead x5 (Bind x3) x6))).(\lambda (H16: (csubst0 i v x4 x5)).(or4_intro2 +(clear (CHead x1 (Flat f) x0) c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x1 (Flat f) x0) (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C +T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead x1 (Flat f) x0) (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(clear (CHead x1 (Flat f) x0) (CHead e2 (Bind b) u2))))))) (\lambda +(_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))) (ex3_4_intro B C +C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead x1 (Flat f) x0) (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2))))) x3 x4 x5 x6 H14 (clear_flat x1 (CHead x5 (Bind x3) x6) H15 f x0) +H16))))))))) H13)) (\lambda (H13: (ex4_5 B C C T T (\lambda (b: B).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(clear x1 (CHead e2 (Bind b) u2))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 i v e1 e2)))))))).(ex4_5_ind B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear x1 (CHead e2 +(Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))) (or4 (clear (CHead x1 (Flat f) x0) c0) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind +b) u1)))))) (\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: +T).(clear (CHead x1 (Flat f) x0) (CHead e (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) +(ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c0 (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(clear (CHead x1 (Flat f) x0) (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 i v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(clear (CHead x1 (Flat f) x0) (CHead e2 (Bind b) +u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 +e2)))))))) (\lambda (x3: B).(\lambda (x4: C).(\lambda (x5: C).(\lambda (x6: +T).(\lambda (x7: T).(\lambda (H14: (eq C c0 (CHead x4 (Bind x3) +x6))).(\lambda (H15: (clear x1 (CHead x5 (Bind x3) x7))).(\lambda (H16: +(subst0 i v x6 x7)).(\lambda (H17: (csubst0 i v x4 x5)).(or4_intro3 (clear +(CHead x1 (Flat f) x0) c0) (ex3_4 B C T T (\lambda (b: B).(\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x1 (Flat f) x0) (CHead e (Bind b) u2)))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 u2)))))) (ex3_4 B C C +T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c0 +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(clear (CHead x1 (Flat f) x0) (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 i +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(clear (CHead x1 (Flat f) x0) (CHead e2 (Bind b) u2))))))) (\lambda +(_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 i v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 i v e1 e2))))))) (ex4_5_intro B C +C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(eq C c0 (CHead e1 (Bind b) u1))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear +(CHead x1 (Flat f) x0) (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda +(_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 i v u1 +u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 i v e1 e2)))))) x3 x4 x5 x6 x7 H14 (clear_flat x1 +(CHead x5 (Bind x3) x7) H15 f x0) H16 H17))))))))))) H13)) H12)))))))) k H1 +H3) c2 H4)))))))) H2)) (csubst0_gen_head k c c2 t v (S i) H0)))))))))))) c1). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/defs.ma new file mode 100644 index 000000000..5d90ea599 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/defs.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst0/defs". + +include "subst0/defs.ma". + +include "C/defs.ma". + +inductive csubst0: nat \to (T \to (C \to (C \to Prop))) \def +| csubst0_snd: \forall (k: K).(\forall (i: nat).(\forall (v: T).(\forall (u1: +T).(\forall (u2: T).((subst0 i v u1 u2) \to (\forall (c: C).(csubst0 (s k i) +v (CHead c k u1) (CHead c k u2)))))))) +| csubst0_fst: \forall (k: K).(\forall (i: nat).(\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst0 i v c1 c2) \to (\forall (u: T).(csubst0 (s +k i) v (CHead c1 k u) (CHead c2 k u)))))))) +| csubst0_both: \forall (k: K).(\forall (i: nat).(\forall (v: T).(\forall +(u1: T).(\forall (u2: T).((subst0 i v u1 u2) \to (\forall (c1: C).(\forall +(c2: C).((csubst0 i v c1 c2) \to (csubst0 (s k i) v (CHead c1 k u1) (CHead c2 +k u2)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/drop.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/drop.ma new file mode 100644 index 000000000..b1a063208 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/drop.ma @@ -0,0 +1,6496 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst0/drop". + +include "csubst0/fwd.ma". + +include "drop/fwd.ma". + +include "s/props.ma". + +theorem csubst0_drop_gt: + \forall (n: nat).(\forall (i: nat).((lt i n) \to (\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst0 i v c1 c2) \to (\forall (e: C).((drop n O +c1 e) \to (drop n O c2 e))))))))) +\def + \lambda (n: nat).(nat_ind (\lambda (n0: nat).(\forall (i: nat).((lt i n0) +\to (\forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 i v c1 c2) +\to (\forall (e: C).((drop n0 O c1 e) \to (drop n0 O c2 e)))))))))) (\lambda +(i: nat).(\lambda (H: (lt i O)).(\lambda (c1: C).(\lambda (c2: C).(\lambda +(v: T).(\lambda (_: (csubst0 i v c1 c2)).(\lambda (e: C).(\lambda (_: (drop O +O c1 e)).(let H2 \def (match H in le return (\lambda (n0: nat).(\lambda (_: +(le ? n0)).((eq nat n0 O) \to (drop O O c2 e)))) with [le_n \Rightarrow +(\lambda (H2: (eq nat (S i) O)).(let H3 \def (eq_ind nat (S i) (\lambda (e0: +nat).(match e0 in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +False | (S _) \Rightarrow True])) I O H2) in (False_ind (drop O O c2 e) H3))) +| (le_S m H2) \Rightarrow (\lambda (H3: (eq nat (S m) O)).((let H4 \def +(eq_ind nat (S m) (\lambda (e0: nat).(match e0 in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H3) in +(False_ind ((le (S i) m) \to (drop O O c2 e)) H4)) H2))]) in (H2 (refl_equal +nat O))))))))))) (\lambda (n0: nat).(\lambda (H: ((\forall (i: nat).((lt i +n0) \to (\forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 i v c1 +c2) \to (\forall (e: C).((drop n0 O c1 e) \to (drop n0 O c2 +e))))))))))).(\lambda (i: nat).(\lambda (H0: (lt i (S n0))).(\lambda (c1: +C).(C_ind (\lambda (c: C).(\forall (c2: C).(\forall (v: T).((csubst0 i v c +c2) \to (\forall (e: C).((drop (S n0) O c e) \to (drop (S n0) O c2 e))))))) +(\lambda (n1: nat).(\lambda (c2: C).(\lambda (v: T).(\lambda (_: (csubst0 i v +(CSort n1) c2)).(\lambda (e: C).(\lambda (H2: (drop (S n0) O (CSort n1) +e)).(and3_ind (eq C e (CSort n1)) (eq nat (S n0) O) (eq nat O O) (drop (S n0) +O c2 e) (\lambda (H3: (eq C e (CSort n1))).(\lambda (H4: (eq nat (S n0) +O)).(\lambda (_: (eq nat O O)).(eq_ind_r C (CSort n1) (\lambda (c: C).(drop +(S n0) O c2 c)) (let H6 \def (eq_ind nat (S n0) (\lambda (ee: nat).(match ee +in nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H4) in (False_ind (drop (S n0) O c2 (CSort n1)) H6)) +e H3)))) (drop_gen_sort n1 (S n0) O e H2)))))))) (\lambda (c: C).(\lambda +(H1: ((\forall (c2: C).(\forall (v: T).((csubst0 i v c c2) \to (\forall (e: +C).((drop (S n0) O c e) \to (drop (S n0) O c2 e)))))))).(\lambda (k: +K).(\lambda (t: T).(\lambda (c2: C).(\lambda (v: T).(\lambda (H2: (csubst0 i +v (CHead c k t) c2)).(\lambda (e: C).(\lambda (H3: (drop (S n0) O (CHead c k +t) e)).(or3_ind (ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat i (s k +j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda +(u2: T).(\lambda (j: nat).(subst0 j v t u2)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat i (s k j)))) (\lambda (c3: C).(\lambda (_: +nat).(eq C c2 (CHead c3 k t)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j +v c c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: +nat).(eq nat i (s k j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: +nat).(eq C c2 (CHead c3 k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda +(j: nat).(subst0 j v t u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c c3))))) (drop (S n0) O c2 e) (\lambda (H4: (ex3_2 T nat +(\lambda (_: T).(\lambda (j: nat).(eq nat i (s k j)))) (\lambda (u2: +T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v t u2))))).(ex3_2_ind T nat (\lambda (_: T).(\lambda (j: +nat).(eq nat i (s k j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 (CHead +c k u2)))) (\lambda (u2: T).(\lambda (j: nat).(subst0 j v t u2))) (drop (S +n0) O c2 e) (\lambda (x0: T).(\lambda (x1: nat).(\lambda (H5: (eq nat i (s k +x1))).(\lambda (H6: (eq C c2 (CHead c k x0))).(\lambda (_: (subst0 x1 v t +x0)).(eq_ind_r C (CHead c k x0) (\lambda (c0: C).(drop (S n0) O c0 e)) (let +H8 \def (eq_ind nat i (\lambda (n1: nat).(\forall (c3: C).(\forall (v0: +T).((csubst0 n1 v0 c c3) \to (\forall (e0: C).((drop (S n0) O c e0) \to (drop +(S n0) O c3 e0))))))) H1 (s k x1) H5) in (let H9 \def (eq_ind nat i (\lambda +(n1: nat).(lt n1 (S n0))) H0 (s k x1) H5) in (K_ind (\lambda (k0: K).((drop +(r k0 n0) O c e) \to (((\forall (c3: C).(\forall (v0: T).((csubst0 (s k0 x1) +v0 c c3) \to (\forall (e0: C).((drop (S n0) O c e0) \to (drop (S n0) O c3 +e0))))))) \to ((lt (s k0 x1) (S n0)) \to (drop (S n0) O (CHead c k0 x0) +e))))) (\lambda (b: B).(\lambda (H10: (drop (r (Bind b) n0) O c e)).(\lambda +(_: ((\forall (c3: C).(\forall (v0: T).((csubst0 (s (Bind b) x1) v0 c c3) \to +(\forall (e0: C).((drop (S n0) O c e0) \to (drop (S n0) O c3 +e0)))))))).(\lambda (_: (lt (s (Bind b) x1) (S n0))).(drop_drop (Bind b) n0 c +e H10 x0))))) (\lambda (f: F).(\lambda (H10: (drop (r (Flat f) n0) O c +e)).(\lambda (_: ((\forall (c3: C).(\forall (v0: T).((csubst0 (s (Flat f) x1) +v0 c c3) \to (\forall (e0: C).((drop (S n0) O c e0) \to (drop (S n0) O c3 +e0)))))))).(\lambda (H12: (lt (s (Flat f) x1) (S n0))).(or_ind (eq nat x1 O) +(ex2 nat (\lambda (m: nat).(eq nat x1 (S m))) (\lambda (m: nat).(lt m n0))) +(drop (S n0) O (CHead c (Flat f) x0) e) (\lambda (_: (eq nat x1 +O)).(drop_drop (Flat f) n0 c e H10 x0)) (\lambda (H13: (ex2 nat (\lambda (m: +nat).(eq nat x1 (S m))) (\lambda (m: nat).(lt m n0)))).(ex2_ind nat (\lambda +(m: nat).(eq nat x1 (S m))) (\lambda (m: nat).(lt m n0)) (drop (S n0) O +(CHead c (Flat f) x0) e) (\lambda (x: nat).(\lambda (_: (eq nat x1 (S +x))).(\lambda (_: (lt x n0)).(drop_drop (Flat f) n0 c e H10 x0)))) H13)) +(lt_gen_xS x1 n0 H12)))))) k (drop_gen_drop k c e t n0 H3) H8 H9))) c2 +H6)))))) H4)) (\lambda (H4: (ex3_2 C nat (\lambda (_: C).(\lambda (j: +nat).(eq nat i (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead +c3 k t)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c +c3))))).(ex3_2_ind C nat (\lambda (_: C).(\lambda (j: nat).(eq nat i (s k +j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k t)))) (\lambda +(c3: C).(\lambda (j: nat).(csubst0 j v c c3))) (drop (S n0) O c2 e) (\lambda +(x0: C).(\lambda (x1: nat).(\lambda (H5: (eq nat i (s k x1))).(\lambda (H6: +(eq C c2 (CHead x0 k t))).(\lambda (H7: (csubst0 x1 v c x0)).(eq_ind_r C +(CHead x0 k t) (\lambda (c0: C).(drop (S n0) O c0 e)) (let H8 \def (eq_ind +nat i (\lambda (n1: nat).(\forall (c3: C).(\forall (v0: T).((csubst0 n1 v0 c +c3) \to (\forall (e0: C).((drop (S n0) O c e0) \to (drop (S n0) O c3 +e0))))))) H1 (s k x1) H5) in (let H9 \def (eq_ind nat i (\lambda (n1: +nat).(lt n1 (S n0))) H0 (s k x1) H5) in (K_ind (\lambda (k0: K).((drop (r k0 +n0) O c e) \to (((\forall (c3: C).(\forall (v0: T).((csubst0 (s k0 x1) v0 c +c3) \to (\forall (e0: C).((drop (S n0) O c e0) \to (drop (S n0) O c3 +e0))))))) \to ((lt (s k0 x1) (S n0)) \to (drop (S n0) O (CHead x0 k0 t) +e))))) (\lambda (b: B).(\lambda (H10: (drop (r (Bind b) n0) O c e)).(\lambda +(_: ((\forall (c3: C).(\forall (v0: T).((csubst0 (s (Bind b) x1) v0 c c3) \to +(\forall (e0: C).((drop (S n0) O c e0) \to (drop (S n0) O c3 +e0)))))))).(\lambda (H12: (lt (s (Bind b) x1) (S n0))).(drop_drop (Bind b) n0 +x0 e (H x1 (lt_S_n x1 n0 H12) c x0 v H7 e H10) t))))) (\lambda (f: +F).(\lambda (H10: (drop (r (Flat f) n0) O c e)).(\lambda (H11: ((\forall (c3: +C).(\forall (v0: T).((csubst0 (s (Flat f) x1) v0 c c3) \to (\forall (e0: +C).((drop (S n0) O c e0) \to (drop (S n0) O c3 e0)))))))).(\lambda (H12: (lt +(s (Flat f) x1) (S n0))).(or_ind (eq nat x1 O) (ex2 nat (\lambda (m: nat).(eq +nat x1 (S m))) (\lambda (m: nat).(lt m n0))) (drop (S n0) O (CHead x0 (Flat +f) t) e) (\lambda (_: (eq nat x1 O)).(drop_drop (Flat f) n0 x0 e (H11 x0 v H7 +e H10) t)) (\lambda (H13: (ex2 nat (\lambda (m: nat).(eq nat x1 (S m))) +(\lambda (m: nat).(lt m n0)))).(ex2_ind nat (\lambda (m: nat).(eq nat x1 (S +m))) (\lambda (m: nat).(lt m n0)) (drop (S n0) O (CHead x0 (Flat f) t) e) +(\lambda (x: nat).(\lambda (_: (eq nat x1 (S x))).(\lambda (_: (lt x +n0)).(drop_drop (Flat f) n0 x0 e (H11 x0 v H7 e H10) t)))) H13)) (lt_gen_xS +x1 n0 H12)))))) k (drop_gen_drop k c e t n0 H3) H8 H9))) c2 H6)))))) H4)) +(\lambda (H4: (ex4_3 T C nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: +nat).(eq nat i (s k j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: +nat).(eq C c2 (CHead c3 k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda +(j: nat).(subst0 j v t u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c c3)))))).(ex4_3_ind T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat i (s k j))))) (\lambda (u2: T).(\lambda (c3: +C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda (u2: T).(\lambda +(_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: T).(\lambda (c3: +C).(\lambda (j: nat).(csubst0 j v c c3)))) (drop (S n0) O c2 e) (\lambda (x0: +T).(\lambda (x1: C).(\lambda (x2: nat).(\lambda (H5: (eq nat i (s k +x2))).(\lambda (H6: (eq C c2 (CHead x1 k x0))).(\lambda (_: (subst0 x2 v t +x0)).(\lambda (H8: (csubst0 x2 v c x1)).(eq_ind_r C (CHead x1 k x0) (\lambda +(c0: C).(drop (S n0) O c0 e)) (let H9 \def (eq_ind nat i (\lambda (n1: +nat).(\forall (c3: C).(\forall (v0: T).((csubst0 n1 v0 c c3) \to (\forall +(e0: C).((drop (S n0) O c e0) \to (drop (S n0) O c3 e0))))))) H1 (s k x2) H5) +in (let H10 \def (eq_ind nat i (\lambda (n1: nat).(lt n1 (S n0))) H0 (s k x2) +H5) in (K_ind (\lambda (k0: K).((drop (r k0 n0) O c e) \to (((\forall (c3: +C).(\forall (v0: T).((csubst0 (s k0 x2) v0 c c3) \to (\forall (e0: C).((drop +(S n0) O c e0) \to (drop (S n0) O c3 e0))))))) \to ((lt (s k0 x2) (S n0)) \to +(drop (S n0) O (CHead x1 k0 x0) e))))) (\lambda (b: B).(\lambda (H11: (drop +(r (Bind b) n0) O c e)).(\lambda (_: ((\forall (c3: C).(\forall (v0: +T).((csubst0 (s (Bind b) x2) v0 c c3) \to (\forall (e0: C).((drop (S n0) O c +e0) \to (drop (S n0) O c3 e0)))))))).(\lambda (H13: (lt (s (Bind b) x2) (S +n0))).(drop_drop (Bind b) n0 x1 e (H x2 (lt_S_n x2 n0 H13) c x1 v H8 e H11) +x0))))) (\lambda (f: F).(\lambda (H11: (drop (r (Flat f) n0) O c e)).(\lambda +(H12: ((\forall (c3: C).(\forall (v0: T).((csubst0 (s (Flat f) x2) v0 c c3) +\to (\forall (e0: C).((drop (S n0) O c e0) \to (drop (S n0) O c3 +e0)))))))).(\lambda (H13: (lt (s (Flat f) x2) (S n0))).(or_ind (eq nat x2 O) +(ex2 nat (\lambda (m: nat).(eq nat x2 (S m))) (\lambda (m: nat).(lt m n0))) +(drop (S n0) O (CHead x1 (Flat f) x0) e) (\lambda (_: (eq nat x2 +O)).(drop_drop (Flat f) n0 x1 e (H12 x1 v H8 e H11) x0)) (\lambda (H14: (ex2 +nat (\lambda (m: nat).(eq nat x2 (S m))) (\lambda (m: nat).(lt m +n0)))).(ex2_ind nat (\lambda (m: nat).(eq nat x2 (S m))) (\lambda (m: +nat).(lt m n0)) (drop (S n0) O (CHead x1 (Flat f) x0) e) (\lambda (x: +nat).(\lambda (_: (eq nat x2 (S x))).(\lambda (_: (lt x n0)).(drop_drop (Flat +f) n0 x1 e (H12 x1 v H8 e H11) x0)))) H14)) (lt_gen_xS x2 n0 H13)))))) k +(drop_gen_drop k c e t n0 H3) H9 H10))) c2 H6)))))))) H4)) (csubst0_gen_head +k c c2 t v i H2))))))))))) c1)))))) n). + +theorem csubst0_drop_gt_back: + \forall (n: nat).(\forall (i: nat).((lt i n) \to (\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst0 i v c1 c2) \to (\forall (e: C).((drop n O +c2 e) \to (drop n O c1 e))))))))) +\def + \lambda (n: nat).(nat_ind (\lambda (n0: nat).(\forall (i: nat).((lt i n0) +\to (\forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 i v c1 c2) +\to (\forall (e: C).((drop n0 O c2 e) \to (drop n0 O c1 e)))))))))) (\lambda +(i: nat).(\lambda (H: (lt i O)).(\lambda (c1: C).(\lambda (c2: C).(\lambda +(v: T).(\lambda (_: (csubst0 i v c1 c2)).(\lambda (e: C).(\lambda (_: (drop O +O c2 e)).(let H2 \def (match H in le return (\lambda (n0: nat).(\lambda (_: +(le ? n0)).((eq nat n0 O) \to (drop O O c1 e)))) with [le_n \Rightarrow +(\lambda (H2: (eq nat (S i) O)).(let H3 \def (eq_ind nat (S i) (\lambda (e0: +nat).(match e0 in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +False | (S _) \Rightarrow True])) I O H2) in (False_ind (drop O O c1 e) H3))) +| (le_S m H2) \Rightarrow (\lambda (H3: (eq nat (S m) O)).((let H4 \def +(eq_ind nat (S m) (\lambda (e0: nat).(match e0 in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H3) in +(False_ind ((le (S i) m) \to (drop O O c1 e)) H4)) H2))]) in (H2 (refl_equal +nat O))))))))))) (\lambda (n0: nat).(\lambda (H: ((\forall (i: nat).((lt i +n0) \to (\forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 i v c1 +c2) \to (\forall (e: C).((drop n0 O c2 e) \to (drop n0 O c1 +e))))))))))).(\lambda (i: nat).(\lambda (H0: (lt i (S n0))).(\lambda (c1: +C).(C_ind (\lambda (c: C).(\forall (c2: C).(\forall (v: T).((csubst0 i v c +c2) \to (\forall (e: C).((drop (S n0) O c2 e) \to (drop (S n0) O c e))))))) +(\lambda (n1: nat).(\lambda (c2: C).(\lambda (v: T).(\lambda (H1: (csubst0 i +v (CSort n1) c2)).(\lambda (e: C).(\lambda (_: (drop (S n0) O c2 +e)).(csubst0_gen_sort c2 v i n1 H1 (drop (S n0) O (CSort n1) e)))))))) +(\lambda (c: C).(\lambda (H1: ((\forall (c2: C).(\forall (v: T).((csubst0 i v +c c2) \to (\forall (e: C).((drop (S n0) O c2 e) \to (drop (S n0) O c +e)))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (c2: C).(\lambda (v: +T).(\lambda (H2: (csubst0 i v (CHead c k t) c2)).(\lambda (e: C).(\lambda +(H3: (drop (S n0) O c2 e)).(or3_ind (ex3_2 T nat (\lambda (_: T).(\lambda (j: +nat).(eq nat i (s k j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 (CHead +c k u2)))) (\lambda (u2: T).(\lambda (j: nat).(subst0 j v t u2)))) (ex3_2 C +nat (\lambda (_: C).(\lambda (j: nat).(eq nat i (s k j)))) (\lambda (c3: +C).(\lambda (_: nat).(eq C c2 (CHead c3 k t)))) (\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat i (s k j))))) (\lambda (u2: T).(\lambda (c3: +C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda (u2: T).(\lambda +(_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: T).(\lambda (c3: +C).(\lambda (j: nat).(csubst0 j v c c3))))) (drop (S n0) O (CHead c k t) e) +(\lambda (H4: (ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat i (s k +j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda +(u2: T).(\lambda (j: nat).(subst0 j v t u2))))).(ex3_2_ind T nat (\lambda (_: +T).(\lambda (j: nat).(eq nat i (s k j)))) (\lambda (u2: T).(\lambda (_: +nat).(eq C c2 (CHead c k u2)))) (\lambda (u2: T).(\lambda (j: nat).(subst0 j +v t u2))) (drop (S n0) O (CHead c k t) e) (\lambda (x0: T).(\lambda (x1: +nat).(\lambda (H5: (eq nat i (s k x1))).(\lambda (H6: (eq C c2 (CHead c k +x0))).(\lambda (_: (subst0 x1 v t x0)).(let H8 \def (eq_ind C c2 (\lambda +(c0: C).(drop (S n0) O c0 e)) H3 (CHead c k x0) H6) in (let H9 \def (eq_ind +nat i (\lambda (n1: nat).(\forall (c3: C).(\forall (v0: T).((csubst0 n1 v0 c +c3) \to (\forall (e0: C).((drop (S n0) O c3 e0) \to (drop (S n0) O c +e0))))))) H1 (s k x1) H5) in (let H10 \def (eq_ind nat i (\lambda (n1: +nat).(lt n1 (S n0))) H0 (s k x1) H5) in (K_ind (\lambda (k0: K).(((\forall +(c3: C).(\forall (v0: T).((csubst0 (s k0 x1) v0 c c3) \to (\forall (e0: +C).((drop (S n0) O c3 e0) \to (drop (S n0) O c e0))))))) \to ((lt (s k0 x1) +(S n0)) \to ((drop (r k0 n0) O c e) \to (drop (S n0) O (CHead c k0 t) e))))) +(\lambda (b: B).(\lambda (_: ((\forall (c3: C).(\forall (v0: T).((csubst0 (s +(Bind b) x1) v0 c c3) \to (\forall (e0: C).((drop (S n0) O c3 e0) \to (drop +(S n0) O c e0)))))))).(\lambda (_: (lt (s (Bind b) x1) (S n0))).(\lambda +(H13: (drop (r (Bind b) n0) O c e)).(drop_drop (Bind b) n0 c e H13 t))))) +(\lambda (f: F).(\lambda (_: ((\forall (c3: C).(\forall (v0: T).((csubst0 (s +(Flat f) x1) v0 c c3) \to (\forall (e0: C).((drop (S n0) O c3 e0) \to (drop +(S n0) O c e0)))))))).(\lambda (H12: (lt (s (Flat f) x1) (S n0))).(\lambda +(H13: (drop (r (Flat f) n0) O c e)).(or_ind (eq nat x1 O) (ex2 nat (\lambda +(m: nat).(eq nat x1 (S m))) (\lambda (m: nat).(lt m n0))) (drop (S n0) O +(CHead c (Flat f) t) e) (\lambda (_: (eq nat x1 O)).(drop_drop (Flat f) n0 c +e H13 t)) (\lambda (H14: (ex2 nat (\lambda (m: nat).(eq nat x1 (S m))) +(\lambda (m: nat).(lt m n0)))).(ex2_ind nat (\lambda (m: nat).(eq nat x1 (S +m))) (\lambda (m: nat).(lt m n0)) (drop (S n0) O (CHead c (Flat f) t) e) +(\lambda (x: nat).(\lambda (_: (eq nat x1 (S x))).(\lambda (_: (lt x +n0)).(drop_drop (Flat f) n0 c e H13 t)))) H14)) (lt_gen_xS x1 n0 H12)))))) k +H9 H10 (drop_gen_drop k c e x0 n0 H8)))))))))) H4)) (\lambda (H4: (ex3_2 C +nat (\lambda (_: C).(\lambda (j: nat).(eq nat i (s k j)))) (\lambda (c3: +C).(\lambda (_: nat).(eq C c2 (CHead c3 k t)))) (\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c c3))))).(ex3_2_ind C nat (\lambda (_: C).(\lambda (j: +nat).(eq nat i (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead +c3 k t)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c c3))) (drop (S +n0) O (CHead c k t) e) (\lambda (x0: C).(\lambda (x1: nat).(\lambda (H5: (eq +nat i (s k x1))).(\lambda (H6: (eq C c2 (CHead x0 k t))).(\lambda (H7: +(csubst0 x1 v c x0)).(let H8 \def (eq_ind C c2 (\lambda (c0: C).(drop (S n0) +O c0 e)) H3 (CHead x0 k t) H6) in (let H9 \def (eq_ind nat i (\lambda (n1: +nat).(\forall (c3: C).(\forall (v0: T).((csubst0 n1 v0 c c3) \to (\forall +(e0: C).((drop (S n0) O c3 e0) \to (drop (S n0) O c e0))))))) H1 (s k x1) H5) +in (let H10 \def (eq_ind nat i (\lambda (n1: nat).(lt n1 (S n0))) H0 (s k x1) +H5) in (K_ind (\lambda (k0: K).(((\forall (c3: C).(\forall (v0: T).((csubst0 +(s k0 x1) v0 c c3) \to (\forall (e0: C).((drop (S n0) O c3 e0) \to (drop (S +n0) O c e0))))))) \to ((lt (s k0 x1) (S n0)) \to ((drop (r k0 n0) O x0 e) \to +(drop (S n0) O (CHead c k0 t) e))))) (\lambda (b: B).(\lambda (_: ((\forall +(c3: C).(\forall (v0: T).((csubst0 (s (Bind b) x1) v0 c c3) \to (\forall (e0: +C).((drop (S n0) O c3 e0) \to (drop (S n0) O c e0)))))))).(\lambda (H12: (lt +(s (Bind b) x1) (S n0))).(\lambda (H13: (drop (r (Bind b) n0) O x0 +e)).(drop_drop (Bind b) n0 c e (H x1 (lt_S_n x1 n0 H12) c x0 v H7 e H13) +t))))) (\lambda (f: F).(\lambda (H11: ((\forall (c3: C).(\forall (v0: +T).((csubst0 (s (Flat f) x1) v0 c c3) \to (\forall (e0: C).((drop (S n0) O c3 +e0) \to (drop (S n0) O c e0)))))))).(\lambda (H12: (lt (s (Flat f) x1) (S +n0))).(\lambda (H13: (drop (r (Flat f) n0) O x0 e)).(or_ind (eq nat x1 O) +(ex2 nat (\lambda (m: nat).(eq nat x1 (S m))) (\lambda (m: nat).(lt m n0))) +(drop (S n0) O (CHead c (Flat f) t) e) (\lambda (_: (eq nat x1 O)).(drop_drop +(Flat f) n0 c e (H11 x0 v H7 e H13) t)) (\lambda (H14: (ex2 nat (\lambda (m: +nat).(eq nat x1 (S m))) (\lambda (m: nat).(lt m n0)))).(ex2_ind nat (\lambda +(m: nat).(eq nat x1 (S m))) (\lambda (m: nat).(lt m n0)) (drop (S n0) O +(CHead c (Flat f) t) e) (\lambda (x: nat).(\lambda (_: (eq nat x1 (S +x))).(\lambda (_: (lt x n0)).(drop_drop (Flat f) n0 c e (H11 x0 v H7 e H13) +t)))) H14)) (lt_gen_xS x1 n0 H12)))))) k H9 H10 (drop_gen_drop k x0 e t n0 +H8)))))))))) H4)) (\lambda (H4: (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat i (s k j))))) (\lambda (u2: T).(\lambda (c3: +C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda (u2: T).(\lambda +(_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: T).(\lambda (c3: +C).(\lambda (j: nat).(csubst0 j v c c3)))))).(ex4_3_ind T C nat (\lambda (_: +T).(\lambda (_: C).(\lambda (j: nat).(eq nat i (s k j))))) (\lambda (u2: +T).(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda +(u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c c3)))) (drop (S n0) O +(CHead c k t) e) (\lambda (x0: T).(\lambda (x1: C).(\lambda (x2: +nat).(\lambda (H5: (eq nat i (s k x2))).(\lambda (H6: (eq C c2 (CHead x1 k +x0))).(\lambda (_: (subst0 x2 v t x0)).(\lambda (H8: (csubst0 x2 v c +x1)).(let H9 \def (eq_ind C c2 (\lambda (c0: C).(drop (S n0) O c0 e)) H3 +(CHead x1 k x0) H6) in (let H10 \def (eq_ind nat i (\lambda (n1: +nat).(\forall (c3: C).(\forall (v0: T).((csubst0 n1 v0 c c3) \to (\forall +(e0: C).((drop (S n0) O c3 e0) \to (drop (S n0) O c e0))))))) H1 (s k x2) H5) +in (let H11 \def (eq_ind nat i (\lambda (n1: nat).(lt n1 (S n0))) H0 (s k x2) +H5) in (K_ind (\lambda (k0: K).(((\forall (c3: C).(\forall (v0: T).((csubst0 +(s k0 x2) v0 c c3) \to (\forall (e0: C).((drop (S n0) O c3 e0) \to (drop (S +n0) O c e0))))))) \to ((lt (s k0 x2) (S n0)) \to ((drop (r k0 n0) O x1 e) \to +(drop (S n0) O (CHead c k0 t) e))))) (\lambda (b: B).(\lambda (_: ((\forall +(c3: C).(\forall (v0: T).((csubst0 (s (Bind b) x2) v0 c c3) \to (\forall (e0: +C).((drop (S n0) O c3 e0) \to (drop (S n0) O c e0)))))))).(\lambda (H13: (lt +(s (Bind b) x2) (S n0))).(\lambda (H14: (drop (r (Bind b) n0) O x1 +e)).(drop_drop (Bind b) n0 c e (H x2 (lt_S_n x2 n0 H13) c x1 v H8 e H14) +t))))) (\lambda (f: F).(\lambda (H12: ((\forall (c3: C).(\forall (v0: +T).((csubst0 (s (Flat f) x2) v0 c c3) \to (\forall (e0: C).((drop (S n0) O c3 +e0) \to (drop (S n0) O c e0)))))))).(\lambda (H13: (lt (s (Flat f) x2) (S +n0))).(\lambda (H14: (drop (r (Flat f) n0) O x1 e)).(or_ind (eq nat x2 O) +(ex2 nat (\lambda (m: nat).(eq nat x2 (S m))) (\lambda (m: nat).(lt m n0))) +(drop (S n0) O (CHead c (Flat f) t) e) (\lambda (_: (eq nat x2 O)).(drop_drop +(Flat f) n0 c e (H12 x1 v H8 e H14) t)) (\lambda (H15: (ex2 nat (\lambda (m: +nat).(eq nat x2 (S m))) (\lambda (m: nat).(lt m n0)))).(ex2_ind nat (\lambda +(m: nat).(eq nat x2 (S m))) (\lambda (m: nat).(lt m n0)) (drop (S n0) O +(CHead c (Flat f) t) e) (\lambda (x: nat).(\lambda (_: (eq nat x2 (S +x))).(\lambda (_: (lt x n0)).(drop_drop (Flat f) n0 c e (H12 x1 v H8 e H14) +t)))) H15)) (lt_gen_xS x2 n0 H13)))))) k H10 H11 (drop_gen_drop k x1 e x0 n0 +H9)))))))))))) H4)) (csubst0_gen_head k c c2 t v i H2))))))))))) c1)))))) n). + +theorem csubst0_drop_lt: + \forall (n: nat).(\forall (i: nat).((lt n i) \to (\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst0 i v c1 c2) \to (\forall (e: C).((drop n O +c1 e) \to (or4 (drop n O c2 e) (ex3_4 K C T T (\lambda (k: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k u)))))) (\lambda (k: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n O c2 (CHead e0 k +w)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (s k n)) v u w)))))) (ex3_4 K C C T (\lambda (k: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k +u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop n O c2 (CHead e2 k u)))))) (\lambda (k: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus i (s k n)) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e1 k u))))))) (\lambda (k: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop n O c2 (CHead e2 k w))))))) +(\lambda (k: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (s k n)) v u w)))))) (\lambda (k: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (s k +n)) v e1 e2)))))))))))))))) +\def + \lambda (n: nat).(nat_ind (\lambda (n0: nat).(\forall (i: nat).((lt n0 i) +\to (\forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 i v c1 c2) +\to (\forall (e: C).((drop n0 O c1 e) \to (or4 (drop n0 O c2 e) (ex3_4 K C T +T (\lambda (k: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 k u)))))) (\lambda (k: K).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop n0 O c2 (CHead e0 k w)))))) (\lambda (k: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k n0)) v u w)))))) +(ex3_4 K C C T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 k u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop n0 O c2 (CHead e2 k u)))))) (\lambda (k: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (s k n0)) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k u))))))) (\lambda (k: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop n0 +O c2 (CHead e2 k w))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k n0)) v u w)))))) +(\lambda (k: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (s k n0)) v e1 e2))))))))))))))))) (\lambda (i: +nat).(\lambda (_: (lt O i)).(\lambda (c1: C).(\lambda (c2: C).(\lambda (v: +T).(\lambda (H0: (csubst0 i v c1 c2)).(\lambda (e: C).(\lambda (H1: (drop O O +c1 e)).(eq_ind C c1 (\lambda (c: C).(or4 (drop O O c2 c) (ex3_4 K C T T +(\lambda (k: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c +(CHead e0 k u)))))) (\lambda (k: K).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop O O c2 (CHead e0 k w)))))) (\lambda (k: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k O)) v u w)))))) +(ex3_4 K C C T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c (CHead e1 k u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop O O c2 (CHead e2 k u)))))) (\lambda (k: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (s k O)) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e1 k u))))))) (\lambda (k: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O +c2 (CHead e2 k w))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k O)) v u w)))))) +(\lambda (k: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (s k O)) v e1 e2))))))))) (csubst0_ind (\lambda (n0: +nat).(\lambda (t: T).(\lambda (c: C).(\lambda (c0: C).(or4 (drop O O c0 c) +(ex3_4 K C T T (\lambda (k: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C c (CHead e0 k u)))))) (\lambda (k: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop O O c0 (CHead e0 k w)))))) (\lambda (k: K).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus n0 (s k O)) t u w)))))) +(ex3_4 K C C T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c (CHead e1 k u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop O O c0 (CHead e2 k u)))))) (\lambda (k: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus n0 (s k O)) t e1 +e2)))))) (ex4_5 K C C T T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e1 k u))))))) (\lambda (k: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O +c0 (CHead e2 k w))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus n0 (s k O)) t u w)))))) +(\lambda (k: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus n0 (s k O)) t e1 e2)))))))))))) (\lambda (k: +K).(\lambda (i0: nat).(\lambda (v0: T).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (H2: (subst0 i0 v0 u1 u2)).(\lambda (c: C).(let H3 \def (eq_ind_r +nat i0 (\lambda (n0: nat).(subst0 n0 v0 u1 u2)) H2 (minus (s k i0) (s k O)) +(s_arith0 k i0)) in (or4_intro1 (drop O O (CHead c k u2) (CHead c k u1)) +(ex3_4 K C T T (\lambda (k0: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C (CHead c k u1) (CHead e0 k0 u)))))) (\lambda (k0: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c k u2) (CHead e0 k0 +w)))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s k i0) (s k0 O)) v0 u w)))))) (ex3_4 K C C T (\lambda +(k0: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead c k u1) +(CHead e1 k0 u)))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop O O (CHead c k u2) (CHead e2 k0 u)))))) (\lambda +(k0: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s +k i0) (s k0 O)) v0 e1 e2)))))) (ex4_5 K C C T T (\lambda (k0: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c k u1) +(CHead e1 k0 u))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c k u2) (CHead e2 k0 +w))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s k i0) (s k0 O)) v0 u w)))))) (\lambda +(k0: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s k i0) (s k0 O)) v0 e1 e2))))))) (ex3_4_intro K C T T +(\lambda (k0: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C +(CHead c k u1) (CHead e0 k0 u)))))) (\lambda (k0: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c k u2) (CHead e0 k0 +w)))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s k i0) (s k0 O)) v0 u w))))) k c u1 u2 (refl_equal C +(CHead c k u1)) (drop_refl (CHead c k u2)) H3)))))))))) (\lambda (k: +K).(\lambda (i0: nat).(\lambda (c3: C).(\lambda (c4: C).(\lambda (v0: +T).(\lambda (H2: (csubst0 i0 v0 c3 c4)).(\lambda (H3: (or4 (drop O O c4 c3) +(ex3_4 K C T T (\lambda (k0: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C c3 (CHead e0 k0 u)))))) (\lambda (k0: K).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop O O c4 (CHead e0 k0 w)))))) (\lambda (k0: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i0 (s k0 +O)) v0 u w)))))) (ex3_4 K C C T (\lambda (k0: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C c3 (CHead e1 k0 u)))))) (\lambda (k0: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop O O c4 (CHead e2 k0 +u)))))) (\lambda (k0: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (s k0 O)) v0 e1 e2)))))) (ex4_5 K C C T T (\lambda (k0: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 +(CHead e1 k0 u))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 (CHead e2 k0 w))))))) +(\lambda (k0: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i0 (s k0 O)) v0 u w)))))) (\lambda (k0: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (s k0 +O)) v0 e1 e2))))))))).(\lambda (u: T).(let H4 \def (eq_ind_r nat i0 (\lambda +(n0: nat).(csubst0 n0 v0 c3 c4)) H2 (minus (s k i0) (s k O)) (s_arith0 k i0)) +in (let H5 \def (eq_ind_r nat i0 (\lambda (n0: nat).(or4 (drop O O c4 c3) +(ex3_4 K C T T (\lambda (k0: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda +(_: T).(eq C c3 (CHead e0 k0 u0)))))) (\lambda (k0: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 (CHead e0 k0 w)))))) (\lambda +(k0: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus n0 (s +k0 O)) v0 u0 w)))))) (ex3_4 K C C T (\lambda (k0: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C c3 (CHead e1 k0 u0)))))) (\lambda +(k0: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop O O c4 (CHead +e2 k0 u0)))))) (\lambda (k0: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus n0 (s k0 O)) v0 e1 e2)))))) (ex4_5 K C C T T (\lambda +(k0: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq +C c3 (CHead e1 k0 u0))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 (CHead e2 k0 w))))))) +(\lambda (k0: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus n0 (s k0 O)) v0 u0 w)))))) (\lambda (k0: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus n0 +(s k0 O)) v0 e1 e2))))))))) H3 (minus (s k i0) (s k O)) (s_arith0 k i0)) in +(or4_intro2 (drop O O (CHead c4 k u) (CHead c3 k u)) (ex3_4 K C T T (\lambda +(k0: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead c3 k +u) (CHead e0 k0 u0)))))) (\lambda (k0: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop O O (CHead c4 k u) (CHead e0 k0 w)))))) (\lambda +(k0: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s k +i0) (s k0 O)) v0 u0 w)))))) (ex3_4 K C C T (\lambda (k0: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead c3 k u) (CHead e1 k0 +u0)))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop O O (CHead c4 k u) (CHead e2 k0 u0)))))) (\lambda (k0: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k i0) (s k0 O)) +v0 e1 e2)))))) (ex4_5 K C C T T (\lambda (k0: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead c3 k u) (CHead e1 k0 +u0))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop O O (CHead c4 k u) (CHead e2 k0 w))))))) (\lambda +(k0: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 (minus (s k i0) (s k0 O)) v0 u0 w)))))) (\lambda (k0: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k +i0) (s k0 O)) v0 e1 e2))))))) (ex3_4_intro K C C T (\lambda (k0: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead c3 k u) (CHead e1 k0 +u0)))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop O O (CHead c4 k u) (CHead e2 k0 u0)))))) (\lambda (k0: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k i0) (s k0 O)) +v0 e1 e2))))) k c3 c4 u (refl_equal C (CHead c3 k u)) (drop_refl (CHead c4 k +u)) H4)))))))))))) (\lambda (k: K).(\lambda (i0: nat).(\lambda (v0: +T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H2: (subst0 i0 v0 u1 +u2)).(\lambda (c3: C).(\lambda (c4: C).(\lambda (H3: (csubst0 i0 v0 c3 +c4)).(\lambda (_: (or4 (drop O O c4 c3) (ex3_4 K C T T (\lambda (k0: +K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 (CHead e0 k0 +u)))))) (\lambda (k0: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop O O c4 (CHead e0 k0 w)))))) (\lambda (k0: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i0 (s k0 O)) v0 u w)))))) +(ex3_4 K C C T (\lambda (k0: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c3 (CHead e1 k0 u)))))) (\lambda (k0: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop O O c4 (CHead e2 k0 u)))))) (\lambda (k0: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (s k0 +O)) v0 e1 e2)))))) (ex4_5 K C C T T (\lambda (k0: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 (CHead e1 k0 +u))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop O O c4 (CHead e2 k0 w))))))) (\lambda (k0: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i0 (s k0 O)) v0 u w)))))) (\lambda (k0: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (s k0 O)) v0 e1 +e2))))))))).(let H5 \def (eq_ind_r nat i0 (\lambda (n0: nat).(subst0 n0 v0 u1 +u2)) H2 (minus (s k i0) (s k O)) (s_arith0 k i0)) in (let H6 \def (eq_ind_r +nat i0 (\lambda (n0: nat).(csubst0 n0 v0 c3 c4)) H3 (minus (s k i0) (s k O)) +(s_arith0 k i0)) in (or4_intro3 (drop O O (CHead c4 k u2) (CHead c3 k u1)) +(ex3_4 K C T T (\lambda (k0: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C (CHead c3 k u1) (CHead e0 k0 u)))))) (\lambda (k0: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c4 k u2) (CHead e0 k0 +w)))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s k i0) (s k0 O)) v0 u w)))))) (ex3_4 K C C T (\lambda +(k0: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead c3 k +u1) (CHead e1 k0 u)))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop O O (CHead c4 k u2) (CHead e2 k0 u)))))) (\lambda +(k0: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s +k i0) (s k0 O)) v0 e1 e2)))))) (ex4_5 K C C T T (\lambda (k0: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c3 k u1) +(CHead e1 k0 u))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c4 k u2) (CHead e2 k0 +w))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s k i0) (s k0 O)) v0 u w)))))) (\lambda +(k0: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s k i0) (s k0 O)) v0 e1 e2))))))) (ex4_5_intro K C C T T +(\lambda (k0: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(eq C (CHead c3 k u1) (CHead e1 k0 u))))))) (\lambda (k0: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c4 k +u2) (CHead e2 k0 w))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k i0) (s k0 O)) v0 u +w)))))) (\lambda (k0: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus (s k i0) (s k0 O)) v0 e1 e2)))))) k c3 c4 +u1 u2 (refl_equal C (CHead c3 k u1)) (drop_refl (CHead c4 k u2)) H5 +H6)))))))))))))) i v c1 c2 H0) e (drop_gen_refl c1 e H1)))))))))) (\lambda +(n0: nat).(\lambda (IHn: ((\forall (i: nat).((lt n0 i) \to (\forall (c1: +C).(\forall (c2: C).(\forall (v: T).((csubst0 i v c1 c2) \to (\forall (e: +C).((drop n0 O c1 e) \to (or4 (drop n0 O c2 e) (ex3_4 K C T T (\lambda (k: +K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k +u)))))) (\lambda (k: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop n0 O c2 (CHead e0 k w)))))) (\lambda (k: K).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus i (s k n0)) v u w)))))) (ex3_4 K C C T +(\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 k u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u: T).(drop n0 O c2 (CHead e2 k u)))))) (\lambda (k: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (s k n0)) v e1 e2)))))) +(ex4_5 K C C T T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e1 k u))))))) (\lambda (k: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c2 (CHead +e2 k w))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (s k n0)) v u w)))))) (\lambda (k: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (s k n0)) v e1 e2)))))))))))))))))).(\lambda (i: nat).(\lambda (H: +(lt (S n0) i)).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: +C).(\forall (v: T).((csubst0 i v c c2) \to (\forall (e: C).((drop (S n0) O c +e) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C T T (\lambda (k: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k u)))))) (\lambda (k: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e0 k w)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (s k (S n0))) v u w)))))) (ex3_4 K C C T (\lambda (k: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k +u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O c2 (CHead e2 k u)))))) (\lambda (k: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (s k (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k u))))))) (\lambda (k: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S +n0) O c2 (CHead e2 k w))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k (S n0))) v u w)))))) +(\lambda (k: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (s k (S n0))) v e1 e2)))))))))))))) (\lambda (n1: +nat).(\lambda (c2: C).(\lambda (v: T).(\lambda (_: (csubst0 i v (CSort n1) +c2)).(\lambda (e: C).(\lambda (H1: (drop (S n0) O (CSort n1) e)).(and3_ind +(eq C e (CSort n1)) (eq nat (S n0) O) (eq nat O O) (or4 (drop (S n0) O c2 e) +(ex3_4 K C T T (\lambda (k: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 k u)))))) (\lambda (k: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k w)))))) (\lambda (k: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k (S +n0))) v u w)))))) (ex3_4 K C C T (\lambda (k: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C e (CHead e1 k u)))))) (\lambda (k: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k u)))))) +(\lambda (k: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus i (s k (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 k u))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k w))))))) +(\lambda (k: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (s k (S n0))) v u w)))))) (\lambda (k: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (s k (S +n0))) v e1 e2)))))))) (\lambda (H2: (eq C e (CSort n1))).(\lambda (H3: (eq +nat (S n0) O)).(\lambda (_: (eq nat O O)).(eq_ind_r C (CSort n1) (\lambda (c: +C).(or4 (drop (S n0) O c2 c) (ex3_4 K C T T (\lambda (k: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e0 k u)))))) (\lambda (k: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e0 k w)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (s k (S n0))) v u w)))))) (ex3_4 K C C T (\lambda (k: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c (CHead e1 k +u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O c2 (CHead e2 k u)))))) (\lambda (k: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (s k (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e1 k u))))))) (\lambda (k: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S +n0) O c2 (CHead e2 k w))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k (S n0))) v u w)))))) +(\lambda (k: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (s k (S n0))) v e1 e2))))))))) (let H5 \def (eq_ind +nat (S n0) (\lambda (ee: nat).(match ee in nat return (\lambda (_: nat).Prop) +with [O \Rightarrow False | (S _) \Rightarrow True])) I O H3) in (False_ind +(or4 (drop (S n0) O c2 (CSort n1)) (ex3_4 K C T T (\lambda (k: K).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CSort n1) (CHead e0 k u)))))) +(\lambda (k: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) +O c2 (CHead e0 k w)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (s k (S n0))) v u w)))))) (ex3_4 K C C T +(\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CSort +n1) (CHead e1 k u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k u)))))) (\lambda (k: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (s k +(S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CSort n1) (CHead e1 +k u))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k w))))))) (\lambda (k: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i (s k (S n0))) v u w)))))) (\lambda (k: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (s k (S n0))) v e1 +e2)))))))) H5)) e H2)))) (drop_gen_sort n1 (S n0) O e H1)))))))) (\lambda (c: +C).(\lambda (H0: ((\forall (c2: C).(\forall (v: T).((csubst0 i v c c2) \to +(\forall (e: C).((drop (S n0) O c e) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C +T T (\lambda (k: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 k u)))))) (\lambda (k: K).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (S n0) O c2 (CHead e0 k w)))))) (\lambda (k: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k (S n0))) v u w)))))) +(ex3_4 K C C T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 k u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k u)))))) (\lambda (k: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (s k +(S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k +u))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k w))))))) (\lambda (k: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i (s k (S n0))) v u w)))))) (\lambda (k: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (s k (S n0))) v e1 +e2))))))))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (c2: C).(\lambda +(v: T).(\lambda (H1: (csubst0 i v (CHead c k t) c2)).(\lambda (e: C).(\lambda +(H2: (drop (S n0) O (CHead c k t) e)).(let H3 \def (match H1 in csubst0 +return (\lambda (n1: nat).(\lambda (t0: T).(\lambda (c0: C).(\lambda (c3: +C).(\lambda (_: (csubst0 n1 t0 c0 c3)).((eq nat n1 i) \to ((eq T t0 v) \to +((eq C c0 (CHead c k t)) \to ((eq C c3 c2) \to (or4 (drop (S n0) O c2 e) +(ex3_4 K C T T (\lambda (k0: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 k0 u)))))) (\lambda (k0: K).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k0 w)))))) (\lambda (k0: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k0 (S +n0))) v u w)))))) (ex3_4 K C C T (\lambda (k0: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C e (CHead e1 k0 u)))))) (\lambda (k0: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k0 +u)))))) (\lambda (k0: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i (s k0 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda +(k0: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq +C e (CHead e1 k0 u))))))) (\lambda (k0: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k0 w))))))) +(\lambda (k0: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (s k0 (S n0))) v u w)))))) (\lambda (k0: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (s k0 +(S n0))) v e1 e2))))))))))))))))) with [(csubst0_snd k0 i0 v0 u1 u2 H3 c0) +\Rightarrow (\lambda (H4: (eq nat (s k0 i0) i)).(\lambda (H5: (eq T v0 +v)).(\lambda (H6: (eq C (CHead c0 k0 u1) (CHead c k t))).(\lambda (H7: (eq C +(CHead c0 k0 u2) c2)).(eq_ind nat (s k0 i0) (\lambda (n1: nat).((eq T v0 v) +\to ((eq C (CHead c0 k0 u1) (CHead c k t)) \to ((eq C (CHead c0 k0 u2) c2) +\to ((subst0 i0 v0 u1 u2) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C T T +(\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus n1 (s k1 (S +n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus n1 (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq +C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus n1 (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus n1 +(s k1 (S n0))) v e1 e2))))))))))))) (\lambda (H8: (eq T v0 v)).(eq_ind T v +(\lambda (t0: T).((eq C (CHead c0 k0 u1) (CHead c k t)) \to ((eq C (CHead c0 +k0 u2) c2) \to ((subst0 i0 t0 u1 u2) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C +T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k0 i0) +(s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c2 (CHead +e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s k0 i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s k0 i0) (s k1 (S n0))) v u w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s k0 i0) (s k1 (S n0))) v e1 e2)))))))))))) (\lambda +(H9: (eq C (CHead c0 k0 u1) (CHead c k t))).(let H10 \def (f_equal C T +(\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u1 | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 k0 u1) (CHead c k +t) H9) in ((let H11 \def (f_equal C K (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | (CHead _ k1 _) +\Rightarrow k1])) (CHead c0 k0 u1) (CHead c k t) H9) in ((let H12 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c3 _ _) \Rightarrow c3])) (CHead c0 k0 u1) +(CHead c k t) H9) in (eq_ind C c (\lambda (c3: C).((eq K k0 k) \to ((eq T u1 +t) \to ((eq C (CHead c3 k0 u2) c2) \to ((subst0 i0 v u1 u2) \to (or4 (drop (S +n0) O c2 e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k1 +w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s k0 i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k0 +i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s k0 i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k0 i0) +(s k1 (S n0))) v e1 e2))))))))))))) (\lambda (H13: (eq K k0 k)).(eq_ind K k +(\lambda (k1: K).((eq T u1 t) \to ((eq C (CHead c k1 u2) c2) \to ((subst0 i0 +v u1 u2) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C T T (\lambda (k2: +K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k2 +u)))))) (\lambda (k2: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c2 (CHead e0 k2 w)))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v +u w)))))) (ex3_4 K C C T (\lambda (k2: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 k2 u)))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k2 u)))))) +(\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus (s k1 i0) (s k2 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k2: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 k2 u))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k2 w))))))) +(\lambda (k2: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v u w)))))) (\lambda (k2: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus (s k1 i0) (s k2 (S n0))) v e1 e2)))))))))))) (\lambda (H14: (eq T u1 +t)).(eq_ind T t (\lambda (t0: T).((eq C (CHead c k u2) c2) \to ((subst0 i0 v +t0 u2) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C T T (\lambda (k1: K).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda +(k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s k i0) (s k1 (S n0))) v u w)))))) (ex3_4 +K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k i0) +(s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s k i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k i0) +(s k1 (S n0))) v e1 e2))))))))))) (\lambda (H15: (eq C (CHead c k u2) +c2)).(eq_ind C (CHead c k u2) (\lambda (c3: C).((subst0 i0 v t u2) \to (or4 +(drop (S n0) O c3 e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead +e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s k i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 +u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O c3 (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k i0) (s k1 (S n0))) v +e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c3 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k i0) (s +k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k i0) (s k1 (S n0))) v +e1 e2)))))))))) (\lambda (_: (subst0 i0 v t u2)).(let H17 \def (eq_ind K k0 +(\lambda (k1: K).(eq nat (s k1 i0) i)) H4 k H13) in (let H18 \def (eq_ind_r +nat i (\lambda (n1: nat).(\forall (c3: C).(\forall (v1: T).((csubst0 n1 v1 c +c3) \to (\forall (e0: C).((drop (S n0) O c e0) \to (or4 (drop (S n0) O c3 e0) +(ex3_4 K C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (u: T).(\lambda (_: +T).(eq C e0 (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e1 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus n1 (s k1 (S +n0))) v1 u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C e0 (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c3 (CHead +e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus n1 (s k1 (S n0))) v1 e1 e2)))))) (ex4_5 K C C T T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq +C e0 (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus n1 (s k1 (S n0))) v1 u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus n1 +(s k1 (S n0))) v1 e1 e2)))))))))))))) H0 (s k i0) H17) in (let H19 \def +(eq_ind_r nat i (\lambda (n1: nat).(lt (S n0) n1)) H (s k i0) H17) in (K_ind +(\lambda (k1: K).((drop (r k1 n0) O c e) \to (((\forall (c3: C).(\forall (v1: +T).((csubst0 (s k1 i0) v1 c c3) \to (\forall (e0: C).((drop (S n0) O c e0) +\to (or4 (drop (S n0) O c3 e0) (ex3_4 K C T T (\lambda (k2: K).(\lambda (e1: +C).(\lambda (u: T).(\lambda (_: T).(eq C e0 (CHead e1 k2 u)))))) (\lambda +(k2: K).(\lambda (e1: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 +(CHead e1 k2 w)))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v1 u w)))))) +(ex3_4 K C C T (\lambda (k2: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e0 (CHead e1 k2 u)))))) (\lambda (k2: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (S n0) O c3 (CHead e2 k2 u)))))) (\lambda (k2: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k1 +i0) (s k2 (S n0))) v1 e1 e2)))))) (ex4_5 K C C T T (\lambda (k2: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e0 (CHead e1 k2 +u))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c3 (CHead e2 k2 w))))))) (\lambda (k2: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s k1 i0) (s k2 (S n0))) v1 u w)))))) (\lambda (k2: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k1 i0) +(s k2 (S n0))) v1 e1 e2)))))))))))))) \to ((lt (S n0) (s k1 i0)) \to (or4 +(drop (S n0) O (CHead c k1 u2) e) (ex3_4 K C T T (\lambda (k2: K).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k2 u)))))) (\lambda +(k2: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O +(CHead c k1 u2) (CHead e0 k2 w)))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v +u w)))))) (ex3_4 K C C T (\lambda (k2: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 k2 u)))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c k1 u2) (CHead e2 +k2 u)))))) (\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v e1 e2)))))) (ex4_5 K C C T T +(\lambda (k2: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e1 k2 u))))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c +k1 u2) (CHead e2 k2 w))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v +u w)))))) (\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v e1 +e2)))))))))))) (\lambda (b: B).(\lambda (H20: (drop (r (Bind b) n0) O c +e)).(\lambda (_: ((\forall (c3: C).(\forall (v1: T).((csubst0 (s (Bind b) i0) +v1 c c3) \to (\forall (e0: C).((drop (S n0) O c e0) \to (or4 (drop (S n0) O +c3 e0) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (u: +T).(\lambda (_: T).(eq C e0 (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e1 k1 +w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v1 u w)))))) (ex3_4 K C C T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e0 +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O c3 (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v1 e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e0 +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v1 u w)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v1 e1 e2))))))))))))))).(\lambda (_: +(lt (S n0) (s (Bind b) i0))).(or4_intro0 (drop (S n0) O (CHead c (Bind b) u2) +e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c (Bind b) u2) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (S n0) O (CHead c (Bind b) u2) (CHead e2 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead +c (Bind b) u2) (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) +i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 +(S n0))) v e1 e2))))))) (drop_drop (Bind b) n0 c e H20 u2)))))) (\lambda (f: +F).(\lambda (H20: (drop (r (Flat f) n0) O c e)).(\lambda (_: ((\forall (c3: +C).(\forall (v1: T).((csubst0 (s (Flat f) i0) v1 c c3) \to (\forall (e0: +C).((drop (S n0) O c e0) \to (or4 (drop (S n0) O c3 e0) (ex3_4 K C T T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (u: T).(\lambda (_: T).(eq C e0 +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c3 (CHead e1 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) +i0) (s k1 (S n0))) v1 u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e0 (CHead e1 k1 u)))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c3 +(CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v1 e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e0 (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c3 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) +i0) (s k1 (S n0))) v1 u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 +(S n0))) v1 e1 e2))))))))))))))).(\lambda (_: (lt (S n0) (s (Flat f) +i0))).(or4_intro0 (drop (S n0) O (CHead c (Flat f) u2) e) (ex3_4 K C T T +(\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c (Flat f) u2) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 +u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Flat f) u2) (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c (Flat f) u2) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2))))))) (drop_drop (Flat f) n0 c e H20 u2)))))) k (drop_gen_drop k c e t n0 +H2) H18 H19))))) c2 H15)) u1 (sym_eq T u1 t H14))) k0 (sym_eq K k0 k H13))) +c0 (sym_eq C c0 c H12))) H11)) H10))) v0 (sym_eq T v0 v H8))) i H4 H5 H6 H7 +H3))))) | (csubst0_fst k0 i0 c0 c3 v0 H3 u) \Rightarrow (\lambda (H4: (eq nat +(s k0 i0) i)).(\lambda (H5: (eq T v0 v)).(\lambda (H6: (eq C (CHead c0 k0 u) +(CHead c k t))).(\lambda (H7: (eq C (CHead c3 k0 u) c2)).(eq_ind nat (s k0 +i0) (\lambda (n1: nat).((eq T v0 v) \to ((eq C (CHead c0 k0 u) (CHead c k t)) +\to ((eq C (CHead c3 k0 u) c2) \to ((csubst0 i0 v0 c0 c3) \to (or4 (drop (S +n0) O c2 e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k1 +w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 (minus n1 (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 k1 +u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop (S n0) O c2 (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus n1 (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c2 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus n1 (s k1 +(S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus n1 (s k1 (S n0))) v e1 +e2))))))))))))) (\lambda (H8: (eq T v0 v)).(eq_ind T v (\lambda (t0: T).((eq +C (CHead c0 k0 u) (CHead c k t)) \to ((eq C (CHead c3 k0 u) c2) \to ((csubst0 +i0 t0 c0 c3) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 k1 +u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c2 (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s k0 i0) (s k1 (S n0))) v +u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O c2 (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s k0 i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(_: T).(eq C e (CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s k0 i0) (s k1 (S n0))) v u0 w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s k0 i0) (s k1 (S n0))) v e1 e2)))))))))))) (\lambda +(H9: (eq C (CHead c0 k0 u) (CHead c k t))).(let H10 \def (f_equal C T +(\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 k0 u) (CHead c k +t) H9) in ((let H11 \def (f_equal C K (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | (CHead _ k1 _) +\Rightarrow k1])) (CHead c0 k0 u) (CHead c k t) H9) in ((let H12 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c4 _ _) \Rightarrow c4])) (CHead c0 k0 u) +(CHead c k t) H9) in (eq_ind C c (\lambda (c4: C).((eq K k0 k) \to ((eq T u +t) \to ((eq C (CHead c3 k0 u) c2) \to ((csubst0 i0 v c4 c3) \to (or4 (drop (S +n0) O c2 e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k1 +w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 (minus (s k0 i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O c2 (CHead e2 k1 u0)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k0 +i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s k0 i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k0 i0) +(s k1 (S n0))) v e1 e2))))))))))))) (\lambda (H13: (eq K k0 k)).(eq_ind K k +(\lambda (k1: K).((eq T u t) \to ((eq C (CHead c3 k1 u) c2) \to ((csubst0 i0 +v c c3) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C T T (\lambda (k2: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 k2 +u0)))))) (\lambda (k2: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c2 (CHead e0 k2 w)))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v +u0 w)))))) (ex3_4 K C C T (\lambda (k2: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 k2 u0)))))) (\lambda (k2: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O c2 (CHead e2 k2 +u0)))))) (\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v e1 e2)))))) (ex4_5 K C C T T +(\lambda (k2: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(_: T).(eq C e (CHead e1 k2 u0))))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e2 k2 w))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v u0 w)))))) +(\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v e1 e2)))))))))))) (\lambda +(H14: (eq T u t)).(eq_ind T t (\lambda (t0: T).((eq C (CHead c3 k t0) c2) \to +((csubst0 i0 v c c3) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C T T (\lambda +(k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 +k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c2 (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s k i0) (s k1 (S n0))) v +u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O c2 (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s k i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(_: T).(eq C e (CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s k i0) (s k1 (S n0))) v u0 w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s k i0) (s k1 (S n0))) v e1 e2))))))))))) (\lambda +(H15: (eq C (CHead c3 k t) c2)).(eq_ind C (CHead c3 k t) (\lambda (c4: +C).((csubst0 i0 v c c3) \to (or4 (drop (S n0) O c4 e) (ex3_4 K C T T (\lambda +(k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 +k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c4 (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s k i0) (s k1 (S n0))) v +u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O c4 (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s k i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(_: T).(eq C e (CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c4 (CHead +e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s k i0) (s k1 (S n0))) v u0 w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s k i0) (s k1 (S n0))) v e1 e2)))))))))) (\lambda +(H16: (csubst0 i0 v c c3)).(let H17 \def (eq_ind K k0 (\lambda (k1: K).(eq +nat (s k1 i0) i)) H4 k H13) in (let H18 \def (eq_ind_r nat i (\lambda (n1: +nat).(\forall (c4: C).(\forall (v1: T).((csubst0 n1 v1 c c4) \to (\forall +(e0: C).((drop (S n0) O c e0) \to (or4 (drop (S n0) O c4 e0) (ex3_4 K C T T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (u0: T).(\lambda (_: T).(eq C e0 +(CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c4 (CHead e1 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus n1 (s k1 +(S n0))) v1 u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C e0 (CHead e1 k1 u0)))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O c4 +(CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus n1 (s k1 (S n0))) v1 e1 e2)))))) (ex4_5 K +C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e0 (CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c4 +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus n1 (s k1 (S n0))) v1 u0 +w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus n1 (s k1 (S n0))) v1 e1 e2)))))))))))))) +H0 (s k i0) H17) in (let H19 \def (eq_ind_r nat i (\lambda (n1: nat).(lt (S +n0) n1)) H (s k i0) H17) in (K_ind (\lambda (k1: K).((drop (r k1 n0) O c e) +\to (((\forall (c4: C).(\forall (v1: T).((csubst0 (s k1 i0) v1 c c4) \to +(\forall (e0: C).((drop (S n0) O c e0) \to (or4 (drop (S n0) O c4 e0) (ex3_4 +K C T T (\lambda (k2: K).(\lambda (e1: C).(\lambda (u0: T).(\lambda (_: +T).(eq C e0 (CHead e1 k2 u0)))))) (\lambda (k2: K).(\lambda (e1: C).(\lambda +(_: T).(\lambda (w: T).(drop (S n0) O c4 (CHead e1 k2 w)))))) (\lambda (k2: +K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s k1 i0) +(s k2 (S n0))) v1 u0 w)))))) (ex3_4 K C C T (\lambda (k2: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C e0 (CHead e1 k2 u0)))))) (\lambda +(k2: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O c4 +(CHead e2 k2 u0)))))) (\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v1 e1 e2)))))) +(ex4_5 K C C T T (\lambda (k2: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e0 (CHead e1 k2 u0))))))) (\lambda (k2: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S +n0) O c4 (CHead e2 k2 w))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) +v1 u0 w)))))) (\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v1 e1 +e2)))))))))))))) \to ((lt (S n0) (s k1 i0)) \to (or4 (drop (S n0) O (CHead c3 +k1 t) e) (ex3_4 K C T T (\lambda (k2: K).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e0 k2 u0)))))) (\lambda (k2: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 k1 t) (CHead +e0 k2 w)))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v u0 w)))))) (ex3_4 K C C T +(\lambda (k2: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 k2 u0)))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O (CHead c3 k1 t) (CHead e2 k2 u0)))))) +(\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus (s k1 i0) (s k2 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k2: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e +(CHead e1 k2 u0))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 k1 t) (CHead e2 +k2 w))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v u0 w)))))) +(\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v e1 e2)))))))))))) (\lambda +(b: B).(\lambda (H20: (drop (r (Bind b) n0) O c e)).(\lambda (_: ((\forall +(c4: C).(\forall (v1: T).((csubst0 (s (Bind b) i0) v1 c c4) \to (\forall (e0: +C).((drop (S n0) O c e0) \to (or4 (drop (S n0) O c4 e0) (ex3_4 K C T T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (u0: T).(\lambda (_: T).(eq C e0 +(CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c4 (CHead e1 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v1 u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e0 (CHead e1 k1 u0)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S +n0) O c4 (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v1 e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e0 (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c4 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v1 u0 w)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v1 e1 e2))))))))))))))).(\lambda (H22: (lt (S n0) (s +(Bind b) i0))).(let H23 \def (IHn i0 (le_S_n (S n0) i0 H22) c c3 v H16 e H20) +in (or4_ind (drop n0 O c3 e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 k1 u0)))))) (\lambda +(k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead +e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 (minus i0 (s k1 n0)) v u0 w)))))) (ex3_4 K C C T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 k1 +u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop n0 O c3 (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (s k1 n0)) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop n0 O c3 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus i0 (s k1 +n0)) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus i0 (s k1 n0)) v e1 e2))))))) (or4 +(drop (S n0) O (CHead c3 (Bind b) t) e) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 k1 +u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S +n0) O (CHead c3 (Bind b) t) (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s +k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda +(k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))))) (\lambda +(H24: (drop n0 O c3 e)).(or4_intro0 (drop (S n0) O (CHead c3 (Bind b) t) e) +(ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda +(_: T).(eq C e (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) t) +(CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Bind b) i0) (s k1 (S n0))) v e1 e2))))))) (drop_drop (Bind b) n0 c3 e H24 +t))) (\lambda (H24: (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e (CHead e0 k1 u0)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead e0 +k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 (minus i0 (s k1 n0)) v u0 w))))))).(ex3_4_ind K C T T (\lambda +(k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 +k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop n0 O c3 (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus i0 (s k1 n0)) v u0 w))))) +(or4 (drop (S n0) O (CHead c3 (Bind b) t) e) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 k1 +u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S +n0) O (CHead c3 (Bind b) t) (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s +k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda +(k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))))) (\lambda +(x0: K).(\lambda (x1: C).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H25: (eq +C e (CHead x1 x0 x2))).(\lambda (H26: (drop n0 O c3 (CHead x1 x0 +x3))).(\lambda (H27: (subst0 (minus i0 (s x0 n0)) v x2 x3)).(eq_ind_r C +(CHead x1 x0 x2) (\lambda (c4: C).(or4 (drop (S n0) O (CHead c3 (Bind b) t) +c4) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C c4 (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(eq C c4 (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) t) +(CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Bind b) i0) (s k1 (S n0))) v e1 e2))))))))) (or4_intro1 (drop (S n0) O +(CHead c3 (Bind b) t) (CHead x1 x0 x2)) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 x0 x2) +(CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 x0 +x2) (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C (CHead x1 x0 x2) (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Bind b) i0) (s k1 (S n0))) v e1 e2))))))) (ex3_4_intro K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 x0 x2) +(CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w))))) x0 x1 x2 x3 (refl_equal C +(CHead x1 x0 x2)) (drop_drop (Bind b) n0 c3 (CHead x1 x0 x3) H26 t) (eq_ind_r +nat (S (s x0 n0)) (\lambda (n1: nat).(subst0 (minus (s (Bind b) i0) n1) v x2 +x3)) H27 (s x0 (S n0)) (s_S x0 n0)))) e H25)))))))) H24)) (\lambda (H24: +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop n0 O c3 (CHead e2 k1 u0)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus i0 (s k1 n0)) v e1 e2))))))).(ex3_4_ind K C C T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 k1 +u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop n0 O c3 (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (s k1 n0)) v e1 +e2))))) (or4 (drop (S n0) O (CHead c3 (Bind b) t) e) (ex3_4 K C T T (\lambda +(k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 +k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S +n0) O (CHead c3 (Bind b) t) (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s +k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda +(k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))))) (\lambda +(x0: K).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H25: (eq +C e (CHead x1 x0 x3))).(\lambda (H26: (drop n0 O c3 (CHead x2 x0 +x3))).(\lambda (H27: (csubst0 (minus i0 (s x0 n0)) v x1 x2)).(eq_ind_r C +(CHead x1 x0 x3) (\lambda (c4: C).(or4 (drop (S n0) O (CHead c3 (Bind b) t) +c4) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C c4 (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(eq C c4 (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) t) +(CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Bind b) i0) (s k1 (S n0))) v e1 e2))))))))) (or4_intro2 (drop (S n0) O +(CHead c3 (Bind b) t) (CHead x1 x0 x3)) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) +(CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 x0 +x3) (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Bind b) i0) (s k1 (S n0))) v e1 e2))))))) (ex3_4_intro K C C T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 x0 x3) +(CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2))))) x0 x1 x2 x3 +(refl_equal C (CHead x1 x0 x3)) (drop_drop (Bind b) n0 c3 (CHead x2 x0 x3) +H26 t) (eq_ind_r nat (S (s x0 n0)) (\lambda (n1: nat).(csubst0 (minus (s +(Bind b) i0) n1) v x1 x2)) H27 (s x0 (S n0)) (s_S x0 n0)))) e H25)))))))) +H24)) (\lambda (H24: (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop n0 O c3 (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus i0 (s k1 n0)) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (s k1 n0)) v e1 +e2)))))))).(ex4_5_ind K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 u0))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop n0 O c3 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus i0 (s k1 +n0)) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus i0 (s k1 n0)) v e1 e2)))))) (or4 (drop +(S n0) O (CHead c3 (Bind b) t) e) (ex3_4 K C T T (\lambda (k1: K).(\lambda +(e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 k1 u0)))))) +(\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S +n0) O (CHead c3 (Bind b) t) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 +(S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O +(CHead c3 (Bind b) t) (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda +(k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))))) (\lambda +(x0: K).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (H25: (eq C e (CHead x1 x0 x3))).(\lambda (H26: (drop n0 O c3 +(CHead x2 x0 x4))).(\lambda (H27: (subst0 (minus i0 (s x0 n0)) v x3 +x4)).(\lambda (H28: (csubst0 (minus i0 (s x0 n0)) v x1 x2)).(eq_ind_r C +(CHead x1 x0 x3) (\lambda (c4: C).(or4 (drop (S n0) O (CHead c3 (Bind b) t) +c4) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C c4 (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(eq C c4 (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) t) +(CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Bind b) i0) (s k1 (S n0))) v e1 e2))))))))) (or4_intro3 (drop (S n0) O +(CHead c3 (Bind b) t) (CHead x1 x0 x3)) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) +(CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 x0 +x3) (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Bind b) i0) (s k1 (S n0))) v e1 e2))))))) (ex4_5_intro K C C T T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq +C (CHead x1 x0 x3) (CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 +(Bind b) t) (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 +(S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v e1 e2)))))) x0 x1 x2 x3 x4 (refl_equal C (CHead x1 x0 x3)) (drop_drop +(Bind b) n0 c3 (CHead x2 x0 x4) H26 t) (eq_ind_r nat (S (s x0 n0)) (\lambda +(n1: nat).(subst0 (minus (s (Bind b) i0) n1) v x3 x4)) H27 (s x0 (S n0)) (s_S +x0 n0)) (eq_ind_r nat (S (s x0 n0)) (\lambda (n1: nat).(csubst0 (minus (s +(Bind b) i0) n1) v x1 x2)) H28 (s x0 (S n0)) (s_S x0 n0)))) e H25)))))))))) +H24)) H23)))))) (\lambda (f: F).(\lambda (H20: (drop (r (Flat f) n0) O c +e)).(\lambda (H21: ((\forall (c4: C).(\forall (v1: T).((csubst0 (s (Flat f) +i0) v1 c c4) \to (\forall (e0: C).((drop (S n0) O c e0) \to (or4 (drop (S n0) +O c4 e0) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e0 (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c4 (CHead e1 k1 +w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v1 u0 w)))))) (ex3_4 K C C T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e0 +(CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O c4 (CHead e2 k1 u0)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v1 e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e0 +(CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c4 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v1 u0 w)))))) (\lambda +(k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v1 e1 +e2))))))))))))))).(\lambda (_: (lt (S n0) (s (Flat f) i0))).(let H23 \def +(H21 c3 v H16 e H20) in (or4_ind (drop (S n0) O c3 e) (ex3_4 K C T T (\lambda +(k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 +k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c3 (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus i0 (s k1 (S n0))) v u0 +w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O c3 (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq +C e (CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus i0 (s k1 (S n0))) v u0 w)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i0 (s k1 (S n0))) v e1 e2))))))) (or4 (drop (S n0) O (CHead c3 (Flat +f) t) e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Flat f) i0) (s k1 (S n0))) v e1 e2)))))))) (\lambda (H24: (drop (S n0) O c3 +e)).(or4_intro0 (drop (S n0) O (CHead c3 (Flat f) t) e) (ex3_4 K C T T +(\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e +(CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 +k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 u0)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e +(CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v e1 e2))))))) (drop_drop (Flat f) n0 c3 e H24 t))) (\lambda (H24: +(ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda +(_: T).(eq C e (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus i0 (s k1 (S n0))) v u0 w))))))).(ex3_4_ind K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 k1 +u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c3 (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus i0 (s k1 (S n0))) v u0 +w))))) (or4 (drop (S n0) O (CHead c3 (Flat f) t) e) (ex3_4 K C T T (\lambda +(k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 +k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S +n0) O (CHead c3 (Flat f) t) (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s +k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (\lambda +(k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2)))))))) (\lambda +(x0: K).(\lambda (x1: C).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H25: (eq +C e (CHead x1 x0 x2))).(\lambda (H26: (drop (S n0) O c3 (CHead x1 x0 +x3))).(\lambda (H27: (subst0 (minus i0 (s x0 (S n0))) v x2 x3)).(eq_ind_r C +(CHead x1 x0 x2) (\lambda (c4: C).(or4 (drop (S n0) O (CHead c3 (Flat f) t) +c4) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C c4 (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(eq C c4 (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Flat f) i0) (s k1 (S n0))) v e1 e2))))))))) (or4_intro1 (drop (S n0) O +(CHead c3 (Flat f) t) (CHead x1 x0 x2)) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 x0 x2) +(CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 x0 +x2) (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C (CHead x1 x0 x2) (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Flat f) i0) (s k1 (S n0))) v e1 e2))))))) (ex3_4_intro K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 x0 x2) +(CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w))))) x0 x1 x2 x3 (refl_equal C +(CHead x1 x0 x2)) (drop_drop (Flat f) n0 c3 (CHead x1 x0 x3) H26 t) H27)) e +H25)))))))) H24)) (\lambda (H24: (ex3_4 K C C T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S +n0) O c3 (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus i0 (s k1 (S n0))) v e1 +e2))))))).(ex3_4_ind K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O c3 (CHead e2 k1 +u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (s k1 (S n0))) v e1 e2))))) (or4 (drop (S n0) O (CHead +c3 (Flat f) t) e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e (CHead e0 k1 u0)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 +(Flat f) t) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(u0: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u0 +w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 k1 u0)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Flat f) i0) (s k1 (S n0))) v e1 e2)))))))) (\lambda (x0: K).(\lambda (x1: +C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H25: (eq C e (CHead x1 x0 +x3))).(\lambda (H26: (drop (S n0) O c3 (CHead x2 x0 x3))).(\lambda (H27: +(csubst0 (minus i0 (s x0 (S n0))) v x1 x2)).(eq_ind_r C (CHead x1 x0 x3) +(\lambda (c4: C).(or4 (drop (S n0) O (CHead c3 (Flat f) t) c4) (ex3_4 K C T T +(\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 +(CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C c4 (CHead e1 +k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 u0)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 +(CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v e1 e2))))))))) (or4_intro2 (drop (S n0) O (CHead c3 (Flat f) t) +(CHead x1 x0 x3)) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda +(u0: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e0 k1 u0)))))) (\lambda +(k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O +(CHead c3 (Flat f) t) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u0: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 u0)))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O +(CHead c3 (Flat f) t) (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) +(CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v e1 e2))))))) (ex3_4_intro K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 +u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 u0)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v e1 e2))))) x0 x1 x2 x3 (refl_equal C (CHead x1 x0 +x3)) (drop_drop (Flat f) n0 c3 (CHead x2 x0 x3) H26 t) H27)) e H25)))))))) +H24)) (\lambda (H24: (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c3 (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus i0 (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (s k1 +(S n0))) v e1 e2)))))))).(ex4_5_ind K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c3 (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus i0 (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (s k1 +(S n0))) v e1 e2)))))) (or4 (drop (S n0) O (CHead c3 (Flat f) t) e) (ex3_4 K +C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq +C e (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 +k1 u0)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 u0)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e +(CHead e1 k1 u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v u0 w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v e1 e2)))))))) (\lambda (x0: K).(\lambda (x1: C).(\lambda (x2: +C).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H25: (eq C e (CHead x1 x0 +x3))).(\lambda (H26: (drop (S n0) O c3 (CHead x2 x0 x4))).(\lambda (H27: +(subst0 (minus i0 (s x0 (S n0))) v x3 x4)).(\lambda (H28: (csubst0 (minus i0 +(s x0 (S n0))) v x1 x2)).(eq_ind_r C (CHead x1 x0 x3) (\lambda (c4: C).(or4 +(drop (S n0) O (CHead c3 (Flat f) t) c4) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e0 k1 +u0)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v u0 w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C c4 (CHead e1 k1 u0)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S +n0) O (CHead c3 (Flat f) t) (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s +k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (\lambda +(k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2))))))))) +(or4_intro3 (drop (S n0) O (CHead c3 (Flat f) t) (CHead x1 x0 x3)) (ex3_4 K C +T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C +(CHead x1 x0 x3) (CHead e0 k1 u0)))))) (\lambda (k1: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 u0)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 +(Flat f) t) (CHead e2 k1 u0)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 +u0))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (\lambda +(k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2))))))) (ex4_5_intro +K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 u0))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) t) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u0 w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Flat f) i0) (s k1 (S n0))) v e1 e2)))))) x0 x1 x2 x3 x4 (refl_equal C (CHead +x1 x0 x3)) (drop_drop (Flat f) n0 c3 (CHead x2 x0 x4) H26 t) H27 H28)) e +H25)))))))))) H24)) H23)))))) k (drop_gen_drop k c e t n0 H2) H18 H19))))) c2 +H15)) u (sym_eq T u t H14))) k0 (sym_eq K k0 k H13))) c0 (sym_eq C c0 c +H12))) H11)) H10))) v0 (sym_eq T v0 v H8))) i H4 H5 H6 H7 H3))))) | +(csubst0_both k0 i0 v0 u1 u2 H3 c0 c3 H4) \Rightarrow (\lambda (H5: (eq nat +(s k0 i0) i)).(\lambda (H6: (eq T v0 v)).(\lambda (H7: (eq C (CHead c0 k0 u1) +(CHead c k t))).(\lambda (H8: (eq C (CHead c3 k0 u2) c2)).(eq_ind nat (s k0 +i0) (\lambda (n1: nat).((eq T v0 v) \to ((eq C (CHead c0 k0 u1) (CHead c k +t)) \to ((eq C (CHead c3 k0 u2) c2) \to ((subst0 i0 v0 u1 u2) \to ((csubst0 +i0 v0 c0 c3) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 +u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c2 (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus n1 (s k1 (S n0))) v u +w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k1 u)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus n1 (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus n1 (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus n1 +(s k1 (S n0))) v e1 e2)))))))))))))) (\lambda (H9: (eq T v0 v)).(eq_ind T v +(\lambda (t0: T).((eq C (CHead c0 k0 u1) (CHead c k t)) \to ((eq C (CHead c3 +k0 u2) c2) \to ((subst0 i0 t0 u1 u2) \to ((csubst0 i0 t0 c0 c3) \to (or4 +(drop (S n0) O c2 e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s k0 i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k0 +i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s k0 i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k0 i0) +(s k1 (S n0))) v e1 e2))))))))))))) (\lambda (H10: (eq C (CHead c0 k0 u1) +(CHead c k t))).(let H11 \def (f_equal C T (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).T) with [(CSort _) \Rightarrow u1 | (CHead _ _ t0) +\Rightarrow t0])) (CHead c0 k0 u1) (CHead c k t) H10) in ((let H12 \def +(f_equal C K (\lambda (e0: C).(match e0 in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow k0 | (CHead _ k1 _) \Rightarrow k1])) (CHead c0 k0 u1) +(CHead c k t) H10) in ((let H13 \def (f_equal C C (\lambda (e0: C).(match e0 +in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c4 _ +_) \Rightarrow c4])) (CHead c0 k0 u1) (CHead c k t) H10) in (eq_ind C c +(\lambda (c4: C).((eq K k0 k) \to ((eq T u1 t) \to ((eq C (CHead c3 k0 u2) +c2) \to ((subst0 i0 v u1 u2) \to ((csubst0 i0 v c4 c3) \to (or4 (drop (S n0) +O c2 e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k1 +w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s k0 i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k0 +i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s k0 i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k0 i0) +(s k1 (S n0))) v e1 e2)))))))))))))) (\lambda (H14: (eq K k0 k)).(eq_ind K k +(\lambda (k1: K).((eq T u1 t) \to ((eq C (CHead c3 k1 u2) c2) \to ((subst0 i0 +v u1 u2) \to ((csubst0 i0 v c c3) \to (or4 (drop (S n0) O c2 e) (ex3_4 K C T +T (\lambda (k2: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 k2 u)))))) (\lambda (k2: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k2 w)))))) (\lambda (k2: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k1 i0) +(s k2 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda (k2: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k2 u)))))) (\lambda (k2: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c2 (CHead +e2 k2 u)))))) (\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v e1 e2)))))) (ex4_5 K C C T T +(\lambda (k2: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e1 k2 u))))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e2 k2 w))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v u w)))))) +(\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v e1 e2))))))))))))) (\lambda +(H15: (eq T u1 t)).(eq_ind T t (\lambda (t0: T).((eq C (CHead c3 k u2) c2) +\to ((subst0 i0 v t0 u2) \to ((csubst0 i0 v c c3) \to (or4 (drop (S n0) O c2 +e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s k i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 +u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O c2 (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k i0) (s k1 (S n0))) v +e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c2 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k i0) (s +k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k i0) (s k1 (S n0))) v +e1 e2)))))))))))) (\lambda (H16: (eq C (CHead c3 k u2) c2)).(eq_ind C (CHead +c3 k u2) (\lambda (c4: C).((subst0 i0 v t u2) \to ((csubst0 i0 v c c3) \to +(or4 (drop (S n0) O c4 e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c4 (CHead +e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s k i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 +u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O c4 (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k i0) (s k1 (S n0))) v +e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c4 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k i0) (s +k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k i0) (s k1 (S n0))) v +e1 e2))))))))))) (\lambda (_: (subst0 i0 v t u2)).(\lambda (H18: (csubst0 i0 +v c c3)).(let H19 \def (eq_ind K k0 (\lambda (k1: K).(eq nat (s k1 i0) i)) H5 +k H14) in (let H20 \def (eq_ind_r nat i (\lambda (n1: nat).(\forall (c4: +C).(\forall (v1: T).((csubst0 n1 v1 c c4) \to (\forall (e0: C).((drop (S n0) +O c e0) \to (or4 (drop (S n0) O c4 e0) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (u: T).(\lambda (_: T).(eq C e0 (CHead e1 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c4 (CHead e1 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus n1 (s k1 (S n0))) v1 u +w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e0 (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c4 (CHead e2 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus n1 (s k1 (S n0))) v1 e1 e2)))))) (ex4_5 K C C T T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq +C e0 (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c4 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus n1 (s k1 (S n0))) v1 u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus n1 +(s k1 (S n0))) v1 e1 e2)))))))))))))) H0 (s k i0) H19) in (let H21 \def +(eq_ind_r nat i (\lambda (n1: nat).(lt (S n0) n1)) H (s k i0) H19) in (K_ind +(\lambda (k1: K).((drop (r k1 n0) O c e) \to (((\forall (c4: C).(\forall (v1: +T).((csubst0 (s k1 i0) v1 c c4) \to (\forall (e0: C).((drop (S n0) O c e0) +\to (or4 (drop (S n0) O c4 e0) (ex3_4 K C T T (\lambda (k2: K).(\lambda (e1: +C).(\lambda (u: T).(\lambda (_: T).(eq C e0 (CHead e1 k2 u)))))) (\lambda +(k2: K).(\lambda (e1: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c4 +(CHead e1 k2 w)))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v1 u w)))))) +(ex3_4 K C C T (\lambda (k2: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e0 (CHead e1 k2 u)))))) (\lambda (k2: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (S n0) O c4 (CHead e2 k2 u)))))) (\lambda (k2: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s k1 +i0) (s k2 (S n0))) v1 e1 e2)))))) (ex4_5 K C C T T (\lambda (k2: K).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e0 (CHead e1 k2 +u))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c4 (CHead e2 k2 w))))))) (\lambda (k2: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s k1 i0) (s k2 (S n0))) v1 u w)))))) (\lambda (k2: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s k1 i0) +(s k2 (S n0))) v1 e1 e2)))))))))))))) \to ((lt (S n0) (s k1 i0)) \to (or4 +(drop (S n0) O (CHead c3 k1 u2) e) (ex3_4 K C T T (\lambda (k2: K).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k2 u)))))) (\lambda +(k2: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O +(CHead c3 k1 u2) (CHead e0 k2 w)))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v +u w)))))) (ex3_4 K C C T (\lambda (k2: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 k2 u)))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 k1 u2) (CHead e2 +k2 u)))))) (\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v e1 e2)))))) (ex4_5 K C C T T +(\lambda (k2: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e1 k2 u))))))) (\lambda (k2: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 +k1 u2) (CHead e2 k2 w))))))) (\lambda (k2: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s k1 i0) (s k2 (S n0))) v +u w)))))) (\lambda (k2: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus (s k1 i0) (s k2 (S n0))) v e1 +e2)))))))))))) (\lambda (b: B).(\lambda (H22: (drop (r (Bind b) n0) O c +e)).(\lambda (_: ((\forall (c4: C).(\forall (v1: T).((csubst0 (s (Bind b) i0) +v1 c c4) \to (\forall (e0: C).((drop (S n0) O c e0) \to (or4 (drop (S n0) O +c4 e0) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (u: +T).(\lambda (_: T).(eq C e0 (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c4 (CHead e1 k1 +w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v1 u w)))))) (ex3_4 K C C T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e0 +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O c4 (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v1 e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e0 +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c4 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v1 u w)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v1 e1 e2))))))))))))))).(\lambda (H24: +(lt (S n0) (s (Bind b) i0))).(let H25 \def (IHn i0 (le_S_n (S n0) i0 H24) c +c3 v H18 e H22) in (or4_ind (drop n0 O c3 e) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 +u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop n0 O c3 (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i0 (s k1 n0)) v u w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop n0 O c3 (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (s k1 +n0)) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop n0 O c3 (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i0 (s k1 n0)) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (s k1 n0)) v e1 +e2))))))) (or4 (drop (S n0) O (CHead c3 (Bind b) u2) e) (ex3_4 K C T T +(\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 +u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 +e2)))))))) (\lambda (H26: (drop n0 O c3 e)).(or4_intro0 (drop (S n0) O (CHead +c3 (Bind b) u2) e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead +c3 (Bind b) u2) (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) +i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 +(S n0))) v e1 e2))))))) (drop_drop (Bind b) n0 c3 e H26 u2))) (\lambda (H26: +(ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop n0 O c3 (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i0 (s k1 +n0)) v u w))))))).(ex3_4_ind K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead e0 +k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i0 (s k1 n0)) v u w))))) (or4 (drop (S n0) O (CHead c3 +(Bind b) u2) e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead +c3 (Bind b) u2) (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) +i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 +(S n0))) v e1 e2)))))))) (\lambda (x0: K).(\lambda (x1: C).(\lambda (x2: +T).(\lambda (x3: T).(\lambda (H27: (eq C e (CHead x1 x0 x2))).(\lambda (H28: +(drop n0 O c3 (CHead x1 x0 x3))).(\lambda (H29: (subst0 (minus i0 (s x0 n0)) +v x2 x3)).(eq_ind_r C (CHead x1 x0 x2) (\lambda (c4: C).(or4 (drop (S n0) O +(CHead c3 (Bind b) u2) c4) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e0 k1 u)))))) (\lambda +(k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O +(CHead c3 (Bind b) u2) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C c4 (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 +(Bind b) u2) (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Bind b) i0) (s k1 (S n0))) v e1 e2))))))))) (or4_intro1 (drop (S n0) O +(CHead c3 (Bind b) u2) (CHead x1 x0 x2)) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 x0 x2) +(CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 x0 +x2) (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 u)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq +C (CHead x1 x0 x2) (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 +(Bind b) u2) (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 +(S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v e1 e2))))))) (ex3_4_intro K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 x0 x2) (CHead e0 k1 +u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) +i0) (s k1 (S n0))) v u w))))) x0 x1 x2 x3 (refl_equal C (CHead x1 x0 x2)) +(drop_drop (Bind b) n0 c3 (CHead x1 x0 x3) H28 u2) (eq_ind_r nat (S (s x0 +n0)) (\lambda (n1: nat).(subst0 (minus (s (Bind b) i0) n1) v x2 x3)) H29 (s +x0 (S n0)) (s_S x0 n0)))) e H27)))))))) H26)) (\lambda (H26: (ex3_4 K C C T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop n0 O c3 (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (s k1 +n0)) v e1 e2))))))).(ex3_4_ind K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop n0 O c3 (CHead e2 +k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (s k1 n0)) v e1 e2))))) (or4 (drop (S n0) O (CHead c3 +(Bind b) u2) e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead +c3 (Bind b) u2) (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) +i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 +(S n0))) v e1 e2)))))))) (\lambda (x0: K).(\lambda (x1: C).(\lambda (x2: +C).(\lambda (x3: T).(\lambda (H27: (eq C e (CHead x1 x0 x3))).(\lambda (H28: +(drop n0 O c3 (CHead x2 x0 x3))).(\lambda (H29: (csubst0 (minus i0 (s x0 n0)) +v x1 x2)).(eq_ind_r C (CHead x1 x0 x3) (\lambda (c4: C).(or4 (drop (S n0) O +(CHead c3 (Bind b) u2) c4) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e0 k1 u)))))) (\lambda +(k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O +(CHead c3 (Bind b) u2) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C c4 (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 +(Bind b) u2) (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Bind b) i0) (s k1 (S n0))) v e1 e2))))))))) (or4_intro2 (drop (S n0) O +(CHead c3 (Bind b) u2) (CHead x1 x0 x3)) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) +(CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 x0 +x3) (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 u)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq +C (CHead x1 x0 x3) (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 +(Bind b) u2) (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 +(S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v e1 e2))))))) (ex3_4_intro K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 +u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v e1 e2))))) x0 x1 x2 x3 (refl_equal C (CHead x1 x0 +x3)) (drop_drop (Bind b) n0 c3 (CHead x2 x0 x3) H28 u2) (eq_ind_r nat (S (s +x0 n0)) (\lambda (n1: nat).(csubst0 (minus (s (Bind b) i0) n1) v x1 x2)) H29 +(s x0 (S n0)) (s_S x0 n0)))) e H27)))))))) H26)) (\lambda (H26: (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead +e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i0 (s k1 n0)) v u w)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i0 (s k1 n0)) v e1 e2)))))))).(ex4_5_ind K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i0 (s k1 n0)) v u w)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (s k1 +n0)) v e1 e2)))))) (or4 (drop (S n0) O (CHead c3 (Bind b) u2) e) (ex3_4 K C T +T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 +u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind +b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 +e2)))))))) (\lambda (x0: K).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: +T).(\lambda (x4: T).(\lambda (H27: (eq C e (CHead x1 x0 x3))).(\lambda (H28: +(drop n0 O c3 (CHead x2 x0 x4))).(\lambda (H29: (subst0 (minus i0 (s x0 n0)) +v x3 x4)).(\lambda (H30: (csubst0 (minus i0 (s x0 n0)) v x1 x2)).(eq_ind_r C +(CHead x1 x0 x3) (\lambda (c4: C).(or4 (drop (S n0) O (CHead c3 (Bind b) u2) +c4) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C c4 (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c4 (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C c4 (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead +c3 (Bind b) u2) (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) +i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 +(S n0))) v e1 e2))))))))) (or4_intro3 (drop (S n0) O (CHead c3 (Bind b) u2) +(CHead x1 x0 x3)) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e0 k1 u)))))) (\lambda +(k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O +(CHead c3 (Bind b) u2) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 u)))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O +(CHead c3 (Bind b) u2) (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S +n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 +e2))))))) (ex4_5_intro K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead e2 k1 +w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Bind b) i0) (s k1 (S n0))) v u w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s (Bind b) i0) (s k1 (S n0))) v e1 e2)))))) x0 x1 x2 +x3 x4 (refl_equal C (CHead x1 x0 x3)) (drop_drop (Bind b) n0 c3 (CHead x2 x0 +x4) H28 u2) (eq_ind_r nat (S (s x0 n0)) (\lambda (n1: nat).(subst0 (minus (s +(Bind b) i0) n1) v x3 x4)) H29 (s x0 (S n0)) (s_S x0 n0)) (eq_ind_r nat (S (s +x0 n0)) (\lambda (n1: nat).(csubst0 (minus (s (Bind b) i0) n1) v x1 x2)) H30 +(s x0 (S n0)) (s_S x0 n0)))) e H27)))))))))) H26)) H25)))))) (\lambda (f: +F).(\lambda (H22: (drop (r (Flat f) n0) O c e)).(\lambda (H23: ((\forall (c4: +C).(\forall (v1: T).((csubst0 (s (Flat f) i0) v1 c c4) \to (\forall (e0: +C).((drop (S n0) O c e0) \to (or4 (drop (S n0) O c4 e0) (ex3_4 K C T T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (u: T).(\lambda (_: T).(eq C e0 +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c4 (CHead e1 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) +i0) (s k1 (S n0))) v1 u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e0 (CHead e1 k1 u)))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c4 +(CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v1 e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e0 (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c4 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) +i0) (s k1 (S n0))) v1 u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 +(S n0))) v1 e1 e2))))))))))))))).(\lambda (_: (lt (S n0) (s (Flat f) +i0))).(let H25 \def (H23 c3 v H18 e H22) in (or4_ind (drop (S n0) O c3 e) +(ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i0 (s k1 (S +n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c3 (CHead e2 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq +C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e2 k1 w))))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i0 (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 +(s k1 (S n0))) v e1 e2))))))) (or4 (drop (S n0) O (CHead c3 (Flat f) u2) e) +(ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e0 k1 +w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T +(\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 u)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq +C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))))) (\lambda (H26: (drop (S n0) O c3 e)).(or4_intro0 (drop (S n0) O +(CHead c3 (Flat f) u2) e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 +(Flat f) u2) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u +w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Flat f) u2) +(CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Flat f) i0) (s k1 (S n0))) v e1 e2))))))) (drop_drop (Flat f) n0 c3 e H26 +u2))) (\lambda (H26: (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead +e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i0 (s k1 (S n0))) v u w))))))).(ex3_4_ind K C T T (\lambda +(k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 +u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c3 (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i0 (s k1 (S n0))) v u +w))))) (or4 (drop (S n0) O (CHead c3 (Flat f) u2) e) (ex3_4 K C T T (\lambda +(k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 +u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) +i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 +(Flat f) u2) (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Flat f) i0) (s k1 (S n0))) v e1 e2)))))))) (\lambda (x0: K).(\lambda (x1: +C).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H27: (eq C e (CHead x1 x0 +x2))).(\lambda (H28: (drop (S n0) O c3 (CHead x1 x0 x3))).(\lambda (H29: +(subst0 (minus i0 (s x0 (S n0))) v x2 x3)).(eq_ind_r C (CHead x1 x0 x2) +(\lambda (c4: C).(or4 (drop (S n0) O (CHead c3 (Flat f) u2) c4) (ex3_4 K C T +T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 +(CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c4 (CHead e1 +k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2))))))))) (or4_intro1 (drop (S n0) O (CHead c3 (Flat f) u2) (CHead x1 x0 +x2)) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C (CHead x1 x0 x2) (CHead e0 k1 u)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 +(Flat f) u2) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u +w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C (CHead x1 x0 x2) (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 +(Flat f) u2) (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 x0 x2) (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 +w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2))))))) +(ex3_4_intro K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C (CHead x1 x0 x2) (CHead e0 k1 u)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 +(Flat f) u2) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u +w))))) x0 x1 x2 x3 (refl_equal C (CHead x1 x0 x2)) (drop_drop (Flat f) n0 c3 +(CHead x1 x0 x3) H28 u2) H29)) e H27)))))))) H26)) (\lambda (H26: (ex3_4 K C +C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (S n0) O c3 (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (s k1 +(S n0))) v e1 e2))))))).(ex3_4_ind K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c3 (CHead +e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (s k1 (S n0))) v e1 e2))))) (or4 (drop (S n0) O (CHead +c3 (Flat f) u2) e) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 +u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C +T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead +c3 (Flat f) u2) (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) +i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 +(S n0))) v e1 e2)))))))) (\lambda (x0: K).(\lambda (x1: C).(\lambda (x2: +C).(\lambda (x3: T).(\lambda (H27: (eq C e (CHead x1 x0 x3))).(\lambda (H28: +(drop (S n0) O c3 (CHead x2 x0 x3))).(\lambda (H29: (csubst0 (minus i0 (s x0 +(S n0))) v x1 x2)).(eq_ind_r C (CHead x1 x0 x3) (\lambda (c4: C).(or4 (drop +(S n0) O (CHead c3 (Flat f) u2) c4) (ex3_4 K C T T (\lambda (k1: K).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e0 k1 u)))))) +(\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S +n0) O (CHead c3 (Flat f) u2) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 +(S n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c4 (CHead e1 k1 u)))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O +(CHead c3 (Flat f) u2) (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 +w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2))))))))) +(or4_intro2 (drop (S n0) O (CHead c3 (Flat f) u2) (CHead x1 x0 x3)) (ex3_4 K +C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C +(CHead x1 x0 x3) (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) +(CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) +(ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C (CHead x1 x0 x3) (CHead e1 k1 u)))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Flat f) u2) +(CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 +w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2))))))) +(ex3_4_intro K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 +(Flat f) u2) (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2))))) x0 x1 x2 x3 (refl_equal C (CHead x1 x0 x3)) (drop_drop (Flat f) n0 c3 +(CHead x2 x0 x3) H28 u2) H29)) e H27)))))))) H26)) (\lambda (H26: (ex4_5 K C +C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i0 (s k1 (S n0))) v u +w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i0 (s k1 (S n0))) v e1 +e2)))))))).(ex4_5_ind K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c3 (CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i0 (s k1 (S +n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus i0 (s k1 (S n0))) v e1 e2)))))) (or4 +(drop (S n0) O (CHead c3 (Flat f) u2) e) (ex3_4 K C T T (\lambda (k1: +K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 k1 +u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e0 k1 w)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) +i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 +(Flat f) u2) (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 k1 u))))))) (\lambda +(k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 w))))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) (\lambda (k1: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus (s +(Flat f) i0) (s k1 (S n0))) v e1 e2)))))))) (\lambda (x0: K).(\lambda (x1: +C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H27: (eq C e +(CHead x1 x0 x3))).(\lambda (H28: (drop (S n0) O c3 (CHead x2 x0 +x4))).(\lambda (H29: (subst0 (minus i0 (s x0 (S n0))) v x3 x4)).(\lambda +(H30: (csubst0 (minus i0 (s x0 (S n0))) v x1 x2)).(eq_ind_r C (CHead x1 x0 +x3) (\lambda (c4: C).(or4 (drop (S n0) O (CHead c3 (Flat f) u2) c4) (ex3_4 K +C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C +c4 (CHead e0 k1 u)))))) (\lambda (k1: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e0 k1 w)))))) +(\lambda (k1: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) (ex3_4 K C C T (\lambda +(k1: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c4 (CHead e1 +k1 u)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 u)))))) (\lambda (k1: +K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat +f) i0) (s k1 (S n0))) v e1 e2)))))) (ex4_5 K C C T T (\lambda (k1: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 +(CHead e1 k1 u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) +(CHead e2 k1 w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S +n0))) v u w)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2))))))))) (or4_intro3 (drop (S n0) O (CHead c3 (Flat f) u2) (CHead x1 x0 +x3)) (ex3_4 K C T T (\lambda (k1: K).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e0 k1 u)))))) (\lambda (k1: +K).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O (CHead c3 +(Flat f) u2) (CHead e0 k1 w)))))) (\lambda (k1: K).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u +w)))))) (ex3_4 K C C T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 u)))))) (\lambda (k1: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 +(Flat f) u2) (CHead e2 k1 u)))))) (\lambda (k1: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 +w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2))))))) +(ex4_5_intro K C C T T (\lambda (k1: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 x0 x3) (CHead e1 k1 +u))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O (CHead c3 (Flat f) u2) (CHead e2 k1 +w))))))) (\lambda (k1: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus (s (Flat f) i0) (s k1 (S n0))) v u w)))))) +(\lambda (k1: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus (s (Flat f) i0) (s k1 (S n0))) v e1 e2)))))) x0 x1 x2 +x3 x4 (refl_equal C (CHead x1 x0 x3)) (drop_drop (Flat f) n0 c3 (CHead x2 x0 +x4) H28 u2) H29 H30)) e H27)))))))))) H26)) H25)))))) k (drop_gen_drop k c e +t n0 H2) H20 H21)))))) c2 H16)) u1 (sym_eq T u1 t H15))) k0 (sym_eq K k0 k +H14))) c0 (sym_eq C c0 c H13))) H12)) H11))) v0 (sym_eq T v0 v H9))) i H5 H6 +H7 H8 H3 H4)))))]) in (H3 (refl_equal nat i) (refl_equal T v) (refl_equal C +(CHead c k t)) (refl_equal C c2)))))))))))) c1)))))) n). + +theorem csubst0_drop_eq: + \forall (n: nat).(\forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 +n v c1 c2) \to (\forall (e: C).((drop n O c1 e) \to (or4 (drop n O c2 e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop n O c2 (CHead e0 (Flat f) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u +w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop n O c2 (CHead e2 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 +(Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop n O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))))))))))) +\def + \lambda (n: nat).(nat_ind (\lambda (n0: nat).(\forall (c1: C).(\forall (c2: +C).(\forall (v: T).((csubst0 n0 v c1 c2) \to (\forall (e: C).((drop n0 O c1 +e) \to (or4 (drop n0 O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O +c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop n0 O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c2 (CHead e2 +(Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))))))))) (\lambda (c1: C).(\lambda (c2: C).(\lambda (v: T).(\lambda +(H: (csubst0 O v c1 c2)).(\lambda (e: C).(\lambda (H0: (drop O O c1 +e)).(eq_ind C c1 (\lambda (c: C).(or4 (drop O O c2 c) (ex3_4 F C T T (\lambda +(f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e0 +(Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop O O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c +(CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop O O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C c (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O +c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))) (insert_eq nat O (\lambda (n0: nat).(csubst0 n0 v c1 c2)) +(or4 (drop O O c2 c1) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C c1 (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O c2 +(CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c1 (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop O O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C c1 (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O c2 (CHead e2 +(Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))) (\lambda (y: nat).(\lambda (H1: (csubst0 y v c1 c2)).(csubst0_ind +(\lambda (n0: nat).(\lambda (t: T).(\lambda (c: C).(\lambda (c0: C).((eq nat +n0 O) \to (or4 (drop O O c0 c) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O c0 +(CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O t u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop O O c0 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O t e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C c (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O c0 (CHead e2 +(Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O t u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O t e1 +e2))))))))))))) (\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: +nat).(\forall (v0: T).(\forall (u1: T).(\forall (u2: T).((subst0 i v0 u1 u2) +\to (\forall (c: C).((eq nat (s k0 i) O) \to (or4 (drop O O (CHead c k0 u2) +(CHead c k0 u1)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C (CHead c k0 u1) (CHead e0 (Flat f) u)))))) (\lambda +(f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c k0 +u2) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v0 u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead c k0 u1) +(CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop O O (CHead c k0 u2) (CHead e2 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c k0 u1) (CHead e1 (Flat f) +u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop O O (CHead c k0 u2) (CHead e2 (Flat f) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v0 u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 e2)))))))))))))))) +(\lambda (b: B).(\lambda (i: nat).(\lambda (v0: T).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (_: (subst0 i v0 u1 u2)).(\lambda (c: C).(\lambda (H3: (eq +nat (S i) O)).(let H4 \def (eq_ind nat (S i) (\lambda (ee: nat).(match ee in +nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H3) in (False_ind (or4 (drop O O (CHead c (Bind b) +u2) (CHead c (Bind b) u1)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c (Bind b) u1) (CHead e0 +(Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop O O (CHead c (Bind b) u2) (CHead e0 (Flat f) w)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C (CHead c (Bind b) u1) (CHead e1 (Flat f) u)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop O O (CHead c (Bind +b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +(CHead c (Bind b) u1) (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c +(Bind b) u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v0 e1 e2)))))))) H4)))))))))) (\lambda (f: F).(\lambda (i: +nat).(\lambda (v0: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H2: (subst0 +i v0 u1 u2)).(\lambda (c: C).(\lambda (H3: (eq nat i O)).(let H4 \def (eq_ind +nat i (\lambda (n0: nat).(subst0 n0 v0 u1 u2)) H2 O H3) in (or4_intro1 (drop +O O (CHead c (Flat f) u2) (CHead c (Flat f) u1)) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c (Flat f) +u1) (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop O O (CHead c (Flat f) u2) (CHead e0 (Flat f0) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v0 u w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead c (Flat f) u1) (CHead e1 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u: T).(drop O O (CHead c (Flat f) u2) (CHead e2 (Flat f0) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c (Flat f) u1) (CHead e1 +(Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop O O (CHead c (Flat f) u2) (CHead e2 (Flat f0) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v0 u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 +e2))))))) (ex3_4_intro F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C (CHead c (Flat f) u1) (CHead e0 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O +(CHead c (Flat f) u2) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w))))) f c u1 u2 +(refl_equal C (CHead c (Flat f) u1)) (drop_refl (CHead c (Flat f) u2)) +H4))))))))))) k)) (\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: +nat).(\forall (c3: C).(\forall (c4: C).(\forall (v0: T).((csubst0 i v0 c3 c4) +\to ((((eq nat i O) \to (or4 (drop O O c4 c3) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 (CHead e0 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop O O c4 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c3 +(CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop O O c4 (CHead e2 (Flat f) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c3 (CHead e1 (Flat f) u))))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop O O c4 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v0 e1 e2)))))))))) \to (\forall (u: T).((eq nat (s k0 i) O) +\to (or4 (drop O O (CHead c4 k0 u) (CHead c3 k0 u)) (ex3_4 F C T T (\lambda +(f: F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead c3 k0 +u) (CHead e0 (Flat f) u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop O O (CHead c4 k0 u) (CHead e0 (Flat f) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v0 +u0 w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C (CHead c3 k0 u) (CHead e1 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop O O +(CHead c4 k0 u) (CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T +T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(_: T).(eq C (CHead c3 k0 u) (CHead e1 (Flat f) u0))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O +(CHead c4 k0 u) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v0 u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v0 e1 e2))))))))))))))))) (\lambda (b: B).(\lambda (i: +nat).(\lambda (c3: C).(\lambda (c4: C).(\lambda (v0: T).(\lambda (_: (csubst0 +i v0 c3 c4)).(\lambda (_: (((eq nat i O) \to (or4 (drop O O c4 c3) (ex3_4 F C +T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 +(CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop O O c4 (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c3 (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop O O c4 (CHead e2 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c3 (CHead e1 (Flat f) u))))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop O O c4 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v0 e1 e2))))))))))).(\lambda (u: T).(\lambda (H4: (eq nat +(S i) O)).(let H5 \def (eq_ind nat (S i) (\lambda (ee: nat).(match ee in nat +return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow +True])) I O H4) in (False_ind (or4 (drop O O (CHead c4 (Bind b) u) (CHead c3 +(Bind b) u)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C (CHead c3 (Bind b) u) (CHead e0 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O +(CHead c4 (Bind b) u) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v0 u0 w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C +(CHead c3 (Bind b) u) (CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u0: T).(drop O O (CHead c4 (Bind b) u) +(CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C +(CHead c3 (Bind b) u) (CHead e1 (Flat f) u0))))))) (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c4 +(Bind b) u) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v0 u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v0 e1 e2)))))))) H5))))))))))) (\lambda (f: F).(\lambda (i: +nat).(\lambda (c3: C).(\lambda (c4: C).(\lambda (v0: T).(\lambda (H2: +(csubst0 i v0 c3 c4)).(\lambda (H3: (((eq nat i O) \to (or4 (drop O O c4 c3) +(ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C c3 (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 (CHead e0 (Flat f0) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 +u w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c3 (CHead e1 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop O O c4 (CHead e2 +(Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 (CHead e1 +(Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop O O c4 (CHead e2 (Flat f0) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v0 u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v0 e1 e2))))))))))).(\lambda (u: T).(\lambda +(H4: (eq nat i O)).(let H5 \def (eq_ind nat i (\lambda (n0: nat).((eq nat n0 +O) \to (or4 (drop O O c4 c3) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C c3 (CHead e0 (Flat f0) u0)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O +c4 (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 O v0 u0 w)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C c3 (CHead e1 (Flat +f0) u0)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop O O c4 (CHead e2 (Flat f0) u0)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T +T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda +(_: T).(eq C c3 (CHead e1 (Flat f0) u0))))))) (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 (CHead e2 +(Flat f0) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (w: T).(subst0 O v0 u0 w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))))))) H3 O H4) in (let H6 \def (eq_ind nat i (\lambda (n0: +nat).(csubst0 n0 v0 c3 c4)) H2 O H4) in (or4_intro2 (drop O O (CHead c4 (Flat +f) u) (CHead c3 (Flat f) u)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead c3 (Flat f) u) (CHead e0 +(Flat f0) u0)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop O O (CHead c4 (Flat f) u) (CHead e0 (Flat f0) w)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v0 u0 +w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C (CHead c3 (Flat f) u) (CHead e1 (Flat f0) u0)))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop O O +(CHead c4 (Flat f) u) (CHead e2 (Flat f0) u0)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C +C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C (CHead c3 (Flat f) u) (CHead e1 (Flat f0) u0))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop O O (CHead c4 (Flat f) u) (CHead e2 (Flat f0) w))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v0 u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 e2))))))) (ex3_4_intro F +C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq +C (CHead c3 (Flat f) u) (CHead e1 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop O O (CHead c4 +(Flat f) u) (CHead e2 (Flat f0) u0)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 e2))))) f c3 c4 u +(refl_equal C (CHead c3 (Flat f) u)) (drop_refl (CHead c4 (Flat f) u)) +H6))))))))))))) k)) (\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: +nat).(\forall (v0: T).(\forall (u1: T).(\forall (u2: T).((subst0 i v0 u1 u2) +\to (\forall (c3: C).(\forall (c4: C).((csubst0 i v0 c3 c4) \to ((((eq nat i +O) \to (or4 (drop O O c4 c3) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C c3 (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 +(CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v0 u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c3 (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop O O c4 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T +T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(eq C c3 (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 (CHead e2 +(Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v0 u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))))))) \to ((eq nat (s k0 i) O) \to (or4 (drop O O (CHead c4 k0 u2) +(CHead c3 k0 u1)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C (CHead c3 k0 u1) (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O +(CHead c4 k0 u2) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead +c3 k0 u1) (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop O O (CHead c4 k0 u2) (CHead e2 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c3 k0 u1) (CHead e1 (Flat f) +u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop O O (CHead c4 k0 u2) (CHead e2 (Flat f) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v0 u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 e2))))))))))))))))))) +(\lambda (b: B).(\lambda (i: nat).(\lambda (v0: T).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (_: (subst0 i v0 u1 u2)).(\lambda (c3: C).(\lambda (c4: +C).(\lambda (_: (csubst0 i v0 c3 c4)).(\lambda (_: (((eq nat i O) \to (or4 +(drop O O c4 c3) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C c3 (CHead e0 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 (CHead e0 +(Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v0 u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c3 (CHead e1 (Flat f) u)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop O O c4 +(CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 +(CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 (CHead e2 (Flat f) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v0 u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 e2))))))))))).(\lambda +(H5: (eq nat (S i) O)).(let H6 \def (eq_ind nat (S i) (\lambda (ee: +nat).(match ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +False | (S _) \Rightarrow True])) I O H5) in (False_ind (or4 (drop O O (CHead +c4 (Bind b) u2) (CHead c3 (Bind b) u1)) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c3 (Bind b) +u1) (CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop O O (CHead c4 (Bind b) u2) (CHead e0 (Flat f) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v0 u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead c3 (Bind b) u1) (CHead e1 +(Flat f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u: T).(drop O O (CHead c4 (Bind b) u2) (CHead e2 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c3 (Bind b) u1) (CHead e1 +(Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop O O (CHead c4 (Bind b) u2) (CHead e2 (Flat f) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v0 u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))))) H6))))))))))))) (\lambda (f: F).(\lambda (i: nat).(\lambda (v0: +T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H2: (subst0 i v0 u1 +u2)).(\lambda (c3: C).(\lambda (c4: C).(\lambda (H3: (csubst0 i v0 c3 +c4)).(\lambda (H4: (((eq nat i O) \to (or4 (drop O O c4 c3) (ex3_4 F C T T +(\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 +(CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop O O c4 (CHead e0 (Flat f0) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) +(ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c3 (CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop O O c4 (CHead e2 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 (CHead e1 (Flat f0) u))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop O O c4 (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v0 e1 e2))))))))))).(\lambda (H5: (eq nat i O)).(let H6 +\def (eq_ind nat i (\lambda (n0: nat).((eq nat n0 O) \to (or4 (drop O O c4 +c3) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C c3 (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop O O c4 (CHead e0 (Flat f0) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 +u w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C c3 (CHead e1 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop O O c4 (CHead e2 +(Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C c3 (CHead e1 +(Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop O O c4 (CHead e2 (Flat f0) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v0 u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v0 e1 e2)))))))))) H4 O H5) in (let H7 \def +(eq_ind nat i (\lambda (n0: nat).(csubst0 n0 v0 c3 c4)) H3 O H5) in (let H8 +\def (eq_ind nat i (\lambda (n0: nat).(subst0 n0 v0 u1 u2)) H2 O H5) in +(or4_intro3 (drop O O (CHead c4 (Flat f) u2) (CHead c3 (Flat f) u1)) (ex3_4 F +C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C +(CHead c3 (Flat f) u1) (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c4 (Flat f) u2) +(CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v0 u w)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead c3 (Flat f) +u1) (CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop O O (CHead c4 (Flat f) u2) (CHead e2 (Flat f0) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c3 (Flat f) +u1) (CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c4 (Flat f) u2) +(CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v0 e1 e2))))))) (ex4_5_intro F C C T T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead c3 (Flat f) +u1) (CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop O O (CHead c4 (Flat f) u2) +(CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v0 u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v0 e1 e2)))))) f c3 c4 u1 u2 (refl_equal C (CHead c3 (Flat f) u1)) +(drop_refl (CHead c4 (Flat f) u2)) H8 H7)))))))))))))))) k)) y v c1 c2 H1))) +H) e (drop_gen_refl c1 e H0)))))))) (\lambda (n0: nat).(\lambda (IHn: +((\forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 n0 v c1 c2) \to +(\forall (e: C).((drop n0 O c1 e) \to (or4 (drop n0 O c2 e) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop n0 O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop n0 O c2 (CHead e2 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop n0 O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))))))))))).(\lambda (c1: C).(C_ind (\lambda +(c: C).(\forall (c2: C).(\forall (v: T).((csubst0 (S n0) v c c2) \to (\forall +(e: C).((drop (S n0) O c e) \to (or4 (drop (S n0) O c2 e) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 (Flat f) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) +u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))))))))))) (\lambda (n1: +nat).(\lambda (c2: C).(\lambda (v: T).(\lambda (_: (csubst0 (S n0) v (CSort +n1) c2)).(\lambda (e: C).(\lambda (H0: (drop (S n0) O (CSort n1) +e)).(and3_ind (eq C e (CSort n1)) (eq nat (S n0) O) (eq nat O O) (or4 (drop +(S n0) O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda +(w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) +O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +e (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 (Flat f) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))) (\lambda (H1: (eq C e (CSort n1))).(\lambda (H2: (eq nat (S n0) +O)).(\lambda (_: (eq nat O O)).(eq_ind_r C (CSort n1) (\lambda (c: C).(or4 +(drop (S n0) O c2 c) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C c (CHead e0 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda +(w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c (CHead e1 (Flat f) u)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) +O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +c (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 (Flat f) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))) (let H4 \def (eq_ind nat (S n0) (\lambda (ee: nat).(match ee in +nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H2) in (False_ind (or4 (drop (S n0) O c2 (CSort n1)) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C (CSort n1) (CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 (Flat f) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CSort n1) (CHead e1 (Flat f) +u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C (CSort n1) (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))) H4)) e H1)))) (drop_gen_sort n1 (S n0) O e H0)))))))) (\lambda (c: +C).(\lambda (H: ((\forall (c2: C).(\forall (v: T).((csubst0 (S n0) v c c2) +\to (\forall (e: C).((drop (S n0) O c e) \to (or4 (drop (S n0) O c2 e) (ex3_4 +F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq +C e (CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (S n0) O c2 (CHead e2 (Flat f) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) +u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2))))))))))))))).(\lambda (k: K).(\lambda +(t: T).(\lambda (c2: C).(\lambda (v: T).(\lambda (H0: (csubst0 (S n0) v +(CHead c k t) c2)).(\lambda (e: C).(\lambda (H1: (drop (S n0) O (CHead c k t) +e)).(let H2 \def (match H0 in csubst0 return (\lambda (n1: nat).(\lambda (t0: +T).(\lambda (c0: C).(\lambda (c3: C).(\lambda (_: (csubst0 n1 t0 c0 c3)).((eq +nat n1 (S n0)) \to ((eq T t0 v) \to ((eq C c0 (CHead c k t)) \to ((eq C c3 +c2) \to (or4 (drop (S n0) O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) +O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c2 (CHead +e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))))))))))) with [(csubst0_snd k0 i v0 u1 u2 H2 c0) \Rightarrow +(\lambda (H3: (eq nat (s k0 i) (S n0))).(\lambda (H4: (eq T v0 v)).(\lambda +(H5: (eq C (CHead c0 k0 u1) (CHead c k t))).(\lambda (H6: (eq C (CHead c0 k0 +u2) c2)).((let H7 \def (f_equal nat nat (\lambda (e0: nat).e0) (s k0 i) (S +n0) H3) in (eq_ind nat (s k0 i) (\lambda (n1: nat).((eq T v0 v) \to ((eq C +(CHead c0 k0 u1) (CHead c k t)) \to ((eq C (CHead c0 k0 u2) c2) \to ((subst0 +i v0 u1 u2) \to (or4 (drop n1 O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n1 O +c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop n1 O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop n1 O c2 (CHead e2 +(Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))))))) (\lambda (H8: (eq T v0 v)).(eq_ind T v (\lambda (t0: T).((eq +C (CHead c0 k0 u1) (CHead c k t)) \to ((eq C (CHead c0 k0 u2) c2) \to +((subst0 i t0 u1 u2) \to (or4 (drop (s k0 i) O c2 e) (ex3_4 F C T T (\lambda +(f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 +(Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (s k0 i) O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s k0 i) O c2 (CHead e2 (Flat f) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) +u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (s k0 i) O c2 (CHead e2 (Flat f) w))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))))))) (\lambda +(H9: (eq C (CHead c0 k0 u1) (CHead c k t))).(let H10 \def (f_equal C T +(\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u1 | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 k0 u1) (CHead c k +t) H9) in ((let H11 \def (f_equal C K (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | (CHead _ k1 _) +\Rightarrow k1])) (CHead c0 k0 u1) (CHead c k t) H9) in ((let H12 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c3 _ _) \Rightarrow c3])) (CHead c0 k0 u1) +(CHead c k t) H9) in (eq_ind C c (\lambda (c3: C).((eq K k0 k) \to ((eq T u1 +t) \to ((eq C (CHead c3 k0 u2) c2) \to ((subst0 i v u1 u2) \to (or4 (drop (s +k0 i) O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k0 i) O c2 +(CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s k0 i) O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k0 i) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))))))) (\lambda (H13: (eq K k0 k)).(eq_ind K +k (\lambda (k1: K).((eq T u1 t) \to ((eq C (CHead c k1 u2) c2) \to ((subst0 i +v u1 u2) \to (or4 (drop (s k1 i) O c2 e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s k1 i) O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (s k1 i) O c2 (CHead e2 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (s k1 i) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))))))) (\lambda (H14: (eq T u1 t)).(eq_ind T t +(\lambda (t0: T).((eq C (CHead c k u2) c2) \to ((subst0 i v t0 u2) \to (or4 +(drop (s k i) O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k +i) O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s k i) O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k i) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))))) (\lambda (H15: (eq C (CHead c k u2) +c2)).(eq_ind C (CHead c k u2) (\lambda (c3: C).((subst0 i v t u2) \to (or4 +(drop (s k i) O c3 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k +i) O c3 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s k i) O c3 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k i) O c3 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))))) (\lambda (H16: (subst0 i v t u2)).(let +H17 \def (eq_ind K k0 (\lambda (k1: K).(eq nat (s k1 i) (S n0))) H7 k H13) in +(K_ind (\lambda (k1: K).((drop (r k1 n0) O c e) \to ((eq nat (s k1 i) (S n0)) +\to (or4 (drop (s k1 i) O (CHead c k1 u2) e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s k1 i) O (CHead c k1 u2) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s k1 i) O (CHead c k1 u2) (CHead +e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s k1 i) O (CHead c k1 u2) (CHead e2 +(Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))))) (\lambda (b: B).(\lambda (H18: (drop (r (Bind b) n0) O c +e)).(\lambda (H19: (eq nat (s (Bind b) i) (S n0))).(let H20 \def (f_equal nat +nat (\lambda (e0: nat).(match e0 in nat return (\lambda (_: nat).nat) with [O +\Rightarrow i | (S n1) \Rightarrow n1])) (S i) (S n0) H19) in (let H21 \def +(eq_ind nat i (\lambda (n1: nat).(subst0 n1 v t u2)) H16 n0 H20) in (eq_ind_r +nat n0 (\lambda (n1: nat).(or4 (drop (s (Bind b) n1) O (CHead c (Bind b) u2) +e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n1) O (CHead c (Bind b) +u2) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s (Bind b) n1) O (CHead c (Bind b) u2) (CHead e2 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Bind b) n1) O (CHead c (Bind b) u2) (CHead e2 (Flat f) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))))) (or4_intro0 +(drop (s (Bind b) n0) O (CHead c (Bind b) u2) e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Bind b) n0) O (CHead c (Bind b) u2) (CHead e0 (Flat f) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u +w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Bind b) n0) O +(CHead c (Bind b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c (Bind b) u2) (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (drop_drop (Bind b) n0 c e H18 +u2)) i H20)))))) (\lambda (f: F).(\lambda (H18: (drop (r (Flat f) n0) O c +e)).(\lambda (H19: (eq nat (s (Flat f) i) (S n0))).(let H20 \def (f_equal nat +nat (\lambda (e0: nat).e0) i (S n0) H19) in (let H21 \def (eq_ind nat i +(\lambda (n1: nat).(subst0 n1 v t u2)) H16 (S n0) H20) in (eq_ind_r nat (S +n0) (\lambda (n1: nat).(or4 (drop (s (Flat f) n1) O (CHead c (Flat f) u2) e) +(ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) n1) O (CHead c (Flat f) +u2) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s (Flat f) n1) O (CHead c (Flat f) u2) (CHead e2 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) n1) O (CHead c (Flat f) u2) (CHead e2 (Flat f0) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))) (or4_intro0 (drop (s (Flat f) (S n0)) O (CHead c (Flat f) u2) e) +(ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c (Flat +f) u2) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s (Flat f) (S n0)) O (CHead c (Flat f) u2) (CHead e2 (Flat f0) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat +f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c (Flat f) u2) (CHead +e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (drop_drop (Flat f) n0 c e H18 u2)) i H20)))))) k +(drop_gen_drop k c e t n0 H1) H17))) c2 H15)) u1 (sym_eq T u1 t H14))) k0 +(sym_eq K k0 k H13))) c0 (sym_eq C c0 c H12))) H11)) H10))) v0 (sym_eq T v0 v +H8))) (S n0) H7)) H4 H5 H6 H2))))) | (csubst0_fst k0 i c0 c3 v0 H2 u) +\Rightarrow (\lambda (H3: (eq nat (s k0 i) (S n0))).(\lambda (H4: (eq T v0 +v)).(\lambda (H5: (eq C (CHead c0 k0 u) (CHead c k t))).(\lambda (H6: (eq C +(CHead c3 k0 u) c2)).((let H7 \def (f_equal nat nat (\lambda (e0: nat).e0) (s +k0 i) (S n0) H3) in (eq_ind nat (s k0 i) (\lambda (n1: nat).((eq T v0 v) \to +((eq C (CHead c0 k0 u) (CHead c k t)) \to ((eq C (CHead c3 k0 u) c2) \to +((csubst0 i v0 c0 c3) \to (or4 (drop n1 O c2 e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f) u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop n1 O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop n1 O c2 (CHead e2 (Flat f) u0)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u0))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop n1 +O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))))))) (\lambda (H8: (eq T v0 v)).(eq_ind T v (\lambda (t0: +T).((eq C (CHead c0 k0 u) (CHead c k t)) \to ((eq C (CHead c3 k0 u) c2) \to +((csubst0 i t0 c0 c3) \to (or4 (drop (s k0 i) O c2 e) (ex3_4 F C T T (\lambda +(f: F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 +(Flat f) u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (s k0 i) O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(eq C e (CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (s k0 i) O c2 (CHead e2 (Flat f) +u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat +f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (s k0 i) O c2 (CHead e2 (Flat f) w))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))))))) (\lambda +(H9: (eq C (CHead c0 k0 u) (CHead c k t))).(let H10 \def (f_equal C T +(\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 k0 u) (CHead c k +t) H9) in ((let H11 \def (f_equal C K (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | (CHead _ k1 _) +\Rightarrow k1])) (CHead c0 k0 u) (CHead c k t) H9) in ((let H12 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c4 _ _) \Rightarrow c4])) (CHead c0 k0 u) +(CHead c k t) H9) in (eq_ind C c (\lambda (c4: C).((eq K k0 k) \to ((eq T u +t) \to ((eq C (CHead c3 k0 u) c2) \to ((csubst0 i v c4 c3) \to (or4 (drop (s +k0 i) O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u0)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k0 i) O c2 +(CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 (Flat +f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop (s k0 i) O c2 (CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u0))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k0 i) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))))))) (\lambda (H13: (eq K k0 k)).(eq_ind K +k (\lambda (k1: K).((eq T u t) \to ((eq C (CHead c3 k1 u) c2) \to ((csubst0 i +v c c3) \to (or4 (drop (s k1 i) O c2 e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f) u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s k1 i) O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (s k1 i) O c2 (CHead e2 (Flat f) u0)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u0))))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (s k1 i) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 +w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))))))))) (\lambda (H14: (eq T u +t)).(eq_ind T t (\lambda (t0: T).((eq C (CHead c3 k t0) c2) \to ((csubst0 i v +c c3) \to (or4 (drop (s k i) O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k +i) O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 (Flat +f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop (s k i) O c2 (CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u0))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k i) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))))) (\lambda (H15: (eq C (CHead c3 k t) +c2)).(eq_ind C (CHead c3 k t) (\lambda (c4: C).((csubst0 i v c c3) \to (or4 +(drop (s k i) O c4 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k +i) O c4 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 (Flat +f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: +T).(drop (s k i) O c4 (CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u0))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k i) O c4 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))))) (\lambda (H16: (csubst0 i v c c3)).(let +H17 \def (eq_ind K k0 (\lambda (k1: K).(eq nat (s k1 i) (S n0))) H7 k H13) in +(K_ind (\lambda (k1: K).((drop (r k1 n0) O c e) \to ((eq nat (s k1 i) (S n0)) +\to (or4 (drop (s k1 i) O (CHead c3 k1 t) e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f) u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s k1 i) O (CHead c3 k1 t) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(eq C e (CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (s k1 i) O (CHead c3 k1 t) (CHead +e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s k1 i) O (CHead c3 k1 t) (CHead e2 +(Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))))) (\lambda (b: B).(\lambda (H18: (drop (r (Bind b) n0) O c +e)).(\lambda (H19: (eq nat (s (Bind b) i) (S n0))).(let H20 \def (f_equal nat +nat (\lambda (e0: nat).(match e0 in nat return (\lambda (_: nat).nat) with [O +\Rightarrow i | (S n1) \Rightarrow n1])) (S i) (S n0) H19) in (let H21 \def +(eq_ind nat i (\lambda (n1: nat).(csubst0 n1 v c c3)) H16 n0 H20) in +(eq_ind_r nat n0 (\lambda (n1: nat).(or4 (drop (s (Bind b) n1) O (CHead c3 +(Bind b) t) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u0)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n1) O +(CHead c3 (Bind b) t) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (s (Bind b) n1) O (CHead c3 (Bind b) t) (CHead e2 +(Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 +(Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop (s (Bind b) n1) O (CHead c3 (Bind b) t) (CHead +e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))) (let H22 \def (IHn c c3 v H21 e H18) in (or4_ind (drop n0 O c3 e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: +T).(eq C e (CHead e0 (Flat f) u0)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead e0 (Flat f) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v +u0 w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 (Flat f) u0)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop n0 O c3 (CHead e2 +(Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 +(Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop n0 O c3 (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O +v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (or4 (drop (s (Bind b) n0) O +(CHead c3 (Bind b) t) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(eq C e (CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (s (Bind b) n0) O (CHead c3 (Bind +b) t) (CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq +C e (CHead e1 (Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 +(Bind b) t) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (H23: (drop n0 O c3 +e)).(or4_intro0 (drop (s (Bind b) n0) O (CHead c3 (Bind b) t) e) (ex3_4 F C T +T (\lambda (f: F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e +(CHead e0 (Flat f) u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead e0 +(Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 (Flat f) u0)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u0))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O +v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (drop_drop (Bind b) n0 c3 e H23 +t))) (\lambda (H23: (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u0)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead e0 +(Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 O v u0 w))))))).(ex3_4_ind F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O +c3 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 O v u0 w))))) (or4 (drop (s (Bind b) n0) O (CHead +c3 (Bind b) t) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u0)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O +(CHead c3 (Bind b) t) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 +(Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 +(Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead +e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))) (\lambda (x0: F).(\lambda (x1: C).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (H24: (eq C e (CHead x1 (Flat x0) x2))).(\lambda (H25: (drop n0 O +c3 (CHead x1 (Flat x0) x3))).(\lambda (H26: (subst0 O v x2 x3)).(eq_ind_r C +(CHead x1 (Flat x0) x2) (\lambda (c4: C).(or4 (drop (s (Bind b) n0) O (CHead +c3 (Bind b) t) c4) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda +(u0: T).(\lambda (_: T).(eq C c4 (CHead e0 (Flat f) u0)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O +(CHead c3 (Bind b) t) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C c4 +(CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 +(Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e1 +(Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead +e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))) (or4_intro1 (drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead +x1 (Flat x0) x2)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda +(u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x2) (CHead e0 (Flat f) +u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead e0 (Flat f) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v +u0 w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C (CHead x1 (Flat x0) x2) (CHead e1 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 (Flat f) u0)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x2) (CHead e1 (Flat f) +u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 +(Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) +(ex3_4_intro F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x2) (CHead e0 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w))))) x0 +x1 x2 x3 (refl_equal C (CHead x1 (Flat x0) x2)) (drop_drop (Bind b) n0 c3 +(CHead x1 (Flat x0) x3) H25 t) H26)) e H24)))))))) H23)) (\lambda (H23: +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(eq C e (CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop n0 O c3 (CHead e2 (Flat f) +u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2))))))).(ex3_4_ind F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop n0 O +c3 (CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2))))) (or4 (drop (s (Bind b) n0) O +(CHead c3 (Bind b) t) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(eq C e (CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (s (Bind b) n0) O (CHead c3 (Bind +b) t) (CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq +C e (CHead e1 (Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 +(Bind b) t) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: F).(\lambda (x1: C).(\lambda +(x2: C).(\lambda (x3: T).(\lambda (H24: (eq C e (CHead x1 (Flat x0) +x3))).(\lambda (H25: (drop n0 O c3 (CHead x2 (Flat x0) x3))).(\lambda (H26: +(csubst0 O v x1 x2)).(eq_ind_r C (CHead x1 (Flat x0) x3) (\lambda (c4: +C).(or4 (drop (s (Bind b) n0) O (CHead c3 (Bind b) t) c4) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 +(CHead e0 (Flat f) u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead e0 +(Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C c4 (CHead e1 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 (Flat f) u0)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(eq C c4 (CHead e1 (Flat f) u0))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O +v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2))))))))) (or4_intro2 (drop (s (Bind b) +n0) O (CHead c3 (Bind b) t) (CHead x1 (Flat x0) x3)) (ex3_4 F C T T (\lambda +(f: F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 +(Flat x0) x3) (CHead e0 (Flat f) u0)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) +t) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 (Flat +x0) x3) (CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u0: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead +e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C +(CHead x1 (Flat x0) x3) (CHead e1 (Flat f) u0))))))) (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) +O (CHead c3 (Bind b) t) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 +w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (ex3_4_intro F C C T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 +(Flat x0) x3) (CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (s (Bind b) n0) O (CHead c3 (Bind +b) t) (CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2))))) x0 x1 x2 x3 (refl_equal C +(CHead x1 (Flat x0) x3)) (drop_drop (Bind b) n0 c3 (CHead x2 (Flat x0) x3) +H25 t) H26)) e H24)))))))) H23)) (\lambda (H23: (ex4_5 F C C T T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead e2 (Flat f) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))).(ex4_5_ind F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u0))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop n0 +O c3 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2)))))) (or4 (drop (s (Bind b) n0) O (CHead c3 (Bind b) t) e) (ex3_4 +F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq +C e (CHead e0 (Flat f) u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead e0 +(Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 (Flat f) u0)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u0))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O +v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: F).(\lambda (x1: +C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H24: (eq C e +(CHead x1 (Flat x0) x3))).(\lambda (H25: (drop n0 O c3 (CHead x2 (Flat x0) +x4))).(\lambda (H26: (subst0 O v x3 x4)).(\lambda (H27: (csubst0 O v x1 +x2)).(eq_ind_r C (CHead x1 (Flat x0) x3) (\lambda (c4: C).(or4 (drop (s (Bind +b) n0) O (CHead c3 (Bind b) t) c4) (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e0 (Flat f) u0)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) t) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(eq C c4 (CHead e1 (Flat f) u0)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(drop (s (Bind b) n0) O (CHead c3 (Bind +b) t) (CHead e2 (Flat f) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq +C c4 (CHead e1 (Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 +(Bind b) t) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro3 (drop (s (Bind b) n0) O (CHead +c3 (Bind b) t) (CHead x1 (Flat x0) x3)) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat +x0) x3) (CHead e0 (Flat f) u0)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead +e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda +(w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 (Flat x0) x3) (CHead e1 +(Flat f) u0)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u0: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) t) (CHead e2 (Flat f) +u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) +x3) (CHead e1 (Flat f) u0))))))) (\lambda (f: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 +(Bind b) t) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (ex4_5_intro F C C T T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C +(CHead x1 (Flat x0) x3) (CHead e1 (Flat f) u0))))))) (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) +O (CHead c3 (Bind b) t) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 +w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))) x0 x1 x2 x3 x4 (refl_equal C +(CHead x1 (Flat x0) x3)) (drop_drop (Bind b) n0 c3 (CHead x2 (Flat x0) x4) +H25 t) H26 H27)) e H24)))))))))) H23)) H22)) i H20)))))) (\lambda (f: +F).(\lambda (H18: (drop (r (Flat f) n0) O c e)).(\lambda (H19: (eq nat (s +(Flat f) i) (S n0))).(let H20 \def (f_equal nat nat (\lambda (e0: nat).e0) i +(S n0) H19) in (let H21 \def (eq_ind nat i (\lambda (n1: nat).(csubst0 n1 v c +c3)) H16 (S n0) H20) in (eq_ind_r nat (S n0) (\lambda (n1: nat).(or4 (drop (s +(Flat f) n1) O (CHead c3 (Flat f) t) e) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f0) u0)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Flat f) n1) O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v +u0 w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s (Flat f) n1) O +(CHead c3 (Flat f) t) (CHead e2 (Flat f0) u0)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u0))))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) n1) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) w))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))))) (let H22 \def +(H c3 v H21 e H18) in (or4_ind (drop (S n0) O c3 e) (ex3_4 F C T T (\lambda +(f0: F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 +(Flat f0) u0)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (S n0) O c3 (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 (Flat f0) u0)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O c3 (CHead e2 (Flat f0) u0)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u0))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop (S n0) O c3 (CHead e2 (Flat f0) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O +v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (or4 (drop (s (Flat f) (S n0)) O +(CHead c3 (Flat f) t) e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u0)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) w)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 +w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s (Flat f) (S +n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) u0)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u0))))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (H23: +(drop (S n0) O c3 e)).(or4_intro0 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat +f) t) e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) +O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 (Flat f0) u0)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead +e2 (Flat f0) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f0) u0))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) t) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (drop_drop (Flat f) n0 c3 e H23 t))) +(\lambda (H23: (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead +e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 O v u0 w))))))).(ex3_4_ind F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f0) u0)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (S n0) O c3 (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w))))) (or4 (drop (s (Flat +f) (S n0)) O (CHead c3 (Flat f) t) e) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f0) u0)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C e (CHead e1 (Flat f0) u0)))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) u0)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u0))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))) (\lambda (x0: F).(\lambda (x1: C).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (H24: (eq C e (CHead x1 (Flat x0) x2))).(\lambda (H25: (drop (S +n0) O c3 (CHead x1 (Flat x0) x3))).(\lambda (H26: (subst0 O v x2 +x3)).(eq_ind_r C (CHead x1 (Flat x0) x2) (\lambda (c4: C).(or4 (drop (s (Flat +f) (S n0)) O (CHead c3 (Flat f) t) c4) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e0 (Flat +f0) u0)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C c4 (CHead e1 (Flat f0) u0)))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) u0)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e1 (Flat f0) u0))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))) (or4_intro1 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) +(CHead x1 (Flat x0) x2)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x2) (CHead e0 +(Flat f0) u0)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 (Flat x0) x2) (CHead e1 +(Flat f0) u0)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u0: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) +u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) +x2) (CHead e1 (Flat f0) u0))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) t) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (ex3_4_intro F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat +x0) x2) (CHead e0 (Flat f0) u0)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) t) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w))))) x0 x1 x2 x3 +(refl_equal C (CHead x1 (Flat x0) x2)) (drop_drop (Flat f) n0 c3 (CHead x1 +(Flat x0) x3) H25 t) H26)) e H24)))))))) H23)) (\lambda (H23: (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 (Flat f0) u0)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (S n0) O c3 (CHead e2 (Flat f0) u0)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2))))))).(ex3_4_ind F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (S n0) O c3 (CHead +e2 (Flat f0) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2))))) (or4 (drop (s (Flat f) (S n0)) O +(CHead c3 (Flat f) t) e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u0)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) w)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 +w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(eq C e (CHead e1 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s (Flat f) (S +n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) u0)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u0))))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: +F).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H24: (eq C e +(CHead x1 (Flat x0) x3))).(\lambda (H25: (drop (S n0) O c3 (CHead x2 (Flat +x0) x3))).(\lambda (H26: (csubst0 O v x1 x2)).(eq_ind_r C (CHead x1 (Flat x0) +x3) (\lambda (c4: C).(or4 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) +c4) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C c4 (CHead e0 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) +O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C c4 +(CHead e1 (Flat f0) u0)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead +e2 (Flat f0) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 +(CHead e1 (Flat f0) u0))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) t) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro2 (drop (s (Flat f) (S n0)) O +(CHead c3 (Flat f) t) (CHead x1 (Flat x0) x3)) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat +x0) x3) (CHead e0 (Flat f0) u0)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) t) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C +(CHead x1 (Flat x0) x3) (CHead e1 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s (Flat f) (S +n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) u0)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x3) (CHead e1 (Flat f0) +u0))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead +e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (ex3_4_intro F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 (Flat x0) x3) (CHead e1 +(Flat f0) u0)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u0: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) +u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2))))) x0 x1 x2 x3 (refl_equal C (CHead x1 (Flat x0) x3)) +(drop_drop (Flat f) n0 c3 (CHead x2 (Flat x0) x3) H25 t) H26)) e H24)))))))) +H23)) (\lambda (H23: (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e (CHead e1 (Flat +f0) u0))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (S n0) O c3 (CHead e2 (Flat f0) w))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))).(ex4_5_ind F C +C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u0))))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S +n0) O c3 (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (or4 (drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) t) e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u0: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u0)))))) (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) +O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(eq C e +(CHead e1 (Flat f0) u0)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u0: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead +e2 (Flat f0) u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f0) u0))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) t) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: F).(\lambda (x1: C).(\lambda +(x2: C).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H24: (eq C e (CHead x1 +(Flat x0) x3))).(\lambda (H25: (drop (S n0) O c3 (CHead x2 (Flat x0) +x4))).(\lambda (H26: (subst0 O v x3 x4)).(\lambda (H27: (csubst0 O v x1 +x2)).(eq_ind_r C (CHead x1 (Flat x0) x3) (\lambda (c4: C).(or4 (drop (s (Flat +f) (S n0)) O (CHead c3 (Flat f) t) c4) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e0 (Flat +f0) u0)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C c4 (CHead e1 (Flat f0) u0)))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) u0)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(eq C c4 (CHead e1 (Flat f0) u0))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: +T).(\lambda (w: T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))) (or4_intro3 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) +(CHead x1 (Flat x0) x3)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x3) (CHead e0 +(Flat f0) u0)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e0 (Flat f0) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(eq C (CHead x1 (Flat x0) x3) (CHead e1 +(Flat f0) u0)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u0: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) +u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) +x3) (CHead e1 (Flat f0) u0))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) t) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: T).(subst0 O v u0 w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (ex4_5_intro F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(eq C +(CHead x1 (Flat x0) x3) (CHead e1 (Flat f0) u0))))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) t) (CHead e2 (Flat f0) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u0: T).(\lambda (w: +T).(subst0 O v u0 w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))) x0 x1 x2 x3 x4 +(refl_equal C (CHead x1 (Flat x0) x3)) (drop_drop (Flat f) n0 c3 (CHead x2 +(Flat x0) x4) H25 t) H26 H27)) e H24)))))))))) H23)) H22)) i H20)))))) k +(drop_gen_drop k c e t n0 H1) H17))) c2 H15)) u (sym_eq T u t H14))) k0 +(sym_eq K k0 k H13))) c0 (sym_eq C c0 c H12))) H11)) H10))) v0 (sym_eq T v0 v +H8))) (S n0) H7)) H4 H5 H6 H2))))) | (csubst0_both k0 i v0 u1 u2 H2 c0 c3 H3) +\Rightarrow (\lambda (H4: (eq nat (s k0 i) (S n0))).(\lambda (H5: (eq T v0 +v)).(\lambda (H6: (eq C (CHead c0 k0 u1) (CHead c k t))).(\lambda (H7: (eq C +(CHead c3 k0 u2) c2)).((let H8 \def (f_equal nat nat (\lambda (e0: nat).e0) +(s k0 i) (S n0) H4) in (eq_ind nat (s k0 i) (\lambda (n1: nat).((eq T v0 v) +\to ((eq C (CHead c0 k0 u1) (CHead c k t)) \to ((eq C (CHead c3 k0 u2) c2) +\to ((subst0 i v0 u1 u2) \to ((csubst0 i v0 c0 c3) \to (or4 (drop n1 O c2 e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop n1 O c2 (CHead e0 (Flat f) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u +w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop n1 O c2 (CHead e2 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 +(Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop n1 O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))))))))))) (\lambda (H9: (eq T v0 +v)).(eq_ind T v (\lambda (t0: T).((eq C (CHead c0 k0 u1) (CHead c k t)) \to +((eq C (CHead c3 k0 u2) c2) \to ((subst0 i t0 u1 u2) \to ((csubst0 i t0 c0 +c3) \to (or4 (drop (s k0 i) O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k0 +i) O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s k0 i) O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k0 i) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))))))) (\lambda (H10: (eq C (CHead c0 k0 u1) +(CHead c k t))).(let H11 \def (f_equal C T (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).T) with [(CSort _) \Rightarrow u1 | (CHead _ _ t0) +\Rightarrow t0])) (CHead c0 k0 u1) (CHead c k t) H10) in ((let H12 \def +(f_equal C K (\lambda (e0: C).(match e0 in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow k0 | (CHead _ k1 _) \Rightarrow k1])) (CHead c0 k0 u1) +(CHead c k t) H10) in ((let H13 \def (f_equal C C (\lambda (e0: C).(match e0 +in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c4 _ +_) \Rightarrow c4])) (CHead c0 k0 u1) (CHead c k t) H10) in (eq_ind C c +(\lambda (c4: C).((eq K k0 k) \to ((eq T u1 t) \to ((eq C (CHead c3 k0 u2) +c2) \to ((subst0 i v u1 u2) \to ((csubst0 i v c4 c3) \to (or4 (drop (s k0 i) +O c2 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k0 i) O c2 +(CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s k0 i) O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k0 i) O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))))))))) (\lambda (H14: (eq K k0 k)).(eq_ind K +k (\lambda (k1: K).((eq T u1 t) \to ((eq C (CHead c3 k1 u2) c2) \to ((subst0 +i v u1 u2) \to ((csubst0 i v c c3) \to (or4 (drop (s k1 i) O c2 e) (ex3_4 F C +T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (s k1 i) O c2 (CHead e0 (Flat f) w)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s k1 i) O c2 (CHead e2 (Flat f) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) +u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (s k1 i) O c2 (CHead e2 (Flat f) w))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))))))))) (\lambda +(H15: (eq T u1 t)).(eq_ind T t (\lambda (t0: T).((eq C (CHead c3 k u2) c2) +\to ((subst0 i v t0 u2) \to ((csubst0 i v c c3) \to (or4 (drop (s k i) O c2 +e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s k i) O c2 (CHead e0 (Flat f) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (s k +i) O c2 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +e (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s k i) O c2 (CHead e2 (Flat f) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))))))) (\lambda (H16: (eq C (CHead c3 k u2) c2)).(eq_ind C (CHead c3 +k u2) (\lambda (c4: C).((subst0 i v t u2) \to ((csubst0 i v c c3) \to (or4 +(drop (s k i) O c4 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k +i) O c4 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s k i) O c4 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k i) O c4 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))))) (\lambda (H17: (subst0 i v t +u2)).(\lambda (H18: (csubst0 i v c c3)).(let H19 \def (eq_ind K k0 (\lambda +(k1: K).(eq nat (s k1 i) (S n0))) H8 k H14) in (K_ind (\lambda (k1: K).((drop +(r k1 n0) O c e) \to ((eq nat (s k1 i) (S n0)) \to (or4 (drop (s k1 i) O +(CHead c3 k1 u2) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s k1 i) O (CHead +c3 k1 u2) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s k1 i) O (CHead c3 k1 u2) (CHead e2 (Flat f) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +k1 i) O (CHead c3 k1 u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))))) (\lambda (b: B).(\lambda (H20: (drop (r +(Bind b) n0) O c e)).(\lambda (H21: (eq nat (s (Bind b) i) (S n0))).(let H22 +\def (f_equal nat nat (\lambda (e0: nat).(match e0 in nat return (\lambda (_: +nat).nat) with [O \Rightarrow i | (S n1) \Rightarrow n1])) (S i) (S n0) H21) +in (let H23 \def (eq_ind nat i (\lambda (n1: nat).(csubst0 n1 v c c3)) H18 n0 +H22) in (let H24 \def (eq_ind nat i (\lambda (n1: nat).(subst0 n1 v t u2)) +H17 n0 H22) in (eq_ind_r nat n0 (\lambda (n1: nat).(or4 (drop (s (Bind b) n1) +O (CHead c3 (Bind b) u2) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n1) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Bind b) n1) O (CHead c3 (Bind +b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +e (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n1) O (CHead c3 (Bind b) +u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))) (let H25 \def (IHn c c3 v H23 e H20) in (or4_ind (drop n0 +O c3 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead e0 +(Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop n0 O +c3 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead e2 (Flat f) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (or4 (drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u +w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Bind b) n0) O +(CHead c3 (Bind b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) w))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (H26: +(drop n0 O c3 e)).(or4_intro0 (drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) +e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C e (CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) +u2) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (drop_drop (Bind +b) n0 c3 e H26 u2))) (\lambda (H26: (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop n0 O +c3 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w))))))).(ex3_4_ind F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop n0 O c3 (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w))))) (or4 (drop (s (Bind +b) n0) O (CHead c3 (Bind b) u2) e) (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Bind b) n0) O (CHead c3 (Bind +b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +e (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) +u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2)))))))) (\lambda (x0: F).(\lambda (x1: C).(\lambda (x2: T).(\lambda +(x3: T).(\lambda (H27: (eq C e (CHead x1 (Flat x0) x2))).(\lambda (H28: (drop +n0 O c3 (CHead x1 (Flat x0) x3))).(\lambda (H29: (subst0 O v x2 +x3)).(eq_ind_r C (CHead x1 (Flat x0) x2) (\lambda (c4: C).(or4 (drop (s (Bind +b) n0) O (CHead c3 (Bind b) u2) c4) (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c4 (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Bind b) n0) O (CHead c3 (Bind +b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +c4 (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) +u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))) (or4_intro1 (drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) +(CHead x1 (Flat x0) x2)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x2) (CHead e0 +(Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 (Flat x0) x2) (CHead e1 +(Flat f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) +x2) (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) +u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (ex3_4_intro F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x2) (CHead e0 +(Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w))))) x0 x1 x2 x3 (refl_equal C (CHead x1 (Flat x0) x2)) +(drop_drop (Bind b) n0 c3 (CHead x1 (Flat x0) x3) H28 u2) H29)) e H27)))))))) +H26)) (\lambda (H26: (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop n0 O c3 (CHead e2 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2))))))).(ex3_4_ind F C C T (\lambda (f: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop n0 O +c3 (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2))))) (or4 (drop (s (Bind b) n0) O +(CHead c3 (Bind b) u2) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Bind b) n0) O (CHead c3 (Bind +b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +e (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) +u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2)))))))) (\lambda (x0: F).(\lambda (x1: C).(\lambda (x2: C).(\lambda +(x3: T).(\lambda (H27: (eq C e (CHead x1 (Flat x0) x3))).(\lambda (H28: (drop +n0 O c3 (CHead x2 (Flat x0) x3))).(\lambda (H29: (csubst0 O v x1 +x2)).(eq_ind_r C (CHead x1 (Flat x0) x3) (\lambda (c4: C).(or4 (drop (s (Bind +b) n0) O (CHead c3 (Bind b) u2) c4) (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e0 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C c4 (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Bind b) n0) O (CHead c3 (Bind +b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +c4 (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) +u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))) (or4_intro2 (drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) +(CHead x1 (Flat x0) x3)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x3) (CHead e0 +(Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 (Flat x0) x3) (CHead e1 +(Flat f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) +x3) (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) +u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (ex3_4_intro F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 (Flat x0) x3) (CHead e1 +(Flat f) u)))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2))))) x0 x1 x2 x3 (refl_equal C (CHead x1 (Flat x0) x3)) +(drop_drop (Bind b) n0 c3 (CHead x2 (Flat x0) x3) H28 u2) H29)) e H27)))))))) +H26)) (\lambda (H26: (ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) +u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop n0 O c3 (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))))).(ex4_5_ind F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +e (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop n0 O c3 (CHead e2 (Flat f) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))) (or4 (drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 (Flat f) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u +w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Flat f) u)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Bind b) n0) O +(CHead c3 (Bind b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) w))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: +F).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (H27: (eq C e (CHead x1 (Flat x0) x3))).(\lambda (H28: (drop n0 O +c3 (CHead x2 (Flat x0) x4))).(\lambda (H29: (subst0 O v x3 x4)).(\lambda +(H30: (csubst0 O v x1 x2)).(eq_ind_r C (CHead x1 (Flat x0) x3) (\lambda (c4: +C).(or4 (drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) c4) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 +(CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e0 +(Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c4 (CHead e1 (Flat f) u)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C c4 (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Bind b) n0) O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) w))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))))) (or4_intro3 +(drop (s (Bind b) n0) O (CHead c3 (Bind b) u2) (CHead x1 (Flat x0) x3)) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C (CHead x1 (Flat x0) x3) (CHead e0 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) O +(CHead c3 (Bind b) u2) (CHead e0 (Flat f) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead +x1 (Flat x0) x3) (CHead e1 (Flat f) u)))))) (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Bind b) n0) O (CHead c3 (Bind +b) u2) (CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +(CHead x1 (Flat x0) x3) (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) +O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (ex4_5_intro F C C T T (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +(CHead x1 (Flat x0) x3) (CHead e1 (Flat f) u))))))) (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Bind b) n0) +O (CHead c3 (Bind b) u2) (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))) x0 x1 x2 x3 x4 (refl_equal C (CHead x1 (Flat +x0) x3)) (drop_drop (Bind b) n0 c3 (CHead x2 (Flat x0) x4) H28 u2) H29 H30)) +e H27)))))))))) H26)) H25)) i H22))))))) (\lambda (f: F).(\lambda (H20: (drop +(r (Flat f) n0) O c e)).(\lambda (H21: (eq nat (s (Flat f) i) (S n0))).(let +H22 \def (f_equal nat nat (\lambda (e0: nat).e0) i (S n0) H21) in (let H23 +\def (eq_ind nat i (\lambda (n1: nat).(csubst0 n1 v c c3)) H18 (S n0) H22) in +(let H24 \def (eq_ind nat i (\lambda (n1: nat).(subst0 n1 v t u2)) H17 (S n0) +H22) in (eq_ind_r nat (S n0) (\lambda (n1: nat).(or4 (drop (s (Flat f) n1) O +(CHead c3 (Flat f) u2) e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) n1) O (CHead c3 (Flat f) u2) (CHead e0 (Flat f0) w)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C e (CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Flat f) n1) O (CHead c3 (Flat +f) u2) (CHead e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq +C e (CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) n1) O (CHead c3 +(Flat f) u2) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (let H25 \def (H c3 v H23 e H20) in +(or4_ind (drop (S n0) O c3 e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S +n0) O c3 (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O c3 (CHead e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u))))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (S +n0) O c3 (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (or4 (drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) u2) e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) +O (CHead c3 (Flat f) u2) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead +e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) u2) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (H26: (drop (S n0) O c3 +e)).(or4_intro0 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) e) (ex3_4 +F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq +C e (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) +(CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat +f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead +e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (drop_drop (Flat f) n0 c3 e H26 u2))) (\lambda (H26: (ex3_4 +F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq +C e (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e0 (Flat f0) w)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u +w))))))).(ex3_4_ind F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead +e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda +(w: T).(subst0 O v u w))))) (or4 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat +f) u2) e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) +O (CHead c3 (Flat f) u2) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead +e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) u2) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: F).(\lambda (x1: C).(\lambda +(x2: T).(\lambda (x3: T).(\lambda (H27: (eq C e (CHead x1 (Flat x0) +x2))).(\lambda (H28: (drop (S n0) O c3 (CHead x1 (Flat x0) x3))).(\lambda +(H29: (subst0 O v x2 x3)).(eq_ind_r C (CHead x1 (Flat x0) x2) (\lambda (c4: +C).(or4 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) c4) (ex3_4 F C T T +(\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 +(CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead +e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda +(w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c4 (CHead e1 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e1 (Flat f0) u))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))) (or4_intro1 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) +(CHead x1 (Flat x0) x2)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x2) (CHead e0 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e0 (Flat f0) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 (Flat x0) x2) (CHead e1 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) +x2) (CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) u2) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (ex3_4_intro F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) +x2) (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) +(CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w))))) x0 x1 x2 x3 (refl_equal C (CHead x1 +(Flat x0) x2)) (drop_drop (Flat f) n0 c3 (CHead x1 (Flat x0) x3) H28 u2) +H29)) e H27)))))))) H26)) (\lambda (H26: (ex3_4 F C C T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop (S n0) O c3 (CHead e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2))))))).(ex3_4_ind +F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C e (CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (S n0) O c3 (CHead e2 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2))))) (or4 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) e) +(ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) u2) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead +e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) u2) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: F).(\lambda (x1: C).(\lambda +(x2: C).(\lambda (x3: T).(\lambda (H27: (eq C e (CHead x1 (Flat x0) +x3))).(\lambda (H28: (drop (S n0) O c3 (CHead x2 (Flat x0) x3))).(\lambda +(H29: (csubst0 O v x1 x2)).(eq_ind_r C (CHead x1 (Flat x0) x3) (\lambda (c4: +C).(or4 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) c4) (ex3_4 F C T T +(\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 +(CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead +e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda +(w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c4 (CHead e1 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c4 (CHead e1 (Flat f0) u))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))) (or4_intro2 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) +(CHead x1 (Flat x0) x3)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x3) (CHead e0 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e0 (Flat f0) +w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 (Flat x0) x3) (CHead e1 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) +x3) (CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) u2) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (ex3_4_intro F C C T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 (Flat x0) +x3) (CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) +(CHead e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2))))) x0 x1 x2 x3 (refl_equal C (CHead +x1 (Flat x0) x3)) (drop_drop (Flat f) n0 c3 (CHead x2 (Flat x0) x3) H28 u2) +H29)) e H27)))))))) H26)) (\lambda (H26: (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (S n0) O c3 (CHead e2 (Flat f0) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))).(ex4_5_ind F C C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop (S n0) O c3 (CHead e2 (Flat f0) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))) (or4 (drop (s (Flat f) (S n0)) O +(CHead c3 (Flat f) u2) e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e0 (Flat f0) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u +w)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop (s (Flat f) (S n0)) +O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e1 (Flat f0) u))))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: +F).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (H27: (eq C e (CHead x1 (Flat x0) x3))).(\lambda (H28: (drop (S +n0) O c3 (CHead x2 (Flat x0) x4))).(\lambda (H29: (subst0 O v x3 +x4)).(\lambda (H30: (csubst0 O v x1 x2)).(eq_ind_r C (CHead x1 (Flat x0) x3) +(\lambda (c4: C).(or4 (drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) c4) +(ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C c4 (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) u2) (CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c4 +(CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead +e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C c4 +(CHead e1 (Flat f0) u))))))) (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 +(Flat f) u2) (CHead e2 (Flat f0) w))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro3 (drop (s (Flat f) (S n0)) O +(CHead c3 (Flat f) u2) (CHead x1 (Flat x0) x3)) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) +x3) (CHead e0 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda +(_: T).(\lambda (w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) +(CHead e0 (Flat f0) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 (Flat x0) +x3) (CHead e1 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) +(CHead e2 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +(CHead x1 (Flat x0) x3) (CHead e1 (Flat f0) u))))))) (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop (s +(Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) w))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (ex4_5_intro F C +C T T (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C (CHead x1 (Flat x0) x3) (CHead e1 (Flat f0) u))))))) +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(drop (s (Flat f) (S n0)) O (CHead c3 (Flat f) u2) (CHead e2 (Flat f0) +w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))) +x0 x1 x2 x3 x4 (refl_equal C (CHead x1 (Flat x0) x3)) (drop_drop (Flat f) n0 +c3 (CHead x2 (Flat x0) x4) H28 u2) H29 H30)) e H27)))))))))) H26)) H25)) i +H22))))))) k (drop_gen_drop k c e t n0 H1) H19)))) c2 H16)) u1 (sym_eq T u1 t +H15))) k0 (sym_eq K k0 k H14))) c0 (sym_eq C c0 c H13))) H12)) H11))) v0 +(sym_eq T v0 v H9))) (S n0) H8)) H5 H6 H7 H2 H3)))))]) in (H2 (refl_equal nat +(S n0)) (refl_equal T v) (refl_equal C (CHead c k t)) (refl_equal C +c2)))))))))))) c1)))) n). + +theorem csubst0_drop_eq_back: + \forall (n: nat).(\forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 +n v c1 c2) \to (\forall (e: C).((drop n O c2 e) \to (or4 (drop n O c1 e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop n O c1 (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop n O c1 (CHead e1 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat +f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop n O c1 (CHead e1 (Flat f) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))))))))) +\def + \lambda (n: nat).(nat_ind (\lambda (n0: nat).(\forall (c1: C).(\forall (c2: +C).(\forall (v: T).((csubst0 n0 v c1 c2) \to (\forall (e: C).((drop n0 O c2 +e) \to (or4 (drop n0 O c1 e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop n0 O +c1 (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop n0 O c1 (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop n0 O c1 (CHead e1 +(Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))))))))) (\lambda (c1: C).(\lambda (c2: C).(\lambda (v: T).(\lambda +(H: (csubst0 O v c1 c2)).(\lambda (e: C).(\lambda (H0: (drop O O c2 +e)).(eq_ind C c2 (\lambda (c: C).(or4 (drop O O c1 c) (ex3_4 F C T T (\lambda +(f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c (CHead e0 +(Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda +(_: T).(drop O O c1 (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C c +(CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(drop O O c1 (CHead e1 (Flat f) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C c (CHead e2 (Flat f) u2))))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop O +O c1 (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))) (insert_eq nat O (\lambda (n0: nat).(csubst0 n0 v c1 c2)) +(or4 (drop O O c1 c2) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C c2 (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop O O +c1 (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C c2 (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop O O c1 (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c2 (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop O O c1 (CHead e1 +(Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))) (\lambda (y: nat).(\lambda (H1: (csubst0 y v c1 c2)).(csubst0_ind +(\lambda (n0: nat).(\lambda (t: T).(\lambda (c: C).(\lambda (c0: C).((eq nat +n0 O) \to (or4 (drop O O c c0) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop O O c +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O t u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop O O c (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O t e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c0 (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop O O c (CHead e1 +(Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O t u1 u2)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O t e1 +e2))))))))))))) (\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: +nat).(\forall (v0: T).(\forall (u1: T).(\forall (u2: T).((subst0 i v0 u1 u2) +\to (\forall (c: C).((eq nat (s k0 i) O) \to (or4 (drop O O (CHead c k0 u1) +(CHead c k0 u2)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u4: T).(eq C (CHead c k0 u2) (CHead e0 (Flat f) u4)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u3: T).(\lambda (_: T).(drop O O +(CHead c k0 u1) (CHead e0 (Flat f) u3)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead +c k0 u2) (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(drop O O (CHead c k0 u1) (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u4: T).(eq C (CHead c k0 u2) (CHead e2 (Flat f) +u4))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u3: +T).(\lambda (_: T).(drop O O (CHead c k0 u1) (CHead e1 (Flat f) u3))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u3: T).(\lambda +(u4: T).(subst0 O v0 u3 u4)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 e2)))))))))))))))) +(\lambda (b: B).(\lambda (i: nat).(\lambda (v0: T).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (_: (subst0 i v0 u1 u2)).(\lambda (c: C).(\lambda (H3: (eq +nat (S i) O)).(let H4 \def (eq_ind nat (S i) (\lambda (ee: nat).(match ee in +nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H3) in (False_ind (or4 (drop O O (CHead c (Bind b) +u1) (CHead c (Bind b) u2)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u4: T).(eq C (CHead c (Bind b) u2) (CHead e0 +(Flat f) u4)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u3: T).(\lambda +(_: T).(drop O O (CHead c (Bind b) u1) (CHead e0 (Flat f) u3)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 +u4)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead c (Bind b) u2) (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop O O +(CHead c (Bind b) u1) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u4: T).(eq C (CHead c (Bind b) u2) (CHead e2 (Flat f) u4))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u3: T).(\lambda +(_: T).(drop O O (CHead c (Bind b) u1) (CHead e1 (Flat f) u3))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: +T).(subst0 O v0 u3 u4)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 e2)))))))) H4)))))))))) +(\lambda (f: F).(\lambda (i: nat).(\lambda (v0: T).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (H2: (subst0 i v0 u1 u2)).(\lambda (c: C).(\lambda (H3: (eq +nat i O)).(let H4 \def (eq_ind nat i (\lambda (n0: nat).(subst0 n0 v0 u1 u2)) +H2 O H3) in (or4_intro1 (drop O O (CHead c (Flat f) u1) (CHead c (Flat f) +u2)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u4: T).(eq C (CHead c (Flat f) u2) (CHead e0 (Flat f0) u4)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (u3: T).(\lambda (_: T).(drop O O +(CHead c (Flat f) u1) (CHead e0 (Flat f0) u3)))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) (ex3_4 F C +C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C +(CHead c (Flat f) u2) (CHead e2 (Flat f0) u)))))) (\lambda (f0: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(drop O O (CHead c (Flat f) u1) +(CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u4: T).(eq C +(CHead c (Flat f) u2) (CHead e2 (Flat f0) u4))))))) (\lambda (f0: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u3: T).(\lambda (_: T).(drop O O (CHead c +(Flat f) u1) (CHead e1 (Flat f0) u3))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v0 e1 e2))))))) (ex3_4_intro F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u4: T).(eq C (CHead c (Flat f) +u2) (CHead e0 (Flat f0) u4)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda +(u3: T).(\lambda (_: T).(drop O O (CHead c (Flat f) u1) (CHead e0 (Flat f0) +u3)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: +T).(subst0 O v0 u3 u4))))) f c u1 u2 (refl_equal C (CHead c (Flat f) u2)) +(drop_refl (CHead c (Flat f) u1)) H4))))))))))) k)) (\lambda (k: K).(K_ind +(\lambda (k0: K).(\forall (i: nat).(\forall (c3: C).(\forall (c4: C).(\forall +(v0: T).((csubst0 i v0 c3 c4) \to ((((eq nat i O) \to (or4 (drop O O c3 c4) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C c4 (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop O O c3 (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O +v0 u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C c4 (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop O O c3 (CHead e1 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C c4 (CHead e2 +(Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(drop O O c3 (CHead e1 (Flat f) u1))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v0 u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 e2)))))))))) \to (\forall +(u: T).((eq nat (s k0 i) O) \to (or4 (drop O O (CHead c3 k0 u) (CHead c4 k0 +u)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(u2: T).(eq C (CHead c4 k0 u) (CHead e0 (Flat f) u2)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop O O (CHead c3 k0 +u) (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v0 u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(eq C (CHead c4 k0 u) +(CHead e2 (Flat f) u0)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(drop O O (CHead c3 k0 u) (CHead e1 (Flat f) u0)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead c4 k0 u) (CHead e2 (Flat f) +u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop O O (CHead c3 k0 u) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v0 u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 e2))))))))))))))))) +(\lambda (b: B).(\lambda (i: nat).(\lambda (c3: C).(\lambda (c4: C).(\lambda +(v0: T).(\lambda (_: (csubst0 i v0 c3 c4)).(\lambda (_: (((eq nat i O) \to +(or4 (drop O O c3 c4) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C c4 (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop O O +c3 (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v0 u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C c4 (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop O O c3 (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T +T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c4 (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop O O c3 (CHead e1 +(Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v0 u1 u2)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 +e2))))))))))).(\lambda (u: T).(\lambda (H4: (eq nat (S i) O)).(let H5 \def +(eq_ind nat (S i) (\lambda (ee: nat).(match ee in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H4) in +(False_ind (or4 (drop O O (CHead c3 (Bind b) u) (CHead c4 (Bind b) u)) (ex3_4 +F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq +C (CHead c4 (Bind b) u) (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(drop O O (CHead c3 (Bind b) u) +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v0 u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(eq C (CHead c4 (Bind b) +u) (CHead e2 (Flat f) u0)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(drop O O (CHead c3 (Bind b) u) (CHead e1 (Flat f) +u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead c4 (Bind b) +u) (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop O O (CHead c3 (Bind b) u) (CHead e1 +(Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v0 u1 u2)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))))) H5))))))))))) (\lambda (f: F).(\lambda (i: nat).(\lambda (c3: +C).(\lambda (c4: C).(\lambda (v0: T).(\lambda (H2: (csubst0 i v0 c3 +c4)).(\lambda (H3: (((eq nat i O) \to (or4 (drop O O c3 c4) (ex3_4 F C T T +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c4 +(CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop O O c3 (CHead e0 (Flat f0) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v0 u1 u2)))))) +(ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C c4 (CHead e2 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop O O c3 (CHead e1 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C c4 (CHead e2 (Flat f0) +u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop O O c3 (CHead e1 (Flat f0) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v0 u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v0 e1 e2))))))))))).(\lambda (u: +T).(\lambda (H4: (eq nat i O)).(let H5 \def (eq_ind nat i (\lambda (n0: +nat).((eq nat n0 O) \to (or4 (drop O O c3 c4) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c4 (CHead e0 (Flat +f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop O O c3 (CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v0 u1 u2)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(eq C c4 +(CHead e2 (Flat f0) u0)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u0: T).(drop O O c3 (CHead e1 (Flat f0) u0)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C c4 (CHead e2 (Flat f0) u2))))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop O O c3 (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v0 u1 +u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v0 e1 e2)))))))))) H3 O H4) in (let H6 \def +(eq_ind nat i (\lambda (n0: nat).(csubst0 n0 v0 c3 c4)) H2 O H4) in +(or4_intro2 (drop O O (CHead c3 (Flat f) u) (CHead c4 (Flat f) u)) (ex3_4 F C +T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C +(CHead c4 (Flat f) u) (CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(drop O O (CHead c3 (Flat f) u) +(CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v0 u1 u2)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u0: T).(eq C (CHead c4 (Flat f) +u) (CHead e2 (Flat f0) u0)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u0: T).(drop O O (CHead c3 (Flat f) u) (CHead e1 (Flat f0) +u0)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead c4 (Flat f) +u) (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u1: T).(\lambda (_: T).(drop O O (CHead c3 (Flat f) u) +(CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v0 u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v0 e1 e2))))))) (ex3_4_intro F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u0: T).(eq C (CHead c4 (Flat f) u) (CHead e2 +(Flat f0) u0)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u0: T).(drop O O (CHead c3 (Flat f) u) (CHead e1 (Flat f0) u0)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 +e2))))) f c3 c4 u (refl_equal C (CHead c4 (Flat f) u)) (drop_refl (CHead c3 +(Flat f) u)) H6))))))))))))) k)) (\lambda (k: K).(K_ind (\lambda (k0: +K).(\forall (i: nat).(\forall (v0: T).(\forall (u1: T).(\forall (u2: +T).((subst0 i v0 u1 u2) \to (\forall (c3: C).(\forall (c4: C).((csubst0 i v0 +c3 c4) \to ((((eq nat i O) \to (or4 (drop O O c3 c4) (ex3_4 F C T T (\lambda +(f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u4: T).(eq C c4 (CHead e0 +(Flat f) u4)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u3: T).(\lambda +(_: T).(drop O O c3 (CHead e0 (Flat f) u3)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C c4 +(CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(drop O O c3 (CHead e1 (Flat f) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u4: T).(eq C c4 (CHead e2 (Flat f) u4))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u3: T).(\lambda +(_: T).(drop O O c3 (CHead e1 (Flat f) u3))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v0 e1 e2)))))))))) \to ((eq nat (s k0 i) O) \to (or4 (drop +O O (CHead c3 k0 u1) (CHead c4 k0 u2)) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u4: T).(eq C (CHead c4 k0 u2) +(CHead e0 (Flat f) u4)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u3: +T).(\lambda (_: T).(drop O O (CHead c3 k0 u1) (CHead e0 (Flat f) u3)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O +v0 u3 u4)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead c4 k0 u2) (CHead e2 (Flat f) u)))))) (\lambda +(f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop O O (CHead c3 +k0 u1) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u4: T).(eq +C (CHead c4 k0 u2) (CHead e2 (Flat f) u4))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u3: T).(\lambda (_: T).(drop O O (CHead c3 k0 +u1) (CHead e1 (Flat f) u3))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v0 e1 e2))))))))))))))))))) (\lambda (b: B).(\lambda (i: nat).(\lambda (v0: +T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (_: (subst0 i v0 u1 +u2)).(\lambda (c3: C).(\lambda (c4: C).(\lambda (_: (csubst0 i v0 c3 +c4)).(\lambda (_: (((eq nat i O) \to (or4 (drop O O c3 c4) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u4: T).(eq C c4 +(CHead e0 (Flat f) u4)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u3: +T).(\lambda (_: T).(drop O O c3 (CHead e0 (Flat f) u3)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C c4 (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop O O c3 (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u4: T).(eq C c4 (CHead e2 (Flat f) u4))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u3: T).(\lambda +(_: T).(drop O O c3 (CHead e1 (Flat f) u3))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v0 e1 e2))))))))))).(\lambda (H5: (eq nat (S i) O)).(let H6 +\def (eq_ind nat (S i) (\lambda (ee: nat).(match ee in nat return (\lambda +(_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H5) +in (False_ind (or4 (drop O O (CHead c3 (Bind b) u1) (CHead c4 (Bind b) u2)) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u4: +T).(eq C (CHead c4 (Bind b) u2) (CHead e0 (Flat f) u4)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (u3: T).(\lambda (_: T).(drop O O (CHead c3 +(Bind b) u1) (CHead e0 (Flat f) u3)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead +c4 (Bind b) u2) (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop O O (CHead c3 (Bind b) u1) (CHead e1 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u4: T).(eq C (CHead c4 +(Bind b) u2) (CHead e2 (Flat f) u4))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u3: T).(\lambda (_: T).(drop O O (CHead c3 (Bind +b) u1) (CHead e1 (Flat f) u3))))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: +T).(csubst0 O v0 e1 e2)))))))) H6))))))))))))) (\lambda (f: F).(\lambda (i: +nat).(\lambda (v0: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H2: (subst0 +i v0 u1 u2)).(\lambda (c3: C).(\lambda (c4: C).(\lambda (H3: (csubst0 i v0 c3 +c4)).(\lambda (H4: (((eq nat i O) \to (or4 (drop O O c3 c4) (ex3_4 F C T T +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u4: T).(eq C c4 +(CHead e0 (Flat f0) u4)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u3: +T).(\lambda (_: T).(drop O O c3 (CHead e0 (Flat f0) u3)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) +(ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C c4 (CHead e2 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop O O c3 (CHead e1 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (u4: T).(eq C c4 (CHead e2 (Flat f0) +u4))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u3: +T).(\lambda (_: T).(drop O O c3 (CHead e1 (Flat f0) u3))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: T).(subst0 +O v0 u3 u4)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v0 e1 e2))))))))))).(\lambda (H5: (eq nat i +O)).(let H6 \def (eq_ind nat i (\lambda (n0: nat).((eq nat n0 O) \to (or4 +(drop O O c3 c4) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda +(_: T).(\lambda (u4: T).(eq C c4 (CHead e0 (Flat f0) u4)))))) (\lambda (f0: +F).(\lambda (e0: C).(\lambda (u3: T).(\lambda (_: T).(drop O O c3 (CHead e0 +(Flat f0) u3)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u3: T).(\lambda +(u4: T).(subst0 O v0 u3 u4)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C c4 (CHead e2 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop O O +c3 (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v0 e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u4: T).(eq C c4 +(CHead e2 (Flat f0) u4))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u3: T).(\lambda (_: T).(drop O O c3 (CHead e1 (Flat f0) +u3))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u3: +T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))))))) H4 O H5) in (let H7 \def (eq_ind nat i (\lambda (n0: +nat).(csubst0 n0 v0 c3 c4)) H3 O H5) in (let H8 \def (eq_ind nat i (\lambda +(n0: nat).(subst0 n0 v0 u1 u2)) H2 O H5) in (or4_intro3 (drop O O (CHead c3 +(Flat f) u1) (CHead c4 (Flat f) u2)) (ex3_4 F C T T (\lambda (f0: F).(\lambda +(e0: C).(\lambda (_: T).(\lambda (u4: T).(eq C (CHead c4 (Flat f) u2) (CHead +e0 (Flat f0) u4)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u3: +T).(\lambda (_: T).(drop O O (CHead c3 (Flat f) u1) (CHead e0 (Flat f0) +u3)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u3: T).(\lambda (u4: +T).(subst0 O v0 u3 u4)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead c4 (Flat f) u2) (CHead e2 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(drop O O (CHead c3 (Flat f) u1) (CHead e1 (Flat f0) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v0 e1 +e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u4: T).(eq C (CHead c4 (Flat f) u2) (CHead e2 +(Flat f0) u4))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u3: T).(\lambda (_: T).(drop O O (CHead c3 (Flat f) u1) (CHead +e1 (Flat f0) u3))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v0 e1 e2))))))) (ex4_5_intro F C C T T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u4: T).(eq C (CHead c4 (Flat f) +u2) (CHead e2 (Flat f0) u4))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u3: T).(\lambda (_: T).(drop O O (CHead c3 (Flat f) u1) +(CHead e1 (Flat f0) u3))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u3: T).(\lambda (u4: T).(subst0 O v0 u3 u4)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v0 e1 e2)))))) f c3 c4 u1 u2 (refl_equal C (CHead c4 (Flat f) u2)) +(drop_refl (CHead c3 (Flat f) u1)) H8 H7)))))))))))))))) k)) y v c1 c2 H1))) +H) e (drop_gen_refl c2 e H0)))))))) (\lambda (n0: nat).(\lambda (IHn: +((\forall (c1: C).(\forall (c2: C).(\forall (v: T).((csubst0 n0 v c1 c2) \to +(\forall (e: C).((drop n0 O c2 e) \to (or4 (drop n0 O c1 e) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop n0 O c1 (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop n0 O c1 (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop n0 O c1 (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda +(_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))))))))))))).(\lambda (c1: C).(C_ind +(\lambda (c: C).(\forall (c2: C).(\forall (v: T).((csubst0 (S n0) v c c2) \to +(\forall (e: C).((drop (S n0) O c2 e) \to (or4 (drop (S n0) O c e) (ex3_4 F C +T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O c (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O c (CHead e1 (Flat f) +u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat +f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O c (CHead e1 (Flat f) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))))))))) (\lambda (n1: +nat).(\lambda (c2: C).(\lambda (v: T).(\lambda (H: (csubst0 (S n0) v (CSort +n1) c2)).(\lambda (e: C).(\lambda (_: (drop (S n0) O c2 e)).(csubst0_gen_sort +c2 v (S n0) n1 H (or4 (drop (S n0) O (CSort n1) e) (ex3_4 F C T T (\lambda +(f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 +(Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CSort n1) (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CSort n1) (CHead e1 (Flat +f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat +f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CSort n1) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))))))))))) +(\lambda (c: C).(\lambda (H: ((\forall (c2: C).(\forall (v: T).((csubst0 (S +n0) v c c2) \to (\forall (e: C).((drop (S n0) O c2 e) \to (or4 (drop (S n0) O +c e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O c (CHead e0 (Flat f) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) +O c (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O c (CHead e1 (Flat f) +u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2))))))))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (c2: C).(\lambda +(v: T).(\lambda (H0: (csubst0 (S n0) v (CHead c k t) c2)).(\lambda (e: +C).(\lambda (H1: (drop (S n0) O c2 e)).(or3_ind (ex3_2 T nat (\lambda (_: +T).(\lambda (j: nat).(eq nat (S n0) (s k j)))) (\lambda (u2: T).(\lambda (_: +nat).(eq C c2 (CHead c k u2)))) (\lambda (u2: T).(\lambda (j: nat).(subst0 j +v t u2)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq nat (S n0) (s k +j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k t)))) (\lambda +(c3: C).(\lambda (j: nat).(csubst0 j v c c3)))) (ex4_3 T C nat (\lambda (_: +T).(\lambda (_: C).(\lambda (j: nat).(eq nat (S n0) (s k j))))) (\lambda (u2: +T).(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda +(u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c c3))))) (or4 (drop (S +n0) O (CHead c k t) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c k t) (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e +(CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(drop (S n0) O (CHead c k t) (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c k t) (CHead e1 (Flat f) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (H2: (ex3_2 T nat +(\lambda (_: T).(\lambda (j: nat).(eq nat (S n0) (s k j)))) (\lambda (u2: +T).(\lambda (_: nat).(eq C c2 (CHead c k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v t u2))))).(ex3_2_ind T nat (\lambda (_: T).(\lambda (j: +nat).(eq nat (S n0) (s k j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C c2 +(CHead c k u2)))) (\lambda (u2: T).(\lambda (j: nat).(subst0 j v t u2))) (or4 +(drop (S n0) O (CHead c k t) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c k t) (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e +(CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(drop (S n0) O (CHead c k t) (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c k t) (CHead e1 (Flat f) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: T).(\lambda +(x1: nat).(\lambda (H3: (eq nat (S n0) (s k x1))).(\lambda (H4: (eq C c2 +(CHead c k x0))).(\lambda (H5: (subst0 x1 v t x0)).(let H6 \def (eq_ind C c2 +(\lambda (c0: C).(drop (S n0) O c0 e)) H1 (CHead c k x0) H4) in (K_ind +(\lambda (k0: K).((eq nat (S n0) (s k0 x1)) \to ((drop (r k0 n0) O c e) \to +(or4 (drop (S n0) O (CHead c k0 t) e) (ex3_4 F C T T (\lambda (f: F).(\lambda +(e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c k0 t) (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e +(CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(drop (S n0) O (CHead c k0 t) (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c k0 t) (CHead e1 (Flat f) u1))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))))))) (\lambda (b: +B).(\lambda (H7: (eq nat (S n0) (s (Bind b) x1))).(\lambda (H8: (drop (r +(Bind b) n0) O c e)).(let H9 \def (f_equal nat nat (\lambda (e0: nat).(match +e0 in nat return (\lambda (_: nat).nat) with [O \Rightarrow n0 | (S n1) +\Rightarrow n1])) (S n0) (S x1) H7) in (let H10 \def (eq_ind_r nat x1 +(\lambda (n1: nat).(subst0 n1 v t x0)) H5 n0 H9) in (or4_intro0 (drop (S n0) +O (CHead c (Bind b) t) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c (Bind b) t) (CHead +e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) +(CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (drop_drop (Bind b) n0 c e H8 t))))))) (\lambda (f: +F).(\lambda (H7: (eq nat (S n0) (s (Flat f) x1))).(\lambda (H8: (drop (r +(Flat f) n0) O c e)).(let H9 \def (f_equal nat nat (\lambda (e0: nat).e0) (S +n0) x1 H7) in (let H10 \def (eq_ind_r nat x1 (\lambda (n1: nat).(subst0 n1 v +t x0)) H5 (S n0) H9) in (or4_intro0 (drop (S n0) O (CHead c (Flat f) t) e) +(ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (drop_drop +(Flat f) n0 c e H8 t))))))) k H3 (drop_gen_drop k c e x0 n0 H6)))))))) H2)) +(\lambda (H2: (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq nat (S n0) +(s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k t)))) +(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c c3))))).(ex3_2_ind C nat +(\lambda (_: C).(\lambda (j: nat).(eq nat (S n0) (s k j)))) (\lambda (c3: +C).(\lambda (_: nat).(eq C c2 (CHead c3 k t)))) (\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c c3))) (or4 (drop (S n0) O (CHead c k t) e) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c k t) (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c k +t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c k t) (CHead e1 +(Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))) (\lambda (x0: C).(\lambda (x1: nat).(\lambda (H3: (eq nat (S n0) +(s k x1))).(\lambda (H4: (eq C c2 (CHead x0 k t))).(\lambda (H5: (csubst0 x1 +v c x0)).(let H6 \def (eq_ind C c2 (\lambda (c0: C).(drop (S n0) O c0 e)) H1 +(CHead x0 k t) H4) in (K_ind (\lambda (k0: K).((eq nat (S n0) (s k0 x1)) \to +((drop (r k0 n0) O x0 e) \to (or4 (drop (S n0) O (CHead c k0 t) e) (ex3_4 F C +T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c k0 t) (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +k0 t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq +C e (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c k0 t) (CHead +e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))))) (\lambda (b: B).(\lambda (H7: (eq nat (S n0) (s (Bind b) +x1))).(\lambda (H8: (drop (r (Bind b) n0) O x0 e)).(let H9 \def (f_equal nat +nat (\lambda (e0: nat).(match e0 in nat return (\lambda (_: nat).nat) with [O +\Rightarrow n0 | (S n1) \Rightarrow n1])) (S n0) (S x1) H7) in (let H10 \def +(eq_ind_r nat x1 (\lambda (n1: nat).(csubst0 n1 v c x0)) H5 n0 H9) in (let +H11 \def (IHn c x0 v H10 e H8) in (or4_ind (drop n0 O c e) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop n0 O c (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop n0 O c (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop n0 O c (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (or4 (drop (S n0) O (CHead c (Bind b) t) e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda +(H12: (drop n0 O c e)).(or4_intro0 (drop (S n0) O (CHead c (Bind b) t) e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (drop_drop +(Bind b) n0 c e H12 t))) (\lambda (H12: (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat +f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop n0 O c (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2))))))).(ex3_4_ind F C +T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop n0 O c (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2))))) +(or4 (drop (S n0) O (CHead c (Bind b) t) e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat +f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x2: F).(\lambda (x3: C).(\lambda +(x4: T).(\lambda (x5: T).(\lambda (H13: (eq C e (CHead x3 (Flat x2) +x5))).(\lambda (H14: (drop n0 O c (CHead x3 (Flat x2) x4))).(\lambda (H15: +(subst0 O v x4 x5)).(eq_ind_r C (CHead x3 (Flat x2) x5) (\lambda (c0: C).(or4 +(drop (S n0) O (CHead c (Bind b) t) c0) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat +f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c0 (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro1 (drop (S n0) O (CHead c (Bind +b) t) (CHead x3 (Flat x2) x5)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x3 (Flat x2) x5) (CHead e0 +(Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead x3 (Flat x2) x5) (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) +O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(eq C (CHead x3 (Flat x2) x5) (CHead e2 (Flat f) +u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) +u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) +(ex3_4_intro F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u2: T).(eq C (CHead x3 (Flat x2) x5) (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2))))) +x2 x3 x4 x5 (refl_equal C (CHead x3 (Flat x2) x5)) (drop_drop (Bind b) n0 c +(CHead x3 (Flat x2) x4) H14 t) H15)) e H13)))))))) H12)) (\lambda (H12: +(ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop n0 O c (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2))))))).(ex3_4_ind F C C T (\lambda (f: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop n0 O c (CHead e1 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2))))) (or4 (drop (S n0) O (CHead c (Bind b) t) e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda +(x2: F).(\lambda (x3: C).(\lambda (x4: C).(\lambda (x5: T).(\lambda (H13: (eq +C e (CHead x4 (Flat x2) x5))).(\lambda (H14: (drop n0 O c (CHead x3 (Flat x2) +x5))).(\lambda (H15: (csubst0 O v x3 x4)).(eq_ind_r C (CHead x4 (Flat x2) x5) +(\lambda (c0: C).(or4 (drop (S n0) O (CHead c (Bind b) t) c0) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) +O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(eq C c0 (CHead e2 (Flat f) u2))))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))))) (or4_intro2 (drop (S n0) O +(CHead c (Bind b) t) (CHead x4 (Flat x2) x5)) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat +x2) x5) (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda +(u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat +f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead x4 (Flat x2) x5) (CHead e2 +(Flat f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat x2) x5) (CHead e2 +(Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat +f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) +(ex3_4_intro F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead x4 (Flat x2) x5) (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) +O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2))))) x2 x3 x4 x5 +(refl_equal C (CHead x4 (Flat x2) x5)) (drop_drop (Bind b) n0 c (CHead x3 +(Flat x2) x5) H14 t) H15)) e H13)))))))) H12)) (\lambda (H12: (ex4_5 F C C T +T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop n0 O c (CHead e1 +(Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))).(ex4_5_ind F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop n0 O c (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (or4 (drop (S n0) O (CHead c (Bind b) t) e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda +(x2: F).(\lambda (x3: C).(\lambda (x4: C).(\lambda (x5: T).(\lambda (x6: +T).(\lambda (H13: (eq C e (CHead x4 (Flat x2) x6))).(\lambda (H14: (drop n0 O +c (CHead x3 (Flat x2) x5))).(\lambda (H15: (subst0 O v x5 x6)).(\lambda (H16: +(csubst0 O v x3 x4)).(eq_ind_r C (CHead x4 (Flat x2) x6) (\lambda (c0: +C).(or4 (drop (S n0) O (CHead c (Bind b) t) c0) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat +f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c0 (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro3 (drop (S n0) O (CHead c (Bind +b) t) (CHead x4 (Flat x2) x6)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat x2) x6) (CHead e0 +(Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead x4 (Flat x2) x6) (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) +O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(eq C (CHead x4 (Flat x2) x6) (CHead e2 (Flat f) +u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) +u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) +(ex4_5_intro F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat x2) x6) (CHead e2 +(Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat +f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))) +x2 x3 x4 x5 x6 (refl_equal C (CHead x4 (Flat x2) x6)) (drop_drop (Bind b) n0 +c (CHead x3 (Flat x2) x5) H14 t) H15 H16)) e H13)))))))))) H12)) H11))))))) +(\lambda (f: F).(\lambda (H7: (eq nat (S n0) (s (Flat f) x1))).(\lambda (H8: +(drop (r (Flat f) n0) O x0 e)).(let H9 \def (f_equal nat nat (\lambda (e0: +nat).e0) (S n0) x1 H7) in (let H10 \def (eq_ind_r nat x1 (\lambda (n1: +nat).(csubst0 n1 v c x0)) H5 (S n0) H9) in (let H11 \def (H x0 v H10 e H8) in +(or4_ind (drop (S n0) O c e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat f0) u2)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O c (CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O c (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O c (CHead +e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (or4 (drop (S n0) O (CHead c (Flat f) t) e) (ex3_4 F C T T +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (H12: (drop (S n0) +O c e)).(or4_intro0 (drop (S n0) O (CHead c (Flat f) t) e) (ex3_4 F C T T +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (drop_drop (Flat f) n0 c e +H12 t))) (\lambda (H12: (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat f0) u2)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O c (CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v u1 u2))))))).(ex3_4_ind F C T T (\lambda +(f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 +(Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O c (CHead e0 (Flat f0) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2))))) +(or4 (drop (S n0) O (CHead c (Flat f) t) e) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat +f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C e (CHead e2 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x2: F).(\lambda (x3: C).(\lambda +(x4: T).(\lambda (x5: T).(\lambda (H13: (eq C e (CHead x3 (Flat x2) +x5))).(\lambda (H14: (drop (S n0) O c (CHead x3 (Flat x2) x4))).(\lambda +(H15: (subst0 O v x4 x5)).(eq_ind_r C (CHead x3 (Flat x2) x5) (\lambda (c0: +C).(or4 (drop (S n0) O (CHead c (Flat f) t) c0) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat +f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c0 (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro1 (drop (S n0) O (CHead c (Flat +f) t) (CHead x3 (Flat x2) x5)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x3 (Flat x2) x5) (CHead e0 +(Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead x3 (Flat x2) x5) (CHead e2 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x3 (Flat x2) x5) (CHead e2 +(Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (ex3_4_intro F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x3 (Flat x2) x5) (CHead e0 +(Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2))))) x2 x3 x4 x5 (refl_equal C (CHead x3 (Flat x2) x5)) +(drop_drop (Flat f) n0 c (CHead x3 (Flat x2) x4) H14 t) H15)) e H13)))))))) +H12)) (\lambda (H12: (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O c (CHead +e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2))))))).(ex3_4_ind F C C T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O c (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2))))) (or4 (drop (S n0) +O (CHead c (Flat f) t) e) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat f0) u2)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C e (CHead e2 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c (Flat f) t) (CHead +e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2)))))))) (\lambda (x2: F).(\lambda (x3: C).(\lambda (x4: C).(\lambda +(x5: T).(\lambda (H13: (eq C e (CHead x4 (Flat x2) x5))).(\lambda (H14: (drop +(S n0) O c (CHead x3 (Flat x2) x5))).(\lambda (H15: (csubst0 O v x3 +x4)).(eq_ind_r C (CHead x4 (Flat x2) x5) (\lambda (c0: C).(or4 (drop (S n0) O +(CHead c (Flat f) t) c0) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat f0) u2)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C c0 (CHead e2 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c (Flat f) t) (CHead +e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 +(CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))) (or4_intro2 (drop (S n0) O (CHead c (Flat f) t) (CHead x4 +(Flat x2) x5)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u2: T).(eq C (CHead x4 (Flat x2) x5) (CHead e0 (Flat f0) +u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead x4 (Flat x2) x5) (CHead e2 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat x2) x5) (CHead e2 (Flat f0) +u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) +u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) +(ex3_4_intro F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead x4 (Flat x2) x5) (CHead e2 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2))))) +x2 x3 x4 x5 (refl_equal C (CHead x4 (Flat x2) x5)) (drop_drop (Flat f) n0 c +(CHead x3 (Flat x2) x5) H14 t) H15)) e H13)))))))) H12)) (\lambda (H12: +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O c (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))).(ex4_5_ind F C C T T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O c (CHead e1 (Flat f0) +u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(or4 (drop (S n0) O (CHead c (Flat f) t) e) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat +f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C e (CHead e2 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x2: F).(\lambda (x3: C).(\lambda +(x4: C).(\lambda (x5: T).(\lambda (x6: T).(\lambda (H13: (eq C e (CHead x4 +(Flat x2) x6))).(\lambda (H14: (drop (S n0) O c (CHead x3 (Flat x2) +x5))).(\lambda (H15: (subst0 O v x5 x6)).(\lambda (H16: (csubst0 O v x3 +x4)).(eq_ind_r C (CHead x4 (Flat x2) x6) (\lambda (c0: C).(or4 (drop (S n0) O +(CHead c (Flat f) t) c0) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat f0) u2)))))) +(\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C c0 (CHead e2 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c (Flat f) t) (CHead +e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 +(CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))) (or4_intro3 (drop (S n0) O (CHead c (Flat f) t) (CHead x4 +(Flat x2) x6)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u2: T).(eq C (CHead x4 (Flat x2) x6) (CHead e0 (Flat f0) +u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead x4 (Flat x2) x6) (CHead e2 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat x2) x6) (CHead e2 (Flat f0) +u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) +u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) +(ex4_5_intro F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat x2) x6) (CHead e2 +(Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2)))))) x2 x3 x4 x5 x6 (refl_equal C (CHead x4 (Flat x2) x6)) +(drop_drop (Flat f) n0 c (CHead x3 (Flat x2) x5) H14 t) H15 H16)) e +H13)))))))))) H12)) H11))))))) k H3 (drop_gen_drop k x0 e t n0 H6)))))))) +H2)) (\lambda (H2: (ex4_3 T C nat (\lambda (_: T).(\lambda (_: C).(\lambda +(j: nat).(eq nat (S n0) (s k j))))) (\lambda (u2: T).(\lambda (c3: +C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda (u2: T).(\lambda +(_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: T).(\lambda (c3: +C).(\lambda (j: nat).(csubst0 j v c c3)))))).(ex4_3_ind T C nat (\lambda (_: +T).(\lambda (_: C).(\lambda (j: nat).(eq nat (S n0) (s k j))))) (\lambda (u2: +T).(\lambda (c3: C).(\lambda (_: nat).(eq C c2 (CHead c3 k u2))))) (\lambda +(u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v t u2)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c c3)))) (or4 (drop (S n0) +O (CHead c k t) e) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda +(_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +k t) (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c k t) (CHead e1 (Flat f) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c k t) (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x0: T).(\lambda (x1: C).(\lambda +(x2: nat).(\lambda (H3: (eq nat (S n0) (s k x2))).(\lambda (H4: (eq C c2 +(CHead x1 k x0))).(\lambda (H5: (subst0 x2 v t x0)).(\lambda (H6: (csubst0 x2 +v c x1)).(let H7 \def (eq_ind C c2 (\lambda (c0: C).(drop (S n0) O c0 e)) H1 +(CHead x1 k x0) H4) in (K_ind (\lambda (k0: K).((eq nat (S n0) (s k0 x2)) \to +((drop (r k0 n0) O x1 e) \to (or4 (drop (S n0) O (CHead c k0 t) e) (ex3_4 F C +T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c k0 t) (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +k0 t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda +(f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq +C e (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c k0 t) (CHead +e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))))))) (\lambda (b: B).(\lambda (H8: (eq nat (S n0) (s (Bind b) +x2))).(\lambda (H9: (drop (r (Bind b) n0) O x1 e)).(let H10 \def (f_equal nat +nat (\lambda (e0: nat).(match e0 in nat return (\lambda (_: nat).nat) with [O +\Rightarrow n0 | (S n1) \Rightarrow n1])) (S n0) (S x2) H8) in (let H11 \def +(eq_ind_r nat x2 (\lambda (n1: nat).(csubst0 n1 v c x1)) H6 n0 H10) in (let +H12 \def (eq_ind_r nat x2 (\lambda (n1: nat).(subst0 n1 v t x0)) H5 n0 H10) +in (let H13 \def (IHn c x1 v H11 e H9) in (or4_ind (drop n0 O c e) (ex3_4 F C +T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop n0 O c (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop n0 O c (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop n0 O c (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (or4 (drop (S n0) O (CHead c (Bind b) t) e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda +(H14: (drop n0 O c e)).(or4_intro0 (drop (S n0) O (CHead c (Bind b) t) e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (drop_drop +(Bind b) n0 c e H14 t))) (\lambda (H14: (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat +f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop n0 O c (CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2))))))).(ex3_4_ind F C +T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop n0 O c (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2))))) +(or4 (drop (S n0) O (CHead c (Bind b) t) e) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat +f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x3: F).(\lambda (x4: C).(\lambda +(x5: T).(\lambda (x6: T).(\lambda (H15: (eq C e (CHead x4 (Flat x3) +x6))).(\lambda (H16: (drop n0 O c (CHead x4 (Flat x3) x5))).(\lambda (H17: +(subst0 O v x5 x6)).(eq_ind_r C (CHead x4 (Flat x3) x6) (\lambda (c0: C).(or4 +(drop (S n0) O (CHead c (Bind b) t) c0) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat +f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c0 (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro1 (drop (S n0) O (CHead c (Bind +b) t) (CHead x4 (Flat x3) x6)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat x3) x6) (CHead e0 +(Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead x4 (Flat x3) x6) (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) +O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(eq C (CHead x4 (Flat x3) x6) (CHead e2 (Flat f) +u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) +u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) +(ex3_4_intro F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u2: T).(eq C (CHead x4 (Flat x3) x6) (CHead e0 (Flat f) u2)))))) +(\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2))))) +x3 x4 x5 x6 (refl_equal C (CHead x4 (Flat x3) x6)) (drop_drop (Bind b) n0 c +(CHead x4 (Flat x3) x5) H16 t) H17)) e H15)))))))) H14)) (\lambda (H14: +(ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(drop n0 O c (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2))))))).(ex3_4_ind F C C T (\lambda (f: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop n0 O c (CHead e1 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2))))) (or4 (drop (S n0) O (CHead c (Bind b) t) e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda +(x3: F).(\lambda (x4: C).(\lambda (x5: C).(\lambda (x6: T).(\lambda (H15: (eq +C e (CHead x5 (Flat x3) x6))).(\lambda (H16: (drop n0 O c (CHead x4 (Flat x3) +x6))).(\lambda (H17: (csubst0 O v x4 x5)).(eq_ind_r C (CHead x5 (Flat x3) x6) +(\lambda (c0: C).(or4 (drop (S n0) O (CHead c (Bind b) t) c0) (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 +(CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) +O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(eq C c0 (CHead e2 (Flat f) u2))))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))))) (or4_intro2 (drop (S n0) O +(CHead c (Bind b) t) (CHead x5 (Flat x3) x6)) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x5 (Flat +x3) x6) (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda +(u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat +f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead x5 (Flat x3) x6) (CHead e2 +(Flat f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x5 (Flat x3) x6) (CHead e2 +(Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat +f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) +(ex3_4_intro F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead x5 (Flat x3) x6) (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) +O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2))))) x3 x4 x5 x6 +(refl_equal C (CHead x5 (Flat x3) x6)) (drop_drop (Bind b) n0 c (CHead x4 +(Flat x3) x6) H16 t) H17)) e H15)))))))) H14)) (\lambda (H14: (ex4_5 F C C T +T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop n0 O c (CHead e1 +(Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 +e2)))))))).(ex4_5_ind F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop n0 O c (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (or4 (drop (S n0) O (CHead c (Bind b) t) e) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C e (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) +(CHead e0 (Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f) u)))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f) u2))))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda +(x3: F).(\lambda (x4: C).(\lambda (x5: C).(\lambda (x6: T).(\lambda (x7: +T).(\lambda (H15: (eq C e (CHead x5 (Flat x3) x7))).(\lambda (H16: (drop n0 O +c (CHead x4 (Flat x3) x6))).(\lambda (H17: (subst0 O v x6 x7)).(\lambda (H18: +(csubst0 O v x4 x5)).(eq_ind_r C (CHead x5 (Flat x3) x7) (\lambda (c0: +C).(or4 (drop (S n0) O (CHead c (Bind b) t) c0) (ex3_4 F C T T (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat +f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c0 (CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Bind b) t) (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro3 (drop (S n0) O (CHead c (Bind +b) t) (CHead x5 (Flat x3) x7)) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x5 (Flat x3) x7) (CHead e0 +(Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C (CHead x5 (Flat x3) x7) (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) +O (CHead c (Bind b) t) (CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C +C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(eq C (CHead x5 (Flat x3) x7) (CHead e2 (Flat f) +u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat f) +u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) +(ex4_5_intro F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x5 (Flat x3) x7) (CHead e2 +(Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Bind b) t) (CHead e1 (Flat +f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))) +x3 x4 x5 x6 x7 (refl_equal C (CHead x5 (Flat x3) x7)) (drop_drop (Bind b) n0 +c (CHead x4 (Flat x3) x6) H16 t) H17 H18)) e H15)))))))))) H14)) H13)))))))) +(\lambda (f: F).(\lambda (H8: (eq nat (S n0) (s (Flat f) x2))).(\lambda (H9: +(drop (r (Flat f) n0) O x1 e)).(let H10 \def (f_equal nat nat (\lambda (e0: +nat).e0) (S n0) x2 H8) in (let H11 \def (eq_ind_r nat x2 (\lambda (n1: +nat).(csubst0 n1 v c x1)) H6 (S n0) H10) in (let H12 \def (eq_ind_r nat x2 +(\lambda (n1: nat).(subst0 n1 v t x0)) H5 (S n0) H10) in (let H13 \def (H x1 +v H11 e H9) in (or4_ind (drop (S n0) O c e) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat +f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O c (CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e +(CHead e2 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(drop (S n0) O c (CHead e1 (Flat f0) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O c (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (or4 (drop (S n0) O (CHead c (Flat f) t) e) +(ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda +(H14: (drop (S n0) O c e)).(or4_intro0 (drop (S n0) O (CHead c (Flat f) t) e) +(ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (drop_drop +(Flat f) n0 c e H14 t))) (\lambda (H14: (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat +f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O c (CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2))))))).(ex3_4_ind F C +T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C +e (CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda +(u1: T).(\lambda (_: T).(drop (S n0) O c (CHead e0 (Flat f0) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2))))) (or4 (drop (S n0) O (CHead c (Flat f) t) e) (ex3_4 F C T T +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e +(CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda (x3: F).(\lambda +(x4: C).(\lambda (x5: T).(\lambda (x6: T).(\lambda (H15: (eq C e (CHead x4 +(Flat x3) x6))).(\lambda (H16: (drop (S n0) O c (CHead x4 (Flat x3) +x5))).(\lambda (H17: (subst0 O v x5 x6)).(eq_ind_r C (CHead x4 (Flat x3) x6) +(\lambda (c0: C).(or4 (drop (S n0) O (CHead c (Flat f) t) c0) (ex3_4 F C T T +(\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 +(CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f0) u)))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) +(ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C c0 (CHead e2 (Flat f0) u2))))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))))) (or4_intro1 (drop (S n0) O +(CHead c (Flat f) t) (CHead x4 (Flat x3) x6)) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat +x3) x6) (CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead x4 (Flat x3) +x6) (CHead e2 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda +(_: C).(\lambda (u: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat +f0) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat +x3) x6) (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))) (ex3_4_intro F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x4 (Flat +x3) x6) (CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2))))) x3 x4 x5 x6 (refl_equal C (CHead +x4 (Flat x3) x6)) (drop_drop (Flat f) n0 c (CHead x4 (Flat x3) x5) H16 t) +H17)) e H15)))))))) H14)) (\lambda (H14: (ex3_4 F C C T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O c (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2))))))).(ex3_4_ind F C +C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e +(CHead e2 (Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(drop (S n0) O c (CHead e1 (Flat f0) u)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2))))) +(or4 (drop (S n0) O (CHead c (Flat f) t) e) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e0 (Flat +f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C e (CHead e2 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))))) (\lambda (x3: F).(\lambda (x4: C).(\lambda +(x5: C).(\lambda (x6: T).(\lambda (H15: (eq C e (CHead x5 (Flat x3) +x6))).(\lambda (H16: (drop (S n0) O c (CHead x4 (Flat x3) x6))).(\lambda +(H17: (csubst0 O v x4 x5)).(eq_ind_r C (CHead x5 (Flat x3) x6) (\lambda (c0: +C).(or4 (drop (S n0) O (CHead c (Flat f) t) c0) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat +f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c0 (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro2 (drop (S n0) O (CHead c (Flat +f) t) (CHead x5 (Flat x3) x6)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x5 (Flat x3) x6) (CHead e0 +(Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead x5 (Flat x3) x6) (CHead e2 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x5 (Flat x3) x6) (CHead e2 +(Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (ex3_4_intro F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead x5 (Flat x3) x6) (CHead e2 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2))))) x3 x4 x5 x6 (refl_equal C (CHead x5 (Flat x3) x6)) (drop_drop +(Flat f) n0 c (CHead x4 (Flat x3) x6) H16 t) H17)) e H15)))))))) H14)) +(\lambda (H14: (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) +u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O c (CHead e1 (Flat f0) u1))))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))).(ex4_5_ind F C +C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S +n0) O c (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (or4 (drop (S n0) O (CHead c (Flat f) t) e) +(ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: C).(\lambda (_: T).(\lambda +(u2: T).(eq C e (CHead e0 (Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e0 (Flat f0) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(eq C e (CHead e2 (Flat +f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda +(_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 +e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C e (CHead e2 (Flat f0) u2))))))) +(\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))))) (\lambda +(x3: F).(\lambda (x4: C).(\lambda (x5: C).(\lambda (x6: T).(\lambda (x7: +T).(\lambda (H15: (eq C e (CHead x5 (Flat x3) x7))).(\lambda (H16: (drop (S +n0) O c (CHead x4 (Flat x3) x6))).(\lambda (H17: (subst0 O v x6 x7)).(\lambda +(H18: (csubst0 O v x4 x5)).(eq_ind_r C (CHead x5 (Flat x3) x7) (\lambda (c0: +C).(or4 (drop (S n0) O (CHead c (Flat f) t) c0) (ex3_4 F C T T (\lambda (f0: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(eq C c0 (CHead e0 (Flat +f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) u1)))))) (\lambda +(_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 +u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C c0 (CHead e2 (Flat f0) u)))))) (\lambda (f0: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u)))))) (\lambda (_: F).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T +(\lambda (f0: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(u2: T).(eq C c0 (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2))))))))) (or4_intro3 (drop (S n0) O (CHead c (Flat +f) t) (CHead x5 (Flat x3) x7)) (ex3_4 F C T T (\lambda (f0: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x5 (Flat x3) x7) (CHead e0 +(Flat f0) u2)))))) (\lambda (f0: F).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e0 (Flat f0) +u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: +T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C (CHead x5 (Flat x3) x7) (CHead e2 +(Flat f0) u)))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(drop (S n0) O (CHead c (Flat f) t) (CHead e1 (Flat f0) u)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 O +v e1 e2)))))) (ex4_5 F C C T T (\lambda (f0: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x5 (Flat x3) x7) (CHead e2 +(Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c (Flat f) t) +(CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2))))))) (ex4_5_intro F C C T T (\lambda (f0: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C (CHead x5 (Flat +x3) x7) (CHead e2 (Flat f0) u2))))))) (\lambda (f0: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop (S n0) O (CHead c +(Flat f) t) (CHead e1 (Flat f0) u1))))))) (\lambda (_: F).(\lambda (_: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) +(\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 O v e1 e2)))))) x3 x4 x5 x6 x7 (refl_equal C (CHead x5 (Flat +x3) x7)) (drop_drop (Flat f) n0 c (CHead x4 (Flat x3) x6) H16 t) H17 H18)) e +H15)))))))))) H14)) H13)))))))) k H3 (drop_gen_drop k x1 e x0 n0 H7)))))))))) +H2)) (csubst0_gen_head k c c2 t v (S n0) H0))))))))))) c1)))) n). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/fwd.ma new file mode 100644 index 000000000..7980be5fc --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/fwd.ma @@ -0,0 +1,391 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst0/fwd". + +include "csubst0/defs.ma". + +theorem csubst0_gen_sort: + \forall (x: C).(\forall (v: T).(\forall (i: nat).(\forall (n: nat).((csubst0 +i v (CSort n) x) \to (\forall (P: Prop).P))))) +\def + \lambda (x: C).(\lambda (v: T).(\lambda (i: nat).(\lambda (n: nat).(\lambda +(H: (csubst0 i v (CSort n) x)).(\lambda (P: Prop).(let H0 \def (match H in +csubst0 return (\lambda (n0: nat).(\lambda (t: T).(\lambda (c: C).(\lambda +(c0: C).(\lambda (_: (csubst0 n0 t c c0)).((eq nat n0 i) \to ((eq T t v) \to +((eq C c (CSort n)) \to ((eq C c0 x) \to P))))))))) with [(csubst0_snd k i0 +v0 u1 u2 H0 c) \Rightarrow (\lambda (H1: (eq nat (s k i0) i)).(\lambda (H2: +(eq T v0 v)).(\lambda (H3: (eq C (CHead c k u1) (CSort n))).(\lambda (H4: (eq +C (CHead c k u2) x)).(eq_ind nat (s k i0) (\lambda (_: nat).((eq T v0 v) \to +((eq C (CHead c k u1) (CSort n)) \to ((eq C (CHead c k u2) x) \to ((subst0 i0 +v0 u1 u2) \to P))))) (\lambda (H5: (eq T v0 v)).(eq_ind T v (\lambda (t: +T).((eq C (CHead c k u1) (CSort n)) \to ((eq C (CHead c k u2) x) \to ((subst0 +i0 t u1 u2) \to P)))) (\lambda (H6: (eq C (CHead c k u1) (CSort n))).(let H7 +\def (eq_ind C (CHead c k u1) (\lambda (e: C).(match e in C return (\lambda +(_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ _ _) \Rightarrow +True])) I (CSort n) H6) in (False_ind ((eq C (CHead c k u2) x) \to ((subst0 +i0 v u1 u2) \to P)) H7))) v0 (sym_eq T v0 v H5))) i H1 H2 H3 H4 H0))))) | +(csubst0_fst k i0 c1 c2 v0 H0 u) \Rightarrow (\lambda (H1: (eq nat (s k i0) +i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: (eq C (CHead c1 k u) (CSort +n))).(\lambda (H4: (eq C (CHead c2 k u) x)).(eq_ind nat (s k i0) (\lambda (_: +nat).((eq T v0 v) \to ((eq C (CHead c1 k u) (CSort n)) \to ((eq C (CHead c2 k +u) x) \to ((csubst0 i0 v0 c1 c2) \to P))))) (\lambda (H5: (eq T v0 +v)).(eq_ind T v (\lambda (t: T).((eq C (CHead c1 k u) (CSort n)) \to ((eq C +(CHead c2 k u) x) \to ((csubst0 i0 t c1 c2) \to P)))) (\lambda (H6: (eq C +(CHead c1 k u) (CSort n))).(let H7 \def (eq_ind C (CHead c1 k u) (\lambda (e: +C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow +False | (CHead _ _ _) \Rightarrow True])) I (CSort n) H6) in (False_ind ((eq +C (CHead c2 k u) x) \to ((csubst0 i0 v c1 c2) \to P)) H7))) v0 (sym_eq T v0 v +H5))) i H1 H2 H3 H4 H0))))) | (csubst0_both k i0 v0 u1 u2 H0 c1 c2 H1) +\Rightarrow (\lambda (H2: (eq nat (s k i0) i)).(\lambda (H3: (eq T v0 +v)).(\lambda (H4: (eq C (CHead c1 k u1) (CSort n))).(\lambda (H5: (eq C +(CHead c2 k u2) x)).(eq_ind nat (s k i0) (\lambda (_: nat).((eq T v0 v) \to +((eq C (CHead c1 k u1) (CSort n)) \to ((eq C (CHead c2 k u2) x) \to ((subst0 +i0 v0 u1 u2) \to ((csubst0 i0 v0 c1 c2) \to P)))))) (\lambda (H6: (eq T v0 +v)).(eq_ind T v (\lambda (t: T).((eq C (CHead c1 k u1) (CSort n)) \to ((eq C +(CHead c2 k u2) x) \to ((subst0 i0 t u1 u2) \to ((csubst0 i0 t c1 c2) \to +P))))) (\lambda (H7: (eq C (CHead c1 k u1) (CSort n))).(let H8 \def (eq_ind C +(CHead c1 k u1) (\lambda (e: C).(match e in C return (\lambda (_: C).Prop) +with [(CSort _) \Rightarrow False | (CHead _ _ _) \Rightarrow True])) I +(CSort n) H7) in (False_ind ((eq C (CHead c2 k u2) x) \to ((subst0 i0 v u1 +u2) \to ((csubst0 i0 v c1 c2) \to P))) H8))) v0 (sym_eq T v0 v H6))) i H2 H3 +H4 H5 H0 H1)))))]) in (H0 (refl_equal nat i) (refl_equal T v) (refl_equal C +(CSort n)) (refl_equal C x)))))))). + +theorem csubst0_gen_head: + \forall (k: K).(\forall (c1: C).(\forall (x: C).(\forall (u1: T).(\forall +(v: T).(\forall (i: nat).((csubst0 i v (CHead c1 k u1) x) \to (or3 (ex3_2 T +nat (\lambda (_: T).(\lambda (j: nat).(eq nat i (s k j)))) (\lambda (u2: +T).(\lambda (_: nat).(eq C x (CHead c1 k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat i (s k j)))) (\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 k +u1)))) (\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 c2)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat i (s k j))))) +(\lambda (u2: T).(\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 k +u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u2)))) (\lambda (_: T).(\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 +c2)))))))))))) +\def + \lambda (k: K).(\lambda (c1: C).(\lambda (x: C).(\lambda (u1: T).(\lambda +(v: T).(\lambda (i: nat).(\lambda (H: (csubst0 i v (CHead c1 k u1) x)).(let +H0 \def (match H in csubst0 return (\lambda (n: nat).(\lambda (t: T).(\lambda +(c: C).(\lambda (c0: C).(\lambda (_: (csubst0 n t c c0)).((eq nat n i) \to +((eq T t v) \to ((eq C c (CHead c1 k u1)) \to ((eq C c0 x) \to (or3 (ex3_2 T +nat (\lambda (_: T).(\lambda (j: nat).(eq nat i (s k j)))) (\lambda (u2: +T).(\lambda (_: nat).(eq C x (CHead c1 k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat i (s k j)))) (\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 k +u1)))) (\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 c2)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat i (s k j))))) +(\lambda (u2: T).(\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 k +u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u2)))) (\lambda (_: T).(\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 +c2))))))))))))))) with [(csubst0_snd k0 i0 v0 u0 u2 H0 c) \Rightarrow +(\lambda (H1: (eq nat (s k0 i0) i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: +(eq C (CHead c k0 u0) (CHead c1 k u1))).(\lambda (H4: (eq C (CHead c k0 u2) +x)).(eq_ind nat (s k0 i0) (\lambda (n: nat).((eq T v0 v) \to ((eq C (CHead c +k0 u0) (CHead c1 k u1)) \to ((eq C (CHead c k0 u2) x) \to ((subst0 i0 v0 u0 +u2) \to (or3 (ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat n (s k +j)))) (\lambda (u3: T).(\lambda (_: nat).(eq C x (CHead c1 k u3)))) (\lambda +(u3: T).(\lambda (j: nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat n (s k j)))) (\lambda (c2: C).(\lambda (_: +nat).(eq C x (CHead c2 k u1)))) (\lambda (c2: C).(\lambda (j: nat).(csubst0 j +v c1 c2)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: +nat).(eq nat n (s k j))))) (\lambda (u3: T).(\lambda (c2: C).(\lambda (_: +nat).(eq C x (CHead c2 k u3))))) (\lambda (u3: T).(\lambda (_: C).(\lambda +(j: nat).(subst0 j v u1 u3)))) (\lambda (_: T).(\lambda (c2: C).(\lambda (j: +nat).(csubst0 j v c1 c2))))))))))) (\lambda (H5: (eq T v0 v)).(eq_ind T v +(\lambda (t: T).((eq C (CHead c k0 u0) (CHead c1 k u1)) \to ((eq C (CHead c +k0 u2) x) \to ((subst0 i0 t u0 u2) \to (or3 (ex3_2 T nat (\lambda (_: +T).(\lambda (j: nat).(eq nat (s k0 i0) (s k j)))) (\lambda (u3: T).(\lambda +(_: nat).(eq C x (CHead c1 k u3)))) (\lambda (u3: T).(\lambda (j: +nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k0 i0) (s k j)))) (\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 +k u1)))) (\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 c2)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k0 i0) (s k +j))))) (\lambda (u3: T).(\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 +k u3))))) (\lambda (u3: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u3)))) (\lambda (_: T).(\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 +c2)))))))))) (\lambda (H6: (eq C (CHead c k0 u0) (CHead c1 k u1))).(let H7 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u0 | (CHead _ _ t) \Rightarrow t])) (CHead c k0 +u0) (CHead c1 k u1) H6) in ((let H8 \def (f_equal C K (\lambda (e: C).(match +e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | (CHead _ k1 +_) \Rightarrow k1])) (CHead c k0 u0) (CHead c1 k u1) H6) in ((let H9 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c | (CHead c0 _ _) \Rightarrow c0])) (CHead c k0 u0) +(CHead c1 k u1) H6) in (eq_ind C c1 (\lambda (c0: C).((eq K k0 k) \to ((eq T +u0 u1) \to ((eq C (CHead c0 k0 u2) x) \to ((subst0 i0 v u0 u2) \to (or3 +(ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat (s k0 i0) (s k j)))) +(\lambda (u3: T).(\lambda (_: nat).(eq C x (CHead c1 k u3)))) (\lambda (u3: +T).(\lambda (j: nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat (s k0 i0) (s k j)))) (\lambda (c2: C).(\lambda +(_: nat).(eq C x (CHead c2 k u1)))) (\lambda (c2: C).(\lambda (j: +nat).(csubst0 j v c1 c2)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat (s k0 i0) (s k j))))) (\lambda (u3: T).(\lambda +(c2: C).(\lambda (_: nat).(eq C x (CHead c2 k u3))))) (\lambda (u3: +T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 u3)))) (\lambda (_: +T).(\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 c2))))))))))) (\lambda +(H10: (eq K k0 k)).(eq_ind K k (\lambda (k1: K).((eq T u0 u1) \to ((eq C +(CHead c1 k1 u2) x) \to ((subst0 i0 v u0 u2) \to (or3 (ex3_2 T nat (\lambda +(_: T).(\lambda (j: nat).(eq nat (s k1 i0) (s k j)))) (\lambda (u3: +T).(\lambda (_: nat).(eq C x (CHead c1 k u3)))) (\lambda (u3: T).(\lambda (j: +nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k1 i0) (s k j)))) (\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 +k u1)))) (\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 c2)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k1 i0) (s k +j))))) (\lambda (u3: T).(\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 +k u3))))) (\lambda (u3: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u3)))) (\lambda (_: T).(\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 +c2)))))))))) (\lambda (H11: (eq T u0 u1)).(eq_ind T u1 (\lambda (t: T).((eq C +(CHead c1 k u2) x) \to ((subst0 i0 v t u2) \to (or3 (ex3_2 T nat (\lambda (_: +T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (u3: T).(\lambda +(_: nat).(eq C x (CHead c1 k u3)))) (\lambda (u3: T).(\lambda (j: +nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k i0) (s k j)))) (\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 +k u1)))) (\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 c2)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k i0) (s k +j))))) (\lambda (u3: T).(\lambda (c2: C).(\lambda (_: nat).(eq C x (CHead c2 +k u3))))) (\lambda (u3: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u3)))) (\lambda (_: T).(\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 +c2))))))))) (\lambda (H12: (eq C (CHead c1 k u2) x)).(eq_ind C (CHead c1 k +u2) (\lambda (c0: C).((subst0 i0 v u1 u2) \to (or3 (ex3_2 T nat (\lambda (_: +T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (u3: T).(\lambda +(_: nat).(eq C c0 (CHead c1 k u3)))) (\lambda (u3: T).(\lambda (j: +nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k i0) (s k j)))) (\lambda (c2: C).(\lambda (_: nat).(eq C c0 (CHead c2 +k u1)))) (\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 c2)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k i0) (s k +j))))) (\lambda (u3: T).(\lambda (c2: C).(\lambda (_: nat).(eq C c0 (CHead c2 +k u3))))) (\lambda (u3: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u3)))) (\lambda (_: T).(\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 +c2)))))))) (\lambda (H13: (subst0 i0 v u1 u2)).(let H14 \def (eq_ind K k0 +(\lambda (k1: K).(eq nat (s k1 i0) i)) H1 k H10) in (or3_intro0 (ex3_2 T nat +(\lambda (_: T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (u3: +T).(\lambda (_: nat).(eq C (CHead c1 k u2) (CHead c1 k u3)))) (\lambda (u3: +T).(\lambda (j: nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (c2: C).(\lambda +(_: nat).(eq C (CHead c1 k u2) (CHead c2 k u1)))) (\lambda (c2: C).(\lambda +(j: nat).(csubst0 j v c1 c2)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat (s k i0) (s k j))))) (\lambda (u3: T).(\lambda +(c2: C).(\lambda (_: nat).(eq C (CHead c1 k u2) (CHead c2 k u3))))) (\lambda +(u3: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 u3)))) (\lambda (_: +T).(\lambda (c2: C).(\lambda (j: nat).(csubst0 j v c1 c2))))) (ex3_2_intro T +nat (\lambda (_: T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda +(u3: T).(\lambda (_: nat).(eq C (CHead c1 k u2) (CHead c1 k u3)))) (\lambda +(u3: T).(\lambda (j: nat).(subst0 j v u1 u3))) u2 i0 (refl_equal nat (s k +i0)) (refl_equal C (CHead c1 k u2)) H13)))) x H12)) u0 (sym_eq T u0 u1 H11))) +k0 (sym_eq K k0 k H10))) c (sym_eq C c c1 H9))) H8)) H7))) v0 (sym_eq T v0 v +H5))) i H1 H2 H3 H4 H0))))) | (csubst0_fst k0 i0 c0 c2 v0 H0 u) \Rightarrow +(\lambda (H1: (eq nat (s k0 i0) i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: +(eq C (CHead c0 k0 u) (CHead c1 k u1))).(\lambda (H4: (eq C (CHead c2 k0 u) +x)).(eq_ind nat (s k0 i0) (\lambda (n: nat).((eq T v0 v) \to ((eq C (CHead c0 +k0 u) (CHead c1 k u1)) \to ((eq C (CHead c2 k0 u) x) \to ((csubst0 i0 v0 c0 +c2) \to (or3 (ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat n (s k +j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C x (CHead c1 k u2)))) (\lambda +(u2: T).(\lambda (j: nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat n (s k j)))) (\lambda (c3: C).(\lambda (_: +nat).(eq C x (CHead c3 k u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j +v c1 c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: +nat).(eq nat n (s k j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: +nat).(eq C x (CHead c3 k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda +(j: nat).(subst0 j v u1 u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c1 c3))))))))))) (\lambda (H5: (eq T v0 v)).(eq_ind T v +(\lambda (t: T).((eq C (CHead c0 k0 u) (CHead c1 k u1)) \to ((eq C (CHead c2 +k0 u) x) \to ((csubst0 i0 t c0 c2) \to (or3 (ex3_2 T nat (\lambda (_: +T).(\lambda (j: nat).(eq nat (s k0 i0) (s k j)))) (\lambda (u2: T).(\lambda +(_: nat).(eq C x (CHead c1 k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k0 i0) (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k0 i0) (s k +j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 +c3)))))))))) (\lambda (H6: (eq C (CHead c0 k0 u) (CHead c1 k u1))).(let H7 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow t])) (CHead c0 k0 +u) (CHead c1 k u1) H6) in ((let H8 \def (f_equal C K (\lambda (e: C).(match e +in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | (CHead _ k1 +_) \Rightarrow k1])) (CHead c0 k0 u) (CHead c1 k u1) H6) in ((let H9 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) (CHead c0 k0 u) +(CHead c1 k u1) H6) in (eq_ind C c1 (\lambda (c: C).((eq K k0 k) \to ((eq T u +u1) \to ((eq C (CHead c2 k0 u) x) \to ((csubst0 i0 v c c2) \to (or3 (ex3_2 T +nat (\lambda (_: T).(\lambda (j: nat).(eq nat (s k0 i0) (s k j)))) (\lambda +(u2: T).(\lambda (_: nat).(eq C x (CHead c1 k u2)))) (\lambda (u2: +T).(\lambda (j: nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat (s k0 i0) (s k j)))) (\lambda (c3: C).(\lambda +(_: nat).(eq C x (CHead c3 k u1)))) (\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c1 c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat (s k0 i0) (s k j))))) (\lambda (u2: T).(\lambda +(c3: C).(\lambda (_: nat).(eq C x (CHead c3 k u2))))) (\lambda (u2: +T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 u2)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3))))))))))) (\lambda +(H10: (eq K k0 k)).(eq_ind K k (\lambda (k1: K).((eq T u u1) \to ((eq C +(CHead c2 k1 u) x) \to ((csubst0 i0 v c1 c2) \to (or3 (ex3_2 T nat (\lambda +(_: T).(\lambda (j: nat).(eq nat (s k1 i0) (s k j)))) (\lambda (u2: +T).(\lambda (_: nat).(eq C x (CHead c1 k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k1 i0) (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k1 i0) (s k +j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 +c3)))))))))) (\lambda (H11: (eq T u u1)).(eq_ind T u1 (\lambda (t: T).((eq C +(CHead c2 k t) x) \to ((csubst0 i0 v c1 c2) \to (or3 (ex3_2 T nat (\lambda +(_: T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (u2: +T).(\lambda (_: nat).(eq C x (CHead c1 k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k i0) (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k i0) (s k +j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 +c3))))))))) (\lambda (H12: (eq C (CHead c2 k u1) x)).(eq_ind C (CHead c2 k +u1) (\lambda (c: C).((csubst0 i0 v c1 c2) \to (or3 (ex3_2 T nat (\lambda (_: +T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (u2: T).(\lambda +(_: nat).(eq C c (CHead c1 k u2)))) (\lambda (u2: T).(\lambda (j: +nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k i0) (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C c (CHead c3 +k u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k i0) (s k +j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: nat).(eq C c (CHead c3 +k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 +c3)))))))) (\lambda (H13: (csubst0 i0 v c1 c2)).(let H14 \def (eq_ind K k0 +(\lambda (k1: K).(eq nat (s k1 i0) i)) H1 k H10) in (or3_intro1 (ex3_2 T nat +(\lambda (_: T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (u2: +T).(\lambda (_: nat).(eq C (CHead c2 k u1) (CHead c1 k u2)))) (\lambda (u2: +T).(\lambda (j: nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (c3: C).(\lambda +(_: nat).(eq C (CHead c2 k u1) (CHead c3 k u1)))) (\lambda (c3: C).(\lambda +(j: nat).(csubst0 j v c1 c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat (s k i0) (s k j))))) (\lambda (u2: T).(\lambda +(c3: C).(\lambda (_: nat).(eq C (CHead c2 k u1) (CHead c3 k u2))))) (\lambda +(u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 u2)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3))))) (ex3_2_intro C +nat (\lambda (_: C).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda +(c3: C).(\lambda (_: nat).(eq C (CHead c2 k u1) (CHead c3 k u1)))) (\lambda +(c3: C).(\lambda (j: nat).(csubst0 j v c1 c3))) c2 i0 (refl_equal nat (s k +i0)) (refl_equal C (CHead c2 k u1)) H13)))) x H12)) u (sym_eq T u u1 H11))) +k0 (sym_eq K k0 k H10))) c0 (sym_eq C c0 c1 H9))) H8)) H7))) v0 (sym_eq T v0 +v H5))) i H1 H2 H3 H4 H0))))) | (csubst0_both k0 i0 v0 u0 u2 H0 c0 c2 H1) +\Rightarrow (\lambda (H2: (eq nat (s k0 i0) i)).(\lambda (H3: (eq T v0 +v)).(\lambda (H4: (eq C (CHead c0 k0 u0) (CHead c1 k u1))).(\lambda (H5: (eq +C (CHead c2 k0 u2) x)).(eq_ind nat (s k0 i0) (\lambda (n: nat).((eq T v0 v) +\to ((eq C (CHead c0 k0 u0) (CHead c1 k u1)) \to ((eq C (CHead c2 k0 u2) x) +\to ((subst0 i0 v0 u0 u2) \to ((csubst0 i0 v0 c0 c2) \to (or3 (ex3_2 T nat +(\lambda (_: T).(\lambda (j: nat).(eq nat n (s k j)))) (\lambda (u3: +T).(\lambda (_: nat).(eq C x (CHead c1 k u3)))) (\lambda (u3: T).(\lambda (j: +nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat n (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 k +u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat n (s k j))))) +(\lambda (u3: T).(\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 k +u3))))) (\lambda (u3: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u3)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 +c3)))))))))))) (\lambda (H6: (eq T v0 v)).(eq_ind T v (\lambda (t: T).((eq C +(CHead c0 k0 u0) (CHead c1 k u1)) \to ((eq C (CHead c2 k0 u2) x) \to ((subst0 +i0 t u0 u2) \to ((csubst0 i0 t c0 c2) \to (or3 (ex3_2 T nat (\lambda (_: +T).(\lambda (j: nat).(eq nat (s k0 i0) (s k j)))) (\lambda (u3: T).(\lambda +(_: nat).(eq C x (CHead c1 k u3)))) (\lambda (u3: T).(\lambda (j: +nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k0 i0) (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k0 i0) (s k +j))))) (\lambda (u3: T).(\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u3))))) (\lambda (u3: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u3)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 +c3))))))))))) (\lambda (H7: (eq C (CHead c0 k0 u0) (CHead c1 k u1))).(let H8 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u0 | (CHead _ _ t) \Rightarrow t])) (CHead c0 k0 +u0) (CHead c1 k u1) H7) in ((let H9 \def (f_equal C K (\lambda (e: C).(match +e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | (CHead _ k1 +_) \Rightarrow k1])) (CHead c0 k0 u0) (CHead c1 k u1) H7) in ((let H10 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) (CHead c0 k0 u0) +(CHead c1 k u1) H7) in (eq_ind C c1 (\lambda (c: C).((eq K k0 k) \to ((eq T +u0 u1) \to ((eq C (CHead c2 k0 u2) x) \to ((subst0 i0 v u0 u2) \to ((csubst0 +i0 v c c2) \to (or3 (ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat (s +k0 i0) (s k j)))) (\lambda (u3: T).(\lambda (_: nat).(eq C x (CHead c1 k +u3)))) (\lambda (u3: T).(\lambda (j: nat).(subst0 j v u1 u3)))) (ex3_2 C nat +(\lambda (_: C).(\lambda (j: nat).(eq nat (s k0 i0) (s k j)))) (\lambda (c3: +C).(\lambda (_: nat).(eq C x (CHead c3 k u1)))) (\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c1 c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat (s k0 i0) (s k j))))) (\lambda (u3: T).(\lambda +(c3: C).(\lambda (_: nat).(eq C x (CHead c3 k u3))))) (\lambda (u3: +T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 u3)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3)))))))))))) (\lambda +(H11: (eq K k0 k)).(eq_ind K k (\lambda (k1: K).((eq T u0 u1) \to ((eq C +(CHead c2 k1 u2) x) \to ((subst0 i0 v u0 u2) \to ((csubst0 i0 v c1 c2) \to +(or3 (ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat (s k1 i0) (s k +j)))) (\lambda (u3: T).(\lambda (_: nat).(eq C x (CHead c1 k u3)))) (\lambda +(u3: T).(\lambda (j: nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat (s k1 i0) (s k j)))) (\lambda (c3: C).(\lambda +(_: nat).(eq C x (CHead c3 k u1)))) (\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c1 c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat (s k1 i0) (s k j))))) (\lambda (u3: T).(\lambda +(c3: C).(\lambda (_: nat).(eq C x (CHead c3 k u3))))) (\lambda (u3: +T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 u3)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3))))))))))) (\lambda +(H12: (eq T u0 u1)).(eq_ind T u1 (\lambda (t: T).((eq C (CHead c2 k u2) x) +\to ((subst0 i0 v t u2) \to ((csubst0 i0 v c1 c2) \to (or3 (ex3_2 T nat +(\lambda (_: T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (u3: +T).(\lambda (_: nat).(eq C x (CHead c1 k u3)))) (\lambda (u3: T).(\lambda (j: +nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: C).(\lambda (j: nat).(eq +nat (s k i0) (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3)))) (ex4_3 T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k i0) (s k +j))))) (\lambda (u3: T).(\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u3))))) (\lambda (u3: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u3)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 +c3)))))))))) (\lambda (H13: (eq C (CHead c2 k u2) x)).(eq_ind C (CHead c2 k +u2) (\lambda (c: C).((subst0 i0 v u1 u2) \to ((csubst0 i0 v c1 c2) \to (or3 +(ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) +(\lambda (u3: T).(\lambda (_: nat).(eq C c (CHead c1 k u3)))) (\lambda (u3: +T).(\lambda (j: nat).(subst0 j v u1 u3)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (c3: C).(\lambda +(_: nat).(eq C c (CHead c3 k u1)))) (\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c1 c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat (s k i0) (s k j))))) (\lambda (u3: T).(\lambda +(c3: C).(\lambda (_: nat).(eq C c (CHead c3 k u3))))) (\lambda (u3: +T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 u3)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3))))))))) (\lambda +(H14: (subst0 i0 v u1 u2)).(\lambda (H15: (csubst0 i0 v c1 c2)).(let H16 \def +(eq_ind K k0 (\lambda (k1: K).(eq nat (s k1 i0) i)) H2 k H11) in (or3_intro2 +(ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) +(\lambda (u3: T).(\lambda (_: nat).(eq C (CHead c2 k u2) (CHead c1 k u3)))) +(\lambda (u3: T).(\lambda (j: nat).(subst0 j v u1 u3)))) (ex3_2 C nat +(\lambda (_: C).(\lambda (j: nat).(eq nat (s k i0) (s k j)))) (\lambda (c3: +C).(\lambda (_: nat).(eq C (CHead c2 k u2) (CHead c3 k u1)))) (\lambda (c3: +C).(\lambda (j: nat).(csubst0 j v c1 c3)))) (ex4_3 T C nat (\lambda (_: +T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k i0) (s k j))))) (\lambda +(u3: T).(\lambda (c3: C).(\lambda (_: nat).(eq C (CHead c2 k u2) (CHead c3 k +u3))))) (\lambda (u3: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u3)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 +c3))))) (ex4_3_intro T C nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: +nat).(eq nat (s k i0) (s k j))))) (\lambda (u3: T).(\lambda (c3: C).(\lambda +(_: nat).(eq C (CHead c2 k u2) (CHead c3 k u3))))) (\lambda (u3: T).(\lambda +(_: C).(\lambda (j: nat).(subst0 j v u1 u3)))) (\lambda (_: T).(\lambda (c3: +C).(\lambda (j: nat).(csubst0 j v c1 c3)))) u2 c2 i0 (refl_equal nat (s k +i0)) (refl_equal C (CHead c2 k u2)) H14 H15))))) x H13)) u0 (sym_eq T u0 u1 +H12))) k0 (sym_eq K k0 k H11))) c0 (sym_eq C c0 c1 H10))) H9)) H8))) v0 +(sym_eq T v0 v H6))) i H2 H3 H4 H5 H0 H1)))))]) in (H0 (refl_equal nat i) +(refl_equal T v) (refl_equal C (CHead c1 k u1)) (refl_equal C x))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/getl.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/getl.ma new file mode 100644 index 000000000..d4ccb6ee5 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/getl.ma @@ -0,0 +1,1105 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst0/getl". + +include "csubst0/clear.ma". + +include "csubst0/drop.ma". + +include "getl/fwd.ma". + +theorem csubst0_getl_ge: + \forall (i: nat).(\forall (n: nat).((le i n) \to (\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst0 i v c1 c2) \to (\forall (e: C).((getl n c1 +e) \to (getl n c2 e))))))))) +\def + \lambda (i: nat).(\lambda (n: nat).(\lambda (H: (le i n)).(\lambda (c1: +C).(\lambda (c2: C).(\lambda (v: T).(\lambda (H0: (csubst0 i v c1 +c2)).(\lambda (e: C).(\lambda (H1: (getl n c1 e)).(let H2 \def (getl_gen_all +c1 e n H1) in (ex2_ind C (\lambda (e0: C).(drop n O c1 e0)) (\lambda (e0: +C).(clear e0 e)) (getl n c2 e) (\lambda (x: C).(\lambda (H3: (drop n O c1 +x)).(\lambda (H4: (clear x e)).(lt_eq_gt_e i n (getl n c2 e) (\lambda (H5: +(lt i n)).(getl_intro n c2 e x (csubst0_drop_gt n i H5 c1 c2 v H0 x H3) H4)) +(\lambda (H5: (eq nat i n)).(let H6 \def (eq_ind_r nat n (\lambda (n0: +nat).(drop n0 O c1 x)) H3 i H5) in (let H7 \def (eq_ind_r nat n (\lambda (n0: +nat).(le i n0)) H i H5) in (eq_ind nat i (\lambda (n0: nat).(getl n0 c2 e)) +(let H8 \def (csubst0_drop_eq i c1 c2 v H0 x H6) in (or4_ind (drop i O c2 x) +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C x (CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop i O c2 (CHead e0 (Flat f) w)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u +w)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C x (CHead e1 (Flat f) u)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop i O c2 (CHead e2 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C x (CHead e1 +(Flat f) u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(drop i O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (getl i c2 e) (\lambda (H9: +(drop i O c2 x)).(getl_intro i c2 e x H9 H4)) (\lambda (H9: (ex3_4 F C T T +(\lambda (f: F).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C x +(CHead e0 (Flat f) u)))))) (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop i O c2 (CHead e0 (Flat f) w)))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u +w))))))).(ex3_4_ind F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C x (CHead e0 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(drop i O c2 (CHead e0 +(Flat f) w)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 O v u w))))) (getl i c2 e) (\lambda (x0: F).(\lambda (x1: +C).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H10: (eq C x (CHead x1 (Flat +x0) x2))).(\lambda (H11: (drop i O c2 (CHead x1 (Flat x0) x3))).(\lambda (_: +(subst0 O v x2 x3)).(let H13 \def (eq_ind C x (\lambda (c: C).(clear c e)) H4 +(CHead x1 (Flat x0) x2) H10) in (getl_intro i c2 e (CHead x1 (Flat x0) x3) +H11 (clear_flat x1 e (clear_gen_flat x0 x1 e x2 H13) x0 x3)))))))))) H9)) +(\lambda (H9: (ex3_4 F C C T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C x (CHead e1 (Flat f) u)))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop i O c2 (CHead e2 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2))))))).(ex3_4_ind F C C T (\lambda (f: F).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(eq C x (CHead e1 (Flat f) u)))))) +(\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(drop i O c2 +(CHead e2 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2))))) (getl i c2 e) (\lambda (x0: +F).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H10: (eq C x +(CHead x1 (Flat x0) x3))).(\lambda (H11: (drop i O c2 (CHead x2 (Flat x0) +x3))).(\lambda (H12: (csubst0 O v x1 x2)).(let H13 \def (eq_ind C x (\lambda +(c: C).(clear c e)) H4 (CHead x1 (Flat x0) x3) H10) in (getl_intro i c2 e +(CHead x2 (Flat x0) x3) H11 (clear_flat x2 e (csubst0_clear_O x1 x2 v H12 e +(clear_gen_flat x0 x1 e x3 H13)) x0 x3)))))))))) H9)) (\lambda (H9: (ex4_5 F +C C T T (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C x (CHead e1 (Flat f) u))))))) (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop i O +c2 (CHead e2 (Flat f) w))))))) (\lambda (_: F).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 O v u w)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2)))))))).(ex4_5_ind F C C T T (\lambda (f: F).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C x (CHead e1 (Flat f) +u))))))) (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop i O c2 (CHead e2 (Flat f) w))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 O +v u w)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 O v e1 e2)))))) (getl i c2 e) (\lambda (x0: +F).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (H10: (eq C x (CHead x1 (Flat x0) x3))).(\lambda (H11: (drop i O +c2 (CHead x2 (Flat x0) x4))).(\lambda (_: (subst0 O v x3 x4)).(\lambda (H13: +(csubst0 O v x1 x2)).(let H14 \def (eq_ind C x (\lambda (c: C).(clear c e)) +H4 (CHead x1 (Flat x0) x3) H10) in (getl_intro i c2 e (CHead x2 (Flat x0) x4) +H11 (clear_flat x2 e (csubst0_clear_O x1 x2 v H13 e (clear_gen_flat x0 x1 e +x3 H14)) x0 x4)))))))))))) H9)) H8)) n H5)))) (\lambda (H5: (lt n +i)).(le_lt_false i n H H5 (getl n c2 e))))))) H2)))))))))). + +theorem csubst0_getl_lt: + \forall (i: nat).(\forall (n: nat).((lt n i) \to (\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst0 i v c1 c2) \to (\forall (e: C).((getl n c1 +e) \to (or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))))))))))))) +\def + \lambda (i: nat).(\lambda (n: nat).(\lambda (H: (lt n i)).(\lambda (c1: +C).(\lambda (c2: C).(\lambda (v: T).(\lambda (H0: (csubst0 i v c1 +c2)).(\lambda (e: C).(\lambda (H1: (getl n c1 e)).(let H2 \def (getl_gen_all +c1 e n H1) in (ex2_ind C (\lambda (e0: C).(drop n O c1 e0)) (\lambda (e0: +C).(clear e0 e)) (or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))))) (\lambda (x: +C).(\lambda (H3: (drop n O c1 x)).(\lambda (H4: (clear x e)).(let H5 \def +(csubst0_drop_lt n i H c1 c2 v H0 x H3) in (or4_ind (drop n O c2 x) (ex3_4 K +C T T (\lambda (k: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C +x (CHead e0 k u)))))) (\lambda (k: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop n O c2 (CHead e0 k w)))))) (\lambda (k: K).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k n)) v u w)))))) +(ex3_4 K C C T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(eq C x (CHead e1 k u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop n O c2 (CHead e2 k u)))))) (\lambda (k: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (s k n)) v e1 +e2)))))) (ex4_5 K C C T T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C x (CHead e1 k u))))))) (\lambda (k: +K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(drop n O +c2 (CHead e2 k w))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k n)) v u w)))))) +(\lambda (k: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (s k n)) v e1 e2))))))) (or4 (getl n c2 e) (ex3_4 B +C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C +e (CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))))) (\lambda (H6: (drop n O c2 x)).(or4_intro0 (getl n c2 e) +(ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 +(CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 +(Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2))))))) (getl_intro n c2 e x H6 H4))) (\lambda (H6: +(ex3_4 K C T T (\lambda (k: K).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C x (CHead e0 k u)))))) (\lambda (k: K).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(drop n O c2 (CHead e0 k w)))))) (\lambda (k: K).(\lambda +(_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k n)) v u +w))))))).(ex3_4_ind K C T T (\lambda (k: K).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C x (CHead e0 k u)))))) (\lambda (k: K).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(drop n O c2 (CHead e0 k w)))))) (\lambda +(k: K).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k +n)) v u w))))) (or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))))) (\lambda (x0: +K).(\lambda (x1: C).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H7: (eq C x +(CHead x1 x0 x2))).(\lambda (H8: (drop n O c2 (CHead x1 x0 x3))).(\lambda +(H9: (subst0 (minus i (s x0 n)) v x2 x3)).(let H10 \def (eq_ind C x (\lambda +(c: C).(clear c e)) H4 (CHead x1 x0 x2) H7) in (K_ind (\lambda (k: K).((drop +n O c2 (CHead x1 k x3)) \to ((subst0 (minus i (s k n)) v x2 x3) \to ((clear +(CHead x1 k x2) e) \to (or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind +b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C e (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))))))))) (\lambda (b: +B).(\lambda (H11: (drop n O c2 (CHead x1 (Bind b) x3))).(\lambda (H12: +(subst0 (minus i (s (Bind b) n)) v x2 x3)).(\lambda (H13: (clear (CHead x1 +(Bind b) x2) e)).(eq_ind_r C (CHead x1 (Bind b) x2) (\lambda (c: C).(or4 +(getl n c2 c) (ex3_4 B C T T (\lambda (b0: B).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C c (CHead e0 (Bind b0) u)))))) (\lambda (b0: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 +(Bind b0) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda +(w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b0: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c (CHead e1 (Bind +b0) u)))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(getl n c2 (CHead e2 (Bind b0) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C c (CHead e1 (Bind b0) u))))))) (\lambda (b0: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n +c2 (CHead e2 (Bind b0) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2))))))))) (or4_intro1 (getl n c2 +(CHead x1 (Bind b) x2)) (ex3_4 B C T T (\lambda (b0: B).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Bind b) x2) (CHead e0 +(Bind b0) u)))))) (\lambda (b0: B).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(getl n c2 (CHead e0 (Bind b0) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C (CHead x1 (Bind b) x2) (CHead e1 (Bind b0) u)))))) (\lambda (b0: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 +(Bind b0) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b0: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +(CHead x1 (Bind b) x2) (CHead e1 (Bind b0) u))))))) (\lambda (b0: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 +(Bind b0) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2))))))) (ex3_4_intro B C T T (\lambda (b0: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Bind b) x2) (CHead +e0 (Bind b0) u)))))) (\lambda (b0: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b0) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w))))) b x1 x2 x3 (refl_equal C (CHead x1 (Bind b) x2)) (getl_intro n c2 +(CHead x1 (Bind b) x3) (CHead x1 (Bind b) x3) H11 (clear_bind b x1 x3)) H12)) +e (clear_gen_bind b x1 e x2 H13)))))) (\lambda (f: F).(\lambda (H11: (drop n +O c2 (CHead x1 (Flat f) x3))).(\lambda (_: (subst0 (minus i (s (Flat f) n)) v +x2 x3)).(\lambda (H13: (clear (CHead x1 (Flat f) x2) e)).(or4_intro0 (getl n +c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 +(Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n +c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2))))))) (getl_intro n c2 e (CHead x1 +(Flat f) x3) H11 (clear_flat x1 e (clear_gen_flat f x1 e x2 H13) f x3))))))) +x0 H8 H9 H10))))))))) H6)) (\lambda (H6: (ex3_4 K C C T (\lambda (k: +K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C x (CHead e1 k +u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(drop n O c2 (CHead e2 k u)))))) (\lambda (k: K).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(csubst0 (minus i (s k n)) v e1 e2))))))).(ex3_4_ind +K C C T (\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C x (CHead e1 k u)))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(drop n O c2 (CHead e2 k u)))))) (\lambda (k: K).(\lambda +(e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (s k n)) v e1 +e2))))) (or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))))) (\lambda (x0: +K).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H7: (eq C x +(CHead x1 x0 x3))).(\lambda (H8: (drop n O c2 (CHead x2 x0 x3))).(\lambda +(H9: (csubst0 (minus i (s x0 n)) v x1 x2)).(let H10 \def (eq_ind C x (\lambda +(c: C).(clear c e)) H4 (CHead x1 x0 x3) H7) in (K_ind (\lambda (k: K).((drop +n O c2 (CHead x2 k x3)) \to ((csubst0 (minus i (s k n)) v x1 x2) \to ((clear +(CHead x1 k x3) e) \to (or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind +b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C e (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))))))))) (\lambda (b: +B).(\lambda (H11: (drop n O c2 (CHead x2 (Bind b) x3))).(\lambda (H12: +(csubst0 (minus i (s (Bind b) n)) v x1 x2)).(\lambda (H13: (clear (CHead x1 +(Bind b) x3) e)).(eq_ind_r C (CHead x1 (Bind b) x3) (\lambda (c: C).(or4 +(getl n c2 c) (ex3_4 B C T T (\lambda (b0: B).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C c (CHead e0 (Bind b0) u)))))) (\lambda (b0: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 +(Bind b0) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda +(w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b0: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c (CHead e1 (Bind +b0) u)))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(getl n c2 (CHead e2 (Bind b0) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C c (CHead e1 (Bind b0) u))))))) (\lambda (b0: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n +c2 (CHead e2 (Bind b0) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2))))))))) (or4_intro2 (getl n c2 +(CHead x1 (Bind b) x3)) (ex3_4 B C T T (\lambda (b0: B).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Bind b) x3) (CHead e0 +(Bind b0) u)))))) (\lambda (b0: B).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(getl n c2 (CHead e0 (Bind b0) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C (CHead x1 (Bind b) x3) (CHead e1 (Bind b0) u)))))) (\lambda (b0: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 +(Bind b0) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b0: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C +(CHead x1 (Bind b) x3) (CHead e1 (Bind b0) u))))))) (\lambda (b0: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 +(Bind b0) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2))))))) (ex3_4_intro B C C T (\lambda (b0: B).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x1 (Bind b) x3) (CHead +e1 (Bind b0) u)))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b0) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2))))) b x1 x2 x3 (refl_equal C (CHead x1 (Bind b) x3)) (getl_intro n +c2 (CHead x2 (Bind b) x3) (CHead x2 (Bind b) x3) H11 (clear_bind b x2 x3)) +H12)) e (clear_gen_bind b x1 e x3 H13)))))) (\lambda (f: F).(\lambda (H11: +(drop n O c2 (CHead x2 (Flat f) x3))).(\lambda (H12: (csubst0 (minus i (s +(Flat f) n)) v x1 x2)).(\lambda (H13: (clear (CHead x1 (Flat f) x3) e)).(let +H14 \def (eq_ind nat (minus i n) (\lambda (n0: nat).(csubst0 n0 v x1 x2)) H12 +(S (minus i (S n))) (minus_x_Sy i n H)) in (let H15 \def (csubst0_clear_S x1 +x2 v (minus i (S n)) H14 e (clear_gen_flat f x1 e x3 H13)) in (or4_ind (clear +x2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u1)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(clear x2 (CHead e0 +(Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 (minus i (S n)) v u1 u2)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear x2 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u1))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(clear +x2 (CHead e2 (Bind b) u2))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (u2: T).(subst0 (minus i (S n)) v u1 u2)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2))))))) (or4 (getl n c2 e) (ex3_4 B C +T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))))) (\lambda (H16: (clear x2 e)).(or4_intro0 (getl n c2 e) (ex3_4 +B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq +C e (CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2))))))) (getl_intro n c2 e (CHead x2 (Flat f) x3) H11 (clear_flat x2 e +H16 f x3)))) (\lambda (H16: (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(clear x2 +(CHead e0 (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 (minus i (S n)) v u1 u2))))))).(ex3_4_ind B C T T +(\lambda (b: B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C e +(CHead e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u2: T).(clear x2 (CHead e0 (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 (minus i (S n)) +v u1 u2))))) (or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))))) (\lambda (x4: +B).(\lambda (x5: C).(\lambda (x6: T).(\lambda (x7: T).(\lambda (H17: (eq C e +(CHead x5 (Bind x4) x6))).(\lambda (H18: (clear x2 (CHead x5 (Bind x4) +x7))).(\lambda (H19: (subst0 (minus i (S n)) v x6 x7)).(eq_ind_r C (CHead x5 +(Bind x4) x6) (\lambda (c: C).(or4 (getl n c2 c) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e0 (Bind +b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C c (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))))))) (or4_intro1 +(getl n c2 (CHead x5 (Bind x4) x6)) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x5 (Bind x4) x6) (CHead +e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C (CHead x5 (Bind x4) x6) (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x5 (Bind x4) +x6) (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2))))))) (ex3_4_intro B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C (CHead x5 (Bind x4) x6) (CHead e0 (Bind b) +u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w))))) x4 x5 +x6 x7 (refl_equal C (CHead x5 (Bind x4) x6)) (getl_intro n c2 (CHead x5 (Bind +x4) x7) (CHead x2 (Flat f) x3) H11 (clear_flat x2 (CHead x5 (Bind x4) x7) H18 +f x3)) H19)) e H17)))))))) H16)) (\lambda (H16: (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear x2 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 +e2))))))).(ex3_4_ind B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear x2 (CHead e2 (Bind +b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i (S n)) v e1 e2))))) (or4 (getl n c2 e) (ex3_4 B C T T +(\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))))) (\lambda (x4: B).(\lambda (x5: C).(\lambda (x6: C).(\lambda +(x7: T).(\lambda (H17: (eq C e (CHead x5 (Bind x4) x7))).(\lambda (H18: +(clear x2 (CHead x6 (Bind x4) x7))).(\lambda (H19: (csubst0 (minus i (S n)) v +x5 x6)).(eq_ind_r C (CHead x5 (Bind x4) x7) (\lambda (c: C).(or4 (getl n c2 +c) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C c (CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 +(CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C c (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 +(Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2))))))))) (or4_intro2 (getl n c2 (CHead x5 (Bind x4) +x7)) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C (CHead x5 (Bind x4) x7) (CHead e0 (Bind b) u)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 +(Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x5 (Bind x4) +x7) (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x5 (Bind x4) x7) (CHead e1 +(Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))))) +(ex3_4_intro B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C (CHead x5 (Bind x4) x7) (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 +(CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))) x4 x5 x6 x7 +(refl_equal C (CHead x5 (Bind x4) x7)) (getl_intro n c2 (CHead x6 (Bind x4) +x7) (CHead x2 (Flat f) x3) H11 (clear_flat x2 (CHead x6 (Bind x4) x7) H18 f +x3)) H19)) e H17)))))))) H16)) (\lambda (H16: (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C e +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear x2 (CHead e2 (Bind b) u2))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 (minus i (S n)) v u1 u2)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))))).(ex4_5_ind B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C e (CHead e1 (Bind +b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(clear x2 (CHead e2 (Bind b) u2))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +(minus i (S n)) v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) +(or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 +(Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n +c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))))) (\lambda (x4: B).(\lambda +(x5: C).(\lambda (x6: C).(\lambda (x7: T).(\lambda (x8: T).(\lambda (H17: (eq +C e (CHead x5 (Bind x4) x7))).(\lambda (H18: (clear x2 (CHead x6 (Bind x4) +x8))).(\lambda (H19: (subst0 (minus i (S n)) v x7 x8)).(\lambda (H20: +(csubst0 (minus i (S n)) v x5 x6)).(eq_ind_r C (CHead x5 (Bind x4) x7) +(\lambda (c: C).(or4 (getl n c2 c) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e0 (Bind b) u)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))))))) (or4_intro3 +(getl n c2 (CHead x5 (Bind x4) x7)) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x5 (Bind x4) x7) (CHead +e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C (CHead x5 (Bind x4) x7) (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x5 (Bind x4) +x7) (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2))))))) (ex4_5_intro B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x5 (Bind x4) +x7) (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) x4 x5 x6 x7 x8 (refl_equal C (CHead x5 (Bind x4) x7)) +(getl_intro n c2 (CHead x6 (Bind x4) x8) (CHead x2 (Flat f) x3) H11 +(clear_flat x2 (CHead x6 (Bind x4) x8) H18 f x3)) H19 H20)) e H17)))))))))) +H16)) H15))))))) x0 H8 H9 H10))))))))) H6)) (\lambda (H6: (ex4_5 K C C T T +(\lambda (k: K).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C x (CHead e1 k u))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(drop n O c2 (CHead e2 k w))))))) (\lambda +(k: K).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (s k n)) v u w)))))) (\lambda (k: K).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (s k +n)) v e1 e2)))))))).(ex4_5_ind K C C T T (\lambda (k: K).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C x (CHead e1 k +u))))))) (\lambda (k: K).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(drop n O c2 (CHead e2 k w))))))) (\lambda (k: K).(\lambda +(_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (s k +n)) v u w)))))) (\lambda (k: K).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 (minus i (s k n)) v e1 e2)))))) (or4 (getl n +c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 +(Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n +c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))))) (\lambda (x0: K).(\lambda +(x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H7: (eq +C x (CHead x1 x0 x3))).(\lambda (H8: (drop n O c2 (CHead x2 x0 x4))).(\lambda +(H9: (subst0 (minus i (s x0 n)) v x3 x4)).(\lambda (H10: (csubst0 (minus i (s +x0 n)) v x1 x2)).(let H11 \def (eq_ind C x (\lambda (c: C).(clear c e)) H4 +(CHead x1 x0 x3) H7) in (K_ind (\lambda (k: K).((drop n O c2 (CHead x2 k x4)) +\to ((subst0 (minus i (s k n)) v x3 x4) \to ((csubst0 (minus i (s k n)) v x1 +x2) \to ((clear (CHead x1 k x3) e) \to (or4 (getl n c2 e) (ex3_4 B C T T +(\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2))))))))))))) (\lambda (b: B).(\lambda (H12: (drop n O c2 (CHead x2 +(Bind b) x4))).(\lambda (H13: (subst0 (minus i (s (Bind b) n)) v x3 +x4)).(\lambda (H14: (csubst0 (minus i (s (Bind b) n)) v x1 x2)).(\lambda +(H15: (clear (CHead x1 (Bind b) x3) e)).(eq_ind_r C (CHead x1 (Bind b) x3) +(\lambda (c: C).(or4 (getl n c2 c) (ex3_4 B C T T (\lambda (b0: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e0 (Bind b0) u)))))) +(\lambda (b0: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b0) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c +(CHead e1 (Bind b0) u)))))) (\lambda (b0: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b0) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e1 (Bind b0) u))))))) +(\lambda (b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(getl n c2 (CHead e2 (Bind b0) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))))))) (or4_intro3 +(getl n c2 (CHead x1 (Bind b) x3)) (ex3_4 B C T T (\lambda (b0: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x1 (Bind b) x3) (CHead +e0 (Bind b0) u)))))) (\lambda (b0: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b0) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (ex3_4 B C C T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C (CHead x1 (Bind b) x3) (CHead e1 (Bind b0) u)))))) +(\lambda (b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 +(CHead e2 (Bind b0) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(eq C (CHead x1 (Bind b) x3) (CHead e1 (Bind b0) u))))))) (\lambda +(b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b0) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))))) (ex4_5_intro B C C +T T (\lambda (b0: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(eq C (CHead x1 (Bind b) x3) (CHead e1 (Bind b0) u))))))) +(\lambda (b0: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(w: T).(getl n c2 (CHead e2 (Bind b0) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) b x1 x2 x3 x4 +(refl_equal C (CHead x1 (Bind b) x3)) (getl_intro n c2 (CHead x2 (Bind b) x4) +(CHead x2 (Bind b) x4) H12 (clear_bind b x2 x4)) H13 H14)) e (clear_gen_bind +b x1 e x3 H15))))))) (\lambda (f: F).(\lambda (H12: (drop n O c2 (CHead x2 +(Flat f) x4))).(\lambda (_: (subst0 (minus i (s (Flat f) n)) v x3 +x4)).(\lambda (H14: (csubst0 (minus i (s (Flat f) n)) v x1 x2)).(\lambda +(H15: (clear (CHead x1 (Flat f) x3) e)).(let H16 \def (eq_ind nat (minus i n) +(\lambda (n0: nat).(csubst0 n0 v x1 x2)) H14 (S (minus i (S n))) (minus_x_Sy +i n H)) in (let H17 \def (csubst0_clear_S x1 x2 v (minus i (S n)) H16 e +(clear_gen_flat f x1 e x3 H15)) in (or4_ind (clear x2 e) (ex3_4 B C T T +(\lambda (b: B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C e +(CHead e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u2: T).(clear x2 (CHead e0 (Bind b) u2)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 (minus i (S n)) +v u1 u2)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear x2 (CHead e2 (Bind +b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C e +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear x2 (CHead e2 (Bind b) u2))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 (minus i (S n)) v u1 u2)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2))))))) (or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))))) (\lambda (H18: +(clear x2 e)).(or4_intro0 (getl n c2 e) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind +b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C e (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))))) (getl_intro n c2 e +(CHead x2 (Flat f) x4) H12 (clear_flat x2 e H18 f x4)))) (\lambda (H18: +(ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: +T).(eq C e (CHead e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: +C).(\lambda (_: T).(\lambda (u2: T).(clear x2 (CHead e0 (Bind b) u2)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +(minus i (S n)) v u1 u2))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: T).(clear x2 +(CHead e0 (Bind b) u2)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (u2: T).(subst0 (minus i (S n)) v u1 u2))))) (or4 (getl n c2 e) +(ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 +(CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C e (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 +(Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2)))))))) (\lambda (x5: B).(\lambda (x6: C).(\lambda +(x7: T).(\lambda (x8: T).(\lambda (H19: (eq C e (CHead x6 (Bind x5) +x7))).(\lambda (H20: (clear x2 (CHead x6 (Bind x5) x8))).(\lambda (H21: +(subst0 (minus i (S n)) v x7 x8)).(eq_ind_r C (CHead x6 (Bind x5) x7) +(\lambda (c: C).(or4 (getl n c2 c) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e0 (Bind b) u)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))))))) (or4_intro1 +(getl n c2 (CHead x6 (Bind x5) x7)) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x6 (Bind x5) x7) (CHead +e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C (CHead x6 (Bind x5) x7) (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x6 (Bind x5) +x7) (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2))))))) (ex3_4_intro B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C (CHead x6 (Bind x5) x7) (CHead e0 (Bind b) +u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w))))) x5 x6 +x7 x8 (refl_equal C (CHead x6 (Bind x5) x7)) (getl_intro n c2 (CHead x6 (Bind +x5) x8) (CHead x2 (Flat f) x4) H12 (clear_flat x2 (CHead x6 (Bind x5) x8) H20 +f x4)) H21)) e H19)))))))) H18)) (\lambda (H18: (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(clear x2 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 +e2))))))).(ex3_4_ind B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(clear x2 (CHead e2 (Bind +b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i (S n)) v e1 e2))))) (or4 (getl n c2 e) (ex3_4 B C T T +(\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C e (CHead e1 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e +(CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))))) (\lambda (x5: B).(\lambda (x6: C).(\lambda (x7: C).(\lambda +(x8: T).(\lambda (H19: (eq C e (CHead x6 (Bind x5) x8))).(\lambda (H20: +(clear x2 (CHead x7 (Bind x5) x8))).(\lambda (H21: (csubst0 (minus i (S n)) v +x6 x7)).(eq_ind_r C (CHead x6 (Bind x5) x8) (\lambda (c: C).(or4 (getl n c2 +c) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C c (CHead e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(eq C c (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 +(CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: +T).(eq C c (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 +(Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2))))))))) (or4_intro2 (getl n c2 (CHead x6 (Bind x5) +x8)) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: T).(\lambda +(_: T).(eq C (CHead x6 (Bind x5) x8) (CHead e0 (Bind b) u)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 +(Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C (CHead x6 (Bind x5) +x8) (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x6 (Bind x5) x8) (CHead e1 +(Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))))) +(ex3_4_intro B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(eq C (CHead x6 (Bind x5) x8) (CHead e1 (Bind b) u)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 +(CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))) x5 x6 x7 x8 +(refl_equal C (CHead x6 (Bind x5) x8)) (getl_intro n c2 (CHead x7 (Bind x5) +x8) (CHead x2 (Flat f) x4) H12 (clear_flat x2 (CHead x7 (Bind x5) x8) H20 f +x4)) H21)) e H19)))))))) H18)) (\lambda (H18: (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C e +(CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (u2: T).(clear x2 (CHead e2 (Bind b) u2))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 (minus i (S n)) v u1 u2)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))))).(ex4_5_ind B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C e (CHead e1 (Bind +b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (u2: T).(clear x2 (CHead e2 (Bind b) u2))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +(minus i (S n)) v u1 u2)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) +(or4 (getl n c2 e) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e0 (Bind b) u)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e0 +(Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C e (CHead e1 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u: +T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C e (CHead e1 (Bind b) u))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n +c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) v e1 e2)))))))) (\lambda (x5: B).(\lambda +(x6: C).(\lambda (x7: C).(\lambda (x8: T).(\lambda (x9: T).(\lambda (H19: (eq +C e (CHead x6 (Bind x5) x8))).(\lambda (H20: (clear x2 (CHead x7 (Bind x5) +x9))).(\lambda (H21: (subst0 (minus i (S n)) v x8 x9)).(\lambda (H22: +(csubst0 (minus i (S n)) v x6 x7)).(eq_ind_r C (CHead x6 (Bind x5) x8) +(\lambda (c: C).(or4 (getl n c2 c) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e0 (Bind b) u)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c2 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: +T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq C c +(CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (_: T).(eq C c (CHead e1 (Bind b) u))))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: +T).(getl n c2 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v +u w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (_: T).(csubst0 (minus i (S n)) v e1 e2))))))))) (or4_intro3 +(getl n c2 (CHead x6 (Bind x5) x8)) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x6 (Bind x5) x8) (CHead +e0 (Bind b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(getl n c2 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(eq +C (CHead x6 (Bind x5) x8) (CHead e1 (Bind b) u)))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(getl n c2 (CHead e2 (Bind b) u)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 +(minus i (S n)) v e1 e2)))))) (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x6 (Bind x5) +x8) (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2))))))) (ex4_5_intro B C C T T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C (CHead x6 (Bind x5) +x8) (CHead e1 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (w: T).(getl n c2 (CHead e2 (Bind b) w))))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) +v e1 e2)))))) x5 x6 x7 x8 x9 (refl_equal C (CHead x6 (Bind x5) x8)) +(getl_intro n c2 (CHead x7 (Bind x5) x9) (CHead x2 (Flat f) x4) H12 +(clear_flat x2 (CHead x7 (Bind x5) x9) H20 f x4)) H21 H22)) e H19)))))))))) +H18)) H17)))))))) x0 H8 H9 H10 H11))))))))))) H6)) H5))))) H2)))))))))). + +theorem csubst0_getl_ge_back: + \forall (i: nat).(\forall (n: nat).((le i n) \to (\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst0 i v c1 c2) \to (\forall (e: C).((getl n c2 +e) \to (getl n c1 e))))))))) +\def + \lambda (i: nat).(\lambda (n: nat).(\lambda (H: (le i n)).(\lambda (c1: +C).(\lambda (c2: C).(\lambda (v: T).(\lambda (H0: (csubst0 i v c1 +c2)).(\lambda (e: C).(\lambda (H1: (getl n c2 e)).(let H2 \def (getl_gen_all +c2 e n H1) in (ex2_ind C (\lambda (e0: C).(drop n O c2 e0)) (\lambda (e0: +C).(clear e0 e)) (getl n c1 e) (\lambda (x: C).(\lambda (H3: (drop n O c2 +x)).(\lambda (H4: (clear x e)).(lt_eq_gt_e i n (getl n c1 e) (\lambda (H5: +(lt i n)).(getl_intro n c1 e x (csubst0_drop_gt_back n i H5 c1 c2 v H0 x H3) +H4)) (\lambda (H5: (eq nat i n)).(let H6 \def (eq_ind_r nat n (\lambda (n0: +nat).(drop n0 O c2 x)) H3 i H5) in (let H7 \def (eq_ind_r nat n (\lambda (n0: +nat).(le i n0)) H i H5) in (eq_ind nat i (\lambda (n0: nat).(getl n0 c1 e)) +(let H8 \def (csubst0_drop_eq_back i c1 c2 v H0 x H6) in (or4_ind (drop i O +c1 x) (ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u2: T).(eq C x (CHead e0 (Flat f) u2)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop i O c1 (CHead e0 +(Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (ex3_4 F C C T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (u: T).(eq C x (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop i O c1 +(CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2)))))) (ex4_5 F C C T T (\lambda (f: +F).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C x +(CHead e2 (Flat f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(drop i O c1 (CHead e1 (Flat f) u1))))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda +(e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 O v e1 e2))))))) (getl i c1 +e) (\lambda (H9: (drop i O c1 x)).(getl_intro i c1 e x H9 H4)) (\lambda (H9: +(ex3_4 F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: T).(\lambda (u2: +T).(eq C x (CHead e0 (Flat f) u2)))))) (\lambda (f: F).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(drop i O c1 (CHead e0 (Flat f) u1)))))) +(\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v +u1 u2))))))).(ex3_4_ind F C T T (\lambda (f: F).(\lambda (e0: C).(\lambda (_: +T).(\lambda (u2: T).(eq C x (CHead e0 (Flat f) u2)))))) (\lambda (f: +F).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(drop i O c1 (CHead e0 +(Flat f) u1)))))) (\lambda (_: F).(\lambda (_: C).(\lambda (u1: T).(\lambda +(u2: T).(subst0 O v u1 u2))))) (getl i c1 e) (\lambda (x0: F).(\lambda (x1: +C).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H10: (eq C x (CHead x1 (Flat +x0) x3))).(\lambda (H11: (drop i O c1 (CHead x1 (Flat x0) x2))).(\lambda (_: +(subst0 O v x2 x3)).(let H13 \def (eq_ind C x (\lambda (c: C).(clear c e)) H4 +(CHead x1 (Flat x0) x3) H10) in (getl_intro i c1 e (CHead x1 (Flat x0) x2) +H11 (clear_flat x1 e (clear_gen_flat x0 x1 e x3 H13) x0 x2)))))))))) H9)) +(\lambda (H9: (ex3_4 F C C T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: +C).(\lambda (u: T).(eq C x (CHead e2 (Flat f) u)))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop i O c1 (CHead e1 +(Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 O v e1 e2))))))).(ex3_4_ind F C C T (\lambda (f: F).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u: T).(eq C x (CHead e2 (Flat f) u)))))) +(\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u: T).(drop i O c1 +(CHead e1 (Flat f) u)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 O v e1 e2))))) (getl i c1 e) (\lambda (x0: +F).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H10: (eq C x +(CHead x2 (Flat x0) x3))).(\lambda (H11: (drop i O c1 (CHead x1 (Flat x0) +x3))).(\lambda (H12: (csubst0 O v x1 x2)).(let H13 \def (eq_ind C x (\lambda +(c: C).(clear c e)) H4 (CHead x2 (Flat x0) x3) H10) in (getl_intro i c1 e +(CHead x1 (Flat x0) x3) H11 (clear_flat x1 e (csubst0_clear_O_back x1 x2 v +H12 e (clear_gen_flat x0 x2 e x3 H13)) x0 x3)))))))))) H9)) (\lambda (H9: +(ex4_5 F C C T T (\lambda (f: F).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (u2: T).(eq C x (CHead e2 (Flat f) u2))))))) (\lambda (f: +F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(drop i +O c1 (CHead e1 (Flat f) u1))))))) (\lambda (_: F).(\lambda (_: C).(\lambda +(_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 O v u1 u2)))))) (\lambda (_: +F).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +O v e1 e2)))))))).(ex4_5_ind F C C T T (\lambda (f: F).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (u2: T).(eq C x (CHead e2 (Flat +f) u2))))))) (\lambda (f: F).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: +T).(\lambda (_: T).(drop i O c1 (CHead e1 (Flat f) u1))))))) (\lambda (_: +F).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (u2: T).(subst0 +O v u1 u2)))))) (\lambda (_: F).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (_: T).(csubst0 O v e1 e2)))))) (getl i c1 e) (\lambda (x0: +F).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (H10: (eq C x (CHead x2 (Flat x0) x4))).(\lambda (H11: (drop i O +c1 (CHead x1 (Flat x0) x3))).(\lambda (_: (subst0 O v x3 x4)).(\lambda (H13: +(csubst0 O v x1 x2)).(let H14 \def (eq_ind C x (\lambda (c: C).(clear c e)) +H4 (CHead x2 (Flat x0) x4) H10) in (getl_intro i c1 e (CHead x1 (Flat x0) x3) +H11 (clear_flat x1 e (csubst0_clear_O_back x1 x2 v H13 e (clear_gen_flat x0 +x2 e x4 H14)) x0 x3)))))))))))) H9)) H8)) n H5)))) (\lambda (H5: (lt n +i)).(le_lt_false i n H H5 (getl n c1 e))))))) H2)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/props.ma new file mode 100644 index 000000000..24e20c400 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/props.ma @@ -0,0 +1,54 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst0/props". + +include "csubst0/defs.ma". + +theorem csubst0_snd_bind: + \forall (b: B).(\forall (i: nat).(\forall (v: T).(\forall (u1: T).(\forall +(u2: T).((subst0 i v u1 u2) \to (\forall (c: C).(csubst0 (S i) v (CHead c +(Bind b) u1) (CHead c (Bind b) u2)))))))) +\def + \lambda (b: B).(\lambda (i: nat).(\lambda (v: T).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (H: (subst0 i v u1 u2)).(\lambda (c: C).(eq_ind nat (s (Bind +b) i) (\lambda (n: nat).(csubst0 n v (CHead c (Bind b) u1) (CHead c (Bind b) +u2))) (csubst0_snd (Bind b) i v u1 u2 H c) (S i) (refl_equal nat (S +i))))))))). + +theorem csubst0_fst_bind: + \forall (b: B).(\forall (i: nat).(\forall (c1: C).(\forall (c2: C).(\forall +(v: T).((csubst0 i v c1 c2) \to (\forall (u: T).(csubst0 (S i) v (CHead c1 +(Bind b) u) (CHead c2 (Bind b) u)))))))) +\def + \lambda (b: B).(\lambda (i: nat).(\lambda (c1: C).(\lambda (c2: C).(\lambda +(v: T).(\lambda (H: (csubst0 i v c1 c2)).(\lambda (u: T).(eq_ind nat (s (Bind +b) i) (\lambda (n: nat).(csubst0 n v (CHead c1 (Bind b) u) (CHead c2 (Bind b) +u))) (csubst0_fst (Bind b) i c1 c2 v H u) (S i) (refl_equal nat (S i))))))))). + +theorem csubst0_both_bind: + \forall (b: B).(\forall (i: nat).(\forall (v: T).(\forall (u1: T).(\forall +(u2: T).((subst0 i v u1 u2) \to (\forall (c1: C).(\forall (c2: C).((csubst0 i +v c1 c2) \to (csubst0 (S i) v (CHead c1 (Bind b) u1) (CHead c2 (Bind b) +u2)))))))))) +\def + \lambda (b: B).(\lambda (i: nat).(\lambda (v: T).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (H: (subst0 i v u1 u2)).(\lambda (c1: C).(\lambda (c2: +C).(\lambda (H0: (csubst0 i v c1 c2)).(eq_ind nat (s (Bind b) i) (\lambda (n: +nat).(csubst0 n v (CHead c1 (Bind b) u1) (CHead c2 (Bind b) u2))) +(csubst0_both (Bind b) i v u1 u2 H c1 c2 H0) (S i) (refl_equal nat (S +i))))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/defs.ma new file mode 100644 index 000000000..a298dfc8c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/defs.ma @@ -0,0 +1,24 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst1/defs". + +include "csubst0/defs.ma". + +inductive csubst1 (i: nat) (v: T) (c1: C): C \to Prop \def +| csubst1_refl: csubst1 i v c1 c1 +| csubst1_sing: \forall (c2: C).((csubst0 i v c1 c2) \to (csubst1 i v c1 c2)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/fwd.ma new file mode 100644 index 000000000..96e86eea5 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/fwd.ma @@ -0,0 +1,126 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst1/fwd". + +include "csubst1/defs.ma". + +include "csubst0/fwd.ma". + +include "subst1/props.ma". + +theorem csubst1_gen_head: + \forall (k: K).(\forall (c1: C).(\forall (x: C).(\forall (u1: T).(\forall +(v: T).(\forall (i: nat).((csubst1 (s k i) v (CHead c1 k u1) x) \to (ex3_2 T +C (\lambda (u2: T).(\lambda (c2: C).(eq C x (CHead c2 k u2)))) (\lambda (u2: +T).(\lambda (_: C).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (c2: +C).(csubst1 i v c1 c2)))))))))) +\def + \lambda (k: K).(\lambda (c1: C).(\lambda (x: C).(\lambda (u1: T).(\lambda +(v: T).(\lambda (i: nat).(\lambda (H: (csubst1 (s k i) v (CHead c1 k u1) +x)).(let H0 \def (match H in csubst1 return (\lambda (c: C).(\lambda (_: +(csubst1 ? ? ? c)).((eq C c x) \to (ex3_2 T C (\lambda (u2: T).(\lambda (c2: +C).(eq C x (CHead c2 k u2)))) (\lambda (u2: T).(\lambda (_: C).(subst1 i v u1 +u2))) (\lambda (_: T).(\lambda (c2: C).(csubst1 i v c1 c2))))))) with +[csubst1_refl \Rightarrow (\lambda (H0: (eq C (CHead c1 k u1) x)).(eq_ind C +(CHead c1 k u1) (\lambda (c: C).(ex3_2 T C (\lambda (u2: T).(\lambda (c2: +C).(eq C c (CHead c2 k u2)))) (\lambda (u2: T).(\lambda (_: C).(subst1 i v u1 +u2))) (\lambda (_: T).(\lambda (c2: C).(csubst1 i v c1 c2))))) (ex3_2_intro T +C (\lambda (u2: T).(\lambda (c2: C).(eq C (CHead c1 k u1) (CHead c2 k u2)))) +(\lambda (u2: T).(\lambda (_: C).(subst1 i v u1 u2))) (\lambda (_: +T).(\lambda (c2: C).(csubst1 i v c1 c2))) u1 c1 (refl_equal C (CHead c1 k +u1)) (subst1_refl i v u1) (csubst1_refl i v c1)) x H0)) | (csubst1_sing c2 +H0) \Rightarrow (\lambda (H1: (eq C c2 x)).(eq_ind C x (\lambda (c: +C).((csubst0 (s k i) v (CHead c1 k u1) c) \to (ex3_2 T C (\lambda (u2: +T).(\lambda (c3: C).(eq C x (CHead c3 k u2)))) (\lambda (u2: T).(\lambda (_: +C).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (c3: C).(csubst1 i v c1 +c3)))))) (\lambda (H2: (csubst0 (s k i) v (CHead c1 k u1) x)).(or3_ind (ex3_2 +T nat (\lambda (_: T).(\lambda (j: nat).(eq nat (s k i) (s k j)))) (\lambda +(u2: T).(\lambda (_: nat).(eq C x (CHead c1 k u2)))) (\lambda (u2: +T).(\lambda (j: nat).(subst0 j v u1 u2)))) (ex3_2 C nat (\lambda (_: +C).(\lambda (j: nat).(eq nat (s k i) (s k j)))) (\lambda (c3: C).(\lambda (_: +nat).(eq C x (CHead c3 k u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j +v c1 c3)))) (ex4_3 T C nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: +nat).(eq nat (s k i) (s k j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda +(_: nat).(eq C x (CHead c3 k u2))))) (\lambda (u2: T).(\lambda (_: +C).(\lambda (j: nat).(subst0 j v u1 u2)))) (\lambda (_: T).(\lambda (c3: +C).(\lambda (j: nat).(csubst0 j v c1 c3))))) (ex3_2 T C (\lambda (u2: +T).(\lambda (c3: C).(eq C x (CHead c3 k u2)))) (\lambda (u2: T).(\lambda (_: +C).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (c3: C).(csubst1 i v c1 +c3)))) (\lambda (H3: (ex3_2 T nat (\lambda (_: T).(\lambda (j: nat).(eq nat +(s k i) (s k j)))) (\lambda (u2: T).(\lambda (_: nat).(eq C x (CHead c1 k +u2)))) (\lambda (u2: T).(\lambda (j: nat).(subst0 j v u1 u2))))).(ex3_2_ind T +nat (\lambda (_: T).(\lambda (j: nat).(eq nat (s k i) (s k j)))) (\lambda +(u2: T).(\lambda (_: nat).(eq C x (CHead c1 k u2)))) (\lambda (u2: +T).(\lambda (j: nat).(subst0 j v u1 u2))) (ex3_2 T C (\lambda (u2: +T).(\lambda (c3: C).(eq C x (CHead c3 k u2)))) (\lambda (u2: T).(\lambda (_: +C).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (c3: C).(csubst1 i v c1 +c3)))) (\lambda (x0: T).(\lambda (x1: nat).(\lambda (H4: (eq nat (s k i) (s k +x1))).(\lambda (H5: (eq C x (CHead c1 k x0))).(\lambda (H6: (subst0 x1 v u1 +x0)).(eq_ind_r C (CHead c1 k x0) (\lambda (c: C).(ex3_2 T C (\lambda (u2: +T).(\lambda (c3: C).(eq C c (CHead c3 k u2)))) (\lambda (u2: T).(\lambda (_: +C).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (c3: C).(csubst1 i v c1 +c3))))) (let H7 \def (eq_ind_r nat x1 (\lambda (n: nat).(subst0 n v u1 x0)) +H6 i (s_inj k i x1 H4)) in (ex3_2_intro T C (\lambda (u2: T).(\lambda (c3: +C).(eq C (CHead c1 k x0) (CHead c3 k u2)))) (\lambda (u2: T).(\lambda (_: +C).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (c3: C).(csubst1 i v c1 +c3))) x0 c1 (refl_equal C (CHead c1 k x0)) (subst1_single i v u1 x0 H7) +(csubst1_refl i v c1))) x H5)))))) H3)) (\lambda (H3: (ex3_2 C nat (\lambda +(_: C).(\lambda (j: nat).(eq nat (s k i) (s k j)))) (\lambda (c3: C).(\lambda +(_: nat).(eq C x (CHead c3 k u1)))) (\lambda (c3: C).(\lambda (j: +nat).(csubst0 j v c1 c3))))).(ex3_2_ind C nat (\lambda (_: C).(\lambda (j: +nat).(eq nat (s k i) (s k j)))) (\lambda (c3: C).(\lambda (_: nat).(eq C x +(CHead c3 k u1)))) (\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3))) +(ex3_2 T C (\lambda (u2: T).(\lambda (c3: C).(eq C x (CHead c3 k u2)))) +(\lambda (u2: T).(\lambda (_: C).(subst1 i v u1 u2))) (\lambda (_: +T).(\lambda (c3: C).(csubst1 i v c1 c3)))) (\lambda (x0: C).(\lambda (x1: +nat).(\lambda (H4: (eq nat (s k i) (s k x1))).(\lambda (H5: (eq C x (CHead x0 +k u1))).(\lambda (H6: (csubst0 x1 v c1 x0)).(eq_ind_r C (CHead x0 k u1) +(\lambda (c: C).(ex3_2 T C (\lambda (u2: T).(\lambda (c3: C).(eq C c (CHead +c3 k u2)))) (\lambda (u2: T).(\lambda (_: C).(subst1 i v u1 u2))) (\lambda +(_: T).(\lambda (c3: C).(csubst1 i v c1 c3))))) (let H7 \def (eq_ind_r nat x1 +(\lambda (n: nat).(csubst0 n v c1 x0)) H6 i (s_inj k i x1 H4)) in +(ex3_2_intro T C (\lambda (u2: T).(\lambda (c3: C).(eq C (CHead x0 k u1) +(CHead c3 k u2)))) (\lambda (u2: T).(\lambda (_: C).(subst1 i v u1 u2))) +(\lambda (_: T).(\lambda (c3: C).(csubst1 i v c1 c3))) u1 x0 (refl_equal C +(CHead x0 k u1)) (subst1_refl i v u1) (csubst1_sing i v c1 x0 H7))) x +H5)))))) H3)) (\lambda (H3: (ex4_3 T C nat (\lambda (_: T).(\lambda (_: +C).(\lambda (j: nat).(eq nat (s k i) (s k j))))) (\lambda (u2: T).(\lambda +(c3: C).(\lambda (_: nat).(eq C x (CHead c3 k u2))))) (\lambda (u2: +T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 u2)))) (\lambda (_: +T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 c3)))))).(ex4_3_ind T C +nat (\lambda (_: T).(\lambda (_: C).(\lambda (j: nat).(eq nat (s k i) (s k +j))))) (\lambda (u2: T).(\lambda (c3: C).(\lambda (_: nat).(eq C x (CHead c3 +k u2))))) (\lambda (u2: T).(\lambda (_: C).(\lambda (j: nat).(subst0 j v u1 +u2)))) (\lambda (_: T).(\lambda (c3: C).(\lambda (j: nat).(csubst0 j v c1 +c3)))) (ex3_2 T C (\lambda (u2: T).(\lambda (c3: C).(eq C x (CHead c3 k +u2)))) (\lambda (u2: T).(\lambda (_: C).(subst1 i v u1 u2))) (\lambda (_: +T).(\lambda (c3: C).(csubst1 i v c1 c3)))) (\lambda (x0: T).(\lambda (x1: +C).(\lambda (x2: nat).(\lambda (H4: (eq nat (s k i) (s k x2))).(\lambda (H5: +(eq C x (CHead x1 k x0))).(\lambda (H6: (subst0 x2 v u1 x0)).(\lambda (H7: +(csubst0 x2 v c1 x1)).(eq_ind_r C (CHead x1 k x0) (\lambda (c: C).(ex3_2 T C +(\lambda (u2: T).(\lambda (c3: C).(eq C c (CHead c3 k u2)))) (\lambda (u2: +T).(\lambda (_: C).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (c3: +C).(csubst1 i v c1 c3))))) (let H8 \def (eq_ind_r nat x2 (\lambda (n: +nat).(csubst0 n v c1 x1)) H7 i (s_inj k i x2 H4)) in (let H9 \def (eq_ind_r +nat x2 (\lambda (n: nat).(subst0 n v u1 x0)) H6 i (s_inj k i x2 H4)) in +(ex3_2_intro T C (\lambda (u2: T).(\lambda (c3: C).(eq C (CHead x1 k x0) +(CHead c3 k u2)))) (\lambda (u2: T).(\lambda (_: C).(subst1 i v u1 u2))) +(\lambda (_: T).(\lambda (c3: C).(csubst1 i v c1 c3))) x0 x1 (refl_equal C +(CHead x1 k x0)) (subst1_single i v u1 x0 H9) (csubst1_sing i v c1 x1 H8)))) +x H5)))))))) H3)) (csubst0_gen_head k c1 x u1 v (s k i) H2))) c2 (sym_eq C c2 +x H1) H0))]) in (H0 (refl_equal C x))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/getl.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/getl.ma new file mode 100644 index 000000000..a6af74625 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/getl.ma @@ -0,0 +1,275 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst1/getl". + +include "csubst1/props.ma". + +include "csubst0/getl.ma". + +include "csubst0/props.ma". + +include "subst1/props.ma". + +include "drop/props.ma". + +theorem csubst1_getl_ge: + \forall (i: nat).(\forall (n: nat).((le i n) \to (\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst1 i v c1 c2) \to (\forall (e: C).((getl n c1 +e) \to (getl n c2 e))))))))) +\def + \lambda (i: nat).(\lambda (n: nat).(\lambda (H: (le i n)).(\lambda (c1: +C).(\lambda (c2: C).(\lambda (v: T).(\lambda (H0: (csubst1 i v c1 +c2)).(csubst1_ind i v c1 (\lambda (c: C).(\forall (e: C).((getl n c1 e) \to +(getl n c e)))) (\lambda (e: C).(\lambda (H1: (getl n c1 e)).H1)) (\lambda +(c3: C).(\lambda (H1: (csubst0 i v c1 c3)).(\lambda (e: C).(\lambda (H2: +(getl n c1 e)).(csubst0_getl_ge i n H c1 c3 v H1 e H2))))) c2 H0))))))). + +theorem csubst1_getl_lt: + \forall (i: nat).(\forall (n: nat).((lt n i) \to (\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst1 i v c1 c2) \to (\forall (e1: C).((getl n c1 +e1) \to (ex2 C (\lambda (e2: C).(csubst1 (minus i n) v e1 e2)) (\lambda (e2: +C).(getl n c2 e2))))))))))) +\def + \lambda (i: nat).(\lambda (n: nat).(\lambda (H: (lt n i)).(\lambda (c1: +C).(\lambda (c2: C).(\lambda (v: T).(\lambda (H0: (csubst1 i v c1 +c2)).(csubst1_ind i v c1 (\lambda (c: C).(\forall (e1: C).((getl n c1 e1) \to +(ex2 C (\lambda (e2: C).(csubst1 (minus i n) v e1 e2)) (\lambda (e2: C).(getl +n c e2)))))) (\lambda (e1: C).(\lambda (H1: (getl n c1 e1)).(eq_ind_r nat (S +(minus i (S n))) (\lambda (n0: nat).(ex2 C (\lambda (e2: C).(csubst1 n0 v e1 +e2)) (\lambda (e2: C).(getl n c1 e2)))) (ex_intro2 C (\lambda (e2: +C).(csubst1 (S (minus i (S n))) v e1 e2)) (\lambda (e2: C).(getl n c1 e2)) e1 +(csubst1_refl (S (minus i (S n))) v e1) H1) (minus i n) (minus_x_Sy i n H)))) +(\lambda (c3: C).(\lambda (H1: (csubst0 i v c1 c3)).(\lambda (e1: C).(\lambda +(H2: (getl n c1 e1)).(eq_ind_r nat (S (minus i (S n))) (\lambda (n0: +nat).(ex2 C (\lambda (e2: C).(csubst1 n0 v e1 e2)) (\lambda (e2: C).(getl n +c3 e2)))) (let H3 \def (csubst0_getl_lt i n H c1 c3 v H1 e1 H2) in (or4_ind +(getl n c3 e1) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e1 (CHead e0 (Bind b) u)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c3 (CHead e0 +(Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w)))))) (ex3_4 B C C T (\lambda (b: +B).(\lambda (e2: C).(\lambda (_: C).(\lambda (u: T).(eq C e1 (CHead e2 (Bind +b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e3: C).(\lambda (u: +T).(getl n c3 (CHead e3 (Bind b) u)))))) (\lambda (_: B).(\lambda (e2: +C).(\lambda (e3: C).(\lambda (_: T).(csubst0 (minus i (S n)) v e2 e3)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e2: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(eq C e1 (CHead e2 (Bind b) u))))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e3: C).(\lambda (_: T).(\lambda (w: T).(getl n +c3 (CHead e3 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (e3: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) v e2 e3))))))) (ex2 C (\lambda (e2: +C).(csubst1 (S (minus i (S n))) v e1 e2)) (\lambda (e2: C).(getl n c3 e2))) +(\lambda (H4: (getl n c3 e1)).(ex_intro2 C (\lambda (e2: C).(csubst1 (S +(minus i (S n))) v e1 e2)) (\lambda (e2: C).(getl n c3 e2)) e1 (csubst1_refl +(S (minus i (S n))) v e1) H4)) (\lambda (H4: (ex3_4 B C T T (\lambda (b: +B).(\lambda (e0: C).(\lambda (u: T).(\lambda (_: T).(eq C e1 (CHead e0 (Bind +b) u)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl n c3 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u +w))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u: +T).(\lambda (_: T).(eq C e1 (CHead e0 (Bind b) u)))))) (\lambda (b: +B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c3 (CHead e0 +(Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u: T).(\lambda (w: +T).(subst0 (minus i (S n)) v u w))))) (ex2 C (\lambda (e2: C).(csubst1 (S +(minus i (S n))) v e1 e2)) (\lambda (e2: C).(getl n c3 e2))) (\lambda (x0: +B).(\lambda (x1: C).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H5: (eq C e1 +(CHead x1 (Bind x0) x2))).(\lambda (H6: (getl n c3 (CHead x1 (Bind x0) +x3))).(\lambda (H7: (subst0 (minus i (S n)) v x2 x3)).(eq_ind_r C (CHead x1 +(Bind x0) x2) (\lambda (c: C).(ex2 C (\lambda (e2: C).(csubst1 (S (minus i (S +n))) v c e2)) (\lambda (e2: C).(getl n c3 e2)))) (ex_intro2 C (\lambda (e2: +C).(csubst1 (S (minus i (S n))) v (CHead x1 (Bind x0) x2) e2)) (\lambda (e2: +C).(getl n c3 e2)) (CHead x1 (Bind x0) x3) (csubst1_sing (S (minus i (S n))) +v (CHead x1 (Bind x0) x2) (CHead x1 (Bind x0) x3) (csubst0_snd_bind x0 (minus +i (S n)) v x2 x3 H7 x1)) H6) e1 H5)))))))) H4)) (\lambda (H4: (ex3_4 B C C T +(\lambda (b: B).(\lambda (e2: C).(\lambda (_: C).(\lambda (u: T).(eq C e1 +(CHead e2 (Bind b) u)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e3: +C).(\lambda (u: T).(getl n c3 (CHead e3 (Bind b) u)))))) (\lambda (_: +B).(\lambda (e2: C).(\lambda (e3: C).(\lambda (_: T).(csubst0 (minus i (S n)) +v e2 e3))))))).(ex3_4_ind B C C T (\lambda (b: B).(\lambda (e2: C).(\lambda +(_: C).(\lambda (u: T).(eq C e1 (CHead e2 (Bind b) u)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e3: C).(\lambda (u: T).(getl n c3 (CHead e3 +(Bind b) u)))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (e3: C).(\lambda +(_: T).(csubst0 (minus i (S n)) v e2 e3))))) (ex2 C (\lambda (e2: C).(csubst1 +(S (minus i (S n))) v e1 e2)) (\lambda (e2: C).(getl n c3 e2))) (\lambda (x0: +B).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H5: (eq C e1 +(CHead x1 (Bind x0) x3))).(\lambda (H6: (getl n c3 (CHead x2 (Bind x0) +x3))).(\lambda (H7: (csubst0 (minus i (S n)) v x1 x2)).(eq_ind_r C (CHead x1 +(Bind x0) x3) (\lambda (c: C).(ex2 C (\lambda (e2: C).(csubst1 (S (minus i (S +n))) v c e2)) (\lambda (e2: C).(getl n c3 e2)))) (ex_intro2 C (\lambda (e2: +C).(csubst1 (S (minus i (S n))) v (CHead x1 (Bind x0) x3) e2)) (\lambda (e2: +C).(getl n c3 e2)) (CHead x2 (Bind x0) x3) (csubst1_sing (S (minus i (S n))) +v (CHead x1 (Bind x0) x3) (CHead x2 (Bind x0) x3) (csubst0_fst_bind x0 (minus +i (S n)) x1 x2 v H7 x3)) H6) e1 H5)))))))) H4)) (\lambda (H4: (ex4_5 B C C T +T (\lambda (b: B).(\lambda (e2: C).(\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(eq C e1 (CHead e2 (Bind b) u))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e3: C).(\lambda (_: T).(\lambda (w: T).(getl n c3 (CHead e3 +(Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u: T).(\lambda (w: T).(subst0 (minus i (S n)) v u w)))))) (\lambda (_: +B).(\lambda (e2: C).(\lambda (e3: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) v e2 e3)))))))).(ex4_5_ind B C C T T (\lambda (b: B).(\lambda +(e2: C).(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(eq C e1 (CHead e2 +(Bind b) u))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e3: C).(\lambda +(_: T).(\lambda (w: T).(getl n c3 (CHead e3 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u: T).(\lambda (w: T).(subst0 +(minus i (S n)) v u w)))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (e3: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i (S n)) v e2 e3)))))) +(ex2 C (\lambda (e2: C).(csubst1 (S (minus i (S n))) v e1 e2)) (\lambda (e2: +C).(getl n c3 e2))) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: +C).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H5: (eq C e1 (CHead x1 (Bind +x0) x3))).(\lambda (H6: (getl n c3 (CHead x2 (Bind x0) x4))).(\lambda (H7: +(subst0 (minus i (S n)) v x3 x4)).(\lambda (H8: (csubst0 (minus i (S n)) v x1 +x2)).(eq_ind_r C (CHead x1 (Bind x0) x3) (\lambda (c: C).(ex2 C (\lambda (e2: +C).(csubst1 (S (minus i (S n))) v c e2)) (\lambda (e2: C).(getl n c3 e2)))) +(ex_intro2 C (\lambda (e2: C).(csubst1 (S (minus i (S n))) v (CHead x1 (Bind +x0) x3) e2)) (\lambda (e2: C).(getl n c3 e2)) (CHead x2 (Bind x0) x4) +(csubst1_sing (S (minus i (S n))) v (CHead x1 (Bind x0) x3) (CHead x2 (Bind +x0) x4) (csubst0_both_bind x0 (minus i (S n)) v x3 x4 H7 x1 x2 H8)) H6) e1 +H5)))))))))) H4)) H3)) (minus i n) (minus_x_Sy i n H)))))) c2 H0))))))). + +theorem csubst1_getl_ge_back: + \forall (i: nat).(\forall (n: nat).((le i n) \to (\forall (c1: C).(\forall +(c2: C).(\forall (v: T).((csubst1 i v c1 c2) \to (\forall (e: C).((getl n c2 +e) \to (getl n c1 e))))))))) +\def + \lambda (i: nat).(\lambda (n: nat).(\lambda (H: (le i n)).(\lambda (c1: +C).(\lambda (c2: C).(\lambda (v: T).(\lambda (H0: (csubst1 i v c1 +c2)).(csubst1_ind i v c1 (\lambda (c: C).(\forall (e: C).((getl n c e) \to +(getl n c1 e)))) (\lambda (e: C).(\lambda (H1: (getl n c1 e)).H1)) (\lambda +(c3: C).(\lambda (H1: (csubst0 i v c1 c3)).(\lambda (e: C).(\lambda (H2: +(getl n c3 e)).(csubst0_getl_ge_back i n H c1 c3 v H1 e H2))))) c2 H0))))))). + +theorem getl_csubst1: + \forall (d: nat).(\forall (c: C).(\forall (e: C).(\forall (u: T).((getl d c +(CHead e (Bind Abbr) u)) \to (ex2_2 C C (\lambda (a0: C).(\lambda (_: +C).(csubst1 d u c a0))) (\lambda (a0: C).(\lambda (a: C).(drop (S O) d a0 +a)))))))) +\def + \lambda (d: nat).(nat_ind (\lambda (n: nat).(\forall (c: C).(\forall (e: +C).(\forall (u: T).((getl n c (CHead e (Bind Abbr) u)) \to (ex2_2 C C +(\lambda (a0: C).(\lambda (_: C).(csubst1 n u c a0))) (\lambda (a0: +C).(\lambda (a: C).(drop (S O) n a0 a))))))))) (\lambda (c: C).(C_ind +(\lambda (c0: C).(\forall (e: C).(\forall (u: T).((getl O c0 (CHead e (Bind +Abbr) u)) \to (ex2_2 C C (\lambda (a0: C).(\lambda (_: C).(csubst1 O u c0 +a0))) (\lambda (a0: C).(\lambda (a: C).(drop (S O) O a0 a)))))))) (\lambda +(n: nat).(\lambda (e: C).(\lambda (u: T).(\lambda (H: (getl O (CSort n) +(CHead e (Bind Abbr) u))).(getl_gen_sort n O (CHead e (Bind Abbr) u) H (ex2_2 +C C (\lambda (a0: C).(\lambda (_: C).(csubst1 O u (CSort n) a0))) (\lambda +(a0: C).(\lambda (a: C).(drop (S O) O a0 a))))))))) (\lambda (c0: C).(\lambda +(H: ((\forall (e: C).(\forall (u: T).((getl O c0 (CHead e (Bind Abbr) u)) \to +(ex2_2 C C (\lambda (a0: C).(\lambda (_: C).(csubst1 O u c0 a0))) (\lambda +(a0: C).(\lambda (a: C).(drop (S O) O a0 a))))))))).(\lambda (k: K).(K_ind +(\lambda (k0: K).(\forall (t: T).(\forall (e: C).(\forall (u: T).((getl O +(CHead c0 k0 t) (CHead e (Bind Abbr) u)) \to (ex2_2 C C (\lambda (a0: +C).(\lambda (_: C).(csubst1 O u (CHead c0 k0 t) a0))) (\lambda (a0: +C).(\lambda (a: C).(drop (S O) O a0 a))))))))) (\lambda (b: B).(\lambda (t: +T).(\lambda (e: C).(\lambda (u: T).(\lambda (H0: (getl O (CHead c0 (Bind b) +t) (CHead e (Bind Abbr) u))).(let H1 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow e | +(CHead c1 _ _) \Rightarrow c1])) (CHead e (Bind Abbr) u) (CHead c0 (Bind b) +t) (clear_gen_bind b c0 (CHead e (Bind Abbr) u) t (getl_gen_O (CHead c0 (Bind +b) t) (CHead e (Bind Abbr) u) H0))) in ((let H2 \def (f_equal C B (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow +Abbr | (CHead _ k0 _) \Rightarrow (match k0 in K return (\lambda (_: K).B) +with [(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (CHead e +(Bind Abbr) u) (CHead c0 (Bind b) t) (clear_gen_bind b c0 (CHead e (Bind +Abbr) u) t (getl_gen_O (CHead c0 (Bind b) t) (CHead e (Bind Abbr) u) H0))) in +((let H3 \def (f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) +(CHead e (Bind Abbr) u) (CHead c0 (Bind b) t) (clear_gen_bind b c0 (CHead e +(Bind Abbr) u) t (getl_gen_O (CHead c0 (Bind b) t) (CHead e (Bind Abbr) u) +H0))) in (\lambda (H4: (eq B Abbr b)).(\lambda (_: (eq C e c0)).(eq_ind_r T t +(\lambda (t0: T).(ex2_2 C C (\lambda (a0: C).(\lambda (_: C).(csubst1 O t0 +(CHead c0 (Bind b) t) a0))) (\lambda (a0: C).(\lambda (a: C).(drop (S O) O a0 +a))))) (eq_ind B Abbr (\lambda (b0: B).(ex2_2 C C (\lambda (a0: C).(\lambda +(_: C).(csubst1 O t (CHead c0 (Bind b0) t) a0))) (\lambda (a0: C).(\lambda +(a: C).(drop (S O) O a0 a))))) (ex2_2_intro C C (\lambda (a0: C).(\lambda (_: +C).(csubst1 O t (CHead c0 (Bind Abbr) t) a0))) (\lambda (a0: C).(\lambda (a: +C).(drop (S O) O a0 a))) (CHead c0 (Bind Abbr) t) c0 (csubst1_refl O t (CHead +c0 (Bind Abbr) t)) (drop_drop (Bind Abbr) O c0 c0 (drop_refl c0) t)) b H4) u +H3)))) H2)) H1))))))) (\lambda (f: F).(\lambda (t: T).(\lambda (e: +C).(\lambda (u: T).(\lambda (H0: (getl O (CHead c0 (Flat f) t) (CHead e (Bind +Abbr) u))).(let H_x \def (subst1_ex u t O) in (let H1 \def H_x in (ex_ind T +(\lambda (t2: T).(subst1 O u t (lift (S O) O t2))) (ex2_2 C C (\lambda (a0: +C).(\lambda (_: C).(csubst1 O u (CHead c0 (Flat f) t) a0))) (\lambda (a0: +C).(\lambda (a: C).(drop (S O) O a0 a)))) (\lambda (x: T).(\lambda (H2: +(subst1 O u t (lift (S O) O x))).(let H3 \def (H e u (getl_intro O c0 (CHead +e (Bind Abbr) u) c0 (drop_refl c0) (clear_gen_flat f c0 (CHead e (Bind Abbr) +u) t (getl_gen_O (CHead c0 (Flat f) t) (CHead e (Bind Abbr) u) H0)))) in +(ex2_2_ind C C (\lambda (a0: C).(\lambda (_: C).(csubst1 O u c0 a0))) +(\lambda (a0: C).(\lambda (a: C).(drop (S O) O a0 a))) (ex2_2 C C (\lambda +(a0: C).(\lambda (_: C).(csubst1 O u (CHead c0 (Flat f) t) a0))) (\lambda +(a0: C).(\lambda (a: C).(drop (S O) O a0 a)))) (\lambda (x0: C).(\lambda (x1: +C).(\lambda (H4: (csubst1 O u c0 x0)).(\lambda (H5: (drop (S O) O x0 +x1)).(ex2_2_intro C C (\lambda (a0: C).(\lambda (_: C).(csubst1 O u (CHead c0 +(Flat f) t) a0))) (\lambda (a0: C).(\lambda (a: C).(drop (S O) O a0 a))) +(CHead x0 (Flat f) (lift (S O) O x)) x1 (csubst1_flat f O u t (lift (S O) O +x) H2 c0 x0 H4) (drop_drop (Flat f) O x0 x1 H5 (lift (S O) O x))))))) H3)))) +H1)))))))) k)))) c)) (\lambda (n: nat).(\lambda (H: ((\forall (c: C).(\forall +(e: C).(\forall (u: T).((getl n c (CHead e (Bind Abbr) u)) \to (ex2_2 C C +(\lambda (a0: C).(\lambda (_: C).(csubst1 n u c a0))) (\lambda (a0: +C).(\lambda (a: C).(drop (S O) n a0 a)))))))))).(\lambda (c: C).(C_ind +(\lambda (c0: C).(\forall (e: C).(\forall (u: T).((getl (S n) c0 (CHead e +(Bind Abbr) u)) \to (ex2_2 C C (\lambda (a0: C).(\lambda (_: C).(csubst1 (S +n) u c0 a0))) (\lambda (a0: C).(\lambda (a: C).(drop (S O) (S n) a0 a)))))))) +(\lambda (n0: nat).(\lambda (e: C).(\lambda (u: T).(\lambda (H0: (getl (S n) +(CSort n0) (CHead e (Bind Abbr) u))).(getl_gen_sort n0 (S n) (CHead e (Bind +Abbr) u) H0 (ex2_2 C C (\lambda (a0: C).(\lambda (_: C).(csubst1 (S n) u +(CSort n0) a0))) (\lambda (a0: C).(\lambda (a: C).(drop (S O) (S n) a0 +a))))))))) (\lambda (c0: C).(\lambda (H0: ((\forall (e: C).(\forall (u: +T).((getl (S n) c0 (CHead e (Bind Abbr) u)) \to (ex2_2 C C (\lambda (a0: +C).(\lambda (_: C).(csubst1 (S n) u c0 a0))) (\lambda (a0: C).(\lambda (a: +C).(drop (S O) (S n) a0 a))))))))).(\lambda (k: K).(K_ind (\lambda (k0: +K).(\forall (t: T).(\forall (e: C).(\forall (u: T).((getl (S n) (CHead c0 k0 +t) (CHead e (Bind Abbr) u)) \to (ex2_2 C C (\lambda (a0: C).(\lambda (_: +C).(csubst1 (S n) u (CHead c0 k0 t) a0))) (\lambda (a0: C).(\lambda (a: +C).(drop (S O) (S n) a0 a))))))))) (\lambda (b: B).(\lambda (t: T).(\lambda +(e: C).(\lambda (u: T).(\lambda (H1: (getl (S n) (CHead c0 (Bind b) t) (CHead +e (Bind Abbr) u))).(let H_x \def (subst1_ex u t n) in (let H2 \def H_x in +(ex_ind T (\lambda (t2: T).(subst1 n u t (lift (S O) n t2))) (ex2_2 C C +(\lambda (a0: C).(\lambda (_: C).(csubst1 (S n) u (CHead c0 (Bind b) t) a0))) +(\lambda (a0: C).(\lambda (a: C).(drop (S O) (S n) a0 a)))) (\lambda (x: +T).(\lambda (H3: (subst1 n u t (lift (S O) n x))).(let H4 \def (H c0 e u +(getl_gen_S (Bind b) c0 (CHead e (Bind Abbr) u) t n H1)) in (ex2_2_ind C C +(\lambda (a0: C).(\lambda (_: C).(csubst1 n u c0 a0))) (\lambda (a0: +C).(\lambda (a: C).(drop (S O) n a0 a))) (ex2_2 C C (\lambda (a0: C).(\lambda +(_: C).(csubst1 (S n) u (CHead c0 (Bind b) t) a0))) (\lambda (a0: C).(\lambda +(a: C).(drop (S O) (S n) a0 a)))) (\lambda (x0: C).(\lambda (x1: C).(\lambda +(H5: (csubst1 n u c0 x0)).(\lambda (H6: (drop (S O) n x0 x1)).(ex2_2_intro C +C (\lambda (a0: C).(\lambda (_: C).(csubst1 (S n) u (CHead c0 (Bind b) t) +a0))) (\lambda (a0: C).(\lambda (a: C).(drop (S O) (S n) a0 a))) (CHead x0 +(Bind b) (lift (S O) n x)) (CHead x1 (Bind b) x) (csubst1_bind b n u t (lift +(S O) n x) H3 c0 x0 H5) (drop_skip_bind (S O) n x0 x1 H6 b x)))))) H4)))) +H2)))))))) (\lambda (f: F).(\lambda (t: T).(\lambda (e: C).(\lambda (u: +T).(\lambda (H1: (getl (S n) (CHead c0 (Flat f) t) (CHead e (Bind Abbr) +u))).(let H_x \def (subst1_ex u t (S n)) in (let H2 \def H_x in (ex_ind T +(\lambda (t2: T).(subst1 (S n) u t (lift (S O) (S n) t2))) (ex2_2 C C +(\lambda (a0: C).(\lambda (_: C).(csubst1 (S n) u (CHead c0 (Flat f) t) a0))) +(\lambda (a0: C).(\lambda (a: C).(drop (S O) (S n) a0 a)))) (\lambda (x: +T).(\lambda (H3: (subst1 (S n) u t (lift (S O) (S n) x))).(let H4 \def (H0 e +u (getl_gen_S (Flat f) c0 (CHead e (Bind Abbr) u) t n H1)) in (ex2_2_ind C C +(\lambda (a0: C).(\lambda (_: C).(csubst1 (S n) u c0 a0))) (\lambda (a0: +C).(\lambda (a: C).(drop (S O) (S n) a0 a))) (ex2_2 C C (\lambda (a0: +C).(\lambda (_: C).(csubst1 (S n) u (CHead c0 (Flat f) t) a0))) (\lambda (a0: +C).(\lambda (a: C).(drop (S O) (S n) a0 a)))) (\lambda (x0: C).(\lambda (x1: +C).(\lambda (H5: (csubst1 (S n) u c0 x0)).(\lambda (H6: (drop (S O) (S n) x0 +x1)).(ex2_2_intro C C (\lambda (a0: C).(\lambda (_: C).(csubst1 (S n) u +(CHead c0 (Flat f) t) a0))) (\lambda (a0: C).(\lambda (a: C).(drop (S O) (S +n) a0 a))) (CHead x0 (Flat f) (lift (S O) (S n) x)) (CHead x1 (Flat f) x) +(csubst1_flat f (S n) u t (lift (S O) (S n) x) H3 c0 x0 H5) (drop_skip_flat +(S O) n x0 x1 H6 f x)))))) H4)))) H2)))))))) k)))) c)))) d). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/props.ma new file mode 100644 index 000000000..9cafa826f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/props.ma @@ -0,0 +1,68 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubst1/props". + +include "csubst1/defs.ma". + +include "subst1/defs.ma". + +theorem csubst1_head: + \forall (k: K).(\forall (i: nat).(\forall (v: T).(\forall (u1: T).(\forall +(u2: T).((subst1 i v u1 u2) \to (\forall (c1: C).(\forall (c2: C).((csubst1 i +v c1 c2) \to (csubst1 (s k i) v (CHead c1 k u1) (CHead c2 k u2)))))))))) +\def + \lambda (k: K).(\lambda (i: nat).(\lambda (v: T).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (H: (subst1 i v u1 u2)).(subst1_ind i v u1 (\lambda (t: +T).(\forall (c1: C).(\forall (c2: C).((csubst1 i v c1 c2) \to (csubst1 (s k +i) v (CHead c1 k u1) (CHead c2 k t)))))) (\lambda (c1: C).(\lambda (c2: +C).(\lambda (H0: (csubst1 i v c1 c2)).(csubst1_ind i v c1 (\lambda (c: +C).(csubst1 (s k i) v (CHead c1 k u1) (CHead c k u1))) (csubst1_refl (s k i) +v (CHead c1 k u1)) (\lambda (c3: C).(\lambda (H1: (csubst0 i v c1 +c3)).(csubst1_sing (s k i) v (CHead c1 k u1) (CHead c3 k u1) (csubst0_fst k i +c1 c3 v H1 u1)))) c2 H0)))) (\lambda (t2: T).(\lambda (H0: (subst0 i v u1 +t2)).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H1: (csubst1 i v c1 +c2)).(csubst1_ind i v c1 (\lambda (c: C).(csubst1 (s k i) v (CHead c1 k u1) +(CHead c k t2))) (csubst1_sing (s k i) v (CHead c1 k u1) (CHead c1 k t2) +(csubst0_snd k i v u1 t2 H0 c1)) (\lambda (c3: C).(\lambda (H2: (csubst0 i v +c1 c3)).(csubst1_sing (s k i) v (CHead c1 k u1) (CHead c3 k t2) (csubst0_both +k i v u1 t2 H0 c1 c3 H2)))) c2 H1)))))) u2 H)))))). + +theorem csubst1_bind: + \forall (b: B).(\forall (i: nat).(\forall (v: T).(\forall (u1: T).(\forall +(u2: T).((subst1 i v u1 u2) \to (\forall (c1: C).(\forall (c2: C).((csubst1 i +v c1 c2) \to (csubst1 (S i) v (CHead c1 (Bind b) u1) (CHead c2 (Bind b) +u2)))))))))) +\def + \lambda (b: B).(\lambda (i: nat).(\lambda (v: T).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (H: (subst1 i v u1 u2)).(\lambda (c1: C).(\lambda (c2: +C).(\lambda (H0: (csubst1 i v c1 c2)).(eq_ind nat (s (Bind b) i) (\lambda (n: +nat).(csubst1 n v (CHead c1 (Bind b) u1) (CHead c2 (Bind b) u2))) +(csubst1_head (Bind b) i v u1 u2 H c1 c2 H0) (S i) (refl_equal nat (S +i))))))))))). + +theorem csubst1_flat: + \forall (f: F).(\forall (i: nat).(\forall (v: T).(\forall (u1: T).(\forall +(u2: T).((subst1 i v u1 u2) \to (\forall (c1: C).(\forall (c2: C).((csubst1 i +v c1 c2) \to (csubst1 i v (CHead c1 (Flat f) u1) (CHead c2 (Flat f) +u2)))))))))) +\def + \lambda (f: F).(\lambda (i: nat).(\lambda (v: T).(\lambda (u1: T).(\lambda +(u2: T).(\lambda (H: (subst1 i v u1 u2)).(\lambda (c1: C).(\lambda (c2: +C).(\lambda (H0: (csubst1 i v c1 c2)).(eq_ind nat (s (Flat f) i) (\lambda (n: +nat).(csubst1 n v (CHead c1 (Flat f) u1) (CHead c2 (Flat f) u2))) +(csubst1_head (Flat f) i v u1 u2 H c1 c2 H0) i (refl_equal nat i)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/clear.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/clear.ma new file mode 100644 index 000000000..22581895b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/clear.ma @@ -0,0 +1,72 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubt/clear". + +include "csubt/defs.ma". + +include "clear/fwd.ma". + +theorem csubt_clear_conf: + \forall (g: G).(\forall (c1: C).(\forall (c2: C).((csubt g c1 c2) \to +(\forall (e1: C).((clear c1 e1) \to (ex2 C (\lambda (e2: C).(csubt g e1 e2)) +(\lambda (e2: C).(clear c2 e2)))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (csubt g c1 +c2)).(csubt_ind g (\lambda (c: C).(\lambda (c0: C).(\forall (e1: C).((clear c +e1) \to (ex2 C (\lambda (e2: C).(csubt g e1 e2)) (\lambda (e2: C).(clear c0 +e2))))))) (\lambda (n: nat).(\lambda (e1: C).(\lambda (H0: (clear (CSort n) +e1)).(clear_gen_sort e1 n H0 (ex2 C (\lambda (e2: C).(csubt g e1 e2)) +(\lambda (e2: C).(clear (CSort n) e2))))))) (\lambda (c3: C).(\lambda (c4: +C).(\lambda (H0: (csubt g c3 c4)).(\lambda (H1: ((\forall (e1: C).((clear c3 +e1) \to (ex2 C (\lambda (e2: C).(csubt g e1 e2)) (\lambda (e2: C).(clear c4 +e2))))))).(\lambda (k: K).(\lambda (u: T).(\lambda (e1: C).(\lambda (H2: +(clear (CHead c3 k u) e1)).(K_ind (\lambda (k0: K).((clear (CHead c3 k0 u) +e1) \to (ex2 C (\lambda (e2: C).(csubt g e1 e2)) (\lambda (e2: C).(clear +(CHead c4 k0 u) e2))))) (\lambda (b: B).(\lambda (H3: (clear (CHead c3 (Bind +b) u) e1)).(eq_ind_r C (CHead c3 (Bind b) u) (\lambda (c: C).(ex2 C (\lambda +(e2: C).(csubt g c e2)) (\lambda (e2: C).(clear (CHead c4 (Bind b) u) e2)))) +(ex_intro2 C (\lambda (e2: C).(csubt g (CHead c3 (Bind b) u) e2)) (\lambda +(e2: C).(clear (CHead c4 (Bind b) u) e2)) (CHead c4 (Bind b) u) (csubt_head g +c3 c4 H0 (Bind b) u) (clear_bind b c4 u)) e1 (clear_gen_bind b c3 e1 u H3)))) +(\lambda (f: F).(\lambda (H3: (clear (CHead c3 (Flat f) u) e1)).(let H4 \def +(H1 e1 (clear_gen_flat f c3 e1 u H3)) in (ex2_ind C (\lambda (e2: C).(csubt g +e1 e2)) (\lambda (e2: C).(clear c4 e2)) (ex2 C (\lambda (e2: C).(csubt g e1 +e2)) (\lambda (e2: C).(clear (CHead c4 (Flat f) u) e2))) (\lambda (x: +C).(\lambda (H5: (csubt g e1 x)).(\lambda (H6: (clear c4 x)).(ex_intro2 C +(\lambda (e2: C).(csubt g e1 e2)) (\lambda (e2: C).(clear (CHead c4 (Flat f) +u) e2)) x H5 (clear_flat c4 x H6 f u))))) H4)))) k H2))))))))) (\lambda (c3: +C).(\lambda (c4: C).(\lambda (H0: (csubt g c3 c4)).(\lambda (_: ((\forall +(e1: C).((clear c3 e1) \to (ex2 C (\lambda (e2: C).(csubt g e1 e2)) (\lambda +(e2: C).(clear c4 e2))))))).(\lambda (b: B).(\lambda (H2: (not (eq B b +Void))).(\lambda (u1: T).(\lambda (u2: T).(\lambda (e1: C).(\lambda (H3: +(clear (CHead c3 (Bind Void) u1) e1)).(eq_ind_r C (CHead c3 (Bind Void) u1) +(\lambda (c: C).(ex2 C (\lambda (e2: C).(csubt g c e2)) (\lambda (e2: +C).(clear (CHead c4 (Bind b) u2) e2)))) (ex_intro2 C (\lambda (e2: C).(csubt +g (CHead c3 (Bind Void) u1) e2)) (\lambda (e2: C).(clear (CHead c4 (Bind b) +u2) e2)) (CHead c4 (Bind b) u2) (csubt_void g c3 c4 H0 b H2 u1 u2) +(clear_bind b c4 u2)) e1 (clear_gen_bind Void c3 e1 u1 H3)))))))))))) +(\lambda (c3: C).(\lambda (c4: C).(\lambda (H0: (csubt g c3 c4)).(\lambda (_: +((\forall (e1: C).((clear c3 e1) \to (ex2 C (\lambda (e2: C).(csubt g e1 e2)) +(\lambda (e2: C).(clear c4 e2))))))).(\lambda (u: T).(\lambda (t: T).(\lambda +(H2: (ty3 g c4 u t)).(\lambda (e1: C).(\lambda (H3: (clear (CHead c3 (Bind +Abst) t) e1)).(eq_ind_r C (CHead c3 (Bind Abst) t) (\lambda (c: C).(ex2 C +(\lambda (e2: C).(csubt g c e2)) (\lambda (e2: C).(clear (CHead c4 (Bind +Abbr) u) e2)))) (ex_intro2 C (\lambda (e2: C).(csubt g (CHead c3 (Bind Abst) +t) e2)) (\lambda (e2: C).(clear (CHead c4 (Bind Abbr) u) e2)) (CHead c4 (Bind +Abbr) u) (csubt_abst g c3 c4 H0 u t H2) (clear_bind Abbr c4 u)) e1 +(clear_gen_bind Abst c3 e1 t H3))))))))))) c1 c2 H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/defs.ma new file mode 100644 index 000000000..3f90ff3ce --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/defs.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubt/defs". + +include "ty3/defs.ma". + +inductive csubt (g: G): C \to (C \to Prop) \def +| csubt_sort: \forall (n: nat).(csubt g (CSort n) (CSort n)) +| csubt_head: \forall (c1: C).(\forall (c2: C).((csubt g c1 c2) \to (\forall +(k: K).(\forall (u: T).(csubt g (CHead c1 k u) (CHead c2 k u)))))) +| csubt_void: \forall (c1: C).(\forall (c2: C).((csubt g c1 c2) \to (\forall +(b: B).((not (eq B b Void)) \to (\forall (u1: T).(\forall (u2: T).(csubt g +(CHead c1 (Bind Void) u1) (CHead c2 (Bind b) u2)))))))) +| csubt_abst: \forall (c1: C).(\forall (c2: C).((csubt g c1 c2) \to (\forall +(u: T).(\forall (t: T).((ty3 g c2 u t) \to (csubt g (CHead c1 (Bind Abst) t) +(CHead c2 (Bind Abbr) u))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/drop.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/drop.ma new file mode 100644 index 000000000..7a7efe4ce --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/drop.ma @@ -0,0 +1,805 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubt/drop". + +include "csubt/defs.ma". + +include "drop/fwd.ma". + +theorem csubt_drop_flat: + \forall (g: G).(\forall (f: F).(\forall (n: nat).(\forall (c1: C).(\forall +(c2: C).((csubt g c1 c2) \to (\forall (d1: C).(\forall (u: T).((drop n O c1 +(CHead d1 (Flat f) u)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop n O c2 (CHead d2 (Flat f) u)))))))))))) +\def + \lambda (g: G).(\lambda (f: F).(\lambda (n: nat).(nat_ind (\lambda (n0: +nat).(\forall (c1: C).(\forall (c2: C).((csubt g c1 c2) \to (\forall (d1: +C).(\forall (u: T).((drop n0 O c1 (CHead d1 (Flat f) u)) \to (ex2 C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c2 (CHead d2 (Flat f) +u))))))))))) (\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (csubt g c1 +c2)).(\lambda (d1: C).(\lambda (u: T).(\lambda (H0: (drop O O c1 (CHead d1 +(Flat f) u))).(let H1 \def (eq_ind C c1 (\lambda (c: C).(csubt g c c2)) H +(CHead d1 (Flat f) u) (drop_gen_refl c1 (CHead d1 (Flat f) u) H0)) in (let H2 +\def (match H1 in csubt return (\lambda (c: C).(\lambda (c0: C).(\lambda (_: +(csubt ? c c0)).((eq C c (CHead d1 (Flat f) u)) \to ((eq C c0 c2) \to (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 +(Flat f) u))))))))) with [(csubt_sort n0) \Rightarrow (\lambda (H2: (eq C +(CSort n0) (CHead d1 (Flat f) u))).(\lambda (H3: (eq C (CSort n0) c2)).((let +H4 \def (eq_ind C (CSort n0) (\lambda (e: C).(match e in C return (\lambda +(_: C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow +False])) I (CHead d1 (Flat f) u) H2) in (False_ind ((eq C (CSort n0) c2) \to +(ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead +d2 (Flat f) u))))) H4)) H3))) | (csubt_head c0 c3 H2 k u0) \Rightarrow +(\lambda (H3: (eq C (CHead c0 k u0) (CHead d1 (Flat f) u))).(\lambda (H4: (eq +C (CHead c3 k u0) c2)).((let H5 \def (f_equal C T (\lambda (e: C).(match e in +C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | (CHead _ _ t) +\Rightarrow t])) (CHead c0 k u0) (CHead d1 (Flat f) u) H3) in ((let H6 \def +(f_equal C K (\lambda (e: C).(match e in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) (CHead c0 k u0) +(CHead d1 (Flat f) u) H3) in ((let H7 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | +(CHead c _ _) \Rightarrow c])) (CHead c0 k u0) (CHead d1 (Flat f) u) H3) in +(eq_ind C d1 (\lambda (c: C).((eq K k (Flat f)) \to ((eq T u0 u) \to ((eq C +(CHead c3 k u0) c2) \to ((csubt g c c3) \to (ex2 C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 (Flat f) u))))))))) (\lambda +(H8: (eq K k (Flat f))).(eq_ind K (Flat f) (\lambda (k0: K).((eq T u0 u) \to +((eq C (CHead c3 k0 u0) c2) \to ((csubt g d1 c3) \to (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 (Flat f) +u)))))))) (\lambda (H9: (eq T u0 u)).(eq_ind T u (\lambda (t: T).((eq C +(CHead c3 (Flat f) t) c2) \to ((csubt g d1 c3) \to (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 (Flat f) u))))))) +(\lambda (H10: (eq C (CHead c3 (Flat f) u) c2)).(eq_ind C (CHead c3 (Flat f) +u) (\lambda (c: C).((csubt g d1 c3) \to (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(drop O O c (CHead d2 (Flat f) u)))))) (\lambda (H11: +(csubt g d1 c3)).(ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop O O (CHead c3 (Flat f) u) (CHead d2 (Flat f) u))) c3 H11 (drop_refl +(CHead c3 (Flat f) u)))) c2 H10)) u0 (sym_eq T u0 u H9))) k (sym_eq K k (Flat +f) H8))) c0 (sym_eq C c0 d1 H7))) H6)) H5)) H4 H2))) | (csubt_void c0 c3 H2 b +H3 u1 u2) \Rightarrow (\lambda (H4: (eq C (CHead c0 (Bind Void) u1) (CHead d1 +(Flat f) u))).(\lambda (H5: (eq C (CHead c3 (Bind b) u2) c2)).((let H6 \def +(eq_ind C (CHead c0 (Bind Void) u1) (\lambda (e: C).(match e in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (CHead d1 (Flat f) u) +H4) in (False_ind ((eq C (CHead c3 (Bind b) u2) c2) \to ((csubt g c0 c3) \to +((not (eq B b Void)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop O O c2 (CHead d2 (Flat f) u))))))) H6)) H5 H2 H3))) | +(csubt_abst c0 c3 H2 u0 t H3) \Rightarrow (\lambda (H4: (eq C (CHead c0 (Bind +Abst) t) (CHead d1 (Flat f) u))).(\lambda (H5: (eq C (CHead c3 (Bind Abbr) +u0) c2)).((let H6 \def (eq_ind C (CHead c0 (Bind Abst) t) (\lambda (e: +C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow +False | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).Prop) +with [(Bind _) \Rightarrow True | (Flat _) \Rightarrow False])])) I (CHead d1 +(Flat f) u) H4) in (False_ind ((eq C (CHead c3 (Bind Abbr) u0) c2) \to +((csubt g c0 c3) \to ((ty3 g c3 u0 t) \to (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 (Flat f) u))))))) H6)) H5 H2 +H3)))]) in (H2 (refl_equal C (CHead d1 (Flat f) u)) (refl_equal C +c2)))))))))) (\lambda (n0: nat).(\lambda (H: ((\forall (c1: C).(\forall (c2: +C).((csubt g c1 c2) \to (\forall (d1: C).(\forall (u: T).((drop n0 O c1 +(CHead d1 (Flat f) u)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop n0 O c2 (CHead d2 (Flat f) u)))))))))))).(\lambda (c1: +C).(\lambda (c2: C).(\lambda (H0: (csubt g c1 c2)).(csubt_ind g (\lambda (c: +C).(\lambda (c0: C).(\forall (d1: C).(\forall (u: T).((drop (S n0) O c (CHead +d1 (Flat f) u)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop (S n0) O c0 (CHead d2 (Flat f) u))))))))) (\lambda (n1: +nat).(\lambda (d1: C).(\lambda (u: T).(\lambda (H1: (drop (S n0) O (CSort n1) +(CHead d1 (Flat f) u))).(let H2 \def (match H1 in drop return (\lambda (n2: +nat).(\lambda (n3: nat).(\lambda (c: C).(\lambda (c0: C).(\lambda (_: (drop +n2 n3 c c0)).((eq nat n2 (S n0)) \to ((eq nat n3 O) \to ((eq C c (CSort n1)) +\to ((eq C c0 (CHead d1 (Flat f) u)) \to (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(drop (S n0) O (CSort n1) (CHead d2 (Flat f) +u))))))))))))) with [(drop_refl c) \Rightarrow (\lambda (H2: (eq nat O (S +n0))).(\lambda (H3: (eq nat O O)).(\lambda (H4: (eq C c (CSort n1))).(\lambda +(H5: (eq C c (CHead d1 (Flat f) u))).((let H6 \def (eq_ind nat O (\lambda (e: +nat).(match e in nat return (\lambda (_: nat).Prop) with [O \Rightarrow True +| (S _) \Rightarrow False])) I (S n0) H2) in (False_ind ((eq nat O O) \to +((eq C c (CSort n1)) \to ((eq C c (CHead d1 (Flat f) u)) \to (ex2 C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CSort n1) (CHead d2 +(Flat f) u))))))) H6)) H3 H4 H5))))) | (drop_drop k h c e H2 u0) \Rightarrow +(\lambda (H3: (eq nat (S h) (S n0))).(\lambda (H4: (eq nat O O)).(\lambda +(H5: (eq C (CHead c k u0) (CSort n1))).(\lambda (H6: (eq C e (CHead d1 (Flat +f) u))).((let H7 \def (f_equal nat nat (\lambda (e0: nat).(match e0 in nat +return (\lambda (_: nat).nat) with [O \Rightarrow h | (S n2) \Rightarrow +n2])) (S h) (S n0) H3) in (eq_ind nat n0 (\lambda (n2: nat).((eq nat O O) \to +((eq C (CHead c k u0) (CSort n1)) \to ((eq C e (CHead d1 (Flat f) u)) \to +((drop (r k n2) O c e) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop (S n0) O (CSort n1) (CHead d2 (Flat f) u))))))))) (\lambda (_: +(eq nat O O)).(\lambda (H9: (eq C (CHead c k u0) (CSort n1))).(let H10 \def +(eq_ind C (CHead c k u0) (\lambda (e0: C).(match e0 in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow False | (CHead _ _ _) \Rightarrow +True])) I (CSort n1) H9) in (False_ind ((eq C e (CHead d1 (Flat f) u)) \to +((drop (r k n0) O c e) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop (S n0) O (CSort n1) (CHead d2 (Flat f) u)))))) H10)))) h +(sym_eq nat h n0 H7))) H4 H5 H6 H2))))) | (drop_skip k h d c e H2 u0) +\Rightarrow (\lambda (H3: (eq nat h (S n0))).(\lambda (H4: (eq nat (S d) +O)).(\lambda (H5: (eq C (CHead c k (lift h (r k d) u0)) (CSort n1))).(\lambda +(H6: (eq C (CHead e k u0) (CHead d1 (Flat f) u))).(eq_ind nat (S n0) (\lambda +(n2: nat).((eq nat (S d) O) \to ((eq C (CHead c k (lift n2 (r k d) u0)) +(CSort n1)) \to ((eq C (CHead e k u0) (CHead d1 (Flat f) u)) \to ((drop n2 (r +k d) c e) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop +(S n0) O (CSort n1) (CHead d2 (Flat f) u))))))))) (\lambda (H7: (eq nat (S d) +O)).(let H8 \def (eq_ind nat (S d) (\lambda (e0: nat).(match e0 in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) +I O H7) in (False_ind ((eq C (CHead c k (lift (S n0) (r k d) u0)) (CSort n1)) +\to ((eq C (CHead e k u0) (CHead d1 (Flat f) u)) \to ((drop (S n0) (r k d) c +e) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) +O (CSort n1) (CHead d2 (Flat f) u))))))) H8))) h (sym_eq nat h (S n0) H3) H4 +H5 H6 H2)))))]) in (H2 (refl_equal nat (S n0)) (refl_equal nat O) (refl_equal +C (CSort n1)) (refl_equal C (CHead d1 (Flat f) u)))))))) (\lambda (c0: +C).(\lambda (c3: C).(\lambda (H1: (csubt g c0 c3)).(\lambda (H2: ((\forall +(d1: C).(\forall (u: T).((drop (S n0) O c0 (CHead d1 (Flat f) u)) \to (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O c3 (CHead +d2 (Flat f) u))))))))).(\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (u: +T).(\forall (d1: C).(\forall (u0: T).((drop (S n0) O (CHead c0 k0 u) (CHead +d1 (Flat f) u0)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop (S n0) O (CHead c3 k0 u) (CHead d2 (Flat f) u0))))))))) (\lambda (b: +B).(\lambda (u: T).(\lambda (d1: C).(\lambda (u0: T).(\lambda (H3: (drop (S +n0) O (CHead c0 (Bind b) u) (CHead d1 (Flat f) u0))).(ex2_ind C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c3 (CHead d2 (Flat f) u0))) +(ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O +(CHead c3 (Bind b) u) (CHead d2 (Flat f) u0)))) (\lambda (x: C).(\lambda (H4: +(csubt g d1 x)).(\lambda (H5: (drop n0 O c3 (CHead x (Flat f) +u0))).(ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop +(S n0) O (CHead c3 (Bind b) u) (CHead d2 (Flat f) u0))) x H4 (drop_drop (Bind +b) n0 c3 (CHead x (Flat f) u0) H5 u))))) (H c0 c3 H1 d1 u0 (drop_gen_drop +(Bind b) c0 (CHead d1 (Flat f) u0) u n0 H3)))))))) (\lambda (f0: F).(\lambda +(u: T).(\lambda (d1: C).(\lambda (u0: T).(\lambda (H3: (drop (S n0) O (CHead +c0 (Flat f0) u) (CHead d1 (Flat f) u0))).(ex2_ind C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(drop (S n0) O c3 (CHead d2 (Flat f) u0))) (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Flat f0) u) (CHead d2 (Flat f) u0)))) (\lambda (x: C).(\lambda (H4: (csubt g +d1 x)).(\lambda (H5: (drop (S n0) O c3 (CHead x (Flat f) u0))).(ex_intro2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Flat f0) u) (CHead d2 (Flat f) u0))) x H4 (drop_drop (Flat f0) n0 c3 (CHead +x (Flat f) u0) H5 u))))) (H2 d1 u0 (drop_gen_drop (Flat f0) c0 (CHead d1 +(Flat f) u0) u n0 H3)))))))) k)))))) (\lambda (c0: C).(\lambda (c3: +C).(\lambda (H1: (csubt g c0 c3)).(\lambda (_: ((\forall (d1: C).(\forall (u: +T).((drop (S n0) O c0 (CHead d1 (Flat f) u)) \to (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O c3 (CHead d2 (Flat f) +u))))))))).(\lambda (b: B).(\lambda (_: (not (eq B b Void))).(\lambda (u1: +T).(\lambda (u2: T).(\lambda (d1: C).(\lambda (u: T).(\lambda (H4: (drop (S +n0) O (CHead c0 (Bind Void) u1) (CHead d1 (Flat f) u))).(ex2_ind C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c3 (CHead d2 (Flat f) +u))) (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O +(CHead c3 (Bind b) u2) (CHead d2 (Flat f) u)))) (\lambda (x: C).(\lambda (H5: +(csubt g d1 x)).(\lambda (H6: (drop n0 O c3 (CHead x (Flat f) u))).(ex_intro2 +C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Bind b) u2) (CHead d2 (Flat f) u))) x H5 (drop_drop (Bind b) n0 c3 (CHead x +(Flat f) u) H6 u2))))) (H c0 c3 H1 d1 u (drop_gen_drop (Bind Void) c0 (CHead +d1 (Flat f) u) u1 n0 H4)))))))))))))) (\lambda (c0: C).(\lambda (c3: +C).(\lambda (H1: (csubt g c0 c3)).(\lambda (_: ((\forall (d1: C).(\forall (u: +T).((drop (S n0) O c0 (CHead d1 (Flat f) u)) \to (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O c3 (CHead d2 (Flat f) +u))))))))).(\lambda (u: T).(\lambda (t: T).(\lambda (_: (ty3 g c3 u +t)).(\lambda (d1: C).(\lambda (u0: T).(\lambda (H4: (drop (S n0) O (CHead c0 +(Bind Abst) t) (CHead d1 (Flat f) u0))).(ex2_ind C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(drop n0 O c3 (CHead d2 (Flat f) u0))) (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Bind Abbr) u) (CHead d2 (Flat f) u0)))) (\lambda (x: C).(\lambda (H5: (csubt +g d1 x)).(\lambda (H6: (drop n0 O c3 (CHead x (Flat f) u0))).(ex_intro2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Bind Abbr) u) (CHead d2 (Flat f) u0))) x H5 (drop_drop (Bind Abbr) n0 c3 +(CHead x (Flat f) u0) H6 u))))) (H c0 c3 H1 d1 u0 (drop_gen_drop (Bind Abst) +c0 (CHead d1 (Flat f) u0) t n0 H4))))))))))))) c1 c2 H0)))))) n))). + +theorem csubt_drop_abbr: + \forall (g: G).(\forall (n: nat).(\forall (c1: C).(\forall (c2: C).((csubt g +c1 c2) \to (\forall (d1: C).(\forall (u: T).((drop n O c1 (CHead d1 (Bind +Abbr) u)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop +n O c2 (CHead d2 (Bind Abbr) u))))))))))) +\def + \lambda (g: G).(\lambda (n: nat).(nat_ind (\lambda (n0: nat).(\forall (c1: +C).(\forall (c2: C).((csubt g c1 c2) \to (\forall (d1: C).(\forall (u: +T).((drop n0 O c1 (CHead d1 (Bind Abbr) u)) \to (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c2 (CHead d2 (Bind Abbr) +u))))))))))) (\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (csubt g c1 +c2)).(\lambda (d1: C).(\lambda (u: T).(\lambda (H0: (drop O O c1 (CHead d1 +(Bind Abbr) u))).(let H1 \def (eq_ind C c1 (\lambda (c: C).(csubt g c c2)) H +(CHead d1 (Bind Abbr) u) (drop_gen_refl c1 (CHead d1 (Bind Abbr) u) H0)) in +(let H2 \def (match H1 in csubt return (\lambda (c: C).(\lambda (c0: +C).(\lambda (_: (csubt ? c c0)).((eq C c (CHead d1 (Bind Abbr) u)) \to ((eq C +c0 c2) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O +O c2 (CHead d2 (Bind Abbr) u))))))))) with [(csubt_sort n0) \Rightarrow +(\lambda (H2: (eq C (CSort n0) (CHead d1 (Bind Abbr) u))).(\lambda (H3: (eq C +(CSort n0) c2)).((let H4 \def (eq_ind C (CSort n0) (\lambda (e: C).(match e +in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow True | (CHead _ +_ _) \Rightarrow False])) I (CHead d1 (Bind Abbr) u) H2) in (False_ind ((eq C +(CSort n0) c2) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop O O c2 (CHead d2 (Bind Abbr) u))))) H4)) H3))) | (csubt_head c0 c3 +H2 k u0) \Rightarrow (\lambda (H3: (eq C (CHead c0 k u0) (CHead d1 (Bind +Abbr) u))).(\lambda (H4: (eq C (CHead c3 k u0) c2)).((let H5 \def (f_equal C +T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u0 | (CHead _ _ t) \Rightarrow t])) (CHead c0 k u0) (CHead d1 +(Bind Abbr) u) H3) in ((let H6 \def (f_equal C K (\lambda (e: C).(match e in +C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k0 _) +\Rightarrow k0])) (CHead c0 k u0) (CHead d1 (Bind Abbr) u) H3) in ((let H7 +\def (f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) +with [(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) (CHead c0 k +u0) (CHead d1 (Bind Abbr) u) H3) in (eq_ind C d1 (\lambda (c: C).((eq K k +(Bind Abbr)) \to ((eq T u0 u) \to ((eq C (CHead c3 k u0) c2) \to ((csubt g c +c3) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O +c2 (CHead d2 (Bind Abbr) u))))))))) (\lambda (H8: (eq K k (Bind +Abbr))).(eq_ind K (Bind Abbr) (\lambda (k0: K).((eq T u0 u) \to ((eq C (CHead +c3 k0 u0) c2) \to ((csubt g d1 c3) \to (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abbr) u)))))))) (\lambda +(H9: (eq T u0 u)).(eq_ind T u (\lambda (t: T).((eq C (CHead c3 (Bind Abbr) t) +c2) \to ((csubt g d1 c3) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abbr) u))))))) (\lambda (H10: +(eq C (CHead c3 (Bind Abbr) u) c2)).(eq_ind C (CHead c3 (Bind Abbr) u) +(\lambda (c: C).((csubt g d1 c3) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop O O c (CHead d2 (Bind Abbr) u)))))) (\lambda (H11: +(csubt g d1 c3)).(ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop O O (CHead c3 (Bind Abbr) u) (CHead d2 (Bind Abbr) u))) c3 H11 +(drop_refl (CHead c3 (Bind Abbr) u)))) c2 H10)) u0 (sym_eq T u0 u H9))) k +(sym_eq K k (Bind Abbr) H8))) c0 (sym_eq C c0 d1 H7))) H6)) H5)) H4 H2))) | +(csubt_void c0 c3 H2 b H3 u1 u2) \Rightarrow (\lambda (H4: (eq C (CHead c0 +(Bind Void) u1) (CHead d1 (Bind Abbr) u))).(\lambda (H5: (eq C (CHead c3 +(Bind b) u2) c2)).((let H6 \def (eq_ind C (CHead c0 (Bind Void) u1) (\lambda +(e: C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow +False | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).Prop) +with [(Bind b0) \Rightarrow (match b0 in B return (\lambda (_: B).Prop) with +[Abbr \Rightarrow False | Abst \Rightarrow False | Void \Rightarrow True]) | +(Flat _) \Rightarrow False])])) I (CHead d1 (Bind Abbr) u) H4) in (False_ind +((eq C (CHead c3 (Bind b) u2) c2) \to ((csubt g c0 c3) \to ((not (eq B b +Void)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O +O c2 (CHead d2 (Bind Abbr) u))))))) H6)) H5 H2 H3))) | (csubt_abst c0 c3 H2 +u0 t H3) \Rightarrow (\lambda (H4: (eq C (CHead c0 (Bind Abst) t) (CHead d1 +(Bind Abbr) u))).(\lambda (H5: (eq C (CHead c3 (Bind Abbr) u0) c2)).((let H6 +\def (eq_ind C (CHead c0 (Bind Abst) t) (\lambda (e: C).(match e in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead d1 (Bind Abbr) u) H4) in (False_ind ((eq C +(CHead c3 (Bind Abbr) u0) c2) \to ((csubt g c0 c3) \to ((ty3 g c3 u0 t) \to +(ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead +d2 (Bind Abbr) u))))))) H6)) H5 H2 H3)))]) in (H2 (refl_equal C (CHead d1 +(Bind Abbr) u)) (refl_equal C c2)))))))))) (\lambda (n0: nat).(\lambda (H: +((\forall (c1: C).(\forall (c2: C).((csubt g c1 c2) \to (\forall (d1: +C).(\forall (u: T).((drop n0 O c1 (CHead d1 (Bind Abbr) u)) \to (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c2 (CHead d2 +(Bind Abbr) u)))))))))))).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H0: +(csubt g c1 c2)).(csubt_ind g (\lambda (c: C).(\lambda (c0: C).(\forall (d1: +C).(\forall (u: T).((drop (S n0) O c (CHead d1 (Bind Abbr) u)) \to (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O c0 (CHead +d2 (Bind Abbr) u))))))))) (\lambda (n1: nat).(\lambda (d1: C).(\lambda (u: +T).(\lambda (H1: (drop (S n0) O (CSort n1) (CHead d1 (Bind Abbr) u))).(let H2 +\def (match H1 in drop return (\lambda (n2: nat).(\lambda (n3: nat).(\lambda +(c: C).(\lambda (c0: C).(\lambda (_: (drop n2 n3 c c0)).((eq nat n2 (S n0)) +\to ((eq nat n3 O) \to ((eq C c (CSort n1)) \to ((eq C c0 (CHead d1 (Bind +Abbr) u)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop +(S n0) O (CSort n1) (CHead d2 (Bind Abbr) u))))))))))))) with [(drop_refl c) +\Rightarrow (\lambda (H2: (eq nat O (S n0))).(\lambda (H3: (eq nat O +O)).(\lambda (H4: (eq C c (CSort n1))).(\lambda (H5: (eq C c (CHead d1 (Bind +Abbr) u))).((let H6 \def (eq_ind nat O (\lambda (e: nat).(match e in nat +return (\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow +False])) I (S n0) H2) in (False_ind ((eq nat O O) \to ((eq C c (CSort n1)) +\to ((eq C c (CHead d1 (Bind Abbr) u)) \to (ex2 C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(drop (S n0) O (CSort n1) (CHead d2 (Bind Abbr) +u))))))) H6)) H3 H4 H5))))) | (drop_drop k h c e H2 u0) \Rightarrow (\lambda +(H3: (eq nat (S h) (S n0))).(\lambda (H4: (eq nat O O)).(\lambda (H5: (eq C +(CHead c k u0) (CSort n1))).(\lambda (H6: (eq C e (CHead d1 (Bind Abbr) +u))).((let H7 \def (f_equal nat nat (\lambda (e0: nat).(match e0 in nat +return (\lambda (_: nat).nat) with [O \Rightarrow h | (S n2) \Rightarrow +n2])) (S h) (S n0) H3) in (eq_ind nat n0 (\lambda (n2: nat).((eq nat O O) \to +((eq C (CHead c k u0) (CSort n1)) \to ((eq C e (CHead d1 (Bind Abbr) u)) \to +((drop (r k n2) O c e) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop (S n0) O (CSort n1) (CHead d2 (Bind Abbr) u))))))))) (\lambda +(_: (eq nat O O)).(\lambda (H9: (eq C (CHead c k u0) (CSort n1))).(let H10 +\def (eq_ind C (CHead c k u0) (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ _ _) \Rightarrow +True])) I (CSort n1) H9) in (False_ind ((eq C e (CHead d1 (Bind Abbr) u)) \to +((drop (r k n0) O c e) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop (S n0) O (CSort n1) (CHead d2 (Bind Abbr) u)))))) H10)))) h +(sym_eq nat h n0 H7))) H4 H5 H6 H2))))) | (drop_skip k h d c e H2 u0) +\Rightarrow (\lambda (H3: (eq nat h (S n0))).(\lambda (H4: (eq nat (S d) +O)).(\lambda (H5: (eq C (CHead c k (lift h (r k d) u0)) (CSort n1))).(\lambda +(H6: (eq C (CHead e k u0) (CHead d1 (Bind Abbr) u))).(eq_ind nat (S n0) +(\lambda (n2: nat).((eq nat (S d) O) \to ((eq C (CHead c k (lift n2 (r k d) +u0)) (CSort n1)) \to ((eq C (CHead e k u0) (CHead d1 (Bind Abbr) u)) \to +((drop n2 (r k d) c e) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop (S n0) O (CSort n1) (CHead d2 (Bind Abbr) u))))))))) (\lambda +(H7: (eq nat (S d) O)).(let H8 \def (eq_ind nat (S d) (\lambda (e0: +nat).(match e0 in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +False | (S _) \Rightarrow True])) I O H7) in (False_ind ((eq C (CHead c k +(lift (S n0) (r k d) u0)) (CSort n1)) \to ((eq C (CHead e k u0) (CHead d1 +(Bind Abbr) u)) \to ((drop (S n0) (r k d) c e) \to (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CSort n1) (CHead d2 +(Bind Abbr) u))))))) H8))) h (sym_eq nat h (S n0) H3) H4 H5 H6 H2)))))]) in +(H2 (refl_equal nat (S n0)) (refl_equal nat O) (refl_equal C (CSort n1)) +(refl_equal C (CHead d1 (Bind Abbr) u)))))))) (\lambda (c0: C).(\lambda (c3: +C).(\lambda (H1: (csubt g c0 c3)).(\lambda (H2: ((\forall (d1: C).(\forall +(u: T).((drop (S n0) O c0 (CHead d1 (Bind Abbr) u)) \to (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O c3 (CHead d2 (Bind Abbr) +u))))))))).(\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (u: T).(\forall +(d1: C).(\forall (u0: T).((drop (S n0) O (CHead c0 k0 u) (CHead d1 (Bind +Abbr) u0)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop (S n0) O (CHead c3 k0 u) (CHead d2 (Bind Abbr) u0))))))))) (\lambda +(b: B).(\lambda (u: T).(\lambda (d1: C).(\lambda (u0: T).(\lambda (H3: (drop +(S n0) O (CHead c0 (Bind b) u) (CHead d1 (Bind Abbr) u0))).(ex2_ind C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c3 (CHead d2 +(Bind Abbr) u0))) (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop (S n0) O (CHead c3 (Bind b) u) (CHead d2 (Bind Abbr) u0)))) (\lambda +(x: C).(\lambda (H4: (csubt g d1 x)).(\lambda (H5: (drop n0 O c3 (CHead x +(Bind Abbr) u0))).(ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop (S n0) O (CHead c3 (Bind b) u) (CHead d2 (Bind Abbr) u0))) x H4 +(drop_drop (Bind b) n0 c3 (CHead x (Bind Abbr) u0) H5 u))))) (H c0 c3 H1 d1 +u0 (drop_gen_drop (Bind b) c0 (CHead d1 (Bind Abbr) u0) u n0 H3)))))))) +(\lambda (f: F).(\lambda (u: T).(\lambda (d1: C).(\lambda (u0: T).(\lambda +(H3: (drop (S n0) O (CHead c0 (Flat f) u) (CHead d1 (Bind Abbr) +u0))).(ex2_ind C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S +n0) O c3 (CHead d2 (Bind Abbr) u0))) (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop (S n0) O (CHead c3 (Flat f) u) (CHead d2 (Bind Abbr) +u0)))) (\lambda (x: C).(\lambda (H4: (csubt g d1 x)).(\lambda (H5: (drop (S +n0) O c3 (CHead x (Bind Abbr) u0))).(ex_intro2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Flat f) u) (CHead d2 (Bind +Abbr) u0))) x H4 (drop_drop (Flat f) n0 c3 (CHead x (Bind Abbr) u0) H5 u))))) +(H2 d1 u0 (drop_gen_drop (Flat f) c0 (CHead d1 (Bind Abbr) u0) u n0 +H3)))))))) k)))))) (\lambda (c0: C).(\lambda (c3: C).(\lambda (H1: (csubt g +c0 c3)).(\lambda (_: ((\forall (d1: C).(\forall (u: T).((drop (S n0) O c0 +(CHead d1 (Bind Abbr) u)) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop (S n0) O c3 (CHead d2 (Bind Abbr) u))))))))).(\lambda +(b: B).(\lambda (_: (not (eq B b Void))).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (d1: C).(\lambda (u: T).(\lambda (H4: (drop (S n0) O (CHead c0 +(Bind Void) u1) (CHead d1 (Bind Abbr) u))).(ex2_ind C (\lambda (d2: C).(csubt +g d1 d2)) (\lambda (d2: C).(drop n0 O c3 (CHead d2 (Bind Abbr) u))) (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Bind b) u2) (CHead d2 (Bind Abbr) u)))) (\lambda (x: C).(\lambda (H5: (csubt +g d1 x)).(\lambda (H6: (drop n0 O c3 (CHead x (Bind Abbr) u))).(ex_intro2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Bind b) u2) (CHead d2 (Bind Abbr) u))) x H5 (drop_drop (Bind b) n0 c3 (CHead +x (Bind Abbr) u) H6 u2))))) (H c0 c3 H1 d1 u (drop_gen_drop (Bind Void) c0 +(CHead d1 (Bind Abbr) u) u1 n0 H4)))))))))))))) (\lambda (c0: C).(\lambda +(c3: C).(\lambda (H1: (csubt g c0 c3)).(\lambda (_: ((\forall (d1: +C).(\forall (u: T).((drop (S n0) O c0 (CHead d1 (Bind Abbr) u)) \to (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O c3 (CHead +d2 (Bind Abbr) u))))))))).(\lambda (u: T).(\lambda (t: T).(\lambda (_: (ty3 g +c3 u t)).(\lambda (d1: C).(\lambda (u0: T).(\lambda (H4: (drop (S n0) O +(CHead c0 (Bind Abst) t) (CHead d1 (Bind Abbr) u0))).(ex2_ind C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c3 (CHead d2 (Bind Abbr) +u0))) (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) +O (CHead c3 (Bind Abbr) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (x: +C).(\lambda (H5: (csubt g d1 x)).(\lambda (H6: (drop n0 O c3 (CHead x (Bind +Abbr) u0))).(ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop (S n0) O (CHead c3 (Bind Abbr) u) (CHead d2 (Bind Abbr) u0))) x H5 +(drop_drop (Bind Abbr) n0 c3 (CHead x (Bind Abbr) u0) H6 u))))) (H c0 c3 H1 +d1 u0 (drop_gen_drop (Bind Abst) c0 (CHead d1 (Bind Abbr) u0) t n0 +H4))))))))))))) c1 c2 H0)))))) n)). + +theorem csubt_drop_abst: + \forall (g: G).(\forall (n: nat).(\forall (c1: C).(\forall (c2: C).((csubt g +c1 c2) \to (\forall (d1: C).(\forall (t: T).((drop n O c1 (CHead d1 (Bind +Abst) t)) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop n O c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(drop n +O c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t)))))))))))) +\def + \lambda (g: G).(\lambda (n: nat).(nat_ind (\lambda (n0: nat).(\forall (c1: +C).(\forall (c2: C).((csubt g c1 c2) \to (\forall (d1: C).(\forall (t: +T).((drop n0 O c1 (CHead d1 (Bind Abst) t)) \to (or (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c2 (CHead d2 (Bind Abst) +t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u: T).(drop n0 O c2 (CHead d2 (Bind Abbr) u)))) (\lambda +(d2: C).(\lambda (u: T).(ty3 g d2 u t)))))))))))) (\lambda (c1: C).(\lambda +(c2: C).(\lambda (H: (csubt g c1 c2)).(\lambda (d1: C).(\lambda (t: +T).(\lambda (H0: (drop O O c1 (CHead d1 (Bind Abst) t))).(let H1 \def (eq_ind +C c1 (\lambda (c: C).(csubt g c c2)) H (CHead d1 (Bind Abst) t) +(drop_gen_refl c1 (CHead d1 (Bind Abst) t) H0)) in (let H2 \def (match H1 in +csubt return (\lambda (c: C).(\lambda (c0: C).(\lambda (_: (csubt ? c +c0)).((eq C c (CHead d1 (Bind Abst) t)) \to ((eq C c0 c2) \to (or (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 +(Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u: T).(drop O O c2 (CHead d2 (Bind Abbr) +u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t)))))))))) with +[(csubt_sort n0) \Rightarrow (\lambda (H2: (eq C (CSort n0) (CHead d1 (Bind +Abst) t))).(\lambda (H3: (eq C (CSort n0) c2)).((let H4 \def (eq_ind C (CSort +n0) (\lambda (e: C).(match e in C return (\lambda (_: C).Prop) with [(CSort +_) \Rightarrow True | (CHead _ _ _) \Rightarrow False])) I (CHead d1 (Bind +Abst) t) H2) in (False_ind ((eq C (CSort n0) c2) \to (or (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abst) t)))) +(ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u: T).(drop O O c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: +C).(\lambda (u: T).(ty3 g d2 u t)))))) H4)) H3))) | (csubt_head c0 c3 H2 k u) +\Rightarrow (\lambda (H3: (eq C (CHead c0 k u) (CHead d1 (Bind Abst) +t))).(\lambda (H4: (eq C (CHead c3 k u) c2)).((let H5 \def (f_equal C T +(\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 k u) (CHead d1 +(Bind Abst) t) H3) in ((let H6 \def (f_equal C K (\lambda (e: C).(match e in +C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k0 _) +\Rightarrow k0])) (CHead c0 k u) (CHead d1 (Bind Abst) t) H3) in ((let H7 +\def (f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) +with [(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) (CHead c0 k +u) (CHead d1 (Bind Abst) t) H3) in (eq_ind C d1 (\lambda (c: C).((eq K k +(Bind Abst)) \to ((eq T u t) \to ((eq C (CHead c3 k u) c2) \to ((csubt g c +c3) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O +O c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop O O c2 (CHead d2 +(Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t)))))))))) +(\lambda (H8: (eq K k (Bind Abst))).(eq_ind K (Bind Abst) (\lambda (k0: +K).((eq T u t) \to ((eq C (CHead c3 k0 u) c2) \to ((csubt g d1 c3) \to (or +(ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead +d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u0: T).(drop O O c2 (CHead d2 (Bind Abbr) +u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t))))))))) (\lambda +(H9: (eq T u t)).(eq_ind T t (\lambda (t0: T).((eq C (CHead c3 (Bind Abst) +t0) c2) \to ((csubt g d1 c3) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda +(d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: +T).(drop O O c2 (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: +T).(ty3 g d2 u0 t)))))))) (\lambda (H10: (eq C (CHead c3 (Bind Abst) t) +c2)).(eq_ind C (CHead c3 (Bind Abst) t) (\lambda (c: C).((csubt g d1 c3) \to +(or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c +(CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop O O c (CHead d2 +(Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t))))))) +(\lambda (H11: (csubt g d1 c3)).(or_introl (ex2 C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(drop O O (CHead c3 (Bind Abst) t) (CHead d2 (Bind +Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) +(\lambda (d2: C).(\lambda (u0: T).(drop O O (CHead c3 (Bind Abst) t) (CHead +d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t)))) +(ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O +(CHead c3 (Bind Abst) t) (CHead d2 (Bind Abst) t))) c3 H11 (drop_refl (CHead +c3 (Bind Abst) t))))) c2 H10)) u (sym_eq T u t H9))) k (sym_eq K k (Bind +Abst) H8))) c0 (sym_eq C c0 d1 H7))) H6)) H5)) H4 H2))) | (csubt_void c0 c3 +H2 b H3 u1 u2) \Rightarrow (\lambda (H4: (eq C (CHead c0 (Bind Void) u1) +(CHead d1 (Bind Abst) t))).(\lambda (H5: (eq C (CHead c3 (Bind b) u2) +c2)).((let H6 \def (eq_ind C (CHead c0 (Bind Void) u1) (\lambda (e: C).(match +e in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | +(CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind b0) \Rightarrow (match b0 in B return (\lambda (_: B).Prop) with [Abbr +\Rightarrow False | Abst \Rightarrow False | Void \Rightarrow True]) | (Flat +_) \Rightarrow False])])) I (CHead d1 (Bind Abst) t) H4) in (False_ind ((eq C +(CHead c3 (Bind b) u2) c2) \to ((csubt g c0 c3) \to ((not (eq B b Void)) \to +(or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 +(CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(drop O O c2 (CHead d2 +(Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t)))))))) H6)) +H5 H2 H3))) | (csubt_abst c0 c3 H2 u t0 H3) \Rightarrow (\lambda (H4: (eq C +(CHead c0 (Bind Abst) t0) (CHead d1 (Bind Abst) t))).(\lambda (H5: (eq C +(CHead c3 (Bind Abbr) u) c2)).((let H6 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow t0 | +(CHead _ _ t1) \Rightarrow t1])) (CHead c0 (Bind Abst) t0) (CHead d1 (Bind +Abst) t) H4) in ((let H7 \def (f_equal C C (\lambda (e: C).(match e in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c _ _) +\Rightarrow c])) (CHead c0 (Bind Abst) t0) (CHead d1 (Bind Abst) t) H4) in +(eq_ind C d1 (\lambda (c: C).((eq T t0 t) \to ((eq C (CHead c3 (Bind Abbr) u) +c2) \to ((csubt g c c3) \to ((ty3 g c3 u t0) \to (or (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abst) t)))) +(ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u0: T).(drop O O c2 (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: +C).(\lambda (u0: T).(ty3 g d2 u0 t)))))))))) (\lambda (H8: (eq T t0 +t)).(eq_ind T t (\lambda (t1: T).((eq C (CHead c3 (Bind Abbr) u) c2) \to +((csubt g d1 c3) \to ((ty3 g c3 u t1) \to (or (ex2 C (\lambda (d2: C).(csubt +g d1 d2)) (\lambda (d2: C).(drop O O c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C +T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u0: T).(drop O O c2 (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: +C).(\lambda (u0: T).(ty3 g d2 u0 t))))))))) (\lambda (H9: (eq C (CHead c3 +(Bind Abbr) u) c2)).(eq_ind C (CHead c3 (Bind Abbr) u) (\lambda (c: +C).((csubt g d1 c3) \to ((ty3 g c3 u t) \to (or (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop O O c (CHead d2 (Bind Abst) t)))) +(ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u0: T).(drop O O c (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: +C).(\lambda (u0: T).(ty3 g d2 u0 t)))))))) (\lambda (H10: (csubt g d1 +c3)).(\lambda (H11: (ty3 g c3 u t)).(or_intror (ex2 C (\lambda (d2: C).(csubt +g d1 d2)) (\lambda (d2: C).(drop O O (CHead c3 (Bind Abbr) u) (CHead d2 (Bind +Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) +(\lambda (d2: C).(\lambda (u0: T).(drop O O (CHead c3 (Bind Abbr) u) (CHead +d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t)))) +(ex3_2_intro C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u0: T).(drop O O (CHead c3 (Bind Abbr) u) (CHead d2 (Bind +Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t))) c3 u H10 +(drop_refl (CHead c3 (Bind Abbr) u)) H11)))) c2 H9)) t0 (sym_eq T t0 t H8))) +c0 (sym_eq C c0 d1 H7))) H6)) H5 H2 H3)))]) in (H2 (refl_equal C (CHead d1 +(Bind Abst) t)) (refl_equal C c2)))))))))) (\lambda (n0: nat).(\lambda (H: +((\forall (c1: C).(\forall (c2: C).((csubt g c1 c2) \to (\forall (d1: +C).(\forall (t: T).((drop n0 O c1 (CHead d1 (Bind Abst) t)) \to (or (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c2 (CHead d2 +(Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u: T).(drop n0 O c2 (CHead d2 (Bind Abbr) +u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))))))))))))).(\lambda +(c1: C).(\lambda (c2: C).(\lambda (H0: (csubt g c1 c2)).(csubt_ind g (\lambda +(c: C).(\lambda (c0: C).(\forall (d1: C).(\forall (t: T).((drop (S n0) O c +(CHead d1 (Bind Abst) t)) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop (S n0) O c0 (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(drop (S n0) O c0 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: +C).(\lambda (u: T).(ty3 g d2 u t)))))))))) (\lambda (n1: nat).(\lambda (d1: +C).(\lambda (t: T).(\lambda (H1: (drop (S n0) O (CSort n1) (CHead d1 (Bind +Abst) t))).(let H2 \def (match H1 in drop return (\lambda (n2: nat).(\lambda +(n3: nat).(\lambda (c: C).(\lambda (c0: C).(\lambda (_: (drop n2 n3 c +c0)).((eq nat n2 (S n0)) \to ((eq nat n3 O) \to ((eq C c (CSort n1)) \to ((eq +C c0 (CHead d1 (Bind Abst) t)) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(drop (S n0) O (CSort n1) (CHead d2 (Bind Abst) t)))) +(ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u: T).(drop (S n0) O (CSort n1) (CHead d2 (Bind Abbr) u)))) +(\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t)))))))))))))) with [(drop_refl +c) \Rightarrow (\lambda (H2: (eq nat O (S n0))).(\lambda (H3: (eq nat O +O)).(\lambda (H4: (eq C c (CSort n1))).(\lambda (H5: (eq C c (CHead d1 (Bind +Abst) t))).((let H6 \def (eq_ind nat O (\lambda (e: nat).(match e in nat +return (\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow +False])) I (S n0) H2) in (False_ind ((eq nat O O) \to ((eq C c (CSort n1)) +\to ((eq C c (CHead d1 (Bind Abst) t)) \to (or (ex2 C (\lambda (d2: C).(csubt +g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CSort n1) (CHead d2 (Bind Abst) +t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u: T).(drop (S n0) O (CSort n1) (CHead d2 (Bind Abbr) u)))) +(\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t)))))))) H6)) H3 H4 H5))))) | +(drop_drop k h c e H2 u) \Rightarrow (\lambda (H3: (eq nat (S h) (S +n0))).(\lambda (H4: (eq nat O O)).(\lambda (H5: (eq C (CHead c k u) (CSort +n1))).(\lambda (H6: (eq C e (CHead d1 (Bind Abst) t))).((let H7 \def (f_equal +nat nat (\lambda (e0: nat).(match e0 in nat return (\lambda (_: nat).nat) +with [O \Rightarrow h | (S n2) \Rightarrow n2])) (S h) (S n0) H3) in (eq_ind +nat n0 (\lambda (n2: nat).((eq nat O O) \to ((eq C (CHead c k u) (CSort n1)) +\to ((eq C e (CHead d1 (Bind Abst) t)) \to ((drop (r k n2) O c e) \to (or +(ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O +(CSort n1) (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda +(_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O +(CSort n1) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: +T).(ty3 g d2 u0 t)))))))))) (\lambda (_: (eq nat O O)).(\lambda (H9: (eq C +(CHead c k u) (CSort n1))).(let H10 \def (eq_ind C (CHead c k u) (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ _ _) \Rightarrow True])) I (CSort n1) H9) in +(False_ind ((eq C e (CHead d1 (Bind Abst) t)) \to ((drop (r k n0) O c e) \to +(or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O +(CSort n1) (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda +(_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O +(CSort n1) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: +T).(ty3 g d2 u0 t))))))) H10)))) h (sym_eq nat h n0 H7))) H4 H5 H6 H2))))) | +(drop_skip k h d c e H2 u) \Rightarrow (\lambda (H3: (eq nat h (S +n0))).(\lambda (H4: (eq nat (S d) O)).(\lambda (H5: (eq C (CHead c k (lift h +(r k d) u)) (CSort n1))).(\lambda (H6: (eq C (CHead e k u) (CHead d1 (Bind +Abst) t))).(eq_ind nat (S n0) (\lambda (n2: nat).((eq nat (S d) O) \to ((eq C +(CHead c k (lift n2 (r k d) u)) (CSort n1)) \to ((eq C (CHead e k u) (CHead +d1 (Bind Abst) t)) \to ((drop n2 (r k d) c e) \to (or (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CSort n1) (CHead d2 +(Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CSort n1) (CHead d2 +(Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t)))))))))) +(\lambda (H7: (eq nat (S d) O)).(let H8 \def (eq_ind nat (S d) (\lambda (e0: +nat).(match e0 in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +False | (S _) \Rightarrow True])) I O H7) in (False_ind ((eq C (CHead c k +(lift (S n0) (r k d) u)) (CSort n1)) \to ((eq C (CHead e k u) (CHead d1 (Bind +Abst) t)) \to ((drop (S n0) (r k d) c e) \to (or (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CSort n1) (CHead d2 +(Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CSort n1) (CHead d2 +(Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t)))))))) +H8))) h (sym_eq nat h (S n0) H3) H4 H5 H6 H2)))))]) in (H2 (refl_equal nat (S +n0)) (refl_equal nat O) (refl_equal C (CSort n1)) (refl_equal C (CHead d1 +(Bind Abst) t)))))))) (\lambda (c0: C).(\lambda (c3: C).(\lambda (H1: (csubt +g c0 c3)).(\lambda (H2: ((\forall (d1: C).(\forall (t: T).((drop (S n0) O c0 +(CHead d1 (Bind Abst) t)) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop (S n0) O c3 (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(drop (S n0) O c3 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: +C).(\lambda (u: T).(ty3 g d2 u t)))))))))).(\lambda (k: K).(K_ind (\lambda +(k0: K).(\forall (u: T).(\forall (d1: C).(\forall (t: T).((drop (S n0) O +(CHead c0 k0 u) (CHead d1 (Bind Abst) t)) \to (or (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 k0 u) (CHead d2 +(Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 k0 u) (CHead +d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 +t)))))))))) (\lambda (b: B).(\lambda (u: T).(\lambda (d1: C).(\lambda (t: +T).(\lambda (H3: (drop (S n0) O (CHead c0 (Bind b) u) (CHead d1 (Bind Abst) +t))).(or_ind (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop +n0 O c3 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop n0 O c3 (CHead +d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t)))) +(or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O +(CHead c3 (Bind b) u) (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop +(S n0) O (CHead c3 (Bind b) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: +C).(\lambda (u0: T).(ty3 g d2 u0 t))))) (\lambda (H4: (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c3 (CHead d2 (Bind Abst) +t))))).(ex2_ind C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 +O c3 (CHead d2 (Bind Abst) t))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop (S n0) O (CHead c3 (Bind b) u) (CHead d2 (Bind Abst) +t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) u) (CHead d2 (Bind +Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t))))) (\lambda +(x: C).(\lambda (H5: (csubt g d1 x)).(\lambda (H6: (drop n0 O c3 (CHead x +(Bind Abst) t))).(or_introl (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop (S n0) O (CHead c3 (Bind b) u) (CHead d2 (Bind Abst) t)))) +(ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Bind b) u) (CHead d2 (Bind +Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t)))) (ex_intro2 +C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Bind b) u) (CHead d2 (Bind Abst) t))) x H5 (drop_drop (Bind b) n0 c3 (CHead +x (Bind Abst) t) H6 u)))))) H4)) (\lambda (H4: (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop +n0 O c3 (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g +d2 u0 t))))).(ex3_2_ind C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u0: T).(drop n0 O c3 (CHead d2 (Bind Abbr) +u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t))) (or (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Bind b) u) (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda +(_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O +(CHead c3 (Bind b) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda +(u0: T).(ty3 g d2 u0 t))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H5: +(csubt g d1 x0)).(\lambda (H6: (drop n0 O c3 (CHead x0 (Bind Abbr) +x1))).(\lambda (H7: (ty3 g x0 x1 t)).(or_intror (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Bind b) u) +(CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CHead +c3 (Bind b) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: +T).(ty3 g d2 u0 t)))) (ex3_2_intro C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CHead +c3 (Bind b) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: +T).(ty3 g d2 u0 t))) x0 x1 H5 (drop_drop (Bind b) n0 c3 (CHead x0 (Bind Abbr) +x1) H6 u) H7))))))) H4)) (H c0 c3 H1 d1 t (drop_gen_drop (Bind b) c0 (CHead +d1 (Bind Abst) t) u n0 H3)))))))) (\lambda (f: F).(\lambda (u: T).(\lambda +(d1: C).(\lambda (t: T).(\lambda (H3: (drop (S n0) O (CHead c0 (Flat f) u) +(CHead d1 (Bind Abst) t))).(or_ind (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop (S n0) O c3 (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u0: T).(drop (S n0) O c3 (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: +C).(\lambda (u0: T).(ty3 g d2 u0 t)))) (or (ex2 C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Flat f) u) (CHead d2 (Bind +Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) +(\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Flat f) u) (CHead +d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t))))) +(\lambda (H4: (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop +(S n0) O c3 (CHead d2 (Bind Abst) t))))).(ex2_ind C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(drop (S n0) O c3 (CHead d2 (Bind Abst) t))) (or +(ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O +(CHead c3 (Flat f) u) (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop +(S n0) O (CHead c3 (Flat f) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: +C).(\lambda (u0: T).(ty3 g d2 u0 t))))) (\lambda (x: C).(\lambda (H5: (csubt +g d1 x)).(\lambda (H6: (drop (S n0) O c3 (CHead x (Bind Abst) t))).(or_introl +(ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O +(CHead c3 (Flat f) u) (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop +(S n0) O (CHead c3 (Flat f) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: +C).(\lambda (u0: T).(ty3 g d2 u0 t)))) (ex_intro2 C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Flat f) u) (CHead d2 (Bind +Abst) t))) x H5 (drop_drop (Flat f) n0 c3 (CHead x (Bind Abst) t) H6 u)))))) +H4)) (\lambda (H4: (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O c3 (CHead d2 (Bind +Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t))))).(ex3_2_ind +C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u0: T).(drop (S n0) O c3 (CHead d2 (Bind Abbr) u0)))) (\lambda +(d2: C).(\lambda (u0: T).(ty3 g d2 u0 t))) (or (ex2 C (\lambda (d2: C).(csubt +g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Flat f) u) (CHead d2 +(Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Flat f) u) +(CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 +t))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H5: (csubt g d1 +x0)).(\lambda (H6: (drop (S n0) O c3 (CHead x0 (Bind Abbr) x1))).(\lambda +(H7: (ty3 g x0 x1 t)).(or_intror (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop (S n0) O (CHead c3 (Flat f) u) (CHead d2 (Bind Abst) +t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Flat f) u) (CHead d2 (Bind +Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t)))) +(ex3_2_intro C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u0: T).(drop (S n0) O (CHead c3 (Flat f) u) (CHead d2 (Bind +Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t))) x0 x1 H5 +(drop_drop (Flat f) n0 c3 (CHead x0 (Bind Abbr) x1) H6 u) H7))))))) H4)) (H2 +d1 t (drop_gen_drop (Flat f) c0 (CHead d1 (Bind Abst) t) u n0 H3)))))))) +k)))))) (\lambda (c0: C).(\lambda (c3: C).(\lambda (H1: (csubt g c0 +c3)).(\lambda (_: ((\forall (d1: C).(\forall (t: T).((drop (S n0) O c0 (CHead +d1 (Bind Abst) t)) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop (S n0) O c3 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda +(d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: +T).(drop (S n0) O c3 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda +(u: T).(ty3 g d2 u t)))))))))).(\lambda (b: B).(\lambda (_: (not (eq B b +Void))).(\lambda (u1: T).(\lambda (u2: T).(\lambda (d1: C).(\lambda (t: +T).(\lambda (H4: (drop (S n0) O (CHead c0 (Bind Void) u1) (CHead d1 (Bind +Abst) t))).(or_ind (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop n0 O c3 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(drop +n0 O c3 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g +d2 u t)))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead d2 (Bind Abst) t)))) (ex3_2 C +T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead d2 (Bind +Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))))) (\lambda (H5: +(ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c3 +(CHead d2 (Bind Abst) t))))).(ex2_ind C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop n0 O c3 (CHead d2 (Bind Abst) t))) (or (ex2 C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Bind b) +u2) (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(drop (S n0) O (CHead +c3 (Bind b) u2) (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t))))) (\lambda (x: C).(\lambda (H6: (csubt g d1 x)).(\lambda +(H7: (drop n0 O c3 (CHead x (Bind Abst) t))).(or_introl (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Bind b) u2) +(CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(drop (S n0) O (CHead +c3 (Bind b) u2) (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t)))) (ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead d2 (Bind Abst) t))) x H6 +(drop_drop (Bind b) n0 c3 (CHead x (Bind Abst) t) H7 u2)))))) H5)) (\lambda +(H5: (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u: T).(drop n0 O c3 (CHead d2 (Bind Abbr) u)))) (\lambda +(d2: C).(\lambda (u: T).(ty3 g d2 u t))))).(ex3_2_ind C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(drop +n0 O c3 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g +d2 u t))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop +(S n0) O (CHead c3 (Bind b) u2) (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(drop (S n0) O (CHead c3 (Bind b) u2) (CHead d2 (Bind Abbr) u)))) +(\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))))) (\lambda (x0: C).(\lambda +(x1: T).(\lambda (H6: (csubt g d1 x0)).(\lambda (H7: (drop n0 O c3 (CHead x0 +(Bind Abbr) x1))).(\lambda (H8: (ty3 g x0 x1 t)).(or_intror (ex2 C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Bind b) +u2) (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(drop (S n0) O (CHead +c3 (Bind b) u2) (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t)))) (ex3_2_intro C T (\lambda (d2: C).(\lambda (_: T).(csubt +g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(drop (S n0) O (CHead c3 (Bind b) +u2) (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t))) x0 x1 H6 (drop_drop (Bind b) n0 c3 (CHead x0 (Bind Abbr) x1) H7 u2) +H8))))))) H5)) (H c0 c3 H1 d1 t (drop_gen_drop (Bind Void) c0 (CHead d1 (Bind +Abst) t) u1 n0 H4)))))))))))))) (\lambda (c0: C).(\lambda (c3: C).(\lambda +(H1: (csubt g c0 c3)).(\lambda (_: ((\forall (d1: C).(\forall (t: T).((drop +(S n0) O c0 (CHead d1 (Bind Abst) t)) \to (or (ex2 C (\lambda (d2: C).(csubt +g d1 d2)) (\lambda (d2: C).(drop (S n0) O c3 (CHead d2 (Bind Abst) t)))) +(ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u: T).(drop (S n0) O c3 (CHead d2 (Bind Abbr) u)))) (\lambda +(d2: C).(\lambda (u: T).(ty3 g d2 u t)))))))))).(\lambda (u: T).(\lambda (t: +T).(\lambda (_: (ty3 g c3 u t)).(\lambda (d1: C).(\lambda (t0: T).(\lambda +(H4: (drop (S n0) O (CHead c0 (Bind Abst) t) (CHead d1 (Bind Abst) +t0))).(or_ind (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop +n0 O c3 (CHead d2 (Bind Abst) t0)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop n0 O c3 (CHead +d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t0)))) +(or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O +(CHead c3 (Bind Abbr) u) (CHead d2 (Bind Abst) t0)))) (ex3_2 C T (\lambda +(d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: +T).(drop (S n0) O (CHead c3 (Bind Abbr) u) (CHead d2 (Bind Abbr) u0)))) +(\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t0))))) (\lambda (H5: (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop n0 O c3 (CHead d2 +(Bind Abst) t0))))).(ex2_ind C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(drop n0 O c3 (CHead d2 (Bind Abst) t0))) (or (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Bind Abbr) u) +(CHead d2 (Bind Abst) t0)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CHead +c3 (Bind Abbr) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: +T).(ty3 g d2 u0 t0))))) (\lambda (x: C).(\lambda (H6: (csubt g d1 +x)).(\lambda (H7: (drop n0 O c3 (CHead x (Bind Abst) t0))).(or_introl (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 +(Bind Abbr) u) (CHead d2 (Bind Abst) t0)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop +(S n0) O (CHead c3 (Bind Abbr) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: +C).(\lambda (u0: T).(ty3 g d2 u0 t0)))) (ex_intro2 C (\lambda (d2: C).(csubt +g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Bind Abbr) u) (CHead d2 +(Bind Abst) t0))) x H6 (drop_drop (Bind Abbr) n0 c3 (CHead x (Bind Abst) t0) +H7 u)))))) H5)) (\lambda (H5: (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop n0 O c3 (CHead +d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 +t0))))).(ex3_2_ind C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) +(\lambda (d2: C).(\lambda (u0: T).(drop n0 O c3 (CHead d2 (Bind Abbr) u0)))) +(\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 u0 t0))) (or (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Bind Abbr) u) +(CHead d2 (Bind Abst) t0)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CHead +c3 (Bind Abbr) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: +T).(ty3 g d2 u0 t0))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H6: +(csubt g d1 x0)).(\lambda (H7: (drop n0 O c3 (CHead x0 (Bind Abbr) +x1))).(\lambda (H8: (ty3 g x0 x1 t0)).(or_intror (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop (S n0) O (CHead c3 (Bind Abbr) u) +(CHead d2 (Bind Abst) t0)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CHead +c3 (Bind Abbr) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: +T).(ty3 g d2 u0 t0)))) (ex3_2_intro C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u0: T).(drop (S n0) O (CHead +c3 (Bind Abbr) u) (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: +T).(ty3 g d2 u0 t0))) x0 x1 H6 (drop_drop (Bind Abbr) n0 c3 (CHead x0 (Bind +Abbr) x1) H7 u) H8))))))) H5)) (H c0 c3 H1 d1 t0 (drop_gen_drop (Bind Abst) +c0 (CHead d1 (Bind Abst) t0) t n0 H4))))))))))))) c1 c2 H0)))))) n)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/fwd.ma new file mode 100644 index 000000000..92e19a503 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/fwd.ma @@ -0,0 +1,389 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubt/fwd". + +include "csubt/defs.ma". + +theorem csubt_inv_coq: + \forall (g: G).(\forall (c1: C).(\forall (c2: C).(\forall (P: ((G \to (C \to +(C \to Prop))))).((((csubt g c1 c2) \to (\forall (n: nat).((eq C (CSort n) +c1) \to ((eq C (CSort n) c2) \to (P g c1 c2)))))) \to ((((csubt g c1 c2) \to +(\forall (c0: C).(\forall (c3: C).(\forall (k: K).(\forall (u: T).((eq C +(CHead c0 k u) c1) \to ((eq C (CHead c3 k u) c2) \to ((csubt g c0 c3) \to (P +g c1 c2)))))))))) \to ((((csubt g c1 c2) \to (\forall (c0: C).(\forall (c3: +C).(\forall (b: B).(\forall (u1: T).(\forall (u2: T).((eq C (CHead c0 (Bind +Void) u1) c1) \to ((eq C (CHead c3 (Bind b) u2) c2) \to ((csubt g c0 c3) \to +((not (eq B b Void)) \to (P g c1 c2)))))))))))) \to ((((csubt g c1 c2) \to +(\forall (c0: C).(\forall (c3: C).(\forall (u: T).(\forall (t: T).((eq C +(CHead c0 (Bind Abst) t) c1) \to ((eq C (CHead c3 (Bind Abbr) u) c2) \to +((csubt g c0 c3) \to ((ty3 g c3 u t) \to (P g c1 c2))))))))))) \to ((csubt g +c1 c2) \to (P g c1 c2))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (c2: C).(\lambda (P: ((G \to (C \to +(C \to Prop))))).(\lambda (H: (((csubt g c1 c2) \to (\forall (n: nat).((eq C +(CSort n) c1) \to ((eq C (CSort n) c2) \to (P g c1 c2))))))).(\lambda (H0: +(((csubt g c1 c2) \to (\forall (c0: C).(\forall (c3: C).(\forall (k: +K).(\forall (u: T).((eq C (CHead c0 k u) c1) \to ((eq C (CHead c3 k u) c2) +\to ((csubt g c0 c3) \to (P g c1 c2))))))))))).(\lambda (H1: (((csubt g c1 +c2) \to (\forall (c0: C).(\forall (c3: C).(\forall (b: B).(\forall (u1: +T).(\forall (u2: T).((eq C (CHead c0 (Bind Void) u1) c1) \to ((eq C (CHead c3 +(Bind b) u2) c2) \to ((csubt g c0 c3) \to ((not (eq B b Void)) \to (P g c1 +c2))))))))))))).(\lambda (H2: (((csubt g c1 c2) \to (\forall (c0: C).(\forall +(c3: C).(\forall (u: T).(\forall (t: T).((eq C (CHead c0 (Bind Abst) t) c1) +\to ((eq C (CHead c3 (Bind Abbr) u) c2) \to ((csubt g c0 c3) \to ((ty3 g c3 u +t) \to (P g c1 c2)))))))))))).(\lambda (H3: (csubt g c1 c2)).(let H4 \def +(match H3 in csubt return (\lambda (c: C).(\lambda (c0: C).(\lambda (_: +(csubt ? c c0)).((eq C c c1) \to ((eq C c0 c2) \to (P g c1 c2)))))) with +[(csubt_sort n) \Rightarrow (\lambda (H4: (eq C (CSort n) c1)).(\lambda (H5: +(eq C (CSort n) c2)).(H H3 n H4 H5))) | (csubt_head c0 c3 H4 k u) \Rightarrow +(\lambda (H5: (eq C (CHead c0 k u) c1)).(\lambda (H6: (eq C (CHead c3 k u) +c2)).(H0 H3 c0 c3 k u H5 H6 H4))) | (csubt_void c0 c3 H4 b H5 u1 u2) +\Rightarrow (\lambda (H6: (eq C (CHead c0 (Bind Void) u1) c1)).(\lambda (H7: +(eq C (CHead c3 (Bind b) u2) c2)).(H1 H3 c0 c3 b u1 u2 H6 H7 H4 H5))) | +(csubt_abst c0 c3 H4 u t H5) \Rightarrow (\lambda (H6: (eq C (CHead c0 (Bind +Abst) t) c1)).(\lambda (H7: (eq C (CHead c3 (Bind Abbr) u) c2)).(H2 H3 c0 c3 +u t H6 H7 H4 H5)))]) in (H4 (refl_equal C c1) (refl_equal C c2))))))))))). + +theorem csubt_gen_abbr: + \forall (g: G).(\forall (e1: C).(\forall (c2: C).(\forall (v: T).((csubt g +(CHead e1 (Bind Abbr) v) c2) \to (ex2 C (\lambda (e2: C).(eq C c2 (CHead e2 +(Bind Abbr) v))) (\lambda (e2: C).(csubt g e1 e2))))))) +\def + \lambda (g: G).(\lambda (e1: C).(\lambda (c2: C).(\lambda (v: T).(\lambda +(H: (csubt g (CHead e1 (Bind Abbr) v) c2)).(csubt_inv_coq g (CHead e1 (Bind +Abbr) v) c2 (\lambda (g0: G).(\lambda (_: C).(\lambda (c0: C).(ex2 C (\lambda +(e2: C).(eq C c0 (CHead e2 (Bind Abbr) v))) (\lambda (e2: C).(csubt g0 e1 +e2)))))) (\lambda (H0: (csubt g (CHead e1 (Bind Abbr) v) c2)).(\lambda (n: +nat).(\lambda (H1: (eq C (CSort n) (CHead e1 (Bind Abbr) v))).(\lambda (H2: +(eq C (CSort n) c2)).(let H3 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g +(CHead e1 (Bind Abbr) v) c)) H0 (CSort n) H2) in (let H4 \def (eq_ind_r C c2 +(\lambda (c: C).(csubt g (CHead e1 (Bind Abbr) v) c)) H (CSort n) H2) in +(eq_ind C (CSort n) (\lambda (c: C).(ex2 C (\lambda (e2: C).(eq C c (CHead e2 +(Bind Abbr) v))) (\lambda (e2: C).(csubt g e1 e2)))) (let H5 \def (eq_ind C +(CSort n) (\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with +[(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow False])) I (CHead e1 +(Bind Abbr) v) H1) in (False_ind (ex2 C (\lambda (e2: C).(eq C (CSort n) +(CHead e2 (Bind Abbr) v))) (\lambda (e2: C).(csubt g e1 e2))) H5)) c2 +H2))))))) (\lambda (H0: (csubt g (CHead e1 (Bind Abbr) v) c2)).(\lambda (c0: +C).(\lambda (c3: C).(\lambda (k: K).(\lambda (u: T).(\lambda (H1: (eq C +(CHead c0 k u) (CHead e1 (Bind Abbr) v))).(\lambda (H2: (eq C (CHead c3 k u) +c2)).(\lambda (H3: (csubt g c0 c3)).(let H4 \def (eq_ind_r C c2 (\lambda (c: +C).(csubt g (CHead e1 (Bind Abbr) v) c)) H0 (CHead c3 k u) H2) in (let H5 +\def (eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 (Bind Abbr) v) c)) H +(CHead c3 k u) H2) in (eq_ind C (CHead c3 k u) (\lambda (c: C).(ex2 C +(\lambda (e2: C).(eq C c (CHead e2 (Bind Abbr) v))) (\lambda (e2: C).(csubt g +e1 e2)))) (let H6 \def (f_equal C C (\lambda (e: C).(match e in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow +c])) (CHead c0 k u) (CHead e1 (Bind Abbr) v) H1) in ((let H7 \def (f_equal C +K (\lambda (e: C).(match e in C return (\lambda (_: C).K) with [(CSort _) +\Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) (CHead c0 k u) (CHead e1 +(Bind Abbr) v) H1) in ((let H8 \def (f_equal C T (\lambda (e: C).(match e in +C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t) +\Rightarrow t])) (CHead c0 k u) (CHead e1 (Bind Abbr) v) H1) in (\lambda (H9: +(eq K k (Bind Abbr))).(\lambda (H10: (eq C c0 e1)).(let H11 \def (eq_ind T u +(\lambda (t: T).(csubt g (CHead e1 (Bind Abbr) v) (CHead c3 k t))) H5 v H8) +in (let H12 \def (eq_ind T u (\lambda (t: T).(csubt g (CHead e1 (Bind Abbr) +v) (CHead c3 k t))) H4 v H8) in (eq_ind_r T v (\lambda (t: T).(ex2 C (\lambda +(e2: C).(eq C (CHead c3 k t) (CHead e2 (Bind Abbr) v))) (\lambda (e2: +C).(csubt g e1 e2)))) (let H13 \def (eq_ind K k (\lambda (k0: K).(csubt g +(CHead e1 (Bind Abbr) v) (CHead c3 k0 v))) H11 (Bind Abbr) H9) in (let H14 +\def (eq_ind K k (\lambda (k0: K).(csubt g (CHead e1 (Bind Abbr) v) (CHead c3 +k0 v))) H12 (Bind Abbr) H9) in (eq_ind_r K (Bind Abbr) (\lambda (k0: K).(ex2 +C (\lambda (e2: C).(eq C (CHead c3 k0 v) (CHead e2 (Bind Abbr) v))) (\lambda +(e2: C).(csubt g e1 e2)))) (let H15 \def (eq_ind C c0 (\lambda (c: C).(csubt +g c c3)) H3 e1 H10) in (ex_intro2 C (\lambda (e2: C).(eq C (CHead c3 (Bind +Abbr) v) (CHead e2 (Bind Abbr) v))) (\lambda (e2: C).(csubt g e1 e2)) c3 +(refl_equal C (CHead c3 (Bind Abbr) v)) H15)) k H9))) u H8)))))) H7)) H6)) c2 +H2))))))))))) (\lambda (H0: (csubt g (CHead e1 (Bind Abbr) v) c2)).(\lambda +(c0: C).(\lambda (c3: C).(\lambda (b: B).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (H2: (eq C (CHead c0 (Bind Void) u1) (CHead e1 (Bind Abbr) +v))).(\lambda (H3: (eq C (CHead c3 (Bind b) u2) c2)).(\lambda (_: (csubt g c0 +c3)).(\lambda (_: (not (eq B b Void))).(let H5 \def (eq_ind_r C c2 (\lambda +(c: C).(csubt g (CHead e1 (Bind Abbr) v) c)) H0 (CHead c3 (Bind b) u2) H3) in +(let H6 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 (Bind Abbr) v) +c)) H (CHead c3 (Bind b) u2) H3) in (eq_ind C (CHead c3 (Bind b) u2) (\lambda +(c: C).(ex2 C (\lambda (e2: C).(eq C c (CHead e2 (Bind Abbr) v))) (\lambda +(e2: C).(csubt g e1 e2)))) (let H7 \def (eq_ind C (CHead c0 (Bind Void) u1) +(\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind b0) \Rightarrow (match b0 in B return (\lambda (_: +B).Prop) with [Abbr \Rightarrow False | Abst \Rightarrow False | Void +\Rightarrow True]) | (Flat _) \Rightarrow False])])) I (CHead e1 (Bind Abbr) +v) H2) in (False_ind (ex2 C (\lambda (e2: C).(eq C (CHead c3 (Bind b) u2) +(CHead e2 (Bind Abbr) v))) (\lambda (e2: C).(csubt g e1 e2))) H7)) c2 +H3))))))))))))) (\lambda (H0: (csubt g (CHead e1 (Bind Abbr) v) c2)).(\lambda +(c0: C).(\lambda (c3: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H2: (eq C +(CHead c0 (Bind Abst) t) (CHead e1 (Bind Abbr) v))).(\lambda (H3: (eq C +(CHead c3 (Bind Abbr) u) c2)).(\lambda (_: (csubt g c0 c3)).(\lambda (_: (ty3 +g c3 u t)).(let H5 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 +(Bind Abbr) v) c)) H0 (CHead c3 (Bind Abbr) u) H3) in (let H6 \def (eq_ind_r +C c2 (\lambda (c: C).(csubt g (CHead e1 (Bind Abbr) v) c)) H (CHead c3 (Bind +Abbr) u) H3) in (eq_ind C (CHead c3 (Bind Abbr) u) (\lambda (c: C).(ex2 C +(\lambda (e2: C).(eq C c (CHead e2 (Bind Abbr) v))) (\lambda (e2: C).(csubt g +e1 e2)))) (let H7 \def (eq_ind C (CHead c0 (Bind Abst) t) (\lambda (ee: +C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow +False | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).Prop) +with [(Bind b) \Rightarrow (match b in B return (\lambda (_: B).Prop) with +[Abbr \Rightarrow False | Abst \Rightarrow True | Void \Rightarrow False]) | +(Flat _) \Rightarrow False])])) I (CHead e1 (Bind Abbr) v) H2) in (False_ind +(ex2 C (\lambda (e2: C).(eq C (CHead c3 (Bind Abbr) u) (CHead e2 (Bind Abbr) +v))) (\lambda (e2: C).(csubt g e1 e2))) H7)) c2 H3)))))))))))) H))))). + +theorem csubt_gen_abst: + \forall (g: G).(\forall (e1: C).(\forall (c2: C).(\forall (v1: T).((csubt g +(CHead e1 (Bind Abst) v1) c2) \to (or (ex2 C (\lambda (e2: C).(eq C c2 (CHead +e2 (Bind Abst) v1))) (\lambda (e2: C).(csubt g e1 e2))) (ex3_2 C T (\lambda +(e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: +C).(\lambda (_: T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g +e2 v2 v1))))))))) +\def + \lambda (g: G).(\lambda (e1: C).(\lambda (c2: C).(\lambda (v1: T).(\lambda +(H: (csubt g (CHead e1 (Bind Abst) v1) c2)).(csubt_inv_coq g (CHead e1 (Bind +Abst) v1) c2 (\lambda (g0: G).(\lambda (_: C).(\lambda (c0: C).(or (ex2 C +(\lambda (e2: C).(eq C c0 (CHead e2 (Bind Abst) v1))) (\lambda (e2: C).(csubt +g0 e1 e2))) (ex3_2 C T (\lambda (e2: C).(\lambda (v2: T).(eq C c0 (CHead e2 +(Bind Abbr) v2)))) (\lambda (e2: C).(\lambda (_: T).(csubt g0 e1 e2))) +(\lambda (e2: C).(\lambda (v2: T).(ty3 g0 e2 v2 v1)))))))) (\lambda (H0: +(csubt g (CHead e1 (Bind Abst) v1) c2)).(\lambda (n: nat).(\lambda (H1: (eq C +(CSort n) (CHead e1 (Bind Abst) v1))).(\lambda (H2: (eq C (CSort n) c2)).(let +H3 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 (Bind Abst) v1) c)) +H0 (CSort n) H2) in (let H4 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g +(CHead e1 (Bind Abst) v1) c)) H (CSort n) H2) in (eq_ind C (CSort n) (\lambda +(c: C).(or (ex2 C (\lambda (e2: C).(eq C c (CHead e2 (Bind Abst) v1))) +(\lambda (e2: C).(csubt g e1 e2))) (ex3_2 C T (\lambda (e2: C).(\lambda (v2: +T).(eq C c (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: C).(\lambda (_: +T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g e2 v2 v1)))))) +(let H5 \def (eq_ind C (CSort n) (\lambda (ee: C).(match ee in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) +\Rightarrow False])) I (CHead e1 (Bind Abst) v1) H1) in (False_ind (or (ex2 C +(\lambda (e2: C).(eq C (CSort n) (CHead e2 (Bind Abst) v1))) (\lambda (e2: +C).(csubt g e1 e2))) (ex3_2 C T (\lambda (e2: C).(\lambda (v2: T).(eq C +(CSort n) (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: C).(\lambda (_: +T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g e2 v2 v1))))) +H5)) c2 H2))))))) (\lambda (H0: (csubt g (CHead e1 (Bind Abst) v1) +c2)).(\lambda (c0: C).(\lambda (c3: C).(\lambda (k: K).(\lambda (u: +T).(\lambda (H1: (eq C (CHead c0 k u) (CHead e1 (Bind Abst) v1))).(\lambda +(H2: (eq C (CHead c3 k u) c2)).(\lambda (H3: (csubt g c0 c3)).(let H4 \def +(eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 (Bind Abst) v1) c)) H0 +(CHead c3 k u) H2) in (let H5 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g +(CHead e1 (Bind Abst) v1) c)) H (CHead c3 k u) H2) in (eq_ind C (CHead c3 k +u) (\lambda (c: C).(or (ex2 C (\lambda (e2: C).(eq C c (CHead e2 (Bind Abst) +v1))) (\lambda (e2: C).(csubt g e1 e2))) (ex3_2 C T (\lambda (e2: C).(\lambda +(v2: T).(eq C c (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: C).(\lambda (_: +T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g e2 v2 v1)))))) +(let H6 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: +C).C) with [(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) (CHead +c0 k u) (CHead e1 (Bind Abst) v1) H1) in ((let H7 \def (f_equal C K (\lambda +(e: C).(match e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k +| (CHead _ k0 _) \Rightarrow k0])) (CHead c0 k u) (CHead e1 (Bind Abst) v1) +H1) in ((let H8 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t) \Rightarrow +t])) (CHead c0 k u) (CHead e1 (Bind Abst) v1) H1) in (\lambda (H9: (eq K k +(Bind Abst))).(\lambda (H10: (eq C c0 e1)).(let H11 \def (eq_ind T u (\lambda +(t: T).(csubt g (CHead e1 (Bind Abst) v1) (CHead c3 k t))) H5 v1 H8) in (let +H12 \def (eq_ind T u (\lambda (t: T).(csubt g (CHead e1 (Bind Abst) v1) +(CHead c3 k t))) H4 v1 H8) in (eq_ind_r T v1 (\lambda (t: T).(or (ex2 C +(\lambda (e2: C).(eq C (CHead c3 k t) (CHead e2 (Bind Abst) v1))) (\lambda +(e2: C).(csubt g e1 e2))) (ex3_2 C T (\lambda (e2: C).(\lambda (v2: T).(eq C +(CHead c3 k t) (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: C).(\lambda (_: +T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g e2 v2 v1)))))) +(let H13 \def (eq_ind K k (\lambda (k0: K).(csubt g (CHead e1 (Bind Abst) v1) +(CHead c3 k0 v1))) H11 (Bind Abst) H9) in (let H14 \def (eq_ind K k (\lambda +(k0: K).(csubt g (CHead e1 (Bind Abst) v1) (CHead c3 k0 v1))) H12 (Bind Abst) +H9) in (eq_ind_r K (Bind Abst) (\lambda (k0: K).(or (ex2 C (\lambda (e2: +C).(eq C (CHead c3 k0 v1) (CHead e2 (Bind Abst) v1))) (\lambda (e2: C).(csubt +g e1 e2))) (ex3_2 C T (\lambda (e2: C).(\lambda (v2: T).(eq C (CHead c3 k0 +v1) (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: C).(\lambda (_: T).(csubt g e1 +e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g e2 v2 v1)))))) (let H15 \def +(eq_ind C c0 (\lambda (c: C).(csubt g c c3)) H3 e1 H10) in (or_introl (ex2 C +(\lambda (e2: C).(eq C (CHead c3 (Bind Abst) v1) (CHead e2 (Bind Abst) v1))) +(\lambda (e2: C).(csubt g e1 e2))) (ex3_2 C T (\lambda (e2: C).(\lambda (v2: +T).(eq C (CHead c3 (Bind Abst) v1) (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: +C).(\lambda (_: T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g +e2 v2 v1)))) (ex_intro2 C (\lambda (e2: C).(eq C (CHead c3 (Bind Abst) v1) +(CHead e2 (Bind Abst) v1))) (\lambda (e2: C).(csubt g e1 e2)) c3 (refl_equal +C (CHead c3 (Bind Abst) v1)) H15))) k H9))) u H8)))))) H7)) H6)) c2 +H2))))))))))) (\lambda (H0: (csubt g (CHead e1 (Bind Abst) v1) c2)).(\lambda +(c0: C).(\lambda (c3: C).(\lambda (b: B).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (H2: (eq C (CHead c0 (Bind Void) u1) (CHead e1 (Bind Abst) +v1))).(\lambda (H3: (eq C (CHead c3 (Bind b) u2) c2)).(\lambda (_: (csubt g +c0 c3)).(\lambda (_: (not (eq B b Void))).(let H5 \def (eq_ind_r C c2 +(\lambda (c: C).(csubt g (CHead e1 (Bind Abst) v1) c)) H0 (CHead c3 (Bind b) +u2) H3) in (let H6 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 +(Bind Abst) v1) c)) H (CHead c3 (Bind b) u2) H3) in (eq_ind C (CHead c3 (Bind +b) u2) (\lambda (c: C).(or (ex2 C (\lambda (e2: C).(eq C c (CHead e2 (Bind +Abst) v1))) (\lambda (e2: C).(csubt g e1 e2))) (ex3_2 C T (\lambda (e2: +C).(\lambda (v2: T).(eq C c (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: +C).(\lambda (_: T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g +e2 v2 v1)))))) (let H7 \def (eq_ind C (CHead c0 (Bind Void) u1) (\lambda (ee: +C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow +False | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).Prop) +with [(Bind b0) \Rightarrow (match b0 in B return (\lambda (_: B).Prop) with +[Abbr \Rightarrow False | Abst \Rightarrow False | Void \Rightarrow True]) | +(Flat _) \Rightarrow False])])) I (CHead e1 (Bind Abst) v1) H2) in (False_ind +(or (ex2 C (\lambda (e2: C).(eq C (CHead c3 (Bind b) u2) (CHead e2 (Bind +Abst) v1))) (\lambda (e2: C).(csubt g e1 e2))) (ex3_2 C T (\lambda (e2: +C).(\lambda (v2: T).(eq C (CHead c3 (Bind b) u2) (CHead e2 (Bind Abbr) v2)))) +(\lambda (e2: C).(\lambda (_: T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda +(v2: T).(ty3 g e2 v2 v1))))) H7)) c2 H3))))))))))))) (\lambda (H0: (csubt g +(CHead e1 (Bind Abst) v1) c2)).(\lambda (c0: C).(\lambda (c3: C).(\lambda (u: +T).(\lambda (t: T).(\lambda (H2: (eq C (CHead c0 (Bind Abst) t) (CHead e1 +(Bind Abst) v1))).(\lambda (H3: (eq C (CHead c3 (Bind Abbr) u) c2)).(\lambda +(H1: (csubt g c0 c3)).(\lambda (H4: (ty3 g c3 u t)).(let H5 \def (eq_ind_r C +c2 (\lambda (c: C).(csubt g (CHead e1 (Bind Abst) v1) c)) H0 (CHead c3 (Bind +Abbr) u) H3) in (let H6 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead +e1 (Bind Abst) v1) c)) H (CHead c3 (Bind Abbr) u) H3) in (eq_ind C (CHead c3 +(Bind Abbr) u) (\lambda (c: C).(or (ex2 C (\lambda (e2: C).(eq C c (CHead e2 +(Bind Abst) v1))) (\lambda (e2: C).(csubt g e1 e2))) (ex3_2 C T (\lambda (e2: +C).(\lambda (v2: T).(eq C c (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: +C).(\lambda (_: T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g +e2 v2 v1)))))) (let H7 \def (f_equal C C (\lambda (e: C).(match e in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow +c])) (CHead c0 (Bind Abst) t) (CHead e1 (Bind Abst) v1) H2) in ((let H8 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow t | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 (Bind +Abst) t) (CHead e1 (Bind Abst) v1) H2) in (\lambda (H9: (eq C c0 e1)).(let +H10 \def (eq_ind T t (\lambda (t0: T).(ty3 g c3 u t0)) H4 v1 H8) in (let H11 +\def (eq_ind C c0 (\lambda (c: C).(csubt g c c3)) H1 e1 H9) in (or_intror +(ex2 C (\lambda (e2: C).(eq C (CHead c3 (Bind Abbr) u) (CHead e2 (Bind Abst) +v1))) (\lambda (e2: C).(csubt g e1 e2))) (ex3_2 C T (\lambda (e2: C).(\lambda +(v2: T).(eq C (CHead c3 (Bind Abbr) u) (CHead e2 (Bind Abbr) v2)))) (\lambda +(e2: C).(\lambda (_: T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: +T).(ty3 g e2 v2 v1)))) (ex3_2_intro C T (\lambda (e2: C).(\lambda (v2: T).(eq +C (CHead c3 (Bind Abbr) u) (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: +C).(\lambda (_: T).(csubt g e1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g +e2 v2 v1))) c3 u (refl_equal C (CHead c3 (Bind Abbr) u)) H11 H10)))))) H7)) +c2 H3)))))))))))) H))))). + +theorem csubt_gen_bind: + \forall (g: G).(\forall (b1: B).(\forall (e1: C).(\forall (c2: C).(\forall +(v1: T).((csubt g (CHead e1 (Bind b1) v1) c2) \to (ex2_3 B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C c2 (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csubt g e1 e2)))))))))) +\def + \lambda (g: G).(\lambda (b1: B).(\lambda (e1: C).(\lambda (c2: C).(\lambda +(v1: T).(\lambda (H: (csubt g (CHead e1 (Bind b1) v1) c2)).(csubt_inv_coq g +(CHead e1 (Bind b1) v1) c2 (\lambda (g0: G).(\lambda (_: C).(\lambda (c0: +C).(ex2_3 B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C c0 +(CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: +T).(csubt g0 e1 e2)))))))) (\lambda (H0: (csubt g (CHead e1 (Bind b1) v1) +c2)).(\lambda (n: nat).(\lambda (H1: (eq C (CSort n) (CHead e1 (Bind b1) +v1))).(\lambda (H2: (eq C (CSort n) c2)).(let H3 \def (eq_ind_r C c2 (\lambda +(c: C).(csubt g (CHead e1 (Bind b1) v1) c)) H0 (CSort n) H2) in (let H4 \def +(eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 (Bind b1) v1) c)) H (CSort +n) H2) in (eq_ind C (CSort n) (\lambda (c: C).(ex2_3 B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C c (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csubt g e1 e2)))))) (let H5 +\def (eq_ind C (CSort n) (\lambda (ee: C).(match ee in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) \Rightarrow +False])) I (CHead e1 (Bind b1) v1) H1) in (False_ind (ex2_3 B C T (\lambda +(b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C (CSort n) (CHead e2 (Bind b2) +v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csubt g e1 e2))))) +H5)) c2 H2))))))) (\lambda (H0: (csubt g (CHead e1 (Bind b1) v1) +c2)).(\lambda (c0: C).(\lambda (c3: C).(\lambda (k: K).(\lambda (u: +T).(\lambda (H1: (eq C (CHead c0 k u) (CHead e1 (Bind b1) v1))).(\lambda (H2: +(eq C (CHead c3 k u) c2)).(\lambda (H3: (csubt g c0 c3)).(let H4 \def +(eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 (Bind b1) v1) c)) H0 (CHead +c3 k u) H2) in (let H5 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 +(Bind b1) v1) c)) H (CHead c3 k u) H2) in (eq_ind C (CHead c3 k u) (\lambda +(c: C).(ex2_3 B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C +c (CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: +T).(csubt g e1 e2)))))) (let H6 \def (f_equal C C (\lambda (e: C).(match e in +C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c _ _) +\Rightarrow c])) (CHead c0 k u) (CHead e1 (Bind b1) v1) H1) in ((let H7 \def +(f_equal C K (\lambda (e: C).(match e in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) (CHead c0 k u) +(CHead e1 (Bind b1) v1) H1) in ((let H8 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | +(CHead _ _ t) \Rightarrow t])) (CHead c0 k u) (CHead e1 (Bind b1) v1) H1) in +(\lambda (H9: (eq K k (Bind b1))).(\lambda (H10: (eq C c0 e1)).(let H11 \def +(eq_ind T u (\lambda (t: T).(csubt g (CHead e1 (Bind b1) v1) (CHead c3 k t))) +H5 v1 H8) in (let H12 \def (eq_ind T u (\lambda (t: T).(csubt g (CHead e1 +(Bind b1) v1) (CHead c3 k t))) H4 v1 H8) in (eq_ind_r T v1 (\lambda (t: +T).(ex2_3 B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C +(CHead c3 k t) (CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: +C).(\lambda (_: T).(csubt g e1 e2)))))) (let H13 \def (eq_ind K k (\lambda +(k0: K).(csubt g (CHead e1 (Bind b1) v1) (CHead c3 k0 v1))) H11 (Bind b1) H9) +in (let H14 \def (eq_ind K k (\lambda (k0: K).(csubt g (CHead e1 (Bind b1) +v1) (CHead c3 k0 v1))) H12 (Bind b1) H9) in (eq_ind_r K (Bind b1) (\lambda +(k0: K).(ex2_3 B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: T).(eq C +(CHead c3 k0 v1) (CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: +C).(\lambda (_: T).(csubt g e1 e2)))))) (let H15 \def (eq_ind C c0 (\lambda +(c: C).(csubt g c c3)) H3 e1 H10) in (ex2_3_intro B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C (CHead c3 (Bind b1) v1) (CHead e2 +(Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csubt g +e1 e2)))) b1 c3 v1 (refl_equal C (CHead c3 (Bind b1) v1)) H15)) k H9))) u +H8)))))) H7)) H6)) c2 H2))))))))))) (\lambda (H0: (csubt g (CHead e1 (Bind +b1) v1) c2)).(\lambda (c0: C).(\lambda (c3: C).(\lambda (b: B).(\lambda (u1: +T).(\lambda (u2: T).(\lambda (H2: (eq C (CHead c0 (Bind Void) u1) (CHead e1 +(Bind b1) v1))).(\lambda (H3: (eq C (CHead c3 (Bind b) u2) c2)).(\lambda (H1: +(csubt g c0 c3)).(\lambda (_: (not (eq B b Void))).(let H5 \def (eq_ind_r C +c2 (\lambda (c: C).(csubt g (CHead e1 (Bind b1) v1) c)) H0 (CHead c3 (Bind b) +u2) H3) in (let H6 \def (eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 +(Bind b1) v1) c)) H (CHead c3 (Bind b) u2) H3) in (eq_ind C (CHead c3 (Bind +b) u2) (\lambda (c: C).(ex2_3 B C T (\lambda (b2: B).(\lambda (e2: +C).(\lambda (v2: T).(eq C c (CHead e2 (Bind b2) v2))))) (\lambda (_: +B).(\lambda (e2: C).(\lambda (_: T).(csubt g e1 e2)))))) (let H7 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) (CHead c0 (Bind +Void) u1) (CHead e1 (Bind b1) v1) H2) in ((let H8 \def (f_equal C B (\lambda +(e: C).(match e in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow +Void | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).B) with +[(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow Void])])) (CHead c0 (Bind +Void) u1) (CHead e1 (Bind b1) v1) H2) in ((let H9 \def (f_equal C T (\lambda +(e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u1 +| (CHead _ _ t) \Rightarrow t])) (CHead c0 (Bind Void) u1) (CHead e1 (Bind +b1) v1) H2) in (\lambda (H10: (eq B Void b1)).(\lambda (H11: (eq C c0 +e1)).(let H12 \def (eq_ind C c0 (\lambda (c: C).(csubt g c c3)) H1 e1 H11) in +(let H13 \def (eq_ind_r B b1 (\lambda (b0: B).(csubt g (CHead e1 (Bind b0) +v1) (CHead c3 (Bind b) u2))) H6 Void H10) in (let H14 \def (eq_ind_r B b1 +(\lambda (b0: B).(csubt g (CHead e1 (Bind b0) v1) (CHead c3 (Bind b) u2))) H5 +Void H10) in (ex2_3_intro B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda +(v2: T).(eq C (CHead c3 (Bind b) u2) (CHead e2 (Bind b2) v2))))) (\lambda (_: +B).(\lambda (e2: C).(\lambda (_: T).(csubt g e1 e2)))) b c3 u2 (refl_equal C +(CHead c3 (Bind b) u2)) H12))))))) H8)) H7)) c2 H3))))))))))))) (\lambda (H0: +(csubt g (CHead e1 (Bind b1) v1) c2)).(\lambda (c0: C).(\lambda (c3: +C).(\lambda (u: T).(\lambda (t: T).(\lambda (H2: (eq C (CHead c0 (Bind Abst) +t) (CHead e1 (Bind b1) v1))).(\lambda (H3: (eq C (CHead c3 (Bind Abbr) u) +c2)).(\lambda (H1: (csubt g c0 c3)).(\lambda (H4: (ty3 g c3 u t)).(let H5 +\def (eq_ind_r C c2 (\lambda (c: C).(csubt g (CHead e1 (Bind b1) v1) c)) H0 +(CHead c3 (Bind Abbr) u) H3) in (let H6 \def (eq_ind_r C c2 (\lambda (c: +C).(csubt g (CHead e1 (Bind b1) v1) c)) H (CHead c3 (Bind Abbr) u) H3) in +(eq_ind C (CHead c3 (Bind Abbr) u) (\lambda (c: C).(ex2_3 B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C c (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csubt g e1 e2)))))) (let H7 +\def (f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) +with [(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) (CHead c0 +(Bind Abst) t) (CHead e1 (Bind b1) v1) H2) in ((let H8 \def (f_equal C B +(\lambda (e: C).(match e in C return (\lambda (_: C).B) with [(CSort _) +\Rightarrow Abst | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).B) with [(Bind b) \Rightarrow b | (Flat _) \Rightarrow Abst])])) +(CHead c0 (Bind Abst) t) (CHead e1 (Bind b1) v1) H2) in ((let H9 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow t | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 (Bind +Abst) t) (CHead e1 (Bind b1) v1) H2) in (\lambda (H10: (eq B Abst +b1)).(\lambda (H11: (eq C c0 e1)).(let H12 \def (eq_ind T t (\lambda (t0: +T).(ty3 g c3 u t0)) H4 v1 H9) in (let H13 \def (eq_ind C c0 (\lambda (c: +C).(csubt g c c3)) H1 e1 H11) in (let H14 \def (eq_ind_r B b1 (\lambda (b: +B).(csubt g (CHead e1 (Bind b) v1) (CHead c3 (Bind Abbr) u))) H6 Abst H10) in +(let H15 \def (eq_ind_r B b1 (\lambda (b: B).(csubt g (CHead e1 (Bind b) v1) +(CHead c3 (Bind Abbr) u))) H5 Abst H10) in (ex2_3_intro B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C (CHead c3 (Bind Abbr) u) (CHead e2 +(Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csubt g +e1 e2)))) Abbr c3 u (refl_equal C (CHead c3 (Bind Abbr) u)) H13)))))))) H8)) +H7)) c2 H3)))))))))))) H)))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/getl.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/getl.ma new file mode 100644 index 000000000..a0f89e0fa --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/getl.ma @@ -0,0 +1,398 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubt/getl". + +include "csubt/fwd.ma". + +include "csubt/clear.ma". + +include "csubt/drop.ma". + +include "getl/clear.ma". + +theorem csubt_getl_abbr: + \forall (g: G).(\forall (c1: C).(\forall (d1: C).(\forall (u: T).(\forall +(n: nat).((getl n c1 (CHead d1 (Bind Abbr) u)) \to (\forall (c2: C).((csubt g +c1 c2) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl n +c2 (CHead d2 (Bind Abbr) u))))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (d1: C).(\lambda (u: T).(\lambda +(n: nat).(\lambda (H: (getl n c1 (CHead d1 (Bind Abbr) u))).(let H0 \def +(getl_gen_all c1 (CHead d1 (Bind Abbr) u) n H) in (ex2_ind C (\lambda (e: +C).(drop n O c1 e)) (\lambda (e: C).(clear e (CHead d1 (Bind Abbr) u))) +(\forall (c2: C).((csubt g c1 c2) \to (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) u)))))) (\lambda (x: +C).(\lambda (H1: (drop n O c1 x)).(\lambda (H2: (clear x (CHead d1 (Bind +Abbr) u))).(C_ind (\lambda (c: C).((drop n O c1 c) \to ((clear c (CHead d1 +(Bind Abbr) u)) \to (\forall (c2: C).((csubt g c1 c2) \to (ex2 C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) +u))))))))) (\lambda (n0: nat).(\lambda (_: (drop n O c1 (CSort n0))).(\lambda +(H4: (clear (CSort n0) (CHead d1 (Bind Abbr) u))).(clear_gen_sort (CHead d1 +(Bind Abbr) u) n0 H4 (\forall (c2: C).((csubt g c1 c2) \to (ex2 C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) +u)))))))))) (\lambda (x0: C).(\lambda (_: (((drop n O c1 x0) \to ((clear x0 +(CHead d1 (Bind Abbr) u)) \to (\forall (c2: C).((csubt g c1 c2) \to (ex2 C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind +Abbr) u)))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (H3: (drop n O c1 +(CHead x0 k t))).(\lambda (H4: (clear (CHead x0 k t) (CHead d1 (Bind Abbr) +u))).(K_ind (\lambda (k0: K).((drop n O c1 (CHead x0 k0 t)) \to ((clear +(CHead x0 k0 t) (CHead d1 (Bind Abbr) u)) \to (\forall (c2: C).((csubt g c1 +c2) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl n c2 +(CHead d2 (Bind Abbr) u))))))))) (\lambda (b: B).(\lambda (H5: (drop n O c1 +(CHead x0 (Bind b) t))).(\lambda (H6: (clear (CHead x0 (Bind b) t) (CHead d1 +(Bind Abbr) u))).(let H7 \def (f_equal C C (\lambda (e: C).(match e in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow d1 | (CHead c _ _) +\Rightarrow c])) (CHead d1 (Bind Abbr) u) (CHead x0 (Bind b) t) +(clear_gen_bind b x0 (CHead d1 (Bind Abbr) u) t H6)) in ((let H8 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abbr | (CHead _ k0 _) \Rightarrow (match k0 in K +return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow Abbr])])) (CHead d1 (Bind Abbr) u) (CHead x0 (Bind b) t) +(clear_gen_bind b x0 (CHead d1 (Bind Abbr) u) t H6)) in ((let H9 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead d1 (Bind +Abbr) u) (CHead x0 (Bind b) t) (clear_gen_bind b x0 (CHead d1 (Bind Abbr) u) +t H6)) in (\lambda (H10: (eq B Abbr b)).(\lambda (H11: (eq C d1 x0)).(\lambda +(c2: C).(\lambda (H12: (csubt g c1 c2)).(let H13 \def (eq_ind_r T t (\lambda +(t0: T).(drop n O c1 (CHead x0 (Bind b) t0))) H5 u H9) in (let H14 \def +(eq_ind_r B b (\lambda (b0: B).(drop n O c1 (CHead x0 (Bind b0) u))) H13 Abbr +H10) in (let H15 \def (eq_ind_r C x0 (\lambda (c: C).(drop n O c1 (CHead c +(Bind Abbr) u))) H14 d1 H11) in (ex2_ind C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop n O c2 (CHead d2 (Bind Abbr) u))) (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) u)))) +(\lambda (x1: C).(\lambda (H16: (csubt g d1 x1)).(\lambda (H17: (drop n O c2 +(CHead x1 (Bind Abbr) u))).(ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) u))) x1 H16 (getl_intro n +c2 (CHead x1 (Bind Abbr) u) (CHead x1 (Bind Abbr) u) H17 (clear_bind Abbr x1 +u)))))) (csubt_drop_abbr g n c1 c2 H12 d1 u H15)))))))))) H8)) H7))))) +(\lambda (f: F).(\lambda (H5: (drop n O c1 (CHead x0 (Flat f) t))).(\lambda +(H6: (clear (CHead x0 (Flat f) t) (CHead d1 (Bind Abbr) u))).(let H7 \def H5 +in (unintro C c1 (\lambda (c: C).((drop n O c (CHead x0 (Flat f) t)) \to +(\forall (c2: C).((csubt g c c2) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) u)))))))) (nat_ind (\lambda +(n0: nat).(\forall (x1: C).((drop n0 O x1 (CHead x0 (Flat f) t)) \to (\forall +(c2: C).((csubt g x1 c2) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl n0 c2 (CHead d2 (Bind Abbr) u))))))))) (\lambda (x1: +C).(\lambda (H8: (drop O O x1 (CHead x0 (Flat f) t))).(\lambda (c2: +C).(\lambda (H9: (csubt g x1 c2)).(let H10 \def (eq_ind C x1 (\lambda (c: +C).(csubt g c c2)) H9 (CHead x0 (Flat f) t) (drop_gen_refl x1 (CHead x0 (Flat +f) t) H8)) in (let H_y \def (clear_flat x0 (CHead d1 (Bind Abbr) u) +(clear_gen_flat f x0 (CHead d1 (Bind Abbr) u) t H6) f t) in (let H11 \def +(csubt_clear_conf g (CHead x0 (Flat f) t) c2 H10 (CHead d1 (Bind Abbr) u) +H_y) in (ex2_ind C (\lambda (e2: C).(csubt g (CHead d1 (Bind Abbr) u) e2)) +(\lambda (e2: C).(clear c2 e2)) (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abbr) u)))) (\lambda (x2: +C).(\lambda (H12: (csubt g (CHead d1 (Bind Abbr) u) x2)).(\lambda (H13: +(clear c2 x2)).(let H14 \def (csubt_gen_abbr g d1 x2 u H12) in (ex2_ind C +(\lambda (e2: C).(eq C x2 (CHead e2 (Bind Abbr) u))) (\lambda (e2: C).(csubt +g d1 e2)) (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl O +c2 (CHead d2 (Bind Abbr) u)))) (\lambda (x3: C).(\lambda (H15: (eq C x2 +(CHead x3 (Bind Abbr) u))).(\lambda (H16: (csubt g d1 x3)).(let H17 \def +(eq_ind C x2 (\lambda (c: C).(clear c2 c)) H13 (CHead x3 (Bind Abbr) u) H15) +in (ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl O c2 +(CHead d2 (Bind Abbr) u))) x3 H16 (getl_intro O c2 (CHead x3 (Bind Abbr) u) +c2 (drop_refl c2) H17)))))) H14))))) H11)))))))) (\lambda (n0: nat).(\lambda +(H8: ((\forall (x1: C).((drop n0 O x1 (CHead x0 (Flat f) t)) \to (\forall +(c2: C).((csubt g x1 c2) \to (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl n0 c2 (CHead d2 (Bind Abbr) u)))))))))).(\lambda (x1: +C).(\lambda (H9: (drop (S n0) O x1 (CHead x0 (Flat f) t))).(\lambda (c2: +C).(\lambda (H10: (csubt g x1 c2)).(let H11 \def (drop_clear x1 (CHead x0 +(Flat f) t) n0 H9) in (ex2_3_ind B C T (\lambda (b: B).(\lambda (e: +C).(\lambda (v: T).(clear x1 (CHead e (Bind b) v))))) (\lambda (_: +B).(\lambda (e: C).(\lambda (_: T).(drop n0 O e (CHead x0 (Flat f) t))))) +(ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl (S n0) c2 +(CHead d2 (Bind Abbr) u)))) (\lambda (x2: B).(\lambda (x3: C).(\lambda (x4: +T).(\lambda (H12: (clear x1 (CHead x3 (Bind x2) x4))).(\lambda (H13: (drop n0 +O x3 (CHead x0 (Flat f) t))).(let H14 \def (csubt_clear_conf g x1 c2 H10 +(CHead x3 (Bind x2) x4) H12) in (ex2_ind C (\lambda (e2: C).(csubt g (CHead +x3 (Bind x2) x4) e2)) (\lambda (e2: C).(clear c2 e2)) (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(getl (S n0) c2 (CHead d2 (Bind Abbr) +u)))) (\lambda (x5: C).(\lambda (H15: (csubt g (CHead x3 (Bind x2) x4) +x5)).(\lambda (H16: (clear c2 x5)).(let H17 \def (csubt_gen_bind g x2 x3 x5 +x4 H15) in (ex2_3_ind B C T (\lambda (b2: B).(\lambda (e2: C).(\lambda (v2: +T).(eq C x5 (CHead e2 (Bind b2) v2))))) (\lambda (_: B).(\lambda (e2: +C).(\lambda (_: T).(csubt g x3 e2)))) (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(getl (S n0) c2 (CHead d2 (Bind Abbr) u)))) (\lambda +(x6: B).(\lambda (x7: C).(\lambda (x8: T).(\lambda (H18: (eq C x5 (CHead x7 +(Bind x6) x8))).(\lambda (H19: (csubt g x3 x7)).(let H20 \def (eq_ind C x5 +(\lambda (c: C).(clear c2 c)) H16 (CHead x7 (Bind x6) x8) H18) in (let H21 +\def (H8 x3 H13 x7 H19) in (ex2_ind C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl n0 x7 (CHead d2 (Bind Abbr) u))) (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(getl (S n0) c2 (CHead d2 (Bind Abbr) +u)))) (\lambda (x9: C).(\lambda (H22: (csubt g d1 x9)).(\lambda (H23: (getl +n0 x7 (CHead x9 (Bind Abbr) u))).(ex_intro2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(getl (S n0) c2 (CHead d2 (Bind Abbr) u))) x9 H22 +(getl_clear_bind x6 c2 x7 x8 H20 (CHead x9 (Bind Abbr) u) n0 H23))))) +H21)))))))) H17))))) H14))))))) H11)))))))) n) H7))))) k H3 H4))))))) x H1 +H2)))) H0))))))). + +theorem csubt_getl_abst: + \forall (g: G).(\forall (c1: C).(\forall (d1: C).(\forall (t: T).(\forall +(n: nat).((getl n c1 (CHead d1 (Bind Abst) t)) \to (\forall (c2: C).((csubt g +c1 c2) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(getl n c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl n +c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t)))))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (d1: C).(\lambda (t: T).(\lambda +(n: nat).(\lambda (H: (getl n c1 (CHead d1 (Bind Abst) t))).(let H0 \def +(getl_gen_all c1 (CHead d1 (Bind Abst) t) n H) in (ex2_ind C (\lambda (e: +C).(drop n O c1 e)) (\lambda (e: C).(clear e (CHead d1 (Bind Abst) t))) +(\forall (c2: C).((csubt g c1 c2) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(getl n c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t))))))) (\lambda (x: C).(\lambda (H1: (drop n O c1 +x)).(\lambda (H2: (clear x (CHead d1 (Bind Abst) t))).(C_ind (\lambda (c: +C).((drop n O c1 c) \to ((clear c (CHead d1 (Bind Abst) t)) \to (\forall (c2: +C).((csubt g c1 c2) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(getl n c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl n +c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t)))))))))) (\lambda (n0: nat).(\lambda (_: (drop n O c1 (CSort +n0))).(\lambda (H4: (clear (CSort n0) (CHead d1 (Bind Abst) +t))).(clear_gen_sort (CHead d1 (Bind Abst) t) n0 H4 (\forall (c2: C).((csubt +g c1 c2) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(getl n c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl n +c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t))))))))))) (\lambda (x0: C).(\lambda (_: (((drop n O c1 x0) \to ((clear x0 +(CHead d1 (Bind Abst) t)) \to (\forall (c2: C).((csubt g c1 c2) \to (or (ex2 +C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl n c2 (CHead d2 +(Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u: T).(getl n c2 (CHead d2 (Bind Abbr) u)))) +(\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))))))))))).(\lambda (k: +K).(\lambda (t0: T).(\lambda (H3: (drop n O c1 (CHead x0 k t0))).(\lambda +(H4: (clear (CHead x0 k t0) (CHead d1 (Bind Abst) t))).(K_ind (\lambda (k0: +K).((drop n O c1 (CHead x0 k0 t0)) \to ((clear (CHead x0 k0 t0) (CHead d1 +(Bind Abst) t)) \to (\forall (c2: C).((csubt g c1 c2) \to (or (ex2 C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) +t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u: T).(getl n c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: +C).(\lambda (u: T).(ty3 g d2 u t)))))))))) (\lambda (b: B).(\lambda (H5: +(drop n O c1 (CHead x0 (Bind b) t0))).(\lambda (H6: (clear (CHead x0 (Bind b) +t0) (CHead d1 (Bind Abst) t))).(let H7 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d1 | +(CHead c _ _) \Rightarrow c])) (CHead d1 (Bind Abst) t) (CHead x0 (Bind b) +t0) (clear_gen_bind b x0 (CHead d1 (Bind Abst) t) t0 H6)) in ((let H8 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abst | (CHead _ k0 _) \Rightarrow (match k0 in K +return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow Abst])])) (CHead d1 (Bind Abst) t) (CHead x0 (Bind b) t0) +(clear_gen_bind b x0 (CHead d1 (Bind Abst) t) t0 H6)) in ((let H9 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow t | (CHead _ _ t1) \Rightarrow t1])) (CHead d1 (Bind +Abst) t) (CHead x0 (Bind b) t0) (clear_gen_bind b x0 (CHead d1 (Bind Abst) t) +t0 H6)) in (\lambda (H10: (eq B Abst b)).(\lambda (H11: (eq C d1 +x0)).(\lambda (c2: C).(\lambda (H12: (csubt g c1 c2)).(let H13 \def (eq_ind_r +T t0 (\lambda (t1: T).(drop n O c1 (CHead x0 (Bind b) t1))) H5 t H9) in (let +H14 \def (eq_ind_r B b (\lambda (b0: B).(drop n O c1 (CHead x0 (Bind b0) t))) +H13 Abst H10) in (let H15 \def (eq_ind_r C x0 (\lambda (c: C).(drop n O c1 +(CHead c (Bind Abst) t))) H14 d1 H11) in (or_ind (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(drop n O c2 (CHead d2 (Bind Abst) t)))) +(ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u: T).(drop n O c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: +C).(\lambda (u: T).(ty3 g d2 u t)))) (or (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(getl n c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t))))) (\lambda (H16: (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(drop n O c2 (CHead d2 (Bind Abst) t))))).(ex2_ind C +(\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(drop n O c2 (CHead d2 +(Bind Abst) t))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(getl n c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl n +c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t))))) (\lambda (x1: C).(\lambda (H17: (csubt g d1 x1)).(\lambda (H18: (drop +n O c2 (CHead x1 (Bind Abst) t))).(or_introl (ex2 C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(getl n c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t)))) (ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(getl n c2 (CHead d2 (Bind Abst) t))) x1 H17 (getl_intro n c2 (CHead +x1 (Bind Abst) t) (CHead x1 (Bind Abst) t) H18 (clear_bind Abst x1 t))))))) +H16)) (\lambda (H16: (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u: T).(drop n O c2 (CHead d2 (Bind Abbr) +u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))))).(ex3_2_ind C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(drop n O c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(getl n c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl n +c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t))))) (\lambda (x1: C).(\lambda (x2: T).(\lambda (H17: (csubt g d1 +x1)).(\lambda (H18: (drop n O c2 (CHead x1 (Bind Abbr) x2))).(\lambda (H19: +(ty3 g x1 x2 t)).(or_intror (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(getl n c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl n +c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t)))) (ex3_2_intro C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) +(\lambda (d2: C).(\lambda (u: T).(getl n c2 (CHead d2 (Bind Abbr) u)))) +(\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))) x1 x2 H17 (getl_intro n c2 +(CHead x1 (Bind Abbr) x2) (CHead x1 (Bind Abbr) x2) H18 (clear_bind Abbr x1 +x2)) H19))))))) H16)) (csubt_drop_abst g n c1 c2 H12 d1 t H15)))))))))) H8)) +H7))))) (\lambda (f: F).(\lambda (H5: (drop n O c1 (CHead x0 (Flat f) +t0))).(\lambda (H6: (clear (CHead x0 (Flat f) t0) (CHead d1 (Bind Abst) +t))).(let H7 \def H5 in (unintro C c1 (\lambda (c: C).((drop n O c (CHead x0 +(Flat f) t0)) \to (\forall (c2: C).((csubt g c c2) \to (or (ex2 C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) +t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u: T).(getl n c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: +C).(\lambda (u: T).(ty3 g d2 u t))))))))) (nat_ind (\lambda (n0: +nat).(\forall (x1: C).((drop n0 O x1 (CHead x0 (Flat f) t0)) \to (\forall +(c2: C).((csubt g x1 c2) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl n0 c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda +(d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: +T).(getl n0 c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t)))))))))) (\lambda (x1: C).(\lambda (H8: (drop O O x1 (CHead +x0 (Flat f) t0))).(\lambda (c2: C).(\lambda (H9: (csubt g x1 c2)).(let H10 +\def (eq_ind C x1 (\lambda (c: C).(csubt g c c2)) H9 (CHead x0 (Flat f) t0) +(drop_gen_refl x1 (CHead x0 (Flat f) t0) H8)) in (let H_y \def (clear_flat x0 +(CHead d1 (Bind Abst) t) (clear_gen_flat f x0 (CHead d1 (Bind Abst) t) t0 H6) +f t0) in (let H11 \def (csubt_clear_conf g (CHead x0 (Flat f) t0) c2 H10 +(CHead d1 (Bind Abst) t) H_y) in (ex2_ind C (\lambda (e2: C).(csubt g (CHead +d1 (Bind Abst) t) e2)) (\lambda (e2: C).(clear c2 e2)) (or (ex2 C (\lambda +(d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abst) +t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda +(d2: C).(\lambda (u: T).(getl O c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: +C).(\lambda (u: T).(ty3 g d2 u t))))) (\lambda (x2: C).(\lambda (H12: (csubt +g (CHead d1 (Bind Abst) t) x2)).(\lambda (H13: (clear c2 x2)).(let H14 \def +(csubt_gen_abst g d1 x2 t H12) in (or_ind (ex2 C (\lambda (e2: C).(eq C x2 +(CHead e2 (Bind Abst) t))) (\lambda (e2: C).(csubt g d1 e2))) (ex3_2 C T +(\lambda (e2: C).(\lambda (v2: T).(eq C x2 (CHead e2 (Bind Abbr) v2)))) +(\lambda (e2: C).(\lambda (_: T).(csubt g d1 e2))) (\lambda (e2: C).(\lambda +(v2: T).(ty3 g e2 v2 t)))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda +(d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: +T).(getl O c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t))))) (\lambda (H15: (ex2 C (\lambda (e2: C).(eq C x2 (CHead +e2 (Bind Abst) t))) (\lambda (e2: C).(csubt g d1 e2)))).(ex2_ind C (\lambda +(e2: C).(eq C x2 (CHead e2 (Bind Abst) t))) (\lambda (e2: C).(csubt g d1 e2)) +(or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl O c2 +(CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl O c2 (CHead d2 +(Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))))) +(\lambda (x3: C).(\lambda (H16: (eq C x2 (CHead x3 (Bind Abst) t))).(\lambda +(H17: (csubt g d1 x3)).(let H18 \def (eq_ind C x2 (\lambda (c: C).(clear c2 +c)) H13 (CHead x3 (Bind Abst) t) H16) in (or_introl (ex2 C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abst) t)))) +(ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: +C).(\lambda (u: T).(getl O c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: +C).(\lambda (u: T).(ty3 g d2 u t)))) (ex_intro2 C (\lambda (d2: C).(csubt g +d1 d2)) (\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abst) t))) x3 H17 +(getl_intro O c2 (CHead x3 (Bind Abst) t) c2 (drop_refl c2) H18))))))) H15)) +(\lambda (H15: (ex3_2 C T (\lambda (e2: C).(\lambda (v2: T).(eq C x2 (CHead +e2 (Bind Abbr) v2)))) (\lambda (e2: C).(\lambda (_: T).(csubt g d1 e2))) +(\lambda (e2: C).(\lambda (v2: T).(ty3 g e2 v2 t))))).(ex3_2_ind C T (\lambda +(e2: C).(\lambda (v2: T).(eq C x2 (CHead e2 (Bind Abbr) v2)))) (\lambda (e2: +C).(\lambda (_: T).(csubt g d1 e2))) (\lambda (e2: C).(\lambda (v2: T).(ty3 g +e2 v2 t))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(getl O c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl O +c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t))))) (\lambda (x3: C).(\lambda (x4: T).(\lambda (H16: (eq C x2 (CHead x3 +(Bind Abbr) x4))).(\lambda (H17: (csubt g d1 x3)).(\lambda (H18: (ty3 g x3 x4 +t)).(let H19 \def (eq_ind C x2 (\lambda (c: C).(clear c2 c)) H13 (CHead x3 +(Bind Abbr) x4) H16) in (or_intror (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl O c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda +(d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: +T).(getl O c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t)))) (ex3_2_intro C T (\lambda (d2: C).(\lambda (_: T).(csubt +g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl O c2 (CHead d2 (Bind Abbr) +u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))) x3 x4 H17 (getl_intro +O c2 (CHead x3 (Bind Abbr) x4) c2 (drop_refl c2) H19) H18)))))))) H15)) +H14))))) H11)))))))) (\lambda (n0: nat).(\lambda (H8: ((\forall (x1: +C).((drop n0 O x1 (CHead x0 (Flat f) t0)) \to (\forall (c2: C).((csubt g x1 +c2) \to (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl +n0 c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl n0 c2 (CHead d2 +(Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t))))))))))).(\lambda (x1: C).(\lambda (H9: (drop (S n0) O x1 (CHead x0 (Flat +f) t0))).(\lambda (c2: C).(\lambda (H10: (csubt g x1 c2)).(let H11 \def +(drop_clear x1 (CHead x0 (Flat f) t0) n0 H9) in (ex2_3_ind B C T (\lambda (b: +B).(\lambda (e: C).(\lambda (v: T).(clear x1 (CHead e (Bind b) v))))) +(\lambda (_: B).(\lambda (e: C).(\lambda (_: T).(drop n0 O e (CHead x0 (Flat +f) t0))))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(getl (S n0) c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl +(S n0) c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g +d2 u t))))) (\lambda (x2: B).(\lambda (x3: C).(\lambda (x4: T).(\lambda (H12: +(clear x1 (CHead x3 (Bind x2) x4))).(\lambda (H13: (drop n0 O x3 (CHead x0 +(Flat f) t0))).(let H14 \def (csubt_clear_conf g x1 c2 H10 (CHead x3 (Bind +x2) x4) H12) in (ex2_ind C (\lambda (e2: C).(csubt g (CHead x3 (Bind x2) x4) +e2)) (\lambda (e2: C).(clear c2 e2)) (or (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(getl (S n0) c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(getl (S n0) c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda +(u: T).(ty3 g d2 u t))))) (\lambda (x5: C).(\lambda (H15: (csubt g (CHead x3 +(Bind x2) x4) x5)).(\lambda (H16: (clear c2 x5)).(let H17 \def +(csubt_gen_bind g x2 x3 x5 x4 H15) in (ex2_3_ind B C T (\lambda (b2: +B).(\lambda (e2: C).(\lambda (v2: T).(eq C x5 (CHead e2 (Bind b2) v2))))) +(\lambda (_: B).(\lambda (e2: C).(\lambda (_: T).(csubt g x3 e2)))) (or (ex2 +C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl (S n0) c2 (CHead +d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 +d2))) (\lambda (d2: C).(\lambda (u: T).(getl (S n0) c2 (CHead d2 (Bind Abbr) +u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))))) (\lambda (x6: +B).(\lambda (x7: C).(\lambda (x8: T).(\lambda (H18: (eq C x5 (CHead x7 (Bind +x6) x8))).(\lambda (H19: (csubt g x3 x7)).(let H20 \def (eq_ind C x5 (\lambda +(c: C).(clear c2 c)) H16 (CHead x7 (Bind x6) x8) H18) in (let H21 \def (H8 x3 +H13 x7 H19) in (or_ind (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(getl n0 x7 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl +n0 x7 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 +u t)))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl +(S n0) c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda +(_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl (S n0) c2 +(CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u +t))))) (\lambda (H22: (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: +C).(getl n0 x7 (CHead d2 (Bind Abst) t))))).(ex2_ind C (\lambda (d2: +C).(csubt g d1 d2)) (\lambda (d2: C).(getl n0 x7 (CHead d2 (Bind Abst) t))) +(or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda (d2: C).(getl (S n0) c2 +(CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl (S n0) c2 (CHead +d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))))) +(\lambda (x9: C).(\lambda (H23: (csubt g d1 x9)).(\lambda (H24: (getl n0 x7 +(CHead x9 (Bind Abst) t))).(or_introl (ex2 C (\lambda (d2: C).(csubt g d1 +d2)) (\lambda (d2: C).(getl (S n0) c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(getl (S n0) c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda +(u: T).(ty3 g d2 u t)))) (ex_intro2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl (S n0) c2 (CHead d2 (Bind Abst) t))) x9 H23 +(getl_clear_bind x6 c2 x7 x8 H20 (CHead x9 (Bind Abst) t) n0 H24)))))) H22)) +(\lambda (H22: (ex3_2 C T (\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) +(\lambda (d2: C).(\lambda (u: T).(getl n0 x7 (CHead d2 (Bind Abbr) u)))) +(\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))))).(ex3_2_ind C T (\lambda +(d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: +T).(getl n0 x7 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: +T).(ty3 g d2 u t))) (or (ex2 C (\lambda (d2: C).(csubt g d1 d2)) (\lambda +(d2: C).(getl (S n0) c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl +(S n0) c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g +d2 u t))))) (\lambda (x9: C).(\lambda (x10: T).(\lambda (H23: (csubt g d1 +x9)).(\lambda (H24: (getl n0 x7 (CHead x9 (Bind Abbr) x10))).(\lambda (H25: +(ty3 g x9 x10 t)).(or_intror (ex2 C (\lambda (d2: C).(csubt g d1 d2)) +(\lambda (d2: C).(getl (S n0) c2 (CHead d2 (Bind Abst) t)))) (ex3_2 C T +(\lambda (d2: C).(\lambda (_: T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda +(u: T).(getl (S n0) c2 (CHead d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda +(u: T).(ty3 g d2 u t)))) (ex3_2_intro C T (\lambda (d2: C).(\lambda (_: +T).(csubt g d1 d2))) (\lambda (d2: C).(\lambda (u: T).(getl (S n0) c2 (CHead +d2 (Bind Abbr) u)))) (\lambda (d2: C).(\lambda (u: T).(ty3 g d2 u t))) x9 x10 +H23 (getl_clear_bind x6 c2 x7 x8 H20 (CHead x9 (Bind Abbr) x10) n0 H24) +H25))))))) H22)) H21)))))))) H17))))) H14))))))) H11)))))))) n) H7))))) k H3 +H4))))))) x H1 H2)))) H0))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/pc3.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/pc3.ma new file mode 100644 index 000000000..d8a6ad246 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/pc3.ma @@ -0,0 +1,58 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubt/pc3". + +include "csubt/getl.ma". + +include "pc3/left.ma". + +theorem csubt_pr2: + \forall (g: G).(\forall (c1: C).(\forall (t1: T).(\forall (t2: T).((pr2 c1 +t1 t2) \to (\forall (c2: C).((csubt g c1 c2) \to (pr2 c2 t1 t2))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (pr2 c1 t1 t2)).(pr2_ind (\lambda (c: C).(\lambda (t: T).(\lambda (t0: +T).(\forall (c2: C).((csubt g c c2) \to (pr2 c2 t t0)))))) (\lambda (c: +C).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H0: (pr0 t3 t4)).(\lambda (c2: +C).(\lambda (_: (csubt g c c2)).(pr2_free c2 t3 t4 H0))))))) (\lambda (c: +C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i c +(CHead d (Bind Abbr) u))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H1: +(pr0 t3 t4)).(\lambda (t: T).(\lambda (H2: (subst0 i u t4 t)).(\lambda (c2: +C).(\lambda (H3: (csubt g c c2)).(let H4 \def (csubt_getl_abbr g c d u i H0 +c2 H3) in (ex2_ind C (\lambda (d2: C).(csubt g d d2)) (\lambda (d2: C).(getl +i c2 (CHead d2 (Bind Abbr) u))) (pr2 c2 t3 t) (\lambda (x: C).(\lambda (_: +(csubt g d x)).(\lambda (H6: (getl i c2 (CHead x (Bind Abbr) u))).(pr2_delta +c2 x u i H6 t3 t4 H1 t H2)))) H4)))))))))))))) c1 t1 t2 H))))). + +theorem csubt_pc3: + \forall (g: G).(\forall (c1: C).(\forall (t1: T).(\forall (t2: T).((pc3 c1 +t1 t2) \to (\forall (c2: C).((csubt g c1 c2) \to (pc3 c2 t1 t2))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (pc3 c1 t1 t2)).(pc3_ind_left c1 (\lambda (t: T).(\lambda (t0: +T).(\forall (c2: C).((csubt g c1 c2) \to (pc3 c2 t t0))))) (\lambda (t: +T).(\lambda (c2: C).(\lambda (_: (csubt g c1 c2)).(pc3_refl c2 t)))) (\lambda +(t0: T).(\lambda (t3: T).(\lambda (H0: (pr2 c1 t0 t3)).(\lambda (t4: +T).(\lambda (_: (pc3 c1 t3 t4)).(\lambda (H2: ((\forall (c2: C).((csubt g c1 +c2) \to (pc3 c2 t3 t4))))).(\lambda (c2: C).(\lambda (H3: (csubt g c1 +c2)).(pc3_t t3 c2 t0 (pc3_pr2_r c2 t0 t3 (csubt_pr2 g c1 t0 t3 H0 c2 H3)) t4 +(H2 c2 H3)))))))))) (\lambda (t0: T).(\lambda (t3: T).(\lambda (H0: (pr2 c1 +t0 t3)).(\lambda (t4: T).(\lambda (_: (pc3 c1 t0 t4)).(\lambda (H2: ((\forall +(c2: C).((csubt g c1 c2) \to (pc3 c2 t0 t4))))).(\lambda (c2: C).(\lambda +(H3: (csubt g c1 c2)).(pc3_t t0 c2 t3 (pc3_pr2_x c2 t3 t0 (csubt_pr2 g c1 t0 +t3 H0 c2 H3)) t4 (H2 c2 H3)))))))))) t1 t2 H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/props.ma new file mode 100644 index 000000000..5d88520a9 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/props.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubt/props". + +include "csubt/defs.ma". + +theorem csubt_refl: + \forall (g: G).(\forall (c: C).(csubt g c c)) +\def + \lambda (g: G).(\lambda (c: C).(C_ind (\lambda (c0: C).(csubt g c0 c0)) +(\lambda (n: nat).(csubt_sort g n)) (\lambda (c0: C).(\lambda (H: (csubt g c0 +c0)).(\lambda (k: K).(\lambda (t: T).(csubt_head g c0 c0 H k t))))) c)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/ty3.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/ty3.ma new file mode 100644 index 000000000..3fbcb516f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/ty3.ma @@ -0,0 +1,99 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/csubt/ty3". + +include "csubt/pc3.ma". + +include "csubt/props.ma". + +theorem csubt_ty3: + \forall (g: G).(\forall (c1: C).(\forall (t1: T).(\forall (t2: T).((ty3 g c1 +t1 t2) \to (\forall (c2: C).((csubt g c1 c2) \to (ty3 g c2 t1 t2))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (ty3 g c1 t1 t2)).(ty3_ind g (\lambda (c: C).(\lambda (t: T).(\lambda +(t0: T).(\forall (c2: C).((csubt g c c2) \to (ty3 g c2 t t0)))))) (\lambda +(c: C).(\lambda (t0: T).(\lambda (t: T).(\lambda (_: (ty3 g c t0 t)).(\lambda +(H1: ((\forall (c2: C).((csubt g c c2) \to (ty3 g c2 t0 t))))).(\lambda (u: +T).(\lambda (t3: T).(\lambda (_: (ty3 g c u t3)).(\lambda (H3: ((\forall (c2: +C).((csubt g c c2) \to (ty3 g c2 u t3))))).(\lambda (H4: (pc3 c t3 +t0)).(\lambda (c2: C).(\lambda (H5: (csubt g c c2)).(ty3_conv g c2 t0 t (H1 +c2 H5) u t3 (H3 c2 H5) (csubt_pc3 g c t3 t0 H4 c2 H5)))))))))))))) (\lambda +(c: C).(\lambda (m: nat).(\lambda (c2: C).(\lambda (_: (csubt g c +c2)).(ty3_sort g c2 m))))) (\lambda (n: nat).(\lambda (c: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (H0: (getl n c (CHead d (Bind Abbr) u))).(\lambda +(t: T).(\lambda (_: (ty3 g d u t)).(\lambda (H2: ((\forall (c2: C).((csubt g +d c2) \to (ty3 g c2 u t))))).(\lambda (c2: C).(\lambda (H3: (csubt g c +c2)).(let H4 \def (csubt_getl_abbr g c d u n H0 c2 H3) in (ex2_ind C (\lambda +(d2: C).(csubt g d d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abbr) +u))) (ty3 g c2 (TLRef n) (lift (S n) O t)) (\lambda (x: C).(\lambda (H5: +(csubt g d x)).(\lambda (H6: (getl n c2 (CHead x (Bind Abbr) u))).(ty3_abbr g +n c2 x u H6 t (H2 x H5))))) H4)))))))))))) (\lambda (n: nat).(\lambda (c: +C).(\lambda (d: C).(\lambda (u: T).(\lambda (H0: (getl n c (CHead d (Bind +Abst) u))).(\lambda (t: T).(\lambda (_: (ty3 g d u t)).(\lambda (H2: +((\forall (c2: C).((csubt g d c2) \to (ty3 g c2 u t))))).(\lambda (c2: +C).(\lambda (H3: (csubt g c c2)).(let H4 \def (csubt_getl_abst g c d u n H0 +c2 H3) in (or_ind (ex2 C (\lambda (d2: C).(csubt g d d2)) (\lambda (d2: +C).(getl n c2 (CHead d2 (Bind Abst) u)))) (ex3_2 C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d d2))) (\lambda (d2: C).(\lambda (u0: T).(getl n +c2 (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 +u0 u)))) (ty3 g c2 (TLRef n) (lift (S n) O u)) (\lambda (H5: (ex2 C (\lambda +(d2: C).(csubt g d d2)) (\lambda (d2: C).(getl n c2 (CHead d2 (Bind Abst) +u))))).(ex2_ind C (\lambda (d2: C).(csubt g d d2)) (\lambda (d2: C).(getl n +c2 (CHead d2 (Bind Abst) u))) (ty3 g c2 (TLRef n) (lift (S n) O u)) (\lambda +(x: C).(\lambda (H6: (csubt g d x)).(\lambda (H7: (getl n c2 (CHead x (Bind +Abst) u))).(ty3_abst g n c2 x u H7 t (H2 x H6))))) H5)) (\lambda (H5: (ex3_2 +C T (\lambda (d2: C).(\lambda (_: T).(csubt g d d2))) (\lambda (d2: +C).(\lambda (u0: T).(getl n c2 (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: +C).(\lambda (u0: T).(ty3 g d2 u0 u))))).(ex3_2_ind C T (\lambda (d2: +C).(\lambda (_: T).(csubt g d d2))) (\lambda (d2: C).(\lambda (u0: T).(getl n +c2 (CHead d2 (Bind Abbr) u0)))) (\lambda (d2: C).(\lambda (u0: T).(ty3 g d2 +u0 u))) (ty3 g c2 (TLRef n) (lift (S n) O u)) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (_: (csubt g d x0)).(\lambda (H7: (getl n c2 (CHead x0 (Bind +Abbr) x1))).(\lambda (H8: (ty3 g x0 x1 u)).(ty3_abbr g n c2 x0 x1 H7 u +H8)))))) H5)) H4)))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (t: +T).(\lambda (_: (ty3 g c u t)).(\lambda (H1: ((\forall (c2: C).((csubt g c +c2) \to (ty3 g c2 u t))))).(\lambda (b: B).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (_: (ty3 g (CHead c (Bind b) u) t0 t3)).(\lambda (H3: ((\forall +(c2: C).((csubt g (CHead c (Bind b) u) c2) \to (ty3 g c2 t0 t3))))).(\lambda +(t4: T).(\lambda (_: (ty3 g (CHead c (Bind b) u) t3 t4)).(\lambda (H5: +((\forall (c2: C).((csubt g (CHead c (Bind b) u) c2) \to (ty3 g c2 t3 +t4))))).(\lambda (c2: C).(\lambda (H6: (csubt g c c2)).(ty3_bind g c2 u t (H1 +c2 H6) b t0 t3 (H3 (CHead c2 (Bind b) u) (csubt_head g c c2 H6 (Bind b) u)) +t4 (H5 (CHead c2 (Bind b) u) (csubt_head g c c2 H6 (Bind b) +u)))))))))))))))))) (\lambda (c: C).(\lambda (w: T).(\lambda (u: T).(\lambda +(_: (ty3 g c w u)).(\lambda (H1: ((\forall (c2: C).((csubt g c c2) \to (ty3 g +c2 w u))))).(\lambda (v: T).(\lambda (t: T).(\lambda (_: (ty3 g c v (THead +(Bind Abst) u t))).(\lambda (H3: ((\forall (c2: C).((csubt g c c2) \to (ty3 g +c2 v (THead (Bind Abst) u t)))))).(\lambda (c2: C).(\lambda (H4: (csubt g c +c2)).(ty3_appl g c2 w u (H1 c2 H4) v t (H3 c2 H4))))))))))))) (\lambda (c: +C).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (ty3 g c t0 t3)).(\lambda +(H1: ((\forall (c2: C).((csubt g c c2) \to (ty3 g c2 t0 t3))))).(\lambda (t4: +T).(\lambda (_: (ty3 g c t3 t4)).(\lambda (H3: ((\forall (c2: C).((csubt g c +c2) \to (ty3 g c2 t3 t4))))).(\lambda (c2: C).(\lambda (H4: (csubt g c +c2)).(ty3_cast g c2 t0 t3 (H1 c2 H4) t4 (H3 c2 H4)))))))))))) c1 t1 t2 H))))). + +theorem csubt_ty3_ld: + \forall (g: G).(\forall (c: C).(\forall (u: T).(\forall (v: T).((ty3 g c u +v) \to (\forall (t1: T).(\forall (t2: T).((ty3 g (CHead c (Bind Abst) v) t1 +t2) \to (ty3 g (CHead c (Bind Abbr) u) t1 t2)))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u: T).(\lambda (v: T).(\lambda (H: +(ty3 g c u v)).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (ty3 g (CHead +c (Bind Abst) v) t1 t2)).(csubt_ty3 g (CHead c (Bind Abst) v) t1 t2 H0 (CHead +c (Bind Abbr) u) (csubt_abst g c c (csubt_refl g c) u v H))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/definitions.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/definitions.ma new file mode 100644 index 000000000..620154782 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/definitions.ma @@ -0,0 +1,62 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/definitions". + +include "tlt/defs.ma". + +include "iso/defs.ma". + +include "clen/defs.ma". + +include "flt/defs.ma". + +include "cnt/defs.ma". + +include "cimp/defs.ma". + +include "subst1/defs.ma". + +include "csubst1/defs.ma". + +include "fsubst0/defs.ma". + +include "next_plus/defs.ma". + +include "tau1/defs.ma". + +include "llt/defs.ma". + +include "aprem/defs.ma". + +include "ex0/defs.ma". + +include "wcpr0/defs.ma". + +include "csuba/defs.ma". + +include "nf2/defs.ma". + +include "ex2/defs.ma". + +include "csubc/defs.ma". + +include "pc1/defs.ma". + +include "ex1/defs.ma". + +include "csubt/defs.ma". + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/defs.ma new file mode 100644 index 000000000..e0b46886f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/defs.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/drop/defs". + +include "C/defs.ma". + +include "lift/defs.ma". + +include "r/defs.ma". + +inductive drop: nat \to (nat \to (C \to (C \to Prop))) \def +| drop_refl: \forall (c: C).(drop O O c c) +| drop_drop: \forall (k: K).(\forall (h: nat).(\forall (c: C).(\forall (e: +C).((drop (r k h) O c e) \to (\forall (u: T).(drop (S h) O (CHead c k u) +e)))))) +| drop_skip: \forall (k: K).(\forall (h: nat).(\forall (d: nat).(\forall (c: +C).(\forall (e: C).((drop h (r k d) c e) \to (\forall (u: T).(drop h (S d) +(CHead c k (lift h (r k d) u)) (CHead e k u)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/fwd.ma new file mode 100644 index 000000000..af9e245f3 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/fwd.ma @@ -0,0 +1,326 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/drop/fwd". + +include "drop/defs.ma". + +theorem drop_gen_sort: + \forall (n: nat).(\forall (h: nat).(\forall (d: nat).(\forall (x: C).((drop +h d (CSort n) x) \to (and3 (eq C x (CSort n)) (eq nat h O) (eq nat d O)))))) +\def + \lambda (n: nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (x: +C).(\lambda (H: (drop h d (CSort n) x)).(insert_eq C (CSort n) (\lambda (c: +C).(drop h d c x)) (and3 (eq C x (CSort n)) (eq nat h O) (eq nat d O)) +(\lambda (y: C).(\lambda (H0: (drop h d y x)).(drop_ind (\lambda (n0: +nat).(\lambda (n1: nat).(\lambda (c: C).(\lambda (c0: C).((eq C c (CSort n)) +\to (and3 (eq C c0 (CSort n)) (eq nat n0 O) (eq nat n1 O))))))) (\lambda (c: +C).(\lambda (H1: (eq C c (CSort n))).(let H2 \def (f_equal C C (\lambda (e: +C).e) c (CSort n) H1) in (eq_ind_r C (CSort n) (\lambda (c0: C).(and3 (eq C +c0 (CSort n)) (eq nat O O) (eq nat O O))) (and3_intro (eq C (CSort n) (CSort +n)) (eq nat O O) (eq nat O O) (refl_equal C (CSort n)) (refl_equal nat O) +(refl_equal nat O)) c H2)))) (\lambda (k: K).(\lambda (h0: nat).(\lambda (c: +C).(\lambda (e: C).(\lambda (_: (drop (r k h0) O c e)).(\lambda (_: (((eq C c +(CSort n)) \to (and3 (eq C e (CSort n)) (eq nat (r k h0) O) (eq nat O +O))))).(\lambda (u: T).(\lambda (H3: (eq C (CHead c k u) (CSort n))).(let H4 +\def (eq_ind C (CHead c k u) (\lambda (ee: C).(match ee in C return (\lambda +(_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ _ _) \Rightarrow +True])) I (CSort n) H3) in (False_ind (and3 (eq C e (CSort n)) (eq nat (S h0) +O) (eq nat O O)) H4)))))))))) (\lambda (k: K).(\lambda (h0: nat).(\lambda +(d0: nat).(\lambda (c: C).(\lambda (e: C).(\lambda (_: (drop h0 (r k d0) c +e)).(\lambda (_: (((eq C c (CSort n)) \to (and3 (eq C e (CSort n)) (eq nat h0 +O) (eq nat (r k d0) O))))).(\lambda (u: T).(\lambda (H3: (eq C (CHead c k +(lift h0 (r k d0) u)) (CSort n))).(let H4 \def (eq_ind C (CHead c k (lift h0 +(r k d0) u)) (\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) +with [(CSort _) \Rightarrow False | (CHead _ _ _) \Rightarrow True])) I +(CSort n) H3) in (False_ind (and3 (eq C (CHead e k u) (CSort n)) (eq nat h0 +O) (eq nat (S d0) O)) H4))))))))))) h d y x H0))) H))))). + +theorem drop_gen_refl: + \forall (x: C).(\forall (e: C).((drop O O x e) \to (eq C x e))) +\def + \lambda (x: C).(\lambda (e: C).(\lambda (H: (drop O O x e)).(insert_eq nat O +(\lambda (n: nat).(drop n O x e)) (eq C x e) (\lambda (y: nat).(\lambda (H0: +(drop y O x e)).(insert_eq nat O (\lambda (n: nat).(drop y n x e)) ((eq nat y +O) \to (eq C x e)) (\lambda (y0: nat).(\lambda (H1: (drop y y0 x +e)).(drop_ind (\lambda (n: nat).(\lambda (n0: nat).(\lambda (c: C).(\lambda +(c0: C).((eq nat n0 O) \to ((eq nat n O) \to (eq C c c0))))))) (\lambda (c: +C).(\lambda (_: (eq nat O O)).(\lambda (_: (eq nat O O)).(refl_equal C c)))) +(\lambda (k: K).(\lambda (h: nat).(\lambda (c: C).(\lambda (e0: C).(\lambda +(_: (drop (r k h) O c e0)).(\lambda (_: (((eq nat O O) \to ((eq nat (r k h) +O) \to (eq C c e0))))).(\lambda (u: T).(\lambda (_: (eq nat O O)).(\lambda +(H5: (eq nat (S h) O)).(let H6 \def (eq_ind nat (S h) (\lambda (ee: +nat).(match ee in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +False | (S _) \Rightarrow True])) I O H5) in (False_ind (eq C (CHead c k u) +e0) H6))))))))))) (\lambda (k: K).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (c: C).(\lambda (e0: C).(\lambda (H2: (drop h (r k d) c +e0)).(\lambda (H3: (((eq nat (r k d) O) \to ((eq nat h O) \to (eq C c +e0))))).(\lambda (u: T).(\lambda (H4: (eq nat (S d) O)).(\lambda (H5: (eq nat +h O)).(let H6 \def (f_equal nat nat (\lambda (e1: nat).e1) h O H5) in (let H7 +\def (eq_ind nat h (\lambda (n: nat).((eq nat (r k d) O) \to ((eq nat n O) +\to (eq C c e0)))) H3 O H6) in (let H8 \def (eq_ind nat h (\lambda (n: +nat).(drop n (r k d) c e0)) H2 O H6) in (eq_ind_r nat O (\lambda (n: nat).(eq +C (CHead c k (lift n (r k d) u)) (CHead e0 k u))) (let H9 \def (eq_ind nat (S +d) (\lambda (ee: nat).(match ee in nat return (\lambda (_: nat).Prop) with [O +\Rightarrow False | (S _) \Rightarrow True])) I O H4) in (False_ind (eq C +(CHead c k (lift O (r k d) u)) (CHead e0 k u)) H9)) h H6)))))))))))))) y y0 x +e H1))) H0))) H))). + +theorem drop_gen_drop: + \forall (k: K).(\forall (c: C).(\forall (x: C).(\forall (u: T).(\forall (h: +nat).((drop (S h) O (CHead c k u) x) \to (drop (r k h) O c x)))))) +\def + \lambda (k: K).(\lambda (c: C).(\lambda (x: C).(\lambda (u: T).(\lambda (h: +nat).(\lambda (H: (drop (S h) O (CHead c k u) x)).(insert_eq C (CHead c k u) +(\lambda (c0: C).(drop (S h) O c0 x)) (drop (r k h) O c x) (\lambda (y: +C).(\lambda (H0: (drop (S h) O y x)).(insert_eq nat O (\lambda (n: nat).(drop +(S h) n y x)) ((eq C y (CHead c k u)) \to (drop (r k h) O c x)) (\lambda (y0: +nat).(\lambda (H1: (drop (S h) y0 y x)).(insert_eq nat (S h) (\lambda (n: +nat).(drop n y0 y x)) ((eq nat y0 O) \to ((eq C y (CHead c k u)) \to (drop (r +k h) O c x))) (\lambda (y1: nat).(\lambda (H2: (drop y1 y0 y x)).(drop_ind +(\lambda (n: nat).(\lambda (n0: nat).(\lambda (c0: C).(\lambda (c1: C).((eq +nat n (S h)) \to ((eq nat n0 O) \to ((eq C c0 (CHead c k u)) \to (drop (r k +h) O c c1)))))))) (\lambda (c0: C).(\lambda (H3: (eq nat O (S h))).(\lambda +(_: (eq nat O O)).(\lambda (_: (eq C c0 (CHead c k u))).(let H6 \def (match +H3 in eq return (\lambda (n: nat).(\lambda (_: (eq ? ? n)).((eq nat n (S h)) +\to (drop (r k h) O c c0)))) with [refl_equal \Rightarrow (\lambda (H6: (eq +nat O (S h))).(let H7 \def (eq_ind nat O (\lambda (e: nat).(match e in nat +return (\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow +False])) I (S h) H6) in (False_ind (drop (r k h) O c c0) H7)))]) in (H6 +(refl_equal nat (S h)))))))) (\lambda (k0: K).(\lambda (h0: nat).(\lambda +(c0: C).(\lambda (e: C).(\lambda (H3: (drop (r k0 h0) O c0 e)).(\lambda (_: +(((eq nat (r k0 h0) (S h)) \to ((eq nat O O) \to ((eq C c0 (CHead c k u)) \to +(drop (r k h) O c e)))))).(\lambda (u0: T).(\lambda (H5: (eq nat (S h0) (S +h))).(\lambda (_: (eq nat O O)).(\lambda (H7: (eq C (CHead c0 k0 u0) (CHead c +k u))).(let H8 \def (match H5 in eq return (\lambda (n: nat).(\lambda (_: (eq +? ? n)).((eq nat n (S h)) \to (drop (r k h) O c e)))) with [refl_equal +\Rightarrow (\lambda (H8: (eq nat (S h0) (S h))).(let H9 \def (f_equal nat +nat (\lambda (e0: nat).(match e0 in nat return (\lambda (_: nat).nat) with [O +\Rightarrow h0 | (S n) \Rightarrow n])) (S h0) (S h) H8) in (eq_ind nat h +(\lambda (_: nat).(drop (r k h) O c e)) (let H10 \def (match H7 in eq return +(\lambda (c1: C).(\lambda (_: (eq ? ? c1)).((eq C c1 (CHead c k u)) \to (drop +(r k h) O c e)))) with [refl_equal \Rightarrow (\lambda (H10: (eq C (CHead c0 +k0 u0) (CHead c k u))).(let H11 \def (f_equal C T (\lambda (e0: C).(match e0 +in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | (CHead _ _ t) +\Rightarrow t])) (CHead c0 k0 u0) (CHead c k u) H10) in ((let H12 \def +(f_equal C K (\lambda (e0: C).(match e0 in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow k0 | (CHead _ k1 _) \Rightarrow k1])) (CHead c0 k0 u0) +(CHead c k u) H10) in ((let H13 \def (f_equal C C (\lambda (e0: C).(match e0 +in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c1 _ +_) \Rightarrow c1])) (CHead c0 k0 u0) (CHead c k u) H10) in (eq_ind C c +(\lambda (_: C).((eq K k0 k) \to ((eq T u0 u) \to (drop (r k h) O c e)))) +(\lambda (H14: (eq K k0 k)).(eq_ind K k (\lambda (_: K).((eq T u0 u) \to +(drop (r k h) O c e))) (\lambda (H15: (eq T u0 u)).(eq_ind T u (\lambda (_: +T).(drop (r k h) O c e)) (eq_ind nat h0 (\lambda (n: nat).(drop (r k n) O c +e)) (eq_ind C c0 (\lambda (c1: C).(drop (r k h0) O c1 e)) (eq_ind K k0 +(\lambda (k1: K).(drop (r k1 h0) O c0 e)) H3 k H14) c H13) h H9) u0 (sym_eq T +u0 u H15))) k0 (sym_eq K k0 k H14))) c0 (sym_eq C c0 c H13))) H12)) H11)))]) +in (H10 (refl_equal C (CHead c k u)))) h0 (sym_eq nat h0 h H9))))]) in (H8 +(refl_equal nat (S h)))))))))))))) (\lambda (k0: K).(\lambda (h0: +nat).(\lambda (d: nat).(\lambda (c0: C).(\lambda (e: C).(\lambda (_: (drop h0 +(r k0 d) c0 e)).(\lambda (_: (((eq nat h0 (S h)) \to ((eq nat (r k0 d) O) \to +((eq C c0 (CHead c k u)) \to (drop (r k h) O c e)))))).(\lambda (u0: +T).(\lambda (_: (eq nat h0 (S h))).(\lambda (H6: (eq nat (S d) O)).(\lambda +(_: (eq C (CHead c0 k0 (lift h0 (r k0 d) u0)) (CHead c k u))).(let H8 \def +(match H6 in eq return (\lambda (n: nat).(\lambda (_: (eq ? ? n)).((eq nat n +O) \to (drop (r k h) O c (CHead e k0 u0))))) with [refl_equal \Rightarrow +(\lambda (H8: (eq nat (S d) O)).(let H9 \def (eq_ind nat (S d) (\lambda (e0: +nat).(match e0 in nat return (\lambda (_: nat).Prop) with [O \Rightarrow +False | (S _) \Rightarrow True])) I O H8) in (False_ind (drop (r k h) O c +(CHead e k0 u0)) H9)))]) in (H8 (refl_equal nat O)))))))))))))) y1 y0 y x +H2))) H1))) H0))) H)))))). + +theorem drop_gen_skip_r: + \forall (c: C).(\forall (x: C).(\forall (u: T).(\forall (h: nat).(\forall +(d: nat).(\forall (k: K).((drop h (S d) x (CHead c k u)) \to (ex2 C (\lambda +(e: C).(eq C x (CHead e k (lift h (r k d) u)))) (\lambda (e: C).(drop h (r k +d) e c))))))))) +\def + \lambda (c: C).(\lambda (x: C).(\lambda (u: T).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (k: K).(\lambda (H: (drop h (S d) x (CHead c k u))).(let H0 +\def (match H in drop return (\lambda (n: nat).(\lambda (n0: nat).(\lambda +(c0: C).(\lambda (c1: C).(\lambda (_: (drop n n0 c0 c1)).((eq nat n h) \to +((eq nat n0 (S d)) \to ((eq C c0 x) \to ((eq C c1 (CHead c k u)) \to (ex2 C +(\lambda (e: C).(eq C x (CHead e k (lift h (r k d) u)))) (\lambda (e: +C).(drop h (r k d) e c)))))))))))) with [(drop_refl c0) \Rightarrow (\lambda +(H0: (eq nat O h)).(\lambda (H1: (eq nat O (S d))).(\lambda (H2: (eq C c0 +x)).(\lambda (H3: (eq C c0 (CHead c k u))).(eq_ind nat O (\lambda (n: +nat).((eq nat O (S d)) \to ((eq C c0 x) \to ((eq C c0 (CHead c k u)) \to (ex2 +C (\lambda (e: C).(eq C x (CHead e k (lift n (r k d) u)))) (\lambda (e: +C).(drop n (r k d) e c))))))) (\lambda (H4: (eq nat O (S d))).(let H5 \def +(eq_ind nat O (\lambda (e: nat).(match e in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) I (S d) H4) +in (False_ind ((eq C c0 x) \to ((eq C c0 (CHead c k u)) \to (ex2 C (\lambda +(e: C).(eq C x (CHead e k (lift O (r k d) u)))) (\lambda (e: C).(drop O (r k +d) e c))))) H5))) h H0 H1 H2 H3))))) | (drop_drop k0 h0 c0 e H0 u0) +\Rightarrow (\lambda (H1: (eq nat (S h0) h)).(\lambda (H2: (eq nat O (S +d))).(\lambda (H3: (eq C (CHead c0 k0 u0) x)).(\lambda (H4: (eq C e (CHead c +k u))).(eq_ind nat (S h0) (\lambda (n: nat).((eq nat O (S d)) \to ((eq C +(CHead c0 k0 u0) x) \to ((eq C e (CHead c k u)) \to ((drop (r k0 h0) O c0 e) +\to (ex2 C (\lambda (e0: C).(eq C x (CHead e0 k (lift n (r k d) u)))) +(\lambda (e0: C).(drop n (r k d) e0 c)))))))) (\lambda (H5: (eq nat O (S +d))).(let H6 \def (eq_ind nat O (\lambda (e0: nat).(match e0 in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) +I (S d) H5) in (False_ind ((eq C (CHead c0 k0 u0) x) \to ((eq C e (CHead c k +u)) \to ((drop (r k0 h0) O c0 e) \to (ex2 C (\lambda (e0: C).(eq C x (CHead +e0 k (lift (S h0) (r k d) u)))) (\lambda (e0: C).(drop (S h0) (r k d) e0 +c)))))) H6))) h H1 H2 H3 H4 H0))))) | (drop_skip k0 h0 d0 c0 e H0 u0) +\Rightarrow (\lambda (H1: (eq nat h0 h)).(\lambda (H2: (eq nat (S d0) (S +d))).(\lambda (H3: (eq C (CHead c0 k0 (lift h0 (r k0 d0) u0)) x)).(\lambda +(H4: (eq C (CHead e k0 u0) (CHead c k u))).(eq_ind nat h (\lambda (n: +nat).((eq nat (S d0) (S d)) \to ((eq C (CHead c0 k0 (lift n (r k0 d0) u0)) x) +\to ((eq C (CHead e k0 u0) (CHead c k u)) \to ((drop n (r k0 d0) c0 e) \to +(ex2 C (\lambda (e0: C).(eq C x (CHead e0 k (lift h (r k d) u)))) (\lambda +(e0: C).(drop h (r k d) e0 c)))))))) (\lambda (H5: (eq nat (S d0) (S +d))).(let H6 \def (f_equal nat nat (\lambda (e0: nat).(match e0 in nat return +(\lambda (_: nat).nat) with [O \Rightarrow d0 | (S n) \Rightarrow n])) (S d0) +(S d) H5) in (eq_ind nat d (\lambda (n: nat).((eq C (CHead c0 k0 (lift h (r +k0 n) u0)) x) \to ((eq C (CHead e k0 u0) (CHead c k u)) \to ((drop h (r k0 n) +c0 e) \to (ex2 C (\lambda (e0: C).(eq C x (CHead e0 k (lift h (r k d) u)))) +(\lambda (e0: C).(drop h (r k d) e0 c))))))) (\lambda (H7: (eq C (CHead c0 k0 +(lift h (r k0 d) u0)) x)).(eq_ind C (CHead c0 k0 (lift h (r k0 d) u0)) +(\lambda (c1: C).((eq C (CHead e k0 u0) (CHead c k u)) \to ((drop h (r k0 d) +c0 e) \to (ex2 C (\lambda (e0: C).(eq C c1 (CHead e0 k (lift h (r k d) u)))) +(\lambda (e0: C).(drop h (r k d) e0 c)))))) (\lambda (H8: (eq C (CHead e k0 +u0) (CHead c k u))).(let H9 \def (f_equal C T (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | (CHead _ _ t) +\Rightarrow t])) (CHead e k0 u0) (CHead c k u) H8) in ((let H10 \def (f_equal +C K (\lambda (e0: C).(match e0 in C return (\lambda (_: C).K) with [(CSort _) +\Rightarrow k0 | (CHead _ k1 _) \Rightarrow k1])) (CHead e k0 u0) (CHead c k +u) H8) in ((let H11 \def (f_equal C C (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow e | (CHead c1 _ _) \Rightarrow +c1])) (CHead e k0 u0) (CHead c k u) H8) in (eq_ind C c (\lambda (c1: C).((eq +K k0 k) \to ((eq T u0 u) \to ((drop h (r k0 d) c0 c1) \to (ex2 C (\lambda +(e0: C).(eq C (CHead c0 k0 (lift h (r k0 d) u0)) (CHead e0 k (lift h (r k d) +u)))) (\lambda (e0: C).(drop h (r k d) e0 c))))))) (\lambda (H12: (eq K k0 +k)).(eq_ind K k (\lambda (k1: K).((eq T u0 u) \to ((drop h (r k1 d) c0 c) \to +(ex2 C (\lambda (e0: C).(eq C (CHead c0 k1 (lift h (r k1 d) u0)) (CHead e0 k +(lift h (r k d) u)))) (\lambda (e0: C).(drop h (r k d) e0 c)))))) (\lambda +(H13: (eq T u0 u)).(eq_ind T u (\lambda (t: T).((drop h (r k d) c0 c) \to +(ex2 C (\lambda (e0: C).(eq C (CHead c0 k (lift h (r k d) t)) (CHead e0 k +(lift h (r k d) u)))) (\lambda (e0: C).(drop h (r k d) e0 c))))) (\lambda +(H14: (drop h (r k d) c0 c)).(let H15 \def (eq_ind T u0 (\lambda (t: T).(eq C +(CHead c0 k0 (lift h (r k0 d) t)) x)) H7 u H13) in (let H16 \def (eq_ind K k0 +(\lambda (k1: K).(eq C (CHead c0 k1 (lift h (r k1 d) u)) x)) H15 k H12) in +(let H17 \def (eq_ind_r C x (\lambda (c1: C).(drop h (S d) c1 (CHead c k u))) +H (CHead c0 k (lift h (r k d) u)) H16) in (ex_intro2 C (\lambda (e0: C).(eq C +(CHead c0 k (lift h (r k d) u)) (CHead e0 k (lift h (r k d) u)))) (\lambda +(e0: C).(drop h (r k d) e0 c)) c0 (refl_equal C (CHead c0 k (lift h (r k d) +u))) H14))))) u0 (sym_eq T u0 u H13))) k0 (sym_eq K k0 k H12))) e (sym_eq C e +c H11))) H10)) H9))) x H7)) d0 (sym_eq nat d0 d H6)))) h0 (sym_eq nat h0 h +H1) H2 H3 H4 H0)))))]) in (H0 (refl_equal nat h) (refl_equal nat (S d)) +(refl_equal C x) (refl_equal C (CHead c k u)))))))))). + +theorem drop_gen_skip_l: + \forall (c: C).(\forall (x: C).(\forall (u: T).(\forall (h: nat).(\forall +(d: nat).(\forall (k: K).((drop h (S d) (CHead c k u) x) \to (ex3_2 C T +(\lambda (e: C).(\lambda (v: T).(eq C x (CHead e k v)))) (\lambda (_: +C).(\lambda (v: T).(eq T u (lift h (r k d) v)))) (\lambda (e: C).(\lambda (_: +T).(drop h (r k d) c e)))))))))) +\def + \lambda (c: C).(\lambda (x: C).(\lambda (u: T).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (k: K).(\lambda (H: (drop h (S d) (CHead c k u) x)).(let H0 +\def (match H in drop return (\lambda (n: nat).(\lambda (n0: nat).(\lambda +(c0: C).(\lambda (c1: C).(\lambda (_: (drop n n0 c0 c1)).((eq nat n h) \to +((eq nat n0 (S d)) \to ((eq C c0 (CHead c k u)) \to ((eq C c1 x) \to (ex3_2 C +T (\lambda (e: C).(\lambda (v: T).(eq C x (CHead e k v)))) (\lambda (_: +C).(\lambda (v: T).(eq T u (lift h (r k d) v)))) (\lambda (e: C).(\lambda (_: +T).(drop h (r k d) c e))))))))))))) with [(drop_refl c0) \Rightarrow (\lambda +(H0: (eq nat O h)).(\lambda (H1: (eq nat O (S d))).(\lambda (H2: (eq C c0 +(CHead c k u))).(\lambda (H3: (eq C c0 x)).(eq_ind nat O (\lambda (n: +nat).((eq nat O (S d)) \to ((eq C c0 (CHead c k u)) \to ((eq C c0 x) \to +(ex3_2 C T (\lambda (e: C).(\lambda (v: T).(eq C x (CHead e k v)))) (\lambda +(_: C).(\lambda (v: T).(eq T u (lift n (r k d) v)))) (\lambda (e: C).(\lambda +(_: T).(drop n (r k d) c e)))))))) (\lambda (H4: (eq nat O (S d))).(let H5 +\def (eq_ind nat O (\lambda (e: nat).(match e in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) I (S d) H4) +in (False_ind ((eq C c0 (CHead c k u)) \to ((eq C c0 x) \to (ex3_2 C T +(\lambda (e: C).(\lambda (v: T).(eq C x (CHead e k v)))) (\lambda (_: +C).(\lambda (v: T).(eq T u (lift O (r k d) v)))) (\lambda (e: C).(\lambda (_: +T).(drop O (r k d) c e)))))) H5))) h H0 H1 H2 H3))))) | (drop_drop k0 h0 c0 e +H0 u0) \Rightarrow (\lambda (H1: (eq nat (S h0) h)).(\lambda (H2: (eq nat O +(S d))).(\lambda (H3: (eq C (CHead c0 k0 u0) (CHead c k u))).(\lambda (H4: +(eq C e x)).(eq_ind nat (S h0) (\lambda (n: nat).((eq nat O (S d)) \to ((eq C +(CHead c0 k0 u0) (CHead c k u)) \to ((eq C e x) \to ((drop (r k0 h0) O c0 e) +\to (ex3_2 C T (\lambda (e0: C).(\lambda (v: T).(eq C x (CHead e0 k v)))) +(\lambda (_: C).(\lambda (v: T).(eq T u (lift n (r k d) v)))) (\lambda (e0: +C).(\lambda (_: T).(drop n (r k d) c e0))))))))) (\lambda (H5: (eq nat O (S +d))).(let H6 \def (eq_ind nat O (\lambda (e0: nat).(match e0 in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) +I (S d) H5) in (False_ind ((eq C (CHead c0 k0 u0) (CHead c k u)) \to ((eq C e +x) \to ((drop (r k0 h0) O c0 e) \to (ex3_2 C T (\lambda (e0: C).(\lambda (v: +T).(eq C x (CHead e0 k v)))) (\lambda (_: C).(\lambda (v: T).(eq T u (lift (S +h0) (r k d) v)))) (\lambda (e0: C).(\lambda (_: T).(drop (S h0) (r k d) c +e0))))))) H6))) h H1 H2 H3 H4 H0))))) | (drop_skip k0 h0 d0 c0 e H0 u0) +\Rightarrow (\lambda (H1: (eq nat h0 h)).(\lambda (H2: (eq nat (S d0) (S +d))).(\lambda (H3: (eq C (CHead c0 k0 (lift h0 (r k0 d0) u0)) (CHead c k +u))).(\lambda (H4: (eq C (CHead e k0 u0) x)).(eq_ind nat h (\lambda (n: +nat).((eq nat (S d0) (S d)) \to ((eq C (CHead c0 k0 (lift n (r k0 d0) u0)) +(CHead c k u)) \to ((eq C (CHead e k0 u0) x) \to ((drop n (r k0 d0) c0 e) \to +(ex3_2 C T (\lambda (e0: C).(\lambda (v: T).(eq C x (CHead e0 k v)))) +(\lambda (_: C).(\lambda (v: T).(eq T u (lift h (r k d) v)))) (\lambda (e0: +C).(\lambda (_: T).(drop h (r k d) c e0))))))))) (\lambda (H5: (eq nat (S d0) +(S d))).(let H6 \def (f_equal nat nat (\lambda (e0: nat).(match e0 in nat +return (\lambda (_: nat).nat) with [O \Rightarrow d0 | (S n) \Rightarrow n])) +(S d0) (S d) H5) in (eq_ind nat d (\lambda (n: nat).((eq C (CHead c0 k0 (lift +h (r k0 n) u0)) (CHead c k u)) \to ((eq C (CHead e k0 u0) x) \to ((drop h (r +k0 n) c0 e) \to (ex3_2 C T (\lambda (e0: C).(\lambda (v: T).(eq C x (CHead e0 +k v)))) (\lambda (_: C).(\lambda (v: T).(eq T u (lift h (r k d) v)))) +(\lambda (e0: C).(\lambda (_: T).(drop h (r k d) c e0)))))))) (\lambda (H7: +(eq C (CHead c0 k0 (lift h (r k0 d) u0)) (CHead c k u))).(let H8 \def +(f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d1: nat) (t: +T) on t: T \def (match t with [(TSort n) \Rightarrow (TSort n) | (TLRef i) +\Rightarrow (TLRef (match (blt i d1) with [true \Rightarrow i | false +\Rightarrow (f i)])) | (THead k1 u1 t0) \Rightarrow (THead k1 (lref_map f d1 +u1) (lref_map f (s k1 d1) t0))]) in lref_map) (\lambda (x0: nat).(plus x0 h)) +(r k0 d) u0) | (CHead _ _ t) \Rightarrow t])) (CHead c0 k0 (lift h (r k0 d) +u0)) (CHead c k u) H7) in ((let H9 \def (f_equal C K (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k0 | (CHead _ +k1 _) \Rightarrow k1])) (CHead c0 k0 (lift h (r k0 d) u0)) (CHead c k u) H7) +in ((let H10 \def (f_equal C C (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c1 _ _) +\Rightarrow c1])) (CHead c0 k0 (lift h (r k0 d) u0)) (CHead c k u) H7) in +(eq_ind C c (\lambda (c1: C).((eq K k0 k) \to ((eq T (lift h (r k0 d) u0) u) +\to ((eq C (CHead e k0 u0) x) \to ((drop h (r k0 d) c1 e) \to (ex3_2 C T +(\lambda (e0: C).(\lambda (v: T).(eq C x (CHead e0 k v)))) (\lambda (_: +C).(\lambda (v: T).(eq T u (lift h (r k d) v)))) (\lambda (e0: C).(\lambda +(_: T).(drop h (r k d) c e0))))))))) (\lambda (H11: (eq K k0 k)).(eq_ind K k +(\lambda (k1: K).((eq T (lift h (r k1 d) u0) u) \to ((eq C (CHead e k1 u0) x) +\to ((drop h (r k1 d) c e) \to (ex3_2 C T (\lambda (e0: C).(\lambda (v: +T).(eq C x (CHead e0 k v)))) (\lambda (_: C).(\lambda (v: T).(eq T u (lift h +(r k d) v)))) (\lambda (e0: C).(\lambda (_: T).(drop h (r k d) c e0)))))))) +(\lambda (H12: (eq T (lift h (r k d) u0) u)).(eq_ind T (lift h (r k d) u0) +(\lambda (t: T).((eq C (CHead e k u0) x) \to ((drop h (r k d) c e) \to (ex3_2 +C T (\lambda (e0: C).(\lambda (v: T).(eq C x (CHead e0 k v)))) (\lambda (_: +C).(\lambda (v: T).(eq T t (lift h (r k d) v)))) (\lambda (e0: C).(\lambda +(_: T).(drop h (r k d) c e0))))))) (\lambda (H13: (eq C (CHead e k u0) +x)).(eq_ind C (CHead e k u0) (\lambda (c1: C).((drop h (r k d) c e) \to +(ex3_2 C T (\lambda (e0: C).(\lambda (v: T).(eq C c1 (CHead e0 k v)))) +(\lambda (_: C).(\lambda (v: T).(eq T (lift h (r k d) u0) (lift h (r k d) +v)))) (\lambda (e0: C).(\lambda (_: T).(drop h (r k d) c e0)))))) (\lambda +(H14: (drop h (r k d) c e)).(let H15 \def (eq_ind_r T u (\lambda (t: T).(drop +h (S d) (CHead c k t) x)) H (lift h (r k d) u0) H12) in (let H16 \def +(eq_ind_r C x (\lambda (c1: C).(drop h (S d) (CHead c k (lift h (r k d) u0)) +c1)) H15 (CHead e k u0) H13) in (ex3_2_intro C T (\lambda (e0: C).(\lambda +(v: T).(eq C (CHead e k u0) (CHead e0 k v)))) (\lambda (_: C).(\lambda (v: +T).(eq T (lift h (r k d) u0) (lift h (r k d) v)))) (\lambda (e0: C).(\lambda +(_: T).(drop h (r k d) c e0))) e u0 (refl_equal C (CHead e k u0)) (refl_equal +T (lift h (r k d) u0)) H14)))) x H13)) u H12)) k0 (sym_eq K k0 k H11))) c0 +(sym_eq C c0 c H10))) H9)) H8))) d0 (sym_eq nat d0 d H6)))) h0 (sym_eq nat h0 +h H1) H2 H3 H4 H0)))))]) in (H0 (refl_equal nat h) (refl_equal nat (S d)) +(refl_equal C (CHead c k u)) (refl_equal C x))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/props.ma new file mode 100644 index 000000000..029720727 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/props.ma @@ -0,0 +1,729 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/drop/props". + +include "drop/fwd.ma". + +include "lift/props.ma". + +include "r/props.ma". + +theorem drop_skip_bind: + \forall (h: nat).(\forall (d: nat).(\forall (c: C).(\forall (e: C).((drop h +d c e) \to (\forall (b: B).(\forall (u: T).(drop h (S d) (CHead c (Bind b) +(lift h d u)) (CHead e (Bind b) u)))))))) +\def + \lambda (h: nat).(\lambda (d: nat).(\lambda (c: C).(\lambda (e: C).(\lambda +(H: (drop h d c e)).(\lambda (b: B).(\lambda (u: T).(eq_ind nat (r (Bind b) +d) (\lambda (n: nat).(drop h (S d) (CHead c (Bind b) (lift h n u)) (CHead e +(Bind b) u))) (drop_skip (Bind b) h d c e H u) d (refl_equal nat d)))))))). + +theorem drop_skip_flat: + \forall (h: nat).(\forall (d: nat).(\forall (c: C).(\forall (e: C).((drop h +(S d) c e) \to (\forall (f: F).(\forall (u: T).(drop h (S d) (CHead c (Flat +f) (lift h (S d) u)) (CHead e (Flat f) u)))))))) +\def + \lambda (h: nat).(\lambda (d: nat).(\lambda (c: C).(\lambda (e: C).(\lambda +(H: (drop h (S d) c e)).(\lambda (f: F).(\lambda (u: T).(eq_ind nat (r (Flat +f) d) (\lambda (n: nat).(drop h (S d) (CHead c (Flat f) (lift h n u)) (CHead +e (Flat f) u))) (drop_skip (Flat f) h d c e H u) (S d) (refl_equal nat (S +d))))))))). + +theorem drop_S: + \forall (b: B).(\forall (c: C).(\forall (e: C).(\forall (u: T).(\forall (h: +nat).((drop h O c (CHead e (Bind b) u)) \to (drop (S h) O c e)))))) +\def + \lambda (b: B).(\lambda (c: C).(C_ind (\lambda (c0: C).(\forall (e: +C).(\forall (u: T).(\forall (h: nat).((drop h O c0 (CHead e (Bind b) u)) \to +(drop (S h) O c0 e)))))) (\lambda (n: nat).(\lambda (e: C).(\lambda (u: +T).(\lambda (h: nat).(\lambda (H: (drop h O (CSort n) (CHead e (Bind b) +u))).(and3_ind (eq C (CHead e (Bind b) u) (CSort n)) (eq nat h O) (eq nat O +O) (drop (S h) O (CSort n) e) (\lambda (H0: (eq C (CHead e (Bind b) u) (CSort +n))).(\lambda (H1: (eq nat h O)).(\lambda (_: (eq nat O O)).(eq_ind_r nat O +(\lambda (n0: nat).(drop (S n0) O (CSort n) e)) (let H3 \def (eq_ind C (CHead +e (Bind b) u) (\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) +with [(CSort _) \Rightarrow False | (CHead _ _ _) \Rightarrow True])) I +(CSort n) H0) in (False_ind (drop (S O) O (CSort n) e) H3)) h H1)))) +(drop_gen_sort n h O (CHead e (Bind b) u) H))))))) (\lambda (c0: C).(\lambda +(H: ((\forall (e: C).(\forall (u: T).(\forall (h: nat).((drop h O c0 (CHead e +(Bind b) u)) \to (drop (S h) O c0 e))))))).(\lambda (k: K).(\lambda (t: +T).(\lambda (e: C).(\lambda (u: T).(\lambda (h: nat).(nat_ind (\lambda (n: +nat).((drop n O (CHead c0 k t) (CHead e (Bind b) u)) \to (drop (S n) O (CHead +c0 k t) e))) (\lambda (H0: (drop O O (CHead c0 k t) (CHead e (Bind b) +u))).(let H1 \def (f_equal C C (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c1 _ _) +\Rightarrow c1])) (CHead c0 k t) (CHead e (Bind b) u) (drop_gen_refl (CHead +c0 k t) (CHead e (Bind b) u) H0)) in ((let H2 \def (f_equal C K (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | +(CHead _ k0 _) \Rightarrow k0])) (CHead c0 k t) (CHead e (Bind b) u) +(drop_gen_refl (CHead c0 k t) (CHead e (Bind b) u) H0)) in ((let H3 \def +(f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow t | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 k t) +(CHead e (Bind b) u) (drop_gen_refl (CHead c0 k t) (CHead e (Bind b) u) H0)) +in (\lambda (H4: (eq K k (Bind b))).(\lambda (H5: (eq C c0 e)).(eq_ind C c0 +(\lambda (c1: C).(drop (S O) O (CHead c0 k t) c1)) (eq_ind_r K (Bind b) +(\lambda (k0: K).(drop (S O) O (CHead c0 k0 t) c0)) (drop_drop (Bind b) O c0 +c0 (drop_refl c0) t) k H4) e H5)))) H2)) H1))) (\lambda (n: nat).(\lambda (_: +(((drop n O (CHead c0 k t) (CHead e (Bind b) u)) \to (drop (S n) O (CHead c0 +k t) e)))).(\lambda (H1: (drop (S n) O (CHead c0 k t) (CHead e (Bind b) +u))).(drop_drop k (S n) c0 e (eq_ind_r nat (S (r k n)) (\lambda (n0: +nat).(drop n0 O c0 e)) (H e u (r k n) (drop_gen_drop k c0 (CHead e (Bind b) +u) t n H1)) (r k (S n)) (r_S k n)) t)))) h)))))))) c)). + +theorem drop_ctail: + \forall (c1: C).(\forall (c2: C).(\forall (d: nat).(\forall (h: nat).((drop +h d c1 c2) \to (\forall (k: K).(\forall (u: T).(drop h d (CTail k u c1) +(CTail k u c2)))))))) +\def + \lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: C).(\forall (d: +nat).(\forall (h: nat).((drop h d c c2) \to (\forall (k: K).(\forall (u: +T).(drop h d (CTail k u c) (CTail k u c2))))))))) (\lambda (n: nat).(\lambda +(c2: C).(\lambda (d: nat).(\lambda (h: nat).(\lambda (H: (drop h d (CSort n) +c2)).(\lambda (k: K).(\lambda (u: T).(and3_ind (eq C c2 (CSort n)) (eq nat h +O) (eq nat d O) (drop h d (CTail k u (CSort n)) (CTail k u c2)) (\lambda (H0: +(eq C c2 (CSort n))).(\lambda (H1: (eq nat h O)).(\lambda (H2: (eq nat d +O)).(eq_ind_r nat O (\lambda (n0: nat).(drop n0 d (CTail k u (CSort n)) +(CTail k u c2))) (eq_ind_r nat O (\lambda (n0: nat).(drop O n0 (CTail k u +(CSort n)) (CTail k u c2))) (eq_ind_r C (CSort n) (\lambda (c: C).(drop O O +(CTail k u (CSort n)) (CTail k u c))) (drop_refl (CTail k u (CSort n))) c2 +H0) d H2) h H1)))) (drop_gen_sort n h d c2 H))))))))) (\lambda (c2: +C).(\lambda (IHc: ((\forall (c3: C).(\forall (d: nat).(\forall (h: +nat).((drop h d c2 c3) \to (\forall (k: K).(\forall (u: T).(drop h d (CTail k +u c2) (CTail k u c3)))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (c3: +C).(\lambda (d: nat).(nat_ind (\lambda (n: nat).(\forall (h: nat).((drop h n +(CHead c2 k t) c3) \to (\forall (k0: K).(\forall (u: T).(drop h n (CTail k0 u +(CHead c2 k t)) (CTail k0 u c3))))))) (\lambda (h: nat).(nat_ind (\lambda (n: +nat).((drop n O (CHead c2 k t) c3) \to (\forall (k0: K).(\forall (u: T).(drop +n O (CTail k0 u (CHead c2 k t)) (CTail k0 u c3)))))) (\lambda (H: (drop O O +(CHead c2 k t) c3)).(\lambda (k0: K).(\lambda (u: T).(eq_ind C (CHead c2 k t) +(\lambda (c: C).(drop O O (CTail k0 u (CHead c2 k t)) (CTail k0 u c))) +(drop_refl (CTail k0 u (CHead c2 k t))) c3 (drop_gen_refl (CHead c2 k t) c3 +H))))) (\lambda (n: nat).(\lambda (_: (((drop n O (CHead c2 k t) c3) \to +(\forall (k0: K).(\forall (u: T).(drop n O (CTail k0 u (CHead c2 k t)) (CTail +k0 u c3))))))).(\lambda (H0: (drop (S n) O (CHead c2 k t) c3)).(\lambda (k0: +K).(\lambda (u: T).(drop_drop k n (CTail k0 u c2) (CTail k0 u c3) (IHc c3 O +(r k n) (drop_gen_drop k c2 c3 t n H0) k0 u) t)))))) h)) (\lambda (n: +nat).(\lambda (H: ((\forall (h: nat).((drop h n (CHead c2 k t) c3) \to +(\forall (k0: K).(\forall (u: T).(drop h n (CTail k0 u (CHead c2 k t)) (CTail +k0 u c3)))))))).(\lambda (h: nat).(\lambda (H0: (drop h (S n) (CHead c2 k t) +c3)).(\lambda (k0: K).(\lambda (u: T).(ex3_2_ind C T (\lambda (e: C).(\lambda +(v: T).(eq C c3 (CHead e k v)))) (\lambda (_: C).(\lambda (v: T).(eq T t +(lift h (r k n) v)))) (\lambda (e: C).(\lambda (_: T).(drop h (r k n) c2 e))) +(drop h (S n) (CTail k0 u (CHead c2 k t)) (CTail k0 u c3)) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (H1: (eq C c3 (CHead x0 k x1))).(\lambda (H2: +(eq T t (lift h (r k n) x1))).(\lambda (H3: (drop h (r k n) c2 x0)).(let H4 +\def (eq_ind C c3 (\lambda (c: C).(\forall (h0: nat).((drop h0 n (CHead c2 k +t) c) \to (\forall (k1: K).(\forall (u0: T).(drop h0 n (CTail k1 u0 (CHead c2 +k t)) (CTail k1 u0 c))))))) H (CHead x0 k x1) H1) in (eq_ind_r C (CHead x0 k +x1) (\lambda (c: C).(drop h (S n) (CTail k0 u (CHead c2 k t)) (CTail k0 u +c))) (let H5 \def (eq_ind T t (\lambda (t0: T).(\forall (h0: nat).((drop h0 n +(CHead c2 k t0) (CHead x0 k x1)) \to (\forall (k1: K).(\forall (u0: T).(drop +h0 n (CTail k1 u0 (CHead c2 k t0)) (CTail k1 u0 (CHead x0 k x1)))))))) H4 +(lift h (r k n) x1) H2) in (eq_ind_r T (lift h (r k n) x1) (\lambda (t0: +T).(drop h (S n) (CTail k0 u (CHead c2 k t0)) (CTail k0 u (CHead x0 k x1)))) +(drop_skip k h n (CTail k0 u c2) (CTail k0 u x0) (IHc x0 (r k n) h H3 k0 u) +x1) t H2)) c3 H1))))))) (drop_gen_skip_l c2 c3 t h n k H0)))))))) d))))))) +c1). + +theorem drop_mono: + \forall (c: C).(\forall (x1: C).(\forall (d: nat).(\forall (h: nat).((drop h +d c x1) \to (\forall (x2: C).((drop h d c x2) \to (eq C x1 x2))))))) +\def + \lambda (c: C).(C_ind (\lambda (c0: C).(\forall (x1: C).(\forall (d: +nat).(\forall (h: nat).((drop h d c0 x1) \to (\forall (x2: C).((drop h d c0 +x2) \to (eq C x1 x2)))))))) (\lambda (n: nat).(\lambda (x1: C).(\lambda (d: +nat).(\lambda (h: nat).(\lambda (H: (drop h d (CSort n) x1)).(\lambda (x2: +C).(\lambda (H0: (drop h d (CSort n) x2)).(and3_ind (eq C x2 (CSort n)) (eq +nat h O) (eq nat d O) (eq C x1 x2) (\lambda (H1: (eq C x2 (CSort +n))).(\lambda (H2: (eq nat h O)).(\lambda (H3: (eq nat d O)).(and3_ind (eq C +x1 (CSort n)) (eq nat h O) (eq nat d O) (eq C x1 x2) (\lambda (H4: (eq C x1 +(CSort n))).(\lambda (H5: (eq nat h O)).(\lambda (H6: (eq nat d O)).(eq_ind_r +C (CSort n) (\lambda (c0: C).(eq C x1 c0)) (let H7 \def (eq_ind nat h +(\lambda (n0: nat).(eq nat n0 O)) H2 O H5) in (let H8 \def (eq_ind nat d +(\lambda (n0: nat).(eq nat n0 O)) H3 O H6) in (eq_ind_r C (CSort n) (\lambda +(c0: C).(eq C c0 (CSort n))) (refl_equal C (CSort n)) x1 H4))) x2 H1)))) +(drop_gen_sort n h d x1 H))))) (drop_gen_sort n h d x2 H0))))))))) (\lambda +(c0: C).(\lambda (H: ((\forall (x1: C).(\forall (d: nat).(\forall (h: +nat).((drop h d c0 x1) \to (\forall (x2: C).((drop h d c0 x2) \to (eq C x1 +x2))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (x1: C).(\lambda (d: +nat).(nat_ind (\lambda (n: nat).(\forall (h: nat).((drop h n (CHead c0 k t) +x1) \to (\forall (x2: C).((drop h n (CHead c0 k t) x2) \to (eq C x1 x2)))))) +(\lambda (h: nat).(nat_ind (\lambda (n: nat).((drop n O (CHead c0 k t) x1) +\to (\forall (x2: C).((drop n O (CHead c0 k t) x2) \to (eq C x1 x2))))) +(\lambda (H0: (drop O O (CHead c0 k t) x1)).(\lambda (x2: C).(\lambda (H1: +(drop O O (CHead c0 k t) x2)).(eq_ind C (CHead c0 k t) (\lambda (c1: C).(eq C +x1 c1)) (eq_ind C (CHead c0 k t) (\lambda (c1: C).(eq C c1 (CHead c0 k t))) +(refl_equal C (CHead c0 k t)) x1 (drop_gen_refl (CHead c0 k t) x1 H0)) x2 +(drop_gen_refl (CHead c0 k t) x2 H1))))) (\lambda (n: nat).(\lambda (_: +(((drop n O (CHead c0 k t) x1) \to (\forall (x2: C).((drop n O (CHead c0 k t) +x2) \to (eq C x1 x2)))))).(\lambda (H1: (drop (S n) O (CHead c0 k t) +x1)).(\lambda (x2: C).(\lambda (H2: (drop (S n) O (CHead c0 k t) x2)).(H x1 O +(r k n) (drop_gen_drop k c0 x1 t n H1) x2 (drop_gen_drop k c0 x2 t n +H2))))))) h)) (\lambda (n: nat).(\lambda (H0: ((\forall (h: nat).((drop h n +(CHead c0 k t) x1) \to (\forall (x2: C).((drop h n (CHead c0 k t) x2) \to (eq +C x1 x2))))))).(\lambda (h: nat).(\lambda (H1: (drop h (S n) (CHead c0 k t) +x1)).(\lambda (x2: C).(\lambda (H2: (drop h (S n) (CHead c0 k t) +x2)).(ex3_2_ind C T (\lambda (e: C).(\lambda (v: T).(eq C x2 (CHead e k v)))) +(\lambda (_: C).(\lambda (v: T).(eq T t (lift h (r k n) v)))) (\lambda (e: +C).(\lambda (_: T).(drop h (r k n) c0 e))) (eq C x1 x2) (\lambda (x0: +C).(\lambda (x3: T).(\lambda (H3: (eq C x2 (CHead x0 k x3))).(\lambda (H4: +(eq T t (lift h (r k n) x3))).(\lambda (H5: (drop h (r k n) c0 +x0)).(ex3_2_ind C T (\lambda (e: C).(\lambda (v: T).(eq C x1 (CHead e k v)))) +(\lambda (_: C).(\lambda (v: T).(eq T t (lift h (r k n) v)))) (\lambda (e: +C).(\lambda (_: T).(drop h (r k n) c0 e))) (eq C x1 x2) (\lambda (x4: +C).(\lambda (x5: T).(\lambda (H6: (eq C x1 (CHead x4 k x5))).(\lambda (H7: +(eq T t (lift h (r k n) x5))).(\lambda (H8: (drop h (r k n) c0 x4)).(eq_ind_r +C (CHead x0 k x3) (\lambda (c1: C).(eq C x1 c1)) (let H9 \def (eq_ind C x1 +(\lambda (c1: C).(\forall (h0: nat).((drop h0 n (CHead c0 k t) c1) \to +(\forall (x6: C).((drop h0 n (CHead c0 k t) x6) \to (eq C c1 x6)))))) H0 +(CHead x4 k x5) H6) in (eq_ind_r C (CHead x4 k x5) (\lambda (c1: C).(eq C c1 +(CHead x0 k x3))) (let H10 \def (eq_ind T t (\lambda (t0: T).(\forall (h0: +nat).((drop h0 n (CHead c0 k t0) (CHead x4 k x5)) \to (\forall (x6: C).((drop +h0 n (CHead c0 k t0) x6) \to (eq C (CHead x4 k x5) x6)))))) H9 (lift h (r k +n) x5) H7) in (let H11 \def (eq_ind T t (\lambda (t0: T).(eq T t0 (lift h (r +k n) x3))) H4 (lift h (r k n) x5) H7) in (let H12 \def (eq_ind T x5 (\lambda +(t0: T).(\forall (h0: nat).((drop h0 n (CHead c0 k (lift h (r k n) t0)) +(CHead x4 k t0)) \to (\forall (x6: C).((drop h0 n (CHead c0 k (lift h (r k n) +t0)) x6) \to (eq C (CHead x4 k t0) x6)))))) H10 x3 (lift_inj x5 x3 h (r k n) +H11)) in (eq_ind_r T x3 (\lambda (t0: T).(eq C (CHead x4 k t0) (CHead x0 k +x3))) (f_equal3 C K T C CHead x4 x0 k k x3 x3 (sym_eq C x0 x4 (H x0 (r k n) h +H5 x4 H8)) (refl_equal K k) (refl_equal T x3)) x5 (lift_inj x5 x3 h (r k n) +H11))))) x1 H6)) x2 H3)))))) (drop_gen_skip_l c0 x1 t h n k H1))))))) +(drop_gen_skip_l c0 x2 t h n k H2)))))))) d))))))) c). + +theorem drop_conf_lt: + \forall (k: K).(\forall (i: nat).(\forall (u: T).(\forall (c0: C).(\forall +(c: C).((drop i O c (CHead c0 k u)) \to (\forall (e: C).(\forall (h: +nat).(\forall (d: nat).((drop h (S (plus i d)) c e) \to (ex3_2 T C (\lambda +(v: T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop i O e (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: C).(drop +h (r k d) c0 e0))))))))))))) +\def + \lambda (k: K).(\lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (u: +T).(\forall (c0: C).(\forall (c: C).((drop n O c (CHead c0 k u)) \to (\forall +(e: C).(\forall (h: nat).(\forall (d: nat).((drop h (S (plus n d)) c e) \to +(ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) +(\lambda (v: T).(\lambda (e0: C).(drop n O e (CHead e0 k v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h (r k d) c0 e0))))))))))))) (\lambda (u: +T).(\lambda (c0: C).(\lambda (c: C).(\lambda (H: (drop O O c (CHead c0 k +u))).(\lambda (e: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H0: (drop +h (S (plus O d)) c e)).(let H1 \def (eq_ind C c (\lambda (c1: C).(drop h (S +(plus O d)) c1 e)) H0 (CHead c0 k u) (drop_gen_refl c (CHead c0 k u) H)) in +(ex3_2_ind C T (\lambda (e0: C).(\lambda (v: T).(eq C e (CHead e0 k v)))) +(\lambda (_: C).(\lambda (v: T).(eq T u (lift h (r k (plus O d)) v)))) +(\lambda (e0: C).(\lambda (_: T).(drop h (r k (plus O d)) c0 e0))) (ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: +T).(\lambda (e0: C).(drop O O e (CHead e0 k v)))) (\lambda (_: T).(\lambda +(e0: C).(drop h (r k d) c0 e0)))) (\lambda (x0: C).(\lambda (x1: T).(\lambda +(H2: (eq C e (CHead x0 k x1))).(\lambda (H3: (eq T u (lift h (r k (plus O d)) +x1))).(\lambda (H4: (drop h (r k (plus O d)) c0 x0)).(eq_ind_r C (CHead x0 k +x1) (\lambda (c1: C).(ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift +h (r k d) v)))) (\lambda (v: T).(\lambda (e0: C).(drop O O c1 (CHead e0 k +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h (r k d) c0 e0))))) (eq_ind_r T +(lift h (r k (plus O d)) x1) (\lambda (t: T).(ex3_2 T C (\lambda (v: +T).(\lambda (_: C).(eq T t (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop O O (CHead x0 k x1) (CHead e0 k v)))) (\lambda (_: T).(\lambda +(e0: C).(drop h (r k d) c0 e0))))) (ex3_2_intro T C (\lambda (v: T).(\lambda +(_: C).(eq T (lift h (r k (plus O d)) x1) (lift h (r k d) v)))) (\lambda (v: +T).(\lambda (e0: C).(drop O O (CHead x0 k x1) (CHead e0 k v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h (r k d) c0 e0))) x1 x0 (refl_equal T (lift h (r k +d) x1)) (drop_refl (CHead x0 k x1)) H4) u H3) e H2)))))) (drop_gen_skip_l c0 +e u h (plus O d) k H1))))))))))) (\lambda (i0: nat).(\lambda (H: ((\forall +(u: T).(\forall (c0: C).(\forall (c: C).((drop i0 O c (CHead c0 k u)) \to +(\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop h (S (plus i0 d)) +c e) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h (r k d) +v)))) (\lambda (v: T).(\lambda (e0: C).(drop i0 O e (CHead e0 k v)))) +(\lambda (_: T).(\lambda (e0: C).(drop h (r k d) c0 e0)))))))))))))).(\lambda +(u: T).(\lambda (c0: C).(\lambda (c: C).(C_ind (\lambda (c1: C).((drop (S i0) +O c1 (CHead c0 k u)) \to (\forall (e: C).(\forall (h: nat).(\forall (d: +nat).((drop h (S (plus (S i0) d)) c1 e) \to (ex3_2 T C (\lambda (v: +T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop (S i0) O e (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (r k d) c0 e0)))))))))) (\lambda (n: nat).(\lambda (_: (drop (S +i0) O (CSort n) (CHead c0 k u))).(\lambda (e: C).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (H1: (drop h (S (plus (S i0) d)) (CSort n) e)).(and3_ind +(eq C e (CSort n)) (eq nat h O) (eq nat (S (plus (S i0) d)) O) (ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: +T).(\lambda (e0: C).(drop (S i0) O e (CHead e0 k v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h (r k d) c0 e0)))) (\lambda (_: (eq C e (CSort +n))).(\lambda (_: (eq nat h O)).(\lambda (H4: (eq nat (S (plus (S i0) d)) +O)).(let H5 \def (eq_ind nat (S (plus (S i0) d)) (\lambda (ee: nat).(match ee +in nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H4) in (False_ind (ex3_2 T C (\lambda (v: T).(\lambda +(_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda (e0: C).(drop +(S i0) O e (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: C).(drop h (r k d) +c0 e0)))) H5))))) (drop_gen_sort n h (S (plus (S i0) d)) e H1)))))))) +(\lambda (c1: C).(\lambda (H0: (((drop (S i0) O c1 (CHead c0 k u)) \to +(\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop h (S (plus (S i0) +d)) c1 e) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h (r k +d) v)))) (\lambda (v: T).(\lambda (e0: C).(drop (S i0) O e (CHead e0 k v)))) +(\lambda (_: T).(\lambda (e0: C).(drop h (r k d) c0 e0))))))))))).(\lambda +(k0: K).(K_ind (\lambda (k1: K).(\forall (t: T).((drop (S i0) O (CHead c1 k1 +t) (CHead c0 k u)) \to (\forall (e: C).(\forall (h: nat).(\forall (d: +nat).((drop h (S (plus (S i0) d)) (CHead c1 k1 t) e) \to (ex3_2 T C (\lambda +(v: T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop (S i0) O e (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (r k d) c0 e0))))))))))) (\lambda (b: B).(\lambda (t: T).(\lambda +(H1: (drop (S i0) O (CHead c1 (Bind b) t) (CHead c0 k u))).(\lambda (e: +C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H2: (drop h (S (plus (S i0) +d)) (CHead c1 (Bind b) t) e)).(ex3_2_ind C T (\lambda (e0: C).(\lambda (v: +T).(eq C e (CHead e0 (Bind b) v)))) (\lambda (_: C).(\lambda (v: T).(eq T t +(lift h (r (Bind b) (plus (S i0) d)) v)))) (\lambda (e0: C).(\lambda (_: +T).(drop h (r (Bind b) (plus (S i0) d)) c1 e0))) (ex3_2 T C (\lambda (v: +T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop (S i0) O e (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (r k d) c0 e0)))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H3: +(eq C e (CHead x0 (Bind b) x1))).(\lambda (_: (eq T t (lift h (r (Bind b) +(plus (S i0) d)) x1))).(\lambda (H5: (drop h (r (Bind b) (plus (S i0) d)) c1 +x0)).(eq_ind_r C (CHead x0 (Bind b) x1) (\lambda (c2: C).(ex3_2 T C (\lambda +(v: T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop (S i0) O c2 (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (r k d) c0 e0))))) (let H6 \def (H u c0 c1 (drop_gen_drop (Bind b) +c1 (CHead c0 k u) t i0 H1) x0 h d H5) in (ex3_2_ind T C (\lambda (v: +T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop i0 O x0 (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (r k d) c0 e0))) (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T +u (lift h (r k d) v)))) (\lambda (v: T).(\lambda (e0: C).(drop (S i0) O +(CHead x0 (Bind b) x1) (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (r k d) c0 e0)))) (\lambda (x2: T).(\lambda (x3: C).(\lambda (H7: +(eq T u (lift h (r k d) x2))).(\lambda (H8: (drop i0 O x0 (CHead x3 k +x2))).(\lambda (H9: (drop h (r k d) c0 x3)).(ex3_2_intro T C (\lambda (v: +T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop (S i0) O (CHead x0 (Bind b) x1) (CHead e0 k v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h (r k d) c0 e0))) x2 x3 H7 (drop_drop (Bind b) i0 +x0 (CHead x3 k x2) H8 x1) H9)))))) H6)) e H3)))))) (drop_gen_skip_l c1 e t h +(plus (S i0) d) (Bind b) H2))))))))) (\lambda (f: F).(\lambda (t: T).(\lambda +(H1: (drop (S i0) O (CHead c1 (Flat f) t) (CHead c0 k u))).(\lambda (e: +C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H2: (drop h (S (plus (S i0) +d)) (CHead c1 (Flat f) t) e)).(ex3_2_ind C T (\lambda (e0: C).(\lambda (v: +T).(eq C e (CHead e0 (Flat f) v)))) (\lambda (_: C).(\lambda (v: T).(eq T t +(lift h (r (Flat f) (plus (S i0) d)) v)))) (\lambda (e0: C).(\lambda (_: +T).(drop h (r (Flat f) (plus (S i0) d)) c1 e0))) (ex3_2 T C (\lambda (v: +T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop (S i0) O e (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (r k d) c0 e0)))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H3: +(eq C e (CHead x0 (Flat f) x1))).(\lambda (_: (eq T t (lift h (r (Flat f) +(plus (S i0) d)) x1))).(\lambda (H5: (drop h (r (Flat f) (plus (S i0) d)) c1 +x0)).(eq_ind_r C (CHead x0 (Flat f) x1) (\lambda (c2: C).(ex3_2 T C (\lambda +(v: T).(\lambda (_: C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda +(e0: C).(drop (S i0) O c2 (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (r k d) c0 e0))))) (ex3_2_ind T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift h (r k d) v)))) (\lambda (v: T).(\lambda (e0: C).(drop (S +i0) O x0 (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: C).(drop h (r k d) +c0 e0))) (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h (r k d) +v)))) (\lambda (v: T).(\lambda (e0: C).(drop (S i0) O (CHead x0 (Flat f) x1) +(CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: C).(drop h (r k d) c0 e0)))) +(\lambda (x2: T).(\lambda (x3: C).(\lambda (H6: (eq T u (lift h (r k d) +x2))).(\lambda (H7: (drop (S i0) O x0 (CHead x3 k x2))).(\lambda (H8: (drop h +(r k d) c0 x3)).(ex3_2_intro T C (\lambda (v: T).(\lambda (_: C).(eq T u +(lift h (r k d) v)))) (\lambda (v: T).(\lambda (e0: C).(drop (S i0) O (CHead +x0 (Flat f) x1) (CHead e0 k v)))) (\lambda (_: T).(\lambda (e0: C).(drop h (r +k d) c0 e0))) x2 x3 H6 (drop_drop (Flat f) i0 x0 (CHead x3 k x2) H7 x1) +H8)))))) (H0 (drop_gen_drop (Flat f) c1 (CHead c0 k u) t i0 H1) x0 h d H5)) e +H3)))))) (drop_gen_skip_l c1 e t h (plus (S i0) d) (Flat f) H2))))))))) +k0)))) c)))))) i)). + +theorem drop_conf_ge: + \forall (i: nat).(\forall (a: C).(\forall (c: C).((drop i O c a) \to +(\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop h d c e) \to ((le +(plus d h) i) \to (drop (minus i h) O e a))))))))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (a: C).(\forall (c: +C).((drop n O c a) \to (\forall (e: C).(\forall (h: nat).(\forall (d: +nat).((drop h d c e) \to ((le (plus d h) n) \to (drop (minus n h) O e +a)))))))))) (\lambda (a: C).(\lambda (c: C).(\lambda (H: (drop O O c +a)).(\lambda (e: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H0: (drop h +d c e)).(\lambda (H1: (le (plus d h) O)).(let H2 \def (eq_ind C c (\lambda +(c0: C).(drop h d c0 e)) H0 a (drop_gen_refl c a H)) in (let H3 \def (match +H1 in le return (\lambda (n: nat).(\lambda (_: (le ? n)).((eq nat n O) \to +(drop (minus O h) O e a)))) with [le_n \Rightarrow (\lambda (H3: (eq nat +(plus d h) O)).(let H4 \def (f_equal nat nat (\lambda (e0: nat).e0) (plus d +h) O H3) in (eq_ind nat (plus d h) (\lambda (n: nat).(drop (minus n h) n e +a)) (eq_ind_r nat O (\lambda (n: nat).(drop (minus n h) n e a)) (and_ind (eq +nat d O) (eq nat h O) (drop O O e a) (\lambda (H5: (eq nat d O)).(\lambda +(H6: (eq nat h O)).(let H7 \def (eq_ind nat d (\lambda (n: nat).(drop h n a +e)) H2 O H5) in (let H8 \def (eq_ind nat h (\lambda (n: nat).(drop n O a e)) +H7 O H6) in (eq_ind C a (\lambda (c0: C).(drop O O c0 a)) (drop_refl a) e +(drop_gen_refl a e H8)))))) (plus_O d h H4)) (plus d h) H4) O H4))) | (le_S m +H3) \Rightarrow (\lambda (H4: (eq nat (S m) O)).((let H5 \def (eq_ind nat (S +m) (\lambda (e0: nat).(match e0 in nat return (\lambda (_: nat).Prop) with [O +\Rightarrow False | (S _) \Rightarrow True])) I O H4) in (False_ind ((le +(plus d h) m) \to (drop (minus O h) O e a)) H5)) H3))]) in (H3 (refl_equal +nat O)))))))))))) (\lambda (i0: nat).(\lambda (H: ((\forall (a: C).(\forall +(c: C).((drop i0 O c a) \to (\forall (e: C).(\forall (h: nat).(\forall (d: +nat).((drop h d c e) \to ((le (plus d h) i0) \to (drop (minus i0 h) O e +a))))))))))).(\lambda (a: C).(\lambda (c: C).(C_ind (\lambda (c0: C).((drop +(S i0) O c0 a) \to (\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop +h d c0 e) \to ((le (plus d h) (S i0)) \to (drop (minus (S i0) h) O e +a)))))))) (\lambda (n: nat).(\lambda (H0: (drop (S i0) O (CSort n) +a)).(\lambda (e: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H1: (drop h +d (CSort n) e)).(\lambda (H2: (le (plus d h) (S i0))).(and3_ind (eq C e +(CSort n)) (eq nat h O) (eq nat d O) (drop (minus (S i0) h) O e a) (\lambda +(H3: (eq C e (CSort n))).(\lambda (H4: (eq nat h O)).(\lambda (H5: (eq nat d +O)).(and3_ind (eq C a (CSort n)) (eq nat (S i0) O) (eq nat O O) (drop (minus +(S i0) h) O e a) (\lambda (H6: (eq C a (CSort n))).(\lambda (H7: (eq nat (S +i0) O)).(\lambda (_: (eq nat O O)).(let H9 \def (eq_ind nat d (\lambda (n0: +nat).(le (plus n0 h) (S i0))) H2 O H5) in (let H10 \def (eq_ind nat h +(\lambda (n0: nat).(le (plus O n0) (S i0))) H9 O H4) in (eq_ind_r nat O +(\lambda (n0: nat).(drop (minus (S i0) n0) O e a)) (eq_ind_r C (CSort n) +(\lambda (c0: C).(drop (minus (S i0) O) O c0 a)) (eq_ind_r C (CSort n) +(\lambda (c0: C).(drop (minus (S i0) O) O (CSort n) c0)) (let H11 \def +(eq_ind nat (S i0) (\lambda (ee: nat).(match ee in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H7) in +(False_ind (drop (minus (S i0) O) O (CSort n) (CSort n)) H11)) a H6) e H3) h +H4)))))) (drop_gen_sort n (S i0) O a H0))))) (drop_gen_sort n h d e +H1))))))))) (\lambda (c0: C).(\lambda (H0: (((drop (S i0) O c0 a) \to +(\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop h d c0 e) \to ((le +(plus d h) (S i0)) \to (drop (minus (S i0) h) O e a))))))))).(\lambda (k: +K).(K_ind (\lambda (k0: K).(\forall (t: T).((drop (S i0) O (CHead c0 k0 t) a) +\to (\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop h d (CHead c0 +k0 t) e) \to ((le (plus d h) (S i0)) \to (drop (minus (S i0) h) O e +a))))))))) (\lambda (b: B).(\lambda (t: T).(\lambda (H1: (drop (S i0) O +(CHead c0 (Bind b) t) a)).(\lambda (e: C).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H2: (drop h d (CHead c0 (Bind b) t) e)).(\lambda (H3: (le +(plus d h) (S i0))).(nat_ind (\lambda (n: nat).((drop h n (CHead c0 (Bind b) +t) e) \to ((le (plus n h) (S i0)) \to (drop (minus (S i0) h) O e a)))) +(\lambda (H4: (drop h O (CHead c0 (Bind b) t) e)).(\lambda (H5: (le (plus O +h) (S i0))).(nat_ind (\lambda (n: nat).((drop n O (CHead c0 (Bind b) t) e) +\to ((le (plus O n) (S i0)) \to (drop (minus (S i0) n) O e a)))) (\lambda +(H6: (drop O O (CHead c0 (Bind b) t) e)).(\lambda (_: (le (plus O O) (S +i0))).(eq_ind C (CHead c0 (Bind b) t) (\lambda (c1: C).(drop (minus (S i0) O) +O c1 a)) (drop_drop (Bind b) i0 c0 a (drop_gen_drop (Bind b) c0 a t i0 H1) t) +e (drop_gen_refl (CHead c0 (Bind b) t) e H6)))) (\lambda (h0: nat).(\lambda +(_: (((drop h0 O (CHead c0 (Bind b) t) e) \to ((le (plus O h0) (S i0)) \to +(drop (minus (S i0) h0) O e a))))).(\lambda (H6: (drop (S h0) O (CHead c0 +(Bind b) t) e)).(\lambda (H7: (le (plus O (S h0)) (S i0))).(H a c0 +(drop_gen_drop (Bind b) c0 a t i0 H1) e h0 O (drop_gen_drop (Bind b) c0 e t +h0 H6) (le_S_n (plus O h0) i0 H7)))))) h H4 H5))) (\lambda (d0: nat).(\lambda +(_: (((drop h d0 (CHead c0 (Bind b) t) e) \to ((le (plus d0 h) (S i0)) \to +(drop (minus (S i0) h) O e a))))).(\lambda (H4: (drop h (S d0) (CHead c0 +(Bind b) t) e)).(\lambda (H5: (le (plus (S d0) h) (S i0))).(ex3_2_ind C T +(\lambda (e0: C).(\lambda (v: T).(eq C e (CHead e0 (Bind b) v)))) (\lambda +(_: C).(\lambda (v: T).(eq T t (lift h (r (Bind b) d0) v)))) (\lambda (e0: +C).(\lambda (_: T).(drop h (r (Bind b) d0) c0 e0))) (drop (minus (S i0) h) O +e a) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H6: (eq C e (CHead x0 (Bind +b) x1))).(\lambda (_: (eq T t (lift h (r (Bind b) d0) x1))).(\lambda (H8: +(drop h (r (Bind b) d0) c0 x0)).(eq_ind_r C (CHead x0 (Bind b) x1) (\lambda +(c1: C).(drop (minus (S i0) h) O c1 a)) (eq_ind nat (S (minus i0 h)) (\lambda +(n: nat).(drop n O (CHead x0 (Bind b) x1) a)) (drop_drop (Bind b) (minus i0 +h) x0 a (H a c0 (drop_gen_drop (Bind b) c0 a t i0 H1) x0 h d0 H8 (le_S_n +(plus d0 h) i0 H5)) x1) (minus (S i0) h) (minus_Sn_m i0 h (le_trans_plus_r d0 +h i0 (le_S_n (plus d0 h) i0 H5)))) e H6)))))) (drop_gen_skip_l c0 e t h d0 +(Bind b) H4)))))) d H2 H3))))))))) (\lambda (f: F).(\lambda (t: T).(\lambda +(H1: (drop (S i0) O (CHead c0 (Flat f) t) a)).(\lambda (e: C).(\lambda (h: +nat).(\lambda (d: nat).(\lambda (H2: (drop h d (CHead c0 (Flat f) t) +e)).(\lambda (H3: (le (plus d h) (S i0))).(nat_ind (\lambda (n: nat).((drop h +n (CHead c0 (Flat f) t) e) \to ((le (plus n h) (S i0)) \to (drop (minus (S +i0) h) O e a)))) (\lambda (H4: (drop h O (CHead c0 (Flat f) t) e)).(\lambda +(H5: (le (plus O h) (S i0))).(nat_ind (\lambda (n: nat).((drop n O (CHead c0 +(Flat f) t) e) \to ((le (plus O n) (S i0)) \to (drop (minus (S i0) n) O e +a)))) (\lambda (H6: (drop O O (CHead c0 (Flat f) t) e)).(\lambda (_: (le +(plus O O) (S i0))).(eq_ind C (CHead c0 (Flat f) t) (\lambda (c1: C).(drop +(minus (S i0) O) O c1 a)) (drop_drop (Flat f) i0 c0 a (drop_gen_drop (Flat f) +c0 a t i0 H1) t) e (drop_gen_refl (CHead c0 (Flat f) t) e H6)))) (\lambda +(h0: nat).(\lambda (_: (((drop h0 O (CHead c0 (Flat f) t) e) \to ((le (plus O +h0) (S i0)) \to (drop (minus (S i0) h0) O e a))))).(\lambda (H6: (drop (S h0) +O (CHead c0 (Flat f) t) e)).(\lambda (H7: (le (plus O (S h0)) (S i0))).(H0 +(drop_gen_drop (Flat f) c0 a t i0 H1) e (S h0) O (drop_gen_drop (Flat f) c0 e +t h0 H6) H7))))) h H4 H5))) (\lambda (d0: nat).(\lambda (_: (((drop h d0 +(CHead c0 (Flat f) t) e) \to ((le (plus d0 h) (S i0)) \to (drop (minus (S i0) +h) O e a))))).(\lambda (H4: (drop h (S d0) (CHead c0 (Flat f) t) e)).(\lambda +(H5: (le (plus (S d0) h) (S i0))).(ex3_2_ind C T (\lambda (e0: C).(\lambda +(v: T).(eq C e (CHead e0 (Flat f) v)))) (\lambda (_: C).(\lambda (v: T).(eq T +t (lift h (r (Flat f) d0) v)))) (\lambda (e0: C).(\lambda (_: T).(drop h (r +(Flat f) d0) c0 e0))) (drop (minus (S i0) h) O e a) (\lambda (x0: C).(\lambda +(x1: T).(\lambda (H6: (eq C e (CHead x0 (Flat f) x1))).(\lambda (_: (eq T t +(lift h (r (Flat f) d0) x1))).(\lambda (H8: (drop h (r (Flat f) d0) c0 +x0)).(eq_ind_r C (CHead x0 (Flat f) x1) (\lambda (c1: C).(drop (minus (S i0) +h) O c1 a)) (let H9 \def (eq_ind_r nat (minus (S i0) h) (\lambda (n: +nat).(drop n O x0 a)) (H0 (drop_gen_drop (Flat f) c0 a t i0 H1) x0 h (S d0) +H8 H5) (S (minus i0 h)) (minus_Sn_m i0 h (le_trans_plus_r d0 h i0 (le_S_n +(plus d0 h) i0 H5)))) in (eq_ind nat (S (minus i0 h)) (\lambda (n: nat).(drop +n O (CHead x0 (Flat f) x1) a)) (drop_drop (Flat f) (minus i0 h) x0 a H9 x1) +(minus (S i0) h) (minus_Sn_m i0 h (le_trans_plus_r d0 h i0 (le_S_n (plus d0 +h) i0 H5))))) e H6)))))) (drop_gen_skip_l c0 e t h d0 (Flat f) H4)))))) d H2 +H3))))))))) k)))) c))))) i). + +theorem drop_conf_rev: + \forall (j: nat).(\forall (e1: C).(\forall (e2: C).((drop j O e1 e2) \to +(\forall (c2: C).(\forall (i: nat).((drop i O c2 e2) \to (ex2 C (\lambda (c1: +C).(drop j O c1 c2)) (\lambda (c1: C).(drop i j c1 e1))))))))) +\def + \lambda (j: nat).(nat_ind (\lambda (n: nat).(\forall (e1: C).(\forall (e2: +C).((drop n O e1 e2) \to (\forall (c2: C).(\forall (i: nat).((drop i O c2 e2) +\to (ex2 C (\lambda (c1: C).(drop n O c1 c2)) (\lambda (c1: C).(drop i n c1 +e1)))))))))) (\lambda (e1: C).(\lambda (e2: C).(\lambda (H: (drop O O e1 +e2)).(\lambda (c2: C).(\lambda (i: nat).(\lambda (H0: (drop i O c2 e2)).(let +H1 \def (eq_ind_r C e2 (\lambda (c: C).(drop i O c2 c)) H0 e1 (drop_gen_refl +e1 e2 H)) in (ex_intro2 C (\lambda (c1: C).(drop O O c1 c2)) (\lambda (c1: +C).(drop i O c1 e1)) c2 (drop_refl c2) H1)))))))) (\lambda (j0: nat).(\lambda +(IHj: ((\forall (e1: C).(\forall (e2: C).((drop j0 O e1 e2) \to (\forall (c2: +C).(\forall (i: nat).((drop i O c2 e2) \to (ex2 C (\lambda (c1: C).(drop j0 O +c1 c2)) (\lambda (c1: C).(drop i j0 c1 e1))))))))))).(\lambda (e1: C).(C_ind +(\lambda (c: C).(\forall (e2: C).((drop (S j0) O c e2) \to (\forall (c2: +C).(\forall (i: nat).((drop i O c2 e2) \to (ex2 C (\lambda (c1: C).(drop (S +j0) O c1 c2)) (\lambda (c1: C).(drop i (S j0) c1 c))))))))) (\lambda (n: +nat).(\lambda (e2: C).(\lambda (H: (drop (S j0) O (CSort n) e2)).(\lambda +(c2: C).(\lambda (i: nat).(\lambda (H0: (drop i O c2 e2)).(and3_ind (eq C e2 +(CSort n)) (eq nat (S j0) O) (eq nat O O) (ex2 C (\lambda (c1: C).(drop (S +j0) O c1 c2)) (\lambda (c1: C).(drop i (S j0) c1 (CSort n)))) (\lambda (H1: +(eq C e2 (CSort n))).(\lambda (H2: (eq nat (S j0) O)).(\lambda (_: (eq nat O +O)).(let H4 \def (eq_ind C e2 (\lambda (c: C).(drop i O c2 c)) H0 (CSort n) +H1) in (let H5 \def (eq_ind nat (S j0) (\lambda (ee: nat).(match ee in nat +return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow +True])) I O H2) in (False_ind (ex2 C (\lambda (c1: C).(drop (S j0) O c1 c2)) +(\lambda (c1: C).(drop i (S j0) c1 (CSort n)))) H5)))))) (drop_gen_sort n (S +j0) O e2 H)))))))) (\lambda (e2: C).(\lambda (IHe1: ((\forall (e3: C).((drop +(S j0) O e2 e3) \to (\forall (c2: C).(\forall (i: nat).((drop i O c2 e3) \to +(ex2 C (\lambda (c1: C).(drop (S j0) O c1 c2)) (\lambda (c1: C).(drop i (S +j0) c1 e2)))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (e3: C).(\lambda +(H: (drop (S j0) O (CHead e2 k t) e3)).(\lambda (c2: C).(\lambda (i: +nat).(\lambda (H0: (drop i O c2 e3)).(K_ind (\lambda (k0: K).((drop (r k0 j0) +O e2 e3) \to (ex2 C (\lambda (c1: C).(drop (S j0) O c1 c2)) (\lambda (c1: +C).(drop i (S j0) c1 (CHead e2 k0 t)))))) (\lambda (b: B).(\lambda (H1: (drop +(r (Bind b) j0) O e2 e3)).(let H_x \def (IHj e2 e3 H1 c2 i H0) in (let H2 +\def H_x in (ex2_ind C (\lambda (c1: C).(drop j0 O c1 c2)) (\lambda (c1: +C).(drop i j0 c1 e2)) (ex2 C (\lambda (c1: C).(drop (S j0) O c1 c2)) (\lambda +(c1: C).(drop i (S j0) c1 (CHead e2 (Bind b) t)))) (\lambda (x: C).(\lambda +(H3: (drop j0 O x c2)).(\lambda (H4: (drop i j0 x e2)).(ex_intro2 C (\lambda +(c1: C).(drop (S j0) O c1 c2)) (\lambda (c1: C).(drop i (S j0) c1 (CHead e2 +(Bind b) t))) (CHead x (Bind b) (lift i (r (Bind b) j0) t)) (drop_drop (Bind +b) j0 x c2 H3 (lift i (r (Bind b) j0) t)) (drop_skip (Bind b) i j0 x e2 H4 +t))))) H2))))) (\lambda (f: F).(\lambda (H1: (drop (r (Flat f) j0) O e2 +e3)).(let H_x \def (IHe1 e3 H1 c2 i H0) in (let H2 \def H_x in (ex2_ind C +(\lambda (c1: C).(drop (S j0) O c1 c2)) (\lambda (c1: C).(drop i (S j0) c1 +e2)) (ex2 C (\lambda (c1: C).(drop (S j0) O c1 c2)) (\lambda (c1: C).(drop i +(S j0) c1 (CHead e2 (Flat f) t)))) (\lambda (x: C).(\lambda (H3: (drop (S j0) +O x c2)).(\lambda (H4: (drop i (S j0) x e2)).(ex_intro2 C (\lambda (c1: +C).(drop (S j0) O c1 c2)) (\lambda (c1: C).(drop i (S j0) c1 (CHead e2 (Flat +f) t))) (CHead x (Flat f) (lift i (r (Flat f) j0) t)) (drop_drop (Flat f) j0 +x c2 H3 (lift i (r (Flat f) j0) t)) (drop_skip (Flat f) i j0 x e2 H4 t))))) +H2))))) k (drop_gen_drop k e2 e3 t j0 H))))))))))) e1)))) j). + +theorem drop_trans_le: + \forall (i: nat).(\forall (d: nat).((le i d) \to (\forall (c1: C).(\forall +(c2: C).(\forall (h: nat).((drop h d c1 c2) \to (\forall (e2: C).((drop i O +c2 e2) \to (ex2 C (\lambda (e1: C).(drop i O c1 e1)) (\lambda (e1: C).(drop h +(minus d i) e1 e2))))))))))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (d: nat).((le n d) \to +(\forall (c1: C).(\forall (c2: C).(\forall (h: nat).((drop h d c1 c2) \to +(\forall (e2: C).((drop n O c2 e2) \to (ex2 C (\lambda (e1: C).(drop n O c1 +e1)) (\lambda (e1: C).(drop h (minus d n) e1 e2)))))))))))) (\lambda (d: +nat).(\lambda (_: (le O d)).(\lambda (c1: C).(\lambda (c2: C).(\lambda (h: +nat).(\lambda (H0: (drop h d c1 c2)).(\lambda (e2: C).(\lambda (H1: (drop O O +c2 e2)).(let H2 \def (eq_ind C c2 (\lambda (c: C).(drop h d c1 c)) H0 e2 +(drop_gen_refl c2 e2 H1)) in (eq_ind nat d (\lambda (n: nat).(ex2 C (\lambda +(e1: C).(drop O O c1 e1)) (\lambda (e1: C).(drop h n e1 e2)))) (ex_intro2 C +(\lambda (e1: C).(drop O O c1 e1)) (\lambda (e1: C).(drop h d e1 e2)) c1 +(drop_refl c1) H2) (minus d O) (minus_n_O d))))))))))) (\lambda (i0: +nat).(\lambda (IHi: ((\forall (d: nat).((le i0 d) \to (\forall (c1: +C).(\forall (c2: C).(\forall (h: nat).((drop h d c1 c2) \to (\forall (e2: +C).((drop i0 O c2 e2) \to (ex2 C (\lambda (e1: C).(drop i0 O c1 e1)) (\lambda +(e1: C).(drop h (minus d i0) e1 e2))))))))))))).(\lambda (d: nat).(nat_ind +(\lambda (n: nat).((le (S i0) n) \to (\forall (c1: C).(\forall (c2: +C).(\forall (h: nat).((drop h n c1 c2) \to (\forall (e2: C).((drop (S i0) O +c2 e2) \to (ex2 C (\lambda (e1: C).(drop (S i0) O c1 e1)) (\lambda (e1: +C).(drop h (minus n (S i0)) e1 e2))))))))))) (\lambda (H: (le (S i0) +O)).(\lambda (c1: C).(\lambda (c2: C).(\lambda (h: nat).(\lambda (_: (drop h +O c1 c2)).(\lambda (e2: C).(\lambda (_: (drop (S i0) O c2 e2)).(let H2 \def +(match H in le return (\lambda (n: nat).(\lambda (_: (le ? n)).((eq nat n O) +\to (ex2 C (\lambda (e1: C).(drop (S i0) O c1 e1)) (\lambda (e1: C).(drop h +(minus O (S i0)) e1 e2)))))) with [le_n \Rightarrow (\lambda (H2: (eq nat (S +i0) O)).(let H3 \def (eq_ind nat (S i0) (\lambda (e: nat).(match e in nat +return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow +True])) I O H2) in (False_ind (ex2 C (\lambda (e1: C).(drop (S i0) O c1 e1)) +(\lambda (e1: C).(drop h (minus O (S i0)) e1 e2))) H3))) | (le_S m H2) +\Rightarrow (\lambda (H3: (eq nat (S m) O)).((let H4 \def (eq_ind nat (S m) +(\lambda (e: nat).(match e in nat return (\lambda (_: nat).Prop) with [O +\Rightarrow False | (S _) \Rightarrow True])) I O H3) in (False_ind ((le (S +i0) m) \to (ex2 C (\lambda (e1: C).(drop (S i0) O c1 e1)) (\lambda (e1: +C).(drop h (minus O (S i0)) e1 e2)))) H4)) H2))]) in (H2 (refl_equal nat +O)))))))))) (\lambda (d0: nat).(\lambda (_: (((le (S i0) d0) \to (\forall +(c1: C).(\forall (c2: C).(\forall (h: nat).((drop h d0 c1 c2) \to (\forall +(e2: C).((drop (S i0) O c2 e2) \to (ex2 C (\lambda (e1: C).(drop (S i0) O c1 +e1)) (\lambda (e1: C).(drop h (minus d0 (S i0)) e1 e2)))))))))))).(\lambda +(H: (le (S i0) (S d0))).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: +C).(\forall (h: nat).((drop h (S d0) c c2) \to (\forall (e2: C).((drop (S i0) +O c2 e2) \to (ex2 C (\lambda (e1: C).(drop (S i0) O c e1)) (\lambda (e1: +C).(drop h (minus (S d0) (S i0)) e1 e2))))))))) (\lambda (n: nat).(\lambda +(c2: C).(\lambda (h: nat).(\lambda (H0: (drop h (S d0) (CSort n) +c2)).(\lambda (e2: C).(\lambda (H1: (drop (S i0) O c2 e2)).(and3_ind (eq C c2 +(CSort n)) (eq nat h O) (eq nat (S d0) O) (ex2 C (\lambda (e1: C).(drop (S +i0) O (CSort n) e1)) (\lambda (e1: C).(drop h (minus (S d0) (S i0)) e1 e2))) +(\lambda (H2: (eq C c2 (CSort n))).(\lambda (_: (eq nat h O)).(\lambda (_: +(eq nat (S d0) O)).(let H5 \def (eq_ind C c2 (\lambda (c: C).(drop (S i0) O c +e2)) H1 (CSort n) H2) in (and3_ind (eq C e2 (CSort n)) (eq nat (S i0) O) (eq +nat O O) (ex2 C (\lambda (e1: C).(drop (S i0) O (CSort n) e1)) (\lambda (e1: +C).(drop h (minus (S d0) (S i0)) e1 e2))) (\lambda (H6: (eq C e2 (CSort +n))).(\lambda (H7: (eq nat (S i0) O)).(\lambda (_: (eq nat O O)).(eq_ind_r C +(CSort n) (\lambda (c: C).(ex2 C (\lambda (e1: C).(drop (S i0) O (CSort n) +e1)) (\lambda (e1: C).(drop h (minus (S d0) (S i0)) e1 c)))) (let H9 \def +(eq_ind nat (S i0) (\lambda (ee: nat).(match ee in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True])) I O H7) in +(False_ind (ex2 C (\lambda (e1: C).(drop (S i0) O (CSort n) e1)) (\lambda +(e1: C).(drop h (minus (S d0) (S i0)) e1 (CSort n)))) H9)) e2 H6)))) +(drop_gen_sort n (S i0) O e2 H5)))))) (drop_gen_sort n h (S d0) c2 H0)))))))) +(\lambda (c2: C).(\lambda (IHc: ((\forall (c3: C).(\forall (h: nat).((drop h +(S d0) c2 c3) \to (\forall (e2: C).((drop (S i0) O c3 e2) \to (ex2 C (\lambda +(e1: C).(drop (S i0) O c2 e1)) (\lambda (e1: C).(drop h (minus (S d0) (S i0)) +e1 e2)))))))))).(\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (t: +T).(\forall (c3: C).(\forall (h: nat).((drop h (S d0) (CHead c2 k0 t) c3) \to +(\forall (e2: C).((drop (S i0) O c3 e2) \to (ex2 C (\lambda (e1: C).(drop (S +i0) O (CHead c2 k0 t) e1)) (\lambda (e1: C).(drop h (minus (S d0) (S i0)) e1 +e2)))))))))) (\lambda (b: B).(\lambda (t: T).(\lambda (c3: C).(\lambda (h: +nat).(\lambda (H0: (drop h (S d0) (CHead c2 (Bind b) t) c3)).(\lambda (e2: +C).(\lambda (H1: (drop (S i0) O c3 e2)).(ex3_2_ind C T (\lambda (e: +C).(\lambda (v: T).(eq C c3 (CHead e (Bind b) v)))) (\lambda (_: C).(\lambda +(v: T).(eq T t (lift h (r (Bind b) d0) v)))) (\lambda (e: C).(\lambda (_: +T).(drop h (r (Bind b) d0) c2 e))) (ex2 C (\lambda (e1: C).(drop (S i0) O +(CHead c2 (Bind b) t) e1)) (\lambda (e1: C).(drop h (minus (S d0) (S i0)) e1 +e2))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H2: (eq C c3 (CHead x0 +(Bind b) x1))).(\lambda (H3: (eq T t (lift h (r (Bind b) d0) x1))).(\lambda +(H4: (drop h (r (Bind b) d0) c2 x0)).(let H5 \def (eq_ind C c3 (\lambda (c: +C).(drop (S i0) O c e2)) H1 (CHead x0 (Bind b) x1) H2) in (eq_ind_r T (lift h +(r (Bind b) d0) x1) (\lambda (t0: T).(ex2 C (\lambda (e1: C).(drop (S i0) O +(CHead c2 (Bind b) t0) e1)) (\lambda (e1: C).(drop h (minus (S d0) (S i0)) e1 +e2)))) (ex2_ind C (\lambda (e1: C).(drop i0 O c2 e1)) (\lambda (e1: C).(drop +h (minus d0 i0) e1 e2)) (ex2 C (\lambda (e1: C).(drop (S i0) O (CHead c2 +(Bind b) (lift h (r (Bind b) d0) x1)) e1)) (\lambda (e1: C).(drop h (minus (S +d0) (S i0)) e1 e2))) (\lambda (x: C).(\lambda (H6: (drop i0 O c2 x)).(\lambda +(H7: (drop h (minus d0 i0) x e2)).(ex_intro2 C (\lambda (e1: C).(drop (S i0) +O (CHead c2 (Bind b) (lift h (r (Bind b) d0) x1)) e1)) (\lambda (e1: C).(drop +h (minus (S d0) (S i0)) e1 e2)) x (drop_drop (Bind b) i0 c2 x H6 (lift h (r +(Bind b) d0) x1)) H7)))) (IHi d0 (le_S_n i0 d0 H) c2 x0 h H4 e2 +(drop_gen_drop (Bind b) x0 e2 x1 i0 H5))) t H3))))))) (drop_gen_skip_l c2 c3 +t h d0 (Bind b) H0))))))))) (\lambda (f: F).(\lambda (t: T).(\lambda (c3: +C).(\lambda (h: nat).(\lambda (H0: (drop h (S d0) (CHead c2 (Flat f) t) +c3)).(\lambda (e2: C).(\lambda (H1: (drop (S i0) O c3 e2)).(ex3_2_ind C T +(\lambda (e: C).(\lambda (v: T).(eq C c3 (CHead e (Flat f) v)))) (\lambda (_: +C).(\lambda (v: T).(eq T t (lift h (r (Flat f) d0) v)))) (\lambda (e: +C).(\lambda (_: T).(drop h (r (Flat f) d0) c2 e))) (ex2 C (\lambda (e1: +C).(drop (S i0) O (CHead c2 (Flat f) t) e1)) (\lambda (e1: C).(drop h (minus +(S d0) (S i0)) e1 e2))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H2: (eq C +c3 (CHead x0 (Flat f) x1))).(\lambda (H3: (eq T t (lift h (r (Flat f) d0) +x1))).(\lambda (H4: (drop h (r (Flat f) d0) c2 x0)).(let H5 \def (eq_ind C c3 +(\lambda (c: C).(drop (S i0) O c e2)) H1 (CHead x0 (Flat f) x1) H2) in +(eq_ind_r T (lift h (r (Flat f) d0) x1) (\lambda (t0: T).(ex2 C (\lambda (e1: +C).(drop (S i0) O (CHead c2 (Flat f) t0) e1)) (\lambda (e1: C).(drop h (minus +(S d0) (S i0)) e1 e2)))) (ex2_ind C (\lambda (e1: C).(drop (S i0) O c2 e1)) +(\lambda (e1: C).(drop h (minus (S d0) (S i0)) e1 e2)) (ex2 C (\lambda (e1: +C).(drop (S i0) O (CHead c2 (Flat f) (lift h (r (Flat f) d0) x1)) e1)) +(\lambda (e1: C).(drop h (minus (S d0) (S i0)) e1 e2))) (\lambda (x: +C).(\lambda (H6: (drop (S i0) O c2 x)).(\lambda (H7: (drop h (minus (S d0) (S +i0)) x e2)).(ex_intro2 C (\lambda (e1: C).(drop (S i0) O (CHead c2 (Flat f) +(lift h (r (Flat f) d0) x1)) e1)) (\lambda (e1: C).(drop h (minus (S d0) (S +i0)) e1 e2)) x (drop_drop (Flat f) i0 c2 x H6 (lift h (r (Flat f) d0) x1)) +H7)))) (IHc x0 h H4 e2 (drop_gen_drop (Flat f) x0 e2 x1 i0 H5))) t H3))))))) +(drop_gen_skip_l c2 c3 t h d0 (Flat f) H0))))))))) k)))) c1))))) d)))) i). + +theorem drop_trans_ge: + \forall (i: nat).(\forall (c1: C).(\forall (c2: C).(\forall (d: +nat).(\forall (h: nat).((drop h d c1 c2) \to (\forall (e2: C).((drop i O c2 +e2) \to ((le d i) \to (drop (plus i h) O c1 e2))))))))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (c1: C).(\forall (c2: +C).(\forall (d: nat).(\forall (h: nat).((drop h d c1 c2) \to (\forall (e2: +C).((drop n O c2 e2) \to ((le d n) \to (drop (plus n h) O c1 e2)))))))))) +(\lambda (c1: C).(\lambda (c2: C).(\lambda (d: nat).(\lambda (h: +nat).(\lambda (H: (drop h d c1 c2)).(\lambda (e2: C).(\lambda (H0: (drop O O +c2 e2)).(\lambda (H1: (le d O)).(eq_ind C c2 (\lambda (c: C).(drop (plus O h) +O c1 c)) (let H2 \def (match H1 in le return (\lambda (n: nat).(\lambda (_: +(le ? n)).((eq nat n O) \to (drop (plus O h) O c1 c2)))) with [le_n +\Rightarrow (\lambda (H2: (eq nat d O)).(eq_ind nat O (\lambda (_: nat).(drop +(plus O h) O c1 c2)) (let H3 \def (eq_ind nat d (\lambda (n: nat).(le n O)) +H1 O H2) in (let H4 \def (eq_ind nat d (\lambda (n: nat).(drop h n c1 c2)) H +O H2) in H4)) d (sym_eq nat d O H2))) | (le_S m H2) \Rightarrow (\lambda (H3: +(eq nat (S m) O)).((let H4 \def (eq_ind nat (S m) (\lambda (e: nat).(match e +in nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H3) in (False_ind ((le d m) \to (drop (plus O h) O c1 +c2)) H4)) H2))]) in (H2 (refl_equal nat O))) e2 (drop_gen_refl c2 e2 +H0)))))))))) (\lambda (i0: nat).(\lambda (IHi: ((\forall (c1: C).(\forall +(c2: C).(\forall (d: nat).(\forall (h: nat).((drop h d c1 c2) \to (\forall +(e2: C).((drop i0 O c2 e2) \to ((le d i0) \to (drop (plus i0 h) O c1 +e2))))))))))).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: +C).(\forall (d: nat).(\forall (h: nat).((drop h d c c2) \to (\forall (e2: +C).((drop (S i0) O c2 e2) \to ((le d (S i0)) \to (drop (plus (S i0) h) O c +e2))))))))) (\lambda (n: nat).(\lambda (c2: C).(\lambda (d: nat).(\lambda (h: +nat).(\lambda (H: (drop h d (CSort n) c2)).(\lambda (e2: C).(\lambda (H0: +(drop (S i0) O c2 e2)).(\lambda (H1: (le d (S i0))).(and3_ind (eq C c2 (CSort +n)) (eq nat h O) (eq nat d O) (drop (S (plus i0 h)) O (CSort n) e2) (\lambda +(H2: (eq C c2 (CSort n))).(\lambda (H3: (eq nat h O)).(\lambda (H4: (eq nat d +O)).(eq_ind_r nat O (\lambda (n0: nat).(drop (S (plus i0 n0)) O (CSort n) +e2)) (let H5 \def (eq_ind nat d (\lambda (n0: nat).(le n0 (S i0))) H1 O H4) +in (let H6 \def (eq_ind C c2 (\lambda (c: C).(drop (S i0) O c e2)) H0 (CSort +n) H2) in (and3_ind (eq C e2 (CSort n)) (eq nat (S i0) O) (eq nat O O) (drop +(S (plus i0 O)) O (CSort n) e2) (\lambda (H7: (eq C e2 (CSort n))).(\lambda +(H8: (eq nat (S i0) O)).(\lambda (_: (eq nat O O)).(eq_ind_r C (CSort n) +(\lambda (c: C).(drop (S (plus i0 O)) O (CSort n) c)) (let H10 \def (eq_ind +nat (S i0) (\lambda (ee: nat).(match ee in nat return (\lambda (_: nat).Prop) +with [O \Rightarrow False | (S _) \Rightarrow True])) I O H8) in (False_ind +(drop (S (plus i0 O)) O (CSort n) (CSort n)) H10)) e2 H7)))) (drop_gen_sort n +(S i0) O e2 H6)))) h H3)))) (drop_gen_sort n h d c2 H)))))))))) (\lambda (c2: +C).(\lambda (IHc: ((\forall (c3: C).(\forall (d: nat).(\forall (h: +nat).((drop h d c2 c3) \to (\forall (e2: C).((drop (S i0) O c3 e2) \to ((le d +(S i0)) \to (drop (S (plus i0 h)) O c2 e2)))))))))).(\lambda (k: K).(\lambda +(t: T).(\lambda (c3: C).(\lambda (d: nat).(nat_ind (\lambda (n: nat).(\forall +(h: nat).((drop h n (CHead c2 k t) c3) \to (\forall (e2: C).((drop (S i0) O +c3 e2) \to ((le n (S i0)) \to (drop (S (plus i0 h)) O (CHead c2 k t) +e2))))))) (\lambda (h: nat).(nat_ind (\lambda (n: nat).((drop n O (CHead c2 k +t) c3) \to (\forall (e2: C).((drop (S i0) O c3 e2) \to ((le O (S i0)) \to +(drop (S (plus i0 n)) O (CHead c2 k t) e2)))))) (\lambda (H: (drop O O (CHead +c2 k t) c3)).(\lambda (e2: C).(\lambda (H0: (drop (S i0) O c3 e2)).(\lambda +(_: (le O (S i0))).(let H2 \def (eq_ind_r C c3 (\lambda (c: C).(drop (S i0) O +c e2)) H0 (CHead c2 k t) (drop_gen_refl (CHead c2 k t) c3 H)) in (eq_ind nat +i0 (\lambda (n: nat).(drop (S n) O (CHead c2 k t) e2)) (drop_drop k i0 c2 e2 +(drop_gen_drop k c2 e2 t i0 H2) t) (plus i0 O) (plus_n_O i0))))))) (\lambda +(n: nat).(\lambda (_: (((drop n O (CHead c2 k t) c3) \to (\forall (e2: +C).((drop (S i0) O c3 e2) \to ((le O (S i0)) \to (drop (S (plus i0 n)) O +(CHead c2 k t) e2))))))).(\lambda (H0: (drop (S n) O (CHead c2 k t) +c3)).(\lambda (e2: C).(\lambda (H1: (drop (S i0) O c3 e2)).(\lambda (H2: (le +O (S i0))).(eq_ind nat (S (plus i0 n)) (\lambda (n0: nat).(drop (S n0) O +(CHead c2 k t) e2)) (drop_drop k (S (plus i0 n)) c2 e2 (eq_ind_r nat (S (r k +(plus i0 n))) (\lambda (n0: nat).(drop n0 O c2 e2)) (eq_ind_r nat (plus i0 (r +k n)) (\lambda (n0: nat).(drop (S n0) O c2 e2)) (IHc c3 O (r k n) +(drop_gen_drop k c2 c3 t n H0) e2 H1 H2) (r k (plus i0 n)) (r_plus_sym k i0 +n)) (r k (S (plus i0 n))) (r_S k (plus i0 n))) t) (plus i0 (S n)) (plus_n_Sm +i0 n)))))))) h)) (\lambda (d0: nat).(\lambda (IHd: ((\forall (h: nat).((drop +h d0 (CHead c2 k t) c3) \to (\forall (e2: C).((drop (S i0) O c3 e2) \to ((le +d0 (S i0)) \to (drop (S (plus i0 h)) O (CHead c2 k t) e2)))))))).(\lambda (h: +nat).(\lambda (H: (drop h (S d0) (CHead c2 k t) c3)).(\lambda (e2: +C).(\lambda (H0: (drop (S i0) O c3 e2)).(\lambda (H1: (le (S d0) (S +i0))).(ex3_2_ind C T (\lambda (e: C).(\lambda (v: T).(eq C c3 (CHead e k +v)))) (\lambda (_: C).(\lambda (v: T).(eq T t (lift h (r k d0) v)))) (\lambda +(e: C).(\lambda (_: T).(drop h (r k d0) c2 e))) (drop (S (plus i0 h)) O +(CHead c2 k t) e2) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H2: (eq C c3 +(CHead x0 k x1))).(\lambda (H3: (eq T t (lift h (r k d0) x1))).(\lambda (H4: +(drop h (r k d0) c2 x0)).(let H5 \def (eq_ind C c3 (\lambda (c: C).(\forall +(h0: nat).((drop h0 d0 (CHead c2 k t) c) \to (\forall (e3: C).((drop (S i0) O +c e3) \to ((le d0 (S i0)) \to (drop (S (plus i0 h0)) O (CHead c2 k t) +e3))))))) IHd (CHead x0 k x1) H2) in (let H6 \def (eq_ind C c3 (\lambda (c: +C).(drop (S i0) O c e2)) H0 (CHead x0 k x1) H2) in (let H7 \def (eq_ind T t +(\lambda (t0: T).(\forall (h0: nat).((drop h0 d0 (CHead c2 k t0) (CHead x0 k +x1)) \to (\forall (e3: C).((drop (S i0) O (CHead x0 k x1) e3) \to ((le d0 (S +i0)) \to (drop (S (plus i0 h0)) O (CHead c2 k t0) e3))))))) H5 (lift h (r k +d0) x1) H3) in (eq_ind_r T (lift h (r k d0) x1) (\lambda (t0: T).(drop (S +(plus i0 h)) O (CHead c2 k t0) e2)) (drop_drop k (plus i0 h) c2 e2 (K_ind +(\lambda (k0: K).((drop h (r k0 d0) c2 x0) \to ((drop (r k0 i0) O x0 e2) \to +(drop (r k0 (plus i0 h)) O c2 e2)))) (\lambda (b: B).(\lambda (H8: (drop h (r +(Bind b) d0) c2 x0)).(\lambda (H9: (drop (r (Bind b) i0) O x0 e2)).(IHi c2 x0 +(r (Bind b) d0) h H8 e2 H9 (le_S_n (r (Bind b) d0) i0 H1))))) (\lambda (f: +F).(\lambda (H8: (drop h (r (Flat f) d0) c2 x0)).(\lambda (H9: (drop (r (Flat +f) i0) O x0 e2)).(IHc x0 (r (Flat f) d0) h H8 e2 H9 H1)))) k H4 +(drop_gen_drop k x0 e2 x1 i0 H6)) (lift h (r k d0) x1)) t H3))))))))) +(drop_gen_skip_l c2 c3 t h d0 k H))))))))) d))))))) c1)))) i). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/defs.ma new file mode 100644 index 000000000..dea03ca70 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/defs.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/drop1/defs". + +include "drop/defs.ma". + +include "lift1/defs.ma". + +inductive drop1: PList \to (C \to (C \to Prop)) \def +| drop1_nil: \forall (c: C).(drop1 PNil c c) +| drop1_cons: \forall (c1: C).(\forall (c2: C).(\forall (h: nat).(\forall (d: +nat).((drop h d c1 c2) \to (\forall (c3: C).(\forall (hds: PList).((drop1 hds +c2 c3) \to (drop1 (PCons h d hds) c1 c3)))))))). + +definition ptrans: + PList \to (nat \to PList) +\def + let rec ptrans (hds: PList) on hds: (nat \to PList) \def (\lambda (i: +nat).(match hds with [PNil \Rightarrow PNil | (PCons h d hds0) \Rightarrow +(let j \def (trans hds0 i) in (let q \def (ptrans hds0 i) in (match (blt j d) +with [true \Rightarrow (PCons h (minus d (S j)) q) | false \Rightarrow +q])))])) in ptrans. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/getl.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/getl.ma new file mode 100644 index 000000000..f8ec287e3 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/getl.ma @@ -0,0 +1,195 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/drop1/getl". + +include "drop1/defs.ma". + +include "getl/drop.ma". + +theorem drop1_getl_trans: + \forall (hds: PList).(\forall (c1: C).(\forall (c2: C).((drop1 hds c2 c1) +\to (\forall (b: B).(\forall (e1: C).(\forall (v: T).(\forall (i: nat).((getl +i c1 (CHead e1 (Bind b) v)) \to (ex2 C (\lambda (e2: C).(drop1 (ptrans hds i) +e2 e1)) (\lambda (e2: C).(getl (trans hds i) c2 (CHead e2 (Bind b) (lift1 +(ptrans hds i) v))))))))))))) +\def + \lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall (c1: +C).(\forall (c2: C).((drop1 p c2 c1) \to (\forall (b: B).(\forall (e1: +C).(\forall (v: T).(\forall (i: nat).((getl i c1 (CHead e1 (Bind b) v)) \to +(ex2 C (\lambda (e2: C).(drop1 (ptrans p i) e2 e1)) (\lambda (e2: C).(getl +(trans p i) c2 (CHead e2 (Bind b) (lift1 (ptrans p i) v)))))))))))))) +(\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (drop1 PNil c2 c1)).(\lambda +(b: B).(\lambda (e1: C).(\lambda (v: T).(\lambda (i: nat).(\lambda (H0: (getl +i c1 (CHead e1 (Bind b) v))).(let H1 \def (match H in drop1 return (\lambda +(p: PList).(\lambda (c: C).(\lambda (c0: C).(\lambda (_: (drop1 p c c0)).((eq +PList p PNil) \to ((eq C c c2) \to ((eq C c0 c1) \to (ex2 C (\lambda (e2: +C).(drop1 PNil e2 e1)) (\lambda (e2: C).(getl i c2 (CHead e2 (Bind b) +v))))))))))) with [(drop1_nil c) \Rightarrow (\lambda (_: (eq PList PNil +PNil)).(\lambda (H2: (eq C c c2)).(\lambda (H3: (eq C c c1)).(eq_ind C c2 +(\lambda (c0: C).((eq C c0 c1) \to (ex2 C (\lambda (e2: C).(drop1 PNil e2 +e1)) (\lambda (e2: C).(getl i c2 (CHead e2 (Bind b) v)))))) (\lambda (H4: (eq +C c2 c1)).(eq_ind C c1 (\lambda (c0: C).(ex2 C (\lambda (e2: C).(drop1 PNil +e2 e1)) (\lambda (e2: C).(getl i c0 (CHead e2 (Bind b) v))))) (ex_intro2 C +(\lambda (e2: C).(drop1 PNil e2 e1)) (\lambda (e2: C).(getl i c1 (CHead e2 +(Bind b) v))) e1 (drop1_nil e1) H0) c2 (sym_eq C c2 c1 H4))) c (sym_eq C c c2 +H2) H3)))) | (drop1_cons c0 c3 h d H1 c4 hds0 H2) \Rightarrow (\lambda (H3: +(eq PList (PCons h d hds0) PNil)).(\lambda (H4: (eq C c0 c2)).(\lambda (H5: +(eq C c4 c1)).((let H6 \def (eq_ind PList (PCons h d hds0) (\lambda (e: +PList).(match e in PList return (\lambda (_: PList).Prop) with [PNil +\Rightarrow False | (PCons _ _ _) \Rightarrow True])) I PNil H3) in +(False_ind ((eq C c0 c2) \to ((eq C c4 c1) \to ((drop h d c0 c3) \to ((drop1 +hds0 c3 c4) \to (ex2 C (\lambda (e2: C).(drop1 PNil e2 e1)) (\lambda (e2: +C).(getl i c2 (CHead e2 (Bind b) v)))))))) H6)) H4 H5 H1 H2))))]) in (H1 +(refl_equal PList PNil) (refl_equal C c2) (refl_equal C c1))))))))))) +(\lambda (h: nat).(\lambda (d: nat).(\lambda (hds0: PList).(\lambda (H: +((\forall (c1: C).(\forall (c2: C).((drop1 hds0 c2 c1) \to (\forall (b: +B).(\forall (e1: C).(\forall (v: T).(\forall (i: nat).((getl i c1 (CHead e1 +(Bind b) v)) \to (ex2 C (\lambda (e2: C).(drop1 (ptrans hds0 i) e2 e1)) +(\lambda (e2: C).(getl (trans hds0 i) c2 (CHead e2 (Bind b) (lift1 (ptrans +hds0 i) v))))))))))))))).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H0: +(drop1 (PCons h d hds0) c2 c1)).(\lambda (b: B).(\lambda (e1: C).(\lambda (v: +T).(\lambda (i: nat).(\lambda (H1: (getl i c1 (CHead e1 (Bind b) v))).(let H2 +\def (match H0 in drop1 return (\lambda (p: PList).(\lambda (c: C).(\lambda +(c0: C).(\lambda (_: (drop1 p c c0)).((eq PList p (PCons h d hds0)) \to ((eq +C c c2) \to ((eq C c0 c1) \to (ex2 C (\lambda (e2: C).(drop1 (match (blt +(trans hds0 i) d) with [true \Rightarrow (PCons h (minus d (S (trans hds0 +i))) (ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) e2 e1)) (\lambda +(e2: C).(getl (match (blt (trans hds0 i) d) with [true \Rightarrow (trans +hds0 i) | false \Rightarrow (plus (trans hds0 i) h)]) c2 (CHead e2 (Bind b) +(lift1 (match (blt (trans hds0 i) d) with [true \Rightarrow (PCons h (minus d +(S (trans hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) +v)))))))))))) with [(drop1_nil c) \Rightarrow (\lambda (H2: (eq PList PNil +(PCons h d hds0))).(\lambda (H3: (eq C c c2)).(\lambda (H4: (eq C c +c1)).((let H5 \def (eq_ind PList PNil (\lambda (e: PList).(match e in PList +return (\lambda (_: PList).Prop) with [PNil \Rightarrow True | (PCons _ _ _) +\Rightarrow False])) I (PCons h d hds0) H2) in (False_ind ((eq C c c2) \to +((eq C c c1) \to (ex2 C (\lambda (e2: C).(drop1 (match (blt (trans hds0 i) d) +with [true \Rightarrow (PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) +| false \Rightarrow (ptrans hds0 i)]) e2 e1)) (\lambda (e2: C).(getl (match +(blt (trans hds0 i) d) with [true \Rightarrow (trans hds0 i) | false +\Rightarrow (plus (trans hds0 i) h)]) c2 (CHead e2 (Bind b) (lift1 (match +(blt (trans hds0 i) d) with [true \Rightarrow (PCons h (minus d (S (trans +hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) v))))))) +H5)) H3 H4)))) | (drop1_cons c0 c3 h0 d0 H2 c4 hds1 H3) \Rightarrow (\lambda +(H4: (eq PList (PCons h0 d0 hds1) (PCons h d hds0))).(\lambda (H5: (eq C c0 +c2)).(\lambda (H6: (eq C c4 c1)).((let H7 \def (f_equal PList PList (\lambda +(e: PList).(match e in PList return (\lambda (_: PList).PList) with [PNil +\Rightarrow hds1 | (PCons _ _ p) \Rightarrow p])) (PCons h0 d0 hds1) (PCons h +d hds0) H4) in ((let H8 \def (f_equal PList nat (\lambda (e: PList).(match e +in PList return (\lambda (_: PList).nat) with [PNil \Rightarrow d0 | (PCons _ +n _) \Rightarrow n])) (PCons h0 d0 hds1) (PCons h d hds0) H4) in ((let H9 +\def (f_equal PList nat (\lambda (e: PList).(match e in PList return (\lambda +(_: PList).nat) with [PNil \Rightarrow h0 | (PCons n _ _) \Rightarrow n])) +(PCons h0 d0 hds1) (PCons h d hds0) H4) in (eq_ind nat h (\lambda (n: +nat).((eq nat d0 d) \to ((eq PList hds1 hds0) \to ((eq C c0 c2) \to ((eq C c4 +c1) \to ((drop n d0 c0 c3) \to ((drop1 hds1 c3 c4) \to (ex2 C (\lambda (e2: +C).(drop1 (match (blt (trans hds0 i) d) with [true \Rightarrow (PCons h +(minus d (S (trans hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans +hds0 i)]) e2 e1)) (\lambda (e2: C).(getl (match (blt (trans hds0 i) d) with +[true \Rightarrow (trans hds0 i) | false \Rightarrow (plus (trans hds0 i) +h)]) c2 (CHead e2 (Bind b) (lift1 (match (blt (trans hds0 i) d) with [true +\Rightarrow (PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) | false +\Rightarrow (ptrans hds0 i)]) v)))))))))))) (\lambda (H10: (eq nat d0 +d)).(eq_ind nat d (\lambda (n: nat).((eq PList hds1 hds0) \to ((eq C c0 c2) +\to ((eq C c4 c1) \to ((drop h n c0 c3) \to ((drop1 hds1 c3 c4) \to (ex2 C +(\lambda (e2: C).(drop1 (match (blt (trans hds0 i) d) with [true \Rightarrow +(PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) | false \Rightarrow +(ptrans hds0 i)]) e2 e1)) (\lambda (e2: C).(getl (match (blt (trans hds0 i) +d) with [true \Rightarrow (trans hds0 i) | false \Rightarrow (plus (trans +hds0 i) h)]) c2 (CHead e2 (Bind b) (lift1 (match (blt (trans hds0 i) d) with +[true \Rightarrow (PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) | +false \Rightarrow (ptrans hds0 i)]) v))))))))))) (\lambda (H11: (eq PList +hds1 hds0)).(eq_ind PList hds0 (\lambda (p: PList).((eq C c0 c2) \to ((eq C +c4 c1) \to ((drop h d c0 c3) \to ((drop1 p c3 c4) \to (ex2 C (\lambda (e2: +C).(drop1 (match (blt (trans hds0 i) d) with [true \Rightarrow (PCons h +(minus d (S (trans hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans +hds0 i)]) e2 e1)) (\lambda (e2: C).(getl (match (blt (trans hds0 i) d) with +[true \Rightarrow (trans hds0 i) | false \Rightarrow (plus (trans hds0 i) +h)]) c2 (CHead e2 (Bind b) (lift1 (match (blt (trans hds0 i) d) with [true +\Rightarrow (PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) | false +\Rightarrow (ptrans hds0 i)]) v)))))))))) (\lambda (H12: (eq C c0 +c2)).(eq_ind C c2 (\lambda (c: C).((eq C c4 c1) \to ((drop h d c c3) \to +((drop1 hds0 c3 c4) \to (ex2 C (\lambda (e2: C).(drop1 (match (blt (trans +hds0 i) d) with [true \Rightarrow (PCons h (minus d (S (trans hds0 i))) +(ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) e2 e1)) (\lambda (e2: +C).(getl (match (blt (trans hds0 i) d) with [true \Rightarrow (trans hds0 i) +| false \Rightarrow (plus (trans hds0 i) h)]) c2 (CHead e2 (Bind b) (lift1 +(match (blt (trans hds0 i) d) with [true \Rightarrow (PCons h (minus d (S +(trans hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) +v))))))))) (\lambda (H13: (eq C c4 c1)).(eq_ind C c1 (\lambda (c: C).((drop h +d c2 c3) \to ((drop1 hds0 c3 c) \to (ex2 C (\lambda (e2: C).(drop1 (match +(blt (trans hds0 i) d) with [true \Rightarrow (PCons h (minus d (S (trans +hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) e2 e1)) +(\lambda (e2: C).(getl (match (blt (trans hds0 i) d) with [true \Rightarrow +(trans hds0 i) | false \Rightarrow (plus (trans hds0 i) h)]) c2 (CHead e2 +(Bind b) (lift1 (match (blt (trans hds0 i) d) with [true \Rightarrow (PCons h +(minus d (S (trans hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans +hds0 i)]) v)))))))) (\lambda (H14: (drop h d c2 c3)).(\lambda (H15: (drop1 +hds0 c3 c1)).(xinduction bool (blt (trans hds0 i) d) (\lambda (b0: bool).(ex2 +C (\lambda (e2: C).(drop1 (match b0 with [true \Rightarrow (PCons h (minus d +(S (trans hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) e2 +e1)) (\lambda (e2: C).(getl (match b0 with [true \Rightarrow (trans hds0 i) | +false \Rightarrow (plus (trans hds0 i) h)]) c2 (CHead e2 (Bind b) (lift1 +(match b0 with [true \Rightarrow (PCons h (minus d (S (trans hds0 i))) +(ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) v)))))) (\lambda (x_x: +bool).(bool_ind (\lambda (b0: bool).((eq bool (blt (trans hds0 i) d) b0) \to +(ex2 C (\lambda (e2: C).(drop1 (match b0 with [true \Rightarrow (PCons h +(minus d (S (trans hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans +hds0 i)]) e2 e1)) (\lambda (e2: C).(getl (match b0 with [true \Rightarrow +(trans hds0 i) | false \Rightarrow (plus (trans hds0 i) h)]) c2 (CHead e2 +(Bind b) (lift1 (match b0 with [true \Rightarrow (PCons h (minus d (S (trans +hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) v))))))) +(\lambda (H16: (eq bool (blt (trans hds0 i) d) true)).(let H_x \def (H c1 c3 +H15 b e1 v i H1) in (let H17 \def H_x in (ex2_ind C (\lambda (e2: C).(drop1 +(ptrans hds0 i) e2 e1)) (\lambda (e2: C).(getl (trans hds0 i) c3 (CHead e2 +(Bind b) (lift1 (ptrans hds0 i) v)))) (ex2 C (\lambda (e2: C).(drop1 (PCons h +(minus d (S (trans hds0 i))) (ptrans hds0 i)) e2 e1)) (\lambda (e2: C).(getl +(trans hds0 i) c2 (CHead e2 (Bind b) (lift1 (PCons h (minus d (S (trans hds0 +i))) (ptrans hds0 i)) v))))) (\lambda (x: C).(\lambda (H18: (drop1 (ptrans +hds0 i) x e1)).(\lambda (H19: (getl (trans hds0 i) c3 (CHead x (Bind b) +(lift1 (ptrans hds0 i) v)))).(let H_x0 \def (drop_getl_trans_lt (trans hds0 +i) d (blt_lt d (trans hds0 i) H16) c2 c3 h H14 b x (lift1 (ptrans hds0 i) v) +H19) in (let H20 \def H_x0 in (ex2_ind C (\lambda (e2: C).(getl (trans hds0 +i) c2 (CHead e2 (Bind b) (lift h (minus d (S (trans hds0 i))) (lift1 (ptrans +hds0 i) v))))) (\lambda (e2: C).(drop h (minus d (S (trans hds0 i))) e2 x)) +(ex2 C (\lambda (e2: C).(drop1 (PCons h (minus d (S (trans hds0 i))) (ptrans +hds0 i)) e2 e1)) (\lambda (e2: C).(getl (trans hds0 i) c2 (CHead e2 (Bind b) +(lift1 (PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) v))))) (\lambda +(x0: C).(\lambda (H21: (getl (trans hds0 i) c2 (CHead x0 (Bind b) (lift h +(minus d (S (trans hds0 i))) (lift1 (ptrans hds0 i) v))))).(\lambda (H22: +(drop h (minus d (S (trans hds0 i))) x0 x)).(ex_intro2 C (\lambda (e2: +C).(drop1 (PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) e2 e1)) +(\lambda (e2: C).(getl (trans hds0 i) c2 (CHead e2 (Bind b) (lift1 (PCons h +(minus d (S (trans hds0 i))) (ptrans hds0 i)) v)))) x0 (drop1_cons x0 x h +(minus d (S (trans hds0 i))) H22 e1 (ptrans hds0 i) H18) H21)))) H20)))))) +H17)))) (\lambda (H16: (eq bool (blt (trans hds0 i) d) false)).(let H_x \def +(H c1 c3 H15 b e1 v i H1) in (let H17 \def H_x in (ex2_ind C (\lambda (e2: +C).(drop1 (ptrans hds0 i) e2 e1)) (\lambda (e2: C).(getl (trans hds0 i) c3 +(CHead e2 (Bind b) (lift1 (ptrans hds0 i) v)))) (ex2 C (\lambda (e2: +C).(drop1 (ptrans hds0 i) e2 e1)) (\lambda (e2: C).(getl (plus (trans hds0 i) +h) c2 (CHead e2 (Bind b) (lift1 (ptrans hds0 i) v))))) (\lambda (x: +C).(\lambda (H18: (drop1 (ptrans hds0 i) x e1)).(\lambda (H19: (getl (trans +hds0 i) c3 (CHead x (Bind b) (lift1 (ptrans hds0 i) v)))).(let H20 \def +(drop_getl_trans_ge (trans hds0 i) c2 c3 d h H14 (CHead x (Bind b) (lift1 +(ptrans hds0 i) v)) H19) in (ex_intro2 C (\lambda (e2: C).(drop1 (ptrans hds0 +i) e2 e1)) (\lambda (e2: C).(getl (plus (trans hds0 i) h) c2 (CHead e2 (Bind +b) (lift1 (ptrans hds0 i) v)))) x H18 (H20 (bge_le d (trans hds0 i) +H16))))))) H17)))) x_x))))) c4 (sym_eq C c4 c1 H13))) c0 (sym_eq C c0 c2 +H12))) hds1 (sym_eq PList hds1 hds0 H11))) d0 (sym_eq nat d0 d H10))) h0 +(sym_eq nat h0 h H9))) H8)) H7)) H5 H6 H2 H3))))]) in (H2 (refl_equal PList +(PCons h d hds0)) (refl_equal C c2) (refl_equal C c1))))))))))))))) hds). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/props.ma new file mode 100644 index 000000000..5d1e9dc29 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/props.ma @@ -0,0 +1,234 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/drop1/props". + +include "drop1/defs.ma". + +include "drop/props.ma". + +include "getl/defs.ma". + +theorem drop1_skip_bind: + \forall (b: B).(\forall (e: C).(\forall (hds: PList).(\forall (c: +C).(\forall (u: T).((drop1 hds c e) \to (drop1 (Ss hds) (CHead c (Bind b) +(lift1 hds u)) (CHead e (Bind b) u))))))) +\def + \lambda (b: B).(\lambda (e: C).(\lambda (hds: PList).(PList_ind (\lambda (p: +PList).(\forall (c: C).(\forall (u: T).((drop1 p c e) \to (drop1 (Ss p) +(CHead c (Bind b) (lift1 p u)) (CHead e (Bind b) u)))))) (\lambda (c: +C).(\lambda (u: T).(\lambda (H: (drop1 PNil c e)).(let H0 \def (match H in +drop1 return (\lambda (p: PList).(\lambda (c0: C).(\lambda (c1: C).(\lambda +(_: (drop1 p c0 c1)).((eq PList p PNil) \to ((eq C c0 c) \to ((eq C c1 e) \to +(drop1 PNil (CHead c (Bind b) u) (CHead e (Bind b) u))))))))) with +[(drop1_nil c0) \Rightarrow (\lambda (_: (eq PList PNil PNil)).(\lambda (H1: +(eq C c0 c)).(\lambda (H2: (eq C c0 e)).(eq_ind C c (\lambda (c1: C).((eq C +c1 e) \to (drop1 PNil (CHead c (Bind b) u) (CHead e (Bind b) u)))) (\lambda +(H3: (eq C c e)).(eq_ind C e (\lambda (c1: C).(drop1 PNil (CHead c1 (Bind b) +u) (CHead e (Bind b) u))) (drop1_nil (CHead e (Bind b) u)) c (sym_eq C c e +H3))) c0 (sym_eq C c0 c H1) H2)))) | (drop1_cons c1 c2 h d H0 c3 hds0 H1) +\Rightarrow (\lambda (H2: (eq PList (PCons h d hds0) PNil)).(\lambda (H3: (eq +C c1 c)).(\lambda (H4: (eq C c3 e)).((let H5 \def (eq_ind PList (PCons h d +hds0) (\lambda (e0: PList).(match e0 in PList return (\lambda (_: +PList).Prop) with [PNil \Rightarrow False | (PCons _ _ _) \Rightarrow True])) +I PNil H2) in (False_ind ((eq C c1 c) \to ((eq C c3 e) \to ((drop h d c1 c2) +\to ((drop1 hds0 c2 c3) \to (drop1 PNil (CHead c (Bind b) u) (CHead e (Bind +b) u)))))) H5)) H3 H4 H0 H1))))]) in (H0 (refl_equal PList PNil) (refl_equal +C c) (refl_equal C e)))))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda (p: +PList).(\lambda (H: ((\forall (c: C).(\forall (u: T).((drop1 p c e) \to +(drop1 (Ss p) (CHead c (Bind b) (lift1 p u)) (CHead e (Bind b) +u))))))).(\lambda (c: C).(\lambda (u: T).(\lambda (H0: (drop1 (PCons n n0 p) +c e)).(let H1 \def (match H0 in drop1 return (\lambda (p0: PList).(\lambda +(c0: C).(\lambda (c1: C).(\lambda (_: (drop1 p0 c0 c1)).((eq PList p0 (PCons +n n0 p)) \to ((eq C c0 c) \to ((eq C c1 e) \to (drop1 (PCons n (S n0) (Ss p)) +(CHead c (Bind b) (lift n n0 (lift1 p u))) (CHead e (Bind b) u))))))))) with +[(drop1_nil c0) \Rightarrow (\lambda (H1: (eq PList PNil (PCons n n0 +p))).(\lambda (H2: (eq C c0 c)).(\lambda (H3: (eq C c0 e)).((let H4 \def +(eq_ind PList PNil (\lambda (e0: PList).(match e0 in PList return (\lambda +(_: PList).Prop) with [PNil \Rightarrow True | (PCons _ _ _) \Rightarrow +False])) I (PCons n n0 p) H1) in (False_ind ((eq C c0 c) \to ((eq C c0 e) \to +(drop1 (PCons n (S n0) (Ss p)) (CHead c (Bind b) (lift n n0 (lift1 p u))) +(CHead e (Bind b) u)))) H4)) H2 H3)))) | (drop1_cons c1 c2 h d H1 c3 hds0 H2) +\Rightarrow (\lambda (H3: (eq PList (PCons h d hds0) (PCons n n0 +p))).(\lambda (H4: (eq C c1 c)).(\lambda (H5: (eq C c3 e)).((let H6 \def +(f_equal PList PList (\lambda (e0: PList).(match e0 in PList return (\lambda +(_: PList).PList) with [PNil \Rightarrow hds0 | (PCons _ _ p0) \Rightarrow +p0])) (PCons h d hds0) (PCons n n0 p) H3) in ((let H7 \def (f_equal PList nat +(\lambda (e0: PList).(match e0 in PList return (\lambda (_: PList).nat) with +[PNil \Rightarrow d | (PCons _ n1 _) \Rightarrow n1])) (PCons h d hds0) +(PCons n n0 p) H3) in ((let H8 \def (f_equal PList nat (\lambda (e0: +PList).(match e0 in PList return (\lambda (_: PList).nat) with [PNil +\Rightarrow h | (PCons n1 _ _) \Rightarrow n1])) (PCons h d hds0) (PCons n n0 +p) H3) in (eq_ind nat n (\lambda (n1: nat).((eq nat d n0) \to ((eq PList hds0 +p) \to ((eq C c1 c) \to ((eq C c3 e) \to ((drop n1 d c1 c2) \to ((drop1 hds0 +c2 c3) \to (drop1 (PCons n (S n0) (Ss p)) (CHead c (Bind b) (lift n n0 (lift1 +p u))) (CHead e (Bind b) u))))))))) (\lambda (H9: (eq nat d n0)).(eq_ind nat +n0 (\lambda (n1: nat).((eq PList hds0 p) \to ((eq C c1 c) \to ((eq C c3 e) +\to ((drop n n1 c1 c2) \to ((drop1 hds0 c2 c3) \to (drop1 (PCons n (S n0) (Ss +p)) (CHead c (Bind b) (lift n n0 (lift1 p u))) (CHead e (Bind b) u)))))))) +(\lambda (H10: (eq PList hds0 p)).(eq_ind PList p (\lambda (p0: PList).((eq C +c1 c) \to ((eq C c3 e) \to ((drop n n0 c1 c2) \to ((drop1 p0 c2 c3) \to +(drop1 (PCons n (S n0) (Ss p)) (CHead c (Bind b) (lift n n0 (lift1 p u))) +(CHead e (Bind b) u))))))) (\lambda (H11: (eq C c1 c)).(eq_ind C c (\lambda +(c0: C).((eq C c3 e) \to ((drop n n0 c0 c2) \to ((drop1 p c2 c3) \to (drop1 +(PCons n (S n0) (Ss p)) (CHead c (Bind b) (lift n n0 (lift1 p u))) (CHead e +(Bind b) u)))))) (\lambda (H12: (eq C c3 e)).(eq_ind C e (\lambda (c0: +C).((drop n n0 c c2) \to ((drop1 p c2 c0) \to (drop1 (PCons n (S n0) (Ss p)) +(CHead c (Bind b) (lift n n0 (lift1 p u))) (CHead e (Bind b) u))))) (\lambda +(H13: (drop n n0 c c2)).(\lambda (H14: (drop1 p c2 e)).(drop1_cons (CHead c +(Bind b) (lift n n0 (lift1 p u))) (CHead c2 (Bind b) (lift1 p u)) n (S n0) +(drop_skip_bind n n0 c c2 H13 b (lift1 p u)) (CHead e (Bind b) u) (Ss p) (H +c2 u H14)))) c3 (sym_eq C c3 e H12))) c1 (sym_eq C c1 c H11))) hds0 (sym_eq +PList hds0 p H10))) d (sym_eq nat d n0 H9))) h (sym_eq nat h n H8))) H7)) +H6)) H4 H5 H1 H2))))]) in (H1 (refl_equal PList (PCons n n0 p)) (refl_equal C +c) (refl_equal C e)))))))))) hds))). + +theorem drop1_cons_tail: + \forall (c2: C).(\forall (c3: C).(\forall (h: nat).(\forall (d: nat).((drop +h d c2 c3) \to (\forall (hds: PList).(\forall (c1: C).((drop1 hds c1 c2) \to +(drop1 (PConsTail hds h d) c1 c3)))))))) +\def + \lambda (c2: C).(\lambda (c3: C).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H: (drop h d c2 c3)).(\lambda (hds: PList).(PList_ind (\lambda +(p: PList).(\forall (c1: C).((drop1 p c1 c2) \to (drop1 (PConsTail p h d) c1 +c3)))) (\lambda (c1: C).(\lambda (H0: (drop1 PNil c1 c2)).(let H1 \def (match +H0 in drop1 return (\lambda (p: PList).(\lambda (c: C).(\lambda (c0: +C).(\lambda (_: (drop1 p c c0)).((eq PList p PNil) \to ((eq C c c1) \to ((eq +C c0 c2) \to (drop1 (PCons h d PNil) c1 c3)))))))) with [(drop1_nil c) +\Rightarrow (\lambda (_: (eq PList PNil PNil)).(\lambda (H2: (eq C c +c1)).(\lambda (H3: (eq C c c2)).(eq_ind C c1 (\lambda (c0: C).((eq C c0 c2) +\to (drop1 (PCons h d PNil) c1 c3))) (\lambda (H4: (eq C c1 c2)).(eq_ind C c2 +(\lambda (c0: C).(drop1 (PCons h d PNil) c0 c3)) (drop1_cons c2 c3 h d H c3 +PNil (drop1_nil c3)) c1 (sym_eq C c1 c2 H4))) c (sym_eq C c c1 H2) H3)))) | +(drop1_cons c0 c4 h0 d0 H1 c5 hds0 H2) \Rightarrow (\lambda (H3: (eq PList +(PCons h0 d0 hds0) PNil)).(\lambda (H4: (eq C c0 c1)).(\lambda (H5: (eq C c5 +c2)).((let H6 \def (eq_ind PList (PCons h0 d0 hds0) (\lambda (e: +PList).(match e in PList return (\lambda (_: PList).Prop) with [PNil +\Rightarrow False | (PCons _ _ _) \Rightarrow True])) I PNil H3) in +(False_ind ((eq C c0 c1) \to ((eq C c5 c2) \to ((drop h0 d0 c0 c4) \to +((drop1 hds0 c4 c5) \to (drop1 (PCons h d PNil) c1 c3))))) H6)) H4 H5 H1 +H2))))]) in (H1 (refl_equal PList PNil) (refl_equal C c1) (refl_equal C +c2))))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda (p: PList).(\lambda +(H0: ((\forall (c1: C).((drop1 p c1 c2) \to (drop1 (PConsTail p h d) c1 +c3))))).(\lambda (c1: C).(\lambda (H1: (drop1 (PCons n n0 p) c1 c2)).(let H2 +\def (match H1 in drop1 return (\lambda (p0: PList).(\lambda (c: C).(\lambda +(c0: C).(\lambda (_: (drop1 p0 c c0)).((eq PList p0 (PCons n n0 p)) \to ((eq +C c c1) \to ((eq C c0 c2) \to (drop1 (PCons n n0 (PConsTail p h d)) c1 +c3)))))))) with [(drop1_nil c) \Rightarrow (\lambda (H2: (eq PList PNil +(PCons n n0 p))).(\lambda (H3: (eq C c c1)).(\lambda (H4: (eq C c c2)).((let +H5 \def (eq_ind PList PNil (\lambda (e: PList).(match e in PList return +(\lambda (_: PList).Prop) with [PNil \Rightarrow True | (PCons _ _ _) +\Rightarrow False])) I (PCons n n0 p) H2) in (False_ind ((eq C c c1) \to ((eq +C c c2) \to (drop1 (PCons n n0 (PConsTail p h d)) c1 c3))) H5)) H3 H4)))) | +(drop1_cons c0 c4 h0 d0 H2 c5 hds0 H3) \Rightarrow (\lambda (H4: (eq PList +(PCons h0 d0 hds0) (PCons n n0 p))).(\lambda (H5: (eq C c0 c1)).(\lambda (H6: +(eq C c5 c2)).((let H7 \def (f_equal PList PList (\lambda (e: PList).(match e +in PList return (\lambda (_: PList).PList) with [PNil \Rightarrow hds0 | +(PCons _ _ p0) \Rightarrow p0])) (PCons h0 d0 hds0) (PCons n n0 p) H4) in +((let H8 \def (f_equal PList nat (\lambda (e: PList).(match e in PList return +(\lambda (_: PList).nat) with [PNil \Rightarrow d0 | (PCons _ n1 _) +\Rightarrow n1])) (PCons h0 d0 hds0) (PCons n n0 p) H4) in ((let H9 \def +(f_equal PList nat (\lambda (e: PList).(match e in PList return (\lambda (_: +PList).nat) with [PNil \Rightarrow h0 | (PCons n1 _ _) \Rightarrow n1])) +(PCons h0 d0 hds0) (PCons n n0 p) H4) in (eq_ind nat n (\lambda (n1: +nat).((eq nat d0 n0) \to ((eq PList hds0 p) \to ((eq C c0 c1) \to ((eq C c5 +c2) \to ((drop n1 d0 c0 c4) \to ((drop1 hds0 c4 c5) \to (drop1 (PCons n n0 +(PConsTail p h d)) c1 c3)))))))) (\lambda (H10: (eq nat d0 n0)).(eq_ind nat +n0 (\lambda (n1: nat).((eq PList hds0 p) \to ((eq C c0 c1) \to ((eq C c5 c2) +\to ((drop n n1 c0 c4) \to ((drop1 hds0 c4 c5) \to (drop1 (PCons n n0 +(PConsTail p h d)) c1 c3))))))) (\lambda (H11: (eq PList hds0 p)).(eq_ind +PList p (\lambda (p0: PList).((eq C c0 c1) \to ((eq C c5 c2) \to ((drop n n0 +c0 c4) \to ((drop1 p0 c4 c5) \to (drop1 (PCons n n0 (PConsTail p h d)) c1 +c3)))))) (\lambda (H12: (eq C c0 c1)).(eq_ind C c1 (\lambda (c: C).((eq C c5 +c2) \to ((drop n n0 c c4) \to ((drop1 p c4 c5) \to (drop1 (PCons n n0 +(PConsTail p h d)) c1 c3))))) (\lambda (H13: (eq C c5 c2)).(eq_ind C c2 +(\lambda (c: C).((drop n n0 c1 c4) \to ((drop1 p c4 c) \to (drop1 (PCons n n0 +(PConsTail p h d)) c1 c3)))) (\lambda (H14: (drop n n0 c1 c4)).(\lambda (H15: +(drop1 p c4 c2)).(drop1_cons c1 c4 n n0 H14 c3 (PConsTail p h d) (H0 c4 +H15)))) c5 (sym_eq C c5 c2 H13))) c0 (sym_eq C c0 c1 H12))) hds0 (sym_eq +PList hds0 p H11))) d0 (sym_eq nat d0 n0 H10))) h0 (sym_eq nat h0 n H9))) +H8)) H7)) H5 H6 H2 H3))))]) in (H2 (refl_equal PList (PCons n n0 p)) +(refl_equal C c1) (refl_equal C c2))))))))) hds)))))). + +theorem drop1_trans: + \forall (is1: PList).(\forall (c1: C).(\forall (c0: C).((drop1 is1 c1 c0) +\to (\forall (is2: PList).(\forall (c2: C).((drop1 is2 c0 c2) \to (drop1 +(papp is1 is2) c1 c2))))))) +\def + \lambda (is1: PList).(PList_ind (\lambda (p: PList).(\forall (c1: +C).(\forall (c0: C).((drop1 p c1 c0) \to (\forall (is2: PList).(\forall (c2: +C).((drop1 is2 c0 c2) \to (drop1 (papp p is2) c1 c2)))))))) (\lambda (c1: +C).(\lambda (c0: C).(\lambda (H: (drop1 PNil c1 c0)).(\lambda (is2: +PList).(\lambda (c2: C).(\lambda (H0: (drop1 is2 c0 c2)).(let H1 \def (match +H in drop1 return (\lambda (p: PList).(\lambda (c: C).(\lambda (c3: +C).(\lambda (_: (drop1 p c c3)).((eq PList p PNil) \to ((eq C c c1) \to ((eq +C c3 c0) \to (drop1 is2 c1 c2)))))))) with [(drop1_nil c) \Rightarrow +(\lambda (_: (eq PList PNil PNil)).(\lambda (H2: (eq C c c1)).(\lambda (H3: +(eq C c c0)).(eq_ind C c1 (\lambda (c3: C).((eq C c3 c0) \to (drop1 is2 c1 +c2))) (\lambda (H4: (eq C c1 c0)).(eq_ind C c0 (\lambda (c3: C).(drop1 is2 c3 +c2)) (let H5 \def (eq_ind_r C c0 (\lambda (c3: C).(drop1 is2 c3 c2)) H0 c1 +H4) in (eq_ind C c1 (\lambda (c3: C).(drop1 is2 c3 c2)) H5 c0 H4)) c1 (sym_eq +C c1 c0 H4))) c (sym_eq C c c1 H2) H3)))) | (drop1_cons c3 c4 h d H1 c5 hds +H2) \Rightarrow (\lambda (H3: (eq PList (PCons h d hds) PNil)).(\lambda (H4: +(eq C c3 c1)).(\lambda (H5: (eq C c5 c0)).((let H6 \def (eq_ind PList (PCons +h d hds) (\lambda (e: PList).(match e in PList return (\lambda (_: +PList).Prop) with [PNil \Rightarrow False | (PCons _ _ _) \Rightarrow True])) +I PNil H3) in (False_ind ((eq C c3 c1) \to ((eq C c5 c0) \to ((drop h d c3 +c4) \to ((drop1 hds c4 c5) \to (drop1 is2 c1 c2))))) H6)) H4 H5 H1 H2))))]) +in (H1 (refl_equal PList PNil) (refl_equal C c1) (refl_equal C c0))))))))) +(\lambda (n: nat).(\lambda (n0: nat).(\lambda (p: PList).(\lambda (H: +((\forall (c1: C).(\forall (c0: C).((drop1 p c1 c0) \to (\forall (is2: +PList).(\forall (c2: C).((drop1 is2 c0 c2) \to (drop1 (papp p is2) c1 +c2))))))))).(\lambda (c1: C).(\lambda (c0: C).(\lambda (H0: (drop1 (PCons n +n0 p) c1 c0)).(\lambda (is2: PList).(\lambda (c2: C).(\lambda (H1: (drop1 is2 +c0 c2)).(let H2 \def (match H0 in drop1 return (\lambda (p0: PList).(\lambda +(c: C).(\lambda (c3: C).(\lambda (_: (drop1 p0 c c3)).((eq PList p0 (PCons n +n0 p)) \to ((eq C c c1) \to ((eq C c3 c0) \to (drop1 (PCons n n0 (papp p +is2)) c1 c2)))))))) with [(drop1_nil c) \Rightarrow (\lambda (H2: (eq PList +PNil (PCons n n0 p))).(\lambda (H3: (eq C c c1)).(\lambda (H4: (eq C c +c0)).((let H5 \def (eq_ind PList PNil (\lambda (e: PList).(match e in PList +return (\lambda (_: PList).Prop) with [PNil \Rightarrow True | (PCons _ _ _) +\Rightarrow False])) I (PCons n n0 p) H2) in (False_ind ((eq C c c1) \to ((eq +C c c0) \to (drop1 (PCons n n0 (papp p is2)) c1 c2))) H5)) H3 H4)))) | +(drop1_cons c3 c4 h d H2 c5 hds H3) \Rightarrow (\lambda (H4: (eq PList +(PCons h d hds) (PCons n n0 p))).(\lambda (H5: (eq C c3 c1)).(\lambda (H6: +(eq C c5 c0)).((let H7 \def (f_equal PList PList (\lambda (e: PList).(match e +in PList return (\lambda (_: PList).PList) with [PNil \Rightarrow hds | +(PCons _ _ p0) \Rightarrow p0])) (PCons h d hds) (PCons n n0 p) H4) in ((let +H8 \def (f_equal PList nat (\lambda (e: PList).(match e in PList return +(\lambda (_: PList).nat) with [PNil \Rightarrow d | (PCons _ n1 _) +\Rightarrow n1])) (PCons h d hds) (PCons n n0 p) H4) in ((let H9 \def +(f_equal PList nat (\lambda (e: PList).(match e in PList return (\lambda (_: +PList).nat) with [PNil \Rightarrow h | (PCons n1 _ _) \Rightarrow n1])) +(PCons h d hds) (PCons n n0 p) H4) in (eq_ind nat n (\lambda (n1: nat).((eq +nat d n0) \to ((eq PList hds p) \to ((eq C c3 c1) \to ((eq C c5 c0) \to +((drop n1 d c3 c4) \to ((drop1 hds c4 c5) \to (drop1 (PCons n n0 (papp p +is2)) c1 c2)))))))) (\lambda (H10: (eq nat d n0)).(eq_ind nat n0 (\lambda +(n1: nat).((eq PList hds p) \to ((eq C c3 c1) \to ((eq C c5 c0) \to ((drop n +n1 c3 c4) \to ((drop1 hds c4 c5) \to (drop1 (PCons n n0 (papp p is2)) c1 +c2))))))) (\lambda (H11: (eq PList hds p)).(eq_ind PList p (\lambda (p0: +PList).((eq C c3 c1) \to ((eq C c5 c0) \to ((drop n n0 c3 c4) \to ((drop1 p0 +c4 c5) \to (drop1 (PCons n n0 (papp p is2)) c1 c2)))))) (\lambda (H12: (eq C +c3 c1)).(eq_ind C c1 (\lambda (c: C).((eq C c5 c0) \to ((drop n n0 c c4) \to +((drop1 p c4 c5) \to (drop1 (PCons n n0 (papp p is2)) c1 c2))))) (\lambda +(H13: (eq C c5 c0)).(eq_ind C c0 (\lambda (c: C).((drop n n0 c1 c4) \to +((drop1 p c4 c) \to (drop1 (PCons n n0 (papp p is2)) c1 c2)))) (\lambda (H14: +(drop n n0 c1 c4)).(\lambda (H15: (drop1 p c4 c0)).(drop1_cons c1 c4 n n0 H14 +c2 (papp p is2) (H c4 c0 H15 is2 c2 H1)))) c5 (sym_eq C c5 c0 H13))) c3 +(sym_eq C c3 c1 H12))) hds (sym_eq PList hds p H11))) d (sym_eq nat d n0 +H10))) h (sym_eq nat h n H9))) H8)) H7)) H5 H6 H2 H3))))]) in (H2 (refl_equal +PList (PCons n n0 p)) (refl_equal C c1) (refl_equal C c0))))))))))))) is1). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/defs.ma new file mode 100644 index 000000000..078545c74 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/defs.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ex0/defs". + +include "A/defs.ma". + +include "G/defs.ma". + +definition gz: + G +\def + mk_G S lt_n_Sn. + +inductive leqz: A \to (A \to Prop) \def +| leqz_sort: \forall (h1: nat).(\forall (h2: nat).(\forall (n1: nat).(\forall +(n2: nat).((eq nat (plus h1 n2) (plus h2 n1)) \to (leqz (ASort h1 n1) (ASort +h2 n2)))))) +| leqz_head: \forall (a1: A).(\forall (a2: A).((leqz a1 a2) \to (\forall (a3: +A).(\forall (a4: A).((leqz a3 a4) \to (leqz (AHead a1 a3) (AHead a2 a4))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/props.ma new file mode 100644 index 000000000..66350ed9c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/props.ma @@ -0,0 +1,208 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ex0/props". + +include "ex0/defs.ma". + +include "leq/defs.ma". + +include "aplus/props.ma". + +theorem aplus_gz_le: + \forall (k: nat).(\forall (h: nat).(\forall (n: nat).((le h k) \to (eq A +(aplus gz (ASort h n) k) (ASort O (plus (minus k h) n)))))) +\def + \lambda (k: nat).(nat_ind (\lambda (n: nat).(\forall (h: nat).(\forall (n0: +nat).((le h n) \to (eq A (aplus gz (ASort h n0) n) (ASort O (plus (minus n h) +n0))))))) (\lambda (h: nat).(\lambda (n: nat).(\lambda (H: (le h O)).(let H_y +\def (le_n_O_eq h H) in (eq_ind nat O (\lambda (n0: nat).(eq A (ASort n0 n) +(ASort O n))) (refl_equal A (ASort O n)) h H_y))))) (\lambda (k0: +nat).(\lambda (IH: ((\forall (h: nat).(\forall (n: nat).((le h k0) \to (eq A +(aplus gz (ASort h n) k0) (ASort O (plus (minus k0 h) n)))))))).(\lambda (h: +nat).(nat_ind (\lambda (n: nat).(\forall (n0: nat).((le n (S k0)) \to (eq A +(asucc gz (aplus gz (ASort n n0) k0)) (ASort O (plus (match n with [O +\Rightarrow (S k0) | (S l) \Rightarrow (minus k0 l)]) n0)))))) (\lambda (n: +nat).(\lambda (_: (le O (S k0))).(eq_ind A (aplus gz (asucc gz (ASort O n)) +k0) (\lambda (a: A).(eq A a (ASort O (S (plus k0 n))))) (eq_ind_r A (ASort O +(plus (minus k0 O) (S n))) (\lambda (a: A).(eq A a (ASort O (S (plus k0 +n))))) (eq_ind nat k0 (\lambda (n0: nat).(eq A (ASort O (plus n0 (S n))) +(ASort O (S (plus k0 n))))) (eq_ind nat (S (plus k0 n)) (\lambda (n0: +nat).(eq A (ASort O n0) (ASort O (S (plus k0 n))))) (refl_equal A (ASort O (S +(plus k0 n)))) (plus k0 (S n)) (plus_n_Sm k0 n)) (minus k0 O) (minus_n_O k0)) +(aplus gz (ASort O (S n)) k0) (IH O (S n) (le_O_n k0))) (asucc gz (aplus gz +(ASort O n) k0)) (aplus_asucc gz k0 (ASort O n))))) (\lambda (n: +nat).(\lambda (_: ((\forall (n0: nat).((le n (S k0)) \to (eq A (asucc gz +(aplus gz (ASort n n0) k0)) (ASort O (plus (match n with [O \Rightarrow (S +k0) | (S l) \Rightarrow (minus k0 l)]) n0))))))).(\lambda (n0: nat).(\lambda +(H0: (le (S n) (S k0))).(ex2_ind nat (\lambda (n1: nat).(eq nat (S k0) (S +n1))) (\lambda (n1: nat).(le n n1)) (eq A (asucc gz (aplus gz (ASort (S n) +n0) k0)) (ASort O (plus (minus k0 n) n0))) (\lambda (x: nat).(\lambda (H1: +(eq nat (S k0) (S x))).(\lambda (H2: (le n x)).(let H3 \def (f_equal nat nat +(\lambda (e: nat).(match e in nat return (\lambda (_: nat).nat) with [O +\Rightarrow k0 | (S n1) \Rightarrow n1])) (S k0) (S x) H1) in (let H4 \def +(eq_ind_r nat x (\lambda (n1: nat).(le n n1)) H2 k0 H3) in (eq_ind A (aplus +gz (ASort n n0) k0) (\lambda (a: A).(eq A (asucc gz (aplus gz (ASort (S n) +n0) k0)) a)) (eq_ind A (aplus gz (asucc gz (ASort (S n) n0)) k0) (\lambda (a: +A).(eq A a (aplus gz (ASort n n0) k0))) (refl_equal A (aplus gz (ASort n n0) +k0)) (asucc gz (aplus gz (ASort (S n) n0) k0)) (aplus_asucc gz k0 (ASort (S +n) n0))) (ASort O (plus (minus k0 n) n0)) (IH n n0 H4))))))) (le_gen_S n (S +k0) H0)))))) h)))) k). + +theorem aplus_gz_ge: + \forall (n: nat).(\forall (k: nat).(\forall (h: nat).((le k h) \to (eq A +(aplus gz (ASort h n) k) (ASort (minus h k) n))))) +\def + \lambda (n: nat).(\lambda (k: nat).(nat_ind (\lambda (n0: nat).(\forall (h: +nat).((le n0 h) \to (eq A (aplus gz (ASort h n) n0) (ASort (minus h n0) +n))))) (\lambda (h: nat).(\lambda (_: (le O h)).(eq_ind nat h (\lambda (n0: +nat).(eq A (ASort h n) (ASort n0 n))) (refl_equal A (ASort h n)) (minus h O) +(minus_n_O h)))) (\lambda (k0: nat).(\lambda (IH: ((\forall (h: nat).((le k0 +h) \to (eq A (aplus gz (ASort h n) k0) (ASort (minus h k0) n)))))).(\lambda +(h: nat).(nat_ind (\lambda (n0: nat).((le (S k0) n0) \to (eq A (asucc gz +(aplus gz (ASort n0 n) k0)) (ASort (minus n0 (S k0)) n)))) (\lambda (H: (le +(S k0) O)).(ex2_ind nat (\lambda (n0: nat).(eq nat O (S n0))) (\lambda (n0: +nat).(le k0 n0)) (eq A (asucc gz (aplus gz (ASort O n) k0)) (ASort O n)) +(\lambda (x: nat).(\lambda (H0: (eq nat O (S x))).(\lambda (_: (le k0 +x)).(let H2 \def (eq_ind nat O (\lambda (ee: nat).(match ee in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow True | (S _) \Rightarrow False])) +I (S x) H0) in (False_ind (eq A (asucc gz (aplus gz (ASort O n) k0)) (ASort O +n)) H2))))) (le_gen_S k0 O H))) (\lambda (n0: nat).(\lambda (_: (((le (S k0) +n0) \to (eq A (asucc gz (aplus gz (ASort n0 n) k0)) (ASort (minus n0 (S k0)) +n))))).(\lambda (H0: (le (S k0) (S n0))).(ex2_ind nat (\lambda (n1: nat).(eq +nat (S n0) (S n1))) (\lambda (n1: nat).(le k0 n1)) (eq A (asucc gz (aplus gz +(ASort (S n0) n) k0)) (ASort (minus n0 k0) n)) (\lambda (x: nat).(\lambda +(H1: (eq nat (S n0) (S x))).(\lambda (H2: (le k0 x)).(let H3 \def (f_equal +nat nat (\lambda (e: nat).(match e in nat return (\lambda (_: nat).nat) with +[O \Rightarrow n0 | (S n1) \Rightarrow n1])) (S n0) (S x) H1) in (let H4 \def +(eq_ind_r nat x (\lambda (n1: nat).(le k0 n1)) H2 n0 H3) in (eq_ind A (aplus +gz (ASort n0 n) k0) (\lambda (a: A).(eq A (asucc gz (aplus gz (ASort (S n0) +n) k0)) a)) (eq_ind A (aplus gz (asucc gz (ASort (S n0) n)) k0) (\lambda (a: +A).(eq A a (aplus gz (ASort n0 n) k0))) (refl_equal A (aplus gz (ASort n0 n) +k0)) (asucc gz (aplus gz (ASort (S n0) n) k0)) (aplus_asucc gz k0 (ASort (S +n0) n))) (ASort (minus n0 k0) n) (IH n0 H4))))))) (le_gen_S k0 (S n0) H0))))) +h)))) k)). + +theorem next_plus_gz: + \forall (n: nat).(\forall (h: nat).(eq nat (next_plus gz n h) (plus h n))) +\def + \lambda (n: nat).(\lambda (h: nat).(nat_ind (\lambda (n0: nat).(eq nat +(next_plus gz n n0) (plus n0 n))) (refl_equal nat n) (\lambda (n0: +nat).(\lambda (H: (eq nat (next_plus gz n n0) (plus n0 n))).(f_equal nat nat +S (next_plus gz n n0) (plus n0 n) H))) h)). + +theorem leqz_leq: + \forall (a1: A).(\forall (a2: A).((leq gz a1 a2) \to (leqz a1 a2))) +\def + \lambda (a1: A).(\lambda (a2: A).(\lambda (H: (leq gz a1 a2)).(leq_ind gz +(\lambda (a: A).(\lambda (a0: A).(leqz a a0))) (\lambda (h1: nat).(\lambda +(h2: nat).(\lambda (n1: nat).(\lambda (n2: nat).(\lambda (k: nat).(\lambda +(H0: (eq A (aplus gz (ASort h1 n1) k) (aplus gz (ASort h2 n2) k))).(lt_le_e k +h1 (leqz (ASort h1 n1) (ASort h2 n2)) (\lambda (H1: (lt k h1)).(lt_le_e k h2 +(leqz (ASort h1 n1) (ASort h2 n2)) (\lambda (H2: (lt k h2)).(let H3 \def +(eq_ind A (aplus gz (ASort h1 n1) k) (\lambda (a: A).(eq A a (aplus gz (ASort +h2 n2) k))) H0 (ASort (minus h1 k) n1) (aplus_gz_ge n1 k h1 (le_S_n k h1 +(le_S (S k) h1 H1)))) in (let H4 \def (eq_ind A (aplus gz (ASort h2 n2) k) +(\lambda (a: A).(eq A (ASort (minus h1 k) n1) a)) H3 (ASort (minus h2 k) n2) +(aplus_gz_ge n2 k h2 (le_S_n k h2 (le_S (S k) h2 H2)))) in (let H5 \def +(f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) with +[(ASort n _) \Rightarrow n | (AHead _ _) \Rightarrow ((let rec minus (n: nat) +on n: (nat \to nat) \def (\lambda (m: nat).(match n with [O \Rightarrow O | +(S k0) \Rightarrow (match m with [O \Rightarrow (S k0) | (S l) \Rightarrow +(minus k0 l)])])) in minus) h1 k)])) (ASort (minus h1 k) n1) (ASort (minus h2 +k) n2) H4) in ((let H6 \def (f_equal A nat (\lambda (e: A).(match e in A +return (\lambda (_: A).nat) with [(ASort _ n) \Rightarrow n | (AHead _ _) +\Rightarrow n1])) (ASort (minus h1 k) n1) (ASort (minus h2 k) n2) H4) in +(\lambda (H7: (eq nat (minus h1 k) (minus h2 k))).(eq_ind nat n1 (\lambda (n: +nat).(leqz (ASort h1 n1) (ASort h2 n))) (eq_ind nat h1 (\lambda (n: +nat).(leqz (ASort h1 n1) (ASort n n1))) (leqz_sort h1 h1 n1 n1 (refl_equal +nat (plus h1 n1))) h2 (minus_minus k h1 h2 (le_S_n k h1 (le_S (S k) h1 H1)) +(le_S_n k h2 (le_S (S k) h2 H2)) H7)) n2 H6))) H5))))) (\lambda (H2: (le h2 +k)).(let H3 \def (eq_ind A (aplus gz (ASort h1 n1) k) (\lambda (a: A).(eq A a +(aplus gz (ASort h2 n2) k))) H0 (ASort (minus h1 k) n1) (aplus_gz_ge n1 k h1 +(le_S_n k h1 (le_S (S k) h1 H1)))) in (let H4 \def (eq_ind A (aplus gz (ASort +h2 n2) k) (\lambda (a: A).(eq A (ASort (minus h1 k) n1) a)) H3 (ASort O (plus +(minus k h2) n2)) (aplus_gz_le k h2 n2 H2)) in (let H5 \def (eq_ind nat +(minus h1 k) (\lambda (n: nat).(eq A (ASort n n1) (ASort O (plus (minus k h2) +n2)))) H4 (S (minus h1 (S k))) (minus_x_Sy h1 k H1)) in (let H6 \def (eq_ind +A (ASort (S (minus h1 (S k))) n1) (\lambda (ee: A).(match ee in A return +(\lambda (_: A).Prop) with [(ASort n _) \Rightarrow (match n in nat return +(\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow True]) +| (AHead _ _) \Rightarrow False])) I (ASort O (plus (minus k h2) n2)) H5) in +(False_ind (leqz (ASort h1 n1) (ASort h2 n2)) H6)))))))) (\lambda (H1: (le h1 +k)).(lt_le_e k h2 (leqz (ASort h1 n1) (ASort h2 n2)) (\lambda (H2: (lt k +h2)).(let H3 \def (eq_ind A (aplus gz (ASort h1 n1) k) (\lambda (a: A).(eq A +a (aplus gz (ASort h2 n2) k))) H0 (ASort O (plus (minus k h1) n1)) +(aplus_gz_le k h1 n1 H1)) in (let H4 \def (eq_ind A (aplus gz (ASort h2 n2) +k) (\lambda (a: A).(eq A (ASort O (plus (minus k h1) n1)) a)) H3 (ASort +(minus h2 k) n2) (aplus_gz_ge n2 k h2 (le_S_n k h2 (le_S (S k) h2 H2)))) in +(let H5 \def (sym_eq A (ASort O (plus (minus k h1) n1)) (ASort (minus h2 k) +n2) H4) in (let H6 \def (eq_ind nat (minus h2 k) (\lambda (n: nat).(eq A +(ASort n n2) (ASort O (plus (minus k h1) n1)))) H5 (S (minus h2 (S k))) +(minus_x_Sy h2 k H2)) in (let H7 \def (eq_ind A (ASort (S (minus h2 (S k))) +n2) (\lambda (ee: A).(match ee in A return (\lambda (_: A).Prop) with [(ASort +n _) \Rightarrow (match n in nat return (\lambda (_: nat).Prop) with [O +\Rightarrow False | (S _) \Rightarrow True]) | (AHead _ _) \Rightarrow +False])) I (ASort O (plus (minus k h1) n1)) H6) in (False_ind (leqz (ASort h1 +n1) (ASort h2 n2)) H7))))))) (\lambda (H2: (le h2 k)).(let H3 \def (eq_ind A +(aplus gz (ASort h1 n1) k) (\lambda (a: A).(eq A a (aplus gz (ASort h2 n2) +k))) H0 (ASort O (plus (minus k h1) n1)) (aplus_gz_le k h1 n1 H1)) in (let H4 +\def (eq_ind A (aplus gz (ASort h2 n2) k) (\lambda (a: A).(eq A (ASort O +(plus (minus k h1) n1)) a)) H3 (ASort O (plus (minus k h2) n2)) (aplus_gz_le +k h2 n2 H2)) in (let H5 \def (f_equal A nat (\lambda (e: A).(match e in A +return (\lambda (_: A).nat) with [(ASort _ n) \Rightarrow n | (AHead _ _) +\Rightarrow ((let rec plus (n: nat) on n: (nat \to nat) \def (\lambda (m: +nat).(match n with [O \Rightarrow m | (S p) \Rightarrow (S (plus p m))])) in +plus) (minus k h1) n1)])) (ASort O (plus (minus k h1) n1)) (ASort O (plus +(minus k h2) n2)) H4) in (let H_y \def (plus_plus k h1 h2 n1 n2 H1 H2 H5) in +(leqz_sort h1 h2 n1 n2 H_y))))))))))))))) (\lambda (a0: A).(\lambda (a3: +A).(\lambda (_: (leq gz a0 a3)).(\lambda (H1: (leqz a0 a3)).(\lambda (a4: +A).(\lambda (a5: A).(\lambda (_: (leq gz a4 a5)).(\lambda (H3: (leqz a4 +a5)).(leqz_head a0 a3 H1 a4 a5 H3))))))))) a1 a2 H))). + +theorem leq_leqz: + \forall (a1: A).(\forall (a2: A).((leqz a1 a2) \to (leq gz a1 a2))) +\def + \lambda (a1: A).(\lambda (a2: A).(\lambda (H: (leqz a1 a2)).(leqz_ind +(\lambda (a: A).(\lambda (a0: A).(leq gz a a0))) (\lambda (h1: nat).(\lambda +(h2: nat).(\lambda (n1: nat).(\lambda (n2: nat).(\lambda (H0: (eq nat (plus +h1 n2) (plus h2 n1))).(leq_sort gz h1 h2 n1 n2 (plus h1 h2) (eq_ind_r A +(ASort (minus h1 (plus h1 h2)) (next_plus gz n1 (minus (plus h1 h2) h1))) +(\lambda (a: A).(eq A a (aplus gz (ASort h2 n2) (plus h1 h2)))) (eq_ind_r A +(ASort (minus h2 (plus h1 h2)) (next_plus gz n2 (minus (plus h1 h2) h2))) +(\lambda (a: A).(eq A (ASort (minus h1 (plus h1 h2)) (next_plus gz n1 (minus +(plus h1 h2) h1))) a)) (eq_ind_r nat h2 (\lambda (n: nat).(eq A (ASort (minus +h1 (plus h1 h2)) (next_plus gz n1 n)) (ASort (minus h2 (plus h1 h2)) +(next_plus gz n2 (minus (plus h1 h2) h2))))) (eq_ind_r nat h1 (\lambda (n: +nat).(eq A (ASort (minus h1 (plus h1 h2)) (next_plus gz n1 h2)) (ASort (minus +h2 (plus h1 h2)) (next_plus gz n2 n)))) (eq_ind_r nat O (\lambda (n: nat).(eq +A (ASort n (next_plus gz n1 h2)) (ASort (minus h2 (plus h1 h2)) (next_plus gz +n2 h1)))) (eq_ind_r nat O (\lambda (n: nat).(eq A (ASort O (next_plus gz n1 +h2)) (ASort n (next_plus gz n2 h1)))) (eq_ind_r nat (plus h2 n1) (\lambda (n: +nat).(eq A (ASort O n) (ASort O (next_plus gz n2 h1)))) (eq_ind_r nat (plus +h1 n2) (\lambda (n: nat).(eq A (ASort O (plus h2 n1)) (ASort O n))) (f_equal +nat A (ASort O) (plus h2 n1) (plus h1 n2) (sym_eq nat (plus h1 n2) (plus h2 +n1) H0)) (next_plus gz n2 h1) (next_plus_gz n2 h1)) (next_plus gz n1 h2) +(next_plus_gz n1 h2)) (minus h2 (plus h1 h2)) (O_minus h2 (plus h1 h2) +(le_plus_r h1 h2))) (minus h1 (plus h1 h2)) (O_minus h1 (plus h1 h2) +(le_plus_l h1 h2))) (minus (plus h1 h2) h2) (minus_plus_r h1 h2)) (minus +(plus h1 h2) h1) (minus_plus h1 h2)) (aplus gz (ASort h2 n2) (plus h1 h2)) +(aplus_asort_simpl gz (plus h1 h2) h2 n2)) (aplus gz (ASort h1 n1) (plus h1 +h2)) (aplus_asort_simpl gz (plus h1 h2) h1 n1)))))))) (\lambda (a0: +A).(\lambda (a3: A).(\lambda (_: (leqz a0 a3)).(\lambda (H1: (leq gz a0 +a3)).(\lambda (a4: A).(\lambda (a5: A).(\lambda (_: (leqz a4 a5)).(\lambda +(H3: (leq gz a4 a5)).(leq_head gz a0 a3 H1 a4 a5 H3))))))))) a1 a2 H))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/defs.ma new file mode 100644 index 000000000..3e16c05ed --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/defs.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ex1/defs". + +include "C/defs.ma". + +definition ex1_c: + C +\def + CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(Bind Abst) (TLRef O). + +definition ex1_t: + T +\def + THead (Flat Appl) (TLRef O) (THead (Bind Abst) (TLRef (S (S O))) (TSort O)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/props.ma new file mode 100644 index 000000000..218efc455 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/props.ma @@ -0,0 +1,542 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ex1/props". + +include "ex1/defs.ma". + +include "ty3/fwd.ma". + +include "pc3/fwd.ma". + +include "nf2/pr3.ma". + +include "nf2/props.ma". + +include "arity/defs.ma". + +include "leq/props.ma". + +theorem ex1__leq_sort_SS: + \forall (g: G).(\forall (k: nat).(\forall (n: nat).(leq g (ASort k n) (asucc +g (asucc g (ASort (S (S k)) n)))))) +\def + \lambda (g: G).(\lambda (k: nat).(\lambda (n: nat).(leq_refl g (asucc g +(asucc g (ASort (S (S k)) n)))))). + +theorem ex1_arity: + \forall (g: G).(arity g ex1_c ex1_t (ASort O O)) +\def + \lambda (g: G).(arity_appl g (CHead (CHead (CHead (CSort O) (Bind Abst) +(TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef O) (ASort (S +(S O)) O) (arity_abst g (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (TLRef O) O (getl_refl Abst (CHead +(CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (TLRef O)) +(ASort (S (S O)) O) (arity_abst g (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) (CHead (CSort O) (Bind Abst) (TSort O)) (TSort O) +O (getl_refl Abst (CHead (CSort O) (Bind Abst) (TSort O)) (TSort O)) (asucc g +(ASort (S (S O)) O)) (arity_repl g (CHead (CSort O) (Bind Abst) (TSort O)) +(TSort O) (ASort O O) (arity_sort g (CHead (CSort O) (Bind Abst) (TSort O)) +O) (asucc g (asucc g (ASort (S (S O)) O))) (ex1__leq_sort_SS g O O)))) (THead +(Bind Abst) (TLRef (S (S O))) (TSort O)) (ASort O O) (arity_head g (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (TLRef (S (S O))) (ASort (S (S O)) O) (arity_abst g (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CSort O) (TSort O) (S (S O)) (getl_clear_bind Abst (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (TLRef O) (clear_bind Abst (CHead (CHead (CSort O) (Bind Abst) +(TSort O)) (Bind Abst) (TSort O)) (TLRef O)) (CHead (CSort O) (Bind Abst) +(TSort O)) (S O) (getl_head (Bind Abst) O (CHead (CSort O) (Bind Abst) (TSort +O)) (CHead (CSort O) (Bind Abst) (TSort O)) (getl_refl Abst (CSort O) (TSort +O)) (TSort O))) (asucc g (ASort (S (S O)) O)) (arity_repl g (CSort O) (TSort +O) (ASort O O) (arity_sort g (CSort O) O) (asucc g (asucc g (ASort (S (S O)) +O))) (ex1__leq_sort_SS g O O))) (TSort O) (ASort O O) (arity_sort g (CHead +(CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(Bind Abst) (TLRef O)) (Bind Abst) (TLRef (S (S O)))) O))). + +theorem ex1_ty3: + \forall (g: G).(\forall (u: T).((ty3 g ex1_c ex1_t u) \to (\forall (P: +Prop).P))) +\def + \lambda (g: G).(\lambda (u: T).(\lambda (H: (ty3 g (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (THead (Flat Appl) (TLRef O) (THead (Bind Abst) (TLRef (S (S O))) (TSort +O))) u)).(\lambda (P: Prop).(ex3_2_ind T T (\lambda (u0: T).(\lambda (t: +T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (THead (Flat Appl) (TLRef O) (THead (Bind +Abst) u0 t)) u))) (\lambda (u0: T).(\lambda (t: T).(ty3 g (CHead (CHead +(CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) +(TLRef O)) (THead (Bind Abst) (TLRef (S (S O))) (TSort O)) (THead (Bind Abst) +u0 t)))) (\lambda (u0: T).(\lambda (_: T).(ty3 g (CHead (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) +(TLRef O) u0))) P (\lambda (x0: T).(\lambda (x1: T).(\lambda (_: (pc3 (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (THead (Flat Appl) (TLRef O) (THead (Bind Abst) x0 x1)) +u)).(\lambda (H1: (ty3 g (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (THead (Bind Abst) (TLRef +(S (S O))) (TSort O)) (THead (Bind Abst) x0 x1))).(\lambda (H2: (ty3 g (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (TLRef O) x0)).(or_ind (ex3_3 C T T (\lambda (_: C).(\lambda +(_: T).(\lambda (t: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S O) O t) x0)))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl O (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t: T).(ty3 g e u0 t))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S O) O u0) x0)))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl O (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t: T).(ty3 g e u0 t))))) P (\lambda (H3: (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S O) O +t) x0)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl O (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t: T).(ty3 g e u0 t)))))).(ex3_3_ind C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S O) O +t) x0)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl O (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t: T).(ty3 g e u0 t)))) P (\lambda (x2: C).(\lambda (x3: +T).(\lambda (x4: T).(\lambda (_: (pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S O) O +x4) x0)).(\lambda (H5: (getl O (CHead (CHead (CHead (CSort O) (Bind Abst) +(TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (CHead x2 (Bind +Abbr) x3))).(\lambda (_: (ty3 g x2 x3 x4)).(ex4_3_ind T T T (\lambda (t2: +T).(\lambda (_: T).(\lambda (_: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (THead (Bind +Abst) (TLRef (S (S O))) t2) (THead (Bind Abst) x0 x1))))) (\lambda (_: +T).(\lambda (t: T).(\lambda (_: T).(ty3 g (CHead (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef +(S (S O))) t)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g +(CHead (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (Bind Abst) (TLRef (S (S O)))) (TSort O) +t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t0: T).(ty3 g (CHead (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (Bind Abst) (TLRef (S (S O)))) t2 t0)))) P (\lambda (x5: +T).(\lambda (x6: T).(\lambda (x7: T).(\lambda (_: (pc3 (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (THead (Bind Abst) (TLRef (S (S O))) x5) (THead (Bind Abst) x0 +x1))).(\lambda (H8: (ty3 g (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef (S (S O))) +x6)).(\lambda (_: (ty3 g (CHead (CHead (CHead (CHead (CSort O) (Bind Abst) +(TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (Bind Abst) (TLRef +(S (S O)))) (TSort O) x5)).(\lambda (_: (ty3 g (CHead (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (Bind Abst) (TLRef (S (S O)))) x5 x7)).(or_ind (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S +O))) O t) x6)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S (S +O)) (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort +O)) (Bind Abst) (TLRef O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t))))) (ex3_3 C T T (\lambda +(_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 (CHead (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S +(S (S O))) O u0) x6)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl (S (S O)) (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (CHead e (Bind Abst) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t))))) P +(\lambda (H11: (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: +T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S O))) O t) x6)))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S (S O)) (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t: T).(ty3 g e u0 t)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (_: +T).(\lambda (t: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S O))) O t) x6)))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S (S O)) (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t: T).(ty3 g e u0 t)))) P (\lambda (x8: C).(\lambda (x9: +T).(\lambda (x10: T).(\lambda (_: (pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S +O))) O x10) x6)).(\lambda (H13: (getl (S (S O)) (CHead (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) +(CHead x8 (Bind Abbr) x9))).(\lambda (_: (ty3 g x8 x9 x10)).(let H15 \def +(getl_gen_all (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (CHead x8 (Bind Abbr) x9) (r (Bind Abst) (S O)) (getl_gen_S (Bind +Abst) (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(CHead x8 (Bind Abbr) x9) (TLRef O) (S O) H13)) in (ex2_ind C (\lambda (e: +C).(drop (S O) O (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) e)) (\lambda (e: C).(clear e (CHead x8 (Bind Abbr) x9))) P +(\lambda (x: C).(\lambda (_: (drop (S O) O (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) x)).(\lambda (_: (clear x (CHead x8 +(Bind Abbr) x9))).(let H18 \def (eq_ind C (CHead x2 (Bind Abbr) x3) (\lambda +(ee: C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind b) \Rightarrow (match b in B return (\lambda (_: +B).Prop) with [Abbr \Rightarrow True | Abst \Rightarrow False | Void +\Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (clear_gen_bind Abst (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (CHead x2 (Bind Abbr) x3) (TLRef O) (getl_gen_O (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead x2 (Bind Abbr) x3) H5))) in (False_ind P H18))))) +H15)))))))) H11)) (\lambda (H11: (ex3_3 C T T (\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S O))) O u0) +x6)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S (S O)) +(CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(Bind Abst) (TLRef O)) (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda +(u0: T).(\lambda (t: T).(ty3 g e u0 t)))))).(ex3_3_ind C T T (\lambda (_: +C).(\lambda (u0: T).(\lambda (_: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S +O))) O u0) x6)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S +(S O)) (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t)))) P (\lambda (x8: +C).(\lambda (x9: T).(\lambda (x10: T).(\lambda (_: (pc3 (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (lift (S (S (S O))) O x9) x6)).(\lambda (H13: (getl (S (S O)) (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead x8 (Bind Abst) x9))).(\lambda (_: (ty3 g x8 x9 +x10)).(let H15 \def (getl_gen_all (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) (CHead x8 (Bind Abst) x9) (r (Bind Abst) (S O)) +(getl_gen_S (Bind Abst) (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (CHead x8 (Bind Abst) x9) (TLRef O) (S O) H13)) in (ex2_ind +C (\lambda (e: C).(drop (S O) O (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) e)) (\lambda (e: C).(clear e (CHead x8 (Bind Abst) +x9))) P (\lambda (x: C).(\lambda (_: (drop (S O) O (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) x)).(\lambda (_: (clear x +(CHead x8 (Bind Abst) x9))).(let H18 \def (eq_ind C (CHead x2 (Bind Abbr) x3) +(\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind b) \Rightarrow (match b in B return (\lambda (_: +B).Prop) with [Abbr \Rightarrow True | Abst \Rightarrow False | Void +\Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (clear_gen_bind Abst (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (CHead x2 (Bind Abbr) x3) (TLRef O) (getl_gen_O (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead x2 (Bind Abbr) x3) H5))) in (False_ind P H18))))) +H15)))))))) H11)) (ty3_gen_lref g (CHead (CHead (CHead (CSort O) (Bind Abst) +(TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) x6 (S (S O)) +H8))))))))) (ty3_gen_bind g Abst (CHead (CHead (CHead (CSort O) (Bind Abst) +(TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef (S (S O))) +(TSort O) (THead (Bind Abst) x0 x1) H1)))))))) H3)) (\lambda (H3: (ex3_3 C T +T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (lift (S O) O u0) x0)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl O (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t)))))).(ex3_3_ind C T T +(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (lift (S O) O u0) x0)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl O (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t)))) P (\lambda (x2: +C).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H4: (pc3 (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (lift (S O) O x3) x0)).(\lambda (H5: (getl O (CHead (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) +(CHead x2 (Bind Abst) x3))).(\lambda (H6: (ty3 g x2 x3 x4)).(ex4_3_ind T T T +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (THead (Bind Abst) (TLRef (S (S O))) t2) (THead (Bind Abst) x0 x1))))) +(\lambda (_: T).(\lambda (t: T).(\lambda (_: T).(ty3 g (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (TLRef (S (S O))) t)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (_: +T).(ty3 g (CHead (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (Bind Abst) (TLRef O)) (Bind Abst) (TLRef (S (S O)))) (TSort +O) t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t0: T).(ty3 g (CHead +(CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(Bind Abst) (TLRef O)) (Bind Abst) (TLRef (S (S O)))) t2 t0)))) P (\lambda +(x5: T).(\lambda (x6: T).(\lambda (x7: T).(\lambda (H7: (pc3 (CHead (CHead +(CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) +(TLRef O)) (THead (Bind Abst) (TLRef (S (S O))) x5) (THead (Bind Abst) x0 +x1))).(\lambda (H8: (ty3 g (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef (S (S O))) +x6)).(\lambda (_: (ty3 g (CHead (CHead (CHead (CHead (CSort O) (Bind Abst) +(TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (Bind Abst) (TLRef +(S (S O)))) (TSort O) x5)).(\lambda (_: (ty3 g (CHead (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (Bind Abst) (TLRef (S (S O)))) x5 x7)).(or_ind (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S +O))) O t) x6)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S (S +O)) (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort +O)) (Bind Abst) (TLRef O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t))))) (ex3_3 C T T (\lambda +(_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 (CHead (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S +(S (S O))) O u0) x6)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl (S (S O)) (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (CHead e (Bind Abst) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t))))) P +(\lambda (H11: (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: +T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S O))) O t) x6)))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S (S O)) (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t: T).(ty3 g e u0 t)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (_: +T).(\lambda (t: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S O))) O t) x6)))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S (S O)) (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t: T).(ty3 g e u0 t)))) P (\lambda (x8: C).(\lambda (x9: +T).(\lambda (x10: T).(\lambda (_: (pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S +O))) O x10) x6)).(\lambda (H13: (getl (S (S O)) (CHead (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) +(CHead x8 (Bind Abbr) x9))).(\lambda (_: (ty3 g x8 x9 x10)).(let H15 \def +(getl_gen_all (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (CHead x8 (Bind Abbr) x9) (r (Bind Abst) (S O)) (getl_gen_S (Bind +Abst) (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(CHead x8 (Bind Abbr) x9) (TLRef O) (S O) H13)) in (ex2_ind C (\lambda (e: +C).(drop (S O) O (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) e)) (\lambda (e: C).(clear e (CHead x8 (Bind Abbr) x9))) P +(\lambda (x: C).(\lambda (H16: (drop (S O) O (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) x)).(\lambda (H17: (clear x (CHead x8 +(Bind Abbr) x9))).(let H18 \def (f_equal C C (\lambda (e: C).(match e in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow x2 | (CHead c _ _) +\Rightarrow c])) (CHead x2 (Bind Abst) x3) (CHead (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) +(clear_gen_bind Abst (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (CHead x2 (Bind Abst) x3) (TLRef O) (getl_gen_O (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead x2 (Bind Abst) x3) H5))) in ((let H19 \def (f_equal C +T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow x3 | (CHead _ _ t) \Rightarrow t])) (CHead x2 (Bind Abst) x3) +(CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(Bind Abst) (TLRef O)) (clear_gen_bind Abst (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (CHead x2 (Bind Abst) x3) (TLRef O) +(getl_gen_O (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (CHead x2 (Bind Abst) x3) H5))) in (\lambda +(H20: (eq C x2 (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)))).(let H21 \def (eq_ind T x3 (\lambda (t: T).(ty3 g x2 t x4)) H6 +(TLRef O) H19) in (let H22 \def (eq_ind T x3 (\lambda (t: T).(pc3 (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (lift (S O) O t) x0)) H4 (TLRef O) H19) in (let H23 \def +(eq_ind C x2 (\lambda (c: C).(ty3 g c (TLRef O) x4)) H21 (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) H20) in (let H24 \def +(eq_ind_r C x (\lambda (c: C).(clear c (CHead x8 (Bind Abbr) x9))) H17 (CHead +(CSort O) (Bind Abst) (TSort O)) (drop_gen_refl (CHead (CSort O) (Bind Abst) +(TSort O)) x (drop_gen_drop (Bind Abst) (CHead (CSort O) (Bind Abst) (TSort +O)) x (TSort O) O H16))) in (let H25 \def (eq_ind C (CHead x8 (Bind Abbr) x9) +(\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind b) \Rightarrow (match b in B return (\lambda (_: +B).Prop) with [Abbr \Rightarrow True | Abst \Rightarrow False | Void +\Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead (CSort O) +(Bind Abst) (TSort O)) (clear_gen_bind Abst (CSort O) (CHead x8 (Bind Abbr) +x9) (TSort O) H24)) in (False_ind P H25)))))))) H18))))) H15)))))))) H11)) +(\lambda (H11: (ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: +T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S O))) O u0) x6)))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S (S O)) (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t: T).(ty3 g e u0 t)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S O))) O u0) +x6)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl (S (S O)) +(CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(Bind Abst) (TLRef O)) (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda +(u0: T).(\lambda (t: T).(ty3 g e u0 t)))) P (\lambda (x8: C).(\lambda (x9: +T).(\lambda (x10: T).(\lambda (H12: (pc3 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S +O))) O x9) x6)).(\lambda (H13: (getl (S (S O)) (CHead (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (CHead +x8 (Bind Abst) x9))).(\lambda (H14: (ty3 g x8 x9 x10)).(let H15 \def +(getl_gen_all (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (CHead x8 (Bind Abst) x9) (r (Bind Abst) (S O)) (getl_gen_S (Bind +Abst) (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(CHead x8 (Bind Abst) x9) (TLRef O) (S O) H13)) in (ex2_ind C (\lambda (e: +C).(drop (S O) O (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) e)) (\lambda (e: C).(clear e (CHead x8 (Bind Abst) x9))) P +(\lambda (x: C).(\lambda (H16: (drop (S O) O (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) x)).(\lambda (H17: (clear x (CHead x8 +(Bind Abst) x9))).(let H18 \def (f_equal C C (\lambda (e: C).(match e in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow x2 | (CHead c _ _) +\Rightarrow c])) (CHead x2 (Bind Abst) x3) (CHead (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) +(clear_gen_bind Abst (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (CHead x2 (Bind Abst) x3) (TLRef O) (getl_gen_O (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (CHead x2 (Bind Abst) x3) H5))) in ((let H19 \def (f_equal C +T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow x3 | (CHead _ _ t) \Rightarrow t])) (CHead x2 (Bind Abst) x3) +(CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(Bind Abst) (TLRef O)) (clear_gen_bind Abst (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (CHead x2 (Bind Abst) x3) (TLRef O) +(getl_gen_O (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (CHead x2 (Bind Abst) x3) H5))) in (\lambda +(H20: (eq C x2 (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)))).(let H21 \def (eq_ind T x3 (\lambda (t: T).(ty3 g x2 t x4)) H6 +(TLRef O) H19) in (let H22 \def (eq_ind T x3 (\lambda (t: T).(pc3 (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (lift (S O) O t) x0)) H4 (TLRef O) H19) in (let H23 \def +(eq_ind C x2 (\lambda (c: C).(ty3 g c (TLRef O) x4)) H21 (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) H20) in (let H24 \def +(eq_ind_r C x (\lambda (c: C).(clear c (CHead x8 (Bind Abst) x9))) H17 (CHead +(CSort O) (Bind Abst) (TSort O)) (drop_gen_refl (CHead (CSort O) (Bind Abst) +(TSort O)) x (drop_gen_drop (Bind Abst) (CHead (CSort O) (Bind Abst) (TSort +O)) x (TSort O) O H16))) in (let H25 \def (f_equal C C (\lambda (e: C).(match +e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow x8 | (CHead c _ +_) \Rightarrow c])) (CHead x8 (Bind Abst) x9) (CHead (CSort O) (Bind Abst) +(TSort O)) (clear_gen_bind Abst (CSort O) (CHead x8 (Bind Abst) x9) (TSort O) +H24)) in ((let H26 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow x9 | (CHead _ _ t) \Rightarrow +t])) (CHead x8 (Bind Abst) x9) (CHead (CSort O) (Bind Abst) (TSort O)) +(clear_gen_bind Abst (CSort O) (CHead x8 (Bind Abst) x9) (TSort O) H24)) in +(\lambda (H27: (eq C x8 (CSort O))).(let H28 \def (eq_ind T x9 (\lambda (t: +T).(ty3 g x8 t x10)) H14 (TSort O) H26) in (let H29 \def (eq_ind T x9 +(\lambda (t: T).(pc3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift (S (S (S O))) O t) x6)) +H12 (TSort O) H26) in (let H30 \def (eq_ind C x8 (\lambda (c: C).(ty3 g c +(TSort O) x10)) H28 (CSort O) H27) in (or_ind (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t: T).(pc3 (CHead (CHead (CSort O) (Bind Abst) +(TSort O)) (Bind Abst) (TSort O)) (lift (S O) O t) x4)))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (_: T).(getl O (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (CHead e (Bind Abbr) u0))))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t))))) (ex3_3 C T T +(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (lift (S O) O u0) x4)))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl O (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (CHead e (Bind Abst) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t))))) P +(\lambda (H31: (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: +T).(pc3 (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(lift (S O) O t) x4)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl O (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort +O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t: T).(ty3 g e u0 t)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (_: +T).(\lambda (t: T).(pc3 (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (lift (S O) O t) x4)))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (_: T).(getl O (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda +(u0: T).(\lambda (t: T).(ty3 g e u0 t)))) P (\lambda (x11: C).(\lambda (x12: +T).(\lambda (x13: T).(\lambda (_: (pc3 (CHead (CHead (CSort O) (Bind Abst) +(TSort O)) (Bind Abst) (TSort O)) (lift (S O) O x13) x4)).(\lambda (H33: +(getl O (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(CHead x11 (Bind Abbr) x12))).(\lambda (_: (ty3 g x11 x12 x13)).(let H35 \def +(eq_ind C (CHead x11 (Bind Abbr) x12) (\lambda (ee: C).(match ee in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +True | Abst \Rightarrow False | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (clear_gen_bind Abst (CHead (CSort O) (Bind Abst) (TSort O)) +(CHead x11 (Bind Abbr) x12) (TSort O) (getl_gen_O (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (CHead x11 (Bind Abbr) x12) +H33))) in (False_ind P H35)))))))) H31)) (\lambda (H31: (ex3_3 C T T (\lambda +(_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (lift (S O) O u0) x4)))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (_: T).(getl O (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (CHead e (Bind Abst) u0))))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t)))))).(ex3_3_ind C T T +(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (lift (S O) O u0) x4)))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl O (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (CHead e (Bind Abst) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t)))) P (\lambda +(x11: C).(\lambda (x12: T).(\lambda (x13: T).(\lambda (H32: (pc3 (CHead +(CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (lift (S O) O +x12) x4)).(\lambda (H33: (getl O (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) (CHead x11 (Bind Abst) x12))).(\lambda (H34: (ty3 +g x11 x12 x13)).(let H35 \def (f_equal C C (\lambda (e: C).(match e in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow x11 | (CHead c _ _) +\Rightarrow c])) (CHead x11 (Bind Abst) x12) (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (clear_gen_bind Abst (CHead (CSort O) +(Bind Abst) (TSort O)) (CHead x11 (Bind Abst) x12) (TSort O) (getl_gen_O +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (CHead +x11 (Bind Abst) x12) H33))) in ((let H36 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow x12 | +(CHead _ _ t) \Rightarrow t])) (CHead x11 (Bind Abst) x12) (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (clear_gen_bind Abst +(CHead (CSort O) (Bind Abst) (TSort O)) (CHead x11 (Bind Abst) x12) (TSort O) +(getl_gen_O (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort +O)) (CHead x11 (Bind Abst) x12) H33))) in (\lambda (H37: (eq C x11 (CHead +(CSort O) (Bind Abst) (TSort O)))).(let H38 \def (eq_ind T x12 (\lambda (t: +T).(ty3 g x11 t x13)) H34 (TSort O) H36) in (let H39 \def (eq_ind T x12 +(\lambda (t: T).(pc3 (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (lift (S O) O t) x4)) H32 (TSort O) H36) in (let H40 \def +(eq_ind C x11 (\lambda (c: C).(ty3 g c (TSort O) x13)) H38 (CHead (CSort O) +(Bind Abst) (TSort O)) H37) in (and_ind (pc3 (CHead (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef +(S (S O))) x0) (\forall (b: B).(\forall (u0: T).(pc3 (CHead (CHead (CHead +(CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) +(TLRef O)) (Bind b) u0) x5 x1))) P (\lambda (H41: (pc3 (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (TLRef (S (S O))) x0)).(\lambda (_: ((\forall (b: B).(\forall (u0: +T).(pc3 (CHead (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (Bind Abst) (TLRef O)) (Bind b) u0) x5 x1))))).(let H43 \def +(eq_ind T (lift (S O) O (TLRef O)) (\lambda (t: T).(pc3 (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) (TLRef (S (S O))) t)) (pc3_t x0 (CHead (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef (S (S +O))) H41 (lift (S O) O (TLRef O)) (ex2_sym T (pr3 (CHead (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (lift +(S O) O (TLRef O))) (pr3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) x0) H22)) (TLRef (plus O (S +O))) (lift_lref_ge O (S O) O (le_n O))) in (let H44 \def H43 in (ex2_ind T +(\lambda (t: T).(pr3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef (S (S O))) t)) (\lambda +(t: T).(pr3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) +(TSort O)) (Bind Abst) (TLRef O)) (TLRef (S O)) t)) P (\lambda (x14: +T).(\lambda (H45: (pr3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef (S (S O))) +x14)).(\lambda (H46: (pr3 (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort +O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef (S O)) x14)).(let +H47 \def (eq_ind_r T x14 (\lambda (t: T).(eq T (TLRef (S (S O))) t)) +(nf2_pr3_unfold (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef (S (S O))) x14 H45 +(nf2_lref_abst (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (Bind Abst) (TLRef O)) (CSort O) (TSort O) (S (S O)) +(getl_clear_bind Abst (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (CHead (CHead (CSort O) (Bind +Abst) (TSort O)) (Bind Abst) (TSort O)) (TLRef O) (clear_bind Abst (CHead +(CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (TLRef O)) +(CHead (CSort O) (Bind Abst) (TSort O)) (S O) (getl_head (Bind Abst) O (CHead +(CSort O) (Bind Abst) (TSort O)) (CHead (CSort O) (Bind Abst) (TSort O)) +(getl_refl Abst (CSort O) (TSort O)) (TSort O))))) (TLRef (S O)) +(nf2_pr3_unfold (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef (S O)) x14 H46 (nf2_lref_abst +(CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) +(Bind Abst) (TLRef O)) (CHead (CSort O) (Bind Abst) (TSort O)) (TSort O) (S +O) (getl_head (Bind Abst) O (CHead (CHead (CSort O) (Bind Abst) (TSort O)) +(Bind Abst) (TSort O)) (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (getl_refl Abst (CHead (CSort O) (Bind Abst) (TSort O)) +(TSort O)) (TLRef O))))) in (let H48 \def (eq_ind T (TLRef (S (S O))) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef n) \Rightarrow (match n in nat return (\lambda (_: +nat).Prop) with [O \Rightarrow False | (S n0) \Rightarrow (match n0 in nat +return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) \Rightarrow +True])]) | (THead _ _ _) \Rightarrow False])) I (TLRef (S O)) H47) in +(False_ind P H48)))))) H44))))) (pc3_gen_abst (CHead (CHead (CHead (CSort O) +(Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) (TLRef +(S (S O))) x0 x5 x1 H7))))))) H35)))))))) H31)) (ty3_gen_lref g (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) x4 O H23))))))) +H25)))))))) H18))))) H15)))))))) H11)) (ty3_gen_lref g (CHead (CHead (CHead +(CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef +O)) x6 (S (S O)) H8))))))))) (ty3_gen_bind g Abst (CHead (CHead (CHead (CSort +O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind Abst) (TLRef O)) +(TLRef (S (S O))) (TSort O) (THead (Bind Abst) x0 x1) H1)))))))) H3)) +(ty3_gen_lref g (CHead (CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind +Abst) (TSort O)) (Bind Abst) (TLRef O)) x0 O H2))))))) (ty3_gen_appl g (CHead +(CHead (CHead (CSort O) (Bind Abst) (TSort O)) (Bind Abst) (TSort O)) (Bind +Abst) (TLRef O)) (TLRef O) (THead (Bind Abst) (TLRef (S (S O))) (TSort O)) u +H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/defs.ma new file mode 100644 index 000000000..482249d5e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/defs.ma @@ -0,0 +1,30 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ex2/defs". + +include "C/defs.ma". + +definition ex2_c: + C +\def + CSort O. + +definition ex2_t: + T +\def + THead (Flat Appl) (TSort O) (TSort O). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/props.ma new file mode 100644 index 000000000..f35ee3579 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/props.ma @@ -0,0 +1,171 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ex2/props". + +include "ex2/defs.ma". + +include "nf2/defs.ma". + +include "pr2/fwd.ma". + +include "arity/fwd.ma". + +theorem ex2_nf2: + nf2 ex2_c ex2_t +\def + \lambda (t2: T).(\lambda (H: (pr2 (CSort O) (THead (Flat Appl) (TSort O) +(TSort O)) t2)).(let H0 \def (pr2_gen_appl (CSort O) (TSort O) (TSort O) t2 +H) in (or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 (CSort O) (TSort +O) u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 (CSort O) (TSort O) t3)))) +(ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(eq T (TSort O) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 (CSort O) (TSort O) u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead (CSort O) +(Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (TSort O) (THead (Bind b) y1 +z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: +T).(\lambda (u2: T).(\lambda (y2: T).(eq T t2 (THead (Bind b) y2 (THead (Flat +Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 (CSort O) (TSort +O) u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CSort O) y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead (CSort O) (Bind b) y2) z1 z2)))))))) (eq T (THead (Flat +Appl) (TSort O) (TSort O)) t2) (\lambda (H1: (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 (CSort O) (TSort O) u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 (CSort O) (TSort O) t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 (CSort O) (TSort O) u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 (CSort O) (TSort O) t3))) (eq T (THead (Flat Appl) (TSort O) +(TSort O)) t2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H2: (eq T t2 +(THead (Flat Appl) x0 x1))).(\lambda (H3: (pr2 (CSort O) (TSort O) +x0)).(\lambda (H4: (pr2 (CSort O) (TSort O) x1)).(let H5 \def (eq_ind T x1 +(\lambda (t: T).(eq T t2 (THead (Flat Appl) x0 t))) H2 (TSort O) +(pr2_gen_sort (CSort O) x1 O H4)) in (let H6 \def (eq_ind T x0 (\lambda (t: +T).(eq T t2 (THead (Flat Appl) t (TSort O)))) H5 (TSort O) (pr2_gen_sort +(CSort O) x0 O H3)) in (eq_ind_r T (THead (Flat Appl) (TSort O) (TSort O)) +(\lambda (t: T).(eq T (THead (Flat Appl) (TSort O) (TSort O)) t)) (refl_equal +T (THead (Flat Appl) (TSort O) (TSort O))) t2 H6)))))))) H1)) (\lambda (H1: +(ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(eq T (TSort O) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 (CSort O) (TSort O) u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead (CSort O) +(Bind b) u) z1 t3))))))))).(ex4_4_ind T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (TSort O) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 (CSort O) (TSort O) u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: +B).(\forall (u: T).(pr2 (CHead (CSort O) (Bind b) u) z1 t3))))))) (eq T +(THead (Flat Appl) (TSort O) (TSort O)) t2) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H2: (eq T (TSort O) (THead +(Bind Abst) x0 x1))).(\lambda (H3: (eq T t2 (THead (Bind Abbr) x2 +x3))).(\lambda (H4: (pr2 (CSort O) (TSort O) x2)).(\lambda (_: ((\forall (b: +B).(\forall (u: T).(pr2 (CHead (CSort O) (Bind b) u) x1 x3))))).(let H6 \def +(eq_ind T x2 (\lambda (t: T).(eq T t2 (THead (Bind Abbr) t x3))) H3 (TSort O) +(pr2_gen_sort (CSort O) x2 O H4)) in (eq_ind_r T (THead (Bind Abbr) (TSort O) +x3) (\lambda (t: T).(eq T (THead (Flat Appl) (TSort O) (TSort O)) t)) (let H7 +\def (eq_ind T (TSort O) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow False])) I (THead (Bind Abst) x0 x1) H2) in +(False_ind (eq T (THead (Flat Appl) (TSort O) (TSort O)) (THead (Bind Abbr) +(TSort O) x3)) H7)) t2 H6)))))))))) H1)) (\lambda (H1: (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(TSort O) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 (CSort O) (TSort O) u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CSort O) y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead (CSort +O) (Bind b) y2) z1 z2))))))))).(ex6_6_ind B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (TSort O) +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t2 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 (CSort O) (TSort O) u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CSort O) y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead (CSort O) +(Bind b) y2) z1 z2))))))) (eq T (THead (Flat Appl) (TSort O) (TSort O)) t2) +(\lambda (x0: B).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda +(x4: T).(\lambda (x5: T).(\lambda (_: (not (eq B x0 Abst))).(\lambda (H3: (eq +T (TSort O) (THead (Bind x0) x1 x2))).(\lambda (H4: (eq T t2 (THead (Bind x0) +x5 (THead (Flat Appl) (lift (S O) O x4) x3)))).(\lambda (H5: (pr2 (CSort O) +(TSort O) x4)).(\lambda (H6: (pr2 (CSort O) x1 x5)).(\lambda (_: (pr2 (CHead +(CSort O) (Bind x0) x5) x2 x3)).(let H_y \def (pr2_gen_csort x1 x5 O H6) in +(let H8 \def (eq_ind T x4 (\lambda (t: T).(eq T t2 (THead (Bind x0) x5 (THead +(Flat Appl) (lift (S O) O t) x3)))) H4 (TSort O) (pr2_gen_sort (CSort O) x4 O +H5)) in (eq_ind_r T (THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) O +(TSort O)) x3)) (\lambda (t: T).(eq T (THead (Flat Appl) (TSort O) (TSort O)) +t)) (let H9 \def (eq_ind T (TSort O) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow False])) I (THead (Bind x0) x1 +x2) H3) in (False_ind (eq T (THead (Flat Appl) (TSort O) (TSort O)) (THead +(Bind x0) x5 (THead (Flat Appl) (lift (S O) O (TSort O)) x3))) H9)) t2 +H8))))))))))))))) H1)) H0))). + +theorem ex2_arity: + \forall (g: G).(\forall (a: A).((arity g ex2_c ex2_t a) \to (\forall (P: +Prop).P))) +\def + \lambda (g: G).(\lambda (a: A).(\lambda (H: (arity g (CSort O) (THead (Flat +Appl) (TSort O) (TSort O)) a)).(\lambda (P: Prop).(let H0 \def +(arity_gen_appl g (CSort O) (TSort O) (TSort O) a H) in (ex2_ind A (\lambda +(a1: A).(arity g (CSort O) (TSort O) a1)) (\lambda (a1: A).(arity g (CSort O) +(TSort O) (AHead a1 a))) P (\lambda (x: A).(\lambda (_: (arity g (CSort O) +(TSort O) x)).(\lambda (H2: (arity g (CSort O) (TSort O) (AHead x a))).(let +H3 \def (match (arity_gen_sort g (CSort O) O (AHead x a) H2) in leq return +(\lambda (a0: A).(\lambda (a1: A).(\lambda (_: (leq ? a0 a1)).((eq A a0 +(AHead x a)) \to ((eq A a1 (ASort O O)) \to P))))) with [(leq_sort h1 h2 n1 +n2 k H3) \Rightarrow (\lambda (H4: (eq A (ASort h1 n1) (AHead x a))).(\lambda +(H5: (eq A (ASort h2 n2) (ASort O O))).((let H6 \def (eq_ind A (ASort h1 n1) +(\lambda (e: A).(match e in A return (\lambda (_: A).Prop) with [(ASort _ _) +\Rightarrow True | (AHead _ _) \Rightarrow False])) I (AHead x a) H4) in +(False_ind ((eq A (ASort h2 n2) (ASort O O)) \to ((eq A (aplus g (ASort h1 +n1) k) (aplus g (ASort h2 n2) k)) \to P)) H6)) H5 H3))) | (leq_head a1 a2 H3 +a3 a4 H4) \Rightarrow (\lambda (H5: (eq A (AHead a1 a3) (AHead x +a))).(\lambda (H6: (eq A (AHead a2 a4) (ASort O O))).((let H7 \def (f_equal A +A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) +\Rightarrow a3 | (AHead _ a0) \Rightarrow a0])) (AHead a1 a3) (AHead x a) H5) +in ((let H8 \def (f_equal A A (\lambda (e: A).(match e in A return (\lambda +(_: A).A) with [(ASort _ _) \Rightarrow a1 | (AHead a0 _) \Rightarrow a0])) +(AHead a1 a3) (AHead x a) H5) in (eq_ind A x (\lambda (a0: A).((eq A a3 a) +\to ((eq A (AHead a2 a4) (ASort O O)) \to ((leq g a0 a2) \to ((leq g a3 a4) +\to P))))) (\lambda (H9: (eq A a3 a)).(eq_ind A a (\lambda (a0: A).((eq A +(AHead a2 a4) (ASort O O)) \to ((leq g x a2) \to ((leq g a0 a4) \to P)))) +(\lambda (H10: (eq A (AHead a2 a4) (ASort O O))).(let H11 \def (eq_ind A +(AHead a2 a4) (\lambda (e: A).(match e in A return (\lambda (_: A).Prop) with +[(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow True])) I (ASort O +O) H10) in (False_ind ((leq g x a2) \to ((leq g a a4) \to P)) H11))) a3 +(sym_eq A a3 a H9))) a1 (sym_eq A a1 x H8))) H7)) H6 H3 H4)))]) in (H3 +(refl_equal A (AHead x a)) (refl_equal A (ASort O O))))))) H0))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/defs.ma new file mode 100644 index 000000000..9143b89a2 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/defs.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/flt/defs". + +include "C/defs.ma". + +definition fweight: + C \to (T \to nat) +\def + \lambda (c: C).(\lambda (t: T).(plus (cweight c) (tweight t))). + +definition flt: + C \to (T \to (C \to (T \to Prop))) +\def + \lambda (c1: C).(\lambda (t1: T).(\lambda (c2: C).(\lambda (t2: T).(lt +(fweight c1 t1) (fweight c2 t2))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/props.ma new file mode 100644 index 000000000..a8d7daff3 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/props.ma @@ -0,0 +1,119 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/flt/props". + +include "flt/defs.ma". + +include "C/props.ma". + +theorem flt_thead_sx: + \forall (k: K).(\forall (c: C).(\forall (u: T).(\forall (t: T).(flt c u c +(THead k u t))))) +\def + \lambda (_: K).(\lambda (c: C).(\lambda (u: T).(\lambda (t: +T).(plus_le_lt_compat (cweight c) (cweight c) (tweight u) (S (plus (tweight +u) (tweight t))) (le_n (cweight c)) (le_n_S (tweight u) (plus (tweight u) +(tweight t)) (le_plus_l (tweight u) (tweight t))))))). + +theorem flt_thead_dx: + \forall (k: K).(\forall (c: C).(\forall (u: T).(\forall (t: T).(flt c t c +(THead k u t))))) +\def + \lambda (_: K).(\lambda (c: C).(\lambda (u: T).(\lambda (t: +T).(plus_le_lt_compat (cweight c) (cweight c) (tweight t) (S (plus (tweight +u) (tweight t))) (le_n (cweight c)) (le_n_S (tweight t) (plus (tweight u) +(tweight t)) (le_plus_r (tweight u) (tweight t))))))). + +theorem flt_shift: + \forall (k: K).(\forall (c: C).(\forall (u: T).(\forall (t: T).(flt (CHead c +k u) t c (THead k u t))))) +\def + \lambda (_: K).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(eq_ind nat +(S (plus (cweight c) (plus (tweight u) (tweight t)))) (\lambda (n: nat).(lt +(plus (plus (cweight c) (tweight u)) (tweight t)) n)) (eq_ind_r nat (plus +(plus (cweight c) (tweight u)) (tweight t)) (\lambda (n: nat).(lt (plus (plus +(cweight c) (tweight u)) (tweight t)) (S n))) (le_n (S (plus (plus (cweight +c) (tweight u)) (tweight t)))) (plus (cweight c) (plus (tweight u) (tweight +t))) (plus_assoc (cweight c) (tweight u) (tweight t))) (plus (cweight c) (S +(plus (tweight u) (tweight t)))) (plus_n_Sm (cweight c) (plus (tweight u) +(tweight t))))))). + +theorem flt_arith0: + \forall (k: K).(\forall (c: C).(\forall (t: T).(\forall (i: nat).(flt c t +(CHead c k t) (TLRef i))))) +\def + \lambda (_: K).(\lambda (c: C).(\lambda (t: T).(\lambda (_: +nat).(lt_x_plus_x_Sy (plus (cweight c) (tweight t)) O)))). + +theorem flt_arith1: + \forall (k1: K).(\forall (c1: C).(\forall (c2: C).(\forall (t1: T).((cle +(CHead c1 k1 t1) c2) \to (\forall (k2: K).(\forall (t2: T).(\forall (i: +nat).(flt c1 t1 (CHead c2 k2 t2) (TLRef i))))))))) +\def + \lambda (_: K).(\lambda (c1: C).(\lambda (c2: C).(\lambda (t1: T).(\lambda +(H: (le (plus (cweight c1) (tweight t1)) (cweight c2))).(\lambda (_: +K).(\lambda (t2: T).(\lambda (_: nat).(le_lt_trans (plus (cweight c1) +(tweight t1)) (cweight c2) (plus (plus (cweight c2) (tweight t2)) (S O)) H +(eq_ind_r nat (plus (S O) (plus (cweight c2) (tweight t2))) (\lambda (n: +nat).(lt (cweight c2) n)) (le_lt_n_Sm (cweight c2) (plus (cweight c2) +(tweight t2)) (le_plus_l (cweight c2) (tweight t2))) (plus (plus (cweight c2) +(tweight t2)) (S O)) (plus_comm (plus (cweight c2) (tweight t2)) (S +O))))))))))). + +theorem flt_arith2: + \forall (c1: C).(\forall (c2: C).(\forall (t1: T).(\forall (i: nat).((flt c1 +t1 c2 (TLRef i)) \to (\forall (k2: K).(\forall (t2: T).(\forall (j: nat).(flt +c1 t1 (CHead c2 k2 t2) (TLRef j))))))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (t1: T).(\lambda (_: nat).(\lambda +(H: (lt (plus (cweight c1) (tweight t1)) (plus (cweight c2) (S O)))).(\lambda +(_: K).(\lambda (t2: T).(\lambda (_: nat).(lt_le_trans (plus (cweight c1) +(tweight t1)) (plus (cweight c2) (S O)) (plus (plus (cweight c2) (tweight +t2)) (S O)) H (plus_le_compat (cweight c2) (plus (cweight c2) (tweight t2)) +(S O) (S O) (le_plus_l (cweight c2) (tweight t2)) (le_n (S O))))))))))). + +theorem flt_wf__q_ind: + \forall (P: ((C \to (T \to Prop)))).(((\forall (n: nat).((\lambda (P0: ((C +\to (T \to Prop)))).(\lambda (n0: nat).(\forall (c: C).(\forall (t: T).((eq +nat (fweight c t) n0) \to (P0 c t)))))) P n))) \to (\forall (c: C).(\forall +(t: T).(P c t)))) +\def + let Q \def (\lambda (P: ((C \to (T \to Prop)))).(\lambda (n: nat).(\forall +(c: C).(\forall (t: T).((eq nat (fweight c t) n) \to (P c t)))))) in (\lambda +(P: ((C \to (T \to Prop)))).(\lambda (H: ((\forall (n: nat).(\forall (c: +C).(\forall (t: T).((eq nat (fweight c t) n) \to (P c t))))))).(\lambda (c: +C).(\lambda (t: T).(H (fweight c t) c t (refl_equal nat (fweight c t))))))). + +theorem flt_wf_ind: + \forall (P: ((C \to (T \to Prop)))).(((\forall (c2: C).(\forall (t2: +T).(((\forall (c1: C).(\forall (t1: T).((flt c1 t1 c2 t2) \to (P c1 t1))))) +\to (P c2 t2))))) \to (\forall (c: C).(\forall (t: T).(P c t)))) +\def + let Q \def (\lambda (P: ((C \to (T \to Prop)))).(\lambda (n: nat).(\forall +(c: C).(\forall (t: T).((eq nat (fweight c t) n) \to (P c t)))))) in (\lambda +(P: ((C \to (T \to Prop)))).(\lambda (H: ((\forall (c2: C).(\forall (t2: +T).(((\forall (c1: C).(\forall (t1: T).((flt c1 t1 c2 t2) \to (P c1 t1))))) +\to (P c2 t2)))))).(\lambda (c: C).(\lambda (t: T).(flt_wf__q_ind P (\lambda +(n: nat).(lt_wf_ind n (Q P) (\lambda (n0: nat).(\lambda (H0: ((\forall (m: +nat).((lt m n0) \to (Q P m))))).(\lambda (c0: C).(\lambda (t0: T).(\lambda +(H1: (eq nat (fweight c0 t0) n0)).(let H2 \def (eq_ind_r nat n0 (\lambda (n1: +nat).(\forall (m: nat).((lt m n1) \to (\forall (c1: C).(\forall (t1: T).((eq +nat (fweight c1 t1) m) \to (P c1 t1))))))) H0 (fweight c0 t0) H1) in (H c0 t0 +(\lambda (c1: C).(\lambda (t1: T).(\lambda (H3: (flt c1 t1 c0 t0)).(H2 +(fweight c1 t1) H3 c1 t1 (refl_equal nat (fweight c1 t1))))))))))))))) c +t))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/defs.ma new file mode 100644 index 000000000..d3eccba43 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/defs.ma @@ -0,0 +1,30 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/fsubst0/defs". + +include "csubst0/defs.ma". + +include "subst0/defs.ma". + +inductive fsubst0 (i: nat) (v: T) (c1: C) (t1: T): C \to (T \to Prop) \def +| fsubst0_snd: \forall (t2: T).((subst0 i v t1 t2) \to (fsubst0 i v c1 t1 c1 +t2)) +| fsubst0_fst: \forall (c2: C).((csubst0 i v c1 c2) \to (fsubst0 i v c1 t1 c2 +t1)) +| fsubst0_both: \forall (t2: T).((subst0 i v t1 t2) \to (\forall (c2: +C).((csubst0 i v c1 c2) \to (fsubst0 i v c1 t1 c2 t2)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/fwd.ma new file mode 100644 index 000000000..773e57278 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/fwd.ma @@ -0,0 +1,67 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/fsubst0/fwd". + +include "fsubst0/defs.ma". + +theorem fsubst0_gen_base: + \forall (c1: C).(\forall (c2: C).(\forall (t1: T).(\forall (t2: T).(\forall +(v: T).(\forall (i: nat).((fsubst0 i v c1 t1 c2 t2) \to (or3 (land (eq C c1 +c2) (subst0 i v t1 t2)) (land (eq T t1 t2) (csubst0 i v c1 c2)) (land (subst0 +i v t1 t2) (csubst0 i v c1 c2))))))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(v: T).(\lambda (i: nat).(\lambda (H: (fsubst0 i v c1 t1 c2 t2)).(let H0 \def +(match H in fsubst0 return (\lambda (c: C).(\lambda (t: T).(\lambda (_: +(fsubst0 ? ? ? ? c t)).((eq C c c2) \to ((eq T t t2) \to (or3 (land (eq C c1 +c2) (subst0 i v t1 t2)) (land (eq T t1 t2) (csubst0 i v c1 c2)) (land (subst0 +i v t1 t2) (csubst0 i v c1 c2)))))))) with [(fsubst0_snd t0 H0) \Rightarrow +(\lambda (H1: (eq C c1 c2)).(\lambda (H2: (eq T t0 t2)).(eq_ind C c2 (\lambda +(c: C).((eq T t0 t2) \to ((subst0 i v t1 t0) \to (or3 (land (eq C c c2) +(subst0 i v t1 t2)) (land (eq T t1 t2) (csubst0 i v c c2)) (land (subst0 i v +t1 t2) (csubst0 i v c c2)))))) (\lambda (H3: (eq T t0 t2)).(eq_ind T t2 +(\lambda (t: T).((subst0 i v t1 t) \to (or3 (land (eq C c2 c2) (subst0 i v t1 +t2)) (land (eq T t1 t2) (csubst0 i v c2 c2)) (land (subst0 i v t1 t2) +(csubst0 i v c2 c2))))) (\lambda (H4: (subst0 i v t1 t2)).(or3_intro0 (land +(eq C c2 c2) (subst0 i v t1 t2)) (land (eq T t1 t2) (csubst0 i v c2 c2)) +(land (subst0 i v t1 t2) (csubst0 i v c2 c2)) (conj (eq C c2 c2) (subst0 i v +t1 t2) (refl_equal C c2) H4))) t0 (sym_eq T t0 t2 H3))) c1 (sym_eq C c1 c2 +H1) H2 H0))) | (fsubst0_fst c0 H0) \Rightarrow (\lambda (H1: (eq C c0 +c2)).(\lambda (H2: (eq T t1 t2)).(eq_ind C c2 (\lambda (c: C).((eq T t1 t2) +\to ((csubst0 i v c1 c) \to (or3 (land (eq C c1 c2) (subst0 i v t1 t2)) (land +(eq T t1 t2) (csubst0 i v c1 c2)) (land (subst0 i v t1 t2) (csubst0 i v c1 +c2)))))) (\lambda (H3: (eq T t1 t2)).(eq_ind T t2 (\lambda (t: T).((csubst0 i +v c1 c2) \to (or3 (land (eq C c1 c2) (subst0 i v t t2)) (land (eq T t t2) +(csubst0 i v c1 c2)) (land (subst0 i v t t2) (csubst0 i v c1 c2))))) (\lambda +(H4: (csubst0 i v c1 c2)).(or3_intro1 (land (eq C c1 c2) (subst0 i v t2 t2)) +(land (eq T t2 t2) (csubst0 i v c1 c2)) (land (subst0 i v t2 t2) (csubst0 i v +c1 c2)) (conj (eq T t2 t2) (csubst0 i v c1 c2) (refl_equal T t2) H4))) t1 +(sym_eq T t1 t2 H3))) c0 (sym_eq C c0 c2 H1) H2 H0))) | (fsubst0_both t0 H0 +c0 H1) \Rightarrow (\lambda (H2: (eq C c0 c2)).(\lambda (H3: (eq T t0 +t2)).(eq_ind C c2 (\lambda (c: C).((eq T t0 t2) \to ((subst0 i v t1 t0) \to +((csubst0 i v c1 c) \to (or3 (land (eq C c1 c2) (subst0 i v t1 t2)) (land (eq +T t1 t2) (csubst0 i v c1 c2)) (land (subst0 i v t1 t2) (csubst0 i v c1 +c2))))))) (\lambda (H4: (eq T t0 t2)).(eq_ind T t2 (\lambda (t: T).((subst0 i +v t1 t) \to ((csubst0 i v c1 c2) \to (or3 (land (eq C c1 c2) (subst0 i v t1 +t2)) (land (eq T t1 t2) (csubst0 i v c1 c2)) (land (subst0 i v t1 t2) +(csubst0 i v c1 c2)))))) (\lambda (H5: (subst0 i v t1 t2)).(\lambda (H6: +(csubst0 i v c1 c2)).(or3_intro2 (land (eq C c1 c2) (subst0 i v t1 t2)) (land +(eq T t1 t2) (csubst0 i v c1 c2)) (land (subst0 i v t1 t2) (csubst0 i v c1 +c2)) (conj (subst0 i v t1 t2) (csubst0 i v c1 c2) H5 H6)))) t0 (sym_eq T t0 +t2 H4))) c0 (sym_eq C c0 c2 H2) H3 H0 H1)))]) in (H0 (refl_equal C c2) +(refl_equal T t2))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/clear.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/clear.ma new file mode 100644 index 000000000..8b7c55259 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/clear.ma @@ -0,0 +1,143 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/getl/clear". + +include "getl/props.ma". + +include "clear/drop.ma". + +theorem clear_getl_trans: + \forall (i: nat).(\forall (c2: C).(\forall (c3: C).((getl i c2 c3) \to +(\forall (c1: C).((clear c1 c2) \to (getl i c1 c3)))))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (c2: C).(\forall (c3: +C).((getl n c2 c3) \to (\forall (c1: C).((clear c1 c2) \to (getl n c1 +c3))))))) (\lambda (c2: C).(\lambda (c3: C).(\lambda (H: (getl O c2 +c3)).(\lambda (c1: C).(\lambda (H0: (clear c1 c2)).(getl_intro O c1 c3 c1 +(drop_refl c1) (clear_trans c1 c2 H0 c3 (getl_gen_O c2 c3 H)))))))) (\lambda +(n: nat).(\lambda (_: ((\forall (c2: C).(\forall (c3: C).((getl n c2 c3) \to +(\forall (c1: C).((clear c1 c2) \to (getl n c1 c3)))))))).(\lambda (c2: +C).(C_ind (\lambda (c: C).(\forall (c3: C).((getl (S n) c c3) \to (\forall +(c1: C).((clear c1 c) \to (getl (S n) c1 c3)))))) (\lambda (n0: nat).(\lambda +(c3: C).(\lambda (H0: (getl (S n) (CSort n0) c3)).(\lambda (c1: C).(\lambda +(_: (clear c1 (CSort n0))).(getl_gen_sort n0 (S n) c3 H0 (getl (S n) c1 +c3))))))) (\lambda (c: C).(\lambda (_: ((\forall (c3: C).((getl (S n) c c3) +\to (\forall (c1: C).((clear c1 c) \to (getl (S n) c1 c3))))))).(\lambda (k: +K).(\lambda (t: T).(\lambda (c3: C).(\lambda (H1: (getl (S n) (CHead c k t) +c3)).(\lambda (c1: C).(\lambda (H2: (clear c1 (CHead c k t))).(K_ind (\lambda +(k0: K).((getl (S n) (CHead c k0 t) c3) \to ((clear c1 (CHead c k0 t)) \to +(getl (S n) c1 c3)))) (\lambda (b: B).(\lambda (H3: (getl (S n) (CHead c +(Bind b) t) c3)).(\lambda (H4: (clear c1 (CHead c (Bind b) t))).(let H5 \def +(getl_gen_all c c3 (r (Bind b) n) (getl_gen_S (Bind b) c c3 t n H3)) in +(ex2_ind C (\lambda (e: C).(drop n O c e)) (\lambda (e: C).(clear e c3)) +(getl (S n) c1 c3) (\lambda (x: C).(\lambda (H6: (drop n O c x)).(\lambda +(H7: (clear x c3)).(getl_intro (S n) c1 c3 x (drop_clear_O b c1 c t H4 x n +H6) H7)))) H5))))) (\lambda (f: F).(\lambda (_: (getl (S n) (CHead c (Flat f) +t) c3)).(\lambda (H4: (clear c1 (CHead c (Flat f) t))).(clear_gen_flat_r f c1 +c t H4 (getl (S n) c1 c3))))) k H1 H2))))))))) c2)))) i). + +theorem getl_clear_trans: + \forall (i: nat).(\forall (c1: C).(\forall (c2: C).((getl i c1 c2) \to +(\forall (c3: C).((clear c2 c3) \to (getl i c1 c3)))))) +\def + \lambda (i: nat).(\lambda (c1: C).(\lambda (c2: C).(\lambda (H: (getl i c1 +c2)).(\lambda (c3: C).(\lambda (H0: (clear c2 c3)).(let H1 \def (getl_gen_all +c1 c2 i H) in (ex2_ind C (\lambda (e: C).(drop i O c1 e)) (\lambda (e: +C).(clear e c2)) (getl i c1 c3) (\lambda (x: C).(\lambda (H2: (drop i O c1 +x)).(\lambda (H3: (clear x c2)).(let H4 \def (clear_gen_all x c2 H3) in +(ex_3_ind B C T (\lambda (b: B).(\lambda (e: C).(\lambda (u: T).(eq C c2 +(CHead e (Bind b) u))))) (getl i c1 c3) (\lambda (x0: B).(\lambda (x1: +C).(\lambda (x2: T).(\lambda (H5: (eq C c2 (CHead x1 (Bind x0) x2))).(let H6 +\def (eq_ind C c2 (\lambda (c: C).(clear x c)) H3 (CHead x1 (Bind x0) x2) H5) +in (let H7 \def (eq_ind C c2 (\lambda (c: C).(clear c c3)) H0 (CHead x1 (Bind +x0) x2) H5) in (eq_ind_r C (CHead x1 (Bind x0) x2) (\lambda (c: C).(getl i c1 +c)) (getl_intro i c1 (CHead x1 (Bind x0) x2) x H2 H6) c3 (clear_gen_bind x0 +x1 c3 x2 H7)))))))) H4))))) H1))))))). + +theorem getl_clear_bind: + \forall (b: B).(\forall (c: C).(\forall (e1: C).(\forall (v: T).((clear c +(CHead e1 (Bind b) v)) \to (\forall (e2: C).(\forall (n: nat).((getl n e1 e2) +\to (getl (S n) c e2)))))))) +\def + \lambda (b: B).(\lambda (c: C).(C_ind (\lambda (c0: C).(\forall (e1: +C).(\forall (v: T).((clear c0 (CHead e1 (Bind b) v)) \to (\forall (e2: +C).(\forall (n: nat).((getl n e1 e2) \to (getl (S n) c0 e2)))))))) (\lambda +(n: nat).(\lambda (e1: C).(\lambda (v: T).(\lambda (H: (clear (CSort n) +(CHead e1 (Bind b) v))).(\lambda (e2: C).(\lambda (n0: nat).(\lambda (_: +(getl n0 e1 e2)).(clear_gen_sort (CHead e1 (Bind b) v) n H (getl (S n0) +(CSort n) e2))))))))) (\lambda (c0: C).(\lambda (H: ((\forall (e1: +C).(\forall (v: T).((clear c0 (CHead e1 (Bind b) v)) \to (\forall (e2: +C).(\forall (n: nat).((getl n e1 e2) \to (getl (S n) c0 e2))))))))).(\lambda +(k: K).(\lambda (t: T).(\lambda (e1: C).(\lambda (v: T).(\lambda (H0: (clear +(CHead c0 k t) (CHead e1 (Bind b) v))).(\lambda (e2: C).(\lambda (n: +nat).(\lambda (H1: (getl n e1 e2)).(K_ind (\lambda (k0: K).((clear (CHead c0 +k0 t) (CHead e1 (Bind b) v)) \to (getl (S n) (CHead c0 k0 t) e2))) (\lambda +(b0: B).(\lambda (H2: (clear (CHead c0 (Bind b0) t) (CHead e1 (Bind b) +v))).(let H3 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow e1 | (CHead c1 _ _) \Rightarrow c1])) +(CHead e1 (Bind b) v) (CHead c0 (Bind b0) t) (clear_gen_bind b0 c0 (CHead e1 +(Bind b) v) t H2)) in ((let H4 \def (f_equal C B (\lambda (e: C).(match e in +C return (\lambda (_: C).B) with [(CSort _) \Rightarrow b | (CHead _ k0 _) +\Rightarrow (match k0 in K return (\lambda (_: K).B) with [(Bind b1) +\Rightarrow b1 | (Flat _) \Rightarrow b])])) (CHead e1 (Bind b) v) (CHead c0 +(Bind b0) t) (clear_gen_bind b0 c0 (CHead e1 (Bind b) v) t H2)) in ((let H5 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow v | (CHead _ _ t0) \Rightarrow t0])) (CHead e1 +(Bind b) v) (CHead c0 (Bind b0) t) (clear_gen_bind b0 c0 (CHead e1 (Bind b) +v) t H2)) in (\lambda (H6: (eq B b b0)).(\lambda (H7: (eq C e1 c0)).(let H8 +\def (eq_ind C e1 (\lambda (c1: C).(getl n c1 e2)) H1 c0 H7) in (eq_ind B b +(\lambda (b1: B).(getl (S n) (CHead c0 (Bind b1) t) e2)) (getl_head (Bind b) +n c0 e2 H8 t) b0 H6))))) H4)) H3)))) (\lambda (f: F).(\lambda (H2: (clear +(CHead c0 (Flat f) t) (CHead e1 (Bind b) v))).(getl_flat c0 e2 (S n) (H e1 v +(clear_gen_flat f c0 (CHead e1 (Bind b) v) t H2) e2 n H1) f t))) k +H0))))))))))) c)). + +theorem getl_clear_conf: + \forall (i: nat).(\forall (c1: C).(\forall (c3: C).((getl i c1 c3) \to +(\forall (c2: C).((clear c1 c2) \to (getl i c2 c3)))))) +\def + \lambda (i: nat).(nat_ind (\lambda (n: nat).(\forall (c1: C).(\forall (c3: +C).((getl n c1 c3) \to (\forall (c2: C).((clear c1 c2) \to (getl n c2 +c3))))))) (\lambda (c1: C).(\lambda (c3: C).(\lambda (H: (getl O c1 +c3)).(\lambda (c2: C).(\lambda (H0: (clear c1 c2)).(eq_ind C c3 (\lambda (c: +C).(getl O c c3)) (let H1 \def (clear_gen_all c1 c3 (getl_gen_O c1 c3 H)) in +(ex_3_ind B C T (\lambda (b: B).(\lambda (e: C).(\lambda (u: T).(eq C c3 +(CHead e (Bind b) u))))) (getl O c3 c3) (\lambda (x0: B).(\lambda (x1: +C).(\lambda (x2: T).(\lambda (H2: (eq C c3 (CHead x1 (Bind x0) x2))).(let H3 +\def (eq_ind C c3 (\lambda (c: C).(clear c1 c)) (getl_gen_O c1 c3 H) (CHead +x1 (Bind x0) x2) H2) in (eq_ind_r C (CHead x1 (Bind x0) x2) (\lambda (c: +C).(getl O c c)) (getl_refl x0 x1 x2) c3 H2)))))) H1)) c2 (clear_mono c1 c3 +(getl_gen_O c1 c3 H) c2 H0))))))) (\lambda (n: nat).(\lambda (_: ((\forall +(c1: C).(\forall (c3: C).((getl n c1 c3) \to (\forall (c2: C).((clear c1 c2) +\to (getl n c2 c3)))))))).(\lambda (c1: C).(C_ind (\lambda (c: C).(\forall +(c3: C).((getl (S n) c c3) \to (\forall (c2: C).((clear c c2) \to (getl (S n) +c2 c3)))))) (\lambda (n0: nat).(\lambda (c3: C).(\lambda (H0: (getl (S n) +(CSort n0) c3)).(\lambda (c2: C).(\lambda (_: (clear (CSort n0) +c2)).(getl_gen_sort n0 (S n) c3 H0 (getl (S n) c2 c3))))))) (\lambda (c: +C).(\lambda (H0: ((\forall (c3: C).((getl (S n) c c3) \to (\forall (c2: +C).((clear c c2) \to (getl (S n) c2 c3))))))).(\lambda (k: K).(\lambda (t: +T).(\lambda (c3: C).(\lambda (H1: (getl (S n) (CHead c k t) c3)).(\lambda +(c2: C).(\lambda (H2: (clear (CHead c k t) c2)).(K_ind (\lambda (k0: +K).((getl (S n) (CHead c k0 t) c3) \to ((clear (CHead c k0 t) c2) \to (getl +(S n) c2 c3)))) (\lambda (b: B).(\lambda (H3: (getl (S n) (CHead c (Bind b) +t) c3)).(\lambda (H4: (clear (CHead c (Bind b) t) c2)).(eq_ind_r C (CHead c +(Bind b) t) (\lambda (c0: C).(getl (S n) c0 c3)) (getl_head (Bind b) n c c3 +(getl_gen_S (Bind b) c c3 t n H3) t) c2 (clear_gen_bind b c c2 t H4))))) +(\lambda (f: F).(\lambda (H3: (getl (S n) (CHead c (Flat f) t) c3)).(\lambda +(H4: (clear (CHead c (Flat f) t) c2)).(H0 c3 (getl_gen_S (Flat f) c c3 t n +H3) c2 (clear_gen_flat f c c2 t H4))))) k H1 H2))))))))) c1)))) i). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/dec.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/dec.ma new file mode 100644 index 000000000..f22b7b333 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/dec.ma @@ -0,0 +1,99 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/getl/dec". + +include "getl/props.ma". + +theorem getl_dec: + \forall (c: C).(\forall (i: nat).(or (ex_3 C B T (\lambda (e: C).(\lambda +(b: B).(\lambda (v: T).(getl i c (CHead e (Bind b) v)))))) (\forall (d: +C).((getl i c d) \to (\forall (P: Prop).P))))) +\def + \lambda (c: C).(C_ind (\lambda (c0: C).(\forall (i: nat).(or (ex_3 C B T +(\lambda (e: C).(\lambda (b: B).(\lambda (v: T).(getl i c0 (CHead e (Bind b) +v)))))) (\forall (d: C).((getl i c0 d) \to (\forall (P: Prop).P)))))) +(\lambda (n: nat).(\lambda (i: nat).(or_intror (ex_3 C B T (\lambda (e: +C).(\lambda (b: B).(\lambda (v: T).(getl i (CSort n) (CHead e (Bind b) +v)))))) (\forall (d: C).((getl i (CSort n) d) \to (\forall (P: Prop).P))) +(\lambda (d: C).(\lambda (H: (getl i (CSort n) d)).(\lambda (P: +Prop).(getl_gen_sort n i d H P))))))) (\lambda (c0: C).(\lambda (H: ((\forall +(i: nat).(or (ex_3 C B T (\lambda (e: C).(\lambda (b: B).(\lambda (v: +T).(getl i c0 (CHead e (Bind b) v)))))) (\forall (d: C).((getl i c0 d) \to +(\forall (P: Prop).P))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (i: +nat).(nat_ind (\lambda (n: nat).(or (ex_3 C B T (\lambda (e: C).(\lambda (b: +B).(\lambda (v: T).(getl n (CHead c0 k t) (CHead e (Bind b) v)))))) (\forall +(d: C).((getl n (CHead c0 k t) d) \to (\forall (P: Prop).P))))) (K_ind +(\lambda (k0: K).(or (ex_3 C B T (\lambda (e: C).(\lambda (b: B).(\lambda (v: +T).(getl O (CHead c0 k0 t) (CHead e (Bind b) v)))))) (\forall (d: C).((getl O +(CHead c0 k0 t) d) \to (\forall (P: Prop).P))))) (\lambda (b: B).(or_introl +(ex_3 C B T (\lambda (e: C).(\lambda (b0: B).(\lambda (v: T).(getl O (CHead +c0 (Bind b) t) (CHead e (Bind b0) v)))))) (\forall (d: C).((getl O (CHead c0 +(Bind b) t) d) \to (\forall (P: Prop).P))) (ex_3_intro C B T (\lambda (e: +C).(\lambda (b0: B).(\lambda (v: T).(getl O (CHead c0 (Bind b) t) (CHead e +(Bind b0) v))))) c0 b t (getl_refl b c0 t)))) (\lambda (f: F).(let H_x \def +(H O) in (let H0 \def H_x in (or_ind (ex_3 C B T (\lambda (e: C).(\lambda (b: +B).(\lambda (v: T).(getl O c0 (CHead e (Bind b) v)))))) (\forall (d: +C).((getl O c0 d) \to (\forall (P: Prop).P))) (or (ex_3 C B T (\lambda (e: +C).(\lambda (b: B).(\lambda (v: T).(getl O (CHead c0 (Flat f) t) (CHead e +(Bind b) v)))))) (\forall (d: C).((getl O (CHead c0 (Flat f) t) d) \to +(\forall (P: Prop).P)))) (\lambda (H1: (ex_3 C B T (\lambda (e: C).(\lambda +(b: B).(\lambda (v: T).(getl O c0 (CHead e (Bind b) v))))))).(ex_3_ind C B T +(\lambda (e: C).(\lambda (b: B).(\lambda (v: T).(getl O c0 (CHead e (Bind b) +v))))) (or (ex_3 C B T (\lambda (e: C).(\lambda (b: B).(\lambda (v: T).(getl +O (CHead c0 (Flat f) t) (CHead e (Bind b) v)))))) (\forall (d: C).((getl O +(CHead c0 (Flat f) t) d) \to (\forall (P: Prop).P)))) (\lambda (x0: +C).(\lambda (x1: B).(\lambda (x2: T).(\lambda (H2: (getl O c0 (CHead x0 (Bind +x1) x2))).(or_introl (ex_3 C B T (\lambda (e: C).(\lambda (b: B).(\lambda (v: +T).(getl O (CHead c0 (Flat f) t) (CHead e (Bind b) v)))))) (\forall (d: +C).((getl O (CHead c0 (Flat f) t) d) \to (\forall (P: Prop).P))) (ex_3_intro +C B T (\lambda (e: C).(\lambda (b: B).(\lambda (v: T).(getl O (CHead c0 (Flat +f) t) (CHead e (Bind b) v))))) x0 x1 x2 (getl_flat c0 (CHead x0 (Bind x1) x2) +O H2 f t))))))) H1)) (\lambda (H1: ((\forall (d: C).((getl O c0 d) \to +(\forall (P: Prop).P))))).(or_intror (ex_3 C B T (\lambda (e: C).(\lambda (b: +B).(\lambda (v: T).(getl O (CHead c0 (Flat f) t) (CHead e (Bind b) v)))))) +(\forall (d: C).((getl O (CHead c0 (Flat f) t) d) \to (\forall (P: Prop).P))) +(\lambda (d: C).(\lambda (H2: (getl O (CHead c0 (Flat f) t) d)).(\lambda (P: +Prop).(H1 d (getl_intro O c0 d c0 (drop_refl c0) (clear_gen_flat f c0 d t +(getl_gen_O (CHead c0 (Flat f) t) d H2))) P)))))) H0)))) k) (\lambda (n: +nat).(\lambda (_: (or (ex_3 C B T (\lambda (e: C).(\lambda (b: B).(\lambda +(v: T).(getl n (CHead c0 k t) (CHead e (Bind b) v)))))) (\forall (d: +C).((getl n (CHead c0 k t) d) \to (\forall (P: Prop).P))))).(let H_x \def (H +(r k n)) in (let H1 \def H_x in (or_ind (ex_3 C B T (\lambda (e: C).(\lambda +(b: B).(\lambda (v: T).(getl (r k n) c0 (CHead e (Bind b) v)))))) (\forall +(d: C).((getl (r k n) c0 d) \to (\forall (P: Prop).P))) (or (ex_3 C B T +(\lambda (e: C).(\lambda (b: B).(\lambda (v: T).(getl (S n) (CHead c0 k t) +(CHead e (Bind b) v)))))) (\forall (d: C).((getl (S n) (CHead c0 k t) d) \to +(\forall (P: Prop).P)))) (\lambda (H2: (ex_3 C B T (\lambda (e: C).(\lambda +(b: B).(\lambda (v: T).(getl (r k n) c0 (CHead e (Bind b) v))))))).(ex_3_ind +C B T (\lambda (e: C).(\lambda (b: B).(\lambda (v: T).(getl (r k n) c0 (CHead +e (Bind b) v))))) (or (ex_3 C B T (\lambda (e: C).(\lambda (b: B).(\lambda +(v: T).(getl (S n) (CHead c0 k t) (CHead e (Bind b) v)))))) (\forall (d: +C).((getl (S n) (CHead c0 k t) d) \to (\forall (P: Prop).P)))) (\lambda (x0: +C).(\lambda (x1: B).(\lambda (x2: T).(\lambda (H3: (getl (r k n) c0 (CHead x0 +(Bind x1) x2))).(or_introl (ex_3 C B T (\lambda (e: C).(\lambda (b: +B).(\lambda (v: T).(getl (S n) (CHead c0 k t) (CHead e (Bind b) v)))))) +(\forall (d: C).((getl (S n) (CHead c0 k t) d) \to (\forall (P: Prop).P))) +(ex_3_intro C B T (\lambda (e: C).(\lambda (b: B).(\lambda (v: T).(getl (S n) +(CHead c0 k t) (CHead e (Bind b) v))))) x0 x1 x2 (getl_head k n c0 (CHead x0 +(Bind x1) x2) H3 t))))))) H2)) (\lambda (H2: ((\forall (d: C).((getl (r k n) +c0 d) \to (\forall (P: Prop).P))))).(or_intror (ex_3 C B T (\lambda (e: +C).(\lambda (b: B).(\lambda (v: T).(getl (S n) (CHead c0 k t) (CHead e (Bind +b) v)))))) (\forall (d: C).((getl (S n) (CHead c0 k t) d) \to (\forall (P: +Prop).P))) (\lambda (d: C).(\lambda (H3: (getl (S n) (CHead c0 k t) +d)).(\lambda (P: Prop).(H2 d (getl_gen_S k c0 d t n H3) P)))))) H1))))) +i)))))) c). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/defs.ma new file mode 100644 index 000000000..0d97227a1 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/defs.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/getl/defs". + +include "drop/defs.ma". + +include "clear/defs.ma". + +inductive getl (h: nat) (c1: C) (c2: C): Prop \def +| getl_intro: \forall (e: C).((drop h O c1 e) \to ((clear e c2) \to (getl h +c1 c2))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/drop.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/drop.ma new file mode 100644 index 000000000..c176ca62d --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/drop.ma @@ -0,0 +1,491 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/getl/drop". + +include "getl/props.ma". + +include "clear/drop.ma". + +include "r/props.ma". + +theorem getl_drop: + \forall (b: B).(\forall (c: C).(\forall (e: C).(\forall (u: T).(\forall (h: +nat).((getl h c (CHead e (Bind b) u)) \to (drop (S h) O c e)))))) +\def + \lambda (b: B).(\lambda (c: C).(C_ind (\lambda (c0: C).(\forall (e: +C).(\forall (u: T).(\forall (h: nat).((getl h c0 (CHead e (Bind b) u)) \to +(drop (S h) O c0 e)))))) (\lambda (n: nat).(\lambda (e: C).(\lambda (u: +T).(\lambda (h: nat).(\lambda (H: (getl h (CSort n) (CHead e (Bind b) +u))).(getl_gen_sort n h (CHead e (Bind b) u) H (drop (S h) O (CSort n) +e))))))) (\lambda (c0: C).(\lambda (H: ((\forall (e: C).(\forall (u: +T).(\forall (h: nat).((getl h c0 (CHead e (Bind b) u)) \to (drop (S h) O c0 +e))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (e: C).(\lambda (u: +T).(\lambda (h: nat).(nat_ind (\lambda (n: nat).((getl n (CHead c0 k t) +(CHead e (Bind b) u)) \to (drop (S n) O (CHead c0 k t) e))) (\lambda (H0: +(getl O (CHead c0 k t) (CHead e (Bind b) u))).(K_ind (\lambda (k0: K).((clear +(CHead c0 k0 t) (CHead e (Bind b) u)) \to (drop (S O) O (CHead c0 k0 t) e))) +(\lambda (b0: B).(\lambda (H1: (clear (CHead c0 (Bind b0) t) (CHead e (Bind +b) u))).(let H2 \def (f_equal C C (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow e | (CHead c1 _ _) \Rightarrow +c1])) (CHead e (Bind b) u) (CHead c0 (Bind b0) t) (clear_gen_bind b0 c0 +(CHead e (Bind b) u) t H1)) in ((let H3 \def (f_equal C B (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow b | +(CHead _ k0 _) \Rightarrow (match k0 in K return (\lambda (_: K).B) with +[(Bind b1) \Rightarrow b1 | (Flat _) \Rightarrow b])])) (CHead e (Bind b) u) +(CHead c0 (Bind b0) t) (clear_gen_bind b0 c0 (CHead e (Bind b) u) t H1)) in +((let H4 \def (f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) +(CHead e (Bind b) u) (CHead c0 (Bind b0) t) (clear_gen_bind b0 c0 (CHead e +(Bind b) u) t H1)) in (\lambda (H5: (eq B b b0)).(\lambda (H6: (eq C e +c0)).(eq_ind_r C c0 (\lambda (c1: C).(drop (S O) O (CHead c0 (Bind b0) t) +c1)) (eq_ind B b (\lambda (b1: B).(drop (S O) O (CHead c0 (Bind b1) t) c0)) +(drop_drop (Bind b) O c0 c0 (drop_refl c0) t) b0 H5) e H6)))) H3)) H2)))) +(\lambda (f: F).(\lambda (H1: (clear (CHead c0 (Flat f) t) (CHead e (Bind b) +u))).(drop_clear_O b (CHead c0 (Flat f) t) e u (clear_flat c0 (CHead e (Bind +b) u) (clear_gen_flat f c0 (CHead e (Bind b) u) t H1) f t) e O (drop_refl +e)))) k (getl_gen_O (CHead c0 k t) (CHead e (Bind b) u) H0))) (\lambda (n: +nat).(\lambda (_: (((getl n (CHead c0 k t) (CHead e (Bind b) u)) \to (drop (S +n) O (CHead c0 k t) e)))).(\lambda (H1: (getl (S n) (CHead c0 k t) (CHead e +(Bind b) u))).(drop_drop k (S n) c0 e (eq_ind_r nat (S (r k n)) (\lambda (n0: +nat).(drop n0 O c0 e)) (H e u (r k n) (getl_gen_S k c0 (CHead e (Bind b) u) t +n H1)) (r k (S n)) (r_S k n)) t)))) h)))))))) c)). + +theorem getl_drop_conf_lt: + \forall (b: B).(\forall (c: C).(\forall (c0: C).(\forall (u: T).(\forall (i: +nat).((getl i c (CHead c0 (Bind b) u)) \to (\forall (e: C).(\forall (h: +nat).(\forall (d: nat).((drop h (S (plus i d)) c e) \to (ex3_2 T C (\lambda +(v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: T).(\lambda (e0: +C).(getl i e (CHead e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop +h d c0 e0))))))))))))) +\def + \lambda (b: B).(\lambda (c: C).(C_ind (\lambda (c0: C).(\forall (c1: +C).(\forall (u: T).(\forall (i: nat).((getl i c0 (CHead c1 (Bind b) u)) \to +(\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop h (S (plus i d)) +c0 e) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) +(\lambda (v: T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) v)))) (\lambda +(_: T).(\lambda (e0: C).(drop h d c1 e0))))))))))))) (\lambda (n: +nat).(\lambda (c0: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H: (getl i +(CSort n) (CHead c0 (Bind b) u))).(\lambda (e: C).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (_: (drop h (S (plus i d)) (CSort n) e)).(getl_gen_sort n i +(CHead c0 (Bind b) u) H (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u +(lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c0 e0)))))))))))))) (\lambda +(c0: C).(\lambda (H: ((\forall (c1: C).(\forall (u: T).(\forall (i: +nat).((getl i c0 (CHead c1 (Bind b) u)) \to (\forall (e: C).(\forall (h: +nat).(\forall (d: nat).((drop h (S (plus i d)) c0 e) \to (ex3_2 T C (\lambda +(v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: T).(\lambda (e0: +C).(getl i e (CHead e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop +h d c1 e0)))))))))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (c1: +C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i (CHead c0 k t) +(CHead c1 (Bind b) u))).(\lambda (e: C).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H1: (drop h (S (plus i d)) (CHead c0 k t) e)).(let H2 \def +(getl_gen_all (CHead c0 k t) (CHead c1 (Bind b) u) i H0) in (ex2_ind C +(\lambda (e0: C).(drop i O (CHead c0 k t) e0)) (\lambda (e0: C).(clear e0 +(CHead c1 (Bind b) u))) (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u +(lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0)))) (\lambda (x: +C).(\lambda (H3: (drop i O (CHead c0 k t) x)).(\lambda (H4: (clear x (CHead +c1 (Bind b) u))).(C_ind (\lambda (c2: C).((drop i O (CHead c0 k t) c2) \to +((clear c2 (CHead c1 (Bind b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl i e (CHead +e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) +(\lambda (n: nat).(\lambda (_: (drop i O (CHead c0 k t) (CSort n))).(\lambda +(H6: (clear (CSort n) (CHead c1 (Bind b) u))).(clear_gen_sort (CHead c1 (Bind +b) u) n H6 (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) +(\lambda (v: T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) v)))) (\lambda +(_: T).(\lambda (e0: C).(drop h d c1 e0)))))))) (\lambda (x0: C).(\lambda +(IHx: (((drop i O (CHead c0 k t) x0) \to ((clear x0 (CHead c1 (Bind b) u)) +\to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) +(\lambda (v: T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) v)))) (\lambda +(_: T).(\lambda (e0: C).(drop h d c1 e0)))))))).(\lambda (k0: K).(\lambda +(t0: T).(\lambda (H5: (drop i O (CHead c0 k t) (CHead x0 k0 t0))).(\lambda +(H6: (clear (CHead x0 k0 t0) (CHead c1 (Bind b) u))).(K_ind (\lambda (k1: +K).((drop i O (CHead c0 k t) (CHead x0 k1 t0)) \to ((clear (CHead x0 k1 t0) +(CHead c1 (Bind b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u +(lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) (\lambda (b0: +B).(\lambda (H7: (drop i O (CHead c0 k t) (CHead x0 (Bind b0) t0))).(\lambda +(H8: (clear (CHead x0 (Bind b0) t0) (CHead c1 (Bind b) u))).(let H9 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c1 | (CHead c2 _ _) \Rightarrow c2])) (CHead c1 (Bind +b) u) (CHead x0 (Bind b0) t0) (clear_gen_bind b0 x0 (CHead c1 (Bind b) u) t0 +H8)) in ((let H10 \def (f_equal C B (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).B) with [(CSort _) \Rightarrow b | (CHead _ k1 _) \Rightarrow +(match k1 in K return (\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | +(Flat _) \Rightarrow b])])) (CHead c1 (Bind b) u) (CHead x0 (Bind b0) t0) +(clear_gen_bind b0 x0 (CHead c1 (Bind b) u) t0 H8)) in ((let H11 \def +(f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow u | (CHead _ _ t1) \Rightarrow t1])) (CHead c1 (Bind +b) u) (CHead x0 (Bind b0) t0) (clear_gen_bind b0 x0 (CHead c1 (Bind b) u) t0 +H8)) in (\lambda (H12: (eq B b b0)).(\lambda (H13: (eq C c1 x0)).(let H14 +\def (eq_ind_r T t0 (\lambda (t1: T).(drop i O (CHead c0 k t) (CHead x0 (Bind +b0) t1))) H7 u H11) in (let H15 \def (eq_ind_r B b0 (\lambda (b1: B).(drop i +O (CHead c0 k t) (CHead x0 (Bind b1) u))) H14 b H12) in (let H16 \def +(eq_ind_r C x0 (\lambda (c2: C).((drop i O (CHead c0 k t) c2) \to ((clear c2 +(CHead c1 (Bind b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u +(lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) IHx c1 H13) in +(let H17 \def (eq_ind_r C x0 (\lambda (c2: C).(drop i O (CHead c0 k t) (CHead +c2 (Bind b) u))) H15 c1 H13) in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift h (r (Bind b) d) v)))) (\lambda (v: T).(\lambda (e0: +C).(drop i O e (CHead e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (r (Bind b) d) c1 e0))) (ex3_2 T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl i e (CHead +e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0)))) +(\lambda (x1: T).(\lambda (x2: C).(\lambda (H18: (eq T u (lift h (r (Bind b) +d) x1))).(\lambda (H19: (drop i O e (CHead x2 (Bind b) x1))).(\lambda (H20: +(drop h (r (Bind b) d) c1 x2)).(let H21 \def (eq_ind T u (\lambda (t1: +T).((drop i O (CHead c0 k t) c1) \to ((clear c1 (CHead c1 (Bind b) t1)) \to +(ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T t1 (lift h d v)))) (\lambda +(v: T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0))))))) H16 (lift h (r (Bind b) d) x1) +H18) in (eq_ind_r T (lift h (r (Bind b) d) x1) (\lambda (t1: T).(ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T t1 (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0))))) (ex3_2_intro T C (\lambda (v: +T).(\lambda (_: C).(eq T (lift h (r (Bind b) d) x1) (lift h d v)))) (\lambda +(v: T).(\lambda (e0: C).(getl i e (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0))) x1 x2 (refl_equal T (lift h d x1)) +(getl_intro i e (CHead x2 (Bind b) x1) (CHead x2 (Bind b) x1) H19 (clear_bind +b x2 x1)) H20) u H18))))))) (drop_conf_lt (Bind b) i u c1 (CHead c0 k t) H17 +e h d H1))))))))) H10)) H9))))) (\lambda (f: F).(\lambda (H7: (drop i O +(CHead c0 k t) (CHead x0 (Flat f) t0))).(\lambda (H8: (clear (CHead x0 (Flat +f) t0) (CHead c1 (Bind b) u))).(nat_ind (\lambda (n: nat).((drop h (S (plus n +d)) (CHead c0 k t) e) \to ((drop n O (CHead c0 k t) (CHead x0 (Flat f) t0)) +\to ((((drop n O (CHead c0 k t) x0) \to ((clear x0 (CHead c1 (Bind b) u)) \to +(ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda +(v: T).(\lambda (e0: C).(getl n e (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0))))))) \to (ex3_2 T C (\lambda (v: +T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: T).(\lambda (e0: +C).(getl n e (CHead e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop +h d c1 e0)))))))) (\lambda (H9: (drop h (S (plus O d)) (CHead c0 k t) +e)).(\lambda (H10: (drop O O (CHead c0 k t) (CHead x0 (Flat f) t0))).(\lambda +(IHx0: (((drop O O (CHead c0 k t) x0) \to ((clear x0 (CHead c1 (Bind b) u)) +\to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) +(\lambda (v: T).(\lambda (e0: C).(getl O e (CHead e0 (Bind b) v)))) (\lambda +(_: T).(\lambda (e0: C).(drop h d c1 e0)))))))).(let H11 \def (f_equal C C +(\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow c0 | (CHead c2 _ _) \Rightarrow c2])) (CHead c0 k t) (CHead x0 +(Flat f) t0) (drop_gen_refl (CHead c0 k t) (CHead x0 (Flat f) t0) H10)) in +((let H12 \def (f_equal C K (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k1 _) \Rightarrow k1])) +(CHead c0 k t) (CHead x0 (Flat f) t0) (drop_gen_refl (CHead c0 k t) (CHead x0 +(Flat f) t0) H10)) in ((let H13 \def (f_equal C T (\lambda (e0: C).(match e0 +in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow t | (CHead _ _ t1) +\Rightarrow t1])) (CHead c0 k t) (CHead x0 (Flat f) t0) (drop_gen_refl (CHead +c0 k t) (CHead x0 (Flat f) t0) H10)) in (\lambda (H14: (eq K k (Flat +f))).(\lambda (H15: (eq C c0 x0)).(let H16 \def (eq_ind_r C x0 (\lambda (c2: +C).(clear c2 (CHead c1 (Bind b) u))) (clear_gen_flat f x0 (CHead c1 (Bind b) +u) t0 H8) c0 H15) in (let H17 \def (eq_ind_r C x0 (\lambda (c2: C).((drop O O +(CHead c0 k t) c2) \to ((clear c2 (CHead c1 (Bind b) u)) \to (ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl O e (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0))))))) IHx0 c0 H15) in (let H18 \def +(eq_ind K k (\lambda (k1: K).((drop O O (CHead c0 k1 t) c0) \to ((clear c0 +(CHead c1 (Bind b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u +(lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl O e (CHead e0 (Bind b) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) H17 (Flat f) +H14) in (let H19 \def (eq_ind K k (\lambda (k1: K).(drop h (S (plus O d)) +(CHead c0 k1 t) e)) H9 (Flat f) H14) in (ex3_2_ind C T (\lambda (e0: +C).(\lambda (v: T).(eq C e (CHead e0 (Flat f) v)))) (\lambda (_: C).(\lambda +(v: T).(eq T t (lift h (r (Flat f) (plus O d)) v)))) (\lambda (e0: +C).(\lambda (_: T).(drop h (r (Flat f) (plus O d)) c0 e0))) (ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl O e (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0)))) (\lambda (x1: C).(\lambda (x2: +T).(\lambda (H20: (eq C e (CHead x1 (Flat f) x2))).(\lambda (H21: (eq T t +(lift h (r (Flat f) (plus O d)) x2))).(\lambda (H22: (drop h (r (Flat f) +(plus O d)) c0 x1)).(let H23 \def (f_equal T T (\lambda (e0: T).e0) t (lift h +(r (Flat f) (plus O d)) x2) H21) in (let H24 \def (eq_ind C e (\lambda (c2: +C).((drop O O (CHead c0 (Flat f) t) c0) \to ((clear c0 (CHead c1 (Bind b) u)) +\to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) +(\lambda (v: T).(\lambda (e0: C).(getl O c2 (CHead e0 (Bind b) v)))) (\lambda +(_: T).(\lambda (e0: C).(drop h d c1 e0))))))) H18 (CHead x1 (Flat f) x2) +H20) in (eq_ind_r C (CHead x1 (Flat f) x2) (\lambda (c2: C).(ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl O c2 (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0))))) (let H25 \def (eq_ind T t (\lambda +(t1: T).((drop O O (CHead c0 (Flat f) t1) c0) \to ((clear c0 (CHead c1 (Bind +b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) +(\lambda (v: T).(\lambda (e0: C).(getl O (CHead x1 (Flat f) x2) (CHead e0 +(Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) H24 +(lift h (S d) x2) H23) in (let H26 \def (H c1 u O (getl_intro O c0 (CHead c1 +(Bind b) u) c0 (drop_refl c0) H16) x1 h d H22) in (ex3_2_ind T C (\lambda (v: +T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: T).(\lambda (e0: +C).(getl O x1 (CHead e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop +h d c1 e0))) (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d +v)))) (\lambda (v: T).(\lambda (e0: C).(getl O (CHead x1 (Flat f) x2) (CHead +e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0)))) +(\lambda (x3: T).(\lambda (x4: C).(\lambda (H27: (eq T u (lift h d +x3))).(\lambda (H28: (getl O x1 (CHead x4 (Bind b) x3))).(\lambda (H29: (drop +h d c1 x4)).(let H30 \def (eq_ind T u (\lambda (t1: T).((drop O O (CHead c0 +(Flat f) (lift h (S d) x2)) c0) \to ((clear c0 (CHead c1 (Bind b) t1)) \to +(ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T t1 (lift h d v)))) (\lambda +(v: T).(\lambda (e0: C).(getl O (CHead x1 (Flat f) x2) (CHead e0 (Bind b) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) H25 (lift h d +x3) H27) in (let H31 \def (eq_ind T u (\lambda (t1: T).(clear c0 (CHead c1 +(Bind b) t1))) H16 (lift h d x3) H27) in (eq_ind_r T (lift h d x3) (\lambda +(t1: T).(ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T t1 (lift h d v)))) +(\lambda (v: T).(\lambda (e0: C).(getl O (CHead x1 (Flat f) x2) (CHead e0 +(Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))) +(ex3_2_intro T C (\lambda (v: T).(\lambda (_: C).(eq T (lift h d x3) (lift h +d v)))) (\lambda (v: T).(\lambda (e0: C).(getl O (CHead x1 (Flat f) x2) +(CHead e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))) +x3 x4 (refl_equal T (lift h d x3)) (getl_flat x1 (CHead x4 (Bind b) x3) O H28 +f x2) H29) u H27)))))))) H26))) e H20)))))))) (drop_gen_skip_l c0 e t h (plus +O d) (Flat f) H19))))))))) H12)) H11))))) (\lambda (i0: nat).(\lambda (IHi: +(((drop h (S (plus i0 d)) (CHead c0 k t) e) \to ((drop i0 O (CHead c0 k t) +(CHead x0 (Flat f) t0)) \to ((((drop i0 O (CHead c0 k t) x0) \to ((clear x0 +(CHead c1 (Bind b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u +(lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl i0 e (CHead e0 (Bind +b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) \to (ex3_2 T +C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl i0 e (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0))))))))).(\lambda (H9: (drop h (S (plus +(S i0) d)) (CHead c0 k t) e)).(\lambda (H10: (drop (S i0) O (CHead c0 k t) +(CHead x0 (Flat f) t0))).(\lambda (IHx0: (((drop (S i0) O (CHead c0 k t) x0) +\to ((clear x0 (CHead c1 (Bind b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda +(_: C).(eq T u (lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl (S i0) +e (CHead e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 +e0)))))))).(ex3_2_ind C T (\lambda (e0: C).(\lambda (v: T).(eq C e (CHead e0 +k v)))) (\lambda (_: C).(\lambda (v: T).(eq T t (lift h (r k (plus (S i0) d)) +v)))) (\lambda (e0: C).(\lambda (_: T).(drop h (r k (plus (S i0) d)) c0 e0))) +(ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda +(v: T).(\lambda (e0: C).(getl (S i0) e (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0)))) (\lambda (x1: C).(\lambda (x2: +T).(\lambda (H11: (eq C e (CHead x1 k x2))).(\lambda (H12: (eq T t (lift h (r +k (plus (S i0) d)) x2))).(\lambda (H13: (drop h (r k (plus (S i0) d)) c0 +x1)).(let H14 \def (f_equal T T (\lambda (e0: T).e0) t (lift h (r k (plus (S +i0) d)) x2) H12) in (let H15 \def (eq_ind C e (\lambda (c2: C).((drop h (S +(plus i0 d)) (CHead c0 k t) c2) \to ((drop i0 O (CHead c0 k t) (CHead x0 +(Flat f) t0)) \to ((((drop i0 O (CHead c0 k t) x0) \to ((clear x0 (CHead c1 +(Bind b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d +v)))) (\lambda (v: T).(\lambda (e0: C).(getl i0 c2 (CHead e0 (Bind b) v)))) +(\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) \to (ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl i0 c2 (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0)))))))) IHi (CHead x1 k x2) H11) in (let +H16 \def (eq_ind C e (\lambda (c2: C).((drop (S i0) O (CHead c0 k t) x0) \to +((clear x0 (CHead c1 (Bind b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl (S i0) c2 +(CHead e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 +e0))))))) IHx0 (CHead x1 k x2) H11) in (eq_ind_r C (CHead x1 k x2) (\lambda +(c2: C).(ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) +(\lambda (v: T).(\lambda (e0: C).(getl (S i0) c2 (CHead e0 (Bind b) v)))) +(\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))) (let H17 \def (eq_ind T +t (\lambda (t1: T).((drop (S i0) O (CHead c0 k t1) x0) \to ((clear x0 (CHead +c1 (Bind b) u)) \to (ex3_2 T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift +h d v)))) (\lambda (v: T).(\lambda (e0: C).(getl (S i0) (CHead x1 k x2) +(CHead e0 (Bind b) v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 +e0))))))) H16 (lift h (r k (S (plus i0 d))) x2) H14) in (let H18 \def (eq_ind +T t (\lambda (t1: T).((drop h (S (plus i0 d)) (CHead c0 k t1) (CHead x1 k +x2)) \to ((drop i0 O (CHead c0 k t1) (CHead x0 (Flat f) t0)) \to ((((drop i0 +O (CHead c0 k t1) x0) \to ((clear x0 (CHead c1 (Bind b) u)) \to (ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl i0 (CHead x1 k x2) (CHead e0 (Bind b) v)))) +(\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) \to (ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl i0 (CHead x1 k x2) (CHead e0 (Bind b) v)))) +(\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0)))))))) H15 (lift h (r k (S +(plus i0 d))) x2) H14) in (let H19 \def (eq_ind nat (r k (plus (S i0) d)) +(\lambda (n: nat).(drop h n c0 x1)) H13 (plus (r k (S i0)) d) (r_plus k (S +i0) d)) in (let H20 \def (eq_ind nat (r k (S i0)) (\lambda (n: nat).(drop h +(plus n d) c0 x1)) H19 (S (r k i0)) (r_S k i0)) in (let H21 \def (H c1 u (r k +i0) (getl_intro (r k i0) c0 (CHead c1 (Bind b) u) (CHead x0 (Flat f) t0) +(drop_gen_drop k c0 (CHead x0 (Flat f) t0) t i0 H10) (clear_flat x0 (CHead c1 +(Bind b) u) (clear_gen_flat f x0 (CHead c1 (Bind b) u) t0 H8) f t0)) x1 h d +H20) in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: C).(eq T u (lift h d +v)))) (\lambda (v: T).(\lambda (e0: C).(getl (r k i0) x1 (CHead e0 (Bind b) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))) (ex3_2 T C (\lambda +(v: T).(\lambda (_: C).(eq T u (lift h d v)))) (\lambda (v: T).(\lambda (e0: +C).(getl (S i0) (CHead x1 k x2) (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0)))) (\lambda (x3: T).(\lambda (x4: +C).(\lambda (H22: (eq T u (lift h d x3))).(\lambda (H23: (getl (r k i0) x1 +(CHead x4 (Bind b) x3))).(\lambda (H24: (drop h d c1 x4)).(let H25 \def +(eq_ind T u (\lambda (t1: T).((drop (S i0) O (CHead c0 k (lift h (r k (S +(plus i0 d))) x2)) x0) \to ((clear x0 (CHead c1 (Bind b) t1)) \to (ex3_2 T C +(\lambda (v: T).(\lambda (_: C).(eq T t1 (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl (S i0) (CHead x1 k x2) (CHead e0 (Bind b) v)))) +(\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))))))) H17 (lift h d x3) +H22) in (let H26 \def (eq_ind T u (\lambda (t1: T).(clear x0 (CHead c1 (Bind +b) t1))) (clear_gen_flat f x0 (CHead c1 (Bind b) u) t0 H8) (lift h d x3) H22) +in (eq_ind_r T (lift h d x3) (\lambda (t1: T).(ex3_2 T C (\lambda (v: +T).(\lambda (_: C).(eq T t1 (lift h d v)))) (\lambda (v: T).(\lambda (e0: +C).(getl (S i0) (CHead x1 k x2) (CHead e0 (Bind b) v)))) (\lambda (_: +T).(\lambda (e0: C).(drop h d c1 e0))))) (ex3_2_intro T C (\lambda (v: +T).(\lambda (_: C).(eq T (lift h d x3) (lift h d v)))) (\lambda (v: +T).(\lambda (e0: C).(getl (S i0) (CHead x1 k x2) (CHead e0 (Bind b) v)))) +(\lambda (_: T).(\lambda (e0: C).(drop h d c1 e0))) x3 x4 (refl_equal T (lift +h d x3)) (getl_head k i0 x1 (CHead x4 (Bind b) x3) H23 x2) H24) u H22)))))))) +H21)))))) e H11))))))))) (drop_gen_skip_l c0 e t h (plus (S i0) d) k +H9))))))) i H1 H7 IHx)))) k0 H5 H6))))))) x H3 H4)))) H2)))))))))))))) c)). + +theorem getl_drop_conf_ge: + \forall (i: nat).(\forall (a: C).(\forall (c: C).((getl i c a) \to (\forall +(e: C).(\forall (h: nat).(\forall (d: nat).((drop h d c e) \to ((le (plus d +h) i) \to (getl (minus i h) e a))))))))) +\def + \lambda (i: nat).(\lambda (a: C).(\lambda (c: C).(\lambda (H: (getl i c +a)).(\lambda (e: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H0: (drop h +d c e)).(\lambda (H1: (le (plus d h) i)).(let H2 \def (getl_gen_all c a i H) +in (ex2_ind C (\lambda (e0: C).(drop i O c e0)) (\lambda (e0: C).(clear e0 +a)) (getl (minus i h) e a) (\lambda (x: C).(\lambda (H3: (drop i O c +x)).(\lambda (H4: (clear x a)).(getl_intro (minus i h) e a x (drop_conf_ge i +x c H3 e h d H0 H1) H4)))) H2)))))))))). + +theorem getl_conf_ge_drop: + \forall (b: B).(\forall (c1: C).(\forall (e: C).(\forall (u: T).(\forall (i: +nat).((getl i c1 (CHead e (Bind b) u)) \to (\forall (c2: C).((drop (S O) i c1 +c2) \to (drop i O c2 e)))))))) +\def + \lambda (b: B).(\lambda (c1: C).(\lambda (e: C).(\lambda (u: T).(\lambda (i: +nat).(\lambda (H: (getl i c1 (CHead e (Bind b) u))).(\lambda (c2: C).(\lambda +(H0: (drop (S O) i c1 c2)).(let H3 \def (eq_ind nat (minus (S i) (S O)) +(\lambda (n: nat).(drop n O c2 e)) (drop_conf_ge (S i) e c1 (getl_drop b c1 e +u i H) c2 (S O) i H0 (eq_ind_r nat (plus (S O) i) (\lambda (n: nat).(le n (S +i))) (le_n (S i)) (plus i (S O)) (plus_comm i (S O)))) i (minus_Sx_SO i)) in +H3)))))))). + +theorem getl_drop_conf_rev: + \forall (j: nat).(\forall (e1: C).(\forall (e2: C).((drop j O e1 e2) \to +(\forall (b: B).(\forall (c2: C).(\forall (v2: T).(\forall (i: nat).((getl i +c2 (CHead e2 (Bind b) v2)) \to (ex2 C (\lambda (c1: C).(drop j O c1 c2)) +(\lambda (c1: C).(drop (S i) j c1 e1))))))))))) +\def + \lambda (j: nat).(\lambda (e1: C).(\lambda (e2: C).(\lambda (H: (drop j O e1 +e2)).(\lambda (b: B).(\lambda (c2: C).(\lambda (v2: T).(\lambda (i: +nat).(\lambda (H0: (getl i c2 (CHead e2 (Bind b) v2))).(drop_conf_rev j e1 e2 +H c2 (S i) (getl_drop b c2 e2 v2 i H0)))))))))). + +theorem drop_getl_trans_lt: + \forall (i: nat).(\forall (d: nat).((lt i d) \to (\forall (c1: C).(\forall +(c2: C).(\forall (h: nat).((drop h d c1 c2) \to (\forall (b: B).(\forall (e2: +C).(\forall (v: T).((getl i c2 (CHead e2 (Bind b) v)) \to (ex2 C (\lambda +(e1: C).(getl i c1 (CHead e1 (Bind b) (lift h (minus d (S i)) v)))) (\lambda +(e1: C).(drop h (minus d (S i)) e1 e2))))))))))))) +\def + \lambda (i: nat).(\lambda (d: nat).(\lambda (H: (lt i d)).(\lambda (c1: +C).(\lambda (c2: C).(\lambda (h: nat).(\lambda (H0: (drop h d c1 +c2)).(\lambda (b: B).(\lambda (e2: C).(\lambda (v: T).(\lambda (H1: (getl i +c2 (CHead e2 (Bind b) v))).(let H2 \def (getl_gen_all c2 (CHead e2 (Bind b) +v) i H1) in (ex2_ind C (\lambda (e: C).(drop i O c2 e)) (\lambda (e: +C).(clear e (CHead e2 (Bind b) v))) (ex2 C (\lambda (e1: C).(getl i c1 (CHead +e1 (Bind b) (lift h (minus d (S i)) v)))) (\lambda (e1: C).(drop h (minus d +(S i)) e1 e2))) (\lambda (x: C).(\lambda (H3: (drop i O c2 x)).(\lambda (H4: +(clear x (CHead e2 (Bind b) v))).(ex2_ind C (\lambda (e1: C).(drop i O c1 +e1)) (\lambda (e1: C).(drop h (minus d i) e1 x)) (ex2 C (\lambda (e1: +C).(getl i c1 (CHead e1 (Bind b) (lift h (minus d (S i)) v)))) (\lambda (e1: +C).(drop h (minus d (S i)) e1 e2))) (\lambda (x0: C).(\lambda (H5: (drop i O +c1 x0)).(\lambda (H6: (drop h (minus d i) x0 x)).(let H7 \def (eq_ind nat +(minus d i) (\lambda (n: nat).(drop h n x0 x)) H6 (S (minus d (S i))) +(minus_x_Sy d i H)) in (let H8 \def (drop_clear_S x x0 h (minus d (S i)) H7 b +e2 v H4) in (ex2_ind C (\lambda (c3: C).(clear x0 (CHead c3 (Bind b) (lift h +(minus d (S i)) v)))) (\lambda (c3: C).(drop h (minus d (S i)) c3 e2)) (ex2 C +(\lambda (e1: C).(getl i c1 (CHead e1 (Bind b) (lift h (minus d (S i)) v)))) +(\lambda (e1: C).(drop h (minus d (S i)) e1 e2))) (\lambda (x1: C).(\lambda +(H9: (clear x0 (CHead x1 (Bind b) (lift h (minus d (S i)) v)))).(\lambda +(H10: (drop h (minus d (S i)) x1 e2)).(ex_intro2 C (\lambda (e1: C).(getl i +c1 (CHead e1 (Bind b) (lift h (minus d (S i)) v)))) (\lambda (e1: C).(drop h +(minus d (S i)) e1 e2)) x1 (getl_intro i c1 (CHead x1 (Bind b) (lift h (minus +d (S i)) v)) x0 H5 H9) H10)))) H8)))))) (drop_trans_le i d (le_S_n i d (le_S +(S i) d H)) c1 c2 h H0 x H3))))) H2)))))))))))). + +theorem drop_getl_trans_le: + \forall (i: nat).(\forall (d: nat).((le i d) \to (\forall (c1: C).(\forall +(c2: C).(\forall (h: nat).((drop h d c1 c2) \to (\forall (e2: C).((getl i c2 +e2) \to (ex3_2 C C (\lambda (e0: C).(\lambda (_: C).(drop i O c1 e0))) +(\lambda (e0: C).(\lambda (e1: C).(drop h (minus d i) e0 e1))) (\lambda (_: +C).(\lambda (e1: C).(clear e1 e2)))))))))))) +\def + \lambda (i: nat).(\lambda (d: nat).(\lambda (H: (le i d)).(\lambda (c1: +C).(\lambda (c2: C).(\lambda (h: nat).(\lambda (H0: (drop h d c1 +c2)).(\lambda (e2: C).(\lambda (H1: (getl i c2 e2)).(let H2 \def +(getl_gen_all c2 e2 i H1) in (ex2_ind C (\lambda (e: C).(drop i O c2 e)) +(\lambda (e: C).(clear e e2)) (ex3_2 C C (\lambda (e0: C).(\lambda (_: +C).(drop i O c1 e0))) (\lambda (e0: C).(\lambda (e1: C).(drop h (minus d i) +e0 e1))) (\lambda (_: C).(\lambda (e1: C).(clear e1 e2)))) (\lambda (x: +C).(\lambda (H3: (drop i O c2 x)).(\lambda (H4: (clear x e2)).(let H5 \def +(drop_trans_le i d H c1 c2 h H0 x H3) in (ex2_ind C (\lambda (e1: C).(drop i +O c1 e1)) (\lambda (e1: C).(drop h (minus d i) e1 x)) (ex3_2 C C (\lambda +(e0: C).(\lambda (_: C).(drop i O c1 e0))) (\lambda (e0: C).(\lambda (e1: +C).(drop h (minus d i) e0 e1))) (\lambda (_: C).(\lambda (e1: C).(clear e1 +e2)))) (\lambda (x0: C).(\lambda (H6: (drop i O c1 x0)).(\lambda (H7: (drop h +(minus d i) x0 x)).(ex3_2_intro C C (\lambda (e0: C).(\lambda (_: C).(drop i +O c1 e0))) (\lambda (e0: C).(\lambda (e1: C).(drop h (minus d i) e0 e1))) +(\lambda (_: C).(\lambda (e1: C).(clear e1 e2))) x0 x H6 H7 H4)))) H5))))) +H2)))))))))). + +theorem drop_getl_trans_ge: + \forall (i: nat).(\forall (c1: C).(\forall (c2: C).(\forall (d: +nat).(\forall (h: nat).((drop h d c1 c2) \to (\forall (e2: C).((getl i c2 e2) +\to ((le d i) \to (getl (plus i h) c1 e2))))))))) +\def + \lambda (i: nat).(\lambda (c1: C).(\lambda (c2: C).(\lambda (d: +nat).(\lambda (h: nat).(\lambda (H: (drop h d c1 c2)).(\lambda (e2: +C).(\lambda (H0: (getl i c2 e2)).(\lambda (H1: (le d i)).(let H2 \def +(getl_gen_all c2 e2 i H0) in (ex2_ind C (\lambda (e: C).(drop i O c2 e)) +(\lambda (e: C).(clear e e2)) (getl (plus i h) c1 e2) (\lambda (x: +C).(\lambda (H3: (drop i O c2 x)).(\lambda (H4: (clear x e2)).(getl_intro +(plus i h) c1 e2 x (drop_trans_ge i c1 c2 d h H x H3 H1) H4)))) H2)))))))))). + +theorem getl_drop_trans: + \forall (c1: C).(\forall (c2: C).(\forall (h: nat).((getl h c1 c2) \to +(\forall (e2: C).(\forall (i: nat).((drop (S i) O c2 e2) \to (drop (S (plus i +h)) O c1 e2))))))) +\def + \lambda (c1: C).(C_ind (\lambda (c: C).(\forall (c2: C).(\forall (h: +nat).((getl h c c2) \to (\forall (e2: C).(\forall (i: nat).((drop (S i) O c2 +e2) \to (drop (S (plus i h)) O c e2)))))))) (\lambda (n: nat).(\lambda (c2: +C).(\lambda (h: nat).(\lambda (H: (getl h (CSort n) c2)).(\lambda (e2: +C).(\lambda (i: nat).(\lambda (_: (drop (S i) O c2 e2)).(getl_gen_sort n h c2 +H (drop (S (plus i h)) O (CSort n) e2))))))))) (\lambda (c2: C).(\lambda +(IHc: ((\forall (c3: C).(\forall (h: nat).((getl h c2 c3) \to (\forall (e2: +C).(\forall (i: nat).((drop (S i) O c3 e2) \to (drop (S (plus i h)) O c2 +e2))))))))).(\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (t: T).(\forall +(c3: C).(\forall (h: nat).((getl h (CHead c2 k0 t) c3) \to (\forall (e2: +C).(\forall (i: nat).((drop (S i) O c3 e2) \to (drop (S (plus i h)) O (CHead +c2 k0 t) e2))))))))) (\lambda (b: B).(\lambda (t: T).(\lambda (c3: +C).(\lambda (h: nat).(nat_ind (\lambda (n: nat).((getl n (CHead c2 (Bind b) +t) c3) \to (\forall (e2: C).(\forall (i: nat).((drop (S i) O c3 e2) \to (drop +(S (plus i n)) O (CHead c2 (Bind b) t) e2)))))) (\lambda (H: (getl O (CHead +c2 (Bind b) t) c3)).(\lambda (e2: C).(\lambda (i: nat).(\lambda (H0: (drop (S +i) O c3 e2)).(let H1 \def (eq_ind C c3 (\lambda (c: C).(drop (S i) O c e2)) +H0 (CHead c2 (Bind b) t) (clear_gen_bind b c2 c3 t (getl_gen_O (CHead c2 +(Bind b) t) c3 H))) in (eq_ind nat i (\lambda (n: nat).(drop (S n) O (CHead +c2 (Bind b) t) e2)) (drop_drop (Bind b) i c2 e2 (drop_gen_drop (Bind b) c2 e2 +t i H1) t) (plus i O) (plus_n_O i))))))) (\lambda (n: nat).(\lambda (_: +(((getl n (CHead c2 (Bind b) t) c3) \to (\forall (e2: C).(\forall (i: +nat).((drop (S i) O c3 e2) \to (drop (S (plus i n)) O (CHead c2 (Bind b) t) +e2))))))).(\lambda (H0: (getl (S n) (CHead c2 (Bind b) t) c3)).(\lambda (e2: +C).(\lambda (i: nat).(\lambda (H1: (drop (S i) O c3 e2)).(eq_ind nat (plus (S +i) n) (\lambda (n0: nat).(drop (S n0) O (CHead c2 (Bind b) t) e2)) (drop_drop +(Bind b) (plus (S i) n) c2 e2 (IHc c3 n (getl_gen_S (Bind b) c2 c3 t n H0) e2 +i H1) t) (plus i (S n)) (plus_Snm_nSm i n)))))))) h))))) (\lambda (f: +F).(\lambda (t: T).(\lambda (c3: C).(\lambda (h: nat).(nat_ind (\lambda (n: +nat).((getl n (CHead c2 (Flat f) t) c3) \to (\forall (e2: C).(\forall (i: +nat).((drop (S i) O c3 e2) \to (drop (S (plus i n)) O (CHead c2 (Flat f) t) +e2)))))) (\lambda (H: (getl O (CHead c2 (Flat f) t) c3)).(\lambda (e2: +C).(\lambda (i: nat).(\lambda (H0: (drop (S i) O c3 e2)).(drop_drop (Flat f) +(plus i O) c2 e2 (IHc c3 O (getl_intro O c2 c3 c2 (drop_refl c2) +(clear_gen_flat f c2 c3 t (getl_gen_O (CHead c2 (Flat f) t) c3 H))) e2 i H0) +t))))) (\lambda (n: nat).(\lambda (_: (((getl n (CHead c2 (Flat f) t) c3) \to +(\forall (e2: C).(\forall (i: nat).((drop (S i) O c3 e2) \to (drop (S (plus i +n)) O (CHead c2 (Flat f) t) e2))))))).(\lambda (H0: (getl (S n) (CHead c2 +(Flat f) t) c3)).(\lambda (e2: C).(\lambda (i: nat).(\lambda (H1: (drop (S i) +O c3 e2)).(drop_drop (Flat f) (plus i (S n)) c2 e2 (IHc c3 (S n) (getl_gen_S +(Flat f) c2 c3 t n H0) e2 i H1) t))))))) h))))) k)))) c1). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/flt.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/flt.ma new file mode 100644 index 000000000..81a47ff2e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/flt.ma @@ -0,0 +1,66 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/getl/flt". + +include "getl/fwd.ma". + +include "clear/props.ma". + +include "flt/props.ma". + +theorem getl_flt: + \forall (b: B).(\forall (c: C).(\forall (e: C).(\forall (u: T).(\forall (i: +nat).((getl i c (CHead e (Bind b) u)) \to (flt e u c (TLRef i))))))) +\def + \lambda (b: B).(\lambda (c: C).(C_ind (\lambda (c0: C).(\forall (e: +C).(\forall (u: T).(\forall (i: nat).((getl i c0 (CHead e (Bind b) u)) \to +(flt e u c0 (TLRef i))))))) (\lambda (n: nat).(\lambda (e: C).(\lambda (u: +T).(\lambda (i: nat).(\lambda (H: (getl i (CSort n) (CHead e (Bind b) +u))).(getl_gen_sort n i (CHead e (Bind b) u) H (flt e u (CSort n) (TLRef +i)))))))) (\lambda (c0: C).(\lambda (H: ((\forall (e: C).(\forall (u: +T).(\forall (i: nat).((getl i c0 (CHead e (Bind b) u)) \to (flt e u c0 (TLRef +i)))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (e: C).(\lambda (u: +T).(\lambda (i: nat).(nat_ind (\lambda (n: nat).((getl n (CHead c0 k t) +(CHead e (Bind b) u)) \to (flt e u (CHead c0 k t) (TLRef n)))) (\lambda (H0: +(getl O (CHead c0 k t) (CHead e (Bind b) u))).(K_ind (\lambda (k0: K).((clear +(CHead c0 k0 t) (CHead e (Bind b) u)) \to (flt e u (CHead c0 k0 t) (TLRef +O)))) (\lambda (b0: B).(\lambda (H1: (clear (CHead c0 (Bind b0) t) (CHead e +(Bind b) u))).(let H2 \def (f_equal C C (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow e | (CHead c1 _ _) +\Rightarrow c1])) (CHead e (Bind b) u) (CHead c0 (Bind b0) t) (clear_gen_bind +b0 c0 (CHead e (Bind b) u) t H1)) in ((let H3 \def (f_equal C B (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow b | +(CHead _ k0 _) \Rightarrow (match k0 in K return (\lambda (_: K).B) with +[(Bind b1) \Rightarrow b1 | (Flat _) \Rightarrow b])])) (CHead e (Bind b) u) +(CHead c0 (Bind b0) t) (clear_gen_bind b0 c0 (CHead e (Bind b) u) t H1)) in +((let H4 \def (f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) +(CHead e (Bind b) u) (CHead c0 (Bind b0) t) (clear_gen_bind b0 c0 (CHead e +(Bind b) u) t H1)) in (\lambda (H5: (eq B b b0)).(\lambda (H6: (eq C e +c0)).(eq_ind_r T t (\lambda (t0: T).(flt e t0 (CHead c0 (Bind b0) t) (TLRef +O))) (eq_ind_r C c0 (\lambda (c1: C).(flt c1 t (CHead c0 (Bind b0) t) (TLRef +O))) (eq_ind B b (\lambda (b1: B).(flt c0 t (CHead c0 (Bind b1) t) (TLRef +O))) (flt_arith0 (Bind b) c0 t O) b0 H5) e H6) u H4)))) H3)) H2)))) (\lambda +(f: F).(\lambda (H1: (clear (CHead c0 (Flat f) t) (CHead e (Bind b) +u))).(flt_arith1 (Bind b) e c0 u (clear_cle c0 (CHead e (Bind b) u) +(clear_gen_flat f c0 (CHead e (Bind b) u) t H1)) (Flat f) t O))) k +(getl_gen_O (CHead c0 k t) (CHead e (Bind b) u) H0))) (\lambda (n: +nat).(\lambda (_: (((getl n (CHead c0 k t) (CHead e (Bind b) u)) \to (flt e u +(CHead c0 k t) (TLRef n))))).(\lambda (H1: (getl (S n) (CHead c0 k t) (CHead +e (Bind b) u))).(let H_y \def (H e u (r k n) (getl_gen_S k c0 (CHead e (Bind +b) u) t n H1)) in (flt_arith2 e c0 u (r k n) H_y k t (S n)))))) i)))))))) c)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/fwd.ma new file mode 100644 index 000000000..538165227 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/fwd.ma @@ -0,0 +1,107 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/getl/fwd". + +include "getl/defs.ma". + +include "drop/fwd.ma". + +include "clear/fwd.ma". + +theorem getl_gen_all: + \forall (c1: C).(\forall (c2: C).(\forall (i: nat).((getl i c1 c2) \to (ex2 +C (\lambda (e: C).(drop i O c1 e)) (\lambda (e: C).(clear e c2)))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (i: nat).(\lambda (H: (getl i c1 +c2)).(let H0 \def (match H in getl return (\lambda (_: (getl ? ? ?)).(ex2 C +(\lambda (e: C).(drop i O c1 e)) (\lambda (e: C).(clear e c2)))) with +[(getl_intro e H0 H1) \Rightarrow (ex_intro2 C (\lambda (e0: C).(drop i O c1 +e0)) (\lambda (e0: C).(clear e0 c2)) e H0 H1)]) in H0)))). + +theorem getl_gen_sort: + \forall (n: nat).(\forall (h: nat).(\forall (x: C).((getl h (CSort n) x) \to +(\forall (P: Prop).P)))) +\def + \lambda (n: nat).(\lambda (h: nat).(\lambda (x: C).(\lambda (H: (getl h +(CSort n) x)).(\lambda (P: Prop).(let H0 \def (getl_gen_all (CSort n) x h H) +in (ex2_ind C (\lambda (e: C).(drop h O (CSort n) e)) (\lambda (e: C).(clear +e x)) P (\lambda (x0: C).(\lambda (H1: (drop h O (CSort n) x0)).(\lambda (H2: +(clear x0 x)).(and3_ind (eq C x0 (CSort n)) (eq nat h O) (eq nat O O) P +(\lambda (H3: (eq C x0 (CSort n))).(\lambda (_: (eq nat h O)).(\lambda (_: +(eq nat O O)).(let H6 \def (eq_ind C x0 (\lambda (c: C).(clear c x)) H2 +(CSort n) H3) in (clear_gen_sort x n H6 P))))) (drop_gen_sort n h O x0 +H1))))) H0)))))). + +theorem getl_gen_O: + \forall (e: C).(\forall (x: C).((getl O e x) \to (clear e x))) +\def + \lambda (e: C).(\lambda (x: C).(\lambda (H: (getl O e x)).(let H0 \def +(getl_gen_all e x O H) in (ex2_ind C (\lambda (e0: C).(drop O O e e0)) +(\lambda (e0: C).(clear e0 x)) (clear e x) (\lambda (x0: C).(\lambda (H1: +(drop O O e x0)).(\lambda (H2: (clear x0 x)).(let H3 \def (eq_ind_r C x0 +(\lambda (c: C).(clear c x)) H2 e (drop_gen_refl e x0 H1)) in H3)))) H0)))). + +theorem getl_gen_S: + \forall (k: K).(\forall (c: C).(\forall (x: C).(\forall (u: T).(\forall (h: +nat).((getl (S h) (CHead c k u) x) \to (getl (r k h) c x)))))) +\def + \lambda (k: K).(\lambda (c: C).(\lambda (x: C).(\lambda (u: T).(\lambda (h: +nat).(\lambda (H: (getl (S h) (CHead c k u) x)).(let H0 \def (getl_gen_all +(CHead c k u) x (S h) H) in (ex2_ind C (\lambda (e: C).(drop (S h) O (CHead c +k u) e)) (\lambda (e: C).(clear e x)) (getl (r k h) c x) (\lambda (x0: +C).(\lambda (H1: (drop (S h) O (CHead c k u) x0)).(\lambda (H2: (clear x0 +x)).(getl_intro (r k h) c x x0 (drop_gen_drop k c x0 u h H1) H2)))) H0))))))). + +theorem getl_gen_flat: + \forall (f: F).(\forall (e: C).(\forall (d: C).(\forall (v: T).(\forall (i: +nat).((getl i (CHead e (Flat f) v) d) \to (getl i e d)))))) +\def + \lambda (f: F).(\lambda (e: C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: +nat).(nat_ind (\lambda (n: nat).((getl n (CHead e (Flat f) v) d) \to (getl n +e d))) (\lambda (H: (getl O (CHead e (Flat f) v) d)).(getl_intro O e d e +(drop_refl e) (clear_gen_flat f e d v (getl_gen_O (CHead e (Flat f) v) d +H)))) (\lambda (n: nat).(\lambda (_: (((getl n (CHead e (Flat f) v) d) \to +(getl n e d)))).(\lambda (H0: (getl (S n) (CHead e (Flat f) v) +d)).(getl_gen_S (Flat f) e d v n H0)))) i))))). + +theorem getl_gen_bind: + \forall (b: B).(\forall (e: C).(\forall (d: C).(\forall (v: T).(\forall (i: +nat).((getl i (CHead e (Bind b) v) d) \to (or (land (eq nat i O) (eq C d +(CHead e (Bind b) v))) (ex2 nat (\lambda (j: nat).(eq nat i (S j))) (\lambda +(j: nat).(getl j e d))))))))) +\def + \lambda (b: B).(\lambda (e: C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: +nat).(nat_ind (\lambda (n: nat).((getl n (CHead e (Bind b) v) d) \to (or +(land (eq nat n O) (eq C d (CHead e (Bind b) v))) (ex2 nat (\lambda (j: +nat).(eq nat n (S j))) (\lambda (j: nat).(getl j e d)))))) (\lambda (H: (getl +O (CHead e (Bind b) v) d)).(eq_ind_r C (CHead e (Bind b) v) (\lambda (c: +C).(or (land (eq nat O O) (eq C c (CHead e (Bind b) v))) (ex2 nat (\lambda +(j: nat).(eq nat O (S j))) (\lambda (j: nat).(getl j e c))))) (or_introl +(land (eq nat O O) (eq C (CHead e (Bind b) v) (CHead e (Bind b) v))) (ex2 nat +(\lambda (j: nat).(eq nat O (S j))) (\lambda (j: nat).(getl j e (CHead e +(Bind b) v)))) (conj (eq nat O O) (eq C (CHead e (Bind b) v) (CHead e (Bind +b) v)) (refl_equal nat O) (refl_equal C (CHead e (Bind b) v)))) d +(clear_gen_bind b e d v (getl_gen_O (CHead e (Bind b) v) d H)))) (\lambda (n: +nat).(\lambda (_: (((getl n (CHead e (Bind b) v) d) \to (or (land (eq nat n +O) (eq C d (CHead e (Bind b) v))) (ex2 nat (\lambda (j: nat).(eq nat n (S +j))) (\lambda (j: nat).(getl j e d))))))).(\lambda (H0: (getl (S n) (CHead e +(Bind b) v) d)).(or_intror (land (eq nat (S n) O) (eq C d (CHead e (Bind b) +v))) (ex2 nat (\lambda (j: nat).(eq nat (S n) (S j))) (\lambda (j: nat).(getl +j e d))) (ex_intro2 nat (\lambda (j: nat).(eq nat (S n) (S j))) (\lambda (j: +nat).(getl j e d)) n (refl_equal nat (S n)) (getl_gen_S (Bind b) e d v n +H0)))))) i))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/getl.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/getl.ma new file mode 100644 index 000000000..62218d746 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/getl.ma @@ -0,0 +1,53 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/getl/getl". + +include "getl/drop.ma". + +include "getl/clear.ma". + +theorem getl_conf_le: + \forall (i: nat).(\forall (a: C).(\forall (c: C).((getl i c a) \to (\forall +(e: C).(\forall (h: nat).((getl h c e) \to ((le h i) \to (getl (minus i h) e +a)))))))) +\def + \lambda (i: nat).(\lambda (a: C).(\lambda (c: C).(\lambda (H: (getl i c +a)).(\lambda (e: C).(\lambda (h: nat).(\lambda (H0: (getl h c e)).(\lambda +(H1: (le h i)).(let H2 \def (getl_gen_all c e h H0) in (ex2_ind C (\lambda +(e0: C).(drop h O c e0)) (\lambda (e0: C).(clear e0 e)) (getl (minus i h) e +a) (\lambda (x: C).(\lambda (H3: (drop h O c x)).(\lambda (H4: (clear x +e)).(getl_clear_conf (minus i h) x a (getl_drop_conf_ge i a c H x h O H3 H1) +e H4)))) H2))))))))). + +theorem getl_trans: + \forall (i: nat).(\forall (c1: C).(\forall (c2: C).(\forall (h: nat).((getl +h c1 c2) \to (\forall (e2: C).((getl i c2 e2) \to (getl (plus i h) c1 +e2))))))) +\def + \lambda (i: nat).(\lambda (c1: C).(\lambda (c2: C).(\lambda (h: +nat).(\lambda (H: (getl h c1 c2)).(\lambda (e2: C).(\lambda (H0: (getl i c2 +e2)).(let H1 \def (getl_gen_all c2 e2 i H0) in (ex2_ind C (\lambda (e: +C).(drop i O c2 e)) (\lambda (e: C).(clear e e2)) (getl (plus i h) c1 e2) +(\lambda (x: C).(\lambda (H2: (drop i O c2 x)).(\lambda (H3: (clear x +e2)).(nat_ind (\lambda (n: nat).((drop n O c2 x) \to (getl (plus n h) c1 +e2))) (\lambda (H4: (drop O O c2 x)).(let H5 \def (eq_ind_r C x (\lambda (c: +C).(clear c e2)) H3 c2 (drop_gen_refl c2 x H4)) in (getl_clear_trans (plus O +h) c1 c2 H e2 H5))) (\lambda (i0: nat).(\lambda (_: (((drop i0 O c2 x) \to +(getl (plus i0 h) c1 e2)))).(\lambda (H4: (drop (S i0) O c2 x)).(let H_y \def +(getl_drop_trans c1 c2 h H x i0 H4) in (getl_intro (plus (S i0) h) c1 e2 x +H_y H3))))) i H2)))) H1)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/props.ma new file mode 100644 index 000000000..a5228d950 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/props.ma @@ -0,0 +1,91 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/getl/props". + +include "getl/fwd.ma". + +include "drop/props.ma". + +include "clear/props.ma". + +theorem getl_refl: + \forall (b: B).(\forall (c: C).(\forall (u: T).(getl O (CHead c (Bind b) u) +(CHead c (Bind b) u)))) +\def + \lambda (b: B).(\lambda (c: C).(\lambda (u: T).(getl_intro O (CHead c (Bind +b) u) (CHead c (Bind b) u) (CHead c (Bind b) u) (drop_refl (CHead c (Bind b) +u)) (clear_bind b c u)))). + +theorem getl_head: + \forall (k: K).(\forall (h: nat).(\forall (c: C).(\forall (e: C).((getl (r k +h) c e) \to (\forall (u: T).(getl (S h) (CHead c k u) e)))))) +\def + \lambda (k: K).(\lambda (h: nat).(\lambda (c: C).(\lambda (e: C).(\lambda +(H: (getl (r k h) c e)).(\lambda (u: T).(let H0 \def (getl_gen_all c e (r k +h) H) in (ex2_ind C (\lambda (e0: C).(drop (r k h) O c e0)) (\lambda (e0: +C).(clear e0 e)) (getl (S h) (CHead c k u) e) (\lambda (x: C).(\lambda (H1: +(drop (r k h) O c x)).(\lambda (H2: (clear x e)).(getl_intro (S h) (CHead c k +u) e x (drop_drop k h c x H1 u) H2)))) H0))))))). + +theorem getl_flat: + \forall (c: C).(\forall (e: C).(\forall (h: nat).((getl h c e) \to (\forall +(f: F).(\forall (u: T).(getl h (CHead c (Flat f) u) e)))))) +\def + \lambda (c: C).(\lambda (e: C).(\lambda (h: nat).(\lambda (H: (getl h c +e)).(\lambda (f: F).(\lambda (u: T).(let H0 \def (getl_gen_all c e h H) in +(ex2_ind C (\lambda (e0: C).(drop h O c e0)) (\lambda (e0: C).(clear e0 e)) +(getl h (CHead c (Flat f) u) e) (\lambda (x: C).(\lambda (H1: (drop h O c +x)).(\lambda (H2: (clear x e)).(nat_ind (\lambda (n: nat).((drop n O c x) \to +(getl n (CHead c (Flat f) u) e))) (\lambda (H3: (drop O O c x)).(let H4 \def +(eq_ind_r C x (\lambda (c0: C).(clear c0 e)) H2 c (drop_gen_refl c x H3)) in +(getl_intro O (CHead c (Flat f) u) e (CHead c (Flat f) u) (drop_refl (CHead c +(Flat f) u)) (clear_flat c e H4 f u)))) (\lambda (h0: nat).(\lambda (_: +(((drop h0 O c x) \to (getl h0 (CHead c (Flat f) u) e)))).(\lambda (H3: (drop +(S h0) O c x)).(getl_intro (S h0) (CHead c (Flat f) u) e x (drop_drop (Flat +f) h0 c x H3 u) H2)))) h H1)))) H0))))))). + +theorem getl_ctail: + \forall (b: B).(\forall (c: C).(\forall (d: C).(\forall (u: T).(\forall (i: +nat).((getl i c (CHead d (Bind b) u)) \to (\forall (k: K).(\forall (v: +T).(getl i (CTail k v c) (CHead (CTail k v d) (Bind b) u))))))))) +\def + \lambda (b: B).(\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: +nat).(\lambda (H: (getl i c (CHead d (Bind b) u))).(\lambda (k: K).(\lambda +(v: T).(let H0 \def (getl_gen_all c (CHead d (Bind b) u) i H) in (ex2_ind C +(\lambda (e: C).(drop i O c e)) (\lambda (e: C).(clear e (CHead d (Bind b) +u))) (getl i (CTail k v c) (CHead (CTail k v d) (Bind b) u)) (\lambda (x: +C).(\lambda (H1: (drop i O c x)).(\lambda (H2: (clear x (CHead d (Bind b) +u))).(getl_intro i (CTail k v c) (CHead (CTail k v d) (Bind b) u) (CTail k v +x) (drop_ctail c x O i H1 k v) (clear_ctail b x d u H2 k v))))) H0))))))))). + +theorem getl_mono: + \forall (c: C).(\forall (x1: C).(\forall (h: nat).((getl h c x1) \to +(\forall (x2: C).((getl h c x2) \to (eq C x1 x2)))))) +\def + \lambda (c: C).(\lambda (x1: C).(\lambda (h: nat).(\lambda (H: (getl h c +x1)).(\lambda (x2: C).(\lambda (H0: (getl h c x2)).(let H1 \def (getl_gen_all +c x2 h H0) in (ex2_ind C (\lambda (e: C).(drop h O c e)) (\lambda (e: +C).(clear e x2)) (eq C x1 x2) (\lambda (x: C).(\lambda (H2: (drop h O c +x)).(\lambda (H3: (clear x x2)).(let H4 \def (getl_gen_all c x1 h H) in +(ex2_ind C (\lambda (e: C).(drop h O c e)) (\lambda (e: C).(clear e x1)) (eq +C x1 x2) (\lambda (x0: C).(\lambda (H5: (drop h O c x0)).(\lambda (H6: (clear +x0 x1)).(let H7 \def (eq_ind C x (\lambda (c0: C).(drop h O c c0)) H2 x0 +(drop_mono c x O h H2 x0 H5)) in (let H8 \def (eq_ind_r C x0 (\lambda (c0: +C).(drop h O c c0)) H7 x (drop_mono c x O h H2 x0 H5)) in (let H9 \def +(eq_ind_r C x0 (\lambda (c0: C).(clear c0 x1)) H6 x (drop_mono c x O h H2 x0 +H5)) in (clear_mono x x1 H9 x2 H3))))))) H4))))) H1))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/defs.ma new file mode 100644 index 000000000..fa327f922 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/defs.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/iso/defs". + +include "T/defs.ma". + +inductive iso: T \to (T \to Prop) \def +| iso_sort: \forall (n1: nat).(\forall (n2: nat).(iso (TSort n1) (TSort n2))) +| iso_lref: \forall (i1: nat).(\forall (i2: nat).(iso (TLRef i1) (TLRef i2))) +| iso_head: \forall (v1: T).(\forall (v2: T).(\forall (t1: T).(\forall (t2: +T).(\forall (k: K).(iso (THead k v1 t1) (THead k v2 t2)))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/fwd.ma new file mode 100644 index 000000000..5a6607941 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/fwd.ma @@ -0,0 +1,313 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/iso/fwd". + +include "iso/defs.ma". + +include "tlist/defs.ma". + +theorem iso_flats_lref_bind_false: + \forall (f: F).(\forall (b: B).(\forall (i: nat).(\forall (v: T).(\forall +(t: T).(\forall (vs: TList).((iso (THeads (Flat f) vs (TLRef i)) (THead (Bind +b) v t)) \to (\forall (P: Prop).P))))))) +\def + \lambda (f: F).(\lambda (b: B).(\lambda (i: nat).(\lambda (v: T).(\lambda +(t: T).(\lambda (vs: TList).(TList_ind (\lambda (t0: TList).((iso (THeads +(Flat f) t0 (TLRef i)) (THead (Bind b) v t)) \to (\forall (P: Prop).P))) +(\lambda (H: (iso (TLRef i) (THead (Bind b) v t))).(\lambda (P: Prop).(let H0 +\def (match H in iso return (\lambda (t0: T).(\lambda (t1: T).(\lambda (_: +(iso t0 t1)).((eq T t0 (TLRef i)) \to ((eq T t1 (THead (Bind b) v t)) \to +P))))) with [(iso_sort n1 n2) \Rightarrow (\lambda (H0: (eq T (TSort n1) +(TLRef i))).(\lambda (H1: (eq T (TSort n2) (THead (Bind b) v t))).((let H2 +\def (eq_ind T (TSort n1) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow False])) I (TLRef i) H0) in (False_ind ((eq T +(TSort n2) (THead (Bind b) v t)) \to P) H2)) H1))) | (iso_lref i1 i2) +\Rightarrow (\lambda (H0: (eq T (TLRef i1) (TLRef i))).(\lambda (H1: (eq T +(TLRef i2) (THead (Bind b) v t))).((let H2 \def (f_equal T nat (\lambda (e: +T).(match e in T return (\lambda (_: T).nat) with [(TSort _) \Rightarrow i1 | +(TLRef n) \Rightarrow n | (THead _ _ _) \Rightarrow i1])) (TLRef i1) (TLRef +i) H0) in (eq_ind nat i (\lambda (_: nat).((eq T (TLRef i2) (THead (Bind b) v +t)) \to P)) (\lambda (H3: (eq T (TLRef i2) (THead (Bind b) v t))).(let H4 +\def (eq_ind T (TLRef i2) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead (Bind b) v t) H3) in (False_ind P +H4))) i1 (sym_eq nat i1 i H2))) H1))) | (iso_head v1 v2 t1 t2 k) \Rightarrow +(\lambda (H0: (eq T (THead k v1 t1) (TLRef i))).(\lambda (H1: (eq T (THead k +v2 t2) (THead (Bind b) v t))).((let H2 \def (eq_ind T (THead k v1 t1) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +True])) I (TLRef i) H0) in (False_ind ((eq T (THead k v2 t2) (THead (Bind b) +v t)) \to P) H2)) H1)))]) in (H0 (refl_equal T (TLRef i)) (refl_equal T +(THead (Bind b) v t)))))) (\lambda (t0: T).(\lambda (t1: TList).(\lambda (_: +(((iso (THeads (Flat f) t1 (TLRef i)) (THead (Bind b) v t)) \to (\forall (P: +Prop).P)))).(\lambda (H0: (iso (THead (Flat f) t0 (THeads (Flat f) t1 (TLRef +i))) (THead (Bind b) v t))).(\lambda (P: Prop).(let H1 \def (match H0 in iso +return (\lambda (t2: T).(\lambda (t3: T).(\lambda (_: (iso t2 t3)).((eq T t2 +(THead (Flat f) t0 (THeads (Flat f) t1 (TLRef i)))) \to ((eq T t3 (THead +(Bind b) v t)) \to P))))) with [(iso_sort n1 n2) \Rightarrow (\lambda (H1: +(eq T (TSort n1) (THead (Flat f) t0 (THeads (Flat f) t1 (TLRef +i))))).(\lambda (H2: (eq T (TSort n2) (THead (Bind b) v t))).((let H3 \def +(eq_ind T (TSort n1) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow False])) I (THead (Flat f) t0 (THeads (Flat f) t1 +(TLRef i))) H1) in (False_ind ((eq T (TSort n2) (THead (Bind b) v t)) \to P) +H3)) H2))) | (iso_lref i1 i2) \Rightarrow (\lambda (H1: (eq T (TLRef i1) +(THead (Flat f) t0 (THeads (Flat f) t1 (TLRef i))))).(\lambda (H2: (eq T +(TLRef i2) (THead (Bind b) v t))).((let H3 \def (eq_ind T (TLRef i1) (\lambda +(e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I +(THead (Flat f) t0 (THeads (Flat f) t1 (TLRef i))) H1) in (False_ind ((eq T +(TLRef i2) (THead (Bind b) v t)) \to P) H3)) H2))) | (iso_head v1 v2 t2 t3 k) +\Rightarrow (\lambda (H1: (eq T (THead k v1 t2) (THead (Flat f) t0 (THeads +(Flat f) t1 (TLRef i))))).(\lambda (H2: (eq T (THead k v2 t3) (THead (Bind b) +v t))).((let H3 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t2 | (TLRef _) \Rightarrow t2 +| (THead _ _ t4) \Rightarrow t4])) (THead k v1 t2) (THead (Flat f) t0 (THeads +(Flat f) t1 (TLRef i))) H1) in ((let H4 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow v1 | +(TLRef _) \Rightarrow v1 | (THead _ t4 _) \Rightarrow t4])) (THead k v1 t2) +(THead (Flat f) t0 (THeads (Flat f) t1 (TLRef i))) H1) in ((let H5 \def +(f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) with +[(TSort _) \Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) +\Rightarrow k0])) (THead k v1 t2) (THead (Flat f) t0 (THeads (Flat f) t1 +(TLRef i))) H1) in (eq_ind K (Flat f) (\lambda (k0: K).((eq T v1 t0) \to ((eq +T t2 (THeads (Flat f) t1 (TLRef i))) \to ((eq T (THead k0 v2 t3) (THead (Bind +b) v t)) \to P)))) (\lambda (H6: (eq T v1 t0)).(eq_ind T t0 (\lambda (_: +T).((eq T t2 (THeads (Flat f) t1 (TLRef i))) \to ((eq T (THead (Flat f) v2 +t3) (THead (Bind b) v t)) \to P))) (\lambda (H7: (eq T t2 (THeads (Flat f) t1 +(TLRef i)))).(eq_ind T (THeads (Flat f) t1 (TLRef i)) (\lambda (_: T).((eq T +(THead (Flat f) v2 t3) (THead (Bind b) v t)) \to P)) (\lambda (H8: (eq T +(THead (Flat f) v2 t3) (THead (Bind b) v t))).(let H9 \def (eq_ind T (THead +(Flat f) v2 t3) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k0 _ +_) \Rightarrow (match k0 in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind b) v t) H8) +in (False_ind P H9))) t2 (sym_eq T t2 (THeads (Flat f) t1 (TLRef i)) H7))) v1 +(sym_eq T v1 t0 H6))) k (sym_eq K k (Flat f) H5))) H4)) H3)) H2)))]) in (H1 +(refl_equal T (THead (Flat f) t0 (THeads (Flat f) t1 (TLRef i)))) (refl_equal +T (THead (Bind b) v t))))))))) vs)))))). + +theorem iso_flats_flat_bind_false: + \forall (f1: F).(\forall (f2: F).(\forall (b: B).(\forall (v: T).(\forall +(v2: T).(\forall (t: T).(\forall (t2: T).(\forall (vs: TList).((iso (THeads +(Flat f1) vs (THead (Flat f2) v2 t2)) (THead (Bind b) v t)) \to (\forall (P: +Prop).P))))))))) +\def + \lambda (f1: F).(\lambda (f2: F).(\lambda (b: B).(\lambda (v: T).(\lambda +(v2: T).(\lambda (t: T).(\lambda (t2: T).(\lambda (vs: TList).(TList_ind +(\lambda (t0: TList).((iso (THeads (Flat f1) t0 (THead (Flat f2) v2 t2)) +(THead (Bind b) v t)) \to (\forall (P: Prop).P))) (\lambda (H: (iso (THead +(Flat f2) v2 t2) (THead (Bind b) v t))).(\lambda (P: Prop).(let H0 \def +(match H in iso return (\lambda (t0: T).(\lambda (t1: T).(\lambda (_: (iso t0 +t1)).((eq T t0 (THead (Flat f2) v2 t2)) \to ((eq T t1 (THead (Bind b) v t)) +\to P))))) with [(iso_sort n1 n2) \Rightarrow (\lambda (H0: (eq T (TSort n1) +(THead (Flat f2) v2 t2))).(\lambda (H1: (eq T (TSort n2) (THead (Bind b) v +t))).((let H2 \def (eq_ind T (TSort n1) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow False])) I (THead (Flat f2) v2 +t2) H0) in (False_ind ((eq T (TSort n2) (THead (Bind b) v t)) \to P) H2)) +H1))) | (iso_lref i1 i2) \Rightarrow (\lambda (H0: (eq T (TLRef i1) (THead +(Flat f2) v2 t2))).(\lambda (H1: (eq T (TLRef i2) (THead (Bind b) v +t))).((let H2 \def (eq_ind T (TLRef i1) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead (Flat f2) v2 +t2) H0) in (False_ind ((eq T (TLRef i2) (THead (Bind b) v t)) \to P) H2)) +H1))) | (iso_head v1 v0 t1 t0 k) \Rightarrow (\lambda (H0: (eq T (THead k v1 +t1) (THead (Flat f2) v2 t2))).(\lambda (H1: (eq T (THead k v0 t0) (THead +(Bind b) v t))).((let H2 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow t1 | (TLRef _) +\Rightarrow t1 | (THead _ _ t3) \Rightarrow t3])) (THead k v1 t1) (THead +(Flat f2) v2 t2) H0) in ((let H3 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow v1 | (TLRef _) +\Rightarrow v1 | (THead _ t3 _) \Rightarrow t3])) (THead k v1 t1) (THead +(Flat f2) v2 t2) H0) in ((let H4 \def (f_equal T K (\lambda (e: T).(match e +in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k v1 t1) (THead (Flat +f2) v2 t2) H0) in (eq_ind K (Flat f2) (\lambda (k0: K).((eq T v1 v2) \to ((eq +T t1 t2) \to ((eq T (THead k0 v0 t0) (THead (Bind b) v t)) \to P)))) (\lambda +(H5: (eq T v1 v2)).(eq_ind T v2 (\lambda (_: T).((eq T t1 t2) \to ((eq T +(THead (Flat f2) v0 t0) (THead (Bind b) v t)) \to P))) (\lambda (H6: (eq T t1 +t2)).(eq_ind T t2 (\lambda (_: T).((eq T (THead (Flat f2) v0 t0) (THead (Bind +b) v t)) \to P)) (\lambda (H7: (eq T (THead (Flat f2) v0 t0) (THead (Bind b) +v t))).(let H8 \def (eq_ind T (THead (Flat f2) v0 t0) (\lambda (e: T).(match +e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind b) v t) H7) in (False_ind P H8))) t1 +(sym_eq T t1 t2 H6))) v1 (sym_eq T v1 v2 H5))) k (sym_eq K k (Flat f2) H4))) +H3)) H2)) H1)))]) in (H0 (refl_equal T (THead (Flat f2) v2 t2)) (refl_equal T +(THead (Bind b) v t)))))) (\lambda (t0: T).(\lambda (t1: TList).(\lambda (_: +(((iso (THeads (Flat f1) t1 (THead (Flat f2) v2 t2)) (THead (Bind b) v t)) +\to (\forall (P: Prop).P)))).(\lambda (H0: (iso (THead (Flat f1) t0 (THeads +(Flat f1) t1 (THead (Flat f2) v2 t2))) (THead (Bind b) v t))).(\lambda (P: +Prop).(let H1 \def (match H0 in iso return (\lambda (t3: T).(\lambda (t4: +T).(\lambda (_: (iso t3 t4)).((eq T t3 (THead (Flat f1) t0 (THeads (Flat f1) +t1 (THead (Flat f2) v2 t2)))) \to ((eq T t4 (THead (Bind b) v t)) \to P))))) +with [(iso_sort n1 n2) \Rightarrow (\lambda (H1: (eq T (TSort n1) (THead +(Flat f1) t0 (THeads (Flat f1) t1 (THead (Flat f2) v2 t2))))).(\lambda (H2: +(eq T (TSort n2) (THead (Bind b) v t))).((let H3 \def (eq_ind T (TSort n1) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +False])) I (THead (Flat f1) t0 (THeads (Flat f1) t1 (THead (Flat f2) v2 t2))) +H1) in (False_ind ((eq T (TSort n2) (THead (Bind b) v t)) \to P) H3)) H2))) | +(iso_lref i1 i2) \Rightarrow (\lambda (H1: (eq T (TLRef i1) (THead (Flat f1) +t0 (THeads (Flat f1) t1 (THead (Flat f2) v2 t2))))).(\lambda (H2: (eq T +(TLRef i2) (THead (Bind b) v t))).((let H3 \def (eq_ind T (TLRef i1) (\lambda +(e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I +(THead (Flat f1) t0 (THeads (Flat f1) t1 (THead (Flat f2) v2 t2))) H1) in +(False_ind ((eq T (TLRef i2) (THead (Bind b) v t)) \to P) H3)) H2))) | +(iso_head v1 v0 t3 t4 k) \Rightarrow (\lambda (H1: (eq T (THead k v1 t3) +(THead (Flat f1) t0 (THeads (Flat f1) t1 (THead (Flat f2) v2 t2))))).(\lambda +(H2: (eq T (THead k v0 t4) (THead (Bind b) v t))).((let H3 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t5) \Rightarrow t5])) +(THead k v1 t3) (THead (Flat f1) t0 (THeads (Flat f1) t1 (THead (Flat f2) v2 +t2))) H1) in ((let H4 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow v1 | (TLRef _) \Rightarrow v1 +| (THead _ t5 _) \Rightarrow t5])) (THead k v1 t3) (THead (Flat f1) t0 +(THeads (Flat f1) t1 (THead (Flat f2) v2 t2))) H1) in ((let H5 \def (f_equal +T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) +\Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) \Rightarrow k0])) +(THead k v1 t3) (THead (Flat f1) t0 (THeads (Flat f1) t1 (THead (Flat f2) v2 +t2))) H1) in (eq_ind K (Flat f1) (\lambda (k0: K).((eq T v1 t0) \to ((eq T t3 +(THeads (Flat f1) t1 (THead (Flat f2) v2 t2))) \to ((eq T (THead k0 v0 t4) +(THead (Bind b) v t)) \to P)))) (\lambda (H6: (eq T v1 t0)).(eq_ind T t0 +(\lambda (_: T).((eq T t3 (THeads (Flat f1) t1 (THead (Flat f2) v2 t2))) \to +((eq T (THead (Flat f1) v0 t4) (THead (Bind b) v t)) \to P))) (\lambda (H7: +(eq T t3 (THeads (Flat f1) t1 (THead (Flat f2) v2 t2)))).(eq_ind T (THeads +(Flat f1) t1 (THead (Flat f2) v2 t2)) (\lambda (_: T).((eq T (THead (Flat f1) +v0 t4) (THead (Bind b) v t)) \to P)) (\lambda (H8: (eq T (THead (Flat f1) v0 +t4) (THead (Bind b) v t))).(let H9 \def (eq_ind T (THead (Flat f1) v0 t4) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow +(match k0 in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False +| (Flat _) \Rightarrow True])])) I (THead (Bind b) v t) H8) in (False_ind P +H9))) t3 (sym_eq T t3 (THeads (Flat f1) t1 (THead (Flat f2) v2 t2)) H7))) v1 +(sym_eq T v1 t0 H6))) k (sym_eq K k (Flat f1) H5))) H4)) H3)) H2)))]) in (H1 +(refl_equal T (THead (Flat f1) t0 (THeads (Flat f1) t1 (THead (Flat f2) v2 +t2)))) (refl_equal T (THead (Bind b) v t))))))))) vs)))))))). + +theorem iso_gen_sort: + \forall (u2: T).(\forall (n1: nat).((iso (TSort n1) u2) \to (ex nat (\lambda +(n2: nat).(eq T u2 (TSort n2)))))) +\def + \lambda (u2: T).(\lambda (n1: nat).(\lambda (H: (iso (TSort n1) u2)).(let H0 +\def (match H in iso return (\lambda (t: T).(\lambda (t0: T).(\lambda (_: +(iso t t0)).((eq T t (TSort n1)) \to ((eq T t0 u2) \to (ex nat (\lambda (n2: +nat).(eq T u2 (TSort n2))))))))) with [(iso_sort n0 n2) \Rightarrow (\lambda +(H0: (eq T (TSort n0) (TSort n1))).(\lambda (H1: (eq T (TSort n2) u2)).((let +H2 \def (f_equal T nat (\lambda (e: T).(match e in T return (\lambda (_: +T).nat) with [(TSort n) \Rightarrow n | (TLRef _) \Rightarrow n0 | (THead _ _ +_) \Rightarrow n0])) (TSort n0) (TSort n1) H0) in (eq_ind nat n1 (\lambda (_: +nat).((eq T (TSort n2) u2) \to (ex nat (\lambda (n3: nat).(eq T u2 (TSort +n3)))))) (\lambda (H3: (eq T (TSort n2) u2)).(eq_ind T (TSort n2) (\lambda +(t: T).(ex nat (\lambda (n3: nat).(eq T t (TSort n3))))) (ex_intro nat +(\lambda (n3: nat).(eq T (TSort n2) (TSort n3))) n2 (refl_equal T (TSort +n2))) u2 H3)) n0 (sym_eq nat n0 n1 H2))) H1))) | (iso_lref i1 i2) \Rightarrow +(\lambda (H0: (eq T (TLRef i1) (TSort n1))).(\lambda (H1: (eq T (TLRef i2) +u2)).((let H2 \def (eq_ind T (TLRef i1) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (TSort n1) H0) in +(False_ind ((eq T (TLRef i2) u2) \to (ex nat (\lambda (n2: nat).(eq T u2 +(TSort n2))))) H2)) H1))) | (iso_head v1 v2 t1 t2 k) \Rightarrow (\lambda +(H0: (eq T (THead k v1 t1) (TSort n1))).(\lambda (H1: (eq T (THead k v2 t2) +u2)).((let H2 \def (eq_ind T (THead k v1 t1) (\lambda (e: T).(match e in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n1) H0) in +(False_ind ((eq T (THead k v2 t2) u2) \to (ex nat (\lambda (n2: nat).(eq T u2 +(TSort n2))))) H2)) H1)))]) in (H0 (refl_equal T (TSort n1)) (refl_equal T +u2))))). + +theorem iso_gen_lref: + \forall (u2: T).(\forall (n1: nat).((iso (TLRef n1) u2) \to (ex nat (\lambda +(n2: nat).(eq T u2 (TLRef n2)))))) +\def + \lambda (u2: T).(\lambda (n1: nat).(\lambda (H: (iso (TLRef n1) u2)).(let H0 +\def (match H in iso return (\lambda (t: T).(\lambda (t0: T).(\lambda (_: +(iso t t0)).((eq T t (TLRef n1)) \to ((eq T t0 u2) \to (ex nat (\lambda (n2: +nat).(eq T u2 (TLRef n2))))))))) with [(iso_sort n0 n2) \Rightarrow (\lambda +(H0: (eq T (TSort n0) (TLRef n1))).(\lambda (H1: (eq T (TSort n2) u2)).((let +H2 \def (eq_ind T (TSort n0) (\lambda (e: T).(match e in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow False])) I (TLRef n1) H0) in (False_ind ((eq T +(TSort n2) u2) \to (ex nat (\lambda (n3: nat).(eq T u2 (TLRef n3))))) H2)) +H1))) | (iso_lref i1 i2) \Rightarrow (\lambda (H0: (eq T (TLRef i1) (TLRef +n1))).(\lambda (H1: (eq T (TLRef i2) u2)).((let H2 \def (f_equal T nat +(\lambda (e: T).(match e in T return (\lambda (_: T).nat) with [(TSort _) +\Rightarrow i1 | (TLRef n) \Rightarrow n | (THead _ _ _) \Rightarrow i1])) +(TLRef i1) (TLRef n1) H0) in (eq_ind nat n1 (\lambda (_: nat).((eq T (TLRef +i2) u2) \to (ex nat (\lambda (n2: nat).(eq T u2 (TLRef n2)))))) (\lambda (H3: +(eq T (TLRef i2) u2)).(eq_ind T (TLRef i2) (\lambda (t: T).(ex nat (\lambda +(n2: nat).(eq T t (TLRef n2))))) (ex_intro nat (\lambda (n2: nat).(eq T +(TLRef i2) (TLRef n2))) i2 (refl_equal T (TLRef i2))) u2 H3)) i1 (sym_eq nat +i1 n1 H2))) H1))) | (iso_head v1 v2 t1 t2 k) \Rightarrow (\lambda (H0: (eq T +(THead k v1 t1) (TLRef n1))).(\lambda (H1: (eq T (THead k v2 t2) u2)).((let +H2 \def (eq_ind T (THead k v1 t1) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n1) H0) in +(False_ind ((eq T (THead k v2 t2) u2) \to (ex nat (\lambda (n2: nat).(eq T u2 +(TLRef n2))))) H2)) H1)))]) in (H0 (refl_equal T (TLRef n1)) (refl_equal T +u2))))). + +theorem iso_gen_head: + \forall (k: K).(\forall (v1: T).(\forall (t1: T).(\forall (u2: T).((iso +(THead k v1 t1) u2) \to (ex_2 T T (\lambda (v2: T).(\lambda (t2: T).(eq T u2 +(THead k v2 t2))))))))) +\def + \lambda (k: K).(\lambda (v1: T).(\lambda (t1: T).(\lambda (u2: T).(\lambda +(H: (iso (THead k v1 t1) u2)).(let H0 \def (match H in iso return (\lambda +(t: T).(\lambda (t0: T).(\lambda (_: (iso t t0)).((eq T t (THead k v1 t1)) +\to ((eq T t0 u2) \to (ex_2 T T (\lambda (v2: T).(\lambda (t2: T).(eq T u2 +(THead k v2 t2)))))))))) with [(iso_sort n1 n2) \Rightarrow (\lambda (H0: (eq +T (TSort n1) (THead k v1 t1))).(\lambda (H1: (eq T (TSort n2) u2)).((let H2 +\def (eq_ind T (TSort n1) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow False])) I (THead k v1 t1) H0) in (False_ind ((eq T +(TSort n2) u2) \to (ex_2 T T (\lambda (v2: T).(\lambda (t2: T).(eq T u2 +(THead k v2 t2)))))) H2)) H1))) | (iso_lref i1 i2) \Rightarrow (\lambda (H0: +(eq T (TLRef i1) (THead k v1 t1))).(\lambda (H1: (eq T (TLRef i2) u2)).((let +H2 \def (eq_ind T (TLRef i1) (\lambda (e: T).(match e in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead k v1 t1) H0) in (False_ind ((eq T +(TLRef i2) u2) \to (ex_2 T T (\lambda (v2: T).(\lambda (t2: T).(eq T u2 +(THead k v2 t2)))))) H2)) H1))) | (iso_head v0 v2 t0 t2 k0) \Rightarrow +(\lambda (H0: (eq T (THead k0 v0 t0) (THead k v1 t1))).(\lambda (H1: (eq T +(THead k0 v2 t2) u2)).((let H2 \def (f_equal T T (\lambda (e: T).(match e in +T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) +\Rightarrow t0 | (THead _ _ t) \Rightarrow t])) (THead k0 v0 t0) (THead k v1 +t1) H0) in ((let H3 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow v0 | (TLRef _) \Rightarrow v0 +| (THead _ t _) \Rightarrow t])) (THead k0 v0 t0) (THead k v1 t1) H0) in +((let H4 \def (f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: +T).K) with [(TSort _) \Rightarrow k0 | (TLRef _) \Rightarrow k0 | (THead k1 _ +_) \Rightarrow k1])) (THead k0 v0 t0) (THead k v1 t1) H0) in (eq_ind K k +(\lambda (k1: K).((eq T v0 v1) \to ((eq T t0 t1) \to ((eq T (THead k1 v2 t2) +u2) \to (ex_2 T T (\lambda (v3: T).(\lambda (t3: T).(eq T u2 (THead k v3 +t3))))))))) (\lambda (H5: (eq T v0 v1)).(eq_ind T v1 (\lambda (_: T).((eq T +t0 t1) \to ((eq T (THead k v2 t2) u2) \to (ex_2 T T (\lambda (v3: T).(\lambda +(t3: T).(eq T u2 (THead k v3 t3)))))))) (\lambda (H6: (eq T t0 t1)).(eq_ind T +t1 (\lambda (_: T).((eq T (THead k v2 t2) u2) \to (ex_2 T T (\lambda (v3: +T).(\lambda (t3: T).(eq T u2 (THead k v3 t3))))))) (\lambda (H7: (eq T (THead +k v2 t2) u2)).(eq_ind T (THead k v2 t2) (\lambda (t: T).(ex_2 T T (\lambda +(v3: T).(\lambda (t3: T).(eq T t (THead k v3 t3)))))) (ex_2_intro T T +(\lambda (v3: T).(\lambda (t3: T).(eq T (THead k v2 t2) (THead k v3 t3)))) v2 +t2 (refl_equal T (THead k v2 t2))) u2 H7)) t0 (sym_eq T t0 t1 H6))) v0 +(sym_eq T v0 v1 H5))) k0 (sym_eq K k0 k H4))) H3)) H2)) H1)))]) in (H0 +(refl_equal T (THead k v1 t1)) (refl_equal T u2))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/props.ma new file mode 100644 index 000000000..edc9758a9 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/props.ma @@ -0,0 +1,52 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/iso/props". + +include "iso/fwd.ma". + +theorem iso_refl: + \forall (t: T).(iso t t) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(iso t0 t0)) (\lambda (n: +nat).(iso_sort n n)) (\lambda (n: nat).(iso_lref n n)) (\lambda (k: +K).(\lambda (t0: T).(\lambda (_: (iso t0 t0)).(\lambda (t1: T).(\lambda (_: +(iso t1 t1)).(iso_head t0 t0 t1 t1 k)))))) t). + +theorem iso_trans: + \forall (t1: T).(\forall (t2: T).((iso t1 t2) \to (\forall (t3: T).((iso t2 +t3) \to (iso t1 t3))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (iso t1 t2)).(iso_ind (\lambda +(t: T).(\lambda (t0: T).(\forall (t3: T).((iso t0 t3) \to (iso t t3))))) +(\lambda (n1: nat).(\lambda (n2: nat).(\lambda (t3: T).(\lambda (H0: (iso +(TSort n2) t3)).(let H_x \def (iso_gen_sort t3 n2 H0) in (let H1 \def H_x in +(ex_ind nat (\lambda (n3: nat).(eq T t3 (TSort n3))) (iso (TSort n1) t3) +(\lambda (x: nat).(\lambda (H2: (eq T t3 (TSort x))).(eq_ind_r T (TSort x) +(\lambda (t: T).(iso (TSort n1) t)) (iso_sort n1 x) t3 H2))) H1))))))) +(\lambda (i1: nat).(\lambda (i2: nat).(\lambda (t3: T).(\lambda (H0: (iso +(TLRef i2) t3)).(let H_x \def (iso_gen_lref t3 i2 H0) in (let H1 \def H_x in +(ex_ind nat (\lambda (n2: nat).(eq T t3 (TLRef n2))) (iso (TLRef i1) t3) +(\lambda (x: nat).(\lambda (H2: (eq T t3 (TLRef x))).(eq_ind_r T (TLRef x) +(\lambda (t: T).(iso (TLRef i1) t)) (iso_lref i1 x) t3 H2))) H1))))))) +(\lambda (v1: T).(\lambda (v2: T).(\lambda (t3: T).(\lambda (t4: T).(\lambda +(k: K).(\lambda (t5: T).(\lambda (H0: (iso (THead k v2 t4) t5)).(let H_x \def +(iso_gen_head k v2 t4 t5 H0) in (let H1 \def H_x in (ex_2_ind T T (\lambda +(v3: T).(\lambda (t6: T).(eq T t5 (THead k v3 t6)))) (iso (THead k v1 t3) t5) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (H2: (eq T t5 (THead k x0 +x1))).(eq_ind_r T (THead k x0 x1) (\lambda (t: T).(iso (THead k v1 t3) t)) +(iso_head v1 x0 t3 x1 k) t5 H2)))) H1)))))))))) t1 t2 H))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/asucc.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/asucc.ma new file mode 100644 index 000000000..25f9dfd07 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/asucc.ma @@ -0,0 +1,746 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/leq/asucc". + +include "leq/props.ma". + +include "aplus/props.ma". + +theorem asucc_repl: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((leq g a1 a2) \to (leq g +(asucc g a1) (asucc g a2))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (H: (leq g a1 +a2)).(leq_ind g (\lambda (a: A).(\lambda (a0: A).(leq g (asucc g a) (asucc g +a0)))) (\lambda (h1: nat).(\lambda (h2: nat).(\lambda (n1: nat).(\lambda (n2: +nat).(\lambda (k: nat).(\lambda (H0: (eq A (aplus g (ASort h1 n1) k) (aplus g +(ASort h2 n2) k))).(nat_ind (\lambda (n: nat).((eq A (aplus g (ASort n n1) k) +(aplus g (ASort h2 n2) k)) \to (leq g (match n with [O \Rightarrow (ASort O +(next g n1)) | (S h) \Rightarrow (ASort h n1)]) (match h2 with [O \Rightarrow +(ASort O (next g n2)) | (S h) \Rightarrow (ASort h n2)])))) (\lambda (H1: (eq +A (aplus g (ASort O n1) k) (aplus g (ASort h2 n2) k))).(nat_ind (\lambda (n: +nat).((eq A (aplus g (ASort O n1) k) (aplus g (ASort n n2) k)) \to (leq g +(ASort O (next g n1)) (match n with [O \Rightarrow (ASort O (next g n2)) | (S +h) \Rightarrow (ASort h n2)])))) (\lambda (H2: (eq A (aplus g (ASort O n1) k) +(aplus g (ASort O n2) k))).(leq_sort g O O (next g n1) (next g n2) k (eq_ind +A (aplus g (ASort O n1) (S k)) (\lambda (a: A).(eq A a (aplus g (ASort O +(next g n2)) k))) (eq_ind A (aplus g (ASort O n2) (S k)) (\lambda (a: A).(eq +A (aplus g (ASort O n1) (S k)) a)) (eq_ind_r A (aplus g (ASort O n2) k) +(\lambda (a: A).(eq A (asucc g a) (asucc g (aplus g (ASort O n2) k)))) +(refl_equal A (asucc g (aplus g (ASort O n2) k))) (aplus g (ASort O n1) k) +H2) (aplus g (ASort O (next g n2)) k) (aplus_sort_O_S_simpl g n2 k)) (aplus g +(ASort O (next g n1)) k) (aplus_sort_O_S_simpl g n1 k)))) (\lambda (h3: +nat).(\lambda (_: (((eq A (aplus g (ASort O n1) k) (aplus g (ASort h3 n2) k)) +\to (leq g (ASort O (next g n1)) (match h3 with [O \Rightarrow (ASort O (next +g n2)) | (S h) \Rightarrow (ASort h n2)]))))).(\lambda (H2: (eq A (aplus g +(ASort O n1) k) (aplus g (ASort (S h3) n2) k))).(leq_sort g O h3 (next g n1) +n2 k (eq_ind A (aplus g (ASort O n1) (S k)) (\lambda (a: A).(eq A a (aplus g +(ASort h3 n2) k))) (eq_ind A (aplus g (ASort (S h3) n2) (S k)) (\lambda (a: +A).(eq A (aplus g (ASort O n1) (S k)) a)) (eq_ind_r A (aplus g (ASort (S h3) +n2) k) (\lambda (a: A).(eq A (asucc g a) (asucc g (aplus g (ASort (S h3) n2) +k)))) (refl_equal A (asucc g (aplus g (ASort (S h3) n2) k))) (aplus g (ASort +O n1) k) H2) (aplus g (ASort h3 n2) k) (aplus_sort_S_S_simpl g n2 h3 k)) +(aplus g (ASort O (next g n1)) k) (aplus_sort_O_S_simpl g n1 k)))))) h2 H1)) +(\lambda (h3: nat).(\lambda (IHh1: (((eq A (aplus g (ASort h3 n1) k) (aplus g +(ASort h2 n2) k)) \to (leq g (match h3 with [O \Rightarrow (ASort O (next g +n1)) | (S h) \Rightarrow (ASort h n1)]) (match h2 with [O \Rightarrow (ASort +O (next g n2)) | (S h) \Rightarrow (ASort h n2)]))))).(\lambda (H1: (eq A +(aplus g (ASort (S h3) n1) k) (aplus g (ASort h2 n2) k))).(nat_ind (\lambda +(n: nat).((eq A (aplus g (ASort (S h3) n1) k) (aplus g (ASort n n2) k)) \to +((((eq A (aplus g (ASort h3 n1) k) (aplus g (ASort n n2) k)) \to (leq g +(match h3 with [O \Rightarrow (ASort O (next g n1)) | (S h) \Rightarrow +(ASort h n1)]) (match n with [O \Rightarrow (ASort O (next g n2)) | (S h) +\Rightarrow (ASort h n2)])))) \to (leq g (ASort h3 n1) (match n with [O +\Rightarrow (ASort O (next g n2)) | (S h) \Rightarrow (ASort h n2)]))))) +(\lambda (H2: (eq A (aplus g (ASort (S h3) n1) k) (aplus g (ASort O n2) +k))).(\lambda (_: (((eq A (aplus g (ASort h3 n1) k) (aplus g (ASort O n2) k)) +\to (leq g (match h3 with [O \Rightarrow (ASort O (next g n1)) | (S h) +\Rightarrow (ASort h n1)]) (ASort O (next g n2)))))).(leq_sort g h3 O n1 +(next g n2) k (eq_ind A (aplus g (ASort O n2) (S k)) (\lambda (a: A).(eq A +(aplus g (ASort h3 n1) k) a)) (eq_ind A (aplus g (ASort (S h3) n1) (S k)) +(\lambda (a: A).(eq A a (aplus g (ASort O n2) (S k)))) (eq_ind_r A (aplus g +(ASort O n2) k) (\lambda (a: A).(eq A (asucc g a) (asucc g (aplus g (ASort O +n2) k)))) (refl_equal A (asucc g (aplus g (ASort O n2) k))) (aplus g (ASort +(S h3) n1) k) H2) (aplus g (ASort h3 n1) k) (aplus_sort_S_S_simpl g n1 h3 k)) +(aplus g (ASort O (next g n2)) k) (aplus_sort_O_S_simpl g n2 k))))) (\lambda +(h4: nat).(\lambda (_: (((eq A (aplus g (ASort (S h3) n1) k) (aplus g (ASort +h4 n2) k)) \to ((((eq A (aplus g (ASort h3 n1) k) (aplus g (ASort h4 n2) k)) +\to (leq g (match h3 with [O \Rightarrow (ASort O (next g n1)) | (S h) +\Rightarrow (ASort h n1)]) (match h4 with [O \Rightarrow (ASort O (next g +n2)) | (S h) \Rightarrow (ASort h n2)])))) \to (leq g (ASort h3 n1) (match h4 +with [O \Rightarrow (ASort O (next g n2)) | (S h) \Rightarrow (ASort h +n2)])))))).(\lambda (H2: (eq A (aplus g (ASort (S h3) n1) k) (aplus g (ASort +(S h4) n2) k))).(\lambda (_: (((eq A (aplus g (ASort h3 n1) k) (aplus g +(ASort (S h4) n2) k)) \to (leq g (match h3 with [O \Rightarrow (ASort O (next +g n1)) | (S h) \Rightarrow (ASort h n1)]) (ASort h4 n2))))).(leq_sort g h3 h4 +n1 n2 k (eq_ind A (aplus g (ASort (S h3) n1) (S k)) (\lambda (a: A).(eq A a +(aplus g (ASort h4 n2) k))) (eq_ind A (aplus g (ASort (S h4) n2) (S k)) +(\lambda (a: A).(eq A (aplus g (ASort (S h3) n1) (S k)) a)) (eq_ind_r A +(aplus g (ASort (S h4) n2) k) (\lambda (a: A).(eq A (asucc g a) (asucc g +(aplus g (ASort (S h4) n2) k)))) (refl_equal A (asucc g (aplus g (ASort (S +h4) n2) k))) (aplus g (ASort (S h3) n1) k) H2) (aplus g (ASort h4 n2) k) +(aplus_sort_S_S_simpl g n2 h4 k)) (aplus g (ASort h3 n1) k) +(aplus_sort_S_S_simpl g n1 h3 k))))))) h2 H1 IHh1)))) h1 H0))))))) (\lambda +(a3: A).(\lambda (a4: A).(\lambda (H0: (leq g a3 a4)).(\lambda (_: (leq g +(asucc g a3) (asucc g a4))).(\lambda (a5: A).(\lambda (a6: A).(\lambda (_: +(leq g a5 a6)).(\lambda (H3: (leq g (asucc g a5) (asucc g a6))).(leq_head g +a3 a4 H0 (asucc g a5) (asucc g a6) H3))))))))) a1 a2 H)))). + +theorem asucc_inj: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((leq g (asucc g a1) (asucc +g a2)) \to (leq g a1 a2)))) +\def + \lambda (g: G).(\lambda (a1: A).(A_ind (\lambda (a: A).(\forall (a2: +A).((leq g (asucc g a) (asucc g a2)) \to (leq g a a2)))) (\lambda (n: +nat).(\lambda (n0: nat).(\lambda (a2: A).(A_ind (\lambda (a: A).((leq g +(asucc g (ASort n n0)) (asucc g a)) \to (leq g (ASort n n0) a))) (\lambda +(n1: nat).(\lambda (n2: nat).(\lambda (H: (leq g (asucc g (ASort n n0)) +(asucc g (ASort n1 n2)))).(nat_ind (\lambda (n3: nat).((leq g (asucc g (ASort +n3 n0)) (asucc g (ASort n1 n2))) \to (leq g (ASort n3 n0) (ASort n1 n2)))) +(\lambda (H0: (leq g (asucc g (ASort O n0)) (asucc g (ASort n1 +n2)))).(nat_ind (\lambda (n3: nat).((leq g (asucc g (ASort O n0)) (asucc g +(ASort n3 n2))) \to (leq g (ASort O n0) (ASort n3 n2)))) (\lambda (H1: (leq g +(asucc g (ASort O n0)) (asucc g (ASort O n2)))).(let H2 \def (match H1 in leq +return (\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a +(ASort O (next g n0))) \to ((eq A a0 (ASort O (next g n2))) \to (leq g (ASort +O n0) (ASort O n2))))))) with [(leq_sort h1 h2 n3 n4 k H2) \Rightarrow +(\lambda (H3: (eq A (ASort h1 n3) (ASort O (next g n0)))).(\lambda (H4: (eq A +(ASort h2 n4) (ASort O (next g n2)))).((let H5 \def (f_equal A nat (\lambda +(e: A).(match e in A return (\lambda (_: A).nat) with [(ASort _ n5) +\Rightarrow n5 | (AHead _ _) \Rightarrow n3])) (ASort h1 n3) (ASort O (next g +n0)) H3) in ((let H6 \def (f_equal A nat (\lambda (e: A).(match e in A return +(\lambda (_: A).nat) with [(ASort n5 _) \Rightarrow n5 | (AHead _ _) +\Rightarrow h1])) (ASort h1 n3) (ASort O (next g n0)) H3) in (eq_ind nat O +(\lambda (n5: nat).((eq nat n3 (next g n0)) \to ((eq A (ASort h2 n4) (ASort O +(next g n2))) \to ((eq A (aplus g (ASort n5 n3) k) (aplus g (ASort h2 n4) k)) +\to (leq g (ASort O n0) (ASort O n2)))))) (\lambda (H7: (eq nat n3 (next g +n0))).(eq_ind nat (next g n0) (\lambda (n5: nat).((eq A (ASort h2 n4) (ASort +O (next g n2))) \to ((eq A (aplus g (ASort O n5) k) (aplus g (ASort h2 n4) +k)) \to (leq g (ASort O n0) (ASort O n2))))) (\lambda (H8: (eq A (ASort h2 +n4) (ASort O (next g n2)))).(let H9 \def (f_equal A nat (\lambda (e: +A).(match e in A return (\lambda (_: A).nat) with [(ASort _ n5) \Rightarrow +n5 | (AHead _ _) \Rightarrow n4])) (ASort h2 n4) (ASort O (next g n2)) H8) in +((let H10 \def (f_equal A nat (\lambda (e: A).(match e in A return (\lambda +(_: A).nat) with [(ASort n5 _) \Rightarrow n5 | (AHead _ _) \Rightarrow h2])) +(ASort h2 n4) (ASort O (next g n2)) H8) in (eq_ind nat O (\lambda (n5: +nat).((eq nat n4 (next g n2)) \to ((eq A (aplus g (ASort O (next g n0)) k) +(aplus g (ASort n5 n4) k)) \to (leq g (ASort O n0) (ASort O n2))))) (\lambda +(H11: (eq nat n4 (next g n2))).(eq_ind nat (next g n2) (\lambda (n5: +nat).((eq A (aplus g (ASort O (next g n0)) k) (aplus g (ASort O n5) k)) \to +(leq g (ASort O n0) (ASort O n2)))) (\lambda (H12: (eq A (aplus g (ASort O +(next g n0)) k) (aplus g (ASort O (next g n2)) k))).(let H13 \def (eq_ind_r A +(aplus g (ASort O (next g n0)) k) (\lambda (a: A).(eq A a (aplus g (ASort O +(next g n2)) k))) H12 (aplus g (ASort O n0) (S k)) (aplus_sort_O_S_simpl g n0 +k)) in (let H14 \def (eq_ind_r A (aplus g (ASort O (next g n2)) k) (\lambda +(a: A).(eq A (aplus g (ASort O n0) (S k)) a)) H13 (aplus g (ASort O n2) (S +k)) (aplus_sort_O_S_simpl g n2 k)) in (leq_sort g O O n0 n2 (S k) H14)))) n4 +(sym_eq nat n4 (next g n2) H11))) h2 (sym_eq nat h2 O H10))) H9))) n3 (sym_eq +nat n3 (next g n0) H7))) h1 (sym_eq nat h1 O H6))) H5)) H4 H2))) | (leq_head +a0 a3 H2 a4 a5 H3) \Rightarrow (\lambda (H4: (eq A (AHead a0 a4) (ASort O +(next g n0)))).(\lambda (H5: (eq A (AHead a3 a5) (ASort O (next g +n2)))).((let H6 \def (eq_ind A (AHead a0 a4) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ +_) \Rightarrow True])) I (ASort O (next g n0)) H4) in (False_ind ((eq A +(AHead a3 a5) (ASort O (next g n2))) \to ((leq g a0 a3) \to ((leq g a4 a5) +\to (leq g (ASort O n0) (ASort O n2))))) H6)) H5 H2 H3)))]) in (H2 +(refl_equal A (ASort O (next g n0))) (refl_equal A (ASort O (next g n2)))))) +(\lambda (n3: nat).(\lambda (_: (((leq g (asucc g (ASort O n0)) (asucc g +(ASort n3 n2))) \to (leq g (ASort O n0) (ASort n3 n2))))).(\lambda (H1: (leq +g (asucc g (ASort O n0)) (asucc g (ASort (S n3) n2)))).(let H2 \def (match H1 +in leq return (\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a +a0)).((eq A a (ASort O (next g n0))) \to ((eq A a0 (ASort n3 n2)) \to (leq g +(ASort O n0) (ASort (S n3) n2))))))) with [(leq_sort h1 h2 n4 n5 k H2) +\Rightarrow (\lambda (H3: (eq A (ASort h1 n4) (ASort O (next g +n0)))).(\lambda (H4: (eq A (ASort h2 n5) (ASort n3 n2))).((let H5 \def +(f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) with +[(ASort _ n6) \Rightarrow n6 | (AHead _ _) \Rightarrow n4])) (ASort h1 n4) +(ASort O (next g n0)) H3) in ((let H6 \def (f_equal A nat (\lambda (e: +A).(match e in A return (\lambda (_: A).nat) with [(ASort n6 _) \Rightarrow +n6 | (AHead _ _) \Rightarrow h1])) (ASort h1 n4) (ASort O (next g n0)) H3) in +(eq_ind nat O (\lambda (n6: nat).((eq nat n4 (next g n0)) \to ((eq A (ASort +h2 n5) (ASort n3 n2)) \to ((eq A (aplus g (ASort n6 n4) k) (aplus g (ASort h2 +n5) k)) \to (leq g (ASort O n0) (ASort (S n3) n2)))))) (\lambda (H7: (eq nat +n4 (next g n0))).(eq_ind nat (next g n0) (\lambda (n6: nat).((eq A (ASort h2 +n5) (ASort n3 n2)) \to ((eq A (aplus g (ASort O n6) k) (aplus g (ASort h2 n5) +k)) \to (leq g (ASort O n0) (ASort (S n3) n2))))) (\lambda (H8: (eq A (ASort +h2 n5) (ASort n3 n2))).(let H9 \def (f_equal A nat (\lambda (e: A).(match e +in A return (\lambda (_: A).nat) with [(ASort _ n6) \Rightarrow n6 | (AHead _ +_) \Rightarrow n5])) (ASort h2 n5) (ASort n3 n2) H8) in ((let H10 \def +(f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) with +[(ASort n6 _) \Rightarrow n6 | (AHead _ _) \Rightarrow h2])) (ASort h2 n5) +(ASort n3 n2) H8) in (eq_ind nat n3 (\lambda (n6: nat).((eq nat n5 n2) \to +((eq A (aplus g (ASort O (next g n0)) k) (aplus g (ASort n6 n5) k)) \to (leq +g (ASort O n0) (ASort (S n3) n2))))) (\lambda (H11: (eq nat n5 n2)).(eq_ind +nat n2 (\lambda (n6: nat).((eq A (aplus g (ASort O (next g n0)) k) (aplus g +(ASort n3 n6) k)) \to (leq g (ASort O n0) (ASort (S n3) n2)))) (\lambda (H12: +(eq A (aplus g (ASort O (next g n0)) k) (aplus g (ASort n3 n2) k))).(let H13 +\def (eq_ind_r A (aplus g (ASort O (next g n0)) k) (\lambda (a: A).(eq A a +(aplus g (ASort n3 n2) k))) H12 (aplus g (ASort O n0) (S k)) +(aplus_sort_O_S_simpl g n0 k)) in (let H14 \def (eq_ind_r A (aplus g (ASort +n3 n2) k) (\lambda (a: A).(eq A (aplus g (ASort O n0) (S k)) a)) H13 (aplus g +(ASort (S n3) n2) (S k)) (aplus_sort_S_S_simpl g n2 n3 k)) in (leq_sort g O +(S n3) n0 n2 (S k) H14)))) n5 (sym_eq nat n5 n2 H11))) h2 (sym_eq nat h2 n3 +H10))) H9))) n4 (sym_eq nat n4 (next g n0) H7))) h1 (sym_eq nat h1 O H6))) +H5)) H4 H2))) | (leq_head a0 a3 H2 a4 a5 H3) \Rightarrow (\lambda (H4: (eq A +(AHead a0 a4) (ASort O (next g n0)))).(\lambda (H5: (eq A (AHead a3 a5) +(ASort n3 n2))).((let H6 \def (eq_ind A (AHead a0 a4) (\lambda (e: A).(match +e in A return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | +(AHead _ _) \Rightarrow True])) I (ASort O (next g n0)) H4) in (False_ind +((eq A (AHead a3 a5) (ASort n3 n2)) \to ((leq g a0 a3) \to ((leq g a4 a5) \to +(leq g (ASort O n0) (ASort (S n3) n2))))) H6)) H5 H2 H3)))]) in (H2 +(refl_equal A (ASort O (next g n0))) (refl_equal A (ASort n3 n2))))))) n1 +H0)) (\lambda (n3: nat).(\lambda (IHn: (((leq g (asucc g (ASort n3 n0)) +(asucc g (ASort n1 n2))) \to (leq g (ASort n3 n0) (ASort n1 n2))))).(\lambda +(H0: (leq g (asucc g (ASort (S n3) n0)) (asucc g (ASort n1 n2)))).(nat_ind +(\lambda (n4: nat).((leq g (asucc g (ASort (S n3) n0)) (asucc g (ASort n4 +n2))) \to ((((leq g (asucc g (ASort n3 n0)) (asucc g (ASort n4 n2))) \to (leq +g (ASort n3 n0) (ASort n4 n2)))) \to (leq g (ASort (S n3) n0) (ASort n4 +n2))))) (\lambda (H1: (leq g (asucc g (ASort (S n3) n0)) (asucc g (ASort O +n2)))).(\lambda (_: (((leq g (asucc g (ASort n3 n0)) (asucc g (ASort O n2))) +\to (leq g (ASort n3 n0) (ASort O n2))))).(let H2 \def (match H1 in leq +return (\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a +(ASort n3 n0)) \to ((eq A a0 (ASort O (next g n2))) \to (leq g (ASort (S n3) +n0) (ASort O n2))))))) with [(leq_sort h1 h2 n4 n5 k H2) \Rightarrow (\lambda +(H3: (eq A (ASort h1 n4) (ASort n3 n0))).(\lambda (H4: (eq A (ASort h2 n5) +(ASort O (next g n2)))).((let H5 \def (f_equal A nat (\lambda (e: A).(match e +in A return (\lambda (_: A).nat) with [(ASort _ n6) \Rightarrow n6 | (AHead _ +_) \Rightarrow n4])) (ASort h1 n4) (ASort n3 n0) H3) in ((let H6 \def +(f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) with +[(ASort n6 _) \Rightarrow n6 | (AHead _ _) \Rightarrow h1])) (ASort h1 n4) +(ASort n3 n0) H3) in (eq_ind nat n3 (\lambda (n6: nat).((eq nat n4 n0) \to +((eq A (ASort h2 n5) (ASort O (next g n2))) \to ((eq A (aplus g (ASort n6 n4) +k) (aplus g (ASort h2 n5) k)) \to (leq g (ASort (S n3) n0) (ASort O n2)))))) +(\lambda (H7: (eq nat n4 n0)).(eq_ind nat n0 (\lambda (n6: nat).((eq A (ASort +h2 n5) (ASort O (next g n2))) \to ((eq A (aplus g (ASort n3 n6) k) (aplus g +(ASort h2 n5) k)) \to (leq g (ASort (S n3) n0) (ASort O n2))))) (\lambda (H8: +(eq A (ASort h2 n5) (ASort O (next g n2)))).(let H9 \def (f_equal A nat +(\lambda (e: A).(match e in A return (\lambda (_: A).nat) with [(ASort _ n6) +\Rightarrow n6 | (AHead _ _) \Rightarrow n5])) (ASort h2 n5) (ASort O (next g +n2)) H8) in ((let H10 \def (f_equal A nat (\lambda (e: A).(match e in A +return (\lambda (_: A).nat) with [(ASort n6 _) \Rightarrow n6 | (AHead _ _) +\Rightarrow h2])) (ASort h2 n5) (ASort O (next g n2)) H8) in (eq_ind nat O +(\lambda (n6: nat).((eq nat n5 (next g n2)) \to ((eq A (aplus g (ASort n3 n0) +k) (aplus g (ASort n6 n5) k)) \to (leq g (ASort (S n3) n0) (ASort O n2))))) +(\lambda (H11: (eq nat n5 (next g n2))).(eq_ind nat (next g n2) (\lambda (n6: +nat).((eq A (aplus g (ASort n3 n0) k) (aplus g (ASort O n6) k)) \to (leq g +(ASort (S n3) n0) (ASort O n2)))) (\lambda (H12: (eq A (aplus g (ASort n3 n0) +k) (aplus g (ASort O (next g n2)) k))).(let H13 \def (eq_ind_r A (aplus g +(ASort n3 n0) k) (\lambda (a: A).(eq A a (aplus g (ASort O (next g n2)) k))) +H12 (aplus g (ASort (S n3) n0) (S k)) (aplus_sort_S_S_simpl g n0 n3 k)) in +(let H14 \def (eq_ind_r A (aplus g (ASort O (next g n2)) k) (\lambda (a: +A).(eq A (aplus g (ASort (S n3) n0) (S k)) a)) H13 (aplus g (ASort O n2) (S +k)) (aplus_sort_O_S_simpl g n2 k)) in (leq_sort g (S n3) O n0 n2 (S k) +H14)))) n5 (sym_eq nat n5 (next g n2) H11))) h2 (sym_eq nat h2 O H10))) H9))) +n4 (sym_eq nat n4 n0 H7))) h1 (sym_eq nat h1 n3 H6))) H5)) H4 H2))) | +(leq_head a0 a3 H2 a4 a5 H3) \Rightarrow (\lambda (H4: (eq A (AHead a0 a4) +(ASort n3 n0))).(\lambda (H5: (eq A (AHead a3 a5) (ASort O (next g +n2)))).((let H6 \def (eq_ind A (AHead a0 a4) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ +_) \Rightarrow True])) I (ASort n3 n0) H4) in (False_ind ((eq A (AHead a3 a5) +(ASort O (next g n2))) \to ((leq g a0 a3) \to ((leq g a4 a5) \to (leq g +(ASort (S n3) n0) (ASort O n2))))) H6)) H5 H2 H3)))]) in (H2 (refl_equal A +(ASort n3 n0)) (refl_equal A (ASort O (next g n2))))))) (\lambda (n4: +nat).(\lambda (_: (((leq g (asucc g (ASort (S n3) n0)) (asucc g (ASort n4 +n2))) \to ((((leq g (asucc g (ASort n3 n0)) (asucc g (ASort n4 n2))) \to (leq +g (ASort n3 n0) (ASort n4 n2)))) \to (leq g (ASort (S n3) n0) (ASort n4 +n2)))))).(\lambda (H1: (leq g (asucc g (ASort (S n3) n0)) (asucc g (ASort (S +n4) n2)))).(\lambda (_: (((leq g (asucc g (ASort n3 n0)) (asucc g (ASort (S +n4) n2))) \to (leq g (ASort n3 n0) (ASort (S n4) n2))))).(let H2 \def (match +H1 in leq return (\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a +a0)).((eq A a (ASort n3 n0)) \to ((eq A a0 (ASort n4 n2)) \to (leq g (ASort +(S n3) n0) (ASort (S n4) n2))))))) with [(leq_sort h1 h2 n5 n6 k H2) +\Rightarrow (\lambda (H3: (eq A (ASort h1 n5) (ASort n3 n0))).(\lambda (H4: +(eq A (ASort h2 n6) (ASort n4 n2))).((let H5 \def (f_equal A nat (\lambda (e: +A).(match e in A return (\lambda (_: A).nat) with [(ASort _ n7) \Rightarrow +n7 | (AHead _ _) \Rightarrow n5])) (ASort h1 n5) (ASort n3 n0) H3) in ((let +H6 \def (f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: +A).nat) with [(ASort n7 _) \Rightarrow n7 | (AHead _ _) \Rightarrow h1])) +(ASort h1 n5) (ASort n3 n0) H3) in (eq_ind nat n3 (\lambda (n7: nat).((eq nat +n5 n0) \to ((eq A (ASort h2 n6) (ASort n4 n2)) \to ((eq A (aplus g (ASort n7 +n5) k) (aplus g (ASort h2 n6) k)) \to (leq g (ASort (S n3) n0) (ASort (S n4) +n2)))))) (\lambda (H7: (eq nat n5 n0)).(eq_ind nat n0 (\lambda (n7: nat).((eq +A (ASort h2 n6) (ASort n4 n2)) \to ((eq A (aplus g (ASort n3 n7) k) (aplus g +(ASort h2 n6) k)) \to (leq g (ASort (S n3) n0) (ASort (S n4) n2))))) (\lambda +(H8: (eq A (ASort h2 n6) (ASort n4 n2))).(let H9 \def (f_equal A nat (\lambda +(e: A).(match e in A return (\lambda (_: A).nat) with [(ASort _ n7) +\Rightarrow n7 | (AHead _ _) \Rightarrow n6])) (ASort h2 n6) (ASort n4 n2) +H8) in ((let H10 \def (f_equal A nat (\lambda (e: A).(match e in A return +(\lambda (_: A).nat) with [(ASort n7 _) \Rightarrow n7 | (AHead _ _) +\Rightarrow h2])) (ASort h2 n6) (ASort n4 n2) H8) in (eq_ind nat n4 (\lambda +(n7: nat).((eq nat n6 n2) \to ((eq A (aplus g (ASort n3 n0) k) (aplus g +(ASort n7 n6) k)) \to (leq g (ASort (S n3) n0) (ASort (S n4) n2))))) (\lambda +(H11: (eq nat n6 n2)).(eq_ind nat n2 (\lambda (n7: nat).((eq A (aplus g +(ASort n3 n0) k) (aplus g (ASort n4 n7) k)) \to (leq g (ASort (S n3) n0) +(ASort (S n4) n2)))) (\lambda (H12: (eq A (aplus g (ASort n3 n0) k) (aplus g +(ASort n4 n2) k))).(let H13 \def (eq_ind_r A (aplus g (ASort n3 n0) k) +(\lambda (a: A).(eq A a (aplus g (ASort n4 n2) k))) H12 (aplus g (ASort (S +n3) n0) (S k)) (aplus_sort_S_S_simpl g n0 n3 k)) in (let H14 \def (eq_ind_r A +(aplus g (ASort n4 n2) k) (\lambda (a: A).(eq A (aplus g (ASort (S n3) n0) (S +k)) a)) H13 (aplus g (ASort (S n4) n2) (S k)) (aplus_sort_S_S_simpl g n2 n4 +k)) in (leq_sort g (S n3) (S n4) n0 n2 (S k) H14)))) n6 (sym_eq nat n6 n2 +H11))) h2 (sym_eq nat h2 n4 H10))) H9))) n5 (sym_eq nat n5 n0 H7))) h1 +(sym_eq nat h1 n3 H6))) H5)) H4 H2))) | (leq_head a0 a3 H2 a4 a5 H3) +\Rightarrow (\lambda (H4: (eq A (AHead a0 a4) (ASort n3 n0))).(\lambda (H5: +(eq A (AHead a3 a5) (ASort n4 n2))).((let H6 \def (eq_ind A (AHead a0 a4) +(\lambda (e: A).(match e in A return (\lambda (_: A).Prop) with [(ASort _ _) +\Rightarrow False | (AHead _ _) \Rightarrow True])) I (ASort n3 n0) H4) in +(False_ind ((eq A (AHead a3 a5) (ASort n4 n2)) \to ((leq g a0 a3) \to ((leq g +a4 a5) \to (leq g (ASort (S n3) n0) (ASort (S n4) n2))))) H6)) H5 H2 H3)))]) +in (H2 (refl_equal A (ASort n3 n0)) (refl_equal A (ASort n4 n2)))))))) n1 H0 +IHn)))) n H)))) (\lambda (a: A).(\lambda (H: (((leq g (asucc g (ASort n n0)) +(asucc g a)) \to (leq g (ASort n n0) a)))).(\lambda (a0: A).(\lambda (H0: +(((leq g (asucc g (ASort n n0)) (asucc g a0)) \to (leq g (ASort n n0) +a0)))).(\lambda (H1: (leq g (asucc g (ASort n n0)) (asucc g (AHead a +a0)))).(nat_ind (\lambda (n1: nat).((((leq g (asucc g (ASort n1 n0)) (asucc g +a)) \to (leq g (ASort n1 n0) a))) \to ((((leq g (asucc g (ASort n1 n0)) +(asucc g a0)) \to (leq g (ASort n1 n0) a0))) \to ((leq g (asucc g (ASort n1 +n0)) (asucc g (AHead a a0))) \to (leq g (ASort n1 n0) (AHead a a0)))))) +(\lambda (_: (((leq g (asucc g (ASort O n0)) (asucc g a)) \to (leq g (ASort O +n0) a)))).(\lambda (_: (((leq g (asucc g (ASort O n0)) (asucc g a0)) \to (leq +g (ASort O n0) a0)))).(\lambda (H4: (leq g (asucc g (ASort O n0)) (asucc g +(AHead a a0)))).(let H5 \def (match H4 in leq return (\lambda (a3: +A).(\lambda (a4: A).(\lambda (_: (leq ? a3 a4)).((eq A a3 (ASort O (next g +n0))) \to ((eq A a4 (AHead a (asucc g a0))) \to (leq g (ASort O n0) (AHead a +a0))))))) with [(leq_sort h1 h2 n1 n2 k H5) \Rightarrow (\lambda (H6: (eq A +(ASort h1 n1) (ASort O (next g n0)))).(\lambda (H7: (eq A (ASort h2 n2) +(AHead a (asucc g a0)))).((let H8 \def (f_equal A nat (\lambda (e: A).(match +e in A return (\lambda (_: A).nat) with [(ASort _ n3) \Rightarrow n3 | (AHead +_ _) \Rightarrow n1])) (ASort h1 n1) (ASort O (next g n0)) H6) in ((let H9 +\def (f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) +with [(ASort n3 _) \Rightarrow n3 | (AHead _ _) \Rightarrow h1])) (ASort h1 +n1) (ASort O (next g n0)) H6) in (eq_ind nat O (\lambda (n3: nat).((eq nat n1 +(next g n0)) \to ((eq A (ASort h2 n2) (AHead a (asucc g a0))) \to ((eq A +(aplus g (ASort n3 n1) k) (aplus g (ASort h2 n2) k)) \to (leq g (ASort O n0) +(AHead a a0)))))) (\lambda (H10: (eq nat n1 (next g n0))).(eq_ind nat (next g +n0) (\lambda (n3: nat).((eq A (ASort h2 n2) (AHead a (asucc g a0))) \to ((eq +A (aplus g (ASort O n3) k) (aplus g (ASort h2 n2) k)) \to (leq g (ASort O n0) +(AHead a a0))))) (\lambda (H11: (eq A (ASort h2 n2) (AHead a (asucc g +a0)))).(let H12 \def (eq_ind A (ASort h2 n2) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) +\Rightarrow False])) I (AHead a (asucc g a0)) H11) in (False_ind ((eq A +(aplus g (ASort O (next g n0)) k) (aplus g (ASort h2 n2) k)) \to (leq g +(ASort O n0) (AHead a a0))) H12))) n1 (sym_eq nat n1 (next g n0) H10))) h1 +(sym_eq nat h1 O H9))) H8)) H7 H5))) | (leq_head a3 a4 H5 a5 a6 H6) +\Rightarrow (\lambda (H7: (eq A (AHead a3 a5) (ASort O (next g +n0)))).(\lambda (H8: (eq A (AHead a4 a6) (AHead a (asucc g a0)))).((let H9 +\def (eq_ind A (AHead a3 a5) (\lambda (e: A).(match e in A return (\lambda +(_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow +True])) I (ASort O (next g n0)) H7) in (False_ind ((eq A (AHead a4 a6) (AHead +a (asucc g a0))) \to ((leq g a3 a4) \to ((leq g a5 a6) \to (leq g (ASort O +n0) (AHead a a0))))) H9)) H8 H5 H6)))]) in (H5 (refl_equal A (ASort O (next g +n0))) (refl_equal A (AHead a (asucc g a0)))))))) (\lambda (n1: nat).(\lambda +(_: (((((leq g (asucc g (ASort n1 n0)) (asucc g a)) \to (leq g (ASort n1 n0) +a))) \to ((((leq g (asucc g (ASort n1 n0)) (asucc g a0)) \to (leq g (ASort n1 +n0) a0))) \to ((leq g (asucc g (ASort n1 n0)) (asucc g (AHead a a0))) \to +(leq g (ASort n1 n0) (AHead a a0))))))).(\lambda (_: (((leq g (asucc g (ASort +(S n1) n0)) (asucc g a)) \to (leq g (ASort (S n1) n0) a)))).(\lambda (_: +(((leq g (asucc g (ASort (S n1) n0)) (asucc g a0)) \to (leq g (ASort (S n1) +n0) a0)))).(\lambda (H4: (leq g (asucc g (ASort (S n1) n0)) (asucc g (AHead a +a0)))).(let H5 \def (match H4 in leq return (\lambda (a3: A).(\lambda (a4: +A).(\lambda (_: (leq ? a3 a4)).((eq A a3 (ASort n1 n0)) \to ((eq A a4 (AHead +a (asucc g a0))) \to (leq g (ASort (S n1) n0) (AHead a a0))))))) with +[(leq_sort h1 h2 n2 n3 k H5) \Rightarrow (\lambda (H6: (eq A (ASort h1 n2) +(ASort n1 n0))).(\lambda (H7: (eq A (ASort h2 n3) (AHead a (asucc g +a0)))).((let H8 \def (f_equal A nat (\lambda (e: A).(match e in A return +(\lambda (_: A).nat) with [(ASort _ n4) \Rightarrow n4 | (AHead _ _) +\Rightarrow n2])) (ASort h1 n2) (ASort n1 n0) H6) in ((let H9 \def (f_equal A +nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) with [(ASort n4 +_) \Rightarrow n4 | (AHead _ _) \Rightarrow h1])) (ASort h1 n2) (ASort n1 n0) +H6) in (eq_ind nat n1 (\lambda (n4: nat).((eq nat n2 n0) \to ((eq A (ASort h2 +n3) (AHead a (asucc g a0))) \to ((eq A (aplus g (ASort n4 n2) k) (aplus g +(ASort h2 n3) k)) \to (leq g (ASort (S n1) n0) (AHead a a0)))))) (\lambda +(H10: (eq nat n2 n0)).(eq_ind nat n0 (\lambda (n4: nat).((eq A (ASort h2 n3) +(AHead a (asucc g a0))) \to ((eq A (aplus g (ASort n1 n4) k) (aplus g (ASort +h2 n3) k)) \to (leq g (ASort (S n1) n0) (AHead a a0))))) (\lambda (H11: (eq A +(ASort h2 n3) (AHead a (asucc g a0)))).(let H12 \def (eq_ind A (ASort h2 n3) +(\lambda (e: A).(match e in A return (\lambda (_: A).Prop) with [(ASort _ _) +\Rightarrow True | (AHead _ _) \Rightarrow False])) I (AHead a (asucc g a0)) +H11) in (False_ind ((eq A (aplus g (ASort n1 n0) k) (aplus g (ASort h2 n3) +k)) \to (leq g (ASort (S n1) n0) (AHead a a0))) H12))) n2 (sym_eq nat n2 n0 +H10))) h1 (sym_eq nat h1 n1 H9))) H8)) H7 H5))) | (leq_head a3 a4 H5 a5 a6 +H6) \Rightarrow (\lambda (H7: (eq A (AHead a3 a5) (ASort n1 n0))).(\lambda +(H8: (eq A (AHead a4 a6) (AHead a (asucc g a0)))).((let H9 \def (eq_ind A +(AHead a3 a5) (\lambda (e: A).(match e in A return (\lambda (_: A).Prop) with +[(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow True])) I (ASort n1 +n0) H7) in (False_ind ((eq A (AHead a4 a6) (AHead a (asucc g a0))) \to ((leq +g a3 a4) \to ((leq g a5 a6) \to (leq g (ASort (S n1) n0) (AHead a a0))))) +H9)) H8 H5 H6)))]) in (H5 (refl_equal A (ASort n1 n0)) (refl_equal A (AHead a +(asucc g a0)))))))))) n H H0 H1)))))) a2)))) (\lambda (a: A).(\lambda (_: +((\forall (a2: A).((leq g (asucc g a) (asucc g a2)) \to (leq g a +a2))))).(\lambda (a0: A).(\lambda (H0: ((\forall (a2: A).((leq g (asucc g a0) +(asucc g a2)) \to (leq g a0 a2))))).(\lambda (a2: A).(A_ind (\lambda (a3: +A).((leq g (asucc g (AHead a a0)) (asucc g a3)) \to (leq g (AHead a a0) a3))) +(\lambda (n: nat).(\lambda (n0: nat).(\lambda (H1: (leq g (asucc g (AHead a +a0)) (asucc g (ASort n n0)))).(nat_ind (\lambda (n1: nat).((leq g (asucc g +(AHead a a0)) (asucc g (ASort n1 n0))) \to (leq g (AHead a a0) (ASort n1 +n0)))) (\lambda (H2: (leq g (asucc g (AHead a a0)) (asucc g (ASort O +n0)))).(let H3 \def (match H2 in leq return (\lambda (a3: A).(\lambda (a4: +A).(\lambda (_: (leq ? a3 a4)).((eq A a3 (AHead a (asucc g a0))) \to ((eq A +a4 (ASort O (next g n0))) \to (leq g (AHead a a0) (ASort O n0))))))) with +[(leq_sort h1 h2 n1 n2 k H3) \Rightarrow (\lambda (H4: (eq A (ASort h1 n1) +(AHead a (asucc g a0)))).(\lambda (H5: (eq A (ASort h2 n2) (ASort O (next g +n0)))).((let H6 \def (eq_ind A (ASort h1 n1) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) +\Rightarrow False])) I (AHead a (asucc g a0)) H4) in (False_ind ((eq A (ASort +h2 n2) (ASort O (next g n0))) \to ((eq A (aplus g (ASort h1 n1) k) (aplus g +(ASort h2 n2) k)) \to (leq g (AHead a a0) (ASort O n0)))) H6)) H5 H3))) | +(leq_head a3 a4 H3 a5 a6 H4) \Rightarrow (\lambda (H5: (eq A (AHead a3 a5) +(AHead a (asucc g a0)))).(\lambda (H6: (eq A (AHead a4 a6) (ASort O (next g +n0)))).((let H7 \def (f_equal A A (\lambda (e: A).(match e in A return +(\lambda (_: A).A) with [(ASort _ _) \Rightarrow a5 | (AHead _ a7) +\Rightarrow a7])) (AHead a3 a5) (AHead a (asucc g a0)) H5) in ((let H8 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a3 | (AHead a7 _) \Rightarrow a7])) (AHead a3 a5) +(AHead a (asucc g a0)) H5) in (eq_ind A a (\lambda (a7: A).((eq A a5 (asucc g +a0)) \to ((eq A (AHead a4 a6) (ASort O (next g n0))) \to ((leq g a7 a4) \to +((leq g a5 a6) \to (leq g (AHead a a0) (ASort O n0))))))) (\lambda (H9: (eq A +a5 (asucc g a0))).(eq_ind A (asucc g a0) (\lambda (a7: A).((eq A (AHead a4 +a6) (ASort O (next g n0))) \to ((leq g a a4) \to ((leq g a7 a6) \to (leq g +(AHead a a0) (ASort O n0)))))) (\lambda (H10: (eq A (AHead a4 a6) (ASort O +(next g n0)))).(let H11 \def (eq_ind A (AHead a4 a6) (\lambda (e: A).(match e +in A return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | +(AHead _ _) \Rightarrow True])) I (ASort O (next g n0)) H10) in (False_ind +((leq g a a4) \to ((leq g (asucc g a0) a6) \to (leq g (AHead a a0) (ASort O +n0)))) H11))) a5 (sym_eq A a5 (asucc g a0) H9))) a3 (sym_eq A a3 a H8))) H7)) +H6 H3 H4)))]) in (H3 (refl_equal A (AHead a (asucc g a0))) (refl_equal A +(ASort O (next g n0)))))) (\lambda (n1: nat).(\lambda (_: (((leq g (asucc g +(AHead a a0)) (asucc g (ASort n1 n0))) \to (leq g (AHead a a0) (ASort n1 +n0))))).(\lambda (H2: (leq g (asucc g (AHead a a0)) (asucc g (ASort (S n1) +n0)))).(let H3 \def (match H2 in leq return (\lambda (a3: A).(\lambda (a4: +A).(\lambda (_: (leq ? a3 a4)).((eq A a3 (AHead a (asucc g a0))) \to ((eq A +a4 (ASort n1 n0)) \to (leq g (AHead a a0) (ASort (S n1) n0))))))) with +[(leq_sort h1 h2 n2 n3 k H3) \Rightarrow (\lambda (H4: (eq A (ASort h1 n2) +(AHead a (asucc g a0)))).(\lambda (H5: (eq A (ASort h2 n3) (ASort n1 +n0))).((let H6 \def (eq_ind A (ASort h1 n2) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) +\Rightarrow False])) I (AHead a (asucc g a0)) H4) in (False_ind ((eq A (ASort +h2 n3) (ASort n1 n0)) \to ((eq A (aplus g (ASort h1 n2) k) (aplus g (ASort h2 +n3) k)) \to (leq g (AHead a a0) (ASort (S n1) n0)))) H6)) H5 H3))) | +(leq_head a3 a4 H3 a5 a6 H4) \Rightarrow (\lambda (H5: (eq A (AHead a3 a5) +(AHead a (asucc g a0)))).(\lambda (H6: (eq A (AHead a4 a6) (ASort n1 +n0))).((let H7 \def (f_equal A A (\lambda (e: A).(match e in A return +(\lambda (_: A).A) with [(ASort _ _) \Rightarrow a5 | (AHead _ a7) +\Rightarrow a7])) (AHead a3 a5) (AHead a (asucc g a0)) H5) in ((let H8 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a3 | (AHead a7 _) \Rightarrow a7])) (AHead a3 a5) +(AHead a (asucc g a0)) H5) in (eq_ind A a (\lambda (a7: A).((eq A a5 (asucc g +a0)) \to ((eq A (AHead a4 a6) (ASort n1 n0)) \to ((leq g a7 a4) \to ((leq g +a5 a6) \to (leq g (AHead a a0) (ASort (S n1) n0))))))) (\lambda (H9: (eq A a5 +(asucc g a0))).(eq_ind A (asucc g a0) (\lambda (a7: A).((eq A (AHead a4 a6) +(ASort n1 n0)) \to ((leq g a a4) \to ((leq g a7 a6) \to (leq g (AHead a a0) +(ASort (S n1) n0)))))) (\lambda (H10: (eq A (AHead a4 a6) (ASort n1 +n0))).(let H11 \def (eq_ind A (AHead a4 a6) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ +_) \Rightarrow True])) I (ASort n1 n0) H10) in (False_ind ((leq g a a4) \to +((leq g (asucc g a0) a6) \to (leq g (AHead a a0) (ASort (S n1) n0)))) H11))) +a5 (sym_eq A a5 (asucc g a0) H9))) a3 (sym_eq A a3 a H8))) H7)) H6 H3 H4)))]) +in (H3 (refl_equal A (AHead a (asucc g a0))) (refl_equal A (ASort n1 +n0))))))) n H1)))) (\lambda (a3: A).(\lambda (_: (((leq g (asucc g (AHead a +a0)) (asucc g a3)) \to (leq g (AHead a a0) a3)))).(\lambda (a4: A).(\lambda +(_: (((leq g (asucc g (AHead a a0)) (asucc g a4)) \to (leq g (AHead a a0) +a4)))).(\lambda (H3: (leq g (asucc g (AHead a a0)) (asucc g (AHead a3 +a4)))).(let H4 \def (match H3 in leq return (\lambda (a5: A).(\lambda (a6: +A).(\lambda (_: (leq ? a5 a6)).((eq A a5 (AHead a (asucc g a0))) \to ((eq A +a6 (AHead a3 (asucc g a4))) \to (leq g (AHead a a0) (AHead a3 a4))))))) with +[(leq_sort h1 h2 n1 n2 k H4) \Rightarrow (\lambda (H5: (eq A (ASort h1 n1) +(AHead a (asucc g a0)))).(\lambda (H6: (eq A (ASort h2 n2) (AHead a3 (asucc g +a4)))).((let H7 \def (eq_ind A (ASort h1 n1) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) +\Rightarrow False])) I (AHead a (asucc g a0)) H5) in (False_ind ((eq A (ASort +h2 n2) (AHead a3 (asucc g a4))) \to ((eq A (aplus g (ASort h1 n1) k) (aplus g +(ASort h2 n2) k)) \to (leq g (AHead a a0) (AHead a3 a4)))) H7)) H6 H4))) | +(leq_head a5 a6 H4 a7 a8 H5) \Rightarrow (\lambda (H6: (eq A (AHead a5 a7) +(AHead a (asucc g a0)))).(\lambda (H7: (eq A (AHead a6 a8) (AHead a3 (asucc g +a4)))).((let H8 \def (f_equal A A (\lambda (e: A).(match e in A return +(\lambda (_: A).A) with [(ASort _ _) \Rightarrow a7 | (AHead _ a9) +\Rightarrow a9])) (AHead a5 a7) (AHead a (asucc g a0)) H6) in ((let H9 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a5 | (AHead a9 _) \Rightarrow a9])) (AHead a5 a7) +(AHead a (asucc g a0)) H6) in (eq_ind A a (\lambda (a9: A).((eq A a7 (asucc g +a0)) \to ((eq A (AHead a6 a8) (AHead a3 (asucc g a4))) \to ((leq g a9 a6) \to +((leq g a7 a8) \to (leq g (AHead a a0) (AHead a3 a4))))))) (\lambda (H10: (eq +A a7 (asucc g a0))).(eq_ind A (asucc g a0) (\lambda (a9: A).((eq A (AHead a6 +a8) (AHead a3 (asucc g a4))) \to ((leq g a a6) \to ((leq g a9 a8) \to (leq g +(AHead a a0) (AHead a3 a4)))))) (\lambda (H11: (eq A (AHead a6 a8) (AHead a3 +(asucc g a4)))).(let H12 \def (f_equal A A (\lambda (e: A).(match e in A +return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a8 | (AHead _ a9) +\Rightarrow a9])) (AHead a6 a8) (AHead a3 (asucc g a4)) H11) in ((let H13 +\def (f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) +with [(ASort _ _) \Rightarrow a6 | (AHead a9 _) \Rightarrow a9])) (AHead a6 +a8) (AHead a3 (asucc g a4)) H11) in (eq_ind A a3 (\lambda (a9: A).((eq A a8 +(asucc g a4)) \to ((leq g a a9) \to ((leq g (asucc g a0) a8) \to (leq g +(AHead a a0) (AHead a3 a4)))))) (\lambda (H14: (eq A a8 (asucc g +a4))).(eq_ind A (asucc g a4) (\lambda (a9: A).((leq g a a3) \to ((leq g +(asucc g a0) a9) \to (leq g (AHead a a0) (AHead a3 a4))))) (\lambda (H15: +(leq g a a3)).(\lambda (H16: (leq g (asucc g a0) (asucc g a4))).(leq_head g a +a3 H15 a0 a4 (H0 a4 H16)))) a8 (sym_eq A a8 (asucc g a4) H14))) a6 (sym_eq A +a6 a3 H13))) H12))) a7 (sym_eq A a7 (asucc g a0) H10))) a5 (sym_eq A a5 a +H9))) H8)) H7 H4 H5)))]) in (H4 (refl_equal A (AHead a (asucc g a0))) +(refl_equal A (AHead a3 (asucc g a4)))))))))) a2)))))) a1)). + +theorem leq_asucc: + \forall (g: G).(\forall (a: A).(ex A (\lambda (a0: A).(leq g a (asucc g +a0))))) +\def + \lambda (g: G).(\lambda (a: A).(A_ind (\lambda (a0: A).(ex A (\lambda (a1: +A).(leq g a0 (asucc g a1))))) (\lambda (n: nat).(\lambda (n0: nat).(ex_intro +A (\lambda (a0: A).(leq g (ASort n n0) (asucc g a0))) (ASort (S n) n0) +(leq_refl g (ASort n n0))))) (\lambda (a0: A).(\lambda (_: (ex A (\lambda +(a1: A).(leq g a0 (asucc g a1))))).(\lambda (a1: A).(\lambda (H0: (ex A +(\lambda (a2: A).(leq g a1 (asucc g a2))))).(let H1 \def H0 in (ex_ind A +(\lambda (a2: A).(leq g a1 (asucc g a2))) (ex A (\lambda (a2: A).(leq g +(AHead a0 a1) (asucc g a2)))) (\lambda (x: A).(\lambda (H2: (leq g a1 (asucc +g x))).(ex_intro A (\lambda (a2: A).(leq g (AHead a0 a1) (asucc g a2))) +(AHead a0 x) (leq_head g a0 a0 (leq_refl g a0) a1 (asucc g x) H2)))) H1)))))) +a)). + +theorem leq_ahead_asucc_false: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((leq g (AHead a1 a2) +(asucc g a1)) \to (\forall (P: Prop).P)))) +\def + \lambda (g: G).(\lambda (a1: A).(A_ind (\lambda (a: A).(\forall (a2: +A).((leq g (AHead a a2) (asucc g a)) \to (\forall (P: Prop).P)))) (\lambda +(n: nat).(\lambda (n0: nat).(\lambda (a2: A).(\lambda (H: (leq g (AHead +(ASort n n0) a2) (match n with [O \Rightarrow (ASort O (next g n0)) | (S h) +\Rightarrow (ASort h n0)]))).(\lambda (P: Prop).(nat_ind (\lambda (n1: +nat).((leq g (AHead (ASort n1 n0) a2) (match n1 with [O \Rightarrow (ASort O +(next g n0)) | (S h) \Rightarrow (ASort h n0)])) \to P)) (\lambda (H0: (leq g +(AHead (ASort O n0) a2) (ASort O (next g n0)))).(let H1 \def (match H0 in leq +return (\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a +(AHead (ASort O n0) a2)) \to ((eq A a0 (ASort O (next g n0))) \to P))))) with +[(leq_sort h1 h2 n1 n2 k H1) \Rightarrow (\lambda (H2: (eq A (ASort h1 n1) +(AHead (ASort O n0) a2))).(\lambda (H3: (eq A (ASort h2 n2) (ASort O (next g +n0)))).((let H4 \def (eq_ind A (ASort h1 n1) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) +\Rightarrow False])) I (AHead (ASort O n0) a2) H2) in (False_ind ((eq A +(ASort h2 n2) (ASort O (next g n0))) \to ((eq A (aplus g (ASort h1 n1) k) +(aplus g (ASort h2 n2) k)) \to P)) H4)) H3 H1))) | (leq_head a0 a3 H1 a4 a5 +H2) \Rightarrow (\lambda (H3: (eq A (AHead a0 a4) (AHead (ASort O n0) +a2))).(\lambda (H4: (eq A (AHead a3 a5) (ASort O (next g n0)))).((let H5 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a4 | (AHead _ a) \Rightarrow a])) (AHead a0 a4) +(AHead (ASort O n0) a2) H3) in ((let H6 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a0 | +(AHead a _) \Rightarrow a])) (AHead a0 a4) (AHead (ASort O n0) a2) H3) in +(eq_ind A (ASort O n0) (\lambda (a: A).((eq A a4 a2) \to ((eq A (AHead a3 a5) +(ASort O (next g n0))) \to ((leq g a a3) \to ((leq g a4 a5) \to P))))) +(\lambda (H7: (eq A a4 a2)).(eq_ind A a2 (\lambda (a: A).((eq A (AHead a3 a5) +(ASort O (next g n0))) \to ((leq g (ASort O n0) a3) \to ((leq g a a5) \to +P)))) (\lambda (H8: (eq A (AHead a3 a5) (ASort O (next g n0)))).(let H9 \def +(eq_ind A (AHead a3 a5) (\lambda (e: A).(match e in A return (\lambda (_: +A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow +True])) I (ASort O (next g n0)) H8) in (False_ind ((leq g (ASort O n0) a3) +\to ((leq g a2 a5) \to P)) H9))) a4 (sym_eq A a4 a2 H7))) a0 (sym_eq A a0 +(ASort O n0) H6))) H5)) H4 H1 H2)))]) in (H1 (refl_equal A (AHead (ASort O +n0) a2)) (refl_equal A (ASort O (next g n0)))))) (\lambda (n1: nat).(\lambda +(_: (((leq g (AHead (ASort n1 n0) a2) (match n1 with [O \Rightarrow (ASort O +(next g n0)) | (S h) \Rightarrow (ASort h n0)])) \to P))).(\lambda (H0: (leq +g (AHead (ASort (S n1) n0) a2) (ASort n1 n0))).(let H1 \def (match H0 in leq +return (\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a +(AHead (ASort (S n1) n0) a2)) \to ((eq A a0 (ASort n1 n0)) \to P))))) with +[(leq_sort h1 h2 n2 n3 k H1) \Rightarrow (\lambda (H2: (eq A (ASort h1 n2) +(AHead (ASort (S n1) n0) a2))).(\lambda (H3: (eq A (ASort h2 n3) (ASort n1 +n0))).((let H4 \def (eq_ind A (ASort h1 n2) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) +\Rightarrow False])) I (AHead (ASort (S n1) n0) a2) H2) in (False_ind ((eq A +(ASort h2 n3) (ASort n1 n0)) \to ((eq A (aplus g (ASort h1 n2) k) (aplus g +(ASort h2 n3) k)) \to P)) H4)) H3 H1))) | (leq_head a0 a3 H1 a4 a5 H2) +\Rightarrow (\lambda (H3: (eq A (AHead a0 a4) (AHead (ASort (S n1) n0) +a2))).(\lambda (H4: (eq A (AHead a3 a5) (ASort n1 n0))).((let H5 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a4 | (AHead _ a) \Rightarrow a])) (AHead a0 a4) +(AHead (ASort (S n1) n0) a2) H3) in ((let H6 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a0 | +(AHead a _) \Rightarrow a])) (AHead a0 a4) (AHead (ASort (S n1) n0) a2) H3) +in (eq_ind A (ASort (S n1) n0) (\lambda (a: A).((eq A a4 a2) \to ((eq A +(AHead a3 a5) (ASort n1 n0)) \to ((leq g a a3) \to ((leq g a4 a5) \to P))))) +(\lambda (H7: (eq A a4 a2)).(eq_ind A a2 (\lambda (a: A).((eq A (AHead a3 a5) +(ASort n1 n0)) \to ((leq g (ASort (S n1) n0) a3) \to ((leq g a a5) \to P)))) +(\lambda (H8: (eq A (AHead a3 a5) (ASort n1 n0))).(let H9 \def (eq_ind A +(AHead a3 a5) (\lambda (e: A).(match e in A return (\lambda (_: A).Prop) with +[(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow True])) I (ASort n1 +n0) H8) in (False_ind ((leq g (ASort (S n1) n0) a3) \to ((leq g a2 a5) \to +P)) H9))) a4 (sym_eq A a4 a2 H7))) a0 (sym_eq A a0 (ASort (S n1) n0) H6))) +H5)) H4 H1 H2)))]) in (H1 (refl_equal A (AHead (ASort (S n1) n0) a2)) +(refl_equal A (ASort n1 n0))))))) n H)))))) (\lambda (a: A).(\lambda (_: +((\forall (a2: A).((leq g (AHead a a2) (asucc g a)) \to (\forall (P: +Prop).P))))).(\lambda (a0: A).(\lambda (_: ((\forall (a2: A).((leq g (AHead +a0 a2) (asucc g a0)) \to (\forall (P: Prop).P))))).(\lambda (a2: A).(\lambda +(H1: (leq g (AHead (AHead a a0) a2) (AHead a (asucc g a0)))).(\lambda (P: +Prop).(let H2 \def (match H1 in leq return (\lambda (a3: A).(\lambda (a4: +A).(\lambda (_: (leq ? a3 a4)).((eq A a3 (AHead (AHead a a0) a2)) \to ((eq A +a4 (AHead a (asucc g a0))) \to P))))) with [(leq_sort h1 h2 n1 n2 k H2) +\Rightarrow (\lambda (H3: (eq A (ASort h1 n1) (AHead (AHead a a0) +a2))).(\lambda (H4: (eq A (ASort h2 n2) (AHead a (asucc g a0)))).((let H5 +\def (eq_ind A (ASort h1 n1) (\lambda (e: A).(match e in A return (\lambda +(_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) \Rightarrow +False])) I (AHead (AHead a a0) a2) H3) in (False_ind ((eq A (ASort h2 n2) +(AHead a (asucc g a0))) \to ((eq A (aplus g (ASort h1 n1) k) (aplus g (ASort +h2 n2) k)) \to P)) H5)) H4 H2))) | (leq_head a3 a4 H2 a5 a6 H3) \Rightarrow +(\lambda (H4: (eq A (AHead a3 a5) (AHead (AHead a a0) a2))).(\lambda (H5: (eq +A (AHead a4 a6) (AHead a (asucc g a0)))).((let H6 \def (f_equal A A (\lambda +(e: A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow +a5 | (AHead _ a7) \Rightarrow a7])) (AHead a3 a5) (AHead (AHead a a0) a2) H4) +in ((let H7 \def (f_equal A A (\lambda (e: A).(match e in A return (\lambda +(_: A).A) with [(ASort _ _) \Rightarrow a3 | (AHead a7 _) \Rightarrow a7])) +(AHead a3 a5) (AHead (AHead a a0) a2) H4) in (eq_ind A (AHead a a0) (\lambda +(a7: A).((eq A a5 a2) \to ((eq A (AHead a4 a6) (AHead a (asucc g a0))) \to +((leq g a7 a4) \to ((leq g a5 a6) \to P))))) (\lambda (H8: (eq A a5 +a2)).(eq_ind A a2 (\lambda (a7: A).((eq A (AHead a4 a6) (AHead a (asucc g +a0))) \to ((leq g (AHead a a0) a4) \to ((leq g a7 a6) \to P)))) (\lambda (H9: +(eq A (AHead a4 a6) (AHead a (asucc g a0)))).(let H10 \def (f_equal A A +(\lambda (e: A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) +\Rightarrow a6 | (AHead _ a7) \Rightarrow a7])) (AHead a4 a6) (AHead a (asucc +g a0)) H9) in ((let H11 \def (f_equal A A (\lambda (e: A).(match e in A +return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a4 | (AHead a7 _) +\Rightarrow a7])) (AHead a4 a6) (AHead a (asucc g a0)) H9) in (eq_ind A a +(\lambda (a7: A).((eq A a6 (asucc g a0)) \to ((leq g (AHead a a0) a7) \to +((leq g a2 a6) \to P)))) (\lambda (H12: (eq A a6 (asucc g a0))).(eq_ind A +(asucc g a0) (\lambda (a7: A).((leq g (AHead a a0) a) \to ((leq g a2 a7) \to +P))) (\lambda (H13: (leq g (AHead a a0) a)).(\lambda (_: (leq g a2 (asucc g +a0))).(leq_ahead_false_1 g a a0 H13 P))) a6 (sym_eq A a6 (asucc g a0) H12))) +a4 (sym_eq A a4 a H11))) H10))) a5 (sym_eq A a5 a2 H8))) a3 (sym_eq A a3 +(AHead a a0) H7))) H6)) H5 H2 H3)))]) in (H2 (refl_equal A (AHead (AHead a +a0) a2)) (refl_equal A (AHead a (asucc g a0)))))))))))) a1)). + +theorem leq_asucc_false: + \forall (g: G).(\forall (a: A).((leq g (asucc g a) a) \to (\forall (P: +Prop).P))) +\def + \lambda (g: G).(\lambda (a: A).(A_ind (\lambda (a0: A).((leq g (asucc g a0) +a0) \to (\forall (P: Prop).P))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda +(H: (leq g (match n with [O \Rightarrow (ASort O (next g n0)) | (S h) +\Rightarrow (ASort h n0)]) (ASort n n0))).(\lambda (P: Prop).(nat_ind +(\lambda (n1: nat).((leq g (match n1 with [O \Rightarrow (ASort O (next g +n0)) | (S h) \Rightarrow (ASort h n0)]) (ASort n1 n0)) \to P)) (\lambda (H0: +(leq g (ASort O (next g n0)) (ASort O n0))).(let H1 \def (match H0 in leq +return (\lambda (a0: A).(\lambda (a1: A).(\lambda (_: (leq ? a0 a1)).((eq A +a0 (ASort O (next g n0))) \to ((eq A a1 (ASort O n0)) \to P))))) with +[(leq_sort h1 h2 n1 n2 k H1) \Rightarrow (\lambda (H2: (eq A (ASort h1 n1) +(ASort O (next g n0)))).(\lambda (H3: (eq A (ASort h2 n2) (ASort O +n0))).((let H4 \def (f_equal A nat (\lambda (e: A).(match e in A return +(\lambda (_: A).nat) with [(ASort _ n3) \Rightarrow n3 | (AHead _ _) +\Rightarrow n1])) (ASort h1 n1) (ASort O (next g n0)) H2) in ((let H5 \def +(f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) with +[(ASort n3 _) \Rightarrow n3 | (AHead _ _) \Rightarrow h1])) (ASort h1 n1) +(ASort O (next g n0)) H2) in (eq_ind nat O (\lambda (n3: nat).((eq nat n1 +(next g n0)) \to ((eq A (ASort h2 n2) (ASort O n0)) \to ((eq A (aplus g +(ASort n3 n1) k) (aplus g (ASort h2 n2) k)) \to P)))) (\lambda (H6: (eq nat +n1 (next g n0))).(eq_ind nat (next g n0) (\lambda (n3: nat).((eq A (ASort h2 +n2) (ASort O n0)) \to ((eq A (aplus g (ASort O n3) k) (aplus g (ASort h2 n2) +k)) \to P))) (\lambda (H7: (eq A (ASort h2 n2) (ASort O n0))).(let H8 \def +(f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) with +[(ASort _ n3) \Rightarrow n3 | (AHead _ _) \Rightarrow n2])) (ASort h2 n2) +(ASort O n0) H7) in ((let H9 \def (f_equal A nat (\lambda (e: A).(match e in +A return (\lambda (_: A).nat) with [(ASort n3 _) \Rightarrow n3 | (AHead _ _) +\Rightarrow h2])) (ASort h2 n2) (ASort O n0) H7) in (eq_ind nat O (\lambda +(n3: nat).((eq nat n2 n0) \to ((eq A (aplus g (ASort O (next g n0)) k) (aplus +g (ASort n3 n2) k)) \to P))) (\lambda (H10: (eq nat n2 n0)).(eq_ind nat n0 +(\lambda (n3: nat).((eq A (aplus g (ASort O (next g n0)) k) (aplus g (ASort O +n3) k)) \to P)) (\lambda (H11: (eq A (aplus g (ASort O (next g n0)) k) (aplus +g (ASort O n0) k))).(let H12 \def (eq_ind_r A (aplus g (ASort O (next g n0)) +k) (\lambda (a0: A).(eq A a0 (aplus g (ASort O n0) k))) H11 (aplus g (ASort O +n0) (S k)) (aplus_sort_O_S_simpl g n0 k)) in (let H_y \def (aplus_inj g (S k) +k (ASort O n0) H12) in (le_Sx_x k (eq_ind_r nat k (\lambda (n3: nat).(le n3 +k)) (le_n k) (S k) H_y) P)))) n2 (sym_eq nat n2 n0 H10))) h2 (sym_eq nat h2 O +H9))) H8))) n1 (sym_eq nat n1 (next g n0) H6))) h1 (sym_eq nat h1 O H5))) +H4)) H3 H1))) | (leq_head a1 a2 H1 a3 a4 H2) \Rightarrow (\lambda (H3: (eq A +(AHead a1 a3) (ASort O (next g n0)))).(\lambda (H4: (eq A (AHead a2 a4) +(ASort O n0))).((let H5 \def (eq_ind A (AHead a1 a3) (\lambda (e: A).(match e +in A return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | +(AHead _ _) \Rightarrow True])) I (ASort O (next g n0)) H3) in (False_ind +((eq A (AHead a2 a4) (ASort O n0)) \to ((leq g a1 a2) \to ((leq g a3 a4) \to +P))) H5)) H4 H1 H2)))]) in (H1 (refl_equal A (ASort O (next g n0))) +(refl_equal A (ASort O n0))))) (\lambda (n1: nat).(\lambda (_: (((leq g +(match n1 with [O \Rightarrow (ASort O (next g n0)) | (S h) \Rightarrow +(ASort h n0)]) (ASort n1 n0)) \to P))).(\lambda (H0: (leq g (ASort n1 n0) +(ASort (S n1) n0))).(let H1 \def (match H0 in leq return (\lambda (a0: +A).(\lambda (a1: A).(\lambda (_: (leq ? a0 a1)).((eq A a0 (ASort n1 n0)) \to +((eq A a1 (ASort (S n1) n0)) \to P))))) with [(leq_sort h1 h2 n2 n3 k H1) +\Rightarrow (\lambda (H2: (eq A (ASort h1 n2) (ASort n1 n0))).(\lambda (H3: +(eq A (ASort h2 n3) (ASort (S n1) n0))).((let H4 \def (f_equal A nat (\lambda +(e: A).(match e in A return (\lambda (_: A).nat) with [(ASort _ n4) +\Rightarrow n4 | (AHead _ _) \Rightarrow n2])) (ASort h1 n2) (ASort n1 n0) +H2) in ((let H5 \def (f_equal A nat (\lambda (e: A).(match e in A return +(\lambda (_: A).nat) with [(ASort n4 _) \Rightarrow n4 | (AHead _ _) +\Rightarrow h1])) (ASort h1 n2) (ASort n1 n0) H2) in (eq_ind nat n1 (\lambda +(n4: nat).((eq nat n2 n0) \to ((eq A (ASort h2 n3) (ASort (S n1) n0)) \to +((eq A (aplus g (ASort n4 n2) k) (aplus g (ASort h2 n3) k)) \to P)))) +(\lambda (H6: (eq nat n2 n0)).(eq_ind nat n0 (\lambda (n4: nat).((eq A (ASort +h2 n3) (ASort (S n1) n0)) \to ((eq A (aplus g (ASort n1 n4) k) (aplus g +(ASort h2 n3) k)) \to P))) (\lambda (H7: (eq A (ASort h2 n3) (ASort (S n1) +n0))).(let H8 \def (f_equal A nat (\lambda (e: A).(match e in A return +(\lambda (_: A).nat) with [(ASort _ n4) \Rightarrow n4 | (AHead _ _) +\Rightarrow n3])) (ASort h2 n3) (ASort (S n1) n0) H7) in ((let H9 \def +(f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) with +[(ASort n4 _) \Rightarrow n4 | (AHead _ _) \Rightarrow h2])) (ASort h2 n3) +(ASort (S n1) n0) H7) in (eq_ind nat (S n1) (\lambda (n4: nat).((eq nat n3 +n0) \to ((eq A (aplus g (ASort n1 n0) k) (aplus g (ASort n4 n3) k)) \to P))) +(\lambda (H10: (eq nat n3 n0)).(eq_ind nat n0 (\lambda (n4: nat).((eq A +(aplus g (ASort n1 n0) k) (aplus g (ASort (S n1) n4) k)) \to P)) (\lambda +(H11: (eq A (aplus g (ASort n1 n0) k) (aplus g (ASort (S n1) n0) k))).(let +H12 \def (eq_ind_r A (aplus g (ASort n1 n0) k) (\lambda (a0: A).(eq A a0 +(aplus g (ASort (S n1) n0) k))) H11 (aplus g (ASort (S n1) n0) (S k)) +(aplus_sort_S_S_simpl g n0 n1 k)) in (let H_y \def (aplus_inj g (S k) k +(ASort (S n1) n0) H12) in (le_Sx_x k (eq_ind_r nat k (\lambda (n4: nat).(le +n4 k)) (le_n k) (S k) H_y) P)))) n3 (sym_eq nat n3 n0 H10))) h2 (sym_eq nat +h2 (S n1) H9))) H8))) n2 (sym_eq nat n2 n0 H6))) h1 (sym_eq nat h1 n1 H5))) +H4)) H3 H1))) | (leq_head a1 a2 H1 a3 a4 H2) \Rightarrow (\lambda (H3: (eq A +(AHead a1 a3) (ASort n1 n0))).(\lambda (H4: (eq A (AHead a2 a4) (ASort (S n1) +n0))).((let H5 \def (eq_ind A (AHead a1 a3) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ +_) \Rightarrow True])) I (ASort n1 n0) H3) in (False_ind ((eq A (AHead a2 a4) +(ASort (S n1) n0)) \to ((leq g a1 a2) \to ((leq g a3 a4) \to P))) H5)) H4 H1 +H2)))]) in (H1 (refl_equal A (ASort n1 n0)) (refl_equal A (ASort (S n1) +n0))))))) n H))))) (\lambda (a0: A).(\lambda (_: (((leq g (asucc g a0) a0) +\to (\forall (P: Prop).P)))).(\lambda (a1: A).(\lambda (H0: (((leq g (asucc g +a1) a1) \to (\forall (P: Prop).P)))).(\lambda (H1: (leq g (AHead a0 (asucc g +a1)) (AHead a0 a1))).(\lambda (P: Prop).(let H2 \def (match H1 in leq return +(\lambda (a2: A).(\lambda (a3: A).(\lambda (_: (leq ? a2 a3)).((eq A a2 +(AHead a0 (asucc g a1))) \to ((eq A a3 (AHead a0 a1)) \to P))))) with +[(leq_sort h1 h2 n1 n2 k H2) \Rightarrow (\lambda (H3: (eq A (ASort h1 n1) +(AHead a0 (asucc g a1)))).(\lambda (H4: (eq A (ASort h2 n2) (AHead a0 +a1))).((let H5 \def (eq_ind A (ASort h1 n1) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) +\Rightarrow False])) I (AHead a0 (asucc g a1)) H3) in (False_ind ((eq A +(ASort h2 n2) (AHead a0 a1)) \to ((eq A (aplus g (ASort h1 n1) k) (aplus g +(ASort h2 n2) k)) \to P)) H5)) H4 H2))) | (leq_head a2 a3 H2 a4 a5 H3) +\Rightarrow (\lambda (H4: (eq A (AHead a2 a4) (AHead a0 (asucc g +a1)))).(\lambda (H5: (eq A (AHead a3 a5) (AHead a0 a1))).((let H6 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a4 | (AHead _ a6) \Rightarrow a6])) (AHead a2 a4) +(AHead a0 (asucc g a1)) H4) in ((let H7 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a2 | +(AHead a6 _) \Rightarrow a6])) (AHead a2 a4) (AHead a0 (asucc g a1)) H4) in +(eq_ind A a0 (\lambda (a6: A).((eq A a4 (asucc g a1)) \to ((eq A (AHead a3 +a5) (AHead a0 a1)) \to ((leq g a6 a3) \to ((leq g a4 a5) \to P))))) (\lambda +(H8: (eq A a4 (asucc g a1))).(eq_ind A (asucc g a1) (\lambda (a6: A).((eq A +(AHead a3 a5) (AHead a0 a1)) \to ((leq g a0 a3) \to ((leq g a6 a5) \to P)))) +(\lambda (H9: (eq A (AHead a3 a5) (AHead a0 a1))).(let H10 \def (f_equal A A +(\lambda (e: A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) +\Rightarrow a5 | (AHead _ a6) \Rightarrow a6])) (AHead a3 a5) (AHead a0 a1) +H9) in ((let H11 \def (f_equal A A (\lambda (e: A).(match e in A return +(\lambda (_: A).A) with [(ASort _ _) \Rightarrow a3 | (AHead a6 _) +\Rightarrow a6])) (AHead a3 a5) (AHead a0 a1) H9) in (eq_ind A a0 (\lambda +(a6: A).((eq A a5 a1) \to ((leq g a0 a6) \to ((leq g (asucc g a1) a5) \to +P)))) (\lambda (H12: (eq A a5 a1)).(eq_ind A a1 (\lambda (a6: A).((leq g a0 +a0) \to ((leq g (asucc g a1) a6) \to P))) (\lambda (_: (leq g a0 +a0)).(\lambda (H14: (leq g (asucc g a1) a1)).(H0 H14 P))) a5 (sym_eq A a5 a1 +H12))) a3 (sym_eq A a3 a0 H11))) H10))) a4 (sym_eq A a4 (asucc g a1) H8))) a2 +(sym_eq A a2 a0 H7))) H6)) H5 H2 H3)))]) in (H2 (refl_equal A (AHead a0 +(asucc g a1))) (refl_equal A (AHead a0 a1)))))))))) a)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/defs.ma new file mode 100644 index 000000000..d14a0e535 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/defs.ma @@ -0,0 +1,28 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/leq/defs". + +include "aplus/defs.ma". + +inductive leq (g: G): A \to (A \to Prop) \def +| leq_sort: \forall (h1: nat).(\forall (h2: nat).(\forall (n1: nat).(\forall +(n2: nat).(\forall (k: nat).((eq A (aplus g (ASort h1 n1) k) (aplus g (ASort +h2 n2) k)) \to (leq g (ASort h1 n1) (ASort h2 n2))))))) +| leq_head: \forall (a1: A).(\forall (a2: A).((leq g a1 a2) \to (\forall (a3: +A).(\forall (a4: A).((leq g a3 a4) \to (leq g (AHead a1 a3) (AHead a2 +a4))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/fwd.ma new file mode 100644 index 000000000..36c26579b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/fwd.ma @@ -0,0 +1,118 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/leq/fwd". + +include "leq/defs.ma". + +theorem leq_gen_sort: + \forall (g: G).(\forall (h1: nat).(\forall (n1: nat).(\forall (a2: A).((leq +g (ASort h1 n1) a2) \to (ex2_3 nat nat nat (\lambda (n2: nat).(\lambda (h2: +nat).(\lambda (_: nat).(eq A a2 (ASort h2 n2))))) (\lambda (n2: nat).(\lambda +(h2: nat).(\lambda (k: nat).(eq A (aplus g (ASort h1 n1) k) (aplus g (ASort +h2 n2) k)))))))))) +\def + \lambda (g: G).(\lambda (h1: nat).(\lambda (n1: nat).(\lambda (a2: +A).(\lambda (H: (leq g (ASort h1 n1) a2)).(let H0 \def (match H in leq return +(\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a (ASort +h1 n1)) \to ((eq A a0 a2) \to (ex2_3 nat nat nat (\lambda (n2: nat).(\lambda +(h2: nat).(\lambda (_: nat).(eq A a2 (ASort h2 n2))))) (\lambda (n2: +nat).(\lambda (h2: nat).(\lambda (k: nat).(eq A (aplus g (ASort h1 n1) k) +(aplus g (ASort h2 n2) k))))))))))) with [(leq_sort h0 h2 n0 n2 k H0) +\Rightarrow (\lambda (H1: (eq A (ASort h0 n0) (ASort h1 n1))).(\lambda (H2: +(eq A (ASort h2 n2) a2)).((let H3 \def (f_equal A nat (\lambda (e: A).(match +e in A return (\lambda (_: A).nat) with [(ASort _ n) \Rightarrow n | (AHead _ +_) \Rightarrow n0])) (ASort h0 n0) (ASort h1 n1) H1) in ((let H4 \def +(f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) with +[(ASort n _) \Rightarrow n | (AHead _ _) \Rightarrow h0])) (ASort h0 n0) +(ASort h1 n1) H1) in (eq_ind nat h1 (\lambda (n: nat).((eq nat n0 n1) \to +((eq A (ASort h2 n2) a2) \to ((eq A (aplus g (ASort n n0) k) (aplus g (ASort +h2 n2) k)) \to (ex2_3 nat nat nat (\lambda (n3: nat).(\lambda (h3: +nat).(\lambda (_: nat).(eq A a2 (ASort h3 n3))))) (\lambda (n3: nat).(\lambda +(h3: nat).(\lambda (k0: nat).(eq A (aplus g (ASort h1 n1) k0) (aplus g (ASort +h3 n3) k0)))))))))) (\lambda (H5: (eq nat n0 n1)).(eq_ind nat n1 (\lambda (n: +nat).((eq A (ASort h2 n2) a2) \to ((eq A (aplus g (ASort h1 n) k) (aplus g +(ASort h2 n2) k)) \to (ex2_3 nat nat nat (\lambda (n3: nat).(\lambda (h3: +nat).(\lambda (_: nat).(eq A a2 (ASort h3 n3))))) (\lambda (n3: nat).(\lambda +(h3: nat).(\lambda (k0: nat).(eq A (aplus g (ASort h1 n1) k0) (aplus g (ASort +h3 n3) k0))))))))) (\lambda (H6: (eq A (ASort h2 n2) a2)).(eq_ind A (ASort h2 +n2) (\lambda (a: A).((eq A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) +k)) \to (ex2_3 nat nat nat (\lambda (n3: nat).(\lambda (h3: nat).(\lambda (_: +nat).(eq A a (ASort h3 n3))))) (\lambda (n3: nat).(\lambda (h3: nat).(\lambda +(k0: nat).(eq A (aplus g (ASort h1 n1) k0) (aplus g (ASort h3 n3) k0)))))))) +(\lambda (H7: (eq A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) +k))).(ex2_3_intro nat nat nat (\lambda (n3: nat).(\lambda (h3: nat).(\lambda +(_: nat).(eq A (ASort h2 n2) (ASort h3 n3))))) (\lambda (n3: nat).(\lambda +(h3: nat).(\lambda (k0: nat).(eq A (aplus g (ASort h1 n1) k0) (aplus g (ASort +h3 n3) k0))))) n2 h2 k (refl_equal A (ASort h2 n2)) H7)) a2 H6)) n0 (sym_eq +nat n0 n1 H5))) h0 (sym_eq nat h0 h1 H4))) H3)) H2 H0))) | (leq_head a1 a0 H0 +a3 a4 H1) \Rightarrow (\lambda (H2: (eq A (AHead a1 a3) (ASort h1 +n1))).(\lambda (H3: (eq A (AHead a0 a4) a2)).((let H4 \def (eq_ind A (AHead +a1 a3) (\lambda (e: A).(match e in A return (\lambda (_: A).Prop) with +[(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow True])) I (ASort h1 +n1) H2) in (False_ind ((eq A (AHead a0 a4) a2) \to ((leq g a1 a0) \to ((leq g +a3 a4) \to (ex2_3 nat nat nat (\lambda (n2: nat).(\lambda (h2: nat).(\lambda +(_: nat).(eq A a2 (ASort h2 n2))))) (\lambda (n2: nat).(\lambda (h2: +nat).(\lambda (k: nat).(eq A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) +k))))))))) H4)) H3 H0 H1)))]) in (H0 (refl_equal A (ASort h1 n1)) (refl_equal +A a2))))))). + +theorem leq_gen_head: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).(\forall (a: A).((leq g +(AHead a1 a2) a) \to (ex3_2 A A (\lambda (a3: A).(\lambda (a4: A).(eq A a +(AHead a3 a4)))) (\lambda (a3: A).(\lambda (_: A).(leq g a1 a3))) (\lambda +(_: A).(\lambda (a4: A).(leq g a2 a4)))))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (a: A).(\lambda +(H: (leq g (AHead a1 a2) a)).(let H0 \def (match H in leq return (\lambda +(a0: A).(\lambda (a3: A).(\lambda (_: (leq ? a0 a3)).((eq A a0 (AHead a1 a2)) +\to ((eq A a3 a) \to (ex3_2 A A (\lambda (a4: A).(\lambda (a5: A).(eq A a +(AHead a4 a5)))) (\lambda (a4: A).(\lambda (_: A).(leq g a1 a4))) (\lambda +(_: A).(\lambda (a5: A).(leq g a2 a5))))))))) with [(leq_sort h1 h2 n1 n2 k +H0) \Rightarrow (\lambda (H1: (eq A (ASort h1 n1) (AHead a1 a2))).(\lambda +(H2: (eq A (ASort h2 n2) a)).((let H3 \def (eq_ind A (ASort h1 n1) (\lambda +(e: A).(match e in A return (\lambda (_: A).Prop) with [(ASort _ _) +\Rightarrow True | (AHead _ _) \Rightarrow False])) I (AHead a1 a2) H1) in +(False_ind ((eq A (ASort h2 n2) a) \to ((eq A (aplus g (ASort h1 n1) k) +(aplus g (ASort h2 n2) k)) \to (ex3_2 A A (\lambda (a3: A).(\lambda (a4: +A).(eq A a (AHead a3 a4)))) (\lambda (a3: A).(\lambda (_: A).(leq g a1 a3))) +(\lambda (_: A).(\lambda (a4: A).(leq g a2 a4)))))) H3)) H2 H0))) | (leq_head +a0 a3 H0 a4 a5 H1) \Rightarrow (\lambda (H2: (eq A (AHead a0 a4) (AHead a1 +a2))).(\lambda (H3: (eq A (AHead a3 a5) a)).((let H4 \def (f_equal A A +(\lambda (e: A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) +\Rightarrow a4 | (AHead _ a6) \Rightarrow a6])) (AHead a0 a4) (AHead a1 a2) +H2) in ((let H5 \def (f_equal A A (\lambda (e: A).(match e in A return +(\lambda (_: A).A) with [(ASort _ _) \Rightarrow a0 | (AHead a6 _) +\Rightarrow a6])) (AHead a0 a4) (AHead a1 a2) H2) in (eq_ind A a1 (\lambda +(a6: A).((eq A a4 a2) \to ((eq A (AHead a3 a5) a) \to ((leq g a6 a3) \to +((leq g a4 a5) \to (ex3_2 A A (\lambda (a7: A).(\lambda (a8: A).(eq A a +(AHead a7 a8)))) (\lambda (a7: A).(\lambda (_: A).(leq g a1 a7))) (\lambda +(_: A).(\lambda (a8: A).(leq g a2 a8))))))))) (\lambda (H6: (eq A a4 +a2)).(eq_ind A a2 (\lambda (a6: A).((eq A (AHead a3 a5) a) \to ((leq g a1 a3) +\to ((leq g a6 a5) \to (ex3_2 A A (\lambda (a7: A).(\lambda (a8: A).(eq A a +(AHead a7 a8)))) (\lambda (a7: A).(\lambda (_: A).(leq g a1 a7))) (\lambda +(_: A).(\lambda (a8: A).(leq g a2 a8)))))))) (\lambda (H7: (eq A (AHead a3 +a5) a)).(eq_ind A (AHead a3 a5) (\lambda (a6: A).((leq g a1 a3) \to ((leq g +a2 a5) \to (ex3_2 A A (\lambda (a7: A).(\lambda (a8: A).(eq A a6 (AHead a7 +a8)))) (\lambda (a7: A).(\lambda (_: A).(leq g a1 a7))) (\lambda (_: +A).(\lambda (a8: A).(leq g a2 a8))))))) (\lambda (H8: (leq g a1 a3)).(\lambda +(H9: (leq g a2 a5)).(ex3_2_intro A A (\lambda (a6: A).(\lambda (a7: A).(eq A +(AHead a3 a5) (AHead a6 a7)))) (\lambda (a6: A).(\lambda (_: A).(leq g a1 +a6))) (\lambda (_: A).(\lambda (a7: A).(leq g a2 a7))) a3 a5 (refl_equal A +(AHead a3 a5)) H8 H9))) a H7)) a4 (sym_eq A a4 a2 H6))) a0 (sym_eq A a0 a1 +H5))) H4)) H3 H0 H1)))]) in (H0 (refl_equal A (AHead a1 a2)) (refl_equal A +a))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/props.ma new file mode 100644 index 000000000..0ad16f9e7 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/props.ma @@ -0,0 +1,373 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/leq/props". + +include "leq/defs.ma". + +include "aplus/props.ma". + +theorem ahead_inj_snd: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).(\forall (a3: A).(\forall +(a4: A).((leq g (AHead a1 a2) (AHead a3 a4)) \to (leq g a2 a4)))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (a3: A).(\lambda +(a4: A).(\lambda (H: (leq g (AHead a1 a2) (AHead a3 a4))).(let H0 \def (match +H in leq return (\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a +a0)).((eq A a (AHead a1 a2)) \to ((eq A a0 (AHead a3 a4)) \to (leq g a2 +a4)))))) with [(leq_sort h1 h2 n1 n2 k H0) \Rightarrow (\lambda (H1: (eq A +(ASort h1 n1) (AHead a1 a2))).(\lambda (H2: (eq A (ASort h2 n2) (AHead a3 +a4))).((let H3 \def (eq_ind A (ASort h1 n1) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) +\Rightarrow False])) I (AHead a1 a2) H1) in (False_ind ((eq A (ASort h2 n2) +(AHead a3 a4)) \to ((eq A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) +k)) \to (leq g a2 a4))) H3)) H2 H0))) | (leq_head a0 a5 H0 a6 a7 H1) +\Rightarrow (\lambda (H2: (eq A (AHead a0 a6) (AHead a1 a2))).(\lambda (H3: +(eq A (AHead a5 a7) (AHead a3 a4))).((let H4 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a6 | +(AHead _ a) \Rightarrow a])) (AHead a0 a6) (AHead a1 a2) H2) in ((let H5 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a0 | (AHead a _) \Rightarrow a])) (AHead a0 a6) +(AHead a1 a2) H2) in (eq_ind A a1 (\lambda (a: A).((eq A a6 a2) \to ((eq A +(AHead a5 a7) (AHead a3 a4)) \to ((leq g a a5) \to ((leq g a6 a7) \to (leq g +a2 a4)))))) (\lambda (H6: (eq A a6 a2)).(eq_ind A a2 (\lambda (a: A).((eq A +(AHead a5 a7) (AHead a3 a4)) \to ((leq g a1 a5) \to ((leq g a a7) \to (leq g +a2 a4))))) (\lambda (H7: (eq A (AHead a5 a7) (AHead a3 a4))).(let H8 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a7 | (AHead _ a) \Rightarrow a])) (AHead a5 a7) +(AHead a3 a4) H7) in ((let H9 \def (f_equal A A (\lambda (e: A).(match e in A +return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a5 | (AHead a _) +\Rightarrow a])) (AHead a5 a7) (AHead a3 a4) H7) in (eq_ind A a3 (\lambda (a: +A).((eq A a7 a4) \to ((leq g a1 a) \to ((leq g a2 a7) \to (leq g a2 a4))))) +(\lambda (H10: (eq A a7 a4)).(eq_ind A a4 (\lambda (a: A).((leq g a1 a3) \to +((leq g a2 a) \to (leq g a2 a4)))) (\lambda (_: (leq g a1 a3)).(\lambda (H12: +(leq g a2 a4)).H12)) a7 (sym_eq A a7 a4 H10))) a5 (sym_eq A a5 a3 H9))) H8))) +a6 (sym_eq A a6 a2 H6))) a0 (sym_eq A a0 a1 H5))) H4)) H3 H0 H1)))]) in (H0 +(refl_equal A (AHead a1 a2)) (refl_equal A (AHead a3 a4))))))))). + +theorem leq_refl: + \forall (g: G).(\forall (a: A).(leq g a a)) +\def + \lambda (g: G).(\lambda (a: A).(A_ind (\lambda (a0: A).(leq g a0 a0)) +(\lambda (n: nat).(\lambda (n0: nat).(leq_sort g n n n0 n0 O (refl_equal A +(aplus g (ASort n n0) O))))) (\lambda (a0: A).(\lambda (H: (leq g a0 +a0)).(\lambda (a1: A).(\lambda (H0: (leq g a1 a1)).(leq_head g a0 a0 H a1 a1 +H0))))) a)). + +theorem leq_eq: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((eq A a1 a2) \to (leq g a1 +a2)))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (H: (eq A a1 +a2)).(eq_ind_r A a2 (\lambda (a: A).(leq g a a2)) (leq_refl g a2) a1 H)))). + +theorem leq_sym: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((leq g a1 a2) \to (leq g +a2 a1)))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (H: (leq g a1 +a2)).(leq_ind g (\lambda (a: A).(\lambda (a0: A).(leq g a0 a))) (\lambda (h1: +nat).(\lambda (h2: nat).(\lambda (n1: nat).(\lambda (n2: nat).(\lambda (k: +nat).(\lambda (H0: (eq A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) +k))).(leq_sort g h2 h1 n2 n1 k (sym_eq A (aplus g (ASort h1 n1) k) (aplus g +(ASort h2 n2) k) H0)))))))) (\lambda (a3: A).(\lambda (a4: A).(\lambda (_: +(leq g a3 a4)).(\lambda (H1: (leq g a4 a3)).(\lambda (a5: A).(\lambda (a6: +A).(\lambda (_: (leq g a5 a6)).(\lambda (H3: (leq g a6 a5)).(leq_head g a4 a3 +H1 a6 a5 H3))))))))) a1 a2 H)))). + +theorem leq_trans: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((leq g a1 a2) \to (\forall +(a3: A).((leq g a2 a3) \to (leq g a1 a3)))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (H: (leq g a1 +a2)).(leq_ind g (\lambda (a: A).(\lambda (a0: A).(\forall (a3: A).((leq g a0 +a3) \to (leq g a a3))))) (\lambda (h1: nat).(\lambda (h2: nat).(\lambda (n1: +nat).(\lambda (n2: nat).(\lambda (k: nat).(\lambda (H0: (eq A (aplus g (ASort +h1 n1) k) (aplus g (ASort h2 n2) k))).(\lambda (a3: A).(\lambda (H1: (leq g +(ASort h2 n2) a3)).(let H2 \def (match H1 in leq return (\lambda (a: +A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a (ASort h2 n2)) \to +((eq A a0 a3) \to (leq g (ASort h1 n1) a3)))))) with [(leq_sort h0 h3 n0 n3 +k0 H2) \Rightarrow (\lambda (H3: (eq A (ASort h0 n0) (ASort h2 n2))).(\lambda +(H4: (eq A (ASort h3 n3) a3)).((let H5 \def (f_equal A nat (\lambda (e: +A).(match e in A return (\lambda (_: A).nat) with [(ASort _ n) \Rightarrow n +| (AHead _ _) \Rightarrow n0])) (ASort h0 n0) (ASort h2 n2) H3) in ((let H6 +\def (f_equal A nat (\lambda (e: A).(match e in A return (\lambda (_: A).nat) +with [(ASort n _) \Rightarrow n | (AHead _ _) \Rightarrow h0])) (ASort h0 n0) +(ASort h2 n2) H3) in (eq_ind nat h2 (\lambda (n: nat).((eq nat n0 n2) \to +((eq A (ASort h3 n3) a3) \to ((eq A (aplus g (ASort n n0) k0) (aplus g (ASort +h3 n3) k0)) \to (leq g (ASort h1 n1) a3))))) (\lambda (H7: (eq nat n0 +n2)).(eq_ind nat n2 (\lambda (n: nat).((eq A (ASort h3 n3) a3) \to ((eq A +(aplus g (ASort h2 n) k0) (aplus g (ASort h3 n3) k0)) \to (leq g (ASort h1 +n1) a3)))) (\lambda (H8: (eq A (ASort h3 n3) a3)).(eq_ind A (ASort h3 n3) +(\lambda (a: A).((eq A (aplus g (ASort h2 n2) k0) (aplus g (ASort h3 n3) k0)) +\to (leq g (ASort h1 n1) a))) (\lambda (H9: (eq A (aplus g (ASort h2 n2) k0) +(aplus g (ASort h3 n3) k0))).(lt_le_e k k0 (leq g (ASort h1 n1) (ASort h3 +n3)) (\lambda (H10: (lt k k0)).(let H_y \def (aplus_reg_r g (ASort h1 n1) +(ASort h2 n2) k k H0 (minus k0 k)) in (let H11 \def (eq_ind_r nat (plus +(minus k0 k) k) (\lambda (n: nat).(eq A (aplus g (ASort h1 n1) n) (aplus g +(ASort h2 n2) n))) H_y k0 (le_plus_minus_sym k k0 (le_trans k (S k) k0 (le_S +k k (le_n k)) H10))) in (leq_sort g h1 h3 n1 n3 k0 (trans_eq A (aplus g +(ASort h1 n1) k0) (aplus g (ASort h2 n2) k0) (aplus g (ASort h3 n3) k0) H11 +H9))))) (\lambda (H10: (le k0 k)).(let H_y \def (aplus_reg_r g (ASort h2 n2) +(ASort h3 n3) k0 k0 H9 (minus k k0)) in (let H11 \def (eq_ind_r nat (plus +(minus k k0) k0) (\lambda (n: nat).(eq A (aplus g (ASort h2 n2) n) (aplus g +(ASort h3 n3) n))) H_y k (le_plus_minus_sym k0 k H10)) in (leq_sort g h1 h3 +n1 n3 k (trans_eq A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) k) +(aplus g (ASort h3 n3) k) H0 H11))))))) a3 H8)) n0 (sym_eq nat n0 n2 H7))) h0 +(sym_eq nat h0 h2 H6))) H5)) H4 H2))) | (leq_head a0 a4 H2 a5 a6 H3) +\Rightarrow (\lambda (H4: (eq A (AHead a0 a5) (ASort h2 n2))).(\lambda (H5: +(eq A (AHead a4 a6) a3)).((let H6 \def (eq_ind A (AHead a0 a5) (\lambda (e: +A).(match e in A return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow +False | (AHead _ _) \Rightarrow True])) I (ASort h2 n2) H4) in (False_ind +((eq A (AHead a4 a6) a3) \to ((leq g a0 a4) \to ((leq g a5 a6) \to (leq g +(ASort h1 n1) a3)))) H6)) H5 H2 H3)))]) in (H2 (refl_equal A (ASort h2 n2)) +(refl_equal A a3))))))))))) (\lambda (a3: A).(\lambda (a4: A).(\lambda (_: +(leq g a3 a4)).(\lambda (H1: ((\forall (a5: A).((leq g a4 a5) \to (leq g a3 +a5))))).(\lambda (a5: A).(\lambda (a6: A).(\lambda (_: (leq g a5 +a6)).(\lambda (H3: ((\forall (a7: A).((leq g a6 a7) \to (leq g a5 +a7))))).(\lambda (a0: A).(\lambda (H4: (leq g (AHead a4 a6) a0)).(let H5 \def +(match H4 in leq return (\lambda (a: A).(\lambda (a7: A).(\lambda (_: (leq ? +a a7)).((eq A a (AHead a4 a6)) \to ((eq A a7 a0) \to (leq g (AHead a3 a5) +a0)))))) with [(leq_sort h1 h2 n1 n2 k H5) \Rightarrow (\lambda (H6: (eq A +(ASort h1 n1) (AHead a4 a6))).(\lambda (H7: (eq A (ASort h2 n2) a0)).((let H8 +\def (eq_ind A (ASort h1 n1) (\lambda (e: A).(match e in A return (\lambda +(_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) \Rightarrow +False])) I (AHead a4 a6) H6) in (False_ind ((eq A (ASort h2 n2) a0) \to ((eq +A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) k)) \to (leq g (AHead a3 +a5) a0))) H8)) H7 H5))) | (leq_head a7 a8 H5 a9 a10 H6) \Rightarrow (\lambda +(H7: (eq A (AHead a7 a9) (AHead a4 a6))).(\lambda (H8: (eq A (AHead a8 a10) +a0)).((let H9 \def (f_equal A A (\lambda (e: A).(match e in A return (\lambda +(_: A).A) with [(ASort _ _) \Rightarrow a9 | (AHead _ a) \Rightarrow a])) +(AHead a7 a9) (AHead a4 a6) H7) in ((let H10 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a7 | +(AHead a _) \Rightarrow a])) (AHead a7 a9) (AHead a4 a6) H7) in (eq_ind A a4 +(\lambda (a: A).((eq A a9 a6) \to ((eq A (AHead a8 a10) a0) \to ((leq g a a8) +\to ((leq g a9 a10) \to (leq g (AHead a3 a5) a0)))))) (\lambda (H11: (eq A a9 +a6)).(eq_ind A a6 (\lambda (a: A).((eq A (AHead a8 a10) a0) \to ((leq g a4 +a8) \to ((leq g a a10) \to (leq g (AHead a3 a5) a0))))) (\lambda (H12: (eq A +(AHead a8 a10) a0)).(eq_ind A (AHead a8 a10) (\lambda (a: A).((leq g a4 a8) +\to ((leq g a6 a10) \to (leq g (AHead a3 a5) a)))) (\lambda (H13: (leq g a4 +a8)).(\lambda (H14: (leq g a6 a10)).(leq_head g a3 a8 (H1 a8 H13) a5 a10 (H3 +a10 H14)))) a0 H12)) a9 (sym_eq A a9 a6 H11))) a7 (sym_eq A a7 a4 H10))) H9)) +H8 H5 H6)))]) in (H5 (refl_equal A (AHead a4 a6)) (refl_equal A +a0))))))))))))) a1 a2 H)))). + +theorem leq_ahead_false_1: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((leq g (AHead a1 a2) a1) +\to (\forall (P: Prop).P)))) +\def + \lambda (g: G).(\lambda (a1: A).(A_ind (\lambda (a: A).(\forall (a2: +A).((leq g (AHead a a2) a) \to (\forall (P: Prop).P)))) (\lambda (n: +nat).(\lambda (n0: nat).(\lambda (a2: A).(\lambda (H: (leq g (AHead (ASort n +n0) a2) (ASort n n0))).(\lambda (P: Prop).(nat_ind (\lambda (n1: nat).((leq g +(AHead (ASort n1 n0) a2) (ASort n1 n0)) \to P)) (\lambda (H0: (leq g (AHead +(ASort O n0) a2) (ASort O n0))).(let H1 \def (match H0 in leq return (\lambda +(a: A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a (AHead (ASort O +n0) a2)) \to ((eq A a0 (ASort O n0)) \to P))))) with [(leq_sort h1 h2 n1 n2 k +H1) \Rightarrow (\lambda (H2: (eq A (ASort h1 n1) (AHead (ASort O n0) +a2))).(\lambda (H3: (eq A (ASort h2 n2) (ASort O n0))).((let H4 \def (eq_ind +A (ASort h1 n1) (\lambda (e: A).(match e in A return (\lambda (_: A).Prop) +with [(ASort _ _) \Rightarrow True | (AHead _ _) \Rightarrow False])) I +(AHead (ASort O n0) a2) H2) in (False_ind ((eq A (ASort h2 n2) (ASort O n0)) +\to ((eq A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) k)) \to P)) H4)) +H3 H1))) | (leq_head a0 a3 H1 a4 a5 H2) \Rightarrow (\lambda (H3: (eq A +(AHead a0 a4) (AHead (ASort O n0) a2))).(\lambda (H4: (eq A (AHead a3 a5) +(ASort O n0))).((let H5 \def (f_equal A A (\lambda (e: A).(match e in A +return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a4 | (AHead _ a) +\Rightarrow a])) (AHead a0 a4) (AHead (ASort O n0) a2) H3) in ((let H6 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a0 | (AHead a _) \Rightarrow a])) (AHead a0 a4) +(AHead (ASort O n0) a2) H3) in (eq_ind A (ASort O n0) (\lambda (a: A).((eq A +a4 a2) \to ((eq A (AHead a3 a5) (ASort O n0)) \to ((leq g a a3) \to ((leq g +a4 a5) \to P))))) (\lambda (H7: (eq A a4 a2)).(eq_ind A a2 (\lambda (a: +A).((eq A (AHead a3 a5) (ASort O n0)) \to ((leq g (ASort O n0) a3) \to ((leq +g a a5) \to P)))) (\lambda (H8: (eq A (AHead a3 a5) (ASort O n0))).(let H9 +\def (eq_ind A (AHead a3 a5) (\lambda (e: A).(match e in A return (\lambda +(_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow +True])) I (ASort O n0) H8) in (False_ind ((leq g (ASort O n0) a3) \to ((leq g +a2 a5) \to P)) H9))) a4 (sym_eq A a4 a2 H7))) a0 (sym_eq A a0 (ASort O n0) +H6))) H5)) H4 H1 H2)))]) in (H1 (refl_equal A (AHead (ASort O n0) a2)) +(refl_equal A (ASort O n0))))) (\lambda (n1: nat).(\lambda (_: (((leq g +(AHead (ASort n1 n0) a2) (ASort n1 n0)) \to P))).(\lambda (H0: (leq g (AHead +(ASort (S n1) n0) a2) (ASort (S n1) n0))).(let H1 \def (match H0 in leq +return (\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a +(AHead (ASort (S n1) n0) a2)) \to ((eq A a0 (ASort (S n1) n0)) \to P))))) +with [(leq_sort h1 h2 n2 n3 k H1) \Rightarrow (\lambda (H2: (eq A (ASort h1 +n2) (AHead (ASort (S n1) n0) a2))).(\lambda (H3: (eq A (ASort h2 n3) (ASort +(S n1) n0))).((let H4 \def (eq_ind A (ASort h1 n2) (\lambda (e: A).(match e +in A return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead +_ _) \Rightarrow False])) I (AHead (ASort (S n1) n0) a2) H2) in (False_ind +((eq A (ASort h2 n3) (ASort (S n1) n0)) \to ((eq A (aplus g (ASort h1 n2) k) +(aplus g (ASort h2 n3) k)) \to P)) H4)) H3 H1))) | (leq_head a0 a3 H1 a4 a5 +H2) \Rightarrow (\lambda (H3: (eq A (AHead a0 a4) (AHead (ASort (S n1) n0) +a2))).(\lambda (H4: (eq A (AHead a3 a5) (ASort (S n1) n0))).((let H5 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a4 | (AHead _ a) \Rightarrow a])) (AHead a0 a4) +(AHead (ASort (S n1) n0) a2) H3) in ((let H6 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a0 | +(AHead a _) \Rightarrow a])) (AHead a0 a4) (AHead (ASort (S n1) n0) a2) H3) +in (eq_ind A (ASort (S n1) n0) (\lambda (a: A).((eq A a4 a2) \to ((eq A +(AHead a3 a5) (ASort (S n1) n0)) \to ((leq g a a3) \to ((leq g a4 a5) \to +P))))) (\lambda (H7: (eq A a4 a2)).(eq_ind A a2 (\lambda (a: A).((eq A (AHead +a3 a5) (ASort (S n1) n0)) \to ((leq g (ASort (S n1) n0) a3) \to ((leq g a a5) +\to P)))) (\lambda (H8: (eq A (AHead a3 a5) (ASort (S n1) n0))).(let H9 \def +(eq_ind A (AHead a3 a5) (\lambda (e: A).(match e in A return (\lambda (_: +A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow +True])) I (ASort (S n1) n0) H8) in (False_ind ((leq g (ASort (S n1) n0) a3) +\to ((leq g a2 a5) \to P)) H9))) a4 (sym_eq A a4 a2 H7))) a0 (sym_eq A a0 +(ASort (S n1) n0) H6))) H5)) H4 H1 H2)))]) in (H1 (refl_equal A (AHead (ASort +(S n1) n0) a2)) (refl_equal A (ASort (S n1) n0))))))) n H)))))) (\lambda (a: +A).(\lambda (H: ((\forall (a2: A).((leq g (AHead a a2) a) \to (\forall (P: +Prop).P))))).(\lambda (a0: A).(\lambda (_: ((\forall (a2: A).((leq g (AHead +a0 a2) a0) \to (\forall (P: Prop).P))))).(\lambda (a2: A).(\lambda (H1: (leq +g (AHead (AHead a a0) a2) (AHead a a0))).(\lambda (P: Prop).(let H2 \def +(match H1 in leq return (\lambda (a3: A).(\lambda (a4: A).(\lambda (_: (leq ? +a3 a4)).((eq A a3 (AHead (AHead a a0) a2)) \to ((eq A a4 (AHead a a0)) \to +P))))) with [(leq_sort h1 h2 n1 n2 k H2) \Rightarrow (\lambda (H3: (eq A +(ASort h1 n1) (AHead (AHead a a0) a2))).(\lambda (H4: (eq A (ASort h2 n2) +(AHead a a0))).((let H5 \def (eq_ind A (ASort h1 n1) (\lambda (e: A).(match e +in A return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead +_ _) \Rightarrow False])) I (AHead (AHead a a0) a2) H3) in (False_ind ((eq A +(ASort h2 n2) (AHead a a0)) \to ((eq A (aplus g (ASort h1 n1) k) (aplus g +(ASort h2 n2) k)) \to P)) H5)) H4 H2))) | (leq_head a3 a4 H2 a5 a6 H3) +\Rightarrow (\lambda (H4: (eq A (AHead a3 a5) (AHead (AHead a a0) +a2))).(\lambda (H5: (eq A (AHead a4 a6) (AHead a a0))).((let H6 \def (f_equal +A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) +\Rightarrow a5 | (AHead _ a7) \Rightarrow a7])) (AHead a3 a5) (AHead (AHead a +a0) a2) H4) in ((let H7 \def (f_equal A A (\lambda (e: A).(match e in A +return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a3 | (AHead a7 _) +\Rightarrow a7])) (AHead a3 a5) (AHead (AHead a a0) a2) H4) in (eq_ind A +(AHead a a0) (\lambda (a7: A).((eq A a5 a2) \to ((eq A (AHead a4 a6) (AHead a +a0)) \to ((leq g a7 a4) \to ((leq g a5 a6) \to P))))) (\lambda (H8: (eq A a5 +a2)).(eq_ind A a2 (\lambda (a7: A).((eq A (AHead a4 a6) (AHead a a0)) \to +((leq g (AHead a a0) a4) \to ((leq g a7 a6) \to P)))) (\lambda (H9: (eq A +(AHead a4 a6) (AHead a a0))).(let H10 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a6 | +(AHead _ a7) \Rightarrow a7])) (AHead a4 a6) (AHead a a0) H9) in ((let H11 +\def (f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) +with [(ASort _ _) \Rightarrow a4 | (AHead a7 _) \Rightarrow a7])) (AHead a4 +a6) (AHead a a0) H9) in (eq_ind A a (\lambda (a7: A).((eq A a6 a0) \to ((leq +g (AHead a a0) a7) \to ((leq g a2 a6) \to P)))) (\lambda (H12: (eq A a6 +a0)).(eq_ind A a0 (\lambda (a7: A).((leq g (AHead a a0) a) \to ((leq g a2 a7) +\to P))) (\lambda (H13: (leq g (AHead a a0) a)).(\lambda (_: (leq g a2 +a0)).(H a0 H13 P))) a6 (sym_eq A a6 a0 H12))) a4 (sym_eq A a4 a H11))) H10))) +a5 (sym_eq A a5 a2 H8))) a3 (sym_eq A a3 (AHead a a0) H7))) H6)) H5 H2 +H3)))]) in (H2 (refl_equal A (AHead (AHead a a0) a2)) (refl_equal A (AHead a +a0))))))))))) a1)). + +theorem leq_ahead_false_2: + \forall (g: G).(\forall (a2: A).(\forall (a1: A).((leq g (AHead a1 a2) a2) +\to (\forall (P: Prop).P)))) +\def + \lambda (g: G).(\lambda (a2: A).(A_ind (\lambda (a: A).(\forall (a1: +A).((leq g (AHead a1 a) a) \to (\forall (P: Prop).P)))) (\lambda (n: +nat).(\lambda (n0: nat).(\lambda (a1: A).(\lambda (H: (leq g (AHead a1 (ASort +n n0)) (ASort n n0))).(\lambda (P: Prop).(nat_ind (\lambda (n1: nat).((leq g +(AHead a1 (ASort n1 n0)) (ASort n1 n0)) \to P)) (\lambda (H0: (leq g (AHead +a1 (ASort O n0)) (ASort O n0))).(let H1 \def (match H0 in leq return (\lambda +(a: A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a (AHead a1 (ASort +O n0))) \to ((eq A a0 (ASort O n0)) \to P))))) with [(leq_sort h1 h2 n1 n2 k +H1) \Rightarrow (\lambda (H2: (eq A (ASort h1 n1) (AHead a1 (ASort O +n0)))).(\lambda (H3: (eq A (ASort h2 n2) (ASort O n0))).((let H4 \def (eq_ind +A (ASort h1 n1) (\lambda (e: A).(match e in A return (\lambda (_: A).Prop) +with [(ASort _ _) \Rightarrow True | (AHead _ _) \Rightarrow False])) I +(AHead a1 (ASort O n0)) H2) in (False_ind ((eq A (ASort h2 n2) (ASort O n0)) +\to ((eq A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) k)) \to P)) H4)) +H3 H1))) | (leq_head a0 a3 H1 a4 a5 H2) \Rightarrow (\lambda (H3: (eq A +(AHead a0 a4) (AHead a1 (ASort O n0)))).(\lambda (H4: (eq A (AHead a3 a5) +(ASort O n0))).((let H5 \def (f_equal A A (\lambda (e: A).(match e in A +return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a4 | (AHead _ a) +\Rightarrow a])) (AHead a0 a4) (AHead a1 (ASort O n0)) H3) in ((let H6 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a0 | (AHead a _) \Rightarrow a])) (AHead a0 a4) +(AHead a1 (ASort O n0)) H3) in (eq_ind A a1 (\lambda (a: A).((eq A a4 (ASort +O n0)) \to ((eq A (AHead a3 a5) (ASort O n0)) \to ((leq g a a3) \to ((leq g +a4 a5) \to P))))) (\lambda (H7: (eq A a4 (ASort O n0))).(eq_ind A (ASort O +n0) (\lambda (a: A).((eq A (AHead a3 a5) (ASort O n0)) \to ((leq g a1 a3) \to +((leq g a a5) \to P)))) (\lambda (H8: (eq A (AHead a3 a5) (ASort O n0))).(let +H9 \def (eq_ind A (AHead a3 a5) (\lambda (e: A).(match e in A return (\lambda +(_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ _) \Rightarrow +True])) I (ASort O n0) H8) in (False_ind ((leq g a1 a3) \to ((leq g (ASort O +n0) a5) \to P)) H9))) a4 (sym_eq A a4 (ASort O n0) H7))) a0 (sym_eq A a0 a1 +H6))) H5)) H4 H1 H2)))]) in (H1 (refl_equal A (AHead a1 (ASort O n0))) +(refl_equal A (ASort O n0))))) (\lambda (n1: nat).(\lambda (_: (((leq g +(AHead a1 (ASort n1 n0)) (ASort n1 n0)) \to P))).(\lambda (H0: (leq g (AHead +a1 (ASort (S n1) n0)) (ASort (S n1) n0))).(let H1 \def (match H0 in leq +return (\lambda (a: A).(\lambda (a0: A).(\lambda (_: (leq ? a a0)).((eq A a +(AHead a1 (ASort (S n1) n0))) \to ((eq A a0 (ASort (S n1) n0)) \to P))))) +with [(leq_sort h1 h2 n2 n3 k H1) \Rightarrow (\lambda (H2: (eq A (ASort h1 +n2) (AHead a1 (ASort (S n1) n0)))).(\lambda (H3: (eq A (ASort h2 n3) (ASort +(S n1) n0))).((let H4 \def (eq_ind A (ASort h1 n2) (\lambda (e: A).(match e +in A return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead +_ _) \Rightarrow False])) I (AHead a1 (ASort (S n1) n0)) H2) in (False_ind +((eq A (ASort h2 n3) (ASort (S n1) n0)) \to ((eq A (aplus g (ASort h1 n2) k) +(aplus g (ASort h2 n3) k)) \to P)) H4)) H3 H1))) | (leq_head a0 a3 H1 a4 a5 +H2) \Rightarrow (\lambda (H3: (eq A (AHead a0 a4) (AHead a1 (ASort (S n1) +n0)))).(\lambda (H4: (eq A (AHead a3 a5) (ASort (S n1) n0))).((let H5 \def +(f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) with +[(ASort _ _) \Rightarrow a4 | (AHead _ a) \Rightarrow a])) (AHead a0 a4) +(AHead a1 (ASort (S n1) n0)) H3) in ((let H6 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a0 | +(AHead a _) \Rightarrow a])) (AHead a0 a4) (AHead a1 (ASort (S n1) n0)) H3) +in (eq_ind A a1 (\lambda (a: A).((eq A a4 (ASort (S n1) n0)) \to ((eq A +(AHead a3 a5) (ASort (S n1) n0)) \to ((leq g a a3) \to ((leq g a4 a5) \to +P))))) (\lambda (H7: (eq A a4 (ASort (S n1) n0))).(eq_ind A (ASort (S n1) n0) +(\lambda (a: A).((eq A (AHead a3 a5) (ASort (S n1) n0)) \to ((leq g a1 a3) +\to ((leq g a a5) \to P)))) (\lambda (H8: (eq A (AHead a3 a5) (ASort (S n1) +n0))).(let H9 \def (eq_ind A (AHead a3 a5) (\lambda (e: A).(match e in A +return (\lambda (_: A).Prop) with [(ASort _ _) \Rightarrow False | (AHead _ +_) \Rightarrow True])) I (ASort (S n1) n0) H8) in (False_ind ((leq g a1 a3) +\to ((leq g (ASort (S n1) n0) a5) \to P)) H9))) a4 (sym_eq A a4 (ASort (S n1) +n0) H7))) a0 (sym_eq A a0 a1 H6))) H5)) H4 H1 H2)))]) in (H1 (refl_equal A +(AHead a1 (ASort (S n1) n0))) (refl_equal A (ASort (S n1) n0))))))) n H)))))) +(\lambda (a: A).(\lambda (_: ((\forall (a1: A).((leq g (AHead a1 a) a) \to +(\forall (P: Prop).P))))).(\lambda (a0: A).(\lambda (H0: ((\forall (a1: +A).((leq g (AHead a1 a0) a0) \to (\forall (P: Prop).P))))).(\lambda (a1: +A).(\lambda (H1: (leq g (AHead a1 (AHead a a0)) (AHead a a0))).(\lambda (P: +Prop).(let H2 \def (match H1 in leq return (\lambda (a3: A).(\lambda (a4: +A).(\lambda (_: (leq ? a3 a4)).((eq A a3 (AHead a1 (AHead a a0))) \to ((eq A +a4 (AHead a a0)) \to P))))) with [(leq_sort h1 h2 n1 n2 k H2) \Rightarrow +(\lambda (H3: (eq A (ASort h1 n1) (AHead a1 (AHead a a0)))).(\lambda (H4: (eq +A (ASort h2 n2) (AHead a a0))).((let H5 \def (eq_ind A (ASort h1 n1) (\lambda +(e: A).(match e in A return (\lambda (_: A).Prop) with [(ASort _ _) +\Rightarrow True | (AHead _ _) \Rightarrow False])) I (AHead a1 (AHead a a0)) +H3) in (False_ind ((eq A (ASort h2 n2) (AHead a a0)) \to ((eq A (aplus g +(ASort h1 n1) k) (aplus g (ASort h2 n2) k)) \to P)) H5)) H4 H2))) | (leq_head +a3 a4 H2 a5 a6 H3) \Rightarrow (\lambda (H4: (eq A (AHead a3 a5) (AHead a1 +(AHead a a0)))).(\lambda (H5: (eq A (AHead a4 a6) (AHead a a0))).((let H6 +\def (f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) +with [(ASort _ _) \Rightarrow a5 | (AHead _ a7) \Rightarrow a7])) (AHead a3 +a5) (AHead a1 (AHead a a0)) H4) in ((let H7 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a3 | +(AHead a7 _) \Rightarrow a7])) (AHead a3 a5) (AHead a1 (AHead a a0)) H4) in +(eq_ind A a1 (\lambda (a7: A).((eq A a5 (AHead a a0)) \to ((eq A (AHead a4 +a6) (AHead a a0)) \to ((leq g a7 a4) \to ((leq g a5 a6) \to P))))) (\lambda +(H8: (eq A a5 (AHead a a0))).(eq_ind A (AHead a a0) (\lambda (a7: A).((eq A +(AHead a4 a6) (AHead a a0)) \to ((leq g a1 a4) \to ((leq g a7 a6) \to P)))) +(\lambda (H9: (eq A (AHead a4 a6) (AHead a a0))).(let H10 \def (f_equal A A +(\lambda (e: A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) +\Rightarrow a6 | (AHead _ a7) \Rightarrow a7])) (AHead a4 a6) (AHead a a0) +H9) in ((let H11 \def (f_equal A A (\lambda (e: A).(match e in A return +(\lambda (_: A).A) with [(ASort _ _) \Rightarrow a4 | (AHead a7 _) +\Rightarrow a7])) (AHead a4 a6) (AHead a a0) H9) in (eq_ind A a (\lambda (a7: +A).((eq A a6 a0) \to ((leq g a1 a7) \to ((leq g (AHead a a0) a6) \to P)))) +(\lambda (H12: (eq A a6 a0)).(eq_ind A a0 (\lambda (a7: A).((leq g a1 a) \to +((leq g (AHead a a0) a7) \to P))) (\lambda (_: (leq g a1 a)).(\lambda (H14: +(leq g (AHead a a0) a0)).(H0 a H14 P))) a6 (sym_eq A a6 a0 H12))) a4 (sym_eq +A a4 a H11))) H10))) a5 (sym_eq A a5 (AHead a a0) H8))) a3 (sym_eq A a3 a1 +H7))) H6)) H5 H2 H3)))]) in (H2 (refl_equal A (AHead a1 (AHead a a0))) +(refl_equal A (AHead a a0))))))))))) a2)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/defs.ma new file mode 100644 index 000000000..9a03fcd17 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/defs.ma @@ -0,0 +1,46 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/lift/defs". + +include "T/defs.ma". + +include "tlist/defs.ma". + +include "s/defs.ma". + +definition lref_map: + ((nat \to nat)) \to (nat \to (T \to T)) +\def + let rec lref_map (f: ((nat \to nat))) (d: nat) (t: T) on t: T \def (match t +with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match +(blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u +t0) \Rightarrow (THead k (lref_map f d u) (lref_map f (s k d) t0))]) in +lref_map. + +definition lift: + nat \to (nat \to (T \to T)) +\def + \lambda (h: nat).(\lambda (i: nat).(\lambda (t: T).(lref_map (\lambda (x: +nat).(plus x h)) i t))). + +definition lifts: + nat \to (nat \to (TList \to TList)) +\def + let rec lifts (h: nat) (d: nat) (ts: TList) on ts: TList \def (match ts with +[TNil \Rightarrow TNil | (TCons t ts0) \Rightarrow (TCons (lift h d t) (lifts +h d ts0))]) in lifts. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/fwd.ma new file mode 100644 index 000000000..5a80f43e6 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/fwd.ma @@ -0,0 +1,654 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/lift/fwd". + +include "lift/defs.ma". + +theorem lift_sort: + \forall (n: nat).(\forall (h: nat).(\forall (d: nat).(eq T (lift h d (TSort +n)) (TSort n)))) +\def + \lambda (n: nat).(\lambda (_: nat).(\lambda (_: nat).(refl_equal T (TSort +n)))). + +theorem lift_lref_lt: + \forall (n: nat).(\forall (h: nat).(\forall (d: nat).((lt n d) \to (eq T +(lift h d (TLRef n)) (TLRef n))))) +\def + \lambda (n: nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H: (lt n +d)).(eq_ind bool true (\lambda (b: bool).(eq T (TLRef (match b with [true +\Rightarrow n | false \Rightarrow (plus n h)])) (TLRef n))) (refl_equal T +(TLRef n)) (blt n d) (sym_eq bool (blt n d) true (lt_blt d n H)))))). + +theorem lift_lref_ge: + \forall (n: nat).(\forall (h: nat).(\forall (d: nat).((le d n) \to (eq T +(lift h d (TLRef n)) (TLRef (plus n h)))))) +\def + \lambda (n: nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H: (le d +n)).(eq_ind bool false (\lambda (b: bool).(eq T (TLRef (match b with [true +\Rightarrow n | false \Rightarrow (plus n h)])) (TLRef (plus n h)))) +(refl_equal T (TLRef (plus n h))) (blt n d) (sym_eq bool (blt n d) false +(le_bge d n H)))))). + +theorem lift_head: + \forall (k: K).(\forall (u: T).(\forall (t: T).(\forall (h: nat).(\forall +(d: nat).(eq T (lift h d (THead k u t)) (THead k (lift h d u) (lift h (s k d) +t))))))) +\def + \lambda (k: K).(\lambda (u: T).(\lambda (t: T).(\lambda (h: nat).(\lambda +(d: nat).(refl_equal T (THead k (lift h d u) (lift h (s k d) t))))))). + +theorem lift_bind: + \forall (b: B).(\forall (u: T).(\forall (t: T).(\forall (h: nat).(\forall +(d: nat).(eq T (lift h d (THead (Bind b) u t)) (THead (Bind b) (lift h d u) +(lift h (S d) t))))))) +\def + \lambda (b: B).(\lambda (u: T).(\lambda (t: T).(\lambda (h: nat).(\lambda +(d: nat).(refl_equal T (THead (Bind b) (lift h d u) (lift h (S d) t))))))). + +theorem lift_flat: + \forall (f: F).(\forall (u: T).(\forall (t: T).(\forall (h: nat).(\forall +(d: nat).(eq T (lift h d (THead (Flat f) u t)) (THead (Flat f) (lift h d u) +(lift h d t))))))) +\def + \lambda (f: F).(\lambda (u: T).(\lambda (t: T).(\lambda (h: nat).(\lambda +(d: nat).(refl_equal T (THead (Flat f) (lift h d u) (lift h d t))))))). + +theorem lift_gen_sort: + \forall (h: nat).(\forall (d: nat).(\forall (n: nat).(\forall (t: T).((eq T +(TSort n) (lift h d t)) \to (eq T t (TSort n)))))) +\def + \lambda (h: nat).(\lambda (d: nat).(\lambda (n: nat).(\lambda (t: T).(T_ind +(\lambda (t0: T).((eq T (TSort n) (lift h d t0)) \to (eq T t0 (TSort n)))) +(\lambda (n0: nat).(\lambda (H: (eq T (TSort n) (lift h d (TSort +n0)))).(sym_eq T (TSort n) (TSort n0) H))) (\lambda (n0: nat).(\lambda (H: +(eq T (TSort n) (lift h d (TLRef n0)))).(lt_le_e n0 d (eq T (TLRef n0) (TSort +n)) (\lambda (H0: (lt n0 d)).(let H1 \def (eq_ind T (lift h d (TLRef n0)) +(\lambda (t0: T).(eq T (TSort n) t0)) H (TLRef n0) (lift_lref_lt n0 h d H0)) +in (let H2 \def (match H1 in eq return (\lambda (t0: T).(\lambda (_: (eq ? ? +t0)).((eq T t0 (TLRef n0)) \to (eq T (TLRef n0) (TSort n))))) with +[refl_equal \Rightarrow (\lambda (H2: (eq T (TSort n) (TLRef n0))).(let H3 +\def (eq_ind T (TSort n) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow False])) I (TLRef n0) H2) in (False_ind (eq T +(TLRef n0) (TSort n)) H3)))]) in (H2 (refl_equal T (TLRef n0)))))) (\lambda +(H0: (le d n0)).(let H1 \def (eq_ind T (lift h d (TLRef n0)) (\lambda (t0: +T).(eq T (TSort n) t0)) H (TLRef (plus n0 h)) (lift_lref_ge n0 h d H0)) in +(let H2 \def (match H1 in eq return (\lambda (t0: T).(\lambda (_: (eq ? ? +t0)).((eq T t0 (TLRef (plus n0 h))) \to (eq T (TLRef n0) (TSort n))))) with +[refl_equal \Rightarrow (\lambda (H2: (eq T (TSort n) (TLRef (plus n0 +h)))).(let H3 \def (eq_ind T (TSort n) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow False])) I (TLRef (plus n0 h)) +H2) in (False_ind (eq T (TLRef n0) (TSort n)) H3)))]) in (H2 (refl_equal T +(TLRef (plus n0 h)))))))))) (\lambda (k: K).(\lambda (t0: T).(\lambda (_: +(((eq T (TSort n) (lift h d t0)) \to (eq T t0 (TSort n))))).(\lambda (t1: +T).(\lambda (_: (((eq T (TSort n) (lift h d t1)) \to (eq T t1 (TSort +n))))).(\lambda (H1: (eq T (TSort n) (lift h d (THead k t0 t1)))).(let H2 +\def (eq_ind T (lift h d (THead k t0 t1)) (\lambda (t2: T).(eq T (TSort n) +t2)) H1 (THead k (lift h d t0) (lift h (s k d) t1)) (lift_head k t0 t1 h d)) +in (let H3 \def (match H2 in eq return (\lambda (t2: T).(\lambda (_: (eq ? ? +t2)).((eq T t2 (THead k (lift h d t0) (lift h (s k d) t1))) \to (eq T (THead +k t0 t1) (TSort n))))) with [refl_equal \Rightarrow (\lambda (H3: (eq T +(TSort n) (THead k (lift h d t0) (lift h (s k d) t1)))).(let H4 \def (eq_ind +T (TSort n) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow False])) I (THead k (lift h d t0) (lift h (s k d) t1)) H3) in +(False_ind (eq T (THead k t0 t1) (TSort n)) H4)))]) in (H3 (refl_equal T +(THead k (lift h d t0) (lift h (s k d) t1)))))))))))) t)))). + +theorem lift_gen_lref: + \forall (t: T).(\forall (d: nat).(\forall (h: nat).(\forall (i: nat).((eq T +(TLRef i) (lift h d t)) \to (or (land (lt i d) (eq T t (TLRef i))) (land (le +(plus d h) i) (eq T t (TLRef (minus i h))))))))) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(\forall (d: nat).(\forall (h: +nat).(\forall (i: nat).((eq T (TLRef i) (lift h d t0)) \to (or (land (lt i d) +(eq T t0 (TLRef i))) (land (le (plus d h) i) (eq T t0 (TLRef (minus i +h)))))))))) (\lambda (n: nat).(\lambda (d: nat).(\lambda (h: nat).(\lambda +(i: nat).(\lambda (H: (eq T (TLRef i) (lift h d (TSort n)))).(let H0 \def +(eq_ind T (lift h d (TSort n)) (\lambda (t0: T).(eq T (TLRef i) t0)) H (TSort +n) (lift_sort n h d)) in (let H1 \def (eq_ind T (TLRef i) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I +(TSort n) H0) in (False_ind (or (land (lt i d) (eq T (TSort n) (TLRef i))) +(land (le (plus d h) i) (eq T (TSort n) (TLRef (minus i h))))) H1)))))))) +(\lambda (n: nat).(\lambda (d: nat).(\lambda (h: nat).(\lambda (i: +nat).(\lambda (H: (eq T (TLRef i) (lift h d (TLRef n)))).(lt_le_e n d (or +(land (lt i d) (eq T (TLRef n) (TLRef i))) (land (le (plus d h) i) (eq T +(TLRef n) (TLRef (minus i h))))) (\lambda (H0: (lt n d)).(let H1 \def (eq_ind +T (lift h d (TLRef n)) (\lambda (t0: T).(eq T (TLRef i) t0)) H (TLRef n) +(lift_lref_lt n h d H0)) in (let H2 \def (f_equal T nat (\lambda (e: +T).(match e in T return (\lambda (_: T).nat) with [(TSort _) \Rightarrow i | +(TLRef n0) \Rightarrow n0 | (THead _ _ _) \Rightarrow i])) (TLRef i) (TLRef +n) H1) in (eq_ind_r nat n (\lambda (n0: nat).(or (land (lt n0 d) (eq T (TLRef +n) (TLRef n0))) (land (le (plus d h) n0) (eq T (TLRef n) (TLRef (minus n0 +h)))))) (or_introl (land (lt n d) (eq T (TLRef n) (TLRef n))) (land (le (plus +d h) n) (eq T (TLRef n) (TLRef (minus n h)))) (conj (lt n d) (eq T (TLRef n) +(TLRef n)) H0 (refl_equal T (TLRef n)))) i H2)))) (\lambda (H0: (le d +n)).(let H1 \def (eq_ind T (lift h d (TLRef n)) (\lambda (t0: T).(eq T (TLRef +i) t0)) H (TLRef (plus n h)) (lift_lref_ge n h d H0)) in (let H2 \def +(f_equal T nat (\lambda (e: T).(match e in T return (\lambda (_: T).nat) with +[(TSort _) \Rightarrow i | (TLRef n0) \Rightarrow n0 | (THead _ _ _) +\Rightarrow i])) (TLRef i) (TLRef (plus n h)) H1) in (eq_ind_r nat (plus n h) +(\lambda (n0: nat).(or (land (lt n0 d) (eq T (TLRef n) (TLRef n0))) (land (le +(plus d h) n0) (eq T (TLRef n) (TLRef (minus n0 h)))))) (eq_ind_r nat n +(\lambda (n0: nat).(or (land (lt (plus n h) d) (eq T (TLRef n) (TLRef (plus n +h)))) (land (le (plus d h) (plus n h)) (eq T (TLRef n) (TLRef n0))))) +(or_intror (land (lt (plus n h) d) (eq T (TLRef n) (TLRef (plus n h)))) (land +(le (plus d h) (plus n h)) (eq T (TLRef n) (TLRef n))) (conj (le (plus d h) +(plus n h)) (eq T (TLRef n) (TLRef n)) (plus_le_compat d n h h H0 (le_n h)) +(refl_equal T (TLRef n)))) (minus (plus n h) h) (minus_plus_r n h)) i +H2)))))))))) (\lambda (k: K).(\lambda (t0: T).(\lambda (_: ((\forall (d: +nat).(\forall (h: nat).(\forall (i: nat).((eq T (TLRef i) (lift h d t0)) \to +(or (land (lt i d) (eq T t0 (TLRef i))) (land (le (plus d h) i) (eq T t0 +(TLRef (minus i h))))))))))).(\lambda (t1: T).(\lambda (_: ((\forall (d: +nat).(\forall (h: nat).(\forall (i: nat).((eq T (TLRef i) (lift h d t1)) \to +(or (land (lt i d) (eq T t1 (TLRef i))) (land (le (plus d h) i) (eq T t1 +(TLRef (minus i h))))))))))).(\lambda (d: nat).(\lambda (h: nat).(\lambda (i: +nat).(\lambda (H1: (eq T (TLRef i) (lift h d (THead k t0 t1)))).(let H2 \def +(eq_ind T (lift h d (THead k t0 t1)) (\lambda (t2: T).(eq T (TLRef i) t2)) H1 +(THead k (lift h d t0) (lift h (s k d) t1)) (lift_head k t0 t1 h d)) in (let +H3 \def (eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead k (lift h d t0) (lift h (s k d) +t1)) H2) in (False_ind (or (land (lt i d) (eq T (THead k t0 t1) (TLRef i))) +(land (le (plus d h) i) (eq T (THead k t0 t1) (TLRef (minus i h))))) +H3)))))))))))) t). + +theorem lift_gen_lref_lt: + \forall (h: nat).(\forall (d: nat).(\forall (n: nat).((lt n d) \to (\forall +(t: T).((eq T (TLRef n) (lift h d t)) \to (eq T t (TLRef n))))))) +\def + \lambda (h: nat).(\lambda (d: nat).(\lambda (n: nat).(\lambda (H: (lt n +d)).(\lambda (t: T).(T_ind (\lambda (t0: T).((eq T (TLRef n) (lift h d t0)) +\to (eq T t0 (TLRef n)))) (\lambda (n0: nat).(\lambda (H0: (eq T (TLRef n) +(lift h d (TSort n0)))).(sym_eq T (TLRef n) (TSort n0) H0))) (\lambda (n0: +nat).(\lambda (H0: (eq T (TLRef n) (lift h d (TLRef n0)))).(lt_le_e n0 d (eq +T (TLRef n0) (TLRef n)) (\lambda (H1: (lt n0 d)).(let H2 \def (eq_ind T (lift +h d (TLRef n0)) (\lambda (t0: T).(eq T (TLRef n) t0)) H0 (TLRef n0) +(lift_lref_lt n0 h d H1)) in (sym_eq T (TLRef n) (TLRef n0) H2))) (\lambda +(H1: (le d n0)).(let H2 \def (eq_ind T (lift h d (TLRef n0)) (\lambda (t0: +T).(eq T (TLRef n) t0)) H0 (TLRef (plus n0 h)) (lift_lref_ge n0 h d H1)) in +(let H3 \def (match H2 in eq return (\lambda (t0: T).(\lambda (_: (eq ? ? +t0)).((eq T t0 (TLRef (plus n0 h))) \to (eq T (TLRef n0) (TLRef n))))) with +[refl_equal \Rightarrow (\lambda (H3: (eq T (TLRef n) (TLRef (plus n0 +h)))).(let H4 \def (f_equal T nat (\lambda (e: T).(match e in T return +(\lambda (_: T).nat) with [(TSort _) \Rightarrow n | (TLRef n1) \Rightarrow +n1 | (THead _ _ _) \Rightarrow n])) (TLRef n) (TLRef (plus n0 h)) H3) in +(eq_ind nat (plus n0 h) (\lambda (n1: nat).(eq T (TLRef n0) (TLRef n1))) (let +H5 \def (eq_ind nat n (\lambda (n1: nat).(lt n1 d)) H (plus n0 h) H4) in +(le_false d n0 (eq T (TLRef n0) (TLRef (plus n0 h))) H1 (lt_le_S n0 d +(lt_le_trans n0 (S (plus n0 h)) d (le_lt_n_Sm n0 (plus n0 h) (le_plus_l n0 +h)) (lt_le_S (plus n0 h) d H5))))) n (sym_eq nat n (plus n0 h) H4))))]) in +(H3 (refl_equal T (TLRef (plus n0 h)))))))))) (\lambda (k: K).(\lambda (t0: +T).(\lambda (_: (((eq T (TLRef n) (lift h d t0)) \to (eq T t0 (TLRef +n))))).(\lambda (t1: T).(\lambda (_: (((eq T (TLRef n) (lift h d t1)) \to (eq +T t1 (TLRef n))))).(\lambda (H2: (eq T (TLRef n) (lift h d (THead k t0 +t1)))).(let H3 \def (eq_ind T (lift h d (THead k t0 t1)) (\lambda (t2: T).(eq +T (TLRef n) t2)) H2 (THead k (lift h d t0) (lift h (s k d) t1)) (lift_head k +t0 t1 h d)) in (let H4 \def (match H3 in eq return (\lambda (t2: T).(\lambda +(_: (eq ? ? t2)).((eq T t2 (THead k (lift h d t0) (lift h (s k d) t1))) \to +(eq T (THead k t0 t1) (TLRef n))))) with [refl_equal \Rightarrow (\lambda +(H4: (eq T (TLRef n) (THead k (lift h d t0) (lift h (s k d) t1)))).(let H5 +\def (eq_ind T (TLRef n) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead k (lift h d t0) (lift h (s k d) +t1)) H4) in (False_ind (eq T (THead k t0 t1) (TLRef n)) H5)))]) in (H4 +(refl_equal T (THead k (lift h d t0) (lift h (s k d) t1)))))))))))) t))))). + +theorem lift_gen_lref_false: + \forall (h: nat).(\forall (d: nat).(\forall (n: nat).((le d n) \to ((lt n +(plus d h)) \to (\forall (t: T).((eq T (TLRef n) (lift h d t)) \to (\forall +(P: Prop).P))))))) +\def + \lambda (h: nat).(\lambda (d: nat).(\lambda (n: nat).(\lambda (H: (le d +n)).(\lambda (H0: (lt n (plus d h))).(\lambda (t: T).(T_ind (\lambda (t0: +T).((eq T (TLRef n) (lift h d t0)) \to (\forall (P: Prop).P))) (\lambda (n0: +nat).(\lambda (H1: (eq T (TLRef n) (lift h d (TSort n0)))).(\lambda (P: +Prop).(let H2 \def (match H1 in eq return (\lambda (t0: T).(\lambda (_: (eq ? +? t0)).((eq T t0 (lift h d (TSort n0))) \to P))) with [refl_equal \Rightarrow +(\lambda (H2: (eq T (TLRef n) (lift h d (TSort n0)))).(let H3 \def (eq_ind T +(TLRef n) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) +\Rightarrow False])) I (lift h d (TSort n0)) H2) in (False_ind P H3)))]) in +(H2 (refl_equal T (lift h d (TSort n0)))))))) (\lambda (n0: nat).(\lambda +(H1: (eq T (TLRef n) (lift h d (TLRef n0)))).(\lambda (P: Prop).(lt_le_e n0 d +P (\lambda (H2: (lt n0 d)).(let H3 \def (eq_ind T (lift h d (TLRef n0)) +(\lambda (t0: T).(eq T (TLRef n) t0)) H1 (TLRef n0) (lift_lref_lt n0 h d H2)) +in (let H4 \def (match H3 in eq return (\lambda (t0: T).(\lambda (_: (eq ? ? +t0)).((eq T t0 (TLRef n0)) \to P))) with [refl_equal \Rightarrow (\lambda +(H4: (eq T (TLRef n) (TLRef n0))).(let H5 \def (f_equal T nat (\lambda (e: +T).(match e in T return (\lambda (_: T).nat) with [(TSort _) \Rightarrow n | +(TLRef n1) \Rightarrow n1 | (THead _ _ _) \Rightarrow n])) (TLRef n) (TLRef +n0) H4) in (eq_ind nat n0 (\lambda (_: nat).P) (let H6 \def (eq_ind_r nat n0 +(\lambda (n1: nat).(lt n1 d)) H2 n H5) in (le_false d n P H H6)) n (sym_eq +nat n n0 H5))))]) in (H4 (refl_equal T (TLRef n0)))))) (\lambda (H2: (le d +n0)).(let H3 \def (eq_ind T (lift h d (TLRef n0)) (\lambda (t0: T).(eq T +(TLRef n) t0)) H1 (TLRef (plus n0 h)) (lift_lref_ge n0 h d H2)) in (let H4 +\def (match H3 in eq return (\lambda (t0: T).(\lambda (_: (eq ? ? t0)).((eq T +t0 (TLRef (plus n0 h))) \to P))) with [refl_equal \Rightarrow (\lambda (H4: +(eq T (TLRef n) (TLRef (plus n0 h)))).(let H5 \def (f_equal T nat (\lambda +(e: T).(match e in T return (\lambda (_: T).nat) with [(TSort _) \Rightarrow +n | (TLRef n1) \Rightarrow n1 | (THead _ _ _) \Rightarrow n])) (TLRef n) +(TLRef (plus n0 h)) H4) in (eq_ind nat (plus n0 h) (\lambda (_: nat).P) (let +H6 \def (eq_ind nat n (\lambda (n1: nat).(lt n1 (plus d h))) H0 (plus n0 h) +H5) in (le_false d n0 P H2 (lt_le_S n0 d (simpl_lt_plus_r h n0 d H6)))) n +(sym_eq nat n (plus n0 h) H5))))]) in (H4 (refl_equal T (TLRef (plus n0 +h))))))))))) (\lambda (k: K).(\lambda (t0: T).(\lambda (_: (((eq T (TLRef n) +(lift h d t0)) \to (\forall (P: Prop).P)))).(\lambda (t1: T).(\lambda (_: +(((eq T (TLRef n) (lift h d t1)) \to (\forall (P: Prop).P)))).(\lambda (H3: +(eq T (TLRef n) (lift h d (THead k t0 t1)))).(\lambda (P: Prop).(let H4 \def +(eq_ind T (lift h d (THead k t0 t1)) (\lambda (t2: T).(eq T (TLRef n) t2)) H3 +(THead k (lift h d t0) (lift h (s k d) t1)) (lift_head k t0 t1 h d)) in (let +H5 \def (match H4 in eq return (\lambda (t2: T).(\lambda (_: (eq ? ? +t2)).((eq T t2 (THead k (lift h d t0) (lift h (s k d) t1))) \to P))) with +[refl_equal \Rightarrow (\lambda (H5: (eq T (TLRef n) (THead k (lift h d t0) +(lift h (s k d) t1)))).(let H6 \def (eq_ind T (TLRef n) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I +(THead k (lift h d t0) (lift h (s k d) t1)) H5) in (False_ind P H6)))]) in +(H5 (refl_equal T (THead k (lift h d t0) (lift h (s k d) t1))))))))))))) +t)))))). + +theorem lift_gen_lref_ge: + \forall (h: nat).(\forall (d: nat).(\forall (n: nat).((le d n) \to (\forall +(t: T).((eq T (TLRef (plus n h)) (lift h d t)) \to (eq T t (TLRef n))))))) +\def + \lambda (h: nat).(\lambda (d: nat).(\lambda (n: nat).(\lambda (H: (le d +n)).(\lambda (t: T).(T_ind (\lambda (t0: T).((eq T (TLRef (plus n h)) (lift h +d t0)) \to (eq T t0 (TLRef n)))) (\lambda (n0: nat).(\lambda (H0: (eq T +(TLRef (plus n h)) (lift h d (TSort n0)))).(let H1 \def (match H0 in eq +return (\lambda (t0: T).(\lambda (_: (eq ? ? t0)).((eq T t0 (lift h d (TSort +n0))) \to (eq T (TSort n0) (TLRef n))))) with [refl_equal \Rightarrow +(\lambda (H1: (eq T (TLRef (plus n h)) (lift h d (TSort n0)))).(let H2 \def +(eq_ind T (TLRef (plus n h)) (\lambda (e: T).(match e in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (lift h d (TSort n0)) H1) in (False_ind +(eq T (TSort n0) (TLRef n)) H2)))]) in (H1 (refl_equal T (lift h d (TSort +n0))))))) (\lambda (n0: nat).(\lambda (H0: (eq T (TLRef (plus n h)) (lift h d +(TLRef n0)))).(lt_le_e n0 d (eq T (TLRef n0) (TLRef n)) (\lambda (H1: (lt n0 +d)).(let H2 \def (eq_ind T (lift h d (TLRef n0)) (\lambda (t0: T).(eq T +(TLRef (plus n h)) t0)) H0 (TLRef n0) (lift_lref_lt n0 h d H1)) in (let H3 +\def (match H2 in eq return (\lambda (t0: T).(\lambda (_: (eq ? ? t0)).((eq T +t0 (TLRef n0)) \to (eq T (TLRef n0) (TLRef n))))) with [refl_equal +\Rightarrow (\lambda (H3: (eq T (TLRef (plus n h)) (TLRef n0))).(let H4 \def +(f_equal T nat (\lambda (e: T).(match e in T return (\lambda (_: T).nat) with +[(TSort _) \Rightarrow ((let rec plus (n1: nat) on n1: (nat \to nat) \def +(\lambda (m: nat).(match n1 with [O \Rightarrow m | (S p) \Rightarrow (S +(plus p m))])) in plus) n h) | (TLRef n1) \Rightarrow n1 | (THead _ _ _) +\Rightarrow ((let rec plus (n1: nat) on n1: (nat \to nat) \def (\lambda (m: +nat).(match n1 with [O \Rightarrow m | (S p) \Rightarrow (S (plus p m))])) in +plus) n h)])) (TLRef (plus n h)) (TLRef n0) H3) in (eq_ind nat (plus n h) +(\lambda (n1: nat).(eq T (TLRef n1) (TLRef n))) (let H5 \def (eq_ind_r nat n0 +(\lambda (n1: nat).(lt n1 d)) H1 (plus n h) H4) in (le_false d n (eq T (TLRef +(plus n h)) (TLRef n)) H (lt_le_S n d (simpl_lt_plus_r h n d (lt_le_trans +(plus n h) d (plus d h) H5 (le_plus_l d h)))))) n0 H4)))]) in (H3 (refl_equal +T (TLRef n0)))))) (\lambda (H1: (le d n0)).(let H2 \def (eq_ind T (lift h d +(TLRef n0)) (\lambda (t0: T).(eq T (TLRef (plus n h)) t0)) H0 (TLRef (plus n0 +h)) (lift_lref_ge n0 h d H1)) in (let H3 \def (match H2 in eq return (\lambda +(t0: T).(\lambda (_: (eq ? ? t0)).((eq T t0 (TLRef (plus n0 h))) \to (eq T +(TLRef n0) (TLRef n))))) with [refl_equal \Rightarrow (\lambda (H3: (eq T +(TLRef (plus n h)) (TLRef (plus n0 h)))).(let H4 \def (f_equal T nat (\lambda +(e: T).(match e in T return (\lambda (_: T).nat) with [(TSort _) \Rightarrow +((let rec plus (n1: nat) on n1: (nat \to nat) \def (\lambda (m: nat).(match +n1 with [O \Rightarrow m | (S p) \Rightarrow (S (plus p m))])) in plus) n h) +| (TLRef n1) \Rightarrow n1 | (THead _ _ _) \Rightarrow ((let rec plus (n1: +nat) on n1: (nat \to nat) \def (\lambda (m: nat).(match n1 with [O +\Rightarrow m | (S p) \Rightarrow (S (plus p m))])) in plus) n h)])) (TLRef +(plus n h)) (TLRef (plus n0 h)) H3) in (eq_ind nat (plus n h) (\lambda (_: +nat).(eq T (TLRef n0) (TLRef n))) (f_equal nat T TLRef n0 n (simpl_plus_r h +n0 n (sym_eq nat (plus n h) (plus n0 h) H4))) (plus n0 h) H4)))]) in (H3 +(refl_equal T (TLRef (plus n0 h)))))))))) (\lambda (k: K).(\lambda (t0: +T).(\lambda (_: (((eq T (TLRef (plus n h)) (lift h d t0)) \to (eq T t0 (TLRef +n))))).(\lambda (t1: T).(\lambda (_: (((eq T (TLRef (plus n h)) (lift h d +t1)) \to (eq T t1 (TLRef n))))).(\lambda (H2: (eq T (TLRef (plus n h)) (lift +h d (THead k t0 t1)))).(let H3 \def (eq_ind T (lift h d (THead k t0 t1)) +(\lambda (t2: T).(eq T (TLRef (plus n h)) t2)) H2 (THead k (lift h d t0) +(lift h (s k d) t1)) (lift_head k t0 t1 h d)) in (let H4 \def (match H3 in eq +return (\lambda (t2: T).(\lambda (_: (eq ? ? t2)).((eq T t2 (THead k (lift h +d t0) (lift h (s k d) t1))) \to (eq T (THead k t0 t1) (TLRef n))))) with +[refl_equal \Rightarrow (\lambda (H4: (eq T (TLRef (plus n h)) (THead k (lift +h d t0) (lift h (s k d) t1)))).(let H5 \def (eq_ind T (TLRef (plus n h)) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow +False])) I (THead k (lift h d t0) (lift h (s k d) t1)) H4) in (False_ind (eq +T (THead k t0 t1) (TLRef n)) H5)))]) in (H4 (refl_equal T (THead k (lift h d +t0) (lift h (s k d) t1)))))))))))) t))))). + +theorem lift_gen_head: + \forall (k: K).(\forall (u: T).(\forall (t: T).(\forall (x: T).(\forall (h: +nat).(\forall (d: nat).((eq T (THead k u t) (lift h d x)) \to (ex3_2 T T +(\lambda (y: T).(\lambda (z: T).(eq T x (THead k y z)))) (\lambda (y: +T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h (s k d) z))))))))))) +\def + \lambda (k: K).(\lambda (u: T).(\lambda (t: T).(\lambda (x: T).(T_ind +(\lambda (t0: T).(\forall (h: nat).(\forall (d: nat).((eq T (THead k u t) +(lift h d t0)) \to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T t0 (THead +k y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda +(_: T).(\lambda (z: T).(eq T t (lift h (s k d) z))))))))) (\lambda (n: +nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H: (eq T (THead k u t) +(lift h d (TSort n)))).(let H0 \def (match H in eq return (\lambda (t0: +T).(\lambda (_: (eq ? ? t0)).((eq T t0 (lift h d (TSort n))) \to (ex3_2 T T +(\lambda (y: T).(\lambda (z: T).(eq T (TSort n) (THead k y z)))) (\lambda (y: +T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h (s k d) z)))))))) with [refl_equal \Rightarrow (\lambda +(H0: (eq T (THead k u t) (lift h d (TSort n)))).(let H1 \def (eq_ind T (THead +k u t) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (lift h d (TSort n)) H0) in (False_ind (ex3_2 T T +(\lambda (y: T).(\lambda (z: T).(eq T (TSort n) (THead k y z)))) (\lambda (y: +T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h (s k d) z))))) H1)))]) in (H0 (refl_equal T (lift h d +(TSort n))))))))) (\lambda (n: nat).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H: (eq T (THead k u t) (lift h d (TLRef n)))).(lt_le_e n d +(ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead k y z)))) +(\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h (s k d) z))))) (\lambda (H0: (lt n +d)).(let H1 \def (eq_ind T (lift h d (TLRef n)) (\lambda (t0: T).(eq T (THead +k u t) t0)) H (TLRef n) (lift_lref_lt n h d H0)) in (let H2 \def (match H1 in +eq return (\lambda (t0: T).(\lambda (_: (eq ? ? t0)).((eq T t0 (TLRef n)) \to +(ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead k y z)))) +(\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h (s k d) z)))))))) with [refl_equal +\Rightarrow (\lambda (H2: (eq T (THead k u t) (TLRef n))).(let H3 \def +(eq_ind T (THead k u t) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow True])) I (TLRef n) H2) in (False_ind (ex3_2 T T +(\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead k y z)))) (\lambda (y: +T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h (s k d) z))))) H3)))]) in (H2 (refl_equal T (TLRef n)))))) +(\lambda (H0: (le d n)).(let H1 \def (eq_ind T (lift h d (TLRef n)) (\lambda +(t0: T).(eq T (THead k u t) t0)) H (TLRef (plus n h)) (lift_lref_ge n h d +H0)) in (let H2 \def (match H1 in eq return (\lambda (t0: T).(\lambda (_: (eq +? ? t0)).((eq T t0 (TLRef (plus n h))) \to (ex3_2 T T (\lambda (y: +T).(\lambda (z: T).(eq T (TLRef n) (THead k y z)))) (\lambda (y: T).(\lambda +(_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift +h (s k d) z)))))))) with [refl_equal \Rightarrow (\lambda (H2: (eq T (THead k +u t) (TLRef (plus n h)))).(let H3 \def (eq_ind T (THead k u t) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I +(TLRef (plus n h)) H2) in (False_ind (ex3_2 T T (\lambda (y: T).(\lambda (z: +T).(eq T (TLRef n) (THead k y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u +(lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h (s k d) +z))))) H3)))]) in (H2 (refl_equal T (TLRef (plus n h)))))))))))) (\lambda +(k0: K).(\lambda (t0: T).(\lambda (_: ((\forall (h: nat).(\forall (d: +nat).((eq T (THead k u t) (lift h d t0)) \to (ex3_2 T T (\lambda (y: +T).(\lambda (z: T).(eq T t0 (THead k y z)))) (\lambda (y: T).(\lambda (_: +T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h (s +k d) z)))))))))).(\lambda (t1: T).(\lambda (_: ((\forall (h: nat).(\forall +(d: nat).((eq T (THead k u t) (lift h d t1)) \to (ex3_2 T T (\lambda (y: +T).(\lambda (z: T).(eq T t1 (THead k y z)))) (\lambda (y: T).(\lambda (_: +T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h (s +k d) z)))))))))).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H1: (eq T +(THead k u t) (lift h d (THead k0 t0 t1)))).(let H2 \def (eq_ind T (lift h d +(THead k0 t0 t1)) (\lambda (t2: T).(eq T (THead k u t) t2)) H1 (THead k0 +(lift h d t0) (lift h (s k0 d) t1)) (lift_head k0 t0 t1 h d)) in (let H3 \def +(match H2 in eq return (\lambda (t2: T).(\lambda (_: (eq ? ? t2)).((eq T t2 +(THead k0 (lift h d t0) (lift h (s k0 d) t1))) \to (ex3_2 T T (\lambda (y: +T).(\lambda (z: T).(eq T (THead k0 t0 t1) (THead k y z)))) (\lambda (y: +T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h (s k d) z)))))))) with [refl_equal \Rightarrow (\lambda +(H3: (eq T (THead k u t) (THead k0 (lift h d t0) (lift h (s k0 d) t1)))).(let +H4 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t | (TLRef _) \Rightarrow t | (THead _ _ t2) +\Rightarrow t2])) (THead k u t) (THead k0 (lift h d t0) (lift h (s k0 d) t1)) +H3) in ((let H5 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | +(THead _ t2 _) \Rightarrow t2])) (THead k u t) (THead k0 (lift h d t0) (lift +h (s k0 d) t1)) H3) in ((let H6 \def (f_equal T K (\lambda (e: T).(match e in +T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k1 _ _) \Rightarrow k1])) (THead k u t) (THead k0 +(lift h d t0) (lift h (s k0 d) t1)) H3) in (eq_ind K k0 (\lambda (k1: K).((eq +T u (lift h d t0)) \to ((eq T t (lift h (s k0 d) t1)) \to (ex3_2 T T (\lambda +(y: T).(\lambda (z: T).(eq T (THead k0 t0 t1) (THead k1 y z)))) (\lambda (y: +T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h (s k1 d) z)))))))) (\lambda (H7: (eq T u (lift h d +t0))).(eq_ind T (lift h d t0) (\lambda (t2: T).((eq T t (lift h (s k0 d) t1)) +\to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (THead k0 t0 t1) (THead +k0 y z)))) (\lambda (y: T).(\lambda (_: T).(eq T t2 (lift h d y)))) (\lambda +(_: T).(\lambda (z: T).(eq T t (lift h (s k0 d) z))))))) (\lambda (H8: (eq T +t (lift h (s k0 d) t1))).(eq_ind T (lift h (s k0 d) t1) (\lambda (t2: +T).(ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (THead k0 t0 t1) (THead +k0 y z)))) (\lambda (y: T).(\lambda (_: T).(eq T (lift h d t0) (lift h d +y)))) (\lambda (_: T).(\lambda (z: T).(eq T t2 (lift h (s k0 d) z)))))) +(ex3_2_intro T T (\lambda (y: T).(\lambda (z: T).(eq T (THead k0 t0 t1) +(THead k0 y z)))) (\lambda (y: T).(\lambda (_: T).(eq T (lift h d t0) (lift h +d y)))) (\lambda (_: T).(\lambda (z: T).(eq T (lift h (s k0 d) t1) (lift h (s +k0 d) z)))) t0 t1 (refl_equal T (THead k0 t0 t1)) (refl_equal T (lift h d +t0)) (refl_equal T (lift h (s k0 d) t1))) t (sym_eq T t (lift h (s k0 d) t1) +H8))) u (sym_eq T u (lift h d t0) H7))) k (sym_eq K k k0 H6))) H5)) H4)))]) +in (H3 (refl_equal T (THead k0 (lift h d t0) (lift h (s k0 d) +t1)))))))))))))) x)))). + +theorem lift_gen_bind: + \forall (b: B).(\forall (u: T).(\forall (t: T).(\forall (x: T).(\forall (h: +nat).(\forall (d: nat).((eq T (THead (Bind b) u t) (lift h d x)) \to (ex3_2 T +T (\lambda (y: T).(\lambda (z: T).(eq T x (THead (Bind b) y z)))) (\lambda +(y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h (S d) z))))))))))) +\def + \lambda (b: B).(\lambda (u: T).(\lambda (t: T).(\lambda (x: T).(T_ind +(\lambda (t0: T).(\forall (h: nat).(\forall (d: nat).((eq T (THead (Bind b) u +t) (lift h d t0)) \to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T t0 +(THead (Bind b) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d +y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h (S d) z))))))))) +(\lambda (n: nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H: (eq T +(THead (Bind b) u t) (lift h d (TSort n)))).(let H0 \def (match H in eq +return (\lambda (t0: T).(\lambda (_: (eq ? ? t0)).((eq T t0 (lift h d (TSort +n))) \to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (TSort n) (THead +(Bind b) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) +(\lambda (_: T).(\lambda (z: T).(eq T t (lift h (S d) z)))))))) with +[refl_equal \Rightarrow (\lambda (H0: (eq T (THead (Bind b) u t) (lift h d +(TSort n)))).(let H1 \def (eq_ind T (THead (Bind b) u t) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I +(lift h d (TSort n)) H0) in (False_ind (ex3_2 T T (\lambda (y: T).(\lambda +(z: T).(eq T (TSort n) (THead (Bind b) y z)))) (\lambda (y: T).(\lambda (_: +T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h (S +d) z))))) H1)))]) in (H0 (refl_equal T (lift h d (TSort n))))))))) (\lambda +(n: nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H: (eq T (THead (Bind +b) u t) (lift h d (TLRef n)))).(lt_le_e n d (ex3_2 T T (\lambda (y: +T).(\lambda (z: T).(eq T (TLRef n) (THead (Bind b) y z)))) (\lambda (y: +T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h (S d) z))))) (\lambda (H0: (lt n d)).(let H1 \def (eq_ind +T (lift h d (TLRef n)) (\lambda (t0: T).(eq T (THead (Bind b) u t) t0)) H +(TLRef n) (lift_lref_lt n h d H0)) in (let H2 \def (match H1 in eq return +(\lambda (t0: T).(\lambda (_: (eq ? ? t0)).((eq T t0 (TLRef n)) \to (ex3_2 T +T (\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead (Bind b) y z)))) +(\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h (S d) z)))))))) with [refl_equal +\Rightarrow (\lambda (H2: (eq T (THead (Bind b) u t) (TLRef n))).(let H3 \def +(eq_ind T (THead (Bind b) u t) (\lambda (e: T).(match e in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False +| (THead _ _ _) \Rightarrow True])) I (TLRef n) H2) in (False_ind (ex3_2 T T +(\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead (Bind b) y z)))) +(\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h (S d) z))))) H3)))]) in (H2 (refl_equal T +(TLRef n)))))) (\lambda (H0: (le d n)).(let H1 \def (eq_ind T (lift h d +(TLRef n)) (\lambda (t0: T).(eq T (THead (Bind b) u t) t0)) H (TLRef (plus n +h)) (lift_lref_ge n h d H0)) in (let H2 \def (match H1 in eq return (\lambda +(t0: T).(\lambda (_: (eq ? ? t0)).((eq T t0 (TLRef (plus n h))) \to (ex3_2 T +T (\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead (Bind b) y z)))) +(\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h (S d) z)))))))) with [refl_equal +\Rightarrow (\lambda (H2: (eq T (THead (Bind b) u t) (TLRef (plus n +h)))).(let H3 \def (eq_ind T (THead (Bind b) u t) (\lambda (e: T).(match e in +T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef (plus n h)) +H2) in (False_ind (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) +(THead (Bind b) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d +y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h (S d) z))))) H3)))]) in +(H2 (refl_equal T (TLRef (plus n h)))))))))))) (\lambda (k: K).(\lambda (t0: +T).(\lambda (_: ((\forall (h: nat).(\forall (d: nat).((eq T (THead (Bind b) u +t) (lift h d t0)) \to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T t0 +(THead (Bind b) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d +y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h (S d) +z)))))))))).(\lambda (t1: T).(\lambda (_: ((\forall (h: nat).(\forall (d: +nat).((eq T (THead (Bind b) u t) (lift h d t1)) \to (ex3_2 T T (\lambda (y: +T).(\lambda (z: T).(eq T t1 (THead (Bind b) y z)))) (\lambda (y: T).(\lambda +(_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift +h (S d) z)))))))))).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H1: (eq T +(THead (Bind b) u t) (lift h d (THead k t0 t1)))).(let H2 \def (eq_ind T +(lift h d (THead k t0 t1)) (\lambda (t2: T).(eq T (THead (Bind b) u t) t2)) +H1 (THead k (lift h d t0) (lift h (s k d) t1)) (lift_head k t0 t1 h d)) in +(let H3 \def (match H2 in eq return (\lambda (t2: T).(\lambda (_: (eq ? ? +t2)).((eq T t2 (THead k (lift h d t0) (lift h (s k d) t1))) \to (ex3_2 T T +(\lambda (y: T).(\lambda (z: T).(eq T (THead k t0 t1) (THead (Bind b) y z)))) +(\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h (S d) z)))))))) with [refl_equal +\Rightarrow (\lambda (H3: (eq T (THead (Bind b) u t) (THead k (lift h d t0) +(lift h (s k d) t1)))).(let H4 \def (f_equal T T (\lambda (e: T).(match e in +T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t | (TLRef _) +\Rightarrow t | (THead _ _ t2) \Rightarrow t2])) (THead (Bind b) u t) (THead +k (lift h d t0) (lift h (s k d) t1)) H3) in ((let H5 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u | (TLRef _) \Rightarrow u | (THead _ t2 _) \Rightarrow t2])) +(THead (Bind b) u t) (THead k (lift h d t0) (lift h (s k d) t1)) H3) in ((let +H6 \def (f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) +with [(TSort _) \Rightarrow (Bind b) | (TLRef _) \Rightarrow (Bind b) | +(THead k0 _ _) \Rightarrow k0])) (THead (Bind b) u t) (THead k (lift h d t0) +(lift h (s k d) t1)) H3) in (eq_ind K (Bind b) (\lambda (k0: K).((eq T u +(lift h d t0)) \to ((eq T t (lift h (s k0 d) t1)) \to (ex3_2 T T (\lambda (y: +T).(\lambda (z: T).(eq T (THead k0 t0 t1) (THead (Bind b) y z)))) (\lambda +(y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h (S d) z)))))))) (\lambda (H7: (eq T u (lift h d +t0))).(eq_ind T (lift h d t0) (\lambda (t2: T).((eq T t (lift h (s (Bind b) +d) t1)) \to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (THead (Bind b) +t0 t1) (THead (Bind b) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T t2 (lift +h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h (S d) z))))))) +(\lambda (H8: (eq T t (lift h (s (Bind b) d) t1))).(eq_ind T (lift h (s (Bind +b) d) t1) (\lambda (t2: T).(ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T +(THead (Bind b) t0 t1) (THead (Bind b) y z)))) (\lambda (y: T).(\lambda (_: +T).(eq T (lift h d t0) (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T +t2 (lift h (S d) z)))))) (ex3_2_intro T T (\lambda (y: T).(\lambda (z: T).(eq +T (THead (Bind b) t0 t1) (THead (Bind b) y z)))) (\lambda (y: T).(\lambda (_: +T).(eq T (lift h d t0) (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T +(lift h (s (Bind b) d) t1) (lift h (S d) z)))) t0 t1 (refl_equal T (THead +(Bind b) t0 t1)) (refl_equal T (lift h d t0)) (refl_equal T (lift h (S d) +t1))) t (sym_eq T t (lift h (s (Bind b) d) t1) H8))) u (sym_eq T u (lift h d +t0) H7))) k H6)) H5)) H4)))]) in (H3 (refl_equal T (THead k (lift h d t0) +(lift h (s k d) t1)))))))))))))) x)))). + +theorem lift_gen_flat: + \forall (f: F).(\forall (u: T).(\forall (t: T).(\forall (x: T).(\forall (h: +nat).(\forall (d: nat).((eq T (THead (Flat f) u t) (lift h d x)) \to (ex3_2 T +T (\lambda (y: T).(\lambda (z: T).(eq T x (THead (Flat f) y z)))) (\lambda +(y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h d z))))))))))) +\def + \lambda (f: F).(\lambda (u: T).(\lambda (t: T).(\lambda (x: T).(T_ind +(\lambda (t0: T).(\forall (h: nat).(\forall (d: nat).((eq T (THead (Flat f) u +t) (lift h d t0)) \to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T t0 +(THead (Flat f) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d +y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h d z))))))))) (\lambda +(n: nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H: (eq T (THead (Flat +f) u t) (lift h d (TSort n)))).(let H0 \def (match H in eq return (\lambda +(t0: T).(\lambda (_: (eq ? ? t0)).((eq T t0 (lift h d (TSort n))) \to (ex3_2 +T T (\lambda (y: T).(\lambda (z: T).(eq T (TSort n) (THead (Flat f) y z)))) +(\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h d z)))))))) with [refl_equal \Rightarrow +(\lambda (H0: (eq T (THead (Flat f) u t) (lift h d (TSort n)))).(let H1 \def +(eq_ind T (THead (Flat f) u t) (\lambda (e: T).(match e in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False +| (THead _ _ _) \Rightarrow True])) I (lift h d (TSort n)) H0) in (False_ind +(ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (TSort n) (THead (Flat f) y +z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h d z))))) H1)))]) in (H0 (refl_equal T +(lift h d (TSort n))))))))) (\lambda (n: nat).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H: (eq T (THead (Flat f) u t) (lift h d (TLRef n)))).(lt_le_e +n d (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead (Flat +f) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda +(_: T).(\lambda (z: T).(eq T t (lift h d z))))) (\lambda (H0: (lt n d)).(let +H1 \def (eq_ind T (lift h d (TLRef n)) (\lambda (t0: T).(eq T (THead (Flat f) +u t) t0)) H (TLRef n) (lift_lref_lt n h d H0)) in (let H2 \def (match H1 in +eq return (\lambda (t0: T).(\lambda (_: (eq ? ? t0)).((eq T t0 (TLRef n)) \to +(ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead (Flat f) y +z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h d z)))))))) with [refl_equal \Rightarrow +(\lambda (H2: (eq T (THead (Flat f) u t) (TLRef n))).(let H3 \def (eq_ind T +(THead (Flat f) u t) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow True])) I (TLRef n) H2) in (False_ind (ex3_2 T T +(\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead (Flat f) y z)))) +(\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h d z))))) H3)))]) in (H2 (refl_equal T +(TLRef n)))))) (\lambda (H0: (le d n)).(let H1 \def (eq_ind T (lift h d +(TLRef n)) (\lambda (t0: T).(eq T (THead (Flat f) u t) t0)) H (TLRef (plus n +h)) (lift_lref_ge n h d H0)) in (let H2 \def (match H1 in eq return (\lambda +(t0: T).(\lambda (_: (eq ? ? t0)).((eq T t0 (TLRef (plus n h))) \to (ex3_2 T +T (\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead (Flat f) y z)))) +(\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h d z)))))))) with [refl_equal \Rightarrow +(\lambda (H2: (eq T (THead (Flat f) u t) (TLRef (plus n h)))).(let H3 \def +(eq_ind T (THead (Flat f) u t) (\lambda (e: T).(match e in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False +| (THead _ _ _) \Rightarrow True])) I (TLRef (plus n h)) H2) in (False_ind +(ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (TLRef n) (THead (Flat f) y +z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h d z))))) H3)))]) in (H2 (refl_equal T +(TLRef (plus n h)))))))))))) (\lambda (k: K).(\lambda (t0: T).(\lambda (_: +((\forall (h: nat).(\forall (d: nat).((eq T (THead (Flat f) u t) (lift h d +t0)) \to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T t0 (THead (Flat f) +y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T t (lift h d z)))))))))).(\lambda (t1: T).(\lambda +(_: ((\forall (h: nat).(\forall (d: nat).((eq T (THead (Flat f) u t) (lift h +d t1)) \to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T t1 (THead (Flat +f) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda +(_: T).(\lambda (z: T).(eq T t (lift h d z)))))))))).(\lambda (h: +nat).(\lambda (d: nat).(\lambda (H1: (eq T (THead (Flat f) u t) (lift h d +(THead k t0 t1)))).(let H2 \def (eq_ind T (lift h d (THead k t0 t1)) (\lambda +(t2: T).(eq T (THead (Flat f) u t) t2)) H1 (THead k (lift h d t0) (lift h (s +k d) t1)) (lift_head k t0 t1 h d)) in (let H3 \def (match H2 in eq return +(\lambda (t2: T).(\lambda (_: (eq ? ? t2)).((eq T t2 (THead k (lift h d t0) +(lift h (s k d) t1))) \to (ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T +(THead k t0 t1) (THead (Flat f) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T +u (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h d z)))))))) +with [refl_equal \Rightarrow (\lambda (H3: (eq T (THead (Flat f) u t) (THead +k (lift h d t0) (lift h (s k d) t1)))).(let H4 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t | +(TLRef _) \Rightarrow t | (THead _ _ t2) \Rightarrow t2])) (THead (Flat f) u +t) (THead k (lift h d t0) (lift h (s k d) t1)) H3) in ((let H5 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u | (TLRef _) \Rightarrow u | (THead _ t2 _) \Rightarrow t2])) +(THead (Flat f) u t) (THead k (lift h d t0) (lift h (s k d) t1)) H3) in ((let +H6 \def (f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) +with [(TSort _) \Rightarrow (Flat f) | (TLRef _) \Rightarrow (Flat f) | +(THead k0 _ _) \Rightarrow k0])) (THead (Flat f) u t) (THead k (lift h d t0) +(lift h (s k d) t1)) H3) in (eq_ind K (Flat f) (\lambda (k0: K).((eq T u +(lift h d t0)) \to ((eq T t (lift h (s k0 d) t1)) \to (ex3_2 T T (\lambda (y: +T).(\lambda (z: T).(eq T (THead k0 t0 t1) (THead (Flat f) y z)))) (\lambda +(y: T).(\lambda (_: T).(eq T u (lift h d y)))) (\lambda (_: T).(\lambda (z: +T).(eq T t (lift h d z)))))))) (\lambda (H7: (eq T u (lift h d t0))).(eq_ind +T (lift h d t0) (\lambda (t2: T).((eq T t (lift h (s (Flat f) d) t1)) \to +(ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (THead (Flat f) t0 t1) +(THead (Flat f) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T t2 (lift h d +y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift h d z))))))) (\lambda +(H8: (eq T t (lift h (s (Flat f) d) t1))).(eq_ind T (lift h (s (Flat f) d) +t1) (\lambda (t2: T).(ex3_2 T T (\lambda (y: T).(\lambda (z: T).(eq T (THead +(Flat f) t0 t1) (THead (Flat f) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T +(lift h d t0) (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T t2 (lift +h d z)))))) (ex3_2_intro T T (\lambda (y: T).(\lambda (z: T).(eq T (THead +(Flat f) t0 t1) (THead (Flat f) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T +(lift h d t0) (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq T (lift h +(s (Flat f) d) t1) (lift h d z)))) t0 t1 (refl_equal T (THead (Flat f) t0 +t1)) (refl_equal T (lift h d t0)) (refl_equal T (lift h d t1))) t (sym_eq T t +(lift h (s (Flat f) d) t1) H8))) u (sym_eq T u (lift h d t0) H7))) k H6)) +H5)) H4)))]) in (H3 (refl_equal T (THead k (lift h d t0) (lift h (s k d) +t1)))))))))))))) x)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/props.ma new file mode 100644 index 000000000..6a8cc0ac0 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/props.ma @@ -0,0 +1,520 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/lift/props". + +include "tlist/defs.ma". + +include "lift/fwd.ma". + +include "s/props.ma". + +theorem thead_x_lift_y_y: + \forall (k: K).(\forall (t: T).(\forall (v: T).(\forall (h: nat).(\forall +(d: nat).((eq T (THead k v (lift h d t)) t) \to (\forall (P: Prop).P)))))) +\def + \lambda (k: K).(\lambda (t: T).(T_ind (\lambda (t0: T).(\forall (v: +T).(\forall (h: nat).(\forall (d: nat).((eq T (THead k v (lift h d t0)) t0) +\to (\forall (P: Prop).P)))))) (\lambda (n: nat).(\lambda (v: T).(\lambda (h: +nat).(\lambda (d: nat).(\lambda (H: (eq T (THead k v (lift h d (TSort n))) +(TSort n))).(\lambda (P: Prop).(let H0 \def (eq_ind T (THead k v (lift h d +(TSort n))) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TSort n) H) in (False_ind P H0)))))))) (\lambda (n: +nat).(\lambda (v: T).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H: (eq T +(THead k v (lift h d (TLRef n))) (TLRef n))).(\lambda (P: Prop).(let H0 \def +(eq_ind T (THead k v (lift h d (TLRef n))) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n) H) in +(False_ind P H0)))))))) (\lambda (k0: K).(\lambda (t0: T).(\lambda (_: +((\forall (v: T).(\forall (h: nat).(\forall (d: nat).((eq T (THead k v (lift +h d t0)) t0) \to (\forall (P: Prop).P))))))).(\lambda (t1: T).(\lambda (H0: +((\forall (v: T).(\forall (h: nat).(\forall (d: nat).((eq T (THead k v (lift +h d t1)) t1) \to (\forall (P: Prop).P))))))).(\lambda (v: T).(\lambda (h: +nat).(\lambda (d: nat).(\lambda (H1: (eq T (THead k v (lift h d (THead k0 t0 +t1))) (THead k0 t0 t1))).(\lambda (P: Prop).(let H2 \def (f_equal T K +(\lambda (e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) +\Rightarrow k | (TLRef _) \Rightarrow k | (THead k1 _ _) \Rightarrow k1])) +(THead k v (lift h d (THead k0 t0 t1))) (THead k0 t0 t1) H1) in ((let H3 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow v | (TLRef _) \Rightarrow v | (THead _ t2 _) +\Rightarrow t2])) (THead k v (lift h d (THead k0 t0 t1))) (THead k0 t0 t1) +H1) in ((let H4 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow (THead k0 ((let rec lref_map +(f: ((nat \to nat))) (d0: nat) (t2: T) on t2: T \def (match t2 with [(TSort +n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d0) +with [true \Rightarrow i | false \Rightarrow (f i)])) | (THead k1 u t3) +\Rightarrow (THead k1 (lref_map f d0 u) (lref_map f (s k1 d0) t3))]) in +lref_map) (\lambda (x: nat).(plus x h)) d t0) ((let rec lref_map (f: ((nat +\to nat))) (d0: nat) (t2: T) on t2: T \def (match t2 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d0) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k1 u t3) +\Rightarrow (THead k1 (lref_map f d0 u) (lref_map f (s k1 d0) t3))]) in +lref_map) (\lambda (x: nat).(plus x h)) (s k0 d) t1)) | (TLRef _) \Rightarrow +(THead k0 ((let rec lref_map (f: ((nat \to nat))) (d0: nat) (t2: T) on t2: T +\def (match t2 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d0) with [true \Rightarrow i | false \Rightarrow (f +i)])) | (THead k1 u t3) \Rightarrow (THead k1 (lref_map f d0 u) (lref_map f +(s k1 d0) t3))]) in lref_map) (\lambda (x: nat).(plus x h)) d t0) ((let rec +lref_map (f: ((nat \to nat))) (d0: nat) (t2: T) on t2: T \def (match t2 with +[(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i +d0) with [true \Rightarrow i | false \Rightarrow (f i)])) | (THead k1 u t3) +\Rightarrow (THead k1 (lref_map f d0 u) (lref_map f (s k1 d0) t3))]) in +lref_map) (\lambda (x: nat).(plus x h)) (s k0 d) t1)) | (THead _ _ t2) +\Rightarrow t2])) (THead k v (lift h d (THead k0 t0 t1))) (THead k0 t0 t1) +H1) in (\lambda (_: (eq T v t0)).(\lambda (H6: (eq K k k0)).(let H7 \def +(eq_ind K k (\lambda (k1: K).(\forall (v0: T).(\forall (h0: nat).(\forall +(d0: nat).((eq T (THead k1 v0 (lift h0 d0 t1)) t1) \to (\forall (P0: +Prop).P0)))))) H0 k0 H6) in (let H8 \def (eq_ind T (lift h d (THead k0 t0 +t1)) (\lambda (t2: T).(eq T t2 t1)) H4 (THead k0 (lift h d t0) (lift h (s k0 +d) t1)) (lift_head k0 t0 t1 h d)) in (H7 (lift h d t0) h (s k0 d) H8 P)))))) +H3)) H2)))))))))))) t)). + +theorem lift_r: + \forall (t: T).(\forall (d: nat).(eq T (lift O d t) t)) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(\forall (d: nat).(eq T (lift O d t0) +t0))) (\lambda (n: nat).(\lambda (_: nat).(refl_equal T (TSort n)))) (\lambda +(n: nat).(\lambda (d: nat).(lt_le_e n d (eq T (lift O d (TLRef n)) (TLRef n)) +(\lambda (H: (lt n d)).(eq_ind_r T (TLRef n) (\lambda (t0: T).(eq T t0 (TLRef +n))) (refl_equal T (TLRef n)) (lift O d (TLRef n)) (lift_lref_lt n O d H))) +(\lambda (H: (le d n)).(eq_ind_r T (TLRef (plus n O)) (\lambda (t0: T).(eq T +t0 (TLRef n))) (f_equal nat T TLRef (plus n O) n (sym_eq nat n (plus n O) +(plus_n_O n))) (lift O d (TLRef n)) (lift_lref_ge n O d H)))))) (\lambda (k: +K).(\lambda (t0: T).(\lambda (H: ((\forall (d: nat).(eq T (lift O d t0) +t0)))).(\lambda (t1: T).(\lambda (H0: ((\forall (d: nat).(eq T (lift O d t1) +t1)))).(\lambda (d: nat).(eq_ind_r T (THead k (lift O d t0) (lift O (s k d) +t1)) (\lambda (t2: T).(eq T t2 (THead k t0 t1))) (f_equal3 K T T T THead k k +(lift O d t0) t0 (lift O (s k d) t1) t1 (refl_equal K k) (H d) (H0 (s k d))) +(lift O d (THead k t0 t1)) (lift_head k t0 t1 O d)))))))) t). + +theorem lift_lref_gt: + \forall (d: nat).(\forall (n: nat).((lt d n) \to (eq T (lift (S O) d (TLRef +(pred n))) (TLRef n)))) +\def + \lambda (d: nat).(\lambda (n: nat).(\lambda (H: (lt d n)).(eq_ind_r T (TLRef +(plus (pred n) (S O))) (\lambda (t: T).(eq T t (TLRef n))) (eq_ind nat (plus +(S O) (pred n)) (\lambda (n0: nat).(eq T (TLRef n0) (TLRef n))) (eq_ind nat n +(\lambda (n0: nat).(eq T (TLRef n0) (TLRef n))) (refl_equal T (TLRef n)) (S +(pred n)) (S_pred n d H)) (plus (pred n) (S O)) (plus_comm (S O) (pred n))) +(lift (S O) d (TLRef (pred n))) (lift_lref_ge (pred n) (S O) d (le_S_n d +(pred n) (eq_ind nat n (\lambda (n0: nat).(le (S d) n0)) H (S (pred n)) +(S_pred n d H))))))). + +theorem lifts_tapp: + \forall (h: nat).(\forall (d: nat).(\forall (v: T).(\forall (vs: TList).(eq +TList (lifts h d (TApp vs v)) (TApp (lifts h d vs) (lift h d v)))))) +\def + \lambda (h: nat).(\lambda (d: nat).(\lambda (v: T).(\lambda (vs: +TList).(TList_ind (\lambda (t: TList).(eq TList (lifts h d (TApp t v)) (TApp +(lifts h d t) (lift h d v)))) (refl_equal TList (TCons (lift h d v) TNil)) +(\lambda (t: T).(\lambda (t0: TList).(\lambda (H: (eq TList (lifts h d (TApp +t0 v)) (TApp (lifts h d t0) (lift h d v)))).(eq_ind_r TList (TApp (lifts h d +t0) (lift h d v)) (\lambda (t1: TList).(eq TList (TCons (lift h d t) t1) +(TCons (lift h d t) (TApp (lifts h d t0) (lift h d v))))) (refl_equal TList +(TCons (lift h d t) (TApp (lifts h d t0) (lift h d v)))) (lifts h d (TApp t0 +v)) H)))) vs)))). + +theorem lift_inj: + \forall (x: T).(\forall (t: T).(\forall (h: nat).(\forall (d: nat).((eq T +(lift h d x) (lift h d t)) \to (eq T x t))))) +\def + \lambda (x: T).(T_ind (\lambda (t: T).(\forall (t0: T).(\forall (h: +nat).(\forall (d: nat).((eq T (lift h d t) (lift h d t0)) \to (eq T t +t0)))))) (\lambda (n: nat).(\lambda (t: T).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H: (eq T (lift h d (TSort n)) (lift h d t))).(let H0 \def +(eq_ind T (lift h d (TSort n)) (\lambda (t0: T).(eq T t0 (lift h d t))) H +(TSort n) (lift_sort n h d)) in (sym_eq T t (TSort n) (lift_gen_sort h d n t +H0)))))))) (\lambda (n: nat).(\lambda (t: T).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H: (eq T (lift h d (TLRef n)) (lift h d t))).(lt_le_e n d (eq +T (TLRef n) t) (\lambda (H0: (lt n d)).(let H1 \def (eq_ind T (lift h d +(TLRef n)) (\lambda (t0: T).(eq T t0 (lift h d t))) H (TLRef n) (lift_lref_lt +n h d H0)) in (sym_eq T t (TLRef n) (lift_gen_lref_lt h d n (lt_le_trans n d +d H0 (le_n d)) t H1)))) (\lambda (H0: (le d n)).(let H1 \def (eq_ind T (lift +h d (TLRef n)) (\lambda (t0: T).(eq T t0 (lift h d t))) H (TLRef (plus n h)) +(lift_lref_ge n h d H0)) in (sym_eq T t (TLRef n) (lift_gen_lref_ge h d n H0 +t H1)))))))))) (\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (t: +T).(((\forall (t0: T).(\forall (h: nat).(\forall (d: nat).((eq T (lift h d t) +(lift h d t0)) \to (eq T t t0)))))) \to (\forall (t0: T).(((\forall (t1: +T).(\forall (h: nat).(\forall (d: nat).((eq T (lift h d t0) (lift h d t1)) +\to (eq T t0 t1)))))) \to (\forall (t1: T).(\forall (h: nat).(\forall (d: +nat).((eq T (lift h d (THead k0 t t0)) (lift h d t1)) \to (eq T (THead k0 t +t0) t1)))))))))) (\lambda (b: B).(\lambda (t: T).(\lambda (H: ((\forall (t0: +T).(\forall (h: nat).(\forall (d: nat).((eq T (lift h d t) (lift h d t0)) \to +(eq T t t0))))))).(\lambda (t0: T).(\lambda (H0: ((\forall (t1: T).(\forall +(h: nat).(\forall (d: nat).((eq T (lift h d t0) (lift h d t1)) \to (eq T t0 +t1))))))).(\lambda (t1: T).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H1: +(eq T (lift h d (THead (Bind b) t t0)) (lift h d t1))).(let H2 \def (eq_ind T +(lift h d (THead (Bind b) t t0)) (\lambda (t2: T).(eq T t2 (lift h d t1))) H1 +(THead (Bind b) (lift h d t) (lift h (S d) t0)) (lift_bind b t t0 h d)) in +(ex3_2_ind T T (\lambda (y: T).(\lambda (z: T).(eq T t1 (THead (Bind b) y +z)))) (\lambda (y: T).(\lambda (_: T).(eq T (lift h d t) (lift h d y)))) +(\lambda (_: T).(\lambda (z: T).(eq T (lift h (S d) t0) (lift h (S d) z)))) +(eq T (THead (Bind b) t t0) t1) (\lambda (x0: T).(\lambda (x1: T).(\lambda +(H3: (eq T t1 (THead (Bind b) x0 x1))).(\lambda (H4: (eq T (lift h d t) (lift +h d x0))).(\lambda (H5: (eq T (lift h (S d) t0) (lift h (S d) x1))).(eq_ind_r +T (THead (Bind b) x0 x1) (\lambda (t2: T).(eq T (THead (Bind b) t t0) t2)) +(f_equal3 K T T T THead (Bind b) (Bind b) t x0 t0 x1 (refl_equal K (Bind b)) +(H x0 h d H4) (H0 x1 h (S d) H5)) t1 H3)))))) (lift_gen_bind b (lift h d t) +(lift h (S d) t0) t1 h d H2)))))))))))) (\lambda (f: F).(\lambda (t: +T).(\lambda (H: ((\forall (t0: T).(\forall (h: nat).(\forall (d: nat).((eq T +(lift h d t) (lift h d t0)) \to (eq T t t0))))))).(\lambda (t0: T).(\lambda +(H0: ((\forall (t1: T).(\forall (h: nat).(\forall (d: nat).((eq T (lift h d +t0) (lift h d t1)) \to (eq T t0 t1))))))).(\lambda (t1: T).(\lambda (h: +nat).(\lambda (d: nat).(\lambda (H1: (eq T (lift h d (THead (Flat f) t t0)) +(lift h d t1))).(let H2 \def (eq_ind T (lift h d (THead (Flat f) t t0)) +(\lambda (t2: T).(eq T t2 (lift h d t1))) H1 (THead (Flat f) (lift h d t) +(lift h d t0)) (lift_flat f t t0 h d)) in (ex3_2_ind T T (\lambda (y: +T).(\lambda (z: T).(eq T t1 (THead (Flat f) y z)))) (\lambda (y: T).(\lambda +(_: T).(eq T (lift h d t) (lift h d y)))) (\lambda (_: T).(\lambda (z: T).(eq +T (lift h d t0) (lift h d z)))) (eq T (THead (Flat f) t t0) t1) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H3: (eq T t1 (THead (Flat f) x0 x1))).(\lambda +(H4: (eq T (lift h d t) (lift h d x0))).(\lambda (H5: (eq T (lift h d t0) +(lift h d x1))).(eq_ind_r T (THead (Flat f) x0 x1) (\lambda (t2: T).(eq T +(THead (Flat f) t t0) t2)) (f_equal3 K T T T THead (Flat f) (Flat f) t x0 t0 +x1 (refl_equal K (Flat f)) (H x0 h d H4) (H0 x1 h d H5)) t1 H3)))))) +(lift_gen_flat f (lift h d t) (lift h d t0) t1 h d H2)))))))))))) k)) x). + +theorem lift_gen_lift: + \forall (t1: T).(\forall (x: T).(\forall (h1: nat).(\forall (h2: +nat).(\forall (d1: nat).(\forall (d2: nat).((le d1 d2) \to ((eq T (lift h1 d1 +t1) (lift h2 (plus d2 h1) x)) \to (ex2 T (\lambda (t2: T).(eq T x (lift h1 d1 +t2))) (\lambda (t2: T).(eq T t1 (lift h2 d2 t2))))))))))) +\def + \lambda (t1: T).(T_ind (\lambda (t: T).(\forall (x: T).(\forall (h1: +nat).(\forall (h2: nat).(\forall (d1: nat).(\forall (d2: nat).((le d1 d2) \to +((eq T (lift h1 d1 t) (lift h2 (plus d2 h1) x)) \to (ex2 T (\lambda (t2: +T).(eq T x (lift h1 d1 t2))) (\lambda (t2: T).(eq T t (lift h2 d2 +t2)))))))))))) (\lambda (n: nat).(\lambda (x: T).(\lambda (h1: nat).(\lambda +(h2: nat).(\lambda (d1: nat).(\lambda (d2: nat).(\lambda (_: (le d1 +d2)).(\lambda (H0: (eq T (lift h1 d1 (TSort n)) (lift h2 (plus d2 h1) +x))).(let H1 \def (eq_ind T (lift h1 d1 (TSort n)) (\lambda (t: T).(eq T t +(lift h2 (plus d2 h1) x))) H0 (TSort n) (lift_sort n h1 d1)) in (eq_ind_r T +(TSort n) (\lambda (t: T).(ex2 T (\lambda (t2: T).(eq T t (lift h1 d1 t2))) +(\lambda (t2: T).(eq T (TSort n) (lift h2 d2 t2))))) (ex_intro2 T (\lambda +(t2: T).(eq T (TSort n) (lift h1 d1 t2))) (\lambda (t2: T).(eq T (TSort n) +(lift h2 d2 t2))) (TSort n) (eq_ind_r T (TSort n) (\lambda (t: T).(eq T +(TSort n) t)) (refl_equal T (TSort n)) (lift h1 d1 (TSort n)) (lift_sort n h1 +d1)) (eq_ind_r T (TSort n) (\lambda (t: T).(eq T (TSort n) t)) (refl_equal T +(TSort n)) (lift h2 d2 (TSort n)) (lift_sort n h2 d2))) x (lift_gen_sort h2 +(plus d2 h1) n x H1))))))))))) (\lambda (n: nat).(\lambda (x: T).(\lambda +(h1: nat).(\lambda (h2: nat).(\lambda (d1: nat).(\lambda (d2: nat).(\lambda +(H: (le d1 d2)).(\lambda (H0: (eq T (lift h1 d1 (TLRef n)) (lift h2 (plus d2 +h1) x))).(lt_le_e n d1 (ex2 T (\lambda (t2: T).(eq T x (lift h1 d1 t2))) +(\lambda (t2: T).(eq T (TLRef n) (lift h2 d2 t2)))) (\lambda (H1: (lt n +d1)).(let H2 \def (eq_ind T (lift h1 d1 (TLRef n)) (\lambda (t: T).(eq T t +(lift h2 (plus d2 h1) x))) H0 (TLRef n) (lift_lref_lt n h1 d1 H1)) in +(eq_ind_r T (TLRef n) (\lambda (t: T).(ex2 T (\lambda (t2: T).(eq T t (lift +h1 d1 t2))) (\lambda (t2: T).(eq T (TLRef n) (lift h2 d2 t2))))) (ex_intro2 T +(\lambda (t2: T).(eq T (TLRef n) (lift h1 d1 t2))) (\lambda (t2: T).(eq T +(TLRef n) (lift h2 d2 t2))) (TLRef n) (eq_ind_r T (TLRef n) (\lambda (t: +T).(eq T (TLRef n) t)) (refl_equal T (TLRef n)) (lift h1 d1 (TLRef n)) +(lift_lref_lt n h1 d1 H1)) (eq_ind_r T (TLRef n) (\lambda (t: T).(eq T (TLRef +n) t)) (refl_equal T (TLRef n)) (lift h2 d2 (TLRef n)) (lift_lref_lt n h2 d2 +(lt_le_trans n d1 d2 H1 H)))) x (lift_gen_lref_lt h2 (plus d2 h1) n +(lt_le_trans n d1 (plus d2 h1) H1 (le_plus_trans d1 d2 h1 H)) x H2)))) +(\lambda (H1: (le d1 n)).(let H2 \def (eq_ind T (lift h1 d1 (TLRef n)) +(\lambda (t: T).(eq T t (lift h2 (plus d2 h1) x))) H0 (TLRef (plus n h1)) +(lift_lref_ge n h1 d1 H1)) in (lt_le_e n d2 (ex2 T (\lambda (t2: T).(eq T x +(lift h1 d1 t2))) (\lambda (t2: T).(eq T (TLRef n) (lift h2 d2 t2)))) +(\lambda (H3: (lt n d2)).(eq_ind_r T (TLRef (plus n h1)) (\lambda (t: T).(ex2 +T (\lambda (t2: T).(eq T t (lift h1 d1 t2))) (\lambda (t2: T).(eq T (TLRef n) +(lift h2 d2 t2))))) (ex_intro2 T (\lambda (t2: T).(eq T (TLRef (plus n h1)) +(lift h1 d1 t2))) (\lambda (t2: T).(eq T (TLRef n) (lift h2 d2 t2))) (TLRef +n) (eq_ind_r T (TLRef (plus n h1)) (\lambda (t: T).(eq T (TLRef (plus n h1)) +t)) (refl_equal T (TLRef (plus n h1))) (lift h1 d1 (TLRef n)) (lift_lref_ge n +h1 d1 H1)) (eq_ind_r T (TLRef n) (\lambda (t: T).(eq T (TLRef n) t)) +(refl_equal T (TLRef n)) (lift h2 d2 (TLRef n)) (lift_lref_lt n h2 d2 H3))) x +(lift_gen_lref_lt h2 (plus d2 h1) (plus n h1) (plus_lt_compat_r n d2 h1 H3) x +H2))) (\lambda (H3: (le d2 n)).(lt_le_e n (plus d2 h2) (ex2 T (\lambda (t2: +T).(eq T x (lift h1 d1 t2))) (\lambda (t2: T).(eq T (TLRef n) (lift h2 d2 +t2)))) (\lambda (H4: (lt n (plus d2 h2))).(lift_gen_lref_false h2 (plus d2 +h1) (plus n h1) (plus_le_compat d2 n h1 h1 H3 (le_n h1)) (eq_ind_r nat (plus +(plus d2 h2) h1) (\lambda (n0: nat).(lt (plus n h1) n0)) (plus_lt_compat_r n +(plus d2 h2) h1 H4) (plus (plus d2 h1) h2) (plus_permute_2_in_3 d2 h1 h2)) x +H2 (ex2 T (\lambda (t2: T).(eq T x (lift h1 d1 t2))) (\lambda (t2: T).(eq T +(TLRef n) (lift h2 d2 t2)))))) (\lambda (H4: (le (plus d2 h2) n)).(let H5 +\def (eq_ind nat (plus n h1) (\lambda (n0: nat).(eq T (TLRef n0) (lift h2 +(plus d2 h1) x))) H2 (plus (minus (plus n h1) h2) h2) (le_plus_minus_sym h2 +(plus n h1) (le_plus_trans h2 n h1 (le_trans h2 (plus d2 h2) n (le_plus_r d2 +h2) H4)))) in (eq_ind_r T (TLRef (minus (plus n h1) h2)) (\lambda (t: T).(ex2 +T (\lambda (t2: T).(eq T t (lift h1 d1 t2))) (\lambda (t2: T).(eq T (TLRef n) +(lift h2 d2 t2))))) (ex_intro2 T (\lambda (t2: T).(eq T (TLRef (minus (plus n +h1) h2)) (lift h1 d1 t2))) (\lambda (t2: T).(eq T (TLRef n) (lift h2 d2 t2))) +(TLRef (minus n h2)) (eq_ind_r nat (plus (minus n h2) h1) (\lambda (n0: +nat).(eq T (TLRef n0) (lift h1 d1 (TLRef (minus n h2))))) (eq_ind_r T (TLRef +(plus (minus n h2) h1)) (\lambda (t: T).(eq T (TLRef (plus (minus n h2) h1)) +t)) (refl_equal T (TLRef (plus (minus n h2) h1))) (lift h1 d1 (TLRef (minus n +h2))) (lift_lref_ge (minus n h2) h1 d1 (le_trans d1 d2 (minus n h2) H +(le_minus d2 n h2 H4)))) (minus (plus n h1) h2) (le_minus_plus h2 n (le_trans +h2 (plus d2 h2) n (le_plus_r d2 h2) H4) h1)) (eq_ind_r nat (plus (minus n h2) +h2) (\lambda (n0: nat).(eq T (TLRef n0) (lift h2 d2 (TLRef (minus n0 h2))))) +(eq_ind_r T (TLRef (plus (minus (plus (minus n h2) h2) h2) h2)) (\lambda (t: +T).(eq T (TLRef (plus (minus n h2) h2)) t)) (f_equal nat T TLRef (plus (minus +n h2) h2) (plus (minus (plus (minus n h2) h2) h2) h2) (f_equal2 nat nat nat +plus (minus n h2) (minus (plus (minus n h2) h2) h2) h2 h2 (sym_eq nat (minus +(plus (minus n h2) h2) h2) (minus n h2) (minus_plus_r (minus n h2) h2)) +(refl_equal nat h2))) (lift h2 d2 (TLRef (minus (plus (minus n h2) h2) h2))) +(lift_lref_ge (minus (plus (minus n h2) h2) h2) h2 d2 (le_minus d2 (plus +(minus n h2) h2) h2 (plus_le_compat d2 (minus n h2) h2 h2 (le_minus d2 n h2 +H4) (le_n h2))))) n (le_plus_minus_sym h2 n (le_trans h2 (plus d2 h2) n +(le_plus_r d2 h2) H4)))) x (lift_gen_lref_ge h2 (plus d2 h1) (minus (plus n +h1) h2) (arith0 h2 d2 n H4 h1) x H5)))))))))))))))))) (\lambda (k: +K).(\lambda (t: T).(\lambda (H: ((\forall (x: T).(\forall (h1: nat).(\forall +(h2: nat).(\forall (d1: nat).(\forall (d2: nat).((le d1 d2) \to ((eq T (lift +h1 d1 t) (lift h2 (plus d2 h1) x)) \to (ex2 T (\lambda (t2: T).(eq T x (lift +h1 d1 t2))) (\lambda (t2: T).(eq T t (lift h2 d2 t2))))))))))))).(\lambda +(t0: T).(\lambda (H0: ((\forall (x: T).(\forall (h1: nat).(\forall (h2: +nat).(\forall (d1: nat).(\forall (d2: nat).((le d1 d2) \to ((eq T (lift h1 d1 +t0) (lift h2 (plus d2 h1) x)) \to (ex2 T (\lambda (t2: T).(eq T x (lift h1 d1 +t2))) (\lambda (t2: T).(eq T t0 (lift h2 d2 t2))))))))))))).(\lambda (x: +T).(\lambda (h1: nat).(\lambda (h2: nat).(\lambda (d1: nat).(\lambda (d2: +nat).(\lambda (H1: (le d1 d2)).(\lambda (H2: (eq T (lift h1 d1 (THead k t +t0)) (lift h2 (plus d2 h1) x))).(K_ind (\lambda (k0: K).((eq T (lift h1 d1 +(THead k0 t t0)) (lift h2 (plus d2 h1) x)) \to (ex2 T (\lambda (t2: T).(eq T +x (lift h1 d1 t2))) (\lambda (t2: T).(eq T (THead k0 t t0) (lift h2 d2 +t2)))))) (\lambda (b: B).(\lambda (H3: (eq T (lift h1 d1 (THead (Bind b) t +t0)) (lift h2 (plus d2 h1) x))).(let H4 \def (eq_ind T (lift h1 d1 (THead +(Bind b) t t0)) (\lambda (t2: T).(eq T t2 (lift h2 (plus d2 h1) x))) H3 +(THead (Bind b) (lift h1 d1 t) (lift h1 (S d1) t0)) (lift_bind b t t0 h1 d1)) +in (ex3_2_ind T T (\lambda (y: T).(\lambda (z: T).(eq T x (THead (Bind b) y +z)))) (\lambda (y: T).(\lambda (_: T).(eq T (lift h1 d1 t) (lift h2 (plus d2 +h1) y)))) (\lambda (_: T).(\lambda (z: T).(eq T (lift h1 (S d1) t0) (lift h2 +(S (plus d2 h1)) z)))) (ex2 T (\lambda (t2: T).(eq T x (lift h1 d1 t2))) +(\lambda (t2: T).(eq T (THead (Bind b) t t0) (lift h2 d2 t2)))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H5: (eq T x (THead (Bind b) x0 x1))).(\lambda +(H6: (eq T (lift h1 d1 t) (lift h2 (plus d2 h1) x0))).(\lambda (H7: (eq T +(lift h1 (S d1) t0) (lift h2 (S (plus d2 h1)) x1))).(eq_ind_r T (THead (Bind +b) x0 x1) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h1 d1 t3))) +(\lambda (t3: T).(eq T (THead (Bind b) t t0) (lift h2 d2 t3))))) (ex2_ind T +(\lambda (t2: T).(eq T x0 (lift h1 d1 t2))) (\lambda (t2: T).(eq T t (lift h2 +d2 t2))) (ex2 T (\lambda (t2: T).(eq T (THead (Bind b) x0 x1) (lift h1 d1 +t2))) (\lambda (t2: T).(eq T (THead (Bind b) t t0) (lift h2 d2 t2)))) +(\lambda (x2: T).(\lambda (H8: (eq T x0 (lift h1 d1 x2))).(\lambda (H9: (eq T +t (lift h2 d2 x2))).(eq_ind_r T (lift h1 d1 x2) (\lambda (t2: T).(ex2 T +(\lambda (t3: T).(eq T (THead (Bind b) t2 x1) (lift h1 d1 t3))) (\lambda (t3: +T).(eq T (THead (Bind b) t t0) (lift h2 d2 t3))))) (eq_ind_r T (lift h2 d2 +x2) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead (Bind b) (lift h1 +d1 x2) x1) (lift h1 d1 t3))) (\lambda (t3: T).(eq T (THead (Bind b) t2 t0) +(lift h2 d2 t3))))) (let H10 \def (refl_equal nat (plus (S d2) h1)) in (let +H11 \def (eq_ind nat (S (plus d2 h1)) (\lambda (n: nat).(eq T (lift h1 (S d1) +t0) (lift h2 n x1))) H7 (plus (S d2) h1) H10) in (ex2_ind T (\lambda (t2: +T).(eq T x1 (lift h1 (S d1) t2))) (\lambda (t2: T).(eq T t0 (lift h2 (S d2) +t2))) (ex2 T (\lambda (t2: T).(eq T (THead (Bind b) (lift h1 d1 x2) x1) (lift +h1 d1 t2))) (\lambda (t2: T).(eq T (THead (Bind b) (lift h2 d2 x2) t0) (lift +h2 d2 t2)))) (\lambda (x3: T).(\lambda (H12: (eq T x1 (lift h1 (S d1) +x3))).(\lambda (H13: (eq T t0 (lift h2 (S d2) x3))).(eq_ind_r T (lift h1 (S +d1) x3) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead (Bind b) (lift +h1 d1 x2) t2) (lift h1 d1 t3))) (\lambda (t3: T).(eq T (THead (Bind b) (lift +h2 d2 x2) t0) (lift h2 d2 t3))))) (eq_ind_r T (lift h2 (S d2) x3) (\lambda +(t2: T).(ex2 T (\lambda (t3: T).(eq T (THead (Bind b) (lift h1 d1 x2) (lift +h1 (S d1) x3)) (lift h1 d1 t3))) (\lambda (t3: T).(eq T (THead (Bind b) (lift +h2 d2 x2) t2) (lift h2 d2 t3))))) (ex_intro2 T (\lambda (t2: T).(eq T (THead +(Bind b) (lift h1 d1 x2) (lift h1 (S d1) x3)) (lift h1 d1 t2))) (\lambda (t2: +T).(eq T (THead (Bind b) (lift h2 d2 x2) (lift h2 (S d2) x3)) (lift h2 d2 +t2))) (THead (Bind b) x2 x3) (eq_ind_r T (THead (Bind b) (lift h1 d1 x2) +(lift h1 (S d1) x3)) (\lambda (t2: T).(eq T (THead (Bind b) (lift h1 d1 x2) +(lift h1 (S d1) x3)) t2)) (refl_equal T (THead (Bind b) (lift h1 d1 x2) (lift +h1 (S d1) x3))) (lift h1 d1 (THead (Bind b) x2 x3)) (lift_bind b x2 x3 h1 +d1)) (eq_ind_r T (THead (Bind b) (lift h2 d2 x2) (lift h2 (S d2) x3)) +(\lambda (t2: T).(eq T (THead (Bind b) (lift h2 d2 x2) (lift h2 (S d2) x3)) +t2)) (refl_equal T (THead (Bind b) (lift h2 d2 x2) (lift h2 (S d2) x3))) +(lift h2 d2 (THead (Bind b) x2 x3)) (lift_bind b x2 x3 h2 d2))) t0 H13) x1 +H12)))) (H0 x1 h1 h2 (S d1) (S d2) (le_n_S d1 d2 H1) H11)))) t H9) x0 H8)))) +(H x0 h1 h2 d1 d2 H1 H6)) x H5)))))) (lift_gen_bind b (lift h1 d1 t) (lift h1 +(S d1) t0) x h2 (plus d2 h1) H4))))) (\lambda (f: F).(\lambda (H3: (eq T +(lift h1 d1 (THead (Flat f) t t0)) (lift h2 (plus d2 h1) x))).(let H4 \def +(eq_ind T (lift h1 d1 (THead (Flat f) t t0)) (\lambda (t2: T).(eq T t2 (lift +h2 (plus d2 h1) x))) H3 (THead (Flat f) (lift h1 d1 t) (lift h1 d1 t0)) +(lift_flat f t t0 h1 d1)) in (ex3_2_ind T T (\lambda (y: T).(\lambda (z: +T).(eq T x (THead (Flat f) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T +(lift h1 d1 t) (lift h2 (plus d2 h1) y)))) (\lambda (_: T).(\lambda (z: +T).(eq T (lift h1 d1 t0) (lift h2 (plus d2 h1) z)))) (ex2 T (\lambda (t2: +T).(eq T x (lift h1 d1 t2))) (\lambda (t2: T).(eq T (THead (Flat f) t t0) +(lift h2 d2 t2)))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H5: (eq T x +(THead (Flat f) x0 x1))).(\lambda (H6: (eq T (lift h1 d1 t) (lift h2 (plus d2 +h1) x0))).(\lambda (H7: (eq T (lift h1 d1 t0) (lift h2 (plus d2 h1) +x1))).(eq_ind_r T (THead (Flat f) x0 x1) (\lambda (t2: T).(ex2 T (\lambda +(t3: T).(eq T t2 (lift h1 d1 t3))) (\lambda (t3: T).(eq T (THead (Flat f) t +t0) (lift h2 d2 t3))))) (ex2_ind T (\lambda (t2: T).(eq T x0 (lift h1 d1 +t2))) (\lambda (t2: T).(eq T t (lift h2 d2 t2))) (ex2 T (\lambda (t2: T).(eq +T (THead (Flat f) x0 x1) (lift h1 d1 t2))) (\lambda (t2: T).(eq T (THead +(Flat f) t t0) (lift h2 d2 t2)))) (\lambda (x2: T).(\lambda (H8: (eq T x0 +(lift h1 d1 x2))).(\lambda (H9: (eq T t (lift h2 d2 x2))).(eq_ind_r T (lift +h1 d1 x2) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead (Flat f) t2 +x1) (lift h1 d1 t3))) (\lambda (t3: T).(eq T (THead (Flat f) t t0) (lift h2 +d2 t3))))) (eq_ind_r T (lift h2 d2 x2) (\lambda (t2: T).(ex2 T (\lambda (t3: +T).(eq T (THead (Flat f) (lift h1 d1 x2) x1) (lift h1 d1 t3))) (\lambda (t3: +T).(eq T (THead (Flat f) t2 t0) (lift h2 d2 t3))))) (ex2_ind T (\lambda (t2: +T).(eq T x1 (lift h1 d1 t2))) (\lambda (t2: T).(eq T t0 (lift h2 d2 t2))) +(ex2 T (\lambda (t2: T).(eq T (THead (Flat f) (lift h1 d1 x2) x1) (lift h1 d1 +t2))) (\lambda (t2: T).(eq T (THead (Flat f) (lift h2 d2 x2) t0) (lift h2 d2 +t2)))) (\lambda (x3: T).(\lambda (H10: (eq T x1 (lift h1 d1 x3))).(\lambda +(H11: (eq T t0 (lift h2 d2 x3))).(eq_ind_r T (lift h1 d1 x3) (\lambda (t2: +T).(ex2 T (\lambda (t3: T).(eq T (THead (Flat f) (lift h1 d1 x2) t2) (lift h1 +d1 t3))) (\lambda (t3: T).(eq T (THead (Flat f) (lift h2 d2 x2) t0) (lift h2 +d2 t3))))) (eq_ind_r T (lift h2 d2 x3) (\lambda (t2: T).(ex2 T (\lambda (t3: +T).(eq T (THead (Flat f) (lift h1 d1 x2) (lift h1 d1 x3)) (lift h1 d1 t3))) +(\lambda (t3: T).(eq T (THead (Flat f) (lift h2 d2 x2) t2) (lift h2 d2 +t3))))) (ex_intro2 T (\lambda (t2: T).(eq T (THead (Flat f) (lift h1 d1 x2) +(lift h1 d1 x3)) (lift h1 d1 t2))) (\lambda (t2: T).(eq T (THead (Flat f) +(lift h2 d2 x2) (lift h2 d2 x3)) (lift h2 d2 t2))) (THead (Flat f) x2 x3) +(eq_ind_r T (THead (Flat f) (lift h1 d1 x2) (lift h1 d1 x3)) (\lambda (t2: +T).(eq T (THead (Flat f) (lift h1 d1 x2) (lift h1 d1 x3)) t2)) (refl_equal T +(THead (Flat f) (lift h1 d1 x2) (lift h1 d1 x3))) (lift h1 d1 (THead (Flat f) +x2 x3)) (lift_flat f x2 x3 h1 d1)) (eq_ind_r T (THead (Flat f) (lift h2 d2 +x2) (lift h2 d2 x3)) (\lambda (t2: T).(eq T (THead (Flat f) (lift h2 d2 x2) +(lift h2 d2 x3)) t2)) (refl_equal T (THead (Flat f) (lift h2 d2 x2) (lift h2 +d2 x3))) (lift h2 d2 (THead (Flat f) x2 x3)) (lift_flat f x2 x3 h2 d2))) t0 +H11) x1 H10)))) (H0 x1 h1 h2 d1 d2 H1 H7)) t H9) x0 H8)))) (H x0 h1 h2 d1 d2 +H1 H6)) x H5)))))) (lift_gen_flat f (lift h1 d1 t) (lift h1 d1 t0) x h2 (plus +d2 h1) H4))))) k H2))))))))))))) t1). + +theorem lift_free: + \forall (t: T).(\forall (h: nat).(\forall (k: nat).(\forall (d: +nat).(\forall (e: nat).((le e (plus d h)) \to ((le d e) \to (eq T (lift k e +(lift h d t)) (lift (plus k h) d t)))))))) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(\forall (h: nat).(\forall (k: +nat).(\forall (d: nat).(\forall (e: nat).((le e (plus d h)) \to ((le d e) \to +(eq T (lift k e (lift h d t0)) (lift (plus k h) d t0))))))))) (\lambda (n: +nat).(\lambda (h: nat).(\lambda (k: nat).(\lambda (d: nat).(\lambda (e: +nat).(\lambda (_: (le e (plus d h))).(\lambda (_: (le d e)).(eq_ind_r T +(TSort n) (\lambda (t0: T).(eq T (lift k e t0) (lift (plus k h) d (TSort +n)))) (eq_ind_r T (TSort n) (\lambda (t0: T).(eq T t0 (lift (plus k h) d +(TSort n)))) (eq_ind_r T (TSort n) (\lambda (t0: T).(eq T (TSort n) t0)) +(refl_equal T (TSort n)) (lift (plus k h) d (TSort n)) (lift_sort n (plus k +h) d)) (lift k e (TSort n)) (lift_sort n k e)) (lift h d (TSort n)) +(lift_sort n h d))))))))) (\lambda (n: nat).(\lambda (h: nat).(\lambda (k: +nat).(\lambda (d: nat).(\lambda (e: nat).(\lambda (H: (le e (plus d +h))).(\lambda (H0: (le d e)).(lt_le_e n d (eq T (lift k e (lift h d (TLRef +n))) (lift (plus k h) d (TLRef n))) (\lambda (H1: (lt n d)).(eq_ind_r T +(TLRef n) (\lambda (t0: T).(eq T (lift k e t0) (lift (plus k h) d (TLRef +n)))) (eq_ind_r T (TLRef n) (\lambda (t0: T).(eq T t0 (lift (plus k h) d +(TLRef n)))) (eq_ind_r T (TLRef n) (\lambda (t0: T).(eq T (TLRef n) t0)) +(refl_equal T (TLRef n)) (lift (plus k h) d (TLRef n)) (lift_lref_lt n (plus +k h) d H1)) (lift k e (TLRef n)) (lift_lref_lt n k e (lt_le_trans n d e H1 +H0))) (lift h d (TLRef n)) (lift_lref_lt n h d H1))) (\lambda (H1: (le d +n)).(eq_ind_r T (TLRef (plus n h)) (\lambda (t0: T).(eq T (lift k e t0) (lift +(plus k h) d (TLRef n)))) (eq_ind_r T (TLRef (plus (plus n h) k)) (\lambda +(t0: T).(eq T t0 (lift (plus k h) d (TLRef n)))) (eq_ind_r T (TLRef (plus n +(plus k h))) (\lambda (t0: T).(eq T (TLRef (plus (plus n h) k)) t0)) (f_equal +nat T TLRef (plus (plus n h) k) (plus n (plus k h)) +(plus_permute_2_in_3_assoc n h k)) (lift (plus k h) d (TLRef n)) +(lift_lref_ge n (plus k h) d H1)) (lift k e (TLRef (plus n h))) (lift_lref_ge +(plus n h) k e (le_trans e (plus d h) (plus n h) H (plus_le_compat d n h h H1 +(le_n h))))) (lift h d (TLRef n)) (lift_lref_ge n h d H1))))))))))) (\lambda +(k: K).(\lambda (t0: T).(\lambda (H: ((\forall (h: nat).(\forall (k0: +nat).(\forall (d: nat).(\forall (e: nat).((le e (plus d h)) \to ((le d e) \to +(eq T (lift k0 e (lift h d t0)) (lift (plus k0 h) d t0)))))))))).(\lambda +(t1: T).(\lambda (H0: ((\forall (h: nat).(\forall (k0: nat).(\forall (d: +nat).(\forall (e: nat).((le e (plus d h)) \to ((le d e) \to (eq T (lift k0 e +(lift h d t1)) (lift (plus k0 h) d t1)))))))))).(\lambda (h: nat).(\lambda +(k0: nat).(\lambda (d: nat).(\lambda (e: nat).(\lambda (H1: (le e (plus d +h))).(\lambda (H2: (le d e)).(eq_ind_r T (THead k (lift h d t0) (lift h (s k +d) t1)) (\lambda (t2: T).(eq T (lift k0 e t2) (lift (plus k0 h) d (THead k t0 +t1)))) (eq_ind_r T (THead k (lift k0 e (lift h d t0)) (lift k0 (s k e) (lift +h (s k d) t1))) (\lambda (t2: T).(eq T t2 (lift (plus k0 h) d (THead k t0 +t1)))) (eq_ind_r T (THead k (lift (plus k0 h) d t0) (lift (plus k0 h) (s k d) +t1)) (\lambda (t2: T).(eq T (THead k (lift k0 e (lift h d t0)) (lift k0 (s k +e) (lift h (s k d) t1))) t2)) (f_equal3 K T T T THead k k (lift k0 e (lift h +d t0)) (lift (plus k0 h) d t0) (lift k0 (s k e) (lift h (s k d) t1)) (lift +(plus k0 h) (s k d) t1) (refl_equal K k) (H h k0 d e H1 H2) (H0 h k0 (s k d) +(s k e) (eq_ind nat (s k (plus d h)) (\lambda (n: nat).(le (s k e) n)) (s_le +k e (plus d h) H1) (plus (s k d) h) (s_plus k d h)) (s_le k d e H2))) (lift +(plus k0 h) d (THead k t0 t1)) (lift_head k t0 t1 (plus k0 h) d)) (lift k0 e +(THead k (lift h d t0) (lift h (s k d) t1))) (lift_head k (lift h d t0) (lift +h (s k d) t1) k0 e)) (lift h d (THead k t0 t1)) (lift_head k t0 t1 h +d))))))))))))) t). + +theorem lift_d: + \forall (t: T).(\forall (h: nat).(\forall (k: nat).(\forall (d: +nat).(\forall (e: nat).((le e d) \to (eq T (lift h (plus k d) (lift k e t)) +(lift k e (lift h d t)))))))) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(\forall (h: nat).(\forall (k: +nat).(\forall (d: nat).(\forall (e: nat).((le e d) \to (eq T (lift h (plus k +d) (lift k e t0)) (lift k e (lift h d t0))))))))) (\lambda (n: nat).(\lambda +(h: nat).(\lambda (k: nat).(\lambda (d: nat).(\lambda (e: nat).(\lambda (_: +(le e d)).(eq_ind_r T (TSort n) (\lambda (t0: T).(eq T (lift h (plus k d) t0) +(lift k e (lift h d (TSort n))))) (eq_ind_r T (TSort n) (\lambda (t0: T).(eq +T t0 (lift k e (lift h d (TSort n))))) (eq_ind_r T (TSort n) (\lambda (t0: +T).(eq T (TSort n) (lift k e t0))) (eq_ind_r T (TSort n) (\lambda (t0: T).(eq +T (TSort n) t0)) (refl_equal T (TSort n)) (lift k e (TSort n)) (lift_sort n k +e)) (lift h d (TSort n)) (lift_sort n h d)) (lift h (plus k d) (TSort n)) +(lift_sort n h (plus k d))) (lift k e (TSort n)) (lift_sort n k e)))))))) +(\lambda (n: nat).(\lambda (h: nat).(\lambda (k: nat).(\lambda (d: +nat).(\lambda (e: nat).(\lambda (H: (le e d)).(lt_le_e n e (eq T (lift h +(plus k d) (lift k e (TLRef n))) (lift k e (lift h d (TLRef n)))) (\lambda +(H0: (lt n e)).(let H1 \def (lt_le_trans n e d H0 H) in (eq_ind_r T (TLRef n) +(\lambda (t0: T).(eq T (lift h (plus k d) t0) (lift k e (lift h d (TLRef +n))))) (eq_ind_r T (TLRef n) (\lambda (t0: T).(eq T t0 (lift k e (lift h d +(TLRef n))))) (eq_ind_r T (TLRef n) (\lambda (t0: T).(eq T (TLRef n) (lift k +e t0))) (eq_ind_r T (TLRef n) (\lambda (t0: T).(eq T (TLRef n) t0)) +(refl_equal T (TLRef n)) (lift k e (TLRef n)) (lift_lref_lt n k e H0)) (lift +h d (TLRef n)) (lift_lref_lt n h d H1)) (lift h (plus k d) (TLRef n)) +(lift_lref_lt n h (plus k d) (lt_le_trans n d (plus k d) H1 (le_plus_r k +d)))) (lift k e (TLRef n)) (lift_lref_lt n k e H0)))) (\lambda (H0: (le e +n)).(eq_ind_r T (TLRef (plus n k)) (\lambda (t0: T).(eq T (lift h (plus k d) +t0) (lift k e (lift h d (TLRef n))))) (eq_ind_r nat (plus d k) (\lambda (n0: +nat).(eq T (lift h n0 (TLRef (plus n k))) (lift k e (lift h d (TLRef n))))) +(lt_le_e n d (eq T (lift h (plus d k) (TLRef (plus n k))) (lift k e (lift h d +(TLRef n)))) (\lambda (H1: (lt n d)).(eq_ind_r T (TLRef (plus n k)) (\lambda +(t0: T).(eq T t0 (lift k e (lift h d (TLRef n))))) (eq_ind_r T (TLRef n) +(\lambda (t0: T).(eq T (TLRef (plus n k)) (lift k e t0))) (eq_ind_r T (TLRef +(plus n k)) (\lambda (t0: T).(eq T (TLRef (plus n k)) t0)) (refl_equal T +(TLRef (plus n k))) (lift k e (TLRef n)) (lift_lref_ge n k e H0)) (lift h d +(TLRef n)) (lift_lref_lt n h d H1)) (lift h (plus d k) (TLRef (plus n k))) +(lift_lref_lt (plus n k) h (plus d k) (plus_lt_compat_r n d k H1)))) (\lambda +(H1: (le d n)).(eq_ind_r T (TLRef (plus (plus n k) h)) (\lambda (t0: T).(eq T +t0 (lift k e (lift h d (TLRef n))))) (eq_ind_r T (TLRef (plus n h)) (\lambda +(t0: T).(eq T (TLRef (plus (plus n k) h)) (lift k e t0))) (eq_ind_r T (TLRef +(plus (plus n h) k)) (\lambda (t0: T).(eq T (TLRef (plus (plus n k) h)) t0)) +(f_equal nat T TLRef (plus (plus n k) h) (plus (plus n h) k) (sym_eq nat +(plus (plus n h) k) (plus (plus n k) h) (plus_permute_2_in_3 n h k))) (lift k +e (TLRef (plus n h))) (lift_lref_ge (plus n h) k e (le_plus_trans e n h H0))) +(lift h d (TLRef n)) (lift_lref_ge n h d H1)) (lift h (plus d k) (TLRef (plus +n k))) (lift_lref_ge (plus n k) h (plus d k) (plus_le_compat d n k k H1 (le_n +k)))))) (plus k d) (plus_comm k d)) (lift k e (TLRef n)) (lift_lref_ge n k e +H0)))))))))) (\lambda (k: K).(\lambda (t0: T).(\lambda (H: ((\forall (h: +nat).(\forall (k0: nat).(\forall (d: nat).(\forall (e: nat).((le e d) \to (eq +T (lift h (plus k0 d) (lift k0 e t0)) (lift k0 e (lift h d +t0)))))))))).(\lambda (t1: T).(\lambda (H0: ((\forall (h: nat).(\forall (k0: +nat).(\forall (d: nat).(\forall (e: nat).((le e d) \to (eq T (lift h (plus k0 +d) (lift k0 e t1)) (lift k0 e (lift h d t1)))))))))).(\lambda (h: +nat).(\lambda (k0: nat).(\lambda (d: nat).(\lambda (e: nat).(\lambda (H1: (le +e d)).(eq_ind_r T (THead k (lift k0 e t0) (lift k0 (s k e) t1)) (\lambda (t2: +T).(eq T (lift h (plus k0 d) t2) (lift k0 e (lift h d (THead k t0 t1))))) +(eq_ind_r T (THead k (lift h (plus k0 d) (lift k0 e t0)) (lift h (s k (plus +k0 d)) (lift k0 (s k e) t1))) (\lambda (t2: T).(eq T t2 (lift k0 e (lift h d +(THead k t0 t1))))) (eq_ind_r T (THead k (lift h d t0) (lift h (s k d) t1)) +(\lambda (t2: T).(eq T (THead k (lift h (plus k0 d) (lift k0 e t0)) (lift h +(s k (plus k0 d)) (lift k0 (s k e) t1))) (lift k0 e t2))) (eq_ind_r T (THead +k (lift k0 e (lift h d t0)) (lift k0 (s k e) (lift h (s k d) t1))) (\lambda +(t2: T).(eq T (THead k (lift h (plus k0 d) (lift k0 e t0)) (lift h (s k (plus +k0 d)) (lift k0 (s k e) t1))) t2)) (eq_ind_r nat (plus k0 (s k d)) (\lambda +(n: nat).(eq T (THead k (lift h (plus k0 d) (lift k0 e t0)) (lift h n (lift +k0 (s k e) t1))) (THead k (lift k0 e (lift h d t0)) (lift k0 (s k e) (lift h +(s k d) t1))))) (f_equal3 K T T T THead k k (lift h (plus k0 d) (lift k0 e +t0)) (lift k0 e (lift h d t0)) (lift h (plus k0 (s k d)) (lift k0 (s k e) +t1)) (lift k0 (s k e) (lift h (s k d) t1)) (refl_equal K k) (H h k0 d e H1) +(H0 h k0 (s k d) (s k e) (s_le k e d H1))) (s k (plus k0 d)) (s_plus_sym k k0 +d)) (lift k0 e (THead k (lift h d t0) (lift h (s k d) t1))) (lift_head k +(lift h d t0) (lift h (s k d) t1) k0 e)) (lift h d (THead k t0 t1)) +(lift_head k t0 t1 h d)) (lift h (plus k0 d) (THead k (lift k0 e t0) (lift k0 +(s k e) t1))) (lift_head k (lift k0 e t0) (lift k0 (s k e) t1) h (plus k0 +d))) (lift k0 e (THead k t0 t1)) (lift_head k t0 t1 k0 e)))))))))))) t). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/tlt.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/tlt.ma new file mode 100644 index 000000000..0e041d02d --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/tlt.ma @@ -0,0 +1,294 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/lift/tlt". + +include "lift/fwd.ma". + +include "tlt/props.ma". + +theorem lift_weight_map: + \forall (t: T).(\forall (h: nat).(\forall (d: nat).(\forall (f: ((nat \to +nat))).(((\forall (m: nat).((le d m) \to (eq nat (f m) O)))) \to (eq nat +(weight_map f (lift h d t)) (weight_map f t)))))) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(\forall (h: nat).(\forall (d: +nat).(\forall (f: ((nat \to nat))).(((\forall (m: nat).((le d m) \to (eq nat +(f m) O)))) \to (eq nat (weight_map f (lift h d t0)) (weight_map f t0))))))) +(\lambda (n: nat).(\lambda (_: nat).(\lambda (d: nat).(\lambda (f: ((nat \to +nat))).(\lambda (_: ((\forall (m: nat).((le d m) \to (eq nat (f m) +O))))).(refl_equal nat (weight_map f (TSort n)))))))) (\lambda (n: +nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (f: ((nat \to +nat))).(\lambda (H: ((\forall (m: nat).((le d m) \to (eq nat (f m) +O))))).(lt_le_e n d (eq nat (weight_map f (lift h d (TLRef n))) (weight_map f +(TLRef n))) (\lambda (H0: (lt n d)).(eq_ind_r T (TLRef n) (\lambda (t0: +T).(eq nat (weight_map f t0) (weight_map f (TLRef n)))) (refl_equal nat +(weight_map f (TLRef n))) (lift h d (TLRef n)) (lift_lref_lt n h d H0))) +(\lambda (H0: (le d n)).(eq_ind_r T (TLRef (plus n h)) (\lambda (t0: T).(eq +nat (weight_map f t0) (weight_map f (TLRef n)))) (eq_ind_r nat O (\lambda +(n0: nat).(eq nat (f (plus n h)) n0)) (H (plus n h) (le_plus_trans d n h H0)) +(f n) (H n H0)) (lift h d (TLRef n)) (lift_lref_ge n h d H0))))))))) (\lambda +(k: K).(\lambda (t0: T).(\lambda (H: ((\forall (h: nat).(\forall (d: +nat).(\forall (f: ((nat \to nat))).(((\forall (m: nat).((le d m) \to (eq nat +(f m) O)))) \to (eq nat (weight_map f (lift h d t0)) (weight_map f +t0)))))))).(\lambda (t1: T).(\lambda (H0: ((\forall (h: nat).(\forall (d: +nat).(\forall (f: ((nat \to nat))).(((\forall (m: nat).((le d m) \to (eq nat +(f m) O)))) \to (eq nat (weight_map f (lift h d t1)) (weight_map f +t1)))))))).(\lambda (h: nat).(\lambda (d: nat).(\lambda (f: ((nat \to +nat))).(\lambda (H1: ((\forall (m: nat).((le d m) \to (eq nat (f m) +O))))).(K_ind (\lambda (k0: K).(eq nat (weight_map f (lift h d (THead k0 t0 +t1))) (weight_map f (THead k0 t0 t1)))) (\lambda (b: B).(eq_ind_r T (THead +(Bind b) (lift h d t0) (lift h (s (Bind b) d) t1)) (\lambda (t2: T).(eq nat +(weight_map f t2) (weight_map f (THead (Bind b) t0 t1)))) (B_ind (\lambda +(b0: B).(eq nat (match b0 with [Abbr \Rightarrow (S (plus (weight_map f (lift +h d t0)) (weight_map (wadd f (S (weight_map f (lift h d t0)))) (lift h (S d) +t1)))) | Abst \Rightarrow (S (plus (weight_map f (lift h d t0)) (weight_map +(wadd f O) (lift h (S d) t1)))) | Void \Rightarrow (S (plus (weight_map f +(lift h d t0)) (weight_map (wadd f O) (lift h (S d) t1))))]) (match b0 with +[Abbr \Rightarrow (S (plus (weight_map f t0) (weight_map (wadd f (S +(weight_map f t0))) t1))) | Abst \Rightarrow (S (plus (weight_map f t0) +(weight_map (wadd f O) t1))) | Void \Rightarrow (S (plus (weight_map f t0) +(weight_map (wadd f O) t1)))]))) (eq_ind_r nat (weight_map f t0) (\lambda (n: +nat).(eq nat (S (plus n (weight_map (wadd f (S n)) (lift h (S d) t1)))) (S +(plus (weight_map f t0) (weight_map (wadd f (S (weight_map f t0))) t1))))) +(eq_ind_r nat (weight_map (wadd f (S (weight_map f t0))) t1) (\lambda (n: +nat).(eq nat (S (plus (weight_map f t0) n)) (S (plus (weight_map f t0) +(weight_map (wadd f (S (weight_map f t0))) t1))))) (refl_equal nat (S (plus +(weight_map f t0) (weight_map (wadd f (S (weight_map f t0))) t1)))) +(weight_map (wadd f (S (weight_map f t0))) (lift h (S d) t1)) (H0 h (S d) +(wadd f (S (weight_map f t0))) (\lambda (m: nat).(\lambda (H2: (le (S d) +m)).(ex2_ind nat (\lambda (n: nat).(eq nat m (S n))) (\lambda (n: nat).(le d +n)) (eq nat (wadd f (S (weight_map f t0)) m) O) (\lambda (x: nat).(\lambda +(H3: (eq nat m (S x))).(\lambda (H4: (le d x)).(eq_ind_r nat (S x) (\lambda +(n: nat).(eq nat (wadd f (S (weight_map f t0)) n) O)) (H1 x H4) m H3)))) +(le_gen_S d m H2)))))) (weight_map f (lift h d t0)) (H h d f H1)) (eq_ind_r +nat (weight_map (wadd f O) t1) (\lambda (n: nat).(eq nat (S (plus (weight_map +f (lift h d t0)) n)) (S (plus (weight_map f t0) (weight_map (wadd f O) +t1))))) (f_equal nat nat S (plus (weight_map f (lift h d t0)) (weight_map +(wadd f O) t1)) (plus (weight_map f t0) (weight_map (wadd f O) t1)) (f_equal2 +nat nat nat plus (weight_map f (lift h d t0)) (weight_map f t0) (weight_map +(wadd f O) t1) (weight_map (wadd f O) t1) (H h d f H1) (refl_equal nat +(weight_map (wadd f O) t1)))) (weight_map (wadd f O) (lift h (S d) t1)) (H0 h +(S d) (wadd f O) (\lambda (m: nat).(\lambda (H2: (le (S d) m)).(ex2_ind nat +(\lambda (n: nat).(eq nat m (S n))) (\lambda (n: nat).(le d n)) (eq nat (wadd +f O m) O) (\lambda (x: nat).(\lambda (H3: (eq nat m (S x))).(\lambda (H4: (le +d x)).(eq_ind_r nat (S x) (\lambda (n: nat).(eq nat (wadd f O n) O)) (H1 x +H4) m H3)))) (le_gen_S d m H2)))))) (eq_ind_r nat (weight_map (wadd f O) t1) +(\lambda (n: nat).(eq nat (S (plus (weight_map f (lift h d t0)) n)) (S (plus +(weight_map f t0) (weight_map (wadd f O) t1))))) (f_equal nat nat S (plus +(weight_map f (lift h d t0)) (weight_map (wadd f O) t1)) (plus (weight_map f +t0) (weight_map (wadd f O) t1)) (f_equal2 nat nat nat plus (weight_map f +(lift h d t0)) (weight_map f t0) (weight_map (wadd f O) t1) (weight_map (wadd +f O) t1) (H h d f H1) (refl_equal nat (weight_map (wadd f O) t1)))) +(weight_map (wadd f O) (lift h (S d) t1)) (H0 h (S d) (wadd f O) (\lambda (m: +nat).(\lambda (H2: (le (S d) m)).(ex2_ind nat (\lambda (n: nat).(eq nat m (S +n))) (\lambda (n: nat).(le d n)) (eq nat (wadd f O m) O) (\lambda (x: +nat).(\lambda (H3: (eq nat m (S x))).(\lambda (H4: (le d x)).(eq_ind_r nat (S +x) (\lambda (n: nat).(eq nat (wadd f O n) O)) (H1 x H4) m H3)))) (le_gen_S d +m H2)))))) b) (lift h d (THead (Bind b) t0 t1)) (lift_head (Bind b) t0 t1 h +d))) (\lambda (f0: F).(eq_ind_r T (THead (Flat f0) (lift h d t0) (lift h (s +(Flat f0) d) t1)) (\lambda (t2: T).(eq nat (weight_map f t2) (weight_map f +(THead (Flat f0) t0 t1)))) (f_equal nat nat S (plus (weight_map f (lift h d +t0)) (weight_map f (lift h d t1))) (plus (weight_map f t0) (weight_map f t1)) +(f_equal2 nat nat nat plus (weight_map f (lift h d t0)) (weight_map f t0) +(weight_map f (lift h d t1)) (weight_map f t1) (H h d f H1) (H0 h d f H1))) +(lift h d (THead (Flat f0) t0 t1)) (lift_head (Flat f0) t0 t1 h d))) +k)))))))))) t). + +theorem lift_weight: + \forall (t: T).(\forall (h: nat).(\forall (d: nat).(eq nat (weight (lift h d +t)) (weight t)))) +\def + \lambda (t: T).(\lambda (h: nat).(\lambda (d: nat).(lift_weight_map t h d +(\lambda (_: nat).O) (\lambda (m: nat).(\lambda (_: (le d m)).(refl_equal nat +O)))))). + +theorem lift_weight_add: + \forall (w: nat).(\forall (t: T).(\forall (h: nat).(\forall (d: +nat).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall +(m: nat).((lt m d) \to (eq nat (g m) (f m))))) \to ((eq nat (g d) w) \to +(((\forall (m: nat).((le d m) \to (eq nat (g (S m)) (f m))))) \to (eq nat +(weight_map f (lift h d t)) (weight_map g (lift (S h) d t))))))))))) +\def + \lambda (w: nat).(\lambda (t: T).(T_ind (\lambda (t0: T).(\forall (h: +nat).(\forall (d: nat).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).((lt m d) \to (eq nat (g m) (f m))))) \to ((eq nat +(g d) w) \to (((\forall (m: nat).((le d m) \to (eq nat (g (S m)) (f m))))) +\to (eq nat (weight_map f (lift h d t0)) (weight_map g (lift (S h) d +t0))))))))))) (\lambda (n: nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda +(f: ((nat \to nat))).(\lambda (g: ((nat \to nat))).(\lambda (_: ((\forall (m: +nat).((lt m d) \to (eq nat (g m) (f m)))))).(\lambda (_: (eq nat (g d) +w)).(\lambda (_: ((\forall (m: nat).((le d m) \to (eq nat (g (S m)) (f +m)))))).(refl_equal nat (weight_map g (lift (S h) d (TSort n)))))))))))) +(\lambda (n: nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (f: ((nat \to +nat))).(\lambda (g: ((nat \to nat))).(\lambda (H: ((\forall (m: nat).((lt m +d) \to (eq nat (g m) (f m)))))).(\lambda (_: (eq nat (g d) w)).(\lambda (H1: +((\forall (m: nat).((le d m) \to (eq nat (g (S m)) (f m)))))).(lt_le_e n d +(eq nat (weight_map f (lift h d (TLRef n))) (weight_map g (lift (S h) d +(TLRef n)))) (\lambda (H2: (lt n d)).(eq_ind_r T (TLRef n) (\lambda (t0: +T).(eq nat (weight_map f t0) (weight_map g (lift (S h) d (TLRef n))))) +(eq_ind_r T (TLRef n) (\lambda (t0: T).(eq nat (weight_map f (TLRef n)) +(weight_map g t0))) (sym_eq nat (g n) (f n) (H n H2)) (lift (S h) d (TLRef +n)) (lift_lref_lt n (S h) d H2)) (lift h d (TLRef n)) (lift_lref_lt n h d +H2))) (\lambda (H2: (le d n)).(eq_ind_r T (TLRef (plus n h)) (\lambda (t0: +T).(eq nat (weight_map f t0) (weight_map g (lift (S h) d (TLRef n))))) +(eq_ind_r T (TLRef (plus n (S h))) (\lambda (t0: T).(eq nat (weight_map f +(TLRef (plus n h))) (weight_map g t0))) (eq_ind nat (S (plus n h)) (\lambda +(n0: nat).(eq nat (f (plus n h)) (g n0))) (sym_eq nat (g (S (plus n h))) (f +(plus n h)) (H1 (plus n h) (le_plus_trans d n h H2))) (plus n (S h)) +(plus_n_Sm n h)) (lift (S h) d (TLRef n)) (lift_lref_ge n (S h) d H2)) (lift +h d (TLRef n)) (lift_lref_ge n h d H2)))))))))))) (\lambda (k: K).(\lambda +(t0: T).(\lambda (H: ((\forall (h: nat).(\forall (d: nat).(\forall (f: ((nat +\to nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).((lt m d) \to +(eq nat (g m) (f m))))) \to ((eq nat (g d) w) \to (((\forall (m: nat).((le d +m) \to (eq nat (g (S m)) (f m))))) \to (eq nat (weight_map f (lift h d t0)) +(weight_map g (lift (S h) d t0)))))))))))).(\lambda (t1: T).(\lambda (H0: +((\forall (h: nat).(\forall (d: nat).(\forall (f: ((nat \to nat))).(\forall +(g: ((nat \to nat))).(((\forall (m: nat).((lt m d) \to (eq nat (g m) (f +m))))) \to ((eq nat (g d) w) \to (((\forall (m: nat).((le d m) \to (eq nat (g +(S m)) (f m))))) \to (eq nat (weight_map f (lift h d t1)) (weight_map g (lift +(S h) d t1)))))))))))).(\lambda (h: nat).(\lambda (d: nat).(\lambda (f: ((nat +\to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H1: ((\forall (m: +nat).((lt m d) \to (eq nat (g m) (f m)))))).(\lambda (H2: (eq nat (g d) +w)).(\lambda (H3: ((\forall (m: nat).((le d m) \to (eq nat (g (S m)) (f +m)))))).(K_ind (\lambda (k0: K).(eq nat (weight_map f (lift h d (THead k0 t0 +t1))) (weight_map g (lift (S h) d (THead k0 t0 t1))))) (\lambda (b: +B).(eq_ind_r T (THead (Bind b) (lift h d t0) (lift h (s (Bind b) d) t1)) +(\lambda (t2: T).(eq nat (weight_map f t2) (weight_map g (lift (S h) d (THead +(Bind b) t0 t1))))) (eq_ind_r T (THead (Bind b) (lift (S h) d t0) (lift (S h) +(s (Bind b) d) t1)) (\lambda (t2: T).(eq nat (weight_map f (THead (Bind b) +(lift h d t0) (lift h (s (Bind b) d) t1))) (weight_map g t2))) (B_ind +(\lambda (b0: B).(eq nat (match b0 with [Abbr \Rightarrow (S (plus +(weight_map f (lift h d t0)) (weight_map (wadd f (S (weight_map f (lift h d +t0)))) (lift h (S d) t1)))) | Abst \Rightarrow (S (plus (weight_map f (lift h +d t0)) (weight_map (wadd f O) (lift h (S d) t1)))) | Void \Rightarrow (S +(plus (weight_map f (lift h d t0)) (weight_map (wadd f O) (lift h (S d) +t1))))]) (match b0 with [Abbr \Rightarrow (S (plus (weight_map g (lift (S h) +d t0)) (weight_map (wadd g (S (weight_map g (lift (S h) d t0)))) (lift (S h) +(S d) t1)))) | Abst \Rightarrow (S (plus (weight_map g (lift (S h) d t0)) +(weight_map (wadd g O) (lift (S h) (S d) t1)))) | Void \Rightarrow (S (plus +(weight_map g (lift (S h) d t0)) (weight_map (wadd g O) (lift (S h) (S d) +t1))))]))) (f_equal nat nat S (plus (weight_map f (lift h d t0)) (weight_map +(wadd f (S (weight_map f (lift h d t0)))) (lift h (S d) t1))) (plus +(weight_map g (lift (S h) d t0)) (weight_map (wadd g (S (weight_map g (lift +(S h) d t0)))) (lift (S h) (S d) t1))) (f_equal2 nat nat nat plus (weight_map +f (lift h d t0)) (weight_map g (lift (S h) d t0)) (weight_map (wadd f (S +(weight_map f (lift h d t0)))) (lift h (S d) t1)) (weight_map (wadd g (S +(weight_map g (lift (S h) d t0)))) (lift (S h) (S d) t1)) (H h d f g H1 H2 +H3) (H0 h (S d) (wadd f (S (weight_map f (lift h d t0)))) (wadd g (S +(weight_map g (lift (S h) d t0)))) (\lambda (m: nat).(\lambda (H4: (lt m (S +d))).(or_ind (eq nat m O) (ex2 nat (\lambda (m0: nat).(eq nat m (S m0))) +(\lambda (m0: nat).(lt m0 d))) (eq nat (wadd g (S (weight_map g (lift (S h) d +t0))) m) (wadd f (S (weight_map f (lift h d t0))) m)) (\lambda (H5: (eq nat m +O)).(eq_ind_r nat O (\lambda (n: nat).(eq nat (wadd g (S (weight_map g (lift +(S h) d t0))) n) (wadd f (S (weight_map f (lift h d t0))) n))) (f_equal nat +nat S (weight_map g (lift (S h) d t0)) (weight_map f (lift h d t0)) (sym_eq +nat (weight_map f (lift h d t0)) (weight_map g (lift (S h) d t0)) (H h d f g +H1 H2 H3))) m H5)) (\lambda (H5: (ex2 nat (\lambda (m0: nat).(eq nat m (S +m0))) (\lambda (m0: nat).(lt m0 d)))).(ex2_ind nat (\lambda (m0: nat).(eq nat +m (S m0))) (\lambda (m0: nat).(lt m0 d)) (eq nat (wadd g (S (weight_map g +(lift (S h) d t0))) m) (wadd f (S (weight_map f (lift h d t0))) m)) (\lambda +(x: nat).(\lambda (H6: (eq nat m (S x))).(\lambda (H7: (lt x d)).(eq_ind_r +nat (S x) (\lambda (n: nat).(eq nat (wadd g (S (weight_map g (lift (S h) d +t0))) n) (wadd f (S (weight_map f (lift h d t0))) n))) (H1 x H7) m H6)))) +H5)) (lt_gen_xS m d H4)))) H2 (\lambda (m: nat).(\lambda (H4: (le (S d) +m)).(ex2_ind nat (\lambda (n: nat).(eq nat m (S n))) (\lambda (n: nat).(le d +n)) (eq nat (g m) (wadd f (S (weight_map f (lift h d t0))) m)) (\lambda (x: +nat).(\lambda (H5: (eq nat m (S x))).(\lambda (H6: (le d x)).(eq_ind_r nat (S +x) (\lambda (n: nat).(eq nat (g n) (wadd f (S (weight_map f (lift h d t0))) +n))) (H3 x H6) m H5)))) (le_gen_S d m H4))))))) (f_equal nat nat S (plus +(weight_map f (lift h d t0)) (weight_map (wadd f O) (lift h (S d) t1))) (plus +(weight_map g (lift (S h) d t0)) (weight_map (wadd g O) (lift (S h) (S d) +t1))) (f_equal2 nat nat nat plus (weight_map f (lift h d t0)) (weight_map g +(lift (S h) d t0)) (weight_map (wadd f O) (lift h (S d) t1)) (weight_map +(wadd g O) (lift (S h) (S d) t1)) (H h d f g H1 H2 H3) (H0 h (S d) (wadd f O) +(wadd g O) (\lambda (m: nat).(\lambda (H4: (lt m (S d))).(or_ind (eq nat m O) +(ex2 nat (\lambda (m0: nat).(eq nat m (S m0))) (\lambda (m0: nat).(lt m0 d))) +(eq nat (wadd g O m) (wadd f O m)) (\lambda (H5: (eq nat m O)).(eq_ind_r nat +O (\lambda (n: nat).(eq nat (wadd g O n) (wadd f O n))) (refl_equal nat O) m +H5)) (\lambda (H5: (ex2 nat (\lambda (m0: nat).(eq nat m (S m0))) (\lambda +(m0: nat).(lt m0 d)))).(ex2_ind nat (\lambda (m0: nat).(eq nat m (S m0))) +(\lambda (m0: nat).(lt m0 d)) (eq nat (wadd g O m) (wadd f O m)) (\lambda (x: +nat).(\lambda (H6: (eq nat m (S x))).(\lambda (H7: (lt x d)).(eq_ind_r nat (S +x) (\lambda (n: nat).(eq nat (wadd g O n) (wadd f O n))) (H1 x H7) m H6)))) +H5)) (lt_gen_xS m d H4)))) H2 (\lambda (m: nat).(\lambda (H4: (le (S d) +m)).(ex2_ind nat (\lambda (n: nat).(eq nat m (S n))) (\lambda (n: nat).(le d +n)) (eq nat (g m) (wadd f O m)) (\lambda (x: nat).(\lambda (H5: (eq nat m (S +x))).(\lambda (H6: (le d x)).(eq_ind_r nat (S x) (\lambda (n: nat).(eq nat (g +n) (wadd f O n))) (H3 x H6) m H5)))) (le_gen_S d m H4))))))) (f_equal nat nat +S (plus (weight_map f (lift h d t0)) (weight_map (wadd f O) (lift h (S d) +t1))) (plus (weight_map g (lift (S h) d t0)) (weight_map (wadd g O) (lift (S +h) (S d) t1))) (f_equal2 nat nat nat plus (weight_map f (lift h d t0)) +(weight_map g (lift (S h) d t0)) (weight_map (wadd f O) (lift h (S d) t1)) +(weight_map (wadd g O) (lift (S h) (S d) t1)) (H h d f g H1 H2 H3) (H0 h (S +d) (wadd f O) (wadd g O) (\lambda (m: nat).(\lambda (H4: (lt m (S +d))).(or_ind (eq nat m O) (ex2 nat (\lambda (m0: nat).(eq nat m (S m0))) +(\lambda (m0: nat).(lt m0 d))) (eq nat (wadd g O m) (wadd f O m)) (\lambda +(H5: (eq nat m O)).(eq_ind_r nat O (\lambda (n: nat).(eq nat (wadd g O n) +(wadd f O n))) (refl_equal nat O) m H5)) (\lambda (H5: (ex2 nat (\lambda (m0: +nat).(eq nat m (S m0))) (\lambda (m0: nat).(lt m0 d)))).(ex2_ind nat (\lambda +(m0: nat).(eq nat m (S m0))) (\lambda (m0: nat).(lt m0 d)) (eq nat (wadd g O +m) (wadd f O m)) (\lambda (x: nat).(\lambda (H6: (eq nat m (S x))).(\lambda +(H7: (lt x d)).(eq_ind_r nat (S x) (\lambda (n: nat).(eq nat (wadd g O n) +(wadd f O n))) (H1 x H7) m H6)))) H5)) (lt_gen_xS m d H4)))) H2 (\lambda (m: +nat).(\lambda (H4: (le (S d) m)).(ex2_ind nat (\lambda (n: nat).(eq nat m (S +n))) (\lambda (n: nat).(le d n)) (eq nat (g m) (wadd f O m)) (\lambda (x: +nat).(\lambda (H5: (eq nat m (S x))).(\lambda (H6: (le d x)).(eq_ind_r nat (S +x) (\lambda (n: nat).(eq nat (g n) (wadd f O n))) (H3 x H6) m H5)))) +(le_gen_S d m H4))))))) b) (lift (S h) d (THead (Bind b) t0 t1)) (lift_head +(Bind b) t0 t1 (S h) d)) (lift h d (THead (Bind b) t0 t1)) (lift_head (Bind +b) t0 t1 h d))) (\lambda (f0: F).(eq_ind_r T (THead (Flat f0) (lift h d t0) +(lift h (s (Flat f0) d) t1)) (\lambda (t2: T).(eq nat (weight_map f t2) +(weight_map g (lift (S h) d (THead (Flat f0) t0 t1))))) (eq_ind_r T (THead +(Flat f0) (lift (S h) d t0) (lift (S h) (s (Flat f0) d) t1)) (\lambda (t2: +T).(eq nat (weight_map f (THead (Flat f0) (lift h d t0) (lift h (s (Flat f0) +d) t1))) (weight_map g t2))) (f_equal nat nat S (plus (weight_map f (lift h d +t0)) (weight_map f (lift h d t1))) (plus (weight_map g (lift (S h) d t0)) +(weight_map g (lift (S h) d t1))) (f_equal2 nat nat nat plus (weight_map f +(lift h d t0)) (weight_map g (lift (S h) d t0)) (weight_map f (lift h d t1)) +(weight_map g (lift (S h) d t1)) (H h d f g H1 H2 H3) (H0 h d f g H1 H2 H3))) +(lift (S h) d (THead (Flat f0) t0 t1)) (lift_head (Flat f0) t0 t1 (S h) d)) +(lift h d (THead (Flat f0) t0 t1)) (lift_head (Flat f0) t0 t1 h d))) +k))))))))))))) t)). + +theorem lift_weight_add_O: + \forall (w: nat).(\forall (t: T).(\forall (h: nat).(\forall (f: ((nat \to +nat))).(eq nat (weight_map f (lift h O t)) (weight_map (wadd f w) (lift (S h) +O t)))))) +\def + \lambda (w: nat).(\lambda (t: T).(\lambda (h: nat).(\lambda (f: ((nat \to +nat))).(lift_weight_add (plus (wadd f w O) O) t h O f (wadd f w) (\lambda (m: +nat).(\lambda (H: (lt m O)).(let H0 \def (match H in le return (\lambda (n: +nat).(\lambda (_: (le ? n)).((eq nat n O) \to (eq nat (wadd f w m) (f m))))) +with [le_n \Rightarrow (\lambda (H0: (eq nat (S m) O)).(let H1 \def (eq_ind +nat (S m) (\lambda (e: nat).(match e in nat return (\lambda (_: nat).Prop) +with [O \Rightarrow False | (S _) \Rightarrow True])) I O H0) in (False_ind +(eq nat (wadd f w m) (f m)) H1))) | (le_S m0 H0) \Rightarrow (\lambda (H1: +(eq nat (S m0) O)).((let H2 \def (eq_ind nat (S m0) (\lambda (e: nat).(match +e in nat return (\lambda (_: nat).Prop) with [O \Rightarrow False | (S _) +\Rightarrow True])) I O H1) in (False_ind ((le (S m) m0) \to (eq nat (wadd f +w m) (f m))) H2)) H0))]) in (H0 (refl_equal nat O))))) (plus_n_O (wadd f w +O)) (\lambda (m: nat).(\lambda (_: (le O m)).(refl_equal nat (f m)))))))). + +theorem lift_tlt_dx: + \forall (k: K).(\forall (u: T).(\forall (t: T).(\forall (h: nat).(\forall +(d: nat).(tlt t (THead k u (lift h d t))))))) +\def + \lambda (k: K).(\lambda (u: T).(\lambda (t: T).(\lambda (h: nat).(\lambda +(d: nat).(eq_ind nat (weight (lift h d t)) (\lambda (n: nat).(lt n (weight +(THead k u (lift h d t))))) (tlt_head_dx k u (lift h d t)) (weight t) +(lift_weight t h d)))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/defs.ma new file mode 100644 index 000000000..4042efeee --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/defs.ma @@ -0,0 +1,42 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/lift1/defs". + +include "lift/defs.ma". + +definition trans: + PList \to (nat \to nat) +\def + let rec trans (hds: PList) on hds: (nat \to nat) \def (\lambda (i: +nat).(match hds with [PNil \Rightarrow i | (PCons h d hds0) \Rightarrow (let +j \def (trans hds0 i) in (match (blt j d) with [true \Rightarrow j | false +\Rightarrow (plus j h)]))])) in trans. + +definition lift1: + PList \to (T \to T) +\def + let rec lift1 (hds: PList) on hds: (T \to T) \def (\lambda (t: T).(match hds +with [PNil \Rightarrow t | (PCons h d hds0) \Rightarrow (lift h d (lift1 hds0 +t))])) in lift1. + +definition lifts1: + PList \to (TList \to TList) +\def + let rec lifts1 (hds: PList) (ts: TList) on ts: TList \def (match ts with +[TNil \Rightarrow TNil | (TCons t ts0) \Rightarrow (TCons (lift1 hds t) +(lifts1 hds ts0))]) in lifts1. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/fwd.ma new file mode 100644 index 000000000..bbdef6d1f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/fwd.ma @@ -0,0 +1,142 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/lift1/fwd". + +include "lift1/defs.ma". + +include "lift/fwd.ma". + +theorem lift1_sort: + \forall (n: nat).(\forall (is: PList).(eq T (lift1 is (TSort n)) (TSort n))) +\def + \lambda (n: nat).(\lambda (is: PList).(PList_ind (\lambda (p: PList).(eq T +(lift1 p (TSort n)) (TSort n))) (refl_equal T (TSort n)) (\lambda (n0: +nat).(\lambda (n1: nat).(\lambda (p: PList).(\lambda (H: (eq T (lift1 p +(TSort n)) (TSort n))).(eq_ind_r T (TSort n) (\lambda (t: T).(eq T (lift n0 +n1 t) (TSort n))) (refl_equal T (TSort n)) (lift1 p (TSort n)) H))))) is)). + +theorem lift1_lref: + \forall (hds: PList).(\forall (i: nat).(eq T (lift1 hds (TLRef i)) (TLRef +(trans hds i)))) +\def + \lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall (i: nat).(eq T +(lift1 p (TLRef i)) (TLRef (trans p i))))) (\lambda (i: nat).(refl_equal T +(TLRef i))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda (p: PList).(\lambda +(H: ((\forall (i: nat).(eq T (lift1 p (TLRef i)) (TLRef (trans p +i)))))).(\lambda (i: nat).(eq_ind_r T (TLRef (trans p i)) (\lambda (t: T).(eq +T (lift n n0 t) (TLRef (match (blt (trans p i) n0) with [true \Rightarrow +(trans p i) | false \Rightarrow (plus (trans p i) n)])))) (refl_equal T +(TLRef (match (blt (trans p i) n0) with [true \Rightarrow (trans p i) | false +\Rightarrow (plus (trans p i) n)]))) (lift1 p (TLRef i)) (H i))))))) hds). + +theorem lift1_bind: + \forall (b: B).(\forall (hds: PList).(\forall (u: T).(\forall (t: T).(eq T +(lift1 hds (THead (Bind b) u t)) (THead (Bind b) (lift1 hds u) (lift1 (Ss +hds) t)))))) +\def + \lambda (b: B).(\lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall +(u: T).(\forall (t: T).(eq T (lift1 p (THead (Bind b) u t)) (THead (Bind b) +(lift1 p u) (lift1 (Ss p) t)))))) (\lambda (u: T).(\lambda (t: T).(refl_equal +T (THead (Bind b) u t)))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda (p: +PList).(\lambda (H: ((\forall (u: T).(\forall (t: T).(eq T (lift1 p (THead +(Bind b) u t)) (THead (Bind b) (lift1 p u) (lift1 (Ss p) t))))))).(\lambda +(u: T).(\lambda (t: T).(eq_ind_r T (THead (Bind b) (lift1 p u) (lift1 (Ss p) +t)) (\lambda (t0: T).(eq T (lift n n0 t0) (THead (Bind b) (lift n n0 (lift1 p +u)) (lift n (S n0) (lift1 (Ss p) t))))) (eq_ind_r T (THead (Bind b) (lift n +n0 (lift1 p u)) (lift n (S n0) (lift1 (Ss p) t))) (\lambda (t0: T).(eq T t0 +(THead (Bind b) (lift n n0 (lift1 p u)) (lift n (S n0) (lift1 (Ss p) t))))) +(refl_equal T (THead (Bind b) (lift n n0 (lift1 p u)) (lift n (S n0) (lift1 +(Ss p) t)))) (lift n n0 (THead (Bind b) (lift1 p u) (lift1 (Ss p) t))) +(lift_bind b (lift1 p u) (lift1 (Ss p) t) n n0)) (lift1 p (THead (Bind b) u +t)) (H u t)))))))) hds)). + +theorem lift1_flat: + \forall (f: F).(\forall (hds: PList).(\forall (u: T).(\forall (t: T).(eq T +(lift1 hds (THead (Flat f) u t)) (THead (Flat f) (lift1 hds u) (lift1 hds +t)))))) +\def + \lambda (f: F).(\lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall +(u: T).(\forall (t: T).(eq T (lift1 p (THead (Flat f) u t)) (THead (Flat f) +(lift1 p u) (lift1 p t)))))) (\lambda (u: T).(\lambda (t: T).(refl_equal T +(THead (Flat f) u t)))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda (p: +PList).(\lambda (H: ((\forall (u: T).(\forall (t: T).(eq T (lift1 p (THead +(Flat f) u t)) (THead (Flat f) (lift1 p u) (lift1 p t))))))).(\lambda (u: +T).(\lambda (t: T).(eq_ind_r T (THead (Flat f) (lift1 p u) (lift1 p t)) +(\lambda (t0: T).(eq T (lift n n0 t0) (THead (Flat f) (lift n n0 (lift1 p u)) +(lift n n0 (lift1 p t))))) (eq_ind_r T (THead (Flat f) (lift n n0 (lift1 p +u)) (lift n n0 (lift1 p t))) (\lambda (t0: T).(eq T t0 (THead (Flat f) (lift +n n0 (lift1 p u)) (lift n n0 (lift1 p t))))) (refl_equal T (THead (Flat f) +(lift n n0 (lift1 p u)) (lift n n0 (lift1 p t)))) (lift n n0 (THead (Flat f) +(lift1 p u) (lift1 p t))) (lift_flat f (lift1 p u) (lift1 p t) n n0)) (lift1 +p (THead (Flat f) u t)) (H u t)))))))) hds)). + +theorem lift1_cons_tail: + \forall (t: T).(\forall (h: nat).(\forall (d: nat).(\forall (hds: PList).(eq +T (lift1 (PConsTail hds h d) t) (lift1 hds (lift h d t)))))) +\def + \lambda (t: T).(\lambda (h: nat).(\lambda (d: nat).(\lambda (hds: +PList).(PList_ind (\lambda (p: PList).(eq T (lift1 (PConsTail p h d) t) +(lift1 p (lift h d t)))) (refl_equal T (lift h d t)) (\lambda (n: +nat).(\lambda (n0: nat).(\lambda (p: PList).(\lambda (H: (eq T (lift1 +(PConsTail p h d) t) (lift1 p (lift h d t)))).(eq_ind_r T (lift1 p (lift h d +t)) (\lambda (t0: T).(eq T (lift n n0 t0) (lift n n0 (lift1 p (lift h d +t))))) (refl_equal T (lift n n0 (lift1 p (lift h d t)))) (lift1 (PConsTail p +h d) t) H))))) hds)))). + +theorem lifts1_flat: + \forall (f: F).(\forall (hds: PList).(\forall (t: T).(\forall (ts: +TList).(eq T (lift1 hds (THeads (Flat f) ts t)) (THeads (Flat f) (lifts1 hds +ts) (lift1 hds t)))))) +\def + \lambda (f: F).(\lambda (hds: PList).(\lambda (t: T).(\lambda (ts: +TList).(TList_ind (\lambda (t0: TList).(eq T (lift1 hds (THeads (Flat f) t0 +t)) (THeads (Flat f) (lifts1 hds t0) (lift1 hds t)))) (refl_equal T (lift1 +hds t)) (\lambda (t0: T).(\lambda (t1: TList).(\lambda (H: (eq T (lift1 hds +(THeads (Flat f) t1 t)) (THeads (Flat f) (lifts1 hds t1) (lift1 hds +t)))).(eq_ind_r T (THead (Flat f) (lift1 hds t0) (lift1 hds (THeads (Flat f) +t1 t))) (\lambda (t2: T).(eq T t2 (THead (Flat f) (lift1 hds t0) (THeads +(Flat f) (lifts1 hds t1) (lift1 hds t))))) (eq_ind_r T (THeads (Flat f) +(lifts1 hds t1) (lift1 hds t)) (\lambda (t2: T).(eq T (THead (Flat f) (lift1 +hds t0) t2) (THead (Flat f) (lift1 hds t0) (THeads (Flat f) (lifts1 hds t1) +(lift1 hds t))))) (refl_equal T (THead (Flat f) (lift1 hds t0) (THeads (Flat +f) (lifts1 hds t1) (lift1 hds t)))) (lift1 hds (THeads (Flat f) t1 t)) H) +(lift1 hds (THead (Flat f) t0 (THeads (Flat f) t1 t))) (lift1_flat f hds t0 +(THeads (Flat f) t1 t)))))) ts)))). + +theorem lifts1_nil: + \forall (ts: TList).(eq TList (lifts1 PNil ts) ts) +\def + \lambda (ts: TList).(TList_ind (\lambda (t: TList).(eq TList (lifts1 PNil t) +t)) (refl_equal TList TNil) (\lambda (t: T).(\lambda (t0: TList).(\lambda (H: +(eq TList (lifts1 PNil t0) t0)).(eq_ind_r TList t0 (\lambda (t1: TList).(eq +TList (TCons t t1) (TCons t t0))) (refl_equal TList (TCons t t0)) (lifts1 +PNil t0) H)))) ts). + +theorem lifts1_cons: + \forall (h: nat).(\forall (d: nat).(\forall (hds: PList).(\forall (ts: +TList).(eq TList (lifts1 (PCons h d hds) ts) (lifts h d (lifts1 hds ts)))))) +\def + \lambda (h: nat).(\lambda (d: nat).(\lambda (hds: PList).(\lambda (ts: +TList).(TList_ind (\lambda (t: TList).(eq TList (lifts1 (PCons h d hds) t) +(lifts h d (lifts1 hds t)))) (refl_equal TList TNil) (\lambda (t: T).(\lambda +(t0: TList).(\lambda (H: (eq TList (lifts1 (PCons h d hds) t0) (lifts h d +(lifts1 hds t0)))).(eq_ind_r TList (lifts h d (lifts1 hds t0)) (\lambda (t1: +TList).(eq TList (TCons (lift h d (lift1 hds t)) t1) (TCons (lift h d (lift1 +hds t)) (lifts h d (lifts1 hds t0))))) (refl_equal TList (TCons (lift h d +(lift1 hds t)) (lifts h d (lifts1 hds t0)))) (lifts1 (PCons h d hds) t0) +H)))) ts)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/props.ma new file mode 100644 index 000000000..db5d76536 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/props.ma @@ -0,0 +1,131 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/lift1/props". + +include "lift1/defs.ma". + +include "lift/props.ma". + +include "drop1/defs.ma". + +theorem lift1_lift1: + \forall (is1: PList).(\forall (is2: PList).(\forall (t: T).(eq T (lift1 is1 +(lift1 is2 t)) (lift1 (papp is1 is2) t)))) +\def + \lambda (is1: PList).(PList_ind (\lambda (p: PList).(\forall (is2: +PList).(\forall (t: T).(eq T (lift1 p (lift1 is2 t)) (lift1 (papp p is2) +t))))) (\lambda (is2: PList).(\lambda (t: T).(refl_equal T (lift1 is2 t)))) +(\lambda (n: nat).(\lambda (n0: nat).(\lambda (p: PList).(\lambda (H: +((\forall (is2: PList).(\forall (t: T).(eq T (lift1 p (lift1 is2 t)) (lift1 +(papp p is2) t)))))).(\lambda (is2: PList).(\lambda (t: T).(f_equal3 nat nat +T T lift n n n0 n0 (lift1 p (lift1 is2 t)) (lift1 (papp p is2) t) (refl_equal +nat n) (refl_equal nat n0) (H is2 t)))))))) is1). + +theorem lift1_xhg: + \forall (hds: PList).(\forall (t: T).(eq T (lift1 (Ss hds) (lift (S O) O t)) +(lift (S O) O (lift1 hds t)))) +\def + \lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall (t: T).(eq T +(lift1 (Ss p) (lift (S O) O t)) (lift (S O) O (lift1 p t))))) (\lambda (t: +T).(refl_equal T (lift (S O) O t))) (\lambda (h: nat).(\lambda (d: +nat).(\lambda (p: PList).(\lambda (H: ((\forall (t: T).(eq T (lift1 (Ss p) +(lift (S O) O t)) (lift (S O) O (lift1 p t)))))).(\lambda (t: T).(eq_ind_r T +(lift (S O) O (lift1 p t)) (\lambda (t0: T).(eq T (lift h (S d) t0) (lift (S +O) O (lift h d (lift1 p t))))) (eq_ind nat (plus (S O) d) (\lambda (n: +nat).(eq T (lift h n (lift (S O) O (lift1 p t))) (lift (S O) O (lift h d +(lift1 p t))))) (eq_ind_r T (lift (S O) O (lift h d (lift1 p t))) (\lambda +(t0: T).(eq T t0 (lift (S O) O (lift h d (lift1 p t))))) (refl_equal T (lift +(S O) O (lift h d (lift1 p t)))) (lift h (plus (S O) d) (lift (S O) O (lift1 +p t))) (lift_d (lift1 p t) h (S O) d O (le_O_n d))) (S d) (refl_equal nat (S +d))) (lift1 (Ss p) (lift (S O) O t)) (H t))))))) hds). + +theorem lifts1_xhg: + \forall (hds: PList).(\forall (ts: TList).(eq TList (lifts1 (Ss hds) (lifts +(S O) O ts)) (lifts (S O) O (lifts1 hds ts)))) +\def + \lambda (hds: PList).(\lambda (ts: TList).(TList_ind (\lambda (t: TList).(eq +TList (lifts1 (Ss hds) (lifts (S O) O t)) (lifts (S O) O (lifts1 hds t)))) +(refl_equal TList TNil) (\lambda (t: T).(\lambda (t0: TList).(\lambda (H: (eq +TList (lifts1 (Ss hds) (lifts (S O) O t0)) (lifts (S O) O (lifts1 hds +t0)))).(eq_ind_r T (lift (S O) O (lift1 hds t)) (\lambda (t1: T).(eq TList +(TCons t1 (lifts1 (Ss hds) (lifts (S O) O t0))) (TCons (lift (S O) O (lift1 +hds t)) (lifts (S O) O (lifts1 hds t0))))) (eq_ind_r TList (lifts (S O) O +(lifts1 hds t0)) (\lambda (t1: TList).(eq TList (TCons (lift (S O) O (lift1 +hds t)) t1) (TCons (lift (S O) O (lift1 hds t)) (lifts (S O) O (lifts1 hds +t0))))) (refl_equal TList (TCons (lift (S O) O (lift1 hds t)) (lifts (S O) O +(lifts1 hds t0)))) (lifts1 (Ss hds) (lifts (S O) O t0)) H) (lift1 (Ss hds) +(lift (S O) O t)) (lift1_xhg hds t))))) ts)). + +theorem lift1_free: + \forall (hds: PList).(\forall (i: nat).(\forall (t: T).(eq T (lift1 hds +(lift (S i) O t)) (lift (S (trans hds i)) O (lift1 (ptrans hds i) t))))) +\def + \lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall (i: +nat).(\forall (t: T).(eq T (lift1 p (lift (S i) O t)) (lift (S (trans p i)) O +(lift1 (ptrans p i) t)))))) (\lambda (i: nat).(\lambda (t: T).(refl_equal T +(lift (S i) O t)))) (\lambda (h: nat).(\lambda (d: nat).(\lambda (hds0: +PList).(\lambda (H: ((\forall (i: nat).(\forall (t: T).(eq T (lift1 hds0 +(lift (S i) O t)) (lift (S (trans hds0 i)) O (lift1 (ptrans hds0 i) +t))))))).(\lambda (i: nat).(\lambda (t: T).(eq_ind_r T (lift (S (trans hds0 +i)) O (lift1 (ptrans hds0 i) t)) (\lambda (t0: T).(eq T (lift h d t0) (lift +(S (match (blt (trans hds0 i) d) with [true \Rightarrow (trans hds0 i) | +false \Rightarrow (plus (trans hds0 i) h)])) O (lift1 (match (blt (trans hds0 +i) d) with [true \Rightarrow (PCons h (minus d (S (trans hds0 i))) (ptrans +hds0 i)) | false \Rightarrow (ptrans hds0 i)]) t)))) (xinduction bool (blt +(trans hds0 i) d) (\lambda (b: bool).(eq T (lift h d (lift (S (trans hds0 i)) +O (lift1 (ptrans hds0 i) t))) (lift (S (match b with [true \Rightarrow (trans +hds0 i) | false \Rightarrow (plus (trans hds0 i) h)])) O (lift1 (match b with +[true \Rightarrow (PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) | +false \Rightarrow (ptrans hds0 i)]) t)))) (\lambda (x_x: bool).(bool_ind +(\lambda (b: bool).((eq bool (blt (trans hds0 i) d) b) \to (eq T (lift h d +(lift (S (trans hds0 i)) O (lift1 (ptrans hds0 i) t))) (lift (S (match b with +[true \Rightarrow (trans hds0 i) | false \Rightarrow (plus (trans hds0 i) +h)])) O (lift1 (match b with [true \Rightarrow (PCons h (minus d (S (trans +hds0 i))) (ptrans hds0 i)) | false \Rightarrow (ptrans hds0 i)]) t))))) +(\lambda (H0: (eq bool (blt (trans hds0 i) d) true)).(eq_ind_r nat (plus (S +(trans hds0 i)) (minus d (S (trans hds0 i)))) (\lambda (n: nat).(eq T (lift h +n (lift (S (trans hds0 i)) O (lift1 (ptrans hds0 i) t))) (lift (S (trans hds0 +i)) O (lift1 (PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) t)))) +(eq_ind_r T (lift (S (trans hds0 i)) O (lift h (minus d (S (trans hds0 i))) +(lift1 (ptrans hds0 i) t))) (\lambda (t0: T).(eq T t0 (lift (S (trans hds0 +i)) O (lift1 (PCons h (minus d (S (trans hds0 i))) (ptrans hds0 i)) t)))) +(refl_equal T (lift (S (trans hds0 i)) O (lift1 (PCons h (minus d (S (trans +hds0 i))) (ptrans hds0 i)) t))) (lift h (plus (S (trans hds0 i)) (minus d (S +(trans hds0 i)))) (lift (S (trans hds0 i)) O (lift1 (ptrans hds0 i) t))) +(lift_d (lift1 (ptrans hds0 i) t) h (S (trans hds0 i)) (minus d (S (trans +hds0 i))) O (le_O_n (minus d (S (trans hds0 i)))))) d (le_plus_minus (S +(trans hds0 i)) d (bge_le (S (trans hds0 i)) d (le_bge (S (trans hds0 i)) d +(lt_le_S (trans hds0 i) d (blt_lt d (trans hds0 i) H0))))))) (\lambda (H0: +(eq bool (blt (trans hds0 i) d) false)).(eq_ind_r T (lift (plus h (S (trans +hds0 i))) O (lift1 (ptrans hds0 i) t)) (\lambda (t0: T).(eq T t0 (lift (S +(plus (trans hds0 i) h)) O (lift1 (ptrans hds0 i) t)))) (eq_ind nat (S (plus +h (trans hds0 i))) (\lambda (n: nat).(eq T (lift n O (lift1 (ptrans hds0 i) +t)) (lift (S (plus (trans hds0 i) h)) O (lift1 (ptrans hds0 i) t)))) +(eq_ind_r nat (plus (trans hds0 i) h) (\lambda (n: nat).(eq T (lift (S n) O +(lift1 (ptrans hds0 i) t)) (lift (S (plus (trans hds0 i) h)) O (lift1 (ptrans +hds0 i) t)))) (refl_equal T (lift (S (plus (trans hds0 i) h)) O (lift1 +(ptrans hds0 i) t))) (plus h (trans hds0 i)) (plus_comm h (trans hds0 i))) +(plus h (S (trans hds0 i))) (plus_n_Sm h (trans hds0 i))) (lift h d (lift (S +(trans hds0 i)) O (lift1 (ptrans hds0 i) t))) (lift_free (lift1 (ptrans hds0 +i) t) (S (trans hds0 i)) h O d (eq_ind nat (S (plus O (trans hds0 i))) +(\lambda (n: nat).(le d n)) (eq_ind_r nat (plus (trans hds0 i) O) (\lambda +(n: nat).(le d (S n))) (le_S d (plus (trans hds0 i) O) (le_plus_trans d +(trans hds0 i) O (bge_le d (trans hds0 i) H0))) (plus O (trans hds0 i)) +(plus_comm O (trans hds0 i))) (plus O (S (trans hds0 i))) (plus_n_Sm O (trans +hds0 i))) (le_O_n d)))) x_x))) (lift1 hds0 (lift (S i) O t)) (H i t)))))))) +hds). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/defs.ma new file mode 100644 index 000000000..19ef14486 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/defs.ma @@ -0,0 +1,32 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/llt/defs". + +include "A/defs.ma". + +definition lweight: + A \to nat +\def + let rec lweight (a: A) on a: nat \def (match a with [(ASort _ _) \Rightarrow +O | (AHead a1 a2) \Rightarrow (S (plus (lweight a1) (lweight a2)))]) in +lweight. + +definition llt: + A \to (A \to Prop) +\def + \lambda (a1: A).(\lambda (a2: A).(lt (lweight a1) (lweight a2))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/props.ma new file mode 100644 index 000000000..d34488300 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/props.ma @@ -0,0 +1,95 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/llt/props". + +include "llt/defs.ma". + +include "leq/defs.ma". + +theorem lweight_repl: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((leq g a1 a2) \to (eq nat +(lweight a1) (lweight a2))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (H: (leq g a1 +a2)).(leq_ind g (\lambda (a: A).(\lambda (a0: A).(eq nat (lweight a) (lweight +a0)))) (\lambda (h1: nat).(\lambda (h2: nat).(\lambda (n1: nat).(\lambda (n2: +nat).(\lambda (k: nat).(\lambda (_: (eq A (aplus g (ASort h1 n1) k) (aplus g +(ASort h2 n2) k))).(refl_equal nat O))))))) (\lambda (a0: A).(\lambda (a3: +A).(\lambda (_: (leq g a0 a3)).(\lambda (H1: (eq nat (lweight a0) (lweight +a3))).(\lambda (a4: A).(\lambda (a5: A).(\lambda (_: (leq g a4 a5)).(\lambda +(H3: (eq nat (lweight a4) (lweight a5))).(f_equal nat nat S (plus (lweight +a0) (lweight a4)) (plus (lweight a3) (lweight a5)) (f_equal2 nat nat nat plus +(lweight a0) (lweight a3) (lweight a4) (lweight a5) H1 H3)))))))))) a1 a2 +H)))). + +theorem llt_repl: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).((leq g a1 a2) \to (\forall +(a3: A).((llt a1 a3) \to (llt a2 a3)))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(\lambda (H: (leq g a1 +a2)).(\lambda (a3: A).(\lambda (H0: (lt (lweight a1) (lweight a3))).(let H1 +\def (eq_ind nat (lweight a1) (\lambda (n: nat).(lt n (lweight a3))) H0 +(lweight a2) (lweight_repl g a1 a2 H)) in H1)))))). + +theorem llt_trans: + \forall (a1: A).(\forall (a2: A).(\forall (a3: A).((llt a1 a2) \to ((llt a2 +a3) \to (llt a1 a3))))) +\def + \lambda (a1: A).(\lambda (a2: A).(\lambda (a3: A).(\lambda (H: (lt (lweight +a1) (lweight a2))).(\lambda (H0: (lt (lweight a2) (lweight a3))).(lt_trans +(lweight a1) (lweight a2) (lweight a3) H H0))))). + +theorem llt_head_sx: + \forall (a1: A).(\forall (a2: A).(llt a1 (AHead a1 a2))) +\def + \lambda (a1: A).(\lambda (a2: A).(le_n_S (lweight a1) (plus (lweight a1) +(lweight a2)) (le_plus_l (lweight a1) (lweight a2)))). + +theorem llt_head_dx: + \forall (a1: A).(\forall (a2: A).(llt a2 (AHead a1 a2))) +\def + \lambda (a1: A).(\lambda (a2: A).(le_n_S (lweight a2) (plus (lweight a1) +(lweight a2)) (le_plus_r (lweight a1) (lweight a2)))). + +theorem llt_wf__q_ind: + \forall (P: ((A \to Prop))).(((\forall (n: nat).((\lambda (P0: ((A \to +Prop))).(\lambda (n0: nat).(\forall (a: A).((eq nat (lweight a) n0) \to (P0 +a))))) P n))) \to (\forall (a: A).(P a))) +\def + let Q \def (\lambda (P: ((A \to Prop))).(\lambda (n: nat).(\forall (a: +A).((eq nat (lweight a) n) \to (P a))))) in (\lambda (P: ((A \to +Prop))).(\lambda (H: ((\forall (n: nat).(\forall (a: A).((eq nat (lweight a) +n) \to (P a)))))).(\lambda (a: A).(H (lweight a) a (refl_equal nat (lweight +a)))))). + +theorem llt_wf_ind: + \forall (P: ((A \to Prop))).(((\forall (a2: A).(((\forall (a1: A).((llt a1 +a2) \to (P a1)))) \to (P a2)))) \to (\forall (a: A).(P a))) +\def + let Q \def (\lambda (P: ((A \to Prop))).(\lambda (n: nat).(\forall (a: +A).((eq nat (lweight a) n) \to (P a))))) in (\lambda (P: ((A \to +Prop))).(\lambda (H: ((\forall (a2: A).(((\forall (a1: A).((lt (lweight a1) +(lweight a2)) \to (P a1)))) \to (P a2))))).(\lambda (a: A).(llt_wf__q_ind +(\lambda (a0: A).(P a0)) (\lambda (n: nat).(lt_wf_ind n (Q (\lambda (a0: +A).(P a0))) (\lambda (n0: nat).(\lambda (H0: ((\forall (m: nat).((lt m n0) +\to (Q (\lambda (a0: A).(P a0)) m))))).(\lambda (a0: A).(\lambda (H1: (eq nat +(lweight a0) n0)).(let H2 \def (eq_ind_r nat n0 (\lambda (n1: nat).(\forall +(m: nat).((lt m n1) \to (\forall (a1: A).((eq nat (lweight a1) m) \to (P +a1)))))) H0 (lweight a0) H1) in (H a0 (\lambda (a1: A).(\lambda (H3: (lt +(lweight a1) (lweight a0))).(H2 (lweight a1) H3 a1 (refl_equal nat (lweight +a1))))))))))))) a)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/makefile b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/makefile new file mode 100644 index 000000000..8f20b3276 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/makefile @@ -0,0 +1,39 @@ +H=@ + +RT_BASEDIR=../../../ +OPTIONS=-bench -onepass -system +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/defs.ma new file mode 100644 index 000000000..1764e8610 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/defs.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/next_plus/defs". + +include "G/defs.ma". + +definition next_plus: + G \to (nat \to (nat \to nat)) +\def + let rec next_plus (g: G) (n: nat) (i: nat) on i: nat \def (match i with [O +\Rightarrow n | (S i0) \Rightarrow (next g (next_plus g n i0))]) in next_plus. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/props.ma new file mode 100644 index 000000000..e0f2654ac --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/props.ma @@ -0,0 +1,61 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/next_plus/props". + +include "next_plus/defs.ma". + +theorem next_plus_assoc: + \forall (g: G).(\forall (n: nat).(\forall (h1: nat).(\forall (h2: nat).(eq +nat (next_plus g (next_plus g n h1) h2) (next_plus g n (plus h1 h2)))))) +\def + \lambda (g: G).(\lambda (n: nat).(\lambda (h1: nat).(nat_ind (\lambda (n0: +nat).(\forall (h2: nat).(eq nat (next_plus g (next_plus g n n0) h2) +(next_plus g n (plus n0 h2))))) (\lambda (h2: nat).(refl_equal nat (next_plus +g n h2))) (\lambda (n0: nat).(\lambda (_: ((\forall (h2: nat).(eq nat +(next_plus g (next_plus g n n0) h2) (next_plus g n (plus n0 h2)))))).(\lambda +(h2: nat).(nat_ind (\lambda (n1: nat).(eq nat (next_plus g (next g (next_plus +g n n0)) n1) (next g (next_plus g n (plus n0 n1))))) (eq_ind nat n0 (\lambda +(n1: nat).(eq nat (next g (next_plus g n n0)) (next g (next_plus g n n1)))) +(refl_equal nat (next g (next_plus g n n0))) (plus n0 O) (plus_n_O n0)) +(\lambda (n1: nat).(\lambda (H0: (eq nat (next_plus g (next g (next_plus g n +n0)) n1) (next g (next_plus g n (plus n0 n1))))).(eq_ind nat (S (plus n0 n1)) +(\lambda (n2: nat).(eq nat (next g (next_plus g (next g (next_plus g n n0)) +n1)) (next g (next_plus g n n2)))) (f_equal nat nat (next g) (next_plus g +(next g (next_plus g n n0)) n1) (next g (next_plus g n (plus n0 n1))) H0) +(plus n0 (S n1)) (plus_n_Sm n0 n1)))) h2)))) h1))). + +theorem next_plus_next: + \forall (g: G).(\forall (n: nat).(\forall (h: nat).(eq nat (next_plus g +(next g n) h) (next g (next_plus g n h))))) +\def + \lambda (g: G).(\lambda (n: nat).(\lambda (h: nat).(eq_ind_r nat (next_plus +g n (plus (S O) h)) (\lambda (n0: nat).(eq nat n0 (next g (next_plus g n +h)))) (refl_equal nat (next g (next_plus g n h))) (next_plus g (next_plus g n +(S O)) h) (next_plus_assoc g n (S O) h)))). + +theorem next_plus_lt: + \forall (g: G).(\forall (h: nat).(\forall (n: nat).(lt n (next_plus g (next +g n) h)))) +\def + \lambda (g: G).(\lambda (h: nat).(nat_ind (\lambda (n: nat).(\forall (n0: +nat).(lt n0 (next_plus g (next g n0) n)))) (\lambda (n: nat).(next_lt g n)) +(\lambda (n: nat).(\lambda (H: ((\forall (n0: nat).(lt n0 (next_plus g (next +g n0) n))))).(\lambda (n0: nat).(eq_ind nat (next_plus g (next g (next g n0)) +n) (\lambda (n1: nat).(lt n0 n1)) (lt_trans n0 (next g n0) (next_plus g (next +g (next g n0)) n) (next_lt g n0) (H (next g n0))) (next g (next_plus g (next +g n0) n)) (next_plus_next g (next g n0) n))))) h)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/arity.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/arity.ma new file mode 100644 index 000000000..d67f67282 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/arity.ma @@ -0,0 +1,534 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/nf2/arity". + +include "nf2/fwd.ma". + +include "arity/subst0.ma". + +theorem arity_nf2_inv_all: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (a: A).((arity g c t +a) \to ((nf2 c t) \to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u: T).(eq T t +(THead (Bind Abst) w u)))) (\lambda (w: T).(\lambda (_: T).(nf2 c w))) +(\lambda (w: T).(\lambda (u: T).(nf2 (CHead c (Bind Abst) w) u)))) (ex nat +(\lambda (n: nat).(eq T t (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c t a)).(arity_ind g (\lambda (c0: C).(\lambda (t0: T).(\lambda (_: +A).((nf2 c0 t0) \to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u: T).(eq T t0 +(THead (Bind Abst) w u)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) +(\lambda (w: T).(\lambda (u: T).(nf2 (CHead c0 (Bind Abst) w) u)))) (ex nat +(\lambda (n: nat).(eq T t0 (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))))))) (\lambda (c0: C).(\lambda +(n: nat).(\lambda (_: (nf2 c0 (TSort n))).(or3_intro1 (ex3_2 T T (\lambda (w: +T).(\lambda (u: T).(eq T (TSort n) (THead (Bind Abst) w u)))) (\lambda (w: +T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 (CHead +c0 (Bind Abst) w) u)))) (ex nat (\lambda (n0: nat).(eq T (TSort n) (TSort +n0)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (TSort +n) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))) (ex_intro nat (\lambda (n0: nat).(eq T (TSort n) (TSort n0))) n +(refl_equal T (TSort n))))))) (\lambda (c0: C).(\lambda (d: C).(\lambda (u: +T).(\lambda (i: nat).(\lambda (H0: (getl i c0 (CHead d (Bind Abbr) +u))).(\lambda (a0: A).(\lambda (_: (arity g d u a0)).(\lambda (_: (((nf2 d u) +\to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T u (THead (Bind +Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 d w))) (\lambda (w: +T).(\lambda (u0: T).(nf2 (CHead d (Bind Abst) w) u0)))) (ex nat (\lambda (n: +nat).(eq T u (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i0: +nat).(eq T u (THeads (Flat Appl) ws (TLRef i0))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 d ws))) (\lambda (_: TList).(\lambda (i0: +nat).(nf2 d (TLRef i0))))))))).(\lambda (H3: (nf2 c0 (TLRef +i))).(nf2_gen_lref c0 d u i H0 H3 (or3 (ex3_2 T T (\lambda (w: T).(\lambda +(u0: T).(eq T (TLRef i) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda +(_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind +Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (TLRef i) (TSort n)))) (ex3_2 +TList nat (\lambda (ws: TList).(\lambda (i0: nat).(eq T (TLRef i) (THeads +(Flat Appl) ws (TLRef i0))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 +ws))) (\lambda (_: TList).(\lambda (i0: nat).(nf2 c0 (TLRef +i0)))))))))))))))) (\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda +(i: nat).(\lambda (_: (getl i c0 (CHead d (Bind Abst) u))).(\lambda (a0: +A).(\lambda (_: (arity g d u (asucc g a0))).(\lambda (_: (((nf2 d u) \to (or3 +(ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T u (THead (Bind Abst) w +u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 d w))) (\lambda (w: T).(\lambda +(u0: T).(nf2 (CHead d (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T u +(TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i0: nat).(eq T u +(THeads (Flat Appl) ws (TLRef i0))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 d ws))) (\lambda (_: TList).(\lambda (i0: nat).(nf2 d (TLRef +i0))))))))).(\lambda (H3: (nf2 c0 (TLRef i))).(or3_intro2 (ex3_2 T T (\lambda +(w: T).(\lambda (u0: T).(eq T (TLRef i) (THead (Bind Abst) w u0)))) (\lambda +(w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 +(CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (TLRef i) +(TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i0: nat).(eq T +(TLRef i) (THeads (Flat Appl) ws (TLRef i0))))) (\lambda (ws: TList).(\lambda +(_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i0: nat).(nf2 c0 (TLRef +i0))))) (ex3_2_intro TList nat (\lambda (ws: TList).(\lambda (i0: nat).(eq T +(TLRef i) (THeads (Flat Appl) ws (TLRef i0))))) (\lambda (ws: TList).(\lambda +(_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i0: nat).(nf2 c0 (TLRef +i0)))) TNil i (refl_equal T (TLRef i)) I H3))))))))))) (\lambda (b: +B).(\lambda (H0: (not (eq B b Abst))).(\lambda (c0: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c0 u a1)).(\lambda (_: (((nf2 c0 u) +\to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T u (THead (Bind +Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: +T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: +nat).(eq T u (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: +nat).(eq T u (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i))))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda +(H3: (arity g (CHead c0 (Bind b) u) t0 a2)).(\lambda (_: (((nf2 (CHead c0 +(Bind b) u) t0) \to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T t0 +(THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 (CHead c0 +(Bind b) u) w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead (CHead c0 (Bind +b) u) (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T t0 (TSort n)))) +(ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t0 (THeads +(Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 +(CHead c0 (Bind b) u) ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 (CHead +c0 (Bind b) u) (TLRef i))))))))).(\lambda (H5: (nf2 c0 (THead (Bind b) u +t0))).(B_ind (\lambda (b0: B).((not (eq B b0 Abst)) \to ((arity g (CHead c0 +(Bind b0) u) t0 a2) \to ((nf2 c0 (THead (Bind b0) u t0)) \to (or3 (ex3_2 T T +(\lambda (w: T).(\lambda (u0: T).(eq T (THead (Bind b0) u t0) (THead (Bind +Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: +T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: +nat).(eq T (THead (Bind b0) u t0) (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T (THead (Bind b0) u t0) (THeads (Flat Appl) ws +(TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda +(_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))))))) (\lambda (_: (not (eq +B Abbr Abst))).(\lambda (_: (arity g (CHead c0 (Bind Abbr) u) t0 +a2)).(\lambda (H8: (nf2 c0 (THead (Bind Abbr) u t0))).(nf2_gen_abbr c0 u t0 +H8 (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T (THead (Bind Abbr) +u t0) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 +w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) +(ex nat (\lambda (n: nat).(eq T (THead (Bind Abbr) u t0) (TSort n)))) (ex3_2 +TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Bind Abbr) u +t0) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i)))))))))) (\lambda (H6: (not (eq B Abst Abst))).(\lambda (_: (arity g +(CHead c0 (Bind Abst) u) t0 a2)).(\lambda (_: (nf2 c0 (THead (Bind Abst) u +t0))).(let H9 \def (match (H6 (refl_equal B Abst)) in False return (\lambda +(_: False).(or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T (THead +(Bind Abst) u t0) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: +T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) +w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Bind Abst) u t0) (TSort +n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (THead +(Bind Abst) u t0) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i))))))) with []) in H9)))) (\lambda (_: (not (eq B Void +Abst))).(\lambda (H7: (arity g (CHead c0 (Bind Void) u) t0 a2)).(\lambda (H8: +(nf2 c0 (THead (Bind Void) u t0))).(let H9 \def (arity_gen_cvoid g (CHead c0 +(Bind Void) u) t0 a2 H7 c0 u O (getl_refl Void c0 u)) in (ex_ind T (\lambda +(v: T).(eq T t0 (lift (S O) O v))) (or3 (ex3_2 T T (\lambda (w: T).(\lambda +(u0: T).(eq T (THead (Bind Void) u t0) (THead (Bind Abst) w u0)))) (\lambda +(w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 +(CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Bind +Void) u t0) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: +nat).(eq T (THead (Bind Void) u t0) (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))) (\lambda (x: T).(\lambda +(H10: (eq T t0 (lift (S O) O x))).(let H11 \def (eq_ind T t0 (\lambda (t1: +T).(nf2 c0 (THead (Bind Void) u t1))) H8 (lift (S O) O x) H10) in (eq_ind_r T +(lift (S O) O x) (\lambda (t1: T).(or3 (ex3_2 T T (\lambda (w: T).(\lambda +(u0: T).(eq T (THead (Bind Void) u t1) (THead (Bind Abst) w u0)))) (\lambda +(w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 +(CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Bind +Void) u t1) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: +nat).(eq T (THead (Bind Void) u t1) (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))))) (nf2_gen_void c0 u x H11 +(or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T (THead (Bind Void) u +(lift (S O) O x)) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: +T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) +w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Bind Void) u (lift (S O) O +x)) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq +T (THead (Bind Void) u (lift (S O) O x)) (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))))) t0 H10)))) H9))))) b H0 H3 +H5))))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda (a1: A).(\lambda +(_: (arity g c0 u (asucc g a1))).(\lambda (_: (((nf2 c0 u) \to (or3 (ex3_2 T +T (\lambda (w: T).(\lambda (u0: T).(eq T u (THead (Bind Abst) w u0)))) +(\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: +T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T u +(TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T u +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity g (CHead c0 +(Bind Abst) u) t0 a2)).(\lambda (_: (((nf2 (CHead c0 (Bind Abst) u) t0) \to +(or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T t0 (THead (Bind Abst) +w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 (CHead c0 (Bind Abst) u) w))) +(\lambda (w: T).(\lambda (u0: T).(nf2 (CHead (CHead c0 (Bind Abst) u) (Bind +Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T t0 (TSort n)))) (ex3_2 TList +nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws +(TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 (CHead c0 (Bind +Abst) u) ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 (CHead c0 (Bind +Abst) u) (TLRef i))))))))).(\lambda (H4: (nf2 c0 (THead (Bind Abst) u +t0))).(let H5 \def (nf2_gen_abst c0 u t0 H4) in (and_ind (nf2 c0 u) (nf2 +(CHead c0 (Bind Abst) u) t0) (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: +T).(eq T (THead (Bind Abst) u t0) (THead (Bind Abst) w u0)))) (\lambda (w: +T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead +c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Bind Abst) u +t0) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq +T (THead (Bind Abst) u t0) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i)))))) (\lambda (H6: (nf2 c0 u)).(\lambda (H7: (nf2 +(CHead c0 (Bind Abst) u) t0)).(or3_intro0 (ex3_2 T T (\lambda (w: T).(\lambda +(u0: T).(eq T (THead (Bind Abst) u t0) (THead (Bind Abst) w u0)))) (\lambda +(w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 +(CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Bind +Abst) u t0) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: +nat).(eq T (THead (Bind Abst) u t0) (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))) (ex3_2_intro T T (\lambda (w: +T).(\lambda (u0: T).(eq T (THead (Bind Abst) u t0) (THead (Bind Abst) w +u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda +(u0: T).(nf2 (CHead c0 (Bind Abst) w) u0))) u t0 (refl_equal T (THead (Bind +Abst) u t0)) H6 H7)))) H5)))))))))))) (\lambda (c0: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c0 u a1)).(\lambda (_: (((nf2 c0 u) +\to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T u (THead (Bind +Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: +T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: +nat).(eq T u (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: +nat).(eq T u (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i))))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda +(H2: (arity g c0 t0 (AHead a1 a2))).(\lambda (H3: (((nf2 c0 t0) \to (or3 +(ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T t0 (THead (Bind Abst) w +u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda +(u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T +t0 (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T +t0 (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))))))).(\lambda (H4: (nf2 c0 (THead (Flat Appl) u t0))).(let H5 \def +(nf2_gen_flat Appl c0 u t0 H4) in (and_ind (nf2 c0 u) (nf2 c0 t0) (or3 (ex3_2 +T T (\lambda (w: T).(\lambda (u0: T).(eq T (THead (Flat Appl) u t0) (THead +(Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda +(w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda +(n: nat).(eq T (THead (Flat Appl) u t0) (TSort n)))) (ex3_2 TList nat +(\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u t0) (THeads +(Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 +ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))) (\lambda +(H6: (nf2 c0 u)).(\lambda (H7: (nf2 c0 t0)).(let H_x \def (H3 H7) in (let H8 +\def H_x in (or3_ind (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T t0 +(THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) +(\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat +(\lambda (n: nat).(eq T t0 (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))) (or3 (ex3_2 T T (\lambda (w: +T).(\lambda (u0: T).(eq T (THead (Flat Appl) u t0) (THead (Bind Abst) w +u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda +(u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T +(THead (Flat Appl) u t0) (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u t0) (THeads (Flat Appl) +ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) +(\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))) (\lambda (H9: +(ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T t0 (THead (Bind Abst) w +u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda +(u0: T).(nf2 (CHead c0 (Bind Abst) w) u0))))).(ex3_2_ind T T (\lambda (w: +T).(\lambda (u0: T).(eq T t0 (THead (Bind Abst) w u0)))) (\lambda (w: +T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead +c0 (Bind Abst) w) u0))) (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq +T (THead (Flat Appl) u t0) (THead (Bind Abst) w u0)))) (\lambda (w: +T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead +c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Flat Appl) u +t0) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq +T (THead (Flat Appl) u t0) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i)))))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H10: +(eq T t0 (THead (Bind Abst) x0 x1))).(\lambda (_: (nf2 c0 x0)).(\lambda (_: +(nf2 (CHead c0 (Bind Abst) x0) x1)).(let H13 \def (eq_ind T t0 (\lambda (t1: +T).(nf2 c0 (THead (Flat Appl) u t1))) H4 (THead (Bind Abst) x0 x1) H10) in +(let H14 \def (eq_ind T t0 (\lambda (t1: T).(arity g c0 t1 (AHead a1 a2))) H2 +(THead (Bind Abst) x0 x1) H10) in (eq_ind_r T (THead (Bind Abst) x0 x1) +(\lambda (t1: T).(or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T +(THead (Flat Appl) u t1) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda +(_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind +Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Flat Appl) u t1) +(TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T +(THead (Flat Appl) u t1) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i))))))) (nf2_gen_beta c0 u x0 x1 H13 (or3 (ex3_2 T T +(\lambda (w: T).(\lambda (u0: T).(eq T (THead (Flat Appl) u (THead (Bind +Abst) x0 x1)) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: +T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) +w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Flat Appl) u (THead (Bind +Abst) x0 x1)) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: +nat).(eq T (THead (Flat Appl) u (THead (Bind Abst) x0 x1)) (THeads (Flat +Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) +(\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))))) t0 H10)))))))) +H9)) (\lambda (H9: (ex nat (\lambda (n: nat).(eq T t0 (TSort n))))).(ex_ind +nat (\lambda (n: nat).(eq T t0 (TSort n))) (or3 (ex3_2 T T (\lambda (w: +T).(\lambda (u0: T).(eq T (THead (Flat Appl) u t0) (THead (Bind Abst) w +u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda +(u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T +(THead (Flat Appl) u t0) (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u t0) (THeads (Flat Appl) +ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) +(\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))) (\lambda (x: +nat).(\lambda (H10: (eq T t0 (TSort x))).(let H11 \def (eq_ind T t0 (\lambda +(t1: T).(nf2 c0 (THead (Flat Appl) u t1))) H4 (TSort x) H10) in (let H12 \def +(eq_ind T t0 (\lambda (t1: T).(arity g c0 t1 (AHead a1 a2))) H2 (TSort x) +H10) in (eq_ind_r T (TSort x) (\lambda (t1: T).(or3 (ex3_2 T T (\lambda (w: +T).(\lambda (u0: T).(eq T (THead (Flat Appl) u t1) (THead (Bind Abst) w +u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda +(u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T +(THead (Flat Appl) u t1) (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u t1) (THeads (Flat Appl) +ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) +(\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))))) (let H13 \def +(match (arity_gen_sort g c0 x (AHead a1 a2) H12) in leq return (\lambda (a0: +A).(\lambda (a3: A).(\lambda (_: (leq ? a0 a3)).((eq A a0 (AHead a1 a2)) \to +((eq A a3 (ASort O x)) \to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: +T).(eq T (THead (Flat Appl) u (TSort x)) (THead (Bind Abst) w u0)))) (\lambda +(w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 +(CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Flat +Appl) u (TSort x)) (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u (TSort x)) (THeads (Flat +Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) +(\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))))))))) with +[(leq_sort h1 h2 n1 n2 k H13) \Rightarrow (\lambda (H14: (eq A (ASort h1 n1) +(AHead a1 a2))).(\lambda (H15: (eq A (ASort h2 n2) (ASort O x))).((let H16 +\def (eq_ind A (ASort h1 n1) (\lambda (e: A).(match e in A return (\lambda +(_: A).Prop) with [(ASort _ _) \Rightarrow True | (AHead _ _) \Rightarrow +False])) I (AHead a1 a2) H14) in (False_ind ((eq A (ASort h2 n2) (ASort O x)) +\to ((eq A (aplus g (ASort h1 n1) k) (aplus g (ASort h2 n2) k)) \to (or3 +(ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T (THead (Flat Appl) u (TSort +x)) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) +(\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat +(\lambda (n: nat).(eq T (THead (Flat Appl) u (TSort x)) (TSort n)))) (ex3_2 +TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u +(TSort x)) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda +(_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i)))))))) H16)) H15 H13))) | (leq_head a0 a3 H13 a4 a5 H14) \Rightarrow +(\lambda (H15: (eq A (AHead a0 a4) (AHead a1 a2))).(\lambda (H16: (eq A +(AHead a3 a5) (ASort O x))).((let H17 \def (f_equal A A (\lambda (e: +A).(match e in A return (\lambda (_: A).A) with [(ASort _ _) \Rightarrow a4 | +(AHead _ a6) \Rightarrow a6])) (AHead a0 a4) (AHead a1 a2) H15) in ((let H18 +\def (f_equal A A (\lambda (e: A).(match e in A return (\lambda (_: A).A) +with [(ASort _ _) \Rightarrow a0 | (AHead a6 _) \Rightarrow a6])) (AHead a0 +a4) (AHead a1 a2) H15) in (eq_ind A a1 (\lambda (a6: A).((eq A a4 a2) \to +((eq A (AHead a3 a5) (ASort O x)) \to ((leq g a6 a3) \to ((leq g a4 a5) \to +(or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T (THead (Flat Appl) u +(TSort x)) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 +c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) +(ex nat (\lambda (n: nat).(eq T (THead (Flat Appl) u (TSort x)) (TSort n)))) +(ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Flat +Appl) u (TSort x)) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i))))))))))) (\lambda (H19: (eq A a4 a2)).(eq_ind A a2 +(\lambda (a6: A).((eq A (AHead a3 a5) (ASort O x)) \to ((leq g a1 a3) \to +((leq g a6 a5) \to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T +(THead (Flat Appl) u (TSort x)) (THead (Bind Abst) w u0)))) (\lambda (w: +T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead +c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T (THead (Flat Appl) u +(TSort x)) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: +nat).(eq T (THead (Flat Appl) u (TSort x)) (THeads (Flat Appl) ws (TLRef +i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))))))) (\lambda (H20: (eq A +(AHead a3 a5) (ASort O x))).(let H21 \def (eq_ind A (AHead a3 a5) (\lambda +(e: A).(match e in A return (\lambda (_: A).Prop) with [(ASort _ _) +\Rightarrow False | (AHead _ _) \Rightarrow True])) I (ASort O x) H20) in +(False_ind ((leq g a1 a3) \to ((leq g a2 a5) \to (or3 (ex3_2 T T (\lambda (w: +T).(\lambda (u0: T).(eq T (THead (Flat Appl) u (TSort x)) (THead (Bind Abst) +w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: +T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: +nat).(eq T (THead (Flat Appl) u (TSort x)) (TSort n)))) (ex3_2 TList nat +(\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u (TSort x)) +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i)))))))) H21))) a4 (sym_eq A a4 a2 H19))) a0 (sym_eq A a0 a1 H18))) H17)) +H16 H13 H14)))]) in (H13 (refl_equal A (AHead a1 a2)) (refl_equal A (ASort O +x)))) t0 H10))))) H9)) (\lambda (H9: (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))).(ex3_2_ind TList nat (\lambda +(ws: TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))) (or3 (ex3_2 T T (\lambda (w: +T).(\lambda (u0: T).(eq T (THead (Flat Appl) u t0) (THead (Bind Abst) w +u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda +(u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T +(THead (Flat Appl) u t0) (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u t0) (THeads (Flat Appl) +ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) +(\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))) (\lambda (x0: +TList).(\lambda (x1: nat).(\lambda (H10: (eq T t0 (THeads (Flat Appl) x0 +(TLRef x1)))).(\lambda (H11: (nfs2 c0 x0)).(\lambda (H12: (nf2 c0 (TLRef +x1))).(let H13 \def (eq_ind T t0 (\lambda (t1: T).(nf2 c0 (THead (Flat Appl) +u t1))) H4 (THeads (Flat Appl) x0 (TLRef x1)) H10) in (let H14 \def (eq_ind T +t0 (\lambda (t1: T).(arity g c0 t1 (AHead a1 a2))) H2 (THeads (Flat Appl) x0 +(TLRef x1)) H10) in (eq_ind_r T (THeads (Flat Appl) x0 (TLRef x1)) (\lambda +(t1: T).(or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T (THead (Flat +Appl) u t1) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 +c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) +(ex nat (\lambda (n: nat).(eq T (THead (Flat Appl) u t1) (TSort n)))) (ex3_2 +TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u +t1) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))))) (or3_intro2 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T (THead +(Flat Appl) u (THeads (Flat Appl) x0 (TLRef x1))) (THead (Bind Abst) w u0)))) +(\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: +T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T +(THead (Flat Appl) u (THeads (Flat Appl) x0 (TLRef x1))) (TSort n)))) (ex3_2 +TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u +(THeads (Flat Appl) x0 (TLRef x1))) (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))) (ex3_2_intro TList nat +(\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Flat Appl) u (THeads +(Flat Appl) x0 (TLRef x1))) (THeads (Flat Appl) ws (TLRef i))))) (\lambda +(ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i)))) (TCons u x0) x1 (refl_equal T (THead (Flat Appl) u +(THeads (Flat Appl) x0 (TLRef x1)))) (conj (nf2 c0 u) (nfs2 c0 x0) H6 H11) +H12)) t0 H10)))))))) H9)) H8))))) H5)))))))))))) (\lambda (c0: C).(\lambda +(u: T).(\lambda (a0: A).(\lambda (_: (arity g c0 u (asucc g a0))).(\lambda +(_: (((nf2 c0 u) \to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T u +(THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) +(\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat +(\lambda (n: nat).(eq T u (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T u (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))))))).(\lambda (t0: T).(\lambda +(_: (arity g c0 t0 a0)).(\lambda (_: (((nf2 c0 t0) \to (or3 (ex3_2 T T +(\lambda (w: T).(\lambda (u0: T).(eq T t0 (THead (Bind Abst) w u0)))) +(\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u0: +T).(nf2 (CHead c0 (Bind Abst) w) u0)))) (ex nat (\lambda (n: nat).(eq T t0 +(TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t0 +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))))))).(\lambda (H4: (nf2 c0 (THead (Flat Cast) u t0))).(nf2_gen_cast c0 +u t0 H4 (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T (THead (Flat +Cast) u t0) (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 +c0 w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c0 (Bind Abst) w) u0)))) +(ex nat (\lambda (n: nat).(eq T (THead (Flat Cast) u t0) (TSort n)))) (ex3_2 +TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Flat Cast) u +t0) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i)))))))))))))))) (\lambda (c0: C).(\lambda (t0: T).(\lambda (a1: A).(\lambda +(_: (arity g c0 t0 a1)).(\lambda (H1: (((nf2 c0 t0) \to (or3 (ex3_2 T T +(\lambda (w: T).(\lambda (u: T).(eq T t0 (THead (Bind Abst) w u)))) (\lambda +(w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 +(CHead c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T t0 (TSort +n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t0 +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))))))).(\lambda (a2: A).(\lambda (_: (leq g a1 a2)).(\lambda (H3: (nf2 c0 +t0)).(let H_x \def (H1 H3) in (let H4 \def H_x in (or3_ind (ex3_2 T T +(\lambda (w: T).(\lambda (u: T).(eq T t0 (THead (Bind Abst) w u)))) (\lambda +(w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 +(CHead c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T t0 (TSort +n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t0 +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))) (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u: T).(eq T t0 (THead (Bind +Abst) w u)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: +T).(\lambda (u: T).(nf2 (CHead c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: +nat).(eq T t0 (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: +nat).(eq T t0 (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i)))))) (\lambda (H5: (ex3_2 T T (\lambda (w: T).(\lambda +(u: T).(eq T t0 (THead (Bind Abst) w u)))) (\lambda (w: T).(\lambda (_: +T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 (CHead c0 (Bind Abst) w) +u))))).(ex3_2_ind T T (\lambda (w: T).(\lambda (u: T).(eq T t0 (THead (Bind +Abst) w u)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: +T).(\lambda (u: T).(nf2 (CHead c0 (Bind Abst) w) u))) (or3 (ex3_2 T T +(\lambda (w: T).(\lambda (u: T).(eq T t0 (THead (Bind Abst) w u)))) (\lambda +(w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 +(CHead c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T t0 (TSort +n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t0 +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i)))))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H6: (eq T t0 (THead (Bind +Abst) x0 x1))).(\lambda (H7: (nf2 c0 x0)).(\lambda (H8: (nf2 (CHead c0 (Bind +Abst) x0) x1)).(eq_ind_r T (THead (Bind Abst) x0 x1) (\lambda (t1: T).(or3 +(ex3_2 T T (\lambda (w: T).(\lambda (u: T).(eq T t1 (THead (Bind Abst) w +u)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda +(u: T).(nf2 (CHead c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T t1 +(TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t1 +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))))) (or3_intro0 (ex3_2 T T (\lambda (w: T).(\lambda (u: T).(eq T (THead +(Bind Abst) x0 x1) (THead (Bind Abst) w u)))) (\lambda (w: T).(\lambda (_: +T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 (CHead c0 (Bind Abst) w) +u)))) (ex nat (\lambda (n: nat).(eq T (THead (Bind Abst) x0 x1) (TSort n)))) +(ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (THead (Bind +Abst) x0 x1) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c0 (TLRef i))))) (ex3_2_intro T T (\lambda (w: T).(\lambda (u: +T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind Abst) w u)))) (\lambda (w: +T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 (CHead +c0 (Bind Abst) w) u))) x0 x1 (refl_equal T (THead (Bind Abst) x0 x1)) H7 H8)) +t0 H6)))))) H5)) (\lambda (H5: (ex nat (\lambda (n: nat).(eq T t0 (TSort +n))))).(ex_ind nat (\lambda (n: nat).(eq T t0 (TSort n))) (or3 (ex3_2 T T +(\lambda (w: T).(\lambda (u: T).(eq T t0 (THead (Bind Abst) w u)))) (\lambda +(w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 +(CHead c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T t0 (TSort +n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t0 +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i)))))) (\lambda (x: nat).(\lambda (H6: (eq T t0 (TSort x))).(eq_ind_r T +(TSort x) (\lambda (t1: T).(or3 (ex3_2 T T (\lambda (w: T).(\lambda (u: +T).(eq T t1 (THead (Bind Abst) w u)))) (\lambda (w: T).(\lambda (_: T).(nf2 +c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 (CHead c0 (Bind Abst) w) u)))) +(ex nat (\lambda (n: nat).(eq T t1 (TSort n)))) (ex3_2 TList nat (\lambda +(ws: TList).(\lambda (i: nat).(eq T t1 (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))))) (or3_intro1 (ex3_2 T T +(\lambda (w: T).(\lambda (u: T).(eq T (TSort x) (THead (Bind Abst) w u)))) +(\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: +T).(nf2 (CHead c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T (TSort +x) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T +(TSort x) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda +(_: nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))) (ex_intro nat (\lambda (n: nat).(eq T (TSort x) (TSort n))) x +(refl_equal T (TSort x)))) t0 H6))) H5)) (\lambda (H5: (ex3_2 TList nat +(\lambda (ws: TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws (TLRef +i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))).(ex3_2_ind TList nat (\lambda +(ws: TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))) (or3 (ex3_2 T T (\lambda (w: +T).(\lambda (u: T).(eq T t0 (THead (Bind Abst) w u)))) (\lambda (w: +T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 (CHead +c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T t0 (TSort n)))) +(ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t0 (THeads +(Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 +ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i)))))) (\lambda +(x0: TList).(\lambda (x1: nat).(\lambda (H6: (eq T t0 (THeads (Flat Appl) x0 +(TLRef x1)))).(\lambda (H7: (nfs2 c0 x0)).(\lambda (H8: (nf2 c0 (TLRef +x1))).(eq_ind_r T (THeads (Flat Appl) x0 (TLRef x1)) (\lambda (t1: T).(or3 +(ex3_2 T T (\lambda (w: T).(\lambda (u: T).(eq T t1 (THead (Bind Abst) w +u)))) (\lambda (w: T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda +(u: T).(nf2 (CHead c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T t1 +(TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t1 +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i))))))) (or3_intro2 (ex3_2 T T (\lambda (w: T).(\lambda (u: T).(eq T (THeads +(Flat Appl) x0 (TLRef x1)) (THead (Bind Abst) w u)))) (\lambda (w: +T).(\lambda (_: T).(nf2 c0 w))) (\lambda (w: T).(\lambda (u: T).(nf2 (CHead +c0 (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T (THeads (Flat Appl) +x0 (TLRef x1)) (TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda +(i: nat).(eq T (THeads (Flat Appl) x0 (TLRef x1)) (THeads (Flat Appl) ws +(TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c0 ws))) (\lambda +(_: TList).(\lambda (i: nat).(nf2 c0 (TLRef i))))) (ex3_2_intro TList nat +(\lambda (ws: TList).(\lambda (i: nat).(eq T (THeads (Flat Appl) x0 (TLRef +x1)) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c0 ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c0 (TLRef +i)))) x0 x1 (refl_equal T (THeads (Flat Appl) x0 (TLRef x1))) H7 H8)) t0 +H6)))))) H5)) H4))))))))))) c t a H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/dec.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/dec.ma new file mode 100644 index 000000000..d7aa80992 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/dec.ma @@ -0,0 +1,199 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/nf2/dec". + +include "nf2/defs.ma". + +include "pr2/clen.ma". + +include "pr2/fwd.ma". + +include "pr0/dec.ma". + +include "C/props.ma". + +theorem nf2_dec: + \forall (c: C).(\forall (t1: T).(or (nf2 c t1) (ex2 T (\lambda (t2: T).((eq +T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 c t1 t2))))) +\def + \lambda (c: C).(c_tail_ind (\lambda (c0: C).(\forall (t1: T).(or (\forall +(t2: T).((pr2 c0 t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: T).((eq T t1 +t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 c0 t1 t2)))))) (\lambda +(n: nat).(\lambda (t1: T).(let H_x \def (nf0_dec t1) in (let H \def H_x in +(or_ind (\forall (t2: T).((pr0 t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: +T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 t1 t2))) +(or (\forall (t2: T).((pr2 (CSort n) t1 t2) \to (eq T t1 t2))) (ex2 T +(\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr2 (CSort n) t1 t2)))) (\lambda (H0: ((\forall (t2: T).((pr0 t1 t2) \to +(eq T t1 t2))))).(or_introl (\forall (t2: T).((pr2 (CSort n) t1 t2) \to (eq T +t1 t2))) (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) +(\lambda (t2: T).(pr2 (CSort n) t1 t2))) (\lambda (t2: T).(\lambda (H1: (pr2 +(CSort n) t1 t2)).(let H_y \def (pr2_gen_csort t1 t2 n H1) in (H0 t2 +H_y)))))) (\lambda (H0: (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall +(P: Prop).P))) (\lambda (t2: T).(pr0 t1 t2)))).(ex2_ind T (\lambda (t2: +T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 t1 t2)) +(or (\forall (t2: T).((pr2 (CSort n) t1 t2) \to (eq T t1 t2))) (ex2 T +(\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr2 (CSort n) t1 t2)))) (\lambda (x: T).(\lambda (H1: (((eq T t1 x) \to +(\forall (P: Prop).P)))).(\lambda (H2: (pr0 t1 x)).(or_intror (\forall (t2: +T).((pr2 (CSort n) t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: T).((eq T +t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 (CSort n) t1 t2))) +(ex_intro2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) +(\lambda (t2: T).(pr2 (CSort n) t1 t2)) x H1 (pr2_free (CSort n) t1 x +H2)))))) H0)) H))))) (\lambda (c0: C).(\lambda (H: ((\forall (t1: T).(or +(\forall (t2: T).((pr2 c0 t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: +T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 c0 t1 +t2))))))).(\lambda (k: K).(\lambda (t: T).(\lambda (t1: T).(let H_x \def (H +t1) in (let H0 \def H_x in (or_ind (\forall (t2: T).((pr2 c0 t1 t2) \to (eq T +t1 t2))) (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) +(\lambda (t2: T).(pr2 c0 t1 t2))) (or (\forall (t2: T).((pr2 (CTail k t c0) +t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall +(P: Prop).P))) (\lambda (t2: T).(pr2 (CTail k t c0) t1 t2)))) (\lambda (H1: +((\forall (t2: T).((pr2 c0 t1 t2) \to (eq T t1 t2))))).(K_ind (\lambda (k0: +K).(or (\forall (t2: T).((pr2 (CTail k0 t c0) t1 t2) \to (eq T t1 t2))) (ex2 +T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr2 (CTail k0 t c0) t1 t2))))) (\lambda (b: B).(B_ind (\lambda (b0: +B).(or (\forall (t2: T).((pr2 (CTail (Bind b0) t c0) t1 t2) \to (eq T t1 +t2))) (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) +(\lambda (t2: T).(pr2 (CTail (Bind b0) t c0) t1 t2))))) (let H_x0 \def +(dnf_dec t t1 (clen c0)) in (let H2 \def H_x0 in (ex_ind T (\lambda (v: +T).(or (subst0 (clen c0) t t1 (lift (S O) (clen c0) v)) (eq T t1 (lift (S O) +(clen c0) v)))) (or (\forall (t2: T).((pr2 (CTail (Bind Abbr) t c0) t1 t2) +\to (eq T t1 t2))) (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr2 (CTail (Bind Abbr) t c0) t1 t2)))) (\lambda +(x: T).(\lambda (H3: (or (subst0 (clen c0) t t1 (lift (S O) (clen c0) x)) (eq +T t1 (lift (S O) (clen c0) x)))).(or_ind (subst0 (clen c0) t t1 (lift (S O) +(clen c0) x)) (eq T t1 (lift (S O) (clen c0) x)) (or (\forall (t2: T).((pr2 +(CTail (Bind Abbr) t c0) t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: +T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 (CTail +(Bind Abbr) t c0) t1 t2)))) (\lambda (H4: (subst0 (clen c0) t t1 (lift (S O) +(clen c0) x))).(let H_x1 \def (getl_ctail_clen Abbr t c0) in (let H5 \def +H_x1 in (ex_ind nat (\lambda (n: nat).(getl (clen c0) (CTail (Bind Abbr) t +c0) (CHead (CSort n) (Bind Abbr) t))) (or (\forall (t2: T).((pr2 (CTail (Bind +Abbr) t c0) t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: T).((eq T t1 t2) +\to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 (CTail (Bind Abbr) t c0) t1 +t2)))) (\lambda (x0: nat).(\lambda (H6: (getl (clen c0) (CTail (Bind Abbr) t +c0) (CHead (CSort x0) (Bind Abbr) t))).(or_intror (\forall (t2: T).((pr2 +(CTail (Bind Abbr) t c0) t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: +T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 (CTail +(Bind Abbr) t c0) t1 t2))) (ex_intro2 T (\lambda (t2: T).((eq T t1 t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr2 (CTail (Bind Abbr) t c0) t1 +t2)) (lift (S O) (clen c0) x) (\lambda (H7: (eq T t1 (lift (S O) (clen c0) +x))).(\lambda (P: Prop).(let H8 \def (eq_ind T t1 (\lambda (t0: T).(subst0 +(clen c0) t t0 (lift (S O) (clen c0) x))) H4 (lift (S O) (clen c0) x) H7) in +(subst0_gen_lift_false x t (lift (S O) (clen c0) x) (S O) (clen c0) (clen c0) +(le_n (clen c0)) (eq_ind_r nat (plus (S O) (clen c0)) (\lambda (n: nat).(lt +(clen c0) n)) (le_n (plus (S O) (clen c0))) (plus (clen c0) (S O)) (plus_comm +(clen c0) (S O))) H8 P)))) (pr2_delta (CTail (Bind Abbr) t c0) (CSort x0) t +(clen c0) H6 t1 t1 (pr0_refl t1) (lift (S O) (clen c0) x) H4))))) H5)))) +(\lambda (H4: (eq T t1 (lift (S O) (clen c0) x))).(let H5 \def (eq_ind T t1 +(\lambda (t0: T).(\forall (t2: T).((pr2 c0 t0 t2) \to (eq T t0 t2)))) H1 +(lift (S O) (clen c0) x) H4) in (eq_ind_r T (lift (S O) (clen c0) x) (\lambda +(t0: T).(or (\forall (t2: T).((pr2 (CTail (Bind Abbr) t c0) t0 t2) \to (eq T +t0 t2))) (ex2 T (\lambda (t2: T).((eq T t0 t2) \to (\forall (P: Prop).P))) +(\lambda (t2: T).(pr2 (CTail (Bind Abbr) t c0) t0 t2))))) (or_introl (\forall +(t2: T).((pr2 (CTail (Bind Abbr) t c0) (lift (S O) (clen c0) x) t2) \to (eq T +(lift (S O) (clen c0) x) t2))) (ex2 T (\lambda (t2: T).((eq T (lift (S O) +(clen c0) x) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 (CTail +(Bind Abbr) t c0) (lift (S O) (clen c0) x) t2))) (\lambda (t2: T).(\lambda +(H6: (pr2 (CTail (Bind Abbr) t c0) (lift (S O) (clen c0) x) t2)).(let H_x1 +\def (pr2_gen_ctail (Bind Abbr) c0 t (lift (S O) (clen c0) x) t2 H6) in (let +H7 \def H_x1 in (or_ind (pr2 c0 (lift (S O) (clen c0) x) t2) (ex3 T (\lambda +(_: T).(eq K (Bind Abbr) (Bind Abbr))) (\lambda (t0: T).(pr0 (lift (S O) +(clen c0) x) t0)) (\lambda (t0: T).(subst0 (clen c0) t t0 t2))) (eq T (lift +(S O) (clen c0) x) t2) (\lambda (H8: (pr2 c0 (lift (S O) (clen c0) x) +t2)).(H5 t2 H8)) (\lambda (H8: (ex3 T (\lambda (_: T).(eq K (Bind Abbr) (Bind +Abbr))) (\lambda (t0: T).(pr0 (lift (S O) (clen c0) x) t0)) (\lambda (t0: +T).(subst0 (clen c0) t t0 t2)))).(ex3_ind T (\lambda (_: T).(eq K (Bind Abbr) +(Bind Abbr))) (\lambda (t0: T).(pr0 (lift (S O) (clen c0) x) t0)) (\lambda +(t0: T).(subst0 (clen c0) t t0 t2)) (eq T (lift (S O) (clen c0) x) t2) +(\lambda (x0: T).(\lambda (_: (eq K (Bind Abbr) (Bind Abbr))).(\lambda (H10: +(pr0 (lift (S O) (clen c0) x) x0)).(\lambda (H11: (subst0 (clen c0) t x0 +t2)).(ex2_ind T (\lambda (t3: T).(eq T x0 (lift (S O) (clen c0) t3))) +(\lambda (t3: T).(pr0 x t3)) (eq T (lift (S O) (clen c0) x) t2) (\lambda (x1: +T).(\lambda (H12: (eq T x0 (lift (S O) (clen c0) x1))).(\lambda (_: (pr0 x +x1)).(let H14 \def (eq_ind T x0 (\lambda (t0: T).(subst0 (clen c0) t t0 t2)) +H11 (lift (S O) (clen c0) x1) H12) in (subst0_gen_lift_false x1 t t2 (S O) +(clen c0) (clen c0) (le_n (clen c0)) (eq_ind_r nat (plus (S O) (clen c0)) +(\lambda (n: nat).(lt (clen c0) n)) (le_n (plus (S O) (clen c0))) (plus (clen +c0) (S O)) (plus_comm (clen c0) (S O))) H14 (eq T (lift (S O) (clen c0) x) +t2)))))) (pr0_gen_lift x x0 (S O) (clen c0) H10)))))) H8)) H7)))))) t1 H4))) +H3))) H2))) (or_introl (\forall (t2: T).((pr2 (CTail (Bind Abst) t c0) t1 t2) +\to (eq T t1 t2))) (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr2 (CTail (Bind Abst) t c0) t1 t2))) (\lambda +(t2: T).(\lambda (H2: (pr2 (CTail (Bind Abst) t c0) t1 t2)).(let H_x0 \def +(pr2_gen_ctail (Bind Abst) c0 t t1 t2 H2) in (let H3 \def H_x0 in (or_ind +(pr2 c0 t1 t2) (ex3 T (\lambda (_: T).(eq K (Bind Abst) (Bind Abbr))) +(\lambda (t0: T).(pr0 t1 t0)) (\lambda (t0: T).(subst0 (clen c0) t t0 t2))) +(eq T t1 t2) (\lambda (H4: (pr2 c0 t1 t2)).(H1 t2 H4)) (\lambda (H4: (ex3 T +(\lambda (_: T).(eq K (Bind Abst) (Bind Abbr))) (\lambda (t0: T).(pr0 t1 t0)) +(\lambda (t0: T).(subst0 (clen c0) t t0 t2)))).(ex3_ind T (\lambda (_: T).(eq +K (Bind Abst) (Bind Abbr))) (\lambda (t0: T).(pr0 t1 t0)) (\lambda (t0: +T).(subst0 (clen c0) t t0 t2)) (eq T t1 t2) (\lambda (x0: T).(\lambda (H5: +(eq K (Bind Abst) (Bind Abbr))).(\lambda (_: (pr0 t1 x0)).(\lambda (_: +(subst0 (clen c0) t x0 t2)).(let H8 \def (eq_ind K (Bind Abst) (\lambda (ee: +K).(match ee in K return (\lambda (_: K).Prop) with [(Bind b0) \Rightarrow +(match b0 in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow False | +Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) \Rightarrow +False])) I (Bind Abbr) H5) in (False_ind (eq T t1 t2) H8)))))) H4)) H3)))))) +(or_introl (\forall (t2: T).((pr2 (CTail (Bind Void) t c0) t1 t2) \to (eq T +t1 t2))) (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) +(\lambda (t2: T).(pr2 (CTail (Bind Void) t c0) t1 t2))) (\lambda (t2: +T).(\lambda (H2: (pr2 (CTail (Bind Void) t c0) t1 t2)).(let H_x0 \def +(pr2_gen_ctail (Bind Void) c0 t t1 t2 H2) in (let H3 \def H_x0 in (or_ind +(pr2 c0 t1 t2) (ex3 T (\lambda (_: T).(eq K (Bind Void) (Bind Abbr))) +(\lambda (t0: T).(pr0 t1 t0)) (\lambda (t0: T).(subst0 (clen c0) t t0 t2))) +(eq T t1 t2) (\lambda (H4: (pr2 c0 t1 t2)).(H1 t2 H4)) (\lambda (H4: (ex3 T +(\lambda (_: T).(eq K (Bind Void) (Bind Abbr))) (\lambda (t0: T).(pr0 t1 t0)) +(\lambda (t0: T).(subst0 (clen c0) t t0 t2)))).(ex3_ind T (\lambda (_: T).(eq +K (Bind Void) (Bind Abbr))) (\lambda (t0: T).(pr0 t1 t0)) (\lambda (t0: +T).(subst0 (clen c0) t t0 t2)) (eq T t1 t2) (\lambda (x0: T).(\lambda (H5: +(eq K (Bind Void) (Bind Abbr))).(\lambda (_: (pr0 t1 x0)).(\lambda (_: +(subst0 (clen c0) t x0 t2)).(let H8 \def (eq_ind K (Bind Void) (\lambda (ee: +K).(match ee in K return (\lambda (_: K).Prop) with [(Bind b0) \Rightarrow +(match b0 in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow False | +Abst \Rightarrow False | Void \Rightarrow True]) | (Flat _) \Rightarrow +False])) I (Bind Abbr) H5) in (False_ind (eq T t1 t2) H8)))))) H4)) H3)))))) +b)) (\lambda (f: F).(or_introl (\forall (t2: T).((pr2 (CTail (Flat f) t c0) +t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall +(P: Prop).P))) (\lambda (t2: T).(pr2 (CTail (Flat f) t c0) t1 t2))) (\lambda +(t2: T).(\lambda (H2: (pr2 (CTail (Flat f) t c0) t1 t2)).(let H_x0 \def +(pr2_gen_ctail (Flat f) c0 t t1 t2 H2) in (let H3 \def H_x0 in (or_ind (pr2 +c0 t1 t2) (ex3 T (\lambda (_: T).(eq K (Flat f) (Bind Abbr))) (\lambda (t0: +T).(pr0 t1 t0)) (\lambda (t0: T).(subst0 (clen c0) t t0 t2))) (eq T t1 t2) +(\lambda (H4: (pr2 c0 t1 t2)).(H1 t2 H4)) (\lambda (H4: (ex3 T (\lambda (_: +T).(eq K (Flat f) (Bind Abbr))) (\lambda (t0: T).(pr0 t1 t0)) (\lambda (t0: +T).(subst0 (clen c0) t t0 t2)))).(ex3_ind T (\lambda (_: T).(eq K (Flat f) +(Bind Abbr))) (\lambda (t0: T).(pr0 t1 t0)) (\lambda (t0: T).(subst0 (clen +c0) t t0 t2)) (eq T t1 t2) (\lambda (x0: T).(\lambda (H5: (eq K (Flat f) +(Bind Abbr))).(\lambda (_: (pr0 t1 x0)).(\lambda (_: (subst0 (clen c0) t x0 +t2)).(let H8 \def (eq_ind K (Flat f) (\lambda (ee: K).(match ee in K return +(\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])) I (Bind Abbr) H5) in (False_ind (eq T t1 t2) H8)))))) H4)) H3))))))) +k)) (\lambda (H1: (ex2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr2 c0 t1 t2)))).(ex2_ind T (\lambda (t2: +T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 c0 t1 t2)) +(or (\forall (t2: T).((pr2 (CTail k t c0) t1 t2) \to (eq T t1 t2))) (ex2 T +(\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr2 (CTail k t c0) t1 t2)))) (\lambda (x: T).(\lambda (H2: (((eq T t1 x) +\to (\forall (P: Prop).P)))).(\lambda (H3: (pr2 c0 t1 x)).(or_intror (\forall +(t2: T).((pr2 (CTail k t c0) t1 t2) \to (eq T t1 t2))) (ex2 T (\lambda (t2: +T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr2 (CTail k t +c0) t1 t2))) (ex_intro2 T (\lambda (t2: T).((eq T t1 t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr2 (CTail k t c0) t1 t2)) x H2 (pr2_ctail c0 t1 +x H3 k t)))))) H1)) H0)))))))) c). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/defs.ma new file mode 100644 index 000000000..23868ee8b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/defs.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/nf2/defs". + +include "pr2/defs.ma". + +definition nf2: + C \to (T \to Prop) +\def + \lambda (c: C).(\lambda (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (eq T t1 +t2)))). + +definition nfs2: + C \to (TList \to Prop) +\def + let rec nfs2 (c: C) (ts: TList) on ts: Prop \def (match ts with [TNil +\Rightarrow True | (TCons t ts0) \Rightarrow (land (nf2 c t) (nfs2 c ts0))]) +in nfs2. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/fwd.ma new file mode 100644 index 000000000..849e86090 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/fwd.ma @@ -0,0 +1,198 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/nf2/fwd". + +include "nf2/defs.ma". + +include "pr2/clen.ma". + +include "subst0/dec.ma". + +include "T/props.ma". + +theorem nf2_gen_lref: + \forall (c: C).(\forall (d: C).(\forall (u: T).(\forall (i: nat).((getl i c +(CHead d (Bind Abbr) u)) \to ((nf2 c (TLRef i)) \to (\forall (P: Prop).P)))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead d (Bind Abbr) u))).(\lambda (H0: ((\forall (t2: T).((pr2 +c (TLRef i) t2) \to (eq T (TLRef i) t2))))).(\lambda (P: +Prop).(lift_gen_lref_false (S i) O i (le_O_n i) (le_n (plus O (S i))) u (H0 +(lift (S i) O u) (pr2_delta c d u i H (TLRef i) (TLRef i) (pr0_refl (TLRef +i)) (lift (S i) O u) (subst0_lref u i))) P))))))). + +theorem nf2_gen_abst: + \forall (c: C).(\forall (u: T).(\forall (t: T).((nf2 c (THead (Bind Abst) u +t)) \to (land (nf2 c u) (nf2 (CHead c (Bind Abst) u) t))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: ((\forall (t2: +T).((pr2 c (THead (Bind Abst) u t) t2) \to (eq T (THead (Bind Abst) u t) +t2))))).(conj (\forall (t2: T).((pr2 c u t2) \to (eq T u t2))) (\forall (t2: +T).((pr2 (CHead c (Bind Abst) u) t t2) \to (eq T t t2))) (\lambda (t2: +T).(\lambda (H0: (pr2 c u t2)).(let H1 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u | +(TLRef _) \Rightarrow u | (THead _ t0 _) \Rightarrow t0])) (THead (Bind Abst) +u t) (THead (Bind Abst) t2 t) (H (THead (Bind Abst) t2 t) (pr2_head_1 c u t2 +H0 (Bind Abst) t))) in (let H2 \def (eq_ind_r T t2 (\lambda (t0: T).(pr2 c u +t0)) H0 u H1) in (eq_ind T u (\lambda (t0: T).(eq T u t0)) (refl_equal T u) +t2 H1))))) (\lambda (t2: T).(\lambda (H0: (pr2 (CHead c (Bind Abst) u) t +t2)).(let H1 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda +(_: T).T) with [(TSort _) \Rightarrow t | (TLRef _) \Rightarrow t | (THead _ +_ t0) \Rightarrow t0])) (THead (Bind Abst) u t) (THead (Bind Abst) u t2) (H +(THead (Bind Abst) u t2) (let H_y \def (pr2_gen_cbind Abst c u t t2 H0) in +H_y))) in (let H2 \def (eq_ind_r T t2 (\lambda (t0: T).(pr2 (CHead c (Bind +Abst) u) t t0)) H0 t H1) in (eq_ind T t (\lambda (t0: T).(eq T t t0)) +(refl_equal T t) t2 H1))))))))). + +theorem nf2_gen_cast: + \forall (c: C).(\forall (u: T).(\forall (t: T).((nf2 c (THead (Flat Cast) u +t)) \to (\forall (P: Prop).P)))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: (nf2 c (THead +(Flat Cast) u t))).(\lambda (P: Prop).(thead_x_y_y (Flat Cast) u t (H t +(pr2_free c (THead (Flat Cast) u t) t (pr0_epsilon t t (pr0_refl t) u))) +P))))). + +theorem nf2_gen_beta: + \forall (c: C).(\forall (u: T).(\forall (v: T).(\forall (t: T).((nf2 c +(THead (Flat Appl) u (THead (Bind Abst) v t))) \to (\forall (P: Prop).P))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (v: T).(\lambda (t: T).(\lambda (H: +((\forall (t2: T).((pr2 c (THead (Flat Appl) u (THead (Bind Abst) v t)) t2) +\to (eq T (THead (Flat Appl) u (THead (Bind Abst) v t)) t2))))).(\lambda (P: +Prop).(let H0 \def (eq_ind T (THead (Flat Appl) u (THead (Bind Abst) v t)) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | +(Flat _) \Rightarrow True])])) I (THead (Bind Abbr) u t) (H (THead (Bind +Abbr) u t) (pr2_free c (THead (Flat Appl) u (THead (Bind Abst) v t)) (THead +(Bind Abbr) u t) (pr0_beta v u u (pr0_refl u) t t (pr0_refl t))))) in +(False_ind P H0))))))). + +theorem nf2_gen_flat: + \forall (f: F).(\forall (c: C).(\forall (u: T).(\forall (t: T).((nf2 c +(THead (Flat f) u t)) \to (land (nf2 c u) (nf2 c t)))))) +\def + \lambda (f: F).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: +((\forall (t2: T).((pr2 c (THead (Flat f) u t) t2) \to (eq T (THead (Flat f) +u t) t2))))).(conj (\forall (t2: T).((pr2 c u t2) \to (eq T u t2))) (\forall +(t2: T).((pr2 c t t2) \to (eq T t t2))) (\lambda (t2: T).(\lambda (H0: (pr2 c +u t2)).(let H1 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | +(THead _ t0 _) \Rightarrow t0])) (THead (Flat f) u t) (THead (Flat f) t2 t) +(H (THead (Flat f) t2 t) (pr2_head_1 c u t2 H0 (Flat f) t))) in H1))) +(\lambda (t2: T).(\lambda (H0: (pr2 c t t2)).(let H1 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t | (TLRef _) \Rightarrow t | (THead _ _ t0) \Rightarrow t0])) +(THead (Flat f) u t) (THead (Flat f) u t2) (H (THead (Flat f) u t2) +(pr2_head_2 c u t t2 (Flat f) (pr2_cflat c t t2 H0 f u)))) in H1)))))))). + +theorem nf2_gen__aux: + \forall (b: B).(\forall (x: T).(\forall (u: T).(\forall (d: nat).((eq T +(THead (Bind b) u (lift (S O) d x)) x) \to (\forall (P: Prop).P))))) +\def + \lambda (b: B).(\lambda (x: T).(T_ind (\lambda (t: T).(\forall (u: +T).(\forall (d: nat).((eq T (THead (Bind b) u (lift (S O) d t)) t) \to +(\forall (P: Prop).P))))) (\lambda (n: nat).(\lambda (u: T).(\lambda (d: +nat).(\lambda (H: (eq T (THead (Bind b) u (lift (S O) d (TSort n))) (TSort +n))).(\lambda (P: Prop).(let H0 \def (eq_ind T (THead (Bind b) u (lift (S O) +d (TSort n))) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ +_) \Rightarrow True])) I (TSort n) H) in (False_ind P H0))))))) (\lambda (n: +nat).(\lambda (u: T).(\lambda (d: nat).(\lambda (H: (eq T (THead (Bind b) u +(lift (S O) d (TLRef n))) (TLRef n))).(\lambda (P: Prop).(let H0 \def (eq_ind +T (THead (Bind b) u (lift (S O) d (TLRef n))) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n) H) in +(False_ind P H0))))))) (\lambda (k: K).(\lambda (t: T).(\lambda (_: ((\forall +(u: T).(\forall (d: nat).((eq T (THead (Bind b) u (lift (S O) d t)) t) \to +(\forall (P: Prop).P)))))).(\lambda (t0: T).(\lambda (H0: ((\forall (u: +T).(\forall (d: nat).((eq T (THead (Bind b) u (lift (S O) d t0)) t0) \to +(\forall (P: Prop).P)))))).(\lambda (u: T).(\lambda (d: nat).(\lambda (H1: +(eq T (THead (Bind b) u (lift (S O) d (THead k t t0))) (THead k t +t0))).(\lambda (P: Prop).(let H2 \def (f_equal T K (\lambda (e: T).(match e +in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow (Bind b) | (TLRef +_) \Rightarrow (Bind b) | (THead k0 _ _) \Rightarrow k0])) (THead (Bind b) u +(lift (S O) d (THead k t t0))) (THead k t t0) H1) in ((let H3 \def (f_equal T +T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u | (TLRef _) \Rightarrow u | (THead _ t1 _) \Rightarrow t1])) +(THead (Bind b) u (lift (S O) d (THead k t t0))) (THead k t t0) H1) in ((let +H4 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow (THead k ((let rec lref_map (f: ((nat \to nat))) +(d0: nat) (t1: T) on t1: T \def (match t1 with [(TSort n) \Rightarrow (TSort +n) | (TLRef i) \Rightarrow (TLRef (match (blt i d0) with [true \Rightarrow i +| false \Rightarrow (f i)])) | (THead k0 u0 t2) \Rightarrow (THead k0 +(lref_map f d0 u0) (lref_map f (s k0 d0) t2))]) in lref_map) (\lambda (x0: +nat).(plus x0 (S O))) d t) ((let rec lref_map (f: ((nat \to nat))) (d0: nat) +(t1: T) on t1: T \def (match t1 with [(TSort n) \Rightarrow (TSort n) | +(TLRef i) \Rightarrow (TLRef (match (blt i d0) with [true \Rightarrow i | +false \Rightarrow (f i)])) | (THead k0 u0 t2) \Rightarrow (THead k0 (lref_map +f d0 u0) (lref_map f (s k0 d0) t2))]) in lref_map) (\lambda (x0: nat).(plus +x0 (S O))) (s k d) t0)) | (TLRef _) \Rightarrow (THead k ((let rec lref_map +(f: ((nat \to nat))) (d0: nat) (t1: T) on t1: T \def (match t1 with [(TSort +n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d0) +with [true \Rightarrow i | false \Rightarrow (f i)])) | (THead k0 u0 t2) +\Rightarrow (THead k0 (lref_map f d0 u0) (lref_map f (s k0 d0) t2))]) in +lref_map) (\lambda (x0: nat).(plus x0 (S O))) d t) ((let rec lref_map (f: +((nat \to nat))) (d0: nat) (t1: T) on t1: T \def (match t1 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d0) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k0 u0 t2) +\Rightarrow (THead k0 (lref_map f d0 u0) (lref_map f (s k0 d0) t2))]) in +lref_map) (\lambda (x0: nat).(plus x0 (S O))) (s k d) t0)) | (THead _ _ t1) +\Rightarrow t1])) (THead (Bind b) u (lift (S O) d (THead k t t0))) (THead k t +t0) H1) in (\lambda (_: (eq T u t)).(\lambda (H6: (eq K (Bind b) k)).(let H7 +\def (eq_ind_r K k (\lambda (k0: K).(eq T (lift (S O) d (THead k0 t t0)) t0)) +H4 (Bind b) H6) in (let H8 \def (eq_ind T (lift (S O) d (THead (Bind b) t +t0)) (\lambda (t1: T).(eq T t1 t0)) H7 (THead (Bind b) (lift (S O) d t) (lift +(S O) (S d) t0)) (lift_bind b t t0 (S O) d)) in (H0 (lift (S O) d t) (S d) H8 +P)))))) H3)) H2))))))))))) x)). + +theorem nf2_gen_abbr: + \forall (c: C).(\forall (u: T).(\forall (t: T).((nf2 c (THead (Bind Abbr) u +t)) \to (\forall (P: Prop).P)))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: ((\forall (t2: +T).((pr2 c (THead (Bind Abbr) u t) t2) \to (eq T (THead (Bind Abbr) u t) +t2))))).(\lambda (P: Prop).(let H_x \def (dnf_dec u t O) in (let H0 \def H_x +in (ex_ind T (\lambda (v: T).(or (subst0 O u t (lift (S O) O v)) (eq T t +(lift (S O) O v)))) P (\lambda (x: T).(\lambda (H1: (or (subst0 O u t (lift +(S O) O x)) (eq T t (lift (S O) O x)))).(or_ind (subst0 O u t (lift (S O) O +x)) (eq T t (lift (S O) O x)) P (\lambda (H2: (subst0 O u t (lift (S O) O +x))).(let H3 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda +(_: T).T) with [(TSort _) \Rightarrow t | (TLRef _) \Rightarrow t | (THead _ +_ t0) \Rightarrow t0])) (THead (Bind Abbr) u t) (THead (Bind Abbr) u (lift (S +O) O x)) (H (THead (Bind Abbr) u (lift (S O) O x)) (pr2_free c (THead (Bind +Abbr) u t) (THead (Bind Abbr) u (lift (S O) O x)) (pr0_delta u u (pr0_refl u) +t t (pr0_refl t) (lift (S O) O x) H2)))) in (let H4 \def (eq_ind T t (\lambda +(t0: T).(subst0 O u t0 (lift (S O) O x))) H2 (lift (S O) O x) H3) in +(subst0_refl u (lift (S O) O x) O H4 P)))) (\lambda (H2: (eq T t (lift (S O) +O x))).(let H3 \def (eq_ind T t (\lambda (t0: T).(\forall (t2: T).((pr2 c +(THead (Bind Abbr) u t0) t2) \to (eq T (THead (Bind Abbr) u t0) t2)))) H +(lift (S O) O x) H2) in (nf2_gen__aux Abbr x u O (H3 x (pr2_free c (THead +(Bind Abbr) u (lift (S O) O x)) x (pr0_zeta Abbr not_abbr_abst x x (pr0_refl +x) u))) P))) H1))) H0))))))). + +theorem nf2_gen_void: + \forall (c: C).(\forall (u: T).(\forall (t: T).((nf2 c (THead (Bind Void) u +(lift (S O) O t))) \to (\forall (P: Prop).P)))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: ((\forall (t2: +T).((pr2 c (THead (Bind Void) u (lift (S O) O t)) t2) \to (eq T (THead (Bind +Void) u (lift (S O) O t)) t2))))).(\lambda (P: Prop).(nf2_gen__aux Void t u O +(H t (pr2_free c (THead (Bind Void) u (lift (S O) O t)) t (pr0_zeta Void +not_void_abst t t (pr0_refl t) u))) P))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/iso.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/iso.ma new file mode 100644 index 000000000..54b097c04 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/iso.ma @@ -0,0 +1,129 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/nf2/iso". + +include "nf2/pr3.ma". + +include "pr3/fwd.ma". + +include "iso/props.ma". + +theorem nf2_iso_appls_lref: + \forall (c: C).(\forall (i: nat).((nf2 c (TLRef i)) \to (\forall (vs: +TList).(\forall (u: T).((pr3 c (THeads (Flat Appl) vs (TLRef i)) u) \to (iso +(THeads (Flat Appl) vs (TLRef i)) u)))))) +\def + \lambda (c: C).(\lambda (i: nat).(\lambda (H: (nf2 c (TLRef i))).(\lambda +(vs: TList).(TList_ind (\lambda (t: TList).(\forall (u: T).((pr3 c (THeads +(Flat Appl) t (TLRef i)) u) \to (iso (THeads (Flat Appl) t (TLRef i)) u)))) +(\lambda (u: T).(\lambda (H0: (pr3 c (TLRef i) u)).(let H_y \def +(nf2_pr3_unfold c (TLRef i) u H0 H) in (let H1 \def (eq_ind_r T u (\lambda +(t: T).(pr3 c (TLRef i) t)) H0 (TLRef i) H_y) in (eq_ind T (TLRef i) (\lambda +(t: T).(iso (TLRef i) t)) (iso_refl (TLRef i)) u H_y))))) (\lambda (t: +T).(\lambda (t0: TList).(\lambda (H0: ((\forall (u: T).((pr3 c (THeads (Flat +Appl) t0 (TLRef i)) u) \to (iso (THeads (Flat Appl) t0 (TLRef i)) +u))))).(\lambda (u: T).(\lambda (H1: (pr3 c (THead (Flat Appl) t (THeads +(Flat Appl) t0 (TLRef i))) u)).(let H2 \def (pr3_gen_appl c t (THeads (Flat +Appl) t0 (TLRef i)) u H1) in (or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T u (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c t u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) +t0 (TLRef i)) t2)))) (ex4_4 T T T T (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (t2: T).(pr3 c (THead (Bind Abbr) u2 t2) u))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))))) (\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat +Appl) t0 (TLRef i)) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u0: +T).(pr3 (CHead c (Bind b) u0) z1 t2)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat +Appl) t0 (TLRef i)) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: +T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) +u))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) +y2) z1 z2)))))))) (iso (THead (Flat Appl) t (THeads (Flat Appl) t0 (TLRef +i))) u) (\lambda (H3: (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T u +(THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))) +(\lambda (_: T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) +t2))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t2: T).(eq T u (THead (Flat +Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))) (\lambda (_: +T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) t2))) (iso +(THead (Flat Appl) t (THeads (Flat Appl) t0 (TLRef i))) u) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H4: (eq T u (THead (Flat Appl) x0 +x1))).(\lambda (_: (pr3 c t x0)).(\lambda (_: (pr3 c (THeads (Flat Appl) t0 +(TLRef i)) x1)).(eq_ind_r T (THead (Flat Appl) x0 x1) (\lambda (t1: T).(iso +(THead (Flat Appl) t (THeads (Flat Appl) t0 (TLRef i))) t1)) (iso_head t x0 +(THeads (Flat Appl) t0 (TLRef i)) x1 (Flat Appl)) u H4)))))) H3)) (\lambda +(H3: (ex4_4 T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t2: T).(pr3 c (THead (Bind Abbr) u2 t2) u))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))))) (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat +Appl) t0 (TLRef i)) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u0: +T).(pr3 (CHead c (Bind b) u0) z1 t2))))))))).(ex4_4_ind T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(pr3 c (THead (Bind +Abbr) u2 t2) u))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c t u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(t2: T).(\forall (b: B).(\forall (u0: T).(pr3 (CHead c (Bind b) u0) z1 +t2))))))) (iso (THead (Flat Appl) t (THeads (Flat Appl) t0 (TLRef i))) u) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda +(_: (pr3 c (THead (Bind Abbr) x2 x3) u)).(\lambda (_: (pr3 c t x2)).(\lambda +(H6: (pr3 c (THeads (Flat Appl) t0 (TLRef i)) (THead (Bind Abst) x0 +x1))).(\lambda (_: ((\forall (b: B).(\forall (u0: T).(pr3 (CHead c (Bind b) +u0) x1 x3))))).(let H_y \def (H0 (THead (Bind Abst) x0 x1) H6) in +(iso_flats_lref_bind_false Appl Abst i x0 x1 t0 H_y (iso (THead (Flat Appl) t +(THeads (Flat Appl) t0 (TLRef i))) u))))))))))) H3)) (\lambda (H3: (ex6_6 B T +T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda +(u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift +(S O) O u2) z2)) u))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 +(CHead c (Bind b) y2) z1 z2))))))))).(ex6_6_ind B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat +Appl) t0 (TLRef i)) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: +T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) +u))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) +y2) z1 z2))))))) (iso (THead (Flat Appl) t (THeads (Flat Appl) t0 (TLRef i))) +u) (\lambda (x0: B).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (_: (not (eq B x0 +Abst))).(\lambda (H5: (pr3 c (THeads (Flat Appl) t0 (TLRef i)) (THead (Bind +x0) x1 x2))).(\lambda (_: (pr3 c (THead (Bind x0) x5 (THead (Flat Appl) (lift +(S O) O x4) x3)) u)).(\lambda (_: (pr3 c t x4)).(\lambda (_: (pr3 c x1 +x5)).(\lambda (_: (pr3 (CHead c (Bind x0) x5) x2 x3)).(let H_y \def (H0 +(THead (Bind x0) x1 x2) H5) in (iso_flats_lref_bind_false Appl x0 i x1 x2 t0 +H_y (iso (THead (Flat Appl) t (THeads (Flat Appl) t0 (TLRef i))) +u))))))))))))))) H3)) H2))))))) vs)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/lift1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/lift1.ma new file mode 100644 index 000000000..33c44778d --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/lift1.ma @@ -0,0 +1,84 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/nf2/lift1". + +include "nf2/props.ma". + +include "drop1/defs.ma". + +theorem nf2_lift1: + \forall (e: C).(\forall (hds: PList).(\forall (c: C).(\forall (t: T).((drop1 +hds c e) \to ((nf2 e t) \to (nf2 c (lift1 hds t))))))) +\def + \lambda (e: C).(\lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall +(c: C).(\forall (t: T).((drop1 p c e) \to ((nf2 e t) \to (nf2 c (lift1 p +t))))))) (\lambda (c: C).(\lambda (t: T).(\lambda (H: (drop1 PNil c +e)).(\lambda (H0: (nf2 e t)).(let H1 \def (match H in drop1 return (\lambda +(p: PList).(\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (drop1 p c0 +c1)).((eq PList p PNil) \to ((eq C c0 c) \to ((eq C c1 e) \to (nf2 c +t)))))))) with [(drop1_nil c0) \Rightarrow (\lambda (_: (eq PList PNil +PNil)).(\lambda (H2: (eq C c0 c)).(\lambda (H3: (eq C c0 e)).(eq_ind C c +(\lambda (c1: C).((eq C c1 e) \to (nf2 c t))) (\lambda (H4: (eq C c +e)).(eq_ind C e (\lambda (c1: C).(nf2 c1 t)) H0 c (sym_eq C c e H4))) c0 +(sym_eq C c0 c H2) H3)))) | (drop1_cons c1 c2 h d H1 c3 hds0 H2) \Rightarrow +(\lambda (H3: (eq PList (PCons h d hds0) PNil)).(\lambda (H4: (eq C c1 +c)).(\lambda (H5: (eq C c3 e)).((let H6 \def (eq_ind PList (PCons h d hds0) +(\lambda (e0: PList).(match e0 in PList return (\lambda (_: PList).Prop) with +[PNil \Rightarrow False | (PCons _ _ _) \Rightarrow True])) I PNil H3) in +(False_ind ((eq C c1 c) \to ((eq C c3 e) \to ((drop h d c1 c2) \to ((drop1 +hds0 c2 c3) \to (nf2 c t))))) H6)) H4 H5 H1 H2))))]) in (H1 (refl_equal PList +PNil) (refl_equal C c) (refl_equal C e))))))) (\lambda (n: nat).(\lambda (n0: +nat).(\lambda (p: PList).(\lambda (H: ((\forall (c: C).(\forall (t: +T).((drop1 p c e) \to ((nf2 e t) \to (nf2 c (lift1 p t)))))))).(\lambda (c: +C).(\lambda (t: T).(\lambda (H0: (drop1 (PCons n n0 p) c e)).(\lambda (H1: +(nf2 e t)).(let H2 \def (match H0 in drop1 return (\lambda (p0: +PList).(\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (drop1 p0 c0 c1)).((eq +PList p0 (PCons n n0 p)) \to ((eq C c0 c) \to ((eq C c1 e) \to (nf2 c (lift n +n0 (lift1 p t)))))))))) with [(drop1_nil c0) \Rightarrow (\lambda (H2: (eq +PList PNil (PCons n n0 p))).(\lambda (H3: (eq C c0 c)).(\lambda (H4: (eq C c0 +e)).((let H5 \def (eq_ind PList PNil (\lambda (e0: PList).(match e0 in PList +return (\lambda (_: PList).Prop) with [PNil \Rightarrow True | (PCons _ _ _) +\Rightarrow False])) I (PCons n n0 p) H2) in (False_ind ((eq C c0 c) \to ((eq +C c0 e) \to (nf2 c (lift n n0 (lift1 p t))))) H5)) H3 H4)))) | (drop1_cons c1 +c2 h d H2 c3 hds0 H3) \Rightarrow (\lambda (H4: (eq PList (PCons h d hds0) +(PCons n n0 p))).(\lambda (H5: (eq C c1 c)).(\lambda (H6: (eq C c3 e)).((let +H7 \def (f_equal PList PList (\lambda (e0: PList).(match e0 in PList return +(\lambda (_: PList).PList) with [PNil \Rightarrow hds0 | (PCons _ _ p0) +\Rightarrow p0])) (PCons h d hds0) (PCons n n0 p) H4) in ((let H8 \def +(f_equal PList nat (\lambda (e0: PList).(match e0 in PList return (\lambda +(_: PList).nat) with [PNil \Rightarrow d | (PCons _ n1 _) \Rightarrow n1])) +(PCons h d hds0) (PCons n n0 p) H4) in ((let H9 \def (f_equal PList nat +(\lambda (e0: PList).(match e0 in PList return (\lambda (_: PList).nat) with +[PNil \Rightarrow h | (PCons n1 _ _) \Rightarrow n1])) (PCons h d hds0) +(PCons n n0 p) H4) in (eq_ind nat n (\lambda (n1: nat).((eq nat d n0) \to +((eq PList hds0 p) \to ((eq C c1 c) \to ((eq C c3 e) \to ((drop n1 d c1 c2) +\to ((drop1 hds0 c2 c3) \to (nf2 c (lift n n0 (lift1 p t)))))))))) (\lambda +(H10: (eq nat d n0)).(eq_ind nat n0 (\lambda (n1: nat).((eq PList hds0 p) \to +((eq C c1 c) \to ((eq C c3 e) \to ((drop n n1 c1 c2) \to ((drop1 hds0 c2 c3) +\to (nf2 c (lift n n0 (lift1 p t))))))))) (\lambda (H11: (eq PList hds0 +p)).(eq_ind PList p (\lambda (p0: PList).((eq C c1 c) \to ((eq C c3 e) \to +((drop n n0 c1 c2) \to ((drop1 p0 c2 c3) \to (nf2 c (lift n n0 (lift1 p +t)))))))) (\lambda (H12: (eq C c1 c)).(eq_ind C c (\lambda (c0: C).((eq C c3 +e) \to ((drop n n0 c0 c2) \to ((drop1 p c2 c3) \to (nf2 c (lift n n0 (lift1 p +t))))))) (\lambda (H13: (eq C c3 e)).(eq_ind C e (\lambda (c0: C).((drop n n0 +c c2) \to ((drop1 p c2 c0) \to (nf2 c (lift n n0 (lift1 p t)))))) (\lambda +(H14: (drop n n0 c c2)).(\lambda (H15: (drop1 p c2 e)).(nf2_lift c2 (lift1 p +t) (H c2 t H15 H1) c n n0 H14))) c3 (sym_eq C c3 e H13))) c1 (sym_eq C c1 c +H12))) hds0 (sym_eq PList hds0 p H11))) d (sym_eq nat d n0 H10))) h (sym_eq +nat h n H9))) H8)) H7)) H5 H6 H2 H3))))]) in (H2 (refl_equal PList (PCons n +n0 p)) (refl_equal C c) (refl_equal C e))))))))))) hds)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/pr3.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/pr3.ma new file mode 100644 index 000000000..2206469dc --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/pr3.ma @@ -0,0 +1,52 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/nf2/pr3". + +include "nf2/defs.ma". + +include "pr3/pr3.ma". + +theorem nf2_pr3_unfold: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t1 t2) \to ((nf2 c +t1) \to (eq T t1 t2))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c t1 +t2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).((nf2 c t) \to (eq T t +t0)))) (\lambda (t: T).(\lambda (H0: (nf2 c t)).(H0 t (pr2_free c t t +(pr0_refl t))))) (\lambda (t0: T).(\lambda (t3: T).(\lambda (H0: (pr2 c t3 +t0)).(\lambda (t4: T).(\lambda (_: (pr3 c t0 t4)).(\lambda (H2: (((nf2 c t0) +\to (eq T t0 t4)))).(\lambda (H3: (nf2 c t3)).(let H4 \def H3 in (let H5 \def +(eq_ind T t3 (\lambda (t: T).(nf2 c t)) H3 t0 (H4 t0 H0)) in (let H6 \def +(eq_ind T t3 (\lambda (t: T).(pr2 c t t0)) H0 t0 (H4 t0 H0)) in (eq_ind_r T +t0 (\lambda (t: T).(eq T t t4)) (H2 H5) t3 (H4 t0 H0)))))))))))) t1 t2 H)))). + +theorem nf2_pr3_confluence: + \forall (c: C).(\forall (t1: T).((nf2 c t1) \to (\forall (t2: T).((nf2 c t2) +\to (\forall (t: T).((pr3 c t t1) \to ((pr3 c t t2) \to (eq T t1 t2)))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (H: (nf2 c t1)).(\lambda (t2: +T).(\lambda (H0: (nf2 c t2)).(\lambda (t: T).(\lambda (H1: (pr3 c t +t1)).(\lambda (H2: (pr3 c t t2)).(ex2_ind T (\lambda (t0: T).(pr3 c t2 t0)) +(\lambda (t0: T).(pr3 c t1 t0)) (eq T t1 t2) (\lambda (x: T).(\lambda (H3: +(pr3 c t2 x)).(\lambda (H4: (pr3 c t1 x)).(let H_y \def (nf2_pr3_unfold c t1 +x H4 H) in (let H5 \def (eq_ind_r T x (\lambda (t0: T).(pr3 c t1 t0)) H4 t1 +H_y) in (let H6 \def (eq_ind_r T x (\lambda (t0: T).(pr3 c t2 t0)) H3 t1 H_y) +in (let H_y0 \def (nf2_pr3_unfold c t2 t1 H6 H0) in (let H7 \def (eq_ind T t2 +(\lambda (t0: T).(pr3 c t0 t1)) H6 t1 H_y0) in (eq_ind_r T t1 (\lambda (t0: +T).(eq T t1 t0)) (refl_equal T t1) t2 H_y0))))))))) (pr3_confluence c t t2 H2 +t1 H1))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/props.ma new file mode 100644 index 000000000..499cd5fdc --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/props.ma @@ -0,0 +1,237 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/nf2/props". + +include "nf2/defs.ma". + +include "pr2/fwd.ma". + +theorem nf2_sort: + \forall (c: C).(\forall (n: nat).(nf2 c (TSort n))) +\def + \lambda (c: C).(\lambda (n: nat).(\lambda (t2: T).(\lambda (H: (pr2 c (TSort +n) t2)).(eq_ind_r T (TSort n) (\lambda (t: T).(eq T (TSort n) t)) (refl_equal +T (TSort n)) t2 (pr2_gen_sort c t2 n H))))). + +theorem nf2_csort_lref: + \forall (n: nat).(\forall (i: nat).(nf2 (CSort n) (TLRef i))) +\def + \lambda (n: nat).(\lambda (i: nat).(\lambda (t2: T).(\lambda (H: (pr2 (CSort +n) (TLRef i) t2)).(let H0 \def (pr2_gen_lref (CSort n) t2 i H) in (or_ind (eq +T t2 (TLRef i)) (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i (CSort n) +(CHead d (Bind Abbr) u)))) (\lambda (_: C).(\lambda (u: T).(eq T t2 (lift (S +i) O u))))) (eq T (TLRef i) t2) (\lambda (H1: (eq T t2 (TLRef i))).(eq_ind_r +T (TLRef i) (\lambda (t: T).(eq T (TLRef i) t)) (refl_equal T (TLRef i)) t2 +H1)) (\lambda (H1: (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl i (CSort +n) (CHead d (Bind Abbr) u)))) (\lambda (_: C).(\lambda (u: T).(eq T t2 (lift +(S i) O u)))))).(ex2_2_ind C T (\lambda (d: C).(\lambda (u: T).(getl i (CSort +n) (CHead d (Bind Abbr) u)))) (\lambda (_: C).(\lambda (u: T).(eq T t2 (lift +(S i) O u)))) (eq T (TLRef i) t2) (\lambda (x0: C).(\lambda (x1: T).(\lambda +(H2: (getl i (CSort n) (CHead x0 (Bind Abbr) x1))).(\lambda (H3: (eq T t2 +(lift (S i) O x1))).(eq_ind_r T (lift (S i) O x1) (\lambda (t: T).(eq T +(TLRef i) t)) (getl_gen_sort n i (CHead x0 (Bind Abbr) x1) H2 (eq T (TLRef i) +(lift (S i) O x1))) t2 H3))))) H1)) H0))))). + +theorem nf2_abst: + \forall (c: C).(\forall (u: T).((nf2 c u) \to (\forall (b: B).(\forall (v: +T).(\forall (t: T).((nf2 (CHead c (Bind b) v) t) \to (nf2 c (THead (Bind +Abst) u t)))))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (H: ((\forall (t2: T).((pr2 c u t2) +\to (eq T u t2))))).(\lambda (b: B).(\lambda (v: T).(\lambda (t: T).(\lambda +(H0: ((\forall (t2: T).((pr2 (CHead c (Bind b) v) t t2) \to (eq T t +t2))))).(\lambda (t2: T).(\lambda (H1: (pr2 c (THead (Bind Abst) u t) +t2)).(let H2 \def (pr2_gen_abst c u t t2 H1) in (ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind Abst) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b0: B).(\forall (u0: T).(pr2 (CHead c (Bind b0) u0) t t3))))) (eq T (THead +(Bind Abst) u t) t2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H3: (eq T t2 +(THead (Bind Abst) x0 x1))).(\lambda (H4: (pr2 c u x0)).(\lambda (H5: +((\forall (b0: B).(\forall (u0: T).(pr2 (CHead c (Bind b0) u0) t +x1))))).(eq_ind_r T (THead (Bind Abst) x0 x1) (\lambda (t0: T).(eq T (THead +(Bind Abst) u t) t0)) (f_equal3 K T T T THead (Bind Abst) (Bind Abst) u x0 t +x1 (refl_equal K (Bind Abst)) (H x0 H4) (H0 x1 (H5 b v))) t2 H3)))))) +H2)))))))))). + +theorem nf2_abst_shift: + \forall (c: C).(\forall (u: T).((nf2 c u) \to (\forall (t: T).((nf2 (CHead c +(Bind Abst) u) t) \to (nf2 c (THead (Bind Abst) u t)))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (H: ((\forall (t2: T).((pr2 c u t2) +\to (eq T u t2))))).(\lambda (t: T).(\lambda (H0: ((\forall (t2: T).((pr2 +(CHead c (Bind Abst) u) t t2) \to (eq T t t2))))).(\lambda (t2: T).(\lambda +(H1: (pr2 c (THead (Bind Abst) u t) t2)).(let H2 \def (pr2_gen_abst c u t t2 +H1) in (ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind +Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u u2))) (\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) t t3))))) (eq T (THead (Bind Abst) u t) t2) (\lambda (x0: T).(\lambda +(x1: T).(\lambda (H3: (eq T t2 (THead (Bind Abst) x0 x1))).(\lambda (H4: (pr2 +c u x0)).(\lambda (H5: ((\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t x1))))).(eq_ind_r T (THead (Bind Abst) x0 x1) (\lambda (t0: T).(eq T +(THead (Bind Abst) u t) t0)) (f_equal3 K T T T THead (Bind Abst) (Bind Abst) +u x0 t x1 (refl_equal K (Bind Abst)) (H x0 H4) (H0 x1 (H5 Abst u))) t2 +H3)))))) H2)))))))). + +theorem nf2_appl_lref: + \forall (c: C).(\forall (u: T).((nf2 c u) \to (\forall (i: nat).((nf2 c +(TLRef i)) \to (nf2 c (THead (Flat Appl) u (TLRef i))))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (H: ((\forall (t2: T).((pr2 c u t2) +\to (eq T u t2))))).(\lambda (i: nat).(\lambda (H0: ((\forall (t2: T).((pr2 c +(TLRef i) t2) \to (eq T (TLRef i) t2))))).(\lambda (t2: T).(\lambda (H1: (pr2 +c (THead (Flat Appl) u (TLRef i)) t2)).(let H2 \def (pr2_gen_appl c u (TLRef +i) t2 H1) in (or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 +(THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c (TLRef i) t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(TLRef i) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (TLRef i) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq +T t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) +(eq T (THead (Flat Appl) u (TLRef i)) t2) (\lambda (H3: (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(TLRef i) t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 +(THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c (TLRef i) t3))) (eq T (THead (Flat +Appl) u (TLRef i)) t2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T +t2 (THead (Flat Appl) x0 x1))).(\lambda (H5: (pr2 c u x0)).(\lambda (H6: (pr2 +c (TLRef i) x1)).(eq_ind_r T (THead (Flat Appl) x0 x1) (\lambda (t: T).(eq T +(THead (Flat Appl) u (TLRef i)) t)) (let H7 \def (eq_ind_r T x1 (\lambda (t: +T).(pr2 c (TLRef i) t)) H6 (TLRef i) (H0 x1 H6)) in (eq_ind T (TLRef i) +(\lambda (t: T).(eq T (THead (Flat Appl) u (TLRef i)) (THead (Flat Appl) x0 +t))) (let H8 \def (eq_ind_r T x0 (\lambda (t: T).(pr2 c u t)) H5 u (H x0 H5)) +in (eq_ind T u (\lambda (t: T).(eq T (THead (Flat Appl) u (TLRef i)) (THead +(Flat Appl) t (TLRef i)))) (refl_equal T (THead (Flat Appl) u (TLRef i))) x0 +(H x0 H5))) x1 (H0 x1 H6))) t2 H4)))))) H3)) (\lambda (H3: (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(TLRef i) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 +t3))))))))).(ex4_4_ind T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T (TLRef i) (THead (Bind Abst) y1 z1)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) z1 t3))))))) (eq T (THead (Flat Appl) u (TLRef i)) t2) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H4: (eq T +(TLRef i) (THead (Bind Abst) x0 x1))).(\lambda (H5: (eq T t2 (THead (Bind +Abbr) x2 x3))).(\lambda (_: (pr2 c u x2)).(\lambda (_: ((\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) x1 x3))))).(eq_ind_r T (THead +(Bind Abbr) x2 x3) (\lambda (t: T).(eq T (THead (Flat Appl) u (TLRef i)) t)) +(let H8 \def (eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead (Bind Abst) x0 +x1) H4) in (False_ind (eq T (THead (Flat Appl) u (TLRef i)) (THead (Bind +Abbr) x2 x3)) H8)) t2 H5))))))))) H3)) (\lambda (H3: (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(TLRef i) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 +z2))))))))).(ex6_6_ind B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (TLRef i) (THead (Bind b) y1 +z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: +T).(\lambda (u2: T).(\lambda (y2: T).(eq T t2 (THead (Bind b) y2 (THead (Flat +Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))) (eq T (THead (Flat Appl) u (TLRef i)) t2) +(\lambda (x0: B).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda +(x4: T).(\lambda (x5: T).(\lambda (_: (not (eq B x0 Abst))).(\lambda (H5: (eq +T (TLRef i) (THead (Bind x0) x1 x2))).(\lambda (H6: (eq T t2 (THead (Bind x0) +x5 (THead (Flat Appl) (lift (S O) O x4) x3)))).(\lambda (_: (pr2 c u +x4)).(\lambda (_: (pr2 c x1 x5)).(\lambda (_: (pr2 (CHead c (Bind x0) x5) x2 +x3)).(eq_ind_r T (THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) O x4) +x3)) (\lambda (t: T).(eq T (THead (Flat Appl) u (TLRef i)) t)) (let H10 \def +(eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead (Bind x0) x1 x2) H5) in +(False_ind (eq T (THead (Flat Appl) u (TLRef i)) (THead (Bind x0) x5 (THead +(Flat Appl) (lift (S O) O x4) x3))) H10)) t2 H6))))))))))))) H3)) H2)))))))). + +theorem nf2_lref_abst: + \forall (c: C).(\forall (e: C).(\forall (u: T).(\forall (i: nat).((getl i c +(CHead e (Bind Abst) u)) \to (nf2 c (TLRef i)))))) +\def + \lambda (c: C).(\lambda (e: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead e (Bind Abst) u))).(\lambda (t2: T).(\lambda (H0: (pr2 c +(TLRef i) t2)).(let H1 \def (pr2_gen_lref c t2 i H0) in (or_ind (eq T t2 +(TLRef i)) (ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i c (CHead d +(Bind Abbr) u0)))) (\lambda (_: C).(\lambda (u0: T).(eq T t2 (lift (S i) O +u0))))) (eq T (TLRef i) t2) (\lambda (H2: (eq T t2 (TLRef i))).(eq_ind_r T +(TLRef i) (\lambda (t: T).(eq T (TLRef i) t)) (refl_equal T (TLRef i)) t2 +H2)) (\lambda (H2: (ex2_2 C T (\lambda (d: C).(\lambda (u0: T).(getl i c +(CHead d (Bind Abbr) u0)))) (\lambda (_: C).(\lambda (u0: T).(eq T t2 (lift +(S i) O u0)))))).(ex2_2_ind C T (\lambda (d: C).(\lambda (u0: T).(getl i c +(CHead d (Bind Abbr) u0)))) (\lambda (_: C).(\lambda (u0: T).(eq T t2 (lift +(S i) O u0)))) (eq T (TLRef i) t2) (\lambda (x0: C).(\lambda (x1: T).(\lambda +(H3: (getl i c (CHead x0 (Bind Abbr) x1))).(\lambda (H4: (eq T t2 (lift (S i) +O x1))).(eq_ind_r T (lift (S i) O x1) (\lambda (t: T).(eq T (TLRef i) t)) +(let H5 \def (eq_ind C (CHead e (Bind Abst) u) (\lambda (c0: C).(getl i c +c0)) H (CHead x0 (Bind Abbr) x1) (getl_mono c (CHead e (Bind Abst) u) i H +(CHead x0 (Bind Abbr) x1) H3)) in (let H6 \def (eq_ind C (CHead e (Bind Abst) +u) (\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with [(CSort +_) \Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind b) \Rightarrow (match b in B return +(\lambda (_: B).Prop) with [Abbr \Rightarrow False | Abst \Rightarrow True | +Void \Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead x0 (Bind +Abbr) x1) (getl_mono c (CHead e (Bind Abst) u) i H (CHead x0 (Bind Abbr) x1) +H3)) in (False_ind (eq T (TLRef i) (lift (S i) O x1)) H6))) t2 H4))))) H2)) +H1)))))))). + +theorem nf2_lift: + \forall (d: C).(\forall (t: T).((nf2 d t) \to (\forall (c: C).(\forall (h: +nat).(\forall (i: nat).((drop h i c d) \to (nf2 c (lift h i t)))))))) +\def + \lambda (d: C).(\lambda (t: T).(\lambda (H: ((\forall (t2: T).((pr2 d t t2) +\to (eq T t t2))))).(\lambda (c: C).(\lambda (h: nat).(\lambda (i: +nat).(\lambda (H0: (drop h i c d)).(\lambda (t2: T).(\lambda (H1: (pr2 c +(lift h i t) t2)).(let H2 \def (pr2_gen_lift c t t2 h i H1 d H0) in (ex2_ind +T (\lambda (t3: T).(eq T t2 (lift h i t3))) (\lambda (t3: T).(pr2 d t t3)) +(eq T (lift h i t) t2) (\lambda (x: T).(\lambda (H3: (eq T t2 (lift h i +x))).(\lambda (H4: (pr2 d t x)).(eq_ind_r T (lift h i x) (\lambda (t0: T).(eq +T (lift h i t) t0)) (let H_y \def (H x H4) in (let H5 \def (eq_ind_r T x +(\lambda (t0: T).(pr2 d t t0)) H4 t H_y) in (eq_ind T t (\lambda (t0: T).(eq +T (lift h i t) (lift h i t0))) (refl_equal T (lift h i t)) x H_y))) t2 H3)))) +H2)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/defs.ma new file mode 100644 index 000000000..c81142f5d --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/defs.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc1/defs". + +include "pr1/defs.ma". + +definition pc1: + T \to (T \to Prop) +\def + \lambda (t1: T).(\lambda (t2: T).(ex2 T (\lambda (t: T).(pr1 t1 t)) (\lambda +(t: T).(pr1 t2 t)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/props.ma new file mode 100644 index 000000000..0bd48d44c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/props.ma @@ -0,0 +1,118 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc1/props". + +include "pc1/defs.ma". + +include "pr1/pr1.ma". + +theorem pc1_pr0_r: + \forall (t1: T).(\forall (t2: T).((pr0 t1 t2) \to (pc1 t1 t2))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr0 t1 t2)).(ex_intro2 T +(\lambda (t: T).(pr1 t1 t)) (\lambda (t: T).(pr1 t2 t)) t2 (pr1_pr0 t1 t2 H) +(pr1_refl t2)))). + +theorem pc1_pr0_x: + \forall (t1: T).(\forall (t2: T).((pr0 t2 t1) \to (pc1 t1 t2))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr0 t2 t1)).(ex_intro2 T +(\lambda (t: T).(pr1 t1 t)) (\lambda (t: T).(pr1 t2 t)) t1 (pr1_refl t1) +(pr1_pr0 t2 t1 H)))). + +theorem pc1_pr0_u: + \forall (t2: T).(\forall (t1: T).((pr0 t1 t2) \to (\forall (t3: T).((pc1 t2 +t3) \to (pc1 t1 t3))))) +\def + \lambda (t2: T).(\lambda (t1: T).(\lambda (H: (pr0 t1 t2)).(\lambda (t3: +T).(\lambda (H0: (pc1 t2 t3)).(let H1 \def H0 in (ex2_ind T (\lambda (t: +T).(pr1 t2 t)) (\lambda (t: T).(pr1 t3 t)) (pc1 t1 t3) (\lambda (x: +T).(\lambda (H2: (pr1 t2 x)).(\lambda (H3: (pr1 t3 x)).(ex_intro2 T (\lambda +(t: T).(pr1 t1 t)) (\lambda (t: T).(pr1 t3 t)) x (pr1_sing t2 t1 H x H2) +H3)))) H1)))))). + +theorem pc1_refl: + \forall (t: T).(pc1 t t) +\def + \lambda (t: T).(ex_intro2 T (\lambda (t0: T).(pr1 t t0)) (\lambda (t0: +T).(pr1 t t0)) t (pr1_refl t) (pr1_refl t)). + +theorem pc1_s: + \forall (t2: T).(\forall (t1: T).((pc1 t1 t2) \to (pc1 t2 t1))) +\def + \lambda (t2: T).(\lambda (t1: T).(\lambda (H: (pc1 t1 t2)).(let H0 \def H in +(ex2_ind T (\lambda (t: T).(pr1 t1 t)) (\lambda (t: T).(pr1 t2 t)) (pc1 t2 +t1) (\lambda (x: T).(\lambda (H1: (pr1 t1 x)).(\lambda (H2: (pr1 t2 +x)).(ex_intro2 T (\lambda (t: T).(pr1 t2 t)) (\lambda (t: T).(pr1 t1 t)) x H2 +H1)))) H0)))). + +theorem pc1_head_1: + \forall (u1: T).(\forall (u2: T).((pc1 u1 u2) \to (\forall (t: T).(\forall +(k: K).(pc1 (THead k u1 t) (THead k u2 t)))))) +\def + \lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pc1 u1 u2)).(\lambda (t: +T).(\lambda (k: K).(let H0 \def H in (ex2_ind T (\lambda (t0: T).(pr1 u1 t0)) +(\lambda (t0: T).(pr1 u2 t0)) (pc1 (THead k u1 t) (THead k u2 t)) (\lambda +(x: T).(\lambda (H1: (pr1 u1 x)).(\lambda (H2: (pr1 u2 x)).(ex_intro2 T +(\lambda (t0: T).(pr1 (THead k u1 t) t0)) (\lambda (t0: T).(pr1 (THead k u2 +t) t0)) (THead k x t) (pr1_head_1 u1 x H1 t k) (pr1_head_1 u2 x H2 t k))))) +H0)))))). + +theorem pc1_head_2: + \forall (t1: T).(\forall (t2: T).((pc1 t1 t2) \to (\forall (u: T).(\forall +(k: K).(pc1 (THead k u t1) (THead k u t2)))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc1 t1 t2)).(\lambda (u: +T).(\lambda (k: K).(let H0 \def H in (ex2_ind T (\lambda (t: T).(pr1 t1 t)) +(\lambda (t: T).(pr1 t2 t)) (pc1 (THead k u t1) (THead k u t2)) (\lambda (x: +T).(\lambda (H1: (pr1 t1 x)).(\lambda (H2: (pr1 t2 x)).(ex_intro2 T (\lambda +(t: T).(pr1 (THead k u t1) t)) (\lambda (t: T).(pr1 (THead k u t2) t)) (THead +k u x) (pr1_head_2 t1 x H1 u k) (pr1_head_2 t2 x H2 u k))))) H0)))))). + +theorem pc1_t: + \forall (t2: T).(\forall (t1: T).((pc1 t1 t2) \to (\forall (t3: T).((pc1 t2 +t3) \to (pc1 t1 t3))))) +\def + \lambda (t2: T).(\lambda (t1: T).(\lambda (H: (pc1 t1 t2)).(\lambda (t3: +T).(\lambda (H0: (pc1 t2 t3)).(let H1 \def H0 in (ex2_ind T (\lambda (t: +T).(pr1 t2 t)) (\lambda (t: T).(pr1 t3 t)) (pc1 t1 t3) (\lambda (x: +T).(\lambda (H2: (pr1 t2 x)).(\lambda (H3: (pr1 t3 x)).(let H4 \def H in +(ex2_ind T (\lambda (t: T).(pr1 t1 t)) (\lambda (t: T).(pr1 t2 t)) (pc1 t1 +t3) (\lambda (x0: T).(\lambda (H5: (pr1 t1 x0)).(\lambda (H6: (pr1 t2 +x0)).(ex2_ind T (\lambda (t: T).(pr1 x0 t)) (\lambda (t: T).(pr1 x t)) (pc1 +t1 t3) (\lambda (x1: T).(\lambda (H7: (pr1 x0 x1)).(\lambda (H8: (pr1 x +x1)).(ex_intro2 T (\lambda (t: T).(pr1 t1 t)) (\lambda (t: T).(pr1 t3 t)) x1 +(pr1_t x0 t1 H5 x1 H7) (pr1_t x t3 H3 x1 H8))))) (pr1_confluence t2 x0 H6 x +H2))))) H4))))) H1)))))). + +theorem pc1_pr0_u2: + \forall (t0: T).(\forall (t1: T).((pr0 t0 t1) \to (\forall (t2: T).((pc1 t0 +t2) \to (pc1 t1 t2))))) +\def + \lambda (t0: T).(\lambda (t1: T).(\lambda (H: (pr0 t0 t1)).(\lambda (t2: +T).(\lambda (H0: (pc1 t0 t2)).(pc1_t t0 t1 (pc1_pr0_x t1 t0 H) t2 H0))))). + +theorem pc1_head: + \forall (u1: T).(\forall (u2: T).((pc1 u1 u2) \to (\forall (t1: T).(\forall +(t2: T).((pc1 t1 t2) \to (\forall (k: K).(pc1 (THead k u1 t1) (THead k u2 +t2)))))))) +\def + \lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pc1 u1 u2)).(\lambda (t1: +T).(\lambda (t2: T).(\lambda (H0: (pc1 t1 t2)).(\lambda (k: K).(pc1_t (THead +k u2 t1) (THead k u1 t1) (pc1_head_1 u1 u2 H t1 k) (THead k u2 t2) +(pc1_head_2 t1 t2 H0 u2 k)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/dec.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/dec.ma new file mode 100644 index 000000000..01f4fc13b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/dec.ma @@ -0,0 +1,153 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/dec". + +include "ty3/arity_props.ma". + +include "ty3/pr3.ma". + +include "nf2/fwd.ma". + +theorem pc3_dec: + \forall (g: G).(\forall (c: C).(\forall (u1: T).(\forall (t1: T).((ty3 g c +u1 t1) \to (\forall (u2: T).(\forall (t2: T).((ty3 g c u2 t2) \to (or (pc3 c +u1 u2) ((pc3 c u1 u2) \to (\forall (P: Prop).P)))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda +(H: (ty3 g c u1 t1)).(\lambda (u2: T).(\lambda (t2: T).(\lambda (H0: (ty3 g c +u2 t2)).(let H_y \def (ty3_sn3 g c u1 t1 H) in (let H_y0 \def (ty3_sn3 g c u2 +t2 H0) in (let H_x \def (nf2_sn3 c u1 H_y) in (let H1 \def H_x in (ex2_ind T +(\lambda (u: T).(pr3 c u1 u)) (\lambda (u: T).(nf2 c u)) (or (pc3 c u1 u2) +((pc3 c u1 u2) \to (\forall (P: Prop).P))) (\lambda (x: T).(\lambda (H2: (pr3 +c u1 x)).(\lambda (H3: (nf2 c x)).(let H_x0 \def (nf2_sn3 c u2 H_y0) in (let +H4 \def H_x0 in (ex2_ind T (\lambda (u: T).(pr3 c u2 u)) (\lambda (u: T).(nf2 +c u)) (or (pc3 c u1 u2) ((pc3 c u1 u2) \to (\forall (P: Prop).P))) (\lambda +(x0: T).(\lambda (H5: (pr3 c u2 x0)).(\lambda (H6: (nf2 c x0)).(let H_x1 \def +(term_dec x x0) in (let H7 \def H_x1 in (or_ind (eq T x x0) ((eq T x x0) \to +(\forall (P: Prop).P)) (or (pc3 c u1 u2) ((pc3 c u1 u2) \to (\forall (P: +Prop).P))) (\lambda (H8: (eq T x x0)).(let H9 \def (eq_ind_r T x0 (\lambda +(t: T).(nf2 c t)) H6 x H8) in (let H10 \def (eq_ind_r T x0 (\lambda (t: +T).(pr3 c u2 t)) H5 x H8) in (or_introl (pc3 c u1 u2) ((pc3 c u1 u2) \to +(\forall (P: Prop).P)) (pc3_pr3_t c u1 x H2 u2 H10))))) (\lambda (H8: (((eq T +x x0) \to (\forall (P: Prop).P)))).(or_intror (pc3 c u1 u2) ((pc3 c u1 u2) +\to (\forall (P: Prop).P)) (\lambda (H9: (pc3 c u1 u2)).(\lambda (P: +Prop).(let H10 \def H9 in (ex2_ind T (\lambda (t: T).(pr3 c u1 t)) (\lambda +(t: T).(pr3 c u2 t)) P (\lambda (x1: T).(\lambda (H11: (pr3 c u1 +x1)).(\lambda (H12: (pr3 c u2 x1)).(let H_x2 \def (pr3_confluence c u2 x0 H5 +x1 H12) in (let H13 \def H_x2 in (ex2_ind T (\lambda (t: T).(pr3 c x0 t)) +(\lambda (t: T).(pr3 c x1 t)) P (\lambda (x2: T).(\lambda (H14: (pr3 c x0 +x2)).(\lambda (H15: (pr3 c x1 x2)).(let H_y1 \def (nf2_pr3_unfold c x0 x2 H14 +H6) in (let H16 \def (eq_ind_r T x2 (\lambda (t: T).(pr3 c x1 t)) H15 x0 +H_y1) in (let H17 \def (nf2_pr3_confluence c x H3 x0 H6 u1 H2) in (H8 (H17 +(pr3_t x1 u1 c H11 x0 H16)) P))))))) H13)))))) H10)))))) H7)))))) H4)))))) +H1)))))))))))). + +theorem pc3_abst_dec: + \forall (g: G).(\forall (c: C).(\forall (u1: T).(\forall (t1: T).((ty3 g c +u1 t1) \to (\forall (u2: T).(\forall (t2: T).((ty3 g c u2 t2) \to (or (ex4_2 +T T (\lambda (u: T).(\lambda (_: T).(pc3 c u1 (THead (Bind Abst) u2 u)))) +(\lambda (u: T).(\lambda (v2: T).(ty3 g c (THead (Bind Abst) v2 u) t1))) +(\lambda (_: T).(\lambda (v2: T).(pr3 c u2 v2))) (\lambda (_: T).(\lambda +(v2: T).(nf2 c v2)))) (\forall (u: T).((pc3 c u1 (THead (Bind Abst) u2 u)) +\to (\forall (P: Prop).P))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda +(H: (ty3 g c u1 t1)).(\lambda (u2: T).(\lambda (t2: T).(\lambda (H0: (ty3 g c +u2 t2)).(let H1 \def (ty3_sn3 g c u1 t1 H) in (let H2 \def (ty3_sn3 g c u2 t2 +H0) in (let H_x \def (nf2_sn3 c u1 H1) in (let H3 \def H_x in (ex2_ind T +(\lambda (u: T).(pr3 c u1 u)) (\lambda (u: T).(nf2 c u)) (or (ex4_2 T T +(\lambda (u: T).(\lambda (_: T).(pc3 c u1 (THead (Bind Abst) u2 u)))) +(\lambda (u: T).(\lambda (v2: T).(ty3 g c (THead (Bind Abst) v2 u) t1))) +(\lambda (_: T).(\lambda (v2: T).(pr3 c u2 v2))) (\lambda (_: T).(\lambda +(v2: T).(nf2 c v2)))) (\forall (u: T).((pc3 c u1 (THead (Bind Abst) u2 u)) +\to (\forall (P: Prop).P)))) (\lambda (x: T).(\lambda (H4: (pr3 c u1 +x)).(\lambda (H5: (nf2 c x)).(let H_x0 \def (nf2_sn3 c u2 H2) in (let H6 \def +H_x0 in (ex2_ind T (\lambda (u: T).(pr3 c u2 u)) (\lambda (u: T).(nf2 c u)) +(or (ex4_2 T T (\lambda (u: T).(\lambda (_: T).(pc3 c u1 (THead (Bind Abst) +u2 u)))) (\lambda (u: T).(\lambda (v2: T).(ty3 g c (THead (Bind Abst) v2 u) +t1))) (\lambda (_: T).(\lambda (v2: T).(pr3 c u2 v2))) (\lambda (_: +T).(\lambda (v2: T).(nf2 c v2)))) (\forall (u: T).((pc3 c u1 (THead (Bind +Abst) u2 u)) \to (\forall (P: Prop).P)))) (\lambda (x0: T).(\lambda (H7: (pr3 +c u2 x0)).(\lambda (H8: (nf2 c x0)).(let H_x1 \def (abst_dec x x0) in (let H9 +\def H_x1 in (or_ind (ex T (\lambda (t: T).(eq T x (THead (Bind Abst) x0 +t)))) (\forall (t: T).((eq T x (THead (Bind Abst) x0 t)) \to (\forall (P: +Prop).P))) (or (ex4_2 T T (\lambda (u: T).(\lambda (_: T).(pc3 c u1 (THead +(Bind Abst) u2 u)))) (\lambda (u: T).(\lambda (v2: T).(ty3 g c (THead (Bind +Abst) v2 u) t1))) (\lambda (_: T).(\lambda (v2: T).(pr3 c u2 v2))) (\lambda +(_: T).(\lambda (v2: T).(nf2 c v2)))) (\forall (u: T).((pc3 c u1 (THead (Bind +Abst) u2 u)) \to (\forall (P: Prop).P)))) (\lambda (H10: (ex T (\lambda (t: +T).(eq T x (THead (Bind Abst) x0 t))))).(ex_ind T (\lambda (t: T).(eq T x +(THead (Bind Abst) x0 t))) (or (ex4_2 T T (\lambda (u: T).(\lambda (_: +T).(pc3 c u1 (THead (Bind Abst) u2 u)))) (\lambda (u: T).(\lambda (v2: +T).(ty3 g c (THead (Bind Abst) v2 u) t1))) (\lambda (_: T).(\lambda (v2: +T).(pr3 c u2 v2))) (\lambda (_: T).(\lambda (v2: T).(nf2 c v2)))) (\forall +(u: T).((pc3 c u1 (THead (Bind Abst) u2 u)) \to (\forall (P: Prop).P)))) +(\lambda (x1: T).(\lambda (H11: (eq T x (THead (Bind Abst) x0 x1))).(let H12 +\def (eq_ind T x (\lambda (t: T).(nf2 c t)) H5 (THead (Bind Abst) x0 x1) H11) +in (let H13 \def (eq_ind T x (\lambda (t: T).(pr3 c u1 t)) H4 (THead (Bind +Abst) x0 x1) H11) in (or_introl (ex4_2 T T (\lambda (u: T).(\lambda (_: +T).(pc3 c u1 (THead (Bind Abst) u2 u)))) (\lambda (u: T).(\lambda (v2: +T).(ty3 g c (THead (Bind Abst) v2 u) t1))) (\lambda (_: T).(\lambda (v2: +T).(pr3 c u2 v2))) (\lambda (_: T).(\lambda (v2: T).(nf2 c v2)))) (\forall +(u: T).((pc3 c u1 (THead (Bind Abst) u2 u)) \to (\forall (P: Prop).P))) +(ex4_2_intro T T (\lambda (u: T).(\lambda (_: T).(pc3 c u1 (THead (Bind Abst) +u2 u)))) (\lambda (u: T).(\lambda (v2: T).(ty3 g c (THead (Bind Abst) v2 u) +t1))) (\lambda (_: T).(\lambda (v2: T).(pr3 c u2 v2))) (\lambda (_: +T).(\lambda (v2: T).(nf2 c v2))) x1 x0 (pc3_pr3_t c u1 (THead (Bind Abst) x0 +x1) H13 (THead (Bind Abst) u2 x1) (pr3_head_12 c u2 x0 H7 (Bind Abst) x1 x1 +(pr3_refl (CHead c (Bind Abst) x0) x1))) (ty3_sred_pr3 c u1 (THead (Bind +Abst) x0 x1) H13 g t1 H) H7 H8)))))) H10)) (\lambda (H10: ((\forall (t: +T).((eq T x (THead (Bind Abst) x0 t)) \to (\forall (P: +Prop).P))))).(or_intror (ex4_2 T T (\lambda (u: T).(\lambda (_: T).(pc3 c u1 +(THead (Bind Abst) u2 u)))) (\lambda (u: T).(\lambda (v2: T).(ty3 g c (THead +(Bind Abst) v2 u) t1))) (\lambda (_: T).(\lambda (v2: T).(pr3 c u2 v2))) +(\lambda (_: T).(\lambda (v2: T).(nf2 c v2)))) (\forall (u: T).((pc3 c u1 +(THead (Bind Abst) u2 u)) \to (\forall (P: Prop).P))) (\lambda (u: +T).(\lambda (H11: (pc3 c u1 (THead (Bind Abst) u2 u))).(\lambda (P: +Prop).(let H12 \def H11 in (ex2_ind T (\lambda (t: T).(pr3 c u1 t)) (\lambda +(t: T).(pr3 c (THead (Bind Abst) u2 u) t)) P (\lambda (x1: T).(\lambda (H13: +(pr3 c u1 x1)).(\lambda (H14: (pr3 c (THead (Bind Abst) u2 u) x1)).(ex2_ind T +(\lambda (t: T).(pr3 c x1 t)) (\lambda (t: T).(pr3 c x t)) P (\lambda (x2: +T).(\lambda (H15: (pr3 c x1 x2)).(\lambda (H16: (pr3 c x x2)).(let H_y \def +(nf2_pr3_unfold c x x2 H16 H5) in (let H17 \def (eq_ind_r T x2 (\lambda (t: +T).(pr3 c x1 t)) H15 x H_y) in (let H18 \def (pr3_gen_abst c u2 u x1 H14) in +(ex3_2_ind T T (\lambda (u3: T).(\lambda (t3: T).(eq T x1 (THead (Bind Abst) +u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c u2 u3))) (\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr3 (CHead c (Bind b) +u0) u t3))))) P (\lambda (x3: T).(\lambda (x4: T).(\lambda (H19: (eq T x1 +(THead (Bind Abst) x3 x4))).(\lambda (H20: (pr3 c u2 x3)).(\lambda (_: +((\forall (b: B).(\forall (u0: T).(pr3 (CHead c (Bind b) u0) u x4))))).(let +H22 \def (eq_ind T x1 (\lambda (t: T).(pr3 c t x)) H17 (THead (Bind Abst) x3 +x4) H19) in (let H23 \def (pr3_gen_abst c x3 x4 x H22) in (ex3_2_ind T T +(\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u3 t3)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c x3 u3))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b: B).(\forall (u0: T).(pr3 (CHead c (Bind b) u0) x4 +t3))))) P (\lambda (x5: T).(\lambda (x6: T).(\lambda (H24: (eq T x (THead +(Bind Abst) x5 x6))).(\lambda (H25: (pr3 c x3 x5)).(\lambda (_: ((\forall (b: +B).(\forall (u0: T).(pr3 (CHead c (Bind b) u0) x4 x6))))).(let H27 \def +(eq_ind T x (\lambda (t: T).(\forall (t0: T).((eq T t (THead (Bind Abst) x0 +t0)) \to (\forall (P0: Prop).P0)))) H10 (THead (Bind Abst) x5 x6) H24) in +(let H28 \def (eq_ind T x (\lambda (t: T).(nf2 c t)) H5 (THead (Bind Abst) x5 +x6) H24) in (let H29 \def (nf2_gen_abst c x5 x6 H28) in (and_ind (nf2 c x5) +(nf2 (CHead c (Bind Abst) x5) x6) P (\lambda (H30: (nf2 c x5)).(\lambda (_: +(nf2 (CHead c (Bind Abst) x5) x6)).(let H32 \def (nf2_pr3_confluence c x0 H8 +x5 H30 u2 H7) in (H27 x6 (sym_eq T (THead (Bind Abst) x0 x6) (THead (Bind +Abst) x5 x6) (f_equal3 K T T T THead (Bind Abst) (Bind Abst) x0 x5 x6 x6 +(refl_equal K (Bind Abst)) (H32 (pr3_t x3 u2 c H20 x5 H25)) (refl_equal T +x6))) P)))) H29))))))))) H23)))))))) H18))))))) (pr3_confluence c u1 x1 H13 x +H4))))) H12))))))) H9)))))) H6)))))) H3)))))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/defs.ma new file mode 100644 index 000000000..91d5eaf8b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/defs.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/defs". + +include "pr3/defs.ma". + +definition pc3: + C \to (T \to (T \to Prop)) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(ex2 T (\lambda (t: T).(pr3 +c t1 t)) (\lambda (t: T).(pr3 c t2 t))))). + +inductive pc3_left (c: C): T \to (T \to Prop) \def +| pc3_left_r: \forall (t: T).(pc3_left c t t) +| pc3_left_ur: \forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall +(t3: T).((pc3_left c t2 t3) \to (pc3_left c t1 t3))))) +| pc3_left_ux: \forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall +(t3: T).((pc3_left c t1 t3) \to (pc3_left c t2 t3))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fsubst0.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fsubst0.ma new file mode 100644 index 000000000..6ab7daf1c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fsubst0.ma @@ -0,0 +1,719 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/fsubst0". + +include "pc3/left.ma". + +include "fsubst0/defs.ma". + +include "csubst0/getl.ma". + +theorem pc3_pr2_fsubst0: + \forall (c1: C).(\forall (t1: T).(\forall (t: T).((pr2 c1 t1 t) \to (\forall +(i: nat).(\forall (u: T).(\forall (c2: C).(\forall (t2: T).((fsubst0 i u c1 +t1 c2 t2) \to (\forall (e: C).((getl i c1 (CHead e (Bind Abbr) u)) \to (pc3 +c2 t2 t))))))))))) +\def + \lambda (c1: C).(\lambda (t1: T).(\lambda (t: T).(\lambda (H: (pr2 c1 t1 +t)).(pr2_ind (\lambda (c: C).(\lambda (t0: T).(\lambda (t2: T).(\forall (i: +nat).(\forall (u: T).(\forall (c2: C).(\forall (t3: T).((fsubst0 i u c t0 c2 +t3) \to (\forall (e: C).((getl i c (CHead e (Bind Abbr) u)) \to (pc3 c2 t3 +t2))))))))))) (\lambda (c: C).(\lambda (t2: T).(\lambda (t3: T).(\lambda (H0: +(pr0 t2 t3)).(\lambda (i: nat).(\lambda (u: T).(\lambda (c2: C).(\lambda (t0: +T).(\lambda (H1: (fsubst0 i u c t2 c2 t0)).(fsubst0_ind i u c t2 (\lambda +(c0: C).(\lambda (t4: T).(\forall (e: C).((getl i c (CHead e (Bind Abbr) u)) +\to (pc3 c0 t4 t3))))) (\lambda (t4: T).(\lambda (H2: (subst0 i u t2 +t4)).(\lambda (e: C).(\lambda (H3: (getl i c (CHead e (Bind Abbr) +u))).(or_ind (pr0 t4 t3) (ex2 T (\lambda (w2: T).(pr0 t4 w2)) (\lambda (w2: +T).(subst0 i u t3 w2))) (pc3 c t4 t3) (\lambda (H4: (pr0 t4 t3)).(pc3_pr2_r c +t4 t3 (pr2_free c t4 t3 H4))) (\lambda (H4: (ex2 T (\lambda (w2: T).(pr0 t4 +w2)) (\lambda (w2: T).(subst0 i u t3 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 +t4 w2)) (\lambda (w2: T).(subst0 i u t3 w2)) (pc3 c t4 t3) (\lambda (x: +T).(\lambda (H5: (pr0 t4 x)).(\lambda (H6: (subst0 i u t3 x)).(pc3_pr2_u c x +t4 (pr2_free c t4 x H5) t3 (pc3_pr2_x c x t3 (pr2_delta c e u i H3 t3 t3 +(pr0_refl t3) x H6)))))) H4)) (pr0_subst0 t2 t3 H0 u t4 i H2 u (pr0_refl +u))))))) (\lambda (c0: C).(\lambda (_: (csubst0 i u c c0)).(\lambda (e: +C).(\lambda (_: (getl i c (CHead e (Bind Abbr) u))).(pc3_pr2_r c0 t2 t3 +(pr2_free c0 t2 t3 H0)))))) (\lambda (t4: T).(\lambda (H2: (subst0 i u t2 +t4)).(\lambda (c0: C).(\lambda (H3: (csubst0 i u c c0)).(\lambda (e: +C).(\lambda (H4: (getl i c (CHead e (Bind Abbr) u))).(or_ind (pr0 t4 t3) (ex2 +T (\lambda (w2: T).(pr0 t4 w2)) (\lambda (w2: T).(subst0 i u t3 w2))) (pc3 c0 +t4 t3) (\lambda (H5: (pr0 t4 t3)).(pc3_pr2_r c0 t4 t3 (pr2_free c0 t4 t3 +H5))) (\lambda (H5: (ex2 T (\lambda (w2: T).(pr0 t4 w2)) (\lambda (w2: +T).(subst0 i u t3 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 t4 w2)) (\lambda +(w2: T).(subst0 i u t3 w2)) (pc3 c0 t4 t3) (\lambda (x: T).(\lambda (H6: (pr0 +t4 x)).(\lambda (H7: (subst0 i u t3 x)).(pc3_pr2_u c0 x t4 (pr2_free c0 t4 x +H6) t3 (pc3_pr2_x c0 x t3 (pr2_delta c0 e u i (csubst0_getl_ge i i (le_n i) c +c0 u H3 (CHead e (Bind Abbr) u) H4) t3 t3 (pr0_refl t3) x H7)))))) H5)) +(pr0_subst0 t2 t3 H0 u t4 i H2 u (pr0_refl u))))))))) c2 t0 H1)))))))))) +(\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H0: (getl i c (CHead d (Bind Abbr) u))).(\lambda (t2: T).(\lambda (t3: +T).(\lambda (H1: (pr0 t2 t3)).(\lambda (t0: T).(\lambda (H2: (subst0 i u t3 +t0)).(\lambda (i0: nat).(\lambda (u0: T).(\lambda (c2: C).(\lambda (t4: +T).(\lambda (H3: (fsubst0 i0 u0 c t2 c2 t4)).(fsubst0_ind i0 u0 c t2 (\lambda +(c0: C).(\lambda (t5: T).(\forall (e: C).((getl i0 c (CHead e (Bind Abbr) +u0)) \to (pc3 c0 t5 t0))))) (\lambda (t5: T).(\lambda (H4: (subst0 i0 u0 t2 +t5)).(\lambda (e: C).(\lambda (H5: (getl i0 c (CHead e (Bind Abbr) +u0))).(pc3_t t2 c t5 (pc3_s c t5 t2 (pc3_pr2_r c t2 t5 (pr2_delta c e u0 i0 +H5 t2 t2 (pr0_refl t2) t5 H4))) t0 (pc3_pr2_r c t2 t0 (pr2_delta c d u i H0 +t2 t3 H1 t0 H2))))))) (\lambda (c0: C).(\lambda (H4: (csubst0 i0 u0 c +c0)).(\lambda (e: C).(\lambda (H5: (getl i0 c (CHead e (Bind Abbr) +u0))).(lt_le_e i i0 (pc3 c0 t2 t0) (\lambda (H6: (lt i i0)).(let H7 \def +(csubst0_getl_lt i0 i H6 c c0 u0 H4 (CHead d (Bind Abbr) u) H0) in (or4_ind +(getl i c0 (CHead d (Bind Abbr) u)) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead +e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) +u0 u1 w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c0 +(CHead e2 (Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1))))))) (\lambda +(b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl +i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) u0 u1 w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))) (pc3 c0 t2 t0) (\lambda (H8: +(getl i c0 (CHead d (Bind Abbr) u))).(pc3_pr2_r c0 t2 t0 (pr2_delta c0 d u i +H8 t2 t3 H1 t0 H2))) (\lambda (H8: (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead +e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) +u0 u1 w))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda +(u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e0 (Bind b) +u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl i c0 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) u0 u1 w))))) +(pc3 c0 t2 t0) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: T).(\lambda +(x3: T).(\lambda (H9: (eq C (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x2))).(\lambda (H10: (getl i c0 (CHead x1 (Bind x0) x3))).(\lambda (H11: +(subst0 (minus i0 (S i)) u0 x2 x3)).(let H12 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x2) H9) in ((let H13 \def (f_equal C B (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x2) H9) in ((let H14 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t5) \Rightarrow t5])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x2) H9) in +(\lambda (H15: (eq B Abbr x0)).(\lambda (H16: (eq C d x1)).(let H17 \def +(eq_ind_r T x2 (\lambda (t5: T).(subst0 (minus i0 (S i)) u0 t5 x3)) H11 u +H14) in (let H18 \def (eq_ind_r C x1 (\lambda (c3: C).(getl i c0 (CHead c3 +(Bind x0) x3))) H10 d H16) in (let H19 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead d (Bind b) x3))) H18 Abbr H15) in (ex2_ind T (\lambda +(t5: T).(subst0 i x3 t3 t5)) (\lambda (t5: T).(subst0 (S (plus (minus i0 (S +i)) i)) u0 t0 t5)) (pc3 c0 t2 t0) (\lambda (x: T).(\lambda (H20: (subst0 i x3 +t3 x)).(\lambda (H21: (subst0 (S (plus (minus i0 (S i)) i)) u0 t0 x)).(let +H22 \def (eq_ind_r nat (S (plus (minus i0 (S i)) i)) (\lambda (n: +nat).(subst0 n u0 t0 x)) H21 i0 (lt_plus_minus_r i i0 H6)) in (pc3_pr2_u c0 x +t2 (pr2_delta c0 d x3 i H19 t2 t3 H1 x H20) t0 (pc3_pr2_x c0 x t0 (pr2_delta +c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H4 (CHead e (Bind Abbr) +u0) H5) t0 t0 (pr0_refl t0) x H22))))))) (subst0_subst0_back t3 t0 u i H2 x3 +u0 (minus i0 (S i)) H17)))))))) H13)) H12))))))))) H8)) (\lambda (H8: (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq +C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c0 (CHead e2 +(Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))).(ex3_4_ind B C C T (\lambda +(b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind +Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u1: T).(getl i c0 (CHead e2 (Bind b) u1)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (S +i)) u0 e1 e2))))) (pc3 c0 t2 t0) (\lambda (x0: B).(\lambda (x1: C).(\lambda +(x2: C).(\lambda (x3: T).(\lambda (H9: (eq C (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3))).(\lambda (H10: (getl i c0 (CHead x2 (Bind x0) +x3))).(\lambda (H11: (csubst0 (minus i0 (S i)) u0 x1 x2)).(let H12 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow d | (CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind +Abbr) u) (CHead x1 (Bind x0) x3) H9) in ((let H13 \def (f_equal C B (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow +Abbr | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).B) with +[(Bind b) \Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) +u) (CHead x1 (Bind x0) x3) H9) in ((let H14 \def (f_equal C T (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | +(CHead _ _ t5) \Rightarrow t5])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3) H9) in (\lambda (H15: (eq B Abbr x0)).(\lambda (H16: (eq C d x1)).(let +H17 \def (eq_ind_r T x3 (\lambda (t5: T).(getl i c0 (CHead x2 (Bind x0) t5))) +H10 u H14) in (let H18 \def (eq_ind_r C x1 (\lambda (c3: C).(csubst0 (minus +i0 (S i)) u0 c3 x2)) H11 d H16) in (let H19 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead x2 (Bind b) u))) H17 Abbr H15) in (pc3_pr2_r c0 t2 t0 +(pr2_delta c0 x2 u i H19 t2 t3 H1 t0 H2)))))))) H13)) H12))))))))) H8)) +(\lambda (H8: (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 +e2)))))))).(ex4_5_ind B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) +(pc3 c0 t2 t0) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: C).(\lambda +(x3: T).(\lambda (x4: T).(\lambda (H9: (eq C (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3))).(\lambda (H10: (getl i c0 (CHead x2 (Bind x0) +x4))).(\lambda (H11: (subst0 (minus i0 (S i)) u0 x3 x4)).(\lambda (H12: +(csubst0 (minus i0 (S i)) u0 x1 x2)).(let H13 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3) H9) in ((let H14 \def (f_equal C B (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3) H9) in ((let H15 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t5) \Rightarrow t5])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H9) in +(\lambda (H16: (eq B Abbr x0)).(\lambda (H17: (eq C d x1)).(let H18 \def +(eq_ind_r T x3 (\lambda (t5: T).(subst0 (minus i0 (S i)) u0 t5 x4)) H11 u +H15) in (let H19 \def (eq_ind_r C x1 (\lambda (c3: C).(csubst0 (minus i0 (S +i)) u0 c3 x2)) H12 d H17) in (let H20 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead x2 (Bind b) x4))) H10 Abbr H16) in (ex2_ind T (\lambda +(t5: T).(subst0 i x4 t3 t5)) (\lambda (t5: T).(subst0 (S (plus (minus i0 (S +i)) i)) u0 t0 t5)) (pc3 c0 t2 t0) (\lambda (x: T).(\lambda (H21: (subst0 i x4 +t3 x)).(\lambda (H22: (subst0 (S (plus (minus i0 (S i)) i)) u0 t0 x)).(let +H23 \def (eq_ind_r nat (S (plus (minus i0 (S i)) i)) (\lambda (n: +nat).(subst0 n u0 t0 x)) H22 i0 (lt_plus_minus_r i i0 H6)) in (pc3_pr2_u c0 x +t2 (pr2_delta c0 x2 x4 i H20 t2 t3 H1 x H21) t0 (pc3_pr2_x c0 x t0 (pr2_delta +c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H4 (CHead e (Bind Abbr) +u0) H5) t0 t0 (pr0_refl t0) x H23))))))) (subst0_subst0_back t3 t0 u i H2 x4 +u0 (minus i0 (S i)) H18)))))))) H14)) H13))))))))))) H8)) H7))) (\lambda (H6: +(le i0 i)).(pc3_pr2_r c0 t2 t0 (pr2_delta c0 d u i (csubst0_getl_ge i0 i H6 c +c0 u0 H4 (CHead d (Bind Abbr) u) H0) t2 t3 H1 t0 H2)))))))) (\lambda (t5: +T).(\lambda (H4: (subst0 i0 u0 t2 t5)).(\lambda (c0: C).(\lambda (H5: +(csubst0 i0 u0 c c0)).(\lambda (e: C).(\lambda (H6: (getl i0 c (CHead e (Bind +Abbr) u0))).(lt_le_e i i0 (pc3 c0 t5 t0) (\lambda (H7: (lt i i0)).(let H8 +\def (csubst0_getl_lt i0 i H7 c c0 u0 H5 (CHead d (Bind Abbr) u) H0) in +(or4_ind (getl i c0 (CHead d (Bind Abbr) u)) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind +Abbr) u) (CHead e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u1: T).(getl i c0 (CHead e2 (Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) +u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))) +(pc3 c0 t5 t0) (\lambda (H9: (getl i c0 (CHead d (Bind Abbr) u))).(pc3_pr2_u2 +c0 t2 t5 (pr2_delta c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 +(CHead e (Bind Abbr) u0) H6) t2 t2 (pr0_refl t2) t5 H4) t0 (pc3_pr2_r c0 t2 +t0 (pr2_delta c0 d u i H9 t2 t3 H1 t0 H2)))) (\lambda (H9: (ex3_4 B C T T +(\lambda (b: B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C +(CHead d (Bind Abbr) u) (CHead e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead +e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) +u0 u1 w))))) (pc3 c0 t5 t0) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: +T).(\lambda (x3: T).(\lambda (H10: (eq C (CHead d (Bind Abbr) u) (CHead x1 +(Bind x0) x2))).(\lambda (H11: (getl i c0 (CHead x1 (Bind x0) x3))).(\lambda +(H12: (subst0 (minus i0 (S i)) u0 x2 x3)).(let H13 \def (f_equal C C (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow +d | (CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind Abbr) u) (CHead x1 (Bind +x0) x2) H10) in ((let H14 \def (f_equal C B (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x2) H10) in ((let H15 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t6) \Rightarrow t6])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x2) H10) in +(\lambda (H16: (eq B Abbr x0)).(\lambda (H17: (eq C d x1)).(let H18 \def +(eq_ind_r T x2 (\lambda (t6: T).(subst0 (minus i0 (S i)) u0 t6 x3)) H12 u +H15) in (let H19 \def (eq_ind_r C x1 (\lambda (c3: C).(getl i c0 (CHead c3 +(Bind x0) x3))) H11 d H17) in (let H20 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead d (Bind b) x3))) H19 Abbr H16) in (ex2_ind T (\lambda +(t6: T).(subst0 i x3 t3 t6)) (\lambda (t6: T).(subst0 (S (plus (minus i0 (S +i)) i)) u0 t0 t6)) (pc3 c0 t5 t0) (\lambda (x: T).(\lambda (H21: (subst0 i x3 +t3 x)).(\lambda (H22: (subst0 (S (plus (minus i0 (S i)) i)) u0 t0 x)).(let +H23 \def (eq_ind_r nat (S (plus (minus i0 (S i)) i)) (\lambda (n: +nat).(subst0 n u0 t0 x)) H22 i0 (lt_plus_minus_r i i0 H7)) in (pc3_pr2_u2 c0 +t2 t5 (pr2_delta c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 +(CHead e (Bind Abbr) u0) H6) t2 t2 (pr0_refl t2) t5 H4) t0 (pc3_pr2_u c0 x t2 +(pr2_delta c0 d x3 i H20 t2 t3 H1 x H21) t0 (pc3_pr2_x c0 x t0 (pr2_delta c0 +e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 (CHead e (Bind Abbr) u0) +H6) t0 t0 (pr0_refl t0) x H23)))))))) (subst0_subst0_back t3 t0 u i H2 x3 u0 +(minus i0 (S i)) H18)))))))) H14)) H13))))))))) H9)) (\lambda (H9: (ex3_4 B C +C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C +(CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c0 (CHead e2 (Bind b) +u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))).(ex3_4_ind B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind +Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u1: T).(getl i c0 (CHead e2 (Bind b) u1)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (S +i)) u0 e1 e2))))) (pc3 c0 t5 t0) (\lambda (x0: B).(\lambda (x1: C).(\lambda +(x2: C).(\lambda (x3: T).(\lambda (H10: (eq C (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3))).(\lambda (H11: (getl i c0 (CHead x2 (Bind x0) +x3))).(\lambda (H12: (csubst0 (minus i0 (S i)) u0 x1 x2)).(let H13 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow d | (CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind +Abbr) u) (CHead x1 (Bind x0) x3) H10) in ((let H14 \def (f_equal C B (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow +Abbr | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).B) with +[(Bind b) \Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) +u) (CHead x1 (Bind x0) x3) H10) in ((let H15 \def (f_equal C T (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | +(CHead _ _ t6) \Rightarrow t6])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3) H10) in (\lambda (H16: (eq B Abbr x0)).(\lambda (H17: (eq C d x1)).(let +H18 \def (eq_ind_r T x3 (\lambda (t6: T).(getl i c0 (CHead x2 (Bind x0) t6))) +H11 u H15) in (let H19 \def (eq_ind_r C x1 (\lambda (c3: C).(csubst0 (minus +i0 (S i)) u0 c3 x2)) H12 d H17) in (let H20 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead x2 (Bind b) u))) H18 Abbr H16) in (pc3_pr2_u2 c0 t2 t5 +(pr2_delta c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 (CHead e +(Bind Abbr) u0) H6) t2 t2 (pr0_refl t2) t5 H4) t0 (pc3_pr2_r c0 t2 t0 +(pr2_delta c0 x2 u i H20 t2 t3 H1 t0 H2))))))))) H14)) H13))))))))) H9)) +(\lambda (H9: (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 +e2)))))))).(ex4_5_ind B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) +(pc3 c0 t5 t0) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: C).(\lambda +(x3: T).(\lambda (x4: T).(\lambda (H10: (eq C (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3))).(\lambda (H11: (getl i c0 (CHead x2 (Bind x0) +x4))).(\lambda (H12: (subst0 (minus i0 (S i)) u0 x3 x4)).(\lambda (H13: +(csubst0 (minus i0 (S i)) u0 x1 x2)).(let H14 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3) H10) in ((let H15 \def (f_equal C B (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3) H10) in ((let H16 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t6) \Rightarrow t6])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H10) in +(\lambda (H17: (eq B Abbr x0)).(\lambda (H18: (eq C d x1)).(let H19 \def +(eq_ind_r T x3 (\lambda (t6: T).(subst0 (minus i0 (S i)) u0 t6 x4)) H12 u +H16) in (let H20 \def (eq_ind_r C x1 (\lambda (c3: C).(csubst0 (minus i0 (S +i)) u0 c3 x2)) H13 d H18) in (let H21 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead x2 (Bind b) x4))) H11 Abbr H17) in (ex2_ind T (\lambda +(t6: T).(subst0 i x4 t3 t6)) (\lambda (t6: T).(subst0 (S (plus (minus i0 (S +i)) i)) u0 t0 t6)) (pc3 c0 t5 t0) (\lambda (x: T).(\lambda (H22: (subst0 i x4 +t3 x)).(\lambda (H23: (subst0 (S (plus (minus i0 (S i)) i)) u0 t0 x)).(let +H24 \def (eq_ind_r nat (S (plus (minus i0 (S i)) i)) (\lambda (n: +nat).(subst0 n u0 t0 x)) H23 i0 (lt_plus_minus_r i i0 H7)) in (pc3_pr2_u2 c0 +t2 t5 (pr2_delta c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 +(CHead e (Bind Abbr) u0) H6) t2 t2 (pr0_refl t2) t5 H4) t0 (pc3_pr2_u c0 x t2 +(pr2_delta c0 x2 x4 i H21 t2 t3 H1 x H22) t0 (pc3_pr2_x c0 x t0 (pr2_delta c0 +e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 (CHead e (Bind Abbr) u0) +H6) t0 t0 (pr0_refl t0) x H24)))))))) (subst0_subst0_back t3 t0 u i H2 x4 u0 +(minus i0 (S i)) H19)))))))) H15)) H14))))))))))) H9)) H8))) (\lambda (H7: +(le i0 i)).(pc3_pr2_u2 c0 t2 t5 (pr2_delta c0 e u0 i0 (csubst0_getl_ge i0 i0 +(le_n i0) c c0 u0 H5 (CHead e (Bind Abbr) u0) H6) t2 t2 (pr0_refl t2) t5 H4) +t0 (pc3_pr2_r c0 t2 t0 (pr2_delta c0 d u i (csubst0_getl_ge i0 i H7 c c0 u0 +H5 (CHead d (Bind Abbr) u) H0) t2 t3 H1 t0 H2))))))))))) c2 t4 +H3)))))))))))))))) c1 t1 t H)))). + +theorem pc3_pr2_fsubst0_back: + \forall (c1: C).(\forall (t: T).(\forall (t1: T).((pr2 c1 t t1) \to (\forall +(i: nat).(\forall (u: T).(\forall (c2: C).(\forall (t2: T).((fsubst0 i u c1 +t1 c2 t2) \to (\forall (e: C).((getl i c1 (CHead e (Bind Abbr) u)) \to (pc3 +c2 t t2))))))))))) +\def + \lambda (c1: C).(\lambda (t: T).(\lambda (t1: T).(\lambda (H: (pr2 c1 t +t1)).(pr2_ind (\lambda (c: C).(\lambda (t0: T).(\lambda (t2: T).(\forall (i: +nat).(\forall (u: T).(\forall (c2: C).(\forall (t3: T).((fsubst0 i u c t2 c2 +t3) \to (\forall (e: C).((getl i c (CHead e (Bind Abbr) u)) \to (pc3 c2 t0 +t3))))))))))) (\lambda (c: C).(\lambda (t2: T).(\lambda (t3: T).(\lambda (H0: +(pr0 t2 t3)).(\lambda (i: nat).(\lambda (u: T).(\lambda (c2: C).(\lambda (t0: +T).(\lambda (H1: (fsubst0 i u c t3 c2 t0)).(fsubst0_ind i u c t3 (\lambda +(c0: C).(\lambda (t4: T).(\forall (e: C).((getl i c (CHead e (Bind Abbr) u)) +\to (pc3 c0 t2 t4))))) (\lambda (t4: T).(\lambda (H2: (subst0 i u t3 +t4)).(\lambda (e: C).(\lambda (H3: (getl i c (CHead e (Bind Abbr) +u))).(pc3_pr2_u c t3 t2 (pr2_free c t2 t3 H0) t4 (pc3_pr2_r c t3 t4 +(pr2_delta c e u i H3 t3 t3 (pr0_refl t3) t4 H2))))))) (\lambda (c0: +C).(\lambda (_: (csubst0 i u c c0)).(\lambda (e: C).(\lambda (_: (getl i c +(CHead e (Bind Abbr) u))).(pc3_pr2_r c0 t2 t3 (pr2_free c0 t2 t3 H0)))))) +(\lambda (t4: T).(\lambda (H2: (subst0 i u t3 t4)).(\lambda (c0: C).(\lambda +(H3: (csubst0 i u c c0)).(\lambda (e: C).(\lambda (H4: (getl i c (CHead e +(Bind Abbr) u))).(pc3_pr2_u c0 t3 t2 (pr2_free c0 t2 t3 H0) t4 (pc3_pr2_r c0 +t3 t4 (pr2_delta c0 e u i (csubst0_getl_ge i i (le_n i) c c0 u H3 (CHead e +(Bind Abbr) u) H4) t3 t3 (pr0_refl t3) t4 H2))))))))) c2 t0 H1)))))))))) +(\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H0: (getl i c (CHead d (Bind Abbr) u))).(\lambda (t2: T).(\lambda (t3: +T).(\lambda (H1: (pr0 t2 t3)).(\lambda (t0: T).(\lambda (H2: (subst0 i u t3 +t0)).(\lambda (i0: nat).(\lambda (u0: T).(\lambda (c2: C).(\lambda (t4: +T).(\lambda (H3: (fsubst0 i0 u0 c t0 c2 t4)).(fsubst0_ind i0 u0 c t0 (\lambda +(c0: C).(\lambda (t5: T).(\forall (e: C).((getl i0 c (CHead e (Bind Abbr) +u0)) \to (pc3 c0 t2 t5))))) (\lambda (t5: T).(\lambda (H4: (subst0 i0 u0 t0 +t5)).(\lambda (e: C).(\lambda (H5: (getl i0 c (CHead e (Bind Abbr) +u0))).(pc3_t t3 c t2 (pc3_pr3_r c t2 t3 (pr3_pr2 c t2 t3 (pr2_free c t2 t3 +H1))) t5 (pc3_pr3_r c t3 t5 (pr3_sing c t0 t3 (pr2_delta c d u i H0 t3 t3 +(pr0_refl t3) t0 H2) t5 (pr3_pr2 c t0 t5 (pr2_delta c e u0 i0 H5 t0 t0 +(pr0_refl t0) t5 H4))))))))) (\lambda (c0: C).(\lambda (H4: (csubst0 i0 u0 c +c0)).(\lambda (e: C).(\lambda (H5: (getl i0 c (CHead e (Bind Abbr) +u0))).(lt_le_e i i0 (pc3 c0 t2 t0) (\lambda (H6: (lt i i0)).(let H7 \def +(csubst0_getl_lt i0 i H6 c c0 u0 H4 (CHead d (Bind Abbr) u) H0) in (or4_ind +(getl i c0 (CHead d (Bind Abbr) u)) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead +e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) +u0 u1 w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c0 +(CHead e2 (Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1))))))) (\lambda +(b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl +i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) u0 u1 w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))) (pc3 c0 t2 t0) (\lambda (H8: +(getl i c0 (CHead d (Bind Abbr) u))).(pc3_pr2_r c0 t2 t0 (pr2_delta c0 d u i +H8 t2 t3 H1 t0 H2))) (\lambda (H8: (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead +e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) +u0 u1 w))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda +(u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e0 (Bind b) +u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl i c0 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) u0 u1 w))))) +(pc3 c0 t2 t0) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: T).(\lambda +(x3: T).(\lambda (H9: (eq C (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x2))).(\lambda (H10: (getl i c0 (CHead x1 (Bind x0) x3))).(\lambda (H11: +(subst0 (minus i0 (S i)) u0 x2 x3)).(let H12 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x2) H9) in ((let H13 \def (f_equal C B (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x2) H9) in ((let H14 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t5) \Rightarrow t5])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x2) H9) in +(\lambda (H15: (eq B Abbr x0)).(\lambda (H16: (eq C d x1)).(let H17 \def +(eq_ind_r T x2 (\lambda (t5: T).(subst0 (minus i0 (S i)) u0 t5 x3)) H11 u +H14) in (let H18 \def (eq_ind_r C x1 (\lambda (c3: C).(getl i c0 (CHead c3 +(Bind x0) x3))) H10 d H16) in (let H19 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead d (Bind b) x3))) H18 Abbr H15) in (ex2_ind T (\lambda +(t5: T).(subst0 i x3 t3 t5)) (\lambda (t5: T).(subst0 (S (plus (minus i0 (S +i)) i)) u0 t0 t5)) (pc3 c0 t2 t0) (\lambda (x: T).(\lambda (H20: (subst0 i x3 +t3 x)).(\lambda (H21: (subst0 (S (plus (minus i0 (S i)) i)) u0 t0 x)).(let +H22 \def (eq_ind_r nat (S (plus (minus i0 (S i)) i)) (\lambda (n: +nat).(subst0 n u0 t0 x)) H21 i0 (lt_plus_minus_r i i0 H6)) in (pc3_pr2_u c0 x +t2 (pr2_delta c0 d x3 i H19 t2 t3 H1 x H20) t0 (pc3_pr2_x c0 x t0 (pr2_delta +c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H4 (CHead e (Bind Abbr) +u0) H5) t0 t0 (pr0_refl t0) x H22))))))) (subst0_subst0_back t3 t0 u i H2 x3 +u0 (minus i0 (S i)) H17)))))))) H13)) H12))))))))) H8)) (\lambda (H8: (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq +C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c0 (CHead e2 +(Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))).(ex3_4_ind B C C T (\lambda +(b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind +Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u1: T).(getl i c0 (CHead e2 (Bind b) u1)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (S +i)) u0 e1 e2))))) (pc3 c0 t2 t0) (\lambda (x0: B).(\lambda (x1: C).(\lambda +(x2: C).(\lambda (x3: T).(\lambda (H9: (eq C (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3))).(\lambda (H10: (getl i c0 (CHead x2 (Bind x0) +x3))).(\lambda (H11: (csubst0 (minus i0 (S i)) u0 x1 x2)).(let H12 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow d | (CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind +Abbr) u) (CHead x1 (Bind x0) x3) H9) in ((let H13 \def (f_equal C B (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow +Abbr | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).B) with +[(Bind b) \Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) +u) (CHead x1 (Bind x0) x3) H9) in ((let H14 \def (f_equal C T (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | +(CHead _ _ t5) \Rightarrow t5])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3) H9) in (\lambda (H15: (eq B Abbr x0)).(\lambda (H16: (eq C d x1)).(let +H17 \def (eq_ind_r T x3 (\lambda (t5: T).(getl i c0 (CHead x2 (Bind x0) t5))) +H10 u H14) in (let H18 \def (eq_ind_r C x1 (\lambda (c3: C).(csubst0 (minus +i0 (S i)) u0 c3 x2)) H11 d H16) in (let H19 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead x2 (Bind b) u))) H17 Abbr H15) in (pc3_pr2_r c0 t2 t0 +(pr2_delta c0 x2 u i H19 t2 t3 H1 t0 H2)))))))) H13)) H12))))))))) H8)) +(\lambda (H8: (ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 +e2)))))))).(ex4_5_ind B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) +(pc3 c0 t2 t0) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: C).(\lambda +(x3: T).(\lambda (x4: T).(\lambda (H9: (eq C (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3))).(\lambda (H10: (getl i c0 (CHead x2 (Bind x0) +x4))).(\lambda (H11: (subst0 (minus i0 (S i)) u0 x3 x4)).(\lambda (H12: +(csubst0 (minus i0 (S i)) u0 x1 x2)).(let H13 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3) H9) in ((let H14 \def (f_equal C B (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3) H9) in ((let H15 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t5) \Rightarrow t5])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H9) in +(\lambda (H16: (eq B Abbr x0)).(\lambda (H17: (eq C d x1)).(let H18 \def +(eq_ind_r T x3 (\lambda (t5: T).(subst0 (minus i0 (S i)) u0 t5 x4)) H11 u +H15) in (let H19 \def (eq_ind_r C x1 (\lambda (c3: C).(csubst0 (minus i0 (S +i)) u0 c3 x2)) H12 d H17) in (let H20 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead x2 (Bind b) x4))) H10 Abbr H16) in (ex2_ind T (\lambda +(t5: T).(subst0 i x4 t3 t5)) (\lambda (t5: T).(subst0 (S (plus (minus i0 (S +i)) i)) u0 t0 t5)) (pc3 c0 t2 t0) (\lambda (x: T).(\lambda (H21: (subst0 i x4 +t3 x)).(\lambda (H22: (subst0 (S (plus (minus i0 (S i)) i)) u0 t0 x)).(let +H23 \def (eq_ind_r nat (S (plus (minus i0 (S i)) i)) (\lambda (n: +nat).(subst0 n u0 t0 x)) H22 i0 (lt_plus_minus_r i i0 H6)) in (pc3_pr2_u c0 x +t2 (pr2_delta c0 x2 x4 i H20 t2 t3 H1 x H21) t0 (pc3_pr2_x c0 x t0 (pr2_delta +c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H4 (CHead e (Bind Abbr) +u0) H5) t0 t0 (pr0_refl t0) x H23))))))) (subst0_subst0_back t3 t0 u i H2 x4 +u0 (minus i0 (S i)) H18)))))))) H14)) H13))))))))))) H8)) H7))) (\lambda (H6: +(le i0 i)).(pc3_pr2_r c0 t2 t0 (pr2_delta c0 d u i (csubst0_getl_ge i0 i H6 c +c0 u0 H4 (CHead d (Bind Abbr) u) H0) t2 t3 H1 t0 H2)))))))) (\lambda (t5: +T).(\lambda (H4: (subst0 i0 u0 t0 t5)).(\lambda (c0: C).(\lambda (H5: +(csubst0 i0 u0 c c0)).(\lambda (e: C).(\lambda (H6: (getl i0 c (CHead e (Bind +Abbr) u0))).(lt_le_e i i0 (pc3 c0 t2 t5) (\lambda (H7: (lt i i0)).(let H8 +\def (csubst0_getl_lt i0 i H7 c c0 u0 H5 (CHead d (Bind Abbr) u) H0) in +(or4_ind (getl i c0 (CHead d (Bind Abbr) u)) (ex3_4 B C T T (\lambda (b: +B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind +Abbr) u) (CHead e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: +C).(\lambda (_: T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: +C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(u1: T).(getl i c0 (CHead e2 (Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: +C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) +u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))) +(pc3 c0 t2 t5) (\lambda (H9: (getl i c0 (CHead d (Bind Abbr) u))).(pc3_pr2_u +c0 t3 t2 (pr2_free c0 t2 t3 H1) t5 (pc3_pr3_r c0 t3 t5 (pr3_sing c0 t0 t3 +(pr2_delta c0 d u i H9 t3 t3 (pr0_refl t3) t0 H2) t5 (pr3_pr2 c0 t0 t5 +(pr2_delta c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 (CHead e +(Bind Abbr) u0) H6) t0 t0 (pr0_refl t0) t5 H4)))))) (\lambda (H9: (ex3_4 B C +T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C +(CHead d (Bind Abbr) u) (CHead e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda +(e0: C).(\lambda (_: T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) +(\lambda (_: B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead +e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl i c0 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i0 (S i)) +u0 u1 w))))) (pc3 c0 t2 t5) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: +T).(\lambda (x3: T).(\lambda (H10: (eq C (CHead d (Bind Abbr) u) (CHead x1 +(Bind x0) x2))).(\lambda (H11: (getl i c0 (CHead x1 (Bind x0) x3))).(\lambda +(H12: (subst0 (minus i0 (S i)) u0 x2 x3)).(let H13 \def (f_equal C C (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow +d | (CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind Abbr) u) (CHead x1 (Bind +x0) x2) H10) in ((let H14 \def (f_equal C B (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x2) H10) in ((let H15 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t6) \Rightarrow t6])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x2) H10) in +(\lambda (H16: (eq B Abbr x0)).(\lambda (H17: (eq C d x1)).(let H18 \def +(eq_ind_r T x2 (\lambda (t6: T).(subst0 (minus i0 (S i)) u0 t6 x3)) H12 u +H15) in (let H19 \def (eq_ind_r C x1 (\lambda (c3: C).(getl i c0 (CHead c3 +(Bind x0) x3))) H11 d H17) in (let H20 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead d (Bind b) x3))) H19 Abbr H16) in (ex2_ind T (\lambda +(t6: T).(subst0 i x3 t3 t6)) (\lambda (t6: T).(subst0 (S (plus (minus i0 (S +i)) i)) u0 t0 t6)) (pc3 c0 t2 t5) (\lambda (x: T).(\lambda (H21: (subst0 i x3 +t3 x)).(\lambda (H22: (subst0 (S (plus (minus i0 (S i)) i)) u0 t0 x)).(let +H23 \def (eq_ind_r nat (S (plus (minus i0 (S i)) i)) (\lambda (n: +nat).(subst0 n u0 t0 x)) H22 i0 (lt_plus_minus_r i i0 H7)) in (pc3_pr2_u c0 x +t2 (pr2_delta c0 d x3 i H20 t2 t3 H1 x H21) t5 (pc3_pr2_u2 c0 t0 x (pr2_delta +c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 (CHead e (Bind Abbr) +u0) H6) t0 t0 (pr0_refl t0) x H23) t5 (pc3_pr2_r c0 t0 t5 (pr2_delta c0 e u0 +i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 (CHead e (Bind Abbr) u0) H6) +t0 t0 (pr0_refl t0) t5 H4)))))))) (subst0_subst0_back t3 t0 u i H2 x3 u0 +(minus i0 (S i)) H18)))))))) H14)) H13))))))))) H9)) (\lambda (H9: (ex3_4 B C +C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C +(CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u1: T).(getl i c0 (CHead e2 (Bind b) +u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i0 (S i)) u0 e1 e2))))))).(ex3_4_ind B C C T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind +Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u1: T).(getl i c0 (CHead e2 (Bind b) u1)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i0 (S +i)) u0 e1 e2))))) (pc3 c0 t2 t5) (\lambda (x0: B).(\lambda (x1: C).(\lambda +(x2: C).(\lambda (x3: T).(\lambda (H10: (eq C (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3))).(\lambda (H11: (getl i c0 (CHead x2 (Bind x0) +x3))).(\lambda (H12: (csubst0 (minus i0 (S i)) u0 x1 x2)).(let H13 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow d | (CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind +Abbr) u) (CHead x1 (Bind x0) x3) H10) in ((let H14 \def (f_equal C B (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow +Abbr | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).B) with +[(Bind b) \Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) +u) (CHead x1 (Bind x0) x3) H10) in ((let H15 \def (f_equal C T (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | +(CHead _ _ t6) \Rightarrow t6])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3) H10) in (\lambda (H16: (eq B Abbr x0)).(\lambda (H17: (eq C d x1)).(let +H18 \def (eq_ind_r T x3 (\lambda (t6: T).(getl i c0 (CHead x2 (Bind x0) t6))) +H11 u H15) in (let H19 \def (eq_ind_r C x1 (\lambda (c3: C).(csubst0 (minus +i0 (S i)) u0 c3 x2)) H12 d H17) in (let H20 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead x2 (Bind b) u))) H18 Abbr H16) in (pc3_pr2_u c0 t0 t2 +(pr2_delta c0 x2 u i H20 t2 t3 H1 t0 H2) t5 (pc3_pr2_r c0 t0 t5 (pr2_delta c0 +e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 (CHead e (Bind Abbr) u0) +H6) t0 t0 (pr0_refl t0) t5 H4))))))))) H14)) H13))))))))) H9)) (\lambda (H9: +(ex4_5 B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) +u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: +T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 +e2)))))))).(ex4_5_ind B C C T T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 +(Bind b) u1))))))) (\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda +(_: T).(\lambda (w: T).(getl i c0 (CHead e2 (Bind b) w))))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 +(minus i0 (S i)) u0 u1 w)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(\lambda (_: T).(csubst0 (minus i0 (S i)) u0 e1 e2)))))) +(pc3 c0 t2 t5) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: C).(\lambda +(x3: T).(\lambda (x4: T).(\lambda (H10: (eq C (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3))).(\lambda (H11: (getl i c0 (CHead x2 (Bind x0) +x4))).(\lambda (H12: (subst0 (minus i0 (S i)) u0 x3 x4)).(\lambda (H13: +(csubst0 (minus i0 (S i)) u0 x1 x2)).(let H14 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c3 _ _) \Rightarrow c3])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3) H10) in ((let H15 \def (f_equal C B (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x3) H10) in ((let H16 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t6) \Rightarrow t6])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H10) in +(\lambda (H17: (eq B Abbr x0)).(\lambda (H18: (eq C d x1)).(let H19 \def +(eq_ind_r T x3 (\lambda (t6: T).(subst0 (minus i0 (S i)) u0 t6 x4)) H12 u +H16) in (let H20 \def (eq_ind_r C x1 (\lambda (c3: C).(csubst0 (minus i0 (S +i)) u0 c3 x2)) H13 d H18) in (let H21 \def (eq_ind_r B x0 (\lambda (b: +B).(getl i c0 (CHead x2 (Bind b) x4))) H11 Abbr H17) in (ex2_ind T (\lambda +(t6: T).(subst0 i x4 t3 t6)) (\lambda (t6: T).(subst0 (S (plus (minus i0 (S +i)) i)) u0 t0 t6)) (pc3 c0 t2 t5) (\lambda (x: T).(\lambda (H22: (subst0 i x4 +t3 x)).(\lambda (H23: (subst0 (S (plus (minus i0 (S i)) i)) u0 t0 x)).(let +H24 \def (eq_ind_r nat (S (plus (minus i0 (S i)) i)) (\lambda (n: +nat).(subst0 n u0 t0 x)) H23 i0 (lt_plus_minus_r i i0 H7)) in (pc3_pr2_u c0 x +t2 (pr2_delta c0 x2 x4 i H21 t2 t3 H1 x H22) t5 (pc3_pr2_u2 c0 t0 x +(pr2_delta c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 (CHead e +(Bind Abbr) u0) H6) t0 t0 (pr0_refl t0) x H24) t5 (pc3_pr2_r c0 t0 t5 +(pr2_delta c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n i0) c c0 u0 H5 (CHead e +(Bind Abbr) u0) H6) t0 t0 (pr0_refl t0) t5 H4)))))))) (subst0_subst0_back t3 +t0 u i H2 x4 u0 (minus i0 (S i)) H19)))))))) H15)) H14))))))))))) H9)) H8))) +(\lambda (H7: (le i0 i)).(pc3_pr2_u c0 t0 t2 (pr2_delta c0 d u i +(csubst0_getl_ge i0 i H7 c c0 u0 H5 (CHead d (Bind Abbr) u) H0) t2 t3 H1 t0 +H2) t5 (pc3_pr2_r c0 t0 t5 (pr2_delta c0 e u0 i0 (csubst0_getl_ge i0 i0 (le_n +i0) c c0 u0 H5 (CHead e (Bind Abbr) u0) H6) t0 t0 (pr0_refl t0) t5 +H4))))))))))) c2 t4 H3)))))))))))))))) c1 t t1 H)))). + +theorem pc3_fsubst0: + \forall (c1: C).(\forall (t1: T).(\forall (t: T).((pc3 c1 t1 t) \to (\forall +(i: nat).(\forall (u: T).(\forall (c2: C).(\forall (t2: T).((fsubst0 i u c1 +t1 c2 t2) \to (\forall (e: C).((getl i c1 (CHead e (Bind Abbr) u)) \to (pc3 +c2 t2 t))))))))))) +\def + \lambda (c1: C).(\lambda (t1: T).(\lambda (t: T).(\lambda (H: (pc3 c1 t1 +t)).(pc3_ind_left c1 (\lambda (t0: T).(\lambda (t2: T).(\forall (i: +nat).(\forall (u: T).(\forall (c2: C).(\forall (t3: T).((fsubst0 i u c1 t0 c2 +t3) \to (\forall (e: C).((getl i c1 (CHead e (Bind Abbr) u)) \to (pc3 c2 t3 +t2)))))))))) (\lambda (t0: T).(\lambda (i: nat).(\lambda (u: T).(\lambda (c2: +C).(\lambda (t2: T).(\lambda (H0: (fsubst0 i u c1 t0 c2 t2)).(fsubst0_ind i u +c1 t0 (\lambda (c: C).(\lambda (t3: T).(\forall (e: C).((getl i c1 (CHead e +(Bind Abbr) u)) \to (pc3 c t3 t0))))) (\lambda (t3: T).(\lambda (H1: (subst0 +i u t0 t3)).(\lambda (e: C).(\lambda (H2: (getl i c1 (CHead e (Bind Abbr) +u))).(pc3_pr2_x c1 t3 t0 (pr2_delta c1 e u i H2 t0 t0 (pr0_refl t0) t3 +H1)))))) (\lambda (c0: C).(\lambda (_: (csubst0 i u c1 c0)).(\lambda (e: +C).(\lambda (_: (getl i c1 (CHead e (Bind Abbr) u))).(pc3_refl c0 t0))))) +(\lambda (t3: T).(\lambda (H1: (subst0 i u t0 t3)).(\lambda (c0: C).(\lambda +(H2: (csubst0 i u c1 c0)).(\lambda (e: C).(\lambda (H3: (getl i c1 (CHead e +(Bind Abbr) u))).(pc3_pr2_x c0 t3 t0 (pr2_delta c0 e u i (csubst0_getl_ge i i +(le_n i) c1 c0 u H2 (CHead e (Bind Abbr) u) H3) t0 t0 (pr0_refl t0) t3 +H1)))))))) c2 t2 H0))))))) (\lambda (t0: T).(\lambda (t2: T).(\lambda (H0: +(pr2 c1 t0 t2)).(\lambda (t3: T).(\lambda (H1: (pc3 c1 t2 t3)).(\lambda (H2: +((\forall (i: nat).(\forall (u: T).(\forall (c2: C).(\forall (t4: +T).((fsubst0 i u c1 t2 c2 t4) \to (\forall (e: C).((getl i c1 (CHead e (Bind +Abbr) u)) \to (pc3 c2 t4 t3)))))))))).(\lambda (i: nat).(\lambda (u: +T).(\lambda (c2: C).(\lambda (t4: T).(\lambda (H3: (fsubst0 i u c1 t0 c2 +t4)).(fsubst0_ind i u c1 t0 (\lambda (c: C).(\lambda (t5: T).(\forall (e: +C).((getl i c1 (CHead e (Bind Abbr) u)) \to (pc3 c t5 t3))))) (\lambda (t5: +T).(\lambda (H4: (subst0 i u t0 t5)).(\lambda (e: C).(\lambda (H5: (getl i c1 +(CHead e (Bind Abbr) u))).(pc3_t t2 c1 t5 (pc3_pr2_fsubst0 c1 t0 t2 H0 i u c1 +t5 (fsubst0_snd i u c1 t0 t5 H4) e H5) t3 H1))))) (\lambda (c0: C).(\lambda +(H4: (csubst0 i u c1 c0)).(\lambda (e: C).(\lambda (H5: (getl i c1 (CHead e +(Bind Abbr) u))).(pc3_t t2 c0 t0 (pc3_pr2_fsubst0 c1 t0 t2 H0 i u c0 t0 +(fsubst0_fst i u c1 t0 c0 H4) e H5) t3 (H2 i u c0 t2 (fsubst0_fst i u c1 t2 +c0 H4) e H5)))))) (\lambda (t5: T).(\lambda (H4: (subst0 i u t0 t5)).(\lambda +(c0: C).(\lambda (H5: (csubst0 i u c1 c0)).(\lambda (e: C).(\lambda (H6: +(getl i c1 (CHead e (Bind Abbr) u))).(pc3_t t2 c0 t5 (pc3_pr2_fsubst0 c1 t0 +t2 H0 i u c0 t5 (fsubst0_both i u c1 t0 t5 H4 c0 H5) e H6) t3 (H2 i u c0 t2 +(fsubst0_fst i u c1 t2 c0 H5) e H6)))))))) c2 t4 H3)))))))))))) (\lambda (t0: +T).(\lambda (t2: T).(\lambda (H0: (pr2 c1 t0 t2)).(\lambda (t3: T).(\lambda +(H1: (pc3 c1 t0 t3)).(\lambda (H2: ((\forall (i: nat).(\forall (u: +T).(\forall (c2: C).(\forall (t4: T).((fsubst0 i u c1 t0 c2 t4) \to (\forall +(e: C).((getl i c1 (CHead e (Bind Abbr) u)) \to (pc3 c2 t4 +t3)))))))))).(\lambda (i: nat).(\lambda (u: T).(\lambda (c2: C).(\lambda (t4: +T).(\lambda (H3: (fsubst0 i u c1 t2 c2 t4)).(fsubst0_ind i u c1 t2 (\lambda +(c: C).(\lambda (t5: T).(\forall (e: C).((getl i c1 (CHead e (Bind Abbr) u)) +\to (pc3 c t5 t3))))) (\lambda (t5: T).(\lambda (H4: (subst0 i u t2 +t5)).(\lambda (e: C).(\lambda (H5: (getl i c1 (CHead e (Bind Abbr) +u))).(pc3_t t0 c1 t5 (pc3_s c1 t5 t0 (pc3_pr2_fsubst0_back c1 t0 t2 H0 i u c1 +t5 (fsubst0_snd i u c1 t2 t5 H4) e H5)) t3 H1))))) (\lambda (c0: C).(\lambda +(H4: (csubst0 i u c1 c0)).(\lambda (e: C).(\lambda (H5: (getl i c1 (CHead e +(Bind Abbr) u))).(pc3_t t0 c0 t2 (pc3_s c0 t2 t0 (pc3_pr2_fsubst0_back c1 t0 +t2 H0 i u c0 t2 (fsubst0_fst i u c1 t2 c0 H4) e H5)) t3 (H2 i u c0 t0 +(fsubst0_fst i u c1 t0 c0 H4) e H5)))))) (\lambda (t5: T).(\lambda (H4: +(subst0 i u t2 t5)).(\lambda (c0: C).(\lambda (H5: (csubst0 i u c1 +c0)).(\lambda (e: C).(\lambda (H6: (getl i c1 (CHead e (Bind Abbr) +u))).(pc3_t t0 c0 t5 (pc3_s c0 t5 t0 (pc3_pr2_fsubst0_back c1 t0 t2 H0 i u c0 +t5 (fsubst0_both i u c1 t2 t5 H4 c0 H5) e H6)) t3 (H2 i u c0 t0 (fsubst0_fst +i u c1 t0 c0 H5) e H6)))))))) c2 t4 H3)))))))))))) t1 t H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fwd.ma new file mode 100644 index 000000000..cd70ecf45 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fwd.ma @@ -0,0 +1,314 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/fwd". + +include "pc3/props.ma". + +include "pr3/fwd.ma". + +theorem pc3_gen_sort: + \forall (c: C).(\forall (m: nat).(\forall (n: nat).((pc3 c (TSort m) (TSort +n)) \to (eq nat m n)))) +\def + \lambda (c: C).(\lambda (m: nat).(\lambda (n: nat).(\lambda (H: (pc3 c +(TSort m) (TSort n))).(let H0 \def H in (ex2_ind T (\lambda (t: T).(pr3 c +(TSort m) t)) (\lambda (t: T).(pr3 c (TSort n) t)) (eq nat m n) (\lambda (x: +T).(\lambda (H1: (pr3 c (TSort m) x)).(\lambda (H2: (pr3 c (TSort n) x)).(let +H3 \def (eq_ind T x (\lambda (t: T).(eq T t (TSort n))) (pr3_gen_sort c x n +H2) (TSort m) (pr3_gen_sort c x m H1)) in (let H4 \def (f_equal T nat +(\lambda (e: T).(match e in T return (\lambda (_: T).nat) with [(TSort n0) +\Rightarrow n0 | (TLRef _) \Rightarrow m | (THead _ _ _) \Rightarrow m])) +(TSort m) (TSort n) H3) in H4))))) H0))))). + +theorem pc3_gen_abst: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).(\forall (t1: T).(\forall +(t2: T).((pc3 c (THead (Bind Abst) u1 t1) (THead (Bind Abst) u2 t2)) \to +(land (pc3 c u1 u2) (\forall (b: B).(\forall (u: T).(pc3 (CHead c (Bind b) u) +t1 t2))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (t1: T).(\lambda +(t2: T).(\lambda (H: (pc3 c (THead (Bind Abst) u1 t1) (THead (Bind Abst) u2 +t2))).(let H0 \def H in (ex2_ind T (\lambda (t: T).(pr3 c (THead (Bind Abst) +u1 t1) t)) (\lambda (t: T).(pr3 c (THead (Bind Abst) u2 t2) t)) (land (pc3 c +u1 u2) (\forall (b: B).(\forall (u: T).(pc3 (CHead c (Bind b) u) t1 t2)))) +(\lambda (x: T).(\lambda (H1: (pr3 c (THead (Bind Abst) u1 t1) x)).(\lambda +(H2: (pr3 c (THead (Bind Abst) u2 t2) x)).(let H3 \def (pr3_gen_abst c u2 t2 +x H2) in (ex3_2_ind T T (\lambda (u3: T).(\lambda (t3: T).(eq T x (THead +(Bind Abst) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c u2 u3))) +(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead +c (Bind b) u) t2 t3))))) (land (pc3 c u1 u2) (\forall (b: B).(\forall (u: +T).(pc3 (CHead c (Bind b) u) t1 t2)))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H4: (eq T x (THead (Bind Abst) x0 x1))).(\lambda (H5: (pr3 c u2 +x0)).(\lambda (H6: ((\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +t2 x1))))).(let H7 \def (pr3_gen_abst c u1 t1 x H1) in (ex3_2_ind T T +(\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u3 t3)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c u1 u3))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t1 t3))))) +(land (pc3 c u1 u2) (\forall (b: B).(\forall (u: T).(pc3 (CHead c (Bind b) u) +t1 t2)))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H8: (eq T x (THead +(Bind Abst) x2 x3))).(\lambda (H9: (pr3 c u1 x2)).(\lambda (H10: ((\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t1 x3))))).(let H11 \def +(eq_ind T x (\lambda (t: T).(eq T t (THead (Bind Abst) x0 x1))) H4 (THead +(Bind Abst) x2 x3) H8) in (let H12 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x2 | (TLRef _) +\Rightarrow x2 | (THead _ t _) \Rightarrow t])) (THead (Bind Abst) x2 x3) +(THead (Bind Abst) x0 x1) H11) in ((let H13 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x3 | +(TLRef _) \Rightarrow x3 | (THead _ _ t) \Rightarrow t])) (THead (Bind Abst) +x2 x3) (THead (Bind Abst) x0 x1) H11) in (\lambda (H14: (eq T x2 x0)).(let +H15 \def (eq_ind T x3 (\lambda (t: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) t1 t)))) H10 x1 H13) in (let H16 \def (eq_ind T x2 +(\lambda (t: T).(pr3 c u1 t)) H9 x0 H14) in (conj (pc3 c u1 u2) (\forall (b: +B).(\forall (u: T).(pc3 (CHead c (Bind b) u) t1 t2))) (pc3_pr3_t c u1 x0 H16 +u2 H5) (\lambda (b: B).(\lambda (u: T).(pc3_pr3_t (CHead c (Bind b) u) t1 x1 +(H15 b u) t2 (H6 b u))))))))) H12)))))))) H7))))))) H3))))) H0))))))). + +theorem pc3_gen_abst_shift: + \forall (c: C).(\forall (u: T).(\forall (t1: T).(\forall (t2: T).((pc3 c +(THead (Bind Abst) u t1) (THead (Bind Abst) u t2)) \to (pc3 (CHead c (Bind +Abst) u) t1 t2))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (pc3 c (THead (Bind Abst) u t1) (THead (Bind Abst) u t2))).(let H_x \def +(pc3_gen_abst c u u t1 t2 H) in (let H0 \def H_x in (and_ind (pc3 c u u) +(\forall (b: B).(\forall (u0: T).(pc3 (CHead c (Bind b) u0) t1 t2))) (pc3 +(CHead c (Bind Abst) u) t1 t2) (\lambda (_: (pc3 c u u)).(\lambda (H2: +((\forall (b: B).(\forall (u0: T).(pc3 (CHead c (Bind b) u0) t1 t2))))).(H2 +Abst u))) H0))))))). + +theorem pc3_gen_lift: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).(\forall (h: nat).(\forall +(d: nat).((pc3 c (lift h d t1) (lift h d t2)) \to (\forall (e: C).((drop h d +c e) \to (pc3 e t1 t2)))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (H: (pc3 c (lift h d t1) (lift h d t2))).(\lambda (e: +C).(\lambda (H0: (drop h d c e)).(let H1 \def H in (ex2_ind T (\lambda (t: +T).(pr3 c (lift h d t1) t)) (\lambda (t: T).(pr3 c (lift h d t2) t)) (pc3 e +t1 t2) (\lambda (x: T).(\lambda (H2: (pr3 c (lift h d t1) x)).(\lambda (H3: +(pr3 c (lift h d t2) x)).(let H4 \def (pr3_gen_lift c t2 x h d H3 e H0) in +(ex2_ind T (\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: T).(pr3 e +t2 t3)) (pc3 e t1 t2) (\lambda (x0: T).(\lambda (H5: (eq T x (lift h d +x0))).(\lambda (H6: (pr3 e t2 x0)).(let H7 \def (pr3_gen_lift c t1 x h d H2 e +H0) in (ex2_ind T (\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: +T).(pr3 e t1 t3)) (pc3 e t1 t2) (\lambda (x1: T).(\lambda (H8: (eq T x (lift +h d x1))).(\lambda (H9: (pr3 e t1 x1)).(let H10 \def (eq_ind T x (\lambda (t: +T).(eq T t (lift h d x0))) H5 (lift h d x1) H8) in (let H11 \def (eq_ind T x1 +(\lambda (t: T).(pr3 e t1 t)) H9 x0 (lift_inj x1 x0 h d H10)) in (pc3_pr3_t e +t1 x0 H11 t2 H6)))))) H7))))) H4))))) H1))))))))). + +theorem pc3_gen_not_abst: + \forall (b: B).((not (eq B b Abst)) \to (\forall (c: C).(\forall (t1: +T).(\forall (t2: T).(\forall (u1: T).(\forall (u2: T).((pc3 c (THead (Bind b) +u1 t1) (THead (Bind Abst) u2 t2)) \to (pc3 (CHead c (Bind b) u1) t1 (lift (S +O) O (THead (Bind Abst) u2 t2)))))))))) +\def + \lambda (b: B).(B_ind (\lambda (b0: B).((not (eq B b0 Abst)) \to (\forall +(c: C).(\forall (t1: T).(\forall (t2: T).(\forall (u1: T).(\forall (u2: +T).((pc3 c (THead (Bind b0) u1 t1) (THead (Bind Abst) u2 t2)) \to (pc3 (CHead +c (Bind b0) u1) t1 (lift (S O) O (THead (Bind Abst) u2 t2))))))))))) (\lambda +(_: (not (eq B Abbr Abst))).(\lambda (c: C).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H0: (pc3 c (THead (Bind Abbr) +u1 t1) (THead (Bind Abst) u2 t2))).(let H1 \def H0 in (ex2_ind T (\lambda (t: +T).(pr3 c (THead (Bind Abbr) u1 t1) t)) (\lambda (t: T).(pr3 c (THead (Bind +Abst) u2 t2) t)) (pc3 (CHead c (Bind Abbr) u1) t1 (lift (S O) O (THead (Bind +Abst) u2 t2))) (\lambda (x: T).(\lambda (H2: (pr3 c (THead (Bind Abbr) u1 t1) +x)).(\lambda (H3: (pr3 c (THead (Bind Abst) u2 t2) x)).(let H4 \def +(pr3_gen_abbr c u1 t1 x H2) in (or_ind (ex3_2 T T (\lambda (u3: T).(\lambda +(t3: T).(eq T x (THead (Bind Abbr) u3 t3)))) (\lambda (u3: T).(\lambda (_: +T).(pr3 c u1 u3))) (\lambda (_: T).(\lambda (t3: T).(pr3 (CHead c (Bind Abbr) +u1) t1 t3)))) (pr3 (CHead c (Bind Abbr) u1) t1 (lift (S O) O x)) (pc3 (CHead +c (Bind Abbr) u1) t1 (lift (S O) O (THead (Bind Abst) u2 t2))) (\lambda (H5: +(ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u3 +t3)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c u1 u3))) (\lambda (_: +T).(\lambda (t3: T).(pr3 (CHead c (Bind Abbr) u1) t1 t3))))).(ex3_2_ind T T +(\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u3 t3)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c u1 u3))) (\lambda (_: T).(\lambda +(t3: T).(pr3 (CHead c (Bind Abbr) u1) t1 t3))) (pc3 (CHead c (Bind Abbr) u1) +t1 (lift (S O) O (THead (Bind Abst) u2 t2))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H6: (eq T x (THead (Bind Abbr) x0 x1))).(\lambda (_: (pr3 c u1 +x0)).(\lambda (_: (pr3 (CHead c (Bind Abbr) u1) t1 x1)).(let H9 \def +(pr3_gen_abst c u2 t2 x H3) in (ex3_2_ind T T (\lambda (u3: T).(\lambda (t3: +T).(eq T x (THead (Bind Abst) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr3 +c u2 u3))) (\lambda (_: T).(\lambda (t3: T).(\forall (b0: B).(\forall (u: +T).(pr3 (CHead c (Bind b0) u) t2 t3))))) (pc3 (CHead c (Bind Abbr) u1) t1 +(lift (S O) O (THead (Bind Abst) u2 t2))) (\lambda (x2: T).(\lambda (x3: +T).(\lambda (H10: (eq T x (THead (Bind Abst) x2 x3))).(\lambda (_: (pr3 c u2 +x2)).(\lambda (_: ((\forall (b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) +u) t2 x3))))).(let H13 \def (eq_ind T x (\lambda (t: T).(eq T t (THead (Bind +Abbr) x0 x1))) H6 (THead (Bind Abst) x2 x3) H10) in (let H14 \def (eq_ind T +(THead (Bind Abst) x2 x3) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind b0) \Rightarrow (match b0 in B return (\lambda (_: B).Prop) with [Abbr +\Rightarrow False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat +_) \Rightarrow False])])) I (THead (Bind Abbr) x0 x1) H13) in (False_ind (pc3 +(CHead c (Bind Abbr) u1) t1 (lift (S O) O (THead (Bind Abst) u2 t2))) +H14)))))))) H9))))))) H5)) (\lambda (H5: (pr3 (CHead c (Bind Abbr) u1) t1 +(lift (S O) O x))).(let H6 \def (pr3_gen_abst c u2 t2 x H3) in (ex3_2_ind T T +(\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u3 t3)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c u2 u3))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) u) t2 +t3))))) (pc3 (CHead c (Bind Abbr) u1) t1 (lift (S O) O (THead (Bind Abst) u2 +t2))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H7: (eq T x (THead (Bind +Abst) x0 x1))).(\lambda (H8: (pr3 c u2 x0)).(\lambda (H9: ((\forall (b0: +B).(\forall (u: T).(pr3 (CHead c (Bind b0) u) t2 x1))))).(let H10 \def +(eq_ind T x (\lambda (t: T).(pr3 (CHead c (Bind Abbr) u1) t1 (lift (S O) O +t))) H5 (THead (Bind Abst) x0 x1) H7) in (pc3_pr3_t (CHead c (Bind Abbr) u1) +t1 (lift (S O) O (THead (Bind Abst) x0 x1)) H10 (lift (S O) O (THead (Bind +Abst) u2 t2)) (pr3_lift (CHead c (Bind Abbr) u1) c (S O) O (drop_drop (Bind +Abbr) O c c (drop_refl c) u1) (THead (Bind Abst) u2 t2) (THead (Bind Abst) x0 +x1) (pr3_head_12 c u2 x0 H8 (Bind Abst) t2 x1 (H9 Abst x0)))))))))) H6))) +H4))))) H1))))))))) (\lambda (H: (not (eq B Abst Abst))).(\lambda (c: +C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (_: (pc3 c (THead (Bind Abst) u1 t1) (THead (Bind Abst) u2 +t2))).(let H1 \def (match (H (refl_equal B Abst)) in False return (\lambda +(_: False).(pc3 (CHead c (Bind Abst) u1) t1 (lift (S O) O (THead (Bind Abst) +u2 t2)))) with []) in H1)))))))) (\lambda (_: (not (eq B Void +Abst))).(\lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (u1: +T).(\lambda (u2: T).(\lambda (H0: (pc3 c (THead (Bind Void) u1 t1) (THead +(Bind Abst) u2 t2))).(let H1 \def H0 in (ex2_ind T (\lambda (t: T).(pr3 c +(THead (Bind Void) u1 t1) t)) (\lambda (t: T).(pr3 c (THead (Bind Abst) u2 +t2) t)) (pc3 (CHead c (Bind Void) u1) t1 (lift (S O) O (THead (Bind Abst) u2 +t2))) (\lambda (x: T).(\lambda (H2: (pr3 c (THead (Bind Void) u1 t1) +x)).(\lambda (H3: (pr3 c (THead (Bind Abst) u2 t2) x)).(let H4 \def +(pr3_gen_void c u1 t1 x H2) in (or_ind (ex3_2 T T (\lambda (u3: T).(\lambda +(t3: T).(eq T x (THead (Bind Void) u3 t3)))) (\lambda (u3: T).(\lambda (_: +T).(pr3 c u1 u3))) (\lambda (_: T).(\lambda (t3: T).(\forall (b0: B).(\forall +(u: T).(pr3 (CHead c (Bind b0) u) t1 t3)))))) (pr3 (CHead c (Bind Void) u1) +t1 (lift (S O) O x)) (pc3 (CHead c (Bind Void) u1) t1 (lift (S O) O (THead +(Bind Abst) u2 t2))) (\lambda (H5: (ex3_2 T T (\lambda (u3: T).(\lambda (t3: +T).(eq T x (THead (Bind Void) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr3 +c u1 u3))) (\lambda (_: T).(\lambda (t3: T).(\forall (b0: B).(\forall (u: +T).(pr3 (CHead c (Bind b0) u) t1 t3))))))).(ex3_2_ind T T (\lambda (u3: +T).(\lambda (t3: T).(eq T x (THead (Bind Void) u3 t3)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c u1 u3))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) u) t1 t3))))) (pc3 (CHead c +(Bind Void) u1) t1 (lift (S O) O (THead (Bind Abst) u2 t2))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H6: (eq T x (THead (Bind Void) x0 +x1))).(\lambda (_: (pr3 c u1 x0)).(\lambda (_: ((\forall (b0: B).(\forall (u: +T).(pr3 (CHead c (Bind b0) u) t1 x1))))).(let H9 \def (pr3_gen_abst c u2 t2 x +H3) in (ex3_2_ind T T (\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind +Abst) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c u2 u3))) (\lambda (_: +T).(\lambda (t3: T).(\forall (b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) +u) t2 t3))))) (pc3 (CHead c (Bind Void) u1) t1 (lift (S O) O (THead (Bind +Abst) u2 t2))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H10: (eq T x +(THead (Bind Abst) x2 x3))).(\lambda (_: (pr3 c u2 x2)).(\lambda (_: +((\forall (b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) u) t2 x3))))).(let +H13 \def (eq_ind T x (\lambda (t: T).(eq T t (THead (Bind Void) x0 x1))) H6 +(THead (Bind Abst) x2 x3) H10) in (let H14 \def (eq_ind T (THead (Bind Abst) +x2 x3) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b0) +\Rightarrow (match b0 in B return (\lambda (_: B).Prop) with [Abbr +\Rightarrow False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat +_) \Rightarrow False])])) I (THead (Bind Void) x0 x1) H13) in (False_ind (pc3 +(CHead c (Bind Void) u1) t1 (lift (S O) O (THead (Bind Abst) u2 t2))) +H14)))))))) H9))))))) H5)) (\lambda (H5: (pr3 (CHead c (Bind Void) u1) t1 +(lift (S O) O x))).(let H6 \def (pr3_gen_abst c u2 t2 x H3) in (ex3_2_ind T T +(\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u3 t3)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c u2 u3))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) u) t2 +t3))))) (pc3 (CHead c (Bind Void) u1) t1 (lift (S O) O (THead (Bind Abst) u2 +t2))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H7: (eq T x (THead (Bind +Abst) x0 x1))).(\lambda (H8: (pr3 c u2 x0)).(\lambda (H9: ((\forall (b0: +B).(\forall (u: T).(pr3 (CHead c (Bind b0) u) t2 x1))))).(let H10 \def +(eq_ind T x (\lambda (t: T).(pr3 (CHead c (Bind Void) u1) t1 (lift (S O) O +t))) H5 (THead (Bind Abst) x0 x1) H7) in (pc3_pr3_t (CHead c (Bind Void) u1) +t1 (lift (S O) O (THead (Bind Abst) x0 x1)) H10 (lift (S O) O (THead (Bind +Abst) u2 t2)) (pr3_lift (CHead c (Bind Void) u1) c (S O) O (drop_drop (Bind +Void) O c c (drop_refl c) u1) (THead (Bind Abst) u2 t2) (THead (Bind Abst) x0 +x1) (pr3_head_12 c u2 x0 H8 (Bind Abst) t2 x1 (H9 Abst x0)))))))))) H6))) +H4))))) H1))))))))) b). + +theorem pc3_gen_lift_abst: + \forall (c: C).(\forall (t: T).(\forall (t2: T).(\forall (u2: T).(\forall +(h: nat).(\forall (d: nat).((pc3 c (lift h d t) (THead (Bind Abst) u2 t2)) +\to (\forall (e: C).((drop h d c e) \to (ex3_2 T T (\lambda (u1: T).(\lambda +(t1: T).(pr3 e t (THead (Bind Abst) u1 t1)))) (\lambda (u1: T).(\lambda (_: +T).(pr3 c u2 (lift h d u1)))) (\lambda (_: T).(\lambda (t1: T).(\forall (b: +B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t2 (lift h (S d) +t1))))))))))))))) +\def + \lambda (c: C).(\lambda (t: T).(\lambda (t2: T).(\lambda (u2: T).(\lambda +(h: nat).(\lambda (d: nat).(\lambda (H: (pc3 c (lift h d t) (THead (Bind +Abst) u2 t2))).(\lambda (e: C).(\lambda (H0: (drop h d c e)).(let H1 \def H +in (ex2_ind T (\lambda (t0: T).(pr3 c (lift h d t) t0)) (\lambda (t0: T).(pr3 +c (THead (Bind Abst) u2 t2) t0)) (ex3_2 T T (\lambda (u1: T).(\lambda (t1: +T).(pr3 e t (THead (Bind Abst) u1 t1)))) (\lambda (u1: T).(\lambda (_: +T).(pr3 c u2 (lift h d u1)))) (\lambda (_: T).(\lambda (t1: T).(\forall (b: +B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t2 (lift h (S d) t1))))))) +(\lambda (x: T).(\lambda (H2: (pr3 c (lift h d t) x)).(\lambda (H3: (pr3 c +(THead (Bind Abst) u2 t2) x)).(let H4 \def (pr3_gen_lift c t x h d H2 e H0) +in (ex2_ind T (\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: T).(pr3 +e t t3)) (ex3_2 T T (\lambda (u1: T).(\lambda (t1: T).(pr3 e t (THead (Bind +Abst) u1 t1)))) (\lambda (u1: T).(\lambda (_: T).(pr3 c u2 (lift h d u1)))) +(\lambda (_: T).(\lambda (t1: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead +c (Bind b) u) t2 (lift h (S d) t1))))))) (\lambda (x0: T).(\lambda (H5: (eq T +x (lift h d x0))).(\lambda (H6: (pr3 e t x0)).(let H7 \def (pr3_gen_abst c u2 +t2 x H3) in (ex3_2_ind T T (\lambda (u3: T).(\lambda (t3: T).(eq T x (THead +(Bind Abst) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c u2 u3))) +(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead +c (Bind b) u) t2 t3))))) (ex3_2 T T (\lambda (u1: T).(\lambda (t1: T).(pr3 e +t (THead (Bind Abst) u1 t1)))) (\lambda (u1: T).(\lambda (_: T).(pr3 c u2 +(lift h d u1)))) (\lambda (_: T).(\lambda (t1: T).(\forall (b: B).(\forall +(u: T).(pr3 (CHead c (Bind b) u) t2 (lift h (S d) t1))))))) (\lambda (x1: +T).(\lambda (x2: T).(\lambda (H8: (eq T x (THead (Bind Abst) x1 +x2))).(\lambda (H9: (pr3 c u2 x1)).(\lambda (H10: ((\forall (b: B).(\forall +(u: T).(pr3 (CHead c (Bind b) u) t2 x2))))).(let H11 \def (eq_ind T x +(\lambda (t0: T).(eq T t0 (lift h d x0))) H5 (THead (Bind Abst) x1 x2) H8) in +(ex3_2_ind T T (\lambda (y: T).(\lambda (z: T).(eq T x0 (THead (Bind Abst) y +z)))) (\lambda (y: T).(\lambda (_: T).(eq T x1 (lift h d y)))) (\lambda (_: +T).(\lambda (z: T).(eq T x2 (lift h (S d) z)))) (ex3_2 T T (\lambda (u1: +T).(\lambda (t1: T).(pr3 e t (THead (Bind Abst) u1 t1)))) (\lambda (u1: +T).(\lambda (_: T).(pr3 c u2 (lift h d u1)))) (\lambda (_: T).(\lambda (t1: +T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t2 (lift h (S d) +t1))))))) (\lambda (x3: T).(\lambda (x4: T).(\lambda (H12: (eq T x0 (THead +(Bind Abst) x3 x4))).(\lambda (H13: (eq T x1 (lift h d x3))).(\lambda (H14: +(eq T x2 (lift h (S d) x4))).(let H15 \def (eq_ind T x2 (\lambda (t0: +T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t2 t0)))) H10 +(lift h (S d) x4) H14) in (let H16 \def (eq_ind T x1 (\lambda (t0: T).(pr3 c +u2 t0)) H9 (lift h d x3) H13) in (let H17 \def (eq_ind T x0 (\lambda (t0: +T).(pr3 e t t0)) H6 (THead (Bind Abst) x3 x4) H12) in (ex3_2_intro T T +(\lambda (u1: T).(\lambda (t1: T).(pr3 e t (THead (Bind Abst) u1 t1)))) +(\lambda (u1: T).(\lambda (_: T).(pr3 c u2 (lift h d u1)))) (\lambda (_: +T).(\lambda (t1: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +t2 (lift h (S d) t1)))))) x3 x4 H17 H16 H15))))))))) (lift_gen_bind Abst x1 +x2 x0 h d H11)))))))) H7))))) H4))))) H1)))))))))). + +theorem pc3_gen_sort_abst: + \forall (c: C).(\forall (u: T).(\forall (t: T).(\forall (n: nat).((pc3 c +(TSort n) (THead (Bind Abst) u t)) \to (\forall (P: Prop).P))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (n: nat).(\lambda +(H: (pc3 c (TSort n) (THead (Bind Abst) u t))).(\lambda (P: Prop).(let H0 +\def H in (ex2_ind T (\lambda (t0: T).(pr3 c (TSort n) t0)) (\lambda (t0: +T).(pr3 c (THead (Bind Abst) u t) t0)) P (\lambda (x: T).(\lambda (H1: (pr3 c +(TSort n) x)).(\lambda (H2: (pr3 c (THead (Bind Abst) u t) x)).(let H3 \def +(pr3_gen_abst c u t x H2) in (ex3_2_ind T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 +c u u2))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u0: +T).(pr3 (CHead c (Bind b) u0) t t2))))) P (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H4: (eq T x (THead (Bind Abst) x0 x1))).(\lambda (_: (pr3 c u +x0)).(\lambda (_: ((\forall (b: B).(\forall (u0: T).(pr3 (CHead c (Bind b) +u0) t x1))))).(let H7 \def (eq_ind T x (\lambda (t0: T).(eq T t0 (TSort n))) +(pr3_gen_sort c x n H1) (THead (Bind Abst) x0 x1) H4) in (let H8 \def (eq_ind +T (THead (Bind Abst) x0 x1) (\lambda (ee: T).(match ee in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False +| (THead _ _ _) \Rightarrow True])) I (TSort n) H7) in (False_ind P +H8)))))))) H3))))) H0))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/left.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/left.ma new file mode 100644 index 000000000..3a6db7706 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/left.ma @@ -0,0 +1,109 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/left". + +include "pc3/props.ma". + +theorem pc3_ind_left__pc3_left_pr3: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t1 t2) \to +(pc3_left c t1 t2)))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c t1 +t2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(pc3_left c t t0))) (\lambda +(t: T).(pc3_left_r c t)) (\lambda (t0: T).(\lambda (t3: T).(\lambda (H0: (pr2 +c t3 t0)).(\lambda (t4: T).(\lambda (_: (pr3 c t0 t4)).(\lambda (H2: +(pc3_left c t0 t4)).(pc3_left_ur c t3 t0 H0 t4 H2))))))) t1 t2 H)))). + +theorem pc3_ind_left__pc3_left_trans: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pc3_left c t1 t2) \to +(\forall (t3: T).((pc3_left c t2 t3) \to (pc3_left c t1 t3)))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc3_left c t1 +t2)).(pc3_left_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (t3: +T).((pc3_left c t0 t3) \to (pc3_left c t t3))))) (\lambda (t: T).(\lambda +(t3: T).(\lambda (H0: (pc3_left c t t3)).H0))) (\lambda (t0: T).(\lambda (t3: +T).(\lambda (H0: (pr2 c t0 t3)).(\lambda (t4: T).(\lambda (_: (pc3_left c t3 +t4)).(\lambda (H2: ((\forall (t5: T).((pc3_left c t4 t5) \to (pc3_left c t3 +t5))))).(\lambda (t5: T).(\lambda (H3: (pc3_left c t4 t5)).(pc3_left_ur c t0 +t3 H0 t5 (H2 t5 H3)))))))))) (\lambda (t0: T).(\lambda (t3: T).(\lambda (H0: +(pr2 c t0 t3)).(\lambda (t4: T).(\lambda (_: (pc3_left c t0 t4)).(\lambda +(H2: ((\forall (t5: T).((pc3_left c t4 t5) \to (pc3_left c t0 +t5))))).(\lambda (t5: T).(\lambda (H3: (pc3_left c t4 t5)).(pc3_left_ux c t0 +t3 H0 t5 (H2 t5 H3)))))))))) t1 t2 H)))). + +theorem pc3_ind_left__pc3_left_sym: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pc3_left c t1 t2) \to +(pc3_left c t2 t1)))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc3_left c t1 +t2)).(pc3_left_ind c (\lambda (t: T).(\lambda (t0: T).(pc3_left c t0 t))) +(\lambda (t: T).(pc3_left_r c t)) (\lambda (t0: T).(\lambda (t3: T).(\lambda +(H0: (pr2 c t0 t3)).(\lambda (t4: T).(\lambda (_: (pc3_left c t3 +t4)).(\lambda (H2: (pc3_left c t4 t3)).(pc3_ind_left__pc3_left_trans c t4 t3 +H2 t0 (pc3_left_ux c t0 t3 H0 t0 (pc3_left_r c t0))))))))) (\lambda (t0: +T).(\lambda (t3: T).(\lambda (H0: (pr2 c t0 t3)).(\lambda (t4: T).(\lambda +(_: (pc3_left c t0 t4)).(\lambda (H2: (pc3_left c t4 +t0)).(pc3_ind_left__pc3_left_trans c t4 t0 H2 t3 (pc3_left_ur c t0 t3 H0 t3 +(pc3_left_r c t3))))))))) t1 t2 H)))). + +theorem pc3_ind_left__pc3_left_pc3: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pc3 c t1 t2) \to +(pc3_left c t1 t2)))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc3 c t1 +t2)).(let H0 \def H in (ex2_ind T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: +T).(pr3 c t2 t)) (pc3_left c t1 t2) (\lambda (x: T).(\lambda (H1: (pr3 c t1 +x)).(\lambda (H2: (pr3 c t2 x)).(pc3_ind_left__pc3_left_trans c t1 x +(pc3_ind_left__pc3_left_pr3 c t1 x H1) t2 (pc3_ind_left__pc3_left_sym c t2 x +(pc3_ind_left__pc3_left_pr3 c t2 x H2)))))) H0))))). + +theorem pc3_ind_left__pc3_pc3_left: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pc3_left c t1 t2) \to +(pc3 c t1 t2)))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc3_left c t1 +t2)).(pc3_left_ind c (\lambda (t: T).(\lambda (t0: T).(pc3 c t t0))) (\lambda +(t: T).(pc3_refl c t)) (\lambda (t0: T).(\lambda (t3: T).(\lambda (H0: (pr2 c +t0 t3)).(\lambda (t4: T).(\lambda (_: (pc3_left c t3 t4)).(\lambda (H2: (pc3 +c t3 t4)).(pc3_t t3 c t0 (pc3_pr2_r c t0 t3 H0) t4 H2))))))) (\lambda (t0: +T).(\lambda (t3: T).(\lambda (H0: (pr2 c t0 t3)).(\lambda (t4: T).(\lambda +(_: (pc3_left c t0 t4)).(\lambda (H2: (pc3 c t0 t4)).(pc3_t t0 c t3 +(pc3_pr2_x c t3 t0 H0) t4 H2))))))) t1 t2 H)))). + +theorem pc3_ind_left: + \forall (c: C).(\forall (P: ((T \to (T \to Prop)))).(((\forall (t: T).(P t +t))) \to (((\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall (t3: +T).((pc3 c t2 t3) \to ((P t2 t3) \to (P t1 t3)))))))) \to (((\forall (t1: +T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall (t3: T).((pc3 c t1 t3) \to +((P t1 t3) \to (P t2 t3)))))))) \to (\forall (t: T).(\forall (t0: T).((pc3 c +t t0) \to (P t t0)))))))) +\def + \lambda (c: C).(\lambda (P: ((T \to (T \to Prop)))).(\lambda (H: ((\forall +(t: T).(P t t)))).(\lambda (H0: ((\forall (t1: T).(\forall (t2: T).((pr2 c t1 +t2) \to (\forall (t3: T).((pc3 c t2 t3) \to ((P t2 t3) \to (P t1 +t3))))))))).(\lambda (H1: ((\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) +\to (\forall (t3: T).((pc3 c t1 t3) \to ((P t1 t3) \to (P t2 +t3))))))))).(\lambda (t: T).(\lambda (t0: T).(\lambda (H2: (pc3 c t +t0)).(pc3_left_ind c (\lambda (t1: T).(\lambda (t2: T).(P t1 t2))) H (\lambda +(t1: T).(\lambda (t2: T).(\lambda (H3: (pr2 c t1 t2)).(\lambda (t3: +T).(\lambda (H4: (pc3_left c t2 t3)).(\lambda (H5: (P t2 t3)).(H0 t1 t2 H3 t3 +(pc3_ind_left__pc3_pc3_left c t2 t3 H4) H5))))))) (\lambda (t1: T).(\lambda +(t2: T).(\lambda (H3: (pr2 c t1 t2)).(\lambda (t3: T).(\lambda (H4: (pc3_left +c t1 t3)).(\lambda (H5: (P t1 t3)).(H1 t1 t2 H3 t3 +(pc3_ind_left__pc3_pc3_left c t1 t3 H4) H5))))))) t t0 +(pc3_ind_left__pc3_left_pc3 c t t0 H2))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/nf2.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/nf2.ma new file mode 100644 index 000000000..41136207b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/nf2.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/nf2". + +include "pc3/defs.ma". + +include "nf2/pr3.ma". + +theorem pc3_nf2: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pc3 c t1 t2) \to ((nf2 c +t1) \to ((nf2 c t2) \to (eq T t1 t2)))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc3 c t1 +t2)).(\lambda (H0: (nf2 c t1)).(\lambda (H1: (nf2 c t2)).(let H2 \def H in +(ex2_ind T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: T).(pr3 c t2 t)) (eq T +t1 t2) (\lambda (x: T).(\lambda (H3: (pr3 c t1 x)).(\lambda (H4: (pr3 c t2 +x)).(let H_y \def (nf2_pr3_unfold c t1 x H3 H0) in (let H5 \def (eq_ind_r T x +(\lambda (t: T).(pr3 c t2 t)) H4 t1 H_y) in (let H6 \def (eq_ind_r T x +(\lambda (t: T).(pr3 c t1 t)) H3 t1 H_y) in (let H_y0 \def (nf2_pr3_unfold c +t2 t1 H5 H1) in (let H7 \def (eq_ind T t2 (\lambda (t: T).(pr3 c t t1)) H5 t1 +H_y0) in (eq_ind_r T t1 (\lambda (t: T).(eq T t1 t)) (refl_equal T t1) t2 +H_y0))))))))) H2))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/pc1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/pc1.ma new file mode 100644 index 000000000..0893239e4 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/pc1.ma @@ -0,0 +1,35 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/pc1". + +include "pc3/defs.ma". + +include "pc1/defs.ma". + +include "pr3/pr1.ma". + +theorem pc3_pc1: + \forall (t1: T).(\forall (t2: T).((pc1 t1 t2) \to (\forall (c: C).(pc3 c t1 +t2)))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc1 t1 t2)).(\lambda (c: +C).(let H0 \def H in (ex2_ind T (\lambda (t: T).(pr1 t1 t)) (\lambda (t: +T).(pr1 t2 t)) (pc3 c t1 t2) (\lambda (x: T).(\lambda (H1: (pr1 t1 +x)).(\lambda (H2: (pr1 t2 x)).(ex_intro2 T (\lambda (t: T).(pr3 c t1 t)) +(\lambda (t: T).(pr3 c t2 t)) x (pr3_pr1 t1 x H1 c) (pr3_pr1 t2 x H2 c))))) +H0))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/props.ma new file mode 100644 index 000000000..98a40de4e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/props.ma @@ -0,0 +1,460 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/props". + +include "pc3/defs.ma". + +include "pr3/pr3.ma". + +theorem clear_pc3_trans: + \forall (c2: C).(\forall (t1: T).(\forall (t2: T).((pc3 c2 t1 t2) \to +(\forall (c1: C).((clear c1 c2) \to (pc3 c1 t1 t2)))))) +\def + \lambda (c2: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc3 c2 t1 +t2)).(\lambda (c1: C).(\lambda (H0: (clear c1 c2)).(let H1 \def H in (ex2_ind +T (\lambda (t: T).(pr3 c2 t1 t)) (\lambda (t: T).(pr3 c2 t2 t)) (pc3 c1 t1 +t2) (\lambda (x: T).(\lambda (H2: (pr3 c2 t1 x)).(\lambda (H3: (pr3 c2 t2 +x)).(ex_intro2 T (\lambda (t: T).(pr3 c1 t1 t)) (\lambda (t: T).(pr3 c1 t2 +t)) x (clear_pr3_trans c2 t1 x H2 c1 H0) (clear_pr3_trans c2 t2 x H3 c1 +H0))))) H1))))))). + +theorem pc3_pr2_r: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (pc3 c +t1 t2)))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c t1 +t2)).(ex_intro2 T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: T).(pr3 c t2 t)) +t2 (pr3_pr2 c t1 t2 H) (pr3_refl c t2))))). + +theorem pc3_pr2_x: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr2 c t2 t1) \to (pc3 c +t1 t2)))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c t2 +t1)).(ex_intro2 T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: T).(pr3 c t2 t)) +t1 (pr3_refl c t1) (pr3_pr2 c t2 t1 H))))). + +theorem pc3_pr3_r: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t1 t2) \to (pc3 c +t1 t2)))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c t1 +t2)).(ex_intro2 T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: T).(pr3 c t2 t)) +t2 H (pr3_refl c t2))))). + +theorem pc3_pr3_x: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t2 t1) \to (pc3 c +t1 t2)))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c t2 +t1)).(ex_intro2 T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: T).(pr3 c t2 t)) +t1 (pr3_refl c t1) H)))). + +theorem pc3_pr3_t: + \forall (c: C).(\forall (t1: T).(\forall (t0: T).((pr3 c t1 t0) \to (\forall +(t2: T).((pr3 c t2 t0) \to (pc3 c t1 t2)))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t0: T).(\lambda (H: (pr3 c t1 +t0)).(\lambda (t2: T).(\lambda (H0: (pr3 c t2 t0)).(ex_intro2 T (\lambda (t: +T).(pr3 c t1 t)) (\lambda (t: T).(pr3 c t2 t)) t0 H H0)))))). + +theorem pc3_pr2_u: + \forall (c: C).(\forall (t2: T).(\forall (t1: T).((pr2 c t1 t2) \to (\forall +(t3: T).((pc3 c t2 t3) \to (pc3 c t1 t3)))))) +\def + \lambda (c: C).(\lambda (t2: T).(\lambda (t1: T).(\lambda (H: (pr2 c t1 +t2)).(\lambda (t3: T).(\lambda (H0: (pc3 c t2 t3)).(let H1 \def H0 in +(ex2_ind T (\lambda (t: T).(pr3 c t2 t)) (\lambda (t: T).(pr3 c t3 t)) (pc3 c +t1 t3) (\lambda (x: T).(\lambda (H2: (pr3 c t2 x)).(\lambda (H3: (pr3 c t3 +x)).(ex_intro2 T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: T).(pr3 c t3 t)) +x (pr3_sing c t2 t1 H x H2) H3)))) H1))))))). + +theorem pc3_refl: + \forall (c: C).(\forall (t: T).(pc3 c t t)) +\def + \lambda (c: C).(\lambda (t: T).(ex_intro2 T (\lambda (t0: T).(pr3 c t t0)) +(\lambda (t0: T).(pr3 c t t0)) t (pr3_refl c t) (pr3_refl c t))). + +theorem pc3_s: + \forall (c: C).(\forall (t2: T).(\forall (t1: T).((pc3 c t1 t2) \to (pc3 c +t2 t1)))) +\def + \lambda (c: C).(\lambda (t2: T).(\lambda (t1: T).(\lambda (H: (pc3 c t1 +t2)).(let H0 \def H in (ex2_ind T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: +T).(pr3 c t2 t)) (pc3 c t2 t1) (\lambda (x: T).(\lambda (H1: (pr3 c t1 +x)).(\lambda (H2: (pr3 c t2 x)).(ex_intro2 T (\lambda (t: T).(pr3 c t2 t)) +(\lambda (t: T).(pr3 c t1 t)) x H2 H1)))) H0))))). + +theorem pc3_thin_dx: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pc3 c t1 t2) \to (\forall +(u: T).(\forall (f: F).(pc3 c (THead (Flat f) u t1) (THead (Flat f) u +t2))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc3 c t1 +t2)).(\lambda (u: T).(\lambda (f: F).(let H0 \def H in (ex2_ind T (\lambda +(t: T).(pr3 c t1 t)) (\lambda (t: T).(pr3 c t2 t)) (pc3 c (THead (Flat f) u +t1) (THead (Flat f) u t2)) (\lambda (x: T).(\lambda (H1: (pr3 c t1 +x)).(\lambda (H2: (pr3 c t2 x)).(ex_intro2 T (\lambda (t: T).(pr3 c (THead +(Flat f) u t1) t)) (\lambda (t: T).(pr3 c (THead (Flat f) u t2) t)) (THead +(Flat f) u x) (pr3_thin_dx c t1 x H1 u f) (pr3_thin_dx c t2 x H2 u f))))) +H0))))))). + +theorem pc3_head_1: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pc3 c u1 u2) \to (\forall +(k: K).(\forall (t: T).(pc3 c (THead k u1 t) (THead k u2 t))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pc3 c u1 +u2)).(\lambda (k: K).(\lambda (t: T).(let H0 \def H in (ex2_ind T (\lambda +(t0: T).(pr3 c u1 t0)) (\lambda (t0: T).(pr3 c u2 t0)) (pc3 c (THead k u1 t) +(THead k u2 t)) (\lambda (x: T).(\lambda (H1: (pr3 c u1 x)).(\lambda (H2: +(pr3 c u2 x)).(ex_intro2 T (\lambda (t0: T).(pr3 c (THead k u1 t) t0)) +(\lambda (t0: T).(pr3 c (THead k u2 t) t0)) (THead k x t) (pr3_head_12 c u1 x +H1 k t t (pr3_refl (CHead c k x) t)) (pr3_head_12 c u2 x H2 k t t (pr3_refl +(CHead c k x) t)))))) H0))))))). + +theorem pc3_head_2: + \forall (c: C).(\forall (u: T).(\forall (t1: T).(\forall (t2: T).(\forall +(k: K).((pc3 (CHead c k u) t1 t2) \to (pc3 c (THead k u t1) (THead k u +t2))))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(k: K).(\lambda (H: (pc3 (CHead c k u) t1 t2)).(let H0 \def H in (ex2_ind T +(\lambda (t: T).(pr3 (CHead c k u) t1 t)) (\lambda (t: T).(pr3 (CHead c k u) +t2 t)) (pc3 c (THead k u t1) (THead k u t2)) (\lambda (x: T).(\lambda (H1: +(pr3 (CHead c k u) t1 x)).(\lambda (H2: (pr3 (CHead c k u) t2 x)).(ex_intro2 +T (\lambda (t: T).(pr3 c (THead k u t1) t)) (\lambda (t: T).(pr3 c (THead k u +t2) t)) (THead k u x) (pr3_head_12 c u u (pr3_refl c u) k t1 x H1) +(pr3_head_12 c u u (pr3_refl c u) k t2 x H2))))) H0))))))). + +theorem pc3_t: + \forall (t2: T).(\forall (c: C).(\forall (t1: T).((pc3 c t1 t2) \to (\forall +(t3: T).((pc3 c t2 t3) \to (pc3 c t1 t3)))))) +\def + \lambda (t2: T).(\lambda (c: C).(\lambda (t1: T).(\lambda (H: (pc3 c t1 +t2)).(\lambda (t3: T).(\lambda (H0: (pc3 c t2 t3)).(let H1 \def H0 in +(ex2_ind T (\lambda (t: T).(pr3 c t2 t)) (\lambda (t: T).(pr3 c t3 t)) (pc3 c +t1 t3) (\lambda (x: T).(\lambda (H2: (pr3 c t2 x)).(\lambda (H3: (pr3 c t3 +x)).(let H4 \def H in (ex2_ind T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: +T).(pr3 c t2 t)) (pc3 c t1 t3) (\lambda (x0: T).(\lambda (H5: (pr3 c t1 +x0)).(\lambda (H6: (pr3 c t2 x0)).(ex2_ind T (\lambda (t: T).(pr3 c x0 t)) +(\lambda (t: T).(pr3 c x t)) (pc3 c t1 t3) (\lambda (x1: T).(\lambda (H7: +(pr3 c x0 x1)).(\lambda (H8: (pr3 c x x1)).(pc3_pr3_t c t1 x1 (pr3_t x0 t1 c +H5 x1 H7) t3 (pr3_t x t3 c H3 x1 H8))))) (pr3_confluence c t2 x0 H6 x H2))))) +H4))))) H1))))))). + +theorem pc3_pr2_u2: + \forall (c: C).(\forall (t0: T).(\forall (t1: T).((pr2 c t0 t1) \to (\forall +(t2: T).((pc3 c t0 t2) \to (pc3 c t1 t2)))))) +\def + \lambda (c: C).(\lambda (t0: T).(\lambda (t1: T).(\lambda (H: (pr2 c t0 +t1)).(\lambda (t2: T).(\lambda (H0: (pc3 c t0 t2)).(pc3_t t0 c t1 (pc3_pr2_x +c t1 t0 H) t2 H0)))))). + +theorem pc3_head_12: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pc3 c u1 u2) \to (\forall +(k: K).(\forall (t1: T).(\forall (t2: T).((pc3 (CHead c k u2) t1 t2) \to (pc3 +c (THead k u1 t1) (THead k u2 t2))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pc3 c u1 +u2)).(\lambda (k: K).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pc3 +(CHead c k u2) t1 t2)).(pc3_t (THead k u2 t1) c (THead k u1 t1) (pc3_head_1 c +u1 u2 H k t1) (THead k u2 t2) (pc3_head_2 c u2 t1 t2 k H0))))))))). + +theorem pc3_head_21: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pc3 c u1 u2) \to (\forall +(k: K).(\forall (t1: T).(\forall (t2: T).((pc3 (CHead c k u1) t1 t2) \to (pc3 +c (THead k u1 t1) (THead k u2 t2))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pc3 c u1 +u2)).(\lambda (k: K).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pc3 +(CHead c k u1) t1 t2)).(pc3_t (THead k u1 t2) c (THead k u1 t1) (pc3_head_2 c +u1 t1 t2 k H0) (THead k u2 t2) (pc3_head_1 c u1 u2 H k t2))))))))). + +theorem pc3_pr0_pr2_t: + \forall (u1: T).(\forall (u2: T).((pr0 u2 u1) \to (\forall (c: C).(\forall +(t1: T).(\forall (t2: T).(\forall (k: K).((pr2 (CHead c k u2) t1 t2) \to (pc3 +(CHead c k u1) t1 t2)))))))) +\def + \lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr0 u2 u1)).(\lambda (c: +C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (k: K).(\lambda (H0: (pr2 +(CHead c k u2) t1 t2)).(let H1 \def (match H0 in pr2 return (\lambda (c0: +C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 +(CHead c k u2)) \to ((eq T t t1) \to ((eq T t0 t2) \to (pc3 (CHead c k u1) t1 +t2)))))))) with [(pr2_free c0 t0 t3 H1) \Rightarrow (\lambda (H2: (eq C c0 +(CHead c k u2))).(\lambda (H3: (eq T t0 t1)).(\lambda (H4: (eq T t3 +t2)).(eq_ind C (CHead c k u2) (\lambda (_: C).((eq T t0 t1) \to ((eq T t3 t2) +\to ((pr0 t0 t3) \to (pc3 (CHead c k u1) t1 t2))))) (\lambda (H5: (eq T t0 +t1)).(eq_ind T t1 (\lambda (t: T).((eq T t3 t2) \to ((pr0 t t3) \to (pc3 +(CHead c k u1) t1 t2)))) (\lambda (H6: (eq T t3 t2)).(eq_ind T t2 (\lambda +(t: T).((pr0 t1 t) \to (pc3 (CHead c k u1) t1 t2))) (\lambda (H7: (pr0 t1 +t2)).(pc3_pr2_r (CHead c k u1) t1 t2 (pr2_free (CHead c k u1) t1 t2 H7))) t3 +(sym_eq T t3 t2 H6))) t0 (sym_eq T t0 t1 H5))) c0 (sym_eq C c0 (CHead c k u2) +H2) H3 H4 H1)))) | (pr2_delta c0 d u i H1 t0 t3 H2 t H3) \Rightarrow (\lambda +(H4: (eq C c0 (CHead c k u2))).(\lambda (H5: (eq T t0 t1)).(\lambda (H6: (eq +T t t2)).(eq_ind C (CHead c k u2) (\lambda (c1: C).((eq T t0 t1) \to ((eq T t +t2) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 t0 t3) \to ((subst0 i +u t3 t) \to (pc3 (CHead c k u1) t1 t2))))))) (\lambda (H7: (eq T t0 +t1)).(eq_ind T t1 (\lambda (t4: T).((eq T t t2) \to ((getl i (CHead c k u2) +(CHead d (Bind Abbr) u)) \to ((pr0 t4 t3) \to ((subst0 i u t3 t) \to (pc3 +(CHead c k u1) t1 t2)))))) (\lambda (H8: (eq T t t2)).(eq_ind T t2 (\lambda +(t4: T).((getl i (CHead c k u2) (CHead d (Bind Abbr) u)) \to ((pr0 t1 t3) \to +((subst0 i u t3 t4) \to (pc3 (CHead c k u1) t1 t2))))) (\lambda (H9: (getl i +(CHead c k u2) (CHead d (Bind Abbr) u))).(\lambda (H10: (pr0 t1 t3)).(\lambda +(H11: (subst0 i u t3 t2)).(nat_ind (\lambda (n: nat).((getl n (CHead c k u2) +(CHead d (Bind Abbr) u)) \to ((subst0 n u t3 t2) \to (pc3 (CHead c k u1) t1 +t2)))) (\lambda (H12: (getl O (CHead c k u2) (CHead d (Bind Abbr) +u))).(\lambda (H13: (subst0 O u t3 t2)).(K_ind (\lambda (k0: K).((clear +(CHead c k0 u2) (CHead d (Bind Abbr) u)) \to (pc3 (CHead c k0 u1) t1 t2))) +(\lambda (b: B).(\lambda (H14: (clear (CHead c (Bind b) u2) (CHead d (Bind +Abbr) u))).(let H15 \def (f_equal C C (\lambda (e: C).(match e in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c1 _ _) \Rightarrow +c1])) (CHead d (Bind Abbr) u) (CHead c (Bind b) u2) (clear_gen_bind b c +(CHead d (Bind Abbr) u) u2 H14)) in ((let H16 \def (f_equal C B (\lambda (e: +C).(match e in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | +(CHead _ k0 _) \Rightarrow (match k0 in K return (\lambda (_: K).B) with +[(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind +Abbr) u) (CHead c (Bind b) u2) (clear_gen_bind b c (CHead d (Bind Abbr) u) u2 +H14)) in ((let H17 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t4) \Rightarrow +t4])) (CHead d (Bind Abbr) u) (CHead c (Bind b) u2) (clear_gen_bind b c +(CHead d (Bind Abbr) u) u2 H14)) in (\lambda (H18: (eq B Abbr b)).(\lambda +(_: (eq C d c)).(let H20 \def (eq_ind T u (\lambda (t4: T).(subst0 O t4 t3 +t2)) H13 u2 H17) in (eq_ind B Abbr (\lambda (b0: B).(pc3 (CHead c (Bind b0) +u1) t1 t2)) (ex2_ind T (\lambda (t4: T).(subst0 O u1 t3 t4)) (\lambda (t4: +T).(pr0 t2 t4)) (pc3 (CHead c (Bind Abbr) u1) t1 t2) (\lambda (x: T).(\lambda +(H21: (subst0 O u1 t3 x)).(\lambda (H22: (pr0 t2 x)).(pc3_pr3_t (CHead c +(Bind Abbr) u1) t1 x (pr3_pr2 (CHead c (Bind Abbr) u1) t1 x (pr2_delta (CHead +c (Bind Abbr) u1) c u1 O (getl_refl Abbr c u1) t1 t3 H10 x H21)) t2 (pr3_pr2 +(CHead c (Bind Abbr) u1) t2 x (pr2_free (CHead c (Bind Abbr) u1) t2 x +H22)))))) (pr0_subst0_fwd u2 t3 t2 O H20 u1 H)) b H18))))) H16)) H15)))) +(\lambda (f: F).(\lambda (H14: (clear (CHead c (Flat f) u2) (CHead d (Bind +Abbr) u))).(clear_pc3_trans (CHead d (Bind Abbr) u) t1 t2 (pc3_pr2_r (CHead d +(Bind Abbr) u) t1 t2 (pr2_delta (CHead d (Bind Abbr) u) d u O (getl_refl Abbr +d u) t1 t3 H10 t2 H13)) (CHead c (Flat f) u1) (clear_flat c (CHead d (Bind +Abbr) u) (clear_gen_flat f c (CHead d (Bind Abbr) u) u2 H14) f u1)))) k +(getl_gen_O (CHead c k u2) (CHead d (Bind Abbr) u) H12)))) (\lambda (i0: +nat).(\lambda (IHi: (((getl i0 (CHead c k u2) (CHead d (Bind Abbr) u)) \to +((subst0 i0 u t3 t2) \to (pc3 (CHead c k u1) t1 t2))))).(\lambda (H12: (getl +(S i0) (CHead c k u2) (CHead d (Bind Abbr) u))).(\lambda (H13: (subst0 (S i0) +u t3 t2)).(K_ind (\lambda (k0: K).((((getl i0 (CHead c k0 u2) (CHead d (Bind +Abbr) u)) \to ((subst0 i0 u t3 t2) \to (pc3 (CHead c k0 u1) t1 t2)))) \to +((getl (r k0 i0) c (CHead d (Bind Abbr) u)) \to (pc3 (CHead c k0 u1) t1 +t2)))) (\lambda (b: B).(\lambda (_: (((getl i0 (CHead c (Bind b) u2) (CHead d +(Bind Abbr) u)) \to ((subst0 i0 u t3 t2) \to (pc3 (CHead c (Bind b) u1) t1 +t2))))).(\lambda (H14: (getl (r (Bind b) i0) c (CHead d (Bind Abbr) +u))).(pc3_pr2_r (CHead c (Bind b) u1) t1 t2 (pr2_delta (CHead c (Bind b) u1) +d u (S i0) (getl_head (Bind b) i0 c (CHead d (Bind Abbr) u) H14 u1) t1 t3 H10 +t2 H13))))) (\lambda (f: F).(\lambda (_: (((getl i0 (CHead c (Flat f) u2) +(CHead d (Bind Abbr) u)) \to ((subst0 i0 u t3 t2) \to (pc3 (CHead c (Flat f) +u1) t1 t2))))).(\lambda (H14: (getl (r (Flat f) i0) c (CHead d (Bind Abbr) +u))).(pc3_pr2_r (CHead c (Flat f) u1) t1 t2 (pr2_cflat c t1 t2 (pr2_delta c d +u (r (Flat f) i0) H14 t1 t3 H10 t2 H13) f u1))))) k IHi (getl_gen_S k c +(CHead d (Bind Abbr) u) u2 i0 H12)))))) i H9 H11)))) t (sym_eq T t t2 H8))) +t0 (sym_eq T t0 t1 H7))) c0 (sym_eq C c0 (CHead c k u2) H4) H5 H6 H1 H2 +H3))))]) in (H1 (refl_equal C (CHead c k u2)) (refl_equal T t1) (refl_equal T +t2)))))))))). + +theorem pc3_pr2_pr2_t: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr2 c u2 u1) \to (\forall +(t1: T).(\forall (t2: T).(\forall (k: K).((pr2 (CHead c k u2) t1 t2) \to (pc3 +(CHead c k u1) t1 t2)))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr2 c u2 +u1)).(let H0 \def (match H in pr2 return (\lambda (c0: C).(\lambda (t: +T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 c) \to ((eq T t u2) +\to ((eq T t0 u1) \to (\forall (t1: T).(\forall (t2: T).(\forall (k: K).((pr2 +(CHead c k u2) t1 t2) \to (pc3 (CHead c k u1) t1 t2)))))))))))) with +[(pr2_free c0 t1 t2 H0) \Rightarrow (\lambda (H1: (eq C c0 c)).(\lambda (H2: +(eq T t1 u2)).(\lambda (H3: (eq T t2 u1)).(eq_ind C c (\lambda (_: C).((eq T +t1 u2) \to ((eq T t2 u1) \to ((pr0 t1 t2) \to (\forall (t3: T).(\forall (t4: +T).(\forall (k: K).((pr2 (CHead c k u2) t3 t4) \to (pc3 (CHead c k u1) t3 +t4))))))))) (\lambda (H4: (eq T t1 u2)).(eq_ind T u2 (\lambda (t: T).((eq T +t2 u1) \to ((pr0 t t2) \to (\forall (t3: T).(\forall (t4: T).(\forall (k: +K).((pr2 (CHead c k u2) t3 t4) \to (pc3 (CHead c k u1) t3 t4)))))))) (\lambda +(H5: (eq T t2 u1)).(eq_ind T u1 (\lambda (t: T).((pr0 u2 t) \to (\forall (t3: +T).(\forall (t4: T).(\forall (k: K).((pr2 (CHead c k u2) t3 t4) \to (pc3 +(CHead c k u1) t3 t4))))))) (\lambda (H6: (pr0 u2 u1)).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (k: K).(\lambda (H7: (pr2 (CHead c k u2) t0 +t3)).(pc3_pr0_pr2_t u1 u2 H6 c t0 t3 k H7)))))) t2 (sym_eq T t2 u1 H5))) t1 +(sym_eq T t1 u2 H4))) c0 (sym_eq C c0 c H1) H2 H3 H0)))) | (pr2_delta c0 d u +i H0 t1 t2 H1 t H2) \Rightarrow (\lambda (H3: (eq C c0 c)).(\lambda (H4: (eq +T t1 u2)).(\lambda (H5: (eq T t u1)).(eq_ind C c (\lambda (c1: C).((eq T t1 +u2) \to ((eq T t u1) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 t1 +t2) \to ((subst0 i u t2 t) \to (\forall (t3: T).(\forall (t4: T).(\forall (k: +K).((pr2 (CHead c k u2) t3 t4) \to (pc3 (CHead c k u1) t3 t4))))))))))) +(\lambda (H6: (eq T t1 u2)).(eq_ind T u2 (\lambda (t0: T).((eq T t u1) \to +((getl i c (CHead d (Bind Abbr) u)) \to ((pr0 t0 t2) \to ((subst0 i u t2 t) +\to (\forall (t3: T).(\forall (t4: T).(\forall (k: K).((pr2 (CHead c k u2) t3 +t4) \to (pc3 (CHead c k u1) t3 t4)))))))))) (\lambda (H7: (eq T t +u1)).(eq_ind T u1 (\lambda (t0: T).((getl i c (CHead d (Bind Abbr) u)) \to +((pr0 u2 t2) \to ((subst0 i u t2 t0) \to (\forall (t3: T).(\forall (t4: +T).(\forall (k: K).((pr2 (CHead c k u2) t3 t4) \to (pc3 (CHead c k u1) t3 +t4))))))))) (\lambda (H8: (getl i c (CHead d (Bind Abbr) u))).(\lambda (H9: +(pr0 u2 t2)).(\lambda (H10: (subst0 i u t2 u1)).(\lambda (t0: T).(\lambda +(t3: T).(\lambda (k: K).(\lambda (H11: (pr2 (CHead c k u2) t0 t3)).(let H12 +\def (match H11 in pr2 return (\lambda (c1: C).(\lambda (t4: T).(\lambda (t5: +T).(\lambda (_: (pr2 c1 t4 t5)).((eq C c1 (CHead c k u2)) \to ((eq T t4 t0) +\to ((eq T t5 t3) \to (pc3 (CHead c k u1) t0 t3)))))))) with [(pr2_free c1 t4 +t5 H12) \Rightarrow (\lambda (H13: (eq C c1 (CHead c k u2))).(\lambda (H14: +(eq T t4 t0)).(\lambda (H15: (eq T t5 t3)).(eq_ind C (CHead c k u2) (\lambda +(_: C).((eq T t4 t0) \to ((eq T t5 t3) \to ((pr0 t4 t5) \to (pc3 (CHead c k +u1) t0 t3))))) (\lambda (H16: (eq T t4 t0)).(eq_ind T t0 (\lambda (t6: +T).((eq T t5 t3) \to ((pr0 t6 t5) \to (pc3 (CHead c k u1) t0 t3)))) (\lambda +(H17: (eq T t5 t3)).(eq_ind T t3 (\lambda (t6: T).((pr0 t0 t6) \to (pc3 +(CHead c k u1) t0 t3))) (\lambda (H18: (pr0 t0 t3)).(pc3_pr2_r (CHead c k u1) +t0 t3 (pr2_free (CHead c k u1) t0 t3 H18))) t5 (sym_eq T t5 t3 H17))) t4 +(sym_eq T t4 t0 H16))) c1 (sym_eq C c1 (CHead c k u2) H13) H14 H15 H12)))) | +(pr2_delta c1 d0 u0 i0 H12 t4 t5 H13 t6 H14) \Rightarrow (\lambda (H15: (eq C +c1 (CHead c k u2))).(\lambda (H16: (eq T t4 t0)).(\lambda (H17: (eq T t6 +t3)).(eq_ind C (CHead c k u2) (\lambda (c2: C).((eq T t4 t0) \to ((eq T t6 +t3) \to ((getl i0 c2 (CHead d0 (Bind Abbr) u0)) \to ((pr0 t4 t5) \to ((subst0 +i0 u0 t5 t6) \to (pc3 (CHead c k u1) t0 t3))))))) (\lambda (H18: (eq T t4 +t0)).(eq_ind T t0 (\lambda (t7: T).((eq T t6 t3) \to ((getl i0 (CHead c k u2) +(CHead d0 (Bind Abbr) u0)) \to ((pr0 t7 t5) \to ((subst0 i0 u0 t5 t6) \to +(pc3 (CHead c k u1) t0 t3)))))) (\lambda (H19: (eq T t6 t3)).(eq_ind T t3 +(\lambda (t7: T).((getl i0 (CHead c k u2) (CHead d0 (Bind Abbr) u0)) \to +((pr0 t0 t5) \to ((subst0 i0 u0 t5 t7) \to (pc3 (CHead c k u1) t0 t3))))) +(\lambda (H20: (getl i0 (CHead c k u2) (CHead d0 (Bind Abbr) u0))).(\lambda +(H21: (pr0 t0 t5)).(\lambda (H22: (subst0 i0 u0 t5 t3)).(nat_ind (\lambda (n: +nat).((getl n (CHead c k u2) (CHead d0 (Bind Abbr) u0)) \to ((subst0 n u0 t5 +t3) \to (pc3 (CHead c k u1) t0 t3)))) (\lambda (H23: (getl O (CHead c k u2) +(CHead d0 (Bind Abbr) u0))).(\lambda (H24: (subst0 O u0 t5 t3)).(K_ind +(\lambda (k0: K).((clear (CHead c k0 u2) (CHead d0 (Bind Abbr) u0)) \to (pc3 +(CHead c k0 u1) t0 t3))) (\lambda (b: B).(\lambda (H25: (clear (CHead c (Bind +b) u2) (CHead d0 (Bind Abbr) u0))).(let H26 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d0 | +(CHead c2 _ _) \Rightarrow c2])) (CHead d0 (Bind Abbr) u0) (CHead c (Bind b) +u2) (clear_gen_bind b c (CHead d0 (Bind Abbr) u0) u2 H25)) in ((let H27 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abbr | (CHead _ k0 _) \Rightarrow (match k0 in K +return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow Abbr])])) (CHead d0 (Bind Abbr) u0) (CHead c (Bind b) u2) +(clear_gen_bind b c (CHead d0 (Bind Abbr) u0) u2 H25)) in ((let H28 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow u0 | (CHead _ _ t7) \Rightarrow t7])) (CHead d0 (Bind +Abbr) u0) (CHead c (Bind b) u2) (clear_gen_bind b c (CHead d0 (Bind Abbr) u0) +u2 H25)) in (\lambda (H29: (eq B Abbr b)).(\lambda (_: (eq C d0 c)).(let H31 +\def (eq_ind T u0 (\lambda (t7: T).(subst0 O t7 t5 t3)) H24 u2 H28) in +(eq_ind B Abbr (\lambda (b0: B).(pc3 (CHead c (Bind b0) u1) t0 t3)) (ex2_ind +T (\lambda (t7: T).(subst0 O t2 t5 t7)) (\lambda (t7: T).(pr0 t3 t7)) (pc3 +(CHead c (Bind Abbr) u1) t0 t3) (\lambda (x: T).(\lambda (H32: (subst0 O t2 +t5 x)).(\lambda (H33: (pr0 t3 x)).(ex2_ind T (\lambda (t7: T).(subst0 O u1 t5 +t7)) (\lambda (t7: T).(subst0 (S (plus i O)) u x t7)) (pc3 (CHead c (Bind +Abbr) u1) t0 t3) (\lambda (x0: T).(\lambda (H34: (subst0 O u1 t5 +x0)).(\lambda (H35: (subst0 (S (plus i O)) u x x0)).(let H36 \def (f_equal +nat nat S (plus i O) i (sym_eq nat i (plus i O) (plus_n_O i))) in (let H37 +\def (eq_ind nat (S (plus i O)) (\lambda (n: nat).(subst0 n u x x0)) H35 (S +i) H36) in (pc3_pr2_u (CHead c (Bind Abbr) u1) x0 t0 (pr2_delta (CHead c +(Bind Abbr) u1) c u1 O (getl_refl Abbr c u1) t0 t5 H21 x0 H34) t3 (pc3_pr2_x +(CHead c (Bind Abbr) u1) x0 t3 (pr2_delta (CHead c (Bind Abbr) u1) d u (S i) +(getl_head (Bind Abbr) i c (CHead d (Bind Abbr) u) H8 u1) t3 x H33 x0 +H37)))))))) (subst0_subst0_back t5 x t2 O H32 u1 u i H10))))) (pr0_subst0_fwd +u2 t5 t3 O H31 t2 H9)) b H29))))) H27)) H26)))) (\lambda (f: F).(\lambda +(H25: (clear (CHead c (Flat f) u2) (CHead d0 (Bind Abbr) +u0))).(clear_pc3_trans (CHead d0 (Bind Abbr) u0) t0 t3 (pc3_pr2_r (CHead d0 +(Bind Abbr) u0) t0 t3 (pr2_delta (CHead d0 (Bind Abbr) u0) d0 u0 O (getl_refl +Abbr d0 u0) t0 t5 H21 t3 H24)) (CHead c (Flat f) u1) (clear_flat c (CHead d0 +(Bind Abbr) u0) (clear_gen_flat f c (CHead d0 (Bind Abbr) u0) u2 H25) f +u1)))) k (getl_gen_O (CHead c k u2) (CHead d0 (Bind Abbr) u0) H23)))) +(\lambda (i1: nat).(\lambda (_: (((getl i1 (CHead c k u2) (CHead d0 (Bind +Abbr) u0)) \to ((subst0 i1 u0 t5 t3) \to (pc3 (CHead c k u1) t0 +t3))))).(\lambda (H23: (getl (S i1) (CHead c k u2) (CHead d0 (Bind Abbr) +u0))).(\lambda (H24: (subst0 (S i1) u0 t5 t3)).(K_ind (\lambda (k0: K).((getl +(r k0 i1) c (CHead d0 (Bind Abbr) u0)) \to (pc3 (CHead c k0 u1) t0 t3))) +(\lambda (b: B).(\lambda (H25: (getl (r (Bind b) i1) c (CHead d0 (Bind Abbr) +u0))).(pc3_pr2_r (CHead c (Bind b) u1) t0 t3 (pr2_delta (CHead c (Bind b) u1) +d0 u0 (S i1) (getl_head (Bind b) i1 c (CHead d0 (Bind Abbr) u0) H25 u1) t0 t5 +H21 t3 H24)))) (\lambda (f: F).(\lambda (H25: (getl (r (Flat f) i1) c (CHead +d0 (Bind Abbr) u0))).(pc3_pr2_r (CHead c (Flat f) u1) t0 t3 (pr2_cflat c t0 +t3 (pr2_delta c d0 u0 (r (Flat f) i1) H25 t0 t5 H21 t3 H24) f u1)))) k +(getl_gen_S k c (CHead d0 (Bind Abbr) u0) u2 i1 H23)))))) i0 H20 H22)))) t6 +(sym_eq T t6 t3 H19))) t4 (sym_eq T t4 t0 H18))) c1 (sym_eq C c1 (CHead c k +u2) H15) H16 H17 H12 H13 H14))))]) in (H12 (refl_equal C (CHead c k u2)) +(refl_equal T t0) (refl_equal T t3)))))))))) t (sym_eq T t u1 H7))) t1 +(sym_eq T t1 u2 H6))) c0 (sym_eq C c0 c H3) H4 H5 H0 H1 H2))))]) in (H0 +(refl_equal C c) (refl_equal T u2) (refl_equal T u1)))))). + +theorem pc3_pr2_pr3_t: + \forall (c: C).(\forall (u2: T).(\forall (t1: T).(\forall (t2: T).(\forall +(k: K).((pr3 (CHead c k u2) t1 t2) \to (\forall (u1: T).((pr2 c u2 u1) \to +(pc3 (CHead c k u1) t1 t2)))))))) +\def + \lambda (c: C).(\lambda (u2: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(k: K).(\lambda (H: (pr3 (CHead c k u2) t1 t2)).(pr3_ind (CHead c k u2) +(\lambda (t: T).(\lambda (t0: T).(\forall (u1: T).((pr2 c u2 u1) \to (pc3 +(CHead c k u1) t t0))))) (\lambda (t: T).(\lambda (u1: T).(\lambda (_: (pr2 c +u2 u1)).(pc3_refl (CHead c k u1) t)))) (\lambda (t0: T).(\lambda (t3: +T).(\lambda (H0: (pr2 (CHead c k u2) t3 t0)).(\lambda (t4: T).(\lambda (_: +(pr3 (CHead c k u2) t0 t4)).(\lambda (H2: ((\forall (u1: T).((pr2 c u2 u1) +\to (pc3 (CHead c k u1) t0 t4))))).(\lambda (u1: T).(\lambda (H3: (pr2 c u2 +u1)).(pc3_t t0 (CHead c k u1) t3 (pc3_pr2_pr2_t c u1 u2 H3 t3 t0 k H0) t4 (H2 +u1 H3)))))))))) t1 t2 H)))))). + +theorem pc3_pr3_pc3_t: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr3 c u2 u1) \to (\forall +(t1: T).(\forall (t2: T).(\forall (k: K).((pc3 (CHead c k u2) t1 t2) \to (pc3 +(CHead c k u1) t1 t2)))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr3 c u2 +u1)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (t1: T).(\forall +(t2: T).(\forall (k: K).((pc3 (CHead c k t) t1 t2) \to (pc3 (CHead c k t0) t1 +t2))))))) (\lambda (t: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda (k: +K).(\lambda (H0: (pc3 (CHead c k t) t1 t2)).H0))))) (\lambda (t2: T).(\lambda +(t1: T).(\lambda (H0: (pr2 c t1 t2)).(\lambda (t3: T).(\lambda (_: (pr3 c t2 +t3)).(\lambda (H2: ((\forall (t4: T).(\forall (t5: T).(\forall (k: K).((pc3 +(CHead c k t2) t4 t5) \to (pc3 (CHead c k t3) t4 t5))))))).(\lambda (t0: +T).(\lambda (t4: T).(\lambda (k: K).(\lambda (H3: (pc3 (CHead c k t1) t0 +t4)).(H2 t0 t4 k (let H4 \def H3 in (ex2_ind T (\lambda (t: T).(pr3 (CHead c +k t1) t0 t)) (\lambda (t: T).(pr3 (CHead c k t1) t4 t)) (pc3 (CHead c k t2) +t0 t4) (\lambda (x: T).(\lambda (H5: (pr3 (CHead c k t1) t0 x)).(\lambda (H6: +(pr3 (CHead c k t1) t4 x)).(pc3_t x (CHead c k t2) t0 (pc3_pr2_pr3_t c t1 t0 +x k H5 t2 H0) t4 (pc3_s (CHead c k t2) x t4 (pc3_pr2_pr3_t c t1 t4 x k H6 t2 +H0)))))) H4))))))))))))) u2 u1 H)))). + +theorem pc3_lift: + \forall (c: C).(\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop h +d c e) \to (\forall (t1: T).(\forall (t2: T).((pc3 e t1 t2) \to (pc3 c (lift +h d t1) (lift h d t2))))))))) +\def + \lambda (c: C).(\lambda (e: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda +(H: (drop h d c e)).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pc3 e t1 +t2)).(let H1 \def H0 in (ex2_ind T (\lambda (t: T).(pr3 e t1 t)) (\lambda (t: +T).(pr3 e t2 t)) (pc3 c (lift h d t1) (lift h d t2)) (\lambda (x: T).(\lambda +(H2: (pr3 e t1 x)).(\lambda (H3: (pr3 e t2 x)).(pc3_pr3_t c (lift h d t1) +(lift h d x) (pr3_lift c e h d H t1 x H2) (lift h d t2) (pr3_lift c e h d H +t2 x H3))))) H1))))))))). + +theorem pc3_eta: + \forall (c: C).(\forall (t: T).(\forall (w: T).(\forall (u: T).((pc3 c t +(THead (Bind Abst) w u)) \to (\forall (v: T).((pc3 c v w) \to (pc3 c (THead +(Bind Abst) v (THead (Flat Appl) (TLRef O) (lift (S O) O t))) t))))))) +\def + \lambda (c: C).(\lambda (t: T).(\lambda (w: T).(\lambda (u: T).(\lambda (H: +(pc3 c t (THead (Bind Abst) w u))).(\lambda (v: T).(\lambda (H0: (pc3 c v +w)).(pc3_t (THead (Bind Abst) w (THead (Flat Appl) (TLRef O) (lift (S O) O +(THead (Bind Abst) w u)))) c (THead (Bind Abst) v (THead (Flat Appl) (TLRef +O) (lift (S O) O t))) (pc3_head_21 c v w H0 (Bind Abst) (THead (Flat Appl) +(TLRef O) (lift (S O) O t)) (THead (Flat Appl) (TLRef O) (lift (S O) O (THead +(Bind Abst) w u))) (pc3_thin_dx (CHead c (Bind Abst) v) (lift (S O) O t) +(lift (S O) O (THead (Bind Abst) w u)) (pc3_lift (CHead c (Bind Abst) v) c (S +O) O (drop_drop (Bind Abst) O c c (drop_refl c) v) t (THead (Bind Abst) w u) +H) (TLRef O) Appl)) t (pc3_t (THead (Bind Abst) w u) c (THead (Bind Abst) w +(THead (Flat Appl) (TLRef O) (lift (S O) O (THead (Bind Abst) w u)))) +(pc3_pr3_r c (THead (Bind Abst) w (THead (Flat Appl) (TLRef O) (lift (S O) O +(THead (Bind Abst) w u)))) (THead (Bind Abst) w u) (pr3_eta c w u w (pr3_refl +c w))) t (pc3_s c (THead (Bind Abst) w u) t H))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/subst1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/subst1.ma new file mode 100644 index 000000000..510b2d649 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/subst1.ma @@ -0,0 +1,47 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/subst1". + +include "pc3/props.ma". + +include "pr3/subst1.ma". + +theorem pc3_gen_cabbr: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pc3 c t1 t2) \to (\forall +(e: C).(\forall (u: T).(\forall (d: nat).((getl d c (CHead e (Bind Abbr) u)) +\to (\forall (a0: C).((csubst1 d u c a0) \to (\forall (a: C).((drop (S O) d +a0 a) \to (\forall (x1: T).((subst1 d u t1 (lift (S O) d x1)) \to (\forall +(x2: T).((subst1 d u t2 (lift (S O) d x2)) \to (pc3 a x1 x2)))))))))))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pc3 c t1 +t2)).(\lambda (e: C).(\lambda (u: T).(\lambda (d: nat).(\lambda (H0: (getl d +c (CHead e (Bind Abbr) u))).(\lambda (a0: C).(\lambda (H1: (csubst1 d u c +a0)).(\lambda (a: C).(\lambda (H2: (drop (S O) d a0 a)).(\lambda (x1: +T).(\lambda (H3: (subst1 d u t1 (lift (S O) d x1))).(\lambda (x2: T).(\lambda +(H4: (subst1 d u t2 (lift (S O) d x2))).(let H5 \def H in (ex2_ind T (\lambda +(t: T).(pr3 c t1 t)) (\lambda (t: T).(pr3 c t2 t)) (pc3 a x1 x2) (\lambda (x: +T).(\lambda (H6: (pr3 c t1 x)).(\lambda (H7: (pr3 c t2 x)).(ex2_ind T +(\lambda (x3: T).(subst1 d u x (lift (S O) d x3))) (\lambda (x3: T).(pr3 a x2 +x3)) (pc3 a x1 x2) (\lambda (x0: T).(\lambda (H8: (subst1 d u x (lift (S O) d +x0))).(\lambda (H9: (pr3 a x2 x0)).(ex2_ind T (\lambda (x3: T).(subst1 d u x +(lift (S O) d x3))) (\lambda (x3: T).(pr3 a x1 x3)) (pc3 a x1 x2) (\lambda +(x3: T).(\lambda (H10: (subst1 d u x (lift (S O) d x3))).(\lambda (H11: (pr3 +a x1 x3)).(let H12 \def (eq_ind T x3 (\lambda (t: T).(pr3 a x1 t)) H11 x0 +(subst1_confluence_lift x x3 u d H10 x0 H8)) in (pc3_pr3_t a x1 x0 H12 x2 +H9))))) (pr3_gen_cabbr c t1 x H6 e u d H0 a0 H1 a H2 x1 H3))))) +(pr3_gen_cabbr c t2 x H7 e u d H0 a0 H1 a H2 x2 H4))))) H5))))))))))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/wcpr0.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/wcpr0.ma new file mode 100644 index 000000000..5ed59a431 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/wcpr0.ma @@ -0,0 +1,103 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/wcpr0". + +include "pc3/props.ma". + +include "wcpr0/getl.ma". + +theorem pc3_wcpr0__pc3_wcpr0_t_aux: + \forall (c1: C).(\forall (c2: C).((wcpr0 c1 c2) \to (\forall (k: K).(\forall +(u: T).(\forall (t1: T).(\forall (t2: T).((pr3 (CHead c1 k u) t1 t2) \to (pc3 +(CHead c2 k u) t1 t2)))))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: (wcpr0 c1 c2)).(\lambda (k: +K).(\lambda (u: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pr3 +(CHead c1 k u) t1 t2)).(pr3_ind (CHead c1 k u) (\lambda (t: T).(\lambda (t0: +T).(pc3 (CHead c2 k u) t t0))) (\lambda (t: T).(pc3_refl (CHead c2 k u) t)) +(\lambda (t0: T).(\lambda (t3: T).(\lambda (H1: (pr2 (CHead c1 k u) t3 +t0)).(\lambda (t4: T).(\lambda (_: (pr3 (CHead c1 k u) t0 t4)).(\lambda (H3: +(pc3 (CHead c2 k u) t0 t4)).(pc3_t t0 (CHead c2 k u) t3 (let H4 \def (match +H1 in pr2 return (\lambda (c: C).(\lambda (t: T).(\lambda (t5: T).(\lambda +(_: (pr2 c t t5)).((eq C c (CHead c1 k u)) \to ((eq T t t3) \to ((eq T t5 t0) +\to (pc3 (CHead c2 k u) t3 t0)))))))) with [(pr2_free c t5 t6 H4) \Rightarrow +(\lambda (H5: (eq C c (CHead c1 k u))).(\lambda (H6: (eq T t5 t3)).(\lambda +(H7: (eq T t6 t0)).(eq_ind C (CHead c1 k u) (\lambda (_: C).((eq T t5 t3) \to +((eq T t6 t0) \to ((pr0 t5 t6) \to (pc3 (CHead c2 k u) t3 t0))))) (\lambda +(H8: (eq T t5 t3)).(eq_ind T t3 (\lambda (t: T).((eq T t6 t0) \to ((pr0 t t6) +\to (pc3 (CHead c2 k u) t3 t0)))) (\lambda (H9: (eq T t6 t0)).(eq_ind T t0 +(\lambda (t: T).((pr0 t3 t) \to (pc3 (CHead c2 k u) t3 t0))) (\lambda (H10: +(pr0 t3 t0)).(pc3_pr2_r (CHead c2 k u) t3 t0 (pr2_free (CHead c2 k u) t3 t0 +H10))) t6 (sym_eq T t6 t0 H9))) t5 (sym_eq T t5 t3 H8))) c (sym_eq C c (CHead +c1 k u) H5) H6 H7 H4)))) | (pr2_delta c d u0 i H4 t5 t6 H5 t H6) \Rightarrow +(\lambda (H7: (eq C c (CHead c1 k u))).(\lambda (H8: (eq T t5 t3)).(\lambda +(H9: (eq T t t0)).(eq_ind C (CHead c1 k u) (\lambda (c0: C).((eq T t5 t3) \to +((eq T t t0) \to ((getl i c0 (CHead d (Bind Abbr) u0)) \to ((pr0 t5 t6) \to +((subst0 i u0 t6 t) \to (pc3 (CHead c2 k u) t3 t0))))))) (\lambda (H10: (eq T +t5 t3)).(eq_ind T t3 (\lambda (t7: T).((eq T t t0) \to ((getl i (CHead c1 k +u) (CHead d (Bind Abbr) u0)) \to ((pr0 t7 t6) \to ((subst0 i u0 t6 t) \to +(pc3 (CHead c2 k u) t3 t0)))))) (\lambda (H11: (eq T t t0)).(eq_ind T t0 +(\lambda (t7: T).((getl i (CHead c1 k u) (CHead d (Bind Abbr) u0)) \to ((pr0 +t3 t6) \to ((subst0 i u0 t6 t7) \to (pc3 (CHead c2 k u) t3 t0))))) (\lambda +(H12: (getl i (CHead c1 k u) (CHead d (Bind Abbr) u0))).(\lambda (H13: (pr0 +t3 t6)).(\lambda (H14: (subst0 i u0 t6 t0)).(ex3_2_ind C T (\lambda (e2: +C).(\lambda (u2: T).(getl i (CHead c2 k u) (CHead e2 (Bind Abbr) u2)))) +(\lambda (e2: C).(\lambda (_: T).(wcpr0 d e2))) (\lambda (_: C).(\lambda (u2: +T).(pr0 u0 u2))) (pc3 (CHead c2 k u) t3 t0) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (H15: (getl i (CHead c2 k u) (CHead x0 (Bind Abbr) x1))).(\lambda +(_: (wcpr0 d x0)).(\lambda (H17: (pr0 u0 x1)).(ex2_ind T (\lambda (t7: +T).(subst0 i x1 t6 t7)) (\lambda (t7: T).(pr0 t0 t7)) (pc3 (CHead c2 k u) t3 +t0) (\lambda (x: T).(\lambda (H18: (subst0 i x1 t6 x)).(\lambda (H19: (pr0 t0 +x)).(pc3_pr2_u (CHead c2 k u) x t3 (pr2_delta (CHead c2 k u) x0 x1 i H15 t3 +t6 H13 x H18) t0 (pc3_pr2_x (CHead c2 k u) x t0 (pr2_free (CHead c2 k u) t0 x +H19)))))) (pr0_subst0_fwd u0 t6 t0 i H14 x1 H17))))))) (wcpr0_getl (CHead c1 +k u) (CHead c2 k u) (wcpr0_comp c1 c2 H u u (pr0_refl u) k) i d u0 (Bind +Abbr) H12))))) t (sym_eq T t t0 H11))) t5 (sym_eq T t5 t3 H10))) c (sym_eq C +c (CHead c1 k u) H7) H8 H9 H4 H5 H6))))]) in (H4 (refl_equal C (CHead c1 k +u)) (refl_equal T t3) (refl_equal T t0))) t4 H3))))))) t1 t2 H0)))))))). + +theorem pc3_wcpr0_t: + \forall (c1: C).(\forall (c2: C).((wcpr0 c1 c2) \to (\forall (t1: +T).(\forall (t2: T).((pr3 c1 t1 t2) \to (pc3 c2 t1 t2)))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: (wcpr0 c1 c2)).(wcpr0_ind +(\lambda (c: C).(\lambda (c0: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t1 +t2) \to (pc3 c0 t1 t2)))))) (\lambda (c: C).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (H0: (pr3 c t1 t2)).(pc3_pr3_r c t1 t2 H0))))) (\lambda (c0: +C).(\lambda (c3: C).(\lambda (H0: (wcpr0 c0 c3)).(\lambda (_: ((\forall (t1: +T).(\forall (t2: T).((pr3 c0 t1 t2) \to (pc3 c3 t1 t2)))))).(\lambda (u1: +T).(\lambda (u2: T).(\lambda (H2: (pr0 u1 u2)).(\lambda (k: K).(\lambda (t1: +T).(\lambda (t2: T).(\lambda (H3: (pr3 (CHead c0 k u1) t1 t2)).(let H4 \def +(pc3_pr2_pr3_t c0 u1 t1 t2 k H3 u2 (pr2_free c0 u1 u2 H2)) in (ex2_ind T +(\lambda (t: T).(pr3 (CHead c0 k u2) t1 t)) (\lambda (t: T).(pr3 (CHead c0 k +u2) t2 t)) (pc3 (CHead c3 k u2) t1 t2) (\lambda (x: T).(\lambda (H5: (pr3 +(CHead c0 k u2) t1 x)).(\lambda (H6: (pr3 (CHead c0 k u2) t2 x)).(pc3_t x +(CHead c3 k u2) t1 (pc3_wcpr0__pc3_wcpr0_t_aux c0 c3 H0 k u2 t1 x H5) t2 +(pc3_s (CHead c3 k u2) x t2 (pc3_wcpr0__pc3_wcpr0_t_aux c0 c3 H0 k u2 t2 x +H6)))))) H4))))))))))))) c1 c2 H))). + +theorem pc3_wcpr0: + \forall (c1: C).(\forall (c2: C).((wcpr0 c1 c2) \to (\forall (t1: +T).(\forall (t2: T).((pc3 c1 t1 t2) \to (pc3 c2 t1 t2)))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: (wcpr0 c1 c2)).(\lambda (t1: +T).(\lambda (t2: T).(\lambda (H0: (pc3 c1 t1 t2)).(let H1 \def H0 in (ex2_ind +T (\lambda (t: T).(pr3 c1 t1 t)) (\lambda (t: T).(pr3 c1 t2 t)) (pc3 c2 t1 +t2) (\lambda (x: T).(\lambda (H2: (pr3 c1 t1 x)).(\lambda (H3: (pr3 c1 t2 +x)).(pc3_t x c2 t1 (pc3_wcpr0_t c1 c2 H t1 x H2) t2 (pc3_s c2 x t2 +(pc3_wcpr0_t c1 c2 H t2 x H3)))))) H1))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/dec.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/dec.ma new file mode 100644 index 000000000..26c4a21b6 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/dec.ma @@ -0,0 +1,528 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr0/dec". + +include "pr0/fwd.ma". + +include "subst0/dec.ma". + +include "T/dec.ma". + +include "T/props.ma". + +theorem nf0_dec: + \forall (t1: T).(or (\forall (t2: T).((pr0 t1 t2) \to (eq T t1 t2))) (ex2 T +(\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr0 t1 t2)))) +\def + \lambda (t1: T).(T_ind (\lambda (t: T).(or (\forall (t2: T).((pr0 t t2) \to +(eq T t t2))) (ex2 T (\lambda (t2: T).((eq T t t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 t t2))))) (\lambda (n: nat).(or_introl +(\forall (t2: T).((pr0 (TSort n) t2) \to (eq T (TSort n) t2))) (ex2 T +(\lambda (t2: T).((eq T (TSort n) t2) \to (\forall (P: Prop).P))) (\lambda +(t2: T).(pr0 (TSort n) t2))) (\lambda (t2: T).(\lambda (H: (pr0 (TSort n) +t2)).(eq_ind_r T (TSort n) (\lambda (t: T).(eq T (TSort n) t)) (refl_equal T +(TSort n)) t2 (pr0_gen_sort t2 n H)))))) (\lambda (n: nat).(or_introl +(\forall (t2: T).((pr0 (TLRef n) t2) \to (eq T (TLRef n) t2))) (ex2 T +(\lambda (t2: T).((eq T (TLRef n) t2) \to (\forall (P: Prop).P))) (\lambda +(t2: T).(pr0 (TLRef n) t2))) (\lambda (t2: T).(\lambda (H: (pr0 (TLRef n) +t2)).(eq_ind_r T (TLRef n) (\lambda (t: T).(eq T (TLRef n) t)) (refl_equal T +(TLRef n)) t2 (pr0_gen_lref t2 n H)))))) (\lambda (k: K).(\lambda (t: +T).(\lambda (H: (or (\forall (t2: T).((pr0 t t2) \to (eq T t t2))) (ex2 T +(\lambda (t2: T).((eq T t t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr0 t t2))))).(\lambda (t0: T).(\lambda (H0: (or (\forall (t2: T).((pr0 +t0 t2) \to (eq T t0 t2))) (ex2 T (\lambda (t2: T).((eq T t0 t2) \to (\forall +(P: Prop).P))) (\lambda (t2: T).(pr0 t0 t2))))).(K_ind (\lambda (k0: K).(or +(\forall (t2: T).((pr0 (THead k0 t t0) t2) \to (eq T (THead k0 t t0) t2))) +(ex2 T (\lambda (t2: T).((eq T (THead k0 t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead k0 t t0) t2))))) (\lambda (b: +B).(B_ind (\lambda (b0: B).(or (\forall (t2: T).((pr0 (THead (Bind b0) t t0) +t2) \to (eq T (THead (Bind b0) t t0) t2))) (ex2 T (\lambda (t2: T).((eq T +(THead (Bind b0) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 +(THead (Bind b0) t t0) t2))))) (or_intror (\forall (t2: T).((pr0 (THead (Bind +Abbr) t t0) t2) \to (eq T (THead (Bind Abbr) t t0) t2))) (ex2 T (\lambda (t2: +T).((eq T (THead (Bind Abbr) t t0) t2) \to (\forall (P: Prop).P))) (\lambda +(t2: T).(pr0 (THead (Bind Abbr) t t0) t2))) (let H_x \def (dnf_dec t t0 O) in +(let H1 \def H_x in (ex_ind T (\lambda (v: T).(or (subst0 O t t0 (lift (S O) +O v)) (eq T t0 (lift (S O) O v)))) (ex2 T (\lambda (t2: T).((eq T (THead +(Bind Abbr) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 +(THead (Bind Abbr) t t0) t2))) (\lambda (x: T).(\lambda (H2: (or (subst0 O t +t0 (lift (S O) O x)) (eq T t0 (lift (S O) O x)))).(or_ind (subst0 O t t0 +(lift (S O) O x)) (eq T t0 (lift (S O) O x)) (ex2 T (\lambda (t2: T).((eq T +(THead (Bind Abbr) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr0 (THead (Bind Abbr) t t0) t2))) (\lambda (H3: (subst0 O t t0 (lift (S +O) O x))).(ex_intro2 T (\lambda (t2: T).((eq T (THead (Bind Abbr) t t0) t2) +\to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Abbr) t t0) +t2)) (THead (Bind Abbr) t (lift (S O) O x)) (\lambda (H4: (eq T (THead (Bind +Abbr) t t0) (THead (Bind Abbr) t (lift (S O) O x)))).(\lambda (P: Prop).(let +H5 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t2) +\Rightarrow t2])) (THead (Bind Abbr) t t0) (THead (Bind Abbr) t (lift (S O) O +x)) H4) in (let H6 \def (eq_ind T t0 (\lambda (t2: T).(subst0 O t t2 (lift (S +O) O x))) H3 (lift (S O) O x) H5) in (subst0_refl t (lift (S O) O x) O H6 +P))))) (pr0_delta t t (pr0_refl t) t0 t0 (pr0_refl t0) (lift (S O) O x) H3))) +(\lambda (H3: (eq T t0 (lift (S O) O x))).(eq_ind_r T (lift (S O) O x) +(\lambda (t2: T).(ex2 T (\lambda (t3: T).((eq T (THead (Bind Abbr) t t2) t3) +\to (\forall (P: Prop).P))) (\lambda (t3: T).(pr0 (THead (Bind Abbr) t t2) +t3)))) (ex_intro2 T (\lambda (t2: T).((eq T (THead (Bind Abbr) t (lift (S O) +O x)) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind +Abbr) t (lift (S O) O x)) t2)) x (\lambda (H4: (eq T (THead (Bind Abbr) t +(lift (S O) O x)) x)).(\lambda (P: Prop).(thead_x_lift_y_y (Bind Abbr) x t (S +O) O H4 P))) (pr0_zeta Abbr not_abbr_abst x x (pr0_refl x) t)) t0 H3)) H2))) +H1)))) (let H1 \def H in (or_ind (\forall (t2: T).((pr0 t t2) \to (eq T t +t2))) (ex2 T (\lambda (t2: T).((eq T t t2) \to (\forall (P: Prop).P))) +(\lambda (t2: T).(pr0 t t2))) (or (\forall (t2: T).((pr0 (THead (Bind Abst) t +t0) t2) \to (eq T (THead (Bind Abst) t t0) t2))) (ex2 T (\lambda (t2: T).((eq +T (THead (Bind Abst) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr0 (THead (Bind Abst) t t0) t2)))) (\lambda (H2: ((\forall (t2: T).((pr0 +t t2) \to (eq T t t2))))).(let H3 \def H0 in (or_ind (\forall (t2: T).((pr0 +t0 t2) \to (eq T t0 t2))) (ex2 T (\lambda (t2: T).((eq T t0 t2) \to (\forall +(P: Prop).P))) (\lambda (t2: T).(pr0 t0 t2))) (or (\forall (t2: T).((pr0 +(THead (Bind Abst) t t0) t2) \to (eq T (THead (Bind Abst) t t0) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Bind Abst) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Abst) t t0) t2)))) (\lambda +(H4: ((\forall (t2: T).((pr0 t0 t2) \to (eq T t0 t2))))).(or_introl (\forall +(t2: T).((pr0 (THead (Bind Abst) t t0) t2) \to (eq T (THead (Bind Abst) t t0) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Bind Abst) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Abst) t t0) t2))) +(\lambda (t2: T).(\lambda (H5: (pr0 (THead (Bind Abst) t t0) t2)).(ex3_2_ind +T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abst) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 t u2))) (\lambda (_: T).(\lambda (t3: +T).(pr0 t0 t3))) (eq T (THead (Bind Abst) t t0) t2) (\lambda (x0: T).(\lambda +(x1: T).(\lambda (H6: (eq T t2 (THead (Bind Abst) x0 x1))).(\lambda (H7: (pr0 +t x0)).(\lambda (H8: (pr0 t0 x1)).(let H_y \def (H4 x1 H8) in (let H_y0 \def +(H2 x0 H7) in (let H9 \def (eq_ind_r T x1 (\lambda (t3: T).(pr0 t0 t3)) H8 t0 +H_y) in (let H10 \def (eq_ind_r T x1 (\lambda (t3: T).(eq T t2 (THead (Bind +Abst) x0 t3))) H6 t0 H_y) in (let H11 \def (eq_ind_r T x0 (\lambda (t3: +T).(pr0 t t3)) H7 t H_y0) in (let H12 \def (eq_ind_r T x0 (\lambda (t3: +T).(eq T t2 (THead (Bind Abst) t3 t0))) H10 t H_y0) in (eq_ind_r T (THead +(Bind Abst) t t0) (\lambda (t3: T).(eq T (THead (Bind Abst) t t0) t3)) +(refl_equal T (THead (Bind Abst) t t0)) t2 H12)))))))))))) (pr0_gen_abst t t0 +t2 H5)))))) (\lambda (H4: (ex2 T (\lambda (t2: T).((eq T t0 t2) \to (\forall +(P: Prop).P))) (\lambda (t2: T).(pr0 t0 t2)))).(ex2_ind T (\lambda (t2: +T).((eq T t0 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 t0 t2)) +(or (\forall (t2: T).((pr0 (THead (Bind Abst) t t0) t2) \to (eq T (THead +(Bind Abst) t t0) t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Bind Abst) t +t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Abst) +t t0) t2)))) (\lambda (x: T).(\lambda (H5: (((eq T t0 x) \to (\forall (P: +Prop).P)))).(\lambda (H6: (pr0 t0 x)).(or_intror (\forall (t2: T).((pr0 +(THead (Bind Abst) t t0) t2) \to (eq T (THead (Bind Abst) t t0) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Bind Abst) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Abst) t t0) t2))) (ex_intro2 T +(\lambda (t2: T).((eq T (THead (Bind Abst) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Abst) t t0) t2)) (THead (Bind +Abst) t x) (\lambda (H7: (eq T (THead (Bind Abst) t t0) (THead (Bind Abst) t +x))).(\lambda (P: Prop).(let H8 \def (f_equal T T (\lambda (e: T).(match e in +T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) +\Rightarrow t0 | (THead _ _ t2) \Rightarrow t2])) (THead (Bind Abst) t t0) +(THead (Bind Abst) t x) H7) in (let H9 \def (eq_ind_r T x (\lambda (t2: +T).(pr0 t0 t2)) H6 t0 H8) in (let H10 \def (eq_ind_r T x (\lambda (t2: +T).((eq T t0 t2) \to (\forall (P0: Prop).P0))) H5 t0 H8) in (H10 (refl_equal +T t0) P)))))) (pr0_comp t t (pr0_refl t) t0 x H6 (Bind Abst))))))) H4)) H3))) +(\lambda (H2: (ex2 T (\lambda (t2: T).((eq T t t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 t t2)))).(ex2_ind T (\lambda (t2: T).((eq T +t t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 t t2)) (or (\forall +(t2: T).((pr0 (THead (Bind Abst) t t0) t2) \to (eq T (THead (Bind Abst) t t0) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Bind Abst) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Abst) t t0) t2)))) +(\lambda (x: T).(\lambda (H3: (((eq T t x) \to (\forall (P: +Prop).P)))).(\lambda (H4: (pr0 t x)).(or_intror (\forall (t2: T).((pr0 (THead +(Bind Abst) t t0) t2) \to (eq T (THead (Bind Abst) t t0) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Bind Abst) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Abst) t t0) t2))) (ex_intro2 T +(\lambda (t2: T).((eq T (THead (Bind Abst) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Abst) t t0) t2)) (THead (Bind +Abst) x t0) (\lambda (H5: (eq T (THead (Bind Abst) t t0) (THead (Bind Abst) x +t0))).(\lambda (P: Prop).(let H6 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t | (TLRef _) +\Rightarrow t | (THead _ t2 _) \Rightarrow t2])) (THead (Bind Abst) t t0) +(THead (Bind Abst) x t0) H5) in (let H7 \def (eq_ind_r T x (\lambda (t2: +T).(pr0 t t2)) H4 t H6) in (let H8 \def (eq_ind_r T x (\lambda (t2: T).((eq T +t t2) \to (\forall (P0: Prop).P0))) H3 t H6) in (H8 (refl_equal T t) P)))))) +(pr0_comp t x H4 t0 t0 (pr0_refl t0) (Bind Abst))))))) H2)) H1)) (let H_x +\def (dnf_dec t t0 O) in (let H1 \def H_x in (ex_ind T (\lambda (v: T).(or +(subst0 O t t0 (lift (S O) O v)) (eq T t0 (lift (S O) O v)))) (or (\forall +(t2: T).((pr0 (THead (Bind Void) t t0) t2) \to (eq T (THead (Bind Void) t t0) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Bind Void) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t t0) t2)))) +(\lambda (x: T).(\lambda (H2: (or (subst0 O t t0 (lift (S O) O x)) (eq T t0 +(lift (S O) O x)))).(or_ind (subst0 O t t0 (lift (S O) O x)) (eq T t0 (lift +(S O) O x)) (or (\forall (t2: T).((pr0 (THead (Bind Void) t t0) t2) \to (eq T +(THead (Bind Void) t t0) t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Bind +Void) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead +(Bind Void) t t0) t2)))) (\lambda (H3: (subst0 O t t0 (lift (S O) O x))).(let +H4 \def H in (or_ind (\forall (t2: T).((pr0 t t2) \to (eq T t t2))) (ex2 T +(\lambda (t2: T).((eq T t t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr0 t t2))) (or (\forall (t2: T).((pr0 (THead (Bind Void) t t0) t2) \to +(eq T (THead (Bind Void) t t0) t2))) (ex2 T (\lambda (t2: T).((eq T (THead +(Bind Void) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 +(THead (Bind Void) t t0) t2)))) (\lambda (H5: ((\forall (t2: T).((pr0 t t2) +\to (eq T t t2))))).(let H6 \def H0 in (or_ind (\forall (t2: T).((pr0 t0 t2) +\to (eq T t0 t2))) (ex2 T (\lambda (t2: T).((eq T t0 t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 t0 t2))) (or (\forall (t2: T).((pr0 (THead +(Bind Void) t t0) t2) \to (eq T (THead (Bind Void) t t0) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Bind Void) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t t0) t2)))) (\lambda +(H7: ((\forall (t2: T).((pr0 t0 t2) \to (eq T t0 t2))))).(or_introl (\forall +(t2: T).((pr0 (THead (Bind Void) t t0) t2) \to (eq T (THead (Bind Void) t t0) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Bind Void) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t t0) t2))) +(\lambda (t2: T).(\lambda (H8: (pr0 (THead (Bind Void) t t0) t2)).(or_ind +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Void) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 t u2))) (\lambda (_: T).(\lambda +(t3: T).(pr0 t0 t3)))) (pr0 t0 (lift (S O) O t2)) (eq T (THead (Bind Void) t +t0) t2) (\lambda (H9: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 +(THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 t u2))) +(\lambda (_: T).(\lambda (t3: T).(pr0 t0 t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 t u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t0 +t3))) (eq T (THead (Bind Void) t t0) t2) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H10: (eq T t2 (THead (Bind Void) x0 x1))).(\lambda (H11: (pr0 t +x0)).(\lambda (H12: (pr0 t0 x1)).(let H_y \def (H7 x1 H12) in (let H_y0 \def +(H5 x0 H11) in (let H13 \def (eq_ind_r T x1 (\lambda (t3: T).(pr0 t0 t3)) H12 +t0 H_y) in (let H14 \def (eq_ind_r T x1 (\lambda (t3: T).(eq T t2 (THead +(Bind Void) x0 t3))) H10 t0 H_y) in (let H15 \def (eq_ind_r T x0 (\lambda +(t3: T).(pr0 t t3)) H11 t H_y0) in (let H16 \def (eq_ind_r T x0 (\lambda (t3: +T).(eq T t2 (THead (Bind Void) t3 t0))) H14 t H_y0) in (eq_ind_r T (THead +(Bind Void) t t0) (\lambda (t3: T).(eq T (THead (Bind Void) t t0) t3)) +(refl_equal T (THead (Bind Void) t t0)) t2 H16)))))))))))) H9)) (\lambda (H9: +(pr0 t0 (lift (S O) O t2))).(let H_y \def (H7 (lift (S O) O t2) H9) in (let +H10 \def (eq_ind T t0 (\lambda (t3: T).(subst0 O t t3 (lift (S O) O x))) H3 +(lift (S O) O t2) H_y) in (eq_ind_r T (lift (S O) O t2) (\lambda (t3: T).(eq +T (THead (Bind Void) t t3) t2)) (subst0_gen_lift_false t2 t (lift (S O) O x) +(S O) O O (le_n O) (eq_ind_r nat (plus (S O) O) (\lambda (n: nat).(lt O n)) +(le_n (plus (S O) O)) (plus O (S O)) (plus_comm O (S O))) H10 (eq T (THead +(Bind Void) t (lift (S O) O t2)) t2)) t0 H_y)))) (pr0_gen_void t t0 t2 +H8)))))) (\lambda (H7: (ex2 T (\lambda (t2: T).((eq T t0 t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 t0 t2)))).(ex2_ind T (\lambda (t2: T).((eq T +t0 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 t0 t2)) (or (\forall +(t2: T).((pr0 (THead (Bind Void) t t0) t2) \to (eq T (THead (Bind Void) t t0) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Bind Void) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t t0) t2)))) +(\lambda (x0: T).(\lambda (H8: (((eq T t0 x0) \to (\forall (P: +Prop).P)))).(\lambda (H9: (pr0 t0 x0)).(or_intror (\forall (t2: T).((pr0 +(THead (Bind Void) t t0) t2) \to (eq T (THead (Bind Void) t t0) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Bind Void) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t t0) t2))) (ex_intro2 T +(\lambda (t2: T).((eq T (THead (Bind Void) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t t0) t2)) (THead (Bind +Void) t x0) (\lambda (H10: (eq T (THead (Bind Void) t t0) (THead (Bind Void) +t x0))).(\lambda (P: Prop).(let H11 \def (f_equal T T (\lambda (e: T).(match +e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) +\Rightarrow t0 | (THead _ _ t2) \Rightarrow t2])) (THead (Bind Void) t t0) +(THead (Bind Void) t x0) H10) in (let H12 \def (eq_ind_r T x0 (\lambda (t2: +T).(pr0 t0 t2)) H9 t0 H11) in (let H13 \def (eq_ind_r T x0 (\lambda (t2: +T).((eq T t0 t2) \to (\forall (P0: Prop).P0))) H8 t0 H11) in (H13 (refl_equal +T t0) P)))))) (pr0_comp t t (pr0_refl t) t0 x0 H9 (Bind Void))))))) H7)) +H6))) (\lambda (H5: (ex2 T (\lambda (t2: T).((eq T t t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 t t2)))).(ex2_ind T (\lambda (t2: T).((eq T +t t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 t t2)) (or (\forall +(t2: T).((pr0 (THead (Bind Void) t t0) t2) \to (eq T (THead (Bind Void) t t0) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Bind Void) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t t0) t2)))) +(\lambda (x0: T).(\lambda (H6: (((eq T t x0) \to (\forall (P: +Prop).P)))).(\lambda (H7: (pr0 t x0)).(or_intror (\forall (t2: T).((pr0 +(THead (Bind Void) t t0) t2) \to (eq T (THead (Bind Void) t t0) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Bind Void) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t t0) t2))) (ex_intro2 T +(\lambda (t2: T).((eq T (THead (Bind Void) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t t0) t2)) (THead (Bind +Void) x0 t0) (\lambda (H8: (eq T (THead (Bind Void) t t0) (THead (Bind Void) +x0 t0))).(\lambda (P: Prop).(let H9 \def (f_equal T T (\lambda (e: T).(match +e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t | (TLRef _) +\Rightarrow t | (THead _ t2 _) \Rightarrow t2])) (THead (Bind Void) t t0) +(THead (Bind Void) x0 t0) H8) in (let H10 \def (eq_ind_r T x0 (\lambda (t2: +T).(pr0 t t2)) H7 t H9) in (let H11 \def (eq_ind_r T x0 (\lambda (t2: T).((eq +T t t2) \to (\forall (P0: Prop).P0))) H6 t H9) in (H11 (refl_equal T t) +P)))))) (pr0_comp t x0 H7 t0 t0 (pr0_refl t0) (Bind Void))))))) H5)) H4))) +(\lambda (H3: (eq T t0 (lift (S O) O x))).(let H4 \def (eq_ind T t0 (\lambda +(t2: T).(or (\forall (t3: T).((pr0 t2 t3) \to (eq T t2 t3))) (ex2 T (\lambda +(t3: T).((eq T t2 t3) \to (\forall (P: Prop).P))) (\lambda (t3: T).(pr0 t2 +t3))))) H0 (lift (S O) O x) H3) in (eq_ind_r T (lift (S O) O x) (\lambda (t2: +T).(or (\forall (t3: T).((pr0 (THead (Bind Void) t t2) t3) \to (eq T (THead +(Bind Void) t t2) t3))) (ex2 T (\lambda (t3: T).((eq T (THead (Bind Void) t +t2) t3) \to (\forall (P: Prop).P))) (\lambda (t3: T).(pr0 (THead (Bind Void) +t t2) t3))))) (or_intror (\forall (t2: T).((pr0 (THead (Bind Void) t (lift (S +O) O x)) t2) \to (eq T (THead (Bind Void) t (lift (S O) O x)) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Bind Void) t (lift (S O) O x)) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) t (lift (S +O) O x)) t2))) (ex_intro2 T (\lambda (t2: T).((eq T (THead (Bind Void) t +(lift (S O) O x)) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 +(THead (Bind Void) t (lift (S O) O x)) t2)) x (\lambda (H5: (eq T (THead +(Bind Void) t (lift (S O) O x)) x)).(\lambda (P: Prop).(thead_x_lift_y_y +(Bind Void) x t (S O) O H5 P))) (pr0_zeta Void not_void_abst x x (pr0_refl x) +t))) t0 H3))) H2))) H1))) b)) (\lambda (f: F).(F_ind (\lambda (f0: F).(or +(\forall (t2: T).((pr0 (THead (Flat f0) t t0) t2) \to (eq T (THead (Flat f0) +t t0) t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Flat f0) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat f0) t t0) t2))))) +(let H_x \def (binder_dec t0) in (let H1 \def H_x in (or_ind (ex_3 B T T +(\lambda (b: B).(\lambda (w: T).(\lambda (u: T).(eq T t0 (THead (Bind b) w +u)))))) (\forall (b: B).(\forall (w: T).(\forall (u: T).((eq T t0 (THead +(Bind b) w u)) \to (\forall (P: Prop).P))))) (or (\forall (t2: T).((pr0 +(THead (Flat Appl) t t0) t2) \to (eq T (THead (Flat Appl) t t0) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Flat Appl) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t t0) t2)))) (\lambda +(H2: (ex_3 B T T (\lambda (b: B).(\lambda (w: T).(\lambda (u: T).(eq T t0 +(THead (Bind b) w u))))))).(ex_3_ind B T T (\lambda (b: B).(\lambda (w: +T).(\lambda (u: T).(eq T t0 (THead (Bind b) w u))))) (or (\forall (t2: +T).((pr0 (THead (Flat Appl) t t0) t2) \to (eq T (THead (Flat Appl) t t0) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Flat Appl) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t t0) t2)))) +(\lambda (x0: B).(\lambda (x1: T).(\lambda (x2: T).(\lambda (H3: (eq T t0 +(THead (Bind x0) x1 x2))).(let H4 \def (eq_ind T t0 (\lambda (t2: T).(or +(\forall (t3: T).((pr0 t2 t3) \to (eq T t2 t3))) (ex2 T (\lambda (t3: T).((eq +T t2 t3) \to (\forall (P: Prop).P))) (\lambda (t3: T).(pr0 t2 t3))))) H0 +(THead (Bind x0) x1 x2) H3) in (eq_ind_r T (THead (Bind x0) x1 x2) (\lambda +(t2: T).(or (\forall (t3: T).((pr0 (THead (Flat Appl) t t2) t3) \to (eq T +(THead (Flat Appl) t t2) t3))) (ex2 T (\lambda (t3: T).((eq T (THead (Flat +Appl) t t2) t3) \to (\forall (P: Prop).P))) (\lambda (t3: T).(pr0 (THead +(Flat Appl) t t2) t3))))) (B_ind (\lambda (b: B).((or (\forall (t2: T).((pr0 +(THead (Bind b) x1 x2) t2) \to (eq T (THead (Bind b) x1 x2) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Bind b) x1 x2) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind b) x1 x2) t2)))) \to (or +(\forall (t2: T).((pr0 (THead (Flat Appl) t (THead (Bind b) x1 x2)) t2) \to +(eq T (THead (Flat Appl) t (THead (Bind b) x1 x2)) t2))) (ex2 T (\lambda (t2: +T).((eq T (THead (Flat Appl) t (THead (Bind b) x1 x2)) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t (THead (Bind b) x1 x2)) +t2)))))) (\lambda (_: (or (\forall (t2: T).((pr0 (THead (Bind Abbr) x1 x2) +t2) \to (eq T (THead (Bind Abbr) x1 x2) t2))) (ex2 T (\lambda (t2: T).((eq T +(THead (Bind Abbr) x1 x2) t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr0 (THead (Bind Abbr) x1 x2) t2))))).(or_intror (\forall (t2: T).((pr0 +(THead (Flat Appl) t (THead (Bind Abbr) x1 x2)) t2) \to (eq T (THead (Flat +Appl) t (THead (Bind Abbr) x1 x2)) t2))) (ex2 T (\lambda (t2: T).((eq T +(THead (Flat Appl) t (THead (Bind Abbr) x1 x2)) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t (THead (Bind Abbr) x1 +x2)) t2))) (ex_intro2 T (\lambda (t2: T).((eq T (THead (Flat Appl) t (THead +(Bind Abbr) x1 x2)) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 +(THead (Flat Appl) t (THead (Bind Abbr) x1 x2)) t2)) (THead (Bind Abbr) x1 +(THead (Flat Appl) (lift (S O) O t) x2)) (\lambda (H6: (eq T (THead (Flat +Appl) t (THead (Bind Abbr) x1 x2)) (THead (Bind Abbr) x1 (THead (Flat Appl) +(lift (S O) O t) x2)))).(\lambda (P: Prop).(let H7 \def (eq_ind T (THead +(Flat Appl) t (THead (Bind Abbr) x1 x2)) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ t2) \Rightarrow (match t2 in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False +| (THead k0 _ _) \Rightarrow (match k0 in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow True | (Flat _) \Rightarrow False])])])) I (THead (Bind +Abbr) x1 (THead (Flat Appl) (lift (S O) O t) x2)) H6) in (False_ind P H7)))) +(pr0_upsilon Abbr not_abbr_abst t t (pr0_refl t) x1 x1 (pr0_refl x1) x2 x2 +(pr0_refl x2))))) (\lambda (_: (or (\forall (t2: T).((pr0 (THead (Bind Abst) +x1 x2) t2) \to (eq T (THead (Bind Abst) x1 x2) t2))) (ex2 T (\lambda (t2: +T).((eq T (THead (Bind Abst) x1 x2) t2) \to (\forall (P: Prop).P))) (\lambda +(t2: T).(pr0 (THead (Bind Abst) x1 x2) t2))))).(or_intror (\forall (t2: +T).((pr0 (THead (Flat Appl) t (THead (Bind Abst) x1 x2)) t2) \to (eq T (THead +(Flat Appl) t (THead (Bind Abst) x1 x2)) t2))) (ex2 T (\lambda (t2: T).((eq T +(THead (Flat Appl) t (THead (Bind Abst) x1 x2)) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t (THead (Bind Abst) x1 +x2)) t2))) (ex_intro2 T (\lambda (t2: T).((eq T (THead (Flat Appl) t (THead +(Bind Abst) x1 x2)) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 +(THead (Flat Appl) t (THead (Bind Abst) x1 x2)) t2)) (THead (Bind Abbr) t x2) +(\lambda (H6: (eq T (THead (Flat Appl) t (THead (Bind Abst) x1 x2)) (THead +(Bind Abbr) t x2))).(\lambda (P: Prop).(let H7 \def (eq_ind T (THead (Flat +Appl) t (THead (Bind Abst) x1 x2)) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind Abbr) t x2) H6) in (False_ind P H7)))) (pr0_beta x1 +t t (pr0_refl t) x2 x2 (pr0_refl x2))))) (\lambda (_: (or (\forall (t2: +T).((pr0 (THead (Bind Void) x1 x2) t2) \to (eq T (THead (Bind Void) x1 x2) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Bind Void) x1 x2) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Bind Void) x1 x2) +t2))))).(or_intror (\forall (t2: T).((pr0 (THead (Flat Appl) t (THead (Bind +Void) x1 x2)) t2) \to (eq T (THead (Flat Appl) t (THead (Bind Void) x1 x2)) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Flat Appl) t (THead (Bind Void) +x1 x2)) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat +Appl) t (THead (Bind Void) x1 x2)) t2))) (ex_intro2 T (\lambda (t2: T).((eq T +(THead (Flat Appl) t (THead (Bind Void) x1 x2)) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t (THead (Bind Void) x1 +x2)) t2)) (THead (Bind Void) x1 (THead (Flat Appl) (lift (S O) O t) x2)) +(\lambda (H6: (eq T (THead (Flat Appl) t (THead (Bind Void) x1 x2)) (THead +(Bind Void) x1 (THead (Flat Appl) (lift (S O) O t) x2)))).(\lambda (P: +Prop).(let H7 \def (eq_ind T (THead (Flat Appl) t (THead (Bind Void) x1 x2)) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ t2) \Rightarrow +(match t2 in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False +| (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | (Flat _) +\Rightarrow False])])])) I (THead (Bind Void) x1 (THead (Flat Appl) (lift (S +O) O t) x2)) H6) in (False_ind P H7)))) (pr0_upsilon Void not_void_abst t t +(pr0_refl t) x1 x1 (pr0_refl x1) x2 x2 (pr0_refl x2))))) x0 H4) t0 H3)))))) +H2)) (\lambda (H2: ((\forall (b: B).(\forall (w: T).(\forall (u: T).((eq T t0 +(THead (Bind b) w u)) \to (\forall (P: Prop).P))))))).(let H3 \def H in +(or_ind (\forall (t2: T).((pr0 t t2) \to (eq T t t2))) (ex2 T (\lambda (t2: +T).((eq T t t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 t t2))) (or +(\forall (t2: T).((pr0 (THead (Flat Appl) t t0) t2) \to (eq T (THead (Flat +Appl) t t0) t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Flat Appl) t t0) t2) +\to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t t0) +t2)))) (\lambda (H4: ((\forall (t2: T).((pr0 t t2) \to (eq T t t2))))).(let +H5 \def H0 in (or_ind (\forall (t2: T).((pr0 t0 t2) \to (eq T t0 t2))) (ex2 T +(\lambda (t2: T).((eq T t0 t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr0 t0 t2))) (or (\forall (t2: T).((pr0 (THead (Flat Appl) t t0) t2) \to +(eq T (THead (Flat Appl) t t0) t2))) (ex2 T (\lambda (t2: T).((eq T (THead +(Flat Appl) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 +(THead (Flat Appl) t t0) t2)))) (\lambda (H6: ((\forall (t2: T).((pr0 t0 t2) +\to (eq T t0 t2))))).(or_introl (\forall (t2: T).((pr0 (THead (Flat Appl) t +t0) t2) \to (eq T (THead (Flat Appl) t t0) t2))) (ex2 T (\lambda (t2: T).((eq +T (THead (Flat Appl) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr0 (THead (Flat Appl) t t0) t2))) (\lambda (t2: T).(\lambda (H7: (pr0 +(THead (Flat Appl) t t0) t2)).(or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr0 t u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t0 t3)))) (ex4_4 T T T +T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t0 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr0 t u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(pr0 z1 t3)))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T t0 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t3: T).(eq T +t2 (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O u2) t3))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(\lambda (_: T).(pr0 t u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (t3: T).(pr0 z1 t3)))))))) (eq T (THead (Flat Appl) t t0) t2) +(\lambda (H8: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 t u2))) (\lambda +(_: T).(\lambda (t3: T).(pr0 t0 t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 t u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t0 +t3))) (eq T (THead (Flat Appl) t t0) t2) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H9: (eq T t2 (THead (Flat Appl) x0 x1))).(\lambda (H10: (pr0 t +x0)).(\lambda (H11: (pr0 t0 x1)).(let H_y \def (H6 x1 H11) in (let H_y0 \def +(H4 x0 H10) in (let H12 \def (eq_ind_r T x1 (\lambda (t3: T).(pr0 t0 t3)) H11 +t0 H_y) in (let H13 \def (eq_ind_r T x1 (\lambda (t3: T).(eq T t2 (THead +(Flat Appl) x0 t3))) H9 t0 H_y) in (let H14 \def (eq_ind_r T x0 (\lambda (t3: +T).(pr0 t t3)) H10 t H_y0) in (let H15 \def (eq_ind_r T x0 (\lambda (t3: +T).(eq T t2 (THead (Flat Appl) t3 t0))) H13 t H_y0) in (eq_ind_r T (THead +(Flat Appl) t t0) (\lambda (t3: T).(eq T (THead (Flat Appl) t t0) t3)) +(refl_equal T (THead (Flat Appl) t t0)) t2 H15)))))))))))) H8)) (\lambda (H8: +(ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(eq T t0 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr0 t +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(pr0 z1 t3))))))).(ex4_4_ind T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T t0 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 +(THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr0 t u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (t3: T).(pr0 z1 t3))))) (eq T (THead (Flat Appl) t t0) t2) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda +(H9: (eq T t0 (THead (Bind Abst) x0 x1))).(\lambda (H10: (eq T t2 (THead +(Bind Abbr) x2 x3))).(\lambda (_: (pr0 t x2)).(\lambda (_: (pr0 x1 +x3)).(eq_ind_r T (THead (Bind Abbr) x2 x3) (\lambda (t3: T).(eq T (THead +(Flat Appl) t t0) t3)) (let H13 \def (eq_ind T t0 (\lambda (t3: T).(\forall +(t4: T).((pr0 t3 t4) \to (eq T t3 t4)))) H6 (THead (Bind Abst) x0 x1) H9) in +(let H14 \def (eq_ind T t0 (\lambda (t3: T).(\forall (b: B).(\forall (w: +T).(\forall (u: T).((eq T t3 (THead (Bind b) w u)) \to (\forall (P: +Prop).P)))))) H2 (THead (Bind Abst) x0 x1) H9) in (eq_ind_r T (THead (Bind +Abst) x0 x1) (\lambda (t3: T).(eq T (THead (Flat Appl) t t3) (THead (Bind +Abbr) x2 x3))) (H14 Abst x0 x1 (H13 (THead (Bind Abst) x0 x1) (pr0_refl +(THead (Bind Abst) x0 x1))) (eq T (THead (Flat Appl) t (THead (Bind Abst) x0 +x1)) (THead (Bind Abbr) x2 x3))) t0 H9))) t2 H10))))))))) H8)) (\lambda (H8: +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T t0 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t3: T).(eq T +t2 (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O u2) t3))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(\lambda (_: T).(pr0 t u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (t3: T).(pr0 z1 t3))))))))).(ex6_6_ind B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t0 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (v2: T).(\lambda (t3: T).(eq T t2 (THead (Bind b) v2 (THead +(Flat Appl) (lift (S O) O u2) t3))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda (_: T).(pr0 t +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t3: T).(pr0 z1 t3))))))) (eq T (THead (Flat Appl) t t0) t2) (\lambda (x0: +B).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (x5: T).(\lambda (_: (not (eq B x0 Abst))).(\lambda (H10: (eq T +t0 (THead (Bind x0) x1 x2))).(\lambda (H11: (eq T t2 (THead (Bind x0) x4 +(THead (Flat Appl) (lift (S O) O x3) x5)))).(\lambda (_: (pr0 t x3)).(\lambda +(_: (pr0 x1 x4)).(\lambda (_: (pr0 x2 x5)).(eq_ind_r T (THead (Bind x0) x4 +(THead (Flat Appl) (lift (S O) O x3) x5)) (\lambda (t3: T).(eq T (THead (Flat +Appl) t t0) t3)) (let H15 \def (eq_ind T t0 (\lambda (t3: T).(\forall (t4: +T).((pr0 t3 t4) \to (eq T t3 t4)))) H6 (THead (Bind x0) x1 x2) H10) in (let +H16 \def (eq_ind T t0 (\lambda (t3: T).(\forall (b: B).(\forall (w: +T).(\forall (u: T).((eq T t3 (THead (Bind b) w u)) \to (\forall (P: +Prop).P)))))) H2 (THead (Bind x0) x1 x2) H10) in (eq_ind_r T (THead (Bind x0) +x1 x2) (\lambda (t3: T).(eq T (THead (Flat Appl) t t3) (THead (Bind x0) x4 +(THead (Flat Appl) (lift (S O) O x3) x5)))) (H16 x0 x1 x2 (H15 (THead (Bind +x0) x1 x2) (pr0_refl (THead (Bind x0) x1 x2))) (eq T (THead (Flat Appl) t +(THead (Bind x0) x1 x2)) (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O +x3) x5)))) t0 H10))) t2 H11))))))))))))) H8)) (pr0_gen_appl t t0 t2 H7)))))) +(\lambda (H6: (ex2 T (\lambda (t2: T).((eq T t0 t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 t0 t2)))).(ex2_ind T (\lambda (t2: T).((eq T +t0 t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 t0 t2)) (or (\forall +(t2: T).((pr0 (THead (Flat Appl) t t0) t2) \to (eq T (THead (Flat Appl) t t0) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Flat Appl) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t t0) t2)))) +(\lambda (x: T).(\lambda (H7: (((eq T t0 x) \to (\forall (P: +Prop).P)))).(\lambda (H8: (pr0 t0 x)).(or_intror (\forall (t2: T).((pr0 +(THead (Flat Appl) t t0) t2) \to (eq T (THead (Flat Appl) t t0) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Flat Appl) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t t0) t2))) (ex_intro2 T +(\lambda (t2: T).((eq T (THead (Flat Appl) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t t0) t2)) (THead (Flat +Appl) t x) (\lambda (H9: (eq T (THead (Flat Appl) t t0) (THead (Flat Appl) t +x))).(\lambda (P: Prop).(let H10 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) +\Rightarrow t0 | (THead _ _ t2) \Rightarrow t2])) (THead (Flat Appl) t t0) +(THead (Flat Appl) t x) H9) in (let H11 \def (eq_ind_r T x (\lambda (t2: +T).(pr0 t0 t2)) H8 t0 H10) in (let H12 \def (eq_ind_r T x (\lambda (t2: +T).((eq T t0 t2) \to (\forall (P0: Prop).P0))) H7 t0 H10) in (H12 (refl_equal +T t0) P)))))) (pr0_comp t t (pr0_refl t) t0 x H8 (Flat Appl))))))) H6)) H5))) +(\lambda (H4: (ex2 T (\lambda (t2: T).((eq T t t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 t t2)))).(ex2_ind T (\lambda (t2: T).((eq T +t t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 t t2)) (or (\forall +(t2: T).((pr0 (THead (Flat Appl) t t0) t2) \to (eq T (THead (Flat Appl) t t0) +t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Flat Appl) t t0) t2) \to +(\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t t0) t2)))) +(\lambda (x: T).(\lambda (H5: (((eq T t x) \to (\forall (P: +Prop).P)))).(\lambda (H6: (pr0 t x)).(or_intror (\forall (t2: T).((pr0 (THead +(Flat Appl) t t0) t2) \to (eq T (THead (Flat Appl) t t0) t2))) (ex2 T +(\lambda (t2: T).((eq T (THead (Flat Appl) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t t0) t2))) (ex_intro2 T +(\lambda (t2: T).((eq T (THead (Flat Appl) t t0) t2) \to (\forall (P: +Prop).P))) (\lambda (t2: T).(pr0 (THead (Flat Appl) t t0) t2)) (THead (Flat +Appl) x t0) (\lambda (H7: (eq T (THead (Flat Appl) t t0) (THead (Flat Appl) x +t0))).(\lambda (P: Prop).(let H8 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t | (TLRef _) +\Rightarrow t | (THead _ t2 _) \Rightarrow t2])) (THead (Flat Appl) t t0) +(THead (Flat Appl) x t0) H7) in (let H9 \def (eq_ind_r T x (\lambda (t2: +T).(pr0 t t2)) H6 t H8) in (let H10 \def (eq_ind_r T x (\lambda (t2: T).((eq +T t t2) \to (\forall (P0: Prop).P0))) H5 t H8) in (H10 (refl_equal T t) +P)))))) (pr0_comp t x H6 t0 t0 (pr0_refl t0) (Flat Appl))))))) H4)) H3))) +H1))) (or_intror (\forall (t2: T).((pr0 (THead (Flat Cast) t t0) t2) \to (eq +T (THead (Flat Cast) t t0) t2))) (ex2 T (\lambda (t2: T).((eq T (THead (Flat +Cast) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead +(Flat Cast) t t0) t2))) (ex_intro2 T (\lambda (t2: T).((eq T (THead (Flat +Cast) t t0) t2) \to (\forall (P: Prop).P))) (\lambda (t2: T).(pr0 (THead +(Flat Cast) t t0) t2)) t0 (\lambda (H1: (eq T (THead (Flat Cast) t t0) +t0)).(\lambda (P: Prop).(thead_x_y_y (Flat Cast) t t0 H1 P))) (pr0_epsilon t0 +t0 (pr0_refl t0) t))) f)) k)))))) t1). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/defs.ma new file mode 100644 index 000000000..4086f5beb --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/defs.ma @@ -0,0 +1,42 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr0/defs". + +include "subst0/defs.ma". + +inductive pr0: T \to (T \to Prop) \def +| pr0_refl: \forall (t: T).(pr0 t t) +| pr0_comp: \forall (u1: T).(\forall (u2: T).((pr0 u1 u2) \to (\forall (t1: +T).(\forall (t2: T).((pr0 t1 t2) \to (\forall (k: K).(pr0 (THead k u1 t1) +(THead k u2 t2)))))))) +| pr0_beta: \forall (u: T).(\forall (v1: T).(\forall (v2: T).((pr0 v1 v2) \to +(\forall (t1: T).(\forall (t2: T).((pr0 t1 t2) \to (pr0 (THead (Flat Appl) v1 +(THead (Bind Abst) u t1)) (THead (Bind Abbr) v2 t2)))))))) +| pr0_upsilon: \forall (b: B).((not (eq B b Abst)) \to (\forall (v1: +T).(\forall (v2: T).((pr0 v1 v2) \to (\forall (u1: T).(\forall (u2: T).((pr0 +u1 u2) \to (\forall (t1: T).(\forall (t2: T).((pr0 t1 t2) \to (pr0 (THead +(Flat Appl) v1 (THead (Bind b) u1 t1)) (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t2))))))))))))) +| pr0_delta: \forall (u1: T).(\forall (u2: T).((pr0 u1 u2) \to (\forall (t1: +T).(\forall (t2: T).((pr0 t1 t2) \to (\forall (w: T).((subst0 O u2 t2 w) \to +(pr0 (THead (Bind Abbr) u1 t1) (THead (Bind Abbr) u2 w))))))))) +| pr0_zeta: \forall (b: B).((not (eq B b Abst)) \to (\forall (t1: T).(\forall +(t2: T).((pr0 t1 t2) \to (\forall (u: T).(pr0 (THead (Bind b) u (lift (S O) O +t1)) t2)))))) +| pr0_epsilon: \forall (t1: T).(\forall (t2: T).((pr0 t1 t2) \to (\forall (u: +T).(pr0 (THead (Flat Cast) u t1) t2)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/fwd.ma new file mode 100644 index 000000000..5d1ef3b24 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/fwd.ma @@ -0,0 +1,1736 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr0/fwd". + +include "pr0/props.ma". + +theorem pr0_inv_coq: + \forall (t1: T).(\forall (t2: T).(\forall (P: ((T \to (T \to +Prop)))).((((pr0 t1 t2) \to (\forall (t: T).((eq T t t1) \to ((eq T t t2) \to +(P t1 t2)))))) \to ((((pr0 t1 t2) \to (\forall (u1: T).(\forall (u2: +T).(\forall (t0: T).(\forall (t3: T).(\forall (k: K).((eq T (THead k u1 t0) +t1) \to ((eq T (THead k u2 t3) t2) \to ((pr0 u1 u2) \to ((pr0 t0 t3) \to (P +t1 t2)))))))))))) \to ((((pr0 t1 t2) \to (\forall (u: T).(\forall (v1: +T).(\forall (v2: T).(\forall (t0: T).(\forall (t3: T).((eq T (THead (Flat +Appl) v1 (THead (Bind Abst) u t0)) t1) \to ((eq T (THead (Bind Abbr) v2 t3) +t2) \to ((pr0 v1 v2) \to ((pr0 t0 t3) \to (P t1 t2)))))))))))) \to ((((pr0 t1 +t2) \to (\forall (b: B).(\forall (v1: T).(\forall (v2: T).(\forall (u1: +T).(\forall (u2: T).(\forall (t0: T).(\forall (t3: T).((eq T (THead (Flat +Appl) v1 (THead (Bind b) u1 t0)) t1) \to ((eq T (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t3)) t2) \to ((not (eq B b Abst)) \to ((pr0 v1 +v2) \to ((pr0 u1 u2) \to ((pr0 t0 t3) \to (P t1 t2)))))))))))))))) \to +((((pr0 t1 t2) \to (\forall (u1: T).(\forall (u2: T).(\forall (t0: +T).(\forall (t3: T).(\forall (w: T).((eq T (THead (Bind Abbr) u1 t0) t1) \to +((eq T (THead (Bind Abbr) u2 w) t2) \to ((pr0 u1 u2) \to ((pr0 t0 t3) \to +((subst0 O u2 t3 w) \to (P t1 t2))))))))))))) \to ((((pr0 t1 t2) \to (\forall +(b: B).(\forall (t0: T).(\forall (t3: T).(\forall (u: T).((eq T (THead (Bind +b) u (lift (S O) O t0)) t1) \to ((eq T t3 t2) \to ((not (eq B b Abst)) \to +((pr0 t0 t3) \to (P t1 t2))))))))))) \to ((((pr0 t1 t2) \to (\forall (t0: +T).(\forall (t3: T).(\forall (u: T).((eq T (THead (Flat Cast) u t0) t1) \to +((eq T t3 t2) \to ((pr0 t0 t3) \to (P t1 t2))))))))) \to ((pr0 t1 t2) \to (P +t1 t2))))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (P: ((T \to (T \to +Prop)))).(\lambda (H: (((pr0 t1 t2) \to (\forall (t: T).((eq T t t1) \to ((eq +T t t2) \to (P t1 t2))))))).(\lambda (H0: (((pr0 t1 t2) \to (\forall (u1: +T).(\forall (u2: T).(\forall (t0: T).(\forall (t3: T).(\forall (k: K).((eq T +(THead k u1 t0) t1) \to ((eq T (THead k u2 t3) t2) \to ((pr0 u1 u2) \to ((pr0 +t0 t3) \to (P t1 t2))))))))))))).(\lambda (H1: (((pr0 t1 t2) \to (\forall (u: +T).(\forall (v1: T).(\forall (v2: T).(\forall (t0: T).(\forall (t3: T).((eq T +(THead (Flat Appl) v1 (THead (Bind Abst) u t0)) t1) \to ((eq T (THead (Bind +Abbr) v2 t3) t2) \to ((pr0 v1 v2) \to ((pr0 t0 t3) \to (P t1 +t2))))))))))))).(\lambda (H2: (((pr0 t1 t2) \to (\forall (b: B).(\forall (v1: +T).(\forall (v2: T).(\forall (u1: T).(\forall (u2: T).(\forall (t0: +T).(\forall (t3: T).((eq T (THead (Flat Appl) v1 (THead (Bind b) u1 t0)) t1) +\to ((eq T (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) t2) +\to ((not (eq B b Abst)) \to ((pr0 v1 v2) \to ((pr0 u1 u2) \to ((pr0 t0 t3) +\to (P t1 t2))))))))))))))))).(\lambda (H3: (((pr0 t1 t2) \to (\forall (u1: +T).(\forall (u2: T).(\forall (t0: T).(\forall (t3: T).(\forall (w: T).((eq T +(THead (Bind Abbr) u1 t0) t1) \to ((eq T (THead (Bind Abbr) u2 w) t2) \to +((pr0 u1 u2) \to ((pr0 t0 t3) \to ((subst0 O u2 t3 w) \to (P t1 +t2)))))))))))))).(\lambda (H4: (((pr0 t1 t2) \to (\forall (b: B).(\forall +(t0: T).(\forall (t3: T).(\forall (u: T).((eq T (THead (Bind b) u (lift (S O) +O t0)) t1) \to ((eq T t3 t2) \to ((not (eq B b Abst)) \to ((pr0 t0 t3) \to (P +t1 t2)))))))))))).(\lambda (H5: (((pr0 t1 t2) \to (\forall (t0: T).(\forall +(t3: T).(\forall (u: T).((eq T (THead (Flat Cast) u t0) t1) \to ((eq T t3 t2) +\to ((pr0 t0 t3) \to (P t1 t2)))))))))).(\lambda (H6: (pr0 t1 t2)).(let H7 +\def (match H6 in pr0 return (\lambda (t: T).(\lambda (t0: T).(\lambda (_: +(pr0 t t0)).((eq T t t1) \to ((eq T t0 t2) \to (P t1 t2)))))) with [(pr0_refl +t) \Rightarrow (\lambda (H7: (eq T t t1)).(\lambda (H8: (eq T t t2)).(H H6 t +H7 H8))) | (pr0_comp u1 u2 H7 t0 t3 H8 k) \Rightarrow (\lambda (H9: (eq T +(THead k u1 t0) t1)).(\lambda (H10: (eq T (THead k u2 t3) t2)).(H0 H6 u1 u2 +t0 t3 k H9 H10 H7 H8))) | (pr0_beta u v1 v2 H7 t0 t3 H8) \Rightarrow (\lambda +(H9: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t0)) t1)).(\lambda +(H10: (eq T (THead (Bind Abbr) v2 t3) t2)).(H1 H6 u v1 v2 t0 t3 H9 H10 H7 +H8))) | (pr0_upsilon b H7 v1 v2 H8 u1 u2 H9 t0 t3 H10) \Rightarrow (\lambda +(H11: (eq T (THead (Flat Appl) v1 (THead (Bind b) u1 t0)) t1)).(\lambda (H12: +(eq T (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) t2)).(H2 +H6 b v1 v2 u1 u2 t0 t3 H11 H12 H7 H8 H9 H10))) | (pr0_delta u1 u2 H7 t0 t3 H8 +w H9) \Rightarrow (\lambda (H10: (eq T (THead (Bind Abbr) u1 t0) +t1)).(\lambda (H11: (eq T (THead (Bind Abbr) u2 w) t2)).(H3 H6 u1 u2 t0 t3 w +H10 H11 H7 H8 H9))) | (pr0_zeta b H7 t0 t3 H8 u) \Rightarrow (\lambda (H9: +(eq T (THead (Bind b) u (lift (S O) O t0)) t1)).(\lambda (H10: (eq T t3 +t2)).(H4 H6 b t0 t3 u H9 H10 H7 H8))) | (pr0_epsilon t0 t3 H7 u) \Rightarrow +(\lambda (H8: (eq T (THead (Flat Cast) u t0) t1)).(\lambda (H9: (eq T t3 +t2)).(H5 H6 t0 t3 u H8 H9 H7)))]) in (H7 (refl_equal T t1) (refl_equal T +t2))))))))))))). + +theorem pr0_gen_sort: + \forall (x: T).(\forall (n: nat).((pr0 (TSort n) x) \to (eq T x (TSort n)))) +\def + \lambda (x: T).(\lambda (n: nat).(\lambda (H: (pr0 (TSort n) +x)).(pr0_inv_coq (TSort n) x (\lambda (t: T).(\lambda (t0: T).(eq T t0 t))) +(\lambda (H0: (pr0 (TSort n) x)).(\lambda (t: T).(\lambda (H1: (eq T t (TSort +n))).(\lambda (H2: (eq T t x)).(let H3 \def (eq_ind T t (\lambda (t0: T).(eq +T t0 (TSort n))) H1 x H2) in (let H4 \def (eq_ind T x (\lambda (t0: T).(pr0 +(TSort n) t0)) H0 (TSort n) H3) in (let H5 \def (eq_ind T x (\lambda (t0: +T).(pr0 (TSort n) t0)) H (TSort n) H3) in (eq_ind_r T (TSort n) (\lambda (t0: +T).(eq T t0 (TSort n))) (refl_equal T (TSort n)) x H3)))))))) (\lambda (H0: +(pr0 (TSort n) x)).(\lambda (u1: T).(\lambda (u2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (k: K).(\lambda (H2: (eq T (THead k u1 t0) +(TSort n))).(\lambda (H3: (eq T (THead k u2 t3) x)).(\lambda (_: (pr0 u1 +u2)).(\lambda (_: (pr0 t0 t3)).(let H5 \def (eq_ind_r T x (\lambda (t: +T).(pr0 (TSort n) t)) H0 (THead k u2 t3) H3) in (let H6 \def (eq_ind_r T x +(\lambda (t: T).(pr0 (TSort n) t)) H (THead k u2 t3) H3) in (eq_ind T (THead +k u2 t3) (\lambda (t: T).(eq T t (TSort n))) (let H7 \def (eq_ind T (THead k +u1 t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TSort n) H2) in (False_ind (eq T (THead k u2 t3) +(TSort n)) H7)) x H3))))))))))))) (\lambda (H0: (pr0 (TSort n) x)).(\lambda +(u: T).(\lambda (v1: T).(\lambda (v2: T).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (H2: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t0)) (TSort +n))).(\lambda (H3: (eq T (THead (Bind Abbr) v2 t3) x)).(\lambda (_: (pr0 v1 +v2)).(\lambda (_: (pr0 t0 t3)).(let H5 \def (eq_ind_r T x (\lambda (t: +T).(pr0 (TSort n) t)) H0 (THead (Bind Abbr) v2 t3) H3) in (let H6 \def +(eq_ind_r T x (\lambda (t: T).(pr0 (TSort n) t)) H (THead (Bind Abbr) v2 t3) +H3) in (eq_ind T (THead (Bind Abbr) v2 t3) (\lambda (t: T).(eq T t (TSort +n))) (let H7 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind Abst) u t0)) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +True])) I (TSort n) H2) in (False_ind (eq T (THead (Bind Abbr) v2 t3) (TSort +n)) H7)) x H3))))))))))))) (\lambda (H0: (pr0 (TSort n) x)).(\lambda (b: +B).(\lambda (v1: T).(\lambda (v2: T).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H4: (eq T (THead (Flat Appl) +v1 (THead (Bind b) u1 t0)) (TSort n))).(\lambda (H5: (eq T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3)) x)).(\lambda (_: (not (eq B b +Abst))).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (pr0 u1 u2)).(\lambda (_: (pr0 +t0 t3)).(let H7 \def (eq_ind_r T x (\lambda (t: T).(pr0 (TSort n) t)) H0 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) H5) in (let H8 +\def (eq_ind_r T x (\lambda (t: T).(pr0 (TSort n) t)) H (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3)) H5) in (eq_ind T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3)) (\lambda (t: T).(eq T t (TSort n))) +(let H9 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind b) u1 t0)) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +True])) I (TSort n) H4) in (False_ind (eq T (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t3)) (TSort n)) H9)) x H5))))))))))))))))) (\lambda +(H0: (pr0 (TSort n) x)).(\lambda (u1: T).(\lambda (u2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (w: T).(\lambda (H3: (eq T (THead (Bind Abbr) u1 +t0) (TSort n))).(\lambda (H4: (eq T (THead (Bind Abbr) u2 w) x)).(\lambda (_: +(pr0 u1 u2)).(\lambda (_: (pr0 t0 t3)).(\lambda (_: (subst0 O u2 t3 w)).(let +H6 \def (eq_ind_r T x (\lambda (t: T).(pr0 (TSort n) t)) H0 (THead (Bind +Abbr) u2 w) H4) in (let H7 \def (eq_ind_r T x (\lambda (t: T).(pr0 (TSort n) +t)) H (THead (Bind Abbr) u2 w) H4) in (eq_ind T (THead (Bind Abbr) u2 w) +(\lambda (t: T).(eq T t (TSort n))) (let H8 \def (eq_ind T (THead (Bind Abbr) +u1 t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TSort n) H3) in (False_ind (eq T (THead (Bind Abbr) u2 +w) (TSort n)) H8)) x H4)))))))))))))) (\lambda (_: (pr0 (TSort n) +x)).(\lambda (b: B).(\lambda (t0: T).(\lambda (t3: T).(\lambda (u: +T).(\lambda (H2: (eq T (THead (Bind b) u (lift (S O) O t0)) (TSort +n))).(\lambda (H3: (eq T t3 x)).(\lambda (_: (not (eq B b Abst))).(\lambda +(H4: (pr0 t0 t3)).(let H5 \def (eq_ind T t3 (\lambda (t: T).(pr0 t0 t)) H4 x +H3) in (let H6 \def (eq_ind T (THead (Bind b) u (lift (S O) O t0)) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +True])) I (TSort n) H2) in (False_ind (eq T x (TSort n)) H6)))))))))))) +(\lambda (_: (pr0 (TSort n) x)).(\lambda (t0: T).(\lambda (t3: T).(\lambda +(u: T).(\lambda (H1: (eq T (THead (Flat Cast) u t0) (TSort n))).(\lambda (H2: +(eq T t3 x)).(\lambda (H3: (pr0 t0 t3)).(let H4 \def (eq_ind T t3 (\lambda +(t: T).(pr0 t0 t)) H3 x H2) in (let H5 \def (eq_ind T (THead (Flat Cast) u +t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TSort n) H1) in (False_ind (eq T x (TSort n)) +H5)))))))))) H))). + +theorem pr0_gen_lref: + \forall (x: T).(\forall (n: nat).((pr0 (TLRef n) x) \to (eq T x (TLRef n)))) +\def + \lambda (x: T).(\lambda (n: nat).(\lambda (H: (pr0 (TLRef n) +x)).(pr0_inv_coq (TLRef n) x (\lambda (t: T).(\lambda (t0: T).(eq T t0 t))) +(\lambda (H0: (pr0 (TLRef n) x)).(\lambda (t: T).(\lambda (H1: (eq T t (TLRef +n))).(\lambda (H2: (eq T t x)).(let H3 \def (eq_ind T t (\lambda (t0: T).(eq +T t0 (TLRef n))) H1 x H2) in (let H4 \def (eq_ind T x (\lambda (t0: T).(pr0 +(TLRef n) t0)) H0 (TLRef n) H3) in (let H5 \def (eq_ind T x (\lambda (t0: +T).(pr0 (TLRef n) t0)) H (TLRef n) H3) in (eq_ind_r T (TLRef n) (\lambda (t0: +T).(eq T t0 (TLRef n))) (refl_equal T (TLRef n)) x H3)))))))) (\lambda (H0: +(pr0 (TLRef n) x)).(\lambda (u1: T).(\lambda (u2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (k: K).(\lambda (H2: (eq T (THead k u1 t0) +(TLRef n))).(\lambda (H3: (eq T (THead k u2 t3) x)).(\lambda (_: (pr0 u1 +u2)).(\lambda (_: (pr0 t0 t3)).(let H5 \def (eq_ind_r T x (\lambda (t: +T).(pr0 (TLRef n) t)) H0 (THead k u2 t3) H3) in (let H6 \def (eq_ind_r T x +(\lambda (t: T).(pr0 (TLRef n) t)) H (THead k u2 t3) H3) in (eq_ind T (THead +k u2 t3) (\lambda (t: T).(eq T t (TLRef n))) (let H7 \def (eq_ind T (THead k +u1 t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TLRef n) H2) in (False_ind (eq T (THead k u2 t3) +(TLRef n)) H7)) x H3))))))))))))) (\lambda (H0: (pr0 (TLRef n) x)).(\lambda +(u: T).(\lambda (v1: T).(\lambda (v2: T).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (H2: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t0)) (TLRef +n))).(\lambda (H3: (eq T (THead (Bind Abbr) v2 t3) x)).(\lambda (_: (pr0 v1 +v2)).(\lambda (_: (pr0 t0 t3)).(let H5 \def (eq_ind_r T x (\lambda (t: +T).(pr0 (TLRef n) t)) H0 (THead (Bind Abbr) v2 t3) H3) in (let H6 \def +(eq_ind_r T x (\lambda (t: T).(pr0 (TLRef n) t)) H (THead (Bind Abbr) v2 t3) +H3) in (eq_ind T (THead (Bind Abbr) v2 t3) (\lambda (t: T).(eq T t (TLRef +n))) (let H7 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind Abst) u t0)) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +True])) I (TLRef n) H2) in (False_ind (eq T (THead (Bind Abbr) v2 t3) (TLRef +n)) H7)) x H3))))))))))))) (\lambda (H0: (pr0 (TLRef n) x)).(\lambda (b: +B).(\lambda (v1: T).(\lambda (v2: T).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H4: (eq T (THead (Flat Appl) +v1 (THead (Bind b) u1 t0)) (TLRef n))).(\lambda (H5: (eq T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3)) x)).(\lambda (_: (not (eq B b +Abst))).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (pr0 u1 u2)).(\lambda (_: (pr0 +t0 t3)).(let H7 \def (eq_ind_r T x (\lambda (t: T).(pr0 (TLRef n) t)) H0 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) H5) in (let H8 +\def (eq_ind_r T x (\lambda (t: T).(pr0 (TLRef n) t)) H (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3)) H5) in (eq_ind T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3)) (\lambda (t: T).(eq T t (TLRef n))) +(let H9 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind b) u1 t0)) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +True])) I (TLRef n) H4) in (False_ind (eq T (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t3)) (TLRef n)) H9)) x H5))))))))))))))))) (\lambda +(H0: (pr0 (TLRef n) x)).(\lambda (u1: T).(\lambda (u2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (w: T).(\lambda (H3: (eq T (THead (Bind Abbr) u1 +t0) (TLRef n))).(\lambda (H4: (eq T (THead (Bind Abbr) u2 w) x)).(\lambda (_: +(pr0 u1 u2)).(\lambda (_: (pr0 t0 t3)).(\lambda (_: (subst0 O u2 t3 w)).(let +H6 \def (eq_ind_r T x (\lambda (t: T).(pr0 (TLRef n) t)) H0 (THead (Bind +Abbr) u2 w) H4) in (let H7 \def (eq_ind_r T x (\lambda (t: T).(pr0 (TLRef n) +t)) H (THead (Bind Abbr) u2 w) H4) in (eq_ind T (THead (Bind Abbr) u2 w) +(\lambda (t: T).(eq T t (TLRef n))) (let H8 \def (eq_ind T (THead (Bind Abbr) +u1 t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TLRef n) H3) in (False_ind (eq T (THead (Bind Abbr) u2 +w) (TLRef n)) H8)) x H4)))))))))))))) (\lambda (_: (pr0 (TLRef n) +x)).(\lambda (b: B).(\lambda (t0: T).(\lambda (t3: T).(\lambda (u: +T).(\lambda (H2: (eq T (THead (Bind b) u (lift (S O) O t0)) (TLRef +n))).(\lambda (H3: (eq T t3 x)).(\lambda (_: (not (eq B b Abst))).(\lambda +(H4: (pr0 t0 t3)).(let H5 \def (eq_ind T t3 (\lambda (t: T).(pr0 t0 t)) H4 x +H3) in (let H6 \def (eq_ind T (THead (Bind b) u (lift (S O) O t0)) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +True])) I (TLRef n) H2) in (False_ind (eq T x (TLRef n)) H6)))))))))))) +(\lambda (_: (pr0 (TLRef n) x)).(\lambda (t0: T).(\lambda (t3: T).(\lambda +(u: T).(\lambda (H1: (eq T (THead (Flat Cast) u t0) (TLRef n))).(\lambda (H2: +(eq T t3 x)).(\lambda (H3: (pr0 t0 t3)).(let H4 \def (eq_ind T t3 (\lambda +(t: T).(pr0 t0 t)) H3 x H2) in (let H5 \def (eq_ind T (THead (Flat Cast) u +t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TLRef n) H1) in (False_ind (eq T x (TLRef n)) +H5)))))))))) H))). + +theorem pr0_gen_abst: + \forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr0 (THead (Bind Abst) u1 +t1) x) \to (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind +Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2))))))) +\def + \lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda (H: (pr0 (THead +(Bind Abst) u1 t1) x)).(pr0_inv_coq (THead (Bind Abst) u1 t1) x (\lambda (_: +T).(\lambda (t0: T).(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T t0 +(THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))))) (\lambda (H0: (pr0 (THead +(Bind Abst) u1 t1) x)).(\lambda (t: T).(\lambda (H1: (eq T t (THead (Bind +Abst) u1 t1))).(\lambda (H2: (eq T t x)).(let H3 \def (eq_ind T t (\lambda +(t0: T).(eq T t0 (THead (Bind Abst) u1 t1))) H1 x H2) in (let H4 \def (eq_ind +T x (\lambda (t0: T).(pr0 (THead (Bind Abst) u1 t1) t0)) H0 (THead (Bind +Abst) u1 t1) H3) in (let H5 \def (eq_ind T x (\lambda (t0: T).(pr0 (THead +(Bind Abst) u1 t1) t0)) H (THead (Bind Abst) u1 t1) H3) in (eq_ind_r T (THead +(Bind Abst) u1 t1) (\lambda (t0: T).(ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T t0 (THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2))))) +(ex3_2_intro T T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead (Bind Abst) +u1 t1) (THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 +u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2))) u1 t1 (refl_equal T +(THead (Bind Abst) u1 t1)) (pr0_refl u1) (pr0_refl t1)) x H3)))))))) (\lambda +(H0: (pr0 (THead (Bind Abst) u1 t1) x)).(\lambda (u0: T).(\lambda (u2: +T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (k: K).(\lambda (H2: (eq T +(THead k u0 t0) (THead (Bind Abst) u1 t1))).(\lambda (H3: (eq T (THead k u2 +t3) x)).(\lambda (H1: (pr0 u0 u2)).(\lambda (H4: (pr0 t0 t3)).(let H5 \def +(eq_ind_r T x (\lambda (t: T).(pr0 (THead (Bind Abst) u1 t1) t)) H0 (THead k +u2 t3) H3) in (let H6 \def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Bind +Abst) u1 t1) t)) H (THead k u2 t3) H3) in (eq_ind T (THead k u2 t3) (\lambda +(t: T).(ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T t (THead (Bind +Abst) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2))))) (let H7 \def (f_equal T K (\lambda (e: +T).(match e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | +(TLRef _) \Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k u0 t0) +(THead (Bind Abst) u1 t1) H2) in ((let H8 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | +(TLRef _) \Rightarrow u0 | (THead _ t _) \Rightarrow t])) (THead k u0 t0) +(THead (Bind Abst) u1 t1) H2) in ((let H9 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | +(TLRef _) \Rightarrow t0 | (THead _ _ t) \Rightarrow t])) (THead k u0 t0) +(THead (Bind Abst) u1 t1) H2) in (\lambda (H10: (eq T u0 u1)).(\lambda (H11: +(eq K k (Bind Abst))).(let H12 \def (eq_ind K k (\lambda (k0: K).(pr0 (THead +(Bind Abst) u1 t1) (THead k0 u2 t3))) H6 (Bind Abst) H11) in (let H13 \def +(eq_ind K k (\lambda (k0: K).(pr0 (THead (Bind Abst) u1 t1) (THead k0 u2 +t3))) H5 (Bind Abst) H11) in (eq_ind_r K (Bind Abst) (\lambda (k0: K).(ex3_2 +T T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead k0 u2 t3) (THead (Bind +Abst) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2))))) (let H14 \def (eq_ind T t0 (\lambda (t: +T).(pr0 t t3)) H4 t1 H9) in (let H15 \def (eq_ind T u0 (\lambda (t: T).(pr0 t +u2)) H1 u1 H10) in (ex3_2_intro T T (\lambda (u3: T).(\lambda (t2: T).(eq T +(THead (Bind Abst) u2 t3) (THead (Bind Abst) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 +t2))) u2 t3 (refl_equal T (THead (Bind Abst) u2 t3)) H15 H14))) k H11)))))) +H8)) H7)) x H3))))))))))))) (\lambda (H0: (pr0 (THead (Bind Abst) u1 t1) +x)).(\lambda (u: T).(\lambda (v1: T).(\lambda (v2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (H2: (eq T (THead (Flat Appl) v1 (THead (Bind +Abst) u t0)) (THead (Bind Abst) u1 t1))).(\lambda (H3: (eq T (THead (Bind +Abbr) v2 t3) x)).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (pr0 t0 t3)).(let H5 +\def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Bind Abst) u1 t1) t)) H0 +(THead (Bind Abbr) v2 t3) H3) in (let H6 \def (eq_ind_r T x (\lambda (t: +T).(pr0 (THead (Bind Abst) u1 t1) t)) H (THead (Bind Abbr) v2 t3) H3) in +(eq_ind T (THead (Bind Abbr) v2 t3) (\lambda (t: T).(ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T t (THead (Bind Abst) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 +t2))))) (let H7 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind Abst) u +t0)) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind Abst) u1 +t1) H2) in (False_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T +(THead (Bind Abbr) v2 t3) (THead (Bind Abst) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 +t2)))) H7)) x H3))))))))))))) (\lambda (H0: (pr0 (THead (Bind Abst) u1 t1) +x)).(\lambda (b: B).(\lambda (v1: T).(\lambda (v2: T).(\lambda (u0: +T).(\lambda (u2: T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H4: (eq T +(THead (Flat Appl) v1 (THead (Bind b) u0 t0)) (THead (Bind Abst) u1 +t1))).(\lambda (H5: (eq T (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t3)) x)).(\lambda (_: (not (eq B b Abst))).(\lambda (_: (pr0 v1 +v2)).(\lambda (_: (pr0 u0 u2)).(\lambda (_: (pr0 t0 t3)).(let H7 \def +(eq_ind_r T x (\lambda (t: T).(pr0 (THead (Bind Abst) u1 t1) t)) H0 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) H5) in (let H8 \def +(eq_ind_r T x (\lambda (t: T).(pr0 (THead (Bind Abst) u1 t1) t)) H (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) H5) in (eq_ind T (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (\lambda (t: T).(ex3_2 +T T (\lambda (u3: T).(\lambda (t2: T).(eq T t (THead (Bind Abst) u3 t2)))) +(\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t2: +T).(pr0 t1 t2))))) (let H9 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind +b) u0 t0)) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind Abst) u1 +t1) H4) in (False_ind (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (THead (Bind +Abst) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2)))) H9)) x H5))))))))))))))))) (\lambda (H0: +(pr0 (THead (Bind Abst) u1 t1) x)).(\lambda (u0: T).(\lambda (u2: T).(\lambda +(t0: T).(\lambda (t3: T).(\lambda (w: T).(\lambda (H3: (eq T (THead (Bind +Abbr) u0 t0) (THead (Bind Abst) u1 t1))).(\lambda (H4: (eq T (THead (Bind +Abbr) u2 w) x)).(\lambda (_: (pr0 u0 u2)).(\lambda (_: (pr0 t0 t3)).(\lambda +(_: (subst0 O u2 t3 w)).(let H6 \def (eq_ind_r T x (\lambda (t: T).(pr0 +(THead (Bind Abst) u1 t1) t)) H0 (THead (Bind Abbr) u2 w) H4) in (let H7 \def +(eq_ind_r T x (\lambda (t: T).(pr0 (THead (Bind Abst) u1 t1) t)) H (THead +(Bind Abbr) u2 w) H4) in (eq_ind T (THead (Bind Abbr) u2 w) (\lambda (t: +T).(ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T t (THead (Bind Abst) u3 +t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2))))) (let H8 \def (eq_ind T (THead (Bind Abbr) +u0 t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +True | Abst \Rightarrow False | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (THead (Bind Abst) u1 t1) H3) in (False_ind (ex3_2 T +T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead (Bind Abbr) u2 w) (THead +(Bind Abst) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda +(_: T).(\lambda (t2: T).(pr0 t1 t2)))) H8)) x H4)))))))))))))) (\lambda (H0: +(pr0 (THead (Bind Abst) u1 t1) x)).(\lambda (b: B).(\lambda (t0: T).(\lambda +(t3: T).(\lambda (u: T).(\lambda (H2: (eq T (THead (Bind b) u (lift (S O) O +t0)) (THead (Bind Abst) u1 t1))).(\lambda (H3: (eq T t3 x)).(\lambda (H1: +(not (eq B b Abst))).(\lambda (H4: (pr0 t0 t3)).(let H5 \def (eq_ind T t3 +(\lambda (t: T).(pr0 t0 t)) H4 x H3) in (let H6 \def (f_equal T B (\lambda +(e: T).(match e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b +| (TLRef _) \Rightarrow b | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow +b])])) (THead (Bind b) u (lift (S O) O t0)) (THead (Bind Abst) u1 t1) H2) in +((let H7 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | (THead _ t _) +\Rightarrow t])) (THead (Bind b) u (lift (S O) O t0)) (THead (Bind Abst) u1 +t1) H2) in ((let H8 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map (f: ((nat +\to nat))) (d: nat) (t: T) on t: T \def (match t with [(TSort n) \Rightarrow +(TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with [true +\Rightarrow i | false \Rightarrow (f i)])) | (THead k u0 t2) \Rightarrow +(THead k (lref_map f d u0) (lref_map f (s k d) t2))]) in lref_map) (\lambda +(x0: nat).(plus x0 (S O))) O t0) | (TLRef _) \Rightarrow ((let rec lref_map +(f: ((nat \to nat))) (d: nat) (t: T) on t: T \def (match t with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u0 t2) +\Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) t2))]) in +lref_map) (\lambda (x0: nat).(plus x0 (S O))) O t0) | (THead _ _ t) +\Rightarrow t])) (THead (Bind b) u (lift (S O) O t0)) (THead (Bind Abst) u1 +t1) H2) in (\lambda (_: (eq T u u1)).(\lambda (H10: (eq B b Abst)).(let H11 +\def (eq_ind B b (\lambda (b0: B).(not (eq B b0 Abst))) H1 Abst H10) in (let +H12 \def (eq_ind_r T t1 (\lambda (t: T).(pr0 (THead (Bind Abst) u1 t) x)) H0 +(lift (S O) O t0) H8) in (let H13 \def (eq_ind_r T t1 (\lambda (t: T).(pr0 +(THead (Bind Abst) u1 t) x)) H (lift (S O) O t0) H8) in (eq_ind T (lift (S O) +O t0) (\lambda (t: T).(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x +(THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(pr0 t t2))))) (let H14 \def (match (H11 +(refl_equal B Abst)) in False return (\lambda (_: False).(ex3_2 T T (\lambda +(u2: T).(\lambda (t2: T).(eq T x (THead (Bind Abst) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 (lift +(S O) O t0) t2))))) with []) in H14) t1 H8))))))) H7)) H6)))))))))))) +(\lambda (_: (pr0 (THead (Bind Abst) u1 t1) x)).(\lambda (t0: T).(\lambda +(t3: T).(\lambda (u: T).(\lambda (H1: (eq T (THead (Flat Cast) u t0) (THead +(Bind Abst) u1 t1))).(\lambda (H2: (eq T t3 x)).(\lambda (H3: (pr0 t0 +t3)).(let H4 \def (eq_ind T t3 (\lambda (t: T).(pr0 t0 t)) H3 x H2) in (let +H5 \def (eq_ind T (THead (Flat Cast) u t0) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind Abst) u1 t1) H1) in (False_ind (ex3_2 T T (\lambda +(u2: T).(\lambda (t2: T).(eq T x (THead (Bind Abst) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 +t2)))) H5)))))))))) H)))). + +theorem pr0_gen_appl: + \forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr0 (THead (Flat Appl) u1 +t1) x) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead +(Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda +(_: T).(\lambda (t2: T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Abbr) u2 t2)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t2: T).(eq T x (THead (Bind b) +v2 (THead (Flat Appl) (lift (S O) O u2) t2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda (_: T).(pr0 +u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t2: T).(pr0 z1 t2)))))))))))) +\def + \lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda (H: (pr0 (THead +(Flat Appl) u1 t1) x)).(pr0_inv_coq (THead (Flat Appl) u1 t1) x (\lambda (_: +T).(\lambda (t0: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T +t0 (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 +u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t2: T).(eq T t0 (THead (Bind Abbr) u2 t2)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t2: T).(eq T +t0 (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O u2) t2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(\lambda (_: T).(pr0 u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 +v2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2))))))))))) (\lambda (H0: (pr0 +(THead (Flat Appl) u1 t1) x)).(\lambda (t: T).(\lambda (H1: (eq T t (THead +(Flat Appl) u1 t1))).(\lambda (H2: (eq T t x)).(let H3 \def (eq_ind T t +(\lambda (t0: T).(eq T t0 (THead (Flat Appl) u1 t1))) H1 x H2) in (let H4 +\def (eq_ind T x (\lambda (t0: T).(pr0 (THead (Flat Appl) u1 t1) t0)) H0 +(THead (Flat Appl) u1 t1) H3) in (let H5 \def (eq_ind T x (\lambda (t0: +T).(pr0 (THead (Flat Appl) u1 t1) t0)) H (THead (Flat Appl) u1 t1) H3) in +(eq_ind_r T (THead (Flat Appl) u1 t1) (\lambda (t0: T).(or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T t0 (THead (Flat Appl) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: +T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(eq T t0 (THead (Bind +Abbr) u2 t2)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (v2: T).(\lambda (t2: T).(eq T t0 (THead (Bind b) v2 (THead +(Flat Appl) (lift (S O) O u2) t2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t2: T).(pr0 z1 t2)))))))))) (or3_intro0 (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T (THead (Flat Appl) u1 t1) (THead (Flat Appl) u2 t2)))) (\lambda +(u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 +t1 t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(eq T (THead (Flat Appl) +u1 t1) (THead (Bind Abbr) u2 t2)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t2: T).(eq T (THead (Flat +Appl) u1 t1) (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O u2) +t2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 u2))))))) (\lambda (_: B).(\lambda +(y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (v2: T).(\lambda (_: T).(pr0 +y1 v2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))))) (ex3_2_intro T T +(\lambda (u2: T).(\lambda (t2: T).(eq T (THead (Flat Appl) u1 t1) (THead +(Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda +(_: T).(\lambda (t2: T).(pr0 t1 t2))) u1 t1 (refl_equal T (THead (Flat Appl) +u1 t1)) (pr0_refl u1) (pr0_refl t1))) x H3)))))))) (\lambda (H0: (pr0 (THead +(Flat Appl) u1 t1) x)).(\lambda (u0: T).(\lambda (u2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (k: K).(\lambda (H2: (eq T (THead k u0 t0) +(THead (Flat Appl) u1 t1))).(\lambda (H3: (eq T (THead k u2 t3) x)).(\lambda +(H1: (pr0 u0 u2)).(\lambda (H4: (pr0 t0 t3)).(let H5 \def (eq_ind_r T x +(\lambda (t: T).(pr0 (THead (Flat Appl) u1 t1) t)) H0 (THead k u2 t3) H3) in +(let H6 \def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat Appl) u1 t1) t)) +H (THead k u2 t3) H3) in (eq_ind T (THead k u2 t3) (\lambda (t: T).(or3 +(ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T t (THead (Flat Appl) u3 +t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: +T).(eq T t (THead (Bind Abbr) u3 t2)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (v2: T).(\lambda (t2: T).(eq T t (THead (Bind b) +v2 (THead (Flat Appl) (lift (S O) O u3) t2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(\lambda (_: T).(pr0 +u1 u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t2: T).(pr0 z1 t2)))))))))) (let H7 \def (f_equal T K (\lambda (e: T).(match +e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k u0 t0) (THead (Flat +Appl) u1 t1) H2) in ((let H8 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) +\Rightarrow u0 | (THead _ t _) \Rightarrow t])) (THead k u0 t0) (THead (Flat +Appl) u1 t1) H2) in ((let H9 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) +\Rightarrow t0 | (THead _ _ t) \Rightarrow t])) (THead k u0 t0) (THead (Flat +Appl) u1 t1) H2) in (\lambda (H10: (eq T u0 u1)).(\lambda (H11: (eq K k (Flat +Appl))).(let H12 \def (eq_ind K k (\lambda (k0: K).(pr0 (THead (Flat Appl) u1 +t1) (THead k0 u2 t3))) H6 (Flat Appl) H11) in (let H13 \def (eq_ind K k +(\lambda (k0: K).(pr0 (THead (Flat Appl) u1 t1) (THead k0 u2 t3))) H5 (Flat +Appl) H11) in (eq_ind_r K (Flat Appl) (\lambda (k0: K).(or3 (ex3_2 T T +(\lambda (u3: T).(\lambda (t2: T).(eq T (THead k0 u2 t3) (THead (Flat Appl) +u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: +T).(eq T (THead k0 u2 t3) (THead (Bind Abbr) u3 t2)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (v2: T).(\lambda (t2: T).(eq T +(THead k0 u2 t3) (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O u3) +t2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 u3))))))) (\lambda (_: B).(\lambda +(y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (v2: T).(\lambda (_: T).(pr0 +y1 v2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))))))) (let H14 \def +(eq_ind T t0 (\lambda (t: T).(pr0 t t3)) H4 t1 H9) in (let H15 \def (eq_ind T +u0 (\lambda (t: T).(pr0 t u2)) H1 u1 H10) in (or3_intro0 (ex3_2 T T (\lambda +(u3: T).(\lambda (t2: T).(eq T (THead (Flat Appl) u2 t3) (THead (Flat Appl) +u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: +T).(eq T (THead (Flat Appl) u2 t3) (THead (Bind Abbr) u3 t2)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 +t2)))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (v2: T).(\lambda +(t2: T).(eq T (THead (Flat Appl) u2 t3) (THead (Bind b) v2 (THead (Flat Appl) +(lift (S O) O u3) t2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 u3))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 +t2)))))))) (ex3_2_intro T T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead +(Flat Appl) u2 t3) (THead (Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: +T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2))) u2 t3 +(refl_equal T (THead (Flat Appl) u2 t3)) H15 H14)))) k H11)))))) H8)) H7)) x +H3))))))))))))) (\lambda (H0: (pr0 (THead (Flat Appl) u1 t1) x)).(\lambda (u: +T).(\lambda (v1: T).(\lambda (v2: T).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (H2: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t0)) (THead +(Flat Appl) u1 t1))).(\lambda (H3: (eq T (THead (Bind Abbr) v2 t3) +x)).(\lambda (H1: (pr0 v1 v2)).(\lambda (H4: (pr0 t0 t3)).(let H5 \def +(eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat Appl) u1 t1) t)) H0 (THead +(Bind Abbr) v2 t3) H3) in (let H6 \def (eq_ind_r T x (\lambda (t: T).(pr0 +(THead (Flat Appl) u1 t1) t)) H (THead (Bind Abbr) v2 t3) H3) in (eq_ind T +(THead (Bind Abbr) v2 t3) (\lambda (t: T).(or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T t (THead (Flat Appl) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 +t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(eq T t (THead (Bind +Abbr) u2 t2)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (v3: T).(\lambda (t2: T).(eq T t (THead (Bind b) v3 (THead +(Flat Appl) (lift (S O) O u2) t2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v3: T).(\lambda (_: T).(pr0 y1 v3))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t2: T).(pr0 z1 t2)))))))))) (let H7 \def (f_equal T T (\lambda (e: T).(match +e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow v1 | (TLRef _) +\Rightarrow v1 | (THead _ t _) \Rightarrow t])) (THead (Flat Appl) v1 (THead +(Bind Abst) u t0)) (THead (Flat Appl) u1 t1) H2) in ((let H8 \def (f_equal T +T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow (THead (Bind Abst) u t0) | (TLRef _) \Rightarrow (THead (Bind +Abst) u t0) | (THead _ _ t) \Rightarrow t])) (THead (Flat Appl) v1 (THead +(Bind Abst) u t0)) (THead (Flat Appl) u1 t1) H2) in (\lambda (H9: (eq T v1 +u1)).(let H10 \def (eq_ind T v1 (\lambda (t: T).(pr0 t v2)) H1 u1 H9) in (let +H11 \def (eq_ind_r T t1 (\lambda (t: T).(pr0 (THead (Flat Appl) u1 t) (THead +(Bind Abbr) v2 t3))) H6 (THead (Bind Abst) u t0) H8) in (let H12 \def +(eq_ind_r T t1 (\lambda (t: T).(pr0 (THead (Flat Appl) u1 t) (THead (Bind +Abbr) v2 t3))) H5 (THead (Bind Abst) u t0) H8) in (eq_ind T (THead (Bind +Abst) u t0) (\lambda (t: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T (THead (Bind Abbr) v2 t3) (THead (Flat Appl) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t +t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T t (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(eq T (THead (Bind Abbr) +v2 t3) (THead (Bind Abbr) u2 t2)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (v3: T).(\lambda (t2: T).(eq T (THead (Bind +Abbr) v2 t3) (THead (Bind b) v3 (THead (Flat Appl) (lift (S O) O u2) +t2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 u2))))))) (\lambda (_: B).(\lambda +(y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (v3: T).(\lambda (_: T).(pr0 +y1 v3))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))))))) (or3_intro1 (ex3_2 T +T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead (Bind Abbr) v2 t3) (THead +(Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda +(_: T).(\lambda (t2: T).(pr0 (THead (Bind Abst) u t0) t2)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind Abst) u t0) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(eq T (THead (Bind Abbr) +v2 t3) (THead (Bind Abbr) u2 t2)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind Abst) u t0) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (v3: T).(\lambda +(t2: T).(eq T (THead (Bind Abbr) v2 t3) (THead (Bind b) v3 (THead (Flat Appl) +(lift (S O) O u2) t2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(v3: T).(\lambda (_: T).(pr0 y1 v3))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 +t2)))))))) (ex4_4_intro T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (_: T).(eq T (THead (Bind Abst) u t0) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: +T).(eq T (THead (Bind Abbr) v2 t3) (THead (Bind Abbr) u2 t2)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 +t2))))) u t0 v2 t3 (refl_equal T (THead (Bind Abst) u t0)) (refl_equal T +(THead (Bind Abbr) v2 t3)) H10 H4)) t1 H8)))))) H7)) x H3))))))))))))) +(\lambda (H0: (pr0 (THead (Flat Appl) u1 t1) x)).(\lambda (b: B).(\lambda +(v1: T).(\lambda (v2: T).(\lambda (u0: T).(\lambda (u2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (H4: (eq T (THead (Flat Appl) v1 (THead (Bind b) +u0 t0)) (THead (Flat Appl) u1 t1))).(\lambda (H5: (eq T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3)) x)).(\lambda (H1: (not (eq B b +Abst))).(\lambda (H2: (pr0 v1 v2)).(\lambda (H3: (pr0 u0 u2)).(\lambda (H6: +(pr0 t0 t3)).(let H7 \def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat +Appl) u1 t1) t)) H0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t3)) H5) in (let H8 \def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat +Appl) u1 t1) t)) H (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t3)) H5) in (eq_ind T (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t3)) (\lambda (t: T).(or3 (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T +t (THead (Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) +(\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(t2: T).(eq T t (THead (Bind Abbr) u3 t2)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T +(\lambda (b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b0 Abst)))))))) (\lambda (b0: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (v3: T).(\lambda (t2: T).(eq T t (THead (Bind +b0) v3 (THead (Flat Appl) (lift (S O) O u3) t2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(\lambda +(_: T).(pr0 u1 u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (v3: T).(\lambda (_: T).(pr0 y1 v3))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (t2: T).(pr0 z1 t2)))))))))) (let H9 \def (f_equal T T (\lambda +(e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow v1 +| (TLRef _) \Rightarrow v1 | (THead _ t _) \Rightarrow t])) (THead (Flat +Appl) v1 (THead (Bind b) u0 t0)) (THead (Flat Appl) u1 t1) H4) in ((let H10 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow (THead (Bind b) u0 t0) | (TLRef _) \Rightarrow +(THead (Bind b) u0 t0) | (THead _ _ t) \Rightarrow t])) (THead (Flat Appl) v1 +(THead (Bind b) u0 t0)) (THead (Flat Appl) u1 t1) H4) in (\lambda (H11: (eq T +v1 u1)).(let H12 \def (eq_ind T v1 (\lambda (t: T).(pr0 t v2)) H2 u1 H11) in +(let H13 \def (eq_ind_r T t1 (\lambda (t: T).(pr0 (THead (Flat Appl) u1 t) +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)))) H8 (THead +(Bind b) u0 t0) H10) in (let H14 \def (eq_ind_r T t1 (\lambda (t: T).(pr0 +(THead (Flat Appl) u1 t) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t3)))) H7 (THead (Bind b) u0 t0) H10) in (eq_ind T (THead (Bind b) u0 t0) +(\lambda (t: T).(or3 (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (THead (Flat +Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: +T).(eq T (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (THead +(Bind Abbr) u3 t2)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))))) (\lambda (_: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T (\lambda (b0: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b0 Abst)))))))) (\lambda (b0: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t (THead (Bind +b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(u3: T).(\lambda (v3: T).(\lambda (t2: T).(eq T (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t3)) (THead (Bind b0) v3 (THead (Flat Appl) +(lift (S O) O u3) t2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 u3))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(v3: T).(\lambda (_: T).(pr0 y1 v3))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 +t2)))))))))) (or3_intro2 (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (THead (Flat +Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 (THead (Bind b) u0 t0) t2)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind b) u0 t0) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(eq T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3)) (THead (Bind Abbr) u3 t2)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr0 u1 +u3))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: +T).(pr0 z1 t2)))))) (ex6_6 B T T T T T (\lambda (b0: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b0 Abst)))))))) (\lambda (b0: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind b) u0 t0) (THead +(Bind b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (v3: T).(\lambda (t2: T).(eq T (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (THead (Bind b0) v3 (THead (Flat +Appl) (lift (S O) O u3) t2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (u3: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 u3))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(v3: T).(\lambda (_: T).(pr0 y1 v3))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 +t2)))))))) (ex6_6_intro B T T T T T (\lambda (b0: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b0 +Abst)))))))) (\lambda (b0: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind b) u0 t0) (THead (Bind +b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(u3: T).(\lambda (v3: T).(\lambda (t2: T).(eq T (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t3)) (THead (Bind b0) v3 (THead (Flat Appl) +(lift (S O) O u3) t2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 u3))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(v3: T).(\lambda (_: T).(pr0 y1 v3))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 +t2))))))) b u0 t0 v2 u2 t3 H1 (refl_equal T (THead (Bind b) u0 t0)) +(refl_equal T (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3))) +H12 H3 H6)) t1 H10)))))) H9)) x H5))))))))))))))))) (\lambda (H0: (pr0 (THead +(Flat Appl) u1 t1) x)).(\lambda (u0: T).(\lambda (u2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (w: T).(\lambda (H3: (eq T (THead (Bind Abbr) u0 +t0) (THead (Flat Appl) u1 t1))).(\lambda (H4: (eq T (THead (Bind Abbr) u2 w) +x)).(\lambda (_: (pr0 u0 u2)).(\lambda (_: (pr0 t0 t3)).(\lambda (_: (subst0 +O u2 t3 w)).(let H6 \def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat +Appl) u1 t1) t)) H0 (THead (Bind Abbr) u2 w) H4) in (let H7 \def (eq_ind_r T +x (\lambda (t: T).(pr0 (THead (Flat Appl) u1 t1) t)) H (THead (Bind Abbr) u2 +w) H4) in (eq_ind T (THead (Bind Abbr) u2 w) (\lambda (t: T).(or3 (ex3_2 T T +(\lambda (u3: T).(\lambda (t2: T).(eq T t (THead (Flat Appl) u3 t2)))) +(\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t2: +T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(eq T t (THead (Bind +Abbr) u3 t2)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(_: T).(pr0 u1 u3))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(u3: T).(\lambda (v2: T).(\lambda (t2: T).(eq T t (THead (Bind b) v2 (THead +(Flat Appl) (lift (S O) O u3) t2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 +u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t2: T).(pr0 z1 t2)))))))))) (let H8 \def (eq_ind T (THead (Bind Abbr) u0 t0) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | +(Flat _) \Rightarrow False])])) I (THead (Flat Appl) u1 t1) H3) in (False_ind +(or3 (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead (Bind Abbr) u2 +w) (THead (Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 +u3))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (t2: T).(eq T (THead (Bind Abbr) u2 w) (THead (Bind Abbr) u3 +t2)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: +T).(pr0 u1 u3))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(v2: T).(\lambda (t2: T).(eq T (THead (Bind Abbr) u2 w) (THead (Bind b) v2 +(THead (Flat Appl) (lift (S O) O u3) t2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 +u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t2: T).(pr0 z1 t2))))))))) H8)) x H4)))))))))))))) (\lambda (_: (pr0 (THead +(Flat Appl) u1 t1) x)).(\lambda (b: B).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (u: T).(\lambda (H2: (eq T (THead (Bind b) u (lift (S O) O t0)) +(THead (Flat Appl) u1 t1))).(\lambda (H3: (eq T t3 x)).(\lambda (_: (not (eq +B b Abst))).(\lambda (H4: (pr0 t0 t3)).(let H5 \def (eq_ind T t3 (\lambda (t: +T).(pr0 t0 t)) H4 x H3) in (let H6 \def (eq_ind T (THead (Bind b) u (lift (S +O) O t0)) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat Appl) u1 +t1) H2) in (False_ind (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T +x (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Abbr) u2 t2)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T +(\lambda (b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b0 Abst)))))))) (\lambda (b0: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t2: T).(eq T x (THead (Bind +b0) v2 (THead (Flat Appl) (lift (S O) O u2) t2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda +(_: T).(pr0 u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (t2: T).(pr0 z1 t2))))))))) H6)))))))))))) (\lambda (_: (pr0 +(THead (Flat Appl) u1 t1) x)).(\lambda (t0: T).(\lambda (t3: T).(\lambda (u: +T).(\lambda (H1: (eq T (THead (Flat Cast) u t0) (THead (Flat Appl) u1 +t1))).(\lambda (H2: (eq T t3 x)).(\lambda (H3: (pr0 t0 t3)).(let H4 \def +(eq_ind T t3 (\lambda (t: T).(pr0 t0 t)) H3 x H2) in (let H5 \def (eq_ind T +(THead (Flat Cast) u t0) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat f) \Rightarrow (match f in F return +(\lambda (_: F).Prop) with [Appl \Rightarrow False | Cast \Rightarrow +True])])])) I (THead (Flat Appl) u1 t1) H1) in (False_ind (or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Flat Appl) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: +T).(pr0 t1 t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind +Abbr) u2 t2)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t2: T).(pr0 z1 t2)))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (v2: T).(\lambda (t2: T).(eq T x (THead (Bind b) v2 (THead +(Flat Appl) (lift (S O) O u2) t2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t2: T).(pr0 z1 t2))))))))) H5)))))))))) H)))). + +theorem pr0_gen_cast: + \forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr0 (THead (Flat Cast) u1 +t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead +(Flat Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda +(_: T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 x))))) +\def + \lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda (H: (pr0 (THead +(Flat Cast) u1 t1) x)).(pr0_inv_coq (THead (Flat Cast) u1 t1) x (\lambda (_: +T).(\lambda (t0: T).(or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T t0 +(THead (Flat Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 t0)))) (\lambda (H0: +(pr0 (THead (Flat Cast) u1 t1) x)).(\lambda (t: T).(\lambda (H1: (eq T t +(THead (Flat Cast) u1 t1))).(\lambda (H2: (eq T t x)).(let H3 \def (eq_ind T +t (\lambda (t0: T).(eq T t0 (THead (Flat Cast) u1 t1))) H1 x H2) in (let H4 +\def (eq_ind T x (\lambda (t0: T).(pr0 (THead (Flat Cast) u1 t1) t0)) H0 +(THead (Flat Cast) u1 t1) H3) in (let H5 \def (eq_ind T x (\lambda (t0: +T).(pr0 (THead (Flat Cast) u1 t1) t0)) H (THead (Flat Cast) u1 t1) H3) in +(eq_ind_r T (THead (Flat Cast) u1 t1) (\lambda (t0: T).(or (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T t0 (THead (Flat Cast) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: +T).(pr0 t1 t2)))) (pr0 t1 t0))) (or_introl (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T (THead (Flat Cast) u1 t1) (THead (Flat Cast) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 (THead (Flat Cast) u1 t1)) +(ex3_2_intro T T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead (Flat Cast) +u1 t1) (THead (Flat Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 +u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2))) u1 t1 (refl_equal T +(THead (Flat Cast) u1 t1)) (pr0_refl u1) (pr0_refl t1))) x H3)))))))) +(\lambda (H0: (pr0 (THead (Flat Cast) u1 t1) x)).(\lambda (u0: T).(\lambda +(u2: T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (k: K).(\lambda (H2: (eq T +(THead k u0 t0) (THead (Flat Cast) u1 t1))).(\lambda (H3: (eq T (THead k u2 +t3) x)).(\lambda (H1: (pr0 u0 u2)).(\lambda (H4: (pr0 t0 t3)).(let H5 \def +(eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat Cast) u1 t1) t)) H0 (THead k +u2 t3) H3) in (let H6 \def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat +Cast) u1 t1) t)) H (THead k u2 t3) H3) in (eq_ind T (THead k u2 t3) (\lambda +(t: T).(or (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T t (THead (Flat +Cast) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 t))) (let H7 \def (f_equal T K +(\lambda (e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) +\Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) \Rightarrow k0])) +(THead k u0 t0) (THead (Flat Cast) u1 t1) H2) in ((let H8 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t _) \Rightarrow t])) +(THead k u0 t0) (THead (Flat Cast) u1 t1) H2) in ((let H9 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t) \Rightarrow t])) +(THead k u0 t0) (THead (Flat Cast) u1 t1) H2) in (\lambda (H10: (eq T u0 +u1)).(\lambda (H11: (eq K k (Flat Cast))).(let H12 \def (eq_ind K k (\lambda +(k0: K).(pr0 (THead (Flat Cast) u1 t1) (THead k0 u2 t3))) H6 (Flat Cast) H11) +in (let H13 \def (eq_ind K k (\lambda (k0: K).(pr0 (THead (Flat Cast) u1 t1) +(THead k0 u2 t3))) H5 (Flat Cast) H11) in (eq_ind_r K (Flat Cast) (\lambda +(k0: K).(or (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead k0 u2 +t3) (THead (Flat Cast) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 +u3))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 (THead k0 u2 +t3)))) (let H14 \def (eq_ind T t0 (\lambda (t: T).(pr0 t t3)) H4 t1 H9) in +(let H15 \def (eq_ind T u0 (\lambda (t: T).(pr0 t u2)) H1 u1 H10) in +(or_introl (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead (Flat +Cast) u2 t3) (THead (Flat Cast) u3 t2)))) (\lambda (u3: T).(\lambda (_: +T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 +(THead (Flat Cast) u2 t3)) (ex3_2_intro T T (\lambda (u3: T).(\lambda (t2: +T).(eq T (THead (Flat Cast) u2 t3) (THead (Flat Cast) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 +t2))) u2 t3 (refl_equal T (THead (Flat Cast) u2 t3)) H15 H14)))) k H11)))))) +H8)) H7)) x H3))))))))))))) (\lambda (H0: (pr0 (THead (Flat Cast) u1 t1) +x)).(\lambda (u: T).(\lambda (v1: T).(\lambda (v2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (H2: (eq T (THead (Flat Appl) v1 (THead (Bind +Abst) u t0)) (THead (Flat Cast) u1 t1))).(\lambda (H3: (eq T (THead (Bind +Abbr) v2 t3) x)).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (pr0 t0 t3)).(let H5 +\def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat Cast) u1 t1) t)) H0 +(THead (Bind Abbr) v2 t3) H3) in (let H6 \def (eq_ind_r T x (\lambda (t: +T).(pr0 (THead (Flat Cast) u1 t1) t)) H (THead (Bind Abbr) v2 t3) H3) in +(eq_ind T (THead (Bind Abbr) v2 t3) (\lambda (t: T).(or (ex3_2 T T (\lambda +(u2: T).(\lambda (t2: T).(eq T t (THead (Flat Cast) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 +t2)))) (pr0 t1 t))) (let H7 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind +Abst) u t0)) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ +_) \Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat f) \Rightarrow (match f in F return (\lambda (_: +F).Prop) with [Appl \Rightarrow True | Cast \Rightarrow False])])])) I (THead +(Flat Cast) u1 t1) H2) in (False_ind (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T (THead (Bind Abbr) v2 t3) (THead (Flat Cast) u2 t2)))) (\lambda +(u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 +t1 t2)))) (pr0 t1 (THead (Bind Abbr) v2 t3))) H7)) x H3))))))))))))) (\lambda +(H0: (pr0 (THead (Flat Cast) u1 t1) x)).(\lambda (b: B).(\lambda (v1: +T).(\lambda (v2: T).(\lambda (u0: T).(\lambda (u2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (H4: (eq T (THead (Flat Appl) v1 (THead (Bind b) +u0 t0)) (THead (Flat Cast) u1 t1))).(\lambda (H5: (eq T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3)) x)).(\lambda (_: (not (eq B b +Abst))).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (pr0 u0 u2)).(\lambda (_: (pr0 +t0 t3)).(let H7 \def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat Cast) u1 +t1) t)) H0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) H5) +in (let H8 \def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat Cast) u1 t1) +t)) H (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) H5) in +(eq_ind T (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) +(\lambda (t: T).(or (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T t +(THead (Flat Cast) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) +(\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 t))) (let H9 \def +(eq_ind T (THead (Flat Appl) v1 (THead (Bind b) u0 t0)) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat f) +\Rightarrow (match f in F return (\lambda (_: F).Prop) with [Appl \Rightarrow +True | Cast \Rightarrow False])])])) I (THead (Flat Cast) u1 t1) H4) in +(False_ind (or (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (THead (Flat Cast) u3 +t2)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t3)))) H9)) x H5))))))))))))))))) (\lambda (H0: (pr0 +(THead (Flat Cast) u1 t1) x)).(\lambda (u0: T).(\lambda (u2: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (w: T).(\lambda (H3: (eq T (THead (Bind Abbr) u0 +t0) (THead (Flat Cast) u1 t1))).(\lambda (H4: (eq T (THead (Bind Abbr) u2 w) +x)).(\lambda (_: (pr0 u0 u2)).(\lambda (_: (pr0 t0 t3)).(\lambda (_: (subst0 +O u2 t3 w)).(let H6 \def (eq_ind_r T x (\lambda (t: T).(pr0 (THead (Flat +Cast) u1 t1) t)) H0 (THead (Bind Abbr) u2 w) H4) in (let H7 \def (eq_ind_r T +x (\lambda (t: T).(pr0 (THead (Flat Cast) u1 t1) t)) H (THead (Bind Abbr) u2 +w) H4) in (eq_ind T (THead (Bind Abbr) u2 w) (\lambda (t: T).(or (ex3_2 T T +(\lambda (u3: T).(\lambda (t2: T).(eq T t (THead (Flat Cast) u3 t2)))) +(\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t2: +T).(pr0 t1 t2)))) (pr0 t1 t))) (let H8 \def (eq_ind T (THead (Bind Abbr) u0 +t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat Cast) u1 +t1) H3) in (False_ind (or (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T +(THead (Bind Abbr) u2 w) (THead (Flat Cast) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 +t2)))) (pr0 t1 (THead (Bind Abbr) u2 w))) H8)) x H4)))))))))))))) (\lambda +(_: (pr0 (THead (Flat Cast) u1 t1) x)).(\lambda (b: B).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (u: T).(\lambda (H2: (eq T (THead (Bind b) u +(lift (S O) O t0)) (THead (Flat Cast) u1 t1))).(\lambda (H3: (eq T t3 +x)).(\lambda (_: (not (eq B b Abst))).(\lambda (H4: (pr0 t0 t3)).(let H5 \def +(eq_ind T t3 (\lambda (t: T).(pr0 t0 t)) H4 x H3) in (let H6 \def (eq_ind T +(THead (Bind b) u (lift (S O) O t0)) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow True | (Flat _) \Rightarrow +False])])) I (THead (Flat Cast) u1 t1) H2) in (False_ind (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Flat Cast) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: +T).(pr0 t1 t2)))) (pr0 t1 x)) H6)))))))))))) (\lambda (_: (pr0 (THead (Flat +Cast) u1 t1) x)).(\lambda (t0: T).(\lambda (t3: T).(\lambda (u: T).(\lambda +(H1: (eq T (THead (Flat Cast) u t0) (THead (Flat Cast) u1 t1))).(\lambda (H2: +(eq T t3 x)).(\lambda (H3: (pr0 t0 t3)).(let H4 \def (eq_ind T t3 (\lambda +(t: T).(pr0 t0 t)) H3 x H2) in (let H5 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u | +(TLRef _) \Rightarrow u | (THead _ t _) \Rightarrow t])) (THead (Flat Cast) u +t0) (THead (Flat Cast) u1 t1) H1) in ((let H6 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | +(TLRef _) \Rightarrow t0 | (THead _ _ t) \Rightarrow t])) (THead (Flat Cast) +u t0) (THead (Flat Cast) u1 t1) H1) in (\lambda (_: (eq T u u1)).(let H8 \def +(eq_ind T t0 (\lambda (t: T).(pr0 t x)) H4 t1 H6) in (or_intror (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Flat Cast) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: +T).(pr0 t1 t2)))) (pr0 t1 x) H8)))) H5)))))))))) H)))). + +theorem pr0_gen_abbr: + \forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr0 (THead (Bind Abbr) u1 +t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead +(Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda +(u2: T).(\lambda (t2: T).(or (pr0 t1 t2) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u2 y t2))))))) (pr0 t1 (lift (S O) O x)))))) +\def + \lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda (H: (pr0 (THead +(Bind Abbr) u1 t1) x)).(let H0 \def (match H in pr0 return (\lambda (t: +T).(\lambda (t0: T).(\lambda (_: (pr0 t t0)).((eq T t (THead (Bind Abbr) u1 +t1)) \to ((eq T t0 x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 +u1 u2))) (\lambda (u2: T).(\lambda (t2: T).(or (pr0 t1 t2) (ex2 T (\lambda +(y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u2 y t2))))))) (pr0 t1 (lift (S +O) O x)))))))) with [(pr0_refl t) \Rightarrow (\lambda (H0: (eq T t (THead +(Bind Abbr) u1 t1))).(\lambda (H1: (eq T t x)).(eq_ind T (THead (Bind Abbr) +u1 t1) (\lambda (t0: T).((eq T t0 x) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T x (THead (Bind Abbr) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t2: T).(or (pr0 +t1 t2) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u2 y +t2))))))) (pr0 t1 (lift (S O) O x))))) (\lambda (H2: (eq T (THead (Bind Abbr) +u1 t1) x)).(eq_ind T (THead (Bind Abbr) u1 t1) (\lambda (t0: T).(or (ex3_2 T +T (\lambda (u2: T).(\lambda (t2: T).(eq T t0 (THead (Bind Abbr) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t2: +T).(or (pr0 t1 t2) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 +O u2 y t2))))))) (pr0 t1 (lift (S O) O t0)))) (or_introl (ex3_2 T T (\lambda +(u2: T).(\lambda (t2: T).(eq T (THead (Bind Abbr) u1 t1) (THead (Bind Abbr) +u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: +T).(\lambda (t2: T).(or (pr0 t1 t2) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u2 y t2))))))) (pr0 t1 (lift (S O) O (THead (Bind +Abbr) u1 t1))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t2: T).(eq T +(THead (Bind Abbr) u1 t1) (THead (Bind Abbr) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t2: T).(or (pr0 +t1 t2) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u2 y +t2)))))) u1 t1 (refl_equal T (THead (Bind Abbr) u1 t1)) (pr0_refl u1) +(or_introl (pr0 t1 t1) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: +T).(subst0 O u1 y t1))) (pr0_refl t1)))) x H2)) t (sym_eq T t (THead (Bind +Abbr) u1 t1) H0) H1))) | (pr0_comp u0 u2 H0 t0 t2 H1 k) \Rightarrow (\lambda +(H2: (eq T (THead k u0 t0) (THead (Bind Abbr) u1 t1))).(\lambda (H3: (eq T +(THead k u2 t2) x)).((let H4 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) +\Rightarrow t0 | (THead _ _ t) \Rightarrow t])) (THead k u0 t0) (THead (Bind +Abbr) u1 t1) H2) in ((let H5 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) +\Rightarrow u0 | (THead _ t _) \Rightarrow t])) (THead k u0 t0) (THead (Bind +Abbr) u1 t1) H2) in ((let H6 \def (f_equal T K (\lambda (e: T).(match e in T +return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k u0 t0) (THead (Bind +Abbr) u1 t1) H2) in (eq_ind K (Bind Abbr) (\lambda (k0: K).((eq T u0 u1) \to +((eq T t0 t1) \to ((eq T (THead k0 u2 t2) x) \to ((pr0 u0 u2) \to ((pr0 t0 +t2) \to (or (ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (u3: +T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u3 y t3))))))) (pr0 t1 (lift (S O) O x))))))))) +(\lambda (H7: (eq T u0 u1)).(eq_ind T u1 (\lambda (t: T).((eq T t0 t1) \to +((eq T (THead (Bind Abbr) u2 t2) x) \to ((pr0 t u2) \to ((pr0 t0 t2) \to (or +(ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u3 +t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (u3: +T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u3 y t3))))))) (pr0 t1 (lift (S O) O x)))))))) +(\lambda (H8: (eq T t0 t1)).(eq_ind T t1 (\lambda (t: T).((eq T (THead (Bind +Abbr) u2 t2) x) \to ((pr0 u1 u2) \to ((pr0 t t2) \to (or (ex3_2 T T (\lambda +(u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u3 t3)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (u3: T).(\lambda (t3: T).(or (pr0 +t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u3 y +t3))))))) (pr0 t1 (lift (S O) O x))))))) (\lambda (H9: (eq T (THead (Bind +Abbr) u2 t2) x)).(eq_ind T (THead (Bind Abbr) u2 t2) (\lambda (t: T).((pr0 u1 +u2) \to ((pr0 t1 t2) \to (or (ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq +T t (THead (Bind Abbr) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 +u3))) (\lambda (u3: T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: +T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u3 y t3))))))) (pr0 t1 (lift (S O) O +t)))))) (\lambda (H10: (pr0 u1 u2)).(\lambda (H11: (pr0 t1 t2)).(or_introl +(ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T (THead (Bind Abbr) u2 t2) +(THead (Bind Abbr) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) +(\lambda (u3: T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 +t1 y)) (\lambda (y: T).(subst0 O u3 y t3))))))) (pr0 t1 (lift (S O) O (THead +(Bind Abbr) u2 t2))) (ex3_2_intro T T (\lambda (u3: T).(\lambda (t3: T).(eq T +(THead (Bind Abbr) u2 t2) (THead (Bind Abbr) u3 t3)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (u3: T).(\lambda (t3: T).(or (pr0 +t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u3 y +t3)))))) u2 t2 (refl_equal T (THead (Bind Abbr) u2 t2)) H10 (or_introl (pr0 +t1 t2) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u2 y +t2))) H11))))) x H9)) t0 (sym_eq T t0 t1 H8))) u0 (sym_eq T u0 u1 H7))) k +(sym_eq K k (Bind Abbr) H6))) H5)) H4)) H3 H0 H1))) | (pr0_beta u v1 v2 H0 t0 +t2 H1) \Rightarrow (\lambda (H2: (eq T (THead (Flat Appl) v1 (THead (Bind +Abst) u t0)) (THead (Bind Abbr) u1 t1))).(\lambda (H3: (eq T (THead (Bind +Abbr) v2 t2) x)).((let H4 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind +Abst) u t0)) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind Abbr) u1 +t1) H2) in (False_ind ((eq T (THead (Bind Abbr) v2 t2) x) \to ((pr0 v1 v2) +\to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (u2: T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 +t1 y)) (\lambda (y: T).(subst0 O u2 y t3))))))) (pr0 t1 (lift (S O) O x)))))) +H4)) H3 H0 H1))) | (pr0_upsilon b H0 v1 v2 H1 u0 u2 H2 t0 t2 H3) \Rightarrow +(\lambda (H4: (eq T (THead (Flat Appl) v1 (THead (Bind b) u0 t0)) (THead +(Bind Abbr) u1 t1))).(\lambda (H5: (eq T (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t2)) x)).((let H6 \def (eq_ind T (THead (Flat Appl) +v1 (THead (Bind b) u0 t0)) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind +Abbr) u1 t1) H4) in (False_ind ((eq T (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t2)) x) \to ((not (eq B b Abst)) \to ((pr0 v1 v2) \to ((pr0 +u0 u2) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u3: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 +u1 u3))) (\lambda (u3: T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda +(y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u3 y t3))))))) (pr0 t1 (lift (S +O) O x)))))))) H6)) H5 H0 H1 H2 H3))) | (pr0_delta u0 u2 H0 t0 t2 H1 w H2) +\Rightarrow (\lambda (H3: (eq T (THead (Bind Abbr) u0 t0) (THead (Bind Abbr) +u1 t1))).(\lambda (H4: (eq T (THead (Bind Abbr) u2 w) x)).((let H5 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t) +\Rightarrow t])) (THead (Bind Abbr) u0 t0) (THead (Bind Abbr) u1 t1) H3) in +((let H6 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t +_) \Rightarrow t])) (THead (Bind Abbr) u0 t0) (THead (Bind Abbr) u1 t1) H3) +in (eq_ind T u1 (\lambda (t: T).((eq T t0 t1) \to ((eq T (THead (Bind Abbr) +u2 w) x) \to ((pr0 t u2) \to ((pr0 t0 t2) \to ((subst0 O u2 t2 w) \to (or +(ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u3 +t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (u3: +T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u3 y t3))))))) (pr0 t1 (lift (S O) O x))))))))) +(\lambda (H7: (eq T t0 t1)).(eq_ind T t1 (\lambda (t: T).((eq T (THead (Bind +Abbr) u2 w) x) \to ((pr0 u1 u2) \to ((pr0 t t2) \to ((subst0 O u2 t2 w) \to +(or (ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) +u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (u3: +T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u3 y t3))))))) (pr0 t1 (lift (S O) O x)))))))) +(\lambda (H8: (eq T (THead (Bind Abbr) u2 w) x)).(eq_ind T (THead (Bind Abbr) +u2 w) (\lambda (t: T).((pr0 u1 u2) \to ((pr0 t1 t2) \to ((subst0 O u2 t2 w) +\to (or (ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T t (THead (Bind +Abbr) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (u3: +T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u3 y t3))))))) (pr0 t1 (lift (S O) O t))))))) +(\lambda (H9: (pr0 u1 u2)).(\lambda (H10: (pr0 t1 t2)).(\lambda (H11: (subst0 +O u2 t2 w)).(or_introl (ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T +(THead (Bind Abbr) u2 w) (THead (Bind Abbr) u3 t3)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (u3: T).(\lambda (t3: T).(or (pr0 +t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u3 y +t3))))))) (pr0 t1 (lift (S O) O (THead (Bind Abbr) u2 w))) (ex3_2_intro T T +(\lambda (u3: T).(\lambda (t3: T).(eq T (THead (Bind Abbr) u2 w) (THead (Bind +Abbr) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (u3: +T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u3 y t3)))))) u2 w (refl_equal T (THead (Bind Abbr) +u2 w)) H9 (or_intror (pr0 t1 w) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda +(y: T).(subst0 O u2 y w))) (ex_intro2 T (\lambda (y: T).(pr0 t1 y)) (\lambda +(y: T).(subst0 O u2 y w)) t2 H10 H11))))))) x H8)) t0 (sym_eq T t0 t1 H7))) +u0 (sym_eq T u0 u1 H6))) H5)) H4 H0 H1 H2))) | (pr0_zeta b H0 t0 t2 H1 u) +\Rightarrow (\lambda (H2: (eq T (THead (Bind b) u (lift (S O) O t0)) (THead +(Bind Abbr) u1 t1))).(\lambda (H3: (eq T t2 x)).((let H4 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t: T) on t: T +\def (match t with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k u0 t3) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t3))]) in lref_map) (\lambda (x0: nat).(plus x0 (S O))) O t0) | (TLRef _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t: T) on t: T +\def (match t with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k u0 t3) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t3))]) in lref_map) (\lambda (x0: nat).(plus x0 (S O))) O t0) | (THead _ _ t) +\Rightarrow t])) (THead (Bind b) u (lift (S O) O t0)) (THead (Bind Abbr) u1 +t1) H2) in ((let H5 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | +(THead _ t _) \Rightarrow t])) (THead (Bind b) u (lift (S O) O t0)) (THead +(Bind Abbr) u1 t1) H2) in ((let H6 \def (f_equal T B (\lambda (e: T).(match e +in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b | (TLRef _) +\Rightarrow b | (THead k _ _) \Rightarrow (match k in K return (\lambda (_: +K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow b])])) (THead +(Bind b) u (lift (S O) O t0)) (THead (Bind Abbr) u1 t1) H2) in (eq_ind B Abbr +(\lambda (b0: B).((eq T u u1) \to ((eq T (lift (S O) O t0) t1) \to ((eq T t2 +x) \to ((not (eq B b0 Abst)) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t3: T).(or (pr0 +t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u2 y +t3))))))) (pr0 t1 (lift (S O) O x))))))))) (\lambda (H7: (eq T u u1)).(eq_ind +T u1 (\lambda (_: T).((eq T (lift (S O) O t0) t1) \to ((eq T t2 x) \to ((not +(eq B Abbr Abst)) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t3: T).(or (pr0 +t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u2 y +t3))))))) (pr0 t1 (lift (S O) O x)))))))) (\lambda (H8: (eq T (lift (S O) O +t0) t1)).(eq_ind T (lift (S O) O t0) (\lambda (t: T).((eq T t2 x) \to ((not +(eq B Abbr Abst)) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t3: T).(or (pr0 t +t3) (ex2 T (\lambda (y: T).(pr0 t y)) (\lambda (y: T).(subst0 O u2 y +t3))))))) (pr0 t (lift (S O) O x))))))) (\lambda (H9: (eq T t2 x)).(eq_ind T +x (\lambda (t: T).((not (eq B Abbr Abst)) \to ((pr0 t0 t) \to (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t3: +T).(or (pr0 (lift (S O) O t0) t3) (ex2 T (\lambda (y: T).(pr0 (lift (S O) O +t0) y)) (\lambda (y: T).(subst0 O u2 y t3))))))) (pr0 (lift (S O) O t0) (lift +(S O) O x)))))) (\lambda (_: (not (eq B Abbr Abst))).(\lambda (H11: (pr0 t0 +x)).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead +(Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda +(u2: T).(\lambda (t3: T).(or (pr0 (lift (S O) O t0) t3) (ex2 T (\lambda (y: +T).(pr0 (lift (S O) O t0) y)) (\lambda (y: T).(subst0 O u2 y t3))))))) (pr0 +(lift (S O) O t0) (lift (S O) O x)) (pr0_lift t0 x H11 (S O) O)))) t2 (sym_eq +T t2 x H9))) t1 H8)) u (sym_eq T u u1 H7))) b (sym_eq B b Abbr H6))) H5)) +H4)) H3 H0 H1))) | (pr0_epsilon t0 t2 H0 u) \Rightarrow (\lambda (H1: (eq T +(THead (Flat Cast) u t0) (THead (Bind Abbr) u1 t1))).(\lambda (H2: (eq T t2 +x)).((let H3 \def (eq_ind T (THead (Flat Cast) u t0) (\lambda (e: T).(match e +in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef +_) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind Abbr) u1 t1) H1) in (False_ind ((eq T t2 x) \to +((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (u2: T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 +t1 y)) (\lambda (y: T).(subst0 O u2 y t3))))))) (pr0 t1 (lift (S O) O x))))) +H3)) H2 H0)))]) in (H0 (refl_equal T (THead (Bind Abbr) u1 t1)) (refl_equal T +x)))))). + +theorem pr0_gen_void: + \forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr0 (THead (Bind Void) u1 +t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead +(Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda +(_: T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 (lift (S O) O x)))))) +\def + \lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda (H: (pr0 (THead +(Bind Void) u1 t1) x)).(let H0 \def (match H in pr0 return (\lambda (t: +T).(\lambda (t0: T).(\lambda (_: (pr0 t t0)).((eq T t (THead (Bind Void) u1 +t1)) \to ((eq T t0 x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 +u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 (lift (S O) +O x)))))))) with [(pr0_refl t) \Rightarrow (\lambda (H0: (eq T t (THead (Bind +Void) u1 t1))).(\lambda (H1: (eq T t x)).(eq_ind T (THead (Bind Void) u1 t1) +(\lambda (t0: T).((eq T t0 x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 +(lift (S O) O x))))) (\lambda (H2: (eq T (THead (Bind Void) u1 t1) +x)).(eq_ind T (THead (Bind Void) u1 t1) (\lambda (t0: T).(or (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T t0 (THead (Bind Void) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: +T).(pr0 t1 t2)))) (pr0 t1 (lift (S O) O t0)))) (or_introl (ex3_2 T T (\lambda +(u2: T).(\lambda (t2: T).(eq T (THead (Bind Void) u1 t1) (THead (Bind Void) +u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr0 t1 t2)))) (pr0 t1 (lift (S O) O (THead (Bind Void) +u1 t1))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead +(Bind Void) u1 t1) (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr0 t1 t2))) u1 t1 +(refl_equal T (THead (Bind Void) u1 t1)) (pr0_refl u1) (pr0_refl t1))) x H2)) +t (sym_eq T t (THead (Bind Void) u1 t1) H0) H1))) | (pr0_comp u0 u2 H0 t0 t2 +H1 k) \Rightarrow (\lambda (H2: (eq T (THead k u0 t0) (THead (Bind Void) u1 +t1))).(\lambda (H3: (eq T (THead k u2 t2) x)).((let H4 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t) \Rightarrow t])) +(THead k u0 t0) (THead (Bind Void) u1 t1) H2) in ((let H5 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t _) \Rightarrow t])) +(THead k u0 t0) (THead (Bind Void) u1 t1) H2) in ((let H6 \def (f_equal T K +(\lambda (e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) +\Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) \Rightarrow k0])) +(THead k u0 t0) (THead (Bind Void) u1 t1) H2) in (eq_ind K (Bind Void) +(\lambda (k0: K).((eq T u0 u1) \to ((eq T t0 t1) \to ((eq T (THead k0 u2 t2) +x) \to ((pr0 u0 u2) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u3: +T).(\lambda (t3: T).(eq T x (THead (Bind Void) u3 t3)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3)))) (pr0 t1 (lift (S O) O x))))))))) (\lambda (H7: (eq T u0 u1)).(eq_ind T +u1 (\lambda (t: T).((eq T t0 t1) \to ((eq T (THead (Bind Void) u2 t2) x) \to +((pr0 t u2) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u3: T).(\lambda +(t3: T).(eq T x (THead (Bind Void) u3 t3)))) (\lambda (u3: T).(\lambda (_: +T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3)))) (pr0 t1 +(lift (S O) O x)))))))) (\lambda (H8: (eq T t0 t1)).(eq_ind T t1 (\lambda (t: +T).((eq T (THead (Bind Void) u2 t2) x) \to ((pr0 u1 u2) \to ((pr0 t t2) \to +(or (ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T x (THead (Bind Void) +u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: +T).(\lambda (t3: T).(pr0 t1 t3)))) (pr0 t1 (lift (S O) O x))))))) (\lambda +(H9: (eq T (THead (Bind Void) u2 t2) x)).(eq_ind T (THead (Bind Void) u2 t2) +(\lambda (t: T).((pr0 u1 u2) \to ((pr0 t1 t2) \to (or (ex3_2 T T (\lambda +(u3: T).(\lambda (t3: T).(eq T t (THead (Bind Void) u3 t3)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3)))) (pr0 t1 (lift (S O) O t)))))) (\lambda (H10: (pr0 u1 u2)).(\lambda +(H11: (pr0 t1 t2)).(or_introl (ex3_2 T T (\lambda (u3: T).(\lambda (t3: +T).(eq T (THead (Bind Void) u2 t2) (THead (Bind Void) u3 t3)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3)))) (pr0 t1 (lift (S O) O (THead (Bind Void) u2 t2))) (ex3_2_intro T T +(\lambda (u3: T).(\lambda (t3: T).(eq T (THead (Bind Void) u2 t2) (THead +(Bind Void) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 u1 u3))) (\lambda +(_: T).(\lambda (t3: T).(pr0 t1 t3))) u2 t2 (refl_equal T (THead (Bind Void) +u2 t2)) H10 H11)))) x H9)) t0 (sym_eq T t0 t1 H8))) u0 (sym_eq T u0 u1 H7))) +k (sym_eq K k (Bind Void) H6))) H5)) H4)) H3 H0 H1))) | (pr0_beta u v1 v2 H0 +t0 t2 H1) \Rightarrow (\lambda (H2: (eq T (THead (Flat Appl) v1 (THead (Bind +Abst) u t0)) (THead (Bind Void) u1 t1))).(\lambda (H3: (eq T (THead (Bind +Abbr) v2 t2) x)).((let H4 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind +Abst) u t0)) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind Void) u1 +t1) H2) in (False_ind ((eq T (THead (Bind Abbr) v2 t2) x) \to ((pr0 v1 v2) +\to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3)))) (pr0 t1 (lift (S O) O x)))))) +H4)) H3 H0 H1))) | (pr0_upsilon b H0 v1 v2 H1 u0 u2 H2 t0 t2 H3) \Rightarrow +(\lambda (H4: (eq T (THead (Flat Appl) v1 (THead (Bind b) u0 t0)) (THead +(Bind Void) u1 t1))).(\lambda (H5: (eq T (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t2)) x)).((let H6 \def (eq_ind T (THead (Flat Appl) +v1 (THead (Bind b) u0 t0)) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind +Void) u1 t1) H4) in (False_ind ((eq T (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t2)) x) \to ((not (eq B b Abst)) \to ((pr0 v1 v2) \to ((pr0 +u0 u2) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u3: T).(\lambda (t3: +T).(eq T x (THead (Bind Void) u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(pr0 +u1 u3))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3)))) (pr0 t1 (lift (S O) +O x)))))))) H6)) H5 H0 H1 H2 H3))) | (pr0_delta u0 u2 H0 t0 t2 H1 w H2) +\Rightarrow (\lambda (H3: (eq T (THead (Bind Abbr) u0 t0) (THead (Bind Void) +u1 t1))).(\lambda (H4: (eq T (THead (Bind Abbr) u2 w) x)).((let H5 \def +(eq_ind T (THead (Bind Abbr) u0 t0) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind b) \Rightarrow (match b in B return (\lambda (_: +B).Prop) with [Abbr \Rightarrow True | Abst \Rightarrow False | Void +\Rightarrow False]) | (Flat _) \Rightarrow False])])) I (THead (Bind Void) u1 +t1) H3) in (False_ind ((eq T (THead (Bind Abbr) u2 w) x) \to ((pr0 u0 u2) \to +((pr0 t0 t2) \to ((subst0 O u2 t2 w) \to (or (ex3_2 T T (\lambda (u3: +T).(\lambda (t3: T).(eq T x (THead (Bind Void) u3 t3)))) (\lambda (u3: +T).(\lambda (_: T).(pr0 u1 u3))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3)))) (pr0 t1 (lift (S O) O x))))))) H5)) H4 H0 H1 H2))) | (pr0_zeta b H0 t0 +t2 H1 u) \Rightarrow (\lambda (H2: (eq T (THead (Bind b) u (lift (S O) O t0)) +(THead (Bind Void) u1 t1))).(\lambda (H3: (eq T t2 x)).((let H4 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t: T) on t: T +\def (match t with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k u0 t3) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t3))]) in lref_map) (\lambda (x0: nat).(plus x0 (S O))) O t0) | (TLRef _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t: T) on t: T +\def (match t with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k u0 t3) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t3))]) in lref_map) (\lambda (x0: nat).(plus x0 (S O))) O t0) | (THead _ _ t) +\Rightarrow t])) (THead (Bind b) u (lift (S O) O t0)) (THead (Bind Void) u1 +t1) H2) in ((let H5 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | +(THead _ t _) \Rightarrow t])) (THead (Bind b) u (lift (S O) O t0)) (THead +(Bind Void) u1 t1) H2) in ((let H6 \def (f_equal T B (\lambda (e: T).(match e +in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b | (TLRef _) +\Rightarrow b | (THead k _ _) \Rightarrow (match k in K return (\lambda (_: +K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow b])])) (THead +(Bind b) u (lift (S O) O t0)) (THead (Bind Void) u1 t1) H2) in (eq_ind B Void +(\lambda (b0: B).((eq T u u1) \to ((eq T (lift (S O) O t0) t1) \to ((eq T t2 +x) \to ((not (eq B b0 Abst)) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3)))) (pr0 t1 (lift (S O) O x))))))))) (\lambda (H7: (eq T u u1)).(eq_ind T +u1 (\lambda (_: T).((eq T (lift (S O) O t0) t1) \to ((eq T t2 x) \to ((not +(eq B Void Abst)) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3)))) (pr0 t1 (lift (S O) O x)))))))) (\lambda (H8: (eq T (lift (S O) O t0) +t1)).(eq_ind T (lift (S O) O t0) (\lambda (t: T).((eq T t2 x) \to ((not (eq B +Void Abst)) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t t3)))) (pr0 t (lift +(S O) O x))))))) (\lambda (H9: (eq T t2 x)).(eq_ind T x (\lambda (t: T).((not +(eq B Void Abst)) \to ((pr0 t0 t) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 (lift +(S O) O t0) t3)))) (pr0 (lift (S O) O t0) (lift (S O) O x)))))) (\lambda (_: +(not (eq B Void Abst))).(\lambda (H11: (pr0 t0 x)).(or_intror (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: +T).(pr0 (lift (S O) O t0) t3)))) (pr0 (lift (S O) O t0) (lift (S O) O x)) +(pr0_lift t0 x H11 (S O) O)))) t2 (sym_eq T t2 x H9))) t1 H8)) u (sym_eq T u +u1 H7))) b (sym_eq B b Void H6))) H5)) H4)) H3 H0 H1))) | (pr0_epsilon t0 t2 +H0 u) \Rightarrow (\lambda (H1: (eq T (THead (Flat Cast) u t0) (THead (Bind +Void) u1 t1))).(\lambda (H2: (eq T t2 x)).((let H3 \def (eq_ind T (THead +(Flat Cast) u t0) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ +_) \Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind Void) u1 +t1) H1) in (False_ind ((eq T t2 x) \to ((pr0 t0 t2) \to (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: +T).(pr0 t1 t3)))) (pr0 t1 (lift (S O) O x))))) H3)) H2 H0)))]) in (H0 +(refl_equal T (THead (Bind Void) u1 t1)) (refl_equal T x)))))). + +theorem pr0_gen_lift: + \forall (t1: T).(\forall (x: T).(\forall (h: nat).(\forall (d: nat).((pr0 +(lift h d t1) x) \to (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda +(t2: T).(pr0 t1 t2))))))) +\def + \lambda (t1: T).(\lambda (x: T).(\lambda (h: nat).(\lambda (d: nat).(\lambda +(H: (pr0 (lift h d t1) x)).(insert_eq T (lift h d t1) (\lambda (t: T).(pr0 t +x)) (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(pr0 t1 +t2))) (\lambda (y: T).(\lambda (H0: (pr0 y x)).(unintro nat d (\lambda (n: +nat).((eq T y (lift h n t1)) \to (ex2 T (\lambda (t2: T).(eq T x (lift h n +t2))) (\lambda (t2: T).(pr0 t1 t2))))) (unintro T t1 (\lambda (t: T).(\forall +(x0: nat).((eq T y (lift h x0 t)) \to (ex2 T (\lambda (t2: T).(eq T x (lift h +x0 t2))) (\lambda (t2: T).(pr0 t t2)))))) (pr0_ind (\lambda (t: T).(\lambda +(t0: T).(\forall (x0: T).(\forall (x1: nat).((eq T t (lift h x1 x0)) \to (ex2 +T (\lambda (t2: T).(eq T t0 (lift h x1 t2))) (\lambda (t2: T).(pr0 x0 +t2)))))))) (\lambda (t: T).(\lambda (x0: T).(\lambda (x1: nat).(\lambda (H1: +(eq T t (lift h x1 x0))).(ex_intro2 T (\lambda (t2: T).(eq T t (lift h x1 +t2))) (\lambda (t2: T).(pr0 x0 t2)) x0 H1 (pr0_refl x0)))))) (\lambda (u1: +T).(\lambda (u2: T).(\lambda (_: (pr0 u1 u2)).(\lambda (H2: ((\forall (x0: +T).(\forall (x1: nat).((eq T u1 (lift h x1 x0)) \to (ex2 T (\lambda (t2: +T).(eq T u2 (lift h x1 t2))) (\lambda (t2: T).(pr0 x0 t2)))))))).(\lambda +(t2: T).(\lambda (t3: T).(\lambda (_: (pr0 t2 t3)).(\lambda (H4: ((\forall +(x0: T).(\forall (x1: nat).((eq T t2 (lift h x1 x0)) \to (ex2 T (\lambda (t4: +T).(eq T t3 (lift h x1 t4))) (\lambda (t4: T).(pr0 x0 t4)))))))).(\lambda (k: +K).(\lambda (x0: T).(\lambda (x1: nat).(\lambda (H5: (eq T (THead k u1 t2) +(lift h x1 x0))).(K_ind (\lambda (k0: K).((eq T (THead k0 u1 t2) (lift h x1 +x0)) \to (ex2 T (\lambda (t4: T).(eq T (THead k0 u2 t3) (lift h x1 t4))) +(\lambda (t4: T).(pr0 x0 t4))))) (\lambda (b: B).(\lambda (H6: (eq T (THead +(Bind b) u1 t2) (lift h x1 x0))).(ex3_2_ind T T (\lambda (y0: T).(\lambda (z: +T).(eq T x0 (THead (Bind b) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T +u1 (lift h x1 y0)))) (\lambda (_: T).(\lambda (z: T).(eq T t2 (lift h (S x1) +z)))) (ex2 T (\lambda (t4: T).(eq T (THead (Bind b) u2 t3) (lift h x1 t4))) +(\lambda (t4: T).(pr0 x0 t4))) (\lambda (x2: T).(\lambda (x3: T).(\lambda +(H7: (eq T x0 (THead (Bind b) x2 x3))).(\lambda (H8: (eq T u1 (lift h x1 +x2))).(\lambda (H9: (eq T t2 (lift h (S x1) x3))).(eq_ind_r T (THead (Bind b) +x2 x3) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead (Bind b) u2 t3) +(lift h x1 t4))) (\lambda (t4: T).(pr0 t t4)))) (ex2_ind T (\lambda (t4: +T).(eq T t3 (lift h (S x1) t4))) (\lambda (t4: T).(pr0 x3 t4)) (ex2 T +(\lambda (t4: T).(eq T (THead (Bind b) u2 t3) (lift h x1 t4))) (\lambda (t4: +T).(pr0 (THead (Bind b) x2 x3) t4))) (\lambda (x4: T).(\lambda (H_x: (eq T t3 +(lift h (S x1) x4))).(\lambda (H10: (pr0 x3 x4)).(eq_ind_r T (lift h (S x1) +x4) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead (Bind b) u2 t) (lift +h x1 t4))) (\lambda (t4: T).(pr0 (THead (Bind b) x2 x3) t4)))) (ex2_ind T +(\lambda (t4: T).(eq T u2 (lift h x1 t4))) (\lambda (t4: T).(pr0 x2 t4)) (ex2 +T (\lambda (t4: T).(eq T (THead (Bind b) u2 (lift h (S x1) x4)) (lift h x1 +t4))) (\lambda (t4: T).(pr0 (THead (Bind b) x2 x3) t4))) (\lambda (x5: +T).(\lambda (H_x0: (eq T u2 (lift h x1 x5))).(\lambda (H11: (pr0 x2 +x5)).(eq_ind_r T (lift h x1 x5) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T +(THead (Bind b) t (lift h (S x1) x4)) (lift h x1 t4))) (\lambda (t4: T).(pr0 +(THead (Bind b) x2 x3) t4)))) (ex_intro2 T (\lambda (t4: T).(eq T (THead +(Bind b) (lift h x1 x5) (lift h (S x1) x4)) (lift h x1 t4))) (\lambda (t4: +T).(pr0 (THead (Bind b) x2 x3) t4)) (THead (Bind b) x5 x4) (sym_eq T (lift h +x1 (THead (Bind b) x5 x4)) (THead (Bind b) (lift h x1 x5) (lift h (S x1) x4)) +(lift_bind b x5 x4 h x1)) (pr0_comp x2 x5 H11 x3 x4 H10 (Bind b))) u2 +H_x0)))) (H2 x2 x1 H8)) t3 H_x)))) (H4 x3 (S x1) H9)) x0 H7)))))) +(lift_gen_bind b u1 t2 x0 h x1 H6)))) (\lambda (f: F).(\lambda (H6: (eq T +(THead (Flat f) u1 t2) (lift h x1 x0))).(ex3_2_ind T T (\lambda (y0: +T).(\lambda (z: T).(eq T x0 (THead (Flat f) y0 z)))) (\lambda (y0: +T).(\lambda (_: T).(eq T u1 (lift h x1 y0)))) (\lambda (_: T).(\lambda (z: +T).(eq T t2 (lift h x1 z)))) (ex2 T (\lambda (t4: T).(eq T (THead (Flat f) u2 +t3) (lift h x1 t4))) (\lambda (t4: T).(pr0 x0 t4))) (\lambda (x2: T).(\lambda +(x3: T).(\lambda (H7: (eq T x0 (THead (Flat f) x2 x3))).(\lambda (H8: (eq T +u1 (lift h x1 x2))).(\lambda (H9: (eq T t2 (lift h x1 x3))).(eq_ind_r T +(THead (Flat f) x2 x3) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead +(Flat f) u2 t3) (lift h x1 t4))) (\lambda (t4: T).(pr0 t t4)))) (ex2_ind T +(\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: T).(pr0 x3 t4)) (ex2 +T (\lambda (t4: T).(eq T (THead (Flat f) u2 t3) (lift h x1 t4))) (\lambda +(t4: T).(pr0 (THead (Flat f) x2 x3) t4))) (\lambda (x4: T).(\lambda (H_x: (eq +T t3 (lift h x1 x4))).(\lambda (H10: (pr0 x3 x4)).(eq_ind_r T (lift h x1 x4) +(\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead (Flat f) u2 t) (lift h +x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat f) x2 x3) t4)))) (ex2_ind T +(\lambda (t4: T).(eq T u2 (lift h x1 t4))) (\lambda (t4: T).(pr0 x2 t4)) (ex2 +T (\lambda (t4: T).(eq T (THead (Flat f) u2 (lift h x1 x4)) (lift h x1 t4))) +(\lambda (t4: T).(pr0 (THead (Flat f) x2 x3) t4))) (\lambda (x5: T).(\lambda +(H_x0: (eq T u2 (lift h x1 x5))).(\lambda (H11: (pr0 x2 x5)).(eq_ind_r T +(lift h x1 x5) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead (Flat f) +t (lift h x1 x4)) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat f) x2 +x3) t4)))) (ex_intro2 T (\lambda (t4: T).(eq T (THead (Flat f) (lift h x1 x5) +(lift h x1 x4)) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat f) x2 x3) +t4)) (THead (Flat f) x5 x4) (sym_eq T (lift h x1 (THead (Flat f) x5 x4)) +(THead (Flat f) (lift h x1 x5) (lift h x1 x4)) (lift_flat f x5 x4 h x1)) +(pr0_comp x2 x5 H11 x3 x4 H10 (Flat f))) u2 H_x0)))) (H2 x2 x1 H8)) t3 +H_x)))) (H4 x3 x1 H9)) x0 H7)))))) (lift_gen_flat f u1 t2 x0 h x1 H6)))) k +H5))))))))))))) (\lambda (u: T).(\lambda (v1: T).(\lambda (v2: T).(\lambda +(_: (pr0 v1 v2)).(\lambda (H2: ((\forall (x0: T).(\forall (x1: nat).((eq T v1 +(lift h x1 x0)) \to (ex2 T (\lambda (t2: T).(eq T v2 (lift h x1 t2))) +(\lambda (t2: T).(pr0 x0 t2)))))))).(\lambda (t2: T).(\lambda (t3: +T).(\lambda (_: (pr0 t2 t3)).(\lambda (H4: ((\forall (x0: T).(\forall (x1: +nat).((eq T t2 (lift h x1 x0)) \to (ex2 T (\lambda (t4: T).(eq T t3 (lift h +x1 t4))) (\lambda (t4: T).(pr0 x0 t4)))))))).(\lambda (x0: T).(\lambda (x1: +nat).(\lambda (H5: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t2)) +(lift h x1 x0))).(ex3_2_ind T T (\lambda (y0: T).(\lambda (z: T).(eq T x0 +(THead (Flat Appl) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T v1 (lift h +x1 y0)))) (\lambda (_: T).(\lambda (z: T).(eq T (THead (Bind Abst) u t2) +(lift h x1 z)))) (ex2 T (\lambda (t4: T).(eq T (THead (Bind Abbr) v2 t3) +(lift h x1 t4))) (\lambda (t4: T).(pr0 x0 t4))) (\lambda (x2: T).(\lambda +(x3: T).(\lambda (H6: (eq T x0 (THead (Flat Appl) x2 x3))).(\lambda (H7: (eq +T v1 (lift h x1 x2))).(\lambda (H8: (eq T (THead (Bind Abst) u t2) (lift h x1 +x3))).(eq_ind_r T (THead (Flat Appl) x2 x3) (\lambda (t: T).(ex2 T (\lambda +(t4: T).(eq T (THead (Bind Abbr) v2 t3) (lift h x1 t4))) (\lambda (t4: +T).(pr0 t t4)))) (ex3_2_ind T T (\lambda (y0: T).(\lambda (z: T).(eq T x3 +(THead (Bind Abst) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T u (lift h +x1 y0)))) (\lambda (_: T).(\lambda (z: T).(eq T t2 (lift h (S x1) z)))) (ex2 +T (\lambda (t4: T).(eq T (THead (Bind Abbr) v2 t3) (lift h x1 t4))) (\lambda +(t4: T).(pr0 (THead (Flat Appl) x2 x3) t4))) (\lambda (x4: T).(\lambda (x5: +T).(\lambda (H9: (eq T x3 (THead (Bind Abst) x4 x5))).(\lambda (_: (eq T u +(lift h x1 x4))).(\lambda (H11: (eq T t2 (lift h (S x1) x5))).(eq_ind_r T +(THead (Bind Abst) x4 x5) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T +(THead (Bind Abbr) v2 t3) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat +Appl) x2 t) t4)))) (ex2_ind T (\lambda (t4: T).(eq T t3 (lift h (S x1) t4))) +(\lambda (t4: T).(pr0 x5 t4)) (ex2 T (\lambda (t4: T).(eq T (THead (Bind +Abbr) v2 t3) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat Appl) x2 +(THead (Bind Abst) x4 x5)) t4))) (\lambda (x6: T).(\lambda (H_x: (eq T t3 +(lift h (S x1) x6))).(\lambda (H12: (pr0 x5 x6)).(eq_ind_r T (lift h (S x1) +x6) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead (Bind Abbr) v2 t) +(lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind +Abst) x4 x5)) t4)))) (ex2_ind T (\lambda (t4: T).(eq T v2 (lift h x1 t4))) +(\lambda (t4: T).(pr0 x2 t4)) (ex2 T (\lambda (t4: T).(eq T (THead (Bind +Abbr) v2 (lift h (S x1) x6)) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead +(Flat Appl) x2 (THead (Bind Abst) x4 x5)) t4))) (\lambda (x7: T).(\lambda +(H_x0: (eq T v2 (lift h x1 x7))).(\lambda (H13: (pr0 x2 x7)).(eq_ind_r T +(lift h x1 x7) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead (Bind +Abbr) t (lift h (S x1) x6)) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead +(Flat Appl) x2 (THead (Bind Abst) x4 x5)) t4)))) (ex_intro2 T (\lambda (t4: +T).(eq T (THead (Bind Abbr) (lift h x1 x7) (lift h (S x1) x6)) (lift h x1 +t4))) (\lambda (t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind Abst) x4 x5)) +t4)) (THead (Bind Abbr) x7 x6) (sym_eq T (lift h x1 (THead (Bind Abbr) x7 +x6)) (THead (Bind Abbr) (lift h x1 x7) (lift h (S x1) x6)) (lift_bind Abbr x7 +x6 h x1)) (pr0_beta x4 x2 x7 H13 x5 x6 H12)) v2 H_x0)))) (H2 x2 x1 H7)) t3 +H_x)))) (H4 x5 (S x1) H11)) x3 H9)))))) (lift_gen_bind Abst u t2 x3 h x1 H8)) +x0 H6)))))) (lift_gen_flat Appl v1 (THead (Bind Abst) u t2) x0 h x1 +H5)))))))))))))) (\lambda (b: B).(\lambda (H1: (not (eq B b Abst))).(\lambda +(v1: T).(\lambda (v2: T).(\lambda (_: (pr0 v1 v2)).(\lambda (H3: ((\forall +(x0: T).(\forall (x1: nat).((eq T v1 (lift h x1 x0)) \to (ex2 T (\lambda (t2: +T).(eq T v2 (lift h x1 t2))) (\lambda (t2: T).(pr0 x0 t2)))))))).(\lambda +(u1: T).(\lambda (u2: T).(\lambda (_: (pr0 u1 u2)).(\lambda (H5: ((\forall +(x0: T).(\forall (x1: nat).((eq T u1 (lift h x1 x0)) \to (ex2 T (\lambda (t2: +T).(eq T u2 (lift h x1 t2))) (\lambda (t2: T).(pr0 x0 t2)))))))).(\lambda +(t2: T).(\lambda (t3: T).(\lambda (_: (pr0 t2 t3)).(\lambda (H7: ((\forall +(x0: T).(\forall (x1: nat).((eq T t2 (lift h x1 x0)) \to (ex2 T (\lambda (t4: +T).(eq T t3 (lift h x1 t4))) (\lambda (t4: T).(pr0 x0 t4)))))))).(\lambda +(x0: T).(\lambda (x1: nat).(\lambda (H8: (eq T (THead (Flat Appl) v1 (THead +(Bind b) u1 t2)) (lift h x1 x0))).(ex3_2_ind T T (\lambda (y0: T).(\lambda +(z: T).(eq T x0 (THead (Flat Appl) y0 z)))) (\lambda (y0: T).(\lambda (_: +T).(eq T v1 (lift h x1 y0)))) (\lambda (_: T).(\lambda (z: T).(eq T (THead +(Bind b) u1 t2) (lift h x1 z)))) (ex2 T (\lambda (t4: T).(eq T (THead (Bind +b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (lift h x1 t4))) (\lambda +(t4: T).(pr0 x0 t4))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H9: (eq T +x0 (THead (Flat Appl) x2 x3))).(\lambda (H10: (eq T v1 (lift h x1 +x2))).(\lambda (H11: (eq T (THead (Bind b) u1 t2) (lift h x1 x3))).(eq_ind_r +T (THead (Flat Appl) x2 x3) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (lift h x1 t4))) +(\lambda (t4: T).(pr0 t t4)))) (ex3_2_ind T T (\lambda (y0: T).(\lambda (z: +T).(eq T x3 (THead (Bind b) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T +u1 (lift h x1 y0)))) (\lambda (_: T).(\lambda (z: T).(eq T t2 (lift h (S x1) +z)))) (ex2 T (\lambda (t4: T).(eq T (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t3)) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat +Appl) x2 x3) t4))) (\lambda (x4: T).(\lambda (x5: T).(\lambda (H12: (eq T x3 +(THead (Bind b) x4 x5))).(\lambda (H13: (eq T u1 (lift h x1 x4))).(\lambda +(H14: (eq T t2 (lift h (S x1) x5))).(eq_ind_r T (THead (Bind b) x4 x5) +(\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t3)) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead +(Flat Appl) x2 t) t4)))) (ex2_ind T (\lambda (t4: T).(eq T t3 (lift h (S x1) +t4))) (\lambda (t4: T).(pr0 x5 t4)) (ex2 T (\lambda (t4: T).(eq T (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3)) (lift h x1 t4))) +(\lambda (t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind b) x4 x5)) t4))) +(\lambda (x6: T).(\lambda (H_x: (eq T t3 (lift h (S x1) x6))).(\lambda (H15: +(pr0 x5 x6)).(eq_ind_r T (lift h (S x1) x6) (\lambda (t: T).(ex2 T (\lambda +(t4: T).(eq T (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t)) +(lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind b) +x4 x5)) t4)))) (ex2_ind T (\lambda (t4: T).(eq T u2 (lift h x1 t4))) (\lambda +(t4: T).(pr0 x4 t4)) (ex2 T (\lambda (t4: T).(eq T (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) (lift h (S x1) x6))) (lift h x1 t4))) (\lambda +(t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind b) x4 x5)) t4))) (\lambda +(x7: T).(\lambda (H_x0: (eq T u2 (lift h x1 x7))).(\lambda (H16: (pr0 x4 +x7)).(eq_ind_r T (lift h x1 x7) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T +(THead (Bind b) t (THead (Flat Appl) (lift (S O) O v2) (lift h (S x1) x6))) +(lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind b) +x4 x5)) t4)))) (ex2_ind T (\lambda (t4: T).(eq T v2 (lift h x1 t4))) (\lambda +(t4: T).(pr0 x2 t4)) (ex2 T (\lambda (t4: T).(eq T (THead (Bind b) (lift h x1 +x7) (THead (Flat Appl) (lift (S O) O v2) (lift h (S x1) x6))) (lift h x1 +t4))) (\lambda (t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind b) x4 x5)) +t4))) (\lambda (x8: T).(\lambda (H_x1: (eq T v2 (lift h x1 x8))).(\lambda +(H17: (pr0 x2 x8)).(eq_ind_r T (lift h x1 x8) (\lambda (t: T).(ex2 T (\lambda +(t4: T).(eq T (THead (Bind b) (lift h x1 x7) (THead (Flat Appl) (lift (S O) O +t) (lift h (S x1) x6))) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat +Appl) x2 (THead (Bind b) x4 x5)) t4)))) (eq_ind T (lift h (plus (S O) x1) +(lift (S O) O x8)) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead (Bind +b) (lift h x1 x7) (THead (Flat Appl) t (lift h (S x1) x6))) (lift h x1 t4))) +(\lambda (t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind b) x4 x5)) t4)))) +(eq_ind T (lift h (S x1) (THead (Flat Appl) (lift (S O) O x8) x6)) (\lambda +(t: T).(ex2 T (\lambda (t4: T).(eq T (THead (Bind b) (lift h x1 x7) t) (lift +h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind b) x4 +x5)) t4)))) (ex_intro2 T (\lambda (t4: T).(eq T (THead (Bind b) (lift h x1 +x7) (lift h (S x1) (THead (Flat Appl) (lift (S O) O x8) x6))) (lift h x1 +t4))) (\lambda (t4: T).(pr0 (THead (Flat Appl) x2 (THead (Bind b) x4 x5)) +t4)) (THead (Bind b) x7 (THead (Flat Appl) (lift (S O) O x8) x6)) (sym_eq T +(lift h x1 (THead (Bind b) x7 (THead (Flat Appl) (lift (S O) O x8) x6))) +(THead (Bind b) (lift h x1 x7) (lift h (S x1) (THead (Flat Appl) (lift (S O) +O x8) x6))) (lift_bind b x7 (THead (Flat Appl) (lift (S O) O x8) x6) h x1)) +(pr0_upsilon b H1 x2 x8 H17 x4 x7 H16 x5 x6 H15)) (THead (Flat Appl) (lift h +(S x1) (lift (S O) O x8)) (lift h (S x1) x6)) (lift_flat Appl (lift (S O) O +x8) x6 h (S x1))) (lift (S O) O (lift h x1 x8)) (lift_d x8 h (S O) x1 O +(le_O_n x1))) v2 H_x1)))) (H3 x2 x1 H10)) u2 H_x0)))) (H5 x4 x1 H13)) t3 +H_x)))) (H7 x5 (S x1) H14)) x3 H12)))))) (lift_gen_bind b u1 t2 x3 h x1 H11)) +x0 H9)))))) (lift_gen_flat Appl v1 (THead (Bind b) u1 t2) x0 h x1 +H8))))))))))))))))))) (\lambda (u1: T).(\lambda (u2: T).(\lambda (_: (pr0 u1 +u2)).(\lambda (H2: ((\forall (x0: T).(\forall (x1: nat).((eq T u1 (lift h x1 +x0)) \to (ex2 T (\lambda (t2: T).(eq T u2 (lift h x1 t2))) (\lambda (t2: +T).(pr0 x0 t2)))))))).(\lambda (t2: T).(\lambda (t3: T).(\lambda (_: (pr0 t2 +t3)).(\lambda (H4: ((\forall (x0: T).(\forall (x1: nat).((eq T t2 (lift h x1 +x0)) \to (ex2 T (\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: +T).(pr0 x0 t4)))))))).(\lambda (w: T).(\lambda (H5: (subst0 O u2 t3 +w)).(\lambda (x0: T).(\lambda (x1: nat).(\lambda (H6: (eq T (THead (Bind +Abbr) u1 t2) (lift h x1 x0))).(ex3_2_ind T T (\lambda (y0: T).(\lambda (z: +T).(eq T x0 (THead (Bind Abbr) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq +T u1 (lift h x1 y0)))) (\lambda (_: T).(\lambda (z: T).(eq T t2 (lift h (S +x1) z)))) (ex2 T (\lambda (t4: T).(eq T (THead (Bind Abbr) u2 w) (lift h x1 +t4))) (\lambda (t4: T).(pr0 x0 t4))) (\lambda (x2: T).(\lambda (x3: +T).(\lambda (H7: (eq T x0 (THead (Bind Abbr) x2 x3))).(\lambda (H8: (eq T u1 +(lift h x1 x2))).(\lambda (H9: (eq T t2 (lift h (S x1) x3))).(eq_ind_r T +(THead (Bind Abbr) x2 x3) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T +(THead (Bind Abbr) u2 w) (lift h x1 t4))) (\lambda (t4: T).(pr0 t t4)))) +(ex2_ind T (\lambda (t4: T).(eq T t3 (lift h (S x1) t4))) (\lambda (t4: +T).(pr0 x3 t4)) (ex2 T (\lambda (t4: T).(eq T (THead (Bind Abbr) u2 w) (lift +h x1 t4))) (\lambda (t4: T).(pr0 (THead (Bind Abbr) x2 x3) t4))) (\lambda +(x4: T).(\lambda (H_x: (eq T t3 (lift h (S x1) x4))).(\lambda (H10: (pr0 x3 +x4)).(let H11 \def (eq_ind T t3 (\lambda (t: T).(subst0 O u2 t w)) H5 (lift h +(S x1) x4) H_x) in (ex2_ind T (\lambda (t4: T).(eq T u2 (lift h x1 t4))) +(\lambda (t4: T).(pr0 x2 t4)) (ex2 T (\lambda (t4: T).(eq T (THead (Bind +Abbr) u2 w) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Bind Abbr) x2 x3) +t4))) (\lambda (x5: T).(\lambda (H_x0: (eq T u2 (lift h x1 x5))).(\lambda +(H12: (pr0 x2 x5)).(eq_ind_r T (lift h x1 x5) (\lambda (t: T).(ex2 T (\lambda +(t4: T).(eq T (THead (Bind Abbr) t w) (lift h x1 t4))) (\lambda (t4: T).(pr0 +(THead (Bind Abbr) x2 x3) t4)))) (let H13 \def (eq_ind T u2 (\lambda (t: +T).(subst0 O t (lift h (S x1) x4) w)) H11 (lift h x1 x5) H_x0) in (let H14 +\def (refl_equal nat (S (plus O x1))) in (let H15 \def (eq_ind nat (S x1) +(\lambda (n: nat).(subst0 O (lift h x1 x5) (lift h n x4) w)) H13 (S (plus O +x1)) H14) in (ex2_ind T (\lambda (t4: T).(eq T w (lift h (S (plus O x1)) +t4))) (\lambda (t4: T).(subst0 O x5 x4 t4)) (ex2 T (\lambda (t4: T).(eq T +(THead (Bind Abbr) (lift h x1 x5) w) (lift h x1 t4))) (\lambda (t4: T).(pr0 +(THead (Bind Abbr) x2 x3) t4))) (\lambda (x6: T).(\lambda (H16: (eq T w (lift +h (S (plus O x1)) x6))).(\lambda (H17: (subst0 O x5 x4 x6)).(eq_ind_r T (lift +h (S (plus O x1)) x6) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T (THead +(Bind Abbr) (lift h x1 x5) t) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead +(Bind Abbr) x2 x3) t4)))) (ex_intro2 T (\lambda (t4: T).(eq T (THead (Bind +Abbr) (lift h x1 x5) (lift h (S (plus O x1)) x6)) (lift h x1 t4))) (\lambda +(t4: T).(pr0 (THead (Bind Abbr) x2 x3) t4)) (THead (Bind Abbr) x5 x6) (sym_eq +T (lift h x1 (THead (Bind Abbr) x5 x6)) (THead (Bind Abbr) (lift h x1 x5) +(lift h (S (plus O x1)) x6)) (lift_bind Abbr x5 x6 h (plus O x1))) (pr0_delta +x2 x5 H12 x3 x4 H10 x6 H17)) w H16)))) (subst0_gen_lift_lt x5 x4 w O h x1 +H15))))) u2 H_x0)))) (H2 x2 x1 H8)))))) (H4 x3 (S x1) H9)) x0 H7)))))) +(lift_gen_bind Abbr u1 t2 x0 h x1 H6))))))))))))))) (\lambda (b: B).(\lambda +(H1: (not (eq B b Abst))).(\lambda (t2: T).(\lambda (t3: T).(\lambda (_: (pr0 +t2 t3)).(\lambda (H3: ((\forall (x0: T).(\forall (x1: nat).((eq T t2 (lift h +x1 x0)) \to (ex2 T (\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: +T).(pr0 x0 t4)))))))).(\lambda (u: T).(\lambda (x0: T).(\lambda (x1: +nat).(\lambda (H4: (eq T (THead (Bind b) u (lift (S O) O t2)) (lift h x1 +x0))).(ex3_2_ind T T (\lambda (y0: T).(\lambda (z: T).(eq T x0 (THead (Bind +b) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T u (lift h x1 y0)))) +(\lambda (_: T).(\lambda (z: T).(eq T (lift (S O) O t2) (lift h (S x1) z)))) +(ex2 T (\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: T).(pr0 x0 +t4))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H5: (eq T x0 (THead (Bind +b) x2 x3))).(\lambda (_: (eq T u (lift h x1 x2))).(\lambda (H7: (eq T (lift +(S O) O t2) (lift h (S x1) x3))).(eq_ind_r T (THead (Bind b) x2 x3) (\lambda +(t: T).(ex2 T (\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: +T).(pr0 t t4)))) (let H8 \def (eq_ind_r nat (plus (S O) x1) (\lambda (n: +nat).(eq nat (S x1) n)) (refl_equal nat (plus (S O) x1)) (plus x1 (S O)) +(plus_comm x1 (S O))) in (let H9 \def (eq_ind nat (S x1) (\lambda (n: +nat).(eq T (lift (S O) O t2) (lift h n x3))) H7 (plus x1 (S O)) H8) in +(ex2_ind T (\lambda (t4: T).(eq T x3 (lift (S O) O t4))) (\lambda (t4: T).(eq +T t2 (lift h x1 t4))) (ex2 T (\lambda (t4: T).(eq T t3 (lift h x1 t4))) +(\lambda (t4: T).(pr0 (THead (Bind b) x2 x3) t4))) (\lambda (x4: T).(\lambda +(H10: (eq T x3 (lift (S O) O x4))).(\lambda (H11: (eq T t2 (lift h x1 +x4))).(eq_ind_r T (lift (S O) O x4) (\lambda (t: T).(ex2 T (\lambda (t4: +T).(eq T t3 (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Bind b) x2 t) +t4)))) (ex2_ind T (\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: +T).(pr0 x4 t4)) (ex2 T (\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda +(t4: T).(pr0 (THead (Bind b) x2 (lift (S O) O x4)) t4))) (\lambda (x5: +T).(\lambda (H_x: (eq T t3 (lift h x1 x5))).(\lambda (H12: (pr0 x4 +x5)).(eq_ind_r T (lift h x1 x5) (\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T +t (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Bind b) x2 (lift (S O) O +x4)) t4)))) (ex_intro2 T (\lambda (t4: T).(eq T (lift h x1 x5) (lift h x1 +t4))) (\lambda (t4: T).(pr0 (THead (Bind b) x2 (lift (S O) O x4)) t4)) x5 +(refl_equal T (lift h x1 x5)) (pr0_zeta b H1 x4 x5 H12 x2)) t3 H_x)))) (H3 x4 +x1 H11)) x3 H10)))) (lift_gen_lift t2 x3 (S O) h O x1 (le_O_n x1) H9)))) x0 +H5)))))) (lift_gen_bind b u (lift (S O) O t2) x0 h x1 H4)))))))))))) (\lambda +(t2: T).(\lambda (t3: T).(\lambda (_: (pr0 t2 t3)).(\lambda (H2: ((\forall +(x0: T).(\forall (x1: nat).((eq T t2 (lift h x1 x0)) \to (ex2 T (\lambda (t4: +T).(eq T t3 (lift h x1 t4))) (\lambda (t4: T).(pr0 x0 t4)))))))).(\lambda (u: +T).(\lambda (x0: T).(\lambda (x1: nat).(\lambda (H3: (eq T (THead (Flat Cast) +u t2) (lift h x1 x0))).(ex3_2_ind T T (\lambda (y0: T).(\lambda (z: T).(eq T +x0 (THead (Flat Cast) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T u (lift +h x1 y0)))) (\lambda (_: T).(\lambda (z: T).(eq T t2 (lift h x1 z)))) (ex2 T +(\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: T).(pr0 x0 t4))) +(\lambda (x2: T).(\lambda (x3: T).(\lambda (H4: (eq T x0 (THead (Flat Cast) +x2 x3))).(\lambda (_: (eq T u (lift h x1 x2))).(\lambda (H6: (eq T t2 (lift h +x1 x3))).(eq_ind_r T (THead (Flat Cast) x2 x3) (\lambda (t: T).(ex2 T +(\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: T).(pr0 t t4)))) +(ex2_ind T (\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: T).(pr0 +x3 t4)) (ex2 T (\lambda (t4: T).(eq T t3 (lift h x1 t4))) (\lambda (t4: +T).(pr0 (THead (Flat Cast) x2 x3) t4))) (\lambda (x4: T).(\lambda (H_x: (eq T +t3 (lift h x1 x4))).(\lambda (H7: (pr0 x3 x4)).(eq_ind_r T (lift h x1 x4) +(\lambda (t: T).(ex2 T (\lambda (t4: T).(eq T t (lift h x1 t4))) (\lambda +(t4: T).(pr0 (THead (Flat Cast) x2 x3) t4)))) (ex_intro2 T (\lambda (t4: +T).(eq T (lift h x1 x4) (lift h x1 t4))) (\lambda (t4: T).(pr0 (THead (Flat +Cast) x2 x3) t4)) x4 (refl_equal T (lift h x1 x4)) (pr0_epsilon x3 x4 H7 x2)) +t3 H_x)))) (H2 x3 x1 H6)) x0 H4)))))) (lift_gen_flat Cast u t2 x0 h x1 +H3)))))))))) y x H0))))) H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/pr0.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/pr0.ma new file mode 100644 index 000000000..59e04cef8 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/pr0.ma @@ -0,0 +1,2818 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr0/pr0". + +include "pr0/fwd.ma". + +include "lift/tlt.ma". + +theorem pr0_confluence__pr0_cong_upsilon_refl: + \forall (b: B).((not (eq B b Abst)) \to (\forall (u0: T).(\forall (u3: +T).((pr0 u0 u3) \to (\forall (t4: T).(\forall (t5: T).((pr0 t4 t5) \to +(\forall (u2: T).(\forall (v2: T).(\forall (x: T).((pr0 u2 x) \to ((pr0 v2 x) +\to (ex2 T (\lambda (t: T).(pr0 (THead (Flat Appl) u2 (THead (Bind b) u0 t4)) +t)) (\lambda (t: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O +v2) t5)) t))))))))))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda (u0: T).(\lambda +(u3: T).(\lambda (H0: (pr0 u0 u3)).(\lambda (t4: T).(\lambda (t5: T).(\lambda +(H1: (pr0 t4 t5)).(\lambda (u2: T).(\lambda (v2: T).(\lambda (x: T).(\lambda +(H2: (pr0 u2 x)).(\lambda (H3: (pr0 v2 x)).(ex_intro2 T (\lambda (t: T).(pr0 +(THead (Flat Appl) u2 (THead (Bind b) u0 t4)) t)) (\lambda (t: T).(pr0 (THead +(Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t5)) t)) (THead (Bind b) u3 +(THead (Flat Appl) (lift (S O) O x) t5)) (pr0_upsilon b H u2 x H2 u0 u3 H0 t4 +t5 H1) (pr0_comp u3 u3 (pr0_refl u3) (THead (Flat Appl) (lift (S O) O v2) t5) +(THead (Flat Appl) (lift (S O) O x) t5) (pr0_comp (lift (S O) O v2) (lift (S +O) O x) (pr0_lift v2 x H3 (S O) O) t5 t5 (pr0_refl t5) (Flat Appl)) (Bind +b))))))))))))))). + +theorem pr0_confluence__pr0_cong_upsilon_cong: + \forall (b: B).((not (eq B b Abst)) \to (\forall (u2: T).(\forall (v2: +T).(\forall (x: T).((pr0 u2 x) \to ((pr0 v2 x) \to (\forall (t2: T).(\forall +(t5: T).(\forall (x0: T).((pr0 t2 x0) \to ((pr0 t5 x0) \to (\forall (u5: +T).(\forall (u3: T).(\forall (x1: T).((pr0 u5 x1) \to ((pr0 u3 x1) \to (ex2 T +(\lambda (t: T).(pr0 (THead (Flat Appl) u2 (THead (Bind b) u5 t2)) t)) +(\lambda (t: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) +t5)) t))))))))))))))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda (u2: T).(\lambda +(v2: T).(\lambda (x: T).(\lambda (H0: (pr0 u2 x)).(\lambda (H1: (pr0 v2 +x)).(\lambda (t2: T).(\lambda (t5: T).(\lambda (x0: T).(\lambda (H2: (pr0 t2 +x0)).(\lambda (H3: (pr0 t5 x0)).(\lambda (u5: T).(\lambda (u3: T).(\lambda +(x1: T).(\lambda (H4: (pr0 u5 x1)).(\lambda (H5: (pr0 u3 x1)).(ex_intro2 T +(\lambda (t: T).(pr0 (THead (Flat Appl) u2 (THead (Bind b) u5 t2)) t)) +(\lambda (t: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) +t5)) t)) (THead (Bind b) x1 (THead (Flat Appl) (lift (S O) O x) x0)) +(pr0_upsilon b H u2 x H0 u5 x1 H4 t2 x0 H2) (pr0_comp u3 x1 H5 (THead (Flat +Appl) (lift (S O) O v2) t5) (THead (Flat Appl) (lift (S O) O x) x0) (pr0_comp +(lift (S O) O v2) (lift (S O) O x) (pr0_lift v2 x H1 (S O) O) t5 x0 H3 (Flat +Appl)) (Bind b))))))))))))))))))). + +theorem pr0_confluence__pr0_cong_upsilon_delta: + (not (eq B Abbr Abst)) \to (\forall (u5: T).(\forall (t2: T).(\forall (w: +T).((subst0 O u5 t2 w) \to (\forall (u2: T).(\forall (v2: T).(\forall (x: +T).((pr0 u2 x) \to ((pr0 v2 x) \to (\forall (t5: T).(\forall (x0: T).((pr0 t2 +x0) \to ((pr0 t5 x0) \to (\forall (u3: T).(\forall (x1: T).((pr0 u5 x1) \to +((pr0 u3 x1) \to (ex2 T (\lambda (t: T).(pr0 (THead (Flat Appl) u2 (THead +(Bind Abbr) u5 w)) t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) u3 (THead +(Flat Appl) (lift (S O) O v2) t5)) t)))))))))))))))))))) +\def + \lambda (H: (not (eq B Abbr Abst))).(\lambda (u5: T).(\lambda (t2: +T).(\lambda (w: T).(\lambda (H0: (subst0 O u5 t2 w)).(\lambda (u2: +T).(\lambda (v2: T).(\lambda (x: T).(\lambda (H1: (pr0 u2 x)).(\lambda (H2: +(pr0 v2 x)).(\lambda (t5: T).(\lambda (x0: T).(\lambda (H3: (pr0 t2 +x0)).(\lambda (H4: (pr0 t5 x0)).(\lambda (u3: T).(\lambda (x1: T).(\lambda +(H5: (pr0 u5 x1)).(\lambda (H6: (pr0 u3 x1)).(or_ind (pr0 w x0) (ex2 T +(\lambda (w2: T).(pr0 w w2)) (\lambda (w2: T).(subst0 O x1 x0 w2))) (ex2 T +(\lambda (t: T).(pr0 (THead (Flat Appl) u2 (THead (Bind Abbr) u5 w)) t)) +(\lambda (t: T).(pr0 (THead (Bind Abbr) u3 (THead (Flat Appl) (lift (S O) O +v2) t5)) t))) (\lambda (H7: (pr0 w x0)).(ex_intro2 T (\lambda (t: T).(pr0 +(THead (Flat Appl) u2 (THead (Bind Abbr) u5 w)) t)) (\lambda (t: T).(pr0 +(THead (Bind Abbr) u3 (THead (Flat Appl) (lift (S O) O v2) t5)) t)) (THead +(Bind Abbr) x1 (THead (Flat Appl) (lift (S O) O x) x0)) (pr0_upsilon Abbr H +u2 x H1 u5 x1 H5 w x0 H7) (pr0_comp u3 x1 H6 (THead (Flat Appl) (lift (S O) O +v2) t5) (THead (Flat Appl) (lift (S O) O x) x0) (pr0_comp (lift (S O) O v2) +(lift (S O) O x) (pr0_lift v2 x H2 (S O) O) t5 x0 H4 (Flat Appl)) (Bind +Abbr)))) (\lambda (H7: (ex2 T (\lambda (w2: T).(pr0 w w2)) (\lambda (w2: +T).(subst0 O x1 x0 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 w w2)) (\lambda +(w2: T).(subst0 O x1 x0 w2)) (ex2 T (\lambda (t: T).(pr0 (THead (Flat Appl) +u2 (THead (Bind Abbr) u5 w)) t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) u3 +(THead (Flat Appl) (lift (S O) O v2) t5)) t))) (\lambda (x2: T).(\lambda (H8: +(pr0 w x2)).(\lambda (H9: (subst0 O x1 x0 x2)).(ex_intro2 T (\lambda (t: +T).(pr0 (THead (Flat Appl) u2 (THead (Bind Abbr) u5 w)) t)) (\lambda (t: +T).(pr0 (THead (Bind Abbr) u3 (THead (Flat Appl) (lift (S O) O v2) t5)) t)) +(THead (Bind Abbr) x1 (THead (Flat Appl) (lift (S O) O x) x2)) (pr0_upsilon +Abbr H u2 x H1 u5 x1 H5 w x2 H8) (pr0_delta u3 x1 H6 (THead (Flat Appl) (lift +(S O) O v2) t5) (THead (Flat Appl) (lift (S O) O x) x0) (pr0_comp (lift (S O) +O v2) (lift (S O) O x) (pr0_lift v2 x H2 (S O) O) t5 x0 H4 (Flat Appl)) +(THead (Flat Appl) (lift (S O) O x) x2) (subst0_snd (Flat Appl) x1 x2 x0 O H9 +(lift (S O) O x))))))) H7)) (pr0_subst0 t2 x0 H3 u5 w O H0 x1 +H5))))))))))))))))))). + +theorem pr0_confluence__pr0_cong_upsilon_zeta: + \forall (b: B).((not (eq B b Abst)) \to (\forall (u0: T).(\forall (u3: +T).((pr0 u0 u3) \to (\forall (u2: T).(\forall (v2: T).(\forall (x0: T).((pr0 +u2 x0) \to ((pr0 v2 x0) \to (\forall (x: T).(\forall (t3: T).(\forall (x1: +T).((pr0 x x1) \to ((pr0 t3 x1) \to (ex2 T (\lambda (t: T).(pr0 (THead (Flat +Appl) u2 t3) t)) (\lambda (t: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) +(lift (S O) O v2) (lift (S O) O x))) t))))))))))))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda (u0: T).(\lambda +(u3: T).(\lambda (_: (pr0 u0 u3)).(\lambda (u2: T).(\lambda (v2: T).(\lambda +(x0: T).(\lambda (H1: (pr0 u2 x0)).(\lambda (H2: (pr0 v2 x0)).(\lambda (x: +T).(\lambda (t3: T).(\lambda (x1: T).(\lambda (H3: (pr0 x x1)).(\lambda (H4: +(pr0 t3 x1)).(eq_ind T (lift (S O) O (THead (Flat Appl) v2 x)) (\lambda (t: +T).(ex2 T (\lambda (t0: T).(pr0 (THead (Flat Appl) u2 t3) t0)) (\lambda (t0: +T).(pr0 (THead (Bind b) u3 t) t0)))) (ex_intro2 T (\lambda (t: T).(pr0 (THead +(Flat Appl) u2 t3) t)) (\lambda (t: T).(pr0 (THead (Bind b) u3 (lift (S O) O +(THead (Flat Appl) v2 x))) t)) (THead (Flat Appl) x0 x1) (pr0_comp u2 x0 H1 +t3 x1 H4 (Flat Appl)) (pr0_zeta b H (THead (Flat Appl) v2 x) (THead (Flat +Appl) x0 x1) (pr0_comp v2 x0 H2 x x1 H3 (Flat Appl)) u3)) (THead (Flat Appl) +(lift (S O) O v2) (lift (S O) O x)) (lift_flat Appl v2 x (S O) +O)))))))))))))))). + +theorem pr0_confluence__pr0_cong_delta: + \forall (u3: T).(\forall (t5: T).(\forall (w: T).((subst0 O u3 t5 w) \to +(\forall (u2: T).(\forall (x: T).((pr0 u2 x) \to ((pr0 u3 x) \to (\forall +(t3: T).(\forall (x0: T).((pr0 t3 x0) \to ((pr0 t5 x0) \to (ex2 T (\lambda +(t: T).(pr0 (THead (Bind Abbr) u2 t3) t)) (\lambda (t: T).(pr0 (THead (Bind +Abbr) u3 w) t)))))))))))))) +\def + \lambda (u3: T).(\lambda (t5: T).(\lambda (w: T).(\lambda (H: (subst0 O u3 +t5 w)).(\lambda (u2: T).(\lambda (x: T).(\lambda (H0: (pr0 u2 x)).(\lambda +(H1: (pr0 u3 x)).(\lambda (t3: T).(\lambda (x0: T).(\lambda (H2: (pr0 t3 +x0)).(\lambda (H3: (pr0 t5 x0)).(or_ind (pr0 w x0) (ex2 T (\lambda (w2: +T).(pr0 w w2)) (\lambda (w2: T).(subst0 O x x0 w2))) (ex2 T (\lambda (t: +T).(pr0 (THead (Bind Abbr) u2 t3) t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) +u3 w) t))) (\lambda (H4: (pr0 w x0)).(ex_intro2 T (\lambda (t: T).(pr0 (THead +(Bind Abbr) u2 t3) t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) u3 w) t)) +(THead (Bind Abbr) x x0) (pr0_comp u2 x H0 t3 x0 H2 (Bind Abbr)) (pr0_comp u3 +x H1 w x0 H4 (Bind Abbr)))) (\lambda (H4: (ex2 T (\lambda (w2: T).(pr0 w w2)) +(\lambda (w2: T).(subst0 O x x0 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 w +w2)) (\lambda (w2: T).(subst0 O x x0 w2)) (ex2 T (\lambda (t: T).(pr0 (THead +(Bind Abbr) u2 t3) t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) u3 w) t))) +(\lambda (x1: T).(\lambda (H5: (pr0 w x1)).(\lambda (H6: (subst0 O x x0 +x1)).(ex_intro2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 t3) t)) (\lambda +(t: T).(pr0 (THead (Bind Abbr) u3 w) t)) (THead (Bind Abbr) x x1) (pr0_delta +u2 x H0 t3 x0 H2 x1 H6) (pr0_comp u3 x H1 w x1 H5 (Bind Abbr)))))) H4)) +(pr0_subst0 t5 x0 H3 u3 w O H x H1))))))))))))). + +theorem pr0_confluence__pr0_upsilon_upsilon: + \forall (b: B).((not (eq B b Abst)) \to (\forall (v1: T).(\forall (v2: +T).(\forall (x0: T).((pr0 v1 x0) \to ((pr0 v2 x0) \to (\forall (u1: +T).(\forall (u2: T).(\forall (x1: T).((pr0 u1 x1) \to ((pr0 u2 x1) \to +(\forall (t1: T).(\forall (t2: T).(\forall (x2: T).((pr0 t1 x2) \to ((pr0 t2 +x2) \to (ex2 T (\lambda (t: T).(pr0 (THead (Bind b) u1 (THead (Flat Appl) +(lift (S O) O v1) t1)) t)) (\lambda (t: T).(pr0 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t2)) t))))))))))))))))))) +\def + \lambda (b: B).(\lambda (_: (not (eq B b Abst))).(\lambda (v1: T).(\lambda +(v2: T).(\lambda (x0: T).(\lambda (H0: (pr0 v1 x0)).(\lambda (H1: (pr0 v2 +x0)).(\lambda (u1: T).(\lambda (u2: T).(\lambda (x1: T).(\lambda (H2: (pr0 u1 +x1)).(\lambda (H3: (pr0 u2 x1)).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(x2: T).(\lambda (H4: (pr0 t1 x2)).(\lambda (H5: (pr0 t2 x2)).(ex_intro2 T +(\lambda (t: T).(pr0 (THead (Bind b) u1 (THead (Flat Appl) (lift (S O) O v1) +t1)) t)) (\lambda (t: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t2)) t)) (THead (Bind b) x1 (THead (Flat Appl) (lift (S O) O x0) +x2)) (pr0_comp u1 x1 H2 (THead (Flat Appl) (lift (S O) O v1) t1) (THead (Flat +Appl) (lift (S O) O x0) x2) (pr0_comp (lift (S O) O v1) (lift (S O) O x0) +(pr0_lift v1 x0 H0 (S O) O) t1 x2 H4 (Flat Appl)) (Bind b)) (pr0_comp u2 x1 +H3 (THead (Flat Appl) (lift (S O) O v2) t2) (THead (Flat Appl) (lift (S O) O +x0) x2) (pr0_comp (lift (S O) O v2) (lift (S O) O x0) (pr0_lift v2 x0 H1 (S +O) O) t2 x2 H5 (Flat Appl)) (Bind b))))))))))))))))))). + +theorem pr0_confluence__pr0_delta_delta: + \forall (u2: T).(\forall (t3: T).(\forall (w: T).((subst0 O u2 t3 w) \to +(\forall (u3: T).(\forall (t5: T).(\forall (w0: T).((subst0 O u3 t5 w0) \to +(\forall (x: T).((pr0 u2 x) \to ((pr0 u3 x) \to (\forall (x0: T).((pr0 t3 x0) +\to ((pr0 t5 x0) \to (ex2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) +(\lambda (t: T).(pr0 (THead (Bind Abbr) u3 w0) t)))))))))))))))) +\def + \lambda (u2: T).(\lambda (t3: T).(\lambda (w: T).(\lambda (H: (subst0 O u2 +t3 w)).(\lambda (u3: T).(\lambda (t5: T).(\lambda (w0: T).(\lambda (H0: +(subst0 O u3 t5 w0)).(\lambda (x: T).(\lambda (H1: (pr0 u2 x)).(\lambda (H2: +(pr0 u3 x)).(\lambda (x0: T).(\lambda (H3: (pr0 t3 x0)).(\lambda (H4: (pr0 t5 +x0)).(or_ind (pr0 w0 x0) (ex2 T (\lambda (w2: T).(pr0 w0 w2)) (\lambda (w2: +T).(subst0 O x x0 w2))) (ex2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) +t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) u3 w0) t))) (\lambda (H5: (pr0 w0 +x0)).(or_ind (pr0 w x0) (ex2 T (\lambda (w2: T).(pr0 w w2)) (\lambda (w2: +T).(subst0 O x x0 w2))) (ex2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) +t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) u3 w0) t))) (\lambda (H6: (pr0 w +x0)).(ex_intro2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda +(t: T).(pr0 (THead (Bind Abbr) u3 w0) t)) (THead (Bind Abbr) x x0) (pr0_comp +u2 x H1 w x0 H6 (Bind Abbr)) (pr0_comp u3 x H2 w0 x0 H5 (Bind Abbr)))) +(\lambda (H6: (ex2 T (\lambda (w2: T).(pr0 w w2)) (\lambda (w2: T).(subst0 O +x x0 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 w w2)) (\lambda (w2: T).(subst0 +O x x0 w2)) (ex2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda +(t: T).(pr0 (THead (Bind Abbr) u3 w0) t))) (\lambda (x1: T).(\lambda (H7: +(pr0 w x1)).(\lambda (H8: (subst0 O x x0 x1)).(ex_intro2 T (\lambda (t: +T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) +u3 w0) t)) (THead (Bind Abbr) x x1) (pr0_comp u2 x H1 w x1 H7 (Bind Abbr)) +(pr0_delta u3 x H2 w0 x0 H5 x1 H8))))) H6)) (pr0_subst0 t3 x0 H3 u2 w O H x +H1))) (\lambda (H5: (ex2 T (\lambda (w2: T).(pr0 w0 w2)) (\lambda (w2: +T).(subst0 O x x0 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 w0 w2)) (\lambda +(w2: T).(subst0 O x x0 w2)) (ex2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 +w) t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) u3 w0) t))) (\lambda (x1: +T).(\lambda (H6: (pr0 w0 x1)).(\lambda (H7: (subst0 O x x0 x1)).(or_ind (pr0 +w x0) (ex2 T (\lambda (w2: T).(pr0 w w2)) (\lambda (w2: T).(subst0 O x x0 +w2))) (ex2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda (t: +T).(pr0 (THead (Bind Abbr) u3 w0) t))) (\lambda (H8: (pr0 w x0)).(ex_intro2 T +(\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda (t: T).(pr0 (THead +(Bind Abbr) u3 w0) t)) (THead (Bind Abbr) x x1) (pr0_delta u2 x H1 w x0 H8 x1 +H7) (pr0_comp u3 x H2 w0 x1 H6 (Bind Abbr)))) (\lambda (H8: (ex2 T (\lambda +(w2: T).(pr0 w w2)) (\lambda (w2: T).(subst0 O x x0 w2)))).(ex2_ind T +(\lambda (w2: T).(pr0 w w2)) (\lambda (w2: T).(subst0 O x x0 w2)) (ex2 T +(\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda (t: T).(pr0 (THead +(Bind Abbr) u3 w0) t))) (\lambda (x2: T).(\lambda (H9: (pr0 w x2)).(\lambda +(H10: (subst0 O x x0 x2)).(or4_ind (eq T x2 x1) (ex2 T (\lambda (t: +T).(subst0 O x x2 t)) (\lambda (t: T).(subst0 O x x1 t))) (subst0 O x x2 x1) +(subst0 O x x1 x2) (ex2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) +(\lambda (t: T).(pr0 (THead (Bind Abbr) u3 w0) t))) (\lambda (H11: (eq T x2 +x1)).(let H12 \def (eq_ind T x2 (\lambda (t: T).(pr0 w t)) H9 x1 H11) in +(ex_intro2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda (t: +T).(pr0 (THead (Bind Abbr) u3 w0) t)) (THead (Bind Abbr) x x1) (pr0_comp u2 x +H1 w x1 H12 (Bind Abbr)) (pr0_comp u3 x H2 w0 x1 H6 (Bind Abbr))))) (\lambda +(H11: (ex2 T (\lambda (t: T).(subst0 O x x2 t)) (\lambda (t: T).(subst0 O x +x1 t)))).(ex2_ind T (\lambda (t: T).(subst0 O x x2 t)) (\lambda (t: +T).(subst0 O x x1 t)) (ex2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) +t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) u3 w0) t))) (\lambda (x3: +T).(\lambda (H12: (subst0 O x x2 x3)).(\lambda (H13: (subst0 O x x1 +x3)).(ex_intro2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda +(t: T).(pr0 (THead (Bind Abbr) u3 w0) t)) (THead (Bind Abbr) x x3) (pr0_delta +u2 x H1 w x2 H9 x3 H12) (pr0_delta u3 x H2 w0 x1 H6 x3 H13))))) H11)) +(\lambda (H11: (subst0 O x x2 x1)).(ex_intro2 T (\lambda (t: T).(pr0 (THead +(Bind Abbr) u2 w) t)) (\lambda (t: T).(pr0 (THead (Bind Abbr) u3 w0) t)) +(THead (Bind Abbr) x x1) (pr0_delta u2 x H1 w x2 H9 x1 H11) (pr0_comp u3 x H2 +w0 x1 H6 (Bind Abbr)))) (\lambda (H11: (subst0 O x x1 x2)).(ex_intro2 T +(\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda (t: T).(pr0 (THead +(Bind Abbr) u3 w0) t)) (THead (Bind Abbr) x x2) (pr0_comp u2 x H1 w x2 H9 +(Bind Abbr)) (pr0_delta u3 x H2 w0 x1 H6 x2 H11))) (subst0_confluence_eq x0 +x2 x O H10 x1 H7))))) H8)) (pr0_subst0 t3 x0 H3 u2 w O H x H1))))) H5)) +(pr0_subst0 t5 x0 H4 u3 w0 O H0 x H2))))))))))))))). + +theorem pr0_confluence__pr0_delta_epsilon: + \forall (u2: T).(\forall (t3: T).(\forall (w: T).((subst0 O u2 t3 w) \to +(\forall (t4: T).((pr0 (lift (S O) O t4) t3) \to (\forall (t2: T).(ex2 T +(\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda (t: T).(pr0 t2 +t))))))))) +\def + \lambda (u2: T).(\lambda (t3: T).(\lambda (w: T).(\lambda (H: (subst0 O u2 +t3 w)).(\lambda (t4: T).(\lambda (H0: (pr0 (lift (S O) O t4) t3)).(\lambda +(t2: T).(ex2_ind T (\lambda (t5: T).(eq T t3 (lift (S O) O t5))) (\lambda +(t5: T).(pr0 t4 t5)) (ex2 T (\lambda (t: T).(pr0 (THead (Bind Abbr) u2 w) t)) +(\lambda (t: T).(pr0 t2 t))) (\lambda (x: T).(\lambda (H1: (eq T t3 (lift (S +O) O x))).(\lambda (_: (pr0 t4 x)).(let H3 \def (eq_ind T t3 (\lambda (t: +T).(subst0 O u2 t w)) H (lift (S O) O x) H1) in (subst0_gen_lift_false x u2 w +(S O) O O (le_n O) (eq_ind_r nat (plus (S O) O) (\lambda (n: nat).(lt O n)) +(le_n (plus (S O) O)) (plus O (S O)) (plus_comm O (S O))) H3 (ex2 T (\lambda +(t: T).(pr0 (THead (Bind Abbr) u2 w) t)) (\lambda (t: T).(pr0 t2 t)))))))) +(pr0_gen_lift t4 t3 (S O) O H0)))))))). + +theorem pr0_confluence: + \forall (t0: T).(\forall (t1: T).((pr0 t0 t1) \to (\forall (t2: T).((pr0 t0 +t2) \to (ex2 T (\lambda (t: T).(pr0 t1 t)) (\lambda (t: T).(pr0 t2 t))))))) +\def + \lambda (t0: T).(tlt_wf_ind (\lambda (t: T).(\forall (t1: T).((pr0 t t1) \to +(\forall (t2: T).((pr0 t t2) \to (ex2 T (\lambda (t3: T).(pr0 t1 t3)) +(\lambda (t3: T).(pr0 t2 t3)))))))) (\lambda (t: T).(\lambda (H: ((\forall +(v: T).((tlt v t) \to (\forall (t1: T).((pr0 v t1) \to (\forall (t2: T).((pr0 +v t2) \to (ex2 T (\lambda (t3: T).(pr0 t1 t3)) (\lambda (t3: T).(pr0 t2 +t3))))))))))).(\lambda (t1: T).(\lambda (H0: (pr0 t t1)).(\lambda (t2: +T).(\lambda (H1: (pr0 t t2)).(let H2 \def (match H0 in pr0 return (\lambda +(t3: T).(\lambda (t4: T).(\lambda (_: (pr0 t3 t4)).((eq T t3 t) \to ((eq T t4 +t1) \to (ex2 T (\lambda (t5: T).(pr0 t1 t5)) (\lambda (t5: T).(pr0 t2 +t5)))))))) with [(pr0_refl t3) \Rightarrow (\lambda (H2: (eq T t3 +t)).(\lambda (H3: (eq T t3 t1)).(eq_ind T t (\lambda (t4: T).((eq T t4 t1) +\to (ex2 T (\lambda (t5: T).(pr0 t1 t5)) (\lambda (t5: T).(pr0 t2 t5))))) +(\lambda (H4: (eq T t t1)).(eq_ind T t1 (\lambda (_: T).(ex2 T (\lambda (t5: +T).(pr0 t1 t5)) (\lambda (t5: T).(pr0 t2 t5)))) (let H5 \def (match H1 in pr0 +return (\lambda (t4: T).(\lambda (t5: T).(\lambda (_: (pr0 t4 t5)).((eq T t4 +t) \to ((eq T t5 t2) \to (ex2 T (\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: +T).(pr0 t2 t6)))))))) with [(pr0_refl t4) \Rightarrow (\lambda (H5: (eq T t4 +t)).(\lambda (H6: (eq T t4 t2)).(eq_ind T t (\lambda (t5: T).((eq T t5 t2) +\to (ex2 T (\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 t2 t6))))) +(\lambda (H7: (eq T t t2)).(eq_ind T t2 (\lambda (_: T).(ex2 T (\lambda (t6: +T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 t2 t6)))) (let H8 \def (eq_ind T t +(\lambda (t5: T).(eq T t4 t5)) H5 t2 H7) in (let H9 \def (eq_ind T t (\lambda +(t5: T).(eq T t5 t1)) H4 t2 H7) in (let H10 \def (eq_ind T t (\lambda (t5: +T).(eq T t3 t5)) H2 t2 H7) in (let H11 \def (eq_ind T t (\lambda (t5: +T).(\forall (v: T).((tlt v t5) \to (\forall (t6: T).((pr0 v t6) \to (\forall +(t7: T).((pr0 v t7) \to (ex2 T (\lambda (t8: T).(pr0 t6 t8)) (\lambda (t8: +T).(pr0 t7 t8)))))))))) H t2 H7) in (let H12 \def (eq_ind T t2 (\lambda (t5: +T).(\forall (v: T).((tlt v t5) \to (\forall (t6: T).((pr0 v t6) \to (\forall +(t7: T).((pr0 v t7) \to (ex2 T (\lambda (t8: T).(pr0 t6 t8)) (\lambda (t8: +T).(pr0 t7 t8)))))))))) H11 t1 H9) in (eq_ind_r T t1 (\lambda (t5: T).(ex2 T +(\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 t5 t6)))) (let H13 \def +(eq_ind T t2 (\lambda (t5: T).(eq T t3 t5)) H10 t1 H9) in (ex_intro2 T +(\lambda (t5: T).(pr0 t1 t5)) (\lambda (t5: T).(pr0 t1 t5)) t1 (pr0_refl t1) +(pr0_refl t1))) t2 H9)))))) t (sym_eq T t t2 H7))) t4 (sym_eq T t4 t H5) +H6))) | (pr0_comp u1 u2 H5 t4 t5 H6 k) \Rightarrow (\lambda (H7: (eq T (THead +k u1 t4) t)).(\lambda (H8: (eq T (THead k u2 t5) t2)).(eq_ind T (THead k u1 +t4) (\lambda (_: T).((eq T (THead k u2 t5) t2) \to ((pr0 u1 u2) \to ((pr0 t4 +t5) \to (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 +t7))))))) (\lambda (H9: (eq T (THead k u2 t5) t2)).(eq_ind T (THead k u2 t5) +(\lambda (t6: T).((pr0 u1 u2) \to ((pr0 t4 t5) \to (ex2 T (\lambda (t7: +T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t6 t7)))))) (\lambda (H10: (pr0 u1 +u2)).(\lambda (H11: (pr0 t4 t5)).(let H12 \def (eq_ind_r T t (\lambda (t6: +T).(eq T t6 t1)) H4 (THead k u1 t4) H7) in (eq_ind T (THead k u1 t4) (\lambda +(t6: T).(ex2 T (\lambda (t7: T).(pr0 t6 t7)) (\lambda (t7: T).(pr0 (THead k +u2 t5) t7)))) (let H13 \def (eq_ind_r T t (\lambda (t6: T).(eq T t3 t6)) H2 +(THead k u1 t4) H7) in (let H14 \def (eq_ind_r T t (\lambda (t6: T).(\forall +(v: T).((tlt v t6) \to (\forall (t7: T).((pr0 v t7) \to (\forall (t8: +T).((pr0 v t8) \to (ex2 T (\lambda (t9: T).(pr0 t7 t9)) (\lambda (t9: T).(pr0 +t8 t9)))))))))) H (THead k u1 t4) H7) in (ex_intro2 T (\lambda (t6: T).(pr0 +(THead k u1 t4) t6)) (\lambda (t6: T).(pr0 (THead k u2 t5) t6)) (THead k u2 +t5) (pr0_comp u1 u2 H10 t4 t5 H11 k) (pr0_refl (THead k u2 t5))))) t1 H12)))) +t2 H9)) t H7 H8 H5 H6))) | (pr0_beta u v1 v2 H5 t4 t5 H6) \Rightarrow +(\lambda (H7: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t4)) +t)).(\lambda (H8: (eq T (THead (Bind Abbr) v2 t5) t2)).(eq_ind T (THead (Flat +Appl) v1 (THead (Bind Abst) u t4)) (\lambda (_: T).((eq T (THead (Bind Abbr) +v2 t5) t2) \to ((pr0 v1 v2) \to ((pr0 t4 t5) \to (ex2 T (\lambda (t7: T).(pr0 +t1 t7)) (\lambda (t7: T).(pr0 t2 t7))))))) (\lambda (H9: (eq T (THead (Bind +Abbr) v2 t5) t2)).(eq_ind T (THead (Bind Abbr) v2 t5) (\lambda (t6: T).((pr0 +v1 v2) \to ((pr0 t4 t5) \to (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda +(t7: T).(pr0 t6 t7)))))) (\lambda (H10: (pr0 v1 v2)).(\lambda (H11: (pr0 t4 +t5)).(let H12 \def (eq_ind_r T t (\lambda (t6: T).(eq T t6 t1)) H4 (THead +(Flat Appl) v1 (THead (Bind Abst) u t4)) H7) in (eq_ind T (THead (Flat Appl) +v1 (THead (Bind Abst) u t4)) (\lambda (t6: T).(ex2 T (\lambda (t7: T).(pr0 t6 +t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t5) t7)))) (let H13 \def +(eq_ind_r T t (\lambda (t6: T).(eq T t3 t6)) H2 (THead (Flat Appl) v1 (THead +(Bind Abst) u t4)) H7) in (let H14 \def (eq_ind_r T t (\lambda (t6: +T).(\forall (v: T).((tlt v t6) \to (\forall (t7: T).((pr0 v t7) \to (\forall +(t8: T).((pr0 v t8) \to (ex2 T (\lambda (t9: T).(pr0 t7 t9)) (\lambda (t9: +T).(pr0 t8 t9)))))))))) H (THead (Flat Appl) v1 (THead (Bind Abst) u t4)) H7) +in (ex_intro2 T (\lambda (t6: T).(pr0 (THead (Flat Appl) v1 (THead (Bind +Abst) u t4)) t6)) (\lambda (t6: T).(pr0 (THead (Bind Abbr) v2 t5) t6)) (THead +(Bind Abbr) v2 t5) (pr0_beta u v1 v2 H10 t4 t5 H11) (pr0_refl (THead (Bind +Abbr) v2 t5))))) t1 H12)))) t2 H9)) t H7 H8 H5 H6))) | (pr0_upsilon b H5 v1 +v2 H6 u1 u2 H7 t4 t5 H8) \Rightarrow (\lambda (H9: (eq T (THead (Flat Appl) +v1 (THead (Bind b) u1 t4)) t)).(\lambda (H10: (eq T (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t5)) t2)).(eq_ind T (THead (Flat Appl) v1 +(THead (Bind b) u1 t4)) (\lambda (_: T).((eq T (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t5)) t2) \to ((not (eq B b Abst)) \to ((pr0 v1 +v2) \to ((pr0 u1 u2) \to ((pr0 t4 t5) \to (ex2 T (\lambda (t7: T).(pr0 t1 +t7)) (\lambda (t7: T).(pr0 t2 t7))))))))) (\lambda (H11: (eq T (THead (Bind +b) u2 (THead (Flat Appl) (lift (S O) O v2) t5)) t2)).(eq_ind T (THead (Bind +b) u2 (THead (Flat Appl) (lift (S O) O v2) t5)) (\lambda (t6: T).((not (eq B +b Abst)) \to ((pr0 v1 v2) \to ((pr0 u1 u2) \to ((pr0 t4 t5) \to (ex2 T +(\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t6 t7)))))))) (\lambda +(H12: (not (eq B b Abst))).(\lambda (H13: (pr0 v1 v2)).(\lambda (H14: (pr0 u1 +u2)).(\lambda (H15: (pr0 t4 t5)).(let H16 \def (eq_ind_r T t (\lambda (t6: +T).(eq T t6 t1)) H4 (THead (Flat Appl) v1 (THead (Bind b) u1 t4)) H9) in +(eq_ind T (THead (Flat Appl) v1 (THead (Bind b) u1 t4)) (\lambda (t6: T).(ex2 +T (\lambda (t7: T).(pr0 t6 t7)) (\lambda (t7: T).(pr0 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t5)) t7)))) (let H17 \def (eq_ind_r T t +(\lambda (t6: T).(eq T t3 t6)) H2 (THead (Flat Appl) v1 (THead (Bind b) u1 +t4)) H9) in (let H18 \def (eq_ind_r T t (\lambda (t6: T).(\forall (v: +T).((tlt v t6) \to (\forall (t7: T).((pr0 v t7) \to (\forall (t8: T).((pr0 v +t8) \to (ex2 T (\lambda (t9: T).(pr0 t7 t9)) (\lambda (t9: T).(pr0 t8 +t9)))))))))) H (THead (Flat Appl) v1 (THead (Bind b) u1 t4)) H9) in +(pr0_confluence__pr0_cong_upsilon_refl b H12 u1 u2 H14 t4 t5 H15 v1 v2 v2 H13 +(pr0_refl v2)))) t1 H16)))))) t2 H11)) t H9 H10 H5 H6 H7 H8))) | (pr0_delta +u1 u2 H5 t4 t5 H6 w H7) \Rightarrow (\lambda (H8: (eq T (THead (Bind Abbr) u1 +t4) t)).(\lambda (H9: (eq T (THead (Bind Abbr) u2 w) t2)).(eq_ind T (THead +(Bind Abbr) u1 t4) (\lambda (_: T).((eq T (THead (Bind Abbr) u2 w) t2) \to +((pr0 u1 u2) \to ((pr0 t4 t5) \to ((subst0 O u2 t5 w) \to (ex2 T (\lambda +(t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7)))))))) (\lambda (H10: (eq T +(THead (Bind Abbr) u2 w) t2)).(eq_ind T (THead (Bind Abbr) u2 w) (\lambda +(t6: T).((pr0 u1 u2) \to ((pr0 t4 t5) \to ((subst0 O u2 t5 w) \to (ex2 T +(\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t6 t7))))))) (\lambda +(H11: (pr0 u1 u2)).(\lambda (H12: (pr0 t4 t5)).(\lambda (H13: (subst0 O u2 t5 +w)).(let H14 \def (eq_ind_r T t (\lambda (t6: T).(eq T t6 t1)) H4 (THead +(Bind Abbr) u1 t4) H8) in (eq_ind T (THead (Bind Abbr) u1 t4) (\lambda (t6: +T).(ex2 T (\lambda (t7: T).(pr0 t6 t7)) (\lambda (t7: T).(pr0 (THead (Bind +Abbr) u2 w) t7)))) (let H15 \def (eq_ind_r T t (\lambda (t6: T).(eq T t3 t6)) +H2 (THead (Bind Abbr) u1 t4) H8) in (let H16 \def (eq_ind_r T t (\lambda (t6: +T).(\forall (v: T).((tlt v t6) \to (\forall (t7: T).((pr0 v t7) \to (\forall +(t8: T).((pr0 v t8) \to (ex2 T (\lambda (t9: T).(pr0 t7 t9)) (\lambda (t9: +T).(pr0 t8 t9)))))))))) H (THead (Bind Abbr) u1 t4) H8) in (ex_intro2 T +(\lambda (t6: T).(pr0 (THead (Bind Abbr) u1 t4) t6)) (\lambda (t6: T).(pr0 +(THead (Bind Abbr) u2 w) t6)) (THead (Bind Abbr) u2 w) (pr0_delta u1 u2 H11 +t4 t5 H12 w H13) (pr0_refl (THead (Bind Abbr) u2 w))))) t1 H14))))) t2 H10)) +t H8 H9 H5 H6 H7))) | (pr0_zeta b H5 t4 t5 H6 u) \Rightarrow (\lambda (H7: +(eq T (THead (Bind b) u (lift (S O) O t4)) t)).(\lambda (H8: (eq T t5 +t2)).(eq_ind T (THead (Bind b) u (lift (S O) O t4)) (\lambda (_: T).((eq T t5 +t2) \to ((not (eq B b Abst)) \to ((pr0 t4 t5) \to (ex2 T (\lambda (t7: +T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7))))))) (\lambda (H9: (eq T t5 +t2)).(eq_ind T t2 (\lambda (t6: T).((not (eq B b Abst)) \to ((pr0 t4 t6) \to +(ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7)))))) +(\lambda (H10: (not (eq B b Abst))).(\lambda (H11: (pr0 t4 t2)).(let H12 \def +(eq_ind_r T t (\lambda (t6: T).(eq T t6 t1)) H4 (THead (Bind b) u (lift (S O) +O t4)) H7) in (eq_ind T (THead (Bind b) u (lift (S O) O t4)) (\lambda (t6: +T).(ex2 T (\lambda (t7: T).(pr0 t6 t7)) (\lambda (t7: T).(pr0 t2 t7)))) (let +H13 \def (eq_ind_r T t (\lambda (t6: T).(eq T t3 t6)) H2 (THead (Bind b) u +(lift (S O) O t4)) H7) in (let H14 \def (eq_ind_r T t (\lambda (t6: +T).(\forall (v: T).((tlt v t6) \to (\forall (t7: T).((pr0 v t7) \to (\forall +(t8: T).((pr0 v t8) \to (ex2 T (\lambda (t9: T).(pr0 t7 t9)) (\lambda (t9: +T).(pr0 t8 t9)))))))))) H (THead (Bind b) u (lift (S O) O t4)) H7) in +(ex_intro2 T (\lambda (t6: T).(pr0 (THead (Bind b) u (lift (S O) O t4)) t6)) +(\lambda (t6: T).(pr0 t2 t6)) t2 (pr0_zeta b H10 t4 t2 H11 u) (pr0_refl +t2)))) t1 H12)))) t5 (sym_eq T t5 t2 H9))) t H7 H8 H5 H6))) | (pr0_epsilon t4 +t5 H5 u) \Rightarrow (\lambda (H6: (eq T (THead (Flat Cast) u t4) +t)).(\lambda (H7: (eq T t5 t2)).(eq_ind T (THead (Flat Cast) u t4) (\lambda +(_: T).((eq T t5 t2) \to ((pr0 t4 t5) \to (ex2 T (\lambda (t7: T).(pr0 t1 +t7)) (\lambda (t7: T).(pr0 t2 t7)))))) (\lambda (H8: (eq T t5 t2)).(eq_ind T +t2 (\lambda (t6: T).((pr0 t4 t6) \to (ex2 T (\lambda (t7: T).(pr0 t1 t7)) +(\lambda (t7: T).(pr0 t2 t7))))) (\lambda (H9: (pr0 t4 t2)).(let H10 \def +(eq_ind_r T t (\lambda (t6: T).(eq T t6 t1)) H4 (THead (Flat Cast) u t4) H6) +in (eq_ind T (THead (Flat Cast) u t4) (\lambda (t6: T).(ex2 T (\lambda (t7: +T).(pr0 t6 t7)) (\lambda (t7: T).(pr0 t2 t7)))) (let H11 \def (eq_ind_r T t +(\lambda (t6: T).(eq T t3 t6)) H2 (THead (Flat Cast) u t4) H6) in (let H12 +\def (eq_ind_r T t (\lambda (t6: T).(\forall (v: T).((tlt v t6) \to (\forall +(t7: T).((pr0 v t7) \to (\forall (t8: T).((pr0 v t8) \to (ex2 T (\lambda (t9: +T).(pr0 t7 t9)) (\lambda (t9: T).(pr0 t8 t9)))))))))) H (THead (Flat Cast) u +t4) H6) in (ex_intro2 T (\lambda (t6: T).(pr0 (THead (Flat Cast) u t4) t6)) +(\lambda (t6: T).(pr0 t2 t6)) t2 (pr0_epsilon t4 t2 H9 u) (pr0_refl t2)))) t1 +H10))) t5 (sym_eq T t5 t2 H8))) t H6 H7 H5)))]) in (H5 (refl_equal T t) +(refl_equal T t2))) t (sym_eq T t t1 H4))) t3 (sym_eq T t3 t H2) H3))) | +(pr0_comp u1 u2 H2 t3 t4 H3 k) \Rightarrow (\lambda (H4: (eq T (THead k u1 +t3) t)).(\lambda (H5: (eq T (THead k u2 t4) t1)).(eq_ind T (THead k u1 t3) +(\lambda (_: T).((eq T (THead k u2 t4) t1) \to ((pr0 u1 u2) \to ((pr0 t3 t4) +\to (ex2 T (\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 t2 t6))))))) +(\lambda (H6: (eq T (THead k u2 t4) t1)).(eq_ind T (THead k u2 t4) (\lambda +(t5: T).((pr0 u1 u2) \to ((pr0 t3 t4) \to (ex2 T (\lambda (t6: T).(pr0 t5 +t6)) (\lambda (t6: T).(pr0 t2 t6)))))) (\lambda (H7: (pr0 u1 u2)).(\lambda +(H8: (pr0 t3 t4)).(let H9 \def (match H1 in pr0 return (\lambda (t5: +T).(\lambda (t6: T).(\lambda (_: (pr0 t5 t6)).((eq T t5 t) \to ((eq T t6 t2) +\to (ex2 T (\lambda (t7: T).(pr0 (THead k u2 t4) t7)) (\lambda (t7: T).(pr0 +t2 t7)))))))) with [(pr0_refl t5) \Rightarrow (\lambda (H9: (eq T t5 +t)).(\lambda (H10: (eq T t5 t2)).(eq_ind T t (\lambda (t6: T).((eq T t6 t2) +\to (ex2 T (\lambda (t7: T).(pr0 (THead k u2 t4) t7)) (\lambda (t7: T).(pr0 +t2 t7))))) (\lambda (H11: (eq T t t2)).(eq_ind T t2 (\lambda (_: T).(ex2 T +(\lambda (t7: T).(pr0 (THead k u2 t4) t7)) (\lambda (t7: T).(pr0 t2 t7)))) +(let H12 \def (eq_ind_r T t (\lambda (t6: T).(eq T t6 t2)) H11 (THead k u1 +t3) H4) in (eq_ind T (THead k u1 t3) (\lambda (t6: T).(ex2 T (\lambda (t7: +T).(pr0 (THead k u2 t4) t7)) (\lambda (t7: T).(pr0 t6 t7)))) (let H13 \def +(eq_ind_r T t (\lambda (t6: T).(eq T t5 t6)) H9 (THead k u1 t3) H4) in (let +H14 \def (eq_ind_r T t (\lambda (t6: T).(\forall (v: T).((tlt v t6) \to +(\forall (t7: T).((pr0 v t7) \to (\forall (t8: T).((pr0 v t8) \to (ex2 T +(\lambda (t9: T).(pr0 t7 t9)) (\lambda (t9: T).(pr0 t8 t9)))))))))) H (THead +k u1 t3) H4) in (ex_intro2 T (\lambda (t6: T).(pr0 (THead k u2 t4) t6)) +(\lambda (t6: T).(pr0 (THead k u1 t3) t6)) (THead k u2 t4) (pr0_refl (THead k +u2 t4)) (pr0_comp u1 u2 H7 t3 t4 H8 k)))) t2 H12)) t (sym_eq T t t2 H11))) t5 +(sym_eq T t5 t H9) H10))) | (pr0_comp u0 u3 H9 t5 t6 H10 k0) \Rightarrow +(\lambda (H11: (eq T (THead k0 u0 t5) t)).(\lambda (H12: (eq T (THead k0 u3 +t6) t2)).(eq_ind T (THead k0 u0 t5) (\lambda (_: T).((eq T (THead k0 u3 t6) +t2) \to ((pr0 u0 u3) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead +k u2 t4) t8)) (\lambda (t8: T).(pr0 t2 t8))))))) (\lambda (H13: (eq T (THead +k0 u3 t6) t2)).(eq_ind T (THead k0 u3 t6) (\lambda (t7: T).((pr0 u0 u3) \to +((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead k u2 t4) t8)) (\lambda +(t8: T).(pr0 t7 t8)))))) (\lambda (H14: (pr0 u0 u3)).(\lambda (H15: (pr0 t5 +t6)).(let H16 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead k u1 t3) t7)) +H4 (THead k0 u0 t5) H11) in (let H17 \def (match H16 in eq return (\lambda +(t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead k0 u0 t5)) \to (ex2 T +(\lambda (t8: T).(pr0 (THead k u2 t4) t8)) (\lambda (t8: T).(pr0 (THead k0 u3 +t6) t8)))))) with [refl_equal \Rightarrow (\lambda (H17: (eq T (THead k u1 +t3) (THead k0 u0 t5))).(let H18 \def (f_equal T T (\lambda (e: T).(match e in +T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) +\Rightarrow t3 | (THead _ _ t7) \Rightarrow t7])) (THead k u1 t3) (THead k0 +u0 t5) H17) in ((let H19 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | (TLRef _) +\Rightarrow u1 | (THead _ t7 _) \Rightarrow t7])) (THead k u1 t3) (THead k0 +u0 t5) H17) in ((let H20 \def (f_equal T K (\lambda (e: T).(match e in T +return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k1 _ _) \Rightarrow k1])) (THead k u1 t3) (THead k0 u0 +t5) H17) in (eq_ind K k0 (\lambda (k1: K).((eq T u1 u0) \to ((eq T t3 t5) \to +(ex2 T (\lambda (t7: T).(pr0 (THead k1 u2 t4) t7)) (\lambda (t7: T).(pr0 +(THead k0 u3 t6) t7)))))) (\lambda (H21: (eq T u1 u0)).(eq_ind T u0 (\lambda +(_: T).((eq T t3 t5) \to (ex2 T (\lambda (t8: T).(pr0 (THead k0 u2 t4) t8)) +(\lambda (t8: T).(pr0 (THead k0 u3 t6) t8))))) (\lambda (H22: (eq T t3 +t5)).(eq_ind T t5 (\lambda (_: T).(ex2 T (\lambda (t8: T).(pr0 (THead k0 u2 +t4) t8)) (\lambda (t8: T).(pr0 (THead k0 u3 t6) t8)))) (let H23 \def +(eq_ind_r T t (\lambda (t7: T).(\forall (v: T).((tlt v t7) \to (\forall (t8: +T).((pr0 v t8) \to (\forall (t9: T).((pr0 v t9) \to (ex2 T (\lambda (t10: +T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 t10)))))))))) H (THead k0 u0 t5) +H11) in (let H24 \def (eq_ind T t3 (\lambda (t7: T).(pr0 t7 t4)) H8 t5 H22) +in (let H25 \def (eq_ind T u1 (\lambda (t7: T).(pr0 t7 u2)) H7 u0 H21) in +(ex2_ind T (\lambda (t7: T).(pr0 u2 t7)) (\lambda (t7: T).(pr0 u3 t7)) (ex2 T +(\lambda (t7: T).(pr0 (THead k0 u2 t4) t7)) (\lambda (t7: T).(pr0 (THead k0 +u3 t6) t7))) (\lambda (x: T).(\lambda (H26: (pr0 u2 x)).(\lambda (H27: (pr0 +u3 x)).(ex2_ind T (\lambda (t7: T).(pr0 t4 t7)) (\lambda (t7: T).(pr0 t6 t7)) +(ex2 T (\lambda (t7: T).(pr0 (THead k0 u2 t4) t7)) (\lambda (t7: T).(pr0 +(THead k0 u3 t6) t7))) (\lambda (x0: T).(\lambda (H28: (pr0 t4 x0)).(\lambda +(H29: (pr0 t6 x0)).(ex_intro2 T (\lambda (t7: T).(pr0 (THead k0 u2 t4) t7)) +(\lambda (t7: T).(pr0 (THead k0 u3 t6) t7)) (THead k0 x x0) (pr0_comp u2 x +H26 t4 x0 H28 k0) (pr0_comp u3 x H27 t6 x0 H29 k0))))) (H23 t5 (tlt_head_dx +k0 u0 t5) t4 H24 t6 H15))))) (H23 u0 (tlt_head_sx k0 u0 t5) u2 H25 u3 +H14))))) t3 (sym_eq T t3 t5 H22))) u1 (sym_eq T u1 u0 H21))) k (sym_eq K k k0 +H20))) H19)) H18)))]) in (H17 (refl_equal T (THead k0 u0 t5))))))) t2 H13)) t +H11 H12 H9 H10))) | (pr0_beta u v1 v2 H9 t5 t6 H10) \Rightarrow (\lambda +(H11: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t5)) t)).(\lambda +(H12: (eq T (THead (Bind Abbr) v2 t6) t2)).(eq_ind T (THead (Flat Appl) v1 +(THead (Bind Abst) u t5)) (\lambda (_: T).((eq T (THead (Bind Abbr) v2 t6) +t2) \to ((pr0 v1 v2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead +k u2 t4) t8)) (\lambda (t8: T).(pr0 t2 t8))))))) (\lambda (H13: (eq T (THead +(Bind Abbr) v2 t6) t2)).(eq_ind T (THead (Bind Abbr) v2 t6) (\lambda (t7: +T).((pr0 v1 v2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead k u2 +t4) t8)) (\lambda (t8: T).(pr0 t7 t8)))))) (\lambda (H14: (pr0 v1 +v2)).(\lambda (H15: (pr0 t5 t6)).(let H16 \def (eq_ind_r T t (\lambda (t7: +T).(eq T (THead k u1 t3) t7)) H4 (THead (Flat Appl) v1 (THead (Bind Abst) u +t5)) H11) in (let H17 \def (match H16 in eq return (\lambda (t7: T).(\lambda +(_: (eq ? ? t7)).((eq T t7 (THead (Flat Appl) v1 (THead (Bind Abst) u t5))) +\to (ex2 T (\lambda (t8: T).(pr0 (THead k u2 t4) t8)) (\lambda (t8: T).(pr0 +(THead (Bind Abbr) v2 t6) t8)))))) with [refl_equal \Rightarrow (\lambda +(H17: (eq T (THead k u1 t3) (THead (Flat Appl) v1 (THead (Bind Abst) u +t5)))).(let H18 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 +| (THead _ _ t7) \Rightarrow t7])) (THead k u1 t3) (THead (Flat Appl) v1 +(THead (Bind Abst) u t5)) H17) in ((let H19 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | +(TLRef _) \Rightarrow u1 | (THead _ t7 _) \Rightarrow t7])) (THead k u1 t3) +(THead (Flat Appl) v1 (THead (Bind Abst) u t5)) H17) in ((let H20 \def +(f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) with +[(TSort _) \Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) +\Rightarrow k0])) (THead k u1 t3) (THead (Flat Appl) v1 (THead (Bind Abst) u +t5)) H17) in (eq_ind K (Flat Appl) (\lambda (k0: K).((eq T u1 v1) \to ((eq T +t3 (THead (Bind Abst) u t5)) \to (ex2 T (\lambda (t7: T).(pr0 (THead k0 u2 +t4) t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t6) t7)))))) (\lambda +(H21: (eq T u1 v1)).(eq_ind T v1 (\lambda (_: T).((eq T t3 (THead (Bind Abst) +u t5)) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Flat Appl) u2 t4) t8)) +(\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t6) t8))))) (\lambda (H22: (eq T +t3 (THead (Bind Abst) u t5))).(eq_ind T (THead (Bind Abst) u t5) (\lambda (_: +T).(ex2 T (\lambda (t8: T).(pr0 (THead (Flat Appl) u2 t4) t8)) (\lambda (t8: +T).(pr0 (THead (Bind Abbr) v2 t6) t8)))) (let H23 \def (eq_ind_r T t (\lambda +(t7: T).(\forall (v: T).((tlt v t7) \to (\forall (t8: T).((pr0 v t8) \to +(\forall (t9: T).((pr0 v t9) \to (ex2 T (\lambda (t10: T).(pr0 t8 t10)) +(\lambda (t10: T).(pr0 t9 t10)))))))))) H (THead (Flat Appl) v1 (THead (Bind +Abst) u t5)) H11) in (let H24 \def (eq_ind T t3 (\lambda (t7: T).(pr0 t7 t4)) +H8 (THead (Bind Abst) u t5) H22) in (let H25 \def (match H24 in pr0 return +(\lambda (t7: T).(\lambda (t8: T).(\lambda (_: (pr0 t7 t8)).((eq T t7 (THead +(Bind Abst) u t5)) \to ((eq T t8 t4) \to (ex2 T (\lambda (t9: T).(pr0 (THead +(Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t6) +t9)))))))) with [(pr0_refl t7) \Rightarrow (\lambda (H25: (eq T t7 (THead +(Bind Abst) u t5))).(\lambda (H26: (eq T t7 t4)).(eq_ind T (THead (Bind Abst) +u t5) (\lambda (t8: T).((eq T t8 t4) \to (ex2 T (\lambda (t9: T).(pr0 (THead +(Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t6) +t9))))) (\lambda (H27: (eq T (THead (Bind Abst) u t5) t4)).(eq_ind T (THead +(Bind Abst) u t5) (\lambda (t8: T).(ex2 T (\lambda (t9: T).(pr0 (THead (Flat +Appl) u2 t8) t9)) (\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t6) t9)))) (let +H28 \def (eq_ind T u1 (\lambda (t8: T).(pr0 t8 u2)) H7 v1 H21) in (ex2_ind T +(\lambda (t8: T).(pr0 u2 t8)) (\lambda (t8: T).(pr0 v2 t8)) (ex2 T (\lambda +(t8: T).(pr0 (THead (Flat Appl) u2 (THead (Bind Abst) u t5)) t8)) (\lambda +(t8: T).(pr0 (THead (Bind Abbr) v2 t6) t8))) (\lambda (x: T).(\lambda (H29: +(pr0 u2 x)).(\lambda (H30: (pr0 v2 x)).(ex_intro2 T (\lambda (t8: T).(pr0 +(THead (Flat Appl) u2 (THead (Bind Abst) u t5)) t8)) (\lambda (t8: T).(pr0 +(THead (Bind Abbr) v2 t6) t8)) (THead (Bind Abbr) x t6) (pr0_beta u u2 x H29 +t5 t6 H15) (pr0_comp v2 x H30 t6 t6 (pr0_refl t6) (Bind Abbr)))))) (H23 v1 +(tlt_head_sx (Flat Appl) v1 (THead (Bind Abst) u t5)) u2 H28 v2 H14))) t4 +H27)) t7 (sym_eq T t7 (THead (Bind Abst) u t5) H25) H26))) | (pr0_comp u0 u3 +H25 t7 t8 H26 k0) \Rightarrow (\lambda (H27: (eq T (THead k0 u0 t7) (THead +(Bind Abst) u t5))).(\lambda (H28: (eq T (THead k0 u3 t8) t4)).((let H29 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t7 | (TLRef _) \Rightarrow t7 | (THead _ _ t9) +\Rightarrow t9])) (THead k0 u0 t7) (THead (Bind Abst) u t5) H27) in ((let H30 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t9 _) +\Rightarrow t9])) (THead k0 u0 t7) (THead (Bind Abst) u t5) H27) in ((let H31 +\def (f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) +with [(TSort _) \Rightarrow k0 | (TLRef _) \Rightarrow k0 | (THead k1 _ _) +\Rightarrow k1])) (THead k0 u0 t7) (THead (Bind Abst) u t5) H27) in (eq_ind K +(Bind Abst) (\lambda (k1: K).((eq T u0 u) \to ((eq T t7 t5) \to ((eq T (THead +k1 u3 t8) t4) \to ((pr0 u0 u3) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t9: +T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Bind +Abbr) v2 t6) t9))))))))) (\lambda (H32: (eq T u0 u)).(eq_ind T u (\lambda +(t9: T).((eq T t7 t5) \to ((eq T (THead (Bind Abst) u3 t8) t4) \to ((pr0 t9 +u3) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 +t4) t10)) (\lambda (t10: T).(pr0 (THead (Bind Abbr) v2 t6) t10)))))))) +(\lambda (H33: (eq T t7 t5)).(eq_ind T t5 (\lambda (t9: T).((eq T (THead +(Bind Abst) u3 t8) t4) \to ((pr0 u u3) \to ((pr0 t9 t8) \to (ex2 T (\lambda +(t10: T).(pr0 (THead (Flat Appl) u2 t4) t10)) (\lambda (t10: T).(pr0 (THead +(Bind Abbr) v2 t6) t10))))))) (\lambda (H34: (eq T (THead (Bind Abst) u3 t8) +t4)).(eq_ind T (THead (Bind Abst) u3 t8) (\lambda (t9: T).((pr0 u u3) \to +((pr0 t5 t8) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t9) +t10)) (\lambda (t10: T).(pr0 (THead (Bind Abbr) v2 t6) t10)))))) (\lambda (_: +(pr0 u u3)).(\lambda (H36: (pr0 t5 t8)).(let H37 \def (eq_ind T u1 (\lambda +(t9: T).(pr0 t9 u2)) H7 v1 H21) in (ex2_ind T (\lambda (t9: T).(pr0 u2 t9)) +(\lambda (t9: T).(pr0 v2 t9)) (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) +u2 (THead (Bind Abst) u3 t8)) t9)) (\lambda (t9: T).(pr0 (THead (Bind Abbr) +v2 t6) t9))) (\lambda (x: T).(\lambda (H38: (pr0 u2 x)).(\lambda (H39: (pr0 +v2 x)).(ex2_ind T (\lambda (t9: T).(pr0 t8 t9)) (\lambda (t9: T).(pr0 t6 t9)) +(ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 (THead (Bind Abst) u3 t8)) +t9)) (\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t6) t9))) (\lambda (x0: +T).(\lambda (H40: (pr0 t8 x0)).(\lambda (H41: (pr0 t6 x0)).(ex_intro2 T +(\lambda (t9: T).(pr0 (THead (Flat Appl) u2 (THead (Bind Abst) u3 t8)) t9)) +(\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t6) t9)) (THead (Bind Abbr) x x0) +(pr0_beta u3 u2 x H38 t8 x0 H40) (pr0_comp v2 x H39 t6 x0 H41 (Bind +Abbr)))))) (H23 t5 (tlt_trans (THead (Bind Abst) u t5) t5 (THead (Flat Appl) +v1 (THead (Bind Abst) u t5)) (tlt_head_dx (Bind Abst) u t5) (tlt_head_dx +(Flat Appl) v1 (THead (Bind Abst) u t5))) t8 H36 t6 H15))))) (H23 v1 +(tlt_head_sx (Flat Appl) v1 (THead (Bind Abst) u t5)) u2 H37 v2 H14))))) t4 +H34)) t7 (sym_eq T t7 t5 H33))) u0 (sym_eq T u0 u H32))) k0 (sym_eq K k0 +(Bind Abst) H31))) H30)) H29)) H28 H25 H26))) | (pr0_beta u0 v0 v3 H25 t7 t8 +H26) \Rightarrow (\lambda (H27: (eq T (THead (Flat Appl) v0 (THead (Bind +Abst) u0 t7)) (THead (Bind Abst) u t5))).(\lambda (H28: (eq T (THead (Bind +Abbr) v3 t8) t4)).((let H29 \def (eq_ind T (THead (Flat Appl) v0 (THead (Bind +Abst) u0 t7)) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k0 _ _) +\Rightarrow (match k0 in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind Abst) u t5) +H27) in (False_ind ((eq T (THead (Bind Abbr) v3 t8) t4) \to ((pr0 v0 v3) \to +((pr0 t7 t8) \to (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) +(\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t6) t9)))))) H29)) H28 H25 H26))) +| (pr0_upsilon b H25 v0 v3 H26 u0 u3 H27 t7 t8 H28) \Rightarrow (\lambda +(H29: (eq T (THead (Flat Appl) v0 (THead (Bind b) u0 t7)) (THead (Bind Abst) +u t5))).(\lambda (H30: (eq T (THead (Bind b) u3 (THead (Flat Appl) (lift (S +O) O v3) t8)) t4)).((let H31 \def (eq_ind T (THead (Flat Appl) v0 (THead +(Bind b) u0 t7)) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k0 _ +_) \Rightarrow (match k0 in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind Abst) u t5) +H29) in (False_ind ((eq T (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O +v3) t8)) t4) \to ((not (eq B b Abst)) \to ((pr0 v0 v3) \to ((pr0 u0 u3) \to +((pr0 t7 t8) \to (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) +(\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t6) t9)))))))) H31)) H30 H25 H26 +H27 H28))) | (pr0_delta u0 u3 H25 t7 t8 H26 w H27) \Rightarrow (\lambda (H28: +(eq T (THead (Bind Abbr) u0 t7) (THead (Bind Abst) u t5))).(\lambda (H29: (eq +T (THead (Bind Abbr) u3 w) t4)).((let H30 \def (eq_ind T (THead (Bind Abbr) +u0 t7) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k0 _ _) +\Rightarrow (match k0 in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +True | Abst \Rightarrow False | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (THead (Bind Abst) u t5) H28) in (False_ind ((eq T +(THead (Bind Abbr) u3 w) t4) \to ((pr0 u0 u3) \to ((pr0 t7 t8) \to ((subst0 O +u3 t8 w) \to (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) +(\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t6) t9))))))) H30)) H29 H25 H26 +H27))) | (pr0_zeta b H25 t7 t8 H26 u0) \Rightarrow (\lambda (H27: (eq T +(THead (Bind b) u0 (lift (S O) O t7)) (THead (Bind Abst) u t5))).(\lambda +(H28: (eq T t8 t4)).((let H29 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map (f: +((nat \to nat))) (d: nat) (t9: T) on t9: T \def (match t9 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k0 u3 t10) +\Rightarrow (THead k0 (lref_map f d u3) (lref_map f (s k0 d) t10))]) in +lref_map) (\lambda (x: nat).(plus x (S O))) O t7) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t9: T) on t9: T \def (match +t9 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k0 u3 t10) \Rightarrow (THead k0 (lref_map f d u3) (lref_map f (s k0 +d) t10))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t7) | (THead _ _ +t9) \Rightarrow t9])) (THead (Bind b) u0 (lift (S O) O t7)) (THead (Bind +Abst) u t5) H27) in ((let H30 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) +\Rightarrow u0 | (THead _ t9 _) \Rightarrow t9])) (THead (Bind b) u0 (lift (S +O) O t7)) (THead (Bind Abst) u t5) H27) in ((let H31 \def (f_equal T B +(\lambda (e: T).(match e in T return (\lambda (_: T).B) with [(TSort _) +\Rightarrow b | (TLRef _) \Rightarrow b | (THead k0 _ _) \Rightarrow (match +k0 in K return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow b])])) (THead (Bind b) u0 (lift (S O) O t7)) (THead (Bind Abst) u +t5) H27) in (eq_ind B Abst (\lambda (b0: B).((eq T u0 u) \to ((eq T (lift (S +O) O t7) t5) \to ((eq T t8 t4) \to ((not (eq B b0 Abst)) \to ((pr0 t7 t8) \to +(ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: +T).(pr0 (THead (Bind Abbr) v2 t6) t9))))))))) (\lambda (H32: (eq T u0 +u)).(eq_ind T u (\lambda (_: T).((eq T (lift (S O) O t7) t5) \to ((eq T t8 +t4) \to ((not (eq B Abst Abst)) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t10: +T).(pr0 (THead (Flat Appl) u2 t4) t10)) (\lambda (t10: T).(pr0 (THead (Bind +Abbr) v2 t6) t10)))))))) (\lambda (H33: (eq T (lift (S O) O t7) t5)).(eq_ind +T (lift (S O) O t7) (\lambda (_: T).((eq T t8 t4) \to ((not (eq B Abst Abst)) +\to ((pr0 t7 t8) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t4) +t10)) (\lambda (t10: T).(pr0 (THead (Bind Abbr) v2 t6) t10))))))) (\lambda +(H34: (eq T t8 t4)).(eq_ind T t4 (\lambda (t9: T).((not (eq B Abst Abst)) \to +((pr0 t7 t9) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t4) +t10)) (\lambda (t10: T).(pr0 (THead (Bind Abbr) v2 t6) t10)))))) (\lambda +(H35: (not (eq B Abst Abst))).(\lambda (_: (pr0 t7 t4)).(let H37 \def (match +(H35 (refl_equal B Abst)) in False return (\lambda (_: False).(ex2 T (\lambda +(t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 (THead +(Bind Abbr) v2 t6) t9)))) with []) in H37))) t8 (sym_eq T t8 t4 H34))) t5 +H33)) u0 (sym_eq T u0 u H32))) b (sym_eq B b Abst H31))) H30)) H29)) H28 H25 +H26))) | (pr0_epsilon t7 t8 H25 u0) \Rightarrow (\lambda (H26: (eq T (THead +(Flat Cast) u0 t7) (THead (Bind Abst) u t5))).(\lambda (H27: (eq T t8 +t4)).((let H28 \def (eq_ind T (THead (Flat Cast) u0 t7) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in +K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind Abst) u t5) H26) in (False_ind ((eq T t8 +t4) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 +t4) t9)) (\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t6) t9))))) H28)) H27 +H25)))]) in (H25 (refl_equal T (THead (Bind Abst) u t5)) (refl_equal T +t4))))) t3 (sym_eq T t3 (THead (Bind Abst) u t5) H22))) u1 (sym_eq T u1 v1 +H21))) k (sym_eq K k (Flat Appl) H20))) H19)) H18)))]) in (H17 (refl_equal T +(THead (Flat Appl) v1 (THead (Bind Abst) u t5)))))))) t2 H13)) t H11 H12 H9 +H10))) | (pr0_upsilon b H9 v1 v2 H10 u0 u3 H11 t5 t6 H12) \Rightarrow +(\lambda (H13: (eq T (THead (Flat Appl) v1 (THead (Bind b) u0 t5)) +t)).(\lambda (H14: (eq T (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O +v2) t6)) t2)).(eq_ind T (THead (Flat Appl) v1 (THead (Bind b) u0 t5)) +(\lambda (_: T).((eq T (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O +v2) t6)) t2) \to ((not (eq B b Abst)) \to ((pr0 v1 v2) \to ((pr0 u0 u3) \to +((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead k u2 t4) t8)) (\lambda +(t8: T).(pr0 t2 t8))))))))) (\lambda (H15: (eq T (THead (Bind b) u3 (THead +(Flat Appl) (lift (S O) O v2) t6)) t2)).(eq_ind T (THead (Bind b) u3 (THead +(Flat Appl) (lift (S O) O v2) t6)) (\lambda (t7: T).((not (eq B b Abst)) \to +((pr0 v1 v2) \to ((pr0 u0 u3) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: +T).(pr0 (THead k u2 t4) t8)) (\lambda (t8: T).(pr0 t7 t8)))))))) (\lambda +(H16: (not (eq B b Abst))).(\lambda (H17: (pr0 v1 v2)).(\lambda (H18: (pr0 u0 +u3)).(\lambda (H19: (pr0 t5 t6)).(let H20 \def (eq_ind_r T t (\lambda (t7: +T).(eq T (THead k u1 t3) t7)) H4 (THead (Flat Appl) v1 (THead (Bind b) u0 +t5)) H13) in (let H21 \def (match H20 in eq return (\lambda (t7: T).(\lambda +(_: (eq ? ? t7)).((eq T t7 (THead (Flat Appl) v1 (THead (Bind b) u0 t5))) \to +(ex2 T (\lambda (t8: T).(pr0 (THead k u2 t4) t8)) (\lambda (t8: T).(pr0 +(THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t8)))))) with +[refl_equal \Rightarrow (\lambda (H21: (eq T (THead k u1 t3) (THead (Flat +Appl) v1 (THead (Bind b) u0 t5)))).(let H22 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | +(TLRef _) \Rightarrow t3 | (THead _ _ t7) \Rightarrow t7])) (THead k u1 t3) +(THead (Flat Appl) v1 (THead (Bind b) u0 t5)) H21) in ((let H23 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ t7 _) \Rightarrow t7])) +(THead k u1 t3) (THead (Flat Appl) v1 (THead (Bind b) u0 t5)) H21) in ((let +H24 \def (f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) +with [(TSort _) \Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) +\Rightarrow k0])) (THead k u1 t3) (THead (Flat Appl) v1 (THead (Bind b) u0 +t5)) H21) in (eq_ind K (Flat Appl) (\lambda (k0: K).((eq T u1 v1) \to ((eq T +t3 (THead (Bind b) u0 t5)) \to (ex2 T (\lambda (t7: T).(pr0 (THead k0 u2 t4) +t7)) (\lambda (t7: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) +O v2) t6)) t7)))))) (\lambda (H25: (eq T u1 v1)).(eq_ind T v1 (\lambda (_: +T).((eq T t3 (THead (Bind b) u0 t5)) \to (ex2 T (\lambda (t8: T).(pr0 (THead +(Flat Appl) u2 t4) t8)) (\lambda (t8: T).(pr0 (THead (Bind b) u3 (THead (Flat +Appl) (lift (S O) O v2) t6)) t8))))) (\lambda (H26: (eq T t3 (THead (Bind b) +u0 t5))).(eq_ind T (THead (Bind b) u0 t5) (\lambda (_: T).(ex2 T (\lambda +(t8: T).(pr0 (THead (Flat Appl) u2 t4) t8)) (\lambda (t8: T).(pr0 (THead +(Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t8)))) (let H27 \def +(eq_ind_r T t (\lambda (t7: T).(\forall (v: T).((tlt v t7) \to (\forall (t8: +T).((pr0 v t8) \to (\forall (t9: T).((pr0 v t9) \to (ex2 T (\lambda (t10: +T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 t10)))))))))) H (THead (Flat Appl) +v1 (THead (Bind b) u0 t5)) H13) in (let H28 \def (eq_ind T t3 (\lambda (t7: +T).(pr0 t7 t4)) H8 (THead (Bind b) u0 t5) H26) in (let H29 \def (match H28 in +pr0 return (\lambda (t7: T).(\lambda (t8: T).(\lambda (_: (pr0 t7 t8)).((eq T +t7 (THead (Bind b) u0 t5)) \to ((eq T t8 t4) \to (ex2 T (\lambda (t9: T).(pr0 +(THead (Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Bind b) u3 +(THead (Flat Appl) (lift (S O) O v2) t6)) t9)))))))) with [(pr0_refl t7) +\Rightarrow (\lambda (H29: (eq T t7 (THead (Bind b) u0 t5))).(\lambda (H30: +(eq T t7 t4)).(eq_ind T (THead (Bind b) u0 t5) (\lambda (t8: T).((eq T t8 t4) +\to (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: +T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t9))))) +(\lambda (H31: (eq T (THead (Bind b) u0 t5) t4)).(eq_ind T (THead (Bind b) u0 +t5) (\lambda (t8: T).(ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t8) +t9)) (\lambda (t9: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) +O v2) t6)) t9)))) (let H32 \def (eq_ind T u1 (\lambda (t8: T).(pr0 t8 u2)) H7 +v1 H25) in (ex2_ind T (\lambda (t8: T).(pr0 u2 t8)) (\lambda (t8: T).(pr0 v2 +t8)) (ex2 T (\lambda (t8: T).(pr0 (THead (Flat Appl) u2 (THead (Bind b) u0 +t5)) t8)) (\lambda (t8: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift +(S O) O v2) t6)) t8))) (\lambda (x: T).(\lambda (H33: (pr0 u2 x)).(\lambda +(H34: (pr0 v2 x)).(pr0_confluence__pr0_cong_upsilon_refl b H16 u0 u3 H18 t5 +t6 H19 u2 v2 x H33 H34)))) (H27 v1 (tlt_head_sx (Flat Appl) v1 (THead (Bind +b) u0 t5)) u2 H32 v2 H17))) t4 H31)) t7 (sym_eq T t7 (THead (Bind b) u0 t5) +H29) H30))) | (pr0_comp u4 u5 H29 t7 t8 H30 k0) \Rightarrow (\lambda (H31: +(eq T (THead k0 u4 t7) (THead (Bind b) u0 t5))).(\lambda (H32: (eq T (THead +k0 u5 t8) t4)).((let H33 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow t7 | (TLRef _) +\Rightarrow t7 | (THead _ _ t9) \Rightarrow t9])) (THead k0 u4 t7) (THead +(Bind b) u0 t5) H31) in ((let H34 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u4 | (TLRef _) +\Rightarrow u4 | (THead _ t9 _) \Rightarrow t9])) (THead k0 u4 t7) (THead +(Bind b) u0 t5) H31) in ((let H35 \def (f_equal T K (\lambda (e: T).(match e +in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k0 | (TLRef _) +\Rightarrow k0 | (THead k1 _ _) \Rightarrow k1])) (THead k0 u4 t7) (THead +(Bind b) u0 t5) H31) in (eq_ind K (Bind b) (\lambda (k1: K).((eq T u4 u0) \to +((eq T t7 t5) \to ((eq T (THead k1 u5 t8) t4) \to ((pr0 u4 u5) \to ((pr0 t7 +t8) \to (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda +(t9: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) +t9))))))))) (\lambda (H36: (eq T u4 u0)).(eq_ind T u0 (\lambda (t9: T).((eq T +t7 t5) \to ((eq T (THead (Bind b) u5 t8) t4) \to ((pr0 t9 u5) \to ((pr0 t7 +t8) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t4) t10)) +(\lambda (t10: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O +v2) t6)) t10)))))))) (\lambda (H37: (eq T t7 t5)).(eq_ind T t5 (\lambda (t9: +T).((eq T (THead (Bind b) u5 t8) t4) \to ((pr0 u0 u5) \to ((pr0 t9 t8) \to +(ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t4) t10)) (\lambda (t10: +T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) +t10))))))) (\lambda (H38: (eq T (THead (Bind b) u5 t8) t4)).(eq_ind T (THead +(Bind b) u5 t8) (\lambda (t9: T).((pr0 u0 u5) \to ((pr0 t5 t8) \to (ex2 T +(\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t9) t10)) (\lambda (t10: T).(pr0 +(THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t10)))))) +(\lambda (H39: (pr0 u0 u5)).(\lambda (H40: (pr0 t5 t8)).(let H41 \def (eq_ind +T u1 (\lambda (t9: T).(pr0 t9 u2)) H7 v1 H25) in (ex2_ind T (\lambda (t9: +T).(pr0 u2 t9)) (\lambda (t9: T).(pr0 v2 t9)) (ex2 T (\lambda (t9: T).(pr0 +(THead (Flat Appl) u2 (THead (Bind b) u5 t8)) t9)) (\lambda (t9: T).(pr0 +(THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t9))) (\lambda +(x: T).(\lambda (H42: (pr0 u2 x)).(\lambda (H43: (pr0 v2 x)).(ex2_ind T +(\lambda (t9: T).(pr0 t8 t9)) (\lambda (t9: T).(pr0 t6 t9)) (ex2 T (\lambda +(t9: T).(pr0 (THead (Flat Appl) u2 (THead (Bind b) u5 t8)) t9)) (\lambda (t9: +T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t9))) +(\lambda (x0: T).(\lambda (H44: (pr0 t8 x0)).(\lambda (H45: (pr0 t6 +x0)).(ex2_ind T (\lambda (t9: T).(pr0 u5 t9)) (\lambda (t9: T).(pr0 u3 t9)) +(ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 (THead (Bind b) u5 t8)) +t9)) (\lambda (t9: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) +O v2) t6)) t9))) (\lambda (x1: T).(\lambda (H46: (pr0 u5 x1)).(\lambda (H47: +(pr0 u3 x1)).(pr0_confluence__pr0_cong_upsilon_cong b H16 u2 v2 x H42 H43 t8 +t6 x0 H44 H45 u5 u3 x1 H46 H47)))) (H27 u0 (tlt_trans (THead (Bind b) u0 t5) +u0 (THead (Flat Appl) v1 (THead (Bind b) u0 t5)) (tlt_head_sx (Bind b) u0 t5) +(tlt_head_dx (Flat Appl) v1 (THead (Bind b) u0 t5))) u5 H39 u3 H18))))) (H27 +t5 (tlt_trans (THead (Bind b) u0 t5) t5 (THead (Flat Appl) v1 (THead (Bind b) +u0 t5)) (tlt_head_dx (Bind b) u0 t5) (tlt_head_dx (Flat Appl) v1 (THead (Bind +b) u0 t5))) t8 H40 t6 H19))))) (H27 v1 (tlt_head_sx (Flat Appl) v1 (THead +(Bind b) u0 t5)) u2 H41 v2 H17))))) t4 H38)) t7 (sym_eq T t7 t5 H37))) u4 +(sym_eq T u4 u0 H36))) k0 (sym_eq K k0 (Bind b) H35))) H34)) H33)) H32 H29 +H30))) | (pr0_beta u v0 v3 H29 t7 t8 H30) \Rightarrow (\lambda (H31: (eq T +(THead (Flat Appl) v0 (THead (Bind Abst) u t7)) (THead (Bind b) u0 +t5))).(\lambda (H32: (eq T (THead (Bind Abbr) v3 t8) t4)).((let H33 \def +(eq_ind T (THead (Flat Appl) v0 (THead (Bind Abst) u t7)) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in +K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind b) u0 t5) H31) in (False_ind ((eq T +(THead (Bind Abbr) v3 t8) t4) \to ((pr0 v0 v3) \to ((pr0 t7 t8) \to (ex2 T +(\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 +(THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t9)))))) H33)) +H32 H29 H30))) | (pr0_upsilon b0 H29 v0 v3 H30 u4 u5 H31 t7 t8 H32) +\Rightarrow (\lambda (H33: (eq T (THead (Flat Appl) v0 (THead (Bind b0) u4 +t7)) (THead (Bind b) u0 t5))).(\lambda (H34: (eq T (THead (Bind b0) u5 (THead +(Flat Appl) (lift (S O) O v3) t8)) t4)).((let H35 \def (eq_ind T (THead (Flat +Appl) v0 (THead (Bind b0) u4 t7)) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind b) u0 t5) H33) in (False_ind ((eq T (THead (Bind b0) +u5 (THead (Flat Appl) (lift (S O) O v3) t8)) t4) \to ((not (eq B b0 Abst)) +\to ((pr0 v0 v3) \to ((pr0 u4 u5) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t9: +T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Bind b) +u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t9)))))))) H35)) H34 H29 H30 H31 +H32))) | (pr0_delta u4 u5 H29 t7 t8 H30 w H31) \Rightarrow (\lambda (H32: (eq +T (THead (Bind Abbr) u4 t7) (THead (Bind b) u0 t5))).(\lambda (H33: (eq T +(THead (Bind Abbr) u5 w) t4)).((let H34 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t7 | +(TLRef _) \Rightarrow t7 | (THead _ _ t9) \Rightarrow t9])) (THead (Bind +Abbr) u4 t7) (THead (Bind b) u0 t5) H32) in ((let H35 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u4 | (TLRef _) \Rightarrow u4 | (THead _ t9 _) \Rightarrow t9])) +(THead (Bind Abbr) u4 t7) (THead (Bind b) u0 t5) H32) in ((let H36 \def +(f_equal T B (\lambda (e: T).(match e in T return (\lambda (_: T).B) with +[(TSort _) \Rightarrow Abbr | (TLRef _) \Rightarrow Abbr | (THead k0 _ _) +\Rightarrow (match k0 in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (THead (Bind Abbr) u4 t7) +(THead (Bind b) u0 t5) H32) in (eq_ind B Abbr (\lambda (b0: B).((eq T u4 u0) +\to ((eq T t7 t5) \to ((eq T (THead (Bind Abbr) u5 w) t4) \to ((pr0 u4 u5) +\to ((pr0 t7 t8) \to ((subst0 O u5 t8 w) \to (ex2 T (\lambda (t9: T).(pr0 +(THead (Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Bind b0) u3 +(THead (Flat Appl) (lift (S O) O v2) t6)) t9)))))))))) (\lambda (H37: (eq T +u4 u0)).(eq_ind T u0 (\lambda (t9: T).((eq T t7 t5) \to ((eq T (THead (Bind +Abbr) u5 w) t4) \to ((pr0 t9 u5) \to ((pr0 t7 t8) \to ((subst0 O u5 t8 w) \to +(ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t4) t10)) (\lambda (t10: +T).(pr0 (THead (Bind Abbr) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) +t10))))))))) (\lambda (H38: (eq T t7 t5)).(eq_ind T t5 (\lambda (t9: T).((eq +T (THead (Bind Abbr) u5 w) t4) \to ((pr0 u0 u5) \to ((pr0 t9 t8) \to ((subst0 +O u5 t8 w) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t4) t10)) +(\lambda (t10: T).(pr0 (THead (Bind Abbr) u3 (THead (Flat Appl) (lift (S O) O +v2) t6)) t10)))))))) (\lambda (H39: (eq T (THead (Bind Abbr) u5 w) +t4)).(eq_ind T (THead (Bind Abbr) u5 w) (\lambda (t9: T).((pr0 u0 u5) \to +((pr0 t5 t8) \to ((subst0 O u5 t8 w) \to (ex2 T (\lambda (t10: T).(pr0 (THead +(Flat Appl) u2 t9) t10)) (\lambda (t10: T).(pr0 (THead (Bind Abbr) u3 (THead +(Flat Appl) (lift (S O) O v2) t6)) t10))))))) (\lambda (H40: (pr0 u0 +u5)).(\lambda (H41: (pr0 t5 t8)).(\lambda (H42: (subst0 O u5 t8 w)).(let H43 +\def (eq_ind_r B b (\lambda (b0: B).(\forall (v: T).((tlt v (THead (Flat +Appl) v1 (THead (Bind b0) u0 t5))) \to (\forall (t9: T).((pr0 v t9) \to +(\forall (t10: T).((pr0 v t10) \to (ex2 T (\lambda (t11: T).(pr0 t9 t11)) +(\lambda (t11: T).(pr0 t10 t11)))))))))) H27 Abbr H36) in (let H44 \def +(eq_ind_r B b (\lambda (b0: B).(eq T t3 (THead (Bind b0) u0 t5))) H26 Abbr +H36) in (let H45 \def (eq_ind_r B b (\lambda (b0: B).(not (eq B b0 Abst))) +H16 Abbr H36) in (let H46 \def (eq_ind T u1 (\lambda (t9: T).(pr0 t9 u2)) H7 +v1 H25) in (ex2_ind T (\lambda (t9: T).(pr0 u2 t9)) (\lambda (t9: T).(pr0 v2 +t9)) (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 (THead (Bind Abbr) u5 +w)) t9)) (\lambda (t9: T).(pr0 (THead (Bind Abbr) u3 (THead (Flat Appl) (lift +(S O) O v2) t6)) t9))) (\lambda (x: T).(\lambda (H47: (pr0 u2 x)).(\lambda +(H48: (pr0 v2 x)).(ex2_ind T (\lambda (t9: T).(pr0 t8 t9)) (\lambda (t9: +T).(pr0 t6 t9)) (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 (THead +(Bind Abbr) u5 w)) t9)) (\lambda (t9: T).(pr0 (THead (Bind Abbr) u3 (THead +(Flat Appl) (lift (S O) O v2) t6)) t9))) (\lambda (x0: T).(\lambda (H49: (pr0 +t8 x0)).(\lambda (H50: (pr0 t6 x0)).(ex2_ind T (\lambda (t9: T).(pr0 u5 t9)) +(\lambda (t9: T).(pr0 u3 t9)) (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) +u2 (THead (Bind Abbr) u5 w)) t9)) (\lambda (t9: T).(pr0 (THead (Bind Abbr) u3 +(THead (Flat Appl) (lift (S O) O v2) t6)) t9))) (\lambda (x1: T).(\lambda +(H51: (pr0 u5 x1)).(\lambda (H52: (pr0 u3 +x1)).(pr0_confluence__pr0_cong_upsilon_delta H45 u5 t8 w H42 u2 v2 x H47 H48 +t6 x0 H49 H50 u3 x1 H51 H52)))) (H43 u0 (tlt_trans (THead (Bind Abbr) u0 t5) +u0 (THead (Flat Appl) v1 (THead (Bind Abbr) u0 t5)) (tlt_head_sx (Bind Abbr) +u0 t5) (tlt_head_dx (Flat Appl) v1 (THead (Bind Abbr) u0 t5))) u5 H40 u3 +H18))))) (H43 t5 (tlt_trans (THead (Bind Abbr) u0 t5) t5 (THead (Flat Appl) +v1 (THead (Bind Abbr) u0 t5)) (tlt_head_dx (Bind Abbr) u0 t5) (tlt_head_dx +(Flat Appl) v1 (THead (Bind Abbr) u0 t5))) t8 H41 t6 H19))))) (H43 v1 +(tlt_head_sx (Flat Appl) v1 (THead (Bind Abbr) u0 t5)) u2 H46 v2 H17))))))))) +t4 H39)) t7 (sym_eq T t7 t5 H38))) u4 (sym_eq T u4 u0 H37))) b H36)) H35)) +H34)) H33 H29 H30 H31))) | (pr0_zeta b0 H29 t7 t8 H30 u) \Rightarrow (\lambda +(H31: (eq T (THead (Bind b0) u (lift (S O) O t7)) (THead (Bind b) u0 +t5))).(\lambda (H32: (eq T t8 t4)).((let H33 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow ((let +rec lref_map (f: ((nat \to nat))) (d: nat) (t9: T) on t9: T \def (match t9 +with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match +(blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | (THead k0 +u4 t10) \Rightarrow (THead k0 (lref_map f d u4) (lref_map f (s k0 d) t10))]) +in lref_map) (\lambda (x: nat).(plus x (S O))) O t7) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t9: T) on t9: T \def (match +t9 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k0 u4 t10) \Rightarrow (THead k0 (lref_map f d u4) (lref_map f (s k0 +d) t10))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t7) | (THead _ _ +t9) \Rightarrow t9])) (THead (Bind b0) u (lift (S O) O t7)) (THead (Bind b) +u0 t5) H31) in ((let H34 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) +\Rightarrow u | (THead _ t9 _) \Rightarrow t9])) (THead (Bind b0) u (lift (S +O) O t7)) (THead (Bind b) u0 t5) H31) in ((let H35 \def (f_equal T B (\lambda +(e: T).(match e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b0 +| (TLRef _) \Rightarrow b0 | (THead k0 _ _) \Rightarrow (match k0 in K return +(\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) \Rightarrow +b0])])) (THead (Bind b0) u (lift (S O) O t7)) (THead (Bind b) u0 t5) H31) in +(eq_ind B b (\lambda (b1: B).((eq T u u0) \to ((eq T (lift (S O) O t7) t5) +\to ((eq T t8 t4) \to ((not (eq B b1 Abst)) \to ((pr0 t7 t8) \to (ex2 T +(\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 +(THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t9))))))))) +(\lambda (H36: (eq T u u0)).(eq_ind T u0 (\lambda (_: T).((eq T (lift (S O) O +t7) t5) \to ((eq T t8 t4) \to ((not (eq B b Abst)) \to ((pr0 t7 t8) \to (ex2 +T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t4) t10)) (\lambda (t10: +T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) +t10)))))))) (\lambda (H37: (eq T (lift (S O) O t7) t5)).(eq_ind T (lift (S O) +O t7) (\lambda (_: T).((eq T t8 t4) \to ((not (eq B b Abst)) \to ((pr0 t7 t8) +\to (ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t4) t10)) (\lambda +(t10: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) +t10))))))) (\lambda (H38: (eq T t8 t4)).(eq_ind T t4 (\lambda (t9: T).((not +(eq B b Abst)) \to ((pr0 t7 t9) \to (ex2 T (\lambda (t10: T).(pr0 (THead +(Flat Appl) u2 t4) t10)) (\lambda (t10: T).(pr0 (THead (Bind b) u3 (THead +(Flat Appl) (lift (S O) O v2) t6)) t10)))))) (\lambda (H39: (not (eq B b +Abst))).(\lambda (H40: (pr0 t7 t4)).(let H41 \def (eq_ind_r T t5 (\lambda +(t9: T).(\forall (v: T).((tlt v (THead (Flat Appl) v1 (THead (Bind b) u0 +t9))) \to (\forall (t10: T).((pr0 v t10) \to (\forall (t11: T).((pr0 v t11) +\to (ex2 T (\lambda (t12: T).(pr0 t10 t12)) (\lambda (t12: T).(pr0 t11 +t12)))))))))) H27 (lift (S O) O t7) H37) in (let H42 \def (eq_ind_r T t5 +(\lambda (t9: T).(eq T t3 (THead (Bind b) u0 t9))) H26 (lift (S O) O t7) H37) +in (let H43 \def (eq_ind_r T t5 (\lambda (t9: T).(pr0 t9 t6)) H19 (lift (S O) +O t7) H37) in (ex2_ind T (\lambda (t9: T).(eq T t6 (lift (S O) O t9))) +(\lambda (t9: T).(pr0 t7 t9)) (ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) +u2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift +(S O) O v2) t6)) t9))) (\lambda (x: T).(\lambda (H44: (eq T t6 (lift (S O) O +x))).(\lambda (H45: (pr0 t7 x)).(eq_ind_r T (lift (S O) O x) (\lambda (t9: +T).(ex2 T (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t4) t10)) (\lambda +(t10: T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t9)) +t10)))) (let H46 \def (eq_ind T u1 (\lambda (t9: T).(pr0 t9 u2)) H7 v1 H25) +in (ex2_ind T (\lambda (t9: T).(pr0 u2 t9)) (\lambda (t9: T).(pr0 v2 t9)) +(ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: +T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) (lift (S O) O +x))) t9))) (\lambda (x0: T).(\lambda (H47: (pr0 u2 x0)).(\lambda (H48: (pr0 +v2 x0)).(ex2_ind T (\lambda (t9: T).(pr0 x t9)) (\lambda (t9: T).(pr0 t4 t9)) +(ex2 T (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: +T).(pr0 (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) (lift (S O) O +x))) t9))) (\lambda (x1: T).(\lambda (H49: (pr0 x x1)).(\lambda (H50: (pr0 t4 +x1)).(pr0_confluence__pr0_cong_upsilon_zeta b H39 u0 u3 H18 u2 v2 x0 H47 H48 +x t4 x1 H49 H50)))) (H41 t7 (tlt_trans (THead (Bind b) u0 (lift (S O) O t7)) +t7 (THead (Flat Appl) v1 (THead (Bind b) u0 (lift (S O) O t7))) (lift_tlt_dx +(Bind b) u0 t7 (S O) O) (tlt_head_dx (Flat Appl) v1 (THead (Bind b) u0 (lift +(S O) O t7)))) x H45 t4 H40))))) (H41 v1 (tlt_head_sx (Flat Appl) v1 (THead +(Bind b) u0 (lift (S O) O t7))) u2 H46 v2 H17))) t6 H44)))) (pr0_gen_lift t7 +t6 (S O) O H43))))))) t8 (sym_eq T t8 t4 H38))) t5 H37)) u (sym_eq T u u0 +H36))) b0 (sym_eq B b0 b H35))) H34)) H33)) H32 H29 H30))) | (pr0_epsilon t7 +t8 H29 u) \Rightarrow (\lambda (H30: (eq T (THead (Flat Cast) u t7) (THead +(Bind b) u0 t5))).(\lambda (H31: (eq T t8 t4)).((let H32 \def (eq_ind T +(THead (Flat Cast) u t7) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k0 _ _) \Rightarrow (match k0 in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind +b) u0 t5) H30) in (False_ind ((eq T t8 t4) \to ((pr0 t7 t8) \to (ex2 T +(\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t4) t9)) (\lambda (t9: T).(pr0 +(THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t9))))) H32)) +H31 H29)))]) in (H29 (refl_equal T (THead (Bind b) u0 t5)) (refl_equal T +t4))))) t3 (sym_eq T t3 (THead (Bind b) u0 t5) H26))) u1 (sym_eq T u1 v1 +H25))) k (sym_eq K k (Flat Appl) H24))) H23)) H22)))]) in (H21 (refl_equal T +(THead (Flat Appl) v1 (THead (Bind b) u0 t5)))))))))) t2 H15)) t H13 H14 H9 +H10 H11 H12))) | (pr0_delta u0 u3 H9 t5 t6 H10 w H11) \Rightarrow (\lambda +(H12: (eq T (THead (Bind Abbr) u0 t5) t)).(\lambda (H13: (eq T (THead (Bind +Abbr) u3 w) t2)).(eq_ind T (THead (Bind Abbr) u0 t5) (\lambda (_: T).((eq T +(THead (Bind Abbr) u3 w) t2) \to ((pr0 u0 u3) \to ((pr0 t5 t6) \to ((subst0 O +u3 t6 w) \to (ex2 T (\lambda (t8: T).(pr0 (THead k u2 t4) t8)) (\lambda (t8: +T).(pr0 t2 t8)))))))) (\lambda (H14: (eq T (THead (Bind Abbr) u3 w) +t2)).(eq_ind T (THead (Bind Abbr) u3 w) (\lambda (t7: T).((pr0 u0 u3) \to +((pr0 t5 t6) \to ((subst0 O u3 t6 w) \to (ex2 T (\lambda (t8: T).(pr0 (THead +k u2 t4) t8)) (\lambda (t8: T).(pr0 t7 t8))))))) (\lambda (H15: (pr0 u0 +u3)).(\lambda (H16: (pr0 t5 t6)).(\lambda (H17: (subst0 O u3 t6 w)).(let H18 +\def (eq_ind_r T t (\lambda (t7: T).(eq T (THead k u1 t3) t7)) H4 (THead +(Bind Abbr) u0 t5) H12) in (let H19 \def (match H18 in eq return (\lambda +(t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Bind Abbr) u0 t5)) \to +(ex2 T (\lambda (t8: T).(pr0 (THead k u2 t4) t8)) (\lambda (t8: T).(pr0 +(THead (Bind Abbr) u3 w) t8)))))) with [refl_equal \Rightarrow (\lambda (H19: +(eq T (THead k u1 t3) (THead (Bind Abbr) u0 t5))).(let H20 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t7) \Rightarrow t7])) +(THead k u1 t3) (THead (Bind Abbr) u0 t5) H19) in ((let H21 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ t7 _) \Rightarrow t7])) +(THead k u1 t3) (THead (Bind Abbr) u0 t5) H19) in ((let H22 \def (f_equal T K +(\lambda (e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) +\Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) \Rightarrow k0])) +(THead k u1 t3) (THead (Bind Abbr) u0 t5) H19) in (eq_ind K (Bind Abbr) +(\lambda (k0: K).((eq T u1 u0) \to ((eq T t3 t5) \to (ex2 T (\lambda (t7: +T).(pr0 (THead k0 u2 t4) t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) u3 w) +t7)))))) (\lambda (H23: (eq T u1 u0)).(eq_ind T u0 (\lambda (_: T).((eq T t3 +t5) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 t4) t8)) (\lambda +(t8: T).(pr0 (THead (Bind Abbr) u3 w) t8))))) (\lambda (H24: (eq T t3 +t5)).(eq_ind T t5 (\lambda (_: T).(ex2 T (\lambda (t8: T).(pr0 (THead (Bind +Abbr) u2 t4) t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) u3 w) t8)))) (let +H25 \def (eq_ind_r T t (\lambda (t7: T).(\forall (v: T).((tlt v t7) \to +(\forall (t8: T).((pr0 v t8) \to (\forall (t9: T).((pr0 v t9) \to (ex2 T +(\lambda (t10: T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 t10)))))))))) H +(THead (Bind Abbr) u0 t5) H12) in (let H26 \def (eq_ind T t3 (\lambda (t7: +T).(pr0 t7 t4)) H8 t5 H24) in (let H27 \def (eq_ind T u1 (\lambda (t7: +T).(pr0 t7 u2)) H7 u0 H23) in (ex2_ind T (\lambda (t7: T).(pr0 u2 t7)) +(\lambda (t7: T).(pr0 u3 t7)) (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) +u2 t4) t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) u3 w) t7))) (\lambda (x: +T).(\lambda (H28: (pr0 u2 x)).(\lambda (H29: (pr0 u3 x)).(ex2_ind T (\lambda +(t7: T).(pr0 t4 t7)) (\lambda (t7: T).(pr0 t6 t7)) (ex2 T (\lambda (t7: +T).(pr0 (THead (Bind Abbr) u2 t4) t7)) (\lambda (t7: T).(pr0 (THead (Bind +Abbr) u3 w) t7))) (\lambda (x0: T).(\lambda (H30: (pr0 t4 x0)).(\lambda (H31: +(pr0 t6 x0)).(pr0_confluence__pr0_cong_delta u3 t6 w H17 u2 x H28 H29 t4 x0 +H30 H31)))) (H25 t5 (tlt_head_dx (Bind Abbr) u0 t5) t4 H26 t6 H16))))) (H25 +u0 (tlt_head_sx (Bind Abbr) u0 t5) u2 H27 u3 H15))))) t3 (sym_eq T t3 t5 +H24))) u1 (sym_eq T u1 u0 H23))) k (sym_eq K k (Bind Abbr) H22))) H21)) +H20)))]) in (H19 (refl_equal T (THead (Bind Abbr) u0 t5)))))))) t2 H14)) t +H12 H13 H9 H10 H11))) | (pr0_zeta b H9 t5 t6 H10 u) \Rightarrow (\lambda +(H11: (eq T (THead (Bind b) u (lift (S O) O t5)) t)).(\lambda (H12: (eq T t6 +t2)).(eq_ind T (THead (Bind b) u (lift (S O) O t5)) (\lambda (_: T).((eq T t6 +t2) \to ((not (eq B b Abst)) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: +T).(pr0 (THead k u2 t4) t8)) (\lambda (t8: T).(pr0 t2 t8))))))) (\lambda +(H13: (eq T t6 t2)).(eq_ind T t2 (\lambda (t7: T).((not (eq B b Abst)) \to +((pr0 t5 t7) \to (ex2 T (\lambda (t8: T).(pr0 (THead k u2 t4) t8)) (\lambda +(t8: T).(pr0 t2 t8)))))) (\lambda (H14: (not (eq B b Abst))).(\lambda (H15: +(pr0 t5 t2)).(let H16 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead k u1 +t3) t7)) H4 (THead (Bind b) u (lift (S O) O t5)) H11) in (let H17 \def (match +H16 in eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead +(Bind b) u (lift (S O) O t5))) \to (ex2 T (\lambda (t8: T).(pr0 (THead k u2 +t4) t8)) (\lambda (t8: T).(pr0 t2 t8)))))) with [refl_equal \Rightarrow +(\lambda (H17: (eq T (THead k u1 t3) (THead (Bind b) u (lift (S O) O +t5)))).(let H18 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 +| (THead _ _ t7) \Rightarrow t7])) (THead k u1 t3) (THead (Bind b) u (lift (S +O) O t5)) H17) in ((let H19 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | (TLRef _) +\Rightarrow u1 | (THead _ t7 _) \Rightarrow t7])) (THead k u1 t3) (THead +(Bind b) u (lift (S O) O t5)) H17) in ((let H20 \def (f_equal T K (\lambda +(e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k +| (TLRef _) \Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k u1 t3) +(THead (Bind b) u (lift (S O) O t5)) H17) in (eq_ind K (Bind b) (\lambda (k0: +K).((eq T u1 u) \to ((eq T t3 (lift (S O) O t5)) \to (ex2 T (\lambda (t7: +T).(pr0 (THead k0 u2 t4) t7)) (\lambda (t7: T).(pr0 t2 t7)))))) (\lambda +(H21: (eq T u1 u)).(eq_ind T u (\lambda (_: T).((eq T t3 (lift (S O) O t5)) +\to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 t4) t8)) (\lambda (t8: +T).(pr0 t2 t8))))) (\lambda (H22: (eq T t3 (lift (S O) O t5))).(eq_ind T +(lift (S O) O t5) (\lambda (_: T).(ex2 T (\lambda (t8: T).(pr0 (THead (Bind +b) u2 t4) t8)) (\lambda (t8: T).(pr0 t2 t8)))) (let H23 \def (eq_ind_r T t +(\lambda (t7: T).(\forall (v: T).((tlt v t7) \to (\forall (t8: T).((pr0 v t8) +\to (\forall (t9: T).((pr0 v t9) \to (ex2 T (\lambda (t10: T).(pr0 t8 t10)) +(\lambda (t10: T).(pr0 t9 t10)))))))))) H (THead (Bind b) u (lift (S O) O +t5)) H11) in (let H24 \def (eq_ind T t3 (\lambda (t7: T).(pr0 t7 t4)) H8 +(lift (S O) O t5) H22) in (ex2_ind T (\lambda (t7: T).(eq T t4 (lift (S O) O +t7))) (\lambda (t7: T).(pr0 t5 t7)) (ex2 T (\lambda (t7: T).(pr0 (THead (Bind +b) u2 t4) t7)) (\lambda (t7: T).(pr0 t2 t7))) (\lambda (x: T).(\lambda (H25: +(eq T t4 (lift (S O) O x))).(\lambda (H26: (pr0 t5 x)).(eq_ind_r T (lift (S +O) O x) (\lambda (t7: T).(ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 t7) +t8)) (\lambda (t8: T).(pr0 t2 t8)))) (let H27 \def (eq_ind T u1 (\lambda (t7: +T).(pr0 t7 u2)) H7 u H21) in (ex2_ind T (\lambda (t7: T).(pr0 x t7)) (\lambda +(t7: T).(pr0 t2 t7)) (ex2 T (\lambda (t7: T).(pr0 (THead (Bind b) u2 (lift (S +O) O x)) t7)) (\lambda (t7: T).(pr0 t2 t7))) (\lambda (x0: T).(\lambda (H28: +(pr0 x x0)).(\lambda (H29: (pr0 t2 x0)).(ex_intro2 T (\lambda (t7: T).(pr0 +(THead (Bind b) u2 (lift (S O) O x)) t7)) (\lambda (t7: T).(pr0 t2 t7)) x0 +(pr0_zeta b H14 x x0 H28 u2) H29)))) (H23 t5 (lift_tlt_dx (Bind b) u t5 (S O) +O) x H26 t2 H15))) t4 H25)))) (pr0_gen_lift t5 t4 (S O) O H24)))) t3 (sym_eq +T t3 (lift (S O) O t5) H22))) u1 (sym_eq T u1 u H21))) k (sym_eq K k (Bind b) +H20))) H19)) H18)))]) in (H17 (refl_equal T (THead (Bind b) u (lift (S O) O +t5)))))))) t6 (sym_eq T t6 t2 H13))) t H11 H12 H9 H10))) | (pr0_epsilon t5 t6 +H9 u) \Rightarrow (\lambda (H10: (eq T (THead (Flat Cast) u t5) t)).(\lambda +(H11: (eq T t6 t2)).(eq_ind T (THead (Flat Cast) u t5) (\lambda (_: T).((eq T +t6 t2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead k u2 t4) t8)) +(\lambda (t8: T).(pr0 t2 t8)))))) (\lambda (H12: (eq T t6 t2)).(eq_ind T t2 +(\lambda (t7: T).((pr0 t5 t7) \to (ex2 T (\lambda (t8: T).(pr0 (THead k u2 +t4) t8)) (\lambda (t8: T).(pr0 t2 t8))))) (\lambda (H13: (pr0 t5 t2)).(let +H14 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead k u1 t3) t7)) H4 (THead +(Flat Cast) u t5) H10) in (let H15 \def (match H14 in eq return (\lambda (t7: +T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat Cast) u t5)) \to (ex2 T +(\lambda (t8: T).(pr0 (THead k u2 t4) t8)) (\lambda (t8: T).(pr0 t2 t8)))))) +with [refl_equal \Rightarrow (\lambda (H15: (eq T (THead k u1 t3) (THead +(Flat Cast) u t5))).(let H16 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) +\Rightarrow t3 | (THead _ _ t7) \Rightarrow t7])) (THead k u1 t3) (THead +(Flat Cast) u t5) H15) in ((let H17 \def (f_equal T T (\lambda (e: T).(match +e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | (TLRef _) +\Rightarrow u1 | (THead _ t7 _) \Rightarrow t7])) (THead k u1 t3) (THead +(Flat Cast) u t5) H15) in ((let H18 \def (f_equal T K (\lambda (e: T).(match +e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k u1 t3) (THead (Flat +Cast) u t5) H15) in (eq_ind K (Flat Cast) (\lambda (k0: K).((eq T u1 u) \to +((eq T t3 t5) \to (ex2 T (\lambda (t7: T).(pr0 (THead k0 u2 t4) t7)) (\lambda +(t7: T).(pr0 t2 t7)))))) (\lambda (H19: (eq T u1 u)).(eq_ind T u (\lambda (_: +T).((eq T t3 t5) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Flat Cast) u2 t4) +t8)) (\lambda (t8: T).(pr0 t2 t8))))) (\lambda (H20: (eq T t3 t5)).(eq_ind T +t5 (\lambda (_: T).(ex2 T (\lambda (t8: T).(pr0 (THead (Flat Cast) u2 t4) +t8)) (\lambda (t8: T).(pr0 t2 t8)))) (let H21 \def (eq_ind_r T t (\lambda +(t7: T).(\forall (v: T).((tlt v t7) \to (\forall (t8: T).((pr0 v t8) \to +(\forall (t9: T).((pr0 v t9) \to (ex2 T (\lambda (t10: T).(pr0 t8 t10)) +(\lambda (t10: T).(pr0 t9 t10)))))))))) H (THead (Flat Cast) u t5) H10) in +(let H22 \def (eq_ind T t3 (\lambda (t7: T).(pr0 t7 t4)) H8 t5 H20) in (let +H23 \def (eq_ind T u1 (\lambda (t7: T).(pr0 t7 u2)) H7 u H19) in (ex2_ind T +(\lambda (t7: T).(pr0 t4 t7)) (\lambda (t7: T).(pr0 t2 t7)) (ex2 T (\lambda +(t7: T).(pr0 (THead (Flat Cast) u2 t4) t7)) (\lambda (t7: T).(pr0 t2 t7))) +(\lambda (x: T).(\lambda (H24: (pr0 t4 x)).(\lambda (H25: (pr0 t2 +x)).(ex_intro2 T (\lambda (t7: T).(pr0 (THead (Flat Cast) u2 t4) t7)) +(\lambda (t7: T).(pr0 t2 t7)) x (pr0_epsilon t4 x H24 u2) H25)))) (H21 t5 +(tlt_head_dx (Flat Cast) u t5) t4 H22 t2 H13))))) t3 (sym_eq T t3 t5 H20))) +u1 (sym_eq T u1 u H19))) k (sym_eq K k (Flat Cast) H18))) H17)) H16)))]) in +(H15 (refl_equal T (THead (Flat Cast) u t5)))))) t6 (sym_eq T t6 t2 H12))) t +H10 H11 H9)))]) in (H9 (refl_equal T t) (refl_equal T t2))))) t1 H6)) t H4 H5 +H2 H3))) | (pr0_beta u v1 v2 H2 t3 t4 H3) \Rightarrow (\lambda (H4: (eq T +(THead (Flat Appl) v1 (THead (Bind Abst) u t3)) t)).(\lambda (H5: (eq T +(THead (Bind Abbr) v2 t4) t1)).(eq_ind T (THead (Flat Appl) v1 (THead (Bind +Abst) u t3)) (\lambda (_: T).((eq T (THead (Bind Abbr) v2 t4) t1) \to ((pr0 +v1 v2) \to ((pr0 t3 t4) \to (ex2 T (\lambda (t6: T).(pr0 t1 t6)) (\lambda +(t6: T).(pr0 t2 t6))))))) (\lambda (H6: (eq T (THead (Bind Abbr) v2 t4) +t1)).(eq_ind T (THead (Bind Abbr) v2 t4) (\lambda (t5: T).((pr0 v1 v2) \to +((pr0 t3 t4) \to (ex2 T (\lambda (t6: T).(pr0 t5 t6)) (\lambda (t6: T).(pr0 +t2 t6)))))) (\lambda (H7: (pr0 v1 v2)).(\lambda (H8: (pr0 t3 t4)).(let H9 +\def (match H1 in pr0 return (\lambda (t5: T).(\lambda (t6: T).(\lambda (_: +(pr0 t5 t6)).((eq T t5 t) \to ((eq T t6 t2) \to (ex2 T (\lambda (t7: T).(pr0 +(THead (Bind Abbr) v2 t4) t7)) (\lambda (t7: T).(pr0 t2 t7)))))))) with +[(pr0_refl t5) \Rightarrow (\lambda (H9: (eq T t5 t)).(\lambda (H10: (eq T t5 +t2)).(eq_ind T t (\lambda (t6: T).((eq T t6 t2) \to (ex2 T (\lambda (t7: +T).(pr0 (THead (Bind Abbr) v2 t4) t7)) (\lambda (t7: T).(pr0 t2 t7))))) +(\lambda (H11: (eq T t t2)).(eq_ind T t2 (\lambda (_: T).(ex2 T (\lambda (t7: +T).(pr0 (THead (Bind Abbr) v2 t4) t7)) (\lambda (t7: T).(pr0 t2 t7)))) (let +H12 \def (eq_ind_r T t (\lambda (t6: T).(eq T t6 t2)) H11 (THead (Flat Appl) +v1 (THead (Bind Abst) u t3)) H4) in (eq_ind T (THead (Flat Appl) v1 (THead +(Bind Abst) u t3)) (\lambda (t6: T).(ex2 T (\lambda (t7: T).(pr0 (THead (Bind +Abbr) v2 t4) t7)) (\lambda (t7: T).(pr0 t6 t7)))) (let H13 \def (eq_ind_r T t +(\lambda (t6: T).(eq T t5 t6)) H9 (THead (Flat Appl) v1 (THead (Bind Abst) u +t3)) H4) in (let H14 \def (eq_ind_r T t (\lambda (t6: T).(\forall (v: +T).((tlt v t6) \to (\forall (t7: T).((pr0 v t7) \to (\forall (t8: T).((pr0 v +t8) \to (ex2 T (\lambda (t9: T).(pr0 t7 t9)) (\lambda (t9: T).(pr0 t8 +t9)))))))))) H (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) H4) in +(ex_intro2 T (\lambda (t6: T).(pr0 (THead (Bind Abbr) v2 t4) t6)) (\lambda +(t6: T).(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) t6)) (THead +(Bind Abbr) v2 t4) (pr0_refl (THead (Bind Abbr) v2 t4)) (pr0_beta u v1 v2 H7 +t3 t4 H8)))) t2 H12)) t (sym_eq T t t2 H11))) t5 (sym_eq T t5 t H9) H10))) | +(pr0_comp u1 u2 H9 t5 t6 H10 k) \Rightarrow (\lambda (H11: (eq T (THead k u1 +t5) t)).(\lambda (H12: (eq T (THead k u2 t6) t2)).(eq_ind T (THead k u1 t5) +(\lambda (_: T).((eq T (THead k u2 t6) t2) \to ((pr0 u1 u2) \to ((pr0 t5 t6) +\to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: +T).(pr0 t2 t8))))))) (\lambda (H13: (eq T (THead k u2 t6) t2)).(eq_ind T +(THead k u2 t6) (\lambda (t7: T).((pr0 u1 u2) \to ((pr0 t5 t6) \to (ex2 T +(\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 t7 +t8)))))) (\lambda (H14: (pr0 u1 u2)).(\lambda (H15: (pr0 t5 t6)).(let H16 +\def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Flat Appl) v1 (THead (Bind +Abst) u t3)) t7)) H4 (THead k u1 t5) H11) in (let H17 \def (match H16 in eq +return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead k u1 t5)) +\to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: +T).(pr0 (THead k u2 t6) t8)))))) with [refl_equal \Rightarrow (\lambda (H17: +(eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) (THead k u1 t5))).(let +H18 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow (THead (Bind Abst) u t3) | (TLRef _) \Rightarrow +(THead (Bind Abst) u t3) | (THead _ _ t7) \Rightarrow t7])) (THead (Flat +Appl) v1 (THead (Bind Abst) u t3)) (THead k u1 t5) H17) in ((let H19 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow v1 | (TLRef _) \Rightarrow v1 | (THead _ t7 _) +\Rightarrow t7])) (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) (THead k u1 +t5) H17) in ((let H20 \def (f_equal T K (\lambda (e: T).(match e in T return +(\lambda (_: T).K) with [(TSort _) \Rightarrow (Flat Appl) | (TLRef _) +\Rightarrow (Flat Appl) | (THead k0 _ _) \Rightarrow k0])) (THead (Flat Appl) +v1 (THead (Bind Abst) u t3)) (THead k u1 t5) H17) in (eq_ind K (Flat Appl) +(\lambda (k0: K).((eq T v1 u1) \to ((eq T (THead (Bind Abst) u t3) t5) \to +(ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t4) t7)) (\lambda (t7: +T).(pr0 (THead k0 u2 t6) t7)))))) (\lambda (H21: (eq T v1 u1)).(eq_ind T u1 +(\lambda (_: T).((eq T (THead (Bind Abst) u t3) t5) \to (ex2 T (\lambda (t8: +T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 (THead (Flat +Appl) u2 t6) t8))))) (\lambda (H22: (eq T (THead (Bind Abst) u t3) +t5)).(eq_ind T (THead (Bind Abst) u t3) (\lambda (_: T).(ex2 T (\lambda (t8: +T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 (THead (Flat +Appl) u2 t6) t8)))) (let H23 \def (eq_ind_r K k (\lambda (k0: K).(eq T (THead +k0 u1 t5) t)) H11 (Flat Appl) H20) in (let H24 \def (eq_ind_r T t5 (\lambda +(t7: T).(pr0 t7 t6)) H15 (THead (Bind Abst) u t3) H22) in (let H25 \def +(match H24 in pr0 return (\lambda (t7: T).(\lambda (t8: T).(\lambda (_: (pr0 +t7 t8)).((eq T t7 (THead (Bind Abst) u t3)) \to ((eq T t8 t6) \to (ex2 T +(\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: T).(pr0 +(THead (Flat Appl) u2 t6) t9)))))))) with [(pr0_refl t7) \Rightarrow (\lambda +(H25: (eq T t7 (THead (Bind Abst) u t3))).(\lambda (H26: (eq T t7 +t6)).(eq_ind T (THead (Bind Abst) u t3) (\lambda (t8: T).((eq T t8 t6) \to +(ex2 T (\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: +T).(pr0 (THead (Flat Appl) u2 t6) t9))))) (\lambda (H27: (eq T (THead (Bind +Abst) u t3) t6)).(eq_ind T (THead (Bind Abst) u t3) (\lambda (t8: T).(ex2 T +(\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: T).(pr0 +(THead (Flat Appl) u2 t8) t9)))) (let H28 \def (eq_ind_r T t5 (\lambda (t8: +T).(eq T (THead (Flat Appl) u1 t8) t)) H23 (THead (Bind Abst) u t3) H22) in +(let H29 \def (eq_ind_r T t (\lambda (t8: T).(\forall (v: T).((tlt v t8) \to +(\forall (t9: T).((pr0 v t9) \to (\forall (t10: T).((pr0 v t10) \to (ex2 T +(\lambda (t11: T).(pr0 t9 t11)) (\lambda (t11: T).(pr0 t10 t11)))))))))) H +(THead (Flat Appl) u1 (THead (Bind Abst) u t3)) H28) in (let H30 \def (eq_ind +T v1 (\lambda (t8: T).(pr0 t8 v2)) H7 u1 H21) in (ex2_ind T (\lambda (t8: +T).(pr0 v2 t8)) (\lambda (t8: T).(pr0 u2 t8)) (ex2 T (\lambda (t8: T).(pr0 +(THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 (THead (Flat Appl) u2 +(THead (Bind Abst) u t3)) t8))) (\lambda (x: T).(\lambda (H31: (pr0 v2 +x)).(\lambda (H32: (pr0 u2 x)).(ex_intro2 T (\lambda (t8: T).(pr0 (THead +(Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 (THead (Flat Appl) u2 (THead +(Bind Abst) u t3)) t8)) (THead (Bind Abbr) x t4) (pr0_comp v2 x H31 t4 t4 +(pr0_refl t4) (Bind Abbr)) (pr0_beta u u2 x H32 t3 t4 H8))))) (H29 u1 +(tlt_head_sx (Flat Appl) u1 (THead (Bind Abst) u t3)) v2 H30 u2 H14))))) t6 +H27)) t7 (sym_eq T t7 (THead (Bind Abst) u t3) H25) H26))) | (pr0_comp u0 u3 +H25 t7 t8 H26 k0) \Rightarrow (\lambda (H27: (eq T (THead k0 u0 t7) (THead +(Bind Abst) u t3))).(\lambda (H28: (eq T (THead k0 u3 t8) t6)).((let H29 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t7 | (TLRef _) \Rightarrow t7 | (THead _ _ t9) +\Rightarrow t9])) (THead k0 u0 t7) (THead (Bind Abst) u t3) H27) in ((let H30 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t9 _) +\Rightarrow t9])) (THead k0 u0 t7) (THead (Bind Abst) u t3) H27) in ((let H31 +\def (f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) +with [(TSort _) \Rightarrow k0 | (TLRef _) \Rightarrow k0 | (THead k1 _ _) +\Rightarrow k1])) (THead k0 u0 t7) (THead (Bind Abst) u t3) H27) in (eq_ind K +(Bind Abst) (\lambda (k1: K).((eq T u0 u) \to ((eq T t7 t3) \to ((eq T (THead +k1 u3 t8) t6) \to ((pr0 u0 u3) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t9: +T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Flat +Appl) u2 t6) t9))))))))) (\lambda (H32: (eq T u0 u)).(eq_ind T u (\lambda +(t9: T).((eq T t7 t3) \to ((eq T (THead (Bind Abst) u3 t8) t6) \to ((pr0 t9 +u3) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Bind Abbr) v2 +t4) t10)) (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t6) t10)))))))) +(\lambda (H33: (eq T t7 t3)).(eq_ind T t3 (\lambda (t9: T).((eq T (THead +(Bind Abst) u3 t8) t6) \to ((pr0 u u3) \to ((pr0 t9 t8) \to (ex2 T (\lambda +(t10: T).(pr0 (THead (Bind Abbr) v2 t4) t10)) (\lambda (t10: T).(pr0 (THead +(Flat Appl) u2 t6) t10))))))) (\lambda (H34: (eq T (THead (Bind Abst) u3 t8) +t6)).(eq_ind T (THead (Bind Abst) u3 t8) (\lambda (t9: T).((pr0 u u3) \to +((pr0 t3 t8) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Bind Abbr) v2 t4) +t10)) (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t9) t10)))))) (\lambda (_: +(pr0 u u3)).(\lambda (H36: (pr0 t3 t8)).(let H37 \def (eq_ind_r T t5 (\lambda +(t9: T).(eq T (THead (Flat Appl) u1 t9) t)) H23 (THead (Bind Abst) u t3) H22) +in (let H38 \def (eq_ind_r T t (\lambda (t9: T).(\forall (v: T).((tlt v t9) +\to (\forall (t10: T).((pr0 v t10) \to (\forall (t11: T).((pr0 v t11) \to +(ex2 T (\lambda (t12: T).(pr0 t10 t12)) (\lambda (t12: T).(pr0 t11 +t12)))))))))) H (THead (Flat Appl) u1 (THead (Bind Abst) u t3)) H37) in (let +H39 \def (eq_ind T v1 (\lambda (t9: T).(pr0 t9 v2)) H7 u1 H21) in (ex2_ind T +(\lambda (t9: T).(pr0 v2 t9)) (\lambda (t9: T).(pr0 u2 t9)) (ex2 T (\lambda +(t9: T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: T).(pr0 (THead +(Flat Appl) u2 (THead (Bind Abst) u3 t8)) t9))) (\lambda (x: T).(\lambda +(H40: (pr0 v2 x)).(\lambda (H41: (pr0 u2 x)).(ex2_ind T (\lambda (t9: T).(pr0 +t8 t9)) (\lambda (t9: T).(pr0 t4 t9)) (ex2 T (\lambda (t9: T).(pr0 (THead +(Bind Abbr) v2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 (THead +(Bind Abst) u3 t8)) t9))) (\lambda (x0: T).(\lambda (H42: (pr0 t8 +x0)).(\lambda (H43: (pr0 t4 x0)).(ex_intro2 T (\lambda (t9: T).(pr0 (THead +(Bind Abbr) v2 t4) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 (THead +(Bind Abst) u3 t8)) t9)) (THead (Bind Abbr) x x0) (pr0_comp v2 x H40 t4 x0 +H43 (Bind Abbr)) (pr0_beta u3 u2 x H41 t8 x0 H42))))) (H38 t3 (tlt_trans +(THead (Bind Abst) u t3) t3 (THead (Flat Appl) u1 (THead (Bind Abst) u t3)) +(tlt_head_dx (Bind Abst) u t3) (tlt_head_dx (Flat Appl) u1 (THead (Bind Abst) +u t3))) t8 H36 t4 H8))))) (H38 u1 (tlt_head_sx (Flat Appl) u1 (THead (Bind +Abst) u t3)) v2 H39 u2 H14))))))) t6 H34)) t7 (sym_eq T t7 t3 H33))) u0 +(sym_eq T u0 u H32))) k0 (sym_eq K k0 (Bind Abst) H31))) H30)) H29)) H28 H25 +H26))) | (pr0_beta u0 v0 v3 H25 t7 t8 H26) \Rightarrow (\lambda (H27: (eq T +(THead (Flat Appl) v0 (THead (Bind Abst) u0 t7)) (THead (Bind Abst) u +t3))).(\lambda (H28: (eq T (THead (Bind Abbr) v3 t8) t6)).((let H29 \def +(eq_ind T (THead (Flat Appl) v0 (THead (Bind Abst) u0 t7)) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in +K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind Abst) u t3) H27) in (False_ind ((eq T +(THead (Bind Abbr) v3 t8) t6) \to ((pr0 v0 v3) \to ((pr0 t7 t8) \to (ex2 T +(\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: T).(pr0 +(THead (Flat Appl) u2 t6) t9)))))) H29)) H28 H25 H26))) | (pr0_upsilon b H25 +v0 v3 H26 u0 u3 H27 t7 t8 H28) \Rightarrow (\lambda (H29: (eq T (THead (Flat +Appl) v0 (THead (Bind b) u0 t7)) (THead (Bind Abst) u t3))).(\lambda (H30: +(eq T (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v3) t8)) t6)).((let +H31 \def (eq_ind T (THead (Flat Appl) v0 (THead (Bind b) u0 t7)) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in +K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind Abst) u t3) H29) in (False_ind ((eq T +(THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v3) t8)) t6) \to ((not +(eq B b Abst)) \to ((pr0 v0 v3) \to ((pr0 u0 u3) \to ((pr0 t7 t8) \to (ex2 T +(\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: T).(pr0 +(THead (Flat Appl) u2 t6) t9)))))))) H31)) H30 H25 H26 H27 H28))) | +(pr0_delta u0 u3 H25 t7 t8 H26 w H27) \Rightarrow (\lambda (H28: (eq T (THead +(Bind Abbr) u0 t7) (THead (Bind Abst) u t3))).(\lambda (H29: (eq T (THead +(Bind Abbr) u3 w) t6)).((let H30 \def (eq_ind T (THead (Bind Abbr) u0 t7) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow +(match k0 in K return (\lambda (_: K).Prop) with [(Bind b) \Rightarrow (match +b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow True | Abst +\Rightarrow False | Void \Rightarrow False]) | (Flat _) \Rightarrow +False])])) I (THead (Bind Abst) u t3) H28) in (False_ind ((eq T (THead (Bind +Abbr) u3 w) t6) \to ((pr0 u0 u3) \to ((pr0 t7 t8) \to ((subst0 O u3 t8 w) \to +(ex2 T (\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: +T).(pr0 (THead (Flat Appl) u2 t6) t9))))))) H30)) H29 H25 H26 H27))) | +(pr0_zeta b H25 t7 t8 H26 u0) \Rightarrow (\lambda (H27: (eq T (THead (Bind +b) u0 (lift (S O) O t7)) (THead (Bind Abst) u t3))).(\lambda (H28: (eq T t8 +t6)).((let H29 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map (f: ((nat +\to nat))) (d: nat) (t9: T) on t9: T \def (match t9 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k0 u3 t10) +\Rightarrow (THead k0 (lref_map f d u3) (lref_map f (s k0 d) t10))]) in +lref_map) (\lambda (x: nat).(plus x (S O))) O t7) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t9: T) on t9: T \def (match +t9 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k0 u3 t10) \Rightarrow (THead k0 (lref_map f d u3) (lref_map f (s k0 +d) t10))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t7) | (THead _ _ +t9) \Rightarrow t9])) (THead (Bind b) u0 (lift (S O) O t7)) (THead (Bind +Abst) u t3) H27) in ((let H30 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) +\Rightarrow u0 | (THead _ t9 _) \Rightarrow t9])) (THead (Bind b) u0 (lift (S +O) O t7)) (THead (Bind Abst) u t3) H27) in ((let H31 \def (f_equal T B +(\lambda (e: T).(match e in T return (\lambda (_: T).B) with [(TSort _) +\Rightarrow b | (TLRef _) \Rightarrow b | (THead k0 _ _) \Rightarrow (match +k0 in K return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow b])])) (THead (Bind b) u0 (lift (S O) O t7)) (THead (Bind Abst) u +t3) H27) in (eq_ind B Abst (\lambda (b0: B).((eq T u0 u) \to ((eq T (lift (S +O) O t7) t3) \to ((eq T t8 t6) \to ((not (eq B b0 Abst)) \to ((pr0 t7 t8) \to +(ex2 T (\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: +T).(pr0 (THead (Flat Appl) u2 t6) t9))))))))) (\lambda (H32: (eq T u0 +u)).(eq_ind T u (\lambda (_: T).((eq T (lift (S O) O t7) t3) \to ((eq T t8 +t6) \to ((not (eq B Abst Abst)) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t10: +T).(pr0 (THead (Bind Abbr) v2 t4) t10)) (\lambda (t10: T).(pr0 (THead (Flat +Appl) u2 t6) t10)))))))) (\lambda (H33: (eq T (lift (S O) O t7) t3)).(eq_ind +T (lift (S O) O t7) (\lambda (_: T).((eq T t8 t6) \to ((not (eq B Abst Abst)) +\to ((pr0 t7 t8) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Bind Abbr) v2 t4) +t10)) (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t6) t10))))))) (\lambda +(H34: (eq T t8 t6)).(eq_ind T t6 (\lambda (t9: T).((not (eq B Abst Abst)) \to +((pr0 t7 t9) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Bind Abbr) v2 t4) +t10)) (\lambda (t10: T).(pr0 (THead (Flat Appl) u2 t6) t10)))))) (\lambda +(H35: (not (eq B Abst Abst))).(\lambda (_: (pr0 t7 t6)).(let H37 \def (match +(H35 (refl_equal B Abst)) in False return (\lambda (_: False).(ex2 T (\lambda +(t9: T).(pr0 (THead (Bind Abbr) v2 t4) t9)) (\lambda (t9: T).(pr0 (THead +(Flat Appl) u2 t6) t9)))) with []) in H37))) t8 (sym_eq T t8 t6 H34))) t3 +H33)) u0 (sym_eq T u0 u H32))) b (sym_eq B b Abst H31))) H30)) H29)) H28 H25 +H26))) | (pr0_epsilon t7 t8 H25 u0) \Rightarrow (\lambda (H26: (eq T (THead +(Flat Cast) u0 t7) (THead (Bind Abst) u t3))).(\lambda (H27: (eq T t8 +t6)).((let H28 \def (eq_ind T (THead (Flat Cast) u0 t7) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in +K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind Abst) u t3) H26) in (False_ind ((eq T t8 +t6) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t9: T).(pr0 (THead (Bind Abbr) v2 +t4) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u2 t6) t9))))) H28)) H27 +H25)))]) in (H25 (refl_equal T (THead (Bind Abst) u t3)) (refl_equal T +t6))))) t5 H22)) v1 (sym_eq T v1 u1 H21))) k H20)) H19)) H18)))]) in (H17 +(refl_equal T (THead k u1 t5))))))) t2 H13)) t H11 H12 H9 H10))) | (pr0_beta +u0 v0 v3 H9 t5 t6 H10) \Rightarrow (\lambda (H11: (eq T (THead (Flat Appl) v0 +(THead (Bind Abst) u0 t5)) t)).(\lambda (H12: (eq T (THead (Bind Abbr) v3 t6) +t2)).(eq_ind T (THead (Flat Appl) v0 (THead (Bind Abst) u0 t5)) (\lambda (_: +T).((eq T (THead (Bind Abbr) v3 t6) t2) \to ((pr0 v0 v3) \to ((pr0 t5 t6) \to +(ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: +T).(pr0 t2 t8))))))) (\lambda (H13: (eq T (THead (Bind Abbr) v3 t6) +t2)).(eq_ind T (THead (Bind Abbr) v3 t6) (\lambda (t7: T).((pr0 v0 v3) \to +((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) +(\lambda (t8: T).(pr0 t7 t8)))))) (\lambda (H14: (pr0 v0 v3)).(\lambda (H15: +(pr0 t5 t6)).(let H16 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Flat +Appl) v1 (THead (Bind Abst) u t3)) t7)) H4 (THead (Flat Appl) v0 (THead (Bind +Abst) u0 t5)) H11) in (let H17 \def (match H16 in eq return (\lambda (t7: +T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat Appl) v0 (THead (Bind +Abst) u0 t5))) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) +t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) v3 t6) t8)))))) with +[refl_equal \Rightarrow (\lambda (H17: (eq T (THead (Flat Appl) v1 (THead +(Bind Abst) u t3)) (THead (Flat Appl) v0 (THead (Bind Abst) u0 t5)))).(let +H18 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t7) +\Rightarrow (match t7 in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t8) \Rightarrow +t8])])) (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) (THead (Flat Appl) v0 +(THead (Bind Abst) u0 t5)) H17) in ((let H19 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u | +(TLRef _) \Rightarrow u | (THead _ _ t7) \Rightarrow (match t7 in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | +(THead _ t8 _) \Rightarrow t8])])) (THead (Flat Appl) v1 (THead (Bind Abst) u +t3)) (THead (Flat Appl) v0 (THead (Bind Abst) u0 t5)) H17) in ((let H20 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow v1 | (TLRef _) \Rightarrow v1 | (THead _ t7 _) +\Rightarrow t7])) (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) (THead +(Flat Appl) v0 (THead (Bind Abst) u0 t5)) H17) in (eq_ind T v0 (\lambda (_: +T).((eq T u u0) \to ((eq T t3 t5) \to (ex2 T (\lambda (t8: T).(pr0 (THead +(Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) v3 t6) +t8)))))) (\lambda (H21: (eq T u u0)).(eq_ind T u0 (\lambda (_: T).((eq T t3 +t5) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda +(t8: T).(pr0 (THead (Bind Abbr) v3 t6) t8))))) (\lambda (H22: (eq T t3 +t5)).(eq_ind T t5 (\lambda (_: T).(ex2 T (\lambda (t8: T).(pr0 (THead (Bind +Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) v3 t6) t8)))) (let +H23 \def (eq_ind_r T t (\lambda (t7: T).(\forall (v: T).((tlt v t7) \to +(\forall (t8: T).((pr0 v t8) \to (\forall (t9: T).((pr0 v t9) \to (ex2 T +(\lambda (t10: T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 t10)))))))))) H +(THead (Flat Appl) v0 (THead (Bind Abst) u0 t5)) H11) in (let H24 \def +(eq_ind T t3 (\lambda (t7: T).(pr0 t7 t4)) H8 t5 H22) in (let H25 \def +(eq_ind T v1 (\lambda (t7: T).(pr0 t7 v2)) H7 v0 H20) in (ex2_ind T (\lambda +(t7: T).(pr0 v2 t7)) (\lambda (t7: T).(pr0 v3 t7)) (ex2 T (\lambda (t7: +T).(pr0 (THead (Bind Abbr) v2 t4) t7)) (\lambda (t7: T).(pr0 (THead (Bind +Abbr) v3 t6) t7))) (\lambda (x: T).(\lambda (H26: (pr0 v2 x)).(\lambda (H27: +(pr0 v3 x)).(ex2_ind T (\lambda (t7: T).(pr0 t4 t7)) (\lambda (t7: T).(pr0 t6 +t7)) (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t4) t7)) (\lambda +(t7: T).(pr0 (THead (Bind Abbr) v3 t6) t7))) (\lambda (x0: T).(\lambda (H28: +(pr0 t4 x0)).(\lambda (H29: (pr0 t6 x0)).(ex_intro2 T (\lambda (t7: T).(pr0 +(THead (Bind Abbr) v2 t4) t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) v3 +t6) t7)) (THead (Bind Abbr) x x0) (pr0_comp v2 x H26 t4 x0 H28 (Bind Abbr)) +(pr0_comp v3 x H27 t6 x0 H29 (Bind Abbr)))))) (H23 t5 (tlt_trans (THead (Bind +Abst) u0 t5) t5 (THead (Flat Appl) v0 (THead (Bind Abst) u0 t5)) (tlt_head_dx +(Bind Abst) u0 t5) (tlt_head_dx (Flat Appl) v0 (THead (Bind Abst) u0 t5))) t4 +H24 t6 H15))))) (H23 v0 (tlt_head_sx (Flat Appl) v0 (THead (Bind Abst) u0 +t5)) v2 H25 v3 H14))))) t3 (sym_eq T t3 t5 H22))) u (sym_eq T u u0 H21))) v1 +(sym_eq T v1 v0 H20))) H19)) H18)))]) in (H17 (refl_equal T (THead (Flat +Appl) v0 (THead (Bind Abst) u0 t5)))))))) t2 H13)) t H11 H12 H9 H10))) | +(pr0_upsilon b H9 v0 v3 H10 u1 u2 H11 t5 t6 H12) \Rightarrow (\lambda (H13: +(eq T (THead (Flat Appl) v0 (THead (Bind b) u1 t5)) t)).(\lambda (H14: (eq T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v3) t6)) t2)).(eq_ind T +(THead (Flat Appl) v0 (THead (Bind b) u1 t5)) (\lambda (_: T).((eq T (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v3) t6)) t2) \to ((not (eq B b +Abst)) \to ((pr0 v0 v3) \to ((pr0 u1 u2) \to ((pr0 t5 t6) \to (ex2 T (\lambda +(t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 t2 +t8))))))))) (\lambda (H15: (eq T (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v3) t6)) t2)).(eq_ind T (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v3) t6)) (\lambda (t7: T).((not (eq B b Abst)) \to ((pr0 v0 v3) \to +((pr0 u1 u2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind +Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 t7 t8)))))))) (\lambda (H16: (not (eq +B b Abst))).(\lambda (_: (pr0 v0 v3)).(\lambda (_: (pr0 u1 u2)).(\lambda (_: +(pr0 t5 t6)).(let H20 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Flat +Appl) v1 (THead (Bind Abst) u t3)) t7)) H4 (THead (Flat Appl) v0 (THead (Bind +b) u1 t5)) H13) in (let H21 \def (match H20 in eq return (\lambda (t7: +T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat Appl) v0 (THead (Bind b) +u1 t5))) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) +(\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v3) +t6)) t8)))))) with [refl_equal \Rightarrow (\lambda (H21: (eq T (THead (Flat +Appl) v1 (THead (Bind Abst) u t3)) (THead (Flat Appl) v0 (THead (Bind b) u1 +t5)))).(let H22 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 +| (THead _ _ t7) \Rightarrow (match t7 in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t8) +\Rightarrow t8])])) (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) (THead +(Flat Appl) v0 (THead (Bind b) u1 t5)) H21) in ((let H23 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u | (TLRef _) \Rightarrow u | (THead _ _ t7) \Rightarrow (match +t7 in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) +\Rightarrow u | (THead _ t8 _) \Rightarrow t8])])) (THead (Flat Appl) v1 +(THead (Bind Abst) u t3)) (THead (Flat Appl) v0 (THead (Bind b) u1 t5)) H21) +in ((let H24 \def (f_equal T B (\lambda (e: T).(match e in T return (\lambda +(_: T).B) with [(TSort _) \Rightarrow Abst | (TLRef _) \Rightarrow Abst | +(THead _ _ t7) \Rightarrow (match t7 in T return (\lambda (_: T).B) with +[(TSort _) \Rightarrow Abst | (TLRef _) \Rightarrow Abst | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow Abst])])])) (THead (Flat Appl) v1 +(THead (Bind Abst) u t3)) (THead (Flat Appl) v0 (THead (Bind b) u1 t5)) H21) +in ((let H25 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda +(_: T).T) with [(TSort _) \Rightarrow v1 | (TLRef _) \Rightarrow v1 | (THead +_ t7 _) \Rightarrow t7])) (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) +(THead (Flat Appl) v0 (THead (Bind b) u1 t5)) H21) in (eq_ind T v0 (\lambda +(_: T).((eq B Abst b) \to ((eq T u u1) \to ((eq T t3 t5) \to (ex2 T (\lambda +(t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v3) t6)) t8))))))) (\lambda +(H26: (eq B Abst b)).(eq_ind B Abst (\lambda (b0: B).((eq T u u1) \to ((eq T +t3 t5) \to (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t4) t7)) +(\lambda (t7: T).(pr0 (THead (Bind b0) u2 (THead (Flat Appl) (lift (S O) O +v3) t6)) t7)))))) (\lambda (H27: (eq T u u1)).(eq_ind T u1 (\lambda (_: +T).((eq T t3 t5) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) +t8)) (\lambda (t8: T).(pr0 (THead (Bind Abst) u2 (THead (Flat Appl) (lift (S +O) O v3) t6)) t8))))) (\lambda (H28: (eq T t3 t5)).(eq_ind T t5 (\lambda (_: +T).(ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: +T).(pr0 (THead (Bind Abst) u2 (THead (Flat Appl) (lift (S O) O v3) t6)) +t8)))) (let H29 \def (eq_ind_r B b (\lambda (b0: B).(not (eq B b0 Abst))) H16 +Abst H26) in (let H30 \def (match (H29 (refl_equal B Abst)) in False return +(\lambda (_: False).(ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t4) +t7)) (\lambda (t7: T).(pr0 (THead (Bind Abst) u2 (THead (Flat Appl) (lift (S +O) O v3) t6)) t7)))) with []) in H30)) t3 (sym_eq T t3 t5 H28))) u (sym_eq T +u u1 H27))) b H26)) v1 (sym_eq T v1 v0 H25))) H24)) H23)) H22)))]) in (H21 +(refl_equal T (THead (Flat Appl) v0 (THead (Bind b) u1 t5)))))))))) t2 H15)) +t H13 H14 H9 H10 H11 H12))) | (pr0_delta u1 u2 H9 t5 t6 H10 w H11) +\Rightarrow (\lambda (H12: (eq T (THead (Bind Abbr) u1 t5) t)).(\lambda (H13: +(eq T (THead (Bind Abbr) u2 w) t2)).(eq_ind T (THead (Bind Abbr) u1 t5) +(\lambda (_: T).((eq T (THead (Bind Abbr) u2 w) t2) \to ((pr0 u1 u2) \to +((pr0 t5 t6) \to ((subst0 O u2 t6 w) \to (ex2 T (\lambda (t8: T).(pr0 (THead +(Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 t2 t8)))))))) (\lambda (H14: +(eq T (THead (Bind Abbr) u2 w) t2)).(eq_ind T (THead (Bind Abbr) u2 w) +(\lambda (t7: T).((pr0 u1 u2) \to ((pr0 t5 t6) \to ((subst0 O u2 t6 w) \to +(ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: +T).(pr0 t7 t8))))))) (\lambda (_: (pr0 u1 u2)).(\lambda (_: (pr0 t5 +t6)).(\lambda (_: (subst0 O u2 t6 w)).(let H18 \def (eq_ind_r T t (\lambda +(t7: T).(eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) t7)) H4 (THead +(Bind Abbr) u1 t5) H12) in (let H19 \def (match H18 in eq return (\lambda +(t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Bind Abbr) u1 t5)) \to +(ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: +T).(pr0 (THead (Bind Abbr) u2 w) t8)))))) with [refl_equal \Rightarrow +(\lambda (H19: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) (THead +(Bind Abbr) u1 t5))).(let H20 \def (eq_ind T (THead (Flat Appl) v1 (THead +(Bind Abst) u t3)) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ +_) \Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind Abbr) u1 +t5) H19) in (False_ind (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t4) +t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) u2 w) t7))) H20)))]) in (H19 +(refl_equal T (THead (Bind Abbr) u1 t5)))))))) t2 H14)) t H12 H13 H9 H10 +H11))) | (pr0_zeta b H9 t5 t6 H10 u0) \Rightarrow (\lambda (H11: (eq T (THead +(Bind b) u0 (lift (S O) O t5)) t)).(\lambda (H12: (eq T t6 t2)).(eq_ind T +(THead (Bind b) u0 (lift (S O) O t5)) (\lambda (_: T).((eq T t6 t2) \to ((not +(eq B b Abst)) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind +Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 t2 t8))))))) (\lambda (H13: (eq T t6 +t2)).(eq_ind T t2 (\lambda (t7: T).((not (eq B b Abst)) \to ((pr0 t5 t7) \to +(ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: +T).(pr0 t2 t8)))))) (\lambda (_: (not (eq B b Abst))).(\lambda (_: (pr0 t5 +t2)).(let H16 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Flat Appl) v1 +(THead (Bind Abst) u t3)) t7)) H4 (THead (Bind b) u0 (lift (S O) O t5)) H11) +in (let H17 \def (match H16 in eq return (\lambda (t7: T).(\lambda (_: (eq ? +? t7)).((eq T t7 (THead (Bind b) u0 (lift (S O) O t5))) \to (ex2 T (\lambda +(t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 t2 t8)))))) +with [refl_equal \Rightarrow (\lambda (H17: (eq T (THead (Flat Appl) v1 +(THead (Bind Abst) u t3)) (THead (Bind b) u0 (lift (S O) O t5)))).(let H18 +\def (eq_ind T (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind b) u0 (lift (S O) O t5)) H17) in +(False_ind (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t4) t7)) +(\lambda (t7: T).(pr0 t2 t7))) H18)))]) in (H17 (refl_equal T (THead (Bind b) +u0 (lift (S O) O t5)))))))) t6 (sym_eq T t6 t2 H13))) t H11 H12 H9 H10))) | +(pr0_epsilon t5 t6 H9 u0) \Rightarrow (\lambda (H10: (eq T (THead (Flat Cast) +u0 t5) t)).(\lambda (H11: (eq T t6 t2)).(eq_ind T (THead (Flat Cast) u0 t5) +(\lambda (_: T).((eq T t6 t2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: +T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: T).(pr0 t2 t8)))))) +(\lambda (H12: (eq T t6 t2)).(eq_ind T t2 (\lambda (t7: T).((pr0 t5 t7) \to +(ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda (t8: +T).(pr0 t2 t8))))) (\lambda (_: (pr0 t5 t2)).(let H14 \def (eq_ind_r T t +(\lambda (t7: T).(eq T (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) t7)) +H4 (THead (Flat Cast) u0 t5) H10) in (let H15 \def (match H14 in eq return +(\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat Cast) u0 +t5)) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t4) t8)) (\lambda +(t8: T).(pr0 t2 t8)))))) with [refl_equal \Rightarrow (\lambda (H15: (eq T +(THead (Flat Appl) v1 (THead (Bind Abst) u t3)) (THead (Flat Cast) u0 +t5))).(let H16 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | +(Flat f) \Rightarrow (match f in F return (\lambda (_: F).Prop) with [Appl +\Rightarrow True | Cast \Rightarrow False])])])) I (THead (Flat Cast) u0 t5) +H15) in (False_ind (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t4) +t7)) (\lambda (t7: T).(pr0 t2 t7))) H16)))]) in (H15 (refl_equal T (THead +(Flat Cast) u0 t5)))))) t6 (sym_eq T t6 t2 H12))) t H10 H11 H9)))]) in (H9 +(refl_equal T t) (refl_equal T t2))))) t1 H6)) t H4 H5 H2 H3))) | +(pr0_upsilon b H2 v1 v2 H3 u1 u2 H4 t3 t4 H5) \Rightarrow (\lambda (H6: (eq T +(THead (Flat Appl) v1 (THead (Bind b) u1 t3)) t)).(\lambda (H7: (eq T (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t1)).(eq_ind T (THead +(Flat Appl) v1 (THead (Bind b) u1 t3)) (\lambda (_: T).((eq T (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t1) \to ((not (eq B b Abst)) \to +((pr0 v1 v2) \to ((pr0 u1 u2) \to ((pr0 t3 t4) \to (ex2 T (\lambda (t6: +T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 t2 t6))))))))) (\lambda (H8: (eq T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t1)).(eq_ind T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) (\lambda (t5: +T).((not (eq B b Abst)) \to ((pr0 v1 v2) \to ((pr0 u1 u2) \to ((pr0 t3 t4) +\to (ex2 T (\lambda (t6: T).(pr0 t5 t6)) (\lambda (t6: T).(pr0 t2 t6)))))))) +(\lambda (H9: (not (eq B b Abst))).(\lambda (H10: (pr0 v1 v2)).(\lambda (H11: +(pr0 u1 u2)).(\lambda (H12: (pr0 t3 t4)).(let H13 \def (match H1 in pr0 +return (\lambda (t5: T).(\lambda (t6: T).(\lambda (_: (pr0 t5 t6)).((eq T t5 +t) \to ((eq T t6 t2) \to (ex2 T (\lambda (t7: T).(pr0 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) t7)) (\lambda (t7: T).(pr0 t2 +t7)))))))) with [(pr0_refl t5) \Rightarrow (\lambda (H13: (eq T t5 +t)).(\lambda (H14: (eq T t5 t2)).(eq_ind T t (\lambda (t6: T).((eq T t6 t2) +\to (ex2 T (\lambda (t7: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4)) t7)) (\lambda (t7: T).(pr0 t2 t7))))) (\lambda (H15: (eq T t +t2)).(eq_ind T t2 (\lambda (_: T).(ex2 T (\lambda (t7: T).(pr0 (THead (Bind +b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t7)) (\lambda (t7: T).(pr0 t2 +t7)))) (let H16 \def (eq_ind_r T t (\lambda (t6: T).(eq T t6 t2)) H15 (THead +(Flat Appl) v1 (THead (Bind b) u1 t3)) H6) in (eq_ind T (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) (\lambda (t6: T).(ex2 T (\lambda (t7: T).(pr0 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t7)) (\lambda (t7: +T).(pr0 t6 t7)))) (let H17 \def (eq_ind_r T t (\lambda (t6: T).(eq T t5 t6)) +H13 (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) H6) in (let H18 \def +(eq_ind_r T t (\lambda (t6: T).(\forall (v: T).((tlt v t6) \to (\forall (t7: +T).((pr0 v t7) \to (\forall (t8: T).((pr0 v t8) \to (ex2 T (\lambda (t9: +T).(pr0 t7 t9)) (\lambda (t9: T).(pr0 t8 t9)))))))))) H (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) H6) in (ex2_sym T (pr0 (THead (Flat Appl) v1 (THead +(Bind b) u1 t3))) (pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4))) (pr0_confluence__pr0_cong_upsilon_refl b H9 u1 u2 H11 t3 t4 H12 v1 +v2 v2 H10 (pr0_refl v2))))) t2 H16)) t (sym_eq T t t2 H15))) t5 (sym_eq T t5 +t H13) H14))) | (pr0_comp u0 u3 H13 t5 t6 H14 k) \Rightarrow (\lambda (H15: +(eq T (THead k u0 t5) t)).(\lambda (H16: (eq T (THead k u3 t6) t2)).(eq_ind T +(THead k u0 t5) (\lambda (_: T).((eq T (THead k u3 t6) t2) \to ((pr0 u0 u3) +\to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 t2 t8))))))) +(\lambda (H17: (eq T (THead k u3 t6) t2)).(eq_ind T (THead k u3 t6) (\lambda +(t7: T).((pr0 u0 u3) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: +T).(pr0 t7 t8)))))) (\lambda (H18: (pr0 u0 u3)).(\lambda (H19: (pr0 t5 +t6)).(let H20 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) t7)) H6 (THead k u0 t5) H15) in (let H21 \def (match +H20 in eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead +k u0 t5)) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 (THead k u3 t6) +t8)))))) with [refl_equal \Rightarrow (\lambda (H21: (eq T (THead (Flat Appl) +v1 (THead (Bind b) u1 t3)) (THead k u0 t5))).(let H22 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow (THead (Bind b) u1 t3) | (TLRef _) \Rightarrow (THead (Bind b) u1 +t3) | (THead _ _ t7) \Rightarrow t7])) (THead (Flat Appl) v1 (THead (Bind b) +u1 t3)) (THead k u0 t5) H21) in ((let H23 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow v1 | +(TLRef _) \Rightarrow v1 | (THead _ t7 _) \Rightarrow t7])) (THead (Flat +Appl) v1 (THead (Bind b) u1 t3)) (THead k u0 t5) H21) in ((let H24 \def +(f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) with +[(TSort _) \Rightarrow (Flat Appl) | (TLRef _) \Rightarrow (Flat Appl) | +(THead k0 _ _) \Rightarrow k0])) (THead (Flat Appl) v1 (THead (Bind b) u1 +t3)) (THead k u0 t5) H21) in (eq_ind K (Flat Appl) (\lambda (k0: K).((eq T v1 +u0) \to ((eq T (THead (Bind b) u1 t3) t5) \to (ex2 T (\lambda (t7: T).(pr0 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t7)) (\lambda +(t7: T).(pr0 (THead k0 u3 t6) t7)))))) (\lambda (H25: (eq T v1 u0)).(eq_ind T +u0 (\lambda (_: T).((eq T (THead (Bind b) u1 t3) t5) \to (ex2 T (\lambda (t8: +T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) +(\lambda (t8: T).(pr0 (THead (Flat Appl) u3 t6) t8))))) (\lambda (H26: (eq T +(THead (Bind b) u1 t3) t5)).(eq_ind T (THead (Bind b) u1 t3) (\lambda (_: +T).(ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 (THead (Flat Appl) u3 t6) t8)))) +(let H27 \def (eq_ind_r K k (\lambda (k0: K).(eq T (THead k0 u0 t5) t)) H15 +(Flat Appl) H24) in (let H28 \def (eq_ind_r T t5 (\lambda (t7: T).(pr0 t7 +t6)) H19 (THead (Bind b) u1 t3) H26) in (let H29 \def (match H28 in pr0 +return (\lambda (t7: T).(\lambda (t8: T).(\lambda (_: (pr0 t7 t8)).((eq T t7 +(THead (Bind b) u1 t3)) \to ((eq T t8 t6) \to (ex2 T (\lambda (t9: T).(pr0 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t9)) (\lambda +(t9: T).(pr0 (THead (Flat Appl) u3 t6) t9)))))))) with [(pr0_refl t7) +\Rightarrow (\lambda (H29: (eq T t7 (THead (Bind b) u1 t3))).(\lambda (H30: +(eq T t7 t6)).(eq_ind T (THead (Bind b) u1 t3) (\lambda (t8: T).((eq T t8 t6) +\to (ex2 T (\lambda (t9: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4)) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u3 t6) t9))))) +(\lambda (H31: (eq T (THead (Bind b) u1 t3) t6)).(eq_ind T (THead (Bind b) u1 +t3) (\lambda (t8: T).(ex2 T (\lambda (t9: T).(pr0 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) t9)) (\lambda (t9: T).(pr0 (THead (Flat +Appl) u3 t8) t9)))) (let H32 \def (eq_ind_r T t5 (\lambda (t8: T).(eq T +(THead (Flat Appl) u0 t8) t)) H27 (THead (Bind b) u1 t3) H26) in (let H33 +\def (eq_ind_r T t (\lambda (t8: T).(\forall (v: T).((tlt v t8) \to (\forall +(t9: T).((pr0 v t9) \to (\forall (t10: T).((pr0 v t10) \to (ex2 T (\lambda +(t11: T).(pr0 t9 t11)) (\lambda (t11: T).(pr0 t10 t11)))))))))) H (THead +(Flat Appl) u0 (THead (Bind b) u1 t3)) H32) in (let H34 \def (eq_ind T v1 +(\lambda (t8: T).(pr0 t8 v2)) H10 u0 H25) in (ex2_ind T (\lambda (t8: T).(pr0 +v2 t8)) (\lambda (t8: T).(pr0 u3 t8)) (ex2 T (\lambda (t8: T).(pr0 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: +T).(pr0 (THead (Flat Appl) u3 (THead (Bind b) u1 t3)) t8))) (\lambda (x: +T).(\lambda (H35: (pr0 v2 x)).(\lambda (H36: (pr0 u3 x)).(ex2_sym T (pr0 +(THead (Flat Appl) u3 (THead (Bind b) u1 t3))) (pr0 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4))) (pr0_confluence__pr0_cong_upsilon_refl b +H9 u1 u2 H11 t3 t4 H12 u3 v2 x H36 H35))))) (H33 u0 (tlt_head_sx (Flat Appl) +u0 (THead (Bind b) u1 t3)) v2 H34 u3 H18))))) t6 H31)) t7 (sym_eq T t7 (THead +(Bind b) u1 t3) H29) H30))) | (pr0_comp u4 u5 H29 t7 t8 H30 k0) \Rightarrow +(\lambda (H31: (eq T (THead k0 u4 t7) (THead (Bind b) u1 t3))).(\lambda (H32: +(eq T (THead k0 u5 t8) t6)).((let H33 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t7 | +(TLRef _) \Rightarrow t7 | (THead _ _ t9) \Rightarrow t9])) (THead k0 u4 t7) +(THead (Bind b) u1 t3) H31) in ((let H34 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u4 | +(TLRef _) \Rightarrow u4 | (THead _ t9 _) \Rightarrow t9])) (THead k0 u4 t7) +(THead (Bind b) u1 t3) H31) in ((let H35 \def (f_equal T K (\lambda (e: +T).(match e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k0 | +(TLRef _) \Rightarrow k0 | (THead k1 _ _) \Rightarrow k1])) (THead k0 u4 t7) +(THead (Bind b) u1 t3) H31) in (eq_ind K (Bind b) (\lambda (k1: K).((eq T u4 +u1) \to ((eq T t7 t3) \to ((eq T (THead k1 u5 t8) t6) \to ((pr0 u4 u5) \to +((pr0 t7 t8) \to (ex2 T (\lambda (t9: T).(pr0 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u3 +t6) t9))))))))) (\lambda (H36: (eq T u4 u1)).(eq_ind T u1 (\lambda (t9: +T).((eq T t7 t3) \to ((eq T (THead (Bind b) u5 t8) t6) \to ((pr0 t9 u5) \to +((pr0 t7 t8) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) t10)) (\lambda (t10: T).(pr0 (THead (Flat +Appl) u3 t6) t10)))))))) (\lambda (H37: (eq T t7 t3)).(eq_ind T t3 (\lambda +(t9: T).((eq T (THead (Bind b) u5 t8) t6) \to ((pr0 u1 u5) \to ((pr0 t9 t8) +\to (ex2 T (\lambda (t10: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4)) t10)) (\lambda (t10: T).(pr0 (THead (Flat Appl) u3 t6) +t10))))))) (\lambda (H38: (eq T (THead (Bind b) u5 t8) t6)).(eq_ind T (THead +(Bind b) u5 t8) (\lambda (t9: T).((pr0 u1 u5) \to ((pr0 t3 t8) \to (ex2 T +(\lambda (t10: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4)) t10)) (\lambda (t10: T).(pr0 (THead (Flat Appl) u3 t9) t10)))))) +(\lambda (H39: (pr0 u1 u5)).(\lambda (H40: (pr0 t3 t8)).(let H41 \def +(eq_ind_r T t5 (\lambda (t9: T).(eq T (THead (Flat Appl) u0 t9) t)) H27 +(THead (Bind b) u1 t3) H26) in (let H42 \def (eq_ind_r T t (\lambda (t9: +T).(\forall (v: T).((tlt v t9) \to (\forall (t10: T).((pr0 v t10) \to +(\forall (t11: T).((pr0 v t11) \to (ex2 T (\lambda (t12: T).(pr0 t10 t12)) +(\lambda (t12: T).(pr0 t11 t12)))))))))) H (THead (Flat Appl) u0 (THead (Bind +b) u1 t3)) H41) in (let H43 \def (eq_ind T v1 (\lambda (t9: T).(pr0 t9 v2)) +H10 u0 H25) in (ex2_ind T (\lambda (t9: T).(pr0 v2 t9)) (\lambda (t9: T).(pr0 +u3 t9)) (ex2 T (\lambda (t9: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u3 +(THead (Bind b) u5 t8)) t9))) (\lambda (x: T).(\lambda (H44: (pr0 v2 +x)).(\lambda (H45: (pr0 u3 x)).(ex2_ind T (\lambda (t9: T).(pr0 t8 t9)) +(\lambda (t9: T).(pr0 t4 t9)) (ex2 T (\lambda (t9: T).(pr0 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) t9)) (\lambda (t9: T).(pr0 (THead +(Flat Appl) u3 (THead (Bind b) u5 t8)) t9))) (\lambda (x0: T).(\lambda (H46: +(pr0 t8 x0)).(\lambda (H47: (pr0 t4 x0)).(ex2_ind T (\lambda (t9: T).(pr0 u5 +t9)) (\lambda (t9: T).(pr0 u2 t9)) (ex2 T (\lambda (t9: T).(pr0 (THead (Bind +b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t9)) (\lambda (t9: T).(pr0 +(THead (Flat Appl) u3 (THead (Bind b) u5 t8)) t9))) (\lambda (x1: T).(\lambda +(H48: (pr0 u5 x1)).(\lambda (H49: (pr0 u2 x1)).(ex2_sym T (pr0 (THead (Flat +Appl) u3 (THead (Bind b) u5 t8))) (pr0 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4))) (pr0_confluence__pr0_cong_upsilon_cong b H9 u3 v2 x +H45 H44 t8 t4 x0 H46 H47 u5 u2 x1 H48 H49))))) (H42 u1 (tlt_trans (THead +(Bind b) u1 t3) u1 (THead (Flat Appl) u0 (THead (Bind b) u1 t3)) (tlt_head_sx +(Bind b) u1 t3) (tlt_head_dx (Flat Appl) u0 (THead (Bind b) u1 t3))) u5 H39 +u2 H11))))) (H42 t3 (tlt_trans (THead (Bind b) u1 t3) t3 (THead (Flat Appl) +u0 (THead (Bind b) u1 t3)) (tlt_head_dx (Bind b) u1 t3) (tlt_head_dx (Flat +Appl) u0 (THead (Bind b) u1 t3))) t8 H40 t4 H12))))) (H42 u0 (tlt_head_sx +(Flat Appl) u0 (THead (Bind b) u1 t3)) v2 H43 u3 H18))))))) t6 H38)) t7 +(sym_eq T t7 t3 H37))) u4 (sym_eq T u4 u1 H36))) k0 (sym_eq K k0 (Bind b) +H35))) H34)) H33)) H32 H29 H30))) | (pr0_beta u v0 v3 H29 t7 t8 H30) +\Rightarrow (\lambda (H31: (eq T (THead (Flat Appl) v0 (THead (Bind Abst) u +t7)) (THead (Bind b) u1 t3))).(\lambda (H32: (eq T (THead (Bind Abbr) v3 t8) +t6)).((let H33 \def (eq_ind T (THead (Flat Appl) v0 (THead (Bind Abst) u t7)) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow +(match k0 in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False +| (Flat _) \Rightarrow True])])) I (THead (Bind b) u1 t3) H31) in (False_ind +((eq T (THead (Bind Abbr) v3 t8) t6) \to ((pr0 v0 v3) \to ((pr0 t7 t8) \to +(ex2 T (\lambda (t9: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u3 t6) t9)))))) +H33)) H32 H29 H30))) | (pr0_upsilon b0 H29 v0 v3 H30 u4 u5 H31 t7 t8 H32) +\Rightarrow (\lambda (H33: (eq T (THead (Flat Appl) v0 (THead (Bind b0) u4 +t7)) (THead (Bind b) u1 t3))).(\lambda (H34: (eq T (THead (Bind b0) u5 (THead +(Flat Appl) (lift (S O) O v3) t8)) t6)).((let H35 \def (eq_ind T (THead (Flat +Appl) v0 (THead (Bind b0) u4 t7)) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind b) u1 t3) H33) in (False_ind ((eq T (THead (Bind b0) +u5 (THead (Flat Appl) (lift (S O) O v3) t8)) t6) \to ((not (eq B b0 Abst)) +\to ((pr0 v0 v3) \to ((pr0 u4 u5) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t9: +T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t9)) +(\lambda (t9: T).(pr0 (THead (Flat Appl) u3 t6) t9)))))))) H35)) H34 H29 H30 +H31 H32))) | (pr0_delta u4 u5 H29 t7 t8 H30 w H31) \Rightarrow (\lambda (H32: +(eq T (THead (Bind Abbr) u4 t7) (THead (Bind b) u1 t3))).(\lambda (H33: (eq T +(THead (Bind Abbr) u5 w) t6)).((let H34 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t7 | +(TLRef _) \Rightarrow t7 | (THead _ _ t9) \Rightarrow t9])) (THead (Bind +Abbr) u4 t7) (THead (Bind b) u1 t3) H32) in ((let H35 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u4 | (TLRef _) \Rightarrow u4 | (THead _ t9 _) \Rightarrow t9])) +(THead (Bind Abbr) u4 t7) (THead (Bind b) u1 t3) H32) in ((let H36 \def +(f_equal T B (\lambda (e: T).(match e in T return (\lambda (_: T).B) with +[(TSort _) \Rightarrow Abbr | (TLRef _) \Rightarrow Abbr | (THead k0 _ _) +\Rightarrow (match k0 in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (THead (Bind Abbr) u4 t7) +(THead (Bind b) u1 t3) H32) in (eq_ind B Abbr (\lambda (b0: B).((eq T u4 u1) +\to ((eq T t7 t3) \to ((eq T (THead (Bind Abbr) u5 w) t6) \to ((pr0 u4 u5) +\to ((pr0 t7 t8) \to ((subst0 O u5 t8 w) \to (ex2 T (\lambda (t9: T).(pr0 +(THead (Bind b0) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t9)) (\lambda +(t9: T).(pr0 (THead (Flat Appl) u3 t6) t9)))))))))) (\lambda (H37: (eq T u4 +u1)).(eq_ind T u1 (\lambda (t9: T).((eq T t7 t3) \to ((eq T (THead (Bind +Abbr) u5 w) t6) \to ((pr0 t9 u5) \to ((pr0 t7 t8) \to ((subst0 O u5 t8 w) \to +(ex2 T (\lambda (t10: T).(pr0 (THead (Bind Abbr) u2 (THead (Flat Appl) (lift +(S O) O v2) t4)) t10)) (\lambda (t10: T).(pr0 (THead (Flat Appl) u3 t6) +t10))))))))) (\lambda (H38: (eq T t7 t3)).(eq_ind T t3 (\lambda (t9: T).((eq +T (THead (Bind Abbr) u5 w) t6) \to ((pr0 u1 u5) \to ((pr0 t9 t8) \to ((subst0 +O u5 t8 w) \to (ex2 T (\lambda (t10: T).(pr0 (THead (Bind Abbr) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) t10)) (\lambda (t10: T).(pr0 (THead (Flat +Appl) u3 t6) t10)))))))) (\lambda (H39: (eq T (THead (Bind Abbr) u5 w) +t6)).(eq_ind T (THead (Bind Abbr) u5 w) (\lambda (t9: T).((pr0 u1 u5) \to +((pr0 t3 t8) \to ((subst0 O u5 t8 w) \to (ex2 T (\lambda (t10: T).(pr0 (THead +(Bind Abbr) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t10)) (\lambda (t10: +T).(pr0 (THead (Flat Appl) u3 t9) t10))))))) (\lambda (H40: (pr0 u1 +u5)).(\lambda (H41: (pr0 t3 t8)).(\lambda (H42: (subst0 O u5 t8 w)).(let H43 +\def (eq_ind_r B b (\lambda (b0: B).(eq T (THead (Bind b0) u1 t3) t5)) H26 +Abbr H36) in (let H44 \def (eq_ind_r B b (\lambda (b0: B).(not (eq B b0 +Abst))) H9 Abbr H36) in (let H45 \def (eq_ind_r B b (\lambda (b0: B).(eq T +(THead (Bind b0) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t1)) H8 Abbr +H36) in (let H46 \def (eq_ind_r T t5 (\lambda (t9: T).(eq T (THead (Flat +Appl) u0 t9) t)) H27 (THead (Bind Abbr) u1 t3) H43) in (let H47 \def +(eq_ind_r T t (\lambda (t9: T).(\forall (v: T).((tlt v t9) \to (\forall (t10: +T).((pr0 v t10) \to (\forall (t11: T).((pr0 v t11) \to (ex2 T (\lambda (t12: +T).(pr0 t10 t12)) (\lambda (t12: T).(pr0 t11 t12)))))))))) H (THead (Flat +Appl) u0 (THead (Bind Abbr) u1 t3)) H46) in (let H48 \def (eq_ind T v1 +(\lambda (t9: T).(pr0 t9 v2)) H10 u0 H25) in (ex2_ind T (\lambda (t9: T).(pr0 +v2 t9)) (\lambda (t9: T).(pr0 u3 t9)) (ex2 T (\lambda (t9: T).(pr0 (THead +(Bind Abbr) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t9)) (\lambda (t9: +T).(pr0 (THead (Flat Appl) u3 (THead (Bind Abbr) u5 w)) t9))) (\lambda (x: +T).(\lambda (H49: (pr0 v2 x)).(\lambda (H50: (pr0 u3 x)).(ex2_ind T (\lambda +(t9: T).(pr0 t8 t9)) (\lambda (t9: T).(pr0 t4 t9)) (ex2 T (\lambda (t9: +T).(pr0 (THead (Bind Abbr) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t9)) +(\lambda (t9: T).(pr0 (THead (Flat Appl) u3 (THead (Bind Abbr) u5 w)) t9))) +(\lambda (x0: T).(\lambda (H51: (pr0 t8 x0)).(\lambda (H52: (pr0 t4 +x0)).(ex2_ind T (\lambda (t9: T).(pr0 u5 t9)) (\lambda (t9: T).(pr0 u2 t9)) +(ex2 T (\lambda (t9: T).(pr0 (THead (Bind Abbr) u2 (THead (Flat Appl) (lift +(S O) O v2) t4)) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u3 (THead +(Bind Abbr) u5 w)) t9))) (\lambda (x1: T).(\lambda (H53: (pr0 u5 +x1)).(\lambda (H54: (pr0 u2 x1)).(ex2_sym T (pr0 (THead (Flat Appl) u3 (THead +(Bind Abbr) u5 w))) (pr0 (THead (Bind Abbr) u2 (THead (Flat Appl) (lift (S O) +O v2) t4))) (pr0_confluence__pr0_cong_upsilon_delta H44 u5 t8 w H42 u3 v2 x +H50 H49 t4 x0 H51 H52 u2 x1 H53 H54))))) (H47 u1 (tlt_trans (THead (Bind +Abbr) u1 t3) u1 (THead (Flat Appl) u0 (THead (Bind Abbr) u1 t3)) (tlt_head_sx +(Bind Abbr) u1 t3) (tlt_head_dx (Flat Appl) u0 (THead (Bind Abbr) u1 t3))) u5 +H40 u2 H11))))) (H47 t3 (tlt_trans (THead (Bind Abbr) u1 t3) t3 (THead (Flat +Appl) u0 (THead (Bind Abbr) u1 t3)) (tlt_head_dx (Bind Abbr) u1 t3) +(tlt_head_dx (Flat Appl) u0 (THead (Bind Abbr) u1 t3))) t8 H41 t4 H12))))) +(H47 u0 (tlt_head_sx (Flat Appl) u0 (THead (Bind Abbr) u1 t3)) v2 H48 u3 +H18))))))))))) t6 H39)) t7 (sym_eq T t7 t3 H38))) u4 (sym_eq T u4 u1 H37))) b +H36)) H35)) H34)) H33 H29 H30 H31))) | (pr0_zeta b0 H29 t7 t8 H30 u) +\Rightarrow (\lambda (H31: (eq T (THead (Bind b0) u (lift (S O) O t7)) (THead +(Bind b) u1 t3))).(\lambda (H32: (eq T t8 t6)).((let H33 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t9: T) on t9: T +\def (match t9 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k0 u4 t10) \Rightarrow (THead k0 (lref_map f d u4) (lref_map f (s k0 +d) t10))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t7) | (TLRef _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t9: T) on t9: T +\def (match t9 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k0 u4 t10) \Rightarrow (THead k0 (lref_map f d u4) (lref_map f (s k0 +d) t10))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t7) | (THead _ _ +t9) \Rightarrow t9])) (THead (Bind b0) u (lift (S O) O t7)) (THead (Bind b) +u1 t3) H31) in ((let H34 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) +\Rightarrow u | (THead _ t9 _) \Rightarrow t9])) (THead (Bind b0) u (lift (S +O) O t7)) (THead (Bind b) u1 t3) H31) in ((let H35 \def (f_equal T B (\lambda +(e: T).(match e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b0 +| (TLRef _) \Rightarrow b0 | (THead k0 _ _) \Rightarrow (match k0 in K return +(\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) \Rightarrow +b0])])) (THead (Bind b0) u (lift (S O) O t7)) (THead (Bind b) u1 t3) H31) in +(eq_ind B b (\lambda (b1: B).((eq T u u1) \to ((eq T (lift (S O) O t7) t3) +\to ((eq T t8 t6) \to ((not (eq B b1 Abst)) \to ((pr0 t7 t8) \to (ex2 T +(\lambda (t9: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4)) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u3 t6) t9))))))))) +(\lambda (H36: (eq T u u1)).(eq_ind T u1 (\lambda (_: T).((eq T (lift (S O) O +t7) t3) \to ((eq T t8 t6) \to ((not (eq B b Abst)) \to ((pr0 t7 t8) \to (ex2 +T (\lambda (t10: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4)) t10)) (\lambda (t10: T).(pr0 (THead (Flat Appl) u3 t6) t10)))))))) +(\lambda (H37: (eq T (lift (S O) O t7) t3)).(eq_ind T (lift (S O) O t7) +(\lambda (_: T).((eq T t8 t6) \to ((not (eq B b Abst)) \to ((pr0 t7 t8) \to +(ex2 T (\lambda (t10: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) t10)) (\lambda (t10: T).(pr0 (THead (Flat Appl) u3 t6) +t10))))))) (\lambda (H38: (eq T t8 t6)).(eq_ind T t6 (\lambda (t9: T).((not +(eq B b Abst)) \to ((pr0 t7 t9) \to (ex2 T (\lambda (t10: T).(pr0 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t10)) (\lambda (t10: +T).(pr0 (THead (Flat Appl) u3 t6) t10)))))) (\lambda (H39: (not (eq B b +Abst))).(\lambda (H40: (pr0 t7 t6)).(let H41 \def (eq_ind_r T t3 (\lambda +(t9: T).(eq T (THead (Bind b) u1 t9) t5)) H26 (lift (S O) O t7) H37) in (let +H42 \def (eq_ind_r T t5 (\lambda (t9: T).(eq T (THead (Flat Appl) u0 t9) t)) +H27 (THead (Bind b) u1 (lift (S O) O t7)) H41) in (let H43 \def (eq_ind_r T t +(\lambda (t9: T).(\forall (v: T).((tlt v t9) \to (\forall (t10: T).((pr0 v +t10) \to (\forall (t11: T).((pr0 v t11) \to (ex2 T (\lambda (t12: T).(pr0 t10 +t12)) (\lambda (t12: T).(pr0 t11 t12)))))))))) H (THead (Flat Appl) u0 (THead +(Bind b) u1 (lift (S O) O t7))) H42) in (let H44 \def (eq_ind_r T t3 (\lambda +(t9: T).(pr0 t9 t4)) H12 (lift (S O) O t7) H37) in (ex2_ind T (\lambda (t9: +T).(eq T t4 (lift (S O) O t9))) (\lambda (t9: T).(pr0 t7 t9)) (ex2 T (\lambda +(t9: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u3 t6) t9))) (\lambda (x: +T).(\lambda (H45: (eq T t4 (lift (S O) O x))).(\lambda (H46: (pr0 t7 +x)).(eq_ind_r T (lift (S O) O x) (\lambda (t9: T).(ex2 T (\lambda (t10: +T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t9)) t10)) +(\lambda (t10: T).(pr0 (THead (Flat Appl) u3 t6) t10)))) (let H47 \def +(eq_ind T v1 (\lambda (t9: T).(pr0 t9 v2)) H10 u0 H25) in (ex2_ind T (\lambda +(t9: T).(pr0 v2 t9)) (\lambda (t9: T).(pr0 u3 t9)) (ex2 T (\lambda (t9: +T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) (lift (S O) O +x))) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u3 t6) t9))) (\lambda (x0: +T).(\lambda (H48: (pr0 v2 x0)).(\lambda (H49: (pr0 u3 x0)).(ex2_ind T +(\lambda (t9: T).(pr0 x t9)) (\lambda (t9: T).(pr0 t6 t9)) (ex2 T (\lambda +(t9: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) (lift (S +O) O x))) t9)) (\lambda (t9: T).(pr0 (THead (Flat Appl) u3 t6) t9))) (\lambda +(x1: T).(\lambda (H50: (pr0 x x1)).(\lambda (H51: (pr0 t6 x1)).(ex2_sym T +(pr0 (THead (Flat Appl) u3 t6)) (pr0 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) (lift (S O) O x)))) (pr0_confluence__pr0_cong_upsilon_zeta +b H39 u1 u2 H11 u3 v2 x0 H49 H48 x t6 x1 H50 H51))))) (H43 t7 (tlt_trans +(THead (Bind b) u1 (lift (S O) O t7)) t7 (THead (Flat Appl) u0 (THead (Bind +b) u1 (lift (S O) O t7))) (lift_tlt_dx (Bind b) u1 t7 (S O) O) (tlt_head_dx +(Flat Appl) u0 (THead (Bind b) u1 (lift (S O) O t7)))) x H46 t6 H40))))) (H43 +u0 (tlt_head_sx (Flat Appl) u0 (THead (Bind b) u1 (lift (S O) O t7))) v2 H47 +u3 H18))) t4 H45)))) (pr0_gen_lift t7 t4 (S O) O H44)))))))) t8 (sym_eq T t8 +t6 H38))) t3 H37)) u (sym_eq T u u1 H36))) b0 (sym_eq B b0 b H35))) H34)) +H33)) H32 H29 H30))) | (pr0_epsilon t7 t8 H29 u) \Rightarrow (\lambda (H30: +(eq T (THead (Flat Cast) u t7) (THead (Bind b) u1 t3))).(\lambda (H31: (eq T +t8 t6)).((let H32 \def (eq_ind T (THead (Flat Cast) u t7) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in +K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind b) u1 t3) H30) in (False_ind ((eq T t8 +t6) \to ((pr0 t7 t8) \to (ex2 T (\lambda (t9: T).(pr0 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) t9)) (\lambda (t9: T).(pr0 (THead +(Flat Appl) u3 t6) t9))))) H32)) H31 H29)))]) in (H29 (refl_equal T (THead +(Bind b) u1 t3)) (refl_equal T t6))))) t5 H26)) v1 (sym_eq T v1 u0 H25))) k +H24)) H23)) H22)))]) in (H21 (refl_equal T (THead k u0 t5))))))) t2 H17)) t +H15 H16 H13 H14))) | (pr0_beta u v0 v3 H13 t5 t6 H14) \Rightarrow (\lambda +(H15: (eq T (THead (Flat Appl) v0 (THead (Bind Abst) u t5)) t)).(\lambda +(H16: (eq T (THead (Bind Abbr) v3 t6) t2)).(eq_ind T (THead (Flat Appl) v0 +(THead (Bind Abst) u t5)) (\lambda (_: T).((eq T (THead (Bind Abbr) v3 t6) +t2) \to ((pr0 v0 v3) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: +T).(pr0 t2 t8))))))) (\lambda (H17: (eq T (THead (Bind Abbr) v3 t6) +t2)).(eq_ind T (THead (Bind Abbr) v3 t6) (\lambda (t7: T).((pr0 v0 v3) \to +((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 t7 t8)))))) (\lambda +(_: (pr0 v0 v3)).(\lambda (_: (pr0 t5 t6)).(let H20 \def (eq_ind_r T t +(\lambda (t7: T).(eq T (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) t7)) H6 +(THead (Flat Appl) v0 (THead (Bind Abst) u t5)) H15) in (let H21 \def (match +H20 in eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead +(Flat Appl) v0 (THead (Bind Abst) u t5))) \to (ex2 T (\lambda (t8: T).(pr0 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda +(t8: T).(pr0 (THead (Bind Abbr) v3 t6) t8)))))) with [refl_equal \Rightarrow +(\lambda (H21: (eq T (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) (THead +(Flat Appl) v0 (THead (Bind Abst) u t5)))).(let H22 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t7) \Rightarrow (match +t7 in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) +\Rightarrow t3 | (THead _ _ t8) \Rightarrow t8])])) (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) (THead (Flat Appl) v0 (THead (Bind Abst) u t5)) H21) +in ((let H23 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda +(_: T).T) with [(TSort _) \Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead +_ _ t7) \Rightarrow (match t7 in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ t8 _) \Rightarrow +t8])])) (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) (THead (Flat Appl) v0 +(THead (Bind Abst) u t5)) H21) in ((let H24 \def (f_equal T B (\lambda (e: +T).(match e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b | +(TLRef _) \Rightarrow b | (THead _ _ t7) \Rightarrow (match t7 in T return +(\lambda (_: T).B) with [(TSort _) \Rightarrow b | (TLRef _) \Rightarrow b | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind +b0) \Rightarrow b0 | (Flat _) \Rightarrow b])])])) (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) (THead (Flat Appl) v0 (THead (Bind Abst) u t5)) H21) +in ((let H25 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda +(_: T).T) with [(TSort _) \Rightarrow v1 | (TLRef _) \Rightarrow v1 | (THead +_ t7 _) \Rightarrow t7])) (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) +(THead (Flat Appl) v0 (THead (Bind Abst) u t5)) H21) in (eq_ind T v0 (\lambda +(_: T).((eq B b Abst) \to ((eq T u1 u) \to ((eq T t3 t5) \to (ex2 T (\lambda +(t8: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) v3 t6) t8))))))) (\lambda (H26: +(eq B b Abst)).(eq_ind B Abst (\lambda (b0: B).((eq T u1 u) \to ((eq T t3 t5) +\to (ex2 T (\lambda (t7: T).(pr0 (THead (Bind b0) u2 (THead (Flat Appl) (lift +(S O) O v2) t4)) t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) v3 t6) +t7)))))) (\lambda (H27: (eq T u1 u)).(eq_ind T u (\lambda (_: T).((eq T t3 +t5) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abst) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) v3 t6) +t8))))) (\lambda (H28: (eq T t3 t5)).(eq_ind T t5 (\lambda (_: T).(ex2 T +(\lambda (t8: T).(pr0 (THead (Bind Abst) u2 (THead (Flat Appl) (lift (S O) O +v2) t4)) t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) v3 t6) t8)))) (let H29 +\def (eq_ind_r T t (\lambda (t7: T).(\forall (v: T).((tlt v t7) \to (\forall +(t8: T).((pr0 v t8) \to (\forall (t9: T).((pr0 v t9) \to (ex2 T (\lambda +(t10: T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 t10)))))))))) H (THead (Flat +Appl) v0 (THead (Bind Abst) u t5)) H15) in (let H30 \def (eq_ind T t3 +(\lambda (t7: T).(pr0 t7 t4)) H12 t5 H28) in (let H31 \def (eq_ind T u1 +(\lambda (t7: T).(pr0 t7 u2)) H11 u H27) in (let H32 \def (eq_ind B b +(\lambda (b0: B).(not (eq B b0 Abst))) H9 Abst H26) in (let H33 \def (match +(H32 (refl_equal B Abst)) in False return (\lambda (_: False).(ex2 T (\lambda +(t7: T).(pr0 (THead (Bind Abst) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) v3 t6) t7)))) with []) in +H33))))) t3 (sym_eq T t3 t5 H28))) u1 (sym_eq T u1 u H27))) b (sym_eq B b +Abst H26))) v1 (sym_eq T v1 v0 H25))) H24)) H23)) H22)))]) in (H21 +(refl_equal T (THead (Flat Appl) v0 (THead (Bind Abst) u t5)))))))) t2 H17)) +t H15 H16 H13 H14))) | (pr0_upsilon b0 H13 v0 v3 H14 u0 u3 H15 t5 t6 H16) +\Rightarrow (\lambda (H17: (eq T (THead (Flat Appl) v0 (THead (Bind b0) u0 +t5)) t)).(\lambda (H18: (eq T (THead (Bind b0) u3 (THead (Flat Appl) (lift (S +O) O v3) t6)) t2)).(eq_ind T (THead (Flat Appl) v0 (THead (Bind b0) u0 t5)) +(\lambda (_: T).((eq T (THead (Bind b0) u3 (THead (Flat Appl) (lift (S O) O +v3) t6)) t2) \to ((not (eq B b0 Abst)) \to ((pr0 v0 v3) \to ((pr0 u0 u3) \to +((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 t2 t8))))))))) +(\lambda (H19: (eq T (THead (Bind b0) u3 (THead (Flat Appl) (lift (S O) O v3) +t6)) t2)).(eq_ind T (THead (Bind b0) u3 (THead (Flat Appl) (lift (S O) O v3) +t6)) (\lambda (t7: T).((not (eq B b0 Abst)) \to ((pr0 v0 v3) \to ((pr0 u0 u3) +\to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 t7 t8)))))))) +(\lambda (_: (not (eq B b0 Abst))).(\lambda (H21: (pr0 v0 v3)).(\lambda (H22: +(pr0 u0 u3)).(\lambda (H23: (pr0 t5 t6)).(let H24 \def (eq_ind_r T t (\lambda +(t7: T).(eq T (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) t7)) H6 (THead +(Flat Appl) v0 (THead (Bind b0) u0 t5)) H17) in (let H25 \def (match H24 in +eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat +Appl) v0 (THead (Bind b0) u0 t5))) \to (ex2 T (\lambda (t8: T).(pr0 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: +T).(pr0 (THead (Bind b0) u3 (THead (Flat Appl) (lift (S O) O v3) t6)) +t8)))))) with [refl_equal \Rightarrow (\lambda (H25: (eq T (THead (Flat Appl) +v1 (THead (Bind b) u1 t3)) (THead (Flat Appl) v0 (THead (Bind b0) u0 +t5)))).(let H26 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 +| (THead _ _ t7) \Rightarrow (match t7 in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t8) +\Rightarrow t8])])) (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) (THead +(Flat Appl) v0 (THead (Bind b0) u0 t5)) H25) in ((let H27 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ _ t7) \Rightarrow (match +t7 in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | (TLRef _) +\Rightarrow u1 | (THead _ t8 _) \Rightarrow t8])])) (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) (THead (Flat Appl) v0 (THead (Bind b0) u0 t5)) H25) +in ((let H28 \def (f_equal T B (\lambda (e: T).(match e in T return (\lambda +(_: T).B) with [(TSort _) \Rightarrow b | (TLRef _) \Rightarrow b | (THead _ +_ t7) \Rightarrow (match t7 in T return (\lambda (_: T).B) with [(TSort _) +\Rightarrow b | (TLRef _) \Rightarrow b | (THead k _ _) \Rightarrow (match k +in K return (\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) +\Rightarrow b])])])) (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) (THead +(Flat Appl) v0 (THead (Bind b0) u0 t5)) H25) in ((let H29 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow v1 | (TLRef _) \Rightarrow v1 | (THead _ t7 _) \Rightarrow t7])) +(THead (Flat Appl) v1 (THead (Bind b) u1 t3)) (THead (Flat Appl) v0 (THead +(Bind b0) u0 t5)) H25) in (eq_ind T v0 (\lambda (_: T).((eq B b b0) \to ((eq +T u1 u0) \to ((eq T t3 t5) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 +(THead (Bind b0) u3 (THead (Flat Appl) (lift (S O) O v3) t6)) t8))))))) +(\lambda (H30: (eq B b b0)).(eq_ind B b0 (\lambda (b1: B).((eq T u1 u0) \to +((eq T t3 t5) \to (ex2 T (\lambda (t7: T).(pr0 (THead (Bind b1) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) t7)) (\lambda (t7: T).(pr0 (THead (Bind +b0) u3 (THead (Flat Appl) (lift (S O) O v3) t6)) t7)))))) (\lambda (H31: (eq +T u1 u0)).(eq_ind T u0 (\lambda (_: T).((eq T t3 t5) \to (ex2 T (\lambda (t8: +T).(pr0 (THead (Bind b0) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) +(\lambda (t8: T).(pr0 (THead (Bind b0) u3 (THead (Flat Appl) (lift (S O) O +v3) t6)) t8))))) (\lambda (H32: (eq T t3 t5)).(eq_ind T t5 (\lambda (_: +T).(ex2 T (\lambda (t8: T).(pr0 (THead (Bind b0) u2 (THead (Flat Appl) (lift +(S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 (THead (Bind b0) u3 (THead (Flat +Appl) (lift (S O) O v3) t6)) t8)))) (let H33 \def (eq_ind_r T t (\lambda (t7: +T).(\forall (v: T).((tlt v t7) \to (\forall (t8: T).((pr0 v t8) \to (\forall +(t9: T).((pr0 v t9) \to (ex2 T (\lambda (t10: T).(pr0 t8 t10)) (\lambda (t10: +T).(pr0 t9 t10)))))))))) H (THead (Flat Appl) v0 (THead (Bind b0) u0 t5)) +H17) in (let H34 \def (eq_ind T t3 (\lambda (t7: T).(pr0 t7 t4)) H12 t5 H32) +in (let H35 \def (eq_ind T u1 (\lambda (t7: T).(pr0 t7 u2)) H11 u0 H31) in +(let H36 \def (eq_ind B b (\lambda (b1: B).(not (eq B b1 Abst))) H9 b0 H30) +in (let H37 \def (eq_ind T v1 (\lambda (t7: T).(pr0 t7 v2)) H10 v0 H29) in +(ex2_ind T (\lambda (t7: T).(pr0 v2 t7)) (\lambda (t7: T).(pr0 v3 t7)) (ex2 T +(\lambda (t7: T).(pr0 (THead (Bind b0) u2 (THead (Flat Appl) (lift (S O) O +v2) t4)) t7)) (\lambda (t7: T).(pr0 (THead (Bind b0) u3 (THead (Flat Appl) +(lift (S O) O v3) t6)) t7))) (\lambda (x: T).(\lambda (H38: (pr0 v2 +x)).(\lambda (H39: (pr0 v3 x)).(ex2_ind T (\lambda (t7: T).(pr0 u2 t7)) +(\lambda (t7: T).(pr0 u3 t7)) (ex2 T (\lambda (t7: T).(pr0 (THead (Bind b0) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t7)) (\lambda (t7: T).(pr0 +(THead (Bind b0) u3 (THead (Flat Appl) (lift (S O) O v3) t6)) t7))) (\lambda +(x0: T).(\lambda (H40: (pr0 u2 x0)).(\lambda (H41: (pr0 u3 x0)).(ex2_ind T +(\lambda (t7: T).(pr0 t4 t7)) (\lambda (t7: T).(pr0 t6 t7)) (ex2 T (\lambda +(t7: T).(pr0 (THead (Bind b0) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +t7)) (\lambda (t7: T).(pr0 (THead (Bind b0) u3 (THead (Flat Appl) (lift (S O) +O v3) t6)) t7))) (\lambda (x1: T).(\lambda (H42: (pr0 t4 x1)).(\lambda (H43: +(pr0 t6 x1)).(pr0_confluence__pr0_upsilon_upsilon b0 H36 v2 v3 x H38 H39 u2 +u3 x0 H40 H41 t4 t6 x1 H42 H43)))) (H33 t5 (tlt_trans (THead (Bind b0) u0 t5) +t5 (THead (Flat Appl) v0 (THead (Bind b0) u0 t5)) (tlt_head_dx (Bind b0) u0 +t5) (tlt_head_dx (Flat Appl) v0 (THead (Bind b0) u0 t5))) t4 H34 t6 H23))))) +(H33 u0 (tlt_trans (THead (Bind b0) u0 t5) u0 (THead (Flat Appl) v0 (THead +(Bind b0) u0 t5)) (tlt_head_sx (Bind b0) u0 t5) (tlt_head_dx (Flat Appl) v0 +(THead (Bind b0) u0 t5))) u2 H35 u3 H22))))) (H33 v0 (tlt_head_sx (Flat Appl) +v0 (THead (Bind b0) u0 t5)) v2 H37 v3 H21))))))) t3 (sym_eq T t3 t5 H32))) u1 +(sym_eq T u1 u0 H31))) b (sym_eq B b b0 H30))) v1 (sym_eq T v1 v0 H29))) +H28)) H27)) H26)))]) in (H25 (refl_equal T (THead (Flat Appl) v0 (THead (Bind +b0) u0 t5)))))))))) t2 H19)) t H17 H18 H13 H14 H15 H16))) | (pr0_delta u0 u3 +H13 t5 t6 H14 w H15) \Rightarrow (\lambda (H16: (eq T (THead (Bind Abbr) u0 +t5) t)).(\lambda (H17: (eq T (THead (Bind Abbr) u3 w) t2)).(eq_ind T (THead +(Bind Abbr) u0 t5) (\lambda (_: T).((eq T (THead (Bind Abbr) u3 w) t2) \to +((pr0 u0 u3) \to ((pr0 t5 t6) \to ((subst0 O u3 t6 w) \to (ex2 T (\lambda +(t8: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +t8)) (\lambda (t8: T).(pr0 t2 t8)))))))) (\lambda (H18: (eq T (THead (Bind +Abbr) u3 w) t2)).(eq_ind T (THead (Bind Abbr) u3 w) (\lambda (t7: T).((pr0 u0 +u3) \to ((pr0 t5 t6) \to ((subst0 O u3 t6 w) \to (ex2 T (\lambda (t8: T).(pr0 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda +(t8: T).(pr0 t7 t8))))))) (\lambda (_: (pr0 u0 u3)).(\lambda (_: (pr0 t5 +t6)).(\lambda (_: (subst0 O u3 t6 w)).(let H22 \def (eq_ind_r T t (\lambda +(t7: T).(eq T (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) t7)) H6 (THead +(Bind Abbr) u0 t5) H16) in (let H23 \def (match H22 in eq return (\lambda +(t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Bind Abbr) u0 t5)) \to +(ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) u3 w) t8)))))) +with [refl_equal \Rightarrow (\lambda (H23: (eq T (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) (THead (Bind Abbr) u0 t5))).(let H24 \def (eq_ind T +(THead (Flat Appl) v1 (THead (Bind b) u1 t3)) (\lambda (e: T).(match e in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind Abbr) u0 t5) H23) in (False_ind (ex2 T (\lambda (t7: +T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t7)) +(\lambda (t7: T).(pr0 (THead (Bind Abbr) u3 w) t7))) H24)))]) in (H23 +(refl_equal T (THead (Bind Abbr) u0 t5)))))))) t2 H18)) t H16 H17 H13 H14 +H15))) | (pr0_zeta b0 H13 t5 t6 H14 u) \Rightarrow (\lambda (H15: (eq T +(THead (Bind b0) u (lift (S O) O t5)) t)).(\lambda (H16: (eq T t6 +t2)).(eq_ind T (THead (Bind b0) u (lift (S O) O t5)) (\lambda (_: T).((eq T +t6 t2) \to ((not (eq B b0 Abst)) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: +T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) +(\lambda (t8: T).(pr0 t2 t8))))))) (\lambda (H17: (eq T t6 t2)).(eq_ind T t2 +(\lambda (t7: T).((not (eq B b0 Abst)) \to ((pr0 t5 t7) \to (ex2 T (\lambda +(t8: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +t8)) (\lambda (t8: T).(pr0 t2 t8)))))) (\lambda (_: (not (eq B b0 +Abst))).(\lambda (_: (pr0 t5 t2)).(let H20 \def (eq_ind_r T t (\lambda (t7: +T).(eq T (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) t7)) H6 (THead (Bind +b0) u (lift (S O) O t5)) H15) in (let H21 \def (match H20 in eq return +(\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Bind b0) u (lift +(S O) O t5))) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 t2 t8)))))) +with [refl_equal \Rightarrow (\lambda (H21: (eq T (THead (Flat Appl) v1 +(THead (Bind b) u1 t3)) (THead (Bind b0) u (lift (S O) O t5)))).(let H22 \def +(eq_ind T (THead (Flat Appl) v1 (THead (Bind b) u1 t3)) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind b0) u (lift (S O) O t5)) H21) in +(False_ind (ex2 T (\lambda (t7: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) t7)) (\lambda (t7: T).(pr0 t2 t7))) H22)))]) in (H21 +(refl_equal T (THead (Bind b0) u (lift (S O) O t5)))))))) t6 (sym_eq T t6 t2 +H17))) t H15 H16 H13 H14))) | (pr0_epsilon t5 t6 H13 u) \Rightarrow (\lambda +(H14: (eq T (THead (Flat Cast) u t5) t)).(\lambda (H15: (eq T t6 t2)).(eq_ind +T (THead (Flat Cast) u t5) (\lambda (_: T).((eq T t6 t2) \to ((pr0 t5 t6) \to +(ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 t2 t8)))))) (\lambda (H16: (eq T t6 +t2)).(eq_ind T t2 (\lambda (t7: T).((pr0 t5 t7) \to (ex2 T (\lambda (t8: +T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t8)) +(\lambda (t8: T).(pr0 t2 t8))))) (\lambda (_: (pr0 t5 t2)).(let H18 \def +(eq_ind_r T t (\lambda (t7: T).(eq T (THead (Flat Appl) v1 (THead (Bind b) u1 +t3)) t7)) H6 (THead (Flat Cast) u t5) H14) in (let H19 \def (match H18 in eq +return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat +Cast) u t5)) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) t8)) (\lambda (t8: T).(pr0 t2 t8)))))) with +[refl_equal \Rightarrow (\lambda (H19: (eq T (THead (Flat Appl) v1 (THead +(Bind b) u1 t3)) (THead (Flat Cast) u t5))).(let H20 \def (eq_ind T (THead +(Flat Appl) v1 (THead (Bind b) u1 t3)) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat f) \Rightarrow (match f +in F return (\lambda (_: F).Prop) with [Appl \Rightarrow True | Cast +\Rightarrow False])])])) I (THead (Flat Cast) u t5) H19) in (False_ind (ex2 T +(\lambda (t7: T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4)) t7)) (\lambda (t7: T).(pr0 t2 t7))) H20)))]) in (H19 (refl_equal T +(THead (Flat Cast) u t5)))))) t6 (sym_eq T t6 t2 H16))) t H14 H15 H13)))]) in +(H13 (refl_equal T t) (refl_equal T t2))))))) t1 H8)) t H6 H7 H2 H3 H4 H5))) +| (pr0_delta u1 u2 H2 t3 t4 H3 w H4) \Rightarrow (\lambda (H5: (eq T (THead +(Bind Abbr) u1 t3) t)).(\lambda (H6: (eq T (THead (Bind Abbr) u2 w) +t1)).(eq_ind T (THead (Bind Abbr) u1 t3) (\lambda (_: T).((eq T (THead (Bind +Abbr) u2 w) t1) \to ((pr0 u1 u2) \to ((pr0 t3 t4) \to ((subst0 O u2 t4 w) \to +(ex2 T (\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 t2 t6)))))))) +(\lambda (H7: (eq T (THead (Bind Abbr) u2 w) t1)).(eq_ind T (THead (Bind +Abbr) u2 w) (\lambda (t5: T).((pr0 u1 u2) \to ((pr0 t3 t4) \to ((subst0 O u2 +t4 w) \to (ex2 T (\lambda (t6: T).(pr0 t5 t6)) (\lambda (t6: T).(pr0 t2 +t6))))))) (\lambda (H8: (pr0 u1 u2)).(\lambda (H9: (pr0 t3 t4)).(\lambda +(H10: (subst0 O u2 t4 w)).(let H11 \def (match H1 in pr0 return (\lambda (t5: +T).(\lambda (t6: T).(\lambda (_: (pr0 t5 t6)).((eq T t5 t) \to ((eq T t6 t2) +\to (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) u2 w) t7)) (\lambda (t7: +T).(pr0 t2 t7)))))))) with [(pr0_refl t5) \Rightarrow (\lambda (H11: (eq T t5 +t)).(\lambda (H12: (eq T t5 t2)).(eq_ind T t (\lambda (t6: T).((eq T t6 t2) +\to (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) u2 w) t7)) (\lambda (t7: +T).(pr0 t2 t7))))) (\lambda (H13: (eq T t t2)).(eq_ind T t2 (\lambda (_: +T).(ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) u2 w) t7)) (\lambda (t7: +T).(pr0 t2 t7)))) (let H14 \def (eq_ind_r T t (\lambda (t6: T).(eq T t6 t2)) +H13 (THead (Bind Abbr) u1 t3) H5) in (eq_ind T (THead (Bind Abbr) u1 t3) +(\lambda (t6: T).(ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) u2 w) t7)) +(\lambda (t7: T).(pr0 t6 t7)))) (let H15 \def (eq_ind_r T t (\lambda (t6: +T).(eq T t5 t6)) H11 (THead (Bind Abbr) u1 t3) H5) in (let H16 \def (eq_ind_r +T t (\lambda (t6: T).(\forall (v: T).((tlt v t6) \to (\forall (t7: T).((pr0 v +t7) \to (\forall (t8: T).((pr0 v t8) \to (ex2 T (\lambda (t9: T).(pr0 t7 t9)) +(\lambda (t9: T).(pr0 t8 t9)))))))))) H (THead (Bind Abbr) u1 t3) H5) in +(ex_intro2 T (\lambda (t6: T).(pr0 (THead (Bind Abbr) u2 w) t6)) (\lambda +(t6: T).(pr0 (THead (Bind Abbr) u1 t3) t6)) (THead (Bind Abbr) u2 w) +(pr0_refl (THead (Bind Abbr) u2 w)) (pr0_delta u1 u2 H8 t3 t4 H9 w H10)))) t2 +H14)) t (sym_eq T t t2 H13))) t5 (sym_eq T t5 t H11) H12))) | (pr0_comp u0 u3 +H11 t5 t6 H12 k) \Rightarrow (\lambda (H13: (eq T (THead k u0 t5) +t)).(\lambda (H14: (eq T (THead k u3 t6) t2)).(eq_ind T (THead k u0 t5) +(\lambda (_: T).((eq T (THead k u3 t6) t2) \to ((pr0 u0 u3) \to ((pr0 t5 t6) +\to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda (t8: +T).(pr0 t2 t8))))))) (\lambda (H15: (eq T (THead k u3 t6) t2)).(eq_ind T +(THead k u3 t6) (\lambda (t7: T).((pr0 u0 u3) \to ((pr0 t5 t6) \to (ex2 T +(\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 t7 +t8)))))) (\lambda (H16: (pr0 u0 u3)).(\lambda (H17: (pr0 t5 t6)).(let H18 +\def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Bind Abbr) u1 t3) t7)) H5 +(THead k u0 t5) H13) in (let H19 \def (match H18 in eq return (\lambda (t7: +T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead k u0 t5)) \to (ex2 T (\lambda +(t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 (THead k u3 +t6) t8)))))) with [refl_equal \Rightarrow (\lambda (H19: (eq T (THead (Bind +Abbr) u1 t3) (THead k u0 t5))).(let H20 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | +(TLRef _) \Rightarrow t3 | (THead _ _ t7) \Rightarrow t7])) (THead (Bind +Abbr) u1 t3) (THead k u0 t5) H19) in ((let H21 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | +(TLRef _) \Rightarrow u1 | (THead _ t7 _) \Rightarrow t7])) (THead (Bind +Abbr) u1 t3) (THead k u0 t5) H19) in ((let H22 \def (f_equal T K (\lambda (e: +T).(match e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow (Bind +Abbr) | (TLRef _) \Rightarrow (Bind Abbr) | (THead k0 _ _) \Rightarrow k0])) +(THead (Bind Abbr) u1 t3) (THead k u0 t5) H19) in (eq_ind K (Bind Abbr) +(\lambda (k0: K).((eq T u1 u0) \to ((eq T t3 t5) \to (ex2 T (\lambda (t7: +T).(pr0 (THead (Bind Abbr) u2 w) t7)) (\lambda (t7: T).(pr0 (THead k0 u3 t6) +t7)))))) (\lambda (H23: (eq T u1 u0)).(eq_ind T u0 (\lambda (_: T).((eq T t3 +t5) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda +(t8: T).(pr0 (THead (Bind Abbr) u3 t6) t8))))) (\lambda (H24: (eq T t3 +t5)).(eq_ind T t5 (\lambda (_: T).(ex2 T (\lambda (t8: T).(pr0 (THead (Bind +Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) u3 t6) t8)))) (let +H25 \def (eq_ind_r K k (\lambda (k0: K).(eq T (THead k0 u0 t5) t)) H13 (Bind +Abbr) H22) in (let H26 \def (eq_ind_r T t (\lambda (t7: T).(\forall (v: +T).((tlt v t7) \to (\forall (t8: T).((pr0 v t8) \to (\forall (t9: T).((pr0 v +t9) \to (ex2 T (\lambda (t10: T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 +t10)))))))))) H (THead (Bind Abbr) u0 t5) H25) in (let H27 \def (eq_ind T t3 +(\lambda (t7: T).(pr0 t7 t4)) H9 t5 H24) in (let H28 \def (eq_ind T u1 +(\lambda (t7: T).(pr0 t7 u2)) H8 u0 H23) in (ex2_ind T (\lambda (t7: T).(pr0 +u2 t7)) (\lambda (t7: T).(pr0 u3 t7)) (ex2 T (\lambda (t7: T).(pr0 (THead +(Bind Abbr) u2 w) t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) u3 t6) t7))) +(\lambda (x: T).(\lambda (H29: (pr0 u2 x)).(\lambda (H30: (pr0 u3 +x)).(ex2_ind T (\lambda (t7: T).(pr0 t4 t7)) (\lambda (t7: T).(pr0 t6 t7)) +(ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) u2 w) t7)) (\lambda (t7: +T).(pr0 (THead (Bind Abbr) u3 t6) t7))) (\lambda (x0: T).(\lambda (H31: (pr0 +t4 x0)).(\lambda (H32: (pr0 t6 x0)).(ex2_sym T (pr0 (THead (Bind Abbr) u3 +t6)) (pr0 (THead (Bind Abbr) u2 w)) (pr0_confluence__pr0_cong_delta u2 t4 w +H10 u3 x H30 H29 t6 x0 H32 H31))))) (H26 t5 (tlt_head_dx (Bind Abbr) u0 t5) +t4 H27 t6 H17))))) (H26 u0 (tlt_head_sx (Bind Abbr) u0 t5) u2 H28 u3 +H16)))))) t3 (sym_eq T t3 t5 H24))) u1 (sym_eq T u1 u0 H23))) k H22)) H21)) +H20)))]) in (H19 (refl_equal T (THead k u0 t5))))))) t2 H15)) t H13 H14 H11 +H12))) | (pr0_beta u v1 v2 H11 t5 t6 H12) \Rightarrow (\lambda (H13: (eq T +(THead (Flat Appl) v1 (THead (Bind Abst) u t5)) t)).(\lambda (H14: (eq T +(THead (Bind Abbr) v2 t6) t2)).(eq_ind T (THead (Flat Appl) v1 (THead (Bind +Abst) u t5)) (\lambda (_: T).((eq T (THead (Bind Abbr) v2 t6) t2) \to ((pr0 +v1 v2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) +u2 w) t8)) (\lambda (t8: T).(pr0 t2 t8))))))) (\lambda (H15: (eq T (THead +(Bind Abbr) v2 t6) t2)).(eq_ind T (THead (Bind Abbr) v2 t6) (\lambda (t7: +T).((pr0 v1 v2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead +(Bind Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 t7 t8)))))) (\lambda (_: (pr0 v1 +v2)).(\lambda (_: (pr0 t5 t6)).(let H18 \def (eq_ind_r T t (\lambda (t7: +T).(eq T (THead (Bind Abbr) u1 t3) t7)) H5 (THead (Flat Appl) v1 (THead (Bind +Abst) u t5)) H13) in (let H19 \def (match H18 in eq return (\lambda (t7: +T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat Appl) v1 (THead (Bind +Abst) u t5))) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) +(\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t6) t8)))))) with [refl_equal +\Rightarrow (\lambda (H19: (eq T (THead (Bind Abbr) u1 t3) (THead (Flat Appl) +v1 (THead (Bind Abst) u t5)))).(let H20 \def (eq_ind T (THead (Bind Abbr) u1 +t3) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat Appl) v1 +(THead (Bind Abst) u t5)) H19) in (False_ind (ex2 T (\lambda (t7: T).(pr0 +(THead (Bind Abbr) u2 w) t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t6) +t7))) H20)))]) in (H19 (refl_equal T (THead (Flat Appl) v1 (THead (Bind Abst) +u t5)))))))) t2 H15)) t H13 H14 H11 H12))) | (pr0_upsilon b H11 v1 v2 H12 u0 +u3 H13 t5 t6 H14) \Rightarrow (\lambda (H15: (eq T (THead (Flat Appl) v1 +(THead (Bind b) u0 t5)) t)).(\lambda (H16: (eq T (THead (Bind b) u3 (THead +(Flat Appl) (lift (S O) O v2) t6)) t2)).(eq_ind T (THead (Flat Appl) v1 +(THead (Bind b) u0 t5)) (\lambda (_: T).((eq T (THead (Bind b) u3 (THead +(Flat Appl) (lift (S O) O v2) t6)) t2) \to ((not (eq B b Abst)) \to ((pr0 v1 +v2) \to ((pr0 u0 u3) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead +(Bind Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 t2 t8))))))))) (\lambda (H17: +(eq T (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) +t2)).(eq_ind T (THead (Bind b) u3 (THead (Flat Appl) (lift (S O) O v2) t6)) +(\lambda (t7: T).((not (eq B b Abst)) \to ((pr0 v1 v2) \to ((pr0 u0 u3) \to +((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) +(\lambda (t8: T).(pr0 t7 t8)))))))) (\lambda (_: (not (eq B b +Abst))).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (pr0 u0 u3)).(\lambda (_: (pr0 +t5 t6)).(let H22 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Bind Abbr) +u1 t3) t7)) H5 (THead (Flat Appl) v1 (THead (Bind b) u0 t5)) H15) in (let H23 +\def (match H22 in eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq +T t7 (THead (Flat Appl) v1 (THead (Bind b) u0 t5))) \to (ex2 T (\lambda (t8: +T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 (THead (Bind b) +u3 (THead (Flat Appl) (lift (S O) O v2) t6)) t8)))))) with [refl_equal +\Rightarrow (\lambda (H23: (eq T (THead (Bind Abbr) u1 t3) (THead (Flat Appl) +v1 (THead (Bind b) u0 t5)))).(let H24 \def (eq_ind T (THead (Bind Abbr) u1 +t3) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat Appl) v1 +(THead (Bind b) u0 t5)) H23) in (False_ind (ex2 T (\lambda (t7: T).(pr0 +(THead (Bind Abbr) u2 w) t7)) (\lambda (t7: T).(pr0 (THead (Bind b) u3 (THead +(Flat Appl) (lift (S O) O v2) t6)) t7))) H24)))]) in (H23 (refl_equal T +(THead (Flat Appl) v1 (THead (Bind b) u0 t5)))))))))) t2 H17)) t H15 H16 H11 +H12 H13 H14))) | (pr0_delta u0 u3 H11 t5 t6 H12 w0 H13) \Rightarrow (\lambda +(H14: (eq T (THead (Bind Abbr) u0 t5) t)).(\lambda (H15: (eq T (THead (Bind +Abbr) u3 w0) t2)).(eq_ind T (THead (Bind Abbr) u0 t5) (\lambda (_: T).((eq T +(THead (Bind Abbr) u3 w0) t2) \to ((pr0 u0 u3) \to ((pr0 t5 t6) \to ((subst0 +O u3 t6 w0) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) +(\lambda (t8: T).(pr0 t2 t8)))))))) (\lambda (H16: (eq T (THead (Bind Abbr) +u3 w0) t2)).(eq_ind T (THead (Bind Abbr) u3 w0) (\lambda (t7: T).((pr0 u0 u3) +\to ((pr0 t5 t6) \to ((subst0 O u3 t6 w0) \to (ex2 T (\lambda (t8: T).(pr0 +(THead (Bind Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 t7 t8))))))) (\lambda +(H17: (pr0 u0 u3)).(\lambda (H18: (pr0 t5 t6)).(\lambda (H19: (subst0 O u3 t6 +w0)).(let H20 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Bind Abbr) u1 +t3) t7)) H5 (THead (Bind Abbr) u0 t5) H14) in (let H21 \def (match H20 in eq +return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Bind +Abbr) u0 t5)) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) +(\lambda (t8: T).(pr0 (THead (Bind Abbr) u3 w0) t8)))))) with [refl_equal +\Rightarrow (\lambda (H21: (eq T (THead (Bind Abbr) u1 t3) (THead (Bind Abbr) +u0 t5))).(let H22 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 +| (THead _ _ t7) \Rightarrow t7])) (THead (Bind Abbr) u1 t3) (THead (Bind +Abbr) u0 t5) H21) in ((let H23 \def (f_equal T T (\lambda (e: T).(match e in +T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u1 | (TLRef _) +\Rightarrow u1 | (THead _ t7 _) \Rightarrow t7])) (THead (Bind Abbr) u1 t3) +(THead (Bind Abbr) u0 t5) H21) in (eq_ind T u0 (\lambda (_: T).((eq T t3 t5) +\to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda (t8: +T).(pr0 (THead (Bind Abbr) u3 w0) t8))))) (\lambda (H24: (eq T t3 +t5)).(eq_ind T t5 (\lambda (_: T).(ex2 T (\lambda (t8: T).(pr0 (THead (Bind +Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) u3 w0) t8)))) (let +H25 \def (eq_ind_r T t (\lambda (t7: T).(\forall (v: T).((tlt v t7) \to +(\forall (t8: T).((pr0 v t8) \to (\forall (t9: T).((pr0 v t9) \to (ex2 T +(\lambda (t10: T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 t10)))))))))) H +(THead (Bind Abbr) u0 t5) H14) in (let H26 \def (eq_ind T t3 (\lambda (t7: +T).(pr0 t7 t4)) H9 t5 H24) in (let H27 \def (eq_ind T u1 (\lambda (t7: +T).(pr0 t7 u2)) H8 u0 H23) in (ex2_ind T (\lambda (t7: T).(pr0 u2 t7)) +(\lambda (t7: T).(pr0 u3 t7)) (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) +u2 w) t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) u3 w0) t7))) (\lambda (x: +T).(\lambda (H28: (pr0 u2 x)).(\lambda (H29: (pr0 u3 x)).(ex2_ind T (\lambda +(t7: T).(pr0 t4 t7)) (\lambda (t7: T).(pr0 t6 t7)) (ex2 T (\lambda (t7: +T).(pr0 (THead (Bind Abbr) u2 w) t7)) (\lambda (t7: T).(pr0 (THead (Bind +Abbr) u3 w0) t7))) (\lambda (x0: T).(\lambda (H30: (pr0 t4 x0)).(\lambda +(H31: (pr0 t6 x0)).(pr0_confluence__pr0_delta_delta u2 t4 w H10 u3 t6 w0 H19 +x H28 H29 x0 H30 H31)))) (H25 t5 (tlt_head_dx (Bind Abbr) u0 t5) t4 H26 t6 +H18))))) (H25 u0 (tlt_head_sx (Bind Abbr) u0 t5) u2 H27 u3 H17))))) t3 +(sym_eq T t3 t5 H24))) u1 (sym_eq T u1 u0 H23))) H22)))]) in (H21 (refl_equal +T (THead (Bind Abbr) u0 t5)))))))) t2 H16)) t H14 H15 H11 H12 H13))) | +(pr0_zeta b H11 t5 t6 H12 u) \Rightarrow (\lambda (H13: (eq T (THead (Bind b) +u (lift (S O) O t5)) t)).(\lambda (H14: (eq T t6 t2)).(eq_ind T (THead (Bind +b) u (lift (S O) O t5)) (\lambda (_: T).((eq T t6 t2) \to ((not (eq B b +Abst)) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) +u2 w) t8)) (\lambda (t8: T).(pr0 t2 t8))))))) (\lambda (H15: (eq T t6 +t2)).(eq_ind T t2 (\lambda (t7: T).((not (eq B b Abst)) \to ((pr0 t5 t7) \to +(ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda (t8: +T).(pr0 t2 t8)))))) (\lambda (H16: (not (eq B b Abst))).(\lambda (H17: (pr0 +t5 t2)).(let H18 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Bind Abbr) +u1 t3) t7)) H5 (THead (Bind b) u (lift (S O) O t5)) H13) in (let H19 \def +(match H18 in eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 +(THead (Bind b) u (lift (S O) O t5))) \to (ex2 T (\lambda (t8: T).(pr0 (THead +(Bind Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 t2 t8)))))) with [refl_equal +\Rightarrow (\lambda (H19: (eq T (THead (Bind Abbr) u1 t3) (THead (Bind b) u +(lift (S O) O t5)))).(let H20 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) +\Rightarrow t3 | (THead _ _ t7) \Rightarrow t7])) (THead (Bind Abbr) u1 t3) +(THead (Bind b) u (lift (S O) O t5)) H19) in ((let H21 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ t7 _) \Rightarrow t7])) +(THead (Bind Abbr) u1 t3) (THead (Bind b) u (lift (S O) O t5)) H19) in ((let +H22 \def (f_equal T B (\lambda (e: T).(match e in T return (\lambda (_: T).B) +with [(TSort _) \Rightarrow Abbr | (TLRef _) \Rightarrow Abbr | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (THead (Bind Abbr) u1 t3) +(THead (Bind b) u (lift (S O) O t5)) H19) in (eq_ind B Abbr (\lambda (_: +B).((eq T u1 u) \to ((eq T t3 (lift (S O) O t5)) \to (ex2 T (\lambda (t7: +T).(pr0 (THead (Bind Abbr) u2 w) t7)) (\lambda (t7: T).(pr0 t2 t7)))))) +(\lambda (H23: (eq T u1 u)).(eq_ind T u (\lambda (_: T).((eq T t3 (lift (S O) +O t5)) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) +(\lambda (t8: T).(pr0 t2 t8))))) (\lambda (H24: (eq T t3 (lift (S O) O +t5))).(eq_ind T (lift (S O) O t5) (\lambda (_: T).(ex2 T (\lambda (t8: +T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 t2 t8)))) (let +H25 \def (eq_ind_r B b (\lambda (b0: B).(not (eq B b0 Abst))) H16 Abbr H22) +in (let H26 \def (eq_ind_r B b (\lambda (b0: B).(eq T (THead (Bind b0) u +(lift (S O) O t5)) t)) H13 Abbr H22) in (let H27 \def (eq_ind_r T t (\lambda +(t7: T).(\forall (v: T).((tlt v t7) \to (\forall (t8: T).((pr0 v t8) \to +(\forall (t9: T).((pr0 v t9) \to (ex2 T (\lambda (t10: T).(pr0 t8 t10)) +(\lambda (t10: T).(pr0 t9 t10)))))))))) H (THead (Bind Abbr) u (lift (S O) O +t5)) H26) in (let H28 \def (eq_ind T t3 (\lambda (t7: T).(pr0 t7 t4)) H9 +(lift (S O) O t5) H24) in (ex2_ind T (\lambda (t7: T).(eq T t4 (lift (S O) O +t7))) (\lambda (t7: T).(pr0 t5 t7)) (ex2 T (\lambda (t7: T).(pr0 (THead (Bind +Abbr) u2 w) t7)) (\lambda (t7: T).(pr0 t2 t7))) (\lambda (x: T).(\lambda +(H29: (eq T t4 (lift (S O) O x))).(\lambda (H30: (pr0 t5 x)).(let H31 \def +(eq_ind T t4 (\lambda (t7: T).(subst0 O u2 t7 w)) H10 (lift (S O) O x) H29) +in (let H32 \def (eq_ind T u1 (\lambda (t7: T).(pr0 t7 u2)) H8 u H23) in +(ex2_ind T (\lambda (t7: T).(pr0 x t7)) (\lambda (t7: T).(pr0 t2 t7)) (ex2 T +(\lambda (t7: T).(pr0 (THead (Bind Abbr) u2 w) t7)) (\lambda (t7: T).(pr0 t2 +t7))) (\lambda (x0: T).(\lambda (_: (pr0 x x0)).(\lambda (_: (pr0 t2 +x0)).(pr0_confluence__pr0_delta_epsilon u2 (lift (S O) O x) w H31 x (pr0_refl +(lift (S O) O x)) t2)))) (H27 t5 (lift_tlt_dx (Bind Abbr) u t5 (S O) O) x H30 +t2 H17))))))) (pr0_gen_lift t5 t4 (S O) O H28)))))) t3 (sym_eq T t3 (lift (S +O) O t5) H24))) u1 (sym_eq T u1 u H23))) b H22)) H21)) H20)))]) in (H19 +(refl_equal T (THead (Bind b) u (lift (S O) O t5)))))))) t6 (sym_eq T t6 t2 +H15))) t H13 H14 H11 H12))) | (pr0_epsilon t5 t6 H11 u) \Rightarrow (\lambda +(H12: (eq T (THead (Flat Cast) u t5) t)).(\lambda (H13: (eq T t6 t2)).(eq_ind +T (THead (Flat Cast) u t5) (\lambda (_: T).((eq T t6 t2) \to ((pr0 t5 t6) \to +(ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda (t8: +T).(pr0 t2 t8)))))) (\lambda (H14: (eq T t6 t2)).(eq_ind T t2 (\lambda (t7: +T).((pr0 t5 t7) \to (ex2 T (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) +t8)) (\lambda (t8: T).(pr0 t2 t8))))) (\lambda (_: (pr0 t5 t2)).(let H16 \def +(eq_ind_r T t (\lambda (t7: T).(eq T (THead (Bind Abbr) u1 t3) t7)) H5 (THead +(Flat Cast) u t5) H12) in (let H17 \def (match H16 in eq return (\lambda (t7: +T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat Cast) u t5)) \to (ex2 T +(\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)) (\lambda (t8: T).(pr0 t2 +t8)))))) with [refl_equal \Rightarrow (\lambda (H17: (eq T (THead (Bind Abbr) +u1 t3) (THead (Flat Cast) u t5))).(let H18 \def (eq_ind T (THead (Bind Abbr) +u1 t3) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat Cast) u t5) +H17) in (False_ind (ex2 T (\lambda (t7: T).(pr0 (THead (Bind Abbr) u2 w) t7)) +(\lambda (t7: T).(pr0 t2 t7))) H18)))]) in (H17 (refl_equal T (THead (Flat +Cast) u t5)))))) t6 (sym_eq T t6 t2 H14))) t H12 H13 H11)))]) in (H11 +(refl_equal T t) (refl_equal T t2)))))) t1 H7)) t H5 H6 H2 H3 H4))) | +(pr0_zeta b H2 t3 t4 H3 u) \Rightarrow (\lambda (H4: (eq T (THead (Bind b) u +(lift (S O) O t3)) t)).(\lambda (H5: (eq T t4 t1)).(eq_ind T (THead (Bind b) +u (lift (S O) O t3)) (\lambda (_: T).((eq T t4 t1) \to ((not (eq B b Abst)) +\to ((pr0 t3 t4) \to (ex2 T (\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: +T).(pr0 t2 t6))))))) (\lambda (H6: (eq T t4 t1)).(eq_ind T t1 (\lambda (t5: +T).((not (eq B b Abst)) \to ((pr0 t3 t5) \to (ex2 T (\lambda (t6: T).(pr0 t1 +t6)) (\lambda (t6: T).(pr0 t2 t6)))))) (\lambda (H7: (not (eq B b +Abst))).(\lambda (H8: (pr0 t3 t1)).(let H9 \def (match H1 in pr0 return +(\lambda (t5: T).(\lambda (t6: T).(\lambda (_: (pr0 t5 t6)).((eq T t5 t) \to +((eq T t6 t2) \to (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 +t2 t7)))))))) with [(pr0_refl t5) \Rightarrow (\lambda (H9: (eq T t5 +t)).(\lambda (H10: (eq T t5 t2)).(eq_ind T t (\lambda (t6: T).((eq T t6 t2) +\to (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7))))) +(\lambda (H11: (eq T t t2)).(eq_ind T t2 (\lambda (_: T).(ex2 T (\lambda (t7: +T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7)))) (let H12 \def (eq_ind_r T t +(\lambda (t6: T).(eq T t6 t2)) H11 (THead (Bind b) u (lift (S O) O t3)) H4) +in (eq_ind T (THead (Bind b) u (lift (S O) O t3)) (\lambda (t6: T).(ex2 T +(\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t6 t7)))) (let H13 \def +(eq_ind_r T t (\lambda (t6: T).(eq T t5 t6)) H9 (THead (Bind b) u (lift (S O) +O t3)) H4) in (let H14 \def (eq_ind_r T t (\lambda (t6: T).(\forall (v: +T).((tlt v t6) \to (\forall (t7: T).((pr0 v t7) \to (\forall (t8: T).((pr0 v +t8) \to (ex2 T (\lambda (t9: T).(pr0 t7 t9)) (\lambda (t9: T).(pr0 t8 +t9)))))))))) H (THead (Bind b) u (lift (S O) O t3)) H4) in (ex_intro2 T +(\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 (THead (Bind b) u (lift +(S O) O t3)) t6)) t1 (pr0_refl t1) (pr0_zeta b H7 t3 t1 H8 u)))) t2 H12)) t +(sym_eq T t t2 H11))) t5 (sym_eq T t5 t H9) H10))) | (pr0_comp u1 u2 H9 t5 t6 +H10 k) \Rightarrow (\lambda (H11: (eq T (THead k u1 t5) t)).(\lambda (H12: +(eq T (THead k u2 t6) t2)).(eq_ind T (THead k u1 t5) (\lambda (_: T).((eq T +(THead k u2 t6) t2) \to ((pr0 u1 u2) \to ((pr0 t5 t6) \to (ex2 T (\lambda +(t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8))))))) (\lambda (H13: (eq T +(THead k u2 t6) t2)).(eq_ind T (THead k u2 t6) (\lambda (t7: T).((pr0 u1 u2) +\to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: +T).(pr0 t7 t8)))))) (\lambda (_: (pr0 u1 u2)).(\lambda (H15: (pr0 t5 +t6)).(let H16 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Bind b) u +(lift (S O) O t3)) t7)) H4 (THead k u1 t5) H11) in (let H17 \def (match H16 +in eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead k u1 +t5)) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 (THead k +u2 t6) t8)))))) with [refl_equal \Rightarrow (\lambda (H17: (eq T (THead +(Bind b) u (lift (S O) O t3)) (THead k u1 t5))).(let H18 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t7: T) on t7: T +\def (match t7 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k0 u0 t8) \Rightarrow (THead k0 (lref_map f d u0) (lref_map f (s k0 +d) t8))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t3) | (TLRef _) +\Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t7: T) on t7: T +\def (match t7 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow +(TLRef (match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) +| (THead k0 u0 t8) \Rightarrow (THead k0 (lref_map f d u0) (lref_map f (s k0 +d) t8))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t3) | (THead _ _ +t7) \Rightarrow t7])) (THead (Bind b) u (lift (S O) O t3)) (THead k u1 t5) +H17) in ((let H19 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | +(THead _ t7 _) \Rightarrow t7])) (THead (Bind b) u (lift (S O) O t3)) (THead +k u1 t5) H17) in ((let H20 \def (f_equal T K (\lambda (e: T).(match e in T +return (\lambda (_: T).K) with [(TSort _) \Rightarrow (Bind b) | (TLRef _) +\Rightarrow (Bind b) | (THead k0 _ _) \Rightarrow k0])) (THead (Bind b) u +(lift (S O) O t3)) (THead k u1 t5) H17) in (eq_ind K (Bind b) (\lambda (k0: +K).((eq T u u1) \to ((eq T (lift (S O) O t3) t5) \to (ex2 T (\lambda (t7: +T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 (THead k0 u2 t6) t7)))))) (\lambda +(H21: (eq T u u1)).(eq_ind T u1 (\lambda (_: T).((eq T (lift (S O) O t3) t5) +\to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 (THead (Bind +b) u2 t6) t8))))) (\lambda (H22: (eq T (lift (S O) O t3) t5)).(eq_ind T (lift +(S O) O t3) (\lambda (_: T).(ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda +(t8: T).(pr0 (THead (Bind b) u2 t6) t8)))) (let H23 \def (eq_ind_r K k +(\lambda (k0: K).(eq T (THead k0 u1 t5) t)) H11 (Bind b) H20) in (let H24 +\def (eq_ind_r T t5 (\lambda (t7: T).(pr0 t7 t6)) H15 (lift (S O) O t3) H22) +in (ex2_ind T (\lambda (t7: T).(eq T t6 (lift (S O) O t7))) (\lambda (t7: +T).(pr0 t3 t7)) (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 +(THead (Bind b) u2 t6) t7))) (\lambda (x: T).(\lambda (H25: (eq T t6 (lift (S +O) O x))).(\lambda (H26: (pr0 t3 x)).(let H27 \def (eq_ind_r T t5 (\lambda +(t7: T).(eq T (THead (Bind b) u1 t7) t)) H23 (lift (S O) O t3) H22) in (let +H28 \def (eq_ind_r T t (\lambda (t7: T).(\forall (v: T).((tlt v t7) \to +(\forall (t8: T).((pr0 v t8) \to (\forall (t9: T).((pr0 v t9) \to (ex2 T +(\lambda (t10: T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 t10)))))))))) H +(THead (Bind b) u1 (lift (S O) O t3)) H27) in (eq_ind_r T (lift (S O) O x) +(\lambda (t7: T).(ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 +(THead (Bind b) u2 t7) t8)))) (ex2_ind T (\lambda (t7: T).(pr0 x t7)) +(\lambda (t7: T).(pr0 t1 t7)) (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda +(t7: T).(pr0 (THead (Bind b) u2 (lift (S O) O x)) t7))) (\lambda (x0: +T).(\lambda (H29: (pr0 x x0)).(\lambda (H30: (pr0 t1 x0)).(ex_intro2 T +(\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 (THead (Bind b) u2 (lift +(S O) O x)) t7)) x0 H30 (pr0_zeta b H7 x x0 H29 u2))))) (H28 t3 (lift_tlt_dx +(Bind b) u1 t3 (S O) O) x H26 t1 H8)) t6 H25)))))) (pr0_gen_lift t3 t6 (S O) +O H24)))) t5 H22)) u (sym_eq T u u1 H21))) k H20)) H19)) H18)))]) in (H17 +(refl_equal T (THead k u1 t5))))))) t2 H13)) t H11 H12 H9 H10))) | (pr0_beta +u0 v1 v2 H9 t5 t6 H10) \Rightarrow (\lambda (H11: (eq T (THead (Flat Appl) v1 +(THead (Bind Abst) u0 t5)) t)).(\lambda (H12: (eq T (THead (Bind Abbr) v2 t6) +t2)).(eq_ind T (THead (Flat Appl) v1 (THead (Bind Abst) u0 t5)) (\lambda (_: +T).((eq T (THead (Bind Abbr) v2 t6) t2) \to ((pr0 v1 v2) \to ((pr0 t5 t6) \to +(ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8))))))) +(\lambda (H13: (eq T (THead (Bind Abbr) v2 t6) t2)).(eq_ind T (THead (Bind +Abbr) v2 t6) (\lambda (t7: T).((pr0 v1 v2) \to ((pr0 t5 t6) \to (ex2 T +(\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t7 t8)))))) (\lambda (_: +(pr0 v1 v2)).(\lambda (_: (pr0 t5 t6)).(let H16 \def (eq_ind_r T t (\lambda +(t7: T).(eq T (THead (Bind b) u (lift (S O) O t3)) t7)) H4 (THead (Flat Appl) +v1 (THead (Bind Abst) u0 t5)) H11) in (let H17 \def (match H16 in eq return +(\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat Appl) v1 +(THead (Bind Abst) u0 t5))) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda +(t8: T).(pr0 (THead (Bind Abbr) v2 t6) t8)))))) with [refl_equal \Rightarrow +(\lambda (H17: (eq T (THead (Bind b) u (lift (S O) O t3)) (THead (Flat Appl) +v1 (THead (Bind Abst) u0 t5)))).(let H18 \def (eq_ind T (THead (Bind b) u +(lift (S O) O t3)) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ +_) \Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat Appl) v1 +(THead (Bind Abst) u0 t5)) H17) in (False_ind (ex2 T (\lambda (t7: T).(pr0 t1 +t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t6) t7))) H18)))]) in (H17 +(refl_equal T (THead (Flat Appl) v1 (THead (Bind Abst) u0 t5)))))))) t2 H13)) +t H11 H12 H9 H10))) | (pr0_upsilon b0 H9 v1 v2 H10 u1 u2 H11 t5 t6 H12) +\Rightarrow (\lambda (H13: (eq T (THead (Flat Appl) v1 (THead (Bind b0) u1 +t5)) t)).(\lambda (H14: (eq T (THead (Bind b0) u2 (THead (Flat Appl) (lift (S +O) O v2) t6)) t2)).(eq_ind T (THead (Flat Appl) v1 (THead (Bind b0) u1 t5)) +(\lambda (_: T).((eq T (THead (Bind b0) u2 (THead (Flat Appl) (lift (S O) O +v2) t6)) t2) \to ((not (eq B b0 Abst)) \to ((pr0 v1 v2) \to ((pr0 u1 u2) \to +((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 +t2 t8))))))))) (\lambda (H15: (eq T (THead (Bind b0) u2 (THead (Flat Appl) +(lift (S O) O v2) t6)) t2)).(eq_ind T (THead (Bind b0) u2 (THead (Flat Appl) +(lift (S O) O v2) t6)) (\lambda (t7: T).((not (eq B b0 Abst)) \to ((pr0 v1 +v2) \to ((pr0 u1 u2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 t1 +t8)) (\lambda (t8: T).(pr0 t7 t8)))))))) (\lambda (_: (not (eq B b0 +Abst))).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (pr0 u1 u2)).(\lambda (_: (pr0 +t5 t6)).(let H20 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Bind b) u +(lift (S O) O t3)) t7)) H4 (THead (Flat Appl) v1 (THead (Bind b0) u1 t5)) +H13) in (let H21 \def (match H20 in eq return (\lambda (t7: T).(\lambda (_: +(eq ? ? t7)).((eq T t7 (THead (Flat Appl) v1 (THead (Bind b0) u1 t5))) \to +(ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 (THead (Bind b0) +u2 (THead (Flat Appl) (lift (S O) O v2) t6)) t8)))))) with [refl_equal +\Rightarrow (\lambda (H21: (eq T (THead (Bind b) u (lift (S O) O t3)) (THead +(Flat Appl) v1 (THead (Bind b0) u1 t5)))).(let H22 \def (eq_ind T (THead +(Bind b) u (lift (S O) O t3)) (\lambda (e: T).(match e in T return (\lambda +(_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False +| (THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat +Appl) v1 (THead (Bind b0) u1 t5)) H21) in (False_ind (ex2 T (\lambda (t7: +T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 (THead (Bind b0) u2 (THead (Flat Appl) +(lift (S O) O v2) t6)) t7))) H22)))]) in (H21 (refl_equal T (THead (Flat +Appl) v1 (THead (Bind b0) u1 t5)))))))))) t2 H15)) t H13 H14 H9 H10 H11 +H12))) | (pr0_delta u1 u2 H9 t5 t6 H10 w H11) \Rightarrow (\lambda (H12: (eq +T (THead (Bind Abbr) u1 t5) t)).(\lambda (H13: (eq T (THead (Bind Abbr) u2 w) +t2)).(eq_ind T (THead (Bind Abbr) u1 t5) (\lambda (_: T).((eq T (THead (Bind +Abbr) u2 w) t2) \to ((pr0 u1 u2) \to ((pr0 t5 t6) \to ((subst0 O u2 t6 w) \to +(ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8)))))))) +(\lambda (H14: (eq T (THead (Bind Abbr) u2 w) t2)).(eq_ind T (THead (Bind +Abbr) u2 w) (\lambda (t7: T).((pr0 u1 u2) \to ((pr0 t5 t6) \to ((subst0 O u2 +t6 w) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t7 +t8))))))) (\lambda (_: (pr0 u1 u2)).(\lambda (H16: (pr0 t5 t6)).(\lambda +(H17: (subst0 O u2 t6 w)).(let H18 \def (eq_ind_r T t (\lambda (t7: T).(eq T +(THead (Bind b) u (lift (S O) O t3)) t7)) H4 (THead (Bind Abbr) u1 t5) H12) +in (let H19 \def (match H18 in eq return (\lambda (t7: T).(\lambda (_: (eq ? +? t7)).((eq T t7 (THead (Bind Abbr) u1 t5)) \to (ex2 T (\lambda (t8: T).(pr0 +t1 t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)))))) with +[refl_equal \Rightarrow (\lambda (H19: (eq T (THead (Bind b) u (lift (S O) O +t3)) (THead (Bind Abbr) u1 t5))).(let H20 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow ((let +rec lref_map (f: ((nat \to nat))) (d: nat) (t7: T) on t7: T \def (match t7 +with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match +(blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u0 +t8) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) t8))]) in +lref_map) (\lambda (x: nat).(plus x (S O))) O t3) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t7: T) on t7: T \def (match +t7 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k u0 t8) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t8))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t3) | (THead _ _ t7) +\Rightarrow t7])) (THead (Bind b) u (lift (S O) O t3)) (THead (Bind Abbr) u1 +t5) H19) in ((let H21 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | +(THead _ t7 _) \Rightarrow t7])) (THead (Bind b) u (lift (S O) O t3)) (THead +(Bind Abbr) u1 t5) H19) in ((let H22 \def (f_equal T B (\lambda (e: T).(match +e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b | (TLRef _) +\Rightarrow b | (THead k _ _) \Rightarrow (match k in K return (\lambda (_: +K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow b])])) (THead +(Bind b) u (lift (S O) O t3)) (THead (Bind Abbr) u1 t5) H19) in (eq_ind B +Abbr (\lambda (_: B).((eq T u u1) \to ((eq T (lift (S O) O t3) t5) \to (ex2 T +(\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) u2 w) +t7)))))) (\lambda (H23: (eq T u u1)).(eq_ind T u1 (\lambda (_: T).((eq T +(lift (S O) O t3) t5) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: +T).(pr0 (THead (Bind Abbr) u2 w) t8))))) (\lambda (H24: (eq T (lift (S O) O +t3) t5)).(eq_ind T (lift (S O) O t3) (\lambda (_: T).(ex2 T (\lambda (t8: +T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)))) (let +H25 \def (eq_ind_r T t5 (\lambda (t7: T).(pr0 t7 t6)) H16 (lift (S O) O t3) +H24) in (ex2_ind T (\lambda (t7: T).(eq T t6 (lift (S O) O t7))) (\lambda +(t7: T).(pr0 t3 t7)) (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: +T).(pr0 (THead (Bind Abbr) u2 w) t7))) (\lambda (x: T).(\lambda (H26: (eq T +t6 (lift (S O) O x))).(\lambda (H27: (pr0 t3 x)).(let H28 \def (eq_ind_r T t5 +(\lambda (t7: T).(eq T (THead (Bind Abbr) u1 t7) t)) H12 (lift (S O) O t3) +H24) in (let H29 \def (eq_ind_r T t (\lambda (t7: T).(\forall (v: T).((tlt v +t7) \to (\forall (t8: T).((pr0 v t8) \to (\forall (t9: T).((pr0 v t9) \to +(ex2 T (\lambda (t10: T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 +t10)))))))))) H (THead (Bind Abbr) u1 (lift (S O) O t3)) H28) in (let H30 +\def (eq_ind T t6 (\lambda (t7: T).(subst0 O u2 t7 w)) H17 (lift (S O) O x) +H26) in (let H31 \def (eq_ind B b (\lambda (b0: B).(not (eq B b0 Abst))) H7 +Abbr H22) in (ex2_ind T (\lambda (t7: T).(pr0 x t7)) (\lambda (t7: T).(pr0 t1 +t7)) (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 (THead (Bind +Abbr) u2 w) t7))) (\lambda (x0: T).(\lambda (_: (pr0 x x0)).(\lambda (_: (pr0 +t1 x0)).(ex2_sym T (pr0 (THead (Bind Abbr) u2 w)) (pr0 t1) +(pr0_confluence__pr0_delta_epsilon u2 (lift (S O) O x) w H30 x (pr0_refl +(lift (S O) O x)) t1))))) (H29 t3 (lift_tlt_dx (Bind Abbr) u1 t3 (S O) O) x +H27 t1 H8))))))))) (pr0_gen_lift t3 t6 (S O) O H25))) t5 H24)) u (sym_eq T u +u1 H23))) b (sym_eq B b Abbr H22))) H21)) H20)))]) in (H19 (refl_equal T +(THead (Bind Abbr) u1 t5)))))))) t2 H14)) t H12 H13 H9 H10 H11))) | (pr0_zeta +b0 H9 t5 t6 H10 u0) \Rightarrow (\lambda (H11: (eq T (THead (Bind b0) u0 +(lift (S O) O t5)) t)).(\lambda (H12: (eq T t6 t2)).(eq_ind T (THead (Bind +b0) u0 (lift (S O) O t5)) (\lambda (_: T).((eq T t6 t2) \to ((not (eq B b0 +Abst)) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda +(t8: T).(pr0 t2 t8))))))) (\lambda (H13: (eq T t6 t2)).(eq_ind T t2 (\lambda +(t7: T).((not (eq B b0 Abst)) \to ((pr0 t5 t7) \to (ex2 T (\lambda (t8: +T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8)))))) (\lambda (_: (not (eq B b0 +Abst))).(\lambda (H15: (pr0 t5 t2)).(let H16 \def (eq_ind_r T t (\lambda (t7: +T).(eq T (THead (Bind b) u (lift (S O) O t3)) t7)) H4 (THead (Bind b0) u0 +(lift (S O) O t5)) H11) in (let H17 \def (match H16 in eq return (\lambda +(t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Bind b0) u0 (lift (S O) O +t5))) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 +t8)))))) with [refl_equal \Rightarrow (\lambda (H17: (eq T (THead (Bind b) u +(lift (S O) O t3)) (THead (Bind b0) u0 (lift (S O) O t5)))).(let H18 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) (t7: +T) on t7: T \def (match t7 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) +\Rightarrow (TLRef (match (blt i d) with [true \Rightarrow i | false +\Rightarrow (f i)])) | (THead k u1 t8) \Rightarrow (THead k (lref_map f d u1) +(lref_map f (s k d) t8))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O +t3) | (TLRef _) \Rightarrow ((let rec lref_map (f: ((nat \to nat))) (d: nat) +(t7: T) on t7: T \def (match t7 with [(TSort n) \Rightarrow (TSort n) | +(TLRef i) \Rightarrow (TLRef (match (blt i d) with [true \Rightarrow i | +false \Rightarrow (f i)])) | (THead k u1 t8) \Rightarrow (THead k (lref_map f +d u1) (lref_map f (s k d) t8))]) in lref_map) (\lambda (x: nat).(plus x (S +O))) O t3) | (THead _ _ t7) \Rightarrow t7])) (THead (Bind b) u (lift (S O) O +t3)) (THead (Bind b0) u0 (lift (S O) O t5)) H17) in ((let H19 \def (f_equal T +T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u | (TLRef _) \Rightarrow u | (THead _ t7 _) \Rightarrow t7])) +(THead (Bind b) u (lift (S O) O t3)) (THead (Bind b0) u0 (lift (S O) O t5)) +H17) in ((let H20 \def (f_equal T B (\lambda (e: T).(match e in T return +(\lambda (_: T).B) with [(TSort _) \Rightarrow b | (TLRef _) \Rightarrow b | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind +b1) \Rightarrow b1 | (Flat _) \Rightarrow b])])) (THead (Bind b) u (lift (S +O) O t3)) (THead (Bind b0) u0 (lift (S O) O t5)) H17) in (eq_ind B b0 +(\lambda (_: B).((eq T u u0) \to ((eq T (lift (S O) O t3) (lift (S O) O t5)) +\to (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7)))))) +(\lambda (H21: (eq T u u0)).(eq_ind T u0 (\lambda (_: T).((eq T (lift (S O) O +t3) (lift (S O) O t5)) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: +T).(pr0 t2 t8))))) (\lambda (H22: (eq T (lift (S O) O t3) (lift (S O) O +t5))).(eq_ind T (lift (S O) O t3) (\lambda (_: T).(ex2 T (\lambda (t8: +T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8)))) (let H23 \def (eq_ind_r T t +(\lambda (t7: T).(\forall (v: T).((tlt v t7) \to (\forall (t8: T).((pr0 v t8) +\to (\forall (t9: T).((pr0 v t9) \to (ex2 T (\lambda (t10: T).(pr0 t8 t10)) +(\lambda (t10: T).(pr0 t9 t10)))))))))) H (THead (Bind b0) u0 (lift (S O) O +t5)) H11) in (let H24 \def (eq_ind T t3 (\lambda (t7: T).(pr0 t7 t1)) H8 t5 +(lift_inj t3 t5 (S O) O H22)) in (let H25 \def (eq_ind B b (\lambda (b1: +B).(not (eq B b1 Abst))) H7 b0 H20) in (ex2_ind T (\lambda (t7: T).(pr0 t1 +t7)) (\lambda (t7: T).(pr0 t2 t7)) (ex2 T (\lambda (t7: T).(pr0 t1 t7)) +(\lambda (t7: T).(pr0 t2 t7))) (\lambda (x: T).(\lambda (H26: (pr0 t1 +x)).(\lambda (H27: (pr0 t2 x)).(ex_intro2 T (\lambda (t7: T).(pr0 t1 t7)) +(\lambda (t7: T).(pr0 t2 t7)) x H26 H27)))) (H23 t5 (lift_tlt_dx (Bind b0) u0 +t5 (S O) O) t1 H24 t2 H15))))) (lift (S O) O t5) H22)) u (sym_eq T u u0 +H21))) b (sym_eq B b b0 H20))) H19)) H18)))]) in (H17 (refl_equal T (THead +(Bind b0) u0 (lift (S O) O t5)))))))) t6 (sym_eq T t6 t2 H13))) t H11 H12 H9 +H10))) | (pr0_epsilon t5 t6 H9 u0) \Rightarrow (\lambda (H10: (eq T (THead +(Flat Cast) u0 t5) t)).(\lambda (H11: (eq T t6 t2)).(eq_ind T (THead (Flat +Cast) u0 t5) (\lambda (_: T).((eq T t6 t2) \to ((pr0 t5 t6) \to (ex2 T +(\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8)))))) (\lambda +(H12: (eq T t6 t2)).(eq_ind T t2 (\lambda (t7: T).((pr0 t5 t7) \to (ex2 T +(\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8))))) (\lambda (_: +(pr0 t5 t2)).(let H14 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Bind +b) u (lift (S O) O t3)) t7)) H4 (THead (Flat Cast) u0 t5) H10) in (let H15 +\def (match H14 in eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq +T t7 (THead (Flat Cast) u0 t5)) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) +(\lambda (t8: T).(pr0 t2 t8)))))) with [refl_equal \Rightarrow (\lambda (H15: +(eq T (THead (Bind b) u (lift (S O) O t3)) (THead (Flat Cast) u0 t5))).(let +H16 \def (eq_ind T (THead (Bind b) u (lift (S O) O t3)) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | (Flat _) +\Rightarrow False])])) I (THead (Flat Cast) u0 t5) H15) in (False_ind (ex2 T +(\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7))) H16)))]) in (H15 +(refl_equal T (THead (Flat Cast) u0 t5)))))) t6 (sym_eq T t6 t2 H12))) t H10 +H11 H9)))]) in (H9 (refl_equal T t) (refl_equal T t2))))) t4 (sym_eq T t4 t1 +H6))) t H4 H5 H2 H3))) | (pr0_epsilon t3 t4 H2 u) \Rightarrow (\lambda (H3: +(eq T (THead (Flat Cast) u t3) t)).(\lambda (H4: (eq T t4 t1)).(eq_ind T +(THead (Flat Cast) u t3) (\lambda (_: T).((eq T t4 t1) \to ((pr0 t3 t4) \to +(ex2 T (\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 t2 t6)))))) +(\lambda (H5: (eq T t4 t1)).(eq_ind T t1 (\lambda (t5: T).((pr0 t3 t5) \to +(ex2 T (\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 t2 t6))))) +(\lambda (H6: (pr0 t3 t1)).(let H7 \def (match H1 in pr0 return (\lambda (t5: +T).(\lambda (t6: T).(\lambda (_: (pr0 t5 t6)).((eq T t5 t) \to ((eq T t6 t2) +\to (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7)))))))) +with [(pr0_refl t5) \Rightarrow (\lambda (H7: (eq T t5 t)).(\lambda (H8: (eq +T t5 t2)).(eq_ind T t (\lambda (t6: T).((eq T t6 t2) \to (ex2 T (\lambda (t7: +T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7))))) (\lambda (H9: (eq T t +t2)).(eq_ind T t2 (\lambda (_: T).(ex2 T (\lambda (t7: T).(pr0 t1 t7)) +(\lambda (t7: T).(pr0 t2 t7)))) (let H10 \def (eq_ind_r T t (\lambda (t6: +T).(eq T t6 t2)) H9 (THead (Flat Cast) u t3) H3) in (eq_ind T (THead (Flat +Cast) u t3) (\lambda (t6: T).(ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda +(t7: T).(pr0 t6 t7)))) (let H11 \def (eq_ind_r T t (\lambda (t6: T).(eq T t5 +t6)) H7 (THead (Flat Cast) u t3) H3) in (let H12 \def (eq_ind_r T t (\lambda +(t6: T).(\forall (v: T).((tlt v t6) \to (\forall (t7: T).((pr0 v t7) \to +(\forall (t8: T).((pr0 v t8) \to (ex2 T (\lambda (t9: T).(pr0 t7 t9)) +(\lambda (t9: T).(pr0 t8 t9)))))))))) H (THead (Flat Cast) u t3) H3) in +(ex_intro2 T (\lambda (t6: T).(pr0 t1 t6)) (\lambda (t6: T).(pr0 (THead (Flat +Cast) u t3) t6)) t1 (pr0_refl t1) (pr0_epsilon t3 t1 H6 u)))) t2 H10)) t +(sym_eq T t t2 H9))) t5 (sym_eq T t5 t H7) H8))) | (pr0_comp u1 u2 H7 t5 t6 +H8 k) \Rightarrow (\lambda (H9: (eq T (THead k u1 t5) t)).(\lambda (H10: (eq +T (THead k u2 t6) t2)).(eq_ind T (THead k u1 t5) (\lambda (_: T).((eq T +(THead k u2 t6) t2) \to ((pr0 u1 u2) \to ((pr0 t5 t6) \to (ex2 T (\lambda +(t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8))))))) (\lambda (H11: (eq T +(THead k u2 t6) t2)).(eq_ind T (THead k u2 t6) (\lambda (t7: T).((pr0 u1 u2) +\to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: +T).(pr0 t7 t8)))))) (\lambda (_: (pr0 u1 u2)).(\lambda (H13: (pr0 t5 +t6)).(let H14 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Flat Cast) u +t3) t7)) H3 (THead k u1 t5) H9) in (let H15 \def (match H14 in eq return +(\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead k u1 t5)) \to +(ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 (THead k u2 t6) +t8)))))) with [refl_equal \Rightarrow (\lambda (H15: (eq T (THead (Flat Cast) +u t3) (THead k u1 t5))).(let H16 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) +\Rightarrow t3 | (THead _ _ t7) \Rightarrow t7])) (THead (Flat Cast) u t3) +(THead k u1 t5) H15) in ((let H17 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u | (TLRef _) +\Rightarrow u | (THead _ t7 _) \Rightarrow t7])) (THead (Flat Cast) u t3) +(THead k u1 t5) H15) in ((let H18 \def (f_equal T K (\lambda (e: T).(match e +in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow (Flat Cast) | +(TLRef _) \Rightarrow (Flat Cast) | (THead k0 _ _) \Rightarrow k0])) (THead +(Flat Cast) u t3) (THead k u1 t5) H15) in (eq_ind K (Flat Cast) (\lambda (k0: +K).((eq T u u1) \to ((eq T t3 t5) \to (ex2 T (\lambda (t7: T).(pr0 t1 t7)) +(\lambda (t7: T).(pr0 (THead k0 u2 t6) t7)))))) (\lambda (H19: (eq T u +u1)).(eq_ind T u1 (\lambda (_: T).((eq T t3 t5) \to (ex2 T (\lambda (t8: +T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 (THead (Flat Cast) u2 t6) t8))))) +(\lambda (H20: (eq T t3 t5)).(eq_ind T t5 (\lambda (_: T).(ex2 T (\lambda +(t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 (THead (Flat Cast) u2 t6) t8)))) +(let H21 \def (eq_ind_r K k (\lambda (k0: K).(eq T (THead k0 u1 t5) t)) H9 +(Flat Cast) H18) in (let H22 \def (eq_ind_r T t (\lambda (t7: T).(\forall (v: +T).((tlt v t7) \to (\forall (t8: T).((pr0 v t8) \to (\forall (t9: T).((pr0 v +t9) \to (ex2 T (\lambda (t10: T).(pr0 t8 t10)) (\lambda (t10: T).(pr0 t9 +t10)))))))))) H (THead (Flat Cast) u1 t5) H21) in (let H23 \def (eq_ind T t3 +(\lambda (t7: T).(pr0 t7 t1)) H6 t5 H20) in (ex2_ind T (\lambda (t7: T).(pr0 +t1 t7)) (\lambda (t7: T).(pr0 t6 t7)) (ex2 T (\lambda (t7: T).(pr0 t1 t7)) +(\lambda (t7: T).(pr0 (THead (Flat Cast) u2 t6) t7))) (\lambda (x: +T).(\lambda (H24: (pr0 t1 x)).(\lambda (H25: (pr0 t6 x)).(ex_intro2 T +(\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 (THead (Flat Cast) u2 t6) +t7)) x H24 (pr0_epsilon t6 x H25 u2))))) (H22 t5 (tlt_head_dx (Flat Cast) u1 +t5) t1 H23 t6 H13))))) t3 (sym_eq T t3 t5 H20))) u (sym_eq T u u1 H19))) k +H18)) H17)) H16)))]) in (H15 (refl_equal T (THead k u1 t5))))))) t2 H11)) t +H9 H10 H7 H8))) | (pr0_beta u0 v1 v2 H7 t5 t6 H8) \Rightarrow (\lambda (H9: +(eq T (THead (Flat Appl) v1 (THead (Bind Abst) u0 t5)) t)).(\lambda (H10: (eq +T (THead (Bind Abbr) v2 t6) t2)).(eq_ind T (THead (Flat Appl) v1 (THead (Bind +Abst) u0 t5)) (\lambda (_: T).((eq T (THead (Bind Abbr) v2 t6) t2) \to ((pr0 +v1 v2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda +(t8: T).(pr0 t2 t8))))))) (\lambda (H11: (eq T (THead (Bind Abbr) v2 t6) +t2)).(eq_ind T (THead (Bind Abbr) v2 t6) (\lambda (t7: T).((pr0 v1 v2) \to +((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 +t7 t8)))))) (\lambda (_: (pr0 v1 v2)).(\lambda (_: (pr0 t5 t6)).(let H14 \def +(eq_ind_r T t (\lambda (t7: T).(eq T (THead (Flat Cast) u t3) t7)) H3 (THead +(Flat Appl) v1 (THead (Bind Abst) u0 t5)) H9) in (let H15 \def (match H14 in +eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Flat +Appl) v1 (THead (Bind Abst) u0 t5))) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) +(\lambda (t8: T).(pr0 (THead (Bind Abbr) v2 t6) t8)))))) with [refl_equal +\Rightarrow (\lambda (H15: (eq T (THead (Flat Cast) u t3) (THead (Flat Appl) +v1 (THead (Bind Abst) u0 t5)))).(let H16 \def (eq_ind T (THead (Flat Cast) u +t3) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat f) \Rightarrow (match f in F return (\lambda (_: +F).Prop) with [Appl \Rightarrow False | Cast \Rightarrow True])])])) I (THead +(Flat Appl) v1 (THead (Bind Abst) u0 t5)) H15) in (False_ind (ex2 T (\lambda +(t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) v2 t6) t7))) +H16)))]) in (H15 (refl_equal T (THead (Flat Appl) v1 (THead (Bind Abst) u0 +t5)))))))) t2 H11)) t H9 H10 H7 H8))) | (pr0_upsilon b H7 v1 v2 H8 u1 u2 H9 +t5 t6 H10) \Rightarrow (\lambda (H11: (eq T (THead (Flat Appl) v1 (THead +(Bind b) u1 t5)) t)).(\lambda (H12: (eq T (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t6)) t2)).(eq_ind T (THead (Flat Appl) v1 (THead +(Bind b) u1 t5)) (\lambda (_: T).((eq T (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t6)) t2) \to ((not (eq B b Abst)) \to ((pr0 v1 v2) \to +((pr0 u1 u2) \to ((pr0 t5 t6) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) +(\lambda (t8: T).(pr0 t2 t8))))))))) (\lambda (H13: (eq T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t6)) t2)).(eq_ind T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t6)) (\lambda (t7: T).((not (eq B b +Abst)) \to ((pr0 v1 v2) \to ((pr0 u1 u2) \to ((pr0 t5 t6) \to (ex2 T (\lambda +(t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t7 t8)))))))) (\lambda (_: (not +(eq B b Abst))).(\lambda (_: (pr0 v1 v2)).(\lambda (_: (pr0 u1 u2)).(\lambda +(_: (pr0 t5 t6)).(let H18 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead +(Flat Cast) u t3) t7)) H3 (THead (Flat Appl) v1 (THead (Bind b) u1 t5)) H11) +in (let H19 \def (match H18 in eq return (\lambda (t7: T).(\lambda (_: (eq ? +? t7)).((eq T t7 (THead (Flat Appl) v1 (THead (Bind b) u1 t5))) \to (ex2 T +(\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t6)) t8)))))) with [refl_equal \Rightarrow +(\lambda (H19: (eq T (THead (Flat Cast) u t3) (THead (Flat Appl) v1 (THead +(Bind b) u1 t5)))).(let H20 \def (eq_ind T (THead (Flat Cast) u t3) (\lambda +(e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat f) +\Rightarrow (match f in F return (\lambda (_: F).Prop) with [Appl \Rightarrow +False | Cast \Rightarrow True])])])) I (THead (Flat Appl) v1 (THead (Bind b) +u1 t5)) H19) in (False_ind (ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: +T).(pr0 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t6)) t7))) +H20)))]) in (H19 (refl_equal T (THead (Flat Appl) v1 (THead (Bind b) u1 +t5)))))))))) t2 H13)) t H11 H12 H7 H8 H9 H10))) | (pr0_delta u1 u2 H7 t5 t6 +H8 w H9) \Rightarrow (\lambda (H10: (eq T (THead (Bind Abbr) u1 t5) +t)).(\lambda (H11: (eq T (THead (Bind Abbr) u2 w) t2)).(eq_ind T (THead (Bind +Abbr) u1 t5) (\lambda (_: T).((eq T (THead (Bind Abbr) u2 w) t2) \to ((pr0 u1 +u2) \to ((pr0 t5 t6) \to ((subst0 O u2 t6 w) \to (ex2 T (\lambda (t8: T).(pr0 +t1 t8)) (\lambda (t8: T).(pr0 t2 t8)))))))) (\lambda (H12: (eq T (THead (Bind +Abbr) u2 w) t2)).(eq_ind T (THead (Bind Abbr) u2 w) (\lambda (t7: T).((pr0 u1 +u2) \to ((pr0 t5 t6) \to ((subst0 O u2 t6 w) \to (ex2 T (\lambda (t8: T).(pr0 +t1 t8)) (\lambda (t8: T).(pr0 t7 t8))))))) (\lambda (_: (pr0 u1 u2)).(\lambda +(_: (pr0 t5 t6)).(\lambda (_: (subst0 O u2 t6 w)).(let H16 \def (eq_ind_r T t +(\lambda (t7: T).(eq T (THead (Flat Cast) u t3) t7)) H3 (THead (Bind Abbr) u1 +t5) H10) in (let H17 \def (match H16 in eq return (\lambda (t7: T).(\lambda +(_: (eq ? ? t7)).((eq T t7 (THead (Bind Abbr) u1 t5)) \to (ex2 T (\lambda +(t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 (THead (Bind Abbr) u2 w) t8)))))) +with [refl_equal \Rightarrow (\lambda (H17: (eq T (THead (Flat Cast) u t3) +(THead (Bind Abbr) u1 t5))).(let H18 \def (eq_ind T (THead (Flat Cast) u t3) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | +(Flat _) \Rightarrow True])])) I (THead (Bind Abbr) u1 t5) H17) in (False_ind +(ex2 T (\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 (THead (Bind Abbr) +u2 w) t7))) H18)))]) in (H17 (refl_equal T (THead (Bind Abbr) u1 t5)))))))) +t2 H12)) t H10 H11 H7 H8 H9))) | (pr0_zeta b H7 t5 t6 H8 u0) \Rightarrow +(\lambda (H9: (eq T (THead (Bind b) u0 (lift (S O) O t5)) t)).(\lambda (H10: +(eq T t6 t2)).(eq_ind T (THead (Bind b) u0 (lift (S O) O t5)) (\lambda (_: +T).((eq T t6 t2) \to ((not (eq B b Abst)) \to ((pr0 t5 t6) \to (ex2 T +(\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8))))))) (\lambda +(H11: (eq T t6 t2)).(eq_ind T t2 (\lambda (t7: T).((not (eq B b Abst)) \to +((pr0 t5 t7) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 +t2 t8)))))) (\lambda (_: (not (eq B b Abst))).(\lambda (_: (pr0 t5 t2)).(let +H14 \def (eq_ind_r T t (\lambda (t7: T).(eq T (THead (Flat Cast) u t3) t7)) +H3 (THead (Bind b) u0 (lift (S O) O t5)) H9) in (let H15 \def (match H14 in +eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq T t7 (THead (Bind +b) u0 (lift (S O) O t5))) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda +(t8: T).(pr0 t2 t8)))))) with [refl_equal \Rightarrow (\lambda (H15: (eq T +(THead (Flat Cast) u t3) (THead (Bind b) u0 (lift (S O) O t5)))).(let H16 +\def (eq_ind T (THead (Flat Cast) u t3) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind b) u0 (lift (S O) O t5)) H15) in (False_ind (ex2 T +(\lambda (t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7))) H16)))]) in (H15 +(refl_equal T (THead (Bind b) u0 (lift (S O) O t5)))))))) t6 (sym_eq T t6 t2 +H11))) t H9 H10 H7 H8))) | (pr0_epsilon t5 t6 H7 u0) \Rightarrow (\lambda +(H8: (eq T (THead (Flat Cast) u0 t5) t)).(\lambda (H9: (eq T t6 t2)).(eq_ind +T (THead (Flat Cast) u0 t5) (\lambda (_: T).((eq T t6 t2) \to ((pr0 t5 t6) +\to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8)))))) +(\lambda (H10: (eq T t6 t2)).(eq_ind T t2 (\lambda (t7: T).((pr0 t5 t7) \to +(ex2 T (\lambda (t8: T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8))))) +(\lambda (H11: (pr0 t5 t2)).(let H12 \def (eq_ind_r T t (\lambda (t7: T).(eq +T (THead (Flat Cast) u t3) t7)) H3 (THead (Flat Cast) u0 t5) H8) in (let H13 +\def (match H12 in eq return (\lambda (t7: T).(\lambda (_: (eq ? ? t7)).((eq +T t7 (THead (Flat Cast) u0 t5)) \to (ex2 T (\lambda (t8: T).(pr0 t1 t8)) +(\lambda (t8: T).(pr0 t2 t8)))))) with [refl_equal \Rightarrow (\lambda (H13: +(eq T (THead (Flat Cast) u t3) (THead (Flat Cast) u0 t5))).(let H14 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t7) +\Rightarrow t7])) (THead (Flat Cast) u t3) (THead (Flat Cast) u0 t5) H13) in +((let H15 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | (THead _ t7 +_) \Rightarrow t7])) (THead (Flat Cast) u t3) (THead (Flat Cast) u0 t5) H13) +in (eq_ind T u0 (\lambda (_: T).((eq T t3 t5) \to (ex2 T (\lambda (t8: +T).(pr0 t1 t8)) (\lambda (t8: T).(pr0 t2 t8))))) (\lambda (H16: (eq T t3 +t5)).(eq_ind T t5 (\lambda (_: T).(ex2 T (\lambda (t8: T).(pr0 t1 t8)) +(\lambda (t8: T).(pr0 t2 t8)))) (let H17 \def (eq_ind_r T t (\lambda (t7: +T).(\forall (v: T).((tlt v t7) \to (\forall (t8: T).((pr0 v t8) \to (\forall +(t9: T).((pr0 v t9) \to (ex2 T (\lambda (t10: T).(pr0 t8 t10)) (\lambda (t10: +T).(pr0 t9 t10)))))))))) H (THead (Flat Cast) u0 t5) H8) in (let H18 \def +(eq_ind T t3 (\lambda (t7: T).(pr0 t7 t1)) H6 t5 H16) in (ex2_ind T (\lambda +(t7: T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7)) (ex2 T (\lambda (t7: +T).(pr0 t1 t7)) (\lambda (t7: T).(pr0 t2 t7))) (\lambda (x: T).(\lambda (H19: +(pr0 t1 x)).(\lambda (H20: (pr0 t2 x)).(ex_intro2 T (\lambda (t7: T).(pr0 t1 +t7)) (\lambda (t7: T).(pr0 t2 t7)) x H19 H20)))) (H17 t5 (tlt_head_dx (Flat +Cast) u0 t5) t1 H18 t2 H11)))) t3 (sym_eq T t3 t5 H16))) u (sym_eq T u u0 +H15))) H14)))]) in (H13 (refl_equal T (THead (Flat Cast) u0 t5)))))) t6 +(sym_eq T t6 t2 H10))) t H8 H9 H7)))]) in (H7 (refl_equal T t) (refl_equal T +t2)))) t4 (sym_eq T t4 t1 H5))) t H3 H4 H2)))]) in (H2 (refl_equal T t) +(refl_equal T t1))))))))) t0). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/props.ma new file mode 100644 index 000000000..5e8396c47 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/props.ma @@ -0,0 +1,1772 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr0/props". + +include "pr0/defs.ma". + +include "subst0/subst0.ma". + +theorem pr0_lift: + \forall (t1: T).(\forall (t2: T).((pr0 t1 t2) \to (\forall (h: nat).(\forall +(d: nat).(pr0 (lift h d t1) (lift h d t2)))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr0 t1 t2)).(pr0_ind (\lambda +(t: T).(\lambda (t0: T).(\forall (h: nat).(\forall (d: nat).(pr0 (lift h d t) +(lift h d t0)))))) (\lambda (t: T).(\lambda (h: nat).(\lambda (d: +nat).(pr0_refl (lift h d t))))) (\lambda (u1: T).(\lambda (u2: T).(\lambda +(_: (pr0 u1 u2)).(\lambda (H1: ((\forall (h: nat).(\forall (d: nat).(pr0 +(lift h d u1) (lift h d u2)))))).(\lambda (t0: T).(\lambda (t3: T).(\lambda +(_: (pr0 t0 t3)).(\lambda (H3: ((\forall (h: nat).(\forall (d: nat).(pr0 +(lift h d t0) (lift h d t3)))))).(\lambda (k: K).(\lambda (h: nat).(\lambda +(d: nat).(eq_ind_r T (THead k (lift h d u1) (lift h (s k d) t0)) (\lambda (t: +T).(pr0 t (lift h d (THead k u2 t3)))) (eq_ind_r T (THead k (lift h d u2) +(lift h (s k d) t3)) (\lambda (t: T).(pr0 (THead k (lift h d u1) (lift h (s k +d) t0)) t)) (pr0_comp (lift h d u1) (lift h d u2) (H1 h d) (lift h (s k d) +t0) (lift h (s k d) t3) (H3 h (s k d)) k) (lift h d (THead k u2 t3)) +(lift_head k u2 t3 h d)) (lift h d (THead k u1 t0)) (lift_head k u1 t0 h +d))))))))))))) (\lambda (u: T).(\lambda (v1: T).(\lambda (v2: T).(\lambda (_: +(pr0 v1 v2)).(\lambda (H1: ((\forall (h: nat).(\forall (d: nat).(pr0 (lift h +d v1) (lift h d v2)))))).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (pr0 +t0 t3)).(\lambda (H3: ((\forall (h: nat).(\forall (d: nat).(pr0 (lift h d t0) +(lift h d t3)))))).(\lambda (h: nat).(\lambda (d: nat).(eq_ind_r T (THead +(Flat Appl) (lift h d v1) (lift h (s (Flat Appl) d) (THead (Bind Abst) u +t0))) (\lambda (t: T).(pr0 t (lift h d (THead (Bind Abbr) v2 t3)))) (eq_ind_r +T (THead (Bind Abst) (lift h (s (Flat Appl) d) u) (lift h (s (Bind Abst) (s +(Flat Appl) d)) t0)) (\lambda (t: T).(pr0 (THead (Flat Appl) (lift h d v1) t) +(lift h d (THead (Bind Abbr) v2 t3)))) (eq_ind_r T (THead (Bind Abbr) (lift h +d v2) (lift h (s (Bind Abbr) d) t3)) (\lambda (t: T).(pr0 (THead (Flat Appl) +(lift h d v1) (THead (Bind Abst) (lift h (s (Flat Appl) d) u) (lift h (s +(Bind Abst) (s (Flat Appl) d)) t0))) t)) (pr0_beta (lift h (s (Flat Appl) d) +u) (lift h d v1) (lift h d v2) (H1 h d) (lift h (s (Bind Abst) (s (Flat Appl) +d)) t0) (lift h (s (Bind Abbr) d) t3) (H3 h (s (Bind Abbr) d))) (lift h d +(THead (Bind Abbr) v2 t3)) (lift_head (Bind Abbr) v2 t3 h d)) (lift h (s +(Flat Appl) d) (THead (Bind Abst) u t0)) (lift_head (Bind Abst) u t0 h (s +(Flat Appl) d))) (lift h d (THead (Flat Appl) v1 (THead (Bind Abst) u t0))) +(lift_head (Flat Appl) v1 (THead (Bind Abst) u t0) h d))))))))))))) (\lambda +(b: B).(\lambda (H0: (not (eq B b Abst))).(\lambda (v1: T).(\lambda (v2: +T).(\lambda (_: (pr0 v1 v2)).(\lambda (H2: ((\forall (h: nat).(\forall (d: +nat).(pr0 (lift h d v1) (lift h d v2)))))).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (_: (pr0 u1 u2)).(\lambda (H4: ((\forall (h: nat).(\forall (d: +nat).(pr0 (lift h d u1) (lift h d u2)))))).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (_: (pr0 t0 t3)).(\lambda (H6: ((\forall (h: nat).(\forall (d: +nat).(pr0 (lift h d t0) (lift h d t3)))))).(\lambda (h: nat).(\lambda (d: +nat).(eq_ind_r T (THead (Flat Appl) (lift h d v1) (lift h (s (Flat Appl) d) +(THead (Bind b) u1 t0))) (\lambda (t: T).(pr0 t (lift h d (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t3))))) (eq_ind_r T (THead (Bind b) +(lift h (s (Flat Appl) d) u1) (lift h (s (Bind b) (s (Flat Appl) d)) t0)) +(\lambda (t: T).(pr0 (THead (Flat Appl) (lift h d v1) t) (lift h d (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t3))))) (eq_ind_r T (THead +(Bind b) (lift h d u2) (lift h (s (Bind b) d) (THead (Flat Appl) (lift (S O) +O v2) t3))) (\lambda (t: T).(pr0 (THead (Flat Appl) (lift h d v1) (THead +(Bind b) (lift h (s (Flat Appl) d) u1) (lift h (s (Bind b) (s (Flat Appl) d)) +t0))) t)) (eq_ind_r T (THead (Flat Appl) (lift h (s (Bind b) d) (lift (S O) O +v2)) (lift h (s (Flat Appl) (s (Bind b) d)) t3)) (\lambda (t: T).(pr0 (THead +(Flat Appl) (lift h d v1) (THead (Bind b) (lift h (s (Flat Appl) d) u1) (lift +h (s (Bind b) (s (Flat Appl) d)) t0))) (THead (Bind b) (lift h d u2) t))) +(eq_ind nat (plus (S O) d) (\lambda (n: nat).(pr0 (THead (Flat Appl) (lift h +d v1) (THead (Bind b) (lift h d u1) (lift h n t0))) (THead (Bind b) (lift h d +u2) (THead (Flat Appl) (lift h n (lift (S O) O v2)) (lift h n t3))))) +(eq_ind_r T (lift (S O) O (lift h d v2)) (\lambda (t: T).(pr0 (THead (Flat +Appl) (lift h d v1) (THead (Bind b) (lift h d u1) (lift h (plus (S O) d) +t0))) (THead (Bind b) (lift h d u2) (THead (Flat Appl) t (lift h (plus (S O) +d) t3))))) (pr0_upsilon b H0 (lift h d v1) (lift h d v2) (H2 h d) (lift h d +u1) (lift h d u2) (H4 h d) (lift h (plus (S O) d) t0) (lift h (plus (S O) d) +t3) (H6 h (plus (S O) d))) (lift h (plus (S O) d) (lift (S O) O v2)) (lift_d +v2 h (S O) d O (le_O_n d))) (S d) (refl_equal nat (S d))) (lift h (s (Bind b) +d) (THead (Flat Appl) (lift (S O) O v2) t3)) (lift_head (Flat Appl) (lift (S +O) O v2) t3 h (s (Bind b) d))) (lift h d (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t3))) (lift_head (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t3) h d)) (lift h (s (Flat Appl) d) (THead (Bind b) u1 t0)) +(lift_head (Bind b) u1 t0 h (s (Flat Appl) d))) (lift h d (THead (Flat Appl) +v1 (THead (Bind b) u1 t0))) (lift_head (Flat Appl) v1 (THead (Bind b) u1 t0) +h d)))))))))))))))))) (\lambda (u1: T).(\lambda (u2: T).(\lambda (_: (pr0 u1 +u2)).(\lambda (H1: ((\forall (h: nat).(\forall (d: nat).(pr0 (lift h d u1) +(lift h d u2)))))).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (pr0 t0 +t3)).(\lambda (H3: ((\forall (h: nat).(\forall (d: nat).(pr0 (lift h d t0) +(lift h d t3)))))).(\lambda (w: T).(\lambda (H4: (subst0 O u2 t3 w)).(\lambda +(h: nat).(\lambda (d: nat).(eq_ind_r T (THead (Bind Abbr) (lift h d u1) (lift +h (s (Bind Abbr) d) t0)) (\lambda (t: T).(pr0 t (lift h d (THead (Bind Abbr) +u2 w)))) (eq_ind_r T (THead (Bind Abbr) (lift h d u2) (lift h (s (Bind Abbr) +d) w)) (\lambda (t: T).(pr0 (THead (Bind Abbr) (lift h d u1) (lift h (s (Bind +Abbr) d) t0)) t)) (pr0_delta (lift h d u1) (lift h d u2) (H1 h d) (lift h (S +d) t0) (lift h (S d) t3) (H3 h (S d)) (lift h (S d) w) (let d' \def (S d) in +(eq_ind nat (minus (S d) (S O)) (\lambda (n: nat).(subst0 O (lift h n u2) +(lift h d' t3) (lift h d' w))) (subst0_lift_lt t3 w u2 O H4 (S d) (le_n_S O d +(le_O_n d)) h) d (eq_ind nat d (\lambda (n: nat).(eq nat n d)) (refl_equal +nat d) (minus d O) (minus_n_O d))))) (lift h d (THead (Bind Abbr) u2 w)) +(lift_head (Bind Abbr) u2 w h d)) (lift h d (THead (Bind Abbr) u1 t0)) +(lift_head (Bind Abbr) u1 t0 h d)))))))))))))) (\lambda (b: B).(\lambda (H0: +(not (eq B b Abst))).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (pr0 t0 +t3)).(\lambda (H2: ((\forall (h: nat).(\forall (d: nat).(pr0 (lift h d t0) +(lift h d t3)))))).(\lambda (u: T).(\lambda (h: nat).(\lambda (d: +nat).(eq_ind_r T (THead (Bind b) (lift h d u) (lift h (s (Bind b) d) (lift (S +O) O t0))) (\lambda (t: T).(pr0 t (lift h d t3))) (eq_ind nat (plus (S O) d) +(\lambda (n: nat).(pr0 (THead (Bind b) (lift h d u) (lift h n (lift (S O) O +t0))) (lift h d t3))) (eq_ind_r T (lift (S O) O (lift h d t0)) (\lambda (t: +T).(pr0 (THead (Bind b) (lift h d u) t) (lift h d t3))) (pr0_zeta b H0 (lift +h d t0) (lift h d t3) (H2 h d) (lift h d u)) (lift h (plus (S O) d) (lift (S +O) O t0)) (lift_d t0 h (S O) d O (le_O_n d))) (S d) (refl_equal nat (S d))) +(lift h d (THead (Bind b) u (lift (S O) O t0))) (lift_head (Bind b) u (lift +(S O) O t0) h d))))))))))) (\lambda (t0: T).(\lambda (t3: T).(\lambda (_: +(pr0 t0 t3)).(\lambda (H1: ((\forall (h: nat).(\forall (d: nat).(pr0 (lift h +d t0) (lift h d t3)))))).(\lambda (u: T).(\lambda (h: nat).(\lambda (d: +nat).(eq_ind_r T (THead (Flat Cast) (lift h d u) (lift h (s (Flat Cast) d) +t0)) (\lambda (t: T).(pr0 t (lift h d t3))) (pr0_epsilon (lift h (s (Flat +Cast) d) t0) (lift h d t3) (H1 h d) (lift h d u)) (lift h d (THead (Flat +Cast) u t0)) (lift_head (Flat Cast) u t0 h d))))))))) t1 t2 H))). + +theorem pr0_subst0_back: + \forall (u2: T).(\forall (t1: T).(\forall (t2: T).(\forall (i: nat).((subst0 +i u2 t1 t2) \to (\forall (u1: T).((pr0 u1 u2) \to (ex2 T (\lambda (t: +T).(subst0 i u1 t1 t)) (\lambda (t: T).(pr0 t t2))))))))) +\def + \lambda (u2: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda (i: nat).(\lambda +(H: (subst0 i u2 t1 t2)).(subst0_ind (\lambda (n: nat).(\lambda (t: +T).(\lambda (t0: T).(\lambda (t3: T).(\forall (u1: T).((pr0 u1 t) \to (ex2 T +(\lambda (t4: T).(subst0 n u1 t0 t4)) (\lambda (t4: T).(pr0 t4 t3))))))))) +(\lambda (v: T).(\lambda (i0: nat).(\lambda (u1: T).(\lambda (H0: (pr0 u1 +v)).(ex_intro2 T (\lambda (t: T).(subst0 i0 u1 (TLRef i0) t)) (\lambda (t: +T).(pr0 t (lift (S i0) O v))) (lift (S i0) O u1) (subst0_lref u1 i0) +(pr0_lift u1 v H0 (S i0) O)))))) (\lambda (v: T).(\lambda (u0: T).(\lambda +(u1: T).(\lambda (i0: nat).(\lambda (_: (subst0 i0 v u1 u0)).(\lambda (H1: +((\forall (u3: T).((pr0 u3 v) \to (ex2 T (\lambda (t: T).(subst0 i0 u3 u1 t)) +(\lambda (t: T).(pr0 t u0))))))).(\lambda (t: T).(\lambda (k: K).(\lambda +(u3: T).(\lambda (H2: (pr0 u3 v)).(ex2_ind T (\lambda (t0: T).(subst0 i0 u3 +u1 t0)) (\lambda (t0: T).(pr0 t0 u0)) (ex2 T (\lambda (t0: T).(subst0 i0 u3 +(THead k u1 t) t0)) (\lambda (t0: T).(pr0 t0 (THead k u0 t)))) (\lambda (x: +T).(\lambda (H3: (subst0 i0 u3 u1 x)).(\lambda (H4: (pr0 x u0)).(ex_intro2 T +(\lambda (t0: T).(subst0 i0 u3 (THead k u1 t) t0)) (\lambda (t0: T).(pr0 t0 +(THead k u0 t))) (THead k x t) (subst0_fst u3 x u1 i0 H3 t k) (pr0_comp x u0 +H4 t t (pr0_refl t) k))))) (H1 u3 H2)))))))))))) (\lambda (k: K).(\lambda (v: +T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (i0: nat).(\lambda (_: (subst0 +(s k i0) v t3 t0)).(\lambda (H1: ((\forall (u1: T).((pr0 u1 v) \to (ex2 T +(\lambda (t: T).(subst0 (s k i0) u1 t3 t)) (\lambda (t: T).(pr0 t +t0))))))).(\lambda (u: T).(\lambda (u1: T).(\lambda (H2: (pr0 u1 v)).(ex2_ind +T (\lambda (t: T).(subst0 (s k i0) u1 t3 t)) (\lambda (t: T).(pr0 t t0)) (ex2 +T (\lambda (t: T).(subst0 i0 u1 (THead k u t3) t)) (\lambda (t: T).(pr0 t +(THead k u t0)))) (\lambda (x: T).(\lambda (H3: (subst0 (s k i0) u1 t3 +x)).(\lambda (H4: (pr0 x t0)).(ex_intro2 T (\lambda (t: T).(subst0 i0 u1 +(THead k u t3) t)) (\lambda (t: T).(pr0 t (THead k u t0))) (THead k u x) +(subst0_snd k u1 x t3 i0 H3 u) (pr0_comp u u (pr0_refl u) x t0 H4 k))))) (H1 +u1 H2)))))))))))) (\lambda (v: T).(\lambda (u1: T).(\lambda (u0: T).(\lambda +(i0: nat).(\lambda (_: (subst0 i0 v u1 u0)).(\lambda (H1: ((\forall (u3: +T).((pr0 u3 v) \to (ex2 T (\lambda (t: T).(subst0 i0 u3 u1 t)) (\lambda (t: +T).(pr0 t u0))))))).(\lambda (k: K).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (_: (subst0 (s k i0) v t0 t3)).(\lambda (H3: ((\forall (u3: +T).((pr0 u3 v) \to (ex2 T (\lambda (t: T).(subst0 (s k i0) u3 t0 t)) (\lambda +(t: T).(pr0 t t3))))))).(\lambda (u3: T).(\lambda (H4: (pr0 u3 v)).(ex2_ind T +(\lambda (t: T).(subst0 (s k i0) u3 t0 t)) (\lambda (t: T).(pr0 t t3)) (ex2 T +(\lambda (t: T).(subst0 i0 u3 (THead k u1 t0) t)) (\lambda (t: T).(pr0 t +(THead k u0 t3)))) (\lambda (x: T).(\lambda (H5: (subst0 (s k i0) u3 t0 +x)).(\lambda (H6: (pr0 x t3)).(ex2_ind T (\lambda (t: T).(subst0 i0 u3 u1 t)) +(\lambda (t: T).(pr0 t u0)) (ex2 T (\lambda (t: T).(subst0 i0 u3 (THead k u1 +t0) t)) (\lambda (t: T).(pr0 t (THead k u0 t3)))) (\lambda (x0: T).(\lambda +(H7: (subst0 i0 u3 u1 x0)).(\lambda (H8: (pr0 x0 u0)).(ex_intro2 T (\lambda +(t: T).(subst0 i0 u3 (THead k u1 t0) t)) (\lambda (t: T).(pr0 t (THead k u0 +t3))) (THead k x0 x) (subst0_both u3 u1 x0 i0 H7 k t0 x H5) (pr0_comp x0 u0 +H8 x t3 H6 k))))) (H1 u3 H4))))) (H3 u3 H4))))))))))))))) i u2 t1 t2 H))))). + +theorem pr0_subst0_fwd: + \forall (u2: T).(\forall (t1: T).(\forall (t2: T).(\forall (i: nat).((subst0 +i u2 t1 t2) \to (\forall (u1: T).((pr0 u2 u1) \to (ex2 T (\lambda (t: +T).(subst0 i u1 t1 t)) (\lambda (t: T).(pr0 t2 t))))))))) +\def + \lambda (u2: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda (i: nat).(\lambda +(H: (subst0 i u2 t1 t2)).(subst0_ind (\lambda (n: nat).(\lambda (t: +T).(\lambda (t0: T).(\lambda (t3: T).(\forall (u1: T).((pr0 t u1) \to (ex2 T +(\lambda (t4: T).(subst0 n u1 t0 t4)) (\lambda (t4: T).(pr0 t3 t4))))))))) +(\lambda (v: T).(\lambda (i0: nat).(\lambda (u1: T).(\lambda (H0: (pr0 v +u1)).(ex_intro2 T (\lambda (t: T).(subst0 i0 u1 (TLRef i0) t)) (\lambda (t: +T).(pr0 (lift (S i0) O v) t)) (lift (S i0) O u1) (subst0_lref u1 i0) +(pr0_lift v u1 H0 (S i0) O)))))) (\lambda (v: T).(\lambda (u0: T).(\lambda +(u1: T).(\lambda (i0: nat).(\lambda (_: (subst0 i0 v u1 u0)).(\lambda (H1: +((\forall (u3: T).((pr0 v u3) \to (ex2 T (\lambda (t: T).(subst0 i0 u3 u1 t)) +(\lambda (t: T).(pr0 u0 t))))))).(\lambda (t: T).(\lambda (k: K).(\lambda +(u3: T).(\lambda (H2: (pr0 v u3)).(ex2_ind T (\lambda (t0: T).(subst0 i0 u3 +u1 t0)) (\lambda (t0: T).(pr0 u0 t0)) (ex2 T (\lambda (t0: T).(subst0 i0 u3 +(THead k u1 t) t0)) (\lambda (t0: T).(pr0 (THead k u0 t) t0))) (\lambda (x: +T).(\lambda (H3: (subst0 i0 u3 u1 x)).(\lambda (H4: (pr0 u0 x)).(ex_intro2 T +(\lambda (t0: T).(subst0 i0 u3 (THead k u1 t) t0)) (\lambda (t0: T).(pr0 +(THead k u0 t) t0)) (THead k x t) (subst0_fst u3 x u1 i0 H3 t k) (pr0_comp u0 +x H4 t t (pr0_refl t) k))))) (H1 u3 H2)))))))))))) (\lambda (k: K).(\lambda +(v: T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (i0: nat).(\lambda (_: +(subst0 (s k i0) v t3 t0)).(\lambda (H1: ((\forall (u1: T).((pr0 v u1) \to +(ex2 T (\lambda (t: T).(subst0 (s k i0) u1 t3 t)) (\lambda (t: T).(pr0 t0 +t))))))).(\lambda (u: T).(\lambda (u1: T).(\lambda (H2: (pr0 v u1)).(ex2_ind +T (\lambda (t: T).(subst0 (s k i0) u1 t3 t)) (\lambda (t: T).(pr0 t0 t)) (ex2 +T (\lambda (t: T).(subst0 i0 u1 (THead k u t3) t)) (\lambda (t: T).(pr0 +(THead k u t0) t))) (\lambda (x: T).(\lambda (H3: (subst0 (s k i0) u1 t3 +x)).(\lambda (H4: (pr0 t0 x)).(ex_intro2 T (\lambda (t: T).(subst0 i0 u1 +(THead k u t3) t)) (\lambda (t: T).(pr0 (THead k u t0) t)) (THead k u x) +(subst0_snd k u1 x t3 i0 H3 u) (pr0_comp u u (pr0_refl u) t0 x H4 k))))) (H1 +u1 H2)))))))))))) (\lambda (v: T).(\lambda (u1: T).(\lambda (u0: T).(\lambda +(i0: nat).(\lambda (_: (subst0 i0 v u1 u0)).(\lambda (H1: ((\forall (u3: +T).((pr0 v u3) \to (ex2 T (\lambda (t: T).(subst0 i0 u3 u1 t)) (\lambda (t: +T).(pr0 u0 t))))))).(\lambda (k: K).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (_: (subst0 (s k i0) v t0 t3)).(\lambda (H3: ((\forall (u3: +T).((pr0 v u3) \to (ex2 T (\lambda (t: T).(subst0 (s k i0) u3 t0 t)) (\lambda +(t: T).(pr0 t3 t))))))).(\lambda (u3: T).(\lambda (H4: (pr0 v u3)).(ex2_ind T +(\lambda (t: T).(subst0 (s k i0) u3 t0 t)) (\lambda (t: T).(pr0 t3 t)) (ex2 T +(\lambda (t: T).(subst0 i0 u3 (THead k u1 t0) t)) (\lambda (t: T).(pr0 (THead +k u0 t3) t))) (\lambda (x: T).(\lambda (H5: (subst0 (s k i0) u3 t0 +x)).(\lambda (H6: (pr0 t3 x)).(ex2_ind T (\lambda (t: T).(subst0 i0 u3 u1 t)) +(\lambda (t: T).(pr0 u0 t)) (ex2 T (\lambda (t: T).(subst0 i0 u3 (THead k u1 +t0) t)) (\lambda (t: T).(pr0 (THead k u0 t3) t))) (\lambda (x0: T).(\lambda +(H7: (subst0 i0 u3 u1 x0)).(\lambda (H8: (pr0 u0 x0)).(ex_intro2 T (\lambda +(t: T).(subst0 i0 u3 (THead k u1 t0) t)) (\lambda (t: T).(pr0 (THead k u0 t3) +t)) (THead k x0 x) (subst0_both u3 u1 x0 i0 H7 k t0 x H5) (pr0_comp u0 x0 H8 +t3 x H6 k))))) (H1 u3 H4))))) (H3 u3 H4))))))))))))))) i u2 t1 t2 H))))). + +theorem pr0_subst0: + \forall (t1: T).(\forall (t2: T).((pr0 t1 t2) \to (\forall (v1: T).(\forall +(w1: T).(\forall (i: nat).((subst0 i v1 t1 w1) \to (\forall (v2: T).((pr0 v1 +v2) \to (or (pr0 w1 t2) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v2 t2 w2)))))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr0 t1 t2)).(pr0_ind (\lambda +(t: T).(\lambda (t0: T).(\forall (v1: T).(\forall (w1: T).(\forall (i: +nat).((subst0 i v1 t w1) \to (\forall (v2: T).((pr0 v1 v2) \to (or (pr0 w1 +t0) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 t0 +w2)))))))))))) (\lambda (t: T).(\lambda (v1: T).(\lambda (w1: T).(\lambda (i: +nat).(\lambda (H0: (subst0 i v1 t w1)).(\lambda (v2: T).(\lambda (H1: (pr0 v1 +v2)).(or_intror (pr0 w1 t) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v2 t w2))) (ex2_sym T (subst0 i v2 t) (pr0 w1) (pr0_subst0_fwd +v1 t w1 i H0 v2 H1)))))))))) (\lambda (u1: T).(\lambda (u2: T).(\lambda (H0: +(pr0 u1 u2)).(\lambda (H1: ((\forall (v1: T).(\forall (w1: T).(\forall (i: +nat).((subst0 i v1 u1 w1) \to (\forall (v2: T).((pr0 v1 v2) \to (or (pr0 w1 +u2) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 u2 +w2)))))))))))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H2: (pr0 t3 +t4)).(\lambda (H3: ((\forall (v1: T).(\forall (w1: T).(\forall (i: +nat).((subst0 i v1 t3 w1) \to (\forall (v2: T).((pr0 v1 v2) \to (or (pr0 w1 +t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 t4 +w2)))))))))))).(\lambda (k: K).(\lambda (v1: T).(\lambda (w1: T).(\lambda (i: +nat).(\lambda (H4: (subst0 i v1 (THead k u1 t3) w1)).(\lambda (v2: +T).(\lambda (H5: (pr0 v1 v2)).(or3_ind (ex2 T (\lambda (u3: T).(eq T w1 +(THead k u3 t3))) (\lambda (u3: T).(subst0 i v1 u1 u3))) (ex2 T (\lambda (t5: +T).(eq T w1 (THead k u1 t5))) (\lambda (t5: T).(subst0 (s k i) v1 t3 t5))) +(ex3_2 T T (\lambda (u3: T).(\lambda (t5: T).(eq T w1 (THead k u3 t5)))) +(\lambda (u3: T).(\lambda (_: T).(subst0 i v1 u1 u3))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s k i) v1 t3 t5)))) (or (pr0 w1 (THead k u2 t4)) +(ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 (THead k +u2 t4) w2)))) (\lambda (H6: (ex2 T (\lambda (u3: T).(eq T w1 (THead k u3 +t3))) (\lambda (u3: T).(subst0 i v1 u1 u3)))).(ex2_ind T (\lambda (u3: T).(eq +T w1 (THead k u3 t3))) (\lambda (u3: T).(subst0 i v1 u1 u3)) (or (pr0 w1 +(THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v2 (THead k u2 t4) w2)))) (\lambda (x: T).(\lambda (H7: (eq T w1 +(THead k x t3))).(\lambda (H8: (subst0 i v1 u1 x)).(eq_ind_r T (THead k x t3) +(\lambda (t: T).(or (pr0 t (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 t +w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2))))) (or_ind (pr0 x u2) +(ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 i v2 u2 w2))) +(or (pr0 (THead k x t3) (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead +k x t3) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2)))) (\lambda +(H9: (pr0 x u2)).(or_introl (pr0 (THead k x t3) (THead k u2 t4)) (ex2 T +(\lambda (w2: T).(pr0 (THead k x t3) w2)) (\lambda (w2: T).(subst0 i v2 +(THead k u2 t4) w2))) (pr0_comp x u2 H9 t3 t4 H2 k))) (\lambda (H9: (ex2 T +(\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 i v2 u2 w2)))).(ex2_ind +T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 i v2 u2 w2)) (or (pr0 +(THead k x t3) (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k x t3) +w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2)))) (\lambda (x0: +T).(\lambda (H10: (pr0 x x0)).(\lambda (H11: (subst0 i v2 u2 x0)).(or_intror +(pr0 (THead k x t3) (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k x +t3) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead k x t3) w2)) (\lambda (w2: T).(subst0 i v2 +(THead k u2 t4) w2)) (THead k x0 t4) (pr0_comp x x0 H10 t3 t4 H2 k) +(subst0_fst v2 x0 u2 i H11 t4 k)))))) H9)) (H1 v1 x i H8 v2 H5)) w1 H7)))) +H6)) (\lambda (H6: (ex2 T (\lambda (t5: T).(eq T w1 (THead k u1 t5))) +(\lambda (t5: T).(subst0 (s k i) v1 t3 t5)))).(ex2_ind T (\lambda (t5: T).(eq +T w1 (THead k u1 t5))) (\lambda (t5: T).(subst0 (s k i) v1 t3 t5)) (or (pr0 +w1 (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v2 (THead k u2 t4) w2)))) (\lambda (x: T).(\lambda (H7: (eq T w1 +(THead k u1 x))).(\lambda (H8: (subst0 (s k i) v1 t3 x)).(eq_ind_r T (THead k +u1 x) (\lambda (t: T).(or (pr0 t (THead k u2 t4)) (ex2 T (\lambda (w2: +T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2))))) (or_ind +(pr0 x t4) (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s k +i) v2 t4 w2))) (or (pr0 (THead k u1 x) (THead k u2 t4)) (ex2 T (\lambda (w2: +T).(pr0 (THead k u1 x) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) +w2)))) (\lambda (H9: (pr0 x t4)).(or_introl (pr0 (THead k u1 x) (THead k u2 +t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k u1 x) w2)) (\lambda (w2: +T).(subst0 i v2 (THead k u2 t4) w2))) (pr0_comp u1 u2 H0 x t4 H9 k))) +(\lambda (H9: (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s +k i) v2 t4 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: +T).(subst0 (s k i) v2 t4 w2)) (or (pr0 (THead k u1 x) (THead k u2 t4)) (ex2 T +(\lambda (w2: T).(pr0 (THead k u1 x) w2)) (\lambda (w2: T).(subst0 i v2 +(THead k u2 t4) w2)))) (\lambda (x0: T).(\lambda (H10: (pr0 x x0)).(\lambda +(H11: (subst0 (s k i) v2 t4 x0)).(or_intror (pr0 (THead k u1 x) (THead k u2 +t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k u1 x) w2)) (\lambda (w2: +T).(subst0 i v2 (THead k u2 t4) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 +(THead k u1 x) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2)) (THead +k u2 x0) (pr0_comp u1 u2 H0 x x0 H10 k) (subst0_snd k v2 x0 t4 i H11 u2)))))) +H9)) (H3 v1 x (s k i) H8 v2 H5)) w1 H7)))) H6)) (\lambda (H6: (ex3_2 T T +(\lambda (u3: T).(\lambda (t5: T).(eq T w1 (THead k u3 t5)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 i v1 u1 u3))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s k i) v1 t3 t5))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda +(t5: T).(eq T w1 (THead k u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 +i v1 u1 u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s k i) v1 t3 t5))) +(or (pr0 w1 (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda +(w2: T).(subst0 i v2 (THead k u2 t4) w2)))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H7: (eq T w1 (THead k x0 x1))).(\lambda (H8: (subst0 i v1 u1 +x0)).(\lambda (H9: (subst0 (s k i) v1 t3 x1)).(eq_ind_r T (THead k x0 x1) +(\lambda (t: T).(or (pr0 t (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 t +w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2))))) (or_ind (pr0 x1 +t4) (ex2 T (\lambda (w2: T).(pr0 x1 w2)) (\lambda (w2: T).(subst0 (s k i) v2 +t4 w2))) (or (pr0 (THead k x0 x1) (THead k u2 t4)) (ex2 T (\lambda (w2: +T).(pr0 (THead k x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) +w2)))) (\lambda (H10: (pr0 x1 t4)).(or_ind (pr0 x0 u2) (ex2 T (\lambda (w2: +T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v2 u2 w2))) (or (pr0 (THead k x0 +x1) (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k x0 x1) w2)) +(\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2)))) (\lambda (H11: (pr0 x0 +u2)).(or_introl (pr0 (THead k x0 x1) (THead k u2 t4)) (ex2 T (\lambda (w2: +T).(pr0 (THead k x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) +w2))) (pr0_comp x0 u2 H11 x1 t4 H10 k))) (\lambda (H11: (ex2 T (\lambda (w2: +T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v2 u2 w2)))).(ex2_ind T (\lambda +(w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v2 u2 w2)) (or (pr0 (THead k +x0 x1) (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k x0 x1) w2)) +(\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2)))) (\lambda (x: T).(\lambda +(H12: (pr0 x0 x)).(\lambda (H13: (subst0 i v2 u2 x)).(or_intror (pr0 (THead k +x0 x1) (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k x0 x1) w2)) +(\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2))) (ex_intro2 T (\lambda +(w2: T).(pr0 (THead k x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 +t4) w2)) (THead k x t4) (pr0_comp x0 x H12 x1 t4 H10 k) (subst0_fst v2 x u2 i +H13 t4 k)))))) H11)) (H1 v1 x0 i H8 v2 H5))) (\lambda (H10: (ex2 T (\lambda +(w2: T).(pr0 x1 w2)) (\lambda (w2: T).(subst0 (s k i) v2 t4 w2)))).(ex2_ind T +(\lambda (w2: T).(pr0 x1 w2)) (\lambda (w2: T).(subst0 (s k i) v2 t4 w2)) (or +(pr0 (THead k x0 x1) (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k +x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2)))) (\lambda (x: +T).(\lambda (H11: (pr0 x1 x)).(\lambda (H12: (subst0 (s k i) v2 t4 +x)).(or_ind (pr0 x0 u2) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 i v2 u2 w2))) (or (pr0 (THead k x0 x1) (THead k u2 t4)) (ex2 T +(\lambda (w2: T).(pr0 (THead k x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 +(THead k u2 t4) w2)))) (\lambda (H13: (pr0 x0 u2)).(or_intror (pr0 (THead k +x0 x1) (THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k x0 x1) w2)) +(\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2))) (ex_intro2 T (\lambda +(w2: T).(pr0 (THead k x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 +t4) w2)) (THead k u2 x) (pr0_comp x0 u2 H13 x1 x H11 k) (subst0_snd k v2 x t4 +i H12 u2)))) (\lambda (H13: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda +(w2: T).(subst0 i v2 u2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) +(\lambda (w2: T).(subst0 i v2 u2 w2)) (or (pr0 (THead k x0 x1) (THead k u2 +t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k x0 x1) w2)) (\lambda (w2: +T).(subst0 i v2 (THead k u2 t4) w2)))) (\lambda (x2: T).(\lambda (H14: (pr0 +x0 x2)).(\lambda (H15: (subst0 i v2 u2 x2)).(or_intror (pr0 (THead k x0 x1) +(THead k u2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead k x0 x1) w2)) (\lambda +(w2: T).(subst0 i v2 (THead k u2 t4) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 +(THead k x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead k u2 t4) w2)) +(THead k x2 x) (pr0_comp x0 x2 H14 x1 x H11 k) (subst0_both v2 u2 x2 i H15 k +t4 x H12)))))) H13)) (H1 v1 x0 i H8 v2 H5))))) H10)) (H3 v1 x1 (s k i) H9 v2 +H5)) w1 H7)))))) H6)) (subst0_gen_head k v1 u1 t3 w1 i H4))))))))))))))))) +(\lambda (u: T).(\lambda (v1: T).(\lambda (v2: T).(\lambda (H0: (pr0 v1 +v2)).(\lambda (H1: ((\forall (v3: T).(\forall (w1: T).(\forall (i: +nat).((subst0 i v3 v1 w1) \to (\forall (v4: T).((pr0 v3 v4) \to (or (pr0 w1 +v2) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v4 v2 +w2)))))))))))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H2: (pr0 t3 +t4)).(\lambda (H3: ((\forall (v3: T).(\forall (w1: T).(\forall (i: +nat).((subst0 i v3 t3 w1) \to (\forall (v4: T).((pr0 v3 v4) \to (or (pr0 w1 +t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v4 t4 +w2)))))))))))).(\lambda (v0: T).(\lambda (w1: T).(\lambda (i: nat).(\lambda +(H4: (subst0 i v0 (THead (Flat Appl) v1 (THead (Bind Abst) u t3)) +w1)).(\lambda (v3: T).(\lambda (H5: (pr0 v0 v3)).(or3_ind (ex2 T (\lambda +(u2: T).(eq T w1 (THead (Flat Appl) u2 (THead (Bind Abst) u t3)))) (\lambda +(u2: T).(subst0 i v0 v1 u2))) (ex2 T (\lambda (t5: T).(eq T w1 (THead (Flat +Appl) v1 t5))) (\lambda (t5: T).(subst0 (s (Flat Appl) i) v0 (THead (Bind +Abst) u t3) t5))) (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T w1 +(THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i v0 v1 +u2))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Flat Appl) i) v0 (THead +(Bind Abst) u t3) t5)))) (or (pr0 w1 (THead (Bind Abbr) v2 t4)) (ex2 T +(\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2)))) (\lambda (H6: (ex2 T (\lambda (u2: T).(eq T w1 (THead +(Flat Appl) u2 (THead (Bind Abst) u t3)))) (\lambda (u2: T).(subst0 i v0 v1 +u2)))).(ex2_ind T (\lambda (u2: T).(eq T w1 (THead (Flat Appl) u2 (THead +(Bind Abst) u t3)))) (\lambda (u2: T).(subst0 i v0 v1 u2)) (or (pr0 w1 (THead +(Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (x: T).(\lambda +(H7: (eq T w1 (THead (Flat Appl) x (THead (Bind Abst) u t3)))).(\lambda (H8: +(subst0 i v0 v1 x)).(eq_ind_r T (THead (Flat Appl) x (THead (Bind Abst) u +t3)) (\lambda (t: T).(or (pr0 t (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda +(w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) +w2))))) (or_ind (pr0 x v2) (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: +T).(subst0 i v3 v2 w2))) (or (pr0 (THead (Flat Appl) x (THead (Bind Abst) u +t3)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) x (THead (Bind Abst) u t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind Abbr) v2 t4) w2)))) (\lambda (H9: (pr0 x v2)).(or_introl (pr0 (THead +(Flat Appl) x (THead (Bind Abst) u t3)) (THead (Bind Abbr) v2 t4)) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x (THead (Bind Abst) u t3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2))) (pr0_beta u x +v2 H9 t3 t4 H2))) (\lambda (H9: (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda +(w2: T).(subst0 i v3 v2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x w2)) +(\lambda (w2: T).(subst0 i v3 v2 w2)) (or (pr0 (THead (Flat Appl) x (THead +(Bind Abst) u t3)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x (THead (Bind Abst) u t3)) w2)) (\lambda (w2: T).(subst0 +i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (x0: T).(\lambda (H10: (pr0 x +x0)).(\lambda (H11: (subst0 i v3 v2 x0)).(or_intror (pr0 (THead (Flat Appl) x +(THead (Bind Abst) u t3)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x (THead (Bind Abst) u t3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2))) (ex_intro2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x (THead (Bind Abst) u t3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)) (THead (Bind Abbr) x0 t4) +(pr0_beta u x x0 H10 t3 t4 H2) (subst0_fst v3 x0 v2 i H11 t4 (Bind +Abbr))))))) H9)) (H1 v0 x i H8 v3 H5)) w1 H7)))) H6)) (\lambda (H6: (ex2 T +(\lambda (t5: T).(eq T w1 (THead (Flat Appl) v1 t5))) (\lambda (t5: +T).(subst0 (s (Flat Appl) i) v0 (THead (Bind Abst) u t3) t5)))).(ex2_ind T +(\lambda (t5: T).(eq T w1 (THead (Flat Appl) v1 t5))) (\lambda (t5: +T).(subst0 (s (Flat Appl) i) v0 (THead (Bind Abst) u t3) t5)) (or (pr0 w1 +(THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (x: T).(\lambda +(H7: (eq T w1 (THead (Flat Appl) v1 x))).(\lambda (H8: (subst0 (s (Flat Appl) +i) v0 (THead (Bind Abst) u t3) x)).(or3_ind (ex2 T (\lambda (u2: T).(eq T x +(THead (Bind Abst) u2 t3))) (\lambda (u2: T).(subst0 (s (Flat Appl) i) v0 u +u2))) (ex2 T (\lambda (t5: T).(eq T x (THead (Bind Abst) u t5))) (\lambda +(t5: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 t3 t5))) (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T x (THead (Bind Abst) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 (s (Flat Appl) i) v0 u u2))) +(\lambda (_: T).(\lambda (t5: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 +t3 t5)))) (or (pr0 w1 (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +w1 w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) +(\lambda (H9: (ex2 T (\lambda (u2: T).(eq T x (THead (Bind Abst) u2 t3))) +(\lambda (u2: T).(subst0 (s (Flat Appl) i) v0 u u2)))).(ex2_ind T (\lambda +(u2: T).(eq T x (THead (Bind Abst) u2 t3))) (\lambda (u2: T).(subst0 (s (Flat +Appl) i) v0 u u2)) (or (pr0 w1 (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda +(w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) +w2)))) (\lambda (x0: T).(\lambda (H10: (eq T x (THead (Bind Abst) x0 +t3))).(\lambda (_: (subst0 (s (Flat Appl) i) v0 u x0)).(eq_ind_r T (THead +(Flat Appl) v1 x) (\lambda (t: T).(or (pr0 t (THead (Bind Abbr) v2 t4)) (ex2 +T (\lambda (w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2))))) (eq_ind_r T (THead (Bind Abst) x0 t3) (\lambda (t: +T).(or (pr0 (THead (Flat Appl) v1 t) (THead (Bind Abbr) v2 t4)) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) v1 t) w2)) (\lambda (w2: T).(subst0 +i v3 (THead (Bind Abbr) v2 t4) w2))))) (or_introl (pr0 (THead (Flat Appl) v1 +(THead (Bind Abst) x0 t3)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) x0 t3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2))) (pr0_beta x0 v1 v2 H0 t3 t4 +H2)) x H10) w1 H7)))) H9)) (\lambda (H9: (ex2 T (\lambda (t5: T).(eq T x +(THead (Bind Abst) u t5))) (\lambda (t5: T).(subst0 (s (Bind Abst) (s (Flat +Appl) i)) v0 t3 t5)))).(ex2_ind T (\lambda (t5: T).(eq T x (THead (Bind Abst) +u t5))) (\lambda (t5: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 t3 t5)) +(or (pr0 w1 (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (x0: +T).(\lambda (H10: (eq T x (THead (Bind Abst) u x0))).(\lambda (H11: (subst0 +(s (Bind Abst) (s (Flat Appl) i)) v0 t3 x0)).(eq_ind_r T (THead (Flat Appl) +v1 x) (\lambda (t: T).(or (pr0 t (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda +(w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) +w2))))) (eq_ind_r T (THead (Bind Abst) u x0) (\lambda (t: T).(or (pr0 (THead +(Flat Appl) v1 t) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) v1 t) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2))))) (or_ind (pr0 x0 t4) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) +(\lambda (w2: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v3 t4 w2))) (or +(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) u x0)) (THead (Bind Abbr) v2 +t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) u +x0)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) +(\lambda (H12: (pr0 x0 t4)).(or_introl (pr0 (THead (Flat Appl) v1 (THead +(Bind Abst) u x0)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) v1 (THead (Bind Abst) u x0)) w2)) (\lambda (w2: T).(subst0 +i v3 (THead (Bind Abbr) v2 t4) w2))) (pr0_beta u v1 v2 H0 x0 t4 H12))) +(\lambda (H12: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 +(s (Bind Abst) (s (Flat Appl) i)) v3 t4 w2)))).(ex2_ind T (\lambda (w2: +T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v3 +t4 w2)) (or (pr0 (THead (Flat Appl) v1 (THead (Bind Abst) u x0)) (THead (Bind +Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind +Abst) u x0)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) +w2)))) (\lambda (x1: T).(\lambda (H13: (pr0 x0 x1)).(\lambda (H14: (subst0 (s +(Bind Abst) (s (Flat Appl) i)) v3 t4 x1)).(or_intror (pr0 (THead (Flat Appl) +v1 (THead (Bind Abst) u x0)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) u x0)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2))) (ex_intro2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) u x0)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)) (THead (Bind Abbr) v2 x1) +(pr0_beta u v1 v2 H0 x0 x1 H13) (subst0_snd (Bind Abbr) v3 x1 t4 i H14 +v2)))))) H12)) (H3 v0 x0 (s (Bind Abst) (s (Flat Appl) i)) H11 v3 H5)) x H10) +w1 H7)))) H9)) (\lambda (H9: (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq +T x (THead (Bind Abst) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(subst0 (s +(Flat Appl) i) v0 u u2))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Bind +Abst) (s (Flat Appl) i)) v0 t3 t5))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t5: T).(eq T x (THead (Bind Abst) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 (s (Flat Appl) i) v0 u u2))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 t3 t5))) (or +(pr0 w1 (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H10: (eq T x (THead (Bind Abst) x0 +x1))).(\lambda (_: (subst0 (s (Flat Appl) i) v0 u x0)).(\lambda (H12: (subst0 +(s (Bind Abst) (s (Flat Appl) i)) v0 t3 x1)).(eq_ind_r T (THead (Flat Appl) +v1 x) (\lambda (t: T).(or (pr0 t (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda +(w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) +w2))))) (eq_ind_r T (THead (Bind Abst) x0 x1) (\lambda (t: T).(or (pr0 (THead +(Flat Appl) v1 t) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) v1 t) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2))))) (or_ind (pr0 x1 t4) (ex2 T (\lambda (w2: T).(pr0 x1 w2)) +(\lambda (w2: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v3 t4 w2))) (or +(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) x0 x1)) (THead (Bind Abbr) v2 +t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) x0 +x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) +(\lambda (H13: (pr0 x1 t4)).(or_introl (pr0 (THead (Flat Appl) v1 (THead +(Bind Abst) x0 x1)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) v1 (THead (Bind Abst) x0 x1)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2))) (pr0_beta x0 v1 v2 H0 x1 t4 +H13))) (\lambda (H13: (ex2 T (\lambda (w2: T).(pr0 x1 w2)) (\lambda (w2: +T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v3 t4 w2)))).(ex2_ind T (\lambda +(w2: T).(pr0 x1 w2)) (\lambda (w2: T).(subst0 (s (Bind Abst) (s (Flat Appl) +i)) v3 t4 w2)) (or (pr0 (THead (Flat Appl) v1 (THead (Bind Abst) x0 x1)) +(THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 +(THead (Bind Abst) x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2)))) (\lambda (x2: T).(\lambda (H14: (pr0 x1 x2)).(\lambda +(H15: (subst0 (s (Bind Abst) (s (Flat Appl) i)) v3 t4 x2)).(or_intror (pr0 +(THead (Flat Appl) v1 (THead (Bind Abst) x0 x1)) (THead (Bind Abbr) v2 t4)) +(ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) x0 x1)) +w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2))) (ex_intro2 +T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind Abst) x0 x1)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)) (THead (Bind +Abbr) v2 x2) (pr0_beta x0 v1 v2 H0 x1 x2 H14) (subst0_snd (Bind Abbr) v3 x2 +t4 i H15 v2)))))) H13)) (H3 v0 x1 (s (Bind Abst) (s (Flat Appl) i)) H12 v3 +H5)) x H10) w1 H7)))))) H9)) (subst0_gen_head (Bind Abst) v0 u t3 x (s (Flat +Appl) i) H8))))) H6)) (\lambda (H6: (ex3_2 T T (\lambda (u2: T).(\lambda (t5: +T).(eq T w1 (THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i v0 v1 u2))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Flat +Appl) i) v0 (THead (Bind Abst) u t3) t5))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t5: T).(eq T w1 (THead (Flat Appl) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i v0 v1 u2))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s (Flat Appl) i) v0 (THead (Bind Abst) u t3) t5))) (or (pr0 w1 +(THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (x0: T).(\lambda +(x1: T).(\lambda (H7: (eq T w1 (THead (Flat Appl) x0 x1))).(\lambda (H8: +(subst0 i v0 v1 x0)).(\lambda (H9: (subst0 (s (Flat Appl) i) v0 (THead (Bind +Abst) u t3) x1)).(or3_ind (ex2 T (\lambda (u2: T).(eq T x1 (THead (Bind Abst) +u2 t3))) (\lambda (u2: T).(subst0 (s (Flat Appl) i) v0 u u2))) (ex2 T +(\lambda (t5: T).(eq T x1 (THead (Bind Abst) u t5))) (\lambda (t5: T).(subst0 +(s (Bind Abst) (s (Flat Appl) i)) v0 t3 t5))) (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T x1 (THead (Bind Abst) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 (s (Flat Appl) i) v0 u u2))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 t3 t5)))) +(or (pr0 w1 (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (H10: +(ex2 T (\lambda (u2: T).(eq T x1 (THead (Bind Abst) u2 t3))) (\lambda (u2: +T).(subst0 (s (Flat Appl) i) v0 u u2)))).(ex2_ind T (\lambda (u2: T).(eq T x1 +(THead (Bind Abst) u2 t3))) (\lambda (u2: T).(subst0 (s (Flat Appl) i) v0 u +u2)) (or (pr0 w1 (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 +w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda +(x: T).(\lambda (H11: (eq T x1 (THead (Bind Abst) x t3))).(\lambda (_: +(subst0 (s (Flat Appl) i) v0 u x)).(eq_ind_r T (THead (Flat Appl) x0 x1) +(\lambda (t: T).(or (pr0 t (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: +T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) +w2))))) (eq_ind_r T (THead (Bind Abst) x t3) (\lambda (t: T).(or (pr0 (THead +(Flat Appl) x0 t) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 t) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2))))) (or_ind (pr0 x0 v2) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) +(\lambda (w2: T).(subst0 i v3 v2 w2))) (or (pr0 (THead (Flat Appl) x0 (THead +(Bind Abst) x t3)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 (THead (Bind Abst) x t3)) w2)) (\lambda (w2: T).(subst0 +i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (H13: (pr0 x0 v2)).(or_introl +(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x t3)) (THead (Bind Abbr) v2 +t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x +t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2))) +(pr0_beta x x0 v2 H13 t3 t4 H2))) (\lambda (H13: (ex2 T (\lambda (w2: T).(pr0 +x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2)))).(ex2_ind T (\lambda (w2: +T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2)) (or (pr0 (THead (Flat +Appl) x0 (THead (Bind Abst) x t3)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda +(w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x t3)) w2)) (\lambda +(w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (x2: +T).(\lambda (H14: (pr0 x0 x2)).(\lambda (H15: (subst0 i v3 v2 x2)).(or_intror +(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x t3)) (THead (Bind Abbr) v2 +t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x +t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2))) +(ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x +t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)) (THead +(Bind Abbr) x2 t4) (pr0_beta x x0 x2 H14 t3 t4 H2) (subst0_fst v3 x2 v2 i H15 +t4 (Bind Abbr))))))) H13)) (H1 v0 x0 i H8 v3 H5)) x1 H11) w1 H7)))) H10)) +(\lambda (H10: (ex2 T (\lambda (t5: T).(eq T x1 (THead (Bind Abst) u t5))) +(\lambda (t5: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 t3 +t5)))).(ex2_ind T (\lambda (t5: T).(eq T x1 (THead (Bind Abst) u t5))) +(\lambda (t5: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 t3 t5)) (or +(pr0 w1 (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (x: +T).(\lambda (H11: (eq T x1 (THead (Bind Abst) u x))).(\lambda (H12: (subst0 +(s (Bind Abst) (s (Flat Appl) i)) v0 t3 x)).(eq_ind_r T (THead (Flat Appl) x0 +x1) (\lambda (t: T).(or (pr0 t (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda +(w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) +w2))))) (eq_ind_r T (THead (Bind Abst) u x) (\lambda (t: T).(or (pr0 (THead +(Flat Appl) x0 t) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 t) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2))))) (or_ind (pr0 x t4) (ex2 T (\lambda (w2: T).(pr0 x w2)) +(\lambda (w2: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v3 t4 w2))) (or +(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) (THead (Bind Abbr) v2 +t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u +x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) +(\lambda (H13: (pr0 x t4)).(or_ind (pr0 x0 v2) (ex2 T (\lambda (w2: T).(pr0 +x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2))) (or (pr0 (THead (Flat Appl) x0 +(THead (Bind Abst) u x)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (H14: (pr0 x0 +v2)).(or_introl (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) (THead +(Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind Abst) u x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 +t4) w2))) (pr0_beta u x0 v2 H14 x t4 H13))) (\lambda (H14: (ex2 T (\lambda +(w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2)))).(ex2_ind T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2)) (or (pr0 +(THead (Flat Appl) x0 (THead (Bind Abst) u x)) (THead (Bind Abbr) v2 t4)) +(ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) +w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda +(x2: T).(\lambda (H15: (pr0 x0 x2)).(\lambda (H16: (subst0 i v3 v2 +x2)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) (THead +(Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind Abst) u x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 +t4) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind Abst) u x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 +t4) w2)) (THead (Bind Abbr) x2 t4) (pr0_beta u x0 x2 H15 x t4 H13) +(subst0_fst v3 x2 v2 i H16 t4 (Bind Abbr))))))) H14)) (H1 v0 x0 i H8 v3 H5))) +(\lambda (H13: (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 +(s (Bind Abst) (s (Flat Appl) i)) v3 t4 w2)))).(ex2_ind T (\lambda (w2: +T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v3 +t4 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) (THead (Bind +Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind +Abst) u x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) +w2)))) (\lambda (x2: T).(\lambda (H14: (pr0 x x2)).(\lambda (H15: (subst0 (s +(Bind Abst) (s (Flat Appl) i)) v3 t4 x2)).(or_ind (pr0 x0 v2) (ex2 T (\lambda +(w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2))) (or (pr0 (THead +(Flat Appl) x0 (THead (Bind Abst) u x)) (THead (Bind Abbr) v2 t4)) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (H16: +(pr0 x0 v2)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) +(THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind Abst) u x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind Abst) u x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2)) (THead (Bind Abbr) v2 x2) (pr0_beta u x0 v2 H16 x x2 H14) +(subst0_snd (Bind Abbr) v3 x2 t4 i H15 v2)))) (\lambda (H16: (ex2 T (\lambda +(w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2)))).(ex2_ind T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2)) (or (pr0 +(THead (Flat Appl) x0 (THead (Bind Abst) u x)) (THead (Bind Abbr) v2 t4)) +(ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) +w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda +(x3: T).(\lambda (H17: (pr0 x0 x3)).(\lambda (H18: (subst0 i v3 v2 +x3)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) u x)) (THead +(Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind Abst) u x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 +t4) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind Abst) u x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 +t4) w2)) (THead (Bind Abbr) x3 x2) (pr0_beta u x0 x3 H17 x x2 H14) +(subst0_both v3 v2 x3 i H18 (Bind Abbr) t4 x2 H15)))))) H16)) (H1 v0 x0 i H8 +v3 H5))))) H13)) (H3 v0 x (s (Bind Abst) (s (Flat Appl) i)) H12 v3 H5)) x1 +H11) w1 H7)))) H10)) (\lambda (H10: (ex3_2 T T (\lambda (u2: T).(\lambda (t5: +T).(eq T x1 (THead (Bind Abst) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 (s (Flat Appl) i) v0 u u2))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 t3 t5))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t5: T).(eq T x1 (THead (Bind Abst) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 (s (Flat Appl) i) v0 u u2))) +(\lambda (_: T).(\lambda (t5: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 +t3 t5))) (or (pr0 w1 (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 +w1 w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) +(\lambda (x2: T).(\lambda (x3: T).(\lambda (H11: (eq T x1 (THead (Bind Abst) +x2 x3))).(\lambda (_: (subst0 (s (Flat Appl) i) v0 u x2)).(\lambda (H13: +(subst0 (s (Bind Abst) (s (Flat Appl) i)) v0 t3 x3)).(eq_ind_r T (THead (Flat +Appl) x0 x1) (\lambda (t: T).(or (pr0 t (THead (Bind Abbr) v2 t4)) (ex2 T +(\lambda (w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) +v2 t4) w2))))) (eq_ind_r T (THead (Bind Abst) x2 x3) (\lambda (t: T).(or (pr0 +(THead (Flat Appl) x0 t) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x0 t) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind Abbr) v2 t4) w2))))) (or_ind (pr0 x3 t4) (ex2 T (\lambda (w2: T).(pr0 +x3 w2)) (\lambda (w2: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v3 t4 +w2))) (or (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x2 x3)) (THead (Bind +Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind +Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) +w2)))) (\lambda (H14: (pr0 x3 t4)).(or_ind (pr0 x0 v2) (ex2 T (\lambda (w2: +T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2))) (or (pr0 (THead (Flat +Appl) x0 (THead (Bind Abst) x2 x3)) (THead (Bind Abbr) v2 t4)) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x2 x3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda (H15: +(pr0 x0 v2)).(or_introl (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x2 x3)) +(THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2))) (pr0_beta x2 x0 v2 H15 x3 t4 H14))) (\lambda (H15: (ex2 T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 +v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x2 x3)) (THead +(Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 +t4) w2)))) (\lambda (x: T).(\lambda (H16: (pr0 x0 x)).(\lambda (H17: (subst0 +i v3 v2 x)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x2 x3)) +(THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind +Abbr) v2 t4) w2)) (THead (Bind Abbr) x t4) (pr0_beta x2 x0 x H16 x3 t4 H14) +(subst0_fst v3 x v2 i H17 t4 (Bind Abbr))))))) H15)) (H1 v0 x0 i H8 v3 H5))) +(\lambda (H14: (ex2 T (\lambda (w2: T).(pr0 x3 w2)) (\lambda (w2: T).(subst0 +(s (Bind Abst) (s (Flat Appl) i)) v3 t4 w2)))).(ex2_ind T (\lambda (w2: +T).(pr0 x3 w2)) (\lambda (w2: T).(subst0 (s (Bind Abst) (s (Flat Appl) i)) v3 +t4 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x2 x3)) (THead +(Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 +t4) w2)))) (\lambda (x: T).(\lambda (H15: (pr0 x3 x)).(\lambda (H16: (subst0 +(s (Bind Abst) (s (Flat Appl) i)) v3 t4 x)).(or_ind (pr0 x0 v2) (ex2 T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2))) (or (pr0 +(THead (Flat Appl) x0 (THead (Bind Abst) x2 x3)) (THead (Bind Abbr) v2 t4)) +(ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x2 x3)) +w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 t4) w2)))) (\lambda +(H17: (pr0 x0 v2)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) +x2 x3)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) x0 (THead (Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind Abbr) v2 t4) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) x0 (THead (Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind Abbr) v2 t4) w2)) (THead (Bind Abbr) v2 x) (pr0_beta x2 x0 v2 H17 x3 x +H15) (subst0_snd (Bind Abbr) v3 x t4 i H16 v2)))) (\lambda (H17: (ex2 T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 +v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) x2 x3)) (THead +(Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind Abbr) v2 +t4) w2)))) (\lambda (x4: T).(\lambda (H18: (pr0 x0 x4)).(\lambda (H19: +(subst0 i v3 v2 x4)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind Abst) +x2 x3)) (THead (Bind Abbr) v2 t4)) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) x0 (THead (Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind Abbr) v2 t4) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) x0 (THead (Bind Abst) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind Abbr) v2 t4) w2)) (THead (Bind Abbr) x4 x) (pr0_beta x2 x0 x4 H18 x3 x +H15) (subst0_both v3 v2 x4 i H19 (Bind Abbr) t4 x H16)))))) H17)) (H1 v0 x0 i +H8 v3 H5))))) H14)) (H3 v0 x3 (s (Bind Abst) (s (Flat Appl) i)) H13 v3 H5)) +x1 H11) w1 H7)))))) H10)) (subst0_gen_head (Bind Abst) v0 u t3 x1 (s (Flat +Appl) i) H9))))))) H6)) (subst0_gen_head (Flat Appl) v0 v1 (THead (Bind Abst) +u t3) w1 i H4))))))))))))))))) (\lambda (b: B).(\lambda (H0: (not (eq B b +Abst))).(\lambda (v1: T).(\lambda (v2: T).(\lambda (H1: (pr0 v1 v2)).(\lambda +(H2: ((\forall (v3: T).(\forall (w1: T).(\forall (i: nat).((subst0 i v3 v1 +w1) \to (\forall (v4: T).((pr0 v3 v4) \to (or (pr0 w1 v2) (ex2 T (\lambda +(w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v4 v2 w2)))))))))))).(\lambda +(u1: T).(\lambda (u2: T).(\lambda (H3: (pr0 u1 u2)).(\lambda (H4: ((\forall +(v3: T).(\forall (w1: T).(\forall (i: nat).((subst0 i v3 u1 w1) \to (\forall +(v4: T).((pr0 v3 v4) \to (or (pr0 w1 u2) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) +(\lambda (w2: T).(subst0 i v4 u2 w2)))))))))))).(\lambda (t3: T).(\lambda +(t4: T).(\lambda (H5: (pr0 t3 t4)).(\lambda (H6: ((\forall (v3: T).(\forall +(w1: T).(\forall (i: nat).((subst0 i v3 t3 w1) \to (\forall (v4: T).((pr0 v3 +v4) \to (or (pr0 w1 t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v4 t4 w2)))))))))))).(\lambda (v0: T).(\lambda (w1: T).(\lambda +(i: nat).(\lambda (H7: (subst0 i v0 (THead (Flat Appl) v1 (THead (Bind b) u1 +t3)) w1)).(\lambda (v3: T).(\lambda (H8: (pr0 v0 v3)).(or3_ind (ex2 T +(\lambda (u3: T).(eq T w1 (THead (Flat Appl) u3 (THead (Bind b) u1 t3)))) +(\lambda (u3: T).(subst0 i v0 v1 u3))) (ex2 T (\lambda (t5: T).(eq T w1 +(THead (Flat Appl) v1 t5))) (\lambda (t5: T).(subst0 (s (Flat Appl) i) v0 +(THead (Bind b) u1 t3) t5))) (ex3_2 T T (\lambda (u3: T).(\lambda (t5: T).(eq +T w1 (THead (Flat Appl) u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i +v0 v1 u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Flat Appl) i) v0 +(THead (Bind b) u1 t3) t5)))) (or (pr0 w1 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda +(w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4)) w2)))) (\lambda (H9: (ex2 T (\lambda (u3: T).(eq T w1 (THead (Flat Appl) +u3 (THead (Bind b) u1 t3)))) (\lambda (u3: T).(subst0 i v0 v1 u3)))).(ex2_ind +T (\lambda (u3: T).(eq T w1 (THead (Flat Appl) u3 (THead (Bind b) u1 t3)))) +(\lambda (u3: T).(subst0 i v0 v1 u3)) (or (pr0 w1 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (x: T).(\lambda (H10: (eq T w1 (THead (Flat +Appl) x (THead (Bind b) u1 t3)))).(\lambda (H11: (subst0 i v0 v1 +x)).(eq_ind_r T (THead (Flat Appl) x (THead (Bind b) u1 t3)) (\lambda (t: +T).(or (pr0 t (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) +(ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2))))) (or_ind (pr0 x +v2) (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 i v3 v2 +w2))) (or (pr0 (THead (Flat Appl) x (THead (Bind b) u1 t3)) (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x (THead (Bind b) u1 t3)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (H12: (pr0 x v2)).(or_introl (pr0 (THead (Flat Appl) x (THead (Bind +b) u1 t3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 +T (\lambda (w2: T).(pr0 (THead (Flat Appl) x (THead (Bind b) u1 t3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2))) (pr0_upsilon b H0 x v2 H12 u1 u2 H3 t3 t4 H5))) (\lambda +(H12: (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 i v3 v2 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 i v3 +v2 w2)) (or (pr0 (THead (Flat Appl) x (THead (Bind b) u1 t3)) (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x (THead (Bind b) u1 t3)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (x0: T).(\lambda (H13: (pr0 x x0)).(\lambda (H14: (subst0 i v3 v2 +x0)).(or_intror (pr0 (THead (Flat Appl) x (THead (Bind b) u1 t3)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x (THead (Bind b) u1 t3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x (THead (Bind b) +u1 t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O x0) t4)) (pr0_upsilon b H0 x x0 H13 u1 u2 H3 t3 t4 H5) (subst0_snd +(Bind b) v3 (THead (Flat Appl) (lift (S O) O x0) t4) (THead (Flat Appl) (lift +(S O) O v2) t4) i (subst0_fst v3 (lift (S O) O x0) (lift (S O) O v2) (s (Bind +b) i) (subst0_lift_ge_s v2 x0 v3 i H14 O (le_O_n i) b) t4 (Flat Appl)) +u2)))))) H12)) (H2 v0 x i H11 v3 H8)) w1 H10)))) H9)) (\lambda (H9: (ex2 T +(\lambda (t5: T).(eq T w1 (THead (Flat Appl) v1 t5))) (\lambda (t5: +T).(subst0 (s (Flat Appl) i) v0 (THead (Bind b) u1 t3) t5)))).(ex2_ind T +(\lambda (t5: T).(eq T w1 (THead (Flat Appl) v1 t5))) (\lambda (t5: +T).(subst0 (s (Flat Appl) i) v0 (THead (Bind b) u1 t3) t5)) (or (pr0 w1 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda +(w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (x: T).(\lambda (H10: (eq +T w1 (THead (Flat Appl) v1 x))).(\lambda (H11: (subst0 (s (Flat Appl) i) v0 +(THead (Bind b) u1 t3) x)).(or3_ind (ex2 T (\lambda (u3: T).(eq T x (THead +(Bind b) u3 t3))) (\lambda (u3: T).(subst0 (s (Flat Appl) i) v0 u1 u3))) (ex2 +T (\lambda (t5: T).(eq T x (THead (Bind b) u1 t5))) (\lambda (t5: T).(subst0 +(s (Bind b) (s (Flat Appl) i)) v0 t3 t5))) (ex3_2 T T (\lambda (u3: +T).(\lambda (t5: T).(eq T x (THead (Bind b) u3 t5)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 (s (Flat Appl) i) v0 u1 u3))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s (Bind b) (s (Flat Appl) i)) v0 t3 t5)))) (or +(pr0 w1 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H12: (ex2 T +(\lambda (u3: T).(eq T x (THead (Bind b) u3 t3))) (\lambda (u3: T).(subst0 (s +(Flat Appl) i) v0 u1 u3)))).(ex2_ind T (\lambda (u3: T).(eq T x (THead (Bind +b) u3 t3))) (\lambda (u3: T).(subst0 (s (Flat Appl) i) v0 u1 u3)) (or (pr0 w1 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda +(w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (x0: T).(\lambda (H13: (eq +T x (THead (Bind b) x0 t3))).(\lambda (H14: (subst0 (s (Flat Appl) i) v0 u1 +x0)).(eq_ind_r T (THead (Flat Appl) v1 x) (\lambda (t: T).(or (pr0 t (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2))))) (eq_ind_r T (THead (Bind b) x0 t3) +(\lambda (t: T).(or (pr0 (THead (Flat Appl) v1 t) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) v1 t) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) w2))))) (or_ind (pr0 x0 u2) (ex2 T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 (s (Flat Appl) i) v3 +u2 w2))) (or (pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 t3)) (THead (Bind +b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) v1 (THead (Bind b) x0 t3)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (H15: (pr0 x0 u2)).(or_introl (pr0 (THead (Flat Appl) v1 (THead +(Bind b) x0 t3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 +t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) w2))) (pr0_upsilon b H0 v1 v2 H1 x0 u2 H15 t3 t4 H5))) +(\lambda (H15: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 +(s (Flat Appl) i) v3 u2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) +(\lambda (w2: T).(subst0 (s (Flat Appl) i) v3 u2 w2)) (or (pr0 (THead (Flat +Appl) v1 (THead (Bind b) x0 t3)) (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead +(Bind b) x0 t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (x1: T).(\lambda (H16: +(pr0 x0 x1)).(\lambda (H17: (subst0 (s (Flat Appl) i) v3 u2 x1)).(or_intror +(pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 t3)) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) v1 (THead (Bind b) x0 t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 t3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)) (THead (Bind b) x1 (THead (Flat Appl) (lift (S O) O v2) +t4)) (pr0_upsilon b H0 v1 v2 H1 x0 x1 H16 t3 t4 H5) (subst0_fst v3 x1 u2 i +H17 (THead (Flat Appl) (lift (S O) O v2) t4) (Bind b))))))) H15)) (H4 v0 x0 +(s (Flat Appl) i) H14 v3 H8)) x H13) w1 H10)))) H12)) (\lambda (H12: (ex2 T +(\lambda (t5: T).(eq T x (THead (Bind b) u1 t5))) (\lambda (t5: T).(subst0 (s +(Bind b) (s (Flat Appl) i)) v0 t3 t5)))).(ex2_ind T (\lambda (t5: T).(eq T x +(THead (Bind b) u1 t5))) (\lambda (t5: T).(subst0 (s (Bind b) (s (Flat Appl) +i)) v0 t3 t5)) (or (pr0 w1 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) +O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (x0: T).(\lambda (H13: (eq T x (THead (Bind b) u1 x0))).(\lambda +(H14: (subst0 (s (Bind b) (s (Flat Appl) i)) v0 t3 x0)).(eq_ind_r T (THead +(Flat Appl) v1 x) (\lambda (t: T).(or (pr0 t (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda +(w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4)) w2))))) (eq_ind_r T (THead (Bind b) u1 x0) (\lambda (t: T).(or (pr0 +(THead (Flat Appl) v1 t) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 t) w2)) (\lambda +(w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4)) w2))))) (or_ind (pr0 x0 t4) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) +(\lambda (w2: T).(subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 w2))) (or (pr0 +(THead (Flat Appl) v1 (THead (Bind b) u1 x0)) (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) +v1 (THead (Bind b) u1 x0)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H15: (pr0 x0 +t4)).(or_introl (pr0 (THead (Flat Appl) v1 (THead (Bind b) u1 x0)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) v1 (THead (Bind b) u1 x0)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (pr0_upsilon b H0 v1 v2 H1 u1 u2 H3 x0 t4 H15))) (\lambda (H15: (ex2 T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 (s (Bind b) (s (Flat +Appl) i)) v3 t4 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 w2)) (or (pr0 (THead (Flat +Appl) v1 (THead (Bind b) u1 x0)) (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead +(Bind b) u1 x0)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (x1: T).(\lambda (H16: +(pr0 x0 x1)).(\lambda (H17: (subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 +x1)).(or_intror (pr0 (THead (Flat Appl) v1 (THead (Bind b) u1 x0)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) v1 (THead (Bind b) u1 x0)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind +b) u1 x0)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) x1)) (pr0_upsilon b H0 v1 v2 H1 u1 u2 H3 x0 x1 H16) (subst0_snd +(Bind b) v3 (THead (Flat Appl) (lift (S O) O v2) x1) (THead (Flat Appl) (lift +(S O) O v2) t4) i (subst0_snd (Flat Appl) v3 x1 t4 (s (Bind b) i) H17 (lift +(S O) O v2)) u2)))))) H15)) (H6 v0 x0 (s (Bind b) (s (Flat Appl) i)) H14 v3 +H8)) x H13) w1 H10)))) H12)) (\lambda (H12: (ex3_2 T T (\lambda (u3: +T).(\lambda (t5: T).(eq T x (THead (Bind b) u3 t5)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 (s (Flat Appl) i) v0 u1 u3))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s (Bind b) (s (Flat Appl) i)) v0 t3 +t5))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t5: T).(eq T x (THead (Bind +b) u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 (s (Flat Appl) i) v0 u1 +u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Bind b) (s (Flat Appl) i)) +v0 t3 t5))) (or (pr0 w1 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4))) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v3 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda +(x0: T).(\lambda (x1: T).(\lambda (H13: (eq T x (THead (Bind b) x0 +x1))).(\lambda (H14: (subst0 (s (Flat Appl) i) v0 u1 x0)).(\lambda (H15: +(subst0 (s (Bind b) (s (Flat Appl) i)) v0 t3 x1)).(eq_ind_r T (THead (Flat +Appl) v1 x) (\lambda (t: T).(or (pr0 t (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))))) (eq_ind_r T (THead (Bind b) x0 x1) (\lambda (t: T).(or (pr0 (THead +(Flat Appl) v1 t) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 t) w2)) (\lambda +(w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4)) w2))))) (or_ind (pr0 x1 t4) (ex2 T (\lambda (w2: T).(pr0 x1 w2)) +(\lambda (w2: T).(subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 w2))) (or (pr0 +(THead (Flat Appl) v1 (THead (Bind b) x0 x1)) (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) +v1 (THead (Bind b) x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H16: (pr0 x1 +t4)).(or_ind (pr0 x0 u2) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 (s (Flat Appl) i) v3 u2 w2))) (or (pr0 (THead (Flat Appl) v1 +(THead (Bind b) x0 x1)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind b) +x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H17: (pr0 x0 u2)).(or_introl +(pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 x1)) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) v1 (THead (Bind b) x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2))) (pr0_upsilon b H0 +v1 v2 H1 x0 u2 H17 x1 t4 H16))) (\lambda (H17: (ex2 T (\lambda (w2: T).(pr0 +x0 w2)) (\lambda (w2: T).(subst0 (s (Flat Appl) i) v3 u2 w2)))).(ex2_ind T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 (s (Flat Appl) i) v3 +u2 w2)) (or (pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 x1)) (THead (Bind +b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) v1 (THead (Bind b) x0 x1)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (x2: T).(\lambda (H18: (pr0 x0 x2)).(\lambda (H19: (subst0 (s (Flat +Appl) i) v3 u2 x2)).(or_intror (pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 +x1)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 x1)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 +(THead (Bind b) x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) x2 (THead +(Flat Appl) (lift (S O) O v2) t4)) (pr0_upsilon b H0 v1 v2 H1 x0 x2 H18 x1 t4 +H16) (subst0_fst v3 x2 u2 i H19 (THead (Flat Appl) (lift (S O) O v2) t4) +(Bind b))))))) H17)) (H4 v0 x0 (s (Flat Appl) i) H14 v3 H8))) (\lambda (H16: +(ex2 T (\lambda (w2: T).(pr0 x1 w2)) (\lambda (w2: T).(subst0 (s (Bind b) (s +(Flat Appl) i)) v3 t4 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x1 w2)) +(\lambda (w2: T).(subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 w2)) (or (pr0 +(THead (Flat Appl) v1 (THead (Bind b) x0 x1)) (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) +v1 (THead (Bind b) x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (x2: T).(\lambda +(H17: (pr0 x1 x2)).(\lambda (H18: (subst0 (s (Bind b) (s (Flat Appl) i)) v3 +t4 x2)).(or_ind (pr0 x0 u2) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda +(w2: T).(subst0 (s (Flat Appl) i) v3 u2 w2))) (or (pr0 (THead (Flat Appl) v1 +(THead (Bind b) x0 x1)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind b) +x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H19: (pr0 x0 u2)).(or_intror +(pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 x1)) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) v1 (THead (Bind b) x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 x1)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +x2)) (pr0_upsilon b H0 v1 v2 H1 x0 u2 H19 x1 x2 H17) (subst0_snd (Bind b) v3 +(THead (Flat Appl) (lift (S O) O v2) x2) (THead (Flat Appl) (lift (S O) O v2) +t4) i (subst0_snd (Flat Appl) v3 x2 t4 (s (Bind b) i) H18 (lift (S O) O v2)) +u2)))) (\lambda (H19: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 (s (Flat Appl) i) v3 u2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 +w2)) (\lambda (w2: T).(subst0 (s (Flat Appl) i) v3 u2 w2)) (or (pr0 (THead +(Flat Appl) v1 (THead (Bind b) x0 x1)) (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 +(THead (Bind b) x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (x3: T).(\lambda +(H20: (pr0 x0 x3)).(\lambda (H21: (subst0 (s (Flat Appl) i) v3 u2 +x3)).(or_intror (pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 x1)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) v1 (THead (Bind b) x0 x1)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) v1 (THead (Bind +b) x0 x1)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) x3 (THead (Flat Appl) (lift +(S O) O v2) x2)) (pr0_upsilon b H0 v1 v2 H1 x0 x3 H20 x1 x2 H17) (subst0_both +v3 u2 x3 i H21 (Bind b) (THead (Flat Appl) (lift (S O) O v2) t4) (THead (Flat +Appl) (lift (S O) O v2) x2) (subst0_snd (Flat Appl) v3 x2 t4 (s (Bind b) i) +H18 (lift (S O) O v2)))))))) H19)) (H4 v0 x0 (s (Flat Appl) i) H14 v3 H8))))) +H16)) (H6 v0 x1 (s (Bind b) (s (Flat Appl) i)) H15 v3 H8)) x H13) w1 +H10)))))) H12)) (subst0_gen_head (Bind b) v0 u1 t3 x (s (Flat Appl) i) +H11))))) H9)) (\lambda (H9: (ex3_2 T T (\lambda (u3: T).(\lambda (t5: T).(eq +T w1 (THead (Flat Appl) u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i +v0 v1 u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Flat Appl) i) v0 +(THead (Bind b) u1 t3) t5))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t5: +T).(eq T w1 (THead (Flat Appl) u3 t5)))) (\lambda (u3: T).(\lambda (_: +T).(subst0 i v0 v1 u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Flat +Appl) i) v0 (THead (Bind b) u1 t3) t5))) (or (pr0 w1 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 w1 +w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) w2)))) (\lambda (x0: T).(\lambda (x1: T).(\lambda +(H10: (eq T w1 (THead (Flat Appl) x0 x1))).(\lambda (H11: (subst0 i v0 v1 +x0)).(\lambda (H12: (subst0 (s (Flat Appl) i) v0 (THead (Bind b) u1 t3) +x1)).(or3_ind (ex2 T (\lambda (u3: T).(eq T x1 (THead (Bind b) u3 t3))) +(\lambda (u3: T).(subst0 (s (Flat Appl) i) v0 u1 u3))) (ex2 T (\lambda (t5: +T).(eq T x1 (THead (Bind b) u1 t5))) (\lambda (t5: T).(subst0 (s (Bind b) (s +(Flat Appl) i)) v0 t3 t5))) (ex3_2 T T (\lambda (u3: T).(\lambda (t5: T).(eq +T x1 (THead (Bind b) u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 (s +(Flat Appl) i) v0 u1 u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Bind +b) (s (Flat Appl) i)) v0 t3 t5)))) (or (pr0 w1 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (H13: (ex2 T (\lambda (u3: T).(eq T x1 (THead +(Bind b) u3 t3))) (\lambda (u3: T).(subst0 (s (Flat Appl) i) v0 u1 +u3)))).(ex2_ind T (\lambda (u3: T).(eq T x1 (THead (Bind b) u3 t3))) (\lambda +(u3: T).(subst0 (s (Flat Appl) i) v0 u1 u3)) (or (pr0 w1 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 w1 +w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) w2)))) (\lambda (x: T).(\lambda (H14: (eq T x1 (THead +(Bind b) x t3))).(\lambda (H15: (subst0 (s (Flat Appl) i) v0 u1 x)).(eq_ind_r +T (THead (Flat Appl) x0 x1) (\lambda (t: T).(or (pr0 t (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 t +w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) w2))))) (eq_ind_r T (THead (Bind b) x t3) (\lambda (t: +T).(or (pr0 (THead (Flat Appl) x0 t) (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 t) +w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) w2))))) (or_ind (pr0 x u2) (ex2 T (\lambda (w2: +T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s (Flat Appl) i) v3 u2 w2))) (or +(pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) x0 (THead (Bind b) x t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H16: +(pr0 x u2)).(or_ind (pr0 x0 v2) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda +(w2: T).(subst0 i v3 v2 w2))) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) +x t3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (H17: (pr0 x0 v2)).(or_introl (pr0 (THead (Flat +Appl) x0 (THead (Bind b) x t3)) (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind b) x t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) w2))) (pr0_upsilon b H0 x0 v2 H17 x u2 H16 +t3 t4 H5))) (\lambda (H17: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 i v3 v2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda +(w2: T).(subst0 i v3 v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) x +t3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (x2: T).(\lambda (H18: (pr0 x0 x2)).(\lambda +(H19: (subst0 i v3 v2 x2)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind +b) x t3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 +T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind b) x t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O x2) t4)) (pr0_upsilon b H0 x0 x2 H18 x u2 H16 t3 t4 +H5) (subst0_snd (Bind b) v3 (THead (Flat Appl) (lift (S O) O x2) t4) (THead +(Flat Appl) (lift (S O) O v2) t4) i (subst0_fst v3 (lift (S O) O x2) (lift (S +O) O v2) (s (Bind b) i) (subst0_lift_ge_s v2 x2 v3 i H19 O (le_O_n i) b) t4 +(Flat Appl)) u2)))))) H17)) (H2 v0 x0 i H11 v3 H8))) (\lambda (H16: (ex2 T +(\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s (Flat Appl) i) v3 u2 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s +(Flat Appl) i) v3 u2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) x +t3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (x2: T).(\lambda (H17: (pr0 x x2)).(\lambda +(H18: (subst0 (s (Flat Appl) i) v3 u2 x2)).(or_ind (pr0 x0 v2) (ex2 T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2))) (or (pr0 +(THead (Flat Appl) x0 (THead (Bind b) x t3)) (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) +x0 (THead (Bind b) x t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H19: (pr0 x0 +v2)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind +b) x t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) x2 (THead (Flat Appl) (lift +(S O) O v2) t4)) (pr0_upsilon b H0 x0 v2 H19 x x2 H17 t3 t4 H5) (subst0_fst +v3 x2 u2 i H18 (THead (Flat Appl) (lift (S O) O v2) t4) (Bind b))))) (\lambda +(H19: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 +v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 (THead (Bind b) x t3)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (x3: T).(\lambda (H20: (pr0 x0 x3)).(\lambda (H21: (subst0 i v3 v2 +x3)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x t3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind +b) x t3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) x2 (THead (Flat Appl) (lift +(S O) O x3) t4)) (pr0_upsilon b H0 x0 x3 H20 x x2 H17 t3 t4 H5) (subst0_both +v3 u2 x2 i H18 (Bind b) (THead (Flat Appl) (lift (S O) O v2) t4) (THead (Flat +Appl) (lift (S O) O x3) t4) (subst0_fst v3 (lift (S O) O x3) (lift (S O) O +v2) (s (Bind b) i) (subst0_lift_ge_s v2 x3 v3 i H21 O (le_O_n i) b) t4 (Flat +Appl)))))))) H19)) (H2 v0 x0 i H11 v3 H8))))) H16)) (H4 v0 x (s (Flat Appl) +i) H15 v3 H8)) x1 H14) w1 H10)))) H13)) (\lambda (H13: (ex2 T (\lambda (t5: +T).(eq T x1 (THead (Bind b) u1 t5))) (\lambda (t5: T).(subst0 (s (Bind b) (s +(Flat Appl) i)) v0 t3 t5)))).(ex2_ind T (\lambda (t5: T).(eq T x1 (THead +(Bind b) u1 t5))) (\lambda (t5: T).(subst0 (s (Bind b) (s (Flat Appl) i)) v0 +t3 t5)) (or (pr0 w1 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4))) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v3 +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda +(x: T).(\lambda (H14: (eq T x1 (THead (Bind b) u1 x))).(\lambda (H15: (subst0 +(s (Bind b) (s (Flat Appl) i)) v0 t3 x)).(eq_ind_r T (THead (Flat Appl) x0 +x1) (\lambda (t: T).(or (pr0 t (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2))))) +(eq_ind_r T (THead (Bind b) u1 x) (\lambda (t: T).(or (pr0 (THead (Flat Appl) +x0 t) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 t) w2)) (\lambda (w2: T).(subst0 +i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2))))) +(or_ind (pr0 x t4) (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: +T).(subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 w2))) (or (pr0 (THead (Flat +Appl) x0 (THead (Bind b) u1 x)) (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind b) u1 x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H16: (pr0 x t4)).(or_ind +(pr0 x0 v2) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i +v3 v2 w2))) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) u1 x)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) u1 x)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2)))) (\lambda (H17: (pr0 x0 v2)).(or_introl (pr0 (THead (Flat Appl) x0 +(THead (Bind b) u1 x)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) +u1 x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2))) (pr0_upsilon b H0 x0 v2 H17 u1 u2 H3 x t4 +H16))) (\lambda (H17: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 i v3 v2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda +(w2: T).(subst0 i v3 v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) +u1 x)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) u1 x)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (x2: T).(\lambda (H18: (pr0 x0 x2)).(\lambda +(H19: (subst0 i v3 v2 x2)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind +b) u1 x)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 +T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) u1 x)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind b) u1 x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O x2) t4)) (pr0_upsilon b H0 x0 x2 H18 u1 u2 H3 x t4 +H16) (subst0_snd (Bind b) v3 (THead (Flat Appl) (lift (S O) O x2) t4) (THead +(Flat Appl) (lift (S O) O v2) t4) i (subst0_fst v3 (lift (S O) O x2) (lift (S +O) O v2) (s (Bind b) i) (subst0_lift_ge_s v2 x2 v3 i H19 O (le_O_n i) b) t4 +(Flat Appl)) u2)))))) H17)) (H2 v0 x0 i H11 v3 H8))) (\lambda (H16: (ex2 T +(\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s (Bind b) (s (Flat +Appl) i)) v3 t4 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: +T).(subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 w2)) (or (pr0 (THead (Flat +Appl) x0 (THead (Bind b) u1 x)) (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind b) u1 x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (x2: T).(\lambda (H17: +(pr0 x x2)).(\lambda (H18: (subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 +x2)).(or_ind (pr0 x0 v2) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 i v3 v2 w2))) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) u1 +x)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) u1 x)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (H19: (pr0 x0 v2)).(or_intror (pr0 (THead (Flat +Appl) x0 (THead (Bind b) u1 x)) (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead +(Bind b) u1 x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4)) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 (THead (Bind b) u1 x)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) x2)) (pr0_upsilon b H0 x0 v2 +H19 u1 u2 H3 x x2 H17) (subst0_snd (Bind b) v3 (THead (Flat Appl) (lift (S O) +O v2) x2) (THead (Flat Appl) (lift (S O) O v2) t4) i (subst0_snd (Flat Appl) +v3 x2 t4 (s (Bind b) i) H18 (lift (S O) O v2)) u2)))) (\lambda (H19: (ex2 T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 +v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) u1 x)) (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 (THead (Bind b) u1 x)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (x3: T).(\lambda (H20: (pr0 x0 x3)).(\lambda (H21: (subst0 i v3 v2 +x3)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind b) u1 x)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) u1 x)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind +b) u1 x)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O x3) x2)) (pr0_upsilon b H0 x0 x3 H20 u1 u2 H3 x x2 H17) (subst0_snd +(Bind b) v3 (THead (Flat Appl) (lift (S O) O x3) x2) (THead (Flat Appl) (lift +(S O) O v2) t4) i (subst0_both v3 (lift (S O) O v2) (lift (S O) O x3) (s +(Bind b) i) (subst0_lift_ge_s v2 x3 v3 i H21 O (le_O_n i) b) (Flat Appl) t4 +x2 H18) u2)))))) H19)) (H2 v0 x0 i H11 v3 H8))))) H16)) (H6 v0 x (s (Bind b) +(s (Flat Appl) i)) H15 v3 H8)) x1 H14) w1 H10)))) H13)) (\lambda (H13: (ex3_2 +T T (\lambda (u3: T).(\lambda (t5: T).(eq T x1 (THead (Bind b) u3 t5)))) +(\lambda (u3: T).(\lambda (_: T).(subst0 (s (Flat Appl) i) v0 u1 u3))) +(\lambda (_: T).(\lambda (t5: T).(subst0 (s (Bind b) (s (Flat Appl) i)) v0 t3 +t5))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t5: T).(eq T x1 (THead +(Bind b) u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 (s (Flat Appl) i) +v0 u1 u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Bind b) (s (Flat +Appl) i)) v0 t3 t5))) (or (pr0 w1 (THead (Bind b) u2 (THead (Flat Appl) (lift +(S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2)))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H14: (eq T x1 (THead (Bind +b) x2 x3))).(\lambda (H15: (subst0 (s (Flat Appl) i) v0 u1 x2)).(\lambda +(H16: (subst0 (s (Bind b) (s (Flat Appl) i)) v0 t3 x3)).(eq_ind_r T (THead +(Flat Appl) x0 x1) (\lambda (t: T).(or (pr0 t (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda +(w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4)) w2))))) (eq_ind_r T (THead (Bind b) x2 x3) (\lambda (t: T).(or (pr0 +(THead (Flat Appl) x0 t) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 t) w2)) (\lambda +(w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4)) w2))))) (or_ind (pr0 x3 t4) (ex2 T (\lambda (w2: T).(pr0 x3 w2)) +(\lambda (w2: T).(subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 w2))) (or (pr0 +(THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) +x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H17: (pr0 x3 +t4)).(or_ind (pr0 x2 u2) (ex2 T (\lambda (w2: T).(pr0 x2 w2)) (\lambda (w2: +T).(subst0 (s (Flat Appl) i) v3 u2 w2))) (or (pr0 (THead (Flat Appl) x0 +(THead (Bind b) x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) +x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H18: (pr0 x2 u2)).(or_ind (pr0 +x0 v2) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 +w2))) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (H19: (pr0 x0 v2)).(or_introl (pr0 (THead (Flat Appl) x0 (THead +(Bind b) x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 +x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) w2))) (pr0_upsilon b H0 x0 v2 H19 x2 u2 H18 x3 t4 +H17))) (\lambda (H19: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 i v3 v2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda +(w2: T).(subst0 i v3 v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) +x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (x: T).(\lambda (H20: (pr0 x0 x)).(\lambda +(H21: (subst0 i v3 v2 x)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind +b) x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 +T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O x) t4)) (pr0_upsilon b H0 x0 x H20 x2 u2 H18 x3 t4 +H17) (subst0_snd (Bind b) v3 (THead (Flat Appl) (lift (S O) O x) t4) (THead +(Flat Appl) (lift (S O) O v2) t4) i (subst0_fst v3 (lift (S O) O x) (lift (S +O) O v2) (s (Bind b) i) (subst0_lift_ge_s v2 x v3 i H21 O (le_O_n i) b) t4 +(Flat Appl)) u2)))))) H19)) (H2 v0 x0 i H11 v3 H8))) (\lambda (H18: (ex2 T +(\lambda (w2: T).(pr0 x2 w2)) (\lambda (w2: T).(subst0 (s (Flat Appl) i) v3 +u2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x2 w2)) (\lambda (w2: T).(subst0 +(s (Flat Appl) i) v3 u2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) +x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (x: T).(\lambda (H19: (pr0 x2 x)).(\lambda +(H20: (subst0 (s (Flat Appl) i) v3 u2 x)).(or_ind (pr0 x0 v2) (ex2 T (\lambda +(w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2))) (or (pr0 (THead +(Flat Appl) x0 (THead (Bind b) x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H21: (pr0 x0 +v2)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind +b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) x (THead (Flat Appl) (lift +(S O) O v2) t4)) (pr0_upsilon b H0 x0 v2 H21 x2 x H19 x3 t4 H17) (subst0_fst +v3 x u2 i H20 (THead (Flat Appl) (lift (S O) O v2) t4) (Bind b))))) (\lambda +(H21: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 +v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead (Bind +b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (x4: T).(\lambda (H22: (pr0 x0 x4)).(\lambda (H23: (subst0 i v3 v2 +x4)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind +b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) x (THead (Flat Appl) (lift +(S O) O x4) t4)) (pr0_upsilon b H0 x0 x4 H22 x2 x H19 x3 t4 H17) (subst0_both +v3 u2 x i H20 (Bind b) (THead (Flat Appl) (lift (S O) O v2) t4) (THead (Flat +Appl) (lift (S O) O x4) t4) (subst0_fst v3 (lift (S O) O x4) (lift (S O) O +v2) (s (Bind b) i) (subst0_lift_ge_s v2 x4 v3 i H23 O (le_O_n i) b) t4 (Flat +Appl)))))))) H21)) (H2 v0 x0 i H11 v3 H8))))) H18)) (H4 v0 x2 (s (Flat Appl) +i) H15 v3 H8))) (\lambda (H17: (ex2 T (\lambda (w2: T).(pr0 x3 w2)) (\lambda +(w2: T).(subst0 (s (Bind b) (s (Flat Appl) i)) v3 t4 w2)))).(ex2_ind T +(\lambda (w2: T).(pr0 x3 w2)) (\lambda (w2: T).(subst0 (s (Bind b) (s (Flat +Appl) i)) v3 t4 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda +(w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2)))) (\lambda (x: T).(\lambda (H18: (pr0 x3 x)).(\lambda (H19: (subst0 (s +(Bind b) (s (Flat Appl) i)) v3 t4 x)).(or_ind (pr0 x2 u2) (ex2 T (\lambda +(w2: T).(pr0 x2 w2)) (\lambda (w2: T).(subst0 (s (Flat Appl) i) v3 u2 w2))) +(or (pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (H20: (pr0 x2 u2)).(or_ind (pr0 x0 v2) (ex2 T (\lambda (w2: T).(pr0 +x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2))) (or (pr0 (THead (Flat Appl) x0 +(THead (Bind b) x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) +x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)))) (\lambda (H21: (pr0 x0 v2)).(or_intror +(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +x)) (pr0_upsilon b H0 x0 v2 H21 x2 u2 H20 x3 x H18) (subst0_snd (Bind b) v3 +(THead (Flat Appl) (lift (S O) O v2) x) (THead (Flat Appl) (lift (S O) O v2) +t4) i (subst0_snd (Flat Appl) v3 x t4 (s (Bind b) i) H19 (lift (S O) O v2)) +u2)))) (\lambda (H21: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 i v3 v2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda +(w2: T).(subst0 i v3 v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) +x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T +(\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2)))) (\lambda (x4: T).(\lambda (H22: (pr0 x0 x4)).(\lambda +(H23: (subst0 i v3 v2 x4)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind +b) x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 +T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) +(\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 +(THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) u2 (THead +(Flat Appl) (lift (S O) O x4) x)) (pr0_upsilon b H0 x0 x4 H22 x2 u2 H20 x3 x +H18) (subst0_snd (Bind b) v3 (THead (Flat Appl) (lift (S O) O x4) x) (THead +(Flat Appl) (lift (S O) O v2) t4) i (subst0_both v3 (lift (S O) O v2) (lift +(S O) O x4) (s (Bind b) i) (subst0_lift_ge_s v2 x4 v3 i H23 O (le_O_n i) b) +(Flat Appl) t4 x H19) u2)))))) H21)) (H2 v0 x0 i H11 v3 H8))) (\lambda (H20: +(ex2 T (\lambda (w2: T).(pr0 x2 w2)) (\lambda (w2: T).(subst0 (s (Flat Appl) +i) v3 u2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x2 w2)) (\lambda (w2: +T).(subst0 (s (Flat Appl) i) v3 u2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead +(Bind b) x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 +x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) w2)))) (\lambda (x4: T).(\lambda (H21: (pr0 x2 +x4)).(\lambda (H22: (subst0 (s (Flat Appl) i) v3 u2 x4)).(or_ind (pr0 x0 v2) +(ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 w2))) +(or (pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (H23: (pr0 x0 v2)).(or_intror (pr0 (THead (Flat Appl) x0 (THead +(Bind b) x2 x3)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t4))) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 +x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat +Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) x4 +(THead (Flat Appl) (lift (S O) O v2) x)) (pr0_upsilon b H0 x0 v2 H23 x2 x4 +H21 x3 x H18) (subst0_both v3 u2 x4 i H22 (Bind b) (THead (Flat Appl) (lift +(S O) O v2) t4) (THead (Flat Appl) (lift (S O) O v2) x) (subst0_snd (Flat +Appl) v3 x t4 (s (Bind b) i) H19 (lift (S O) O v2)))))) (\lambda (H23: (ex2 T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 v2 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v3 +v2 w2)) (or (pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead (Bind +b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i +v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) w2)))) +(\lambda (x5: T).(\lambda (H24: (pr0 x0 x5)).(\lambda (H25: (subst0 i v3 v2 +x5)).(or_intror (pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4))) (ex2 T (\lambda (w2: +T).(pr0 (THead (Flat Appl) x0 (THead (Bind b) x2 x3)) w2)) (\lambda (w2: +T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) +w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Appl) x0 (THead (Bind +b) x2 x3)) w2)) (\lambda (w2: T).(subst0 i v3 (THead (Bind b) u2 (THead (Flat +Appl) (lift (S O) O v2) t4)) w2)) (THead (Bind b) x4 (THead (Flat Appl) (lift +(S O) O x5) x)) (pr0_upsilon b H0 x0 x5 H24 x2 x4 H21 x3 x H18) (subst0_both +v3 u2 x4 i H22 (Bind b) (THead (Flat Appl) (lift (S O) O v2) t4) (THead (Flat +Appl) (lift (S O) O x5) x) (subst0_both v3 (lift (S O) O v2) (lift (S O) O +x5) (s (Bind b) i) (subst0_lift_ge_s v2 x5 v3 i H25 O (le_O_n i) b) (Flat +Appl) t4 x H19))))))) H23)) (H2 v0 x0 i H11 v3 H8))))) H20)) (H4 v0 x2 (s +(Flat Appl) i) H15 v3 H8))))) H17)) (H6 v0 x3 (s (Bind b) (s (Flat Appl) i)) +H16 v3 H8)) x1 H14) w1 H10)))))) H13)) (subst0_gen_head (Bind b) v0 u1 t3 x1 +(s (Flat Appl) i) H12))))))) H9)) (subst0_gen_head (Flat Appl) v0 v1 (THead +(Bind b) u1 t3) w1 i H7)))))))))))))))))))))) (\lambda (u1: T).(\lambda (u2: +T).(\lambda (H0: (pr0 u1 u2)).(\lambda (H1: ((\forall (v1: T).(\forall (w1: +T).(\forall (i: nat).((subst0 i v1 u1 w1) \to (\forall (v2: T).((pr0 v1 v2) +\to (or (pr0 w1 u2) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v2 u2 w2)))))))))))).(\lambda (t3: T).(\lambda (t4: T).(\lambda +(H2: (pr0 t3 t4)).(\lambda (H3: ((\forall (v1: T).(\forall (w1: T).(\forall +(i: nat).((subst0 i v1 t3 w1) \to (\forall (v2: T).((pr0 v1 v2) \to (or (pr0 +w1 t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 t4 +w2)))))))))))).(\lambda (w: T).(\lambda (H4: (subst0 O u2 t4 w)).(\lambda +(v1: T).(\lambda (w1: T).(\lambda (i: nat).(\lambda (H5: (subst0 i v1 (THead +(Bind Abbr) u1 t3) w1)).(\lambda (v2: T).(\lambda (H6: (pr0 v1 v2)).(or3_ind +(ex2 T (\lambda (u3: T).(eq T w1 (THead (Bind Abbr) u3 t3))) (\lambda (u3: +T).(subst0 i v1 u1 u3))) (ex2 T (\lambda (t5: T).(eq T w1 (THead (Bind Abbr) +u1 t5))) (\lambda (t5: T).(subst0 (s (Bind Abbr) i) v1 t3 t5))) (ex3_2 T T +(\lambda (u3: T).(\lambda (t5: T).(eq T w1 (THead (Bind Abbr) u3 t5)))) +(\lambda (u3: T).(\lambda (_: T).(subst0 i v1 u1 u3))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s (Bind Abbr) i) v1 t3 t5)))) (or (pr0 w1 (THead +(Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (H7: (ex2 T (\lambda +(u3: T).(eq T w1 (THead (Bind Abbr) u3 t3))) (\lambda (u3: T).(subst0 i v1 u1 +u3)))).(ex2_ind T (\lambda (u3: T).(eq T w1 (THead (Bind Abbr) u3 t3))) +(\lambda (u3: T).(subst0 i v1 u1 u3)) (or (pr0 w1 (THead (Bind Abbr) u2 w)) +(ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 (THead +(Bind Abbr) u2 w) w2)))) (\lambda (x: T).(\lambda (H8: (eq T w1 (THead (Bind +Abbr) x t3))).(\lambda (H9: (subst0 i v1 u1 x)).(eq_ind_r T (THead (Bind +Abbr) x t3) (\lambda (t: T).(or (pr0 t (THead (Bind Abbr) u2 w)) (ex2 T +(\lambda (w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) +u2 w) w2))))) (or_ind (pr0 x u2) (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda +(w2: T).(subst0 i v2 u2 w2))) (or (pr0 (THead (Bind Abbr) x t3) (THead (Bind +Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x t3) w2)) +(\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (H10: +(pr0 x u2)).(or_introl (pr0 (THead (Bind Abbr) x t3) (THead (Bind Abbr) u2 +w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x t3) w2)) (\lambda (w2: +T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2))) (pr0_delta x u2 H10 t3 t4 H2 w +H4))) (\lambda (H10: (ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: +T).(subst0 i v2 u2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x w2)) (\lambda +(w2: T).(subst0 i v2 u2 w2)) (or (pr0 (THead (Bind Abbr) x t3) (THead (Bind +Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x t3) w2)) +(\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (x0: +T).(\lambda (H11: (pr0 x x0)).(\lambda (H12: (subst0 i v2 u2 x0)).(ex2_ind T +(\lambda (t: T).(subst0 O x0 t4 t)) (\lambda (t: T).(subst0 (S (plus i O)) v2 +w t)) (or (pr0 (THead (Bind Abbr) x t3) (THead (Bind Abbr) u2 w)) (ex2 T +(\lambda (w2: T).(pr0 (THead (Bind Abbr) x t3) w2)) (\lambda (w2: T).(subst0 +i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (x1: T).(\lambda (H13: (subst0 +O x0 t4 x1)).(\lambda (H14: (subst0 (S (plus i O)) v2 w x1)).(let H15 \def +(f_equal nat nat S (plus i O) i (sym_eq nat i (plus i O) (plus_n_O i))) in +(let H16 \def (eq_ind nat (S (plus i O)) (\lambda (n: nat).(subst0 n v2 w +x1)) H14 (S i) H15) in (or_intror (pr0 (THead (Bind Abbr) x t3) (THead (Bind +Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x t3) w2)) +(\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead (Bind Abbr) x t3) w2)) (\lambda (w2: T).(subst0 +i v2 (THead (Bind Abbr) u2 w) w2)) (THead (Bind Abbr) x0 x1) (pr0_delta x x0 +H11 t3 t4 H2 x1 H13) (subst0_both v2 u2 x0 i H12 (Bind Abbr) w x1 H16)))))))) +(subst0_subst0_back t4 w u2 O H4 x0 v2 i H12))))) H10)) (H1 v1 x i H9 v2 H6)) +w1 H8)))) H7)) (\lambda (H7: (ex2 T (\lambda (t5: T).(eq T w1 (THead (Bind +Abbr) u1 t5))) (\lambda (t5: T).(subst0 (s (Bind Abbr) i) v1 t3 +t5)))).(ex2_ind T (\lambda (t5: T).(eq T w1 (THead (Bind Abbr) u1 t5))) +(\lambda (t5: T).(subst0 (s (Bind Abbr) i) v1 t3 t5)) (or (pr0 w1 (THead +(Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (x: T).(\lambda (H8: +(eq T w1 (THead (Bind Abbr) u1 x))).(\lambda (H9: (subst0 (s (Bind Abbr) i) +v1 t3 x)).(eq_ind_r T (THead (Bind Abbr) u1 x) (\lambda (t: T).(or (pr0 t +(THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda (w2: +T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2))))) (or_ind (pr0 x t4) (ex2 T +(\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s (Bind Abbr) i) v2 t4 +w2))) (or (pr0 (THead (Bind Abbr) u1 x) (THead (Bind Abbr) u2 w)) (ex2 T +(\lambda (w2: T).(pr0 (THead (Bind Abbr) u1 x) w2)) (\lambda (w2: T).(subst0 +i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (H10: (pr0 x t4)).(or_introl +(pr0 (THead (Bind Abbr) u1 x) (THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: +T).(pr0 (THead (Bind Abbr) u1 x) w2)) (\lambda (w2: T).(subst0 i v2 (THead +(Bind Abbr) u2 w) w2))) (pr0_delta u1 u2 H0 x t4 H10 w H4))) (\lambda (H10: +(ex2 T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s (Bind Abbr) +i) v2 t4 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: +T).(subst0 (s (Bind Abbr) i) v2 t4 w2)) (or (pr0 (THead (Bind Abbr) u1 x) +(THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) u1 +x) w2)) (\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) +(\lambda (x0: T).(\lambda (H11: (pr0 x x0)).(\lambda (H12: (subst0 (s (Bind +Abbr) i) v2 t4 x0)).(ex2_ind T (\lambda (t: T).(subst0 O u2 x0 t)) (\lambda +(t: T).(subst0 (s (Bind Abbr) i) v2 w t)) (or (pr0 (THead (Bind Abbr) u1 x) +(THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) u1 +x) w2)) (\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) +(\lambda (x1: T).(\lambda (H13: (subst0 O u2 x0 x1)).(\lambda (H14: (subst0 +(s (Bind Abbr) i) v2 w x1)).(or_intror (pr0 (THead (Bind Abbr) u1 x) (THead +(Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) u1 x) w2)) +(\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead (Bind Abbr) u1 x) w2)) (\lambda (w2: T).(subst0 +i v2 (THead (Bind Abbr) u2 w) w2)) (THead (Bind Abbr) u2 x1) (pr0_delta u1 u2 +H0 x x0 H11 x1 H13) (subst0_snd (Bind Abbr) v2 x1 w i H14 u2)))))) +(subst0_confluence_neq t4 x0 v2 (s (Bind Abbr) i) H12 w u2 O H4 (sym_not_eq +nat O (S i) (O_S i))))))) H10)) (H3 v1 x (s (Bind Abbr) i) H9 v2 H6)) w1 +H8)))) H7)) (\lambda (H7: (ex3_2 T T (\lambda (u3: T).(\lambda (t5: T).(eq T +w1 (THead (Bind Abbr) u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i v1 +u1 u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Bind Abbr) i) v1 t3 +t5))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t5: T).(eq T w1 (THead +(Bind Abbr) u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i v1 u1 u3))) +(\lambda (_: T).(\lambda (t5: T).(subst0 (s (Bind Abbr) i) v1 t3 t5))) (or +(pr0 w1 (THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) +(\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H8: (eq T w1 (THead (Bind Abbr) x0 +x1))).(\lambda (H9: (subst0 i v1 u1 x0)).(\lambda (H10: (subst0 (s (Bind +Abbr) i) v1 t3 x1)).(eq_ind_r T (THead (Bind Abbr) x0 x1) (\lambda (t: T).(or +(pr0 t (THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda +(w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2))))) (or_ind (pr0 x1 t4) +(ex2 T (\lambda (w2: T).(pr0 x1 w2)) (\lambda (w2: T).(subst0 (s (Bind Abbr) +i) v2 t4 w2))) (or (pr0 (THead (Bind Abbr) x0 x1) (THead (Bind Abbr) u2 w)) +(ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: +T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (H11: (pr0 x1 +t4)).(or_ind (pr0 x0 u2) (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 i v2 u2 w2))) (or (pr0 (THead (Bind Abbr) x0 x1) (THead (Bind +Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) +(\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (H12: +(pr0 x0 u2)).(or_introl (pr0 (THead (Bind Abbr) x0 x1) (THead (Bind Abbr) u2 +w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: +T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2))) (pr0_delta x0 u2 H12 x1 t4 H11 +w H4))) (\lambda (H12: (ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: +T).(subst0 i v2 u2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda +(w2: T).(subst0 i v2 u2 w2)) (or (pr0 (THead (Bind Abbr) x0 x1) (THead (Bind +Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) +(\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (x: +T).(\lambda (H13: (pr0 x0 x)).(\lambda (H14: (subst0 i v2 u2 x)).(ex2_ind T +(\lambda (t: T).(subst0 O x t4 t)) (\lambda (t: T).(subst0 (S (plus i O)) v2 +w t)) (or (pr0 (THead (Bind Abbr) x0 x1) (THead (Bind Abbr) u2 w)) (ex2 T +(\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: T).(subst0 +i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (x2: T).(\lambda (H15: (subst0 +O x t4 x2)).(\lambda (H16: (subst0 (S (plus i O)) v2 w x2)).(let H17 \def +(f_equal nat nat S (plus i O) i (sym_eq nat i (plus i O) (plus_n_O i))) in +(let H18 \def (eq_ind nat (S (plus i O)) (\lambda (n: nat).(subst0 n v2 w +x2)) H16 (S i) H17) in (or_intror (pr0 (THead (Bind Abbr) x0 x1) (THead (Bind +Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) +(\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: T).(subst0 +i v2 (THead (Bind Abbr) u2 w) w2)) (THead (Bind Abbr) x x2) (pr0_delta x0 x +H13 x1 t4 H11 x2 H15) (subst0_both v2 u2 x i H14 (Bind Abbr) w x2 H18)))))))) +(subst0_subst0_back t4 w u2 O H4 x v2 i H14))))) H12)) (H1 v1 x0 i H9 v2 +H6))) (\lambda (H11: (ex2 T (\lambda (w2: T).(pr0 x1 w2)) (\lambda (w2: +T).(subst0 (s (Bind Abbr) i) v2 t4 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x1 +w2)) (\lambda (w2: T).(subst0 (s (Bind Abbr) i) v2 t4 w2)) (or (pr0 (THead +(Bind Abbr) x0 x1) (THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead (Bind +Abbr) u2 w) w2)))) (\lambda (x: T).(\lambda (H12: (pr0 x1 x)).(\lambda (H13: +(subst0 (s (Bind Abbr) i) v2 t4 x)).(or_ind (pr0 x0 u2) (ex2 T (\lambda (w2: +T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v2 u2 w2))) (or (pr0 (THead (Bind +Abbr) x0 x1) (THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead +(Bind Abbr) x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 +w) w2)))) (\lambda (H14: (pr0 x0 u2)).(ex2_ind T (\lambda (t: T).(subst0 O u2 +x t)) (\lambda (t: T).(subst0 (s (Bind Abbr) i) v2 w t)) (or (pr0 (THead +(Bind Abbr) x0 x1) (THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead (Bind +Abbr) u2 w) w2)))) (\lambda (x2: T).(\lambda (H15: (subst0 O u2 x +x2)).(\lambda (H16: (subst0 (s (Bind Abbr) i) v2 w x2)).(or_intror (pr0 +(THead (Bind Abbr) x0 x1) (THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: +T).(pr0 (THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead +(Bind Abbr) u2 w) w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) +x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)) +(THead (Bind Abbr) u2 x2) (pr0_delta x0 u2 H14 x1 x H12 x2 H15) (subst0_snd +(Bind Abbr) v2 x2 w i H16 u2)))))) (subst0_confluence_neq t4 x v2 (s (Bind +Abbr) i) H13 w u2 O H4 (sym_not_eq nat O (S i) (O_S i))))) (\lambda (H14: +(ex2 T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v2 u2 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v2 +u2 w2)) (or (pr0 (THead (Bind Abbr) x0 x1) (THead (Bind Abbr) u2 w)) (ex2 T +(\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: T).(subst0 +i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda (x2: T).(\lambda (H15: (pr0 x0 +x2)).(\lambda (H16: (subst0 i v2 u2 x2)).(ex2_ind T (\lambda (t: T).(subst0 O +x2 t4 t)) (\lambda (t: T).(subst0 (S (plus i O)) v2 w t)) (or (pr0 (THead +(Bind Abbr) x0 x1) (THead (Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 +(THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 (THead (Bind +Abbr) u2 w) w2)))) (\lambda (x3: T).(\lambda (H17: (subst0 O x2 t4 +x3)).(\lambda (H18: (subst0 (S (plus i O)) v2 w x3)).(let H19 \def (f_equal +nat nat S (plus i O) i (sym_eq nat i (plus i O) (plus_n_O i))) in (let H20 +\def (eq_ind nat (S (plus i O)) (\lambda (n: nat).(subst0 n v2 w x3)) H18 (S +i) H19) in (ex2_ind T (\lambda (t: T).(subst0 (s (Bind Abbr) i) v2 x3 t)) +(\lambda (t: T).(subst0 O x2 x t)) (or (pr0 (THead (Bind Abbr) x0 x1) (THead +(Bind Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) +w2)) (\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2)))) (\lambda +(x4: T).(\lambda (H21: (subst0 (s (Bind Abbr) i) v2 x3 x4)).(\lambda (H22: +(subst0 O x2 x x4)).(or_intror (pr0 (THead (Bind Abbr) x0 x1) (THead (Bind +Abbr) u2 w)) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) +(\lambda (w2: T).(subst0 i v2 (THead (Bind Abbr) u2 w) w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead (Bind Abbr) x0 x1) w2)) (\lambda (w2: T).(subst0 +i v2 (THead (Bind Abbr) u2 w) w2)) (THead (Bind Abbr) x2 x4) (pr0_delta x0 x2 +H15 x1 x H12 x4 H22) (subst0_both v2 u2 x2 i H16 (Bind Abbr) w x4 +(subst0_trans x3 w v2 (s (Bind Abbr) i) H20 x4 H21))))))) +(subst0_confluence_neq t4 x3 x2 O H17 x v2 (s (Bind Abbr) i) H13 (O_S +i)))))))) (subst0_subst0_back t4 w u2 O H4 x2 v2 i H16))))) H14)) (H1 v1 x0 i +H9 v2 H6))))) H11)) (H3 v1 x1 (s (Bind Abbr) i) H10 v2 H6)) w1 H8)))))) H7)) +(subst0_gen_head (Bind Abbr) v1 u1 t3 w1 i H5)))))))))))))))))) (\lambda (b: +B).(\lambda (H0: (not (eq B b Abst))).(\lambda (t3: T).(\lambda (t4: +T).(\lambda (H1: (pr0 t3 t4)).(\lambda (H2: ((\forall (v1: T).(\forall (w1: +T).(\forall (i: nat).((subst0 i v1 t3 w1) \to (\forall (v2: T).((pr0 v1 v2) +\to (or (pr0 w1 t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst0 i v2 t4 w2)))))))))))).(\lambda (u: T).(\lambda (v1: T).(\lambda +(w1: T).(\lambda (i: nat).(\lambda (H3: (subst0 i v1 (THead (Bind b) u (lift +(S O) O t3)) w1)).(\lambda (v2: T).(\lambda (H4: (pr0 v1 v2)).(or3_ind (ex2 T +(\lambda (u2: T).(eq T w1 (THead (Bind b) u2 (lift (S O) O t3)))) (\lambda +(u2: T).(subst0 i v1 u u2))) (ex2 T (\lambda (t5: T).(eq T w1 (THead (Bind b) +u t5))) (\lambda (t5: T).(subst0 (s (Bind b) i) v1 (lift (S O) O t3) t5))) +(ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T w1 (THead (Bind b) u2 +t5)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i v1 u u2))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s (Bind b) i) v1 (lift (S O) O t3) t5)))) (or +(pr0 w1 t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i +v2 t4 w2)))) (\lambda (H5: (ex2 T (\lambda (u2: T).(eq T w1 (THead (Bind b) +u2 (lift (S O) O t3)))) (\lambda (u2: T).(subst0 i v1 u u2)))).(ex2_ind T +(\lambda (u2: T).(eq T w1 (THead (Bind b) u2 (lift (S O) O t3)))) (\lambda +(u2: T).(subst0 i v1 u u2)) (or (pr0 w1 t4) (ex2 T (\lambda (w2: T).(pr0 w1 +w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (x: T).(\lambda (H6: +(eq T w1 (THead (Bind b) x (lift (S O) O t3)))).(\lambda (_: (subst0 i v1 u +x)).(eq_ind_r T (THead (Bind b) x (lift (S O) O t3)) (\lambda (t: T).(or (pr0 +t t4) (ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v2 t4 +w2))))) (or_introl (pr0 (THead (Bind b) x (lift (S O) O t3)) t4) (ex2 T +(\lambda (w2: T).(pr0 (THead (Bind b) x (lift (S O) O t3)) w2)) (\lambda (w2: +T).(subst0 i v2 t4 w2))) (pr0_zeta b H0 t3 t4 H1 x)) w1 H6)))) H5)) (\lambda +(H5: (ex2 T (\lambda (t5: T).(eq T w1 (THead (Bind b) u t5))) (\lambda (t5: +T).(subst0 (s (Bind b) i) v1 (lift (S O) O t3) t5)))).(ex2_ind T (\lambda +(t5: T).(eq T w1 (THead (Bind b) u t5))) (\lambda (t5: T).(subst0 (s (Bind b) +i) v1 (lift (S O) O t3) t5)) (or (pr0 w1 t4) (ex2 T (\lambda (w2: T).(pr0 w1 +w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (x: T).(\lambda (H6: +(eq T w1 (THead (Bind b) u x))).(\lambda (H7: (subst0 (s (Bind b) i) v1 (lift +(S O) O t3) x)).(ex2_ind T (\lambda (t5: T).(eq T x (lift (S O) O t5))) +(\lambda (t5: T).(subst0 (minus (s (Bind b) i) (S O)) v1 t3 t5)) (or (pr0 w1 +t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 t4 +w2)))) (\lambda (x0: T).(\lambda (H8: (eq T x (lift (S O) O x0))).(\lambda +(H9: (subst0 (minus (s (Bind b) i) (S O)) v1 t3 x0)).(eq_ind_r T (THead (Bind +b) u x) (\lambda (t: T).(or (pr0 t t4) (ex2 T (\lambda (w2: T).(pr0 t w2)) +(\lambda (w2: T).(subst0 i v2 t4 w2))))) (eq_ind_r T (lift (S O) O x0) +(\lambda (t: T).(or (pr0 (THead (Bind b) u t) t4) (ex2 T (\lambda (w2: +T).(pr0 (THead (Bind b) u t) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))))) +(let H10 \def (eq_ind_r nat (minus i O) (\lambda (n: nat).(subst0 n v1 t3 +x0)) H9 i (minus_n_O i)) in (or_ind (pr0 x0 t4) (ex2 T (\lambda (w2: T).(pr0 +x0 w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))) (or (pr0 (THead (Bind b) u +(lift (S O) O x0)) t4) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind b) u (lift +(S O) O x0)) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (H11: (pr0 +x0 t4)).(or_introl (pr0 (THead (Bind b) u (lift (S O) O x0)) t4) (ex2 T +(\lambda (w2: T).(pr0 (THead (Bind b) u (lift (S O) O x0)) w2)) (\lambda (w2: +T).(subst0 i v2 t4 w2))) (pr0_zeta b H0 x0 t4 H11 u))) (\lambda (H11: (ex2 T +(\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v2 t4 +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x0 w2)) (\lambda (w2: T).(subst0 i v2 +t4 w2)) (or (pr0 (THead (Bind b) u (lift (S O) O x0)) t4) (ex2 T (\lambda +(w2: T).(pr0 (THead (Bind b) u (lift (S O) O x0)) w2)) (\lambda (w2: +T).(subst0 i v2 t4 w2)))) (\lambda (x1: T).(\lambda (H12: (pr0 x0 +x1)).(\lambda (H13: (subst0 i v2 t4 x1)).(or_intror (pr0 (THead (Bind b) u +(lift (S O) O x0)) t4) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind b) u (lift +(S O) O x0)) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead (Bind b) u (lift (S O) O x0)) w2)) (\lambda (w2: +T).(subst0 i v2 t4 w2)) x1 (pr0_zeta b H0 x0 x1 H12 u) H13))))) H11)) (H2 v1 +x0 i H10 v2 H4))) x H8) w1 H6)))) (subst0_gen_lift_ge v1 t3 x (s (Bind b) i) +(S O) O H7 (le_n_S O i (le_O_n i))))))) H5)) (\lambda (H5: (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T w1 (THead (Bind b) u2 t5)))) (\lambda +(u2: T).(\lambda (_: T).(subst0 i v1 u u2))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s (Bind b) i) v1 (lift (S O) O t3) t5))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t5: T).(eq T w1 (THead (Bind b) u2 t5)))) (\lambda +(u2: T).(\lambda (_: T).(subst0 i v1 u u2))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s (Bind b) i) v1 (lift (S O) O t3) t5))) (or (pr0 w1 t4) (ex2 T +(\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (H6: (eq T w1 (THead (Bind b) x0 +x1))).(\lambda (_: (subst0 i v1 u x0)).(\lambda (H8: (subst0 (s (Bind b) i) +v1 (lift (S O) O t3) x1)).(ex2_ind T (\lambda (t5: T).(eq T x1 (lift (S O) O +t5))) (\lambda (t5: T).(subst0 (minus (s (Bind b) i) (S O)) v1 t3 t5)) (or +(pr0 w1 t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i +v2 t4 w2)))) (\lambda (x: T).(\lambda (H9: (eq T x1 (lift (S O) O +x))).(\lambda (H10: (subst0 (minus (s (Bind b) i) (S O)) v1 t3 x)).(eq_ind_r +T (THead (Bind b) x0 x1) (\lambda (t: T).(or (pr0 t t4) (ex2 T (\lambda (w2: +T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))))) (eq_ind_r T (lift (S +O) O x) (\lambda (t: T).(or (pr0 (THead (Bind b) x0 t) t4) (ex2 T (\lambda +(w2: T).(pr0 (THead (Bind b) x0 t) w2)) (\lambda (w2: T).(subst0 i v2 t4 +w2))))) (let H11 \def (eq_ind_r nat (minus i O) (\lambda (n: nat).(subst0 n +v1 t3 x)) H10 i (minus_n_O i)) in (or_ind (pr0 x t4) (ex2 T (\lambda (w2: +T).(pr0 x w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))) (or (pr0 (THead (Bind +b) x0 (lift (S O) O x)) t4) (ex2 T (\lambda (w2: T).(pr0 (THead (Bind b) x0 +(lift (S O) O x)) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (H12: +(pr0 x t4)).(or_introl (pr0 (THead (Bind b) x0 (lift (S O) O x)) t4) (ex2 T +(\lambda (w2: T).(pr0 (THead (Bind b) x0 (lift (S O) O x)) w2)) (\lambda (w2: +T).(subst0 i v2 t4 w2))) (pr0_zeta b H0 x t4 H12 x0))) (\lambda (H12: (ex2 T +(\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))).(ex2_ind +T (\lambda (w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)) (or (pr0 +(THead (Bind b) x0 (lift (S O) O x)) t4) (ex2 T (\lambda (w2: T).(pr0 (THead +(Bind b) x0 (lift (S O) O x)) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) +(\lambda (x2: T).(\lambda (H13: (pr0 x x2)).(\lambda (H14: (subst0 i v2 t4 +x2)).(or_intror (pr0 (THead (Bind b) x0 (lift (S O) O x)) t4) (ex2 T (\lambda +(w2: T).(pr0 (THead (Bind b) x0 (lift (S O) O x)) w2)) (\lambda (w2: +T).(subst0 i v2 t4 w2))) (ex_intro2 T (\lambda (w2: T).(pr0 (THead (Bind b) +x0 (lift (S O) O x)) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)) x2 (pr0_zeta +b H0 x x2 H13 x0) H14))))) H12)) (H2 v1 x i H11 v2 H4))) x1 H9) w1 H6)))) +(subst0_gen_lift_ge v1 t3 x1 (s (Bind b) i) (S O) O H8 (le_n_S O i (le_O_n +i))))))))) H5)) (subst0_gen_head (Bind b) v1 u (lift (S O) O t3) w1 i +H3))))))))))))))) (\lambda (t3: T).(\lambda (t4: T).(\lambda (H0: (pr0 t3 +t4)).(\lambda (H1: ((\forall (v1: T).(\forall (w1: T).(\forall (i: +nat).((subst0 i v1 t3 w1) \to (\forall (v2: T).((pr0 v1 v2) \to (or (pr0 w1 +t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 t4 +w2)))))))))))).(\lambda (u: T).(\lambda (v1: T).(\lambda (w1: T).(\lambda (i: +nat).(\lambda (H2: (subst0 i v1 (THead (Flat Cast) u t3) w1)).(\lambda (v2: +T).(\lambda (H3: (pr0 v1 v2)).(or3_ind (ex2 T (\lambda (u2: T).(eq T w1 +(THead (Flat Cast) u2 t3))) (\lambda (u2: T).(subst0 i v1 u u2))) (ex2 T +(\lambda (t5: T).(eq T w1 (THead (Flat Cast) u t5))) (\lambda (t5: T).(subst0 +(s (Flat Cast) i) v1 t3 t5))) (ex3_2 T T (\lambda (u2: T).(\lambda (t5: +T).(eq T w1 (THead (Flat Cast) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i v1 u u2))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s (Flat +Cast) i) v1 t3 t5)))) (or (pr0 w1 t4) (ex2 T (\lambda (w2: T).(pr0 w1 w2)) +(\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (H4: (ex2 T (\lambda (u2: +T).(eq T w1 (THead (Flat Cast) u2 t3))) (\lambda (u2: T).(subst0 i v1 u +u2)))).(ex2_ind T (\lambda (u2: T).(eq T w1 (THead (Flat Cast) u2 t3))) +(\lambda (u2: T).(subst0 i v1 u u2)) (or (pr0 w1 t4) (ex2 T (\lambda (w2: +T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (x: +T).(\lambda (H5: (eq T w1 (THead (Flat Cast) x t3))).(\lambda (_: (subst0 i +v1 u x)).(eq_ind_r T (THead (Flat Cast) x t3) (\lambda (t: T).(or (pr0 t t4) +(ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))))) +(or_introl (pr0 (THead (Flat Cast) x t3) t4) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Cast) x t3) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))) +(pr0_epsilon t3 t4 H0 x)) w1 H5)))) H4)) (\lambda (H4: (ex2 T (\lambda (t5: +T).(eq T w1 (THead (Flat Cast) u t5))) (\lambda (t5: T).(subst0 (s (Flat +Cast) i) v1 t3 t5)))).(ex2_ind T (\lambda (t5: T).(eq T w1 (THead (Flat Cast) +u t5))) (\lambda (t5: T).(subst0 (s (Flat Cast) i) v1 t3 t5)) (or (pr0 w1 t4) +(ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) +(\lambda (x: T).(\lambda (H5: (eq T w1 (THead (Flat Cast) u x))).(\lambda +(H6: (subst0 (s (Flat Cast) i) v1 t3 x)).(eq_ind_r T (THead (Flat Cast) u x) +(\lambda (t: T).(or (pr0 t t4) (ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda +(w2: T).(subst0 i v2 t4 w2))))) (or_ind (pr0 x t4) (ex2 T (\lambda (w2: +T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s (Flat Cast) i) v2 t4 w2))) (or +(pr0 (THead (Flat Cast) u x) t4) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Cast) u x) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (H7: (pr0 x +t4)).(or_introl (pr0 (THead (Flat Cast) u x) t4) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Cast) u x) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))) +(pr0_epsilon x t4 H7 u))) (\lambda (H7: (ex2 T (\lambda (w2: T).(pr0 x w2)) +(\lambda (w2: T).(subst0 (s (Flat Cast) i) v2 t4 w2)))).(ex2_ind T (\lambda +(w2: T).(pr0 x w2)) (\lambda (w2: T).(subst0 (s (Flat Cast) i) v2 t4 w2)) (or +(pr0 (THead (Flat Cast) u x) t4) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Cast) u x) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (x0: +T).(\lambda (H8: (pr0 x x0)).(\lambda (H9: (subst0 (s (Flat Cast) i) v2 t4 +x0)).(or_intror (pr0 (THead (Flat Cast) u x) t4) (ex2 T (\lambda (w2: T).(pr0 +(THead (Flat Cast) u x) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))) +(ex_intro2 T (\lambda (w2: T).(pr0 (THead (Flat Cast) u x) w2)) (\lambda (w2: +T).(subst0 i v2 t4 w2)) x0 (pr0_epsilon x x0 H8 u) H9))))) H7)) (H1 v1 x (s +(Flat Cast) i) H6 v2 H3)) w1 H5)))) H4)) (\lambda (H4: (ex3_2 T T (\lambda +(u2: T).(\lambda (t5: T).(eq T w1 (THead (Flat Cast) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i v1 u u2))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s (Flat Cast) i) v1 t3 t5))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t5: T).(eq T w1 (THead (Flat Cast) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i v1 u u2))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s (Flat Cast) i) v1 t3 t5))) (or (pr0 w1 t4) (ex2 T (\lambda (w2: +T).(pr0 w1 w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H5: (eq T w1 (THead (Flat Cast) x0 +x1))).(\lambda (_: (subst0 i v1 u x0)).(\lambda (H7: (subst0 (s (Flat Cast) +i) v1 t3 x1)).(eq_ind_r T (THead (Flat Cast) x0 x1) (\lambda (t: T).(or (pr0 +t t4) (ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda (w2: T).(subst0 i v2 t4 +w2))))) (or_ind (pr0 x1 t4) (ex2 T (\lambda (w2: T).(pr0 x1 w2)) (\lambda +(w2: T).(subst0 (s (Flat Cast) i) v2 t4 w2))) (or (pr0 (THead (Flat Cast) x0 +x1) t4) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Cast) x0 x1) w2)) (\lambda +(w2: T).(subst0 i v2 t4 w2)))) (\lambda (H8: (pr0 x1 t4)).(or_introl (pr0 +(THead (Flat Cast) x0 x1) t4) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Cast) +x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))) (pr0_epsilon x1 t4 H8 +x0))) (\lambda (H8: (ex2 T (\lambda (w2: T).(pr0 x1 w2)) (\lambda (w2: +T).(subst0 (s (Flat Cast) i) v2 t4 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 x1 +w2)) (\lambda (w2: T).(subst0 (s (Flat Cast) i) v2 t4 w2)) (or (pr0 (THead +(Flat Cast) x0 x1) t4) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat Cast) x0 x1) +w2)) (\lambda (w2: T).(subst0 i v2 t4 w2)))) (\lambda (x: T).(\lambda (H9: +(pr0 x1 x)).(\lambda (H10: (subst0 (s (Flat Cast) i) v2 t4 x)).(or_intror +(pr0 (THead (Flat Cast) x0 x1) t4) (ex2 T (\lambda (w2: T).(pr0 (THead (Flat +Cast) x0 x1) w2)) (\lambda (w2: T).(subst0 i v2 t4 w2))) (ex_intro2 T +(\lambda (w2: T).(pr0 (THead (Flat Cast) x0 x1) w2)) (\lambda (w2: T).(subst0 +i v2 t4 w2)) x (pr0_epsilon x1 x H9 x0) H10))))) H8)) (H1 v1 x1 (s (Flat +Cast) i) H7 v2 H3)) w1 H5)))))) H4)) (subst0_gen_head (Flat Cast) v1 u t3 w1 +i H2))))))))))))) t1 t2 H))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/subst1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/subst1.ma new file mode 100644 index 000000000..0aa55239f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/subst1.ma @@ -0,0 +1,95 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr0/subst1". + +include "pr0/props.ma". + +include "subst1/defs.ma". + +theorem pr0_delta1: + \forall (u1: T).(\forall (u2: T).((pr0 u1 u2) \to (\forall (t1: T).(\forall +(t2: T).((pr0 t1 t2) \to (\forall (w: T).((subst1 O u2 t2 w) \to (pr0 (THead +(Bind Abbr) u1 t1) (THead (Bind Abbr) u2 w))))))))) +\def + \lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr0 u1 u2)).(\lambda (t1: +T).(\lambda (t2: T).(\lambda (H0: (pr0 t1 t2)).(\lambda (w: T).(\lambda (H1: +(subst1 O u2 t2 w)).(subst1_ind O u2 t2 (\lambda (t: T).(pr0 (THead (Bind +Abbr) u1 t1) (THead (Bind Abbr) u2 t))) (pr0_comp u1 u2 H t1 t2 H0 (Bind +Abbr)) (\lambda (t0: T).(\lambda (H2: (subst0 O u2 t2 t0)).(pr0_delta u1 u2 H +t1 t2 H0 t0 H2))) w H1)))))))). + +theorem pr0_subst1_back: + \forall (u2: T).(\forall (t1: T).(\forall (t2: T).(\forall (i: nat).((subst1 +i u2 t1 t2) \to (\forall (u1: T).((pr0 u1 u2) \to (ex2 T (\lambda (t: +T).(subst1 i u1 t1 t)) (\lambda (t: T).(pr0 t t2))))))))) +\def + \lambda (u2: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda (i: nat).(\lambda +(H: (subst1 i u2 t1 t2)).(subst1_ind i u2 t1 (\lambda (t: T).(\forall (u1: +T).((pr0 u1 u2) \to (ex2 T (\lambda (t0: T).(subst1 i u1 t1 t0)) (\lambda +(t0: T).(pr0 t0 t)))))) (\lambda (u1: T).(\lambda (_: (pr0 u1 u2)).(ex_intro2 +T (\lambda (t: T).(subst1 i u1 t1 t)) (\lambda (t: T).(pr0 t t1)) t1 +(subst1_refl i u1 t1) (pr0_refl t1)))) (\lambda (t0: T).(\lambda (H0: (subst0 +i u2 t1 t0)).(\lambda (u1: T).(\lambda (H1: (pr0 u1 u2)).(ex2_ind T (\lambda +(t: T).(subst0 i u1 t1 t)) (\lambda (t: T).(pr0 t t0)) (ex2 T (\lambda (t: +T).(subst1 i u1 t1 t)) (\lambda (t: T).(pr0 t t0))) (\lambda (x: T).(\lambda +(H2: (subst0 i u1 t1 x)).(\lambda (H3: (pr0 x t0)).(ex_intro2 T (\lambda (t: +T).(subst1 i u1 t1 t)) (\lambda (t: T).(pr0 t t0)) x (subst1_single i u1 t1 x +H2) H3)))) (pr0_subst0_back u2 t1 t0 i H0 u1 H1)))))) t2 H))))). + +theorem pr0_subst1_fwd: + \forall (u2: T).(\forall (t1: T).(\forall (t2: T).(\forall (i: nat).((subst1 +i u2 t1 t2) \to (\forall (u1: T).((pr0 u2 u1) \to (ex2 T (\lambda (t: +T).(subst1 i u1 t1 t)) (\lambda (t: T).(pr0 t2 t))))))))) +\def + \lambda (u2: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda (i: nat).(\lambda +(H: (subst1 i u2 t1 t2)).(subst1_ind i u2 t1 (\lambda (t: T).(\forall (u1: +T).((pr0 u2 u1) \to (ex2 T (\lambda (t0: T).(subst1 i u1 t1 t0)) (\lambda +(t0: T).(pr0 t t0)))))) (\lambda (u1: T).(\lambda (_: (pr0 u2 u1)).(ex_intro2 +T (\lambda (t: T).(subst1 i u1 t1 t)) (\lambda (t: T).(pr0 t1 t)) t1 +(subst1_refl i u1 t1) (pr0_refl t1)))) (\lambda (t0: T).(\lambda (H0: (subst0 +i u2 t1 t0)).(\lambda (u1: T).(\lambda (H1: (pr0 u2 u1)).(ex2_ind T (\lambda +(t: T).(subst0 i u1 t1 t)) (\lambda (t: T).(pr0 t0 t)) (ex2 T (\lambda (t: +T).(subst1 i u1 t1 t)) (\lambda (t: T).(pr0 t0 t))) (\lambda (x: T).(\lambda +(H2: (subst0 i u1 t1 x)).(\lambda (H3: (pr0 t0 x)).(ex_intro2 T (\lambda (t: +T).(subst1 i u1 t1 t)) (\lambda (t: T).(pr0 t0 t)) x (subst1_single i u1 t1 x +H2) H3)))) (pr0_subst0_fwd u2 t1 t0 i H0 u1 H1)))))) t2 H))))). + +theorem pr0_subst1: + \forall (t1: T).(\forall (t2: T).((pr0 t1 t2) \to (\forall (v1: T).(\forall +(w1: T).(\forall (i: nat).((subst1 i v1 t1 w1) \to (\forall (v2: T).((pr0 v1 +v2) \to (ex2 T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst1 i v2 t2 +w2))))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr0 t1 t2)).(\lambda (v1: +T).(\lambda (w1: T).(\lambda (i: nat).(\lambda (H0: (subst1 i v1 t1 +w1)).(subst1_ind i v1 t1 (\lambda (t: T).(\forall (v2: T).((pr0 v1 v2) \to +(ex2 T (\lambda (w2: T).(pr0 t w2)) (\lambda (w2: T).(subst1 i v2 t2 w2)))))) +(\lambda (v2: T).(\lambda (_: (pr0 v1 v2)).(ex_intro2 T (\lambda (w2: T).(pr0 +t1 w2)) (\lambda (w2: T).(subst1 i v2 t2 w2)) t2 H (subst1_refl i v2 t2)))) +(\lambda (t0: T).(\lambda (H1: (subst0 i v1 t1 t0)).(\lambda (v2: T).(\lambda +(H2: (pr0 v1 v2)).(or_ind (pr0 t0 t2) (ex2 T (\lambda (w2: T).(pr0 t0 w2)) +(\lambda (w2: T).(subst0 i v2 t2 w2))) (ex2 T (\lambda (w2: T).(pr0 t0 w2)) +(\lambda (w2: T).(subst1 i v2 t2 w2))) (\lambda (H3: (pr0 t0 t2)).(ex_intro2 +T (\lambda (w2: T).(pr0 t0 w2)) (\lambda (w2: T).(subst1 i v2 t2 w2)) t2 H3 +(subst1_refl i v2 t2))) (\lambda (H3: (ex2 T (\lambda (w2: T).(pr0 t0 w2)) +(\lambda (w2: T).(subst0 i v2 t2 w2)))).(ex2_ind T (\lambda (w2: T).(pr0 t0 +w2)) (\lambda (w2: T).(subst0 i v2 t2 w2)) (ex2 T (\lambda (w2: T).(pr0 t0 +w2)) (\lambda (w2: T).(subst1 i v2 t2 w2))) (\lambda (x: T).(\lambda (H4: +(pr0 t0 x)).(\lambda (H5: (subst0 i v2 t2 x)).(ex_intro2 T (\lambda (w2: +T).(pr0 t0 w2)) (\lambda (w2: T).(subst1 i v2 t2 w2)) x H4 (subst1_single i +v2 t2 x H5))))) H3)) (pr0_subst0 t1 t2 H v1 t0 i H1 v2 H2)))))) w1 H0))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/defs.ma new file mode 100644 index 000000000..85540bde7 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/defs.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr1/defs". + +include "pr0/defs.ma". + +inductive pr1: T \to (T \to Prop) \def +| pr1_refl: \forall (t: T).(pr1 t t) +| pr1_sing: \forall (t2: T).(\forall (t1: T).((pr0 t1 t2) \to (\forall (t3: +T).((pr1 t2 t3) \to (pr1 t1 t3))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/pr1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/pr1.ma new file mode 100644 index 000000000..98a21a512 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/pr1.ma @@ -0,0 +1,64 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr1/pr1". + +include "pr1/props.ma". + +include "pr0/pr0.ma". + +theorem pr1_strip: + \forall (t0: T).(\forall (t1: T).((pr1 t0 t1) \to (\forall (t2: T).((pr0 t0 +t2) \to (ex2 T (\lambda (t: T).(pr1 t1 t)) (\lambda (t: T).(pr1 t2 t))))))) +\def + \lambda (t0: T).(\lambda (t1: T).(\lambda (H: (pr1 t0 t1)).(pr1_ind (\lambda +(t: T).(\lambda (t2: T).(\forall (t3: T).((pr0 t t3) \to (ex2 T (\lambda (t4: +T).(pr1 t2 t4)) (\lambda (t4: T).(pr1 t3 t4))))))) (\lambda (t: T).(\lambda +(t2: T).(\lambda (H0: (pr0 t t2)).(ex_intro2 T (\lambda (t3: T).(pr1 t t3)) +(\lambda (t3: T).(pr1 t2 t3)) t2 (pr1_pr0 t t2 H0) (pr1_refl t2))))) (\lambda +(t2: T).(\lambda (t3: T).(\lambda (H0: (pr0 t3 t2)).(\lambda (t4: T).(\lambda +(_: (pr1 t2 t4)).(\lambda (H2: ((\forall (t5: T).((pr0 t2 t5) \to (ex2 T +(\lambda (t: T).(pr1 t4 t)) (\lambda (t: T).(pr1 t5 t))))))).(\lambda (t5: +T).(\lambda (H3: (pr0 t3 t5)).(ex2_ind T (\lambda (t: T).(pr0 t5 t)) (\lambda +(t: T).(pr0 t2 t)) (ex2 T (\lambda (t: T).(pr1 t4 t)) (\lambda (t: T).(pr1 t5 +t))) (\lambda (x: T).(\lambda (H4: (pr0 t5 x)).(\lambda (H5: (pr0 t2 +x)).(ex2_ind T (\lambda (t: T).(pr1 t4 t)) (\lambda (t: T).(pr1 x t)) (ex2 T +(\lambda (t: T).(pr1 t4 t)) (\lambda (t: T).(pr1 t5 t))) (\lambda (x0: +T).(\lambda (H6: (pr1 t4 x0)).(\lambda (H7: (pr1 x x0)).(ex_intro2 T (\lambda +(t: T).(pr1 t4 t)) (\lambda (t: T).(pr1 t5 t)) x0 H6 (pr1_sing x t5 H4 x0 +H7))))) (H2 x H5))))) (pr0_confluence t3 t5 H3 t2 H0)))))))))) t0 t1 H))). + +theorem pr1_confluence: + \forall (t0: T).(\forall (t1: T).((pr1 t0 t1) \to (\forall (t2: T).((pr1 t0 +t2) \to (ex2 T (\lambda (t: T).(pr1 t1 t)) (\lambda (t: T).(pr1 t2 t))))))) +\def + \lambda (t0: T).(\lambda (t1: T).(\lambda (H: (pr1 t0 t1)).(pr1_ind (\lambda +(t: T).(\lambda (t2: T).(\forall (t3: T).((pr1 t t3) \to (ex2 T (\lambda (t4: +T).(pr1 t2 t4)) (\lambda (t4: T).(pr1 t3 t4))))))) (\lambda (t: T).(\lambda +(t2: T).(\lambda (H0: (pr1 t t2)).(ex_intro2 T (\lambda (t3: T).(pr1 t t3)) +(\lambda (t3: T).(pr1 t2 t3)) t2 H0 (pr1_refl t2))))) (\lambda (t2: +T).(\lambda (t3: T).(\lambda (H0: (pr0 t3 t2)).(\lambda (t4: T).(\lambda (_: +(pr1 t2 t4)).(\lambda (H2: ((\forall (t5: T).((pr1 t2 t5) \to (ex2 T (\lambda +(t: T).(pr1 t4 t)) (\lambda (t: T).(pr1 t5 t))))))).(\lambda (t5: T).(\lambda +(H3: (pr1 t3 t5)).(ex2_ind T (\lambda (t: T).(pr1 t5 t)) (\lambda (t: T).(pr1 +t2 t)) (ex2 T (\lambda (t: T).(pr1 t4 t)) (\lambda (t: T).(pr1 t5 t))) +(\lambda (x: T).(\lambda (H4: (pr1 t5 x)).(\lambda (H5: (pr1 t2 x)).(ex2_ind +T (\lambda (t: T).(pr1 t4 t)) (\lambda (t: T).(pr1 x t)) (ex2 T (\lambda (t: +T).(pr1 t4 t)) (\lambda (t: T).(pr1 t5 t))) (\lambda (x0: T).(\lambda (H6: +(pr1 t4 x0)).(\lambda (H7: (pr1 x x0)).(ex_intro2 T (\lambda (t: T).(pr1 t4 +t)) (\lambda (t: T).(pr1 t5 t)) x0 H6 (pr1_t x t5 H4 x0 H7))))) (H2 x H5))))) +(pr1_strip t3 t5 H3 t2 H0)))))))))) t0 t1 H))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/props.ma new file mode 100644 index 000000000..7840b3cd2 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/props.ma @@ -0,0 +1,110 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr1/props". + +include "pr1/defs.ma". + +include "pr0/subst1.ma". + +include "subst1/props.ma". + +include "T/props.ma". + +theorem pr1_pr0: + \forall (t1: T).(\forall (t2: T).((pr0 t1 t2) \to (pr1 t1 t2))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr0 t1 t2)).(pr1_sing t2 t1 H +t2 (pr1_refl t2)))). + +theorem pr1_t: + \forall (t2: T).(\forall (t1: T).((pr1 t1 t2) \to (\forall (t3: T).((pr1 t2 +t3) \to (pr1 t1 t3))))) +\def + \lambda (t2: T).(\lambda (t1: T).(\lambda (H: (pr1 t1 t2)).(pr1_ind (\lambda +(t: T).(\lambda (t0: T).(\forall (t3: T).((pr1 t0 t3) \to (pr1 t t3))))) +(\lambda (t: T).(\lambda (t3: T).(\lambda (H0: (pr1 t t3)).H0))) (\lambda +(t0: T).(\lambda (t3: T).(\lambda (H0: (pr0 t3 t0)).(\lambda (t4: T).(\lambda +(_: (pr1 t0 t4)).(\lambda (H2: ((\forall (t5: T).((pr1 t4 t5) \to (pr1 t0 +t5))))).(\lambda (t5: T).(\lambda (H3: (pr1 t4 t5)).(pr1_sing t0 t3 H0 t5 (H2 +t5 H3)))))))))) t1 t2 H))). + +theorem pr1_head_1: + \forall (u1: T).(\forall (u2: T).((pr1 u1 u2) \to (\forall (t: T).(\forall +(k: K).(pr1 (THead k u1 t) (THead k u2 t)))))) +\def + \lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr1 u1 u2)).(\lambda (t: +T).(\lambda (k: K).(pr1_ind (\lambda (t0: T).(\lambda (t1: T).(pr1 (THead k +t0 t) (THead k t1 t)))) (\lambda (t0: T).(pr1_refl (THead k t0 t))) (\lambda +(t2: T).(\lambda (t1: T).(\lambda (H0: (pr0 t1 t2)).(\lambda (t3: T).(\lambda +(_: (pr1 t2 t3)).(\lambda (H2: (pr1 (THead k t2 t) (THead k t3 t))).(pr1_sing +(THead k t2 t) (THead k t1 t) (pr0_comp t1 t2 H0 t t (pr0_refl t) k) (THead k +t3 t) H2))))))) u1 u2 H))))). + +theorem pr1_head_2: + \forall (t1: T).(\forall (t2: T).((pr1 t1 t2) \to (\forall (u: T).(\forall +(k: K).(pr1 (THead k u t1) (THead k u t2)))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr1 t1 t2)).(\lambda (u: +T).(\lambda (k: K).(pr1_ind (\lambda (t: T).(\lambda (t0: T).(pr1 (THead k u +t) (THead k u t0)))) (\lambda (t: T).(pr1_refl (THead k u t))) (\lambda (t0: +T).(\lambda (t3: T).(\lambda (H0: (pr0 t3 t0)).(\lambda (t4: T).(\lambda (_: +(pr1 t0 t4)).(\lambda (H2: (pr1 (THead k u t0) (THead k u t4))).(pr1_sing +(THead k u t0) (THead k u t3) (pr0_comp u u (pr0_refl u) t3 t0 H0 k) (THead k +u t4) H2))))))) t1 t2 H))))). + +theorem pr1_comp: + \forall (v: T).(\forall (w: T).((pr1 v w) \to (\forall (t: T).(\forall (u: +T).((pr1 t u) \to (\forall (k: K).(pr1 (THead k v t) (THead k w u)))))))) +\def + \lambda (v: T).(\lambda (w: T).(\lambda (H: (pr1 v w)).(pr1_ind (\lambda (t: +T).(\lambda (t0: T).(\forall (t1: T).(\forall (u: T).((pr1 t1 u) \to (\forall +(k: K).(pr1 (THead k t t1) (THead k t0 u)))))))) (\lambda (t: T).(\lambda +(t0: T).(\lambda (u: T).(\lambda (H0: (pr1 t0 u)).(\lambda (k: K).(pr1_head_2 +t0 u H0 t k)))))) (\lambda (t2: T).(\lambda (t1: T).(\lambda (H0: (pr0 t1 +t2)).(\lambda (t3: T).(\lambda (H1: (pr1 t2 t3)).(\lambda (_: ((\forall (t: +T).(\forall (u: T).((pr1 t u) \to (\forall (k: K).(pr1 (THead k t2 t) (THead +k t3 u)))))))).(\lambda (t: T).(\lambda (u: T).(\lambda (H3: (pr1 t +u)).(\lambda (k: K).(pr1_ind (\lambda (t0: T).(\lambda (t4: T).(pr1 (THead k +t1 t0) (THead k t3 t4)))) (\lambda (t0: T).(pr1_head_1 t1 t3 (pr1_sing t2 t1 +H0 t3 H1) t0 k)) (\lambda (t0: T).(\lambda (t4: T).(\lambda (H4: (pr0 t4 +t0)).(\lambda (t5: T).(\lambda (_: (pr1 t0 t5)).(\lambda (H6: (pr1 (THead k +t1 t0) (THead k t3 t5))).(pr1_sing (THead k t1 t0) (THead k t1 t4) (pr0_comp +t1 t1 (pr0_refl t1) t4 t0 H4 k) (THead k t3 t5) H6))))))) t u H3))))))))))) v +w H))). + +theorem pr1_eta: + \forall (w: T).(\forall (u: T).(let t \def (THead (Bind Abst) w u) in +(\forall (v: T).((pr1 v w) \to (pr1 (THead (Bind Abst) v (THead (Flat Appl) +(TLRef O) (lift (S O) O t))) t))))) +\def + \lambda (w: T).(\lambda (u: T).(let t \def (THead (Bind Abst) w u) in +(\lambda (v: T).(\lambda (H: (pr1 v w)).(eq_ind_r T (THead (Bind Abst) (lift +(S O) O w) (lift (S O) (S O) u)) (\lambda (t0: T).(pr1 (THead (Bind Abst) v +(THead (Flat Appl) (TLRef O) t0)) (THead (Bind Abst) w u))) (pr1_comp v w H +(THead (Flat Appl) (TLRef O) (THead (Bind Abst) (lift (S O) O w) (lift (S O) +(S O) u))) u (pr1_sing (THead (Bind Abbr) (TLRef O) (lift (S O) (S O) u)) +(THead (Flat Appl) (TLRef O) (THead (Bind Abst) (lift (S O) O w) (lift (S O) +(S O) u))) (pr0_beta (lift (S O) O w) (TLRef O) (TLRef O) (pr0_refl (TLRef +O)) (lift (S O) (S O) u) (lift (S O) (S O) u) (pr0_refl (lift (S O) (S O) +u))) u (pr1_sing (THead (Bind Abbr) (TLRef O) (lift (S O) O u)) (THead (Bind +Abbr) (TLRef O) (lift (S O) (S O) u)) (pr0_delta1 (TLRef O) (TLRef O) +(pr0_refl (TLRef O)) (lift (S O) (S O) u) (lift (S O) (S O) u) (pr0_refl +(lift (S O) (S O) u)) (lift (S O) O u) (subst1_lift_S u O O (le_n O))) u +(pr1_pr0 (THead (Bind Abbr) (TLRef O) (lift (S O) O u)) u (pr0_zeta Abbr +not_abbr_abst u u (pr0_refl u) (TLRef O))))) (Bind Abst)) (lift (S O) O +(THead (Bind Abst) w u)) (lift_bind Abst w u (S O) O)))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/clen.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/clen.ma new file mode 100644 index 000000000..27275fa3a --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/clen.ma @@ -0,0 +1,182 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr2/clen". + +include "pr2/props.ma". + +include "clen/getl.ma". + +theorem pr2_gen_ctail: + \forall (k: K).(\forall (c: C).(\forall (u: T).(\forall (t1: T).(\forall +(t2: T).((pr2 (CTail k u c) t1 t2) \to (or (pr2 c t1 t2) (ex3 T (\lambda (_: +T).(eq K k (Bind Abbr))) (\lambda (t: T).(pr0 t1 t)) (\lambda (t: T).(subst0 +(clen c) u t t2))))))))) +\def + \lambda (k: K).(\lambda (c: C).(\lambda (u: T).(\lambda (t1: T).(\lambda +(t2: T).(\lambda (H: (pr2 (CTail k u c) t1 t2)).(insert_eq C (CTail k u c) +(\lambda (c0: C).(pr2 c0 t1 t2)) (or (pr2 c t1 t2) (ex3 T (\lambda (_: T).(eq +K k (Bind Abbr))) (\lambda (t: T).(pr0 t1 t)) (\lambda (t: T).(subst0 (clen +c) u t t2)))) (\lambda (y: C).(\lambda (H0: (pr2 y t1 t2)).(pr2_ind (\lambda +(c0: C).(\lambda (t: T).(\lambda (t0: T).((eq C c0 (CTail k u c)) \to (or +(pr2 c t t0) (ex3 T (\lambda (_: T).(eq K k (Bind Abbr))) (\lambda (t3: +T).(pr0 t t3)) (\lambda (t3: T).(subst0 (clen c) u t3 t0)))))))) (\lambda +(c0: C).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H1: (pr0 t3 t4)).(\lambda +(_: (eq C c0 (CTail k u c))).(or_introl (pr2 c t3 t4) (ex3 T (\lambda (_: +T).(eq K k (Bind Abbr))) (\lambda (t: T).(pr0 t3 t)) (\lambda (t: T).(subst0 +(clen c) u t t4))) (pr2_free c t3 t4 H1))))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (u0: T).(\lambda (i: nat).(\lambda (H1: (getl i c0 (CHead d (Bind +Abbr) u0))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H2: (pr0 t3 +t4)).(\lambda (t: T).(\lambda (H3: (subst0 i u0 t4 t)).(\lambda (H4: (eq C c0 +(CTail k u c))).(let H5 \def (eq_ind C c0 (\lambda (c1: C).(getl i c1 (CHead +d (Bind Abbr) u0))) H1 (CTail k u c) H4) in (let H_x \def (getl_gen_tail k +Abbr u u0 d c i H5) in (let H6 \def H_x in (or_ind (ex2 C (\lambda (e: C).(eq +C d (CTail k u e))) (\lambda (e: C).(getl i c (CHead e (Bind Abbr) u0)))) +(ex4 nat (\lambda (_: nat).(eq nat i (clen c))) (\lambda (_: nat).(eq K k +(Bind Abbr))) (\lambda (_: nat).(eq T u u0)) (\lambda (n: nat).(eq C d (CSort +n)))) (or (pr2 c t3 t) (ex3 T (\lambda (_: T).(eq K k (Bind Abbr))) (\lambda +(t0: T).(pr0 t3 t0)) (\lambda (t0: T).(subst0 (clen c) u t0 t)))) (\lambda +(H7: (ex2 C (\lambda (e: C).(eq C d (CTail k u e))) (\lambda (e: C).(getl i c +(CHead e (Bind Abbr) u0))))).(ex2_ind C (\lambda (e: C).(eq C d (CTail k u +e))) (\lambda (e: C).(getl i c (CHead e (Bind Abbr) u0))) (or (pr2 c t3 t) +(ex3 T (\lambda (_: T).(eq K k (Bind Abbr))) (\lambda (t0: T).(pr0 t3 t0)) +(\lambda (t0: T).(subst0 (clen c) u t0 t)))) (\lambda (x: C).(\lambda (_: (eq +C d (CTail k u x))).(\lambda (H9: (getl i c (CHead x (Bind Abbr) +u0))).(or_introl (pr2 c t3 t) (ex3 T (\lambda (_: T).(eq K k (Bind Abbr))) +(\lambda (t0: T).(pr0 t3 t0)) (\lambda (t0: T).(subst0 (clen c) u t0 t))) +(pr2_delta c x u0 i H9 t3 t4 H2 t H3))))) H7)) (\lambda (H7: (ex4 nat +(\lambda (_: nat).(eq nat i (clen c))) (\lambda (_: nat).(eq K k (Bind +Abbr))) (\lambda (_: nat).(eq T u u0)) (\lambda (n: nat).(eq C d (CSort +n))))).(ex4_ind nat (\lambda (_: nat).(eq nat i (clen c))) (\lambda (_: +nat).(eq K k (Bind Abbr))) (\lambda (_: nat).(eq T u u0)) (\lambda (n: +nat).(eq C d (CSort n))) (or (pr2 c t3 t) (ex3 T (\lambda (_: T).(eq K k +(Bind Abbr))) (\lambda (t0: T).(pr0 t3 t0)) (\lambda (t0: T).(subst0 (clen c) +u t0 t)))) (\lambda (x0: nat).(\lambda (H8: (eq nat i (clen c))).(\lambda +(H9: (eq K k (Bind Abbr))).(\lambda (H10: (eq T u u0)).(\lambda (_: (eq C d +(CSort x0))).(let H12 \def (eq_ind nat i (\lambda (n: nat).(subst0 n u0 t4 +t)) H3 (clen c) H8) in (let H13 \def (eq_ind_r T u0 (\lambda (t0: T).(subst0 +(clen c) t0 t4 t)) H12 u H10) in (eq_ind_r K (Bind Abbr) (\lambda (k0: K).(or +(pr2 c t3 t) (ex3 T (\lambda (_: T).(eq K k0 (Bind Abbr))) (\lambda (t0: +T).(pr0 t3 t0)) (\lambda (t0: T).(subst0 (clen c) u t0 t))))) (or_intror (pr2 +c t3 t) (ex3 T (\lambda (_: T).(eq K (Bind Abbr) (Bind Abbr))) (\lambda (t0: +T).(pr0 t3 t0)) (\lambda (t0: T).(subst0 (clen c) u t0 t))) (ex3_intro T +(\lambda (_: T).(eq K (Bind Abbr) (Bind Abbr))) (\lambda (t0: T).(pr0 t3 t0)) +(\lambda (t0: T).(subst0 (clen c) u t0 t)) t4 (refl_equal K (Bind Abbr)) H2 +H13)) k H9)))))))) H7)) H6))))))))))))))) y t1 t2 H0))) H)))))). + +theorem pr2_gen_cbind: + \forall (b: B).(\forall (c: C).(\forall (v: T).(\forall (t1: T).(\forall +(t2: T).((pr2 (CHead c (Bind b) v) t1 t2) \to (pr2 c (THead (Bind b) v t1) +(THead (Bind b) v t2))))))) +\def + \lambda (b: B).(\lambda (c: C).(\lambda (v: T).(\lambda (t1: T).(\lambda +(t2: T).(\lambda (H: (pr2 (CHead c (Bind b) v) t1 t2)).(let H0 \def (match H +in pr2 return (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: +(pr2 c0 t t0)).((eq C c0 (CHead c (Bind b) v)) \to ((eq T t t1) \to ((eq T t0 +t2) \to (pr2 c (THead (Bind b) v t1) (THead (Bind b) v t2))))))))) with +[(pr2_free c0 t0 t3 H0) \Rightarrow (\lambda (H1: (eq C c0 (CHead c (Bind b) +v))).(\lambda (H2: (eq T t0 t1)).(\lambda (H3: (eq T t3 t2)).(eq_ind C (CHead +c (Bind b) v) (\lambda (_: C).((eq T t0 t1) \to ((eq T t3 t2) \to ((pr0 t0 +t3) \to (pr2 c (THead (Bind b) v t1) (THead (Bind b) v t2)))))) (\lambda (H4: +(eq T t0 t1)).(eq_ind T t1 (\lambda (t: T).((eq T t3 t2) \to ((pr0 t t3) \to +(pr2 c (THead (Bind b) v t1) (THead (Bind b) v t2))))) (\lambda (H5: (eq T t3 +t2)).(eq_ind T t2 (\lambda (t: T).((pr0 t1 t) \to (pr2 c (THead (Bind b) v +t1) (THead (Bind b) v t2)))) (\lambda (H6: (pr0 t1 t2)).(pr2_free c (THead +(Bind b) v t1) (THead (Bind b) v t2) (pr0_comp v v (pr0_refl v) t1 t2 H6 +(Bind b)))) t3 (sym_eq T t3 t2 H5))) t0 (sym_eq T t0 t1 H4))) c0 (sym_eq C c0 +(CHead c (Bind b) v) H1) H2 H3 H0)))) | (pr2_delta c0 d u i H0 t0 t3 H1 t H2) +\Rightarrow (\lambda (H3: (eq C c0 (CHead c (Bind b) v))).(\lambda (H4: (eq T +t0 t1)).(\lambda (H5: (eq T t t2)).(eq_ind C (CHead c (Bind b) v) (\lambda +(c1: C).((eq T t0 t1) \to ((eq T t t2) \to ((getl i c1 (CHead d (Bind Abbr) +u)) \to ((pr0 t0 t3) \to ((subst0 i u t3 t) \to (pr2 c (THead (Bind b) v t1) +(THead (Bind b) v t2)))))))) (\lambda (H6: (eq T t0 t1)).(eq_ind T t1 +(\lambda (t4: T).((eq T t t2) \to ((getl i (CHead c (Bind b) v) (CHead d +(Bind Abbr) u)) \to ((pr0 t4 t3) \to ((subst0 i u t3 t) \to (pr2 c (THead +(Bind b) v t1) (THead (Bind b) v t2))))))) (\lambda (H7: (eq T t t2)).(eq_ind +T t2 (\lambda (t4: T).((getl i (CHead c (Bind b) v) (CHead d (Bind Abbr) u)) +\to ((pr0 t1 t3) \to ((subst0 i u t3 t4) \to (pr2 c (THead (Bind b) v t1) +(THead (Bind b) v t2)))))) (\lambda (H8: (getl i (CHead c (Bind b) v) (CHead +d (Bind Abbr) u))).(\lambda (H9: (pr0 t1 t3)).(\lambda (H10: (subst0 i u t3 +t2)).(let H_x \def (getl_gen_bind b c (CHead d (Bind Abbr) u) v i H8) in (let +H11 \def H_x in (or_ind (land (eq nat i O) (eq C (CHead d (Bind Abbr) u) +(CHead c (Bind b) v))) (ex2 nat (\lambda (j: nat).(eq nat i (S j))) (\lambda +(j: nat).(getl j c (CHead d (Bind Abbr) u)))) (pr2 c (THead (Bind b) v t1) +(THead (Bind b) v t2)) (\lambda (H12: (land (eq nat i O) (eq C (CHead d (Bind +Abbr) u) (CHead c (Bind b) v)))).(and_ind (eq nat i O) (eq C (CHead d (Bind +Abbr) u) (CHead c (Bind b) v)) (pr2 c (THead (Bind b) v t1) (THead (Bind b) v +t2)) (\lambda (H13: (eq nat i O)).(\lambda (H14: (eq C (CHead d (Bind Abbr) +u) (CHead c (Bind b) v))).(let H15 \def (f_equal C C (\lambda (e: C).(match e +in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c1 _ _) +\Rightarrow c1])) (CHead d (Bind Abbr) u) (CHead c (Bind b) v) H14) in ((let +H16 \def (f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) +with [(CSort _) \Rightarrow Abbr | (CHead _ k _) \Rightarrow (match k in K +return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead c (Bind b) v) H14) in +((let H17 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: +C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t4) \Rightarrow t4])) (CHead +d (Bind Abbr) u) (CHead c (Bind b) v) H14) in (\lambda (H18: (eq B Abbr +b)).(\lambda (_: (eq C d c)).(let H20 \def (eq_ind nat i (\lambda (n: +nat).(subst0 n u t3 t2)) H10 O H13) in (let H21 \def (eq_ind T u (\lambda +(t4: T).(subst0 O t4 t3 t2)) H20 v H17) in (eq_ind B Abbr (\lambda (b0: +B).(pr2 c (THead (Bind b0) v t1) (THead (Bind b0) v t2))) (pr2_free c (THead +(Bind Abbr) v t1) (THead (Bind Abbr) v t2) (pr0_delta v v (pr0_refl v) t1 t3 +H9 t2 H21)) b H18)))))) H16)) H15)))) H12)) (\lambda (H12: (ex2 nat (\lambda +(j: nat).(eq nat i (S j))) (\lambda (j: nat).(getl j c (CHead d (Bind Abbr) +u))))).(ex2_ind nat (\lambda (j: nat).(eq nat i (S j))) (\lambda (j: +nat).(getl j c (CHead d (Bind Abbr) u))) (pr2 c (THead (Bind b) v t1) (THead +(Bind b) v t2)) (\lambda (x: nat).(\lambda (H13: (eq nat i (S x))).(\lambda +(H14: (getl x c (CHead d (Bind Abbr) u))).(let H15 \def (f_equal nat nat +(\lambda (e: nat).e) i (S x) H13) in (let H16 \def (eq_ind nat i (\lambda (n: +nat).(subst0 n u t3 t2)) H10 (S x) H15) in (pr2_head_2 c v t1 t2 (Bind b) +(pr2_delta (CHead c (Bind b) v) d u (S x) (getl_clear_bind b (CHead c (Bind +b) v) c v (clear_bind b c v) (CHead d (Bind Abbr) u) x H14) t1 t3 H9 t2 +H16))))))) H12)) H11)))))) t (sym_eq T t t2 H7))) t0 (sym_eq T t0 t1 H6))) c0 +(sym_eq C c0 (CHead c (Bind b) v) H3) H4 H5 H0 H1 H2))))]) in (H0 (refl_equal +C (CHead c (Bind b) v)) (refl_equal T t1) (refl_equal T t2)))))))). + +theorem pr2_gen_cflat: + \forall (f: F).(\forall (c: C).(\forall (v: T).(\forall (t1: T).(\forall +(t2: T).((pr2 (CHead c (Flat f) v) t1 t2) \to (pr2 c t1 t2)))))) +\def + \lambda (f: F).(\lambda (c: C).(\lambda (v: T).(\lambda (t1: T).(\lambda +(t2: T).(\lambda (H: (pr2 (CHead c (Flat f) v) t1 t2)).(let H0 \def (match H +in pr2 return (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: +(pr2 c0 t t0)).((eq C c0 (CHead c (Flat f) v)) \to ((eq T t t1) \to ((eq T t0 +t2) \to (pr2 c t1 t2)))))))) with [(pr2_free c0 t0 t3 H0) \Rightarrow +(\lambda (H1: (eq C c0 (CHead c (Flat f) v))).(\lambda (H2: (eq T t0 +t1)).(\lambda (H3: (eq T t3 t2)).(eq_ind C (CHead c (Flat f) v) (\lambda (_: +C).((eq T t0 t1) \to ((eq T t3 t2) \to ((pr0 t0 t3) \to (pr2 c t1 t2))))) +(\lambda (H4: (eq T t0 t1)).(eq_ind T t1 (\lambda (t: T).((eq T t3 t2) \to +((pr0 t t3) \to (pr2 c t1 t2)))) (\lambda (H5: (eq T t3 t2)).(eq_ind T t2 +(\lambda (t: T).((pr0 t1 t) \to (pr2 c t1 t2))) (\lambda (H6: (pr0 t1 +t2)).(pr2_free c t1 t2 H6)) t3 (sym_eq T t3 t2 H5))) t0 (sym_eq T t0 t1 H4))) +c0 (sym_eq C c0 (CHead c (Flat f) v) H1) H2 H3 H0)))) | (pr2_delta c0 d u i +H0 t0 t3 H1 t H2) \Rightarrow (\lambda (H3: (eq C c0 (CHead c (Flat f) +v))).(\lambda (H4: (eq T t0 t1)).(\lambda (H5: (eq T t t2)).(eq_ind C (CHead +c (Flat f) v) (\lambda (c1: C).((eq T t0 t1) \to ((eq T t t2) \to ((getl i c1 +(CHead d (Bind Abbr) u)) \to ((pr0 t0 t3) \to ((subst0 i u t3 t) \to (pr2 c +t1 t2))))))) (\lambda (H6: (eq T t0 t1)).(eq_ind T t1 (\lambda (t4: T).((eq T +t t2) \to ((getl i (CHead c (Flat f) v) (CHead d (Bind Abbr) u)) \to ((pr0 t4 +t3) \to ((subst0 i u t3 t) \to (pr2 c t1 t2)))))) (\lambda (H7: (eq T t +t2)).(eq_ind T t2 (\lambda (t4: T).((getl i (CHead c (Flat f) v) (CHead d +(Bind Abbr) u)) \to ((pr0 t1 t3) \to ((subst0 i u t3 t4) \to (pr2 c t1 +t2))))) (\lambda (H8: (getl i (CHead c (Flat f) v) (CHead d (Bind Abbr) +u))).(\lambda (H9: (pr0 t1 t3)).(\lambda (H10: (subst0 i u t3 t2)).(let H_y +\def (getl_gen_flat f c (CHead d (Bind Abbr) u) v i H8) in (pr2_delta c d u i +H_y t1 t3 H9 t2 H10))))) t (sym_eq T t t2 H7))) t0 (sym_eq T t0 t1 H6))) c0 +(sym_eq C c0 (CHead c (Flat f) v) H3) H4 H5 H0 H1 H2))))]) in (H0 (refl_equal +C (CHead c (Flat f) v)) (refl_equal T t1) (refl_equal T t2)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/defs.ma new file mode 100644 index 000000000..77932c984 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/defs.ma @@ -0,0 +1,30 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr2/defs". + +include "pr0/defs.ma". + +include "getl/defs.ma". + +inductive pr2: C \to (T \to (T \to Prop)) \def +| pr2_free: \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr0 t1 t2) \to +(pr2 c t1 t2)))) +| pr2_delta: \forall (c: C).(\forall (d: C).(\forall (u: T).(\forall (i: +nat).((getl i c (CHead d (Bind Abbr) u)) \to (\forall (t1: T).(\forall (t2: +T).((pr0 t1 t2) \to (\forall (t: T).((subst0 i u t2 t) \to (pr2 c t1 +t)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/fwd.ma new file mode 100644 index 000000000..848d216fa --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/fwd.ma @@ -0,0 +1,3630 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr2/fwd". + +include "pr2/defs.ma". + +include "pr0/fwd.ma". + +include "getl/drop.ma". + +include "getl/clear.ma". + +theorem pr2_gen_sort: + \forall (c: C).(\forall (x: T).(\forall (n: nat).((pr2 c (TSort n) x) \to +(eq T x (TSort n))))) +\def + \lambda (c: C).(\lambda (x: T).(\lambda (n: nat).(\lambda (H: (pr2 c (TSort +n) x)).(let H0 \def (match H in pr2 return (\lambda (c0: C).(\lambda (t: +T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 c) \to ((eq T t +(TSort n)) \to ((eq T t0 x) \to (eq T x (TSort n))))))))) with [(pr2_free c0 +t1 t2 H0) \Rightarrow (\lambda (H1: (eq C c0 c)).(\lambda (H2: (eq T t1 +(TSort n))).(\lambda (H3: (eq T t2 x)).(eq_ind C c (\lambda (_: C).((eq T t1 +(TSort n)) \to ((eq T t2 x) \to ((pr0 t1 t2) \to (eq T x (TSort n)))))) +(\lambda (H4: (eq T t1 (TSort n))).(eq_ind T (TSort n) (\lambda (t: T).((eq T +t2 x) \to ((pr0 t t2) \to (eq T x (TSort n))))) (\lambda (H5: (eq T t2 +x)).(eq_ind T x (\lambda (t: T).((pr0 (TSort n) t) \to (eq T x (TSort n)))) +(\lambda (H6: (pr0 (TSort n) x)).(let H7 \def (eq_ind T x (\lambda (t: +T).(pr2 c (TSort n) t)) H (TSort n) (pr0_gen_sort x n H6)) in (eq_ind_r T +(TSort n) (\lambda (t: T).(eq T t (TSort n))) (refl_equal T (TSort n)) x +(pr0_gen_sort x n H6)))) t2 (sym_eq T t2 x H5))) t1 (sym_eq T t1 (TSort n) +H4))) c0 (sym_eq C c0 c H1) H2 H3 H0)))) | (pr2_delta c0 d u i H0 t1 t2 H1 t +H2) \Rightarrow (\lambda (H3: (eq C c0 c)).(\lambda (H4: (eq T t1 (TSort +n))).(\lambda (H5: (eq T t x)).(eq_ind C c (\lambda (c1: C).((eq T t1 (TSort +n)) \to ((eq T t x) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 t1 t2) +\to ((subst0 i u t2 t) \to (eq T x (TSort n)))))))) (\lambda (H6: (eq T t1 +(TSort n))).(eq_ind T (TSort n) (\lambda (t0: T).((eq T t x) \to ((getl i c +(CHead d (Bind Abbr) u)) \to ((pr0 t0 t2) \to ((subst0 i u t2 t) \to (eq T x +(TSort n))))))) (\lambda (H7: (eq T t x)).(eq_ind T x (\lambda (t0: T).((getl +i c (CHead d (Bind Abbr) u)) \to ((pr0 (TSort n) t2) \to ((subst0 i u t2 t0) +\to (eq T x (TSort n)))))) (\lambda (_: (getl i c (CHead d (Bind Abbr) +u))).(\lambda (H9: (pr0 (TSort n) t2)).(\lambda (H10: (subst0 i u t2 x)).(let +H11 \def (eq_ind T t2 (\lambda (t0: T).(subst0 i u t0 x)) H10 (TSort n) +(pr0_gen_sort t2 n H9)) in (subst0_gen_sort u x i n H11 (eq T x (TSort +n))))))) t (sym_eq T t x H7))) t1 (sym_eq T t1 (TSort n) H6))) c0 (sym_eq C +c0 c H3) H4 H5 H0 H1 H2))))]) in (H0 (refl_equal C c) (refl_equal T (TSort +n)) (refl_equal T x)))))). + +theorem pr2_gen_lref: + \forall (c: C).(\forall (x: T).(\forall (n: nat).((pr2 c (TLRef n) x) \to +(or (eq T x (TLRef n)) (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl n c +(CHead d (Bind Abbr) u)))) (\lambda (_: C).(\lambda (u: T).(eq T x (lift (S +n) O u))))))))) +\def + \lambda (c: C).(\lambda (x: T).(\lambda (n: nat).(\lambda (H: (pr2 c (TLRef +n) x)).(let H0 \def (match H in pr2 return (\lambda (c0: C).(\lambda (t: +T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 c) \to ((eq T t +(TLRef n)) \to ((eq T t0 x) \to (or (eq T x (TLRef n)) (ex2_2 C T (\lambda +(d: C).(\lambda (u: T).(getl n c (CHead d (Bind Abbr) u)))) (\lambda (_: +C).(\lambda (u: T).(eq T x (lift (S n) O u))))))))))))) with [(pr2_free c0 t1 +t2 H0) \Rightarrow (\lambda (H1: (eq C c0 c)).(\lambda (H2: (eq T t1 (TLRef +n))).(\lambda (H3: (eq T t2 x)).(eq_ind C c (\lambda (_: C).((eq T t1 (TLRef +n)) \to ((eq T t2 x) \to ((pr0 t1 t2) \to (or (eq T x (TLRef n)) (ex2_2 C T +(\lambda (d: C).(\lambda (u: T).(getl n c (CHead d (Bind Abbr) u)))) (\lambda +(_: C).(\lambda (u: T).(eq T x (lift (S n) O u)))))))))) (\lambda (H4: (eq T +t1 (TLRef n))).(eq_ind T (TLRef n) (\lambda (t: T).((eq T t2 x) \to ((pr0 t +t2) \to (or (eq T x (TLRef n)) (ex2_2 C T (\lambda (d: C).(\lambda (u: +T).(getl n c (CHead d (Bind Abbr) u)))) (\lambda (_: C).(\lambda (u: T).(eq T +x (lift (S n) O u))))))))) (\lambda (H5: (eq T t2 x)).(eq_ind T x (\lambda +(t: T).((pr0 (TLRef n) t) \to (or (eq T x (TLRef n)) (ex2_2 C T (\lambda (d: +C).(\lambda (u: T).(getl n c (CHead d (Bind Abbr) u)))) (\lambda (_: +C).(\lambda (u: T).(eq T x (lift (S n) O u)))))))) (\lambda (H6: (pr0 (TLRef +n) x)).(let H7 \def (eq_ind T x (\lambda (t: T).(pr2 c (TLRef n) t)) H (TLRef +n) (pr0_gen_lref x n H6)) in (eq_ind_r T (TLRef n) (\lambda (t: T).(or (eq T +t (TLRef n)) (ex2_2 C T (\lambda (d: C).(\lambda (u: T).(getl n c (CHead d +(Bind Abbr) u)))) (\lambda (_: C).(\lambda (u: T).(eq T t (lift (S n) O +u))))))) (or_introl (eq T (TLRef n) (TLRef n)) (ex2_2 C T (\lambda (d: +C).(\lambda (u: T).(getl n c (CHead d (Bind Abbr) u)))) (\lambda (_: +C).(\lambda (u: T).(eq T (TLRef n) (lift (S n) O u))))) (refl_equal T (TLRef +n))) x (pr0_gen_lref x n H6)))) t2 (sym_eq T t2 x H5))) t1 (sym_eq T t1 +(TLRef n) H4))) c0 (sym_eq C c0 c H1) H2 H3 H0)))) | (pr2_delta c0 d u i H0 +t1 t2 H1 t H2) \Rightarrow (\lambda (H3: (eq C c0 c)).(\lambda (H4: (eq T t1 +(TLRef n))).(\lambda (H5: (eq T t x)).(eq_ind C c (\lambda (c1: C).((eq T t1 +(TLRef n)) \to ((eq T t x) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 +t1 t2) \to ((subst0 i u t2 t) \to (or (eq T x (TLRef n)) (ex2_2 C T (\lambda +(d0: C).(\lambda (u0: T).(getl n c (CHead d0 (Bind Abbr) u0)))) (\lambda (_: +C).(\lambda (u0: T).(eq T x (lift (S n) O u0)))))))))))) (\lambda (H6: (eq T +t1 (TLRef n))).(eq_ind T (TLRef n) (\lambda (t0: T).((eq T t x) \to ((getl i +c (CHead d (Bind Abbr) u)) \to ((pr0 t0 t2) \to ((subst0 i u t2 t) \to (or +(eq T x (TLRef n)) (ex2_2 C T (\lambda (d0: C).(\lambda (u0: T).(getl n c +(CHead d0 (Bind Abbr) u0)))) (\lambda (_: C).(\lambda (u0: T).(eq T x (lift +(S n) O u0))))))))))) (\lambda (H7: (eq T t x)).(eq_ind T x (\lambda (t0: +T).((getl i c (CHead d (Bind Abbr) u)) \to ((pr0 (TLRef n) t2) \to ((subst0 i +u t2 t0) \to (or (eq T x (TLRef n)) (ex2_2 C T (\lambda (d0: C).(\lambda (u0: +T).(getl n c (CHead d0 (Bind Abbr) u0)))) (\lambda (_: C).(\lambda (u0: +T).(eq T x (lift (S n) O u0)))))))))) (\lambda (H8: (getl i c (CHead d (Bind +Abbr) u))).(\lambda (H9: (pr0 (TLRef n) t2)).(\lambda (H10: (subst0 i u t2 +x)).(let H11 \def (eq_ind T t2 (\lambda (t0: T).(subst0 i u t0 x)) H10 (TLRef +n) (pr0_gen_lref t2 n H9)) in (and_ind (eq nat n i) (eq T x (lift (S n) O u)) +(or (eq T x (TLRef n)) (ex2_2 C T (\lambda (d0: C).(\lambda (u0: T).(getl n c +(CHead d0 (Bind Abbr) u0)))) (\lambda (_: C).(\lambda (u0: T).(eq T x (lift +(S n) O u0)))))) (\lambda (H12: (eq nat n i)).(\lambda (H13: (eq T x (lift (S +n) O u))).(let H14 \def (eq_ind_r nat i (\lambda (n0: nat).(getl n0 c (CHead +d (Bind Abbr) u))) H8 n H12) in (let H15 \def (eq_ind T x (\lambda (t0: +T).(pr2 c (TLRef n) t0)) H (lift (S n) O u) H13) in (eq_ind_r T (lift (S n) O +u) (\lambda (t0: T).(or (eq T t0 (TLRef n)) (ex2_2 C T (\lambda (d0: +C).(\lambda (u0: T).(getl n c (CHead d0 (Bind Abbr) u0)))) (\lambda (_: +C).(\lambda (u0: T).(eq T t0 (lift (S n) O u0))))))) (or_intror (eq T (lift +(S n) O u) (TLRef n)) (ex2_2 C T (\lambda (d0: C).(\lambda (u0: T).(getl n c +(CHead d0 (Bind Abbr) u0)))) (\lambda (_: C).(\lambda (u0: T).(eq T (lift (S +n) O u) (lift (S n) O u0))))) (ex2_2_intro C T (\lambda (d0: C).(\lambda (u0: +T).(getl n c (CHead d0 (Bind Abbr) u0)))) (\lambda (_: C).(\lambda (u0: +T).(eq T (lift (S n) O u) (lift (S n) O u0)))) d u H14 (refl_equal T (lift (S +n) O u)))) x H13))))) (subst0_gen_lref u x i n H11)))))) t (sym_eq T t x +H7))) t1 (sym_eq T t1 (TLRef n) H6))) c0 (sym_eq C c0 c H3) H4 H5 H0 H1 +H2))))]) in (H0 (refl_equal C c) (refl_equal T (TLRef n)) (refl_equal T +x)))))). + +theorem pr2_gen_abst: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr2 c +(THead (Bind Abst) u1 t1) x) \to (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 t2)))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr2 c (THead (Bind Abst) u1 t1) x)).(let H0 \def (match H in pr2 return +(\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t +t0)).((eq C c0 c) \to ((eq T t (THead (Bind Abst) u1 t1)) \to ((eq T t0 x) +\to (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind Abst) +u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +t1 t2))))))))))))) with [(pr2_free c0 t0 t2 H0) \Rightarrow (\lambda (H1: (eq +C c0 c)).(\lambda (H2: (eq T t0 (THead (Bind Abst) u1 t1))).(\lambda (H3: (eq +T t2 x)).(eq_ind C c (\lambda (_: C).((eq T t0 (THead (Bind Abst) u1 t1)) \to +((eq T t2 x) \to ((pr0 t0 t2) \to (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 t3)))))))))) (\lambda (H4: (eq T t0 (THead +(Bind Abst) u1 t1))).(eq_ind T (THead (Bind Abst) u1 t1) (\lambda (t: T).((eq +T t2 x) \to ((pr0 t t2) \to (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq +T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) t1 t3))))))))) (\lambda (H5: (eq T t2 x)).(eq_ind T x +(\lambda (t: T).((pr0 (THead (Bind Abst) u1 t1) t) \to (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3)))))))) (\lambda (H6: +(pr0 (THead (Bind Abst) u1 t1) x)).(ex3_2_ind T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3))) (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3)))))) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (H7: (eq T x (THead (Bind Abst) x0 +x1))).(\lambda (H8: (pr0 u1 x0)).(\lambda (H9: (pr0 t1 x1)).(let H10 \def +(eq_ind T x (\lambda (t: T).(pr2 c (THead (Bind Abst) u1 t1) t)) H (THead +(Bind Abst) x0 x1) H7) in (eq_ind_r T (THead (Bind Abst) x0 x1) (\lambda (t: +T).(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t (THead (Bind Abst) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +t1 t3))))))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead +(Bind Abst) x0 x1) (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) t1 t3))))) x0 x1 (refl_equal T (THead (Bind +Abst) x0 x1)) (pr2_free c u1 x0 H8) (\lambda (b: B).(\lambda (u: T).(pr2_free +(CHead c (Bind b) u) t1 x1 H9)))) x H7))))))) (pr0_gen_abst u1 t1 x H6))) t2 +(sym_eq T t2 x H5))) t0 (sym_eq T t0 (THead (Bind Abst) u1 t1) H4))) c0 +(sym_eq C c0 c H1) H2 H3 H0)))) | (pr2_delta c0 d u i H0 t0 t2 H1 t H2) +\Rightarrow (\lambda (H3: (eq C c0 c)).(\lambda (H4: (eq T t0 (THead (Bind +Abst) u1 t1))).(\lambda (H5: (eq T t x)).(eq_ind C c (\lambda (c1: C).((eq T +t0 (THead (Bind Abst) u1 t1)) \to ((eq T t x) \to ((getl i c1 (CHead d (Bind +Abbr) u)) \to ((pr0 t0 t2) \to ((subst0 i u t2 t) \to (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))))))))) (\lambda +(H6: (eq T t0 (THead (Bind Abst) u1 t1))).(eq_ind T (THead (Bind Abst) u1 t1) +(\lambda (t3: T).((eq T t x) \to ((getl i c (CHead d (Bind Abbr) u)) \to +((pr0 t3 t2) \to ((subst0 i u t2 t) \to (ex3_2 T T (\lambda (u2: T).(\lambda +(t4: T).(eq T x (THead (Bind Abst) u2 t4)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t4))))))))))) (\lambda (H7: (eq T t +x)).(eq_ind T x (\lambda (t3: T).((getl i c (CHead d (Bind Abbr) u)) \to +((pr0 (THead (Bind Abst) u1 t1) t2) \to ((subst0 i u t2 t3) \to (ex3_2 T T +(\lambda (u2: T).(\lambda (t4: T).(eq T x (THead (Bind Abst) u2 t4)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t4: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +t4)))))))))) (\lambda (H8: (getl i c (CHead d (Bind Abbr) u))).(\lambda (H9: +(pr0 (THead (Bind Abst) u1 t1) t2)).(\lambda (H10: (subst0 i u t2 +x)).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind +Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr0 t1 t3))) (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H11: (eq T t2 (THead (Bind Abst) x0 x1))).(\lambda (H12: (pr0 u1 +x0)).(\lambda (H13: (pr0 t1 x1)).(let H14 \def (eq_ind T t2 (\lambda (t3: +T).(subst0 i u t3 x)) H10 (THead (Bind Abst) x0 x1) H11) in (or3_ind (ex2 T +(\lambda (u2: T).(eq T x (THead (Bind Abst) u2 x1))) (\lambda (u2: T).(subst0 +i u x0 u2))) (ex2 T (\lambda (t3: T).(eq T x (THead (Bind Abst) x0 t3))) +(\lambda (t3: T).(subst0 (s (Bind Abst) i) u x1 t3))) (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind Abst) i) u x1 t3)))) (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\lambda (H15: (ex2 T (\lambda +(u2: T).(eq T x (THead (Bind Abst) u2 x1))) (\lambda (u2: T).(subst0 i u x0 +u2)))).(ex2_ind T (\lambda (u2: T).(eq T x (THead (Bind Abst) u2 x1))) +(\lambda (u2: T).(subst0 i u x0 u2)) (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\lambda (x2: T).(\lambda +(H16: (eq T x (THead (Bind Abst) x2 x1))).(\lambda (H17: (subst0 i u x0 +x2)).(let H18 \def (eq_ind T x (\lambda (t3: T).(pr2 c (THead (Bind Abst) u1 +t1) t3)) H (THead (Bind Abst) x2 x1) H16) in (eq_ind_r T (THead (Bind Abst) +x2 x1) (\lambda (t3: T).(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 +(THead (Bind Abst) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead +c (Bind b) u0) t1 t4))))))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind Abst) x2 x1) (THead (Bind Abst) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))))) x2 x1 +(refl_equal T (THead (Bind Abst) x2 x1)) (pr2_delta c d u i H8 u1 x0 H12 x2 +H17) (\lambda (b: B).(\lambda (u0: T).(pr2_free (CHead c (Bind b) u0) t1 x1 +H13)))) x H16))))) H15)) (\lambda (H15: (ex2 T (\lambda (t3: T).(eq T x +(THead (Bind Abst) x0 t3))) (\lambda (t3: T).(subst0 (s (Bind Abst) i) u x1 +t3)))).(ex2_ind T (\lambda (t3: T).(eq T x (THead (Bind Abst) x0 t3))) +(\lambda (t3: T).(subst0 (s (Bind Abst) i) u x1 t3)) (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\lambda (x2: +T).(\lambda (H16: (eq T x (THead (Bind Abst) x0 x2))).(\lambda (H17: (subst0 +(s (Bind Abst) i) u x1 x2)).(let H18 \def (eq_ind T x (\lambda (t3: T).(pr2 c +(THead (Bind Abst) u1 t1) t3)) H (THead (Bind Abst) x0 x2) H16) in (eq_ind_r +T (THead (Bind Abst) x0 x2) (\lambda (t3: T).(ex3_2 T T (\lambda (u2: +T).(\lambda (t4: T).(eq T t3 (THead (Bind Abst) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t4))))))) (ex3_2_intro +T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind Abst) x0 x2) (THead +(Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead +c (Bind b) u0) t1 t3))))) x0 x2 (refl_equal T (THead (Bind Abst) x0 x2)) +(pr2_free c u1 x0 H12) (\lambda (b: B).(\lambda (u0: T).(pr2_delta (CHead c +(Bind b) u0) d u (S i) (getl_head (Bind b) i c (CHead d (Bind Abbr) u) H8 u0) +t1 x1 H13 x2 H17)))) x H16))))) H15)) (\lambda (H15: (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind Abst) i) u x1 t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind Abst) i) u x1 t3))) (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\lambda (x2: T).(\lambda (x3: +T).(\lambda (H16: (eq T x (THead (Bind Abst) x2 x3))).(\lambda (H17: (subst0 +i u x0 x2)).(\lambda (H18: (subst0 (s (Bind Abst) i) u x1 x3)).(let H19 \def +(eq_ind T x (\lambda (t3: T).(pr2 c (THead (Bind Abst) u1 t1) t3)) H (THead +(Bind Abst) x2 x3) H16) in (eq_ind_r T (THead (Bind Abst) x2 x3) (\lambda +(t3: T).(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind +Abst) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t4: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) t1 t4))))))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Bind Abst) x2 x3) (THead (Bind Abst) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))))) x2 x3 +(refl_equal T (THead (Bind Abst) x2 x3)) (pr2_delta c d u i H8 u1 x0 H12 x2 +H17) (\lambda (b: B).(\lambda (u0: T).(pr2_delta (CHead c (Bind b) u0) d u (S +i) (getl_head (Bind b) i c (CHead d (Bind Abbr) u) H8 u0) t1 x1 H13 x3 +H18)))) x H16))))))) H15)) (subst0_gen_head (Bind Abst) u x0 x1 x i +H14)))))))) (pr0_gen_abst u1 t1 t2 H9))))) t (sym_eq T t x H7))) t0 (sym_eq T +t0 (THead (Bind Abst) u1 t1) H6))) c0 (sym_eq C c0 c H3) H4 H5 H0 H1 H2))))]) +in (H0 (refl_equal C c) (refl_equal T (THead (Bind Abst) u1 t1)) (refl_equal +T x))))))). + +theorem pr2_gen_cast: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr2 c +(THead (Flat Cast) u1 t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Flat Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr2 c t1 t2)))) (pr2 c +t1 x)))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr2 c (THead (Flat Cast) u1 t1) x)).(let H0 \def (match H in pr2 return +(\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t +t0)).((eq C c0 c) \to ((eq T t (THead (Flat Cast) u1 t1)) \to ((eq T t0 x) +\to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Flat +Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr2 c t1 t2)))) (pr2 c t1 x))))))))) with [(pr2_free c0 +t0 t2 H0) \Rightarrow (\lambda (H1: (eq C c0 c)).(\lambda (H2: (eq T t0 +(THead (Flat Cast) u1 t1))).(\lambda (H3: (eq T t2 x)).(eq_ind C c (\lambda +(_: C).((eq T t0 (THead (Flat Cast) u1 t1)) \to ((eq T t2 x) \to ((pr0 t0 t2) +\to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat +Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c t1 x)))))) (\lambda (H4: (eq T t0 +(THead (Flat Cast) u1 t1))).(eq_ind T (THead (Flat Cast) u1 t1) (\lambda (t: +T).((eq T t2 x) \to ((pr0 t t2) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c +t1 x))))) (\lambda (H5: (eq T t2 x)).(eq_ind T x (\lambda (t: T).((pr0 (THead +(Flat Cast) u1 t1) t) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c t1 x)))) +(\lambda (H6: (pr0 (THead (Flat Cast) u1 t1) x)).(or_ind (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3)))) (pr0 t1 x) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c t1 x)) (\lambda (H7: +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr0 t1 t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3))) (or (ex3_2 T +T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c t1 t3)))) (pr2 c t1 x)) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H8: (eq T x (THead (Flat Cast) x0 x1))).(\lambda (H9: (pr0 u1 +x0)).(\lambda (H10: (pr0 t1 x1)).(let H11 \def (eq_ind T x (\lambda (t: +T).(pr2 c (THead (Flat Cast) u1 t1) t)) H (THead (Flat Cast) x0 x1) H8) in +(eq_ind_r T (THead (Flat Cast) x0 x1) (\lambda (t: T).(or (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T t (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3)))) (pr2 c t1 t))) (or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Flat Cast) x0 x1) (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3)))) (pr2 c t1 (THead (Flat Cast) x0 x1)) (ex3_2_intro T T (\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Flat Cast) x0 x1) (THead (Flat Cast) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3))) x0 x1 (refl_equal T (THead (Flat Cast) x0 +x1)) (pr2_free c u1 x0 H9) (pr2_free c t1 x1 H10))) x H8))))))) H7)) (\lambda +(H7: (pr0 t1 x)).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq +T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c t1 x) +(pr2_free c t1 x H7))) (pr0_gen_cast u1 t1 x H6))) t2 (sym_eq T t2 x H5))) t0 +(sym_eq T t0 (THead (Flat Cast) u1 t1) H4))) c0 (sym_eq C c0 c H1) H2 H3 +H0)))) | (pr2_delta c0 d u i H0 t0 t2 H1 t H2) \Rightarrow (\lambda (H3: (eq +C c0 c)).(\lambda (H4: (eq T t0 (THead (Flat Cast) u1 t1))).(\lambda (H5: (eq +T t x)).(eq_ind C c (\lambda (c1: C).((eq T t0 (THead (Flat Cast) u1 t1)) \to +((eq T t x) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 t0 t2) \to +((subst0 i u t2 t) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +x (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c t1 x)))))))) +(\lambda (H6: (eq T t0 (THead (Flat Cast) u1 t1))).(eq_ind T (THead (Flat +Cast) u1 t1) (\lambda (t3: T).((eq T t x) \to ((getl i c (CHead d (Bind Abbr) +u)) \to ((pr0 t3 t2) \to ((subst0 i u t2 t) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t4: T).(eq T x (THead (Flat Cast) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c t1 +t4)))) (pr2 c t1 x))))))) (\lambda (H7: (eq T t x)).(eq_ind T x (\lambda (t3: +T).((getl i c (CHead d (Bind Abbr) u)) \to ((pr0 (THead (Flat Cast) u1 t1) +t2) \to ((subst0 i u t2 t3) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t4: +T).(eq T x (THead (Flat Cast) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c t1 t4)))) (pr2 c t1 +x)))))) (\lambda (H8: (getl i c (CHead d (Bind Abbr) u))).(\lambda (H9: (pr0 +(THead (Flat Cast) u1 t1) t2)).(\lambda (H10: (subst0 i u t2 x)).(or_ind +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Cast) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr0 t1 t3)))) (pr0 t1 t2) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3)))) (pr2 c t1 x)) (\lambda (H11: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T t2 (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3))))).(ex3_2_ind +T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Cast) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: +T).(pr0 t1 t3))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c t1 x)) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H12: (eq T t2 (THead (Flat Cast) x0 +x1))).(\lambda (H13: (pr0 u1 x0)).(\lambda (H14: (pr0 t1 x1)).(let H15 \def +(eq_ind T t2 (\lambda (t3: T).(subst0 i u t3 x)) H10 (THead (Flat Cast) x0 +x1) H12) in (or3_ind (ex2 T (\lambda (u2: T).(eq T x (THead (Flat Cast) u2 +x1))) (\lambda (u2: T).(subst0 i u x0 u2))) (ex2 T (\lambda (t3: T).(eq T x +(THead (Flat Cast) x0 t3))) (\lambda (t3: T).(subst0 (s (Flat Cast) i) u x1 +t3))) (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Flat Cast) i) u x1 t3)))) (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c t1 t3)))) (pr2 c t1 x)) (\lambda (H16: (ex2 T (\lambda (u2: +T).(eq T x (THead (Flat Cast) u2 x1))) (\lambda (u2: T).(subst0 i u x0 +u2)))).(ex2_ind T (\lambda (u2: T).(eq T x (THead (Flat Cast) u2 x1))) +(\lambda (u2: T).(subst0 i u x0 u2)) (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c +t1 x)) (\lambda (x2: T).(\lambda (H17: (eq T x (THead (Flat Cast) x2 +x1))).(\lambda (H18: (subst0 i u x0 x2)).(or_introl (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3)))) (pr2 c t1 x) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T +x (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3))) x2 x1 H17 (pr2_delta c +d u i H8 u1 x0 H13 x2 H18) (pr2_free c t1 x1 H14)))))) H16)) (\lambda (H16: +(ex2 T (\lambda (t3: T).(eq T x (THead (Flat Cast) x0 t3))) (\lambda (t3: +T).(subst0 (s (Flat Cast) i) u x1 t3)))).(ex2_ind T (\lambda (t3: T).(eq T x +(THead (Flat Cast) x0 t3))) (\lambda (t3: T).(subst0 (s (Flat Cast) i) u x1 +t3)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat +Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c t1 x)) (\lambda (x2: T).(\lambda +(H17: (eq T x (THead (Flat Cast) x0 x2))).(\lambda (H18: (subst0 (s (Flat +Cast) i) u x1 x2)).(or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c t1 x) +(ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3))) x0 x2 H17 (pr2_free c u1 x0 H13) +(pr2_delta c d u i H8 t1 x1 H14 x2 H18)))))) H16)) (\lambda (H16: (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Flat Cast) i) u x1 t3))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Flat Cast) i) u x1 t3))) (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c t1 t3)))) (pr2 c t1 x)) (\lambda (x2: T).(\lambda (x3: +T).(\lambda (H17: (eq T x (THead (Flat Cast) x2 x3))).(\lambda (H18: (subst0 +i u x0 x2)).(\lambda (H19: (subst0 (s (Flat Cast) i) u x1 x3)).(or_introl +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (pr2 c t1 x) (ex3_2_intro T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3))) x2 x3 H17 (pr2_delta c d u i H8 u1 x0 H13 x2 H18) (pr2_delta c d u i H8 +t1 x1 H14 x3 H19)))))))) H16)) (subst0_gen_head (Flat Cast) u x0 x1 x i +H15)))))))) H11)) (\lambda (H11: (pr0 t1 t2)).(or_intror (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3)))) (pr2 c t1 x) (pr2_delta c d u i H8 t1 t2 H11 x H10))) (pr0_gen_cast u1 +t1 t2 H9))))) t (sym_eq T t x H7))) t0 (sym_eq T t0 (THead (Flat Cast) u1 t1) +H6))) c0 (sym_eq C c0 c H3) H4 H5 H0 H1 H2))))]) in (H0 (refl_equal C c) +(refl_equal T (THead (Flat Cast) u1 t1)) (refl_equal T x))))))). + +theorem pr2_gen_csort: + \forall (t1: T).(\forall (t2: T).(\forall (n: nat).((pr2 (CSort n) t1 t2) +\to (pr0 t1 t2)))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (n: nat).(\lambda (H: (pr2 (CSort +n) t1 t2)).(let H0 \def (match H in pr2 return (\lambda (c: C).(\lambda (t: +T).(\lambda (t0: T).(\lambda (_: (pr2 c t t0)).((eq C c (CSort n)) \to ((eq T +t t1) \to ((eq T t0 t2) \to (pr0 t1 t2)))))))) with [(pr2_free c t0 t3 H0) +\Rightarrow (\lambda (H1: (eq C c (CSort n))).(\lambda (H2: (eq T t0 +t1)).(\lambda (H3: (eq T t3 t2)).(eq_ind C (CSort n) (\lambda (_: C).((eq T +t0 t1) \to ((eq T t3 t2) \to ((pr0 t0 t3) \to (pr0 t1 t2))))) (\lambda (H4: +(eq T t0 t1)).(eq_ind T t1 (\lambda (t: T).((eq T t3 t2) \to ((pr0 t t3) \to +(pr0 t1 t2)))) (\lambda (H5: (eq T t3 t2)).(eq_ind T t2 (\lambda (t: T).((pr0 +t1 t) \to (pr0 t1 t2))) (\lambda (H6: (pr0 t1 t2)).H6) t3 (sym_eq T t3 t2 +H5))) t0 (sym_eq T t0 t1 H4))) c (sym_eq C c (CSort n) H1) H2 H3 H0)))) | +(pr2_delta c d u i H0 t0 t3 H1 t H2) \Rightarrow (\lambda (H3: (eq C c (CSort +n))).(\lambda (H4: (eq T t0 t1)).(\lambda (H5: (eq T t t2)).(eq_ind C (CSort +n) (\lambda (c0: C).((eq T t0 t1) \to ((eq T t t2) \to ((getl i c0 (CHead d +(Bind Abbr) u)) \to ((pr0 t0 t3) \to ((subst0 i u t3 t) \to (pr0 t1 t2))))))) +(\lambda (H6: (eq T t0 t1)).(eq_ind T t1 (\lambda (t4: T).((eq T t t2) \to +((getl i (CSort n) (CHead d (Bind Abbr) u)) \to ((pr0 t4 t3) \to ((subst0 i u +t3 t) \to (pr0 t1 t2)))))) (\lambda (H7: (eq T t t2)).(eq_ind T t2 (\lambda +(t4: T).((getl i (CSort n) (CHead d (Bind Abbr) u)) \to ((pr0 t1 t3) \to +((subst0 i u t3 t4) \to (pr0 t1 t2))))) (\lambda (H8: (getl i (CSort n) +(CHead d (Bind Abbr) u))).(\lambda (_: (pr0 t1 t3)).(\lambda (_: (subst0 i u +t3 t2)).(getl_gen_sort n i (CHead d (Bind Abbr) u) H8 (pr0 t1 t2))))) t +(sym_eq T t t2 H7))) t0 (sym_eq T t0 t1 H6))) c (sym_eq C c (CSort n) H3) H4 +H5 H0 H1 H2))))]) in (H0 (refl_equal C (CSort n)) (refl_equal T t1) +(refl_equal T t2)))))). + +theorem pr2_gen_appl: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr2 c +(THead (Flat Appl) u1 t1) x) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr2 c t1 t2)))) (ex4_4 T +T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (t2: T).(eq T x (THead (Bind Abbr) u2 t2)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq +T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead +(Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr2 c (THead (Flat Appl) u1 t1) x)).(let H0 \def (match H in pr2 return +(\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t +t0)).((eq C c0 c) \to ((eq T t (THead (Flat Appl) u1 t1)) \to ((eq T t0 x) +\to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Flat +Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr2 c t1 t2)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Abbr) u2 t2)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))))))))) with [(pr2_free c0 +t0 t2 H0) \Rightarrow (\lambda (H1: (eq C c0 c)).(\lambda (H2: (eq T t0 +(THead (Flat Appl) u1 t1))).(\lambda (H3: (eq T t2 x)).(eq_ind C c (\lambda +(_: C).((eq T t0 (THead (Flat Appl) u1 t1)) \to ((eq T t2 x) \to ((pr0 t0 t2) +\to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat +Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))))))) (\lambda (H4: (eq T t0 +(THead (Flat Appl) u1 t1))).(eq_ind T (THead (Flat Appl) u1 t1) (\lambda (t: +T).((eq T t2 x) \to ((pr0 t t2) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T +T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq +T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead +(Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))))) (\lambda +(H5: (eq T t2 x)).(eq_ind T x (\lambda (t: T).((pr0 (THead (Flat Appl) u1 t1) +t) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat +Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))))) (\lambda (H6: (pr0 (THead +(Flat Appl) u1 t1) x)).(or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 +u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(pr0 z1 t3)))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t3: T).(eq T x +(THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O u2) t3))))))))) (\lambda +(_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(\lambda (_: T).(pr0 u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 +v2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (t3: T).(pr0 z1 t3)))))))) (or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (H7: (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: +T).(pr0 t1 t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3))) (or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T x (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H8: (eq T x +(THead (Flat Appl) x0 x1))).(\lambda (H9: (pr0 u1 x0)).(\lambda (H10: (pr0 t1 +x1)).(eq_ind_r T (THead (Flat Appl) x0 x1) (\lambda (t: T).(or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T t (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T t +(THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) (or3_intro0 (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Flat Appl) x0 x1) (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Flat Appl) x0 x1) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Flat Appl) x0 x1) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2)))))))) (ex3_2_intro T T (\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Flat Appl) x0 x1) (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3))) x0 x1 (refl_equal T (THead (Flat Appl) x0 +x1)) (pr2_free c u1 x0 H9) (pr2_free c t1 x1 H10))) x H8)))))) H7)) (\lambda +(H7: (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(pr0 z1 t3))))))).(ex4_4_ind T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t3: T).(pr0 z1 t3))))) (or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x0: T).(\lambda +(x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H8: (eq T t1 (THead (Bind +Abst) x0 x1))).(\lambda (H9: (eq T x (THead (Bind Abbr) x2 x3))).(\lambda +(H10: (pr0 u1 x2)).(\lambda (H11: (pr0 x1 x3)).(eq_ind_r T (THead (Bind Abbr) +x2 x3) (\lambda (t: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq +T t (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T t (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq +T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t (THead +(Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) (eq_ind_r +T (THead (Bind Abst) x0 x1) (\lambda (t: T).(or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind Abbr) x2 x3) (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind Abbr) x2 x3) (THead (Bind Abbr) u2 t3)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq +T t (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind +Abbr) x2 x3) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))))) (or3_intro1 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind Abbr) x2 x3) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind Abst) x0 x1) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind Abbr) x2 x3) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind b) y1 +z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: +T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind Abbr) x2 x3) (THead +(Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) (ex4_4_intro +T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Bind Abst) x0 x1) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind Abbr) +x2 x3) (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) z1 t3))))))) x0 x1 x2 x3 (refl_equal T +(THead (Bind Abst) x0 x1)) (refl_equal T (THead (Bind Abbr) x2 x3)) (pr2_free +c u1 x2 H10) (\lambda (b: B).(\lambda (u: T).(pr2_free (CHead c (Bind b) u) +x1 x3 H11))))) t1 H8) x H9))))))))) H7)) (\lambda (H7: (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t3: T).(eq T x (THead (Bind b) +v2 (THead (Flat Appl) (lift (S O) O u2) t3))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda (_: T).(pr0 +u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t3: T).(pr0 z1 t3))))))))).(ex6_6_ind B T T T T T (\lambda (b: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not +(eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) +y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (v2: T).(\lambda (t3: T).(eq T x (THead (Bind b) v2 (THead (Flat +Appl) (lift (S O) O u2) t3))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (t3: T).(pr0 z1 +t3))))))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq +T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead +(Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(x0: B).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (x5: T).(\lambda (H8: (not (eq B x0 Abst))).(\lambda (H9: (eq T +t1 (THead (Bind x0) x1 x2))).(\lambda (H10: (eq T x (THead (Bind x0) x4 +(THead (Flat Appl) (lift (S O) O x3) x5)))).(\lambda (H11: (pr0 u1 +x3)).(\lambda (H12: (pr0 x1 x4)).(\lambda (H13: (pr0 x2 x5)).(eq_ind_r T +(THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x5)) (\lambda (t: +T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t (THead (Flat +Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T t (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) (eq_ind_r T (THead (Bind +x0) x1 x2) (\lambda (t: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x5)) (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c t t3)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t3: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x5)) +(THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 (THead +(Flat Appl) (lift (S O) O x3) x5)) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2)))))))))) (or3_intro2 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) +O x3) x5)) (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) +t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x5)) (THead +(Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind +x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +(THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x5)) (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) (ex6_6_intro B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x5)) +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda +(_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))) +x0 x1 x2 x5 x3 x4 H8 (refl_equal T (THead (Bind x0) x1 x2)) (refl_equal T +(THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x5))) (pr2_free c u1 +x3 H11) (pr2_free c x1 x4 H12) (pr2_free (CHead c (Bind x0) x4) x2 x5 H13))) +t1 H9) x H10))))))))))))) H7)) (pr0_gen_appl u1 t1 x H6))) t2 (sym_eq T t2 x +H5))) t0 (sym_eq T t0 (THead (Flat Appl) u1 t1) H4))) c0 (sym_eq C c0 c H1) +H2 H3 H0)))) | (pr2_delta c0 d u i H0 t0 t2 H1 t H2) \Rightarrow (\lambda +(H3: (eq C c0 c)).(\lambda (H4: (eq T t0 (THead (Flat Appl) u1 t1))).(\lambda +(H5: (eq T t x)).(eq_ind C c (\lambda (c1: C).((eq T t0 (THead (Flat Appl) u1 +t1)) \to ((eq T t x) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 t0 +t2) \to ((subst0 i u t2 t) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda +(_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 +z2))))))))))))))) (\lambda (H6: (eq T t0 (THead (Flat Appl) u1 t1))).(eq_ind +T (THead (Flat Appl) u1 t1) (\lambda (t3: T).((eq T t x) \to ((getl i c +(CHead d (Bind Abbr) u)) \to ((pr0 t3 t2) \to ((subst0 i u t2 t) \to (or3 +(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T x (THead (Flat Appl) u2 +t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t4: T).(pr2 c t1 t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: +T).(eq T x (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))))))) (\lambda (H7: (eq T t +x)).(eq_ind T x (\lambda (t3: T).((getl i c (CHead d (Bind Abbr) u)) \to +((pr0 (THead (Flat Appl) u1 t1) t2) \to ((subst0 i u t2 t3) \to (or3 (ex3_2 T +T (\lambda (u2: T).(\lambda (t4: T).(eq T x (THead (Flat Appl) u2 t4)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t4: T).(pr2 c t1 t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T x +(THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))))))) (\lambda (H8: (getl i c +(CHead d (Bind Abbr) u))).(\lambda (H9: (pr0 (THead (Flat Appl) u1 t1) +t2)).(\lambda (H10: (subst0 i u t2 x)).(or3_ind (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(pr0 z1 t3)))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (v2: T).(\lambda (t3: T).(eq T t2 (THead (Bind b) v2 (THead +(Flat Appl) (lift (S O) O u2) t3))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda (_: T).(pr0 u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(t3: T).(pr0 z1 t3)))))))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda +(_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) +(\lambda (H11: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda +(_: T).(\lambda (t3: T).(pr0 t1 t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat +Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x0: T).(\lambda +(x1: T).(\lambda (H12: (eq T t2 (THead (Flat Appl) x0 x1))).(\lambda (H13: +(pr0 u1 x0)).(\lambda (H14: (pr0 t1 x1)).(let H15 \def (eq_ind T t2 (\lambda +(t3: T).(subst0 i u t3 x)) H10 (THead (Flat Appl) x0 x1) H12) in (or3_ind +(ex2 T (\lambda (u2: T).(eq T x (THead (Flat Appl) u2 x1))) (\lambda (u2: +T).(subst0 i u x0 u2))) (ex2 T (\lambda (t3: T).(eq T x (THead (Flat Appl) x0 +t3))) (\lambda (t3: T).(subst0 (s (Flat Appl) i) u x1 t3))) (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Flat Appl) i) u x1 t3)))) (or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (H16: (ex2 T +(\lambda (u2: T).(eq T x (THead (Flat Appl) u2 x1))) (\lambda (u2: T).(subst0 +i u x0 u2)))).(ex2_ind T (\lambda (u2: T).(eq T x (THead (Flat Appl) u2 x1))) +(\lambda (u2: T).(subst0 i u x0 u2)) (or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda +(u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead (Flat Appl) (lift +(S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x2: T).(\lambda (H17: (eq T x +(THead (Flat Appl) x2 x1))).(\lambda (H18: (subst0 i u x0 x2)).(eq_ind_r T +(THead (Flat Appl) x2 x1) (\lambda (t3: T).(or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c t1 +t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind +Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t4: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda +(u2: T).(\lambda (y2: T).(eq T t3 (THead (Bind b) y2 (THead (Flat Appl) (lift +(S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2)))))))))) (or3_intro0 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Flat Appl) x2 x1) (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Flat Appl) x2 x1) (THead (Bind Abbr) u2 t3)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +(THead (Flat Appl) x2 x1) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O +u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Flat Appl) x2 x1) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3))) x2 x1 (refl_equal T (THead (Flat Appl) x2 x1)) (pr2_delta c d u i H8 u1 +x0 H13 x2 H18) (pr2_free c t1 x1 H14))) x H17)))) H16)) (\lambda (H16: (ex2 T +(\lambda (t3: T).(eq T x (THead (Flat Appl) x0 t3))) (\lambda (t3: T).(subst0 +(s (Flat Appl) i) u x1 t3)))).(ex2_ind T (\lambda (t3: T).(eq T x (THead +(Flat Appl) x0 t3))) (\lambda (t3: T).(subst0 (s (Flat Appl) i) u x1 t3)) +(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x2: T).(\lambda +(H17: (eq T x (THead (Flat Appl) x0 x2))).(\lambda (H18: (subst0 (s (Flat +Appl) i) u x1 x2)).(eq_ind_r T (THead (Flat Appl) x0 x2) (\lambda (t3: +T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat +Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t4: T).(pr2 c t1 t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: +T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t3 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) +(or3_intro0 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Flat +Appl) x0 x2) (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T +T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (t3: T).(eq T (THead (Flat Appl) x0 x2) (THead (Bind Abbr) +u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda +(u2: T).(\lambda (y2: T).(eq T (THead (Flat Appl) x0 x2) (THead (Bind b) y2 +(THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) (ex3_2_intro T T (\lambda +(u2: T).(\lambda (t3: T).(eq T (THead (Flat Appl) x0 x2) (THead (Flat Appl) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3))) x0 x2 (refl_equal T (THead (Flat Appl) x0 +x2)) (pr2_free c u1 x0 H13) (pr2_delta c d u i H8 t1 x1 H14 x2 H18))) x +H17)))) H16)) (\lambda (H16: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq +T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u +x0 u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Flat Appl) i) u x1 +t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat +Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u x0 u2))) +(\lambda (_: T).(\lambda (t3: T).(subst0 (s (Flat Appl) i) u x1 t3))) (or3 +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x2: T).(\lambda +(x3: T).(\lambda (H17: (eq T x (THead (Flat Appl) x2 x3))).(\lambda (H18: +(subst0 i u x0 x2)).(\lambda (H19: (subst0 (s (Flat Appl) i) u x1 +x3)).(eq_ind_r T (THead (Flat Appl) x2 x3) (\lambda (t3: T).(or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t4: T).(pr2 c t1 t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T t3 +(THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t3 (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) (or3_intro0 (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Flat Appl) x2 x3) (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Flat Appl) x2 x3) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda +(u2: T).(\lambda (y2: T).(eq T (THead (Flat Appl) x2 x3) (THead (Bind b) y2 +(THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) (ex3_2_intro T T (\lambda +(u2: T).(\lambda (t3: T).(eq T (THead (Flat Appl) x2 x3) (THead (Flat Appl) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3))) x2 x3 (refl_equal T (THead (Flat Appl) x2 +x3)) (pr2_delta c d u i H8 u1 x0 H13 x2 H18) (pr2_delta c d u i H8 t1 x1 H14 +x3 H19))) x H17)))))) H16)) (subst0_gen_head (Flat Appl) u x0 x1 x i +H15)))))))) H11)) (\lambda (H11: (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t3: T).(pr0 z1 t3))))))).(ex4_4_ind T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(pr0 z1 t3))))) (or3 +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c t1 t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x0: T).(\lambda +(x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H12: (eq T t1 (THead +(Bind Abst) x0 x1))).(\lambda (H13: (eq T t2 (THead (Bind Abbr) x2 +x3))).(\lambda (H14: (pr0 u1 x2)).(\lambda (H15: (pr0 x1 x3)).(let H16 \def +(eq_ind T t2 (\lambda (t3: T).(subst0 i u t3 x)) H10 (THead (Bind Abbr) x2 +x3) H13) in (eq_ind_r T (THead (Bind Abst) x0 x1) (\lambda (t3: T).(or3 +(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T x (THead (Flat Appl) u2 +t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t4: T).(pr2 c t3 t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t3 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: +T).(eq T x (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t3 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) (or3_ind (ex2 T (\lambda +(u2: T).(eq T x (THead (Bind Abbr) u2 x3))) (\lambda (u2: T).(subst0 i u x2 +u2))) (ex2 T (\lambda (t3: T).(eq T x (THead (Bind Abbr) x2 t3))) (\lambda +(t3: T).(subst0 (s (Bind Abbr) i) u x3 t3))) (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u x2 u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind Abbr) i) u x3 t3)))) (or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind Abst) x0 x1) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) +O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))) (\lambda (H17: (ex2 T (\lambda (u2: T).(eq T x (THead +(Bind Abbr) u2 x3))) (\lambda (u2: T).(subst0 i u x2 u2)))).(ex2_ind T +(\lambda (u2: T).(eq T x (THead (Bind Abbr) u2 x3))) (\lambda (u2: T).(subst0 +i u x2 u2)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Bind Abst) x0 x1) t3)))) +(ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind Abst) y1 z1)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x4: T).(\lambda +(H18: (eq T x (THead (Bind Abbr) x4 x3))).(\lambda (H19: (subst0 i u x2 +x4)).(eq_ind_r T (THead (Bind Abbr) x4 x3) (\lambda (t3: T).(or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t4: T).(pr2 c (THead (Bind Abst) x0 x1) t4)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) +x0 x1) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: +T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T t3 (THead (Bind b) y2 (THead (Flat Appl) (lift (S +O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))))) (or3_intro1 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind Abbr) x4 x3) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind Abst) x0 x1) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind Abbr) x4 x3) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind +Abbr) x4 x3) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (ex4_4_intro T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind Abbr) x4 x3) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3))))))) x0 x1 x4 x3 (refl_equal T (THead (Bind Abst) x0 x1)) +(refl_equal T (THead (Bind Abbr) x4 x3)) (pr2_delta c d u i H8 u1 x2 H14 x4 +H19) (\lambda (b: B).(\lambda (u0: T).(pr2_free (CHead c (Bind b) u0) x1 x3 +H15))))) x H18)))) H17)) (\lambda (H17: (ex2 T (\lambda (t3: T).(eq T x +(THead (Bind Abbr) x2 t3))) (\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x3 +t3)))).(ex2_ind T (\lambda (t3: T).(eq T x (THead (Bind Abbr) x2 t3))) +(\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x3 t3)) (or3 (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind Abst) x0 x1) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) +O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))) (\lambda (x4: T).(\lambda (H18: (eq T x (THead (Bind Abbr) +x2 x4))).(\lambda (H19: (subst0 (s (Bind Abbr) i) u x3 x4)).(eq_ind_r T +(THead (Bind Abbr) x2 x4) (\lambda (t3: T).(or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c +(THead (Bind Abst) x0 x1) t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t4: T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T t3 (THead (Bind b) y2 (THead (Flat Appl) (lift (S +O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))))) (or3_intro1 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind Abbr) x2 x4) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind Abst) x0 x1) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind Abbr) x2 x4) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind +Abbr) x2 x4) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (ex4_4_intro T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind Abbr) x2 x4) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3))))))) x0 x1 x2 x4 (refl_equal T (THead (Bind Abst) x0 x1)) +(refl_equal T (THead (Bind Abbr) x2 x4)) (pr2_free c u1 x2 H14) (\lambda (b: +B).(\lambda (u0: T).(pr2_delta (CHead c (Bind b) u0) d u (S i) +(getl_clear_bind b (CHead c (Bind b) u0) c u0 (clear_bind b c u0) (CHead d +(Bind Abbr) u) i H8) x1 x3 H15 x4 H19))))) x H18)))) H17)) (\lambda (H17: +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u x2 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x3 t3))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u x2 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x3 t3))) (or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c (THead (Bind Abst) x0 x1) t3)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) +x0 x1) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) +O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))) (\lambda (x4: T).(\lambda (x5: T).(\lambda (H18: (eq T x +(THead (Bind Abbr) x4 x5))).(\lambda (H19: (subst0 i u x2 x4)).(\lambda (H20: +(subst0 (s (Bind Abbr) i) u x3 x5)).(eq_ind_r T (THead (Bind Abbr) x4 x5) +(\lambda (t3: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 +(THead (Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind Abst) x0 x1) t4)))) +(ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind Abst) y1 z1)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead +(Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind +Abst) x0 x1) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +t3 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 +z2)))))))))) (or3_intro1 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Bind Abbr) x4 x5) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind Abst) x0 x1) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind Abbr) x4 x5) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind +Abbr) x4 x5) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (ex4_4_intro T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind Abbr) x4 x5) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3))))))) x0 x1 x4 x5 (refl_equal T (THead (Bind Abst) x0 x1)) +(refl_equal T (THead (Bind Abbr) x4 x5)) (pr2_delta c d u i H8 u1 x2 H14 x4 +H19) (\lambda (b: B).(\lambda (u0: T).(pr2_delta (CHead c (Bind b) u0) d u (S +i) (getl_clear_bind b (CHead c (Bind b) u0) c u0 (clear_bind b c u0) (CHead d +(Bind Abbr) u) i H8) x1 x3 H15 x5 H20))))) x H18)))))) H17)) (subst0_gen_head +(Bind Abbr) u x2 x3 x i H16)) t1 H12)))))))))) H11)) (\lambda (H11: (ex6_6 B +T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t3: T).(eq T +t2 (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O u2) t3))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(\lambda (_: T).(pr0 u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 +v2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (t3: T).(pr0 z1 t3))))))))).(ex6_6_ind B T T T T +T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq +T t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (v2: T).(\lambda (t3: T).(eq T t2 (THead +(Bind b) v2 (THead (Flat Appl) (lift (S O) O u2) t3))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(\lambda +(_: T).(pr0 u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (v2: T).(\lambda (_: T).(pr0 y1 v2))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (t3: T).(pr0 z1 t3))))))) (or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t1 +t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T t1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T t1 (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda +(u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead (Flat Appl) (lift +(S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x0: B).(\lambda (x1: +T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: +T).(\lambda (H12: (not (eq B x0 Abst))).(\lambda (H13: (eq T t1 (THead (Bind +x0) x1 x2))).(\lambda (H14: (eq T t2 (THead (Bind x0) x4 (THead (Flat Appl) +(lift (S O) O x3) x5)))).(\lambda (H15: (pr0 u1 x3)).(\lambda (H16: (pr0 x1 +x4)).(\lambda (H17: (pr0 x2 x5)).(let H18 \def (eq_ind T t2 (\lambda (t3: +T).(subst0 i u t3 x)) H10 (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) +O x3) x5)) H14) in (eq_ind_r T (THead (Bind x0) x1 x2) (\lambda (t3: T).(or3 +(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T x (THead (Flat Appl) u2 +t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t4: T).(pr2 c t3 t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T t3 (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: +T).(eq T x (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T t3 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) (or3_ind (ex2 T (\lambda +(u2: T).(eq T x (THead (Bind x0) u2 (THead (Flat Appl) (lift (S O) O x3) +x5)))) (\lambda (u2: T).(subst0 i u x4 u2))) (ex2 T (\lambda (t3: T).(eq T x +(THead (Bind x0) x4 t3))) (\lambda (t3: T).(subst0 (s (Bind x0) i) u (THead +(Flat Appl) (lift (S O) O x3) x5) t3))) (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind x0) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i u x4 u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Bind x0) +i) u (THead (Flat Appl) (lift (S O) O x3) x5) t3)))) (or3 (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T x (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))) (\lambda (H19: (ex2 T (\lambda (u2: T).(eq T x (THead +(Bind x0) u2 (THead (Flat Appl) (lift (S O) O x3) x5)))) (\lambda (u2: +T).(subst0 i u x4 u2)))).(ex2_ind T (\lambda (u2: T).(eq T x (THead (Bind x0) +u2 (THead (Flat Appl) (lift (S O) O x3) x5)))) (\lambda (u2: T).(subst0 i u +x4 u2)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 +T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x6: T).(\lambda +(H20: (eq T x (THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) O x3) +x5)))).(\lambda (H21: (subst0 i u x4 x6)).(eq_ind_r T (THead (Bind x0) x6 +(THead (Flat Appl) (lift (S O) O x3) x5)) (\lambda (t3: T).(or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t4: T).(pr2 c (THead (Bind x0) x1 x2) t4)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 +x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T t3 (THead (Bind b) y2 (THead (Flat Appl) (lift (S +O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))))) (or3_intro2 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) O x3) x5)) (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 +T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) +x6 (THead (Flat Appl) (lift (S O) O x3) x5)) (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) +O x3) x5)) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (ex6_6_intro B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 (THead +(Flat Appl) (lift (S O) O x3) x5)) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))) x0 x1 x2 x5 x3 x6 H12 (refl_equal T (THead +(Bind x0) x1 x2)) (refl_equal T (THead (Bind x0) x6 (THead (Flat Appl) (lift +(S O) O x3) x5))) (pr2_free c u1 x3 H15) (pr2_delta c d u i H8 x1 x4 H16 x6 +H21) (pr2_free (CHead c (Bind x0) x6) x2 x5 H17))) x H20)))) H19)) (\lambda +(H19: (ex2 T (\lambda (t3: T).(eq T x (THead (Bind x0) x4 t3))) (\lambda (t3: +T).(subst0 (s (Bind x0) i) u (THead (Flat Appl) (lift (S O) O x3) x5) +t3)))).(ex2_ind T (\lambda (t3: T).(eq T x (THead (Bind x0) x4 t3))) (\lambda +(t3: T).(subst0 (s (Bind x0) i) u (THead (Flat Appl) (lift (S O) O x3) x5) +t3)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Flat +Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x6: T).(\lambda +(H20: (eq T x (THead (Bind x0) x4 x6))).(\lambda (H21: (subst0 (s (Bind x0) +i) u (THead (Flat Appl) (lift (S O) O x3) x5) x6)).(eq_ind_r T (THead (Bind +x0) x4 x6) (\lambda (t3: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t4: +T).(eq T t3 (THead (Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind x0) +x1 x2) t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: +T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T t3 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))))) (or3_ind (ex2 T (\lambda (u2: T).(eq T x6 (THead (Flat +Appl) u2 x5))) (\lambda (u2: T).(subst0 (s (Bind x0) i) u (lift (S O) O x3) +u2))) (ex2 T (\lambda (t3: T).(eq T x6 (THead (Flat Appl) (lift (S O) O x3) +t3))) (\lambda (t3: T).(subst0 (s (Flat Appl) (s (Bind x0) i)) u x5 t3))) +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x6 (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 (s (Bind x0) i) u (lift (S O) +O x3) u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Flat Appl) (s (Bind +x0) i)) u x5 t3)))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Bind x0) x4 x6) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t3: T).(eq T (THead (Bind x0) x4 x6) (THead (Bind Abbr) u2 t3)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 x6) (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (H22: (ex2 T +(\lambda (u2: T).(eq T x6 (THead (Flat Appl) u2 x5))) (\lambda (u2: +T).(subst0 (s (Bind x0) i) u (lift (S O) O x3) u2)))).(ex2_ind T (\lambda +(u2: T).(eq T x6 (THead (Flat Appl) u2 x5))) (\lambda (u2: T).(subst0 (s +(Bind x0) i) u (lift (S O) O x3) u2)) (or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind x0) x4 x6) (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) +x4 x6) (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x4 x6) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x7: T).(\lambda (H23: (eq T x6 +(THead (Flat Appl) x7 x5))).(\lambda (H24: (subst0 (s (Bind x0) i) u (lift (S +O) O x3) x7)).(eq_ind_r T (THead (Flat Appl) x7 x5) (\lambda (t3: T).(or3 +(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) x4 t3) +(THead (Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind x0) x1 x2) t4)))) (ex4_4 +T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) +x4 t3) (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x4 t3) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2)))))))))) (ex2_ind T (\lambda (t3: T).(eq T x7 +(lift (S O) O t3))) (\lambda (t3: T).(subst0 (minus (s (Bind x0) i) (S O)) u +x3 t3)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind +x0) x4 (THead (Flat Appl) x7 x5)) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t3: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) x7 x5)) (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 (THead +(Flat Appl) x7 x5)) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))) (\lambda (x8: T).(\lambda (H25: (eq T x7 (lift (S O) O +x8))).(\lambda (H26: (subst0 (minus (s (Bind x0) i) (S O)) u x3 x8)).(let H27 +\def (eq_ind nat (minus (s (Bind x0) i) (S O)) (\lambda (n: nat).(subst0 n u +x3 x8)) H26 i (s_arith1 x0 i)) in (eq_ind_r T (lift (S O) O x8) (\lambda (t3: +T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) +x4 (THead (Flat Appl) t3 x5)) (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c +(THead (Bind x0) x1 x2) t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t4: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) t3 x5)) (THead (Bind +Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t4: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 (THead +(Flat Appl) t3 x5)) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))))) (or3_intro2 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x8) x5)) (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 +T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) +x4 (THead (Flat Appl) (lift (S O) O x8) x5)) (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) +O x8) x5)) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (ex6_6_intro B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 (THead +(Flat Appl) (lift (S O) O x8) x5)) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))) x0 x1 x2 x5 x8 x4 H12 (refl_equal T (THead +(Bind x0) x1 x2)) (refl_equal T (THead (Bind x0) x4 (THead (Flat Appl) (lift +(S O) O x8) x5))) (pr2_delta c d u i H8 u1 x3 H15 x8 H27) (pr2_free c x1 x4 +H16) (pr2_free (CHead c (Bind x0) x4) x2 x5 H17))) x7 H25))))) +(subst0_gen_lift_ge u x3 x7 (s (Bind x0) i) (S O) O H24 (le_n_S O i (le_O_n +i)))) x6 H23)))) H22)) (\lambda (H22: (ex2 T (\lambda (t3: T).(eq T x6 (THead +(Flat Appl) (lift (S O) O x3) t3))) (\lambda (t3: T).(subst0 (s (Flat Appl) +(s (Bind x0) i)) u x5 t3)))).(ex2_ind T (\lambda (t3: T).(eq T x6 (THead +(Flat Appl) (lift (S O) O x3) t3))) (\lambda (t3: T).(subst0 (s (Flat Appl) +(s (Bind x0) i)) u x5 t3)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind x0) x4 x6) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t3: T).(eq T (THead (Bind x0) x4 x6) (THead (Bind Abbr) u2 t3)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 x6) (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x7: T).(\lambda +(H23: (eq T x6 (THead (Flat Appl) (lift (S O) O x3) x7))).(\lambda (H24: +(subst0 (s (Flat Appl) (s (Bind x0) i)) u x5 x7)).(eq_ind_r T (THead (Flat +Appl) (lift (S O) O x3) x7) (\lambda (t3: T).(or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t4: T).(eq T (THead (Bind x0) x4 t3) (THead (Flat Appl) u2 +t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t4: T).(pr2 c (THead (Bind x0) x1 x2) t4)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) +x4 t3) (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x4 t3) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2)))))))))) (or3_intro2 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) +O x3) x7)) (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) +t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x7)) (THead +(Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind +x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +(THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x7)) (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) (ex6_6_intro B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x7)) +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda +(_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))) +x0 x1 x2 x7 x3 x4 H12 (refl_equal T (THead (Bind x0) x1 x2)) (refl_equal T +(THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x3) x7))) (pr2_free c u1 +x3 H15) (pr2_free c x1 x4 H16) (pr2_delta (CHead c (Bind x0) x4) d u (S i) +(getl_clear_bind x0 (CHead c (Bind x0) x4) c x4 (clear_bind x0 c x4) (CHead d +(Bind Abbr) u) i H8) x2 x5 H17 x7 H24))) x6 H23)))) H22)) (\lambda (H22: +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x6 (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 (s (Bind x0) i) u (lift (S O) +O x3) u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Flat Appl) (s (Bind +x0) i)) u x5 t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T +x6 (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 (s +(Bind x0) i) u (lift (S O) O x3) u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Flat Appl) (s (Bind x0) i)) u x5 t3))) (or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) x4 x6) (THead (Flat +Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) +x4 x6) (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x4 x6) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x7: T).(\lambda (x8: +T).(\lambda (H23: (eq T x6 (THead (Flat Appl) x7 x8))).(\lambda (H24: (subst0 +(s (Bind x0) i) u (lift (S O) O x3) x7)).(\lambda (H25: (subst0 (s (Flat +Appl) (s (Bind x0) i)) u x5 x8)).(eq_ind_r T (THead (Flat Appl) x7 x8) +(\lambda (t3: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T +(THead (Bind x0) x4 t3) (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c +(THead (Bind x0) x1 x2) t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t4: T).(eq T (THead (Bind x0) x4 t3) (THead (Bind Abbr) u2 t4)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 t3) (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) (ex2_ind T (\lambda (t3: +T).(eq T x7 (lift (S O) O t3))) (\lambda (t3: T).(subst0 (minus (s (Bind x0) +i) (S O)) u x3 t3)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Bind x0) x4 (THead (Flat Appl) x7 x8)) (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 +x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) x7 x8)) +(THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind +x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +(THead (Bind x0) x4 (THead (Flat Appl) x7 x8)) (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x9: T).(\lambda +(H26: (eq T x7 (lift (S O) O x9))).(\lambda (H27: (subst0 (minus (s (Bind x0) +i) (S O)) u x3 x9)).(let H28 \def (eq_ind nat (minus (s (Bind x0) i) (S O)) +(\lambda (n: nat).(subst0 n u x3 x9)) H27 i (s_arith1 x0 i)) in (eq_ind_r T +(lift (S O) O x9) (\lambda (t3: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda +(t4: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) t3 x8)) (THead (Flat +Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t4: T).(pr2 c (THead (Bind x0) x1 x2) t4)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) +x4 (THead (Flat Appl) t3 x8)) (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) t3 x8)) +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda +(_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 +z2)))))))))) (or3_intro2 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) O x9) x8)) (THead (Flat +Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) +x4 (THead (Flat Appl) (lift (S O) O x9) x8)) (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 (THead (Flat Appl) (lift (S O) +O x9) x8)) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (ex6_6_intro B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x4 (THead +(Flat Appl) (lift (S O) O x9) x8)) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))) x0 x1 x2 x8 x9 x4 H12 (refl_equal T (THead +(Bind x0) x1 x2)) (refl_equal T (THead (Bind x0) x4 (THead (Flat Appl) (lift +(S O) O x9) x8))) (pr2_delta c d u i H8 u1 x3 H15 x9 H28) (pr2_free c x1 x4 +H16) (pr2_delta (CHead c (Bind x0) x4) d u (S i) (getl_clear_bind x0 (CHead c +(Bind x0) x4) c x4 (clear_bind x0 c x4) (CHead d (Bind Abbr) u) i H8) x2 x5 +H17 x8 H25))) x7 H26))))) (subst0_gen_lift_ge u x3 x7 (s (Bind x0) i) (S O) O +H24 (le_n_S O i (le_O_n i)))) x6 H23)))))) H22)) (subst0_gen_head (Flat Appl) +u (lift (S O) O x3) x5 x6 (s (Bind x0) i) H21)) x H20)))) H19)) (\lambda +(H19: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind x0) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u x4 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind x0) i) u (THead (Flat Appl) (lift (S O) +O x3) x5) t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind x0) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u x4 +u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Bind x0) i) u (THead (Flat +Appl) (lift (S O) O x3) x5) t3))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Bind x0) +x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T x (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))) (\lambda (x6: T).(\lambda (x7: T).(\lambda (H20: (eq T x +(THead (Bind x0) x6 x7))).(\lambda (H21: (subst0 i u x4 x6)).(\lambda (H22: +(subst0 (s (Bind x0) i) u (THead (Flat Appl) (lift (S O) O x3) x5) +x7)).(eq_ind_r T (THead (Bind x0) x6 x7) (\lambda (t3: T).(or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t4: T).(pr2 c (THead (Bind x0) x1 x2) t4)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 +x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T t3 (THead (Bind b) y2 (THead (Flat Appl) (lift (S +O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))))) (or3_ind (ex2 T (\lambda (u2: T).(eq T x7 (THead (Flat +Appl) u2 x5))) (\lambda (u2: T).(subst0 (s (Bind x0) i) u (lift (S O) O x3) +u2))) (ex2 T (\lambda (t3: T).(eq T x7 (THead (Flat Appl) (lift (S O) O x3) +t3))) (\lambda (t3: T).(subst0 (s (Flat Appl) (s (Bind x0) i)) u x5 t3))) +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x7 (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 (s (Bind x0) i) u (lift (S O) +O x3) u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Flat Appl) (s (Bind +x0) i)) u x5 t3)))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Bind x0) x6 x7) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t3: T).(eq T (THead (Bind x0) x6 x7) (THead (Bind Abbr) u2 t3)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 x7) (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (H23: (ex2 T +(\lambda (u2: T).(eq T x7 (THead (Flat Appl) u2 x5))) (\lambda (u2: +T).(subst0 (s (Bind x0) i) u (lift (S O) O x3) u2)))).(ex2_ind T (\lambda +(u2: T).(eq T x7 (THead (Flat Appl) u2 x5))) (\lambda (u2: T).(subst0 (s +(Bind x0) i) u (lift (S O) O x3) u2)) (or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind x0) x6 x7) (THead (Flat Appl) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) +x6 x7) (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x6 x7) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x8: T).(\lambda (H24: (eq T x7 +(THead (Flat Appl) x8 x5))).(\lambda (H25: (subst0 (s (Bind x0) i) u (lift (S +O) O x3) x8)).(eq_ind_r T (THead (Flat Appl) x8 x5) (\lambda (t3: T).(or3 +(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) x6 t3) +(THead (Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind x0) x1 x2) t4)))) (ex4_4 +T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) +x6 t3) (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x6 t3) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2)))))))))) (ex2_ind T (\lambda (t3: T).(eq T x8 +(lift (S O) O t3))) (\lambda (t3: T).(subst0 (minus (s (Bind x0) i) (S O)) u +x3 t3)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind +x0) x6 (THead (Flat Appl) x8 x5)) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t3: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) x8 x5)) (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 (THead +(Flat Appl) x8 x5)) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))) (\lambda (x9: T).(\lambda (H26: (eq T x8 (lift (S O) O +x9))).(\lambda (H27: (subst0 (minus (s (Bind x0) i) (S O)) u x3 x9)).(let H28 +\def (eq_ind nat (minus (s (Bind x0) i) (S O)) (\lambda (n: nat).(subst0 n u +x3 x9)) H27 i (s_arith1 x0 i)) in (eq_ind_r T (lift (S O) O x9) (\lambda (t3: +T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) +x6 (THead (Flat Appl) t3 x5)) (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c +(THead (Bind x0) x1 x2) t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t4: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) t3 x5)) (THead (Bind +Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t4: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 (THead +(Flat Appl) t3 x5)) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))))) (or3_intro2 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) O x9) x5)) (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 +T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) +x6 (THead (Flat Appl) (lift (S O) O x9) x5)) (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) +O x9) x5)) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (ex6_6_intro B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 (THead +(Flat Appl) (lift (S O) O x9) x5)) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))) x0 x1 x2 x5 x9 x6 H12 (refl_equal T (THead +(Bind x0) x1 x2)) (refl_equal T (THead (Bind x0) x6 (THead (Flat Appl) (lift +(S O) O x9) x5))) (pr2_delta c d u i H8 u1 x3 H15 x9 H28) (pr2_delta c d u i +H8 x1 x4 H16 x6 H21) (pr2_free (CHead c (Bind x0) x6) x2 x5 H17))) x8 +H26))))) (subst0_gen_lift_ge u x3 x8 (s (Bind x0) i) (S O) O H25 (le_n_S O i +(le_O_n i)))) x7 H24)))) H23)) (\lambda (H23: (ex2 T (\lambda (t3: T).(eq T +x7 (THead (Flat Appl) (lift (S O) O x3) t3))) (\lambda (t3: T).(subst0 (s +(Flat Appl) (s (Bind x0) i)) u x5 t3)))).(ex2_ind T (\lambda (t3: T).(eq T x7 +(THead (Flat Appl) (lift (S O) O x3) t3))) (\lambda (t3: T).(subst0 (s (Flat +Appl) (s (Bind x0) i)) u x5 t3)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T (THead (Bind x0) x6 x7) (THead (Flat Appl) u2 t3)))) (\lambda +(u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 +c (THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T (THead (Bind x0) x6 x7) (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 x7) +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda +(_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) +(\lambda (x8: T).(\lambda (H24: (eq T x7 (THead (Flat Appl) (lift (S O) O x3) +x8))).(\lambda (H25: (subst0 (s (Flat Appl) (s (Bind x0) i)) u x5 +x8)).(eq_ind_r T (THead (Flat Appl) (lift (S O) O x3) x8) (\lambda (t3: +T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) +x6 t3) (THead (Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c +u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind x0) x1 x2) +t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: +T).(eq T (THead (Bind x0) x6 t3) (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 t3) (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) (or3_intro2 (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) x6 (THead (Flat +Appl) (lift (S O) O x3) x8)) (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t3: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) O x3) x8)) +(THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind +x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +(THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) O x3) x8)) (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) (ex6_6_intro B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) O x3) x8)) +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda +(_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))) +x0 x1 x2 x8 x3 x6 H12 (refl_equal T (THead (Bind x0) x1 x2)) (refl_equal T +(THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) O x3) x8))) (pr2_free c u1 +x3 H15) (pr2_delta c d u i H8 x1 x4 H16 x6 H21) (pr2_delta (CHead c (Bind x0) +x6) d u (S i) (getl_clear_bind x0 (CHead c (Bind x0) x6) c x6 (clear_bind x0 +c x6) (CHead d (Bind Abbr) u) i H8) x2 x5 H17 x8 H25))) x7 H24)))) H23)) +(\lambda (H23: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x7 (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 (s (Bind x0) +i) u (lift (S O) O x3) u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s +(Flat Appl) (s (Bind x0) i)) u x5 t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x7 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 (s (Bind x0) i) u (lift (S O) O x3) u2))) (\lambda +(_: T).(\lambda (t3: T).(subst0 (s (Flat Appl) (s (Bind x0) i)) u x5 t3))) +(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) x6 +x7) (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) +(ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(eq T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) +x6 x7) (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T (THead (Bind x0) x6 x7) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x8: T).(\lambda (x9: +T).(\lambda (H24: (eq T x7 (THead (Flat Appl) x8 x9))).(\lambda (H25: (subst0 +(s (Bind x0) i) u (lift (S O) O x3) x8)).(\lambda (H26: (subst0 (s (Flat +Appl) (s (Bind x0) i)) u x5 x9)).(eq_ind_r T (THead (Flat Appl) x8 x9) +(\lambda (t3: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T +(THead (Bind x0) x6 t3) (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c +(THead (Bind x0) x1 x2) t4)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(t4: T).(eq T (THead (Bind x0) x6 t3) (THead (Bind Abbr) u2 t4)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 t3) (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))))) (ex2_ind T (\lambda (t3: +T).(eq T x8 (lift (S O) O t3))) (\lambda (t3: T).(subst0 (minus (s (Bind x0) +i) (S O)) u x3 t3)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Bind x0) x6 (THead (Flat Appl) x8 x9)) (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 +x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) x8 x9)) +(THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind +x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +(THead (Bind x0) x6 (THead (Flat Appl) x8 x9)) (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda (x10: T).(\lambda +(H27: (eq T x8 (lift (S O) O x10))).(\lambda (H28: (subst0 (minus (s (Bind +x0) i) (S O)) u x3 x10)).(let H29 \def (eq_ind nat (minus (s (Bind x0) i) (S +O)) (\lambda (n: nat).(subst0 n u x3 x10)) H28 i (s_arith1 x0 i)) in +(eq_ind_r T (lift (S O) O x10) (\lambda (t3: T).(or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t4: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) t3 x9)) +(THead (Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind x0) x1 x2) t4)))) (ex4_4 +T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T (THead (Bind x0) +x6 (THead (Flat Appl) t3 x9)) (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t4)))))))) (ex6_6 B T T +T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) t3 x9)) +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda +(_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 +z2)))))))))) (or3_intro2 (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) O x10) x9)) (THead (Flat +Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(pr2 c (THead (Bind x0) x1 x2) t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind x0) x1 x2) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind x0) +x6 (THead (Flat Appl) (lift (S O) O x10) x9)) (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) y1 z1)))))))) (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: +T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 (THead (Flat Appl) (lift (S O) +O x10) x9)) (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (ex6_6_intro B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T (THead (Bind x0) x6 (THead +(Flat Appl) (lift (S O) O x10) x9)) (THead (Bind b) y2 (THead (Flat Appl) +(lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))) x0 x1 x2 x9 x10 x6 H12 (refl_equal T +(THead (Bind x0) x1 x2)) (refl_equal T (THead (Bind x0) x6 (THead (Flat Appl) +(lift (S O) O x10) x9))) (pr2_delta c d u i H8 u1 x3 H15 x10 H29) (pr2_delta +c d u i H8 x1 x4 H16 x6 H21) (pr2_delta (CHead c (Bind x0) x6) d u (S i) +(getl_clear_bind x0 (CHead c (Bind x0) x6) c x6 (clear_bind x0 c x6) (CHead d +(Bind Abbr) u) i H8) x2 x5 H17 x9 H26))) x8 H27))))) (subst0_gen_lift_ge u x3 +x8 (s (Bind x0) i) (S O) O H25 (le_n_S O i (le_O_n i)))) x7 H24)))))) H23)) +(subst0_gen_head (Flat Appl) u (lift (S O) O x3) x5 x7 (s (Bind x0) i) H22)) +x H20)))))) H19)) (subst0_gen_head (Bind x0) u x4 (THead (Flat Appl) (lift (S +O) O x3) x5) x i H18)) t1 H13)))))))))))))) H11)) (pr0_gen_appl u1 t1 t2 +H9))))) t (sym_eq T t x H7))) t0 (sym_eq T t0 (THead (Flat Appl) u1 t1) H6))) +c0 (sym_eq C c0 c H3) H4 H5 H0 H1 H2))))]) in (H0 (refl_equal C c) +(refl_equal T (THead (Flat Appl) u1 t1)) (refl_equal T x))))))). + +theorem pr2_gen_abbr: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr2 c +(THead (Bind Abbr) u1 t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(or3 (\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t2))) (ex2 T (\lambda (u: +T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 t2))) (ex3_2 T +T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z t2)))))))) (\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O x))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr2 c (THead (Bind Abbr) u1 t1) x)).(let H0 \def (match H in pr2 return +(\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t +t0)).((eq C c0 c) \to ((eq T t (THead (Bind Abbr) u1 t1)) \to ((eq T t0 x) +\to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind +Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind +b) u) t1 t2))) (ex2 T (\lambda (u: T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead +c (Bind Abbr) u) t1 t2))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) +(\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t2)))))))) +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O +x)))))))))))) with [(pr2_free c0 t0 t2 H0) \Rightarrow (\lambda (H1: (eq C c0 +c)).(\lambda (H2: (eq T t0 (THead (Bind Abbr) u1 t1))).(\lambda (H3: (eq T t2 +x)).(eq_ind C c (\lambda (_: C).((eq T t0 (THead (Bind Abbr) u1 t1)) \to ((eq +T t2 x) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 t3))) (ex2 T (\lambda (u: T).(pr0 u1 u)) +(\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 t3))) (ex3_2 T T (\lambda (y: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u: T).(pr2 (CHead c +(Bind b) u) t1 (lift (S O) O x))))))))) (\lambda (H4: (eq T t0 (THead (Bind +Abbr) u1 t1))).(eq_ind T (THead (Bind Abbr) u1 t1) (\lambda (t: T).((eq T t2 +x) \to ((pr0 t t2) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 t3))) (ex2 T (\lambda (u: T).(pr0 u1 u)) +(\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 t3))) (ex3_2 T T (\lambda (y: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u: T).(pr2 (CHead c +(Bind b) u) t1 (lift (S O) O x)))))))) (\lambda (H5: (eq T t2 x)).(eq_ind T x +(\lambda (t: T).((pr0 (THead (Bind Abbr) u1 t1) t) \to (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 +t3))) (ex2 T (\lambda (u: T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead c (Bind +Abbr) u) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c +(Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda +(_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O x))))))) +(\lambda (H6: (pr0 (THead (Bind Abbr) u1 t1) x)).(or_ind (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t3: T).(or (pr0 +t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u2 y +t3))))))) (pr0 t1 (lift (S O) O x)) (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3))) (ex2 T (\lambda (u: +T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 t3))) (ex3_2 T +T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O x))))) (\lambda (H7: (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t3: +T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 +O u2 y t3)))))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (u2: T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 +t1 y)) (\lambda (y: T).(subst0 O u2 y t3)))))) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3))) (ex2 T +(\lambda (u: T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 +t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O x))))) (\lambda +(x0: T).(\lambda (x1: T).(\lambda (H8: (eq T x (THead (Bind Abbr) x0 +x1))).(\lambda (H9: (pr0 u1 x0)).(\lambda (H_x: (or (pr0 t1 x1) (ex2 T +(\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O x0 y x1))))).(or_ind +(pr0 t1 x1) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O x0 y +x1))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind +b) u) t1 t3))) (ex2 T (\lambda (u: T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead +c (Bind Abbr) u) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) +(\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O +x))))) (\lambda (H10: (pr0 t1 x1)).(eq_ind_r T (THead (Bind Abbr) x0 x1) +(\lambda (t: T).(or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t +(THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) t1 t3))) (ex2 T (\lambda (u: T).(pr0 u1 u)) (\lambda (u: +T).(pr2 (CHead c (Bind Abbr) u) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda +(_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: +T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) +z t3)))))))) (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 +(lift (S O) O t)))))) (or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T (THead (Bind Abbr) x0 x1) (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3))) (ex2 T +(\lambda (u: T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 +t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O (THead (Bind +Abbr) x0 x1))))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T +(THead (Bind Abbr) x0 x1) (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3))) (ex2 T +(\lambda (u: T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 +t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3))))))) x0 x1 +(refl_equal T (THead (Bind Abbr) x0 x1)) (pr2_free c u1 x0 H9) (or3_intro0 +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 x1))) (ex2 T +(\lambda (u: T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 +x1))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z x1)))) (\lambda (b: +B).(\lambda (u: T).(pr2_free (CHead c (Bind b) u) t1 x1 H10)))))) x H8)) +(\lambda (H_x0: (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O +x0 y x1)))).(ex2_ind T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O +x0 y x1)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead +(Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) t1 t3))) (ex2 T (\lambda (u: T).(pr0 u1 u)) (\lambda (u: +T).(pr2 (CHead c (Bind Abbr) u) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda +(_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: +T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) +z t3)))))))) (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 +(lift (S O) O x))))) (\lambda (x2: T).(\lambda (H10: (pr0 t1 x2)).(\lambda +(H11: (subst0 O x0 x2 x1)).(eq_ind_r T (THead (Bind Abbr) x0 x1) (\lambda (t: +T).(or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t (THead (Bind +Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind +b) u) t1 t3))) (ex2 T (\lambda (u: T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead +c (Bind Abbr) u) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) +(\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O +t)))))) (ex2_ind T (\lambda (t: T).(subst0 O u1 x2 t)) (\lambda (t: T).(pr0 t +x1)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind +Abbr) x0 x1) (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3))) (ex2 T (\lambda (u: +T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 t3))) (ex3_2 T +T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O (THead (Bind Abbr) x0 x1)))))) +(\lambda (x3: T).(\lambda (_: (subst0 O u1 x2 x3)).(\lambda (_: (pr0 x3 +x1)).(or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead +(Bind Abbr) x0 x1) (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3))) (ex2 T (\lambda (u: +T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 t3))) (ex3_2 T +T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O (THead (Bind Abbr) x0 x1))))) +(ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind Abbr) +x0 x1) (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c +u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 t3))) (ex2 T (\lambda (u: T).(pr0 u1 u)) +(\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) t1 t3))) (ex3_2 T T (\lambda (y: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z t3))))))) x0 x1 (refl_equal T (THead (Bind Abbr) x0 x1)) +(pr2_free c u1 x0 H9) (or3_intro1 (\forall (b: B).(\forall (u: T).(pr2 (CHead +c (Bind b) u) t1 x1))) (ex2 T (\lambda (u: T).(pr0 u1 u)) (\lambda (u: +T).(pr2 (CHead c (Bind Abbr) u) t1 x1))) (ex3_2 T T (\lambda (y: T).(\lambda +(_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: +T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) +z x1)))) (ex_intro2 T (\lambda (u: T).(pr0 u1 u)) (\lambda (u: T).(pr2 (CHead +c (Bind Abbr) u) t1 x1)) x0 H9 (pr2_delta (CHead c (Bind Abbr) x0) c x0 O +(getl_refl Abbr c x0) t1 x2 H10 x1 H11)))))))) (pr0_subst0_back x0 x2 x1 O +H11 u1 H9)) x H8)))) H_x0)) H_x)))))) H7)) (\lambda (H7: (pr0 t1 (lift (S O) +O x))).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead +(Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) t1 t3))) (ex2 T (\lambda (u: T).(pr0 u1 u)) (\lambda (u: +T).(pr2 (CHead c (Bind Abbr) u) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda +(_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: +T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) +z t3)))))))) (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 +(lift (S O) O x)))) (\lambda (b: B).(\lambda (u: T).(pr2_free (CHead c (Bind +b) u) t1 (lift (S O) O x) H7))))) (pr0_gen_abbr u1 t1 x H6))) t2 (sym_eq T t2 +x H5))) t0 (sym_eq T t0 (THead (Bind Abbr) u1 t1) H4))) c0 (sym_eq C c0 c H1) +H2 H3 H0)))) | (pr2_delta c0 d u i H0 t0 t2 H1 t H2) \Rightarrow (\lambda +(H3: (eq C c0 c)).(\lambda (H4: (eq T t0 (THead (Bind Abbr) u1 t1))).(\lambda +(H5: (eq T t x)).(eq_ind C c (\lambda (c1: C).((eq T t0 (THead (Bind Abbr) u1 +t1)) \to ((eq T t x) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 t0 +t2) \to ((subst0 i u t2 t) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 +u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T +(\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))))))))) (\lambda (H6: (eq +T t0 (THead (Bind Abbr) u1 t1))).(eq_ind T (THead (Bind Abbr) u1 t1) (\lambda +(t3: T).((eq T t x) \to ((getl i c (CHead d (Bind Abbr) u)) \to ((pr0 t3 t2) +\to ((subst0 i u t2 t) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t4: +T).(eq T x (THead (Bind Abbr) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(or3 (\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t4))) (ex2 T (\lambda (u0: T).(pr0 u1 +u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t4))) (ex3_2 T T +(\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z t4)))))))) (\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x)))))))))) (\lambda (H7: (eq +T t x)).(eq_ind T x (\lambda (t3: T).((getl i c (CHead d (Bind Abbr) u)) \to +((pr0 (THead (Bind Abbr) u1 t1) t2) \to ((subst0 i u t2 t3) \to (or (ex3_2 T +T (\lambda (u2: T).(\lambda (t4: T).(eq T x (THead (Bind Abbr) u2 t4)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t4: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +t4))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c +(Bind Abbr) u0) t1 t4))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) +(\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t4)))))))) +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O +x))))))))) (\lambda (H8: (getl i c (CHead d (Bind Abbr) u))).(\lambda (H9: +(pr0 (THead (Bind Abbr) u1 t1) t2)).(\lambda (H10: (subst0 i u t2 x)).(or_ind +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (u2: +T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u2 y t3))))))) (pr0 t1 (lift (S O) O t2)) (or +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 +(CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 +y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z +t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +(lift (S O) O x))))) (\lambda (H11: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T t2 (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr0 u1 u2))) (\lambda (u2: T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T +(\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O u2 y +t3)))))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda +(u2: T).(\lambda (t3: T).(or (pr0 t1 t3) (ex2 T (\lambda (y: T).(pr0 t1 y)) +(\lambda (y: T).(subst0 O u2 y t3)))))) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (H12: (eq T t2 (THead (Bind Abbr) +x0 x1))).(\lambda (H13: (pr0 u1 x0)).(\lambda (H_x: (or (pr0 t1 x1) (ex2 T +(\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O x0 y x1))))).(or_ind +(pr0 t1 x1) (ex2 T (\lambda (y: T).(pr0 t1 y)) (\lambda (y: T).(subst0 O x0 y +x1))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 +(CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 +y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z +t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +(lift (S O) O x))))) (\lambda (H14: (pr0 t1 x1)).(let H15 \def (eq_ind T t2 +(\lambda (t3: T).(subst0 i u t3 x)) H10 (THead (Bind Abbr) x0 x1) H12) in +(or3_ind (ex2 T (\lambda (u2: T).(eq T x (THead (Bind Abbr) u2 x1))) (\lambda +(u2: T).(subst0 i u x0 u2))) (ex2 T (\lambda (t3: T).(eq T x (THead (Bind +Abbr) x0 t3))) (\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x1 t3))) (ex3_2 T +T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x1 t3)))) (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c +(Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) +(\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O +x))))) (\lambda (H16: (ex2 T (\lambda (u2: T).(eq T x (THead (Bind Abbr) u2 +x1))) (\lambda (u2: T).(subst0 i u x0 u2)))).(ex2_ind T (\lambda (u2: T).(eq +T x (THead (Bind Abbr) u2 x1))) (\lambda (u2: T).(subst0 i u x0 u2)) (or +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 +(CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 +y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z +t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +(lift (S O) O x))))) (\lambda (x2: T).(\lambda (H17: (eq T x (THead (Bind +Abbr) x2 x1))).(\lambda (H18: (subst0 i u x0 x2)).(or_introl (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c +(Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) +(\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O +x)))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 +(CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 +y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z +t3))))))) x2 x1 H17 (pr2_delta c d u i H8 u1 x0 H13 x2 H18) (or3_intro0 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 x1))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 x1))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z x1)))) (\lambda (b: +B).(\lambda (u0: T).(pr2_free (CHead c (Bind b) u0) t1 x1 H14))))))))) H16)) +(\lambda (H16: (ex2 T (\lambda (t3: T).(eq T x (THead (Bind Abbr) x0 t3))) +(\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x1 t3)))).(ex2_ind T (\lambda +(t3: T).(eq T x (THead (Bind Abbr) x0 t3))) (\lambda (t3: T).(subst0 (s (Bind +Abbr) i) u x1 t3)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda +(u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c +(Bind b) u0) t1 (lift (S O) O x))))) (\lambda (x2: T).(\lambda (H17: (eq T x +(THead (Bind Abbr) x0 x2))).(\lambda (H18: (subst0 (s (Bind Abbr) i) u x1 +x2)).(or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead +(Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda +(u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c +(Bind b) u0) t1 (lift (S O) O x)))) (ex3_2_intro T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3))))))) x0 x2 H17 +(pr2_free c u1 x0 H13) (or3_intro0 (\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) t1 x2))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda +(u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 x2))) (ex3_2 T T (\lambda (y: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z x2)))) (\lambda (b: B).(\lambda (u0: T).(pr2_delta (CHead c +(Bind b) u0) d u (S i) (getl_head (Bind b) i c (CHead d (Bind Abbr) u) H8 u0) +t1 x1 H14 x2 H18))))))))) H16)) (\lambda (H16: (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind Abbr) i) u x1 t3))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s (Bind Abbr) i) u x1 t3))) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))) +(\lambda (x2: T).(\lambda (x3: T).(\lambda (H17: (eq T x (THead (Bind Abbr) +x2 x3))).(\lambda (H18: (subst0 i u x0 x2)).(\lambda (H19: (subst0 (s (Bind +Abbr) i) u x1 x3)).(or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 +u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T +(\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x)))) (ex3_2_intro T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c +(Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) +(\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3))))))) x2 +x3 H17 (pr2_delta c d u i H8 u1 x0 H13 x2 H18) (or3_intro0 (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 x3))) (ex2 T (\lambda (u0: +T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 x3))) +(ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 +y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z x3)))) (\lambda (b: B).(\lambda (u0: +T).(pr2_delta (CHead c (Bind b) u0) d u (S i) (getl_head (Bind b) i c (CHead +d (Bind Abbr) u) H8 u0) t1 x1 H14 x3 H19))))))))))) H16)) (subst0_gen_head +(Bind Abbr) u x0 x1 x i H15)))) (\lambda (H_x0: (ex2 T (\lambda (y: T).(pr0 +t1 y)) (\lambda (y: T).(subst0 O x0 y x1)))).(ex2_ind T (\lambda (y: T).(pr0 +t1 y)) (\lambda (y: T).(subst0 O x0 y x1)) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))) +(\lambda (x2: T).(\lambda (H14: (pr0 t1 x2)).(\lambda (H15: (subst0 O x0 x2 +x1)).(let H16 \def (eq_ind T t2 (\lambda (t3: T).(subst0 i u t3 x)) H10 +(THead (Bind Abbr) x0 x1) H12) in (or3_ind (ex2 T (\lambda (u2: T).(eq T x +(THead (Bind Abbr) u2 x1))) (\lambda (u2: T).(subst0 i u x0 u2))) (ex2 T +(\lambda (t3: T).(eq T x (THead (Bind Abbr) x0 t3))) (\lambda (t3: T).(subst0 +(s (Bind Abbr) i) u x1 t3))) (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq +T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u +x0 u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x1 +t3)))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 +(CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 +y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z +t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +(lift (S O) O x))))) (\lambda (H17: (ex2 T (\lambda (u2: T).(eq T x (THead +(Bind Abbr) u2 x1))) (\lambda (u2: T).(subst0 i u x0 u2)))).(ex2_ind T +(\lambda (u2: T).(eq T x (THead (Bind Abbr) u2 x1))) (\lambda (u2: T).(subst0 +i u x0 u2)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead +(Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda +(u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c +(Bind b) u0) t1 (lift (S O) O x))))) (\lambda (x3: T).(\lambda (H18: (eq T x +(THead (Bind Abbr) x3 x1))).(\lambda (H19: (subst0 i u x0 x3)).(ex2_ind T +(\lambda (t3: T).(subst0 O u1 x2 t3)) (\lambda (t3: T).(pr0 t3 x1)) (or +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 +(CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 +y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z +t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +(lift (S O) O x))))) (\lambda (x4: T).(\lambda (_: (subst0 O u1 x2 +x4)).(\lambda (_: (pr0 x4 x1)).(or_introl (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x)))) +(ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 +(CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 +y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z +t3))))))) x3 x1 H18 (pr2_delta c d u i H8 u1 x0 H13 x3 H19) (or3_intro1 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 x1))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 x1))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z x1)))) (ex_intro2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 x1)) x0 H13 (pr2_delta (CHead c (Bind Abbr) x0) c x0 O (getl_refl Abbr c +x0) t1 x2 H14 x1 H15)))))))) (pr0_subst0_back x0 x2 x1 O H15 u1 H13))))) +H17)) (\lambda (H17: (ex2 T (\lambda (t3: T).(eq T x (THead (Bind Abbr) x0 +t3))) (\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x1 t3)))).(ex2_ind T +(\lambda (t3: T).(eq T x (THead (Bind Abbr) x0 t3))) (\lambda (t3: T).(subst0 +(s (Bind Abbr) i) u x1 t3)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 +u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T +(\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))) (\lambda (x3: +T).(\lambda (H18: (eq T x (THead (Bind Abbr) x0 x3))).(\lambda (H19: (subst0 +(s (Bind Abbr) i) u x1 x3)).(ex2_ind T (\lambda (t3: T).(subst0 O u1 x2 t3)) +(\lambda (t3: T).(pr0 t3 x1)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 +u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T +(\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))) (\lambda (x4: +T).(\lambda (H20: (subst0 O u1 x2 x4)).(\lambda (H21: (pr0 x4 x1)).(or_introl +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 +(CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 +y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z +t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +(lift (S O) O x)))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T +x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 +u2))) (\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) +(\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda +(y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z t3))))))) x0 x3 H18 (pr2_free c u1 x0 H13) (or3_intro2 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 x3))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 x3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z x3)))) (ex3_2_intro T T +(\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z x3))) x4 x1 (pr2_delta (CHead c (Bind +Abbr) u1) c u1 O (getl_refl Abbr c u1) t1 x2 H14 x4 H20) H21 (pr2_delta +(CHead c (Bind Abbr) u1) d u (S i) (getl_head (Bind Abbr) i c (CHead d (Bind +Abbr) u) H8 u1) x1 x1 (pr0_refl x1) x3 H19)))))))) (pr0_subst0_back x0 x2 x1 +O H15 u1 H13))))) H17)) (\lambda (H17: (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i u x0 u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Bind +Abbr) i) u x1 t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T +x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u +x0 u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s (Bind Abbr) i) u x1 +t3))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind +b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 +(CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 +y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z +t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +(lift (S O) O x))))) (\lambda (x3: T).(\lambda (x4: T).(\lambda (H18: (eq T x +(THead (Bind Abbr) x3 x4))).(\lambda (H19: (subst0 i u x0 x3)).(\lambda (H20: +(subst0 (s (Bind Abbr) i) u x1 x4)).(ex2_ind T (\lambda (t3: T).(subst0 O u1 +x2 t3)) (\lambda (t3: T).(pr0 t3 x1)) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))) +(\lambda (x5: T).(\lambda (H21: (subst0 O u1 x2 x5)).(\lambda (H22: (pr0 x5 +x1)).(or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead +(Bind Abbr) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 +(CHead c (Bind b) u0) t1 t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda +(u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z t3)))))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c +(Bind b) u0) t1 (lift (S O) O x)))) (ex3_2_intro T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(or3 +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3))) (ex2 T +(\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) +t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) +u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: +T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3))))))) x3 x4 H18 +(pr2_delta c d u i H8 u1 x0 H13 x3 H19) (or3_intro2 (\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 x4))) (ex2 T (\lambda (u0: T).(pr0 u1 +u0)) (\lambda (u0: T).(pr2 (CHead c (Bind Abbr) u0) t1 x4))) (ex3_2 T T +(\lambda (y: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) +(\lambda (y: T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) u1) z x4)))) (ex3_2_intro T T (\lambda (y: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: +T).(\lambda (z: T).(pr0 y z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) u1) z x4))) x5 x1 (pr2_delta (CHead c (Bind Abbr) u1) c u1 O +(getl_refl Abbr c u1) t1 x2 H14 x5 H21) H22 (pr2_delta (CHead c (Bind Abbr) +u1) d u (S i) (getl_head (Bind Abbr) i c (CHead d (Bind Abbr) u) H8 u1) x1 x1 +(pr0_refl x1) x4 H20)))))))) (pr0_subst0_back x0 x2 x1 O H15 u1 H13))))))) +H17)) (subst0_gen_head (Bind Abbr) u x0 x1 x i H16)))))) H_x0)) H_x)))))) +H11)) (\lambda (H11: (pr0 t1 (lift (S O) O t2))).(or_intror (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Abbr) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(or3 (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +t3))) (ex2 T (\lambda (u0: T).(pr0 u1 u0)) (\lambda (u0: T).(pr2 (CHead c +(Bind Abbr) u0) t1 t3))) (ex3_2 T T (\lambda (y: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) u1) t1 y))) (\lambda (y: T).(\lambda (z: T).(pr0 y z))) +(\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) u1) z t3)))))))) +(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O +x)))) (\lambda (b: B).(\lambda (u0: T).(pr2_delta (CHead c (Bind b) u0) d u +(S i) (getl_head (Bind b) i c (CHead d (Bind Abbr) u) H8 u0) t1 (lift (S O) O +t2) H11 (lift (S O) O x) (subst0_lift_ge_S t2 x u i H10 O (le_O_n i))))))) +(pr0_gen_abbr u1 t1 t2 H9))))) t (sym_eq T t x H7))) t0 (sym_eq T t0 (THead +(Bind Abbr) u1 t1) H6))) c0 (sym_eq C c0 c H3) H4 H5 H0 H1 H2))))]) in (H0 +(refl_equal C c) (refl_equal T (THead (Bind Abbr) u1 t1)) (refl_equal T +x))))))). + +theorem pr2_gen_void: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr2 c +(THead (Bind Void) u1 t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) t1 t2)))))) (\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O x))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr2 c (THead (Bind Void) u1 t1) x)).(let H0 \def (match H in pr2 return +(\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t +t0)).((eq C c0 c) \to ((eq T t (THead (Bind Void) u1 t1)) \to ((eq T t0 x) +\to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind +Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +t1 t2)))))) (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 +(lift (S O) O x)))))))))))) with [(pr2_free c0 t0 t2 H0) \Rightarrow (\lambda +(H1: (eq C c0 c)).(\lambda (H2: (eq T t0 (THead (Bind Void) u1 t1))).(\lambda +(H3: (eq T t2 x)).(eq_ind C c (\lambda (_: C).((eq T t0 (THead (Bind Void) u1 +t1)) \to ((eq T t2 x) \to ((pr0 t0 t2) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3)))))) (\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O x))))))))) +(\lambda (H4: (eq T t0 (THead (Bind Void) u1 t1))).(eq_ind T (THead (Bind +Void) u1 t1) (\lambda (t: T).((eq T t2 x) \to ((pr0 t t2) \to (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3)))))) +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O +x)))))))) (\lambda (H5: (eq T t2 x)).(eq_ind T x (\lambda (t: T).((pr0 (THead +(Bind Void) u1 t1) t) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 t3)))))) (\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) t1 (lift (S O) O x))))))) (\lambda (H6: (pr0 (THead +(Bind Void) u1 t1) x)).(or_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 +u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3)))) (pr0 t1 (lift (S O) +O x)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +t1 t3)))))) (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 +(lift (S O) O x))))) (\lambda (H7: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 +u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: +T).(pr0 t1 t3))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead +c (Bind b) u) t1 t3)))))) (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind +b) u) t1 (lift (S O) O x))))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H8: +(eq T x (THead (Bind Void) x0 x1))).(\lambda (H9: (pr0 u1 x0)).(\lambda (H10: +(pr0 t1 x1)).(eq_ind_r T (THead (Bind Void) x0 x1) (\lambda (t: T).(or (ex3_2 +T T (\lambda (u2: T).(\lambda (t3: T).(eq T t (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 t3)))))) +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O +t)))))) (or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead +(Bind Void) x0 x1) (THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) t1 t3)))))) (\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 (lift (S O) O (THead (Bind Void) x0 x1))))) +(ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T (THead (Bind Void) +x0 x1) (THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c +u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 t3))))) x0 x1 (refl_equal T (THead (Bind +Void) x0 x1)) (pr2_free c u1 x0 H9) (\lambda (b: B).(\lambda (u: T).(pr2_free +(CHead c (Bind b) u) t1 x1 H10))))) x H8)))))) H7)) (\lambda (H7: (pr0 t1 +(lift (S O) O x))).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 +c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) t1 t3)))))) (\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) t1 (lift (S O) O x)))) (\lambda (b: B).(\lambda (u: +T).(pr2_free (CHead c (Bind b) u) t1 (lift (S O) O x) H7))))) (pr0_gen_void +u1 t1 x H6))) t2 (sym_eq T t2 x H5))) t0 (sym_eq T t0 (THead (Bind Void) u1 +t1) H4))) c0 (sym_eq C c0 c H1) H2 H3 H0)))) | (pr2_delta c0 d u i H0 t0 t2 +H1 t H2) \Rightarrow (\lambda (H3: (eq C c0 c)).(\lambda (H4: (eq T t0 (THead +(Bind Void) u1 t1))).(\lambda (H5: (eq T t x)).(eq_ind C c (\lambda (c1: +C).((eq T t0 (THead (Bind Void) u1 t1)) \to ((eq T t x) \to ((getl i c1 +(CHead d (Bind Abbr) u)) \to ((pr0 t0 t2) \to ((subst0 i u t2 t) \to (or +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) t1 t3)))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) +t1 (lift (S O) O x))))))))))) (\lambda (H6: (eq T t0 (THead (Bind Void) u1 +t1))).(eq_ind T (THead (Bind Void) u1 t1) (\lambda (t3: T).((eq T t x) \to +((getl i c (CHead d (Bind Abbr) u)) \to ((pr0 t3 t2) \to ((subst0 i u t2 t) +\to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T x (THead (Bind +Void) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t4: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) t1 t4)))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) +t1 (lift (S O) O x)))))))))) (\lambda (H7: (eq T t x)).(eq_ind T x (\lambda +(t3: T).((getl i c (CHead d (Bind Abbr) u)) \to ((pr0 (THead (Bind Void) u1 +t1) t2) \to ((subst0 i u t2 t3) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t4: T).(eq T x (THead (Bind Void) u2 t4)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t4)))))) (\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))))))) (\lambda (H8: (getl +i c (CHead d (Bind Abbr) u))).(\lambda (H9: (pr0 (THead (Bind Void) u1 t1) +t2)).(\lambda (H10: (subst0 i u t2 x)).(or_ind (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr0 t1 +t3)))) (pr0 t1 (lift (S O) O t2)) (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))) (\lambda (H11: (ex3_2 T +T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) (\lambda (_: T).(\lambda (t3: +T).(pr0 t1 t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 +(THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr0 u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr0 t1 t3))) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (H12: (eq T t2 (THead (Bind Void) +x0 x1))).(\lambda (H13: (pr0 u1 x0)).(\lambda (H14: (pr0 t1 x1)).(let H15 +\def (eq_ind T t2 (\lambda (t3: T).(subst0 i u t3 x)) H10 (THead (Bind Void) +x0 x1) H12) in (or3_ind (ex2 T (\lambda (u2: T).(eq T x (THead (Bind Void) u2 +x1))) (\lambda (u2: T).(subst0 i u x0 u2))) (ex2 T (\lambda (t3: T).(eq T x +(THead (Bind Void) x0 t3))) (\lambda (t3: T).(subst0 (s (Bind Void) i) u x1 +t3))) (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Void) i) u x1 t3)))) (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +t3)))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift +(S O) O x))))) (\lambda (H16: (ex2 T (\lambda (u2: T).(eq T x (THead (Bind +Void) u2 x1))) (\lambda (u2: T).(subst0 i u x0 u2)))).(ex2_ind T (\lambda +(u2: T).(eq T x (THead (Bind Void) u2 x1))) (\lambda (u2: T).(subst0 i u x0 +u2)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind +Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) t1 t3)))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) +t1 (lift (S O) O x))))) (\lambda (x2: T).(\lambda (H17: (eq T x (THead (Bind +Void) x2 x1))).(\lambda (H18: (subst0 i u x0 x2)).(or_introl (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +t3)))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift +(S O) O x)))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T x +(THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead +c (Bind b) u0) t1 t3))))) x2 x1 H17 (pr2_delta c d u i H8 u1 x0 H13 x2 H18) +(\lambda (b: B).(\lambda (u0: T).(pr2_free (CHead c (Bind b) u0) t1 x1 +H14)))))))) H16)) (\lambda (H16: (ex2 T (\lambda (t3: T).(eq T x (THead (Bind +Void) x0 t3))) (\lambda (t3: T).(subst0 (s (Bind Void) i) u x1 +t3)))).(ex2_ind T (\lambda (t3: T).(eq T x (THead (Bind Void) x0 t3))) +(\lambda (t3: T).(subst0 (s (Bind Void) i) u x1 t3)) (or (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x))))) +(\lambda (x2: T).(\lambda (H17: (eq T x (THead (Bind Void) x0 x2))).(\lambda +(H18: (subst0 (s (Bind Void) i) u x1 x2)).(or_introl (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x)))) +(ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) t1 t3))))) x0 x2 H17 (pr2_free c u1 x0 H13) (\lambda (b: B).(\lambda (u0: +T).(pr2_delta (CHead c (Bind b) u0) d u (S i) (getl_head (Bind b) i c (CHead +d (Bind Abbr) u) H8 u0) t1 x1 H14 x2 H18)))))))) H16)) (\lambda (H16: (ex3_2 +T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Void) i) u x1 t3))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u x0 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s (Bind Void) i) u x1 t3))) (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda +(t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 +t3)))))) (\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift +(S O) O x))))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H17: (eq T x +(THead (Bind Void) x2 x3))).(\lambda (H18: (subst0 i u x0 x2)).(\lambda (H19: +(subst0 (s (Bind Void) i) u x1 x3)).(or_introl (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x)))) +(ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T x (THead (Bind Void) +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) t1 t3))))) x2 x3 H17 (pr2_delta c d u i H8 u1 x0 H13 x2 H18) (\lambda (b: +B).(\lambda (u0: T).(pr2_delta (CHead c (Bind b) u0) d u (S i) (getl_head +(Bind b) i c (CHead d (Bind Abbr) u) H8 u0) t1 x1 H14 x3 H19)))))))))) H16)) +(subst0_gen_head (Bind Void) u x0 x1 x i H15)))))))) H11)) (\lambda (H11: +(pr0 t1 (lift (S O) O t2))).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x (THead (Bind Void) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c u1 u2))) (\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u0: T).(pr2 (CHead c (Bind b) u0) t1 t3)))))) (\forall (b: B).(\forall (u0: +T).(pr2 (CHead c (Bind b) u0) t1 (lift (S O) O x)))) (\lambda (b: B).(\lambda +(u0: T).(pr2_delta (CHead c (Bind b) u0) d u (S i) (getl_head (Bind b) i c +(CHead d (Bind Abbr) u) H8 u0) t1 (lift (S O) O t2) H11 (lift (S O) O x) +(subst0_lift_ge_S t2 x u i H10 O (le_O_n i))))))) (pr0_gen_void u1 t1 t2 +H9))))) t (sym_eq T t x H7))) t0 (sym_eq T t0 (THead (Bind Void) u1 t1) H6))) +c0 (sym_eq C c0 c H3) H4 H5 H0 H1 H2))))]) in (H0 (refl_equal C c) +(refl_equal T (THead (Bind Void) u1 t1)) (refl_equal T x))))))). + +theorem pr2_gen_lift: + \forall (c: C).(\forall (t1: T).(\forall (x: T).(\forall (h: nat).(\forall +(d: nat).((pr2 c (lift h d t1) x) \to (\forall (e: C).((drop h d c e) \to +(ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(pr2 e t1 +t2)))))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (x: T).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (H: (pr2 c (lift h d t1) x)).(\lambda (e: C).(\lambda (H0: +(drop h d c e)).(let H1 \def (match H in pr2 return (\lambda (c0: C).(\lambda +(t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 c) \to ((eq T t +(lift h d t1)) \to ((eq T t0 x) \to (ex2 T (\lambda (t2: T).(eq T x (lift h d +t2))) (\lambda (t2: T).(pr2 e t1 t2)))))))))) with [(pr2_free c0 t0 t2 H1) +\Rightarrow (\lambda (H2: (eq C c0 c)).(\lambda (H3: (eq T t0 (lift h d +t1))).(\lambda (H4: (eq T t2 x)).(eq_ind C c (\lambda (_: C).((eq T t0 (lift +h d t1)) \to ((eq T t2 x) \to ((pr0 t0 t2) \to (ex2 T (\lambda (t3: T).(eq T +x (lift h d t3))) (\lambda (t3: T).(pr2 e t1 t3))))))) (\lambda (H5: (eq T t0 +(lift h d t1))).(eq_ind T (lift h d t1) (\lambda (t: T).((eq T t2 x) \to +((pr0 t t2) \to (ex2 T (\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: +T).(pr2 e t1 t3)))))) (\lambda (H6: (eq T t2 x)).(eq_ind T x (\lambda (t: +T).((pr0 (lift h d t1) t) \to (ex2 T (\lambda (t3: T).(eq T x (lift h d t3))) +(\lambda (t3: T).(pr2 e t1 t3))))) (\lambda (H7: (pr0 (lift h d t1) +x)).(ex2_ind T (\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: T).(pr0 +t1 t3)) (ex2 T (\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: T).(pr2 +e t1 t3))) (\lambda (x0: T).(\lambda (H8: (eq T x (lift h d x0))).(\lambda +(H9: (pr0 t1 x0)).(eq_ind_r T (lift h d x0) (\lambda (t: T).(ex2 T (\lambda +(t3: T).(eq T t (lift h d t3))) (\lambda (t3: T).(pr2 e t1 t3)))) (ex_intro2 +T (\lambda (t3: T).(eq T (lift h d x0) (lift h d t3))) (\lambda (t3: T).(pr2 +e t1 t3)) x0 (refl_equal T (lift h d x0)) (pr2_free e t1 x0 H9)) x H8)))) +(pr0_gen_lift t1 x h d H7))) t2 (sym_eq T t2 x H6))) t0 (sym_eq T t0 (lift h +d t1) H5))) c0 (sym_eq C c0 c H2) H3 H4 H1)))) | (pr2_delta c0 d0 u i H1 t0 +t2 H2 t H3) \Rightarrow (\lambda (H4: (eq C c0 c)).(\lambda (H5: (eq T t0 +(lift h d t1))).(\lambda (H6: (eq T t x)).(eq_ind C c (\lambda (c1: C).((eq T +t0 (lift h d t1)) \to ((eq T t x) \to ((getl i c1 (CHead d0 (Bind Abbr) u)) +\to ((pr0 t0 t2) \to ((subst0 i u t2 t) \to (ex2 T (\lambda (t3: T).(eq T x +(lift h d t3))) (\lambda (t3: T).(pr2 e t1 t3))))))))) (\lambda (H7: (eq T t0 +(lift h d t1))).(eq_ind T (lift h d t1) (\lambda (t3: T).((eq T t x) \to +((getl i c (CHead d0 (Bind Abbr) u)) \to ((pr0 t3 t2) \to ((subst0 i u t2 t) +\to (ex2 T (\lambda (t4: T).(eq T x (lift h d t4))) (\lambda (t4: T).(pr2 e +t1 t4)))))))) (\lambda (H8: (eq T t x)).(eq_ind T x (\lambda (t3: T).((getl i +c (CHead d0 (Bind Abbr) u)) \to ((pr0 (lift h d t1) t2) \to ((subst0 i u t2 +t3) \to (ex2 T (\lambda (t4: T).(eq T x (lift h d t4))) (\lambda (t4: T).(pr2 +e t1 t4))))))) (\lambda (H9: (getl i c (CHead d0 (Bind Abbr) u))).(\lambda +(H10: (pr0 (lift h d t1) t2)).(\lambda (H11: (subst0 i u t2 x)).(ex2_ind T +(\lambda (t3: T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(pr0 t1 t3)) (ex2 +T (\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: T).(pr2 e t1 t3))) +(\lambda (x0: T).(\lambda (H12: (eq T t2 (lift h d x0))).(\lambda (H13: (pr0 +t1 x0)).(let H14 \def (eq_ind T t2 (\lambda (t3: T).(subst0 i u t3 x)) H11 +(lift h d x0) H12) in (lt_le_e i d (ex2 T (\lambda (t3: T).(eq T x (lift h d +t3))) (\lambda (t3: T).(pr2 e t1 t3))) (\lambda (H15: (lt i d)).(let H16 \def +(eq_ind nat d (\lambda (n: nat).(drop h n c e)) H0 (S (plus i (minus d (S +i)))) (lt_plus_minus i d H15)) in (let H17 \def (eq_ind nat d (\lambda (n: +nat).(subst0 i u (lift h n x0) x)) H14 (S (plus i (minus d (S i)))) +(lt_plus_minus i d H15)) in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift h (minus d (S i)) v)))) (\lambda (v: T).(\lambda (e0: +C).(getl i e (CHead e0 (Bind Abbr) v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (minus d (S i)) d0 e0))) (ex2 T (\lambda (t3: T).(eq T x (lift h d +t3))) (\lambda (t3: T).(pr2 e t1 t3))) (\lambda (x1: T).(\lambda (x2: +C).(\lambda (H18: (eq T u (lift h (minus d (S i)) x1))).(\lambda (H19: (getl +i e (CHead x2 (Bind Abbr) x1))).(\lambda (_: (drop h (minus d (S i)) d0 +x2)).(let H21 \def (eq_ind T u (\lambda (t3: T).(subst0 i t3 (lift h (S (plus +i (minus d (S i)))) x0) x)) H17 (lift h (minus d (S i)) x1) H18) in (ex2_ind +T (\lambda (t3: T).(eq T x (lift h (S (plus i (minus d (S i)))) t3))) +(\lambda (t3: T).(subst0 i x1 x0 t3)) (ex2 T (\lambda (t3: T).(eq T x (lift h +d t3))) (\lambda (t3: T).(pr2 e t1 t3))) (\lambda (x3: T).(\lambda (H22: (eq +T x (lift h (S (plus i (minus d (S i)))) x3))).(\lambda (H23: (subst0 i x1 x0 +x3)).(let H24 \def (eq_ind_r nat (S (plus i (minus d (S i)))) (\lambda (n: +nat).(eq T x (lift h n x3))) H22 d (lt_plus_minus i d H15)) in (ex_intro2 T +(\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: T).(pr2 e t1 t3)) x3 +H24 (pr2_delta e x2 x1 i H19 t1 x0 H13 x3 H23)))))) (subst0_gen_lift_lt x1 x0 +x i h (minus d (S i)) H21)))))))) (getl_drop_conf_lt Abbr c d0 u i H9 e h +(minus d (S i)) H16))))) (\lambda (H15: (le d i)).(lt_le_e i (plus d h) (ex2 +T (\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: T).(pr2 e t1 t3))) +(\lambda (H16: (lt i (plus d h))).(subst0_gen_lift_false x0 u x h d i H15 H16 +H14 (ex2 T (\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: T).(pr2 e +t1 t3))))) (\lambda (H16: (le (plus d h) i)).(ex2_ind T (\lambda (t3: T).(eq +T x (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u x0 t3)) (ex2 T +(\lambda (t3: T).(eq T x (lift h d t3))) (\lambda (t3: T).(pr2 e t1 t3))) +(\lambda (x1: T).(\lambda (H17: (eq T x (lift h d x1))).(\lambda (H18: +(subst0 (minus i h) u x0 x1)).(ex_intro2 T (\lambda (t3: T).(eq T x (lift h d +t3))) (\lambda (t3: T).(pr2 e t1 t3)) x1 H17 (pr2_delta e d0 u (minus i h) +(getl_drop_conf_ge i (CHead d0 (Bind Abbr) u) c H9 e h d H0 H16) t1 x0 H13 x1 +H18))))) (subst0_gen_lift_ge u x0 x i h d H14 H16)))))))))) (pr0_gen_lift t1 +t2 h d H10))))) t (sym_eq T t x H8))) t0 (sym_eq T t0 (lift h d t1) H7))) c0 +(sym_eq C c0 c H4) H5 H6 H1 H2 H3))))]) in (H1 (refl_equal C c) (refl_equal T +(lift h d t1)) (refl_equal T x)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/pr2.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/pr2.ma new file mode 100644 index 000000000..307d55398 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/pr2.ma @@ -0,0 +1,248 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr2/pr2". + +include "pr2/defs.ma". + +include "pr0/pr0.ma". + +include "getl/props.ma". + +theorem pr2_confluence__pr2_free_free: + \forall (c: C).(\forall (t0: T).(\forall (t1: T).(\forall (t2: T).((pr0 t0 +t1) \to ((pr0 t0 t2) \to (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: +T).(pr2 c t2 t)))))))) +\def + \lambda (c: C).(\lambda (t0: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (pr0 t0 t1)).(\lambda (H0: (pr0 t0 t2)).(ex2_ind T (\lambda (t: T).(pr0 +t2 t)) (\lambda (t: T).(pr0 t1 t)) (ex2 T (\lambda (t: T).(pr2 c t1 t)) +(\lambda (t: T).(pr2 c t2 t))) (\lambda (x: T).(\lambda (H1: (pr0 t2 +x)).(\lambda (H2: (pr0 t1 x)).(ex_intro2 T (\lambda (t: T).(pr2 c t1 t)) +(\lambda (t: T).(pr2 c t2 t)) x (pr2_free c t1 x H2) (pr2_free c t2 x H1))))) +(pr0_confluence t0 t2 H0 t1 H))))))). + +theorem pr2_confluence__pr2_free_delta: + \forall (c: C).(\forall (d: C).(\forall (t0: T).(\forall (t1: T).(\forall +(t2: T).(\forall (t4: T).(\forall (u: T).(\forall (i: nat).((pr0 t0 t1) \to +((getl i c (CHead d (Bind Abbr) u)) \to ((pr0 t0 t4) \to ((subst0 i u t4 t2) +\to (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 +t)))))))))))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (t0: T).(\lambda (t1: T).(\lambda +(t2: T).(\lambda (t4: T).(\lambda (u: T).(\lambda (i: nat).(\lambda (H: (pr0 +t0 t1)).(\lambda (H0: (getl i c (CHead d (Bind Abbr) u))).(\lambda (H1: (pr0 +t0 t4)).(\lambda (H2: (subst0 i u t4 t2)).(ex2_ind T (\lambda (t: T).(pr0 t4 +t)) (\lambda (t: T).(pr0 t1 t)) (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda +(t: T).(pr2 c t2 t))) (\lambda (x: T).(\lambda (H3: (pr0 t4 x)).(\lambda (H4: +(pr0 t1 x)).(or_ind (pr0 t2 x) (ex2 T (\lambda (w2: T).(pr0 t2 w2)) (\lambda +(w2: T).(subst0 i u x w2))) (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: +T).(pr2 c t2 t))) (\lambda (H5: (pr0 t2 x)).(ex_intro2 T (\lambda (t: T).(pr2 +c t1 t)) (\lambda (t: T).(pr2 c t2 t)) x (pr2_free c t1 x H4) (pr2_free c t2 +x H5))) (\lambda (H5: (ex2 T (\lambda (w2: T).(pr0 t2 w2)) (\lambda (w2: +T).(subst0 i u x w2)))).(ex2_ind T (\lambda (w2: T).(pr0 t2 w2)) (\lambda +(w2: T).(subst0 i u x w2)) (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: +T).(pr2 c t2 t))) (\lambda (x0: T).(\lambda (H6: (pr0 t2 x0)).(\lambda (H7: +(subst0 i u x x0)).(ex_intro2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: +T).(pr2 c t2 t)) x0 (pr2_delta c d u i H0 t1 x H4 x0 H7) (pr2_free c t2 x0 +H6))))) H5)) (pr0_subst0 t4 x H3 u t2 i H2 u (pr0_refl u)))))) +(pr0_confluence t0 t4 H1 t1 H))))))))))))). + +theorem pr2_confluence__pr2_delta_delta: + \forall (c: C).(\forall (d: C).(\forall (d0: C).(\forall (t0: T).(\forall +(t1: T).(\forall (t2: T).(\forall (t3: T).(\forall (t4: T).(\forall (u: +T).(\forall (u0: T).(\forall (i: nat).(\forall (i0: nat).((getl i c (CHead d +(Bind Abbr) u)) \to ((pr0 t0 t3) \to ((subst0 i u t3 t1) \to ((getl i0 c +(CHead d0 (Bind Abbr) u0)) \to ((pr0 t0 t4) \to ((subst0 i0 u0 t4 t2) \to +(ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 +t)))))))))))))))))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (d0: C).(\lambda (t0: T).(\lambda +(t1: T).(\lambda (t2: T).(\lambda (t3: T).(\lambda (t4: T).(\lambda (u: +T).(\lambda (u0: T).(\lambda (i: nat).(\lambda (i0: nat).(\lambda (H: (getl i +c (CHead d (Bind Abbr) u))).(\lambda (H0: (pr0 t0 t3)).(\lambda (H1: (subst0 +i u t3 t1)).(\lambda (H2: (getl i0 c (CHead d0 (Bind Abbr) u0))).(\lambda +(H3: (pr0 t0 t4)).(\lambda (H4: (subst0 i0 u0 t4 t2)).(ex2_ind T (\lambda (t: +T).(pr0 t4 t)) (\lambda (t: T).(pr0 t3 t)) (ex2 T (\lambda (t: T).(pr2 c t1 +t)) (\lambda (t: T).(pr2 c t2 t))) (\lambda (x: T).(\lambda (H5: (pr0 t4 +x)).(\lambda (H6: (pr0 t3 x)).(or_ind (pr0 t1 x) (ex2 T (\lambda (w2: T).(pr0 +t1 w2)) (\lambda (w2: T).(subst0 i u x w2))) (ex2 T (\lambda (t: T).(pr2 c t1 +t)) (\lambda (t: T).(pr2 c t2 t))) (\lambda (H7: (pr0 t1 x)).(or_ind (pr0 t2 +x) (ex2 T (\lambda (w2: T).(pr0 t2 w2)) (\lambda (w2: T).(subst0 i0 u0 x +w2))) (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t))) +(\lambda (H8: (pr0 t2 x)).(ex_intro2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda +(t: T).(pr2 c t2 t)) x (pr2_free c t1 x H7) (pr2_free c t2 x H8))) (\lambda +(H8: (ex2 T (\lambda (w2: T).(pr0 t2 w2)) (\lambda (w2: T).(subst0 i0 u0 x +w2)))).(ex2_ind T (\lambda (w2: T).(pr0 t2 w2)) (\lambda (w2: T).(subst0 i0 +u0 x w2)) (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t))) +(\lambda (x0: T).(\lambda (H9: (pr0 t2 x0)).(\lambda (H10: (subst0 i0 u0 x +x0)).(ex_intro2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t)) +x0 (pr2_delta c d0 u0 i0 H2 t1 x H7 x0 H10) (pr2_free c t2 x0 H9))))) H8)) +(pr0_subst0 t4 x H5 u0 t2 i0 H4 u0 (pr0_refl u0)))) (\lambda (H7: (ex2 T +(\lambda (w2: T).(pr0 t1 w2)) (\lambda (w2: T).(subst0 i u x w2)))).(ex2_ind +T (\lambda (w2: T).(pr0 t1 w2)) (\lambda (w2: T).(subst0 i u x w2)) (ex2 T +(\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t))) (\lambda (x0: +T).(\lambda (H8: (pr0 t1 x0)).(\lambda (H9: (subst0 i u x x0)).(or_ind (pr0 +t2 x) (ex2 T (\lambda (w2: T).(pr0 t2 w2)) (\lambda (w2: T).(subst0 i0 u0 x +w2))) (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t))) +(\lambda (H10: (pr0 t2 x)).(ex_intro2 T (\lambda (t: T).(pr2 c t1 t)) +(\lambda (t: T).(pr2 c t2 t)) x0 (pr2_free c t1 x0 H8) (pr2_delta c d u i H +t2 x H10 x0 H9))) (\lambda (H10: (ex2 T (\lambda (w2: T).(pr0 t2 w2)) +(\lambda (w2: T).(subst0 i0 u0 x w2)))).(ex2_ind T (\lambda (w2: T).(pr0 t2 +w2)) (\lambda (w2: T).(subst0 i0 u0 x w2)) (ex2 T (\lambda (t: T).(pr2 c t1 +t)) (\lambda (t: T).(pr2 c t2 t))) (\lambda (x1: T).(\lambda (H11: (pr0 t2 +x1)).(\lambda (H12: (subst0 i0 u0 x x1)).(neq_eq_e i i0 (ex2 T (\lambda (t: +T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t))) (\lambda (H13: (not (eq nat i +i0))).(ex2_ind T (\lambda (t: T).(subst0 i u x1 t)) (\lambda (t: T).(subst0 +i0 u0 x0 t)) (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 +t))) (\lambda (x2: T).(\lambda (H14: (subst0 i u x1 x2)).(\lambda (H15: +(subst0 i0 u0 x0 x2)).(ex_intro2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: +T).(pr2 c t2 t)) x2 (pr2_delta c d0 u0 i0 H2 t1 x0 H8 x2 H15) (pr2_delta c d +u i H t2 x1 H11 x2 H14))))) (subst0_confluence_neq x x1 u0 i0 H12 x0 u i H9 +(sym_not_eq nat i i0 H13)))) (\lambda (H13: (eq nat i i0)).(let H14 \def +(eq_ind_r nat i0 (\lambda (n: nat).(subst0 n u0 x x1)) H12 i H13) in (let H15 +\def (eq_ind_r nat i0 (\lambda (n: nat).(getl n c (CHead d0 (Bind Abbr) u0))) +H2 i H13) in (let H16 \def (eq_ind C (CHead d (Bind Abbr) u) (\lambda (c0: +C).(getl i c c0)) H (CHead d0 (Bind Abbr) u0) (getl_mono c (CHead d (Bind +Abbr) u) i H (CHead d0 (Bind Abbr) u0) H15)) in (let H17 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow d | (CHead c0 _ _) \Rightarrow c0])) (CHead d (Bind Abbr) u) +(CHead d0 (Bind Abbr) u0) (getl_mono c (CHead d (Bind Abbr) u) i H (CHead d0 +(Bind Abbr) u0) H15)) in ((let H18 \def (f_equal C T (\lambda (e: C).(match e +in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t) +\Rightarrow t])) (CHead d (Bind Abbr) u) (CHead d0 (Bind Abbr) u0) (getl_mono +c (CHead d (Bind Abbr) u) i H (CHead d0 (Bind Abbr) u0) H15)) in (\lambda +(H19: (eq C d d0)).(let H20 \def (eq_ind_r T u0 (\lambda (t: T).(subst0 i t x +x1)) H14 u H18) in (let H21 \def (eq_ind_r T u0 (\lambda (t: T).(getl i c +(CHead d0 (Bind Abbr) t))) H16 u H18) in (let H22 \def (eq_ind_r C d0 +(\lambda (c0: C).(getl i c (CHead c0 (Bind Abbr) u))) H21 d H19) in (or4_ind +(eq T x1 x0) (ex2 T (\lambda (t: T).(subst0 i u x1 t)) (\lambda (t: +T).(subst0 i u x0 t))) (subst0 i u x1 x0) (subst0 i u x0 x1) (ex2 T (\lambda +(t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t))) (\lambda (H23: (eq T x1 +x0)).(let H24 \def (eq_ind T x1 (\lambda (t: T).(pr0 t2 t)) H11 x0 H23) in +(ex_intro2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t)) x0 +(pr2_free c t1 x0 H8) (pr2_free c t2 x0 H24)))) (\lambda (H23: (ex2 T +(\lambda (t: T).(subst0 i u x1 t)) (\lambda (t: T).(subst0 i u x0 +t)))).(ex2_ind T (\lambda (t: T).(subst0 i u x1 t)) (\lambda (t: T).(subst0 i +u x0 t)) (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t))) +(\lambda (x2: T).(\lambda (H24: (subst0 i u x1 x2)).(\lambda (H25: (subst0 i +u x0 x2)).(ex_intro2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c +t2 t)) x2 (pr2_delta c d u i H22 t1 x0 H8 x2 H25) (pr2_delta c d u i H22 t2 +x1 H11 x2 H24))))) H23)) (\lambda (H23: (subst0 i u x1 x0)).(ex_intro2 T +(\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 t)) x0 (pr2_free c t1 +x0 H8) (pr2_delta c d u i H22 t2 x1 H11 x0 H23))) (\lambda (H23: (subst0 i u +x0 x1)).(ex_intro2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 +t)) x1 (pr2_delta c d u i H22 t1 x0 H8 x1 H23) (pr2_free c t2 x1 H11))) +(subst0_confluence_eq x x1 u i H20 x0 H9))))))) H17)))))))))) H10)) +(pr0_subst0 t4 x H5 u0 t2 i0 H4 u0 (pr0_refl u0)))))) H7)) (pr0_subst0 t3 x +H6 u t1 i H1 u (pr0_refl u)))))) (pr0_confluence t0 t4 H3 t3 +H0))))))))))))))))))). + +theorem pr2_confluence: + \forall (c: C).(\forall (t0: T).(\forall (t1: T).((pr2 c t0 t1) \to (\forall +(t2: T).((pr2 c t0 t2) \to (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: +T).(pr2 c t2 t)))))))) +\def + \lambda (c: C).(\lambda (t0: T).(\lambda (t1: T).(\lambda (H: (pr2 c t0 +t1)).(\lambda (t2: T).(\lambda (H0: (pr2 c t0 t2)).(let H1 \def (match H in +pr2 return (\lambda (c0: C).(\lambda (t: T).(\lambda (t3: T).(\lambda (_: +(pr2 c0 t t3)).((eq C c0 c) \to ((eq T t t0) \to ((eq T t3 t1) \to (ex2 T +(\lambda (t4: T).(pr2 c t1 t4)) (\lambda (t4: T).(pr2 c t2 t4)))))))))) with +[(pr2_free c0 t3 t4 H1) \Rightarrow (\lambda (H2: (eq C c0 c)).(\lambda (H3: +(eq T t3 t0)).(\lambda (H4: (eq T t4 t1)).(eq_ind C c (\lambda (_: C).((eq T +t3 t0) \to ((eq T t4 t1) \to ((pr0 t3 t4) \to (ex2 T (\lambda (t: T).(pr2 c +t1 t)) (\lambda (t: T).(pr2 c t2 t))))))) (\lambda (H5: (eq T t3 t0)).(eq_ind +T t0 (\lambda (t: T).((eq T t4 t1) \to ((pr0 t t4) \to (ex2 T (\lambda (t5: +T).(pr2 c t1 t5)) (\lambda (t5: T).(pr2 c t2 t5)))))) (\lambda (H6: (eq T t4 +t1)).(eq_ind T t1 (\lambda (t: T).((pr0 t0 t) \to (ex2 T (\lambda (t5: +T).(pr2 c t1 t5)) (\lambda (t5: T).(pr2 c t2 t5))))) (\lambda (H7: (pr0 t0 +t1)).(let H8 \def (match H0 in pr2 return (\lambda (c1: C).(\lambda (t: +T).(\lambda (t5: T).(\lambda (_: (pr2 c1 t t5)).((eq C c1 c) \to ((eq T t t0) +\to ((eq T t5 t2) \to (ex2 T (\lambda (t6: T).(pr2 c t1 t6)) (\lambda (t6: +T).(pr2 c t2 t6)))))))))) with [(pr2_free c1 t5 t6 H8) \Rightarrow (\lambda +(H9: (eq C c1 c)).(\lambda (H10: (eq T t5 t0)).(\lambda (H11: (eq T t6 +t2)).(eq_ind C c (\lambda (_: C).((eq T t5 t0) \to ((eq T t6 t2) \to ((pr0 t5 +t6) \to (ex2 T (\lambda (t: T).(pr2 c t1 t)) (\lambda (t: T).(pr2 c t2 +t))))))) (\lambda (H12: (eq T t5 t0)).(eq_ind T t0 (\lambda (t: T).((eq T t6 +t2) \to ((pr0 t t6) \to (ex2 T (\lambda (t7: T).(pr2 c t1 t7)) (\lambda (t7: +T).(pr2 c t2 t7)))))) (\lambda (H13: (eq T t6 t2)).(eq_ind T t2 (\lambda (t: +T).((pr0 t0 t) \to (ex2 T (\lambda (t7: T).(pr2 c t1 t7)) (\lambda (t7: +T).(pr2 c t2 t7))))) (\lambda (H14: (pr0 t0 +t2)).(pr2_confluence__pr2_free_free c t0 t1 t2 H7 H14)) t6 (sym_eq T t6 t2 +H13))) t5 (sym_eq T t5 t0 H12))) c1 (sym_eq C c1 c H9) H10 H11 H8)))) | +(pr2_delta c1 d u i H8 t5 t6 H9 t H10) \Rightarrow (\lambda (H11: (eq C c1 +c)).(\lambda (H12: (eq T t5 t0)).(\lambda (H13: (eq T t t2)).(eq_ind C c +(\lambda (c2: C).((eq T t5 t0) \to ((eq T t t2) \to ((getl i c2 (CHead d +(Bind Abbr) u)) \to ((pr0 t5 t6) \to ((subst0 i u t6 t) \to (ex2 T (\lambda +(t7: T).(pr2 c t1 t7)) (\lambda (t7: T).(pr2 c t2 t7))))))))) (\lambda (H14: +(eq T t5 t0)).(eq_ind T t0 (\lambda (t7: T).((eq T t t2) \to ((getl i c +(CHead d (Bind Abbr) u)) \to ((pr0 t7 t6) \to ((subst0 i u t6 t) \to (ex2 T +(\lambda (t8: T).(pr2 c t1 t8)) (\lambda (t8: T).(pr2 c t2 t8)))))))) +(\lambda (H15: (eq T t t2)).(eq_ind T t2 (\lambda (t7: T).((getl i c (CHead d +(Bind Abbr) u)) \to ((pr0 t0 t6) \to ((subst0 i u t6 t7) \to (ex2 T (\lambda +(t8: T).(pr2 c t1 t8)) (\lambda (t8: T).(pr2 c t2 t8))))))) (\lambda (H16: +(getl i c (CHead d (Bind Abbr) u))).(\lambda (H17: (pr0 t0 t6)).(\lambda +(H18: (subst0 i u t6 t2)).(pr2_confluence__pr2_free_delta c d t0 t1 t2 t6 u i +H7 H16 H17 H18)))) t (sym_eq T t t2 H15))) t5 (sym_eq T t5 t0 H14))) c1 +(sym_eq C c1 c H11) H12 H13 H8 H9 H10))))]) in (H8 (refl_equal C c) +(refl_equal T t0) (refl_equal T t2)))) t4 (sym_eq T t4 t1 H6))) t3 (sym_eq T +t3 t0 H5))) c0 (sym_eq C c0 c H2) H3 H4 H1)))) | (pr2_delta c0 d u i H1 t3 t4 +H2 t H3) \Rightarrow (\lambda (H4: (eq C c0 c)).(\lambda (H5: (eq T t3 +t0)).(\lambda (H6: (eq T t t1)).(eq_ind C c (\lambda (c1: C).((eq T t3 t0) +\to ((eq T t t1) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 t3 t4) +\to ((subst0 i u t4 t) \to (ex2 T (\lambda (t5: T).(pr2 c t1 t5)) (\lambda +(t5: T).(pr2 c t2 t5))))))))) (\lambda (H7: (eq T t3 t0)).(eq_ind T t0 +(\lambda (t5: T).((eq T t t1) \to ((getl i c (CHead d (Bind Abbr) u)) \to +((pr0 t5 t4) \to ((subst0 i u t4 t) \to (ex2 T (\lambda (t6: T).(pr2 c t1 +t6)) (\lambda (t6: T).(pr2 c t2 t6)))))))) (\lambda (H8: (eq T t t1)).(eq_ind +T t1 (\lambda (t5: T).((getl i c (CHead d (Bind Abbr) u)) \to ((pr0 t0 t4) +\to ((subst0 i u t4 t5) \to (ex2 T (\lambda (t6: T).(pr2 c t1 t6)) (\lambda +(t6: T).(pr2 c t2 t6))))))) (\lambda (H9: (getl i c (CHead d (Bind Abbr) +u))).(\lambda (H10: (pr0 t0 t4)).(\lambda (H11: (subst0 i u t4 t1)).(let H12 +\def (match H0 in pr2 return (\lambda (c1: C).(\lambda (t5: T).(\lambda (t6: +T).(\lambda (_: (pr2 c1 t5 t6)).((eq C c1 c) \to ((eq T t5 t0) \to ((eq T t6 +t2) \to (ex2 T (\lambda (t7: T).(pr2 c t1 t7)) (\lambda (t7: T).(pr2 c t2 +t7)))))))))) with [(pr2_free c1 t5 t6 H12) \Rightarrow (\lambda (H13: (eq C +c1 c)).(\lambda (H14: (eq T t5 t0)).(\lambda (H15: (eq T t6 t2)).(eq_ind C c +(\lambda (_: C).((eq T t5 t0) \to ((eq T t6 t2) \to ((pr0 t5 t6) \to (ex2 T +(\lambda (t7: T).(pr2 c t1 t7)) (\lambda (t7: T).(pr2 c t2 t7))))))) (\lambda +(H16: (eq T t5 t0)).(eq_ind T t0 (\lambda (t7: T).((eq T t6 t2) \to ((pr0 t7 +t6) \to (ex2 T (\lambda (t8: T).(pr2 c t1 t8)) (\lambda (t8: T).(pr2 c t2 +t8)))))) (\lambda (H17: (eq T t6 t2)).(eq_ind T t2 (\lambda (t7: T).((pr0 t0 +t7) \to (ex2 T (\lambda (t8: T).(pr2 c t1 t8)) (\lambda (t8: T).(pr2 c t2 +t8))))) (\lambda (H18: (pr0 t0 t2)).(ex2_sym T (pr2 c t2) (pr2 c t1) +(pr2_confluence__pr2_free_delta c d t0 t2 t1 t4 u i H18 H9 H10 H11))) t6 +(sym_eq T t6 t2 H17))) t5 (sym_eq T t5 t0 H16))) c1 (sym_eq C c1 c H13) H14 +H15 H12)))) | (pr2_delta c1 d0 u0 i0 H12 t5 t6 H13 t7 H14) \Rightarrow +(\lambda (H15: (eq C c1 c)).(\lambda (H16: (eq T t5 t0)).(\lambda (H17: (eq T +t7 t2)).(eq_ind C c (\lambda (c2: C).((eq T t5 t0) \to ((eq T t7 t2) \to +((getl i0 c2 (CHead d0 (Bind Abbr) u0)) \to ((pr0 t5 t6) \to ((subst0 i0 u0 +t6 t7) \to (ex2 T (\lambda (t8: T).(pr2 c t1 t8)) (\lambda (t8: T).(pr2 c t2 +t8))))))))) (\lambda (H18: (eq T t5 t0)).(eq_ind T t0 (\lambda (t8: T).((eq T +t7 t2) \to ((getl i0 c (CHead d0 (Bind Abbr) u0)) \to ((pr0 t8 t6) \to +((subst0 i0 u0 t6 t7) \to (ex2 T (\lambda (t9: T).(pr2 c t1 t9)) (\lambda +(t9: T).(pr2 c t2 t9)))))))) (\lambda (H19: (eq T t7 t2)).(eq_ind T t2 +(\lambda (t8: T).((getl i0 c (CHead d0 (Bind Abbr) u0)) \to ((pr0 t0 t6) \to +((subst0 i0 u0 t6 t8) \to (ex2 T (\lambda (t9: T).(pr2 c t1 t9)) (\lambda +(t9: T).(pr2 c t2 t9))))))) (\lambda (H20: (getl i0 c (CHead d0 (Bind Abbr) +u0))).(\lambda (H21: (pr0 t0 t6)).(\lambda (H22: (subst0 i0 u0 t6 +t2)).(pr2_confluence__pr2_delta_delta c d d0 t0 t1 t2 t4 t6 u u0 i i0 H9 H10 +H11 H20 H21 H22)))) t7 (sym_eq T t7 t2 H19))) t5 (sym_eq T t5 t0 H18))) c1 +(sym_eq C c1 c H15) H16 H17 H12 H13 H14))))]) in (H12 (refl_equal C c) +(refl_equal T t0) (refl_equal T t2)))))) t (sym_eq T t t1 H8))) t3 (sym_eq T +t3 t0 H7))) c0 (sym_eq C c0 c H4) H5 H6 H1 H2 H3))))]) in (H1 (refl_equal C +c) (refl_equal T t0) (refl_equal T t1)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/props.ma new file mode 100644 index 000000000..2cb35e582 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/props.ma @@ -0,0 +1,339 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr2/props". + +include "pr2/defs.ma". + +include "pr0/props.ma". + +include "getl/drop.ma". + +include "getl/clear.ma". + +theorem pr2_thin_dx: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall +(u: T).(\forall (f: F).(pr2 c (THead (Flat f) u t1) (THead (Flat f) u +t2))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c t1 +t2)).(\lambda (u: T).(\lambda (f: F).(pr2_ind (\lambda (c0: C).(\lambda (t: +T).(\lambda (t0: T).(pr2 c0 (THead (Flat f) u t) (THead (Flat f) u t0))))) +(\lambda (c0: C).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H0: (pr0 t0 +t3)).(pr2_free c0 (THead (Flat f) u t0) (THead (Flat f) u t3) (pr0_comp u u +(pr0_refl u) t0 t3 H0 (Flat f))))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (u0: T).(\lambda (i: nat).(\lambda (H0: (getl i c0 (CHead d (Bind +Abbr) u0))).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H1: (pr0 t0 +t3)).(\lambda (t: T).(\lambda (H2: (subst0 i u0 t3 t)).(pr2_delta c0 d u0 i +H0 (THead (Flat f) u t0) (THead (Flat f) u t3) (pr0_comp u u (pr0_refl u) t0 +t3 H1 (Flat f)) (THead (Flat f) u t) (subst0_snd (Flat f) u0 t t3 i H2 +u)))))))))))) c t1 t2 H)))))). + +theorem pr2_head_1: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr2 c u1 u2) \to (\forall +(k: K).(\forall (t: T).(pr2 c (THead k u1 t) (THead k u2 t))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr2 c u1 +u2)).(\lambda (k: K).(\lambda (t: T).(pr2_ind (\lambda (c0: C).(\lambda (t0: +T).(\lambda (t1: T).(pr2 c0 (THead k t0 t) (THead k t1 t))))) (\lambda (c0: +C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pr0 t1 t2)).(pr2_free c0 +(THead k t1 t) (THead k t2 t) (pr0_comp t1 t2 H0 t t (pr0_refl t) k)))))) +(\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H0: (getl i c0 (CHead d (Bind Abbr) u))).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (H1: (pr0 t1 t2)).(\lambda (t0: T).(\lambda (H2: (subst0 i u t2 +t0)).(pr2_delta c0 d u i H0 (THead k t1 t) (THead k t2 t) (pr0_comp t1 t2 H1 +t t (pr0_refl t) k) (THead k t0 t) (subst0_fst u t0 t2 i H2 t k)))))))))))) c +u1 u2 H)))))). + +theorem pr2_head_2: + \forall (c: C).(\forall (u: T).(\forall (t1: T).(\forall (t2: T).(\forall +(k: K).((pr2 (CHead c k u) t1 t2) \to (pr2 c (THead k u t1) (THead k u +t2))))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(k: K).(K_ind (\lambda (k0: K).((pr2 (CHead c k0 u) t1 t2) \to (pr2 c (THead +k0 u t1) (THead k0 u t2)))) (\lambda (b: B).(\lambda (H: (pr2 (CHead c (Bind +b) u) t1 t2)).(let H0 \def (match H in pr2 return (\lambda (c0: C).(\lambda +(t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 (CHead c (Bind +b) u)) \to ((eq T t t1) \to ((eq T t0 t2) \to (pr2 c (THead (Bind b) u t1) +(THead (Bind b) u t2))))))))) with [(pr2_free c0 t0 t3 H0) \Rightarrow +(\lambda (H1: (eq C c0 (CHead c (Bind b) u))).(\lambda (H2: (eq T t0 +t1)).(\lambda (H3: (eq T t3 t2)).(eq_ind C (CHead c (Bind b) u) (\lambda (_: +C).((eq T t0 t1) \to ((eq T t3 t2) \to ((pr0 t0 t3) \to (pr2 c (THead (Bind +b) u t1) (THead (Bind b) u t2)))))) (\lambda (H4: (eq T t0 t1)).(eq_ind T t1 +(\lambda (t: T).((eq T t3 t2) \to ((pr0 t t3) \to (pr2 c (THead (Bind b) u +t1) (THead (Bind b) u t2))))) (\lambda (H5: (eq T t3 t2)).(eq_ind T t2 +(\lambda (t: T).((pr0 t1 t) \to (pr2 c (THead (Bind b) u t1) (THead (Bind b) +u t2)))) (\lambda (H6: (pr0 t1 t2)).(pr2_free c (THead (Bind b) u t1) (THead +(Bind b) u t2) (pr0_comp u u (pr0_refl u) t1 t2 H6 (Bind b)))) t3 (sym_eq T +t3 t2 H5))) t0 (sym_eq T t0 t1 H4))) c0 (sym_eq C c0 (CHead c (Bind b) u) H1) +H2 H3 H0)))) | (pr2_delta c0 d u0 i H0 t0 t3 H1 t H2) \Rightarrow (\lambda +(H3: (eq C c0 (CHead c (Bind b) u))).(\lambda (H4: (eq T t0 t1)).(\lambda +(H5: (eq T t t2)).(eq_ind C (CHead c (Bind b) u) (\lambda (c1: C).((eq T t0 +t1) \to ((eq T t t2) \to ((getl i c1 (CHead d (Bind Abbr) u0)) \to ((pr0 t0 +t3) \to ((subst0 i u0 t3 t) \to (pr2 c (THead (Bind b) u t1) (THead (Bind b) +u t2)))))))) (\lambda (H6: (eq T t0 t1)).(eq_ind T t1 (\lambda (t4: T).((eq T +t t2) \to ((getl i (CHead c (Bind b) u) (CHead d (Bind Abbr) u0)) \to ((pr0 +t4 t3) \to ((subst0 i u0 t3 t) \to (pr2 c (THead (Bind b) u t1) (THead (Bind +b) u t2))))))) (\lambda (H7: (eq T t t2)).(eq_ind T t2 (\lambda (t4: +T).((getl i (CHead c (Bind b) u) (CHead d (Bind Abbr) u0)) \to ((pr0 t1 t3) +\to ((subst0 i u0 t3 t4) \to (pr2 c (THead (Bind b) u t1) (THead (Bind b) u +t2)))))) (\lambda (H8: (getl i (CHead c (Bind b) u) (CHead d (Bind Abbr) +u0))).(\lambda (H9: (pr0 t1 t3)).(\lambda (H10: (subst0 i u0 t3 t2)).(nat_ind +(\lambda (n: nat).((getl n (CHead c (Bind b) u) (CHead d (Bind Abbr) u0)) \to +((subst0 n u0 t3 t2) \to (pr2 c (THead (Bind b) u t1) (THead (Bind b) u +t2))))) (\lambda (H11: (getl O (CHead c (Bind b) u) (CHead d (Bind Abbr) +u0))).(\lambda (H12: (subst0 O u0 t3 t2)).(let H13 \def (f_equal C C (\lambda +(e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d +| (CHead c1 _ _) \Rightarrow c1])) (CHead d (Bind Abbr) u0) (CHead c (Bind b) +u) (clear_gen_bind b c (CHead d (Bind Abbr) u0) u (getl_gen_O (CHead c (Bind +b) u) (CHead d (Bind Abbr) u0) H11))) in ((let H14 \def (f_equal C B (\lambda +(e: C).(match e in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow +Abbr | (CHead _ k0 _) \Rightarrow (match k0 in K return (\lambda (_: K).B) +with [(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (CHead d +(Bind Abbr) u0) (CHead c (Bind b) u) (clear_gen_bind b c (CHead d (Bind Abbr) +u0) u (getl_gen_O (CHead c (Bind b) u) (CHead d (Bind Abbr) u0) H11))) in +((let H15 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: +C).T) with [(CSort _) \Rightarrow u0 | (CHead _ _ t4) \Rightarrow t4])) +(CHead d (Bind Abbr) u0) (CHead c (Bind b) u) (clear_gen_bind b c (CHead d +(Bind Abbr) u0) u (getl_gen_O (CHead c (Bind b) u) (CHead d (Bind Abbr) u0) +H11))) in (\lambda (H16: (eq B Abbr b)).(\lambda (_: (eq C d c)).(let H18 +\def (eq_ind T u0 (\lambda (t4: T).(subst0 O t4 t3 t2)) H12 u H15) in (eq_ind +B Abbr (\lambda (b0: B).(pr2 c (THead (Bind b0) u t1) (THead (Bind b0) u +t2))) (pr2_free c (THead (Bind Abbr) u t1) (THead (Bind Abbr) u t2) +(pr0_delta u u (pr0_refl u) t1 t3 H9 t2 H18)) b H16))))) H14)) H13)))) +(\lambda (i0: nat).(\lambda (_: (((getl i0 (CHead c (Bind b) u) (CHead d +(Bind Abbr) u0)) \to ((subst0 i0 u0 t3 t2) \to (pr2 c (THead (Bind b) u t1) +(THead (Bind b) u t2)))))).(\lambda (H11: (getl (S i0) (CHead c (Bind b) u) +(CHead d (Bind Abbr) u0))).(\lambda (H12: (subst0 (S i0) u0 t3 +t2)).(pr2_delta c d u0 (r (Bind b) i0) (getl_gen_S (Bind b) c (CHead d (Bind +Abbr) u0) u i0 H11) (THead (Bind b) u t1) (THead (Bind b) u t3) (pr0_comp u u +(pr0_refl u) t1 t3 H9 (Bind b)) (THead (Bind b) u t2) (subst0_snd (Bind b) u0 +t2 t3 (r (Bind b) i0) H12 u)))))) i H8 H10)))) t (sym_eq T t t2 H7))) t0 +(sym_eq T t0 t1 H6))) c0 (sym_eq C c0 (CHead c (Bind b) u) H3) H4 H5 H0 H1 +H2))))]) in (H0 (refl_equal C (CHead c (Bind b) u)) (refl_equal T t1) +(refl_equal T t2))))) (\lambda (f: F).(\lambda (H: (pr2 (CHead c (Flat f) u) +t1 t2)).(let H0 \def (match H in pr2 return (\lambda (c0: C).(\lambda (t: +T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 (CHead c (Flat f) +u)) \to ((eq T t t1) \to ((eq T t0 t2) \to (pr2 c (THead (Flat f) u t1) +(THead (Flat f) u t2))))))))) with [(pr2_free c0 t0 t3 H0) \Rightarrow +(\lambda (H1: (eq C c0 (CHead c (Flat f) u))).(\lambda (H2: (eq T t0 +t1)).(\lambda (H3: (eq T t3 t2)).(eq_ind C (CHead c (Flat f) u) (\lambda (_: +C).((eq T t0 t1) \to ((eq T t3 t2) \to ((pr0 t0 t3) \to (pr2 c (THead (Flat +f) u t1) (THead (Flat f) u t2)))))) (\lambda (H4: (eq T t0 t1)).(eq_ind T t1 +(\lambda (t: T).((eq T t3 t2) \to ((pr0 t t3) \to (pr2 c (THead (Flat f) u +t1) (THead (Flat f) u t2))))) (\lambda (H5: (eq T t3 t2)).(eq_ind T t2 +(\lambda (t: T).((pr0 t1 t) \to (pr2 c (THead (Flat f) u t1) (THead (Flat f) +u t2)))) (\lambda (H6: (pr0 t1 t2)).(pr2_free c (THead (Flat f) u t1) (THead +(Flat f) u t2) (pr0_comp u u (pr0_refl u) t1 t2 H6 (Flat f)))) t3 (sym_eq T +t3 t2 H5))) t0 (sym_eq T t0 t1 H4))) c0 (sym_eq C c0 (CHead c (Flat f) u) H1) +H2 H3 H0)))) | (pr2_delta c0 d u0 i H0 t0 t3 H1 t H2) \Rightarrow (\lambda +(H3: (eq C c0 (CHead c (Flat f) u))).(\lambda (H4: (eq T t0 t1)).(\lambda +(H5: (eq T t t2)).(eq_ind C (CHead c (Flat f) u) (\lambda (c1: C).((eq T t0 +t1) \to ((eq T t t2) \to ((getl i c1 (CHead d (Bind Abbr) u0)) \to ((pr0 t0 +t3) \to ((subst0 i u0 t3 t) \to (pr2 c (THead (Flat f) u t1) (THead (Flat f) +u t2)))))))) (\lambda (H6: (eq T t0 t1)).(eq_ind T t1 (\lambda (t4: T).((eq T +t t2) \to ((getl i (CHead c (Flat f) u) (CHead d (Bind Abbr) u0)) \to ((pr0 +t4 t3) \to ((subst0 i u0 t3 t) \to (pr2 c (THead (Flat f) u t1) (THead (Flat +f) u t2))))))) (\lambda (H7: (eq T t t2)).(eq_ind T t2 (\lambda (t4: +T).((getl i (CHead c (Flat f) u) (CHead d (Bind Abbr) u0)) \to ((pr0 t1 t3) +\to ((subst0 i u0 t3 t4) \to (pr2 c (THead (Flat f) u t1) (THead (Flat f) u +t2)))))) (\lambda (H8: (getl i (CHead c (Flat f) u) (CHead d (Bind Abbr) +u0))).(\lambda (H9: (pr0 t1 t3)).(\lambda (H10: (subst0 i u0 t3 t2)).(nat_ind +(\lambda (n: nat).((getl n (CHead c (Flat f) u) (CHead d (Bind Abbr) u0)) \to +((subst0 n u0 t3 t2) \to (pr2 c (THead (Flat f) u t1) (THead (Flat f) u +t2))))) (\lambda (H11: (getl O (CHead c (Flat f) u) (CHead d (Bind Abbr) +u0))).(\lambda (H12: (subst0 O u0 t3 t2)).(pr2_delta c d u0 O (getl_intro O c +(CHead d (Bind Abbr) u0) c (drop_refl c) (clear_gen_flat f c (CHead d (Bind +Abbr) u0) u (getl_gen_O (CHead c (Flat f) u) (CHead d (Bind Abbr) u0) H11))) +(THead (Flat f) u t1) (THead (Flat f) u t3) (pr0_comp u u (pr0_refl u) t1 t3 +H9 (Flat f)) (THead (Flat f) u t2) (subst0_snd (Flat f) u0 t2 t3 O H12 u)))) +(\lambda (i0: nat).(\lambda (_: (((getl i0 (CHead c (Flat f) u) (CHead d +(Bind Abbr) u0)) \to ((subst0 i0 u0 t3 t2) \to (pr2 c (THead (Flat f) u t1) +(THead (Flat f) u t2)))))).(\lambda (H11: (getl (S i0) (CHead c (Flat f) u) +(CHead d (Bind Abbr) u0))).(\lambda (H12: (subst0 (S i0) u0 t3 +t2)).(pr2_delta c d u0 (r (Flat f) i0) (getl_gen_S (Flat f) c (CHead d (Bind +Abbr) u0) u i0 H11) (THead (Flat f) u t1) (THead (Flat f) u t3) (pr0_comp u u +(pr0_refl u) t1 t3 H9 (Flat f)) (THead (Flat f) u t2) (subst0_snd (Flat f) u0 +t2 t3 (r (Flat f) i0) H12 u)))))) i H8 H10)))) t (sym_eq T t t2 H7))) t0 +(sym_eq T t0 t1 H6))) c0 (sym_eq C c0 (CHead c (Flat f) u) H3) H4 H5 H0 H1 +H2))))]) in (H0 (refl_equal C (CHead c (Flat f) u)) (refl_equal T t1) +(refl_equal T t2))))) k))))). + +theorem clear_pr2_trans: + \forall (c2: C).(\forall (t1: T).(\forall (t2: T).((pr2 c2 t1 t2) \to +(\forall (c1: C).((clear c1 c2) \to (pr2 c1 t1 t2)))))) +\def + \lambda (c2: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c2 t1 +t2)).(\lambda (c1: C).(\lambda (H0: (clear c1 c2)).(let H1 \def (match H in +pr2 return (\lambda (c: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (pr2 +c t t0)).((eq C c c2) \to ((eq T t t1) \to ((eq T t0 t2) \to (pr2 c1 t1 +t2)))))))) with [(pr2_free c t0 t3 H1) \Rightarrow (\lambda (H2: (eq C c +c2)).(\lambda (H3: (eq T t0 t1)).(\lambda (H4: (eq T t3 t2)).(eq_ind C c2 +(\lambda (_: C).((eq T t0 t1) \to ((eq T t3 t2) \to ((pr0 t0 t3) \to (pr2 c1 +t1 t2))))) (\lambda (H5: (eq T t0 t1)).(eq_ind T t1 (\lambda (t: T).((eq T t3 +t2) \to ((pr0 t t3) \to (pr2 c1 t1 t2)))) (\lambda (H6: (eq T t3 t2)).(eq_ind +T t2 (\lambda (t: T).((pr0 t1 t) \to (pr2 c1 t1 t2))) (\lambda (H7: (pr0 t1 +t2)).(pr2_free c1 t1 t2 H7)) t3 (sym_eq T t3 t2 H6))) t0 (sym_eq T t0 t1 +H5))) c (sym_eq C c c2 H2) H3 H4 H1)))) | (pr2_delta c d u i H1 t0 t3 H2 t +H3) \Rightarrow (\lambda (H4: (eq C c c2)).(\lambda (H5: (eq T t0 +t1)).(\lambda (H6: (eq T t t2)).(eq_ind C c2 (\lambda (c0: C).((eq T t0 t1) +\to ((eq T t t2) \to ((getl i c0 (CHead d (Bind Abbr) u)) \to ((pr0 t0 t3) +\to ((subst0 i u t3 t) \to (pr2 c1 t1 t2))))))) (\lambda (H7: (eq T t0 +t1)).(eq_ind T t1 (\lambda (t4: T).((eq T t t2) \to ((getl i c2 (CHead d +(Bind Abbr) u)) \to ((pr0 t4 t3) \to ((subst0 i u t3 t) \to (pr2 c1 t1 +t2)))))) (\lambda (H8: (eq T t t2)).(eq_ind T t2 (\lambda (t4: T).((getl i c2 +(CHead d (Bind Abbr) u)) \to ((pr0 t1 t3) \to ((subst0 i u t3 t4) \to (pr2 c1 +t1 t2))))) (\lambda (H9: (getl i c2 (CHead d (Bind Abbr) u))).(\lambda (H10: +(pr0 t1 t3)).(\lambda (H11: (subst0 i u t3 t2)).(pr2_delta c1 d u i +(clear_getl_trans i c2 (CHead d (Bind Abbr) u) H9 c1 H0) t1 t3 H10 t2 H11)))) +t (sym_eq T t t2 H8))) t0 (sym_eq T t0 t1 H7))) c (sym_eq C c c2 H4) H5 H6 H1 +H2 H3))))]) in (H1 (refl_equal C c2) (refl_equal T t1) (refl_equal T +t2)))))))). + +theorem pr2_cflat: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall +(f: F).(\forall (v: T).(pr2 (CHead c (Flat f) v) t1 t2)))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c t1 +t2)).(pr2_ind (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\forall (f: +F).(\forall (v: T).(pr2 (CHead c0 (Flat f) v) t t0)))))) (\lambda (c0: +C).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H0: (pr0 t3 t4)).(\lambda (f: +F).(\lambda (v: T).(pr2_free (CHead c0 (Flat f) v) t3 t4 H0))))))) (\lambda +(c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl +i c0 (CHead d (Bind Abbr) u))).(\lambda (t3: T).(\lambda (t4: T).(\lambda +(H1: (pr0 t3 t4)).(\lambda (t: T).(\lambda (H2: (subst0 i u t4 t)).(\lambda +(f: F).(\lambda (v: T).(pr2_delta (CHead c0 (Flat f) v) d u i (getl_flat c0 +(CHead d (Bind Abbr) u) i H0 f v) t3 t4 H1 t H2))))))))))))) c t1 t2 H)))). + +theorem pr2_ctail: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall +(k: K).(\forall (u: T).(pr2 (CTail k u c) t1 t2)))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c t1 +t2)).(\lambda (k: K).(\lambda (u: T).(pr2_ind (\lambda (c0: C).(\lambda (t: +T).(\lambda (t0: T).(pr2 (CTail k u c0) t t0)))) (\lambda (c0: C).(\lambda +(t3: T).(\lambda (t4: T).(\lambda (H0: (pr0 t3 t4)).(pr2_free (CTail k u c0) +t3 t4 H0))))) (\lambda (c0: C).(\lambda (d: C).(\lambda (u0: T).(\lambda (i: +nat).(\lambda (H0: (getl i c0 (CHead d (Bind Abbr) u0))).(\lambda (t3: +T).(\lambda (t4: T).(\lambda (H1: (pr0 t3 t4)).(\lambda (t: T).(\lambda (H2: +(subst0 i u0 t4 t)).(pr2_delta (CTail k u c0) (CTail k u d) u0 i (getl_ctail +Abbr c0 d u0 i H0 k u) t3 t4 H1 t H2))))))))))) c t1 t2 H)))))). + +theorem pr2_change: + \forall (b: B).((not (eq B b Abbr)) \to (\forall (c: C).(\forall (v1: +T).(\forall (t1: T).(\forall (t2: T).((pr2 (CHead c (Bind b) v1) t1 t2) \to +(\forall (v2: T).(pr2 (CHead c (Bind b) v2) t1 t2)))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abbr))).(\lambda (c: C).(\lambda +(v1: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pr2 (CHead c (Bind +b) v1) t1 t2)).(\lambda (v2: T).(insert_eq C (CHead c (Bind b) v1) (\lambda +(c0: C).(pr2 c0 t1 t2)) (pr2 (CHead c (Bind b) v2) t1 t2) (\lambda (y: +C).(\lambda (H1: (pr2 y t1 t2)).(pr2_ind (\lambda (c0: C).(\lambda (t: +T).(\lambda (t0: T).((eq C c0 (CHead c (Bind b) v1)) \to (pr2 (CHead c (Bind +b) v2) t t0))))) (\lambda (c0: C).(\lambda (t3: T).(\lambda (t4: T).(\lambda +(H2: (pr0 t3 t4)).(\lambda (_: (eq C c0 (CHead c (Bind b) v1))).(pr2_free +(CHead c (Bind b) v2) t3 t4 H2)))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H2: (getl i c0 (CHead d (Bind +Abbr) u))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H3: (pr0 t3 +t4)).(\lambda (t: T).(\lambda (H4: (subst0 i u t4 t)).(\lambda (H5: (eq C c0 +(CHead c (Bind b) v1))).(let H6 \def (eq_ind C c0 (\lambda (c1: C).(getl i c1 +(CHead d (Bind Abbr) u))) H2 (CHead c (Bind b) v1) H5) in (nat_ind (\lambda +(n: nat).((getl n (CHead c (Bind b) v1) (CHead d (Bind Abbr) u)) \to ((subst0 +n u t4 t) \to (pr2 (CHead c (Bind b) v2) t3 t)))) (\lambda (H7: (getl O +(CHead c (Bind b) v1) (CHead d (Bind Abbr) u))).(\lambda (H8: (subst0 O u t4 +t)).(let H9 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow d | (CHead c1 _ _) \Rightarrow c1])) +(CHead d (Bind Abbr) u) (CHead c (Bind b) v1) (clear_gen_bind b c (CHead d +(Bind Abbr) u) v1 (getl_gen_O (CHead c (Bind b) v1) (CHead d (Bind Abbr) u) +H7))) in ((let H10 \def (f_equal C B (\lambda (e: C).(match e in C return +(\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) +(CHead c (Bind b) v1) (clear_gen_bind b c (CHead d (Bind Abbr) u) v1 +(getl_gen_O (CHead c (Bind b) v1) (CHead d (Bind Abbr) u) H7))) in ((let H11 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead d +(Bind Abbr) u) (CHead c (Bind b) v1) (clear_gen_bind b c (CHead d (Bind Abbr) +u) v1 (getl_gen_O (CHead c (Bind b) v1) (CHead d (Bind Abbr) u) H7))) in +(\lambda (H12: (eq B Abbr b)).(\lambda (_: (eq C d c)).(let H14 \def (eq_ind +T u (\lambda (t0: T).(subst0 O t0 t4 t)) H8 v1 H11) in (let H15 \def +(eq_ind_r B b (\lambda (b0: B).(not (eq B b0 Abbr))) H Abbr H12) in (eq_ind B +Abbr (\lambda (b0: B).(pr2 (CHead c (Bind b0) v2) t3 t)) (let H16 \def (match +(H15 (refl_equal B Abbr)) in False return (\lambda (_: False).(pr2 (CHead c +(Bind Abbr) v2) t3 t)) with []) in H16) b H12)))))) H10)) H9)))) (\lambda +(i0: nat).(\lambda (_: (((getl i0 (CHead c (Bind b) v1) (CHead d (Bind Abbr) +u)) \to ((subst0 i0 u t4 t) \to (pr2 (CHead c (Bind b) v2) t3 t))))).(\lambda +(H7: (getl (S i0) (CHead c (Bind b) v1) (CHead d (Bind Abbr) u))).(\lambda +(H8: (subst0 (S i0) u t4 t)).(pr2_delta (CHead c (Bind b) v2) d u (S i0) +(getl_head (Bind b) i0 c (CHead d (Bind Abbr) u) (getl_gen_S (Bind b) c +(CHead d (Bind Abbr) u) v1 i0 H7) v2) t3 t4 H3 t H8))))) i H6 H4))))))))))))) +y t1 t2 H1))) H0)))))))). + +theorem pr2_lift: + \forall (c: C).(\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop h +d c e) \to (\forall (t1: T).(\forall (t2: T).((pr2 e t1 t2) \to (pr2 c (lift +h d t1) (lift h d t2))))))))) +\def + \lambda (c: C).(\lambda (e: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda +(H: (drop h d c e)).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pr2 e t1 +t2)).(let H1 \def (match H0 in pr2 return (\lambda (c0: C).(\lambda (t: +T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 e) \to ((eq T t t1) +\to ((eq T t0 t2) \to (pr2 c (lift h d t1) (lift h d t2))))))))) with +[(pr2_free c0 t0 t3 H1) \Rightarrow (\lambda (H2: (eq C c0 e)).(\lambda (H3: +(eq T t0 t1)).(\lambda (H4: (eq T t3 t2)).(eq_ind C e (\lambda (_: C).((eq T +t0 t1) \to ((eq T t3 t2) \to ((pr0 t0 t3) \to (pr2 c (lift h d t1) (lift h d +t2)))))) (\lambda (H5: (eq T t0 t1)).(eq_ind T t1 (\lambda (t: T).((eq T t3 +t2) \to ((pr0 t t3) \to (pr2 c (lift h d t1) (lift h d t2))))) (\lambda (H6: +(eq T t3 t2)).(eq_ind T t2 (\lambda (t: T).((pr0 t1 t) \to (pr2 c (lift h d +t1) (lift h d t2)))) (\lambda (H7: (pr0 t1 t2)).(pr2_free c (lift h d t1) +(lift h d t2) (pr0_lift t1 t2 H7 h d))) t3 (sym_eq T t3 t2 H6))) t0 (sym_eq T +t0 t1 H5))) c0 (sym_eq C c0 e H2) H3 H4 H1)))) | (pr2_delta c0 d0 u i H1 t0 +t3 H2 t H3) \Rightarrow (\lambda (H4: (eq C c0 e)).(\lambda (H5: (eq T t0 +t1)).(\lambda (H6: (eq T t t2)).(eq_ind C e (\lambda (c1: C).((eq T t0 t1) +\to ((eq T t t2) \to ((getl i c1 (CHead d0 (Bind Abbr) u)) \to ((pr0 t0 t3) +\to ((subst0 i u t3 t) \to (pr2 c (lift h d t1) (lift h d t2)))))))) (\lambda +(H7: (eq T t0 t1)).(eq_ind T t1 (\lambda (t4: T).((eq T t t2) \to ((getl i e +(CHead d0 (Bind Abbr) u)) \to ((pr0 t4 t3) \to ((subst0 i u t3 t) \to (pr2 c +(lift h d t1) (lift h d t2))))))) (\lambda (H8: (eq T t t2)).(eq_ind T t2 +(\lambda (t4: T).((getl i e (CHead d0 (Bind Abbr) u)) \to ((pr0 t1 t3) \to +((subst0 i u t3 t4) \to (pr2 c (lift h d t1) (lift h d t2)))))) (\lambda (H9: +(getl i e (CHead d0 (Bind Abbr) u))).(\lambda (H10: (pr0 t1 t3)).(\lambda +(H11: (subst0 i u t3 t2)).(lt_le_e i d (pr2 c (lift h d t1) (lift h d t2)) +(\lambda (H12: (lt i d)).(let H13 \def (drop_getl_trans_le i d (le_S_n i d +(le_S (S i) d H12)) c e h H (CHead d0 (Bind Abbr) u) H9) in (ex3_2_ind C C +(\lambda (e0: C).(\lambda (_: C).(drop i O c e0))) (\lambda (e0: C).(\lambda +(e1: C).(drop h (minus d i) e0 e1))) (\lambda (_: C).(\lambda (e1: C).(clear +e1 (CHead d0 (Bind Abbr) u)))) (pr2 c (lift h d t1) (lift h d t2)) (\lambda +(x0: C).(\lambda (x1: C).(\lambda (H14: (drop i O c x0)).(\lambda (H15: (drop +h (minus d i) x0 x1)).(\lambda (H16: (clear x1 (CHead d0 (Bind Abbr) +u))).(let H17 \def (eq_ind nat (minus d i) (\lambda (n: nat).(drop h n x0 +x1)) H15 (S (minus d (S i))) (minus_x_Sy d i H12)) in (let H18 \def +(drop_clear_S x1 x0 h (minus d (S i)) H17 Abbr d0 u H16) in (ex2_ind C +(\lambda (c1: C).(clear x0 (CHead c1 (Bind Abbr) (lift h (minus d (S i)) +u)))) (\lambda (c1: C).(drop h (minus d (S i)) c1 d0)) (pr2 c (lift h d t1) +(lift h d t2)) (\lambda (x: C).(\lambda (H19: (clear x0 (CHead x (Bind Abbr) +(lift h (minus d (S i)) u)))).(\lambda (_: (drop h (minus d (S i)) x +d0)).(pr2_delta c x (lift h (minus d (S i)) u) i (getl_intro i c (CHead x +(Bind Abbr) (lift h (minus d (S i)) u)) x0 H14 H19) (lift h d t1) (lift h d +t3) (pr0_lift t1 t3 H10 h d) (lift h d t2) (subst0_lift_lt t3 t2 u i H11 d +H12 h))))) H18)))))))) H13))) (\lambda (H12: (le d i)).(pr2_delta c d0 u +(plus i h) (drop_getl_trans_ge i c e d h H (CHead d0 (Bind Abbr) u) H9 H12) +(lift h d t1) (lift h d t3) (pr0_lift t1 t3 H10 h d) (lift h d t2) +(subst0_lift_ge t3 t2 u i h H11 d H12))))))) t (sym_eq T t t2 H8))) t0 +(sym_eq T t0 t1 H7))) c0 (sym_eq C c0 e H4) H5 H6 H1 H2 H3))))]) in (H1 +(refl_equal C e) (refl_equal T t1) (refl_equal T t2)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/subst1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/subst1.ma new file mode 100644 index 000000000..27a0221d5 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/subst1.ma @@ -0,0 +1,290 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr2/subst1". + +include "pr2/defs.ma". + +include "pr0/subst1.ma". + +include "pr0/fwd.ma". + +include "csubst1/getl.ma". + +include "csubst1/fwd.ma". + +include "subst1/subst1.ma". + +include "getl/drop.ma". + +theorem pr2_delta1: + \forall (c: C).(\forall (d: C).(\forall (u: T).(\forall (i: nat).((getl i c +(CHead d (Bind Abbr) u)) \to (\forall (t1: T).(\forall (t2: T).((pr0 t1 t2) +\to (\forall (t: T).((subst1 i u t2 t) \to (pr2 c t1 t)))))))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead d (Bind Abbr) u))).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (H0: (pr0 t1 t2)).(\lambda (t: T).(\lambda (H1: (subst1 i u t2 +t)).(subst1_ind i u t2 (\lambda (t0: T).(pr2 c t1 t0)) (pr2_free c t1 t2 H0) +(\lambda (t0: T).(\lambda (H2: (subst0 i u t2 t0)).(pr2_delta c d u i H t1 t2 +H0 t0 H2))) t H1)))))))))). + +theorem pr2_subst1: + \forall (c: C).(\forall (e: C).(\forall (v: T).(\forall (i: nat).((getl i c +(CHead e (Bind Abbr) v)) \to (\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) +\to (\forall (w1: T).((subst1 i v t1 w1) \to (ex2 T (\lambda (w2: T).(pr2 c +w1 w2)) (\lambda (w2: T).(subst1 i v t2 w2)))))))))))) +\def + \lambda (c: C).(\lambda (e: C).(\lambda (v: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead e (Bind Abbr) v))).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (H0: (pr2 c t1 t2)).(let H1 \def (match H0 in pr2 return (\lambda +(c0: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C +c0 c) \to ((eq T t t1) \to ((eq T t0 t2) \to (\forall (w1: T).((subst1 i v t1 +w1) \to (ex2 T (\lambda (w2: T).(pr2 c w1 w2)) (\lambda (w2: T).(subst1 i v +t2 w2)))))))))))) with [(pr2_free c0 t0 t3 H1) \Rightarrow (\lambda (H2: (eq +C c0 c)).(\lambda (H3: (eq T t0 t1)).(\lambda (H4: (eq T t3 t2)).(eq_ind C c +(\lambda (_: C).((eq T t0 t1) \to ((eq T t3 t2) \to ((pr0 t0 t3) \to (\forall +(w1: T).((subst1 i v t1 w1) \to (ex2 T (\lambda (w2: T).(pr2 c w1 w2)) +(\lambda (w2: T).(subst1 i v t2 w2))))))))) (\lambda (H5: (eq T t0 +t1)).(eq_ind T t1 (\lambda (t: T).((eq T t3 t2) \to ((pr0 t t3) \to (\forall +(w1: T).((subst1 i v t1 w1) \to (ex2 T (\lambda (w2: T).(pr2 c w1 w2)) +(\lambda (w2: T).(subst1 i v t2 w2)))))))) (\lambda (H6: (eq T t3 +t2)).(eq_ind T t2 (\lambda (t: T).((pr0 t1 t) \to (\forall (w1: T).((subst1 i +v t1 w1) \to (ex2 T (\lambda (w2: T).(pr2 c w1 w2)) (\lambda (w2: T).(subst1 +i v t2 w2))))))) (\lambda (H7: (pr0 t1 t2)).(\lambda (w1: T).(\lambda (H8: +(subst1 i v t1 w1)).(ex2_ind T (\lambda (w2: T).(pr0 w1 w2)) (\lambda (w2: +T).(subst1 i v t2 w2)) (ex2 T (\lambda (w2: T).(pr2 c w1 w2)) (\lambda (w2: +T).(subst1 i v t2 w2))) (\lambda (x: T).(\lambda (H9: (pr0 w1 x)).(\lambda +(H10: (subst1 i v t2 x)).(ex_intro2 T (\lambda (w2: T).(pr2 c w1 w2)) +(\lambda (w2: T).(subst1 i v t2 w2)) x (pr2_free c w1 x H9) H10)))) +(pr0_subst1 t1 t2 H7 v w1 i H8 v (pr0_refl v)))))) t3 (sym_eq T t3 t2 H6))) +t0 (sym_eq T t0 t1 H5))) c0 (sym_eq C c0 c H2) H3 H4 H1)))) | (pr2_delta c0 d +u i0 H1 t0 t3 H2 t H3) \Rightarrow (\lambda (H4: (eq C c0 c)).(\lambda (H5: +(eq T t0 t1)).(\lambda (H6: (eq T t t2)).(eq_ind C c (\lambda (c1: C).((eq T +t0 t1) \to ((eq T t t2) \to ((getl i0 c1 (CHead d (Bind Abbr) u)) \to ((pr0 +t0 t3) \to ((subst0 i0 u t3 t) \to (\forall (w1: T).((subst1 i v t1 w1) \to +(ex2 T (\lambda (w2: T).(pr2 c w1 w2)) (\lambda (w2: T).(subst1 i v t2 +w2))))))))))) (\lambda (H7: (eq T t0 t1)).(eq_ind T t1 (\lambda (t4: T).((eq +T t t2) \to ((getl i0 c (CHead d (Bind Abbr) u)) \to ((pr0 t4 t3) \to +((subst0 i0 u t3 t) \to (\forall (w1: T).((subst1 i v t1 w1) \to (ex2 T +(\lambda (w2: T).(pr2 c w1 w2)) (\lambda (w2: T).(subst1 i v t2 w2)))))))))) +(\lambda (H8: (eq T t t2)).(eq_ind T t2 (\lambda (t4: T).((getl i0 c (CHead d +(Bind Abbr) u)) \to ((pr0 t1 t3) \to ((subst0 i0 u t3 t4) \to (\forall (w1: +T).((subst1 i v t1 w1) \to (ex2 T (\lambda (w2: T).(pr2 c w1 w2)) (\lambda +(w2: T).(subst1 i v t2 w2))))))))) (\lambda (H9: (getl i0 c (CHead d (Bind +Abbr) u))).(\lambda (H10: (pr0 t1 t3)).(\lambda (H11: (subst0 i0 u t3 +t2)).(\lambda (w1: T).(\lambda (H12: (subst1 i v t1 w1)).(ex2_ind T (\lambda +(w2: T).(pr0 w1 w2)) (\lambda (w2: T).(subst1 i v t3 w2)) (ex2 T (\lambda +(w2: T).(pr2 c w1 w2)) (\lambda (w2: T).(subst1 i v t2 w2))) (\lambda (x: +T).(\lambda (H13: (pr0 w1 x)).(\lambda (H14: (subst1 i v t3 x)).(neq_eq_e i +i0 (ex2 T (\lambda (w2: T).(pr2 c w1 w2)) (\lambda (w2: T).(subst1 i v t2 +w2))) (\lambda (H15: (not (eq nat i i0))).(ex2_ind T (\lambda (t4: T).(subst1 +i v t2 t4)) (\lambda (t4: T).(subst1 i0 u x t4)) (ex2 T (\lambda (w2: T).(pr2 +c w1 w2)) (\lambda (w2: T).(subst1 i v t2 w2))) (\lambda (x0: T).(\lambda +(H16: (subst1 i v t2 x0)).(\lambda (H17: (subst1 i0 u x x0)).(ex_intro2 T +(\lambda (w2: T).(pr2 c w1 w2)) (\lambda (w2: T).(subst1 i v t2 w2)) x0 +(pr2_delta1 c d u i0 H9 w1 x H13 x0 H17) H16)))) (subst1_confluence_neq t3 t2 +u i0 (subst1_single i0 u t3 t2 H11) x v i H14 (sym_not_eq nat i i0 H15)))) +(\lambda (H15: (eq nat i i0)).(let H16 \def (eq_ind_r nat i0 (\lambda (n: +nat).(subst0 n u t3 t2)) H11 i H15) in (let H17 \def (eq_ind_r nat i0 +(\lambda (n: nat).(getl n c (CHead d (Bind Abbr) u))) H9 i H15) in (let H18 +\def (eq_ind C (CHead e (Bind Abbr) v) (\lambda (c1: C).(getl i c c1)) H +(CHead d (Bind Abbr) u) (getl_mono c (CHead e (Bind Abbr) v) i H (CHead d +(Bind Abbr) u) H17)) in (let H19 \def (f_equal C C (\lambda (e0: C).(match e0 +in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow e | (CHead c1 _ _) +\Rightarrow c1])) (CHead e (Bind Abbr) v) (CHead d (Bind Abbr) u) (getl_mono +c (CHead e (Bind Abbr) v) i H (CHead d (Bind Abbr) u) H17)) in ((let H20 \def +(f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow v | (CHead _ _ t4) \Rightarrow t4])) (CHead e (Bind +Abbr) v) (CHead d (Bind Abbr) u) (getl_mono c (CHead e (Bind Abbr) v) i H +(CHead d (Bind Abbr) u) H17)) in (\lambda (H21: (eq C e d)).(let H22 \def +(eq_ind_r T u (\lambda (t4: T).(getl i c (CHead d (Bind Abbr) t4))) H18 v +H20) in (let H23 \def (eq_ind_r T u (\lambda (t4: T).(subst0 i t4 t3 t2)) H16 +v H20) in (let H24 \def (eq_ind_r C d (\lambda (c1: C).(getl i c (CHead c1 +(Bind Abbr) v))) H22 e H21) in (ex2_ind T (\lambda (t4: T).(subst1 i v t2 +t4)) (\lambda (t4: T).(subst1 i v x t4)) (ex2 T (\lambda (w2: T).(pr2 c w1 +w2)) (\lambda (w2: T).(subst1 i v t2 w2))) (\lambda (x0: T).(\lambda (H25: +(subst1 i v t2 x0)).(\lambda (H26: (subst1 i v x x0)).(ex_intro2 T (\lambda +(w2: T).(pr2 c w1 w2)) (\lambda (w2: T).(subst1 i v t2 w2)) x0 (pr2_delta1 c +e v i H24 w1 x H13 x0 H26) H25)))) (subst1_confluence_eq t3 t2 v i +(subst1_single i v t3 t2 H23) x H14))))))) H19)))))))))) (pr0_subst1 t1 t3 +H10 v w1 i H12 v (pr0_refl v)))))))) t (sym_eq T t t2 H8))) t0 (sym_eq T t0 +t1 H7))) c0 (sym_eq C c0 c H4) H5 H6 H1 H2 H3))))]) in (H1 (refl_equal C c) +(refl_equal T t1) (refl_equal T t2)))))))))). + +theorem pr2_gen_cabbr: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall +(e: C).(\forall (u: T).(\forall (d: nat).((getl d c (CHead e (Bind Abbr) u)) +\to (\forall (a0: C).((csubst1 d u c a0) \to (\forall (a: C).((drop (S O) d +a0 a) \to (\forall (x1: T).((subst1 d u t1 (lift (S O) d x1)) \to (ex2 T +(\lambda (x2: T).(subst1 d u t2 (lift (S O) d x2))) (\lambda (x2: T).(pr2 a +x1 x2)))))))))))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c t1 +t2)).(pr2_ind (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\forall (e: +C).(\forall (u: T).(\forall (d: nat).((getl d c0 (CHead e (Bind Abbr) u)) \to +(\forall (a0: C).((csubst1 d u c0 a0) \to (\forall (a: C).((drop (S O) d a0 +a) \to (\forall (x1: T).((subst1 d u t (lift (S O) d x1)) \to (ex2 T (\lambda +(x2: T).(subst1 d u t0 (lift (S O) d x2))) (\lambda (x2: T).(pr2 a x1 +x2)))))))))))))))) (\lambda (c0: C).(\lambda (t3: T).(\lambda (t4: +T).(\lambda (H0: (pr0 t3 t4)).(\lambda (e: C).(\lambda (u: T).(\lambda (d: +nat).(\lambda (_: (getl d c0 (CHead e (Bind Abbr) u))).(\lambda (a0: +C).(\lambda (_: (csubst1 d u c0 a0)).(\lambda (a: C).(\lambda (_: (drop (S O) +d a0 a)).(\lambda (x1: T).(\lambda (H4: (subst1 d u t3 (lift (S O) d +x1))).(ex2_ind T (\lambda (w2: T).(pr0 (lift (S O) d x1) w2)) (\lambda (w2: +T).(subst1 d u t4 w2)) (ex2 T (\lambda (x2: T).(subst1 d u t4 (lift (S O) d +x2))) (\lambda (x2: T).(pr2 a x1 x2))) (\lambda (x: T).(\lambda (H5: (pr0 +(lift (S O) d x1) x)).(\lambda (H6: (subst1 d u t4 x)).(ex2_ind T (\lambda +(t5: T).(eq T x (lift (S O) d t5))) (\lambda (t5: T).(pr0 x1 t5)) (ex2 T +(\lambda (x2: T).(subst1 d u t4 (lift (S O) d x2))) (\lambda (x2: T).(pr2 a +x1 x2))) (\lambda (x0: T).(\lambda (H7: (eq T x (lift (S O) d x0))).(\lambda +(H8: (pr0 x1 x0)).(let H9 \def (eq_ind T x (\lambda (t: T).(subst1 d u t4 t)) +H6 (lift (S O) d x0) H7) in (ex_intro2 T (\lambda (x2: T).(subst1 d u t4 +(lift (S O) d x2))) (\lambda (x2: T).(pr2 a x1 x2)) x0 H9 (pr2_free a x1 x0 +H8)))))) (pr0_gen_lift x1 x (S O) d H5))))) (pr0_subst1 t3 t4 H0 u (lift (S +O) d x1) d H4 u (pr0_refl u))))))))))))))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i c0 (CHead d (Bind +Abbr) u))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H1: (pr0 t3 +t4)).(\lambda (t: T).(\lambda (H2: (subst0 i u t4 t)).(\lambda (e: +C).(\lambda (u0: T).(\lambda (d0: nat).(\lambda (H3: (getl d0 c0 (CHead e +(Bind Abbr) u0))).(\lambda (a0: C).(\lambda (H4: (csubst1 d0 u0 c0 +a0)).(\lambda (a: C).(\lambda (H5: (drop (S O) d0 a0 a)).(\lambda (x1: +T).(\lambda (H6: (subst1 d0 u0 t3 (lift (S O) d0 x1))).(ex2_ind T (\lambda +(w2: T).(pr0 (lift (S O) d0 x1) w2)) (\lambda (w2: T).(subst1 d0 u0 t4 w2)) +(ex2 T (\lambda (x2: T).(subst1 d0 u0 t (lift (S O) d0 x2))) (\lambda (x2: +T).(pr2 a x1 x2))) (\lambda (x: T).(\lambda (H7: (pr0 (lift (S O) d0 x1) +x)).(\lambda (H8: (subst1 d0 u0 t4 x)).(ex2_ind T (\lambda (t5: T).(eq T x +(lift (S O) d0 t5))) (\lambda (t5: T).(pr0 x1 t5)) (ex2 T (\lambda (x2: +T).(subst1 d0 u0 t (lift (S O) d0 x2))) (\lambda (x2: T).(pr2 a x1 x2))) +(\lambda (x0: T).(\lambda (H9: (eq T x (lift (S O) d0 x0))).(\lambda (H10: +(pr0 x1 x0)).(let H11 \def (eq_ind T x (\lambda (t0: T).(subst1 d0 u0 t4 t0)) +H8 (lift (S O) d0 x0) H9) in (lt_eq_gt_e i d0 (ex2 T (\lambda (x2: T).(subst1 +d0 u0 t (lift (S O) d0 x2))) (\lambda (x2: T).(pr2 a x1 x2))) (\lambda (H12: +(lt i d0)).(ex2_ind T (\lambda (t0: T).(subst1 d0 u0 t t0)) (\lambda (t0: +T).(subst1 i u (lift (S O) d0 x0) t0)) (ex2 T (\lambda (x2: T).(subst1 d0 u0 +t (lift (S O) d0 x2))) (\lambda (x2: T).(pr2 a x1 x2))) (\lambda (x2: +T).(\lambda (H13: (subst1 d0 u0 t x2)).(\lambda (H14: (subst1 i u (lift (S O) +d0 x0) x2)).(ex2_ind C (\lambda (e2: C).(csubst1 (minus d0 i) u0 (CHead d +(Bind Abbr) u) e2)) (\lambda (e2: C).(getl i a0 e2)) (ex2 T (\lambda (x3: +T).(subst1 d0 u0 t (lift (S O) d0 x3))) (\lambda (x3: T).(pr2 a x1 x3))) +(\lambda (x3: C).(\lambda (H15: (csubst1 (minus d0 i) u0 (CHead d (Bind Abbr) +u) x3)).(\lambda (H16: (getl i a0 x3)).(let H17 \def (eq_ind nat (minus d0 i) +(\lambda (n: nat).(csubst1 n u0 (CHead d (Bind Abbr) u) x3)) H15 (S (minus d0 +(S i))) (minus_x_Sy d0 i H12)) in (let H18 \def (csubst1_gen_head (Bind Abbr) +d x3 u u0 (minus d0 (S i)) H17) in (ex3_2_ind T C (\lambda (u2: T).(\lambda +(c2: C).(eq C x3 (CHead c2 (Bind Abbr) u2)))) (\lambda (u2: T).(\lambda (_: +C).(subst1 (minus d0 (S i)) u0 u u2))) (\lambda (_: T).(\lambda (c2: +C).(csubst1 (minus d0 (S i)) u0 d c2))) (ex2 T (\lambda (x4: T).(subst1 d0 u0 +t (lift (S O) d0 x4))) (\lambda (x4: T).(pr2 a x1 x4))) (\lambda (x4: +T).(\lambda (x5: C).(\lambda (H19: (eq C x3 (CHead x5 (Bind Abbr) +x4))).(\lambda (H20: (subst1 (minus d0 (S i)) u0 u x4)).(\lambda (_: (csubst1 +(minus d0 (S i)) u0 d x5)).(let H22 \def (eq_ind C x3 (\lambda (c1: C).(getl +i a0 c1)) H16 (CHead x5 (Bind Abbr) x4) H19) in (let H23 \def (eq_ind nat d0 +(\lambda (n: nat).(drop (S O) n a0 a)) H5 (S (plus i (minus d0 (S i)))) +(lt_plus_minus i d0 H12)) in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: +C).(eq T x4 (lift (S O) (minus d0 (S i)) v)))) (\lambda (v: T).(\lambda (e0: +C).(getl i a (CHead e0 (Bind Abbr) v)))) (\lambda (_: T).(\lambda (e0: +C).(drop (S O) (minus d0 (S i)) x5 e0))) (ex2 T (\lambda (x6: T).(subst1 d0 +u0 t (lift (S O) d0 x6))) (\lambda (x6: T).(pr2 a x1 x6))) (\lambda (x6: +T).(\lambda (x7: C).(\lambda (H24: (eq T x4 (lift (S O) (minus d0 (S i)) +x6))).(\lambda (H25: (getl i a (CHead x7 (Bind Abbr) x6))).(\lambda (_: (drop +(S O) (minus d0 (S i)) x5 x7)).(let H27 \def (eq_ind T x4 (\lambda (t0: +T).(subst1 (minus d0 (S i)) u0 u t0)) H20 (lift (S O) (minus d0 (S i)) x6) +H24) in (ex2_ind T (\lambda (t0: T).(subst1 i (lift (S O) (minus d0 (S i)) +x6) (lift (S O) d0 x0) t0)) (\lambda (t0: T).(subst1 (S (plus (minus d0 (S +i)) i)) u0 x2 t0)) (ex2 T (\lambda (x8: T).(subst1 d0 u0 t (lift (S O) d0 +x8))) (\lambda (x8: T).(pr2 a x1 x8))) (\lambda (x8: T).(\lambda (H28: +(subst1 i (lift (S O) (minus d0 (S i)) x6) (lift (S O) d0 x0) x8)).(\lambda +(H29: (subst1 (S (plus (minus d0 (S i)) i)) u0 x2 x8)).(let H30 \def (eq_ind +nat d0 (\lambda (n: nat).(subst1 i (lift (S O) (minus d0 (S i)) x6) (lift (S +O) n x0) x8)) H28 (S (plus i (minus d0 (S i)))) (lt_plus_minus i d0 H12)) in +(ex2_ind T (\lambda (t5: T).(eq T x8 (lift (S O) (S (plus i (minus d0 (S +i)))) t5))) (\lambda (t5: T).(subst1 i x6 x0 t5)) (ex2 T (\lambda (x9: +T).(subst1 d0 u0 t (lift (S O) d0 x9))) (\lambda (x9: T).(pr2 a x1 x9))) +(\lambda (x9: T).(\lambda (H31: (eq T x8 (lift (S O) (S (plus i (minus d0 (S +i)))) x9))).(\lambda (H32: (subst1 i x6 x0 x9)).(let H33 \def (eq_ind T x8 +(\lambda (t0: T).(subst1 (S (plus (minus d0 (S i)) i)) u0 x2 t0)) H29 (lift +(S O) (S (plus i (minus d0 (S i)))) x9) H31) in (let H34 \def (eq_ind_r nat +(S (plus i (minus d0 (S i)))) (\lambda (n: nat).(subst1 (S (plus (minus d0 (S +i)) i)) u0 x2 (lift (S O) n x9))) H33 d0 (lt_plus_minus i d0 H12)) in (let +H35 \def (eq_ind_r nat (S (plus (minus d0 (S i)) i)) (\lambda (n: +nat).(subst1 n u0 x2 (lift (S O) d0 x9))) H34 d0 (lt_plus_minus_r i d0 H12)) +in (ex_intro2 T (\lambda (x10: T).(subst1 d0 u0 t (lift (S O) d0 x10))) +(\lambda (x10: T).(pr2 a x1 x10)) x9 (subst1_trans x2 t u0 d0 H13 (lift (S O) +d0 x9) H35) (pr2_delta1 a x7 x6 i H25 x1 x0 H10 x9 H32)))))))) +(subst1_gen_lift_lt x6 x0 x8 i (S O) (minus d0 (S i)) H30)))))) +(subst1_subst1_back (lift (S O) d0 x0) x2 u i H14 (lift (S O) (minus d0 (S +i)) x6) u0 (minus d0 (S i)) H27)))))))) (getl_drop_conf_lt Abbr a0 x5 x4 i +H22 a (S O) (minus d0 (S i)) H23))))))))) H18)))))) (csubst1_getl_lt d0 i H12 +c0 a0 u0 H4 (CHead d (Bind Abbr) u) H0))))) (subst1_confluence_neq t4 t u i +(subst1_single i u t4 t H2) (lift (S O) d0 x0) u0 d0 H11 (lt_neq i d0 H12)))) +(\lambda (H12: (eq nat i d0)).(let H13 \def (eq_ind_r nat d0 (\lambda (n: +nat).(subst1 n u0 t4 (lift (S O) n x0))) H11 i H12) in (let H14 \def +(eq_ind_r nat d0 (\lambda (n: nat).(drop (S O) n a0 a)) H5 i H12) in (let H15 +\def (eq_ind_r nat d0 (\lambda (n: nat).(csubst1 n u0 c0 a0)) H4 i H12) in +(let H16 \def (eq_ind_r nat d0 (\lambda (n: nat).(getl n c0 (CHead e (Bind +Abbr) u0))) H3 i H12) in (eq_ind nat i (\lambda (n: nat).(ex2 T (\lambda (x2: +T).(subst1 n u0 t (lift (S O) n x2))) (\lambda (x2: T).(pr2 a x1 x2)))) (let +H17 \def (eq_ind C (CHead d (Bind Abbr) u) (\lambda (c1: C).(getl i c0 c1)) +H0 (CHead e (Bind Abbr) u0) (getl_mono c0 (CHead d (Bind Abbr) u) i H0 (CHead +e (Bind Abbr) u0) H16)) in (let H18 \def (f_equal C C (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c1 _ +_) \Rightarrow c1])) (CHead d (Bind Abbr) u) (CHead e (Bind Abbr) u0) +(getl_mono c0 (CHead d (Bind Abbr) u) i H0 (CHead e (Bind Abbr) u0) H16)) in +((let H19 \def (f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) +(CHead d (Bind Abbr) u) (CHead e (Bind Abbr) u0) (getl_mono c0 (CHead d (Bind +Abbr) u) i H0 (CHead e (Bind Abbr) u0) H16)) in (\lambda (H20: (eq C d +e)).(let H21 \def (eq_ind_r T u0 (\lambda (t0: T).(getl i c0 (CHead e (Bind +Abbr) t0))) H17 u H19) in (let H22 \def (eq_ind_r T u0 (\lambda (t0: +T).(subst1 i t0 t4 (lift (S O) i x0))) H13 u H19) in (let H23 \def (eq_ind_r +T u0 (\lambda (t0: T).(csubst1 i t0 c0 a0)) H15 u H19) in (eq_ind T u +(\lambda (t0: T).(ex2 T (\lambda (x2: T).(subst1 i t0 t (lift (S O) i x2))) +(\lambda (x2: T).(pr2 a x1 x2)))) (let H24 \def (eq_ind_r C e (\lambda (c1: +C).(getl i c0 (CHead c1 (Bind Abbr) u))) H21 d H20) in (ex2_ind T (\lambda +(t0: T).(subst1 i u t t0)) (\lambda (t0: T).(subst1 i u (lift (S O) i x0) +t0)) (ex2 T (\lambda (x2: T).(subst1 i u t (lift (S O) i x2))) (\lambda (x2: +T).(pr2 a x1 x2))) (\lambda (x2: T).(\lambda (H25: (subst1 i u t +x2)).(\lambda (H26: (subst1 i u (lift (S O) i x0) x2)).(let H27 \def (eq_ind +T x2 (\lambda (t0: T).(subst1 i u t t0)) H25 (lift (S O) i x0) +(subst1_gen_lift_eq x0 u x2 (S O) i i (le_n i) (eq_ind_r nat (plus (S O) i) +(\lambda (n: nat).(lt i n)) (le_n (plus (S O) i)) (plus i (S O)) (plus_comm i +(S O))) H26)) in (ex_intro2 T (\lambda (x3: T).(subst1 i u t (lift (S O) i +x3))) (\lambda (x3: T).(pr2 a x1 x3)) x0 H27 (pr2_free a x1 x0 H10)))))) +(subst1_confluence_eq t4 t u i (subst1_single i u t4 t H2) (lift (S O) i x0) +H22))) u0 H19)))))) H18))) d0 H12)))))) (\lambda (H12: (lt d0 i)).(ex2_ind T +(\lambda (t0: T).(subst1 d0 u0 t t0)) (\lambda (t0: T).(subst1 i u (lift (S +O) d0 x0) t0)) (ex2 T (\lambda (x2: T).(subst1 d0 u0 t (lift (S O) d0 x2))) +(\lambda (x2: T).(pr2 a x1 x2))) (\lambda (x2: T).(\lambda (H13: (subst1 d0 +u0 t x2)).(\lambda (H14: (subst1 i u (lift (S O) d0 x0) x2)).(ex2_ind T +(\lambda (t5: T).(eq T x2 (lift (S O) d0 t5))) (\lambda (t5: T).(subst1 +(minus i (S O)) u x0 t5)) (ex2 T (\lambda (x3: T).(subst1 d0 u0 t (lift (S O) +d0 x3))) (\lambda (x3: T).(pr2 a x1 x3))) (\lambda (x3: T).(\lambda (H15: (eq +T x2 (lift (S O) d0 x3))).(\lambda (H16: (subst1 (minus i (S O)) u x0 +x3)).(let H17 \def (eq_ind T x2 (\lambda (t0: T).(subst1 d0 u0 t t0)) H13 +(lift (S O) d0 x3) H15) in (ex_intro2 T (\lambda (x4: T).(subst1 d0 u0 t +(lift (S O) d0 x4))) (\lambda (x4: T).(pr2 a x1 x4)) x3 H17 (pr2_delta1 a d u +(minus i (S O)) (getl_drop_conf_ge i (CHead d (Bind Abbr) u) a0 +(csubst1_getl_ge d0 i (le_S_n d0 i (le_S (S d0) i H12)) c0 a0 u0 H4 (CHead d +(Bind Abbr) u) H0) a (S O) d0 H5 (eq_ind_r nat (plus (S O) d0) (\lambda (n: +nat).(le n i)) H12 (plus d0 (S O)) (plus_comm d0 (S O)))) x1 x0 H10 x3 +H16)))))) (subst1_gen_lift_ge u x0 x2 i (S O) d0 H14 (eq_ind_r nat (plus (S +O) d0) (\lambda (n: nat).(le n i)) H12 (plus d0 (S O)) (plus_comm d0 (S +O)))))))) (subst1_confluence_neq t4 t u i (subst1_single i u t4 t H2) (lift +(S O) d0 x0) u0 d0 H11 (sym_not_eq nat d0 i (lt_neq d0 i H12)))))))))) +(pr0_gen_lift x1 x (S O) d0 H7))))) (pr0_subst1 t3 t4 H1 u0 (lift (S O) d0 +x1) d0 H6 u0 (pr0_refl u0))))))))))))))))))))))) c t1 t2 H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/defs.ma new file mode 100644 index 000000000..3baff8a16 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/defs.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr3/defs". + +include "pr2/defs.ma". + +inductive pr3 (c: C): T \to (T \to Prop) \def +| pr3_refl: \forall (t: T).(pr3 c t t) +| pr3_sing: \forall (t2: T).(\forall (t1: T).((pr2 c t1 t2) \to (\forall (t3: +T).((pr3 c t2 t3) \to (pr3 c t1 t3))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/fwd.ma new file mode 100644 index 000000000..5e6137217 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/fwd.ma @@ -0,0 +1,1559 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr3/fwd". + +include "pr3/props.ma". + +include "pr2/fwd.ma". + +theorem pr3_gen_sort: + \forall (c: C).(\forall (x: T).(\forall (n: nat).((pr3 c (TSort n) x) \to +(eq T x (TSort n))))) +\def + \lambda (c: C).(\lambda (x: T).(\lambda (n: nat).(\lambda (H: (pr3 c (TSort +n) x)).(insert_eq T (TSort n) (\lambda (t: T).(pr3 c t x)) (eq T x (TSort n)) +(\lambda (y: T).(\lambda (H0: (pr3 c y x)).(pr3_ind c (\lambda (t: +T).(\lambda (t0: T).((eq T t (TSort n)) \to (eq T t0 (TSort n))))) (\lambda +(t: T).(\lambda (H1: (eq T t (TSort n))).H1)) (\lambda (t2: T).(\lambda (t1: +T).(\lambda (H1: (pr2 c t1 t2)).(\lambda (t3: T).(\lambda (_: (pr3 c t2 +t3)).(\lambda (H3: (((eq T t2 (TSort n)) \to (eq T t3 (TSort n))))).(\lambda +(H4: (eq T t1 (TSort n))).(let H5 \def (eq_ind T t1 (\lambda (t: T).(pr2 c t +t2)) H1 (TSort n) H4) in (H3 (pr2_gen_sort c t2 n H5)))))))))) y x H0))) +H)))). + +theorem pr3_gen_abst: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr3 c +(THead (Bind Abst) u1 t1) x) \to (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 +c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: +T).(pr3 (CHead c (Bind b) u) t1 t2)))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr3 c (THead (Bind Abst) u1 t1) x)).(insert_eq T (THead (Bind Abst) u1 +t1) (\lambda (t: T).(pr3 c t x)) (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 +c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: +T).(pr3 (CHead c (Bind b) u) t1 t2)))))) (\lambda (y: T).(\lambda (H0: (pr3 c +y x)).(unintro T t1 (\lambda (t: T).((eq T y (THead (Bind Abst) u1 t)) \to +(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind Abst) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +t t2)))))))) (unintro T u1 (\lambda (t: T).(\forall (x0: T).((eq T y (THead +(Bind Abst) t x0)) \to (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x +(THead (Bind Abst) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))) +(\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead +c (Bind b) u) x0 t2))))))))) (pr3_ind c (\lambda (t: T).(\lambda (t0: +T).(\forall (x0: T).(\forall (x1: T).((eq T t (THead (Bind Abst) x0 x1)) \to +(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T t0 (THead (Bind Abst) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +x1 t2))))))))))) (\lambda (t: T).(\lambda (x0: T).(\lambda (x1: T).(\lambda +(H1: (eq T t (THead (Bind Abst) x0 x1))).(ex3_2_intro T T (\lambda (u2: +T).(\lambda (t2: T).(eq T t (THead (Bind Abst) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x1 t2))))) x0 x1 H1 +(pr3_refl c x0) (\lambda (b: B).(\lambda (u: T).(pr3_refl (CHead c (Bind b) +u) x1)))))))) (\lambda (t2: T).(\lambda (t3: T).(\lambda (H1: (pr2 c t3 +t2)).(\lambda (t4: T).(\lambda (_: (pr3 c t2 t4)).(\lambda (H3: ((\forall +(x0: T).(\forall (x1: T).((eq T t2 (THead (Bind Abst) x0 x1)) \to (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Abst) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x1 +t5))))))))))).(\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T t3 (THead +(Bind Abst) x0 x1))).(let H5 \def (eq_ind T t3 (\lambda (t: T).(pr2 c t t2)) +H1 (THead (Bind Abst) x0 x1) H4) in (let H6 \def (pr2_gen_abst c x0 x1 t2 H5) +in (ex3_2_ind T T (\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead (Bind +Abst) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +x1 t5))))) (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind +Abst) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +x1 t5)))))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H7: (eq T t2 (THead +(Bind Abst) x2 x3))).(\lambda (H8: (pr2 c x0 x2)).(\lambda (H9: ((\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x1 x3))))).(let H10 \def (eq_ind +T t2 (\lambda (t: T).(\forall (x4: T).(\forall (x5: T).((eq T t (THead (Bind +Abst) x4 x5)) \to (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 +(THead (Bind Abst) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x4 u2))) +(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead +c (Bind b) u) x5 t5)))))))))) H3 (THead (Bind Abst) x2 x3) H7) in (let H11 +\def (H10 x2 x3 (refl_equal T (THead (Bind Abst) x2 x3))) in (ex3_2_ind T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Abst) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda +(t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x3 t5))))) +(ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Abst) u2 +t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +x1 t5)))))) (\lambda (x4: T).(\lambda (x5: T).(\lambda (H12: (eq T t4 (THead +(Bind Abst) x4 x5))).(\lambda (H13: (pr3 c x2 x4)).(\lambda (H14: ((\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x3 x5))))).(ex3_2_intro T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Abst) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x1 t5))))) +x4 x5 H12 (pr3_sing c x2 x0 H8 x4 H13) (\lambda (b: B).(\lambda (u: +T).(pr3_sing (CHead c (Bind b) u) x3 x1 (H9 b u) x5 (H14 b u)))))))))) +H11)))))))) H6)))))))))))) y x H0))))) H))))). + +theorem pr3_gen_cast: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr3 c +(THead (Flat Cast) u1 t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Flat Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c t1 t2)))) (pr3 c +t1 x)))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr3 c (THead (Flat Cast) u1 t1) x)).(insert_eq T (THead (Flat Cast) u1 +t1) (\lambda (t: T).(pr3 c t x)) (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Flat Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c t1 t2)))) (pr3 c +t1 x)) (\lambda (y: T).(\lambda (H0: (pr3 c y x)).(unintro T t1 (\lambda (t: +T).((eq T y (THead (Flat Cast) u1 t)) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T x (THead (Flat Cast) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c t +t2)))) (pr3 c t x)))) (unintro T u1 (\lambda (t: T).(\forall (x0: T).((eq T y +(THead (Flat Cast) t x0)) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Flat Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 +c t u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c x0 t2)))) (pr3 c x0 x))))) +(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (x0: T).(\forall (x1: +T).((eq T t (THead (Flat Cast) x0 x1)) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T t0 (THead (Flat Cast) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c x1 +t2)))) (pr3 c x1 t0))))))) (\lambda (t: T).(\lambda (x0: T).(\lambda (x1: +T).(\lambda (H1: (eq T t (THead (Flat Cast) x0 x1))).(eq_ind_r T (THead (Flat +Cast) x0 x1) (\lambda (t0: T).(or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T t0 (THead (Flat Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c x1 t2)))) (pr3 c +x1 t0))) (or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead +(Flat Cast) x0 x1) (THead (Flat Cast) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c x1 t2)))) (pr3 c +x1 (THead (Flat Cast) x0 x1)) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t2: +T).(eq T (THead (Flat Cast) x0 x1) (THead (Flat Cast) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c x1 +t2))) x0 x1 (refl_equal T (THead (Flat Cast) x0 x1)) (pr3_refl c x0) +(pr3_refl c x1))) t H1))))) (\lambda (t2: T).(\lambda (t3: T).(\lambda (H1: +(pr2 c t3 t2)).(\lambda (t4: T).(\lambda (H2: (pr3 c t2 t4)).(\lambda (H3: +((\forall (x0: T).(\forall (x1: T).((eq T t2 (THead (Flat Cast) x0 x1)) \to +(or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Cast) +u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 c x1 t5)))) (pr3 c x1 t4))))))).(\lambda (x0: +T).(\lambda (x1: T).(\lambda (H4: (eq T t3 (THead (Flat Cast) x0 x1))).(let +H5 \def (eq_ind T t3 (\lambda (t: T).(pr2 c t t2)) H1 (THead (Flat Cast) x0 +x1) H4) in (let H6 \def (pr2_gen_cast c x0 x1 t2 H5) in (or_ind (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead (Flat Cast) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr2 c x1 t5)))) (pr2 c x1 t2) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Flat Cast) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x1 +t5)))) (pr3 c x1 t4)) (\lambda (H7: (ex3_2 T T (\lambda (u2: T).(\lambda (t5: +T).(eq T t2 (THead (Flat Cast) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr2 c x1 +t5))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead +(Flat Cast) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr2 c x1 t5))) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Flat Cast) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x1 +t5)))) (pr3 c x1 t4)) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H8: (eq T +t2 (THead (Flat Cast) x2 x3))).(\lambda (H9: (pr2 c x0 x2)).(\lambda (H10: +(pr2 c x1 x3)).(let H11 \def (eq_ind T t2 (\lambda (t: T).(\forall (x4: +T).(\forall (x5: T).((eq T t (THead (Flat Cast) x4 x5)) \to (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Cast) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x4 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 c x5 t5)))) (pr3 c x5 t4)))))) H3 (THead (Flat Cast) x2 x3) H8) +in (let H12 \def (H11 x2 x3 (refl_equal T (THead (Flat Cast) x2 x3))) in +(or_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat +Cast) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 c x3 t5)))) (pr3 c x3 t4) (or (ex3_2 T T (\lambda +(u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Cast) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x1 +t5)))) (pr3 c x1 t4)) (\lambda (H13: (ex3_2 T T (\lambda (u2: T).(\lambda +(t5: T).(eq T t4 (THead (Flat Cast) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x3 +t5))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead +(Flat Cast) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 c x3 t5))) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Flat Cast) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x1 +t5)))) (pr3 c x1 t4)) (\lambda (x4: T).(\lambda (x5: T).(\lambda (H14: (eq T +t4 (THead (Flat Cast) x4 x5))).(\lambda (H15: (pr3 c x2 x4)).(\lambda (H16: +(pr3 c x3 x5)).(eq_ind_r T (THead (Flat Cast) x4 x5) (\lambda (t: T).(or +(ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t (THead (Flat Cast) u2 +t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 c x1 t5)))) (pr3 c x1 t))) (or_introl (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T (THead (Flat Cast) x4 x5) (THead +(Flat Cast) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 c x1 t5)))) (pr3 c x1 (THead (Flat +Cast) x4 x5)) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t5: T).(eq T (THead +(Flat Cast) x4 x5) (THead (Flat Cast) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x1 t5))) x4 x5 +(refl_equal T (THead (Flat Cast) x4 x5)) (pr3_sing c x2 x0 H9 x4 H15) +(pr3_sing c x3 x1 H10 x5 H16))) t4 H14)))))) H13)) (\lambda (H13: (pr3 c x3 +t4)).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead +(Flat Cast) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 c x1 t5)))) (pr3 c x1 t4) (pr3_sing c +x3 x1 H10 t4 H13))) H12)))))))) H7)) (\lambda (H7: (pr2 c x1 t2)).(or_intror +(ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Cast) u2 +t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 c x1 t5)))) (pr3 c x1 t4) (pr3_sing c t2 x1 H7 t4 +H2))) H6)))))))))))) y x H0))))) H))))). + +theorem pr3_gen_lift: + \forall (c: C).(\forall (t1: T).(\forall (x: T).(\forall (h: nat).(\forall +(d: nat).((pr3 c (lift h d t1) x) \to (\forall (e: C).((drop h d c e) \to +(ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(pr3 e t1 +t2)))))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (x: T).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (H: (pr3 c (lift h d t1) x)).(insert_eq T (lift h d t1) +(\lambda (t: T).(pr3 c t x)) (\forall (e: C).((drop h d c e) \to (ex2 T +(\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(pr3 e t1 t2))))) +(\lambda (y: T).(\lambda (H0: (pr3 c y x)).(unintro T t1 (\lambda (t: T).((eq +T y (lift h d t)) \to (\forall (e: C).((drop h d c e) \to (ex2 T (\lambda +(t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(pr3 e t t2))))))) (pr3_ind +c (\lambda (t: T).(\lambda (t0: T).(\forall (x0: T).((eq T t (lift h d x0)) +\to (\forall (e: C).((drop h d c e) \to (ex2 T (\lambda (t2: T).(eq T t0 +(lift h d t2))) (\lambda (t2: T).(pr3 e x0 t2))))))))) (\lambda (t: +T).(\lambda (x0: T).(\lambda (H1: (eq T t (lift h d x0))).(\lambda (e: +C).(\lambda (_: (drop h d c e)).(ex_intro2 T (\lambda (t2: T).(eq T t (lift h +d t2))) (\lambda (t2: T).(pr3 e x0 t2)) x0 H1 (pr3_refl e x0))))))) (\lambda +(t2: T).(\lambda (t3: T).(\lambda (H1: (pr2 c t3 t2)).(\lambda (t4: +T).(\lambda (_: (pr3 c t2 t4)).(\lambda (H3: ((\forall (x0: T).((eq T t2 +(lift h d x0)) \to (\forall (e: C).((drop h d c e) \to (ex2 T (\lambda (t5: +T).(eq T t4 (lift h d t5))) (\lambda (t5: T).(pr3 e x0 t5))))))))).(\lambda +(x0: T).(\lambda (H4: (eq T t3 (lift h d x0))).(\lambda (e: C).(\lambda (H5: +(drop h d c e)).(let H6 \def (eq_ind T t3 (\lambda (t: T).(pr2 c t t2)) H1 +(lift h d x0) H4) in (let H7 \def (pr2_gen_lift c x0 t2 h d H6 e H5) in +(ex2_ind T (\lambda (t5: T).(eq T t2 (lift h d t5))) (\lambda (t5: T).(pr2 e +x0 t5)) (ex2 T (\lambda (t5: T).(eq T t4 (lift h d t5))) (\lambda (t5: +T).(pr3 e x0 t5))) (\lambda (x1: T).(\lambda (H8: (eq T t2 (lift h d +x1))).(\lambda (H9: (pr2 e x0 x1)).(ex2_ind T (\lambda (t5: T).(eq T t4 (lift +h d t5))) (\lambda (t5: T).(pr3 e x1 t5)) (ex2 T (\lambda (t5: T).(eq T t4 +(lift h d t5))) (\lambda (t5: T).(pr3 e x0 t5))) (\lambda (x2: T).(\lambda +(H10: (eq T t4 (lift h d x2))).(\lambda (H11: (pr3 e x1 x2)).(ex_intro2 T +(\lambda (t5: T).(eq T t4 (lift h d t5))) (\lambda (t5: T).(pr3 e x0 t5)) x2 +H10 (pr3_sing e x1 x0 H9 x2 H11))))) (H3 x1 H8 e H5))))) H7))))))))))))) y x +H0)))) H)))))). + +theorem pr3_gen_lref: + \forall (c: C).(\forall (x: T).(\forall (n: nat).((pr3 c (TLRef n) x) \to +(or (eq T x (TLRef n)) (ex3_3 C T T (\lambda (d: C).(\lambda (u: T).(\lambda +(_: T).(getl n c (CHead d (Bind Abbr) u))))) (\lambda (d: C).(\lambda (u: +T).(\lambda (v: T).(pr3 d u v)))) (\lambda (_: C).(\lambda (_: T).(\lambda +(v: T).(eq T x (lift (S n) O v)))))))))) +\def + \lambda (c: C).(\lambda (x: T).(\lambda (n: nat).(\lambda (H: (pr3 c (TLRef +n) x)).(insert_eq T (TLRef n) (\lambda (t: T).(pr3 c t x)) (or (eq T x (TLRef +n)) (ex3_3 C T T (\lambda (d: C).(\lambda (u: T).(\lambda (_: T).(getl n c +(CHead d (Bind Abbr) u))))) (\lambda (d: C).(\lambda (u: T).(\lambda (v: +T).(pr3 d u v)))) (\lambda (_: C).(\lambda (_: T).(\lambda (v: T).(eq T x +(lift (S n) O v))))))) (\lambda (y: T).(\lambda (H0: (pr3 c y x)).(pr3_ind c +(\lambda (t: T).(\lambda (t0: T).((eq T t (TLRef n)) \to (or (eq T t0 (TLRef +n)) (ex3_3 C T T (\lambda (d: C).(\lambda (u: T).(\lambda (_: T).(getl n c +(CHead d (Bind Abbr) u))))) (\lambda (d: C).(\lambda (u: T).(\lambda (v: +T).(pr3 d u v)))) (\lambda (_: C).(\lambda (_: T).(\lambda (v: T).(eq T t0 +(lift (S n) O v)))))))))) (\lambda (t: T).(\lambda (H1: (eq T t (TLRef +n))).(or_introl (eq T t (TLRef n)) (ex3_3 C T T (\lambda (d: C).(\lambda (u: +T).(\lambda (_: T).(getl n c (CHead d (Bind Abbr) u))))) (\lambda (d: +C).(\lambda (u: T).(\lambda (v: T).(pr3 d u v)))) (\lambda (_: C).(\lambda +(_: T).(\lambda (v: T).(eq T t (lift (S n) O v)))))) H1))) (\lambda (t2: +T).(\lambda (t1: T).(\lambda (H1: (pr2 c t1 t2)).(\lambda (t3: T).(\lambda +(H2: (pr3 c t2 t3)).(\lambda (H3: (((eq T t2 (TLRef n)) \to (or (eq T t3 +(TLRef n)) (ex3_3 C T T (\lambda (d: C).(\lambda (u: T).(\lambda (_: T).(getl +n c (CHead d (Bind Abbr) u))))) (\lambda (d: C).(\lambda (u: T).(\lambda (v: +T).(pr3 d u v)))) (\lambda (_: C).(\lambda (_: T).(\lambda (v: T).(eq T t3 +(lift (S n) O v)))))))))).(\lambda (H4: (eq T t1 (TLRef n))).(let H5 \def +(eq_ind T t1 (\lambda (t: T).(pr2 c t t2)) H1 (TLRef n) H4) in (let H6 \def +(pr2_gen_lref c t2 n H5) in (or_ind (eq T t2 (TLRef n)) (ex2_2 C T (\lambda +(d: C).(\lambda (u: T).(getl n c (CHead d (Bind Abbr) u)))) (\lambda (_: +C).(\lambda (u: T).(eq T t2 (lift (S n) O u))))) (or (eq T t3 (TLRef n)) +(ex3_3 C T T (\lambda (d: C).(\lambda (u: T).(\lambda (_: T).(getl n c (CHead +d (Bind Abbr) u))))) (\lambda (d: C).(\lambda (u: T).(\lambda (v: T).(pr3 d u +v)))) (\lambda (_: C).(\lambda (_: T).(\lambda (v: T).(eq T t3 (lift (S n) O +v))))))) (\lambda (H7: (eq T t2 (TLRef n))).(H3 H7)) (\lambda (H7: (ex2_2 C T +(\lambda (d: C).(\lambda (u: T).(getl n c (CHead d (Bind Abbr) u)))) (\lambda +(_: C).(\lambda (u: T).(eq T t2 (lift (S n) O u)))))).(ex2_2_ind C T (\lambda +(d: C).(\lambda (u: T).(getl n c (CHead d (Bind Abbr) u)))) (\lambda (_: +C).(\lambda (u: T).(eq T t2 (lift (S n) O u)))) (or (eq T t3 (TLRef n)) +(ex3_3 C T T (\lambda (d: C).(\lambda (u: T).(\lambda (_: T).(getl n c (CHead +d (Bind Abbr) u))))) (\lambda (d: C).(\lambda (u: T).(\lambda (v: T).(pr3 d u +v)))) (\lambda (_: C).(\lambda (_: T).(\lambda (v: T).(eq T t3 (lift (S n) O +v))))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H8: (getl n c (CHead x0 +(Bind Abbr) x1))).(\lambda (H9: (eq T t2 (lift (S n) O x1))).(let H10 \def +(eq_ind T t2 (\lambda (t: T).(pr3 c t t3)) H2 (lift (S n) O x1) H9) in (let +H11 \def (pr3_gen_lift c x1 t3 (S n) O H10 x0 (getl_drop Abbr c x0 x1 n H8)) +in (ex2_ind T (\lambda (t4: T).(eq T t3 (lift (S n) O t4))) (\lambda (t4: +T).(pr3 x0 x1 t4)) (or (eq T t3 (TLRef n)) (ex3_3 C T T (\lambda (d: +C).(\lambda (u: T).(\lambda (_: T).(getl n c (CHead d (Bind Abbr) u))))) +(\lambda (d: C).(\lambda (u: T).(\lambda (v: T).(pr3 d u v)))) (\lambda (_: +C).(\lambda (_: T).(\lambda (v: T).(eq T t3 (lift (S n) O v))))))) (\lambda +(x2: T).(\lambda (H12: (eq T t3 (lift (S n) O x2))).(\lambda (H13: (pr3 x0 x1 +x2)).(or_intror (eq T t3 (TLRef n)) (ex3_3 C T T (\lambda (d: C).(\lambda (u: +T).(\lambda (_: T).(getl n c (CHead d (Bind Abbr) u))))) (\lambda (d: +C).(\lambda (u: T).(\lambda (v: T).(pr3 d u v)))) (\lambda (_: C).(\lambda +(_: T).(\lambda (v: T).(eq T t3 (lift (S n) O v)))))) (ex3_3_intro C T T +(\lambda (d: C).(\lambda (u: T).(\lambda (_: T).(getl n c (CHead d (Bind +Abbr) u))))) (\lambda (d: C).(\lambda (u: T).(\lambda (v: T).(pr3 d u v)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (v: T).(eq T t3 (lift (S n) O v))))) +x0 x1 x2 H8 H13 H12))))) H11))))))) H7)) H6)))))))))) y x H0))) H)))). + +theorem pr3_gen_void: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr3 c +(THead (Bind Void) u1 t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall +(u: T).(pr3 (CHead c (Bind b) u) t1 t2)))))) (pr3 (CHead c (Bind Void) u1) t1 +(lift (S O) O x))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr3 c (THead (Bind Void) u1 t1) x)).(insert_eq T (THead (Bind Void) u1 +t1) (\lambda (t: T).(pr3 c t x)) (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall +(u: T).(pr3 (CHead c (Bind b) u) t1 t2)))))) (pr3 (CHead c (Bind Void) u1) t1 +(lift (S O) O x))) (\lambda (y: T).(\lambda (H0: (pr3 c y x)).(unintro T t1 +(\lambda (t: T).((eq T y (THead (Bind Void) u1 t)) \to (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind Void) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda +(t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t t2)))))) +(pr3 (CHead c (Bind Void) u1) t (lift (S O) O x))))) (unintro T u1 (\lambda +(t: T).(\forall (x0: T).((eq T y (THead (Bind Void) t x0)) \to (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind Void) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))) (\lambda (_: T).(\lambda (t2: +T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x0 t2)))))) (pr3 +(CHead c (Bind Void) t) x0 (lift (S O) O x)))))) (pr3_ind c (\lambda (t: +T).(\lambda (t0: T).(\forall (x0: T).(\forall (x1: T).((eq T t (THead (Bind +Void) x0 x1)) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T t0 +(THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead +c (Bind b) u) x1 t2)))))) (pr3 (CHead c (Bind Void) x0) x1 (lift (S O) O +t0)))))))) (\lambda (t: T).(\lambda (x0: T).(\lambda (x1: T).(\lambda (H1: +(eq T t (THead (Bind Void) x0 x1))).(eq_ind_r T (THead (Bind Void) x0 x1) +(\lambda (t0: T).(or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T t0 +(THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead +c (Bind b) u) x1 t2)))))) (pr3 (CHead c (Bind Void) x0) x1 (lift (S O) O +t0)))) (or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead +(Bind Void) x0 x1) (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall +(u: T).(pr3 (CHead c (Bind b) u) x1 t2)))))) (pr3 (CHead c (Bind Void) x0) x1 +(lift (S O) O (THead (Bind Void) x0 x1))) (ex3_2_intro T T (\lambda (u2: +T).(\lambda (t2: T).(eq T (THead (Bind Void) x0 x1) (THead (Bind Void) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +x1 t2))))) x0 x1 (refl_equal T (THead (Bind Void) x0 x1)) (pr3_refl c x0) +(\lambda (b: B).(\lambda (u: T).(pr3_refl (CHead c (Bind b) u) x1))))) t +H1))))) (\lambda (t2: T).(\lambda (t3: T).(\lambda (H1: (pr2 c t3 +t2)).(\lambda (t4: T).(\lambda (H2: (pr3 c t2 t4)).(\lambda (H3: ((\forall +(x0: T).(\forall (x1: T).((eq T t2 (THead (Bind Void) x0 x1)) \to (or (ex3_2 +T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Void) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x1 t5)))))) +(pr3 (CHead c (Bind Void) x0) x1 (lift (S O) O t4)))))))).(\lambda (x0: +T).(\lambda (x1: T).(\lambda (H4: (eq T t3 (THead (Bind Void) x0 x1))).(let +H5 \def (eq_ind T t3 (\lambda (t: T).(pr2 c t t2)) H1 (THead (Bind Void) x0 +x1) H4) in (let H6 \def (pr2_gen_void c x0 x1 t2 H5) in (or_ind (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead (Bind Void) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x1 t5)))))) +(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x1 (lift (S O) O +t2)))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind +Void) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +x1 t5)))))) (pr3 (CHead c (Bind Void) x0) x1 (lift (S O) O t4))) (\lambda +(H7: (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead (Bind Void) +u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +x1 t5))))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead +(Bind Void) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead +c (Bind b) u) x1 t5))))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq +T t4 (THead (Bind Void) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))) (\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) x1 t5)))))) (pr3 (CHead c (Bind Void) x0) x1 (lift (S O) +O t4))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H8: (eq T t2 (THead (Bind +Void) x2 x3))).(\lambda (H9: (pr2 c x0 x2)).(\lambda (H10: ((\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x1 x3))))).(let H11 \def (eq_ind +T t2 (\lambda (t: T).(\forall (x4: T).(\forall (x5: T).((eq T t (THead (Bind +Void) x4 x5)) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 +(THead (Bind Void) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x4 u2))) +(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead +c (Bind b) u) x5 t5)))))) (pr3 (CHead c (Bind Void) x4) x5 (lift (S O) O +t4))))))) H3 (THead (Bind Void) x2 x3) H8) in (let H12 \def (H11 x2 x3 +(refl_equal T (THead (Bind Void) x2 x3))) in (or_ind (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Void) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x3 t5)))))) (pr3 (CHead c +(Bind Void) x2) x3 (lift (S O) O t4)) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Void) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x1 t5)))))) (pr3 (CHead c +(Bind Void) x0) x1 (lift (S O) O t4))) (\lambda (H13: (ex3_2 T T (\lambda +(u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Void) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x3 t5))))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Void) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda +(t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x3 t5))))) +(or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Void) +u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +x1 t5)))))) (pr3 (CHead c (Bind Void) x0) x1 (lift (S O) O t4))) (\lambda +(x4: T).(\lambda (x5: T).(\lambda (H14: (eq T t4 (THead (Bind Void) x4 +x5))).(\lambda (H15: (pr3 c x2 x4)).(\lambda (H16: ((\forall (b: B).(\forall +(u: T).(pr3 (CHead c (Bind b) u) x3 x5))))).(or_introl (ex3_2 T T (\lambda +(u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Void) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x1 t5)))))) (pr3 (CHead c +(Bind Void) x0) x1 (lift (S O) O t4)) (ex3_2_intro T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Void) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x1 t5))))) x4 x5 H14 +(pr3_sing c x2 x0 H9 x4 H15) (\lambda (b: B).(\lambda (u: T).(pr3_sing (CHead +c (Bind b) u) x3 x1 (H10 b u) x5 (H16 b u))))))))))) H13)) (\lambda (H13: +(pr3 (CHead c (Bind Void) x2) x3 (lift (S O) O t4))).(or_intror (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Void) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x1 t5)))))) +(pr3 (CHead c (Bind Void) x0) x1 (lift (S O) O t4)) (pr3_sing (CHead c (Bind +Void) x0) x3 x1 (H10 Void x0) (lift (S O) O t4) (pr3_pr2_pr3_t c x2 x3 (lift +(S O) O t4) (Bind Void) H13 x0 H9)))) H12)))))))) H7)) (\lambda (H7: +((\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x1 (lift (S O) O +t2)))))).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 +(THead (Bind Void) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead +c (Bind b) u) x1 t5)))))) (pr3 (CHead c (Bind Void) x0) x1 (lift (S O) O t4)) +(pr3_sing (CHead c (Bind Void) x0) (lift (S O) O t2) x1 (H7 Void x0) (lift (S +O) O t4) (pr3_lift (CHead c (Bind Void) x0) c (S O) O (drop_drop (Bind Void) +O c c (drop_refl c) x0) t2 t4 H2)))) H6)))))))))))) y x H0))))) H))))). + +theorem pr3_gen_abbr: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr3 c +(THead (Bind Abbr) u1 t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) +u1) t1 t2)))) (pr3 (CHead c (Bind Abbr) u1) t1 (lift (S O) O x))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr3 c (THead (Bind Abbr) u1 t1) x)).(insert_eq T (THead (Bind Abbr) u1 +t1) (\lambda (t: T).(pr3 c t x)) (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) +u1) t1 t2)))) (pr3 (CHead c (Bind Abbr) u1) t1 (lift (S O) O x))) (\lambda +(y: T).(\lambda (H0: (pr3 c y x)).(unintro T t1 (\lambda (t: T).((eq T y +(THead (Bind Abbr) u1 t)) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 +c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) u1) t +t2)))) (pr3 (CHead c (Bind Abbr) u1) t (lift (S O) O x))))) (unintro T u1 +(\lambda (t: T).(\forall (x0: T).((eq T y (THead (Bind Abbr) t x0)) \to (or +(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind Abbr) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))) (\lambda (_: +T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) t) x0 t2)))) (pr3 (CHead c +(Bind Abbr) t) x0 (lift (S O) O x)))))) (pr3_ind c (\lambda (t: T).(\lambda +(t0: T).(\forall (x0: T).(\forall (x1: T).((eq T t (THead (Bind Abbr) x0 x1)) +\to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T t0 (THead (Bind +Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) x0) x1 t2)))) (pr3 (CHead c +(Bind Abbr) x0) x1 (lift (S O) O t0)))))))) (\lambda (t: T).(\lambda (x0: +T).(\lambda (x1: T).(\lambda (H1: (eq T t (THead (Bind Abbr) x0 +x1))).(eq_ind_r T (THead (Bind Abbr) x0 x1) (\lambda (t0: T).(or (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T t0 (THead (Bind Abbr) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t2: T).(pr3 (CHead c (Bind Abbr) x0) x1 t2)))) (pr3 (CHead c (Bind Abbr) x0) +x1 (lift (S O) O t0)))) (or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T (THead (Bind Abbr) x0 x1) (THead (Bind Abbr) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t2)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S +O) O (THead (Bind Abbr) x0 x1))) (ex3_2_intro T T (\lambda (u2: T).(\lambda +(t2: T).(eq T (THead (Bind Abbr) x0 x1) (THead (Bind Abbr) u2 t2)))) (\lambda +(u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t2))) x0 x1 (refl_equal T (THead (Bind Abbr) x0 +x1)) (pr3_refl c x0) (pr3_refl (CHead c (Bind Abbr) x0) x1))) t H1))))) +(\lambda (t2: T).(\lambda (t3: T).(\lambda (H1: (pr2 c t3 t2)).(\lambda (t4: +T).(\lambda (H2: (pr3 c t2 t4)).(\lambda (H3: ((\forall (x0: T).(\forall (x1: +T).((eq T t2 (THead (Bind Abbr) x0 x1)) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S +O) O t4)))))))).(\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T t3 +(THead (Bind Abbr) x0 x1))).(let H5 \def (eq_ind T t3 (\lambda (t: T).(pr2 c +t t2)) H1 (THead (Bind Abbr) x0 x1) H4) in (let H6 \def (pr2_gen_abbr c x0 x1 +t2 H5) in (or_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t2 +(THead (Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) x1 t5))) (ex2 T (\lambda (u: T).(pr0 x0 u)) (\lambda (u: +T).(pr2 (CHead c (Bind Abbr) u) x1 t5))) (ex3_2 T T (\lambda (y0: T).(\lambda +(_: T).(pr2 (CHead c (Bind Abbr) x0) x1 y0))) (\lambda (y0: T).(\lambda (z: +T).(pr0 y0 z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) x0) +z t5)))))))) (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x1 +(lift (S O) O t2)))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T +t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 +t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda (H7: +(ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead (Bind Abbr) u2 +t5)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind +b) u) x1 t5))) (ex2 T (\lambda (u: T).(pr0 x0 u)) (\lambda (u: T).(pr2 (CHead +c (Bind Abbr) u) x1 t5))) (ex3_2 T T (\lambda (y0: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) x0) x1 y0))) (\lambda (y0: T).(\lambda (z: T).(pr0 y0 +z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) x0) z +t5))))))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead +(Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(or3 (\forall (b: B).(\forall (u: T).(pr2 +(CHead c (Bind b) u) x1 t5))) (ex2 T (\lambda (u: T).(pr0 x0 u)) (\lambda (u: +T).(pr2 (CHead c (Bind Abbr) u) x1 t5))) (ex3_2 T T (\lambda (y0: T).(\lambda +(_: T).(pr2 (CHead c (Bind Abbr) x0) x1 y0))) (\lambda (y0: T).(\lambda (z: +T).(pr0 y0 z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) x0) +z t5))))))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead +(Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 t5)))) (pr3 +(CHead c (Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda (x2: T).(\lambda +(x3: T).(\lambda (H8: (eq T t2 (THead (Bind Abbr) x2 x3))).(\lambda (H9: (pr2 +c x0 x2)).(\lambda (H10: (or3 (\forall (b: B).(\forall (u: T).(pr2 (CHead c +(Bind b) u) x1 x3))) (ex2 T (\lambda (u: T).(pr0 x0 u)) (\lambda (u: T).(pr2 +(CHead c (Bind Abbr) u) x1 x3))) (ex3_2 T T (\lambda (y0: T).(\lambda (_: +T).(pr2 (CHead c (Bind Abbr) x0) x1 y0))) (\lambda (y0: T).(\lambda (z: +T).(pr0 y0 z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) x0) +z x3)))))).(or3_ind (\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +x1 x3))) (ex2 T (\lambda (u: T).(pr0 x0 u)) (\lambda (u: T).(pr2 (CHead c +(Bind Abbr) u) x1 x3))) (ex3_2 T T (\lambda (y0: T).(\lambda (_: T).(pr2 +(CHead c (Bind Abbr) x0) x1 y0))) (\lambda (y0: T).(\lambda (z: T).(pr0 y0 +z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c (Bind Abbr) x0) z x3)))) +(or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) +u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c +(Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda (H11: ((\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x1 x3))))).(let H12 \def (eq_ind +T t2 (\lambda (t: T).(\forall (x4: T).(\forall (x5: T).((eq T t (THead (Bind +Abbr) x4 x5)) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 +(THead (Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x4 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x4) x5 t5)))) (pr3 +(CHead c (Bind Abbr) x4) x5 (lift (S O) O t4))))))) H3 (THead (Bind Abbr) x2 +x3) H8) in (let H13 \def (H12 x2 x3 (refl_equal T (THead (Bind Abbr) x2 x3))) +in (or_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind +Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x2) x3 t5)))) (pr3 (CHead c +(Bind Abbr) x2) x3 (lift (S O) O t4)) (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S +O) O t4))) (\lambda (H14: (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T +t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x2 +u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x2) x3 +t5))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead +(Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x2) x3 t5))) (or +(ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 +t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c +(Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda (x4: T).(\lambda (x5: +T).(\lambda (H15: (eq T t4 (THead (Bind Abbr) x4 x5))).(\lambda (H16: (pr3 c +x2 x4)).(\lambda (H17: (pr3 (CHead c (Bind Abbr) x2) x3 x5)).(eq_ind_r T +(THead (Bind Abbr) x4 x5) (\lambda (t: T).(or (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S +O) O t)))) (or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T +(THead (Bind Abbr) x4 x5) (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S +O) O (THead (Bind Abbr) x4 x5))) (ex3_2_intro T T (\lambda (u2: T).(\lambda +(t5: T).(eq T (THead (Bind Abbr) x4 x5) (THead (Bind Abbr) u2 t5)))) (\lambda +(u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5))) x4 x5 (refl_equal T (THead (Bind Abbr) x4 +x5)) (pr3_sing c x2 x0 H9 x4 H16) (pr3_sing (CHead c (Bind Abbr) x0) x3 x1 +(H11 Abbr x0) x5 (pr3_pr2_pr3_t c x2 x3 x5 (Bind Abbr) H17 x0 H9)))) t4 +H15)))))) H14)) (\lambda (H14: (pr3 (CHead c (Bind Abbr) x2) x3 (lift (S O) O +t4))).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead +(Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 t5)))) (pr3 +(CHead c (Bind Abbr) x0) x1 (lift (S O) O t4)) (pr3_sing (CHead c (Bind Abbr) +x0) x3 x1 (H11 Abbr x0) (lift (S O) O t4) (pr3_pr2_pr3_t c x2 x3 (lift (S O) +O t4) (Bind Abbr) H14 x0 H9)))) H13)))) (\lambda (H11: (ex2 T (\lambda (u: +T).(pr0 x0 u)) (\lambda (u: T).(pr2 (CHead c (Bind Abbr) u) x1 +x3)))).(ex2_ind T (\lambda (u: T).(pr0 x0 u)) (\lambda (u: T).(pr2 (CHead c +(Bind Abbr) u) x1 x3)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T +t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 +t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda (x4: +T).(\lambda (H12: (pr0 x0 x4)).(\lambda (H13: (pr2 (CHead c (Bind Abbr) x4) +x1 x3)).(let H14 \def (eq_ind T t2 (\lambda (t: T).(\forall (x5: T).(\forall +(x6: T).((eq T t (THead (Bind Abbr) x5 x6)) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x5 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x5) x6 t5)))) (pr3 (CHead c (Bind Abbr) x5) x6 (lift (S +O) O t4))))))) H3 (THead (Bind Abbr) x2 x3) H8) in (let H15 \def (H14 x2 x3 +(refl_equal T (THead (Bind Abbr) x2 x3))) in (or_ind (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x2) x3 t5)))) (pr3 (CHead c (Bind Abbr) x2) x3 (lift (S +O) O t4)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead +(Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 t5)))) (pr3 +(CHead c (Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda (H16: (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 (CHead c (Bind Abbr) x2) x3 t5))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x2) x3 t5))) (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) +x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda +(x5: T).(\lambda (x6: T).(\lambda (H17: (eq T t4 (THead (Bind Abbr) x5 +x6))).(\lambda (H18: (pr3 c x2 x5)).(\lambda (H19: (pr3 (CHead c (Bind Abbr) +x2) x3 x6)).(eq_ind_r T (THead (Bind Abbr) x5 x6) (\lambda (t: T).(or (ex3_2 +T T (\lambda (u2: T).(\lambda (t5: T).(eq T t (THead (Bind Abbr) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) +x1 (lift (S O) O t)))) (or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t5: +T).(eq T (THead (Bind Abbr) x5 x6) (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S +O) O (THead (Bind Abbr) x5 x6))) (ex3_2_intro T T (\lambda (u2: T).(\lambda +(t5: T).(eq T (THead (Bind Abbr) x5 x6) (THead (Bind Abbr) u2 t5)))) (\lambda +(u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5))) x5 x6 (refl_equal T (THead (Bind Abbr) x5 +x6)) (pr3_sing c x2 x0 H9 x5 H18) (pr3_t x3 x1 (CHead c (Bind Abbr) x0) +(pr3_pr0_pr2_t x0 x4 H12 c x1 x3 (Bind Abbr) H13) x6 (pr3_pr2_pr3_t c x2 x3 +x6 (Bind Abbr) H19 x0 H9)))) t4 H17)))))) H16)) (\lambda (H16: (pr3 (CHead c +(Bind Abbr) x2) x3 (lift (S O) O t4))).(or_intror (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S +O) O t4)) (pr3_t x3 x1 (CHead c (Bind Abbr) x0) (pr3_pr0_pr2_t x0 x4 H12 c x1 +x3 (Bind Abbr) H13) (lift (S O) O t4) (pr3_pr2_pr3_t c x2 x3 (lift (S O) O +t4) (Bind Abbr) H16 x0 H9)))) H15)))))) H11)) (\lambda (H11: (ex3_2 T T +(\lambda (y0: T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) x0) x1 y0))) +(\lambda (y0: T).(\lambda (z: T).(pr0 y0 z))) (\lambda (_: T).(\lambda (z: +T).(pr2 (CHead c (Bind Abbr) x0) z x3))))).(ex3_2_ind T T (\lambda (y0: +T).(\lambda (_: T).(pr2 (CHead c (Bind Abbr) x0) x1 y0))) (\lambda (y0: +T).(\lambda (z: T).(pr0 y0 z))) (\lambda (_: T).(\lambda (z: T).(pr2 (CHead c +(Bind Abbr) x0) z x3))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq +T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 +t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda (x4: +T).(\lambda (x5: T).(\lambda (H12: (pr2 (CHead c (Bind Abbr) x0) x1 +x4)).(\lambda (H13: (pr0 x4 x5)).(\lambda (H14: (pr2 (CHead c (Bind Abbr) x0) +x5 x3)).(let H15 \def (eq_ind T t2 (\lambda (t: T).(\forall (x6: T).(\forall +(x7: T).((eq T t (THead (Bind Abbr) x6 x7)) \to (or (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x6 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x6) x7 t5)))) (pr3 (CHead c (Bind Abbr) x6) x7 (lift (S +O) O t4))))))) H3 (THead (Bind Abbr) x2 x3) H8) in (let H16 \def (H15 x2 x3 +(refl_equal T (THead (Bind Abbr) x2 x3))) in (or_ind (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x2) x3 t5)))) (pr3 (CHead c (Bind Abbr) x2) x3 (lift (S +O) O t4)) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead +(Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 t5)))) (pr3 +(CHead c (Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda (H17: (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 (CHead c (Bind Abbr) x2) x3 t5))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x2) x3 t5))) (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) +x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S O) O t4))) (\lambda +(x6: T).(\lambda (x7: T).(\lambda (H18: (eq T t4 (THead (Bind Abbr) x6 +x7))).(\lambda (H19: (pr3 c x2 x6)).(\lambda (H20: (pr3 (CHead c (Bind Abbr) +x2) x3 x7)).(eq_ind_r T (THead (Bind Abbr) x6 x7) (\lambda (t: T).(or (ex3_2 +T T (\lambda (u2: T).(\lambda (t5: T).(eq T t (THead (Bind Abbr) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) +x1 (lift (S O) O t)))) (or_introl (ex3_2 T T (\lambda (u2: T).(\lambda (t5: +T).(eq T (THead (Bind Abbr) x6 x7) (THead (Bind Abbr) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S +O) O (THead (Bind Abbr) x6 x7))) (ex3_2_intro T T (\lambda (u2: T).(\lambda +(t5: T).(eq T (THead (Bind Abbr) x6 x7) (THead (Bind Abbr) u2 t5)))) (\lambda +(u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 +(CHead c (Bind Abbr) x0) x1 t5))) x6 x7 (refl_equal T (THead (Bind Abbr) x6 +x7)) (pr3_sing c x2 x0 H9 x6 H19) (pr3_sing (CHead c (Bind Abbr) x0) x4 x1 +H12 x7 (pr3_sing (CHead c (Bind Abbr) x0) x5 x4 (pr2_free (CHead c (Bind +Abbr) x0) x4 x5 H13) x7 (pr3_sing (CHead c (Bind Abbr) x0) x3 x5 H14 x7 +(pr3_pr2_pr3_t c x2 x3 x7 (Bind Abbr) H20 x0 H9)))))) t4 H18)))))) H17)) +(\lambda (H17: (pr3 (CHead c (Bind Abbr) x2) x3 (lift (S O) O +t4))).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead +(Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) x0) x1 t5)))) (pr3 +(CHead c (Bind Abbr) x0) x1 (lift (S O) O t4)) (pr3_sing (CHead c (Bind Abbr) +x0) x4 x1 H12 (lift (S O) O t4) (pr3_sing (CHead c (Bind Abbr) x0) x5 x4 +(pr2_free (CHead c (Bind Abbr) x0) x4 x5 H13) (lift (S O) O t4) (pr3_sing +(CHead c (Bind Abbr) x0) x3 x5 H14 (lift (S O) O t4) (pr3_pr2_pr3_t c x2 x3 +(lift (S O) O t4) (Bind Abbr) H17 x0 H9)))))) H16)))))))) H11)) H10)))))) +H7)) (\lambda (H7: ((\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +x1 (lift (S O) O t2)))))).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda +(t5: T).(eq T t4 (THead (Bind Abbr) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 (CHead c (Bind Abbr) +x0) x1 t5)))) (pr3 (CHead c (Bind Abbr) x0) x1 (lift (S O) O t4)) (pr3_sing +(CHead c (Bind Abbr) x0) (lift (S O) O t2) x1 (H7 Abbr x0) (lift (S O) O t4) +(pr3_lift (CHead c (Bind Abbr) x0) c (S O) O (drop_drop (Bind Abbr) O c c +(drop_refl c) x0) t2 t4 H2)))) H6)))))))))))) y x H0))))) H))))). + +theorem pr3_gen_appl: + \forall (c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr3 c +(THead (Flat Appl) u1 t1) x) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c t1 t2)))) (ex4_4 T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(pr3 +c (THead (Bind Abbr) u2 t2) x))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c u1 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c t1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) x))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: T).(\lambda +(H: (pr3 c (THead (Flat Appl) u1 t1) x)).(insert_eq T (THead (Flat Appl) u1 +t1) (\lambda (t: T).(pr3 c t x)) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c t1 t2)))) (ex4_4 T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(pr3 +c (THead (Bind Abbr) u2 t2) x))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c u1 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c t1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c t1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) x))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(y: T).(\lambda (H0: (pr3 c y x)).(unintro T t1 (\lambda (t: T).((eq T y +(THead (Flat Appl) u1 t)) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 +c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c t t2)))) (ex4_4 T T T T +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(pr3 c +(THead (Bind Abbr) u2 t2) x))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c u1 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c t (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c t (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) x))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c u1 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))))) (unintro +T u1 (\lambda (t: T).(\forall (x0: T).((eq T y (THead (Flat Appl) t x0)) \to +(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Flat Appl) +u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c t u2))) (\lambda (_: +T).(\lambda (t2: T).(pr3 c x0 t2)))) (ex4_4 T T T T (\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (t2: T).(pr3 c (THead (Bind Abbr) u2 t2) +x))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 +c t u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c x0 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x0 (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2)) x))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c t u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))))))) (pr3_ind +c (\lambda (t: T).(\lambda (t0: T).(\forall (x0: T).(\forall (x1: T).((eq T t +(THead (Flat Appl) x0 x1)) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T t0 (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c x1 t2)))) (ex4_4 T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(pr3 +c (THead (Bind Abbr) u2 t2) t0))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t0))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))))))))) +(\lambda (t: T).(\lambda (x0: T).(\lambda (x1: T).(\lambda (H1: (eq T t +(THead (Flat Appl) x0 x1))).(eq_ind_r T (THead (Flat Appl) x0 x1) (\lambda +(t0: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T t0 (THead +(Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t2: T).(pr3 c x1 t2)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(pr3 c (THead (Bind +Abbr) u2 t2) t0))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t0))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))))) +(or3_intro0 (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead (Flat +Appl) x0 x1) (THead (Flat Appl) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 c x1 t2)))) (ex4_4 T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t2: T).(pr3 +c (THead (Bind Abbr) u2 t2) (THead (Flat Appl) x0 x1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))))) +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +z1 t2)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) +(THead (Flat Appl) x0 x1)))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 +(CHead c (Bind b) y2) z1 z2)))))))) (ex3_2_intro T T (\lambda (u2: +T).(\lambda (t2: T).(eq T (THead (Flat Appl) x0 x1) (THead (Flat Appl) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr3 c x1 t2))) x0 x1 (refl_equal T (THead (Flat Appl) x0 +x1)) (pr3_refl c x0) (pr3_refl c x1))) t H1))))) (\lambda (t2: T).(\lambda +(t3: T).(\lambda (H1: (pr2 c t3 t2)).(\lambda (t4: T).(\lambda (H2: (pr3 c t2 +t4)).(\lambda (H3: ((\forall (x0: T).(\forall (x1: T).((eq T t2 (THead (Flat +Appl) x0 x1)) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 +(THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind +Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 +z2)))))))))))))).(\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T t3 +(THead (Flat Appl) x0 x1))).(let H5 \def (eq_ind T t3 (\lambda (t: T).(pr2 c +t t2)) H1 (THead (Flat Appl) x0 x1) H4) in (let H6 \def (pr2_gen_appl c x0 x1 +t2 H5) in (or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t2 +(THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr2 c x1 t5)))) (ex4_4 T T T T (\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T x1 (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t5: T).(eq T t2 (THead (Bind Abbr) u2 t5)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq +T x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t2 (THead +(Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) (or3 (ex3_2 +T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Appl) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) t4))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(H7: (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead (Flat Appl) +u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr2 c x1 t5))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t2 (THead (Flat Appl) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr2 c x1 +t5))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat +Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) +t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 +c x0 u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(x2: T).(\lambda (x3: T).(\lambda (H8: (eq T t2 (THead (Flat Appl) x2 +x3))).(\lambda (H9: (pr2 c x0 x2)).(\lambda (H10: (pr2 c x1 x3)).(let H11 +\def (eq_ind T t2 (\lambda (t: T).(\forall (x4: T).(\forall (x5: T).((eq T t +(THead (Flat Appl) x4 x5)) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: +T).(eq T t4 (THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x4 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x5 t5)))) (ex4_4 T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 +c (THead (Bind Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c x4 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x5 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x5 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x4 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))))))) H3 +(THead (Flat Appl) x2 x3) H8) in (let H12 \def (eq_ind T t2 (\lambda (t: +T).(pr3 c t t4)) H2 (THead (Flat Appl) x2 x3) H8) in (let H13 \def (H11 x2 x3 +(refl_equal T (THead (Flat Appl) x2 x3))) in (or3_ind (ex3_2 T T (\lambda +(u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Appl) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x3 +t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) t4))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))))) +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x3 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(pr3 c x3 (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) +t4))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) +y2) z1 z2)))))))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 +(THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind +Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(H14: (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat +Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 c x3 t5))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead (Flat Appl) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x3 +t5))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat +Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) +t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 +c x0 u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(x4: T).(\lambda (x5: T).(\lambda (H15: (eq T t4 (THead (Flat Appl) x4 +x5))).(\lambda (H16: (pr3 c x2 x4)).(\lambda (H17: (pr3 c x3 x5)).(eq_ind_r T +(THead (Flat Appl) x4 x5) (\lambda (t: T).(or3 (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t (THead (Flat Appl) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x1 +t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) t))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))))) +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) +t))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) +y2) z1 z2)))))))))) (or3_intro0 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: +T).(eq T (THead (Flat Appl) x4 x5) (THead (Flat Appl) u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x1 +t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) (THead (Flat Appl) x4 +x5)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall +(u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2)) (THead (Flat Appl) x4 x5)))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))) +(ex3_2_intro T T (\lambda (u2: T).(\lambda (t5: T).(eq T (THead (Flat Appl) +x4 x5) (THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c +x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x1 t5))) x4 x5 (refl_equal T +(THead (Flat Appl) x4 x5)) (pr3_sing c x2 x0 H9 x4 H16) (pr3_sing c x3 x1 H10 +x5 H17))) t4 H15)))))) H14)) (\lambda (H14: (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind +Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x3 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5))))))))).(ex4_4_ind T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 +c (THead (Bind Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c x2 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x3 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5))))))) (or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Appl) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) t4))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(x4: T).(\lambda (x5: T).(\lambda (x6: T).(\lambda (x7: T).(\lambda (H15: +(pr3 c (THead (Bind Abbr) x6 x7) t4)).(\lambda (H16: (pr3 c x2 x6)).(\lambda +(H17: (pr3 c x3 (THead (Bind Abst) x4 x5))).(\lambda (H18: ((\forall (b: +B).(\forall (u: T).(pr3 (CHead c (Bind b) u) x5 x7))))).(or3_intro1 (ex3_2 T +T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Appl) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) t4))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))) (ex4_4_intro +T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: +T).(pr3 c (THead (Bind Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 +t5))))))) x4 x5 x6 x7 H15 (pr3_sing c x2 x0 H9 x6 H16) (pr3_sing c x3 x1 H10 +(THead (Bind Abst) x4 x5) H17) H18)))))))))) H14)) (\lambda (H14: (ex6_6 B T +T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(pr3 c x3 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x2 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 +z2))))))))).(ex6_6_ind B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x3 (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda +(u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift +(S O) O u2) z2)) t4))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x2 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 +(CHead c (Bind b) y2) z1 z2))))))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda +(t5: T).(eq T t4 (THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x1 t5)))) (ex4_4 T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 +c (THead (Bind Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(x4: B).(\lambda (x5: T).(\lambda (x6: T).(\lambda (x7: T).(\lambda (x8: +T).(\lambda (x9: T).(\lambda (H15: (not (eq B x4 Abst))).(\lambda (H16: (pr3 +c x3 (THead (Bind x4) x5 x6))).(\lambda (H17: (pr3 c (THead (Bind x4) x9 +(THead (Flat Appl) (lift (S O) O x8) x7)) t4)).(\lambda (H18: (pr3 c x2 +x8)).(\lambda (H19: (pr3 c x5 x9)).(\lambda (H20: (pr3 (CHead c (Bind x4) x9) +x6 x7)).(or3_intro2 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 +(THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind +Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))) (ex6_6_intro +B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(pr3 c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))) +x4 x5 x6 x7 x8 x9 H15 (pr3_sing c x3 x1 H10 (THead (Bind x4) x5 x6) H16) H17 +(pr3_sing c x2 x0 H9 x8 H18) H19 H20)))))))))))))) H14)) H13))))))))) H7)) +(\lambda (H7: (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T x1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead (Bind +Abbr) u2 t5)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x0 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +z1 t5))))))))).(ex4_4_ind T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (_: T).(eq T x1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(eq T t2 (THead (Bind +Abbr) u2 t5)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x0 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +z1 t5))))))) (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 +(THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind +Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (H8: (eq +T x1 (THead (Bind Abst) x2 x3))).(\lambda (H9: (eq T t2 (THead (Bind Abbr) x4 +x5))).(\lambda (H10: (pr2 c x0 x4)).(\lambda (H11: ((\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) x3 x5))))).(eq_ind_r T (THead (Bind Abst) x2 +x3) (\lambda (t: T).(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T +t4 (THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c t t5)))) (ex4_4 T T T T +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c +(THead (Bind Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c t (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c t (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))))) (let H12 +\def (eq_ind T t2 (\lambda (t: T).(\forall (x6: T).(\forall (x7: T).((eq T t +(THead (Flat Appl) x6 x7)) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: +T).(eq T t4 (THead (Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c x6 u2))) (\lambda (_: T).(\lambda (t5: T).(pr3 c x7 t5)))) (ex4_4 T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 +c (THead (Bind Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c x6 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x7 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x7 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x6 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))))))) H3 +(THead (Bind Abbr) x4 x5) H9) in (let H13 \def (eq_ind T t2 (\lambda (t: +T).(pr3 c t t4)) H2 (THead (Bind Abbr) x4 x5) H9) in (or3_intro1 (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Appl) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 c (THead (Bind Abst) x2 x3) t5)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind +Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THead (Bind Abst) x2 x3) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(pr3 c (THead (Bind Abst) x2 x3) (THead (Bind b) y1 +z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: +T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat +Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))) (ex4_4_intro T T T T +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c +(THead (Bind Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THead (Bind Abst) x2 x3) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +z1 t5))))))) x2 x3 x4 x5 H13 (pr3_pr2 c x0 x4 H10) (pr3_refl c (THead (Bind +Abst) x2 x3)) (\lambda (b: B).(\lambda (u: T).(pr3_pr2 (CHead c (Bind b) u) +x3 x5 (H11 b u)))))))) x1 H8))))))))) H7)) (\lambda (H7: (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T x1 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t2 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))).(ex6_6_ind +B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T x1 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))) +(or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Appl) +u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: +T).(\lambda (t5: T).(pr3 c x1 t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) +t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 +c x0 u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c x1 (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c x1 (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))) (\lambda +(x2: B).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (x6: +T).(\lambda (x7: T).(\lambda (H8: (not (eq B x2 Abst))).(\lambda (H9: (eq T +x1 (THead (Bind x2) x3 x4))).(\lambda (H10: (eq T t2 (THead (Bind x2) x7 +(THead (Flat Appl) (lift (S O) O x6) x5)))).(\lambda (H11: (pr2 c x0 +x6)).(\lambda (H12: (pr2 c x3 x7)).(\lambda (H13: (pr2 (CHead c (Bind x2) x7) +x4 x5)).(eq_ind_r T (THead (Bind x2) x3 x4) (\lambda (t: T).(or3 (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Appl) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 c t t5)))) (ex4_4 T T T T (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind Abbr) u2 t5) t4))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c t (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c t (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))))) (let H14 \def (eq_ind T t2 +(\lambda (t: T).(\forall (x8: T).(\forall (x9: T).((eq T t (THead (Flat Appl) +x8 x9)) \to (or3 (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead +(Flat Appl) u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c x8 u2))) +(\lambda (_: T).(\lambda (t5: T).(pr3 c x9 t5)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind +Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x8 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c x9 (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t5: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t5)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c x9 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr3 c x8 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))))))) H3 +(THead (Bind x2) x7 (THead (Flat Appl) (lift (S O) O x6) x5)) H10) in (let +H15 \def (eq_ind T t2 (\lambda (t: T).(pr3 c t t4)) H2 (THead (Bind x2) x7 +(THead (Flat Appl) (lift (S O) O x6) x5)) H10) in (or3_intro2 (ex3_2 T T +(\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead (Flat Appl) u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))) (\lambda (_: T).(\lambda +(t5: T).(pr3 c (THead (Bind x2) x3 x4) t5)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t5: T).(pr3 c (THead (Bind +Abbr) u2 t5) t4))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr3 c x0 u2))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THead (Bind x2) x3 x4) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t5: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +z1 t5)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(pr3 c (THead (Bind x2) x3 x4) (THead (Bind b) y1 +z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: +T).(\lambda (u2: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat +Appl) (lift (S O) O u2) z2)) t4))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))) (ex6_6_intro B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c +(THead (Bind x2) x3 x4) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2)) +t4))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr3 c x0 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) +y2) z1 z2))))))) x2 x3 x4 x5 x6 x7 H8 (pr3_refl c (THead (Bind x2) x3 x4)) +H15 (pr3_pr2 c x0 x6 H11) (pr3_pr2 c x3 x7 H12) (pr3_pr2 (CHead c (Bind x2) +x7) x4 x5 H13))))) x1 H9))))))))))))) H7)) H6)))))))))))) y x H0))))) H))))). + +theorem pr3_gen_bind: + \forall (b: B).((not (eq B b Abst)) \to (\forall (c: C).(\forall (u1: +T).(\forall (t1: T).(\forall (x: T).((pr3 c (THead (Bind b) u1 t1) x) \to (or +(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind b) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr3 (CHead c (Bind b) u1) t1 t2)))) (pr3 (CHead c (Bind +b) u1) t1 (lift (S O) O x))))))))) +\def + \lambda (b: B).(B_ind (\lambda (b0: B).((not (eq B b0 Abst)) \to (\forall +(c: C).(\forall (u1: T).(\forall (t1: T).(\forall (x: T).((pr3 c (THead (Bind +b0) u1 t1) x) \to (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x +(THead (Bind b0) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind b0) u1) t1 t2)))) (pr3 +(CHead c (Bind b0) u1) t1 (lift (S O) O x)))))))))) (\lambda (_: (not (eq B +Abbr Abst))).(\lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda (x: +T).(\lambda (H0: (pr3 c (THead (Bind Abbr) u1 t1) x)).(let H1 \def +(pr3_gen_abbr c u1 t1 x H0) in (or_ind (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) +u1) t1 t2)))) (pr3 (CHead c (Bind Abbr) u1) t1 (lift (S O) O x)) (or (ex3_2 T +T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind Abbr) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda +(t2: T).(pr3 (CHead c (Bind Abbr) u1) t1 t2)))) (pr3 (CHead c (Bind Abbr) u1) +t1 (lift (S O) O x))) (\lambda (H2: (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 +c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) u1) t1 +t2))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind +Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) u1) t1 t2))) (or (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind Abbr) u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda +(t2: T).(pr3 (CHead c (Bind Abbr) u1) t1 t2)))) (pr3 (CHead c (Bind Abbr) u1) +t1 (lift (S O) O x))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H3: (eq T x +(THead (Bind Abbr) x0 x1))).(\lambda (H4: (pr3 c u1 x0)).(\lambda (H5: (pr3 +(CHead c (Bind Abbr) u1) t1 x1)).(or_introl (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T x (THead (Bind Abbr) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 +(CHead c (Bind Abbr) u1) t1 t2)))) (pr3 (CHead c (Bind Abbr) u1) t1 (lift (S +O) O x)) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead +(Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) u1) t1 t2))) x0 x1 +H3 H4 H5))))))) H2)) (\lambda (H2: (pr3 (CHead c (Bind Abbr) u1) t1 (lift (S +O) O x))).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x +(THead (Bind Abbr) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Abbr) u1) t1 t2)))) (pr3 +(CHead c (Bind Abbr) u1) t1 (lift (S O) O x)) H2)) H1)))))))) (\lambda (H: +(not (eq B Abst Abst))).(\lambda (c: C).(\lambda (u1: T).(\lambda (t1: +T).(\lambda (x: T).(\lambda (_: (pr3 c (THead (Bind Abst) u1 t1) x)).(let H1 +\def (match (H (refl_equal B Abst)) in False return (\lambda (_: False).(or +(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind Abst) u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(pr3 (CHead c (Bind Abst) u1) t1 t2)))) (pr3 (CHead c +(Bind Abst) u1) t1 (lift (S O) O x)))) with []) in H1))))))) (\lambda (_: +(not (eq B Void Abst))).(\lambda (c: C).(\lambda (u1: T).(\lambda (t1: +T).(\lambda (x: T).(\lambda (H0: (pr3 c (THead (Bind Void) u1 t1) x)).(let H1 +\def (pr3_gen_void c u1 t1 x H0) in (or_ind (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(\forall +(b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) u) t1 t2)))))) (pr3 (CHead c +(Bind Void) u1) t1 (lift (S O) O x)) (or (ex3_2 T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Void) +u1) t1 t2)))) (pr3 (CHead c (Bind Void) u1) t1 (lift (S O) O x))) (\lambda +(H2: (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead (Bind Void) +u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(\forall (b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) +u) t1 t2))))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t2: T).(eq T x +(THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(\forall (b0: B).(\forall (u: T).(pr3 (CHead +c (Bind b0) u) t1 t2))))) (or (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 +c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Void) u1) t1 +t2)))) (pr3 (CHead c (Bind Void) u1) t1 (lift (S O) O x))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H3: (eq T x (THead (Bind Void) x0 +x1))).(\lambda (H4: (pr3 c u1 x0)).(\lambda (H5: ((\forall (b0: B).(\forall +(u: T).(pr3 (CHead c (Bind b0) u) t1 x1))))).(or_introl (ex3_2 T T (\lambda +(u2: T).(\lambda (t2: T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 +(CHead c (Bind Void) u1) t1 t2)))) (pr3 (CHead c (Bind Void) u1) t1 (lift (S +O) O x)) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead +(Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Void) u1) t1 t2))) x0 x1 +H3 H4 (H5 Void u1)))))))) H2)) (\lambda (H2: (pr3 (CHead c (Bind Void) u1) t1 +(lift (S O) O x))).(or_intror (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead (Bind Void) u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(pr3 +c u1 u2))) (\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind Void) u1) t1 +t2)))) (pr3 (CHead c (Bind Void) u1) t1 (lift (S O) O x)) H2)) H1)))))))) b). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/iso.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/iso.ma new file mode 100644 index 000000000..1f628e9b2 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/iso.ma @@ -0,0 +1,1136 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr3/iso". + +include "pr3/fwd.ma". + +include "iso/props.ma". + +include "tlist/props.ma". + +theorem pr3_iso_appls_abbr: + \forall (c: C).(\forall (d: C).(\forall (w: T).(\forall (i: nat).((getl i c +(CHead d (Bind Abbr) w)) \to (\forall (vs: TList).(let u1 \def (THeads (Flat +Appl) vs (TLRef i)) in (\forall (u2: T).((pr3 c u1 u2) \to ((((iso u1 u2) \to +(\forall (P: Prop).P))) \to (pr3 c (THeads (Flat Appl) vs (lift (S i) O w)) +u2)))))))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (w: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead d (Bind Abbr) w))).(\lambda (vs: TList).(TList_ind +(\lambda (t: TList).(let u1 \def (THeads (Flat Appl) t (TLRef i)) in (\forall +(u2: T).((pr3 c u1 u2) \to ((((iso u1 u2) \to (\forall (P: Prop).P))) \to +(pr3 c (THeads (Flat Appl) t (lift (S i) O w)) u2)))))) (\lambda (u2: +T).(\lambda (H0: (pr3 c (TLRef i) u2)).(\lambda (H1: (((iso (TLRef i) u2) \to +(\forall (P: Prop).P)))).(let H2 \def (pr3_gen_lref c u2 i H0) in (or_ind (eq +T u2 (TLRef i)) (ex3_3 C T T (\lambda (d0: C).(\lambda (u: T).(\lambda (_: +T).(getl i c (CHead d0 (Bind Abbr) u))))) (\lambda (d0: C).(\lambda (u: +T).(\lambda (v: T).(pr3 d0 u v)))) (\lambda (_: C).(\lambda (_: T).(\lambda +(v: T).(eq T u2 (lift (S i) O v)))))) (pr3 c (lift (S i) O w) u2) (\lambda +(H3: (eq T u2 (TLRef i))).(let H4 \def (eq_ind T u2 (\lambda (t: T).((iso +(TLRef i) t) \to (\forall (P: Prop).P))) H1 (TLRef i) H3) in (eq_ind_r T +(TLRef i) (\lambda (t: T).(pr3 c (lift (S i) O w) t)) (H4 (iso_refl (TLRef +i)) (pr3 c (lift (S i) O w) (TLRef i))) u2 H3))) (\lambda (H3: (ex3_3 C T T +(\lambda (d0: C).(\lambda (u: T).(\lambda (_: T).(getl i c (CHead d0 (Bind +Abbr) u))))) (\lambda (d0: C).(\lambda (u: T).(\lambda (v: T).(pr3 d0 u v)))) +(\lambda (_: C).(\lambda (_: T).(\lambda (v: T).(eq T u2 (lift (S i) O +v))))))).(ex3_3_ind C T T (\lambda (d0: C).(\lambda (u: T).(\lambda (_: +T).(getl i c (CHead d0 (Bind Abbr) u))))) (\lambda (d0: C).(\lambda (u: +T).(\lambda (v: T).(pr3 d0 u v)))) (\lambda (_: C).(\lambda (_: T).(\lambda +(v: T).(eq T u2 (lift (S i) O v))))) (pr3 c (lift (S i) O w) u2) (\lambda +(x0: C).(\lambda (x1: T).(\lambda (x2: T).(\lambda (H4: (getl i c (CHead x0 +(Bind Abbr) x1))).(\lambda (H5: (pr3 x0 x1 x2)).(\lambda (H6: (eq T u2 (lift +(S i) O x2))).(let H7 \def (eq_ind T u2 (\lambda (t: T).((iso (TLRef i) t) +\to (\forall (P: Prop).P))) H1 (lift (S i) O x2) H6) in (eq_ind_r T (lift (S +i) O x2) (\lambda (t: T).(pr3 c (lift (S i) O w) t)) (let H8 \def (eq_ind C +(CHead d (Bind Abbr) w) (\lambda (c0: C).(getl i c c0)) H (CHead x0 (Bind +Abbr) x1) (getl_mono c (CHead d (Bind Abbr) w) i H (CHead x0 (Bind Abbr) x1) +H4)) in (let H9 \def (f_equal C C (\lambda (e: C).(match e in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) \Rightarrow +c0])) (CHead d (Bind Abbr) w) (CHead x0 (Bind Abbr) x1) (getl_mono c (CHead d +(Bind Abbr) w) i H (CHead x0 (Bind Abbr) x1) H4)) in ((let H10 \def (f_equal +C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow w | (CHead _ _ t) \Rightarrow t])) (CHead d (Bind Abbr) w) (CHead +x0 (Bind Abbr) x1) (getl_mono c (CHead d (Bind Abbr) w) i H (CHead x0 (Bind +Abbr) x1) H4)) in (\lambda (H11: (eq C d x0)).(let H12 \def (eq_ind_r T x1 +(\lambda (t: T).(getl i c (CHead x0 (Bind Abbr) t))) H8 w H10) in (let H13 +\def (eq_ind_r T x1 (\lambda (t: T).(pr3 x0 t x2)) H5 w H10) in (let H14 \def +(eq_ind_r C x0 (\lambda (c0: C).(getl i c (CHead c0 (Bind Abbr) w))) H12 d +H11) in (let H15 \def (eq_ind_r C x0 (\lambda (c0: C).(pr3 c0 w x2)) H13 d +H11) in (pr3_lift c d (S i) O (getl_drop Abbr c d w i H14) w x2 H15))))))) +H9))) u2 H6)))))))) H3)) H2))))) (\lambda (t: T).(\lambda (t0: +TList).(\lambda (H0: ((\forall (u2: T).((pr3 c (THeads (Flat Appl) t0 (TLRef +i)) u2) \to ((((iso (THeads (Flat Appl) t0 (TLRef i)) u2) \to (\forall (P: +Prop).P))) \to (pr3 c (THeads (Flat Appl) t0 (lift (S i) O w)) +u2)))))).(\lambda (u2: T).(\lambda (H1: (pr3 c (THead (Flat Appl) t (THeads +(Flat Appl) t0 (TLRef i))) u2)).(\lambda (H2: (((iso (THead (Flat Appl) t +(THeads (Flat Appl) t0 (TLRef i))) u2) \to (\forall (P: Prop).P)))).(let H3 +\def (pr3_gen_appl c t (THeads (Flat Appl) t0 (TLRef i)) u2 H1) in (or3_ind +(ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T u2 (THead (Flat Appl) u3 +t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c t u3))) (\lambda (_: +T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) t2)))) (ex4_4 T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 +c (THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u3: T).(\lambda (_: T).(pr3 c t u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +z1 t2)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) (THead (Bind +b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead +(Flat Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c t +u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))) (pr3 c (THead (Flat Appl) t +(THeads (Flat Appl) t0 (lift (S i) O w))) u2) (\lambda (H4: (ex3_2 T T +(\lambda (u3: T).(\lambda (t2: T).(eq T u2 (THead (Flat Appl) u3 t2)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c t u3))) (\lambda (_: T).(\lambda (t2: +T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) t2))))).(ex3_2_ind T T (\lambda +(u3: T).(\lambda (t2: T).(eq T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c t u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c +(THeads (Flat Appl) t0 (TLRef i)) t2))) (pr3 c (THead (Flat Appl) t (THeads +(Flat Appl) t0 (lift (S i) O w))) u2) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H5: (eq T u2 (THead (Flat Appl) x0 x1))).(\lambda (_: (pr3 c t +x0)).(\lambda (_: (pr3 c (THeads (Flat Appl) t0 (TLRef i)) x1)).(let H8 \def +(eq_ind T u2 (\lambda (t1: T).((iso (THead (Flat Appl) t (THeads (Flat Appl) +t0 (TLRef i))) t1) \to (\forall (P: Prop).P))) H2 (THead (Flat Appl) x0 x1) +H5) in (eq_ind_r T (THead (Flat Appl) x0 x1) (\lambda (t1: T).(pr3 c (THead +(Flat Appl) t (THeads (Flat Appl) t0 (lift (S i) O w))) t1)) (H8 (iso_head t +x0 (THeads (Flat Appl) t0 (TLRef i)) x1 (Flat Appl)) (pr3 c (THead (Flat +Appl) t (THeads (Flat Appl) t0 (lift (S i) O w))) (THead (Flat Appl) x0 x1))) +u2 H5))))))) H4)) (\lambda (H4: (ex4_4 T T T T (\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c (THead (Bind Abbr) u3 t2) u2))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c t +u3))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) (THead (Bind Abst) y1 z1)))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2))))))))).(ex4_4_ind T +T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 +c (THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u3: T).(\lambda (_: T).(pr3 c t u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) +z1 t2))))))) (pr3 c (THead (Flat Appl) t (THeads (Flat Appl) t0 (lift (S i) O +w))) u2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (H5: (pr3 c (THead (Bind Abbr) x2 x3) u2)).(\lambda (H6: (pr3 c t +x2)).(\lambda (H7: (pr3 c (THeads (Flat Appl) t0 (TLRef i)) (THead (Bind +Abst) x0 x1))).(\lambda (H8: ((\forall (b: B).(\forall (u: T).(pr3 (CHead c +(Bind b) u) x1 x3))))).(pr3_t (THead (Bind Abbr) t x1) (THead (Flat Appl) t +(THeads (Flat Appl) t0 (lift (S i) O w))) c (pr3_t (THead (Flat Appl) t +(THead (Bind Abst) x0 x1)) (THead (Flat Appl) t (THeads (Flat Appl) t0 (lift +(S i) O w))) c (pr3_thin_dx c (THeads (Flat Appl) t0 (lift (S i) O w)) (THead +(Bind Abst) x0 x1) (H0 (THead (Bind Abst) x0 x1) H7 (\lambda (H9: (iso +(THeads (Flat Appl) t0 (TLRef i)) (THead (Bind Abst) x0 x1))).(\lambda (P: +Prop).(iso_flats_lref_bind_false Appl Abst i x0 x1 t0 H9 P)))) t Appl) (THead +(Bind Abbr) t x1) (pr3_pr2 c (THead (Flat Appl) t (THead (Bind Abst) x0 x1)) +(THead (Bind Abbr) t x1) (pr2_free c (THead (Flat Appl) t (THead (Bind Abst) +x0 x1)) (THead (Bind Abbr) t x1) (pr0_beta x0 t t (pr0_refl t) x1 x1 +(pr0_refl x1))))) u2 (pr3_t (THead (Bind Abbr) x2 x3) (THead (Bind Abbr) t +x1) c (pr3_head_12 c t x2 H6 (Bind Abbr) x1 x3 (H8 Abbr x2)) u2 H5)))))))))) +H4)) (\lambda (H4: (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(_: T).(pr3 c t u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))).(ex6_6_ind +B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(pr3 c (THeads (Flat Appl) t0 (TLRef i)) (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda +(u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift +(S O) O u3) z2)) u2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c t u3))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 +(CHead c (Bind b) y2) z1 z2))))))) (pr3 c (THead (Flat Appl) t (THeads (Flat +Appl) t0 (lift (S i) O w))) u2) (\lambda (x0: B).(\lambda (x1: T).(\lambda +(x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (H5: (not +(eq B x0 Abst))).(\lambda (H6: (pr3 c (THeads (Flat Appl) t0 (TLRef i)) +(THead (Bind x0) x1 x2))).(\lambda (H7: (pr3 c (THead (Bind x0) x5 (THead +(Flat Appl) (lift (S O) O x4) x3)) u2)).(\lambda (H8: (pr3 c t x4)).(\lambda +(H9: (pr3 c x1 x5)).(\lambda (H10: (pr3 (CHead c (Bind x0) x5) x2 x3)).(pr3_t +(THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O x4) x2)) (THead (Flat +Appl) t (THeads (Flat Appl) t0 (lift (S i) O w))) c (pr3_t (THead (Bind x0) +x1 (THead (Flat Appl) (lift (S O) O t) x2)) (THead (Flat Appl) t (THeads +(Flat Appl) t0 (lift (S i) O w))) c (pr3_t (THead (Flat Appl) t (THead (Bind +x0) x1 x2)) (THead (Flat Appl) t (THeads (Flat Appl) t0 (lift (S i) O w))) c +(pr3_thin_dx c (THeads (Flat Appl) t0 (lift (S i) O w)) (THead (Bind x0) x1 +x2) (H0 (THead (Bind x0) x1 x2) H6 (\lambda (H11: (iso (THeads (Flat Appl) t0 +(TLRef i)) (THead (Bind x0) x1 x2))).(\lambda (P: +Prop).(iso_flats_lref_bind_false Appl x0 i x1 x2 t0 H11 P)))) t Appl) (THead +(Bind x0) x1 (THead (Flat Appl) (lift (S O) O t) x2)) (pr3_pr2 c (THead (Flat +Appl) t (THead (Bind x0) x1 x2)) (THead (Bind x0) x1 (THead (Flat Appl) (lift +(S O) O t) x2)) (pr2_free c (THead (Flat Appl) t (THead (Bind x0) x1 x2)) +(THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O t) x2)) (pr0_upsilon x0 +H5 t t (pr0_refl t) x1 x1 (pr0_refl x1) x2 x2 (pr0_refl x2))))) (THead (Bind +x0) x1 (THead (Flat Appl) (lift (S O) O x4) x2)) (pr3_head_12 c x1 x1 +(pr3_refl c x1) (Bind x0) (THead (Flat Appl) (lift (S O) O t) x2) (THead +(Flat Appl) (lift (S O) O x4) x2) (pr3_head_12 (CHead c (Bind x0) x1) (lift +(S O) O t) (lift (S O) O x4) (pr3_lift (CHead c (Bind x0) x1) c (S O) O +(drop_drop (Bind x0) O c c (drop_refl c) x1) t x4 H8) (Flat Appl) x2 x2 +(pr3_refl (CHead (CHead c (Bind x0) x1) (Flat Appl) (lift (S O) O x4)) x2)))) +u2 (pr3_t (THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) O x4) x3)) +(THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O x4) x2)) c (pr3_head_12 +c x1 x5 H9 (Bind x0) (THead (Flat Appl) (lift (S O) O x4) x2) (THead (Flat +Appl) (lift (S O) O x4) x3) (pr3_thin_dx (CHead c (Bind x0) x5) x2 x3 H10 +(lift (S O) O x4) Appl)) u2 H7)))))))))))))) H4)) H3)))))))) vs)))))). + +theorem pr3_iso_appls_cast: + \forall (c: C).(\forall (v: T).(\forall (t: T).(\forall (vs: TList).(let u1 +\def (THeads (Flat Appl) vs (THead (Flat Cast) v t)) in (\forall (u2: +T).((pr3 c u1 u2) \to ((((iso u1 u2) \to (\forall (P: Prop).P))) \to (pr3 c +(THeads (Flat Appl) vs t) u2)))))))) +\def + \lambda (c: C).(\lambda (v: T).(\lambda (t: T).(\lambda (vs: +TList).(TList_ind (\lambda (t0: TList).(let u1 \def (THeads (Flat Appl) t0 +(THead (Flat Cast) v t)) in (\forall (u2: T).((pr3 c u1 u2) \to ((((iso u1 +u2) \to (\forall (P: Prop).P))) \to (pr3 c (THeads (Flat Appl) t0 t) u2)))))) +(\lambda (u2: T).(\lambda (H: (pr3 c (THead (Flat Cast) v t) u2)).(\lambda +(H0: (((iso (THead (Flat Cast) v t) u2) \to (\forall (P: Prop).P)))).(let H1 +\def (pr3_gen_cast c v t u2 H) in (or_ind (ex3_2 T T (\lambda (u3: +T).(\lambda (t2: T).(eq T u2 (THead (Flat Cast) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c v u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c t +t2)))) (pr3 c t u2) (pr3 c t u2) (\lambda (H2: (ex3_2 T T (\lambda (u3: +T).(\lambda (t2: T).(eq T u2 (THead (Flat Cast) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c v u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c t +t2))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t2: T).(eq T u2 (THead +(Flat Cast) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c v u3))) +(\lambda (_: T).(\lambda (t2: T).(pr3 c t t2))) (pr3 c t u2) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H3: (eq T u2 (THead (Flat Cast) x0 +x1))).(\lambda (_: (pr3 c v x0)).(\lambda (_: (pr3 c t x1)).(let H6 \def +(eq_ind T u2 (\lambda (t0: T).((iso (THead (Flat Cast) v t) t0) \to (\forall +(P: Prop).P))) H0 (THead (Flat Cast) x0 x1) H3) in (eq_ind_r T (THead (Flat +Cast) x0 x1) (\lambda (t0: T).(pr3 c t t0)) (H6 (iso_head v x0 t x1 (Flat +Cast)) (pr3 c t (THead (Flat Cast) x0 x1))) u2 H3))))))) H2)) (\lambda (H2: +(pr3 c t u2)).H2) H1))))) (\lambda (t0: T).(\lambda (t1: TList).(\lambda (H: +((\forall (u2: T).((pr3 c (THeads (Flat Appl) t1 (THead (Flat Cast) v t)) u2) +\to ((((iso (THeads (Flat Appl) t1 (THead (Flat Cast) v t)) u2) \to (\forall +(P: Prop).P))) \to (pr3 c (THeads (Flat Appl) t1 t) u2)))))).(\lambda (u2: +T).(\lambda (H0: (pr3 c (THead (Flat Appl) t0 (THeads (Flat Appl) t1 (THead +(Flat Cast) v t))) u2)).(\lambda (H1: (((iso (THead (Flat Appl) t0 (THeads +(Flat Appl) t1 (THead (Flat Cast) v t))) u2) \to (\forall (P: +Prop).P)))).(let H2 \def (pr3_gen_appl c t0 (THeads (Flat Appl) t1 (THead +(Flat Cast) v t)) u2 H0) in (or3_ind (ex3_2 T T (\lambda (u3: T).(\lambda +(t2: T).(eq T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: +T).(pr3 c t0 u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c (THeads (Flat +Appl) t1 (THead (Flat Cast) v t)) t2)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c (THead (Bind +Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (_: T).(pr3 c t0 u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t1 (THead (Flat +Cast) v t)) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat +Appl) t1 (THead (Flat Cast) v t)) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u3: T).(\lambda +(y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u3) z2)) +u2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(pr3 c t0 u3))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) +y2) z1 z2)))))))) (pr3 c (THead (Flat Appl) t0 (THeads (Flat Appl) t1 t)) u2) +(\lambda (H3: (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T u2 (THead +(Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c t0 u3))) +(\lambda (_: T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) t1 (THead (Flat +Cast) v t)) t2))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t2: T).(eq T u2 +(THead (Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c t0 u3))) +(\lambda (_: T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) t1 (THead (Flat +Cast) v t)) t2))) (pr3 c (THead (Flat Appl) t0 (THeads (Flat Appl) t1 t)) u2) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T u2 (THead (Flat Appl) +x0 x1))).(\lambda (_: (pr3 c t0 x0)).(\lambda (_: (pr3 c (THeads (Flat Appl) +t1 (THead (Flat Cast) v t)) x1)).(let H7 \def (eq_ind T u2 (\lambda (t2: +T).((iso (THead (Flat Appl) t0 (THeads (Flat Appl) t1 (THead (Flat Cast) v +t))) t2) \to (\forall (P: Prop).P))) H1 (THead (Flat Appl) x0 x1) H4) in +(eq_ind_r T (THead (Flat Appl) x0 x1) (\lambda (t2: T).(pr3 c (THead (Flat +Appl) t0 (THeads (Flat Appl) t1 t)) t2)) (H7 (iso_head t0 x0 (THeads (Flat +Appl) t1 (THead (Flat Cast) v t)) x1 (Flat Appl)) (pr3 c (THead (Flat Appl) +t0 (THeads (Flat Appl) t1 t)) (THead (Flat Appl) x0 x1))) u2 H4))))))) H3)) +(\lambda (H3: (ex4_4 T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (t2: T).(pr3 c (THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c t0 u3))))) +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c +(THeads (Flat Appl) t1 (THead (Flat Cast) v t)) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: +T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 +t2))))))))).(ex4_4_ind T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (t2: T).(pr3 c (THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c t0 u3))))) +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c +(THeads (Flat Appl) t1 (THead (Flat Cast) v t)) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: +T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2))))))) +(pr3 c (THead (Flat Appl) t0 (THeads (Flat Appl) t1 t)) u2) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H4: (pr3 c +(THead (Bind Abbr) x2 x3) u2)).(\lambda (H5: (pr3 c t0 x2)).(\lambda (H6: +(pr3 c (THeads (Flat Appl) t1 (THead (Flat Cast) v t)) (THead (Bind Abst) x0 +x1))).(\lambda (H7: ((\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) +u) x1 x3))))).(pr3_t (THead (Bind Abbr) t0 x1) (THead (Flat Appl) t0 (THeads +(Flat Appl) t1 t)) c (pr3_t (THead (Flat Appl) t0 (THead (Bind Abst) x0 x1)) +(THead (Flat Appl) t0 (THeads (Flat Appl) t1 t)) c (pr3_thin_dx c (THeads +(Flat Appl) t1 t) (THead (Bind Abst) x0 x1) (H (THead (Bind Abst) x0 x1) H6 +(\lambda (H8: (iso (THeads (Flat Appl) t1 (THead (Flat Cast) v t)) (THead +(Bind Abst) x0 x1))).(\lambda (P: Prop).(iso_flats_flat_bind_false Appl Cast +Abst x0 v x1 t t1 H8 P)))) t0 Appl) (THead (Bind Abbr) t0 x1) (pr3_pr2 c +(THead (Flat Appl) t0 (THead (Bind Abst) x0 x1)) (THead (Bind Abbr) t0 x1) +(pr2_free c (THead (Flat Appl) t0 (THead (Bind Abst) x0 x1)) (THead (Bind +Abbr) t0 x1) (pr0_beta x0 t0 t0 (pr0_refl t0) x1 x1 (pr0_refl x1))))) u2 +(pr3_t (THead (Bind Abbr) x2 x3) (THead (Bind Abbr) t0 x1) c (pr3_head_12 c +t0 x2 H5 (Bind Abbr) x1 x3 (H7 Abbr x2)) u2 H4)))))))))) H3)) (\lambda (H3: +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(pr3 c (THeads (Flat Appl) t1 (THead (Flat Cast) v t)) (THead (Bind b) +y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: +T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat +Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c t0 +u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))).(ex6_6_ind B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c +(THeads (Flat Appl) t1 (THead (Flat Cast) v t)) (THead (Bind b) y1 z1)))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda +(u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift +(S O) O u3) z2)) u2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c t0 u3))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 +(CHead c (Bind b) y2) z1 z2))))))) (pr3 c (THead (Flat Appl) t0 (THeads (Flat +Appl) t1 t)) u2) (\lambda (x0: B).(\lambda (x1: T).(\lambda (x2: T).(\lambda +(x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (H4: (not (eq B x0 +Abst))).(\lambda (H5: (pr3 c (THeads (Flat Appl) t1 (THead (Flat Cast) v t)) +(THead (Bind x0) x1 x2))).(\lambda (H6: (pr3 c (THead (Bind x0) x5 (THead +(Flat Appl) (lift (S O) O x4) x3)) u2)).(\lambda (H7: (pr3 c t0 x4)).(\lambda +(H8: (pr3 c x1 x5)).(\lambda (H9: (pr3 (CHead c (Bind x0) x5) x2 x3)).(pr3_t +(THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O x4) x2)) (THead (Flat +Appl) t0 (THeads (Flat Appl) t1 t)) c (pr3_t (THead (Bind x0) x1 (THead (Flat +Appl) (lift (S O) O t0) x2)) (THead (Flat Appl) t0 (THeads (Flat Appl) t1 t)) +c (pr3_t (THead (Flat Appl) t0 (THead (Bind x0) x1 x2)) (THead (Flat Appl) t0 +(THeads (Flat Appl) t1 t)) c (pr3_thin_dx c (THeads (Flat Appl) t1 t) (THead +(Bind x0) x1 x2) (H (THead (Bind x0) x1 x2) H5 (\lambda (H10: (iso (THeads +(Flat Appl) t1 (THead (Flat Cast) v t)) (THead (Bind x0) x1 x2))).(\lambda +(P: Prop).(iso_flats_flat_bind_false Appl Cast x0 x1 v x2 t t1 H10 P)))) t0 +Appl) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O t0) x2)) (pr3_pr2 +c (THead (Flat Appl) t0 (THead (Bind x0) x1 x2)) (THead (Bind x0) x1 (THead +(Flat Appl) (lift (S O) O t0) x2)) (pr2_free c (THead (Flat Appl) t0 (THead +(Bind x0) x1 x2)) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O t0) +x2)) (pr0_upsilon x0 H4 t0 t0 (pr0_refl t0) x1 x1 (pr0_refl x1) x2 x2 +(pr0_refl x2))))) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O x4) +x2)) (pr3_head_12 c x1 x1 (pr3_refl c x1) (Bind x0) (THead (Flat Appl) (lift +(S O) O t0) x2) (THead (Flat Appl) (lift (S O) O x4) x2) (pr3_head_12 (CHead +c (Bind x0) x1) (lift (S O) O t0) (lift (S O) O x4) (pr3_lift (CHead c (Bind +x0) x1) c (S O) O (drop_drop (Bind x0) O c c (drop_refl c) x1) t0 x4 H7) +(Flat Appl) x2 x2 (pr3_refl (CHead (CHead c (Bind x0) x1) (Flat Appl) (lift +(S O) O x4)) x2)))) u2 (pr3_t (THead (Bind x0) x5 (THead (Flat Appl) (lift (S +O) O x4) x3)) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O x4) x2)) c +(pr3_head_12 c x1 x5 H8 (Bind x0) (THead (Flat Appl) (lift (S O) O x4) x2) +(THead (Flat Appl) (lift (S O) O x4) x3) (pr3_thin_dx (CHead c (Bind x0) x5) +x2 x3 H9 (lift (S O) O x4) Appl)) u2 H6)))))))))))))) H3)) H2)))))))) vs)))). + +theorem pr3_iso_appl_bind: + \forall (b: B).((not (eq B b Abst)) \to (\forall (v1: T).(\forall (v2: +T).(\forall (t: T).(let u1 \def (THead (Flat Appl) v1 (THead (Bind b) v2 t)) +in (\forall (c: C).(\forall (u2: T).((pr3 c u1 u2) \to ((((iso u1 u2) \to +(\forall (P: Prop).P))) \to (pr3 c (THead (Bind b) v2 (THead (Flat Appl) +(lift (S O) O v1) t)) u2)))))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda (v1: T).(\lambda +(v2: T).(\lambda (t: T).(\lambda (c: C).(\lambda (u2: T).(\lambda (H0: (pr3 c +(THead (Flat Appl) v1 (THead (Bind b) v2 t)) u2)).(\lambda (H1: (((iso (THead +(Flat Appl) v1 (THead (Bind b) v2 t)) u2) \to (\forall (P: Prop).P)))).(let +H2 \def (pr3_gen_appl c v1 (THead (Bind b) v2 t) u2 H0) in (or3_ind (ex3_2 T +T (\lambda (u3: T).(\lambda (t2: T).(eq T u2 (THead (Flat Appl) u3 t2)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c v1 u3))) (\lambda (_: T).(\lambda +(t2: T).(pr3 c (THead (Bind b) v2 t) t2)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c (THead (Bind +Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (_: T).(pr3 c v1 u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THead (Bind b) v2 t) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(t2: T).(\forall (b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) u) z1 +t2)))))))) (ex6_6 B T T T T T (\lambda (b0: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b0 Abst)))))))) +(\lambda (b0: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(pr3 c (THead (Bind b) v2 t) (THead (Bind b0) y1 +z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: +T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b0) y2 (THead (Flat +Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c v1 +u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b0: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 (CHead c (Bind b0) y2) z1 z2)))))))) (pr3 c (THead (Bind b) v2 +(THead (Flat Appl) (lift (S O) O v1) t)) u2) (\lambda (H3: (ex3_2 T T +(\lambda (u3: T).(\lambda (t2: T).(eq T u2 (THead (Flat Appl) u3 t2)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c v1 u3))) (\lambda (_: T).(\lambda +(t2: T).(pr3 c (THead (Bind b) v2 t) t2))))).(ex3_2_ind T T (\lambda (u3: +T).(\lambda (t2: T).(eq T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c v1 u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c +(THead (Bind b) v2 t) t2))) (pr3 c (THead (Bind b) v2 (THead (Flat Appl) +(lift (S O) O v1) t)) u2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq +T u2 (THead (Flat Appl) x0 x1))).(\lambda (_: (pr3 c v1 x0)).(\lambda (_: +(pr3 c (THead (Bind b) v2 t) x1)).(let H7 \def (eq_ind T u2 (\lambda (t0: +T).((iso (THead (Flat Appl) v1 (THead (Bind b) v2 t)) t0) \to (\forall (P: +Prop).P))) H1 (THead (Flat Appl) x0 x1) H4) in (eq_ind_r T (THead (Flat Appl) +x0 x1) (\lambda (t0: T).(pr3 c (THead (Bind b) v2 (THead (Flat Appl) (lift (S +O) O v1) t)) t0)) (H7 (iso_head v1 x0 (THead (Bind b) v2 t) x1 (Flat Appl)) +(pr3 c (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O v1) t)) (THead +(Flat Appl) x0 x1))) u2 H4))))))) H3)) (\lambda (H3: (ex4_4 T T T T (\lambda +(_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c (THead (Bind +Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (_: T).(pr3 c v1 u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THead (Bind b) v2 t) (THead (Bind +Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(t2: T).(\forall (b0: B).(\forall (u: T).(pr3 (CHead c (Bind b0) u) z1 +t2))))))))).(ex4_4_ind T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (t2: T).(pr3 c (THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c v1 u3))))) +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c +(THead (Bind b) v2 t) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b0: B).(\forall (u: +T).(pr3 (CHead c (Bind b0) u) z1 t2))))))) (pr3 c (THead (Bind b) v2 (THead +(Flat Appl) (lift (S O) O v1) t)) u2) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H4: (pr3 c (THead (Bind Abbr) +x2 x3) u2)).(\lambda (H5: (pr3 c v1 x2)).(\lambda (H6: (pr3 c (THead (Bind b) +v2 t) (THead (Bind Abst) x0 x1))).(\lambda (H7: ((\forall (b0: B).(\forall +(u: T).(pr3 (CHead c (Bind b0) u) x1 x3))))).(pr3_t (THead (Bind Abbr) x2 x3) +(THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O v1) t)) c (let H_x \def +(pr3_gen_bind b H c v2 t (THead (Bind Abst) x0 x1) H6) in (let H8 \def H_x in +(or_ind (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead (Bind Abst) +x0 x1) (THead (Bind b) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c v2 +u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 (CHead c (Bind b) v2) t t2)))) +(pr3 (CHead c (Bind b) v2) t (lift (S O) O (THead (Bind Abst) x0 x1))) (pr3 c +(THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O v1) t)) (THead (Bind +Abbr) x2 x3)) (\lambda (H9: (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq +T (THead (Bind Abst) x0 x1) (THead (Bind b) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c v2 u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 +(CHead c (Bind b) v2) t t2))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t2: +T).(eq T (THead (Bind Abst) x0 x1) (THead (Bind b) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c v2 u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 +(CHead c (Bind b) v2) t t2))) (pr3 c (THead (Bind b) v2 (THead (Flat Appl) +(lift (S O) O v1) t)) (THead (Bind Abbr) x2 x3)) (\lambda (x4: T).(\lambda +(x5: T).(\lambda (H10: (eq T (THead (Bind Abst) x0 x1) (THead (Bind b) x4 +x5))).(\lambda (H11: (pr3 c v2 x4)).(\lambda (H12: (pr3 (CHead c (Bind b) v2) +t x5)).(let H13 \def (f_equal T B (\lambda (e: T).(match e in T return +(\lambda (_: T).B) with [(TSort _) \Rightarrow Abst | (TLRef _) \Rightarrow +Abst | (THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).B) with +[(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow Abst])])) (THead (Bind Abst) +x0 x1) (THead (Bind b) x4 x5) H10) in ((let H14 \def (f_equal T T (\lambda +(e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 +| (TLRef _) \Rightarrow x0 | (THead _ t0 _) \Rightarrow t0])) (THead (Bind +Abst) x0 x1) (THead (Bind b) x4 x5) H10) in ((let H15 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow x1 | (TLRef _) \Rightarrow x1 | (THead _ _ t0) \Rightarrow t0])) +(THead (Bind Abst) x0 x1) (THead (Bind b) x4 x5) H10) in (\lambda (H16: (eq T +x0 x4)).(\lambda (H17: (eq B Abst b)).(let H18 \def (eq_ind_r T x5 (\lambda +(t0: T).(pr3 (CHead c (Bind b) v2) t t0)) H12 x1 H15) in (let H19 \def +(eq_ind_r T x4 (\lambda (t0: T).(pr3 c v2 t0)) H11 x0 H16) in (let H20 \def +(eq_ind_r B b (\lambda (b0: B).(pr3 (CHead c (Bind b0) v2) t x1)) H18 Abst +H17) in (let H21 \def (eq_ind_r B b (\lambda (b0: B).(not (eq B b0 Abst))) H +Abst H17) in (eq_ind B Abst (\lambda (b0: B).(pr3 c (THead (Bind b0) v2 +(THead (Flat Appl) (lift (S O) O v1) t)) (THead (Bind Abbr) x2 x3))) (let H22 +\def (match (H21 (refl_equal B Abst)) in False return (\lambda (_: +False).(pr3 c (THead (Bind Abst) v2 (THead (Flat Appl) (lift (S O) O v1) t)) +(THead (Bind Abbr) x2 x3))) with []) in H22) b H17)))))))) H14)) H13))))))) +H9)) (\lambda (H9: (pr3 (CHead c (Bind b) v2) t (lift (S O) O (THead (Bind +Abst) x0 x1)))).(pr3_t (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O +x2) (lift (S O) O (THead (Bind Abst) x0 x1)))) (THead (Bind b) v2 (THead +(Flat Appl) (lift (S O) O v1) t)) c (pr3_head_2 c v2 (THead (Flat Appl) (lift +(S O) O v1) t) (THead (Flat Appl) (lift (S O) O x2) (lift (S O) O (THead +(Bind Abst) x0 x1))) (Bind b) (pr3_flat (CHead c (Bind b) v2) (lift (S O) O +v1) (lift (S O) O x2) (pr3_lift (CHead c (Bind b) v2) c (S O) O (drop_drop +(Bind b) O c c (drop_refl c) v2) v1 x2 H5) t (lift (S O) O (THead (Bind Abst) +x0 x1)) H9 Appl)) (THead (Bind Abbr) x2 x3) (eq_ind T (lift (S O) O (THead +(Flat Appl) x2 (THead (Bind Abst) x0 x1))) (\lambda (t0: T).(pr3 c (THead +(Bind b) v2 t0) (THead (Bind Abbr) x2 x3))) (pr3_sing c (THead (Bind Abbr) x2 +x1) (THead (Bind b) v2 (lift (S O) O (THead (Flat Appl) x2 (THead (Bind Abst) +x0 x1)))) (pr2_free c (THead (Bind b) v2 (lift (S O) O (THead (Flat Appl) x2 +(THead (Bind Abst) x0 x1)))) (THead (Bind Abbr) x2 x1) (pr0_zeta b H (THead +(Flat Appl) x2 (THead (Bind Abst) x0 x1)) (THead (Bind Abbr) x2 x1) (pr0_beta +x0 x2 x2 (pr0_refl x2) x1 x1 (pr0_refl x1)) v2)) (THead (Bind Abbr) x2 x3) +(pr3_head_12 c x2 x2 (pr3_refl c x2) (Bind Abbr) x1 x3 (H7 Abbr x2))) (THead +(Flat Appl) (lift (S O) O x2) (lift (S O) O (THead (Bind Abst) x0 x1))) +(lift_flat Appl x2 (THead (Bind Abst) x0 x1) (S O) O)))) H8))) u2 H4))))))))) +H3)) (\lambda (H3: (ex6_6 B T T T T T (\lambda (b0: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b0 Abst)))))))) (\lambda (b0: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THead (Bind b) v2 t) (THead +(Bind b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b0) +y2 (THead (Flat Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(_: T).(pr3 c v1 u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b0: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b0) y2) z1 z2))))))))).(ex6_6_ind +B T T T T T (\lambda (b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b0 Abst)))))))) (\lambda (b0: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(pr3 c (THead (Bind b) v2 t) (THead (Bind b0) y1 z1)))))))) (\lambda +(b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u3: +T).(\lambda (y2: T).(pr3 c (THead (Bind b0) y2 (THead (Flat Appl) (lift (S O) +O u3) z2)) u2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c v1 u3))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 c y1 y2))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b0) +y2) z1 z2))))))) (pr3 c (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O +v1) t)) u2) (\lambda (x0: B).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (H4: (not (eq B x0 +Abst))).(\lambda (H5: (pr3 c (THead (Bind b) v2 t) (THead (Bind x0) x1 +x2))).(\lambda (H6: (pr3 c (THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) +O x4) x3)) u2)).(\lambda (H7: (pr3 c v1 x4)).(\lambda (H8: (pr3 c x1 +x5)).(\lambda (H9: (pr3 (CHead c (Bind x0) x5) x2 x3)).(pr3_t (THead (Bind +x0) x5 (THead (Flat Appl) (lift (S O) O x4) x3)) (THead (Bind b) v2 (THead +(Flat Appl) (lift (S O) O v1) t)) c (let H_x \def (pr3_gen_bind b H c v2 t +(THead (Bind x0) x1 x2) H5) in (let H10 \def H_x in (or_ind (ex3_2 T T +(\lambda (u3: T).(\lambda (t2: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind +b) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c v2 u3))) (\lambda (_: +T).(\lambda (t2: T).(pr3 (CHead c (Bind b) v2) t t2)))) (pr3 (CHead c (Bind +b) v2) t (lift (S O) O (THead (Bind x0) x1 x2))) (pr3 c (THead (Bind b) v2 +(THead (Flat Appl) (lift (S O) O v1) t)) (THead (Bind x0) x5 (THead (Flat +Appl) (lift (S O) O x4) x3))) (\lambda (H11: (ex3_2 T T (\lambda (u3: +T).(\lambda (t2: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) u3 t2)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c v2 u3))) (\lambda (_: T).(\lambda +(t2: T).(pr3 (CHead c (Bind b) v2) t t2))))).(ex3_2_ind T T (\lambda (u3: +T).(\lambda (t2: T).(eq T (THead (Bind x0) x1 x2) (THead (Bind b) u3 t2)))) +(\lambda (u3: T).(\lambda (_: T).(pr3 c v2 u3))) (\lambda (_: T).(\lambda +(t2: T).(pr3 (CHead c (Bind b) v2) t t2))) (pr3 c (THead (Bind b) v2 (THead +(Flat Appl) (lift (S O) O v1) t)) (THead (Bind x0) x5 (THead (Flat Appl) +(lift (S O) O x4) x3))) (\lambda (x6: T).(\lambda (x7: T).(\lambda (H12: (eq +T (THead (Bind x0) x1 x2) (THead (Bind b) x6 x7))).(\lambda (H13: (pr3 c v2 +x6)).(\lambda (H14: (pr3 (CHead c (Bind b) v2) t x7)).(let H15 \def (f_equal +T B (\lambda (e: T).(match e in T return (\lambda (_: T).B) with [(TSort _) +\Rightarrow x0 | (TLRef _) \Rightarrow x0 | (THead k _ _) \Rightarrow (match +k in K return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow x0])])) (THead (Bind x0) x1 x2) (THead (Bind b) x6 x7) H12) in +((let H16 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow x1 | (TLRef _) \Rightarrow x1 | (THead _ t0 +_) \Rightarrow t0])) (THead (Bind x0) x1 x2) (THead (Bind b) x6 x7) H12) in +((let H17 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow x2 | (TLRef _) \Rightarrow x2 | (THead _ _ +t0) \Rightarrow t0])) (THead (Bind x0) x1 x2) (THead (Bind b) x6 x7) H12) in +(\lambda (H18: (eq T x1 x6)).(\lambda (H19: (eq B x0 b)).(let H20 \def +(eq_ind_r T x7 (\lambda (t0: T).(pr3 (CHead c (Bind b) v2) t t0)) H14 x2 H17) +in (let H21 \def (eq_ind_r T x6 (\lambda (t0: T).(pr3 c v2 t0)) H13 x1 H18) +in (let H22 \def (eq_ind B x0 (\lambda (b0: B).(pr3 (CHead c (Bind b0) x5) x2 +x3)) H9 b H19) in (let H23 \def (eq_ind B x0 (\lambda (b0: B).(not (eq B b0 +Abst))) H4 b H19) in (eq_ind_r B b (\lambda (b0: B).(pr3 c (THead (Bind b) v2 +(THead (Flat Appl) (lift (S O) O v1) t)) (THead (Bind b0) x5 (THead (Flat +Appl) (lift (S O) O x4) x3)))) (pr3_head_21 c v2 x5 (pr3_t x1 v2 c H21 x5 H8) +(Bind b) (THead (Flat Appl) (lift (S O) O v1) t) (THead (Flat Appl) (lift (S +O) O x4) x3) (pr3_flat (CHead c (Bind b) v2) (lift (S O) O v1) (lift (S O) O +x4) (pr3_lift (CHead c (Bind b) v2) c (S O) O (drop_drop (Bind b) O c c +(drop_refl c) v2) v1 x4 H7) t x3 (pr3_t x2 t (CHead c (Bind b) v2) H20 x3 +(pr3_pr3_pr3_t c v2 x1 H21 x2 x3 (Bind b) (pr3_pr3_pr3_t c x1 x5 H8 x2 x3 +(Bind b) H22))) Appl)) x0 H19)))))))) H16)) H15))))))) H11)) (\lambda (H11: +(pr3 (CHead c (Bind b) v2) t (lift (S O) O (THead (Bind x0) x1 x2)))).(pr3_t +(THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O x4) (lift (S O) O (THead +(Bind x0) x1 x2)))) (THead (Bind b) v2 (THead (Flat Appl) (lift (S O) O v1) +t)) c (pr3_head_2 c v2 (THead (Flat Appl) (lift (S O) O v1) t) (THead (Flat +Appl) (lift (S O) O x4) (lift (S O) O (THead (Bind x0) x1 x2))) (Bind b) +(pr3_flat (CHead c (Bind b) v2) (lift (S O) O v1) (lift (S O) O x4) (pr3_lift +(CHead c (Bind b) v2) c (S O) O (drop_drop (Bind b) O c c (drop_refl c) v2) +v1 x4 H7) t (lift (S O) O (THead (Bind x0) x1 x2)) H11 Appl)) (THead (Bind +x0) x5 (THead (Flat Appl) (lift (S O) O x4) x3)) (eq_ind T (lift (S O) O +(THead (Flat Appl) x4 (THead (Bind x0) x1 x2))) (\lambda (t0: T).(pr3 c +(THead (Bind b) v2 t0) (THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) O +x4) x3)))) (pr3_sing c (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O +x4) x2)) (THead (Bind b) v2 (lift (S O) O (THead (Flat Appl) x4 (THead (Bind +x0) x1 x2)))) (pr2_free c (THead (Bind b) v2 (lift (S O) O (THead (Flat Appl) +x4 (THead (Bind x0) x1 x2)))) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S +O) O x4) x2)) (pr0_zeta b H (THead (Flat Appl) x4 (THead (Bind x0) x1 x2)) +(THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O x4) x2)) (pr0_upsilon x0 +H4 x4 x4 (pr0_refl x4) x1 x1 (pr0_refl x1) x2 x2 (pr0_refl x2)) v2)) (THead +(Bind x0) x5 (THead (Flat Appl) (lift (S O) O x4) x3)) (pr3_head_12 c x1 x5 +H8 (Bind x0) (THead (Flat Appl) (lift (S O) O x4) x2) (THead (Flat Appl) +(lift (S O) O x4) x3) (pr3_thin_dx (CHead c (Bind x0) x5) x2 x3 H9 (lift (S +O) O x4) Appl))) (THead (Flat Appl) (lift (S O) O x4) (lift (S O) O (THead +(Bind x0) x1 x2))) (lift_flat Appl x4 (THead (Bind x0) x1 x2) (S O) O)))) +H10))) u2 H6))))))))))))) H3)) H2)))))))))). + +theorem pr3_iso_appls_appl_bind: + \forall (b: B).((not (eq B b Abst)) \to (\forall (v: T).(\forall (u: +T).(\forall (t: T).(\forall (vs: TList).(let u1 \def (THeads (Flat Appl) vs +(THead (Flat Appl) v (THead (Bind b) u t))) in (\forall (c: C).(\forall (u2: +T).((pr3 c u1 u2) \to ((((iso u1 u2) \to (\forall (P: Prop).P))) \to (pr3 c +(THeads (Flat Appl) vs (THead (Bind b) u (THead (Flat Appl) (lift (S O) O v) +t))) u2))))))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda (v: T).(\lambda +(u: T).(\lambda (t: T).(\lambda (vs: TList).(TList_ind (\lambda (t0: +TList).(let u1 \def (THeads (Flat Appl) t0 (THead (Flat Appl) v (THead (Bind +b) u t))) in (\forall (c: C).(\forall (u2: T).((pr3 c u1 u2) \to ((((iso u1 +u2) \to (\forall (P: Prop).P))) \to (pr3 c (THeads (Flat Appl) t0 (THead +(Bind b) u (THead (Flat Appl) (lift (S O) O v) t))) u2))))))) (\lambda (c: +C).(\lambda (u2: T).(\lambda (H0: (pr3 c (THead (Flat Appl) v (THead (Bind b) +u t)) u2)).(\lambda (H1: (((iso (THead (Flat Appl) v (THead (Bind b) u t)) +u2) \to (\forall (P: Prop).P)))).(pr3_iso_appl_bind b H v u t c u2 H0 H1))))) +(\lambda (t0: T).(\lambda (t1: TList).(\lambda (H0: ((\forall (c: C).(\forall +(u2: T).((pr3 c (THeads (Flat Appl) t1 (THead (Flat Appl) v (THead (Bind b) u +t))) u2) \to ((((iso (THeads (Flat Appl) t1 (THead (Flat Appl) v (THead (Bind +b) u t))) u2) \to (\forall (P: Prop).P))) \to (pr3 c (THeads (Flat Appl) t1 +(THead (Bind b) u (THead (Flat Appl) (lift (S O) O v) t))) u2))))))).(\lambda +(c: C).(\lambda (u2: T).(\lambda (H1: (pr3 c (THead (Flat Appl) t0 (THeads +(Flat Appl) t1 (THead (Flat Appl) v (THead (Bind b) u t)))) u2)).(\lambda +(H2: (((iso (THead (Flat Appl) t0 (THeads (Flat Appl) t1 (THead (Flat Appl) v +(THead (Bind b) u t)))) u2) \to (\forall (P: Prop).P)))).(let H3 \def +(pr3_gen_appl c t0 (THeads (Flat Appl) t1 (THead (Flat Appl) v (THead (Bind +b) u t))) u2 H1) in (or3_ind (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq +T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c t0 +u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) t1 (THead +(Flat Appl) v (THead (Bind b) u t))) t2)))) (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c (THead (Bind +Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (_: T).(pr3 c t0 u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t1 (THead (Flat +Appl) v (THead (Bind b) u t))) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b0: +B).(\forall (u0: T).(pr3 (CHead c (Bind b0) u0) z1 t2)))))))) (ex6_6 B T T T +T T (\lambda (b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b0 Abst)))))))) (\lambda (b0: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 +c (THeads (Flat Appl) t1 (THead (Flat Appl) v (THead (Bind b) u t))) (THead +(Bind b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b0) +y2 (THead (Flat Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(_: T).(pr3 c t0 u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b0: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b0) y2) z1 z2)))))))) (pr3 c +(THead (Flat Appl) t0 (THeads (Flat Appl) t1 (THead (Bind b) u (THead (Flat +Appl) (lift (S O) O v) t)))) u2) (\lambda (H4: (ex3_2 T T (\lambda (u3: +T).(\lambda (t2: T).(eq T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c t0 u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c +(THeads (Flat Appl) t1 (THead (Flat Appl) v (THead (Bind b) u t))) +t2))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t2: T).(eq T u2 (THead +(Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c t0 u3))) +(\lambda (_: T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) t1 (THead (Flat +Appl) v (THead (Bind b) u t))) t2))) (pr3 c (THead (Flat Appl) t0 (THeads +(Flat Appl) t1 (THead (Bind b) u (THead (Flat Appl) (lift (S O) O v) t)))) +u2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H5: (eq T u2 (THead (Flat +Appl) x0 x1))).(\lambda (_: (pr3 c t0 x0)).(\lambda (_: (pr3 c (THeads (Flat +Appl) t1 (THead (Flat Appl) v (THead (Bind b) u t))) x1)).(let H8 \def +(eq_ind T u2 (\lambda (t2: T).((iso (THead (Flat Appl) t0 (THeads (Flat Appl) +t1 (THead (Flat Appl) v (THead (Bind b) u t)))) t2) \to (\forall (P: +Prop).P))) H2 (THead (Flat Appl) x0 x1) H5) in (eq_ind_r T (THead (Flat Appl) +x0 x1) (\lambda (t2: T).(pr3 c (THead (Flat Appl) t0 (THeads (Flat Appl) t1 +(THead (Bind b) u (THead (Flat Appl) (lift (S O) O v) t)))) t2)) (H8 +(iso_head t0 x0 (THeads (Flat Appl) t1 (THead (Flat Appl) v (THead (Bind b) u +t))) x1 (Flat Appl)) (pr3 c (THead (Flat Appl) t0 (THeads (Flat Appl) t1 +(THead (Bind b) u (THead (Flat Appl) (lift (S O) O v) t)))) (THead (Flat +Appl) x0 x1))) u2 H5))))))) H4)) (\lambda (H4: (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c (THead (Bind +Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (_: T).(pr3 c t0 u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t1 (THead (Flat +Appl) v (THead (Bind b) u t))) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b0: +B).(\forall (u0: T).(pr3 (CHead c (Bind b0) u0) z1 t2))))))))).(ex4_4_ind T T +T T (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c +(THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u3: T).(\lambda (_: T).(pr3 c t0 u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t1 (THead (Flat +Appl) v (THead (Bind b) u t))) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b0: +B).(\forall (u0: T).(pr3 (CHead c (Bind b0) u0) z1 t2))))))) (pr3 c (THead +(Flat Appl) t0 (THeads (Flat Appl) t1 (THead (Bind b) u (THead (Flat Appl) +(lift (S O) O v) t)))) u2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: +T).(\lambda (x3: T).(\lambda (H5: (pr3 c (THead (Bind Abbr) x2 x3) +u2)).(\lambda (H6: (pr3 c t0 x2)).(\lambda (H7: (pr3 c (THeads (Flat Appl) t1 +(THead (Flat Appl) v (THead (Bind b) u t))) (THead (Bind Abst) x0 +x1))).(\lambda (H8: ((\forall (b0: B).(\forall (u0: T).(pr3 (CHead c (Bind +b0) u0) x1 x3))))).(pr3_t (THead (Bind Abbr) t0 x1) (THead (Flat Appl) t0 +(THeads (Flat Appl) t1 (THead (Bind b) u (THead (Flat Appl) (lift (S O) O v) +t)))) c (pr3_t (THead (Flat Appl) t0 (THead (Bind Abst) x0 x1)) (THead (Flat +Appl) t0 (THeads (Flat Appl) t1 (THead (Bind b) u (THead (Flat Appl) (lift (S +O) O v) t)))) c (pr3_thin_dx c (THeads (Flat Appl) t1 (THead (Bind b) u +(THead (Flat Appl) (lift (S O) O v) t))) (THead (Bind Abst) x0 x1) (H0 c +(THead (Bind Abst) x0 x1) H7 (\lambda (H9: (iso (THeads (Flat Appl) t1 (THead +(Flat Appl) v (THead (Bind b) u t))) (THead (Bind Abst) x0 x1))).(\lambda (P: +Prop).(iso_flats_flat_bind_false Appl Appl Abst x0 v x1 (THead (Bind b) u t) +t1 H9 P)))) t0 Appl) (THead (Bind Abbr) t0 x1) (pr3_pr2 c (THead (Flat Appl) +t0 (THead (Bind Abst) x0 x1)) (THead (Bind Abbr) t0 x1) (pr2_free c (THead +(Flat Appl) t0 (THead (Bind Abst) x0 x1)) (THead (Bind Abbr) t0 x1) (pr0_beta +x0 t0 t0 (pr0_refl t0) x1 x1 (pr0_refl x1))))) u2 (pr3_t (THead (Bind Abbr) +x2 x3) (THead (Bind Abbr) t0 x1) c (pr3_head_12 c t0 x2 H6 (Bind Abbr) x1 x3 +(H8 Abbr x2)) u2 H5)))))))))) H4)) (\lambda (H4: (ex6_6 B T T T T T (\lambda +(b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b0 Abst)))))))) (\lambda (b0: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c +(THeads (Flat Appl) t1 (THead (Flat Appl) v (THead (Bind b) u t))) (THead +(Bind b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b0) +y2 (THead (Flat Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(_: T).(pr3 c t0 u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b0: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b0) y2) z1 z2))))))))).(ex6_6_ind +B T T T T T (\lambda (b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b0 Abst)))))))) (\lambda (b0: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(pr3 c (THeads (Flat Appl) t1 (THead (Flat Appl) v (THead (Bind b) u +t))) (THead (Bind b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (z2: T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind +b0) y2 (THead (Flat Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(_: T).(pr3 c t0 u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b0: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b0) y2) z1 z2))))))) (pr3 c +(THead (Flat Appl) t0 (THeads (Flat Appl) t1 (THead (Bind b) u (THead (Flat +Appl) (lift (S O) O v) t)))) u2) (\lambda (x0: B).(\lambda (x1: T).(\lambda +(x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (H5: (not +(eq B x0 Abst))).(\lambda (H6: (pr3 c (THeads (Flat Appl) t1 (THead (Flat +Appl) v (THead (Bind b) u t))) (THead (Bind x0) x1 x2))).(\lambda (H7: (pr3 c +(THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) O x4) x3)) u2)).(\lambda +(H8: (pr3 c t0 x4)).(\lambda (H9: (pr3 c x1 x5)).(\lambda (H10: (pr3 (CHead c +(Bind x0) x5) x2 x3)).(pr3_t (THead (Bind x0) x1 (THead (Flat Appl) (lift (S +O) O x4) x2)) (THead (Flat Appl) t0 (THeads (Flat Appl) t1 (THead (Bind b) u +(THead (Flat Appl) (lift (S O) O v) t)))) c (pr3_t (THead (Bind x0) x1 (THead +(Flat Appl) (lift (S O) O t0) x2)) (THead (Flat Appl) t0 (THeads (Flat Appl) +t1 (THead (Bind b) u (THead (Flat Appl) (lift (S O) O v) t)))) c (pr3_t +(THead (Flat Appl) t0 (THead (Bind x0) x1 x2)) (THead (Flat Appl) t0 (THeads +(Flat Appl) t1 (THead (Bind b) u (THead (Flat Appl) (lift (S O) O v) t)))) c +(pr3_thin_dx c (THeads (Flat Appl) t1 (THead (Bind b) u (THead (Flat Appl) +(lift (S O) O v) t))) (THead (Bind x0) x1 x2) (H0 c (THead (Bind x0) x1 x2) +H6 (\lambda (H11: (iso (THeads (Flat Appl) t1 (THead (Flat Appl) v (THead +(Bind b) u t))) (THead (Bind x0) x1 x2))).(\lambda (P: +Prop).(iso_flats_flat_bind_false Appl Appl x0 x1 v x2 (THead (Bind b) u t) t1 +H11 P)))) t0 Appl) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O t0) +x2)) (pr3_pr2 c (THead (Flat Appl) t0 (THead (Bind x0) x1 x2)) (THead (Bind +x0) x1 (THead (Flat Appl) (lift (S O) O t0) x2)) (pr2_free c (THead (Flat +Appl) t0 (THead (Bind x0) x1 x2)) (THead (Bind x0) x1 (THead (Flat Appl) +(lift (S O) O t0) x2)) (pr0_upsilon x0 H5 t0 t0 (pr0_refl t0) x1 x1 (pr0_refl +x1) x2 x2 (pr0_refl x2))))) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S +O) O x4) x2)) (pr3_head_12 c x1 x1 (pr3_refl c x1) (Bind x0) (THead (Flat +Appl) (lift (S O) O t0) x2) (THead (Flat Appl) (lift (S O) O x4) x2) +(pr3_head_12 (CHead c (Bind x0) x1) (lift (S O) O t0) (lift (S O) O x4) +(pr3_lift (CHead c (Bind x0) x1) c (S O) O (drop_drop (Bind x0) O c c +(drop_refl c) x1) t0 x4 H8) (Flat Appl) x2 x2 (pr3_refl (CHead (CHead c (Bind +x0) x1) (Flat Appl) (lift (S O) O x4)) x2)))) u2 (pr3_t (THead (Bind x0) x5 +(THead (Flat Appl) (lift (S O) O x4) x3)) (THead (Bind x0) x1 (THead (Flat +Appl) (lift (S O) O x4) x2)) c (pr3_head_12 c x1 x5 H9 (Bind x0) (THead (Flat +Appl) (lift (S O) O x4) x2) (THead (Flat Appl) (lift (S O) O x4) x3) +(pr3_thin_dx (CHead c (Bind x0) x5) x2 x3 H10 (lift (S O) O x4) Appl)) u2 +H7)))))))))))))) H4)) H3))))))))) vs)))))). + +theorem pr3_iso_appls_bind: + \forall (b: B).((not (eq B b Abst)) \to (\forall (vs: TList).(\forall (u: +T).(\forall (t: T).(let u1 \def (THeads (Flat Appl) vs (THead (Bind b) u t)) +in (\forall (c: C).(\forall (u2: T).((pr3 c u1 u2) \to ((((iso u1 u2) \to +(\forall (P: Prop).P))) \to (pr3 c (THead (Bind b) u (THeads (Flat Appl) +(lifts (S O) O vs) t)) u2)))))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda (vs: +TList).(tlist_ind_rew (\lambda (t: TList).(\forall (u: T).(\forall (t0: +T).(let u1 \def (THeads (Flat Appl) t (THead (Bind b) u t0)) in (\forall (c: +C).(\forall (u2: T).((pr3 c u1 u2) \to ((((iso u1 u2) \to (\forall (P: +Prop).P))) \to (pr3 c (THead (Bind b) u (THeads (Flat Appl) (lifts (S O) O t) +t0)) u2))))))))) (\lambda (u: T).(\lambda (t: T).(\lambda (c: C).(\lambda +(u2: T).(\lambda (H0: (pr3 c (THead (Bind b) u t) u2)).(\lambda (_: (((iso +(THead (Bind b) u t) u2) \to (\forall (P: Prop).P)))).H0)))))) (\lambda (ts: +TList).(\lambda (t: T).(\lambda (H0: ((\forall (u: T).(\forall (t0: +T).(\forall (c: C).(\forall (u2: T).((pr3 c (THeads (Flat Appl) ts (THead +(Bind b) u t0)) u2) \to ((((iso (THeads (Flat Appl) ts (THead (Bind b) u t0)) +u2) \to (\forall (P: Prop).P))) \to (pr3 c (THead (Bind b) u (THeads (Flat +Appl) (lifts (S O) O ts) t0)) u2))))))))).(\lambda (u: T).(\lambda (t0: +T).(\lambda (c: C).(\lambda (u2: T).(\lambda (H1: (pr3 c (THeads (Flat Appl) +(TApp ts t) (THead (Bind b) u t0)) u2)).(\lambda (H2: (((iso (THeads (Flat +Appl) (TApp ts t) (THead (Bind b) u t0)) u2) \to (\forall (P: +Prop).P)))).(eq_ind_r TList (TApp (lifts (S O) O ts) (lift (S O) O t)) +(\lambda (t1: TList).(pr3 c (THead (Bind b) u (THeads (Flat Appl) t1 t0)) +u2)) (eq_ind_r T (THeads (Flat Appl) (lifts (S O) O ts) (THead (Flat Appl) +(lift (S O) O t) t0)) (\lambda (t1: T).(pr3 c (THead (Bind b) u t1) u2)) (let +H3 \def (eq_ind T (THeads (Flat Appl) (TApp ts t) (THead (Bind b) u t0)) +(\lambda (t1: T).(pr3 c t1 u2)) H1 (THeads (Flat Appl) ts (THead (Flat Appl) +t (THead (Bind b) u t0))) (theads_tapp (Flat Appl) ts t (THead (Bind b) u +t0))) in (let H4 \def (eq_ind T (THeads (Flat Appl) (TApp ts t) (THead (Bind +b) u t0)) (\lambda (t1: T).((iso t1 u2) \to (\forall (P: Prop).P))) H2 +(THeads (Flat Appl) ts (THead (Flat Appl) t (THead (Bind b) u t0))) +(theads_tapp (Flat Appl) ts t (THead (Bind b) u t0))) in (TList_ind (\lambda +(t1: TList).(((\forall (u0: T).(\forall (t2: T).(\forall (c0: C).(\forall +(u3: T).((pr3 c0 (THeads (Flat Appl) t1 (THead (Bind b) u0 t2)) u3) \to +((((iso (THeads (Flat Appl) t1 (THead (Bind b) u0 t2)) u3) \to (\forall (P: +Prop).P))) \to (pr3 c0 (THead (Bind b) u0 (THeads (Flat Appl) (lifts (S O) O +t1) t2)) u3)))))))) \to ((pr3 c (THeads (Flat Appl) t1 (THead (Flat Appl) t +(THead (Bind b) u t0))) u2) \to ((((iso (THeads (Flat Appl) t1 (THead (Flat +Appl) t (THead (Bind b) u t0))) u2) \to (\forall (P: Prop).P))) \to (pr3 c +(THead (Bind b) u (THeads (Flat Appl) (lifts (S O) O t1) (THead (Flat Appl) +(lift (S O) O t) t0))) u2))))) (\lambda (_: ((\forall (u0: T).(\forall (t1: +T).(\forall (c0: C).(\forall (u3: T).((pr3 c0 (THeads (Flat Appl) TNil (THead +(Bind b) u0 t1)) u3) \to ((((iso (THeads (Flat Appl) TNil (THead (Bind b) u0 +t1)) u3) \to (\forall (P: Prop).P))) \to (pr3 c0 (THead (Bind b) u0 (THeads +(Flat Appl) (lifts (S O) O TNil) t1)) u3))))))))).(\lambda (H6: (pr3 c +(THeads (Flat Appl) TNil (THead (Flat Appl) t (THead (Bind b) u t0))) +u2)).(\lambda (H7: (((iso (THeads (Flat Appl) TNil (THead (Flat Appl) t +(THead (Bind b) u t0))) u2) \to (\forall (P: Prop).P)))).(pr3_iso_appl_bind b +H t u t0 c u2 H6 H7)))) (\lambda (t1: T).(\lambda (ts0: TList).(\lambda (_: +((((\forall (u0: T).(\forall (t2: T).(\forall (c0: C).(\forall (u3: T).((pr3 +c0 (THeads (Flat Appl) ts0 (THead (Bind b) u0 t2)) u3) \to ((((iso (THeads +(Flat Appl) ts0 (THead (Bind b) u0 t2)) u3) \to (\forall (P: Prop).P))) \to +(pr3 c0 (THead (Bind b) u0 (THeads (Flat Appl) (lifts (S O) O ts0) t2)) +u3)))))))) \to ((pr3 c (THeads (Flat Appl) ts0 (THead (Flat Appl) t (THead +(Bind b) u t0))) u2) \to ((((iso (THeads (Flat Appl) ts0 (THead (Flat Appl) t +(THead (Bind b) u t0))) u2) \to (\forall (P: Prop).P))) \to (pr3 c (THead +(Bind b) u (THeads (Flat Appl) (lifts (S O) O ts0) (THead (Flat Appl) (lift +(S O) O t) t0))) u2)))))).(\lambda (H5: ((\forall (u0: T).(\forall (t2: +T).(\forall (c0: C).(\forall (u3: T).((pr3 c0 (THeads (Flat Appl) (TCons t1 +ts0) (THead (Bind b) u0 t2)) u3) \to ((((iso (THeads (Flat Appl) (TCons t1 +ts0) (THead (Bind b) u0 t2)) u3) \to (\forall (P: Prop).P))) \to (pr3 c0 +(THead (Bind b) u0 (THeads (Flat Appl) (lifts (S O) O (TCons t1 ts0)) t2)) +u3))))))))).(\lambda (H6: (pr3 c (THeads (Flat Appl) (TCons t1 ts0) (THead +(Flat Appl) t (THead (Bind b) u t0))) u2)).(\lambda (H7: (((iso (THeads (Flat +Appl) (TCons t1 ts0) (THead (Flat Appl) t (THead (Bind b) u t0))) u2) \to +(\forall (P: Prop).P)))).(H5 u (THead (Flat Appl) (lift (S O) O t) t0) c u2 +(pr3_iso_appls_appl_bind b H t u t0 (TCons t1 ts0) c u2 H6 H7) (\lambda (H8: +(iso (THeads (Flat Appl) (TCons t1 ts0) (THead (Bind b) u (THead (Flat Appl) +(lift (S O) O t) t0))) u2)).(\lambda (P: Prop).(H7 (iso_trans (THeads (Flat +Appl) (TCons t1 ts0) (THead (Flat Appl) t (THead (Bind b) u t0))) (THeads +(Flat Appl) (TCons t1 ts0) (THead (Bind b) u (THead (Flat Appl) (lift (S O) O +t) t0))) (iso_head t1 t1 (THeads (Flat Appl) ts0 (THead (Flat Appl) t (THead +(Bind b) u t0))) (THeads (Flat Appl) ts0 (THead (Bind b) u (THead (Flat Appl) +(lift (S O) O t) t0))) (Flat Appl)) u2 H8) P)))))))))) ts H0 H3 H4))) (THeads +(Flat Appl) (TApp (lifts (S O) O ts) (lift (S O) O t)) t0) (theads_tapp (Flat +Appl) (lifts (S O) O ts) (lift (S O) O t) t0)) (lifts (S O) O (TApp ts t)) +(lifts_tapp (S O) O t ts))))))))))) vs))). + +theorem pr3_iso_beta: + \forall (v: T).(\forall (w: T).(\forall (t: T).(let u1 \def (THead (Flat +Appl) v (THead (Bind Abst) w t)) in (\forall (c: C).(\forall (u2: T).((pr3 c +u1 u2) \to ((((iso u1 u2) \to (\forall (P: Prop).P))) \to (pr3 c (THead (Bind +Abbr) v t) u2)))))))) +\def + \lambda (v: T).(\lambda (w: T).(\lambda (t: T).(\lambda (c: C).(\lambda (u2: +T).(\lambda (H: (pr3 c (THead (Flat Appl) v (THead (Bind Abst) w t)) +u2)).(\lambda (H0: (((iso (THead (Flat Appl) v (THead (Bind Abst) w t)) u2) +\to (\forall (P: Prop).P)))).(let H1 \def (pr3_gen_appl c v (THead (Bind +Abst) w t) u2 H) in (or3_ind (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq +T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c v +u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c (THead (Bind Abst) w t) t2)))) +(ex4_4 T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: +T).(pr3 c (THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(pr3 c v u3))))) (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THead (Bind Abst) +w t) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind +b) u) z1 t2)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THead (Bind Abst) w t) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(_: T).(pr3 c v u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))) (pr3 c +(THead (Bind Abbr) v t) u2) (\lambda (H2: (ex3_2 T T (\lambda (u3: +T).(\lambda (t2: T).(eq T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c v u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c +(THead (Bind Abst) w t) t2))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t2: +T).(eq T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: +T).(pr3 c v u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c (THead (Bind Abst) +w t) t2))) (pr3 c (THead (Bind Abbr) v t) u2) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H3: (eq T u2 (THead (Flat Appl) x0 x1))).(\lambda (_: (pr3 c v +x0)).(\lambda (_: (pr3 c (THead (Bind Abst) w t) x1)).(let H6 \def (eq_ind T +u2 (\lambda (t0: T).((iso (THead (Flat Appl) v (THead (Bind Abst) w t)) t0) +\to (\forall (P: Prop).P))) H0 (THead (Flat Appl) x0 x1) H3) in (eq_ind_r T +(THead (Flat Appl) x0 x1) (\lambda (t0: T).(pr3 c (THead (Bind Abbr) v t) +t0)) (H6 (iso_head v x0 (THead (Bind Abst) w t) x1 (Flat Appl)) (pr3 c (THead +(Bind Abbr) v t) (THead (Flat Appl) x0 x1))) u2 H3))))))) H2)) (\lambda (H2: +(ex4_4 T T T T (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: +T).(pr3 c (THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(pr3 c v u3))))) (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THead (Bind Abst) +w t) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind +b) u) z1 t2))))))))).(ex4_4_ind T T T T (\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c (THead (Bind Abbr) u3 t2) u2))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c v +u3))))) (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(pr3 c (THead (Bind Abst) w t) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall +(u: T).(pr3 (CHead c (Bind b) u) z1 t2))))))) (pr3 c (THead (Bind Abbr) v t) +u2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (H3: (pr3 c (THead (Bind Abbr) x2 x3) u2)).(\lambda (H4: (pr3 c v +x2)).(\lambda (H5: (pr3 c (THead (Bind Abst) w t) (THead (Bind Abst) x0 +x1))).(\lambda (H6: ((\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) +u) x1 x3))))).(let H7 \def (pr3_gen_abst c w t (THead (Bind Abst) x0 x1) H5) +in (ex3_2_ind T T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead (Bind Abst) +x0 x1) (THead (Bind Abst) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c w +u3))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) t t2))))) (pr3 c (THead (Bind Abbr) v t) u2) (\lambda +(x4: T).(\lambda (x5: T).(\lambda (H8: (eq T (THead (Bind Abst) x0 x1) (THead +(Bind Abst) x4 x5))).(\lambda (H9: (pr3 c w x4)).(\lambda (H10: ((\forall (b: +B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t x5))))).(let H11 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow x0 | (TLRef _) \Rightarrow x0 | (THead _ t0 _) \Rightarrow t0])) +(THead (Bind Abst) x0 x1) (THead (Bind Abst) x4 x5) H8) in ((let H12 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow x1 | (TLRef _) \Rightarrow x1 | (THead _ _ t0) +\Rightarrow t0])) (THead (Bind Abst) x0 x1) (THead (Bind Abst) x4 x5) H8) in +(\lambda (H13: (eq T x0 x4)).(let H14 \def (eq_ind_r T x5 (\lambda (t0: +T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t t0)))) H10 x1 +H12) in (let H15 \def (eq_ind_r T x4 (\lambda (t0: T).(pr3 c w t0)) H9 x0 +H13) in (pr3_t (THead (Bind Abbr) x2 x3) (THead (Bind Abbr) v t) c +(pr3_head_12 c v x2 H4 (Bind Abbr) t x3 (pr3_t x1 t (CHead c (Bind Abbr) x2) +(H14 Abbr x2) x3 (H6 Abbr x2))) u2 H3))))) H11))))))) H7)))))))))) H2)) +(\lambda (H2: (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) +(\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(pr3 c (THead (Bind Abst) w t) (THead (Bind b) y1 +z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: +T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat +Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (_: T).(pr3 c v +u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 (CHead c (Bind b) y2) z1 z2))))))))).(ex6_6_ind B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c +(THead (Bind Abst) w t) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u3: T).(\lambda +(y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u3) z2)) +u2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(pr3 c v u3))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) +y2) z1 z2))))))) (pr3 c (THead (Bind Abbr) v t) u2) (\lambda (x0: B).(\lambda +(x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: +T).(\lambda (H3: (not (eq B x0 Abst))).(\lambda (H4: (pr3 c (THead (Bind +Abst) w t) (THead (Bind x0) x1 x2))).(\lambda (H5: (pr3 c (THead (Bind x0) x5 +(THead (Flat Appl) (lift (S O) O x4) x3)) u2)).(\lambda (_: (pr3 c v +x4)).(\lambda (_: (pr3 c x1 x5)).(\lambda (H8: (pr3 (CHead c (Bind x0) x5) x2 +x3)).(let H9 \def (pr3_gen_abst c w t (THead (Bind x0) x1 x2) H4) in +(ex3_2_ind T T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead (Bind x0) x1 +x2) (THead (Bind Abst) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c w +u3))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: B).(\forall (u: T).(pr3 +(CHead c (Bind b) u) t t2))))) (pr3 c (THead (Bind Abbr) v t) u2) (\lambda +(x6: T).(\lambda (x7: T).(\lambda (H10: (eq T (THead (Bind x0) x1 x2) (THead +(Bind Abst) x6 x7))).(\lambda (H11: (pr3 c w x6)).(\lambda (H12: ((\forall +(b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t x7))))).(let H13 \def +(f_equal T B (\lambda (e: T).(match e in T return (\lambda (_: T).B) with +[(TSort _) \Rightarrow x0 | (TLRef _) \Rightarrow x0 | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow x0])])) (THead (Bind x0) x1 x2) (THead +(Bind Abst) x6 x7) H10) in ((let H14 \def (f_equal T T (\lambda (e: T).(match +e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x1 | (TLRef _) +\Rightarrow x1 | (THead _ t0 _) \Rightarrow t0])) (THead (Bind x0) x1 x2) +(THead (Bind Abst) x6 x7) H10) in ((let H15 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x2 | +(TLRef _) \Rightarrow x2 | (THead _ _ t0) \Rightarrow t0])) (THead (Bind x0) +x1 x2) (THead (Bind Abst) x6 x7) H10) in (\lambda (H16: (eq T x1 +x6)).(\lambda (H17: (eq B x0 Abst)).(let H18 \def (eq_ind_r T x7 (\lambda +(t0: T).(\forall (b: B).(\forall (u: T).(pr3 (CHead c (Bind b) u) t t0)))) +H12 x2 H15) in (let H19 \def (eq_ind_r T x6 (\lambda (t0: T).(pr3 c w t0)) +H11 x1 H16) in (let H20 \def (eq_ind B x0 (\lambda (b: B).(pr3 (CHead c (Bind +b) x5) x2 x3)) H8 Abst H17) in (let H21 \def (eq_ind B x0 (\lambda (b: +B).(pr3 c (THead (Bind b) x5 (THead (Flat Appl) (lift (S O) O x4) x3)) u2)) +H5 Abst H17) in (let H22 \def (eq_ind B x0 (\lambda (b: B).(not (eq B b +Abst))) H3 Abst H17) in (let H23 \def (match (H22 (refl_equal B Abst)) in +False return (\lambda (_: False).(pr3 c (THead (Bind Abbr) v t) u2)) with []) +in H23))))))))) H14)) H13))))))) H9)))))))))))))) H2)) H1)))))))). + +theorem pr3_iso_appls_beta: + \forall (us: TList).(\forall (v: T).(\forall (w: T).(\forall (t: T).(let u1 +\def (THeads (Flat Appl) us (THead (Flat Appl) v (THead (Bind Abst) w t))) in +(\forall (c: C).(\forall (u2: T).((pr3 c u1 u2) \to ((((iso u1 u2) \to +(\forall (P: Prop).P))) \to (pr3 c (THeads (Flat Appl) us (THead (Bind Abbr) +v t)) u2))))))))) +\def + \lambda (us: TList).(TList_ind (\lambda (t: TList).(\forall (v: T).(\forall +(w: T).(\forall (t0: T).(let u1 \def (THeads (Flat Appl) t (THead (Flat Appl) +v (THead (Bind Abst) w t0))) in (\forall (c: C).(\forall (u2: T).((pr3 c u1 +u2) \to ((((iso u1 u2) \to (\forall (P: Prop).P))) \to (pr3 c (THeads (Flat +Appl) t (THead (Bind Abbr) v t0)) u2)))))))))) (\lambda (v: T).(\lambda (w: +T).(\lambda (t: T).(\lambda (c: C).(\lambda (u2: T).(\lambda (H: (pr3 c +(THead (Flat Appl) v (THead (Bind Abst) w t)) u2)).(\lambda (H0: (((iso +(THead (Flat Appl) v (THead (Bind Abst) w t)) u2) \to (\forall (P: +Prop).P)))).(pr3_iso_beta v w t c u2 H H0)))))))) (\lambda (t: T).(\lambda +(t0: TList).(\lambda (H: ((\forall (v: T).(\forall (w: T).(\forall (t1: +T).(\forall (c: C).(\forall (u2: T).((pr3 c (THeads (Flat Appl) t0 (THead +(Flat Appl) v (THead (Bind Abst) w t1))) u2) \to ((((iso (THeads (Flat Appl) +t0 (THead (Flat Appl) v (THead (Bind Abst) w t1))) u2) \to (\forall (P: +Prop).P))) \to (pr3 c (THeads (Flat Appl) t0 (THead (Bind Abbr) v t1)) +u2)))))))))).(\lambda (v: T).(\lambda (w: T).(\lambda (t1: T).(\lambda (c: +C).(\lambda (u2: T).(\lambda (H0: (pr3 c (THead (Flat Appl) t (THeads (Flat +Appl) t0 (THead (Flat Appl) v (THead (Bind Abst) w t1)))) u2)).(\lambda (H1: +(((iso (THead (Flat Appl) t (THeads (Flat Appl) t0 (THead (Flat Appl) v +(THead (Bind Abst) w t1)))) u2) \to (\forall (P: Prop).P)))).(let H2 \def +(pr3_gen_appl c t (THeads (Flat Appl) t0 (THead (Flat Appl) v (THead (Bind +Abst) w t1))) u2 H0) in (or3_ind (ex3_2 T T (\lambda (u3: T).(\lambda (t2: +T).(eq T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: +T).(pr3 c t u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) +t0 (THead (Flat Appl) v (THead (Bind Abst) w t1))) t2)))) (ex4_4 T T T T +(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c +(THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u3: T).(\lambda (_: T).(pr3 c t u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t0 (THead (Flat +Appl) v (THead (Bind Abst) w t1))) (THead (Bind Abst) y1 z1)))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b: +B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2)))))))) (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(pr3 c +(THeads (Flat Appl) t0 (THead (Flat Appl) v (THead (Bind Abst) w t1))) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c (THead (Bind b) +y2 (THead (Flat Appl) (lift (S O) O u3) z2)) u2))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda +(_: T).(pr3 c t u3))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 z2)))))))) (pr3 c +(THead (Flat Appl) t (THeads (Flat Appl) t0 (THead (Bind Abbr) v t1))) u2) +(\lambda (H3: (ex3_2 T T (\lambda (u3: T).(\lambda (t2: T).(eq T u2 (THead +(Flat Appl) u3 t2)))) (\lambda (u3: T).(\lambda (_: T).(pr3 c t u3))) +(\lambda (_: T).(\lambda (t2: T).(pr3 c (THeads (Flat Appl) t0 (THead (Flat +Appl) v (THead (Bind Abst) w t1))) t2))))).(ex3_2_ind T T (\lambda (u3: +T).(\lambda (t2: T).(eq T u2 (THead (Flat Appl) u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(pr3 c t u3))) (\lambda (_: T).(\lambda (t2: T).(pr3 c +(THeads (Flat Appl) t0 (THead (Flat Appl) v (THead (Bind Abst) w t1))) t2))) +(pr3 c (THead (Flat Appl) t (THeads (Flat Appl) t0 (THead (Bind Abbr) v t1))) +u2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T u2 (THead (Flat +Appl) x0 x1))).(\lambda (_: (pr3 c t x0)).(\lambda (_: (pr3 c (THeads (Flat +Appl) t0 (THead (Flat Appl) v (THead (Bind Abst) w t1))) x1)).(let H7 \def +(eq_ind T u2 (\lambda (t2: T).((iso (THead (Flat Appl) t (THeads (Flat Appl) +t0 (THead (Flat Appl) v (THead (Bind Abst) w t1)))) t2) \to (\forall (P: +Prop).P))) H1 (THead (Flat Appl) x0 x1) H4) in (eq_ind_r T (THead (Flat Appl) +x0 x1) (\lambda (t2: T).(pr3 c (THead (Flat Appl) t (THeads (Flat Appl) t0 +(THead (Bind Abbr) v t1))) t2)) (H7 (iso_head t x0 (THeads (Flat Appl) t0 +(THead (Flat Appl) v (THead (Bind Abst) w t1))) x1 (Flat Appl)) (pr3 c (THead +(Flat Appl) t (THeads (Flat Appl) t0 (THead (Bind Abbr) v t1))) (THead (Flat +Appl) x0 x1))) u2 H4))))))) H3)) (\lambda (H3: (ex4_4 T T T T (\lambda (_: +T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c (THead (Bind +Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (_: T).(pr3 c t u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t0 (THead (Flat +Appl) v (THead (Bind Abst) w t1))) (THead (Bind Abst) y1 z1)))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b: +B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2))))))))).(ex4_4_ind T T T +T (\lambda (_: T).(\lambda (_: T).(\lambda (u3: T).(\lambda (t2: T).(pr3 c +(THead (Bind Abbr) u3 t2) u2))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u3: T).(\lambda (_: T).(pr3 c t u3))))) (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t0 (THead (Flat +Appl) v (THead (Bind Abst) w t1))) (THead (Bind Abst) y1 z1)))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t2: T).(\forall (b: +B).(\forall (u: T).(pr3 (CHead c (Bind b) u) z1 t2))))))) (pr3 c (THead (Flat +Appl) t (THeads (Flat Appl) t0 (THead (Bind Abbr) v t1))) u2) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (H4: (pr3 c +(THead (Bind Abbr) x2 x3) u2)).(\lambda (H5: (pr3 c t x2)).(\lambda (H6: (pr3 +c (THeads (Flat Appl) t0 (THead (Flat Appl) v (THead (Bind Abst) w t1))) +(THead (Bind Abst) x0 x1))).(\lambda (H7: ((\forall (b: B).(\forall (u: +T).(pr3 (CHead c (Bind b) u) x1 x3))))).(pr3_t (THead (Bind Abbr) t x1) +(THead (Flat Appl) t (THeads (Flat Appl) t0 (THead (Bind Abbr) v t1))) c +(pr3_t (THead (Flat Appl) t (THead (Bind Abst) x0 x1)) (THead (Flat Appl) t +(THeads (Flat Appl) t0 (THead (Bind Abbr) v t1))) c (pr3_thin_dx c (THeads +(Flat Appl) t0 (THead (Bind Abbr) v t1)) (THead (Bind Abst) x0 x1) (H v w t1 +c (THead (Bind Abst) x0 x1) H6 (\lambda (H8: (iso (THeads (Flat Appl) t0 +(THead (Flat Appl) v (THead (Bind Abst) w t1))) (THead (Bind Abst) x0 +x1))).(\lambda (P: Prop).(iso_flats_flat_bind_false Appl Appl Abst x0 v x1 +(THead (Bind Abst) w t1) t0 H8 P)))) t Appl) (THead (Bind Abbr) t x1) +(pr3_pr2 c (THead (Flat Appl) t (THead (Bind Abst) x0 x1)) (THead (Bind Abbr) +t x1) (pr2_free c (THead (Flat Appl) t (THead (Bind Abst) x0 x1)) (THead +(Bind Abbr) t x1) (pr0_beta x0 t t (pr0_refl t) x1 x1 (pr0_refl x1))))) u2 +(pr3_t (THead (Bind Abbr) x2 x3) (THead (Bind Abbr) t x1) c (pr3_head_12 c t +x2 H5 (Bind Abbr) x1 x3 (H7 Abbr x2)) u2 H4)))))))))) H3)) (\lambda (H3: +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(pr3 c (THeads (Flat Appl) t0 (THead (Flat Appl) v (THead (Bind Abst) +w t1))) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u3: T).(\lambda (y2: T).(pr3 c +(THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u3) z2)) u2))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u3: +T).(\lambda (_: T).(pr3 c t u3))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr3 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) y2) z1 +z2))))))))).(ex6_6_ind B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(pr3 c (THeads (Flat Appl) t0 (THead (Flat +Appl) v (THead (Bind Abst) w t1))) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u3: T).(\lambda +(y2: T).(pr3 c (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u3) z2)) +u2))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u3: T).(\lambda (_: T).(pr3 c t u3))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr3 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr3 (CHead c (Bind b) +y2) z1 z2))))))) (pr3 c (THead (Flat Appl) t (THeads (Flat Appl) t0 (THead +(Bind Abbr) v t1))) u2) (\lambda (x0: B).(\lambda (x1: T).(\lambda (x2: +T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (H4: (not (eq +B x0 Abst))).(\lambda (H5: (pr3 c (THeads (Flat Appl) t0 (THead (Flat Appl) v +(THead (Bind Abst) w t1))) (THead (Bind x0) x1 x2))).(\lambda (H6: (pr3 c +(THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) O x4) x3)) u2)).(\lambda +(H7: (pr3 c t x4)).(\lambda (H8: (pr3 c x1 x5)).(\lambda (H9: (pr3 (CHead c +(Bind x0) x5) x2 x3)).(pr3_t (THead (Bind x0) x1 (THead (Flat Appl) (lift (S +O) O x4) x2)) (THead (Flat Appl) t (THeads (Flat Appl) t0 (THead (Bind Abbr) +v t1))) c (pr3_t (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O t) x2)) +(THead (Flat Appl) t (THeads (Flat Appl) t0 (THead (Bind Abbr) v t1))) c +(pr3_t (THead (Flat Appl) t (THead (Bind x0) x1 x2)) (THead (Flat Appl) t +(THeads (Flat Appl) t0 (THead (Bind Abbr) v t1))) c (pr3_thin_dx c (THeads +(Flat Appl) t0 (THead (Bind Abbr) v t1)) (THead (Bind x0) x1 x2) (H v w t1 c +(THead (Bind x0) x1 x2) H5 (\lambda (H10: (iso (THeads (Flat Appl) t0 (THead +(Flat Appl) v (THead (Bind Abst) w t1))) (THead (Bind x0) x1 x2))).(\lambda +(P: Prop).(iso_flats_flat_bind_false Appl Appl x0 x1 v x2 (THead (Bind Abst) +w t1) t0 H10 P)))) t Appl) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) +O t) x2)) (pr3_pr2 c (THead (Flat Appl) t (THead (Bind x0) x1 x2)) (THead +(Bind x0) x1 (THead (Flat Appl) (lift (S O) O t) x2)) (pr2_free c (THead +(Flat Appl) t (THead (Bind x0) x1 x2)) (THead (Bind x0) x1 (THead (Flat Appl) +(lift (S O) O t) x2)) (pr0_upsilon x0 H4 t t (pr0_refl t) x1 x1 (pr0_refl x1) +x2 x2 (pr0_refl x2))))) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O +x4) x2)) (pr3_head_12 c x1 x1 (pr3_refl c x1) (Bind x0) (THead (Flat Appl) +(lift (S O) O t) x2) (THead (Flat Appl) (lift (S O) O x4) x2) (pr3_head_12 +(CHead c (Bind x0) x1) (lift (S O) O t) (lift (S O) O x4) (pr3_lift (CHead c +(Bind x0) x1) c (S O) O (drop_drop (Bind x0) O c c (drop_refl c) x1) t x4 H7) +(Flat Appl) x2 x2 (pr3_refl (CHead (CHead c (Bind x0) x1) (Flat Appl) (lift +(S O) O x4)) x2)))) u2 (pr3_t (THead (Bind x0) x5 (THead (Flat Appl) (lift (S +O) O x4) x3)) (THead (Bind x0) x1 (THead (Flat Appl) (lift (S O) O x4) x2)) c +(pr3_head_12 c x1 x5 H8 (Bind x0) (THead (Flat Appl) (lift (S O) O x4) x2) +(THead (Flat Appl) (lift (S O) O x4) x3) (pr3_thin_dx (CHead c (Bind x0) x5) +x2 x3 H9 (lift (S O) O x4) Appl)) u2 H6)))))))))))))) H3)) H2)))))))))))) us). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr1.ma new file mode 100644 index 000000000..21344033e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr1.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr3/pr1". + +include "pr3/defs.ma". + +include "pr1/defs.ma". + +theorem pr3_pr1: + \forall (t1: T).(\forall (t2: T).((pr1 t1 t2) \to (\forall (c: C).(pr3 c t1 +t2)))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr1 t1 t2)).(pr1_ind (\lambda +(t: T).(\lambda (t0: T).(\forall (c: C).(pr3 c t t0)))) (\lambda (t: +T).(\lambda (c: C).(pr3_refl c t))) (\lambda (t0: T).(\lambda (t3: +T).(\lambda (H0: (pr0 t3 t0)).(\lambda (t4: T).(\lambda (_: (pr1 t0 +t4)).(\lambda (H2: ((\forall (c: C).(pr3 c t0 t4)))).(\lambda (c: +C).(pr3_sing c t0 t3 (pr2_free c t3 t0 H0) t4 (H2 c))))))))) t1 t2 H))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr3.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr3.ma new file mode 100644 index 000000000..c29781a0e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr3.ma @@ -0,0 +1,70 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr3/pr3". + +include "pr3/props.ma". + +include "pr2/pr2.ma". + +theorem pr3_strip: + \forall (c: C).(\forall (t0: T).(\forall (t1: T).((pr3 c t0 t1) \to (\forall +(t2: T).((pr2 c t0 t2) \to (ex2 T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: +T).(pr3 c t2 t)))))))) +\def + \lambda (c: C).(\lambda (t0: T).(\lambda (t1: T).(\lambda (H: (pr3 c t0 +t1)).(pr3_ind c (\lambda (t: T).(\lambda (t2: T).(\forall (t3: T).((pr2 c t +t3) \to (ex2 T (\lambda (t4: T).(pr3 c t2 t4)) (\lambda (t4: T).(pr3 c t3 +t4))))))) (\lambda (t: T).(\lambda (t2: T).(\lambda (H0: (pr2 c t +t2)).(ex_intro2 T (\lambda (t3: T).(pr3 c t t3)) (\lambda (t3: T).(pr3 c t2 +t3)) t2 (pr3_pr2 c t t2 H0) (pr3_refl c t2))))) (\lambda (t2: T).(\lambda +(t3: T).(\lambda (H0: (pr2 c t3 t2)).(\lambda (t4: T).(\lambda (_: (pr3 c t2 +t4)).(\lambda (H2: ((\forall (t5: T).((pr2 c t2 t5) \to (ex2 T (\lambda (t: +T).(pr3 c t4 t)) (\lambda (t: T).(pr3 c t5 t))))))).(\lambda (t5: T).(\lambda +(H3: (pr2 c t3 t5)).(ex2_ind T (\lambda (t: T).(pr2 c t5 t)) (\lambda (t: +T).(pr2 c t2 t)) (ex2 T (\lambda (t: T).(pr3 c t4 t)) (\lambda (t: T).(pr3 c +t5 t))) (\lambda (x: T).(\lambda (H4: (pr2 c t5 x)).(\lambda (H5: (pr2 c t2 +x)).(ex2_ind T (\lambda (t: T).(pr3 c t4 t)) (\lambda (t: T).(pr3 c x t)) +(ex2 T (\lambda (t: T).(pr3 c t4 t)) (\lambda (t: T).(pr3 c t5 t))) (\lambda +(x0: T).(\lambda (H6: (pr3 c t4 x0)).(\lambda (H7: (pr3 c x x0)).(ex_intro2 T +(\lambda (t: T).(pr3 c t4 t)) (\lambda (t: T).(pr3 c t5 t)) x0 H6 (pr3_sing c +x t5 H4 x0 H7))))) (H2 x H5))))) (pr2_confluence c t3 t5 H3 t2 H0)))))))))) +t0 t1 H)))). + +theorem pr3_confluence: + \forall (c: C).(\forall (t0: T).(\forall (t1: T).((pr3 c t0 t1) \to (\forall +(t2: T).((pr3 c t0 t2) \to (ex2 T (\lambda (t: T).(pr3 c t1 t)) (\lambda (t: +T).(pr3 c t2 t)))))))) +\def + \lambda (c: C).(\lambda (t0: T).(\lambda (t1: T).(\lambda (H: (pr3 c t0 +t1)).(pr3_ind c (\lambda (t: T).(\lambda (t2: T).(\forall (t3: T).((pr3 c t +t3) \to (ex2 T (\lambda (t4: T).(pr3 c t2 t4)) (\lambda (t4: T).(pr3 c t3 +t4))))))) (\lambda (t: T).(\lambda (t2: T).(\lambda (H0: (pr3 c t +t2)).(ex_intro2 T (\lambda (t3: T).(pr3 c t t3)) (\lambda (t3: T).(pr3 c t2 +t3)) t2 H0 (pr3_refl c t2))))) (\lambda (t2: T).(\lambda (t3: T).(\lambda +(H0: (pr2 c t3 t2)).(\lambda (t4: T).(\lambda (_: (pr3 c t2 t4)).(\lambda +(H2: ((\forall (t5: T).((pr3 c t2 t5) \to (ex2 T (\lambda (t: T).(pr3 c t4 +t)) (\lambda (t: T).(pr3 c t5 t))))))).(\lambda (t5: T).(\lambda (H3: (pr3 c +t3 t5)).(ex2_ind T (\lambda (t: T).(pr3 c t5 t)) (\lambda (t: T).(pr3 c t2 +t)) (ex2 T (\lambda (t: T).(pr3 c t4 t)) (\lambda (t: T).(pr3 c t5 t))) +(\lambda (x: T).(\lambda (H4: (pr3 c t5 x)).(\lambda (H5: (pr3 c t2 +x)).(ex2_ind T (\lambda (t: T).(pr3 c t4 t)) (\lambda (t: T).(pr3 c x t)) +(ex2 T (\lambda (t: T).(pr3 c t4 t)) (\lambda (t: T).(pr3 c t5 t))) (\lambda +(x0: T).(\lambda (H6: (pr3 c t4 x0)).(\lambda (H7: (pr3 c x x0)).(ex_intro2 T +(\lambda (t: T).(pr3 c t4 t)) (\lambda (t: T).(pr3 c t5 t)) x0 H6 (pr3_t x t5 +c H4 x0 H7))))) (H2 x H5))))) (pr3_strip c t3 t5 H3 t2 H0)))))))))) t0 t1 +H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/props.ma new file mode 100644 index 000000000..c07efa64d --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/props.ma @@ -0,0 +1,415 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr3/props". + +include "pr3/pr1.ma". + +include "pr2/props.ma". + +include "pr1/props.ma". + +theorem clear_pr3_trans: + \forall (c2: C).(\forall (t1: T).(\forall (t2: T).((pr3 c2 t1 t2) \to +(\forall (c1: C).((clear c1 c2) \to (pr3 c1 t1 t2)))))) +\def + \lambda (c2: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c2 t1 +t2)).(\lambda (c1: C).(\lambda (H0: (clear c1 c2)).(pr3_ind c2 (\lambda (t: +T).(\lambda (t0: T).(pr3 c1 t t0))) (\lambda (t: T).(pr3_refl c1 t)) (\lambda +(t3: T).(\lambda (t4: T).(\lambda (H1: (pr2 c2 t4 t3)).(\lambda (t5: +T).(\lambda (_: (pr3 c2 t3 t5)).(\lambda (H3: (pr3 c1 t3 t5)).(pr3_sing c1 t3 +t4 (clear_pr2_trans c2 t4 t3 H1 c1 H0) t5 H3))))))) t1 t2 H)))))). + +theorem pr3_pr2: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (pr3 c +t1 t2)))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c t1 +t2)).(pr3_sing c t2 t1 H t2 (pr3_refl c t2))))). + +theorem pr3_t: + \forall (t2: T).(\forall (t1: T).(\forall (c: C).((pr3 c t1 t2) \to (\forall +(t3: T).((pr3 c t2 t3) \to (pr3 c t1 t3)))))) +\def + \lambda (t2: T).(\lambda (t1: T).(\lambda (c: C).(\lambda (H: (pr3 c t1 +t2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (t3: T).((pr3 c t0 +t3) \to (pr3 c t t3))))) (\lambda (t: T).(\lambda (t3: T).(\lambda (H0: (pr3 +c t t3)).H0))) (\lambda (t0: T).(\lambda (t3: T).(\lambda (H0: (pr2 c t3 +t0)).(\lambda (t4: T).(\lambda (_: (pr3 c t0 t4)).(\lambda (H2: ((\forall +(t5: T).((pr3 c t4 t5) \to (pr3 c t0 t5))))).(\lambda (t5: T).(\lambda (H3: +(pr3 c t4 t5)).(pr3_sing c t0 t3 H0 t5 (H2 t5 H3)))))))))) t1 t2 H)))). + +theorem pr3_thin_dx: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t1 t2) \to (\forall +(u: T).(\forall (f: F).(pr3 c (THead (Flat f) u t1) (THead (Flat f) u +t2))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c t1 +t2)).(\lambda (u: T).(\lambda (f: F).(pr3_ind c (\lambda (t: T).(\lambda (t0: +T).(pr3 c (THead (Flat f) u t) (THead (Flat f) u t0)))) (\lambda (t: +T).(pr3_refl c (THead (Flat f) u t))) (\lambda (t0: T).(\lambda (t3: +T).(\lambda (H0: (pr2 c t3 t0)).(\lambda (t4: T).(\lambda (_: (pr3 c t0 +t4)).(\lambda (H2: (pr3 c (THead (Flat f) u t0) (THead (Flat f) u +t4))).(pr3_sing c (THead (Flat f) u t0) (THead (Flat f) u t3) (pr2_thin_dx c +t3 t0 H0 u f) (THead (Flat f) u t4) H2))))))) t1 t2 H)))))). + +theorem pr3_head_1: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr3 c u1 u2) \to (\forall +(k: K).(\forall (t: T).(pr3 c (THead k u1 t) (THead k u2 t))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr3 c u1 +u2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (k: K).(\forall +(t1: T).(pr3 c (THead k t t1) (THead k t0 t1)))))) (\lambda (t: T).(\lambda +(k: K).(\lambda (t0: T).(pr3_refl c (THead k t t0))))) (\lambda (t2: +T).(\lambda (t1: T).(\lambda (H0: (pr2 c t1 t2)).(\lambda (t3: T).(\lambda +(_: (pr3 c t2 t3)).(\lambda (H2: ((\forall (k: K).(\forall (t: T).(pr3 c +(THead k t2 t) (THead k t3 t)))))).(\lambda (k: K).(\lambda (t: T).(pr3_sing +c (THead k t2 t) (THead k t1 t) (pr2_head_1 c t1 t2 H0 k t) (THead k t3 t) +(H2 k t)))))))))) u1 u2 H)))). + +theorem pr3_head_2: + \forall (c: C).(\forall (u: T).(\forall (t1: T).(\forall (t2: T).(\forall +(k: K).((pr3 (CHead c k u) t1 t2) \to (pr3 c (THead k u t1) (THead k u +t2))))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(k: K).(\lambda (H: (pr3 (CHead c k u) t1 t2)).(pr3_ind (CHead c k u) +(\lambda (t: T).(\lambda (t0: T).(pr3 c (THead k u t) (THead k u t0)))) +(\lambda (t: T).(pr3_refl c (THead k u t))) (\lambda (t0: T).(\lambda (t3: +T).(\lambda (H0: (pr2 (CHead c k u) t3 t0)).(\lambda (t4: T).(\lambda (_: +(pr3 (CHead c k u) t0 t4)).(\lambda (H2: (pr3 c (THead k u t0) (THead k u +t4))).(pr3_sing c (THead k u t0) (THead k u t3) (pr2_head_2 c u t3 t0 k H0) +(THead k u t4) H2))))))) t1 t2 H)))))). + +theorem pr3_head_21: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr3 c u1 u2) \to (\forall +(k: K).(\forall (t1: T).(\forall (t2: T).((pr3 (CHead c k u1) t1 t2) \to (pr3 +c (THead k u1 t1) (THead k u2 t2))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr3 c u1 +u2)).(\lambda (k: K).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pr3 +(CHead c k u1) t1 t2)).(pr3_t (THead k u1 t2) (THead k u1 t1) c (pr3_head_2 c +u1 t1 t2 k H0) (THead k u2 t2) (pr3_head_1 c u1 u2 H k t2))))))))). + +theorem pr3_head_12: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr3 c u1 u2) \to (\forall +(k: K).(\forall (t1: T).(\forall (t2: T).((pr3 (CHead c k u2) t1 t2) \to (pr3 +c (THead k u1 t1) (THead k u2 t2))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr3 c u1 +u2)).(\lambda (k: K).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pr3 +(CHead c k u2) t1 t2)).(pr3_t (THead k u2 t1) (THead k u1 t1) c (pr3_head_1 c +u1 u2 H k t1) (THead k u2 t2) (pr3_head_2 c u2 t1 t2 k H0))))))))). + +theorem pr3_cflat: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t1 t2) \to (\forall +(f: F).(\forall (v: T).(pr3 (CHead c (Flat f) v) t1 t2)))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c t1 +t2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (f: F).(\forall (v: +T).(pr3 (CHead c (Flat f) v) t t0))))) (\lambda (t: T).(\lambda (f: +F).(\lambda (v: T).(pr3_refl (CHead c (Flat f) v) t)))) (\lambda (t3: +T).(\lambda (t4: T).(\lambda (H0: (pr2 c t4 t3)).(\lambda (t5: T).(\lambda +(_: (pr3 c t3 t5)).(\lambda (H2: ((\forall (f: F).(\forall (v: T).(pr3 (CHead +c (Flat f) v) t3 t5))))).(\lambda (f: F).(\lambda (v: T).(pr3_sing (CHead c +(Flat f) v) t3 t4 (pr2_cflat c t4 t3 H0 f v) t5 (H2 f v)))))))))) t1 t2 H)))). + +theorem pr3_flat: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr3 c u1 u2) \to (\forall +(t1: T).(\forall (t2: T).((pr3 c t1 t2) \to (\forall (f: F).(pr3 c (THead +(Flat f) u1 t1) (THead (Flat f) u2 t2))))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr3 c u1 +u2)).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pr3 c t1 t2)).(\lambda +(f: F).(pr3_head_12 c u1 u2 H (Flat f) t1 t2 (pr3_cflat c t1 t2 H0 f +u2))))))))). + +theorem pr3_pr0_pr2_t: + \forall (u1: T).(\forall (u2: T).((pr0 u1 u2) \to (\forall (c: C).(\forall +(t1: T).(\forall (t2: T).(\forall (k: K).((pr2 (CHead c k u2) t1 t2) \to (pr3 +(CHead c k u1) t1 t2)))))))) +\def + \lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr0 u1 u2)).(\lambda (c: +C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (k: K).(\lambda (H0: (pr2 +(CHead c k u2) t1 t2)).(let H1 \def (match H0 in pr2 return (\lambda (c0: +C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 +(CHead c k u2)) \to ((eq T t t1) \to ((eq T t0 t2) \to (pr3 (CHead c k u1) t1 +t2)))))))) with [(pr2_free c0 t0 t3 H1) \Rightarrow (\lambda (H2: (eq C c0 +(CHead c k u2))).(\lambda (H3: (eq T t0 t1)).(\lambda (H4: (eq T t3 +t2)).(eq_ind C (CHead c k u2) (\lambda (_: C).((eq T t0 t1) \to ((eq T t3 t2) +\to ((pr0 t0 t3) \to (pr3 (CHead c k u1) t1 t2))))) (\lambda (H5: (eq T t0 +t1)).(eq_ind T t1 (\lambda (t: T).((eq T t3 t2) \to ((pr0 t t3) \to (pr3 +(CHead c k u1) t1 t2)))) (\lambda (H6: (eq T t3 t2)).(eq_ind T t2 (\lambda +(t: T).((pr0 t1 t) \to (pr3 (CHead c k u1) t1 t2))) (\lambda (H7: (pr0 t1 +t2)).(pr3_pr2 (CHead c k u1) t1 t2 (pr2_free (CHead c k u1) t1 t2 H7))) t3 +(sym_eq T t3 t2 H6))) t0 (sym_eq T t0 t1 H5))) c0 (sym_eq C c0 (CHead c k u2) +H2) H3 H4 H1)))) | (pr2_delta c0 d u i H1 t0 t3 H2 t H3) \Rightarrow (\lambda +(H4: (eq C c0 (CHead c k u2))).(\lambda (H5: (eq T t0 t1)).(\lambda (H6: (eq +T t t2)).(eq_ind C (CHead c k u2) (\lambda (c1: C).((eq T t0 t1) \to ((eq T t +t2) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 t0 t3) \to ((subst0 i +u t3 t) \to (pr3 (CHead c k u1) t1 t2))))))) (\lambda (H7: (eq T t0 +t1)).(eq_ind T t1 (\lambda (t4: T).((eq T t t2) \to ((getl i (CHead c k u2) +(CHead d (Bind Abbr) u)) \to ((pr0 t4 t3) \to ((subst0 i u t3 t) \to (pr3 +(CHead c k u1) t1 t2)))))) (\lambda (H8: (eq T t t2)).(eq_ind T t2 (\lambda +(t4: T).((getl i (CHead c k u2) (CHead d (Bind Abbr) u)) \to ((pr0 t1 t3) \to +((subst0 i u t3 t4) \to (pr3 (CHead c k u1) t1 t2))))) (\lambda (H9: (getl i +(CHead c k u2) (CHead d (Bind Abbr) u))).(\lambda (H10: (pr0 t1 t3)).(\lambda +(H11: (subst0 i u t3 t2)).(nat_ind (\lambda (n: nat).((getl n (CHead c k u2) +(CHead d (Bind Abbr) u)) \to ((subst0 n u t3 t2) \to (pr3 (CHead c k u1) t1 +t2)))) (\lambda (H12: (getl O (CHead c k u2) (CHead d (Bind Abbr) +u))).(\lambda (H13: (subst0 O u t3 t2)).(K_ind (\lambda (k0: K).((getl O +(CHead c k0 u2) (CHead d (Bind Abbr) u)) \to (pr3 (CHead c k0 u1) t1 t2))) +(\lambda (b: B).(\lambda (H14: (getl O (CHead c (Bind b) u2) (CHead d (Bind +Abbr) u))).(let H15 \def (f_equal C C (\lambda (e: C).(match e in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c1 _ _) \Rightarrow +c1])) (CHead d (Bind Abbr) u) (CHead c (Bind b) u2) (clear_gen_bind b c +(CHead d (Bind Abbr) u) u2 (getl_gen_O (CHead c (Bind b) u2) (CHead d (Bind +Abbr) u) H14))) in ((let H16 \def (f_equal C B (\lambda (e: C).(match e in C +return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k0 _) +\Rightarrow (match k0 in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) +(CHead c (Bind b) u2) (clear_gen_bind b c (CHead d (Bind Abbr) u) u2 +(getl_gen_O (CHead c (Bind b) u2) (CHead d (Bind Abbr) u) H14))) in ((let H17 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t4) \Rightarrow t4])) (CHead d +(Bind Abbr) u) (CHead c (Bind b) u2) (clear_gen_bind b c (CHead d (Bind Abbr) +u) u2 (getl_gen_O (CHead c (Bind b) u2) (CHead d (Bind Abbr) u) H14))) in +(\lambda (H18: (eq B Abbr b)).(\lambda (_: (eq C d c)).(let H20 \def (eq_ind +T u (\lambda (t4: T).(subst0 O t4 t3 t2)) H13 u2 H17) in (eq_ind B Abbr +(\lambda (b0: B).(pr3 (CHead c (Bind b0) u1) t1 t2)) (ex2_ind T (\lambda (t4: +T).(subst0 O u1 t3 t4)) (\lambda (t4: T).(pr0 t4 t2)) (pr3 (CHead c (Bind +Abbr) u1) t1 t2) (\lambda (x: T).(\lambda (H21: (subst0 O u1 t3 x)).(\lambda +(H22: (pr0 x t2)).(pr3_sing (CHead c (Bind Abbr) u1) x t1 (pr2_delta (CHead c +(Bind Abbr) u1) c u1 O (getl_refl Abbr c u1) t1 t3 H10 x H21) t2 (pr3_pr2 +(CHead c (Bind Abbr) u1) x t2 (pr2_free (CHead c (Bind Abbr) u1) x t2 +H22)))))) (pr0_subst0_back u2 t3 t2 O H20 u1 H)) b H18))))) H16)) H15)))) +(\lambda (f: F).(\lambda (H14: (getl O (CHead c (Flat f) u2) (CHead d (Bind +Abbr) u))).(pr3_pr2 (CHead c (Flat f) u1) t1 t2 (pr2_cflat c t1 t2 (pr2_delta +c d u O (getl_intro O c (CHead d (Bind Abbr) u) c (drop_refl c) +(clear_gen_flat f c (CHead d (Bind Abbr) u) u2 (getl_gen_O (CHead c (Flat f) +u2) (CHead d (Bind Abbr) u) H14))) t1 t3 H10 t2 H13) f u1)))) k H12))) +(\lambda (i0: nat).(\lambda (IHi: (((getl i0 (CHead c k u2) (CHead d (Bind +Abbr) u)) \to ((subst0 i0 u t3 t2) \to (pr3 (CHead c k u1) t1 +t2))))).(\lambda (H12: (getl (S i0) (CHead c k u2) (CHead d (Bind Abbr) +u))).(\lambda (H13: (subst0 (S i0) u t3 t2)).(K_ind (\lambda (k0: K).((getl +(S i0) (CHead c k0 u2) (CHead d (Bind Abbr) u)) \to ((((getl i0 (CHead c k0 +u2) (CHead d (Bind Abbr) u)) \to ((subst0 i0 u t3 t2) \to (pr3 (CHead c k0 +u1) t1 t2)))) \to (pr3 (CHead c k0 u1) t1 t2)))) (\lambda (b: B).(\lambda +(H14: (getl (S i0) (CHead c (Bind b) u2) (CHead d (Bind Abbr) u))).(\lambda +(_: (((getl i0 (CHead c (Bind b) u2) (CHead d (Bind Abbr) u)) \to ((subst0 i0 +u t3 t2) \to (pr3 (CHead c (Bind b) u1) t1 t2))))).(pr3_pr2 (CHead c (Bind b) +u1) t1 t2 (pr2_delta (CHead c (Bind b) u1) d u (S i0) (getl_head (Bind b) i0 +c (CHead d (Bind Abbr) u) (getl_gen_S (Bind b) c (CHead d (Bind Abbr) u) u2 +i0 H14) u1) t1 t3 H10 t2 H13))))) (\lambda (f: F).(\lambda (H14: (getl (S i0) +(CHead c (Flat f) u2) (CHead d (Bind Abbr) u))).(\lambda (_: (((getl i0 +(CHead c (Flat f) u2) (CHead d (Bind Abbr) u)) \to ((subst0 i0 u t3 t2) \to +(pr3 (CHead c (Flat f) u1) t1 t2))))).(pr3_pr2 (CHead c (Flat f) u1) t1 t2 +(pr2_cflat c t1 t2 (pr2_delta c d u (r (Flat f) i0) (getl_gen_S (Flat f) c +(CHead d (Bind Abbr) u) u2 i0 H14) t1 t3 H10 t2 H13) f u1))))) k H12 IHi))))) +i H9 H11)))) t (sym_eq T t t2 H8))) t0 (sym_eq T t0 t1 H7))) c0 (sym_eq C c0 +(CHead c k u2) H4) H5 H6 H1 H2 H3))))]) in (H1 (refl_equal C (CHead c k u2)) +(refl_equal T t1) (refl_equal T t2)))))))))). + +theorem pr3_pr2_pr2_t: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr2 c u1 u2) \to (\forall +(t1: T).(\forall (t2: T).(\forall (k: K).((pr2 (CHead c k u2) t1 t2) \to (pr3 +(CHead c k u1) t1 t2)))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr2 c u1 +u2)).(let H0 \def (match H in pr2 return (\lambda (c0: C).(\lambda (t: +T).(\lambda (t0: T).(\lambda (_: (pr2 c0 t t0)).((eq C c0 c) \to ((eq T t u1) +\to ((eq T t0 u2) \to (\forall (t1: T).(\forall (t2: T).(\forall (k: K).((pr2 +(CHead c k u2) t1 t2) \to (pr3 (CHead c k u1) t1 t2)))))))))))) with +[(pr2_free c0 t1 t2 H0) \Rightarrow (\lambda (H1: (eq C c0 c)).(\lambda (H2: +(eq T t1 u1)).(\lambda (H3: (eq T t2 u2)).(eq_ind C c (\lambda (_: C).((eq T +t1 u1) \to ((eq T t2 u2) \to ((pr0 t1 t2) \to (\forall (t3: T).(\forall (t4: +T).(\forall (k: K).((pr2 (CHead c k u2) t3 t4) \to (pr3 (CHead c k u1) t3 +t4))))))))) (\lambda (H4: (eq T t1 u1)).(eq_ind T u1 (\lambda (t: T).((eq T +t2 u2) \to ((pr0 t t2) \to (\forall (t3: T).(\forall (t4: T).(\forall (k: +K).((pr2 (CHead c k u2) t3 t4) \to (pr3 (CHead c k u1) t3 t4)))))))) (\lambda +(H5: (eq T t2 u2)).(eq_ind T u2 (\lambda (t: T).((pr0 u1 t) \to (\forall (t3: +T).(\forall (t4: T).(\forall (k: K).((pr2 (CHead c k u2) t3 t4) \to (pr3 +(CHead c k u1) t3 t4))))))) (\lambda (H6: (pr0 u1 u2)).(\lambda (t3: +T).(\lambda (t4: T).(\lambda (k: K).(\lambda (H7: (pr2 (CHead c k u2) t3 +t4)).(pr3_pr0_pr2_t u1 u2 H6 c t3 t4 k H7)))))) t2 (sym_eq T t2 u2 H5))) t1 +(sym_eq T t1 u1 H4))) c0 (sym_eq C c0 c H1) H2 H3 H0)))) | (pr2_delta c0 d u +i H0 t1 t2 H1 t H2) \Rightarrow (\lambda (H3: (eq C c0 c)).(\lambda (H4: (eq +T t1 u1)).(\lambda (H5: (eq T t u2)).(eq_ind C c (\lambda (c1: C).((eq T t1 +u1) \to ((eq T t u2) \to ((getl i c1 (CHead d (Bind Abbr) u)) \to ((pr0 t1 +t2) \to ((subst0 i u t2 t) \to (\forall (t3: T).(\forall (t4: T).(\forall (k: +K).((pr2 (CHead c k u2) t3 t4) \to (pr3 (CHead c k u1) t3 t4))))))))))) +(\lambda (H6: (eq T t1 u1)).(eq_ind T u1 (\lambda (t0: T).((eq T t u2) \to +((getl i c (CHead d (Bind Abbr) u)) \to ((pr0 t0 t2) \to ((subst0 i u t2 t) +\to (\forall (t3: T).(\forall (t4: T).(\forall (k: K).((pr2 (CHead c k u2) t3 +t4) \to (pr3 (CHead c k u1) t3 t4)))))))))) (\lambda (H7: (eq T t +u2)).(eq_ind T u2 (\lambda (t0: T).((getl i c (CHead d (Bind Abbr) u)) \to +((pr0 u1 t2) \to ((subst0 i u t2 t0) \to (\forall (t3: T).(\forall (t4: +T).(\forall (k: K).((pr2 (CHead c k u2) t3 t4) \to (pr3 (CHead c k u1) t3 +t4))))))))) (\lambda (H8: (getl i c (CHead d (Bind Abbr) u))).(\lambda (H9: +(pr0 u1 t2)).(\lambda (H10: (subst0 i u t2 u2)).(\lambda (t3: T).(\lambda +(t0: T).(\lambda (k: K).(\lambda (H11: (pr2 (CHead c k u2) t3 t0)).(let H12 +\def (match H11 in pr2 return (\lambda (c1: C).(\lambda (t4: T).(\lambda (t5: +T).(\lambda (_: (pr2 c1 t4 t5)).((eq C c1 (CHead c k u2)) \to ((eq T t4 t3) +\to ((eq T t5 t0) \to (pr3 (CHead c k u1) t3 t0)))))))) with [(pr2_free c1 t4 +t5 H12) \Rightarrow (\lambda (H13: (eq C c1 (CHead c k u2))).(\lambda (H14: +(eq T t4 t3)).(\lambda (H15: (eq T t5 t0)).(eq_ind C (CHead c k u2) (\lambda +(_: C).((eq T t4 t3) \to ((eq T t5 t0) \to ((pr0 t4 t5) \to (pr3 (CHead c k +u1) t3 t0))))) (\lambda (H16: (eq T t4 t3)).(eq_ind T t3 (\lambda (t6: +T).((eq T t5 t0) \to ((pr0 t6 t5) \to (pr3 (CHead c k u1) t3 t0)))) (\lambda +(H17: (eq T t5 t0)).(eq_ind T t0 (\lambda (t6: T).((pr0 t3 t6) \to (pr3 +(CHead c k u1) t3 t0))) (\lambda (H18: (pr0 t3 t0)).(pr3_pr2 (CHead c k u1) +t3 t0 (pr2_free (CHead c k u1) t3 t0 H18))) t5 (sym_eq T t5 t0 H17))) t4 +(sym_eq T t4 t3 H16))) c1 (sym_eq C c1 (CHead c k u2) H13) H14 H15 H12)))) | +(pr2_delta c1 d0 u0 i0 H12 t4 t5 H13 t6 H14) \Rightarrow (\lambda (H15: (eq C +c1 (CHead c k u2))).(\lambda (H16: (eq T t4 t3)).(\lambda (H17: (eq T t6 +t0)).(eq_ind C (CHead c k u2) (\lambda (c2: C).((eq T t4 t3) \to ((eq T t6 +t0) \to ((getl i0 c2 (CHead d0 (Bind Abbr) u0)) \to ((pr0 t4 t5) \to ((subst0 +i0 u0 t5 t6) \to (pr3 (CHead c k u1) t3 t0))))))) (\lambda (H18: (eq T t4 +t3)).(eq_ind T t3 (\lambda (t7: T).((eq T t6 t0) \to ((getl i0 (CHead c k u2) +(CHead d0 (Bind Abbr) u0)) \to ((pr0 t7 t5) \to ((subst0 i0 u0 t5 t6) \to +(pr3 (CHead c k u1) t3 t0)))))) (\lambda (H19: (eq T t6 t0)).(eq_ind T t0 +(\lambda (t7: T).((getl i0 (CHead c k u2) (CHead d0 (Bind Abbr) u0)) \to +((pr0 t3 t5) \to ((subst0 i0 u0 t5 t7) \to (pr3 (CHead c k u1) t3 t0))))) +(\lambda (H20: (getl i0 (CHead c k u2) (CHead d0 (Bind Abbr) u0))).(\lambda +(H21: (pr0 t3 t5)).(\lambda (H22: (subst0 i0 u0 t5 t0)).(nat_ind (\lambda (n: +nat).((getl n (CHead c k u2) (CHead d0 (Bind Abbr) u0)) \to ((subst0 n u0 t5 +t0) \to (pr3 (CHead c k u1) t3 t0)))) (\lambda (H23: (getl O (CHead c k u2) +(CHead d0 (Bind Abbr) u0))).(\lambda (H24: (subst0 O u0 t5 t0)).(K_ind +(\lambda (k0: K).((clear (CHead c k0 u2) (CHead d0 (Bind Abbr) u0)) \to (pr3 +(CHead c k0 u1) t3 t0))) (\lambda (b: B).(\lambda (H25: (clear (CHead c (Bind +b) u2) (CHead d0 (Bind Abbr) u0))).(let H26 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d0 | +(CHead c2 _ _) \Rightarrow c2])) (CHead d0 (Bind Abbr) u0) (CHead c (Bind b) +u2) (clear_gen_bind b c (CHead d0 (Bind Abbr) u0) u2 H25)) in ((let H27 \def +(f_equal C B (\lambda (e: C).(match e in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abbr | (CHead _ k0 _) \Rightarrow (match k0 in K +return (\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) +\Rightarrow Abbr])])) (CHead d0 (Bind Abbr) u0) (CHead c (Bind b) u2) +(clear_gen_bind b c (CHead d0 (Bind Abbr) u0) u2 H25)) in ((let H28 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow u0 | (CHead _ _ t7) \Rightarrow t7])) (CHead d0 (Bind +Abbr) u0) (CHead c (Bind b) u2) (clear_gen_bind b c (CHead d0 (Bind Abbr) u0) +u2 H25)) in (\lambda (H29: (eq B Abbr b)).(\lambda (_: (eq C d0 c)).(let H31 +\def (eq_ind T u0 (\lambda (t7: T).(subst0 O t7 t5 t0)) H24 u2 H28) in +(eq_ind B Abbr (\lambda (b0: B).(pr3 (CHead c (Bind b0) u1) t3 t0)) (ex2_ind +T (\lambda (t7: T).(subst0 O t2 t5 t7)) (\lambda (t7: T).(subst0 (S (plus i +O)) u t7 t0)) (pr3 (CHead c (Bind Abbr) u1) t3 t0) (\lambda (x: T).(\lambda +(H32: (subst0 O t2 t5 x)).(\lambda (H33: (subst0 (S (plus i O)) u x t0)).(let +H34 \def (f_equal nat nat S (plus i O) i (sym_eq nat i (plus i O) (plus_n_O +i))) in (let H35 \def (eq_ind nat (S (plus i O)) (\lambda (n: nat).(subst0 n +u x t0)) H33 (S i) H34) in (ex2_ind T (\lambda (t7: T).(subst0 O u1 t5 t7)) +(\lambda (t7: T).(pr0 t7 x)) (pr3 (CHead c (Bind Abbr) u1) t3 t0) (\lambda +(x0: T).(\lambda (H36: (subst0 O u1 t5 x0)).(\lambda (H37: (pr0 x0 +x)).(pr3_sing (CHead c (Bind Abbr) u1) x0 t3 (pr2_delta (CHead c (Bind Abbr) +u1) c u1 O (getl_refl Abbr c u1) t3 t5 H21 x0 H36) t0 (pr3_pr2 (CHead c (Bind +Abbr) u1) x0 t0 (pr2_delta (CHead c (Bind Abbr) u1) d u (S i) +(getl_clear_bind Abbr (CHead c (Bind Abbr) u1) c u1 (clear_bind Abbr c u1) +(CHead d (Bind Abbr) u) i H8) x0 x H37 t0 H35)))))) (pr0_subst0_back t2 t5 x +O H32 u1 H9))))))) (subst0_subst0 t5 t0 u2 O H31 t2 u i H10)) b H29))))) +H27)) H26)))) (\lambda (f: F).(\lambda (H25: (clear (CHead c (Flat f) u2) +(CHead d0 (Bind Abbr) u0))).(pr3_pr2 (CHead c (Flat f) u1) t3 t0 (pr2_cflat c +t3 t0 (pr2_delta c d0 u0 O (getl_intro O c (CHead d0 (Bind Abbr) u0) c +(drop_refl c) (clear_gen_flat f c (CHead d0 (Bind Abbr) u0) u2 H25)) t3 t5 +H21 t0 H24) f u1)))) k (getl_gen_O (CHead c k u2) (CHead d0 (Bind Abbr) u0) +H23)))) (\lambda (i1: nat).(\lambda (_: (((getl i1 (CHead c k u2) (CHead d0 +(Bind Abbr) u0)) \to ((subst0 i1 u0 t5 t0) \to (pr3 (CHead c k u1) t3 +t0))))).(\lambda (H23: (getl (S i1) (CHead c k u2) (CHead d0 (Bind Abbr) +u0))).(\lambda (H24: (subst0 (S i1) u0 t5 t0)).(K_ind (\lambda (k0: K).((getl +(S i1) (CHead c k0 u2) (CHead d0 (Bind Abbr) u0)) \to (pr3 (CHead c k0 u1) t3 +t0))) (\lambda (b: B).(\lambda (H25: (getl (S i1) (CHead c (Bind b) u2) +(CHead d0 (Bind Abbr) u0))).(pr3_pr2 (CHead c (Bind b) u1) t3 t0 (pr2_delta +(CHead c (Bind b) u1) d0 u0 (S i1) (getl_head (Bind b) i1 c (CHead d0 (Bind +Abbr) u0) (getl_gen_S (Bind b) c (CHead d0 (Bind Abbr) u0) u2 i1 H25) u1) t3 +t5 H21 t0 H24)))) (\lambda (f: F).(\lambda (H25: (getl (S i1) (CHead c (Flat +f) u2) (CHead d0 (Bind Abbr) u0))).(pr3_pr2 (CHead c (Flat f) u1) t3 t0 +(pr2_cflat c t3 t0 (pr2_delta c d0 u0 (r (Flat f) i1) (getl_gen_S (Flat f) c +(CHead d0 (Bind Abbr) u0) u2 i1 H25) t3 t5 H21 t0 H24) f u1)))) k H23))))) i0 +H20 H22)))) t6 (sym_eq T t6 t0 H19))) t4 (sym_eq T t4 t3 H18))) c1 (sym_eq C +c1 (CHead c k u2) H15) H16 H17 H12 H13 H14))))]) in (H12 (refl_equal C (CHead +c k u2)) (refl_equal T t3) (refl_equal T t0)))))))))) t (sym_eq T t u2 H7))) +t1 (sym_eq T t1 u1 H6))) c0 (sym_eq C c0 c H3) H4 H5 H0 H1 H2))))]) in (H0 +(refl_equal C c) (refl_equal T u1) (refl_equal T u2)))))). + +theorem pr3_pr2_pr3_t: + \forall (c: C).(\forall (u2: T).(\forall (t1: T).(\forall (t2: T).(\forall +(k: K).((pr3 (CHead c k u2) t1 t2) \to (\forall (u1: T).((pr2 c u1 u2) \to +(pr3 (CHead c k u1) t1 t2)))))))) +\def + \lambda (c: C).(\lambda (u2: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(k: K).(\lambda (H: (pr3 (CHead c k u2) t1 t2)).(pr3_ind (CHead c k u2) +(\lambda (t: T).(\lambda (t0: T).(\forall (u1: T).((pr2 c u1 u2) \to (pr3 +(CHead c k u1) t t0))))) (\lambda (t: T).(\lambda (u1: T).(\lambda (_: (pr2 c +u1 u2)).(pr3_refl (CHead c k u1) t)))) (\lambda (t0: T).(\lambda (t3: +T).(\lambda (H0: (pr2 (CHead c k u2) t3 t0)).(\lambda (t4: T).(\lambda (_: +(pr3 (CHead c k u2) t0 t4)).(\lambda (H2: ((\forall (u1: T).((pr2 c u1 u2) +\to (pr3 (CHead c k u1) t0 t4))))).(\lambda (u1: T).(\lambda (H3: (pr2 c u1 +u2)).(pr3_t t0 t3 (CHead c k u1) (pr3_pr2_pr2_t c u1 u2 H3 t3 t0 k H0) t4 (H2 +u1 H3)))))))))) t1 t2 H)))))). + +theorem pr3_pr3_pr3_t: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr3 c u1 u2) \to (\forall +(t1: T).(\forall (t2: T).(\forall (k: K).((pr3 (CHead c k u2) t1 t2) \to (pr3 +(CHead c k u1) t1 t2)))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr3 c u1 +u2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (t1: T).(\forall +(t2: T).(\forall (k: K).((pr3 (CHead c k t0) t1 t2) \to (pr3 (CHead c k t) t1 +t2))))))) (\lambda (t: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda (k: +K).(\lambda (H0: (pr3 (CHead c k t) t1 t2)).H0))))) (\lambda (t2: T).(\lambda +(t1: T).(\lambda (H0: (pr2 c t1 t2)).(\lambda (t3: T).(\lambda (_: (pr3 c t2 +t3)).(\lambda (H2: ((\forall (t4: T).(\forall (t5: T).(\forall (k: K).((pr3 +(CHead c k t3) t4 t5) \to (pr3 (CHead c k t2) t4 t5))))))).(\lambda (t0: +T).(\lambda (t4: T).(\lambda (k: K).(\lambda (H3: (pr3 (CHead c k t3) t0 +t4)).(pr3_pr2_pr3_t c t2 t0 t4 k (H2 t0 t4 k H3) t1 H0))))))))))) u1 u2 H)))). + +theorem pr3_lift: + \forall (c: C).(\forall (e: C).(\forall (h: nat).(\forall (d: nat).((drop h +d c e) \to (\forall (t1: T).(\forall (t2: T).((pr3 e t1 t2) \to (pr3 c (lift +h d t1) (lift h d t2))))))))) +\def + \lambda (c: C).(\lambda (e: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda +(H: (drop h d c e)).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pr3 e t1 +t2)).(pr3_ind e (\lambda (t: T).(\lambda (t0: T).(pr3 c (lift h d t) (lift h +d t0)))) (\lambda (t: T).(pr3_refl c (lift h d t))) (\lambda (t0: T).(\lambda +(t3: T).(\lambda (H1: (pr2 e t3 t0)).(\lambda (t4: T).(\lambda (_: (pr3 e t0 +t4)).(\lambda (H3: (pr3 c (lift h d t0) (lift h d t4))).(pr3_sing c (lift h d +t0) (lift h d t3) (pr2_lift c e h d H t3 t0 H1) (lift h d t4) H3))))))) t1 t2 +H0)))))))). + +theorem pr3_eta: + \forall (c: C).(\forall (w: T).(\forall (u: T).(let t \def (THead (Bind +Abst) w u) in (\forall (v: T).((pr3 c v w) \to (pr3 c (THead (Bind Abst) v +(THead (Flat Appl) (TLRef O) (lift (S O) O t))) t)))))) +\def + \lambda (c: C).(\lambda (w: T).(\lambda (u: T).(let t \def (THead (Bind +Abst) w u) in (\lambda (v: T).(\lambda (H: (pr3 c v w)).(eq_ind_r T (THead +(Bind Abst) (lift (S O) O w) (lift (S O) (S O) u)) (\lambda (t0: T).(pr3 c +(THead (Bind Abst) v (THead (Flat Appl) (TLRef O) t0)) (THead (Bind Abst) w +u))) (pr3_head_12 c v w H (Bind Abst) (THead (Flat Appl) (TLRef O) (THead +(Bind Abst) (lift (S O) O w) (lift (S O) (S O) u))) u (pr3_pr1 (THead (Flat +Appl) (TLRef O) (THead (Bind Abst) (lift (S O) O w) (lift (S O) (S O) u))) u +(pr1_sing (THead (Bind Abbr) (TLRef O) (lift (S O) (S O) u)) (THead (Flat +Appl) (TLRef O) (THead (Bind Abst) (lift (S O) O w) (lift (S O) (S O) u))) +(pr0_beta (lift (S O) O w) (TLRef O) (TLRef O) (pr0_refl (TLRef O)) (lift (S +O) (S O) u) (lift (S O) (S O) u) (pr0_refl (lift (S O) (S O) u))) u (pr1_sing +(THead (Bind Abbr) (TLRef O) (lift (S O) O u)) (THead (Bind Abbr) (TLRef O) +(lift (S O) (S O) u)) (pr0_delta1 (TLRef O) (TLRef O) (pr0_refl (TLRef O)) +(lift (S O) (S O) u) (lift (S O) (S O) u) (pr0_refl (lift (S O) (S O) u)) +(lift (S O) O u) (subst1_lift_S u O O (le_n O))) u (pr1_pr0 (THead (Bind +Abbr) (TLRef O) (lift (S O) O u)) u (pr0_zeta Abbr not_abbr_abst u u +(pr0_refl u) (TLRef O))))) (CHead c (Bind Abst) w))) (lift (S O) O (THead +(Bind Abst) w u)) (lift_bind Abst w u (S O) O))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/subst1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/subst1.ma new file mode 100644 index 000000000..4894993fc --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/subst1.ma @@ -0,0 +1,91 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr3/subst1". + +include "pr3/defs.ma". + +include "pr2/subst1.ma". + +theorem pr3_subst1: + \forall (c: C).(\forall (e: C).(\forall (v: T).(\forall (i: nat).((getl i c +(CHead e (Bind Abbr) v)) \to (\forall (t1: T).(\forall (t2: T).((pr3 c t1 t2) +\to (\forall (w1: T).((subst1 i v t1 w1) \to (ex2 T (\lambda (w2: T).(pr3 c +w1 w2)) (\lambda (w2: T).(subst1 i v t2 w2)))))))))))) +\def + \lambda (c: C).(\lambda (e: C).(\lambda (v: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead e (Bind Abbr) v))).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (H0: (pr3 c t1 t2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: +T).(\forall (w1: T).((subst1 i v t w1) \to (ex2 T (\lambda (w2: T).(pr3 c w1 +w2)) (\lambda (w2: T).(subst1 i v t0 w2))))))) (\lambda (t: T).(\lambda (w1: +T).(\lambda (H1: (subst1 i v t w1)).(ex_intro2 T (\lambda (w2: T).(pr3 c w1 +w2)) (\lambda (w2: T).(subst1 i v t w2)) w1 (pr3_refl c w1) H1)))) (\lambda +(t3: T).(\lambda (t4: T).(\lambda (H1: (pr2 c t4 t3)).(\lambda (t5: +T).(\lambda (_: (pr3 c t3 t5)).(\lambda (H3: ((\forall (w1: T).((subst1 i v +t3 w1) \to (ex2 T (\lambda (w2: T).(pr3 c w1 w2)) (\lambda (w2: T).(subst1 i +v t5 w2))))))).(\lambda (w1: T).(\lambda (H4: (subst1 i v t4 w1)).(ex2_ind T +(\lambda (w2: T).(pr2 c w1 w2)) (\lambda (w2: T).(subst1 i v t3 w2)) (ex2 T +(\lambda (w2: T).(pr3 c w1 w2)) (\lambda (w2: T).(subst1 i v t5 w2))) +(\lambda (x: T).(\lambda (H5: (pr2 c w1 x)).(\lambda (H6: (subst1 i v t3 +x)).(ex2_ind T (\lambda (w2: T).(pr3 c x w2)) (\lambda (w2: T).(subst1 i v t5 +w2)) (ex2 T (\lambda (w2: T).(pr3 c w1 w2)) (\lambda (w2: T).(subst1 i v t5 +w2))) (\lambda (x0: T).(\lambda (H7: (pr3 c x x0)).(\lambda (H8: (subst1 i v +t5 x0)).(ex_intro2 T (\lambda (w2: T).(pr3 c w1 w2)) (\lambda (w2: T).(subst1 +i v t5 w2)) x0 (pr3_sing c x w1 H5 x0 H7) H8)))) (H3 x H6))))) (pr2_subst1 c +e v i H t4 t3 H1 w1 H4)))))))))) t1 t2 H0)))))))). + +theorem pr3_gen_cabbr: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t1 t2) \to (\forall +(e: C).(\forall (u: T).(\forall (d: nat).((getl d c (CHead e (Bind Abbr) u)) +\to (\forall (a0: C).((csubst1 d u c a0) \to (\forall (a: C).((drop (S O) d +a0 a) \to (\forall (x1: T).((subst1 d u t1 (lift (S O) d x1)) \to (ex2 T +(\lambda (x2: T).(subst1 d u t2 (lift (S O) d x2))) (\lambda (x2: T).(pr3 a +x1 x2)))))))))))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c t1 +t2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (e: C).(\forall (u: +T).(\forall (d: nat).((getl d c (CHead e (Bind Abbr) u)) \to (\forall (a0: +C).((csubst1 d u c a0) \to (\forall (a: C).((drop (S O) d a0 a) \to (\forall +(x1: T).((subst1 d u t (lift (S O) d x1)) \to (ex2 T (\lambda (x2: T).(subst1 +d u t0 (lift (S O) d x2))) (\lambda (x2: T).(pr3 a x1 x2))))))))))))))) +(\lambda (t: T).(\lambda (e: C).(\lambda (u: T).(\lambda (d: nat).(\lambda +(_: (getl d c (CHead e (Bind Abbr) u))).(\lambda (a0: C).(\lambda (_: +(csubst1 d u c a0)).(\lambda (a: C).(\lambda (_: (drop (S O) d a0 +a)).(\lambda (x1: T).(\lambda (H3: (subst1 d u t (lift (S O) d +x1))).(ex_intro2 T (\lambda (x2: T).(subst1 d u t (lift (S O) d x2))) +(\lambda (x2: T).(pr3 a x1 x2)) x1 H3 (pr3_refl a x1))))))))))))) (\lambda +(t0: T).(\lambda (t3: T).(\lambda (H0: (pr2 c t3 t0)).(\lambda (t4: +T).(\lambda (_: (pr3 c t0 t4)).(\lambda (H2: ((\forall (e: C).(\forall (u: +T).(\forall (d: nat).((getl d c (CHead e (Bind Abbr) u)) \to (\forall (a0: +C).((csubst1 d u c a0) \to (\forall (a: C).((drop (S O) d a0 a) \to (\forall +(x1: T).((subst1 d u t0 (lift (S O) d x1)) \to (ex2 T (\lambda (x2: +T).(subst1 d u t4 (lift (S O) d x2))) (\lambda (x2: T).(pr3 a x1 +x2))))))))))))))).(\lambda (e: C).(\lambda (u: T).(\lambda (d: nat).(\lambda +(H3: (getl d c (CHead e (Bind Abbr) u))).(\lambda (a0: C).(\lambda (H4: +(csubst1 d u c a0)).(\lambda (a: C).(\lambda (H5: (drop (S O) d a0 +a)).(\lambda (x1: T).(\lambda (H6: (subst1 d u t3 (lift (S O) d +x1))).(ex2_ind T (\lambda (x2: T).(subst1 d u t0 (lift (S O) d x2))) (\lambda +(x2: T).(pr2 a x1 x2)) (ex2 T (\lambda (x2: T).(subst1 d u t4 (lift (S O) d +x2))) (\lambda (x2: T).(pr3 a x1 x2))) (\lambda (x: T).(\lambda (H7: (subst1 +d u t0 (lift (S O) d x))).(\lambda (H8: (pr2 a x1 x)).(ex2_ind T (\lambda +(x2: T).(subst1 d u t4 (lift (S O) d x2))) (\lambda (x2: T).(pr3 a x x2)) +(ex2 T (\lambda (x2: T).(subst1 d u t4 (lift (S O) d x2))) (\lambda (x2: +T).(pr3 a x1 x2))) (\lambda (x0: T).(\lambda (H9: (subst1 d u t4 (lift (S O) +d x0))).(\lambda (H10: (pr3 a x x0)).(ex_intro2 T (\lambda (x2: T).(subst1 d +u t4 (lift (S O) d x2))) (\lambda (x2: T).(pr3 a x1 x2)) x0 H9 (pr3_sing a x +x1 H8 x0 H10))))) (H2 e u d H3 a0 H4 a H5 x H7))))) (pr2_gen_cabbr c t3 t0 H0 +e u d H3 a0 H4 a H5 x1 H6)))))))))))))))))) t1 t2 H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/wcpr0.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/wcpr0.ma new file mode 100644 index 000000000..dd20dae41 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/wcpr0.ma @@ -0,0 +1,79 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pr3/wcpr0". + +include "pr3/props.ma". + +include "wcpr0/getl.ma". + +theorem pr3_wcpr0_t: + \forall (c1: C).(\forall (c2: C).((wcpr0 c2 c1) \to (\forall (t1: +T).(\forall (t2: T).((pr3 c1 t1 t2) \to (pr3 c2 t1 t2)))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: (wcpr0 c2 c1)).(wcpr0_ind +(\lambda (c: C).(\lambda (c0: C).(\forall (t1: T).(\forall (t2: T).((pr3 c0 +t1 t2) \to (pr3 c t1 t2)))))) (\lambda (c: C).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (H0: (pr3 c t1 t2)).H0)))) (\lambda (c0: C).(\lambda (c3: +C).(\lambda (H0: (wcpr0 c0 c3)).(\lambda (_: ((\forall (t1: T).(\forall (t2: +T).((pr3 c3 t1 t2) \to (pr3 c0 t1 t2)))))).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (H2: (pr0 u1 u2)).(\lambda (k: K).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (H3: (pr3 (CHead c3 k u2) t1 t2)).(pr3_ind (CHead c3 k u1) +(\lambda (t: T).(\lambda (t0: T).(pr3 (CHead c0 k u1) t t0))) (\lambda (t: +T).(pr3_refl (CHead c0 k u1) t)) (\lambda (t0: T).(\lambda (t3: T).(\lambda +(H4: (pr2 (CHead c3 k u1) t3 t0)).(\lambda (t4: T).(\lambda (_: (pr3 (CHead +c3 k u1) t0 t4)).(\lambda (H6: (pr3 (CHead c0 k u1) t0 t4)).(pr3_t t0 t3 +(CHead c0 k u1) (let H7 \def (match H4 in pr2 return (\lambda (c: C).(\lambda +(t: T).(\lambda (t5: T).(\lambda (_: (pr2 c t t5)).((eq C c (CHead c3 k u1)) +\to ((eq T t t3) \to ((eq T t5 t0) \to (pr3 (CHead c0 k u1) t3 t0)))))))) +with [(pr2_free c t5 t6 H7) \Rightarrow (\lambda (H8: (eq C c (CHead c3 k +u1))).(\lambda (H9: (eq T t5 t3)).(\lambda (H10: (eq T t6 t0)).(eq_ind C +(CHead c3 k u1) (\lambda (_: C).((eq T t5 t3) \to ((eq T t6 t0) \to ((pr0 t5 +t6) \to (pr3 (CHead c0 k u1) t3 t0))))) (\lambda (H11: (eq T t5 t3)).(eq_ind +T t3 (\lambda (t: T).((eq T t6 t0) \to ((pr0 t t6) \to (pr3 (CHead c0 k u1) +t3 t0)))) (\lambda (H12: (eq T t6 t0)).(eq_ind T t0 (\lambda (t: T).((pr0 t3 +t) \to (pr3 (CHead c0 k u1) t3 t0))) (\lambda (H13: (pr0 t3 t0)).(pr3_pr2 +(CHead c0 k u1) t3 t0 (pr2_free (CHead c0 k u1) t3 t0 H13))) t6 (sym_eq T t6 +t0 H12))) t5 (sym_eq T t5 t3 H11))) c (sym_eq C c (CHead c3 k u1) H8) H9 H10 +H7)))) | (pr2_delta c d u i H7 t5 t6 H8 t H9) \Rightarrow (\lambda (H10: (eq +C c (CHead c3 k u1))).(\lambda (H11: (eq T t5 t3)).(\lambda (H12: (eq T t +t0)).(eq_ind C (CHead c3 k u1) (\lambda (c4: C).((eq T t5 t3) \to ((eq T t +t0) \to ((getl i c4 (CHead d (Bind Abbr) u)) \to ((pr0 t5 t6) \to ((subst0 i +u t6 t) \to (pr3 (CHead c0 k u1) t3 t0))))))) (\lambda (H13: (eq T t5 +t3)).(eq_ind T t3 (\lambda (t7: T).((eq T t t0) \to ((getl i (CHead c3 k u1) +(CHead d (Bind Abbr) u)) \to ((pr0 t7 t6) \to ((subst0 i u t6 t) \to (pr3 +(CHead c0 k u1) t3 t0)))))) (\lambda (H14: (eq T t t0)).(eq_ind T t0 (\lambda +(t7: T).((getl i (CHead c3 k u1) (CHead d (Bind Abbr) u)) \to ((pr0 t3 t6) +\to ((subst0 i u t6 t7) \to (pr3 (CHead c0 k u1) t3 t0))))) (\lambda (H15: +(getl i (CHead c3 k u1) (CHead d (Bind Abbr) u))).(\lambda (H16: (pr0 t3 +t6)).(\lambda (H17: (subst0 i u t6 t0)).(ex3_2_ind C T (\lambda (e2: +C).(\lambda (u3: T).(getl i (CHead c0 k u1) (CHead e2 (Bind Abbr) u3)))) +(\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 d))) (\lambda (_: C).(\lambda (u3: +T).(pr0 u3 u))) (pr3 (CHead c0 k u1) t3 t0) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (H18: (getl i (CHead c0 k u1) (CHead x0 (Bind Abbr) +x1))).(\lambda (_: (wcpr0 x0 d)).(\lambda (H20: (pr0 x1 u)).(ex2_ind T +(\lambda (t7: T).(subst0 i x1 t6 t7)) (\lambda (t7: T).(pr0 t7 t0)) (pr3 +(CHead c0 k u1) t3 t0) (\lambda (x: T).(\lambda (H21: (subst0 i x1 t6 +x)).(\lambda (H22: (pr0 x t0)).(pr3_sing (CHead c0 k u1) x t3 (pr2_delta +(CHead c0 k u1) x0 x1 i H18 t3 t6 H16 x H21) t0 (pr3_pr2 (CHead c0 k u1) x t0 +(pr2_free (CHead c0 k u1) x t0 H22)))))) (pr0_subst0_back u t6 t0 i H17 x1 +H20))))))) (wcpr0_getl_back (CHead c3 k u1) (CHead c0 k u1) (wcpr0_comp c0 c3 +H0 u1 u1 (pr0_refl u1) k) i d u (Bind Abbr) H15))))) t (sym_eq T t t0 H14))) +t5 (sym_eq T t5 t3 H13))) c (sym_eq C c (CHead c3 k u1) H10) H11 H12 H7 H8 +H9))))]) in (H7 (refl_equal C (CHead c3 k u1)) (refl_equal T t3) (refl_equal +T t0))) t4 H6))))))) t1 t2 (pr3_pr2_pr3_t c3 u2 t1 t2 k H3 u1 (pr2_free c3 u1 +u2 H2)))))))))))))) c2 c1 H))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/preamble.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/preamble.ma new file mode 100644 index 000000000..f9dc333af --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/preamble.ma @@ -0,0 +1,42 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/preamble". + +include "../Base-1/theory.ma". + +alias id "and_ind" = "cic:/Coq/Init/Logic/and_ind.con". +alias id "bool_ind" = "cic:/Coq/Init/Datatypes/bool_ind.con". +alias id "ex" = "cic:/Coq/Init/Logic/ex.ind#xpointer(1/1)". +alias id "ex_ind" = "cic:/Coq/Init/Logic/ex_ind.con". +alias id "ex_intro" = "cic:/Coq/Init/Logic/ex.ind#xpointer(1/1/1)". +alias id "f_equal2" = "cic:/Coq/Init/Logic/f_equal2.con". +alias id "f_equal3" = "cic:/Coq/Init/Logic/f_equal3.con". +alias id "le_antisym" = "cic:/Coq/Arith/Le/le_antisym.con". +alias id "le_lt_trans" = "cic:/Coq/Arith/Lt/le_lt_trans.con". +alias id "le_plus_trans" = "cic:/Coq/Arith/Plus/le_plus_trans.con". +alias id "lt_le_trans" = "cic:/Coq/Arith/Lt/lt_le_trans.con". +alias id "lt_n_Sn" = "cic:/Coq/Arith/Lt/lt_n_Sn.con". +alias id "lt_S_n" = "cic:/Coq/Arith/Lt/lt_S_n.con". +alias id "lt_trans" = "cic:/Coq/Arith/Lt/lt_trans.con". +alias id "lt_wf_ind" = "cic:/Coq/Arith/Wf_nat/lt_wf_ind.con". +alias id "minus_n_n" = "cic:/Coq/Arith/Minus/minus_n_n.con". +alias id "minus_Sn_m" = "cic:/Coq/Arith/Minus/minus_Sn_m.con". +alias id "plus_le_lt_compat" = "cic:/Coq/Arith/Plus/plus_le_lt_compat.con". +alias id "plus_lt_compat" = "cic:/Coq/Arith/Plus/plus_lt_compat.con". +alias id "plus_lt_compat_r" = "cic:/Coq/Arith/Plus/plus_lt_compat_r.con". +alias id "plus_lt_le_compat" = "cic:/Coq/Arith/Plus/plus_lt_le_compat.con". +alias id "plus_n_O" = "cic:/Coq/Init/Peano/plus_n_O.con". +alias id "plus_Snm_nSm" = "cic:/Coq/Arith/Plus/plus_Snm_nSm.con". +alias id "S_pred" = "cic:/Coq/Arith/Lt/S_pred.con". diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/defs.ma new file mode 100644 index 000000000..005f3a107 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/defs.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/r/defs". + +include "T/defs.ma". + +definition r: + K \to (nat \to nat) +\def + \lambda (k: K).(\lambda (i: nat).(match k with [(Bind _) \Rightarrow i | +(Flat _) \Rightarrow (S i)])). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/props.ma new file mode 100644 index 000000000..505d1e450 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/props.ma @@ -0,0 +1,95 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/r/props". + +include "r/defs.ma". + +include "s/defs.ma". + +theorem r_S: + \forall (k: K).(\forall (i: nat).(eq nat (r k (S i)) (S (r k i)))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(eq nat (r k0 (S +i)) (S (r k0 i))))) (\lambda (b: B).(\lambda (i: nat).(refl_equal nat (S (r +(Bind b) i))))) (\lambda (f: F).(\lambda (i: nat).(refl_equal nat (S (r (Flat +f) i))))) k). + +theorem r_plus: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).(eq nat (r k (plus i j)) +(plus (r k i) j)))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(\forall (j: +nat).(eq nat (r k0 (plus i j)) (plus (r k0 i) j))))) (\lambda (b: B).(\lambda +(i: nat).(\lambda (j: nat).(refl_equal nat (plus (r (Bind b) i) j))))) +(\lambda (f: F).(\lambda (i: nat).(\lambda (j: nat).(refl_equal nat (plus (r +(Flat f) i) j))))) k). + +theorem r_plus_sym: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).(eq nat (r k (plus i j)) +(plus i (r k j))))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(\forall (j: +nat).(eq nat (r k0 (plus i j)) (plus i (r k0 j)))))) (\lambda (_: B).(\lambda +(i: nat).(\lambda (j: nat).(refl_equal nat (plus i j))))) (\lambda (_: +F).(\lambda (i: nat).(\lambda (j: nat).(plus_n_Sm i j)))) k). + +theorem r_minus: + \forall (i: nat).(\forall (n: nat).((lt n i) \to (\forall (k: K).(eq nat +(minus (r k i) (S n)) (r k (minus i (S n))))))) +\def + \lambda (i: nat).(\lambda (n: nat).(\lambda (H: (lt n i)).(\lambda (k: +K).(K_ind (\lambda (k0: K).(eq nat (minus (r k0 i) (S n)) (r k0 (minus i (S +n))))) (\lambda (_: B).(refl_equal nat (minus i (S n)))) (\lambda (_: +F).(minus_x_Sy i n H)) k)))). + +theorem r_dis: + \forall (k: K).(\forall (P: Prop).(((((\forall (i: nat).(eq nat (r k i) i))) +\to P)) \to (((((\forall (i: nat).(eq nat (r k i) (S i)))) \to P)) \to P))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (P: Prop).(((((\forall (i: +nat).(eq nat (r k0 i) i))) \to P)) \to (((((\forall (i: nat).(eq nat (r k0 i) +(S i)))) \to P)) \to P)))) (\lambda (b: B).(\lambda (P: Prop).(\lambda (H: +((((\forall (i: nat).(eq nat (r (Bind b) i) i))) \to P))).(\lambda (_: +((((\forall (i: nat).(eq nat (r (Bind b) i) (S i)))) \to P))).(H (\lambda (i: +nat).(refl_equal nat i))))))) (\lambda (f: F).(\lambda (P: Prop).(\lambda (_: +((((\forall (i: nat).(eq nat (r (Flat f) i) i))) \to P))).(\lambda (H0: +((((\forall (i: nat).(eq nat (r (Flat f) i) (S i)))) \to P))).(H0 (\lambda +(i: nat).(refl_equal nat (S i)))))))) k). + +theorem s_r: + \forall (k: K).(\forall (i: nat).(eq nat (s k (r k i)) (S i))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(eq nat (s k0 (r k0 +i)) (S i)))) (\lambda (_: B).(\lambda (i: nat).(refl_equal nat (S i)))) +(\lambda (_: F).(\lambda (i: nat).(refl_equal nat (S i)))) k). + +theorem r_arith0: + \forall (k: K).(\forall (i: nat).(eq nat (minus (r k (S i)) (S O)) (r k i))) +\def + \lambda (k: K).(\lambda (i: nat).(eq_ind_r nat (S (r k i)) (\lambda (n: +nat).(eq nat (minus n (S O)) (r k i))) (eq_ind_r nat (r k i) (\lambda (n: +nat).(eq nat n (r k i))) (refl_equal nat (r k i)) (minus (S (r k i)) (S O)) +(minus_Sx_SO (r k i))) (r k (S i)) (r_S k i))). + +theorem r_arith1: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).(eq nat (minus (r k (S +i)) (S j)) (minus (r k i) j)))) +\def + \lambda (k: K).(\lambda (i: nat).(\lambda (j: nat).(eq_ind_r nat (S (r k i)) +(\lambda (n: nat).(eq nat (minus n (S j)) (minus (r k i) j))) (refl_equal nat +(minus (r k i) j)) (r k (S i)) (r_S k i)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/defs.ma new file mode 100644 index 000000000..6cb9d340f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/defs.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/s/defs". + +include "T/defs.ma". + +definition s: + K \to (nat \to nat) +\def + \lambda (k: K).(\lambda (i: nat).(match k with [(Bind _) \Rightarrow (S i) | +(Flat _) \Rightarrow i])). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/props.ma new file mode 100644 index 000000000..7acdf612f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/props.ma @@ -0,0 +1,120 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/s/props". + +include "s/defs.ma". + +theorem s_S: + \forall (k: K).(\forall (i: nat).(eq nat (s k (S i)) (S (s k i)))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(eq nat (s k0 (S +i)) (S (s k0 i))))) (\lambda (b: B).(\lambda (i: nat).(refl_equal nat (S (s +(Bind b) i))))) (\lambda (f: F).(\lambda (i: nat).(refl_equal nat (S (s (Flat +f) i))))) k). + +theorem s_plus: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).(eq nat (s k (plus i j)) +(plus (s k i) j)))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(\forall (j: +nat).(eq nat (s k0 (plus i j)) (plus (s k0 i) j))))) (\lambda (b: B).(\lambda +(i: nat).(\lambda (j: nat).(refl_equal nat (plus (s (Bind b) i) j))))) +(\lambda (f: F).(\lambda (i: nat).(\lambda (j: nat).(refl_equal nat (plus (s +(Flat f) i) j))))) k). + +theorem s_plus_sym: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).(eq nat (s k (plus i j)) +(plus i (s k j))))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(\forall (j: +nat).(eq nat (s k0 (plus i j)) (plus i (s k0 j)))))) (\lambda (_: B).(\lambda +(i: nat).(\lambda (j: nat).(eq_ind_r nat (plus i (S j)) (\lambda (n: nat).(eq +nat n (plus i (S j)))) (refl_equal nat (plus i (S j))) (S (plus i j)) +(plus_n_Sm i j))))) (\lambda (f: F).(\lambda (i: nat).(\lambda (j: +nat).(refl_equal nat (plus i (s (Flat f) j)))))) k). + +theorem s_minus: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).((le j i) \to (eq nat (s +k (minus i j)) (minus (s k i) j))))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(\forall (j: +nat).((le j i) \to (eq nat (s k0 (minus i j)) (minus (s k0 i) j)))))) +(\lambda (_: B).(\lambda (i: nat).(\lambda (j: nat).(\lambda (H: (le j +i)).(eq_ind_r nat (minus (S i) j) (\lambda (n: nat).(eq nat n (minus (S i) +j))) (refl_equal nat (minus (S i) j)) (S (minus i j)) (minus_Sn_m i j H)))))) +(\lambda (f: F).(\lambda (i: nat).(\lambda (j: nat).(\lambda (_: (le j +i)).(refl_equal nat (minus (s (Flat f) i) j)))))) k). + +theorem minus_s_s: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).(eq nat (minus (s k i) (s +k j)) (minus i j)))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(\forall (j: +nat).(eq nat (minus (s k0 i) (s k0 j)) (minus i j))))) (\lambda (_: +B).(\lambda (i: nat).(\lambda (j: nat).(refl_equal nat (minus i j))))) +(\lambda (_: F).(\lambda (i: nat).(\lambda (j: nat).(refl_equal nat (minus i +j))))) k). + +theorem s_le: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).((le i j) \to (le (s k i) +(s k j))))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(\forall (j: +nat).((le i j) \to (le (s k0 i) (s k0 j)))))) (\lambda (_: B).(\lambda (i: +nat).(\lambda (j: nat).(\lambda (H: (le i j)).(le_n_S i j H))))) (\lambda (_: +F).(\lambda (i: nat).(\lambda (j: nat).(\lambda (H: (le i j)).H)))) k). + +theorem s_lt: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).((lt i j) \to (lt (s k i) +(s k j))))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(\forall (j: +nat).((lt i j) \to (lt (s k0 i) (s k0 j)))))) (\lambda (_: B).(\lambda (i: +nat).(\lambda (j: nat).(\lambda (H: (lt i j)).(le_n_S (S i) j H))))) (\lambda +(_: F).(\lambda (i: nat).(\lambda (j: nat).(\lambda (H: (lt i j)).H)))) k). + +theorem s_inj: + \forall (k: K).(\forall (i: nat).(\forall (j: nat).((eq nat (s k i) (s k j)) +\to (eq nat i j)))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(\forall (j: +nat).((eq nat (s k0 i) (s k0 j)) \to (eq nat i j))))) (\lambda (b: +B).(\lambda (i: nat).(\lambda (j: nat).(\lambda (H: (eq nat (s (Bind b) i) (s +(Bind b) j))).(eq_add_S i j H))))) (\lambda (f: F).(\lambda (i: nat).(\lambda +(j: nat).(\lambda (H: (eq nat (s (Flat f) i) (s (Flat f) j))).H)))) k). + +theorem s_inc: + \forall (k: K).(\forall (i: nat).(le i (s k i))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (i: nat).(le i (s k0 i)))) +(\lambda (b: B).(\lambda (i: nat).(le_S_n i (s (Bind b) i) (le_S (S i) (s +(Bind b) i) (le_n (s (Bind b) i)))))) (\lambda (f: F).(\lambda (i: nat).(le_n +(s (Flat f) i)))) k). + +theorem s_arith0: + \forall (k: K).(\forall (i: nat).(eq nat (minus (s k i) (s k O)) i)) +\def + \lambda (k: K).(\lambda (i: nat).(eq_ind_r nat (minus i O) (\lambda (n: +nat).(eq nat n i)) (eq_ind nat i (\lambda (n: nat).(eq nat n i)) (refl_equal +nat i) (minus i O) (minus_n_O i)) (minus (s k i) (s k O)) (minus_s_s k i O))). + +theorem s_arith1: + \forall (b: B).(\forall (i: nat).(eq nat (minus (s (Bind b) i) (S O)) i)) +\def + \lambda (_: B).(\lambda (i: nat).(eq_ind nat i (\lambda (n: nat).(eq nat n +i)) (refl_equal nat i) (minus i O) (minus_n_O i))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/arity.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/arity.ma new file mode 100644 index 000000000..e7f13ac61 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/arity.ma @@ -0,0 +1,307 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/sc3/arity". + +include "csubc/arity.ma". + +include "csubc/getl.ma". + +include "csubc/drop1.ma". + +include "csubc/props.ma". + +theorem sc3_arity_csubc: + \forall (g: G).(\forall (c1: C).(\forall (t: T).(\forall (a: A).((arity g c1 +t a) \to (\forall (d1: C).(\forall (is: PList).((drop1 is d1 c1) \to (\forall +(c2: C).((csubc g d1 c2) \to (sc3 g a c2 (lift1 is t))))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c1 t a)).(arity_ind g (\lambda (c: C).(\lambda (t0: T).(\lambda (a0: +A).(\forall (d1: C).(\forall (is: PList).((drop1 is d1 c) \to (\forall (c2: +C).((csubc g d1 c2) \to (sc3 g a0 c2 (lift1 is t0)))))))))) (\lambda (c: +C).(\lambda (n: nat).(\lambda (d1: C).(\lambda (is: PList).(\lambda (_: +(drop1 is d1 c)).(\lambda (c2: C).(\lambda (_: (csubc g d1 c2)).(eq_ind_r T +(TSort n) (\lambda (t0: T).(land (arity g c2 t0 (ASort O n)) (sn3 c2 t0))) +(conj (arity g c2 (TSort n) (ASort O n)) (sn3 c2 (TSort n)) (arity_sort g c2 +n) (sn3_nf2 c2 (TSort n) (nf2_sort c2 n))) (lift1 is (TSort n)) (lift1_sort n +is))))))))) (\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (i: +nat).(\lambda (H0: (getl i c (CHead d (Bind Abbr) u))).(\lambda (a0: +A).(\lambda (_: (arity g d u a0)).(\lambda (H2: ((\forall (d1: C).(\forall +(is: PList).((drop1 is d1 d) \to (\forall (c2: C).((csubc g d1 c2) \to (sc3 g +a0 c2 (lift1 is u))))))))).(\lambda (d1: C).(\lambda (is: PList).(\lambda +(H3: (drop1 is d1 c)).(\lambda (c2: C).(\lambda (H4: (csubc g d1 c2)).(let +H_x \def (drop1_getl_trans is c d1 H3 Abbr d u i H0) in (let H5 \def H_x in +(ex2_ind C (\lambda (e2: C).(drop1 (ptrans is i) e2 d)) (\lambda (e2: +C).(getl (trans is i) d1 (CHead e2 (Bind Abbr) (lift1 (ptrans is i) u)))) +(sc3 g a0 c2 (lift1 is (TLRef i))) (\lambda (x: C).(\lambda (_: (drop1 +(ptrans is i) x d)).(\lambda (H7: (getl (trans is i) d1 (CHead x (Bind Abbr) +(lift1 (ptrans is i) u)))).(let H_x0 \def (csubc_getl_conf g d1 (CHead x +(Bind Abbr) (lift1 (ptrans is i) u)) (trans is i) H7 c2 H4) in (let H8 \def +H_x0 in (ex2_ind C (\lambda (e2: C).(getl (trans is i) c2 e2)) (\lambda (e2: +C).(csubc g (CHead x (Bind Abbr) (lift1 (ptrans is i) u)) e2)) (sc3 g a0 c2 +(lift1 is (TLRef i))) (\lambda (x0: C).(\lambda (H9: (getl (trans is i) c2 +x0)).(\lambda (H10: (csubc g (CHead x (Bind Abbr) (lift1 (ptrans is i) u)) +x0)).(let H11 \def (match H10 in csubc return (\lambda (c0: C).(\lambda (c3: +C).(\lambda (_: (csubc ? c0 c3)).((eq C c0 (CHead x (Bind Abbr) (lift1 +(ptrans is i) u))) \to ((eq C c3 x0) \to (sc3 g a0 c2 (lift1 is (TLRef +i)))))))) with [(csubc_sort n) \Rightarrow (\lambda (H11: (eq C (CSort n) +(CHead x (Bind Abbr) (lift1 (ptrans is i) u)))).(\lambda (H12: (eq C (CSort +n) x0)).((let H13 \def (eq_ind C (CSort n) (\lambda (e: C).(match e in C +return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow True | (CHead _ _ _) +\Rightarrow False])) I (CHead x (Bind Abbr) (lift1 (ptrans is i) u)) H11) in +(False_ind ((eq C (CSort n) x0) \to (sc3 g a0 c2 (lift1 is (TLRef i)))) H13)) +H12))) | (csubc_head c0 c3 H11 k v) \Rightarrow (\lambda (H12: (eq C (CHead +c0 k v) (CHead x (Bind Abbr) (lift1 (ptrans is i) u)))).(\lambda (H13: (eq C +(CHead c3 k v) x0)).((let H14 \def (f_equal C T (\lambda (e: C).(match e in C +return (\lambda (_: C).T) with [(CSort _) \Rightarrow v | (CHead _ _ t0) +\Rightarrow t0])) (CHead c0 k v) (CHead x (Bind Abbr) (lift1 (ptrans is i) +u)) H12) in ((let H15 \def (f_equal C K (\lambda (e: C).(match e in C return +(\lambda (_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k0 _) \Rightarrow +k0])) (CHead c0 k v) (CHead x (Bind Abbr) (lift1 (ptrans is i) u)) H12) in +((let H16 \def (f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: +C).C) with [(CSort _) \Rightarrow c0 | (CHead c4 _ _) \Rightarrow c4])) +(CHead c0 k v) (CHead x (Bind Abbr) (lift1 (ptrans is i) u)) H12) in (eq_ind +C x (\lambda (c4: C).((eq K k (Bind Abbr)) \to ((eq T v (lift1 (ptrans is i) +u)) \to ((eq C (CHead c3 k v) x0) \to ((csubc g c4 c3) \to (sc3 g a0 c2 +(lift1 is (TLRef i)))))))) (\lambda (H17: (eq K k (Bind Abbr))).(eq_ind K +(Bind Abbr) (\lambda (k0: K).((eq T v (lift1 (ptrans is i) u)) \to ((eq C +(CHead c3 k0 v) x0) \to ((csubc g x c3) \to (sc3 g a0 c2 (lift1 is (TLRef +i))))))) (\lambda (H18: (eq T v (lift1 (ptrans is i) u))).(eq_ind T (lift1 +(ptrans is i) u) (\lambda (t0: T).((eq C (CHead c3 (Bind Abbr) t0) x0) \to +((csubc g x c3) \to (sc3 g a0 c2 (lift1 is (TLRef i)))))) (\lambda (H19: (eq +C (CHead c3 (Bind Abbr) (lift1 (ptrans is i) u)) x0)).(eq_ind C (CHead c3 +(Bind Abbr) (lift1 (ptrans is i) u)) (\lambda (_: C).((csubc g x c3) \to (sc3 +g a0 c2 (lift1 is (TLRef i))))) (\lambda (_: (csubc g x c3)).(let H21 \def +(eq_ind_r C x0 (\lambda (c4: C).(getl (trans is i) c2 c4)) H9 (CHead c3 (Bind +Abbr) (lift1 (ptrans is i) u)) H19) in (let H_y \def (sc3_abbr g a0 TNil) in +(eq_ind_r T (TLRef (trans is i)) (\lambda (t0: T).(sc3 g a0 c2 t0)) (H_y +(trans is i) c3 (lift1 (ptrans is i) u) c2 (eq_ind T (lift1 is (lift (S i) O +u)) (\lambda (t0: T).(sc3 g a0 c2 t0)) (eq_ind T (lift1 (PConsTail is (S i) +O) u) (\lambda (t0: T).(sc3 g a0 c2 t0)) (H2 d1 (PConsTail is (S i) O) +(drop1_cons_tail c d (S i) O (getl_drop Abbr c d u i H0) is d1 H3) c2 H4) +(lift1 is (lift (S i) O u)) (lift1_cons_tail u (S i) O is)) (lift (S (trans +is i)) O (lift1 (ptrans is i) u)) (lift1_free is i u)) H21) (lift1 is (TLRef +i)) (lift1_lref is i))))) x0 H19)) v (sym_eq T v (lift1 (ptrans is i) u) +H18))) k (sym_eq K k (Bind Abbr) H17))) c0 (sym_eq C c0 x H16))) H15)) H14)) +H13 H11))) | (csubc_abst c0 c3 H11 v a1 H12 w H13) \Rightarrow (\lambda (H14: +(eq C (CHead c0 (Bind Abst) v) (CHead x (Bind Abbr) (lift1 (ptrans is i) +u)))).(\lambda (H15: (eq C (CHead c3 (Bind Abbr) w) x0)).((let H16 \def +(eq_ind C (CHead c0 (Bind Abst) v) (\lambda (e: C).(match e in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead x (Bind Abbr) (lift1 (ptrans is i) u)) H14) +in (False_ind ((eq C (CHead c3 (Bind Abbr) w) x0) \to ((csubc g c0 c3) \to +((sc3 g (asucc g a1) c0 v) \to ((sc3 g a1 c3 w) \to (sc3 g a0 c2 (lift1 is +(TLRef i))))))) H16)) H15 H11 H12 H13)))]) in (H11 (refl_equal C (CHead x +(Bind Abbr) (lift1 (ptrans is i) u))) (refl_equal C x0)))))) H8)))))) +H5)))))))))))))))) (\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda +(i: nat).(\lambda (H0: (getl i c (CHead d (Bind Abst) u))).(\lambda (a0: +A).(\lambda (H1: (arity g d u (asucc g a0))).(\lambda (_: ((\forall (d1: +C).(\forall (is: PList).((drop1 is d1 d) \to (\forall (c2: C).((csubc g d1 +c2) \to (sc3 g (asucc g a0) c2 (lift1 is u))))))))).(\lambda (d1: C).(\lambda +(is: PList).(\lambda (H3: (drop1 is d1 c)).(\lambda (c2: C).(\lambda (H4: +(csubc g d1 c2)).(let H5 \def H0 in (let H_x \def (drop1_getl_trans is c d1 +H3 Abst d u i H5) in (let H6 \def H_x in (ex2_ind C (\lambda (e2: C).(drop1 +(ptrans is i) e2 d)) (\lambda (e2: C).(getl (trans is i) d1 (CHead e2 (Bind +Abst) (lift1 (ptrans is i) u)))) (sc3 g a0 c2 (lift1 is (TLRef i))) (\lambda +(x: C).(\lambda (H7: (drop1 (ptrans is i) x d)).(\lambda (H8: (getl (trans is +i) d1 (CHead x (Bind Abst) (lift1 (ptrans is i) u)))).(let H_x0 \def +(csubc_getl_conf g d1 (CHead x (Bind Abst) (lift1 (ptrans is i) u)) (trans is +i) H8 c2 H4) in (let H9 \def H_x0 in (ex2_ind C (\lambda (e2: C).(getl (trans +is i) c2 e2)) (\lambda (e2: C).(csubc g (CHead x (Bind Abst) (lift1 (ptrans +is i) u)) e2)) (sc3 g a0 c2 (lift1 is (TLRef i))) (\lambda (x0: C).(\lambda +(H10: (getl (trans is i) c2 x0)).(\lambda (H11: (csubc g (CHead x (Bind Abst) +(lift1 (ptrans is i) u)) x0)).(let H12 \def (match H11 in csubc return +(\lambda (c0: C).(\lambda (c3: C).(\lambda (_: (csubc ? c0 c3)).((eq C c0 +(CHead x (Bind Abst) (lift1 (ptrans is i) u))) \to ((eq C c3 x0) \to (sc3 g +a0 c2 (lift1 is (TLRef i)))))))) with [(csubc_sort n) \Rightarrow (\lambda +(H12: (eq C (CSort n) (CHead x (Bind Abst) (lift1 (ptrans is i) +u)))).(\lambda (H13: (eq C (CSort n) x0)).((let H14 \def (eq_ind C (CSort n) +(\lambda (e: C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow True | (CHead _ _ _) \Rightarrow False])) I (CHead x (Bind Abst) +(lift1 (ptrans is i) u)) H12) in (False_ind ((eq C (CSort n) x0) \to (sc3 g +a0 c2 (lift1 is (TLRef i)))) H14)) H13))) | (csubc_head c0 c3 H12 k v) +\Rightarrow (\lambda (H13: (eq C (CHead c0 k v) (CHead x (Bind Abst) (lift1 +(ptrans is i) u)))).(\lambda (H14: (eq C (CHead c3 k v) x0)).((let H15 \def +(f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) with +[(CSort _) \Rightarrow v | (CHead _ _ t0) \Rightarrow t0])) (CHead c0 k v) +(CHead x (Bind Abst) (lift1 (ptrans is i) u)) H13) in ((let H16 \def (f_equal +C K (\lambda (e: C).(match e in C return (\lambda (_: C).K) with [(CSort _) +\Rightarrow k | (CHead _ k0 _) \Rightarrow k0])) (CHead c0 k v) (CHead x +(Bind Abst) (lift1 (ptrans is i) u)) H13) in ((let H17 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow c0 | (CHead c4 _ _) \Rightarrow c4])) (CHead c0 k v) (CHead x +(Bind Abst) (lift1 (ptrans is i) u)) H13) in (eq_ind C x (\lambda (c4: +C).((eq K k (Bind Abst)) \to ((eq T v (lift1 (ptrans is i) u)) \to ((eq C +(CHead c3 k v) x0) \to ((csubc g c4 c3) \to (sc3 g a0 c2 (lift1 is (TLRef +i)))))))) (\lambda (H18: (eq K k (Bind Abst))).(eq_ind K (Bind Abst) (\lambda +(k0: K).((eq T v (lift1 (ptrans is i) u)) \to ((eq C (CHead c3 k0 v) x0) \to +((csubc g x c3) \to (sc3 g a0 c2 (lift1 is (TLRef i))))))) (\lambda (H19: (eq +T v (lift1 (ptrans is i) u))).(eq_ind T (lift1 (ptrans is i) u) (\lambda (t0: +T).((eq C (CHead c3 (Bind Abst) t0) x0) \to ((csubc g x c3) \to (sc3 g a0 c2 +(lift1 is (TLRef i)))))) (\lambda (H20: (eq C (CHead c3 (Bind Abst) (lift1 +(ptrans is i) u)) x0)).(eq_ind C (CHead c3 (Bind Abst) (lift1 (ptrans is i) +u)) (\lambda (_: C).((csubc g x c3) \to (sc3 g a0 c2 (lift1 is (TLRef i))))) +(\lambda (_: (csubc g x c3)).(let H22 \def (eq_ind_r C x0 (\lambda (c4: +C).(getl (trans is i) c2 c4)) H10 (CHead c3 (Bind Abst) (lift1 (ptrans is i) +u)) H20) in (let H_y \def (sc3_abst g a0 TNil) in (eq_ind_r T (TLRef (trans +is i)) (\lambda (t0: T).(sc3 g a0 c2 t0)) (H_y c2 (trans is i) +(csubc_arity_conf g d1 c2 H4 (TLRef (trans is i)) a0 (eq_ind T (lift1 is +(TLRef i)) (\lambda (t0: T).(arity g d1 t0 a0)) (arity_lift1 g a0 c is d1 +(TLRef i) H3 (arity_abst g c d u i H0 a0 H1)) (TLRef (trans is i)) +(lift1_lref is i))) (nf2_lref_abst c2 c3 (lift1 (ptrans is i) u) (trans is i) +H22) I) (lift1 is (TLRef i)) (lift1_lref is i))))) x0 H20)) v (sym_eq T v +(lift1 (ptrans is i) u) H19))) k (sym_eq K k (Bind Abst) H18))) c0 (sym_eq C +c0 x H17))) H16)) H15)) H14 H12))) | (csubc_abst c0 c3 H12 v a1 H13 w H14) +\Rightarrow (\lambda (H15: (eq C (CHead c0 (Bind Abst) v) (CHead x (Bind +Abst) (lift1 (ptrans is i) u)))).(\lambda (H16: (eq C (CHead c3 (Bind Abbr) +w) x0)).((let H17 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow v | (CHead _ _ t0) \Rightarrow +t0])) (CHead c0 (Bind Abst) v) (CHead x (Bind Abst) (lift1 (ptrans is i) u)) +H15) in ((let H18 \def (f_equal C C (\lambda (e: C).(match e in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | (CHead c4 _ _) +\Rightarrow c4])) (CHead c0 (Bind Abst) v) (CHead x (Bind Abst) (lift1 +(ptrans is i) u)) H15) in (eq_ind C x (\lambda (c4: C).((eq T v (lift1 +(ptrans is i) u)) \to ((eq C (CHead c3 (Bind Abbr) w) x0) \to ((csubc g c4 +c3) \to ((sc3 g (asucc g a1) c4 v) \to ((sc3 g a1 c3 w) \to (sc3 g a0 c2 +(lift1 is (TLRef i))))))))) (\lambda (H19: (eq T v (lift1 (ptrans is i) +u))).(eq_ind T (lift1 (ptrans is i) u) (\lambda (t0: T).((eq C (CHead c3 +(Bind Abbr) w) x0) \to ((csubc g x c3) \to ((sc3 g (asucc g a1) x t0) \to +((sc3 g a1 c3 w) \to (sc3 g a0 c2 (lift1 is (TLRef i)))))))) (\lambda (H20: +(eq C (CHead c3 (Bind Abbr) w) x0)).(eq_ind C (CHead c3 (Bind Abbr) w) +(\lambda (_: C).((csubc g x c3) \to ((sc3 g (asucc g a1) x (lift1 (ptrans is +i) u)) \to ((sc3 g a1 c3 w) \to (sc3 g a0 c2 (lift1 is (TLRef i))))))) +(\lambda (_: (csubc g x c3)).(\lambda (H22: (sc3 g (asucc g a1) x (lift1 +(ptrans is i) u))).(\lambda (H23: (sc3 g a1 c3 w)).(let H24 \def (eq_ind_r C +x0 (\lambda (c4: C).(getl (trans is i) c2 c4)) H10 (CHead c3 (Bind Abbr) w) +H20) in (let H_y \def (sc3_abbr g a0 TNil) in (eq_ind_r T (TLRef (trans is +i)) (\lambda (t0: T).(sc3 g a0 c2 t0)) (H_y (trans is i) c3 w c2 (let H_y0 +\def (arity_lift1 g (asucc g a0) d (ptrans is i) x u H7 H1) in (let H_y1 \def +(sc3_arity_gen g x (lift1 (ptrans is i) u) (asucc g a1) H22) in (sc3_repl g +a1 c2 (lift (S (trans is i)) O w) (sc3_lift g a1 c3 w H23 c2 (S (trans is i)) +O (getl_drop Abbr c2 c3 w (trans is i) H24)) a0 (asucc_inj g a1 a0 +(arity_mono g x (lift1 (ptrans is i) u) (asucc g a1) H_y1 (asucc g a0) +H_y0))))) H24) (lift1 is (TLRef i)) (lift1_lref is i))))))) x0 H20)) v +(sym_eq T v (lift1 (ptrans is i) u) H19))) c0 (sym_eq C c0 x H18))) H17)) H16 +H12 H13 H14)))]) in (H12 (refl_equal C (CHead x (Bind Abst) (lift1 (ptrans is +i) u))) (refl_equal C x0)))))) H9)))))) H6))))))))))))))))) (\lambda (b: +B).(\lambda (H0: (not (eq B b Abst))).(\lambda (c: C).(\lambda (u: +T).(\lambda (a1: A).(\lambda (_: (arity g c u a1)).(\lambda (H2: ((\forall +(d1: C).(\forall (is: PList).((drop1 is d1 c) \to (\forall (c2: C).((csubc g +d1 c2) \to (sc3 g a1 c2 (lift1 is u))))))))).(\lambda (t0: T).(\lambda (a2: +A).(\lambda (_: (arity g (CHead c (Bind b) u) t0 a2)).(\lambda (H4: ((\forall +(d1: C).(\forall (is: PList).((drop1 is d1 (CHead c (Bind b) u)) \to (\forall +(c2: C).((csubc g d1 c2) \to (sc3 g a2 c2 (lift1 is t0))))))))).(\lambda (d1: +C).(\lambda (is: PList).(\lambda (H5: (drop1 is d1 c)).(\lambda (c2: +C).(\lambda (H6: (csubc g d1 c2)).(let H_y \def (sc3_bind g b H0 a1 a2 TNil) +in (eq_ind_r T (THead (Bind b) (lift1 is u) (lift1 (Ss is) t0)) (\lambda (t1: +T).(sc3 g a2 c2 t1)) (H_y c2 (lift1 is u) (lift1 (Ss is) t0) (H4 (CHead d1 +(Bind b) (lift1 is u)) (Ss is) (drop1_skip_bind b c is d1 u H5) (CHead c2 +(Bind b) (lift1 is u)) (csubc_head g d1 c2 H6 (Bind b) (lift1 is u))) (H2 d1 +is H5 c2 H6)) (lift1 is (THead (Bind b) u t0)) (lift1_bind b is u +t0))))))))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (a1: +A).(\lambda (H0: (arity g c u (asucc g a1))).(\lambda (H1: ((\forall (d1: +C).(\forall (is: PList).((drop1 is d1 c) \to (\forall (c2: C).((csubc g d1 +c2) \to (sc3 g (asucc g a1) c2 (lift1 is u))))))))).(\lambda (t0: T).(\lambda +(a2: A).(\lambda (H2: (arity g (CHead c (Bind Abst) u) t0 a2)).(\lambda (H3: +((\forall (d1: C).(\forall (is: PList).((drop1 is d1 (CHead c (Bind Abst) u)) +\to (\forall (c2: C).((csubc g d1 c2) \to (sc3 g a2 c2 (lift1 is +t0))))))))).(\lambda (d1: C).(\lambda (is: PList).(\lambda (H4: (drop1 is d1 +c)).(\lambda (c2: C).(\lambda (H5: (csubc g d1 c2)).(eq_ind_r T (THead (Bind +Abst) (lift1 is u) (lift1 (Ss is) t0)) (\lambda (t1: T).(land (arity g c2 t1 +(AHead a1 a2)) (\forall (d: C).(\forall (w: T).((sc3 g a1 d w) \to (\forall +(is0: PList).((drop1 is0 d c2) \to (sc3 g a2 d (THead (Flat Appl) w (lift1 +is0 t1)))))))))) (conj (arity g c2 (THead (Bind Abst) (lift1 is u) (lift1 (Ss +is) t0)) (AHead a1 a2)) (\forall (d: C).(\forall (w: T).((sc3 g a1 d w) \to +(\forall (is0: PList).((drop1 is0 d c2) \to (sc3 g a2 d (THead (Flat Appl) w +(lift1 is0 (THead (Bind Abst) (lift1 is u) (lift1 (Ss is) t0)))))))))) +(csubc_arity_conf g d1 c2 H5 (THead (Bind Abst) (lift1 is u) (lift1 (Ss is) +t0)) (AHead a1 a2) (arity_head g d1 (lift1 is u) a1 (arity_lift1 g (asucc g +a1) c is d1 u H4 H0) (lift1 (Ss is) t0) a2 (arity_lift1 g a2 (CHead c (Bind +Abst) u) (Ss is) (CHead d1 (Bind Abst) (lift1 is u)) t0 (drop1_skip_bind Abst +c is d1 u H4) H2))) (\lambda (d: C).(\lambda (w: T).(\lambda (H6: (sc3 g a1 d +w)).(\lambda (is0: PList).(\lambda (H7: (drop1 is0 d c2)).(eq_ind_r T (THead +(Bind Abst) (lift1 is0 (lift1 is u)) (lift1 (Ss is0) (lift1 (Ss is) t0))) +(\lambda (t1: T).(sc3 g a2 d (THead (Flat Appl) w t1))) (let H8 \def +(sc3_appl g a1 a2 TNil) in (H8 d w (lift1 (Ss is0) (lift1 (Ss is) t0)) (let +H_y \def (sc3_bind g Abbr (\lambda (H9: (eq B Abbr Abst)).(not_abbr_abst H9)) +a1 a2 TNil) in (H_y d w (lift1 (Ss is0) (lift1 (Ss is) t0)) (let H_x \def +(csubc_drop1_conf_rev g is0 d c2 H7 d1 H5) in (let H9 \def H_x in (ex2_ind C +(\lambda (c3: C).(drop1 is0 c3 d1)) (\lambda (c3: C).(csubc g c3 d)) (sc3 g +a2 (CHead d (Bind Abbr) w) (lift1 (Ss is0) (lift1 (Ss is) t0))) (\lambda (x: +C).(\lambda (H10: (drop1 is0 x d1)).(\lambda (H11: (csubc g x d)).(eq_ind_r T +(lift1 (papp (Ss is0) (Ss is)) t0) (\lambda (t1: T).(sc3 g a2 (CHead d (Bind +Abbr) w) t1)) (eq_ind_r PList (Ss (papp is0 is)) (\lambda (p: PList).(sc3 g +a2 (CHead d (Bind Abbr) w) (lift1 p t0))) (H3 (CHead x (Bind Abst) (lift1 +(papp is0 is) u)) (Ss (papp is0 is)) (drop1_skip_bind Abst c (papp is0 is) x +u (drop1_trans is0 x d1 H10 is c H4)) (CHead d (Bind Abbr) w) (csubc_abst g x +d H11 (lift1 (papp is0 is) u) a1 (H1 x (papp is0 is) (drop1_trans is0 x d1 +H10 is c H4) x (csubc_refl g x)) w H6)) (papp (Ss is0) (Ss is)) (papp_ss is0 +is)) (lift1 (Ss is0) (lift1 (Ss is) t0)) (lift1_lift1 (Ss is0) (Ss is) +t0))))) H9))) H6)) H6 (lift1 is0 (lift1 is u)) (sc3_lift1 g c2 (asucc g a1) +is0 d (lift1 is u) (H1 d1 is H4 c2 H5) H7))) (lift1 is0 (THead (Bind Abst) +(lift1 is u) (lift1 (Ss is) t0))) (lift1_bind Abst is0 (lift1 is u) (lift1 +(Ss is) t0))))))))) (lift1 is (THead (Bind Abst) u t0)) (lift1_bind Abst is u +t0)))))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (a1: A).(\lambda +(_: (arity g c u a1)).(\lambda (H1: ((\forall (d1: C).(\forall (is: +PList).((drop1 is d1 c) \to (\forall (c2: C).((csubc g d1 c2) \to (sc3 g a1 +c2 (lift1 is u))))))))).(\lambda (t0: T).(\lambda (a2: A).(\lambda (_: (arity +g c t0 (AHead a1 a2))).(\lambda (H3: ((\forall (d1: C).(\forall (is: +PList).((drop1 is d1 c) \to (\forall (c2: C).((csubc g d1 c2) \to (sc3 g +(AHead a1 a2) c2 (lift1 is t0))))))))).(\lambda (d1: C).(\lambda (is: +PList).(\lambda (H4: (drop1 is d1 c)).(\lambda (c2: C).(\lambda (H5: (csubc g +d1 c2)).(let H_y \def (H1 d1 is H4 c2 H5) in (let H_y0 \def (H3 d1 is H4 c2 +H5) in (let H6 \def H_y0 in (and_ind (arity g c2 (lift1 is t0) (AHead a1 a2)) +(\forall (d: C).(\forall (w: T).((sc3 g a1 d w) \to (\forall (is0: +PList).((drop1 is0 d c2) \to (sc3 g a2 d (THead (Flat Appl) w (lift1 is0 +(lift1 is t0))))))))) (sc3 g a2 c2 (lift1 is (THead (Flat Appl) u t0))) +(\lambda (_: (arity g c2 (lift1 is t0) (AHead a1 a2))).(\lambda (H8: +((\forall (d: C).(\forall (w: T).((sc3 g a1 d w) \to (\forall (is0: +PList).((drop1 is0 d c2) \to (sc3 g a2 d (THead (Flat Appl) w (lift1 is0 +(lift1 is t0))))))))))).(let H_y1 \def (H8 c2 (lift1 is u) H_y PNil) in +(eq_ind_r T (THead (Flat Appl) (lift1 is u) (lift1 is t0)) (\lambda (t1: +T).(sc3 g a2 c2 t1)) (H_y1 (drop1_nil c2)) (lift1 is (THead (Flat Appl) u +t0)) (lift1_flat Appl is u t0))))) H6)))))))))))))))))) (\lambda (c: +C).(\lambda (u: T).(\lambda (a0: A).(\lambda (_: (arity g c u (asucc g +a0))).(\lambda (H1: ((\forall (d1: C).(\forall (is: PList).((drop1 is d1 c) +\to (\forall (c2: C).((csubc g d1 c2) \to (sc3 g (asucc g a0) c2 (lift1 is +u))))))))).(\lambda (t0: T).(\lambda (_: (arity g c t0 a0)).(\lambda (H3: +((\forall (d1: C).(\forall (is: PList).((drop1 is d1 c) \to (\forall (c2: +C).((csubc g d1 c2) \to (sc3 g a0 c2 (lift1 is t0))))))))).(\lambda (d1: +C).(\lambda (is: PList).(\lambda (H4: (drop1 is d1 c)).(\lambda (c2: +C).(\lambda (H5: (csubc g d1 c2)).(let H_y \def (sc3_cast g a0 TNil) in +(eq_ind_r T (THead (Flat Cast) (lift1 is u) (lift1 is t0)) (\lambda (t1: +T).(sc3 g a0 c2 t1)) (H_y c2 (lift1 is u) (H1 d1 is H4 c2 H5) (lift1 is t0) +(H3 d1 is H4 c2 H5)) (lift1 is (THead (Flat Cast) u t0)) (lift1_flat Cast is +u t0)))))))))))))))) (\lambda (c: C).(\lambda (t0: T).(\lambda (a1: +A).(\lambda (_: (arity g c t0 a1)).(\lambda (H1: ((\forall (d1: C).(\forall +(is: PList).((drop1 is d1 c) \to (\forall (c2: C).((csubc g d1 c2) \to (sc3 g +a1 c2 (lift1 is t0))))))))).(\lambda (a2: A).(\lambda (H2: (leq g a1 +a2)).(\lambda (d1: C).(\lambda (is: PList).(\lambda (H3: (drop1 is d1 +c)).(\lambda (c2: C).(\lambda (H4: (csubc g d1 c2)).(sc3_repl g a1 c2 (lift1 +is t0) (H1 d1 is H3 c2 H4) a2 H2))))))))))))) c1 t a H))))). + +theorem sc3_arity: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (a: A).((arity g c t +a) \to (sc3 g a c t))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (a: A).(\lambda (H: +(arity g c t a)).(let H_y \def (sc3_arity_csubc g c t a H c PNil) in (H_y +(drop1_nil c) c (csubc_refl g c))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/defs.ma new file mode 100644 index 000000000..fd161f395 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/defs.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/sc3/defs". + +include "sn3/defs.ma". + +include "arity/defs.ma". + +include "drop1/defs.ma". + +definition sc3: + G \to (A \to (C \to (T \to Prop))) +\def + let rec sc3 (g: G) (a: A) on a: (C \to (T \to Prop)) \def (\lambda (c: +C).(\lambda (t: T).(match a with [(ASort h n) \Rightarrow (land (arity g c t +(ASort h n)) (sn3 c t)) | (AHead a1 a2) \Rightarrow (land (arity g c t (AHead +a1 a2)) (\forall (d: C).(\forall (w: T).((sc3 g a1 d w) \to (\forall (is: +PList).((drop1 is d c) \to (sc3 g a2 d (THead (Flat Appl) w (lift1 is +t)))))))))]))) in sc3. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/props.ma new file mode 100644 index 000000000..c1d3787b8 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/props.ma @@ -0,0 +1,739 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/sc3/props". + +include "sc3/defs.ma". + +include "sn3/lift1.ma". + +include "nf2/lift1.ma". + +include "csuba/arity.ma". + +include "arity/lift1.ma". + +include "arity/aprem.ma". + +include "llt/props.ma". + +include "drop1/getl.ma". + +include "drop1/props.ma". + +include "lift1/props.ma". + +theorem sc3_arity_gen: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (a: A).((sc3 g a c +t) \to (arity g c t a))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (a: A).(A_ind +(\lambda (a0: A).((sc3 g a0 c t) \to (arity g c t a0))) (\lambda (n: +nat).(\lambda (n0: nat).(\lambda (H: (land (arity g c t (ASort n n0)) (sn3 c +t))).(let H0 \def H in (and_ind (arity g c t (ASort n n0)) (sn3 c t) (arity g +c t (ASort n n0)) (\lambda (H1: (arity g c t (ASort n n0))).(\lambda (_: (sn3 +c t)).H1)) H0))))) (\lambda (a0: A).(\lambda (_: (((sc3 g a0 c t) \to (arity +g c t a0)))).(\lambda (a1: A).(\lambda (_: (((sc3 g a1 c t) \to (arity g c t +a1)))).(\lambda (H1: (land (arity g c t (AHead a0 a1)) (\forall (d: +C).(\forall (w: T).((sc3 g a0 d w) \to (\forall (is: PList).((drop1 is d c) +\to (sc3 g a1 d (THead (Flat Appl) w (lift1 is t)))))))))).(let H2 \def H1 in +(and_ind (arity g c t (AHead a0 a1)) (\forall (d: C).(\forall (w: T).((sc3 g +a0 d w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a1 d (THead (Flat +Appl) w (lift1 is t)))))))) (arity g c t (AHead a0 a1)) (\lambda (H3: (arity +g c t (AHead a0 a1))).(\lambda (_: ((\forall (d: C).(\forall (w: T).((sc3 g +a0 d w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a1 d (THead (Flat +Appl) w (lift1 is t)))))))))).H3)) H2))))))) a)))). + +theorem sc3_repl: + \forall (g: G).(\forall (a1: A).(\forall (c: C).(\forall (t: T).((sc3 g a1 c +t) \to (\forall (a2: A).((leq g a1 a2) \to (sc3 g a2 c t))))))) +\def + \lambda (g: G).(\lambda (a1: A).(llt_wf_ind (\lambda (a: A).(\forall (c: +C).(\forall (t: T).((sc3 g a c t) \to (\forall (a2: A).((leq g a a2) \to (sc3 +g a2 c t))))))) (\lambda (a2: A).(A_ind (\lambda (a: A).(((\forall (a3: +A).((llt a3 a) \to (\forall (c: C).(\forall (t: T).((sc3 g a3 c t) \to +(\forall (a4: A).((leq g a3 a4) \to (sc3 g a4 c t))))))))) \to (\forall (c: +C).(\forall (t: T).((sc3 g a c t) \to (\forall (a3: A).((leq g a a3) \to (sc3 +g a3 c t)))))))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda (_: ((\forall +(a3: A).((llt a3 (ASort n n0)) \to (\forall (c: C).(\forall (t: T).((sc3 g a3 +c t) \to (\forall (a4: A).((leq g a3 a4) \to (sc3 g a4 c t)))))))))).(\lambda +(c: C).(\lambda (t: T).(\lambda (H0: (land (arity g c t (ASort n n0)) (sn3 c +t))).(\lambda (a3: A).(\lambda (H1: (leq g (ASort n n0) a3)).(let H2 \def H0 +in (and_ind (arity g c t (ASort n n0)) (sn3 c t) (sc3 g a3 c t) (\lambda (H3: +(arity g c t (ASort n n0))).(\lambda (H4: (sn3 c t)).(let H_y \def +(arity_repl g c t (ASort n n0) H3 a3 H1) in (let H_x \def (leq_gen_sort g n +n0 a3 H1) in (let H5 \def H_x in (ex2_3_ind nat nat nat (\lambda (n2: +nat).(\lambda (h2: nat).(\lambda (_: nat).(eq A a3 (ASort h2 n2))))) (\lambda +(n2: nat).(\lambda (h2: nat).(\lambda (k: nat).(eq A (aplus g (ASort n n0) k) +(aplus g (ASort h2 n2) k))))) (sc3 g a3 c t) (\lambda (x0: nat).(\lambda (x1: +nat).(\lambda (x2: nat).(\lambda (H6: (eq A a3 (ASort x1 x0))).(\lambda (_: +(eq A (aplus g (ASort n n0) x2) (aplus g (ASort x1 x0) x2))).(let H8 \def +(eq_ind A a3 (\lambda (a: A).(arity g c t a)) H_y (ASort x1 x0) H6) in +(eq_ind_r A (ASort x1 x0) (\lambda (a: A).(sc3 g a c t)) (conj (arity g c t +(ASort x1 x0)) (sn3 c t) H8 H4) a3 H6))))))) H5)))))) H2)))))))))) (\lambda +(a: A).(\lambda (_: ((((\forall (a3: A).((llt a3 a) \to (\forall (c: +C).(\forall (t: T).((sc3 g a3 c t) \to (\forall (a4: A).((leq g a3 a4) \to +(sc3 g a4 c t))))))))) \to (\forall (c: C).(\forall (t: T).((sc3 g a c t) \to +(\forall (a3: A).((leq g a a3) \to (sc3 g a3 c t))))))))).(\lambda (a0: +A).(\lambda (H0: ((((\forall (a3: A).((llt a3 a0) \to (\forall (c: +C).(\forall (t: T).((sc3 g a3 c t) \to (\forall (a4: A).((leq g a3 a4) \to +(sc3 g a4 c t))))))))) \to (\forall (c: C).(\forall (t: T).((sc3 g a0 c t) +\to (\forall (a3: A).((leq g a0 a3) \to (sc3 g a3 c t))))))))).(\lambda (H1: +((\forall (a3: A).((llt a3 (AHead a a0)) \to (\forall (c: C).(\forall (t: +T).((sc3 g a3 c t) \to (\forall (a4: A).((leq g a3 a4) \to (sc3 g a4 c +t)))))))))).(\lambda (c: C).(\lambda (t: T).(\lambda (H2: (land (arity g c t +(AHead a a0)) (\forall (d: C).(\forall (w: T).((sc3 g a d w) \to (\forall +(is: PList).((drop1 is d c) \to (sc3 g a0 d (THead (Flat Appl) w (lift1 is +t)))))))))).(\lambda (a3: A).(\lambda (H3: (leq g (AHead a a0) a3)).(let H4 +\def H2 in (and_ind (arity g c t (AHead a a0)) (\forall (d: C).(\forall (w: +T).((sc3 g a d w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a0 d +(THead (Flat Appl) w (lift1 is t)))))))) (sc3 g a3 c t) (\lambda (H5: (arity +g c t (AHead a a0))).(\lambda (H6: ((\forall (d: C).(\forall (w: T).((sc3 g a +d w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a0 d (THead (Flat +Appl) w (lift1 is t)))))))))).(let H_x \def (leq_gen_head g a a0 a3 H3) in +(let H7 \def H_x in (ex3_2_ind A A (\lambda (a4: A).(\lambda (a5: A).(eq A a3 +(AHead a4 a5)))) (\lambda (a4: A).(\lambda (_: A).(leq g a a4))) (\lambda (_: +A).(\lambda (a5: A).(leq g a0 a5))) (sc3 g a3 c t) (\lambda (x0: A).(\lambda +(x1: A).(\lambda (H8: (eq A a3 (AHead x0 x1))).(\lambda (H9: (leq g a +x0)).(\lambda (H10: (leq g a0 x1)).(eq_ind_r A (AHead x0 x1) (\lambda (a4: +A).(sc3 g a4 c t)) (conj (arity g c t (AHead x0 x1)) (\forall (d: C).(\forall +(w: T).((sc3 g x0 d w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g x1 +d (THead (Flat Appl) w (lift1 is t)))))))) (arity_repl g c t (AHead a a0) H5 +(AHead x0 x1) (leq_head g a x0 H9 a0 x1 H10)) (\lambda (d: C).(\lambda (w: +T).(\lambda (H11: (sc3 g x0 d w)).(\lambda (is: PList).(\lambda (H12: (drop1 +is d c)).(H0 (\lambda (a4: A).(\lambda (H13: (llt a4 a0)).(\lambda (c0: +C).(\lambda (t0: T).(\lambda (H14: (sc3 g a4 c0 t0)).(\lambda (a5: +A).(\lambda (H15: (leq g a4 a5)).(H1 a4 (llt_trans a4 a0 (AHead a a0) H13 +(llt_head_dx a a0)) c0 t0 H14 a5 H15)))))))) d (THead (Flat Appl) w (lift1 is +t)) (H6 d w (H1 x0 (llt_repl g a x0 H9 (AHead a a0) (llt_head_sx a a0)) d w +H11 a (leq_sym g a x0 H9)) is H12) x1 H10))))))) a3 H8)))))) H7))))) +H4)))))))))))) a2)) a1)). + +theorem sc3_lift: + \forall (g: G).(\forall (a: A).(\forall (e: C).(\forall (t: T).((sc3 g a e +t) \to (\forall (c: C).(\forall (h: nat).(\forall (d: nat).((drop h d c e) +\to (sc3 g a c (lift h d t)))))))))) +\def + \lambda (g: G).(\lambda (a: A).(A_ind (\lambda (a0: A).(\forall (e: +C).(\forall (t: T).((sc3 g a0 e t) \to (\forall (c: C).(\forall (h: +nat).(\forall (d: nat).((drop h d c e) \to (sc3 g a0 c (lift h d t)))))))))) +(\lambda (n: nat).(\lambda (n0: nat).(\lambda (e: C).(\lambda (t: T).(\lambda +(H: (land (arity g e t (ASort n n0)) (sn3 e t))).(\lambda (c: C).(\lambda (h: +nat).(\lambda (d: nat).(\lambda (H0: (drop h d c e)).(let H1 \def H in +(and_ind (arity g e t (ASort n n0)) (sn3 e t) (land (arity g c (lift h d t) +(ASort n n0)) (sn3 c (lift h d t))) (\lambda (H2: (arity g e t (ASort n +n0))).(\lambda (H3: (sn3 e t)).(conj (arity g c (lift h d t) (ASort n n0)) +(sn3 c (lift h d t)) (arity_lift g e t (ASort n n0) H2 c h d H0) (sn3_lift e +t H3 c h d H0)))) H1))))))))))) (\lambda (a0: A).(\lambda (_: ((\forall (e: +C).(\forall (t: T).((sc3 g a0 e t) \to (\forall (c: C).(\forall (h: +nat).(\forall (d: nat).((drop h d c e) \to (sc3 g a0 c (lift h d +t))))))))))).(\lambda (a1: A).(\lambda (_: ((\forall (e: C).(\forall (t: +T).((sc3 g a1 e t) \to (\forall (c: C).(\forall (h: nat).(\forall (d: +nat).((drop h d c e) \to (sc3 g a1 c (lift h d t))))))))))).(\lambda (e: +C).(\lambda (t: T).(\lambda (H1: (land (arity g e t (AHead a0 a1)) (\forall +(d: C).(\forall (w: T).((sc3 g a0 d w) \to (\forall (is: PList).((drop1 is d +e) \to (sc3 g a1 d (THead (Flat Appl) w (lift1 is t)))))))))).(\lambda (c: +C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H2: (drop h d c e)).(let H3 +\def H1 in (and_ind (arity g e t (AHead a0 a1)) (\forall (d0: C).(\forall (w: +T).((sc3 g a0 d0 w) \to (\forall (is: PList).((drop1 is d0 e) \to (sc3 g a1 +d0 (THead (Flat Appl) w (lift1 is t)))))))) (land (arity g c (lift h d t) +(AHead a0 a1)) (\forall (d0: C).(\forall (w: T).((sc3 g a0 d0 w) \to (\forall +(is: PList).((drop1 is d0 c) \to (sc3 g a1 d0 (THead (Flat Appl) w (lift1 is +(lift h d t)))))))))) (\lambda (H4: (arity g e t (AHead a0 a1))).(\lambda +(H5: ((\forall (d0: C).(\forall (w: T).((sc3 g a0 d0 w) \to (\forall (is: +PList).((drop1 is d0 e) \to (sc3 g a1 d0 (THead (Flat Appl) w (lift1 is +t)))))))))).(conj (arity g c (lift h d t) (AHead a0 a1)) (\forall (d0: +C).(\forall (w: T).((sc3 g a0 d0 w) \to (\forall (is: PList).((drop1 is d0 c) +\to (sc3 g a1 d0 (THead (Flat Appl) w (lift1 is (lift h d t))))))))) +(arity_lift g e t (AHead a0 a1) H4 c h d H2) (\lambda (d0: C).(\lambda (w: +T).(\lambda (H6: (sc3 g a0 d0 w)).(\lambda (is: PList).(\lambda (H7: (drop1 +is d0 c)).(let H_y \def (H5 d0 w H6 (PConsTail is h d)) in (eq_ind T (lift1 +(PConsTail is h d) t) (\lambda (t0: T).(sc3 g a1 d0 (THead (Flat Appl) w +t0))) (H_y (drop1_cons_tail c e h d H2 is d0 H7)) (lift1 is (lift h d t)) +(lift1_cons_tail t h d is))))))))))) H3))))))))))))) a)). + +theorem sc3_lift1: + \forall (g: G).(\forall (e: C).(\forall (a: A).(\forall (hds: +PList).(\forall (c: C).(\forall (t: T).((sc3 g a e t) \to ((drop1 hds c e) +\to (sc3 g a c (lift1 hds t))))))))) +\def + \lambda (g: G).(\lambda (e: C).(\lambda (a: A).(\lambda (hds: +PList).(PList_ind (\lambda (p: PList).(\forall (c: C).(\forall (t: T).((sc3 g +a e t) \to ((drop1 p c e) \to (sc3 g a c (lift1 p t))))))) (\lambda (c: +C).(\lambda (t: T).(\lambda (H: (sc3 g a e t)).(\lambda (H0: (drop1 PNil c +e)).(let H1 \def (match H0 in drop1 return (\lambda (p: PList).(\lambda (c0: +C).(\lambda (c1: C).(\lambda (_: (drop1 p c0 c1)).((eq PList p PNil) \to ((eq +C c0 c) \to ((eq C c1 e) \to (sc3 g a c t)))))))) with [(drop1_nil c0) +\Rightarrow (\lambda (_: (eq PList PNil PNil)).(\lambda (H2: (eq C c0 +c)).(\lambda (H3: (eq C c0 e)).(eq_ind C c (\lambda (c1: C).((eq C c1 e) \to +(sc3 g a c t))) (\lambda (H4: (eq C c e)).(eq_ind C e (\lambda (c1: C).(sc3 g +a c1 t)) H c (sym_eq C c e H4))) c0 (sym_eq C c0 c H2) H3)))) | (drop1_cons +c1 c2 h d H1 c3 hds0 H2) \Rightarrow (\lambda (H3: (eq PList (PCons h d hds0) +PNil)).(\lambda (H4: (eq C c1 c)).(\lambda (H5: (eq C c3 e)).((let H6 \def +(eq_ind PList (PCons h d hds0) (\lambda (e0: PList).(match e0 in PList return +(\lambda (_: PList).Prop) with [PNil \Rightarrow False | (PCons _ _ _) +\Rightarrow True])) I PNil H3) in (False_ind ((eq C c1 c) \to ((eq C c3 e) +\to ((drop h d c1 c2) \to ((drop1 hds0 c2 c3) \to (sc3 g a c t))))) H6)) H4 +H5 H1 H2))))]) in (H1 (refl_equal PList PNil) (refl_equal C c) (refl_equal C +e))))))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda (p: PList).(\lambda +(H: ((\forall (c: C).(\forall (t: T).((sc3 g a e t) \to ((drop1 p c e) \to +(sc3 g a c (lift1 p t)))))))).(\lambda (c: C).(\lambda (t: T).(\lambda (H0: +(sc3 g a e t)).(\lambda (H1: (drop1 (PCons n n0 p) c e)).(let H2 \def (match +H1 in drop1 return (\lambda (p0: PList).(\lambda (c0: C).(\lambda (c1: +C).(\lambda (_: (drop1 p0 c0 c1)).((eq PList p0 (PCons n n0 p)) \to ((eq C c0 +c) \to ((eq C c1 e) \to (sc3 g a c (lift n n0 (lift1 p t)))))))))) with +[(drop1_nil c0) \Rightarrow (\lambda (H2: (eq PList PNil (PCons n n0 +p))).(\lambda (H3: (eq C c0 c)).(\lambda (H4: (eq C c0 e)).((let H5 \def +(eq_ind PList PNil (\lambda (e0: PList).(match e0 in PList return (\lambda +(_: PList).Prop) with [PNil \Rightarrow True | (PCons _ _ _) \Rightarrow +False])) I (PCons n n0 p) H2) in (False_ind ((eq C c0 c) \to ((eq C c0 e) \to +(sc3 g a c (lift n n0 (lift1 p t))))) H5)) H3 H4)))) | (drop1_cons c1 c2 h d +H2 c3 hds0 H3) \Rightarrow (\lambda (H4: (eq PList (PCons h d hds0) (PCons n +n0 p))).(\lambda (H5: (eq C c1 c)).(\lambda (H6: (eq C c3 e)).((let H7 \def +(f_equal PList PList (\lambda (e0: PList).(match e0 in PList return (\lambda +(_: PList).PList) with [PNil \Rightarrow hds0 | (PCons _ _ p0) \Rightarrow +p0])) (PCons h d hds0) (PCons n n0 p) H4) in ((let H8 \def (f_equal PList nat +(\lambda (e0: PList).(match e0 in PList return (\lambda (_: PList).nat) with +[PNil \Rightarrow d | (PCons _ n1 _) \Rightarrow n1])) (PCons h d hds0) +(PCons n n0 p) H4) in ((let H9 \def (f_equal PList nat (\lambda (e0: +PList).(match e0 in PList return (\lambda (_: PList).nat) with [PNil +\Rightarrow h | (PCons n1 _ _) \Rightarrow n1])) (PCons h d hds0) (PCons n n0 +p) H4) in (eq_ind nat n (\lambda (n1: nat).((eq nat d n0) \to ((eq PList hds0 +p) \to ((eq C c1 c) \to ((eq C c3 e) \to ((drop n1 d c1 c2) \to ((drop1 hds0 +c2 c3) \to (sc3 g a c (lift n n0 (lift1 p t)))))))))) (\lambda (H10: (eq nat +d n0)).(eq_ind nat n0 (\lambda (n1: nat).((eq PList hds0 p) \to ((eq C c1 c) +\to ((eq C c3 e) \to ((drop n n1 c1 c2) \to ((drop1 hds0 c2 c3) \to (sc3 g a +c (lift n n0 (lift1 p t))))))))) (\lambda (H11: (eq PList hds0 p)).(eq_ind +PList p (\lambda (p0: PList).((eq C c1 c) \to ((eq C c3 e) \to ((drop n n0 c1 +c2) \to ((drop1 p0 c2 c3) \to (sc3 g a c (lift n n0 (lift1 p t)))))))) +(\lambda (H12: (eq C c1 c)).(eq_ind C c (\lambda (c0: C).((eq C c3 e) \to +((drop n n0 c0 c2) \to ((drop1 p c2 c3) \to (sc3 g a c (lift n n0 (lift1 p +t))))))) (\lambda (H13: (eq C c3 e)).(eq_ind C e (\lambda (c0: C).((drop n n0 +c c2) \to ((drop1 p c2 c0) \to (sc3 g a c (lift n n0 (lift1 p t)))))) +(\lambda (H14: (drop n n0 c c2)).(\lambda (H15: (drop1 p c2 e)).(sc3_lift g a +c2 (lift1 p t) (H c2 t H0 H15) c n n0 H14))) c3 (sym_eq C c3 e H13))) c1 +(sym_eq C c1 c H12))) hds0 (sym_eq PList hds0 p H11))) d (sym_eq nat d n0 +H10))) h (sym_eq nat h n H9))) H8)) H7)) H5 H6 H2 H3))))]) in (H2 (refl_equal +PList (PCons n n0 p)) (refl_equal C c) (refl_equal C e))))))))))) hds)))). + +theorem sc3_abbr: + \forall (g: G).(\forall (a: A).(\forall (vs: TList).(\forall (i: +nat).(\forall (d: C).(\forall (v: T).(\forall (c: C).((sc3 g a c (THeads +(Flat Appl) vs (lift (S i) O v))) \to ((getl i c (CHead d (Bind Abbr) v)) \to +(sc3 g a c (THeads (Flat Appl) vs (TLRef i))))))))))) +\def + \lambda (g: G).(\lambda (a: A).(A_ind (\lambda (a0: A).(\forall (vs: +TList).(\forall (i: nat).(\forall (d: C).(\forall (v: T).(\forall (c: +C).((sc3 g a0 c (THeads (Flat Appl) vs (lift (S i) O v))) \to ((getl i c +(CHead d (Bind Abbr) v)) \to (sc3 g a0 c (THeads (Flat Appl) vs (TLRef +i))))))))))) (\lambda (n: nat).(\lambda (n0: nat).(\lambda (vs: +TList).(\lambda (i: nat).(\lambda (d: C).(\lambda (v: T).(\lambda (c: +C).(\lambda (H: (land (arity g c (THeads (Flat Appl) vs (lift (S i) O v)) +(ASort n n0)) (sn3 c (THeads (Flat Appl) vs (lift (S i) O v))))).(\lambda +(H0: (getl i c (CHead d (Bind Abbr) v))).(let H1 \def H in (and_ind (arity g +c (THeads (Flat Appl) vs (lift (S i) O v)) (ASort n n0)) (sn3 c (THeads (Flat +Appl) vs (lift (S i) O v))) (land (arity g c (THeads (Flat Appl) vs (TLRef +i)) (ASort n n0)) (sn3 c (THeads (Flat Appl) vs (TLRef i)))) (\lambda (H2: +(arity g c (THeads (Flat Appl) vs (lift (S i) O v)) (ASort n n0))).(\lambda +(H3: (sn3 c (THeads (Flat Appl) vs (lift (S i) O v)))).(conj (arity g c +(THeads (Flat Appl) vs (TLRef i)) (ASort n n0)) (sn3 c (THeads (Flat Appl) vs +(TLRef i))) (arity_appls_abbr g c d v i H0 vs (ASort n n0) H2) +(sn3_appls_abbr c d v i H0 vs H3)))) H1))))))))))) (\lambda (a0: A).(\lambda +(_: ((\forall (vs: TList).(\forall (i: nat).(\forall (d: C).(\forall (v: +T).(\forall (c: C).((sc3 g a0 c (THeads (Flat Appl) vs (lift (S i) O v))) \to +((getl i c (CHead d (Bind Abbr) v)) \to (sc3 g a0 c (THeads (Flat Appl) vs +(TLRef i)))))))))))).(\lambda (a1: A).(\lambda (H0: ((\forall (vs: +TList).(\forall (i: nat).(\forall (d: C).(\forall (v: T).(\forall (c: +C).((sc3 g a1 c (THeads (Flat Appl) vs (lift (S i) O v))) \to ((getl i c +(CHead d (Bind Abbr) v)) \to (sc3 g a1 c (THeads (Flat Appl) vs (TLRef +i)))))))))))).(\lambda (vs: TList).(\lambda (i: nat).(\lambda (d: C).(\lambda +(v: T).(\lambda (c: C).(\lambda (H1: (land (arity g c (THeads (Flat Appl) vs +(lift (S i) O v)) (AHead a0 a1)) (\forall (d0: C).(\forall (w: T).((sc3 g a0 +d0 w) \to (\forall (is: PList).((drop1 is d0 c) \to (sc3 g a1 d0 (THead (Flat +Appl) w (lift1 is (THeads (Flat Appl) vs (lift (S i) O v)))))))))))).(\lambda +(H2: (getl i c (CHead d (Bind Abbr) v))).(let H3 \def H1 in (and_ind (arity g +c (THeads (Flat Appl) vs (lift (S i) O v)) (AHead a0 a1)) (\forall (d0: +C).(\forall (w: T).((sc3 g a0 d0 w) \to (\forall (is: PList).((drop1 is d0 c) +\to (sc3 g a1 d0 (THead (Flat Appl) w (lift1 is (THeads (Flat Appl) vs (lift +(S i) O v)))))))))) (land (arity g c (THeads (Flat Appl) vs (TLRef i)) (AHead +a0 a1)) (\forall (d0: C).(\forall (w: T).((sc3 g a0 d0 w) \to (\forall (is: +PList).((drop1 is d0 c) \to (sc3 g a1 d0 (THead (Flat Appl) w (lift1 is +(THeads (Flat Appl) vs (TLRef i))))))))))) (\lambda (H4: (arity g c (THeads +(Flat Appl) vs (lift (S i) O v)) (AHead a0 a1))).(\lambda (H5: ((\forall (d0: +C).(\forall (w: T).((sc3 g a0 d0 w) \to (\forall (is: PList).((drop1 is d0 c) +\to (sc3 g a1 d0 (THead (Flat Appl) w (lift1 is (THeads (Flat Appl) vs (lift +(S i) O v)))))))))))).(conj (arity g c (THeads (Flat Appl) vs (TLRef i)) +(AHead a0 a1)) (\forall (d0: C).(\forall (w: T).((sc3 g a0 d0 w) \to (\forall +(is: PList).((drop1 is d0 c) \to (sc3 g a1 d0 (THead (Flat Appl) w (lift1 is +(THeads (Flat Appl) vs (TLRef i)))))))))) (arity_appls_abbr g c d v i H2 vs +(AHead a0 a1) H4) (\lambda (d0: C).(\lambda (w: T).(\lambda (H6: (sc3 g a0 d0 +w)).(\lambda (is: PList).(\lambda (H7: (drop1 is d0 c)).(let H_x \def +(drop1_getl_trans is c d0 H7 Abbr d v i H2) in (let H8 \def H_x in (ex2_ind C +(\lambda (e2: C).(drop1 (ptrans is i) e2 d)) (\lambda (e2: C).(getl (trans is +i) d0 (CHead e2 (Bind Abbr) (lift1 (ptrans is i) v)))) (sc3 g a1 d0 (THead +(Flat Appl) w (lift1 is (THeads (Flat Appl) vs (TLRef i))))) (\lambda (x: +C).(\lambda (_: (drop1 (ptrans is i) x d)).(\lambda (H10: (getl (trans is i) +d0 (CHead x (Bind Abbr) (lift1 (ptrans is i) v)))).(let H_y \def (H0 (TCons w +(lifts1 is vs))) in (eq_ind_r T (THeads (Flat Appl) (lifts1 is vs) (lift1 is +(TLRef i))) (\lambda (t: T).(sc3 g a1 d0 (THead (Flat Appl) w t))) (eq_ind_r +T (TLRef (trans is i)) (\lambda (t: T).(sc3 g a1 d0 (THead (Flat Appl) w +(THeads (Flat Appl) (lifts1 is vs) t)))) (H_y (trans is i) x (lift1 (ptrans +is i) v) d0 (eq_ind T (lift1 is (lift (S i) O v)) (\lambda (t: T).(sc3 g a1 +d0 (THead (Flat Appl) w (THeads (Flat Appl) (lifts1 is vs) t)))) (eq_ind T +(lift1 is (THeads (Flat Appl) vs (lift (S i) O v))) (\lambda (t: T).(sc3 g a1 +d0 (THead (Flat Appl) w t))) (H5 d0 w H6 is H7) (THeads (Flat Appl) (lifts1 +is vs) (lift1 is (lift (S i) O v))) (lifts1_flat Appl is (lift (S i) O v) +vs)) (lift (S (trans is i)) O (lift1 (ptrans is i) v)) (lift1_free is i v)) +H10) (lift1 is (TLRef i)) (lift1_lref is i)) (lift1 is (THeads (Flat Appl) vs +(TLRef i))) (lifts1_flat Appl is (TLRef i) vs)))))) H8))))))))))) +H3))))))))))))) a)). + +theorem sc3_cast: + \forall (g: G).(\forall (a: A).(\forall (vs: TList).(\forall (c: C).(\forall +(u: T).((sc3 g (asucc g a) c (THeads (Flat Appl) vs u)) \to (\forall (t: +T).((sc3 g a c (THeads (Flat Appl) vs t)) \to (sc3 g a c (THeads (Flat Appl) +vs (THead (Flat Cast) u t)))))))))) +\def + \lambda (g: G).(\lambda (a: A).(A_ind (\lambda (a0: A).(\forall (vs: +TList).(\forall (c: C).(\forall (u: T).((sc3 g (asucc g a0) c (THeads (Flat +Appl) vs u)) \to (\forall (t: T).((sc3 g a0 c (THeads (Flat Appl) vs t)) \to +(sc3 g a0 c (THeads (Flat Appl) vs (THead (Flat Cast) u t)))))))))) (\lambda +(n: nat).(\lambda (n0: nat).(\lambda (vs: TList).(\lambda (c: C).(\lambda (u: +T).(\lambda (H: (sc3 g (match n with [O \Rightarrow (ASort O (next g n0)) | +(S h) \Rightarrow (ASort h n0)]) c (THeads (Flat Appl) vs u))).(\lambda (t: +T).(\lambda (H0: (land (arity g c (THeads (Flat Appl) vs t) (ASort n n0)) +(sn3 c (THeads (Flat Appl) vs t)))).(nat_ind (\lambda (n1: nat).((sc3 g +(match n1 with [O \Rightarrow (ASort O (next g n0)) | (S h) \Rightarrow +(ASort h n0)]) c (THeads (Flat Appl) vs u)) \to ((land (arity g c (THeads +(Flat Appl) vs t) (ASort n1 n0)) (sn3 c (THeads (Flat Appl) vs t))) \to (land +(arity g c (THeads (Flat Appl) vs (THead (Flat Cast) u t)) (ASort n1 n0)) +(sn3 c (THeads (Flat Appl) vs (THead (Flat Cast) u t))))))) (\lambda (H1: +(sc3 g (ASort O (next g n0)) c (THeads (Flat Appl) vs u))).(\lambda (H2: +(land (arity g c (THeads (Flat Appl) vs t) (ASort O n0)) (sn3 c (THeads (Flat +Appl) vs t)))).(let H3 \def H1 in (and_ind (arity g c (THeads (Flat Appl) vs +u) (ASort O (next g n0))) (sn3 c (THeads (Flat Appl) vs u)) (land (arity g c +(THeads (Flat Appl) vs (THead (Flat Cast) u t)) (ASort O n0)) (sn3 c (THeads +(Flat Appl) vs (THead (Flat Cast) u t)))) (\lambda (H4: (arity g c (THeads +(Flat Appl) vs u) (ASort O (next g n0)))).(\lambda (H5: (sn3 c (THeads (Flat +Appl) vs u))).(let H6 \def H2 in (and_ind (arity g c (THeads (Flat Appl) vs +t) (ASort O n0)) (sn3 c (THeads (Flat Appl) vs t)) (land (arity g c (THeads +(Flat Appl) vs (THead (Flat Cast) u t)) (ASort O n0)) (sn3 c (THeads (Flat +Appl) vs (THead (Flat Cast) u t)))) (\lambda (H7: (arity g c (THeads (Flat +Appl) vs t) (ASort O n0))).(\lambda (H8: (sn3 c (THeads (Flat Appl) vs +t))).(conj (arity g c (THeads (Flat Appl) vs (THead (Flat Cast) u t)) (ASort +O n0)) (sn3 c (THeads (Flat Appl) vs (THead (Flat Cast) u t))) +(arity_appls_cast g c u t vs (ASort O n0) H4 H7) (sn3_appls_cast c vs u H5 t +H8)))) H6)))) H3)))) (\lambda (n1: nat).(\lambda (_: (((sc3 g (match n1 with +[O \Rightarrow (ASort O (next g n0)) | (S h) \Rightarrow (ASort h n0)]) c +(THeads (Flat Appl) vs u)) \to ((land (arity g c (THeads (Flat Appl) vs t) +(ASort n1 n0)) (sn3 c (THeads (Flat Appl) vs t))) \to (land (arity g c +(THeads (Flat Appl) vs (THead (Flat Cast) u t)) (ASort n1 n0)) (sn3 c (THeads +(Flat Appl) vs (THead (Flat Cast) u t)))))))).(\lambda (H1: (sc3 g (ASort n1 +n0) c (THeads (Flat Appl) vs u))).(\lambda (H2: (land (arity g c (THeads +(Flat Appl) vs t) (ASort (S n1) n0)) (sn3 c (THeads (Flat Appl) vs t)))).(let +H3 \def H1 in (and_ind (arity g c (THeads (Flat Appl) vs u) (ASort n1 n0)) +(sn3 c (THeads (Flat Appl) vs u)) (land (arity g c (THeads (Flat Appl) vs +(THead (Flat Cast) u t)) (ASort (S n1) n0)) (sn3 c (THeads (Flat Appl) vs +(THead (Flat Cast) u t)))) (\lambda (H4: (arity g c (THeads (Flat Appl) vs u) +(ASort n1 n0))).(\lambda (H5: (sn3 c (THeads (Flat Appl) vs u))).(let H6 \def +H2 in (and_ind (arity g c (THeads (Flat Appl) vs t) (ASort (S n1) n0)) (sn3 c +(THeads (Flat Appl) vs t)) (land (arity g c (THeads (Flat Appl) vs (THead +(Flat Cast) u t)) (ASort (S n1) n0)) (sn3 c (THeads (Flat Appl) vs (THead +(Flat Cast) u t)))) (\lambda (H7: (arity g c (THeads (Flat Appl) vs t) (ASort +(S n1) n0))).(\lambda (H8: (sn3 c (THeads (Flat Appl) vs t))).(conj (arity g +c (THeads (Flat Appl) vs (THead (Flat Cast) u t)) (ASort (S n1) n0)) (sn3 c +(THeads (Flat Appl) vs (THead (Flat Cast) u t))) (arity_appls_cast g c u t vs +(ASort (S n1) n0) H4 H7) (sn3_appls_cast c vs u H5 t H8)))) H6)))) H3)))))) n +H H0))))))))) (\lambda (a0: A).(\lambda (_: ((\forall (vs: TList).(\forall +(c: C).(\forall (u: T).((sc3 g (asucc g a0) c (THeads (Flat Appl) vs u)) \to +(\forall (t: T).((sc3 g a0 c (THeads (Flat Appl) vs t)) \to (sc3 g a0 c +(THeads (Flat Appl) vs (THead (Flat Cast) u t))))))))))).(\lambda (a1: +A).(\lambda (H0: ((\forall (vs: TList).(\forall (c: C).(\forall (u: T).((sc3 +g (asucc g a1) c (THeads (Flat Appl) vs u)) \to (\forall (t: T).((sc3 g a1 c +(THeads (Flat Appl) vs t)) \to (sc3 g a1 c (THeads (Flat Appl) vs (THead +(Flat Cast) u t))))))))))).(\lambda (vs: TList).(\lambda (c: C).(\lambda (u: +T).(\lambda (H1: (land (arity g c (THeads (Flat Appl) vs u) (AHead a0 (asucc +g a1))) (\forall (d: C).(\forall (w: T).((sc3 g a0 d w) \to (\forall (is: +PList).((drop1 is d c) \to (sc3 g (asucc g a1) d (THead (Flat Appl) w (lift1 +is (THeads (Flat Appl) vs u))))))))))).(\lambda (t: T).(\lambda (H2: (land +(arity g c (THeads (Flat Appl) vs t) (AHead a0 a1)) (\forall (d: C).(\forall +(w: T).((sc3 g a0 d w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a1 +d (THead (Flat Appl) w (lift1 is (THeads (Flat Appl) vs t))))))))))).(let H3 +\def H1 in (and_ind (arity g c (THeads (Flat Appl) vs u) (AHead a0 (asucc g +a1))) (\forall (d: C).(\forall (w: T).((sc3 g a0 d w) \to (\forall (is: +PList).((drop1 is d c) \to (sc3 g (asucc g a1) d (THead (Flat Appl) w (lift1 +is (THeads (Flat Appl) vs u))))))))) (land (arity g c (THeads (Flat Appl) vs +(THead (Flat Cast) u t)) (AHead a0 a1)) (\forall (d: C).(\forall (w: T).((sc3 +g a0 d w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a1 d (THead +(Flat Appl) w (lift1 is (THeads (Flat Appl) vs (THead (Flat Cast) u +t))))))))))) (\lambda (H4: (arity g c (THeads (Flat Appl) vs u) (AHead a0 +(asucc g a1)))).(\lambda (H5: ((\forall (d: C).(\forall (w: T).((sc3 g a0 d +w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g (asucc g a1) d (THead +(Flat Appl) w (lift1 is (THeads (Flat Appl) vs u))))))))))).(let H6 \def H2 +in (and_ind (arity g c (THeads (Flat Appl) vs t) (AHead a0 a1)) (\forall (d: +C).(\forall (w: T).((sc3 g a0 d w) \to (\forall (is: PList).((drop1 is d c) +\to (sc3 g a1 d (THead (Flat Appl) w (lift1 is (THeads (Flat Appl) vs +t))))))))) (land (arity g c (THeads (Flat Appl) vs (THead (Flat Cast) u t)) +(AHead a0 a1)) (\forall (d: C).(\forall (w: T).((sc3 g a0 d w) \to (\forall +(is: PList).((drop1 is d c) \to (sc3 g a1 d (THead (Flat Appl) w (lift1 is +(THeads (Flat Appl) vs (THead (Flat Cast) u t))))))))))) (\lambda (H7: (arity +g c (THeads (Flat Appl) vs t) (AHead a0 a1))).(\lambda (H8: ((\forall (d: +C).(\forall (w: T).((sc3 g a0 d w) \to (\forall (is: PList).((drop1 is d c) +\to (sc3 g a1 d (THead (Flat Appl) w (lift1 is (THeads (Flat Appl) vs +t))))))))))).(conj (arity g c (THeads (Flat Appl) vs (THead (Flat Cast) u t)) +(AHead a0 a1)) (\forall (d: C).(\forall (w: T).((sc3 g a0 d w) \to (\forall +(is: PList).((drop1 is d c) \to (sc3 g a1 d (THead (Flat Appl) w (lift1 is +(THeads (Flat Appl) vs (THead (Flat Cast) u t)))))))))) (arity_appls_cast g c +u t vs (AHead a0 a1) H4 H7) (\lambda (d: C).(\lambda (w: T).(\lambda (H9: +(sc3 g a0 d w)).(\lambda (is: PList).(\lambda (H10: (drop1 is d c)).(let H_y +\def (H0 (TCons w (lifts1 is vs))) in (eq_ind_r T (THeads (Flat Appl) (lifts1 +is vs) (lift1 is (THead (Flat Cast) u t))) (\lambda (t0: T).(sc3 g a1 d +(THead (Flat Appl) w t0))) (eq_ind_r T (THead (Flat Cast) (lift1 is u) (lift1 +is t)) (\lambda (t0: T).(sc3 g a1 d (THead (Flat Appl) w (THeads (Flat Appl) +(lifts1 is vs) t0)))) (H_y d (lift1 is u) (eq_ind T (lift1 is (THeads (Flat +Appl) vs u)) (\lambda (t0: T).(sc3 g (asucc g a1) d (THead (Flat Appl) w +t0))) (H5 d w H9 is H10) (THeads (Flat Appl) (lifts1 is vs) (lift1 is u)) +(lifts1_flat Appl is u vs)) (lift1 is t) (eq_ind T (lift1 is (THeads (Flat +Appl) vs t)) (\lambda (t0: T).(sc3 g a1 d (THead (Flat Appl) w t0))) (H8 d w +H9 is H10) (THeads (Flat Appl) (lifts1 is vs) (lift1 is t)) (lifts1_flat Appl +is t vs))) (lift1 is (THead (Flat Cast) u t)) (lift1_flat Cast is u t)) +(lift1 is (THeads (Flat Appl) vs (THead (Flat Cast) u t))) (lifts1_flat Appl +is (THead (Flat Cast) u t) vs))))))))))) H6)))) H3)))))))))))) a)). + +theorem sc3_props__sc3_sn3_abst: + \forall (g: G).(\forall (a: A).(land (\forall (c: C).(\forall (t: T).((sc3 g +a c t) \to (sn3 c t)))) (\forall (vs: TList).(\forall (i: nat).(let t \def +(THeads (Flat Appl) vs (TLRef i)) in (\forall (c: C).((arity g c t a) \to +((nf2 c (TLRef i)) \to ((sns3 c vs) \to (sc3 g a c t)))))))))) +\def + \lambda (g: G).(\lambda (a: A).(A_ind (\lambda (a0: A).(land (\forall (c: +C).(\forall (t: T).((sc3 g a0 c t) \to (sn3 c t)))) (\forall (vs: +TList).(\forall (i: nat).(let t \def (THeads (Flat Appl) vs (TLRef i)) in +(\forall (c: C).((arity g c t a0) \to ((nf2 c (TLRef i)) \to ((sns3 c vs) \to +(sc3 g a0 c t)))))))))) (\lambda (n: nat).(\lambda (n0: nat).(conj (\forall +(c: C).(\forall (t: T).((land (arity g c t (ASort n n0)) (sn3 c t)) \to (sn3 +c t)))) (\forall (vs: TList).(\forall (i: nat).(\forall (c: C).((arity g c +(THeads (Flat Appl) vs (TLRef i)) (ASort n n0)) \to ((nf2 c (TLRef i)) \to +((sns3 c vs) \to (land (arity g c (THeads (Flat Appl) vs (TLRef i)) (ASort n +n0)) (sn3 c (THeads (Flat Appl) vs (TLRef i)))))))))) (\lambda (c: +C).(\lambda (t: T).(\lambda (H: (land (arity g c t (ASort n n0)) (sn3 c +t))).(let H0 \def H in (and_ind (arity g c t (ASort n n0)) (sn3 c t) (sn3 c +t) (\lambda (_: (arity g c t (ASort n n0))).(\lambda (H2: (sn3 c t)).H2)) +H0))))) (\lambda (vs: TList).(\lambda (i: nat).(\lambda (c: C).(\lambda (H: +(arity g c (THeads (Flat Appl) vs (TLRef i)) (ASort n n0))).(\lambda (H0: +(nf2 c (TLRef i))).(\lambda (H1: (sns3 c vs)).(conj (arity g c (THeads (Flat +Appl) vs (TLRef i)) (ASort n n0)) (sn3 c (THeads (Flat Appl) vs (TLRef i))) H +(sn3_appls_lref c i H0 vs H1))))))))))) (\lambda (a0: A).(\lambda (H: (land +(\forall (c: C).(\forall (t: T).((sc3 g a0 c t) \to (sn3 c t)))) (\forall +(vs: TList).(\forall (i: nat).(\forall (c: C).((arity g c (THeads (Flat Appl) +vs (TLRef i)) a0) \to ((nf2 c (TLRef i)) \to ((sns3 c vs) \to (sc3 g a0 c +(THeads (Flat Appl) vs (TLRef i))))))))))).(\lambda (a1: A).(\lambda (H0: +(land (\forall (c: C).(\forall (t: T).((sc3 g a1 c t) \to (sn3 c t)))) +(\forall (vs: TList).(\forall (i: nat).(\forall (c: C).((arity g c (THeads +(Flat Appl) vs (TLRef i)) a1) \to ((nf2 c (TLRef i)) \to ((sns3 c vs) \to +(sc3 g a1 c (THeads (Flat Appl) vs (TLRef i))))))))))).(conj (\forall (c: +C).(\forall (t: T).((land (arity g c t (AHead a0 a1)) (\forall (d: +C).(\forall (w: T).((sc3 g a0 d w) \to (\forall (is: PList).((drop1 is d c) +\to (sc3 g a1 d (THead (Flat Appl) w (lift1 is t))))))))) \to (sn3 c t)))) +(\forall (vs: TList).(\forall (i: nat).(\forall (c: C).((arity g c (THeads +(Flat Appl) vs (TLRef i)) (AHead a0 a1)) \to ((nf2 c (TLRef i)) \to ((sns3 c +vs) \to (land (arity g c (THeads (Flat Appl) vs (TLRef i)) (AHead a0 a1)) +(\forall (d: C).(\forall (w: T).((sc3 g a0 d w) \to (\forall (is: +PList).((drop1 is d c) \to (sc3 g a1 d (THead (Flat Appl) w (lift1 is (THeads +(Flat Appl) vs (TLRef i))))))))))))))))) (\lambda (c: C).(\lambda (t: +T).(\lambda (H1: (land (arity g c t (AHead a0 a1)) (\forall (d: C).(\forall +(w: T).((sc3 g a0 d w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a1 +d (THead (Flat Appl) w (lift1 is t)))))))))).(let H2 \def H in (and_ind +(\forall (c0: C).(\forall (t0: T).((sc3 g a0 c0 t0) \to (sn3 c0 t0)))) +(\forall (vs: TList).(\forall (i: nat).(\forall (c0: C).((arity g c0 (THeads +(Flat Appl) vs (TLRef i)) a0) \to ((nf2 c0 (TLRef i)) \to ((sns3 c0 vs) \to +(sc3 g a0 c0 (THeads (Flat Appl) vs (TLRef i))))))))) (sn3 c t) (\lambda (_: +((\forall (c0: C).(\forall (t0: T).((sc3 g a0 c0 t0) \to (sn3 c0 +t0)))))).(\lambda (H4: ((\forall (vs: TList).(\forall (i: nat).(\forall (c0: +C).((arity g c0 (THeads (Flat Appl) vs (TLRef i)) a0) \to ((nf2 c0 (TLRef i)) +\to ((sns3 c0 vs) \to (sc3 g a0 c0 (THeads (Flat Appl) vs (TLRef +i))))))))))).(let H5 \def H0 in (and_ind (\forall (c0: C).(\forall (t0: +T).((sc3 g a1 c0 t0) \to (sn3 c0 t0)))) (\forall (vs: TList).(\forall (i: +nat).(\forall (c0: C).((arity g c0 (THeads (Flat Appl) vs (TLRef i)) a1) \to +((nf2 c0 (TLRef i)) \to ((sns3 c0 vs) \to (sc3 g a1 c0 (THeads (Flat Appl) vs +(TLRef i))))))))) (sn3 c t) (\lambda (H6: ((\forall (c0: C).(\forall (t0: +T).((sc3 g a1 c0 t0) \to (sn3 c0 t0)))))).(\lambda (_: ((\forall (vs: +TList).(\forall (i: nat).(\forall (c0: C).((arity g c0 (THeads (Flat Appl) vs +(TLRef i)) a1) \to ((nf2 c0 (TLRef i)) \to ((sns3 c0 vs) \to (sc3 g a1 c0 +(THeads (Flat Appl) vs (TLRef i))))))))))).(let H8 \def H1 in (and_ind (arity +g c t (AHead a0 a1)) (\forall (d: C).(\forall (w: T).((sc3 g a0 d w) \to +(\forall (is: PList).((drop1 is d c) \to (sc3 g a1 d (THead (Flat Appl) w +(lift1 is t)))))))) (sn3 c t) (\lambda (H9: (arity g c t (AHead a0 +a1))).(\lambda (H10: ((\forall (d: C).(\forall (w: T).((sc3 g a0 d w) \to +(\forall (is: PList).((drop1 is d c) \to (sc3 g a1 d (THead (Flat Appl) w +(lift1 is t)))))))))).(let H_y \def (arity_aprem g c t (AHead a0 a1) H9 O a0) +in (let H11 \def (H_y (aprem_zero a0 a1)) in (ex2_3_ind C T nat (\lambda (d: +C).(\lambda (_: T).(\lambda (j: nat).(drop j O d c)))) (\lambda (d: +C).(\lambda (u: T).(\lambda (_: nat).(arity g d u (asucc g a0))))) (sn3 c t) +(\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: nat).(\lambda (H12: (drop x2 +O x0 c)).(\lambda (H13: (arity g x0 x1 (asucc g a0))).(let H_y0 \def (H10 +(CHead x0 (Bind Abst) x1) (TLRef O) (H4 TNil O (CHead x0 (Bind Abst) x1) +(arity_abst g (CHead x0 (Bind Abst) x1) x0 x1 O (getl_refl Abst x0 x1) a0 +H13) (nf2_lref_abst (CHead x0 (Bind Abst) x1) x0 x1 O (getl_refl Abst x0 x1)) +I) (PCons (S x2) O PNil)) in (let H_y1 \def (H6 (CHead x0 (Bind Abst) x1) +(THead (Flat Appl) (TLRef O) (lift (S x2) O t)) (H_y0 (drop1_cons (CHead x0 +(Bind Abst) x1) c (S x2) O (drop_drop (Bind Abst) x2 x0 c H12 x1) c PNil +(drop1_nil c)))) in (let H_x \def (sn3_gen_flat Appl (CHead x0 (Bind Abst) +x1) (TLRef O) (lift (S x2) O t) H_y1) in (let H14 \def H_x in (and_ind (sn3 +(CHead x0 (Bind Abst) x1) (TLRef O)) (sn3 (CHead x0 (Bind Abst) x1) (lift (S +x2) O t)) (sn3 c t) (\lambda (_: (sn3 (CHead x0 (Bind Abst) x1) (TLRef +O))).(\lambda (H16: (sn3 (CHead x0 (Bind Abst) x1) (lift (S x2) O +t))).(sn3_gen_lift (CHead x0 (Bind Abst) x1) t (S x2) O H16 c (drop_drop +(Bind Abst) x2 x0 c H12 x1)))) H14)))))))))) H11))))) H8)))) H5)))) H2))))) +(\lambda (vs: TList).(\lambda (i: nat).(\lambda (c: C).(\lambda (H1: (arity g +c (THeads (Flat Appl) vs (TLRef i)) (AHead a0 a1))).(\lambda (H2: (nf2 c +(TLRef i))).(\lambda (H3: (sns3 c vs)).(conj (arity g c (THeads (Flat Appl) +vs (TLRef i)) (AHead a0 a1)) (\forall (d: C).(\forall (w: T).((sc3 g a0 d w) +\to (\forall (is: PList).((drop1 is d c) \to (sc3 g a1 d (THead (Flat Appl) w +(lift1 is (THeads (Flat Appl) vs (TLRef i)))))))))) H1 (\lambda (d: +C).(\lambda (w: T).(\lambda (H4: (sc3 g a0 d w)).(\lambda (is: +PList).(\lambda (H5: (drop1 is d c)).(let H6 \def H in (and_ind (\forall (c0: +C).(\forall (t: T).((sc3 g a0 c0 t) \to (sn3 c0 t)))) (\forall (vs0: +TList).(\forall (i0: nat).(\forall (c0: C).((arity g c0 (THeads (Flat Appl) +vs0 (TLRef i0)) a0) \to ((nf2 c0 (TLRef i0)) \to ((sns3 c0 vs0) \to (sc3 g a0 +c0 (THeads (Flat Appl) vs0 (TLRef i0))))))))) (sc3 g a1 d (THead (Flat Appl) +w (lift1 is (THeads (Flat Appl) vs (TLRef i))))) (\lambda (H7: ((\forall (c0: +C).(\forall (t: T).((sc3 g a0 c0 t) \to (sn3 c0 t)))))).(\lambda (_: +((\forall (vs0: TList).(\forall (i0: nat).(\forall (c0: C).((arity g c0 +(THeads (Flat Appl) vs0 (TLRef i0)) a0) \to ((nf2 c0 (TLRef i0)) \to ((sns3 +c0 vs0) \to (sc3 g a0 c0 (THeads (Flat Appl) vs0 (TLRef i0))))))))))).(let H9 +\def H0 in (and_ind (\forall (c0: C).(\forall (t: T).((sc3 g a1 c0 t) \to +(sn3 c0 t)))) (\forall (vs0: TList).(\forall (i0: nat).(\forall (c0: +C).((arity g c0 (THeads (Flat Appl) vs0 (TLRef i0)) a1) \to ((nf2 c0 (TLRef +i0)) \to ((sns3 c0 vs0) \to (sc3 g a1 c0 (THeads (Flat Appl) vs0 (TLRef +i0))))))))) (sc3 g a1 d (THead (Flat Appl) w (lift1 is (THeads (Flat Appl) vs +(TLRef i))))) (\lambda (_: ((\forall (c0: C).(\forall (t: T).((sc3 g a1 c0 t) +\to (sn3 c0 t)))))).(\lambda (H11: ((\forall (vs0: TList).(\forall (i0: +nat).(\forall (c0: C).((arity g c0 (THeads (Flat Appl) vs0 (TLRef i0)) a1) +\to ((nf2 c0 (TLRef i0)) \to ((sns3 c0 vs0) \to (sc3 g a1 c0 (THeads (Flat +Appl) vs0 (TLRef i0))))))))))).(let H_y \def (H11 (TCons w (lifts1 is vs))) +in (eq_ind_r T (THeads (Flat Appl) (lifts1 is vs) (lift1 is (TLRef i))) +(\lambda (t: T).(sc3 g a1 d (THead (Flat Appl) w t))) (eq_ind_r T (TLRef +(trans is i)) (\lambda (t: T).(sc3 g a1 d (THead (Flat Appl) w (THeads (Flat +Appl) (lifts1 is vs) t)))) (H_y (trans is i) d (eq_ind T (lift1 is (TLRef i)) +(\lambda (t: T).(arity g d (THead (Flat Appl) w (THeads (Flat Appl) (lifts1 +is vs) t)) a1)) (eq_ind T (lift1 is (THeads (Flat Appl) vs (TLRef i))) +(\lambda (t: T).(arity g d (THead (Flat Appl) w t) a1)) (arity_appl g d w a0 +(sc3_arity_gen g d w a0 H4) (lift1 is (THeads (Flat Appl) vs (TLRef i))) a1 +(arity_lift1 g (AHead a0 a1) c is d (THeads (Flat Appl) vs (TLRef i)) H5 H1)) +(THeads (Flat Appl) (lifts1 is vs) (lift1 is (TLRef i))) (lifts1_flat Appl is +(TLRef i) vs)) (TLRef (trans is i)) (lift1_lref is i)) (eq_ind T (lift1 is +(TLRef i)) (\lambda (t: T).(nf2 d t)) (nf2_lift1 c is d (TLRef i) H5 H2) +(TLRef (trans is i)) (lift1_lref is i)) (conj (sn3 d w) (sns3 d (lifts1 is +vs)) (H7 d w H4) (sns3_lifts1 c is d H5 vs H3))) (lift1 is (TLRef i)) +(lift1_lref is i)) (lift1 is (THeads (Flat Appl) vs (TLRef i))) (lifts1_flat +Appl is (TLRef i) vs))))) H9)))) H6))))))))))))))))))) a)). + +theorem sc3_sn3: + \forall (g: G).(\forall (a: A).(\forall (c: C).(\forall (t: T).((sc3 g a c +t) \to (sn3 c t))))) +\def + \lambda (g: G).(\lambda (a: A).(\lambda (c: C).(\lambda (t: T).(\lambda (H: +(sc3 g a c t)).(let H_x \def (sc3_props__sc3_sn3_abst g a) in (let H0 \def +H_x in (and_ind (\forall (c0: C).(\forall (t0: T).((sc3 g a c0 t0) \to (sn3 +c0 t0)))) (\forall (vs: TList).(\forall (i: nat).(let t0 \def (THeads (Flat +Appl) vs (TLRef i)) in (\forall (c0: C).((arity g c0 t0 a) \to ((nf2 c0 +(TLRef i)) \to ((sns3 c0 vs) \to (sc3 g a c0 t0)))))))) (sn3 c t) (\lambda +(H1: ((\forall (c0: C).(\forall (t0: T).((sc3 g a c0 t0) \to (sn3 c0 +t0)))))).(\lambda (_: ((\forall (vs: TList).(\forall (i: nat).(let t0 \def +(THeads (Flat Appl) vs (TLRef i)) in (\forall (c0: C).((arity g c0 t0 a) \to +((nf2 c0 (TLRef i)) \to ((sns3 c0 vs) \to (sc3 g a c0 t0)))))))))).(H1 c t +H))) H0))))))). + +theorem sc3_abst: + \forall (g: G).(\forall (a: A).(\forall (vs: TList).(\forall (c: C).(\forall +(i: nat).((arity g c (THeads (Flat Appl) vs (TLRef i)) a) \to ((nf2 c (TLRef +i)) \to ((sns3 c vs) \to (sc3 g a c (THeads (Flat Appl) vs (TLRef i)))))))))) +\def + \lambda (g: G).(\lambda (a: A).(\lambda (vs: TList).(\lambda (c: C).(\lambda +(i: nat).(\lambda (H: (arity g c (THeads (Flat Appl) vs (TLRef i)) +a)).(\lambda (H0: (nf2 c (TLRef i))).(\lambda (H1: (sns3 c vs)).(let H_x \def +(sc3_props__sc3_sn3_abst g a) in (let H2 \def H_x in (and_ind (\forall (c0: +C).(\forall (t: T).((sc3 g a c0 t) \to (sn3 c0 t)))) (\forall (vs0: +TList).(\forall (i0: nat).(let t \def (THeads (Flat Appl) vs0 (TLRef i0)) in +(\forall (c0: C).((arity g c0 t a) \to ((nf2 c0 (TLRef i0)) \to ((sns3 c0 +vs0) \to (sc3 g a c0 t)))))))) (sc3 g a c (THeads (Flat Appl) vs (TLRef i))) +(\lambda (_: ((\forall (c0: C).(\forall (t: T).((sc3 g a c0 t) \to (sn3 c0 +t)))))).(\lambda (H4: ((\forall (vs0: TList).(\forall (i0: nat).(let t \def +(THeads (Flat Appl) vs0 (TLRef i0)) in (\forall (c0: C).((arity g c0 t a) \to +((nf2 c0 (TLRef i0)) \to ((sns3 c0 vs0) \to (sc3 g a c0 t)))))))))).(H4 vs i +c H H0 H1))) H2)))))))))). + +theorem sc3_bind: + \forall (g: G).(\forall (b: B).((not (eq B b Abst)) \to (\forall (a1: +A).(\forall (a2: A).(\forall (vs: TList).(\forall (c: C).(\forall (v: +T).(\forall (t: T).((sc3 g a2 (CHead c (Bind b) v) (THeads (Flat Appl) (lifts +(S O) O vs) t)) \to ((sc3 g a1 c v) \to (sc3 g a2 c (THeads (Flat Appl) vs +(THead (Bind b) v t))))))))))))) +\def + \lambda (g: G).(\lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda +(a1: A).(\lambda (a2: A).(A_ind (\lambda (a: A).(\forall (vs: TList).(\forall +(c: C).(\forall (v: T).(\forall (t: T).((sc3 g a (CHead c (Bind b) v) (THeads +(Flat Appl) (lifts (S O) O vs) t)) \to ((sc3 g a1 c v) \to (sc3 g a c (THeads +(Flat Appl) vs (THead (Bind b) v t)))))))))) (\lambda (n: nat).(\lambda (n0: +nat).(\lambda (vs: TList).(\lambda (c: C).(\lambda (v: T).(\lambda (t: +T).(\lambda (H0: (land (arity g (CHead c (Bind b) v) (THeads (Flat Appl) +(lifts (S O) O vs) t) (ASort n n0)) (sn3 (CHead c (Bind b) v) (THeads (Flat +Appl) (lifts (S O) O vs) t)))).(\lambda (H1: (sc3 g a1 c v)).(let H2 \def H0 +in (and_ind (arity g (CHead c (Bind b) v) (THeads (Flat Appl) (lifts (S O) O +vs) t) (ASort n n0)) (sn3 (CHead c (Bind b) v) (THeads (Flat Appl) (lifts (S +O) O vs) t)) (land (arity g c (THeads (Flat Appl) vs (THead (Bind b) v t)) +(ASort n n0)) (sn3 c (THeads (Flat Appl) vs (THead (Bind b) v t)))) (\lambda +(H3: (arity g (CHead c (Bind b) v) (THeads (Flat Appl) (lifts (S O) O vs) t) +(ASort n n0))).(\lambda (H4: (sn3 (CHead c (Bind b) v) (THeads (Flat Appl) +(lifts (S O) O vs) t))).(conj (arity g c (THeads (Flat Appl) vs (THead (Bind +b) v t)) (ASort n n0)) (sn3 c (THeads (Flat Appl) vs (THead (Bind b) v t))) +(arity_appls_bind g b H c v a1 (sc3_arity_gen g c v a1 H1) t vs (ASort n n0) +H3) (sn3_appls_bind b H c v (sc3_sn3 g a1 c v H1) vs t H4)))) H2)))))))))) +(\lambda (a: A).(\lambda (_: ((\forall (vs: TList).(\forall (c: C).(\forall +(v: T).(\forall (t: T).((sc3 g a (CHead c (Bind b) v) (THeads (Flat Appl) +(lifts (S O) O vs) t)) \to ((sc3 g a1 c v) \to (sc3 g a c (THeads (Flat Appl) +vs (THead (Bind b) v t))))))))))).(\lambda (a0: A).(\lambda (H1: ((\forall +(vs: TList).(\forall (c: C).(\forall (v: T).(\forall (t: T).((sc3 g a0 (CHead +c (Bind b) v) (THeads (Flat Appl) (lifts (S O) O vs) t)) \to ((sc3 g a1 c v) +\to (sc3 g a0 c (THeads (Flat Appl) vs (THead (Bind b) v +t))))))))))).(\lambda (vs: TList).(\lambda (c: C).(\lambda (v: T).(\lambda +(t: T).(\lambda (H2: (land (arity g (CHead c (Bind b) v) (THeads (Flat Appl) +(lifts (S O) O vs) t) (AHead a a0)) (\forall (d: C).(\forall (w: T).((sc3 g a +d w) \to (\forall (is: PList).((drop1 is d (CHead c (Bind b) v)) \to (sc3 g +a0 d (THead (Flat Appl) w (lift1 is (THeads (Flat Appl) (lifts (S O) O vs) +t))))))))))).(\lambda (H3: (sc3 g a1 c v)).(let H4 \def H2 in (and_ind (arity +g (CHead c (Bind b) v) (THeads (Flat Appl) (lifts (S O) O vs) t) (AHead a +a0)) (\forall (d: C).(\forall (w: T).((sc3 g a d w) \to (\forall (is: +PList).((drop1 is d (CHead c (Bind b) v)) \to (sc3 g a0 d (THead (Flat Appl) +w (lift1 is (THeads (Flat Appl) (lifts (S O) O vs) t))))))))) (land (arity g +c (THeads (Flat Appl) vs (THead (Bind b) v t)) (AHead a a0)) (\forall (d: +C).(\forall (w: T).((sc3 g a d w) \to (\forall (is: PList).((drop1 is d c) +\to (sc3 g a0 d (THead (Flat Appl) w (lift1 is (THeads (Flat Appl) vs (THead +(Bind b) v t))))))))))) (\lambda (H5: (arity g (CHead c (Bind b) v) (THeads +(Flat Appl) (lifts (S O) O vs) t) (AHead a a0))).(\lambda (H6: ((\forall (d: +C).(\forall (w: T).((sc3 g a d w) \to (\forall (is: PList).((drop1 is d +(CHead c (Bind b) v)) \to (sc3 g a0 d (THead (Flat Appl) w (lift1 is (THeads +(Flat Appl) (lifts (S O) O vs) t))))))))))).(conj (arity g c (THeads (Flat +Appl) vs (THead (Bind b) v t)) (AHead a a0)) (\forall (d: C).(\forall (w: +T).((sc3 g a d w) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a0 d +(THead (Flat Appl) w (lift1 is (THeads (Flat Appl) vs (THead (Bind b) v +t)))))))))) (arity_appls_bind g b H c v a1 (sc3_arity_gen g c v a1 H3) t vs +(AHead a a0) H5) (\lambda (d: C).(\lambda (w: T).(\lambda (H7: (sc3 g a d +w)).(\lambda (is: PList).(\lambda (H8: (drop1 is d c)).(let H_y \def (H1 +(TCons w (lifts1 is vs))) in (eq_ind_r T (THeads (Flat Appl) (lifts1 is vs) +(lift1 is (THead (Bind b) v t))) (\lambda (t0: T).(sc3 g a0 d (THead (Flat +Appl) w t0))) (eq_ind_r T (THead (Bind b) (lift1 is v) (lift1 (Ss is) t)) +(\lambda (t0: T).(sc3 g a0 d (THead (Flat Appl) w (THeads (Flat Appl) (lifts1 +is vs) t0)))) (H_y d (lift1 is v) (lift1 (Ss is) t) (eq_ind TList (lifts1 (Ss +is) (lifts (S O) O vs)) (\lambda (t0: TList).(sc3 g a0 (CHead d (Bind b) +(lift1 is v)) (THead (Flat Appl) (lift (S O) O w) (THeads (Flat Appl) t0 +(lift1 (Ss is) t))))) (eq_ind T (lift1 (Ss is) (THeads (Flat Appl) (lifts (S +O) O vs) t)) (\lambda (t0: T).(sc3 g a0 (CHead d (Bind b) (lift1 is v)) +(THead (Flat Appl) (lift (S O) O w) t0))) (H6 (CHead d (Bind b) (lift1 is v)) +(lift (S O) O w) (sc3_lift g a d w H7 (CHead d (Bind b) (lift1 is v)) (S O) O +(drop_drop (Bind b) O d d (drop_refl d) (lift1 is v))) (Ss is) +(drop1_skip_bind b c is d v H8)) (THeads (Flat Appl) (lifts1 (Ss is) (lifts +(S O) O vs)) (lift1 (Ss is) t)) (lifts1_flat Appl (Ss is) t (lifts (S O) O +vs))) (lifts (S O) O (lifts1 is vs)) (lifts1_xhg is vs)) (sc3_lift1 g c a1 is +d v H3 H8)) (lift1 is (THead (Bind b) v t)) (lift1_bind b is v t)) (lift1 is +(THeads (Flat Appl) vs (THead (Bind b) v t))) (lifts1_flat Appl is (THead +(Bind b) v t) vs))))))))))) H4)))))))))))) a2))))). + +theorem sc3_appl: + \forall (g: G).(\forall (a1: A).(\forall (a2: A).(\forall (vs: +TList).(\forall (c: C).(\forall (v: T).(\forall (t: T).((sc3 g a2 c (THeads +(Flat Appl) vs (THead (Bind Abbr) v t))) \to ((sc3 g a1 c v) \to (\forall (w: +T).((sc3 g (asucc g a1) c w) \to (sc3 g a2 c (THeads (Flat Appl) vs (THead +(Flat Appl) v (THead (Bind Abst) w t)))))))))))))) +\def + \lambda (g: G).(\lambda (a1: A).(\lambda (a2: A).(A_ind (\lambda (a: +A).(\forall (vs: TList).(\forall (c: C).(\forall (v: T).(\forall (t: T).((sc3 +g a c (THeads (Flat Appl) vs (THead (Bind Abbr) v t))) \to ((sc3 g a1 c v) +\to (\forall (w: T).((sc3 g (asucc g a1) c w) \to (sc3 g a c (THeads (Flat +Appl) vs (THead (Flat Appl) v (THead (Bind Abst) w t))))))))))))) (\lambda +(n: nat).(\lambda (n0: nat).(\lambda (vs: TList).(\lambda (c: C).(\lambda (v: +T).(\lambda (t: T).(\lambda (H: (land (arity g c (THeads (Flat Appl) vs +(THead (Bind Abbr) v t)) (ASort n n0)) (sn3 c (THeads (Flat Appl) vs (THead +(Bind Abbr) v t))))).(\lambda (H0: (sc3 g a1 c v)).(\lambda (w: T).(\lambda +(H1: (sc3 g (asucc g a1) c w)).(let H2 \def H in (and_ind (arity g c (THeads +(Flat Appl) vs (THead (Bind Abbr) v t)) (ASort n n0)) (sn3 c (THeads (Flat +Appl) vs (THead (Bind Abbr) v t))) (land (arity g c (THeads (Flat Appl) vs +(THead (Flat Appl) v (THead (Bind Abst) w t))) (ASort n n0)) (sn3 c (THeads +(Flat Appl) vs (THead (Flat Appl) v (THead (Bind Abst) w t))))) (\lambda (H3: +(arity g c (THeads (Flat Appl) vs (THead (Bind Abbr) v t)) (ASort n +n0))).(\lambda (H4: (sn3 c (THeads (Flat Appl) vs (THead (Bind Abbr) v +t)))).(conj (arity g c (THeads (Flat Appl) vs (THead (Flat Appl) v (THead +(Bind Abst) w t))) (ASort n n0)) (sn3 c (THeads (Flat Appl) vs (THead (Flat +Appl) v (THead (Bind Abst) w t)))) (arity_appls_appl g c v a1 (sc3_arity_gen +g c v a1 H0) w (sc3_arity_gen g c w (asucc g a1) H1) t vs (ASort n n0) H3) +(sn3_appls_beta c v t vs H4 w (sc3_sn3 g (asucc g a1) c w H1))))) +H2)))))))))))) (\lambda (a: A).(\lambda (_: ((\forall (vs: TList).(\forall +(c: C).(\forall (v: T).(\forall (t: T).((sc3 g a c (THeads (Flat Appl) vs +(THead (Bind Abbr) v t))) \to ((sc3 g a1 c v) \to (\forall (w: T).((sc3 g +(asucc g a1) c w) \to (sc3 g a c (THeads (Flat Appl) vs (THead (Flat Appl) v +(THead (Bind Abst) w t)))))))))))))).(\lambda (a0: A).(\lambda (H0: ((\forall +(vs: TList).(\forall (c: C).(\forall (v: T).(\forall (t: T).((sc3 g a0 c +(THeads (Flat Appl) vs (THead (Bind Abbr) v t))) \to ((sc3 g a1 c v) \to +(\forall (w: T).((sc3 g (asucc g a1) c w) \to (sc3 g a0 c (THeads (Flat Appl) +vs (THead (Flat Appl) v (THead (Bind Abst) w t)))))))))))))).(\lambda (vs: +TList).(\lambda (c: C).(\lambda (v: T).(\lambda (t: T).(\lambda (H1: (land +(arity g c (THeads (Flat Appl) vs (THead (Bind Abbr) v t)) (AHead a a0)) +(\forall (d: C).(\forall (w: T).((sc3 g a d w) \to (\forall (is: +PList).((drop1 is d c) \to (sc3 g a0 d (THead (Flat Appl) w (lift1 is (THeads +(Flat Appl) vs (THead (Bind Abbr) v t)))))))))))).(\lambda (H2: (sc3 g a1 c +v)).(\lambda (w: T).(\lambda (H3: (sc3 g (asucc g a1) c w)).(let H4 \def H1 +in (and_ind (arity g c (THeads (Flat Appl) vs (THead (Bind Abbr) v t)) (AHead +a a0)) (\forall (d: C).(\forall (w0: T).((sc3 g a d w0) \to (\forall (is: +PList).((drop1 is d c) \to (sc3 g a0 d (THead (Flat Appl) w0 (lift1 is +(THeads (Flat Appl) vs (THead (Bind Abbr) v t)))))))))) (land (arity g c +(THeads (Flat Appl) vs (THead (Flat Appl) v (THead (Bind Abst) w t))) (AHead +a a0)) (\forall (d: C).(\forall (w0: T).((sc3 g a d w0) \to (\forall (is: +PList).((drop1 is d c) \to (sc3 g a0 d (THead (Flat Appl) w0 (lift1 is +(THeads (Flat Appl) vs (THead (Flat Appl) v (THead (Bind Abst) w +t)))))))))))) (\lambda (H5: (arity g c (THeads (Flat Appl) vs (THead (Bind +Abbr) v t)) (AHead a a0))).(\lambda (H6: ((\forall (d: C).(\forall (w0: +T).((sc3 g a d w0) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a0 d +(THead (Flat Appl) w0 (lift1 is (THeads (Flat Appl) vs (THead (Bind Abbr) v +t)))))))))))).(conj (arity g c (THeads (Flat Appl) vs (THead (Flat Appl) v +(THead (Bind Abst) w t))) (AHead a a0)) (\forall (d: C).(\forall (w0: +T).((sc3 g a d w0) \to (\forall (is: PList).((drop1 is d c) \to (sc3 g a0 d +(THead (Flat Appl) w0 (lift1 is (THeads (Flat Appl) vs (THead (Flat Appl) v +(THead (Bind Abst) w t))))))))))) (arity_appls_appl g c v a1 (sc3_arity_gen g +c v a1 H2) w (sc3_arity_gen g c w (asucc g a1) H3) t vs (AHead a a0) H5) +(\lambda (d: C).(\lambda (w0: T).(\lambda (H7: (sc3 g a d w0)).(\lambda (is: +PList).(\lambda (H8: (drop1 is d c)).(eq_ind_r T (THeads (Flat Appl) (lifts1 +is vs) (lift1 is (THead (Flat Appl) v (THead (Bind Abst) w t)))) (\lambda +(t0: T).(sc3 g a0 d (THead (Flat Appl) w0 t0))) (eq_ind_r T (THead (Flat +Appl) (lift1 is v) (lift1 is (THead (Bind Abst) w t))) (\lambda (t0: T).(sc3 +g a0 d (THead (Flat Appl) w0 (THeads (Flat Appl) (lifts1 is vs) t0)))) +(eq_ind_r T (THead (Bind Abst) (lift1 is w) (lift1 (Ss is) t)) (\lambda (t0: +T).(sc3 g a0 d (THead (Flat Appl) w0 (THeads (Flat Appl) (lifts1 is vs) +(THead (Flat Appl) (lift1 is v) t0))))) (let H_y \def (H0 (TCons w0 (lifts1 +is vs))) in (H_y d (lift1 is v) (lift1 (Ss is) t) (eq_ind T (lift1 is (THead +(Bind Abbr) v t)) (\lambda (t0: T).(sc3 g a0 d (THead (Flat Appl) w0 (THeads +(Flat Appl) (lifts1 is vs) t0)))) (eq_ind T (lift1 is (THeads (Flat Appl) vs +(THead (Bind Abbr) v t))) (\lambda (t0: T).(sc3 g a0 d (THead (Flat Appl) w0 +t0))) (H6 d w0 H7 is H8) (THeads (Flat Appl) (lifts1 is vs) (lift1 is (THead +(Bind Abbr) v t))) (lifts1_flat Appl is (THead (Bind Abbr) v t) vs)) (THead +(Bind Abbr) (lift1 is v) (lift1 (Ss is) t)) (lift1_bind Abbr is v t)) +(sc3_lift1 g c a1 is d v H2 H8) (lift1 is w) (sc3_lift1 g c (asucc g a1) is d +w H3 H8))) (lift1 is (THead (Bind Abst) w t)) (lift1_bind Abst is w t)) +(lift1 is (THead (Flat Appl) v (THead (Bind Abst) w t))) (lift1_flat Appl is +v (THead (Bind Abst) w t))) (lift1 is (THeads (Flat Appl) vs (THead (Flat +Appl) v (THead (Bind Abst) w t)))) (lifts1_flat Appl is (THead (Flat Appl) v +(THead (Bind Abst) w t)) vs)))))))))) H4)))))))))))))) a2))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/defs.ma new file mode 100644 index 000000000..0d38de3a8 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/defs.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/sn3/defs". + +include "pr3/defs.ma". + +inductive sn3 (c: C): T \to Prop \def +| sn3_sing: \forall (t1: T).(((\forall (t2: T).((((eq T t1 t2) \to (\forall +(P: Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c t2))))) \to (sn3 c t1)). + +definition sns3: + C \to (TList \to Prop) +\def + let rec sns3 (c: C) (ts: TList) on ts: Prop \def (match ts with [TNil +\Rightarrow True | (TCons t ts0) \Rightarrow (land (sn3 c t) (sns3 c ts0))]) +in sns3. + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/fwd.ma new file mode 100644 index 000000000..779e4a8cf --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/fwd.ma @@ -0,0 +1,183 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/sn3/fwd". + +include "sn3/defs.ma". + +include "pr3/props.ma". + +theorem sn3_gen_bind: + \forall (b: B).(\forall (c: C).(\forall (u: T).(\forall (t: T).((sn3 c +(THead (Bind b) u t)) \to (land (sn3 c u) (sn3 (CHead c (Bind b) u) t)))))) +\def + \lambda (b: B).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: +(sn3 c (THead (Bind b) u t))).(insert_eq T (THead (Bind b) u t) (\lambda (t0: +T).(sn3 c t0)) (land (sn3 c u) (sn3 (CHead c (Bind b) u) t)) (\lambda (y: +T).(\lambda (H0: (sn3 c y)).(unintro T t (\lambda (t0: T).((eq T y (THead +(Bind b) u t0)) \to (land (sn3 c u) (sn3 (CHead c (Bind b) u) t0)))) (unintro +T u (\lambda (t0: T).(\forall (x: T).((eq T y (THead (Bind b) t0 x)) \to +(land (sn3 c t0) (sn3 (CHead c (Bind b) t0) x))))) (sn3_ind c (\lambda (t0: +T).(\forall (x: T).(\forall (x0: T).((eq T t0 (THead (Bind b) x x0)) \to +(land (sn3 c x) (sn3 (CHead c (Bind b) x) x0)))))) (\lambda (t1: T).(\lambda +(H1: ((\forall (t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 +c t1 t2) \to (sn3 c t2)))))).(\lambda (H2: ((\forall (t2: T).((((eq T t1 t2) +\to (\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to (\forall (x: T).(\forall +(x0: T).((eq T t2 (THead (Bind b) x x0)) \to (land (sn3 c x) (sn3 (CHead c +(Bind b) x) x0)))))))))).(\lambda (x: T).(\lambda (x0: T).(\lambda (H3: (eq T +t1 (THead (Bind b) x x0))).(let H4 \def (eq_ind T t1 (\lambda (t0: +T).(\forall (t2: T).((((eq T t0 t2) \to (\forall (P: Prop).P))) \to ((pr3 c +t0 t2) \to (\forall (x1: T).(\forall (x2: T).((eq T t2 (THead (Bind b) x1 +x2)) \to (land (sn3 c x1) (sn3 (CHead c (Bind b) x1) x2))))))))) H2 (THead +(Bind b) x x0) H3) in (let H5 \def (eq_ind T t1 (\lambda (t0: T).(\forall +(t2: T).((((eq T t0 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t0 t2) \to +(sn3 c t2))))) H1 (THead (Bind b) x x0) H3) in (conj (sn3 c x) (sn3 (CHead c +(Bind b) x) x0) (sn3_sing c x (\lambda (t2: T).(\lambda (H6: (((eq T x t2) +\to (\forall (P: Prop).P)))).(\lambda (H7: (pr3 c x t2)).(let H8 \def (H4 +(THead (Bind b) t2 x0) (\lambda (H8: (eq T (THead (Bind b) x x0) (THead (Bind +b) t2 x0))).(\lambda (P: Prop).(let H9 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x | +(TLRef _) \Rightarrow x | (THead _ t0 _) \Rightarrow t0])) (THead (Bind b) x +x0) (THead (Bind b) t2 x0) H8) in (let H10 \def (eq_ind_r T t2 (\lambda (t0: +T).(pr3 c x t0)) H7 x H9) in (let H11 \def (eq_ind_r T t2 (\lambda (t0: +T).((eq T x t0) \to (\forall (P0: Prop).P0))) H6 x H9) in (H11 (refl_equal T +x) P)))))) (pr3_head_12 c x t2 H7 (Bind b) x0 x0 (pr3_refl (CHead c (Bind b) +t2) x0)) t2 x0 (refl_equal T (THead (Bind b) t2 x0))) in (and_ind (sn3 c t2) +(sn3 (CHead c (Bind b) t2) x0) (sn3 c t2) (\lambda (H9: (sn3 c t2)).(\lambda +(_: (sn3 (CHead c (Bind b) t2) x0)).H9)) H8)))))) (sn3_sing (CHead c (Bind b) +x) x0 (\lambda (t2: T).(\lambda (H6: (((eq T x0 t2) \to (\forall (P: +Prop).P)))).(\lambda (H7: (pr3 (CHead c (Bind b) x) x0 t2)).(let H8 \def (H4 +(THead (Bind b) x t2) (\lambda (H8: (eq T (THead (Bind b) x x0) (THead (Bind +b) x t2))).(\lambda (P: Prop).(let H9 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | +(TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Bind b) x +x0) (THead (Bind b) x t2) H8) in (let H10 \def (eq_ind_r T t2 (\lambda (t0: +T).(pr3 (CHead c (Bind b) x) x0 t0)) H7 x0 H9) in (let H11 \def (eq_ind_r T +t2 (\lambda (t0: T).((eq T x0 t0) \to (\forall (P0: Prop).P0))) H6 x0 H9) in +(H11 (refl_equal T x0) P)))))) (pr3_head_12 c x x (pr3_refl c x) (Bind b) x0 +t2 H7) x t2 (refl_equal T (THead (Bind b) x t2))) in (and_ind (sn3 c x) (sn3 +(CHead c (Bind b) x) t2) (sn3 (CHead c (Bind b) x) t2) (\lambda (_: (sn3 c +x)).(\lambda (H10: (sn3 (CHead c (Bind b) x) t2)).H10)) H8))))))))))))))) y +H0))))) H))))). + +theorem sn3_gen_flat: + \forall (f: F).(\forall (c: C).(\forall (u: T).(\forall (t: T).((sn3 c +(THead (Flat f) u t)) \to (land (sn3 c u) (sn3 c t)))))) +\def + \lambda (f: F).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: +(sn3 c (THead (Flat f) u t))).(insert_eq T (THead (Flat f) u t) (\lambda (t0: +T).(sn3 c t0)) (land (sn3 c u) (sn3 c t)) (\lambda (y: T).(\lambda (H0: (sn3 +c y)).(unintro T t (\lambda (t0: T).((eq T y (THead (Flat f) u t0)) \to (land +(sn3 c u) (sn3 c t0)))) (unintro T u (\lambda (t0: T).(\forall (x: T).((eq T +y (THead (Flat f) t0 x)) \to (land (sn3 c t0) (sn3 c x))))) (sn3_ind c +(\lambda (t0: T).(\forall (x: T).(\forall (x0: T).((eq T t0 (THead (Flat f) x +x0)) \to (land (sn3 c x) (sn3 c x0)))))) (\lambda (t1: T).(\lambda (H1: +((\forall (t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 +t2) \to (sn3 c t2)))))).(\lambda (H2: ((\forall (t2: T).((((eq T t1 t2) \to +(\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to (\forall (x: T).(\forall (x0: +T).((eq T t2 (THead (Flat f) x x0)) \to (land (sn3 c x) (sn3 c +x0)))))))))).(\lambda (x: T).(\lambda (x0: T).(\lambda (H3: (eq T t1 (THead +(Flat f) x x0))).(let H4 \def (eq_ind T t1 (\lambda (t0: T).(\forall (t2: +T).((((eq T t0 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t0 t2) \to +(\forall (x1: T).(\forall (x2: T).((eq T t2 (THead (Flat f) x1 x2)) \to (land +(sn3 c x1) (sn3 c x2))))))))) H2 (THead (Flat f) x x0) H3) in (let H5 \def +(eq_ind T t1 (\lambda (t0: T).(\forall (t2: T).((((eq T t0 t2) \to (\forall +(P: Prop).P))) \to ((pr3 c t0 t2) \to (sn3 c t2))))) H1 (THead (Flat f) x x0) +H3) in (conj (sn3 c x) (sn3 c x0) (sn3_sing c x (\lambda (t2: T).(\lambda +(H6: (((eq T x t2) \to (\forall (P: Prop).P)))).(\lambda (H7: (pr3 c x +t2)).(let H8 \def (H4 (THead (Flat f) t2 x0) (\lambda (H8: (eq T (THead (Flat +f) x x0) (THead (Flat f) t2 x0))).(\lambda (P: Prop).(let H9 \def (f_equal T +T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow x | (TLRef _) \Rightarrow x | (THead _ t0 _) \Rightarrow t0])) +(THead (Flat f) x x0) (THead (Flat f) t2 x0) H8) in (let H10 \def (eq_ind_r T +t2 (\lambda (t0: T).(pr3 c x t0)) H7 x H9) in (let H11 \def (eq_ind_r T t2 +(\lambda (t0: T).((eq T x t0) \to (\forall (P0: Prop).P0))) H6 x H9) in (H11 +(refl_equal T x) P)))))) (pr3_head_12 c x t2 H7 (Flat f) x0 x0 (pr3_refl +(CHead c (Flat f) t2) x0)) t2 x0 (refl_equal T (THead (Flat f) t2 x0))) in +(and_ind (sn3 c t2) (sn3 c x0) (sn3 c t2) (\lambda (H9: (sn3 c t2)).(\lambda +(_: (sn3 c x0)).H9)) H8)))))) (sn3_sing c x0 (\lambda (t2: T).(\lambda (H6: +(((eq T x0 t2) \to (\forall (P: Prop).P)))).(\lambda (H7: (pr3 c x0 t2)).(let +H8 \def (H4 (THead (Flat f) x t2) (\lambda (H8: (eq T (THead (Flat f) x x0) +(THead (Flat f) x t2))).(\lambda (P: Prop).(let H9 \def (f_equal T T (\lambda +(e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 +| (TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Flat f) +x x0) (THead (Flat f) x t2) H8) in (let H10 \def (eq_ind_r T t2 (\lambda (t0: +T).(pr3 c x0 t0)) H7 x0 H9) in (let H11 \def (eq_ind_r T t2 (\lambda (t0: +T).((eq T x0 t0) \to (\forall (P0: Prop).P0))) H6 x0 H9) in (H11 (refl_equal +T x0) P)))))) (pr3_thin_dx c x0 t2 H7 x f) x t2 (refl_equal T (THead (Flat f) +x t2))) in (and_ind (sn3 c x) (sn3 c t2) (sn3 c t2) (\lambda (_: (sn3 c +x)).(\lambda (H10: (sn3 c t2)).H10)) H8))))))))))))))) y H0))))) H))))). + +theorem sn3_gen_head: + \forall (k: K).(\forall (c: C).(\forall (u: T).(\forall (t: T).((sn3 c +(THead k u t)) \to (sn3 c u))))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (c: C).(\forall (u: +T).(\forall (t: T).((sn3 c (THead k0 u t)) \to (sn3 c u)))))) (\lambda (b: +B).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: (sn3 c (THead +(Bind b) u t))).(let H_x \def (sn3_gen_bind b c u t H) in (let H0 \def H_x in +(and_ind (sn3 c u) (sn3 (CHead c (Bind b) u) t) (sn3 c u) (\lambda (H1: (sn3 +c u)).(\lambda (_: (sn3 (CHead c (Bind b) u) t)).H1)) H0)))))))) (\lambda (f: +F).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: (sn3 c (THead +(Flat f) u t))).(let H_x \def (sn3_gen_flat f c u t H) in (let H0 \def H_x in +(and_ind (sn3 c u) (sn3 c t) (sn3 c u) (\lambda (H1: (sn3 c u)).(\lambda (_: +(sn3 c t)).H1)) H0)))))))) k). + +theorem sn3_gen_cflat: + \forall (f: F).(\forall (c: C).(\forall (u: T).(\forall (t: T).((sn3 (CHead +c (Flat f) u) t) \to (sn3 c t))))) +\def + \lambda (f: F).(\lambda (c: C).(\lambda (u: T).(\lambda (t: T).(\lambda (H: +(sn3 (CHead c (Flat f) u) t)).(sn3_ind (CHead c (Flat f) u) (\lambda (t0: +T).(sn3 c t0)) (\lambda (t1: T).(\lambda (_: ((\forall (t2: T).((((eq T t1 +t2) \to (\forall (P: Prop).P))) \to ((pr3 (CHead c (Flat f) u) t1 t2) \to +(sn3 (CHead c (Flat f) u) t2)))))).(\lambda (H1: ((\forall (t2: T).((((eq T +t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 (CHead c (Flat f) u) t1 t2) \to +(sn3 c t2)))))).(sn3_sing c t1 (\lambda (t2: T).(\lambda (H2: (((eq T t1 t2) +\to (\forall (P: Prop).P)))).(\lambda (H3: (pr3 c t1 t2)).(H1 t2 H2 +(pr3_cflat c t1 t2 H3 f u))))))))) t H))))). + +theorem sn3_gen_lift: + \forall (c1: C).(\forall (t: T).(\forall (h: nat).(\forall (d: nat).((sn3 c1 +(lift h d t)) \to (\forall (c2: C).((drop h d c1 c2) \to (sn3 c2 t))))))) +\def + \lambda (c1: C).(\lambda (t: T).(\lambda (h: nat).(\lambda (d: nat).(\lambda +(H: (sn3 c1 (lift h d t))).(insert_eq T (lift h d t) (\lambda (t0: T).(sn3 c1 +t0)) (\forall (c2: C).((drop h d c1 c2) \to (sn3 c2 t))) (\lambda (y: +T).(\lambda (H0: (sn3 c1 y)).(unintro T t (\lambda (t0: T).((eq T y (lift h d +t0)) \to (\forall (c2: C).((drop h d c1 c2) \to (sn3 c2 t0))))) (sn3_ind c1 +(\lambda (t0: T).(\forall (x: T).((eq T t0 (lift h d x)) \to (\forall (c2: +C).((drop h d c1 c2) \to (sn3 c2 x)))))) (\lambda (t1: T).(\lambda (H1: +((\forall (t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c1 t1 +t2) \to (sn3 c1 t2)))))).(\lambda (H2: ((\forall (t2: T).((((eq T t1 t2) \to +(\forall (P: Prop).P))) \to ((pr3 c1 t1 t2) \to (\forall (x: T).((eq T t2 +(lift h d x)) \to (\forall (c2: C).((drop h d c1 c2) \to (sn3 c2 +x)))))))))).(\lambda (x: T).(\lambda (H3: (eq T t1 (lift h d x))).(\lambda +(c2: C).(\lambda (H4: (drop h d c1 c2)).(let H5 \def (eq_ind T t1 (\lambda +(t0: T).(\forall (t2: T).((((eq T t0 t2) \to (\forall (P: Prop).P))) \to +((pr3 c1 t0 t2) \to (\forall (x0: T).((eq T t2 (lift h d x0)) \to (\forall +(c3: C).((drop h d c1 c3) \to (sn3 c3 x0))))))))) H2 (lift h d x) H3) in (let +H6 \def (eq_ind T t1 (\lambda (t0: T).(\forall (t2: T).((((eq T t0 t2) \to +(\forall (P: Prop).P))) \to ((pr3 c1 t0 t2) \to (sn3 c1 t2))))) H1 (lift h d +x) H3) in (sn3_sing c2 x (\lambda (t2: T).(\lambda (H7: (((eq T x t2) \to +(\forall (P: Prop).P)))).(\lambda (H8: (pr3 c2 x t2)).(H5 (lift h d t2) +(\lambda (H9: (eq T (lift h d x) (lift h d t2))).(\lambda (P: Prop).(let H10 +\def (eq_ind_r T t2 (\lambda (t0: T).(pr3 c2 x t0)) H8 x (lift_inj x t2 h d +H9)) in (let H11 \def (eq_ind_r T t2 (\lambda (t0: T).((eq T x t0) \to +(\forall (P0: Prop).P0))) H7 x (lift_inj x t2 h d H9)) in (H11 (refl_equal T +x) P))))) (pr3_lift c1 c2 h d H4 x t2 H8) t2 (refl_equal T (lift h d t2)) c2 +H4)))))))))))))) y H0)))) H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/lift1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/lift1.ma new file mode 100644 index 000000000..d84d094a2 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/lift1.ma @@ -0,0 +1,90 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/sn3/lift1". + +include "sn3/props.ma". + +include "drop1/defs.ma". + +include "lift1/fwd.ma". + +theorem sns3_lifts1: + \forall (e: C).(\forall (hds: PList).(\forall (c: C).((drop1 hds c e) \to +(\forall (ts: TList).((sns3 e ts) \to (sns3 c (lifts1 hds ts))))))) +\def + \lambda (e: C).(\lambda (hds: PList).(PList_ind (\lambda (p: PList).(\forall +(c: C).((drop1 p c e) \to (\forall (ts: TList).((sns3 e ts) \to (sns3 c +(lifts1 p ts))))))) (\lambda (c: C).(\lambda (H: (drop1 PNil c e)).(\lambda +(ts: TList).(\lambda (H0: (sns3 e ts)).(let H1 \def (match H in drop1 return +(\lambda (p: PList).(\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (drop1 p +c0 c1)).((eq PList p PNil) \to ((eq C c0 c) \to ((eq C c1 e) \to (sns3 c +(lifts1 PNil ts))))))))) with [(drop1_nil c0) \Rightarrow (\lambda (_: (eq +PList PNil PNil)).(\lambda (H2: (eq C c0 c)).(\lambda (H3: (eq C c0 +e)).(eq_ind C c (\lambda (c1: C).((eq C c1 e) \to (sns3 c (lifts1 PNil ts)))) +(\lambda (H4: (eq C c e)).(eq_ind C e (\lambda (c1: C).(sns3 c1 (lifts1 PNil +ts))) (eq_ind_r TList ts (\lambda (t: TList).(sns3 e t)) H0 (lifts1 PNil ts) +(lifts1_nil ts)) c (sym_eq C c e H4))) c0 (sym_eq C c0 c H2) H3)))) | +(drop1_cons c1 c2 h d H1 c3 hds0 H2) \Rightarrow (\lambda (H3: (eq PList +(PCons h d hds0) PNil)).(\lambda (H4: (eq C c1 c)).(\lambda (H5: (eq C c3 +e)).((let H6 \def (eq_ind PList (PCons h d hds0) (\lambda (e0: PList).(match +e0 in PList return (\lambda (_: PList).Prop) with [PNil \Rightarrow False | +(PCons _ _ _) \Rightarrow True])) I PNil H3) in (False_ind ((eq C c1 c) \to +((eq C c3 e) \to ((drop h d c1 c2) \to ((drop1 hds0 c2 c3) \to (sns3 c +(lifts1 PNil ts)))))) H6)) H4 H5 H1 H2))))]) in (H1 (refl_equal PList PNil) +(refl_equal C c) (refl_equal C e))))))) (\lambda (n: nat).(\lambda (n0: +nat).(\lambda (p: PList).(\lambda (H: ((\forall (c: C).((drop1 p c e) \to +(\forall (ts: TList).((sns3 e ts) \to (sns3 c (lifts1 p ts)))))))).(\lambda +(c: C).(\lambda (H0: (drop1 (PCons n n0 p) c e)).(\lambda (ts: +TList).(\lambda (H1: (sns3 e ts)).(let H2 \def (match H0 in drop1 return +(\lambda (p0: PList).(\lambda (c0: C).(\lambda (c1: C).(\lambda (_: (drop1 p0 +c0 c1)).((eq PList p0 (PCons n n0 p)) \to ((eq C c0 c) \to ((eq C c1 e) \to +(sns3 c (lifts1 (PCons n n0 p) ts))))))))) with [(drop1_nil c0) \Rightarrow +(\lambda (H2: (eq PList PNil (PCons n n0 p))).(\lambda (H3: (eq C c0 +c)).(\lambda (H4: (eq C c0 e)).((let H5 \def (eq_ind PList PNil (\lambda (e0: +PList).(match e0 in PList return (\lambda (_: PList).Prop) with [PNil +\Rightarrow True | (PCons _ _ _) \Rightarrow False])) I (PCons n n0 p) H2) in +(False_ind ((eq C c0 c) \to ((eq C c0 e) \to (sns3 c (lifts1 (PCons n n0 p) +ts)))) H5)) H3 H4)))) | (drop1_cons c1 c2 h d H2 c3 hds0 H3) \Rightarrow +(\lambda (H4: (eq PList (PCons h d hds0) (PCons n n0 p))).(\lambda (H5: (eq C +c1 c)).(\lambda (H6: (eq C c3 e)).((let H7 \def (f_equal PList PList (\lambda +(e0: PList).(match e0 in PList return (\lambda (_: PList).PList) with [PNil +\Rightarrow hds0 | (PCons _ _ p0) \Rightarrow p0])) (PCons h d hds0) (PCons n +n0 p) H4) in ((let H8 \def (f_equal PList nat (\lambda (e0: PList).(match e0 +in PList return (\lambda (_: PList).nat) with [PNil \Rightarrow d | (PCons _ +n1 _) \Rightarrow n1])) (PCons h d hds0) (PCons n n0 p) H4) in ((let H9 \def +(f_equal PList nat (\lambda (e0: PList).(match e0 in PList return (\lambda +(_: PList).nat) with [PNil \Rightarrow h | (PCons n1 _ _) \Rightarrow n1])) +(PCons h d hds0) (PCons n n0 p) H4) in (eq_ind nat n (\lambda (n1: nat).((eq +nat d n0) \to ((eq PList hds0 p) \to ((eq C c1 c) \to ((eq C c3 e) \to ((drop +n1 d c1 c2) \to ((drop1 hds0 c2 c3) \to (sns3 c (lifts1 (PCons n n0 p) +ts))))))))) (\lambda (H10: (eq nat d n0)).(eq_ind nat n0 (\lambda (n1: +nat).((eq PList hds0 p) \to ((eq C c1 c) \to ((eq C c3 e) \to ((drop n n1 c1 +c2) \to ((drop1 hds0 c2 c3) \to (sns3 c (lifts1 (PCons n n0 p) ts)))))))) +(\lambda (H11: (eq PList hds0 p)).(eq_ind PList p (\lambda (p0: PList).((eq C +c1 c) \to ((eq C c3 e) \to ((drop n n0 c1 c2) \to ((drop1 p0 c2 c3) \to (sns3 +c (lifts1 (PCons n n0 p) ts))))))) (\lambda (H12: (eq C c1 c)).(eq_ind C c +(\lambda (c0: C).((eq C c3 e) \to ((drop n n0 c0 c2) \to ((drop1 p c2 c3) \to +(sns3 c (lifts1 (PCons n n0 p) ts)))))) (\lambda (H13: (eq C c3 e)).(eq_ind C +e (\lambda (c0: C).((drop n n0 c c2) \to ((drop1 p c2 c0) \to (sns3 c (lifts1 +(PCons n n0 p) ts))))) (\lambda (H14: (drop n n0 c c2)).(\lambda (H15: (drop1 +p c2 e)).(eq_ind_r TList (lifts n n0 (lifts1 p ts)) (\lambda (t: TList).(sns3 +c t)) (sns3_lifts c c2 n n0 H14 (lifts1 p ts) (H c2 H15 ts H1)) (lifts1 +(PCons n n0 p) ts) (lifts1_cons n n0 p ts)))) c3 (sym_eq C c3 e H13))) c1 +(sym_eq C c1 c H12))) hds0 (sym_eq PList hds0 p H11))) d (sym_eq nat d n0 +H10))) h (sym_eq nat h n H9))) H8)) H7)) H5 H6 H2 H3))))]) in (H2 (refl_equal +PList (PCons n n0 p)) (refl_equal C c) (refl_equal C e))))))))))) hds)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/nf2.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/nf2.ma new file mode 100644 index 000000000..7b5c1d1bb --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/nf2.ma @@ -0,0 +1,62 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/sn3/nf2". + +include "sn3/defs.ma". + +include "nf2/dec.ma". + +include "nf2/pr3.ma". + +theorem sn3_nf2: + \forall (c: C).(\forall (t: T).((nf2 c t) \to (sn3 c t))) +\def + \lambda (c: C).(\lambda (t: T).(\lambda (H: (nf2 c t)).(sn3_sing c t +(\lambda (t2: T).(\lambda (H0: (((eq T t t2) \to (\forall (P: +Prop).P)))).(\lambda (H1: (pr3 c t t2)).(let H_y \def (nf2_pr3_unfold c t t2 +H1 H) in (let H2 \def (eq_ind_r T t2 (\lambda (t0: T).(pr3 c t t0)) H1 t H_y) +in (let H3 \def (eq_ind_r T t2 (\lambda (t0: T).((eq T t t0) \to (\forall (P: +Prop).P))) H0 t H_y) in (eq_ind T t (\lambda (t0: T).(sn3 c t0)) (H3 +(refl_equal T t) (sn3 c t)) t2 H_y)))))))))). + +theorem nf2_sn3: + \forall (c: C).(\forall (t: T).((sn3 c t) \to (ex2 T (\lambda (u: T).(pr3 c +t u)) (\lambda (u: T).(nf2 c u))))) +\def + \lambda (c: C).(\lambda (t: T).(\lambda (H: (sn3 c t)).(sn3_ind c (\lambda +(t0: T).(ex2 T (\lambda (u: T).(pr3 c t0 u)) (\lambda (u: T).(nf2 c u)))) +(\lambda (t1: T).(\lambda (_: ((\forall (t2: T).((((eq T t1 t2) \to (\forall +(P: Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c t2)))))).(\lambda (H1: ((\forall +(t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to +(ex2 T (\lambda (u: T).(pr3 c t2 u)) (\lambda (u: T).(nf2 c u)))))))).(let +H_x \def (nf2_dec c t1) in (let H2 \def H_x in (or_ind (nf2 c t1) (ex2 T +(\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr2 c t1 t2))) (ex2 T (\lambda (u: T).(pr3 c t1 u)) (\lambda (u: T).(nf2 +c u))) (\lambda (H3: (nf2 c t1)).(ex_intro2 T (\lambda (u: T).(pr3 c t1 u)) +(\lambda (u: T).(nf2 c u)) t1 (pr3_refl c t1) H3)) (\lambda (H3: (ex2 T +(\lambda (t2: T).((eq T t1 t2) \to (\forall (P: Prop).P))) (\lambda (t2: +T).(pr2 c t1 t2)))).(ex2_ind T (\lambda (t2: T).((eq T t1 t2) \to (\forall +(P: Prop).P))) (\lambda (t2: T).(pr2 c t1 t2)) (ex2 T (\lambda (u: T).(pr3 c +t1 u)) (\lambda (u: T).(nf2 c u))) (\lambda (x: T).(\lambda (H4: (((eq T t1 +x) \to (\forall (P: Prop).P)))).(\lambda (H5: (pr2 c t1 x)).(let H_y \def (H1 +x H4) in (let H6 \def (H_y (pr3_pr2 c t1 x H5)) in (ex2_ind T (\lambda (u: +T).(pr3 c x u)) (\lambda (u: T).(nf2 c u)) (ex2 T (\lambda (u: T).(pr3 c t1 +u)) (\lambda (u: T).(nf2 c u))) (\lambda (x0: T).(\lambda (H7: (pr3 c x +x0)).(\lambda (H8: (nf2 c x0)).(ex_intro2 T (\lambda (u: T).(pr3 c t1 u)) +(\lambda (u: T).(nf2 c u)) x0 (pr3_sing c x t1 H5 x0 H7) H8)))) H6)))))) H3)) +H2)))))) t H))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/props.ma new file mode 100644 index 000000000..8cdfff89e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/props.ma @@ -0,0 +1,2499 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/sn3/props". + +include "sn3/nf2.ma". + +include "sn3/fwd.ma". + +include "nf2/iso.ma". + +include "pr3/iso.ma". + +include "iso/props.ma". + +theorem sn3_pr3_trans: + \forall (c: C).(\forall (t1: T).((sn3 c t1) \to (\forall (t2: T).((pr3 c t1 +t2) \to (sn3 c t2))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (H: (sn3 c t1)).(sn3_ind c (\lambda +(t: T).(\forall (t2: T).((pr3 c t t2) \to (sn3 c t2)))) (\lambda (t2: +T).(\lambda (H0: ((\forall (t3: T).((((eq T t2 t3) \to (\forall (P: +Prop).P))) \to ((pr3 c t2 t3) \to (sn3 c t3)))))).(\lambda (H1: ((\forall +(t3: T).((((eq T t2 t3) \to (\forall (P: Prop).P))) \to ((pr3 c t2 t3) \to +(\forall (t4: T).((pr3 c t3 t4) \to (sn3 c t4)))))))).(\lambda (t3: +T).(\lambda (H2: (pr3 c t2 t3)).(sn3_sing c t3 (\lambda (t0: T).(\lambda (H3: +(((eq T t3 t0) \to (\forall (P: Prop).P)))).(\lambda (H4: (pr3 c t3 t0)).(let +H_x \def (term_dec t2 t3) in (let H5 \def H_x in (or_ind (eq T t2 t3) ((eq T +t2 t3) \to (\forall (P: Prop).P)) (sn3 c t0) (\lambda (H6: (eq T t2 t3)).(let +H7 \def (eq_ind_r T t3 (\lambda (t: T).(pr3 c t t0)) H4 t2 H6) in (let H8 +\def (eq_ind_r T t3 (\lambda (t: T).((eq T t t0) \to (\forall (P: Prop).P))) +H3 t2 H6) in (let H9 \def (eq_ind_r T t3 (\lambda (t: T).(pr3 c t2 t)) H2 t2 +H6) in (H0 t0 H8 H7))))) (\lambda (H6: (((eq T t2 t3) \to (\forall (P: +Prop).P)))).(H1 t3 H6 H2 t0 H4)) H5)))))))))))) t1 H))). + +theorem sn3_pr2_intro: + \forall (c: C).(\forall (t1: T).(((\forall (t2: T).((((eq T t1 t2) \to +(\forall (P: Prop).P))) \to ((pr2 c t1 t2) \to (sn3 c t2))))) \to (sn3 c t1))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (H: ((\forall (t2: T).((((eq T t1 +t2) \to (\forall (P: Prop).P))) \to ((pr2 c t1 t2) \to (sn3 c +t2)))))).(sn3_sing c t1 (\lambda (t2: T).(\lambda (H0: (((eq T t1 t2) \to +(\forall (P: Prop).P)))).(\lambda (H1: (pr3 c t1 t2)).(let H2 \def H0 in +((let H3 \def H in (pr3_ind c (\lambda (t: T).(\lambda (t0: T).(((\forall +(t3: T).((((eq T t t3) \to (\forall (P: Prop).P))) \to ((pr2 c t t3) \to (sn3 +c t3))))) \to ((((eq T t t0) \to (\forall (P: Prop).P))) \to (sn3 c t0))))) +(\lambda (t: T).(\lambda (H4: ((\forall (t3: T).((((eq T t t3) \to (\forall +(P: Prop).P))) \to ((pr2 c t t3) \to (sn3 c t3)))))).(\lambda (H5: (((eq T t +t) \to (\forall (P: Prop).P)))).(H4 t H5 (pr2_free c t t (pr0_refl t)))))) +(\lambda (t3: T).(\lambda (t4: T).(\lambda (H4: (pr2 c t4 t3)).(\lambda (t5: +T).(\lambda (H5: (pr3 c t3 t5)).(\lambda (H6: ((((\forall (t6: T).((((eq T t3 +t6) \to (\forall (P: Prop).P))) \to ((pr2 c t3 t6) \to (sn3 c t6))))) \to +((((eq T t3 t5) \to (\forall (P: Prop).P))) \to (sn3 c t5))))).(\lambda (H7: +((\forall (t6: T).((((eq T t4 t6) \to (\forall (P: Prop).P))) \to ((pr2 c t4 +t6) \to (sn3 c t6)))))).(\lambda (H8: (((eq T t4 t5) \to (\forall (P: +Prop).P)))).(let H_x \def (term_dec t4 t3) in (let H9 \def H_x in (or_ind (eq +T t4 t3) ((eq T t4 t3) \to (\forall (P: Prop).P)) (sn3 c t5) (\lambda (H10: +(eq T t4 t3)).(let H11 \def (eq_ind T t4 (\lambda (t: T).((eq T t t5) \to +(\forall (P: Prop).P))) H8 t3 H10) in (let H12 \def (eq_ind T t4 (\lambda (t: +T).(\forall (t6: T).((((eq T t t6) \to (\forall (P: Prop).P))) \to ((pr2 c t +t6) \to (sn3 c t6))))) H7 t3 H10) in (let H13 \def (eq_ind T t4 (\lambda (t: +T).(pr2 c t t3)) H4 t3 H10) in (H6 H12 H11))))) (\lambda (H10: (((eq T t4 t3) +\to (\forall (P: Prop).P)))).(sn3_pr3_trans c t3 (H7 t3 H10 H4) t5 H5)) +H9))))))))))) t1 t2 H1 H3)) H2)))))))). + +theorem sn3_cast: + \forall (c: C).(\forall (u: T).((sn3 c u) \to (\forall (t: T).((sn3 c t) \to +(sn3 c (THead (Flat Cast) u t)))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (H: (sn3 c u)).(sn3_ind c (\lambda +(t: T).(\forall (t0: T).((sn3 c t0) \to (sn3 c (THead (Flat Cast) t t0))))) +(\lambda (t1: T).(\lambda (_: ((\forall (t2: T).((((eq T t1 t2) \to (\forall +(P: Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c t2)))))).(\lambda (H1: ((\forall +(t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to +(\forall (t: T).((sn3 c t) \to (sn3 c (THead (Flat Cast) t2 +t))))))))).(\lambda (t: T).(\lambda (H2: (sn3 c t)).(sn3_ind c (\lambda (t0: +T).(sn3 c (THead (Flat Cast) t1 t0))) (\lambda (t0: T).(\lambda (H3: +((\forall (t2: T).((((eq T t0 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t0 +t2) \to (sn3 c t2)))))).(\lambda (H4: ((\forall (t2: T).((((eq T t0 t2) \to +(\forall (P: Prop).P))) \to ((pr3 c t0 t2) \to (sn3 c (THead (Flat Cast) t1 +t2))))))).(sn3_pr2_intro c (THead (Flat Cast) t1 t0) (\lambda (t2: +T).(\lambda (H5: (((eq T (THead (Flat Cast) t1 t0) t2) \to (\forall (P: +Prop).P)))).(\lambda (H6: (pr2 c (THead (Flat Cast) t1 t0) t2)).(let H7 \def +(pr2_gen_cast c t1 t0 t2 H6) in (or_ind (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T t2 (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c t1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t0 t3)))) (pr2 c +t0 t2) (sn3 c t2) (\lambda (H8: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T t2 (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c t1 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c t0 +t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c t1 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c t0 t3))) (sn3 c t2) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H9: (eq T t2 (THead (Flat Cast) x0 +x1))).(\lambda (H10: (pr2 c t1 x0)).(\lambda (H11: (pr2 c t0 x1)).(let H12 +\def (eq_ind T t2 (\lambda (t3: T).((eq T (THead (Flat Cast) t1 t0) t3) \to +(\forall (P: Prop).P))) H5 (THead (Flat Cast) x0 x1) H9) in (eq_ind_r T +(THead (Flat Cast) x0 x1) (\lambda (t3: T).(sn3 c t3)) (let H_x \def +(term_dec x0 t1) in (let H13 \def H_x in (or_ind (eq T x0 t1) ((eq T x0 t1) +\to (\forall (P: Prop).P)) (sn3 c (THead (Flat Cast) x0 x1)) (\lambda (H14: +(eq T x0 t1)).(let H15 \def (eq_ind T x0 (\lambda (t3: T).((eq T (THead (Flat +Cast) t1 t0) (THead (Flat Cast) t3 x1)) \to (\forall (P: Prop).P))) H12 t1 +H14) in (let H16 \def (eq_ind T x0 (\lambda (t3: T).(pr2 c t1 t3)) H10 t1 +H14) in (eq_ind_r T t1 (\lambda (t3: T).(sn3 c (THead (Flat Cast) t3 x1))) +(let H_x0 \def (term_dec t0 x1) in (let H17 \def H_x0 in (or_ind (eq T t0 x1) +((eq T t0 x1) \to (\forall (P: Prop).P)) (sn3 c (THead (Flat Cast) t1 x1)) +(\lambda (H18: (eq T t0 x1)).(let H19 \def (eq_ind_r T x1 (\lambda (t3: +T).((eq T (THead (Flat Cast) t1 t0) (THead (Flat Cast) t1 t3)) \to (\forall +(P: Prop).P))) H15 t0 H18) in (let H20 \def (eq_ind_r T x1 (\lambda (t3: +T).(pr2 c t0 t3)) H11 t0 H18) in (eq_ind T t0 (\lambda (t3: T).(sn3 c (THead +(Flat Cast) t1 t3))) (H19 (refl_equal T (THead (Flat Cast) t1 t0)) (sn3 c +(THead (Flat Cast) t1 t0))) x1 H18)))) (\lambda (H18: (((eq T t0 x1) \to +(\forall (P: Prop).P)))).(H4 x1 H18 (pr3_pr2 c t0 x1 H11))) H17))) x0 H14)))) +(\lambda (H14: (((eq T x0 t1) \to (\forall (P: Prop).P)))).(H1 x0 (\lambda +(H15: (eq T t1 x0)).(\lambda (P: Prop).(let H16 \def (eq_ind_r T x0 (\lambda +(t3: T).((eq T t3 t1) \to (\forall (P0: Prop).P0))) H14 t1 H15) in (let H17 +\def (eq_ind_r T x0 (\lambda (t3: T).((eq T (THead (Flat Cast) t1 t0) (THead +(Flat Cast) t3 x1)) \to (\forall (P0: Prop).P0))) H12 t1 H15) in (let H18 +\def (eq_ind_r T x0 (\lambda (t3: T).(pr2 c t1 t3)) H10 t1 H15) in (H16 +(refl_equal T t1) P)))))) (pr3_pr2 c t1 x0 H10) x1 (let H_x0 \def (term_dec +t0 x1) in (let H15 \def H_x0 in (or_ind (eq T t0 x1) ((eq T t0 x1) \to +(\forall (P: Prop).P)) (sn3 c x1) (\lambda (H16: (eq T t0 x1)).(let H17 \def +(eq_ind_r T x1 (\lambda (t3: T).((eq T (THead (Flat Cast) t1 t0) (THead (Flat +Cast) x0 t3)) \to (\forall (P: Prop).P))) H12 t0 H16) in (let H18 \def +(eq_ind_r T x1 (\lambda (t3: T).(pr2 c t0 t3)) H11 t0 H16) in (eq_ind T t0 +(\lambda (t3: T).(sn3 c t3)) (sn3_sing c t0 H3) x1 H16)))) (\lambda (H16: +(((eq T t0 x1) \to (\forall (P: Prop).P)))).(H3 x1 H16 (pr3_pr2 c t0 x1 +H11))) H15))))) H13))) t2 H9))))))) H8)) (\lambda (H8: (pr2 c t0 +t2)).(sn3_pr3_trans c t0 (sn3_sing c t0 H3) t2 (pr3_pr2 c t0 t2 H8))) +H7))))))))) t H2)))))) u H))). + +theorem sn3_cflat: + \forall (c: C).(\forall (t: T).((sn3 c t) \to (\forall (f: F).(\forall (u: +T).(sn3 (CHead c (Flat f) u) t))))) +\def + \lambda (c: C).(\lambda (t: T).(\lambda (H: (sn3 c t)).(\lambda (f: +F).(\lambda (u: T).(sn3_ind c (\lambda (t0: T).(sn3 (CHead c (Flat f) u) t0)) +(\lambda (t1: T).(\lambda (_: ((\forall (t2: T).((((eq T t1 t2) \to (\forall +(P: Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c t2)))))).(\lambda (H1: ((\forall +(t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to +(sn3 (CHead c (Flat f) u) t2)))))).(sn3_pr2_intro (CHead c (Flat f) u) t1 +(\lambda (t2: T).(\lambda (H2: (((eq T t1 t2) \to (\forall (P: +Prop).P)))).(\lambda (H3: (pr2 (CHead c (Flat f) u) t1 t2)).(H1 t2 H2 +(pr3_pr2 c t1 t2 (pr2_gen_cflat f c u t1 t2 H3)))))))))) t H))))). + +theorem sn3_shift: + \forall (b: B).(\forall (c: C).(\forall (v: T).(\forall (t: T).((sn3 c +(THead (Bind b) v t)) \to (sn3 (CHead c (Bind b) v) t))))) +\def + \lambda (b: B).(\lambda (c: C).(\lambda (v: T).(\lambda (t: T).(\lambda (H: +(sn3 c (THead (Bind b) v t))).(let H_x \def (sn3_gen_bind b c v t H) in (let +H0 \def H_x in (and_ind (sn3 c v) (sn3 (CHead c (Bind b) v) t) (sn3 (CHead c +(Bind b) v) t) (\lambda (_: (sn3 c v)).(\lambda (H2: (sn3 (CHead c (Bind b) +v) t)).H2)) H0))))))). + +theorem sn3_change: + \forall (b: B).((not (eq B b Abbr)) \to (\forall (c: C).(\forall (v1: +T).(\forall (t: T).((sn3 (CHead c (Bind b) v1) t) \to (\forall (v2: T).(sn3 +(CHead c (Bind b) v2) t))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abbr))).(\lambda (c: C).(\lambda +(v1: T).(\lambda (t: T).(\lambda (H0: (sn3 (CHead c (Bind b) v1) t)).(\lambda +(v2: T).(sn3_ind (CHead c (Bind b) v1) (\lambda (t0: T).(sn3 (CHead c (Bind +b) v2) t0)) (\lambda (t1: T).(\lambda (_: ((\forall (t2: T).((((eq T t1 t2) +\to (\forall (P: Prop).P))) \to ((pr3 (CHead c (Bind b) v1) t1 t2) \to (sn3 +(CHead c (Bind b) v1) t2)))))).(\lambda (H2: ((\forall (t2: T).((((eq T t1 +t2) \to (\forall (P: Prop).P))) \to ((pr3 (CHead c (Bind b) v1) t1 t2) \to +(sn3 (CHead c (Bind b) v2) t2)))))).(sn3_pr2_intro (CHead c (Bind b) v2) t1 +(\lambda (t2: T).(\lambda (H3: (((eq T t1 t2) \to (\forall (P: +Prop).P)))).(\lambda (H4: (pr2 (CHead c (Bind b) v2) t1 t2)).(H2 t2 H3 +(pr3_pr2 (CHead c (Bind b) v1) t1 t2 (pr2_change b H c v2 t1 t2 H4 +v1)))))))))) t H0))))))). + +theorem sn3_cpr3_trans: + \forall (c: C).(\forall (u1: T).(\forall (u2: T).((pr3 c u1 u2) \to (\forall +(k: K).(\forall (t: T).((sn3 (CHead c k u1) t) \to (sn3 (CHead c k u2) +t))))))) +\def + \lambda (c: C).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H: (pr3 c u1 +u2)).(\lambda (k: K).(\lambda (t: T).(\lambda (H0: (sn3 (CHead c k u1) +t)).(sn3_ind (CHead c k u1) (\lambda (t0: T).(sn3 (CHead c k u2) t0)) +(\lambda (t1: T).(\lambda (_: ((\forall (t2: T).((((eq T t1 t2) \to (\forall +(P: Prop).P))) \to ((pr3 (CHead c k u1) t1 t2) \to (sn3 (CHead c k u1) +t2)))))).(\lambda (H2: ((\forall (t2: T).((((eq T t1 t2) \to (\forall (P: +Prop).P))) \to ((pr3 (CHead c k u1) t1 t2) \to (sn3 (CHead c k u2) +t2)))))).(sn3_sing (CHead c k u2) t1 (\lambda (t2: T).(\lambda (H3: (((eq T +t1 t2) \to (\forall (P: Prop).P)))).(\lambda (H4: (pr3 (CHead c k u2) t1 +t2)).(H2 t2 H3 (pr3_pr3_pr3_t c u1 u2 H t1 t2 k H4))))))))) t H0))))))). + +theorem sn3_bind: + \forall (b: B).(\forall (c: C).(\forall (u: T).((sn3 c u) \to (\forall (t: +T).((sn3 (CHead c (Bind b) u) t) \to (sn3 c (THead (Bind b) u t))))))) +\def + \lambda (b: B).(\lambda (c: C).(\lambda (u: T).(\lambda (H: (sn3 c +u)).(sn3_ind c (\lambda (t: T).(\forall (t0: T).((sn3 (CHead c (Bind b) t) +t0) \to (sn3 c (THead (Bind b) t t0))))) (\lambda (t1: T).(\lambda (_: +((\forall (t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 +t2) \to (sn3 c t2)))))).(\lambda (H1: ((\forall (t2: T).((((eq T t1 t2) \to +(\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to (\forall (t: T).((sn3 (CHead c +(Bind b) t2) t) \to (sn3 c (THead (Bind b) t2 t))))))))).(\lambda (t: +T).(\lambda (H2: (sn3 (CHead c (Bind b) t1) t)).(sn3_ind (CHead c (Bind b) +t1) (\lambda (t0: T).(sn3 c (THead (Bind b) t1 t0))) (\lambda (t2: +T).(\lambda (H3: ((\forall (t3: T).((((eq T t2 t3) \to (\forall (P: +Prop).P))) \to ((pr3 (CHead c (Bind b) t1) t2 t3) \to (sn3 (CHead c (Bind b) +t1) t3)))))).(\lambda (H4: ((\forall (t3: T).((((eq T t2 t3) \to (\forall (P: +Prop).P))) \to ((pr3 (CHead c (Bind b) t1) t2 t3) \to (sn3 c (THead (Bind b) +t1 t3))))))).(sn3_sing c (THead (Bind b) t1 t2) (\lambda (t3: T).(\lambda +(H5: (((eq T (THead (Bind b) t1 t2) t3) \to (\forall (P: Prop).P)))).(\lambda +(H6: (pr3 c (THead (Bind b) t1 t2) t3)).(let H_x \def (bind_dec_not b Abst) +in (let H7 \def H_x in (or_ind (eq B b Abst) (not (eq B b Abst)) (sn3 c t3) +(\lambda (H8: (eq B b Abst)).(let H9 \def (eq_ind B b (\lambda (b0: B).(pr3 c +(THead (Bind b0) t1 t2) t3)) H6 Abst H8) in (let H10 \def (eq_ind B b +(\lambda (b0: B).((eq T (THead (Bind b0) t1 t2) t3) \to (\forall (P: +Prop).P))) H5 Abst H8) in (let H11 \def (eq_ind B b (\lambda (b0: B).(\forall +(t4: T).((((eq T t2 t4) \to (\forall (P: Prop).P))) \to ((pr3 (CHead c (Bind +b0) t1) t2 t4) \to (sn3 c (THead (Bind b0) t1 t4)))))) H4 Abst H8) in (let +H12 \def (eq_ind B b (\lambda (b0: B).(\forall (t4: T).((((eq T t2 t4) \to +(\forall (P: Prop).P))) \to ((pr3 (CHead c (Bind b0) t1) t2 t4) \to (sn3 +(CHead c (Bind b0) t1) t4))))) H3 Abst H8) in (let H13 \def (eq_ind B b +(\lambda (b0: B).(\forall (t4: T).((((eq T t1 t4) \to (\forall (P: Prop).P))) +\to ((pr3 c t1 t4) \to (\forall (t0: T).((sn3 (CHead c (Bind b0) t4) t0) \to +(sn3 c (THead (Bind b0) t4 t0)))))))) H1 Abst H8) in (let H14 \def +(pr3_gen_abst c t1 t2 t3 H9) in (ex3_2_ind T T (\lambda (u2: T).(\lambda (t4: +T).(eq T t3 (THead (Bind Abst) u2 t4)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c t1 u2))) (\lambda (_: T).(\lambda (t4: T).(\forall (b0: B).(\forall +(u0: T).(pr3 (CHead c (Bind b0) u0) t2 t4))))) (sn3 c t3) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H15: (eq T t3 (THead (Bind Abst) x0 +x1))).(\lambda (H16: (pr3 c t1 x0)).(\lambda (H17: ((\forall (b0: B).(\forall +(u0: T).(pr3 (CHead c (Bind b0) u0) t2 x1))))).(let H18 \def (eq_ind T t3 +(\lambda (t0: T).((eq T (THead (Bind Abst) t1 t2) t0) \to (\forall (P: +Prop).P))) H10 (THead (Bind Abst) x0 x1) H15) in (eq_ind_r T (THead (Bind +Abst) x0 x1) (\lambda (t0: T).(sn3 c t0)) (let H_x0 \def (term_dec t1 x0) in +(let H19 \def H_x0 in (or_ind (eq T t1 x0) ((eq T t1 x0) \to (\forall (P: +Prop).P)) (sn3 c (THead (Bind Abst) x0 x1)) (\lambda (H20: (eq T t1 x0)).(let +H21 \def (eq_ind_r T x0 (\lambda (t0: T).((eq T (THead (Bind Abst) t1 t2) +(THead (Bind Abst) t0 x1)) \to (\forall (P: Prop).P))) H18 t1 H20) in (let +H22 \def (eq_ind_r T x0 (\lambda (t0: T).(pr3 c t1 t0)) H16 t1 H20) in +(eq_ind T t1 (\lambda (t0: T).(sn3 c (THead (Bind Abst) t0 x1))) (let H_x1 +\def (term_dec t2 x1) in (let H23 \def H_x1 in (or_ind (eq T t2 x1) ((eq T t2 +x1) \to (\forall (P: Prop).P)) (sn3 c (THead (Bind Abst) t1 x1)) (\lambda +(H24: (eq T t2 x1)).(let H25 \def (eq_ind_r T x1 (\lambda (t0: T).((eq T +(THead (Bind Abst) t1 t2) (THead (Bind Abst) t1 t0)) \to (\forall (P: +Prop).P))) H21 t2 H24) in (let H26 \def (eq_ind_r T x1 (\lambda (t0: +T).(\forall (b0: B).(\forall (u0: T).(pr3 (CHead c (Bind b0) u0) t2 t0)))) +H17 t2 H24) in (eq_ind T t2 (\lambda (t0: T).(sn3 c (THead (Bind Abst) t1 +t0))) (H25 (refl_equal T (THead (Bind Abst) t1 t2)) (sn3 c (THead (Bind Abst) +t1 t2))) x1 H24)))) (\lambda (H24: (((eq T t2 x1) \to (\forall (P: +Prop).P)))).(H11 x1 H24 (H17 Abst t1))) H23))) x0 H20)))) (\lambda (H20: +(((eq T t1 x0) \to (\forall (P: Prop).P)))).(let H_x1 \def (term_dec t2 x1) +in (let H21 \def H_x1 in (or_ind (eq T t2 x1) ((eq T t2 x1) \to (\forall (P: +Prop).P)) (sn3 c (THead (Bind Abst) x0 x1)) (\lambda (H22: (eq T t2 x1)).(let +H23 \def (eq_ind_r T x1 (\lambda (t0: T).(\forall (b0: B).(\forall (u0: +T).(pr3 (CHead c (Bind b0) u0) t2 t0)))) H17 t2 H22) in (eq_ind T t2 (\lambda +(t0: T).(sn3 c (THead (Bind Abst) x0 t0))) (H13 x0 H20 H16 t2 (sn3_cpr3_trans +c t1 x0 H16 (Bind Abst) t2 (sn3_sing (CHead c (Bind Abst) t1) t2 H12))) x1 +H22))) (\lambda (H22: (((eq T t2 x1) \to (\forall (P: Prop).P)))).(H13 x0 H20 +H16 x1 (sn3_cpr3_trans c t1 x0 H16 (Bind Abst) x1 (H12 x1 H22 (H17 Abst +t1))))) H21)))) H19))) t3 H15))))))) H14)))))))) (\lambda (H8: (not (eq B b +Abst))).(let H_x0 \def (pr3_gen_bind b H8 c t1 t2 t3 H6) in (let H9 \def H_x0 +in (or_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind +b) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c t1 u2))) (\lambda (_: +T).(\lambda (t4: T).(pr3 (CHead c (Bind b) t1) t2 t4)))) (pr3 (CHead c (Bind +b) t1) t2 (lift (S O) O t3)) (sn3 c t3) (\lambda (H10: (ex3_2 T T (\lambda +(u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind b) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr3 c t1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr3 +(CHead c (Bind b) t1) t2 t4))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda +(t4: T).(eq T t3 (THead (Bind b) u2 t4)))) (\lambda (u2: T).(\lambda (_: +T).(pr3 c t1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr3 (CHead c (Bind b) +t1) t2 t4))) (sn3 c t3) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H11: (eq +T t3 (THead (Bind b) x0 x1))).(\lambda (H12: (pr3 c t1 x0)).(\lambda (H13: +(pr3 (CHead c (Bind b) t1) t2 x1)).(let H14 \def (eq_ind T t3 (\lambda (t0: +T).((eq T (THead (Bind b) t1 t2) t0) \to (\forall (P: Prop).P))) H5 (THead +(Bind b) x0 x1) H11) in (eq_ind_r T (THead (Bind b) x0 x1) (\lambda (t0: +T).(sn3 c t0)) (let H_x1 \def (term_dec t1 x0) in (let H15 \def H_x1 in +(or_ind (eq T t1 x0) ((eq T t1 x0) \to (\forall (P: Prop).P)) (sn3 c (THead +(Bind b) x0 x1)) (\lambda (H16: (eq T t1 x0)).(let H17 \def (eq_ind_r T x0 +(\lambda (t0: T).((eq T (THead (Bind b) t1 t2) (THead (Bind b) t0 x1)) \to +(\forall (P: Prop).P))) H14 t1 H16) in (let H18 \def (eq_ind_r T x0 (\lambda +(t0: T).(pr3 c t1 t0)) H12 t1 H16) in (eq_ind T t1 (\lambda (t0: T).(sn3 c +(THead (Bind b) t0 x1))) (let H_x2 \def (term_dec t2 x1) in (let H19 \def +H_x2 in (or_ind (eq T t2 x1) ((eq T t2 x1) \to (\forall (P: Prop).P)) (sn3 c +(THead (Bind b) t1 x1)) (\lambda (H20: (eq T t2 x1)).(let H21 \def (eq_ind_r +T x1 (\lambda (t0: T).((eq T (THead (Bind b) t1 t2) (THead (Bind b) t1 t0)) +\to (\forall (P: Prop).P))) H17 t2 H20) in (let H22 \def (eq_ind_r T x1 +(\lambda (t0: T).(pr3 (CHead c (Bind b) t1) t2 t0)) H13 t2 H20) in (eq_ind T +t2 (\lambda (t0: T).(sn3 c (THead (Bind b) t1 t0))) (H21 (refl_equal T (THead +(Bind b) t1 t2)) (sn3 c (THead (Bind b) t1 t2))) x1 H20)))) (\lambda (H20: +(((eq T t2 x1) \to (\forall (P: Prop).P)))).(H4 x1 H20 H13)) H19))) x0 +H16)))) (\lambda (H16: (((eq T t1 x0) \to (\forall (P: Prop).P)))).(let H_x2 +\def (term_dec t2 x1) in (let H17 \def H_x2 in (or_ind (eq T t2 x1) ((eq T t2 +x1) \to (\forall (P: Prop).P)) (sn3 c (THead (Bind b) x0 x1)) (\lambda (H18: +(eq T t2 x1)).(let H19 \def (eq_ind_r T x1 (\lambda (t0: T).(pr3 (CHead c +(Bind b) t1) t2 t0)) H13 t2 H18) in (eq_ind T t2 (\lambda (t0: T).(sn3 c +(THead (Bind b) x0 t0))) (H1 x0 H16 H12 t2 (sn3_cpr3_trans c t1 x0 H12 (Bind +b) t2 (sn3_sing (CHead c (Bind b) t1) t2 H3))) x1 H18))) (\lambda (H18: (((eq +T t2 x1) \to (\forall (P: Prop).P)))).(H1 x0 H16 H12 x1 (sn3_cpr3_trans c t1 +x0 H12 (Bind b) x1 (H3 x1 H18 H13)))) H17)))) H15))) t3 H11))))))) H10)) +(\lambda (H10: (pr3 (CHead c (Bind b) t1) t2 (lift (S O) O +t3))).(sn3_gen_lift (CHead c (Bind b) t1) t3 (S O) O (sn3_pr3_trans (CHead c +(Bind b) t1) t2 (sn3_pr2_intro (CHead c (Bind b) t1) t2 (\lambda (t0: +T).(\lambda (H11: (((eq T t2 t0) \to (\forall (P: Prop).P)))).(\lambda (H12: +(pr2 (CHead c (Bind b) t1) t2 t0)).(H3 t0 H11 (pr3_pr2 (CHead c (Bind b) t1) +t2 t0 H12)))))) (lift (S O) O t3) H10) c (drop_drop (Bind b) O c c (drop_refl +c) t1))) H9)))) H7)))))))))) t H2)))))) u H)))). + +theorem sn3_beta: + \forall (c: C).(\forall (v: T).(\forall (t: T).((sn3 c (THead (Bind Abbr) v +t)) \to (\forall (w: T).((sn3 c w) \to (sn3 c (THead (Flat Appl) v (THead +(Bind Abst) w t)))))))) +\def + \lambda (c: C).(\lambda (v: T).(\lambda (t: T).(\lambda (H: (sn3 c (THead +(Bind Abbr) v t))).(insert_eq T (THead (Bind Abbr) v t) (\lambda (t0: T).(sn3 +c t0)) (\forall (w: T).((sn3 c w) \to (sn3 c (THead (Flat Appl) v (THead +(Bind Abst) w t))))) (\lambda (y: T).(\lambda (H0: (sn3 c y)).(unintro T t +(\lambda (t0: T).((eq T y (THead (Bind Abbr) v t0)) \to (\forall (w: T).((sn3 +c w) \to (sn3 c (THead (Flat Appl) v (THead (Bind Abst) w t0))))))) (unintro +T v (\lambda (t0: T).(\forall (x: T).((eq T y (THead (Bind Abbr) t0 x)) \to +(\forall (w: T).((sn3 c w) \to (sn3 c (THead (Flat Appl) t0 (THead (Bind +Abst) w x)))))))) (sn3_ind c (\lambda (t0: T).(\forall (x: T).(\forall (x0: +T).((eq T t0 (THead (Bind Abbr) x x0)) \to (\forall (w: T).((sn3 c w) \to +(sn3 c (THead (Flat Appl) x (THead (Bind Abst) w x0))))))))) (\lambda (t1: +T).(\lambda (H1: ((\forall (t2: T).((((eq T t1 t2) \to (\forall (P: +Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c t2)))))).(\lambda (H2: ((\forall +(t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to +(\forall (x: T).(\forall (x0: T).((eq T t2 (THead (Bind Abbr) x x0)) \to +(\forall (w: T).((sn3 c w) \to (sn3 c (THead (Flat Appl) x (THead (Bind Abst) +w x0))))))))))))).(\lambda (x: T).(\lambda (x0: T).(\lambda (H3: (eq T t1 +(THead (Bind Abbr) x x0))).(\lambda (w: T).(\lambda (H4: (sn3 c w)).(let H5 +\def (eq_ind T t1 (\lambda (t0: T).(\forall (t2: T).((((eq T t0 t2) \to +(\forall (P: Prop).P))) \to ((pr3 c t0 t2) \to (\forall (x1: T).(\forall (x2: +T).((eq T t2 (THead (Bind Abbr) x1 x2)) \to (\forall (w0: T).((sn3 c w0) \to +(sn3 c (THead (Flat Appl) x1 (THead (Bind Abst) w0 x2)))))))))))) H2 (THead +(Bind Abbr) x x0) H3) in (let H6 \def (eq_ind T t1 (\lambda (t0: T).(\forall +(t2: T).((((eq T t0 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t0 t2) \to +(sn3 c t2))))) H1 (THead (Bind Abbr) x x0) H3) in (sn3_ind c (\lambda (t0: +T).(sn3 c (THead (Flat Appl) x (THead (Bind Abst) t0 x0)))) (\lambda (t2: +T).(\lambda (H7: ((\forall (t3: T).((((eq T t2 t3) \to (\forall (P: +Prop).P))) \to ((pr3 c t2 t3) \to (sn3 c t3)))))).(\lambda (H8: ((\forall +(t3: T).((((eq T t2 t3) \to (\forall (P: Prop).P))) \to ((pr3 c t2 t3) \to +(sn3 c (THead (Flat Appl) x (THead (Bind Abst) t3 x0)))))))).(sn3_pr2_intro c +(THead (Flat Appl) x (THead (Bind Abst) t2 x0)) (\lambda (t3: T).(\lambda +(H9: (((eq T (THead (Flat Appl) x (THead (Bind Abst) t2 x0)) t3) \to (\forall +(P: Prop).P)))).(\lambda (H10: (pr2 c (THead (Flat Appl) x (THead (Bind Abst) +t2 x0)) t3)).(let H11 \def (pr2_gen_appl c x (THead (Bind Abst) t2 x0) t3 +H10) in (or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead +(Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind Abst) t2 x0) t4)))) +(ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(eq T (THead (Bind Abst) t2 x0) (THead (Bind Abst) y1 z1)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead +(Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (t4: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind +b) u) z1 t4)))))))) (ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) t2 x0) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t3 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) (sn3 c t3) +(\lambda (H12: (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead +(Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind Abst) t2 x0) +t4))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead +(Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind Abst) t2 x0) t4))) (sn3 +c t3) (\lambda (x1: T).(\lambda (x2: T).(\lambda (H13: (eq T t3 (THead (Flat +Appl) x1 x2))).(\lambda (H14: (pr2 c x x1)).(\lambda (H15: (pr2 c (THead +(Bind Abst) t2 x0) x2)).(let H16 \def (eq_ind T t3 (\lambda (t0: T).((eq T +(THead (Flat Appl) x (THead (Bind Abst) t2 x0)) t0) \to (\forall (P: +Prop).P))) H9 (THead (Flat Appl) x1 x2) H13) in (eq_ind_r T (THead (Flat +Appl) x1 x2) (\lambda (t0: T).(sn3 c t0)) (let H17 \def (pr2_gen_abst c t2 x0 +x2 H15) in (ex3_2_ind T T (\lambda (u2: T).(\lambda (t4: T).(eq T x2 (THead +(Bind Abst) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c t2 u2))) +(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead +c (Bind b) u) x0 t4))))) (sn3 c (THead (Flat Appl) x1 x2)) (\lambda (x3: +T).(\lambda (x4: T).(\lambda (H18: (eq T x2 (THead (Bind Abst) x3 +x4))).(\lambda (H19: (pr2 c t2 x3)).(\lambda (H20: ((\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) x0 x4))))).(let H21 \def (eq_ind T x2 +(\lambda (t0: T).((eq T (THead (Flat Appl) x (THead (Bind Abst) t2 x0)) +(THead (Flat Appl) x1 t0)) \to (\forall (P: Prop).P))) H16 (THead (Bind Abst) +x3 x4) H18) in (eq_ind_r T (THead (Bind Abst) x3 x4) (\lambda (t0: T).(sn3 c +(THead (Flat Appl) x1 t0))) (let H_x \def (term_dec t2 x3) in (let H22 \def +H_x in (or_ind (eq T t2 x3) ((eq T t2 x3) \to (\forall (P: Prop).P)) (sn3 c +(THead (Flat Appl) x1 (THead (Bind Abst) x3 x4))) (\lambda (H23: (eq T t2 +x3)).(let H24 \def (eq_ind_r T x3 (\lambda (t0: T).((eq T (THead (Flat Appl) +x (THead (Bind Abst) t2 x0)) (THead (Flat Appl) x1 (THead (Bind Abst) t0 +x4))) \to (\forall (P: Prop).P))) H21 t2 H23) in (let H25 \def (eq_ind_r T x3 +(\lambda (t0: T).(pr2 c t2 t0)) H19 t2 H23) in (eq_ind T t2 (\lambda (t0: +T).(sn3 c (THead (Flat Appl) x1 (THead (Bind Abst) t0 x4)))) (let H_x0 \def +(term_dec x x1) in (let H26 \def H_x0 in (or_ind (eq T x x1) ((eq T x x1) \to +(\forall (P: Prop).P)) (sn3 c (THead (Flat Appl) x1 (THead (Bind Abst) t2 +x4))) (\lambda (H27: (eq T x x1)).(let H28 \def (eq_ind_r T x1 (\lambda (t0: +T).((eq T (THead (Flat Appl) x (THead (Bind Abst) t2 x0)) (THead (Flat Appl) +t0 (THead (Bind Abst) t2 x4))) \to (\forall (P: Prop).P))) H24 x H27) in (let +H29 \def (eq_ind_r T x1 (\lambda (t0: T).(pr2 c x t0)) H14 x H27) in (eq_ind +T x (\lambda (t0: T).(sn3 c (THead (Flat Appl) t0 (THead (Bind Abst) t2 +x4)))) (let H_x1 \def (term_dec x0 x4) in (let H30 \def H_x1 in (or_ind (eq T +x0 x4) ((eq T x0 x4) \to (\forall (P: Prop).P)) (sn3 c (THead (Flat Appl) x +(THead (Bind Abst) t2 x4))) (\lambda (H31: (eq T x0 x4)).(let H32 \def +(eq_ind_r T x4 (\lambda (t0: T).((eq T (THead (Flat Appl) x (THead (Bind +Abst) t2 x0)) (THead (Flat Appl) x (THead (Bind Abst) t2 t0))) \to (\forall +(P: Prop).P))) H28 x0 H31) in (let H33 \def (eq_ind_r T x4 (\lambda (t0: +T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x0 t0)))) H20 x0 +H31) in (eq_ind T x0 (\lambda (t0: T).(sn3 c (THead (Flat Appl) x (THead +(Bind Abst) t2 t0)))) (H32 (refl_equal T (THead (Flat Appl) x (THead (Bind +Abst) t2 x0))) (sn3 c (THead (Flat Appl) x (THead (Bind Abst) t2 x0)))) x4 +H31)))) (\lambda (H31: (((eq T x0 x4) \to (\forall (P: Prop).P)))).(H5 (THead +(Bind Abbr) x x4) (\lambda (H32: (eq T (THead (Bind Abbr) x x0) (THead (Bind +Abbr) x x4))).(\lambda (P: Prop).(let H33 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | +(TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Bind +Abbr) x x0) (THead (Bind Abbr) x x4) H32) in (let H34 \def (eq_ind_r T x4 +(\lambda (t0: T).((eq T x0 t0) \to (\forall (P0: Prop).P0))) H31 x0 H33) in +(let H35 \def (eq_ind_r T x4 (\lambda (t0: T).(\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) x0 t0)))) H20 x0 H33) in (H34 (refl_equal T x0) +P)))))) (pr3_pr2 c (THead (Bind Abbr) x x0) (THead (Bind Abbr) x x4) +(pr2_head_2 c x x0 x4 (Bind Abbr) (H20 Abbr x))) x x4 (refl_equal T (THead +(Bind Abbr) x x4)) t2 (sn3_sing c t2 H7))) H30))) x1 H27)))) (\lambda (H27: +(((eq T x x1) \to (\forall (P: Prop).P)))).(H5 (THead (Bind Abbr) x1 x4) +(\lambda (H28: (eq T (THead (Bind Abbr) x x0) (THead (Bind Abbr) x1 +x4))).(\lambda (P: Prop).(let H29 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x | (TLRef _) +\Rightarrow x | (THead _ t0 _) \Rightarrow t0])) (THead (Bind Abbr) x x0) +(THead (Bind Abbr) x1 x4) H28) in ((let H30 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | +(TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Bind +Abbr) x x0) (THead (Bind Abbr) x1 x4) H28) in (\lambda (H31: (eq T x +x1)).(let H32 \def (eq_ind_r T x4 (\lambda (t0: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) x0 t0)))) H20 x0 H30) in (let H33 \def +(eq_ind_r T x1 (\lambda (t0: T).((eq T x t0) \to (\forall (P0: Prop).P0))) +H27 x H31) in (let H34 \def (eq_ind_r T x1 (\lambda (t0: T).(pr2 c x t0)) H14 +x H31) in (H33 (refl_equal T x) P)))))) H29)))) (pr3_head_12 c x x1 (pr3_pr2 +c x x1 H14) (Bind Abbr) x0 x4 (pr3_pr2 (CHead c (Bind Abbr) x1) x0 x4 (H20 +Abbr x1))) x1 x4 (refl_equal T (THead (Bind Abbr) x1 x4)) t2 (sn3_sing c t2 +H7))) H26))) x3 H23)))) (\lambda (H23: (((eq T t2 x3) \to (\forall (P: +Prop).P)))).(let H_x0 \def (term_dec x x1) in (let H24 \def H_x0 in (or_ind +(eq T x x1) ((eq T x x1) \to (\forall (P: Prop).P)) (sn3 c (THead (Flat Appl) +x1 (THead (Bind Abst) x3 x4))) (\lambda (H25: (eq T x x1)).(let H26 \def +(eq_ind_r T x1 (\lambda (t0: T).(pr2 c x t0)) H14 x H25) in (eq_ind T x +(\lambda (t0: T).(sn3 c (THead (Flat Appl) t0 (THead (Bind Abst) x3 x4)))) +(let H_x1 \def (term_dec x0 x4) in (let H27 \def H_x1 in (or_ind (eq T x0 x4) +((eq T x0 x4) \to (\forall (P: Prop).P)) (sn3 c (THead (Flat Appl) x (THead +(Bind Abst) x3 x4))) (\lambda (H28: (eq T x0 x4)).(let H29 \def (eq_ind_r T +x4 (\lambda (t0: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +x0 t0)))) H20 x0 H28) in (eq_ind T x0 (\lambda (t0: T).(sn3 c (THead (Flat +Appl) x (THead (Bind Abst) x3 t0)))) (H8 x3 H23 (pr3_pr2 c t2 x3 H19)) x4 +H28))) (\lambda (H28: (((eq T x0 x4) \to (\forall (P: Prop).P)))).(H5 (THead +(Bind Abbr) x x4) (\lambda (H29: (eq T (THead (Bind Abbr) x x0) (THead (Bind +Abbr) x x4))).(\lambda (P: Prop).(let H30 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | +(TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Bind +Abbr) x x0) (THead (Bind Abbr) x x4) H29) in (let H31 \def (eq_ind_r T x4 +(\lambda (t0: T).((eq T x0 t0) \to (\forall (P0: Prop).P0))) H28 x0 H30) in +(let H32 \def (eq_ind_r T x4 (\lambda (t0: T).(\forall (b: B).(\forall (u: +T).(pr2 (CHead c (Bind b) u) x0 t0)))) H20 x0 H30) in (H31 (refl_equal T x0) +P)))))) (pr3_pr2 c (THead (Bind Abbr) x x0) (THead (Bind Abbr) x x4) +(pr2_head_2 c x x0 x4 (Bind Abbr) (H20 Abbr x))) x x4 (refl_equal T (THead +(Bind Abbr) x x4)) x3 (H7 x3 H23 (pr3_pr2 c t2 x3 H19)))) H27))) x1 H25))) +(\lambda (H25: (((eq T x x1) \to (\forall (P: Prop).P)))).(H5 (THead (Bind +Abbr) x1 x4) (\lambda (H26: (eq T (THead (Bind Abbr) x x0) (THead (Bind Abbr) +x1 x4))).(\lambda (P: Prop).(let H27 \def (f_equal T T (\lambda (e: T).(match +e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x | (TLRef _) +\Rightarrow x | (THead _ t0 _) \Rightarrow t0])) (THead (Bind Abbr) x x0) +(THead (Bind Abbr) x1 x4) H26) in ((let H28 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | +(TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Bind +Abbr) x x0) (THead (Bind Abbr) x1 x4) H26) in (\lambda (H29: (eq T x +x1)).(let H30 \def (eq_ind_r T x4 (\lambda (t0: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) x0 t0)))) H20 x0 H28) in (let H31 \def +(eq_ind_r T x1 (\lambda (t0: T).((eq T x t0) \to (\forall (P0: Prop).P0))) +H25 x H29) in (let H32 \def (eq_ind_r T x1 (\lambda (t0: T).(pr2 c x t0)) H14 +x H29) in (H31 (refl_equal T x) P)))))) H27)))) (pr3_head_12 c x x1 (pr3_pr2 +c x x1 H14) (Bind Abbr) x0 x4 (pr3_pr2 (CHead c (Bind Abbr) x1) x0 x4 (H20 +Abbr x1))) x1 x4 (refl_equal T (THead (Bind Abbr) x1 x4)) x3 (H7 x3 H23 +(pr3_pr2 c t2 x3 H19)))) H24)))) H22))) x2 H18))))))) H17)) t3 H13))))))) +H12)) (\lambda (H12: (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) t2 x0) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t4: T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t4))))))))).(ex4_4_ind T T T +T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind Abst) t2 x0) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind +Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t4: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +z1 t4))))))) (sn3 c t3) (\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (x4: T).(\lambda (H13: (eq T (THead (Bind Abst) t2 x0) (THead +(Bind Abst) x1 x2))).(\lambda (H14: (eq T t3 (THead (Bind Abbr) x3 +x4))).(\lambda (H15: (pr2 c x x3)).(\lambda (H16: ((\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) x2 x4))))).(let H17 \def (eq_ind T t3 +(\lambda (t0: T).((eq T (THead (Flat Appl) x (THead (Bind Abst) t2 x0)) t0) +\to (\forall (P: Prop).P))) H9 (THead (Bind Abbr) x3 x4) H14) in (eq_ind_r T +(THead (Bind Abbr) x3 x4) (\lambda (t0: T).(sn3 c t0)) (let H18 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t2 | (TLRef _) \Rightarrow t2 | (THead _ t0 _) \Rightarrow t0])) +(THead (Bind Abst) t2 x0) (THead (Bind Abst) x1 x2) H13) in ((let H19 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow x0 | (TLRef _) \Rightarrow x0 | (THead _ _ t0) +\Rightarrow t0])) (THead (Bind Abst) t2 x0) (THead (Bind Abst) x1 x2) H13) in +(\lambda (_: (eq T t2 x1)).(let H21 \def (eq_ind_r T x2 (\lambda (t0: +T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) t0 x4)))) H16 x0 +H19) in (let H_x \def (term_dec x x3) in (let H22 \def H_x in (or_ind (eq T x +x3) ((eq T x x3) \to (\forall (P: Prop).P)) (sn3 c (THead (Bind Abbr) x3 x4)) +(\lambda (H23: (eq T x x3)).(let H24 \def (eq_ind_r T x3 (\lambda (t0: +T).(pr2 c x t0)) H15 x H23) in (eq_ind T x (\lambda (t0: T).(sn3 c (THead +(Bind Abbr) t0 x4))) (let H_x0 \def (term_dec x0 x4) in (let H25 \def H_x0 in +(or_ind (eq T x0 x4) ((eq T x0 x4) \to (\forall (P: Prop).P)) (sn3 c (THead +(Bind Abbr) x x4)) (\lambda (H26: (eq T x0 x4)).(let H27 \def (eq_ind_r T x4 +(\lambda (t0: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x0 +t0)))) H21 x0 H26) in (eq_ind T x0 (\lambda (t0: T).(sn3 c (THead (Bind Abbr) +x t0))) (sn3_sing c (THead (Bind Abbr) x x0) H6) x4 H26))) (\lambda (H26: +(((eq T x0 x4) \to (\forall (P: Prop).P)))).(H6 (THead (Bind Abbr) x x4) +(\lambda (H27: (eq T (THead (Bind Abbr) x x0) (THead (Bind Abbr) x +x4))).(\lambda (P: Prop).(let H28 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | (TLRef _) +\Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Bind Abbr) x x0) +(THead (Bind Abbr) x x4) H27) in (let H29 \def (eq_ind_r T x4 (\lambda (t0: +T).((eq T x0 t0) \to (\forall (P0: Prop).P0))) H26 x0 H28) in (let H30 \def +(eq_ind_r T x4 (\lambda (t0: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c +(Bind b) u) x0 t0)))) H21 x0 H28) in (H29 (refl_equal T x0) P)))))) (pr3_pr2 +c (THead (Bind Abbr) x x0) (THead (Bind Abbr) x x4) (pr2_head_2 c x x0 x4 +(Bind Abbr) (H21 Abbr x))))) H25))) x3 H23))) (\lambda (H23: (((eq T x x3) +\to (\forall (P: Prop).P)))).(H6 (THead (Bind Abbr) x3 x4) (\lambda (H24: (eq +T (THead (Bind Abbr) x x0) (THead (Bind Abbr) x3 x4))).(\lambda (P: +Prop).(let H25 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow x | (TLRef _) \Rightarrow x | +(THead _ t0 _) \Rightarrow t0])) (THead (Bind Abbr) x x0) (THead (Bind Abbr) +x3 x4) H24) in ((let H26 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | (TLRef _) +\Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Bind Abbr) x x0) +(THead (Bind Abbr) x3 x4) H24) in (\lambda (H27: (eq T x x3)).(let H28 \def +(eq_ind_r T x4 (\lambda (t0: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c +(Bind b) u) x0 t0)))) H21 x0 H26) in (let H29 \def (eq_ind_r T x3 (\lambda +(t0: T).((eq T x t0) \to (\forall (P0: Prop).P0))) H23 x H27) in (let H30 +\def (eq_ind_r T x3 (\lambda (t0: T).(pr2 c x t0)) H15 x H27) in (H29 +(refl_equal T x) P)))))) H25)))) (pr3_head_12 c x x3 (pr3_pr2 c x x3 H15) +(Bind Abbr) x0 x4 (pr3_pr2 (CHead c (Bind Abbr) x3) x0 x4 (H21 Abbr x3))))) +H22)))))) H18)) t3 H14)))))))))) H12)) (\lambda (H12: (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind Abst) t2 x0) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T t3 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))).(ex6_6_ind B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind Abst) t2 x0) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t3 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))) (sn3 c t3) +(\lambda (x1: B).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda +(x5: T).(\lambda (x6: T).(\lambda (H13: (not (eq B x1 Abst))).(\lambda (H14: +(eq T (THead (Bind Abst) t2 x0) (THead (Bind x1) x2 x3))).(\lambda (H15: (eq +T t3 (THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) O x5) x4)))).(\lambda +(_: (pr2 c x x5)).(\lambda (H17: (pr2 c x2 x6)).(\lambda (H18: (pr2 (CHead c +(Bind x1) x6) x3 x4)).(let H19 \def (eq_ind T t3 (\lambda (t0: T).((eq T +(THead (Flat Appl) x (THead (Bind Abst) t2 x0)) t0) \to (\forall (P: +Prop).P))) H9 (THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) O x5) x4)) +H15) in (eq_ind_r T (THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) O x5) +x4)) (\lambda (t0: T).(sn3 c t0)) (let H20 \def (f_equal T B (\lambda (e: +T).(match e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow Abst | +(TLRef _) \Rightarrow Abst | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b) \Rightarrow b | (Flat _) \Rightarrow +Abst])])) (THead (Bind Abst) t2 x0) (THead (Bind x1) x2 x3) H14) in ((let H21 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t2 | (TLRef _) \Rightarrow t2 | (THead _ t0 _) +\Rightarrow t0])) (THead (Bind Abst) t2 x0) (THead (Bind x1) x2 x3) H14) in +((let H22 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow x0 | (TLRef _) \Rightarrow x0 | (THead _ _ +t0) \Rightarrow t0])) (THead (Bind Abst) t2 x0) (THead (Bind x1) x2 x3) H14) +in (\lambda (H23: (eq T t2 x2)).(\lambda (H24: (eq B Abst x1)).(let H25 \def +(eq_ind_r T x3 (\lambda (t0: T).(pr2 (CHead c (Bind x1) x6) t0 x4)) H18 x0 +H22) in (let H26 \def (eq_ind_r T x2 (\lambda (t0: T).(pr2 c t0 x6)) H17 t2 +H23) in (let H27 \def (eq_ind_r B x1 (\lambda (b: B).(pr2 (CHead c (Bind b) +x6) x0 x4)) H25 Abst H24) in (let H28 \def (eq_ind_r B x1 (\lambda (b: +B).(not (eq B b Abst))) H13 Abst H24) in (eq_ind B Abst (\lambda (b: B).(sn3 +c (THead (Bind b) x6 (THead (Flat Appl) (lift (S O) O x5) x4)))) (let H29 +\def (match (H28 (refl_equal B Abst)) in False return (\lambda (_: +False).(sn3 c (THead (Bind Abst) x6 (THead (Flat Appl) (lift (S O) O x5) +x4)))) with []) in H29) x1 H24)))))))) H21)) H20)) t3 H15)))))))))))))) H12)) +H11))))))))) w H4))))))))))) y H0))))) H)))). + +theorem sn3_appl_lref: + \forall (c: C).(\forall (i: nat).((nf2 c (TLRef i)) \to (\forall (v: +T).((sn3 c v) \to (sn3 c (THead (Flat Appl) v (TLRef i))))))) +\def + \lambda (c: C).(\lambda (i: nat).(\lambda (H: (nf2 c (TLRef i))).(\lambda +(v: T).(\lambda (H0: (sn3 c v)).(sn3_ind c (\lambda (t: T).(sn3 c (THead +(Flat Appl) t (TLRef i)))) (\lambda (t1: T).(\lambda (_: ((\forall (t2: +T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c +t2)))))).(\lambda (H2: ((\forall (t2: T).((((eq T t1 t2) \to (\forall (P: +Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c (THead (Flat Appl) t2 (TLRef +i)))))))).(sn3_pr2_intro c (THead (Flat Appl) t1 (TLRef i)) (\lambda (t2: +T).(\lambda (H3: (((eq T (THead (Flat Appl) t1 (TLRef i)) t2) \to (\forall +(P: Prop).P)))).(\lambda (H4: (pr2 c (THead (Flat Appl) t1 (TLRef i)) +t2)).(let H5 \def (pr2_gen_appl c t1 (TLRef i) t2 H4) in (or3_ind (ex3_2 T T +(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c t1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c (TLRef i) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (TLRef i) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: +T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c t1 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) z1 t3)))))))) (ex6_6 B T T T T T (\lambda +(b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(TLRef i) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c t1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) +(sn3 c t2) (\lambda (H6: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c t1 +u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c (TLRef i) t3))))).(ex3_2_ind T +T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c t1 u2))) (\lambda (_: T).(\lambda +(t3: T).(pr2 c (TLRef i) t3))) (sn3 c t2) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H7: (eq T t2 (THead (Flat Appl) x0 x1))).(\lambda (H8: (pr2 c t1 +x0)).(\lambda (H9: (pr2 c (TLRef i) x1)).(let H10 \def (eq_ind T t2 (\lambda +(t: T).((eq T (THead (Flat Appl) t1 (TLRef i)) t) \to (\forall (P: Prop).P))) +H3 (THead (Flat Appl) x0 x1) H7) in (eq_ind_r T (THead (Flat Appl) x0 x1) +(\lambda (t: T).(sn3 c t)) (let H11 \def (eq_ind_r T x1 (\lambda (t: T).((eq +T (THead (Flat Appl) t1 (TLRef i)) (THead (Flat Appl) x0 t)) \to (\forall (P: +Prop).P))) H10 (TLRef i) (H x1 H9)) in (let H12 \def (eq_ind_r T x1 (\lambda +(t: T).(pr2 c (TLRef i) t)) H9 (TLRef i) (H x1 H9)) in (eq_ind T (TLRef i) +(\lambda (t: T).(sn3 c (THead (Flat Appl) x0 t))) (let H_x \def (term_dec t1 +x0) in (let H13 \def H_x in (or_ind (eq T t1 x0) ((eq T t1 x0) \to (\forall +(P: Prop).P)) (sn3 c (THead (Flat Appl) x0 (TLRef i))) (\lambda (H14: (eq T +t1 x0)).(let H15 \def (eq_ind_r T x0 (\lambda (t: T).((eq T (THead (Flat +Appl) t1 (TLRef i)) (THead (Flat Appl) t (TLRef i))) \to (\forall (P: +Prop).P))) H11 t1 H14) in (let H16 \def (eq_ind_r T x0 (\lambda (t: T).(pr2 c +t1 t)) H8 t1 H14) in (eq_ind T t1 (\lambda (t: T).(sn3 c (THead (Flat Appl) t +(TLRef i)))) (H15 (refl_equal T (THead (Flat Appl) t1 (TLRef i))) (sn3 c +(THead (Flat Appl) t1 (TLRef i)))) x0 H14)))) (\lambda (H14: (((eq T t1 x0) +\to (\forall (P: Prop).P)))).(H2 x0 H14 (pr3_pr2 c t1 x0 H8))) H13))) x1 (H +x1 H9)))) t2 H7))))))) H6)) (\lambda (H6: (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (TLRef i) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c t1 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t3))))))))).(ex4_4_ind T +T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(TLRef i) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c t1 +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t3))))))) +(sn3 c t2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (H7: (eq T (TLRef i) (THead (Bind Abst) x0 x1))).(\lambda (H8: +(eq T t2 (THead (Bind Abbr) x2 x3))).(\lambda (_: (pr2 c t1 x2)).(\lambda (_: +((\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x1 x3))))).(let +H11 \def (eq_ind T t2 (\lambda (t: T).((eq T (THead (Flat Appl) t1 (TLRef i)) +t) \to (\forall (P: Prop).P))) H3 (THead (Bind Abbr) x2 x3) H8) in (eq_ind_r +T (THead (Bind Abbr) x2 x3) (\lambda (t: T).(sn3 c t)) (let H12 \def (eq_ind +T (TLRef i) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) +\Rightarrow False])) I (THead (Bind Abst) x0 x1) H7) in (False_ind (sn3 c +(THead (Bind Abbr) x2 x3)) H12)) t2 H8)))))))))) H6)) (\lambda (H6: (ex6_6 B +T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (TLRef i) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq +T t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c t1 u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 +z2))))))))).(ex6_6_ind B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (TLRef i) (THead (Bind b) y1 +z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: +T).(\lambda (u2: T).(\lambda (y2: T).(eq T t2 (THead (Bind b) y2 (THead (Flat +Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c t1 u2))))))) +(\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 +(CHead c (Bind b) y2) z1 z2))))))) (sn3 c t2) (\lambda (x0: B).(\lambda (x1: +T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: +T).(\lambda (_: (not (eq B x0 Abst))).(\lambda (H8: (eq T (TLRef i) (THead +(Bind x0) x1 x2))).(\lambda (H9: (eq T t2 (THead (Bind x0) x5 (THead (Flat +Appl) (lift (S O) O x4) x3)))).(\lambda (_: (pr2 c t1 x4)).(\lambda (_: (pr2 +c x1 x5)).(\lambda (_: (pr2 (CHead c (Bind x0) x5) x2 x3)).(let H13 \def +(eq_ind T t2 (\lambda (t: T).((eq T (THead (Flat Appl) t1 (TLRef i)) t) \to +(\forall (P: Prop).P))) H3 (THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) +O x4) x3)) H9) in (eq_ind_r T (THead (Bind x0) x5 (THead (Flat Appl) (lift (S +O) O x4) x3)) (\lambda (t: T).(sn3 c t)) (let H14 \def (eq_ind T (TLRef i) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow +False])) I (THead (Bind x0) x1 x2) H8) in (False_ind (sn3 c (THead (Bind x0) +x5 (THead (Flat Appl) (lift (S O) O x4) x3))) H14)) t2 H9)))))))))))))) H6)) +H5))))))))) v H0))))). + +theorem sn3_appl_abbr: + \forall (c: C).(\forall (d: C).(\forall (w: T).(\forall (i: nat).((getl i c +(CHead d (Bind Abbr) w)) \to (\forall (v: T).((sn3 c (THead (Flat Appl) v +(lift (S i) O w))) \to (sn3 c (THead (Flat Appl) v (TLRef i))))))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (w: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead d (Bind Abbr) w))).(\lambda (v: T).(\lambda (H0: (sn3 c +(THead (Flat Appl) v (lift (S i) O w)))).(insert_eq T (THead (Flat Appl) v +(lift (S i) O w)) (\lambda (t: T).(sn3 c t)) (sn3 c (THead (Flat Appl) v +(TLRef i))) (\lambda (y: T).(\lambda (H1: (sn3 c y)).(unintro T v (\lambda +(t: T).((eq T y (THead (Flat Appl) t (lift (S i) O w))) \to (sn3 c (THead +(Flat Appl) t (TLRef i))))) (sn3_ind c (\lambda (t: T).(\forall (x: T).((eq T +t (THead (Flat Appl) x (lift (S i) O w))) \to (sn3 c (THead (Flat Appl) x +(TLRef i)))))) (\lambda (t1: T).(\lambda (H2: ((\forall (t2: T).((((eq T t1 +t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c +t2)))))).(\lambda (H3: ((\forall (t2: T).((((eq T t1 t2) \to (\forall (P: +Prop).P))) \to ((pr3 c t1 t2) \to (\forall (x: T).((eq T t2 (THead (Flat +Appl) x (lift (S i) O w))) \to (sn3 c (THead (Flat Appl) x (TLRef +i)))))))))).(\lambda (x: T).(\lambda (H4: (eq T t1 (THead (Flat Appl) x (lift +(S i) O w)))).(let H5 \def (eq_ind T t1 (\lambda (t: T).(\forall (t2: +T).((((eq T t t2) \to (\forall (P: Prop).P))) \to ((pr3 c t t2) \to (\forall +(x0: T).((eq T t2 (THead (Flat Appl) x0 (lift (S i) O w))) \to (sn3 c (THead +(Flat Appl) x0 (TLRef i))))))))) H3 (THead (Flat Appl) x (lift (S i) O w)) +H4) in (let H6 \def (eq_ind T t1 (\lambda (t: T).(\forall (t2: T).((((eq T t +t2) \to (\forall (P: Prop).P))) \to ((pr3 c t t2) \to (sn3 c t2))))) H2 +(THead (Flat Appl) x (lift (S i) O w)) H4) in (sn3_pr2_intro c (THead (Flat +Appl) x (TLRef i)) (\lambda (t2: T).(\lambda (H7: (((eq T (THead (Flat Appl) +x (TLRef i)) t2) \to (\forall (P: Prop).P)))).(\lambda (H8: (pr2 c (THead +(Flat Appl) x (TLRef i)) t2)).(let H9 \def (pr2_gen_appl c x (TLRef i) t2 H8) +in (or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c (TLRef i) t3)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(TLRef i) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: +T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t3)))))))) +(ex6_6 B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (TLRef i) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq +T t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) +(sn3 c t2) (\lambda (H10: (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T +t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x +u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c (TLRef i) t3))))).(ex3_2_ind T +T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) (\lambda (_: T).(\lambda (t3: +T).(pr2 c (TLRef i) t3))) (sn3 c t2) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H11: (eq T t2 (THead (Flat Appl) x0 x1))).(\lambda (H12: (pr2 c +x x0)).(\lambda (H13: (pr2 c (TLRef i) x1)).(let H14 \def (eq_ind T t2 +(\lambda (t: T).((eq T (THead (Flat Appl) x (TLRef i)) t) \to (\forall (P: +Prop).P))) H7 (THead (Flat Appl) x0 x1) H11) in (eq_ind_r T (THead (Flat +Appl) x0 x1) (\lambda (t: T).(sn3 c t)) (let H15 \def (pr2_gen_lref c x1 i +H13) in (or_ind (eq T x1 (TLRef i)) (ex2_2 C T (\lambda (d0: C).(\lambda (u: +T).(getl i c (CHead d0 (Bind Abbr) u)))) (\lambda (_: C).(\lambda (u: T).(eq +T x1 (lift (S i) O u))))) (sn3 c (THead (Flat Appl) x0 x1)) (\lambda (H16: +(eq T x1 (TLRef i))).(let H17 \def (eq_ind T x1 (\lambda (t: T).((eq T (THead +(Flat Appl) x (TLRef i)) (THead (Flat Appl) x0 t)) \to (\forall (P: +Prop).P))) H14 (TLRef i) H16) in (eq_ind_r T (TLRef i) (\lambda (t: T).(sn3 c +(THead (Flat Appl) x0 t))) (let H_x \def (term_dec x x0) in (let H18 \def H_x +in (or_ind (eq T x x0) ((eq T x x0) \to (\forall (P: Prop).P)) (sn3 c (THead +(Flat Appl) x0 (TLRef i))) (\lambda (H19: (eq T x x0)).(let H20 \def +(eq_ind_r T x0 (\lambda (t: T).((eq T (THead (Flat Appl) x (TLRef i)) (THead +(Flat Appl) t (TLRef i))) \to (\forall (P: Prop).P))) H17 x H19) in (let H21 +\def (eq_ind_r T x0 (\lambda (t: T).(pr2 c x t)) H12 x H19) in (eq_ind T x +(\lambda (t: T).(sn3 c (THead (Flat Appl) t (TLRef i)))) (H20 (refl_equal T +(THead (Flat Appl) x (TLRef i))) (sn3 c (THead (Flat Appl) x (TLRef i)))) x0 +H19)))) (\lambda (H19: (((eq T x x0) \to (\forall (P: Prop).P)))).(H5 (THead +(Flat Appl) x0 (lift (S i) O w)) (\lambda (H20: (eq T (THead (Flat Appl) x +(lift (S i) O w)) (THead (Flat Appl) x0 (lift (S i) O w)))).(\lambda (P: +Prop).(let H21 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow x | (TLRef _) \Rightarrow x | +(THead _ t _) \Rightarrow t])) (THead (Flat Appl) x (lift (S i) O w)) (THead +(Flat Appl) x0 (lift (S i) O w)) H20) in (let H22 \def (eq_ind_r T x0 +(\lambda (t: T).((eq T x t) \to (\forall (P0: Prop).P0))) H19 x H21) in (let +H23 \def (eq_ind_r T x0 (\lambda (t: T).(pr2 c x t)) H12 x H21) in (H22 +(refl_equal T x) P)))))) (pr3_pr2 c (THead (Flat Appl) x (lift (S i) O w)) +(THead (Flat Appl) x0 (lift (S i) O w)) (pr2_head_1 c x x0 H12 (Flat Appl) +(lift (S i) O w))) x0 (refl_equal T (THead (Flat Appl) x0 (lift (S i) O +w))))) H18))) x1 H16))) (\lambda (H16: (ex2_2 C T (\lambda (d0: C).(\lambda +(u: T).(getl i c (CHead d0 (Bind Abbr) u)))) (\lambda (_: C).(\lambda (u: +T).(eq T x1 (lift (S i) O u)))))).(ex2_2_ind C T (\lambda (d0: C).(\lambda +(u: T).(getl i c (CHead d0 (Bind Abbr) u)))) (\lambda (_: C).(\lambda (u: +T).(eq T x1 (lift (S i) O u)))) (sn3 c (THead (Flat Appl) x0 x1)) (\lambda +(x2: C).(\lambda (x3: T).(\lambda (H17: (getl i c (CHead x2 (Bind Abbr) +x3))).(\lambda (H18: (eq T x1 (lift (S i) O x3))).(let H19 \def (eq_ind T x1 +(\lambda (t: T).((eq T (THead (Flat Appl) x (TLRef i)) (THead (Flat Appl) x0 +t)) \to (\forall (P: Prop).P))) H14 (lift (S i) O x3) H18) in (eq_ind_r T +(lift (S i) O x3) (\lambda (t: T).(sn3 c (THead (Flat Appl) x0 t))) (let H20 +\def (eq_ind C (CHead d (Bind Abbr) w) (\lambda (c0: C).(getl i c c0)) H +(CHead x2 (Bind Abbr) x3) (getl_mono c (CHead d (Bind Abbr) w) i H (CHead x2 +(Bind Abbr) x3) H17)) in (let H21 \def (f_equal C C (\lambda (e: C).(match e +in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) +\Rightarrow c0])) (CHead d (Bind Abbr) w) (CHead x2 (Bind Abbr) x3) +(getl_mono c (CHead d (Bind Abbr) w) i H (CHead x2 (Bind Abbr) x3) H17)) in +((let H22 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: +C).T) with [(CSort _) \Rightarrow w | (CHead _ _ t) \Rightarrow t])) (CHead d +(Bind Abbr) w) (CHead x2 (Bind Abbr) x3) (getl_mono c (CHead d (Bind Abbr) w) +i H (CHead x2 (Bind Abbr) x3) H17)) in (\lambda (H23: (eq C d x2)).(let H24 +\def (eq_ind_r T x3 (\lambda (t: T).(getl i c (CHead x2 (Bind Abbr) t))) H20 +w H22) in (eq_ind T w (\lambda (t: T).(sn3 c (THead (Flat Appl) x0 (lift (S +i) O t)))) (let H25 \def (eq_ind_r C x2 (\lambda (c0: C).(getl i c (CHead c0 +(Bind Abbr) w))) H24 d H23) in (let H_x \def (term_dec x x0) in (let H26 \def +H_x in (or_ind (eq T x x0) ((eq T x x0) \to (\forall (P: Prop).P)) (sn3 c +(THead (Flat Appl) x0 (lift (S i) O w))) (\lambda (H27: (eq T x x0)).(let H28 +\def (eq_ind_r T x0 (\lambda (t: T).(pr2 c x t)) H12 x H27) in (eq_ind T x +(\lambda (t: T).(sn3 c (THead (Flat Appl) t (lift (S i) O w)))) (sn3_sing c +(THead (Flat Appl) x (lift (S i) O w)) H6) x0 H27))) (\lambda (H27: (((eq T x +x0) \to (\forall (P: Prop).P)))).(H6 (THead (Flat Appl) x0 (lift (S i) O w)) +(\lambda (H28: (eq T (THead (Flat Appl) x (lift (S i) O w)) (THead (Flat +Appl) x0 (lift (S i) O w)))).(\lambda (P: Prop).(let H29 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow x | (TLRef _) \Rightarrow x | (THead _ t _) \Rightarrow t])) +(THead (Flat Appl) x (lift (S i) O w)) (THead (Flat Appl) x0 (lift (S i) O +w)) H28) in (let H30 \def (eq_ind_r T x0 (\lambda (t: T).((eq T x t) \to +(\forall (P0: Prop).P0))) H27 x H29) in (let H31 \def (eq_ind_r T x0 (\lambda +(t: T).(pr2 c x t)) H12 x H29) in (H30 (refl_equal T x) P)))))) (pr3_pr2 c +(THead (Flat Appl) x (lift (S i) O w)) (THead (Flat Appl) x0 (lift (S i) O +w)) (pr2_head_1 c x x0 H12 (Flat Appl) (lift (S i) O w))))) H26)))) x3 +H22)))) H21))) x1 H18)))))) H16)) H15)) t2 H11))))))) H10)) (\lambda (H10: +(ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: +T).(eq T (TLRef i) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda +(_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 +t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: +T).(pr2 c x u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda +(t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 +t3))))))))).(ex4_4_ind T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T (TLRef i) (THead (Bind Abst) y1 z1)))))) (\lambda +(_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead +(Bind Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (t3: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind +b) u) z1 t3))))))) (sn3 c t2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: +T).(\lambda (x3: T).(\lambda (H11: (eq T (TLRef i) (THead (Bind Abst) x0 +x1))).(\lambda (H12: (eq T t2 (THead (Bind Abbr) x2 x3))).(\lambda (_: (pr2 c +x x2)).(\lambda (_: ((\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) +u) x1 x3))))).(let H15 \def (eq_ind T t2 (\lambda (t: T).((eq T (THead (Flat +Appl) x (TLRef i)) t) \to (\forall (P: Prop).P))) H7 (THead (Bind Abbr) x2 +x3) H12) in (eq_ind_r T (THead (Bind Abbr) x2 x3) (\lambda (t: T).(sn3 c t)) +(let H16 \def (eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead (Bind Abst) x0 +x1) H11) in (False_ind (sn3 c (THead (Bind Abbr) x2 x3)) H16)) t2 +H12)))))))))) H10)) (\lambda (H10: (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (TLRef i) +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t2 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))).(ex6_6_ind +B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T (TLRef i) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda +(_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq +T t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))) +(sn3 c t2) (\lambda (x0: B).(\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (_: (not (eq B x0 +Abst))).(\lambda (H12: (eq T (TLRef i) (THead (Bind x0) x1 x2))).(\lambda +(H13: (eq T t2 (THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) O x4) +x3)))).(\lambda (_: (pr2 c x x4)).(\lambda (_: (pr2 c x1 x5)).(\lambda (_: +(pr2 (CHead c (Bind x0) x5) x2 x3)).(let H17 \def (eq_ind T t2 (\lambda (t: +T).((eq T (THead (Flat Appl) x (TLRef i)) t) \to (\forall (P: Prop).P))) H7 +(THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) O x4) x3)) H13) in +(eq_ind_r T (THead (Bind x0) x5 (THead (Flat Appl) (lift (S O) O x4) x3)) +(\lambda (t: T).(sn3 c t)) (let H18 \def (eq_ind T (TLRef i) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I +(THead (Bind x0) x1 x2) H12) in (False_ind (sn3 c (THead (Bind x0) x5 (THead +(Flat Appl) (lift (S O) O x4) x3))) H18)) t2 H13)))))))))))))) H10)) +H9))))))))))))) y H1)))) H0))))))). + +theorem sn3_appl_cast: + \forall (c: C).(\forall (v: T).(\forall (u: T).((sn3 c (THead (Flat Appl) v +u)) \to (\forall (t: T).((sn3 c (THead (Flat Appl) v t)) \to (sn3 c (THead +(Flat Appl) v (THead (Flat Cast) u t)))))))) +\def + \lambda (c: C).(\lambda (v: T).(\lambda (u: T).(\lambda (H: (sn3 c (THead +(Flat Appl) v u))).(insert_eq T (THead (Flat Appl) v u) (\lambda (t: T).(sn3 +c t)) (\forall (t: T).((sn3 c (THead (Flat Appl) v t)) \to (sn3 c (THead +(Flat Appl) v (THead (Flat Cast) u t))))) (\lambda (y: T).(\lambda (H0: (sn3 +c y)).(unintro T u (\lambda (t: T).((eq T y (THead (Flat Appl) v t)) \to +(\forall (t0: T).((sn3 c (THead (Flat Appl) v t0)) \to (sn3 c (THead (Flat +Appl) v (THead (Flat Cast) t t0))))))) (unintro T v (\lambda (t: T).(\forall +(x: T).((eq T y (THead (Flat Appl) t x)) \to (\forall (t0: T).((sn3 c (THead +(Flat Appl) t t0)) \to (sn3 c (THead (Flat Appl) t (THead (Flat Cast) x +t0)))))))) (sn3_ind c (\lambda (t: T).(\forall (x: T).(\forall (x0: T).((eq T +t (THead (Flat Appl) x x0)) \to (\forall (t0: T).((sn3 c (THead (Flat Appl) x +t0)) \to (sn3 c (THead (Flat Appl) x (THead (Flat Cast) x0 t0))))))))) +(\lambda (t1: T).(\lambda (H1: ((\forall (t2: T).((((eq T t1 t2) \to (\forall +(P: Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c t2)))))).(\lambda (H2: ((\forall +(t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to +(\forall (x: T).(\forall (x0: T).((eq T t2 (THead (Flat Appl) x x0)) \to +(\forall (t: T).((sn3 c (THead (Flat Appl) x t)) \to (sn3 c (THead (Flat +Appl) x (THead (Flat Cast) x0 t))))))))))))).(\lambda (x: T).(\lambda (x0: +T).(\lambda (H3: (eq T t1 (THead (Flat Appl) x x0))).(\lambda (t: T).(\lambda +(H4: (sn3 c (THead (Flat Appl) x t))).(insert_eq T (THead (Flat Appl) x t) +(\lambda (t0: T).(sn3 c t0)) (sn3 c (THead (Flat Appl) x (THead (Flat Cast) +x0 t))) (\lambda (y0: T).(\lambda (H5: (sn3 c y0)).(unintro T t (\lambda (t0: +T).((eq T y0 (THead (Flat Appl) x t0)) \to (sn3 c (THead (Flat Appl) x (THead +(Flat Cast) x0 t0))))) (sn3_ind c (\lambda (t0: T).(\forall (x1: T).((eq T t0 +(THead (Flat Appl) x x1)) \to (sn3 c (THead (Flat Appl) x (THead (Flat Cast) +x0 x1)))))) (\lambda (t0: T).(\lambda (H6: ((\forall (t2: T).((((eq T t0 t2) +\to (\forall (P: Prop).P))) \to ((pr3 c t0 t2) \to (sn3 c t2)))))).(\lambda +(H7: ((\forall (t2: T).((((eq T t0 t2) \to (\forall (P: Prop).P))) \to ((pr3 +c t0 t2) \to (\forall (x1: T).((eq T t2 (THead (Flat Appl) x x1)) \to (sn3 c +(THead (Flat Appl) x (THead (Flat Cast) x0 x1)))))))))).(\lambda (x1: +T).(\lambda (H8: (eq T t0 (THead (Flat Appl) x x1))).(let H9 \def (eq_ind T +t0 (\lambda (t2: T).(\forall (t3: T).((((eq T t2 t3) \to (\forall (P: +Prop).P))) \to ((pr3 c t2 t3) \to (\forall (x2: T).((eq T t3 (THead (Flat +Appl) x x2)) \to (sn3 c (THead (Flat Appl) x (THead (Flat Cast) x0 +x2))))))))) H7 (THead (Flat Appl) x x1) H8) in (let H10 \def (eq_ind T t0 +(\lambda (t2: T).(\forall (t3: T).((((eq T t2 t3) \to (\forall (P: Prop).P))) +\to ((pr3 c t2 t3) \to (sn3 c t3))))) H6 (THead (Flat Appl) x x1) H8) in (let +H11 \def (eq_ind T t1 (\lambda (t2: T).(\forall (t3: T).((((eq T t2 t3) \to +(\forall (P: Prop).P))) \to ((pr3 c t2 t3) \to (\forall (x2: T).(\forall (x3: +T).((eq T t3 (THead (Flat Appl) x2 x3)) \to (\forall (t4: T).((sn3 c (THead +(Flat Appl) x2 t4)) \to (sn3 c (THead (Flat Appl) x2 (THead (Flat Cast) x3 +t4)))))))))))) H2 (THead (Flat Appl) x x0) H3) in (let H12 \def (eq_ind T t1 +(\lambda (t2: T).(\forall (t3: T).((((eq T t2 t3) \to (\forall (P: Prop).P))) +\to ((pr3 c t2 t3) \to (sn3 c t3))))) H1 (THead (Flat Appl) x x0) H3) in +(sn3_pr2_intro c (THead (Flat Appl) x (THead (Flat Cast) x0 x1)) (\lambda +(t2: T).(\lambda (H13: (((eq T (THead (Flat Appl) x (THead (Flat Cast) x0 +x1)) t2) \to (\forall (P: Prop).P)))).(\lambda (H14: (pr2 c (THead (Flat +Appl) x (THead (Flat Cast) x0 x1)) t2)).(let H15 \def (pr2_gen_appl c x +(THead (Flat Cast) x0 x1) t2 H14) in (or3_ind (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Flat Cast) x0 x1) t3)))) (ex4_4 T T T T (\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Flat Cast) x0 x1) +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3)))))))) (ex6_6 B T T T T +T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Flat Cast) x0 x1) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (sn3 c t2) (\lambda (H16: (ex3_2 T T (\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c +(THead (Flat Cast) x0 x1) t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda +(t3: T).(eq T t2 (THead (Flat Appl) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c x u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c (THead (Flat Cast) +x0 x1) t3))) (sn3 c t2) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H17: (eq +T t2 (THead (Flat Appl) x2 x3))).(\lambda (H18: (pr2 c x x2)).(\lambda (H19: +(pr2 c (THead (Flat Cast) x0 x1) x3)).(let H20 \def (eq_ind T t2 (\lambda +(t3: T).((eq T (THead (Flat Appl) x (THead (Flat Cast) x0 x1)) t3) \to +(\forall (P: Prop).P))) H13 (THead (Flat Appl) x2 x3) H17) in (eq_ind_r T +(THead (Flat Appl) x2 x3) (\lambda (t3: T).(sn3 c t3)) (let H21 \def +(pr2_gen_cast c x0 x1 x3 H19) in (or_ind (ex3_2 T T (\lambda (u2: T).(\lambda +(t3: T).(eq T x3 (THead (Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c x0 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c x1 t3)))) (pr2 c +x1 x3) (sn3 c (THead (Flat Appl) x2 x3)) (\lambda (H22: (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T x3 (THead (Flat Cast) u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c x0 u2))) (\lambda (_: T).(\lambda (t3: T).(pr2 c x1 +t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T x3 (THead +(Flat Cast) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x0 u2))) +(\lambda (_: T).(\lambda (t3: T).(pr2 c x1 t3))) (sn3 c (THead (Flat Appl) x2 +x3)) (\lambda (x4: T).(\lambda (x5: T).(\lambda (H23: (eq T x3 (THead (Flat +Cast) x4 x5))).(\lambda (H24: (pr2 c x0 x4)).(\lambda (H25: (pr2 c x1 +x5)).(let H26 \def (eq_ind T x3 (\lambda (t3: T).((eq T (THead (Flat Appl) x +(THead (Flat Cast) x0 x1)) (THead (Flat Appl) x2 t3)) \to (\forall (P: +Prop).P))) H20 (THead (Flat Cast) x4 x5) H23) in (eq_ind_r T (THead (Flat +Cast) x4 x5) (\lambda (t3: T).(sn3 c (THead (Flat Appl) x2 t3))) (let H_x +\def (term_dec (THead (Flat Appl) x x0) (THead (Flat Appl) x2 x4)) in (let +H27 \def H_x in (or_ind (eq T (THead (Flat Appl) x x0) (THead (Flat Appl) x2 +x4)) ((eq T (THead (Flat Appl) x x0) (THead (Flat Appl) x2 x4)) \to (\forall +(P: Prop).P)) (sn3 c (THead (Flat Appl) x2 (THead (Flat Cast) x4 x5))) +(\lambda (H28: (eq T (THead (Flat Appl) x x0) (THead (Flat Appl) x2 +x4))).(let H29 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow x | (TLRef _) \Rightarrow x | +(THead _ t3 _) \Rightarrow t3])) (THead (Flat Appl) x x0) (THead (Flat Appl) +x2 x4) H28) in ((let H30 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | (TLRef _) +\Rightarrow x0 | (THead _ _ t3) \Rightarrow t3])) (THead (Flat Appl) x x0) +(THead (Flat Appl) x2 x4) H28) in (\lambda (H31: (eq T x x2)).(let H32 \def +(eq_ind_r T x4 (\lambda (t3: T).((eq T (THead (Flat Appl) x (THead (Flat +Cast) x0 x1)) (THead (Flat Appl) x2 (THead (Flat Cast) t3 x5))) \to (\forall +(P: Prop).P))) H26 x0 H30) in (let H33 \def (eq_ind_r T x4 (\lambda (t3: +T).(pr2 c x0 t3)) H24 x0 H30) in (eq_ind T x0 (\lambda (t3: T).(sn3 c (THead +(Flat Appl) x2 (THead (Flat Cast) t3 x5)))) (let H34 \def (eq_ind_r T x2 +(\lambda (t3: T).((eq T (THead (Flat Appl) x (THead (Flat Cast) x0 x1)) +(THead (Flat Appl) t3 (THead (Flat Cast) x0 x5))) \to (\forall (P: Prop).P))) +H32 x H31) in (let H35 \def (eq_ind_r T x2 (\lambda (t3: T).(pr2 c x t3)) H18 +x H31) in (eq_ind T x (\lambda (t3: T).(sn3 c (THead (Flat Appl) t3 (THead +(Flat Cast) x0 x5)))) (let H_x0 \def (term_dec (THead (Flat Appl) x x1) +(THead (Flat Appl) x x5)) in (let H36 \def H_x0 in (or_ind (eq T (THead (Flat +Appl) x x1) (THead (Flat Appl) x x5)) ((eq T (THead (Flat Appl) x x1) (THead +(Flat Appl) x x5)) \to (\forall (P: Prop).P)) (sn3 c (THead (Flat Appl) x +(THead (Flat Cast) x0 x5))) (\lambda (H37: (eq T (THead (Flat Appl) x x1) +(THead (Flat Appl) x x5))).(let H38 \def (f_equal T T (\lambda (e: T).(match +e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x1 | (TLRef _) +\Rightarrow x1 | (THead _ _ t3) \Rightarrow t3])) (THead (Flat Appl) x x1) +(THead (Flat Appl) x x5) H37) in (let H39 \def (eq_ind_r T x5 (\lambda (t3: +T).((eq T (THead (Flat Appl) x (THead (Flat Cast) x0 x1)) (THead (Flat Appl) +x (THead (Flat Cast) x0 t3))) \to (\forall (P: Prop).P))) H34 x1 H38) in (let +H40 \def (eq_ind_r T x5 (\lambda (t3: T).(pr2 c x1 t3)) H25 x1 H38) in +(eq_ind T x1 (\lambda (t3: T).(sn3 c (THead (Flat Appl) x (THead (Flat Cast) +x0 t3)))) (H39 (refl_equal T (THead (Flat Appl) x (THead (Flat Cast) x0 x1))) +(sn3 c (THead (Flat Appl) x (THead (Flat Cast) x0 x1)))) x5 H38))))) (\lambda +(H37: (((eq T (THead (Flat Appl) x x1) (THead (Flat Appl) x x5)) \to (\forall +(P: Prop).P)))).(H9 (THead (Flat Appl) x x5) H37 (pr3_pr2 c (THead (Flat +Appl) x x1) (THead (Flat Appl) x x5) (pr2_thin_dx c x1 x5 H25 x Appl)) x5 +(refl_equal T (THead (Flat Appl) x x5)))) H36))) x2 H31))) x4 H30))))) H29))) +(\lambda (H28: (((eq T (THead (Flat Appl) x x0) (THead (Flat Appl) x2 x4)) +\to (\forall (P: Prop).P)))).(let H_x0 \def (term_dec (THead (Flat Appl) x +x1) (THead (Flat Appl) x2 x5)) in (let H29 \def H_x0 in (or_ind (eq T (THead +(Flat Appl) x x1) (THead (Flat Appl) x2 x5)) ((eq T (THead (Flat Appl) x x1) +(THead (Flat Appl) x2 x5)) \to (\forall (P: Prop).P)) (sn3 c (THead (Flat +Appl) x2 (THead (Flat Cast) x4 x5))) (\lambda (H30: (eq T (THead (Flat Appl) +x x1) (THead (Flat Appl) x2 x5))).(let H31 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x | +(TLRef _) \Rightarrow x | (THead _ t3 _) \Rightarrow t3])) (THead (Flat Appl) +x x1) (THead (Flat Appl) x2 x5) H30) in ((let H32 \def (f_equal T T (\lambda +(e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x1 +| (TLRef _) \Rightarrow x1 | (THead _ _ t3) \Rightarrow t3])) (THead (Flat +Appl) x x1) (THead (Flat Appl) x2 x5) H30) in (\lambda (H33: (eq T x +x2)).(let H34 \def (eq_ind_r T x5 (\lambda (t3: T).(pr2 c x1 t3)) H25 x1 H32) +in (eq_ind T x1 (\lambda (t3: T).(sn3 c (THead (Flat Appl) x2 (THead (Flat +Cast) x4 t3)))) (let H35 \def (eq_ind_r T x2 (\lambda (t3: T).((eq T (THead +(Flat Appl) x x0) (THead (Flat Appl) t3 x4)) \to (\forall (P: Prop).P))) H28 +x H33) in (let H36 \def (eq_ind_r T x2 (\lambda (t3: T).(pr2 c x t3)) H18 x +H33) in (eq_ind T x (\lambda (t3: T).(sn3 c (THead (Flat Appl) t3 (THead +(Flat Cast) x4 x1)))) (H11 (THead (Flat Appl) x x4) H35 (pr3_pr2 c (THead +(Flat Appl) x x0) (THead (Flat Appl) x x4) (pr2_thin_dx c x0 x4 H24 x Appl)) +x x4 (refl_equal T (THead (Flat Appl) x x4)) x1 (sn3_sing c (THead (Flat +Appl) x x1) H10)) x2 H33))) x5 H32)))) H31))) (\lambda (H30: (((eq T (THead +(Flat Appl) x x1) (THead (Flat Appl) x2 x5)) \to (\forall (P: +Prop).P)))).(H11 (THead (Flat Appl) x2 x4) H28 (pr3_flat c x x2 (pr3_pr2 c x +x2 H18) x0 x4 (pr3_pr2 c x0 x4 H24) Appl) x2 x4 (refl_equal T (THead (Flat +Appl) x2 x4)) x5 (H10 (THead (Flat Appl) x2 x5) H30 (pr3_flat c x x2 (pr3_pr2 +c x x2 H18) x1 x5 (pr3_pr2 c x1 x5 H25) Appl)))) H29)))) H27))) x3 H23))))))) +H22)) (\lambda (H22: (pr2 c x1 x3)).(let H_x \def (term_dec (THead (Flat +Appl) x x1) (THead (Flat Appl) x2 x3)) in (let H23 \def H_x in (or_ind (eq T +(THead (Flat Appl) x x1) (THead (Flat Appl) x2 x3)) ((eq T (THead (Flat Appl) +x x1) (THead (Flat Appl) x2 x3)) \to (\forall (P: Prop).P)) (sn3 c (THead +(Flat Appl) x2 x3)) (\lambda (H24: (eq T (THead (Flat Appl) x x1) (THead +(Flat Appl) x2 x3))).(let H25 \def (f_equal T T (\lambda (e: T).(match e in T +return (\lambda (_: T).T) with [(TSort _) \Rightarrow x | (TLRef _) +\Rightarrow x | (THead _ t3 _) \Rightarrow t3])) (THead (Flat Appl) x x1) +(THead (Flat Appl) x2 x3) H24) in ((let H26 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x1 | +(TLRef _) \Rightarrow x1 | (THead _ _ t3) \Rightarrow t3])) (THead (Flat +Appl) x x1) (THead (Flat Appl) x2 x3) H24) in (\lambda (H27: (eq T x +x2)).(let H28 \def (eq_ind_r T x3 (\lambda (t3: T).(pr2 c x1 t3)) H22 x1 H26) +in (let H29 \def (eq_ind_r T x3 (\lambda (t3: T).((eq T (THead (Flat Appl) x +(THead (Flat Cast) x0 x1)) (THead (Flat Appl) x2 t3)) \to (\forall (P: +Prop).P))) H20 x1 H26) in (eq_ind T x1 (\lambda (t3: T).(sn3 c (THead (Flat +Appl) x2 t3))) (let H30 \def (eq_ind_r T x2 (\lambda (t3: T).((eq T (THead +(Flat Appl) x (THead (Flat Cast) x0 x1)) (THead (Flat Appl) t3 x1)) \to +(\forall (P: Prop).P))) H29 x H27) in (let H31 \def (eq_ind_r T x2 (\lambda +(t3: T).(pr2 c x t3)) H18 x H27) in (eq_ind T x (\lambda (t3: T).(sn3 c +(THead (Flat Appl) t3 x1))) (sn3_sing c (THead (Flat Appl) x x1) H10) x2 +H27))) x3 H26))))) H25))) (\lambda (H24: (((eq T (THead (Flat Appl) x x1) +(THead (Flat Appl) x2 x3)) \to (\forall (P: Prop).P)))).(H10 (THead (Flat +Appl) x2 x3) H24 (pr3_flat c x x2 (pr3_pr2 c x x2 H18) x1 x3 (pr3_pr2 c x1 x3 +H22) Appl))) H23)))) H21)) t2 H17))))))) H16)) (\lambda (H16: (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Flat Cast) x0 x1) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead (Bind +Abbr) u2 t3)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t3: T).(\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) z1 t3))))))))).(ex4_4_ind T T T T (\lambda (y1: T).(\lambda (z1: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Flat Cast) x0 x1) (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t3: T).(eq T t2 (THead (Bind Abbr) u2 t3)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t3: T).(\forall (b: +B).(\forall (u0: T).(pr2 (CHead c (Bind b) u0) z1 t3))))))) (sn3 c t2) +(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda +(H17: (eq T (THead (Flat Cast) x0 x1) (THead (Bind Abst) x2 x3))).(\lambda +(H18: (eq T t2 (THead (Bind Abbr) x4 x5))).(\lambda (_: (pr2 c x +x4)).(\lambda (_: ((\forall (b: B).(\forall (u0: T).(pr2 (CHead c (Bind b) +u0) x3 x5))))).(let H21 \def (eq_ind T t2 (\lambda (t3: T).((eq T (THead +(Flat Appl) x (THead (Flat Cast) x0 x1)) t3) \to (\forall (P: Prop).P))) H13 +(THead (Bind Abbr) x4 x5) H18) in (eq_ind_r T (THead (Bind Abbr) x4 x5) +(\lambda (t3: T).(sn3 c t3)) (let H22 \def (eq_ind T (THead (Flat Cast) x0 +x1) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind Abst) x2 +x3) H17) in (False_ind (sn3 c (THead (Bind Abbr) x4 x5)) H22)) t2 +H18)))))))))) H16)) (\lambda (H16: (ex6_6 B T T T T T (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Flat +Cast) x0 x1) (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +t2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 +z2))))))))).(ex6_6_ind B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b +Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Flat Cast) x0 x1) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t2 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))) (sn3 c t2) +(\lambda (x2: B).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda +(x6: T).(\lambda (x7: T).(\lambda (_: (not (eq B x2 Abst))).(\lambda (H18: +(eq T (THead (Flat Cast) x0 x1) (THead (Bind x2) x3 x4))).(\lambda (H19: (eq +T t2 (THead (Bind x2) x7 (THead (Flat Appl) (lift (S O) O x6) x5)))).(\lambda +(_: (pr2 c x x6)).(\lambda (_: (pr2 c x3 x7)).(\lambda (_: (pr2 (CHead c +(Bind x2) x7) x4 x5)).(let H23 \def (eq_ind T t2 (\lambda (t3: T).((eq T +(THead (Flat Appl) x (THead (Flat Cast) x0 x1)) t3) \to (\forall (P: +Prop).P))) H13 (THead (Bind x2) x7 (THead (Flat Appl) (lift (S O) O x6) x5)) +H19) in (eq_ind_r T (THead (Bind x2) x7 (THead (Flat Appl) (lift (S O) O x6) +x5)) (\lambda (t3: T).(sn3 c t3)) (let H24 \def (eq_ind T (THead (Flat Cast) +x0 x1) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind x2) x3 x4) +H18) in (False_ind (sn3 c (THead (Bind x2) x7 (THead (Flat Appl) (lift (S O) +O x6) x5))) H24)) t2 H19)))))))))))))) H16)) H15))))))))))))))) y0 H5)))) +H4))))))))) y H0))))) H)))). + +theorem sn3_appl_bind: + \forall (b: B).((not (eq B b Abst)) \to (\forall (c: C).(\forall (u: +T).((sn3 c u) \to (\forall (t: T).(\forall (v: T).((sn3 (CHead c (Bind b) u) +(THead (Flat Appl) (lift (S O) O v) t)) \to (sn3 c (THead (Flat Appl) v +(THead (Bind b) u t)))))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda (c: C).(\lambda +(u: T).(\lambda (H0: (sn3 c u)).(sn3_ind c (\lambda (t: T).(\forall (t0: +T).(\forall (v: T).((sn3 (CHead c (Bind b) t) (THead (Flat Appl) (lift (S O) +O v) t0)) \to (sn3 c (THead (Flat Appl) v (THead (Bind b) t t0))))))) +(\lambda (t1: T).(\lambda (H1: ((\forall (t2: T).((((eq T t1 t2) \to (\forall +(P: Prop).P))) \to ((pr3 c t1 t2) \to (sn3 c t2)))))).(\lambda (H2: ((\forall +(t2: T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 c t1 t2) \to +(\forall (t: T).(\forall (v: T).((sn3 (CHead c (Bind b) t2) (THead (Flat +Appl) (lift (S O) O v) t)) \to (sn3 c (THead (Flat Appl) v (THead (Bind b) t2 +t))))))))))).(\lambda (t: T).(\lambda (v: T).(\lambda (H3: (sn3 (CHead c +(Bind b) t1) (THead (Flat Appl) (lift (S O) O v) t))).(insert_eq T (THead +(Flat Appl) (lift (S O) O v) t) (\lambda (t0: T).(sn3 (CHead c (Bind b) t1) +t0)) (sn3 c (THead (Flat Appl) v (THead (Bind b) t1 t))) (\lambda (y: +T).(\lambda (H4: (sn3 (CHead c (Bind b) t1) y)).(unintro T t (\lambda (t0: +T).((eq T y (THead (Flat Appl) (lift (S O) O v) t0)) \to (sn3 c (THead (Flat +Appl) v (THead (Bind b) t1 t0))))) (unintro T v (\lambda (t0: T).(\forall (x: +T).((eq T y (THead (Flat Appl) (lift (S O) O t0) x)) \to (sn3 c (THead (Flat +Appl) t0 (THead (Bind b) t1 x)))))) (sn3_ind (CHead c (Bind b) t1) (\lambda +(t0: T).(\forall (x: T).(\forall (x0: T).((eq T t0 (THead (Flat Appl) (lift +(S O) O x) x0)) \to (sn3 c (THead (Flat Appl) x (THead (Bind b) t1 x0))))))) +(\lambda (t2: T).(\lambda (H5: ((\forall (t3: T).((((eq T t2 t3) \to (\forall +(P: Prop).P))) \to ((pr3 (CHead c (Bind b) t1) t2 t3) \to (sn3 (CHead c (Bind +b) t1) t3)))))).(\lambda (H6: ((\forall (t3: T).((((eq T t2 t3) \to (\forall +(P: Prop).P))) \to ((pr3 (CHead c (Bind b) t1) t2 t3) \to (\forall (x: +T).(\forall (x0: T).((eq T t3 (THead (Flat Appl) (lift (S O) O x) x0)) \to +(sn3 c (THead (Flat Appl) x (THead (Bind b) t1 x0))))))))))).(\lambda (x: +T).(\lambda (x0: T).(\lambda (H7: (eq T t2 (THead (Flat Appl) (lift (S O) O +x) x0))).(let H8 \def (eq_ind T t2 (\lambda (t0: T).(\forall (t3: T).((((eq T +t0 t3) \to (\forall (P: Prop).P))) \to ((pr3 (CHead c (Bind b) t1) t0 t3) \to +(\forall (x1: T).(\forall (x2: T).((eq T t3 (THead (Flat Appl) (lift (S O) O +x1) x2)) \to (sn3 c (THead (Flat Appl) x1 (THead (Bind b) t1 x2)))))))))) H6 +(THead (Flat Appl) (lift (S O) O x) x0) H7) in (let H9 \def (eq_ind T t2 +(\lambda (t0: T).(\forall (t3: T).((((eq T t0 t3) \to (\forall (P: Prop).P))) +\to ((pr3 (CHead c (Bind b) t1) t0 t3) \to (sn3 (CHead c (Bind b) t1) t3))))) +H5 (THead (Flat Appl) (lift (S O) O x) x0) H7) in (sn3_pr2_intro c (THead +(Flat Appl) x (THead (Bind b) t1 x0)) (\lambda (t3: T).(\lambda (H10: (((eq T +(THead (Flat Appl) x (THead (Bind b) t1 x0)) t3) \to (\forall (P: +Prop).P)))).(\lambda (H11: (pr2 c (THead (Flat Appl) x (THead (Bind b) t1 +x0)) t3)).(let H12 \def (pr2_gen_appl c x (THead (Bind b) t1 x0) t3 H11) in +(or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat +Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) (\lambda (_: +T).(\lambda (t4: T).(pr2 c (THead (Bind b) t1 x0) t4)))) (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Bind b) t1 x0) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind +Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t4: T).(\forall (b0: B).(\forall (u0: T).(pr2 (CHead c (Bind b0) +u0) z1 t4)))))))) (ex6_6 B T T T T T (\lambda (b0: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b0 Abst)))))))) (\lambda (b0: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind b) t1 x0) (THead +(Bind b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t3 (THead (Bind +b0) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b0: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b0) y2) z1 z2)))))))) (sn3 c t3) +(\lambda (H13: (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead +(Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind b) t1 x0) +t4))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead +(Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Bind b) t1 x0) t4))) (sn3 c +t3) (\lambda (x1: T).(\lambda (x2: T).(\lambda (H14: (eq T t3 (THead (Flat +Appl) x1 x2))).(\lambda (H15: (pr2 c x x1)).(\lambda (H16: (pr2 c (THead +(Bind b) t1 x0) x2)).(let H17 \def (eq_ind T t3 (\lambda (t0: T).((eq T +(THead (Flat Appl) x (THead (Bind b) t1 x0)) t0) \to (\forall (P: Prop).P))) +H10 (THead (Flat Appl) x1 x2) H14) in (eq_ind_r T (THead (Flat Appl) x1 x2) +(\lambda (t0: T).(sn3 c t0)) (let H_x \def (pr3_gen_bind b H c t1 x0 x2) in +(let H18 \def (H_x (pr3_pr2 c (THead (Bind b) t1 x0) x2 H16)) in (or_ind +(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T x2 (THead (Bind b) u2 +t4)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c t1 u2))) (\lambda (_: +T).(\lambda (t4: T).(pr3 (CHead c (Bind b) t1) x0 t4)))) (pr3 (CHead c (Bind +b) t1) x0 (lift (S O) O x2)) (sn3 c (THead (Flat Appl) x1 x2)) (\lambda (H19: +(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T x2 (THead (Bind b) u2 +t4)))) (\lambda (u2: T).(\lambda (_: T).(pr3 c t1 u2))) (\lambda (_: +T).(\lambda (t4: T).(pr3 (CHead c (Bind b) t1) x0 t4))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t4: T).(eq T x2 (THead (Bind b) u2 t4)))) (\lambda +(u2: T).(\lambda (_: T).(pr3 c t1 u2))) (\lambda (_: T).(\lambda (t4: T).(pr3 +(CHead c (Bind b) t1) x0 t4))) (sn3 c (THead (Flat Appl) x1 x2)) (\lambda +(x3: T).(\lambda (x4: T).(\lambda (H20: (eq T x2 (THead (Bind b) x3 +x4))).(\lambda (H21: (pr3 c t1 x3)).(\lambda (H22: (pr3 (CHead c (Bind b) t1) +x0 x4)).(let H23 \def (eq_ind T x2 (\lambda (t0: T).((eq T (THead (Flat Appl) +x (THead (Bind b) t1 x0)) (THead (Flat Appl) x1 t0)) \to (\forall (P: +Prop).P))) H17 (THead (Bind b) x3 x4) H20) in (eq_ind_r T (THead (Bind b) x3 +x4) (\lambda (t0: T).(sn3 c (THead (Flat Appl) x1 t0))) (let H_x0 \def +(term_dec t1 x3) in (let H24 \def H_x0 in (or_ind (eq T t1 x3) ((eq T t1 x3) +\to (\forall (P: Prop).P)) (sn3 c (THead (Flat Appl) x1 (THead (Bind b) x3 +x4))) (\lambda (H25: (eq T t1 x3)).(let H26 \def (eq_ind_r T x3 (\lambda (t0: +T).((eq T (THead (Flat Appl) x (THead (Bind b) t1 x0)) (THead (Flat Appl) x1 +(THead (Bind b) t0 x4))) \to (\forall (P: Prop).P))) H23 t1 H25) in (let H27 +\def (eq_ind_r T x3 (\lambda (t0: T).(pr3 c t1 t0)) H21 t1 H25) in (eq_ind T +t1 (\lambda (t0: T).(sn3 c (THead (Flat Appl) x1 (THead (Bind b) t0 x4)))) +(let H_x1 \def (term_dec x0 x4) in (let H28 \def H_x1 in (or_ind (eq T x0 x4) +((eq T x0 x4) \to (\forall (P: Prop).P)) (sn3 c (THead (Flat Appl) x1 (THead +(Bind b) t1 x4))) (\lambda (H29: (eq T x0 x4)).(let H30 \def (eq_ind_r T x4 +(\lambda (t0: T).((eq T (THead (Flat Appl) x (THead (Bind b) t1 x0)) (THead +(Flat Appl) x1 (THead (Bind b) t1 t0))) \to (\forall (P: Prop).P))) H26 x0 +H29) in (let H31 \def (eq_ind_r T x4 (\lambda (t0: T).(pr3 (CHead c (Bind b) +t1) x0 t0)) H22 x0 H29) in (eq_ind T x0 (\lambda (t0: T).(sn3 c (THead (Flat +Appl) x1 (THead (Bind b) t1 t0)))) (let H_x2 \def (term_dec x x1) in (let H32 +\def H_x2 in (or_ind (eq T x x1) ((eq T x x1) \to (\forall (P: Prop).P)) (sn3 +c (THead (Flat Appl) x1 (THead (Bind b) t1 x0))) (\lambda (H33: (eq T x +x1)).(let H34 \def (eq_ind_r T x1 (\lambda (t0: T).((eq T (THead (Flat Appl) +x (THead (Bind b) t1 x0)) (THead (Flat Appl) t0 (THead (Bind b) t1 x0))) \to +(\forall (P: Prop).P))) H30 x H33) in (let H35 \def (eq_ind_r T x1 (\lambda +(t0: T).(pr2 c x t0)) H15 x H33) in (eq_ind T x (\lambda (t0: T).(sn3 c +(THead (Flat Appl) t0 (THead (Bind b) t1 x0)))) (H34 (refl_equal T (THead +(Flat Appl) x (THead (Bind b) t1 x0))) (sn3 c (THead (Flat Appl) x (THead +(Bind b) t1 x0)))) x1 H33)))) (\lambda (H33: (((eq T x x1) \to (\forall (P: +Prop).P)))).(H8 (THead (Flat Appl) (lift (S O) O x1) x0) (\lambda (H34: (eq T +(THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift (S O) O x1) +x0))).(\lambda (P: Prop).(let H35 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map +(f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match t0 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u0 t4) +\Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) t4))]) in +lref_map) (\lambda (x5: nat).(plus x5 (S O))) O x) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match +t0 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k u0 t4) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t4))]) in lref_map) (\lambda (x5: nat).(plus x5 (S O))) O x) | (THead _ t0 _) +\Rightarrow t0])) (THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) +(lift (S O) O x1) x0) H34) in (let H36 \def (eq_ind_r T x1 (\lambda (t0: +T).((eq T x t0) \to (\forall (P0: Prop).P0))) H33 x (lift_inj x x1 (S O) O +H35)) in (let H37 \def (eq_ind_r T x1 (\lambda (t0: T).(pr2 c x t0)) H15 x +(lift_inj x x1 (S O) O H35)) in (H36 (refl_equal T x) P)))))) (pr3_flat +(CHead c (Bind b) t1) (lift (S O) O x) (lift (S O) O x1) (pr3_lift (CHead c +(Bind b) t1) c (S O) O (drop_drop (Bind b) O c c (drop_refl c) t1) x x1 +(pr3_pr2 c x x1 H15)) x0 x0 (pr3_refl (CHead c (Bind b) t1) x0) Appl) x1 x0 +(refl_equal T (THead (Flat Appl) (lift (S O) O x1) x0)))) H32))) x4 H29)))) +(\lambda (H29: (((eq T x0 x4) \to (\forall (P: Prop).P)))).(H8 (THead (Flat +Appl) (lift (S O) O x1) x4) (\lambda (H30: (eq T (THead (Flat Appl) (lift (S +O) O x) x0) (THead (Flat Appl) (lift (S O) O x1) x4))).(\lambda (P: +Prop).(let H31 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map (f: ((nat +\to nat))) (d: nat) (t0: T) on t0: T \def (match t0 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u0 t4) +\Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) t4))]) in +lref_map) (\lambda (x5: nat).(plus x5 (S O))) O x) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match +t0 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k u0 t4) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t4))]) in lref_map) (\lambda (x5: nat).(plus x5 (S O))) O x) | (THead _ t0 _) +\Rightarrow t0])) (THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) +(lift (S O) O x1) x4) H30) in ((let H32 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | +(TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Flat +Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift (S O) O x1) x4) H30) in +(\lambda (H33: (eq T (lift (S O) O x) (lift (S O) O x1))).(let H34 \def +(eq_ind_r T x4 (\lambda (t0: T).((eq T x0 t0) \to (\forall (P0: Prop).P0))) +H29 x0 H32) in (let H35 \def (eq_ind_r T x4 (\lambda (t0: T).((eq T (THead +(Flat Appl) x (THead (Bind b) t1 x0)) (THead (Flat Appl) x1 (THead (Bind b) +t1 t0))) \to (\forall (P0: Prop).P0))) H26 x0 H32) in (let H36 \def (eq_ind_r +T x4 (\lambda (t0: T).(pr3 (CHead c (Bind b) t1) x0 t0)) H22 x0 H32) in (let +H37 \def (eq_ind_r T x1 (\lambda (t0: T).((eq T (THead (Flat Appl) x (THead +(Bind b) t1 x0)) (THead (Flat Appl) t0 (THead (Bind b) t1 x0))) \to (\forall +(P0: Prop).P0))) H35 x (lift_inj x x1 (S O) O H33)) in (let H38 \def +(eq_ind_r T x1 (\lambda (t0: T).(pr2 c x t0)) H15 x (lift_inj x x1 (S O) O +H33)) in (H34 (refl_equal T x0) P)))))))) H31)))) (pr3_flat (CHead c (Bind b) +t1) (lift (S O) O x) (lift (S O) O x1) (pr3_lift (CHead c (Bind b) t1) c (S +O) O (drop_drop (Bind b) O c c (drop_refl c) t1) x x1 (pr3_pr2 c x x1 H15)) +x0 x4 H22 Appl) x1 x4 (refl_equal T (THead (Flat Appl) (lift (S O) O x1) +x4)))) H28))) x3 H25)))) (\lambda (H25: (((eq T t1 x3) \to (\forall (P: +Prop).P)))).(H2 x3 H25 H21 x4 x1 (sn3_cpr3_trans c t1 x3 H21 (Bind b) (THead +(Flat Appl) (lift (S O) O x1) x4) (let H_x1 \def (term_dec x0 x4) in (let H26 +\def H_x1 in (or_ind (eq T x0 x4) ((eq T x0 x4) \to (\forall (P: Prop).P)) +(sn3 (CHead c (Bind b) t1) (THead (Flat Appl) (lift (S O) O x1) x4)) (\lambda +(H27: (eq T x0 x4)).(let H28 \def (eq_ind_r T x4 (\lambda (t0: T).(pr3 (CHead +c (Bind b) t1) x0 t0)) H22 x0 H27) in (eq_ind T x0 (\lambda (t0: T).(sn3 +(CHead c (Bind b) t1) (THead (Flat Appl) (lift (S O) O x1) t0))) (let H_x2 +\def (term_dec x x1) in (let H29 \def H_x2 in (or_ind (eq T x x1) ((eq T x +x1) \to (\forall (P: Prop).P)) (sn3 (CHead c (Bind b) t1) (THead (Flat Appl) +(lift (S O) O x1) x0)) (\lambda (H30: (eq T x x1)).(let H31 \def (eq_ind_r T +x1 (\lambda (t0: T).(pr2 c x t0)) H15 x H30) in (eq_ind T x (\lambda (t0: +T).(sn3 (CHead c (Bind b) t1) (THead (Flat Appl) (lift (S O) O t0) x0))) +(sn3_sing (CHead c (Bind b) t1) (THead (Flat Appl) (lift (S O) O x) x0) H9) +x1 H30))) (\lambda (H30: (((eq T x x1) \to (\forall (P: Prop).P)))).(H9 +(THead (Flat Appl) (lift (S O) O x1) x0) (\lambda (H31: (eq T (THead (Flat +Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift (S O) O x1) +x0))).(\lambda (P: Prop).(let H32 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map +(f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match t0 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u0 t4) +\Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) t4))]) in +lref_map) (\lambda (x5: nat).(plus x5 (S O))) O x) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match +t0 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k u0 t4) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t4))]) in lref_map) (\lambda (x5: nat).(plus x5 (S O))) O x) | (THead _ t0 _) +\Rightarrow t0])) (THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) +(lift (S O) O x1) x0) H31) in (let H33 \def (eq_ind_r T x1 (\lambda (t0: +T).((eq T x t0) \to (\forall (P0: Prop).P0))) H30 x (lift_inj x x1 (S O) O +H32)) in (let H34 \def (eq_ind_r T x1 (\lambda (t0: T).(pr2 c x t0)) H15 x +(lift_inj x x1 (S O) O H32)) in (H33 (refl_equal T x) P)))))) (pr3_flat +(CHead c (Bind b) t1) (lift (S O) O x) (lift (S O) O x1) (pr3_lift (CHead c +(Bind b) t1) c (S O) O (drop_drop (Bind b) O c c (drop_refl c) t1) x x1 +(pr3_pr2 c x x1 H15)) x0 x0 (pr3_refl (CHead c (Bind b) t1) x0) Appl))) +H29))) x4 H27))) (\lambda (H27: (((eq T x0 x4) \to (\forall (P: +Prop).P)))).(H9 (THead (Flat Appl) (lift (S O) O x1) x4) (\lambda (H28: (eq T +(THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift (S O) O x1) +x4))).(\lambda (P: Prop).(let H29 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map +(f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match t0 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u0 t4) +\Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) t4))]) in +lref_map) (\lambda (x5: nat).(plus x5 (S O))) O x) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match +t0 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k u0 t4) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t4))]) in lref_map) (\lambda (x5: nat).(plus x5 (S O))) O x) | (THead _ t0 _) +\Rightarrow t0])) (THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) +(lift (S O) O x1) x4) H28) in ((let H30 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | +(TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Flat +Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift (S O) O x1) x4) H28) in +(\lambda (H31: (eq T (lift (S O) O x) (lift (S O) O x1))).(let H32 \def +(eq_ind_r T x4 (\lambda (t0: T).((eq T x0 t0) \to (\forall (P0: Prop).P0))) +H27 x0 H30) in (let H33 \def (eq_ind_r T x4 (\lambda (t0: T).(pr3 (CHead c +(Bind b) t1) x0 t0)) H22 x0 H30) in (let H34 \def (eq_ind_r T x1 (\lambda +(t0: T).(pr2 c x t0)) H15 x (lift_inj x x1 (S O) O H31)) in (H32 (refl_equal +T x0) P)))))) H29)))) (pr3_flat (CHead c (Bind b) t1) (lift (S O) O x) (lift +(S O) O x1) (pr3_lift (CHead c (Bind b) t1) c (S O) O (drop_drop (Bind b) O c +c (drop_refl c) t1) x x1 (pr3_pr2 c x x1 H15)) x0 x4 H22 Appl))) H26)))))) +H24))) x2 H20))))))) H19)) (\lambda (H19: (pr3 (CHead c (Bind b) t1) x0 (lift +(S O) O x2))).(sn3_gen_lift (CHead c (Bind b) t1) (THead (Flat Appl) x1 x2) +(S O) O (eq_ind_r T (THead (Flat Appl) (lift (S O) O x1) (lift (S O) (s (Flat +Appl) O) x2)) (\lambda (t0: T).(sn3 (CHead c (Bind b) t1) t0)) (sn3_pr3_trans +(CHead c (Bind b) t1) (THead (Flat Appl) (lift (S O) O x1) x0) (let H_x0 \def +(term_dec x x1) in (let H20 \def H_x0 in (or_ind (eq T x x1) ((eq T x x1) \to +(\forall (P: Prop).P)) (sn3 (CHead c (Bind b) t1) (THead (Flat Appl) (lift (S +O) O x1) x0)) (\lambda (H21: (eq T x x1)).(let H22 \def (eq_ind_r T x1 +(\lambda (t0: T).(pr2 c x t0)) H15 x H21) in (eq_ind T x (\lambda (t0: +T).(sn3 (CHead c (Bind b) t1) (THead (Flat Appl) (lift (S O) O t0) x0))) +(sn3_sing (CHead c (Bind b) t1) (THead (Flat Appl) (lift (S O) O x) x0) H9) +x1 H21))) (\lambda (H21: (((eq T x x1) \to (\forall (P: Prop).P)))).(H9 +(THead (Flat Appl) (lift (S O) O x1) x0) (\lambda (H22: (eq T (THead (Flat +Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift (S O) O x1) +x0))).(\lambda (P: Prop).(let H23 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map +(f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match t0 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u0 t4) +\Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) t4))]) in +lref_map) (\lambda (x3: nat).(plus x3 (S O))) O x) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match +t0 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k u0 t4) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t4))]) in lref_map) (\lambda (x3: nat).(plus x3 (S O))) O x) | (THead _ t0 _) +\Rightarrow t0])) (THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) +(lift (S O) O x1) x0) H22) in (let H24 \def (eq_ind_r T x1 (\lambda (t0: +T).((eq T x t0) \to (\forall (P0: Prop).P0))) H21 x (lift_inj x x1 (S O) O +H23)) in (let H25 \def (eq_ind_r T x1 (\lambda (t0: T).(pr2 c x t0)) H15 x +(lift_inj x x1 (S O) O H23)) in (H24 (refl_equal T x) P)))))) (pr3_flat +(CHead c (Bind b) t1) (lift (S O) O x) (lift (S O) O x1) (pr3_lift (CHead c +(Bind b) t1) c (S O) O (drop_drop (Bind b) O c c (drop_refl c) t1) x x1 +(pr3_pr2 c x x1 H15)) x0 x0 (pr3_refl (CHead c (Bind b) t1) x0) Appl))) +H20))) (THead (Flat Appl) (lift (S O) O x1) (lift (S O) O x2)) (pr3_thin_dx +(CHead c (Bind b) t1) x0 (lift (S O) O x2) H19 (lift (S O) O x1) Appl)) (lift +(S O) O (THead (Flat Appl) x1 x2)) (lift_head (Flat Appl) x1 x2 (S O) O)) c +(drop_drop (Bind b) O c c (drop_refl c) t1))) H18))) t3 H14))))))) H13)) +(\lambda (H13: (ex4_4 T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(eq T (THead (Bind b) t1 x0) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: +T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))))) (\lambda (_: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b0: B).(\forall (u0: +T).(pr2 (CHead c (Bind b0) u0) z1 t4))))))))).(ex4_4_ind T T T T (\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind +b) t1 x0) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) +(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x +u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: +T).(\forall (b0: B).(\forall (u0: T).(pr2 (CHead c (Bind b0) u0) z1 t4))))))) +(sn3 c t3) (\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (H14: (eq T (THead (Bind b) t1 x0) (THead (Bind Abst) x1 +x2))).(\lambda (H15: (eq T t3 (THead (Bind Abbr) x3 x4))).(\lambda (_: (pr2 c +x x3)).(\lambda (H17: ((\forall (b0: B).(\forall (u0: T).(pr2 (CHead c (Bind +b0) u0) x2 x4))))).(let H18 \def (eq_ind T t3 (\lambda (t0: T).((eq T (THead +(Flat Appl) x (THead (Bind b) t1 x0)) t0) \to (\forall (P: Prop).P))) H10 +(THead (Bind Abbr) x3 x4) H15) in (eq_ind_r T (THead (Bind Abbr) x3 x4) +(\lambda (t0: T).(sn3 c t0)) (let H19 \def (f_equal T B (\lambda (e: +T).(match e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b | +(TLRef _) \Rightarrow b | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow +b])])) (THead (Bind b) t1 x0) (THead (Bind Abst) x1 x2) H14) in ((let H20 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t1 | (TLRef _) \Rightarrow t1 | (THead _ t0 _) +\Rightarrow t0])) (THead (Bind b) t1 x0) (THead (Bind Abst) x1 x2) H14) in +((let H21 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow x0 | (TLRef _) \Rightarrow x0 | (THead _ _ +t0) \Rightarrow t0])) (THead (Bind b) t1 x0) (THead (Bind Abst) x1 x2) H14) +in (\lambda (_: (eq T t1 x1)).(\lambda (H23: (eq B b Abst)).(let H24 \def +(eq_ind_r T x2 (\lambda (t0: T).(\forall (b0: B).(\forall (u0: T).(pr2 (CHead +c (Bind b0) u0) t0 x4)))) H17 x0 H21) in (let H25 \def (eq_ind B b (\lambda +(b0: B).((eq T (THead (Flat Appl) x (THead (Bind b0) t1 x0)) (THead (Bind +Abbr) x3 x4)) \to (\forall (P: Prop).P))) H18 Abst H23) in (let H26 \def +(eq_ind B b (\lambda (b0: B).(\forall (t4: T).((((eq T (THead (Flat Appl) +(lift (S O) O x) x0) t4) \to (\forall (P: Prop).P))) \to ((pr3 (CHead c (Bind +b0) t1) (THead (Flat Appl) (lift (S O) O x) x0) t4) \to (sn3 (CHead c (Bind +b0) t1) t4))))) H9 Abst H23) in (let H27 \def (eq_ind B b (\lambda (b0: +B).(\forall (t4: T).((((eq T (THead (Flat Appl) (lift (S O) O x) x0) t4) \to +(\forall (P: Prop).P))) \to ((pr3 (CHead c (Bind b0) t1) (THead (Flat Appl) +(lift (S O) O x) x0) t4) \to (\forall (x5: T).(\forall (x6: T).((eq T t4 +(THead (Flat Appl) (lift (S O) O x5) x6)) \to (sn3 c (THead (Flat Appl) x5 +(THead (Bind b0) t1 x6)))))))))) H8 Abst H23) in (let H28 \def (eq_ind B b +(\lambda (b0: B).(\forall (t4: T).((((eq T t1 t4) \to (\forall (P: Prop).P))) +\to ((pr3 c t1 t4) \to (\forall (t0: T).(\forall (v0: T).((sn3 (CHead c (Bind +b0) t4) (THead (Flat Appl) (lift (S O) O v0) t0)) \to (sn3 c (THead (Flat +Appl) v0 (THead (Bind b0) t4 t0)))))))))) H2 Abst H23) in (let H29 \def +(eq_ind B b (\lambda (b0: B).(not (eq B b0 Abst))) H Abst H23) in (let H30 +\def (match (H29 (refl_equal B Abst)) in False return (\lambda (_: +False).(sn3 c (THead (Bind Abbr) x3 x4))) with []) in H30)))))))))) H20)) +H19)) t3 H15)))))))))) H13)) (\lambda (H13: (ex6_6 B T T T T T (\lambda (b0: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(not (eq B b0 Abst)))))))) (\lambda (b0: B).(\lambda (y1: T).(\lambda +(z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind b) +t1 x0) (THead (Bind b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +t3 (THead (Bind b0) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b0) y2) z1 +z2))))))))).(ex6_6_ind B T T T T T (\lambda (b0: B).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B b0 +Abst)))))))) (\lambda (b0: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Bind b) t1 x0) (THead (Bind +b0) y1 z1)))))))) (\lambda (b0: B).(\lambda (_: T).(\lambda (_: T).(\lambda +(z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t3 (THead (Bind b0) y2 (THead +(Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x +u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) (\lambda (b0: +B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 (CHead c (Bind b0) y2) z1 z2))))))) (sn3 c t3) (\lambda (x1: +B).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: +T).(\lambda (x6: T).(\lambda (_: (not (eq B x1 Abst))).(\lambda (H15: (eq T +(THead (Bind b) t1 x0) (THead (Bind x1) x2 x3))).(\lambda (H16: (eq T t3 +(THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) O x5) x4)))).(\lambda +(H17: (pr2 c x x5)).(\lambda (H18: (pr2 c x2 x6)).(\lambda (H19: (pr2 (CHead +c (Bind x1) x6) x3 x4)).(let H20 \def (eq_ind T t3 (\lambda (t0: T).((eq T +(THead (Flat Appl) x (THead (Bind b) t1 x0)) t0) \to (\forall (P: Prop).P))) +H10 (THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) O x5) x4)) H16) in +(eq_ind_r T (THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) O x5) x4)) +(\lambda (t0: T).(sn3 c t0)) (let H21 \def (f_equal T B (\lambda (e: +T).(match e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b | +(TLRef _) \Rightarrow b | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b0) \Rightarrow b0 | (Flat _) \Rightarrow +b])])) (THead (Bind b) t1 x0) (THead (Bind x1) x2 x3) H15) in ((let H22 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t1 | (TLRef _) \Rightarrow t1 | (THead _ t0 _) +\Rightarrow t0])) (THead (Bind b) t1 x0) (THead (Bind x1) x2 x3) H15) in +((let H23 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow x0 | (TLRef _) \Rightarrow x0 | (THead _ _ +t0) \Rightarrow t0])) (THead (Bind b) t1 x0) (THead (Bind x1) x2 x3) H15) in +(\lambda (H24: (eq T t1 x2)).(\lambda (H25: (eq B b x1)).(let H26 \def +(eq_ind_r T x3 (\lambda (t0: T).(pr2 (CHead c (Bind x1) x6) t0 x4)) H19 x0 +H23) in (let H27 \def (eq_ind_r T x2 (\lambda (t0: T).(pr2 c t0 x6)) H18 t1 +H24) in (let H28 \def (eq_ind_r B x1 (\lambda (b0: B).(pr2 (CHead c (Bind b0) +x6) x0 x4)) H26 b H25) in (eq_ind B b (\lambda (b0: B).(sn3 c (THead (Bind +b0) x6 (THead (Flat Appl) (lift (S O) O x5) x4)))) (sn3_pr3_trans c (THead +(Bind b) t1 (THead (Flat Appl) (lift (S O) O x5) x4)) (sn3_bind b c t1 +(sn3_sing c t1 H1) (THead (Flat Appl) (lift (S O) O x5) x4) (let H_x \def +(term_dec x x5) in (let H29 \def H_x in (or_ind (eq T x x5) ((eq T x x5) \to +(\forall (P: Prop).P)) (sn3 (CHead c (Bind b) t1) (THead (Flat Appl) (lift (S +O) O x5) x4)) (\lambda (H30: (eq T x x5)).(let H31 \def (eq_ind_r T x5 +(\lambda (t0: T).(pr2 c x t0)) H17 x H30) in (eq_ind T x (\lambda (t0: +T).(sn3 (CHead c (Bind b) t1) (THead (Flat Appl) (lift (S O) O t0) x4))) (let +H_x0 \def (term_dec x0 x4) in (let H32 \def H_x0 in (or_ind (eq T x0 x4) ((eq +T x0 x4) \to (\forall (P: Prop).P)) (sn3 (CHead c (Bind b) t1) (THead (Flat +Appl) (lift (S O) O x) x4)) (\lambda (H33: (eq T x0 x4)).(let H34 \def +(eq_ind_r T x4 (\lambda (t0: T).(pr2 (CHead c (Bind b) x6) x0 t0)) H28 x0 +H33) in (eq_ind T x0 (\lambda (t0: T).(sn3 (CHead c (Bind b) t1) (THead (Flat +Appl) (lift (S O) O x) t0))) (sn3_sing (CHead c (Bind b) t1) (THead (Flat +Appl) (lift (S O) O x) x0) H9) x4 H33))) (\lambda (H33: (((eq T x0 x4) \to +(\forall (P: Prop).P)))).(H9 (THead (Flat Appl) (lift (S O) O x) x4) (\lambda +(H34: (eq T (THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift +(S O) O x) x4))).(\lambda (P: Prop).(let H35 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | +(TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Flat +Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift (S O) O x) x4) H34) in +(let H36 \def (eq_ind_r T x4 (\lambda (t0: T).((eq T x0 t0) \to (\forall (P0: +Prop).P0))) H33 x0 H35) in (let H37 \def (eq_ind_r T x4 (\lambda (t0: T).(pr2 +(CHead c (Bind b) x6) x0 t0)) H28 x0 H35) in (H36 (refl_equal T x0) P)))))) +(pr3_pr3_pr3_t c t1 x6 (pr3_pr2 c t1 x6 H27) (THead (Flat Appl) (lift (S O) O +x) x0) (THead (Flat Appl) (lift (S O) O x) x4) (Bind b) (pr3_pr2 (CHead c +(Bind b) x6) (THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift +(S O) O x) x4) (pr2_thin_dx (CHead c (Bind b) x6) x0 x4 H28 (lift (S O) O x) +Appl))))) H32))) x5 H30))) (\lambda (H30: (((eq T x x5) \to (\forall (P: +Prop).P)))).(H9 (THead (Flat Appl) (lift (S O) O x5) x4) (\lambda (H31: (eq T +(THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift (S O) O x5) +x4))).(\lambda (P: Prop).(let H32 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow ((let rec lref_map +(f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match t0 with [(TSort n) +\Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match (blt i d) with +[true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u0 t4) +\Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) t4))]) in +lref_map) (\lambda (x7: nat).(plus x7 (S O))) O x) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t0: T) on t0: T \def (match +t0 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k u0 t4) \Rightarrow (THead k (lref_map f d u0) (lref_map f (s k d) +t4))]) in lref_map) (\lambda (x7: nat).(plus x7 (S O))) O x) | (THead _ t0 _) +\Rightarrow t0])) (THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) +(lift (S O) O x5) x4) H31) in ((let H33 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow x0 | +(TLRef _) \Rightarrow x0 | (THead _ _ t0) \Rightarrow t0])) (THead (Flat +Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift (S O) O x5) x4) H31) in +(\lambda (H34: (eq T (lift (S O) O x) (lift (S O) O x5))).(let H35 \def +(eq_ind_r T x5 (\lambda (t0: T).((eq T x t0) \to (\forall (P0: Prop).P0))) +H30 x (lift_inj x x5 (S O) O H34)) in (let H36 \def (eq_ind_r T x5 (\lambda +(t0: T).(pr2 c x t0)) H17 x (lift_inj x x5 (S O) O H34)) in (let H37 \def +(eq_ind_r T x4 (\lambda (t0: T).(pr2 (CHead c (Bind b) x6) x0 t0)) H28 x0 +H33) in (H35 (refl_equal T x) P)))))) H32)))) (pr3_pr3_pr3_t c t1 x6 (pr3_pr2 +c t1 x6 H27) (THead (Flat Appl) (lift (S O) O x) x0) (THead (Flat Appl) (lift +(S O) O x5) x4) (Bind b) (pr3_flat (CHead c (Bind b) x6) (lift (S O) O x) +(lift (S O) O x5) (pr3_lift (CHead c (Bind b) x6) c (S O) O (drop_drop (Bind +b) O c c (drop_refl c) x6) x x5 (pr3_pr2 c x x5 H17)) x0 x4 (pr3_pr2 (CHead c +(Bind b) x6) x0 x4 H28) Appl)))) H29)))) (THead (Bind b) x6 (THead (Flat +Appl) (lift (S O) O x5) x4)) (pr3_pr2 c (THead (Bind b) t1 (THead (Flat Appl) +(lift (S O) O x5) x4)) (THead (Bind b) x6 (THead (Flat Appl) (lift (S O) O +x5) x4)) (pr2_head_1 c t1 x6 H27 (Bind b) (THead (Flat Appl) (lift (S O) O +x5) x4)))) x1 H25))))))) H22)) H21)) t3 H16)))))))))))))) H13)) +H12)))))))))))))) y H4))))) H3))))))) u H0))))). + +theorem sn3_appl_appl: + \forall (v1: T).(\forall (t1: T).(let u1 \def (THead (Flat Appl) v1 t1) in +(\forall (c: C).((sn3 c u1) \to (\forall (v2: T).((sn3 c v2) \to (((\forall +(u2: T).((pr3 c u1 u2) \to ((((iso u1 u2) \to (\forall (P: Prop).P))) \to +(sn3 c (THead (Flat Appl) v2 u2)))))) \to (sn3 c (THead (Flat Appl) v2 +u1))))))))) +\def + \lambda (v1: T).(\lambda (t1: T).(let u1 \def (THead (Flat Appl) v1 t1) in +(\lambda (c: C).(\lambda (H: (sn3 c (THead (Flat Appl) v1 t1))).(insert_eq T +(THead (Flat Appl) v1 t1) (\lambda (t: T).(sn3 c t)) (\forall (v2: T).((sn3 c +v2) \to (((\forall (u2: T).((pr3 c (THead (Flat Appl) v1 t1) u2) \to ((((iso +(THead (Flat Appl) v1 t1) u2) \to (\forall (P: Prop).P))) \to (sn3 c (THead +(Flat Appl) v2 u2)))))) \to (sn3 c (THead (Flat Appl) v2 (THead (Flat Appl) +v1 t1)))))) (\lambda (y: T).(\lambda (H0: (sn3 c y)).(unintro T t1 (\lambda +(t: T).((eq T y (THead (Flat Appl) v1 t)) \to (\forall (v2: T).((sn3 c v2) +\to (((\forall (u2: T).((pr3 c (THead (Flat Appl) v1 t) u2) \to ((((iso +(THead (Flat Appl) v1 t) u2) \to (\forall (P: Prop).P))) \to (sn3 c (THead +(Flat Appl) v2 u2)))))) \to (sn3 c (THead (Flat Appl) v2 (THead (Flat Appl) +v1 t)))))))) (unintro T v1 (\lambda (t: T).(\forall (x: T).((eq T y (THead +(Flat Appl) t x)) \to (\forall (v2: T).((sn3 c v2) \to (((\forall (u2: +T).((pr3 c (THead (Flat Appl) t x) u2) \to ((((iso (THead (Flat Appl) t x) +u2) \to (\forall (P: Prop).P))) \to (sn3 c (THead (Flat Appl) v2 u2)))))) \to +(sn3 c (THead (Flat Appl) v2 (THead (Flat Appl) t x))))))))) (sn3_ind c +(\lambda (t: T).(\forall (x: T).(\forall (x0: T).((eq T t (THead (Flat Appl) +x x0)) \to (\forall (v2: T).((sn3 c v2) \to (((\forall (u2: T).((pr3 c (THead +(Flat Appl) x x0) u2) \to ((((iso (THead (Flat Appl) x x0) u2) \to (\forall +(P: Prop).P))) \to (sn3 c (THead (Flat Appl) v2 u2)))))) \to (sn3 c (THead +(Flat Appl) v2 (THead (Flat Appl) x x0)))))))))) (\lambda (t2: T).(\lambda +(H1: ((\forall (t3: T).((((eq T t2 t3) \to (\forall (P: Prop).P))) \to ((pr3 +c t2 t3) \to (sn3 c t3)))))).(\lambda (H2: ((\forall (t3: T).((((eq T t2 t3) +\to (\forall (P: Prop).P))) \to ((pr3 c t2 t3) \to (\forall (x: T).(\forall +(x0: T).((eq T t3 (THead (Flat Appl) x x0)) \to (\forall (v2: T).((sn3 c v2) +\to (((\forall (u2: T).((pr3 c (THead (Flat Appl) x x0) u2) \to ((((iso +(THead (Flat Appl) x x0) u2) \to (\forall (P: Prop).P))) \to (sn3 c (THead +(Flat Appl) v2 u2)))))) \to (sn3 c (THead (Flat Appl) v2 (THead (Flat Appl) x +x0)))))))))))))).(\lambda (x: T).(\lambda (x0: T).(\lambda (H3: (eq T t2 +(THead (Flat Appl) x x0))).(\lambda (v2: T).(\lambda (H4: (sn3 c +v2)).(sn3_ind c (\lambda (t: T).(((\forall (u2: T).((pr3 c (THead (Flat Appl) +x x0) u2) \to ((((iso (THead (Flat Appl) x x0) u2) \to (\forall (P: +Prop).P))) \to (sn3 c (THead (Flat Appl) t u2)))))) \to (sn3 c (THead (Flat +Appl) t (THead (Flat Appl) x x0))))) (\lambda (t0: T).(\lambda (H5: ((\forall +(t3: T).((((eq T t0 t3) \to (\forall (P: Prop).P))) \to ((pr3 c t0 t3) \to +(sn3 c t3)))))).(\lambda (H6: ((\forall (t3: T).((((eq T t0 t3) \to (\forall +(P: Prop).P))) \to ((pr3 c t0 t3) \to (((\forall (u2: T).((pr3 c (THead (Flat +Appl) x x0) u2) \to ((((iso (THead (Flat Appl) x x0) u2) \to (\forall (P: +Prop).P))) \to (sn3 c (THead (Flat Appl) t3 u2)))))) \to (sn3 c (THead (Flat +Appl) t3 (THead (Flat Appl) x x0))))))))).(\lambda (H7: ((\forall (u2: +T).((pr3 c (THead (Flat Appl) x x0) u2) \to ((((iso (THead (Flat Appl) x x0) +u2) \to (\forall (P: Prop).P))) \to (sn3 c (THead (Flat Appl) t0 +u2))))))).(let H8 \def (eq_ind T t2 (\lambda (t: T).(\forall (t3: T).((((eq T +t t3) \to (\forall (P: Prop).P))) \to ((pr3 c t t3) \to (\forall (x1: +T).(\forall (x2: T).((eq T t3 (THead (Flat Appl) x1 x2)) \to (\forall (v3: +T).((sn3 c v3) \to (((\forall (u2: T).((pr3 c (THead (Flat Appl) x1 x2) u2) +\to ((((iso (THead (Flat Appl) x1 x2) u2) \to (\forall (P: Prop).P))) \to +(sn3 c (THead (Flat Appl) v3 u2)))))) \to (sn3 c (THead (Flat Appl) v3 (THead +(Flat Appl) x1 x2))))))))))))) H2 (THead (Flat Appl) x x0) H3) in (let H9 +\def (eq_ind T t2 (\lambda (t: T).(\forall (t3: T).((((eq T t t3) \to +(\forall (P: Prop).P))) \to ((pr3 c t t3) \to (sn3 c t3))))) H1 (THead (Flat +Appl) x x0) H3) in (sn3_pr2_intro c (THead (Flat Appl) t0 (THead (Flat Appl) +x x0)) (\lambda (t3: T).(\lambda (H10: (((eq T (THead (Flat Appl) t0 (THead +(Flat Appl) x x0)) t3) \to (\forall (P: Prop).P)))).(\lambda (H11: (pr2 c +(THead (Flat Appl) t0 (THead (Flat Appl) x x0)) t3)).(let H12 \def +(pr2_gen_appl c t0 (THead (Flat Appl) x x0) t3 H11) in (or3_ind (ex3_2 T T +(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) +(\lambda (u2: T).(\lambda (_: T).(pr2 c t0 u2))) (\lambda (_: T).(\lambda +(t4: T).(pr2 c (THead (Flat Appl) x x0) t4)))) (ex4_4 T T T T (\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Flat Appl) +x x0) (THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda +(u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c t0 u2))))) +(\lambda (_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall +(b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t4)))))))) (ex6_6 B T T T +T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq +T (THead (Flat Appl) x x0) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T t3 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c t0 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2)))))))) (sn3 c t3) (\lambda (H13: (ex3_2 T T (\lambda (u2: +T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c t0 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c +(THead (Flat Appl) x x0) t4))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda +(t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: +T).(pr2 c t0 u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c (THead (Flat Appl) +x x0) t4))) (sn3 c t3) (\lambda (x1: T).(\lambda (x2: T).(\lambda (H14: (eq T +t3 (THead (Flat Appl) x1 x2))).(\lambda (H15: (pr2 c t0 x1)).(\lambda (H16: +(pr2 c (THead (Flat Appl) x x0) x2)).(let H17 \def (eq_ind T t3 (\lambda (t: +T).((eq T (THead (Flat Appl) t0 (THead (Flat Appl) x x0)) t) \to (\forall (P: +Prop).P))) H10 (THead (Flat Appl) x1 x2) H14) in (eq_ind_r T (THead (Flat +Appl) x1 x2) (\lambda (t: T).(sn3 c t)) (let H18 \def (pr2_gen_appl c x x0 x2 +H16) in (or3_ind (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T x2 (THead +(Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c x0 t4)))) (ex4_4 T T T T (\lambda +(y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T x0 (THead +(Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t4: T).(eq T x2 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t4)))))))) (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T x0 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x2 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2)))))))) (sn3 c +(THead (Flat Appl) x1 x2)) (\lambda (H19: (ex3_2 T T (\lambda (u2: +T).(\lambda (t4: T).(eq T x2 (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))) (\lambda (_: T).(\lambda (t4: T).(pr2 c x0 +t4))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t4: T).(eq T x2 (THead +(Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))) +(\lambda (_: T).(\lambda (t4: T).(pr2 c x0 t4))) (sn3 c (THead (Flat Appl) x1 +x2)) (\lambda (x3: T).(\lambda (x4: T).(\lambda (H20: (eq T x2 (THead (Flat +Appl) x3 x4))).(\lambda (H21: (pr2 c x x3)).(\lambda (H22: (pr2 c x0 +x4)).(let H23 \def (eq_ind T x2 (\lambda (t: T).((eq T (THead (Flat Appl) t0 +(THead (Flat Appl) x x0)) (THead (Flat Appl) x1 t)) \to (\forall (P: +Prop).P))) H17 (THead (Flat Appl) x3 x4) H20) in (eq_ind_r T (THead (Flat +Appl) x3 x4) (\lambda (t: T).(sn3 c (THead (Flat Appl) x1 t))) (let H_x \def +(term_dec (THead (Flat Appl) x x0) (THead (Flat Appl) x3 x4)) in (let H24 +\def H_x in (or_ind (eq T (THead (Flat Appl) x x0) (THead (Flat Appl) x3 x4)) +((eq T (THead (Flat Appl) x x0) (THead (Flat Appl) x3 x4)) \to (\forall (P: +Prop).P)) (sn3 c (THead (Flat Appl) x1 (THead (Flat Appl) x3 x4))) (\lambda +(H25: (eq T (THead (Flat Appl) x x0) (THead (Flat Appl) x3 x4))).(let H26 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow x | (TLRef _) \Rightarrow x | (THead _ t _) +\Rightarrow t])) (THead (Flat Appl) x x0) (THead (Flat Appl) x3 x4) H25) in +((let H27 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow x0 | (TLRef _) \Rightarrow x0 | (THead _ _ +t) \Rightarrow t])) (THead (Flat Appl) x x0) (THead (Flat Appl) x3 x4) H25) +in (\lambda (H28: (eq T x x3)).(let H29 \def (eq_ind_r T x4 (\lambda (t: +T).((eq T (THead (Flat Appl) t0 (THead (Flat Appl) x x0)) (THead (Flat Appl) +x1 (THead (Flat Appl) x3 t))) \to (\forall (P: Prop).P))) H23 x0 H27) in (let +H30 \def (eq_ind_r T x4 (\lambda (t: T).(pr2 c x0 t)) H22 x0 H27) in (eq_ind +T x0 (\lambda (t: T).(sn3 c (THead (Flat Appl) x1 (THead (Flat Appl) x3 t)))) +(let H31 \def (eq_ind_r T x3 (\lambda (t: T).((eq T (THead (Flat Appl) t0 +(THead (Flat Appl) x x0)) (THead (Flat Appl) x1 (THead (Flat Appl) t x0))) +\to (\forall (P: Prop).P))) H29 x H28) in (let H32 \def (eq_ind_r T x3 +(\lambda (t: T).(pr2 c x t)) H21 x H28) in (eq_ind T x (\lambda (t: T).(sn3 c +(THead (Flat Appl) x1 (THead (Flat Appl) t x0)))) (let H_x0 \def (term_dec t0 +x1) in (let H33 \def H_x0 in (or_ind (eq T t0 x1) ((eq T t0 x1) \to (\forall +(P: Prop).P)) (sn3 c (THead (Flat Appl) x1 (THead (Flat Appl) x x0))) +(\lambda (H34: (eq T t0 x1)).(let H35 \def (eq_ind_r T x1 (\lambda (t: +T).((eq T (THead (Flat Appl) t0 (THead (Flat Appl) x x0)) (THead (Flat Appl) +t (THead (Flat Appl) x x0))) \to (\forall (P: Prop).P))) H31 t0 H34) in (let +H36 \def (eq_ind_r T x1 (\lambda (t: T).(pr2 c t0 t)) H15 t0 H34) in (eq_ind +T t0 (\lambda (t: T).(sn3 c (THead (Flat Appl) t (THead (Flat Appl) x x0)))) +(H35 (refl_equal T (THead (Flat Appl) t0 (THead (Flat Appl) x x0))) (sn3 c +(THead (Flat Appl) t0 (THead (Flat Appl) x x0)))) x1 H34)))) (\lambda (H34: +(((eq T t0 x1) \to (\forall (P: Prop).P)))).(H6 x1 H34 (pr3_pr2 c t0 x1 H15) +(\lambda (u2: T).(\lambda (H35: (pr3 c (THead (Flat Appl) x x0) u2)).(\lambda +(H36: (((iso (THead (Flat Appl) x x0) u2) \to (\forall (P: +Prop).P)))).(sn3_pr3_trans c (THead (Flat Appl) t0 u2) (H7 u2 H35 H36) (THead +(Flat Appl) x1 u2) (pr3_pr2 c (THead (Flat Appl) t0 u2) (THead (Flat Appl) x1 +u2) (pr2_head_1 c t0 x1 H15 (Flat Appl) u2)))))))) H33))) x3 H28))) x4 +H27))))) H26))) (\lambda (H25: (((eq T (THead (Flat Appl) x x0) (THead (Flat +Appl) x3 x4)) \to (\forall (P: Prop).P)))).(H8 (THead (Flat Appl) x3 x4) H25 +(pr3_flat c x x3 (pr3_pr2 c x x3 H21) x0 x4 (pr3_pr2 c x0 x4 H22) Appl) x3 x4 +(refl_equal T (THead (Flat Appl) x3 x4)) x1 (sn3_pr3_trans c t0 (sn3_sing c +t0 H5) x1 (pr3_pr2 c t0 x1 H15)) (\lambda (u2: T).(\lambda (H26: (pr3 c +(THead (Flat Appl) x3 x4) u2)).(\lambda (H27: (((iso (THead (Flat Appl) x3 +x4) u2) \to (\forall (P: Prop).P)))).(sn3_pr3_trans c (THead (Flat Appl) t0 +u2) (H7 u2 (pr3_sing c (THead (Flat Appl) x x4) (THead (Flat Appl) x x0) +(pr2_thin_dx c x0 x4 H22 x Appl) u2 (pr3_sing c (THead (Flat Appl) x3 x4) +(THead (Flat Appl) x x4) (pr2_head_1 c x x3 H21 (Flat Appl) x4) u2 H26)) +(\lambda (H28: (iso (THead (Flat Appl) x x0) u2)).(\lambda (P: Prop).(H27 +(iso_trans (THead (Flat Appl) x3 x4) (THead (Flat Appl) x x0) (iso_head x3 x +x4 x0 (Flat Appl)) u2 H28) P)))) (THead (Flat Appl) x1 u2) (pr3_pr2 c (THead +(Flat Appl) t0 u2) (THead (Flat Appl) x1 u2) (pr2_head_1 c t0 x1 H15 (Flat +Appl) u2)))))))) H24))) x2 H20))))))) H19)) (\lambda (H19: (ex4_4 T T T T +(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T x0 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t4: T).(eq T x2 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t4))))))))).(ex4_4_ind T T T +T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T x0 +(THead (Bind Abst) y1 z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (t4: T).(eq T x2 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (_: T).(pr2 c x u2))))) (\lambda +(_: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: +B).(\forall (u: T).(pr2 (CHead c (Bind b) u) z1 t4))))))) (sn3 c (THead (Flat +Appl) x1 x2)) (\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda +(x6: T).(\lambda (H20: (eq T x0 (THead (Bind Abst) x3 x4))).(\lambda (H21: +(eq T x2 (THead (Bind Abbr) x5 x6))).(\lambda (H22: (pr2 c x x5)).(\lambda +(H23: ((\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x4 +x6))))).(let H24 \def (eq_ind T x2 (\lambda (t: T).((eq T (THead (Flat Appl) +t0 (THead (Flat Appl) x x0)) (THead (Flat Appl) x1 t)) \to (\forall (P: +Prop).P))) H17 (THead (Bind Abbr) x5 x6) H21) in (eq_ind_r T (THead (Bind +Abbr) x5 x6) (\lambda (t: T).(sn3 c (THead (Flat Appl) x1 t))) (let H25 \def +(eq_ind T x0 (\lambda (t: T).((eq T (THead (Flat Appl) t0 (THead (Flat Appl) +x t)) (THead (Flat Appl) x1 (THead (Bind Abbr) x5 x6))) \to (\forall (P: +Prop).P))) H24 (THead (Bind Abst) x3 x4) H20) in (let H26 \def (eq_ind T x0 +(\lambda (t: T).(\forall (t4: T).((((eq T (THead (Flat Appl) x t) t4) \to +(\forall (P: Prop).P))) \to ((pr3 c (THead (Flat Appl) x t) t4) \to (sn3 c +t4))))) H9 (THead (Bind Abst) x3 x4) H20) in (let H27 \def (eq_ind T x0 +(\lambda (t: T).(\forall (t4: T).((((eq T (THead (Flat Appl) x t) t4) \to +(\forall (P: Prop).P))) \to ((pr3 c (THead (Flat Appl) x t) t4) \to (\forall +(x7: T).(\forall (x8: T).((eq T t4 (THead (Flat Appl) x7 x8)) \to (\forall +(v3: T).((sn3 c v3) \to (((\forall (u2: T).((pr3 c (THead (Flat Appl) x7 x8) +u2) \to ((((iso (THead (Flat Appl) x7 x8) u2) \to (\forall (P: Prop).P))) \to +(sn3 c (THead (Flat Appl) v3 u2)))))) \to (sn3 c (THead (Flat Appl) v3 (THead +(Flat Appl) x7 x8))))))))))))) H8 (THead (Bind Abst) x3 x4) H20) in (let H28 +\def (eq_ind T x0 (\lambda (t: T).(\forall (u2: T).((pr3 c (THead (Flat Appl) +x t) u2) \to ((((iso (THead (Flat Appl) x t) u2) \to (\forall (P: Prop).P))) +\to (sn3 c (THead (Flat Appl) t0 u2)))))) H7 (THead (Bind Abst) x3 x4) H20) +in (let H29 \def (eq_ind T x0 (\lambda (t: T).(\forall (t4: T).((((eq T t0 +t4) \to (\forall (P: Prop).P))) \to ((pr3 c t0 t4) \to (((\forall (u2: +T).((pr3 c (THead (Flat Appl) x t) u2) \to ((((iso (THead (Flat Appl) x t) +u2) \to (\forall (P: Prop).P))) \to (sn3 c (THead (Flat Appl) t4 u2)))))) \to +(sn3 c (THead (Flat Appl) t4 (THead (Flat Appl) x t)))))))) H6 (THead (Bind +Abst) x3 x4) H20) in (sn3_pr3_trans c (THead (Flat Appl) t0 (THead (Bind +Abbr) x5 x6)) (H28 (THead (Bind Abbr) x5 x6) (pr3_sing c (THead (Bind Abbr) x +x4) (THead (Flat Appl) x (THead (Bind Abst) x3 x4)) (pr2_free c (THead (Flat +Appl) x (THead (Bind Abst) x3 x4)) (THead (Bind Abbr) x x4) (pr0_beta x3 x x +(pr0_refl x) x4 x4 (pr0_refl x4))) (THead (Bind Abbr) x5 x6) (pr3_head_12 c x +x5 (pr3_pr2 c x x5 H22) (Bind Abbr) x4 x6 (pr3_pr2 (CHead c (Bind Abbr) x5) +x4 x6 (H23 Abbr x5)))) (\lambda (H30: (iso (THead (Flat Appl) x (THead (Bind +Abst) x3 x4)) (THead (Bind Abbr) x5 x6))).(\lambda (P: Prop).(let H31 \def +(match H30 in iso return (\lambda (t: T).(\lambda (t4: T).(\lambda (_: (iso t +t4)).((eq T t (THead (Flat Appl) x (THead (Bind Abst) x3 x4))) \to ((eq T t4 +(THead (Bind Abbr) x5 x6)) \to P))))) with [(iso_sort n1 n2) \Rightarrow +(\lambda (H31: (eq T (TSort n1) (THead (Flat Appl) x (THead (Bind Abst) x3 +x4)))).(\lambda (H32: (eq T (TSort n2) (THead (Bind Abbr) x5 x6))).((let H33 +\def (eq_ind T (TSort n1) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow False])) I (THead (Flat Appl) x (THead (Bind Abst) +x3 x4)) H31) in (False_ind ((eq T (TSort n2) (THead (Bind Abbr) x5 x6)) \to +P) H33)) H32))) | (iso_lref i1 i2) \Rightarrow (\lambda (H31: (eq T (TLRef +i1) (THead (Flat Appl) x (THead (Bind Abst) x3 x4)))).(\lambda (H32: (eq T +(TLRef i2) (THead (Bind Abbr) x5 x6))).((let H33 \def (eq_ind T (TLRef i1) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow +False])) I (THead (Flat Appl) x (THead (Bind Abst) x3 x4)) H31) in (False_ind +((eq T (TLRef i2) (THead (Bind Abbr) x5 x6)) \to P) H33)) H32))) | (iso_head +v4 v5 t4 t5 k) \Rightarrow (\lambda (H31: (eq T (THead k v4 t4) (THead (Flat +Appl) x (THead (Bind Abst) x3 x4)))).(\lambda (H32: (eq T (THead k v5 t5) +(THead (Bind Abbr) x5 x6))).((let H33 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t4 | +(TLRef _) \Rightarrow t4 | (THead _ _ t) \Rightarrow t])) (THead k v4 t4) +(THead (Flat Appl) x (THead (Bind Abst) x3 x4)) H31) in ((let H34 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow v4 | (TLRef _) \Rightarrow v4 | (THead _ t _) +\Rightarrow t])) (THead k v4 t4) (THead (Flat Appl) x (THead (Bind Abst) x3 +x4)) H31) in ((let H35 \def (f_equal T K (\lambda (e: T).(match e in T return +(\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) \Rightarrow k | +(THead k0 _ _) \Rightarrow k0])) (THead k v4 t4) (THead (Flat Appl) x (THead +(Bind Abst) x3 x4)) H31) in (eq_ind K (Flat Appl) (\lambda (k0: K).((eq T v4 +x) \to ((eq T t4 (THead (Bind Abst) x3 x4)) \to ((eq T (THead k0 v5 t5) +(THead (Bind Abbr) x5 x6)) \to P)))) (\lambda (H36: (eq T v4 x)).(eq_ind T x +(\lambda (_: T).((eq T t4 (THead (Bind Abst) x3 x4)) \to ((eq T (THead (Flat +Appl) v5 t5) (THead (Bind Abbr) x5 x6)) \to P))) (\lambda (H37: (eq T t4 +(THead (Bind Abst) x3 x4))).(eq_ind T (THead (Bind Abst) x3 x4) (\lambda (_: +T).((eq T (THead (Flat Appl) v5 t5) (THead (Bind Abbr) x5 x6)) \to P)) +(\lambda (H38: (eq T (THead (Flat Appl) v5 t5) (THead (Bind Abbr) x5 +x6))).(let H39 \def (eq_ind T (THead (Flat Appl) v5 t5) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in +K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind Abbr) x5 x6) H38) in (False_ind P H39))) +t4 (sym_eq T t4 (THead (Bind Abst) x3 x4) H37))) v4 (sym_eq T v4 x H36))) k +(sym_eq K k (Flat Appl) H35))) H34)) H33)) H32)))]) in (H31 (refl_equal T +(THead (Flat Appl) x (THead (Bind Abst) x3 x4))) (refl_equal T (THead (Bind +Abbr) x5 x6))))))) (THead (Flat Appl) x1 (THead (Bind Abbr) x5 x6)) (pr3_pr2 +c (THead (Flat Appl) t0 (THead (Bind Abbr) x5 x6)) (THead (Flat Appl) x1 +(THead (Bind Abbr) x5 x6)) (pr2_head_1 c t0 x1 H15 (Flat Appl) (THead (Bind +Abbr) x5 x6))))))))) x2 H21)))))))))) H19)) (\lambda (H19: (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T x0 +(THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T x2 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))))).(ex6_6_ind +B T T T T T (\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: +B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(_: T).(eq T x0 (THead (Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T +x2 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) +(\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: +T).(\lambda (_: T).(pr2 c x u2))))))) (\lambda (_: B).(\lambda (y1: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 +y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: +T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))) +(sn3 c (THead (Flat Appl) x1 x2)) (\lambda (x3: B).(\lambda (x4: T).(\lambda +(x5: T).(\lambda (x6: T).(\lambda (x7: T).(\lambda (x8: T).(\lambda (H20: +(not (eq B x3 Abst))).(\lambda (H21: (eq T x0 (THead (Bind x3) x4 +x5))).(\lambda (H22: (eq T x2 (THead (Bind x3) x8 (THead (Flat Appl) (lift (S +O) O x7) x6)))).(\lambda (H23: (pr2 c x x7)).(\lambda (H24: (pr2 c x4 +x8)).(\lambda (H25: (pr2 (CHead c (Bind x3) x8) x5 x6)).(let H26 \def (eq_ind +T x2 (\lambda (t: T).((eq T (THead (Flat Appl) t0 (THead (Flat Appl) x x0)) +(THead (Flat Appl) x1 t)) \to (\forall (P: Prop).P))) H17 (THead (Bind x3) x8 +(THead (Flat Appl) (lift (S O) O x7) x6)) H22) in (eq_ind_r T (THead (Bind +x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6)) (\lambda (t: T).(sn3 c +(THead (Flat Appl) x1 t))) (let H27 \def (eq_ind T x0 (\lambda (t: T).((eq T +(THead (Flat Appl) t0 (THead (Flat Appl) x t)) (THead (Flat Appl) x1 (THead +(Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6)))) \to (\forall (P: +Prop).P))) H26 (THead (Bind x3) x4 x5) H21) in (let H28 \def (eq_ind T x0 +(\lambda (t: T).(\forall (t4: T).((((eq T (THead (Flat Appl) x t) t4) \to +(\forall (P: Prop).P))) \to ((pr3 c (THead (Flat Appl) x t) t4) \to (sn3 c +t4))))) H9 (THead (Bind x3) x4 x5) H21) in (let H29 \def (eq_ind T x0 +(\lambda (t: T).(\forall (t4: T).((((eq T (THead (Flat Appl) x t) t4) \to +(\forall (P: Prop).P))) \to ((pr3 c (THead (Flat Appl) x t) t4) \to (\forall +(x9: T).(\forall (x10: T).((eq T t4 (THead (Flat Appl) x9 x10)) \to (\forall +(v3: T).((sn3 c v3) \to (((\forall (u2: T).((pr3 c (THead (Flat Appl) x9 x10) +u2) \to ((((iso (THead (Flat Appl) x9 x10) u2) \to (\forall (P: Prop).P))) +\to (sn3 c (THead (Flat Appl) v3 u2)))))) \to (sn3 c (THead (Flat Appl) v3 +(THead (Flat Appl) x9 x10))))))))))))) H8 (THead (Bind x3) x4 x5) H21) in +(let H30 \def (eq_ind T x0 (\lambda (t: T).(\forall (u2: T).((pr3 c (THead +(Flat Appl) x t) u2) \to ((((iso (THead (Flat Appl) x t) u2) \to (\forall (P: +Prop).P))) \to (sn3 c (THead (Flat Appl) t0 u2)))))) H7 (THead (Bind x3) x4 +x5) H21) in (let H31 \def (eq_ind T x0 (\lambda (t: T).(\forall (t4: +T).((((eq T t0 t4) \to (\forall (P: Prop).P))) \to ((pr3 c t0 t4) \to +(((\forall (u2: T).((pr3 c (THead (Flat Appl) x t) u2) \to ((((iso (THead +(Flat Appl) x t) u2) \to (\forall (P: Prop).P))) \to (sn3 c (THead (Flat +Appl) t4 u2)))))) \to (sn3 c (THead (Flat Appl) t4 (THead (Flat Appl) x +t)))))))) H6 (THead (Bind x3) x4 x5) H21) in (sn3_pr3_trans c (THead (Flat +Appl) t0 (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6))) (H30 +(THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6)) (pr3_sing c +(THead (Bind x3) x4 (THead (Flat Appl) (lift (S O) O x) x5)) (THead (Flat +Appl) x (THead (Bind x3) x4 x5)) (pr2_free c (THead (Flat Appl) x (THead +(Bind x3) x4 x5)) (THead (Bind x3) x4 (THead (Flat Appl) (lift (S O) O x) +x5)) (pr0_upsilon x3 H20 x x (pr0_refl x) x4 x4 (pr0_refl x4) x5 x5 (pr0_refl +x5))) (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6)) +(pr3_head_12 c x4 x8 (pr3_pr2 c x4 x8 H24) (Bind x3) (THead (Flat Appl) (lift +(S O) O x) x5) (THead (Flat Appl) (lift (S O) O x7) x6) (pr3_head_12 (CHead c +(Bind x3) x8) (lift (S O) O x) (lift (S O) O x7) (pr3_lift (CHead c (Bind x3) +x8) c (S O) O (drop_drop (Bind x3) O c c (drop_refl c) x8) x x7 (pr3_pr2 c x +x7 H23)) (Flat Appl) x5 x6 (pr3_pr2 (CHead (CHead c (Bind x3) x8) (Flat Appl) +(lift (S O) O x7)) x5 x6 (pr2_cflat (CHead c (Bind x3) x8) x5 x6 H25 Appl +(lift (S O) O x7)))))) (\lambda (H32: (iso (THead (Flat Appl) x (THead (Bind +x3) x4 x5)) (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) +x6)))).(\lambda (P: Prop).(let H33 \def (match H32 in iso return (\lambda (t: +T).(\lambda (t4: T).(\lambda (_: (iso t t4)).((eq T t (THead (Flat Appl) x +(THead (Bind x3) x4 x5))) \to ((eq T t4 (THead (Bind x3) x8 (THead (Flat +Appl) (lift (S O) O x7) x6))) \to P))))) with [(iso_sort n1 n2) \Rightarrow +(\lambda (H33: (eq T (TSort n1) (THead (Flat Appl) x (THead (Bind x3) x4 +x5)))).(\lambda (H34: (eq T (TSort n2) (THead (Bind x3) x8 (THead (Flat Appl) +(lift (S O) O x7) x6)))).((let H35 \def (eq_ind T (TSort n1) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow False])) I +(THead (Flat Appl) x (THead (Bind x3) x4 x5)) H33) in (False_ind ((eq T +(TSort n2) (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6))) \to +P) H35)) H34))) | (iso_lref i1 i2) \Rightarrow (\lambda (H33: (eq T (TLRef +i1) (THead (Flat Appl) x (THead (Bind x3) x4 x5)))).(\lambda (H34: (eq T +(TLRef i2) (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) +x6)))).((let H35 \def (eq_ind T (TLRef i1) (\lambda (e: T).(match e in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead (Flat Appl) x +(THead (Bind x3) x4 x5)) H33) in (False_ind ((eq T (TLRef i2) (THead (Bind +x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6))) \to P) H35)) H34))) | +(iso_head v4 v5 t4 t5 k) \Rightarrow (\lambda (H33: (eq T (THead k v4 t4) +(THead (Flat Appl) x (THead (Bind x3) x4 x5)))).(\lambda (H34: (eq T (THead k +v5 t5) (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6)))).((let +H35 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t4 | (TLRef _) \Rightarrow t4 | (THead _ _ t) +\Rightarrow t])) (THead k v4 t4) (THead (Flat Appl) x (THead (Bind x3) x4 +x5)) H33) in ((let H36 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow v4 | (TLRef _) \Rightarrow v4 +| (THead _ t _) \Rightarrow t])) (THead k v4 t4) (THead (Flat Appl) x (THead +(Bind x3) x4 x5)) H33) in ((let H37 \def (f_equal T K (\lambda (e: T).(match +e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k | (TLRef _) +\Rightarrow k | (THead k0 _ _) \Rightarrow k0])) (THead k v4 t4) (THead (Flat +Appl) x (THead (Bind x3) x4 x5)) H33) in (eq_ind K (Flat Appl) (\lambda (k0: +K).((eq T v4 x) \to ((eq T t4 (THead (Bind x3) x4 x5)) \to ((eq T (THead k0 +v5 t5) (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6))) \to +P)))) (\lambda (H38: (eq T v4 x)).(eq_ind T x (\lambda (_: T).((eq T t4 +(THead (Bind x3) x4 x5)) \to ((eq T (THead (Flat Appl) v5 t5) (THead (Bind +x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6))) \to P))) (\lambda (H39: (eq +T t4 (THead (Bind x3) x4 x5))).(eq_ind T (THead (Bind x3) x4 x5) (\lambda (_: +T).((eq T (THead (Flat Appl) v5 t5) (THead (Bind x3) x8 (THead (Flat Appl) +(lift (S O) O x7) x6))) \to P)) (\lambda (H40: (eq T (THead (Flat Appl) v5 +t5) (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6)))).(let H41 +\def (eq_ind T (THead (Flat Appl) v5 t5) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k0 _ _) \Rightarrow (match k0 in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6)) +H40) in (False_ind P H41))) t4 (sym_eq T t4 (THead (Bind x3) x4 x5) H39))) v4 +(sym_eq T v4 x H38))) k (sym_eq K k (Flat Appl) H37))) H36)) H35)) H34)))]) +in (H33 (refl_equal T (THead (Flat Appl) x (THead (Bind x3) x4 x5))) +(refl_equal T (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) +x6)))))))) (THead (Flat Appl) x1 (THead (Bind x3) x8 (THead (Flat Appl) (lift +(S O) O x7) x6))) (pr3_pr2 c (THead (Flat Appl) t0 (THead (Bind x3) x8 (THead +(Flat Appl) (lift (S O) O x7) x6))) (THead (Flat Appl) x1 (THead (Bind x3) x8 +(THead (Flat Appl) (lift (S O) O x7) x6))) (pr2_head_1 c t0 x1 H15 (Flat +Appl) (THead (Bind x3) x8 (THead (Flat Appl) (lift (S O) O x7) x6)))))))))) +x2 H22)))))))))))))) H19)) H18)) t3 H14))))))) H13)) (\lambda (H13: (ex4_4 T +T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Flat Appl) x x0) (THead (Bind Abst) y1 z1)))))) (\lambda (_: +T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Bind +Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c t0 u2))))) (\lambda (_: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (t4: T).(\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) +z1 t4))))))))).(ex4_4_ind T T T T (\lambda (y1: T).(\lambda (z1: T).(\lambda +(_: T).(\lambda (_: T).(eq T (THead (Flat Appl) x x0) (THead (Bind Abst) y1 +z1)))))) (\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda (t4: +T).(eq T t3 (THead (Bind Abbr) u2 t4)))))) (\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c t0 u2))))) (\lambda (_: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (t4: T).(\forall (b: B).(\forall +(u: T).(pr2 (CHead c (Bind b) u) z1 t4))))))) (sn3 c t3) (\lambda (x1: +T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (H14: (eq T +(THead (Flat Appl) x x0) (THead (Bind Abst) x1 x2))).(\lambda (H15: (eq T t3 +(THead (Bind Abbr) x3 x4))).(\lambda (_: (pr2 c t0 x3)).(\lambda (_: +((\forall (b: B).(\forall (u: T).(pr2 (CHead c (Bind b) u) x2 x4))))).(let +H18 \def (eq_ind T t3 (\lambda (t: T).((eq T (THead (Flat Appl) t0 (THead +(Flat Appl) x x0)) t) \to (\forall (P: Prop).P))) H10 (THead (Bind Abbr) x3 +x4) H15) in (eq_ind_r T (THead (Bind Abbr) x3 x4) (\lambda (t: T).(sn3 c t)) +(let H19 \def (eq_ind T (THead (Flat Appl) x x0) (\lambda (ee: T).(match ee +in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef +_) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind Abst) x1 x2) H14) in (False_ind (sn3 c (THead (Bind +Abbr) x3 x4)) H19)) t3 H15)))))))))) H13)) (\lambda (H13: (ex6_6 B T T T T T +(\lambda (b: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (_: T).(not (eq B b Abst)))))))) (\lambda (b: B).(\lambda (y1: +T).(\lambda (z1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(eq T +(THead (Flat Appl) x x0) (THead (Bind b) y1 z1)))))))) (\lambda (b: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (z2: T).(\lambda (u2: T).(\lambda +(y2: T).(eq T t3 (THead (Bind b) y2 (THead (Flat Appl) (lift (S O) O u2) +z2))))))))) (\lambda (_: B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: +T).(\lambda (u2: T).(\lambda (_: T).(pr2 c t0 u2))))))) (\lambda (_: +B).(\lambda (y1: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda +(y2: T).(pr2 c y1 y2))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (z1: +T).(\lambda (z2: T).(\lambda (_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) +y2) z1 z2))))))))).(ex6_6_ind B T T T T T (\lambda (b: B).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(not (eq B +b Abst)))))))) (\lambda (b: B).(\lambda (y1: T).(\lambda (z1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(eq T (THead (Flat Appl) x x0) (THead +(Bind b) y1 z1)))))))) (\lambda (b: B).(\lambda (_: T).(\lambda (_: +T).(\lambda (z2: T).(\lambda (u2: T).(\lambda (y2: T).(eq T t3 (THead (Bind +b) y2 (THead (Flat Appl) (lift (S O) O u2) z2))))))))) (\lambda (_: +B).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).(\lambda (u2: T).(\lambda +(_: T).(pr2 c t0 u2))))))) (\lambda (_: B).(\lambda (y1: T).(\lambda (_: +T).(\lambda (_: T).(\lambda (_: T).(\lambda (y2: T).(pr2 c y1 y2))))))) +(\lambda (b: B).(\lambda (_: T).(\lambda (z1: T).(\lambda (z2: T).(\lambda +(_: T).(\lambda (y2: T).(pr2 (CHead c (Bind b) y2) z1 z2))))))) (sn3 c t3) +(\lambda (x1: B).(\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda +(x5: T).(\lambda (x6: T).(\lambda (_: (not (eq B x1 Abst))).(\lambda (H15: +(eq T (THead (Flat Appl) x x0) (THead (Bind x1) x2 x3))).(\lambda (H16: (eq T +t3 (THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) O x5) x4)))).(\lambda +(_: (pr2 c t0 x5)).(\lambda (_: (pr2 c x2 x6)).(\lambda (_: (pr2 (CHead c +(Bind x1) x6) x3 x4)).(let H20 \def (eq_ind T t3 (\lambda (t: T).((eq T +(THead (Flat Appl) t0 (THead (Flat Appl) x x0)) t) \to (\forall (P: +Prop).P))) H10 (THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) O x5) x4)) +H16) in (eq_ind_r T (THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) O x5) +x4)) (\lambda (t: T).(sn3 c t)) (let H21 \def (eq_ind T (THead (Flat Appl) x +x0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind x1) x2 x3) +H15) in (False_ind (sn3 c (THead (Bind x1) x6 (THead (Flat Appl) (lift (S O) +O x5) x4))) H21)) t3 H16)))))))))))))) H13)) H12)))))))))))) v2 H4))))))))) y +H0))))) H))))). + +theorem sn3_appl_beta: + \forall (c: C).(\forall (u: T).(\forall (v: T).(\forall (t: T).((sn3 c +(THead (Flat Appl) u (THead (Bind Abbr) v t))) \to (\forall (w: T).((sn3 c w) +\to (sn3 c (THead (Flat Appl) u (THead (Flat Appl) v (THead (Bind Abst) w +t)))))))))) +\def + \lambda (c: C).(\lambda (u: T).(\lambda (v: T).(\lambda (t: T).(\lambda (H: +(sn3 c (THead (Flat Appl) u (THead (Bind Abbr) v t)))).(\lambda (w: +T).(\lambda (H0: (sn3 c w)).(let H_x \def (sn3_gen_flat Appl c u (THead (Bind +Abbr) v t) H) in (let H1 \def H_x in (and_ind (sn3 c u) (sn3 c (THead (Bind +Abbr) v t)) (sn3 c (THead (Flat Appl) u (THead (Flat Appl) v (THead (Bind +Abst) w t)))) (\lambda (H2: (sn3 c u)).(\lambda (H3: (sn3 c (THead (Bind +Abbr) v t))).(sn3_appl_appl v (THead (Bind Abst) w t) c (sn3_beta c v t H3 w +H0) u H2 (\lambda (u2: T).(\lambda (H4: (pr3 c (THead (Flat Appl) v (THead +(Bind Abst) w t)) u2)).(\lambda (H5: (((iso (THead (Flat Appl) v (THead (Bind +Abst) w t)) u2) \to (\forall (P: Prop).P)))).(sn3_pr3_trans c (THead (Flat +Appl) u (THead (Bind Abbr) v t)) H (THead (Flat Appl) u u2) (pr3_thin_dx c +(THead (Bind Abbr) v t) u2 (pr3_iso_beta v w t c u2 H4 H5) u Appl)))))))) +H1))))))))). + +theorem sn3_appl_appls: + \forall (v1: T).(\forall (t1: T).(\forall (vs: TList).(let u1 \def (THeads +(Flat Appl) (TCons v1 vs) t1) in (\forall (c: C).((sn3 c u1) \to (\forall +(v2: T).((sn3 c v2) \to (((\forall (u2: T).((pr3 c u1 u2) \to ((((iso u1 u2) +\to (\forall (P: Prop).P))) \to (sn3 c (THead (Flat Appl) v2 u2)))))) \to +(sn3 c (THead (Flat Appl) v2 u1)))))))))) +\def + \lambda (v1: T).(\lambda (t1: T).(\lambda (vs: TList).(let u1 \def (THeads +(Flat Appl) (TCons v1 vs) t1) in (\lambda (c: C).(\lambda (H: (sn3 c (THead +(Flat Appl) v1 (THeads (Flat Appl) vs t1)))).(\lambda (v2: T).(\lambda (H0: +(sn3 c v2)).(\lambda (H1: ((\forall (u2: T).((pr3 c (THead (Flat Appl) v1 +(THeads (Flat Appl) vs t1)) u2) \to ((((iso (THead (Flat Appl) v1 (THeads +(Flat Appl) vs t1)) u2) \to (\forall (P: Prop).P))) \to (sn3 c (THead (Flat +Appl) v2 u2))))))).(sn3_appl_appl v1 (THeads (Flat Appl) vs t1) c H v2 H0 +H1))))))))). + +theorem sn3_appls_lref: + \forall (c: C).(\forall (i: nat).((nf2 c (TLRef i)) \to (\forall (us: +TList).((sns3 c us) \to (sn3 c (THeads (Flat Appl) us (TLRef i))))))) +\def + \lambda (c: C).(\lambda (i: nat).(\lambda (H: (nf2 c (TLRef i))).(\lambda +(us: TList).(TList_ind (\lambda (t: TList).((sns3 c t) \to (sn3 c (THeads +(Flat Appl) t (TLRef i))))) (\lambda (_: True).(sn3_nf2 c (TLRef i) H)) +(\lambda (t: T).(\lambda (t0: TList).(TList_ind (\lambda (t1: TList).((((sns3 +c t1) \to (sn3 c (THeads (Flat Appl) t1 (TLRef i))))) \to ((land (sn3 c t) +(sns3 c t1)) \to (sn3 c (THead (Flat Appl) t (THeads (Flat Appl) t1 (TLRef +i))))))) (\lambda (_: (((sns3 c TNil) \to (sn3 c (THeads (Flat Appl) TNil +(TLRef i)))))).(\lambda (H1: (land (sn3 c t) (sns3 c TNil))).(let H2 \def H1 +in (and_ind (sn3 c t) True (sn3 c (THead (Flat Appl) t (THeads (Flat Appl) +TNil (TLRef i)))) (\lambda (H3: (sn3 c t)).(\lambda (_: True).(sn3_appl_lref +c i H t H3))) H2)))) (\lambda (t1: T).(\lambda (t2: TList).(\lambda (_: +(((((sns3 c t2) \to (sn3 c (THeads (Flat Appl) t2 (TLRef i))))) \to ((land +(sn3 c t) (sns3 c t2)) \to (sn3 c (THead (Flat Appl) t (THeads (Flat Appl) t2 +(TLRef i)))))))).(\lambda (H1: (((sns3 c (TCons t1 t2)) \to (sn3 c (THeads +(Flat Appl) (TCons t1 t2) (TLRef i)))))).(\lambda (H2: (land (sn3 c t) (sns3 +c (TCons t1 t2)))).(let H3 \def H2 in (and_ind (sn3 c t) (land (sn3 c t1) +(sns3 c t2)) (sn3 c (THead (Flat Appl) t (THeads (Flat Appl) (TCons t1 t2) +(TLRef i)))) (\lambda (H4: (sn3 c t)).(\lambda (H5: (land (sn3 c t1) (sns3 c +t2))).(and_ind (sn3 c t1) (sns3 c t2) (sn3 c (THead (Flat Appl) t (THeads +(Flat Appl) (TCons t1 t2) (TLRef i)))) (\lambda (H6: (sn3 c t1)).(\lambda +(H7: (sns3 c t2)).(sn3_appl_appls t1 (TLRef i) t2 c (H1 (conj (sn3 c t1) +(sns3 c t2) H6 H7)) t H4 (\lambda (u2: T).(\lambda (H8: (pr3 c (THeads (Flat +Appl) (TCons t1 t2) (TLRef i)) u2)).(\lambda (H9: (((iso (THeads (Flat Appl) +(TCons t1 t2) (TLRef i)) u2) \to (\forall (P: Prop).P)))).(H9 +(nf2_iso_appls_lref c i H (TCons t1 t2) u2 H8) (sn3 c (THead (Flat Appl) t +u2))))))))) H5))) H3))))))) t0))) us)))). + +theorem sn3_appls_cast: + \forall (c: C).(\forall (vs: TList).(\forall (u: T).((sn3 c (THeads (Flat +Appl) vs u)) \to (\forall (t: T).((sn3 c (THeads (Flat Appl) vs t)) \to (sn3 +c (THeads (Flat Appl) vs (THead (Flat Cast) u t)))))))) +\def + \lambda (c: C).(\lambda (vs: TList).(TList_ind (\lambda (t: TList).(\forall +(u: T).((sn3 c (THeads (Flat Appl) t u)) \to (\forall (t0: T).((sn3 c (THeads +(Flat Appl) t t0)) \to (sn3 c (THeads (Flat Appl) t (THead (Flat Cast) u +t0)))))))) (\lambda (u: T).(\lambda (H: (sn3 c u)).(\lambda (t: T).(\lambda +(H0: (sn3 c t)).(sn3_cast c u H t H0))))) (\lambda (t: T).(\lambda (t0: +TList).(TList_ind (\lambda (t1: TList).(((\forall (u: T).((sn3 c (THeads +(Flat Appl) t1 u)) \to (\forall (t2: T).((sn3 c (THeads (Flat Appl) t1 t2)) +\to (sn3 c (THeads (Flat Appl) t1 (THead (Flat Cast) u t2)))))))) \to +(\forall (u: T).((sn3 c (THead (Flat Appl) t (THeads (Flat Appl) t1 u))) \to +(\forall (t2: T).((sn3 c (THead (Flat Appl) t (THeads (Flat Appl) t1 t2))) +\to (sn3 c (THead (Flat Appl) t (THeads (Flat Appl) t1 (THead (Flat Cast) u +t2)))))))))) (\lambda (_: ((\forall (u: T).((sn3 c (THeads (Flat Appl) TNil +u)) \to (\forall (t1: T).((sn3 c (THeads (Flat Appl) TNil t1)) \to (sn3 c +(THeads (Flat Appl) TNil (THead (Flat Cast) u t1))))))))).(\lambda (u: +T).(\lambda (H0: (sn3 c (THead (Flat Appl) t (THeads (Flat Appl) TNil +u)))).(\lambda (t1: T).(\lambda (H1: (sn3 c (THead (Flat Appl) t (THeads +(Flat Appl) TNil t1)))).(sn3_appl_cast c t u H0 t1 H1)))))) (\lambda (t1: +T).(\lambda (t2: TList).(\lambda (_: ((((\forall (u: T).((sn3 c (THeads (Flat +Appl) t2 u)) \to (\forall (t3: T).((sn3 c (THeads (Flat Appl) t2 t3)) \to +(sn3 c (THeads (Flat Appl) t2 (THead (Flat Cast) u t3)))))))) \to (\forall +(u: T).((sn3 c (THead (Flat Appl) t (THeads (Flat Appl) t2 u))) \to (\forall +(t3: T).((sn3 c (THead (Flat Appl) t (THeads (Flat Appl) t2 t3))) \to (sn3 c +(THead (Flat Appl) t (THeads (Flat Appl) t2 (THead (Flat Cast) u +t3))))))))))).(\lambda (H0: ((\forall (u: T).((sn3 c (THeads (Flat Appl) +(TCons t1 t2) u)) \to (\forall (t3: T).((sn3 c (THeads (Flat Appl) (TCons t1 +t2) t3)) \to (sn3 c (THeads (Flat Appl) (TCons t1 t2) (THead (Flat Cast) u +t3))))))))).(\lambda (u: T).(\lambda (H1: (sn3 c (THead (Flat Appl) t (THeads +(Flat Appl) (TCons t1 t2) u)))).(\lambda (t3: T).(\lambda (H2: (sn3 c (THead +(Flat Appl) t (THeads (Flat Appl) (TCons t1 t2) t3)))).(let H_x \def +(sn3_gen_flat Appl c t (THeads (Flat Appl) (TCons t1 t2) t3) H2) in (let H3 +\def H_x in (and_ind (sn3 c t) (sn3 c (THeads (Flat Appl) (TCons t1 t2) t3)) +(sn3 c (THead (Flat Appl) t (THeads (Flat Appl) (TCons t1 t2) (THead (Flat +Cast) u t3)))) (\lambda (_: (sn3 c t)).(\lambda (H5: (sn3 c (THeads (Flat +Appl) (TCons t1 t2) t3))).(let H6 \def H5 in (let H_x0 \def (sn3_gen_flat +Appl c t (THeads (Flat Appl) (TCons t1 t2) u) H1) in (let H7 \def H_x0 in +(and_ind (sn3 c t) (sn3 c (THeads (Flat Appl) (TCons t1 t2) u)) (sn3 c (THead +(Flat Appl) t (THeads (Flat Appl) (TCons t1 t2) (THead (Flat Cast) u t3)))) +(\lambda (H8: (sn3 c t)).(\lambda (H9: (sn3 c (THeads (Flat Appl) (TCons t1 +t2) u))).(let H10 \def H9 in (sn3_appl_appls t1 (THead (Flat Cast) u t3) t2 c +(H0 u H10 t3 H6) t H8 (\lambda (u2: T).(\lambda (H11: (pr3 c (THeads (Flat +Appl) (TCons t1 t2) (THead (Flat Cast) u t3)) u2)).(\lambda (H12: (((iso +(THeads (Flat Appl) (TCons t1 t2) (THead (Flat Cast) u t3)) u2) \to (\forall +(P: Prop).P)))).(sn3_pr3_trans c (THead (Flat Appl) t (THeads (Flat Appl) +(TCons t1 t2) t3)) H2 (THead (Flat Appl) t u2) (pr3_thin_dx c (THeads (Flat +Appl) (TCons t1 t2) t3) u2 (pr3_iso_appls_cast c u t3 (TCons t1 t2) u2 H11 +H12) t Appl))))))))) H7)))))) H3))))))))))) t0))) vs)). + +theorem sn3_appls_bind: + \forall (b: B).((not (eq B b Abst)) \to (\forall (c: C).(\forall (u: +T).((sn3 c u) \to (\forall (vs: TList).(\forall (t: T).((sn3 (CHead c (Bind +b) u) (THeads (Flat Appl) (lifts (S O) O vs) t)) \to (sn3 c (THeads (Flat +Appl) vs (THead (Bind b) u t)))))))))) +\def + \lambda (b: B).(\lambda (H: (not (eq B b Abst))).(\lambda (c: C).(\lambda +(u: T).(\lambda (H0: (sn3 c u)).(\lambda (vs: TList).(TList_ind (\lambda (t: +TList).(\forall (t0: T).((sn3 (CHead c (Bind b) u) (THeads (Flat Appl) (lifts +(S O) O t) t0)) \to (sn3 c (THeads (Flat Appl) t (THead (Bind b) u t0)))))) +(\lambda (t: T).(\lambda (H1: (sn3 (CHead c (Bind b) u) t)).(sn3_bind b c u +H0 t H1))) (\lambda (v: T).(\lambda (vs0: TList).(TList_ind (\lambda (t: +TList).(((\forall (t0: T).((sn3 (CHead c (Bind b) u) (THeads (Flat Appl) +(lifts (S O) O t) t0)) \to (sn3 c (THeads (Flat Appl) t (THead (Bind b) u +t0)))))) \to (\forall (t0: T).((sn3 (CHead c (Bind b) u) (THead (Flat Appl) +(lift (S O) O v) (THeads (Flat Appl) (lifts (S O) O t) t0))) \to (sn3 c +(THead (Flat Appl) v (THeads (Flat Appl) t (THead (Bind b) u t0)))))))) +(\lambda (_: ((\forall (t: T).((sn3 (CHead c (Bind b) u) (THeads (Flat Appl) +(lifts (S O) O TNil) t)) \to (sn3 c (THeads (Flat Appl) TNil (THead (Bind b) +u t))))))).(\lambda (t: T).(\lambda (H2: (sn3 (CHead c (Bind b) u) (THead +(Flat Appl) (lift (S O) O v) (THeads (Flat Appl) (lifts (S O) O TNil) +t)))).(sn3_appl_bind b H c u H0 t v H2)))) (\lambda (t: T).(\lambda (t0: +TList).(\lambda (_: ((((\forall (t1: T).((sn3 (CHead c (Bind b) u) (THeads +(Flat Appl) (lifts (S O) O t0) t1)) \to (sn3 c (THeads (Flat Appl) t0 (THead +(Bind b) u t1)))))) \to (\forall (t1: T).((sn3 (CHead c (Bind b) u) (THead +(Flat Appl) (lift (S O) O v) (THeads (Flat Appl) (lifts (S O) O t0) t1))) \to +(sn3 c (THead (Flat Appl) v (THeads (Flat Appl) t0 (THead (Bind b) u +t1))))))))).(\lambda (H2: ((\forall (t1: T).((sn3 (CHead c (Bind b) u) +(THeads (Flat Appl) (lifts (S O) O (TCons t t0)) t1)) \to (sn3 c (THeads +(Flat Appl) (TCons t t0) (THead (Bind b) u t1))))))).(\lambda (t1: +T).(\lambda (H3: (sn3 (CHead c (Bind b) u) (THead (Flat Appl) (lift (S O) O +v) (THeads (Flat Appl) (lifts (S O) O (TCons t t0)) t1)))).(let H_x \def +(sn3_gen_flat Appl (CHead c (Bind b) u) (lift (S O) O v) (THeads (Flat Appl) +(lifts (S O) O (TCons t t0)) t1) H3) in (let H4 \def H_x in (and_ind (sn3 +(CHead c (Bind b) u) (lift (S O) O v)) (sn3 (CHead c (Bind b) u) (THeads +(Flat Appl) (lifts (S O) O (TCons t t0)) t1)) (sn3 c (THead (Flat Appl) v +(THeads (Flat Appl) (TCons t t0) (THead (Bind b) u t1)))) (\lambda (H5: (sn3 +(CHead c (Bind b) u) (lift (S O) O v))).(\lambda (H6: (sn3 (CHead c (Bind b) +u) (THeads (Flat Appl) (lifts (S O) O (TCons t t0)) t1))).(let H_y \def +(sn3_gen_lift (CHead c (Bind b) u) v (S O) O H5 c) in (sn3_appl_appls t +(THead (Bind b) u t1) t0 c (H2 t1 H6) v (H_y (drop_drop (Bind b) O c c +(drop_refl c) u)) (\lambda (u2: T).(\lambda (H7: (pr3 c (THeads (Flat Appl) +(TCons t t0) (THead (Bind b) u t1)) u2)).(\lambda (H8: (((iso (THeads (Flat +Appl) (TCons t t0) (THead (Bind b) u t1)) u2) \to (\forall (P: +Prop).P)))).(let H9 \def (pr3_iso_appls_bind b H (TCons t t0) u t1 c u2 H7 +H8) in (sn3_pr3_trans c (THead (Flat Appl) v (THead (Bind b) u (THeads (Flat +Appl) (lifts (S O) O (TCons t t0)) t1))) (sn3_appl_bind b H c u H0 (THeads +(Flat Appl) (lifts (S O) O (TCons t t0)) t1) v H3) (THead (Flat Appl) v u2) +(pr3_flat c v v (pr3_refl c v) (THead (Bind b) u (THeads (Flat Appl) (lifts +(S O) O (TCons t t0)) t1)) u2 H9 Appl)))))))))) H4))))))))) vs0))) vs)))))). + +theorem sn3_appls_beta: + \forall (c: C).(\forall (v: T).(\forall (t: T).(\forall (us: TList).((sn3 c +(THeads (Flat Appl) us (THead (Bind Abbr) v t))) \to (\forall (w: T).((sn3 c +w) \to (sn3 c (THeads (Flat Appl) us (THead (Flat Appl) v (THead (Bind Abst) +w t)))))))))) +\def + \lambda (c: C).(\lambda (v: T).(\lambda (t: T).(\lambda (us: +TList).(TList_ind (\lambda (t0: TList).((sn3 c (THeads (Flat Appl) t0 (THead +(Bind Abbr) v t))) \to (\forall (w: T).((sn3 c w) \to (sn3 c (THeads (Flat +Appl) t0 (THead (Flat Appl) v (THead (Bind Abst) w t)))))))) (\lambda (H: +(sn3 c (THead (Bind Abbr) v t))).(\lambda (w: T).(\lambda (H0: (sn3 c +w)).(sn3_beta c v t H w H0)))) (\lambda (u: T).(\lambda (us0: +TList).(TList_ind (\lambda (t0: TList).((((sn3 c (THeads (Flat Appl) t0 +(THead (Bind Abbr) v t))) \to (\forall (w: T).((sn3 c w) \to (sn3 c (THeads +(Flat Appl) t0 (THead (Flat Appl) v (THead (Bind Abst) w t)))))))) \to ((sn3 +c (THead (Flat Appl) u (THeads (Flat Appl) t0 (THead (Bind Abbr) v t)))) \to +(\forall (w: T).((sn3 c w) \to (sn3 c (THead (Flat Appl) u (THeads (Flat +Appl) t0 (THead (Flat Appl) v (THead (Bind Abst) w t)))))))))) (\lambda (_: +(((sn3 c (THeads (Flat Appl) TNil (THead (Bind Abbr) v t))) \to (\forall (w: +T).((sn3 c w) \to (sn3 c (THeads (Flat Appl) TNil (THead (Flat Appl) v (THead +(Bind Abst) w t))))))))).(\lambda (H0: (sn3 c (THead (Flat Appl) u (THeads +(Flat Appl) TNil (THead (Bind Abbr) v t))))).(\lambda (w: T).(\lambda (H1: +(sn3 c w)).(sn3_appl_beta c u v t H0 w H1))))) (\lambda (t0: T).(\lambda (t1: +TList).(\lambda (_: (((((sn3 c (THeads (Flat Appl) t1 (THead (Bind Abbr) v +t))) \to (\forall (w: T).((sn3 c w) \to (sn3 c (THeads (Flat Appl) t1 (THead +(Flat Appl) v (THead (Bind Abst) w t)))))))) \to ((sn3 c (THead (Flat Appl) u +(THeads (Flat Appl) t1 (THead (Bind Abbr) v t)))) \to (\forall (w: T).((sn3 c +w) \to (sn3 c (THead (Flat Appl) u (THeads (Flat Appl) t1 (THead (Flat Appl) +v (THead (Bind Abst) w t))))))))))).(\lambda (H0: (((sn3 c (THeads (Flat +Appl) (TCons t0 t1) (THead (Bind Abbr) v t))) \to (\forall (w: T).((sn3 c w) +\to (sn3 c (THeads (Flat Appl) (TCons t0 t1) (THead (Flat Appl) v (THead +(Bind Abst) w t))))))))).(\lambda (H1: (sn3 c (THead (Flat Appl) u (THeads +(Flat Appl) (TCons t0 t1) (THead (Bind Abbr) v t))))).(\lambda (w: +T).(\lambda (H2: (sn3 c w)).(let H_x \def (sn3_gen_flat Appl c u (THeads +(Flat Appl) (TCons t0 t1) (THead (Bind Abbr) v t)) H1) in (let H3 \def H_x in +(and_ind (sn3 c u) (sn3 c (THeads (Flat Appl) (TCons t0 t1) (THead (Bind +Abbr) v t))) (sn3 c (THead (Flat Appl) u (THeads (Flat Appl) (TCons t0 t1) +(THead (Flat Appl) v (THead (Bind Abst) w t))))) (\lambda (H4: (sn3 c +u)).(\lambda (H5: (sn3 c (THeads (Flat Appl) (TCons t0 t1) (THead (Bind Abbr) +v t)))).(sn3_appl_appls t0 (THead (Flat Appl) v (THead (Bind Abst) w t)) t1 c +(H0 H5 w H2) u H4 (\lambda (u2: T).(\lambda (H6: (pr3 c (THeads (Flat Appl) +(TCons t0 t1) (THead (Flat Appl) v (THead (Bind Abst) w t))) u2)).(\lambda +(H7: (((iso (THeads (Flat Appl) (TCons t0 t1) (THead (Flat Appl) v (THead +(Bind Abst) w t))) u2) \to (\forall (P: Prop).P)))).(let H8 \def +(pr3_iso_appls_beta (TCons t0 t1) v w t c u2 H6 H7) in (sn3_pr3_trans c +(THead (Flat Appl) u (THeads (Flat Appl) (TCons t0 t1) (THead (Bind Abbr) v +t))) H1 (THead (Flat Appl) u u2) (pr3_thin_dx c (THeads (Flat Appl) (TCons t0 +t1) (THead (Bind Abbr) v t)) u2 H8 u Appl))))))))) H3)))))))))) us0))) us)))). + +theorem sn3_lift: + \forall (d: C).(\forall (t: T).((sn3 d t) \to (\forall (c: C).(\forall (h: +nat).(\forall (i: nat).((drop h i c d) \to (sn3 c (lift h i t)))))))) +\def + \lambda (d: C).(\lambda (t: T).(\lambda (H: (sn3 d t)).(sn3_ind d (\lambda +(t0: T).(\forall (c: C).(\forall (h: nat).(\forall (i: nat).((drop h i c d) +\to (sn3 c (lift h i t0))))))) (\lambda (t1: T).(\lambda (_: ((\forall (t2: +T).((((eq T t1 t2) \to (\forall (P: Prop).P))) \to ((pr3 d t1 t2) \to (sn3 d +t2)))))).(\lambda (H1: ((\forall (t2: T).((((eq T t1 t2) \to (\forall (P: +Prop).P))) \to ((pr3 d t1 t2) \to (\forall (c: C).(\forall (h: nat).(\forall +(i: nat).((drop h i c d) \to (sn3 c (lift h i t2))))))))))).(\lambda (c: +C).(\lambda (h: nat).(\lambda (i: nat).(\lambda (H2: (drop h i c +d)).(sn3_pr2_intro c (lift h i t1) (\lambda (t2: T).(\lambda (H3: (((eq T +(lift h i t1) t2) \to (\forall (P: Prop).P)))).(\lambda (H4: (pr2 c (lift h i +t1) t2)).(let H5 \def (pr2_gen_lift c t1 t2 h i H4 d H2) in (ex2_ind T +(\lambda (t3: T).(eq T t2 (lift h i t3))) (\lambda (t3: T).(pr2 d t1 t3)) +(sn3 c t2) (\lambda (x: T).(\lambda (H6: (eq T t2 (lift h i x))).(\lambda +(H7: (pr2 d t1 x)).(let H8 \def (eq_ind T t2 (\lambda (t0: T).((eq T (lift h +i t1) t0) \to (\forall (P: Prop).P))) H3 (lift h i x) H6) in (eq_ind_r T +(lift h i x) (\lambda (t0: T).(sn3 c t0)) (H1 x (\lambda (H9: (eq T t1 +x)).(\lambda (P: Prop).(let H10 \def (eq_ind_r T x (\lambda (t0: T).((eq T +(lift h i t1) (lift h i t0)) \to (\forall (P0: Prop).P0))) H8 t1 H9) in (let +H11 \def (eq_ind_r T x (\lambda (t0: T).(pr2 d t1 t0)) H7 t1 H9) in (H10 +(refl_equal T (lift h i t1)) P))))) (pr3_pr2 d t1 x H7) c h i H2) t2 H6))))) +H5))))))))))))) t H))). + +theorem sn3_abbr: + \forall (c: C).(\forall (d: C).(\forall (v: T).(\forall (i: nat).((getl i c +(CHead d (Bind Abbr) v)) \to ((sn3 d v) \to (sn3 c (TLRef i))))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead d (Bind Abbr) v))).(\lambda (H0: (sn3 d +v)).(sn3_pr2_intro c (TLRef i) (\lambda (t2: T).(\lambda (H1: (((eq T (TLRef +i) t2) \to (\forall (P: Prop).P)))).(\lambda (H2: (pr2 c (TLRef i) t2)).(let +H3 \def (pr2_gen_lref c t2 i H2) in (or_ind (eq T t2 (TLRef i)) (ex2_2 C T +(\lambda (d0: C).(\lambda (u: T).(getl i c (CHead d0 (Bind Abbr) u)))) +(\lambda (_: C).(\lambda (u: T).(eq T t2 (lift (S i) O u))))) (sn3 c t2) +(\lambda (H4: (eq T t2 (TLRef i))).(let H5 \def (eq_ind T t2 (\lambda (t: +T).((eq T (TLRef i) t) \to (\forall (P: Prop).P))) H1 (TLRef i) H4) in +(eq_ind_r T (TLRef i) (\lambda (t: T).(sn3 c t)) (H5 (refl_equal T (TLRef i)) +(sn3 c (TLRef i))) t2 H4))) (\lambda (H4: (ex2_2 C T (\lambda (d0: +C).(\lambda (u: T).(getl i c (CHead d0 (Bind Abbr) u)))) (\lambda (_: +C).(\lambda (u: T).(eq T t2 (lift (S i) O u)))))).(ex2_2_ind C T (\lambda +(d0: C).(\lambda (u: T).(getl i c (CHead d0 (Bind Abbr) u)))) (\lambda (_: +C).(\lambda (u: T).(eq T t2 (lift (S i) O u)))) (sn3 c t2) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (H5: (getl i c (CHead x0 (Bind Abbr) +x1))).(\lambda (H6: (eq T t2 (lift (S i) O x1))).(let H7 \def (eq_ind T t2 +(\lambda (t: T).((eq T (TLRef i) t) \to (\forall (P: Prop).P))) H1 (lift (S +i) O x1) H6) in (eq_ind_r T (lift (S i) O x1) (\lambda (t: T).(sn3 c t)) (let +H8 \def (eq_ind C (CHead d (Bind Abbr) v) (\lambda (c0: C).(getl i c c0)) H +(CHead x0 (Bind Abbr) x1) (getl_mono c (CHead d (Bind Abbr) v) i H (CHead x0 +(Bind Abbr) x1) H5)) in (let H9 \def (f_equal C C (\lambda (e: C).(match e in +C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) +\Rightarrow c0])) (CHead d (Bind Abbr) v) (CHead x0 (Bind Abbr) x1) +(getl_mono c (CHead d (Bind Abbr) v) i H (CHead x0 (Bind Abbr) x1) H5)) in +((let H10 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: +C).T) with [(CSort _) \Rightarrow v | (CHead _ _ t) \Rightarrow t])) (CHead d +(Bind Abbr) v) (CHead x0 (Bind Abbr) x1) (getl_mono c (CHead d (Bind Abbr) v) +i H (CHead x0 (Bind Abbr) x1) H5)) in (\lambda (H11: (eq C d x0)).(let H12 +\def (eq_ind_r T x1 (\lambda (t: T).(getl i c (CHead x0 (Bind Abbr) t))) H8 v +H10) in (eq_ind T v (\lambda (t: T).(sn3 c (lift (S i) O t))) (let H13 \def +(eq_ind_r C x0 (\lambda (c0: C).(getl i c (CHead c0 (Bind Abbr) v))) H12 d +H11) in (sn3_lift d v H0 c (S i) O (getl_drop Abbr c d v i H13))) x1 H10)))) +H9))) t2 H6)))))) H4)) H3))))))))))). + +theorem sn3_appls_abbr: + \forall (c: C).(\forall (d: C).(\forall (w: T).(\forall (i: nat).((getl i c +(CHead d (Bind Abbr) w)) \to (\forall (vs: TList).((sn3 c (THeads (Flat Appl) +vs (lift (S i) O w))) \to (sn3 c (THeads (Flat Appl) vs (TLRef i))))))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (w: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead d (Bind Abbr) w))).(\lambda (vs: TList).(TList_ind +(\lambda (t: TList).((sn3 c (THeads (Flat Appl) t (lift (S i) O w))) \to (sn3 +c (THeads (Flat Appl) t (TLRef i))))) (\lambda (H0: (sn3 c (lift (S i) O +w))).(let H_y \def (sn3_gen_lift c w (S i) O H0 d (getl_drop Abbr c d w i H)) +in (sn3_abbr c d w i H H_y))) (\lambda (v: T).(\lambda (vs0: +TList).(TList_ind (\lambda (t: TList).((((sn3 c (THeads (Flat Appl) t (lift +(S i) O w))) \to (sn3 c (THeads (Flat Appl) t (TLRef i))))) \to ((sn3 c +(THead (Flat Appl) v (THeads (Flat Appl) t (lift (S i) O w)))) \to (sn3 c +(THead (Flat Appl) v (THeads (Flat Appl) t (TLRef i))))))) (\lambda (_: +(((sn3 c (THeads (Flat Appl) TNil (lift (S i) O w))) \to (sn3 c (THeads (Flat +Appl) TNil (TLRef i)))))).(\lambda (H1: (sn3 c (THead (Flat Appl) v (THeads +(Flat Appl) TNil (lift (S i) O w))))).(sn3_appl_abbr c d w i H v H1))) +(\lambda (t: T).(\lambda (t0: TList).(\lambda (_: (((((sn3 c (THeads (Flat +Appl) t0 (lift (S i) O w))) \to (sn3 c (THeads (Flat Appl) t0 (TLRef i))))) +\to ((sn3 c (THead (Flat Appl) v (THeads (Flat Appl) t0 (lift (S i) O w)))) +\to (sn3 c (THead (Flat Appl) v (THeads (Flat Appl) t0 (TLRef +i)))))))).(\lambda (H1: (((sn3 c (THeads (Flat Appl) (TCons t t0) (lift (S i) +O w))) \to (sn3 c (THeads (Flat Appl) (TCons t t0) (TLRef i)))))).(\lambda +(H2: (sn3 c (THead (Flat Appl) v (THeads (Flat Appl) (TCons t t0) (lift (S i) +O w))))).(let H_x \def (sn3_gen_flat Appl c v (THeads (Flat Appl) (TCons t +t0) (lift (S i) O w)) H2) in (let H3 \def H_x in (and_ind (sn3 c v) (sn3 c +(THeads (Flat Appl) (TCons t t0) (lift (S i) O w))) (sn3 c (THead (Flat Appl) +v (THeads (Flat Appl) (TCons t t0) (TLRef i)))) (\lambda (H4: (sn3 c +v)).(\lambda (H5: (sn3 c (THeads (Flat Appl) (TCons t t0) (lift (S i) O +w)))).(sn3_appl_appls t (TLRef i) t0 c (H1 H5) v H4 (\lambda (u2: T).(\lambda +(H6: (pr3 c (THeads (Flat Appl) (TCons t t0) (TLRef i)) u2)).(\lambda (H7: +(((iso (THeads (Flat Appl) (TCons t t0) (TLRef i)) u2) \to (\forall (P: +Prop).P)))).(sn3_pr3_trans c (THead (Flat Appl) v (THeads (Flat Appl) (TCons +t t0) (lift (S i) O w))) H2 (THead (Flat Appl) v u2) (pr3_thin_dx c (THeads +(Flat Appl) (TCons t t0) (lift (S i) O w)) u2 (pr3_iso_appls_abbr c d w i H +(TCons t t0) u2 H6 H7) v Appl)))))))) H3)))))))) vs0))) vs)))))). + +theorem sns3_lifts: + \forall (c: C).(\forall (d: C).(\forall (h: nat).(\forall (i: nat).((drop h +i c d) \to (\forall (ts: TList).((sns3 d ts) \to (sns3 c (lifts h i ts)))))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (h: nat).(\lambda (i: nat).(\lambda +(H: (drop h i c d)).(\lambda (ts: TList).(TList_ind (\lambda (t: +TList).((sns3 d t) \to (sns3 c (lifts h i t)))) (\lambda (H0: True).H0) +(\lambda (t: T).(\lambda (t0: TList).(\lambda (H0: (((sns3 d t0) \to (sns3 c +(lifts h i t0))))).(\lambda (H1: (land (sn3 d t) (sns3 d t0))).(let H2 \def +H1 in (and_ind (sn3 d t) (sns3 d t0) (land (sn3 c (lift h i t)) (sns3 c +(lifts h i t0))) (\lambda (H3: (sn3 d t)).(\lambda (H4: (sns3 d t0)).(conj +(sn3 c (lift h i t)) (sns3 c (lifts h i t0)) (sn3_lift d t H3 c h i H) (H0 +H4)))) H2)))))) ts)))))). + +theorem sn3_gen_def: + \forall (c: C).(\forall (d: C).(\forall (v: T).(\forall (i: nat).((getl i c +(CHead d (Bind Abbr) v)) \to ((sn3 c (TLRef i)) \to (sn3 d v)))))) +\def + \lambda (c: C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: nat).(\lambda +(H: (getl i c (CHead d (Bind Abbr) v))).(\lambda (H0: (sn3 c (TLRef +i))).(sn3_gen_lift c v (S i) O (sn3_pr3_trans c (TLRef i) H0 (lift (S i) O v) +(pr3_pr2 c (TLRef i) (lift (S i) O v) (pr2_delta c d v i H (TLRef i) (TLRef +i) (pr0_refl (TLRef i)) (lift (S i) O v) (subst0_lref v i)))) d (getl_drop +Abbr c d v i H))))))). + +theorem sn3_cdelta: + \forall (v: T).(\forall (t: T).(\forall (i: nat).(((\forall (w: T).(ex T +(\lambda (u: T).(subst0 i w t u))))) \to (\forall (c: C).(\forall (d: +C).((getl i c (CHead d (Bind Abbr) v)) \to ((sn3 c t) \to (sn3 d v)))))))) +\def + \lambda (v: T).(\lambda (t: T).(\lambda (i: nat).(\lambda (H: ((\forall (w: +T).(ex T (\lambda (u: T).(subst0 i w t u)))))).(let H_x \def (H v) in (let H0 +\def H_x in (ex_ind T (\lambda (u: T).(subst0 i v t u)) (\forall (c: +C).(\forall (d: C).((getl i c (CHead d (Bind Abbr) v)) \to ((sn3 c t) \to +(sn3 d v))))) (\lambda (x: T).(\lambda (H1: (subst0 i v t x)).(subst0_ind +(\lambda (n: nat).(\lambda (t0: T).(\lambda (t1: T).(\lambda (_: T).(\forall +(c: C).(\forall (d: C).((getl n c (CHead d (Bind Abbr) t0)) \to ((sn3 c t1) +\to (sn3 d t0))))))))) (\lambda (v0: T).(\lambda (i0: nat).(\lambda (c: +C).(\lambda (d: C).(\lambda (H2: (getl i0 c (CHead d (Bind Abbr) +v0))).(\lambda (H3: (sn3 c (TLRef i0))).(sn3_gen_def c d v0 i0 H2 H3))))))) +(\lambda (v0: T).(\lambda (u2: T).(\lambda (u1: T).(\lambda (i0: +nat).(\lambda (_: (subst0 i0 v0 u1 u2)).(\lambda (H3: ((\forall (c: +C).(\forall (d: C).((getl i0 c (CHead d (Bind Abbr) v0)) \to ((sn3 c u1) \to +(sn3 d v0))))))).(\lambda (t0: T).(\lambda (k: K).(\lambda (c: C).(\lambda +(d: C).(\lambda (H4: (getl i0 c (CHead d (Bind Abbr) v0))).(\lambda (H5: (sn3 +c (THead k u1 t0))).(let H_y \def (sn3_gen_head k c u1 t0 H5) in (H3 c d H4 +H_y)))))))))))))) (\lambda (k: K).(\lambda (v0: T).(\lambda (t2: T).(\lambda +(t1: T).(\lambda (i0: nat).(\lambda (H2: (subst0 (s k i0) v0 t1 t2)).(\lambda +(H3: ((\forall (c: C).(\forall (d: C).((getl (s k i0) c (CHead d (Bind Abbr) +v0)) \to ((sn3 c t1) \to (sn3 d v0))))))).(\lambda (u: T).(\lambda (c: +C).(\lambda (d: C).(\lambda (H4: (getl i0 c (CHead d (Bind Abbr) +v0))).(\lambda (H5: (sn3 c (THead k u t1))).(K_ind (\lambda (k0: K).((subst0 +(s k0 i0) v0 t1 t2) \to (((\forall (c0: C).(\forall (d0: C).((getl (s k0 i0) +c0 (CHead d0 (Bind Abbr) v0)) \to ((sn3 c0 t1) \to (sn3 d0 v0)))))) \to ((sn3 +c (THead k0 u t1)) \to (sn3 d v0))))) (\lambda (b: B).(\lambda (_: (subst0 (s +(Bind b) i0) v0 t1 t2)).(\lambda (H7: ((\forall (c0: C).(\forall (d0: +C).((getl (s (Bind b) i0) c0 (CHead d0 (Bind Abbr) v0)) \to ((sn3 c0 t1) \to +(sn3 d0 v0))))))).(\lambda (H8: (sn3 c (THead (Bind b) u t1))).(let H_x0 \def +(sn3_gen_bind b c u t1 H8) in (let H9 \def H_x0 in (and_ind (sn3 c u) (sn3 +(CHead c (Bind b) u) t1) (sn3 d v0) (\lambda (_: (sn3 c u)).(\lambda (H11: +(sn3 (CHead c (Bind b) u) t1)).(H7 (CHead c (Bind b) u) d (getl_clear_bind b +(CHead c (Bind b) u) c u (clear_bind b c u) (CHead d (Bind Abbr) v0) i0 H4) +H11))) H9))))))) (\lambda (f: F).(\lambda (_: (subst0 (s (Flat f) i0) v0 t1 +t2)).(\lambda (H7: ((\forall (c0: C).(\forall (d0: C).((getl (s (Flat f) i0) +c0 (CHead d0 (Bind Abbr) v0)) \to ((sn3 c0 t1) \to (sn3 d0 v0))))))).(\lambda +(H8: (sn3 c (THead (Flat f) u t1))).(let H_x0 \def (sn3_gen_flat f c u t1 H8) +in (let H9 \def H_x0 in (and_ind (sn3 c u) (sn3 c t1) (sn3 d v0) (\lambda (_: +(sn3 c u)).(\lambda (H11: (sn3 c t1)).(H7 c d H4 H11))) H9))))))) k H2 H3 +H5))))))))))))) (\lambda (v0: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda +(i0: nat).(\lambda (_: (subst0 i0 v0 u1 u2)).(\lambda (H3: ((\forall (c: +C).(\forall (d: C).((getl i0 c (CHead d (Bind Abbr) v0)) \to ((sn3 c u1) \to +(sn3 d v0))))))).(\lambda (k: K).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(_: (subst0 (s k i0) v0 t1 t2)).(\lambda (_: ((\forall (c: C).(\forall (d: +C).((getl (s k i0) c (CHead d (Bind Abbr) v0)) \to ((sn3 c t1) \to (sn3 d +v0))))))).(\lambda (c: C).(\lambda (d: C).(\lambda (H6: (getl i0 c (CHead d +(Bind Abbr) v0))).(\lambda (H7: (sn3 c (THead k u1 t1))).(let H_y \def +(sn3_gen_head k c u1 t1 H7) in (H3 c d H6 H_y))))))))))))))))) i v t x H1))) +H0)))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/spare.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/spare.ma new file mode 100644 index 000000000..70b94347b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/spare.ma @@ -0,0 +1,118 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/spare". + +include "theory.ma". + +inductive sort: T \to Prop \def +| sort_sort: \forall (n: nat).(sort (TSort n)) +| sort_abst: \forall (u: T).((sort u) \to (\forall (t: T).((sort t) \to (sort +(THead (Bind Abst) u t))))). + +theorem sort_nf2: + \forall (t: T).((sort t) \to (\forall (c: C).(nf2 c t))) +\def + \lambda (t: T).(\lambda (H: (sort t)).(sort_ind (\lambda (t0: T).(\forall +(c: C).(nf2 c t0))) (\lambda (n: nat).(\lambda (c: C).(nf2_sort c n))) +(\lambda (u: T).(\lambda (_: (sort u)).(\lambda (H1: ((\forall (c: C).(nf2 c +u)))).(\lambda (t0: T).(\lambda (_: (sort t0)).(\lambda (H3: ((\forall (c: +C).(nf2 c t0)))).(\lambda (c: C).(let H_y \def (H3 (CHead c (Bind Abst) u)) +in (nf2_abst_shift c u (H1 c) t0 H_y))))))))) t H)). + +theorem sort_pc3: + \forall (t1: T).((sort t1) \to (\forall (t2: T).((sort t2) \to (\forall (c: +C).((pc3 c t1 t2) \to (eq T t1 t2)))))) +\def + \lambda (t1: T).(\lambda (H: (sort t1)).(sort_ind (\lambda (t: T).(\forall +(t2: T).((sort t2) \to (\forall (c: C).((pc3 c t t2) \to (eq T t t2)))))) +(\lambda (n: nat).(\lambda (t2: T).(\lambda (H0: (sort t2)).(sort_ind +(\lambda (t: T).(\forall (c: C).((pc3 c (TSort n) t) \to (eq T (TSort n) +t)))) (\lambda (n0: nat).(\lambda (c: C).(\lambda (H1: (pc3 c (TSort n) +(TSort n0))).(eq_ind nat n (\lambda (n1: nat).(eq T (TSort n) (TSort n1))) +(refl_equal T (TSort n)) n0 (pc3_gen_sort c n n0 H1))))) (\lambda (u: +T).(\lambda (_: (sort u)).(\lambda (_: ((\forall (c: C).((pc3 c (TSort n) u) +\to (eq T (TSort n) u))))).(\lambda (t: T).(\lambda (_: (sort t)).(\lambda +(_: ((\forall (c: C).((pc3 c (TSort n) t) \to (eq T (TSort n) t))))).(\lambda +(c: C).(\lambda (H5: (pc3 c (TSort n) (THead (Bind Abst) u +t))).(pc3_gen_sort_abst c u t n H5 (eq T (TSort n) (THead (Bind Abst) u +t))))))))))) t2 H0)))) (\lambda (u: T).(\lambda (_: (sort u)).(\lambda (H1: +((\forall (t2: T).((sort t2) \to (\forall (c: C).((pc3 c u t2) \to (eq T u +t2))))))).(\lambda (t: T).(\lambda (_: (sort t)).(\lambda (H3: ((\forall (t2: +T).((sort t2) \to (\forall (c: C).((pc3 c t t2) \to (eq T t +t2))))))).(\lambda (t2: T).(\lambda (H4: (sort t2)).(sort_ind (\lambda (t0: +T).(\forall (c: C).((pc3 c (THead (Bind Abst) u t) t0) \to (eq T (THead (Bind +Abst) u t) t0)))) (\lambda (n: nat).(\lambda (c: C).(\lambda (H5: (pc3 c +(THead (Bind Abst) u t) (TSort n))).(pc3_gen_sort_abst c u t n (pc3_s c +(TSort n) (THead (Bind Abst) u t) H5) (eq T (THead (Bind Abst) u t) (TSort +n)))))) (\lambda (u0: T).(\lambda (H5: (sort u0)).(\lambda (_: ((\forall (c: +C).((pc3 c (THead (Bind Abst) u t) u0) \to (eq T (THead (Bind Abst) u t) +u0))))).(\lambda (t0: T).(\lambda (H7: (sort t0)).(\lambda (_: ((\forall (c: +C).((pc3 c (THead (Bind Abst) u t) t0) \to (eq T (THead (Bind Abst) u t) +t0))))).(\lambda (c: C).(\lambda (H9: (pc3 c (THead (Bind Abst) u t) (THead +(Bind Abst) u0 t0))).(and_ind (pc3 c u u0) (\forall (b: B).(\forall (u1: +T).(pc3 (CHead c (Bind b) u1) t t0))) (eq T (THead (Bind Abst) u t) (THead +(Bind Abst) u0 t0)) (\lambda (H10: (pc3 c u u0)).(\lambda (H11: ((\forall (b: +B).(\forall (u1: T).(pc3 (CHead c (Bind b) u1) t t0))))).(let H_y \def (H11 +Abbr u) in (let H_y0 \def (H1 u0 H5 c H10) in (let H_y1 \def (H3 t0 H7 (CHead +c (Bind Abbr) u) H_y) in (let H12 \def (eq_ind_r T t0 (\lambda (t3: T).(pc3 +(CHead c (Bind Abbr) u) t t3)) H_y t H_y1) in (let H13 \def (eq_ind_r T t0 +(\lambda (t3: T).(sort t3)) H7 t H_y1) in (eq_ind T t (\lambda (t3: T).(eq T +(THead (Bind Abst) u t) (THead (Bind Abst) u0 t3))) (let H14 \def (eq_ind_r T +u0 (\lambda (t3: T).(pc3 c u t3)) H10 u H_y0) in (let H15 \def (eq_ind_r T u0 +(\lambda (t3: T).(sort t3)) H5 u H_y0) in (eq_ind T u (\lambda (t3: T).(eq T +(THead (Bind Abst) u t) (THead (Bind Abst) t3 t))) (refl_equal T (THead (Bind +Abst) u t)) u0 H_y0))) t0 H_y1)))))))) (pc3_gen_abst c u u0 t t0 H9)))))))))) +t2 H4))))))))) t1 H)). + +theorem sort_correct: + \forall (g: G).(\forall (t1: T).((sort t1) \to (\forall (c: C).(ex3 T +(\lambda (t2: T).(tau0 g c t1 t2)) (\lambda (t2: T).(ty3 g c t1 t2)) (\lambda +(t2: T).(sort t2)))))) +\def + \lambda (g: G).(\lambda (t1: T).(\lambda (H: (sort t1)).(sort_ind (\lambda +(t: T).(\forall (c: C).(ex3 T (\lambda (t2: T).(tau0 g c t t2)) (\lambda (t2: +T).(ty3 g c t t2)) (\lambda (t2: T).(sort t2))))) (\lambda (n: nat).(\lambda +(c: C).(ex3_intro T (\lambda (t2: T).(tau0 g c (TSort n) t2)) (\lambda (t2: +T).(ty3 g c (TSort n) t2)) (\lambda (t2: T).(sort t2)) (TSort (next g n)) +(tau0_sort g c n) (ty3_sort g c n) (sort_sort (next g n))))) (\lambda (u: +T).(\lambda (H0: (sort u)).(\lambda (H1: ((\forall (c: C).(ex3 T (\lambda +(t2: T).(tau0 g c u t2)) (\lambda (t2: T).(ty3 g c u t2)) (\lambda (t2: +T).(sort t2)))))).(\lambda (t: T).(\lambda (_: (sort t)).(\lambda (H3: +((\forall (c: C).(ex3 T (\lambda (t2: T).(tau0 g c t t2)) (\lambda (t2: +T).(ty3 g c t t2)) (\lambda (t2: T).(sort t2)))))).(\lambda (c: C).(let H_x +\def (H1 c) in (let H4 \def H_x in (ex3_ind T (\lambda (t2: T).(tau0 g c u +t2)) (\lambda (t2: T).(ty3 g c u t2)) (\lambda (t2: T).(sort t2)) (ex3 T +(\lambda (t2: T).(tau0 g c (THead (Bind Abst) u t) t2)) (\lambda (t2: T).(ty3 +g c (THead (Bind Abst) u t) t2)) (\lambda (t2: T).(sort t2))) (\lambda (x0: +T).(\lambda (_: (tau0 g c u x0)).(\lambda (H6: (ty3 g c u x0)).(\lambda (_: +(sort x0)).(let H_x0 \def (H3 (CHead c (Bind Abst) u)) in (let H8 \def H_x0 +in (ex3_ind T (\lambda (t2: T).(tau0 g (CHead c (Bind Abst) u) t t2)) +(\lambda (t2: T).(ty3 g (CHead c (Bind Abst) u) t t2)) (\lambda (t2: T).(sort +t2)) (ex3 T (\lambda (t2: T).(tau0 g c (THead (Bind Abst) u t) t2)) (\lambda +(t2: T).(ty3 g c (THead (Bind Abst) u t) t2)) (\lambda (t2: T).(sort t2))) +(\lambda (x1: T).(\lambda (H9: (tau0 g (CHead c (Bind Abst) u) t +x1)).(\lambda (H10: (ty3 g (CHead c (Bind Abst) u) t x1)).(\lambda (H11: +(sort x1)).(ex_ind T (\lambda (t0: T).(ty3 g (CHead c (Bind Abst) u) x1 t0)) +(ex3 T (\lambda (t2: T).(tau0 g c (THead (Bind Abst) u t) t2)) (\lambda (t2: +T).(ty3 g c (THead (Bind Abst) u t) t2)) (\lambda (t2: T).(sort t2))) +(\lambda (x: T).(\lambda (H12: (ty3 g (CHead c (Bind Abst) u) x1 +x)).(ex3_intro T (\lambda (t2: T).(tau0 g c (THead (Bind Abst) u t) t2)) +(\lambda (t2: T).(ty3 g c (THead (Bind Abst) u t) t2)) (\lambda (t2: T).(sort +t2)) (THead (Bind Abst) u x1) (tau0_bind g Abst c u t x1 H9) (ty3_bind g c u +x0 H6 Abst t x1 H10 x H12) (sort_abst u H0 x1 H11)))) (ty3_correct g (CHead c +(Bind Abst) u) t x1 H10)))))) H8))))))) H4)))))))))) t1 H))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/dec.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/dec.ma new file mode 100644 index 000000000..cfa2bbe3f --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/dec.ma @@ -0,0 +1,178 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst0/dec". + +include "subst0/defs.ma". + +include "lift/props.ma". + +theorem dnf_dec2: + \forall (t: T).(\forall (d: nat).(or (\forall (w: T).(ex T (\lambda (v: +T).(subst0 d w t (lift (S O) d v))))) (ex T (\lambda (v: T).(eq T t (lift (S +O) d v)))))) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(\forall (d: nat).(or (\forall (w: +T).(ex T (\lambda (v: T).(subst0 d w t0 (lift (S O) d v))))) (ex T (\lambda +(v: T).(eq T t0 (lift (S O) d v))))))) (\lambda (n: nat).(\lambda (d: +nat).(or_intror (\forall (w: T).(ex T (\lambda (v: T).(subst0 d w (TSort n) +(lift (S O) d v))))) (ex T (\lambda (v: T).(eq T (TSort n) (lift (S O) d +v)))) (ex_intro T (\lambda (v: T).(eq T (TSort n) (lift (S O) d v))) (TSort +n) (eq_ind_r T (TSort n) (\lambda (t0: T).(eq T (TSort n) t0)) (refl_equal T +(TSort n)) (lift (S O) d (TSort n)) (lift_sort n (S O) d)))))) (\lambda (n: +nat).(\lambda (d: nat).(lt_eq_gt_e n d (or (\forall (w: T).(ex T (\lambda (v: +T).(subst0 d w (TLRef n) (lift (S O) d v))))) (ex T (\lambda (v: T).(eq T +(TLRef n) (lift (S O) d v))))) (\lambda (H: (lt n d)).(or_intror (\forall (w: +T).(ex T (\lambda (v: T).(subst0 d w (TLRef n) (lift (S O) d v))))) (ex T +(\lambda (v: T).(eq T (TLRef n) (lift (S O) d v)))) (ex_intro T (\lambda (v: +T).(eq T (TLRef n) (lift (S O) d v))) (TLRef n) (eq_ind_r T (TLRef n) +(\lambda (t0: T).(eq T (TLRef n) t0)) (refl_equal T (TLRef n)) (lift (S O) d +(TLRef n)) (lift_lref_lt n (S O) d H))))) (\lambda (H: (eq nat n d)).(eq_ind +nat n (\lambda (n0: nat).(or (\forall (w: T).(ex T (\lambda (v: T).(subst0 n0 +w (TLRef n) (lift (S O) n0 v))))) (ex T (\lambda (v: T).(eq T (TLRef n) (lift +(S O) n0 v)))))) (or_introl (\forall (w: T).(ex T (\lambda (v: T).(subst0 n w +(TLRef n) (lift (S O) n v))))) (ex T (\lambda (v: T).(eq T (TLRef n) (lift (S +O) n v)))) (\lambda (w: T).(ex_intro T (\lambda (v: T).(subst0 n w (TLRef n) +(lift (S O) n v))) (lift n O w) (eq_ind_r T (lift (plus (S O) n) O w) +(\lambda (t0: T).(subst0 n w (TLRef n) t0)) (subst0_lref w n) (lift (S O) n +(lift n O w)) (lift_free w n (S O) O n (le_n (plus O n)) (le_O_n n)))))) d +H)) (\lambda (H: (lt d n)).(or_intror (\forall (w: T).(ex T (\lambda (v: +T).(subst0 d w (TLRef n) (lift (S O) d v))))) (ex T (\lambda (v: T).(eq T +(TLRef n) (lift (S O) d v)))) (ex_intro T (\lambda (v: T).(eq T (TLRef n) +(lift (S O) d v))) (TLRef (pred n)) (eq_ind_r T (TLRef n) (\lambda (t0: +T).(eq T (TLRef n) t0)) (refl_equal T (TLRef n)) (lift (S O) d (TLRef (pred +n))) (lift_lref_gt d n H)))))))) (\lambda (k: K).(\lambda (t0: T).(\lambda +(H: ((\forall (d: nat).(or (\forall (w: T).(ex T (\lambda (v: T).(subst0 d w +t0 (lift (S O) d v))))) (ex T (\lambda (v: T).(eq T t0 (lift (S O) d +v)))))))).(\lambda (t1: T).(\lambda (H0: ((\forall (d: nat).(or (\forall (w: +T).(ex T (\lambda (v: T).(subst0 d w t1 (lift (S O) d v))))) (ex T (\lambda +(v: T).(eq T t1 (lift (S O) d v)))))))).(\lambda (d: nat).(let H_x \def (H d) +in (let H1 \def H_x in (or_ind (\forall (w: T).(ex T (\lambda (v: T).(subst0 +d w t0 (lift (S O) d v))))) (ex T (\lambda (v: T).(eq T t0 (lift (S O) d +v)))) (or (\forall (w: T).(ex T (\lambda (v: T).(subst0 d w (THead k t0 t1) +(lift (S O) d v))))) (ex T (\lambda (v: T).(eq T (THead k t0 t1) (lift (S O) +d v))))) (\lambda (H2: ((\forall (w: T).(ex T (\lambda (v: T).(subst0 d w t0 +(lift (S O) d v))))))).(let H_x0 \def (H0 (s k d)) in (let H3 \def H_x0 in +(or_ind (\forall (w: T).(ex T (\lambda (v: T).(subst0 (s k d) w t1 (lift (S +O) (s k d) v))))) (ex T (\lambda (v: T).(eq T t1 (lift (S O) (s k d) v)))) +(or (\forall (w: T).(ex T (\lambda (v: T).(subst0 d w (THead k t0 t1) (lift +(S O) d v))))) (ex T (\lambda (v: T).(eq T (THead k t0 t1) (lift (S O) d +v))))) (\lambda (H4: ((\forall (w: T).(ex T (\lambda (v: T).(subst0 (s k d) w +t1 (lift (S O) (s k d) v))))))).(or_introl (\forall (w: T).(ex T (\lambda (v: +T).(subst0 d w (THead k t0 t1) (lift (S O) d v))))) (ex T (\lambda (v: T).(eq +T (THead k t0 t1) (lift (S O) d v)))) (\lambda (w: T).(let H_x1 \def (H4 w) +in (let H5 \def H_x1 in (ex_ind T (\lambda (v: T).(subst0 (s k d) w t1 (lift +(S O) (s k d) v))) (ex T (\lambda (v: T).(subst0 d w (THead k t0 t1) (lift (S +O) d v)))) (\lambda (x: T).(\lambda (H6: (subst0 (s k d) w t1 (lift (S O) (s +k d) x))).(let H_x2 \def (H2 w) in (let H7 \def H_x2 in (ex_ind T (\lambda +(v: T).(subst0 d w t0 (lift (S O) d v))) (ex T (\lambda (v: T).(subst0 d w +(THead k t0 t1) (lift (S O) d v)))) (\lambda (x0: T).(\lambda (H8: (subst0 d +w t0 (lift (S O) d x0))).(ex_intro T (\lambda (v: T).(subst0 d w (THead k t0 +t1) (lift (S O) d v))) (THead k x0 x) (eq_ind_r T (THead k (lift (S O) d x0) +(lift (S O) (s k d) x)) (\lambda (t2: T).(subst0 d w (THead k t0 t1) t2)) +(subst0_both w t0 (lift (S O) d x0) d H8 k t1 (lift (S O) (s k d) x) H6) +(lift (S O) d (THead k x0 x)) (lift_head k x0 x (S O) d))))) H7))))) H5)))))) +(\lambda (H4: (ex T (\lambda (v: T).(eq T t1 (lift (S O) (s k d) +v))))).(ex_ind T (\lambda (v: T).(eq T t1 (lift (S O) (s k d) v))) (or +(\forall (w: T).(ex T (\lambda (v: T).(subst0 d w (THead k t0 t1) (lift (S O) +d v))))) (ex T (\lambda (v: T).(eq T (THead k t0 t1) (lift (S O) d v))))) +(\lambda (x: T).(\lambda (H5: (eq T t1 (lift (S O) (s k d) x))).(eq_ind_r T +(lift (S O) (s k d) x) (\lambda (t2: T).(or (\forall (w: T).(ex T (\lambda +(v: T).(subst0 d w (THead k t0 t2) (lift (S O) d v))))) (ex T (\lambda (v: +T).(eq T (THead k t0 t2) (lift (S O) d v)))))) (or_introl (\forall (w: T).(ex +T (\lambda (v: T).(subst0 d w (THead k t0 (lift (S O) (s k d) x)) (lift (S O) +d v))))) (ex T (\lambda (v: T).(eq T (THead k t0 (lift (S O) (s k d) x)) +(lift (S O) d v)))) (\lambda (w: T).(let H_x1 \def (H2 w) in (let H6 \def +H_x1 in (ex_ind T (\lambda (v: T).(subst0 d w t0 (lift (S O) d v))) (ex T +(\lambda (v: T).(subst0 d w (THead k t0 (lift (S O) (s k d) x)) (lift (S O) d +v)))) (\lambda (x0: T).(\lambda (H7: (subst0 d w t0 (lift (S O) d +x0))).(ex_intro T (\lambda (v: T).(subst0 d w (THead k t0 (lift (S O) (s k d) +x)) (lift (S O) d v))) (THead k x0 x) (eq_ind_r T (THead k (lift (S O) d x0) +(lift (S O) (s k d) x)) (\lambda (t2: T).(subst0 d w (THead k t0 (lift (S O) +(s k d) x)) t2)) (subst0_fst w (lift (S O) d x0) t0 d H7 (lift (S O) (s k d) +x) k) (lift (S O) d (THead k x0 x)) (lift_head k x0 x (S O) d))))) H6))))) t1 +H5))) H4)) H3)))) (\lambda (H2: (ex T (\lambda (v: T).(eq T t0 (lift (S O) d +v))))).(ex_ind T (\lambda (v: T).(eq T t0 (lift (S O) d v))) (or (\forall (w: +T).(ex T (\lambda (v: T).(subst0 d w (THead k t0 t1) (lift (S O) d v))))) (ex +T (\lambda (v: T).(eq T (THead k t0 t1) (lift (S O) d v))))) (\lambda (x: +T).(\lambda (H3: (eq T t0 (lift (S O) d x))).(let H_x0 \def (H0 (s k d)) in +(let H4 \def H_x0 in (or_ind (\forall (w: T).(ex T (\lambda (v: T).(subst0 (s +k d) w t1 (lift (S O) (s k d) v))))) (ex T (\lambda (v: T).(eq T t1 (lift (S +O) (s k d) v)))) (or (\forall (w: T).(ex T (\lambda (v: T).(subst0 d w (THead +k t0 t1) (lift (S O) d v))))) (ex T (\lambda (v: T).(eq T (THead k t0 t1) +(lift (S O) d v))))) (\lambda (H5: ((\forall (w: T).(ex T (\lambda (v: +T).(subst0 (s k d) w t1 (lift (S O) (s k d) v))))))).(eq_ind_r T (lift (S O) +d x) (\lambda (t2: T).(or (\forall (w: T).(ex T (\lambda (v: T).(subst0 d w +(THead k t2 t1) (lift (S O) d v))))) (ex T (\lambda (v: T).(eq T (THead k t2 +t1) (lift (S O) d v)))))) (or_introl (\forall (w: T).(ex T (\lambda (v: +T).(subst0 d w (THead k (lift (S O) d x) t1) (lift (S O) d v))))) (ex T +(\lambda (v: T).(eq T (THead k (lift (S O) d x) t1) (lift (S O) d v)))) +(\lambda (w: T).(let H_x1 \def (H5 w) in (let H6 \def H_x1 in (ex_ind T +(\lambda (v: T).(subst0 (s k d) w t1 (lift (S O) (s k d) v))) (ex T (\lambda +(v: T).(subst0 d w (THead k (lift (S O) d x) t1) (lift (S O) d v)))) (\lambda +(x0: T).(\lambda (H7: (subst0 (s k d) w t1 (lift (S O) (s k d) +x0))).(ex_intro T (\lambda (v: T).(subst0 d w (THead k (lift (S O) d x) t1) +(lift (S O) d v))) (THead k x x0) (eq_ind_r T (THead k (lift (S O) d x) (lift +(S O) (s k d) x0)) (\lambda (t2: T).(subst0 d w (THead k (lift (S O) d x) t1) +t2)) (subst0_snd k w (lift (S O) (s k d) x0) t1 d H7 (lift (S O) d x)) (lift +(S O) d (THead k x x0)) (lift_head k x x0 (S O) d))))) H6))))) t0 H3)) +(\lambda (H5: (ex T (\lambda (v: T).(eq T t1 (lift (S O) (s k d) +v))))).(ex_ind T (\lambda (v: T).(eq T t1 (lift (S O) (s k d) v))) (or +(\forall (w: T).(ex T (\lambda (v: T).(subst0 d w (THead k t0 t1) (lift (S O) +d v))))) (ex T (\lambda (v: T).(eq T (THead k t0 t1) (lift (S O) d v))))) +(\lambda (x0: T).(\lambda (H6: (eq T t1 (lift (S O) (s k d) x0))).(eq_ind_r T +(lift (S O) (s k d) x0) (\lambda (t2: T).(or (\forall (w: T).(ex T (\lambda +(v: T).(subst0 d w (THead k t0 t2) (lift (S O) d v))))) (ex T (\lambda (v: +T).(eq T (THead k t0 t2) (lift (S O) d v)))))) (eq_ind_r T (lift (S O) d x) +(\lambda (t2: T).(or (\forall (w: T).(ex T (\lambda (v: T).(subst0 d w (THead +k t2 (lift (S O) (s k d) x0)) (lift (S O) d v))))) (ex T (\lambda (v: T).(eq +T (THead k t2 (lift (S O) (s k d) x0)) (lift (S O) d v)))))) (or_intror +(\forall (w: T).(ex T (\lambda (v: T).(subst0 d w (THead k (lift (S O) d x) +(lift (S O) (s k d) x0)) (lift (S O) d v))))) (ex T (\lambda (v: T).(eq T +(THead k (lift (S O) d x) (lift (S O) (s k d) x0)) (lift (S O) d v)))) +(ex_intro T (\lambda (v: T).(eq T (THead k (lift (S O) d x) (lift (S O) (s k +d) x0)) (lift (S O) d v))) (THead k x x0) (eq_ind_r T (THead k (lift (S O) d +x) (lift (S O) (s k d) x0)) (\lambda (t2: T).(eq T (THead k (lift (S O) d x) +(lift (S O) (s k d) x0)) t2)) (refl_equal T (THead k (lift (S O) d x) (lift +(S O) (s k d) x0))) (lift (S O) d (THead k x x0)) (lift_head k x x0 (S O) +d)))) t0 H3) t1 H6))) H5)) H4))))) H2)) H1))))))))) t). + +theorem dnf_dec: + \forall (w: T).(\forall (t: T).(\forall (d: nat).(ex T (\lambda (v: T).(or +(subst0 d w t (lift (S O) d v)) (eq T t (lift (S O) d v))))))) +\def + \lambda (w: T).(\lambda (t: T).(\lambda (d: nat).(let H_x \def (dnf_dec2 t +d) in (let H \def H_x in (or_ind (\forall (w0: T).(ex T (\lambda (v: +T).(subst0 d w0 t (lift (S O) d v))))) (ex T (\lambda (v: T).(eq T t (lift (S +O) d v)))) (ex T (\lambda (v: T).(or (subst0 d w t (lift (S O) d v)) (eq T t +(lift (S O) d v))))) (\lambda (H0: ((\forall (w0: T).(ex T (\lambda (v: +T).(subst0 d w0 t (lift (S O) d v))))))).(let H_x0 \def (H0 w) in (let H1 +\def H_x0 in (ex_ind T (\lambda (v: T).(subst0 d w t (lift (S O) d v))) (ex T +(\lambda (v: T).(or (subst0 d w t (lift (S O) d v)) (eq T t (lift (S O) d +v))))) (\lambda (x: T).(\lambda (H2: (subst0 d w t (lift (S O) d +x))).(ex_intro T (\lambda (v: T).(or (subst0 d w t (lift (S O) d v)) (eq T t +(lift (S O) d v)))) x (or_introl (subst0 d w t (lift (S O) d x)) (eq T t +(lift (S O) d x)) H2)))) H1)))) (\lambda (H0: (ex T (\lambda (v: T).(eq T t +(lift (S O) d v))))).(ex_ind T (\lambda (v: T).(eq T t (lift (S O) d v))) (ex +T (\lambda (v: T).(or (subst0 d w t (lift (S O) d v)) (eq T t (lift (S O) d +v))))) (\lambda (x: T).(\lambda (H1: (eq T t (lift (S O) d x))).(eq_ind_r T +(lift (S O) d x) (\lambda (t0: T).(ex T (\lambda (v: T).(or (subst0 d w t0 +(lift (S O) d v)) (eq T t0 (lift (S O) d v)))))) (ex_intro T (\lambda (v: +T).(or (subst0 d w (lift (S O) d x) (lift (S O) d v)) (eq T (lift (S O) d x) +(lift (S O) d v)))) x (or_intror (subst0 d w (lift (S O) d x) (lift (S O) d +x)) (eq T (lift (S O) d x) (lift (S O) d x)) (refl_equal T (lift (S O) d +x)))) t H1))) H0)) H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/defs.ma new file mode 100644 index 000000000..c675bc6ab --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/defs.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst0/defs". + +include "lift/defs.ma". + +inductive subst0: nat \to (T \to (T \to (T \to Prop))) \def +| subst0_lref: \forall (v: T).(\forall (i: nat).(subst0 i v (TLRef i) (lift +(S i) O v))) +| subst0_fst: \forall (v: T).(\forall (u2: T).(\forall (u1: T).(\forall (i: +nat).((subst0 i v u1 u2) \to (\forall (t: T).(\forall (k: K).(subst0 i v +(THead k u1 t) (THead k u2 t)))))))) +| subst0_snd: \forall (k: K).(\forall (v: T).(\forall (t2: T).(\forall (t1: +T).(\forall (i: nat).((subst0 (s k i) v t1 t2) \to (\forall (u: T).(subst0 i +v (THead k u t1) (THead k u t2)))))))) +| subst0_both: \forall (v: T).(\forall (u1: T).(\forall (u2: T).(\forall (i: +nat).((subst0 i v u1 u2) \to (\forall (k: K).(\forall (t1: T).(\forall (t2: +T).((subst0 (s k i) v t1 t2) \to (subst0 i v (THead k u1 t1) (THead k u2 +t2)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/fwd.ma new file mode 100644 index 000000000..e16f362b0 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/fwd.ma @@ -0,0 +1,817 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst0/fwd". + +include "subst0/defs.ma". + +include "lift/props.ma". + +theorem subst0_inv_coq: + \forall (i: nat).(\forall (v: T).(\forall (t1: T).(\forall (t2: T).(\forall +(P: ((nat \to (T \to (T \to (T \to Prop)))))).((((subst0 i v t1 t2) \to +(\forall (v0: T).(\forall (i0: nat).((eq nat i0 i) \to ((eq T v0 v) \to ((eq +T (TLRef i0) t1) \to ((eq T (lift (S i0) O v0) t2) \to (P i v t1 t2))))))))) +\to ((((subst0 i v t1 t2) \to (\forall (v0: T).(\forall (u2: T).(\forall (u1: +T).(\forall (i0: nat).(\forall (t: T).(\forall (k: K).((eq nat i0 i) \to ((eq +T v0 v) \to ((eq T (THead k u1 t) t1) \to ((eq T (THead k u2 t) t2) \to +((subst0 i0 v0 u1 u2) \to (P i v t1 t2)))))))))))))) \to ((((subst0 i v t1 +t2) \to (\forall (k: K).(\forall (v0: T).(\forall (t0: T).(\forall (t3: +T).(\forall (i0: nat).(\forall (u: T).((eq nat i0 i) \to ((eq T v0 v) \to +((eq T (THead k u t3) t1) \to ((eq T (THead k u t0) t2) \to ((subst0 (s k i0) +v0 t3 t0) \to (P i v t1 t2)))))))))))))) \to ((((subst0 i v t1 t2) \to +(\forall (v0: T).(\forall (u1: T).(\forall (u2: T).(\forall (i0: +nat).(\forall (k: K).(\forall (t0: T).(\forall (t3: T).((eq nat i0 i) \to +((eq T v0 v) \to ((eq T (THead k u1 t0) t1) \to ((eq T (THead k u2 t3) t2) +\to ((subst0 i0 v0 u1 u2) \to ((subst0 (s k i0) v0 t0 t3) \to (P i v t1 +t2)))))))))))))))) \to ((subst0 i v t1 t2) \to (P i v t1 t2)))))))))) +\def + \lambda (i: nat).(\lambda (v: T).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(P: ((nat \to (T \to (T \to (T \to Prop)))))).(\lambda (H: (((subst0 i v t1 +t2) \to (\forall (v0: T).(\forall (i0: nat).((eq nat i0 i) \to ((eq T v0 v) +\to ((eq T (TLRef i0) t1) \to ((eq T (lift (S i0) O v0) t2) \to (P i v t1 +t2)))))))))).(\lambda (H0: (((subst0 i v t1 t2) \to (\forall (v0: T).(\forall +(u2: T).(\forall (u1: T).(\forall (i0: nat).(\forall (t: T).(\forall (k: +K).((eq nat i0 i) \to ((eq T v0 v) \to ((eq T (THead k u1 t) t1) \to ((eq T +(THead k u2 t) t2) \to ((subst0 i0 v0 u1 u2) \to (P i v t1 +t2))))))))))))))).(\lambda (H1: (((subst0 i v t1 t2) \to (\forall (k: +K).(\forall (v0: T).(\forall (t0: T).(\forall (t3: T).(\forall (i0: +nat).(\forall (u: T).((eq nat i0 i) \to ((eq T v0 v) \to ((eq T (THead k u +t3) t1) \to ((eq T (THead k u t0) t2) \to ((subst0 (s k i0) v0 t3 t0) \to (P +i v t1 t2))))))))))))))).(\lambda (H2: (((subst0 i v t1 t2) \to (\forall (v0: +T).(\forall (u1: T).(\forall (u2: T).(\forall (i0: nat).(\forall (k: +K).(\forall (t0: T).(\forall (t3: T).((eq nat i0 i) \to ((eq T v0 v) \to ((eq +T (THead k u1 t0) t1) \to ((eq T (THead k u2 t3) t2) \to ((subst0 i0 v0 u1 +u2) \to ((subst0 (s k i0) v0 t0 t3) \to (P i v t1 +t2))))))))))))))))).(\lambda (H3: (subst0 i v t1 t2)).(let H4 \def (match H3 +in subst0 return (\lambda (n: nat).(\lambda (t: T).(\lambda (t0: T).(\lambda +(t3: T).(\lambda (_: (subst0 n t t0 t3)).((eq nat n i) \to ((eq T t v) \to +((eq T t0 t1) \to ((eq T t3 t2) \to (P i v t1 t2)))))))))) with [(subst0_lref +v0 i0) \Rightarrow (\lambda (H4: (eq nat i0 i)).(\lambda (H5: (eq T v0 +v)).(\lambda (H6: (eq T (TLRef i0) t1)).(\lambda (H7: (eq T (lift (S i0) O +v0) t2)).(H H3 v0 i0 H4 H5 H6 H7))))) | (subst0_fst v0 u2 u1 i0 H4 t k) +\Rightarrow (\lambda (H5: (eq nat i0 i)).(\lambda (H6: (eq T v0 v)).(\lambda +(H7: (eq T (THead k u1 t) t1)).(\lambda (H8: (eq T (THead k u2 t) t2)).(H0 H3 +v0 u2 u1 i0 t k H5 H6 H7 H8 H4))))) | (subst0_snd k v0 t0 t3 i0 H4 u) +\Rightarrow (\lambda (H5: (eq nat i0 i)).(\lambda (H6: (eq T v0 v)).(\lambda +(H7: (eq T (THead k u t3) t1)).(\lambda (H8: (eq T (THead k u t0) t2)).(H1 H3 +k v0 t0 t3 i0 u H5 H6 H7 H8 H4))))) | (subst0_both v0 u1 u2 i0 H4 k t0 t3 H5) +\Rightarrow (\lambda (H6: (eq nat i0 i)).(\lambda (H7: (eq T v0 v)).(\lambda +(H8: (eq T (THead k u1 t0) t1)).(\lambda (H9: (eq T (THead k u2 t3) t2)).(H2 +H3 v0 u1 u2 i0 k t0 t3 H6 H7 H8 H9 H4 H5)))))]) in (H4 (refl_equal nat i) +(refl_equal T v) (refl_equal T t1) (refl_equal T t2)))))))))))). + +theorem subst0_gen_sort: + \forall (v: T).(\forall (x: T).(\forall (i: nat).(\forall (n: nat).((subst0 +i v (TSort n) x) \to (\forall (P: Prop).P))))) +\def + \lambda (v: T).(\lambda (x: T).(\lambda (i: nat).(\lambda (n: nat).(\lambda +(H: (subst0 i v (TSort n) x)).(\lambda (P: Prop).(subst0_inv_coq i v (TSort +n) x (\lambda (_: nat).(\lambda (_: T).(\lambda (_: T).(\lambda (_: T).P)))) +(\lambda (H0: (subst0 i v (TSort n) x)).(\lambda (v0: T).(\lambda (i0: +nat).(\lambda (H1: (eq nat i0 i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: +(eq T (TLRef i0) (TSort n))).(\lambda (H4: (eq T (lift (S i0) O v0) x)).(let +H5 \def (eq_ind nat i0 (\lambda (n0: nat).(eq T (lift (S n0) O v0) x)) H4 i +H1) in (let H6 \def (eq_ind nat i0 (\lambda (n0: nat).(eq T (TLRef n0) (TSort +n))) H3 i H1) in (let H7 \def (eq_ind T v0 (\lambda (t: T).(eq T (lift (S i) +O t) x)) H5 v H2) in (let H8 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v +(TSort n) t)) H0 (lift (S i) O v) H7) in (let H9 \def (eq_ind_r T x (\lambda +(t: T).(subst0 i v (TSort n) t)) H (lift (S i) O v) H7) in (let H10 \def +(eq_ind T (TLRef i) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (TSort n) H6) in (False_ind P +H10)))))))))))))) (\lambda (H0: (subst0 i v (TSort n) x)).(\lambda (v0: +T).(\lambda (u2: T).(\lambda (u1: T).(\lambda (i0: nat).(\lambda (t: +T).(\lambda (k: K).(\lambda (H1: (eq nat i0 i)).(\lambda (H2: (eq T v0 +v)).(\lambda (H3: (eq T (THead k u1 t) (TSort n))).(\lambda (H4: (eq T (THead +k u2 t) x)).(\lambda (H5: (subst0 i0 v0 u1 u2)).(let H6 \def (eq_ind nat i0 +(\lambda (n0: nat).(subst0 n0 v0 u1 u2)) H5 i H1) in (let H7 \def (eq_ind T +v0 (\lambda (t0: T).(subst0 i t0 u1 u2)) H6 v H2) in (let H8 \def (eq_ind_r T +x (\lambda (t0: T).(subst0 i v (TSort n) t0)) H0 (THead k u2 t) H4) in (let +H9 \def (eq_ind_r T x (\lambda (t0: T).(subst0 i v (TSort n) t0)) H (THead k +u2 t) H4) in (let H10 \def (eq_ind T (THead k u1 t) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n) +H3) in (False_ind P H10)))))))))))))))))) (\lambda (H0: (subst0 i v (TSort n) +x)).(\lambda (k: K).(\lambda (v0: T).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (i0: nat).(\lambda (u: T).(\lambda (H1: (eq nat i0 i)).(\lambda +(H2: (eq T v0 v)).(\lambda (H3: (eq T (THead k u t3) (TSort n))).(\lambda +(H4: (eq T (THead k u t0) x)).(\lambda (H5: (subst0 (s k i0) v0 t3 t0)).(let +H6 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 (s k n0) v0 t3 t0)) H5 i +H1) in (let H7 \def (eq_ind T v0 (\lambda (t: T).(subst0 (s k i) t t3 t0)) H6 +v H2) in (let H8 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (TSort n) t)) +H0 (THead k u t0) H4) in (let H9 \def (eq_ind_r T x (\lambda (t: T).(subst0 i +v (TSort n) t)) H (THead k u t0) H4) in (let H10 \def (eq_ind T (THead k u +t3) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TSort n) H3) in (False_ind P H10)))))))))))))))))) +(\lambda (H0: (subst0 i v (TSort n) x)).(\lambda (v0: T).(\lambda (u1: +T).(\lambda (u2: T).(\lambda (i0: nat).(\lambda (k: K).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (H2: (eq nat i0 i)).(\lambda (H3: (eq T v0 +v)).(\lambda (H4: (eq T (THead k u1 t0) (TSort n))).(\lambda (H5: (eq T +(THead k u2 t3) x)).(\lambda (H1: (subst0 i0 v0 u1 u2)).(\lambda (H6: (subst0 +(s k i0) v0 t0 t3)).(let H7 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 (s +k n0) v0 t0 t3)) H6 i H2) in (let H8 \def (eq_ind nat i0 (\lambda (n0: +nat).(subst0 n0 v0 u1 u2)) H1 i H2) in (let H9 \def (eq_ind T v0 (\lambda (t: +T).(subst0 (s k i) t t0 t3)) H7 v H3) in (let H10 \def (eq_ind T v0 (\lambda +(t: T).(subst0 i t u1 u2)) H8 v H3) in (let H11 \def (eq_ind_r T x (\lambda +(t: T).(subst0 i v (TSort n) t)) H0 (THead k u2 t3) H5) in (let H12 \def +(eq_ind_r T x (\lambda (t: T).(subst0 i v (TSort n) t)) H (THead k u2 t3) H5) +in (let H13 \def (eq_ind T (THead k u1 t0) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n) H4) in +(False_ind P H13)))))))))))))))))))))) H)))))). + +theorem subst0_gen_lref: + \forall (v: T).(\forall (x: T).(\forall (i: nat).(\forall (n: nat).((subst0 +i v (TLRef n) x) \to (land (eq nat n i) (eq T x (lift (S n) O v))))))) +\def + \lambda (v: T).(\lambda (x: T).(\lambda (i: nat).(\lambda (n: nat).(\lambda +(H: (subst0 i v (TLRef n) x)).(subst0_inv_coq i v (TLRef n) x (\lambda (n0: +nat).(\lambda (t: T).(\lambda (_: T).(\lambda (t1: T).(land (eq nat n n0) (eq +T t1 (lift (S n) O t))))))) (\lambda (H0: (subst0 i v (TLRef n) x)).(\lambda +(v0: T).(\lambda (i0: nat).(\lambda (H1: (eq nat i0 i)).(\lambda (H2: (eq T +v0 v)).(\lambda (H3: (eq T (TLRef i0) (TLRef n))).(\lambda (H4: (eq T (lift +(S i0) O v0) x)).(let H5 \def (eq_ind nat i0 (\lambda (n0: nat).(eq T (lift +(S n0) O v0) x)) H4 i H1) in (let H6 \def (eq_ind nat i0 (\lambda (n0: +nat).(eq T (TLRef n0) (TLRef n))) H3 i H1) in (let H7 \def (eq_ind T v0 +(\lambda (t: T).(eq T (lift (S i) O t) x)) H5 v H2) in (let H8 \def (eq_ind_r +T x (\lambda (t: T).(subst0 i v (TLRef n) t)) H0 (lift (S i) O v) H7) in (let +H9 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (TLRef n) t)) H (lift (S i) +O v) H7) in (eq_ind T (lift (S i) O v) (\lambda (t: T).(land (eq nat n i) (eq +T t (lift (S n) O v)))) (let H10 \def (f_equal T nat (\lambda (e: T).(match e +in T return (\lambda (_: T).nat) with [(TSort _) \Rightarrow i | (TLRef n0) +\Rightarrow n0 | (THead _ _ _) \Rightarrow i])) (TLRef i) (TLRef n) H6) in +(let H11 \def (eq_ind_r nat n (\lambda (n0: nat).(subst0 i v (TLRef n0) (lift +(S i) O v))) H8 i H10) in (let H12 \def (eq_ind_r nat n (\lambda (n0: +nat).(subst0 i v (TLRef n0) (lift (S i) O v))) H9 i H10) in (eq_ind nat i +(\lambda (n0: nat).(land (eq nat n0 i) (eq T (lift (S i) O v) (lift (S n0) O +v)))) (conj (eq nat i i) (eq T (lift (S i) O v) (lift (S i) O v)) (refl_equal +nat i) (refl_equal T (lift (S i) O v))) n H10)))) x H7))))))))))))) (\lambda +(H0: (subst0 i v (TLRef n) x)).(\lambda (v0: T).(\lambda (u2: T).(\lambda +(u1: T).(\lambda (i0: nat).(\lambda (t: T).(\lambda (k: K).(\lambda (H1: (eq +nat i0 i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: (eq T (THead k u1 t) +(TLRef n))).(\lambda (H4: (eq T (THead k u2 t) x)).(\lambda (H5: (subst0 i0 +v0 u1 u2)).(let H6 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 n0 v0 u1 +u2)) H5 i H1) in (let H7 \def (eq_ind T v0 (\lambda (t0: T).(subst0 i t0 u1 +u2)) H6 v H2) in (let H8 \def (eq_ind_r T x (\lambda (t0: T).(subst0 i v +(TLRef n) t0)) H0 (THead k u2 t) H4) in (let H9 \def (eq_ind_r T x (\lambda +(t0: T).(subst0 i v (TLRef n) t0)) H (THead k u2 t) H4) in (eq_ind T (THead k +u2 t) (\lambda (t0: T).(land (eq nat n i) (eq T t0 (lift (S n) O v)))) (let +H10 \def (eq_ind T (THead k u1 t) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n) H3) in +(False_ind (land (eq nat n i) (eq T (THead k u2 t) (lift (S n) O v))) H10)) x +H4))))))))))))))))) (\lambda (H0: (subst0 i v (TLRef n) x)).(\lambda (k: +K).(\lambda (v0: T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (i0: +nat).(\lambda (u: T).(\lambda (H1: (eq nat i0 i)).(\lambda (H2: (eq T v0 +v)).(\lambda (H3: (eq T (THead k u t3) (TLRef n))).(\lambda (H4: (eq T (THead +k u t0) x)).(\lambda (H5: (subst0 (s k i0) v0 t3 t0)).(let H6 \def (eq_ind +nat i0 (\lambda (n0: nat).(subst0 (s k n0) v0 t3 t0)) H5 i H1) in (let H7 +\def (eq_ind T v0 (\lambda (t: T).(subst0 (s k i) t t3 t0)) H6 v H2) in (let +H8 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (TLRef n) t)) H0 (THead k u +t0) H4) in (let H9 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (TLRef n) +t)) H (THead k u t0) H4) in (eq_ind T (THead k u t0) (\lambda (t: T).(land +(eq nat n i) (eq T t (lift (S n) O v)))) (let H10 \def (eq_ind T (THead k u +t3) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TLRef n) H3) in (False_ind (land (eq nat n i) (eq T +(THead k u t0) (lift (S n) O v))) H10)) x H4))))))))))))))))) (\lambda (H0: +(subst0 i v (TLRef n) x)).(\lambda (v0: T).(\lambda (u1: T).(\lambda (u2: +T).(\lambda (i0: nat).(\lambda (k: K).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (H2: (eq nat i0 i)).(\lambda (H3: (eq T v0 v)).(\lambda (H4: (eq +T (THead k u1 t0) (TLRef n))).(\lambda (H5: (eq T (THead k u2 t3) +x)).(\lambda (H1: (subst0 i0 v0 u1 u2)).(\lambda (H6: (subst0 (s k i0) v0 t0 +t3)).(let H7 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 (s k n0) v0 t0 +t3)) H6 i H2) in (let H8 \def (eq_ind nat i0 (\lambda (n0: nat).(subst0 n0 v0 +u1 u2)) H1 i H2) in (let H9 \def (eq_ind T v0 (\lambda (t: T).(subst0 (s k i) +t t0 t3)) H7 v H3) in (let H10 \def (eq_ind T v0 (\lambda (t: T).(subst0 i t +u1 u2)) H8 v H3) in (let H11 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v +(TLRef n) t)) H0 (THead k u2 t3) H5) in (let H12 \def (eq_ind_r T x (\lambda +(t: T).(subst0 i v (TLRef n) t)) H (THead k u2 t3) H5) in (eq_ind T (THead k +u2 t3) (\lambda (t: T).(land (eq nat n i) (eq T t (lift (S n) O v)))) (let +H13 \def (eq_ind T (THead k u1 t0) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n) H4) in +(False_ind (land (eq nat n i) (eq T (THead k u2 t3) (lift (S n) O v))) H13)) +x H5))))))))))))))))))))) H))))). + +theorem subst0_gen_head: + \forall (k: K).(\forall (v: T).(\forall (u1: T).(\forall (t1: T).(\forall +(x: T).(\forall (i: nat).((subst0 i v (THead k u1 t1) x) \to (or3 (ex2 T +(\lambda (u2: T).(eq T x (THead k u2 t1))) (\lambda (u2: T).(subst0 i v u1 +u2))) (ex2 T (\lambda (t2: T).(eq T x (THead k u1 t2))) (\lambda (t2: +T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i v u1 +u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) v t1 t2))))))))))) +\def + \lambda (k: K).(\lambda (v: T).(\lambda (u1: T).(\lambda (t1: T).(\lambda +(x: T).(\lambda (i: nat).(\lambda (H: (subst0 i v (THead k u1 t1) +x)).(subst0_inv_coq i v (THead k u1 t1) x (\lambda (n: nat).(\lambda (t: +T).(\lambda (_: T).(\lambda (t2: T).(or3 (ex2 T (\lambda (u2: T).(eq T t2 +(THead k u2 t1))) (\lambda (u2: T).(subst0 n t u1 u2))) (ex2 T (\lambda (t3: +T).(eq T t2 (THead k u1 t3))) (\lambda (t3: T).(subst0 (s k n) t t1 t3))) +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead k u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 n t u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s k n) t t1 t3))))))))) (\lambda (H0: (subst0 i +v (THead k u1 t1) x)).(\lambda (v0: T).(\lambda (i0: nat).(\lambda (H1: (eq +nat i0 i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: (eq T (TLRef i0) (THead k +u1 t1))).(\lambda (H4: (eq T (lift (S i0) O v0) x)).(let H5 \def (eq_ind nat +i0 (\lambda (n: nat).(eq T (lift (S n) O v0) x)) H4 i H1) in (let H6 \def +(eq_ind nat i0 (\lambda (n: nat).(eq T (TLRef n) (THead k u1 t1))) H3 i H1) +in (let H7 \def (eq_ind T v0 (\lambda (t: T).(eq T (lift (S i) O t) x)) H5 v +H2) in (let H8 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (THead k u1 t1) +t)) H0 (lift (S i) O v) H7) in (let H9 \def (eq_ind_r T x (\lambda (t: +T).(subst0 i v (THead k u1 t1) t)) H (lift (S i) O v) H7) in (eq_ind T (lift +(S i) O v) (\lambda (t: T).(or3 (ex2 T (\lambda (u2: T).(eq T t (THead k u2 +t1))) (\lambda (u2: T).(subst0 i v u1 u2))) (ex2 T (\lambda (t2: T).(eq T t +(THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T t (THead k u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s k i) v t1 t2)))))) (let H10 \def (eq_ind T (TLRef i) (\lambda +(ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow +False])) I (THead k u1 t1) H6) in (False_ind (or3 (ex2 T (\lambda (u2: T).(eq +T (lift (S i) O v) (THead k u2 t1))) (\lambda (u2: T).(subst0 i v u1 u2))) +(ex2 T (\lambda (t2: T).(eq T (lift (S i) O v) (THead k u1 t2))) (\lambda +(t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T (lift (S i) O v) (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i v u1 u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) v t1 +t2))))) H10)) x H7))))))))))))) (\lambda (H0: (subst0 i v (THead k u1 t1) +x)).(\lambda (v0: T).(\lambda (u2: T).(\lambda (u0: T).(\lambda (i0: +nat).(\lambda (t: T).(\lambda (k0: K).(\lambda (H1: (eq nat i0 i)).(\lambda +(H2: (eq T v0 v)).(\lambda (H3: (eq T (THead k0 u0 t) (THead k u1 +t1))).(\lambda (H4: (eq T (THead k0 u2 t) x)).(\lambda (H5: (subst0 i0 v0 u0 +u2)).(let H6 \def (eq_ind nat i0 (\lambda (n: nat).(subst0 n v0 u0 u2)) H5 i +H1) in (let H7 \def (eq_ind T v0 (\lambda (t0: T).(subst0 i t0 u0 u2)) H6 v +H2) in (let H8 \def (eq_ind_r T x (\lambda (t0: T).(subst0 i v (THead k u1 +t1) t0)) H0 (THead k0 u2 t) H4) in (let H9 \def (eq_ind_r T x (\lambda (t0: +T).(subst0 i v (THead k u1 t1) t0)) H (THead k0 u2 t) H4) in (eq_ind T (THead +k0 u2 t) (\lambda (t0: T).(or3 (ex2 T (\lambda (u3: T).(eq T t0 (THead k u3 +t1))) (\lambda (u3: T).(subst0 i v u1 u3))) (ex2 T (\lambda (t2: T).(eq T t0 +(THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T +(\lambda (u3: T).(\lambda (t2: T).(eq T t0 (THead k u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s k i) v t1 t2)))))) (let H10 \def (f_equal T K (\lambda (e: +T).(match e in T return (\lambda (_: T).K) with [(TSort _) \Rightarrow k0 | +(TLRef _) \Rightarrow k0 | (THead k1 _ _) \Rightarrow k1])) (THead k0 u0 t) +(THead k u1 t1) H3) in ((let H11 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) +\Rightarrow u0 | (THead _ t0 _) \Rightarrow t0])) (THead k0 u0 t) (THead k u1 +t1) H3) in ((let H12 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow t | (TLRef _) \Rightarrow t | +(THead _ _ t0) \Rightarrow t0])) (THead k0 u0 t) (THead k u1 t1) H3) in +(\lambda (H13: (eq T u0 u1)).(\lambda (H14: (eq K k0 k)).(let H15 \def +(eq_ind K k0 (\lambda (k1: K).(subst0 i v (THead k u1 t1) (THead k1 u2 t))) +H9 k H14) in (let H16 \def (eq_ind K k0 (\lambda (k1: K).(subst0 i v (THead k +u1 t1) (THead k1 u2 t))) H8 k H14) in (eq_ind_r K k (\lambda (k1: K).(or3 +(ex2 T (\lambda (u3: T).(eq T (THead k1 u2 t) (THead k u3 t1))) (\lambda (u3: +T).(subst0 i v u1 u3))) (ex2 T (\lambda (t2: T).(eq T (THead k1 u2 t) (THead +k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda +(u3: T).(\lambda (t2: T).(eq T (THead k1 u2 t) (THead k u3 t2)))) (\lambda +(u3: T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s k i) v t1 t2)))))) (let H17 \def (eq_ind T t (\lambda (t0: +T).(subst0 i v (THead k u1 t1) (THead k u2 t0))) H15 t1 H12) in (let H18 \def +(eq_ind T t (\lambda (t0: T).(subst0 i v (THead k u1 t1) (THead k u2 t0))) +H16 t1 H12) in (eq_ind_r T t1 (\lambda (t0: T).(or3 (ex2 T (\lambda (u3: +T).(eq T (THead k u2 t0) (THead k u3 t1))) (\lambda (u3: T).(subst0 i v u1 +u3))) (ex2 T (\lambda (t2: T).(eq T (THead k u2 t0) (THead k u1 t2))) +(\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u3: +T).(\lambda (t2: T).(eq T (THead k u2 t0) (THead k u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s k i) v t1 t2)))))) (let H19 \def (eq_ind T u0 (\lambda (t0: +T).(subst0 i v t0 u2)) H7 u1 H13) in (or3_intro0 (ex2 T (\lambda (u3: T).(eq +T (THead k u2 t1) (THead k u3 t1))) (\lambda (u3: T).(subst0 i v u1 u3))) +(ex2 T (\lambda (t2: T).(eq T (THead k u2 t1) (THead k u1 t2))) (\lambda (t2: +T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u3: T).(\lambda (t2: +T).(eq T (THead k u2 t1) (THead k u3 t2)))) (\lambda (u3: T).(\lambda (_: +T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) v t1 +t2)))) (ex_intro2 T (\lambda (u3: T).(eq T (THead k u2 t1) (THead k u3 t1))) +(\lambda (u3: T).(subst0 i v u1 u3)) u2 (refl_equal T (THead k u2 t1)) H19))) +t H12))) k0 H14)))))) H11)) H10)) x H4))))))))))))))))) (\lambda (H0: (subst0 +i v (THead k u1 t1) x)).(\lambda (k0: K).(\lambda (v0: T).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (i0: nat).(\lambda (u: T).(\lambda (H1: (eq nat +i0 i)).(\lambda (H2: (eq T v0 v)).(\lambda (H3: (eq T (THead k0 u t3) (THead +k u1 t1))).(\lambda (H4: (eq T (THead k0 u t0) x)).(\lambda (H5: (subst0 (s +k0 i0) v0 t3 t0)).(let H6 \def (eq_ind nat i0 (\lambda (n: nat).(subst0 (s k0 +n) v0 t3 t0)) H5 i H1) in (let H7 \def (eq_ind T v0 (\lambda (t: T).(subst0 +(s k0 i) t t3 t0)) H6 v H2) in (let H8 \def (eq_ind_r T x (\lambda (t: +T).(subst0 i v (THead k u1 t1) t)) H0 (THead k0 u t0) H4) in (let H9 \def +(eq_ind_r T x (\lambda (t: T).(subst0 i v (THead k u1 t1) t)) H (THead k0 u +t0) H4) in (eq_ind T (THead k0 u t0) (\lambda (t: T).(or3 (ex2 T (\lambda +(u2: T).(eq T t (THead k u2 t1))) (\lambda (u2: T).(subst0 i v u1 u2))) (ex2 +T (\lambda (t2: T).(eq T t (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) +v t1 t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T t (THead k u2 +t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(subst0 (s k i) v t1 t2)))))) (let H10 \def (f_equal T K +(\lambda (e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) +\Rightarrow k0 | (TLRef _) \Rightarrow k0 | (THead k1 _ _) \Rightarrow k1])) +(THead k0 u t3) (THead k u1 t1) H3) in ((let H11 \def (f_equal T T (\lambda +(e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u +| (TLRef _) \Rightarrow u | (THead _ t _) \Rightarrow t])) (THead k0 u t3) +(THead k u1 t1) H3) in ((let H12 \def (f_equal T T (\lambda (e: T).(match e +in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t3 | (TLRef _) +\Rightarrow t3 | (THead _ _ t) \Rightarrow t])) (THead k0 u t3) (THead k u1 +t1) H3) in (\lambda (H13: (eq T u u1)).(\lambda (H14: (eq K k0 k)).(let H15 +\def (eq_ind T u (\lambda (t: T).(subst0 i v (THead k u1 t1) (THead k0 t +t0))) H9 u1 H13) in (let H16 \def (eq_ind T u (\lambda (t: T).(subst0 i v +(THead k u1 t1) (THead k0 t t0))) H8 u1 H13) in (eq_ind_r T u1 (\lambda (t: +T).(or3 (ex2 T (\lambda (u2: T).(eq T (THead k0 t t0) (THead k u2 t1))) +(\lambda (u2: T).(subst0 i v u1 u2))) (ex2 T (\lambda (t2: T).(eq T (THead k0 +t t0) (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T +T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead k0 t t0) (THead k u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(subst0 (s k i) v t1 t2)))))) (let H17 \def (eq_ind T t3 +(\lambda (t: T).(subst0 (s k0 i) v t t0)) H7 t1 H12) in (let H18 \def (eq_ind +K k0 (\lambda (k1: K).(subst0 i v (THead k u1 t1) (THead k1 u1 t0))) H15 k +H14) in (let H19 \def (eq_ind K k0 (\lambda (k1: K).(subst0 i v (THead k u1 +t1) (THead k1 u1 t0))) H16 k H14) in (let H20 \def (eq_ind K k0 (\lambda (k1: +K).(subst0 (s k1 i) v t1 t0)) H17 k H14) in (eq_ind_r K k (\lambda (k1: +K).(or3 (ex2 T (\lambda (u2: T).(eq T (THead k1 u1 t0) (THead k u2 t1))) +(\lambda (u2: T).(subst0 i v u1 u2))) (ex2 T (\lambda (t2: T).(eq T (THead k1 +u1 t0) (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T +T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead k1 u1 t0) (THead k u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_: +T).(\lambda (t2: T).(subst0 (s k i) v t1 t2)))))) (or3_intro1 (ex2 T (\lambda +(u2: T).(eq T (THead k u1 t0) (THead k u2 t1))) (\lambda (u2: T).(subst0 i v +u1 u2))) (ex2 T (\lambda (t2: T).(eq T (THead k u1 t0) (THead k u1 t2))) +(\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T (THead k u1 t0) (THead k u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s k i) v t1 t2)))) (ex_intro2 T (\lambda (t2: T).(eq T (THead k +u1 t0) (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2)) t0 +(refl_equal T (THead k u1 t0)) H20)) k0 H14))))) u H13)))))) H11)) H10)) x +H4))))))))))))))))) (\lambda (H0: (subst0 i v (THead k u1 t1) x)).(\lambda +(v0: T).(\lambda (u0: T).(\lambda (u2: T).(\lambda (i0: nat).(\lambda (k0: +K).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H2: (eq nat i0 i)).(\lambda +(H3: (eq T v0 v)).(\lambda (H4: (eq T (THead k0 u0 t0) (THead k u1 +t1))).(\lambda (H5: (eq T (THead k0 u2 t3) x)).(\lambda (H1: (subst0 i0 v0 u0 +u2)).(\lambda (H6: (subst0 (s k0 i0) v0 t0 t3)).(let H7 \def (eq_ind nat i0 +(\lambda (n: nat).(subst0 (s k0 n) v0 t0 t3)) H6 i H2) in (let H8 \def +(eq_ind nat i0 (\lambda (n: nat).(subst0 n v0 u0 u2)) H1 i H2) in (let H9 +\def (eq_ind T v0 (\lambda (t: T).(subst0 (s k0 i) t t0 t3)) H7 v H3) in (let +H10 \def (eq_ind T v0 (\lambda (t: T).(subst0 i t u0 u2)) H8 v H3) in (let +H11 \def (eq_ind_r T x (\lambda (t: T).(subst0 i v (THead k u1 t1) t)) H0 +(THead k0 u2 t3) H5) in (let H12 \def (eq_ind_r T x (\lambda (t: T).(subst0 i +v (THead k u1 t1) t)) H (THead k0 u2 t3) H5) in (eq_ind T (THead k0 u2 t3) +(\lambda (t: T).(or3 (ex2 T (\lambda (u3: T).(eq T t (THead k u3 t1))) +(\lambda (u3: T).(subst0 i v u1 u3))) (ex2 T (\lambda (t2: T).(eq T t (THead +k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda +(u3: T).(\lambda (t2: T).(eq T t (THead k u3 t2)))) (\lambda (u3: T).(\lambda +(_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) +v t1 t2)))))) (let H13 \def (f_equal T K (\lambda (e: T).(match e in T return +(\lambda (_: T).K) with [(TSort _) \Rightarrow k0 | (TLRef _) \Rightarrow k0 +| (THead k1 _ _) \Rightarrow k1])) (THead k0 u0 t0) (THead k u1 t1) H4) in +((let H14 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 | (THead _ t +_) \Rightarrow t])) (THead k0 u0 t0) (THead k u1 t1) H4) in ((let H15 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t) +\Rightarrow t])) (THead k0 u0 t0) (THead k u1 t1) H4) in (\lambda (H16: (eq T +u0 u1)).(\lambda (H17: (eq K k0 k)).(let H18 \def (eq_ind T t0 (\lambda (t: +T).(subst0 (s k0 i) v t t3)) H9 t1 H15) in (let H19 \def (eq_ind K k0 +(\lambda (k1: K).(subst0 i v (THead k u1 t1) (THead k1 u2 t3))) H12 k H17) in +(let H20 \def (eq_ind K k0 (\lambda (k1: K).(subst0 i v (THead k u1 t1) +(THead k1 u2 t3))) H11 k H17) in (let H21 \def (eq_ind K k0 (\lambda (k1: +K).(subst0 (s k1 i) v t1 t3)) H18 k H17) in (eq_ind_r K k (\lambda (k1: +K).(or3 (ex2 T (\lambda (u3: T).(eq T (THead k1 u2 t3) (THead k u3 t1))) +(\lambda (u3: T).(subst0 i v u1 u3))) (ex2 T (\lambda (t2: T).(eq T (THead k1 +u2 t3) (THead k u1 t2))) (\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T +T (\lambda (u3: T).(\lambda (t2: T).(eq T (THead k1 u2 t3) (THead k u3 t2)))) +(\lambda (u3: T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_: +T).(\lambda (t2: T).(subst0 (s k i) v t1 t2)))))) (let H22 \def (eq_ind T u0 +(\lambda (t: T).(subst0 i v t u2)) H10 u1 H16) in (or3_intro2 (ex2 T (\lambda +(u3: T).(eq T (THead k u2 t3) (THead k u3 t1))) (\lambda (u3: T).(subst0 i v +u1 u3))) (ex2 T (\lambda (t2: T).(eq T (THead k u2 t3) (THead k u1 t2))) +(\lambda (t2: T).(subst0 (s k i) v t1 t2))) (ex3_2 T T (\lambda (u3: +T).(\lambda (t2: T).(eq T (THead k u2 t3) (THead k u3 t2)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s k i) v t1 t2)))) (ex3_2_intro T T (\lambda (u3: T).(\lambda +(t2: T).(eq T (THead k u2 t3) (THead k u3 t2)))) (\lambda (u3: T).(\lambda +(_: T).(subst0 i v u1 u3))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) +v t1 t2))) u2 t3 (refl_equal T (THead k u2 t3)) H22 H21))) k0 H17)))))))) +H14)) H13)) x H5))))))))))))))))))))) H))))))). + +theorem subst0_gen_lift_lt: + \forall (u: T).(\forall (t1: T).(\forall (x: T).(\forall (i: nat).(\forall +(h: nat).(\forall (d: nat).((subst0 i (lift h d u) (lift h (S (plus i d)) t1) +x) \to (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d)) t2))) (\lambda +(t2: T).(subst0 i u t1 t2))))))))) +\def + \lambda (u: T).(\lambda (t1: T).(T_ind (\lambda (t: T).(\forall (x: +T).(\forall (i: nat).(\forall (h: nat).(\forall (d: nat).((subst0 i (lift h d +u) (lift h (S (plus i d)) t) x) \to (ex2 T (\lambda (t2: T).(eq T x (lift h +(S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u t t2))))))))) (\lambda (n: +nat).(\lambda (x: T).(\lambda (i: nat).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H: (subst0 i (lift h d u) (lift h (S (plus i d)) (TSort n)) +x)).(let H0 \def (eq_ind T (lift h (S (plus i d)) (TSort n)) (\lambda (t: +T).(subst0 i (lift h d u) t x)) H (TSort n) (lift_sort n h (S (plus i d)))) +in (subst0_gen_sort (lift h d u) x i n H0 (ex2 T (\lambda (t2: T).(eq T x +(lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TSort n) +t2))))))))))) (\lambda (n: nat).(\lambda (x: T).(\lambda (i: nat).(\lambda +(h: nat).(\lambda (d: nat).(\lambda (H: (subst0 i (lift h d u) (lift h (S +(plus i d)) (TLRef n)) x)).(lt_le_e n (S (plus i d)) (ex2 T (\lambda (t2: +T).(eq T x (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TLRef +n) t2))) (\lambda (H0: (lt n (S (plus i d)))).(let H1 \def (eq_ind T (lift h +(S (plus i d)) (TLRef n)) (\lambda (t: T).(subst0 i (lift h d u) t x)) H +(TLRef n) (lift_lref_lt n h (S (plus i d)) H0)) in (and_ind (eq nat n i) (eq +T x (lift (S n) O (lift h d u))) (ex2 T (\lambda (t2: T).(eq T x (lift h (S +(plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TLRef n) t2))) (\lambda (H2: +(eq nat n i)).(\lambda (H3: (eq T x (lift (S n) O (lift h d u)))).(eq_ind_r T +(lift (S n) O (lift h d u)) (\lambda (t: T).(ex2 T (\lambda (t2: T).(eq T t +(lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TLRef n) t2)))) +(eq_ind_r nat i (\lambda (n0: nat).(ex2 T (\lambda (t2: T).(eq T (lift (S n0) +O (lift h d u)) (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u +(TLRef n0) t2)))) (eq_ind T (lift h (plus (S i) d) (lift (S i) O u)) (\lambda +(t: T).(ex2 T (\lambda (t2: T).(eq T t (lift h (S (plus i d)) t2))) (\lambda +(t2: T).(subst0 i u (TLRef i) t2)))) (ex_intro2 T (\lambda (t2: T).(eq T +(lift h (S (plus i d)) (lift (S i) O u)) (lift h (S (plus i d)) t2))) +(\lambda (t2: T).(subst0 i u (TLRef i) t2)) (lift (S i) O u) (refl_equal T +(lift h (S (plus i d)) (lift (S i) O u))) (subst0_lref u i)) (lift (S i) O +(lift h d u)) (lift_d u h (S i) d O (le_O_n d))) n H2) x H3))) +(subst0_gen_lref (lift h d u) x i n H1)))) (\lambda (H0: (le (S (plus i d)) +n)).(let H1 \def (eq_ind T (lift h (S (plus i d)) (TLRef n)) (\lambda (t: +T).(subst0 i (lift h d u) t x)) H (TLRef (plus n h)) (lift_lref_ge n h (S +(plus i d)) H0)) in (and_ind (eq nat (plus n h) i) (eq T x (lift (S (plus n +h)) O (lift h d u))) (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d)) +t2))) (\lambda (t2: T).(subst0 i u (TLRef n) t2))) (\lambda (H2: (eq nat +(plus n h) i)).(\lambda (_: (eq T x (lift (S (plus n h)) O (lift h d +u)))).(let H4 \def (eq_ind_r nat i (\lambda (n0: nat).(le (S (plus n0 d)) n)) +H0 (plus n h) H2) in (le_false n (plus (plus n h) d) (ex2 T (\lambda (t2: +T).(eq T x (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (TLRef +n) t2))) (le_plus_trans n (plus n h) d (le_plus_l n h)) H4)))) +(subst0_gen_lref (lift h d u) x i (plus n h) H1))))))))))) (\lambda (k: +K).(\lambda (t: T).(\lambda (H: ((\forall (x: T).(\forall (i: nat).(\forall +(h: nat).(\forall (d: nat).((subst0 i (lift h d u) (lift h (S (plus i d)) t) +x) \to (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d)) t2))) (\lambda +(t2: T).(subst0 i u t t2)))))))))).(\lambda (t0: T).(\lambda (H0: ((\forall +(x: T).(\forall (i: nat).(\forall (h: nat).(\forall (d: nat).((subst0 i (lift +h d u) (lift h (S (plus i d)) t0) x) \to (ex2 T (\lambda (t2: T).(eq T x +(lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u t0 +t2)))))))))).(\lambda (x: T).(\lambda (i: nat).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H1: (subst0 i (lift h d u) (lift h (S (plus i d)) (THead k t +t0)) x)).(let H2 \def (eq_ind T (lift h (S (plus i d)) (THead k t t0)) +(\lambda (t2: T).(subst0 i (lift h d u) t2 x)) H1 (THead k (lift h (S (plus i +d)) t) (lift h (s k (S (plus i d))) t0)) (lift_head k t t0 h (S (plus i d)))) +in (or3_ind (ex2 T (\lambda (u2: T).(eq T x (THead k u2 (lift h (s k (S (plus +i d))) t0)))) (\lambda (u2: T).(subst0 i (lift h d u) (lift h (S (plus i d)) +t) u2))) (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h (S (plus i d)) t) +t2))) (\lambda (t2: T).(subst0 (s k i) (lift h d u) (lift h (s k (S (plus i +d))) t0) t2))) (ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead k +u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i (lift h d u) (lift h (S +(plus i d)) t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) (lift h +d u) (lift h (s k (S (plus i d))) t0) t2)))) (ex2 T (\lambda (t2: T).(eq T x +(lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) +t2))) (\lambda (H3: (ex2 T (\lambda (u2: T).(eq T x (THead k u2 (lift h (s k +(S (plus i d))) t0)))) (\lambda (u2: T).(subst0 i (lift h d u) (lift h (S +(plus i d)) t) u2)))).(ex2_ind T (\lambda (u2: T).(eq T x (THead k u2 (lift h +(s k (S (plus i d))) t0)))) (\lambda (u2: T).(subst0 i (lift h d u) (lift h +(S (plus i d)) t) u2)) (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d)) +t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2))) (\lambda (x0: +T).(\lambda (H4: (eq T x (THead k x0 (lift h (s k (S (plus i d))) +t0)))).(\lambda (H5: (subst0 i (lift h d u) (lift h (S (plus i d)) t) +x0)).(eq_ind_r T (THead k x0 (lift h (s k (S (plus i d))) t0)) (\lambda (t2: +T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda +(t3: T).(subst0 i u (THead k t t0) t3)))) (ex2_ind T (\lambda (t2: T).(eq T +x0 (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u t t2)) (ex2 T +(\lambda (t2: T).(eq T (THead k x0 (lift h (s k (S (plus i d))) t0)) (lift h +(S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2))) +(\lambda (x1: T).(\lambda (H6: (eq T x0 (lift h (S (plus i d)) x1))).(\lambda +(H7: (subst0 i u t x1)).(eq_ind_r T (lift h (S (plus i d)) x1) (\lambda (t2: +T).(ex2 T (\lambda (t3: T).(eq T (THead k t2 (lift h (s k (S (plus i d))) +t0)) (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i u (THead k t t0) +t3)))) (eq_ind T (lift h (S (plus i d)) (THead k x1 t0)) (\lambda (t2: +T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda +(t3: T).(subst0 i u (THead k t t0) t3)))) (ex_intro2 T (\lambda (t2: T).(eq T +(lift h (S (plus i d)) (THead k x1 t0)) (lift h (S (plus i d)) t2))) (\lambda +(t2: T).(subst0 i u (THead k t t0) t2)) (THead k x1 t0) (refl_equal T (lift h +(S (plus i d)) (THead k x1 t0))) (subst0_fst u x1 t i H7 t0 k)) (THead k +(lift h (S (plus i d)) x1) (lift h (s k (S (plus i d))) t0)) (lift_head k x1 +t0 h (S (plus i d)))) x0 H6)))) (H x0 i h d H5)) x H4)))) H3)) (\lambda (H3: +(ex2 T (\lambda (t2: T).(eq T x (THead k (lift h (S (plus i d)) t) t2))) +(\lambda (t2: T).(subst0 (s k i) (lift h d u) (lift h (s k (S (plus i d))) +t0) t2)))).(ex2_ind T (\lambda (t2: T).(eq T x (THead k (lift h (S (plus i +d)) t) t2))) (\lambda (t2: T).(subst0 (s k i) (lift h d u) (lift h (s k (S +(plus i d))) t0) t2)) (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d)) +t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2))) (\lambda (x0: +T).(\lambda (H4: (eq T x (THead k (lift h (S (plus i d)) t) x0))).(\lambda +(H5: (subst0 (s k i) (lift h d u) (lift h (s k (S (plus i d))) t0) +x0)).(eq_ind_r T (THead k (lift h (S (plus i d)) t) x0) (\lambda (t2: T).(ex2 +T (\lambda (t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda (t3: +T).(subst0 i u (THead k t t0) t3)))) (let H6 \def (eq_ind nat (s k (S (plus i +d))) (\lambda (n: nat).(subst0 (s k i) (lift h d u) (lift h n t0) x0)) H5 (S +(s k (plus i d))) (s_S k (plus i d))) in (let H7 \def (eq_ind nat (s k (plus +i d)) (\lambda (n: nat).(subst0 (s k i) (lift h d u) (lift h (S n) t0) x0)) +H6 (plus (s k i) d) (s_plus k i d)) in (ex2_ind T (\lambda (t2: T).(eq T x0 +(lift h (S (plus (s k i) d)) t2))) (\lambda (t2: T).(subst0 (s k i) u t0 t2)) +(ex2 T (\lambda (t2: T).(eq T (THead k (lift h (S (plus i d)) t) x0) (lift h +(S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2))) +(\lambda (x1: T).(\lambda (H8: (eq T x0 (lift h (S (plus (s k i) d)) +x1))).(\lambda (H9: (subst0 (s k i) u t0 x1)).(eq_ind_r T (lift h (S (plus (s +k i) d)) x1) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead k (lift h +(S (plus i d)) t) t2) (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i +u (THead k t t0) t3)))) (eq_ind nat (s k (plus i d)) (\lambda (n: nat).(ex2 T +(\lambda (t2: T).(eq T (THead k (lift h (S (plus i d)) t) (lift h (S n) x1)) +(lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) +t2)))) (eq_ind nat (s k (S (plus i d))) (\lambda (n: nat).(ex2 T (\lambda +(t2: T).(eq T (THead k (lift h (S (plus i d)) t) (lift h n x1)) (lift h (S +(plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2)))) (eq_ind +T (lift h (S (plus i d)) (THead k t x1)) (\lambda (t2: T).(ex2 T (\lambda +(t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i u +(THead k t t0) t3)))) (ex_intro2 T (\lambda (t2: T).(eq T (lift h (S (plus i +d)) (THead k t x1)) (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u +(THead k t t0) t2)) (THead k t x1) (refl_equal T (lift h (S (plus i d)) +(THead k t x1))) (subst0_snd k u x1 t0 i H9 t)) (THead k (lift h (S (plus i +d)) t) (lift h (s k (S (plus i d))) x1)) (lift_head k t x1 h (S (plus i d)))) +(S (s k (plus i d))) (s_S k (plus i d))) (plus (s k i) d) (s_plus k i d)) x0 +H8)))) (H0 x0 (s k i) h d H7)))) x H4)))) H3)) (\lambda (H3: (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i (lift h d u) (lift h (S (plus i d)) t) u2))) +(\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) (lift h d u) (lift h (s k (S +(plus i d))) t0) t2))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t2: T).(eq +T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i (lift h d +u) (lift h (S (plus i d)) t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 +(s k i) (lift h d u) (lift h (s k (S (plus i d))) t0) t2))) (ex2 T (\lambda +(t2: T).(eq T x (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u +(THead k t t0) t2))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T x +(THead k x0 x1))).(\lambda (H5: (subst0 i (lift h d u) (lift h (S (plus i d)) +t) x0)).(\lambda (H6: (subst0 (s k i) (lift h d u) (lift h (s k (S (plus i +d))) t0) x1)).(eq_ind_r T (THead k x0 x1) (\lambda (t2: T).(ex2 T (\lambda +(t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i u +(THead k t t0) t3)))) (let H7 \def (eq_ind nat (s k (S (plus i d))) (\lambda +(n: nat).(subst0 (s k i) (lift h d u) (lift h n t0) x1)) H6 (S (s k (plus i +d))) (s_S k (plus i d))) in (let H8 \def (eq_ind nat (s k (plus i d)) +(\lambda (n: nat).(subst0 (s k i) (lift h d u) (lift h (S n) t0) x1)) H7 +(plus (s k i) d) (s_plus k i d)) in (ex2_ind T (\lambda (t2: T).(eq T x1 +(lift h (S (plus (s k i) d)) t2))) (\lambda (t2: T).(subst0 (s k i) u t0 t2)) +(ex2 T (\lambda (t2: T).(eq T (THead k x0 x1) (lift h (S (plus i d)) t2))) +(\lambda (t2: T).(subst0 i u (THead k t t0) t2))) (\lambda (x2: T).(\lambda +(H9: (eq T x1 (lift h (S (plus (s k i) d)) x2))).(\lambda (H10: (subst0 (s k +i) u t0 x2)).(ex2_ind T (\lambda (t2: T).(eq T x0 (lift h (S (plus i d)) +t2))) (\lambda (t2: T).(subst0 i u t t2)) (ex2 T (\lambda (t2: T).(eq T +(THead k x0 x1) (lift h (S (plus i d)) t2))) (\lambda (t2: T).(subst0 i u +(THead k t t0) t2))) (\lambda (x3: T).(\lambda (H11: (eq T x0 (lift h (S +(plus i d)) x3))).(\lambda (H12: (subst0 i u t x3)).(eq_ind_r T (lift h (S +(plus i d)) x3) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead k t2 +x1) (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst0 i u (THead k t t0) +t3)))) (eq_ind_r T (lift h (S (plus (s k i) d)) x2) (\lambda (t2: T).(ex2 T +(\lambda (t3: T).(eq T (THead k (lift h (S (plus i d)) x3) t2) (lift h (S +(plus i d)) t3))) (\lambda (t3: T).(subst0 i u (THead k t t0) t3)))) (eq_ind +nat (s k (plus i d)) (\lambda (n: nat).(ex2 T (\lambda (t2: T).(eq T (THead k +(lift h (S (plus i d)) x3) (lift h (S n) x2)) (lift h (S (plus i d)) t2))) +(\lambda (t2: T).(subst0 i u (THead k t t0) t2)))) (eq_ind nat (s k (S (plus +i d))) (\lambda (n: nat).(ex2 T (\lambda (t2: T).(eq T (THead k (lift h (S +(plus i d)) x3) (lift h n x2)) (lift h (S (plus i d)) t2))) (\lambda (t2: +T).(subst0 i u (THead k t t0) t2)))) (eq_ind T (lift h (S (plus i d)) (THead +k x3 x2)) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h (S (plus +i d)) t3))) (\lambda (t3: T).(subst0 i u (THead k t t0) t3)))) (ex_intro2 T +(\lambda (t2: T).(eq T (lift h (S (plus i d)) (THead k x3 x2)) (lift h (S +(plus i d)) t2))) (\lambda (t2: T).(subst0 i u (THead k t t0) t2)) (THead k +x3 x2) (refl_equal T (lift h (S (plus i d)) (THead k x3 x2))) (subst0_both u +t x3 i H12 k t0 x2 H10)) (THead k (lift h (S (plus i d)) x3) (lift h (s k (S +(plus i d))) x2)) (lift_head k x3 x2 h (S (plus i d)))) (S (s k (plus i d))) +(s_S k (plus i d))) (plus (s k i) d) (s_plus k i d)) x1 H9) x0 H11)))) (H x0 +i h d H5))))) (H0 x1 (s k i) h d H8)))) x H4)))))) H3)) (subst0_gen_head k +(lift h d u) (lift h (S (plus i d)) t) (lift h (s k (S (plus i d))) t0) x i +H2))))))))))))) t1)). + +theorem subst0_gen_lift_false: + \forall (t: T).(\forall (u: T).(\forall (x: T).(\forall (h: nat).(\forall +(d: nat).(\forall (i: nat).((le d i) \to ((lt i (plus d h)) \to ((subst0 i u +(lift h d t) x) \to (\forall (P: Prop).P))))))))) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(\forall (u: T).(\forall (x: +T).(\forall (h: nat).(\forall (d: nat).(\forall (i: nat).((le d i) \to ((lt i +(plus d h)) \to ((subst0 i u (lift h d t0) x) \to (\forall (P: +Prop).P)))))))))) (\lambda (n: nat).(\lambda (u: T).(\lambda (x: T).(\lambda +(h: nat).(\lambda (d: nat).(\lambda (i: nat).(\lambda (_: (le d i)).(\lambda +(_: (lt i (plus d h))).(\lambda (H1: (subst0 i u (lift h d (TSort n)) +x)).(\lambda (P: Prop).(let H2 \def (eq_ind T (lift h d (TSort n)) (\lambda +(t0: T).(subst0 i u t0 x)) H1 (TSort n) (lift_sort n h d)) in +(subst0_gen_sort u x i n H2 P)))))))))))) (\lambda (n: nat).(\lambda (u: +T).(\lambda (x: T).(\lambda (h: nat).(\lambda (d: nat).(\lambda (i: +nat).(\lambda (H: (le d i)).(\lambda (H0: (lt i (plus d h))).(\lambda (H1: +(subst0 i u (lift h d (TLRef n)) x)).(\lambda (P: Prop).(lt_le_e n d P +(\lambda (H2: (lt n d)).(let H3 \def (eq_ind T (lift h d (TLRef n)) (\lambda +(t0: T).(subst0 i u t0 x)) H1 (TLRef n) (lift_lref_lt n h d H2)) in (and_ind +(eq nat n i) (eq T x (lift (S n) O u)) P (\lambda (H4: (eq nat n i)).(\lambda +(_: (eq T x (lift (S n) O u))).(let H6 \def (eq_ind nat n (\lambda (n0: +nat).(lt n0 d)) H2 i H4) in (le_false d i P H H6)))) (subst0_gen_lref u x i n +H3)))) (\lambda (H2: (le d n)).(let H3 \def (eq_ind T (lift h d (TLRef n)) +(\lambda (t0: T).(subst0 i u t0 x)) H1 (TLRef (plus n h)) (lift_lref_ge n h d +H2)) in (and_ind (eq nat (plus n h) i) (eq T x (lift (S (plus n h)) O u)) P +(\lambda (H4: (eq nat (plus n h) i)).(\lambda (_: (eq T x (lift (S (plus n +h)) O u))).(let H6 \def (eq_ind_r nat i (\lambda (n0: nat).(lt n0 (plus d +h))) H0 (plus n h) H4) in (le_false d n P H2 (lt_le_S n d (simpl_lt_plus_r h +n d H6)))))) (subst0_gen_lref u x i (plus n h) H3))))))))))))))) (\lambda (k: +K).(\lambda (t0: T).(\lambda (H: ((\forall (u: T).(\forall (x: T).(\forall +(h: nat).(\forall (d: nat).(\forall (i: nat).((le d i) \to ((lt i (plus d h)) +\to ((subst0 i u (lift h d t0) x) \to (\forall (P: +Prop).P))))))))))).(\lambda (t1: T).(\lambda (H0: ((\forall (u: T).(\forall +(x: T).(\forall (h: nat).(\forall (d: nat).(\forall (i: nat).((le d i) \to +((lt i (plus d h)) \to ((subst0 i u (lift h d t1) x) \to (\forall (P: +Prop).P))))))))))).(\lambda (u: T).(\lambda (x: T).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (i: nat).(\lambda (H1: (le d i)).(\lambda (H2: (lt i (plus +d h))).(\lambda (H3: (subst0 i u (lift h d (THead k t0 t1)) x)).(\lambda (P: +Prop).(let H4 \def (eq_ind T (lift h d (THead k t0 t1)) (\lambda (t2: +T).(subst0 i u t2 x)) H3 (THead k (lift h d t0) (lift h (s k d) t1)) +(lift_head k t0 t1 h d)) in (or3_ind (ex2 T (\lambda (u2: T).(eq T x (THead k +u2 (lift h (s k d) t1)))) (\lambda (u2: T).(subst0 i u (lift h d t0) u2))) +(ex2 T (\lambda (t2: T).(eq T x (THead k (lift h d t0) t2))) (\lambda (t2: +T).(subst0 (s k i) u (lift h (s k d) t1) t2))) (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i u (lift h d t0) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 +(s k i) u (lift h (s k d) t1) t2)))) P (\lambda (H5: (ex2 T (\lambda (u2: +T).(eq T x (THead k u2 (lift h (s k d) t1)))) (\lambda (u2: T).(subst0 i u +(lift h d t0) u2)))).(ex2_ind T (\lambda (u2: T).(eq T x (THead k u2 (lift h +(s k d) t1)))) (\lambda (u2: T).(subst0 i u (lift h d t0) u2)) P (\lambda +(x0: T).(\lambda (_: (eq T x (THead k x0 (lift h (s k d) t1)))).(\lambda (H7: +(subst0 i u (lift h d t0) x0)).(H u x0 h d i H1 H2 H7 P)))) H5)) (\lambda +(H5: (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h d t0) t2))) (\lambda +(t2: T).(subst0 (s k i) u (lift h (s k d) t1) t2)))).(ex2_ind T (\lambda (t2: +T).(eq T x (THead k (lift h d t0) t2))) (\lambda (t2: T).(subst0 (s k i) u +(lift h (s k d) t1) t2)) P (\lambda (x0: T).(\lambda (_: (eq T x (THead k +(lift h d t0) x0))).(\lambda (H7: (subst0 (s k i) u (lift h (s k d) t1) +x0)).(H0 u x0 h (s k d) (s k i) (s_le k d i H1) (eq_ind nat (s k (plus d h)) +(\lambda (n: nat).(lt (s k i) n)) (lt_le_S (s k i) (s k (plus d h)) (s_lt k i +(plus d h) H2)) (plus (s k d) h) (s_plus k d h)) H7 P)))) H5)) (\lambda (H5: +(ex3_2 T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u (lift h d t0) u2))) (\lambda (_: +T).(\lambda (t2: T).(subst0 (s k i) u (lift h (s k d) t1) t2))))).(ex3_2_ind +T T (\lambda (u2: T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda +(u2: T).(\lambda (_: T).(subst0 i u (lift h d t0) u2))) (\lambda (_: +T).(\lambda (t2: T).(subst0 (s k i) u (lift h (s k d) t1) t2))) P (\lambda +(x0: T).(\lambda (x1: T).(\lambda (_: (eq T x (THead k x0 x1))).(\lambda (H7: +(subst0 i u (lift h d t0) x0)).(\lambda (_: (subst0 (s k i) u (lift h (s k d) +t1) x1)).(H u x0 h d i H1 H2 H7 P)))))) H5)) (subst0_gen_head k u (lift h d +t0) (lift h (s k d) t1) x i H4))))))))))))))))) t). + +theorem subst0_gen_lift_ge: + \forall (u: T).(\forall (t1: T).(\forall (x: T).(\forall (i: nat).(\forall +(h: nat).(\forall (d: nat).((subst0 i u (lift h d t1) x) \to ((le (plus d h) +i) \to (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: +T).(subst0 (minus i h) u t1 t2)))))))))) +\def + \lambda (u: T).(\lambda (t1: T).(T_ind (\lambda (t: T).(\forall (x: +T).(\forall (i: nat).(\forall (h: nat).(\forall (d: nat).((subst0 i u (lift h +d t) x) \to ((le (plus d h) i) \to (ex2 T (\lambda (t2: T).(eq T x (lift h d +t2))) (\lambda (t2: T).(subst0 (minus i h) u t t2)))))))))) (\lambda (n: +nat).(\lambda (x: T).(\lambda (i: nat).(\lambda (h: nat).(\lambda (d: +nat).(\lambda (H: (subst0 i u (lift h d (TSort n)) x)).(\lambda (_: (le (plus +d h) i)).(let H1 \def (eq_ind T (lift h d (TSort n)) (\lambda (t: T).(subst0 +i u t x)) H (TSort n) (lift_sort n h d)) in (subst0_gen_sort u x i n H1 (ex2 +T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(subst0 (minus i +h) u (TSort n) t2)))))))))))) (\lambda (n: nat).(\lambda (x: T).(\lambda (i: +nat).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H: (subst0 i u (lift h d +(TLRef n)) x)).(\lambda (H0: (le (plus d h) i)).(lt_le_e n d (ex2 T (\lambda +(t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (TLRef +n) t2))) (\lambda (H1: (lt n d)).(let H2 \def (eq_ind T (lift h d (TLRef n)) +(\lambda (t: T).(subst0 i u t x)) H (TLRef n) (lift_lref_lt n h d H1)) in +(and_ind (eq nat n i) (eq T x (lift (S n) O u)) (ex2 T (\lambda (t2: T).(eq T +x (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (TLRef n) t2))) +(\lambda (H3: (eq nat n i)).(\lambda (_: (eq T x (lift (S n) O u))).(let H5 +\def (eq_ind nat n (\lambda (n0: nat).(lt n0 d)) H1 i H3) in (le_false (plus +d h) i (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: +T).(subst0 (minus i h) u (TLRef n) t2))) H0 (le_plus_trans (S i) d h H5))))) +(subst0_gen_lref u x i n H2)))) (\lambda (H1: (le d n)).(let H2 \def (eq_ind +T (lift h d (TLRef n)) (\lambda (t: T).(subst0 i u t x)) H (TLRef (plus n h)) +(lift_lref_ge n h d H1)) in (and_ind (eq nat (plus n h) i) (eq T x (lift (S +(plus n h)) O u)) (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda +(t2: T).(subst0 (minus i h) u (TLRef n) t2))) (\lambda (H3: (eq nat (plus n +h) i)).(\lambda (H4: (eq T x (lift (S (plus n h)) O u))).(eq_ind nat (plus n +h) (\lambda (n0: nat).(ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) +(\lambda (t2: T).(subst0 (minus n0 h) u (TLRef n) t2)))) (eq_ind_r T (lift (S +(plus n h)) O u) (\lambda (t: T).(ex2 T (\lambda (t2: T).(eq T t (lift h d +t2))) (\lambda (t2: T).(subst0 (minus (plus n h) h) u (TLRef n) t2)))) +(eq_ind_r nat n (\lambda (n0: nat).(ex2 T (\lambda (t2: T).(eq T (lift (S +(plus n h)) O u) (lift h d t2))) (\lambda (t2: T).(subst0 n0 u (TLRef n) +t2)))) (ex_intro2 T (\lambda (t2: T).(eq T (lift (S (plus n h)) O u) (lift h +d t2))) (\lambda (t2: T).(subst0 n u (TLRef n) t2)) (lift (S n) O u) +(eq_ind_r T (lift (plus h (S n)) O u) (\lambda (t: T).(eq T (lift (S (plus n +h)) O u) t)) (eq_ind_r nat (plus h n) (\lambda (n0: nat).(eq T (lift (S n0) O +u) (lift (plus h (S n)) O u))) (eq_ind_r nat (plus h (S n)) (\lambda (n0: +nat).(eq T (lift n0 O u) (lift (plus h (S n)) O u))) (refl_equal T (lift +(plus h (S n)) O u)) (S (plus h n)) (plus_n_Sm h n)) (plus n h) (plus_comm n +h)) (lift h d (lift (S n) O u)) (lift_free u (S n) h O d (le_trans_plus_r O d +(plus O (S n)) (plus_le_compat O O d (S n) (le_n O) (le_S d n H1))) (le_O_n +d))) (subst0_lref u n)) (minus (plus n h) h) (minus_plus_r n h)) x H4) i +H3))) (subst0_gen_lref u x i (plus n h) H2)))))))))))) (\lambda (k: +K).(\lambda (t: T).(\lambda (H: ((\forall (x: T).(\forall (i: nat).(\forall +(h: nat).(\forall (d: nat).((subst0 i u (lift h d t) x) \to ((le (plus d h) +i) \to (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: +T).(subst0 (minus i h) u t t2))))))))))).(\lambda (t0: T).(\lambda (H0: +((\forall (x: T).(\forall (i: nat).(\forall (h: nat).(\forall (d: +nat).((subst0 i u (lift h d t0) x) \to ((le (plus d h) i) \to (ex2 T (\lambda +(t2: T).(eq T x (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u t0 +t2))))))))))).(\lambda (x: T).(\lambda (i: nat).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (H1: (subst0 i u (lift h d (THead k t t0)) x)).(\lambda +(H2: (le (plus d h) i)).(let H3 \def (eq_ind T (lift h d (THead k t t0)) +(\lambda (t2: T).(subst0 i u t2 x)) H1 (THead k (lift h d t) (lift h (s k d) +t0)) (lift_head k t t0 h d)) in (or3_ind (ex2 T (\lambda (u2: T).(eq T x +(THead k u2 (lift h (s k d) t0)))) (\lambda (u2: T).(subst0 i u (lift h d t) +u2))) (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h d t) t2))) (\lambda +(t2: T).(subst0 (s k i) u (lift h (s k d) t0) t2))) (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i u (lift h d t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s +k i) u (lift h (s k d) t0) t2)))) (ex2 T (\lambda (t2: T).(eq T x (lift h d +t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda +(H4: (ex2 T (\lambda (u2: T).(eq T x (THead k u2 (lift h (s k d) t0)))) +(\lambda (u2: T).(subst0 i u (lift h d t) u2)))).(ex2_ind T (\lambda (u2: +T).(eq T x (THead k u2 (lift h (s k d) t0)))) (\lambda (u2: T).(subst0 i u +(lift h d t) u2)) (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda +(t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda (x0: T).(\lambda +(H5: (eq T x (THead k x0 (lift h (s k d) t0)))).(\lambda (H6: (subst0 i u +(lift h d t) x0)).(eq_ind_r T (THead k x0 (lift h (s k d) t0)) (\lambda (t2: +T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(subst0 +(minus i h) u (THead k t t0) t3)))) (ex2_ind T (\lambda (t2: T).(eq T x0 +(lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u t t2)) (ex2 T (\lambda +(t2: T).(eq T (THead k x0 (lift h (s k d) t0)) (lift h d t2))) (\lambda (t2: +T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda (x1: T).(\lambda (H7: +(eq T x0 (lift h d x1))).(\lambda (H8: (subst0 (minus i h) u t x1)).(eq_ind_r +T (lift h d x1) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead k t2 +(lift h (s k d) t0)) (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u +(THead k t t0) t3)))) (eq_ind T (lift h d (THead k x1 t0)) (\lambda (t2: +T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(subst0 +(minus i h) u (THead k t t0) t3)))) (ex_intro2 T (\lambda (t2: T).(eq T (lift +h d (THead k x1 t0)) (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u +(THead k t t0) t2)) (THead k x1 t0) (refl_equal T (lift h d (THead k x1 t0))) +(subst0_fst u x1 t (minus i h) H8 t0 k)) (THead k (lift h d x1) (lift h (s k +d) t0)) (lift_head k x1 t0 h d)) x0 H7)))) (H x0 i h d H6 H2)) x H5)))) H4)) +(\lambda (H4: (ex2 T (\lambda (t2: T).(eq T x (THead k (lift h d t) t2))) +(\lambda (t2: T).(subst0 (s k i) u (lift h (s k d) t0) t2)))).(ex2_ind T +(\lambda (t2: T).(eq T x (THead k (lift h d t) t2))) (\lambda (t2: T).(subst0 +(s k i) u (lift h (s k d) t0) t2)) (ex2 T (\lambda (t2: T).(eq T x (lift h d +t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda +(x0: T).(\lambda (H5: (eq T x (THead k (lift h d t) x0))).(\lambda (H6: +(subst0 (s k i) u (lift h (s k d) t0) x0)).(eq_ind_r T (THead k (lift h d t) +x0) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h d t3))) +(\lambda (t3: T).(subst0 (minus i h) u (THead k t t0) t3)))) (ex2_ind T +(\lambda (t2: T).(eq T x0 (lift h (s k d) t2))) (\lambda (t2: T).(subst0 +(minus (s k i) h) u t0 t2)) (ex2 T (\lambda (t2: T).(eq T (THead k (lift h d +t) x0) (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead k t t0) +t2))) (\lambda (x1: T).(\lambda (H7: (eq T x0 (lift h (s k d) x1))).(\lambda +(H8: (subst0 (minus (s k i) h) u t0 x1)).(eq_ind_r T (lift h (s k d) x1) +(\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T (THead k (lift h d t) t2) +(lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead k t t0) t3)))) +(eq_ind T (lift h d (THead k t x1)) (\lambda (t2: T).(ex2 T (\lambda (t3: +T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead k t +t0) t3)))) (let H9 \def (eq_ind_r nat (minus (s k i) h) (\lambda (n: +nat).(subst0 n u t0 x1)) H8 (s k (minus i h)) (s_minus k i h (le_trans_plus_r +d h i H2))) in (ex_intro2 T (\lambda (t2: T).(eq T (lift h d (THead k t x1)) +(lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead k t t0) t2)) +(THead k t x1) (refl_equal T (lift h d (THead k t x1))) (subst0_snd k u x1 t0 +(minus i h) H9 t))) (THead k (lift h d t) (lift h (s k d) x1)) (lift_head k t +x1 h d)) x0 H7)))) (H0 x0 (s k i) h (s k d) H6 (eq_ind nat (s k (plus d h)) +(\lambda (n: nat).(le n (s k i))) (s_le k (plus d h) i H2) (plus (s k d) h) +(s_plus k d h)))) x H5)))) H4)) (\lambda (H4: (ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i u (lift h d t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s +k i) u (lift h (s k d) t0) t2))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda +(t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i +u (lift h d t) u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k i) u (lift +h (s k d) t0) t2))) (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda +(t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda (x0: T).(\lambda +(x1: T).(\lambda (H5: (eq T x (THead k x0 x1))).(\lambda (H6: (subst0 i u +(lift h d t) x0)).(\lambda (H7: (subst0 (s k i) u (lift h (s k d) t0) +x1)).(eq_ind_r T (THead k x0 x1) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq +T t2 (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead k t t0) +t3)))) (ex2_ind T (\lambda (t2: T).(eq T x1 (lift h (s k d) t2))) (\lambda +(t2: T).(subst0 (minus (s k i) h) u t0 t2)) (ex2 T (\lambda (t2: T).(eq T +(THead k x0 x1) (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u (THead +k t t0) t2))) (\lambda (x2: T).(\lambda (H8: (eq T x1 (lift h (s k d) +x2))).(\lambda (H9: (subst0 (minus (s k i) h) u t0 x2)).(ex2_ind T (\lambda +(t2: T).(eq T x0 (lift h d t2))) (\lambda (t2: T).(subst0 (minus i h) u t +t2)) (ex2 T (\lambda (t2: T).(eq T (THead k x0 x1) (lift h d t2))) (\lambda +(t2: T).(subst0 (minus i h) u (THead k t t0) t2))) (\lambda (x3: T).(\lambda +(H10: (eq T x0 (lift h d x3))).(\lambda (H11: (subst0 (minus i h) u t +x3)).(eq_ind_r T (lift h d x3) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T +(THead k t2 x1) (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead +k t t0) t3)))) (eq_ind_r T (lift h (s k d) x2) (\lambda (t2: T).(ex2 T +(\lambda (t3: T).(eq T (THead k (lift h d x3) t2) (lift h d t3))) (\lambda +(t3: T).(subst0 (minus i h) u (THead k t t0) t3)))) (eq_ind T (lift h d +(THead k x3 x2)) (\lambda (t2: T).(ex2 T (\lambda (t3: T).(eq T t2 (lift h d +t3))) (\lambda (t3: T).(subst0 (minus i h) u (THead k t t0) t3)))) (let H12 +\def (eq_ind_r nat (minus (s k i) h) (\lambda (n: nat).(subst0 n u t0 x2)) H9 +(s k (minus i h)) (s_minus k i h (le_trans_plus_r d h i H2))) in (ex_intro2 T +(\lambda (t2: T).(eq T (lift h d (THead k x3 x2)) (lift h d t2))) (\lambda +(t2: T).(subst0 (minus i h) u (THead k t t0) t2)) (THead k x3 x2) (refl_equal +T (lift h d (THead k x3 x2))) (subst0_both u t x3 (minus i h) H11 k t0 x2 +H12))) (THead k (lift h d x3) (lift h (s k d) x2)) (lift_head k x3 x2 h d)) +x1 H8) x0 H10)))) (H x0 i h d H6 H2))))) (H0 x1 (s k i) h (s k d) H7 (eq_ind +nat (s k (plus d h)) (\lambda (n: nat).(le n (s k i))) (s_le k (plus d h) i +H2) (plus (s k d) h) (s_plus k d h)))) x H5)))))) H4)) (subst0_gen_head k u +(lift h d t) (lift h (s k d) t0) x i H3)))))))))))))) t1)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/props.ma new file mode 100644 index 000000000..7b147c20e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/props.ma @@ -0,0 +1,230 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst0/props". + +include "subst0/fwd.ma". + +include "lift/props.ma". + +theorem subst0_refl: + \forall (u: T).(\forall (t: T).(\forall (d: nat).((subst0 d u t t) \to +(\forall (P: Prop).P)))) +\def + \lambda (u: T).(\lambda (t: T).(T_ind (\lambda (t0: T).(\forall (d: +nat).((subst0 d u t0 t0) \to (\forall (P: Prop).P)))) (\lambda (n: +nat).(\lambda (d: nat).(\lambda (H: (subst0 d u (TSort n) (TSort +n))).(\lambda (P: Prop).(subst0_gen_sort u (TSort n) d n H P))))) (\lambda +(n: nat).(\lambda (d: nat).(\lambda (H: (subst0 d u (TLRef n) (TLRef +n))).(\lambda (P: Prop).(and_ind (eq nat n d) (eq T (TLRef n) (lift (S n) O +u)) P (\lambda (_: (eq nat n d)).(\lambda (H1: (eq T (TLRef n) (lift (S n) O +u))).(lift_gen_lref_false (S n) O n (le_O_n n) (le_n (plus O (S n))) u H1 +P))) (subst0_gen_lref u (TLRef n) d n H)))))) (\lambda (k: K).(\lambda (t0: +T).(\lambda (H: ((\forall (d: nat).((subst0 d u t0 t0) \to (\forall (P: +Prop).P))))).(\lambda (t1: T).(\lambda (H0: ((\forall (d: nat).((subst0 d u +t1 t1) \to (\forall (P: Prop).P))))).(\lambda (d: nat).(\lambda (H1: (subst0 +d u (THead k t0 t1) (THead k t0 t1))).(\lambda (P: Prop).(or3_ind (ex2 T +(\lambda (u2: T).(eq T (THead k t0 t1) (THead k u2 t1))) (\lambda (u2: +T).(subst0 d u t0 u2))) (ex2 T (\lambda (t2: T).(eq T (THead k t0 t1) (THead +k t0 t2))) (\lambda (t2: T).(subst0 (s k d) u t1 t2))) (ex3_2 T T (\lambda +(u2: T).(\lambda (t2: T).(eq T (THead k t0 t1) (THead k u2 t2)))) (\lambda +(u2: T).(\lambda (_: T).(subst0 d u t0 u2))) (\lambda (_: T).(\lambda (t2: +T).(subst0 (s k d) u t1 t2)))) P (\lambda (H2: (ex2 T (\lambda (u2: T).(eq T +(THead k t0 t1) (THead k u2 t1))) (\lambda (u2: T).(subst0 d u t0 +u2)))).(ex2_ind T (\lambda (u2: T).(eq T (THead k t0 t1) (THead k u2 t1))) +(\lambda (u2: T).(subst0 d u t0 u2)) P (\lambda (x: T).(\lambda (H3: (eq T +(THead k t0 t1) (THead k x t1))).(\lambda (H4: (subst0 d u t0 x)).(let H5 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ t2 _) +\Rightarrow t2])) (THead k t0 t1) (THead k x t1) H3) in (let H6 \def +(eq_ind_r T x (\lambda (t2: T).(subst0 d u t0 t2)) H4 t0 H5) in (H d H6 +P)))))) H2)) (\lambda (H2: (ex2 T (\lambda (t2: T).(eq T (THead k t0 t1) +(THead k t0 t2))) (\lambda (t2: T).(subst0 (s k d) u t1 t2)))).(ex2_ind T +(\lambda (t2: T).(eq T (THead k t0 t1) (THead k t0 t2))) (\lambda (t2: +T).(subst0 (s k d) u t1 t2)) P (\lambda (x: T).(\lambda (H3: (eq T (THead k +t0 t1) (THead k t0 x))).(\lambda (H4: (subst0 (s k d) u t1 x)).(let H5 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t1 | (TLRef _) \Rightarrow t1 | (THead _ _ t2) +\Rightarrow t2])) (THead k t0 t1) (THead k t0 x) H3) in (let H6 \def +(eq_ind_r T x (\lambda (t2: T).(subst0 (s k d) u t1 t2)) H4 t1 H5) in (H0 (s +k d) H6 P)))))) H2)) (\lambda (H2: (ex3_2 T T (\lambda (u2: T).(\lambda (t2: +T).(eq T (THead k t0 t1) (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 d u t0 u2))) (\lambda (_: T).(\lambda (t2: T).(subst0 (s k d) u t1 +t2))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead k t0 +t1) (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst0 d u t0 u2))) +(\lambda (_: T).(\lambda (t2: T).(subst0 (s k d) u t1 t2))) P (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H3: (eq T (THead k t0 t1) (THead k x0 +x1))).(\lambda (H4: (subst0 d u t0 x0)).(\lambda (H5: (subst0 (s k d) u t1 +x1)).(let H6 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda +(_: T).T) with [(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead +_ t2 _) \Rightarrow t2])) (THead k t0 t1) (THead k x0 x1) H3) in ((let H7 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t1 | (TLRef _) \Rightarrow t1 | (THead _ _ t2) +\Rightarrow t2])) (THead k t0 t1) (THead k x0 x1) H3) in (\lambda (H8: (eq T +t0 x0)).(let H9 \def (eq_ind_r T x1 (\lambda (t2: T).(subst0 (s k d) u t1 +t2)) H5 t1 H7) in (let H10 \def (eq_ind_r T x0 (\lambda (t2: T).(subst0 d u +t0 t2)) H4 t0 H8) in (H d H10 P))))) H6))))))) H2)) (subst0_gen_head k u t0 +t1 (THead k t0 t1) d H1)))))))))) t)). + +theorem subst0_lift_lt: + \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).((subst0 +i u t1 t2) \to (\forall (d: nat).((lt i d) \to (\forall (h: nat).(subst0 i +(lift h (minus d (S i)) u) (lift h d t1) (lift h d t2))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (subst0 i u t1 t2)).(subst0_ind (\lambda (n: nat).(\lambda (t: +T).(\lambda (t0: T).(\lambda (t3: T).(\forall (d: nat).((lt n d) \to (\forall +(h: nat).(subst0 n (lift h (minus d (S n)) t) (lift h d t0) (lift h d +t3))))))))) (\lambda (v: T).(\lambda (i0: nat).(\lambda (d: nat).(\lambda +(H0: (lt i0 d)).(\lambda (h: nat).(eq_ind_r T (TLRef i0) (\lambda (t: +T).(subst0 i0 (lift h (minus d (S i0)) v) t (lift h d (lift (S i0) O v)))) +(let w \def (minus d (S i0)) in (eq_ind nat (plus (S i0) (minus d (S i0))) +(\lambda (n: nat).(subst0 i0 (lift h w v) (TLRef i0) (lift h n (lift (S i0) O +v)))) (eq_ind_r T (lift (S i0) O (lift h (minus d (S i0)) v)) (\lambda (t: +T).(subst0 i0 (lift h w v) (TLRef i0) t)) (subst0_lref (lift h (minus d (S +i0)) v) i0) (lift h (plus (S i0) (minus d (S i0))) (lift (S i0) O v)) (lift_d +v h (S i0) (minus d (S i0)) O (le_O_n (minus d (S i0))))) d (le_plus_minus_r +(S i0) d H0))) (lift h d (TLRef i0)) (lift_lref_lt i0 h d H0))))))) (\lambda +(v: T).(\lambda (u2: T).(\lambda (u1: T).(\lambda (i0: nat).(\lambda (_: +(subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (d: nat).((lt i0 d) \to (\forall +(h: nat).(subst0 i0 (lift h (minus d (S i0)) v) (lift h d u1) (lift h d +u2))))))).(\lambda (t: T).(\lambda (k: K).(\lambda (d: nat).(\lambda (H2: (lt +i0 d)).(\lambda (h: nat).(eq_ind_r T (THead k (lift h d u1) (lift h (s k d) +t)) (\lambda (t0: T).(subst0 i0 (lift h (minus d (S i0)) v) t0 (lift h d +(THead k u2 t)))) (eq_ind_r T (THead k (lift h d u2) (lift h (s k d) t)) +(\lambda (t0: T).(subst0 i0 (lift h (minus d (S i0)) v) (THead k (lift h d +u1) (lift h (s k d) t)) t0)) (subst0_fst (lift h (minus d (S i0)) v) (lift h +d u2) (lift h d u1) i0 (H1 d H2 h) (lift h (s k d) t) k) (lift h d (THead k +u2 t)) (lift_head k u2 t h d)) (lift h d (THead k u1 t)) (lift_head k u1 t h +d))))))))))))) (\lambda (k: K).(\lambda (v: T).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (i0: nat).(\lambda (_: (subst0 (s k i0) v t3 t0)).(\lambda (H1: +((\forall (d: nat).((lt (s k i0) d) \to (\forall (h: nat).(subst0 (s k i0) +(lift h (minus d (S (s k i0))) v) (lift h d t3) (lift h d t0))))))).(\lambda +(u0: T).(\lambda (d: nat).(\lambda (H2: (lt i0 d)).(\lambda (h: nat).(let H3 +\def (eq_ind_r nat (S (s k i0)) (\lambda (n: nat).(\forall (d0: nat).((lt (s +k i0) d0) \to (\forall (h0: nat).(subst0 (s k i0) (lift h0 (minus d0 n) v) +(lift h0 d0 t3) (lift h0 d0 t0)))))) H1 (s k (S i0)) (s_S k i0)) in (eq_ind_r +T (THead k (lift h d u0) (lift h (s k d) t3)) (\lambda (t: T).(subst0 i0 +(lift h (minus d (S i0)) v) t (lift h d (THead k u0 t0)))) (eq_ind_r T (THead +k (lift h d u0) (lift h (s k d) t0)) (\lambda (t: T).(subst0 i0 (lift h +(minus d (S i0)) v) (THead k (lift h d u0) (lift h (s k d) t3)) t)) (eq_ind +nat (minus (s k d) (s k (S i0))) (\lambda (n: nat).(subst0 i0 (lift h n v) +(THead k (lift h d u0) (lift h (s k d) t3)) (THead k (lift h d u0) (lift h (s +k d) t0)))) (subst0_snd k (lift h (minus (s k d) (s k (S i0))) v) (lift h (s +k d) t0) (lift h (s k d) t3) i0 (H3 (s k d) (s_lt k i0 d H2) h) (lift h d +u0)) (minus d (S i0)) (minus_s_s k d (S i0))) (lift h d (THead k u0 t0)) +(lift_head k u0 t0 h d)) (lift h d (THead k u0 t3)) (lift_head k u0 t3 h +d)))))))))))))) (\lambda (v: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda +(i0: nat).(\lambda (_: (subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (d: +nat).((lt i0 d) \to (\forall (h: nat).(subst0 i0 (lift h (minus d (S i0)) v) +(lift h d u1) (lift h d u2))))))).(\lambda (k: K).(\lambda (t0: T).(\lambda +(t3: T).(\lambda (_: (subst0 (s k i0) v t0 t3)).(\lambda (H3: ((\forall (d: +nat).((lt (s k i0) d) \to (\forall (h: nat).(subst0 (s k i0) (lift h (minus d +(S (s k i0))) v) (lift h d t0) (lift h d t3))))))).(\lambda (d: nat).(\lambda +(H4: (lt i0 d)).(\lambda (h: nat).(let H5 \def (eq_ind_r nat (S (s k i0)) +(\lambda (n: nat).(\forall (d0: nat).((lt (s k i0) d0) \to (\forall (h0: +nat).(subst0 (s k i0) (lift h0 (minus d0 n) v) (lift h0 d0 t0) (lift h0 d0 +t3)))))) H3 (s k (S i0)) (s_S k i0)) in (eq_ind_r T (THead k (lift h d u1) +(lift h (s k d) t0)) (\lambda (t: T).(subst0 i0 (lift h (minus d (S i0)) v) t +(lift h d (THead k u2 t3)))) (eq_ind_r T (THead k (lift h d u2) (lift h (s k +d) t3)) (\lambda (t: T).(subst0 i0 (lift h (minus d (S i0)) v) (THead k (lift +h d u1) (lift h (s k d) t0)) t)) (subst0_both (lift h (minus d (S i0)) v) +(lift h d u1) (lift h d u2) i0 (H1 d H4 h) k (lift h (s k d) t0) (lift h (s k +d) t3) (eq_ind nat (minus (s k d) (s k (S i0))) (\lambda (n: nat).(subst0 (s +k i0) (lift h n v) (lift h (s k d) t0) (lift h (s k d) t3))) (H5 (s k d) +(s_lt k i0 d H4) h) (minus d (S i0)) (minus_s_s k d (S i0)))) (lift h d +(THead k u2 t3)) (lift_head k u2 t3 h d)) (lift h d (THead k u1 t0)) +(lift_head k u1 t0 h d))))))))))))))))) i u t1 t2 H))))). + +theorem subst0_lift_ge: + \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).(\forall +(h: nat).((subst0 i u t1 t2) \to (\forall (d: nat).((le d i) \to (subst0 +(plus i h) u (lift h d t1) (lift h d t2))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(h: nat).(\lambda (H: (subst0 i u t1 t2)).(subst0_ind (\lambda (n: +nat).(\lambda (t: T).(\lambda (t0: T).(\lambda (t3: T).(\forall (d: nat).((le +d n) \to (subst0 (plus n h) t (lift h d t0) (lift h d t3)))))))) (\lambda (v: +T).(\lambda (i0: nat).(\lambda (d: nat).(\lambda (H0: (le d i0)).(eq_ind_r T +(TLRef (plus i0 h)) (\lambda (t: T).(subst0 (plus i0 h) v t (lift h d (lift +(S i0) O v)))) (eq_ind_r T (lift (plus h (S i0)) O v) (\lambda (t: T).(subst0 +(plus i0 h) v (TLRef (plus i0 h)) t)) (eq_ind nat (S (plus h i0)) (\lambda +(n: nat).(subst0 (plus i0 h) v (TLRef (plus i0 h)) (lift n O v))) (eq_ind_r +nat (plus h i0) (\lambda (n: nat).(subst0 n v (TLRef n) (lift (S (plus h i0)) +O v))) (subst0_lref v (plus h i0)) (plus i0 h) (plus_comm i0 h)) (plus h (S +i0)) (plus_n_Sm h i0)) (lift h d (lift (S i0) O v)) (lift_free v (S i0) h O d +(le_S d i0 H0) (le_O_n d))) (lift h d (TLRef i0)) (lift_lref_ge i0 h d +H0)))))) (\lambda (v: T).(\lambda (u2: T).(\lambda (u1: T).(\lambda (i0: +nat).(\lambda (_: (subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (d: nat).((le +d i0) \to (subst0 (plus i0 h) v (lift h d u1) (lift h d u2)))))).(\lambda (t: +T).(\lambda (k: K).(\lambda (d: nat).(\lambda (H2: (le d i0)).(eq_ind_r T +(THead k (lift h d u1) (lift h (s k d) t)) (\lambda (t0: T).(subst0 (plus i0 +h) v t0 (lift h d (THead k u2 t)))) (eq_ind_r T (THead k (lift h d u2) (lift +h (s k d) t)) (\lambda (t0: T).(subst0 (plus i0 h) v (THead k (lift h d u1) +(lift h (s k d) t)) t0)) (subst0_fst v (lift h d u2) (lift h d u1) (plus i0 +h) (H1 d H2) (lift h (s k d) t) k) (lift h d (THead k u2 t)) (lift_head k u2 +t h d)) (lift h d (THead k u1 t)) (lift_head k u1 t h d)))))))))))) (\lambda +(k: K).(\lambda (v: T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (i0: +nat).(\lambda (_: (subst0 (s k i0) v t3 t0)).(\lambda (H1: ((\forall (d: +nat).((le d (s k i0)) \to (subst0 (plus (s k i0) h) v (lift h d t3) (lift h d +t0)))))).(\lambda (u0: T).(\lambda (d: nat).(\lambda (H2: (le d i0)).(let H3 +\def (eq_ind_r nat (plus (s k i0) h) (\lambda (n: nat).(\forall (d0: +nat).((le d0 (s k i0)) \to (subst0 n v (lift h d0 t3) (lift h d0 t0))))) H1 +(s k (plus i0 h)) (s_plus k i0 h)) in (eq_ind_r T (THead k (lift h d u0) +(lift h (s k d) t3)) (\lambda (t: T).(subst0 (plus i0 h) v t (lift h d (THead +k u0 t0)))) (eq_ind_r T (THead k (lift h d u0) (lift h (s k d) t0)) (\lambda +(t: T).(subst0 (plus i0 h) v (THead k (lift h d u0) (lift h (s k d) t3)) t)) +(subst0_snd k v (lift h (s k d) t0) (lift h (s k d) t3) (plus i0 h) (H3 (s k +d) (s_le k d i0 H2)) (lift h d u0)) (lift h d (THead k u0 t0)) (lift_head k +u0 t0 h d)) (lift h d (THead k u0 t3)) (lift_head k u0 t3 h d))))))))))))) +(\lambda (v: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (i0: nat).(\lambda +(_: (subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (d: nat).((le d i0) \to +(subst0 (plus i0 h) v (lift h d u1) (lift h d u2)))))).(\lambda (k: +K).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (subst0 (s k i0) v t0 +t3)).(\lambda (H3: ((\forall (d: nat).((le d (s k i0)) \to (subst0 (plus (s k +i0) h) v (lift h d t0) (lift h d t3)))))).(\lambda (d: nat).(\lambda (H4: (le +d i0)).(let H5 \def (eq_ind_r nat (plus (s k i0) h) (\lambda (n: +nat).(\forall (d0: nat).((le d0 (s k i0)) \to (subst0 n v (lift h d0 t0) +(lift h d0 t3))))) H3 (s k (plus i0 h)) (s_plus k i0 h)) in (eq_ind_r T +(THead k (lift h d u1) (lift h (s k d) t0)) (\lambda (t: T).(subst0 (plus i0 +h) v t (lift h d (THead k u2 t3)))) (eq_ind_r T (THead k (lift h d u2) (lift +h (s k d) t3)) (\lambda (t: T).(subst0 (plus i0 h) v (THead k (lift h d u1) +(lift h (s k d) t0)) t)) (subst0_both v (lift h d u1) (lift h d u2) (plus i0 +h) (H1 d H4) k (lift h (s k d) t0) (lift h (s k d) t3) (H5 (s k d) (s_le k d +i0 H4))) (lift h d (THead k u2 t3)) (lift_head k u2 t3 h d)) (lift h d (THead +k u1 t0)) (lift_head k u1 t0 h d)))))))))))))))) i u t1 t2 H)))))). + +theorem subst0_lift_ge_S: + \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).((subst0 +i u t1 t2) \to (\forall (d: nat).((le d i) \to (subst0 (S i) u (lift (S O) d +t1) (lift (S O) d t2)))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (subst0 i u t1 t2)).(\lambda (d: nat).(\lambda (H0: (le d i)).(eq_ind nat +(plus i (S O)) (\lambda (n: nat).(subst0 n u (lift (S O) d t1) (lift (S O) d +t2))) (subst0_lift_ge t1 t2 u i (S O) H d H0) (S i) (eq_ind_r nat (plus (S O) +i) (\lambda (n: nat).(eq nat n (S i))) (refl_equal nat (S i)) (plus i (S O)) +(plus_comm i (S O)))))))))). + +theorem subst0_lift_ge_s: + \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).((subst0 +i u t1 t2) \to (\forall (d: nat).((le d i) \to (\forall (b: B).(subst0 (s +(Bind b) i) u (lift (S O) d t1) (lift (S O) d t2))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (subst0 i u t1 t2)).(\lambda (d: nat).(\lambda (H0: (le d i)).(\lambda +(_: B).(subst0_lift_ge_S t1 t2 u i H d H0)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/subst0.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/subst0.ma new file mode 100644 index 000000000..9b9c0bb54 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/subst0.ma @@ -0,0 +1,1374 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst0/subst0". + +include "subst0/props.ma". + +theorem subst0_subst0: + \forall (t1: T).(\forall (t2: T).(\forall (u2: T).(\forall (j: nat).((subst0 +j u2 t1 t2) \to (\forall (u1: T).(\forall (u: T).(\forall (i: nat).((subst0 i +u u1 u2) \to (ex2 T (\lambda (t: T).(subst0 j u1 t1 t)) (\lambda (t: +T).(subst0 (S (plus i j)) u t t2))))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u2: T).(\lambda (j: nat).(\lambda +(H: (subst0 j u2 t1 t2)).(subst0_ind (\lambda (n: nat).(\lambda (t: +T).(\lambda (t0: T).(\lambda (t3: T).(\forall (u1: T).(\forall (u: +T).(\forall (i: nat).((subst0 i u u1 t) \to (ex2 T (\lambda (t4: T).(subst0 n +u1 t0 t4)) (\lambda (t4: T).(subst0 (S (plus i n)) u t4 t3))))))))))) +(\lambda (v: T).(\lambda (i: nat).(\lambda (u1: T).(\lambda (u: T).(\lambda +(i0: nat).(\lambda (H0: (subst0 i0 u u1 v)).(eq_ind nat (plus i0 (S i)) +(\lambda (n: nat).(ex2 T (\lambda (t: T).(subst0 i u1 (TLRef i) t)) (\lambda +(t: T).(subst0 n u t (lift (S i) O v))))) (ex_intro2 T (\lambda (t: +T).(subst0 i u1 (TLRef i) t)) (\lambda (t: T).(subst0 (plus i0 (S i)) u t +(lift (S i) O v))) (lift (S i) O u1) (subst0_lref u1 i) (subst0_lift_ge u1 v +u i0 (S i) H0 O (le_O_n i0))) (S (plus i0 i)) (sym_eq nat (S (plus i0 i)) +(plus i0 (S i)) (plus_n_Sm i0 i))))))))) (\lambda (v: T).(\lambda (u0: +T).(\lambda (u1: T).(\lambda (i: nat).(\lambda (_: (subst0 i v u1 +u0)).(\lambda (H1: ((\forall (u3: T).(\forall (u: T).(\forall (i0: +nat).((subst0 i0 u u3 v) \to (ex2 T (\lambda (t: T).(subst0 i u3 u1 t)) +(\lambda (t: T).(subst0 (S (plus i0 i)) u t u0))))))))).(\lambda (t: +T).(\lambda (k: K).(\lambda (u3: T).(\lambda (u: T).(\lambda (i0: +nat).(\lambda (H2: (subst0 i0 u u3 v)).(ex2_ind T (\lambda (t0: T).(subst0 i +u3 u1 t0)) (\lambda (t0: T).(subst0 (S (plus i0 i)) u t0 u0)) (ex2 T (\lambda +(t0: T).(subst0 i u3 (THead k u1 t) t0)) (\lambda (t0: T).(subst0 (S (plus i0 +i)) u t0 (THead k u0 t)))) (\lambda (x: T).(\lambda (H3: (subst0 i u3 u1 +x)).(\lambda (H4: (subst0 (S (plus i0 i)) u x u0)).(ex_intro2 T (\lambda (t0: +T).(subst0 i u3 (THead k u1 t) t0)) (\lambda (t0: T).(subst0 (S (plus i0 i)) +u t0 (THead k u0 t))) (THead k x t) (subst0_fst u3 x u1 i H3 t k) (subst0_fst +u u0 x (S (plus i0 i)) H4 t k))))) (H1 u3 u i0 H2)))))))))))))) (\lambda (k: +K).(\lambda (v: T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (i: +nat).(\lambda (_: (subst0 (s k i) v t3 t0)).(\lambda (H1: ((\forall (u1: +T).(\forall (u: T).(\forall (i0: nat).((subst0 i0 u u1 v) \to (ex2 T (\lambda +(t: T).(subst0 (s k i) u1 t3 t)) (\lambda (t: T).(subst0 (S (plus i0 (s k +i))) u t t0))))))))).(\lambda (u: T).(\lambda (u1: T).(\lambda (u0: +T).(\lambda (i0: nat).(\lambda (H2: (subst0 i0 u0 u1 v)).(ex2_ind T (\lambda +(t: T).(subst0 (s k i) u1 t3 t)) (\lambda (t: T).(subst0 (S (plus i0 (s k +i))) u0 t t0)) (ex2 T (\lambda (t: T).(subst0 i u1 (THead k u t3) t)) +(\lambda (t: T).(subst0 (S (plus i0 i)) u0 t (THead k u t0)))) (\lambda (x: +T).(\lambda (H3: (subst0 (s k i) u1 t3 x)).(\lambda (H4: (subst0 (S (plus i0 +(s k i))) u0 x t0)).(let H5 \def (eq_ind_r nat (plus i0 (s k i)) (\lambda (n: +nat).(subst0 (S n) u0 x t0)) H4 (s k (plus i0 i)) (s_plus_sym k i0 i)) in +(let H6 \def (eq_ind_r nat (S (s k (plus i0 i))) (\lambda (n: nat).(subst0 n +u0 x t0)) H5 (s k (S (plus i0 i))) (s_S k (plus i0 i))) in (ex_intro2 T +(\lambda (t: T).(subst0 i u1 (THead k u t3) t)) (\lambda (t: T).(subst0 (S +(plus i0 i)) u0 t (THead k u t0))) (THead k u x) (subst0_snd k u1 x t3 i H3 +u) (subst0_snd k u0 t0 x (S (plus i0 i)) H6 u))))))) (H1 u1 u0 i0 +H2)))))))))))))) (\lambda (v: T).(\lambda (u1: T).(\lambda (u0: T).(\lambda +(i: nat).(\lambda (_: (subst0 i v u1 u0)).(\lambda (H1: ((\forall (u3: +T).(\forall (u: T).(\forall (i0: nat).((subst0 i0 u u3 v) \to (ex2 T (\lambda +(t: T).(subst0 i u3 u1 t)) (\lambda (t: T).(subst0 (S (plus i0 i)) u t +u0))))))))).(\lambda (k: K).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: +(subst0 (s k i) v t0 t3)).(\lambda (H3: ((\forall (u3: T).(\forall (u: +T).(\forall (i0: nat).((subst0 i0 u u3 v) \to (ex2 T (\lambda (t: T).(subst0 +(s k i) u3 t0 t)) (\lambda (t: T).(subst0 (S (plus i0 (s k i))) u t +t3))))))))).(\lambda (u3: T).(\lambda (u: T).(\lambda (i0: nat).(\lambda (H4: +(subst0 i0 u u3 v)).(ex2_ind T (\lambda (t: T).(subst0 (s k i) u3 t0 t)) +(\lambda (t: T).(subst0 (S (plus i0 (s k i))) u t t3)) (ex2 T (\lambda (t: +T).(subst0 i u3 (THead k u1 t0) t)) (\lambda (t: T).(subst0 (S (plus i0 i)) u +t (THead k u0 t3)))) (\lambda (x: T).(\lambda (H5: (subst0 (s k i) u3 t0 +x)).(\lambda (H6: (subst0 (S (plus i0 (s k i))) u x t3)).(ex2_ind T (\lambda +(t: T).(subst0 i u3 u1 t)) (\lambda (t: T).(subst0 (S (plus i0 i)) u t u0)) +(ex2 T (\lambda (t: T).(subst0 i u3 (THead k u1 t0) t)) (\lambda (t: +T).(subst0 (S (plus i0 i)) u t (THead k u0 t3)))) (\lambda (x0: T).(\lambda +(H7: (subst0 i u3 u1 x0)).(\lambda (H8: (subst0 (S (plus i0 i)) u x0 +u0)).(let H9 \def (eq_ind_r nat (plus i0 (s k i)) (\lambda (n: nat).(subst0 +(S n) u x t3)) H6 (s k (plus i0 i)) (s_plus_sym k i0 i)) in (let H10 \def +(eq_ind_r nat (S (s k (plus i0 i))) (\lambda (n: nat).(subst0 n u x t3)) H9 +(s k (S (plus i0 i))) (s_S k (plus i0 i))) in (ex_intro2 T (\lambda (t: +T).(subst0 i u3 (THead k u1 t0) t)) (\lambda (t: T).(subst0 (S (plus i0 i)) u +t (THead k u0 t3))) (THead k x0 x) (subst0_both u3 u1 x0 i H7 k t0 x H5) +(subst0_both u x0 u0 (S (plus i0 i)) H8 k x t3 H10))))))) (H1 u3 u i0 H4))))) +(H3 u3 u i0 H4))))))))))))))))) j u2 t1 t2 H))))). + +theorem subst0_subst0_back: + \forall (t1: T).(\forall (t2: T).(\forall (u2: T).(\forall (j: nat).((subst0 +j u2 t1 t2) \to (\forall (u1: T).(\forall (u: T).(\forall (i: nat).((subst0 i +u u2 u1) \to (ex2 T (\lambda (t: T).(subst0 j u1 t1 t)) (\lambda (t: +T).(subst0 (S (plus i j)) u t2 t))))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u2: T).(\lambda (j: nat).(\lambda +(H: (subst0 j u2 t1 t2)).(subst0_ind (\lambda (n: nat).(\lambda (t: +T).(\lambda (t0: T).(\lambda (t3: T).(\forall (u1: T).(\forall (u: +T).(\forall (i: nat).((subst0 i u t u1) \to (ex2 T (\lambda (t4: T).(subst0 n +u1 t0 t4)) (\lambda (t4: T).(subst0 (S (plus i n)) u t3 t4))))))))))) +(\lambda (v: T).(\lambda (i: nat).(\lambda (u1: T).(\lambda (u: T).(\lambda +(i0: nat).(\lambda (H0: (subst0 i0 u v u1)).(eq_ind nat (plus i0 (S i)) +(\lambda (n: nat).(ex2 T (\lambda (t: T).(subst0 i u1 (TLRef i) t)) (\lambda +(t: T).(subst0 n u (lift (S i) O v) t)))) (ex_intro2 T (\lambda (t: +T).(subst0 i u1 (TLRef i) t)) (\lambda (t: T).(subst0 (plus i0 (S i)) u (lift +(S i) O v) t)) (lift (S i) O u1) (subst0_lref u1 i) (subst0_lift_ge v u1 u i0 +(S i) H0 O (le_O_n i0))) (S (plus i0 i)) (sym_eq nat (S (plus i0 i)) (plus i0 +(S i)) (plus_n_Sm i0 i))))))))) (\lambda (v: T).(\lambda (u0: T).(\lambda +(u1: T).(\lambda (i: nat).(\lambda (_: (subst0 i v u1 u0)).(\lambda (H1: +((\forall (u3: T).(\forall (u: T).(\forall (i0: nat).((subst0 i0 u v u3) \to +(ex2 T (\lambda (t: T).(subst0 i u3 u1 t)) (\lambda (t: T).(subst0 (S (plus +i0 i)) u u0 t))))))))).(\lambda (t: T).(\lambda (k: K).(\lambda (u3: +T).(\lambda (u: T).(\lambda (i0: nat).(\lambda (H2: (subst0 i0 u v +u3)).(ex2_ind T (\lambda (t0: T).(subst0 i u3 u1 t0)) (\lambda (t0: +T).(subst0 (S (plus i0 i)) u u0 t0)) (ex2 T (\lambda (t0: T).(subst0 i u3 +(THead k u1 t) t0)) (\lambda (t0: T).(subst0 (S (plus i0 i)) u (THead k u0 t) +t0))) (\lambda (x: T).(\lambda (H3: (subst0 i u3 u1 x)).(\lambda (H4: (subst0 +(S (plus i0 i)) u u0 x)).(ex_intro2 T (\lambda (t0: T).(subst0 i u3 (THead k +u1 t) t0)) (\lambda (t0: T).(subst0 (S (plus i0 i)) u (THead k u0 t) t0)) +(THead k x t) (subst0_fst u3 x u1 i H3 t k) (subst0_fst u x u0 (S (plus i0 +i)) H4 t k))))) (H1 u3 u i0 H2)))))))))))))) (\lambda (k: K).(\lambda (v: +T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (i: nat).(\lambda (_: (subst0 +(s k i) v t3 t0)).(\lambda (H1: ((\forall (u1: T).(\forall (u: T).(\forall +(i0: nat).((subst0 i0 u v u1) \to (ex2 T (\lambda (t: T).(subst0 (s k i) u1 +t3 t)) (\lambda (t: T).(subst0 (S (plus i0 (s k i))) u t0 t))))))))).(\lambda +(u: T).(\lambda (u1: T).(\lambda (u0: T).(\lambda (i0: nat).(\lambda (H2: +(subst0 i0 u0 v u1)).(ex2_ind T (\lambda (t: T).(subst0 (s k i) u1 t3 t)) +(\lambda (t: T).(subst0 (S (plus i0 (s k i))) u0 t0 t)) (ex2 T (\lambda (t: +T).(subst0 i u1 (THead k u t3) t)) (\lambda (t: T).(subst0 (S (plus i0 i)) u0 +(THead k u t0) t))) (\lambda (x: T).(\lambda (H3: (subst0 (s k i) u1 t3 +x)).(\lambda (H4: (subst0 (S (plus i0 (s k i))) u0 t0 x)).(let H5 \def +(eq_ind_r nat (plus i0 (s k i)) (\lambda (n: nat).(subst0 (S n) u0 t0 x)) H4 +(s k (plus i0 i)) (s_plus_sym k i0 i)) in (let H6 \def (eq_ind_r nat (S (s k +(plus i0 i))) (\lambda (n: nat).(subst0 n u0 t0 x)) H5 (s k (S (plus i0 i))) +(s_S k (plus i0 i))) in (ex_intro2 T (\lambda (t: T).(subst0 i u1 (THead k u +t3) t)) (\lambda (t: T).(subst0 (S (plus i0 i)) u0 (THead k u t0) t)) (THead +k u x) (subst0_snd k u1 x t3 i H3 u) (subst0_snd k u0 x t0 (S (plus i0 i)) H6 +u))))))) (H1 u1 u0 i0 H2)))))))))))))) (\lambda (v: T).(\lambda (u1: +T).(\lambda (u0: T).(\lambda (i: nat).(\lambda (_: (subst0 i v u1 +u0)).(\lambda (H1: ((\forall (u3: T).(\forall (u: T).(\forall (i0: +nat).((subst0 i0 u v u3) \to (ex2 T (\lambda (t: T).(subst0 i u3 u1 t)) +(\lambda (t: T).(subst0 (S (plus i0 i)) u u0 t))))))))).(\lambda (k: +K).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (subst0 (s k i) v t0 +t3)).(\lambda (H3: ((\forall (u3: T).(\forall (u: T).(\forall (i0: +nat).((subst0 i0 u v u3) \to (ex2 T (\lambda (t: T).(subst0 (s k i) u3 t0 t)) +(\lambda (t: T).(subst0 (S (plus i0 (s k i))) u t3 t))))))))).(\lambda (u3: +T).(\lambda (u: T).(\lambda (i0: nat).(\lambda (H4: (subst0 i0 u v +u3)).(ex2_ind T (\lambda (t: T).(subst0 (s k i) u3 t0 t)) (\lambda (t: +T).(subst0 (S (plus i0 (s k i))) u t3 t)) (ex2 T (\lambda (t: T).(subst0 i u3 +(THead k u1 t0) t)) (\lambda (t: T).(subst0 (S (plus i0 i)) u (THead k u0 t3) +t))) (\lambda (x: T).(\lambda (H5: (subst0 (s k i) u3 t0 x)).(\lambda (H6: +(subst0 (S (plus i0 (s k i))) u t3 x)).(ex2_ind T (\lambda (t: T).(subst0 i +u3 u1 t)) (\lambda (t: T).(subst0 (S (plus i0 i)) u u0 t)) (ex2 T (\lambda +(t: T).(subst0 i u3 (THead k u1 t0) t)) (\lambda (t: T).(subst0 (S (plus i0 +i)) u (THead k u0 t3) t))) (\lambda (x0: T).(\lambda (H7: (subst0 i u3 u1 +x0)).(\lambda (H8: (subst0 (S (plus i0 i)) u u0 x0)).(let H9 \def (eq_ind_r +nat (plus i0 (s k i)) (\lambda (n: nat).(subst0 (S n) u t3 x)) H6 (s k (plus +i0 i)) (s_plus_sym k i0 i)) in (let H10 \def (eq_ind_r nat (S (s k (plus i0 +i))) (\lambda (n: nat).(subst0 n u t3 x)) H9 (s k (S (plus i0 i))) (s_S k +(plus i0 i))) in (ex_intro2 T (\lambda (t: T).(subst0 i u3 (THead k u1 t0) +t)) (\lambda (t: T).(subst0 (S (plus i0 i)) u (THead k u0 t3) t)) (THead k x0 +x) (subst0_both u3 u1 x0 i H7 k t0 x H5) (subst0_both u u0 x0 (S (plus i0 i)) +H8 k t3 x H10))))))) (H1 u3 u i0 H4))))) (H3 u3 u i0 H4))))))))))))))))) j u2 +t1 t2 H))))). + +theorem subst0_trans: + \forall (t2: T).(\forall (t1: T).(\forall (v: T).(\forall (i: nat).((subst0 +i v t1 t2) \to (\forall (t3: T).((subst0 i v t2 t3) \to (subst0 i v t1 +t3))))))) +\def + \lambda (t2: T).(\lambda (t1: T).(\lambda (v: T).(\lambda (i: nat).(\lambda +(H: (subst0 i v t1 t2)).(subst0_ind (\lambda (n: nat).(\lambda (t: +T).(\lambda (t0: T).(\lambda (t3: T).(\forall (t4: T).((subst0 n t t3 t4) \to +(subst0 n t t0 t4))))))) (\lambda (v0: T).(\lambda (i0: nat).(\lambda (t3: +T).(\lambda (H0: (subst0 i0 v0 (lift (S i0) O v0) t3)).(subst0_gen_lift_false +v0 v0 t3 (S i0) O i0 (le_O_n i0) (le_n (plus O (S i0))) H0 (subst0 i0 v0 +(TLRef i0) t3)))))) (\lambda (v0: T).(\lambda (u2: T).(\lambda (u1: +T).(\lambda (i0: nat).(\lambda (H0: (subst0 i0 v0 u1 u2)).(\lambda (H1: +((\forall (t3: T).((subst0 i0 v0 u2 t3) \to (subst0 i0 v0 u1 t3))))).(\lambda +(t: T).(\lambda (k: K).(\lambda (t3: T).(\lambda (H2: (subst0 i0 v0 (THead k +u2 t) t3)).(or3_ind (ex2 T (\lambda (u3: T).(eq T t3 (THead k u3 t))) +(\lambda (u3: T).(subst0 i0 v0 u2 u3))) (ex2 T (\lambda (t4: T).(eq T t3 +(THead k u2 t4))) (\lambda (t4: T).(subst0 (s k i0) v0 t t4))) (ex3_2 T T +(\lambda (u3: T).(\lambda (t4: T).(eq T t3 (THead k u3 t4)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 i0 v0 u2 u3))) (\lambda (_: T).(\lambda (t4: +T).(subst0 (s k i0) v0 t t4)))) (subst0 i0 v0 (THead k u1 t) t3) (\lambda +(H3: (ex2 T (\lambda (u3: T).(eq T t3 (THead k u3 t))) (\lambda (u3: +T).(subst0 i0 v0 u2 u3)))).(ex2_ind T (\lambda (u3: T).(eq T t3 (THead k u3 +t))) (\lambda (u3: T).(subst0 i0 v0 u2 u3)) (subst0 i0 v0 (THead k u1 t) t3) +(\lambda (x: T).(\lambda (H4: (eq T t3 (THead k x t))).(\lambda (H5: (subst0 +i0 v0 u2 x)).(eq_ind_r T (THead k x t) (\lambda (t0: T).(subst0 i0 v0 (THead +k u1 t) t0)) (subst0_fst v0 x u1 i0 (H1 x H5) t k) t3 H4)))) H3)) (\lambda +(H3: (ex2 T (\lambda (t4: T).(eq T t3 (THead k u2 t4))) (\lambda (t4: +T).(subst0 (s k i0) v0 t t4)))).(ex2_ind T (\lambda (t4: T).(eq T t3 (THead k +u2 t4))) (\lambda (t4: T).(subst0 (s k i0) v0 t t4)) (subst0 i0 v0 (THead k +u1 t) t3) (\lambda (x: T).(\lambda (H4: (eq T t3 (THead k u2 x))).(\lambda +(H5: (subst0 (s k i0) v0 t x)).(eq_ind_r T (THead k u2 x) (\lambda (t0: +T).(subst0 i0 v0 (THead k u1 t) t0)) (subst0_both v0 u1 u2 i0 H0 k t x H5) t3 +H4)))) H3)) (\lambda (H3: (ex3_2 T T (\lambda (u3: T).(\lambda (t4: T).(eq T +t3 (THead k u3 t4)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i0 v0 u2 u3))) +(\lambda (_: T).(\lambda (t4: T).(subst0 (s k i0) v0 t t4))))).(ex3_2_ind T T +(\lambda (u3: T).(\lambda (t4: T).(eq T t3 (THead k u3 t4)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 i0 v0 u2 u3))) (\lambda (_: T).(\lambda (t4: +T).(subst0 (s k i0) v0 t t4))) (subst0 i0 v0 (THead k u1 t) t3) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H4: (eq T t3 (THead k x0 x1))).(\lambda (H5: +(subst0 i0 v0 u2 x0)).(\lambda (H6: (subst0 (s k i0) v0 t x1)).(eq_ind_r T +(THead k x0 x1) (\lambda (t0: T).(subst0 i0 v0 (THead k u1 t) t0)) +(subst0_both v0 u1 x0 i0 (H1 x0 H5) k t x1 H6) t3 H4)))))) H3)) +(subst0_gen_head k v0 u2 t t3 i0 H2)))))))))))) (\lambda (k: K).(\lambda (v0: +T).(\lambda (t0: T).(\lambda (t3: T).(\lambda (i0: nat).(\lambda (H0: (subst0 +(s k i0) v0 t3 t0)).(\lambda (H1: ((\forall (t4: T).((subst0 (s k i0) v0 t0 +t4) \to (subst0 (s k i0) v0 t3 t4))))).(\lambda (u: T).(\lambda (t4: +T).(\lambda (H2: (subst0 i0 v0 (THead k u t0) t4)).(or3_ind (ex2 T (\lambda +(u2: T).(eq T t4 (THead k u2 t0))) (\lambda (u2: T).(subst0 i0 v0 u u2))) +(ex2 T (\lambda (t5: T).(eq T t4 (THead k u t5))) (\lambda (t5: T).(subst0 (s +k i0) v0 t0 t5))) (ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 +(THead k u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i0 v0 u u2))) +(\lambda (_: T).(\lambda (t5: T).(subst0 (s k i0) v0 t0 t5)))) (subst0 i0 v0 +(THead k u t3) t4) (\lambda (H3: (ex2 T (\lambda (u2: T).(eq T t4 (THead k u2 +t0))) (\lambda (u2: T).(subst0 i0 v0 u u2)))).(ex2_ind T (\lambda (u2: T).(eq +T t4 (THead k u2 t0))) (\lambda (u2: T).(subst0 i0 v0 u u2)) (subst0 i0 v0 +(THead k u t3) t4) (\lambda (x: T).(\lambda (H4: (eq T t4 (THead k x +t0))).(\lambda (H5: (subst0 i0 v0 u x)).(eq_ind_r T (THead k x t0) (\lambda +(t: T).(subst0 i0 v0 (THead k u t3) t)) (subst0_both v0 u x i0 H5 k t3 t0 H0) +t4 H4)))) H3)) (\lambda (H3: (ex2 T (\lambda (t5: T).(eq T t4 (THead k u +t5))) (\lambda (t5: T).(subst0 (s k i0) v0 t0 t5)))).(ex2_ind T (\lambda (t5: +T).(eq T t4 (THead k u t5))) (\lambda (t5: T).(subst0 (s k i0) v0 t0 t5)) +(subst0 i0 v0 (THead k u t3) t4) (\lambda (x: T).(\lambda (H4: (eq T t4 +(THead k u x))).(\lambda (H5: (subst0 (s k i0) v0 t0 x)).(eq_ind_r T (THead k +u x) (\lambda (t: T).(subst0 i0 v0 (THead k u t3) t)) (subst0_snd k v0 x t3 +i0 (H1 x H5) u) t4 H4)))) H3)) (\lambda (H3: (ex3_2 T T (\lambda (u2: +T).(\lambda (t5: T).(eq T t4 (THead k u2 t5)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i0 v0 u u2))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s k i0) v0 +t0 t5))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead k +u2 t5)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i0 v0 u u2))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s k i0) v0 t0 t5))) (subst0 i0 v0 (THead k u t3) +t4) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T t4 (THead k x0 +x1))).(\lambda (H5: (subst0 i0 v0 u x0)).(\lambda (H6: (subst0 (s k i0) v0 t0 +x1)).(eq_ind_r T (THead k x0 x1) (\lambda (t: T).(subst0 i0 v0 (THead k u t3) +t)) (subst0_both v0 u x0 i0 H5 k t3 x1 (H1 x1 H6)) t4 H4)))))) H3)) +(subst0_gen_head k v0 u t0 t4 i0 H2)))))))))))) (\lambda (v0: T).(\lambda +(u1: T).(\lambda (u2: T).(\lambda (i0: nat).(\lambda (H0: (subst0 i0 v0 u1 +u2)).(\lambda (H1: ((\forall (t3: T).((subst0 i0 v0 u2 t3) \to (subst0 i0 v0 +u1 t3))))).(\lambda (k: K).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H2: +(subst0 (s k i0) v0 t0 t3)).(\lambda (H3: ((\forall (t4: T).((subst0 (s k i0) +v0 t3 t4) \to (subst0 (s k i0) v0 t0 t4))))).(\lambda (t4: T).(\lambda (H4: +(subst0 i0 v0 (THead k u2 t3) t4)).(or3_ind (ex2 T (\lambda (u3: T).(eq T t4 +(THead k u3 t3))) (\lambda (u3: T).(subst0 i0 v0 u2 u3))) (ex2 T (\lambda +(t5: T).(eq T t4 (THead k u2 t5))) (\lambda (t5: T).(subst0 (s k i0) v0 t3 +t5))) (ex3_2 T T (\lambda (u3: T).(\lambda (t5: T).(eq T t4 (THead k u3 +t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i0 v0 u2 u3))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s k i0) v0 t3 t5)))) (subst0 i0 v0 (THead k u1 +t0) t4) (\lambda (H5: (ex2 T (\lambda (u3: T).(eq T t4 (THead k u3 t3))) +(\lambda (u3: T).(subst0 i0 v0 u2 u3)))).(ex2_ind T (\lambda (u3: T).(eq T t4 +(THead k u3 t3))) (\lambda (u3: T).(subst0 i0 v0 u2 u3)) (subst0 i0 v0 (THead +k u1 t0) t4) (\lambda (x: T).(\lambda (H6: (eq T t4 (THead k x t3))).(\lambda +(H7: (subst0 i0 v0 u2 x)).(eq_ind_r T (THead k x t3) (\lambda (t: T).(subst0 +i0 v0 (THead k u1 t0) t)) (subst0_both v0 u1 x i0 (H1 x H7) k t0 t3 H2) t4 +H6)))) H5)) (\lambda (H5: (ex2 T (\lambda (t5: T).(eq T t4 (THead k u2 t5))) +(\lambda (t5: T).(subst0 (s k i0) v0 t3 t5)))).(ex2_ind T (\lambda (t5: +T).(eq T t4 (THead k u2 t5))) (\lambda (t5: T).(subst0 (s k i0) v0 t3 t5)) +(subst0 i0 v0 (THead k u1 t0) t4) (\lambda (x: T).(\lambda (H6: (eq T t4 +(THead k u2 x))).(\lambda (H7: (subst0 (s k i0) v0 t3 x)).(eq_ind_r T (THead +k u2 x) (\lambda (t: T).(subst0 i0 v0 (THead k u1 t0) t)) (subst0_both v0 u1 +u2 i0 H0 k t0 x (H3 x H7)) t4 H6)))) H5)) (\lambda (H5: (ex3_2 T T (\lambda +(u3: T).(\lambda (t5: T).(eq T t4 (THead k u3 t5)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 i0 v0 u2 u3))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s k i0) v0 t3 t5))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda +(t5: T).(eq T t4 (THead k u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 +i0 v0 u2 u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s k i0) v0 t3 t5))) +(subst0 i0 v0 (THead k u1 t0) t4) (\lambda (x0: T).(\lambda (x1: T).(\lambda +(H6: (eq T t4 (THead k x0 x1))).(\lambda (H7: (subst0 i0 v0 u2 x0)).(\lambda +(H8: (subst0 (s k i0) v0 t3 x1)).(eq_ind_r T (THead k x0 x1) (\lambda (t: +T).(subst0 i0 v0 (THead k u1 t0) t)) (subst0_both v0 u1 x0 i0 (H1 x0 H7) k t0 +x1 (H3 x1 H8)) t4 H6)))))) H5)) (subst0_gen_head k v0 u2 t3 t4 i0 +H4))))))))))))))) i v t1 t2 H))))). + +theorem subst0_confluence_neq: + \forall (t0: T).(\forall (t1: T).(\forall (u1: T).(\forall (i1: +nat).((subst0 i1 u1 t0 t1) \to (\forall (t2: T).(\forall (u2: T).(\forall +(i2: nat).((subst0 i2 u2 t0 t2) \to ((not (eq nat i1 i2)) \to (ex2 T (\lambda +(t: T).(subst0 i2 u2 t1 t)) (\lambda (t: T).(subst0 i1 u1 t2 t)))))))))))) +\def + \lambda (t0: T).(\lambda (t1: T).(\lambda (u1: T).(\lambda (i1: +nat).(\lambda (H: (subst0 i1 u1 t0 t1)).(subst0_ind (\lambda (n: +nat).(\lambda (t: T).(\lambda (t2: T).(\lambda (t3: T).(\forall (t4: +T).(\forall (u2: T).(\forall (i2: nat).((subst0 i2 u2 t2 t4) \to ((not (eq +nat n i2)) \to (ex2 T (\lambda (t5: T).(subst0 i2 u2 t3 t5)) (\lambda (t5: +T).(subst0 n t t4 t5)))))))))))) (\lambda (v: T).(\lambda (i: nat).(\lambda +(t2: T).(\lambda (u2: T).(\lambda (i2: nat).(\lambda (H0: (subst0 i2 u2 +(TLRef i) t2)).(\lambda (H1: (not (eq nat i i2))).(and_ind (eq nat i i2) (eq +T t2 (lift (S i) O u2)) (ex2 T (\lambda (t: T).(subst0 i2 u2 (lift (S i) O v) +t)) (\lambda (t: T).(subst0 i v t2 t))) (\lambda (H2: (eq nat i i2)).(\lambda +(H3: (eq T t2 (lift (S i) O u2))).(let H4 \def (eq_ind nat i (\lambda (n: +nat).(not (eq nat n i2))) H1 i2 H2) in (eq_ind_r T (lift (S i) O u2) (\lambda +(t: T).(ex2 T (\lambda (t3: T).(subst0 i2 u2 (lift (S i) O v) t3)) (\lambda +(t3: T).(subst0 i v t t3)))) (let H5 \def (match (H4 (refl_equal nat i2)) in +False return (\lambda (_: False).(ex2 T (\lambda (t: T).(subst0 i2 u2 (lift +(S i) O v) t)) (\lambda (t: T).(subst0 i v (lift (S i) O u2) t)))) with []) +in H5) t2 H3)))) (subst0_gen_lref u2 t2 i2 i H0))))))))) (\lambda (v: +T).(\lambda (u2: T).(\lambda (u0: T).(\lambda (i: nat).(\lambda (H0: (subst0 +i v u0 u2)).(\lambda (H1: ((\forall (t2: T).(\forall (u3: T).(\forall (i2: +nat).((subst0 i2 u3 u0 t2) \to ((not (eq nat i i2)) \to (ex2 T (\lambda (t: +T).(subst0 i2 u3 u2 t)) (\lambda (t: T).(subst0 i v t2 t)))))))))).(\lambda +(t: T).(\lambda (k: K).(\lambda (t2: T).(\lambda (u3: T).(\lambda (i2: +nat).(\lambda (H2: (subst0 i2 u3 (THead k u0 t) t2)).(\lambda (H3: (not (eq +nat i i2))).(or3_ind (ex2 T (\lambda (u4: T).(eq T t2 (THead k u4 t))) +(\lambda (u4: T).(subst0 i2 u3 u0 u4))) (ex2 T (\lambda (t3: T).(eq T t2 +(THead k u0 t3))) (\lambda (t3: T).(subst0 (s k i2) u3 t t3))) (ex3_2 T T +(\lambda (u4: T).(\lambda (t3: T).(eq T t2 (THead k u4 t3)))) (\lambda (u4: +T).(\lambda (_: T).(subst0 i2 u3 u0 u4))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s k i2) u3 t t3)))) (ex2 T (\lambda (t3: T).(subst0 i2 u3 (THead +k u2 t) t3)) (\lambda (t3: T).(subst0 i v t2 t3))) (\lambda (H4: (ex2 T +(\lambda (u4: T).(eq T t2 (THead k u4 t))) (\lambda (u4: T).(subst0 i2 u3 u0 +u4)))).(ex2_ind T (\lambda (u4: T).(eq T t2 (THead k u4 t))) (\lambda (u4: +T).(subst0 i2 u3 u0 u4)) (ex2 T (\lambda (t3: T).(subst0 i2 u3 (THead k u2 t) +t3)) (\lambda (t3: T).(subst0 i v t2 t3))) (\lambda (x: T).(\lambda (H5: (eq +T t2 (THead k x t))).(\lambda (H6: (subst0 i2 u3 u0 x)).(eq_ind_r T (THead k +x t) (\lambda (t3: T).(ex2 T (\lambda (t4: T).(subst0 i2 u3 (THead k u2 t) +t4)) (\lambda (t4: T).(subst0 i v t3 t4)))) (ex2_ind T (\lambda (t3: +T).(subst0 i2 u3 u2 t3)) (\lambda (t3: T).(subst0 i v x t3)) (ex2 T (\lambda +(t3: T).(subst0 i2 u3 (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i v (THead +k x t) t3))) (\lambda (x0: T).(\lambda (H7: (subst0 i2 u3 u2 x0)).(\lambda +(H8: (subst0 i v x x0)).(ex_intro2 T (\lambda (t3: T).(subst0 i2 u3 (THead k +u2 t) t3)) (\lambda (t3: T).(subst0 i v (THead k x t) t3)) (THead k x0 t) +(subst0_fst u3 x0 u2 i2 H7 t k) (subst0_fst v x0 x i H8 t k))))) (H1 x u3 i2 +H6 H3)) t2 H5)))) H4)) (\lambda (H4: (ex2 T (\lambda (t3: T).(eq T t2 (THead +k u0 t3))) (\lambda (t3: T).(subst0 (s k i2) u3 t t3)))).(ex2_ind T (\lambda +(t3: T).(eq T t2 (THead k u0 t3))) (\lambda (t3: T).(subst0 (s k i2) u3 t +t3)) (ex2 T (\lambda (t3: T).(subst0 i2 u3 (THead k u2 t) t3)) (\lambda (t3: +T).(subst0 i v t2 t3))) (\lambda (x: T).(\lambda (H5: (eq T t2 (THead k u0 +x))).(\lambda (H6: (subst0 (s k i2) u3 t x)).(eq_ind_r T (THead k u0 x) +(\lambda (t3: T).(ex2 T (\lambda (t4: T).(subst0 i2 u3 (THead k u2 t) t4)) +(\lambda (t4: T).(subst0 i v t3 t4)))) (ex_intro2 T (\lambda (t3: T).(subst0 +i2 u3 (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i v (THead k u0 x) t3)) +(THead k u2 x) (subst0_snd k u3 x t i2 H6 u2) (subst0_fst v u2 u0 i H0 x k)) +t2 H5)))) H4)) (\lambda (H4: (ex3_2 T T (\lambda (u4: T).(\lambda (t3: T).(eq +T t2 (THead k u4 t3)))) (\lambda (u4: T).(\lambda (_: T).(subst0 i2 u3 u0 +u4))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s k i2) u3 t +t3))))).(ex3_2_ind T T (\lambda (u4: T).(\lambda (t3: T).(eq T t2 (THead k u4 +t3)))) (\lambda (u4: T).(\lambda (_: T).(subst0 i2 u3 u0 u4))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s k i2) u3 t t3))) (ex2 T (\lambda (t3: +T).(subst0 i2 u3 (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i v t2 t3))) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (H5: (eq T t2 (THead k x0 +x1))).(\lambda (H6: (subst0 i2 u3 u0 x0)).(\lambda (H7: (subst0 (s k i2) u3 t +x1)).(eq_ind_r T (THead k x0 x1) (\lambda (t3: T).(ex2 T (\lambda (t4: +T).(subst0 i2 u3 (THead k u2 t) t4)) (\lambda (t4: T).(subst0 i v t3 t4)))) +(ex2_ind T (\lambda (t3: T).(subst0 i2 u3 u2 t3)) (\lambda (t3: T).(subst0 i +v x0 t3)) (ex2 T (\lambda (t3: T).(subst0 i2 u3 (THead k u2 t) t3)) (\lambda +(t3: T).(subst0 i v (THead k x0 x1) t3))) (\lambda (x: T).(\lambda (H8: +(subst0 i2 u3 u2 x)).(\lambda (H9: (subst0 i v x0 x)).(ex_intro2 T (\lambda +(t3: T).(subst0 i2 u3 (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i v (THead +k x0 x1) t3)) (THead k x x1) (subst0_both u3 u2 x i2 H8 k t x1 H7) +(subst0_fst v x x0 i H9 x1 k))))) (H1 x0 u3 i2 H6 H3)) t2 H5)))))) H4)) +(subst0_gen_head k u3 u0 t t2 i2 H2))))))))))))))) (\lambda (k: K).(\lambda +(v: T).(\lambda (t2: T).(\lambda (t3: T).(\lambda (i: nat).(\lambda (H0: +(subst0 (s k i) v t3 t2)).(\lambda (H1: ((\forall (t4: T).(\forall (u2: +T).(\forall (i2: nat).((subst0 i2 u2 t3 t4) \to ((not (eq nat (s k i) i2)) +\to (ex2 T (\lambda (t: T).(subst0 i2 u2 t2 t)) (\lambda (t: T).(subst0 (s k +i) v t4 t)))))))))).(\lambda (u: T).(\lambda (t4: T).(\lambda (u2: +T).(\lambda (i2: nat).(\lambda (H2: (subst0 i2 u2 (THead k u t3) +t4)).(\lambda (H3: (not (eq nat i i2))).(or3_ind (ex2 T (\lambda (u3: T).(eq +T t4 (THead k u3 t3))) (\lambda (u3: T).(subst0 i2 u2 u u3))) (ex2 T (\lambda +(t5: T).(eq T t4 (THead k u t5))) (\lambda (t5: T).(subst0 (s k i2) u2 t3 +t5))) (ex3_2 T T (\lambda (u3: T).(\lambda (t5: T).(eq T t4 (THead k u3 +t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i2 u2 u u3))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s k i2) u2 t3 t5)))) (ex2 T (\lambda (t: +T).(subst0 i2 u2 (THead k u t2) t)) (\lambda (t: T).(subst0 i v t4 t))) +(\lambda (H4: (ex2 T (\lambda (u3: T).(eq T t4 (THead k u3 t3))) (\lambda +(u3: T).(subst0 i2 u2 u u3)))).(ex2_ind T (\lambda (u3: T).(eq T t4 (THead k +u3 t3))) (\lambda (u3: T).(subst0 i2 u2 u u3)) (ex2 T (\lambda (t: T).(subst0 +i2 u2 (THead k u t2) t)) (\lambda (t: T).(subst0 i v t4 t))) (\lambda (x: +T).(\lambda (H5: (eq T t4 (THead k x t3))).(\lambda (H6: (subst0 i2 u2 u +x)).(eq_ind_r T (THead k x t3) (\lambda (t: T).(ex2 T (\lambda (t5: +T).(subst0 i2 u2 (THead k u t2) t5)) (\lambda (t5: T).(subst0 i v t t5)))) +(ex_intro2 T (\lambda (t: T).(subst0 i2 u2 (THead k u t2) t)) (\lambda (t: +T).(subst0 i v (THead k x t3) t)) (THead k x t2) (subst0_fst u2 x u i2 H6 t2 +k) (subst0_snd k v t2 t3 i H0 x)) t4 H5)))) H4)) (\lambda (H4: (ex2 T +(\lambda (t5: T).(eq T t4 (THead k u t5))) (\lambda (t5: T).(subst0 (s k i2) +u2 t3 t5)))).(ex2_ind T (\lambda (t5: T).(eq T t4 (THead k u t5))) (\lambda +(t5: T).(subst0 (s k i2) u2 t3 t5)) (ex2 T (\lambda (t: T).(subst0 i2 u2 +(THead k u t2) t)) (\lambda (t: T).(subst0 i v t4 t))) (\lambda (x: +T).(\lambda (H5: (eq T t4 (THead k u x))).(\lambda (H6: (subst0 (s k i2) u2 +t3 x)).(eq_ind_r T (THead k u x) (\lambda (t: T).(ex2 T (\lambda (t5: +T).(subst0 i2 u2 (THead k u t2) t5)) (\lambda (t5: T).(subst0 i v t t5)))) +(ex2_ind T (\lambda (t: T).(subst0 (s k i2) u2 t2 t)) (\lambda (t: T).(subst0 +(s k i) v x t)) (ex2 T (\lambda (t: T).(subst0 i2 u2 (THead k u t2) t)) +(\lambda (t: T).(subst0 i v (THead k u x) t))) (\lambda (x0: T).(\lambda (H7: +(subst0 (s k i2) u2 t2 x0)).(\lambda (H8: (subst0 (s k i) v x x0)).(ex_intro2 +T (\lambda (t: T).(subst0 i2 u2 (THead k u t2) t)) (\lambda (t: T).(subst0 i +v (THead k u x) t)) (THead k u x0) (subst0_snd k u2 x0 t2 i2 H7 u) +(subst0_snd k v x0 x i H8 u))))) (H1 x u2 (s k i2) H6 (\lambda (H7: (eq nat +(s k i) (s k i2))).(H3 (s_inj k i i2 H7))))) t4 H5)))) H4)) (\lambda (H4: +(ex3_2 T T (\lambda (u3: T).(\lambda (t5: T).(eq T t4 (THead k u3 t5)))) +(\lambda (u3: T).(\lambda (_: T).(subst0 i2 u2 u u3))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s k i2) u2 t3 t5))))).(ex3_2_ind T T (\lambda +(u3: T).(\lambda (t5: T).(eq T t4 (THead k u3 t5)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 i2 u2 u u3))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s k i2) u2 t3 t5))) (ex2 T (\lambda (t: T).(subst0 i2 u2 (THead k +u t2) t)) (\lambda (t: T).(subst0 i v t4 t))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H5: (eq T t4 (THead k x0 x1))).(\lambda (H6: (subst0 i2 u2 u +x0)).(\lambda (H7: (subst0 (s k i2) u2 t3 x1)).(eq_ind_r T (THead k x0 x1) +(\lambda (t: T).(ex2 T (\lambda (t5: T).(subst0 i2 u2 (THead k u t2) t5)) +(\lambda (t5: T).(subst0 i v t t5)))) (ex2_ind T (\lambda (t: T).(subst0 (s k +i2) u2 t2 t)) (\lambda (t: T).(subst0 (s k i) v x1 t)) (ex2 T (\lambda (t: +T).(subst0 i2 u2 (THead k u t2) t)) (\lambda (t: T).(subst0 i v (THead k x0 +x1) t))) (\lambda (x: T).(\lambda (H8: (subst0 (s k i2) u2 t2 x)).(\lambda +(H9: (subst0 (s k i) v x1 x)).(ex_intro2 T (\lambda (t: T).(subst0 i2 u2 +(THead k u t2) t)) (\lambda (t: T).(subst0 i v (THead k x0 x1) t)) (THead k +x0 x) (subst0_both u2 u x0 i2 H6 k t2 x H8) (subst0_snd k v x x1 i H9 x0))))) +(H1 x1 u2 (s k i2) H7 (\lambda (H8: (eq nat (s k i) (s k i2))).(H3 (s_inj k i +i2 H8))))) t4 H5)))))) H4)) (subst0_gen_head k u2 u t3 t4 i2 +H2))))))))))))))) (\lambda (v: T).(\lambda (u0: T).(\lambda (u2: T).(\lambda +(i: nat).(\lambda (H0: (subst0 i v u0 u2)).(\lambda (H1: ((\forall (t2: +T).(\forall (u3: T).(\forall (i2: nat).((subst0 i2 u3 u0 t2) \to ((not (eq +nat i i2)) \to (ex2 T (\lambda (t: T).(subst0 i2 u3 u2 t)) (\lambda (t: +T).(subst0 i v t2 t)))))))))).(\lambda (k: K).(\lambda (t2: T).(\lambda (t3: +T).(\lambda (H2: (subst0 (s k i) v t2 t3)).(\lambda (H3: ((\forall (t4: +T).(\forall (u3: T).(\forall (i2: nat).((subst0 i2 u3 t2 t4) \to ((not (eq +nat (s k i) i2)) \to (ex2 T (\lambda (t: T).(subst0 i2 u3 t3 t)) (\lambda (t: +T).(subst0 (s k i) v t4 t)))))))))).(\lambda (t4: T).(\lambda (u3: +T).(\lambda (i2: nat).(\lambda (H4: (subst0 i2 u3 (THead k u0 t2) +t4)).(\lambda (H5: (not (eq nat i i2))).(or3_ind (ex2 T (\lambda (u4: T).(eq +T t4 (THead k u4 t2))) (\lambda (u4: T).(subst0 i2 u3 u0 u4))) (ex2 T +(\lambda (t5: T).(eq T t4 (THead k u0 t5))) (\lambda (t5: T).(subst0 (s k i2) +u3 t2 t5))) (ex3_2 T T (\lambda (u4: T).(\lambda (t5: T).(eq T t4 (THead k u4 +t5)))) (\lambda (u4: T).(\lambda (_: T).(subst0 i2 u3 u0 u4))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s k i2) u3 t2 t5)))) (ex2 T (\lambda (t: +T).(subst0 i2 u3 (THead k u2 t3) t)) (\lambda (t: T).(subst0 i v t4 t))) +(\lambda (H6: (ex2 T (\lambda (u4: T).(eq T t4 (THead k u4 t2))) (\lambda +(u4: T).(subst0 i2 u3 u0 u4)))).(ex2_ind T (\lambda (u4: T).(eq T t4 (THead k +u4 t2))) (\lambda (u4: T).(subst0 i2 u3 u0 u4)) (ex2 T (\lambda (t: +T).(subst0 i2 u3 (THead k u2 t3) t)) (\lambda (t: T).(subst0 i v t4 t))) +(\lambda (x: T).(\lambda (H7: (eq T t4 (THead k x t2))).(\lambda (H8: (subst0 +i2 u3 u0 x)).(eq_ind_r T (THead k x t2) (\lambda (t: T).(ex2 T (\lambda (t5: +T).(subst0 i2 u3 (THead k u2 t3) t5)) (\lambda (t5: T).(subst0 i v t t5)))) +(ex2_ind T (\lambda (t: T).(subst0 i2 u3 u2 t)) (\lambda (t: T).(subst0 i v x +t)) (ex2 T (\lambda (t: T).(subst0 i2 u3 (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i v (THead k x t2) t))) (\lambda (x0: T).(\lambda (H9: (subst0 i2 +u3 u2 x0)).(\lambda (H10: (subst0 i v x x0)).(ex_intro2 T (\lambda (t: +T).(subst0 i2 u3 (THead k u2 t3) t)) (\lambda (t: T).(subst0 i v (THead k x +t2) t)) (THead k x0 t3) (subst0_fst u3 x0 u2 i2 H9 t3 k) (subst0_both v x x0 +i H10 k t2 t3 H2))))) (H1 x u3 i2 H8 H5)) t4 H7)))) H6)) (\lambda (H6: (ex2 T +(\lambda (t5: T).(eq T t4 (THead k u0 t5))) (\lambda (t5: T).(subst0 (s k i2) +u3 t2 t5)))).(ex2_ind T (\lambda (t5: T).(eq T t4 (THead k u0 t5))) (\lambda +(t5: T).(subst0 (s k i2) u3 t2 t5)) (ex2 T (\lambda (t: T).(subst0 i2 u3 +(THead k u2 t3) t)) (\lambda (t: T).(subst0 i v t4 t))) (\lambda (x: +T).(\lambda (H7: (eq T t4 (THead k u0 x))).(\lambda (H8: (subst0 (s k i2) u3 +t2 x)).(eq_ind_r T (THead k u0 x) (\lambda (t: T).(ex2 T (\lambda (t5: +T).(subst0 i2 u3 (THead k u2 t3) t5)) (\lambda (t5: T).(subst0 i v t t5)))) +(ex2_ind T (\lambda (t: T).(subst0 (s k i2) u3 t3 t)) (\lambda (t: T).(subst0 +(s k i) v x t)) (ex2 T (\lambda (t: T).(subst0 i2 u3 (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i v (THead k u0 x) t))) (\lambda (x0: T).(\lambda +(H9: (subst0 (s k i2) u3 t3 x0)).(\lambda (H10: (subst0 (s k i) v x +x0)).(ex_intro2 T (\lambda (t: T).(subst0 i2 u3 (THead k u2 t3) t)) (\lambda +(t: T).(subst0 i v (THead k u0 x) t)) (THead k u2 x0) (subst0_snd k u3 x0 t3 +i2 H9 u2) (subst0_both v u0 u2 i H0 k x x0 H10))))) (H3 x u3 (s k i2) H8 +(\lambda (H9: (eq nat (s k i) (s k i2))).(H5 (s_inj k i i2 H9))))) t4 H7)))) +H6)) (\lambda (H6: (ex3_2 T T (\lambda (u4: T).(\lambda (t5: T).(eq T t4 +(THead k u4 t5)))) (\lambda (u4: T).(\lambda (_: T).(subst0 i2 u3 u0 u4))) +(\lambda (_: T).(\lambda (t5: T).(subst0 (s k i2) u3 t2 t5))))).(ex3_2_ind T +T (\lambda (u4: T).(\lambda (t5: T).(eq T t4 (THead k u4 t5)))) (\lambda (u4: +T).(\lambda (_: T).(subst0 i2 u3 u0 u4))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s k i2) u3 t2 t5))) (ex2 T (\lambda (t: T).(subst0 i2 u3 (THead k +u2 t3) t)) (\lambda (t: T).(subst0 i v t4 t))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H7: (eq T t4 (THead k x0 x1))).(\lambda (H8: (subst0 i2 u3 u0 +x0)).(\lambda (H9: (subst0 (s k i2) u3 t2 x1)).(eq_ind_r T (THead k x0 x1) +(\lambda (t: T).(ex2 T (\lambda (t5: T).(subst0 i2 u3 (THead k u2 t3) t5)) +(\lambda (t5: T).(subst0 i v t t5)))) (ex2_ind T (\lambda (t: T).(subst0 i2 +u3 u2 t)) (\lambda (t: T).(subst0 i v x0 t)) (ex2 T (\lambda (t: T).(subst0 +i2 u3 (THead k u2 t3) t)) (\lambda (t: T).(subst0 i v (THead k x0 x1) t))) +(\lambda (x: T).(\lambda (H10: (subst0 i2 u3 u2 x)).(\lambda (H11: (subst0 i +v x0 x)).(ex2_ind T (\lambda (t: T).(subst0 (s k i2) u3 t3 t)) (\lambda (t: +T).(subst0 (s k i) v x1 t)) (ex2 T (\lambda (t: T).(subst0 i2 u3 (THead k u2 +t3) t)) (\lambda (t: T).(subst0 i v (THead k x0 x1) t))) (\lambda (x2: +T).(\lambda (H12: (subst0 (s k i2) u3 t3 x2)).(\lambda (H13: (subst0 (s k i) +v x1 x2)).(ex_intro2 T (\lambda (t: T).(subst0 i2 u3 (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i v (THead k x0 x1) t)) (THead k x x2) (subst0_both +u3 u2 x i2 H10 k t3 x2 H12) (subst0_both v x0 x i H11 k x1 x2 H13))))) (H3 x1 +u3 (s k i2) H9 (\lambda (H12: (eq nat (s k i) (s k i2))).(H5 (s_inj k i i2 +H12)))))))) (H1 x0 u3 i2 H8 H5)) t4 H7)))))) H6)) (subst0_gen_head k u3 u0 t2 +t4 i2 H4)))))))))))))))))) i1 u1 t0 t1 H))))). + +theorem subst0_confluence_eq: + \forall (t0: T).(\forall (t1: T).(\forall (u: T).(\forall (i: nat).((subst0 +i u t0 t1) \to (\forall (t2: T).((subst0 i u t0 t2) \to (or4 (eq T t1 t2) +(ex2 T (\lambda (t: T).(subst0 i u t1 t)) (\lambda (t: T).(subst0 i u t2 t))) +(subst0 i u t1 t2) (subst0 i u t2 t1)))))))) +\def + \lambda (t0: T).(\lambda (t1: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (subst0 i u t0 t1)).(subst0_ind (\lambda (n: nat).(\lambda (t: +T).(\lambda (t2: T).(\lambda (t3: T).(\forall (t4: T).((subst0 n t t2 t4) \to +(or4 (eq T t3 t4) (ex2 T (\lambda (t5: T).(subst0 n t t3 t5)) (\lambda (t5: +T).(subst0 n t t4 t5))) (subst0 n t t3 t4) (subst0 n t t4 t3)))))))) (\lambda +(v: T).(\lambda (i0: nat).(\lambda (t2: T).(\lambda (H0: (subst0 i0 v (TLRef +i0) t2)).(and_ind (eq nat i0 i0) (eq T t2 (lift (S i0) O v)) (or4 (eq T (lift +(S i0) O v) t2) (ex2 T (\lambda (t: T).(subst0 i0 v (lift (S i0) O v) t)) +(\lambda (t: T).(subst0 i0 v t2 t))) (subst0 i0 v (lift (S i0) O v) t2) +(subst0 i0 v t2 (lift (S i0) O v))) (\lambda (_: (eq nat i0 i0)).(\lambda +(H2: (eq T t2 (lift (S i0) O v))).(or4_intro0 (eq T (lift (S i0) O v) t2) +(ex2 T (\lambda (t: T).(subst0 i0 v (lift (S i0) O v) t)) (\lambda (t: +T).(subst0 i0 v t2 t))) (subst0 i0 v (lift (S i0) O v) t2) (subst0 i0 v t2 +(lift (S i0) O v)) (sym_eq T t2 (lift (S i0) O v) H2)))) (subst0_gen_lref v +t2 i0 i0 H0)))))) (\lambda (v: T).(\lambda (u2: T).(\lambda (u1: T).(\lambda +(i0: nat).(\lambda (H0: (subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (t2: +T).((subst0 i0 v u1 t2) \to (or4 (eq T u2 t2) (ex2 T (\lambda (t: T).(subst0 +i0 v u2 t)) (\lambda (t: T).(subst0 i0 v t2 t))) (subst0 i0 v u2 t2) (subst0 +i0 v t2 u2)))))).(\lambda (t: T).(\lambda (k: K).(\lambda (t2: T).(\lambda +(H2: (subst0 i0 v (THead k u1 t) t2)).(or3_ind (ex2 T (\lambda (u3: T).(eq T +t2 (THead k u3 t))) (\lambda (u3: T).(subst0 i0 v u1 u3))) (ex2 T (\lambda +(t3: T).(eq T t2 (THead k u1 t3))) (\lambda (t3: T).(subst0 (s k i0) v t +t3))) (ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq T t2 (THead k u3 +t3)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i0 v u1 u3))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s k i0) v t t3)))) (or4 (eq T (THead k u2 t) t2) +(ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: +T).(subst0 i0 v t2 t3))) (subst0 i0 v (THead k u2 t) t2) (subst0 i0 v t2 +(THead k u2 t))) (\lambda (H3: (ex2 T (\lambda (u3: T).(eq T t2 (THead k u3 +t))) (\lambda (u3: T).(subst0 i0 v u1 u3)))).(ex2_ind T (\lambda (u3: T).(eq +T t2 (THead k u3 t))) (\lambda (u3: T).(subst0 i0 v u1 u3)) (or4 (eq T (THead +k u2 t) t2) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda +(t3: T).(subst0 i0 v t2 t3))) (subst0 i0 v (THead k u2 t) t2) (subst0 i0 v t2 +(THead k u2 t))) (\lambda (x: T).(\lambda (H4: (eq T t2 (THead k x +t))).(\lambda (H5: (subst0 i0 v u1 x)).(eq_ind_r T (THead k x t) (\lambda +(t3: T).(or4 (eq T (THead k u2 t) t3) (ex2 T (\lambda (t4: T).(subst0 i0 v +(THead k u2 t) t4)) (\lambda (t4: T).(subst0 i0 v t3 t4))) (subst0 i0 v +(THead k u2 t) t3) (subst0 i0 v t3 (THead k u2 t)))) (or4_ind (eq T u2 x) +(ex2 T (\lambda (t3: T).(subst0 i0 v u2 t3)) (\lambda (t3: T).(subst0 i0 v x +t3))) (subst0 i0 v u2 x) (subst0 i0 v x u2) (or4 (eq T (THead k u2 t) (THead +k x t)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda +(t3: T).(subst0 i0 v (THead k x t) t3))) (subst0 i0 v (THead k u2 t) (THead k +x t)) (subst0 i0 v (THead k x t) (THead k u2 t))) (\lambda (H6: (eq T u2 +x)).(eq_ind_r T x (\lambda (t3: T).(or4 (eq T (THead k t3 t) (THead k x t)) +(ex2 T (\lambda (t4: T).(subst0 i0 v (THead k t3 t) t4)) (\lambda (t4: +T).(subst0 i0 v (THead k x t) t4))) (subst0 i0 v (THead k t3 t) (THead k x +t)) (subst0 i0 v (THead k x t) (THead k t3 t)))) (or4_intro0 (eq T (THead k x +t) (THead k x t)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k x t) t3)) +(\lambda (t3: T).(subst0 i0 v (THead k x t) t3))) (subst0 i0 v (THead k x t) +(THead k x t)) (subst0 i0 v (THead k x t) (THead k x t)) (refl_equal T (THead +k x t))) u2 H6)) (\lambda (H6: (ex2 T (\lambda (t3: T).(subst0 i0 v u2 t3)) +(\lambda (t3: T).(subst0 i0 v x t3)))).(ex2_ind T (\lambda (t3: T).(subst0 i0 +v u2 t3)) (\lambda (t3: T).(subst0 i0 v x t3)) (or4 (eq T (THead k u2 t) +(THead k x t)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) +(\lambda (t3: T).(subst0 i0 v (THead k x t) t3))) (subst0 i0 v (THead k u2 t) +(THead k x t)) (subst0 i0 v (THead k x t) (THead k u2 t))) (\lambda (x0: +T).(\lambda (H7: (subst0 i0 v u2 x0)).(\lambda (H8: (subst0 i0 v x +x0)).(or4_intro1 (eq T (THead k u2 t) (THead k x t)) (ex2 T (\lambda (t3: +T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i0 v (THead k x +t) t3))) (subst0 i0 v (THead k u2 t) (THead k x t)) (subst0 i0 v (THead k x +t) (THead k u2 t)) (ex_intro2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) +t3)) (\lambda (t3: T).(subst0 i0 v (THead k x t) t3)) (THead k x0 t) +(subst0_fst v x0 u2 i0 H7 t k) (subst0_fst v x0 x i0 H8 t k)))))) H6)) +(\lambda (H6: (subst0 i0 v u2 x)).(or4_intro2 (eq T (THead k u2 t) (THead k x +t)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: +T).(subst0 i0 v (THead k x t) t3))) (subst0 i0 v (THead k u2 t) (THead k x +t)) (subst0 i0 v (THead k x t) (THead k u2 t)) (subst0_fst v x u2 i0 H6 t +k))) (\lambda (H6: (subst0 i0 v x u2)).(or4_intro3 (eq T (THead k u2 t) +(THead k x t)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) +(\lambda (t3: T).(subst0 i0 v (THead k x t) t3))) (subst0 i0 v (THead k u2 t) +(THead k x t)) (subst0 i0 v (THead k x t) (THead k u2 t)) (subst0_fst v u2 x +i0 H6 t k))) (H1 x H5)) t2 H4)))) H3)) (\lambda (H3: (ex2 T (\lambda (t3: +T).(eq T t2 (THead k u1 t3))) (\lambda (t3: T).(subst0 (s k i0) v t +t3)))).(ex2_ind T (\lambda (t3: T).(eq T t2 (THead k u1 t3))) (\lambda (t3: +T).(subst0 (s k i0) v t t3)) (or4 (eq T (THead k u2 t) t2) (ex2 T (\lambda +(t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i0 v t2 +t3))) (subst0 i0 v (THead k u2 t) t2) (subst0 i0 v t2 (THead k u2 t))) +(\lambda (x: T).(\lambda (H4: (eq T t2 (THead k u1 x))).(\lambda (H5: (subst0 +(s k i0) v t x)).(eq_ind_r T (THead k u1 x) (\lambda (t3: T).(or4 (eq T +(THead k u2 t) t3) (ex2 T (\lambda (t4: T).(subst0 i0 v (THead k u2 t) t4)) +(\lambda (t4: T).(subst0 i0 v t3 t4))) (subst0 i0 v (THead k u2 t) t3) +(subst0 i0 v t3 (THead k u2 t)))) (or4_ind (eq T u2 u2) (ex2 T (\lambda (t3: +T).(subst0 i0 v u2 t3)) (\lambda (t3: T).(subst0 i0 v u2 t3))) (subst0 i0 v +u2 u2) (subst0 i0 v u2 u2) (or4 (eq T (THead k u2 t) (THead k u1 x)) (ex2 T +(\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i0 +v (THead k u1 x) t3))) (subst0 i0 v (THead k u2 t) (THead k u1 x)) (subst0 i0 +v (THead k u1 x) (THead k u2 t))) (\lambda (_: (eq T u2 u2)).(or4_intro1 (eq +T (THead k u2 t) (THead k u1 x)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead +k u2 t) t3)) (\lambda (t3: T).(subst0 i0 v (THead k u1 x) t3))) (subst0 i0 v +(THead k u2 t) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t)) +(ex_intro2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: +T).(subst0 i0 v (THead k u1 x) t3)) (THead k u2 x) (subst0_snd k v x t i0 H5 +u2) (subst0_fst v u2 u1 i0 H0 x k)))) (\lambda (H6: (ex2 T (\lambda (t3: +T).(subst0 i0 v u2 t3)) (\lambda (t3: T).(subst0 i0 v u2 t3)))).(ex2_ind T +(\lambda (t3: T).(subst0 i0 v u2 t3)) (\lambda (t3: T).(subst0 i0 v u2 t3)) +(or4 (eq T (THead k u2 t) (THead k u1 x)) (ex2 T (\lambda (t3: T).(subst0 i0 +v (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i0 v (THead k u1 x) t3))) +(subst0 i0 v (THead k u2 t) (THead k u1 x)) (subst0 i0 v (THead k u1 x) +(THead k u2 t))) (\lambda (x0: T).(\lambda (_: (subst0 i0 v u2 x0)).(\lambda +(_: (subst0 i0 v u2 x0)).(or4_intro1 (eq T (THead k u2 t) (THead k u1 x)) +(ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: +T).(subst0 i0 v (THead k u1 x) t3))) (subst0 i0 v (THead k u2 t) (THead k u1 +x)) (subst0 i0 v (THead k u1 x) (THead k u2 t)) (ex_intro2 T (\lambda (t3: +T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i0 v (THead k u1 +x) t3)) (THead k u2 x) (subst0_snd k v x t i0 H5 u2) (subst0_fst v u2 u1 i0 +H0 x k)))))) H6)) (\lambda (_: (subst0 i0 v u2 u2)).(or4_intro1 (eq T (THead +k u2 t) (THead k u1 x)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) +t3)) (\lambda (t3: T).(subst0 i0 v (THead k u1 x) t3))) (subst0 i0 v (THead k +u2 t) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t)) (ex_intro2 +T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: T).(subst0 +i0 v (THead k u1 x) t3)) (THead k u2 x) (subst0_snd k v x t i0 H5 u2) +(subst0_fst v u2 u1 i0 H0 x k)))) (\lambda (_: (subst0 i0 v u2 +u2)).(or4_intro1 (eq T (THead k u2 t) (THead k u1 x)) (ex2 T (\lambda (t3: +T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i0 v (THead k u1 +x) t3))) (subst0 i0 v (THead k u2 t) (THead k u1 x)) (subst0 i0 v (THead k u1 +x) (THead k u2 t)) (ex_intro2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) +t3)) (\lambda (t3: T).(subst0 i0 v (THead k u1 x) t3)) (THead k u2 x) +(subst0_snd k v x t i0 H5 u2) (subst0_fst v u2 u1 i0 H0 x k)))) (H1 u2 H0)) +t2 H4)))) H3)) (\lambda (H3: (ex3_2 T T (\lambda (u3: T).(\lambda (t3: T).(eq +T t2 (THead k u3 t3)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i0 v u1 +u3))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s k i0) v t +t3))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t3: T).(eq T t2 (THead k u3 +t3)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i0 v u1 u3))) (\lambda (_: +T).(\lambda (t3: T).(subst0 (s k i0) v t t3))) (or4 (eq T (THead k u2 t) t2) +(ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: +T).(subst0 i0 v t2 t3))) (subst0 i0 v (THead k u2 t) t2) (subst0 i0 v t2 +(THead k u2 t))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H4: (eq T t2 +(THead k x0 x1))).(\lambda (H5: (subst0 i0 v u1 x0)).(\lambda (H6: (subst0 (s +k i0) v t x1)).(eq_ind_r T (THead k x0 x1) (\lambda (t3: T).(or4 (eq T (THead +k u2 t) t3) (ex2 T (\lambda (t4: T).(subst0 i0 v (THead k u2 t) t4)) (\lambda +(t4: T).(subst0 i0 v t3 t4))) (subst0 i0 v (THead k u2 t) t3) (subst0 i0 v t3 +(THead k u2 t)))) (or4_ind (eq T u2 x0) (ex2 T (\lambda (t3: T).(subst0 i0 v +u2 t3)) (\lambda (t3: T).(subst0 i0 v x0 t3))) (subst0 i0 v u2 x0) (subst0 i0 +v x0 u2) (or4 (eq T (THead k u2 t) (THead k x0 x1)) (ex2 T (\lambda (t3: +T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i0 v (THead k x0 +x1) t3))) (subst0 i0 v (THead k u2 t) (THead k x0 x1)) (subst0 i0 v (THead k +x0 x1) (THead k u2 t))) (\lambda (H7: (eq T u2 x0)).(eq_ind_r T x0 (\lambda +(t3: T).(or4 (eq T (THead k t3 t) (THead k x0 x1)) (ex2 T (\lambda (t4: +T).(subst0 i0 v (THead k t3 t) t4)) (\lambda (t4: T).(subst0 i0 v (THead k x0 +x1) t4))) (subst0 i0 v (THead k t3 t) (THead k x0 x1)) (subst0 i0 v (THead k +x0 x1) (THead k t3 t)))) (or4_intro2 (eq T (THead k x0 t) (THead k x0 x1)) +(ex2 T (\lambda (t3: T).(subst0 i0 v (THead k x0 t) t3)) (\lambda (t3: +T).(subst0 i0 v (THead k x0 x1) t3))) (subst0 i0 v (THead k x0 t) (THead k x0 +x1)) (subst0 i0 v (THead k x0 x1) (THead k x0 t)) (subst0_snd k v x1 t i0 H6 +x0)) u2 H7)) (\lambda (H7: (ex2 T (\lambda (t3: T).(subst0 i0 v u2 t3)) +(\lambda (t3: T).(subst0 i0 v x0 t3)))).(ex2_ind T (\lambda (t3: T).(subst0 +i0 v u2 t3)) (\lambda (t3: T).(subst0 i0 v x0 t3)) (or4 (eq T (THead k u2 t) +(THead k x0 x1)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) +(\lambda (t3: T).(subst0 i0 v (THead k x0 x1) t3))) (subst0 i0 v (THead k u2 +t) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t))) (\lambda +(x: T).(\lambda (H8: (subst0 i0 v u2 x)).(\lambda (H9: (subst0 i0 v x0 +x)).(or4_intro1 (eq T (THead k u2 t) (THead k x0 x1)) (ex2 T (\lambda (t3: +T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: T).(subst0 i0 v (THead k x0 +x1) t3))) (subst0 i0 v (THead k u2 t) (THead k x0 x1)) (subst0 i0 v (THead k +x0 x1) (THead k u2 t)) (ex_intro2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 +t) t3)) (\lambda (t3: T).(subst0 i0 v (THead k x0 x1) t3)) (THead k x x1) +(subst0_both v u2 x i0 H8 k t x1 H6) (subst0_fst v x x0 i0 H9 x1 k)))))) H7)) +(\lambda (H7: (subst0 i0 v u2 x0)).(or4_intro2 (eq T (THead k u2 t) (THead k +x0 x1)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda +(t3: T).(subst0 i0 v (THead k x0 x1) t3))) (subst0 i0 v (THead k u2 t) (THead +k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t)) (subst0_both v u2 x0 +i0 H7 k t x1 H6))) (\lambda (H7: (subst0 i0 v x0 u2)).(or4_intro1 (eq T +(THead k u2 t) (THead k x0 x1)) (ex2 T (\lambda (t3: T).(subst0 i0 v (THead k +u2 t) t3)) (\lambda (t3: T).(subst0 i0 v (THead k x0 x1) t3))) (subst0 i0 v +(THead k u2 t) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t)) +(ex_intro2 T (\lambda (t3: T).(subst0 i0 v (THead k u2 t) t3)) (\lambda (t3: +T).(subst0 i0 v (THead k x0 x1) t3)) (THead k u2 x1) (subst0_snd k v x1 t i0 +H6 u2) (subst0_fst v u2 x0 i0 H7 x1 k)))) (H1 x0 H5)) t2 H4)))))) H3)) +(subst0_gen_head k v u1 t t2 i0 H2)))))))))))) (\lambda (k: K).(\lambda (v: +T).(\lambda (t2: T).(\lambda (t3: T).(\lambda (i0: nat).(\lambda (H0: (subst0 +(s k i0) v t3 t2)).(\lambda (H1: ((\forall (t4: T).((subst0 (s k i0) v t3 t4) +\to (or4 (eq T t2 t4) (ex2 T (\lambda (t: T).(subst0 (s k i0) v t2 t)) +(\lambda (t: T).(subst0 (s k i0) v t4 t))) (subst0 (s k i0) v t2 t4) (subst0 +(s k i0) v t4 t2)))))).(\lambda (u0: T).(\lambda (t4: T).(\lambda (H2: +(subst0 i0 v (THead k u0 t3) t4)).(or3_ind (ex2 T (\lambda (u2: T).(eq T t4 +(THead k u2 t3))) (\lambda (u2: T).(subst0 i0 v u0 u2))) (ex2 T (\lambda (t5: +T).(eq T t4 (THead k u0 t5))) (\lambda (t5: T).(subst0 (s k i0) v t3 t5))) +(ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead k u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i0 v u0 u2))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s k i0) v t3 t5)))) (or4 (eq T (THead k u0 t2) +t4) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: +T).(subst0 i0 v t4 t))) (subst0 i0 v (THead k u0 t2) t4) (subst0 i0 v t4 +(THead k u0 t2))) (\lambda (H3: (ex2 T (\lambda (u2: T).(eq T t4 (THead k u2 +t3))) (\lambda (u2: T).(subst0 i0 v u0 u2)))).(ex2_ind T (\lambda (u2: T).(eq +T t4 (THead k u2 t3))) (\lambda (u2: T).(subst0 i0 v u0 u2)) (or4 (eq T +(THead k u0 t2) t4) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u0 t2) t)) +(\lambda (t: T).(subst0 i0 v t4 t))) (subst0 i0 v (THead k u0 t2) t4) (subst0 +i0 v t4 (THead k u0 t2))) (\lambda (x: T).(\lambda (H4: (eq T t4 (THead k x +t3))).(\lambda (H5: (subst0 i0 v u0 x)).(eq_ind_r T (THead k x t3) (\lambda +(t: T).(or4 (eq T (THead k u0 t2) t) (ex2 T (\lambda (t5: T).(subst0 i0 v +(THead k u0 t2) t5)) (\lambda (t5: T).(subst0 i0 v t t5))) (subst0 i0 v +(THead k u0 t2) t) (subst0 i0 v t (THead k u0 t2)))) (or4_ind (eq T t2 t2) +(ex2 T (\lambda (t: T).(subst0 (s k i0) v t2 t)) (\lambda (t: T).(subst0 (s k +i0) v t2 t))) (subst0 (s k i0) v t2 t2) (subst0 (s k i0) v t2 t2) (or4 (eq T +(THead k u0 t2) (THead k x t3)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x t3) t))) (subst0 i0 v +(THead k u0 t2) (THead k x t3)) (subst0 i0 v (THead k x t3) (THead k u0 t2))) +(\lambda (_: (eq T t2 t2)).(or4_intro1 (eq T (THead k u0 t2) (THead k x t3)) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t3) t))) (subst0 i0 v (THead k u0 t2) (THead k x +t3)) (subst0 i0 v (THead k x t3) (THead k u0 t2)) (ex_intro2 T (\lambda (t: +T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x +t3) t)) (THead k x t2) (subst0_fst v x u0 i0 H5 t2 k) (subst0_snd k v t2 t3 +i0 H0 x)))) (\lambda (H6: (ex2 T (\lambda (t: T).(subst0 (s k i0) v t2 t)) +(\lambda (t: T).(subst0 (s k i0) v t2 t)))).(ex2_ind T (\lambda (t: +T).(subst0 (s k i0) v t2 t)) (\lambda (t: T).(subst0 (s k i0) v t2 t)) (or4 +(eq T (THead k u0 t2) (THead k x t3)) (ex2 T (\lambda (t: T).(subst0 i0 v +(THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x t3) t))) (subst0 +i0 v (THead k u0 t2) (THead k x t3)) (subst0 i0 v (THead k x t3) (THead k u0 +t2))) (\lambda (x0: T).(\lambda (_: (subst0 (s k i0) v t2 x0)).(\lambda (_: +(subst0 (s k i0) v t2 x0)).(or4_intro1 (eq T (THead k u0 t2) (THead k x t3)) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t3) t))) (subst0 i0 v (THead k u0 t2) (THead k x +t3)) (subst0 i0 v (THead k x t3) (THead k u0 t2)) (ex_intro2 T (\lambda (t: +T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x +t3) t)) (THead k x t2) (subst0_fst v x u0 i0 H5 t2 k) (subst0_snd k v t2 t3 +i0 H0 x)))))) H6)) (\lambda (_: (subst0 (s k i0) v t2 t2)).(or4_intro1 (eq T +(THead k u0 t2) (THead k x t3)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x t3) t))) (subst0 i0 v +(THead k u0 t2) (THead k x t3)) (subst0 i0 v (THead k x t3) (THead k u0 t2)) +(ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t3) t)) (THead k x t2) (subst0_fst v x u0 i0 H5 t2 +k) (subst0_snd k v t2 t3 i0 H0 x)))) (\lambda (_: (subst0 (s k i0) v t2 +t2)).(or4_intro1 (eq T (THead k u0 t2) (THead k x t3)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x +t3) t))) (subst0 i0 v (THead k u0 t2) (THead k x t3)) (subst0 i0 v (THead k x +t3) (THead k u0 t2)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u0 +t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x t3) t)) (THead k x t2) +(subst0_fst v x u0 i0 H5 t2 k) (subst0_snd k v t2 t3 i0 H0 x)))) (H1 t2 H0)) +t4 H4)))) H3)) (\lambda (H3: (ex2 T (\lambda (t5: T).(eq T t4 (THead k u0 +t5))) (\lambda (t5: T).(subst0 (s k i0) v t3 t5)))).(ex2_ind T (\lambda (t5: +T).(eq T t4 (THead k u0 t5))) (\lambda (t5: T).(subst0 (s k i0) v t3 t5)) +(or4 (eq T (THead k u0 t2) t4) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u0 t2) t)) (\lambda (t: T).(subst0 i0 v t4 t))) (subst0 i0 v (THead k u0 t2) +t4) (subst0 i0 v t4 (THead k u0 t2))) (\lambda (x: T).(\lambda (H4: (eq T t4 +(THead k u0 x))).(\lambda (H5: (subst0 (s k i0) v t3 x)).(eq_ind_r T (THead k +u0 x) (\lambda (t: T).(or4 (eq T (THead k u0 t2) t) (ex2 T (\lambda (t5: +T).(subst0 i0 v (THead k u0 t2) t5)) (\lambda (t5: T).(subst0 i0 v t t5))) +(subst0 i0 v (THead k u0 t2) t) (subst0 i0 v t (THead k u0 t2)))) (or4_ind +(eq T t2 x) (ex2 T (\lambda (t: T).(subst0 (s k i0) v t2 t)) (\lambda (t: +T).(subst0 (s k i0) v x t))) (subst0 (s k i0) v t2 x) (subst0 (s k i0) v x +t2) (or4 (eq T (THead k u0 t2) (THead k u0 x)) (ex2 T (\lambda (t: T).(subst0 +i0 v (THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k u0 x) t))) +(subst0 i0 v (THead k u0 t2) (THead k u0 x)) (subst0 i0 v (THead k u0 x) +(THead k u0 t2))) (\lambda (H6: (eq T t2 x)).(eq_ind_r T x (\lambda (t: +T).(or4 (eq T (THead k u0 t) (THead k u0 x)) (ex2 T (\lambda (t5: T).(subst0 +i0 v (THead k u0 t) t5)) (\lambda (t5: T).(subst0 i0 v (THead k u0 x) t5))) +(subst0 i0 v (THead k u0 t) (THead k u0 x)) (subst0 i0 v (THead k u0 x) +(THead k u0 t)))) (or4_intro0 (eq T (THead k u0 x) (THead k u0 x)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u0 x) t)) (\lambda (t: T).(subst0 i0 v +(THead k u0 x) t))) (subst0 i0 v (THead k u0 x) (THead k u0 x)) (subst0 i0 v +(THead k u0 x) (THead k u0 x)) (refl_equal T (THead k u0 x))) t2 H6)) +(\lambda (H6: (ex2 T (\lambda (t: T).(subst0 (s k i0) v t2 t)) (\lambda (t: +T).(subst0 (s k i0) v x t)))).(ex2_ind T (\lambda (t: T).(subst0 (s k i0) v +t2 t)) (\lambda (t: T).(subst0 (s k i0) v x t)) (or4 (eq T (THead k u0 t2) +(THead k u0 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u0 t2) t)) +(\lambda (t: T).(subst0 i0 v (THead k u0 x) t))) (subst0 i0 v (THead k u0 t2) +(THead k u0 x)) (subst0 i0 v (THead k u0 x) (THead k u0 t2))) (\lambda (x0: +T).(\lambda (H7: (subst0 (s k i0) v t2 x0)).(\lambda (H8: (subst0 (s k i0) v +x x0)).(or4_intro1 (eq T (THead k u0 t2) (THead k u0 x)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k u0 +x) t))) (subst0 i0 v (THead k u0 t2) (THead k u0 x)) (subst0 i0 v (THead k u0 +x) (THead k u0 t2)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u0 t2) +t)) (\lambda (t: T).(subst0 i0 v (THead k u0 x) t)) (THead k u0 x0) +(subst0_snd k v x0 t2 i0 H7 u0) (subst0_snd k v x0 x i0 H8 u0)))))) H6)) +(\lambda (H6: (subst0 (s k i0) v t2 x)).(or4_intro2 (eq T (THead k u0 t2) +(THead k u0 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u0 t2) t)) +(\lambda (t: T).(subst0 i0 v (THead k u0 x) t))) (subst0 i0 v (THead k u0 t2) +(THead k u0 x)) (subst0 i0 v (THead k u0 x) (THead k u0 t2)) (subst0_snd k v +x t2 i0 H6 u0))) (\lambda (H6: (subst0 (s k i0) v x t2)).(or4_intro3 (eq T +(THead k u0 t2) (THead k u0 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k u0 x) t))) (subst0 i0 v +(THead k u0 t2) (THead k u0 x)) (subst0 i0 v (THead k u0 x) (THead k u0 t2)) +(subst0_snd k v t2 x i0 H6 u0))) (H1 x H5)) t4 H4)))) H3)) (\lambda (H3: +(ex3_2 T T (\lambda (u2: T).(\lambda (t5: T).(eq T t4 (THead k u2 t5)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i0 v u0 u2))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s k i0) v t3 t5))))).(ex3_2_ind T T (\lambda +(u2: T).(\lambda (t5: T).(eq T t4 (THead k u2 t5)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i0 v u0 u2))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s k i0) v t3 t5))) (or4 (eq T (THead k u0 t2) t4) (ex2 T (\lambda +(t: T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v t4 t))) +(subst0 i0 v (THead k u0 t2) t4) (subst0 i0 v t4 (THead k u0 t2))) (\lambda +(x0: T).(\lambda (x1: T).(\lambda (H4: (eq T t4 (THead k x0 x1))).(\lambda +(H5: (subst0 i0 v u0 x0)).(\lambda (H6: (subst0 (s k i0) v t3 x1)).(eq_ind_r +T (THead k x0 x1) (\lambda (t: T).(or4 (eq T (THead k u0 t2) t) (ex2 T +(\lambda (t5: T).(subst0 i0 v (THead k u0 t2) t5)) (\lambda (t5: T).(subst0 +i0 v t t5))) (subst0 i0 v (THead k u0 t2) t) (subst0 i0 v t (THead k u0 +t2)))) (or4_ind (eq T t2 x1) (ex2 T (\lambda (t: T).(subst0 (s k i0) v t2 t)) +(\lambda (t: T).(subst0 (s k i0) v x1 t))) (subst0 (s k i0) v t2 x1) (subst0 +(s k i0) v x1 t2) (or4 (eq T (THead k u0 t2) (THead k x0 x1)) (ex2 T (\lambda +(t: T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k +x0 x1) t))) (subst0 i0 v (THead k u0 t2) (THead k x0 x1)) (subst0 i0 v (THead +k x0 x1) (THead k u0 t2))) (\lambda (H7: (eq T t2 x1)).(eq_ind_r T x1 +(\lambda (t: T).(or4 (eq T (THead k u0 t) (THead k x0 x1)) (ex2 T (\lambda +(t5: T).(subst0 i0 v (THead k u0 t) t5)) (\lambda (t5: T).(subst0 i0 v (THead +k x0 x1) t5))) (subst0 i0 v (THead k u0 t) (THead k x0 x1)) (subst0 i0 v +(THead k x0 x1) (THead k u0 t)))) (or4_intro2 (eq T (THead k u0 x1) (THead k +x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u0 x1) t)) (\lambda (t: +T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u0 x1) (THead k x0 +x1)) (subst0 i0 v (THead k x0 x1) (THead k u0 x1)) (subst0_fst v x0 u0 i0 H5 +x1 k)) t2 H7)) (\lambda (H7: (ex2 T (\lambda (t: T).(subst0 (s k i0) v t2 t)) +(\lambda (t: T).(subst0 (s k i0) v x1 t)))).(ex2_ind T (\lambda (t: +T).(subst0 (s k i0) v t2 t)) (\lambda (t: T).(subst0 (s k i0) v x1 t)) (or4 +(eq T (THead k u0 t2) (THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v +(THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 +i0 v (THead k u0 t2) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k +u0 t2))) (\lambda (x: T).(\lambda (H8: (subst0 (s k i0) v t2 x)).(\lambda +(H9: (subst0 (s k i0) v x1 x)).(or4_intro1 (eq T (THead k u0 t2) (THead k x0 +x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: +T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u0 t2) (THead k x0 +x1)) (subst0 i0 v (THead k x0 x1) (THead k u0 t2)) (ex_intro2 T (\lambda (t: +T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 +x1) t)) (THead k x0 x) (subst0_both v u0 x0 i0 H5 k t2 x H8) (subst0_snd k v +x x1 i0 H9 x0)))))) H7)) (\lambda (H7: (subst0 (s k i0) v t2 x1)).(or4_intro2 +(eq T (THead k u0 t2) (THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v +(THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 +i0 v (THead k u0 t2) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k +u0 t2)) (subst0_both v u0 x0 i0 H5 k t2 x1 H7))) (\lambda (H7: (subst0 (s k +i0) v x1 t2)).(or4_intro1 (eq T (THead k u0 t2) (THead k x0 x1)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v +(THead k x0 x1) t))) (subst0 i0 v (THead k u0 t2) (THead k x0 x1)) (subst0 i0 +v (THead k x0 x1) (THead k u0 t2)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v +(THead k u0 t2) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t)) (THead k +x0 t2) (subst0_fst v x0 u0 i0 H5 t2 k) (subst0_snd k v t2 x1 i0 H7 x0)))) (H1 +x1 H6)) t4 H4)))))) H3)) (subst0_gen_head k v u0 t3 t4 i0 H2)))))))))))) +(\lambda (v: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (i0: nat).(\lambda +(H0: (subst0 i0 v u1 u2)).(\lambda (H1: ((\forall (t2: T).((subst0 i0 v u1 +t2) \to (or4 (eq T u2 t2) (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda +(t: T).(subst0 i0 v t2 t))) (subst0 i0 v u2 t2) (subst0 i0 v t2 +u2)))))).(\lambda (k: K).(\lambda (t2: T).(\lambda (t3: T).(\lambda (H2: +(subst0 (s k i0) v t2 t3)).(\lambda (H3: ((\forall (t4: T).((subst0 (s k i0) +v t2 t4) \to (or4 (eq T t3 t4) (ex2 T (\lambda (t: T).(subst0 (s k i0) v t3 +t)) (\lambda (t: T).(subst0 (s k i0) v t4 t))) (subst0 (s k i0) v t3 t4) +(subst0 (s k i0) v t4 t3)))))).(\lambda (t4: T).(\lambda (H4: (subst0 i0 v +(THead k u1 t2) t4)).(or3_ind (ex2 T (\lambda (u3: T).(eq T t4 (THead k u3 +t2))) (\lambda (u3: T).(subst0 i0 v u1 u3))) (ex2 T (\lambda (t5: T).(eq T t4 +(THead k u1 t5))) (\lambda (t5: T).(subst0 (s k i0) v t2 t5))) (ex3_2 T T +(\lambda (u3: T).(\lambda (t5: T).(eq T t4 (THead k u3 t5)))) (\lambda (u3: +T).(\lambda (_: T).(subst0 i0 v u1 u3))) (\lambda (_: T).(\lambda (t5: +T).(subst0 (s k i0) v t2 t5)))) (or4 (eq T (THead k u2 t3) t4) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +t4 t))) (subst0 i0 v (THead k u2 t3) t4) (subst0 i0 v t4 (THead k u2 t3))) +(\lambda (H5: (ex2 T (\lambda (u3: T).(eq T t4 (THead k u3 t2))) (\lambda +(u3: T).(subst0 i0 v u1 u3)))).(ex2_ind T (\lambda (u3: T).(eq T t4 (THead k +u3 t2))) (\lambda (u3: T).(subst0 i0 v u1 u3)) (or4 (eq T (THead k u2 t3) t4) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v t4 t))) (subst0 i0 v (THead k u2 t3) t4) (subst0 i0 v t4 +(THead k u2 t3))) (\lambda (x: T).(\lambda (H6: (eq T t4 (THead k x +t2))).(\lambda (H7: (subst0 i0 v u1 x)).(eq_ind_r T (THead k x t2) (\lambda +(t: T).(or4 (eq T (THead k u2 t3) t) (ex2 T (\lambda (t5: T).(subst0 i0 v +(THead k u2 t3) t5)) (\lambda (t5: T).(subst0 i0 v t t5))) (subst0 i0 v +(THead k u2 t3) t) (subst0 i0 v t (THead k u2 t3)))) (or4_ind (eq T t3 t3) +(ex2 T (\lambda (t: T).(subst0 (s k i0) v t3 t)) (\lambda (t: T).(subst0 (s k +i0) v t3 t))) (subst0 (s k i0) v t3 t3) (subst0 (s k i0) v t3 t3) (or4 (eq T +(THead k u2 t3) (THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v +(THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3))) +(\lambda (_: (eq T t3 t3)).(or4_ind (eq T u2 x) (ex2 T (\lambda (t: +T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v x t))) (subst0 i0 v u2 x) +(subst0 i0 v x u2) (or4 (eq T (THead k u2 t3) (THead k x t2)) (ex2 T (\lambda +(t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k +x t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k +x t2) (THead k u2 t3))) (\lambda (H9: (eq T u2 x)).(eq_ind_r T x (\lambda (t: +T).(or4 (eq T (THead k t t3) (THead k x t2)) (ex2 T (\lambda (t5: T).(subst0 +i0 v (THead k t t3) t5)) (\lambda (t5: T).(subst0 i0 v (THead k x t2) t5))) +(subst0 i0 v (THead k t t3) (THead k x t2)) (subst0 i0 v (THead k x t2) +(THead k t t3)))) (or4_intro3 (eq T (THead k x t3) (THead k x t2)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k x t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k x t2) t))) (subst0 i0 v (THead k x t3) (THead k x t2)) (subst0 i0 v +(THead k x t2) (THead k x t3)) (subst0_snd k v t3 t2 i0 H2 x)) u2 H9)) +(\lambda (H9: (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: +T).(subst0 i0 v x t)))).(ex2_ind T (\lambda (t: T).(subst0 i0 v u2 t)) +(\lambda (t: T).(subst0 i0 v x t)) (or4 (eq T (THead k u2 t3) (THead k x t2)) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x +t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3))) (\lambda (x0: T).(\lambda +(H10: (subst0 i0 v u2 x0)).(\lambda (H11: (subst0 i0 v x x0)).(or4_intro1 (eq +T (THead k u2 t3) (THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead +k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v +(THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3)) +(ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t2) t)) (THead k x0 t3) (subst0_fst v x0 u2 i0 H10 +t3 k) (subst0_both v x x0 i0 H11 k t2 t3 H2)))))) H9)) (\lambda (H9: (subst0 +i0 v u2 x)).(or4_intro1 (eq T (THead k u2 t3) (THead k x t2)) (ex2 T (\lambda +(t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k +x t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k +x t2) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 +t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t)) (THead k x t3) +(subst0_fst v x u2 i0 H9 t3 k) (subst0_snd k v t3 t2 i0 H2 x)))) (\lambda +(H9: (subst0 i0 v x u2)).(or4_intro3 (eq T (THead k u2 t3) (THead k x t2)) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x +t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3)) (subst0_both v x u2 i0 H9 k +t2 t3 H2))) (H1 x H7))) (\lambda (H8: (ex2 T (\lambda (t: T).(subst0 (s k i0) +v t3 t)) (\lambda (t: T).(subst0 (s k i0) v t3 t)))).(ex2_ind T (\lambda (t: +T).(subst0 (s k i0) v t3 t)) (\lambda (t: T).(subst0 (s k i0) v t3 t)) (or4 +(eq T (THead k u2 t3) (THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v +(THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 +i0 v (THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 +t3))) (\lambda (x0: T).(\lambda (_: (subst0 (s k i0) v t3 x0)).(\lambda (_: +(subst0 (s k i0) v t3 x0)).(or4_ind (eq T u2 x) (ex2 T (\lambda (t: +T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v x t))) (subst0 i0 v u2 x) +(subst0 i0 v x u2) (or4 (eq T (THead k u2 t3) (THead k x t2)) (ex2 T (\lambda +(t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k +x t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k +x t2) (THead k u2 t3))) (\lambda (H11: (eq T u2 x)).(eq_ind_r T x (\lambda +(t: T).(or4 (eq T (THead k t t3) (THead k x t2)) (ex2 T (\lambda (t5: +T).(subst0 i0 v (THead k t t3) t5)) (\lambda (t5: T).(subst0 i0 v (THead k x +t2) t5))) (subst0 i0 v (THead k t t3) (THead k x t2)) (subst0 i0 v (THead k x +t2) (THead k t t3)))) (or4_intro3 (eq T (THead k x t3) (THead k x t2)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k x t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k x t2) t))) (subst0 i0 v (THead k x t3) (THead k x t2)) (subst0 i0 v +(THead k x t2) (THead k x t3)) (subst0_snd k v t3 t2 i0 H2 x)) u2 H11)) +(\lambda (H11: (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: +T).(subst0 i0 v x t)))).(ex2_ind T (\lambda (t: T).(subst0 i0 v u2 t)) +(\lambda (t: T).(subst0 i0 v x t)) (or4 (eq T (THead k u2 t3) (THead k x t2)) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x +t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3))) (\lambda (x1: T).(\lambda +(H12: (subst0 i0 v u2 x1)).(\lambda (H13: (subst0 i0 v x x1)).(or4_intro1 (eq +T (THead k u2 t3) (THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead +k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v +(THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3)) +(ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t2) t)) (THead k x1 t3) (subst0_fst v x1 u2 i0 H12 +t3 k) (subst0_both v x x1 i0 H13 k t2 t3 H2)))))) H11)) (\lambda (H11: +(subst0 i0 v u2 x)).(or4_intro1 (eq T (THead k u2 t3) (THead k x t2)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k x t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x t2)) (subst0 i0 v +(THead k x t2) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v +(THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t)) (THead k +x t3) (subst0_fst v x u2 i0 H11 t3 k) (subst0_snd k v t3 t2 i0 H2 x)))) +(\lambda (H11: (subst0 i0 v x u2)).(or4_intro3 (eq T (THead k u2 t3) (THead k +x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x +t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3)) (subst0_both v x u2 i0 H11 +k t2 t3 H2))) (H1 x H7))))) H8)) (\lambda (_: (subst0 (s k i0) v t3 +t3)).(or4_ind (eq T u2 x) (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda +(t: T).(subst0 i0 v x t))) (subst0 i0 v u2 x) (subst0 i0 v x u2) (or4 (eq T +(THead k u2 t3) (THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v +(THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3))) +(\lambda (H9: (eq T u2 x)).(eq_ind_r T x (\lambda (t: T).(or4 (eq T (THead k +t t3) (THead k x t2)) (ex2 T (\lambda (t5: T).(subst0 i0 v (THead k t t3) +t5)) (\lambda (t5: T).(subst0 i0 v (THead k x t2) t5))) (subst0 i0 v (THead k +t t3) (THead k x t2)) (subst0 i0 v (THead k x t2) (THead k t t3)))) +(or4_intro3 (eq T (THead k x t3) (THead k x t2)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k x t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x +t2) t))) (subst0 i0 v (THead k x t3) (THead k x t2)) (subst0 i0 v (THead k x +t2) (THead k x t3)) (subst0_snd k v t3 t2 i0 H2 x)) u2 H9)) (\lambda (H9: +(ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v x +t)))).(ex2_ind T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 +i0 v x t)) (or4 (eq T (THead k u2 t3) (THead k x t2)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x +t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k x +t2) (THead k u2 t3))) (\lambda (x0: T).(\lambda (H10: (subst0 i0 v u2 +x0)).(\lambda (H11: (subst0 i0 v x x0)).(or4_intro1 (eq T (THead k u2 t3) +(THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k u2 t3) +(THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3)) (ex_intro2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k x t2) t)) (THead k x0 t3) (subst0_fst v x0 u2 i0 H10 t3 k) +(subst0_both v x x0 i0 H11 k t2 t3 H2)))))) H9)) (\lambda (H9: (subst0 i0 v +u2 x)).(or4_intro1 (eq T (THead k u2 t3) (THead k x t2)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x +t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k x +t2) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 +t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t)) (THead k x t3) +(subst0_fst v x u2 i0 H9 t3 k) (subst0_snd k v t3 t2 i0 H2 x)))) (\lambda +(H9: (subst0 i0 v x u2)).(or4_intro3 (eq T (THead k u2 t3) (THead k x t2)) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x +t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3)) (subst0_both v x u2 i0 H9 k +t2 t3 H2))) (H1 x H7))) (\lambda (_: (subst0 (s k i0) v t3 t3)).(or4_ind (eq +T u2 x) (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 +v x t))) (subst0 i0 v u2 x) (subst0 i0 v x u2) (or4 (eq T (THead k u2 t3) +(THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k u2 t3) +(THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3))) (\lambda (H9: +(eq T u2 x)).(eq_ind_r T x (\lambda (t: T).(or4 (eq T (THead k t t3) (THead k +x t2)) (ex2 T (\lambda (t5: T).(subst0 i0 v (THead k t t3) t5)) (\lambda (t5: +T).(subst0 i0 v (THead k x t2) t5))) (subst0 i0 v (THead k t t3) (THead k x +t2)) (subst0 i0 v (THead k x t2) (THead k t t3)))) (or4_intro3 (eq T (THead k +x t3) (THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k x t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k x t3) +(THead k x t2)) (subst0 i0 v (THead k x t2) (THead k x t3)) (subst0_snd k v +t3 t2 i0 H2 x)) u2 H9)) (\lambda (H9: (ex2 T (\lambda (t: T).(subst0 i0 v u2 +t)) (\lambda (t: T).(subst0 i0 v x t)))).(ex2_ind T (\lambda (t: T).(subst0 +i0 v u2 t)) (\lambda (t: T).(subst0 i0 v x t)) (or4 (eq T (THead k u2 t3) +(THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k u2 t3) +(THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3))) (\lambda (x0: +T).(\lambda (H10: (subst0 i0 v u2 x0)).(\lambda (H11: (subst0 i0 v x +x0)).(or4_intro1 (eq T (THead k u2 t3) (THead k x t2)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x +t2) t))) (subst0 i0 v (THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k x +t2) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 +t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t)) (THead k x0 t3) +(subst0_fst v x0 u2 i0 H10 t3 k) (subst0_both v x x0 i0 H11 k t2 t3 H2)))))) +H9)) (\lambda (H9: (subst0 i0 v u2 x)).(or4_intro1 (eq T (THead k u2 t3) +(THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v (THead k u2 t3) +(THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3)) (ex_intro2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k x t2) t)) (THead k x t3) (subst0_fst v x u2 i0 H9 t3 k) (subst0_snd +k v t3 t2 i0 H2 x)))) (\lambda (H9: (subst0 i0 v x u2)).(or4_intro3 (eq T +(THead k u2 t3) (THead k x t2)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x t2) t))) (subst0 i0 v +(THead k u2 t3) (THead k x t2)) (subst0 i0 v (THead k x t2) (THead k u2 t3)) +(subst0_both v x u2 i0 H9 k t2 t3 H2))) (H1 x H7))) (H3 t3 H2)) t4 H6)))) +H5)) (\lambda (H5: (ex2 T (\lambda (t5: T).(eq T t4 (THead k u1 t5))) +(\lambda (t5: T).(subst0 (s k i0) v t2 t5)))).(ex2_ind T (\lambda (t5: T).(eq +T t4 (THead k u1 t5))) (\lambda (t5: T).(subst0 (s k i0) v t2 t5)) (or4 (eq T +(THead k u2 t3) t4) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v t4 t))) (subst0 i0 v (THead k u2 t3) t4) (subst0 +i0 v t4 (THead k u2 t3))) (\lambda (x: T).(\lambda (H6: (eq T t4 (THead k u1 +x))).(\lambda (H7: (subst0 (s k i0) v t2 x)).(eq_ind_r T (THead k u1 x) +(\lambda (t: T).(or4 (eq T (THead k u2 t3) t) (ex2 T (\lambda (t5: T).(subst0 +i0 v (THead k u2 t3) t5)) (\lambda (t5: T).(subst0 i0 v t t5))) (subst0 i0 v +(THead k u2 t3) t) (subst0 i0 v t (THead k u2 t3)))) (or4_ind (eq T t3 x) +(ex2 T (\lambda (t: T).(subst0 (s k i0) v t3 t)) (\lambda (t: T).(subst0 (s k +i0) v x t))) (subst0 (s k i0) v t3 x) (subst0 (s k i0) v x t3) (or4 (eq T +(THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v +(THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t3))) +(\lambda (H8: (eq T t3 x)).(eq_ind_r T x (\lambda (t: T).(or4 (eq T (THead k +u2 t) (THead k u1 x)) (ex2 T (\lambda (t5: T).(subst0 i0 v (THead k u2 t) +t5)) (\lambda (t5: T).(subst0 i0 v (THead k u1 x) t5))) (subst0 i0 v (THead k +u2 t) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t)))) (or4_ind +(eq T u2 u2) (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: +T).(subst0 i0 v u2 t))) (subst0 i0 v u2 u2) (subst0 i0 v u2 u2) (or4 (eq T +(THead k u2 x) (THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u2 x) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v +(THead k u2 x) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 x))) +(\lambda (_: (eq T u2 u2)).(or4_intro3 (eq T (THead k u2 x) (THead k u1 x)) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 x) t)) (\lambda (t: +T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v (THead k u2 x) (THead k u1 +x)) (subst0 i0 v (THead k u1 x) (THead k u2 x)) (subst0_fst v u2 u1 i0 H0 x +k))) (\lambda (H9: (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: +T).(subst0 i0 v u2 t)))).(ex2_ind T (\lambda (t: T).(subst0 i0 v u2 t)) +(\lambda (t: T).(subst0 i0 v u2 t)) (or4 (eq T (THead k u2 x) (THead k u1 x)) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 x) t)) (\lambda (t: +T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v (THead k u2 x) (THead k u1 +x)) (subst0 i0 v (THead k u1 x) (THead k u2 x))) (\lambda (x0: T).(\lambda +(_: (subst0 i0 v u2 x0)).(\lambda (_: (subst0 i0 v u2 x0)).(or4_intro3 (eq T +(THead k u2 x) (THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u2 x) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v +(THead k u2 x) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 x)) +(subst0_fst v u2 u1 i0 H0 x k))))) H9)) (\lambda (_: (subst0 i0 v u2 +u2)).(or4_intro3 (eq T (THead k u2 x) (THead k u1 x)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 x) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 +x) t))) (subst0 i0 v (THead k u2 x) (THead k u1 x)) (subst0 i0 v (THead k u1 +x) (THead k u2 x)) (subst0_fst v u2 u1 i0 H0 x k))) (\lambda (_: (subst0 i0 v +u2 u2)).(or4_intro3 (eq T (THead k u2 x) (THead k u1 x)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 x) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 +x) t))) (subst0 i0 v (THead k u2 x) (THead k u1 x)) (subst0 i0 v (THead k u1 +x) (THead k u2 x)) (subst0_fst v u2 u1 i0 H0 x k))) (H1 u2 H0)) t3 H8)) +(\lambda (H8: (ex2 T (\lambda (t: T).(subst0 (s k i0) v t3 t)) (\lambda (t: +T).(subst0 (s k i0) v x t)))).(ex2_ind T (\lambda (t: T).(subst0 (s k i0) v +t3 t)) (\lambda (t: T).(subst0 (s k i0) v x t)) (or4 (eq T (THead k u2 t3) +(THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v (THead k u2 t3) +(THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t3))) (\lambda (x0: +T).(\lambda (H9: (subst0 (s k i0) v t3 x0)).(\lambda (H10: (subst0 (s k i0) v +x x0)).(or4_ind (eq T u2 u2) (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) +(\lambda (t: T).(subst0 i0 v u2 t))) (subst0 i0 v u2 u2) (subst0 i0 v u2 u2) +(or4 (eq T (THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 +v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) +(subst0 i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 x) +(THead k u2 t3))) (\lambda (_: (eq T u2 u2)).(or4_intro1 (eq T (THead k u2 +t3) (THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v (THead k u2 t3) +(THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t3)) (ex_intro2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k u1 x) t)) (THead k u2 x0) (subst0_snd k v x0 t3 i0 H9 u2) +(subst0_both v u1 u2 i0 H0 k x x0 H10)))) (\lambda (H11: (ex2 T (\lambda (t: +T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v u2 t)))).(ex2_ind T +(\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v u2 t)) (or4 +(eq T (THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v +(THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 +i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 +t3))) (\lambda (x1: T).(\lambda (_: (subst0 i0 v u2 x1)).(\lambda (_: (subst0 +i0 v u2 x1)).(or4_intro1 (eq T (THead k u2 t3) (THead k u1 x)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k u1 x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v +(THead k u1 x) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v +(THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t)) (THead k +u2 x0) (subst0_snd k v x0 t3 i0 H9 u2) (subst0_both v u1 u2 i0 H0 k x x0 +H10)))))) H11)) (\lambda (_: (subst0 i0 v u2 u2)).(or4_intro1 (eq T (THead k +u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) +t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v (THead k u2 +t3) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t3)) (ex_intro2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k u1 x) t)) (THead k u2 x0) (subst0_snd k v x0 t3 i0 H9 u2) +(subst0_both v u1 u2 i0 H0 k x x0 H10)))) (\lambda (_: (subst0 i0 v u2 +u2)).(or4_intro1 (eq T (THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 +x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 +x) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) +t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t)) (THead k u2 x0) +(subst0_snd k v x0 t3 i0 H9 u2) (subst0_both v u1 u2 i0 H0 k x x0 H10)))) (H1 +u2 H0))))) H8)) (\lambda (H8: (subst0 (s k i0) v t3 x)).(or4_ind (eq T u2 u2) +(ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v u2 +t))) (subst0 i0 v u2 u2) (subst0 i0 v u2 u2) (or4 (eq T (THead k u2 t3) +(THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v (THead k u2 t3) +(THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t3))) (\lambda (_: +(eq T u2 u2)).(or4_intro1 (eq T (THead k u2 t3) (THead k u1 x)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k u1 x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v +(THead k u1 x) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v +(THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t)) (THead k +u2 x) (subst0_snd k v x t3 i0 H8 u2) (subst0_fst v u2 u1 i0 H0 x k)))) +(\lambda (H9: (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: +T).(subst0 i0 v u2 t)))).(ex2_ind T (\lambda (t: T).(subst0 i0 v u2 t)) +(\lambda (t: T).(subst0 i0 v u2 t)) (or4 (eq T (THead k u2 t3) (THead k u1 +x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 +x)) (subst0 i0 v (THead k u1 x) (THead k u2 t3))) (\lambda (x0: T).(\lambda +(_: (subst0 i0 v u2 x0)).(\lambda (_: (subst0 i0 v u2 x0)).(or4_intro1 (eq T +(THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v +(THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t3)) +(ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k u1 x) t)) (THead k u2 x) (subst0_snd k v x t3 i0 H8 +u2) (subst0_fst v u2 u1 i0 H0 x k)))))) H9)) (\lambda (_: (subst0 i0 v u2 +u2)).(or4_intro1 (eq T (THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 +x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 +x) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) +t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t)) (THead k u2 x) +(subst0_snd k v x t3 i0 H8 u2) (subst0_fst v u2 u1 i0 H0 x k)))) (\lambda (_: +(subst0 i0 v u2 u2)).(or4_intro1 (eq T (THead k u2 t3) (THead k u1 x)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k u1 x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v +(THead k u1 x) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v +(THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t)) (THead k +u2 x) (subst0_snd k v x t3 i0 H8 u2) (subst0_fst v u2 u1 i0 H0 x k)))) (H1 u2 +H0))) (\lambda (H8: (subst0 (s k i0) v x t3)).(or4_ind (eq T u2 u2) (ex2 T +(\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v u2 t))) +(subst0 i0 v u2 u2) (subst0 i0 v u2 u2) (or4 (eq T (THead k u2 t3) (THead k +u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 +x)) (subst0 i0 v (THead k u1 x) (THead k u2 t3))) (\lambda (_: (eq T u2 +u2)).(or4_intro3 (eq T (THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 +x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 +x) (THead k u2 t3)) (subst0_both v u1 u2 i0 H0 k x t3 H8))) (\lambda (H9: +(ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v u2 +t)))).(ex2_ind T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 +i0 v u2 t)) (or4 (eq T (THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 +x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 +x) (THead k u2 t3))) (\lambda (x0: T).(\lambda (_: (subst0 i0 v u2 +x0)).(\lambda (_: (subst0 i0 v u2 x0)).(or4_intro3 (eq T (THead k u2 t3) +(THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 i0 v (THead k u2 t3) +(THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 t3)) (subst0_both v +u1 u2 i0 H0 k x t3 H8))))) H9)) (\lambda (_: (subst0 i0 v u2 u2)).(or4_intro3 +(eq T (THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: T).(subst0 i0 v +(THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 x) t))) (subst0 +i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 x) (THead k u2 +t3)) (subst0_both v u1 u2 i0 H0 k x t3 H8))) (\lambda (_: (subst0 i0 v u2 +u2)).(or4_intro3 (eq T (THead k u2 t3) (THead k u1 x)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k u1 +x) t))) (subst0 i0 v (THead k u2 t3) (THead k u1 x)) (subst0 i0 v (THead k u1 +x) (THead k u2 t3)) (subst0_both v u1 u2 i0 H0 k x t3 H8))) (H1 u2 H0))) (H3 +x H7)) t4 H6)))) H5)) (\lambda (H5: (ex3_2 T T (\lambda (u3: T).(\lambda (t5: +T).(eq T t4 (THead k u3 t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i0 v +u1 u3))) (\lambda (_: T).(\lambda (t5: T).(subst0 (s k i0) v t2 +t5))))).(ex3_2_ind T T (\lambda (u3: T).(\lambda (t5: T).(eq T t4 (THead k u3 +t5)))) (\lambda (u3: T).(\lambda (_: T).(subst0 i0 v u1 u3))) (\lambda (_: +T).(\lambda (t5: T).(subst0 (s k i0) v t2 t5))) (or4 (eq T (THead k u2 t3) +t4) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v t4 t))) (subst0 i0 v (THead k u2 t3) t4) (subst0 i0 v t4 +(THead k u2 t3))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H6: (eq T t4 +(THead k x0 x1))).(\lambda (H7: (subst0 i0 v u1 x0)).(\lambda (H8: (subst0 (s +k i0) v t2 x1)).(eq_ind_r T (THead k x0 x1) (\lambda (t: T).(or4 (eq T (THead +k u2 t3) t) (ex2 T (\lambda (t5: T).(subst0 i0 v (THead k u2 t3) t5)) +(\lambda (t5: T).(subst0 i0 v t t5))) (subst0 i0 v (THead k u2 t3) t) (subst0 +i0 v t (THead k u2 t3)))) (or4_ind (eq T t3 x1) (ex2 T (\lambda (t: +T).(subst0 (s k i0) v t3 t)) (\lambda (t: T).(subst0 (s k i0) v x1 t))) +(subst0 (s k i0) v t3 x1) (subst0 (s k i0) v x1 t3) (or4 (eq T (THead k u2 +t3) (THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 +t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t3))) (\lambda +(H9: (eq T t3 x1)).(eq_ind_r T x1 (\lambda (t: T).(or4 (eq T (THead k u2 t) +(THead k x0 x1)) (ex2 T (\lambda (t5: T).(subst0 i0 v (THead k u2 t) t5)) +(\lambda (t5: T).(subst0 i0 v (THead k x0 x1) t5))) (subst0 i0 v (THead k u2 +t) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t)))) (or4_ind +(eq T u2 x0) (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: +T).(subst0 i0 v x0 t))) (subst0 i0 v u2 x0) (subst0 i0 v x0 u2) (or4 (eq T +(THead k u2 x1) (THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k +u2 x1) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v +(THead k u2 x1) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 +x1))) (\lambda (H10: (eq T u2 x0)).(eq_ind_r T x0 (\lambda (t: T).(or4 (eq T +(THead k t x1) (THead k x0 x1)) (ex2 T (\lambda (t5: T).(subst0 i0 v (THead k +t x1) t5)) (\lambda (t5: T).(subst0 i0 v (THead k x0 x1) t5))) (subst0 i0 v +(THead k t x1) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k t +x1)))) (or4_intro0 (eq T (THead k x0 x1) (THead k x0 x1)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k x0 x1) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 +x1) t))) (subst0 i0 v (THead k x0 x1) (THead k x0 x1)) (subst0 i0 v (THead k +x0 x1) (THead k x0 x1)) (refl_equal T (THead k x0 x1))) u2 H10)) (\lambda +(H10: (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v +x0 t)))).(ex2_ind T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: +T).(subst0 i0 v x0 t)) (or4 (eq T (THead k u2 x1) (THead k x0 x1)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 x1) t)) (\lambda (t: T).(subst0 i0 v +(THead k x0 x1) t))) (subst0 i0 v (THead k u2 x1) (THead k x0 x1)) (subst0 i0 +v (THead k x0 x1) (THead k u2 x1))) (\lambda (x: T).(\lambda (H11: (subst0 i0 +v u2 x)).(\lambda (H12: (subst0 i0 v x0 x)).(or4_intro1 (eq T (THead k u2 x1) +(THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 x1) t)) +(\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 +x1) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 x1)) (ex_intro2 +T (\lambda (t: T).(subst0 i0 v (THead k u2 x1) t)) (\lambda (t: T).(subst0 i0 +v (THead k x0 x1) t)) (THead k x x1) (subst0_fst v x u2 i0 H11 x1 k) +(subst0_fst v x x0 i0 H12 x1 k)))))) H10)) (\lambda (H10: (subst0 i0 v u2 +x0)).(or4_intro2 (eq T (THead k u2 x1) (THead k x0 x1)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 x1) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 +x1) t))) (subst0 i0 v (THead k u2 x1) (THead k x0 x1)) (subst0 i0 v (THead k +x0 x1) (THead k u2 x1)) (subst0_fst v x0 u2 i0 H10 x1 k))) (\lambda (H10: +(subst0 i0 v x0 u2)).(or4_intro3 (eq T (THead k u2 x1) (THead k x0 x1)) (ex2 +T (\lambda (t: T).(subst0 i0 v (THead k u2 x1) t)) (\lambda (t: T).(subst0 i0 +v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 x1) (THead k x0 x1)) (subst0 +i0 v (THead k x0 x1) (THead k u2 x1)) (subst0_fst v u2 x0 i0 H10 x1 k))) (H1 +x0 H7)) t3 H9)) (\lambda (H9: (ex2 T (\lambda (t: T).(subst0 (s k i0) v t3 +t)) (\lambda (t: T).(subst0 (s k i0) v x1 t)))).(ex2_ind T (\lambda (t: +T).(subst0 (s k i0) v t3 t)) (\lambda (t: T).(subst0 (s k i0) v x1 t)) (or4 +(eq T (THead k u2 t3) (THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v +(THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 +i0 v (THead k u2 t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k +u2 t3))) (\lambda (x: T).(\lambda (H10: (subst0 (s k i0) v t3 x)).(\lambda +(H11: (subst0 (s k i0) v x1 x)).(or4_ind (eq T u2 x0) (ex2 T (\lambda (t: +T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v x0 t))) (subst0 i0 v u2 +x0) (subst0 i0 v x0 u2) (or4 (eq T (THead k u2 t3) (THead k x0 x1)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k x0 x1) t))) (subst0 i0 v (THead k u2 t3) (THead k x0 x1)) (subst0 i0 +v (THead k x0 x1) (THead k u2 t3))) (\lambda (H12: (eq T u2 x0)).(eq_ind_r T +x0 (\lambda (t: T).(or4 (eq T (THead k t t3) (THead k x0 x1)) (ex2 T (\lambda +(t5: T).(subst0 i0 v (THead k t t3) t5)) (\lambda (t5: T).(subst0 i0 v (THead +k x0 x1) t5))) (subst0 i0 v (THead k t t3) (THead k x0 x1)) (subst0 i0 v +(THead k x0 x1) (THead k t t3)))) (or4_intro1 (eq T (THead k x0 t3) (THead k +x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k x0 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k x0 t3) (THead k x0 +x1)) (subst0 i0 v (THead k x0 x1) (THead k x0 t3)) (ex_intro2 T (\lambda (t: +T).(subst0 i0 v (THead k x0 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 +x1) t)) (THead k x0 x) (subst0_snd k v x t3 i0 H10 x0) (subst0_snd k v x x1 +i0 H11 x0))) u2 H12)) (\lambda (H12: (ex2 T (\lambda (t: T).(subst0 i0 v u2 +t)) (\lambda (t: T).(subst0 i0 v x0 t)))).(ex2_ind T (\lambda (t: T).(subst0 +i0 v u2 t)) (\lambda (t: T).(subst0 i0 v x0 t)) (or4 (eq T (THead k u2 t3) +(THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 +t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t3))) (\lambda +(x2: T).(\lambda (H13: (subst0 i0 v u2 x2)).(\lambda (H14: (subst0 i0 v x0 +x2)).(or4_intro1 (eq T (THead k u2 t3) (THead k x0 x1)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 +x1) t))) (subst0 i0 v (THead k u2 t3) (THead k x0 x1)) (subst0 i0 v (THead k +x0 x1) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 +t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t)) (THead k x2 x) +(subst0_both v u2 x2 i0 H13 k t3 x H10) (subst0_both v x0 x2 i0 H14 k x1 x +H11)))))) H12)) (\lambda (H12: (subst0 i0 v u2 x0)).(or4_intro1 (eq T (THead +k u2 t3) (THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) +t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k +u2 t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t3)) +(ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x0 x1) t)) (THead k x0 x) (subst0_both v u2 x0 i0 +H12 k t3 x H10) (subst0_snd k v x x1 i0 H11 x0)))) (\lambda (H12: (subst0 i0 +v x0 u2)).(or4_intro1 (eq T (THead k u2 t3) (THead k x0 x1)) (ex2 T (\lambda +(t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k +x0 x1) t))) (subst0 i0 v (THead k u2 t3) (THead k x0 x1)) (subst0 i0 v (THead +k x0 x1) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k +u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t)) (THead k u2 x) +(subst0_snd k v x t3 i0 H10 u2) (subst0_both v x0 u2 i0 H12 k x1 x H11)))) +(H1 x0 H7))))) H9)) (\lambda (H9: (subst0 (s k i0) v t3 x1)).(or4_ind (eq T +u2 x0) (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 +v x0 t))) (subst0 i0 v u2 x0) (subst0 i0 v x0 u2) (or4 (eq T (THead k u2 t3) +(THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 +t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t3))) (\lambda +(H10: (eq T u2 x0)).(eq_ind_r T x0 (\lambda (t: T).(or4 (eq T (THead k t t3) +(THead k x0 x1)) (ex2 T (\lambda (t5: T).(subst0 i0 v (THead k t t3) t5)) +(\lambda (t5: T).(subst0 i0 v (THead k x0 x1) t5))) (subst0 i0 v (THead k t +t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k t t3)))) +(or4_intro2 (eq T (THead k x0 t3) (THead k x0 x1)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k x0 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 +x1) t))) (subst0 i0 v (THead k x0 t3) (THead k x0 x1)) (subst0 i0 v (THead k +x0 x1) (THead k x0 t3)) (subst0_snd k v x1 t3 i0 H9 x0)) u2 H10)) (\lambda +(H10: (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: T).(subst0 i0 v +x0 t)))).(ex2_ind T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: +T).(subst0 i0 v x0 t)) (or4 (eq T (THead k u2 t3) (THead k x0 x1)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k x0 x1) t))) (subst0 i0 v (THead k u2 t3) (THead k x0 x1)) (subst0 i0 +v (THead k x0 x1) (THead k u2 t3))) (\lambda (x: T).(\lambda (H11: (subst0 i0 +v u2 x)).(\lambda (H12: (subst0 i0 v x0 x)).(or4_intro1 (eq T (THead k u2 t3) +(THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) +(\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 +t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t3)) (ex_intro2 +T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 +v (THead k x0 x1) t)) (THead k x x1) (subst0_both v u2 x i0 H11 k t3 x1 H9) +(subst0_fst v x x0 i0 H12 x1 k)))))) H10)) (\lambda (H10: (subst0 i0 v u2 +x0)).(or4_intro2 (eq T (THead k u2 t3) (THead k x0 x1)) (ex2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 +x1) t))) (subst0 i0 v (THead k u2 t3) (THead k x0 x1)) (subst0 i0 v (THead k +x0 x1) (THead k u2 t3)) (subst0_both v u2 x0 i0 H10 k t3 x1 H9))) (\lambda +(H10: (subst0 i0 v x0 u2)).(or4_intro1 (eq T (THead k u2 t3) (THead k x0 x1)) +(ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 t3) (THead k x0 +x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t3)) (ex_intro2 T (\lambda (t: +T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 +x1) t)) (THead k u2 x1) (subst0_snd k v x1 t3 i0 H9 u2) (subst0_fst v u2 x0 +i0 H10 x1 k)))) (H1 x0 H7))) (\lambda (H9: (subst0 (s k i0) v x1 +t3)).(or4_ind (eq T u2 x0) (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) +(\lambda (t: T).(subst0 i0 v x0 t))) (subst0 i0 v u2 x0) (subst0 i0 v x0 u2) +(or4 (eq T (THead k u2 t3) (THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 +v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) +(subst0 i0 v (THead k u2 t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) +(THead k u2 t3))) (\lambda (H10: (eq T u2 x0)).(eq_ind_r T x0 (\lambda (t: +T).(or4 (eq T (THead k t t3) (THead k x0 x1)) (ex2 T (\lambda (t5: T).(subst0 +i0 v (THead k t t3) t5)) (\lambda (t5: T).(subst0 i0 v (THead k x0 x1) t5))) +(subst0 i0 v (THead k t t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) +(THead k t t3)))) (or4_intro3 (eq T (THead k x0 t3) (THead k x0 x1)) (ex2 T +(\lambda (t: T).(subst0 i0 v (THead k x0 t3) t)) (\lambda (t: T).(subst0 i0 v +(THead k x0 x1) t))) (subst0 i0 v (THead k x0 t3) (THead k x0 x1)) (subst0 i0 +v (THead k x0 x1) (THead k x0 t3)) (subst0_snd k v t3 x1 i0 H9 x0)) u2 H10)) +(\lambda (H10: (ex2 T (\lambda (t: T).(subst0 i0 v u2 t)) (\lambda (t: +T).(subst0 i0 v x0 t)))).(ex2_ind T (\lambda (t: T).(subst0 i0 v u2 t)) +(\lambda (t: T).(subst0 i0 v x0 t)) (or4 (eq T (THead k u2 t3) (THead k x0 +x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: +T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 t3) (THead k x0 +x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t3))) (\lambda (x: T).(\lambda +(H11: (subst0 i0 v u2 x)).(\lambda (H12: (subst0 i0 v x0 x)).(or4_intro1 (eq +T (THead k u2 t3) (THead k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead +k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v +(THead k u2 t3) (THead k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 +t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda +(t: T).(subst0 i0 v (THead k x0 x1) t)) (THead k x t3) (subst0_fst v x u2 i0 +H11 t3 k) (subst0_both v x0 x i0 H12 k x1 t3 H9)))))) H10)) (\lambda (H10: +(subst0 i0 v u2 x0)).(or4_intro1 (eq T (THead k u2 t3) (THead k x0 x1)) (ex2 +T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 +v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 t3) (THead k x0 x1)) (subst0 +i0 v (THead k x0 x1) (THead k u2 t3)) (ex_intro2 T (\lambda (t: T).(subst0 i0 +v (THead k u2 t3) t)) (\lambda (t: T).(subst0 i0 v (THead k x0 x1) t)) (THead +k x0 t3) (subst0_fst v x0 u2 i0 H10 t3 k) (subst0_snd k v t3 x1 i0 H9 x0)))) +(\lambda (H10: (subst0 i0 v x0 u2)).(or4_intro3 (eq T (THead k u2 t3) (THead +k x0 x1)) (ex2 T (\lambda (t: T).(subst0 i0 v (THead k u2 t3) t)) (\lambda +(t: T).(subst0 i0 v (THead k x0 x1) t))) (subst0 i0 v (THead k u2 t3) (THead +k x0 x1)) (subst0 i0 v (THead k x0 x1) (THead k u2 t3)) (subst0_both v x0 u2 +i0 H10 k x1 t3 H9))) (H1 x0 H7))) (H3 x1 H8)) t4 H6)))))) H5)) +(subst0_gen_head k v u1 t2 t4 i0 H4))))))))))))))) i u t0 t1 H))))). + +theorem subst0_confluence_lift: + \forall (t0: T).(\forall (t1: T).(\forall (u: T).(\forall (i: nat).((subst0 +i u t0 (lift (S O) i t1)) \to (\forall (t2: T).((subst0 i u t0 (lift (S O) i +t2)) \to (eq T t1 t2))))))) +\def + \lambda (t0: T).(\lambda (t1: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (subst0 i u t0 (lift (S O) i t1))).(\lambda (t2: T).(\lambda (H0: (subst0 +i u t0 (lift (S O) i t2))).(or4_ind (eq T (lift (S O) i t2) (lift (S O) i +t1)) (ex2 T (\lambda (t: T).(subst0 i u (lift (S O) i t2) t)) (\lambda (t: +T).(subst0 i u (lift (S O) i t1) t))) (subst0 i u (lift (S O) i t2) (lift (S +O) i t1)) (subst0 i u (lift (S O) i t1) (lift (S O) i t2)) (eq T t1 t2) +(\lambda (H1: (eq T (lift (S O) i t2) (lift (S O) i t1))).(let H2 \def +(sym_eq T (lift (S O) i t2) (lift (S O) i t1) H1) in (lift_inj t1 t2 (S O) i +H2))) (\lambda (H1: (ex2 T (\lambda (t: T).(subst0 i u (lift (S O) i t2) t)) +(\lambda (t: T).(subst0 i u (lift (S O) i t1) t)))).(ex2_ind T (\lambda (t: +T).(subst0 i u (lift (S O) i t2) t)) (\lambda (t: T).(subst0 i u (lift (S O) +i t1) t)) (eq T t1 t2) (\lambda (x: T).(\lambda (_: (subst0 i u (lift (S O) i +t2) x)).(\lambda (H3: (subst0 i u (lift (S O) i t1) +x)).(subst0_gen_lift_false t1 u x (S O) i i (le_n i) (eq_ind_r nat (plus (S +O) i) (\lambda (n: nat).(lt i n)) (le_n (plus (S O) i)) (plus i (S O)) +(plus_comm i (S O))) H3 (eq T t1 t2))))) H1)) (\lambda (H1: (subst0 i u (lift +(S O) i t2) (lift (S O) i t1))).(subst0_gen_lift_false t2 u (lift (S O) i t1) +(S O) i i (le_n i) (eq_ind_r nat (plus (S O) i) (\lambda (n: nat).(lt i n)) +(le_n (plus (S O) i)) (plus i (S O)) (plus_comm i (S O))) H1 (eq T t1 t2))) +(\lambda (H1: (subst0 i u (lift (S O) i t1) (lift (S O) i +t2))).(subst0_gen_lift_false t1 u (lift (S O) i t2) (S O) i i (le_n i) +(eq_ind_r nat (plus (S O) i) (\lambda (n: nat).(lt i n)) (le_n (plus (S O) +i)) (plus i (S O)) (plus_comm i (S O))) H1 (eq T t1 t2))) +(subst0_confluence_eq t0 (lift (S O) i t2) u i H0 (lift (S O) i t1) H)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/tlt.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/tlt.ma new file mode 100644 index 000000000..fd0ba2f0c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/tlt.ma @@ -0,0 +1,460 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst0/tlt". + +include "subst0/defs.ma". + +include "lift/props.ma". + +include "lift/tlt.ma". + +theorem subst0_weight_le: + \forall (u: T).(\forall (t: T).(\forall (z: T).(\forall (d: nat).((subst0 d +u t z) \to (\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +d) O u)) (g d)) \to (le (weight_map f z) (weight_map g t)))))))))) +\def + \lambda (u: T).(\lambda (t: T).(\lambda (z: T).(\lambda (d: nat).(\lambda +(H: (subst0 d u t z)).(subst0_ind (\lambda (n: nat).(\lambda (t0: T).(\lambda +(t1: T).(\lambda (t2: T).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +n) O t0)) (g n)) \to (le (weight_map f t2) (weight_map g t1)))))))))) +(\lambda (v: T).(\lambda (i: nat).(\lambda (f: ((nat \to nat))).(\lambda (g: +((nat \to nat))).(\lambda (_: ((\forall (m: nat).(le (f m) (g m))))).(\lambda +(H1: (lt (weight_map f (lift (S i) O v)) (g i))).(le_S_n (weight_map f (lift +(S i) O v)) (weight_map g (TLRef i)) (le_S (S (weight_map f (lift (S i) O +v))) (weight_map g (TLRef i)) H1)))))))) (\lambda (v: T).(\lambda (u2: +T).(\lambda (u1: T).(\lambda (i: nat).(\lambda (_: (subst0 i v u1 +u2)).(\lambda (H1: ((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +i) O v)) (g i)) \to (le (weight_map f u2) (weight_map g u1)))))))).(\lambda +(t0: T).(\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S i) O v)) (g i)) \to (le (weight_map f (THead +k0 u2 t0)) (weight_map g (THead k0 u1 t0)))))))) (\lambda (b: B).(B_ind +(\lambda (b0: B).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +i) O v)) (g i)) \to (le (weight_map f (THead (Bind b0) u2 t0)) (weight_map g +(THead (Bind b0) u1 t0)))))))) (\lambda (f: ((nat \to nat))).(\lambda (g: +((nat \to nat))).(\lambda (H2: ((\forall (m: nat).(le (f m) (g +m))))).(\lambda (H3: (lt (weight_map f (lift (S i) O v)) (g i))).(le_n_S +(plus (weight_map f u2) (weight_map (wadd f (S (weight_map f u2))) t0)) (plus +(weight_map g u1) (weight_map (wadd g (S (weight_map g u1))) t0)) +(plus_le_compat (weight_map f u2) (weight_map g u1) (weight_map (wadd f (S +(weight_map f u2))) t0) (weight_map (wadd g (S (weight_map g u1))) t0) (H1 f +g H2 H3) (weight_le t0 (wadd f (S (weight_map f u2))) (wadd g (S (weight_map +g u1))) (\lambda (n: nat).(wadd_le f g H2 (S (weight_map f u2)) (S +(weight_map g u1)) (le_n_S (weight_map f u2) (weight_map g u1) (H1 f g H2 +H3)) n))))))))) (\lambda (f: ((nat \to nat))).(\lambda (g: ((nat \to +nat))).(\lambda (H2: ((\forall (m: nat).(le (f m) (g m))))).(\lambda (H3: (lt +(weight_map f (lift (S i) O v)) (g i))).(le_n_S (plus (weight_map f u2) +(weight_map (wadd f O) t0)) (plus (weight_map g u1) (weight_map (wadd g O) +t0)) (plus_le_compat (weight_map f u2) (weight_map g u1) (weight_map (wadd f +O) t0) (weight_map (wadd g O) t0) (H1 f g H2 H3) (weight_le t0 (wadd f O) +(wadd g O) (\lambda (n: nat).(wadd_le f g H2 O O (le_n O) n))))))))) (\lambda +(f: ((nat \to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H2: ((\forall +(m: nat).(le (f m) (g m))))).(\lambda (H3: (lt (weight_map f (lift (S i) O +v)) (g i))).(le_n_S (plus (weight_map f u2) (weight_map (wadd f O) t0)) (plus +(weight_map g u1) (weight_map (wadd g O) t0)) (plus_le_compat (weight_map f +u2) (weight_map g u1) (weight_map (wadd f O) t0) (weight_map (wadd g O) t0) +(H1 f g H2 H3) (weight_le t0 (wadd f O) (wadd g O) (\lambda (n: nat).(wadd_le +f g H2 O O (le_n O) n))))))))) b)) (\lambda (_: F).(\lambda (f0: ((nat \to +nat))).(\lambda (g: ((nat \to nat))).(\lambda (H2: ((\forall (m: nat).(le (f0 +m) (g m))))).(\lambda (H3: (lt (weight_map f0 (lift (S i) O v)) (g +i))).(le_n_S (plus (weight_map f0 u2) (weight_map f0 t0)) (plus (weight_map g +u1) (weight_map g t0)) (plus_le_compat (weight_map f0 u2) (weight_map g u1) +(weight_map f0 t0) (weight_map g t0) (H1 f0 g H2 H3) (weight_le t0 f0 g +H2)))))))) k))))))))) (\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (v: +T).(\forall (t2: T).(\forall (t1: T).(\forall (i: nat).((subst0 (s k0 i) v t1 +t2) \to (((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +(s k0 i)) O v)) (g (s k0 i))) \to (le (weight_map f t2) (weight_map g +t1))))))) \to (\forall (u0: T).(\forall (f: ((nat \to nat))).(\forall (g: +((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map +f (lift (S i) O v)) (g i)) \to (le (weight_map f (THead k0 u0 t2)) +(weight_map g (THead k0 u0 t1))))))))))))))) (\lambda (b: B).(B_ind (\lambda +(b0: B).(\forall (v: T).(\forall (t2: T).(\forall (t1: T).(\forall (i: +nat).((subst0 (s (Bind b0) i) v t1 t2) \to (((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S (s (Bind b0) i)) O v)) (g (s (Bind b0) i))) +\to (le (weight_map f t2) (weight_map g t1))))))) \to (\forall (u0: +T).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (m: +nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S i) O v)) (g i)) \to +(le (weight_map f (THead (Bind b0) u0 t2)) (weight_map g (THead (Bind b0) u0 +t1))))))))))))))) (\lambda (v: T).(\lambda (t2: T).(\lambda (t1: T).(\lambda +(i: nat).(\lambda (_: (subst0 (S i) v t1 t2)).(\lambda (H1: ((\forall (f: +((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) +(g m)))) \to ((lt (weight_map f (lift (S (S i)) O v)) (g (S i))) \to (le +(weight_map f t2) (weight_map g t1)))))))).(\lambda (u0: T).(\lambda (f: +((nat \to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H2: ((\forall (m: +nat).(le (f m) (g m))))).(\lambda (H3: (lt (weight_map f (lift (S i) O v)) (g +i))).(le_n_S (plus (weight_map f u0) (weight_map (wadd f (S (weight_map f +u0))) t2)) (plus (weight_map g u0) (weight_map (wadd g (S (weight_map g u0))) +t1)) (plus_le_compat (weight_map f u0) (weight_map g u0) (weight_map (wadd f +(S (weight_map f u0))) t2) (weight_map (wadd g (S (weight_map g u0))) t1) +(weight_le u0 f g H2) (H1 (wadd f (S (weight_map f u0))) (wadd g (S +(weight_map g u0))) (\lambda (m: nat).(wadd_le f g H2 (S (weight_map f u0)) +(S (weight_map g u0)) (le_n_S (weight_map f u0) (weight_map g u0) (weight_le +u0 f g H2)) m)) (eq_ind nat (weight_map f (lift (S i) O v)) (\lambda (n: +nat).(lt n (g i))) H3 (weight_map (wadd f (S (weight_map f u0))) (lift (S (S +i)) O v)) (lift_weight_add_O (S (weight_map f u0)) v (S i) f)))))))))))))))) +(\lambda (v: T).(\lambda (t2: T).(\lambda (t1: T).(\lambda (i: nat).(\lambda +(_: (subst0 (S i) v t1 t2)).(\lambda (H1: ((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S (S i)) O v)) (g (S i))) \to (le (weight_map f +t2) (weight_map g t1)))))))).(\lambda (u0: T).(\lambda (f: ((nat \to +nat))).(\lambda (g: ((nat \to nat))).(\lambda (H2: ((\forall (m: nat).(le (f +m) (g m))))).(\lambda (H3: (lt (weight_map f (lift (S i) O v)) (g +i))).(le_n_S (plus (weight_map f u0) (weight_map (wadd f O) t2)) (plus +(weight_map g u0) (weight_map (wadd g O) t1)) (plus_le_compat (weight_map f +u0) (weight_map g u0) (weight_map (wadd f O) t2) (weight_map (wadd g O) t1) +(weight_le u0 f g H2) (H1 (wadd f O) (wadd g O) (\lambda (m: nat).(wadd_le f +g H2 O O (le_n O) m)) (eq_ind nat (weight_map f (lift (S i) O v)) (\lambda +(n: nat).(lt n (g i))) H3 (weight_map (wadd f O) (lift (S (S i)) O v)) +(lift_weight_add_O O v (S i) f)))))))))))))))) (\lambda (v: T).(\lambda (t2: +T).(\lambda (t1: T).(\lambda (i: nat).(\lambda (_: (subst0 (S i) v t1 +t2)).(\lambda (H1: ((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +(S i)) O v)) (g (S i))) \to (le (weight_map f t2) (weight_map g +t1)))))))).(\lambda (u0: T).(\lambda (f: ((nat \to nat))).(\lambda (g: ((nat +\to nat))).(\lambda (H2: ((\forall (m: nat).(le (f m) (g m))))).(\lambda (H3: +(lt (weight_map f (lift (S i) O v)) (g i))).(le_n_S (plus (weight_map f u0) +(weight_map (wadd f O) t2)) (plus (weight_map g u0) (weight_map (wadd g O) +t1)) (plus_le_compat (weight_map f u0) (weight_map g u0) (weight_map (wadd f +O) t2) (weight_map (wadd g O) t1) (weight_le u0 f g H2) (H1 (wadd f O) (wadd +g O) (\lambda (m: nat).(wadd_le f g H2 O O (le_n O) m)) (eq_ind nat +(weight_map f (lift (S i) O v)) (\lambda (n: nat).(lt n (g i))) H3 +(weight_map (wadd f O) (lift (S (S i)) O v)) (lift_weight_add_O O v (S i) +f)))))))))))))))) b)) (\lambda (_: F).(\lambda (v: T).(\lambda (t2: +T).(\lambda (t1: T).(\lambda (i: nat).(\lambda (_: (subst0 i v t1 +t2)).(\lambda (H1: ((\forall (f0: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f0 m) (g m)))) \to ((lt (weight_map f0 (lift +(S i) O v)) (g i)) \to (le (weight_map f0 t2) (weight_map g +t1)))))))).(\lambda (u0: T).(\lambda (f0: ((nat \to nat))).(\lambda (g: ((nat +\to nat))).(\lambda (H2: ((\forall (m: nat).(le (f0 m) (g m))))).(\lambda +(H3: (lt (weight_map f0 (lift (S i) O v)) (g i))).(le_n_S (plus (weight_map +f0 u0) (weight_map f0 t2)) (plus (weight_map g u0) (weight_map g t1)) +(plus_le_compat (weight_map f0 u0) (weight_map g u0) (weight_map f0 t2) +(weight_map g t1) (weight_le u0 f0 g H2) (H1 f0 g H2 H3))))))))))))))) k)) +(\lambda (v: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (i: nat).(\lambda +(_: (subst0 i v u1 u2)).(\lambda (H1: ((\forall (f: ((nat \to nat))).(\forall +(g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt +(weight_map f (lift (S i) O v)) (g i)) \to (le (weight_map f u2) (weight_map +g u1)))))))).(\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (t1: +T).(\forall (t2: T).((subst0 (s k0 i) v t1 t2) \to (((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S (s k0 i)) O v)) (g (s k0 i))) \to (le +(weight_map f t2) (weight_map g t1))))))) \to (\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S i) O v)) (g i)) \to (le (weight_map f (THead +k0 u2 t2)) (weight_map g (THead k0 u1 t1)))))))))))) (\lambda (b: B).(B_ind +(\lambda (b0: B).(\forall (t1: T).(\forall (t2: T).((subst0 (s (Bind b0) i) v +t1 t2) \to (((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +(s (Bind b0) i)) O v)) (g (s (Bind b0) i))) \to (le (weight_map f t2) +(weight_map g t1))))))) \to (\forall (f: ((nat \to nat))).(\forall (g: ((nat +\to nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f +(lift (S i) O v)) (g i)) \to (le (weight_map f (THead (Bind b0) u2 t2)) +(weight_map g (THead (Bind b0) u1 t1)))))))))))) (\lambda (t1: T).(\lambda +(t2: T).(\lambda (_: (subst0 (S i) v t1 t2)).(\lambda (H3: ((\forall (f: +((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) +(g m)))) \to ((lt (weight_map f (lift (S (S i)) O v)) (g (S i))) \to (le +(weight_map f t2) (weight_map g t1)))))))).(\lambda (f: ((nat \to +nat))).(\lambda (g: ((nat \to nat))).(\lambda (H4: ((\forall (m: nat).(le (f +m) (g m))))).(\lambda (H5: (lt (weight_map f (lift (S i) O v)) (g +i))).(le_n_S (plus (weight_map f u2) (weight_map (wadd f (S (weight_map f +u2))) t2)) (plus (weight_map g u1) (weight_map (wadd g (S (weight_map g u1))) +t1)) (plus_le_compat (weight_map f u2) (weight_map g u1) (weight_map (wadd f +(S (weight_map f u2))) t2) (weight_map (wadd g (S (weight_map g u1))) t1) (H1 +f g H4 H5) (H3 (wadd f (S (weight_map f u2))) (wadd g (S (weight_map g u1))) +(\lambda (m: nat).(wadd_le f g H4 (S (weight_map f u2)) (S (weight_map g u1)) +(le_n_S (weight_map f u2) (weight_map g u1) (H1 f g H4 H5)) m)) (eq_ind nat +(weight_map f (lift (S i) O v)) (\lambda (n: nat).(lt n (g i))) H5 +(weight_map (wadd f (S (weight_map f u2))) (lift (S (S i)) O v)) +(lift_weight_add_O (S (weight_map f u2)) v (S i) f))))))))))))) (\lambda (t1: +T).(\lambda (t2: T).(\lambda (_: (subst0 (S i) v t1 t2)).(\lambda (H3: +((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (m: +nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S (S i)) O v)) (g (S +i))) \to (le (weight_map f t2) (weight_map g t1)))))))).(\lambda (f: ((nat +\to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H4: ((\forall (m: nat).(le +(f m) (g m))))).(\lambda (H5: (lt (weight_map f (lift (S i) O v)) (g +i))).(le_n_S (plus (weight_map f u2) (weight_map (wadd f O) t2)) (plus +(weight_map g u1) (weight_map (wadd g O) t1)) (plus_le_compat (weight_map f +u2) (weight_map g u1) (weight_map (wadd f O) t2) (weight_map (wadd g O) t1) +(H1 f g H4 H5) (H3 (wadd f O) (wadd g O) (\lambda (m: nat).(wadd_le f g H4 O +O (le_n O) m)) (eq_ind nat (weight_map f (lift (S i) O v)) (\lambda (n: +nat).(lt n (g i))) H5 (weight_map (wadd f O) (lift (S (S i)) O v)) +(lift_weight_add_O O v (S i) f))))))))))))) (\lambda (t1: T).(\lambda (t2: +T).(\lambda (_: (subst0 (S i) v t1 t2)).(\lambda (H3: ((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S (S i)) O v)) (g (S i))) \to (le (weight_map f +t2) (weight_map g t1)))))))).(\lambda (f: ((nat \to nat))).(\lambda (g: ((nat +\to nat))).(\lambda (H4: ((\forall (m: nat).(le (f m) (g m))))).(\lambda (H5: +(lt (weight_map f (lift (S i) O v)) (g i))).(le_n_S (plus (weight_map f u2) +(weight_map (wadd f O) t2)) (plus (weight_map g u1) (weight_map (wadd g O) +t1)) (plus_le_compat (weight_map f u2) (weight_map g u1) (weight_map (wadd f +O) t2) (weight_map (wadd g O) t1) (H1 f g H4 H5) (H3 (wadd f O) (wadd g O) +(\lambda (m: nat).(wadd_le f g H4 O O (le_n O) m)) (eq_ind nat (weight_map f +(lift (S i) O v)) (\lambda (n: nat).(lt n (g i))) H5 (weight_map (wadd f O) +(lift (S (S i)) O v)) (lift_weight_add_O O v (S i) f))))))))))))) b)) +(\lambda (_: F).(\lambda (t1: T).(\lambda (t2: T).(\lambda (_: (subst0 i v t1 +t2)).(\lambda (H3: ((\forall (f0: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f0 m) (g m)))) \to ((lt (weight_map f0 (lift +(S i) O v)) (g i)) \to (le (weight_map f0 t2) (weight_map g +t1)))))))).(\lambda (f0: ((nat \to nat))).(\lambda (g: ((nat \to +nat))).(\lambda (H4: ((\forall (m: nat).(le (f0 m) (g m))))).(\lambda (H5: +(lt (weight_map f0 (lift (S i) O v)) (g i))).(le_n_S (plus (weight_map f0 u2) +(weight_map f0 t2)) (plus (weight_map g u1) (weight_map g t1)) +(plus_le_compat (weight_map f0 u2) (weight_map g u1) (weight_map f0 t2) +(weight_map g t1) (H1 f0 g H4 H5) (H3 f0 g H4 H5)))))))))))) k)))))))) d u t +z H))))). + +theorem subst0_weight_lt: + \forall (u: T).(\forall (t: T).(\forall (z: T).(\forall (d: nat).((subst0 d +u t z) \to (\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +d) O u)) (g d)) \to (lt (weight_map f z) (weight_map g t)))))))))) +\def + \lambda (u: T).(\lambda (t: T).(\lambda (z: T).(\lambda (d: nat).(\lambda +(H: (subst0 d u t z)).(subst0_ind (\lambda (n: nat).(\lambda (t0: T).(\lambda +(t1: T).(\lambda (t2: T).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +n) O t0)) (g n)) \to (lt (weight_map f t2) (weight_map g t1)))))))))) +(\lambda (v: T).(\lambda (i: nat).(\lambda (f: ((nat \to nat))).(\lambda (g: +((nat \to nat))).(\lambda (_: ((\forall (m: nat).(le (f m) (g m))))).(\lambda +(H1: (lt (weight_map f (lift (S i) O v)) (g i))).H1)))))) (\lambda (v: +T).(\lambda (u2: T).(\lambda (u1: T).(\lambda (i: nat).(\lambda (_: (subst0 i +v u1 u2)).(\lambda (H1: ((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +i) O v)) (g i)) \to (lt (weight_map f u2) (weight_map g u1)))))))).(\lambda +(t0: T).(\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S i) O v)) (g i)) \to (lt (weight_map f (THead +k0 u2 t0)) (weight_map g (THead k0 u1 t0)))))))) (\lambda (b: B).(B_ind +(\lambda (b0: B).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +i) O v)) (g i)) \to (lt (weight_map f (THead (Bind b0) u2 t0)) (weight_map g +(THead (Bind b0) u1 t0)))))))) (\lambda (f: ((nat \to nat))).(\lambda (g: +((nat \to nat))).(\lambda (H2: ((\forall (m: nat).(le (f m) (g +m))))).(\lambda (H3: (lt (weight_map f (lift (S i) O v)) (g i))).(lt_n_S +(plus (weight_map f u2) (weight_map (wadd f (S (weight_map f u2))) t0)) (plus +(weight_map g u1) (weight_map (wadd g (S (weight_map g u1))) t0)) +(plus_lt_le_compat (weight_map f u2) (weight_map g u1) (weight_map (wadd f (S +(weight_map f u2))) t0) (weight_map (wadd g (S (weight_map g u1))) t0) (H1 f +g H2 H3) (weight_le t0 (wadd f (S (weight_map f u2))) (wadd g (S (weight_map +g u1))) (\lambda (n: nat).(wadd_lt f g H2 (S (weight_map f u2)) (S +(weight_map g u1)) (lt_n_S (weight_map f u2) (weight_map g u1) (H1 f g H2 +H3)) n))))))))) (\lambda (f: ((nat \to nat))).(\lambda (g: ((nat \to +nat))).(\lambda (H2: ((\forall (m: nat).(le (f m) (g m))))).(\lambda (H3: (lt +(weight_map f (lift (S i) O v)) (g i))).(lt_n_S (plus (weight_map f u2) +(weight_map (wadd f O) t0)) (plus (weight_map g u1) (weight_map (wadd g O) +t0)) (plus_lt_le_compat (weight_map f u2) (weight_map g u1) (weight_map (wadd +f O) t0) (weight_map (wadd g O) t0) (H1 f g H2 H3) (weight_le t0 (wadd f O) +(wadd g O) (\lambda (n: nat).(le_S_n (wadd f O n) (wadd g O n) (le_n_S (wadd +f O n) (wadd g O n) (wadd_le f g H2 O O (le_n O) n))))))))))) (\lambda (f: +((nat \to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H2: ((\forall (m: +nat).(le (f m) (g m))))).(\lambda (H3: (lt (weight_map f (lift (S i) O v)) (g +i))).(lt_n_S (plus (weight_map f u2) (weight_map (wadd f O) t0)) (plus +(weight_map g u1) (weight_map (wadd g O) t0)) (plus_lt_le_compat (weight_map +f u2) (weight_map g u1) (weight_map (wadd f O) t0) (weight_map (wadd g O) t0) +(H1 f g H2 H3) (weight_le t0 (wadd f O) (wadd g O) (\lambda (n: nat).(le_S_n +(wadd f O n) (wadd g O n) (le_n_S (wadd f O n) (wadd g O n) (wadd_le f g H2 O +O (le_n O) n))))))))))) b)) (\lambda (_: F).(\lambda (f0: ((nat \to +nat))).(\lambda (g: ((nat \to nat))).(\lambda (H2: ((\forall (m: nat).(le (f0 +m) (g m))))).(\lambda (H3: (lt (weight_map f0 (lift (S i) O v)) (g +i))).(lt_n_S (plus (weight_map f0 u2) (weight_map f0 t0)) (plus (weight_map g +u1) (weight_map g t0)) (plus_lt_le_compat (weight_map f0 u2) (weight_map g +u1) (weight_map f0 t0) (weight_map g t0) (H1 f0 g H2 H3) (weight_le t0 f0 g +H2)))))))) k))))))))) (\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (v: +T).(\forall (t2: T).(\forall (t1: T).(\forall (i: nat).((subst0 (s k0 i) v t1 +t2) \to (((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +(s k0 i)) O v)) (g (s k0 i))) \to (lt (weight_map f t2) (weight_map g +t1))))))) \to (\forall (u0: T).(\forall (f: ((nat \to nat))).(\forall (g: +((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map +f (lift (S i) O v)) (g i)) \to (lt (weight_map f (THead k0 u0 t2)) +(weight_map g (THead k0 u0 t1))))))))))))))) (\lambda (b: B).(B_ind (\lambda +(b0: B).(\forall (v: T).(\forall (t2: T).(\forall (t1: T).(\forall (i: +nat).((subst0 (s (Bind b0) i) v t1 t2) \to (((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S (s (Bind b0) i)) O v)) (g (s (Bind b0) i))) +\to (lt (weight_map f t2) (weight_map g t1))))))) \to (\forall (u0: +T).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (m: +nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S i) O v)) (g i)) \to +(lt (weight_map f (THead (Bind b0) u0 t2)) (weight_map g (THead (Bind b0) u0 +t1))))))))))))))) (\lambda (v: T).(\lambda (t2: T).(\lambda (t1: T).(\lambda +(i: nat).(\lambda (_: (subst0 (S i) v t1 t2)).(\lambda (H1: ((\forall (f: +((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) +(g m)))) \to ((lt (weight_map f (lift (S (S i)) O v)) (g (S i))) \to (lt +(weight_map f t2) (weight_map g t1)))))))).(\lambda (u0: T).(\lambda (f: +((nat \to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H2: ((\forall (m: +nat).(le (f m) (g m))))).(\lambda (H3: (lt (weight_map f (lift (S i) O v)) (g +i))).(lt_n_S (plus (weight_map f u0) (weight_map (wadd f (S (weight_map f +u0))) t2)) (plus (weight_map g u0) (weight_map (wadd g (S (weight_map g u0))) +t1)) (plus_le_lt_compat (weight_map f u0) (weight_map g u0) (weight_map (wadd +f (S (weight_map f u0))) t2) (weight_map (wadd g (S (weight_map g u0))) t1) +(weight_le u0 f g H2) (H1 (wadd f (S (weight_map f u0))) (wadd g (S +(weight_map g u0))) (\lambda (m: nat).(wadd_le f g H2 (S (weight_map f u0)) +(S (weight_map g u0)) (le_n_S (weight_map f u0) (weight_map g u0) (weight_le +u0 f g H2)) m)) (eq_ind nat (weight_map f (lift (S i) O v)) (\lambda (n: +nat).(lt n (g i))) H3 (weight_map (wadd f (S (weight_map f u0))) (lift (S (S +i)) O v)) (lift_weight_add_O (S (weight_map f u0)) v (S i) f)))))))))))))))) +(\lambda (v: T).(\lambda (t2: T).(\lambda (t1: T).(\lambda (i: nat).(\lambda +(_: (subst0 (S i) v t1 t2)).(\lambda (H1: ((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S (S i)) O v)) (g (S i))) \to (lt (weight_map f +t2) (weight_map g t1)))))))).(\lambda (u0: T).(\lambda (f: ((nat \to +nat))).(\lambda (g: ((nat \to nat))).(\lambda (H2: ((\forall (m: nat).(le (f +m) (g m))))).(\lambda (H3: (lt (weight_map f (lift (S i) O v)) (g +i))).(lt_n_S (plus (weight_map f u0) (weight_map (wadd f O) t2)) (plus +(weight_map g u0) (weight_map (wadd g O) t1)) (plus_le_lt_compat (weight_map +f u0) (weight_map g u0) (weight_map (wadd f O) t2) (weight_map (wadd g O) t1) +(weight_le u0 f g H2) (H1 (wadd f O) (wadd g O) (\lambda (m: nat).(wadd_le f +g H2 O O (le_n O) m)) (eq_ind nat (weight_map f (lift (S i) O v)) (\lambda +(n: nat).(lt n (g i))) H3 (weight_map (wadd f O) (lift (S (S i)) O v)) +(lift_weight_add_O O v (S i) f)))))))))))))))) (\lambda (v: T).(\lambda (t2: +T).(\lambda (t1: T).(\lambda (i: nat).(\lambda (_: (subst0 (S i) v t1 +t2)).(\lambda (H1: ((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +(S i)) O v)) (g (S i))) \to (lt (weight_map f t2) (weight_map g +t1)))))))).(\lambda (u0: T).(\lambda (f: ((nat \to nat))).(\lambda (g: ((nat +\to nat))).(\lambda (H2: ((\forall (m: nat).(le (f m) (g m))))).(\lambda (H3: +(lt (weight_map f (lift (S i) O v)) (g i))).(lt_n_S (plus (weight_map f u0) +(weight_map (wadd f O) t2)) (plus (weight_map g u0) (weight_map (wadd g O) +t1)) (plus_le_lt_compat (weight_map f u0) (weight_map g u0) (weight_map (wadd +f O) t2) (weight_map (wadd g O) t1) (weight_le u0 f g H2) (H1 (wadd f O) +(wadd g O) (\lambda (m: nat).(wadd_le f g H2 O O (le_n O) m)) (eq_ind nat +(weight_map f (lift (S i) O v)) (\lambda (n: nat).(lt n (g i))) H3 +(weight_map (wadd f O) (lift (S (S i)) O v)) (lift_weight_add_O O v (S i) +f)))))))))))))))) b)) (\lambda (_: F).(\lambda (v: T).(\lambda (t2: +T).(\lambda (t1: T).(\lambda (i: nat).(\lambda (_: (subst0 i v t1 +t2)).(\lambda (H1: ((\forall (f0: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f0 m) (g m)))) \to ((lt (weight_map f0 (lift +(S i) O v)) (g i)) \to (lt (weight_map f0 t2) (weight_map g +t1)))))))).(\lambda (u0: T).(\lambda (f0: ((nat \to nat))).(\lambda (g: ((nat +\to nat))).(\lambda (H2: ((\forall (m: nat).(le (f0 m) (g m))))).(\lambda +(H3: (lt (weight_map f0 (lift (S i) O v)) (g i))).(lt_n_S (plus (weight_map +f0 u0) (weight_map f0 t2)) (plus (weight_map g u0) (weight_map g t1)) +(plus_le_lt_compat (weight_map f0 u0) (weight_map g u0) (weight_map f0 t2) +(weight_map g t1) (weight_le u0 f0 g H2) (H1 f0 g H2 H3))))))))))))))) k)) +(\lambda (v: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (i: nat).(\lambda +(_: (subst0 i v u1 u2)).(\lambda (H1: ((\forall (f: ((nat \to nat))).(\forall +(g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt +(weight_map f (lift (S i) O v)) (g i)) \to (lt (weight_map f u2) (weight_map +g u1)))))))).(\lambda (k: K).(K_ind (\lambda (k0: K).(\forall (t1: +T).(\forall (t2: T).((subst0 (s k0 i) v t1 t2) \to (((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S (s k0 i)) O v)) (g (s k0 i))) \to (lt +(weight_map f t2) (weight_map g t1))))))) \to (\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) (g m)))) +\to ((lt (weight_map f (lift (S i) O v)) (g i)) \to (lt (weight_map f (THead +k0 u2 t2)) (weight_map g (THead k0 u1 t1)))))))))))) (\lambda (b: B).(B_ind +(\lambda (b0: B).(\forall (t1: T).(\forall (t2: T).((subst0 (s (Bind b0) i) v +t1 t2) \to (((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +(s (Bind b0) i)) O v)) (g (s (Bind b0) i))) \to (lt (weight_map f t2) +(weight_map g t1))))))) \to (\forall (f: ((nat \to nat))).(\forall (g: ((nat +\to nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f +(lift (S i) O v)) (g i)) \to (lt (weight_map f (THead (Bind b0) u2 t2)) +(weight_map g (THead (Bind b0) u1 t1)))))))))))) (\lambda (t1: T).(\lambda +(t2: T).(\lambda (H2: (subst0 (S i) v t1 t2)).(\lambda (_: ((\forall (f: +((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f m) +(g m)))) \to ((lt (weight_map f (lift (S (S i)) O v)) (g (S i))) \to (lt +(weight_map f t2) (weight_map g t1)))))))).(\lambda (f: ((nat \to +nat))).(\lambda (g: ((nat \to nat))).(\lambda (H4: ((\forall (m: nat).(le (f +m) (g m))))).(\lambda (H5: (lt (weight_map f (lift (S i) O v)) (g +i))).(lt_n_S (plus (weight_map f u2) (weight_map (wadd f (S (weight_map f +u2))) t2)) (plus (weight_map g u1) (weight_map (wadd g (S (weight_map g u1))) +t1)) (plus_lt_le_compat (weight_map f u2) (weight_map g u1) (weight_map (wadd +f (S (weight_map f u2))) t2) (weight_map (wadd g (S (weight_map g u1))) t1) +(H1 f g H4 H5) (subst0_weight_le v t1 t2 (S i) H2 (wadd f (S (weight_map f +u2))) (wadd g (S (weight_map g u1))) (\lambda (m: nat).(wadd_lt f g H4 (S +(weight_map f u2)) (S (weight_map g u1)) (lt_n_S (weight_map f u2) +(weight_map g u1) (H1 f g H4 H5)) m)) (eq_ind nat (weight_map f (lift (S i) O +v)) (\lambda (n: nat).(lt n (g i))) H5 (weight_map (wadd f (S (weight_map f +u2))) (lift (S (S i)) O v)) (lift_weight_add_O (S (weight_map f u2)) v (S i) +f))))))))))))) (\lambda (t1: T).(\lambda (t2: T).(\lambda (_: (subst0 (S i) v +t1 t2)).(\lambda (H3: ((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (m: nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S +(S i)) O v)) (g (S i))) \to (lt (weight_map f t2) (weight_map g +t1)))))))).(\lambda (f: ((nat \to nat))).(\lambda (g: ((nat \to +nat))).(\lambda (H4: ((\forall (m: nat).(le (f m) (g m))))).(\lambda (H5: (lt +(weight_map f (lift (S i) O v)) (g i))).(lt_n_S (plus (weight_map f u2) +(weight_map (wadd f O) t2)) (plus (weight_map g u1) (weight_map (wadd g O) +t1)) (plus_lt_compat (weight_map f u2) (weight_map g u1) (weight_map (wadd f +O) t2) (weight_map (wadd g O) t1) (H1 f g H4 H5) (H3 (wadd f O) (wadd g O) +(\lambda (m: nat).(le_S_n (wadd f O m) (wadd g O m) (le_n_S (wadd f O m) +(wadd g O m) (wadd_le f g H4 O O (le_n O) m)))) (eq_ind nat (weight_map f +(lift (S i) O v)) (\lambda (n: nat).(lt n (g i))) H5 (weight_map (wadd f O) +(lift (S (S i)) O v)) (lift_weight_add_O O v (S i) f))))))))))))) (\lambda +(t1: T).(\lambda (t2: T).(\lambda (_: (subst0 (S i) v t1 t2)).(\lambda (H3: +((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (m: +nat).(le (f m) (g m)))) \to ((lt (weight_map f (lift (S (S i)) O v)) (g (S +i))) \to (lt (weight_map f t2) (weight_map g t1)))))))).(\lambda (f: ((nat +\to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H4: ((\forall (m: nat).(le +(f m) (g m))))).(\lambda (H5: (lt (weight_map f (lift (S i) O v)) (g +i))).(lt_n_S (plus (weight_map f u2) (weight_map (wadd f O) t2)) (plus +(weight_map g u1) (weight_map (wadd g O) t1)) (plus_lt_compat (weight_map f +u2) (weight_map g u1) (weight_map (wadd f O) t2) (weight_map (wadd g O) t1) +(H1 f g H4 H5) (H3 (wadd f O) (wadd g O) (\lambda (m: nat).(le_S_n (wadd f O +m) (wadd g O m) (le_n_S (wadd f O m) (wadd g O m) (wadd_le f g H4 O O (le_n +O) m)))) (eq_ind nat (weight_map f (lift (S i) O v)) (\lambda (n: nat).(lt n +(g i))) H5 (weight_map (wadd f O) (lift (S (S i)) O v)) (lift_weight_add_O O +v (S i) f))))))))))))) b)) (\lambda (_: F).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (_: (subst0 i v t1 t2)).(\lambda (H3: ((\forall (f0: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (m: nat).(le (f0 m) (g m)))) +\to ((lt (weight_map f0 (lift (S i) O v)) (g i)) \to (lt (weight_map f0 t2) +(weight_map g t1)))))))).(\lambda (f0: ((nat \to nat))).(\lambda (g: ((nat +\to nat))).(\lambda (H4: ((\forall (m: nat).(le (f0 m) (g m))))).(\lambda +(H5: (lt (weight_map f0 (lift (S i) O v)) (g i))).(lt_n_S (plus (weight_map +f0 u2) (weight_map f0 t2)) (plus (weight_map g u1) (weight_map g t1)) +(plus_lt_compat (weight_map f0 u2) (weight_map g u1) (weight_map f0 t2) +(weight_map g t1) (H1 f0 g H4 H5) (H3 f0 g H4 H5)))))))))))) k)))))))) d u t +z H))))). + +theorem subst0_tlt_head: + \forall (u: T).(\forall (t: T).(\forall (z: T).((subst0 O u t z) \to (tlt +(THead (Bind Abbr) u z) (THead (Bind Abbr) u t))))) +\def + \lambda (u: T).(\lambda (t: T).(\lambda (z: T).(\lambda (H: (subst0 O u t +z)).(lt_n_S (plus (weight_map (\lambda (_: nat).O) u) (weight_map (wadd +(\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) z)) (plus +(weight_map (\lambda (_: nat).O) u) (weight_map (wadd (\lambda (_: nat).O) (S +(weight_map (\lambda (_: nat).O) u))) t)) (plus_le_lt_compat (weight_map +(\lambda (_: nat).O) u) (weight_map (\lambda (_: nat).O) u) (weight_map (wadd +(\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) z) (weight_map +(wadd (\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) t) (le_n +(weight_map (\lambda (_: nat).O) u)) (subst0_weight_lt u t z O H (wadd +(\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) (wadd (\lambda +(_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) (\lambda (m: nat).(le_n +(wadd (\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) u)) m))) +(eq_ind nat (weight_map (\lambda (_: nat).O) (lift O O u)) (\lambda (n: +nat).(lt n (S (weight_map (\lambda (_: nat).O) u)))) (eq_ind_r T u (\lambda +(t0: T).(lt (weight_map (\lambda (_: nat).O) t0) (S (weight_map (\lambda (_: +nat).O) u)))) (le_n (S (weight_map (\lambda (_: nat).O) u))) (lift O O u) +(lift_r u O)) (weight_map (wadd (\lambda (_: nat).O) (S (weight_map (\lambda +(_: nat).O) u))) (lift (S O) O u)) (lift_weight_add_O (S (weight_map (\lambda +(_: nat).O) u)) u O (\lambda (_: nat).O))))))))). + +theorem subst0_tlt: + \forall (u: T).(\forall (t: T).(\forall (z: T).((subst0 O u t z) \to (tlt z +(THead (Bind Abbr) u t))))) +\def + \lambda (u: T).(\lambda (t: T).(\lambda (z: T).(\lambda (H: (subst0 O u t +z)).(tlt_trans (THead (Bind Abbr) u z) z (THead (Bind Abbr) u t) (tlt_head_dx +(Bind Abbr) u z) (subst0_tlt_head u t z H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/defs.ma new file mode 100644 index 000000000..304adc590 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/defs.ma @@ -0,0 +1,24 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst1/defs". + +include "subst0/defs.ma". + +inductive subst1 (i: nat) (v: T) (t1: T): T \to Prop \def +| subst1_refl: subst1 i v t1 t1 +| subst1_single: \forall (t2: T).((subst0 i v t1 t2) \to (subst1 i v t1 t2)). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/fwd.ma new file mode 100644 index 000000000..317086097 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/fwd.ma @@ -0,0 +1,166 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst1/fwd". + +include "subst1/defs.ma". + +include "subst0/props.ma". + +theorem subst1_gen_sort: + \forall (v: T).(\forall (x: T).(\forall (i: nat).(\forall (n: nat).((subst1 +i v (TSort n) x) \to (eq T x (TSort n)))))) +\def + \lambda (v: T).(\lambda (x: T).(\lambda (i: nat).(\lambda (n: nat).(\lambda +(H: (subst1 i v (TSort n) x)).(subst1_ind i v (TSort n) (\lambda (t: T).(eq T +t (TSort n))) (refl_equal T (TSort n)) (\lambda (t2: T).(\lambda (H0: (subst0 +i v (TSort n) t2)).(subst0_gen_sort v t2 i n H0 (eq T t2 (TSort n))))) x +H))))). + +theorem subst1_gen_lref: + \forall (v: T).(\forall (x: T).(\forall (i: nat).(\forall (n: nat).((subst1 +i v (TLRef n) x) \to (or (eq T x (TLRef n)) (land (eq nat n i) (eq T x (lift +(S n) O v)))))))) +\def + \lambda (v: T).(\lambda (x: T).(\lambda (i: nat).(\lambda (n: nat).(\lambda +(H: (subst1 i v (TLRef n) x)).(subst1_ind i v (TLRef n) (\lambda (t: T).(or +(eq T t (TLRef n)) (land (eq nat n i) (eq T t (lift (S n) O v))))) (or_introl +(eq T (TLRef n) (TLRef n)) (land (eq nat n i) (eq T (TLRef n) (lift (S n) O +v))) (refl_equal T (TLRef n))) (\lambda (t2: T).(\lambda (H0: (subst0 i v +(TLRef n) t2)).(and_ind (eq nat n i) (eq T t2 (lift (S n) O v)) (or (eq T t2 +(TLRef n)) (land (eq nat n i) (eq T t2 (lift (S n) O v)))) (\lambda (H1: (eq +nat n i)).(\lambda (H2: (eq T t2 (lift (S n) O v))).(or_intror (eq T t2 +(TLRef n)) (land (eq nat n i) (eq T t2 (lift (S n) O v))) (conj (eq nat n i) +(eq T t2 (lift (S n) O v)) H1 H2)))) (subst0_gen_lref v t2 i n H0)))) x +H))))). + +theorem subst1_gen_head: + \forall (k: K).(\forall (v: T).(\forall (u1: T).(\forall (t1: T).(\forall +(x: T).(\forall (i: nat).((subst1 i v (THead k u1 t1) x) \to (ex3_2 T T +(\lambda (u2: T).(\lambda (t2: T).(eq T x (THead k u2 t2)))) (\lambda (u2: +T).(\lambda (_: T).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (t2: +T).(subst1 (s k i) v t1 t2)))))))))) +\def + \lambda (k: K).(\lambda (v: T).(\lambda (u1: T).(\lambda (t1: T).(\lambda +(x: T).(\lambda (i: nat).(\lambda (H: (subst1 i v (THead k u1 t1) +x)).(subst1_ind i v (THead k u1 t1) (\lambda (t: T).(ex3_2 T T (\lambda (u2: +T).(\lambda (t2: T).(eq T t (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: +T).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (t2: T).(subst1 (s k i) v t1 +t2))))) (ex3_2_intro T T (\lambda (u2: T).(\lambda (t2: T).(eq T (THead k u1 +t1) (THead k u2 t2)))) (\lambda (u2: T).(\lambda (_: T).(subst1 i v u1 u2))) +(\lambda (_: T).(\lambda (t2: T).(subst1 (s k i) v t1 t2))) u1 t1 (refl_equal +T (THead k u1 t1)) (subst1_refl i v u1) (subst1_refl (s k i) v t1)) (\lambda +(t2: T).(\lambda (H0: (subst0 i v (THead k u1 t1) t2)).(or3_ind (ex2 T +(\lambda (u2: T).(eq T t2 (THead k u2 t1))) (\lambda (u2: T).(subst0 i v u1 +u2))) (ex2 T (\lambda (t3: T).(eq T t2 (THead k u1 t3))) (\lambda (t3: +T).(subst0 (s k i) v t1 t3))) (ex3_2 T T (\lambda (u2: T).(\lambda (t3: +T).(eq T t2 (THead k u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i v +u1 u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s k i) v t1 t3)))) (ex3_2 +T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead k u2 t3)))) (\lambda +(u2: T).(\lambda (_: T).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (t3: +T).(subst1 (s k i) v t1 t3)))) (\lambda (H1: (ex2 T (\lambda (u2: T).(eq T t2 +(THead k u2 t1))) (\lambda (u2: T).(subst0 i v u1 u2)))).(ex2_ind T (\lambda +(u2: T).(eq T t2 (THead k u2 t1))) (\lambda (u2: T).(subst0 i v u1 u2)) +(ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead k u2 t3)))) +(\lambda (u2: T).(\lambda (_: T).(subst1 i v u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst1 (s k i) v t1 t3)))) (\lambda (x0: T).(\lambda +(H2: (eq T t2 (THead k x0 t1))).(\lambda (H3: (subst0 i v u1 +x0)).(ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead k u2 +t3)))) (\lambda (u2: T).(\lambda (_: T).(subst1 i v u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst1 (s k i) v t1 t3))) x0 t1 H2 (subst1_single i v u1 +x0 H3) (subst1_refl (s k i) v t1))))) H1)) (\lambda (H1: (ex2 T (\lambda (t3: +T).(eq T t2 (THead k u1 t3))) (\lambda (t3: T).(subst0 (s k i) v t1 +t3)))).(ex2_ind T (\lambda (t3: T).(eq T t2 (THead k u1 t3))) (\lambda (t3: +T).(subst0 (s k i) v t1 t3)) (ex3_2 T T (\lambda (u2: T).(\lambda (t3: T).(eq +T t2 (THead k u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst1 i v u1 u2))) +(\lambda (_: T).(\lambda (t3: T).(subst1 (s k i) v t1 t3)))) (\lambda (x0: +T).(\lambda (H2: (eq T t2 (THead k u1 x0))).(\lambda (H3: (subst0 (s k i) v +t1 x0)).(ex3_2_intro T T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead k +u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst1 i v u1 u2))) (\lambda (_: +T).(\lambda (t3: T).(subst1 (s k i) v t1 t3))) u1 x0 H2 (subst1_refl i v u1) +(subst1_single (s k i) v t1 x0 H3))))) H1)) (\lambda (H1: (ex3_2 T T (\lambda +(u2: T).(\lambda (t3: T).(eq T t2 (THead k u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i v u1 u2))) (\lambda (_: T).(\lambda (t3: +T).(subst0 (s k i) v t1 t3))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: +T).(eq T t2 (THead k u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i v +u1 u2))) (\lambda (_: T).(\lambda (t3: T).(subst0 (s k i) v t1 t3))) (ex3_2 T +T (\lambda (u2: T).(\lambda (t3: T).(eq T t2 (THead k u2 t3)))) (\lambda (u2: +T).(\lambda (_: T).(subst1 i v u1 u2))) (\lambda (_: T).(\lambda (t3: +T).(subst1 (s k i) v t1 t3)))) (\lambda (x0: T).(\lambda (x1: T).(\lambda +(H2: (eq T t2 (THead k x0 x1))).(\lambda (H3: (subst0 i v u1 x0)).(\lambda +(H4: (subst0 (s k i) v t1 x1)).(ex3_2_intro T T (\lambda (u2: T).(\lambda +(t3: T).(eq T t2 (THead k u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst1 +i v u1 u2))) (\lambda (_: T).(\lambda (t3: T).(subst1 (s k i) v t1 t3))) x0 +x1 H2 (subst1_single i v u1 x0 H3) (subst1_single (s k i) v t1 x1 H4))))))) +H1)) (subst0_gen_head k v u1 t1 t2 i H0)))) x H))))))). + +theorem subst1_gen_lift_lt: + \forall (u: T).(\forall (t1: T).(\forall (x: T).(\forall (i: nat).(\forall +(h: nat).(\forall (d: nat).((subst1 i (lift h d u) (lift h (S (plus i d)) t1) +x) \to (ex2 T (\lambda (t2: T).(eq T x (lift h (S (plus i d)) t2))) (\lambda +(t2: T).(subst1 i u t1 t2))))))))) +\def + \lambda (u: T).(\lambda (t1: T).(\lambda (x: T).(\lambda (i: nat).(\lambda +(h: nat).(\lambda (d: nat).(\lambda (H: (subst1 i (lift h d u) (lift h (S +(plus i d)) t1) x)).(subst1_ind i (lift h d u) (lift h (S (plus i d)) t1) +(\lambda (t: T).(ex2 T (\lambda (t2: T).(eq T t (lift h (S (plus i d)) t2))) +(\lambda (t2: T).(subst1 i u t1 t2)))) (ex_intro2 T (\lambda (t2: T).(eq T +(lift h (S (plus i d)) t1) (lift h (S (plus i d)) t2))) (\lambda (t2: +T).(subst1 i u t1 t2)) t1 (refl_equal T (lift h (S (plus i d)) t1)) +(subst1_refl i u t1)) (\lambda (t2: T).(\lambda (H0: (subst0 i (lift h d u) +(lift h (S (plus i d)) t1) t2)).(ex2_ind T (\lambda (t3: T).(eq T t2 (lift h +(S (plus i d)) t3))) (\lambda (t3: T).(subst0 i u t1 t3)) (ex2 T (\lambda +(t3: T).(eq T t2 (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst1 i u t1 +t3))) (\lambda (x0: T).(\lambda (H1: (eq T t2 (lift h (S (plus i d)) +x0))).(\lambda (H2: (subst0 i u t1 x0)).(ex_intro2 T (\lambda (t3: T).(eq T +t2 (lift h (S (plus i d)) t3))) (\lambda (t3: T).(subst1 i u t1 t3)) x0 H1 +(subst1_single i u t1 x0 H2))))) (subst0_gen_lift_lt u t1 t2 i h d H0)))) x +H))))))). + +theorem subst1_gen_lift_eq: + \forall (t: T).(\forall (u: T).(\forall (x: T).(\forall (h: nat).(\forall +(d: nat).(\forall (i: nat).((le d i) \to ((lt i (plus d h)) \to ((subst1 i u +(lift h d t) x) \to (eq T x (lift h d t)))))))))) +\def + \lambda (t: T).(\lambda (u: T).(\lambda (x: T).(\lambda (h: nat).(\lambda +(d: nat).(\lambda (i: nat).(\lambda (H: (le d i)).(\lambda (H0: (lt i (plus d +h))).(\lambda (H1: (subst1 i u (lift h d t) x)).(subst1_ind i u (lift h d t) +(\lambda (t0: T).(eq T t0 (lift h d t))) (refl_equal T (lift h d t)) (\lambda +(t2: T).(\lambda (H2: (subst0 i u (lift h d t) t2)).(subst0_gen_lift_false t +u t2 h d i H H0 H2 (eq T t2 (lift h d t))))) x H1))))))))). + +theorem subst1_gen_lift_ge: + \forall (u: T).(\forall (t1: T).(\forall (x: T).(\forall (i: nat).(\forall +(h: nat).(\forall (d: nat).((subst1 i u (lift h d t1) x) \to ((le (plus d h) +i) \to (ex2 T (\lambda (t2: T).(eq T x (lift h d t2))) (\lambda (t2: +T).(subst1 (minus i h) u t1 t2)))))))))) +\def + \lambda (u: T).(\lambda (t1: T).(\lambda (x: T).(\lambda (i: nat).(\lambda +(h: nat).(\lambda (d: nat).(\lambda (H: (subst1 i u (lift h d t1) +x)).(\lambda (H0: (le (plus d h) i)).(subst1_ind i u (lift h d t1) (\lambda +(t: T).(ex2 T (\lambda (t2: T).(eq T t (lift h d t2))) (\lambda (t2: +T).(subst1 (minus i h) u t1 t2)))) (ex_intro2 T (\lambda (t2: T).(eq T (lift +h d t1) (lift h d t2))) (\lambda (t2: T).(subst1 (minus i h) u t1 t2)) t1 +(refl_equal T (lift h d t1)) (subst1_refl (minus i h) u t1)) (\lambda (t2: +T).(\lambda (H1: (subst0 i u (lift h d t1) t2)).(ex2_ind T (\lambda (t3: +T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(subst0 (minus i h) u t1 t3)) +(ex2 T (\lambda (t3: T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(subst1 +(minus i h) u t1 t3))) (\lambda (x0: T).(\lambda (H2: (eq T t2 (lift h d +x0))).(\lambda (H3: (subst0 (minus i h) u t1 x0)).(ex_intro2 T (\lambda (t3: +T).(eq T t2 (lift h d t3))) (\lambda (t3: T).(subst1 (minus i h) u t1 t3)) x0 +H2 (subst1_single (minus i h) u t1 x0 H3))))) (subst0_gen_lift_ge u t1 t2 i h +d H1 H0)))) x H)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/props.ma new file mode 100644 index 000000000..a933775b7 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/props.ma @@ -0,0 +1,166 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst1/props". + +include "subst1/defs.ma". + +include "subst0/props.ma". + +theorem subst1_head: + \forall (v: T).(\forall (u1: T).(\forall (u2: T).(\forall (i: nat).((subst1 +i v u1 u2) \to (\forall (k: K).(\forall (t1: T).(\forall (t2: T).((subst1 (s +k i) v t1 t2) \to (subst1 i v (THead k u1 t1) (THead k u2 t2)))))))))) +\def + \lambda (v: T).(\lambda (u1: T).(\lambda (u2: T).(\lambda (i: nat).(\lambda +(H: (subst1 i v u1 u2)).(subst1_ind i v u1 (\lambda (t: T).(\forall (k: +K).(\forall (t1: T).(\forall (t2: T).((subst1 (s k i) v t1 t2) \to (subst1 i +v (THead k u1 t1) (THead k t t2))))))) (\lambda (k: K).(\lambda (t1: +T).(\lambda (t2: T).(\lambda (H0: (subst1 (s k i) v t1 t2)).(subst1_ind (s k +i) v t1 (\lambda (t: T).(subst1 i v (THead k u1 t1) (THead k u1 t))) +(subst1_refl i v (THead k u1 t1)) (\lambda (t3: T).(\lambda (H1: (subst0 (s k +i) v t1 t3)).(subst1_single i v (THead k u1 t1) (THead k u1 t3) (subst0_snd k +v t3 t1 i H1 u1)))) t2 H0))))) (\lambda (t2: T).(\lambda (H0: (subst0 i v u1 +t2)).(\lambda (k: K).(\lambda (t1: T).(\lambda (t0: T).(\lambda (H1: (subst1 +(s k i) v t1 t0)).(subst1_ind (s k i) v t1 (\lambda (t: T).(subst1 i v (THead +k u1 t1) (THead k t2 t))) (subst1_single i v (THead k u1 t1) (THead k t2 t1) +(subst0_fst v t2 u1 i H0 t1 k)) (\lambda (t3: T).(\lambda (H2: (subst0 (s k +i) v t1 t3)).(subst1_single i v (THead k u1 t1) (THead k t2 t3) (subst0_both +v u1 t2 i H0 k t1 t3 H2)))) t0 H1))))))) u2 H))))). + +theorem subst1_lift_lt: + \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).((subst1 +i u t1 t2) \to (\forall (d: nat).((lt i d) \to (\forall (h: nat).(subst1 i +(lift h (minus d (S i)) u) (lift h d t1) (lift h d t2))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (subst1 i u t1 t2)).(subst1_ind i u t1 (\lambda (t: T).(\forall (d: +nat).((lt i d) \to (\forall (h: nat).(subst1 i (lift h (minus d (S i)) u) +(lift h d t1) (lift h d t)))))) (\lambda (d: nat).(\lambda (_: (lt i +d)).(\lambda (h: nat).(subst1_refl i (lift h (minus d (S i)) u) (lift h d +t1))))) (\lambda (t3: T).(\lambda (H0: (subst0 i u t1 t3)).(\lambda (d: +nat).(\lambda (H1: (lt i d)).(\lambda (h: nat).(subst1_single i (lift h +(minus d (S i)) u) (lift h d t1) (lift h d t3) (subst0_lift_lt t1 t3 u i H0 d +H1 h))))))) t2 H))))). + +theorem subst1_lift_ge: + \forall (t1: T).(\forall (t2: T).(\forall (u: T).(\forall (i: nat).(\forall +(h: nat).((subst1 i u t1 t2) \to (\forall (d: nat).((le d i) \to (subst1 +(plus i h) u (lift h d t1) (lift h d t2))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(h: nat).(\lambda (H: (subst1 i u t1 t2)).(subst1_ind i u t1 (\lambda (t: +T).(\forall (d: nat).((le d i) \to (subst1 (plus i h) u (lift h d t1) (lift h +d t))))) (\lambda (d: nat).(\lambda (_: (le d i)).(subst1_refl (plus i h) u +(lift h d t1)))) (\lambda (t3: T).(\lambda (H0: (subst0 i u t1 t3)).(\lambda +(d: nat).(\lambda (H1: (le d i)).(subst1_single (plus i h) u (lift h d t1) +(lift h d t3) (subst0_lift_ge t1 t3 u i h H0 d H1)))))) t2 H)))))). + +theorem subst1_ex: + \forall (u: T).(\forall (t1: T).(\forall (d: nat).(ex T (\lambda (t2: +T).(subst1 d u t1 (lift (S O) d t2)))))) +\def + \lambda (u: T).(\lambda (t1: T).(T_ind (\lambda (t: T).(\forall (d: nat).(ex +T (\lambda (t2: T).(subst1 d u t (lift (S O) d t2)))))) (\lambda (n: +nat).(\lambda (d: nat).(ex_intro T (\lambda (t2: T).(subst1 d u (TSort n) +(lift (S O) d t2))) (TSort n) (eq_ind_r T (TSort n) (\lambda (t: T).(subst1 d +u (TSort n) t)) (subst1_refl d u (TSort n)) (lift (S O) d (TSort n)) +(lift_sort n (S O) d))))) (\lambda (n: nat).(\lambda (d: nat).(lt_eq_gt_e n d +(ex T (\lambda (t2: T).(subst1 d u (TLRef n) (lift (S O) d t2)))) (\lambda +(H: (lt n d)).(ex_intro T (\lambda (t2: T).(subst1 d u (TLRef n) (lift (S O) +d t2))) (TLRef n) (eq_ind_r T (TLRef n) (\lambda (t: T).(subst1 d u (TLRef n) +t)) (subst1_refl d u (TLRef n)) (lift (S O) d (TLRef n)) (lift_lref_lt n (S +O) d H)))) (\lambda (H: (eq nat n d)).(eq_ind nat n (\lambda (n0: nat).(ex T +(\lambda (t2: T).(subst1 n0 u (TLRef n) (lift (S O) n0 t2))))) (ex_intro T +(\lambda (t2: T).(subst1 n u (TLRef n) (lift (S O) n t2))) (lift n O u) +(eq_ind_r T (lift (plus (S O) n) O u) (\lambda (t: T).(subst1 n u (TLRef n) +t)) (subst1_single n u (TLRef n) (lift (S n) O u) (subst0_lref u n)) (lift (S +O) n (lift n O u)) (lift_free u n (S O) O n (le_n (plus O n)) (le_O_n n)))) d +H)) (\lambda (H: (lt d n)).(ex_intro T (\lambda (t2: T).(subst1 d u (TLRef n) +(lift (S O) d t2))) (TLRef (pred n)) (eq_ind_r T (TLRef n) (\lambda (t: +T).(subst1 d u (TLRef n) t)) (subst1_refl d u (TLRef n)) (lift (S O) d (TLRef +(pred n))) (lift_lref_gt d n H))))))) (\lambda (k: K).(\lambda (t: +T).(\lambda (H: ((\forall (d: nat).(ex T (\lambda (t2: T).(subst1 d u t (lift +(S O) d t2))))))).(\lambda (t0: T).(\lambda (H0: ((\forall (d: nat).(ex T +(\lambda (t2: T).(subst1 d u t0 (lift (S O) d t2))))))).(\lambda (d: +nat).(let H_x \def (H d) in (let H1 \def H_x in (ex_ind T (\lambda (t2: +T).(subst1 d u t (lift (S O) d t2))) (ex T (\lambda (t2: T).(subst1 d u +(THead k t t0) (lift (S O) d t2)))) (\lambda (x: T).(\lambda (H2: (subst1 d u +t (lift (S O) d x))).(let H_x0 \def (H0 (s k d)) in (let H3 \def H_x0 in +(ex_ind T (\lambda (t2: T).(subst1 (s k d) u t0 (lift (S O) (s k d) t2))) (ex +T (\lambda (t2: T).(subst1 d u (THead k t t0) (lift (S O) d t2)))) (\lambda +(x0: T).(\lambda (H4: (subst1 (s k d) u t0 (lift (S O) (s k d) +x0))).(ex_intro T (\lambda (t2: T).(subst1 d u (THead k t t0) (lift (S O) d +t2))) (THead k x x0) (eq_ind_r T (THead k (lift (S O) d x) (lift (S O) (s k +d) x0)) (\lambda (t2: T).(subst1 d u (THead k t t0) t2)) (subst1_head u t +(lift (S O) d x) d H2 k t0 (lift (S O) (s k d) x0) H4) (lift (S O) d (THead k +x x0)) (lift_head k x x0 (S O) d))))) H3))))) H1))))))))) t1)). + +theorem subst1_lift_S: + \forall (u: T).(\forall (i: nat).(\forall (h: nat).((le h i) \to (subst1 i +(TLRef h) (lift (S h) (S i) u) (lift (S h) i u))))) +\def + \lambda (u: T).(T_ind (\lambda (t: T).(\forall (i: nat).(\forall (h: +nat).((le h i) \to (subst1 i (TLRef h) (lift (S h) (S i) t) (lift (S h) i +t)))))) (\lambda (n: nat).(\lambda (i: nat).(\lambda (h: nat).(\lambda (_: +(le h i)).(eq_ind_r T (TSort n) (\lambda (t: T).(subst1 i (TLRef h) t (lift +(S h) i (TSort n)))) (eq_ind_r T (TSort n) (\lambda (t: T).(subst1 i (TLRef +h) (TSort n) t)) (subst1_refl i (TLRef h) (TSort n)) (lift (S h) i (TSort n)) +(lift_sort n (S h) i)) (lift (S h) (S i) (TSort n)) (lift_sort n (S h) (S +i))))))) (\lambda (n: nat).(\lambda (i: nat).(\lambda (h: nat).(\lambda (H: +(le h i)).(lt_eq_gt_e n i (subst1 i (TLRef h) (lift (S h) (S i) (TLRef n)) +(lift (S h) i (TLRef n))) (\lambda (H0: (lt n i)).(eq_ind_r T (TLRef n) +(\lambda (t: T).(subst1 i (TLRef h) t (lift (S h) i (TLRef n)))) (eq_ind_r T +(TLRef n) (\lambda (t: T).(subst1 i (TLRef h) (TLRef n) t)) (subst1_refl i +(TLRef h) (TLRef n)) (lift (S h) i (TLRef n)) (lift_lref_lt n (S h) i H0)) +(lift (S h) (S i) (TLRef n)) (lift_lref_lt n (S h) (S i) (le_S (S n) i H0)))) +(\lambda (H0: (eq nat n i)).(let H1 \def (eq_ind_r nat i (\lambda (n0: +nat).(le h n0)) H n H0) in (eq_ind nat n (\lambda (n0: nat).(subst1 n0 (TLRef +h) (lift (S h) (S n0) (TLRef n)) (lift (S h) n0 (TLRef n)))) (eq_ind_r T +(TLRef n) (\lambda (t: T).(subst1 n (TLRef h) t (lift (S h) n (TLRef n)))) +(eq_ind_r T (TLRef (plus n (S h))) (\lambda (t: T).(subst1 n (TLRef h) (TLRef +n) t)) (eq_ind nat (S (plus n h)) (\lambda (n0: nat).(subst1 n (TLRef h) +(TLRef n) (TLRef n0))) (eq_ind_r nat (plus h n) (\lambda (n0: nat).(subst1 n +(TLRef h) (TLRef n) (TLRef (S n0)))) (eq_ind nat (plus h (S n)) (\lambda (n0: +nat).(subst1 n (TLRef h) (TLRef n) (TLRef n0))) (eq_ind T (lift (S n) O +(TLRef h)) (\lambda (t: T).(subst1 n (TLRef h) (TLRef n) t)) (subst1_single n +(TLRef h) (TLRef n) (lift (S n) O (TLRef h)) (subst0_lref (TLRef h) n)) +(TLRef (plus h (S n))) (lift_lref_ge h (S n) O (le_O_n h))) (S (plus h n)) +(sym_eq nat (S (plus h n)) (plus h (S n)) (plus_n_Sm h n))) (plus n h) +(plus_comm n h)) (plus n (S h)) (plus_n_Sm n h)) (lift (S h) n (TLRef n)) +(lift_lref_ge n (S h) n (le_n n))) (lift (S h) (S n) (TLRef n)) (lift_lref_lt +n (S h) (S n) (le_n (S n)))) i H0))) (\lambda (H0: (lt i n)).(eq_ind_r T +(TLRef (plus n (S h))) (\lambda (t: T).(subst1 i (TLRef h) t (lift (S h) i +(TLRef n)))) (eq_ind_r T (TLRef (plus n (S h))) (\lambda (t: T).(subst1 i +(TLRef h) (TLRef (plus n (S h))) t)) (subst1_refl i (TLRef h) (TLRef (plus n +(S h)))) (lift (S h) i (TLRef n)) (lift_lref_ge n (S h) i (le_S_n i n (le_S +(S i) n H0)))) (lift (S h) (S i) (TLRef n)) (lift_lref_ge n (S h) (S i) +H0)))))))) (\lambda (k: K).(\lambda (t: T).(\lambda (H: ((\forall (i: +nat).(\forall (h: nat).((le h i) \to (subst1 i (TLRef h) (lift (S h) (S i) t) +(lift (S h) i t))))))).(\lambda (t0: T).(\lambda (H0: ((\forall (i: +nat).(\forall (h: nat).((le h i) \to (subst1 i (TLRef h) (lift (S h) (S i) +t0) (lift (S h) i t0))))))).(\lambda (i: nat).(\lambda (h: nat).(\lambda (H1: +(le h i)).(eq_ind_r T (THead k (lift (S h) (S i) t) (lift (S h) (s k (S i)) +t0)) (\lambda (t1: T).(subst1 i (TLRef h) t1 (lift (S h) i (THead k t t0)))) +(eq_ind_r T (THead k (lift (S h) i t) (lift (S h) (s k i) t0)) (\lambda (t1: +T).(subst1 i (TLRef h) (THead k (lift (S h) (S i) t) (lift (S h) (s k (S i)) +t0)) t1)) (subst1_head (TLRef h) (lift (S h) (S i) t) (lift (S h) i t) i (H i +h H1) k (lift (S h) (s k (S i)) t0) (lift (S h) (s k i) t0) (eq_ind_r nat (S +(s k i)) (\lambda (n: nat).(subst1 (s k i) (TLRef h) (lift (S h) n t0) (lift +(S h) (s k i) t0))) (H0 (s k i) h (le_trans h i (s k i) H1 (s_inc k i))) (s k +(S i)) (s_S k i))) (lift (S h) i (THead k t t0)) (lift_head k t t0 (S h) i)) +(lift (S h) (S i) (THead k t t0)) (lift_head k t t0 (S h) (S i))))))))))) u). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/subst1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/subst1.ma new file mode 100644 index 000000000..dc20f3ff3 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/subst1.ma @@ -0,0 +1,198 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/subst1/subst1". + +include "subst1/fwd.ma". + +include "subst0/subst0.ma". + +theorem subst1_subst1: + \forall (t1: T).(\forall (t2: T).(\forall (u2: T).(\forall (j: nat).((subst1 +j u2 t1 t2) \to (\forall (u1: T).(\forall (u: T).(\forall (i: nat).((subst1 i +u u1 u2) \to (ex2 T (\lambda (t: T).(subst1 j u1 t1 t)) (\lambda (t: +T).(subst1 (S (plus i j)) u t t2))))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u2: T).(\lambda (j: nat).(\lambda +(H: (subst1 j u2 t1 t2)).(subst1_ind j u2 t1 (\lambda (t: T).(\forall (u1: +T).(\forall (u: T).(\forall (i: nat).((subst1 i u u1 u2) \to (ex2 T (\lambda +(t0: T).(subst1 j u1 t1 t0)) (\lambda (t0: T).(subst1 (S (plus i j)) u t0 +t)))))))) (\lambda (u1: T).(\lambda (u: T).(\lambda (i: nat).(\lambda (_: +(subst1 i u u1 u2)).(ex_intro2 T (\lambda (t: T).(subst1 j u1 t1 t)) (\lambda +(t: T).(subst1 (S (plus i j)) u t t1)) t1 (subst1_refl j u1 t1) (subst1_refl +(S (plus i j)) u t1)))))) (\lambda (t3: T).(\lambda (H0: (subst0 j u2 t1 +t3)).(\lambda (u1: T).(\lambda (u: T).(\lambda (i: nat).(\lambda (H1: (subst1 +i u u1 u2)).(insert_eq T u2 (\lambda (t: T).(subst1 i u u1 t)) (ex2 T +(\lambda (t: T).(subst1 j u1 t1 t)) (\lambda (t: T).(subst1 (S (plus i j)) u +t t3))) (\lambda (y: T).(\lambda (H2: (subst1 i u u1 y)).(subst1_ind i u u1 +(\lambda (t: T).((eq T t u2) \to (ex2 T (\lambda (t0: T).(subst1 j u1 t1 t0)) +(\lambda (t0: T).(subst1 (S (plus i j)) u t0 t3))))) (\lambda (H3: (eq T u1 +u2)).(eq_ind_r T u2 (\lambda (t: T).(ex2 T (\lambda (t0: T).(subst1 j t t1 +t0)) (\lambda (t0: T).(subst1 (S (plus i j)) u t0 t3)))) (ex_intro2 T +(\lambda (t: T).(subst1 j u2 t1 t)) (\lambda (t: T).(subst1 (S (plus i j)) u +t t3)) t3 (subst1_single j u2 t1 t3 H0) (subst1_refl (S (plus i j)) u t3)) u1 +H3)) (\lambda (t0: T).(\lambda (H3: (subst0 i u u1 t0)).(\lambda (H4: (eq T +t0 u2)).(let H5 \def (eq_ind T t0 (\lambda (t: T).(subst0 i u u1 t)) H3 u2 +H4) in (ex2_ind T (\lambda (t: T).(subst0 j u1 t1 t)) (\lambda (t: T).(subst0 +(S (plus i j)) u t t3)) (ex2 T (\lambda (t: T).(subst1 j u1 t1 t)) (\lambda +(t: T).(subst1 (S (plus i j)) u t t3))) (\lambda (x: T).(\lambda (H6: (subst0 +j u1 t1 x)).(\lambda (H7: (subst0 (S (plus i j)) u x t3)).(ex_intro2 T +(\lambda (t: T).(subst1 j u1 t1 t)) (\lambda (t: T).(subst1 (S (plus i j)) u +t t3)) x (subst1_single j u1 t1 x H6) (subst1_single (S (plus i j)) u x t3 +H7))))) (subst0_subst0 t1 t3 u2 j H0 u1 u i H5)))))) y H2))) H1))))))) t2 +H))))). + +theorem subst1_subst1_back: + \forall (t1: T).(\forall (t2: T).(\forall (u2: T).(\forall (j: nat).((subst1 +j u2 t1 t2) \to (\forall (u1: T).(\forall (u: T).(\forall (i: nat).((subst1 i +u u2 u1) \to (ex2 T (\lambda (t: T).(subst1 j u1 t1 t)) (\lambda (t: +T).(subst1 (S (plus i j)) u t2 t))))))))))) +\def + \lambda (t1: T).(\lambda (t2: T).(\lambda (u2: T).(\lambda (j: nat).(\lambda +(H: (subst1 j u2 t1 t2)).(subst1_ind j u2 t1 (\lambda (t: T).(\forall (u1: +T).(\forall (u: T).(\forall (i: nat).((subst1 i u u2 u1) \to (ex2 T (\lambda +(t0: T).(subst1 j u1 t1 t0)) (\lambda (t0: T).(subst1 (S (plus i j)) u t +t0)))))))) (\lambda (u1: T).(\lambda (u: T).(\lambda (i: nat).(\lambda (_: +(subst1 i u u2 u1)).(ex_intro2 T (\lambda (t: T).(subst1 j u1 t1 t)) (\lambda +(t: T).(subst1 (S (plus i j)) u t1 t)) t1 (subst1_refl j u1 t1) (subst1_refl +(S (plus i j)) u t1)))))) (\lambda (t3: T).(\lambda (H0: (subst0 j u2 t1 +t3)).(\lambda (u1: T).(\lambda (u: T).(\lambda (i: nat).(\lambda (H1: (subst1 +i u u2 u1)).(subst1_ind i u u2 (\lambda (t: T).(ex2 T (\lambda (t0: +T).(subst1 j t t1 t0)) (\lambda (t0: T).(subst1 (S (plus i j)) u t3 t0)))) +(ex_intro2 T (\lambda (t: T).(subst1 j u2 t1 t)) (\lambda (t: T).(subst1 (S +(plus i j)) u t3 t)) t3 (subst1_single j u2 t1 t3 H0) (subst1_refl (S (plus i +j)) u t3)) (\lambda (t0: T).(\lambda (H2: (subst0 i u u2 t0)).(ex2_ind T +(\lambda (t: T).(subst0 j t0 t1 t)) (\lambda (t: T).(subst0 (S (plus i j)) u +t3 t)) (ex2 T (\lambda (t: T).(subst1 j t0 t1 t)) (\lambda (t: T).(subst1 (S +(plus i j)) u t3 t))) (\lambda (x: T).(\lambda (H3: (subst0 j t0 t1 +x)).(\lambda (H4: (subst0 (S (plus i j)) u t3 x)).(ex_intro2 T (\lambda (t: +T).(subst1 j t0 t1 t)) (\lambda (t: T).(subst1 (S (plus i j)) u t3 t)) x +(subst1_single j t0 t1 x H3) (subst1_single (S (plus i j)) u t3 x H4))))) +(subst0_subst0_back t1 t3 u2 j H0 t0 u i H2)))) u1 H1))))))) t2 H))))). + +theorem subst1_trans: + \forall (t2: T).(\forall (t1: T).(\forall (v: T).(\forall (i: nat).((subst1 +i v t1 t2) \to (\forall (t3: T).((subst1 i v t2 t3) \to (subst1 i v t1 +t3))))))) +\def + \lambda (t2: T).(\lambda (t1: T).(\lambda (v: T).(\lambda (i: nat).(\lambda +(H: (subst1 i v t1 t2)).(subst1_ind i v t1 (\lambda (t: T).(\forall (t3: +T).((subst1 i v t t3) \to (subst1 i v t1 t3)))) (\lambda (t3: T).(\lambda +(H0: (subst1 i v t1 t3)).H0)) (\lambda (t3: T).(\lambda (H0: (subst0 i v t1 +t3)).(\lambda (t4: T).(\lambda (H1: (subst1 i v t3 t4)).(subst1_ind i v t3 +(\lambda (t: T).(subst1 i v t1 t)) (subst1_single i v t1 t3 H0) (\lambda (t0: +T).(\lambda (H2: (subst0 i v t3 t0)).(subst1_single i v t1 t0 (subst0_trans +t3 t1 v i H0 t0 H2)))) t4 H1))))) t2 H))))). + +theorem subst1_confluence_neq: + \forall (t0: T).(\forall (t1: T).(\forall (u1: T).(\forall (i1: +nat).((subst1 i1 u1 t0 t1) \to (\forall (t2: T).(\forall (u2: T).(\forall +(i2: nat).((subst1 i2 u2 t0 t2) \to ((not (eq nat i1 i2)) \to (ex2 T (\lambda +(t: T).(subst1 i2 u2 t1 t)) (\lambda (t: T).(subst1 i1 u1 t2 t)))))))))))) +\def + \lambda (t0: T).(\lambda (t1: T).(\lambda (u1: T).(\lambda (i1: +nat).(\lambda (H: (subst1 i1 u1 t0 t1)).(subst1_ind i1 u1 t0 (\lambda (t: +T).(\forall (t2: T).(\forall (u2: T).(\forall (i2: nat).((subst1 i2 u2 t0 t2) +\to ((not (eq nat i1 i2)) \to (ex2 T (\lambda (t3: T).(subst1 i2 u2 t t3)) +(\lambda (t3: T).(subst1 i1 u1 t2 t3))))))))) (\lambda (t2: T).(\lambda (u2: +T).(\lambda (i2: nat).(\lambda (H0: (subst1 i2 u2 t0 t2)).(\lambda (_: (not +(eq nat i1 i2))).(ex_intro2 T (\lambda (t: T).(subst1 i2 u2 t0 t)) (\lambda +(t: T).(subst1 i1 u1 t2 t)) t2 H0 (subst1_refl i1 u1 t2))))))) (\lambda (t2: +T).(\lambda (H0: (subst0 i1 u1 t0 t2)).(\lambda (t3: T).(\lambda (u2: +T).(\lambda (i2: nat).(\lambda (H1: (subst1 i2 u2 t0 t3)).(\lambda (H2: (not +(eq nat i1 i2))).(subst1_ind i2 u2 t0 (\lambda (t: T).(ex2 T (\lambda (t4: +T).(subst1 i2 u2 t2 t4)) (\lambda (t4: T).(subst1 i1 u1 t t4)))) (ex_intro2 T +(\lambda (t: T).(subst1 i2 u2 t2 t)) (\lambda (t: T).(subst1 i1 u1 t0 t)) t2 +(subst1_refl i2 u2 t2) (subst1_single i1 u1 t0 t2 H0)) (\lambda (t4: +T).(\lambda (H3: (subst0 i2 u2 t0 t4)).(ex2_ind T (\lambda (t: T).(subst0 i1 +u1 t4 t)) (\lambda (t: T).(subst0 i2 u2 t2 t)) (ex2 T (\lambda (t: T).(subst1 +i2 u2 t2 t)) (\lambda (t: T).(subst1 i1 u1 t4 t))) (\lambda (x: T).(\lambda +(H4: (subst0 i1 u1 t4 x)).(\lambda (H5: (subst0 i2 u2 t2 x)).(ex_intro2 T +(\lambda (t: T).(subst1 i2 u2 t2 t)) (\lambda (t: T).(subst1 i1 u1 t4 t)) x +(subst1_single i2 u2 t2 x H5) (subst1_single i1 u1 t4 x H4))))) +(subst0_confluence_neq t0 t4 u2 i2 H3 t2 u1 i1 H0 (sym_not_eq nat i1 i2 +H2))))) t3 H1)))))))) t1 H))))). + +theorem subst1_confluence_eq: + \forall (t0: T).(\forall (t1: T).(\forall (u: T).(\forall (i: nat).((subst1 +i u t0 t1) \to (\forall (t2: T).((subst1 i u t0 t2) \to (ex2 T (\lambda (t: +T).(subst1 i u t1 t)) (\lambda (t: T).(subst1 i u t2 t))))))))) +\def + \lambda (t0: T).(\lambda (t1: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (subst1 i u t0 t1)).(subst1_ind i u t0 (\lambda (t: T).(\forall (t2: +T).((subst1 i u t0 t2) \to (ex2 T (\lambda (t3: T).(subst1 i u t t3)) +(\lambda (t3: T).(subst1 i u t2 t3)))))) (\lambda (t2: T).(\lambda (H0: +(subst1 i u t0 t2)).(ex_intro2 T (\lambda (t: T).(subst1 i u t0 t)) (\lambda +(t: T).(subst1 i u t2 t)) t2 H0 (subst1_refl i u t2)))) (\lambda (t2: +T).(\lambda (H0: (subst0 i u t0 t2)).(\lambda (t3: T).(\lambda (H1: (subst1 i +u t0 t3)).(subst1_ind i u t0 (\lambda (t: T).(ex2 T (\lambda (t4: T).(subst1 +i u t2 t4)) (\lambda (t4: T).(subst1 i u t t4)))) (ex_intro2 T (\lambda (t: +T).(subst1 i u t2 t)) (\lambda (t: T).(subst1 i u t0 t)) t2 (subst1_refl i u +t2) (subst1_single i u t0 t2 H0)) (\lambda (t4: T).(\lambda (H2: (subst0 i u +t0 t4)).(or4_ind (eq T t4 t2) (ex2 T (\lambda (t: T).(subst0 i u t4 t)) +(\lambda (t: T).(subst0 i u t2 t))) (subst0 i u t4 t2) (subst0 i u t2 t4) +(ex2 T (\lambda (t: T).(subst1 i u t2 t)) (\lambda (t: T).(subst1 i u t4 t))) +(\lambda (H3: (eq T t4 t2)).(eq_ind_r T t2 (\lambda (t: T).(ex2 T (\lambda +(t5: T).(subst1 i u t2 t5)) (\lambda (t5: T).(subst1 i u t t5)))) (ex_intro2 +T (\lambda (t: T).(subst1 i u t2 t)) (\lambda (t: T).(subst1 i u t2 t)) t2 +(subst1_refl i u t2) (subst1_refl i u t2)) t4 H3)) (\lambda (H3: (ex2 T +(\lambda (t: T).(subst0 i u t4 t)) (\lambda (t: T).(subst0 i u t2 +t)))).(ex2_ind T (\lambda (t: T).(subst0 i u t4 t)) (\lambda (t: T).(subst0 i +u t2 t)) (ex2 T (\lambda (t: T).(subst1 i u t2 t)) (\lambda (t: T).(subst1 i +u t4 t))) (\lambda (x: T).(\lambda (H4: (subst0 i u t4 x)).(\lambda (H5: +(subst0 i u t2 x)).(ex_intro2 T (\lambda (t: T).(subst1 i u t2 t)) (\lambda +(t: T).(subst1 i u t4 t)) x (subst1_single i u t2 x H5) (subst1_single i u t4 +x H4))))) H3)) (\lambda (H3: (subst0 i u t4 t2)).(ex_intro2 T (\lambda (t: +T).(subst1 i u t2 t)) (\lambda (t: T).(subst1 i u t4 t)) t2 (subst1_refl i u +t2) (subst1_single i u t4 t2 H3))) (\lambda (H3: (subst0 i u t2 +t4)).(ex_intro2 T (\lambda (t: T).(subst1 i u t2 t)) (\lambda (t: T).(subst1 +i u t4 t)) t4 (subst1_single i u t2 t4 H3) (subst1_refl i u t4))) +(subst0_confluence_eq t0 t4 u i H2 t2 H0)))) t3 H1))))) t1 H))))). + +theorem subst1_confluence_lift: + \forall (t0: T).(\forall (t1: T).(\forall (u: T).(\forall (i: nat).((subst1 +i u t0 (lift (S O) i t1)) \to (\forall (t2: T).((subst1 i u t0 (lift (S O) i +t2)) \to (eq T t1 t2))))))) +\def + \lambda (t0: T).(\lambda (t1: T).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H: (subst1 i u t0 (lift (S O) i t1))).(insert_eq T (lift (S O) i t1) +(\lambda (t: T).(subst1 i u t0 t)) (\forall (t2: T).((subst1 i u t0 (lift (S +O) i t2)) \to (eq T t1 t2))) (\lambda (y: T).(\lambda (H0: (subst1 i u t0 +y)).(subst1_ind i u t0 (\lambda (t: T).((eq T t (lift (S O) i t1)) \to +(\forall (t2: T).((subst1 i u t0 (lift (S O) i t2)) \to (eq T t1 t2))))) +(\lambda (H1: (eq T t0 (lift (S O) i t1))).(\lambda (t2: T).(\lambda (H2: +(subst1 i u t0 (lift (S O) i t2))).(let H3 \def (eq_ind T t0 (\lambda (t: +T).(subst1 i u t (lift (S O) i t2))) H2 (lift (S O) i t1) H1) in (let H4 \def +(sym_eq T (lift (S O) i t2) (lift (S O) i t1) (subst1_gen_lift_eq t1 u (lift +(S O) i t2) (S O) i i (le_n i) (eq_ind_r nat (plus (S O) i) (\lambda (n: +nat).(lt i n)) (le_n (plus (S O) i)) (plus i (S O)) (plus_comm i (S O))) H3)) +in (lift_inj t1 t2 (S O) i H4)))))) (\lambda (t2: T).(\lambda (H1: (subst0 i +u t0 t2)).(\lambda (H2: (eq T t2 (lift (S O) i t1))).(\lambda (t3: +T).(\lambda (H3: (subst1 i u t0 (lift (S O) i t3))).(let H4 \def (eq_ind T t2 +(\lambda (t: T).(subst0 i u t0 t)) H1 (lift (S O) i t1) H2) in (insert_eq T +(lift (S O) i t3) (\lambda (t: T).(subst1 i u t0 t)) (eq T t1 t3) (\lambda +(y0: T).(\lambda (H5: (subst1 i u t0 y0)).(subst1_ind i u t0 (\lambda (t: +T).((eq T t (lift (S O) i t3)) \to (eq T t1 t3))) (\lambda (H6: (eq T t0 +(lift (S O) i t3))).(let H7 \def (eq_ind T t0 (\lambda (t: T).(subst0 i u t +(lift (S O) i t1))) H4 (lift (S O) i t3) H6) in (subst0_gen_lift_false t3 u +(lift (S O) i t1) (S O) i i (le_n i) (eq_ind_r nat (plus (S O) i) (\lambda +(n: nat).(lt i n)) (le_n (plus (S O) i)) (plus i (S O)) (plus_comm i (S O))) +H7 (eq T t1 t3)))) (\lambda (t4: T).(\lambda (H6: (subst0 i u t0 +t4)).(\lambda (H7: (eq T t4 (lift (S O) i t3))).(let H8 \def (eq_ind T t4 +(\lambda (t: T).(subst0 i u t0 t)) H6 (lift (S O) i t3) H7) in (sym_eq T t3 +t1 (subst0_confluence_lift t0 t3 u i H8 t1 H4)))))) y0 H5))) H3))))))) y +H0))) H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/defs.ma new file mode 100644 index 000000000..0a1853ded --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/defs.ma @@ -0,0 +1,41 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/tau0/defs". + +include "G/defs.ma". + +include "getl/defs.ma". + +inductive tau0 (g: G): C \to (T \to (T \to Prop)) \def +| tau0_sort: \forall (c: C).(\forall (n: nat).(tau0 g c (TSort n) (TSort +(next g n)))) +| tau0_abbr: \forall (c: C).(\forall (d: C).(\forall (v: T).(\forall (i: +nat).((getl i c (CHead d (Bind Abbr) v)) \to (\forall (w: T).((tau0 g d v w) +\to (tau0 g c (TLRef i) (lift (S i) O w)))))))) +| tau0_abst: \forall (c: C).(\forall (d: C).(\forall (v: T).(\forall (i: +nat).((getl i c (CHead d (Bind Abst) v)) \to (\forall (w: T).((tau0 g d v w) +\to (tau0 g c (TLRef i) (lift (S i) O v)))))))) +| tau0_bind: \forall (b: B).(\forall (c: C).(\forall (v: T).(\forall (t1: +T).(\forall (t2: T).((tau0 g (CHead c (Bind b) v) t1 t2) \to (tau0 g c (THead +(Bind b) v t1) (THead (Bind b) v t2))))))) +| tau0_appl: \forall (c: C).(\forall (v: T).(\forall (t1: T).(\forall (t2: +T).((tau0 g c t1 t2) \to (tau0 g c (THead (Flat Appl) v t1) (THead (Flat +Appl) v t2)))))) +| tau0_cast: \forall (c: C).(\forall (v1: T).(\forall (v2: T).((tau0 g c v1 +v2) \to (\forall (t1: T).(\forall (t2: T).((tau0 g c t1 t2) \to (tau0 g c +(THead (Flat Cast) v1 t1) (THead (Flat Cast) v2 t2)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/props.ma new file mode 100644 index 000000000..9baf6cb96 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/props.ma @@ -0,0 +1,213 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/tau0/props". + +include "tau0/defs.ma". + +include "getl/drop.ma". + +theorem tau0_lift: + \forall (g: G).(\forall (e: C).(\forall (t1: T).(\forall (t2: T).((tau0 g e +t1 t2) \to (\forall (c: C).(\forall (h: nat).(\forall (d: nat).((drop h d c +e) \to (tau0 g c (lift h d t1) (lift h d t2)))))))))) +\def + \lambda (g: G).(\lambda (e: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (tau0 g e t1 t2)).(tau0_ind g (\lambda (c: C).(\lambda (t: T).(\lambda +(t0: T).(\forall (c0: C).(\forall (h: nat).(\forall (d: nat).((drop h d c0 c) +\to (tau0 g c0 (lift h d t) (lift h d t0))))))))) (\lambda (c: C).(\lambda +(n: nat).(\lambda (c0: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (_: +(drop h d c0 c)).(eq_ind_r T (TSort n) (\lambda (t: T).(tau0 g c0 t (lift h d +(TSort (next g n))))) (eq_ind_r T (TSort (next g n)) (\lambda (t: T).(tau0 g +c0 (TSort n) t)) (tau0_sort g c0 n) (lift h d (TSort (next g n))) (lift_sort +(next g n) h d)) (lift h d (TSort n)) (lift_sort n h d)))))))) (\lambda (c: +C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: nat).(\lambda (H0: (getl i c +(CHead d (Bind Abbr) v))).(\lambda (w: T).(\lambda (H1: (tau0 g d v +w)).(\lambda (H2: ((\forall (c0: C).(\forall (h: nat).(\forall (d0: +nat).((drop h d0 c0 d) \to (tau0 g c0 (lift h d0 v) (lift h d0 +w)))))))).(\lambda (c0: C).(\lambda (h: nat).(\lambda (d0: nat).(\lambda (H3: +(drop h d0 c0 c)).(lt_le_e i d0 (tau0 g c0 (lift h d0 (TLRef i)) (lift h d0 +(lift (S i) O w))) (\lambda (H4: (lt i d0)).(let H5 \def (drop_getl_trans_le +i d0 (le_S_n i d0 (le_S (S i) d0 H4)) c0 c h H3 (CHead d (Bind Abbr) v) H0) +in (ex3_2_ind C C (\lambda (e0: C).(\lambda (_: C).(drop i O c0 e0))) +(\lambda (e0: C).(\lambda (e1: C).(drop h (minus d0 i) e0 e1))) (\lambda (_: +C).(\lambda (e1: C).(clear e1 (CHead d (Bind Abbr) v)))) (tau0 g c0 (lift h +d0 (TLRef i)) (lift h d0 (lift (S i) O w))) (\lambda (x0: C).(\lambda (x1: +C).(\lambda (H6: (drop i O c0 x0)).(\lambda (H7: (drop h (minus d0 i) x0 +x1)).(\lambda (H8: (clear x1 (CHead d (Bind Abbr) v))).(let H9 \def (eq_ind +nat (minus d0 i) (\lambda (n: nat).(drop h n x0 x1)) H7 (S (minus d0 (S i))) +(minus_x_Sy d0 i H4)) in (let H10 \def (drop_clear_S x1 x0 h (minus d0 (S i)) +H9 Abbr d v H8) in (ex2_ind C (\lambda (c1: C).(clear x0 (CHead c1 (Bind +Abbr) (lift h (minus d0 (S i)) v)))) (\lambda (c1: C).(drop h (minus d0 (S +i)) c1 d)) (tau0 g c0 (lift h d0 (TLRef i)) (lift h d0 (lift (S i) O w))) +(\lambda (x: C).(\lambda (H11: (clear x0 (CHead x (Bind Abbr) (lift h (minus +d0 (S i)) v)))).(\lambda (H12: (drop h (minus d0 (S i)) x d)).(eq_ind_r T +(TLRef i) (\lambda (t: T).(tau0 g c0 t (lift h d0 (lift (S i) O w)))) (eq_ind +nat (plus (S i) (minus d0 (S i))) (\lambda (n: nat).(tau0 g c0 (TLRef i) +(lift h n (lift (S i) O w)))) (eq_ind_r T (lift (S i) O (lift h (minus d0 (S +i)) w)) (\lambda (t: T).(tau0 g c0 (TLRef i) t)) (eq_ind nat d0 (\lambda (_: +nat).(tau0 g c0 (TLRef i) (lift (S i) O (lift h (minus d0 (S i)) w)))) +(tau0_abbr g c0 x (lift h (minus d0 (S i)) v) i (getl_intro i c0 (CHead x +(Bind Abbr) (lift h (minus d0 (S i)) v)) x0 H6 H11) (lift h (minus d0 (S i)) +w) (H2 x h (minus d0 (S i)) H12)) (plus (S i) (minus d0 (S i))) +(le_plus_minus (S i) d0 H4)) (lift h (plus (S i) (minus d0 (S i))) (lift (S +i) O w)) (lift_d w h (S i) (minus d0 (S i)) O (le_O_n (minus d0 (S i))))) d0 +(le_plus_minus_r (S i) d0 H4)) (lift h d0 (TLRef i)) (lift_lref_lt i h d0 +H4))))) H10)))))))) H5))) (\lambda (H4: (le d0 i)).(eq_ind_r T (TLRef (plus i +h)) (\lambda (t: T).(tau0 g c0 t (lift h d0 (lift (S i) O w)))) (eq_ind nat +(S i) (\lambda (_: nat).(tau0 g c0 (TLRef (plus i h)) (lift h d0 (lift (S i) +O w)))) (eq_ind_r T (lift (plus h (S i)) O w) (\lambda (t: T).(tau0 g c0 +(TLRef (plus i h)) t)) (eq_ind_r nat (plus (S i) h) (\lambda (n: nat).(tau0 g +c0 (TLRef (plus i h)) (lift n O w))) (tau0_abbr g c0 d v (plus i h) +(drop_getl_trans_ge i c0 c d0 h H3 (CHead d (Bind Abbr) v) H0 H4) w H1) (plus +h (S i)) (plus_comm h (S i))) (lift h d0 (lift (S i) O w)) (lift_free w (S i) +h O d0 (le_S d0 i H4) (le_O_n d0))) (plus i (S O)) (eq_ind_r nat (plus (S O) +i) (\lambda (n: nat).(eq nat (S i) n)) (refl_equal nat (plus (S O) i)) (plus +i (S O)) (plus_comm i (S O)))) (lift h d0 (TLRef i)) (lift_lref_ge i h d0 +H4)))))))))))))))) (\lambda (c: C).(\lambda (d: C).(\lambda (v: T).(\lambda +(i: nat).(\lambda (H0: (getl i c (CHead d (Bind Abst) v))).(\lambda (w: +T).(\lambda (H1: (tau0 g d v w)).(\lambda (H2: ((\forall (c0: C).(\forall (h: +nat).(\forall (d0: nat).((drop h d0 c0 d) \to (tau0 g c0 (lift h d0 v) (lift +h d0 w)))))))).(\lambda (c0: C).(\lambda (h: nat).(\lambda (d0: nat).(\lambda +(H3: (drop h d0 c0 c)).(lt_le_e i d0 (tau0 g c0 (lift h d0 (TLRef i)) (lift h +d0 (lift (S i) O v))) (\lambda (H4: (lt i d0)).(let H5 \def +(drop_getl_trans_le i d0 (le_S_n i d0 (le_S (S i) d0 H4)) c0 c h H3 (CHead d +(Bind Abst) v) H0) in (ex3_2_ind C C (\lambda (e0: C).(\lambda (_: C).(drop i +O c0 e0))) (\lambda (e0: C).(\lambda (e1: C).(drop h (minus d0 i) e0 e1))) +(\lambda (_: C).(\lambda (e1: C).(clear e1 (CHead d (Bind Abst) v)))) (tau0 g +c0 (lift h d0 (TLRef i)) (lift h d0 (lift (S i) O v))) (\lambda (x0: +C).(\lambda (x1: C).(\lambda (H6: (drop i O c0 x0)).(\lambda (H7: (drop h +(minus d0 i) x0 x1)).(\lambda (H8: (clear x1 (CHead d (Bind Abst) v))).(let +H9 \def (eq_ind nat (minus d0 i) (\lambda (n: nat).(drop h n x0 x1)) H7 (S +(minus d0 (S i))) (minus_x_Sy d0 i H4)) in (let H10 \def (drop_clear_S x1 x0 +h (minus d0 (S i)) H9 Abst d v H8) in (ex2_ind C (\lambda (c1: C).(clear x0 +(CHead c1 (Bind Abst) (lift h (minus d0 (S i)) v)))) (\lambda (c1: C).(drop h +(minus d0 (S i)) c1 d)) (tau0 g c0 (lift h d0 (TLRef i)) (lift h d0 (lift (S +i) O v))) (\lambda (x: C).(\lambda (H11: (clear x0 (CHead x (Bind Abst) (lift +h (minus d0 (S i)) v)))).(\lambda (H12: (drop h (minus d0 (S i)) x +d)).(eq_ind_r T (TLRef i) (\lambda (t: T).(tau0 g c0 t (lift h d0 (lift (S i) +O v)))) (eq_ind nat (plus (S i) (minus d0 (S i))) (\lambda (n: nat).(tau0 g +c0 (TLRef i) (lift h n (lift (S i) O v)))) (eq_ind_r T (lift (S i) O (lift h +(minus d0 (S i)) v)) (\lambda (t: T).(tau0 g c0 (TLRef i) t)) (eq_ind nat d0 +(\lambda (_: nat).(tau0 g c0 (TLRef i) (lift (S i) O (lift h (minus d0 (S i)) +v)))) (tau0_abst g c0 x (lift h (minus d0 (S i)) v) i (getl_intro i c0 (CHead +x (Bind Abst) (lift h (minus d0 (S i)) v)) x0 H6 H11) (lift h (minus d0 (S +i)) w) (H2 x h (minus d0 (S i)) H12)) (plus (S i) (minus d0 (S i))) +(le_plus_minus (S i) d0 H4)) (lift h (plus (S i) (minus d0 (S i))) (lift (S +i) O v)) (lift_d v h (S i) (minus d0 (S i)) O (le_O_n (minus d0 (S i))))) d0 +(le_plus_minus_r (S i) d0 H4)) (lift h d0 (TLRef i)) (lift_lref_lt i h d0 +H4))))) H10)))))))) H5))) (\lambda (H4: (le d0 i)).(eq_ind_r T (TLRef (plus i +h)) (\lambda (t: T).(tau0 g c0 t (lift h d0 (lift (S i) O v)))) (eq_ind nat +(S i) (\lambda (_: nat).(tau0 g c0 (TLRef (plus i h)) (lift h d0 (lift (S i) +O v)))) (eq_ind_r T (lift (plus h (S i)) O v) (\lambda (t: T).(tau0 g c0 +(TLRef (plus i h)) t)) (eq_ind_r nat (plus (S i) h) (\lambda (n: nat).(tau0 g +c0 (TLRef (plus i h)) (lift n O v))) (tau0_abst g c0 d v (plus i h) +(drop_getl_trans_ge i c0 c d0 h H3 (CHead d (Bind Abst) v) H0 H4) w H1) (plus +h (S i)) (plus_comm h (S i))) (lift h d0 (lift (S i) O v)) (lift_free v (S i) +h O d0 (le_S d0 i H4) (le_O_n d0))) (plus i (S O)) (eq_ind_r nat (plus (S O) +i) (\lambda (n: nat).(eq nat (S i) n)) (refl_equal nat (plus (S O) i)) (plus +i (S O)) (plus_comm i (S O)))) (lift h d0 (TLRef i)) (lift_lref_ge i h d0 +H4)))))))))))))))) (\lambda (b: B).(\lambda (c: C).(\lambda (v: T).(\lambda +(t3: T).(\lambda (t4: T).(\lambda (_: (tau0 g (CHead c (Bind b) v) t3 +t4)).(\lambda (H1: ((\forall (c0: C).(\forall (h: nat).(\forall (d: +nat).((drop h d c0 (CHead c (Bind b) v)) \to (tau0 g c0 (lift h d t3) (lift h +d t4)))))))).(\lambda (c0: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda +(H2: (drop h d c0 c)).(eq_ind_r T (THead (Bind b) (lift h d v) (lift h (s +(Bind b) d) t3)) (\lambda (t: T).(tau0 g c0 t (lift h d (THead (Bind b) v +t4)))) (eq_ind_r T (THead (Bind b) (lift h d v) (lift h (s (Bind b) d) t4)) +(\lambda (t: T).(tau0 g c0 (THead (Bind b) (lift h d v) (lift h (s (Bind b) +d) t3)) t)) (tau0_bind g b c0 (lift h d v) (lift h (S d) t3) (lift h (S d) +t4) (H1 (CHead c0 (Bind b) (lift h d v)) h (S d) (drop_skip_bind h d c0 c H2 +b v))) (lift h d (THead (Bind b) v t4)) (lift_head (Bind b) v t4 h d)) (lift +h d (THead (Bind b) v t3)) (lift_head (Bind b) v t3 h d))))))))))))) (\lambda +(c: C).(\lambda (v: T).(\lambda (t3: T).(\lambda (t4: T).(\lambda (_: (tau0 g +c t3 t4)).(\lambda (H1: ((\forall (c0: C).(\forall (h: nat).(\forall (d: +nat).((drop h d c0 c) \to (tau0 g c0 (lift h d t3) (lift h d +t4)))))))).(\lambda (c0: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H2: +(drop h d c0 c)).(eq_ind_r T (THead (Flat Appl) (lift h d v) (lift h (s (Flat +Appl) d) t3)) (\lambda (t: T).(tau0 g c0 t (lift h d (THead (Flat Appl) v +t4)))) (eq_ind_r T (THead (Flat Appl) (lift h d v) (lift h (s (Flat Appl) d) +t4)) (\lambda (t: T).(tau0 g c0 (THead (Flat Appl) (lift h d v) (lift h (s +(Flat Appl) d) t3)) t)) (tau0_appl g c0 (lift h d v) (lift h (s (Flat Appl) +d) t3) (lift h (s (Flat Appl) d) t4) (H1 c0 h (s (Flat Appl) d) H2)) (lift h +d (THead (Flat Appl) v t4)) (lift_head (Flat Appl) v t4 h d)) (lift h d +(THead (Flat Appl) v t3)) (lift_head (Flat Appl) v t3 h d)))))))))))) +(\lambda (c: C).(\lambda (v1: T).(\lambda (v2: T).(\lambda (_: (tau0 g c v1 +v2)).(\lambda (H1: ((\forall (c0: C).(\forall (h: nat).(\forall (d: +nat).((drop h d c0 c) \to (tau0 g c0 (lift h d v1) (lift h d +v2)))))))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (_: (tau0 g c t3 +t4)).(\lambda (H3: ((\forall (c0: C).(\forall (h: nat).(\forall (d: +nat).((drop h d c0 c) \to (tau0 g c0 (lift h d t3) (lift h d +t4)))))))).(\lambda (c0: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H4: +(drop h d c0 c)).(eq_ind_r T (THead (Flat Cast) (lift h d v1) (lift h (s +(Flat Cast) d) t3)) (\lambda (t: T).(tau0 g c0 t (lift h d (THead (Flat Cast) +v2 t4)))) (eq_ind_r T (THead (Flat Cast) (lift h d v2) (lift h (s (Flat Cast) +d) t4)) (\lambda (t: T).(tau0 g c0 (THead (Flat Cast) (lift h d v1) (lift h +(s (Flat Cast) d) t3)) t)) (tau0_cast g c0 (lift h d v1) (lift h d v2) (H1 c0 +h d H4) (lift h (s (Flat Cast) d) t3) (lift h (s (Flat Cast) d) t4) (H3 c0 h +(s (Flat Cast) d) H4)) (lift h d (THead (Flat Cast) v2 t4)) (lift_head (Flat +Cast) v2 t4 h d)) (lift h d (THead (Flat Cast) v1 t3)) (lift_head (Flat Cast) +v1 t3 h d))))))))))))))) e t1 t2 H))))). + +theorem tau0_correct: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t: T).((tau0 g c +t1 t) \to (ex T (\lambda (t2: T).(tau0 g c t t2))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t: T).(\lambda (H: +(tau0 g c t1 t)).(tau0_ind g (\lambda (c0: C).(\lambda (_: T).(\lambda (t2: +T).(ex T (\lambda (t3: T).(tau0 g c0 t2 t3)))))) (\lambda (c0: C).(\lambda +(n: nat).(ex_intro T (\lambda (t2: T).(tau0 g c0 (TSort (next g n)) t2)) +(TSort (next g (next g n))) (tau0_sort g c0 (next g n))))) (\lambda (c0: +C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: nat).(\lambda (H0: (getl i c0 +(CHead d (Bind Abbr) v))).(\lambda (w: T).(\lambda (_: (tau0 g d v +w)).(\lambda (H2: (ex T (\lambda (t2: T).(tau0 g d w t2)))).(let H3 \def H2 +in (ex_ind T (\lambda (t2: T).(tau0 g d w t2)) (ex T (\lambda (t2: T).(tau0 g +c0 (lift (S i) O w) t2))) (\lambda (x: T).(\lambda (H4: (tau0 g d w +x)).(ex_intro T (\lambda (t2: T).(tau0 g c0 (lift (S i) O w) t2)) (lift (S i) +O x) (tau0_lift g d w x H4 c0 (S i) O (getl_drop Abbr c0 d v i H0))))) +H3)))))))))) (\lambda (c0: C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: +nat).(\lambda (H0: (getl i c0 (CHead d (Bind Abst) v))).(\lambda (w: +T).(\lambda (H1: (tau0 g d v w)).(\lambda (H2: (ex T (\lambda (t2: T).(tau0 g +d w t2)))).(let H3 \def H2 in (ex_ind T (\lambda (t2: T).(tau0 g d w t2)) (ex +T (\lambda (t2: T).(tau0 g c0 (lift (S i) O v) t2))) (\lambda (x: T).(\lambda +(_: (tau0 g d w x)).(ex_intro T (\lambda (t2: T).(tau0 g c0 (lift (S i) O v) +t2)) (lift (S i) O w) (tau0_lift g d v w H1 c0 (S i) O (getl_drop Abst c0 d v +i H0))))) H3)))))))))) (\lambda (b: B).(\lambda (c0: C).(\lambda (v: +T).(\lambda (t2: T).(\lambda (t3: T).(\lambda (_: (tau0 g (CHead c0 (Bind b) +v) t2 t3)).(\lambda (H1: (ex T (\lambda (t4: T).(tau0 g (CHead c0 (Bind b) v) +t3 t4)))).(let H2 \def H1 in (ex_ind T (\lambda (t4: T).(tau0 g (CHead c0 +(Bind b) v) t3 t4)) (ex T (\lambda (t4: T).(tau0 g c0 (THead (Bind b) v t3) +t4))) (\lambda (x: T).(\lambda (H3: (tau0 g (CHead c0 (Bind b) v) t3 +x)).(ex_intro T (\lambda (t4: T).(tau0 g c0 (THead (Bind b) v t3) t4)) (THead +(Bind b) v x) (tau0_bind g b c0 v t3 x H3)))) H2))))))))) (\lambda (c0: +C).(\lambda (v: T).(\lambda (t2: T).(\lambda (t3: T).(\lambda (_: (tau0 g c0 +t2 t3)).(\lambda (H1: (ex T (\lambda (t4: T).(tau0 g c0 t3 t4)))).(let H2 +\def H1 in (ex_ind T (\lambda (t4: T).(tau0 g c0 t3 t4)) (ex T (\lambda (t4: +T).(tau0 g c0 (THead (Flat Appl) v t3) t4))) (\lambda (x: T).(\lambda (H3: +(tau0 g c0 t3 x)).(ex_intro T (\lambda (t4: T).(tau0 g c0 (THead (Flat Appl) +v t3) t4)) (THead (Flat Appl) v x) (tau0_appl g c0 v t3 x H3)))) H2)))))))) +(\lambda (c0: C).(\lambda (v1: T).(\lambda (v2: T).(\lambda (_: (tau0 g c0 v1 +v2)).(\lambda (H1: (ex T (\lambda (t2: T).(tau0 g c0 v2 t2)))).(\lambda (t2: +T).(\lambda (t3: T).(\lambda (_: (tau0 g c0 t2 t3)).(\lambda (H3: (ex T +(\lambda (t4: T).(tau0 g c0 t3 t4)))).(let H4 \def H1 in (ex_ind T (\lambda +(t4: T).(tau0 g c0 v2 t4)) (ex T (\lambda (t4: T).(tau0 g c0 (THead (Flat +Cast) v2 t3) t4))) (\lambda (x: T).(\lambda (H5: (tau0 g c0 v2 x)).(let H6 +\def H3 in (ex_ind T (\lambda (t4: T).(tau0 g c0 t3 t4)) (ex T (\lambda (t4: +T).(tau0 g c0 (THead (Flat Cast) v2 t3) t4))) (\lambda (x0: T).(\lambda (H7: +(tau0 g c0 t3 x0)).(ex_intro T (\lambda (t4: T).(tau0 g c0 (THead (Flat Cast) +v2 t3) t4)) (THead (Flat Cast) x x0) (tau0_cast g c0 v2 x H5 t3 x0 H7)))) +H6)))) H4))))))))))) c t1 t H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/cnt.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/cnt.ma new file mode 100644 index 000000000..845ea8933 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/cnt.ma @@ -0,0 +1,88 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/tau1/cnt". + +include "tau1/props.ma". + +include "cnt/props.ma". + +theorem tau1_cnt: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t: T).((tau0 g c +t1 t) \to (ex2 T (\lambda (t2: T).(tau1 g c t1 t2)) (\lambda (t2: T).(cnt +t2))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t: T).(\lambda (H: +(tau0 g c t1 t)).(tau0_ind g (\lambda (c0: C).(\lambda (t0: T).(\lambda (_: +T).(ex2 T (\lambda (t3: T).(tau1 g c0 t0 t3)) (\lambda (t3: T).(cnt t3)))))) +(\lambda (c0: C).(\lambda (n: nat).(ex_intro2 T (\lambda (t2: T).(tau1 g c0 +(TSort n) t2)) (\lambda (t2: T).(cnt t2)) (TSort (next g n)) (tau1_tau0 g c0 +(TSort n) (TSort (next g n)) (tau0_sort g c0 n)) (cnt_sort (next g n))))) +(\lambda (c0: C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: nat).(\lambda +(H0: (getl i c0 (CHead d (Bind Abbr) v))).(\lambda (w: T).(\lambda (_: (tau0 +g d v w)).(\lambda (H2: (ex2 T (\lambda (t2: T).(tau1 g d v t2)) (\lambda +(t2: T).(cnt t2)))).(let H3 \def H2 in (ex2_ind T (\lambda (t2: T).(tau1 g d +v t2)) (\lambda (t2: T).(cnt t2)) (ex2 T (\lambda (t2: T).(tau1 g c0 (TLRef +i) t2)) (\lambda (t2: T).(cnt t2))) (\lambda (x: T).(\lambda (H4: (tau1 g d v +x)).(\lambda (H5: (cnt x)).(ex_intro2 T (\lambda (t2: T).(tau1 g c0 (TLRef i) +t2)) (\lambda (t2: T).(cnt t2)) (lift (S i) O x) (tau1_abbr g c0 d v i H0 x +H4) (cnt_lift x H5 (S i) O))))) H3)))))))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (v: T).(\lambda (i: nat).(\lambda (H0: (getl i c0 (CHead d (Bind +Abst) v))).(\lambda (w: T).(\lambda (H1: (tau0 g d v w)).(\lambda (H2: (ex2 T +(\lambda (t2: T).(tau1 g d v t2)) (\lambda (t2: T).(cnt t2)))).(let H3 \def +H2 in (ex2_ind T (\lambda (t2: T).(tau1 g d v t2)) (\lambda (t2: T).(cnt t2)) +(ex2 T (\lambda (t2: T).(tau1 g c0 (TLRef i) t2)) (\lambda (t2: T).(cnt t2))) +(\lambda (x: T).(\lambda (H4: (tau1 g d v x)).(\lambda (H5: (cnt +x)).(ex_intro2 T (\lambda (t2: T).(tau1 g c0 (TLRef i) t2)) (\lambda (t2: +T).(cnt t2)) (lift (S i) O x) (tau1_trans g c0 (TLRef i) (lift (S i) O v) +(tau1_tau0 g c0 (TLRef i) (lift (S i) O v) (tau0_abst g c0 d v i H0 w H1)) +(lift (S i) O x) (tau1_lift g d v x H4 c0 (S i) O (getl_drop Abst c0 d v i +H0))) (cnt_lift x H5 (S i) O))))) H3)))))))))) (\lambda (b: B).(\lambda (c0: +C).(\lambda (v: T).(\lambda (t2: T).(\lambda (t3: T).(\lambda (_: (tau0 g +(CHead c0 (Bind b) v) t2 t3)).(\lambda (H1: (ex2 T (\lambda (t4: T).(tau1 g +(CHead c0 (Bind b) v) t2 t4)) (\lambda (t4: T).(cnt t4)))).(let H2 \def H1 in +(ex2_ind T (\lambda (t4: T).(tau1 g (CHead c0 (Bind b) v) t2 t4)) (\lambda +(t4: T).(cnt t4)) (ex2 T (\lambda (t4: T).(tau1 g c0 (THead (Bind b) v t2) +t4)) (\lambda (t4: T).(cnt t4))) (\lambda (x: T).(\lambda (H3: (tau1 g (CHead +c0 (Bind b) v) t2 x)).(\lambda (H4: (cnt x)).(ex_intro2 T (\lambda (t4: +T).(tau1 g c0 (THead (Bind b) v t2) t4)) (\lambda (t4: T).(cnt t4)) (THead +(Bind b) v x) (tau1_bind g b c0 v t2 x H3) (cnt_head x H4 (Bind b) v))))) +H2))))))))) (\lambda (c0: C).(\lambda (v: T).(\lambda (t2: T).(\lambda (t3: +T).(\lambda (_: (tau0 g c0 t2 t3)).(\lambda (H1: (ex2 T (\lambda (t4: +T).(tau1 g c0 t2 t4)) (\lambda (t4: T).(cnt t4)))).(let H2 \def H1 in +(ex2_ind T (\lambda (t4: T).(tau1 g c0 t2 t4)) (\lambda (t4: T).(cnt t4)) +(ex2 T (\lambda (t4: T).(tau1 g c0 (THead (Flat Appl) v t2) t4)) (\lambda +(t4: T).(cnt t4))) (\lambda (x: T).(\lambda (H3: (tau1 g c0 t2 x)).(\lambda +(H4: (cnt x)).(ex_intro2 T (\lambda (t4: T).(tau1 g c0 (THead (Flat Appl) v +t2) t4)) (\lambda (t4: T).(cnt t4)) (THead (Flat Appl) v x) (tau1_appl g c0 v +t2 x H3) (cnt_head x H4 (Flat Appl) v))))) H2)))))))) (\lambda (c0: +C).(\lambda (v1: T).(\lambda (v2: T).(\lambda (H0: (tau0 g c0 v1 +v2)).(\lambda (_: (ex2 T (\lambda (t2: T).(tau1 g c0 v1 t2)) (\lambda (t2: +T).(cnt t2)))).(\lambda (t2: T).(\lambda (t3: T).(\lambda (_: (tau0 g c0 t2 +t3)).(\lambda (H3: (ex2 T (\lambda (t4: T).(tau1 g c0 t2 t4)) (\lambda (t4: +T).(cnt t4)))).(let H4 \def H3 in (ex2_ind T (\lambda (t4: T).(tau1 g c0 t2 +t4)) (\lambda (t4: T).(cnt t4)) (ex2 T (\lambda (t4: T).(tau1 g c0 (THead +(Flat Cast) v1 t2) t4)) (\lambda (t4: T).(cnt t4))) (\lambda (x: T).(\lambda +(H5: (tau1 g c0 t2 x)).(\lambda (H6: (cnt x)).(let H_x \def (tau1_cast2 g c0 +t2 x H5 v1 v2 H0) in (let H7 \def H_x in (ex2_ind T (\lambda (v3: T).(tau1 g +c0 v1 v3)) (\lambda (v3: T).(tau1 g c0 (THead (Flat Cast) v1 t2) (THead (Flat +Cast) v3 x))) (ex2 T (\lambda (t4: T).(tau1 g c0 (THead (Flat Cast) v1 t2) +t4)) (\lambda (t4: T).(cnt t4))) (\lambda (x0: T).(\lambda (_: (tau1 g c0 v1 +x0)).(\lambda (H9: (tau1 g c0 (THead (Flat Cast) v1 t2) (THead (Flat Cast) x0 +x))).(ex_intro2 T (\lambda (t4: T).(tau1 g c0 (THead (Flat Cast) v1 t2) t4)) +(\lambda (t4: T).(cnt t4)) (THead (Flat Cast) x0 x) H9 (cnt_head x H6 (Flat +Cast) x0))))) H7)))))) H4))))))))))) c t1 t H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/defs.ma new file mode 100644 index 000000000..09a531fbc --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/defs.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/tau1/defs". + +include "tau0/defs.ma". + +inductive tau1 (g: G) (c: C) (t1: T): T \to Prop \def +| tau1_tau0: \forall (t2: T).((tau0 g c t1 t2) \to (tau1 g c t1 t2)) +| tau1_sing: \forall (t: T).((tau1 g c t1 t) \to (\forall (t2: T).((tau0 g c +t t2) \to (tau1 g c t1 t2)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/props.ma new file mode 100644 index 000000000..30ee3158c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/props.ma @@ -0,0 +1,144 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/tau1/props". + +include "tau1/defs.ma". + +include "tau0/props.ma". + +theorem tau1_trans: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t: T).((tau1 g c +t1 t) \to (\forall (t2: T).((tau1 g c t t2) \to (tau1 g c t1 t2))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t: T).(\lambda (H: +(tau1 g c t1 t)).(\lambda (t2: T).(\lambda (H0: (tau1 g c t t2)).(tau1_ind g +c t (\lambda (t0: T).(tau1 g c t1 t0)) (\lambda (t3: T).(\lambda (H1: (tau0 g +c t t3)).(tau1_sing g c t1 t H t3 H1))) (\lambda (t0: T).(\lambda (_: (tau1 g +c t t0)).(\lambda (H2: (tau1 g c t1 t0)).(\lambda (t3: T).(\lambda (H3: (tau0 +g c t0 t3)).(tau1_sing g c t1 t0 H2 t3 H3)))))) t2 H0))))))). + +theorem tau1_bind: + \forall (g: G).(\forall (b: B).(\forall (c: C).(\forall (v: T).(\forall (t1: +T).(\forall (t2: T).((tau1 g (CHead c (Bind b) v) t1 t2) \to (tau1 g c (THead +(Bind b) v t1) (THead (Bind b) v t2)))))))) +\def + \lambda (g: G).(\lambda (b: B).(\lambda (c: C).(\lambda (v: T).(\lambda (t1: +T).(\lambda (t2: T).(\lambda (H: (tau1 g (CHead c (Bind b) v) t1 +t2)).(tau1_ind g (CHead c (Bind b) v) t1 (\lambda (t: T).(tau1 g c (THead +(Bind b) v t1) (THead (Bind b) v t))) (\lambda (t3: T).(\lambda (H0: (tau0 g +(CHead c (Bind b) v) t1 t3)).(tau1_tau0 g c (THead (Bind b) v t1) (THead +(Bind b) v t3) (tau0_bind g b c v t1 t3 H0)))) (\lambda (t: T).(\lambda (_: +(tau1 g (CHead c (Bind b) v) t1 t)).(\lambda (H1: (tau1 g c (THead (Bind b) v +t1) (THead (Bind b) v t))).(\lambda (t3: T).(\lambda (H2: (tau0 g (CHead c +(Bind b) v) t t3)).(tau1_sing g c (THead (Bind b) v t1) (THead (Bind b) v t) +H1 (THead (Bind b) v t3) (tau0_bind g b c v t t3 H2))))))) t2 H))))))). + +theorem tau1_appl: + \forall (g: G).(\forall (c: C).(\forall (v: T).(\forall (t1: T).(\forall +(t2: T).((tau1 g c t1 t2) \to (tau1 g c (THead (Flat Appl) v t1) (THead (Flat +Appl) v t2))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (v: T).(\lambda (t1: T).(\lambda +(t2: T).(\lambda (H: (tau1 g c t1 t2)).(tau1_ind g c t1 (\lambda (t: T).(tau1 +g c (THead (Flat Appl) v t1) (THead (Flat Appl) v t))) (\lambda (t3: +T).(\lambda (H0: (tau0 g c t1 t3)).(tau1_tau0 g c (THead (Flat Appl) v t1) +(THead (Flat Appl) v t3) (tau0_appl g c v t1 t3 H0)))) (\lambda (t: +T).(\lambda (_: (tau1 g c t1 t)).(\lambda (H1: (tau1 g c (THead (Flat Appl) v +t1) (THead (Flat Appl) v t))).(\lambda (t3: T).(\lambda (H2: (tau0 g c t +t3)).(tau1_sing g c (THead (Flat Appl) v t1) (THead (Flat Appl) v t) H1 +(THead (Flat Appl) v t3) (tau0_appl g c v t t3 H2))))))) t2 H)))))). + +theorem tau1_lift: + \forall (g: G).(\forall (e: C).(\forall (t1: T).(\forall (t2: T).((tau1 g e +t1 t2) \to (\forall (c: C).(\forall (h: nat).(\forall (d: nat).((drop h d c +e) \to (tau1 g c (lift h d t1) (lift h d t2)))))))))) +\def + \lambda (g: G).(\lambda (e: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (tau1 g e t1 t2)).(tau1_ind g e t1 (\lambda (t: T).(\forall (c: +C).(\forall (h: nat).(\forall (d: nat).((drop h d c e) \to (tau1 g c (lift h +d t1) (lift h d t))))))) (\lambda (t3: T).(\lambda (H0: (tau0 g e t1 +t3)).(\lambda (c: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda (H1: (drop +h d c e)).(tau1_tau0 g c (lift h d t1) (lift h d t3) (tau0_lift g e t1 t3 H0 +c h d H1)))))))) (\lambda (t: T).(\lambda (_: (tau1 g e t1 t)).(\lambda (H1: +((\forall (c: C).(\forall (h: nat).(\forall (d: nat).((drop h d c e) \to +(tau1 g c (lift h d t1) (lift h d t)))))))).(\lambda (t3: T).(\lambda (H2: +(tau0 g e t t3)).(\lambda (c: C).(\lambda (h: nat).(\lambda (d: nat).(\lambda +(H3: (drop h d c e)).(tau1_sing g c (lift h d t1) (lift h d t) (H1 c h d H3) +(lift h d t3) (tau0_lift g e t t3 H2 c h d H3))))))))))) t2 H))))). + +theorem tau1_correct: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t: T).((tau1 g c +t1 t) \to (ex T (\lambda (t2: T).(tau0 g c t t2))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t: T).(\lambda (H: +(tau1 g c t1 t)).(tau1_ind g c t1 (\lambda (t0: T).(ex T (\lambda (t2: +T).(tau0 g c t0 t2)))) (\lambda (t2: T).(\lambda (H0: (tau0 g c t1 +t2)).(tau0_correct g c t1 t2 H0))) (\lambda (t0: T).(\lambda (_: (tau1 g c t1 +t0)).(\lambda (_: (ex T (\lambda (t2: T).(tau0 g c t0 t2)))).(\lambda (t2: +T).(\lambda (H2: (tau0 g c t0 t2)).(tau0_correct g c t0 t2 H2)))))) t H))))). + +theorem tau1_abbr: + \forall (g: G).(\forall (c: C).(\forall (d: C).(\forall (v: T).(\forall (i: +nat).((getl i c (CHead d (Bind Abbr) v)) \to (\forall (w: T).((tau1 g d v w) +\to (tau1 g c (TLRef i) (lift (S i) O w))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (d: C).(\lambda (v: T).(\lambda (i: +nat).(\lambda (H: (getl i c (CHead d (Bind Abbr) v))).(\lambda (w: +T).(\lambda (H0: (tau1 g d v w)).(tau1_ind g d v (\lambda (t: T).(tau1 g c +(TLRef i) (lift (S i) O t))) (\lambda (t2: T).(\lambda (H1: (tau0 g d v +t2)).(tau1_tau0 g c (TLRef i) (lift (S i) O t2) (tau0_abbr g c d v i H t2 +H1)))) (\lambda (t: T).(\lambda (_: (tau1 g d v t)).(\lambda (H2: (tau1 g c +(TLRef i) (lift (S i) O t))).(\lambda (t2: T).(\lambda (H3: (tau0 g d t +t2)).(tau1_sing g c (TLRef i) (lift (S i) O t) H2 (lift (S i) O t2) +(tau0_lift g d t t2 H3 c (S i) O (getl_drop Abbr c d v i H)))))))) w +H0)))))))). + +theorem tau1_cast2: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t2: T).((tau1 g c +t1 t2) \to (\forall (v1: T).(\forall (v2: T).((tau0 g c v1 v2) \to (ex2 T +(\lambda (v3: T).(tau1 g c v1 v3)) (\lambda (v3: T).(tau1 g c (THead (Flat +Cast) v1 t1) (THead (Flat Cast) v3 t2))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (tau1 g c t1 t2)).(tau1_ind g c t1 (\lambda (t: T).(\forall (v1: +T).(\forall (v2: T).((tau0 g c v1 v2) \to (ex2 T (\lambda (v3: T).(tau1 g c +v1 v3)) (\lambda (v3: T).(tau1 g c (THead (Flat Cast) v1 t1) (THead (Flat +Cast) v3 t)))))))) (\lambda (t3: T).(\lambda (H0: (tau0 g c t1 t3)).(\lambda +(v1: T).(\lambda (v2: T).(\lambda (H1: (tau0 g c v1 v2)).(ex_intro2 T +(\lambda (v3: T).(tau1 g c v1 v3)) (\lambda (v3: T).(tau1 g c (THead (Flat +Cast) v1 t1) (THead (Flat Cast) v3 t3))) v2 (tau1_tau0 g c v1 v2 H1) +(tau1_tau0 g c (THead (Flat Cast) v1 t1) (THead (Flat Cast) v2 t3) (tau0_cast +g c v1 v2 H1 t1 t3 H0)))))))) (\lambda (t: T).(\lambda (_: (tau1 g c t1 +t)).(\lambda (H1: ((\forall (v1: T).(\forall (v2: T).((tau0 g c v1 v2) \to +(ex2 T (\lambda (v3: T).(tau1 g c v1 v3)) (\lambda (v3: T).(tau1 g c (THead +(Flat Cast) v1 t1) (THead (Flat Cast) v3 t))))))))).(\lambda (t3: T).(\lambda +(H2: (tau0 g c t t3)).(\lambda (v1: T).(\lambda (v2: T).(\lambda (H3: (tau0 g +c v1 v2)).(let H_x \def (H1 v1 v2 H3) in (let H4 \def H_x in (ex2_ind T +(\lambda (v3: T).(tau1 g c v1 v3)) (\lambda (v3: T).(tau1 g c (THead (Flat +Cast) v1 t1) (THead (Flat Cast) v3 t))) (ex2 T (\lambda (v3: T).(tau1 g c v1 +v3)) (\lambda (v3: T).(tau1 g c (THead (Flat Cast) v1 t1) (THead (Flat Cast) +v3 t3)))) (\lambda (x: T).(\lambda (H5: (tau1 g c v1 x)).(\lambda (H6: (tau1 +g c (THead (Flat Cast) v1 t1) (THead (Flat Cast) x t))).(let H_x0 \def +(tau1_correct g c v1 x H5) in (let H7 \def H_x0 in (ex_ind T (\lambda (t4: +T).(tau0 g c x t4)) (ex2 T (\lambda (v3: T).(tau1 g c v1 v3)) (\lambda (v3: +T).(tau1 g c (THead (Flat Cast) v1 t1) (THead (Flat Cast) v3 t3)))) (\lambda +(x0: T).(\lambda (H8: (tau0 g c x x0)).(ex_intro2 T (\lambda (v3: T).(tau1 g +c v1 v3)) (\lambda (v3: T).(tau1 g c (THead (Flat Cast) v1 t1) (THead (Flat +Cast) v3 t3))) x0 (tau1_sing g c v1 x H5 x0 H8) (tau1_sing g c (THead (Flat +Cast) v1 t1) (THead (Flat Cast) x t) H6 (THead (Flat Cast) x0 t3) (tau0_cast +g c x x0 H8 t t3 H2))))) H7)))))) H4))))))))))) t2 H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/theory.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/theory.ma new file mode 100644 index 000000000..daf2a250e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/theory.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/theory". + +include "subst0/tlt.ma". + +include "tau1/cnt.ma". + +include "ex0/props.ma". + +include "wcpr0/fwd.ma". + +include "pr3/wcpr0.ma". + +include "ex2/props.ma". + +include "ex1/props.ma". + +include "ty3/tau0.ma". + +include "ty3/nf2.ma". + +include "ty3/dec.ma". + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/defs.ma new file mode 100644 index 000000000..ad412abf3 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/defs.ma @@ -0,0 +1,49 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/tlist/defs". + +include "T/defs.ma". + +inductive TList: Set \def +| TNil: TList +| TCons: T \to (TList \to TList). + +definition THeads: + K \to (TList \to (T \to T)) +\def + let rec THeads (k: K) (us: TList) on us: (T \to T) \def (\lambda (t: +T).(match us with [TNil \Rightarrow t | (TCons u ul) \Rightarrow (THead k u +(THeads k ul t))])) in THeads. + +definition TApp: + TList \to (T \to TList) +\def + let rec TApp (ts: TList) on ts: (T \to TList) \def (\lambda (v: T).(match ts +with [TNil \Rightarrow (TCons v TNil) | (TCons t ts0) \Rightarrow (TCons t +(TApp ts0 v))])) in TApp. + +definition tslen: + TList \to nat +\def + let rec tslen (ts: TList) on ts: nat \def (match ts with [TNil \Rightarrow O +| (TCons _ ts0) \Rightarrow (S (tslen ts0))]) in tslen. + +definition tslt: + TList \to (TList \to Prop) +\def + \lambda (ts1: TList).(\lambda (ts2: TList).(lt (tslen ts1) (tslen ts2))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/props.ma new file mode 100644 index 000000000..9f37ad2b4 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/props.ma @@ -0,0 +1,120 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/tlist/props". + +include "tlist/defs.ma". + +theorem tslt_wf__q_ind: + \forall (P: ((TList \to Prop))).(((\forall (n: nat).((\lambda (P0: ((TList +\to Prop))).(\lambda (n0: nat).(\forall (ts: TList).((eq nat (tslen ts) n0) +\to (P0 ts))))) P n))) \to (\forall (ts: TList).(P ts))) +\def + let Q \def (\lambda (P: ((TList \to Prop))).(\lambda (n: nat).(\forall (ts: +TList).((eq nat (tslen ts) n) \to (P ts))))) in (\lambda (P: ((TList \to +Prop))).(\lambda (H: ((\forall (n: nat).(\forall (ts: TList).((eq nat (tslen +ts) n) \to (P ts)))))).(\lambda (ts: TList).(H (tslen ts) ts (refl_equal nat +(tslen ts)))))). + +theorem tslt_wf_ind: + \forall (P: ((TList \to Prop))).(((\forall (ts2: TList).(((\forall (ts1: +TList).((tslt ts1 ts2) \to (P ts1)))) \to (P ts2)))) \to (\forall (ts: +TList).(P ts))) +\def + let Q \def (\lambda (P: ((TList \to Prop))).(\lambda (n: nat).(\forall (ts: +TList).((eq nat (tslen ts) n) \to (P ts))))) in (\lambda (P: ((TList \to +Prop))).(\lambda (H: ((\forall (ts2: TList).(((\forall (ts1: TList).((lt +(tslen ts1) (tslen ts2)) \to (P ts1)))) \to (P ts2))))).(\lambda (ts: +TList).(tslt_wf__q_ind (\lambda (t: TList).(P t)) (\lambda (n: +nat).(lt_wf_ind n (Q (\lambda (t: TList).(P t))) (\lambda (n0: nat).(\lambda +(H0: ((\forall (m: nat).((lt m n0) \to (Q (\lambda (t: TList).(P t)) +m))))).(\lambda (ts0: TList).(\lambda (H1: (eq nat (tslen ts0) n0)).(let H2 +\def (eq_ind_r nat n0 (\lambda (n1: nat).(\forall (m: nat).((lt m n1) \to +(\forall (ts1: TList).((eq nat (tslen ts1) m) \to (P ts1)))))) H0 (tslen ts0) +H1) in (H ts0 (\lambda (ts1: TList).(\lambda (H3: (lt (tslen ts1) (tslen +ts0))).(H2 (tslen ts1) H3 ts1 (refl_equal nat (tslen ts1))))))))))))) ts)))). + +theorem theads_tapp: + \forall (k: K).(\forall (vs: TList).(\forall (v: T).(\forall (t: T).(eq T +(THeads k (TApp vs v) t) (THeads k vs (THead k v t)))))) +\def + \lambda (k: K).(\lambda (vs: TList).(TList_ind (\lambda (t: TList).(\forall +(v: T).(\forall (t0: T).(eq T (THeads k (TApp t v) t0) (THeads k t (THead k v +t0)))))) (\lambda (v: T).(\lambda (t: T).(refl_equal T (THead k v t)))) +(\lambda (t: T).(\lambda (t0: TList).(\lambda (H: ((\forall (v: T).(\forall +(t1: T).(eq T (THeads k (TApp t0 v) t1) (THeads k t0 (THead k v +t1))))))).(\lambda (v: T).(\lambda (t1: T).(eq_ind_r T (THeads k t0 (THead k +v t1)) (\lambda (t2: T).(eq T (THead k t t2) (THead k t (THeads k t0 (THead k +v t1))))) (refl_equal T (THead k t (THeads k t0 (THead k v t1)))) (THeads k +(TApp t0 v) t1) (H v t1))))))) vs)). + +theorem tcons_tapp_ex: + \forall (ts1: TList).(\forall (t1: T).(ex2_2 TList T (\lambda (ts2: +TList).(\lambda (t2: T).(eq TList (TCons t1 ts1) (TApp ts2 t2)))) (\lambda +(ts2: TList).(\lambda (_: T).(eq nat (tslen ts1) (tslen ts2)))))) +\def + \lambda (ts1: TList).(TList_ind (\lambda (t: TList).(\forall (t1: T).(ex2_2 +TList T (\lambda (ts2: TList).(\lambda (t2: T).(eq TList (TCons t1 t) (TApp +ts2 t2)))) (\lambda (ts2: TList).(\lambda (_: T).(eq nat (tslen t) (tslen +ts2))))))) (\lambda (t1: T).(ex2_2_intro TList T (\lambda (ts2: +TList).(\lambda (t2: T).(eq TList (TCons t1 TNil) (TApp ts2 t2)))) (\lambda +(ts2: TList).(\lambda (_: T).(eq nat O (tslen ts2)))) TNil t1 (refl_equal +TList (TApp TNil t1)) (refl_equal nat (tslen TNil)))) (\lambda (t: +T).(\lambda (t0: TList).(\lambda (H: ((\forall (t1: T).(ex2_2 TList T +(\lambda (ts2: TList).(\lambda (t2: T).(eq TList (TCons t1 t0) (TApp ts2 +t2)))) (\lambda (ts2: TList).(\lambda (_: T).(eq nat (tslen t0) (tslen +ts2)))))))).(\lambda (t1: T).(let H_x \def (H t) in (let H0 \def H_x in +(ex2_2_ind TList T (\lambda (ts2: TList).(\lambda (t2: T).(eq TList (TCons t +t0) (TApp ts2 t2)))) (\lambda (ts2: TList).(\lambda (_: T).(eq nat (tslen t0) +(tslen ts2)))) (ex2_2 TList T (\lambda (ts2: TList).(\lambda (t2: T).(eq +TList (TCons t1 (TCons t t0)) (TApp ts2 t2)))) (\lambda (ts2: TList).(\lambda +(_: T).(eq nat (S (tslen t0)) (tslen ts2))))) (\lambda (x0: TList).(\lambda +(x1: T).(\lambda (H1: (eq TList (TCons t t0) (TApp x0 x1))).(\lambda (H2: (eq +nat (tslen t0) (tslen x0))).(eq_ind_r TList (TApp x0 x1) (\lambda (t2: +TList).(ex2_2 TList T (\lambda (ts2: TList).(\lambda (t3: T).(eq TList (TCons +t1 t2) (TApp ts2 t3)))) (\lambda (ts2: TList).(\lambda (_: T).(eq nat (S +(tslen t0)) (tslen ts2)))))) (eq_ind_r nat (tslen x0) (\lambda (n: +nat).(ex2_2 TList T (\lambda (ts2: TList).(\lambda (t2: T).(eq TList (TCons +t1 (TApp x0 x1)) (TApp ts2 t2)))) (\lambda (ts2: TList).(\lambda (_: T).(eq +nat (S n) (tslen ts2)))))) (ex2_2_intro TList T (\lambda (ts2: +TList).(\lambda (t2: T).(eq TList (TCons t1 (TApp x0 x1)) (TApp ts2 t2)))) +(\lambda (ts2: TList).(\lambda (_: T).(eq nat (S (tslen x0)) (tslen ts2)))) +(TCons t1 x0) x1 (refl_equal TList (TApp (TCons t1 x0) x1)) (refl_equal nat +(tslen (TCons t1 x0)))) (tslen t0) H2) (TCons t t0) H1))))) H0))))))) ts1). + +theorem tlist_ind_rew: + \forall (P: ((TList \to Prop))).((P TNil) \to (((\forall (ts: +TList).(\forall (t: T).((P ts) \to (P (TApp ts t)))))) \to (\forall (ts: +TList).(P ts)))) +\def + \lambda (P: ((TList \to Prop))).(\lambda (H: (P TNil)).(\lambda (H0: +((\forall (ts: TList).(\forall (t: T).((P ts) \to (P (TApp ts +t))))))).(\lambda (ts: TList).(tslt_wf_ind (\lambda (t: TList).(P t)) +(\lambda (ts2: TList).(TList_ind (\lambda (t: TList).(((\forall (ts1: +TList).((tslt ts1 t) \to (P ts1)))) \to (P t))) (\lambda (_: ((\forall (ts1: +TList).((tslt ts1 TNil) \to (P ts1))))).H) (\lambda (t: T).(\lambda (t0: +TList).(\lambda (_: ((((\forall (ts1: TList).((tslt ts1 t0) \to (P ts1)))) +\to (P t0)))).(\lambda (H2: ((\forall (ts1: TList).((tslt ts1 (TCons t t0)) +\to (P ts1))))).(let H_x \def (tcons_tapp_ex t0 t) in (let H3 \def H_x in +(ex2_2_ind TList T (\lambda (ts3: TList).(\lambda (t2: T).(eq TList (TCons t +t0) (TApp ts3 t2)))) (\lambda (ts3: TList).(\lambda (_: T).(eq nat (tslen t0) +(tslen ts3)))) (P (TCons t t0)) (\lambda (x0: TList).(\lambda (x1: +T).(\lambda (H4: (eq TList (TCons t t0) (TApp x0 x1))).(\lambda (H5: (eq nat +(tslen t0) (tslen x0))).(eq_ind_r TList (TApp x0 x1) (\lambda (t1: TList).(P +t1)) (H0 x0 x1 (H2 x0 (eq_ind nat (tslen t0) (\lambda (n: nat).(lt n (tslen +(TCons t t0)))) (le_n (tslen (TCons t t0))) (tslen x0) H5))) (TCons t t0) +H4))))) H3))))))) ts2)) ts)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/defs.ma new file mode 100644 index 000000000..f5acb3e27 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/defs.ma @@ -0,0 +1,48 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/tlt/defs". + +include "T/defs.ma". + +definition wadd: + ((nat \to nat)) \to (nat \to (nat \to nat)) +\def + \lambda (f: ((nat \to nat))).(\lambda (w: nat).(\lambda (n: nat).(match n +with [O \Rightarrow w | (S m) \Rightarrow (f m)]))). + +definition weight_map: + ((nat \to nat)) \to (T \to nat) +\def + let rec weight_map (f: ((nat \to nat))) (t: T) on t: nat \def (match t with +[(TSort _) \Rightarrow O | (TLRef n) \Rightarrow (f n) | (THead k u t0) +\Rightarrow (match k with [(Bind b) \Rightarrow (match b with [Abbr +\Rightarrow (S (plus (weight_map f u) (weight_map (wadd f (S (weight_map f +u))) t0))) | Abst \Rightarrow (S (plus (weight_map f u) (weight_map (wadd f +O) t0))) | Void \Rightarrow (S (plus (weight_map f u) (weight_map (wadd f O) +t0)))]) | (Flat _) \Rightarrow (S (plus (weight_map f u) (weight_map f +t0)))])]) in weight_map. + +definition weight: + T \to nat +\def + weight_map (\lambda (_: nat).O). + +definition tlt: + T \to (T \to Prop) +\def + \lambda (t1: T).(\lambda (t2: T).(lt (weight t1) (weight t2))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/props.ma new file mode 100644 index 000000000..b75bc8053 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/props.ma @@ -0,0 +1,267 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/tlt/props". + +include "tlt/defs.ma". + +theorem wadd_le: + \forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (n: +nat).(le (f n) (g n)))) \to (\forall (v: nat).(\forall (w: nat).((le v w) \to +(\forall (n: nat).(le (wadd f v n) (wadd g w n)))))))) +\def + \lambda (f: ((nat \to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H: +((\forall (n: nat).(le (f n) (g n))))).(\lambda (v: nat).(\lambda (w: +nat).(\lambda (H0: (le v w)).(\lambda (n: nat).(nat_ind (\lambda (n0: +nat).(le (wadd f v n0) (wadd g w n0))) H0 (\lambda (n0: nat).(\lambda (_: (le +(wadd f v n0) (wadd g w n0))).(H n0))) n))))))). + +theorem wadd_lt: + \forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (n: +nat).(le (f n) (g n)))) \to (\forall (v: nat).(\forall (w: nat).((lt v w) \to +(\forall (n: nat).(le (wadd f v n) (wadd g w n)))))))) +\def + \lambda (f: ((nat \to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H: +((\forall (n: nat).(le (f n) (g n))))).(\lambda (v: nat).(\lambda (w: +nat).(\lambda (H0: (lt v w)).(\lambda (n: nat).(nat_ind (\lambda (n0: +nat).(le (wadd f v n0) (wadd g w n0))) (le_S_n v w (le_S (S v) w H0)) +(\lambda (n0: nat).(\lambda (_: (le (wadd f v n0) (wadd g w n0))).(H n0))) +n))))))). + +theorem wadd_O: + \forall (n: nat).(eq nat (wadd (\lambda (_: nat).O) O n) O) +\def + \lambda (n: nat).(nat_ind (\lambda (n0: nat).(eq nat (wadd (\lambda (_: +nat).O) O n0) O)) (refl_equal nat O) (\lambda (n0: nat).(\lambda (_: (eq nat +(wadd (\lambda (_: nat).O) O n0) O)).(refl_equal nat O))) n). + +theorem weight_le: + \forall (t: T).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (n: nat).(le (f n) (g n)))) \to (le (weight_map f t) +(weight_map g t))))) +\def + \lambda (t: T).(T_ind (\lambda (t0: T).(\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (n: nat).(le (f n) (g n)))) +\to (le (weight_map f t0) (weight_map g t0)))))) (\lambda (n: nat).(\lambda +(f: ((nat \to nat))).(\lambda (g: ((nat \to nat))).(\lambda (_: ((\forall +(n0: nat).(le (f n0) (g n0))))).(le_n (weight_map g (TSort n))))))) (\lambda +(n: nat).(\lambda (f: ((nat \to nat))).(\lambda (g: ((nat \to nat))).(\lambda +(H: ((\forall (n0: nat).(le (f n0) (g n0))))).(H n))))) (\lambda (k: +K).(K_ind (\lambda (k0: K).(\forall (t0: T).(((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (n: nat).(le (f n) (g n)))) +\to (le (weight_map f t0) (weight_map g t0)))))) \to (\forall (t1: +T).(((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall +(n: nat).(le (f n) (g n)))) \to (le (weight_map f t1) (weight_map g t1)))))) +\to (\forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall +(n: nat).(le (f n) (g n)))) \to (le (weight_map f (THead k0 t0 t1)) +(weight_map g (THead k0 t0 t1))))))))))) (\lambda (b: B).(B_ind (\lambda (b0: +B).(\forall (t0: T).(((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (n: nat).(le (f n) (g n)))) \to (le (weight_map f t0) +(weight_map g t0)))))) \to (\forall (t1: T).(((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (n: nat).(le (f n) (g n)))) +\to (le (weight_map f t1) (weight_map g t1)))))) \to (\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (n: nat).(le (f n) (g n)))) +\to (le (match b0 with [Abbr \Rightarrow (S (plus (weight_map f t0) +(weight_map (wadd f (S (weight_map f t0))) t1))) | Abst \Rightarrow (S (plus +(weight_map f t0) (weight_map (wadd f O) t1))) | Void \Rightarrow (S (plus +(weight_map f t0) (weight_map (wadd f O) t1)))]) (match b0 with [Abbr +\Rightarrow (S (plus (weight_map g t0) (weight_map (wadd g (S (weight_map g +t0))) t1))) | Abst \Rightarrow (S (plus (weight_map g t0) (weight_map (wadd g +O) t1))) | Void \Rightarrow (S (plus (weight_map g t0) (weight_map (wadd g O) +t1)))])))))))))) (\lambda (t0: T).(\lambda (H: ((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (n: nat).(le (f n) (g n)))) +\to (le (weight_map f t0) (weight_map g t0))))))).(\lambda (t1: T).(\lambda +(H0: ((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall +(n: nat).(le (f n) (g n)))) \to (le (weight_map f t1) (weight_map g +t1))))))).(\lambda (f: ((nat \to nat))).(\lambda (g: ((nat \to +nat))).(\lambda (H1: ((\forall (n: nat).(le (f n) (g n))))).(le_n_S (plus +(weight_map f t0) (weight_map (wadd f (S (weight_map f t0))) t1)) (plus +(weight_map g t0) (weight_map (wadd g (S (weight_map g t0))) t1)) +(plus_le_compat (weight_map f t0) (weight_map g t0) (weight_map (wadd f (S +(weight_map f t0))) t1) (weight_map (wadd g (S (weight_map g t0))) t1) (H f g +H1) (H0 (wadd f (S (weight_map f t0))) (wadd g (S (weight_map g t0))) +(\lambda (n: nat).(wadd_le f g H1 (S (weight_map f t0)) (S (weight_map g t0)) +(le_n_S (weight_map f t0) (weight_map g t0) (H f g H1)) n)))))))))))) +(\lambda (t0: T).(\lambda (H: ((\forall (f: ((nat \to nat))).(\forall (g: +((nat \to nat))).(((\forall (n: nat).(le (f n) (g n)))) \to (le (weight_map f +t0) (weight_map g t0))))))).(\lambda (t1: T).(\lambda (H0: ((\forall (f: +((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (n: nat).(le (f n) +(g n)))) \to (le (weight_map f t1) (weight_map g t1))))))).(\lambda (f: ((nat +\to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H1: ((\forall (n: nat).(le +(f n) (g n))))).(le_n_S (plus (weight_map f t0) (weight_map (wadd f O) t1)) +(plus (weight_map g t0) (weight_map (wadd g O) t1)) (plus_le_compat +(weight_map f t0) (weight_map g t0) (weight_map (wadd f O) t1) (weight_map +(wadd g O) t1) (H f g H1) (H0 (wadd f O) (wadd g O) (\lambda (n: +nat).(wadd_le f g H1 O O (le_n O) n)))))))))))) (\lambda (t0: T).(\lambda (H: +((\forall (f: ((nat \to nat))).(\forall (g: ((nat \to nat))).(((\forall (n: +nat).(le (f n) (g n)))) \to (le (weight_map f t0) (weight_map g +t0))))))).(\lambda (t1: T).(\lambda (H0: ((\forall (f: ((nat \to +nat))).(\forall (g: ((nat \to nat))).(((\forall (n: nat).(le (f n) (g n)))) +\to (le (weight_map f t1) (weight_map g t1))))))).(\lambda (f: ((nat \to +nat))).(\lambda (g: ((nat \to nat))).(\lambda (H1: ((\forall (n: nat).(le (f +n) (g n))))).(le_n_S (plus (weight_map f t0) (weight_map (wadd f O) t1)) +(plus (weight_map g t0) (weight_map (wadd g O) t1)) (plus_le_compat +(weight_map f t0) (weight_map g t0) (weight_map (wadd f O) t1) (weight_map +(wadd g O) t1) (H f g H1) (H0 (wadd f O) (wadd g O) (\lambda (n: +nat).(wadd_le f g H1 O O (le_n O) n)))))))))))) b)) (\lambda (_: F).(\lambda +(t0: T).(\lambda (H: ((\forall (f0: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (n: nat).(le (f0 n) (g n)))) \to (le (weight_map f0 t0) +(weight_map g t0))))))).(\lambda (t1: T).(\lambda (H0: ((\forall (f0: ((nat +\to nat))).(\forall (g: ((nat \to nat))).(((\forall (n: nat).(le (f0 n) (g +n)))) \to (le (weight_map f0 t1) (weight_map g t1))))))).(\lambda (f0: ((nat +\to nat))).(\lambda (g: ((nat \to nat))).(\lambda (H1: ((\forall (n: nat).(le +(f0 n) (g n))))).(le_n_S (plus (weight_map f0 t0) (weight_map f0 t1)) (plus +(weight_map g t0) (weight_map g t1)) (plus_le_compat (weight_map f0 t0) +(weight_map g t0) (weight_map f0 t1) (weight_map g t1) (H f0 g H1) (H0 f0 g +H1))))))))))) k)) t). + +theorem weight_eq: + \forall (t: T).(\forall (f: ((nat \to nat))).(\forall (g: ((nat \to +nat))).(((\forall (n: nat).(eq nat (f n) (g n)))) \to (eq nat (weight_map f +t) (weight_map g t))))) +\def + \lambda (t: T).(\lambda (f: ((nat \to nat))).(\lambda (g: ((nat \to +nat))).(\lambda (H: ((\forall (n: nat).(eq nat (f n) (g n))))).(le_antisym +(weight_map f t) (weight_map g t) (weight_le t f g (\lambda (n: +nat).(eq_ind_r nat (g n) (\lambda (n0: nat).(le n0 (g n))) (le_n (g n)) (f n) +(H n)))) (weight_le t g f (\lambda (n: nat).(eq_ind_r nat (g n) (\lambda (n0: +nat).(le (g n) n0)) (le_n (g n)) (f n) (H n)))))))). + +theorem weight_add_O: + \forall (t: T).(eq nat (weight_map (wadd (\lambda (_: nat).O) O) t) +(weight_map (\lambda (_: nat).O) t)) +\def + \lambda (t: T).(weight_eq t (wadd (\lambda (_: nat).O) O) (\lambda (_: +nat).O) (\lambda (n: nat).(wadd_O n))). + +theorem weight_add_S: + \forall (t: T).(\forall (m: nat).(le (weight_map (wadd (\lambda (_: nat).O) +O) t) (weight_map (wadd (\lambda (_: nat).O) (S m)) t))) +\def + \lambda (t: T).(\lambda (m: nat).(weight_le t (wadd (\lambda (_: nat).O) O) +(wadd (\lambda (_: nat).O) (S m)) (\lambda (n: nat).(wadd_le (\lambda (_: +nat).O) (\lambda (_: nat).O) (\lambda (_: nat).(le_n O)) O (S m) (le_S O m +(le_O_n m)) n)))). + +theorem tlt_trans: + \forall (v: T).(\forall (u: T).(\forall (t: T).((tlt u v) \to ((tlt v t) \to +(tlt u t))))) +\def + \lambda (v: T).(\lambda (u: T).(\lambda (t: T).(\lambda (H: (lt (weight u) +(weight v))).(\lambda (H0: (lt (weight v) (weight t))).(lt_trans (weight u) +(weight v) (weight t) H H0))))). + +theorem tlt_head_sx: + \forall (k: K).(\forall (u: T).(\forall (t: T).(tlt u (THead k u t)))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (u: T).(\forall (t: T).(lt +(weight_map (\lambda (_: nat).O) u) (weight_map (\lambda (_: nat).O) (THead +k0 u t)))))) (\lambda (b: B).(B_ind (\lambda (b0: B).(\forall (u: T).(\forall +(t: T).(lt (weight_map (\lambda (_: nat).O) u) (match b0 with [Abbr +\Rightarrow (S (plus (weight_map (\lambda (_: nat).O) u) (weight_map (wadd +(\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) t))) | Abst +\Rightarrow (S (plus (weight_map (\lambda (_: nat).O) u) (weight_map (wadd +(\lambda (_: nat).O) O) t))) | Void \Rightarrow (S (plus (weight_map (\lambda +(_: nat).O) u) (weight_map (wadd (\lambda (_: nat).O) O) t)))]))))) (\lambda +(u: T).(\lambda (t: T).(le_n_S (weight_map (\lambda (_: nat).O) u) (plus +(weight_map (\lambda (_: nat).O) u) (weight_map (wadd (\lambda (_: nat).O) (S +(weight_map (\lambda (_: nat).O) u))) t)) (le_plus_l (weight_map (\lambda (_: +nat).O) u) (weight_map (wadd (\lambda (_: nat).O) (S (weight_map (\lambda (_: +nat).O) u))) t))))) (\lambda (u: T).(\lambda (t: T).(le_n_S (weight_map +(\lambda (_: nat).O) u) (plus (weight_map (\lambda (_: nat).O) u) (weight_map +(wadd (\lambda (_: nat).O) O) t)) (le_plus_l (weight_map (\lambda (_: nat).O) +u) (weight_map (wadd (\lambda (_: nat).O) O) t))))) (\lambda (u: T).(\lambda +(t: T).(le_n_S (weight_map (\lambda (_: nat).O) u) (plus (weight_map (\lambda +(_: nat).O) u) (weight_map (wadd (\lambda (_: nat).O) O) t)) (le_plus_l +(weight_map (\lambda (_: nat).O) u) (weight_map (wadd (\lambda (_: nat).O) O) +t))))) b)) (\lambda (_: F).(\lambda (u: T).(\lambda (t: T).(le_n_S +(weight_map (\lambda (_: nat).O) u) (plus (weight_map (\lambda (_: nat).O) u) +(weight_map (\lambda (_: nat).O) t)) (le_plus_l (weight_map (\lambda (_: +nat).O) u) (weight_map (\lambda (_: nat).O) t)))))) k). + +theorem tlt_head_dx: + \forall (k: K).(\forall (u: T).(\forall (t: T).(tlt t (THead k u t)))) +\def + \lambda (k: K).(K_ind (\lambda (k0: K).(\forall (u: T).(\forall (t: T).(lt +(weight_map (\lambda (_: nat).O) t) (weight_map (\lambda (_: nat).O) (THead +k0 u t)))))) (\lambda (b: B).(B_ind (\lambda (b0: B).(\forall (u: T).(\forall +(t: T).(lt (weight_map (\lambda (_: nat).O) t) (match b0 with [Abbr +\Rightarrow (S (plus (weight_map (\lambda (_: nat).O) u) (weight_map (wadd +(\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) t))) | Abst +\Rightarrow (S (plus (weight_map (\lambda (_: nat).O) u) (weight_map (wadd +(\lambda (_: nat).O) O) t))) | Void \Rightarrow (S (plus (weight_map (\lambda +(_: nat).O) u) (weight_map (wadd (\lambda (_: nat).O) O) t)))]))))) (\lambda +(u: T).(\lambda (t: T).(lt_le_trans (weight_map (\lambda (_: nat).O) t) (S +(weight_map (\lambda (_: nat).O) t)) (S (plus (weight_map (\lambda (_: +nat).O) u) (weight_map (wadd (\lambda (_: nat).O) (S (weight_map (\lambda (_: +nat).O) u))) t))) (lt_n_Sn (weight_map (\lambda (_: nat).O) t)) (le_n_S +(weight_map (\lambda (_: nat).O) t) (plus (weight_map (\lambda (_: nat).O) u) +(weight_map (wadd (\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) +u))) t)) (le_trans (weight_map (\lambda (_: nat).O) t) (weight_map (wadd +(\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) t) (plus +(weight_map (\lambda (_: nat).O) u) (weight_map (wadd (\lambda (_: nat).O) (S +(weight_map (\lambda (_: nat).O) u))) t)) (eq_ind nat (weight_map (wadd +(\lambda (_: nat).O) O) t) (\lambda (n: nat).(le n (weight_map (wadd (\lambda +(_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) t))) (weight_add_S t +(weight_map (\lambda (_: nat).O) u)) (weight_map (\lambda (_: nat).O) t) +(weight_add_O t)) (le_plus_r (weight_map (\lambda (_: nat).O) u) (weight_map +(wadd (\lambda (_: nat).O) (S (weight_map (\lambda (_: nat).O) u))) t))))))) +(\lambda (u: T).(\lambda (t: T).(eq_ind_r nat (weight_map (\lambda (_: +nat).O) t) (\lambda (n: nat).(lt (weight_map (\lambda (_: nat).O) t) (S (plus +(weight_map (\lambda (_: nat).O) u) n)))) (le_n_S (weight_map (\lambda (_: +nat).O) t) (plus (weight_map (\lambda (_: nat).O) u) (weight_map (\lambda (_: +nat).O) t)) (le_plus_r (weight_map (\lambda (_: nat).O) u) (weight_map +(\lambda (_: nat).O) t))) (weight_map (wadd (\lambda (_: nat).O) O) t) +(weight_add_O t)))) (\lambda (u: T).(\lambda (t: T).(eq_ind_r nat (weight_map +(\lambda (_: nat).O) t) (\lambda (n: nat).(lt (weight_map (\lambda (_: +nat).O) t) (S (plus (weight_map (\lambda (_: nat).O) u) n)))) (le_n_S +(weight_map (\lambda (_: nat).O) t) (plus (weight_map (\lambda (_: nat).O) u) +(weight_map (\lambda (_: nat).O) t)) (le_plus_r (weight_map (\lambda (_: +nat).O) u) (weight_map (\lambda (_: nat).O) t))) (weight_map (wadd (\lambda +(_: nat).O) O) t) (weight_add_O t)))) b)) (\lambda (_: F).(\lambda (u: +T).(\lambda (t: T).(le_n_S (weight_map (\lambda (_: nat).O) t) (plus +(weight_map (\lambda (_: nat).O) u) (weight_map (\lambda (_: nat).O) t)) +(le_plus_r (weight_map (\lambda (_: nat).O) u) (weight_map (\lambda (_: +nat).O) t)))))) k). + +theorem tlt_wf__q_ind: + \forall (P: ((T \to Prop))).(((\forall (n: nat).((\lambda (P0: ((T \to +Prop))).(\lambda (n0: nat).(\forall (t: T).((eq nat (weight t) n0) \to (P0 +t))))) P n))) \to (\forall (t: T).(P t))) +\def + let Q \def (\lambda (P: ((T \to Prop))).(\lambda (n: nat).(\forall (t: +T).((eq nat (weight t) n) \to (P t))))) in (\lambda (P: ((T \to +Prop))).(\lambda (H: ((\forall (n: nat).(\forall (t: T).((eq nat (weight t) +n) \to (P t)))))).(\lambda (t: T).(H (weight t) t (refl_equal nat (weight +t)))))). + +theorem tlt_wf_ind: + \forall (P: ((T \to Prop))).(((\forall (t: T).(((\forall (v: T).((tlt v t) +\to (P v)))) \to (P t)))) \to (\forall (t: T).(P t))) +\def + let Q \def (\lambda (P: ((T \to Prop))).(\lambda (n: nat).(\forall (t: +T).((eq nat (weight t) n) \to (P t))))) in (\lambda (P: ((T \to +Prop))).(\lambda (H: ((\forall (t: T).(((\forall (v: T).((lt (weight v) +(weight t)) \to (P v)))) \to (P t))))).(\lambda (t: T).(tlt_wf__q_ind +(\lambda (t0: T).(P t0)) (\lambda (n: nat).(lt_wf_ind n (Q (\lambda (t0: +T).(P t0))) (\lambda (n0: nat).(\lambda (H0: ((\forall (m: nat).((lt m n0) +\to (Q (\lambda (t0: T).(P t0)) m))))).(\lambda (t0: T).(\lambda (H1: (eq nat +(weight t0) n0)).(let H2 \def (eq_ind_r nat n0 (\lambda (n1: nat).(\forall +(m: nat).((lt m n1) \to (\forall (t1: T).((eq nat (weight t1) m) \to (P +t1)))))) H0 (weight t0) H1) in (H t0 (\lambda (v: T).(\lambda (H3: (lt +(weight v) (weight t0))).(H2 (weight v) H3 v (refl_equal nat (weight +v))))))))))))) t)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity.ma new file mode 100644 index 000000000..ba58219da --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity.ma @@ -0,0 +1,198 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/arity". + +include "ty3/pr3_props.ma". + +include "arity/pr3.ma". + +include "asucc/fwd.ma". + +theorem ty3_arity: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t2: T).((ty3 g c +t1 t2) \to (ex2 A (\lambda (a1: A).(arity g c t1 a1)) (\lambda (a1: A).(arity +g c t2 (asucc g a1)))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (ty3 g c t1 t2)).(ty3_ind g (\lambda (c0: C).(\lambda (t: T).(\lambda +(t0: T).(ex2 A (\lambda (a1: A).(arity g c0 t a1)) (\lambda (a1: A).(arity g +c0 t0 (asucc g a1))))))) (\lambda (c0: C).(\lambda (t3: T).(\lambda (t: +T).(\lambda (_: (ty3 g c0 t3 t)).(\lambda (H1: (ex2 A (\lambda (a1: A).(arity +g c0 t3 a1)) (\lambda (a1: A).(arity g c0 t (asucc g a1))))).(\lambda (u: +T).(\lambda (t4: T).(\lambda (_: (ty3 g c0 u t4)).(\lambda (H3: (ex2 A +(\lambda (a1: A).(arity g c0 u a1)) (\lambda (a1: A).(arity g c0 t4 (asucc g +a1))))).(\lambda (H4: (pc3 c0 t4 t3)).(let H5 \def H1 in (ex2_ind A (\lambda +(a1: A).(arity g c0 t3 a1)) (\lambda (a1: A).(arity g c0 t (asucc g a1))) +(ex2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (a1: A).(arity g c0 t3 +(asucc g a1)))) (\lambda (x: A).(\lambda (H6: (arity g c0 t3 x)).(\lambda (_: +(arity g c0 t (asucc g x))).(let H8 \def H3 in (ex2_ind A (\lambda (a1: +A).(arity g c0 u a1)) (\lambda (a1: A).(arity g c0 t4 (asucc g a1))) (ex2 A +(\lambda (a1: A).(arity g c0 u a1)) (\lambda (a1: A).(arity g c0 t3 (asucc g +a1)))) (\lambda (x0: A).(\lambda (H9: (arity g c0 u x0)).(\lambda (H10: +(arity g c0 t4 (asucc g x0))).(let H11 \def H4 in (ex2_ind T (\lambda (t0: +T).(pr3 c0 t4 t0)) (\lambda (t0: T).(pr3 c0 t3 t0)) (ex2 A (\lambda (a1: +A).(arity g c0 u a1)) (\lambda (a1: A).(arity g c0 t3 (asucc g a1)))) +(\lambda (x1: T).(\lambda (H12: (pr3 c0 t4 x1)).(\lambda (H13: (pr3 c0 t3 +x1)).(ex_intro2 A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (a1: A).(arity +g c0 t3 (asucc g a1))) x0 H9 (arity_repl g c0 t3 x H6 (asucc g x0) (leq_sym g +(asucc g x0) x (arity_mono g c0 x1 (asucc g x0) (arity_sred_pr3 c0 t4 x1 H12 +g (asucc g x0) H10) x (arity_sred_pr3 c0 t3 x1 H13 g x H6)))))))) H11))))) +H8))))) H5)))))))))))) (\lambda (c0: C).(\lambda (m: nat).(ex_intro2 A +(\lambda (a1: A).(arity g c0 (TSort m) a1)) (\lambda (a1: A).(arity g c0 +(TSort (next g m)) (asucc g a1))) (ASort O m) (arity_sort g c0 m) (arity_sort +g c0 (next g m))))) (\lambda (n: nat).(\lambda (c0: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (H0: (getl n c0 (CHead d (Bind Abbr) +u))).(\lambda (t: T).(\lambda (_: (ty3 g d u t)).(\lambda (H2: (ex2 A +(\lambda (a1: A).(arity g d u a1)) (\lambda (a1: A).(arity g d t (asucc g +a1))))).(let H3 \def H2 in (ex2_ind A (\lambda (a1: A).(arity g d u a1)) +(\lambda (a1: A).(arity g d t (asucc g a1))) (ex2 A (\lambda (a1: A).(arity g +c0 (TLRef n) a1)) (\lambda (a1: A).(arity g c0 (lift (S n) O t) (asucc g +a1)))) (\lambda (x: A).(\lambda (H4: (arity g d u x)).(\lambda (H5: (arity g +d t (asucc g x))).(ex_intro2 A (\lambda (a1: A).(arity g c0 (TLRef n) a1)) +(\lambda (a1: A).(arity g c0 (lift (S n) O t) (asucc g a1))) x (arity_abbr g +c0 d u n H0 x H4) (arity_lift g d t (asucc g x) H5 c0 (S n) O (getl_drop Abbr +c0 d u n H0)))))) H3)))))))))) (\lambda (n: nat).(\lambda (c0: C).(\lambda +(d: C).(\lambda (u: T).(\lambda (H0: (getl n c0 (CHead d (Bind Abst) +u))).(\lambda (t: T).(\lambda (_: (ty3 g d u t)).(\lambda (H2: (ex2 A +(\lambda (a1: A).(arity g d u a1)) (\lambda (a1: A).(arity g d t (asucc g +a1))))).(let H3 \def H2 in (ex2_ind A (\lambda (a1: A).(arity g d u a1)) +(\lambda (a1: A).(arity g d t (asucc g a1))) (ex2 A (\lambda (a1: A).(arity g +c0 (TLRef n) a1)) (\lambda (a1: A).(arity g c0 (lift (S n) O u) (asucc g +a1)))) (\lambda (x: A).(\lambda (H4: (arity g d u x)).(\lambda (_: (arity g d +t (asucc g x))).(let H_x \def (leq_asucc g x) in (let H6 \def H_x in (ex_ind +A (\lambda (a0: A).(leq g x (asucc g a0))) (ex2 A (\lambda (a1: A).(arity g +c0 (TLRef n) a1)) (\lambda (a1: A).(arity g c0 (lift (S n) O u) (asucc g +a1)))) (\lambda (x0: A).(\lambda (H7: (leq g x (asucc g x0))).(ex_intro2 A +(\lambda (a1: A).(arity g c0 (TLRef n) a1)) (\lambda (a1: A).(arity g c0 +(lift (S n) O u) (asucc g a1))) x0 (arity_abst g c0 d u n H0 x0 (arity_repl g +d u x H4 (asucc g x0) H7)) (arity_lift g d u (asucc g x0) (arity_repl g d u x +H4 (asucc g x0) H7) c0 (S n) O (getl_drop Abst c0 d u n H0))))) H6)))))) +H3)))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda (t: T).(\lambda (_: +(ty3 g c0 u t)).(\lambda (H1: (ex2 A (\lambda (a1: A).(arity g c0 u a1)) +(\lambda (a1: A).(arity g c0 t (asucc g a1))))).(\lambda (b: B).(\lambda (t3: +T).(\lambda (t4: T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u) t3 +t4)).(\lambda (H3: (ex2 A (\lambda (a1: A).(arity g (CHead c0 (Bind b) u) t3 +a1)) (\lambda (a1: A).(arity g (CHead c0 (Bind b) u) t4 (asucc g +a1))))).(\lambda (t0: T).(\lambda (H4: (ty3 g (CHead c0 (Bind b) u) t4 +t0)).(\lambda (H5: (ex2 A (\lambda (a1: A).(arity g (CHead c0 (Bind b) u) t4 +a1)) (\lambda (a1: A).(arity g (CHead c0 (Bind b) u) t0 (asucc g a1))))).(let +H6 \def H1 in (ex2_ind A (\lambda (a1: A).(arity g c0 u a1)) (\lambda (a1: +A).(arity g c0 t (asucc g a1))) (ex2 A (\lambda (a1: A).(arity g c0 (THead +(Bind b) u t3) a1)) (\lambda (a1: A).(arity g c0 (THead (Bind b) u t4) (asucc +g a1)))) (\lambda (x: A).(\lambda (H7: (arity g c0 u x)).(\lambda (_: (arity +g c0 t (asucc g x))).(let H9 \def H3 in (ex2_ind A (\lambda (a1: A).(arity g +(CHead c0 (Bind b) u) t3 a1)) (\lambda (a1: A).(arity g (CHead c0 (Bind b) u) +t4 (asucc g a1))) (ex2 A (\lambda (a1: A).(arity g c0 (THead (Bind b) u t3) +a1)) (\lambda (a1: A).(arity g c0 (THead (Bind b) u t4) (asucc g a1)))) +(\lambda (x0: A).(\lambda (H10: (arity g (CHead c0 (Bind b) u) t3 +x0)).(\lambda (H11: (arity g (CHead c0 (Bind b) u) t4 (asucc g x0))).(let H_x +\def (leq_asucc g x) in (let H12 \def H_x in (ex_ind A (\lambda (a0: A).(leq +g x (asucc g a0))) (ex2 A (\lambda (a1: A).(arity g c0 (THead (Bind b) u t3) +a1)) (\lambda (a1: A).(arity g c0 (THead (Bind b) u t4) (asucc g a1)))) +(\lambda (x1: A).(\lambda (H13: (leq g x (asucc g x1))).(B_ind (\lambda (b0: +B).((ty3 g (CHead c0 (Bind b0) u) t4 t0) \to ((ex2 A (\lambda (a1: A).(arity +g (CHead c0 (Bind b0) u) t4 a1)) (\lambda (a1: A).(arity g (CHead c0 (Bind +b0) u) t0 (asucc g a1)))) \to ((arity g (CHead c0 (Bind b0) u) t3 x0) \to +((arity g (CHead c0 (Bind b0) u) t4 (asucc g x0)) \to (ex2 A (\lambda (a1: +A).(arity g c0 (THead (Bind b0) u t3) a1)) (\lambda (a1: A).(arity g c0 +(THead (Bind b0) u t4) (asucc g a1))))))))) (\lambda (_: (ty3 g (CHead c0 +(Bind Abbr) u) t4 t0)).(\lambda (_: (ex2 A (\lambda (a1: A).(arity g (CHead +c0 (Bind Abbr) u) t4 a1)) (\lambda (a1: A).(arity g (CHead c0 (Bind Abbr) u) +t0 (asucc g a1))))).(\lambda (H16: (arity g (CHead c0 (Bind Abbr) u) t3 +x0)).(\lambda (H17: (arity g (CHead c0 (Bind Abbr) u) t4 (asucc g +x0))).(ex_intro2 A (\lambda (a1: A).(arity g c0 (THead (Bind Abbr) u t3) a1)) +(\lambda (a1: A).(arity g c0 (THead (Bind Abbr) u t4) (asucc g a1))) x0 +(arity_bind g Abbr not_abbr_abst c0 u x H7 t3 x0 H16) (arity_bind g Abbr +not_abbr_abst c0 u x H7 t4 (asucc g x0) H17)))))) (\lambda (_: (ty3 g (CHead +c0 (Bind Abst) u) t4 t0)).(\lambda (_: (ex2 A (\lambda (a1: A).(arity g +(CHead c0 (Bind Abst) u) t4 a1)) (\lambda (a1: A).(arity g (CHead c0 (Bind +Abst) u) t0 (asucc g a1))))).(\lambda (H16: (arity g (CHead c0 (Bind Abst) u) +t3 x0)).(\lambda (H17: (arity g (CHead c0 (Bind Abst) u) t4 (asucc g +x0))).(ex_intro2 A (\lambda (a1: A).(arity g c0 (THead (Bind Abst) u t3) a1)) +(\lambda (a1: A).(arity g c0 (THead (Bind Abst) u t4) (asucc g a1))) (AHead +x1 x0) (arity_head g c0 u x1 (arity_repl g c0 u x H7 (asucc g x1) H13) t3 x0 +H16) (arity_repl g c0 (THead (Bind Abst) u t4) (AHead x1 (asucc g x0)) +(arity_head g c0 u x1 (arity_repl g c0 u x H7 (asucc g x1) H13) t4 (asucc g +x0) H17) (asucc g (AHead x1 x0)) (leq_refl g (asucc g (AHead x1 x0))))))))) +(\lambda (_: (ty3 g (CHead c0 (Bind Void) u) t4 t0)).(\lambda (_: (ex2 A +(\lambda (a1: A).(arity g (CHead c0 (Bind Void) u) t4 a1)) (\lambda (a1: +A).(arity g (CHead c0 (Bind Void) u) t0 (asucc g a1))))).(\lambda (H16: +(arity g (CHead c0 (Bind Void) u) t3 x0)).(\lambda (H17: (arity g (CHead c0 +(Bind Void) u) t4 (asucc g x0))).(ex_intro2 A (\lambda (a1: A).(arity g c0 +(THead (Bind Void) u t3) a1)) (\lambda (a1: A).(arity g c0 (THead (Bind Void) +u t4) (asucc g a1))) x0 (arity_bind g Void not_void_abst c0 u x H7 t3 x0 H16) +(arity_bind g Void not_void_abst c0 u x H7 t4 (asucc g x0) H17)))))) b H4 H5 +H10 H11))) H12)))))) H9))))) H6))))))))))))))) (\lambda (c0: C).(\lambda (w: +T).(\lambda (u: T).(\lambda (_: (ty3 g c0 w u)).(\lambda (H1: (ex2 A (\lambda +(a1: A).(arity g c0 w a1)) (\lambda (a1: A).(arity g c0 u (asucc g +a1))))).(\lambda (v: T).(\lambda (t: T).(\lambda (_: (ty3 g c0 v (THead (Bind +Abst) u t))).(\lambda (H3: (ex2 A (\lambda (a1: A).(arity g c0 v a1)) +(\lambda (a1: A).(arity g c0 (THead (Bind Abst) u t) (asucc g a1))))).(let H4 +\def H1 in (ex2_ind A (\lambda (a1: A).(arity g c0 w a1)) (\lambda (a1: +A).(arity g c0 u (asucc g a1))) (ex2 A (\lambda (a1: A).(arity g c0 (THead +(Flat Appl) w v) a1)) (\lambda (a1: A).(arity g c0 (THead (Flat Appl) w +(THead (Bind Abst) u t)) (asucc g a1)))) (\lambda (x: A).(\lambda (H5: (arity +g c0 w x)).(\lambda (H6: (arity g c0 u (asucc g x))).(let H7 \def H3 in +(ex2_ind A (\lambda (a1: A).(arity g c0 v a1)) (\lambda (a1: A).(arity g c0 +(THead (Bind Abst) u t) (asucc g a1))) (ex2 A (\lambda (a1: A).(arity g c0 +(THead (Flat Appl) w v) a1)) (\lambda (a1: A).(arity g c0 (THead (Flat Appl) +w (THead (Bind Abst) u t)) (asucc g a1)))) (\lambda (x0: A).(\lambda (H8: +(arity g c0 v x0)).(\lambda (H9: (arity g c0 (THead (Bind Abst) u t) (asucc g +x0))).(let H10 \def (arity_gen_abst g c0 u t (asucc g x0) H9) in (ex3_2_ind A +A (\lambda (a1: A).(\lambda (a2: A).(eq A (asucc g x0) (AHead a1 a2)))) +(\lambda (a1: A).(\lambda (_: A).(arity g c0 u (asucc g a1)))) (\lambda (_: +A).(\lambda (a2: A).(arity g (CHead c0 (Bind Abst) u) t a2))) (ex2 A (\lambda +(a1: A).(arity g c0 (THead (Flat Appl) w v) a1)) (\lambda (a1: A).(arity g c0 +(THead (Flat Appl) w (THead (Bind Abst) u t)) (asucc g a1)))) (\lambda (x1: +A).(\lambda (x2: A).(\lambda (H11: (eq A (asucc g x0) (AHead x1 +x2))).(\lambda (H12: (arity g c0 u (asucc g x1))).(\lambda (H13: (arity g +(CHead c0 (Bind Abst) u) t x2)).(let H14 \def (sym_eq A (asucc g x0) (AHead +x1 x2) H11) in (let H15 \def (asucc_gen_head g x1 x2 x0 H14) in (ex2_ind A +(\lambda (a0: A).(eq A x0 (AHead x1 a0))) (\lambda (a0: A).(eq A x2 (asucc g +a0))) (ex2 A (\lambda (a1: A).(arity g c0 (THead (Flat Appl) w v) a1)) +(\lambda (a1: A).(arity g c0 (THead (Flat Appl) w (THead (Bind Abst) u t)) +(asucc g a1)))) (\lambda (x3: A).(\lambda (H16: (eq A x0 (AHead x1 +x3))).(\lambda (H17: (eq A x2 (asucc g x3))).(let H18 \def (eq_ind A x2 +(\lambda (a: A).(arity g (CHead c0 (Bind Abst) u) t a)) H13 (asucc g x3) H17) +in (let H19 \def (eq_ind A x0 (\lambda (a: A).(arity g c0 v a)) H8 (AHead x1 +x3) H16) in (ex_intro2 A (\lambda (a1: A).(arity g c0 (THead (Flat Appl) w v) +a1)) (\lambda (a1: A).(arity g c0 (THead (Flat Appl) w (THead (Bind Abst) u +t)) (asucc g a1))) x3 (arity_appl g c0 w x1 (arity_repl g c0 w x H5 x1 +(leq_sym g x1 x (asucc_inj g x1 x (arity_mono g c0 u (asucc g x1) H12 (asucc +g x) H6)))) v x3 H19) (arity_appl g c0 w x H5 (THead (Bind Abst) u t) (asucc +g x3) (arity_head g c0 u x H6 t (asucc g x3) H18)))))))) H15)))))))) H10))))) +H7))))) H4))))))))))) (\lambda (c0: C).(\lambda (t3: T).(\lambda (t4: +T).(\lambda (_: (ty3 g c0 t3 t4)).(\lambda (H1: (ex2 A (\lambda (a1: +A).(arity g c0 t3 a1)) (\lambda (a1: A).(arity g c0 t4 (asucc g +a1))))).(\lambda (t0: T).(\lambda (_: (ty3 g c0 t4 t0)).(\lambda (H3: (ex2 A +(\lambda (a1: A).(arity g c0 t4 a1)) (\lambda (a1: A).(arity g c0 t0 (asucc g +a1))))).(let H4 \def H1 in (ex2_ind A (\lambda (a1: A).(arity g c0 t3 a1)) +(\lambda (a1: A).(arity g c0 t4 (asucc g a1))) (ex2 A (\lambda (a1: A).(arity +g c0 (THead (Flat Cast) t4 t3) a1)) (\lambda (a1: A).(arity g c0 (THead (Flat +Cast) t0 t4) (asucc g a1)))) (\lambda (x: A).(\lambda (H5: (arity g c0 t3 +x)).(\lambda (H6: (arity g c0 t4 (asucc g x))).(let H7 \def H3 in (ex2_ind A +(\lambda (a1: A).(arity g c0 t4 a1)) (\lambda (a1: A).(arity g c0 t0 (asucc g +a1))) (ex2 A (\lambda (a1: A).(arity g c0 (THead (Flat Cast) t4 t3) a1)) +(\lambda (a1: A).(arity g c0 (THead (Flat Cast) t0 t4) (asucc g a1)))) +(\lambda (x0: A).(\lambda (H8: (arity g c0 t4 x0)).(\lambda (H9: (arity g c0 +t0 (asucc g x0))).(ex_intro2 A (\lambda (a1: A).(arity g c0 (THead (Flat +Cast) t4 t3) a1)) (\lambda (a1: A).(arity g c0 (THead (Flat Cast) t0 t4) +(asucc g a1))) x (arity_cast g c0 t4 x H6 t3 H5) (arity_cast g c0 t0 (asucc g +x) (arity_repl g c0 t0 (asucc g x0) H9 (asucc g (asucc g x)) (asucc_repl g x0 +(asucc g x) (arity_mono g c0 t4 x0 H8 (asucc g x) H6))) t4 H6))))) H7))))) +H4)))))))))) c t1 t2 H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity_props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity_props.ma new file mode 100644 index 000000000..2f758d80c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity_props.ma @@ -0,0 +1,111 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/arity_props". + +include "ty3/arity.ma". + +include "ty3/fwd.ma". + +include "sc3/arity.ma". + +theorem ty3_predicative: + \forall (g: G).(\forall (c: C).(\forall (v: T).(\forall (t: T).(\forall (u: +T).((ty3 g c (THead (Bind Abst) v t) u) \to ((pc3 c u v) \to (\forall (P: +Prop).P))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (v: T).(\lambda (t: T).(\lambda (u: +T).(\lambda (H: (ty3 g c (THead (Bind Abst) v t) u)).(\lambda (H0: (pc3 c u +v)).(\lambda (P: Prop).(let H1 \def H in (ex4_3_ind T T T (\lambda (t2: +T).(\lambda (_: T).(\lambda (_: T).(pc3 c (THead (Bind Abst) v t2) u)))) +(\lambda (_: T).(\lambda (t0: T).(\lambda (_: T).(ty3 g c v t0)))) (\lambda +(t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) v) t +t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t1: T).(ty3 g (CHead c +(Bind Abst) v) t2 t1)))) P (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: +T).(\lambda (_: (pc3 c (THead (Bind Abst) v x0) u)).(\lambda (H3: (ty3 g c v +x1)).(\lambda (_: (ty3 g (CHead c (Bind Abst) v) t x0)).(\lambda (_: (ty3 g +(CHead c (Bind Abst) v) x0 x2)).(let H_y \def (ty3_conv g c v x1 H3 (THead +(Bind Abst) v t) u H H0) in (let H_x \def (ty3_arity g c (THead (Bind Abst) v +t) v H_y) in (let H6 \def H_x in (ex2_ind A (\lambda (a1: A).(arity g c +(THead (Bind Abst) v t) a1)) (\lambda (a1: A).(arity g c v (asucc g a1))) P +(\lambda (x: A).(\lambda (H7: (arity g c (THead (Bind Abst) v t) x)).(\lambda +(H8: (arity g c v (asucc g x))).(let H9 \def (arity_gen_abst g c v t x H7) in +(ex3_2_ind A A (\lambda (a1: A).(\lambda (a2: A).(eq A x (AHead a1 a2)))) +(\lambda (a1: A).(\lambda (_: A).(arity g c v (asucc g a1)))) (\lambda (_: +A).(\lambda (a2: A).(arity g (CHead c (Bind Abst) v) t a2))) P (\lambda (x3: +A).(\lambda (x4: A).(\lambda (H10: (eq A x (AHead x3 x4))).(\lambda (H11: +(arity g c v (asucc g x3))).(\lambda (_: (arity g (CHead c (Bind Abst) v) t +x4)).(let H13 \def (eq_ind A x (\lambda (a: A).(arity g c v (asucc g a))) H8 +(AHead x3 x4) H10) in (leq_ahead_asucc_false g x3 (asucc g x4) (arity_mono g +c v (asucc g (AHead x3 x4)) H13 (asucc g x3) H11) P))))))) H9))))) +H6))))))))))) (ty3_gen_bind g Abst c v t u H1)))))))))). + +theorem ty3_repellent: + \forall (g: G).(\forall (c: C).(\forall (w: T).(\forall (t: T).(\forall (u1: +T).((ty3 g c (THead (Bind Abst) w t) u1) \to (\forall (u2: T).((ty3 g (CHead +c (Bind Abst) w) t (lift (S O) O u2)) \to ((pc3 c u1 u2) \to (\forall (P: +Prop).P))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (w: T).(\lambda (t: T).(\lambda (u1: +T).(\lambda (H: (ty3 g c (THead (Bind Abst) w t) u1)).(\lambda (u2: +T).(\lambda (H0: (ty3 g (CHead c (Bind Abst) w) t (lift (S O) O +u2))).(\lambda (H1: (pc3 c u1 u2)).(\lambda (P: Prop).(ex_ind T (\lambda (t0: +T).(ty3 g (CHead c (Bind Abst) w) (lift (S O) O u2) t0)) P (\lambda (x: +T).(\lambda (H2: (ty3 g (CHead c (Bind Abst) w) (lift (S O) O u2) x)).(let H3 +\def (ty3_gen_lift g (CHead c (Bind Abst) w) u2 x (S O) O H2 c (drop_drop +(Bind Abst) O c c (drop_refl c) w)) in (ex2_ind T (\lambda (t2: T).(pc3 +(CHead c (Bind Abst) w) (lift (S O) O t2) x)) (\lambda (t2: T).(ty3 g c u2 +t2)) P (\lambda (x0: T).(\lambda (_: (pc3 (CHead c (Bind Abst) w) (lift (S O) +O x0) x)).(\lambda (H5: (ty3 g c u2 x0)).(let H_y \def (ty3_conv g c u2 x0 H5 +(THead (Bind Abst) w t) u1 H H1) in (let H_x \def (ty3_arity g (CHead c (Bind +Abst) w) t (lift (S O) O u2) H0) in (let H6 \def H_x in (ex2_ind A (\lambda +(a1: A).(arity g (CHead c (Bind Abst) w) t a1)) (\lambda (a1: A).(arity g +(CHead c (Bind Abst) w) (lift (S O) O u2) (asucc g a1))) P (\lambda (x1: +A).(\lambda (H7: (arity g (CHead c (Bind Abst) w) t x1)).(\lambda (H8: (arity +g (CHead c (Bind Abst) w) (lift (S O) O u2) (asucc g x1))).(let H_x0 \def +(ty3_arity g c (THead (Bind Abst) w t) u2 H_y) in (let H9 \def H_x0 in +(ex2_ind A (\lambda (a1: A).(arity g c (THead (Bind Abst) w t) a1)) (\lambda +(a1: A).(arity g c u2 (asucc g a1))) P (\lambda (x2: A).(\lambda (H10: (arity +g c (THead (Bind Abst) w t) x2)).(\lambda (H11: (arity g c u2 (asucc g +x2))).(arity_repellent g c w t x1 H7 x2 H10 (asucc_inj g x1 x2 (arity_mono g +c u2 (asucc g x1) (arity_gen_lift g (CHead c (Bind Abst) w) u2 (asucc g x1) +(S O) O H8 c (drop_drop (Bind Abst) O c c (drop_refl c) w)) (asucc g x2) +H11)) P)))) H9)))))) H6))))))) H3)))) (ty3_correct g (CHead c (Bind Abst) w) +t (lift (S O) O u2) H0))))))))))). + +theorem ty3_acyclic: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (u: T).((ty3 g c t +u) \to ((pc3 c u t) \to (\forall (P: Prop).P)))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (u: T).(\lambda (H: +(ty3 g c t u)).(\lambda (H0: (pc3 c u t)).(\lambda (P: Prop).(let H_y \def +(ty3_conv g c t u H t u H H0) in (let H_x \def (ty3_arity g c t t H_y) in +(let H1 \def H_x in (ex2_ind A (\lambda (a1: A).(arity g c t a1)) (\lambda +(a1: A).(arity g c t (asucc g a1))) P (\lambda (x: A).(\lambda (H2: (arity g +c t x)).(\lambda (H3: (arity g c t (asucc g x))).(leq_asucc_false g x +(arity_mono g c t (asucc g x) H3 x H2) P)))) H1)))))))))). + +theorem ty3_sn3: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (u: T).((ty3 g c t +u) \to (sn3 c t))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (u: T).(\lambda (H: +(ty3 g c t u)).(let H_x \def (ty3_arity g c t u H) in (let H0 \def H_x in +(ex2_ind A (\lambda (a1: A).(arity g c t a1)) (\lambda (a1: A).(arity g c u +(asucc g a1))) (sn3 c t) (\lambda (x: A).(\lambda (H1: (arity g c t +x)).(\lambda (_: (arity g c u (asucc g x))).(sc3_sn3 g x c t (sc3_arity g c t +x H1))))) H0))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/dec.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/dec.ma new file mode 100644 index 000000000..4ad1efbd4 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/dec.ma @@ -0,0 +1,470 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/dec". + +include "ty3/pr3_props.ma". + +include "pc3/dec.ma". + +include "getl/flt.ma". + +include "getl/dec.ma". + +theorem ty3_inference: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(or (ex T (\lambda (t2: +T).(ty3 g c t1 t2))) (\forall (t2: T).((ty3 g c t1 t2) \to (\forall (P: +Prop).P)))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(flt_wf_ind (\lambda (c0: +C).(\lambda (t: T).(or (ex T (\lambda (t2: T).(ty3 g c0 t t2))) (\forall (t2: +T).((ty3 g c0 t t2) \to (\forall (P: Prop).P)))))) (\lambda (c2: C).(\lambda +(t2: T).(T_ind (\lambda (t: T).(((\forall (c1: C).(\forall (t3: T).((flt c1 +t3 c2 t) \to (or (ex T (\lambda (t4: T).(ty3 g c1 t3 t4))) (\forall (t4: +T).((ty3 g c1 t3 t4) \to (\forall (P: Prop).P)))))))) \to (or (ex T (\lambda +(t3: T).(ty3 g c2 t t3))) (\forall (t3: T).((ty3 g c2 t t3) \to (\forall (P: +Prop).P)))))) (\lambda (n: nat).(\lambda (_: ((\forall (c1: C).(\forall (t3: +T).((flt c1 t3 c2 (TSort n)) \to (or (ex T (\lambda (t4: T).(ty3 g c1 t3 +t4))) (\forall (t4: T).((ty3 g c1 t3 t4) \to (\forall (P: +Prop).P))))))))).(or_introl (ex T (\lambda (t3: T).(ty3 g c2 (TSort n) t3))) +(\forall (t3: T).((ty3 g c2 (TSort n) t3) \to (\forall (P: Prop).P))) +(ex_intro T (\lambda (t3: T).(ty3 g c2 (TSort n) t3)) (TSort (next g n)) +(ty3_sort g c2 n))))) (\lambda (n: nat).(\lambda (H: ((\forall (c1: +C).(\forall (t3: T).((flt c1 t3 c2 (TLRef n)) \to (or (ex T (\lambda (t4: +T).(ty3 g c1 t3 t4))) (\forall (t4: T).((ty3 g c1 t3 t4) \to (\forall (P: +Prop).P))))))))).(let H_x \def (getl_dec c2 n) in (let H0 \def H_x in (or_ind +(ex_3 C B T (\lambda (e: C).(\lambda (b: B).(\lambda (v: T).(getl n c2 (CHead +e (Bind b) v)))))) (\forall (d: C).((getl n c2 d) \to (\forall (P: Prop).P))) +(or (ex T (\lambda (t3: T).(ty3 g c2 (TLRef n) t3))) (\forall (t3: T).((ty3 g +c2 (TLRef n) t3) \to (\forall (P: Prop).P)))) (\lambda (H1: (ex_3 C B T +(\lambda (e: C).(\lambda (b: B).(\lambda (v: T).(getl n c2 (CHead e (Bind b) +v))))))).(ex_3_ind C B T (\lambda (e: C).(\lambda (b: B).(\lambda (v: +T).(getl n c2 (CHead e (Bind b) v))))) (or (ex T (\lambda (t3: T).(ty3 g c2 +(TLRef n) t3))) (\forall (t3: T).((ty3 g c2 (TLRef n) t3) \to (\forall (P: +Prop).P)))) (\lambda (x0: C).(\lambda (x1: B).(\lambda (x2: T).(\lambda (H2: +(getl n c2 (CHead x0 (Bind x1) x2))).(let H3 \def (H x0 x2 (getl_flt x1 c2 x0 +x2 n H2)) in (or_ind (ex T (\lambda (t3: T).(ty3 g x0 x2 t3))) (\forall (t3: +T).((ty3 g x0 x2 t3) \to (\forall (P: Prop).P))) (or (ex T (\lambda (t3: +T).(ty3 g c2 (TLRef n) t3))) (\forall (t3: T).((ty3 g c2 (TLRef n) t3) \to +(\forall (P: Prop).P)))) (\lambda (H4: (ex T (\lambda (t3: T).(ty3 g x0 x2 +t3)))).(ex_ind T (\lambda (t3: T).(ty3 g x0 x2 t3)) (or (ex T (\lambda (t3: +T).(ty3 g c2 (TLRef n) t3))) (\forall (t3: T).((ty3 g c2 (TLRef n) t3) \to +(\forall (P: Prop).P)))) (\lambda (x: T).(\lambda (H5: (ty3 g x0 x2 +x)).(B_ind (\lambda (b: B).((getl n c2 (CHead x0 (Bind b) x2)) \to (or (ex T +(\lambda (t3: T).(ty3 g c2 (TLRef n) t3))) (\forall (t3: T).((ty3 g c2 (TLRef +n) t3) \to (\forall (P: Prop).P)))))) (\lambda (H6: (getl n c2 (CHead x0 +(Bind Abbr) x2))).(or_introl (ex T (\lambda (t3: T).(ty3 g c2 (TLRef n) t3))) +(\forall (t3: T).((ty3 g c2 (TLRef n) t3) \to (\forall (P: Prop).P))) +(ex_intro T (\lambda (t3: T).(ty3 g c2 (TLRef n) t3)) (lift (S n) O x) +(ty3_abbr g n c2 x0 x2 H6 x H5)))) (\lambda (H6: (getl n c2 (CHead x0 (Bind +Abst) x2))).(or_introl (ex T (\lambda (t3: T).(ty3 g c2 (TLRef n) t3))) +(\forall (t3: T).((ty3 g c2 (TLRef n) t3) \to (\forall (P: Prop).P))) +(ex_intro T (\lambda (t3: T).(ty3 g c2 (TLRef n) t3)) (lift (S n) O x2) +(ty3_abst g n c2 x0 x2 H6 x H5)))) (\lambda (H6: (getl n c2 (CHead x0 (Bind +Void) x2))).(or_intror (ex T (\lambda (t3: T).(ty3 g c2 (TLRef n) t3))) +(\forall (t3: T).((ty3 g c2 (TLRef n) t3) \to (\forall (P: Prop).P))) +(\lambda (t3: T).(\lambda (H7: (ty3 g c2 (TLRef n) t3)).(\lambda (P: +Prop).(or_ind (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: +T).(pc3 c2 (lift (S n) O t) t3)))) (\lambda (e: C).(\lambda (u: T).(\lambda +(_: T).(getl n c2 (CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: +T).(\lambda (t: T).(ty3 g e u t))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(pc3 c2 (lift (S n) O u) t3)))) (\lambda (e: +C).(\lambda (u: T).(\lambda (_: T).(getl n c2 (CHead e (Bind Abst) u))))) +(\lambda (e: C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t))))) P (\lambda +(H8: (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: T).(pc3 c2 +(lift (S n) O t) t3)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl +n c2 (CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: +T).(ty3 g e u t)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (_: +T).(\lambda (t: T).(pc3 c2 (lift (S n) O t) t3)))) (\lambda (e: C).(\lambda +(u: T).(\lambda (_: T).(getl n c2 (CHead e (Bind Abbr) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t)))) P (\lambda (x3: +C).(\lambda (x4: T).(\lambda (x5: T).(\lambda (_: (pc3 c2 (lift (S n) O x5) +t3)).(\lambda (H10: (getl n c2 (CHead x3 (Bind Abbr) x4))).(\lambda (_: (ty3 +g x3 x4 x5)).(let H12 \def (eq_ind C (CHead x0 (Bind Void) x2) (\lambda (c0: +C).(getl n c2 c0)) H6 (CHead x3 (Bind Abbr) x4) (getl_mono c2 (CHead x0 (Bind +Void) x2) n H6 (CHead x3 (Bind Abbr) x4) H10)) in (let H13 \def (eq_ind C +(CHead x0 (Bind Void) x2) (\lambda (ee: C).(match ee in C return (\lambda (_: +C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) \Rightarrow (match +k in K return (\lambda (_: K).Prop) with [(Bind b) \Rightarrow (match b in B +return (\lambda (_: B).Prop) with [Abbr \Rightarrow False | Abst \Rightarrow +False | Void \Rightarrow True]) | (Flat _) \Rightarrow False])])) I (CHead x3 +(Bind Abbr) x4) (getl_mono c2 (CHead x0 (Bind Void) x2) n H6 (CHead x3 (Bind +Abbr) x4) H10)) in (False_ind P H13))))))))) H8)) (\lambda (H8: (ex3_3 C T T +(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(pc3 c2 (lift (S n) O u) +t3)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl n c2 (CHead e +(Bind Abst) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u +t)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(pc3 +c2 (lift (S n) O u) t3)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: +T).(getl n c2 (CHead e (Bind Abst) u))))) (\lambda (e: C).(\lambda (u: +T).(\lambda (t: T).(ty3 g e u t)))) P (\lambda (x3: C).(\lambda (x4: +T).(\lambda (x5: T).(\lambda (_: (pc3 c2 (lift (S n) O x4) t3)).(\lambda +(H10: (getl n c2 (CHead x3 (Bind Abst) x4))).(\lambda (_: (ty3 g x3 x4 +x5)).(let H12 \def (eq_ind C (CHead x0 (Bind Void) x2) (\lambda (c0: C).(getl +n c2 c0)) H6 (CHead x3 (Bind Abst) x4) (getl_mono c2 (CHead x0 (Bind Void) +x2) n H6 (CHead x3 (Bind Abst) x4) H10)) in (let H13 \def (eq_ind C (CHead x0 +(Bind Void) x2) (\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) +with [(CSort _) \Rightarrow False | (CHead _ k _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind b) \Rightarrow (match b in B return +(\lambda (_: B).Prop) with [Abbr \Rightarrow False | Abst \Rightarrow False | +Void \Rightarrow True]) | (Flat _) \Rightarrow False])])) I (CHead x3 (Bind +Abst) x4) (getl_mono c2 (CHead x0 (Bind Void) x2) n H6 (CHead x3 (Bind Abst) +x4) H10)) in (False_ind P H13))))))))) H8)) (ty3_gen_lref g c2 t3 n H7))))))) +x1 H2))) H4)) (\lambda (H4: ((\forall (t3: T).((ty3 g x0 x2 t3) \to (\forall +(P: Prop).P))))).(or_intror (ex T (\lambda (t3: T).(ty3 g c2 (TLRef n) t3))) +(\forall (t3: T).((ty3 g c2 (TLRef n) t3) \to (\forall (P: Prop).P))) +(\lambda (t3: T).(\lambda (H5: (ty3 g c2 (TLRef n) t3)).(\lambda (P: +Prop).(or_ind (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: +T).(pc3 c2 (lift (S n) O t) t3)))) (\lambda (e: C).(\lambda (u: T).(\lambda +(_: T).(getl n c2 (CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: +T).(\lambda (t: T).(ty3 g e u t))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(pc3 c2 (lift (S n) O u) t3)))) (\lambda (e: +C).(\lambda (u: T).(\lambda (_: T).(getl n c2 (CHead e (Bind Abst) u))))) +(\lambda (e: C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t))))) P (\lambda +(H6: (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: T).(pc3 c2 +(lift (S n) O t) t3)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl +n c2 (CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: +T).(ty3 g e u t)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (_: +T).(\lambda (t: T).(pc3 c2 (lift (S n) O t) t3)))) (\lambda (e: C).(\lambda +(u: T).(\lambda (_: T).(getl n c2 (CHead e (Bind Abbr) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t)))) P (\lambda (x3: +C).(\lambda (x4: T).(\lambda (x5: T).(\lambda (_: (pc3 c2 (lift (S n) O x5) +t3)).(\lambda (H8: (getl n c2 (CHead x3 (Bind Abbr) x4))).(\lambda (H9: (ty3 +g x3 x4 x5)).(let H10 \def (eq_ind C (CHead x0 (Bind x1) x2) (\lambda (c0: +C).(getl n c2 c0)) H2 (CHead x3 (Bind Abbr) x4) (getl_mono c2 (CHead x0 (Bind +x1) x2) n H2 (CHead x3 (Bind Abbr) x4) H8)) in (let H11 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow x0 | (CHead c0 _ _) \Rightarrow c0])) (CHead x0 (Bind x1) x2) +(CHead x3 (Bind Abbr) x4) (getl_mono c2 (CHead x0 (Bind x1) x2) n H2 (CHead +x3 (Bind Abbr) x4) H8)) in ((let H12 \def (f_equal C B (\lambda (e: C).(match +e in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow x1 | (CHead _ k +_) \Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow x1])])) (CHead x0 (Bind x1) x2) (CHead +x3 (Bind Abbr) x4) (getl_mono c2 (CHead x0 (Bind x1) x2) n H2 (CHead x3 (Bind +Abbr) x4) H8)) in ((let H13 \def (f_equal C T (\lambda (e: C).(match e in C +return (\lambda (_: C).T) with [(CSort _) \Rightarrow x2 | (CHead _ _ t) +\Rightarrow t])) (CHead x0 (Bind x1) x2) (CHead x3 (Bind Abbr) x4) (getl_mono +c2 (CHead x0 (Bind x1) x2) n H2 (CHead x3 (Bind Abbr) x4) H8)) in (\lambda +(_: (eq B x1 Abbr)).(\lambda (H15: (eq C x0 x3)).(let H16 \def (eq_ind_r T x4 +(\lambda (t: T).(getl n c2 (CHead x3 (Bind Abbr) t))) H10 x2 H13) in (let H17 +\def (eq_ind_r T x4 (\lambda (t: T).(ty3 g x3 t x5)) H9 x2 H13) in (let H18 +\def (eq_ind_r C x3 (\lambda (c0: C).(getl n c2 (CHead c0 (Bind Abbr) x2))) +H16 x0 H15) in (let H19 \def (eq_ind_r C x3 (\lambda (c0: C).(ty3 g c0 x2 +x5)) H17 x0 H15) in (H4 x5 H19 P)))))))) H12)) H11))))))))) H6)) (\lambda +(H6: (ex3_3 C T T (\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(pc3 c2 +(lift (S n) O u) t3)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl +n c2 (CHead e (Bind Abst) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: +T).(ty3 g e u t)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(pc3 c2 (lift (S n) O u) t3)))) (\lambda (e: C).(\lambda +(u: T).(\lambda (_: T).(getl n c2 (CHead e (Bind Abst) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t)))) P (\lambda (x3: +C).(\lambda (x4: T).(\lambda (x5: T).(\lambda (H7: (pc3 c2 (lift (S n) O x4) +t3)).(\lambda (H8: (getl n c2 (CHead x3 (Bind Abst) x4))).(\lambda (H9: (ty3 +g x3 x4 x5)).(let H10 \def (eq_ind C (CHead x0 (Bind x1) x2) (\lambda (c0: +C).(getl n c2 c0)) H2 (CHead x3 (Bind Abst) x4) (getl_mono c2 (CHead x0 (Bind +x1) x2) n H2 (CHead x3 (Bind Abst) x4) H8)) in (let H11 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow x0 | (CHead c0 _ _) \Rightarrow c0])) (CHead x0 (Bind x1) x2) +(CHead x3 (Bind Abst) x4) (getl_mono c2 (CHead x0 (Bind x1) x2) n H2 (CHead +x3 (Bind Abst) x4) H8)) in ((let H12 \def (f_equal C B (\lambda (e: C).(match +e in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow x1 | (CHead _ k +_) \Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow x1])])) (CHead x0 (Bind x1) x2) (CHead +x3 (Bind Abst) x4) (getl_mono c2 (CHead x0 (Bind x1) x2) n H2 (CHead x3 (Bind +Abst) x4) H8)) in ((let H13 \def (f_equal C T (\lambda (e: C).(match e in C +return (\lambda (_: C).T) with [(CSort _) \Rightarrow x2 | (CHead _ _ t) +\Rightarrow t])) (CHead x0 (Bind x1) x2) (CHead x3 (Bind Abst) x4) (getl_mono +c2 (CHead x0 (Bind x1) x2) n H2 (CHead x3 (Bind Abst) x4) H8)) in (\lambda +(_: (eq B x1 Abst)).(\lambda (H15: (eq C x0 x3)).(let H16 \def (eq_ind_r T x4 +(\lambda (t: T).(getl n c2 (CHead x3 (Bind Abst) t))) H10 x2 H13) in (let H17 +\def (eq_ind_r T x4 (\lambda (t: T).(ty3 g x3 t x5)) H9 x2 H13) in (let H18 +\def (eq_ind_r T x4 (\lambda (t: T).(pc3 c2 (lift (S n) O t) t3)) H7 x2 H13) +in (let H19 \def (eq_ind_r C x3 (\lambda (c0: C).(getl n c2 (CHead c0 (Bind +Abst) x2))) H16 x0 H15) in (let H20 \def (eq_ind_r C x3 (\lambda (c0: C).(ty3 +g c0 x2 x5)) H17 x0 H15) in (H4 x5 H20 P))))))))) H12)) H11))))))))) H6)) +(ty3_gen_lref g c2 t3 n H5))))))) H3)))))) H1)) (\lambda (H1: ((\forall (d: +C).((getl n c2 d) \to (\forall (P: Prop).P))))).(or_intror (ex T (\lambda +(t3: T).(ty3 g c2 (TLRef n) t3))) (\forall (t3: T).((ty3 g c2 (TLRef n) t3) +\to (\forall (P: Prop).P))) (\lambda (t3: T).(\lambda (H2: (ty3 g c2 (TLRef +n) t3)).(\lambda (P: Prop).(or_ind (ex3_3 C T T (\lambda (_: C).(\lambda (_: +T).(\lambda (t: T).(pc3 c2 (lift (S n) O t) t3)))) (\lambda (e: C).(\lambda +(u: T).(\lambda (_: T).(getl n c2 (CHead e (Bind Abbr) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t))))) (ex3_3 C T T (\lambda +(_: C).(\lambda (u: T).(\lambda (_: T).(pc3 c2 (lift (S n) O u) t3)))) +(\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl n c2 (CHead e (Bind +Abst) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u +t))))) P (\lambda (H3: (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda +(t: T).(pc3 c2 (lift (S n) O t) t3)))) (\lambda (e: C).(\lambda (u: +T).(\lambda (_: T).(getl n c2 (CHead e (Bind Abbr) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t)))))).(ex3_3_ind C T T +(\lambda (_: C).(\lambda (_: T).(\lambda (t: T).(pc3 c2 (lift (S n) O t) +t3)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl n c2 (CHead e +(Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u +t)))) P (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: T).(\lambda (_: (pc3 +c2 (lift (S n) O x2) t3)).(\lambda (H5: (getl n c2 (CHead x0 (Bind Abbr) +x1))).(\lambda (_: (ty3 g x0 x1 x2)).(H1 (CHead x0 (Bind Abbr) x1) H5 +P))))))) H3)) (\lambda (H3: (ex3_3 C T T (\lambda (_: C).(\lambda (u: +T).(\lambda (_: T).(pc3 c2 (lift (S n) O u) t3)))) (\lambda (e: C).(\lambda +(u: T).(\lambda (_: T).(getl n c2 (CHead e (Bind Abst) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t)))))).(ex3_3_ind C T T +(\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(pc3 c2 (lift (S n) O u) +t3)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl n c2 (CHead e +(Bind Abst) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u +t)))) P (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: T).(\lambda (_: (pc3 +c2 (lift (S n) O x1) t3)).(\lambda (H5: (getl n c2 (CHead x0 (Bind Abst) +x1))).(\lambda (_: (ty3 g x0 x1 x2)).(H1 (CHead x0 (Bind Abst) x1) H5 +P))))))) H3)) (ty3_gen_lref g c2 t3 n H2))))))) H0))))) (\lambda (k: +K).(\lambda (t: T).(\lambda (_: ((((\forall (c1: C).(\forall (t3: T).((flt c1 +t3 c2 t) \to (or (ex T (\lambda (t4: T).(ty3 g c1 t3 t4))) (\forall (t4: +T).((ty3 g c1 t3 t4) \to (\forall (P: Prop).P)))))))) \to (or (ex T (\lambda +(t3: T).(ty3 g c2 t t3))) (\forall (t3: T).((ty3 g c2 t t3) \to (\forall (P: +Prop).P))))))).(\lambda (t0: T).(\lambda (_: ((((\forall (c1: C).(\forall +(t3: T).((flt c1 t3 c2 t0) \to (or (ex T (\lambda (t4: T).(ty3 g c1 t3 t4))) +(\forall (t4: T).((ty3 g c1 t3 t4) \to (\forall (P: Prop).P)))))))) \to (or +(ex T (\lambda (t3: T).(ty3 g c2 t0 t3))) (\forall (t3: T).((ty3 g c2 t0 t3) +\to (\forall (P: Prop).P))))))).(\lambda (H1: ((\forall (c1: C).(\forall (t3: +T).((flt c1 t3 c2 (THead k t t0)) \to (or (ex T (\lambda (t4: T).(ty3 g c1 t3 +t4))) (\forall (t4: T).((ty3 g c1 t3 t4) \to (\forall (P: +Prop).P))))))))).(K_ind (\lambda (k0: K).(((\forall (c1: C).(\forall (t3: +T).((flt c1 t3 c2 (THead k0 t t0)) \to (or (ex T (\lambda (t4: T).(ty3 g c1 +t3 t4))) (\forall (t4: T).((ty3 g c1 t3 t4) \to (\forall (P: Prop).P)))))))) +\to (or (ex T (\lambda (t3: T).(ty3 g c2 (THead k0 t t0) t3))) (\forall (t3: +T).((ty3 g c2 (THead k0 t t0) t3) \to (\forall (P: Prop).P)))))) (\lambda (b: +B).(\lambda (H2: ((\forall (c1: C).(\forall (t3: T).((flt c1 t3 c2 (THead +(Bind b) t t0)) \to (or (ex T (\lambda (t4: T).(ty3 g c1 t3 t4))) (\forall +(t4: T).((ty3 g c1 t3 t4) \to (\forall (P: Prop).P))))))))).(let H3 \def (H2 +c2 t (flt_thead_sx (Bind b) c2 t t0)) in (or_ind (ex T (\lambda (t3: T).(ty3 +g c2 t t3))) (\forall (t3: T).((ty3 g c2 t t3) \to (\forall (P: Prop).P))) +(or (ex T (\lambda (t3: T).(ty3 g c2 (THead (Bind b) t t0) t3))) (\forall +(t3: T).((ty3 g c2 (THead (Bind b) t t0) t3) \to (\forall (P: Prop).P)))) +(\lambda (H4: (ex T (\lambda (t3: T).(ty3 g c2 t t3)))).(ex_ind T (\lambda +(t3: T).(ty3 g c2 t t3)) (or (ex T (\lambda (t3: T).(ty3 g c2 (THead (Bind b) +t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Bind b) t t0) t3) \to +(\forall (P: Prop).P)))) (\lambda (x: T).(\lambda (H5: (ty3 g c2 t x)).(let +H6 \def (H2 (CHead c2 (Bind b) t) t0 (flt_shift (Bind b) c2 t t0)) in (or_ind +(ex T (\lambda (t3: T).(ty3 g (CHead c2 (Bind b) t) t0 t3))) (\forall (t3: +T).((ty3 g (CHead c2 (Bind b) t) t0 t3) \to (\forall (P: Prop).P))) (or (ex T +(\lambda (t3: T).(ty3 g c2 (THead (Bind b) t t0) t3))) (\forall (t3: T).((ty3 +g c2 (THead (Bind b) t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (H7: (ex +T (\lambda (t3: T).(ty3 g (CHead c2 (Bind b) t) t0 t3)))).(ex_ind T (\lambda +(t3: T).(ty3 g (CHead c2 (Bind b) t) t0 t3)) (or (ex T (\lambda (t3: T).(ty3 +g c2 (THead (Bind b) t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Bind b) +t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (x0: T).(\lambda (H8: (ty3 g +(CHead c2 (Bind b) t) t0 x0)).(ex_ind T (\lambda (t3: T).(ty3 g (CHead c2 +(Bind b) t) x0 t3)) (or (ex T (\lambda (t3: T).(ty3 g c2 (THead (Bind b) t +t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Bind b) t t0) t3) \to (\forall +(P: Prop).P)))) (\lambda (x1: T).(\lambda (H9: (ty3 g (CHead c2 (Bind b) t) +x0 x1)).(or_introl (ex T (\lambda (t3: T).(ty3 g c2 (THead (Bind b) t t0) +t3))) (\forall (t3: T).((ty3 g c2 (THead (Bind b) t t0) t3) \to (\forall (P: +Prop).P))) (ex_intro T (\lambda (t3: T).(ty3 g c2 (THead (Bind b) t t0) t3)) +(THead (Bind b) t x0) (ty3_bind g c2 t x H5 b t0 x0 H8 x1 H9))))) +(ty3_correct g (CHead c2 (Bind b) t) t0 x0 H8)))) H7)) (\lambda (H7: +((\forall (t3: T).((ty3 g (CHead c2 (Bind b) t) t0 t3) \to (\forall (P: +Prop).P))))).(or_intror (ex T (\lambda (t3: T).(ty3 g c2 (THead (Bind b) t +t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Bind b) t t0) t3) \to (\forall +(P: Prop).P))) (\lambda (t3: T).(\lambda (H8: (ty3 g c2 (THead (Bind b) t t0) +t3)).(\lambda (P: Prop).(ex4_3_ind T T T (\lambda (t4: T).(\lambda (_: +T).(\lambda (_: T).(pc3 c2 (THead (Bind b) t t4) t3)))) (\lambda (_: +T).(\lambda (t5: T).(\lambda (_: T).(ty3 g c2 t t5)))) (\lambda (t4: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c2 (Bind b) t) t0 t4)))) +(\lambda (t4: T).(\lambda (_: T).(\lambda (t6: T).(ty3 g (CHead c2 (Bind b) +t) t4 t6)))) P (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: T).(\lambda +(_: (pc3 c2 (THead (Bind b) t x0) t3)).(\lambda (_: (ty3 g c2 t x1)).(\lambda +(H11: (ty3 g (CHead c2 (Bind b) t) t0 x0)).(\lambda (_: (ty3 g (CHead c2 +(Bind b) t) x0 x2)).(H7 x0 H11 P)))))))) (ty3_gen_bind g b c2 t t0 t3 +H8))))))) H6)))) H4)) (\lambda (H4: ((\forall (t3: T).((ty3 g c2 t t3) \to +(\forall (P: Prop).P))))).(or_intror (ex T (\lambda (t3: T).(ty3 g c2 (THead +(Bind b) t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Bind b) t t0) t3) +\to (\forall (P: Prop).P))) (\lambda (t3: T).(\lambda (H5: (ty3 g c2 (THead +(Bind b) t t0) t3)).(\lambda (P: Prop).(ex4_3_ind T T T (\lambda (t4: +T).(\lambda (_: T).(\lambda (_: T).(pc3 c2 (THead (Bind b) t t4) t3)))) +(\lambda (_: T).(\lambda (t5: T).(\lambda (_: T).(ty3 g c2 t t5)))) (\lambda +(t4: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c2 (Bind b) t) t0 +t4)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (t6: T).(ty3 g (CHead c2 +(Bind b) t) t4 t6)))) P (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: +T).(\lambda (_: (pc3 c2 (THead (Bind b) t x0) t3)).(\lambda (H7: (ty3 g c2 t +x1)).(\lambda (_: (ty3 g (CHead c2 (Bind b) t) t0 x0)).(\lambda (_: (ty3 g +(CHead c2 (Bind b) t) x0 x2)).(H4 x1 H7 P)))))))) (ty3_gen_bind g b c2 t t0 +t3 H5))))))) H3)))) (\lambda (f: F).(\lambda (H2: ((\forall (c1: C).(\forall +(t3: T).((flt c1 t3 c2 (THead (Flat f) t t0)) \to (or (ex T (\lambda (t4: +T).(ty3 g c1 t3 t4))) (\forall (t4: T).((ty3 g c1 t3 t4) \to (\forall (P: +Prop).P))))))))).(F_ind (\lambda (f0: F).(((\forall (c1: C).(\forall (t3: +T).((flt c1 t3 c2 (THead (Flat f0) t t0)) \to (or (ex T (\lambda (t4: T).(ty3 +g c1 t3 t4))) (\forall (t4: T).((ty3 g c1 t3 t4) \to (\forall (P: +Prop).P)))))))) \to (or (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat f0) t +t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat f0) t t0) t3) \to (\forall +(P: Prop).P)))))) (\lambda (H3: ((\forall (c1: C).(\forall (t3: T).((flt c1 +t3 c2 (THead (Flat Appl) t t0)) \to (or (ex T (\lambda (t4: T).(ty3 g c1 t3 +t4))) (\forall (t4: T).((ty3 g c1 t3 t4) \to (\forall (P: +Prop).P))))))))).(let H4 \def (H3 c2 t (flt_thead_sx (Flat Appl) c2 t t0)) in +(or_ind (ex T (\lambda (t3: T).(ty3 g c2 t t3))) (\forall (t3: T).((ty3 g c2 +t t3) \to (\forall (P: Prop).P))) (or (ex T (\lambda (t3: T).(ty3 g c2 (THead +(Flat Appl) t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Appl) t t0) +t3) \to (\forall (P: Prop).P)))) (\lambda (H5: (ex T (\lambda (t3: T).(ty3 g +c2 t t3)))).(ex_ind T (\lambda (t3: T).(ty3 g c2 t t3)) (or (ex T (\lambda +(t3: T).(ty3 g c2 (THead (Flat Appl) t t0) t3))) (\forall (t3: T).((ty3 g c2 +(THead (Flat Appl) t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (x: +T).(\lambda (H6: (ty3 g c2 t x)).(let H7 \def (H3 c2 t0 (flt_thead_dx (Flat +Appl) c2 t t0)) in (or_ind (ex T (\lambda (t3: T).(ty3 g c2 t0 t3))) (\forall +(t3: T).((ty3 g c2 t0 t3) \to (\forall (P: Prop).P))) (or (ex T (\lambda (t3: +T).(ty3 g c2 (THead (Flat Appl) t t0) t3))) (\forall (t3: T).((ty3 g c2 +(THead (Flat Appl) t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (H8: (ex T +(\lambda (t3: T).(ty3 g c2 t0 t3)))).(ex_ind T (\lambda (t3: T).(ty3 g c2 t0 +t3)) (or (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Appl) t t0) t3))) +(\forall (t3: T).((ty3 g c2 (THead (Flat Appl) t t0) t3) \to (\forall (P: +Prop).P)))) (\lambda (x0: T).(\lambda (H9: (ty3 g c2 t0 x0)).(ex_ind T +(\lambda (t3: T).(ty3 g c2 x0 t3)) (or (ex T (\lambda (t3: T).(ty3 g c2 +(THead (Flat Appl) t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Appl) +t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (x1: T).(\lambda (H10: (ty3 g +c2 x0 x1)).(ex_ind T (\lambda (t3: T).(ty3 g c2 x t3)) (or (ex T (\lambda +(t3: T).(ty3 g c2 (THead (Flat Appl) t t0) t3))) (\forall (t3: T).((ty3 g c2 +(THead (Flat Appl) t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (x2: +T).(\lambda (H11: (ty3 g c2 x x2)).(let H12 \def (ty3_sn3 g c2 x x2 H11) in +(let H_x \def (nf2_sn3 c2 x H12) in (let H13 \def H_x in (ex2_ind T (\lambda +(u: T).(pr3 c2 x u)) (\lambda (u: T).(nf2 c2 u)) (or (ex T (\lambda (t3: +T).(ty3 g c2 (THead (Flat Appl) t t0) t3))) (\forall (t3: T).((ty3 g c2 +(THead (Flat Appl) t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (x3: +T).(\lambda (H14: (pr3 c2 x x3)).(\lambda (H15: (nf2 c2 x3)).(let H16 \def +(ty3_sred_pr3 c2 x x3 H14 g x2 H11) in (let H_x0 \def (pc3_abst_dec g c2 x0 +x1 H10 x3 x2 H16) in (let H17 \def H_x0 in (or_ind (ex4_2 T T (\lambda (u: +T).(\lambda (_: T).(pc3 c2 x0 (THead (Bind Abst) x3 u)))) (\lambda (u: +T).(\lambda (v2: T).(ty3 g c2 (THead (Bind Abst) v2 u) x1))) (\lambda (_: +T).(\lambda (v2: T).(pr3 c2 x3 v2))) (\lambda (_: T).(\lambda (v2: T).(nf2 c2 +v2)))) (\forall (u: T).((pc3 c2 x0 (THead (Bind Abst) x3 u)) \to (\forall (P: +Prop).P))) (or (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Appl) t t0) +t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Appl) t t0) t3) \to (\forall +(P: Prop).P)))) (\lambda (H18: (ex4_2 T T (\lambda (u: T).(\lambda (_: +T).(pc3 c2 x0 (THead (Bind Abst) x3 u)))) (\lambda (u: T).(\lambda (v2: +T).(ty3 g c2 (THead (Bind Abst) v2 u) x1))) (\lambda (_: T).(\lambda (v2: +T).(pr3 c2 x3 v2))) (\lambda (_: T).(\lambda (v2: T).(nf2 c2 +v2))))).(ex4_2_ind T T (\lambda (u: T).(\lambda (_: T).(pc3 c2 x0 (THead +(Bind Abst) x3 u)))) (\lambda (u: T).(\lambda (v2: T).(ty3 g c2 (THead (Bind +Abst) v2 u) x1))) (\lambda (_: T).(\lambda (v2: T).(pr3 c2 x3 v2))) (\lambda +(_: T).(\lambda (v2: T).(nf2 c2 v2))) (or (ex T (\lambda (t3: T).(ty3 g c2 +(THead (Flat Appl) t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Appl) +t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (x4: T).(\lambda (x5: +T).(\lambda (H19: (pc3 c2 x0 (THead (Bind Abst) x3 x4))).(\lambda (H20: (ty3 +g c2 (THead (Bind Abst) x5 x4) x1)).(\lambda (H21: (pr3 c2 x3 x5)).(\lambda +(_: (nf2 c2 x5)).(let H_y \def (nf2_pr3_unfold c2 x3 x5 H21 H15) in (let H23 +\def (eq_ind_r T x5 (\lambda (t3: T).(pr3 c2 x3 t3)) H21 x3 H_y) in (let H24 +\def (eq_ind_r T x5 (\lambda (t3: T).(ty3 g c2 (THead (Bind Abst) t3 x4) x1)) +H20 x3 H_y) in (or_introl (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Appl) +t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Appl) t t0) t3) \to +(\forall (P: Prop).P))) (ex_intro T (\lambda (t3: T).(ty3 g c2 (THead (Flat +Appl) t t0) t3)) (THead (Flat Appl) t (THead (Bind Abst) x3 x4)) (ty3_appl g +c2 t x3 (ty3_tred g c2 t x H6 x3 H14) t0 x4 (ty3_conv g c2 (THead (Bind Abst) +x3 x4) x1 H24 t0 x0 H9 H19))))))))))))) H18)) (\lambda (H18: ((\forall (u: +T).((pc3 c2 x0 (THead (Bind Abst) x3 u)) \to (\forall (P: +Prop).P))))).(or_intror (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Appl) t +t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Appl) t t0) t3) \to +(\forall (P: Prop).P))) (\lambda (t3: T).(\lambda (H19: (ty3 g c2 (THead +(Flat Appl) t t0) t3)).(\lambda (P: Prop).(ex3_2_ind T T (\lambda (u: +T).(\lambda (t4: T).(pc3 c2 (THead (Flat Appl) t (THead (Bind Abst) u t4)) +t3))) (\lambda (u: T).(\lambda (t4: T).(ty3 g c2 t0 (THead (Bind Abst) u +t4)))) (\lambda (u: T).(\lambda (_: T).(ty3 g c2 t u))) P (\lambda (x4: +T).(\lambda (x5: T).(\lambda (_: (pc3 c2 (THead (Flat Appl) t (THead (Bind +Abst) x4 x5)) t3)).(\lambda (H21: (ty3 g c2 t0 (THead (Bind Abst) x4 +x5))).(\lambda (H22: (ty3 g c2 t x4)).(let H_y \def (ty3_unique g c2 t x4 H22 +x H6) in (let H_y0 \def (ty3_unique g c2 t0 (THead (Bind Abst) x4 x5) H21 x0 +H9) in (H18 x5 (pc3_t (THead (Bind Abst) x4 x5) c2 x0 (pc3_s c2 x0 (THead +(Bind Abst) x4 x5) H_y0) (THead (Bind Abst) x3 x5) (pc3_head_1 c2 x4 x3 +(pc3_t x c2 x4 H_y x3 (pc3_pr3_r c2 x x3 H14)) (Bind Abst) x5)) P)))))))) +(ty3_gen_appl g c2 t t0 t3 H19))))))) H17))))))) H13)))))) (ty3_correct g c2 +t x H6)))) (ty3_correct g c2 t0 x0 H9)))) H8)) (\lambda (H8: ((\forall (t3: +T).((ty3 g c2 t0 t3) \to (\forall (P: Prop).P))))).(or_intror (ex T (\lambda +(t3: T).(ty3 g c2 (THead (Flat Appl) t t0) t3))) (\forall (t3: T).((ty3 g c2 +(THead (Flat Appl) t t0) t3) \to (\forall (P: Prop).P))) (\lambda (t3: +T).(\lambda (H9: (ty3 g c2 (THead (Flat Appl) t t0) t3)).(\lambda (P: +Prop).(ex3_2_ind T T (\lambda (u: T).(\lambda (t4: T).(pc3 c2 (THead (Flat +Appl) t (THead (Bind Abst) u t4)) t3))) (\lambda (u: T).(\lambda (t4: T).(ty3 +g c2 t0 (THead (Bind Abst) u t4)))) (\lambda (u: T).(\lambda (_: T).(ty3 g c2 +t u))) P (\lambda (x0: T).(\lambda (x1: T).(\lambda (_: (pc3 c2 (THead (Flat +Appl) t (THead (Bind Abst) x0 x1)) t3)).(\lambda (H11: (ty3 g c2 t0 (THead +(Bind Abst) x0 x1))).(\lambda (_: (ty3 g c2 t x0)).(H8 (THead (Bind Abst) x0 +x1) H11 P)))))) (ty3_gen_appl g c2 t t0 t3 H9))))))) H7)))) H5)) (\lambda +(H5: ((\forall (t3: T).((ty3 g c2 t t3) \to (\forall (P: +Prop).P))))).(or_intror (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Appl) t +t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Appl) t t0) t3) \to +(\forall (P: Prop).P))) (\lambda (t3: T).(\lambda (H6: (ty3 g c2 (THead (Flat +Appl) t t0) t3)).(\lambda (P: Prop).(ex3_2_ind T T (\lambda (u: T).(\lambda +(t4: T).(pc3 c2 (THead (Flat Appl) t (THead (Bind Abst) u t4)) t3))) (\lambda +(u: T).(\lambda (t4: T).(ty3 g c2 t0 (THead (Bind Abst) u t4)))) (\lambda (u: +T).(\lambda (_: T).(ty3 g c2 t u))) P (\lambda (x0: T).(\lambda (x1: +T).(\lambda (_: (pc3 c2 (THead (Flat Appl) t (THead (Bind Abst) x0 x1)) +t3)).(\lambda (_: (ty3 g c2 t0 (THead (Bind Abst) x0 x1))).(\lambda (H9: (ty3 +g c2 t x0)).(H5 x0 H9 P)))))) (ty3_gen_appl g c2 t t0 t3 H6))))))) H4))) +(\lambda (H3: ((\forall (c1: C).(\forall (t3: T).((flt c1 t3 c2 (THead (Flat +Cast) t t0)) \to (or (ex T (\lambda (t4: T).(ty3 g c1 t3 t4))) (\forall (t4: +T).((ty3 g c1 t3 t4) \to (\forall (P: Prop).P))))))))).(let H4 \def (H3 c2 t +(flt_thead_sx (Flat Cast) c2 t t0)) in (or_ind (ex T (\lambda (t3: T).(ty3 g +c2 t t3))) (\forall (t3: T).((ty3 g c2 t t3) \to (\forall (P: Prop).P))) (or +(ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Cast) t t0) t3))) (\forall (t3: +T).((ty3 g c2 (THead (Flat Cast) t t0) t3) \to (\forall (P: Prop).P)))) +(\lambda (H5: (ex T (\lambda (t3: T).(ty3 g c2 t t3)))).(ex_ind T (\lambda +(t3: T).(ty3 g c2 t t3)) (or (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat +Cast) t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Cast) t t0) t3) +\to (\forall (P: Prop).P)))) (\lambda (x: T).(\lambda (H6: (ty3 g c2 t +x)).(let H7 \def (H3 c2 t0 (flt_thead_dx (Flat Cast) c2 t t0)) in (or_ind (ex +T (\lambda (t3: T).(ty3 g c2 t0 t3))) (\forall (t3: T).((ty3 g c2 t0 t3) \to +(\forall (P: Prop).P))) (or (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat +Cast) t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Cast) t t0) t3) +\to (\forall (P: Prop).P)))) (\lambda (H8: (ex T (\lambda (t3: T).(ty3 g c2 +t0 t3)))).(ex_ind T (\lambda (t3: T).(ty3 g c2 t0 t3)) (or (ex T (\lambda +(t3: T).(ty3 g c2 (THead (Flat Cast) t t0) t3))) (\forall (t3: T).((ty3 g c2 +(THead (Flat Cast) t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (x0: +T).(\lambda (H9: (ty3 g c2 t0 x0)).(ex_ind T (\lambda (t3: T).(ty3 g c2 x0 +t3)) (or (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Cast) t t0) t3))) +(\forall (t3: T).((ty3 g c2 (THead (Flat Cast) t t0) t3) \to (\forall (P: +Prop).P)))) (\lambda (x1: T).(\lambda (H10: (ty3 g c2 x0 x1)).(let H_x \def +(pc3_dec g c2 x0 x1 H10 t x H6) in (let H11 \def H_x in (or_ind (pc3 c2 x0 t) +((pc3 c2 x0 t) \to (\forall (P: Prop).P)) (or (ex T (\lambda (t3: T).(ty3 g +c2 (THead (Flat Cast) t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat +Cast) t t0) t3) \to (\forall (P: Prop).P)))) (\lambda (H12: (pc3 c2 x0 +t)).(or_introl (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Cast) t t0) +t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Cast) t t0) t3) \to (\forall +(P: Prop).P))) (ex_intro T (\lambda (t3: T).(ty3 g c2 (THead (Flat Cast) t +t0) t3)) (THead (Flat Cast) x t) (ty3_cast g c2 t0 t (ty3_conv g c2 t x H6 t0 +x0 H9 H12) x H6)))) (\lambda (H12: (((pc3 c2 x0 t) \to (\forall (P: +Prop).P)))).(or_intror (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Cast) t +t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Cast) t t0) t3) \to +(\forall (P: Prop).P))) (\lambda (t3: T).(\lambda (H13: (ty3 g c2 (THead +(Flat Cast) t t0) t3)).(\lambda (P: Prop).(ex3_ind T (\lambda (t4: T).(pc3 c2 +(THead (Flat Cast) t4 t) t3)) (\lambda (_: T).(ty3 g c2 t0 t)) (\lambda (t4: +T).(ty3 g c2 t t4)) P (\lambda (x2: T).(\lambda (_: (pc3 c2 (THead (Flat +Cast) x2 t) t3)).(\lambda (H15: (ty3 g c2 t0 t)).(\lambda (H16: (ty3 g c2 t +x2)).(let H_y \def (ty3_unique g c2 t x2 H16 x H6) in (let H_y0 \def +(ty3_unique g c2 t0 t H15 x0 H9) in (H12 (ex2_sym T (pr3 c2 t) (pr3 c2 x0) +H_y0) P))))))) (ty3_gen_cast g c2 t0 t t3 H13))))))) H11))))) (ty3_correct g +c2 t0 x0 H9)))) H8)) (\lambda (H8: ((\forall (t3: T).((ty3 g c2 t0 t3) \to +(\forall (P: Prop).P))))).(or_intror (ex T (\lambda (t3: T).(ty3 g c2 (THead +(Flat Cast) t t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Cast) t t0) +t3) \to (\forall (P: Prop).P))) (\lambda (t3: T).(\lambda (H9: (ty3 g c2 +(THead (Flat Cast) t t0) t3)).(\lambda (P: Prop).(ex3_ind T (\lambda (t4: +T).(pc3 c2 (THead (Flat Cast) t4 t) t3)) (\lambda (_: T).(ty3 g c2 t0 t)) +(\lambda (t4: T).(ty3 g c2 t t4)) P (\lambda (x0: T).(\lambda (_: (pc3 c2 +(THead (Flat Cast) x0 t) t3)).(\lambda (H11: (ty3 g c2 t0 t)).(\lambda (_: +(ty3 g c2 t x0)).(H8 t H11 P))))) (ty3_gen_cast g c2 t0 t t3 H9))))))) H7)))) +H5)) (\lambda (H5: ((\forall (t3: T).((ty3 g c2 t t3) \to (\forall (P: +Prop).P))))).(or_intror (ex T (\lambda (t3: T).(ty3 g c2 (THead (Flat Cast) t +t0) t3))) (\forall (t3: T).((ty3 g c2 (THead (Flat Cast) t t0) t3) \to +(\forall (P: Prop).P))) (\lambda (t3: T).(\lambda (H6: (ty3 g c2 (THead (Flat +Cast) t t0) t3)).(\lambda (P: Prop).(ex3_ind T (\lambda (t4: T).(pc3 c2 +(THead (Flat Cast) t4 t) t3)) (\lambda (_: T).(ty3 g c2 t0 t)) (\lambda (t4: +T).(ty3 g c2 t t4)) P (\lambda (x0: T).(\lambda (_: (pc3 c2 (THead (Flat +Cast) x0 t) t3)).(\lambda (_: (ty3 g c2 t0 t)).(\lambda (H9: (ty3 g c2 t +x0)).(ex_ind T (\lambda (t4: T).(ty3 g c2 x0 t4)) P (\lambda (x: T).(\lambda +(_: (ty3 g c2 x0 x)).(H5 x0 H9 P))) (ty3_correct g c2 t x0 H9)))))) +(ty3_gen_cast g c2 t0 t t3 H6))))))) H4))) f H2))) k H1))))))) t2))) c t1))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/defs.ma new file mode 100644 index 000000000..eff4d8e7b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/defs.ma @@ -0,0 +1,46 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/defs". + +include "G/defs.ma". + +include "pc3/defs.ma". + +inductive ty3 (g: G): C \to (T \to (T \to Prop)) \def +| ty3_conv: \forall (c: C).(\forall (t2: T).(\forall (t: T).((ty3 g c t2 t) +\to (\forall (u: T).(\forall (t1: T).((ty3 g c u t1) \to ((pc3 c t1 t2) \to +(ty3 g c u t2)))))))) +| ty3_sort: \forall (c: C).(\forall (m: nat).(ty3 g c (TSort m) (TSort (next +g m)))) +| ty3_abbr: \forall (n: nat).(\forall (c: C).(\forall (d: C).(\forall (u: +T).((getl n c (CHead d (Bind Abbr) u)) \to (\forall (t: T).((ty3 g d u t) \to +(ty3 g c (TLRef n) (lift (S n) O t)))))))) +| ty3_abst: \forall (n: nat).(\forall (c: C).(\forall (d: C).(\forall (u: +T).((getl n c (CHead d (Bind Abst) u)) \to (\forall (t: T).((ty3 g d u t) \to +(ty3 g c (TLRef n) (lift (S n) O u)))))))) +| ty3_bind: \forall (c: C).(\forall (u: T).(\forall (t: T).((ty3 g c u t) \to +(\forall (b: B).(\forall (t1: T).(\forall (t2: T).((ty3 g (CHead c (Bind b) +u) t1 t2) \to (\forall (t0: T).((ty3 g (CHead c (Bind b) u) t2 t0) \to (ty3 g +c (THead (Bind b) u t1) (THead (Bind b) u t2))))))))))) +| ty3_appl: \forall (c: C).(\forall (w: T).(\forall (u: T).((ty3 g c w u) \to +(\forall (v: T).(\forall (t: T).((ty3 g c v (THead (Bind Abst) u t)) \to (ty3 +g c (THead (Flat Appl) w v) (THead (Flat Appl) w (THead (Bind Abst) u +t))))))))) +| ty3_cast: \forall (c: C).(\forall (t1: T).(\forall (t2: T).((ty3 g c t1 t2) +\to (\forall (t0: T).((ty3 g c t2 t0) \to (ty3 g c (THead (Flat Cast) t2 t1) +(THead (Flat Cast) t0 t2))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fsubst0.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fsubst0.ma new file mode 100644 index 000000000..1370b3d79 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fsubst0.ma @@ -0,0 +1,1009 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/fsubst0". + +include "ty3/props.ma". + +include "pc3/fsubst0.ma". + +include "csubst0/props.ma". + +include "getl/getl.ma". + +theorem ty3_fsubst0: + \forall (g: G).(\forall (c1: C).(\forall (t1: T).(\forall (t: T).((ty3 g c1 +t1 t) \to (\forall (i: nat).(\forall (u: T).(\forall (c2: C).(\forall (t2: +T).((fsubst0 i u c1 t1 c2 t2) \to (\forall (e: C).((getl i c1 (CHead e (Bind +Abbr) u)) \to (ty3 g c2 t2 t)))))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t1: T).(\lambda (t: T).(\lambda +(H: (ty3 g c1 t1 t)).(ty3_ind g (\lambda (c: C).(\lambda (t0: T).(\lambda +(t2: T).(\forall (i: nat).(\forall (u: T).(\forall (c2: C).(\forall (t3: +T).((fsubst0 i u c t0 c2 t3) \to (\forall (e: C).((getl i c (CHead e (Bind +Abbr) u)) \to (ty3 g c2 t3 t2))))))))))) (\lambda (c: C).(\lambda (t2: +T).(\lambda (t0: T).(\lambda (H0: (ty3 g c t2 t0)).(\lambda (H1: ((\forall +(i: nat).(\forall (u: T).(\forall (c2: C).(\forall (t3: T).((fsubst0 i u c t2 +c2 t3) \to (\forall (e: C).((getl i c (CHead e (Bind Abbr) u)) \to (ty3 g c2 +t3 t0)))))))))).(\lambda (u: T).(\lambda (t3: T).(\lambda (_: (ty3 g c u +t3)).(\lambda (H3: ((\forall (i: nat).(\forall (u0: T).(\forall (c2: +C).(\forall (t4: T).((fsubst0 i u0 c u c2 t4) \to (\forall (e: C).((getl i c +(CHead e (Bind Abbr) u0)) \to (ty3 g c2 t4 t3)))))))))).(\lambda (H4: (pc3 c +t3 t2)).(\lambda (i: nat).(\lambda (u0: T).(\lambda (c2: C).(\lambda (t4: +T).(\lambda (H5: (fsubst0 i u0 c u c2 t4)).(fsubst0_ind i u0 c u (\lambda +(c0: C).(\lambda (t5: T).(\forall (e: C).((getl i c (CHead e (Bind Abbr) u0)) +\to (ty3 g c0 t5 t2))))) (\lambda (t5: T).(\lambda (H6: (subst0 i u0 u +t5)).(\lambda (e: C).(\lambda (H7: (getl i c (CHead e (Bind Abbr) +u0))).(ty3_conv g c t2 t0 H0 t5 t3 (H3 i u0 c t5 (fsubst0_snd i u0 c u t5 H6) +e H7) H4))))) (\lambda (c3: C).(\lambda (H6: (csubst0 i u0 c c3)).(\lambda +(e: C).(\lambda (H7: (getl i c (CHead e (Bind Abbr) u0))).(ty3_conv g c3 t2 +t0 (H1 i u0 c3 t2 (fsubst0_fst i u0 c t2 c3 H6) e H7) u t3 (H3 i u0 c3 u +(fsubst0_fst i u0 c u c3 H6) e H7) (pc3_fsubst0 c t3 t2 H4 i u0 c3 t3 +(fsubst0_fst i u0 c t3 c3 H6) e H7)))))) (\lambda (t5: T).(\lambda (H6: +(subst0 i u0 u t5)).(\lambda (c3: C).(\lambda (H7: (csubst0 i u0 c +c3)).(\lambda (e: C).(\lambda (H8: (getl i c (CHead e (Bind Abbr) +u0))).(ty3_conv g c3 t2 t0 (H1 i u0 c3 t2 (fsubst0_fst i u0 c t2 c3 H7) e H8) +t5 t3 (H3 i u0 c3 t5 (fsubst0_both i u0 c u t5 H6 c3 H7) e H8) (pc3_fsubst0 c +t3 t2 H4 i u0 c3 t3 (fsubst0_fst i u0 c t3 c3 H7) e H8)))))))) c2 t4 +H5)))))))))))))))) (\lambda (c: C).(\lambda (m: nat).(\lambda (i: +nat).(\lambda (u: T).(\lambda (c2: C).(\lambda (t2: T).(\lambda (H0: (fsubst0 +i u c (TSort m) c2 t2)).(fsubst0_ind i u c (TSort m) (\lambda (c0: +C).(\lambda (t0: T).(\forall (e: C).((getl i c (CHead e (Bind Abbr) u)) \to +(ty3 g c0 t0 (TSort (next g m))))))) (\lambda (t3: T).(\lambda (H1: (subst0 i +u (TSort m) t3)).(\lambda (e: C).(\lambda (_: (getl i c (CHead e (Bind Abbr) +u))).(subst0_gen_sort u t3 i m H1 (ty3 g c t3 (TSort (next g m)))))))) +(\lambda (c3: C).(\lambda (_: (csubst0 i u c c3)).(\lambda (e: C).(\lambda +(_: (getl i c (CHead e (Bind Abbr) u))).(ty3_sort g c3 m))))) (\lambda (t3: +T).(\lambda (H1: (subst0 i u (TSort m) t3)).(\lambda (c3: C).(\lambda (_: +(csubst0 i u c c3)).(\lambda (e: C).(\lambda (_: (getl i c (CHead e (Bind +Abbr) u))).(subst0_gen_sort u t3 i m H1 (ty3 g c3 t3 (TSort (next g +m)))))))))) c2 t2 H0)))))))) (\lambda (n: nat).(\lambda (c: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (H0: (getl n c (CHead d (Bind Abbr) u))).(\lambda +(t0: T).(\lambda (H1: (ty3 g d u t0)).(\lambda (H2: ((\forall (i: +nat).(\forall (u0: T).(\forall (c2: C).(\forall (t2: T).((fsubst0 i u0 d u c2 +t2) \to (\forall (e: C).((getl i d (CHead e (Bind Abbr) u0)) \to (ty3 g c2 t2 +t0)))))))))).(\lambda (i: nat).(\lambda (u0: T).(\lambda (c2: C).(\lambda +(t2: T).(\lambda (H3: (fsubst0 i u0 c (TLRef n) c2 t2)).(fsubst0_ind i u0 c +(TLRef n) (\lambda (c0: C).(\lambda (t3: T).(\forall (e: C).((getl i c (CHead +e (Bind Abbr) u0)) \to (ty3 g c0 t3 (lift (S n) O t0)))))) (\lambda (t3: +T).(\lambda (H4: (subst0 i u0 (TLRef n) t3)).(\lambda (e: C).(\lambda (H5: +(getl i c (CHead e (Bind Abbr) u0))).(and_ind (eq nat n i) (eq T t3 (lift (S +n) O u0)) (ty3 g c t3 (lift (S n) O t0)) (\lambda (H6: (eq nat n i)).(\lambda +(H7: (eq T t3 (lift (S n) O u0))).(eq_ind_r T (lift (S n) O u0) (\lambda (t4: +T).(ty3 g c t4 (lift (S n) O t0))) (let H8 \def (eq_ind_r nat i (\lambda (n0: +nat).(getl n0 c (CHead e (Bind Abbr) u0))) H5 n H6) in (let H9 \def (eq_ind C +(CHead d (Bind Abbr) u) (\lambda (c0: C).(getl n c c0)) H0 (CHead e (Bind +Abbr) u0) (getl_mono c (CHead d (Bind Abbr) u) n H0 (CHead e (Bind Abbr) u0) +H8)) in (let H10 \def (f_equal C C (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) \Rightarrow +c0])) (CHead d (Bind Abbr) u) (CHead e (Bind Abbr) u0) (getl_mono c (CHead d +(Bind Abbr) u) n H0 (CHead e (Bind Abbr) u0) H8)) in ((let H11 \def (f_equal +C T (\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u | (CHead _ _ t4) \Rightarrow t4])) (CHead d (Bind Abbr) u) +(CHead e (Bind Abbr) u0) (getl_mono c (CHead d (Bind Abbr) u) n H0 (CHead e +(Bind Abbr) u0) H8)) in (\lambda (H12: (eq C d e)).(let H13 \def (eq_ind_r C +e (\lambda (c0: C).(getl n c (CHead c0 (Bind Abbr) u0))) H9 d H12) in (let +H14 \def (eq_ind_r T u0 (\lambda (t4: T).(getl n c (CHead d (Bind Abbr) t4))) +H13 u H11) in (eq_ind T u (\lambda (t4: T).(ty3 g c (lift (S n) O t4) (lift +(S n) O t0))) (ty3_lift g d u t0 H1 c O (S n) (getl_drop Abbr c d u n H14)) +u0 H11))))) H10)))) t3 H7))) (subst0_gen_lref u0 t3 i n H4)))))) (\lambda +(c3: C).(\lambda (H4: (csubst0 i u0 c c3)).(\lambda (e: C).(\lambda (H5: +(getl i c (CHead e (Bind Abbr) u0))).(lt_le_e n i (ty3 g c3 (TLRef n) (lift +(S n) O t0)) (\lambda (H6: (lt n i)).(let H7 \def (csubst0_getl_lt i n H6 c +c3 u0 H4 (CHead d (Bind Abbr) u) H0) in (or4_ind (getl n c3 (CHead d (Bind +Abbr) u)) (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e0 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c3 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 w)))))) (ex3_4 B C C T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C +(CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (u1: T).(getl n c3 (CHead e2 (Bind b) +u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: +T).(csubst0 (minus i (S n)) u0 e1 e2)))))) (ex4_5 B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C +(CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n c3 (CHead e2 +(Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 w)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) u0 e1 e2))))))) (ty3 g c3 (TLRef n) (lift (S n) O t0)) +(\lambda (H8: (getl n c3 (CHead d (Bind Abbr) u))).(ty3_abbr g n c3 d u H8 t0 +H1)) (\lambda (H8: (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda +(u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e0 (Bind b) +u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: +T).(getl n c3 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 +w))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(eq C (CHead d (Bind Abbr) u) (CHead e0 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c3 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 w))))) (ty3 g c3 (TLRef n) +(lift (S n) O t0)) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: +T).(\lambda (x3: T).(\lambda (H9: (eq C (CHead d (Bind Abbr) u) (CHead x1 +(Bind x0) x2))).(\lambda (H10: (getl n c3 (CHead x1 (Bind x0) x3))).(\lambda +(H11: (subst0 (minus i (S n)) u0 x2 x3)).(let H12 \def (f_equal C C (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow +d | (CHead c0 _ _) \Rightarrow c0])) (CHead d (Bind Abbr) u) (CHead x1 (Bind +x0) x2) H9) in ((let H13 \def (f_equal C B (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).B) with [(CSort _) \Rightarrow Abbr | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abbr])])) (CHead d (Bind Abbr) u) (CHead +x1 (Bind x0) x2) H9) in ((let H14 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t3) \Rightarrow t3])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x2) H9) in +(\lambda (H15: (eq B Abbr x0)).(\lambda (H16: (eq C d x1)).(let H17 \def +(eq_ind_r T x2 (\lambda (t3: T).(subst0 (minus i (S n)) u0 t3 x3)) H11 u H14) +in (let H18 \def (eq_ind_r C x1 (\lambda (c0: C).(getl n c3 (CHead c0 (Bind +x0) x3))) H10 d H16) in (let H19 \def (eq_ind_r B x0 (\lambda (b: B).(getl n +c3 (CHead d (Bind b) x3))) H18 Abbr H15) in (let H20 \def (eq_ind nat (minus +i n) (\lambda (n0: nat).(getl n0 (CHead d (Bind Abbr) x3) (CHead e (Bind +Abbr) u0))) (getl_conf_le i (CHead e (Bind Abbr) u0) c3 (csubst0_getl_ge i i +(le_n i) c c3 u0 H4 (CHead e (Bind Abbr) u0) H5) (CHead d (Bind Abbr) x3) n +H19 (le_S_n n i (le_S (S n) i H6))) (S (minus i (S n))) (minus_x_Sy i n H6)) +in (ty3_abbr g n c3 d x3 H19 t0 (H2 (minus i (S n)) u0 d x3 (fsubst0_snd +(minus i (S n)) u0 d u x3 H17) e (getl_gen_S (Bind Abbr) d (CHead e (Bind +Abbr) u0) x3 (minus i (S n)) H20)))))))))) H13)) H12))))))))) H8)) (\lambda +(H8: (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda +(u1: T).(eq C (CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda +(b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u1: T).(getl n c3 (CHead e2 +(Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) u0 e1 e2))))))).(ex3_4_ind B C C T (\lambda +(b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind +Abbr) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u1: T).(getl n c3 (CHead e2 (Bind b) u1)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +u0 e1 e2))))) (ty3 g c3 (TLRef n) (lift (S n) O t0)) (\lambda (x0: +B).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H9: (eq C +(CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3))).(\lambda (H10: (getl n c3 +(CHead x2 (Bind x0) x3))).(\lambda (H11: (csubst0 (minus i (S n)) u0 x1 +x2)).(let H12 \def (f_equal C C (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) \Rightarrow +c0])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H9) in ((let H13 \def +(f_equal C B (\lambda (e0: C).(match e0 in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abbr | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b) \Rightarrow b | (Flat _) \Rightarrow +Abbr])])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H9) in ((let H14 +\def (f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t3) \Rightarrow t3])) (CHead d +(Bind Abbr) u) (CHead x1 (Bind x0) x3) H9) in (\lambda (H15: (eq B Abbr +x0)).(\lambda (H16: (eq C d x1)).(let H17 \def (eq_ind_r T x3 (\lambda (t3: +T).(getl n c3 (CHead x2 (Bind x0) t3))) H10 u H14) in (let H18 \def (eq_ind_r +C x1 (\lambda (c0: C).(csubst0 (minus i (S n)) u0 c0 x2)) H11 d H16) in (let +H19 \def (eq_ind_r B x0 (\lambda (b: B).(getl n c3 (CHead x2 (Bind b) u))) +H17 Abbr H15) in (let H20 \def (eq_ind nat (minus i n) (\lambda (n0: +nat).(getl n0 (CHead x2 (Bind Abbr) u) (CHead e (Bind Abbr) u0))) +(getl_conf_le i (CHead e (Bind Abbr) u0) c3 (csubst0_getl_ge i i (le_n i) c +c3 u0 H4 (CHead e (Bind Abbr) u0) H5) (CHead x2 (Bind Abbr) u) n H19 (le_S_n +n i (le_S (S n) i H6))) (S (minus i (S n))) (minus_x_Sy i n H6)) in (ty3_abbr +g n c3 x2 u H19 t0 (H2 (minus i (S n)) u0 x2 u (fsubst0_fst (minus i (S n)) +u0 d u x2 H18) e (csubst0_getl_ge_back (minus i (S n)) (minus i (S n)) (le_n +(minus i (S n))) d x2 u0 H18 (CHead e (Bind Abbr) u0) (getl_gen_S (Bind Abbr) +x2 (CHead e (Bind Abbr) u0) u (minus i (S n)) H20))))))))))) H13)) +H12))))))))) H8)) (\lambda (H8: (ex4_5 B C C T T (\lambda (b: B).(\lambda +(e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind +Abbr) u) (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda (_: +C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n c3 (CHead e2 +(Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 w)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) u0 e1 e2)))))))).(ex4_5_ind B C C T T (\lambda (b: +B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(eq C +(CHead d (Bind Abbr) u) (CHead e1 (Bind b) u1))))))) (\lambda (b: B).(\lambda +(_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl n c3 (CHead e2 +(Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: C).(\lambda +(u1: T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 w)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (_: T).(csubst0 +(minus i (S n)) u0 e1 e2)))))) (ty3 g c3 (TLRef n) (lift (S n) O t0)) +(\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda +(x4: T).(\lambda (H9: (eq C (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) +x3))).(\lambda (H10: (getl n c3 (CHead x2 (Bind x0) x4))).(\lambda (H11: +(subst0 (minus i (S n)) u0 x3 x4)).(\lambda (H12: (csubst0 (minus i (S n)) u0 +x1 x2)).(let H13 \def (f_equal C C (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) \Rightarrow +c0])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H9) in ((let H14 \def +(f_equal C B (\lambda (e0: C).(match e0 in C return (\lambda (_: C).B) with +[(CSort _) \Rightarrow Abbr | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b) \Rightarrow b | (Flat _) \Rightarrow +Abbr])])) (CHead d (Bind Abbr) u) (CHead x1 (Bind x0) x3) H9) in ((let H15 +\def (f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t3) \Rightarrow t3])) (CHead d +(Bind Abbr) u) (CHead x1 (Bind x0) x3) H9) in (\lambda (H16: (eq B Abbr +x0)).(\lambda (H17: (eq C d x1)).(let H18 \def (eq_ind_r T x3 (\lambda (t3: +T).(subst0 (minus i (S n)) u0 t3 x4)) H11 u H15) in (let H19 \def (eq_ind_r C +x1 (\lambda (c0: C).(csubst0 (minus i (S n)) u0 c0 x2)) H12 d H17) in (let +H20 \def (eq_ind_r B x0 (\lambda (b: B).(getl n c3 (CHead x2 (Bind b) x4))) +H10 Abbr H16) in (let H21 \def (eq_ind nat (minus i n) (\lambda (n0: +nat).(getl n0 (CHead x2 (Bind Abbr) x4) (CHead e (Bind Abbr) u0))) +(getl_conf_le i (CHead e (Bind Abbr) u0) c3 (csubst0_getl_ge i i (le_n i) c +c3 u0 H4 (CHead e (Bind Abbr) u0) H5) (CHead x2 (Bind Abbr) x4) n H20 (le_S_n +n i (le_S (S n) i H6))) (S (minus i (S n))) (minus_x_Sy i n H6)) in (ty3_abbr +g n c3 x2 x4 H20 t0 (H2 (minus i (S n)) u0 x2 x4 (fsubst0_both (minus i (S +n)) u0 d u x4 H18 x2 H19) e (csubst0_getl_ge_back (minus i (S n)) (minus i (S +n)) (le_n (minus i (S n))) d x2 u0 H19 (CHead e (Bind Abbr) u0) (getl_gen_S +(Bind Abbr) x2 (CHead e (Bind Abbr) u0) x4 (minus i (S n)) H21))))))))))) +H14)) H13))))))))))) H8)) H7))) (\lambda (H6: (le i n)).(ty3_abbr g n c3 d u +(csubst0_getl_ge i n H6 c c3 u0 H4 (CHead d (Bind Abbr) u) H0) t0 H1))))))) +(\lambda (t3: T).(\lambda (H4: (subst0 i u0 (TLRef n) t3)).(\lambda (c3: +C).(\lambda (H5: (csubst0 i u0 c c3)).(\lambda (e: C).(\lambda (H6: (getl i c +(CHead e (Bind Abbr) u0))).(and_ind (eq nat n i) (eq T t3 (lift (S n) O u0)) +(ty3 g c3 t3 (lift (S n) O t0)) (\lambda (H7: (eq nat n i)).(\lambda (H8: (eq +T t3 (lift (S n) O u0))).(eq_ind_r T (lift (S n) O u0) (\lambda (t4: T).(ty3 +g c3 t4 (lift (S n) O t0))) (let H9 \def (eq_ind_r nat i (\lambda (n0: +nat).(getl n0 c (CHead e (Bind Abbr) u0))) H6 n H7) in (let H10 \def +(eq_ind_r nat i (\lambda (n0: nat).(csubst0 n0 u0 c c3)) H5 n H7) in (let H11 +\def (eq_ind C (CHead d (Bind Abbr) u) (\lambda (c0: C).(getl n c c0)) H0 +(CHead e (Bind Abbr) u0) (getl_mono c (CHead d (Bind Abbr) u) n H0 (CHead e +(Bind Abbr) u0) H9)) in (let H12 \def (f_equal C C (\lambda (e0: C).(match e0 +in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) +\Rightarrow c0])) (CHead d (Bind Abbr) u) (CHead e (Bind Abbr) u0) (getl_mono +c (CHead d (Bind Abbr) u) n H0 (CHead e (Bind Abbr) u0) H9)) in ((let H13 +\def (f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u | (CHead _ _ t4) \Rightarrow t4])) (CHead d +(Bind Abbr) u) (CHead e (Bind Abbr) u0) (getl_mono c (CHead d (Bind Abbr) u) +n H0 (CHead e (Bind Abbr) u0) H9)) in (\lambda (H14: (eq C d e)).(let H15 +\def (eq_ind_r C e (\lambda (c0: C).(getl n c (CHead c0 (Bind Abbr) u0))) H11 +d H14) in (let H16 \def (eq_ind_r T u0 (\lambda (t4: T).(getl n c (CHead d +(Bind Abbr) t4))) H15 u H13) in (let H17 \def (eq_ind_r T u0 (\lambda (t4: +T).(csubst0 n t4 c c3)) H10 u H13) in (eq_ind T u (\lambda (t4: T).(ty3 g c3 +(lift (S n) O t4) (lift (S n) O t0))) (ty3_lift g d u t0 H1 c3 O (S n) +(getl_drop Abbr c3 d u n (csubst0_getl_ge n n (le_n n) c c3 u H17 (CHead d +(Bind Abbr) u) H16))) u0 H13)))))) H12))))) t3 H8))) (subst0_gen_lref u0 t3 i +n H4)))))))) c2 t2 H3)))))))))))))) (\lambda (n: nat).(\lambda (c: +C).(\lambda (d: C).(\lambda (u: T).(\lambda (H0: (getl n c (CHead d (Bind +Abst) u))).(\lambda (t0: T).(\lambda (H1: (ty3 g d u t0)).(\lambda (H2: +((\forall (i: nat).(\forall (u0: T).(\forall (c2: C).(\forall (t2: +T).((fsubst0 i u0 d u c2 t2) \to (\forall (e: C).((getl i d (CHead e (Bind +Abbr) u0)) \to (ty3 g c2 t2 t0)))))))))).(\lambda (i: nat).(\lambda (u0: +T).(\lambda (c2: C).(\lambda (t2: T).(\lambda (H3: (fsubst0 i u0 c (TLRef n) +c2 t2)).(fsubst0_ind i u0 c (TLRef n) (\lambda (c0: C).(\lambda (t3: +T).(\forall (e: C).((getl i c (CHead e (Bind Abbr) u0)) \to (ty3 g c0 t3 +(lift (S n) O u)))))) (\lambda (t3: T).(\lambda (H4: (subst0 i u0 (TLRef n) +t3)).(\lambda (e: C).(\lambda (H5: (getl i c (CHead e (Bind Abbr) +u0))).(and_ind (eq nat n i) (eq T t3 (lift (S n) O u0)) (ty3 g c t3 (lift (S +n) O u)) (\lambda (H6: (eq nat n i)).(\lambda (H7: (eq T t3 (lift (S n) O +u0))).(eq_ind_r T (lift (S n) O u0) (\lambda (t4: T).(ty3 g c t4 (lift (S n) +O u))) (let H8 \def (eq_ind_r nat i (\lambda (n0: nat).(getl n0 c (CHead e +(Bind Abbr) u0))) H5 n H6) in (let H9 \def (eq_ind C (CHead d (Bind Abst) u) +(\lambda (c0: C).(getl n c c0)) H0 (CHead e (Bind Abbr) u0) (getl_mono c +(CHead d (Bind Abst) u) n H0 (CHead e (Bind Abbr) u0) H8)) in (let H10 \def +(eq_ind C (CHead d (Bind Abst) u) (\lambda (ee: C).(match ee in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead e (Bind Abbr) u0) (getl_mono c (CHead d (Bind +Abst) u) n H0 (CHead e (Bind Abbr) u0) H8)) in (False_ind (ty3 g c (lift (S +n) O u0) (lift (S n) O u)) H10)))) t3 H7))) (subst0_gen_lref u0 t3 i n +H4)))))) (\lambda (c3: C).(\lambda (H4: (csubst0 i u0 c c3)).(\lambda (e: +C).(\lambda (H5: (getl i c (CHead e (Bind Abbr) u0))).(lt_le_e n i (ty3 g c3 +(TLRef n) (lift (S n) O u)) (\lambda (H6: (lt n i)).(let H7 \def +(csubst0_getl_lt i n H6 c c3 u0 H4 (CHead d (Bind Abst) u) H0) in (or4_ind +(getl n c3 (CHead d (Bind Abst) u)) (ex3_4 B C T T (\lambda (b: B).(\lambda +(e0: C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abst) u) (CHead +e0 (Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: +T).(\lambda (w: T).(getl n c3 (CHead e0 (Bind b) w)))))) (\lambda (_: +B).(\lambda (_: C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i (S n)) +u0 u1 w)))))) (ex3_4 B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: +C).(\lambda (u1: T).(eq C (CHead d (Bind Abst) u) (CHead e1 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u1: T).(getl n c3 +(CHead e2 (Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: +C).(\lambda (_: T).(csubst0 (minus i (S n)) u0 e1 e2)))))) (ex4_5 B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C (CHead d (Bind Abst) u) (CHead e1 (Bind b) u1))))))) (\lambda +(b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl +n c3 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) u0 e1 e2))))))) (ty3 g c3 (TLRef n) (lift (S +n) O u)) (\lambda (H8: (getl n c3 (CHead d (Bind Abst) u))).(ty3_abst g n c3 +d u H8 t0 H1)) (\lambda (H8: (ex3_4 B C T T (\lambda (b: B).(\lambda (e0: +C).(\lambda (u1: T).(\lambda (_: T).(eq C (CHead d (Bind Abst) u) (CHead e0 +(Bind b) u1)))))) (\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda +(w: T).(getl n c3 (CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 +w))))))).(ex3_4_ind B C T T (\lambda (b: B).(\lambda (e0: C).(\lambda (u1: +T).(\lambda (_: T).(eq C (CHead d (Bind Abst) u) (CHead e0 (Bind b) u1)))))) +(\lambda (b: B).(\lambda (e0: C).(\lambda (_: T).(\lambda (w: T).(getl n c3 +(CHead e0 (Bind b) w)))))) (\lambda (_: B).(\lambda (_: C).(\lambda (u1: +T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 w))))) (ty3 g c3 (TLRef n) +(lift (S n) O u)) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: T).(\lambda +(x3: T).(\lambda (H9: (eq C (CHead d (Bind Abst) u) (CHead x1 (Bind x0) +x2))).(\lambda (H10: (getl n c3 (CHead x1 (Bind x0) x3))).(\lambda (H11: +(subst0 (minus i (S n)) u0 x2 x3)).(let H12 \def (f_equal C C (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c0 _ _) \Rightarrow c0])) (CHead d (Bind Abst) u) (CHead x1 (Bind x0) +x2) H9) in ((let H13 \def (f_equal C B (\lambda (e0: C).(match e0 in C return +(\lambda (_: C).B) with [(CSort _) \Rightarrow Abst | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b) +\Rightarrow b | (Flat _) \Rightarrow Abst])])) (CHead d (Bind Abst) u) (CHead +x1 (Bind x0) x2) H9) in ((let H14 \def (f_equal C T (\lambda (e0: C).(match +e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ +t3) \Rightarrow t3])) (CHead d (Bind Abst) u) (CHead x1 (Bind x0) x2) H9) in +(\lambda (H15: (eq B Abst x0)).(\lambda (H16: (eq C d x1)).(let H17 \def +(eq_ind_r T x2 (\lambda (t3: T).(subst0 (minus i (S n)) u0 t3 x3)) H11 u H14) +in (let H18 \def (eq_ind_r C x1 (\lambda (c0: C).(getl n c3 (CHead c0 (Bind +x0) x3))) H10 d H16) in (let H19 \def (eq_ind_r B x0 (\lambda (b: B).(getl n +c3 (CHead d (Bind b) x3))) H18 Abst H15) in (let H20 \def (eq_ind nat (minus +i n) (\lambda (n0: nat).(getl n0 (CHead d (Bind Abst) x3) (CHead e (Bind +Abbr) u0))) (getl_conf_le i (CHead e (Bind Abbr) u0) c3 (csubst0_getl_ge i i +(le_n i) c c3 u0 H4 (CHead e (Bind Abbr) u0) H5) (CHead d (Bind Abst) x3) n +H19 (le_S_n n i (le_S (S n) i H6))) (S (minus i (S n))) (minus_x_Sy i n H6)) +in (ty3_conv g c3 (lift (S n) O u) (lift (S n) O t0) (ty3_lift g d u t0 H1 c3 +O (S n) (getl_drop Abst c3 d x3 n H19)) (TLRef n) (lift (S n) O x3) (ty3_abst +g n c3 d x3 H19 t0 (H2 (minus i (S n)) u0 d x3 (fsubst0_snd (minus i (S n)) +u0 d u x3 H17) e (getl_gen_S (Bind Abst) d (CHead e (Bind Abbr) u0) x3 (minus +i (S n)) H20))) (pc3_lift c3 d (S n) O (getl_drop Abst c3 d x3 n H19) x3 u +(pc3_pr2_x d x3 u (pr2_delta d e u0 (r (Bind Abst) (minus i (S n))) +(getl_gen_S (Bind Abst) d (CHead e (Bind Abbr) u0) x3 (minus i (S n)) H20) u +u (pr0_refl u) x3 H17))))))))))) H13)) H12))))))))) H8)) (\lambda (H8: (ex3_4 +B C C T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq +C (CHead d (Bind Abst) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: +B).(\lambda (_: C).(\lambda (e2: C).(\lambda (u1: T).(getl n c3 (CHead e2 +(Bind b) u1)))))) (\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda +(_: T).(csubst0 (minus i (S n)) u0 e1 e2))))))).(ex3_4_ind B C C T (\lambda +(b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(eq C (CHead d (Bind +Abst) u) (CHead e1 (Bind b) u1)))))) (\lambda (b: B).(\lambda (_: C).(\lambda +(e2: C).(\lambda (u1: T).(getl n c3 (CHead e2 (Bind b) u1)))))) (\lambda (_: +B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(csubst0 (minus i (S n)) +u0 e1 e2))))) (ty3 g c3 (TLRef n) (lift (S n) O u)) (\lambda (x0: B).(\lambda +(x1: C).(\lambda (x2: C).(\lambda (x3: T).(\lambda (H9: (eq C (CHead d (Bind +Abst) u) (CHead x1 (Bind x0) x3))).(\lambda (H10: (getl n c3 (CHead x2 (Bind +x0) x3))).(\lambda (H11: (csubst0 (minus i (S n)) u0 x1 x2)).(let H12 \def +(f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow d | (CHead c0 _ _) \Rightarrow c0])) (CHead d (Bind +Abst) u) (CHead x1 (Bind x0) x3) H9) in ((let H13 \def (f_equal C B (\lambda +(e0: C).(match e0 in C return (\lambda (_: C).B) with [(CSort _) \Rightarrow +Abst | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).B) with +[(Bind b) \Rightarrow b | (Flat _) \Rightarrow Abst])])) (CHead d (Bind Abst) +u) (CHead x1 (Bind x0) x3) H9) in ((let H14 \def (f_equal C T (\lambda (e0: +C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u | +(CHead _ _ t3) \Rightarrow t3])) (CHead d (Bind Abst) u) (CHead x1 (Bind x0) +x3) H9) in (\lambda (H15: (eq B Abst x0)).(\lambda (H16: (eq C d x1)).(let +H17 \def (eq_ind_r T x3 (\lambda (t3: T).(getl n c3 (CHead x2 (Bind x0) t3))) +H10 u H14) in (let H18 \def (eq_ind_r C x1 (\lambda (c0: C).(csubst0 (minus i +(S n)) u0 c0 x2)) H11 d H16) in (let H19 \def (eq_ind_r B x0 (\lambda (b: +B).(getl n c3 (CHead x2 (Bind b) u))) H17 Abst H15) in (let H20 \def (eq_ind +nat (minus i n) (\lambda (n0: nat).(getl n0 (CHead x2 (Bind Abst) u) (CHead e +(Bind Abbr) u0))) (getl_conf_le i (CHead e (Bind Abbr) u0) c3 +(csubst0_getl_ge i i (le_n i) c c3 u0 H4 (CHead e (Bind Abbr) u0) H5) (CHead +x2 (Bind Abst) u) n H19 (le_S_n n i (le_S (S n) i H6))) (S (minus i (S n))) +(minus_x_Sy i n H6)) in (ty3_abst g n c3 x2 u H19 t0 (H2 (minus i (S n)) u0 +x2 u (fsubst0_fst (minus i (S n)) u0 d u x2 H18) e (csubst0_getl_ge_back +(minus i (S n)) (minus i (S n)) (le_n (minus i (S n))) d x2 u0 H18 (CHead e +(Bind Abbr) u0) (getl_gen_S (Bind Abst) x2 (CHead e (Bind Abbr) u0) u (minus +i (S n)) H20))))))))))) H13)) H12))))))))) H8)) (\lambda (H8: (ex4_5 B C C T +T (\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C (CHead d (Bind Abst) u) (CHead e1 (Bind b) u1))))))) (\lambda +(b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl +n c3 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) u0 e1 e2)))))))).(ex4_5_ind B C C T T +(\lambda (b: B).(\lambda (e1: C).(\lambda (_: C).(\lambda (u1: T).(\lambda +(_: T).(eq C (CHead d (Bind Abst) u) (CHead e1 (Bind b) u1))))))) (\lambda +(b: B).(\lambda (_: C).(\lambda (e2: C).(\lambda (_: T).(\lambda (w: T).(getl +n c3 (CHead e2 (Bind b) w))))))) (\lambda (_: B).(\lambda (_: C).(\lambda (_: +C).(\lambda (u1: T).(\lambda (w: T).(subst0 (minus i (S n)) u0 u1 w)))))) +(\lambda (_: B).(\lambda (e1: C).(\lambda (e2: C).(\lambda (_: T).(\lambda +(_: T).(csubst0 (minus i (S n)) u0 e1 e2)))))) (ty3 g c3 (TLRef n) (lift (S +n) O u)) (\lambda (x0: B).(\lambda (x1: C).(\lambda (x2: C).(\lambda (x3: +T).(\lambda (x4: T).(\lambda (H9: (eq C (CHead d (Bind Abst) u) (CHead x1 +(Bind x0) x3))).(\lambda (H10: (getl n c3 (CHead x2 (Bind x0) x4))).(\lambda +(H11: (subst0 (minus i (S n)) u0 x3 x4)).(\lambda (H12: (csubst0 (minus i (S +n)) u0 x1 x2)).(let H13 \def (f_equal C C (\lambda (e0: C).(match e0 in C +return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | (CHead c0 _ _) +\Rightarrow c0])) (CHead d (Bind Abst) u) (CHead x1 (Bind x0) x3) H9) in +((let H14 \def (f_equal C B (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).B) with [(CSort _) \Rightarrow Abst | (CHead _ k _) \Rightarrow (match +k in K return (\lambda (_: K).B) with [(Bind b) \Rightarrow b | (Flat _) +\Rightarrow Abst])])) (CHead d (Bind Abst) u) (CHead x1 (Bind x0) x3) H9) in +((let H15 \def (f_equal C T (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).T) with [(CSort _) \Rightarrow u | (CHead _ _ t3) \Rightarrow t3])) +(CHead d (Bind Abst) u) (CHead x1 (Bind x0) x3) H9) in (\lambda (H16: (eq B +Abst x0)).(\lambda (H17: (eq C d x1)).(let H18 \def (eq_ind_r T x3 (\lambda +(t3: T).(subst0 (minus i (S n)) u0 t3 x4)) H11 u H15) in (let H19 \def +(eq_ind_r C x1 (\lambda (c0: C).(csubst0 (minus i (S n)) u0 c0 x2)) H12 d +H17) in (let H20 \def (eq_ind_r B x0 (\lambda (b: B).(getl n c3 (CHead x2 +(Bind b) x4))) H10 Abst H16) in (let H21 \def (eq_ind nat (minus i n) +(\lambda (n0: nat).(getl n0 (CHead x2 (Bind Abst) x4) (CHead e (Bind Abbr) +u0))) (getl_conf_le i (CHead e (Bind Abbr) u0) c3 (csubst0_getl_ge i i (le_n +i) c c3 u0 H4 (CHead e (Bind Abbr) u0) H5) (CHead x2 (Bind Abst) x4) n H20 +(le_S_n n i (le_S (S n) i H6))) (S (minus i (S n))) (minus_x_Sy i n H6)) in +(ty3_conv g c3 (lift (S n) O u) (lift (S n) O t0) (ty3_lift g x2 u t0 (H2 +(minus i (S n)) u0 x2 u (fsubst0_fst (minus i (S n)) u0 d u x2 H19) e +(csubst0_getl_ge_back (minus i (S n)) (minus i (S n)) (le_n (minus i (S n))) +d x2 u0 H19 (CHead e (Bind Abbr) u0) (getl_gen_S (Bind Abst) x2 (CHead e +(Bind Abbr) u0) x4 (minus i (S n)) H21))) c3 O (S n) (getl_drop Abst c3 x2 x4 +n H20)) (TLRef n) (lift (S n) O x4) (ty3_abst g n c3 x2 x4 H20 t0 (H2 (minus +i (S n)) u0 x2 x4 (fsubst0_both (minus i (S n)) u0 d u x4 H18 x2 H19) e +(csubst0_getl_ge_back (minus i (S n)) (minus i (S n)) (le_n (minus i (S n))) +d x2 u0 H19 (CHead e (Bind Abbr) u0) (getl_gen_S (Bind Abst) x2 (CHead e +(Bind Abbr) u0) x4 (minus i (S n)) H21)))) (pc3_lift c3 x2 (S n) O (getl_drop +Abst c3 x2 x4 n H20) x4 u (pc3_fsubst0 d u u (pc3_refl d u) (minus i (S n)) +u0 x2 x4 (fsubst0_both (minus i (S n)) u0 d u x4 H18 x2 H19) e +(csubst0_getl_ge_back (minus i (S n)) (minus i (S n)) (le_n (minus i (S n))) +d x2 u0 H19 (CHead e (Bind Abbr) u0) (getl_gen_S (Bind Abst) x2 (CHead e +(Bind Abbr) u0) x4 (minus i (S n)) H21)))))))))))) H14)) H13))))))))))) H8)) +H7))) (\lambda (H6: (le i n)).(ty3_abst g n c3 d u (csubst0_getl_ge i n H6 c +c3 u0 H4 (CHead d (Bind Abst) u) H0) t0 H1))))))) (\lambda (t3: T).(\lambda +(H4: (subst0 i u0 (TLRef n) t3)).(\lambda (c3: C).(\lambda (H5: (csubst0 i u0 +c c3)).(\lambda (e: C).(\lambda (H6: (getl i c (CHead e (Bind Abbr) +u0))).(and_ind (eq nat n i) (eq T t3 (lift (S n) O u0)) (ty3 g c3 t3 (lift (S +n) O u)) (\lambda (H7: (eq nat n i)).(\lambda (H8: (eq T t3 (lift (S n) O +u0))).(eq_ind_r T (lift (S n) O u0) (\lambda (t4: T).(ty3 g c3 t4 (lift (S n) +O u))) (let H9 \def (eq_ind_r nat i (\lambda (n0: nat).(getl n0 c (CHead e +(Bind Abbr) u0))) H6 n H7) in (let H10 \def (eq_ind_r nat i (\lambda (n0: +nat).(csubst0 n0 u0 c c3)) H5 n H7) in (let H11 \def (eq_ind C (CHead d (Bind +Abst) u) (\lambda (c0: C).(getl n c c0)) H0 (CHead e (Bind Abbr) u0) +(getl_mono c (CHead d (Bind Abst) u) n H0 (CHead e (Bind Abbr) u0) H9)) in +(let H12 \def (eq_ind C (CHead d (Bind Abst) u) (\lambda (ee: C).(match ee in +C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k +_) \Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead e (Bind Abbr) u0) (getl_mono c (CHead d (Bind +Abst) u) n H0 (CHead e (Bind Abbr) u0) H9)) in (False_ind (ty3 g c3 (lift (S +n) O u0) (lift (S n) O u)) H12))))) t3 H8))) (subst0_gen_lref u0 t3 i n +H4)))))))) c2 t2 H3)))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda +(t0: T).(\lambda (H0: (ty3 g c u t0)).(\lambda (H1: ((\forall (i: +nat).(\forall (u0: T).(\forall (c2: C).(\forall (t2: T).((fsubst0 i u0 c u c2 +t2) \to (\forall (e: C).((getl i c (CHead e (Bind Abbr) u0)) \to (ty3 g c2 t2 +t0)))))))))).(\lambda (b: B).(\lambda (t2: T).(\lambda (t3: T).(\lambda (_: +(ty3 g (CHead c (Bind b) u) t2 t3)).(\lambda (H3: ((\forall (i: nat).(\forall +(u0: T).(\forall (c2: C).(\forall (t4: T).((fsubst0 i u0 (CHead c (Bind b) u) +t2 c2 t4) \to (\forall (e: C).((getl i (CHead c (Bind b) u) (CHead e (Bind +Abbr) u0)) \to (ty3 g c2 t4 t3)))))))))).(\lambda (t4: T).(\lambda (H4: (ty3 +g (CHead c (Bind b) u) t3 t4)).(\lambda (_: ((\forall (i: nat).(\forall (u0: +T).(\forall (c2: C).(\forall (t5: T).((fsubst0 i u0 (CHead c (Bind b) u) t3 +c2 t5) \to (\forall (e: C).((getl i (CHead c (Bind b) u) (CHead e (Bind Abbr) +u0)) \to (ty3 g c2 t5 t4)))))))))).(\lambda (i: nat).(\lambda (u0: +T).(\lambda (c2: C).(\lambda (t5: T).(\lambda (H6: (fsubst0 i u0 c (THead +(Bind b) u t2) c2 t5)).(fsubst0_ind i u0 c (THead (Bind b) u t2) (\lambda +(c0: C).(\lambda (t6: T).(\forall (e: C).((getl i c (CHead e (Bind Abbr) u0)) +\to (ty3 g c0 t6 (THead (Bind b) u t3)))))) (\lambda (t6: T).(\lambda (H7: +(subst0 i u0 (THead (Bind b) u t2) t6)).(\lambda (e: C).(\lambda (H8: (getl i +c (CHead e (Bind Abbr) u0))).(or3_ind (ex2 T (\lambda (u2: T).(eq T t6 (THead +(Bind b) u2 t2))) (\lambda (u2: T).(subst0 i u0 u u2))) (ex2 T (\lambda (t7: +T).(eq T t6 (THead (Bind b) u t7))) (\lambda (t7: T).(subst0 (s (Bind b) i) +u0 t2 t7))) (ex3_2 T T (\lambda (u2: T).(\lambda (t7: T).(eq T t6 (THead +(Bind b) u2 t7)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) +(\lambda (_: T).(\lambda (t7: T).(subst0 (s (Bind b) i) u0 t2 t7)))) (ty3 g c +t6 (THead (Bind b) u t3)) (\lambda (H9: (ex2 T (\lambda (u2: T).(eq T t6 +(THead (Bind b) u2 t2))) (\lambda (u2: T).(subst0 i u0 u u2)))).(ex2_ind T +(\lambda (u2: T).(eq T t6 (THead (Bind b) u2 t2))) (\lambda (u2: T).(subst0 i +u0 u u2)) (ty3 g c t6 (THead (Bind b) u t3)) (\lambda (x: T).(\lambda (H10: +(eq T t6 (THead (Bind b) x t2))).(\lambda (H11: (subst0 i u0 u x)).(eq_ind_r +T (THead (Bind b) x t2) (\lambda (t7: T).(ty3 g c t7 (THead (Bind b) u t3))) +(ex_ind T (\lambda (t7: T).(ty3 g (CHead c (Bind b) u) t4 t7)) (ty3 g c +(THead (Bind b) x t2) (THead (Bind b) u t3)) (\lambda (x0: T).(\lambda (H12: +(ty3 g (CHead c (Bind b) u) t4 x0)).(ex_ind T (\lambda (t7: T).(ty3 g (CHead +c (Bind b) x) t3 t7)) (ty3 g c (THead (Bind b) x t2) (THead (Bind b) u t3)) +(\lambda (x1: T).(\lambda (H13: (ty3 g (CHead c (Bind b) x) t3 x1)).(ty3_conv +g c (THead (Bind b) u t3) (THead (Bind b) u t4) (ty3_bind g c u t0 H0 b t3 t4 +H4 x0 H12) (THead (Bind b) x t2) (THead (Bind b) x t3) (ty3_bind g c x t0 (H1 +i u0 c x (fsubst0_snd i u0 c u x H11) e H8) b t2 t3 (H3 (S i) u0 (CHead c +(Bind b) x) t2 (fsubst0_fst (S i) u0 (CHead c (Bind b) u) t2 (CHead c (Bind +b) x) (csubst0_snd_bind b i u0 u x H11 c)) e (getl_head (Bind b) i c (CHead e +(Bind Abbr) u0) H8 u)) x1 H13) (pc3_fsubst0 c (THead (Bind b) u t3) (THead +(Bind b) u t3) (pc3_refl c (THead (Bind b) u t3)) i u0 c (THead (Bind b) x +t3) (fsubst0_snd i u0 c (THead (Bind b) u t3) (THead (Bind b) x t3) +(subst0_fst u0 x u i H11 t3 (Bind b))) e H8)))) (ty3_correct g (CHead c (Bind +b) x) t2 t3 (H3 (S i) u0 (CHead c (Bind b) x) t2 (fsubst0_fst (S i) u0 (CHead +c (Bind b) u) t2 (CHead c (Bind b) x) (csubst0_snd_bind b i u0 u x H11 c)) e +(getl_head (Bind b) i c (CHead e (Bind Abbr) u0) H8 u)))))) (ty3_correct g +(CHead c (Bind b) u) t3 t4 H4)) t6 H10)))) H9)) (\lambda (H9: (ex2 T (\lambda +(t7: T).(eq T t6 (THead (Bind b) u t7))) (\lambda (t7: T).(subst0 (s (Bind b) +i) u0 t2 t7)))).(ex2_ind T (\lambda (t7: T).(eq T t6 (THead (Bind b) u t7))) +(\lambda (t7: T).(subst0 (s (Bind b) i) u0 t2 t7)) (ty3 g c t6 (THead (Bind +b) u t3)) (\lambda (x: T).(\lambda (H10: (eq T t6 (THead (Bind b) u +x))).(\lambda (H11: (subst0 (s (Bind b) i) u0 t2 x)).(eq_ind_r T (THead (Bind +b) u x) (\lambda (t7: T).(ty3 g c t7 (THead (Bind b) u t3))) (ex_ind T +(\lambda (t7: T).(ty3 g (CHead c (Bind b) u) t3 t7)) (ty3 g c (THead (Bind b) +u x) (THead (Bind b) u t3)) (\lambda (x0: T).(\lambda (H12: (ty3 g (CHead c +(Bind b) u) t3 x0)).(ty3_bind g c u t0 H0 b x t3 (H3 (S i) u0 (CHead c (Bind +b) u) x (fsubst0_snd (S i) u0 (CHead c (Bind b) u) t2 x H11) e (getl_head +(Bind b) i c (CHead e (Bind Abbr) u0) H8 u)) x0 H12))) (ty3_correct g (CHead +c (Bind b) u) x t3 (H3 (S i) u0 (CHead c (Bind b) u) x (fsubst0_snd (S i) u0 +(CHead c (Bind b) u) t2 x H11) e (getl_head (Bind b) i c (CHead e (Bind Abbr) +u0) H8 u)))) t6 H10)))) H9)) (\lambda (H9: (ex3_2 T T (\lambda (u2: +T).(\lambda (t7: T).(eq T t6 (THead (Bind b) u2 t7)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t7: +T).(subst0 (s (Bind b) i) u0 t2 t7))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t7: T).(eq T t6 (THead (Bind b) u2 t7)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t7: +T).(subst0 (s (Bind b) i) u0 t2 t7))) (ty3 g c t6 (THead (Bind b) u t3)) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (H10: (eq T t6 (THead (Bind b) x0 +x1))).(\lambda (H11: (subst0 i u0 u x0)).(\lambda (H12: (subst0 (s (Bind b) +i) u0 t2 x1)).(eq_ind_r T (THead (Bind b) x0 x1) (\lambda (t7: T).(ty3 g c t7 +(THead (Bind b) u t3))) (ex_ind T (\lambda (t7: T).(ty3 g (CHead c (Bind b) +u) t4 t7)) (ty3 g c (THead (Bind b) x0 x1) (THead (Bind b) u t3)) (\lambda +(x: T).(\lambda (H13: (ty3 g (CHead c (Bind b) u) t4 x)).(ex_ind T (\lambda +(t7: T).(ty3 g (CHead c (Bind b) x0) t3 t7)) (ty3 g c (THead (Bind b) x0 x1) +(THead (Bind b) u t3)) (\lambda (x2: T).(\lambda (H14: (ty3 g (CHead c (Bind +b) x0) t3 x2)).(ty3_conv g c (THead (Bind b) u t3) (THead (Bind b) u t4) +(ty3_bind g c u t0 H0 b t3 t4 H4 x H13) (THead (Bind b) x0 x1) (THead (Bind +b) x0 t3) (ty3_bind g c x0 t0 (H1 i u0 c x0 (fsubst0_snd i u0 c u x0 H11) e +H8) b x1 t3 (H3 (S i) u0 (CHead c (Bind b) x0) x1 (fsubst0_both (S i) u0 +(CHead c (Bind b) u) t2 x1 H12 (CHead c (Bind b) x0) (csubst0_snd_bind b i u0 +u x0 H11 c)) e (getl_head (Bind b) i c (CHead e (Bind Abbr) u0) H8 u)) x2 +H14) (pc3_fsubst0 c (THead (Bind b) u t3) (THead (Bind b) u t3) (pc3_refl c +(THead (Bind b) u t3)) i u0 c (THead (Bind b) x0 t3) (fsubst0_snd i u0 c +(THead (Bind b) u t3) (THead (Bind b) x0 t3) (subst0_fst u0 x0 u i H11 t3 +(Bind b))) e H8)))) (ty3_correct g (CHead c (Bind b) x0) x1 t3 (H3 (S i) u0 +(CHead c (Bind b) x0) x1 (fsubst0_both (S i) u0 (CHead c (Bind b) u) t2 x1 +H12 (CHead c (Bind b) x0) (csubst0_snd_bind b i u0 u x0 H11 c)) e (getl_head +(Bind b) i c (CHead e (Bind Abbr) u0) H8 u)))))) (ty3_correct g (CHead c +(Bind b) u) t3 t4 H4)) t6 H10)))))) H9)) (subst0_gen_head (Bind b) u0 u t2 t6 +i H7)))))) (\lambda (c3: C).(\lambda (H7: (csubst0 i u0 c c3)).(\lambda (e: +C).(\lambda (H8: (getl i c (CHead e (Bind Abbr) u0))).(ex_ind T (\lambda (t6: +T).(ty3 g (CHead c3 (Bind b) u) t3 t6)) (ty3 g c3 (THead (Bind b) u t2) +(THead (Bind b) u t3)) (\lambda (x: T).(\lambda (H9: (ty3 g (CHead c3 (Bind +b) u) t3 x)).(ty3_bind g c3 u t0 (H1 i u0 c3 u (fsubst0_fst i u0 c u c3 H7) e +H8) b t2 t3 (H3 (S i) u0 (CHead c3 (Bind b) u) t2 (fsubst0_fst (S i) u0 +(CHead c (Bind b) u) t2 (CHead c3 (Bind b) u) (csubst0_fst_bind b i c c3 u0 +H7 u)) e (getl_head (Bind b) i c (CHead e (Bind Abbr) u0) H8 u)) x H9))) +(ty3_correct g (CHead c3 (Bind b) u) t2 t3 (H3 (S i) u0 (CHead c3 (Bind b) u) +t2 (fsubst0_fst (S i) u0 (CHead c (Bind b) u) t2 (CHead c3 (Bind b) u) +(csubst0_fst_bind b i c c3 u0 H7 u)) e (getl_head (Bind b) i c (CHead e (Bind +Abbr) u0) H8 u)))))))) (\lambda (t6: T).(\lambda (H7: (subst0 i u0 (THead +(Bind b) u t2) t6)).(\lambda (c3: C).(\lambda (H8: (csubst0 i u0 c +c3)).(\lambda (e: C).(\lambda (H9: (getl i c (CHead e (Bind Abbr) +u0))).(or3_ind (ex2 T (\lambda (u2: T).(eq T t6 (THead (Bind b) u2 t2))) +(\lambda (u2: T).(subst0 i u0 u u2))) (ex2 T (\lambda (t7: T).(eq T t6 (THead +(Bind b) u t7))) (\lambda (t7: T).(subst0 (s (Bind b) i) u0 t2 t7))) (ex3_2 T +T (\lambda (u2: T).(\lambda (t7: T).(eq T t6 (THead (Bind b) u2 t7)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: +T).(\lambda (t7: T).(subst0 (s (Bind b) i) u0 t2 t7)))) (ty3 g c3 t6 (THead +(Bind b) u t3)) (\lambda (H10: (ex2 T (\lambda (u2: T).(eq T t6 (THead (Bind +b) u2 t2))) (\lambda (u2: T).(subst0 i u0 u u2)))).(ex2_ind T (\lambda (u2: +T).(eq T t6 (THead (Bind b) u2 t2))) (\lambda (u2: T).(subst0 i u0 u u2)) +(ty3 g c3 t6 (THead (Bind b) u t3)) (\lambda (x: T).(\lambda (H11: (eq T t6 +(THead (Bind b) x t2))).(\lambda (H12: (subst0 i u0 u x)).(eq_ind_r T (THead +(Bind b) x t2) (\lambda (t7: T).(ty3 g c3 t7 (THead (Bind b) u t3))) (ex_ind +T (\lambda (t7: T).(ty3 g (CHead c3 (Bind b) u) t3 t7)) (ty3 g c3 (THead +(Bind b) x t2) (THead (Bind b) u t3)) (\lambda (x0: T).(\lambda (H13: (ty3 g +(CHead c3 (Bind b) u) t3 x0)).(ex_ind T (\lambda (t7: T).(ty3 g (CHead c3 +(Bind b) u) x0 t7)) (ty3 g c3 (THead (Bind b) x t2) (THead (Bind b) u t3)) +(\lambda (x1: T).(\lambda (H14: (ty3 g (CHead c3 (Bind b) u) x0 x1)).(ex_ind +T (\lambda (t7: T).(ty3 g (CHead c3 (Bind b) x) t3 t7)) (ty3 g c3 (THead +(Bind b) x t2) (THead (Bind b) u t3)) (\lambda (x2: T).(\lambda (H15: (ty3 g +(CHead c3 (Bind b) x) t3 x2)).(ty3_conv g c3 (THead (Bind b) u t3) (THead +(Bind b) u x0) (ty3_bind g c3 u t0 (H1 i u0 c3 u (fsubst0_fst i u0 c u c3 H8) +e H9) b t3 x0 H13 x1 H14) (THead (Bind b) x t2) (THead (Bind b) x t3) +(ty3_bind g c3 x t0 (H1 i u0 c3 x (fsubst0_both i u0 c u x H12 c3 H8) e H9) b +t2 t3 (H3 (S i) u0 (CHead c3 (Bind b) x) t2 (fsubst0_fst (S i) u0 (CHead c +(Bind b) u) t2 (CHead c3 (Bind b) x) (csubst0_both_bind b i u0 u x H12 c c3 +H8)) e (getl_head (Bind b) i c (CHead e (Bind Abbr) u0) H9 u)) x2 H15) +(pc3_fsubst0 c (THead (Bind b) u t3) (THead (Bind b) u t3) (pc3_refl c (THead +(Bind b) u t3)) i u0 c3 (THead (Bind b) x t3) (fsubst0_both i u0 c (THead +(Bind b) u t3) (THead (Bind b) x t3) (subst0_fst u0 x u i H12 t3 (Bind b)) c3 +H8) e H9)))) (ty3_correct g (CHead c3 (Bind b) x) t2 t3 (H3 (S i) u0 (CHead +c3 (Bind b) x) t2 (fsubst0_fst (S i) u0 (CHead c (Bind b) u) t2 (CHead c3 +(Bind b) x) (csubst0_both_bind b i u0 u x H12 c c3 H8)) e (getl_head (Bind b) +i c (CHead e (Bind Abbr) u0) H9 u)))))) (ty3_correct g (CHead c3 (Bind b) u) +t3 x0 H13)))) (ty3_correct g (CHead c3 (Bind b) u) t2 t3 (H3 (S i) u0 (CHead +c3 (Bind b) u) t2 (fsubst0_fst (S i) u0 (CHead c (Bind b) u) t2 (CHead c3 +(Bind b) u) (csubst0_fst_bind b i c c3 u0 H8 u)) e (getl_head (Bind b) i c +(CHead e (Bind Abbr) u0) H9 u)))) t6 H11)))) H10)) (\lambda (H10: (ex2 T +(\lambda (t7: T).(eq T t6 (THead (Bind b) u t7))) (\lambda (t7: T).(subst0 (s +(Bind b) i) u0 t2 t7)))).(ex2_ind T (\lambda (t7: T).(eq T t6 (THead (Bind b) +u t7))) (\lambda (t7: T).(subst0 (s (Bind b) i) u0 t2 t7)) (ty3 g c3 t6 +(THead (Bind b) u t3)) (\lambda (x: T).(\lambda (H11: (eq T t6 (THead (Bind +b) u x))).(\lambda (H12: (subst0 (s (Bind b) i) u0 t2 x)).(eq_ind_r T (THead +(Bind b) u x) (\lambda (t7: T).(ty3 g c3 t7 (THead (Bind b) u t3))) (ex_ind T +(\lambda (t7: T).(ty3 g (CHead c3 (Bind b) u) t3 t7)) (ty3 g c3 (THead (Bind +b) u x) (THead (Bind b) u t3)) (\lambda (x0: T).(\lambda (H13: (ty3 g (CHead +c3 (Bind b) u) t3 x0)).(ty3_bind g c3 u t0 (H1 i u0 c3 u (fsubst0_fst i u0 c +u c3 H8) e H9) b x t3 (H3 (S i) u0 (CHead c3 (Bind b) u) x (fsubst0_both (S +i) u0 (CHead c (Bind b) u) t2 x H12 (CHead c3 (Bind b) u) (csubst0_fst_bind b +i c c3 u0 H8 u)) e (getl_head (Bind b) i c (CHead e (Bind Abbr) u0) H9 u)) x0 +H13))) (ty3_correct g (CHead c3 (Bind b) u) x t3 (H3 (S i) u0 (CHead c3 (Bind +b) u) x (fsubst0_both (S i) u0 (CHead c (Bind b) u) t2 x H12 (CHead c3 (Bind +b) u) (csubst0_fst_bind b i c c3 u0 H8 u)) e (getl_head (Bind b) i c (CHead e +(Bind Abbr) u0) H9 u)))) t6 H11)))) H10)) (\lambda (H10: (ex3_2 T T (\lambda +(u2: T).(\lambda (t7: T).(eq T t6 (THead (Bind b) u2 t7)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t7: +T).(subst0 (s (Bind b) i) u0 t2 t7))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t7: T).(eq T t6 (THead (Bind b) u2 t7)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 u u2))) (\lambda (_: T).(\lambda (t7: +T).(subst0 (s (Bind b) i) u0 t2 t7))) (ty3 g c3 t6 (THead (Bind b) u t3)) +(\lambda (x0: T).(\lambda (x1: T).(\lambda (H11: (eq T t6 (THead (Bind b) x0 +x1))).(\lambda (H12: (subst0 i u0 u x0)).(\lambda (H13: (subst0 (s (Bind b) +i) u0 t2 x1)).(eq_ind_r T (THead (Bind b) x0 x1) (\lambda (t7: T).(ty3 g c3 +t7 (THead (Bind b) u t3))) (ex_ind T (\lambda (t7: T).(ty3 g (CHead c3 (Bind +b) u) t3 t7)) (ty3 g c3 (THead (Bind b) x0 x1) (THead (Bind b) u t3)) +(\lambda (x: T).(\lambda (H14: (ty3 g (CHead c3 (Bind b) u) t3 x)).(ex_ind T +(\lambda (t7: T).(ty3 g (CHead c3 (Bind b) u) x t7)) (ty3 g c3 (THead (Bind +b) x0 x1) (THead (Bind b) u t3)) (\lambda (x2: T).(\lambda (H15: (ty3 g +(CHead c3 (Bind b) u) x x2)).(ex_ind T (\lambda (t7: T).(ty3 g (CHead c3 +(Bind b) x0) t3 t7)) (ty3 g c3 (THead (Bind b) x0 x1) (THead (Bind b) u t3)) +(\lambda (x3: T).(\lambda (H16: (ty3 g (CHead c3 (Bind b) x0) t3 +x3)).(ty3_conv g c3 (THead (Bind b) u t3) (THead (Bind b) u x) (ty3_bind g c3 +u t0 (H1 i u0 c3 u (fsubst0_fst i u0 c u c3 H8) e H9) b t3 x H14 x2 H15) +(THead (Bind b) x0 x1) (THead (Bind b) x0 t3) (ty3_bind g c3 x0 t0 (H1 i u0 +c3 x0 (fsubst0_both i u0 c u x0 H12 c3 H8) e H9) b x1 t3 (H3 (S i) u0 (CHead +c3 (Bind b) x0) x1 (fsubst0_both (S i) u0 (CHead c (Bind b) u) t2 x1 H13 +(CHead c3 (Bind b) x0) (csubst0_both_bind b i u0 u x0 H12 c c3 H8)) e +(getl_head (Bind b) i c (CHead e (Bind Abbr) u0) H9 u)) x3 H16) (pc3_fsubst0 +c (THead (Bind b) u t3) (THead (Bind b) u t3) (pc3_refl c (THead (Bind b) u +t3)) i u0 c3 (THead (Bind b) x0 t3) (fsubst0_both i u0 c (THead (Bind b) u +t3) (THead (Bind b) x0 t3) (subst0_fst u0 x0 u i H12 t3 (Bind b)) c3 H8) e +H9)))) (ty3_correct g (CHead c3 (Bind b) x0) x1 t3 (H3 (S i) u0 (CHead c3 +(Bind b) x0) x1 (fsubst0_both (S i) u0 (CHead c (Bind b) u) t2 x1 H13 (CHead +c3 (Bind b) x0) (csubst0_both_bind b i u0 u x0 H12 c c3 H8)) e (getl_head +(Bind b) i c (CHead e (Bind Abbr) u0) H9 u)))))) (ty3_correct g (CHead c3 +(Bind b) u) t3 x H14)))) (ty3_correct g (CHead c3 (Bind b) u) t2 t3 (H3 (S i) +u0 (CHead c3 (Bind b) u) t2 (fsubst0_fst (S i) u0 (CHead c (Bind b) u) t2 +(CHead c3 (Bind b) u) (csubst0_fst_bind b i c c3 u0 H8 u)) e (getl_head (Bind +b) i c (CHead e (Bind Abbr) u0) H9 u)))) t6 H11)))))) H10)) (subst0_gen_head +(Bind b) u0 u t2 t6 i H7)))))))) c2 t5 H6))))))))))))))))))) (\lambda (c: +C).(\lambda (w: T).(\lambda (u: T).(\lambda (H0: (ty3 g c w u)).(\lambda (H1: +((\forall (i: nat).(\forall (u0: T).(\forall (c2: C).(\forall (t2: +T).((fsubst0 i u0 c w c2 t2) \to (\forall (e: C).((getl i c (CHead e (Bind +Abbr) u0)) \to (ty3 g c2 t2 u)))))))))).(\lambda (v: T).(\lambda (t0: +T).(\lambda (H2: (ty3 g c v (THead (Bind Abst) u t0))).(\lambda (H3: +((\forall (i: nat).(\forall (u0: T).(\forall (c2: C).(\forall (t2: +T).((fsubst0 i u0 c v c2 t2) \to (\forall (e: C).((getl i c (CHead e (Bind +Abbr) u0)) \to (ty3 g c2 t2 (THead (Bind Abst) u t0))))))))))).(\lambda (i: +nat).(\lambda (u0: T).(\lambda (c2: C).(\lambda (t2: T).(\lambda (H4: +(fsubst0 i u0 c (THead (Flat Appl) w v) c2 t2)).(fsubst0_ind i u0 c (THead +(Flat Appl) w v) (\lambda (c0: C).(\lambda (t3: T).(\forall (e: C).((getl i c +(CHead e (Bind Abbr) u0)) \to (ty3 g c0 t3 (THead (Flat Appl) w (THead (Bind +Abst) u t0))))))) (\lambda (t3: T).(\lambda (H5: (subst0 i u0 (THead (Flat +Appl) w v) t3)).(\lambda (e: C).(\lambda (H6: (getl i c (CHead e (Bind Abbr) +u0))).(or3_ind (ex2 T (\lambda (u2: T).(eq T t3 (THead (Flat Appl) u2 v))) +(\lambda (u2: T).(subst0 i u0 w u2))) (ex2 T (\lambda (t4: T).(eq T t3 (THead +(Flat Appl) w t4))) (\lambda (t4: T).(subst0 (s (Flat Appl) i) u0 v t4))) +(ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 +t4)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 w u2))) (\lambda (_: +T).(\lambda (t4: T).(subst0 (s (Flat Appl) i) u0 v t4)))) (ty3 g c t3 (THead +(Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (H7: (ex2 T (\lambda (u2: +T).(eq T t3 (THead (Flat Appl) u2 v))) (\lambda (u2: T).(subst0 i u0 w +u2)))).(ex2_ind T (\lambda (u2: T).(eq T t3 (THead (Flat Appl) u2 v))) +(\lambda (u2: T).(subst0 i u0 w u2)) (ty3 g c t3 (THead (Flat Appl) w (THead +(Bind Abst) u t0))) (\lambda (x: T).(\lambda (H8: (eq T t3 (THead (Flat Appl) +x v))).(\lambda (H9: (subst0 i u0 w x)).(eq_ind_r T (THead (Flat Appl) x v) +(\lambda (t4: T).(ty3 g c t4 (THead (Flat Appl) w (THead (Bind Abst) u t0)))) +(ex_ind T (\lambda (t4: T).(ty3 g c (THead (Bind Abst) u t0) t4)) (ty3 g c +(THead (Flat Appl) x v) (THead (Flat Appl) w (THead (Bind Abst) u t0))) +(\lambda (x0: T).(\lambda (H10: (ty3 g c (THead (Bind Abst) u t0) +x0)).(ex4_3_ind T T T (\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(pc3 c +(THead (Bind Abst) u t4) x0)))) (\lambda (_: T).(\lambda (t5: T).(\lambda (_: +T).(ty3 g c u t5)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(ty3 g +(CHead c (Bind Abst) u) t0 t4)))) (\lambda (t4: T).(\lambda (_: T).(\lambda +(t6: T).(ty3 g (CHead c (Bind Abst) u) t4 t6)))) (ty3 g c (THead (Flat Appl) +x v) (THead (Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (x1: +T).(\lambda (x2: T).(\lambda (x3: T).(\lambda (_: (pc3 c (THead (Bind Abst) u +x1) x0)).(\lambda (_: (ty3 g c u x2)).(\lambda (H13: (ty3 g (CHead c (Bind +Abst) u) t0 x1)).(\lambda (H14: (ty3 g (CHead c (Bind Abst) u) x1 +x3)).(ex_ind T (\lambda (t4: T).(ty3 g c u t4)) (ty3 g c (THead (Flat Appl) x +v) (THead (Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (x4: T).(\lambda +(H15: (ty3 g c u x4)).(ty3_conv g c (THead (Flat Appl) w (THead (Bind Abst) u +t0)) (THead (Flat Appl) w (THead (Bind Abst) u x1)) (ty3_appl g c w u H0 +(THead (Bind Abst) u t0) x1 (ty3_bind g c u x4 H15 Abst t0 x1 H13 x3 H14)) +(THead (Flat Appl) x v) (THead (Flat Appl) x (THead (Bind Abst) u t0)) +(ty3_appl g c x u (H1 i u0 c x (fsubst0_snd i u0 c w x H9) e H6) v t0 H2) +(pc3_fsubst0 c (THead (Flat Appl) w (THead (Bind Abst) u t0)) (THead (Flat +Appl) w (THead (Bind Abst) u t0)) (pc3_refl c (THead (Flat Appl) w (THead +(Bind Abst) u t0))) i u0 c (THead (Flat Appl) x (THead (Bind Abst) u t0)) +(fsubst0_snd i u0 c (THead (Flat Appl) w (THead (Bind Abst) u t0)) (THead +(Flat Appl) x (THead (Bind Abst) u t0)) (subst0_fst u0 x w i H9 (THead (Bind +Abst) u t0) (Flat Appl))) e H6)))) (ty3_correct g c x u (H1 i u0 c x +(fsubst0_snd i u0 c w x H9) e H6)))))))))) (ty3_gen_bind g Abst c u t0 x0 +H10)))) (ty3_correct g c v (THead (Bind Abst) u t0) H2)) t3 H8)))) H7)) +(\lambda (H7: (ex2 T (\lambda (t4: T).(eq T t3 (THead (Flat Appl) w t4))) +(\lambda (t4: T).(subst0 (s (Flat Appl) i) u0 v t4)))).(ex2_ind T (\lambda +(t4: T).(eq T t3 (THead (Flat Appl) w t4))) (\lambda (t4: T).(subst0 (s (Flat +Appl) i) u0 v t4)) (ty3 g c t3 (THead (Flat Appl) w (THead (Bind Abst) u +t0))) (\lambda (x: T).(\lambda (H8: (eq T t3 (THead (Flat Appl) w +x))).(\lambda (H9: (subst0 (s (Flat Appl) i) u0 v x)).(eq_ind_r T (THead +(Flat Appl) w x) (\lambda (t4: T).(ty3 g c t4 (THead (Flat Appl) w (THead +(Bind Abst) u t0)))) (ty3_appl g c w u H0 x t0 (H3 (s (Flat Appl) i) u0 c x +(fsubst0_snd (s (Flat Appl) i) u0 c v x H9) e H6)) t3 H8)))) H7)) (\lambda +(H7: (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) +u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 w u2))) (\lambda (_: +T).(\lambda (t4: T).(subst0 (s (Flat Appl) i) u0 v t4))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u0 w u2))) (\lambda (_: +T).(\lambda (t4: T).(subst0 (s (Flat Appl) i) u0 v t4))) (ty3 g c t3 (THead +(Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H8: (eq T t3 (THead (Flat Appl) x0 x1))).(\lambda (H9: (subst0 i +u0 w x0)).(\lambda (H10: (subst0 (s (Flat Appl) i) u0 v x1)).(eq_ind_r T +(THead (Flat Appl) x0 x1) (\lambda (t4: T).(ty3 g c t4 (THead (Flat Appl) w +(THead (Bind Abst) u t0)))) (ex_ind T (\lambda (t4: T).(ty3 g c (THead (Bind +Abst) u t0) t4)) (ty3 g c (THead (Flat Appl) x0 x1) (THead (Flat Appl) w +(THead (Bind Abst) u t0))) (\lambda (x: T).(\lambda (H11: (ty3 g c (THead +(Bind Abst) u t0) x)).(ex4_3_ind T T T (\lambda (t4: T).(\lambda (_: +T).(\lambda (_: T).(pc3 c (THead (Bind Abst) u t4) x)))) (\lambda (_: +T).(\lambda (t5: T).(\lambda (_: T).(ty3 g c u t5)))) (\lambda (t4: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) u) t0 t4)))) +(\lambda (t4: T).(\lambda (_: T).(\lambda (t6: T).(ty3 g (CHead c (Bind Abst) +u) t4 t6)))) (ty3 g c (THead (Flat Appl) x0 x1) (THead (Flat Appl) w (THead +(Bind Abst) u t0))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (_: (pc3 c (THead (Bind Abst) u x2) x)).(\lambda (_: (ty3 g c u +x3)).(\lambda (H14: (ty3 g (CHead c (Bind Abst) u) t0 x2)).(\lambda (H15: +(ty3 g (CHead c (Bind Abst) u) x2 x4)).(ex_ind T (\lambda (t4: T).(ty3 g c u +t4)) (ty3 g c (THead (Flat Appl) x0 x1) (THead (Flat Appl) w (THead (Bind +Abst) u t0))) (\lambda (x5: T).(\lambda (H16: (ty3 g c u x5)).(ty3_conv g c +(THead (Flat Appl) w (THead (Bind Abst) u t0)) (THead (Flat Appl) w (THead +(Bind Abst) u x2)) (ty3_appl g c w u H0 (THead (Bind Abst) u t0) x2 (ty3_bind +g c u x5 H16 Abst t0 x2 H14 x4 H15)) (THead (Flat Appl) x0 x1) (THead (Flat +Appl) x0 (THead (Bind Abst) u t0)) (ty3_appl g c x0 u (H1 i u0 c x0 +(fsubst0_snd i u0 c w x0 H9) e H6) x1 t0 (H3 (s (Flat Appl) i) u0 c x1 +(fsubst0_snd (s (Flat Appl) i) u0 c v x1 H10) e H6)) (pc3_fsubst0 c (THead +(Flat Appl) w (THead (Bind Abst) u t0)) (THead (Flat Appl) w (THead (Bind +Abst) u t0)) (pc3_refl c (THead (Flat Appl) w (THead (Bind Abst) u t0))) i u0 +c (THead (Flat Appl) x0 (THead (Bind Abst) u t0)) (fsubst0_snd i u0 c (THead +(Flat Appl) w (THead (Bind Abst) u t0)) (THead (Flat Appl) x0 (THead (Bind +Abst) u t0)) (subst0_fst u0 x0 w i H9 (THead (Bind Abst) u t0) (Flat Appl))) +e H6)))) (ty3_correct g c w u H0))))))))) (ty3_gen_bind g Abst c u t0 x +H11)))) (ty3_correct g c v (THead (Bind Abst) u t0) H2)) t3 H8)))))) H7)) +(subst0_gen_head (Flat Appl) u0 w v t3 i H5)))))) (\lambda (c3: C).(\lambda +(H5: (csubst0 i u0 c c3)).(\lambda (e: C).(\lambda (H6: (getl i c (CHead e +(Bind Abbr) u0))).(ty3_appl g c3 w u (H1 i u0 c3 w (fsubst0_fst i u0 c w c3 +H5) e H6) v t0 (H3 i u0 c3 v (fsubst0_fst i u0 c v c3 H5) e H6)))))) (\lambda +(t3: T).(\lambda (H5: (subst0 i u0 (THead (Flat Appl) w v) t3)).(\lambda (c3: +C).(\lambda (H6: (csubst0 i u0 c c3)).(\lambda (e: C).(\lambda (H7: (getl i c +(CHead e (Bind Abbr) u0))).(or3_ind (ex2 T (\lambda (u2: T).(eq T t3 (THead +(Flat Appl) u2 v))) (\lambda (u2: T).(subst0 i u0 w u2))) (ex2 T (\lambda +(t4: T).(eq T t3 (THead (Flat Appl) w t4))) (\lambda (t4: T).(subst0 (s (Flat +Appl) i) u0 v t4))) (ex3_2 T T (\lambda (u2: T).(\lambda (t4: T).(eq T t3 +(THead (Flat Appl) u2 t4)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u0 w +u2))) (\lambda (_: T).(\lambda (t4: T).(subst0 (s (Flat Appl) i) u0 v t4)))) +(ty3 g c3 t3 (THead (Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (H8: +(ex2 T (\lambda (u2: T).(eq T t3 (THead (Flat Appl) u2 v))) (\lambda (u2: +T).(subst0 i u0 w u2)))).(ex2_ind T (\lambda (u2: T).(eq T t3 (THead (Flat +Appl) u2 v))) (\lambda (u2: T).(subst0 i u0 w u2)) (ty3 g c3 t3 (THead (Flat +Appl) w (THead (Bind Abst) u t0))) (\lambda (x: T).(\lambda (H9: (eq T t3 +(THead (Flat Appl) x v))).(\lambda (H10: (subst0 i u0 w x)).(eq_ind_r T +(THead (Flat Appl) x v) (\lambda (t4: T).(ty3 g c3 t4 (THead (Flat Appl) w +(THead (Bind Abst) u t0)))) (ex_ind T (\lambda (t4: T).(ty3 g c3 (THead (Bind +Abst) u t0) t4)) (ty3 g c3 (THead (Flat Appl) x v) (THead (Flat Appl) w +(THead (Bind Abst) u t0))) (\lambda (x0: T).(\lambda (H11: (ty3 g c3 (THead +(Bind Abst) u t0) x0)).(ex4_3_ind T T T (\lambda (t4: T).(\lambda (_: +T).(\lambda (_: T).(pc3 c3 (THead (Bind Abst) u t4) x0)))) (\lambda (_: +T).(\lambda (t5: T).(\lambda (_: T).(ty3 g c3 u t5)))) (\lambda (t4: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c3 (Bind Abst) u) t0 t4)))) +(\lambda (t4: T).(\lambda (_: T).(\lambda (t6: T).(ty3 g (CHead c3 (Bind +Abst) u) t4 t6)))) (ty3 g c3 (THead (Flat Appl) x v) (THead (Flat Appl) w +(THead (Bind Abst) u t0))) (\lambda (x1: T).(\lambda (x2: T).(\lambda (x3: +T).(\lambda (_: (pc3 c3 (THead (Bind Abst) u x1) x0)).(\lambda (H13: (ty3 g +c3 u x2)).(\lambda (H14: (ty3 g (CHead c3 (Bind Abst) u) t0 x1)).(\lambda +(H15: (ty3 g (CHead c3 (Bind Abst) u) x1 x3)).(ty3_conv g c3 (THead (Flat +Appl) w (THead (Bind Abst) u t0)) (THead (Flat Appl) w (THead (Bind Abst) u +x1)) (ty3_appl g c3 w u (H1 i u0 c3 w (fsubst0_fst i u0 c w c3 H6) e H7) +(THead (Bind Abst) u t0) x1 (ty3_bind g c3 u x2 H13 Abst t0 x1 H14 x3 H15)) +(THead (Flat Appl) x v) (THead (Flat Appl) x (THead (Bind Abst) u t0)) +(ty3_appl g c3 x u (H1 i u0 c3 x (fsubst0_both i u0 c w x H10 c3 H6) e H7) v +t0 (H3 i u0 c3 v (fsubst0_fst i u0 c v c3 H6) e H7)) (pc3_fsubst0 c (THead +(Flat Appl) w (THead (Bind Abst) u t0)) (THead (Flat Appl) w (THead (Bind +Abst) u t0)) (pc3_refl c (THead (Flat Appl) w (THead (Bind Abst) u t0))) i u0 +c3 (THead (Flat Appl) x (THead (Bind Abst) u t0)) (fsubst0_both i u0 c (THead +(Flat Appl) w (THead (Bind Abst) u t0)) (THead (Flat Appl) x (THead (Bind +Abst) u t0)) (subst0_fst u0 x w i H10 (THead (Bind Abst) u t0) (Flat Appl)) +c3 H6) e H7))))))))) (ty3_gen_bind g Abst c3 u t0 x0 H11)))) (ty3_correct g +c3 v (THead (Bind Abst) u t0) (H3 i u0 c3 v (fsubst0_fst i u0 c v c3 H6) e +H7))) t3 H9)))) H8)) (\lambda (H8: (ex2 T (\lambda (t4: T).(eq T t3 (THead +(Flat Appl) w t4))) (\lambda (t4: T).(subst0 (s (Flat Appl) i) u0 v +t4)))).(ex2_ind T (\lambda (t4: T).(eq T t3 (THead (Flat Appl) w t4))) +(\lambda (t4: T).(subst0 (s (Flat Appl) i) u0 v t4)) (ty3 g c3 t3 (THead +(Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (x: T).(\lambda (H9: (eq T +t3 (THead (Flat Appl) w x))).(\lambda (H10: (subst0 (s (Flat Appl) i) u0 v +x)).(eq_ind_r T (THead (Flat Appl) w x) (\lambda (t4: T).(ty3 g c3 t4 (THead +(Flat Appl) w (THead (Bind Abst) u t0)))) (ty3_appl g c3 w u (H1 i u0 c3 w +(fsubst0_fst i u0 c w c3 H6) e H7) x t0 (H3 i u0 c3 x (fsubst0_both i u0 c v +x H10 c3 H6) e H7)) t3 H9)))) H8)) (\lambda (H8: (ex3_2 T T (\lambda (u2: +T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 w u2))) (\lambda (_: T).(\lambda (t4: +T).(subst0 (s (Flat Appl) i) u0 v t4))))).(ex3_2_ind T T (\lambda (u2: +T).(\lambda (t4: T).(eq T t3 (THead (Flat Appl) u2 t4)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u0 w u2))) (\lambda (_: T).(\lambda (t4: +T).(subst0 (s (Flat Appl) i) u0 v t4))) (ty3 g c3 t3 (THead (Flat Appl) w +(THead (Bind Abst) u t0))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H9: +(eq T t3 (THead (Flat Appl) x0 x1))).(\lambda (H10: (subst0 i u0 w +x0)).(\lambda (H11: (subst0 (s (Flat Appl) i) u0 v x1)).(eq_ind_r T (THead +(Flat Appl) x0 x1) (\lambda (t4: T).(ty3 g c3 t4 (THead (Flat Appl) w (THead +(Bind Abst) u t0)))) (ex_ind T (\lambda (t4: T).(ty3 g c3 (THead (Bind Abst) +u t0) t4)) (ty3 g c3 (THead (Flat Appl) x0 x1) (THead (Flat Appl) w (THead +(Bind Abst) u t0))) (\lambda (x: T).(\lambda (H12: (ty3 g c3 (THead (Bind +Abst) u t0) x)).(ex4_3_ind T T T (\lambda (t4: T).(\lambda (_: T).(\lambda +(_: T).(pc3 c3 (THead (Bind Abst) u t4) x)))) (\lambda (_: T).(\lambda (t5: +T).(\lambda (_: T).(ty3 g c3 u t5)))) (\lambda (t4: T).(\lambda (_: +T).(\lambda (_: T).(ty3 g (CHead c3 (Bind Abst) u) t0 t4)))) (\lambda (t4: +T).(\lambda (_: T).(\lambda (t6: T).(ty3 g (CHead c3 (Bind Abst) u) t4 t6)))) +(ty3 g c3 (THead (Flat Appl) x0 x1) (THead (Flat Appl) w (THead (Bind Abst) u +t0))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda (_: (pc3 c3 +(THead (Bind Abst) u x2) x)).(\lambda (_: (ty3 g c3 u x3)).(\lambda (H15: +(ty3 g (CHead c3 (Bind Abst) u) t0 x2)).(\lambda (H16: (ty3 g (CHead c3 (Bind +Abst) u) x2 x4)).(ex_ind T (\lambda (t4: T).(ty3 g c3 u t4)) (ty3 g c3 (THead +(Flat Appl) x0 x1) (THead (Flat Appl) w (THead (Bind Abst) u t0))) (\lambda +(x5: T).(\lambda (H17: (ty3 g c3 u x5)).(ty3_conv g c3 (THead (Flat Appl) w +(THead (Bind Abst) u t0)) (THead (Flat Appl) w (THead (Bind Abst) u x2)) +(ty3_appl g c3 w u (H1 i u0 c3 w (fsubst0_fst i u0 c w c3 H6) e H7) (THead +(Bind Abst) u t0) x2 (ty3_bind g c3 u x5 H17 Abst t0 x2 H15 x4 H16)) (THead +(Flat Appl) x0 x1) (THead (Flat Appl) x0 (THead (Bind Abst) u t0)) (ty3_appl +g c3 x0 u (H1 i u0 c3 x0 (fsubst0_both i u0 c w x0 H10 c3 H6) e H7) x1 t0 (H3 +i u0 c3 x1 (fsubst0_both i u0 c v x1 H11 c3 H6) e H7)) (pc3_fsubst0 c (THead +(Flat Appl) w (THead (Bind Abst) u t0)) (THead (Flat Appl) w (THead (Bind +Abst) u t0)) (pc3_refl c (THead (Flat Appl) w (THead (Bind Abst) u t0))) i u0 +c3 (THead (Flat Appl) x0 (THead (Bind Abst) u t0)) (fsubst0_both i u0 c +(THead (Flat Appl) w (THead (Bind Abst) u t0)) (THead (Flat Appl) x0 (THead +(Bind Abst) u t0)) (subst0_fst u0 x0 w i H10 (THead (Bind Abst) u t0) (Flat +Appl)) c3 H6) e H7)))) (ty3_correct g c3 w u (H1 i u0 c3 w (fsubst0_fst i u0 +c w c3 H6) e H7)))))))))) (ty3_gen_bind g Abst c3 u t0 x H12)))) (ty3_correct +g c3 v (THead (Bind Abst) u t0) (H3 i u0 c3 v (fsubst0_fst i u0 c v c3 H6) e +H7))) t3 H9)))))) H8)) (subst0_gen_head (Flat Appl) u0 w v t3 i H5)))))))) c2 +t2 H4))))))))))))))) (\lambda (c: C).(\lambda (t2: T).(\lambda (t3: +T).(\lambda (H0: (ty3 g c t2 t3)).(\lambda (H1: ((\forall (i: nat).(\forall +(u: T).(\forall (c2: C).(\forall (t4: T).((fsubst0 i u c t2 c2 t4) \to +(\forall (e: C).((getl i c (CHead e (Bind Abbr) u)) \to (ty3 g c2 t4 +t3)))))))))).(\lambda (t0: T).(\lambda (H2: (ty3 g c t3 t0)).(\lambda (H3: +((\forall (i: nat).(\forall (u: T).(\forall (c2: C).(\forall (t4: +T).((fsubst0 i u c t3 c2 t4) \to (\forall (e: C).((getl i c (CHead e (Bind +Abbr) u)) \to (ty3 g c2 t4 t0)))))))))).(\lambda (i: nat).(\lambda (u: +T).(\lambda (c2: C).(\lambda (t4: T).(\lambda (H4: (fsubst0 i u c (THead +(Flat Cast) t3 t2) c2 t4)).(fsubst0_ind i u c (THead (Flat Cast) t3 t2) +(\lambda (c0: C).(\lambda (t5: T).(\forall (e: C).((getl i c (CHead e (Bind +Abbr) u)) \to (ty3 g c0 t5 (THead (Flat Cast) t0 t3)))))) (\lambda (t5: +T).(\lambda (H5: (subst0 i u (THead (Flat Cast) t3 t2) t5)).(\lambda (e: +C).(\lambda (H6: (getl i c (CHead e (Bind Abbr) u))).(or3_ind (ex2 T (\lambda +(u2: T).(eq T t5 (THead (Flat Cast) u2 t2))) (\lambda (u2: T).(subst0 i u t3 +u2))) (ex2 T (\lambda (t6: T).(eq T t5 (THead (Flat Cast) t3 t6))) (\lambda +(t6: T).(subst0 (s (Flat Cast) i) u t2 t6))) (ex3_2 T T (\lambda (u2: +T).(\lambda (t6: T).(eq T t5 (THead (Flat Cast) u2 t6)))) (\lambda (u2: +T).(\lambda (_: T).(subst0 i u t3 u2))) (\lambda (_: T).(\lambda (t6: +T).(subst0 (s (Flat Cast) i) u t2 t6)))) (ty3 g c t5 (THead (Flat Cast) t0 +t3)) (\lambda (H7: (ex2 T (\lambda (u2: T).(eq T t5 (THead (Flat Cast) u2 +t2))) (\lambda (u2: T).(subst0 i u t3 u2)))).(ex2_ind T (\lambda (u2: T).(eq +T t5 (THead (Flat Cast) u2 t2))) (\lambda (u2: T).(subst0 i u t3 u2)) (ty3 g +c t5 (THead (Flat Cast) t0 t3)) (\lambda (x: T).(\lambda (H8: (eq T t5 (THead +(Flat Cast) x t2))).(\lambda (H9: (subst0 i u t3 x)).(eq_ind_r T (THead (Flat +Cast) x t2) (\lambda (t6: T).(ty3 g c t6 (THead (Flat Cast) t0 t3))) (ex_ind +T (\lambda (t6: T).(ty3 g c t0 t6)) (ty3 g c (THead (Flat Cast) x t2) (THead +(Flat Cast) t0 t3)) (\lambda (x0: T).(\lambda (H10: (ty3 g c t0 +x0)).(ty3_conv g c (THead (Flat Cast) t0 t3) (THead (Flat Cast) x0 t0) +(ty3_cast g c t3 t0 H2 x0 H10) (THead (Flat Cast) x t2) (THead (Flat Cast) t0 +x) (ty3_cast g c t2 x (ty3_conv g c x t0 (H3 i u c x (fsubst0_snd i u c t3 x +H9) e H6) t2 t3 H0 (pc3_s c t3 x (pc3_fsubst0 c t3 t3 (pc3_refl c t3) i u c x +(fsubst0_snd i u c t3 x H9) e H6))) t0 (H3 i u c x (fsubst0_snd i u c t3 x +H9) e H6)) (pc3_fsubst0 c (THead (Flat Cast) t0 t3) (THead (Flat Cast) t0 t3) +(pc3_refl c (THead (Flat Cast) t0 t3)) i u c (THead (Flat Cast) t0 x) +(fsubst0_snd i u c (THead (Flat Cast) t0 t3) (THead (Flat Cast) t0 x) +(subst0_snd (Flat Cast) u x t3 i H9 t0)) e H6)))) (ty3_correct g c x t0 (H3 i +u c x (fsubst0_snd i u c t3 x H9) e H6))) t5 H8)))) H7)) (\lambda (H7: (ex2 T +(\lambda (t6: T).(eq T t5 (THead (Flat Cast) t3 t6))) (\lambda (t6: +T).(subst0 (s (Flat Cast) i) u t2 t6)))).(ex2_ind T (\lambda (t6: T).(eq T t5 +(THead (Flat Cast) t3 t6))) (\lambda (t6: T).(subst0 (s (Flat Cast) i) u t2 +t6)) (ty3 g c t5 (THead (Flat Cast) t0 t3)) (\lambda (x: T).(\lambda (H8: (eq +T t5 (THead (Flat Cast) t3 x))).(\lambda (H9: (subst0 (s (Flat Cast) i) u t2 +x)).(eq_ind_r T (THead (Flat Cast) t3 x) (\lambda (t6: T).(ty3 g c t6 (THead +(Flat Cast) t0 t3))) (ty3_cast g c x t3 (H1 (s (Flat Cast) i) u c x +(fsubst0_snd (s (Flat Cast) i) u c t2 x H9) e H6) t0 H2) t5 H8)))) H7)) +(\lambda (H7: (ex3_2 T T (\lambda (u2: T).(\lambda (t6: T).(eq T t5 (THead +(Flat Cast) u2 t6)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u t3 u2))) +(\lambda (_: T).(\lambda (t6: T).(subst0 (s (Flat Cast) i) u t2 +t6))))).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t6: T).(eq T t5 (THead +(Flat Cast) u2 t6)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u t3 u2))) +(\lambda (_: T).(\lambda (t6: T).(subst0 (s (Flat Cast) i) u t2 t6))) (ty3 g +c t5 (THead (Flat Cast) t0 t3)) (\lambda (x0: T).(\lambda (x1: T).(\lambda +(H8: (eq T t5 (THead (Flat Cast) x0 x1))).(\lambda (H9: (subst0 i u t3 +x0)).(\lambda (H10: (subst0 (s (Flat Cast) i) u t2 x1)).(eq_ind_r T (THead +(Flat Cast) x0 x1) (\lambda (t6: T).(ty3 g c t6 (THead (Flat Cast) t0 t3))) +(ex_ind T (\lambda (t6: T).(ty3 g c t0 t6)) (ty3 g c (THead (Flat Cast) x0 +x1) (THead (Flat Cast) t0 t3)) (\lambda (x: T).(\lambda (H11: (ty3 g c t0 +x)).(ty3_conv g c (THead (Flat Cast) t0 t3) (THead (Flat Cast) x t0) +(ty3_cast g c t3 t0 H2 x H11) (THead (Flat Cast) x0 x1) (THead (Flat Cast) t0 +x0) (ty3_cast g c x1 x0 (ty3_conv g c x0 t0 (H3 i u c x0 (fsubst0_snd i u c +t3 x0 H9) e H6) x1 t3 (H1 (s (Flat Cast) i) u c x1 (fsubst0_snd (s (Flat +Cast) i) u c t2 x1 H10) e H6) (pc3_s c t3 x0 (pc3_fsubst0 c t3 t3 (pc3_refl c +t3) i u c x0 (fsubst0_snd i u c t3 x0 H9) e H6))) t0 (H3 i u c x0 +(fsubst0_snd i u c t3 x0 H9) e H6)) (pc3_fsubst0 c (THead (Flat Cast) t0 t3) +(THead (Flat Cast) t0 t3) (pc3_refl c (THead (Flat Cast) t0 t3)) i u c (THead +(Flat Cast) t0 x0) (fsubst0_snd i u c (THead (Flat Cast) t0 t3) (THead (Flat +Cast) t0 x0) (subst0_snd (Flat Cast) u x0 t3 i H9 t0)) e H6)))) (ty3_correct +g c x0 t0 (H3 i u c x0 (fsubst0_snd i u c t3 x0 H9) e H6))) t5 H8)))))) H7)) +(subst0_gen_head (Flat Cast) u t3 t2 t5 i H5)))))) (\lambda (c3: C).(\lambda +(H5: (csubst0 i u c c3)).(\lambda (e: C).(\lambda (H6: (getl i c (CHead e +(Bind Abbr) u))).(ty3_cast g c3 t2 t3 (H1 i u c3 t2 (fsubst0_fst i u c t2 c3 +H5) e H6) t0 (H3 i u c3 t3 (fsubst0_fst i u c t3 c3 H5) e H6)))))) (\lambda +(t5: T).(\lambda (H5: (subst0 i u (THead (Flat Cast) t3 t2) t5)).(\lambda +(c3: C).(\lambda (H6: (csubst0 i u c c3)).(\lambda (e: C).(\lambda (H7: (getl +i c (CHead e (Bind Abbr) u))).(or3_ind (ex2 T (\lambda (u2: T).(eq T t5 +(THead (Flat Cast) u2 t2))) (\lambda (u2: T).(subst0 i u t3 u2))) (ex2 T +(\lambda (t6: T).(eq T t5 (THead (Flat Cast) t3 t6))) (\lambda (t6: +T).(subst0 (s (Flat Cast) i) u t2 t6))) (ex3_2 T T (\lambda (u2: T).(\lambda +(t6: T).(eq T t5 (THead (Flat Cast) u2 t6)))) (\lambda (u2: T).(\lambda (_: +T).(subst0 i u t3 u2))) (\lambda (_: T).(\lambda (t6: T).(subst0 (s (Flat +Cast) i) u t2 t6)))) (ty3 g c3 t5 (THead (Flat Cast) t0 t3)) (\lambda (H8: +(ex2 T (\lambda (u2: T).(eq T t5 (THead (Flat Cast) u2 t2))) (\lambda (u2: +T).(subst0 i u t3 u2)))).(ex2_ind T (\lambda (u2: T).(eq T t5 (THead (Flat +Cast) u2 t2))) (\lambda (u2: T).(subst0 i u t3 u2)) (ty3 g c3 t5 (THead (Flat +Cast) t0 t3)) (\lambda (x: T).(\lambda (H9: (eq T t5 (THead (Flat Cast) x +t2))).(\lambda (H10: (subst0 i u t3 x)).(eq_ind_r T (THead (Flat Cast) x t2) +(\lambda (t6: T).(ty3 g c3 t6 (THead (Flat Cast) t0 t3))) (ex_ind T (\lambda +(t6: T).(ty3 g c3 t0 t6)) (ty3 g c3 (THead (Flat Cast) x t2) (THead (Flat +Cast) t0 t3)) (\lambda (x0: T).(\lambda (H11: (ty3 g c3 t0 x0)).(ty3_conv g +c3 (THead (Flat Cast) t0 t3) (THead (Flat Cast) x0 t0) (ty3_cast g c3 t3 t0 +(H3 i u c3 t3 (fsubst0_fst i u c t3 c3 H6) e H7) x0 H11) (THead (Flat Cast) x +t2) (THead (Flat Cast) t0 x) (ty3_cast g c3 t2 x (ty3_conv g c3 x t0 (H3 i u +c3 x (fsubst0_both i u c t3 x H10 c3 H6) e H7) t2 t3 (H1 i u c3 t2 +(fsubst0_fst i u c t2 c3 H6) e H7) (pc3_s c3 t3 x (pc3_fsubst0 c t3 t3 +(pc3_refl c t3) i u c3 x (fsubst0_both i u c t3 x H10 c3 H6) e H7))) t0 (H3 i +u c3 x (fsubst0_both i u c t3 x H10 c3 H6) e H7)) (pc3_fsubst0 c (THead (Flat +Cast) t0 t3) (THead (Flat Cast) t0 t3) (pc3_refl c (THead (Flat Cast) t0 t3)) +i u c3 (THead (Flat Cast) t0 x) (fsubst0_both i u c (THead (Flat Cast) t0 t3) +(THead (Flat Cast) t0 x) (subst0_snd (Flat Cast) u x t3 i H10 t0) c3 H6) e +H7)))) (ty3_correct g c3 t3 t0 (H3 i u c3 t3 (fsubst0_fst i u c t3 c3 H6) e +H7))) t5 H9)))) H8)) (\lambda (H8: (ex2 T (\lambda (t6: T).(eq T t5 (THead +(Flat Cast) t3 t6))) (\lambda (t6: T).(subst0 (s (Flat Cast) i) u t2 +t6)))).(ex2_ind T (\lambda (t6: T).(eq T t5 (THead (Flat Cast) t3 t6))) +(\lambda (t6: T).(subst0 (s (Flat Cast) i) u t2 t6)) (ty3 g c3 t5 (THead +(Flat Cast) t0 t3)) (\lambda (x: T).(\lambda (H9: (eq T t5 (THead (Flat Cast) +t3 x))).(\lambda (H10: (subst0 (s (Flat Cast) i) u t2 x)).(eq_ind_r T (THead +(Flat Cast) t3 x) (\lambda (t6: T).(ty3 g c3 t6 (THead (Flat Cast) t0 t3))) +(ty3_cast g c3 x t3 (H1 i u c3 x (fsubst0_both i u c t2 x H10 c3 H6) e H7) t0 +(H3 i u c3 t3 (fsubst0_fst i u c t3 c3 H6) e H7)) t5 H9)))) H8)) (\lambda +(H8: (ex3_2 T T (\lambda (u2: T).(\lambda (t6: T).(eq T t5 (THead (Flat Cast) +u2 t6)))) (\lambda (u2: T).(\lambda (_: T).(subst0 i u t3 u2))) (\lambda (_: +T).(\lambda (t6: T).(subst0 (s (Flat Cast) i) u t2 t6))))).(ex3_2_ind T T +(\lambda (u2: T).(\lambda (t6: T).(eq T t5 (THead (Flat Cast) u2 t6)))) +(\lambda (u2: T).(\lambda (_: T).(subst0 i u t3 u2))) (\lambda (_: +T).(\lambda (t6: T).(subst0 (s (Flat Cast) i) u t2 t6))) (ty3 g c3 t5 (THead +(Flat Cast) t0 t3)) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H9: (eq T t5 +(THead (Flat Cast) x0 x1))).(\lambda (H10: (subst0 i u t3 x0)).(\lambda (H11: +(subst0 (s (Flat Cast) i) u t2 x1)).(eq_ind_r T (THead (Flat Cast) x0 x1) +(\lambda (t6: T).(ty3 g c3 t6 (THead (Flat Cast) t0 t3))) (ex_ind T (\lambda +(t6: T).(ty3 g c3 t0 t6)) (ty3 g c3 (THead (Flat Cast) x0 x1) (THead (Flat +Cast) t0 t3)) (\lambda (x: T).(\lambda (H12: (ty3 g c3 t0 x)).(ty3_conv g c3 +(THead (Flat Cast) t0 t3) (THead (Flat Cast) x t0) (ty3_cast g c3 t3 t0 (H3 i +u c3 t3 (fsubst0_fst i u c t3 c3 H6) e H7) x H12) (THead (Flat Cast) x0 x1) +(THead (Flat Cast) t0 x0) (ty3_cast g c3 x1 x0 (ty3_conv g c3 x0 t0 (H3 i u +c3 x0 (fsubst0_both i u c t3 x0 H10 c3 H6) e H7) x1 t3 (H1 i u c3 x1 +(fsubst0_both i u c t2 x1 H11 c3 H6) e H7) (pc3_s c3 t3 x0 (pc3_fsubst0 c t3 +t3 (pc3_refl c t3) i u c3 x0 (fsubst0_both i u c t3 x0 H10 c3 H6) e H7))) t0 +(H3 i u c3 x0 (fsubst0_both i u c t3 x0 H10 c3 H6) e H7)) (pc3_fsubst0 c +(THead (Flat Cast) t0 t3) (THead (Flat Cast) t0 t3) (pc3_refl c (THead (Flat +Cast) t0 t3)) i u c3 (THead (Flat Cast) t0 x0) (fsubst0_both i u c (THead +(Flat Cast) t0 t3) (THead (Flat Cast) t0 x0) (subst0_snd (Flat Cast) u x0 t3 +i H10 t0) c3 H6) e H7)))) (ty3_correct g c3 t3 t0 (H3 i u c3 t3 (fsubst0_fst +i u c t3 c3 H6) e H7))) t5 H9)))))) H8)) (subst0_gen_head (Flat Cast) u t3 t2 +t5 i H5)))))))) c2 t4 H4)))))))))))))) c1 t1 t H))))). + +theorem ty3_csubst0: + \forall (g: G).(\forall (c1: C).(\forall (t1: T).(\forall (t2: T).((ty3 g c1 +t1 t2) \to (\forall (e: C).(\forall (u: T).(\forall (i: nat).((getl i c1 +(CHead e (Bind Abbr) u)) \to (\forall (c2: C).((csubst0 i u c1 c2) \to (ty3 g +c2 t1 t2))))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (ty3 g c1 t1 t2)).(\lambda (e: C).(\lambda (u: T).(\lambda (i: +nat).(\lambda (H0: (getl i c1 (CHead e (Bind Abbr) u))).(\lambda (c2: +C).(\lambda (H1: (csubst0 i u c1 c2)).(ty3_fsubst0 g c1 t1 t2 H i u c2 t1 +(fsubst0_fst i u c1 t1 c2 H1) e H0))))))))))). + +theorem ty3_subst0: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t: T).((ty3 g c t1 +t) \to (\forall (e: C).(\forall (u: T).(\forall (i: nat).((getl i c (CHead e +(Bind Abbr) u)) \to (\forall (t2: T).((subst0 i u t1 t2) \to (ty3 g c t2 +t))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t: T).(\lambda (H: +(ty3 g c t1 t)).(\lambda (e: C).(\lambda (u: T).(\lambda (i: nat).(\lambda +(H0: (getl i c (CHead e (Bind Abbr) u))).(\lambda (t2: T).(\lambda (H1: +(subst0 i u t1 t2)).(ty3_fsubst0 g c t1 t H i u c t2 (fsubst0_snd i u c t1 t2 +H1) e H0))))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fwd.ma new file mode 100644 index 000000000..5267f5c6a --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fwd.ma @@ -0,0 +1,954 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/fwd". + +include "ty3/defs.ma". + +include "pc3/props.ma". + +theorem ty3_gen_sort: + \forall (g: G).(\forall (c: C).(\forall (x: T).(\forall (n: nat).((ty3 g c +(TSort n) x) \to (pc3 c (TSort (next g n)) x))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (x: T).(\lambda (n: nat).(\lambda +(H: (ty3 g c (TSort n) x)).(insert_eq T (TSort n) (\lambda (t: T).(ty3 g c t +x)) (pc3 c (TSort (next g n)) x) (\lambda (y: T).(\lambda (H0: (ty3 g c y +x)).(ty3_ind g (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).((eq T t +(TSort n)) \to (pc3 c0 (TSort (next g n)) t0))))) (\lambda (c0: C).(\lambda +(t2: T).(\lambda (t: T).(\lambda (_: (ty3 g c0 t2 t)).(\lambda (_: (((eq T t2 +(TSort n)) \to (pc3 c0 (TSort (next g n)) t)))).(\lambda (u: T).(\lambda (t1: +T).(\lambda (H3: (ty3 g c0 u t1)).(\lambda (H4: (((eq T u (TSort n)) \to (pc3 +c0 (TSort (next g n)) t1)))).(\lambda (H5: (pc3 c0 t1 t2)).(\lambda (H6: (eq +T u (TSort n))).(let H7 \def (f_equal T T (\lambda (e: T).e) u (TSort n) H6) +in (let H8 \def (eq_ind T u (\lambda (t0: T).((eq T t0 (TSort n)) \to (pc3 c0 +(TSort (next g n)) t1))) H4 (TSort n) H7) in (let H9 \def (eq_ind T u +(\lambda (t0: T).(ty3 g c0 t0 t1)) H3 (TSort n) H7) in (pc3_t t1 c0 (TSort +(next g n)) (H8 (refl_equal T (TSort n))) t2 H5))))))))))))))) (\lambda (c0: +C).(\lambda (m: nat).(\lambda (H1: (eq T (TSort m) (TSort n))).(let H2 \def +(f_equal T nat (\lambda (e: T).(match e in T return (\lambda (_: T).nat) with +[(TSort n0) \Rightarrow n0 | (TLRef _) \Rightarrow m | (THead _ _ _) +\Rightarrow m])) (TSort m) (TSort n) H1) in (eq_ind_r nat n (\lambda (n0: +nat).(pc3 c0 (TSort (next g n)) (TSort (next g n0)))) (pc3_refl c0 (TSort +(next g n))) m H2))))) (\lambda (n0: nat).(\lambda (c0: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (_: (getl n0 c0 (CHead d (Bind Abbr) +u))).(\lambda (t: T).(\lambda (_: (ty3 g d u t)).(\lambda (_: (((eq T u +(TSort n)) \to (pc3 d (TSort (next g n)) t)))).(\lambda (H4: (eq T (TLRef n0) +(TSort n))).(let H5 \def (eq_ind T (TLRef n0) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (TSort n) H4) in +(False_ind (pc3 c0 (TSort (next g n)) (lift (S n0) O t)) H5))))))))))) +(\lambda (n0: nat).(\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda +(_: (getl n0 c0 (CHead d (Bind Abst) u))).(\lambda (t: T).(\lambda (_: (ty3 g +d u t)).(\lambda (_: (((eq T u (TSort n)) \to (pc3 d (TSort (next g n)) +t)))).(\lambda (H4: (eq T (TLRef n0) (TSort n))).(let H5 \def (eq_ind T +(TLRef n0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) +\Rightarrow False])) I (TSort n) H4) in (False_ind (pc3 c0 (TSort (next g n)) +(lift (S n0) O u)) H5))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda +(t: T).(\lambda (_: (ty3 g c0 u t)).(\lambda (_: (((eq T u (TSort n)) \to +(pc3 c0 (TSort (next g n)) t)))).(\lambda (b: B).(\lambda (t1: T).(\lambda +(t2: T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u) t1 t2)).(\lambda (_: (((eq +T t1 (TSort n)) \to (pc3 (CHead c0 (Bind b) u) (TSort (next g n)) +t2)))).(\lambda (t0: T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u) t2 +t0)).(\lambda (_: (((eq T t2 (TSort n)) \to (pc3 (CHead c0 (Bind b) u) (TSort +(next g n)) t0)))).(\lambda (H7: (eq T (THead (Bind b) u t1) (TSort n))).(let +H8 \def (eq_ind T (THead (Bind b) u t1) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n) H7) in +(False_ind (pc3 c0 (TSort (next g n)) (THead (Bind b) u t2)) +H8)))))))))))))))) (\lambda (c0: C).(\lambda (w: T).(\lambda (u: T).(\lambda +(_: (ty3 g c0 w u)).(\lambda (_: (((eq T w (TSort n)) \to (pc3 c0 (TSort +(next g n)) u)))).(\lambda (v: T).(\lambda (t: T).(\lambda (_: (ty3 g c0 v +(THead (Bind Abst) u t))).(\lambda (_: (((eq T v (TSort n)) \to (pc3 c0 +(TSort (next g n)) (THead (Bind Abst) u t))))).(\lambda (H5: (eq T (THead +(Flat Appl) w v) (TSort n))).(let H6 \def (eq_ind T (THead (Flat Appl) w v) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +True])) I (TSort n) H5) in (False_ind (pc3 c0 (TSort (next g n)) (THead (Flat +Appl) w (THead (Bind Abst) u t))) H6)))))))))))) (\lambda (c0: C).(\lambda +(t1: T).(\lambda (t2: T).(\lambda (_: (ty3 g c0 t1 t2)).(\lambda (_: (((eq T +t1 (TSort n)) \to (pc3 c0 (TSort (next g n)) t2)))).(\lambda (t0: T).(\lambda +(_: (ty3 g c0 t2 t0)).(\lambda (_: (((eq T t2 (TSort n)) \to (pc3 c0 (TSort +(next g n)) t0)))).(\lambda (H5: (eq T (THead (Flat Cast) t2 t1) (TSort +n))).(let H6 \def (eq_ind T (THead (Flat Cast) t2 t1) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort n) +H5) in (False_ind (pc3 c0 (TSort (next g n)) (THead (Flat Cast) t0 t2)) +H6))))))))))) c y x H0))) H))))). + +theorem ty3_gen_lref: + \forall (g: G).(\forall (c: C).(\forall (x: T).(\forall (n: nat).((ty3 g c +(TLRef n) x) \to (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda +(t: T).(pc3 c (lift (S n) O t) x)))) (\lambda (e: C).(\lambda (u: T).(\lambda +(_: T).(getl n c (CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: +T).(\lambda (t: T).(ty3 g e u t))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(pc3 c (lift (S n) O u) x)))) (\lambda (e: C).(\lambda +(u: T).(\lambda (_: T).(getl n c (CHead e (Bind Abst) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t)))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (x: T).(\lambda (n: nat).(\lambda +(H: (ty3 g c (TLRef n) x)).(insert_eq T (TLRef n) (\lambda (t: T).(ty3 g c t +x)) (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: T).(pc3 c +(lift (S n) O t) x)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl +n c (CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: +T).(ty3 g e u t))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(pc3 c (lift (S n) O u) x)))) (\lambda (e: C).(\lambda (u: T).(\lambda +(_: T).(getl n c (CHead e (Bind Abst) u))))) (\lambda (e: C).(\lambda (u: +T).(\lambda (t: T).(ty3 g e u t)))))) (\lambda (y: T).(\lambda (H0: (ty3 g c +y x)).(ty3_ind g (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).((eq T t +(TLRef n)) \to (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t1: +T).(pc3 c0 (lift (S n) O t1) t0)))) (\lambda (e: C).(\lambda (u: T).(\lambda +(_: T).(getl n c0 (CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: +T).(\lambda (t1: T).(ty3 g e u t1))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u) t0)))) (\lambda (e: +C).(\lambda (u: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u))))) +(\lambda (e: C).(\lambda (u: T).(\lambda (t1: T).(ty3 g e u t1)))))))))) +(\lambda (c0: C).(\lambda (t2: T).(\lambda (t: T).(\lambda (_: (ty3 g c0 t2 +t)).(\lambda (_: (((eq T t2 (TLRef n)) \to (or (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t)))) (\lambda +(e: C).(\lambda (u: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) u))))) +(\lambda (e: C).(\lambda (u: T).(\lambda (t0: T).(ty3 g e u t0))))) (ex3_3 C +T T (\lambda (_: C).(\lambda (u: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u) +t)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl n c0 (CHead e +(Bind Abst) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t0: T).(ty3 g e +u t0))))))))).(\lambda (u: T).(\lambda (t1: T).(\lambda (H3: (ty3 g c0 u +t1)).(\lambda (H4: (((eq T u (TLRef n)) \to (or (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t1)))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) +u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))) +(ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c0 (lift +(S n) O u0) t1)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n +c0 (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t0: T).(ty3 g e u0 t0))))))))).(\lambda (H5: (pc3 c0 t1 t2)).(\lambda (H6: +(eq T u (TLRef n))).(let H7 \def (f_equal T T (\lambda (e: T).e) u (TLRef n) +H6) in (let H8 \def (eq_ind T u (\lambda (t0: T).((eq T t0 (TLRef n)) \to (or +(ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t3: T).(pc3 c0 (lift +(S n) O t3) t1)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n +c0 (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t3: T).(ty3 g e u0 t3))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) t1)))) (\lambda (e: C).(\lambda +(u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t3: T).(ty3 g e u0 t3)))))))) H4 (TLRef n) H7) +in (let H9 \def (eq_ind T u (\lambda (t0: T).(ty3 g c0 t0 t1)) H3 (TLRef n) +H7) in (let H10 \def (H8 (refl_equal T (TLRef n))) in (or_ind (ex3_3 C T T +(\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) +t1)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e +(Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g +e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: +T).(pc3 c0 (lift (S n) O u0) t1)))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(_: T).(getl n c0 (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0))))) (or (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t2)))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) +u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))) +(ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c0 (lift +(S n) O u0) t2)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n +c0 (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t0: T).(ty3 g e u0 t0)))))) (\lambda (H11: (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t1)))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) +u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 +t0)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: +T).(pc3 c0 (lift (S n) O t0) t1)))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(_: T).(getl n c0 (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0)))) (or (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t2)))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) +u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))) +(ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c0 (lift +(S n) O u0) t2)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n +c0 (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t0: T).(ty3 g e u0 t0)))))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: +T).(\lambda (H12: (pc3 c0 (lift (S n) O x2) t1)).(\lambda (H13: (getl n c0 +(CHead x0 (Bind Abbr) x1))).(\lambda (H14: (ty3 g x0 x1 x2)).(or_introl +(ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift +(S n) O t0) t2)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n +c0 (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t0: T).(ty3 g e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) t2)))) (\lambda (e: C).(\lambda +(u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex3_3_intro C T T +(\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) +t2)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e +(Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g +e u0 t0)))) x0 x1 x2 (pc3_t t1 c0 (lift (S n) O x2) H12 t2 H5) H13 +H14)))))))) H11)) (\lambda (H11: (ex3_3 C T T (\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) t1)))) (\lambda (e: C).(\lambda +(u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0)))))).(ex3_3_ind C T T +(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) +t1)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e +(Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g +e u0 t0)))) (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: +T).(pc3 c0 (lift (S n) O t0) t2)))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(_: T).(getl n c0 (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) t2)))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0)))))) +(\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: T).(\lambda (H12: (pc3 c0 +(lift (S n) O x1) t1)).(\lambda (H13: (getl n c0 (CHead x0 (Bind Abst) +x1))).(\lambda (H14: (ty3 g x0 x1 x2)).(or_intror (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t2)))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) +u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))) +(ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c0 (lift +(S n) O u0) t2)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n +c0 (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(t0: T).(ty3 g e u0 t0))))) (ex3_3_intro C T T (\lambda (_: C).(\lambda (u0: +T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) t2)))) (\lambda (e: C).(\lambda +(u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0)))) x0 x1 x2 (pc3_t t1 c0 +(lift (S n) O x1) H12 t2 H5) H13 H14)))))))) H11)) H10)))))))))))))))) +(\lambda (c0: C).(\lambda (m: nat).(\lambda (H1: (eq T (TSort m) (TLRef +n))).(let H2 \def (eq_ind T (TSort m) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow False])) I (TLRef n) H1) in +(False_ind (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: +T).(pc3 c0 (lift (S n) O t) (TSort (next g m)))))) (\lambda (e: C).(\lambda +(u: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t))))) (ex3_3 C T T (\lambda +(_: C).(\lambda (u: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u) (TSort (next +g m)))))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl n c0 (CHead e +(Bind Abst) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u +t)))))) H2))))) (\lambda (n0: nat).(\lambda (c0: C).(\lambda (d: C).(\lambda +(u: T).(\lambda (H1: (getl n0 c0 (CHead d (Bind Abbr) u))).(\lambda (t: +T).(\lambda (H2: (ty3 g d u t)).(\lambda (_: (((eq T u (TLRef n)) \to (or +(ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 d (lift (S +n) O t0) t)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n d +(CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: +T).(ty3 g e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda +(_: T).(pc3 d (lift (S n) O u0) t)))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (_: T).(getl n d (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))))))).(\lambda (H4: +(eq T (TLRef n0) (TLRef n))).(let H5 \def (f_equal T nat (\lambda (e: +T).(match e in T return (\lambda (_: T).nat) with [(TSort _) \Rightarrow n0 | +(TLRef n1) \Rightarrow n1 | (THead _ _ _) \Rightarrow n0])) (TLRef n0) (TLRef +n) H4) in (let H6 \def (eq_ind nat n0 (\lambda (n1: nat).(getl n1 c0 (CHead d +(Bind Abbr) u))) H1 n H5) in (eq_ind_r nat n (\lambda (n1: nat).(or (ex3_3 C +T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O +t0) (lift (S n1) O t))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl n c0 (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) (lift (S n1) O t))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind +Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 +t0))))))) (or_introl (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda +(t0: T).(pc3 c0 (lift (S n) O t0) (lift (S n) O t))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex3_3 +C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c0 (lift (S n) O +u0) (lift (S n) O t))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl n c0 (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex3_3_intro C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) (lift (S n) O +t))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e +(Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g +e u0 t0)))) d u t (pc3_refl c0 (lift (S n) O t)) H6 H2)) n0 H5)))))))))))) +(\lambda (n0: nat).(\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda +(H1: (getl n0 c0 (CHead d (Bind Abst) u))).(\lambda (t: T).(\lambda (H2: (ty3 +g d u t)).(\lambda (_: (((eq T u (TLRef n)) \to (or (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 d (lift (S n) O t0) t)))) (\lambda +(e: C).(\lambda (u0: T).(\lambda (_: T).(getl n d (CHead e (Bind Abbr) +u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))) +(ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 d (lift (S +n) O u0) t)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n d +(CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: +T).(ty3 g e u0 t0))))))))).(\lambda (H4: (eq T (TLRef n0) (TLRef n))).(let H5 +\def (f_equal T nat (\lambda (e: T).(match e in T return (\lambda (_: T).nat) +with [(TSort _) \Rightarrow n0 | (TLRef n1) \Rightarrow n1 | (THead _ _ _) +\Rightarrow n0])) (TLRef n0) (TLRef n) H4) in (let H6 \def (eq_ind nat n0 +(\lambda (n1: nat).(getl n1 c0 (CHead d (Bind Abst) u))) H1 n H5) in +(eq_ind_r nat n (\lambda (n1: nat).(or (ex3_3 C T T (\lambda (_: C).(\lambda +(_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) (lift (S n1) O u))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind +Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 +t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c0 +(lift (S n) O u0) (lift (S n1) O u))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))))) (or_intror (ex3_3 +C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O +t0) (lift (S n) O u))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl n c0 (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) (lift (S n) O u))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind +Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 +t0))))) (ex3_3_intro C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: +T).(pc3 c0 (lift (S n) O u0) (lift (S n) O u))))) (\lambda (e: C).(\lambda +(u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0)))) d u t (pc3_refl c0 +(lift (S n) O u)) H6 H2)) n0 H5)))))))))))) (\lambda (c0: C).(\lambda (u: +T).(\lambda (t: T).(\lambda (_: (ty3 g c0 u t)).(\lambda (_: (((eq T u (TLRef +n)) \to (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: +T).(pc3 c0 (lift (S n) O t0) t)))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(_: T).(getl n c0 (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) t)))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 +t0))))))))).(\lambda (b: B).(\lambda (t1: T).(\lambda (t2: T).(\lambda (_: +(ty3 g (CHead c0 (Bind b) u) t1 t2)).(\lambda (_: (((eq T t1 (TLRef n)) \to +(or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 (CHead +c0 (Bind b) u) (lift (S n) O t0) t2)))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (_: T).(getl n (CHead c0 (Bind b) u) (CHead e (Bind Abbr) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex3_3 +C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 (CHead c0 (Bind +b) u) (lift (S n) O u0) t2)))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl n (CHead c0 (Bind b) u) (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))))))).(\lambda (t0: +T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u) t2 t0)).(\lambda (_: (((eq T t2 +(TLRef n)) \to (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t3: +T).(pc3 (CHead c0 (Bind b) u) (lift (S n) O t3) t0)))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (_: T).(getl n (CHead c0 (Bind b) u) (CHead e +(Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t3: T).(ty3 g +e u0 t3))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: +T).(pc3 (CHead c0 (Bind b) u) (lift (S n) O u0) t0)))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (_: T).(getl n (CHead c0 (Bind b) u) (CHead e +(Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t3: T).(ty3 g +e u0 t3))))))))).(\lambda (H7: (eq T (THead (Bind b) u t1) (TLRef n))).(let +H8 \def (eq_ind T (THead (Bind b) u t1) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n) H7) in +(False_ind (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t3: +T).(pc3 c0 (lift (S n) O t3) (THead (Bind b) u t2))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t3: T).(ty3 g e u0 t3))))) (ex3_3 +C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c0 (lift (S n) O +u0) (THead (Bind b) u t2))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl n c0 (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t3: T).(ty3 g e u0 t3)))))) H8)))))))))))))))) (\lambda (c0: +C).(\lambda (w: T).(\lambda (u: T).(\lambda (_: (ty3 g c0 w u)).(\lambda (_: +(((eq T w (TLRef n)) \to (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: +T).(\lambda (t: T).(pc3 c0 (lift (S n) O t) u)))) (\lambda (e: C).(\lambda +(u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 t))))) (ex3_3 C T T (\lambda +(_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) u)))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind +Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t: T).(ty3 g e u0 +t))))))))).(\lambda (v: T).(\lambda (t: T).(\lambda (_: (ty3 g c0 v (THead +(Bind Abst) u t))).(\lambda (_: (((eq T v (TLRef n)) \to (or (ex3_3 C T T +(\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) +(THead (Bind Abst) u t))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl n c0 (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u0: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u0) (THead (Bind Abst) u t))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e (Bind +Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 +t0))))))))).(\lambda (H5: (eq T (THead (Flat Appl) w v) (TLRef n))).(let H6 +\def (eq_ind T (THead (Flat Appl) w v) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TLRef n) H5) in +(False_ind (or (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: +T).(pc3 c0 (lift (S n) O t0) (THead (Flat Appl) w (THead (Bind Abst) u +t)))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e +(Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g +e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: +T).(pc3 c0 (lift (S n) O u0) (THead (Flat Appl) w (THead (Bind Abst) u +t)))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl n c0 (CHead e +(Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g +e u0 t0)))))) H6)))))))))))) (\lambda (c0: C).(\lambda (t1: T).(\lambda (t2: +T).(\lambda (_: (ty3 g c0 t1 t2)).(\lambda (_: (((eq T t1 (TLRef n)) \to (or +(ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: T).(pc3 c0 (lift (S +n) O t) t2)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl n c0 +(CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: +T).(ty3 g e u t))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(pc3 c0 (lift (S n) O u) t2)))) (\lambda (e: C).(\lambda (u: +T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t))))))))).(\lambda (t0: +T).(\lambda (_: (ty3 g c0 t2 t0)).(\lambda (_: (((eq T t2 (TLRef n)) \to (or +(ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t: T).(pc3 c0 (lift (S +n) O t) t0)))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl n c0 +(CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: +T).(ty3 g e u t))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u: T).(\lambda +(_: T).(pc3 c0 (lift (S n) O u) t0)))) (\lambda (e: C).(\lambda (u: +T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u))))) (\lambda (e: +C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u t))))))))).(\lambda (H5: (eq T +(THead (Flat Cast) t2 t1) (TLRef n))).(let H6 \def (eq_ind T (THead (Flat +Cast) t2 t1) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ +_) \Rightarrow True])) I (TLRef n) H5) in (False_ind (or (ex3_3 C T T +(\lambda (_: C).(\lambda (_: T).(\lambda (t: T).(pc3 c0 (lift (S n) O t) +(THead (Flat Cast) t0 t2))))) (\lambda (e: C).(\lambda (u: T).(\lambda (_: +T).(getl n c0 (CHead e (Bind Abbr) u))))) (\lambda (e: C).(\lambda (u: +T).(\lambda (t: T).(ty3 g e u t))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u) (THead (Flat Cast) t0 t2))))) +(\lambda (e: C).(\lambda (u: T).(\lambda (_: T).(getl n c0 (CHead e (Bind +Abst) u))))) (\lambda (e: C).(\lambda (u: T).(\lambda (t: T).(ty3 g e u +t)))))) H6))))))))))) c y x H0))) H))))). + +theorem ty3_gen_bind: + \forall (g: G).(\forall (b: B).(\forall (c: C).(\forall (u: T).(\forall (t1: +T).(\forall (x: T).((ty3 g c (THead (Bind b) u t1) x) \to (ex4_3 T T T +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 c (THead (Bind b) u t2) +x)))) (\lambda (_: T).(\lambda (t: T).(\lambda (_: T).(ty3 g c u t)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c (Bind b) u) +t1 t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t0: T).(ty3 g (CHead c +(Bind b) u) t2 t0))))))))))) +\def + \lambda (g: G).(\lambda (b: B).(\lambda (c: C).(\lambda (u: T).(\lambda (t1: +T).(\lambda (x: T).(\lambda (H: (ty3 g c (THead (Bind b) u t1) x)).(insert_eq +T (THead (Bind b) u t1) (\lambda (t: T).(ty3 g c t x)) (ex4_3 T T T (\lambda +(t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 c (THead (Bind b) u t2) x)))) +(\lambda (_: T).(\lambda (t: T).(\lambda (_: T).(ty3 g c u t)))) (\lambda +(t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c (Bind b) u) t1 t2)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (t0: T).(ty3 g (CHead c (Bind b) u) +t2 t0))))) (\lambda (y: T).(\lambda (H0: (ty3 g c y x)).(ty3_ind g (\lambda +(c0: C).(\lambda (t: T).(\lambda (t0: T).((eq T t (THead (Bind b) u t1)) \to +(ex4_3 T T T (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead +(Bind b) u t2) t0)))) (\lambda (_: T).(\lambda (t3: T).(\lambda (_: T).(ty3 g +c0 u t3)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 +(Bind b) u) t1 t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t4: T).(ty3 +g (CHead c0 (Bind b) u) t2 t4))))))))) (\lambda (c0: C).(\lambda (t2: +T).(\lambda (t: T).(\lambda (_: (ty3 g c0 t2 t)).(\lambda (_: (((eq T t2 +(THead (Bind b) u t1)) \to (ex4_3 T T T (\lambda (t3: T).(\lambda (_: +T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u t3) t)))) (\lambda (_: +T).(\lambda (t0: T).(\lambda (_: T).(ty3 g c0 u t0)))) (\lambda (t3: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 t3)))) +(\lambda (t3: T).(\lambda (_: T).(\lambda (t4: T).(ty3 g (CHead c0 (Bind b) +u) t3 t4)))))))).(\lambda (u0: T).(\lambda (t0: T).(\lambda (H3: (ty3 g c0 u0 +t0)).(\lambda (H4: (((eq T u0 (THead (Bind b) u t1)) \to (ex4_3 T T T +(\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u +t3) t0)))) (\lambda (_: T).(\lambda (t4: T).(\lambda (_: T).(ty3 g c0 u +t4)))) (\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 +(Bind b) u) t1 t3)))) (\lambda (t3: T).(\lambda (_: T).(\lambda (t5: T).(ty3 +g (CHead c0 (Bind b) u) t3 t5)))))))).(\lambda (H5: (pc3 c0 t0 t2)).(\lambda +(H6: (eq T u0 (THead (Bind b) u t1))).(let H7 \def (f_equal T T (\lambda (e: +T).e) u0 (THead (Bind b) u t1) H6) in (let H8 \def (eq_ind T u0 (\lambda (t3: +T).((eq T t3 (THead (Bind b) u t1)) \to (ex4_3 T T T (\lambda (t4: +T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u t4) t0)))) +(\lambda (_: T).(\lambda (t5: T).(\lambda (_: T).(ty3 g c0 u t5)))) (\lambda +(t4: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 +t4)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (t6: T).(ty3 g (CHead c0 +(Bind b) u) t4 t6))))))) H4 (THead (Bind b) u t1) H7) in (let H9 \def (eq_ind +T u0 (\lambda (t3: T).(ty3 g c0 t3 t0)) H3 (THead (Bind b) u t1) H7) in (let +H10 \def (H8 (refl_equal T (THead (Bind b) u t1))) in (ex4_3_ind T T T +(\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u +t3) t0)))) (\lambda (_: T).(\lambda (t4: T).(\lambda (_: T).(ty3 g c0 u +t4)))) (\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 +(Bind b) u) t1 t3)))) (\lambda (t3: T).(\lambda (_: T).(\lambda (t5: T).(ty3 +g (CHead c0 (Bind b) u) t3 t5)))) (ex4_3 T T T (\lambda (t3: T).(\lambda (_: +T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u t3) t2)))) (\lambda (_: +T).(\lambda (t4: T).(\lambda (_: T).(ty3 g c0 u t4)))) (\lambda (t3: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 t3)))) +(\lambda (t3: T).(\lambda (_: T).(\lambda (t5: T).(ty3 g (CHead c0 (Bind b) +u) t3 t5))))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: T).(\lambda +(H11: (pc3 c0 (THead (Bind b) u x0) t0)).(\lambda (H12: (ty3 g c0 u +x1)).(\lambda (H13: (ty3 g (CHead c0 (Bind b) u) t1 x0)).(\lambda (H14: (ty3 +g (CHead c0 (Bind b) u) x0 x2)).(ex4_3_intro T T T (\lambda (t3: T).(\lambda +(_: T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u t3) t2)))) (\lambda (_: +T).(\lambda (t4: T).(\lambda (_: T).(ty3 g c0 u t4)))) (\lambda (t3: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 t3)))) +(\lambda (t3: T).(\lambda (_: T).(\lambda (t5: T).(ty3 g (CHead c0 (Bind b) +u) t3 t5)))) x0 x1 x2 (pc3_t t0 c0 (THead (Bind b) u x0) H11 t2 H5) H12 H13 +H14)))))))) H10)))))))))))))))) (\lambda (c0: C).(\lambda (m: nat).(\lambda +(H1: (eq T (TSort m) (THead (Bind b) u t1))).(let H2 \def (eq_ind T (TSort m) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +False])) I (THead (Bind b) u t1) H1) in (False_ind (ex4_3 T T T (\lambda (t2: +T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u t2) (TSort (next +g m)))))) (\lambda (_: T).(\lambda (t: T).(\lambda (_: T).(ty3 g c0 u t)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) +t1 t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t0: T).(ty3 g (CHead c0 +(Bind b) u) t2 t0))))) H2))))) (\lambda (n: nat).(\lambda (c0: C).(\lambda +(d: C).(\lambda (u0: T).(\lambda (_: (getl n c0 (CHead d (Bind Abbr) +u0))).(\lambda (t: T).(\lambda (_: (ty3 g d u0 t)).(\lambda (_: (((eq T u0 +(THead (Bind b) u t1)) \to (ex4_3 T T T (\lambda (t2: T).(\lambda (_: +T).(\lambda (_: T).(pc3 d (THead (Bind b) u t2) t)))) (\lambda (_: +T).(\lambda (t0: T).(\lambda (_: T).(ty3 g d u t0)))) (\lambda (t2: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead d (Bind b) u) t1 t2)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (t3: T).(ty3 g (CHead d (Bind b) u) +t2 t3)))))))).(\lambda (H4: (eq T (TLRef n) (THead (Bind b) u t1))).(let H5 +\def (eq_ind T (TLRef n) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead (Bind b) u t1) H4) in (False_ind +(ex4_3 T T T (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead +(Bind b) u t2) (lift (S n) O t))))) (\lambda (_: T).(\lambda (t0: T).(\lambda +(_: T).(ty3 g c0 u t0)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (_: +T).(ty3 g (CHead c0 (Bind b) u) t1 t2)))) (\lambda (t2: T).(\lambda (_: +T).(\lambda (t3: T).(ty3 g (CHead c0 (Bind b) u) t2 t3))))) H5))))))))))) +(\lambda (n: nat).(\lambda (c0: C).(\lambda (d: C).(\lambda (u0: T).(\lambda +(_: (getl n c0 (CHead d (Bind Abst) u0))).(\lambda (t: T).(\lambda (_: (ty3 g +d u0 t)).(\lambda (_: (((eq T u0 (THead (Bind b) u t1)) \to (ex4_3 T T T +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 d (THead (Bind b) u t2) +t)))) (\lambda (_: T).(\lambda (t0: T).(\lambda (_: T).(ty3 g d u t0)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead d (Bind b) u) +t1 t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t3: T).(ty3 g (CHead d +(Bind b) u) t2 t3)))))))).(\lambda (H4: (eq T (TLRef n) (THead (Bind b) u +t1))).(let H5 \def (eq_ind T (TLRef n) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead (Bind b) u t1) +H4) in (False_ind (ex4_3 T T T (\lambda (t2: T).(\lambda (_: T).(\lambda (_: +T).(pc3 c0 (THead (Bind b) u t2) (lift (S n) O u0))))) (\lambda (_: +T).(\lambda (t0: T).(\lambda (_: T).(ty3 g c0 u t0)))) (\lambda (t2: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 t2)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (t3: T).(ty3 g (CHead c0 (Bind b) +u) t2 t3))))) H5))))))))))) (\lambda (c0: C).(\lambda (u0: T).(\lambda (t: +T).(\lambda (H1: (ty3 g c0 u0 t)).(\lambda (H2: (((eq T u0 (THead (Bind b) u +t1)) \to (ex4_3 T T T (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 +c0 (THead (Bind b) u t2) t)))) (\lambda (_: T).(\lambda (t0: T).(\lambda (_: +T).(ty3 g c0 u t0)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g +(CHead c0 (Bind b) u) t1 t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda +(t3: T).(ty3 g (CHead c0 (Bind b) u) t2 t3)))))))).(\lambda (b0: B).(\lambda +(t0: T).(\lambda (t2: T).(\lambda (H3: (ty3 g (CHead c0 (Bind b0) u0) t0 +t2)).(\lambda (H4: (((eq T t0 (THead (Bind b) u t1)) \to (ex4_3 T T T +(\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(pc3 (CHead c0 (Bind b0) u0) +(THead (Bind b) u t3) t2)))) (\lambda (_: T).(\lambda (t4: T).(\lambda (_: +T).(ty3 g (CHead c0 (Bind b0) u0) u t4)))) (\lambda (t3: T).(\lambda (_: +T).(\lambda (_: T).(ty3 g (CHead (CHead c0 (Bind b0) u0) (Bind b) u) t1 +t3)))) (\lambda (t3: T).(\lambda (_: T).(\lambda (t5: T).(ty3 g (CHead (CHead +c0 (Bind b0) u0) (Bind b) u) t3 t5)))))))).(\lambda (t3: T).(\lambda (H5: +(ty3 g (CHead c0 (Bind b0) u0) t2 t3)).(\lambda (H6: (((eq T t2 (THead (Bind +b) u t1)) \to (ex4_3 T T T (\lambda (t4: T).(\lambda (_: T).(\lambda (_: +T).(pc3 (CHead c0 (Bind b0) u0) (THead (Bind b) u t4) t3)))) (\lambda (_: +T).(\lambda (t5: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b0) u0) u t5)))) +(\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead (CHead c0 +(Bind b0) u0) (Bind b) u) t1 t4)))) (\lambda (t4: T).(\lambda (_: T).(\lambda +(t6: T).(ty3 g (CHead (CHead c0 (Bind b0) u0) (Bind b) u) t4 +t6)))))))).(\lambda (H7: (eq T (THead (Bind b0) u0 t0) (THead (Bind b) u +t1))).(let H8 \def (f_equal T B (\lambda (e: T).(match e in T return (\lambda +(_: T).B) with [(TSort _) \Rightarrow b0 | (TLRef _) \Rightarrow b0 | (THead +k _ _) \Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b1) +\Rightarrow b1 | (Flat _) \Rightarrow b0])])) (THead (Bind b0) u0 t0) (THead +(Bind b) u t1) H7) in ((let H9 \def (f_equal T T (\lambda (e: T).(match e in +T return (\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) +\Rightarrow u0 | (THead _ t4 _) \Rightarrow t4])) (THead (Bind b0) u0 t0) +(THead (Bind b) u t1) H7) in ((let H10 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t0 | +(TLRef _) \Rightarrow t0 | (THead _ _ t4) \Rightarrow t4])) (THead (Bind b0) +u0 t0) (THead (Bind b) u t1) H7) in (\lambda (H11: (eq T u0 u)).(\lambda +(H12: (eq B b0 b)).(let H13 \def (eq_ind T t0 (\lambda (t4: T).((eq T t4 +(THead (Bind b) u t1)) \to (ex4_3 T T T (\lambda (t5: T).(\lambda (_: +T).(\lambda (_: T).(pc3 (CHead c0 (Bind b0) u0) (THead (Bind b) u t5) t2)))) +(\lambda (_: T).(\lambda (t6: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b0) +u0) u t6)))) (\lambda (t5: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead +(CHead c0 (Bind b0) u0) (Bind b) u) t1 t5)))) (\lambda (t5: T).(\lambda (_: +T).(\lambda (t7: T).(ty3 g (CHead (CHead c0 (Bind b0) u0) (Bind b) u) t5 +t7))))))) H4 t1 H10) in (let H14 \def (eq_ind T t0 (\lambda (t4: T).(ty3 g +(CHead c0 (Bind b0) u0) t4 t2)) H3 t1 H10) in (let H15 \def (eq_ind B b0 +(\lambda (b1: B).((eq T t2 (THead (Bind b) u t1)) \to (ex4_3 T T T (\lambda +(t4: T).(\lambda (_: T).(\lambda (_: T).(pc3 (CHead c0 (Bind b1) u0) (THead +(Bind b) u t4) t3)))) (\lambda (_: T).(\lambda (t5: T).(\lambda (_: T).(ty3 g +(CHead c0 (Bind b1) u0) u t5)))) (\lambda (t4: T).(\lambda (_: T).(\lambda +(_: T).(ty3 g (CHead (CHead c0 (Bind b1) u0) (Bind b) u) t1 t4)))) (\lambda +(t4: T).(\lambda (_: T).(\lambda (t6: T).(ty3 g (CHead (CHead c0 (Bind b1) +u0) (Bind b) u) t4 t6))))))) H6 b H12) in (let H16 \def (eq_ind B b0 (\lambda +(b1: B).(ty3 g (CHead c0 (Bind b1) u0) t2 t3)) H5 b H12) in (let H17 \def +(eq_ind B b0 (\lambda (b1: B).((eq T t1 (THead (Bind b) u t1)) \to (ex4_3 T T +T (\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(pc3 (CHead c0 (Bind b1) +u0) (THead (Bind b) u t4) t2)))) (\lambda (_: T).(\lambda (t5: T).(\lambda +(_: T).(ty3 g (CHead c0 (Bind b1) u0) u t5)))) (\lambda (t4: T).(\lambda (_: +T).(\lambda (_: T).(ty3 g (CHead (CHead c0 (Bind b1) u0) (Bind b) u) t1 +t4)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (t6: T).(ty3 g (CHead (CHead +c0 (Bind b1) u0) (Bind b) u) t4 t6))))))) H13 b H12) in (let H18 \def (eq_ind +B b0 (\lambda (b1: B).(ty3 g (CHead c0 (Bind b1) u0) t1 t2)) H14 b H12) in +(eq_ind_r B b (\lambda (b1: B).(ex4_3 T T T (\lambda (t4: T).(\lambda (_: +T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u t4) (THead (Bind b1) u0 t2))))) +(\lambda (_: T).(\lambda (t5: T).(\lambda (_: T).(ty3 g c0 u t5)))) (\lambda +(t4: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 +t4)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (t6: T).(ty3 g (CHead c0 +(Bind b) u) t4 t6)))))) (let H19 \def (eq_ind T u0 (\lambda (t4: T).((eq T t2 +(THead (Bind b) u t1)) \to (ex4_3 T T T (\lambda (t5: T).(\lambda (_: +T).(\lambda (_: T).(pc3 (CHead c0 (Bind b) t4) (THead (Bind b) u t5) t3)))) +(\lambda (_: T).(\lambda (t6: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) +t4) u t6)))) (\lambda (t5: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead +(CHead c0 (Bind b) t4) (Bind b) u) t1 t5)))) (\lambda (t5: T).(\lambda (_: +T).(\lambda (t7: T).(ty3 g (CHead (CHead c0 (Bind b) t4) (Bind b) u) t5 +t7))))))) H15 u H11) in (let H20 \def (eq_ind T u0 (\lambda (t4: T).(ty3 g +(CHead c0 (Bind b) t4) t2 t3)) H16 u H11) in (let H21 \def (eq_ind T u0 +(\lambda (t4: T).((eq T t1 (THead (Bind b) u t1)) \to (ex4_3 T T T (\lambda +(t5: T).(\lambda (_: T).(\lambda (_: T).(pc3 (CHead c0 (Bind b) t4) (THead +(Bind b) u t5) t2)))) (\lambda (_: T).(\lambda (t6: T).(\lambda (_: T).(ty3 g +(CHead c0 (Bind b) t4) u t6)))) (\lambda (t5: T).(\lambda (_: T).(\lambda (_: +T).(ty3 g (CHead (CHead c0 (Bind b) t4) (Bind b) u) t1 t5)))) (\lambda (t5: +T).(\lambda (_: T).(\lambda (t7: T).(ty3 g (CHead (CHead c0 (Bind b) t4) +(Bind b) u) t5 t7))))))) H17 u H11) in (let H22 \def (eq_ind T u0 (\lambda +(t4: T).(ty3 g (CHead c0 (Bind b) t4) t1 t2)) H18 u H11) in (let H23 \def +(eq_ind T u0 (\lambda (t4: T).((eq T t4 (THead (Bind b) u t1)) \to (ex4_3 T T +T (\lambda (t5: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u +t5) t)))) (\lambda (_: T).(\lambda (t6: T).(\lambda (_: T).(ty3 g c0 u t6)))) +(\lambda (t5: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) +t1 t5)))) (\lambda (t5: T).(\lambda (_: T).(\lambda (t7: T).(ty3 g (CHead c0 +(Bind b) u) t5 t7))))))) H2 u H11) in (let H24 \def (eq_ind T u0 (\lambda +(t4: T).(ty3 g c0 t4 t)) H1 u H11) in (eq_ind_r T u (\lambda (t4: T).(ex4_3 T +T T (\lambda (t5: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind b) +u t5) (THead (Bind b) t4 t2))))) (\lambda (_: T).(\lambda (t6: T).(\lambda +(_: T).(ty3 g c0 u t6)))) (\lambda (t5: T).(\lambda (_: T).(\lambda (_: +T).(ty3 g (CHead c0 (Bind b) u) t1 t5)))) (\lambda (t5: T).(\lambda (_: +T).(\lambda (t7: T).(ty3 g (CHead c0 (Bind b) u) t5 t7)))))) (ex4_3_intro T T +T (\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u +t4) (THead (Bind b) u t2))))) (\lambda (_: T).(\lambda (t5: T).(\lambda (_: +T).(ty3 g c0 u t5)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(ty3 g +(CHead c0 (Bind b) u) t1 t4)))) (\lambda (t4: T).(\lambda (_: T).(\lambda +(t6: T).(ty3 g (CHead c0 (Bind b) u) t4 t6)))) t2 t t3 (pc3_refl c0 (THead +(Bind b) u t2)) H24 H22 H20) u0 H11))))))) b0 H12)))))))))) H9)) +H8)))))))))))))))) (\lambda (c0: C).(\lambda (w: T).(\lambda (u0: T).(\lambda +(_: (ty3 g c0 w u0)).(\lambda (_: (((eq T w (THead (Bind b) u t1)) \to (ex4_3 +T T T (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind +b) u t2) u0)))) (\lambda (_: T).(\lambda (t: T).(\lambda (_: T).(ty3 g c0 u +t)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind +b) u) t1 t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t0: T).(ty3 g +(CHead c0 (Bind b) u) t2 t0)))))))).(\lambda (v: T).(\lambda (t: T).(\lambda +(_: (ty3 g c0 v (THead (Bind Abst) u0 t))).(\lambda (_: (((eq T v (THead +(Bind b) u t1)) \to (ex4_3 T T T (\lambda (t2: T).(\lambda (_: T).(\lambda +(_: T).(pc3 c0 (THead (Bind b) u t2) (THead (Bind Abst) u0 t))))) (\lambda +(_: T).(\lambda (t0: T).(\lambda (_: T).(ty3 g c0 u t0)))) (\lambda (t2: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 t2)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (t3: T).(ty3 g (CHead c0 (Bind b) +u) t2 t3)))))))).(\lambda (H5: (eq T (THead (Flat Appl) w v) (THead (Bind b) +u t1))).(let H6 \def (eq_ind T (THead (Flat Appl) w v) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) +\Rightarrow True])])) I (THead (Bind b) u t1) H5) in (False_ind (ex4_3 T T T +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u +t2) (THead (Flat Appl) w (THead (Bind Abst) u0 t)))))) (\lambda (_: +T).(\lambda (t0: T).(\lambda (_: T).(ty3 g c0 u t0)))) (\lambda (t2: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 t2)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (t3: T).(ty3 g (CHead c0 (Bind b) +u) t2 t3))))) H6)))))))))))) (\lambda (c0: C).(\lambda (t0: T).(\lambda (t2: +T).(\lambda (_: (ty3 g c0 t0 t2)).(\lambda (_: (((eq T t0 (THead (Bind b) u +t1)) \to (ex4_3 T T T (\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(pc3 +c0 (THead (Bind b) u t3) t2)))) (\lambda (_: T).(\lambda (t: T).(\lambda (_: +T).(ty3 g c0 u t)))) (\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(ty3 g +(CHead c0 (Bind b) u) t1 t3)))) (\lambda (t3: T).(\lambda (_: T).(\lambda +(t4: T).(ty3 g (CHead c0 (Bind b) u) t3 t4)))))))).(\lambda (t3: T).(\lambda +(_: (ty3 g c0 t2 t3)).(\lambda (_: (((eq T t2 (THead (Bind b) u t1)) \to +(ex4_3 T T T (\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead +(Bind b) u t4) t3)))) (\lambda (_: T).(\lambda (t: T).(\lambda (_: T).(ty3 g +c0 u t)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 +(Bind b) u) t1 t4)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (t5: T).(ty3 +g (CHead c0 (Bind b) u) t4 t5)))))))).(\lambda (H5: (eq T (THead (Flat Cast) +t2 t0) (THead (Bind b) u t1))).(let H6 \def (eq_ind T (THead (Flat Cast) t2 +t0) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind b) u t1) +H5) in (False_ind (ex4_3 T T T (\lambda (t4: T).(\lambda (_: T).(\lambda (_: +T).(pc3 c0 (THead (Bind b) u t4) (THead (Flat Cast) t3 t2))))) (\lambda (_: +T).(\lambda (t: T).(\lambda (_: T).(ty3 g c0 u t)))) (\lambda (t4: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 t4)))) +(\lambda (t4: T).(\lambda (_: T).(\lambda (t5: T).(ty3 g (CHead c0 (Bind b) +u) t4 t5))))) H6))))))))))) c y x H0))) H))))))). + +theorem ty3_gen_appl: + \forall (g: G).(\forall (c: C).(\forall (w: T).(\forall (v: T).(\forall (x: +T).((ty3 g c (THead (Flat Appl) w v) x) \to (ex3_2 T T (\lambda (u: +T).(\lambda (t: T).(pc3 c (THead (Flat Appl) w (THead (Bind Abst) u t)) x))) +(\lambda (u: T).(\lambda (t: T).(ty3 g c v (THead (Bind Abst) u t)))) +(\lambda (u: T).(\lambda (_: T).(ty3 g c w u))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (w: T).(\lambda (v: T).(\lambda (x: +T).(\lambda (H: (ty3 g c (THead (Flat Appl) w v) x)).(insert_eq T (THead +(Flat Appl) w v) (\lambda (t: T).(ty3 g c t x)) (ex3_2 T T (\lambda (u: +T).(\lambda (t: T).(pc3 c (THead (Flat Appl) w (THead (Bind Abst) u t)) x))) +(\lambda (u: T).(\lambda (t: T).(ty3 g c v (THead (Bind Abst) u t)))) +(\lambda (u: T).(\lambda (_: T).(ty3 g c w u)))) (\lambda (y: T).(\lambda +(H0: (ty3 g c y x)).(ty3_ind g (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: +T).((eq T t (THead (Flat Appl) w v)) \to (ex3_2 T T (\lambda (u: T).(\lambda +(t1: T).(pc3 c0 (THead (Flat Appl) w (THead (Bind Abst) u t1)) t0))) (\lambda +(u: T).(\lambda (t1: T).(ty3 g c0 v (THead (Bind Abst) u t1)))) (\lambda (u: +T).(\lambda (_: T).(ty3 g c0 w u)))))))) (\lambda (c0: C).(\lambda (t2: +T).(\lambda (t: T).(\lambda (_: (ty3 g c0 t2 t)).(\lambda (_: (((eq T t2 +(THead (Flat Appl) w v)) \to (ex3_2 T T (\lambda (u: T).(\lambda (t0: T).(pc3 +c0 (THead (Flat Appl) w (THead (Bind Abst) u t0)) t))) (\lambda (u: +T).(\lambda (t0: T).(ty3 g c0 v (THead (Bind Abst) u t0)))) (\lambda (u: +T).(\lambda (_: T).(ty3 g c0 w u))))))).(\lambda (u: T).(\lambda (t1: +T).(\lambda (H3: (ty3 g c0 u t1)).(\lambda (H4: (((eq T u (THead (Flat Appl) +w v)) \to (ex3_2 T T (\lambda (u0: T).(\lambda (t0: T).(pc3 c0 (THead (Flat +Appl) w (THead (Bind Abst) u0 t0)) t1))) (\lambda (u0: T).(\lambda (t0: +T).(ty3 g c0 v (THead (Bind Abst) u0 t0)))) (\lambda (u0: T).(\lambda (_: +T).(ty3 g c0 w u0))))))).(\lambda (H5: (pc3 c0 t1 t2)).(\lambda (H6: (eq T u +(THead (Flat Appl) w v))).(let H7 \def (f_equal T T (\lambda (e: T).e) u +(THead (Flat Appl) w v) H6) in (let H8 \def (eq_ind T u (\lambda (t0: T).((eq +T t0 (THead (Flat Appl) w v)) \to (ex3_2 T T (\lambda (u0: T).(\lambda (t3: +T).(pc3 c0 (THead (Flat Appl) w (THead (Bind Abst) u0 t3)) t1))) (\lambda +(u0: T).(\lambda (t3: T).(ty3 g c0 v (THead (Bind Abst) u0 t3)))) (\lambda +(u0: T).(\lambda (_: T).(ty3 g c0 w u0)))))) H4 (THead (Flat Appl) w v) H7) +in (let H9 \def (eq_ind T u (\lambda (t0: T).(ty3 g c0 t0 t1)) H3 (THead +(Flat Appl) w v) H7) in (let H10 \def (H8 (refl_equal T (THead (Flat Appl) w +v))) in (ex3_2_ind T T (\lambda (u0: T).(\lambda (t0: T).(pc3 c0 (THead (Flat +Appl) w (THead (Bind Abst) u0 t0)) t1))) (\lambda (u0: T).(\lambda (t0: +T).(ty3 g c0 v (THead (Bind Abst) u0 t0)))) (\lambda (u0: T).(\lambda (_: +T).(ty3 g c0 w u0))) (ex3_2 T T (\lambda (u0: T).(\lambda (t0: T).(pc3 c0 +(THead (Flat Appl) w (THead (Bind Abst) u0 t0)) t2))) (\lambda (u0: +T).(\lambda (t0: T).(ty3 g c0 v (THead (Bind Abst) u0 t0)))) (\lambda (u0: +T).(\lambda (_: T).(ty3 g c0 w u0)))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H11: (pc3 c0 (THead (Flat Appl) w (THead (Bind Abst) x0 x1)) +t1)).(\lambda (H12: (ty3 g c0 v (THead (Bind Abst) x0 x1))).(\lambda (H13: +(ty3 g c0 w x0)).(ex3_2_intro T T (\lambda (u0: T).(\lambda (t0: T).(pc3 c0 +(THead (Flat Appl) w (THead (Bind Abst) u0 t0)) t2))) (\lambda (u0: +T).(\lambda (t0: T).(ty3 g c0 v (THead (Bind Abst) u0 t0)))) (\lambda (u0: +T).(\lambda (_: T).(ty3 g c0 w u0))) x0 x1 (pc3_t t1 c0 (THead (Flat Appl) w +(THead (Bind Abst) x0 x1)) H11 t2 H5) H12 H13)))))) H10)))))))))))))))) +(\lambda (c0: C).(\lambda (m: nat).(\lambda (H1: (eq T (TSort m) (THead (Flat +Appl) w v))).(let H2 \def (eq_ind T (TSort m) (\lambda (ee: T).(match ee in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow False])) I (THead (Flat Appl) w +v) H1) in (False_ind (ex3_2 T T (\lambda (u: T).(\lambda (t: T).(pc3 c0 +(THead (Flat Appl) w (THead (Bind Abst) u t)) (TSort (next g m))))) (\lambda +(u: T).(\lambda (t: T).(ty3 g c0 v (THead (Bind Abst) u t)))) (\lambda (u: +T).(\lambda (_: T).(ty3 g c0 w u)))) H2))))) (\lambda (n: nat).(\lambda (c0: +C).(\lambda (d: C).(\lambda (u: T).(\lambda (_: (getl n c0 (CHead d (Bind +Abbr) u))).(\lambda (t: T).(\lambda (_: (ty3 g d u t)).(\lambda (_: (((eq T u +(THead (Flat Appl) w v)) \to (ex3_2 T T (\lambda (u0: T).(\lambda (t0: +T).(pc3 d (THead (Flat Appl) w (THead (Bind Abst) u0 t0)) t))) (\lambda (u0: +T).(\lambda (t0: T).(ty3 g d v (THead (Bind Abst) u0 t0)))) (\lambda (u0: +T).(\lambda (_: T).(ty3 g d w u0))))))).(\lambda (H4: (eq T (TLRef n) (THead +(Flat Appl) w v))).(let H5 \def (eq_ind T (TLRef n) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead +(Flat Appl) w v) H4) in (False_ind (ex3_2 T T (\lambda (u0: T).(\lambda (t0: +T).(pc3 c0 (THead (Flat Appl) w (THead (Bind Abst) u0 t0)) (lift (S n) O +t)))) (\lambda (u0: T).(\lambda (t0: T).(ty3 g c0 v (THead (Bind Abst) u0 +t0)))) (\lambda (u0: T).(\lambda (_: T).(ty3 g c0 w u0)))) H5))))))))))) +(\lambda (n: nat).(\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda +(_: (getl n c0 (CHead d (Bind Abst) u))).(\lambda (t: T).(\lambda (_: (ty3 g +d u t)).(\lambda (_: (((eq T u (THead (Flat Appl) w v)) \to (ex3_2 T T +(\lambda (u0: T).(\lambda (t0: T).(pc3 d (THead (Flat Appl) w (THead (Bind +Abst) u0 t0)) t))) (\lambda (u0: T).(\lambda (t0: T).(ty3 g d v (THead (Bind +Abst) u0 t0)))) (\lambda (u0: T).(\lambda (_: T).(ty3 g d w +u0))))))).(\lambda (H4: (eq T (TLRef n) (THead (Flat Appl) w v))).(let H5 +\def (eq_ind T (TLRef n) (\lambda (ee: T).(match ee in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead (Flat Appl) w v) H4) in +(False_ind (ex3_2 T T (\lambda (u0: T).(\lambda (t0: T).(pc3 c0 (THead (Flat +Appl) w (THead (Bind Abst) u0 t0)) (lift (S n) O u)))) (\lambda (u0: +T).(\lambda (t0: T).(ty3 g c0 v (THead (Bind Abst) u0 t0)))) (\lambda (u0: +T).(\lambda (_: T).(ty3 g c0 w u0)))) H5))))))))))) (\lambda (c0: C).(\lambda +(u: T).(\lambda (t: T).(\lambda (_: (ty3 g c0 u t)).(\lambda (_: (((eq T u +(THead (Flat Appl) w v)) \to (ex3_2 T T (\lambda (u0: T).(\lambda (t0: +T).(pc3 c0 (THead (Flat Appl) w (THead (Bind Abst) u0 t0)) t))) (\lambda (u0: +T).(\lambda (t0: T).(ty3 g c0 v (THead (Bind Abst) u0 t0)))) (\lambda (u0: +T).(\lambda (_: T).(ty3 g c0 w u0))))))).(\lambda (b: B).(\lambda (t1: +T).(\lambda (t2: T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u) t1 +t2)).(\lambda (_: (((eq T t1 (THead (Flat Appl) w v)) \to (ex3_2 T T (\lambda +(u0: T).(\lambda (t0: T).(pc3 (CHead c0 (Bind b) u) (THead (Flat Appl) w +(THead (Bind Abst) u0 t0)) t2))) (\lambda (u0: T).(\lambda (t0: T).(ty3 g +(CHead c0 (Bind b) u) v (THead (Bind Abst) u0 t0)))) (\lambda (u0: +T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) w u0))))))).(\lambda (t0: +T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u) t2 t0)).(\lambda (_: (((eq T t2 +(THead (Flat Appl) w v)) \to (ex3_2 T T (\lambda (u0: T).(\lambda (t3: +T).(pc3 (CHead c0 (Bind b) u) (THead (Flat Appl) w (THead (Bind Abst) u0 t3)) +t0))) (\lambda (u0: T).(\lambda (t3: T).(ty3 g (CHead c0 (Bind b) u) v (THead +(Bind Abst) u0 t3)))) (\lambda (u0: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind +b) u) w u0))))))).(\lambda (H7: (eq T (THead (Bind b) u t1) (THead (Flat +Appl) w v))).(let H8 \def (eq_ind T (THead (Bind b) u t1) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | (Flat _) +\Rightarrow False])])) I (THead (Flat Appl) w v) H7) in (False_ind (ex3_2 T T +(\lambda (u0: T).(\lambda (t3: T).(pc3 c0 (THead (Flat Appl) w (THead (Bind +Abst) u0 t3)) (THead (Bind b) u t2)))) (\lambda (u0: T).(\lambda (t3: T).(ty3 +g c0 v (THead (Bind Abst) u0 t3)))) (\lambda (u0: T).(\lambda (_: T).(ty3 g +c0 w u0)))) H8)))))))))))))))) (\lambda (c0: C).(\lambda (w0: T).(\lambda (u: +T).(\lambda (H1: (ty3 g c0 w0 u)).(\lambda (H2: (((eq T w0 (THead (Flat Appl) +w v)) \to (ex3_2 T T (\lambda (u0: T).(\lambda (t: T).(pc3 c0 (THead (Flat +Appl) w (THead (Bind Abst) u0 t)) u))) (\lambda (u0: T).(\lambda (t: T).(ty3 +g c0 v (THead (Bind Abst) u0 t)))) (\lambda (u0: T).(\lambda (_: T).(ty3 g c0 +w u0))))))).(\lambda (v0: T).(\lambda (t: T).(\lambda (H3: (ty3 g c0 v0 +(THead (Bind Abst) u t))).(\lambda (H4: (((eq T v0 (THead (Flat Appl) w v)) +\to (ex3_2 T T (\lambda (u0: T).(\lambda (t0: T).(pc3 c0 (THead (Flat Appl) w +(THead (Bind Abst) u0 t0)) (THead (Bind Abst) u t)))) (\lambda (u0: +T).(\lambda (t0: T).(ty3 g c0 v (THead (Bind Abst) u0 t0)))) (\lambda (u0: +T).(\lambda (_: T).(ty3 g c0 w u0))))))).(\lambda (H5: (eq T (THead (Flat +Appl) w0 v0) (THead (Flat Appl) w v))).(let H6 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow w0 | +(TLRef _) \Rightarrow w0 | (THead _ t0 _) \Rightarrow t0])) (THead (Flat +Appl) w0 v0) (THead (Flat Appl) w v) H5) in ((let H7 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow v0 | (TLRef _) \Rightarrow v0 | (THead _ _ t0) \Rightarrow t0])) +(THead (Flat Appl) w0 v0) (THead (Flat Appl) w v) H5) in (\lambda (H8: (eq T +w0 w)).(let H9 \def (eq_ind T v0 (\lambda (t0: T).((eq T t0 (THead (Flat +Appl) w v)) \to (ex3_2 T T (\lambda (u0: T).(\lambda (t1: T).(pc3 c0 (THead +(Flat Appl) w (THead (Bind Abst) u0 t1)) (THead (Bind Abst) u t)))) (\lambda +(u0: T).(\lambda (t1: T).(ty3 g c0 v (THead (Bind Abst) u0 t1)))) (\lambda +(u0: T).(\lambda (_: T).(ty3 g c0 w u0)))))) H4 v H7) in (let H10 \def +(eq_ind T v0 (\lambda (t0: T).(ty3 g c0 t0 (THead (Bind Abst) u t))) H3 v H7) +in (let H11 \def (eq_ind T w0 (\lambda (t0: T).((eq T t0 (THead (Flat Appl) w +v)) \to (ex3_2 T T (\lambda (u0: T).(\lambda (t1: T).(pc3 c0 (THead (Flat +Appl) w (THead (Bind Abst) u0 t1)) u))) (\lambda (u0: T).(\lambda (t1: +T).(ty3 g c0 v (THead (Bind Abst) u0 t1)))) (\lambda (u0: T).(\lambda (_: +T).(ty3 g c0 w u0)))))) H2 w H8) in (let H12 \def (eq_ind T w0 (\lambda (t0: +T).(ty3 g c0 t0 u)) H1 w H8) in (eq_ind_r T w (\lambda (t0: T).(ex3_2 T T +(\lambda (u0: T).(\lambda (t1: T).(pc3 c0 (THead (Flat Appl) w (THead (Bind +Abst) u0 t1)) (THead (Flat Appl) t0 (THead (Bind Abst) u t))))) (\lambda (u0: +T).(\lambda (t1: T).(ty3 g c0 v (THead (Bind Abst) u0 t1)))) (\lambda (u0: +T).(\lambda (_: T).(ty3 g c0 w u0))))) (ex3_2_intro T T (\lambda (u0: +T).(\lambda (t0: T).(pc3 c0 (THead (Flat Appl) w (THead (Bind Abst) u0 t0)) +(THead (Flat Appl) w (THead (Bind Abst) u t))))) (\lambda (u0: T).(\lambda +(t0: T).(ty3 g c0 v (THead (Bind Abst) u0 t0)))) (\lambda (u0: T).(\lambda +(_: T).(ty3 g c0 w u0))) u t (pc3_refl c0 (THead (Flat Appl) w (THead (Bind +Abst) u t))) H10 H12) w0 H8))))))) H6)))))))))))) (\lambda (c0: C).(\lambda +(t1: T).(\lambda (t2: T).(\lambda (_: (ty3 g c0 t1 t2)).(\lambda (_: (((eq T +t1 (THead (Flat Appl) w v)) \to (ex3_2 T T (\lambda (u: T).(\lambda (t: +T).(pc3 c0 (THead (Flat Appl) w (THead (Bind Abst) u t)) t2))) (\lambda (u: +T).(\lambda (t: T).(ty3 g c0 v (THead (Bind Abst) u t)))) (\lambda (u: +T).(\lambda (_: T).(ty3 g c0 w u))))))).(\lambda (t0: T).(\lambda (_: (ty3 g +c0 t2 t0)).(\lambda (_: (((eq T t2 (THead (Flat Appl) w v)) \to (ex3_2 T T +(\lambda (u: T).(\lambda (t: T).(pc3 c0 (THead (Flat Appl) w (THead (Bind +Abst) u t)) t0))) (\lambda (u: T).(\lambda (t: T).(ty3 g c0 v (THead (Bind +Abst) u t)))) (\lambda (u: T).(\lambda (_: T).(ty3 g c0 w u))))))).(\lambda +(H5: (eq T (THead (Flat Cast) t2 t1) (THead (Flat Appl) w v))).(let H6 \def +(eq_ind T (THead (Flat Cast) t2 t1) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat f) \Rightarrow (match f +in F return (\lambda (_: F).Prop) with [Appl \Rightarrow False | Cast +\Rightarrow True])])])) I (THead (Flat Appl) w v) H5) in (False_ind (ex3_2 T +T (\lambda (u: T).(\lambda (t: T).(pc3 c0 (THead (Flat Appl) w (THead (Bind +Abst) u t)) (THead (Flat Cast) t0 t2)))) (\lambda (u: T).(\lambda (t: T).(ty3 +g c0 v (THead (Bind Abst) u t)))) (\lambda (u: T).(\lambda (_: T).(ty3 g c0 w +u)))) H6))))))))))) c y x H0))) H)))))). + +theorem ty3_gen_cast: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t2: T).(\forall +(x: T).((ty3 g c (THead (Flat Cast) t2 t1) x) \to (ex3 T (\lambda (t0: +T).(pc3 c (THead (Flat Cast) t0 t2) x)) (\lambda (_: T).(ty3 g c t1 t2)) +(\lambda (t0: T).(ty3 g c t2 t0)))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(x: T).(\lambda (H: (ty3 g c (THead (Flat Cast) t2 t1) x)).(insert_eq T +(THead (Flat Cast) t2 t1) (\lambda (t: T).(ty3 g c t x)) (ex3 T (\lambda (t0: +T).(pc3 c (THead (Flat Cast) t0 t2) x)) (\lambda (_: T).(ty3 g c t1 t2)) +(\lambda (t0: T).(ty3 g c t2 t0))) (\lambda (y: T).(\lambda (H0: (ty3 g c y +x)).(ty3_ind g (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).((eq T t +(THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda (t3: T).(pc3 c0 (THead (Flat +Cast) t3 t2) t0)) (\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda (t3: T).(ty3 g +c0 t2 t3))))))) (\lambda (c0: C).(\lambda (t0: T).(\lambda (t: T).(\lambda +(_: (ty3 g c0 t0 t)).(\lambda (_: (((eq T t0 (THead (Flat Cast) t2 t1)) \to +(ex3 T (\lambda (t3: T).(pc3 c0 (THead (Flat Cast) t3 t2) t)) (\lambda (_: +T).(ty3 g c0 t1 t2)) (\lambda (t3: T).(ty3 g c0 t2 t3)))))).(\lambda (u: +T).(\lambda (t3: T).(\lambda (H3: (ty3 g c0 u t3)).(\lambda (H4: (((eq T u +(THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda (t4: T).(pc3 c0 (THead (Flat +Cast) t4 t2) t3)) (\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda (t4: T).(ty3 g +c0 t2 t4)))))).(\lambda (H5: (pc3 c0 t3 t0)).(\lambda (H6: (eq T u (THead +(Flat Cast) t2 t1))).(let H7 \def (f_equal T T (\lambda (e: T).e) u (THead +(Flat Cast) t2 t1) H6) in (let H8 \def (eq_ind T u (\lambda (t4: T).((eq T t4 +(THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda (t5: T).(pc3 c0 (THead (Flat +Cast) t5 t2) t3)) (\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda (t5: T).(ty3 g +c0 t2 t5))))) H4 (THead (Flat Cast) t2 t1) H7) in (let H9 \def (eq_ind T u +(\lambda (t4: T).(ty3 g c0 t4 t3)) H3 (THead (Flat Cast) t2 t1) H7) in (let +H10 \def (H8 (refl_equal T (THead (Flat Cast) t2 t1))) in (ex3_ind T (\lambda +(t4: T).(pc3 c0 (THead (Flat Cast) t4 t2) t3)) (\lambda (_: T).(ty3 g c0 t1 +t2)) (\lambda (t4: T).(ty3 g c0 t2 t4)) (ex3 T (\lambda (t4: T).(pc3 c0 +(THead (Flat Cast) t4 t2) t0)) (\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda +(t4: T).(ty3 g c0 t2 t4))) (\lambda (x0: T).(\lambda (H11: (pc3 c0 (THead +(Flat Cast) x0 t2) t3)).(\lambda (H12: (ty3 g c0 t1 t2)).(\lambda (H13: (ty3 +g c0 t2 x0)).(ex3_intro T (\lambda (t4: T).(pc3 c0 (THead (Flat Cast) t4 t2) +t0)) (\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda (t4: T).(ty3 g c0 t2 t4)) x0 +(pc3_t t3 c0 (THead (Flat Cast) x0 t2) H11 t0 H5) H12 H13))))) +H10)))))))))))))))) (\lambda (c0: C).(\lambda (m: nat).(\lambda (H1: (eq T +(TSort m) (THead (Flat Cast) t2 t1))).(let H2 \def (eq_ind T (TSort m) +(\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +False])) I (THead (Flat Cast) t2 t1) H1) in (False_ind (ex3 T (\lambda (t0: +T).(pc3 c0 (THead (Flat Cast) t0 t2) (TSort (next g m)))) (\lambda (_: +T).(ty3 g c0 t1 t2)) (\lambda (t0: T).(ty3 g c0 t2 t0))) H2))))) (\lambda (n: +nat).(\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (_: (getl n c0 +(CHead d (Bind Abbr) u))).(\lambda (t: T).(\lambda (_: (ty3 g d u +t)).(\lambda (_: (((eq T u (THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda +(t0: T).(pc3 d (THead (Flat Cast) t0 t2) t)) (\lambda (_: T).(ty3 g d t1 t2)) +(\lambda (t0: T).(ty3 g d t2 t0)))))).(\lambda (H4: (eq T (TLRef n) (THead +(Flat Cast) t2 t1))).(let H5 \def (eq_ind T (TLRef n) (\lambda (ee: T).(match +ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead +(Flat Cast) t2 t1) H4) in (False_ind (ex3 T (\lambda (t0: T).(pc3 c0 (THead +(Flat Cast) t0 t2) (lift (S n) O t))) (\lambda (_: T).(ty3 g c0 t1 t2)) +(\lambda (t0: T).(ty3 g c0 t2 t0))) H5))))))))))) (\lambda (n: nat).(\lambda +(c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (_: (getl n c0 (CHead d +(Bind Abst) u))).(\lambda (t: T).(\lambda (_: (ty3 g d u t)).(\lambda (_: +(((eq T u (THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda (t0: T).(pc3 d +(THead (Flat Cast) t0 t2) t)) (\lambda (_: T).(ty3 g d t1 t2)) (\lambda (t0: +T).(ty3 g d t2 t0)))))).(\lambda (H4: (eq T (TLRef n) (THead (Flat Cast) t2 +t1))).(let H5 \def (eq_ind T (TLRef n) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead (Flat Cast) t2 +t1) H4) in (False_ind (ex3 T (\lambda (t0: T).(pc3 c0 (THead (Flat Cast) t0 +t2) (lift (S n) O u))) (\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda (t0: +T).(ty3 g c0 t2 t0))) H5))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda +(t: T).(\lambda (_: (ty3 g c0 u t)).(\lambda (_: (((eq T u (THead (Flat Cast) +t2 t1)) \to (ex3 T (\lambda (t0: T).(pc3 c0 (THead (Flat Cast) t0 t2) t)) +(\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda (t0: T).(ty3 g c0 t2 +t0)))))).(\lambda (b: B).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (ty3 +g (CHead c0 (Bind b) u) t0 t3)).(\lambda (_: (((eq T t0 (THead (Flat Cast) t2 +t1)) \to (ex3 T (\lambda (t4: T).(pc3 (CHead c0 (Bind b) u) (THead (Flat +Cast) t4 t2) t3)) (\lambda (_: T).(ty3 g (CHead c0 (Bind b) u) t1 t2)) +(\lambda (t4: T).(ty3 g (CHead c0 (Bind b) u) t2 t4)))))).(\lambda (t4: +T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u) t3 t4)).(\lambda (_: (((eq T t3 +(THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda (t5: T).(pc3 (CHead c0 (Bind +b) u) (THead (Flat Cast) t5 t2) t4)) (\lambda (_: T).(ty3 g (CHead c0 (Bind +b) u) t1 t2)) (\lambda (t5: T).(ty3 g (CHead c0 (Bind b) u) t2 +t5)))))).(\lambda (H7: (eq T (THead (Bind b) u t0) (THead (Flat Cast) t2 +t1))).(let H8 \def (eq_ind T (THead (Bind b) u t0) (\lambda (ee: T).(match ee +in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef +_) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | (Flat _) \Rightarrow +False])])) I (THead (Flat Cast) t2 t1) H7) in (False_ind (ex3 T (\lambda (t5: +T).(pc3 c0 (THead (Flat Cast) t5 t2) (THead (Bind b) u t3))) (\lambda (_: +T).(ty3 g c0 t1 t2)) (\lambda (t5: T).(ty3 g c0 t2 t5))) H8)))))))))))))))) +(\lambda (c0: C).(\lambda (w: T).(\lambda (u: T).(\lambda (_: (ty3 g c0 w +u)).(\lambda (_: (((eq T w (THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda +(t0: T).(pc3 c0 (THead (Flat Cast) t0 t2) u)) (\lambda (_: T).(ty3 g c0 t1 +t2)) (\lambda (t0: T).(ty3 g c0 t2 t0)))))).(\lambda (v: T).(\lambda (t: +T).(\lambda (_: (ty3 g c0 v (THead (Bind Abst) u t))).(\lambda (_: (((eq T v +(THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda (t0: T).(pc3 c0 (THead (Flat +Cast) t0 t2) (THead (Bind Abst) u t))) (\lambda (_: T).(ty3 g c0 t1 t2)) +(\lambda (t0: T).(ty3 g c0 t2 t0)))))).(\lambda (H5: (eq T (THead (Flat Appl) +w v) (THead (Flat Cast) t2 t1))).(let H6 \def (eq_ind T (THead (Flat Appl) w +v) (\lambda (ee: T).(match ee in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat f) \Rightarrow (match f in F return (\lambda (_: +F).Prop) with [Appl \Rightarrow True | Cast \Rightarrow False])])])) I (THead +(Flat Cast) t2 t1) H5) in (False_ind (ex3 T (\lambda (t0: T).(pc3 c0 (THead +(Flat Cast) t0 t2) (THead (Flat Appl) w (THead (Bind Abst) u t)))) (\lambda +(_: T).(ty3 g c0 t1 t2)) (\lambda (t0: T).(ty3 g c0 t2 t0))) H6)))))))))))) +(\lambda (c0: C).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H1: (ty3 g c0 t0 +t3)).(\lambda (H2: (((eq T t0 (THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda +(t4: T).(pc3 c0 (THead (Flat Cast) t4 t2) t3)) (\lambda (_: T).(ty3 g c0 t1 +t2)) (\lambda (t4: T).(ty3 g c0 t2 t4)))))).(\lambda (t4: T).(\lambda (H3: +(ty3 g c0 t3 t4)).(\lambda (H4: (((eq T t3 (THead (Flat Cast) t2 t1)) \to +(ex3 T (\lambda (t5: T).(pc3 c0 (THead (Flat Cast) t5 t2) t4)) (\lambda (_: +T).(ty3 g c0 t1 t2)) (\lambda (t5: T).(ty3 g c0 t2 t5)))))).(\lambda (H5: (eq +T (THead (Flat Cast) t3 t0) (THead (Flat Cast) t2 t1))).(let H6 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ t _) \Rightarrow t])) +(THead (Flat Cast) t3 t0) (THead (Flat Cast) t2 t1) H5) in ((let H7 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t) +\Rightarrow t])) (THead (Flat Cast) t3 t0) (THead (Flat Cast) t2 t1) H5) in +(\lambda (H8: (eq T t3 t2)).(let H9 \def (eq_ind T t3 (\lambda (t: T).((eq T +t (THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda (t5: T).(pc3 c0 (THead (Flat +Cast) t5 t2) t4)) (\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda (t5: T).(ty3 g +c0 t2 t5))))) H4 t2 H8) in (let H10 \def (eq_ind T t3 (\lambda (t: T).(ty3 g +c0 t t4)) H3 t2 H8) in (let H11 \def (eq_ind T t3 (\lambda (t: T).((eq T t0 +(THead (Flat Cast) t2 t1)) \to (ex3 T (\lambda (t5: T).(pc3 c0 (THead (Flat +Cast) t5 t2) t)) (\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda (t5: T).(ty3 g c0 +t2 t5))))) H2 t2 H8) in (let H12 \def (eq_ind T t3 (\lambda (t: T).(ty3 g c0 +t0 t)) H1 t2 H8) in (eq_ind_r T t2 (\lambda (t: T).(ex3 T (\lambda (t5: +T).(pc3 c0 (THead (Flat Cast) t5 t2) (THead (Flat Cast) t4 t))) (\lambda (_: +T).(ty3 g c0 t1 t2)) (\lambda (t5: T).(ty3 g c0 t2 t5)))) (let H13 \def +(eq_ind T t0 (\lambda (t: T).((eq T t (THead (Flat Cast) t2 t1)) \to (ex3 T +(\lambda (t5: T).(pc3 c0 (THead (Flat Cast) t5 t2) t2)) (\lambda (_: T).(ty3 +g c0 t1 t2)) (\lambda (t5: T).(ty3 g c0 t2 t5))))) H11 t1 H7) in (let H14 +\def (eq_ind T t0 (\lambda (t: T).(ty3 g c0 t t2)) H12 t1 H7) in (ex3_intro T +(\lambda (t5: T).(pc3 c0 (THead (Flat Cast) t5 t2) (THead (Flat Cast) t4 +t2))) (\lambda (_: T).(ty3 g c0 t1 t2)) (\lambda (t5: T).(ty3 g c0 t2 t5)) t4 +(pc3_refl c0 (THead (Flat Cast) t4 t2)) H14 H10))) t3 H8))))))) H6))))))))))) +c y x H0))) H)))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/nf2.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/nf2.ma new file mode 100644 index 000000000..358626faa --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/nf2.ma @@ -0,0 +1,467 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/nf2". + +include "ty3/arity.ma". + +include "pc3/nf2.ma". + +include "nf2/arity.ma". + +definition ty3_nf2_inv_abst_premise: + C \to (T \to (T \to Prop)) +\def + \lambda (c: C).(\lambda (w: T).(\lambda (u: T).(\forall (d: C).(\forall (wi: +T).(\forall (i: nat).((getl i c (CHead d (Bind Abst) wi)) \to (\forall (vs: +TList).((pc3 c (THeads (Flat Appl) vs (lift (S i) O wi)) (THead (Bind Abst) w +u)) \to False)))))))). + +theorem ty3_nf2_inv_abst_premise_csort: + \forall (w: T).(\forall (u: T).(\forall (m: nat).(ty3_nf2_inv_abst_premise +(CSort m) w u))) +\def + \lambda (w: T).(\lambda (u: T).(\lambda (m: nat).(\lambda (d: C).(\lambda +(wi: T).(\lambda (i: nat).(\lambda (H: (getl i (CSort m) (CHead d (Bind Abst) +wi))).(\lambda (vs: TList).(\lambda (_: (pc3 (CSort m) (THeads (Flat Appl) vs +(lift (S i) O wi)) (THead (Bind Abst) w u))).(getl_gen_sort m i (CHead d +(Bind Abst) wi) H False))))))))). + +theorem ty3_nf2_inv_all: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (u: T).((ty3 g c t +u) \to ((nf2 c t) \to (or3 (ex3_2 T T (\lambda (w: T).(\lambda (u0: T).(eq T +t (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: T).(nf2 c w))) +(\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c (Bind Abst) w) u0)))) (ex nat +(\lambda (n: nat).(eq T t (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (u: T).(\lambda (H: +(ty3 g c t u)).(\lambda (H0: (nf2 c t)).(let H_x \def (ty3_arity g c t u H) +in (let H1 \def H_x in (ex2_ind A (\lambda (a1: A).(arity g c t a1)) (\lambda +(a1: A).(arity g c u (asucc g a1))) (or3 (ex3_2 T T (\lambda (w: T).(\lambda +(u0: T).(eq T t (THead (Bind Abst) w u0)))) (\lambda (w: T).(\lambda (_: +T).(nf2 c w))) (\lambda (w: T).(\lambda (u0: T).(nf2 (CHead c (Bind Abst) w) +u0)))) (ex nat (\lambda (n: nat).(eq T t (TSort n)))) (ex3_2 TList nat +(\lambda (ws: TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) ws (TLRef +i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i)))))) (\lambda (x: A).(\lambda (H2: +(arity g c t x)).(\lambda (_: (arity g c u (asucc g x))).(arity_nf2_inv_all g +c t x H2 H0)))) H1)))))))). + +theorem ty3_nf2_inv_sort: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (m: nat).((ty3 g c t +(TSort m)) \to ((nf2 c t) \to (or (ex2 nat (\lambda (n: nat).(eq T t (TSort +n))) (\lambda (n: nat).(eq nat m (next g n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (m: nat).(\lambda +(H: (ty3 g c t (TSort m))).(\lambda (H0: (nf2 c t)).(let H_x \def +(ty3_nf2_inv_all g c t (TSort m) H H0) in (let H1 \def H_x in (or3_ind (ex3_2 +T T (\lambda (w: T).(\lambda (u: T).(eq T t (THead (Bind Abst) w u)))) +(\lambda (w: T).(\lambda (_: T).(nf2 c w))) (\lambda (w: T).(\lambda (u: +T).(nf2 (CHead c (Bind Abst) w) u)))) (ex nat (\lambda (n: nat).(eq T t +(TSort n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t +(THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c (TLRef i))))) +(or (ex2 nat (\lambda (n: nat).(eq T t (TSort n))) (\lambda (n: nat).(eq nat +m (next g n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T +t (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c (TLRef +i)))))) (\lambda (H2: (ex3_2 T T (\lambda (w: T).(\lambda (u: T).(eq T t +(THead (Bind Abst) w u)))) (\lambda (w: T).(\lambda (_: T).(nf2 c w))) +(\lambda (w: T).(\lambda (u: T).(nf2 (CHead c (Bind Abst) w) +u))))).(ex3_2_ind T T (\lambda (w: T).(\lambda (u: T).(eq T t (THead (Bind +Abst) w u)))) (\lambda (w: T).(\lambda (_: T).(nf2 c w))) (\lambda (w: +T).(\lambda (u: T).(nf2 (CHead c (Bind Abst) w) u))) (or (ex2 nat (\lambda +(n: nat).(eq T t (TSort n))) (\lambda (n: nat).(eq nat m (next g n)))) (ex3_2 +TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) +ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) +(\lambda (_: TList).(\lambda (i: nat).(nf2 c (TLRef i)))))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H3: (eq T t (THead (Bind Abst) x0 +x1))).(\lambda (_: (nf2 c x0)).(\lambda (_: (nf2 (CHead c (Bind Abst) x0) +x1)).(let H6 \def (eq_ind T t (\lambda (t0: T).(ty3 g c t0 (TSort m))) H +(THead (Bind Abst) x0 x1) H3) in (eq_ind_r T (THead (Bind Abst) x0 x1) +(\lambda (t0: T).(or (ex2 nat (\lambda (n: nat).(eq T t0 (TSort n))) (\lambda +(n: nat).(eq nat m (next g n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i))))))) (ex4_3_ind T T T (\lambda +(t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 c (THead (Bind Abst) x0 t2) +(TSort m))))) (\lambda (_: T).(\lambda (t0: T).(\lambda (_: T).(ty3 g c x0 +t0)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c (Bind +Abst) x0) x1 t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t1: T).(ty3 g +(CHead c (Bind Abst) x0) t2 t1)))) (or (ex2 nat (\lambda (n: nat).(eq T +(THead (Bind Abst) x0 x1) (TSort n))) (\lambda (n: nat).(eq nat m (next g +n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T (THead +(Bind Abst) x0 x1) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: +TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: TList).(\lambda (i: +nat).(nf2 c (TLRef i)))))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (H7: (pc3 c (THead (Bind Abst) x0 x2) (TSort m))).(\lambda (_: +(ty3 g c x0 x3)).(\lambda (_: (ty3 g (CHead c (Bind Abst) x0) x1 +x2)).(\lambda (_: (ty3 g (CHead c (Bind Abst) x0) x2 x4)).(pc3_gen_sort_abst +c x0 x2 m (pc3_s c (TSort m) (THead (Bind Abst) x0 x2) H7) (or (ex2 nat +(\lambda (n: nat).(eq T (THead (Bind Abst) x0 x1) (TSort n))) (\lambda (n: +nat).(eq nat m (next g n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda +(i: nat).(eq T (THead (Bind Abst) x0 x1) (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i)))))))))))))) (ty3_gen_bind g Abst c +x0 x1 (TSort m) H6)) t H3))))))) H2)) (\lambda (H2: (ex nat (\lambda (n: +nat).(eq T t (TSort n))))).(ex_ind nat (\lambda (n: nat).(eq T t (TSort n))) +(or (ex2 nat (\lambda (n: nat).(eq T t (TSort n))) (\lambda (n: nat).(eq nat +m (next g n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T +t (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c (TLRef +i)))))) (\lambda (x: nat).(\lambda (H3: (eq T t (TSort x))).(let H4 \def +(eq_ind T t (\lambda (t0: T).(ty3 g c t0 (TSort m))) H (TSort x) H3) in +(eq_ind_r T (TSort x) (\lambda (t0: T).(or (ex2 nat (\lambda (n: nat).(eq T +t0 (TSort n))) (\lambda (n: nat).(eq nat m (next g n)))) (ex3_2 TList nat +(\lambda (ws: TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws (TLRef +i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i))))))) (eq_ind nat (next g x) +(\lambda (n: nat).(or (ex2 nat (\lambda (n0: nat).(eq T (TSort x) (TSort +n0))) (\lambda (n0: nat).(eq nat n (next g n0)))) (ex3_2 TList nat (\lambda +(ws: TList).(\lambda (i: nat).(eq T (TSort x) (THeads (Flat Appl) ws (TLRef +i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i))))))) (or_introl (ex2 nat (\lambda +(n: nat).(eq T (TSort x) (TSort n))) (\lambda (n: nat).(eq nat (next g x) +(next g n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T +(TSort x) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda +(_: nat).(nfs2 c ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c (TLRef +i))))) (ex_intro2 nat (\lambda (n: nat).(eq T (TSort x) (TSort n))) (\lambda +(n: nat).(eq nat (next g x) (next g n))) x (refl_equal T (TSort x)) +(refl_equal nat (next g x)))) m (pc3_gen_sort c (next g x) m (ty3_gen_sort g +c (TSort m) x H4))) t H3)))) H2)) (\lambda (H2: (ex3_2 TList nat (\lambda +(ws: TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i)))))).(ex3_2_ind TList nat (\lambda +(ws: TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i)))) (or (ex2 nat (\lambda (n: +nat).(eq T t (TSort n))) (\lambda (n: nat).(eq nat m (next g n)))) (ex3_2 +TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) +ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) +(\lambda (_: TList).(\lambda (i: nat).(nf2 c (TLRef i)))))) (\lambda (x0: +TList).(\lambda (x1: nat).(\lambda (H3: (eq T t (THeads (Flat Appl) x0 (TLRef +x1)))).(\lambda (H4: (nfs2 c x0)).(\lambda (H5: (nf2 c (TLRef x1))).(let H6 +\def (eq_ind T t (\lambda (t0: T).(ty3 g c t0 (TSort m))) H (THeads (Flat +Appl) x0 (TLRef x1)) H3) in (eq_ind_r T (THeads (Flat Appl) x0 (TLRef x1)) +(\lambda (t0: T).(or (ex2 nat (\lambda (n: nat).(eq T t0 (TSort n))) (\lambda +(n: nat).(eq nat m (next g n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T t0 (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i))))))) (or_intror (ex2 nat (\lambda +(n: nat).(eq T (THeads (Flat Appl) x0 (TLRef x1)) (TSort n))) (\lambda (n: +nat).(eq nat m (next g n)))) (ex3_2 TList nat (\lambda (ws: TList).(\lambda +(i: nat).(eq T (THeads (Flat Appl) x0 (TLRef x1)) (THeads (Flat Appl) ws +(TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda +(_: TList).(\lambda (i: nat).(nf2 c (TLRef i))))) (ex3_2_intro TList nat +(\lambda (ws: TList).(\lambda (i: nat).(eq T (THeads (Flat Appl) x0 (TLRef +x1)) (THeads (Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: +nat).(nfs2 c ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c (TLRef i)))) +x0 x1 (refl_equal T (THeads (Flat Appl) x0 (TLRef x1))) H4 H5)) t H3))))))) +H2)) H1)))))))). + +theorem ty3_nf2_gen__ty3_nf2_inv_abst_aux: + \forall (c: C).(\forall (w1: T).(\forall (u1: T).((ty3_nf2_inv_abst_premise +c w1 u1) \to (\forall (t: T).(\forall (w2: T).(\forall (u2: T).((pc3 c (THead +(Flat Appl) t (THead (Bind Abst) w2 u2)) (THead (Bind Abst) w1 u1)) \to +(ty3_nf2_inv_abst_premise c w2 u2)))))))) +\def + \lambda (c: C).(\lambda (w1: T).(\lambda (u1: T).(\lambda (H: ((\forall (d: +C).(\forall (wi: T).(\forall (i: nat).((getl i c (CHead d (Bind Abst) wi)) +\to (\forall (vs: TList).((pc3 c (THeads (Flat Appl) vs (lift (S i) O wi)) +(THead (Bind Abst) w1 u1)) \to False)))))))).(\lambda (t: T).(\lambda (w2: +T).(\lambda (u2: T).(\lambda (H0: (pc3 c (THead (Flat Appl) t (THead (Bind +Abst) w2 u2)) (THead (Bind Abst) w1 u1))).(\lambda (d: C).(\lambda (wi: +T).(\lambda (i: nat).(\lambda (H1: (getl i c (CHead d (Bind Abst) +wi))).(\lambda (vs: TList).(\lambda (H2: (pc3 c (THeads (Flat Appl) vs (lift +(S i) O wi)) (THead (Bind Abst) w2 u2))).(H d wi i H1 (TCons t vs) (pc3_t +(THead (Flat Appl) t (THead (Bind Abst) w2 u2)) c (THead (Flat Appl) t +(THeads (Flat Appl) vs (lift (S i) O wi))) (pc3_thin_dx c (THeads (Flat Appl) +vs (lift (S i) O wi)) (THead (Bind Abst) w2 u2) H2 t Appl) (THead (Bind Abst) +w1 u1) H0))))))))))))))). + +theorem ty3_nf2_inv_abst: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (w: T).(\forall (u: +T).((ty3 g c t (THead (Bind Abst) w u)) \to ((nf2 c t) \to ((nf2 c w) \to +((ty3_nf2_inv_abst_premise c w u) \to (ex4_2 T T (\lambda (v: T).(\lambda (_: +T).(eq T t (THead (Bind Abst) w v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g +c w w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) w) v +u))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) w) +v)))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (w: T).(\lambda (u: +T).(\lambda (H: (ty3 g c t (THead (Bind Abst) w u))).(\lambda (H0: (nf2 c +t)).(\lambda (H1: (nf2 c w)).(\lambda (H2: (ty3_nf2_inv_abst_premise c w +u)).(let H_x \def (ty3_nf2_inv_all g c t (THead (Bind Abst) w u) H H0) in +(let H3 \def H_x in (or3_ind (ex3_2 T T (\lambda (w0: T).(\lambda (u0: T).(eq +T t (THead (Bind Abst) w0 u0)))) (\lambda (w0: T).(\lambda (_: T).(nf2 c +w0))) (\lambda (w0: T).(\lambda (u0: T).(nf2 (CHead c (Bind Abst) w0) u0)))) +(ex nat (\lambda (n: nat).(eq T t (TSort n)))) (ex3_2 TList nat (\lambda (ws: +TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) ws (TLRef i))))) +(\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) (\lambda (_: +TList).(\lambda (i: nat).(nf2 c (TLRef i))))) (ex4_2 T T (\lambda (v: +T).(\lambda (_: T).(eq T t (THead (Bind Abst) w v)))) (\lambda (_: +T).(\lambda (w0: T).(ty3 g c w w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g +(CHead c (Bind Abst) w) v u))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c +(Bind Abst) w) v)))) (\lambda (H4: (ex3_2 T T (\lambda (w0: T).(\lambda (u0: +T).(eq T t (THead (Bind Abst) w0 u0)))) (\lambda (w0: T).(\lambda (_: T).(nf2 +c w0))) (\lambda (w0: T).(\lambda (u0: T).(nf2 (CHead c (Bind Abst) w0) +u0))))).(ex3_2_ind T T (\lambda (w0: T).(\lambda (u0: T).(eq T t (THead (Bind +Abst) w0 u0)))) (\lambda (w0: T).(\lambda (_: T).(nf2 c w0))) (\lambda (w0: +T).(\lambda (u0: T).(nf2 (CHead c (Bind Abst) w0) u0))) (ex4_2 T T (\lambda +(v: T).(\lambda (_: T).(eq T t (THead (Bind Abst) w v)))) (\lambda (_: +T).(\lambda (w0: T).(ty3 g c w w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g +(CHead c (Bind Abst) w) v u))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c +(Bind Abst) w) v)))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H5: (eq T t +(THead (Bind Abst) x0 x1))).(\lambda (H6: (nf2 c x0)).(\lambda (H7: (nf2 +(CHead c (Bind Abst) x0) x1)).(let H8 \def (eq_ind T t (\lambda (t0: T).(ty3 +g c t0 (THead (Bind Abst) w u))) H (THead (Bind Abst) x0 x1) H5) in (eq_ind_r +T (THead (Bind Abst) x0 x1) (\lambda (t0: T).(ex4_2 T T (\lambda (v: +T).(\lambda (_: T).(eq T t0 (THead (Bind Abst) w v)))) (\lambda (_: +T).(\lambda (w0: T).(ty3 g c w w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g +(CHead c (Bind Abst) w) v u))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c +(Bind Abst) w) v))))) (ex_ind T (\lambda (t0: T).(ty3 g c (THead (Bind Abst) +w u) t0)) (ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T (THead (Bind Abst) +x0 x1) (THead (Bind Abst) w v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c w +w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) w) v u))) +(\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) w) v)))) (\lambda +(x: T).(\lambda (H9: (ty3 g c (THead (Bind Abst) w u) x)).(ex4_3_ind T T T +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 c (THead (Bind Abst) w +t2) x)))) (\lambda (_: T).(\lambda (t0: T).(\lambda (_: T).(ty3 g c w t0)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) +w) u t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t1: T).(ty3 g (CHead c +(Bind Abst) w) t2 t1)))) (ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T +(THead (Bind Abst) x0 x1) (THead (Bind Abst) w v)))) (\lambda (_: T).(\lambda +(w0: T).(ty3 g c w w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c +(Bind Abst) w) v u))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind +Abst) w) v)))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: T).(\lambda +(_: (pc3 c (THead (Bind Abst) w x2) x)).(\lambda (H11: (ty3 g c w +x3)).(\lambda (H12: (ty3 g (CHead c (Bind Abst) w) u x2)).(\lambda (_: (ty3 g +(CHead c (Bind Abst) w) x2 x4)).(ex4_3_ind T T T (\lambda (t2: T).(\lambda +(_: T).(\lambda (_: T).(pc3 c (THead (Bind Abst) x0 t2) (THead (Bind Abst) w +u))))) (\lambda (_: T).(\lambda (t0: T).(\lambda (_: T).(ty3 g c x0 t0)))) +(\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) +x0) x1 t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t1: T).(ty3 g (CHead +c (Bind Abst) x0) t2 t1)))) (ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T +(THead (Bind Abst) x0 x1) (THead (Bind Abst) w v)))) (\lambda (_: T).(\lambda +(w0: T).(ty3 g c w w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c +(Bind Abst) w) v u))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind +Abst) w) v)))) (\lambda (x5: T).(\lambda (x6: T).(\lambda (x7: T).(\lambda +(H14: (pc3 c (THead (Bind Abst) x0 x5) (THead (Bind Abst) w u))).(\lambda (_: +(ty3 g c x0 x6)).(\lambda (H16: (ty3 g (CHead c (Bind Abst) x0) x1 +x5)).(\lambda (_: (ty3 g (CHead c (Bind Abst) x0) x5 x7)).(and_ind (pc3 c x0 +w) (\forall (b: B).(\forall (u0: T).(pc3 (CHead c (Bind b) u0) x5 u))) (ex4_2 +T T (\lambda (v: T).(\lambda (_: T).(eq T (THead (Bind Abst) x0 x1) (THead +(Bind Abst) w v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c w w0))) +(\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) w) v u))) +(\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) w) v)))) (\lambda +(H18: (pc3 c x0 w)).(\lambda (H19: ((\forall (b: B).(\forall (u0: T).(pc3 +(CHead c (Bind b) u0) x5 u))))).(let H_y \def (pc3_nf2 c x0 w H18 H6 H1) in +(let H20 \def (eq_ind T x0 (\lambda (t0: T).(ty3 g (CHead c (Bind Abst) t0) +x1 x5)) H16 w H_y) in (let H21 \def (eq_ind T x0 (\lambda (t0: T).(nf2 (CHead +c (Bind Abst) t0) x1)) H7 w H_y) in (eq_ind_r T w (\lambda (t0: T).(ex4_2 T T +(\lambda (v: T).(\lambda (_: T).(eq T (THead (Bind Abst) t0 x1) (THead (Bind +Abst) w v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c w w0))) (\lambda (v: +T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) w) v u))) (\lambda (v: +T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) w) v))))) (ex4_2_intro T T +(\lambda (v: T).(\lambda (_: T).(eq T (THead (Bind Abst) w x1) (THead (Bind +Abst) w v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c w w0))) (\lambda (v: +T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) w) v u))) (\lambda (v: +T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) w) v))) x1 x3 (refl_equal T +(THead (Bind Abst) w x1)) H11 (ty3_conv g (CHead c (Bind Abst) w) u x2 H12 x1 +x5 H20 (H19 Abst w)) H21) x0 H_y)))))) (pc3_gen_abst c x0 w x5 u H14))))))))) +(ty3_gen_bind g Abst c x0 x1 (THead (Bind Abst) w u) H8))))))))) +(ty3_gen_bind g Abst c w u x H9)))) (ty3_correct g c (THead (Bind Abst) x0 +x1) (THead (Bind Abst) w u) H8)) t H5))))))) H4)) (\lambda (H4: (ex nat +(\lambda (n: nat).(eq T t (TSort n))))).(ex_ind nat (\lambda (n: nat).(eq T t +(TSort n))) (ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T t (THead (Bind +Abst) w v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c w w0))) (\lambda (v: +T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) w) v u))) (\lambda (v: +T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) w) v)))) (\lambda (x: +nat).(\lambda (H5: (eq T t (TSort x))).(let H6 \def (eq_ind T t (\lambda (t0: +T).(ty3 g c t0 (THead (Bind Abst) w u))) H (TSort x) H5) in (eq_ind_r T +(TSort x) (\lambda (t0: T).(ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T +t0 (THead (Bind Abst) w v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c w +w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) w) v u))) +(\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) w) v))))) +(pc3_gen_sort_abst c w u (next g x) (ty3_gen_sort g c (THead (Bind Abst) w u) +x H6) (ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T (TSort x) (THead (Bind +Abst) w v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c w w0))) (\lambda (v: +T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) w) v u))) (\lambda (v: +T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) w) v))))) t H5)))) H4)) (\lambda +(H4: (ex3_2 TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t (THeads +(Flat Appl) ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c +ws))) (\lambda (_: TList).(\lambda (i: nat).(nf2 c (TLRef i)))))).(ex3_2_ind +TList nat (\lambda (ws: TList).(\lambda (i: nat).(eq T t (THeads (Flat Appl) +ws (TLRef i))))) (\lambda (ws: TList).(\lambda (_: nat).(nfs2 c ws))) +(\lambda (_: TList).(\lambda (i: nat).(nf2 c (TLRef i)))) (ex4_2 T T (\lambda +(v: T).(\lambda (_: T).(eq T t (THead (Bind Abst) w v)))) (\lambda (_: +T).(\lambda (w0: T).(ty3 g c w w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g +(CHead c (Bind Abst) w) v u))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c +(Bind Abst) w) v)))) (\lambda (x0: TList).(\lambda (x1: nat).(\lambda (H5: +(eq T t (THeads (Flat Appl) x0 (TLRef x1)))).(\lambda (_: (nfs2 c +x0)).(\lambda (H7: (nf2 c (TLRef x1))).(let H8 \def (eq_ind T t (\lambda (t0: +T).(ty3 g c t0 (THead (Bind Abst) w u))) H (THeads (Flat Appl) x0 (TLRef x1)) +H5) in (eq_ind_r T (THeads (Flat Appl) x0 (TLRef x1)) (\lambda (t0: T).(ex4_2 +T T (\lambda (v: T).(\lambda (_: T).(eq T t0 (THead (Bind Abst) w v)))) +(\lambda (_: T).(\lambda (w0: T).(ty3 g c w w0))) (\lambda (v: T).(\lambda +(_: T).(ty3 g (CHead c (Bind Abst) w) v u))) (\lambda (v: T).(\lambda (_: +T).(nf2 (CHead c (Bind Abst) w) v))))) (let H9 \def H2 in ((let H10 \def H8 +in (unintro T u (\lambda (t0: T).((ty3 g c (THeads (Flat Appl) x0 (TLRef x1)) +(THead (Bind Abst) w t0)) \to ((ty3_nf2_inv_abst_premise c w t0) \to (ex4_2 T +T (\lambda (v: T).(\lambda (_: T).(eq T (THeads (Flat Appl) x0 (TLRef x1)) +(THead (Bind Abst) w v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c w w0))) +(\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) w) v t0))) +(\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) w) v))))))) +(unintro T w (\lambda (t0: T).(\forall (x: T).((ty3 g c (THeads (Flat Appl) +x0 (TLRef x1)) (THead (Bind Abst) t0 x)) \to ((ty3_nf2_inv_abst_premise c t0 +x) \to (ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T (THeads (Flat Appl) +x0 (TLRef x1)) (THead (Bind Abst) t0 v)))) (\lambda (_: T).(\lambda (w0: +T).(ty3 g c t0 w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind +Abst) t0) v x))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) +t0) v)))))))) (TList_ind (\lambda (t0: TList).(\forall (x: T).(\forall (x2: +T).((ty3 g c (THeads (Flat Appl) t0 (TLRef x1)) (THead (Bind Abst) x x2)) \to +((ty3_nf2_inv_abst_premise c x x2) \to (ex4_2 T T (\lambda (v: T).(\lambda +(_: T).(eq T (THeads (Flat Appl) t0 (TLRef x1)) (THead (Bind Abst) x v)))) +(\lambda (_: T).(\lambda (w0: T).(ty3 g c x w0))) (\lambda (v: T).(\lambda +(_: T).(ty3 g (CHead c (Bind Abst) x) v x2))) (\lambda (v: T).(\lambda (_: +T).(nf2 (CHead c (Bind Abst) x) v))))))))) (\lambda (x: T).(\lambda (x2: +T).(\lambda (H11: (ty3 g c (TLRef x1) (THead (Bind Abst) x x2))).(\lambda +(H12: (ty3_nf2_inv_abst_premise c x x2)).(or_ind (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c (lift (S x1) O t0) (THead (Bind +Abst) x x2))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl x1 c +(CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: +T).(ty3 g e u0 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda +(_: T).(pc3 c (lift (S x1) O u0) (THead (Bind Abst) x x2))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (_: T).(getl x1 c (CHead e (Bind Abst) u0))))) +(\lambda (e: C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0))))) (ex4_2 +T T (\lambda (v: T).(\lambda (_: T).(eq T (TLRef x1) (THead (Bind Abst) x +v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c x w0))) (\lambda (v: +T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) x) v x2))) (\lambda (v: +T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) x) v)))) (\lambda (H13: (ex3_3 C +T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 c (lift (S x1) O +t0) (THead (Bind Abst) x x2))))) (\lambda (e: C).(\lambda (u0: T).(\lambda +(_: T).(getl x1 c (CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0)))))).(ex3_3_ind C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c (lift (S x1) O t0) (THead (Bind +Abst) x x2))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: T).(getl x1 c +(CHead e (Bind Abbr) u0))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (t0: +T).(ty3 g e u0 t0)))) (ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T (TLRef +x1) (THead (Bind Abst) x v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c x +w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) x) v x2))) +(\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) x) v)))) (\lambda +(x3: C).(\lambda (x4: T).(\lambda (x5: T).(\lambda (_: (pc3 c (lift (S x1) O +x5) (THead (Bind Abst) x x2))).(\lambda (H15: (getl x1 c (CHead x3 (Bind +Abbr) x4))).(\lambda (_: (ty3 g x3 x4 x5)).(nf2_gen_lref c x3 x4 x1 H15 H7 +(ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T (TLRef x1) (THead (Bind +Abst) x v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c x w0))) (\lambda (v: +T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) x) v x2))) (\lambda (v: +T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) x) v))))))))))) H13)) (\lambda +(H13: (ex3_3 C T T (\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c +(lift (S x1) O u0) (THead (Bind Abst) x x2))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (_: T).(getl x1 c (CHead e (Bind Abst) u0))))) (\lambda (e: +C).(\lambda (u0: T).(\lambda (t0: T).(ty3 g e u0 t0)))))).(ex3_3_ind C T T +(\lambda (_: C).(\lambda (u0: T).(\lambda (_: T).(pc3 c (lift (S x1) O u0) +(THead (Bind Abst) x x2))))) (\lambda (e: C).(\lambda (u0: T).(\lambda (_: +T).(getl x1 c (CHead e (Bind Abst) u0))))) (\lambda (e: C).(\lambda (u0: +T).(\lambda (t0: T).(ty3 g e u0 t0)))) (ex4_2 T T (\lambda (v: T).(\lambda +(_: T).(eq T (TLRef x1) (THead (Bind Abst) x v)))) (\lambda (_: T).(\lambda +(w0: T).(ty3 g c x w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c +(Bind Abst) x) v x2))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind +Abst) x) v)))) (\lambda (x3: C).(\lambda (x4: T).(\lambda (x5: T).(\lambda +(H14: (pc3 c (lift (S x1) O x4) (THead (Bind Abst) x x2))).(\lambda (H15: +(getl x1 c (CHead x3 (Bind Abst) x4))).(\lambda (_: (ty3 g x3 x4 x5)).(let +H_x0 \def (H12 x3 x4 x1 H15 TNil H14) in (let H17 \def H_x0 in (False_ind +(ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T (TLRef x1) (THead (Bind +Abst) x v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c x w0))) (\lambda (v: +T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) x) v x2))) (\lambda (v: +T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) x) v)))) H17))))))))) H13)) +(ty3_gen_lref g c (THead (Bind Abst) x x2) x1 H11)))))) (\lambda (t0: +T).(\lambda (t1: TList).(\lambda (H11: ((\forall (x: T).(\forall (x2: +T).((ty3 g c (THeads (Flat Appl) t1 (TLRef x1)) (THead (Bind Abst) x x2)) \to +((ty3_nf2_inv_abst_premise c x x2) \to (ex4_2 T T (\lambda (v: T).(\lambda +(_: T).(eq T (THeads (Flat Appl) t1 (TLRef x1)) (THead (Bind Abst) x v)))) +(\lambda (_: T).(\lambda (w0: T).(ty3 g c x w0))) (\lambda (v: T).(\lambda +(_: T).(ty3 g (CHead c (Bind Abst) x) v x2))) (\lambda (v: T).(\lambda (_: +T).(nf2 (CHead c (Bind Abst) x) v)))))))))).(\lambda (x: T).(\lambda (x2: +T).(\lambda (H12: (ty3 g c (THead (Flat Appl) t0 (THeads (Flat Appl) t1 +(TLRef x1))) (THead (Bind Abst) x x2))).(\lambda (H13: +(ty3_nf2_inv_abst_premise c x x2)).(ex3_2_ind T T (\lambda (u0: T).(\lambda +(t2: T).(pc3 c (THead (Flat Appl) t0 (THead (Bind Abst) u0 t2)) (THead (Bind +Abst) x x2)))) (\lambda (u0: T).(\lambda (t2: T).(ty3 g c (THeads (Flat Appl) +t1 (TLRef x1)) (THead (Bind Abst) u0 t2)))) (\lambda (u0: T).(\lambda (_: +T).(ty3 g c t0 u0))) (ex4_2 T T (\lambda (v: T).(\lambda (_: T).(eq T (THead +(Flat Appl) t0 (THeads (Flat Appl) t1 (TLRef x1))) (THead (Bind Abst) x v)))) +(\lambda (_: T).(\lambda (w0: T).(ty3 g c x w0))) (\lambda (v: T).(\lambda +(_: T).(ty3 g (CHead c (Bind Abst) x) v x2))) (\lambda (v: T).(\lambda (_: +T).(nf2 (CHead c (Bind Abst) x) v)))) (\lambda (x3: T).(\lambda (x4: +T).(\lambda (H14: (pc3 c (THead (Flat Appl) t0 (THead (Bind Abst) x3 x4)) +(THead (Bind Abst) x x2))).(\lambda (H15: (ty3 g c (THeads (Flat Appl) t1 +(TLRef x1)) (THead (Bind Abst) x3 x4))).(\lambda (_: (ty3 g c t0 x3)).(let +H_y \def (ty3_nf2_gen__ty3_nf2_inv_abst_aux c x x2 H13 t0 x3 x4 H14) in (let +H_x0 \def (H11 x3 x4 H15 H_y) in (let H17 \def H_x0 in (ex4_2_ind T T +(\lambda (v: T).(\lambda (_: T).(eq T (THeads (Flat Appl) t1 (TLRef x1)) +(THead (Bind Abst) x3 v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 g c x3 +w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) x3) v x4))) +(\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) x3) v))) (ex4_2 T T +(\lambda (v: T).(\lambda (_: T).(eq T (THead (Flat Appl) t0 (THeads (Flat +Appl) t1 (TLRef x1))) (THead (Bind Abst) x v)))) (\lambda (_: T).(\lambda +(w0: T).(ty3 g c x w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c +(Bind Abst) x) v x2))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind +Abst) x) v)))) (\lambda (x5: T).(\lambda (x6: T).(\lambda (H18: (eq T (THeads +(Flat Appl) t1 (TLRef x1)) (THead (Bind Abst) x3 x5))).(\lambda (_: (ty3 g c +x3 x6)).(\lambda (_: (ty3 g (CHead c (Bind Abst) x3) x5 x4)).(\lambda (_: +(nf2 (CHead c (Bind Abst) x3) x5)).(TList_ind (\lambda (t2: TList).((eq T +(THeads (Flat Appl) t2 (TLRef x1)) (THead (Bind Abst) x3 x5)) \to (ex4_2 T T +(\lambda (v: T).(\lambda (_: T).(eq T (THead (Flat Appl) t0 (THeads (Flat +Appl) t2 (TLRef x1))) (THead (Bind Abst) x v)))) (\lambda (_: T).(\lambda +(w0: T).(ty3 g c x w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c +(Bind Abst) x) v x2))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind +Abst) x) v)))))) (\lambda (H22: (eq T (THeads (Flat Appl) TNil (TLRef x1)) +(THead (Bind Abst) x3 x5))).(let H23 \def (eq_ind T (TLRef x1) (\lambda (ee: +T).(match ee in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I +(THead (Bind Abst) x3 x5) H22) in (False_ind (ex4_2 T T (\lambda (v: +T).(\lambda (_: T).(eq T (THead (Flat Appl) t0 (THeads (Flat Appl) TNil +(TLRef x1))) (THead (Bind Abst) x v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 +g c x w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) x) v +x2))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) x) v)))) +H23))) (\lambda (t2: T).(\lambda (t3: TList).(\lambda (_: (((eq T (THeads +(Flat Appl) t3 (TLRef x1)) (THead (Bind Abst) x3 x5)) \to (ex4_2 T T (\lambda +(v: T).(\lambda (_: T).(eq T (THead (Flat Appl) t0 (THeads (Flat Appl) t3 +(TLRef x1))) (THead (Bind Abst) x v)))) (\lambda (_: T).(\lambda (w0: T).(ty3 +g c x w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) x) v +x2))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) x) +v))))))).(\lambda (H22: (eq T (THeads (Flat Appl) (TCons t2 t3) (TLRef x1)) +(THead (Bind Abst) x3 x5))).(let H23 \def (eq_ind T (THead (Flat Appl) t2 +(THeads (Flat Appl) t3 (TLRef x1))) (\lambda (ee: T).(match ee in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind Abst) x3 x5) H22) in (False_ind (ex4_2 T T (\lambda +(v: T).(\lambda (_: T).(eq T (THead (Flat Appl) t0 (THeads (Flat Appl) (TCons +t2 t3) (TLRef x1))) (THead (Bind Abst) x v)))) (\lambda (_: T).(\lambda (w0: +T).(ty3 g c x w0))) (\lambda (v: T).(\lambda (_: T).(ty3 g (CHead c (Bind +Abst) x) v x2))) (\lambda (v: T).(\lambda (_: T).(nf2 (CHead c (Bind Abst) x) +v)))) H23)))))) t1 H18))))))) H17))))))))) (ty3_gen_appl g c t0 (THeads (Flat +Appl) t1 (TLRef x1)) (THead (Bind Abst) x x2) H12))))))))) x0)) H10)) H9)) t +H5))))))) H4)) H3))))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3.ma new file mode 100644 index 000000000..d0f9999d4 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3.ma @@ -0,0 +1,747 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3". + +include "csubt/ty3.ma". + +include "ty3/subst1.ma". + +include "ty3/fsubst0.ma". + +include "pc3/pc1.ma". + +include "pc3/wcpr0.ma". + +include "pc1/props.ma". + +theorem ty3_sred_wcpr0_pr0: + \forall (g: G).(\forall (c1: C).(\forall (t1: T).(\forall (t: T).((ty3 g c1 +t1 t) \to (\forall (c2: C).((wcpr0 c1 c2) \to (\forall (t2: T).((pr0 t1 t2) +\to (ty3 g c2 t2 t))))))))) +\def + \lambda (g: G).(\lambda (c1: C).(\lambda (t1: T).(\lambda (t: T).(\lambda +(H: (ty3 g c1 t1 t)).(ty3_ind g (\lambda (c: C).(\lambda (t0: T).(\lambda +(t2: T).(\forall (c2: C).((wcpr0 c c2) \to (\forall (t3: T).((pr0 t0 t3) \to +(ty3 g c2 t3 t2)))))))) (\lambda (c: C).(\lambda (t2: T).(\lambda (t0: +T).(\lambda (_: (ty3 g c t2 t0)).(\lambda (H1: ((\forall (c2: C).((wcpr0 c +c2) \to (\forall (t3: T).((pr0 t2 t3) \to (ty3 g c2 t3 t0))))))).(\lambda (u: +T).(\lambda (t3: T).(\lambda (_: (ty3 g c u t3)).(\lambda (H3: ((\forall (c2: +C).((wcpr0 c c2) \to (\forall (t4: T).((pr0 u t4) \to (ty3 g c2 t4 +t3))))))).(\lambda (H4: (pc3 c t3 t2)).(\lambda (c2: C).(\lambda (H5: (wcpr0 +c c2)).(\lambda (t4: T).(\lambda (H6: (pr0 u t4)).(ty3_conv g c2 t2 t0 (H1 c2 +H5 t2 (pr0_refl t2)) t4 t3 (H3 c2 H5 t4 H6) (pc3_wcpr0 c c2 H5 t3 t2 +H4)))))))))))))))) (\lambda (c: C).(\lambda (m: nat).(\lambda (c2: +C).(\lambda (_: (wcpr0 c c2)).(\lambda (t2: T).(\lambda (H1: (pr0 (TSort m) +t2)).(eq_ind_r T (TSort m) (\lambda (t0: T).(ty3 g c2 t0 (TSort (next g m)))) +(ty3_sort g c2 m) t2 (pr0_gen_sort t2 m H1)))))))) (\lambda (n: nat).(\lambda +(c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (H0: (getl n c (CHead d (Bind +Abbr) u))).(\lambda (t0: T).(\lambda (_: (ty3 g d u t0)).(\lambda (H2: +((\forall (c2: C).((wcpr0 d c2) \to (\forall (t2: T).((pr0 u t2) \to (ty3 g +c2 t2 t0))))))).(\lambda (c2: C).(\lambda (H3: (wcpr0 c c2)).(\lambda (t2: +T).(\lambda (H4: (pr0 (TLRef n) t2)).(eq_ind_r T (TLRef n) (\lambda (t3: +T).(ty3 g c2 t3 (lift (S n) O t0))) (ex3_2_ind C T (\lambda (e2: C).(\lambda +(u2: T).(getl n c2 (CHead e2 (Bind Abbr) u2)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 d e2))) (\lambda (_: C).(\lambda (u2: T).(pr0 u u2))) (ty3 g c2 +(TLRef n) (lift (S n) O t0)) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H5: +(getl n c2 (CHead x0 (Bind Abbr) x1))).(\lambda (H6: (wcpr0 d x0)).(\lambda +(H7: (pr0 u x1)).(ty3_abbr g n c2 x0 x1 H5 t0 (H2 x0 H6 x1 H7))))))) +(wcpr0_getl c c2 H3 n d u (Bind Abbr) H0)) t2 (pr0_gen_lref t2 n +H4)))))))))))))) (\lambda (n: nat).(\lambda (c: C).(\lambda (d: C).(\lambda +(u: T).(\lambda (H0: (getl n c (CHead d (Bind Abst) u))).(\lambda (t0: +T).(\lambda (_: (ty3 g d u t0)).(\lambda (H2: ((\forall (c2: C).((wcpr0 d c2) +\to (\forall (t2: T).((pr0 u t2) \to (ty3 g c2 t2 t0))))))).(\lambda (c2: +C).(\lambda (H3: (wcpr0 c c2)).(\lambda (t2: T).(\lambda (H4: (pr0 (TLRef n) +t2)).(eq_ind_r T (TLRef n) (\lambda (t3: T).(ty3 g c2 t3 (lift (S n) O u))) +(ex3_2_ind C T (\lambda (e2: C).(\lambda (u2: T).(getl n c2 (CHead e2 (Bind +Abst) u2)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 d e2))) (\lambda (_: +C).(\lambda (u2: T).(pr0 u u2))) (ty3 g c2 (TLRef n) (lift (S n) O u)) +(\lambda (x0: C).(\lambda (x1: T).(\lambda (H5: (getl n c2 (CHead x0 (Bind +Abst) x1))).(\lambda (H6: (wcpr0 d x0)).(\lambda (H7: (pr0 u x1)).(ty3_conv g +c2 (lift (S n) O u) (lift (S n) O t0) (ty3_lift g x0 u t0 (H2 x0 H6 u +(pr0_refl u)) c2 O (S n) (getl_drop Abst c2 x0 x1 n H5)) (TLRef n) (lift (S +n) O x1) (ty3_abst g n c2 x0 x1 H5 t0 (H2 x0 H6 x1 H7)) (pc3_lift c2 x0 (S n) +O (getl_drop Abst c2 x0 x1 n H5) x1 u (pc3_pr2_x x0 x1 u (pr2_free x0 u x1 +H7))))))))) (wcpr0_getl c c2 H3 n d u (Bind Abst) H0)) t2 (pr0_gen_lref t2 n +H4)))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (t0: T).(\lambda +(_: (ty3 g c u t0)).(\lambda (H1: ((\forall (c2: C).((wcpr0 c c2) \to +(\forall (t2: T).((pr0 u t2) \to (ty3 g c2 t2 t0))))))).(\lambda (b: +B).(\lambda (t2: T).(\lambda (t3: T).(\lambda (H2: (ty3 g (CHead c (Bind b) +u) t2 t3)).(\lambda (H3: ((\forall (c2: C).((wcpr0 (CHead c (Bind b) u) c2) +\to (\forall (t4: T).((pr0 t2 t4) \to (ty3 g c2 t4 t3))))))).(\lambda (t4: +T).(\lambda (H4: (ty3 g (CHead c (Bind b) u) t3 t4)).(\lambda (H5: ((\forall +(c2: C).((wcpr0 (CHead c (Bind b) u) c2) \to (\forall (t5: T).((pr0 t3 t5) +\to (ty3 g c2 t5 t4))))))).(\lambda (c2: C).(\lambda (H6: (wcpr0 c +c2)).(\lambda (t5: T).(\lambda (H7: (pr0 (THead (Bind b) u t2) t5)).(let H8 +\def (match H7 in pr0 return (\lambda (t6: T).(\lambda (t7: T).(\lambda (_: +(pr0 t6 t7)).((eq T t6 (THead (Bind b) u t2)) \to ((eq T t7 t5) \to (ty3 g c2 +t5 (THead (Bind b) u t3))))))) with [(pr0_refl t6) \Rightarrow (\lambda (H8: +(eq T t6 (THead (Bind b) u t2))).(\lambda (H9: (eq T t6 t5)).(eq_ind T (THead +(Bind b) u t2) (\lambda (t7: T).((eq T t7 t5) \to (ty3 g c2 t5 (THead (Bind +b) u t3)))) (\lambda (H10: (eq T (THead (Bind b) u t2) t5)).(eq_ind T (THead +(Bind b) u t2) (\lambda (t7: T).(ty3 g c2 t7 (THead (Bind b) u t3))) +(ty3_bind g c2 u t0 (H1 c2 H6 u (pr0_refl u)) b t2 t3 (H3 (CHead c2 (Bind b) +u) (wcpr0_comp c c2 H6 u u (pr0_refl u) (Bind b)) t2 (pr0_refl t2)) t4 (H5 +(CHead c2 (Bind b) u) (wcpr0_comp c c2 H6 u u (pr0_refl u) (Bind b)) t3 +(pr0_refl t3))) t5 H10)) t6 (sym_eq T t6 (THead (Bind b) u t2) H8) H9))) | +(pr0_comp u1 u2 H8 t6 t7 H9 k) \Rightarrow (\lambda (H10: (eq T (THead k u1 +t6) (THead (Bind b) u t2))).(\lambda (H11: (eq T (THead k u2 t7) t5)).((let +H12 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow t6 | (TLRef _) \Rightarrow t6 | (THead _ _ t8) +\Rightarrow t8])) (THead k u1 t6) (THead (Bind b) u t2) H10) in ((let H13 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ t8 _) +\Rightarrow t8])) (THead k u1 t6) (THead (Bind b) u t2) H10) in ((let H14 +\def (f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) +with [(TSort _) \Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) +\Rightarrow k0])) (THead k u1 t6) (THead (Bind b) u t2) H10) in (eq_ind K +(Bind b) (\lambda (k0: K).((eq T u1 u) \to ((eq T t6 t2) \to ((eq T (THead k0 +u2 t7) t5) \to ((pr0 u1 u2) \to ((pr0 t6 t7) \to (ty3 g c2 t5 (THead (Bind b) +u t3)))))))) (\lambda (H15: (eq T u1 u)).(eq_ind T u (\lambda (t8: T).((eq T +t6 t2) \to ((eq T (THead (Bind b) u2 t7) t5) \to ((pr0 t8 u2) \to ((pr0 t6 +t7) \to (ty3 g c2 t5 (THead (Bind b) u t3))))))) (\lambda (H16: (eq T t6 +t2)).(eq_ind T t2 (\lambda (t8: T).((eq T (THead (Bind b) u2 t7) t5) \to +((pr0 u u2) \to ((pr0 t8 t7) \to (ty3 g c2 t5 (THead (Bind b) u t3)))))) +(\lambda (H17: (eq T (THead (Bind b) u2 t7) t5)).(eq_ind T (THead (Bind b) u2 +t7) (\lambda (t8: T).((pr0 u u2) \to ((pr0 t2 t7) \to (ty3 g c2 t8 (THead +(Bind b) u t3))))) (\lambda (H18: (pr0 u u2)).(\lambda (H19: (pr0 t2 +t7)).(ex_ind T (\lambda (t8: T).(ty3 g (CHead c2 (Bind b) u) t4 t8)) (ty3 g +c2 (THead (Bind b) u2 t7) (THead (Bind b) u t3)) (\lambda (x: T).(\lambda +(H20: (ty3 g (CHead c2 (Bind b) u) t4 x)).(ex_ind T (\lambda (t8: T).(ty3 g +(CHead c2 (Bind b) u2) t3 t8)) (ty3 g c2 (THead (Bind b) u2 t7) (THead (Bind +b) u t3)) (\lambda (x0: T).(\lambda (H21: (ty3 g (CHead c2 (Bind b) u2) t3 +x0)).(ty3_conv g c2 (THead (Bind b) u t3) (THead (Bind b) u t4) (ty3_bind g +c2 u t0 (H1 c2 H6 u (pr0_refl u)) b t3 t4 (H5 (CHead c2 (Bind b) u) +(wcpr0_comp c c2 H6 u u (pr0_refl u) (Bind b)) t3 (pr0_refl t3)) x H20) +(THead (Bind b) u2 t7) (THead (Bind b) u2 t3) (ty3_bind g c2 u2 t0 (H1 c2 H6 +u2 H18) b t7 t3 (H3 (CHead c2 (Bind b) u2) (wcpr0_comp c c2 H6 u u2 H18 (Bind +b)) t7 H19) x0 H21) (pc3_pr2_x c2 (THead (Bind b) u2 t3) (THead (Bind b) u +t3) (pr2_head_1 c2 u u2 (pr2_free c2 u u2 H18) (Bind b) t3))))) (ty3_correct +g (CHead c2 (Bind b) u2) t7 t3 (H3 (CHead c2 (Bind b) u2) (wcpr0_comp c c2 H6 +u u2 H18 (Bind b)) t7 H19))))) (ty3_correct g (CHead c2 (Bind b) u) t3 t4 (H5 +(CHead c2 (Bind b) u) (wcpr0_comp c c2 H6 u u (pr0_refl u) (Bind b)) t3 +(pr0_refl t3)))))) t5 H17)) t6 (sym_eq T t6 t2 H16))) u1 (sym_eq T u1 u +H15))) k (sym_eq K k (Bind b) H14))) H13)) H12)) H11 H8 H9))) | (pr0_beta u0 +v1 v2 H8 t6 t7 H9) \Rightarrow (\lambda (H10: (eq T (THead (Flat Appl) v1 +(THead (Bind Abst) u0 t6)) (THead (Bind b) u t2))).(\lambda (H11: (eq T +(THead (Bind Abbr) v2 t7) t5)).((let H12 \def (eq_ind T (THead (Flat Appl) v1 +(THead (Bind Abst) u0 t6)) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind +b) u t2) H10) in (False_ind ((eq T (THead (Bind Abbr) v2 t7) t5) \to ((pr0 v1 +v2) \to ((pr0 t6 t7) \to (ty3 g c2 t5 (THead (Bind b) u t3))))) H12)) H11 H8 +H9))) | (pr0_upsilon b0 H8 v1 v2 H9 u1 u2 H10 t6 t7 H11) \Rightarrow (\lambda +(H12: (eq T (THead (Flat Appl) v1 (THead (Bind b0) u1 t6)) (THead (Bind b) u +t2))).(\lambda (H13: (eq T (THead (Bind b0) u2 (THead (Flat Appl) (lift (S O) +O v2) t7)) t5)).((let H14 \def (eq_ind T (THead (Flat Appl) v1 (THead (Bind +b0) u1 t6)) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind b) u t2) +H12) in (False_ind ((eq T (THead (Bind b0) u2 (THead (Flat Appl) (lift (S O) +O v2) t7)) t5) \to ((not (eq B b0 Abst)) \to ((pr0 v1 v2) \to ((pr0 u1 u2) +\to ((pr0 t6 t7) \to (ty3 g c2 t5 (THead (Bind b) u t3))))))) H14)) H13 H8 H9 +H10 H11))) | (pr0_delta u1 u2 H8 t6 t7 H9 w H10) \Rightarrow (\lambda (H11: +(eq T (THead (Bind Abbr) u1 t6) (THead (Bind b) u t2))).(\lambda (H12: (eq T +(THead (Bind Abbr) u2 w) t5)).((let H13 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow t6 | +(TLRef _) \Rightarrow t6 | (THead _ _ t8) \Rightarrow t8])) (THead (Bind +Abbr) u1 t6) (THead (Bind b) u t2) H11) in ((let H14 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ t8 _) \Rightarrow t8])) +(THead (Bind Abbr) u1 t6) (THead (Bind b) u t2) H11) in ((let H15 \def +(f_equal T B (\lambda (e: T).(match e in T return (\lambda (_: T).B) with +[(TSort _) \Rightarrow Abbr | (TLRef _) \Rightarrow Abbr | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).B) with [(Bind b0) +\Rightarrow b0 | (Flat _) \Rightarrow Abbr])])) (THead (Bind Abbr) u1 t6) +(THead (Bind b) u t2) H11) in (eq_ind B Abbr (\lambda (b0: B).((eq T u1 u) +\to ((eq T t6 t2) \to ((eq T (THead (Bind Abbr) u2 w) t5) \to ((pr0 u1 u2) +\to ((pr0 t6 t7) \to ((subst0 O u2 t7 w) \to (ty3 g c2 t5 (THead (Bind b0) u +t3))))))))) (\lambda (H16: (eq T u1 u)).(eq_ind T u (\lambda (t8: T).((eq T +t6 t2) \to ((eq T (THead (Bind Abbr) u2 w) t5) \to ((pr0 t8 u2) \to ((pr0 t6 +t7) \to ((subst0 O u2 t7 w) \to (ty3 g c2 t5 (THead (Bind Abbr) u t3)))))))) +(\lambda (H17: (eq T t6 t2)).(eq_ind T t2 (\lambda (t8: T).((eq T (THead +(Bind Abbr) u2 w) t5) \to ((pr0 u u2) \to ((pr0 t8 t7) \to ((subst0 O u2 t7 +w) \to (ty3 g c2 t5 (THead (Bind Abbr) u t3))))))) (\lambda (H18: (eq T +(THead (Bind Abbr) u2 w) t5)).(eq_ind T (THead (Bind Abbr) u2 w) (\lambda +(t8: T).((pr0 u u2) \to ((pr0 t2 t7) \to ((subst0 O u2 t7 w) \to (ty3 g c2 t8 +(THead (Bind Abbr) u t3)))))) (\lambda (H19: (pr0 u u2)).(\lambda (H20: (pr0 +t2 t7)).(\lambda (H21: (subst0 O u2 t7 w)).(let H22 \def (eq_ind_r B b +(\lambda (b0: B).(\forall (c3: C).((wcpr0 (CHead c (Bind b0) u) c3) \to +(\forall (t8: T).((pr0 t3 t8) \to (ty3 g c3 t8 t4)))))) H5 Abbr H15) in (let +H23 \def (eq_ind_r B b (\lambda (b0: B).(ty3 g (CHead c (Bind b0) u) t3 t4)) +H4 Abbr H15) in (let H24 \def (eq_ind_r B b (\lambda (b0: B).(\forall (c3: +C).((wcpr0 (CHead c (Bind b0) u) c3) \to (\forall (t8: T).((pr0 t2 t8) \to +(ty3 g c3 t8 t3)))))) H3 Abbr H15) in (let H25 \def (eq_ind_r B b (\lambda +(b0: B).(ty3 g (CHead c (Bind b0) u) t2 t3)) H2 Abbr H15) in (ex_ind T +(\lambda (t8: T).(ty3 g (CHead c2 (Bind Abbr) u) t4 t8)) (ty3 g c2 (THead +(Bind Abbr) u2 w) (THead (Bind Abbr) u t3)) (\lambda (x: T).(\lambda (H26: +(ty3 g (CHead c2 (Bind Abbr) u) t4 x)).(ex_ind T (\lambda (t8: T).(ty3 g +(CHead c2 (Bind Abbr) u2) t3 t8)) (ty3 g c2 (THead (Bind Abbr) u2 w) (THead +(Bind Abbr) u t3)) (\lambda (x0: T).(\lambda (H27: (ty3 g (CHead c2 (Bind +Abbr) u2) t3 x0)).(ty3_conv g c2 (THead (Bind Abbr) u t3) (THead (Bind Abbr) +u t4) (ty3_bind g c2 u t0 (H1 c2 H6 u (pr0_refl u)) Abbr t3 t4 (H22 (CHead c2 +(Bind Abbr) u) (wcpr0_comp c c2 H6 u u (pr0_refl u) (Bind Abbr)) t3 (pr0_refl +t3)) x H26) (THead (Bind Abbr) u2 w) (THead (Bind Abbr) u2 t3) (ty3_bind g c2 +u2 t0 (H1 c2 H6 u2 H19) Abbr w t3 (ty3_subst0 g (CHead c2 (Bind Abbr) u2) t7 +t3 (H24 (CHead c2 (Bind Abbr) u2) (wcpr0_comp c c2 H6 u u2 H19 (Bind Abbr)) +t7 H20) c2 u2 O (getl_refl Abbr c2 u2) w H21) x0 H27) (pc3_pr2_x c2 (THead +(Bind Abbr) u2 t3) (THead (Bind Abbr) u t3) (pr2_head_1 c2 u u2 (pr2_free c2 +u u2 H19) (Bind Abbr) t3))))) (ty3_correct g (CHead c2 (Bind Abbr) u2) t7 t3 +(H24 (CHead c2 (Bind Abbr) u2) (wcpr0_comp c c2 H6 u u2 H19 (Bind Abbr)) t7 +H20))))) (ty3_correct g (CHead c2 (Bind Abbr) u) t3 t4 (H22 (CHead c2 (Bind +Abbr) u) (wcpr0_comp c c2 H6 u u (pr0_refl u) (Bind Abbr)) t3 (pr0_refl +t3))))))))))) t5 H18)) t6 (sym_eq T t6 t2 H17))) u1 (sym_eq T u1 u H16))) b +H15)) H14)) H13)) H12 H8 H9 H10))) | (pr0_zeta b0 H8 t6 t7 H9 u0) \Rightarrow +(\lambda (H10: (eq T (THead (Bind b0) u0 (lift (S O) O t6)) (THead (Bind b) u +t2))).(\lambda (H11: (eq T t7 t5)).((let H12 \def (f_equal T T (\lambda (e: +T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow ((let +rec lref_map (f: ((nat \to nat))) (d: nat) (t8: T) on t8: T \def (match t8 +with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef (match +(blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | (THead k u1 +t9) \Rightarrow (THead k (lref_map f d u1) (lref_map f (s k d) t9))]) in +lref_map) (\lambda (x: nat).(plus x (S O))) O t6) | (TLRef _) \Rightarrow +((let rec lref_map (f: ((nat \to nat))) (d: nat) (t8: T) on t8: T \def (match +t8 with [(TSort n) \Rightarrow (TSort n) | (TLRef i) \Rightarrow (TLRef +(match (blt i d) with [true \Rightarrow i | false \Rightarrow (f i)])) | +(THead k u1 t9) \Rightarrow (THead k (lref_map f d u1) (lref_map f (s k d) +t9))]) in lref_map) (\lambda (x: nat).(plus x (S O))) O t6) | (THead _ _ t8) +\Rightarrow t8])) (THead (Bind b0) u0 (lift (S O) O t6)) (THead (Bind b) u +t2) H10) in ((let H13 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow u0 | (TLRef _) \Rightarrow u0 +| (THead _ t8 _) \Rightarrow t8])) (THead (Bind b0) u0 (lift (S O) O t6)) +(THead (Bind b) u t2) H10) in ((let H14 \def (f_equal T B (\lambda (e: +T).(match e in T return (\lambda (_: T).B) with [(TSort _) \Rightarrow b0 | +(TLRef _) \Rightarrow b0 | (THead k _ _) \Rightarrow (match k in K return +(\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) \Rightarrow +b0])])) (THead (Bind b0) u0 (lift (S O) O t6)) (THead (Bind b) u t2) H10) in +(eq_ind B b (\lambda (b1: B).((eq T u0 u) \to ((eq T (lift (S O) O t6) t2) +\to ((eq T t7 t5) \to ((not (eq B b1 Abst)) \to ((pr0 t6 t7) \to (ty3 g c2 t5 +(THead (Bind b) u t3)))))))) (\lambda (H15: (eq T u0 u)).(eq_ind T u (\lambda +(_: T).((eq T (lift (S O) O t6) t2) \to ((eq T t7 t5) \to ((not (eq B b +Abst)) \to ((pr0 t6 t7) \to (ty3 g c2 t5 (THead (Bind b) u t3))))))) (\lambda +(H16: (eq T (lift (S O) O t6) t2)).(eq_ind T (lift (S O) O t6) (\lambda (_: +T).((eq T t7 t5) \to ((not (eq B b Abst)) \to ((pr0 t6 t7) \to (ty3 g c2 t5 +(THead (Bind b) u t3)))))) (\lambda (H17: (eq T t7 t5)).(eq_ind T t5 (\lambda +(t8: T).((not (eq B b Abst)) \to ((pr0 t6 t8) \to (ty3 g c2 t5 (THead (Bind +b) u t3))))) (\lambda (H18: (not (eq B b Abst))).(\lambda (H19: (pr0 t6 +t5)).(let H20 \def (eq_ind_r T t2 (\lambda (t8: T).(\forall (c3: C).((wcpr0 +(CHead c (Bind b) u) c3) \to (\forall (t9: T).((pr0 t8 t9) \to (ty3 g c3 t9 +t3)))))) H3 (lift (S O) O t6) H16) in (let H21 \def (eq_ind_r T t2 (\lambda +(t8: T).(ty3 g (CHead c (Bind b) u) t8 t3)) H2 (lift (S O) O t6) H16) in +(ex_ind T (\lambda (t8: T).(ty3 g (CHead c2 (Bind b) u) t4 t8)) (ty3 g c2 t5 +(THead (Bind b) u t3)) (\lambda (x: T).(\lambda (H22: (ty3 g (CHead c2 (Bind +b) u) t4 x)).(B_ind (\lambda (b1: B).((not (eq B b1 Abst)) \to ((ty3 g (CHead +c2 (Bind b1) u) t3 t4) \to ((ty3 g (CHead c2 (Bind b1) u) t4 x) \to ((ty3 g +(CHead c2 (Bind b1) u) (lift (S O) O t5) t3) \to (ty3 g c2 t5 (THead (Bind +b1) u t3))))))) (\lambda (H23: (not (eq B Abbr Abst))).(\lambda (H24: (ty3 g +(CHead c2 (Bind Abbr) u) t3 t4)).(\lambda (H25: (ty3 g (CHead c2 (Bind Abbr) +u) t4 x)).(\lambda (H26: (ty3 g (CHead c2 (Bind Abbr) u) (lift (S O) O t5) +t3)).(let H27 \def (ty3_gen_cabbr g (CHead c2 (Bind Abbr) u) (lift (S O) O +t5) t3 H26 c2 u O (getl_refl Abbr c2 u) (CHead c2 (Bind Abbr) u) +(csubst1_refl O u (CHead c2 (Bind Abbr) u)) c2 (drop_drop (Bind Abbr) O c2 c2 +(drop_refl c2) u)) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(subst1 +O u (lift (S O) O t5) (lift (S O) O y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 O u t3 (lift (S O) O y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 +g c2 y1 y2))) (ty3 g c2 t5 (THead (Bind Abbr) u t3)) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H28: (subst1 O u (lift (S O) O t5) (lift (S O) +O x0))).(\lambda (H29: (subst1 O u t3 (lift (S O) O x1))).(\lambda (H30: (ty3 +g c2 x0 x1)).(let H31 \def (eq_ind T x0 (\lambda (t8: T).(ty3 g c2 t8 x1)) +H30 t5 (lift_inj x0 t5 (S O) O (subst1_gen_lift_eq t5 u (lift (S O) O x0) (S +O) O O (le_n O) (eq_ind_r nat (plus (S O) O) (\lambda (n: nat).(lt O n)) +(le_n (plus (S O) O)) (plus O (S O)) (plus_comm O (S O))) H28))) in (ty3_conv +g c2 (THead (Bind Abbr) u t3) (THead (Bind Abbr) u t4) (ty3_bind g c2 u t0 +(H1 c2 H6 u (pr0_refl u)) Abbr t3 t4 H24 x H25) t5 x1 H31 (pc3_pr3_x c2 x1 +(THead (Bind Abbr) u t3) (pr3_t (THead (Bind Abbr) u (lift (S O) O x1)) +(THead (Bind Abbr) u t3) c2 (pr3_pr2 c2 (THead (Bind Abbr) u t3) (THead (Bind +Abbr) u (lift (S O) O x1)) (pr2_free c2 (THead (Bind Abbr) u t3) (THead (Bind +Abbr) u (lift (S O) O x1)) (pr0_delta1 u u (pr0_refl u) t3 t3 (pr0_refl t3) +(lift (S O) O x1) H29))) x1 (pr3_pr2 c2 (THead (Bind Abbr) u (lift (S O) O +x1)) x1 (pr2_free c2 (THead (Bind Abbr) u (lift (S O) O x1)) x1 (pr0_zeta +Abbr H23 x1 x1 (pr0_refl x1) u)))))))))))) H27)))))) (\lambda (H23: (not (eq +B Abst Abst))).(\lambda (_: (ty3 g (CHead c2 (Bind Abst) u) t3 t4)).(\lambda +(_: (ty3 g (CHead c2 (Bind Abst) u) t4 x)).(\lambda (_: (ty3 g (CHead c2 +(Bind Abst) u) (lift (S O) O t5) t3)).(let H27 \def (match (H23 (refl_equal B +Abst)) in False return (\lambda (_: False).(ty3 g c2 t5 (THead (Bind Abst) u +t3))) with []) in H27))))) (\lambda (H23: (not (eq B Void Abst))).(\lambda +(H24: (ty3 g (CHead c2 (Bind Void) u) t3 t4)).(\lambda (H25: (ty3 g (CHead c2 +(Bind Void) u) t4 x)).(\lambda (H26: (ty3 g (CHead c2 (Bind Void) u) (lift (S +O) O t5) t3)).(let H27 \def (ty3_gen_cvoid g (CHead c2 (Bind Void) u) (lift +(S O) O t5) t3 H26 c2 u O (getl_refl Void c2 u) c2 (drop_drop (Bind Void) O +c2 c2 (drop_refl c2) u)) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: +T).(eq T (lift (S O) O t5) (lift (S O) O y1)))) (\lambda (_: T).(\lambda (y2: +T).(eq T t3 (lift (S O) O y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g c2 +y1 y2))) (ty3 g c2 t5 (THead (Bind Void) u t3)) (\lambda (x0: T).(\lambda +(x1: T).(\lambda (H28: (eq T (lift (S O) O t5) (lift (S O) O x0))).(\lambda +(H29: (eq T t3 (lift (S O) O x1))).(\lambda (H30: (ty3 g c2 x0 x1)).(let H31 +\def (eq_ind T t3 (\lambda (t8: T).(ty3 g (CHead c2 (Bind Void) u) t8 t4)) +H24 (lift (S O) O x1) H29) in (eq_ind_r T (lift (S O) O x1) (\lambda (t8: +T).(ty3 g c2 t5 (THead (Bind Void) u t8))) (let H32 \def (eq_ind_r T x0 +(\lambda (t8: T).(ty3 g c2 t8 x1)) H30 t5 (lift_inj t5 x0 (S O) O H28)) in +(ty3_conv g c2 (THead (Bind Void) u (lift (S O) O x1)) (THead (Bind Void) u +t4) (ty3_bind g c2 u t0 (H1 c2 H6 u (pr0_refl u)) Void (lift (S O) O x1) t4 +H31 x H25) t5 x1 H32 (pc3_s c2 x1 (THead (Bind Void) u (lift (S O) O x1)) +(pc3_pr2_r c2 (THead (Bind Void) u (lift (S O) O x1)) x1 (pr2_free c2 (THead +(Bind Void) u (lift (S O) O x1)) x1 (pr0_zeta Void H23 x1 x1 (pr0_refl x1) +u)))))) t3 H29))))))) H27)))))) b H18 (H5 (CHead c2 (Bind b) u) (wcpr0_comp c +c2 H6 u u (pr0_refl u) (Bind b)) t3 (pr0_refl t3)) H22 (H20 (CHead c2 (Bind +b) u) (wcpr0_comp c c2 H6 u u (pr0_refl u) (Bind b)) (lift (S O) O t5) +(pr0_lift t6 t5 H19 (S O) O))))) (ty3_correct g (CHead c2 (Bind b) u) t3 t4 +(H5 (CHead c2 (Bind b) u) (wcpr0_comp c c2 H6 u u (pr0_refl u) (Bind b)) t3 +(pr0_refl t3)))))))) t7 (sym_eq T t7 t5 H17))) t2 H16)) u0 (sym_eq T u0 u +H15))) b0 (sym_eq B b0 b H14))) H13)) H12)) H11 H8 H9))) | (pr0_epsilon t6 t7 +H8 u0) \Rightarrow (\lambda (H9: (eq T (THead (Flat Cast) u0 t6) (THead (Bind +b) u t2))).(\lambda (H10: (eq T t7 t5)).((let H11 \def (eq_ind T (THead (Flat +Cast) u0 t6) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind b) u t2) +H9) in (False_ind ((eq T t7 t5) \to ((pr0 t6 t7) \to (ty3 g c2 t5 (THead +(Bind b) u t3)))) H11)) H10 H8)))]) in (H8 (refl_equal T (THead (Bind b) u +t2)) (refl_equal T t5)))))))))))))))))))) (\lambda (c: C).(\lambda (w: +T).(\lambda (u: T).(\lambda (_: (ty3 g c w u)).(\lambda (H1: ((\forall (c2: +C).((wcpr0 c c2) \to (\forall (t2: T).((pr0 w t2) \to (ty3 g c2 t2 +u))))))).(\lambda (v: T).(\lambda (t0: T).(\lambda (H2: (ty3 g c v (THead +(Bind Abst) u t0))).(\lambda (H3: ((\forall (c2: C).((wcpr0 c c2) \to +(\forall (t2: T).((pr0 v t2) \to (ty3 g c2 t2 (THead (Bind Abst) u +t0)))))))).(\lambda (c2: C).(\lambda (H4: (wcpr0 c c2)).(\lambda (t2: +T).(\lambda (H5: (pr0 (THead (Flat Appl) w v) t2)).(let H6 \def (match H5 in +pr0 return (\lambda (t3: T).(\lambda (t4: T).(\lambda (_: (pr0 t3 t4)).((eq T +t3 (THead (Flat Appl) w v)) \to ((eq T t4 t2) \to (ty3 g c2 t2 (THead (Flat +Appl) w (THead (Bind Abst) u t0)))))))) with [(pr0_refl t3) \Rightarrow +(\lambda (H6: (eq T t3 (THead (Flat Appl) w v))).(\lambda (H7: (eq T t3 +t2)).(eq_ind T (THead (Flat Appl) w v) (\lambda (t4: T).((eq T t4 t2) \to +(ty3 g c2 t2 (THead (Flat Appl) w (THead (Bind Abst) u t0))))) (\lambda (H8: +(eq T (THead (Flat Appl) w v) t2)).(eq_ind T (THead (Flat Appl) w v) (\lambda +(t4: T).(ty3 g c2 t4 (THead (Flat Appl) w (THead (Bind Abst) u t0)))) +(ty3_appl g c2 w u (H1 c2 H4 w (pr0_refl w)) v t0 (H3 c2 H4 v (pr0_refl v))) +t2 H8)) t3 (sym_eq T t3 (THead (Flat Appl) w v) H6) H7))) | (pr0_comp u1 u2 +H6 t3 t4 H7 k) \Rightarrow (\lambda (H8: (eq T (THead k u1 t3) (THead (Flat +Appl) w v))).(\lambda (H9: (eq T (THead k u2 t4) t2)).((let H10 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t3 | (TLRef _) \Rightarrow t3 | (THead _ _ t5) \Rightarrow t5])) +(THead k u1 t3) (THead (Flat Appl) w v) H8) in ((let H11 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ t5 _) \Rightarrow t5])) +(THead k u1 t3) (THead (Flat Appl) w v) H8) in ((let H12 \def (f_equal T K +(\lambda (e: T).(match e in T return (\lambda (_: T).K) with [(TSort _) +\Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) \Rightarrow k0])) +(THead k u1 t3) (THead (Flat Appl) w v) H8) in (eq_ind K (Flat Appl) (\lambda +(k0: K).((eq T u1 w) \to ((eq T t3 v) \to ((eq T (THead k0 u2 t4) t2) \to +((pr0 u1 u2) \to ((pr0 t3 t4) \to (ty3 g c2 t2 (THead (Flat Appl) w (THead +(Bind Abst) u t0))))))))) (\lambda (H13: (eq T u1 w)).(eq_ind T w (\lambda +(t5: T).((eq T t3 v) \to ((eq T (THead (Flat Appl) u2 t4) t2) \to ((pr0 t5 +u2) \to ((pr0 t3 t4) \to (ty3 g c2 t2 (THead (Flat Appl) w (THead (Bind Abst) +u t0)))))))) (\lambda (H14: (eq T t3 v)).(eq_ind T v (\lambda (t5: T).((eq T +(THead (Flat Appl) u2 t4) t2) \to ((pr0 w u2) \to ((pr0 t5 t4) \to (ty3 g c2 +t2 (THead (Flat Appl) w (THead (Bind Abst) u t0))))))) (\lambda (H15: (eq T +(THead (Flat Appl) u2 t4) t2)).(eq_ind T (THead (Flat Appl) u2 t4) (\lambda +(t5: T).((pr0 w u2) \to ((pr0 v t4) \to (ty3 g c2 t5 (THead (Flat Appl) w +(THead (Bind Abst) u t0)))))) (\lambda (H16: (pr0 w u2)).(\lambda (H17: (pr0 +v t4)).(ex_ind T (\lambda (t5: T).(ty3 g c2 (THead (Bind Abst) u t0) t5)) +(ty3 g c2 (THead (Flat Appl) u2 t4) (THead (Flat Appl) w (THead (Bind Abst) u +t0))) (\lambda (x: T).(\lambda (H18: (ty3 g c2 (THead (Bind Abst) u t0) +x)).(ex4_3_ind T T T (\lambda (t5: T).(\lambda (_: T).(\lambda (_: T).(pc3 c2 +(THead (Bind Abst) u t5) x)))) (\lambda (_: T).(\lambda (t6: T).(\lambda (_: +T).(ty3 g c2 u t6)))) (\lambda (t5: T).(\lambda (_: T).(\lambda (_: T).(ty3 g +(CHead c2 (Bind Abst) u) t0 t5)))) (\lambda (t5: T).(\lambda (_: T).(\lambda +(t7: T).(ty3 g (CHead c2 (Bind Abst) u) t5 t7)))) (ty3 g c2 (THead (Flat +Appl) u2 t4) (THead (Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (_: (pc3 c2 (THead (Bind Abst) +u x0) x)).(\lambda (H20: (ty3 g c2 u x1)).(\lambda (H21: (ty3 g (CHead c2 +(Bind Abst) u) t0 x0)).(\lambda (H22: (ty3 g (CHead c2 (Bind Abst) u) x0 +x2)).(ty3_conv g c2 (THead (Flat Appl) w (THead (Bind Abst) u t0)) (THead +(Flat Appl) w (THead (Bind Abst) u x0)) (ty3_appl g c2 w u (H1 c2 H4 w +(pr0_refl w)) (THead (Bind Abst) u t0) x0 (ty3_bind g c2 u x1 H20 Abst t0 x0 +H21 x2 H22)) (THead (Flat Appl) u2 t4) (THead (Flat Appl) u2 (THead (Bind +Abst) u t0)) (ty3_appl g c2 u2 u (H1 c2 H4 u2 H16) t4 t0 (H3 c2 H4 t4 H17)) +(pc3_pr2_x c2 (THead (Flat Appl) u2 (THead (Bind Abst) u t0)) (THead (Flat +Appl) w (THead (Bind Abst) u t0)) (pr2_head_1 c2 w u2 (pr2_free c2 w u2 H16) +(Flat Appl) (THead (Bind Abst) u t0))))))))))) (ty3_gen_bind g Abst c2 u t0 x +H18)))) (ty3_correct g c2 v (THead (Bind Abst) u t0) (H3 c2 H4 v (pr0_refl +v)))))) t2 H15)) t3 (sym_eq T t3 v H14))) u1 (sym_eq T u1 w H13))) k (sym_eq +K k (Flat Appl) H12))) H11)) H10)) H9 H6 H7))) | (pr0_beta u0 v1 v2 H6 t3 t4 +H7) \Rightarrow (\lambda (H8: (eq T (THead (Flat Appl) v1 (THead (Bind Abst) +u0 t3)) (THead (Flat Appl) w v))).(\lambda (H9: (eq T (THead (Bind Abbr) v2 +t4) t2)).((let H10 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow (THead (Bind Abst) u0 t3) | +(TLRef _) \Rightarrow (THead (Bind Abst) u0 t3) | (THead _ _ t5) \Rightarrow +t5])) (THead (Flat Appl) v1 (THead (Bind Abst) u0 t3)) (THead (Flat Appl) w +v) H8) in ((let H11 \def (f_equal T T (\lambda (e: T).(match e in T return +(\lambda (_: T).T) with [(TSort _) \Rightarrow v1 | (TLRef _) \Rightarrow v1 +| (THead _ t5 _) \Rightarrow t5])) (THead (Flat Appl) v1 (THead (Bind Abst) +u0 t3)) (THead (Flat Appl) w v) H8) in (eq_ind T w (\lambda (t5: T).((eq T +(THead (Bind Abst) u0 t3) v) \to ((eq T (THead (Bind Abbr) v2 t4) t2) \to +((pr0 t5 v2) \to ((pr0 t3 t4) \to (ty3 g c2 t2 (THead (Flat Appl) w (THead +(Bind Abst) u t0)))))))) (\lambda (H12: (eq T (THead (Bind Abst) u0 t3) +v)).(eq_ind T (THead (Bind Abst) u0 t3) (\lambda (_: T).((eq T (THead (Bind +Abbr) v2 t4) t2) \to ((pr0 w v2) \to ((pr0 t3 t4) \to (ty3 g c2 t2 (THead +(Flat Appl) w (THead (Bind Abst) u t0))))))) (\lambda (H13: (eq T (THead +(Bind Abbr) v2 t4) t2)).(eq_ind T (THead (Bind Abbr) v2 t4) (\lambda (t5: +T).((pr0 w v2) \to ((pr0 t3 t4) \to (ty3 g c2 t5 (THead (Flat Appl) w (THead +(Bind Abst) u t0)))))) (\lambda (H14: (pr0 w v2)).(\lambda (H15: (pr0 t3 +t4)).(let H16 \def (eq_ind_r T v (\lambda (t5: T).(\forall (c3: C).((wcpr0 c +c3) \to (\forall (t6: T).((pr0 t5 t6) \to (ty3 g c3 t6 (THead (Bind Abst) u +t0))))))) H3 (THead (Bind Abst) u0 t3) H12) in (let H17 \def (eq_ind_r T v +(\lambda (t5: T).(ty3 g c t5 (THead (Bind Abst) u t0))) H2 (THead (Bind Abst) +u0 t3) H12) in (ex_ind T (\lambda (t5: T).(ty3 g c2 (THead (Bind Abst) u t0) +t5)) (ty3 g c2 (THead (Bind Abbr) v2 t4) (THead (Flat Appl) w (THead (Bind +Abst) u t0))) (\lambda (x: T).(\lambda (H18: (ty3 g c2 (THead (Bind Abst) u +t0) x)).(ex4_3_ind T T T (\lambda (t5: T).(\lambda (_: T).(\lambda (_: +T).(pc3 c2 (THead (Bind Abst) u t5) x)))) (\lambda (_: T).(\lambda (t6: +T).(\lambda (_: T).(ty3 g c2 u t6)))) (\lambda (t5: T).(\lambda (_: +T).(\lambda (_: T).(ty3 g (CHead c2 (Bind Abst) u) t0 t5)))) (\lambda (t5: +T).(\lambda (_: T).(\lambda (t7: T).(ty3 g (CHead c2 (Bind Abst) u) t5 t7)))) +(ty3 g c2 (THead (Bind Abbr) v2 t4) (THead (Flat Appl) w (THead (Bind Abst) u +t0))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (_: (pc3 c2 +(THead (Bind Abst) u x0) x)).(\lambda (H20: (ty3 g c2 u x1)).(\lambda (H21: +(ty3 g (CHead c2 (Bind Abst) u) t0 x0)).(\lambda (H22: (ty3 g (CHead c2 (Bind +Abst) u) x0 x2)).(ex4_3_ind T T T (\lambda (t5: T).(\lambda (_: T).(\lambda +(_: T).(pc3 c2 (THead (Bind Abst) u0 t5) (THead (Bind Abst) u t0))))) +(\lambda (_: T).(\lambda (t6: T).(\lambda (_: T).(ty3 g c2 u0 t6)))) (\lambda +(t5: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c2 (Bind Abst) u0) t4 +t5)))) (\lambda (t5: T).(\lambda (_: T).(\lambda (t7: T).(ty3 g (CHead c2 +(Bind Abst) u0) t5 t7)))) (ty3 g c2 (THead (Bind Abbr) v2 t4) (THead (Flat +Appl) w (THead (Bind Abst) u t0))) (\lambda (x3: T).(\lambda (x4: T).(\lambda +(x5: T).(\lambda (H23: (pc3 c2 (THead (Bind Abst) u0 x3) (THead (Bind Abst) u +t0))).(\lambda (H24: (ty3 g c2 u0 x4)).(\lambda (H25: (ty3 g (CHead c2 (Bind +Abst) u0) t4 x3)).(\lambda (H26: (ty3 g (CHead c2 (Bind Abst) u0) x3 +x5)).(and_ind (pc3 c2 u0 u) (\forall (b: B).(\forall (u1: T).(pc3 (CHead c2 +(Bind b) u1) x3 t0))) (ty3 g c2 (THead (Bind Abbr) v2 t4) (THead (Flat Appl) +w (THead (Bind Abst) u t0))) (\lambda (H27: (pc3 c2 u0 u)).(\lambda (H28: +((\forall (b: B).(\forall (u1: T).(pc3 (CHead c2 (Bind b) u1) x3 +t0))))).(ty3_conv g c2 (THead (Flat Appl) w (THead (Bind Abst) u t0)) (THead +(Flat Appl) w (THead (Bind Abst) u x0)) (ty3_appl g c2 w u (H1 c2 H4 w +(pr0_refl w)) (THead (Bind Abst) u t0) x0 (ty3_bind g c2 u x1 H20 Abst t0 x0 +H21 x2 H22)) (THead (Bind Abbr) v2 t4) (THead (Bind Abbr) v2 x3) (ty3_bind g +c2 v2 u (H1 c2 H4 v2 H14) Abbr t4 x3 (csubt_ty3_ld g c2 v2 u0 (ty3_conv g c2 +u0 x4 H24 v2 u (H1 c2 H4 v2 H14) (pc3_s c2 u u0 H27)) t4 x3 H25) x5 +(csubt_ty3_ld g c2 v2 u0 (ty3_conv g c2 u0 x4 H24 v2 u (H1 c2 H4 v2 H14) +(pc3_s c2 u u0 H27)) x3 x5 H26)) (pc3_t (THead (Bind Abbr) v2 t0) c2 (THead +(Bind Abbr) v2 x3) (pc3_head_2 c2 v2 x3 t0 (Bind Abbr) (H28 Abbr v2)) (THead +(Flat Appl) w (THead (Bind Abst) u t0)) (pc3_pr2_x c2 (THead (Bind Abbr) v2 +t0) (THead (Flat Appl) w (THead (Bind Abst) u t0)) (pr2_free c2 (THead (Flat +Appl) w (THead (Bind Abst) u t0)) (THead (Bind Abbr) v2 t0) (pr0_beta u w v2 +H14 t0 t0 (pr0_refl t0)))))))) (pc3_gen_abst c2 u0 u x3 t0 H23))))))))) +(ty3_gen_bind g Abst c2 u0 t4 (THead (Bind Abst) u t0) (H16 c2 H4 (THead +(Bind Abst) u0 t4) (pr0_comp u0 u0 (pr0_refl u0) t3 t4 H15 (Bind +Abst)))))))))))) (ty3_gen_bind g Abst c2 u t0 x H18)))) (ty3_correct g c2 +(THead (Bind Abst) u0 t3) (THead (Bind Abst) u t0) (H16 c2 H4 (THead (Bind +Abst) u0 t3) (pr0_refl (THead (Bind Abst) u0 t3))))))))) t2 H13)) v H12)) v1 +(sym_eq T v1 w H11))) H10)) H9 H6 H7))) | (pr0_upsilon b H6 v1 v2 H7 u1 u2 H8 +t3 t4 H9) \Rightarrow (\lambda (H10: (eq T (THead (Flat Appl) v1 (THead (Bind +b) u1 t3)) (THead (Flat Appl) w v))).(\lambda (H11: (eq T (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t4)) t2)).((let H12 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow (THead (Bind b) u1 t3) | (TLRef _) \Rightarrow (THead (Bind b) u1 +t3) | (THead _ _ t5) \Rightarrow t5])) (THead (Flat Appl) v1 (THead (Bind b) +u1 t3)) (THead (Flat Appl) w v) H10) in ((let H13 \def (f_equal T T (\lambda +(e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) \Rightarrow v1 +| (TLRef _) \Rightarrow v1 | (THead _ t5 _) \Rightarrow t5])) (THead (Flat +Appl) v1 (THead (Bind b) u1 t3)) (THead (Flat Appl) w v) H10) in (eq_ind T w +(\lambda (t5: T).((eq T (THead (Bind b) u1 t3) v) \to ((eq T (THead (Bind b) +u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t2) \to ((not (eq B b Abst)) \to +((pr0 t5 v2) \to ((pr0 u1 u2) \to ((pr0 t3 t4) \to (ty3 g c2 t2 (THead (Flat +Appl) w (THead (Bind Abst) u t0)))))))))) (\lambda (H14: (eq T (THead (Bind +b) u1 t3) v)).(eq_ind T (THead (Bind b) u1 t3) (\lambda (_: T).((eq T (THead +(Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t2) \to ((not (eq B b +Abst)) \to ((pr0 w v2) \to ((pr0 u1 u2) \to ((pr0 t3 t4) \to (ty3 g c2 t2 +(THead (Flat Appl) w (THead (Bind Abst) u t0))))))))) (\lambda (H15: (eq T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) t2)).(eq_ind T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) (\lambda (t5: +T).((not (eq B b Abst)) \to ((pr0 w v2) \to ((pr0 u1 u2) \to ((pr0 t3 t4) \to +(ty3 g c2 t5 (THead (Flat Appl) w (THead (Bind Abst) u t0)))))))) (\lambda +(H16: (not (eq B b Abst))).(\lambda (H17: (pr0 w v2)).(\lambda (H18: (pr0 u1 +u2)).(\lambda (H19: (pr0 t3 t4)).(let H20 \def (eq_ind_r T v (\lambda (t5: +T).(\forall (c3: C).((wcpr0 c c3) \to (\forall (t6: T).((pr0 t5 t6) \to (ty3 +g c3 t6 (THead (Bind Abst) u t0))))))) H3 (THead (Bind b) u1 t3) H14) in (let +H21 \def (eq_ind_r T v (\lambda (t5: T).(ty3 g c t5 (THead (Bind Abst) u +t0))) H2 (THead (Bind b) u1 t3) H14) in (ex_ind T (\lambda (t5: T).(ty3 g c2 +(THead (Bind Abst) u t0) t5)) (ty3 g c2 (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) t4)) (THead (Flat Appl) w (THead (Bind Abst) u t0))) +(\lambda (x: T).(\lambda (H22: (ty3 g c2 (THead (Bind Abst) u t0) x)).(let +H23 \def H22 in (ex4_3_ind T T T (\lambda (t5: T).(\lambda (_: T).(\lambda +(_: T).(pc3 c2 (THead (Bind Abst) u t5) x)))) (\lambda (_: T).(\lambda (t6: +T).(\lambda (_: T).(ty3 g c2 u t6)))) (\lambda (t5: T).(\lambda (_: +T).(\lambda (_: T).(ty3 g (CHead c2 (Bind Abst) u) t0 t5)))) (\lambda (t5: +T).(\lambda (_: T).(\lambda (t7: T).(ty3 g (CHead c2 (Bind Abst) u) t5 t7)))) +(ty3 g c2 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t4)) (THead +(Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (x2: T).(\lambda (_: (pc3 c2 (THead (Bind Abst) u x0) +x)).(\lambda (H25: (ty3 g c2 u x1)).(\lambda (H26: (ty3 g (CHead c2 (Bind +Abst) u) t0 x0)).(\lambda (H27: (ty3 g (CHead c2 (Bind Abst) u) x0 +x2)).(ex4_3_ind T T T (\lambda (t5: T).(\lambda (_: T).(\lambda (_: T).(pc3 +c2 (THead (Bind b) u2 t5) (THead (Bind Abst) u t0))))) (\lambda (_: +T).(\lambda (t6: T).(\lambda (_: T).(ty3 g c2 u2 t6)))) (\lambda (t5: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c2 (Bind b) u2) t4 t5)))) +(\lambda (t5: T).(\lambda (_: T).(\lambda (t7: T).(ty3 g (CHead c2 (Bind b) +u2) t5 t7)))) (ty3 g c2 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) t4)) (THead (Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (x3: +T).(\lambda (x4: T).(\lambda (x5: T).(\lambda (H28: (pc3 c2 (THead (Bind b) +u2 x3) (THead (Bind Abst) u t0))).(\lambda (H29: (ty3 g c2 u2 x4)).(\lambda +(H30: (ty3 g (CHead c2 (Bind b) u2) t4 x3)).(\lambda (_: (ty3 g (CHead c2 +(Bind b) u2) x3 x5)).(let H32 \def (eq_ind T (lift (S O) O (THead (Bind Abst) +u t0)) (\lambda (t5: T).(pc3 (CHead c2 (Bind b) u2) x3 t5)) (pc3_gen_not_abst +b H16 c2 x3 t0 u2 u H28) (THead (Bind Abst) (lift (S O) O u) (lift (S O) (S +O) t0)) (lift_bind Abst u t0 (S O) O)) in (let H33 \def (eq_ind T (lift (S O) +O (THead (Bind Abst) u t0)) (\lambda (t5: T).(ty3 g (CHead c2 (Bind b) u2) t5 +(lift (S O) O x))) (ty3_lift g c2 (THead (Bind Abst) u t0) x H22 (CHead c2 +(Bind b) u2) O (S O) (drop_drop (Bind b) O c2 c2 (drop_refl c2) u2)) (THead +(Bind Abst) (lift (S O) O u) (lift (S O) (S O) t0)) (lift_bind Abst u t0 (S +O) O)) in (ex4_3_ind T T T (\lambda (t5: T).(\lambda (_: T).(\lambda (_: +T).(pc3 (CHead c2 (Bind b) u2) (THead (Bind Abst) (lift (S O) O u) t5) (lift +(S O) O x))))) (\lambda (_: T).(\lambda (t6: T).(\lambda (_: T).(ty3 g (CHead +c2 (Bind b) u2) (lift (S O) O u) t6)))) (\lambda (t5: T).(\lambda (_: +T).(\lambda (_: T).(ty3 g (CHead (CHead c2 (Bind b) u2) (Bind Abst) (lift (S +O) O u)) (lift (S O) (S O) t0) t5)))) (\lambda (t5: T).(\lambda (_: +T).(\lambda (t7: T).(ty3 g (CHead (CHead c2 (Bind b) u2) (Bind Abst) (lift (S +O) O u)) t5 t7)))) (ty3 g c2 (THead (Bind b) u2 (THead (Flat Appl) (lift (S +O) O v2) t4)) (THead (Flat Appl) w (THead (Bind Abst) u t0))) (\lambda (x6: +T).(\lambda (x7: T).(\lambda (x8: T).(\lambda (_: (pc3 (CHead c2 (Bind b) u2) +(THead (Bind Abst) (lift (S O) O u) x6) (lift (S O) O x))).(\lambda (H35: +(ty3 g (CHead c2 (Bind b) u2) (lift (S O) O u) x7)).(\lambda (H36: (ty3 g +(CHead (CHead c2 (Bind b) u2) (Bind Abst) (lift (S O) O u)) (lift (S O) (S O) +t0) x6)).(\lambda (H37: (ty3 g (CHead (CHead c2 (Bind b) u2) (Bind Abst) +(lift (S O) O u)) x6 x8)).(ty3_conv g c2 (THead (Flat Appl) w (THead (Bind +Abst) u t0)) (THead (Flat Appl) w (THead (Bind Abst) u x0)) (ty3_appl g c2 w +u (H1 c2 H4 w (pr0_refl w)) (THead (Bind Abst) u t0) x0 (ty3_bind g c2 u x1 +H25 Abst t0 x0 H26 x2 H27)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) +O v2) t4)) (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) (THead +(Bind Abst) (lift (S O) O u) (lift (S O) (S O) t0)))) (ty3_bind g c2 u2 x4 +H29 b (THead (Flat Appl) (lift (S O) O v2) t4) (THead (Flat Appl) (lift (S O) +O v2) (THead (Bind Abst) (lift (S O) O u) (lift (S O) (S O) t0))) (ty3_appl g +(CHead c2 (Bind b) u2) (lift (S O) O v2) (lift (S O) O u) (ty3_lift g c2 v2 u +(H1 c2 H4 v2 H17) (CHead c2 (Bind b) u2) O (S O) (drop_drop (Bind b) O c2 c2 +(drop_refl c2) u2)) t4 (lift (S O) (S O) t0) (ty3_conv g (CHead c2 (Bind b) +u2) (THead (Bind Abst) (lift (S O) O u) (lift (S O) (S O) t0)) (THead (Bind +Abst) (lift (S O) O u) x6) (ty3_bind g (CHead c2 (Bind b) u2) (lift (S O) O +u) x7 H35 Abst (lift (S O) (S O) t0) x6 H36 x8 H37) t4 x3 H30 H32)) (THead +(Flat Appl) (lift (S O) O v2) (THead (Bind Abst) (lift (S O) O u) x6)) +(ty3_appl g (CHead c2 (Bind b) u2) (lift (S O) O v2) (lift (S O) O u) +(ty3_lift g c2 v2 u (H1 c2 H4 v2 H17) (CHead c2 (Bind b) u2) O (S O) +(drop_drop (Bind b) O c2 c2 (drop_refl c2) u2)) (THead (Bind Abst) (lift (S +O) O u) (lift (S O) (S O) t0)) x6 (ty3_bind g (CHead c2 (Bind b) u2) (lift (S +O) O u) x7 H35 Abst (lift (S O) (S O) t0) x6 H36 x8 H37))) (eq_ind T (lift (S +O) O (THead (Bind Abst) u t0)) (\lambda (t5: T).(pc3 c2 (THead (Bind b) u2 +(THead (Flat Appl) (lift (S O) O v2) t5)) (THead (Flat Appl) w (THead (Bind +Abst) u t0)))) (pc3_pc1 (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O +v2) (lift (S O) O (THead (Bind Abst) u t0)))) (THead (Flat Appl) w (THead +(Bind Abst) u t0)) (pc1_pr0_u2 (THead (Flat Appl) v2 (THead (Bind b) u2 (lift +(S O) O (THead (Bind Abst) u t0)))) (THead (Bind b) u2 (THead (Flat Appl) +(lift (S O) O v2) (lift (S O) O (THead (Bind Abst) u t0)))) (pr0_upsilon b +H16 v2 v2 (pr0_refl v2) u2 u2 (pr0_refl u2) (lift (S O) O (THead (Bind Abst) +u t0)) (lift (S O) O (THead (Bind Abst) u t0)) (pr0_refl (lift (S O) O (THead +(Bind Abst) u t0)))) (THead (Flat Appl) w (THead (Bind Abst) u t0)) (pc1_head +v2 w (pc1_pr0_x v2 w H17) (THead (Bind b) u2 (lift (S O) O (THead (Bind Abst) +u t0))) (THead (Bind Abst) u t0) (pc1_pr0_r (THead (Bind b) u2 (lift (S O) O +(THead (Bind Abst) u t0))) (THead (Bind Abst) u t0) (pr0_zeta b H16 (THead +(Bind Abst) u t0) (THead (Bind Abst) u t0) (pr0_refl (THead (Bind Abst) u +t0)) u2)) (Flat Appl))) c2) (THead (Bind Abst) (lift (S O) O u) (lift (S O) +(S O) t0)) (lift_bind Abst u t0 (S O) O)))))))))) (ty3_gen_bind g Abst (CHead +c2 (Bind b) u2) (lift (S O) O u) (lift (S O) (S O) t0) (lift (S O) O x) +H33))))))))))) (ty3_gen_bind g b c2 u2 t4 (THead (Bind Abst) u t0) (H20 c2 H4 +(THead (Bind b) u2 t4) (pr0_comp u1 u2 H18 t3 t4 H19 (Bind b)))))))))))) +(ty3_gen_bind g Abst c2 u t0 x H23))))) (ty3_correct g c2 (THead (Bind b) u2 +t4) (THead (Bind Abst) u t0) (H20 c2 H4 (THead (Bind b) u2 t4) (pr0_comp u1 +u2 H18 t3 t4 H19 (Bind b))))))))))) t2 H15)) v H14)) v1 (sym_eq T v1 w H13))) +H12)) H11 H6 H7 H8 H9))) | (pr0_delta u1 u2 H6 t3 t4 H7 w0 H8) \Rightarrow +(\lambda (H9: (eq T (THead (Bind Abbr) u1 t3) (THead (Flat Appl) w +v))).(\lambda (H10: (eq T (THead (Bind Abbr) u2 w0) t2)).((let H11 \def +(eq_ind T (THead (Bind Abbr) u1 t3) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow True | (Flat _) \Rightarrow +False])])) I (THead (Flat Appl) w v) H9) in (False_ind ((eq T (THead (Bind +Abbr) u2 w0) t2) \to ((pr0 u1 u2) \to ((pr0 t3 t4) \to ((subst0 O u2 t4 w0) +\to (ty3 g c2 t2 (THead (Flat Appl) w (THead (Bind Abst) u t0))))))) H11)) +H10 H6 H7 H8))) | (pr0_zeta b H6 t3 t4 H7 u0) \Rightarrow (\lambda (H8: (eq T +(THead (Bind b) u0 (lift (S O) O t3)) (THead (Flat Appl) w v))).(\lambda (H9: +(eq T t4 t2)).((let H10 \def (eq_ind T (THead (Bind b) u0 (lift (S O) O t3)) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | +(Flat _) \Rightarrow False])])) I (THead (Flat Appl) w v) H8) in (False_ind +((eq T t4 t2) \to ((not (eq B b Abst)) \to ((pr0 t3 t4) \to (ty3 g c2 t2 +(THead (Flat Appl) w (THead (Bind Abst) u t0)))))) H10)) H9 H6 H7))) | +(pr0_epsilon t3 t4 H6 u0) \Rightarrow (\lambda (H7: (eq T (THead (Flat Cast) +u0 t3) (THead (Flat Appl) w v))).(\lambda (H8: (eq T t4 t2)).((let H9 \def +(eq_ind T (THead (Flat Cast) u0 t3) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat f) \Rightarrow (match f +in F return (\lambda (_: F).Prop) with [Appl \Rightarrow False | Cast +\Rightarrow True])])])) I (THead (Flat Appl) w v) H7) in (False_ind ((eq T t4 +t2) \to ((pr0 t3 t4) \to (ty3 g c2 t2 (THead (Flat Appl) w (THead (Bind Abst) +u t0))))) H9)) H8 H6)))]) in (H6 (refl_equal T (THead (Flat Appl) w v)) +(refl_equal T t2)))))))))))))))) (\lambda (c: C).(\lambda (t2: T).(\lambda +(t3: T).(\lambda (_: (ty3 g c t2 t3)).(\lambda (H1: ((\forall (c2: C).((wcpr0 +c c2) \to (\forall (t4: T).((pr0 t2 t4) \to (ty3 g c2 t4 t3))))))).(\lambda +(t0: T).(\lambda (_: (ty3 g c t3 t0)).(\lambda (H3: ((\forall (c2: C).((wcpr0 +c c2) \to (\forall (t4: T).((pr0 t3 t4) \to (ty3 g c2 t4 t0))))))).(\lambda +(c2: C).(\lambda (H4: (wcpr0 c c2)).(\lambda (t4: T).(\lambda (H5: (pr0 +(THead (Flat Cast) t3 t2) t4)).(let H6 \def (match H5 in pr0 return (\lambda +(t5: T).(\lambda (t6: T).(\lambda (_: (pr0 t5 t6)).((eq T t5 (THead (Flat +Cast) t3 t2)) \to ((eq T t6 t4) \to (ty3 g c2 t4 (THead (Flat Cast) t0 +t3))))))) with [(pr0_refl t5) \Rightarrow (\lambda (H6: (eq T t5 (THead (Flat +Cast) t3 t2))).(\lambda (H7: (eq T t5 t4)).(eq_ind T (THead (Flat Cast) t3 +t2) (\lambda (t6: T).((eq T t6 t4) \to (ty3 g c2 t4 (THead (Flat Cast) t0 +t3)))) (\lambda (H8: (eq T (THead (Flat Cast) t3 t2) t4)).(eq_ind T (THead +(Flat Cast) t3 t2) (\lambda (t6: T).(ty3 g c2 t6 (THead (Flat Cast) t0 t3))) +(ty3_cast g c2 t2 t3 (H1 c2 H4 t2 (pr0_refl t2)) t0 (H3 c2 H4 t3 (pr0_refl +t3))) t4 H8)) t5 (sym_eq T t5 (THead (Flat Cast) t3 t2) H6) H7))) | (pr0_comp +u1 u2 H6 t5 t6 H7 k) \Rightarrow (\lambda (H8: (eq T (THead k u1 t5) (THead +(Flat Cast) t3 t2))).(\lambda (H9: (eq T (THead k u2 t6) t4)).((let H10 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t5 | (TLRef _) \Rightarrow t5 | (THead _ _ t7) +\Rightarrow t7])) (THead k u1 t5) (THead (Flat Cast) t3 t2) H8) in ((let H11 +\def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) +with [(TSort _) \Rightarrow u1 | (TLRef _) \Rightarrow u1 | (THead _ t7 _) +\Rightarrow t7])) (THead k u1 t5) (THead (Flat Cast) t3 t2) H8) in ((let H12 +\def (f_equal T K (\lambda (e: T).(match e in T return (\lambda (_: T).K) +with [(TSort _) \Rightarrow k | (TLRef _) \Rightarrow k | (THead k0 _ _) +\Rightarrow k0])) (THead k u1 t5) (THead (Flat Cast) t3 t2) H8) in (eq_ind K +(Flat Cast) (\lambda (k0: K).((eq T u1 t3) \to ((eq T t5 t2) \to ((eq T +(THead k0 u2 t6) t4) \to ((pr0 u1 u2) \to ((pr0 t5 t6) \to (ty3 g c2 t4 +(THead (Flat Cast) t0 t3)))))))) (\lambda (H13: (eq T u1 t3)).(eq_ind T t3 +(\lambda (t7: T).((eq T t5 t2) \to ((eq T (THead (Flat Cast) u2 t6) t4) \to +((pr0 t7 u2) \to ((pr0 t5 t6) \to (ty3 g c2 t4 (THead (Flat Cast) t0 +t3))))))) (\lambda (H14: (eq T t5 t2)).(eq_ind T t2 (\lambda (t7: T).((eq T +(THead (Flat Cast) u2 t6) t4) \to ((pr0 t3 u2) \to ((pr0 t7 t6) \to (ty3 g c2 +t4 (THead (Flat Cast) t0 t3)))))) (\lambda (H15: (eq T (THead (Flat Cast) u2 +t6) t4)).(eq_ind T (THead (Flat Cast) u2 t6) (\lambda (t7: T).((pr0 t3 u2) +\to ((pr0 t2 t6) \to (ty3 g c2 t7 (THead (Flat Cast) t0 t3))))) (\lambda +(H16: (pr0 t3 u2)).(\lambda (H17: (pr0 t2 t6)).(ex_ind T (\lambda (t7: +T).(ty3 g c2 t0 t7)) (ty3 g c2 (THead (Flat Cast) u2 t6) (THead (Flat Cast) +t0 t3)) (\lambda (x: T).(\lambda (H18: (ty3 g c2 t0 x)).(ty3_conv g c2 (THead +(Flat Cast) t0 t3) (THead (Flat Cast) x t0) (ty3_cast g c2 t3 t0 (H3 c2 H4 t3 +(pr0_refl t3)) x H18) (THead (Flat Cast) u2 t6) (THead (Flat Cast) t0 u2) +(ty3_cast g c2 t6 u2 (ty3_conv g c2 u2 t0 (H3 c2 H4 u2 H16) t6 t3 (H1 c2 H4 +t6 H17) (pc3_pr2_r c2 t3 u2 (pr2_free c2 t3 u2 H16))) t0 (H3 c2 H4 u2 H16)) +(pc3_s c2 (THead (Flat Cast) t0 u2) (THead (Flat Cast) t0 t3) (pc3_pr2_r c2 +(THead (Flat Cast) t0 t3) (THead (Flat Cast) t0 u2) (pr2_thin_dx c2 t3 u2 +(pr2_free c2 t3 u2 H16) t0 Cast)))))) (ty3_correct g c2 t3 t0 (H3 c2 H4 t3 +(pr0_refl t3)))))) t4 H15)) t5 (sym_eq T t5 t2 H14))) u1 (sym_eq T u1 t3 +H13))) k (sym_eq K k (Flat Cast) H12))) H11)) H10)) H9 H6 H7))) | (pr0_beta u +v1 v2 H6 t5 t6 H7) \Rightarrow (\lambda (H8: (eq T (THead (Flat Appl) v1 +(THead (Bind Abst) u t5)) (THead (Flat Cast) t3 t2))).(\lambda (H9: (eq T +(THead (Bind Abbr) v2 t6) t4)).((let H10 \def (eq_ind T (THead (Flat Appl) v1 +(THead (Bind Abst) u t5)) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat f) \Rightarrow (match f in F return +(\lambda (_: F).Prop) with [Appl \Rightarrow True | Cast \Rightarrow +False])])])) I (THead (Flat Cast) t3 t2) H8) in (False_ind ((eq T (THead +(Bind Abbr) v2 t6) t4) \to ((pr0 v1 v2) \to ((pr0 t5 t6) \to (ty3 g c2 t4 +(THead (Flat Cast) t0 t3))))) H10)) H9 H6 H7))) | (pr0_upsilon b H6 v1 v2 H7 +u1 u2 H8 t5 t6 H9) \Rightarrow (\lambda (H10: (eq T (THead (Flat Appl) v1 +(THead (Bind b) u1 t5)) (THead (Flat Cast) t3 t2))).(\lambda (H11: (eq T +(THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) t6)) t4)).((let H12 +\def (eq_ind T (THead (Flat Appl) v1 (THead (Bind b) u1 t5)) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | (Flat f) +\Rightarrow (match f in F return (\lambda (_: F).Prop) with [Appl \Rightarrow +True | Cast \Rightarrow False])])])) I (THead (Flat Cast) t3 t2) H10) in +(False_ind ((eq T (THead (Bind b) u2 (THead (Flat Appl) (lift (S O) O v2) +t6)) t4) \to ((not (eq B b Abst)) \to ((pr0 v1 v2) \to ((pr0 u1 u2) \to ((pr0 +t5 t6) \to (ty3 g c2 t4 (THead (Flat Cast) t0 t3))))))) H12)) H11 H6 H7 H8 +H9))) | (pr0_delta u1 u2 H6 t5 t6 H7 w H8) \Rightarrow (\lambda (H9: (eq T +(THead (Bind Abbr) u1 t5) (THead (Flat Cast) t3 t2))).(\lambda (H10: (eq T +(THead (Bind Abbr) u2 w) t4)).((let H11 \def (eq_ind T (THead (Bind Abbr) u1 +t5) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort +_) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat Cast) t3 +t2) H9) in (False_ind ((eq T (THead (Bind Abbr) u2 w) t4) \to ((pr0 u1 u2) +\to ((pr0 t5 t6) \to ((subst0 O u2 t6 w) \to (ty3 g c2 t4 (THead (Flat Cast) +t0 t3)))))) H11)) H10 H6 H7 H8))) | (pr0_zeta b H6 t5 t6 H7 u) \Rightarrow +(\lambda (H8: (eq T (THead (Bind b) u (lift (S O) O t5)) (THead (Flat Cast) +t3 t2))).(\lambda (H9: (eq T t6 t4)).((let H10 \def (eq_ind T (THead (Bind b) +u (lift (S O) O t5)) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat +Cast) t3 t2) H8) in (False_ind ((eq T t6 t4) \to ((not (eq B b Abst)) \to +((pr0 t5 t6) \to (ty3 g c2 t4 (THead (Flat Cast) t0 t3))))) H10)) H9 H6 H7))) +| (pr0_epsilon t5 t6 H6 u) \Rightarrow (\lambda (H7: (eq T (THead (Flat Cast) +u t5) (THead (Flat Cast) t3 t2))).(\lambda (H8: (eq T t6 t4)).((let H9 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t5 | (TLRef _) \Rightarrow t5 | (THead _ _ t7) +\Rightarrow t7])) (THead (Flat Cast) u t5) (THead (Flat Cast) t3 t2) H7) in +((let H10 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow u | (TLRef _) \Rightarrow u | (THead _ t7 +_) \Rightarrow t7])) (THead (Flat Cast) u t5) (THead (Flat Cast) t3 t2) H7) +in (eq_ind T t3 (\lambda (_: T).((eq T t5 t2) \to ((eq T t6 t4) \to ((pr0 t5 +t6) \to (ty3 g c2 t4 (THead (Flat Cast) t0 t3)))))) (\lambda (H11: (eq T t5 +t2)).(eq_ind T t2 (\lambda (t7: T).((eq T t6 t4) \to ((pr0 t7 t6) \to (ty3 g +c2 t4 (THead (Flat Cast) t0 t3))))) (\lambda (H12: (eq T t6 t4)).(eq_ind T t4 +(\lambda (t7: T).((pr0 t2 t7) \to (ty3 g c2 t4 (THead (Flat Cast) t0 t3)))) +(\lambda (H13: (pr0 t2 t4)).(ex_ind T (\lambda (t7: T).(ty3 g c2 t0 t7)) (ty3 +g c2 t4 (THead (Flat Cast) t0 t3)) (\lambda (x: T).(\lambda (H14: (ty3 g c2 +t0 x)).(ty3_conv g c2 (THead (Flat Cast) t0 t3) (THead (Flat Cast) x t0) +(ty3_cast g c2 t3 t0 (H3 c2 H4 t3 (pr0_refl t3)) x H14) t4 t3 (H1 c2 H4 t4 +H13) (pc3_pr2_x c2 t3 (THead (Flat Cast) t0 t3) (pr2_free c2 (THead (Flat +Cast) t0 t3) t3 (pr0_epsilon t3 t3 (pr0_refl t3) t0)))))) (ty3_correct g c2 +t3 t0 (H3 c2 H4 t3 (pr0_refl t3))))) t6 (sym_eq T t6 t4 H12))) t5 (sym_eq T +t5 t2 H11))) u (sym_eq T u t3 H10))) H9)) H8 H6)))]) in (H6 (refl_equal T +(THead (Flat Cast) t3 t2)) (refl_equal T t4))))))))))))))) c1 t1 t H))))). + +theorem ty3_sred_pr1: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr1 t1 t2) \to (\forall +(g: G).(\forall (t: T).((ty3 g c t1 t) \to (ty3 g c t2 t))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr1 t1 +t2)).(pr1_ind (\lambda (t: T).(\lambda (t0: T).(\forall (g: G).(\forall (t3: +T).((ty3 g c t t3) \to (ty3 g c t0 t3)))))) (\lambda (t: T).(\lambda (g: +G).(\lambda (t0: T).(\lambda (H0: (ty3 g c t t0)).H0)))) (\lambda (t3: +T).(\lambda (t4: T).(\lambda (H0: (pr0 t4 t3)).(\lambda (t5: T).(\lambda (_: +(pr1 t3 t5)).(\lambda (H2: ((\forall (g: G).(\forall (t: T).((ty3 g c t3 t) +\to (ty3 g c t5 t)))))).(\lambda (g: G).(\lambda (t: T).(\lambda (H3: (ty3 g +c t4 t)).(H2 g t (ty3_sred_wcpr0_pr0 g c t4 t H3 c (wcpr0_refl c) t3 +H0))))))))))) t1 t2 H)))). + +theorem ty3_sred_pr2: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr2 c t1 t2) \to (\forall +(g: G).(\forall (t: T).((ty3 g c t1 t) \to (ty3 g c t2 t))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr2 c t1 +t2)).(pr2_ind (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\forall (g: +G).(\forall (t3: T).((ty3 g c0 t t3) \to (ty3 g c0 t0 t3))))))) (\lambda (c0: +C).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H0: (pr0 t3 t4)).(\lambda (g: +G).(\lambda (t: T).(\lambda (H1: (ty3 g c0 t3 t)).(ty3_sred_wcpr0_pr0 g c0 t3 +t H1 c0 (wcpr0_refl c0) t4 H0)))))))) (\lambda (c0: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (i: nat).(\lambda (H0: (getl i c0 (CHead d (Bind +Abbr) u))).(\lambda (t3: T).(\lambda (t4: T).(\lambda (H1: (pr0 t3 +t4)).(\lambda (t: T).(\lambda (H2: (subst0 i u t4 t)).(\lambda (g: +G).(\lambda (t0: T).(\lambda (H3: (ty3 g c0 t3 t0)).(ty3_subst0 g c0 t4 t0 +(ty3_sred_wcpr0_pr0 g c0 t3 t0 H3 c0 (wcpr0_refl c0) t4 H1) d u i H0 t +H2)))))))))))))) c t1 t2 H)))). + +theorem ty3_sred_pr3: + \forall (c: C).(\forall (t1: T).(\forall (t2: T).((pr3 c t1 t2) \to (\forall +(g: G).(\forall (t: T).((ty3 g c t1 t) \to (ty3 g c t2 t))))))) +\def + \lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H: (pr3 c t1 +t2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (g: G).(\forall +(t3: T).((ty3 g c t t3) \to (ty3 g c t0 t3)))))) (\lambda (t: T).(\lambda (g: +G).(\lambda (t0: T).(\lambda (H0: (ty3 g c t t0)).H0)))) (\lambda (t3: +T).(\lambda (t4: T).(\lambda (H0: (pr2 c t4 t3)).(\lambda (t5: T).(\lambda +(_: (pr3 c t3 t5)).(\lambda (H2: ((\forall (g: G).(\forall (t: T).((ty3 g c +t3 t) \to (ty3 g c t5 t)))))).(\lambda (g: G).(\lambda (t: T).(\lambda (H3: +(ty3 g c t4 t)).(H2 g t (ty3_sred_pr2 c t4 t3 H0 g t H3))))))))))) t1 t2 +H)))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3_props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3_props.ma new file mode 100644 index 000000000..4693788ce --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3_props.ma @@ -0,0 +1,506 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3_props". + +include "ty3/pr3.ma". + +theorem ty3_cred_pr2: + \forall (g: G).(\forall (c: C).(\forall (v1: T).(\forall (v2: T).((pr2 c v1 +v2) \to (\forall (b: B).(\forall (t1: T).(\forall (t2: T).((ty3 g (CHead c +(Bind b) v1) t1 t2) \to (ty3 g (CHead c (Bind b) v2) t1 t2))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (v1: T).(\lambda (v2: T).(\lambda +(H: (pr2 c v1 v2)).(pr2_ind (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: +T).(\forall (b: B).(\forall (t1: T).(\forall (t2: T).((ty3 g (CHead c0 (Bind +b) t) t1 t2) \to (ty3 g (CHead c0 (Bind b) t0) t1 t2)))))))) (\lambda (c0: +C).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (pr0 t1 t2)).(\lambda (b: +B).(\lambda (t0: T).(\lambda (t3: T).(\lambda (H1: (ty3 g (CHead c0 (Bind b) +t1) t0 t3)).(ty3_sred_wcpr0_pr0 g (CHead c0 (Bind b) t1) t0 t3 H1 (CHead c0 +(Bind b) t2) (wcpr0_comp c0 c0 (wcpr0_refl c0) t1 t2 H0 (Bind b)) t0 +(pr0_refl t0)))))))))) (\lambda (c0: C).(\lambda (d: C).(\lambda (u: +T).(\lambda (i: nat).(\lambda (H0: (getl i c0 (CHead d (Bind Abbr) +u))).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H1: (pr0 t1 t2)).(\lambda +(t: T).(\lambda (H2: (subst0 i u t2 t)).(\lambda (b: B).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (H3: (ty3 g (CHead c0 (Bind b) t1) t0 +t3)).(ty3_csubst0 g (CHead c0 (Bind b) t2) t0 t3 (ty3_sred_wcpr0_pr0 g (CHead +c0 (Bind b) t1) t0 t3 H3 (CHead c0 (Bind b) t2) (wcpr0_comp c0 c0 (wcpr0_refl +c0) t1 t2 H1 (Bind b)) t0 (pr0_refl t0)) d u (S i) (getl_clear_bind b (CHead +c0 (Bind b) t2) c0 t2 (clear_bind b c0 t2) (CHead d (Bind Abbr) u) i H0) +(CHead c0 (Bind b) t) (csubst0_snd_bind b i u t2 t H2 c0)))))))))))))))) c v1 +v2 H))))). + +theorem ty3_cred_pr3: + \forall (g: G).(\forall (c: C).(\forall (v1: T).(\forall (v2: T).((pr3 c v1 +v2) \to (\forall (b: B).(\forall (t1: T).(\forall (t2: T).((ty3 g (CHead c +(Bind b) v1) t1 t2) \to (ty3 g (CHead c (Bind b) v2) t1 t2))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (v1: T).(\lambda (v2: T).(\lambda +(H: (pr3 c v1 v2)).(pr3_ind c (\lambda (t: T).(\lambda (t0: T).(\forall (b: +B).(\forall (t1: T).(\forall (t2: T).((ty3 g (CHead c (Bind b) t) t1 t2) \to +(ty3 g (CHead c (Bind b) t0) t1 t2))))))) (\lambda (t: T).(\lambda (b: +B).(\lambda (t1: T).(\lambda (t2: T).(\lambda (H0: (ty3 g (CHead c (Bind b) +t) t1 t2)).H0))))) (\lambda (t2: T).(\lambda (t1: T).(\lambda (H0: (pr2 c t1 +t2)).(\lambda (t3: T).(\lambda (_: (pr3 c t2 t3)).(\lambda (H2: ((\forall (b: +B).(\forall (t4: T).(\forall (t5: T).((ty3 g (CHead c (Bind b) t2) t4 t5) \to +(ty3 g (CHead c (Bind b) t3) t4 t5))))))).(\lambda (b: B).(\lambda (t0: +T).(\lambda (t4: T).(\lambda (H3: (ty3 g (CHead c (Bind b) t1) t0 t4)).(H2 b +t0 t4 (ty3_cred_pr2 g c t1 t2 H0 b t0 t4 H3)))))))))))) v1 v2 H))))). + +theorem ty3_gen_lift: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (x: T).(\forall (h: +nat).(\forall (d: nat).((ty3 g c (lift h d t1) x) \to (\forall (e: C).((drop +h d c e) \to (ex2 T (\lambda (t2: T).(pc3 c (lift h d t2) x)) (\lambda (t2: +T).(ty3 g e t1 t2))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (x: T).(\lambda (h: +nat).(\lambda (d: nat).(\lambda (H: (ty3 g c (lift h d t1) x)).(insert_eq T +(lift h d t1) (\lambda (t: T).(ty3 g c t x)) (\forall (e: C).((drop h d c e) +\to (ex2 T (\lambda (t2: T).(pc3 c (lift h d t2) x)) (\lambda (t2: T).(ty3 g +e t1 t2))))) (\lambda (y: T).(\lambda (H0: (ty3 g c y x)).(unintro nat d +(\lambda (n: nat).((eq T y (lift h n t1)) \to (\forall (e: C).((drop h n c e) +\to (ex2 T (\lambda (t2: T).(pc3 c (lift h n t2) x)) (\lambda (t2: T).(ty3 g +e t1 t2))))))) (unintro T t1 (\lambda (t: T).(\forall (x0: nat).((eq T y +(lift h x0 t)) \to (\forall (e: C).((drop h x0 c e) \to (ex2 T (\lambda (t2: +T).(pc3 c (lift h x0 t2) x)) (\lambda (t2: T).(ty3 g e t t2)))))))) (ty3_ind +g (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: T).(\forall (x0: T).(\forall +(x1: nat).((eq T t (lift h x1 x0)) \to (\forall (e: C).((drop h x1 c0 e) \to +(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) t0)) (\lambda (t2: T).(ty3 g e +x0 t2))))))))))) (\lambda (c0: C).(\lambda (t2: T).(\lambda (t: T).(\lambda +(_: (ty3 g c0 t2 t)).(\lambda (_: ((\forall (x0: T).(\forall (x1: nat).((eq T +t2 (lift h x1 x0)) \to (\forall (e: C).((drop h x1 c0 e) \to (ex2 T (\lambda +(t3: T).(pc3 c0 (lift h x1 t3) t)) (\lambda (t3: T).(ty3 g e x0 +t3)))))))))).(\lambda (u: T).(\lambda (t3: T).(\lambda (H3: (ty3 g c0 u +t3)).(\lambda (H4: ((\forall (x0: T).(\forall (x1: nat).((eq T u (lift h x1 +x0)) \to (\forall (e: C).((drop h x1 c0 e) \to (ex2 T (\lambda (t4: T).(pc3 +c0 (lift h x1 t4) t3)) (\lambda (t4: T).(ty3 g e x0 t4)))))))))).(\lambda +(H5: (pc3 c0 t3 t2)).(\lambda (x0: T).(\lambda (x1: nat).(\lambda (H6: (eq T +u (lift h x1 x0))).(\lambda (e: C).(\lambda (H7: (drop h x1 c0 e)).(let H8 +\def (eq_ind T u (\lambda (t0: T).(\forall (x2: T).(\forall (x3: nat).((eq T +t0 (lift h x3 x2)) \to (\forall (e0: C).((drop h x3 c0 e0) \to (ex2 T +(\lambda (t4: T).(pc3 c0 (lift h x3 t4) t3)) (\lambda (t4: T).(ty3 g e0 x2 +t4))))))))) H4 (lift h x1 x0) H6) in (let H9 \def (eq_ind T u (\lambda (t0: +T).(ty3 g c0 t0 t3)) H3 (lift h x1 x0) H6) in (let H10 \def (H8 x0 x1 +(refl_equal T (lift h x1 x0)) e H7) in (ex2_ind T (\lambda (t4: T).(pc3 c0 +(lift h x1 t4) t3)) (\lambda (t4: T).(ty3 g e x0 t4)) (ex2 T (\lambda (t4: +T).(pc3 c0 (lift h x1 t4) t2)) (\lambda (t4: T).(ty3 g e x0 t4))) (\lambda +(x2: T).(\lambda (H11: (pc3 c0 (lift h x1 x2) t3)).(\lambda (H12: (ty3 g e x0 +x2)).(ex_intro2 T (\lambda (t4: T).(pc3 c0 (lift h x1 t4) t2)) (\lambda (t4: +T).(ty3 g e x0 t4)) x2 (pc3_t t3 c0 (lift h x1 x2) H11 t2 H5) H12)))) +H10))))))))))))))))))) (\lambda (c0: C).(\lambda (m: nat).(\lambda (x0: +T).(\lambda (x1: nat).(\lambda (H1: (eq T (TSort m) (lift h x1 x0))).(\lambda +(e: C).(\lambda (_: (drop h x1 c0 e)).(eq_ind_r T (TSort m) (\lambda (t: +T).(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (TSort (next g m)))) +(\lambda (t2: T).(ty3 g e t t2)))) (ex_intro2 T (\lambda (t2: T).(pc3 c0 +(lift h x1 t2) (TSort (next g m)))) (\lambda (t2: T).(ty3 g e (TSort m) t2)) +(TSort (next g m)) (eq_ind_r T (TSort (next g m)) (\lambda (t: T).(pc3 c0 t +(TSort (next g m)))) (pc3_refl c0 (TSort (next g m))) (lift h x1 (TSort (next +g m))) (lift_sort (next g m) h x1)) (ty3_sort g e m)) x0 (lift_gen_sort h x1 +m x0 H1))))))))) (\lambda (n: nat).(\lambda (c0: C).(\lambda (d0: C).(\lambda +(u: T).(\lambda (H1: (getl n c0 (CHead d0 (Bind Abbr) u))).(\lambda (t: +T).(\lambda (H2: (ty3 g d0 u t)).(\lambda (H3: ((\forall (x0: T).(\forall +(x1: nat).((eq T u (lift h x1 x0)) \to (\forall (e: C).((drop h x1 d0 e) \to +(ex2 T (\lambda (t2: T).(pc3 d0 (lift h x1 t2) t)) (\lambda (t2: T).(ty3 g e +x0 t2)))))))))).(\lambda (x0: T).(\lambda (x1: nat).(\lambda (H4: (eq T +(TLRef n) (lift h x1 x0))).(\lambda (e: C).(\lambda (H5: (drop h x1 c0 +e)).(let H_x \def (lift_gen_lref x0 x1 h n H4) in (let H6 \def H_x in (or_ind +(land (lt n x1) (eq T x0 (TLRef n))) (land (le (plus x1 h) n) (eq T x0 (TLRef +(minus n h)))) (ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (lift (S n) O +t))) (\lambda (t2: T).(ty3 g e x0 t2))) (\lambda (H7: (land (lt n x1) (eq T +x0 (TLRef n)))).(and_ind (lt n x1) (eq T x0 (TLRef n)) (ex2 T (\lambda (t2: +T).(pc3 c0 (lift h x1 t2) (lift (S n) O t))) (\lambda (t2: T).(ty3 g e x0 +t2))) (\lambda (H8: (lt n x1)).(\lambda (H9: (eq T x0 (TLRef n))).(eq_ind_r T +(TLRef n) (\lambda (t0: T).(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) +(lift (S n) O t))) (\lambda (t2: T).(ty3 g e t0 t2)))) (let H10 \def (eq_ind +nat x1 (\lambda (n0: nat).(drop h n0 c0 e)) H5 (S (plus n (minus x1 (S n)))) +(lt_plus_minus n x1 H8)) in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift h (minus x1 (S n)) v)))) (\lambda (v: T).(\lambda (e0: +C).(getl n e (CHead e0 (Bind Abbr) v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (minus x1 (S n)) d0 e0))) (ex2 T (\lambda (t2: T).(pc3 c0 (lift h +x1 t2) (lift (S n) O t))) (\lambda (t2: T).(ty3 g e (TLRef n) t2))) (\lambda +(x2: T).(\lambda (x3: C).(\lambda (H11: (eq T u (lift h (minus x1 (S n)) +x2))).(\lambda (H12: (getl n e (CHead x3 (Bind Abbr) x2))).(\lambda (H13: +(drop h (minus x1 (S n)) d0 x3)).(let H14 \def (eq_ind T u (\lambda (t0: +T).(\forall (x4: T).(\forall (x5: nat).((eq T t0 (lift h x5 x4)) \to (\forall +(e0: C).((drop h x5 d0 e0) \to (ex2 T (\lambda (t2: T).(pc3 d0 (lift h x5 t2) +t)) (\lambda (t2: T).(ty3 g e0 x4 t2))))))))) H3 (lift h (minus x1 (S n)) x2) +H11) in (let H15 \def (eq_ind T u (\lambda (t0: T).(ty3 g d0 t0 t)) H2 (lift +h (minus x1 (S n)) x2) H11) in (let H16 \def (H14 x2 (minus x1 (S n)) +(refl_equal T (lift h (minus x1 (S n)) x2)) x3 H13) in (ex2_ind T (\lambda +(t2: T).(pc3 d0 (lift h (minus x1 (S n)) t2) t)) (\lambda (t2: T).(ty3 g x3 +x2 t2)) (ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (lift (S n) O t))) +(\lambda (t2: T).(ty3 g e (TLRef n) t2))) (\lambda (x4: T).(\lambda (H17: +(pc3 d0 (lift h (minus x1 (S n)) x4) t)).(\lambda (H18: (ty3 g x3 x2 +x4)).(eq_ind_r nat (plus (S n) (minus x1 (S n))) (\lambda (n0: nat).(ex2 T +(\lambda (t2: T).(pc3 c0 (lift h n0 t2) (lift (S n) O t))) (\lambda (t2: +T).(ty3 g e (TLRef n) t2)))) (ex_intro2 T (\lambda (t2: T).(pc3 c0 (lift h +(plus (S n) (minus x1 (S n))) t2) (lift (S n) O t))) (\lambda (t2: T).(ty3 g +e (TLRef n) t2)) (lift (S n) O x4) (eq_ind_r T (lift (S n) O (lift h (minus +x1 (S n)) x4)) (\lambda (t0: T).(pc3 c0 t0 (lift (S n) O t))) (pc3_lift c0 d0 +(S n) O (getl_drop Abbr c0 d0 u n H1) (lift h (minus x1 (S n)) x4) t H17) +(lift h (plus (S n) (minus x1 (S n))) (lift (S n) O x4)) (lift_d x4 h (S n) +(minus x1 (S n)) O (le_O_n (minus x1 (S n))))) (ty3_abbr g n e x3 x2 H12 x4 +H18)) x1 (le_plus_minus (S n) x1 H8))))) H16))))))))) (getl_drop_conf_lt Abbr +c0 d0 u n H1 e h (minus x1 (S n)) H10))) x0 H9))) H7)) (\lambda (H7: (land +(le (plus x1 h) n) (eq T x0 (TLRef (minus n h))))).(and_ind (le (plus x1 h) +n) (eq T x0 (TLRef (minus n h))) (ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 +t2) (lift (S n) O t))) (\lambda (t2: T).(ty3 g e x0 t2))) (\lambda (H8: (le +(plus x1 h) n)).(\lambda (H9: (eq T x0 (TLRef (minus n h)))).(eq_ind_r T +(TLRef (minus n h)) (\lambda (t0: T).(ex2 T (\lambda (t2: T).(pc3 c0 (lift h +x1 t2) (lift (S n) O t))) (\lambda (t2: T).(ty3 g e t0 t2)))) (ex_intro2 T +(\lambda (t2: T).(pc3 c0 (lift h x1 t2) (lift (S n) O t))) (\lambda (t2: +T).(ty3 g e (TLRef (minus n h)) t2)) (lift (S (minus n h)) O t) (eq_ind_r T +(lift (plus h (S (minus n h))) O t) (\lambda (t0: T).(pc3 c0 t0 (lift (S n) O +t))) (eq_ind nat (S (plus h (minus n h))) (\lambda (n0: nat).(pc3 c0 (lift n0 +O t) (lift (S n) O t))) (eq_ind nat n (\lambda (n0: nat).(pc3 c0 (lift (S n0) +O t) (lift (S n) O t))) (pc3_refl c0 (lift (S n) O t)) (plus h (minus n h)) +(le_plus_minus h n (le_trans h (plus x1 h) n (le_plus_r x1 h) H8))) (plus h +(S (minus n h))) (plus_n_Sm h (minus n h))) (lift h x1 (lift (S (minus n h)) +O t)) (lift_free t (S (minus n h)) h O x1 (le_trans x1 (S (minus n h)) (plus +O (S (minus n h))) (le_S_minus x1 h n H8) (le_n (plus O (S (minus n h))))) +(le_O_n x1))) (ty3_abbr g (minus n h) e d0 u (getl_drop_conf_ge n (CHead d0 +(Bind Abbr) u) c0 H1 e h x1 H5 H8) t H2)) x0 H9))) H7)) H6)))))))))))))))) +(\lambda (n: nat).(\lambda (c0: C).(\lambda (d0: C).(\lambda (u: T).(\lambda +(H1: (getl n c0 (CHead d0 (Bind Abst) u))).(\lambda (t: T).(\lambda (H2: (ty3 +g d0 u t)).(\lambda (H3: ((\forall (x0: T).(\forall (x1: nat).((eq T u (lift +h x1 x0)) \to (\forall (e: C).((drop h x1 d0 e) \to (ex2 T (\lambda (t2: +T).(pc3 d0 (lift h x1 t2) t)) (\lambda (t2: T).(ty3 g e x0 +t2)))))))))).(\lambda (x0: T).(\lambda (x1: nat).(\lambda (H4: (eq T (TLRef +n) (lift h x1 x0))).(\lambda (e: C).(\lambda (H5: (drop h x1 c0 e)).(let H_x +\def (lift_gen_lref x0 x1 h n H4) in (let H6 \def H_x in (or_ind (land (lt n +x1) (eq T x0 (TLRef n))) (land (le (plus x1 h) n) (eq T x0 (TLRef (minus n +h)))) (ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (lift (S n) O u))) +(\lambda (t2: T).(ty3 g e x0 t2))) (\lambda (H7: (land (lt n x1) (eq T x0 +(TLRef n)))).(and_ind (lt n x1) (eq T x0 (TLRef n)) (ex2 T (\lambda (t2: +T).(pc3 c0 (lift h x1 t2) (lift (S n) O u))) (\lambda (t2: T).(ty3 g e x0 +t2))) (\lambda (H8: (lt n x1)).(\lambda (H9: (eq T x0 (TLRef n))).(eq_ind_r T +(TLRef n) (\lambda (t0: T).(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) +(lift (S n) O u))) (\lambda (t2: T).(ty3 g e t0 t2)))) (let H10 \def (eq_ind +nat x1 (\lambda (n0: nat).(drop h n0 c0 e)) H5 (S (plus n (minus x1 (S n)))) +(lt_plus_minus n x1 H8)) in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift h (minus x1 (S n)) v)))) (\lambda (v: T).(\lambda (e0: +C).(getl n e (CHead e0 (Bind Abst) v)))) (\lambda (_: T).(\lambda (e0: +C).(drop h (minus x1 (S n)) d0 e0))) (ex2 T (\lambda (t2: T).(pc3 c0 (lift h +x1 t2) (lift (S n) O u))) (\lambda (t2: T).(ty3 g e (TLRef n) t2))) (\lambda +(x2: T).(\lambda (x3: C).(\lambda (H11: (eq T u (lift h (minus x1 (S n)) +x2))).(\lambda (H12: (getl n e (CHead x3 (Bind Abst) x2))).(\lambda (H13: +(drop h (minus x1 (S n)) d0 x3)).(let H14 \def (eq_ind T u (\lambda (t0: +T).(\forall (x4: T).(\forall (x5: nat).((eq T t0 (lift h x5 x4)) \to (\forall +(e0: C).((drop h x5 d0 e0) \to (ex2 T (\lambda (t2: T).(pc3 d0 (lift h x5 t2) +t)) (\lambda (t2: T).(ty3 g e0 x4 t2))))))))) H3 (lift h (minus x1 (S n)) x2) +H11) in (let H15 \def (eq_ind T u (\lambda (t0: T).(ty3 g d0 t0 t)) H2 (lift +h (minus x1 (S n)) x2) H11) in (eq_ind_r T (lift h (minus x1 (S n)) x2) +(\lambda (t0: T).(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (lift (S n) O +t0))) (\lambda (t2: T).(ty3 g e (TLRef n) t2)))) (let H16 \def (H14 x2 (minus +x1 (S n)) (refl_equal T (lift h (minus x1 (S n)) x2)) x3 H13) in (ex2_ind T +(\lambda (t2: T).(pc3 d0 (lift h (minus x1 (S n)) t2) t)) (\lambda (t2: +T).(ty3 g x3 x2 t2)) (ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (lift (S +n) O (lift h (minus x1 (S n)) x2)))) (\lambda (t2: T).(ty3 g e (TLRef n) +t2))) (\lambda (x4: T).(\lambda (_: (pc3 d0 (lift h (minus x1 (S n)) x4) +t)).(\lambda (H18: (ty3 g x3 x2 x4)).(eq_ind_r nat (plus (S n) (minus x1 (S +n))) (\lambda (n0: nat).(ex2 T (\lambda (t2: T).(pc3 c0 (lift h n0 t2) (lift +(S n) O (lift h (minus n0 (S n)) x2)))) (\lambda (t2: T).(ty3 g e (TLRef n) +t2)))) (ex_intro2 T (\lambda (t2: T).(pc3 c0 (lift h (plus (S n) (minus x1 (S +n))) t2) (lift (S n) O (lift h (minus (plus (S n) (minus x1 (S n))) (S n)) +x2)))) (\lambda (t2: T).(ty3 g e (TLRef n) t2)) (lift (S n) O x2) (eq_ind_r T +(lift (S n) O (lift h (minus x1 (S n)) x2)) (\lambda (t0: T).(pc3 c0 t0 (lift +(S n) O (lift h (minus (plus (S n) (minus x1 (S n))) (S n)) x2)))) (eq_ind +nat x1 (\lambda (n0: nat).(pc3 c0 (lift (S n) O (lift h (minus x1 (S n)) x2)) +(lift (S n) O (lift h (minus n0 (S n)) x2)))) (pc3_refl c0 (lift (S n) O +(lift h (minus x1 (S n)) x2))) (plus (S n) (minus x1 (S n))) (le_plus_minus +(S n) x1 H8)) (lift h (plus (S n) (minus x1 (S n))) (lift (S n) O x2)) +(lift_d x2 h (S n) (minus x1 (S n)) O (le_O_n (minus x1 (S n))))) (ty3_abst g +n e x3 x2 H12 x4 H18)) x1 (le_plus_minus (S n) x1 H8))))) H16)) u H11)))))))) +(getl_drop_conf_lt Abst c0 d0 u n H1 e h (minus x1 (S n)) H10))) x0 H9))) +H7)) (\lambda (H7: (land (le (plus x1 h) n) (eq T x0 (TLRef (minus n +h))))).(and_ind (le (plus x1 h) n) (eq T x0 (TLRef (minus n h))) (ex2 T +(\lambda (t2: T).(pc3 c0 (lift h x1 t2) (lift (S n) O u))) (\lambda (t2: +T).(ty3 g e x0 t2))) (\lambda (H8: (le (plus x1 h) n)).(\lambda (H9: (eq T x0 +(TLRef (minus n h)))).(eq_ind_r T (TLRef (minus n h)) (\lambda (t0: T).(ex2 T +(\lambda (t2: T).(pc3 c0 (lift h x1 t2) (lift (S n) O u))) (\lambda (t2: +T).(ty3 g e t0 t2)))) (ex_intro2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) +(lift (S n) O u))) (\lambda (t2: T).(ty3 g e (TLRef (minus n h)) t2)) (lift +(S (minus n h)) O u) (eq_ind_r T (lift (plus h (S (minus n h))) O u) (\lambda +(t0: T).(pc3 c0 t0 (lift (S n) O u))) (eq_ind nat (S (plus h (minus n h))) +(\lambda (n0: nat).(pc3 c0 (lift n0 O u) (lift (S n) O u))) (eq_ind nat n +(\lambda (n0: nat).(pc3 c0 (lift (S n0) O u) (lift (S n) O u))) (pc3_refl c0 +(lift (S n) O u)) (plus h (minus n h)) (le_plus_minus h n (le_trans h (plus +x1 h) n (le_plus_r x1 h) H8))) (plus h (S (minus n h))) (plus_n_Sm h (minus n +h))) (lift h x1 (lift (S (minus n h)) O u)) (lift_free u (S (minus n h)) h O +x1 (le_trans x1 (S (minus n h)) (plus O (S (minus n h))) (le_S_minus x1 h n +H8) (le_n (plus O (S (minus n h))))) (le_O_n x1))) (ty3_abst g (minus n h) e +d0 u (getl_drop_conf_ge n (CHead d0 (Bind Abst) u) c0 H1 e h x1 H5 H8) t H2)) +x0 H9))) H7)) H6)))))))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda +(t: T).(\lambda (H1: (ty3 g c0 u t)).(\lambda (H2: ((\forall (x0: T).(\forall +(x1: nat).((eq T u (lift h x1 x0)) \to (\forall (e: C).((drop h x1 c0 e) \to +(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) t)) (\lambda (t2: T).(ty3 g e +x0 t2)))))))))).(\lambda (b: B).(\lambda (t2: T).(\lambda (t3: T).(\lambda +(H3: (ty3 g (CHead c0 (Bind b) u) t2 t3)).(\lambda (H4: ((\forall (x0: +T).(\forall (x1: nat).((eq T t2 (lift h x1 x0)) \to (\forall (e: C).((drop h +x1 (CHead c0 (Bind b) u) e) \to (ex2 T (\lambda (t4: T).(pc3 (CHead c0 (Bind +b) u) (lift h x1 t4) t3)) (\lambda (t4: T).(ty3 g e x0 t4)))))))))).(\lambda +(t0: T).(\lambda (H5: (ty3 g (CHead c0 (Bind b) u) t3 t0)).(\lambda (H6: +((\forall (x0: T).(\forall (x1: nat).((eq T t3 (lift h x1 x0)) \to (\forall +(e: C).((drop h x1 (CHead c0 (Bind b) u) e) \to (ex2 T (\lambda (t4: T).(pc3 +(CHead c0 (Bind b) u) (lift h x1 t4) t0)) (\lambda (t4: T).(ty3 g e x0 +t4)))))))))).(\lambda (x0: T).(\lambda (x1: nat).(\lambda (H7: (eq T (THead +(Bind b) u t2) (lift h x1 x0))).(\lambda (e: C).(\lambda (H8: (drop h x1 c0 +e)).(ex3_2_ind T T (\lambda (y0: T).(\lambda (z: T).(eq T x0 (THead (Bind b) +y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T u (lift h x1 y0)))) (\lambda +(_: T).(\lambda (z: T).(eq T t2 (lift h (S x1) z)))) (ex2 T (\lambda (t4: +T).(pc3 c0 (lift h x1 t4) (THead (Bind b) u t3))) (\lambda (t4: T).(ty3 g e +x0 t4))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H9: (eq T x0 (THead +(Bind b) x2 x3))).(\lambda (H10: (eq T u (lift h x1 x2))).(\lambda (H11: (eq +T t2 (lift h (S x1) x3))).(eq_ind_r T (THead (Bind b) x2 x3) (\lambda (t4: +T).(ex2 T (\lambda (t5: T).(pc3 c0 (lift h x1 t5) (THead (Bind b) u t3))) +(\lambda (t5: T).(ty3 g e t4 t5)))) (let H12 \def (eq_ind T t2 (\lambda (t4: +T).(\forall (x4: T).(\forall (x5: nat).((eq T t4 (lift h x5 x4)) \to (\forall +(e0: C).((drop h x5 (CHead c0 (Bind b) u) e0) \to (ex2 T (\lambda (t5: +T).(pc3 (CHead c0 (Bind b) u) (lift h x5 t5) t3)) (\lambda (t5: T).(ty3 g e0 +x4 t5))))))))) H4 (lift h (S x1) x3) H11) in (let H13 \def (eq_ind T t2 +(\lambda (t4: T).(ty3 g (CHead c0 (Bind b) u) t4 t3)) H3 (lift h (S x1) x3) +H11) in (let H14 \def (eq_ind T u (\lambda (t4: T).(ty3 g (CHead c0 (Bind b) +t4) (lift h (S x1) x3) t3)) H13 (lift h x1 x2) H10) in (let H15 \def (eq_ind +T u (\lambda (t4: T).(\forall (x4: T).(\forall (x5: nat).((eq T (lift h (S +x1) x3) (lift h x5 x4)) \to (\forall (e0: C).((drop h x5 (CHead c0 (Bind b) +t4) e0) \to (ex2 T (\lambda (t5: T).(pc3 (CHead c0 (Bind b) t4) (lift h x5 +t5) t3)) (\lambda (t5: T).(ty3 g e0 x4 t5))))))))) H12 (lift h x1 x2) H10) in +(let H16 \def (eq_ind T u (\lambda (t4: T).(\forall (x4: T).(\forall (x5: +nat).((eq T t3 (lift h x5 x4)) \to (\forall (e0: C).((drop h x5 (CHead c0 +(Bind b) t4) e0) \to (ex2 T (\lambda (t5: T).(pc3 (CHead c0 (Bind b) t4) +(lift h x5 t5) t0)) (\lambda (t5: T).(ty3 g e0 x4 t5))))))))) H6 (lift h x1 +x2) H10) in (let H17 \def (eq_ind T u (\lambda (t4: T).(ty3 g (CHead c0 (Bind +b) t4) t3 t0)) H5 (lift h x1 x2) H10) in (let H18 \def (eq_ind T u (\lambda +(t4: T).(\forall (x4: T).(\forall (x5: nat).((eq T t4 (lift h x5 x4)) \to +(\forall (e0: C).((drop h x5 c0 e0) \to (ex2 T (\lambda (t5: T).(pc3 c0 (lift +h x5 t5) t)) (\lambda (t5: T).(ty3 g e0 x4 t5))))))))) H2 (lift h x1 x2) H10) +in (let H19 \def (eq_ind T u (\lambda (t4: T).(ty3 g c0 t4 t)) H1 (lift h x1 +x2) H10) in (eq_ind_r T (lift h x1 x2) (\lambda (t4: T).(ex2 T (\lambda (t5: +T).(pc3 c0 (lift h x1 t5) (THead (Bind b) t4 t3))) (\lambda (t5: T).(ty3 g e +(THead (Bind b) x2 x3) t5)))) (let H20 \def (H18 x2 x1 (refl_equal T (lift h +x1 x2)) e H8) in (ex2_ind T (\lambda (t4: T).(pc3 c0 (lift h x1 t4) t)) +(\lambda (t4: T).(ty3 g e x2 t4)) (ex2 T (\lambda (t4: T).(pc3 c0 (lift h x1 +t4) (THead (Bind b) (lift h x1 x2) t3))) (\lambda (t4: T).(ty3 g e (THead +(Bind b) x2 x3) t4))) (\lambda (x4: T).(\lambda (_: (pc3 c0 (lift h x1 x4) +t)).(\lambda (H22: (ty3 g e x2 x4)).(let H23 \def (H15 x3 (S x1) (refl_equal +T (lift h (S x1) x3)) (CHead e (Bind b) x2) (drop_skip_bind h x1 c0 e H8 b +x2)) in (ex2_ind T (\lambda (t4: T).(pc3 (CHead c0 (Bind b) (lift h x1 x2)) +(lift h (S x1) t4) t3)) (\lambda (t4: T).(ty3 g (CHead e (Bind b) x2) x3 t4)) +(ex2 T (\lambda (t4: T).(pc3 c0 (lift h x1 t4) (THead (Bind b) (lift h x1 x2) +t3))) (\lambda (t4: T).(ty3 g e (THead (Bind b) x2 x3) t4))) (\lambda (x5: +T).(\lambda (H24: (pc3 (CHead c0 (Bind b) (lift h x1 x2)) (lift h (S x1) x5) +t3)).(\lambda (H25: (ty3 g (CHead e (Bind b) x2) x3 x5)).(ex_ind T (\lambda +(t4: T).(ty3 g (CHead e (Bind b) x2) x5 t4)) (ex2 T (\lambda (t4: T).(pc3 c0 +(lift h x1 t4) (THead (Bind b) (lift h x1 x2) t3))) (\lambda (t4: T).(ty3 g e +(THead (Bind b) x2 x3) t4))) (\lambda (x6: T).(\lambda (H26: (ty3 g (CHead e +(Bind b) x2) x5 x6)).(ex_intro2 T (\lambda (t4: T).(pc3 c0 (lift h x1 t4) +(THead (Bind b) (lift h x1 x2) t3))) (\lambda (t4: T).(ty3 g e (THead (Bind +b) x2 x3) t4)) (THead (Bind b) x2 x5) (eq_ind_r T (THead (Bind b) (lift h x1 +x2) (lift h (S x1) x5)) (\lambda (t4: T).(pc3 c0 t4 (THead (Bind b) (lift h +x1 x2) t3))) (pc3_head_2 c0 (lift h x1 x2) (lift h (S x1) x5) t3 (Bind b) +H24) (lift h x1 (THead (Bind b) x2 x5)) (lift_bind b x2 x5 h x1)) (ty3_bind g +e x2 x4 H22 b x3 x5 H25 x6 H26)))) (ty3_correct g (CHead e (Bind b) x2) x3 x5 +H25))))) H23))))) H20)) u H10))))))))) x0 H9)))))) (lift_gen_bind b u t2 x0 h +x1 H7)))))))))))))))))))) (\lambda (c0: C).(\lambda (w: T).(\lambda (u: +T).(\lambda (H1: (ty3 g c0 w u)).(\lambda (H2: ((\forall (x0: T).(\forall +(x1: nat).((eq T w (lift h x1 x0)) \to (\forall (e: C).((drop h x1 c0 e) \to +(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) u)) (\lambda (t2: T).(ty3 g e +x0 t2)))))))))).(\lambda (v: T).(\lambda (t: T).(\lambda (H3: (ty3 g c0 v +(THead (Bind Abst) u t))).(\lambda (H4: ((\forall (x0: T).(\forall (x1: +nat).((eq T v (lift h x1 x0)) \to (\forall (e: C).((drop h x1 c0 e) \to (ex2 +T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (THead (Bind Abst) u t))) (\lambda +(t2: T).(ty3 g e x0 t2)))))))))).(\lambda (x0: T).(\lambda (x1: nat).(\lambda +(H5: (eq T (THead (Flat Appl) w v) (lift h x1 x0))).(\lambda (e: C).(\lambda +(H6: (drop h x1 c0 e)).(ex3_2_ind T T (\lambda (y0: T).(\lambda (z: T).(eq T +x0 (THead (Flat Appl) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T w (lift +h x1 y0)))) (\lambda (_: T).(\lambda (z: T).(eq T v (lift h x1 z)))) (ex2 T +(\lambda (t2: T).(pc3 c0 (lift h x1 t2) (THead (Flat Appl) w (THead (Bind +Abst) u t)))) (\lambda (t2: T).(ty3 g e x0 t2))) (\lambda (x2: T).(\lambda +(x3: T).(\lambda (H7: (eq T x0 (THead (Flat Appl) x2 x3))).(\lambda (H8: (eq +T w (lift h x1 x2))).(\lambda (H9: (eq T v (lift h x1 x3))).(eq_ind_r T +(THead (Flat Appl) x2 x3) (\lambda (t0: T).(ex2 T (\lambda (t2: T).(pc3 c0 +(lift h x1 t2) (THead (Flat Appl) w (THead (Bind Abst) u t)))) (\lambda (t2: +T).(ty3 g e t0 t2)))) (let H10 \def (eq_ind T v (\lambda (t0: T).(\forall +(x4: T).(\forall (x5: nat).((eq T t0 (lift h x5 x4)) \to (\forall (e0: +C).((drop h x5 c0 e0) \to (ex2 T (\lambda (t2: T).(pc3 c0 (lift h x5 t2) +(THead (Bind Abst) u t))) (\lambda (t2: T).(ty3 g e0 x4 t2))))))))) H4 (lift +h x1 x3) H9) in (let H11 \def (eq_ind T v (\lambda (t0: T).(ty3 g c0 t0 +(THead (Bind Abst) u t))) H3 (lift h x1 x3) H9) in (let H12 \def (eq_ind T w +(\lambda (t0: T).(\forall (x4: T).(\forall (x5: nat).((eq T t0 (lift h x5 +x4)) \to (\forall (e0: C).((drop h x5 c0 e0) \to (ex2 T (\lambda (t2: T).(pc3 +c0 (lift h x5 t2) u)) (\lambda (t2: T).(ty3 g e0 x4 t2))))))))) H2 (lift h x1 +x2) H8) in (let H13 \def (eq_ind T w (\lambda (t0: T).(ty3 g c0 t0 u)) H1 +(lift h x1 x2) H8) in (eq_ind_r T (lift h x1 x2) (\lambda (t0: T).(ex2 T +(\lambda (t2: T).(pc3 c0 (lift h x1 t2) (THead (Flat Appl) t0 (THead (Bind +Abst) u t)))) (\lambda (t2: T).(ty3 g e (THead (Flat Appl) x2 x3) t2)))) (let +H14 \def (H12 x2 x1 (refl_equal T (lift h x1 x2)) e H6) in (ex2_ind T +(\lambda (t2: T).(pc3 c0 (lift h x1 t2) u)) (\lambda (t2: T).(ty3 g e x2 t2)) +(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (THead (Flat Appl) (lift h x1 +x2) (THead (Bind Abst) u t)))) (\lambda (t2: T).(ty3 g e (THead (Flat Appl) +x2 x3) t2))) (\lambda (x4: T).(\lambda (H15: (pc3 c0 (lift h x1 x4) +u)).(\lambda (H16: (ty3 g e x2 x4)).(let H17 \def (H10 x3 x1 (refl_equal T +(lift h x1 x3)) e H6) in (ex2_ind T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) +(THead (Bind Abst) u t))) (\lambda (t2: T).(ty3 g e x3 t2)) (ex2 T (\lambda +(t2: T).(pc3 c0 (lift h x1 t2) (THead (Flat Appl) (lift h x1 x2) (THead (Bind +Abst) u t)))) (\lambda (t2: T).(ty3 g e (THead (Flat Appl) x2 x3) t2))) +(\lambda (x5: T).(\lambda (H18: (pc3 c0 (lift h x1 x5) (THead (Bind Abst) u +t))).(\lambda (H19: (ty3 g e x3 x5)).(ex3_2_ind T T (\lambda (u1: T).(\lambda +(t2: T).(pr3 e x5 (THead (Bind Abst) u1 t2)))) (\lambda (u1: T).(\lambda (_: +T).(pr3 c0 u (lift h x1 u1)))) (\lambda (_: T).(\lambda (t2: T).(\forall (b: +B).(\forall (u0: T).(pr3 (CHead c0 (Bind b) u0) t (lift h (S x1) t2)))))) +(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (THead (Flat Appl) (lift h x1 +x2) (THead (Bind Abst) u t)))) (\lambda (t2: T).(ty3 g e (THead (Flat Appl) +x2 x3) t2))) (\lambda (x6: T).(\lambda (x7: T).(\lambda (H20: (pr3 e x5 +(THead (Bind Abst) x6 x7))).(\lambda (H21: (pr3 c0 u (lift h x1 +x6))).(\lambda (H22: ((\forall (b: B).(\forall (u0: T).(pr3 (CHead c0 (Bind +b) u0) t (lift h (S x1) x7)))))).(ex_ind T (\lambda (t0: T).(ty3 g e x5 t0)) +(ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (THead (Flat Appl) (lift h x1 +x2) (THead (Bind Abst) u t)))) (\lambda (t2: T).(ty3 g e (THead (Flat Appl) +x2 x3) t2))) (\lambda (x8: T).(\lambda (H23: (ty3 g e x5 x8)).(ex4_3_ind T T +T (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(pc3 e (THead (Bind Abst) +x6 t2) x8)))) (\lambda (_: T).(\lambda (t0: T).(\lambda (_: T).(ty3 g e x6 +t0)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead e (Bind +Abst) x6) x7 t2)))) (\lambda (t2: T).(\lambda (_: T).(\lambda (t3: T).(ty3 g +(CHead e (Bind Abst) x6) t2 t3)))) (ex2 T (\lambda (t2: T).(pc3 c0 (lift h x1 +t2) (THead (Flat Appl) (lift h x1 x2) (THead (Bind Abst) u t)))) (\lambda +(t2: T).(ty3 g e (THead (Flat Appl) x2 x3) t2))) (\lambda (x9: T).(\lambda +(x10: T).(\lambda (x11: T).(\lambda (_: (pc3 e (THead (Bind Abst) x6 x9) +x8)).(\lambda (H25: (ty3 g e x6 x10)).(\lambda (H26: (ty3 g (CHead e (Bind +Abst) x6) x7 x9)).(\lambda (H27: (ty3 g (CHead e (Bind Abst) x6) x9 +x11)).(ex_intro2 T (\lambda (t2: T).(pc3 c0 (lift h x1 t2) (THead (Flat Appl) +(lift h x1 x2) (THead (Bind Abst) u t)))) (\lambda (t2: T).(ty3 g e (THead +(Flat Appl) x2 x3) t2)) (THead (Flat Appl) x2 (THead (Bind Abst) x6 x7)) +(eq_ind_r T (THead (Flat Appl) (lift h x1 x2) (lift h x1 (THead (Bind Abst) +x6 x7))) (\lambda (t0: T).(pc3 c0 t0 (THead (Flat Appl) (lift h x1 x2) (THead +(Bind Abst) u t)))) (pc3_thin_dx c0 (lift h x1 (THead (Bind Abst) x6 x7)) +(THead (Bind Abst) u t) (eq_ind_r T (THead (Bind Abst) (lift h x1 x6) (lift h +(S x1) x7)) (\lambda (t0: T).(pc3 c0 t0 (THead (Bind Abst) u t))) +(pc3_head_21 c0 (lift h x1 x6) u (pc3_pr3_x c0 (lift h x1 x6) u H21) (Bind +Abst) (lift h (S x1) x7) t (pc3_pr3_x (CHead c0 (Bind Abst) (lift h x1 x6)) +(lift h (S x1) x7) t (H22 Abst (lift h x1 x6)))) (lift h x1 (THead (Bind +Abst) x6 x7)) (lift_bind Abst x6 x7 h x1)) (lift h x1 x2) Appl) (lift h x1 +(THead (Flat Appl) x2 (THead (Bind Abst) x6 x7))) (lift_flat Appl x2 (THead +(Bind Abst) x6 x7) h x1)) (ty3_appl g e x2 x6 (ty3_conv g e x6 x10 H25 x2 x4 +H16 (pc3_gen_lift c0 x4 x6 h x1 (pc3_t u c0 (lift h x1 x4) H15 (lift h x1 x6) +(pc3_pr3_r c0 u (lift h x1 x6) H21)) e H6)) x3 x7 (ty3_conv g e (THead (Bind +Abst) x6 x7) (THead (Bind Abst) x6 x9) (ty3_bind g e x6 x10 H25 Abst x7 x9 +H26 x11 H27) x3 x5 H19 (pc3_pr3_r e x5 (THead (Bind Abst) x6 x7) +H20))))))))))) (ty3_gen_bind g Abst e x6 x7 x8 (ty3_sred_pr3 e x5 (THead +(Bind Abst) x6 x7) H20 g x8 H23))))) (ty3_correct g e x3 x5 H19))))))) +(pc3_gen_lift_abst c0 x5 t u h x1 H18 e H6))))) H17))))) H14)) w H8))))) x0 +H7)))))) (lift_gen_flat Appl w v x0 h x1 H5)))))))))))))))) (\lambda (c0: +C).(\lambda (t2: T).(\lambda (t3: T).(\lambda (H1: (ty3 g c0 t2 t3)).(\lambda +(H2: ((\forall (x0: T).(\forall (x1: nat).((eq T t2 (lift h x1 x0)) \to +(\forall (e: C).((drop h x1 c0 e) \to (ex2 T (\lambda (t4: T).(pc3 c0 (lift h +x1 t4) t3)) (\lambda (t4: T).(ty3 g e x0 t4)))))))))).(\lambda (t0: +T).(\lambda (H3: (ty3 g c0 t3 t0)).(\lambda (H4: ((\forall (x0: T).(\forall +(x1: nat).((eq T t3 (lift h x1 x0)) \to (\forall (e: C).((drop h x1 c0 e) \to +(ex2 T (\lambda (t4: T).(pc3 c0 (lift h x1 t4) t0)) (\lambda (t4: T).(ty3 g e +x0 t4)))))))))).(\lambda (x0: T).(\lambda (x1: nat).(\lambda (H5: (eq T +(THead (Flat Cast) t3 t2) (lift h x1 x0))).(\lambda (e: C).(\lambda (H6: +(drop h x1 c0 e)).(ex3_2_ind T T (\lambda (y0: T).(\lambda (z: T).(eq T x0 +(THead (Flat Cast) y0 z)))) (\lambda (y0: T).(\lambda (_: T).(eq T t3 (lift h +x1 y0)))) (\lambda (_: T).(\lambda (z: T).(eq T t2 (lift h x1 z)))) (ex2 T +(\lambda (t4: T).(pc3 c0 (lift h x1 t4) (THead (Flat Cast) t0 t3))) (\lambda +(t4: T).(ty3 g e x0 t4))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H7: (eq +T x0 (THead (Flat Cast) x2 x3))).(\lambda (H8: (eq T t3 (lift h x1 +x2))).(\lambda (H9: (eq T t2 (lift h x1 x3))).(eq_ind_r T (THead (Flat Cast) +x2 x3) (\lambda (t: T).(ex2 T (\lambda (t4: T).(pc3 c0 (lift h x1 t4) (THead +(Flat Cast) t0 t3))) (\lambda (t4: T).(ty3 g e t t4)))) (let H10 \def (eq_ind +T t3 (\lambda (t: T).(\forall (x4: T).(\forall (x5: nat).((eq T t (lift h x5 +x4)) \to (\forall (e0: C).((drop h x5 c0 e0) \to (ex2 T (\lambda (t4: T).(pc3 +c0 (lift h x5 t4) t0)) (\lambda (t4: T).(ty3 g e0 x4 t4))))))))) H4 (lift h +x1 x2) H8) in (let H11 \def (eq_ind T t3 (\lambda (t: T).(ty3 g c0 t t0)) H3 +(lift h x1 x2) H8) in (let H12 \def (eq_ind T t3 (\lambda (t: T).(\forall +(x4: T).(\forall (x5: nat).((eq T t2 (lift h x5 x4)) \to (\forall (e0: +C).((drop h x5 c0 e0) \to (ex2 T (\lambda (t4: T).(pc3 c0 (lift h x5 t4) t)) +(\lambda (t4: T).(ty3 g e0 x4 t4))))))))) H2 (lift h x1 x2) H8) in (let H13 +\def (eq_ind T t3 (\lambda (t: T).(ty3 g c0 t2 t)) H1 (lift h x1 x2) H8) in +(eq_ind_r T (lift h x1 x2) (\lambda (t: T).(ex2 T (\lambda (t4: T).(pc3 c0 +(lift h x1 t4) (THead (Flat Cast) t0 t))) (\lambda (t4: T).(ty3 g e (THead +(Flat Cast) x2 x3) t4)))) (let H14 \def (eq_ind T t2 (\lambda (t: T).(ty3 g +c0 t (lift h x1 x2))) H13 (lift h x1 x3) H9) in (let H15 \def (eq_ind T t2 +(\lambda (t: T).(\forall (x4: T).(\forall (x5: nat).((eq T t (lift h x5 x4)) +\to (\forall (e0: C).((drop h x5 c0 e0) \to (ex2 T (\lambda (t4: T).(pc3 c0 +(lift h x5 t4) (lift h x1 x2))) (\lambda (t4: T).(ty3 g e0 x4 t4))))))))) H12 +(lift h x1 x3) H9) in (let H16 \def (H15 x3 x1 (refl_equal T (lift h x1 x3)) +e H6) in (ex2_ind T (\lambda (t4: T).(pc3 c0 (lift h x1 t4) (lift h x1 x2))) +(\lambda (t4: T).(ty3 g e x3 t4)) (ex2 T (\lambda (t4: T).(pc3 c0 (lift h x1 +t4) (THead (Flat Cast) t0 (lift h x1 x2)))) (\lambda (t4: T).(ty3 g e (THead +(Flat Cast) x2 x3) t4))) (\lambda (x4: T).(\lambda (H17: (pc3 c0 (lift h x1 +x4) (lift h x1 x2))).(\lambda (H18: (ty3 g e x3 x4)).(let H19 \def (H10 x2 x1 +(refl_equal T (lift h x1 x2)) e H6) in (ex2_ind T (\lambda (t4: T).(pc3 c0 +(lift h x1 t4) t0)) (\lambda (t4: T).(ty3 g e x2 t4)) (ex2 T (\lambda (t4: +T).(pc3 c0 (lift h x1 t4) (THead (Flat Cast) t0 (lift h x1 x2)))) (\lambda +(t4: T).(ty3 g e (THead (Flat Cast) x2 x3) t4))) (\lambda (x5: T).(\lambda +(H20: (pc3 c0 (lift h x1 x5) t0)).(\lambda (H21: (ty3 g e x2 x5)).(ex_intro2 +T (\lambda (t4: T).(pc3 c0 (lift h x1 t4) (THead (Flat Cast) t0 (lift h x1 +x2)))) (\lambda (t4: T).(ty3 g e (THead (Flat Cast) x2 x3) t4)) (THead (Flat +Cast) x5 x2) (eq_ind_r T (THead (Flat Cast) (lift h x1 x5) (lift h x1 x2)) +(\lambda (t: T).(pc3 c0 t (THead (Flat Cast) t0 (lift h x1 x2)))) (pc3_head_1 +c0 (lift h x1 x5) t0 H20 (Flat Cast) (lift h x1 x2)) (lift h x1 (THead (Flat +Cast) x5 x2)) (lift_flat Cast x5 x2 h x1)) (ty3_cast g e x3 x2 (ty3_conv g e +x2 x5 H21 x3 x4 H18 (pc3_gen_lift c0 x4 x2 h x1 H17 e H6)) x5 H21))))) +H19))))) H16)))) t3 H8))))) x0 H7)))))) (lift_gen_flat Cast t3 t2 x0 h x1 +H5))))))))))))))) c y x H0))))) H))))))). + +theorem ty3_tred: + \forall (g: G).(\forall (c: C).(\forall (u: T).(\forall (t1: T).((ty3 g c u +t1) \to (\forall (t2: T).((pr3 c t1 t2) \to (ty3 g c u t2))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u: T).(\lambda (t1: T).(\lambda (H: +(ty3 g c u t1)).(\lambda (t2: T).(\lambda (H0: (pr3 c t1 t2)).(ex_ind T +(\lambda (t: T).(ty3 g c t1 t)) (ty3 g c u t2) (\lambda (x: T).(\lambda (H1: +(ty3 g c t1 x)).(ty3_conv g c t2 x (ty3_sred_pr3 c t1 t2 H0 g x H1) u t1 H +(pc3_pr3_r c t1 t2 H0)))) (ty3_correct g c u t1 H)))))))). + +theorem ty3_sconv_pc3: + \forall (g: G).(\forall (c: C).(\forall (u1: T).(\forall (t1: T).((ty3 g c +u1 t1) \to (\forall (u2: T).(\forall (t2: T).((ty3 g c u2 t2) \to ((pc3 c u1 +u2) \to (pc3 c t1 t2))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda +(H: (ty3 g c u1 t1)).(\lambda (u2: T).(\lambda (t2: T).(\lambda (H0: (ty3 g c +u2 t2)).(\lambda (H1: (pc3 c u1 u2)).(let H2 \def H1 in (ex2_ind T (\lambda +(t: T).(pr3 c u1 t)) (\lambda (t: T).(pr3 c u2 t)) (pc3 c t1 t2) (\lambda (x: +T).(\lambda (H3: (pr3 c u1 x)).(\lambda (H4: (pr3 c u2 x)).(ty3_unique g c x +t1 (ty3_sred_pr3 c u1 x H3 g t1 H) t2 (ty3_sred_pr3 c u2 x H4 g t2 H0))))) +H2)))))))))). + +theorem ty3_sred_back: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t0: T).((ty3 g c +t1 t0) \to (\forall (t2: T).((pr3 c t1 t2) \to (\forall (t: T).((ty3 g c t2 +t) \to (ty3 g c t1 t))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t0: T).(\lambda +(H: (ty3 g c t1 t0)).(\lambda (t2: T).(\lambda (H0: (pr3 c t1 t2)).(\lambda +(t: T).(\lambda (H1: (ty3 g c t2 t)).(ex_ind T (\lambda (t3: T).(ty3 g c t +t3)) (ty3 g c t1 t) (\lambda (x: T).(\lambda (H2: (ty3 g c t x)).(ty3_conv g +c t x H2 t1 t0 H (ty3_unique g c t2 t0 (ty3_sred_pr3 c t1 t2 H0 g t0 H) t +H1)))) (ty3_correct g c t2 t H1)))))))))). + +theorem ty3_sconv: + \forall (g: G).(\forall (c: C).(\forall (u1: T).(\forall (t1: T).((ty3 g c +u1 t1) \to (\forall (u2: T).(\forall (t2: T).((ty3 g c u2 t2) \to ((pc3 c u1 +u2) \to (ty3 g c u1 t2))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u1: T).(\lambda (t1: T).(\lambda +(H: (ty3 g c u1 t1)).(\lambda (u2: T).(\lambda (t2: T).(\lambda (H0: (ty3 g c +u2 t2)).(\lambda (H1: (pc3 c u1 u2)).(let H2 \def H1 in (ex2_ind T (\lambda +(t: T).(pr3 c u1 t)) (\lambda (t: T).(pr3 c u2 t)) (ty3 g c u1 t2) (\lambda +(x: T).(\lambda (H3: (pr3 c u1 x)).(\lambda (H4: (pr3 c u2 x)).(ty3_sred_back +g c u1 t1 H x H3 t2 (ty3_sred_pr3 c u2 x H4 g t2 H0))))) H2)))))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/props.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/props.ma new file mode 100644 index 000000000..9809bc5ef --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/props.ma @@ -0,0 +1,483 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/props". + +include "ty3/fwd.ma". + +include "pc3/fwd.ma". + +theorem ty3_lift: + \forall (g: G).(\forall (e: C).(\forall (t1: T).(\forall (t2: T).((ty3 g e +t1 t2) \to (\forall (c: C).(\forall (d: nat).(\forall (h: nat).((drop h d c +e) \to (ty3 g c (lift h d t1) (lift h d t2)))))))))) +\def + \lambda (g: G).(\lambda (e: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (ty3 g e t1 t2)).(ty3_ind g (\lambda (c: C).(\lambda (t: T).(\lambda (t0: +T).(\forall (c0: C).(\forall (d: nat).(\forall (h: nat).((drop h d c0 c) \to +(ty3 g c0 (lift h d t) (lift h d t0))))))))) (\lambda (c: C).(\lambda (t0: +T).(\lambda (t: T).(\lambda (_: (ty3 g c t0 t)).(\lambda (H1: ((\forall (c0: +C).(\forall (d: nat).(\forall (h: nat).((drop h d c0 c) \to (ty3 g c0 (lift h +d t0) (lift h d t)))))))).(\lambda (u: T).(\lambda (t3: T).(\lambda (_: (ty3 +g c u t3)).(\lambda (H3: ((\forall (c0: C).(\forall (d: nat).(\forall (h: +nat).((drop h d c0 c) \to (ty3 g c0 (lift h d u) (lift h d +t3)))))))).(\lambda (H4: (pc3 c t3 t0)).(\lambda (c0: C).(\lambda (d: +nat).(\lambda (h: nat).(\lambda (H5: (drop h d c0 c)).(ty3_conv g c0 (lift h +d t0) (lift h d t) (H1 c0 d h H5) (lift h d u) (lift h d t3) (H3 c0 d h H5) +(pc3_lift c0 c h d H5 t3 t0 H4)))))))))))))))) (\lambda (c: C).(\lambda (m: +nat).(\lambda (c0: C).(\lambda (d: nat).(\lambda (h: nat).(\lambda (_: (drop +h d c0 c)).(eq_ind_r T (TSort m) (\lambda (t: T).(ty3 g c0 t (lift h d (TSort +(next g m))))) (eq_ind_r T (TSort (next g m)) (\lambda (t: T).(ty3 g c0 +(TSort m) t)) (ty3_sort g c0 m) (lift h d (TSort (next g m))) (lift_sort +(next g m) h d)) (lift h d (TSort m)) (lift_sort m h d)))))))) (\lambda (n: +nat).(\lambda (c: C).(\lambda (d: C).(\lambda (u: T).(\lambda (H0: (getl n c +(CHead d (Bind Abbr) u))).(\lambda (t: T).(\lambda (H1: (ty3 g d u +t)).(\lambda (H2: ((\forall (c0: C).(\forall (d0: nat).(\forall (h: +nat).((drop h d0 c0 d) \to (ty3 g c0 (lift h d0 u) (lift h d0 +t)))))))).(\lambda (c0: C).(\lambda (d0: nat).(\lambda (h: nat).(\lambda (H3: +(drop h d0 c0 c)).(lt_le_e n d0 (ty3 g c0 (lift h d0 (TLRef n)) (lift h d0 +(lift (S n) O t))) (\lambda (H4: (lt n d0)).(let H5 \def (drop_getl_trans_le +n d0 (le_S_n n d0 (le_S (S n) d0 H4)) c0 c h H3 (CHead d (Bind Abbr) u) H0) +in (ex3_2_ind C C (\lambda (e0: C).(\lambda (_: C).(drop n O c0 e0))) +(\lambda (e0: C).(\lambda (e1: C).(drop h (minus d0 n) e0 e1))) (\lambda (_: +C).(\lambda (e1: C).(clear e1 (CHead d (Bind Abbr) u)))) (ty3 g c0 (lift h d0 +(TLRef n)) (lift h d0 (lift (S n) O t))) (\lambda (x0: C).(\lambda (x1: +C).(\lambda (H6: (drop n O c0 x0)).(\lambda (H7: (drop h (minus d0 n) x0 +x1)).(\lambda (H8: (clear x1 (CHead d (Bind Abbr) u))).(let H9 \def (eq_ind +nat (minus d0 n) (\lambda (n0: nat).(drop h n0 x0 x1)) H7 (S (minus d0 (S +n))) (minus_x_Sy d0 n H4)) in (let H10 \def (drop_clear_S x1 x0 h (minus d0 +(S n)) H9 Abbr d u H8) in (ex2_ind C (\lambda (c1: C).(clear x0 (CHead c1 +(Bind Abbr) (lift h (minus d0 (S n)) u)))) (\lambda (c1: C).(drop h (minus d0 +(S n)) c1 d)) (ty3 g c0 (lift h d0 (TLRef n)) (lift h d0 (lift (S n) O t))) +(\lambda (x: C).(\lambda (H11: (clear x0 (CHead x (Bind Abbr) (lift h (minus +d0 (S n)) u)))).(\lambda (H12: (drop h (minus d0 (S n)) x d)).(eq_ind_r T +(TLRef n) (\lambda (t0: T).(ty3 g c0 t0 (lift h d0 (lift (S n) O t)))) +(eq_ind nat (plus (S n) (minus d0 (S n))) (\lambda (n0: nat).(ty3 g c0 (TLRef +n) (lift h n0 (lift (S n) O t)))) (eq_ind_r T (lift (S n) O (lift h (minus d0 +(S n)) t)) (\lambda (t0: T).(ty3 g c0 (TLRef n) t0)) (eq_ind nat d0 (\lambda +(_: nat).(ty3 g c0 (TLRef n) (lift (S n) O (lift h (minus d0 (S n)) t)))) +(ty3_abbr g n c0 x (lift h (minus d0 (S n)) u) (getl_intro n c0 (CHead x +(Bind Abbr) (lift h (minus d0 (S n)) u)) x0 H6 H11) (lift h (minus d0 (S n)) +t) (H2 x (minus d0 (S n)) h H12)) (plus (S n) (minus d0 (S n))) +(le_plus_minus (S n) d0 H4)) (lift h (plus (S n) (minus d0 (S n))) (lift (S +n) O t)) (lift_d t h (S n) (minus d0 (S n)) O (le_O_n (minus d0 (S n))))) d0 +(le_plus_minus_r (S n) d0 H4)) (lift h d0 (TLRef n)) (lift_lref_lt n h d0 +H4))))) H10)))))))) H5))) (\lambda (H4: (le d0 n)).(eq_ind_r T (TLRef (plus n +h)) (\lambda (t0: T).(ty3 g c0 t0 (lift h d0 (lift (S n) O t)))) (eq_ind nat +(S n) (\lambda (_: nat).(ty3 g c0 (TLRef (plus n h)) (lift h d0 (lift (S n) O +t)))) (eq_ind_r T (lift (plus h (S n)) O t) (\lambda (t0: T).(ty3 g c0 (TLRef +(plus n h)) t0)) (eq_ind_r nat (plus (S n) h) (\lambda (n0: nat).(ty3 g c0 +(TLRef (plus n h)) (lift n0 O t))) (ty3_abbr g (plus n h) c0 d u +(drop_getl_trans_ge n c0 c d0 h H3 (CHead d (Bind Abbr) u) H0 H4) t H1) (plus +h (S n)) (plus_comm h (S n))) (lift h d0 (lift (S n) O t)) (lift_free t (S n) +h O d0 (le_S d0 n H4) (le_O_n d0))) (plus n (S O)) (eq_ind_r nat (plus (S O) +n) (\lambda (n0: nat).(eq nat (S n) n0)) (refl_equal nat (plus (S O) n)) +(plus n (S O)) (plus_comm n (S O)))) (lift h d0 (TLRef n)) (lift_lref_ge n h +d0 H4)))))))))))))))) (\lambda (n: nat).(\lambda (c: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (H0: (getl n c (CHead d (Bind Abst) u))).(\lambda +(t: T).(\lambda (H1: (ty3 g d u t)).(\lambda (H2: ((\forall (c0: C).(\forall +(d0: nat).(\forall (h: nat).((drop h d0 c0 d) \to (ty3 g c0 (lift h d0 u) +(lift h d0 t)))))))).(\lambda (c0: C).(\lambda (d0: nat).(\lambda (h: +nat).(\lambda (H3: (drop h d0 c0 c)).(lt_le_e n d0 (ty3 g c0 (lift h d0 +(TLRef n)) (lift h d0 (lift (S n) O u))) (\lambda (H4: (lt n d0)).(let H5 +\def (drop_getl_trans_le n d0 (le_S_n n d0 (le_S (S n) d0 H4)) c0 c h H3 +(CHead d (Bind Abst) u) H0) in (ex3_2_ind C C (\lambda (e0: C).(\lambda (_: +C).(drop n O c0 e0))) (\lambda (e0: C).(\lambda (e1: C).(drop h (minus d0 n) +e0 e1))) (\lambda (_: C).(\lambda (e1: C).(clear e1 (CHead d (Bind Abst) +u)))) (ty3 g c0 (lift h d0 (TLRef n)) (lift h d0 (lift (S n) O u))) (\lambda +(x0: C).(\lambda (x1: C).(\lambda (H6: (drop n O c0 x0)).(\lambda (H7: (drop +h (minus d0 n) x0 x1)).(\lambda (H8: (clear x1 (CHead d (Bind Abst) u))).(let +H9 \def (eq_ind nat (minus d0 n) (\lambda (n0: nat).(drop h n0 x0 x1)) H7 (S +(minus d0 (S n))) (minus_x_Sy d0 n H4)) in (let H10 \def (drop_clear_S x1 x0 +h (minus d0 (S n)) H9 Abst d u H8) in (ex2_ind C (\lambda (c1: C).(clear x0 +(CHead c1 (Bind Abst) (lift h (minus d0 (S n)) u)))) (\lambda (c1: C).(drop h +(minus d0 (S n)) c1 d)) (ty3 g c0 (lift h d0 (TLRef n)) (lift h d0 (lift (S +n) O u))) (\lambda (x: C).(\lambda (H11: (clear x0 (CHead x (Bind Abst) (lift +h (minus d0 (S n)) u)))).(\lambda (H12: (drop h (minus d0 (S n)) x +d)).(eq_ind_r T (TLRef n) (\lambda (t0: T).(ty3 g c0 t0 (lift h d0 (lift (S +n) O u)))) (eq_ind nat (plus (S n) (minus d0 (S n))) (\lambda (n0: nat).(ty3 +g c0 (TLRef n) (lift h n0 (lift (S n) O u)))) (eq_ind_r T (lift (S n) O (lift +h (minus d0 (S n)) u)) (\lambda (t0: T).(ty3 g c0 (TLRef n) t0)) (eq_ind nat +d0 (\lambda (_: nat).(ty3 g c0 (TLRef n) (lift (S n) O (lift h (minus d0 (S +n)) u)))) (ty3_abst g n c0 x (lift h (minus d0 (S n)) u) (getl_intro n c0 +(CHead x (Bind Abst) (lift h (minus d0 (S n)) u)) x0 H6 H11) (lift h (minus +d0 (S n)) t) (H2 x (minus d0 (S n)) h H12)) (plus (S n) (minus d0 (S n))) +(le_plus_minus (S n) d0 H4)) (lift h (plus (S n) (minus d0 (S n))) (lift (S +n) O u)) (lift_d u h (S n) (minus d0 (S n)) O (le_O_n (minus d0 (S n))))) d0 +(le_plus_minus_r (S n) d0 H4)) (lift h d0 (TLRef n)) (lift_lref_lt n h d0 +H4))))) H10)))))))) H5))) (\lambda (H4: (le d0 n)).(eq_ind_r T (TLRef (plus n +h)) (\lambda (t0: T).(ty3 g c0 t0 (lift h d0 (lift (S n) O u)))) (eq_ind nat +(S n) (\lambda (_: nat).(ty3 g c0 (TLRef (plus n h)) (lift h d0 (lift (S n) O +u)))) (eq_ind_r T (lift (plus h (S n)) O u) (\lambda (t0: T).(ty3 g c0 (TLRef +(plus n h)) t0)) (eq_ind_r nat (plus (S n) h) (\lambda (n0: nat).(ty3 g c0 +(TLRef (plus n h)) (lift n0 O u))) (ty3_abst g (plus n h) c0 d u +(drop_getl_trans_ge n c0 c d0 h H3 (CHead d (Bind Abst) u) H0 H4) t H1) (plus +h (S n)) (plus_comm h (S n))) (lift h d0 (lift (S n) O u)) (lift_free u (S n) +h O d0 (le_S d0 n H4) (le_O_n d0))) (plus n (S O)) (eq_ind_r nat (plus (S O) +n) (\lambda (n0: nat).(eq nat (S n) n0)) (refl_equal nat (plus (S O) n)) +(plus n (S O)) (plus_comm n (S O)))) (lift h d0 (TLRef n)) (lift_lref_ge n h +d0 H4)))))))))))))))) (\lambda (c: C).(\lambda (u: T).(\lambda (t: +T).(\lambda (_: (ty3 g c u t)).(\lambda (H1: ((\forall (c0: C).(\forall (d: +nat).(\forall (h: nat).((drop h d c0 c) \to (ty3 g c0 (lift h d u) (lift h d +t)))))))).(\lambda (b: B).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (ty3 +g (CHead c (Bind b) u) t0 t3)).(\lambda (H3: ((\forall (c0: C).(\forall (d: +nat).(\forall (h: nat).((drop h d c0 (CHead c (Bind b) u)) \to (ty3 g c0 +(lift h d t0) (lift h d t3)))))))).(\lambda (t4: T).(\lambda (_: (ty3 g +(CHead c (Bind b) u) t3 t4)).(\lambda (H5: ((\forall (c0: C).(\forall (d: +nat).(\forall (h: nat).((drop h d c0 (CHead c (Bind b) u)) \to (ty3 g c0 +(lift h d t3) (lift h d t4)))))))).(\lambda (c0: C).(\lambda (d: +nat).(\lambda (h: nat).(\lambda (H6: (drop h d c0 c)).(eq_ind_r T (THead +(Bind b) (lift h d u) (lift h (s (Bind b) d) t0)) (\lambda (t5: T).(ty3 g c0 +t5 (lift h d (THead (Bind b) u t3)))) (eq_ind_r T (THead (Bind b) (lift h d +u) (lift h (s (Bind b) d) t3)) (\lambda (t5: T).(ty3 g c0 (THead (Bind b) +(lift h d u) (lift h (s (Bind b) d) t0)) t5)) (ty3_bind g c0 (lift h d u) +(lift h d t) (H1 c0 d h H6) b (lift h (S d) t0) (lift h (S d) t3) (H3 (CHead +c0 (Bind b) (lift h d u)) (S d) h (drop_skip_bind h d c0 c H6 b u)) (lift h +(S d) t4) (H5 (CHead c0 (Bind b) (lift h d u)) (S d) h (drop_skip_bind h d c0 +c H6 b u))) (lift h d (THead (Bind b) u t3)) (lift_head (Bind b) u t3 h d)) +(lift h d (THead (Bind b) u t0)) (lift_head (Bind b) u t0 h +d))))))))))))))))))) (\lambda (c: C).(\lambda (w: T).(\lambda (u: T).(\lambda +(_: (ty3 g c w u)).(\lambda (H1: ((\forall (c0: C).(\forall (d: nat).(\forall +(h: nat).((drop h d c0 c) \to (ty3 g c0 (lift h d w) (lift h d +u)))))))).(\lambda (v: T).(\lambda (t: T).(\lambda (_: (ty3 g c v (THead +(Bind Abst) u t))).(\lambda (H3: ((\forall (c0: C).(\forall (d: nat).(\forall +(h: nat).((drop h d c0 c) \to (ty3 g c0 (lift h d v) (lift h d (THead (Bind +Abst) u t))))))))).(\lambda (c0: C).(\lambda (d: nat).(\lambda (h: +nat).(\lambda (H4: (drop h d c0 c)).(eq_ind_r T (THead (Flat Appl) (lift h d +w) (lift h (s (Flat Appl) d) v)) (\lambda (t0: T).(ty3 g c0 t0 (lift h d +(THead (Flat Appl) w (THead (Bind Abst) u t))))) (eq_ind_r T (THead (Flat +Appl) (lift h d w) (lift h (s (Flat Appl) d) (THead (Bind Abst) u t))) +(\lambda (t0: T).(ty3 g c0 (THead (Flat Appl) (lift h d w) (lift h (s (Flat +Appl) d) v)) t0)) (eq_ind_r T (THead (Bind Abst) (lift h (s (Flat Appl) d) u) +(lift h (s (Bind Abst) (s (Flat Appl) d)) t)) (\lambda (t0: T).(ty3 g c0 +(THead (Flat Appl) (lift h d w) (lift h (s (Flat Appl) d) v)) (THead (Flat +Appl) (lift h d w) t0))) (ty3_appl g c0 (lift h d w) (lift h d u) (H1 c0 d h +H4) (lift h d v) (lift h (S d) t) (eq_ind T (lift h d (THead (Bind Abst) u +t)) (\lambda (t0: T).(ty3 g c0 (lift h d v) t0)) (H3 c0 d h H4) (THead (Bind +Abst) (lift h d u) (lift h (S d) t)) (lift_bind Abst u t h d))) (lift h (s +(Flat Appl) d) (THead (Bind Abst) u t)) (lift_head (Bind Abst) u t h (s (Flat +Appl) d))) (lift h d (THead (Flat Appl) w (THead (Bind Abst) u t))) +(lift_head (Flat Appl) w (THead (Bind Abst) u t) h d)) (lift h d (THead (Flat +Appl) w v)) (lift_head (Flat Appl) w v h d))))))))))))))) (\lambda (c: +C).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (ty3 g c t0 t3)).(\lambda +(H1: ((\forall (c0: C).(\forall (d: nat).(\forall (h: nat).((drop h d c0 c) +\to (ty3 g c0 (lift h d t0) (lift h d t3)))))))).(\lambda (t4: T).(\lambda +(_: (ty3 g c t3 t4)).(\lambda (H3: ((\forall (c0: C).(\forall (d: +nat).(\forall (h: nat).((drop h d c0 c) \to (ty3 g c0 (lift h d t3) (lift h d +t4)))))))).(\lambda (c0: C).(\lambda (d: nat).(\lambda (h: nat).(\lambda (H4: +(drop h d c0 c)).(eq_ind_r T (THead (Flat Cast) (lift h d t3) (lift h (s +(Flat Cast) d) t0)) (\lambda (t: T).(ty3 g c0 t (lift h d (THead (Flat Cast) +t4 t3)))) (eq_ind_r T (THead (Flat Cast) (lift h d t4) (lift h (s (Flat Cast) +d) t3)) (\lambda (t: T).(ty3 g c0 (THead (Flat Cast) (lift h d t3) (lift h (s +(Flat Cast) d) t0)) t)) (ty3_cast g c0 (lift h (s (Flat Cast) d) t0) (lift h +(s (Flat Cast) d) t3) (H1 c0 (s (Flat Cast) d) h H4) (lift h d t4) (H3 c0 d h +H4)) (lift h d (THead (Flat Cast) t4 t3)) (lift_head (Flat Cast) t4 t3 h d)) +(lift h d (THead (Flat Cast) t3 t0)) (lift_head (Flat Cast) t3 t0 h +d)))))))))))))) e t1 t2 H))))). + +theorem ty3_correct: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t2: T).((ty3 g c +t1 t2) \to (ex T (\lambda (t: T).(ty3 g c t2 t))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (ty3 g c t1 t2)).(ty3_ind g (\lambda (c0: C).(\lambda (_: T).(\lambda +(t0: T).(ex T (\lambda (t3: T).(ty3 g c0 t0 t3)))))) (\lambda (c0: +C).(\lambda (t0: T).(\lambda (t: T).(\lambda (H0: (ty3 g c0 t0 t)).(\lambda +(_: (ex T (\lambda (t3: T).(ty3 g c0 t t3)))).(\lambda (u: T).(\lambda (t3: +T).(\lambda (_: (ty3 g c0 u t3)).(\lambda (_: (ex T (\lambda (t4: T).(ty3 g +c0 t3 t4)))).(\lambda (_: (pc3 c0 t3 t0)).(ex_intro T (\lambda (t4: T).(ty3 g +c0 t0 t4)) t H0))))))))))) (\lambda (c0: C).(\lambda (m: nat).(ex_intro T +(\lambda (t: T).(ty3 g c0 (TSort (next g m)) t)) (TSort (next g (next g m))) +(ty3_sort g c0 (next g m))))) (\lambda (n: nat).(\lambda (c0: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (H0: (getl n c0 (CHead d (Bind Abbr) +u))).(\lambda (t: T).(\lambda (_: (ty3 g d u t)).(\lambda (H2: (ex T (\lambda +(t0: T).(ty3 g d t t0)))).(let H3 \def H2 in (ex_ind T (\lambda (t0: T).(ty3 +g d t t0)) (ex T (\lambda (t0: T).(ty3 g c0 (lift (S n) O t) t0))) (\lambda +(x: T).(\lambda (H4: (ty3 g d t x)).(ex_intro T (\lambda (t0: T).(ty3 g c0 +(lift (S n) O t) t0)) (lift (S n) O x) (ty3_lift g d t x H4 c0 O (S n) +(getl_drop Abbr c0 d u n H0))))) H3)))))))))) (\lambda (n: nat).(\lambda (c0: +C).(\lambda (d: C).(\lambda (u: T).(\lambda (H0: (getl n c0 (CHead d (Bind +Abst) u))).(\lambda (t: T).(\lambda (H1: (ty3 g d u t)).(\lambda (_: (ex T +(\lambda (t0: T).(ty3 g d t t0)))).(ex_intro T (\lambda (t0: T).(ty3 g c0 +(lift (S n) O u) t0)) (lift (S n) O t) (ty3_lift g d u t H1 c0 O (S n) +(getl_drop Abst c0 d u n H0))))))))))) (\lambda (c0: C).(\lambda (u: +T).(\lambda (t: T).(\lambda (H0: (ty3 g c0 u t)).(\lambda (_: (ex T (\lambda +(t0: T).(ty3 g c0 t t0)))).(\lambda (b: B).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u) t0 t3)).(\lambda (_: (ex T +(\lambda (t4: T).(ty3 g (CHead c0 (Bind b) u) t3 t4)))).(\lambda (t4: +T).(\lambda (H4: (ty3 g (CHead c0 (Bind b) u) t3 t4)).(\lambda (H5: (ex T +(\lambda (t5: T).(ty3 g (CHead c0 (Bind b) u) t4 t5)))).(let H6 \def H5 in +(ex_ind T (\lambda (t5: T).(ty3 g (CHead c0 (Bind b) u) t4 t5)) (ex T +(\lambda (t5: T).(ty3 g c0 (THead (Bind b) u t3) t5))) (\lambda (x: +T).(\lambda (H7: (ty3 g (CHead c0 (Bind b) u) t4 x)).(ex_intro T (\lambda +(t5: T).(ty3 g c0 (THead (Bind b) u t3) t5)) (THead (Bind b) u t4) (ty3_bind +g c0 u t H0 b t3 t4 H4 x H7)))) H6))))))))))))))) (\lambda (c0: C).(\lambda +(w: T).(\lambda (u: T).(\lambda (H0: (ty3 g c0 w u)).(\lambda (H1: (ex T +(\lambda (t: T).(ty3 g c0 u t)))).(\lambda (v: T).(\lambda (t: T).(\lambda +(_: (ty3 g c0 v (THead (Bind Abst) u t))).(\lambda (H3: (ex T (\lambda (t0: +T).(ty3 g c0 (THead (Bind Abst) u t) t0)))).(let H4 \def H1 in (ex_ind T +(\lambda (t0: T).(ty3 g c0 u t0)) (ex T (\lambda (t0: T).(ty3 g c0 (THead +(Flat Appl) w (THead (Bind Abst) u t)) t0))) (\lambda (x: T).(\lambda (_: +(ty3 g c0 u x)).(let H6 \def H3 in (ex_ind T (\lambda (t0: T).(ty3 g c0 +(THead (Bind Abst) u t) t0)) (ex T (\lambda (t0: T).(ty3 g c0 (THead (Flat +Appl) w (THead (Bind Abst) u t)) t0))) (\lambda (x0: T).(\lambda (H7: (ty3 g +c0 (THead (Bind Abst) u t) x0)).(ex4_3_ind T T T (\lambda (t3: T).(\lambda +(_: T).(\lambda (_: T).(pc3 c0 (THead (Bind Abst) u t3) x0)))) (\lambda (_: +T).(\lambda (t0: T).(\lambda (_: T).(ty3 g c0 u t0)))) (\lambda (t3: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind Abst) u) t t3)))) +(\lambda (t3: T).(\lambda (_: T).(\lambda (t4: T).(ty3 g (CHead c0 (Bind +Abst) u) t3 t4)))) (ex T (\lambda (t0: T).(ty3 g c0 (THead (Flat Appl) w +(THead (Bind Abst) u t)) t0))) (\lambda (x1: T).(\lambda (x2: T).(\lambda +(x3: T).(\lambda (_: (pc3 c0 (THead (Bind Abst) u x1) x0)).(\lambda (H9: (ty3 +g c0 u x2)).(\lambda (H10: (ty3 g (CHead c0 (Bind Abst) u) t x1)).(\lambda +(H11: (ty3 g (CHead c0 (Bind Abst) u) x1 x3)).(ex_intro T (\lambda (t0: +T).(ty3 g c0 (THead (Flat Appl) w (THead (Bind Abst) u t)) t0)) (THead (Flat +Appl) w (THead (Bind Abst) u x1)) (ty3_appl g c0 w u H0 (THead (Bind Abst) u +t) x1 (ty3_bind g c0 u x2 H9 Abst t x1 H10 x3 H11)))))))))) (ty3_gen_bind g +Abst c0 u t x0 H7)))) H6)))) H4))))))))))) (\lambda (c0: C).(\lambda (t0: +T).(\lambda (t3: T).(\lambda (_: (ty3 g c0 t0 t3)).(\lambda (_: (ex T +(\lambda (t: T).(ty3 g c0 t3 t)))).(\lambda (t4: T).(\lambda (H2: (ty3 g c0 +t3 t4)).(\lambda (H3: (ex T (\lambda (t: T).(ty3 g c0 t4 t)))).(let H4 \def +H3 in (ex_ind T (\lambda (t: T).(ty3 g c0 t4 t)) (ex T (\lambda (t: T).(ty3 g +c0 (THead (Flat Cast) t4 t3) t))) (\lambda (x: T).(\lambda (H5: (ty3 g c0 t4 +x)).(ex_intro T (\lambda (t: T).(ty3 g c0 (THead (Flat Cast) t4 t3) t)) +(THead (Flat Cast) x t4) (ty3_cast g c0 t3 t4 H2 x H5)))) H4)))))))))) c t1 +t2 H))))). + +theorem ty3_unique: + \forall (g: G).(\forall (c: C).(\forall (u: T).(\forall (t1: T).((ty3 g c u +t1) \to (\forall (t2: T).((ty3 g c u t2) \to (pc3 c t1 t2))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u: T).(\lambda (t1: T).(\lambda (H: +(ty3 g c u t1)).(ty3_ind g (\lambda (c0: C).(\lambda (t: T).(\lambda (t0: +T).(\forall (t2: T).((ty3 g c0 t t2) \to (pc3 c0 t0 t2)))))) (\lambda (c0: +C).(\lambda (t2: T).(\lambda (t: T).(\lambda (_: (ty3 g c0 t2 t)).(\lambda +(_: ((\forall (t3: T).((ty3 g c0 t2 t3) \to (pc3 c0 t t3))))).(\lambda (u0: +T).(\lambda (t0: T).(\lambda (_: (ty3 g c0 u0 t0)).(\lambda (H3: ((\forall +(t3: T).((ty3 g c0 u0 t3) \to (pc3 c0 t0 t3))))).(\lambda (H4: (pc3 c0 t0 +t2)).(\lambda (t3: T).(\lambda (H5: (ty3 g c0 u0 t3)).(pc3_t t0 c0 t2 (pc3_s +c0 t2 t0 H4) t3 (H3 t3 H5)))))))))))))) (\lambda (c0: C).(\lambda (m: +nat).(\lambda (t2: T).(\lambda (H0: (ty3 g c0 (TSort m) t2)).(ty3_gen_sort g +c0 t2 m H0))))) (\lambda (n: nat).(\lambda (c0: C).(\lambda (d: C).(\lambda +(u0: T).(\lambda (H0: (getl n c0 (CHead d (Bind Abbr) u0))).(\lambda (t: +T).(\lambda (_: (ty3 g d u0 t)).(\lambda (H2: ((\forall (t2: T).((ty3 g d u0 +t2) \to (pc3 d t t2))))).(\lambda (t2: T).(\lambda (H3: (ty3 g c0 (TLRef n) +t2)).(or_ind (ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: +T).(pc3 c0 (lift (S n) O t0) t2)))) (\lambda (e: C).(\lambda (u1: T).(\lambda +(_: T).(getl n c0 (CHead e (Bind Abbr) u1))))) (\lambda (e: C).(\lambda (u1: +T).(\lambda (t0: T).(ty3 g e u1 t0))))) (ex3_3 C T T (\lambda (_: C).(\lambda +(u1: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u1) t2)))) (\lambda (e: +C).(\lambda (u1: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) u1))))) +(\lambda (e: C).(\lambda (u1: T).(\lambda (t0: T).(ty3 g e u1 t0))))) (pc3 c0 +(lift (S n) O t) t2) (\lambda (H4: (ex3_3 C T T (\lambda (_: C).(\lambda (_: +T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t2)))) (\lambda (e: C).(\lambda +(u1: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) u1))))) (\lambda (e: +C).(\lambda (u1: T).(\lambda (t0: T).(ty3 g e u1 t0)))))).(ex3_3_ind C T T +(\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) +t2)))) (\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(getl n c0 (CHead e +(Bind Abbr) u1))))) (\lambda (e: C).(\lambda (u1: T).(\lambda (t0: T).(ty3 g +e u1 t0)))) (pc3 c0 (lift (S n) O t) t2) (\lambda (x0: C).(\lambda (x1: +T).(\lambda (x2: T).(\lambda (H5: (pc3 c0 (lift (S n) O x2) t2)).(\lambda +(H6: (getl n c0 (CHead x0 (Bind Abbr) x1))).(\lambda (H7: (ty3 g x0 x1 +x2)).(let H8 \def (eq_ind C (CHead d (Bind Abbr) u0) (\lambda (c1: C).(getl n +c0 c1)) H0 (CHead x0 (Bind Abbr) x1) (getl_mono c0 (CHead d (Bind Abbr) u0) n +H0 (CHead x0 (Bind Abbr) x1) H6)) in (let H9 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c1 _ _) \Rightarrow c1])) (CHead d (Bind Abbr) u0) (CHead x0 (Bind +Abbr) x1) (getl_mono c0 (CHead d (Bind Abbr) u0) n H0 (CHead x0 (Bind Abbr) +x1) H6)) in ((let H10 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | (CHead _ _ t0) +\Rightarrow t0])) (CHead d (Bind Abbr) u0) (CHead x0 (Bind Abbr) x1) +(getl_mono c0 (CHead d (Bind Abbr) u0) n H0 (CHead x0 (Bind Abbr) x1) H6)) in +(\lambda (H11: (eq C d x0)).(let H12 \def (eq_ind_r T x1 (\lambda (t0: +T).(getl n c0 (CHead x0 (Bind Abbr) t0))) H8 u0 H10) in (let H13 \def +(eq_ind_r T x1 (\lambda (t0: T).(ty3 g x0 t0 x2)) H7 u0 H10) in (let H14 \def +(eq_ind_r C x0 (\lambda (c1: C).(getl n c0 (CHead c1 (Bind Abbr) u0))) H12 d +H11) in (let H15 \def (eq_ind_r C x0 (\lambda (c1: C).(ty3 g c1 u0 x2)) H13 d +H11) in (pc3_t (lift (S n) O x2) c0 (lift (S n) O t) (pc3_lift c0 d (S n) O +(getl_drop Abbr c0 d u0 n H14) t x2 (H2 x2 H15)) t2 H5))))))) H9))))))))) +H4)) (\lambda (H4: (ex3_3 C T T (\lambda (_: C).(\lambda (u1: T).(\lambda (_: +T).(pc3 c0 (lift (S n) O u1) t2)))) (\lambda (e: C).(\lambda (u1: T).(\lambda +(_: T).(getl n c0 (CHead e (Bind Abst) u1))))) (\lambda (e: C).(\lambda (u1: +T).(\lambda (t0: T).(ty3 g e u1 t0)))))).(ex3_3_ind C T T (\lambda (_: +C).(\lambda (u1: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u1) t2)))) (\lambda +(e: C).(\lambda (u1: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abst) +u1))))) (\lambda (e: C).(\lambda (u1: T).(\lambda (t0: T).(ty3 g e u1 t0)))) +(pc3 c0 (lift (S n) O t) t2) (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: +T).(\lambda (_: (pc3 c0 (lift (S n) O x1) t2)).(\lambda (H6: (getl n c0 +(CHead x0 (Bind Abst) x1))).(\lambda (_: (ty3 g x0 x1 x2)).(let H8 \def +(eq_ind C (CHead d (Bind Abbr) u0) (\lambda (c1: C).(getl n c0 c1)) H0 (CHead +x0 (Bind Abst) x1) (getl_mono c0 (CHead d (Bind Abbr) u0) n H0 (CHead x0 +(Bind Abst) x1) H6)) in (let H9 \def (eq_ind C (CHead d (Bind Abbr) u0) +(\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) +\Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind b) \Rightarrow (match b in B return (\lambda (_: +B).Prop) with [Abbr \Rightarrow True | Abst \Rightarrow False | Void +\Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead x0 (Bind Abst) +x1) (getl_mono c0 (CHead d (Bind Abbr) u0) n H0 (CHead x0 (Bind Abst) x1) +H6)) in (False_ind (pc3 c0 (lift (S n) O t) t2) H9))))))))) H4)) +(ty3_gen_lref g c0 t2 n H3)))))))))))) (\lambda (n: nat).(\lambda (c0: +C).(\lambda (d: C).(\lambda (u0: T).(\lambda (H0: (getl n c0 (CHead d (Bind +Abst) u0))).(\lambda (t: T).(\lambda (_: (ty3 g d u0 t)).(\lambda (_: +((\forall (t2: T).((ty3 g d u0 t2) \to (pc3 d t t2))))).(\lambda (t2: +T).(\lambda (H3: (ty3 g c0 (TLRef n) t2)).(or_ind (ex3_3 C T T (\lambda (_: +C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t2)))) (\lambda +(e: C).(\lambda (u1: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) +u1))))) (\lambda (e: C).(\lambda (u1: T).(\lambda (t0: T).(ty3 g e u1 t0))))) +(ex3_3 C T T (\lambda (_: C).(\lambda (u1: T).(\lambda (_: T).(pc3 c0 (lift +(S n) O u1) t2)))) (\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(getl n +c0 (CHead e (Bind Abst) u1))))) (\lambda (e: C).(\lambda (u1: T).(\lambda +(t0: T).(ty3 g e u1 t0))))) (pc3 c0 (lift (S n) O u0) t2) (\lambda (H4: +(ex3_3 C T T (\lambda (_: C).(\lambda (_: T).(\lambda (t0: T).(pc3 c0 (lift +(S n) O t0) t2)))) (\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(getl n +c0 (CHead e (Bind Abbr) u1))))) (\lambda (e: C).(\lambda (u1: T).(\lambda +(t0: T).(ty3 g e u1 t0)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (_: +T).(\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t2)))) (\lambda (e: C).(\lambda +(u1: T).(\lambda (_: T).(getl n c0 (CHead e (Bind Abbr) u1))))) (\lambda (e: +C).(\lambda (u1: T).(\lambda (t0: T).(ty3 g e u1 t0)))) (pc3 c0 (lift (S n) O +u0) t2) (\lambda (x0: C).(\lambda (x1: T).(\lambda (x2: T).(\lambda (_: (pc3 +c0 (lift (S n) O x2) t2)).(\lambda (H6: (getl n c0 (CHead x0 (Bind Abbr) +x1))).(\lambda (_: (ty3 g x0 x1 x2)).(let H8 \def (eq_ind C (CHead d (Bind +Abst) u0) (\lambda (c1: C).(getl n c0 c1)) H0 (CHead x0 (Bind Abbr) x1) +(getl_mono c0 (CHead d (Bind Abst) u0) n H0 (CHead x0 (Bind Abbr) x1) H6)) in +(let H9 \def (eq_ind C (CHead d (Bind Abst) u0) (\lambda (ee: C).(match ee in +C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k +_) \Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead x0 (Bind Abbr) x1) (getl_mono c0 (CHead d +(Bind Abst) u0) n H0 (CHead x0 (Bind Abbr) x1) H6)) in (False_ind (pc3 c0 +(lift (S n) O u0) t2) H9))))))))) H4)) (\lambda (H4: (ex3_3 C T T (\lambda +(_: C).(\lambda (u1: T).(\lambda (_: T).(pc3 c0 (lift (S n) O u1) t2)))) +(\lambda (e: C).(\lambda (u1: T).(\lambda (_: T).(getl n c0 (CHead e (Bind +Abst) u1))))) (\lambda (e: C).(\lambda (u1: T).(\lambda (t0: T).(ty3 g e u1 +t0)))))).(ex3_3_ind C T T (\lambda (_: C).(\lambda (u1: T).(\lambda (_: +T).(pc3 c0 (lift (S n) O u1) t2)))) (\lambda (e: C).(\lambda (u1: T).(\lambda +(_: T).(getl n c0 (CHead e (Bind Abst) u1))))) (\lambda (e: C).(\lambda (u1: +T).(\lambda (t0: T).(ty3 g e u1 t0)))) (pc3 c0 (lift (S n) O u0) t2) (\lambda +(x0: C).(\lambda (x1: T).(\lambda (x2: T).(\lambda (H5: (pc3 c0 (lift (S n) O +x1) t2)).(\lambda (H6: (getl n c0 (CHead x0 (Bind Abst) x1))).(\lambda (H7: +(ty3 g x0 x1 x2)).(let H8 \def (eq_ind C (CHead d (Bind Abst) u0) (\lambda +(c1: C).(getl n c0 c1)) H0 (CHead x0 (Bind Abst) x1) (getl_mono c0 (CHead d +(Bind Abst) u0) n H0 (CHead x0 (Bind Abst) x1) H6)) in (let H9 \def (f_equal +C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow d | (CHead c1 _ _) \Rightarrow c1])) (CHead d (Bind Abst) u0) +(CHead x0 (Bind Abst) x1) (getl_mono c0 (CHead d (Bind Abst) u0) n H0 (CHead +x0 (Bind Abst) x1) H6)) in ((let H10 \def (f_equal C T (\lambda (e: C).(match +e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | (CHead _ _ +t0) \Rightarrow t0])) (CHead d (Bind Abst) u0) (CHead x0 (Bind Abst) x1) +(getl_mono c0 (CHead d (Bind Abst) u0) n H0 (CHead x0 (Bind Abst) x1) H6)) in +(\lambda (H11: (eq C d x0)).(let H12 \def (eq_ind_r T x1 (\lambda (t0: +T).(getl n c0 (CHead x0 (Bind Abst) t0))) H8 u0 H10) in (let H13 \def +(eq_ind_r T x1 (\lambda (t0: T).(ty3 g x0 t0 x2)) H7 u0 H10) in (let H14 \def +(eq_ind_r T x1 (\lambda (t0: T).(pc3 c0 (lift (S n) O t0) t2)) H5 u0 H10) in +(let H15 \def (eq_ind_r C x0 (\lambda (c1: C).(getl n c0 (CHead c1 (Bind +Abst) u0))) H12 d H11) in (let H16 \def (eq_ind_r C x0 (\lambda (c1: C).(ty3 +g c1 u0 x2)) H13 d H11) in H14))))))) H9))))))))) H4)) (ty3_gen_lref g c0 t2 +n H3)))))))))))) (\lambda (c0: C).(\lambda (u0: T).(\lambda (t: T).(\lambda +(_: (ty3 g c0 u0 t)).(\lambda (_: ((\forall (t2: T).((ty3 g c0 u0 t2) \to +(pc3 c0 t t2))))).(\lambda (b: B).(\lambda (t0: T).(\lambda (t2: T).(\lambda +(_: (ty3 g (CHead c0 (Bind b) u0) t0 t2)).(\lambda (H3: ((\forall (t3: +T).((ty3 g (CHead c0 (Bind b) u0) t0 t3) \to (pc3 (CHead c0 (Bind b) u0) t2 +t3))))).(\lambda (t3: T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u0) t2 +t3)).(\lambda (_: ((\forall (t4: T).((ty3 g (CHead c0 (Bind b) u0) t2 t4) \to +(pc3 (CHead c0 (Bind b) u0) t3 t4))))).(\lambda (t4: T).(\lambda (H6: (ty3 g +c0 (THead (Bind b) u0 t0) t4)).(ex4_3_ind T T T (\lambda (t5: T).(\lambda (_: +T).(\lambda (_: T).(pc3 c0 (THead (Bind b) u0 t5) t4)))) (\lambda (_: +T).(\lambda (t6: T).(\lambda (_: T).(ty3 g c0 u0 t6)))) (\lambda (t5: +T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 (Bind b) u0) t0 t5)))) +(\lambda (t5: T).(\lambda (_: T).(\lambda (t7: T).(ty3 g (CHead c0 (Bind b) +u0) t5 t7)))) (pc3 c0 (THead (Bind b) u0 t2) t4) (\lambda (x0: T).(\lambda +(x1: T).(\lambda (x2: T).(\lambda (H7: (pc3 c0 (THead (Bind b) u0 x0) +t4)).(\lambda (_: (ty3 g c0 u0 x1)).(\lambda (H9: (ty3 g (CHead c0 (Bind b) +u0) t0 x0)).(\lambda (_: (ty3 g (CHead c0 (Bind b) u0) x0 x2)).(pc3_t (THead +(Bind b) u0 x0) c0 (THead (Bind b) u0 t2) (pc3_head_2 c0 u0 t2 x0 (Bind b) +(H3 x0 H9)) t4 H7)))))))) (ty3_gen_bind g b c0 u0 t0 t4 H6))))))))))))))))) +(\lambda (c0: C).(\lambda (w: T).(\lambda (u0: T).(\lambda (_: (ty3 g c0 w +u0)).(\lambda (_: ((\forall (t2: T).((ty3 g c0 w t2) \to (pc3 c0 u0 +t2))))).(\lambda (v: T).(\lambda (t: T).(\lambda (_: (ty3 g c0 v (THead (Bind +Abst) u0 t))).(\lambda (H3: ((\forall (t2: T).((ty3 g c0 v t2) \to (pc3 c0 +(THead (Bind Abst) u0 t) t2))))).(\lambda (t2: T).(\lambda (H4: (ty3 g c0 +(THead (Flat Appl) w v) t2)).(ex3_2_ind T T (\lambda (u1: T).(\lambda (t0: +T).(pc3 c0 (THead (Flat Appl) w (THead (Bind Abst) u1 t0)) t2))) (\lambda +(u1: T).(\lambda (t0: T).(ty3 g c0 v (THead (Bind Abst) u1 t0)))) (\lambda +(u1: T).(\lambda (_: T).(ty3 g c0 w u1))) (pc3 c0 (THead (Flat Appl) w (THead +(Bind Abst) u0 t)) t2) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H5: (pc3 +c0 (THead (Flat Appl) w (THead (Bind Abst) x0 x1)) t2)).(\lambda (H6: (ty3 g +c0 v (THead (Bind Abst) x0 x1))).(\lambda (_: (ty3 g c0 w x0)).(pc3_t (THead +(Flat Appl) w (THead (Bind Abst) x0 x1)) c0 (THead (Flat Appl) w (THead (Bind +Abst) u0 t)) (pc3_thin_dx c0 (THead (Bind Abst) u0 t) (THead (Bind Abst) x0 +x1) (H3 (THead (Bind Abst) x0 x1) H6) w Appl) t2 H5)))))) (ty3_gen_appl g c0 +w v t2 H4))))))))))))) (\lambda (c0: C).(\lambda (t0: T).(\lambda (t2: +T).(\lambda (_: (ty3 g c0 t0 t2)).(\lambda (_: ((\forall (t3: T).((ty3 g c0 +t0 t3) \to (pc3 c0 t2 t3))))).(\lambda (t3: T).(\lambda (_: (ty3 g c0 t2 +t3)).(\lambda (H3: ((\forall (t4: T).((ty3 g c0 t2 t4) \to (pc3 c0 t3 +t4))))).(\lambda (t4: T).(\lambda (H4: (ty3 g c0 (THead (Flat Cast) t2 t0) +t4)).(ex3_ind T (\lambda (t5: T).(pc3 c0 (THead (Flat Cast) t5 t2) t4)) +(\lambda (_: T).(ty3 g c0 t0 t2)) (\lambda (t5: T).(ty3 g c0 t2 t5)) (pc3 c0 +(THead (Flat Cast) t3 t2) t4) (\lambda (x0: T).(\lambda (H5: (pc3 c0 (THead +(Flat Cast) x0 t2) t4)).(\lambda (_: (ty3 g c0 t0 t2)).(\lambda (H7: (ty3 g +c0 t2 x0)).(pc3_t (THead (Flat Cast) x0 t2) c0 (THead (Flat Cast) t3 t2) +(pc3_head_1 c0 t3 x0 (H3 x0 H7) (Flat Cast) t2) t4 H5))))) (ty3_gen_cast g c0 +t0 t2 t4 H4)))))))))))) c u t1 H))))). + +theorem ty3_gen_abst_abst: + \forall (g: G).(\forall (c: C).(\forall (u: T).(\forall (t1: T).(\forall +(t2: T).((ty3 g c (THead (Bind Abst) u t1) (THead (Bind Abst) u t2)) \to (ex2 +T (\lambda (w: T).(ty3 g c u w)) (\lambda (_: T).(ty3 g (CHead c (Bind Abst) +u) t1 t2)))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u: T).(\lambda (t1: T).(\lambda +(t2: T).(\lambda (H: (ty3 g c (THead (Bind Abst) u t1) (THead (Bind Abst) u +t2))).(ex_ind T (\lambda (t: T).(ty3 g c (THead (Bind Abst) u t2) t)) (ex2 T +(\lambda (w: T).(ty3 g c u w)) (\lambda (_: T).(ty3 g (CHead c (Bind Abst) u) +t1 t2))) (\lambda (x: T).(\lambda (H0: (ty3 g c (THead (Bind Abst) u t2) +x)).(ex4_3_ind T T T (\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(pc3 c +(THead (Bind Abst) u t3) x)))) (\lambda (_: T).(\lambda (t: T).(\lambda (_: +T).(ty3 g c u t)))) (\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(ty3 g +(CHead c (Bind Abst) u) t2 t3)))) (\lambda (t3: T).(\lambda (_: T).(\lambda +(t0: T).(ty3 g (CHead c (Bind Abst) u) t3 t0)))) (ex2 T (\lambda (w: T).(ty3 +g c u w)) (\lambda (_: T).(ty3 g (CHead c (Bind Abst) u) t1 t2))) (\lambda +(x0: T).(\lambda (x1: T).(\lambda (x2: T).(\lambda (_: (pc3 c (THead (Bind +Abst) u x0) x)).(\lambda (H2: (ty3 g c u x1)).(\lambda (H3: (ty3 g (CHead c +(Bind Abst) u) t2 x0)).(\lambda (_: (ty3 g (CHead c (Bind Abst) u) x0 +x2)).(ex4_3_ind T T T (\lambda (t3: T).(\lambda (_: T).(\lambda (_: T).(pc3 c +(THead (Bind Abst) u t3) (THead (Bind Abst) u t2))))) (\lambda (_: +T).(\lambda (t: T).(\lambda (_: T).(ty3 g c u t)))) (\lambda (t3: T).(\lambda +(_: T).(\lambda (_: T).(ty3 g (CHead c (Bind Abst) u) t1 t3)))) (\lambda (t3: +T).(\lambda (_: T).(\lambda (t0: T).(ty3 g (CHead c (Bind Abst) u) t3 t0)))) +(ex2 T (\lambda (w: T).(ty3 g c u w)) (\lambda (_: T).(ty3 g (CHead c (Bind +Abst) u) t1 t2))) (\lambda (x3: T).(\lambda (x4: T).(\lambda (x5: T).(\lambda +(H5: (pc3 c (THead (Bind Abst) u x3) (THead (Bind Abst) u t2))).(\lambda (_: +(ty3 g c u x4)).(\lambda (H7: (ty3 g (CHead c (Bind Abst) u) t1 x3)).(\lambda +(_: (ty3 g (CHead c (Bind Abst) u) x3 x5)).(let H_y \def (pc3_gen_abst_shift +c u x3 t2 H5) in (ex_intro2 T (\lambda (w: T).(ty3 g c u w)) (\lambda (_: +T).(ty3 g (CHead c (Bind Abst) u) t1 t2)) x1 H2 (ty3_conv g (CHead c (Bind +Abst) u) t2 x0 H3 t1 x3 H7 H_y)))))))))) (ty3_gen_bind g Abst c u t1 (THead +(Bind Abst) u t2) H))))))))) (ty3_gen_bind g Abst c u t2 x H0)))) +(ty3_correct g c (THead (Bind Abst) u t1) (THead (Bind Abst) u t2) H))))))). + +theorem ty3_typecheck: + \forall (g: G).(\forall (c: C).(\forall (t: T).(\forall (v: T).((ty3 g c t +v) \to (ex T (\lambda (u: T).(ty3 g c (THead (Flat Cast) v t) u))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t: T).(\lambda (v: T).(\lambda (H: +(ty3 g c t v)).(ex_ind T (\lambda (t0: T).(ty3 g c v t0)) (ex T (\lambda (u: +T).(ty3 g c (THead (Flat Cast) v t) u))) (\lambda (x: T).(\lambda (H0: (ty3 g +c v x)).(ex_intro T (\lambda (u: T).(ty3 g c (THead (Flat Cast) v t) u)) +(THead (Flat Cast) x v) (ty3_cast g c t v H x H0)))) (ty3_correct g c t v +H)))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/subst1.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/subst1.ma new file mode 100644 index 000000000..60e08dbe1 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/subst1.ma @@ -0,0 +1,1167 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/subst1". + +include "ty3/props.ma". + +include "pc3/subst1.ma". + +include "pc3/fwd.ma". + +include "csubst1/getl.ma". + +include "csubst1/fwd.ma". + +include "getl/getl.ma". + +theorem ty3_gen_cabbr: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t2: T).((ty3 g c +t1 t2) \to (\forall (e: C).(\forall (u: T).(\forall (d: nat).((getl d c +(CHead e (Bind Abbr) u)) \to (\forall (a0: C).((csubst1 d u c a0) \to +(\forall (a: C).((drop (S O) d a0 a) \to (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d u t1 (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 d u t2 (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 +g a y1 y2)))))))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (ty3 g c t1 t2)).(ty3_ind g (\lambda (c0: C).(\lambda (t: T).(\lambda +(t0: T).(\forall (e: C).(\forall (u: T).(\forall (d: nat).((getl d c0 (CHead +e (Bind Abbr) u)) \to (\forall (a0: C).((csubst1 d u c0 a0) \to (\forall (a: +C).((drop (S O) d a0 a) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(subst1 d u t (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 d u t0 (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 +g a y1 y2))))))))))))))) (\lambda (c0: C).(\lambda (t3: T).(\lambda (t: +T).(\lambda (_: (ty3 g c0 t3 t)).(\lambda (H1: ((\forall (e: C).(\forall (u: +T).(\forall (d: nat).((getl d c0 (CHead e (Bind Abbr) u)) \to (\forall (a0: +C).((csubst1 d u c0 a0) \to (\forall (a: C).((drop (S O) d a0 a) \to (ex3_2 T +T (\lambda (y1: T).(\lambda (_: T).(subst1 d u t3 (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(subst1 d u t (lift (S O) d y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))))).(\lambda (u: +T).(\lambda (t4: T).(\lambda (_: (ty3 g c0 u t4)).(\lambda (H3: ((\forall (e: +C).(\forall (u0: T).(\forall (d: nat).((getl d c0 (CHead e (Bind Abbr) u0)) +\to (\forall (a0: C).((csubst1 d u0 c0 a0) \to (\forall (a: C).((drop (S O) d +a0 a) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 u (lift (S +O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 t4 (lift (S O) d +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2)))))))))))))).(\lambda (H4: (pc3 c0 t4 t3)).(\lambda (e: C).(\lambda (u0: +T).(\lambda (d: nat).(\lambda (H5: (getl d c0 (CHead e (Bind Abbr) +u0))).(\lambda (a0: C).(\lambda (H6: (csubst1 d u0 c0 a0)).(\lambda (a: +C).(\lambda (H7: (drop (S O) d a0 a)).(let H8 \def (H3 e u0 d H5 a0 H6 a H7) +in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 u (lift (S O) +d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 t4 (lift (S O) d +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(subst1 d u0 u (lift (S O) d y1)))) (\lambda +(_: T).(\lambda (y2: T).(subst1 d u0 t3 (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H9: (subst1 d u0 u (lift (S O) d x0))).(\lambda (H10: (subst1 d +u0 t4 (lift (S O) d x1))).(\lambda (H11: (ty3 g a x0 x1)).(let H12 \def (H1 e +u0 d H5 a0 H6 a H7) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: +T).(subst1 d u0 t3 (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 d u0 t (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 +g a y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 u (lift +(S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 t3 (lift (S O) d +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x2: +T).(\lambda (x3: T).(\lambda (H13: (subst1 d u0 t3 (lift (S O) d +x2))).(\lambda (_: (subst1 d u0 t (lift (S O) d x3))).(\lambda (H15: (ty3 g a +x2 x3)).(ex3_2_intro T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 u +(lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 t3 (lift +(S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) x0 x2 H9 +H13 (ty3_conv g a x2 x3 H15 x0 x1 H11 (pc3_gen_cabbr c0 t4 t3 H4 e u0 d H5 a0 +H6 a H7 x1 H10 x2 H13)))))))) H12))))))) H8)))))))))))))))))))) (\lambda (c0: +C).(\lambda (m: nat).(\lambda (e: C).(\lambda (u: T).(\lambda (d: +nat).(\lambda (_: (getl d c0 (CHead e (Bind Abbr) u))).(\lambda (a0: +C).(\lambda (_: (csubst1 d u c0 a0)).(\lambda (a: C).(\lambda (_: (drop (S O) +d a0 a)).(ex3_2_intro T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u (TSort +m) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u (TSort +(next g m)) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a +y1 y2))) (TSort m) (TSort (next g m)) (eq_ind_r T (TSort m) (\lambda (t: +T).(subst1 d u (TSort m) t)) (subst1_refl d u (TSort m)) (lift (S O) d (TSort +m)) (lift_sort m (S O) d)) (eq_ind_r T (TSort (next g m)) (\lambda (t: +T).(subst1 d u (TSort (next g m)) t)) (subst1_refl d u (TSort (next g m))) +(lift (S O) d (TSort (next g m))) (lift_sort (next g m) (S O) d)) (ty3_sort g +a m)))))))))))) (\lambda (n: nat).(\lambda (c0: C).(\lambda (d: C).(\lambda +(u: T).(\lambda (H0: (getl n c0 (CHead d (Bind Abbr) u))).(\lambda (t: +T).(\lambda (H1: (ty3 g d u t)).(\lambda (H2: ((\forall (e: C).(\forall (u0: +T).(\forall (d0: nat).((getl d0 d (CHead e (Bind Abbr) u0)) \to (\forall (a0: +C).((csubst1 d0 u0 d a0) \to (\forall (a: C).((drop (S O) d0 a0 a) \to (ex3_2 +T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 u (lift (S O) d0 y1)))) +(\lambda (_: T).(\lambda (y2: T).(subst1 d0 u0 t (lift (S O) d0 y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))))).(\lambda (e: +C).(\lambda (u0: T).(\lambda (d0: nat).(\lambda (H3: (getl d0 c0 (CHead e +(Bind Abbr) u0))).(\lambda (a0: C).(\lambda (H4: (csubst1 d0 u0 c0 +a0)).(\lambda (a: C).(\lambda (H5: (drop (S O) d0 a0 a)).(lt_eq_gt_e n d0 +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 (TLRef n) (lift (S +O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d0 u0 (lift (S n) O t) +(lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) +(\lambda (H6: (lt n d0)).(let H7 \def (eq_ind nat (minus d0 n) (\lambda (n0: +nat).(getl n0 (CHead d (Bind Abbr) u) (CHead e (Bind Abbr) u0))) +(getl_conf_le d0 (CHead e (Bind Abbr) u0) c0 H3 (CHead d (Bind Abbr) u) n H0 +(le_S_n n d0 (le_S (S n) d0 H6))) (S (minus d0 (S n))) (minus_x_Sy d0 n H6)) +in (ex2_ind C (\lambda (e2: C).(csubst1 (minus d0 n) u0 (CHead d (Bind Abbr) +u) e2)) (\lambda (e2: C).(getl n a0 e2)) (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(subst1 d0 u0 (lift (S n) O t) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x: C).(\lambda (H8: (csubst1 +(minus d0 n) u0 (CHead d (Bind Abbr) u) x)).(\lambda (H9: (getl n a0 x)).(let +H10 \def (eq_ind nat (minus d0 n) (\lambda (n0: nat).(csubst1 n0 u0 (CHead d +(Bind Abbr) u) x)) H8 (S (minus d0 (S n))) (minus_x_Sy d0 n H6)) in (let H11 +\def (csubst1_gen_head (Bind Abbr) d x u u0 (minus d0 (S n)) H10) in +(ex3_2_ind T C (\lambda (u2: T).(\lambda (c2: C).(eq C x (CHead c2 (Bind +Abbr) u2)))) (\lambda (u2: T).(\lambda (_: C).(subst1 (minus d0 (S n)) u0 u +u2))) (\lambda (_: T).(\lambda (c2: C).(csubst1 (minus d0 (S n)) u0 d c2))) +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 (TLRef n) (lift (S +O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d0 u0 (lift (S n) O t) +(lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) +(\lambda (x0: T).(\lambda (x1: C).(\lambda (H12: (eq C x (CHead x1 (Bind +Abbr) x0))).(\lambda (H13: (subst1 (minus d0 (S n)) u0 u x0)).(\lambda (H14: +(csubst1 (minus d0 (S n)) u0 d x1)).(let H15 \def (eq_ind C x (\lambda (c1: +C).(getl n a0 c1)) H9 (CHead x1 (Bind Abbr) x0) H12) in (let H16 \def (eq_ind +nat d0 (\lambda (n0: nat).(drop (S O) n0 a0 a)) H5 (S (plus n (minus d0 (S +n)))) (lt_plus_minus n d0 H6)) in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: +C).(eq T x0 (lift (S O) (minus d0 (S n)) v)))) (\lambda (v: T).(\lambda (e0: +C).(getl n a (CHead e0 (Bind Abbr) v)))) (\lambda (_: T).(\lambda (e0: +C).(drop (S O) (minus d0 (S n)) x1 e0))) (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(subst1 d0 u0 (lift (S n) O t) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x2: T).(\lambda (x3: +C).(\lambda (H17: (eq T x0 (lift (S O) (minus d0 (S n)) x2))).(\lambda (H18: +(getl n a (CHead x3 (Bind Abbr) x2))).(\lambda (H19: (drop (S O) (minus d0 (S +n)) x1 x3)).(let H20 \def (eq_ind T x0 (\lambda (t0: T).(subst1 (minus d0 (S +n)) u0 u t0)) H13 (lift (S O) (minus d0 (S n)) x2) H17) in (let H21 \def (H2 +e u0 (minus d0 (S n)) (getl_gen_S (Bind Abbr) d (CHead e (Bind Abbr) u0) u +(minus d0 (S n)) H7) x1 H14 x3 H19) in (ex3_2_ind T T (\lambda (y1: +T).(\lambda (_: T).(subst1 (minus d0 (S n)) u0 u (lift (S O) (minus d0 (S n)) +y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 (minus d0 (S n)) u0 t (lift +(S O) (minus d0 (S n)) y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g x3 y1 +y2))) (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 (TLRef n) +(lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d0 u0 (lift (S +n) O t) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2)))) (\lambda (x4: T).(\lambda (x5: T).(\lambda (H22: (subst1 (minus d0 (S +n)) u0 u (lift (S O) (minus d0 (S n)) x4))).(\lambda (H23: (subst1 (minus d0 +(S n)) u0 t (lift (S O) (minus d0 (S n)) x5))).(\lambda (H24: (ty3 g x3 x4 +x5)).(let H25 \def (eq_ind T x4 (\lambda (t0: T).(ty3 g x3 t0 x5)) H24 x2 +(subst1_confluence_lift u x4 u0 (minus d0 (S n)) H22 x2 H20)) in (eq_ind_r +nat (plus (minus d0 (S n)) (S n)) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: +T).(\lambda (y2: T).(subst1 n0 u0 (lift (S n) O t) (lift (S O) d0 y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind_r nat (plus (S +n) (minus d0 (S n))) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(subst1 (plus (minus d0 (S n)) (S n)) u0 (lift (S n) O t) (lift (S O) +n0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (ex3_2_intro +T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 +y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 (plus (minus d0 (S n)) (S n)) +u0 (lift (S n) O t) (lift (S O) (plus (S n) (minus d0 (S n))) y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (TLRef n) (lift (S n) O x5) +(eq_ind_r T (TLRef n) (\lambda (t0: T).(subst1 d0 u0 (TLRef n) t0)) +(subst1_refl d0 u0 (TLRef n)) (lift (S O) d0 (TLRef n)) (lift_lref_lt n (S O) +d0 H6)) (eq_ind_r T (lift (S n) O (lift (S O) (minus d0 (S n)) x5)) (\lambda +(t0: T).(subst1 (plus (minus d0 (S n)) (S n)) u0 (lift (S n) O t) t0)) +(subst1_lift_ge t (lift (S O) (minus d0 (S n)) x5) u0 (minus d0 (S n)) (S n) +H23 O (le_O_n (minus d0 (S n)))) (lift (S O) (plus (S n) (minus d0 (S n))) +(lift (S n) O x5)) (lift_d x5 (S O) (S n) (minus d0 (S n)) O (le_O_n (minus +d0 (S n))))) (ty3_abbr g n a x3 x2 H18 x5 H25)) d0 (le_plus_minus (S n) d0 +H6)) d0 (le_plus_minus_sym (S n) d0 H6)))))))) H21)))))))) (getl_drop_conf_lt +Abbr a0 x1 x0 n H15 a (S O) (minus d0 (S n)) H16))))))))) H11)))))) +(csubst1_getl_lt d0 n H6 c0 a0 u0 H4 (CHead d (Bind Abbr) u) H0)))) (\lambda +(H6: (eq nat n d0)).(let H7 \def (eq_ind_r nat d0 (\lambda (n0: nat).(drop (S +O) n0 a0 a)) H5 n H6) in (let H8 \def (eq_ind_r nat d0 (\lambda (n0: +nat).(csubst1 n0 u0 c0 a0)) H4 n H6) in (let H9 \def (eq_ind_r nat d0 +(\lambda (n0: nat).(getl n0 c0 (CHead e (Bind Abbr) u0))) H3 n H6) in (eq_ind +nat n (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 +n0 u0 (TLRef n) (lift (S O) n0 y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 n0 u0 (lift (S n) O t) (lift (S O) n0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H10 \def (eq_ind C (CHead d +(Bind Abbr) u) (\lambda (c1: C).(getl n c0 c1)) H0 (CHead e (Bind Abbr) u0) +(getl_mono c0 (CHead d (Bind Abbr) u) n H0 (CHead e (Bind Abbr) u0) H9)) in +(let H11 \def (f_equal C C (\lambda (e0: C).(match e0 in C return (\lambda +(_: C).C) with [(CSort _) \Rightarrow d | (CHead c1 _ _) \Rightarrow c1])) +(CHead d (Bind Abbr) u) (CHead e (Bind Abbr) u0) (getl_mono c0 (CHead d (Bind +Abbr) u) n H0 (CHead e (Bind Abbr) u0) H9)) in ((let H12 \def (f_equal C T +(\lambda (e0: C).(match e0 in C return (\lambda (_: C).T) with [(CSort _) +\Rightarrow u | (CHead _ _ t0) \Rightarrow t0])) (CHead d (Bind Abbr) u) +(CHead e (Bind Abbr) u0) (getl_mono c0 (CHead d (Bind Abbr) u) n H0 (CHead e +(Bind Abbr) u0) H9)) in (\lambda (H13: (eq C d e)).(let H14 \def (eq_ind_r T +u0 (\lambda (t0: T).(getl n c0 (CHead e (Bind Abbr) t0))) H10 u H12) in (let +H15 \def (eq_ind_r T u0 (\lambda (t0: T).(csubst1 n t0 c0 a0)) H8 u H12) in +(eq_ind T u (\lambda (t0: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(subst1 n t0 (TLRef n) (lift (S O) n y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 n t0 (lift (S n) O t) (lift (S O) n y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H16 \def (eq_ind_r C e (\lambda +(c1: C).(getl n c0 (CHead c1 (Bind Abbr) u))) H14 d H13) in (ex3_2_intro T T +(\lambda (y1: T).(\lambda (_: T).(subst1 n u (TLRef n) (lift (S O) n y1)))) +(\lambda (_: T).(\lambda (y2: T).(subst1 n u (lift (S n) O t) (lift (S O) n +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (lift n O u) (lift +n O t) (subst1_single n u (TLRef n) (lift (S O) n (lift n O u)) (eq_ind_r T +(lift (plus (S O) n) O u) (\lambda (t0: T).(subst0 n u (TLRef n) t0)) +(subst0_lref u n) (lift (S O) n (lift n O u)) (lift_free u n (S O) O n (le_n +(plus O n)) (le_O_n n)))) (eq_ind_r T (lift (plus (S O) n) O t) (\lambda (t0: +T).(subst1 n u (lift (S n) O t) t0)) (subst1_refl n u (lift (S n) O t)) (lift +(S O) n (lift n O t)) (lift_free t n (S O) O n (le_n (plus O n)) (le_O_n n))) +(ty3_lift g d u t H1 a O n (getl_conf_ge_drop Abbr a0 d u n (csubst1_getl_ge +n n (le_n n) c0 a0 u H15 (CHead d (Bind Abbr) u) H16) a H7)))) u0 H12))))) +H11))) d0 H6))))) (\lambda (H6: (lt d0 n)).(eq_ind_r nat (S (plus O (minus n +(S O)))) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(subst1 d0 u0 (TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(subst1 d0 u0 (lift (S n) O t) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind nat (plus (S O) (minus n (S +O))) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 +d0 u0 (TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 d0 u0 (lift (S n) O t) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind_r nat (plus (minus n (S O)) +(S O)) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 +d0 u0 (TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 d0 u0 (lift (S n) O t) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (ex3_2_intro T T (\lambda (y1: +T).(\lambda (_: T).(subst1 d0 u0 (TLRef (plus (minus n (S O)) (S O))) (lift +(S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d0 u0 (lift (S n) O +t) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) +(TLRef (minus n (S O))) (lift n O t) (eq_ind_r T (TLRef (plus (minus n (S O)) +(S O))) (\lambda (t0: T).(subst1 d0 u0 (TLRef (plus (minus n (S O)) (S O))) +t0)) (subst1_refl d0 u0 (TLRef (plus (minus n (S O)) (S O)))) (lift (S O) d0 +(TLRef (minus n (S O)))) (lift_lref_ge (minus n (S O)) (S O) d0 (lt_le_minus +d0 n H6))) (eq_ind_r T (lift (plus (S O) n) O t) (\lambda (t0: T).(subst1 d0 +u0 (lift (S n) O t) t0)) (subst1_refl d0 u0 (lift (S n) O t)) (lift (S O) d0 +(lift n O t)) (lift_free t n (S O) O d0 (le_S_n d0 (plus O n) (le_S (S d0) +(plus O n) H6)) (le_O_n d0))) (eq_ind_r nat (S (minus n (S O))) (\lambda (n0: +nat).(ty3 g a (TLRef (minus n (S O))) (lift n0 O t))) (ty3_abbr g (minus n (S +O)) a d u (getl_drop_conf_ge n (CHead d (Bind Abbr) u) a0 (csubst1_getl_ge d0 +n (le_S_n d0 n (le_S (S d0) n H6)) c0 a0 u0 H4 (CHead d (Bind Abbr) u) H0) a +(S O) d0 H5 (eq_ind_r nat (plus (S O) d0) (\lambda (n0: nat).(le n0 n)) H6 +(plus d0 (S O)) (plus_comm d0 (S O)))) t H1) n (minus_x_SO n (le_lt_trans O +d0 n (le_O_n d0) H6)))) (plus (S O) (minus n (S O))) (plus_comm (S O) (minus +n (S O)))) (S (plus O (minus n (S O)))) (refl_equal nat (S (plus O (minus n +(S O)))))) n (lt_plus_minus O n (le_lt_trans O d0 n (le_O_n d0) +H6))))))))))))))))))))) (\lambda (n: nat).(\lambda (c0: C).(\lambda (d: +C).(\lambda (u: T).(\lambda (H0: (getl n c0 (CHead d (Bind Abst) +u))).(\lambda (t: T).(\lambda (H1: (ty3 g d u t)).(\lambda (H2: ((\forall (e: +C).(\forall (u0: T).(\forall (d0: nat).((getl d0 d (CHead e (Bind Abbr) u0)) +\to (\forall (a0: C).((csubst1 d0 u0 d a0) \to (\forall (a: C).((drop (S O) +d0 a0 a) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 u +(lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d0 u0 t (lift +(S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2)))))))))))))).(\lambda (e: C).(\lambda (u0: T).(\lambda (d0: nat).(\lambda +(H3: (getl d0 c0 (CHead e (Bind Abbr) u0))).(\lambda (a0: C).(\lambda (H4: +(csubst1 d0 u0 c0 a0)).(\lambda (a: C).(\lambda (H5: (drop (S O) d0 a0 +a)).(lt_eq_gt_e n d0 (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 +u0 (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 +d0 u0 (lift (S n) O u) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: +T).(ty3 g a y1 y2)))) (\lambda (H6: (lt n d0)).(let H7 \def (eq_ind nat +(minus d0 n) (\lambda (n0: nat).(getl n0 (CHead d (Bind Abst) u) (CHead e +(Bind Abbr) u0))) (getl_conf_le d0 (CHead e (Bind Abbr) u0) c0 H3 (CHead d +(Bind Abst) u) n H0 (le_S_n n d0 (le_S (S n) d0 H6))) (S (minus d0 (S n))) +(minus_x_Sy d0 n H6)) in (ex2_ind C (\lambda (e2: C).(csubst1 (minus d0 n) u0 +(CHead d (Bind Abst) u) e2)) (\lambda (e2: C).(getl n a0 e2)) (ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 +y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d0 u0 (lift (S n) O u) (lift +(S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda +(x: C).(\lambda (H8: (csubst1 (minus d0 n) u0 (CHead d (Bind Abst) u) +x)).(\lambda (H9: (getl n a0 x)).(let H10 \def (eq_ind nat (minus d0 n) +(\lambda (n0: nat).(csubst1 n0 u0 (CHead d (Bind Abst) u) x)) H8 (S (minus d0 +(S n))) (minus_x_Sy d0 n H6)) in (let H11 \def (csubst1_gen_head (Bind Abst) +d x u u0 (minus d0 (S n)) H10) in (ex3_2_ind T C (\lambda (u2: T).(\lambda +(c2: C).(eq C x (CHead c2 (Bind Abst) u2)))) (\lambda (u2: T).(\lambda (_: +C).(subst1 (minus d0 (S n)) u0 u u2))) (\lambda (_: T).(\lambda (c2: +C).(csubst1 (minus d0 (S n)) u0 d c2))) (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(subst1 d0 u0 (lift (S n) O u) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x0: T).(\lambda (x1: +C).(\lambda (H12: (eq C x (CHead x1 (Bind Abst) x0))).(\lambda (H13: (subst1 +(minus d0 (S n)) u0 u x0)).(\lambda (H14: (csubst1 (minus d0 (S n)) u0 d +x1)).(let H15 \def (eq_ind C x (\lambda (c1: C).(getl n a0 c1)) H9 (CHead x1 +(Bind Abst) x0) H12) in (let H16 \def (eq_ind nat d0 (\lambda (n0: nat).(drop +(S O) n0 a0 a)) H5 (S (plus n (minus d0 (S n)))) (lt_plus_minus n d0 H6)) in +(ex3_2_ind T C (\lambda (v: T).(\lambda (_: C).(eq T x0 (lift (S O) (minus d0 +(S n)) v)))) (\lambda (v: T).(\lambda (e0: C).(getl n a (CHead e0 (Bind Abst) +v)))) (\lambda (_: T).(\lambda (e0: C).(drop (S O) (minus d0 (S n)) x1 e0))) +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 (TLRef n) (lift (S +O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d0 u0 (lift (S n) O u) +(lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) +(\lambda (x2: T).(\lambda (x3: C).(\lambda (H17: (eq T x0 (lift (S O) (minus +d0 (S n)) x2))).(\lambda (H18: (getl n a (CHead x3 (Bind Abst) x2))).(\lambda +(H19: (drop (S O) (minus d0 (S n)) x1 x3)).(let H20 \def (eq_ind T x0 +(\lambda (t0: T).(subst1 (minus d0 (S n)) u0 u t0)) H13 (lift (S O) (minus d0 +(S n)) x2) H17) in (let H21 \def (H2 e u0 (minus d0 (S n)) (getl_gen_S (Bind +Abst) d (CHead e (Bind Abbr) u0) u (minus d0 (S n)) H7) x1 H14 x3 H19) in +(ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(subst1 (minus d0 (S n)) u0 u +(lift (S O) (minus d0 (S n)) y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 +(minus d0 (S n)) u0 t (lift (S O) (minus d0 (S n)) y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g x3 y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(subst1 d0 u0 (lift (S n) O u) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x4: T).(\lambda (x5: +T).(\lambda (H22: (subst1 (minus d0 (S n)) u0 u (lift (S O) (minus d0 (S n)) +x4))).(\lambda (_: (subst1 (minus d0 (S n)) u0 t (lift (S O) (minus d0 (S n)) +x5))).(\lambda (H24: (ty3 g x3 x4 x5)).(let H25 \def (eq_ind T x4 (\lambda +(t0: T).(ty3 g x3 t0 x5)) H24 x2 (subst1_confluence_lift u x4 u0 (minus d0 (S +n)) H22 x2 H20)) in (eq_ind_r nat (plus (minus d0 (S n)) (S n)) (\lambda (n0: +nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 (TLRef n) +(lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 n0 u0 (lift (S +n) O u) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2))))) (eq_ind_r nat (plus (S n) (minus d0 (S n))) (\lambda (n0: nat).(ex3_2 +T T (\lambda (y1: T).(\lambda (_: T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 +y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 (plus (minus d0 (S n)) (S n)) +u0 (lift (S n) O u) (lift (S O) n0 y2)))) (\lambda (y1: T).(\lambda (y2: +T).(ty3 g a y1 y2))))) (ex3_2_intro T T (\lambda (y1: T).(\lambda (_: +T).(subst1 d0 u0 (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(subst1 (plus (minus d0 (S n)) (S n)) u0 (lift (S n) O u) (lift (S O) +(plus (S n) (minus d0 (S n))) y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g +a y1 y2))) (TLRef n) (lift (S n) O x2) (eq_ind_r T (TLRef n) (\lambda (t0: +T).(subst1 d0 u0 (TLRef n) t0)) (subst1_refl d0 u0 (TLRef n)) (lift (S O) d0 +(TLRef n)) (lift_lref_lt n (S O) d0 H6)) (eq_ind_r T (lift (S n) O (lift (S +O) (minus d0 (S n)) x2)) (\lambda (t0: T).(subst1 (plus (minus d0 (S n)) (S +n)) u0 (lift (S n) O u) t0)) (subst1_lift_ge u (lift (S O) (minus d0 (S n)) +x2) u0 (minus d0 (S n)) (S n) H20 O (le_O_n (minus d0 (S n)))) (lift (S O) +(plus (S n) (minus d0 (S n))) (lift (S n) O x2)) (lift_d x2 (S O) (S n) +(minus d0 (S n)) O (le_O_n (minus d0 (S n))))) (ty3_abst g n a x3 x2 H18 x5 +H25)) d0 (le_plus_minus (S n) d0 H6)) d0 (le_plus_minus_sym (S n) d0 +H6)))))))) H21)))))))) (getl_drop_conf_lt Abst a0 x1 x0 n H15 a (S O) (minus +d0 (S n)) H16))))))))) H11)))))) (csubst1_getl_lt d0 n H6 c0 a0 u0 H4 (CHead +d (Bind Abst) u) H0)))) (\lambda (H6: (eq nat n d0)).(let H7 \def (eq_ind_r +nat d0 (\lambda (n0: nat).(drop (S O) n0 a0 a)) H5 n H6) in (let H8 \def +(eq_ind_r nat d0 (\lambda (n0: nat).(csubst1 n0 u0 c0 a0)) H4 n H6) in (let +H9 \def (eq_ind_r nat d0 (\lambda (n0: nat).(getl n0 c0 (CHead e (Bind Abbr) +u0))) H3 n H6) in (eq_ind nat n (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(subst1 n0 u0 (TLRef n) (lift (S O) n0 y1)))) (\lambda (_: +T).(\lambda (y2: T).(subst1 n0 u0 (lift (S n) O u) (lift (S O) n0 y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H10 \def (eq_ind C +(CHead d (Bind Abst) u) (\lambda (c1: C).(getl n c0 c1)) H0 (CHead e (Bind +Abbr) u0) (getl_mono c0 (CHead d (Bind Abst) u) n H0 (CHead e (Bind Abbr) u0) +H9)) in (let H11 \def (eq_ind C (CHead d (Bind Abst) u) (\lambda (ee: +C).(match ee in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow +False | (CHead _ k _) \Rightarrow (match k in K return (\lambda (_: K).Prop) +with [(Bind b) \Rightarrow (match b in B return (\lambda (_: B).Prop) with +[Abbr \Rightarrow False | Abst \Rightarrow True | Void \Rightarrow False]) | +(Flat _) \Rightarrow False])])) I (CHead e (Bind Abbr) u0) (getl_mono c0 +(CHead d (Bind Abst) u) n H0 (CHead e (Bind Abbr) u0) H9)) in (False_ind +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 n u0 (TLRef n) (lift (S +O) n y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 n u0 (lift (S n) O u) +(lift (S O) n y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) +H11))) d0 H6))))) (\lambda (H6: (lt d0 n)).(eq_ind_r nat (S (plus O (minus n +(S O)))) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(subst1 d0 u0 (TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(subst1 d0 u0 (lift (S n) O u) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind nat (plus (S O) (minus n (S +O))) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 +d0 u0 (TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 d0 u0 (lift (S n) O u) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind_r nat (plus (minus n (S O)) +(S O)) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 +d0 u0 (TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 d0 u0 (lift (S n) O u) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (ex3_2_intro T T (\lambda (y1: +T).(\lambda (_: T).(subst1 d0 u0 (TLRef (plus (minus n (S O)) (S O))) (lift +(S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d0 u0 (lift (S n) O +u) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) +(TLRef (minus n (S O))) (lift n O u) (eq_ind_r T (TLRef (plus (minus n (S O)) +(S O))) (\lambda (t0: T).(subst1 d0 u0 (TLRef (plus (minus n (S O)) (S O))) +t0)) (subst1_refl d0 u0 (TLRef (plus (minus n (S O)) (S O)))) (lift (S O) d0 +(TLRef (minus n (S O)))) (lift_lref_ge (minus n (S O)) (S O) d0 (lt_le_minus +d0 n H6))) (eq_ind_r T (lift (plus (S O) n) O u) (\lambda (t0: T).(subst1 d0 +u0 (lift (S n) O u) t0)) (subst1_refl d0 u0 (lift (S n) O u)) (lift (S O) d0 +(lift n O u)) (lift_free u n (S O) O d0 (le_S_n d0 (plus O n) (le_S (S d0) +(plus O n) H6)) (le_O_n d0))) (eq_ind_r nat (S (minus n (S O))) (\lambda (n0: +nat).(ty3 g a (TLRef (minus n (S O))) (lift n0 O u))) (ty3_abst g (minus n (S +O)) a d u (getl_drop_conf_ge n (CHead d (Bind Abst) u) a0 (csubst1_getl_ge d0 +n (le_S_n d0 n (le_S (S d0) n H6)) c0 a0 u0 H4 (CHead d (Bind Abst) u) H0) a +(S O) d0 H5 (eq_ind_r nat (plus (S O) d0) (\lambda (n0: nat).(le n0 n)) H6 +(plus d0 (S O)) (plus_comm d0 (S O)))) t H1) n (minus_x_SO n (le_lt_trans O +d0 n (le_O_n d0) H6)))) (plus (S O) (minus n (S O))) (plus_comm (S O) (minus +n (S O)))) (S (plus O (minus n (S O)))) (refl_equal nat (S (plus O (minus n +(S O)))))) n (lt_plus_minus O n (le_lt_trans O d0 n (le_O_n d0) +H6))))))))))))))))))))) (\lambda (c0: C).(\lambda (u: T).(\lambda (t: +T).(\lambda (_: (ty3 g c0 u t)).(\lambda (H1: ((\forall (e: C).(\forall (u0: +T).(\forall (d: nat).((getl d c0 (CHead e (Bind Abbr) u0)) \to (\forall (a0: +C).((csubst1 d u0 c0 a0) \to (\forall (a: C).((drop (S O) d a0 a) \to (ex3_2 +T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 u (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(subst1 d u0 t (lift (S O) d y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))))).(\lambda (b: +B).(\lambda (t3: T).(\lambda (t4: T).(\lambda (_: (ty3 g (CHead c0 (Bind b) +u) t3 t4)).(\lambda (H3: ((\forall (e: C).(\forall (u0: T).(\forall (d: +nat).((getl d (CHead c0 (Bind b) u) (CHead e (Bind Abbr) u0)) \to (\forall +(a0: C).((csubst1 d u0 (CHead c0 (Bind b) u) a0) \to (\forall (a: C).((drop +(S O) d a0 a) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 t3 +(lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 t4 (lift +(S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2)))))))))))))).(\lambda (t0: T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u) +t4 t0)).(\lambda (H5: ((\forall (e: C).(\forall (u0: T).(\forall (d: +nat).((getl d (CHead c0 (Bind b) u) (CHead e (Bind Abbr) u0)) \to (\forall +(a0: C).((csubst1 d u0 (CHead c0 (Bind b) u) a0) \to (\forall (a: C).((drop +(S O) d a0 a) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 t4 +(lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 t0 (lift +(S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2)))))))))))))).(\lambda (e: C).(\lambda (u0: T).(\lambda (d: nat).(\lambda +(H6: (getl d c0 (CHead e (Bind Abbr) u0))).(\lambda (a0: C).(\lambda (H7: +(csubst1 d u0 c0 a0)).(\lambda (a: C).(\lambda (H8: (drop (S O) d a0 a)).(let +H9 \def (H1 e u0 d H6 a0 H7 a H8) in (ex3_2_ind T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d u0 u (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 d u0 t (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 +g a y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 (THead +(Bind b) u t3) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 +d u0 (THead (Bind b) u t4) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2)))) (\lambda (x0: T).(\lambda (x1: T).(\lambda (H10: +(subst1 d u0 u (lift (S O) d x0))).(\lambda (_: (subst1 d u0 t (lift (S O) d +x1))).(\lambda (H12: (ty3 g a x0 x1)).(let H13 \def (H5 e u0 (S d) (getl_head +(Bind b) d c0 (CHead e (Bind Abbr) u0) H6 u) (CHead a0 (Bind b) (lift (S O) d +x0)) (csubst1_bind b d u0 u (lift (S O) d x0) H10 c0 a0 H7) (CHead a (Bind b) +x0) (drop_skip_bind (S O) d a0 a H8 b x0)) in (ex3_2_ind T T (\lambda (y1: +T).(\lambda (_: T).(subst1 (S d) u0 t4 (lift (S O) (S d) y1)))) (\lambda (_: +T).(\lambda (y2: T).(subst1 (S d) u0 t0 (lift (S O) (S d) y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g (CHead a (Bind b) x0) y1 y2))) (ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(subst1 d u0 (THead (Bind b) u t3) (lift (S +O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 (THead (Bind b) u +t4) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) +(\lambda (x2: T).(\lambda (x3: T).(\lambda (H14: (subst1 (S d) u0 t4 (lift (S +O) (S d) x2))).(\lambda (_: (subst1 (S d) u0 t0 (lift (S O) (S d) +x3))).(\lambda (H16: (ty3 g (CHead a (Bind b) x0) x2 x3)).(let H17 \def (H3 e +u0 (S d) (getl_head (Bind b) d c0 (CHead e (Bind Abbr) u0) H6 u) (CHead a0 +(Bind b) (lift (S O) d x0)) (csubst1_bind b d u0 u (lift (S O) d x0) H10 c0 +a0 H7) (CHead a (Bind b) x0) (drop_skip_bind (S O) d a0 a H8 b x0)) in +(ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(subst1 (S d) u0 t3 (lift (S +O) (S d) y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 (S d) u0 t4 (lift (S +O) (S d) y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g (CHead a (Bind b) +x0) y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 (THead +(Bind b) u t3) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 +d u0 (THead (Bind b) u t4) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2)))) (\lambda (x4: T).(\lambda (x5: T).(\lambda (H18: +(subst1 (S d) u0 t3 (lift (S O) (S d) x4))).(\lambda (H19: (subst1 (S d) u0 +t4 (lift (S O) (S d) x5))).(\lambda (H20: (ty3 g (CHead a (Bind b) x0) x4 +x5)).(let H21 \def (eq_ind T x5 (\lambda (t5: T).(ty3 g (CHead a (Bind b) x0) +x4 t5)) H20 x2 (subst1_confluence_lift t4 x5 u0 (S d) H19 x2 H14)) in +(ex3_2_intro T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 (THead (Bind +b) u t3) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 +(THead (Bind b) u t4) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: +T).(ty3 g a y1 y2))) (THead (Bind b) x0 x4) (THead (Bind b) x0 x2) (eq_ind_r +T (THead (Bind b) (lift (S O) d x0) (lift (S O) (S d) x4)) (\lambda (t5: +T).(subst1 d u0 (THead (Bind b) u t3) t5)) (subst1_head u0 u (lift (S O) d +x0) d H10 (Bind b) t3 (lift (S O) (S d) x4) H18) (lift (S O) d (THead (Bind +b) x0 x4)) (lift_bind b x0 x4 (S O) d)) (eq_ind_r T (THead (Bind b) (lift (S +O) d x0) (lift (S O) (S d) x2)) (\lambda (t5: T).(subst1 d u0 (THead (Bind b) +u t4) t5)) (subst1_head u0 u (lift (S O) d x0) d H10 (Bind b) t4 (lift (S O) +(S d) x2) H14) (lift (S O) d (THead (Bind b) x0 x2)) (lift_bind b x0 x2 (S O) +d)) (ty3_bind g a x0 x1 H12 b x4 x2 H21 x3 H16)))))))) H17))))))) H13))))))) +H9))))))))))))))))))))))) (\lambda (c0: C).(\lambda (w: T).(\lambda (u: +T).(\lambda (_: (ty3 g c0 w u)).(\lambda (H1: ((\forall (e: C).(\forall (u0: +T).(\forall (d: nat).((getl d c0 (CHead e (Bind Abbr) u0)) \to (\forall (a0: +C).((csubst1 d u0 c0 a0) \to (\forall (a: C).((drop (S O) d a0 a) \to (ex3_2 +T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 w (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(subst1 d u0 u (lift (S O) d y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))))).(\lambda (v: +T).(\lambda (t: T).(\lambda (_: (ty3 g c0 v (THead (Bind Abst) u +t))).(\lambda (H3: ((\forall (e: C).(\forall (u0: T).(\forall (d: nat).((getl +d c0 (CHead e (Bind Abbr) u0)) \to (\forall (a0: C).((csubst1 d u0 c0 a0) \to +(\forall (a: C).((drop (S O) d a0 a) \to (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d u0 v (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: +T).(subst1 d u0 (THead (Bind Abst) u t) (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))))).(\lambda (e: C).(\lambda +(u0: T).(\lambda (d: nat).(\lambda (H4: (getl d c0 (CHead e (Bind Abbr) +u0))).(\lambda (a0: C).(\lambda (H5: (csubst1 d u0 c0 a0)).(\lambda (a: +C).(\lambda (H6: (drop (S O) d a0 a)).(let H7 \def (H3 e u0 d H4 a0 H5 a H6) +in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 v (lift (S O) +d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 (THead (Bind Abst) u +t) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 (THead (Flat Appl) w +v) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 (THead +(Flat Appl) w (THead (Bind Abst) u t)) (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H8: (subst1 d u0 v (lift (S O) d x0))).(\lambda (H9: (subst1 d +u0 (THead (Bind Abst) u t) (lift (S O) d x1))).(\lambda (H10: (ty3 g a x0 +x1)).(let H11 \def (H1 e u0 d H4 a0 H5 a H6) in (ex3_2_ind T T (\lambda (y1: +T).(\lambda (_: T).(subst1 d u0 w (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(subst1 d u0 u (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d u0 (THead (Flat Appl) w v) (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(subst1 d u0 (THead (Flat Appl) w (THead (Bind Abst) u +t)) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) +(\lambda (x2: T).(\lambda (x3: T).(\lambda (H12: (subst1 d u0 w (lift (S O) d +x2))).(\lambda (H13: (subst1 d u0 u (lift (S O) d x3))).(\lambda (H14: (ty3 g +a x2 x3)).(ex3_2_ind T T (\lambda (u2: T).(\lambda (t3: T).(eq T (lift (S O) +d x1) (THead (Bind Abst) u2 t3)))) (\lambda (u2: T).(\lambda (_: T).(subst1 d +u0 u u2))) (\lambda (_: T).(\lambda (t3: T).(subst1 (s (Bind Abst) d) u0 t +t3))) (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 (THead (Flat +Appl) w v) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 +(THead (Flat Appl) w (THead (Bind Abst) u t)) (lift (S O) d y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x4: T).(\lambda (x5: +T).(\lambda (H15: (eq T (lift (S O) d x1) (THead (Bind Abst) x4 +x5))).(\lambda (H16: (subst1 d u0 u x4)).(\lambda (H17: (subst1 (s (Bind +Abst) d) u0 t x5)).(let H18 \def (sym_eq T (lift (S O) d x1) (THead (Bind +Abst) x4 x5) H15) in (ex3_2_ind T T (\lambda (y: T).(\lambda (z: T).(eq T x1 +(THead (Bind Abst) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T x4 (lift (S +O) d y)))) (\lambda (_: T).(\lambda (z: T).(eq T x5 (lift (S O) (S d) z)))) +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 (THead (Flat Appl) w +v) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 (THead +(Flat Appl) w (THead (Bind Abst) u t)) (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x6: T).(\lambda (x7: +T).(\lambda (H19: (eq T x1 (THead (Bind Abst) x6 x7))).(\lambda (H20: (eq T +x4 (lift (S O) d x6))).(\lambda (H21: (eq T x5 (lift (S O) (S d) x7))).(let +H22 \def (eq_ind T x5 (\lambda (t0: T).(subst1 (s (Bind Abst) d) u0 t t0)) +H17 (lift (S O) (S d) x7) H21) in (let H23 \def (eq_ind T x4 (\lambda (t0: +T).(subst1 d u0 u t0)) H16 (lift (S O) d x6) H20) in (let H24 \def (eq_ind T +x1 (\lambda (t0: T).(ty3 g a x0 t0)) H10 (THead (Bind Abst) x6 x7) H19) in +(let H25 \def (eq_ind T x6 (\lambda (t0: T).(ty3 g a x0 (THead (Bind Abst) t0 +x7))) H24 x3 (subst1_confluence_lift u x6 u0 d H23 x3 H13)) in (ex3_2_intro T +T (\lambda (y1: T).(\lambda (_: T).(subst1 d u0 (THead (Flat Appl) w v) (lift +(S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u0 (THead (Flat +Appl) w (THead (Bind Abst) u t)) (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))) (THead (Flat Appl) x2 x0) (THead (Flat +Appl) x2 (THead (Bind Abst) x3 x7)) (eq_ind_r T (THead (Flat Appl) (lift (S +O) d x2) (lift (S O) d x0)) (\lambda (t0: T).(subst1 d u0 (THead (Flat Appl) +w v) t0)) (subst1_head u0 w (lift (S O) d x2) d H12 (Flat Appl) v (lift (S O) +d x0) H8) (lift (S O) d (THead (Flat Appl) x2 x0)) (lift_flat Appl x2 x0 (S +O) d)) (eq_ind_r T (THead (Flat Appl) (lift (S O) d x2) (lift (S O) d (THead +(Bind Abst) x3 x7))) (\lambda (t0: T).(subst1 d u0 (THead (Flat Appl) w +(THead (Bind Abst) u t)) t0)) (subst1_head u0 w (lift (S O) d x2) d H12 (Flat +Appl) (THead (Bind Abst) u t) (lift (S O) d (THead (Bind Abst) x3 x7)) +(eq_ind_r T (THead (Bind Abst) (lift (S O) d x3) (lift (S O) (S d) x7)) +(\lambda (t0: T).(subst1 (s (Flat Appl) d) u0 (THead (Bind Abst) u t) t0)) +(subst1_head u0 u (lift (S O) d x3) (s (Flat Appl) d) H13 (Bind Abst) t (lift +(S O) (S d) x7) H22) (lift (S O) d (THead (Bind Abst) x3 x7)) (lift_bind Abst +x3 x7 (S O) d))) (lift (S O) d (THead (Flat Appl) x2 (THead (Bind Abst) x3 +x7))) (lift_flat Appl x2 (THead (Bind Abst) x3 x7) (S O) d)) (ty3_appl g a x2 +x3 H14 x0 x7 H25))))))))))) (lift_gen_bind Abst x4 x5 x1 (S O) d H18)))))))) +(subst1_gen_head (Bind Abst) u0 u t (lift (S O) d x1) d H9))))))) H11))))))) +H7))))))))))))))))))) (\lambda (c0: C).(\lambda (t3: T).(\lambda (t4: +T).(\lambda (_: (ty3 g c0 t3 t4)).(\lambda (H1: ((\forall (e: C).(\forall (u: +T).(\forall (d: nat).((getl d c0 (CHead e (Bind Abbr) u)) \to (\forall (a0: +C).((csubst1 d u c0 a0) \to (\forall (a: C).((drop (S O) d a0 a) \to (ex3_2 T +T (\lambda (y1: T).(\lambda (_: T).(subst1 d u t3 (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(subst1 d u t4 (lift (S O) d y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))))).(\lambda (t0: +T).(\lambda (_: (ty3 g c0 t4 t0)).(\lambda (H3: ((\forall (e: C).(\forall (u: +T).(\forall (d: nat).((getl d c0 (CHead e (Bind Abbr) u)) \to (\forall (a0: +C).((csubst1 d u c0 a0) \to (\forall (a: C).((drop (S O) d a0 a) \to (ex3_2 T +T (\lambda (y1: T).(\lambda (_: T).(subst1 d u t4 (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(subst1 d u t0 (lift (S O) d y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))))).(\lambda (e: +C).(\lambda (u: T).(\lambda (d: nat).(\lambda (H4: (getl d c0 (CHead e (Bind +Abbr) u))).(\lambda (a0: C).(\lambda (H5: (csubst1 d u c0 a0)).(\lambda (a: +C).(\lambda (H6: (drop (S O) d a0 a)).(let H7 \def (H3 e u d H4 a0 H5 a H6) +in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(subst1 d u t4 (lift (S O) +d y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u t0 (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(subst1 d u (THead (Flat Cast) t4 t3) (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(subst1 d u (THead (Flat Cast) t0 t4) (lift +(S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda +(x0: T).(\lambda (x1: T).(\lambda (H8: (subst1 d u t4 (lift (S O) d +x0))).(\lambda (H9: (subst1 d u t0 (lift (S O) d x1))).(\lambda (H10: (ty3 g +a x0 x1)).(let H11 \def (H1 e u d H4 a0 H5 a H6) in (ex3_2_ind T T (\lambda +(y1: T).(\lambda (_: T).(subst1 d u t3 (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(subst1 d u t4 (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(subst1 d u (THead (Flat Cast) t4 t3) (lift (S O) d y1)))) (\lambda +(_: T).(\lambda (y2: T).(subst1 d u (THead (Flat Cast) t0 t4) (lift (S O) d +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x2: +T).(\lambda (x3: T).(\lambda (H12: (subst1 d u t3 (lift (S O) d +x2))).(\lambda (H13: (subst1 d u t4 (lift (S O) d x3))).(\lambda (H14: (ty3 g +a x2 x3)).(let H15 \def (eq_ind T x3 (\lambda (t: T).(ty3 g a x2 t)) H14 x0 +(subst1_confluence_lift t4 x3 u d H13 x0 H8)) in (ex3_2_intro T T (\lambda +(y1: T).(\lambda (_: T).(subst1 d u (THead (Flat Cast) t4 t3) (lift (S O) d +y1)))) (\lambda (_: T).(\lambda (y2: T).(subst1 d u (THead (Flat Cast) t0 t4) +(lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) +(THead (Flat Cast) x0 x2) (THead (Flat Cast) x1 x0) (eq_ind_r T (THead (Flat +Cast) (lift (S O) d x0) (lift (S O) d x2)) (\lambda (t: T).(subst1 d u (THead +(Flat Cast) t4 t3) t)) (subst1_head u t4 (lift (S O) d x0) d H8 (Flat Cast) +t3 (lift (S O) d x2) H12) (lift (S O) d (THead (Flat Cast) x0 x2)) (lift_flat +Cast x0 x2 (S O) d)) (eq_ind_r T (THead (Flat Cast) (lift (S O) d x1) (lift +(S O) d x0)) (\lambda (t: T).(subst1 d u (THead (Flat Cast) t0 t4) t)) +(subst1_head u t0 (lift (S O) d x1) d H9 (Flat Cast) t4 (lift (S O) d x0) H8) +(lift (S O) d (THead (Flat Cast) x1 x0)) (lift_flat Cast x1 x0 (S O) d)) +(ty3_cast g a x2 x0 H15 x1 H10)))))))) H11))))))) H7)))))))))))))))))) c t1 +t2 H))))). + +theorem ty3_gen_cvoid: + \forall (g: G).(\forall (c: C).(\forall (t1: T).(\forall (t2: T).((ty3 g c +t1 t2) \to (\forall (e: C).(\forall (u: T).(\forall (d: nat).((getl d c +(CHead e (Bind Void) u)) \to (\forall (a: C).((drop (S O) d c a) \to (ex3_2 T +T (\lambda (y1: T).(\lambda (_: T).(eq T t1 (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T t2 (lift (S O) d y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2)))))))))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (t1: T).(\lambda (t2: T).(\lambda +(H: (ty3 g c t1 t2)).(ty3_ind g (\lambda (c0: C).(\lambda (t: T).(\lambda +(t0: T).(\forall (e: C).(\forall (u: T).(\forall (d: nat).((getl d c0 (CHead +e (Bind Void) u)) \to (\forall (a: C).((drop (S O) d c0 a) \to (ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(eq T t (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T t0 (lift (S O) d y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2))))))))))))) (\lambda (c0: C).(\lambda (t3: +T).(\lambda (t: T).(\lambda (H0: (ty3 g c0 t3 t)).(\lambda (H1: ((\forall (e: +C).(\forall (u: T).(\forall (d: nat).((getl d c0 (CHead e (Bind Void) u)) \to +(\forall (a: C).((drop (S O) d c0 a) \to (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(eq T t3 (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t +(lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2)))))))))))).(\lambda (u: T).(\lambda (t4: T).(\lambda (H2: (ty3 g c0 u +t4)).(\lambda (H3: ((\forall (e: C).(\forall (u0: T).(\forall (d: nat).((getl +d c0 (CHead e (Bind Void) u0)) \to (\forall (a: C).((drop (S O) d c0 a) \to +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T u (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T t4 (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))).(\lambda (H4: (pc3 c0 t4 +t3)).(\lambda (e: C).(\lambda (u0: T).(\lambda (d: nat).(\lambda (H5: (getl d +c0 (CHead e (Bind Void) u0))).(\lambda (a: C).(\lambda (H6: (drop (S O) d c0 +a)).(let H7 \def (H3 e u0 d H5 a H6) in (ex3_2_ind T T (\lambda (y1: +T).(\lambda (_: T).(eq T u (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: +T).(eq T t4 (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a +y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T u (lift (S O) d +y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t3 (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H8: (eq T u (lift (S O) d x0))).(\lambda (H9: +(eq T t4 (lift (S O) d x1))).(\lambda (H10: (ty3 g a x0 x1)).(let H11 \def +(eq_ind T t4 (\lambda (t0: T).(pc3 c0 t0 t3)) H4 (lift (S O) d x1) H9) in +(let H12 \def (eq_ind T t4 (\lambda (t0: T).(ty3 g c0 u t0)) H2 (lift (S O) d +x1) H9) in (let H13 \def (eq_ind T u (\lambda (t0: T).(ty3 g c0 t0 (lift (S +O) d x1))) H12 (lift (S O) d x0) H8) in (eq_ind_r T (lift (S O) d x0) +(\lambda (t0: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T t0 (lift +(S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t3 (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H14 \def (H1 e u0 +d H5 a H6) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(eq T t3 (lift +(S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T (lift (S O) d x0) (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T t3 (lift (S O) d y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2)))) (\lambda (x2: T).(\lambda (x3: T).(\lambda (H15: +(eq T t3 (lift (S O) d x2))).(\lambda (H16: (eq T t (lift (S O) d +x3))).(\lambda (H17: (ty3 g a x2 x3)).(let H18 \def (eq_ind T t (\lambda (t0: +T).(ty3 g c0 t3 t0)) H0 (lift (S O) d x3) H16) in (let H19 \def (eq_ind T t3 +(\lambda (t0: T).(ty3 g c0 t0 (lift (S O) d x3))) H18 (lift (S O) d x2) H15) +in (let H20 \def (eq_ind T t3 (\lambda (t0: T).(pc3 c0 (lift (S O) d x1) t0)) +H11 (lift (S O) d x2) H15) in (eq_ind_r T (lift (S O) d x2) (\lambda (t0: +T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (lift (S O) d x0) (lift +(S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t0 (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (ex3_2_intro T T +(\lambda (y1: T).(\lambda (_: T).(eq T (lift (S O) d x0) (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T (lift (S O) d x2) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) x0 x2 (refl_equal T (lift +(S O) d x0)) (refl_equal T (lift (S O) d x2)) (ty3_conv g a x2 x3 H17 x0 x1 +H10 (pc3_gen_lift c0 x1 x2 (S O) d H20 a H6))) t3 H15))))))))) H14)) u +H8))))))))) H7)))))))))))))))))) (\lambda (c0: C).(\lambda (m: nat).(\lambda +(e: C).(\lambda (u: T).(\lambda (d: nat).(\lambda (_: (getl d c0 (CHead e +(Bind Void) u))).(\lambda (a: C).(\lambda (_: (drop (S O) d c0 +a)).(ex3_2_intro T T (\lambda (y1: T).(\lambda (_: T).(eq T (TSort m) (lift +(S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (TSort (next g m)) +(lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) +(TSort m) (TSort (next g m)) (eq_ind_r T (TSort m) (\lambda (t: T).(eq T +(TSort m) t)) (refl_equal T (TSort m)) (lift (S O) d (TSort m)) (lift_sort m +(S O) d)) (eq_ind_r T (TSort (next g m)) (\lambda (t: T).(eq T (TSort (next g +m)) t)) (refl_equal T (TSort (next g m))) (lift (S O) d (TSort (next g m))) +(lift_sort (next g m) (S O) d)) (ty3_sort g a m)))))))))) (\lambda (n: +nat).(\lambda (c0: C).(\lambda (d: C).(\lambda (u: T).(\lambda (H0: (getl n +c0 (CHead d (Bind Abbr) u))).(\lambda (t: T).(\lambda (H1: (ty3 g d u +t)).(\lambda (H2: ((\forall (e: C).(\forall (u0: T).(\forall (d0: nat).((getl +d0 d (CHead e (Bind Void) u0)) \to (\forall (a: C).((drop (S O) d0 d a) \to +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T u (lift (S O) d0 y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T t (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))).(\lambda (e: C).(\lambda (u0: +T).(\lambda (d0: nat).(\lambda (H3: (getl d0 c0 (CHead e (Bind Void) +u0))).(\lambda (a: C).(\lambda (H4: (drop (S O) d0 c0 a)).(lt_eq_gt_e n d0 +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (TLRef n) (lift (S O) d0 +y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S n) O t) (lift (S O) d0 +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (H5: (lt +n d0)).(let H6 \def (eq_ind nat (minus d0 n) (\lambda (n0: nat).(getl n0 +(CHead d (Bind Abbr) u) (CHead e (Bind Void) u0))) (getl_conf_le d0 (CHead e +(Bind Void) u0) c0 H3 (CHead d (Bind Abbr) u) n H0 (le_S_n n d0 (le_S (S n) +d0 H5))) (S (minus d0 (S n))) (minus_x_Sy d0 n H5)) in (let H7 \def (eq_ind +nat d0 (\lambda (n0: nat).(drop (S O) n0 c0 a)) H4 (S (plus n (minus d0 (S +n)))) (lt_plus_minus n d0 H5)) in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift (S O) (minus d0 (S n)) v)))) (\lambda (v: T).(\lambda (e0: +C).(getl n a (CHead e0 (Bind Abbr) v)))) (\lambda (_: T).(\lambda (e0: +C).(drop (S O) (minus d0 (S n)) d e0))) (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(eq T (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: +T).(eq T (lift (S n) O t) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2)))) (\lambda (x0: T).(\lambda (x1: C).(\lambda (H8: +(eq T u (lift (S O) (minus d0 (S n)) x0))).(\lambda (H9: (getl n a (CHead x1 +(Bind Abbr) x0))).(\lambda (H10: (drop (S O) (minus d0 (S n)) d x1)).(let H11 +\def (eq_ind T u (\lambda (t0: T).(\forall (e0: C).(\forall (u1: T).(\forall +(d1: nat).((getl d1 d (CHead e0 (Bind Void) u1)) \to (\forall (a0: C).((drop +(S O) d1 d a0) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T t0 (lift +(S O) d1 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t (lift (S O) d1 +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a0 y1 y2))))))))))) H2 (lift +(S O) (minus d0 (S n)) x0) H8) in (let H12 \def (eq_ind T u (\lambda (t0: +T).(ty3 g d t0 t)) H1 (lift (S O) (minus d0 (S n)) x0) H8) in (let H13 \def +(H11 e u0 (minus d0 (S n)) (getl_gen_S (Bind Abbr) d (CHead e (Bind Void) u0) +u (minus d0 (S n)) H6) x1 H10) in (ex3_2_ind T T (\lambda (y1: T).(\lambda +(_: T).(eq T (lift (S O) (minus d0 (S n)) x0) (lift (S O) (minus d0 (S n)) +y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t (lift (S O) (minus d0 (S n)) +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g x1 y1 y2))) (ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(eq T (TLRef n) (lift (S O) d0 y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T (lift (S n) O t) (lift (S O) d0 y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x2: +T).(\lambda (x3: T).(\lambda (H14: (eq T (lift (S O) (minus d0 (S n)) x0) +(lift (S O) (minus d0 (S n)) x2))).(\lambda (H15: (eq T t (lift (S O) (minus +d0 (S n)) x3))).(\lambda (H16: (ty3 g x1 x2 x3)).(let H17 \def (eq_ind T t +(\lambda (t0: T).(ty3 g d (lift (S O) (minus d0 (S n)) x0) t0)) H12 (lift (S +O) (minus d0 (S n)) x3) H15) in (eq_ind_r T (lift (S O) (minus d0 (S n)) x3) +(\lambda (t0: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (TLRef n) +(lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S n) O +t0) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2))))) (let H18 \def (eq_ind_r T x2 (\lambda (t0: T).(ty3 g x1 t0 x3)) H16 +x0 (lift_inj x0 x2 (S O) (minus d0 (S n)) H14)) in (eq_ind T (lift (S O) +(plus (S n) (minus d0 (S n))) (lift (S n) O x3)) (\lambda (t0: T).(ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(eq T (TLRef n) (lift (S O) d0 y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T t0 (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind nat d0 (\lambda (n0: +nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (TLRef n) (lift (S O) +d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S O) n0 (lift (S n) O +x3)) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2))))) (ex3_2_intro T T (\lambda (y1: T).(\lambda (_: T).(eq T (TLRef n) +(lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S O) d0 +(lift (S n) O x3)) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: +T).(ty3 g a y1 y2))) (TLRef n) (lift (S n) O x3) (eq_ind_r T (TLRef n) +(\lambda (t0: T).(eq T (TLRef n) t0)) (refl_equal T (TLRef n)) (lift (S O) d0 +(TLRef n)) (lift_lref_lt n (S O) d0 H5)) (refl_equal T (lift (S O) d0 (lift +(S n) O x3))) (ty3_abbr g n a x1 x0 H9 x3 H18)) (plus (S n) (minus d0 (S n))) +(le_plus_minus (S n) d0 H5)) (lift (S n) O (lift (S O) (minus d0 (S n)) x3)) +(lift_d x3 (S O) (S n) (minus d0 (S n)) O (le_O_n (minus d0 (S n)))))) t +H15))))))) H13))))))))) (getl_drop_conf_lt Abbr c0 d u n H0 a (S O) (minus d0 +(S n)) H7))))) (\lambda (H5: (eq nat n d0)).(let H6 \def (eq_ind_r nat d0 +(\lambda (n0: nat).(drop (S O) n0 c0 a)) H4 n H5) in (let H7 \def (eq_ind_r +nat d0 (\lambda (n0: nat).(getl n0 c0 (CHead e (Bind Void) u0))) H3 n H5) in +(eq_ind nat n (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(eq T (TLRef n) (lift (S O) n0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq +T (lift (S n) O t) (lift (S O) n0 y2)))) (\lambda (y1: T).(\lambda (y2: +T).(ty3 g a y1 y2))))) (let H8 \def (eq_ind C (CHead d (Bind Abbr) u) +(\lambda (c1: C).(getl n c0 c1)) H0 (CHead e (Bind Void) u0) (getl_mono c0 +(CHead d (Bind Abbr) u) n H0 (CHead e (Bind Void) u0) H7)) in (let H9 \def +(eq_ind C (CHead d (Bind Abbr) u) (\lambda (ee: C).(match ee in C return +(\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead _ k _) +\Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +True | Abst \Rightarrow False | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead e (Bind Void) u0) (getl_mono c0 (CHead d +(Bind Abbr) u) n H0 (CHead e (Bind Void) u0) H7)) in (False_ind (ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(eq T (TLRef n) (lift (S O) n y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T (lift (S n) O t) (lift (S O) n y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) H9))) d0 H5)))) (\lambda +(H5: (lt d0 n)).(eq_ind_r nat (S (plus O (minus n (S O)))) (\lambda (n0: +nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (TLRef n0) (lift (S O) +d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S n) O t) (lift (S O) +d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind nat +(plus (S O) (minus n (S O))) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T (TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (lift (S n) O t) (lift (S O) d0 y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind_r nat (plus (minus n (S +O)) (S O)) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq +T (TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T +(lift (S n) O t) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 +g a y1 y2))))) (ex3_2_intro T T (\lambda (y1: T).(\lambda (_: T).(eq T (TLRef +(plus (minus n (S O)) (S O))) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(eq T (lift (S n) O t) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))) (TLRef (minus n (S O))) (lift n O t) +(eq_ind_r T (TLRef (plus (minus n (S O)) (S O))) (\lambda (t0: T).(eq T +(TLRef (plus (minus n (S O)) (S O))) t0)) (refl_equal T (TLRef (plus (minus n +(S O)) (S O)))) (lift (S O) d0 (TLRef (minus n (S O)))) (lift_lref_ge (minus +n (S O)) (S O) d0 (lt_le_minus d0 n H5))) (eq_ind_r T (lift (plus (S O) n) O +t) (\lambda (t0: T).(eq T (lift (S n) O t) t0)) (refl_equal T (lift (S n) O +t)) (lift (S O) d0 (lift n O t)) (lift_free t n (S O) O d0 (le_S_n d0 (plus O +n) (le_S (S d0) (plus O n) H5)) (le_O_n d0))) (eq_ind_r nat (S (minus n (S +O))) (\lambda (n0: nat).(ty3 g a (TLRef (minus n (S O))) (lift n0 O t))) +(ty3_abbr g (minus n (S O)) a d u (getl_drop_conf_ge n (CHead d (Bind Abbr) +u) c0 H0 a (S O) d0 H4 (eq_ind_r nat (plus (S O) d0) (\lambda (n0: nat).(le +n0 n)) H5 (plus d0 (S O)) (plus_comm d0 (S O)))) t H1) n (minus_x_SO n +(le_lt_trans O d0 n (le_O_n d0) H5)))) (plus (S O) (minus n (S O))) +(plus_comm (S O) (minus n (S O)))) (S (plus O (minus n (S O)))) (refl_equal +nat (S (plus O (minus n (S O)))))) n (lt_plus_minus O n (le_lt_trans O d0 n +(le_O_n d0) H5))))))))))))))))))) (\lambda (n: nat).(\lambda (c0: C).(\lambda +(d: C).(\lambda (u: T).(\lambda (H0: (getl n c0 (CHead d (Bind Abst) +u))).(\lambda (t: T).(\lambda (H1: (ty3 g d u t)).(\lambda (H2: ((\forall (e: +C).(\forall (u0: T).(\forall (d0: nat).((getl d0 d (CHead e (Bind Void) u0)) +\to (\forall (a: C).((drop (S O) d0 d a) \to (ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T u (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(eq T t (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 +g a y1 y2)))))))))))).(\lambda (e: C).(\lambda (u0: T).(\lambda (d0: +nat).(\lambda (H3: (getl d0 c0 (CHead e (Bind Void) u0))).(\lambda (a: +C).(\lambda (H4: (drop (S O) d0 c0 a)).(lt_eq_gt_e n d0 (ex3_2 T T (\lambda +(y1: T).(\lambda (_: T).(eq T (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (lift (S n) O u) (lift (S O) d0 y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (H5: (lt n d0)).(let H6 +\def (eq_ind nat (minus d0 n) (\lambda (n0: nat).(getl n0 (CHead d (Bind +Abst) u) (CHead e (Bind Void) u0))) (getl_conf_le d0 (CHead e (Bind Void) u0) +c0 H3 (CHead d (Bind Abst) u) n H0 (le_S_n n d0 (le_S (S n) d0 H5))) (S +(minus d0 (S n))) (minus_x_Sy d0 n H5)) in (let H7 \def (eq_ind nat d0 +(\lambda (n0: nat).(drop (S O) n0 c0 a)) H4 (S (plus n (minus d0 (S n)))) +(lt_plus_minus n d0 H5)) in (ex3_2_ind T C (\lambda (v: T).(\lambda (_: +C).(eq T u (lift (S O) (minus d0 (S n)) v)))) (\lambda (v: T).(\lambda (e0: +C).(getl n a (CHead e0 (Bind Abst) v)))) (\lambda (_: T).(\lambda (e0: +C).(drop (S O) (minus d0 (S n)) d e0))) (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(eq T (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: +T).(eq T (lift (S n) O u) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2)))) (\lambda (x0: T).(\lambda (x1: C).(\lambda (H8: +(eq T u (lift (S O) (minus d0 (S n)) x0))).(\lambda (H9: (getl n a (CHead x1 +(Bind Abst) x0))).(\lambda (H10: (drop (S O) (minus d0 (S n)) d x1)).(let H11 +\def (eq_ind T u (\lambda (t0: T).(\forall (e0: C).(\forall (u1: T).(\forall +(d1: nat).((getl d1 d (CHead e0 (Bind Void) u1)) \to (\forall (a0: C).((drop +(S O) d1 d a0) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T t0 (lift +(S O) d1 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t (lift (S O) d1 +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a0 y1 y2))))))))))) H2 (lift +(S O) (minus d0 (S n)) x0) H8) in (let H12 \def (eq_ind T u (\lambda (t0: +T).(ty3 g d t0 t)) H1 (lift (S O) (minus d0 (S n)) x0) H8) in (eq_ind_r T +(lift (S O) (minus d0 (S n)) x0) (\lambda (t0: T).(ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (lift (S n) O t0) (lift (S O) d0 y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H13 \def (H11 e u0 (minus +d0 (S n)) (getl_gen_S (Bind Abst) d (CHead e (Bind Void) u0) u (minus d0 (S +n)) H6) x1 H10) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(eq T +(lift (S O) (minus d0 (S n)) x0) (lift (S O) (minus d0 (S n)) y1)))) (\lambda +(_: T).(\lambda (y2: T).(eq T t (lift (S O) (minus d0 (S n)) y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g x1 y1 y2))) (ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (lift (S n) O (lift (S O) (minus d0 (S n)) x0)) +(lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) +(\lambda (x2: T).(\lambda (x3: T).(\lambda (H14: (eq T (lift (S O) (minus d0 +(S n)) x0) (lift (S O) (minus d0 (S n)) x2))).(\lambda (H15: (eq T t (lift (S +O) (minus d0 (S n)) x3))).(\lambda (H16: (ty3 g x1 x2 x3)).(let H17 \def +(eq_ind T t (\lambda (t0: T).(ty3 g d (lift (S O) (minus d0 (S n)) x0) t0)) +H12 (lift (S O) (minus d0 (S n)) x3) H15) in (let H18 \def (eq_ind_r T x2 +(\lambda (t0: T).(ty3 g x1 t0 x3)) H16 x0 (lift_inj x0 x2 (S O) (minus d0 (S +n)) H14)) in (eq_ind T (lift (S O) (plus (S n) (minus d0 (S n))) (lift (S n) +O x0)) (\lambda (t0: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T +(TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t0 +(lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) +(eq_ind nat d0 (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(eq T (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq +T (lift (S O) n0 (lift (S n) O x0)) (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (ex3_2_intro T T (\lambda (y1: +T).(\lambda (_: T).(eq T (TLRef n) (lift (S O) d0 y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (lift (S O) d0 (lift (S n) O x0)) (lift (S O) d0 +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (TLRef n) (lift (S +n) O x0) (eq_ind_r T (TLRef n) (\lambda (t0: T).(eq T (TLRef n) t0)) +(refl_equal T (TLRef n)) (lift (S O) d0 (TLRef n)) (lift_lref_lt n (S O) d0 +H5)) (refl_equal T (lift (S O) d0 (lift (S n) O x0))) (ty3_abst g n a x1 x0 +H9 x3 H18)) (plus (S n) (minus d0 (S n))) (le_plus_minus (S n) d0 H5)) (lift +(S n) O (lift (S O) (minus d0 (S n)) x0)) (lift_d x0 (S O) (S n) (minus d0 (S +n)) O (le_O_n (minus d0 (S n)))))))))))) H13)) u H8)))))))) +(getl_drop_conf_lt Abst c0 d u n H0 a (S O) (minus d0 (S n)) H7))))) (\lambda +(H5: (eq nat n d0)).(let H6 \def (eq_ind_r nat d0 (\lambda (n0: nat).(drop (S +O) n0 c0 a)) H4 n H5) in (let H7 \def (eq_ind_r nat d0 (\lambda (n0: +nat).(getl n0 c0 (CHead e (Bind Void) u0))) H3 n H5) in (eq_ind nat n +(\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (TLRef +n) (lift (S O) n0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S n) O +u) (lift (S O) n0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2))))) (let H8 \def (eq_ind C (CHead d (Bind Abst) u) (\lambda (c1: C).(getl +n c0 c1)) H0 (CHead e (Bind Void) u0) (getl_mono c0 (CHead d (Bind Abst) u) n +H0 (CHead e (Bind Void) u0) H7)) in (let H9 \def (eq_ind C (CHead d (Bind +Abst) u) (\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with +[(CSort _) \Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind b) \Rightarrow (match b in B return +(\lambda (_: B).Prop) with [Abbr \Rightarrow False | Abst \Rightarrow True | +Void \Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead e (Bind +Void) u0) (getl_mono c0 (CHead d (Bind Abst) u) n H0 (CHead e (Bind Void) u0) +H7)) in (False_ind (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (TLRef +n) (lift (S O) n y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S n) O +u) (lift (S O) n y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) +H9))) d0 H5)))) (\lambda (H5: (lt d0 n)).(eq_ind_r nat (S (plus O (minus n (S +O)))) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T +(TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift +(S n) O u) (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a +y1 y2))))) (eq_ind nat (plus (S O) (minus n (S O))) (\lambda (n0: nat).(ex3_2 +T T (\lambda (y1: T).(\lambda (_: T).(eq T (TLRef n0) (lift (S O) d0 y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T (lift (S n) O u) (lift (S O) d0 y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind_r nat (plus +(minus n (S O)) (S O)) (\lambda (n0: nat).(ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T (TLRef n0) (lift (S O) d0 y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (lift (S n) O u) (lift (S O) d0 y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (ex3_2_intro T T (\lambda (y1: +T).(\lambda (_: T).(eq T (TLRef (plus (minus n (S O)) (S O))) (lift (S O) d0 +y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S n) O u) (lift (S O) d0 +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (TLRef (minus n (S +O))) (lift n O u) (eq_ind_r T (TLRef (plus (minus n (S O)) (S O))) (\lambda +(t0: T).(eq T (TLRef (plus (minus n (S O)) (S O))) t0)) (refl_equal T (TLRef +(plus (minus n (S O)) (S O)))) (lift (S O) d0 (TLRef (minus n (S O)))) +(lift_lref_ge (minus n (S O)) (S O) d0 (lt_le_minus d0 n H5))) (eq_ind_r T +(lift (plus (S O) n) O u) (\lambda (t0: T).(eq T (lift (S n) O u) t0)) +(refl_equal T (lift (S n) O u)) (lift (S O) d0 (lift n O u)) (lift_free u n +(S O) O d0 (le_S_n d0 (plus O n) (le_S (S d0) (plus O n) H5)) (le_O_n d0))) +(eq_ind_r nat (S (minus n (S O))) (\lambda (n0: nat).(ty3 g a (TLRef (minus n +(S O))) (lift n0 O u))) (ty3_abst g (minus n (S O)) a d u (getl_drop_conf_ge +n (CHead d (Bind Abst) u) c0 H0 a (S O) d0 H4 (eq_ind_r nat (plus (S O) d0) +(\lambda (n0: nat).(le n0 n)) H5 (plus d0 (S O)) (plus_comm d0 (S O)))) t H1) +n (minus_x_SO n (le_lt_trans O d0 n (le_O_n d0) H5)))) (plus (S O) (minus n +(S O))) (plus_comm (S O) (minus n (S O)))) (S (plus O (minus n (S O)))) +(refl_equal nat (S (plus O (minus n (S O)))))) n (lt_plus_minus O n +(le_lt_trans O d0 n (le_O_n d0) H5))))))))))))))))))) (\lambda (c0: +C).(\lambda (u: T).(\lambda (t: T).(\lambda (H0: (ty3 g c0 u t)).(\lambda +(H1: ((\forall (e: C).(\forall (u0: T).(\forall (d: nat).((getl d c0 (CHead e +(Bind Void) u0)) \to (\forall (a: C).((drop (S O) d c0 a) \to (ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(eq T u (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T t (lift (S O) d y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2)))))))))))).(\lambda (b: B).(\lambda (t3: T).(\lambda +(t4: T).(\lambda (H2: (ty3 g (CHead c0 (Bind b) u) t3 t4)).(\lambda (H3: +((\forall (e: C).(\forall (u0: T).(\forall (d: nat).((getl d (CHead c0 (Bind +b) u) (CHead e (Bind Void) u0)) \to (\forall (a: C).((drop (S O) d (CHead c0 +(Bind b) u) a) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T t3 (lift +(S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t4 (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))).(\lambda (t0: +T).(\lambda (H4: (ty3 g (CHead c0 (Bind b) u) t4 t0)).(\lambda (H5: ((\forall +(e: C).(\forall (u0: T).(\forall (d: nat).((getl d (CHead c0 (Bind b) u) +(CHead e (Bind Void) u0)) \to (\forall (a: C).((drop (S O) d (CHead c0 (Bind +b) u) a) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T t4 (lift (S O) +d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t0 (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))).(\lambda (e: +C).(\lambda (u0: T).(\lambda (d: nat).(\lambda (H6: (getl d c0 (CHead e (Bind +Void) u0))).(\lambda (a: C).(\lambda (H7: (drop (S O) d c0 a)).(let H8 \def +(H1 e u0 d H6 a H7) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(eq T +u (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t (lift (S O) d +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(eq T (THead (Bind b) u t3) (lift (S O) d +y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Bind b) u t4) (lift (S +O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda +(x0: T).(\lambda (x1: T).(\lambda (H9: (eq T u (lift (S O) d x0))).(\lambda +(H10: (eq T t (lift (S O) d x1))).(\lambda (H11: (ty3 g a x0 x1)).(let H12 +\def (eq_ind T t (\lambda (t5: T).(ty3 g c0 u t5)) H0 (lift (S O) d x1) H10) +in (let H13 \def (eq_ind T u (\lambda (t5: T).(ty3 g c0 t5 (lift (S O) d +x1))) H12 (lift (S O) d x0) H9) in (let H14 \def (eq_ind T u (\lambda (t5: +T).(\forall (e0: C).(\forall (u1: T).(\forall (d0: nat).((getl d0 (CHead c0 +(Bind b) t5) (CHead e0 (Bind Void) u1)) \to (\forall (a0: C).((drop (S O) d0 +(CHead c0 (Bind b) t5) a0) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(eq T t4 (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t0 +(lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a0 y1 +y2))))))))))) H5 (lift (S O) d x0) H9) in (let H15 \def (eq_ind T u (\lambda +(t5: T).(ty3 g (CHead c0 (Bind b) t5) t4 t0)) H4 (lift (S O) d x0) H9) in +(let H16 \def (eq_ind T u (\lambda (t5: T).(\forall (e0: C).(\forall (u1: +T).(\forall (d0: nat).((getl d0 (CHead c0 (Bind b) t5) (CHead e0 (Bind Void) +u1)) \to (\forall (a0: C).((drop (S O) d0 (CHead c0 (Bind b) t5) a0) \to +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T t3 (lift (S O) d0 y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T t4 (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a0 y1 y2))))))))))) H3 (lift (S O) d x0) H9) in +(let H17 \def (eq_ind T u (\lambda (t5: T).(ty3 g (CHead c0 (Bind b) t5) t3 +t4)) H2 (lift (S O) d x0) H9) in (eq_ind_r T (lift (S O) d x0) (\lambda (t5: +T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (THead (Bind b) t5 t3) +(lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Bind b) +t5 t4) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2))))) (let H18 \def (H16 e u0 (S d) (getl_head (Bind b) d c0 (CHead e (Bind +Void) u0) H6 (lift (S O) d x0)) (CHead a (Bind b) x0) (drop_skip_bind (S O) d +c0 a H7 b x0)) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(eq T t3 +(lift (S O) (S d) y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t4 (lift (S +O) (S d) y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g (CHead a (Bind b) +x0) y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (THead (Bind +b) (lift (S O) d x0) t3) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: +T).(eq T (THead (Bind b) (lift (S O) d x0) t4) (lift (S O) d y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x2: T).(\lambda (x3: +T).(\lambda (H19: (eq T t3 (lift (S O) (S d) x2))).(\lambda (H20: (eq T t4 +(lift (S O) (S d) x3))).(\lambda (H21: (ty3 g (CHead a (Bind b) x0) x2 +x3)).(let H22 \def (eq_ind T t4 (\lambda (t5: T).(\forall (e0: C).(\forall +(u1: T).(\forall (d0: nat).((getl d0 (CHead c0 (Bind b) (lift (S O) d x0)) +(CHead e0 (Bind Void) u1)) \to (\forall (a0: C).((drop (S O) d0 (CHead c0 +(Bind b) (lift (S O) d x0)) a0) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(eq T t5 (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t0 +(lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a0 y1 +y2))))))))))) H14 (lift (S O) (S d) x3) H20) in (eq_ind_r T (lift (S O) (S d) +x3) (\lambda (t5: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (THead +(Bind b) (lift (S O) d x0) t3) (lift (S O) d y1)))) (\lambda (_: T).(\lambda +(y2: T).(eq T (THead (Bind b) (lift (S O) d x0) t5) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind_r T (lift (S O) +(S d) x2) (\lambda (t5: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T +(THead (Bind b) (lift (S O) d x0) t5) (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (THead (Bind b) (lift (S O) d x0) (lift (S O) (S d) +x3)) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2))))) (let H23 \def (H22 e u0 (S d) (getl_head (Bind b) d c0 (CHead e (Bind +Void) u0) H6 (lift (S O) d x0)) (CHead a (Bind b) x0) (drop_skip_bind (S O) d +c0 a H7 b x0)) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(eq T (lift +(S O) (S d) x3) (lift (S O) (S d) y1)))) (\lambda (_: T).(\lambda (y2: T).(eq +T t0 (lift (S O) (S d) y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g (CHead +a (Bind b) x0) y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T +(THead (Bind b) (lift (S O) d x0) (lift (S O) (S d) x2)) (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T (THead (Bind b) (lift (S O) d x0) +(lift (S O) (S d) x3)) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: +T).(ty3 g a y1 y2)))) (\lambda (x4: T).(\lambda (x5: T).(\lambda (H24: (eq T +(lift (S O) (S d) x3) (lift (S O) (S d) x4))).(\lambda (_: (eq T t0 (lift (S +O) (S d) x5))).(\lambda (H26: (ty3 g (CHead a (Bind b) x0) x4 x5)).(let H27 +\def (eq_ind_r T x4 (\lambda (t5: T).(ty3 g (CHead a (Bind b) x0) t5 x5)) H26 +x3 (lift_inj x3 x4 (S O) (S d) H24)) in (eq_ind T (lift (S O) d (THead (Bind +b) x0 x2)) (\lambda (t5: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T +t5 (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Bind +b) (lift (S O) d x0) (lift (S O) (S d) x3)) (lift (S O) d y2)))) (\lambda +(y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind T (lift (S O) d (THead +(Bind b) x0 x3)) (\lambda (t5: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(eq T (lift (S O) d (THead (Bind b) x0 x2)) (lift (S O) d y1)))) (\lambda +(_: T).(\lambda (y2: T).(eq T t5 (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (ex3_2_intro T T (\lambda (y1: +T).(\lambda (_: T).(eq T (lift (S O) d (THead (Bind b) x0 x2)) (lift (S O) d +y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S O) d (THead (Bind b) +x0 x3)) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2))) (THead (Bind b) x0 x2) (THead (Bind b) x0 x3) (refl_equal T (lift (S O) +d (THead (Bind b) x0 x2))) (refl_equal T (lift (S O) d (THead (Bind b) x0 +x3))) (ty3_bind g a x0 x1 H11 b x2 x3 H21 x5 H27)) (THead (Bind b) (lift (S +O) d x0) (lift (S O) (S d) x3)) (lift_bind b x0 x3 (S O) d)) (THead (Bind b) +(lift (S O) d x0) (lift (S O) (S d) x2)) (lift_bind b x0 x2 (S O) d)))))))) +H23)) t3 H19) t4 H20))))))) H18)) u H9)))))))))))) H8))))))))))))))))))))) +(\lambda (c0: C).(\lambda (w: T).(\lambda (u: T).(\lambda (_: (ty3 g c0 w +u)).(\lambda (H1: ((\forall (e: C).(\forall (u0: T).(\forall (d: nat).((getl +d c0 (CHead e (Bind Void) u0)) \to (\forall (a: C).((drop (S O) d c0 a) \to +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T w (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T u (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))).(\lambda (v: T).(\lambda (t: +T).(\lambda (H2: (ty3 g c0 v (THead (Bind Abst) u t))).(\lambda (H3: +((\forall (e: C).(\forall (u0: T).(\forall (d: nat).((getl d c0 (CHead e +(Bind Void) u0)) \to (\forall (a: C).((drop (S O) d c0 a) \to (ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(eq T v (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (THead (Bind Abst) u t) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))))))))))).(\lambda (e: +C).(\lambda (u0: T).(\lambda (d: nat).(\lambda (H4: (getl d c0 (CHead e (Bind +Void) u0))).(\lambda (a: C).(\lambda (H5: (drop (S O) d c0 a)).(let H6 \def +(H3 e u0 d H4 a H5) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(eq T +v (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Bind +Abst) u t) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2))) (ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (THead (Flat Appl) w +v) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Flat +Appl) w (THead (Bind Abst) u t)) (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x0: T).(\lambda (x1: +T).(\lambda (H7: (eq T v (lift (S O) d x0))).(\lambda (H8: (eq T (THead (Bind +Abst) u t) (lift (S O) d x1))).(\lambda (H9: (ty3 g a x0 x1)).(let H10 \def +(eq_ind T v (\lambda (t0: T).(ty3 g c0 t0 (THead (Bind Abst) u t))) H2 (lift +(S O) d x0) H7) in (eq_ind_r T (lift (S O) d x0) (\lambda (t0: T).(ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(eq T (THead (Flat Appl) w t0) (lift (S O) d +y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Flat Appl) w (THead +(Bind Abst) u t)) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 +g a y1 y2))))) (ex3_2_ind T T (\lambda (y: T).(\lambda (z: T).(eq T x1 (THead +(Bind Abst) y z)))) (\lambda (y: T).(\lambda (_: T).(eq T u (lift (S O) d +y)))) (\lambda (_: T).(\lambda (z: T).(eq T t (lift (S O) (S d) z)))) (ex3_2 +T T (\lambda (y1: T).(\lambda (_: T).(eq T (THead (Flat Appl) w (lift (S O) d +x0)) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Flat +Appl) w (THead (Bind Abst) u t)) (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x2: T).(\lambda (x3: +T).(\lambda (H11: (eq T x1 (THead (Bind Abst) x2 x3))).(\lambda (H12: (eq T u +(lift (S O) d x2))).(\lambda (H13: (eq T t (lift (S O) (S d) x3))).(let H14 +\def (eq_ind T x1 (\lambda (t0: T).(ty3 g a x0 t0)) H9 (THead (Bind Abst) x2 +x3) H11) in (eq_ind_r T (lift (S O) (S d) x3) (\lambda (t0: T).(ex3_2 T T +(\lambda (y1: T).(\lambda (_: T).(eq T (THead (Flat Appl) w (lift (S O) d +x0)) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Flat +Appl) w (THead (Bind Abst) u t0)) (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H15 \def (eq_ind T u (\lambda +(t0: T).(\forall (e0: C).(\forall (u1: T).(\forall (d0: nat).((getl d0 c0 +(CHead e0 (Bind Void) u1)) \to (\forall (a0: C).((drop (S O) d0 c0 a0) \to +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T w (lift (S O) d0 y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T t0 (lift (S O) d0 y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a0 y1 y2))))))))))) H1 (lift (S O) d x2) H12) in +(eq_ind_r T (lift (S O) d x2) (\lambda (t0: T).(ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T (THead (Flat Appl) w (lift (S O) d x0)) (lift (S O) +d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Flat Appl) w (THead +(Bind Abst) t0 (lift (S O) (S d) x3))) (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H16 \def (H15 e u0 d H4 a H5) in +(ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(eq T w (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T (lift (S O) d x2) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T (THead (Flat Appl) w (lift (S O) d x0)) (lift (S O) +d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Flat Appl) w (THead +(Bind Abst) (lift (S O) d x2) (lift (S O) (S d) x3))) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x4: +T).(\lambda (x5: T).(\lambda (H17: (eq T w (lift (S O) d x4))).(\lambda (H18: +(eq T (lift (S O) d x2) (lift (S O) d x5))).(\lambda (H19: (ty3 g a x4 +x5)).(eq_ind_r T (lift (S O) d x4) (\lambda (t0: T).(ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T (THead (Flat Appl) t0 (lift (S O) d x0)) (lift (S O) +d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (THead (Flat Appl) t0 (THead +(Bind Abst) (lift (S O) d x2) (lift (S O) (S d) x3))) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H20 \def (eq_ind_r +T x5 (\lambda (t0: T).(ty3 g a x4 t0)) H19 x2 (lift_inj x2 x5 (S O) d H18)) +in (eq_ind T (lift (S O) d (THead (Bind Abst) x2 x3)) (\lambda (t0: T).(ex3_2 +T T (\lambda (y1: T).(\lambda (_: T).(eq T (THead (Flat Appl) (lift (S O) d +x4) (lift (S O) d x0)) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: +T).(eq T (THead (Flat Appl) (lift (S O) d x4) t0) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (eq_ind T (lift (S O) d +(THead (Flat Appl) x4 x0)) (\lambda (t0: T).(ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T t0 (lift (S O) d y1)))) (\lambda (_: T).(\lambda +(y2: T).(eq T (THead (Flat Appl) (lift (S O) d x4) (lift (S O) d (THead (Bind +Abst) x2 x3))) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g +a y1 y2))))) (eq_ind T (lift (S O) d (THead (Flat Appl) x4 (THead (Bind Abst) +x2 x3))) (\lambda (t0: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T +(lift (S O) d (THead (Flat Appl) x4 x0)) (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T t0 (lift (S O) d y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2))))) (ex3_2_intro T T (\lambda (y1: T).(\lambda (_: +T).(eq T (lift (S O) d (THead (Flat Appl) x4 x0)) (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T (lift (S O) d (THead (Flat Appl) x4 +(THead (Bind Abst) x2 x3))) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2))) (THead (Flat Appl) x4 x0) (THead (Flat Appl) x4 +(THead (Bind Abst) x2 x3)) (refl_equal T (lift (S O) d (THead (Flat Appl) x4 +x0))) (refl_equal T (lift (S O) d (THead (Flat Appl) x4 (THead (Bind Abst) x2 +x3)))) (ty3_appl g a x4 x2 H20 x0 x3 H14)) (THead (Flat Appl) (lift (S O) d +x4) (lift (S O) d (THead (Bind Abst) x2 x3))) (lift_flat Appl x4 (THead (Bind +Abst) x2 x3) (S O) d)) (THead (Flat Appl) (lift (S O) d x4) (lift (S O) d +x0)) (lift_flat Appl x4 x0 (S O) d)) (THead (Bind Abst) (lift (S O) d x2) +(lift (S O) (S d) x3)) (lift_bind Abst x2 x3 (S O) d))) w H17)))))) H16)) u +H12)) t H13))))))) (lift_gen_bind Abst u t x1 (S O) d H8)) v H7))))))) +H6))))))))))))))))) (\lambda (c0: C).(\lambda (t3: T).(\lambda (t4: +T).(\lambda (H0: (ty3 g c0 t3 t4)).(\lambda (H1: ((\forall (e: C).(\forall +(u: T).(\forall (d: nat).((getl d c0 (CHead e (Bind Void) u)) \to (\forall +(a: C).((drop (S O) d c0 a) \to (ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(eq T t3 (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T t4 +(lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 +y2)))))))))))).(\lambda (t0: T).(\lambda (H2: (ty3 g c0 t4 t0)).(\lambda (H3: +((\forall (e: C).(\forall (u: T).(\forall (d: nat).((getl d c0 (CHead e (Bind +Void) u)) \to (\forall (a: C).((drop (S O) d c0 a) \to (ex3_2 T T (\lambda +(y1: T).(\lambda (_: T).(eq T t4 (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T t0 (lift (S O) d y2)))) (\lambda (y1: T).(\lambda +(y2: T).(ty3 g a y1 y2)))))))))))).(\lambda (e: C).(\lambda (u: T).(\lambda +(d: nat).(\lambda (H4: (getl d c0 (CHead e (Bind Void) u))).(\lambda (a: +C).(\lambda (H5: (drop (S O) d c0 a)).(let H6 \def (H3 e u d H4 a H5) in +(ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(eq T t4 (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T t0 (lift (S O) d y2)))) (\lambda (y1: +T).(\lambda (y2: T).(ty3 g a y1 y2))) (ex3_2 T T (\lambda (y1: T).(\lambda +(_: T).(eq T (THead (Flat Cast) t4 t3) (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (THead (Flat Cast) t0 t4) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x0: +T).(\lambda (x1: T).(\lambda (H7: (eq T t4 (lift (S O) d x0))).(\lambda (H8: +(eq T t0 (lift (S O) d x1))).(\lambda (H9: (ty3 g a x0 x1)).(let H10 \def +(eq_ind T t0 (\lambda (t: T).(ty3 g c0 t4 t)) H2 (lift (S O) d x1) H8) in +(eq_ind_r T (lift (S O) d x1) (\lambda (t: T).(ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T (THead (Flat Cast) t4 t3) (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T (THead (Flat Cast) t t4) (lift (S O) d +y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H11 \def +(eq_ind T t4 (\lambda (t: T).(ty3 g c0 t (lift (S O) d x1))) H10 (lift (S O) +d x0) H7) in (let H12 \def (eq_ind T t4 (\lambda (t: T).(\forall (e0: +C).(\forall (u0: T).(\forall (d0: nat).((getl d0 c0 (CHead e0 (Bind Void) +u0)) \to (\forall (a0: C).((drop (S O) d0 c0 a0) \to (ex3_2 T T (\lambda (y1: +T).(\lambda (_: T).(eq T t3 (lift (S O) d0 y1)))) (\lambda (_: T).(\lambda +(y2: T).(eq T t (lift (S O) d0 y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 +g a0 y1 y2))))))))))) H1 (lift (S O) d x0) H7) in (let H13 \def (eq_ind T t4 +(\lambda (t: T).(ty3 g c0 t3 t)) H0 (lift (S O) d x0) H7) in (eq_ind_r T +(lift (S O) d x0) (\lambda (t: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: +T).(eq T (THead (Flat Cast) t t3) (lift (S O) d y1)))) (\lambda (_: +T).(\lambda (y2: T).(eq T (THead (Flat Cast) (lift (S O) d x1) t) (lift (S O) +d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H14 \def +(H12 e u d H4 a H5) in (ex3_2_ind T T (\lambda (y1: T).(\lambda (_: T).(eq T +t3 (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T (lift (S O) d +x0) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) +(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (THead (Flat Cast) (lift (S +O) d x0) t3) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: T).(eq T +(THead (Flat Cast) (lift (S O) d x1) (lift (S O) d x0)) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2)))) (\lambda (x2: +T).(\lambda (x3: T).(\lambda (H15: (eq T t3 (lift (S O) d x2))).(\lambda +(H16: (eq T (lift (S O) d x0) (lift (S O) d x3))).(\lambda (H17: (ty3 g a x2 +x3)).(let H18 \def (eq_ind T t3 (\lambda (t: T).(ty3 g c0 t (lift (S O) d +x0))) H13 (lift (S O) d x2) H15) in (eq_ind_r T (lift (S O) d x2) (\lambda +(t: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (THead (Flat Cast) +(lift (S O) d x0) t) (lift (S O) d y1)))) (\lambda (_: T).(\lambda (y2: +T).(eq T (THead (Flat Cast) (lift (S O) d x1) (lift (S O) d x0)) (lift (S O) +d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))))) (let H19 \def +(eq_ind_r T x3 (\lambda (t: T).(ty3 g a x2 t)) H17 x0 (lift_inj x0 x3 (S O) d +H16)) in (eq_ind T (lift (S O) d (THead (Flat Cast) x0 x2)) (\lambda (t: +T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T t (lift (S O) d y1)))) +(\lambda (_: T).(\lambda (y2: T).(eq T (THead (Flat Cast) (lift (S O) d x1) +(lift (S O) d x0)) (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: +T).(ty3 g a y1 y2))))) (eq_ind T (lift (S O) d (THead (Flat Cast) x1 x0)) +(\lambda (t: T).(ex3_2 T T (\lambda (y1: T).(\lambda (_: T).(eq T (lift (S O) +d (THead (Flat Cast) x0 x2)) (lift (S O) d y1)))) (\lambda (_: T).(\lambda +(y2: T).(eq T t (lift (S O) d y2)))) (\lambda (y1: T).(\lambda (y2: T).(ty3 g +a y1 y2))))) (ex3_2_intro T T (\lambda (y1: T).(\lambda (_: T).(eq T (lift (S +O) d (THead (Flat Cast) x0 x2)) (lift (S O) d y1)))) (\lambda (_: T).(\lambda +(y2: T).(eq T (lift (S O) d (THead (Flat Cast) x1 x0)) (lift (S O) d y2)))) +(\lambda (y1: T).(\lambda (y2: T).(ty3 g a y1 y2))) (THead (Flat Cast) x0 x2) +(THead (Flat Cast) x1 x0) (refl_equal T (lift (S O) d (THead (Flat Cast) x0 +x2))) (refl_equal T (lift (S O) d (THead (Flat Cast) x1 x0))) (ty3_cast g a +x2 x0 H19 x1 H9)) (THead (Flat Cast) (lift (S O) d x1) (lift (S O) d x0)) +(lift_flat Cast x1 x0 (S O) d)) (THead (Flat Cast) (lift (S O) d x0) (lift (S +O) d x2)) (lift_flat Cast x0 x2 (S O) d))) t3 H15))))))) H14)) t4 H7)))) t0 +H8))))))) H6)))))))))))))))) c t1 t2 H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/tau0.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/tau0.ma new file mode 100644 index 000000000..a470e0d0c --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/tau0.ma @@ -0,0 +1,633 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/tau0". + +include "ty3/pr3_props.ma". + +include "tau0/defs.ma". + +theorem ty3_tau0: + \forall (g: G).(\forall (c: C).(\forall (u: T).(\forall (t1: T).((ty3 g c u +t1) \to (\forall (t2: T).((tau0 g c u t2) \to (ty3 g c u t2))))))) +\def + \lambda (g: G).(\lambda (c: C).(\lambda (u: T).(\lambda (t1: T).(\lambda (H: +(ty3 g c u t1)).(ty3_ind g (\lambda (c0: C).(\lambda (t: T).(\lambda (_: +T).(\forall (t2: T).((tau0 g c0 t t2) \to (ty3 g c0 t t2)))))) (\lambda (c0: +C).(\lambda (t2: T).(\lambda (t: T).(\lambda (_: (ty3 g c0 t2 t)).(\lambda +(_: ((\forall (t3: T).((tau0 g c0 t2 t3) \to (ty3 g c0 t2 t3))))).(\lambda +(u0: T).(\lambda (t3: T).(\lambda (_: (ty3 g c0 u0 t3)).(\lambda (H3: +((\forall (t4: T).((tau0 g c0 u0 t4) \to (ty3 g c0 u0 t4))))).(\lambda (_: +(pc3 c0 t3 t2)).(\lambda (t0: T).(\lambda (H5: (tau0 g c0 u0 t0)).(H3 t0 +H5))))))))))))) (\lambda (c0: C).(\lambda (m: nat).(\lambda (t2: T).(\lambda +(H0: (tau0 g c0 (TSort m) t2)).(let H1 \def (match H0 in tau0 return (\lambda +(c1: C).(\lambda (t: T).(\lambda (t0: T).(\lambda (_: (tau0 ? c1 t t0)).((eq +C c1 c0) \to ((eq T t (TSort m)) \to ((eq T t0 t2) \to (ty3 g c0 (TSort m) +t2)))))))) with [(tau0_sort c1 n) \Rightarrow (\lambda (H1: (eq C c1 +c0)).(\lambda (H2: (eq T (TSort n) (TSort m))).(\lambda (H3: (eq T (TSort +(next g n)) t2)).(eq_ind C c0 (\lambda (_: C).((eq T (TSort n) (TSort m)) \to +((eq T (TSort (next g n)) t2) \to (ty3 g c0 (TSort m) t2)))) (\lambda (H4: +(eq T (TSort n) (TSort m))).(let H5 \def (f_equal T nat (\lambda (e: +T).(match e in T return (\lambda (_: T).nat) with [(TSort n0) \Rightarrow n0 +| (TLRef _) \Rightarrow n | (THead _ _ _) \Rightarrow n])) (TSort n) (TSort +m) H4) in (eq_ind nat m (\lambda (n0: nat).((eq T (TSort (next g n0)) t2) \to +(ty3 g c0 (TSort m) t2))) (\lambda (H6: (eq T (TSort (next g m)) t2)).(eq_ind +T (TSort (next g m)) (\lambda (t: T).(ty3 g c0 (TSort m) t)) (ty3_sort g c0 +m) t2 H6)) n (sym_eq nat n m H5)))) c1 (sym_eq C c1 c0 H1) H2 H3)))) | +(tau0_abbr c1 d v i H1 w H2) \Rightarrow (\lambda (H3: (eq C c1 c0)).(\lambda +(H4: (eq T (TLRef i) (TSort m))).(\lambda (H5: (eq T (lift (S i) O w) +t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (TLRef i) (TSort m)) \to ((eq T +(lift (S i) O w) t2) \to ((getl i c2 (CHead d (Bind Abbr) v)) \to ((tau0 g d +v w) \to (ty3 g c0 (TSort m) t2)))))) (\lambda (H6: (eq T (TLRef i) (TSort +m))).(let H7 \def (eq_ind T (TLRef i) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (TSort m) H6) in +(False_ind ((eq T (lift (S i) O w) t2) \to ((getl i c0 (CHead d (Bind Abbr) +v)) \to ((tau0 g d v w) \to (ty3 g c0 (TSort m) t2)))) H7))) c1 (sym_eq C c1 +c0 H3) H4 H5 H1 H2)))) | (tau0_abst c1 d v i H1 w H2) \Rightarrow (\lambda +(H3: (eq C c1 c0)).(\lambda (H4: (eq T (TLRef i) (TSort m))).(\lambda (H5: +(eq T (lift (S i) O v) t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (TLRef i) +(TSort m)) \to ((eq T (lift (S i) O v) t2) \to ((getl i c2 (CHead d (Bind +Abst) v)) \to ((tau0 g d v w) \to (ty3 g c0 (TSort m) t2)))))) (\lambda (H6: +(eq T (TLRef i) (TSort m))).(let H7 \def (eq_ind T (TLRef i) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I +(TSort m) H6) in (False_ind ((eq T (lift (S i) O v) t2) \to ((getl i c0 +(CHead d (Bind Abst) v)) \to ((tau0 g d v w) \to (ty3 g c0 (TSort m) t2)))) +H7))) c1 (sym_eq C c1 c0 H3) H4 H5 H1 H2)))) | (tau0_bind b c1 v t0 t3 H1) +\Rightarrow (\lambda (H2: (eq C c1 c0)).(\lambda (H3: (eq T (THead (Bind b) v +t0) (TSort m))).(\lambda (H4: (eq T (THead (Bind b) v t3) t2)).(eq_ind C c0 +(\lambda (c2: C).((eq T (THead (Bind b) v t0) (TSort m)) \to ((eq T (THead +(Bind b) v t3) t2) \to ((tau0 g (CHead c2 (Bind b) v) t0 t3) \to (ty3 g c0 +(TSort m) t2))))) (\lambda (H5: (eq T (THead (Bind b) v t0) (TSort m))).(let +H6 \def (eq_ind T (THead (Bind b) v t0) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow True])) I (TSort m) H5) in +(False_ind ((eq T (THead (Bind b) v t3) t2) \to ((tau0 g (CHead c0 (Bind b) +v) t0 t3) \to (ty3 g c0 (TSort m) t2))) H6))) c1 (sym_eq C c1 c0 H2) H3 H4 +H1)))) | (tau0_appl c1 v t0 t3 H1) \Rightarrow (\lambda (H2: (eq C c1 +c0)).(\lambda (H3: (eq T (THead (Flat Appl) v t0) (TSort m))).(\lambda (H4: +(eq T (THead (Flat Appl) v t3) t2)).(eq_ind C c0 (\lambda (c2: C).((eq T +(THead (Flat Appl) v t0) (TSort m)) \to ((eq T (THead (Flat Appl) v t3) t2) +\to ((tau0 g c2 t0 t3) \to (ty3 g c0 (TSort m) t2))))) (\lambda (H5: (eq T +(THead (Flat Appl) v t0) (TSort m))).(let H6 \def (eq_ind T (THead (Flat +Appl) v t0) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TSort m) H5) in (False_ind ((eq T (THead (Flat Appl) v +t3) t2) \to ((tau0 g c0 t0 t3) \to (ty3 g c0 (TSort m) t2))) H6))) c1 (sym_eq +C c1 c0 H2) H3 H4 H1)))) | (tau0_cast c1 v1 v2 H1 t0 t3 H2) \Rightarrow +(\lambda (H3: (eq C c1 c0)).(\lambda (H4: (eq T (THead (Flat Cast) v1 t0) +(TSort m))).(\lambda (H5: (eq T (THead (Flat Cast) v2 t3) t2)).(eq_ind C c0 +(\lambda (c2: C).((eq T (THead (Flat Cast) v1 t0) (TSort m)) \to ((eq T +(THead (Flat Cast) v2 t3) t2) \to ((tau0 g c2 v1 v2) \to ((tau0 g c2 t0 t3) +\to (ty3 g c0 (TSort m) t2)))))) (\lambda (H6: (eq T (THead (Flat Cast) v1 +t0) (TSort m))).(let H7 \def (eq_ind T (THead (Flat Cast) v1 t0) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I +(TSort m) H6) in (False_ind ((eq T (THead (Flat Cast) v2 t3) t2) \to ((tau0 g +c0 v1 v2) \to ((tau0 g c0 t0 t3) \to (ty3 g c0 (TSort m) t2)))) H7))) c1 +(sym_eq C c1 c0 H3) H4 H5 H1 H2))))]) in (H1 (refl_equal C c0) (refl_equal T +(TSort m)) (refl_equal T t2))))))) (\lambda (n: nat).(\lambda (c0: +C).(\lambda (d: C).(\lambda (u0: T).(\lambda (H0: (getl n c0 (CHead d (Bind +Abbr) u0))).(\lambda (t: T).(\lambda (_: (ty3 g d u0 t)).(\lambda (H2: +((\forall (t2: T).((tau0 g d u0 t2) \to (ty3 g d u0 t2))))).(\lambda (t2: +T).(\lambda (H3: (tau0 g c0 (TLRef n) t2)).(let H4 \def (match H3 in tau0 +return (\lambda (c1: C).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (tau0 +? c1 t0 t3)).((eq C c1 c0) \to ((eq T t0 (TLRef n)) \to ((eq T t3 t2) \to +(ty3 g c0 (TLRef n) t2)))))))) with [(tau0_sort c1 n0) \Rightarrow (\lambda +(H4: (eq C c1 c0)).(\lambda (H5: (eq T (TSort n0) (TLRef n))).(\lambda (H6: +(eq T (TSort (next g n0)) t2)).(eq_ind C c0 (\lambda (_: C).((eq T (TSort n0) +(TLRef n)) \to ((eq T (TSort (next g n0)) t2) \to (ty3 g c0 (TLRef n) t2)))) +(\lambda (H7: (eq T (TSort n0) (TLRef n))).(let H8 \def (eq_ind T (TSort n0) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +False])) I (TLRef n) H7) in (False_ind ((eq T (TSort (next g n0)) t2) \to +(ty3 g c0 (TLRef n) t2)) H8))) c1 (sym_eq C c1 c0 H4) H5 H6)))) | (tau0_abbr +c1 d0 v i H4 w H5) \Rightarrow (\lambda (H6: (eq C c1 c0)).(\lambda (H7: (eq +T (TLRef i) (TLRef n))).(\lambda (H8: (eq T (lift (S i) O w) t2)).(eq_ind C +c0 (\lambda (c2: C).((eq T (TLRef i) (TLRef n)) \to ((eq T (lift (S i) O w) +t2) \to ((getl i c2 (CHead d0 (Bind Abbr) v)) \to ((tau0 g d0 v w) \to (ty3 g +c0 (TLRef n) t2)))))) (\lambda (H9: (eq T (TLRef i) (TLRef n))).(let H10 \def +(f_equal T nat (\lambda (e: T).(match e in T return (\lambda (_: T).nat) with +[(TSort _) \Rightarrow i | (TLRef n0) \Rightarrow n0 | (THead _ _ _) +\Rightarrow i])) (TLRef i) (TLRef n) H9) in (eq_ind nat n (\lambda (n0: +nat).((eq T (lift (S n0) O w) t2) \to ((getl n0 c0 (CHead d0 (Bind Abbr) v)) +\to ((tau0 g d0 v w) \to (ty3 g c0 (TLRef n) t2))))) (\lambda (H11: (eq T +(lift (S n) O w) t2)).(eq_ind T (lift (S n) O w) (\lambda (t0: T).((getl n c0 +(CHead d0 (Bind Abbr) v)) \to ((tau0 g d0 v w) \to (ty3 g c0 (TLRef n) t0)))) +(\lambda (H12: (getl n c0 (CHead d0 (Bind Abbr) v))).(\lambda (H13: (tau0 g +d0 v w)).(let H14 \def (eq_ind C (CHead d (Bind Abbr) u0) (\lambda (c2: +C).(getl n c0 c2)) H0 (CHead d0 (Bind Abbr) v) (getl_mono c0 (CHead d (Bind +Abbr) u0) n H0 (CHead d0 (Bind Abbr) v) H12)) in (let H15 \def (f_equal C C +(\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow d | (CHead c2 _ _) \Rightarrow c2])) (CHead d (Bind Abbr) u0) +(CHead d0 (Bind Abbr) v) (getl_mono c0 (CHead d (Bind Abbr) u0) n H0 (CHead +d0 (Bind Abbr) v) H12)) in ((let H16 \def (f_equal C T (\lambda (e: C).(match +e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | (CHead _ _ +t0) \Rightarrow t0])) (CHead d (Bind Abbr) u0) (CHead d0 (Bind Abbr) v) +(getl_mono c0 (CHead d (Bind Abbr) u0) n H0 (CHead d0 (Bind Abbr) v) H12)) in +(\lambda (H17: (eq C d d0)).(let H18 \def (eq_ind_r T v (\lambda (t0: +T).(getl n c0 (CHead d0 (Bind Abbr) t0))) H14 u0 H16) in (let H19 \def +(eq_ind_r T v (\lambda (t0: T).(tau0 g d0 t0 w)) H13 u0 H16) in (let H20 \def +(eq_ind_r C d0 (\lambda (c2: C).(getl n c0 (CHead c2 (Bind Abbr) u0))) H18 d +H17) in (let H21 \def (eq_ind_r C d0 (\lambda (c2: C).(tau0 g c2 u0 w)) H19 d +H17) in (ty3_abbr g n c0 d u0 H20 w (H2 w H21)))))))) H15))))) t2 H11)) i +(sym_eq nat i n H10)))) c1 (sym_eq C c1 c0 H6) H7 H8 H4 H5)))) | (tau0_abst +c1 d0 v i H4 w H5) \Rightarrow (\lambda (H6: (eq C c1 c0)).(\lambda (H7: (eq +T (TLRef i) (TLRef n))).(\lambda (H8: (eq T (lift (S i) O v) t2)).(eq_ind C +c0 (\lambda (c2: C).((eq T (TLRef i) (TLRef n)) \to ((eq T (lift (S i) O v) +t2) \to ((getl i c2 (CHead d0 (Bind Abst) v)) \to ((tau0 g d0 v w) \to (ty3 g +c0 (TLRef n) t2)))))) (\lambda (H9: (eq T (TLRef i) (TLRef n))).(let H10 \def +(f_equal T nat (\lambda (e: T).(match e in T return (\lambda (_: T).nat) with +[(TSort _) \Rightarrow i | (TLRef n0) \Rightarrow n0 | (THead _ _ _) +\Rightarrow i])) (TLRef i) (TLRef n) H9) in (eq_ind nat n (\lambda (n0: +nat).((eq T (lift (S n0) O v) t2) \to ((getl n0 c0 (CHead d0 (Bind Abst) v)) +\to ((tau0 g d0 v w) \to (ty3 g c0 (TLRef n) t2))))) (\lambda (H11: (eq T +(lift (S n) O v) t2)).(eq_ind T (lift (S n) O v) (\lambda (t0: T).((getl n c0 +(CHead d0 (Bind Abst) v)) \to ((tau0 g d0 v w) \to (ty3 g c0 (TLRef n) t0)))) +(\lambda (H12: (getl n c0 (CHead d0 (Bind Abst) v))).(\lambda (_: (tau0 g d0 +v w)).(let H14 \def (eq_ind C (CHead d (Bind Abbr) u0) (\lambda (c2: C).(getl +n c0 c2)) H0 (CHead d0 (Bind Abst) v) (getl_mono c0 (CHead d (Bind Abbr) u0) +n H0 (CHead d0 (Bind Abst) v) H12)) in (let H15 \def (eq_ind C (CHead d (Bind +Abbr) u0) (\lambda (ee: C).(match ee in C return (\lambda (_: C).Prop) with +[(CSort _) \Rightarrow False | (CHead _ k _) \Rightarrow (match k in K return +(\lambda (_: K).Prop) with [(Bind b) \Rightarrow (match b in B return +(\lambda (_: B).Prop) with [Abbr \Rightarrow True | Abst \Rightarrow False | +Void \Rightarrow False]) | (Flat _) \Rightarrow False])])) I (CHead d0 (Bind +Abst) v) (getl_mono c0 (CHead d (Bind Abbr) u0) n H0 (CHead d0 (Bind Abst) v) +H12)) in (False_ind (ty3 g c0 (TLRef n) (lift (S n) O v)) H15))))) t2 H11)) i +(sym_eq nat i n H10)))) c1 (sym_eq C c1 c0 H6) H7 H8 H4 H5)))) | (tau0_bind b +c1 v t0 t3 H4) \Rightarrow (\lambda (H5: (eq C c1 c0)).(\lambda (H6: (eq T +(THead (Bind b) v t0) (TLRef n))).(\lambda (H7: (eq T (THead (Bind b) v t3) +t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (THead (Bind b) v t0) (TLRef n)) +\to ((eq T (THead (Bind b) v t3) t2) \to ((tau0 g (CHead c2 (Bind b) v) t0 +t3) \to (ty3 g c0 (TLRef n) t2))))) (\lambda (H8: (eq T (THead (Bind b) v t0) +(TLRef n))).(let H9 \def (eq_ind T (THead (Bind b) v t0) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I +(TLRef n) H8) in (False_ind ((eq T (THead (Bind b) v t3) t2) \to ((tau0 g +(CHead c0 (Bind b) v) t0 t3) \to (ty3 g c0 (TLRef n) t2))) H9))) c1 (sym_eq C +c1 c0 H5) H6 H7 H4)))) | (tau0_appl c1 v t0 t3 H4) \Rightarrow (\lambda (H5: +(eq C c1 c0)).(\lambda (H6: (eq T (THead (Flat Appl) v t0) (TLRef +n))).(\lambda (H7: (eq T (THead (Flat Appl) v t3) t2)).(eq_ind C c0 (\lambda +(c2: C).((eq T (THead (Flat Appl) v t0) (TLRef n)) \to ((eq T (THead (Flat +Appl) v t3) t2) \to ((tau0 g c2 t0 t3) \to (ty3 g c0 (TLRef n) t2))))) +(\lambda (H8: (eq T (THead (Flat Appl) v t0) (TLRef n))).(let H9 \def (eq_ind +T (THead (Flat Appl) v t0) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow True])) I (TLRef n) H8) in (False_ind ((eq T (THead +(Flat Appl) v t3) t2) \to ((tau0 g c0 t0 t3) \to (ty3 g c0 (TLRef n) t2))) +H9))) c1 (sym_eq C c1 c0 H5) H6 H7 H4)))) | (tau0_cast c1 v1 v2 H4 t0 t3 H5) +\Rightarrow (\lambda (H6: (eq C c1 c0)).(\lambda (H7: (eq T (THead (Flat +Cast) v1 t0) (TLRef n))).(\lambda (H8: (eq T (THead (Flat Cast) v2 t3) +t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (THead (Flat Cast) v1 t0) (TLRef +n)) \to ((eq T (THead (Flat Cast) v2 t3) t2) \to ((tau0 g c2 v1 v2) \to +((tau0 g c2 t0 t3) \to (ty3 g c0 (TLRef n) t2)))))) (\lambda (H9: (eq T +(THead (Flat Cast) v1 t0) (TLRef n))).(let H10 \def (eq_ind T (THead (Flat +Cast) v1 t0) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TLRef n) H9) in (False_ind ((eq T (THead (Flat Cast) +v2 t3) t2) \to ((tau0 g c0 v1 v2) \to ((tau0 g c0 t0 t3) \to (ty3 g c0 (TLRef +n) t2)))) H10))) c1 (sym_eq C c1 c0 H6) H7 H8 H4 H5))))]) in (H4 (refl_equal +C c0) (refl_equal T (TLRef n)) (refl_equal T t2))))))))))))) (\lambda (n: +nat).(\lambda (c0: C).(\lambda (d: C).(\lambda (u0: T).(\lambda (H0: (getl n +c0 (CHead d (Bind Abst) u0))).(\lambda (t: T).(\lambda (H1: (ty3 g d u0 +t)).(\lambda (_: ((\forall (t2: T).((tau0 g d u0 t2) \to (ty3 g d u0 +t2))))).(\lambda (t2: T).(\lambda (H3: (tau0 g c0 (TLRef n) t2)).(let H4 \def +(match H3 in tau0 return (\lambda (c1: C).(\lambda (t0: T).(\lambda (t3: +T).(\lambda (_: (tau0 ? c1 t0 t3)).((eq C c1 c0) \to ((eq T t0 (TLRef n)) \to +((eq T t3 t2) \to (ty3 g c0 (TLRef n) t2)))))))) with [(tau0_sort c1 n0) +\Rightarrow (\lambda (H4: (eq C c1 c0)).(\lambda (H5: (eq T (TSort n0) (TLRef +n))).(\lambda (H6: (eq T (TSort (next g n0)) t2)).(eq_ind C c0 (\lambda (_: +C).((eq T (TSort n0) (TLRef n)) \to ((eq T (TSort (next g n0)) t2) \to (ty3 g +c0 (TLRef n) t2)))) (\lambda (H7: (eq T (TSort n0) (TLRef n))).(let H8 \def +(eq_ind T (TSort n0) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow False])) I (TLRef n) H7) in (False_ind ((eq T +(TSort (next g n0)) t2) \to (ty3 g c0 (TLRef n) t2)) H8))) c1 (sym_eq C c1 c0 +H4) H5 H6)))) | (tau0_abbr c1 d0 v i H4 w H5) \Rightarrow (\lambda (H6: (eq C +c1 c0)).(\lambda (H7: (eq T (TLRef i) (TLRef n))).(\lambda (H8: (eq T (lift +(S i) O w) t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (TLRef i) (TLRef n)) \to +((eq T (lift (S i) O w) t2) \to ((getl i c2 (CHead d0 (Bind Abbr) v)) \to +((tau0 g d0 v w) \to (ty3 g c0 (TLRef n) t2)))))) (\lambda (H9: (eq T (TLRef +i) (TLRef n))).(let H10 \def (f_equal T nat (\lambda (e: T).(match e in T +return (\lambda (_: T).nat) with [(TSort _) \Rightarrow i | (TLRef n0) +\Rightarrow n0 | (THead _ _ _) \Rightarrow i])) (TLRef i) (TLRef n) H9) in +(eq_ind nat n (\lambda (n0: nat).((eq T (lift (S n0) O w) t2) \to ((getl n0 +c0 (CHead d0 (Bind Abbr) v)) \to ((tau0 g d0 v w) \to (ty3 g c0 (TLRef n) +t2))))) (\lambda (H11: (eq T (lift (S n) O w) t2)).(eq_ind T (lift (S n) O w) +(\lambda (t0: T).((getl n c0 (CHead d0 (Bind Abbr) v)) \to ((tau0 g d0 v w) +\to (ty3 g c0 (TLRef n) t0)))) (\lambda (H12: (getl n c0 (CHead d0 (Bind +Abbr) v))).(\lambda (_: (tau0 g d0 v w)).(let H14 \def (eq_ind C (CHead d +(Bind Abst) u0) (\lambda (c2: C).(getl n c0 c2)) H0 (CHead d0 (Bind Abbr) v) +(getl_mono c0 (CHead d (Bind Abst) u0) n H0 (CHead d0 (Bind Abbr) v) H12)) in +(let H15 \def (eq_ind C (CHead d (Bind Abst) u0) (\lambda (ee: C).(match ee +in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow False | (CHead +_ k _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind b) +\Rightarrow (match b in B return (\lambda (_: B).Prop) with [Abbr \Rightarrow +False | Abst \Rightarrow True | Void \Rightarrow False]) | (Flat _) +\Rightarrow False])])) I (CHead d0 (Bind Abbr) v) (getl_mono c0 (CHead d +(Bind Abst) u0) n H0 (CHead d0 (Bind Abbr) v) H12)) in (False_ind (ty3 g c0 +(TLRef n) (lift (S n) O w)) H15))))) t2 H11)) i (sym_eq nat i n H10)))) c1 +(sym_eq C c1 c0 H6) H7 H8 H4 H5)))) | (tau0_abst c1 d0 v i H4 w H5) +\Rightarrow (\lambda (H6: (eq C c1 c0)).(\lambda (H7: (eq T (TLRef i) (TLRef +n))).(\lambda (H8: (eq T (lift (S i) O v) t2)).(eq_ind C c0 (\lambda (c2: +C).((eq T (TLRef i) (TLRef n)) \to ((eq T (lift (S i) O v) t2) \to ((getl i +c2 (CHead d0 (Bind Abst) v)) \to ((tau0 g d0 v w) \to (ty3 g c0 (TLRef n) +t2)))))) (\lambda (H9: (eq T (TLRef i) (TLRef n))).(let H10 \def (f_equal T +nat (\lambda (e: T).(match e in T return (\lambda (_: T).nat) with [(TSort _) +\Rightarrow i | (TLRef n0) \Rightarrow n0 | (THead _ _ _) \Rightarrow i])) +(TLRef i) (TLRef n) H9) in (eq_ind nat n (\lambda (n0: nat).((eq T (lift (S +n0) O v) t2) \to ((getl n0 c0 (CHead d0 (Bind Abst) v)) \to ((tau0 g d0 v w) +\to (ty3 g c0 (TLRef n) t2))))) (\lambda (H11: (eq T (lift (S n) O v) +t2)).(eq_ind T (lift (S n) O v) (\lambda (t0: T).((getl n c0 (CHead d0 (Bind +Abst) v)) \to ((tau0 g d0 v w) \to (ty3 g c0 (TLRef n) t0)))) (\lambda (H12: +(getl n c0 (CHead d0 (Bind Abst) v))).(\lambda (H13: (tau0 g d0 v w)).(let +H14 \def (eq_ind C (CHead d (Bind Abst) u0) (\lambda (c2: C).(getl n c0 c2)) +H0 (CHead d0 (Bind Abst) v) (getl_mono c0 (CHead d (Bind Abst) u0) n H0 +(CHead d0 (Bind Abst) v) H12)) in (let H15 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow d | +(CHead c2 _ _) \Rightarrow c2])) (CHead d (Bind Abst) u0) (CHead d0 (Bind +Abst) v) (getl_mono c0 (CHead d (Bind Abst) u0) n H0 (CHead d0 (Bind Abst) v) +H12)) in ((let H16 \def (f_equal C T (\lambda (e: C).(match e in C return +(\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | (CHead _ _ t0) +\Rightarrow t0])) (CHead d (Bind Abst) u0) (CHead d0 (Bind Abst) v) +(getl_mono c0 (CHead d (Bind Abst) u0) n H0 (CHead d0 (Bind Abst) v) H12)) in +(\lambda (H17: (eq C d d0)).(let H18 \def (eq_ind_r T v (\lambda (t0: +T).(getl n c0 (CHead d0 (Bind Abst) t0))) H14 u0 H16) in (let H19 \def +(eq_ind_r T v (\lambda (t0: T).(tau0 g d0 t0 w)) H13 u0 H16) in (eq_ind T u0 +(\lambda (t0: T).(ty3 g c0 (TLRef n) (lift (S n) O t0))) (let H20 \def +(eq_ind_r C d0 (\lambda (c2: C).(getl n c0 (CHead c2 (Bind Abst) u0))) H18 d +H17) in (let H21 \def (eq_ind_r C d0 (\lambda (c2: C).(tau0 g c2 u0 w)) H19 d +H17) in (ty3_abst g n c0 d u0 H20 t H1))) v H16))))) H15))))) t2 H11)) i +(sym_eq nat i n H10)))) c1 (sym_eq C c1 c0 H6) H7 H8 H4 H5)))) | (tau0_bind b +c1 v t0 t3 H4) \Rightarrow (\lambda (H5: (eq C c1 c0)).(\lambda (H6: (eq T +(THead (Bind b) v t0) (TLRef n))).(\lambda (H7: (eq T (THead (Bind b) v t3) +t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (THead (Bind b) v t0) (TLRef n)) +\to ((eq T (THead (Bind b) v t3) t2) \to ((tau0 g (CHead c2 (Bind b) v) t0 +t3) \to (ty3 g c0 (TLRef n) t2))))) (\lambda (H8: (eq T (THead (Bind b) v t0) +(TLRef n))).(let H9 \def (eq_ind T (THead (Bind b) v t0) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow True])) I +(TLRef n) H8) in (False_ind ((eq T (THead (Bind b) v t3) t2) \to ((tau0 g +(CHead c0 (Bind b) v) t0 t3) \to (ty3 g c0 (TLRef n) t2))) H9))) c1 (sym_eq C +c1 c0 H5) H6 H7 H4)))) | (tau0_appl c1 v t0 t3 H4) \Rightarrow (\lambda (H5: +(eq C c1 c0)).(\lambda (H6: (eq T (THead (Flat Appl) v t0) (TLRef +n))).(\lambda (H7: (eq T (THead (Flat Appl) v t3) t2)).(eq_ind C c0 (\lambda +(c2: C).((eq T (THead (Flat Appl) v t0) (TLRef n)) \to ((eq T (THead (Flat +Appl) v t3) t2) \to ((tau0 g c2 t0 t3) \to (ty3 g c0 (TLRef n) t2))))) +(\lambda (H8: (eq T (THead (Flat Appl) v t0) (TLRef n))).(let H9 \def (eq_ind +T (THead (Flat Appl) v t0) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead _ _ _) \Rightarrow True])) I (TLRef n) H8) in (False_ind ((eq T (THead +(Flat Appl) v t3) t2) \to ((tau0 g c0 t0 t3) \to (ty3 g c0 (TLRef n) t2))) +H9))) c1 (sym_eq C c1 c0 H5) H6 H7 H4)))) | (tau0_cast c1 v1 v2 H4 t0 t3 H5) +\Rightarrow (\lambda (H6: (eq C c1 c0)).(\lambda (H7: (eq T (THead (Flat +Cast) v1 t0) (TLRef n))).(\lambda (H8: (eq T (THead (Flat Cast) v2 t3) +t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (THead (Flat Cast) v1 t0) (TLRef +n)) \to ((eq T (THead (Flat Cast) v2 t3) t2) \to ((tau0 g c2 v1 v2) \to +((tau0 g c2 t0 t3) \to (ty3 g c0 (TLRef n) t2)))))) (\lambda (H9: (eq T +(THead (Flat Cast) v1 t0) (TLRef n))).(let H10 \def (eq_ind T (THead (Flat +Cast) v1 t0) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead _ _ _) +\Rightarrow True])) I (TLRef n) H9) in (False_ind ((eq T (THead (Flat Cast) +v2 t3) t2) \to ((tau0 g c0 v1 v2) \to ((tau0 g c0 t0 t3) \to (ty3 g c0 (TLRef +n) t2)))) H10))) c1 (sym_eq C c1 c0 H6) H7 H8 H4 H5))))]) in (H4 (refl_equal +C c0) (refl_equal T (TLRef n)) (refl_equal T t2))))))))))))) (\lambda (c0: +C).(\lambda (u0: T).(\lambda (t: T).(\lambda (H0: (ty3 g c0 u0 t)).(\lambda +(_: ((\forall (t2: T).((tau0 g c0 u0 t2) \to (ty3 g c0 u0 t2))))).(\lambda +(b: B).(\lambda (t2: T).(\lambda (t3: T).(\lambda (_: (ty3 g (CHead c0 (Bind +b) u0) t2 t3)).(\lambda (H3: ((\forall (t4: T).((tau0 g (CHead c0 (Bind b) +u0) t2 t4) \to (ty3 g (CHead c0 (Bind b) u0) t2 t4))))).(\lambda (t0: +T).(\lambda (_: (ty3 g (CHead c0 (Bind b) u0) t3 t0)).(\lambda (_: ((\forall +(t4: T).((tau0 g (CHead c0 (Bind b) u0) t3 t4) \to (ty3 g (CHead c0 (Bind b) +u0) t3 t4))))).(\lambda (t4: T).(\lambda (H6: (tau0 g c0 (THead (Bind b) u0 +t2) t4)).(let H7 \def (match H6 in tau0 return (\lambda (c1: C).(\lambda (t5: +T).(\lambda (t6: T).(\lambda (_: (tau0 ? c1 t5 t6)).((eq C c1 c0) \to ((eq T +t5 (THead (Bind b) u0 t2)) \to ((eq T t6 t4) \to (ty3 g c0 (THead (Bind b) u0 +t2) t4)))))))) with [(tau0_sort c1 n) \Rightarrow (\lambda (H7: (eq C c1 +c0)).(\lambda (H8: (eq T (TSort n) (THead (Bind b) u0 t2))).(\lambda (H9: (eq +T (TSort (next g n)) t4)).(eq_ind C c0 (\lambda (_: C).((eq T (TSort n) +(THead (Bind b) u0 t2)) \to ((eq T (TSort (next g n)) t4) \to (ty3 g c0 +(THead (Bind b) u0 t2) t4)))) (\lambda (H10: (eq T (TSort n) (THead (Bind b) +u0 t2))).(let H11 \def (eq_ind T (TSort n) (\lambda (e: T).(match e in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow False])) I (THead (Bind b) u0 +t2) H10) in (False_ind ((eq T (TSort (next g n)) t4) \to (ty3 g c0 (THead +(Bind b) u0 t2) t4)) H11))) c1 (sym_eq C c1 c0 H7) H8 H9)))) | (tau0_abbr c1 +d v i H7 w H8) \Rightarrow (\lambda (H9: (eq C c1 c0)).(\lambda (H10: (eq T +(TLRef i) (THead (Bind b) u0 t2))).(\lambda (H11: (eq T (lift (S i) O w) +t4)).(eq_ind C c0 (\lambda (c2: C).((eq T (TLRef i) (THead (Bind b) u0 t2)) +\to ((eq T (lift (S i) O w) t4) \to ((getl i c2 (CHead d (Bind Abbr) v)) \to +((tau0 g d v w) \to (ty3 g c0 (THead (Bind b) u0 t2) t4)))))) (\lambda (H12: +(eq T (TLRef i) (THead (Bind b) u0 t2))).(let H13 \def (eq_ind T (TLRef i) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow +False])) I (THead (Bind b) u0 t2) H12) in (False_ind ((eq T (lift (S i) O w) +t4) \to ((getl i c0 (CHead d (Bind Abbr) v)) \to ((tau0 g d v w) \to (ty3 g +c0 (THead (Bind b) u0 t2) t4)))) H13))) c1 (sym_eq C c1 c0 H9) H10 H11 H7 +H8)))) | (tau0_abst c1 d v i H7 w H8) \Rightarrow (\lambda (H9: (eq C c1 +c0)).(\lambda (H10: (eq T (TLRef i) (THead (Bind b) u0 t2))).(\lambda (H11: +(eq T (lift (S i) O v) t4)).(eq_ind C c0 (\lambda (c2: C).((eq T (TLRef i) +(THead (Bind b) u0 t2)) \to ((eq T (lift (S i) O v) t4) \to ((getl i c2 +(CHead d (Bind Abst) v)) \to ((tau0 g d v w) \to (ty3 g c0 (THead (Bind b) u0 +t2) t4)))))) (\lambda (H12: (eq T (TLRef i) (THead (Bind b) u0 t2))).(let H13 +\def (eq_ind T (TLRef i) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | +(THead _ _ _) \Rightarrow False])) I (THead (Bind b) u0 t2) H12) in +(False_ind ((eq T (lift (S i) O v) t4) \to ((getl i c0 (CHead d (Bind Abst) +v)) \to ((tau0 g d v w) \to (ty3 g c0 (THead (Bind b) u0 t2) t4)))) H13))) c1 +(sym_eq C c1 c0 H9) H10 H11 H7 H8)))) | (tau0_bind b0 c1 v t5 t6 H7) +\Rightarrow (\lambda (H8: (eq C c1 c0)).(\lambda (H9: (eq T (THead (Bind b0) +v t5) (THead (Bind b) u0 t2))).(\lambda (H10: (eq T (THead (Bind b0) v t6) +t4)).(eq_ind C c0 (\lambda (c2: C).((eq T (THead (Bind b0) v t5) (THead (Bind +b) u0 t2)) \to ((eq T (THead (Bind b0) v t6) t4) \to ((tau0 g (CHead c2 (Bind +b0) v) t5 t6) \to (ty3 g c0 (THead (Bind b) u0 t2) t4))))) (\lambda (H11: (eq +T (THead (Bind b0) v t5) (THead (Bind b) u0 t2))).(let H12 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t5 | (TLRef _) \Rightarrow t5 | (THead _ _ t7) \Rightarrow t7])) +(THead (Bind b0) v t5) (THead (Bind b) u0 t2) H11) in ((let H13 \def (f_equal +T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow v | (TLRef _) \Rightarrow v | (THead _ t7 _) \Rightarrow t7])) +(THead (Bind b0) v t5) (THead (Bind b) u0 t2) H11) in ((let H14 \def (f_equal +T B (\lambda (e: T).(match e in T return (\lambda (_: T).B) with [(TSort _) +\Rightarrow b0 | (TLRef _) \Rightarrow b0 | (THead k _ _) \Rightarrow (match +k in K return (\lambda (_: K).B) with [(Bind b1) \Rightarrow b1 | (Flat _) +\Rightarrow b0])])) (THead (Bind b0) v t5) (THead (Bind b) u0 t2) H11) in +(eq_ind B b (\lambda (b1: B).((eq T v u0) \to ((eq T t5 t2) \to ((eq T (THead +(Bind b1) v t6) t4) \to ((tau0 g (CHead c0 (Bind b1) v) t5 t6) \to (ty3 g c0 +(THead (Bind b) u0 t2) t4)))))) (\lambda (H15: (eq T v u0)).(eq_ind T u0 +(\lambda (t7: T).((eq T t5 t2) \to ((eq T (THead (Bind b) t7 t6) t4) \to +((tau0 g (CHead c0 (Bind b) t7) t5 t6) \to (ty3 g c0 (THead (Bind b) u0 t2) +t4))))) (\lambda (H16: (eq T t5 t2)).(eq_ind T t2 (\lambda (t7: T).((eq T +(THead (Bind b) u0 t6) t4) \to ((tau0 g (CHead c0 (Bind b) u0) t7 t6) \to +(ty3 g c0 (THead (Bind b) u0 t2) t4)))) (\lambda (H17: (eq T (THead (Bind b) +u0 t6) t4)).(eq_ind T (THead (Bind b) u0 t6) (\lambda (t7: T).((tau0 g (CHead +c0 (Bind b) u0) t2 t6) \to (ty3 g c0 (THead (Bind b) u0 t2) t7))) (\lambda +(H18: (tau0 g (CHead c0 (Bind b) u0) t2 t6)).(let H_y \def (H3 t6 H18) in +(ex_ind T (\lambda (t7: T).(ty3 g (CHead c0 (Bind b) u0) t6 t7)) (ty3 g c0 +(THead (Bind b) u0 t2) (THead (Bind b) u0 t6)) (\lambda (x: T).(\lambda (H19: +(ty3 g (CHead c0 (Bind b) u0) t6 x)).(ty3_bind g c0 u0 t H0 b t2 t6 H_y x +H19))) (ty3_correct g (CHead c0 (Bind b) u0) t2 t6 H_y)))) t4 H17)) t5 +(sym_eq T t5 t2 H16))) v (sym_eq T v u0 H15))) b0 (sym_eq B b0 b H14))) H13)) +H12))) c1 (sym_eq C c1 c0 H8) H9 H10 H7)))) | (tau0_appl c1 v t5 t6 H7) +\Rightarrow (\lambda (H8: (eq C c1 c0)).(\lambda (H9: (eq T (THead (Flat +Appl) v t5) (THead (Bind b) u0 t2))).(\lambda (H10: (eq T (THead (Flat Appl) +v t6) t4)).(eq_ind C c0 (\lambda (c2: C).((eq T (THead (Flat Appl) v t5) +(THead (Bind b) u0 t2)) \to ((eq T (THead (Flat Appl) v t6) t4) \to ((tau0 g +c2 t5 t6) \to (ty3 g c0 (THead (Bind b) u0 t2) t4))))) (\lambda (H11: (eq T +(THead (Flat Appl) v t5) (THead (Bind b) u0 t2))).(let H12 \def (eq_ind T +(THead (Flat Appl) v t5) (\lambda (e: T).(match e in T return (\lambda (_: +T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | +(THead k _ _) \Rightarrow (match k in K return (\lambda (_: K).Prop) with +[(Bind _) \Rightarrow False | (Flat _) \Rightarrow True])])) I (THead (Bind +b) u0 t2) H11) in (False_ind ((eq T (THead (Flat Appl) v t6) t4) \to ((tau0 g +c0 t5 t6) \to (ty3 g c0 (THead (Bind b) u0 t2) t4))) H12))) c1 (sym_eq C c1 +c0 H8) H9 H10 H7)))) | (tau0_cast c1 v1 v2 H7 t5 t6 H8) \Rightarrow (\lambda +(H9: (eq C c1 c0)).(\lambda (H10: (eq T (THead (Flat Cast) v1 t5) (THead +(Bind b) u0 t2))).(\lambda (H11: (eq T (THead (Flat Cast) v2 t6) t4)).(eq_ind +C c0 (\lambda (c2: C).((eq T (THead (Flat Cast) v1 t5) (THead (Bind b) u0 +t2)) \to ((eq T (THead (Flat Cast) v2 t6) t4) \to ((tau0 g c2 v1 v2) \to +((tau0 g c2 t5 t6) \to (ty3 g c0 (THead (Bind b) u0 t2) t4)))))) (\lambda +(H12: (eq T (THead (Flat Cast) v1 t5) (THead (Bind b) u0 t2))).(let H13 \def +(eq_ind T (THead (Flat Cast) v1 t5) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow False | (THead k _ _) \Rightarrow (match k in K return (\lambda +(_: K).Prop) with [(Bind _) \Rightarrow False | (Flat _) \Rightarrow +True])])) I (THead (Bind b) u0 t2) H12) in (False_ind ((eq T (THead (Flat +Cast) v2 t6) t4) \to ((tau0 g c0 v1 v2) \to ((tau0 g c0 t5 t6) \to (ty3 g c0 +(THead (Bind b) u0 t2) t4)))) H13))) c1 (sym_eq C c1 c0 H9) H10 H11 H7 +H8))))]) in (H7 (refl_equal C c0) (refl_equal T (THead (Bind b) u0 t2)) +(refl_equal T t4)))))))))))))))))) (\lambda (c0: C).(\lambda (w: T).(\lambda +(u0: T).(\lambda (H0: (ty3 g c0 w u0)).(\lambda (_: ((\forall (t2: T).((tau0 +g c0 w t2) \to (ty3 g c0 w t2))))).(\lambda (v: T).(\lambda (t: T).(\lambda +(H2: (ty3 g c0 v (THead (Bind Abst) u0 t))).(\lambda (H3: ((\forall (t2: +T).((tau0 g c0 v t2) \to (ty3 g c0 v t2))))).(\lambda (t2: T).(\lambda (H4: +(tau0 g c0 (THead (Flat Appl) w v) t2)).(let H5 \def (match H4 in tau0 return +(\lambda (c1: C).(\lambda (t0: T).(\lambda (t3: T).(\lambda (_: (tau0 ? c1 t0 +t3)).((eq C c1 c0) \to ((eq T t0 (THead (Flat Appl) w v)) \to ((eq T t3 t2) +\to (ty3 g c0 (THead (Flat Appl) w v) t2)))))))) with [(tau0_sort c1 n) +\Rightarrow (\lambda (H5: (eq C c1 c0)).(\lambda (H6: (eq T (TSort n) (THead +(Flat Appl) w v))).(\lambda (H7: (eq T (TSort (next g n)) t2)).(eq_ind C c0 +(\lambda (_: C).((eq T (TSort n) (THead (Flat Appl) w v)) \to ((eq T (TSort +(next g n)) t2) \to (ty3 g c0 (THead (Flat Appl) w v) t2)))) (\lambda (H8: +(eq T (TSort n) (THead (Flat Appl) w v))).(let H9 \def (eq_ind T (TSort n) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow True | (TLRef _) \Rightarrow False | (THead _ _ _) \Rightarrow +False])) I (THead (Flat Appl) w v) H8) in (False_ind ((eq T (TSort (next g +n)) t2) \to (ty3 g c0 (THead (Flat Appl) w v) t2)) H9))) c1 (sym_eq C c1 c0 +H5) H6 H7)))) | (tau0_abbr c1 d v0 i H5 w0 H6) \Rightarrow (\lambda (H7: (eq +C c1 c0)).(\lambda (H8: (eq T (TLRef i) (THead (Flat Appl) w v))).(\lambda +(H9: (eq T (lift (S i) O w0) t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (TLRef +i) (THead (Flat Appl) w v)) \to ((eq T (lift (S i) O w0) t2) \to ((getl i c2 +(CHead d (Bind Abbr) v0)) \to ((tau0 g d v0 w0) \to (ty3 g c0 (THead (Flat +Appl) w v) t2)))))) (\lambda (H10: (eq T (TLRef i) (THead (Flat Appl) w +v))).(let H11 \def (eq_ind T (TLRef i) (\lambda (e: T).(match e in T return +(\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | (TLRef _) +\Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead (Flat Appl) w +v) H10) in (False_ind ((eq T (lift (S i) O w0) t2) \to ((getl i c0 (CHead d +(Bind Abbr) v0)) \to ((tau0 g d v0 w0) \to (ty3 g c0 (THead (Flat Appl) w v) +t2)))) H11))) c1 (sym_eq C c1 c0 H7) H8 H9 H5 H6)))) | (tau0_abst c1 d v0 i +H5 w0 H6) \Rightarrow (\lambda (H7: (eq C c1 c0)).(\lambda (H8: (eq T (TLRef +i) (THead (Flat Appl) w v))).(\lambda (H9: (eq T (lift (S i) O v0) +t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (TLRef i) (THead (Flat Appl) w v)) +\to ((eq T (lift (S i) O v0) t2) \to ((getl i c2 (CHead d (Bind Abst) v0)) +\to ((tau0 g d v0 w0) \to (ty3 g c0 (THead (Flat Appl) w v) t2)))))) (\lambda +(H10: (eq T (TLRef i) (THead (Flat Appl) w v))).(let H11 \def (eq_ind T +(TLRef i) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) +\Rightarrow False])) I (THead (Flat Appl) w v) H10) in (False_ind ((eq T +(lift (S i) O v0) t2) \to ((getl i c0 (CHead d (Bind Abst) v0)) \to ((tau0 g +d v0 w0) \to (ty3 g c0 (THead (Flat Appl) w v) t2)))) H11))) c1 (sym_eq C c1 +c0 H7) H8 H9 H5 H6)))) | (tau0_bind b c1 v0 t0 t3 H5) \Rightarrow (\lambda +(H6: (eq C c1 c0)).(\lambda (H7: (eq T (THead (Bind b) v0 t0) (THead (Flat +Appl) w v))).(\lambda (H8: (eq T (THead (Bind b) v0 t3) t2)).(eq_ind C c0 +(\lambda (c2: C).((eq T (THead (Bind b) v0 t0) (THead (Flat Appl) w v)) \to +((eq T (THead (Bind b) v0 t3) t2) \to ((tau0 g (CHead c2 (Bind b) v0) t0 t3) +\to (ty3 g c0 (THead (Flat Appl) w v) t2))))) (\lambda (H9: (eq T (THead +(Bind b) v0 t0) (THead (Flat Appl) w v))).(let H10 \def (eq_ind T (THead +(Bind b) v0 t0) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ +_) \Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow True | (Flat _) \Rightarrow False])])) I (THead (Flat Appl) w v) +H9) in (False_ind ((eq T (THead (Bind b) v0 t3) t2) \to ((tau0 g (CHead c0 +(Bind b) v0) t0 t3) \to (ty3 g c0 (THead (Flat Appl) w v) t2))) H10))) c1 +(sym_eq C c1 c0 H6) H7 H8 H5)))) | (tau0_appl c1 v0 t0 t3 H5) \Rightarrow +(\lambda (H6: (eq C c1 c0)).(\lambda (H7: (eq T (THead (Flat Appl) v0 t0) +(THead (Flat Appl) w v))).(\lambda (H8: (eq T (THead (Flat Appl) v0 t3) +t2)).(eq_ind C c0 (\lambda (c2: C).((eq T (THead (Flat Appl) v0 t0) (THead +(Flat Appl) w v)) \to ((eq T (THead (Flat Appl) v0 t3) t2) \to ((tau0 g c2 t0 +t3) \to (ty3 g c0 (THead (Flat Appl) w v) t2))))) (\lambda (H9: (eq T (THead +(Flat Appl) v0 t0) (THead (Flat Appl) w v))).(let H10 \def (f_equal T T +(\lambda (e: T).(match e in T return (\lambda (_: T).T) with [(TSort _) +\Rightarrow t0 | (TLRef _) \Rightarrow t0 | (THead _ _ t4) \Rightarrow t4])) +(THead (Flat Appl) v0 t0) (THead (Flat Appl) w v) H9) in ((let H11 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow v0 | (TLRef _) \Rightarrow v0 | (THead _ t4 _) +\Rightarrow t4])) (THead (Flat Appl) v0 t0) (THead (Flat Appl) w v) H9) in +(eq_ind T w (\lambda (t4: T).((eq T t0 v) \to ((eq T (THead (Flat Appl) t4 +t3) t2) \to ((tau0 g c0 t0 t3) \to (ty3 g c0 (THead (Flat Appl) w v) t2))))) +(\lambda (H12: (eq T t0 v)).(eq_ind T v (\lambda (t4: T).((eq T (THead (Flat +Appl) w t3) t2) \to ((tau0 g c0 t4 t3) \to (ty3 g c0 (THead (Flat Appl) w v) +t2)))) (\lambda (H13: (eq T (THead (Flat Appl) w t3) t2)).(eq_ind T (THead +(Flat Appl) w t3) (\lambda (t4: T).((tau0 g c0 v t3) \to (ty3 g c0 (THead +(Flat Appl) w v) t4))) (\lambda (H14: (tau0 g c0 v t3)).(let H_y \def (H3 t3 +H14) in (let H15 \def (ty3_unique g c0 v t3 H_y (THead (Bind Abst) u0 t) H2) +in (ex_ind T (\lambda (t4: T).(ty3 g c0 t3 t4)) (ty3 g c0 (THead (Flat Appl) +w v) (THead (Flat Appl) w t3)) (\lambda (x: T).(\lambda (H16: (ty3 g c0 t3 +x)).(ex_ind T (\lambda (t4: T).(ty3 g c0 u0 t4)) (ty3 g c0 (THead (Flat Appl) +w v) (THead (Flat Appl) w t3)) (\lambda (x0: T).(\lambda (_: (ty3 g c0 u0 +x0)).(ex_ind T (\lambda (t4: T).(ty3 g c0 (THead (Bind Abst) u0 t) t4)) (ty3 +g c0 (THead (Flat Appl) w v) (THead (Flat Appl) w t3)) (\lambda (x1: +T).(\lambda (H18: (ty3 g c0 (THead (Bind Abst) u0 t) x1)).(ex4_3_ind T T T +(\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(pc3 c0 (THead (Bind Abst) +u0 t4) x1)))) (\lambda (_: T).(\lambda (t5: T).(\lambda (_: T).(ty3 g c0 u0 +t5)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (_: T).(ty3 g (CHead c0 +(Bind Abst) u0) t t4)))) (\lambda (t4: T).(\lambda (_: T).(\lambda (t6: +T).(ty3 g (CHead c0 (Bind Abst) u0) t4 t6)))) (ty3 g c0 (THead (Flat Appl) w +v) (THead (Flat Appl) w t3)) (\lambda (x2: T).(\lambda (x3: T).(\lambda (x4: +T).(\lambda (_: (pc3 c0 (THead (Bind Abst) u0 x2) x1)).(\lambda (H20: (ty3 g +c0 u0 x3)).(\lambda (H21: (ty3 g (CHead c0 (Bind Abst) u0) t x2)).(\lambda +(H22: (ty3 g (CHead c0 (Bind Abst) u0) x2 x4)).(ty3_conv g c0 (THead (Flat +Appl) w t3) (THead (Flat Appl) w (THead (Bind Abst) u0 x2)) (ty3_appl g c0 w +u0 H0 t3 x2 (ty3_sconv g c0 t3 x H16 (THead (Bind Abst) u0 t) (THead (Bind +Abst) u0 x2) (ty3_bind g c0 u0 x3 H20 Abst t x2 H21 x4 H22) H15)) (THead +(Flat Appl) w v) (THead (Flat Appl) w (THead (Bind Abst) u0 t)) (ty3_appl g +c0 w u0 H0 v t H2) (pc3_thin_dx c0 (THead (Bind Abst) u0 t) t3 (ty3_unique g +c0 v (THead (Bind Abst) u0 t) H2 t3 H_y) w Appl))))))))) (ty3_gen_bind g Abst +c0 u0 t x1 H18)))) (ty3_correct g c0 v (THead (Bind Abst) u0 t) H2)))) +(ty3_correct g c0 w u0 H0)))) (ty3_correct g c0 v t3 H_y))))) t2 H13)) t0 +(sym_eq T t0 v H12))) v0 (sym_eq T v0 w H11))) H10))) c1 (sym_eq C c1 c0 H6) +H7 H8 H5)))) | (tau0_cast c1 v1 v2 H5 t0 t3 H6) \Rightarrow (\lambda (H7: (eq +C c1 c0)).(\lambda (H8: (eq T (THead (Flat Cast) v1 t0) (THead (Flat Appl) w +v))).(\lambda (H9: (eq T (THead (Flat Cast) v2 t3) t2)).(eq_ind C c0 (\lambda +(c2: C).((eq T (THead (Flat Cast) v1 t0) (THead (Flat Appl) w v)) \to ((eq T +(THead (Flat Cast) v2 t3) t2) \to ((tau0 g c2 v1 v2) \to ((tau0 g c2 t0 t3) +\to (ty3 g c0 (THead (Flat Appl) w v) t2)))))) (\lambda (H10: (eq T (THead +(Flat Cast) v1 t0) (THead (Flat Appl) w v))).(let H11 \def (eq_ind T (THead +(Flat Cast) v1 t0) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) +with [(TSort _) \Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ +_) \Rightarrow (match k in K return (\lambda (_: K).Prop) with [(Bind _) +\Rightarrow False | (Flat f) \Rightarrow (match f in F return (\lambda (_: +F).Prop) with [Appl \Rightarrow False | Cast \Rightarrow True])])])) I (THead +(Flat Appl) w v) H10) in (False_ind ((eq T (THead (Flat Cast) v2 t3) t2) \to +((tau0 g c0 v1 v2) \to ((tau0 g c0 t0 t3) \to (ty3 g c0 (THead (Flat Appl) w +v) t2)))) H11))) c1 (sym_eq C c1 c0 H7) H8 H9 H5 H6))))]) in (H5 (refl_equal +C c0) (refl_equal T (THead (Flat Appl) w v)) (refl_equal T t2)))))))))))))) +(\lambda (c0: C).(\lambda (t2: T).(\lambda (t3: T).(\lambda (H0: (ty3 g c0 t2 +t3)).(\lambda (H1: ((\forall (t4: T).((tau0 g c0 t2 t4) \to (ty3 g c0 t2 +t4))))).(\lambda (t0: T).(\lambda (_: (ty3 g c0 t3 t0)).(\lambda (H3: +((\forall (t4: T).((tau0 g c0 t3 t4) \to (ty3 g c0 t3 t4))))).(\lambda (t4: +T).(\lambda (H4: (tau0 g c0 (THead (Flat Cast) t3 t2) t4)).(let H5 \def +(match H4 in tau0 return (\lambda (c1: C).(\lambda (t: T).(\lambda (t5: +T).(\lambda (_: (tau0 ? c1 t t5)).((eq C c1 c0) \to ((eq T t (THead (Flat +Cast) t3 t2)) \to ((eq T t5 t4) \to (ty3 g c0 (THead (Flat Cast) t3 t2) +t4)))))))) with [(tau0_sort c1 n) \Rightarrow (\lambda (H5: (eq C c1 +c0)).(\lambda (H6: (eq T (TSort n) (THead (Flat Cast) t3 t2))).(\lambda (H7: +(eq T (TSort (next g n)) t4)).(eq_ind C c0 (\lambda (_: C).((eq T (TSort n) +(THead (Flat Cast) t3 t2)) \to ((eq T (TSort (next g n)) t4) \to (ty3 g c0 +(THead (Flat Cast) t3 t2) t4)))) (\lambda (H8: (eq T (TSort n) (THead (Flat +Cast) t3 t2))).(let H9 \def (eq_ind T (TSort n) (\lambda (e: T).(match e in T +return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow True | (TLRef _) +\Rightarrow False | (THead _ _ _) \Rightarrow False])) I (THead (Flat Cast) +t3 t2) H8) in (False_ind ((eq T (TSort (next g n)) t4) \to (ty3 g c0 (THead +(Flat Cast) t3 t2) t4)) H9))) c1 (sym_eq C c1 c0 H5) H6 H7)))) | (tau0_abbr +c1 d v i H5 w H6) \Rightarrow (\lambda (H7: (eq C c1 c0)).(\lambda (H8: (eq T +(TLRef i) (THead (Flat Cast) t3 t2))).(\lambda (H9: (eq T (lift (S i) O w) +t4)).(eq_ind C c0 (\lambda (c2: C).((eq T (TLRef i) (THead (Flat Cast) t3 +t2)) \to ((eq T (lift (S i) O w) t4) \to ((getl i c2 (CHead d (Bind Abbr) v)) +\to ((tau0 g d v w) \to (ty3 g c0 (THead (Flat Cast) t3 t2) t4)))))) (\lambda +(H10: (eq T (TLRef i) (THead (Flat Cast) t3 t2))).(let H11 \def (eq_ind T +(TLRef i) (\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with +[(TSort _) \Rightarrow False | (TLRef _) \Rightarrow True | (THead _ _ _) +\Rightarrow False])) I (THead (Flat Cast) t3 t2) H10) in (False_ind ((eq T +(lift (S i) O w) t4) \to ((getl i c0 (CHead d (Bind Abbr) v)) \to ((tau0 g d +v w) \to (ty3 g c0 (THead (Flat Cast) t3 t2) t4)))) H11))) c1 (sym_eq C c1 c0 +H7) H8 H9 H5 H6)))) | (tau0_abst c1 d v i H5 w H6) \Rightarrow (\lambda (H7: +(eq C c1 c0)).(\lambda (H8: (eq T (TLRef i) (THead (Flat Cast) t3 +t2))).(\lambda (H9: (eq T (lift (S i) O v) t4)).(eq_ind C c0 (\lambda (c2: +C).((eq T (TLRef i) (THead (Flat Cast) t3 t2)) \to ((eq T (lift (S i) O v) +t4) \to ((getl i c2 (CHead d (Bind Abst) v)) \to ((tau0 g d v w) \to (ty3 g +c0 (THead (Flat Cast) t3 t2) t4)))))) (\lambda (H10: (eq T (TLRef i) (THead +(Flat Cast) t3 t2))).(let H11 \def (eq_ind T (TLRef i) (\lambda (e: T).(match +e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow False | +(TLRef _) \Rightarrow True | (THead _ _ _) \Rightarrow False])) I (THead +(Flat Cast) t3 t2) H10) in (False_ind ((eq T (lift (S i) O v) t4) \to ((getl +i c0 (CHead d (Bind Abst) v)) \to ((tau0 g d v w) \to (ty3 g c0 (THead (Flat +Cast) t3 t2) t4)))) H11))) c1 (sym_eq C c1 c0 H7) H8 H9 H5 H6)))) | +(tau0_bind b c1 v t5 t6 H5) \Rightarrow (\lambda (H6: (eq C c1 c0)).(\lambda +(H7: (eq T (THead (Bind b) v t5) (THead (Flat Cast) t3 t2))).(\lambda (H8: +(eq T (THead (Bind b) v t6) t4)).(eq_ind C c0 (\lambda (c2: C).((eq T (THead +(Bind b) v t5) (THead (Flat Cast) t3 t2)) \to ((eq T (THead (Bind b) v t6) +t4) \to ((tau0 g (CHead c2 (Bind b) v) t5 t6) \to (ty3 g c0 (THead (Flat +Cast) t3 t2) t4))))) (\lambda (H9: (eq T (THead (Bind b) v t5) (THead (Flat +Cast) t3 t2))).(let H10 \def (eq_ind T (THead (Bind b) v t5) (\lambda (e: +T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) \Rightarrow +False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow (match k in K +return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow True | (Flat _) +\Rightarrow False])])) I (THead (Flat Cast) t3 t2) H9) in (False_ind ((eq T +(THead (Bind b) v t6) t4) \to ((tau0 g (CHead c0 (Bind b) v) t5 t6) \to (ty3 +g c0 (THead (Flat Cast) t3 t2) t4))) H10))) c1 (sym_eq C c1 c0 H6) H7 H8 +H5)))) | (tau0_appl c1 v t5 t6 H5) \Rightarrow (\lambda (H6: (eq C c1 +c0)).(\lambda (H7: (eq T (THead (Flat Appl) v t5) (THead (Flat Cast) t3 +t2))).(\lambda (H8: (eq T (THead (Flat Appl) v t6) t4)).(eq_ind C c0 (\lambda +(c2: C).((eq T (THead (Flat Appl) v t5) (THead (Flat Cast) t3 t2)) \to ((eq T +(THead (Flat Appl) v t6) t4) \to ((tau0 g c2 t5 t6) \to (ty3 g c0 (THead +(Flat Cast) t3 t2) t4))))) (\lambda (H9: (eq T (THead (Flat Appl) v t5) +(THead (Flat Cast) t3 t2))).(let H10 \def (eq_ind T (THead (Flat Appl) v t5) +(\lambda (e: T).(match e in T return (\lambda (_: T).Prop) with [(TSort _) +\Rightarrow False | (TLRef _) \Rightarrow False | (THead k _ _) \Rightarrow +(match k in K return (\lambda (_: K).Prop) with [(Bind _) \Rightarrow False | +(Flat f) \Rightarrow (match f in F return (\lambda (_: F).Prop) with [Appl +\Rightarrow True | Cast \Rightarrow False])])])) I (THead (Flat Cast) t3 t2) +H9) in (False_ind ((eq T (THead (Flat Appl) v t6) t4) \to ((tau0 g c0 t5 t6) +\to (ty3 g c0 (THead (Flat Cast) t3 t2) t4))) H10))) c1 (sym_eq C c1 c0 H6) +H7 H8 H5)))) | (tau0_cast c1 v1 v2 H5 t5 t6 H6) \Rightarrow (\lambda (H7: (eq +C c1 c0)).(\lambda (H8: (eq T (THead (Flat Cast) v1 t5) (THead (Flat Cast) t3 +t2))).(\lambda (H9: (eq T (THead (Flat Cast) v2 t6) t4)).(eq_ind C c0 +(\lambda (c2: C).((eq T (THead (Flat Cast) v1 t5) (THead (Flat Cast) t3 t2)) +\to ((eq T (THead (Flat Cast) v2 t6) t4) \to ((tau0 g c2 v1 v2) \to ((tau0 g +c2 t5 t6) \to (ty3 g c0 (THead (Flat Cast) t3 t2) t4)))))) (\lambda (H10: (eq +T (THead (Flat Cast) v1 t5) (THead (Flat Cast) t3 t2))).(let H11 \def +(f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: T).T) with +[(TSort _) \Rightarrow t5 | (TLRef _) \Rightarrow t5 | (THead _ _ t) +\Rightarrow t])) (THead (Flat Cast) v1 t5) (THead (Flat Cast) t3 t2) H10) in +((let H12 \def (f_equal T T (\lambda (e: T).(match e in T return (\lambda (_: +T).T) with [(TSort _) \Rightarrow v1 | (TLRef _) \Rightarrow v1 | (THead _ t +_) \Rightarrow t])) (THead (Flat Cast) v1 t5) (THead (Flat Cast) t3 t2) H10) +in (eq_ind T t3 (\lambda (t: T).((eq T t5 t2) \to ((eq T (THead (Flat Cast) +v2 t6) t4) \to ((tau0 g c0 t v2) \to ((tau0 g c0 t5 t6) \to (ty3 g c0 (THead +(Flat Cast) t3 t2) t4)))))) (\lambda (H13: (eq T t5 t2)).(eq_ind T t2 +(\lambda (t: T).((eq T (THead (Flat Cast) v2 t6) t4) \to ((tau0 g c0 t3 v2) +\to ((tau0 g c0 t t6) \to (ty3 g c0 (THead (Flat Cast) t3 t2) t4))))) +(\lambda (H14: (eq T (THead (Flat Cast) v2 t6) t4)).(eq_ind T (THead (Flat +Cast) v2 t6) (\lambda (t: T).((tau0 g c0 t3 v2) \to ((tau0 g c0 t2 t6) \to +(ty3 g c0 (THead (Flat Cast) t3 t2) t)))) (\lambda (H15: (tau0 g c0 t3 +v2)).(\lambda (H16: (tau0 g c0 t2 t6)).(let H_y \def (H1 t6 H16) in (let H_y0 +\def (H3 v2 H15) in (let H17 \def (ty3_unique g c0 t2 t6 H_y t3 H0) in +(ex_ind T (\lambda (t: T).(ty3 g c0 v2 t)) (ty3 g c0 (THead (Flat Cast) t3 +t2) (THead (Flat Cast) v2 t6)) (\lambda (x: T).(\lambda (H18: (ty3 g c0 v2 +x)).(ex_ind T (\lambda (t: T).(ty3 g c0 t6 t)) (ty3 g c0 (THead (Flat Cast) +t3 t2) (THead (Flat Cast) v2 t6)) (\lambda (x0: T).(\lambda (H19: (ty3 g c0 +t6 x0)).(ty3_conv g c0 (THead (Flat Cast) v2 t6) (THead (Flat Cast) x v2) +(ty3_cast g c0 t6 v2 (ty3_sconv g c0 t6 x0 H19 t3 v2 H_y0 H17) x H18) (THead +(Flat Cast) t3 t2) (THead (Flat Cast) v2 t3) (ty3_cast g c0 t2 t3 H0 v2 H_y0) +(pc3_thin_dx c0 t3 t6 (ty3_unique g c0 t2 t3 H0 t6 H_y) v2 Cast)))) +(ty3_correct g c0 t2 t6 H_y)))) (ty3_correct g c0 t3 v2 H_y0))))))) t4 H14)) +t5 (sym_eq T t5 t2 H13))) v1 (sym_eq T v1 t3 H12))) H11))) c1 (sym_eq C c1 c0 +H7) H8 H9 H5 H6))))]) in (H5 (refl_equal C c0) (refl_equal T (THead (Flat +Cast) t3 t2)) (refl_equal T t4))))))))))))) c u t1 H))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/defs.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/defs.ma new file mode 100644 index 000000000..dff8bb8cc --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/defs.ma @@ -0,0 +1,28 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/wcpr0/defs". + +include "pr0/defs.ma". + +include "C/defs.ma". + +inductive wcpr0: C \to (C \to Prop) \def +| wcpr0_refl: \forall (c: C).(wcpr0 c c) +| wcpr0_comp: \forall (c1: C).(\forall (c2: C).((wcpr0 c1 c2) \to (\forall +(u1: T).(\forall (u2: T).((pr0 u1 u2) \to (\forall (k: K).(wcpr0 (CHead c1 k +u1) (CHead c2 k u2)))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/fwd.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/fwd.ma new file mode 100644 index 000000000..359d38544 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/fwd.ma @@ -0,0 +1,102 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/wcpr0/fwd". + +include "wcpr0/defs.ma". + +theorem wcpr0_gen_sort: + \forall (x: C).(\forall (n: nat).((wcpr0 (CSort n) x) \to (eq C x (CSort +n)))) +\def + \lambda (x: C).(\lambda (n: nat).(\lambda (H: (wcpr0 (CSort n) x)).(let H0 +\def (match H in wcpr0 return (\lambda (c: C).(\lambda (c0: C).(\lambda (_: +(wcpr0 c c0)).((eq C c (CSort n)) \to ((eq C c0 x) \to (eq C x (CSort +n))))))) with [(wcpr0_refl c) \Rightarrow (\lambda (H0: (eq C c (CSort +n))).(\lambda (H1: (eq C c x)).(eq_ind C (CSort n) (\lambda (c0: C).((eq C c0 +x) \to (eq C x (CSort n)))) (\lambda (H2: (eq C (CSort n) x)).(eq_ind C +(CSort n) (\lambda (c0: C).(eq C c0 (CSort n))) (refl_equal C (CSort n)) x +H2)) c (sym_eq C c (CSort n) H0) H1))) | (wcpr0_comp c1 c2 H0 u1 u2 H1 k) +\Rightarrow (\lambda (H2: (eq C (CHead c1 k u1) (CSort n))).(\lambda (H3: (eq +C (CHead c2 k u2) x)).((let H4 \def (eq_ind C (CHead c1 k u1) (\lambda (e: +C).(match e in C return (\lambda (_: C).Prop) with [(CSort _) \Rightarrow +False | (CHead _ _ _) \Rightarrow True])) I (CSort n) H2) in (False_ind ((eq +C (CHead c2 k u2) x) \to ((wcpr0 c1 c2) \to ((pr0 u1 u2) \to (eq C x (CSort +n))))) H4)) H3 H0 H1)))]) in (H0 (refl_equal C (CSort n)) (refl_equal C +x))))). + +theorem wcpr0_gen_head: + \forall (k: K).(\forall (c1: C).(\forall (x: C).(\forall (u1: T).((wcpr0 +(CHead c1 k u1) x) \to (or (eq C x (CHead c1 k u1)) (ex3_2 C T (\lambda (c2: +C).(\lambda (u2: T).(eq C x (CHead c2 k u2)))) (\lambda (c2: C).(\lambda (_: +T).(wcpr0 c1 c2))) (\lambda (_: C).(\lambda (u2: T).(pr0 u1 u2))))))))) +\def + \lambda (k: K).(\lambda (c1: C).(\lambda (x: C).(\lambda (u1: T).(\lambda +(H: (wcpr0 (CHead c1 k u1) x)).(let H0 \def (match H in wcpr0 return (\lambda +(c: C).(\lambda (c0: C).(\lambda (_: (wcpr0 c c0)).((eq C c (CHead c1 k u1)) +\to ((eq C c0 x) \to (or (eq C x (CHead c1 k u1)) (ex3_2 C T (\lambda (c2: +C).(\lambda (u2: T).(eq C x (CHead c2 k u2)))) (\lambda (c2: C).(\lambda (_: +T).(wcpr0 c1 c2))) (\lambda (_: C).(\lambda (u2: T).(pr0 u1 u2)))))))))) with +[(wcpr0_refl c) \Rightarrow (\lambda (H0: (eq C c (CHead c1 k u1))).(\lambda +(H1: (eq C c x)).(eq_ind C (CHead c1 k u1) (\lambda (c0: C).((eq C c0 x) \to +(or (eq C x (CHead c1 k u1)) (ex3_2 C T (\lambda (c2: C).(\lambda (u2: T).(eq +C x (CHead c2 k u2)))) (\lambda (c2: C).(\lambda (_: T).(wcpr0 c1 c2))) +(\lambda (_: C).(\lambda (u2: T).(pr0 u1 u2))))))) (\lambda (H2: (eq C (CHead +c1 k u1) x)).(eq_ind C (CHead c1 k u1) (\lambda (c0: C).(or (eq C c0 (CHead +c1 k u1)) (ex3_2 C T (\lambda (c2: C).(\lambda (u2: T).(eq C c0 (CHead c2 k +u2)))) (\lambda (c2: C).(\lambda (_: T).(wcpr0 c1 c2))) (\lambda (_: +C).(\lambda (u2: T).(pr0 u1 u2)))))) (or_introl (eq C (CHead c1 k u1) (CHead +c1 k u1)) (ex3_2 C T (\lambda (c2: C).(\lambda (u2: T).(eq C (CHead c1 k u1) +(CHead c2 k u2)))) (\lambda (c2: C).(\lambda (_: T).(wcpr0 c1 c2))) (\lambda +(_: C).(\lambda (u2: T).(pr0 u1 u2)))) (refl_equal C (CHead c1 k u1))) x H2)) +c (sym_eq C c (CHead c1 k u1) H0) H1))) | (wcpr0_comp c0 c2 H0 u0 u2 H1 k0) +\Rightarrow (\lambda (H2: (eq C (CHead c0 k0 u0) (CHead c1 k u1))).(\lambda +(H3: (eq C (CHead c2 k0 u2) x)).((let H4 \def (f_equal C T (\lambda (e: +C).(match e in C return (\lambda (_: C).T) with [(CSort _) \Rightarrow u0 | +(CHead _ _ t) \Rightarrow t])) (CHead c0 k0 u0) (CHead c1 k u1) H2) in ((let +H5 \def (f_equal C K (\lambda (e: C).(match e in C return (\lambda (_: C).K) +with [(CSort _) \Rightarrow k0 | (CHead _ k1 _) \Rightarrow k1])) (CHead c0 +k0 u0) (CHead c1 k u1) H2) in ((let H6 \def (f_equal C C (\lambda (e: +C).(match e in C return (\lambda (_: C).C) with [(CSort _) \Rightarrow c0 | +(CHead c _ _) \Rightarrow c])) (CHead c0 k0 u0) (CHead c1 k u1) H2) in +(eq_ind C c1 (\lambda (c: C).((eq K k0 k) \to ((eq T u0 u1) \to ((eq C (CHead +c2 k0 u2) x) \to ((wcpr0 c c2) \to ((pr0 u0 u2) \to (or (eq C x (CHead c1 k +u1)) (ex3_2 C T (\lambda (c3: C).(\lambda (u3: T).(eq C x (CHead c3 k u3)))) +(\lambda (c3: C).(\lambda (_: T).(wcpr0 c1 c3))) (\lambda (_: C).(\lambda +(u3: T).(pr0 u1 u3))))))))))) (\lambda (H7: (eq K k0 k)).(eq_ind K k (\lambda +(k1: K).((eq T u0 u1) \to ((eq C (CHead c2 k1 u2) x) \to ((wcpr0 c1 c2) \to +((pr0 u0 u2) \to (or (eq C x (CHead c1 k u1)) (ex3_2 C T (\lambda (c3: +C).(\lambda (u3: T).(eq C x (CHead c3 k u3)))) (\lambda (c3: C).(\lambda (_: +T).(wcpr0 c1 c3))) (\lambda (_: C).(\lambda (u3: T).(pr0 u1 u3)))))))))) +(\lambda (H8: (eq T u0 u1)).(eq_ind T u1 (\lambda (t: T).((eq C (CHead c2 k +u2) x) \to ((wcpr0 c1 c2) \to ((pr0 t u2) \to (or (eq C x (CHead c1 k u1)) +(ex3_2 C T (\lambda (c3: C).(\lambda (u3: T).(eq C x (CHead c3 k u3)))) +(\lambda (c3: C).(\lambda (_: T).(wcpr0 c1 c3))) (\lambda (_: C).(\lambda +(u3: T).(pr0 u1 u3))))))))) (\lambda (H9: (eq C (CHead c2 k u2) x)).(eq_ind C +(CHead c2 k u2) (\lambda (c: C).((wcpr0 c1 c2) \to ((pr0 u1 u2) \to (or (eq C +c (CHead c1 k u1)) (ex3_2 C T (\lambda (c3: C).(\lambda (u3: T).(eq C c +(CHead c3 k u3)))) (\lambda (c3: C).(\lambda (_: T).(wcpr0 c1 c3))) (\lambda +(_: C).(\lambda (u3: T).(pr0 u1 u3)))))))) (\lambda (H10: (wcpr0 c1 +c2)).(\lambda (H11: (pr0 u1 u2)).(or_intror (eq C (CHead c2 k u2) (CHead c1 k +u1)) (ex3_2 C T (\lambda (c3: C).(\lambda (u3: T).(eq C (CHead c2 k u2) +(CHead c3 k u3)))) (\lambda (c3: C).(\lambda (_: T).(wcpr0 c1 c3))) (\lambda +(_: C).(\lambda (u3: T).(pr0 u1 u3)))) (ex3_2_intro C T (\lambda (c3: +C).(\lambda (u3: T).(eq C (CHead c2 k u2) (CHead c3 k u3)))) (\lambda (c3: +C).(\lambda (_: T).(wcpr0 c1 c3))) (\lambda (_: C).(\lambda (u3: T).(pr0 u1 +u3))) c2 u2 (refl_equal C (CHead c2 k u2)) H10 H11)))) x H9)) u0 (sym_eq T u0 +u1 H8))) k0 (sym_eq K k0 k H7))) c0 (sym_eq C c0 c1 H6))) H5)) H4)) H3 H0 +H1)))]) in (H0 (refl_equal C (CHead c1 k u1)) (refl_equal C x))))))). + diff --git a/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/getl.ma b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/getl.ma new file mode 100644 index 000000000..f52805131 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/getl.ma @@ -0,0 +1,468 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* This file was automatically generated: do not edit *********************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/wcpr0/getl". + +include "wcpr0/defs.ma". + +include "getl/props.ma". + +theorem wcpr0_drop: + \forall (c1: C).(\forall (c2: C).((wcpr0 c1 c2) \to (\forall (h: +nat).(\forall (e1: C).(\forall (u1: T).(\forall (k: K).((drop h O c1 (CHead +e1 k u1)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u2: T).(drop h O c2 +(CHead e2 k u2)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda +(_: C).(\lambda (u2: T).(pr0 u1 u2))))))))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: (wcpr0 c1 c2)).(wcpr0_ind +(\lambda (c: C).(\lambda (c0: C).(\forall (h: nat).(\forall (e1: C).(\forall +(u1: T).(\forall (k: K).((drop h O c (CHead e1 k u1)) \to (ex3_2 C T (\lambda +(e2: C).(\lambda (u2: T).(drop h O c0 (CHead e2 k u2)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u2: T).(pr0 u1 +u2))))))))))) (\lambda (c: C).(\lambda (h: nat).(\lambda (e1: C).(\lambda +(u1: T).(\lambda (k: K).(\lambda (H0: (drop h O c (CHead e1 k +u1))).(ex3_2_intro C T (\lambda (e2: C).(\lambda (u2: T).(drop h O c (CHead +e2 k u2)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: +C).(\lambda (u2: T).(pr0 u1 u2))) e1 u1 H0 (wcpr0_refl e1) (pr0_refl +u1)))))))) (\lambda (c0: C).(\lambda (c3: C).(\lambda (H0: (wcpr0 c0 +c3)).(\lambda (H1: ((\forall (h: nat).(\forall (e1: C).(\forall (u1: +T).(\forall (k: K).((drop h O c0 (CHead e1 k u1)) \to (ex3_2 C T (\lambda +(e2: C).(\lambda (u2: T).(drop h O c3 (CHead e2 k u2)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u2: T).(pr0 u1 +u2))))))))))).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H2: (pr0 u1 +u2)).(\lambda (k: K).(\lambda (h: nat).(nat_ind (\lambda (n: nat).(\forall +(e1: C).(\forall (u3: T).(\forall (k0: K).((drop n O (CHead c0 k u1) (CHead +e1 k0 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(drop n O (CHead +c3 k u2) (CHead e2 k0 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) +(\lambda (_: C).(\lambda (u4: T).(pr0 u3 u4))))))))) (\lambda (e1: +C).(\lambda (u0: T).(\lambda (k0: K).(\lambda (H3: (drop O O (CHead c0 k u1) +(CHead e1 k0 u0))).(let H4 \def (match (drop_gen_refl (CHead c0 k u1) (CHead +e1 k0 u0) H3) in eq return (\lambda (c: C).(\lambda (_: (eq ? ? c)).((eq C c +(CHead e1 k0 u0)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(drop O O +(CHead c3 k u2) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 +e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3))))))) with [refl_equal +\Rightarrow (\lambda (H4: (eq C (CHead c0 k u1) (CHead e1 k0 u0))).(let H5 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u1 | (CHead _ _ t) \Rightarrow t])) (CHead c0 k +u1) (CHead e1 k0 u0) H4) in ((let H6 \def (f_equal C K (\lambda (e: C).(match +e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k1 +_) \Rightarrow k1])) (CHead c0 k u1) (CHead e1 k0 u0) H4) in ((let H7 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c0 | (CHead c _ _) \Rightarrow c])) (CHead c0 k u1) +(CHead e1 k0 u0) H4) in (eq_ind C e1 (\lambda (_: C).((eq K k k0) \to ((eq T +u1 u0) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(drop O O (CHead c3 k +u2) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) +(\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3))))))) (\lambda (H8: (eq K k +k0)).(eq_ind K k0 (\lambda (k1: K).((eq T u1 u0) \to (ex3_2 C T (\lambda (e2: +C).(\lambda (u3: T).(drop O O (CHead c3 k1 u2) (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u0 u3)))))) (\lambda (H9: (eq T u1 u0)).(eq_ind T u0 (\lambda (_: T).(ex3_2 C +T (\lambda (e2: C).(\lambda (u3: T).(drop O O (CHead c3 k0 u2) (CHead e2 k0 +u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: +C).(\lambda (u3: T).(pr0 u0 u3))))) (let H10 \def (eq_ind T u1 (\lambda (t: +T).(pr0 t u2)) H2 u0 H9) in (let H11 \def (eq_ind C c0 (\lambda (c: C).(wcpr0 +c c3)) H0 e1 H7) in (ex3_2_intro C T (\lambda (e2: C).(\lambda (u3: T).(drop +O O (CHead c3 k0 u2) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3))) c3 u2 +(drop_refl (CHead c3 k0 u2)) H11 H10))) u1 (sym_eq T u1 u0 H9))) k (sym_eq K +k k0 H8))) c0 (sym_eq C c0 e1 H7))) H6)) H5)))]) in (H4 (refl_equal C (CHead +e1 k0 u0)))))))) (K_ind (\lambda (k0: K).(\forall (n: nat).(((\forall (e1: +C).(\forall (u3: T).(\forall (k1: K).((drop n O (CHead c0 k0 u1) (CHead e1 k1 +u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(drop n O (CHead c3 k0 +u2) (CHead e2 k1 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) +(\lambda (_: C).(\lambda (u4: T).(pr0 u3 u4))))))))) \to (\forall (e1: +C).(\forall (u3: T).(\forall (k1: K).((drop (S n) O (CHead c0 k0 u1) (CHead +e1 k1 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(drop (S n) O +(CHead c3 k0 u2) (CHead e2 k1 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 +e1 e2))) (\lambda (_: C).(\lambda (u4: T).(pr0 u3 u4))))))))))) (\lambda (b: +B).(\lambda (n: nat).(\lambda (_: ((\forall (e1: C).(\forall (u3: T).(\forall +(k0: K).((drop n O (CHead c0 (Bind b) u1) (CHead e1 k0 u3)) \to (ex3_2 C T +(\lambda (e2: C).(\lambda (u4: T).(drop n O (CHead c3 (Bind b) u2) (CHead e2 +k0 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: +C).(\lambda (u4: T).(pr0 u3 u4)))))))))).(\lambda (e1: C).(\lambda (u0: +T).(\lambda (k0: K).(\lambda (H4: (drop (S n) O (CHead c0 (Bind b) u1) (CHead +e1 k0 u0))).(ex3_2_ind C T (\lambda (e2: C).(\lambda (u3: T).(drop n O c3 +(CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda +(_: C).(\lambda (u3: T).(pr0 u0 u3))) (ex3_2 C T (\lambda (e2: C).(\lambda +(u3: T).(drop (S n) O (CHead c3 (Bind b) u2) (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u0 u3)))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H5: (drop n O c3 (CHead +x0 k0 x1))).(\lambda (H6: (wcpr0 e1 x0)).(\lambda (H7: (pr0 u0 +x1)).(ex3_2_intro C T (\lambda (e2: C).(\lambda (u3: T).(drop (S n) O (CHead +c3 (Bind b) u2) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 +e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3))) x0 x1 (drop_drop +(Bind b) n c3 (CHead x0 k0 x1) H5 u2) H6 H7)))))) (H1 n e1 u0 k0 +(drop_gen_drop (Bind b) c0 (CHead e1 k0 u0) u1 n H4)))))))))) (\lambda (f: +F).(\lambda (n: nat).(\lambda (_: ((\forall (e1: C).(\forall (u3: T).(\forall +(k0: K).((drop n O (CHead c0 (Flat f) u1) (CHead e1 k0 u3)) \to (ex3_2 C T +(\lambda (e2: C).(\lambda (u4: T).(drop n O (CHead c3 (Flat f) u2) (CHead e2 +k0 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: +C).(\lambda (u4: T).(pr0 u3 u4)))))))))).(\lambda (e1: C).(\lambda (u0: +T).(\lambda (k0: K).(\lambda (H4: (drop (S n) O (CHead c0 (Flat f) u1) (CHead +e1 k0 u0))).(ex3_2_ind C T (\lambda (e2: C).(\lambda (u3: T).(drop (S n) O c3 +(CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda +(_: C).(\lambda (u3: T).(pr0 u0 u3))) (ex3_2 C T (\lambda (e2: C).(\lambda +(u3: T).(drop (S n) O (CHead c3 (Flat f) u2) (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u0 u3)))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H5: (drop (S n) O c3 +(CHead x0 k0 x1))).(\lambda (H6: (wcpr0 e1 x0)).(\lambda (H7: (pr0 u0 +x1)).(ex3_2_intro C T (\lambda (e2: C).(\lambda (u3: T).(drop (S n) O (CHead +c3 (Flat f) u2) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 +e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3))) x0 x1 (drop_drop +(Flat f) n c3 (CHead x0 k0 x1) H5 u2) H6 H7)))))) (H1 (S n) e1 u0 k0 +(drop_gen_drop (Flat f) c0 (CHead e1 k0 u0) u1 n H4)))))))))) k) h)))))))))) +c1 c2 H))). + +theorem wcpr0_drop_back: + \forall (c1: C).(\forall (c2: C).((wcpr0 c2 c1) \to (\forall (h: +nat).(\forall (e1: C).(\forall (u1: T).(\forall (k: K).((drop h O c1 (CHead +e1 k u1)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u2: T).(drop h O c2 +(CHead e2 k u2)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda +(_: C).(\lambda (u2: T).(pr0 u2 u1))))))))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: (wcpr0 c2 c1)).(wcpr0_ind +(\lambda (c: C).(\lambda (c0: C).(\forall (h: nat).(\forall (e1: C).(\forall +(u1: T).(\forall (k: K).((drop h O c0 (CHead e1 k u1)) \to (ex3_2 C T +(\lambda (e2: C).(\lambda (u2: T).(drop h O c (CHead e2 k u2)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u2: T).(pr0 +u2 u1))))))))))) (\lambda (c: C).(\lambda (h: nat).(\lambda (e1: C).(\lambda +(u1: T).(\lambda (k: K).(\lambda (H0: (drop h O c (CHead e1 k +u1))).(ex3_2_intro C T (\lambda (e2: C).(\lambda (u2: T).(drop h O c (CHead +e2 k u2)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: +C).(\lambda (u2: T).(pr0 u2 u1))) e1 u1 H0 (wcpr0_refl e1) (pr0_refl +u1)))))))) (\lambda (c0: C).(\lambda (c3: C).(\lambda (H0: (wcpr0 c0 +c3)).(\lambda (H1: ((\forall (h: nat).(\forall (e1: C).(\forall (u1: +T).(\forall (k: K).((drop h O c3 (CHead e1 k u1)) \to (ex3_2 C T (\lambda +(e2: C).(\lambda (u2: T).(drop h O c0 (CHead e2 k u2)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u2: T).(pr0 u2 +u1))))))))))).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H2: (pr0 u1 +u2)).(\lambda (k: K).(\lambda (h: nat).(nat_ind (\lambda (n: nat).(\forall +(e1: C).(\forall (u3: T).(\forall (k0: K).((drop n O (CHead c3 k u2) (CHead +e1 k0 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(drop n O (CHead +c0 k u1) (CHead e2 k0 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) +(\lambda (_: C).(\lambda (u4: T).(pr0 u4 u3))))))))) (\lambda (e1: +C).(\lambda (u0: T).(\lambda (k0: K).(\lambda (H3: (drop O O (CHead c3 k u2) +(CHead e1 k0 u0))).(let H4 \def (match (drop_gen_refl (CHead c3 k u2) (CHead +e1 k0 u0) H3) in eq return (\lambda (c: C).(\lambda (_: (eq ? ? c)).((eq C c +(CHead e1 k0 u0)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(drop O O +(CHead c0 k u1) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 +e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0))))))) with [refl_equal +\Rightarrow (\lambda (H4: (eq C (CHead c3 k u2) (CHead e1 k0 u0))).(let H5 +\def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u2 | (CHead _ _ t) \Rightarrow t])) (CHead c3 k +u2) (CHead e1 k0 u0) H4) in ((let H6 \def (f_equal C K (\lambda (e: C).(match +e in C return (\lambda (_: C).K) with [(CSort _) \Rightarrow k | (CHead _ k1 +_) \Rightarrow k1])) (CHead c3 k u2) (CHead e1 k0 u0) H4) in ((let H7 \def +(f_equal C C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with +[(CSort _) \Rightarrow c3 | (CHead c _ _) \Rightarrow c])) (CHead c3 k u2) +(CHead e1 k0 u0) H4) in (eq_ind C e1 (\lambda (_: C).((eq K k k0) \to ((eq T +u2 u0) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(drop O O (CHead c0 k +u1) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) +(\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0))))))) (\lambda (H8: (eq K k +k0)).(eq_ind K k0 (\lambda (k1: K).((eq T u2 u0) \to (ex3_2 C T (\lambda (e2: +C).(\lambda (u3: T).(drop O O (CHead c0 k1 u1) (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u3 u0)))))) (\lambda (H9: (eq T u2 u0)).(eq_ind T u0 (\lambda (_: T).(ex3_2 C +T (\lambda (e2: C).(\lambda (u3: T).(drop O O (CHead c0 k0 u1) (CHead e2 k0 +u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: +C).(\lambda (u3: T).(pr0 u3 u0))))) (let H10 \def (eq_ind T u2 (\lambda (t: +T).(pr0 u1 t)) H2 u0 H9) in (let H11 \def (eq_ind C c3 (\lambda (c: C).(wcpr0 +c0 c)) H0 e1 H7) in (ex3_2_intro C T (\lambda (e2: C).(\lambda (u3: T).(drop +O O (CHead c0 k0 u1) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0))) c0 u1 +(drop_refl (CHead c0 k0 u1)) H11 H10))) u2 (sym_eq T u2 u0 H9))) k (sym_eq K +k k0 H8))) c3 (sym_eq C c3 e1 H7))) H6)) H5)))]) in (H4 (refl_equal C (CHead +e1 k0 u0)))))))) (K_ind (\lambda (k0: K).(\forall (n: nat).(((\forall (e1: +C).(\forall (u3: T).(\forall (k1: K).((drop n O (CHead c3 k0 u2) (CHead e1 k1 +u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(drop n O (CHead c0 k0 +u1) (CHead e2 k1 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) +(\lambda (_: C).(\lambda (u4: T).(pr0 u4 u3))))))))) \to (\forall (e1: +C).(\forall (u3: T).(\forall (k1: K).((drop (S n) O (CHead c3 k0 u2) (CHead +e1 k1 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(drop (S n) O +(CHead c0 k0 u1) (CHead e2 k1 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 +e2 e1))) (\lambda (_: C).(\lambda (u4: T).(pr0 u4 u3))))))))))) (\lambda (b: +B).(\lambda (n: nat).(\lambda (_: ((\forall (e1: C).(\forall (u3: T).(\forall +(k0: K).((drop n O (CHead c3 (Bind b) u2) (CHead e1 k0 u3)) \to (ex3_2 C T +(\lambda (e2: C).(\lambda (u4: T).(drop n O (CHead c0 (Bind b) u1) (CHead e2 +k0 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: +C).(\lambda (u4: T).(pr0 u4 u3)))))))))).(\lambda (e1: C).(\lambda (u0: +T).(\lambda (k0: K).(\lambda (H4: (drop (S n) O (CHead c3 (Bind b) u2) (CHead +e1 k0 u0))).(ex3_2_ind C T (\lambda (e2: C).(\lambda (u3: T).(drop n O c0 +(CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda +(_: C).(\lambda (u3: T).(pr0 u3 u0))) (ex3_2 C T (\lambda (e2: C).(\lambda +(u3: T).(drop (S n) O (CHead c0 (Bind b) u1) (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u3 u0)))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H5: (drop n O c0 (CHead +x0 k0 x1))).(\lambda (H6: (wcpr0 x0 e1)).(\lambda (H7: (pr0 x1 +u0)).(ex3_2_intro C T (\lambda (e2: C).(\lambda (u3: T).(drop (S n) O (CHead +c0 (Bind b) u1) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 +e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0))) x0 x1 (drop_drop +(Bind b) n c0 (CHead x0 k0 x1) H5 u1) H6 H7)))))) (H1 n e1 u0 k0 +(drop_gen_drop (Bind b) c3 (CHead e1 k0 u0) u2 n H4)))))))))) (\lambda (f: +F).(\lambda (n: nat).(\lambda (_: ((\forall (e1: C).(\forall (u3: T).(\forall +(k0: K).((drop n O (CHead c3 (Flat f) u2) (CHead e1 k0 u3)) \to (ex3_2 C T +(\lambda (e2: C).(\lambda (u4: T).(drop n O (CHead c0 (Flat f) u1) (CHead e2 +k0 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: +C).(\lambda (u4: T).(pr0 u4 u3)))))))))).(\lambda (e1: C).(\lambda (u0: +T).(\lambda (k0: K).(\lambda (H4: (drop (S n) O (CHead c3 (Flat f) u2) (CHead +e1 k0 u0))).(ex3_2_ind C T (\lambda (e2: C).(\lambda (u3: T).(drop (S n) O c0 +(CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda +(_: C).(\lambda (u3: T).(pr0 u3 u0))) (ex3_2 C T (\lambda (e2: C).(\lambda +(u3: T).(drop (S n) O (CHead c0 (Flat f) u1) (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u3 u0)))) (\lambda (x0: C).(\lambda (x1: T).(\lambda (H5: (drop (S n) O c0 +(CHead x0 k0 x1))).(\lambda (H6: (wcpr0 x0 e1)).(\lambda (H7: (pr0 x1 +u0)).(ex3_2_intro C T (\lambda (e2: C).(\lambda (u3: T).(drop (S n) O (CHead +c0 (Flat f) u1) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 +e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0))) x0 x1 (drop_drop +(Flat f) n c0 (CHead x0 k0 x1) H5 u1) H6 H7)))))) (H1 (S n) e1 u0 k0 +(drop_gen_drop (Flat f) c3 (CHead e1 k0 u0) u2 n H4)))))))))) k) h)))))))))) +c2 c1 H))). + +theorem wcpr0_getl: + \forall (c1: C).(\forall (c2: C).((wcpr0 c1 c2) \to (\forall (h: +nat).(\forall (e1: C).(\forall (u1: T).(\forall (k: K).((getl h c1 (CHead e1 +k u1)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u2: T).(getl h c2 (CHead e2 +k u2)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: +C).(\lambda (u2: T).(pr0 u1 u2))))))))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: (wcpr0 c1 c2)).(wcpr0_ind +(\lambda (c: C).(\lambda (c0: C).(\forall (h: nat).(\forall (e1: C).(\forall +(u1: T).(\forall (k: K).((getl h c (CHead e1 k u1)) \to (ex3_2 C T (\lambda +(e2: C).(\lambda (u2: T).(getl h c0 (CHead e2 k u2)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u2: T).(pr0 u1 +u2))))))))))) (\lambda (c: C).(\lambda (h: nat).(\lambda (e1: C).(\lambda +(u1: T).(\lambda (k: K).(\lambda (H0: (getl h c (CHead e1 k +u1))).(ex3_2_intro C T (\lambda (e2: C).(\lambda (u2: T).(getl h c (CHead e2 +k u2)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: +C).(\lambda (u2: T).(pr0 u1 u2))) e1 u1 H0 (wcpr0_refl e1) (pr0_refl +u1)))))))) (\lambda (c0: C).(\lambda (c3: C).(\lambda (H0: (wcpr0 c0 +c3)).(\lambda (H1: ((\forall (h: nat).(\forall (e1: C).(\forall (u1: +T).(\forall (k: K).((getl h c0 (CHead e1 k u1)) \to (ex3_2 C T (\lambda (e2: +C).(\lambda (u2: T).(getl h c3 (CHead e2 k u2)))) (\lambda (e2: C).(\lambda +(_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u2: T).(pr0 u1 +u2))))))))))).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H2: (pr0 u1 +u2)).(\lambda (k: K).(\lambda (h: nat).(nat_ind (\lambda (n: nat).(\forall +(e1: C).(\forall (u3: T).(\forall (k0: K).((getl n (CHead c0 k u1) (CHead e1 +k0 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(getl n (CHead c3 k +u2) (CHead e2 k0 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) +(\lambda (_: C).(\lambda (u4: T).(pr0 u3 u4))))))))) (\lambda (e1: +C).(\lambda (u0: T).(\lambda (k0: K).(\lambda (H3: (getl O (CHead c0 k u1) +(CHead e1 k0 u0))).(K_ind (\lambda (k1: K).((clear (CHead c0 k1 u1) (CHead e1 +k0 u0)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl O (CHead c3 k1 +u2) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) +(\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3)))))) (\lambda (b: B).(\lambda +(H4: (clear (CHead c0 (Bind b) u1) (CHead e1 k0 u0))).(let H5 \def (f_equal C +C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow e1 | (CHead c _ _) \Rightarrow c])) (CHead e1 k0 u0) (CHead c0 +(Bind b) u1) (clear_gen_bind b c0 (CHead e1 k0 u0) u1 H4)) in ((let H6 \def +(f_equal C K (\lambda (e: C).(match e in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow k0 | (CHead _ k1 _) \Rightarrow k1])) (CHead e1 k0 u0) +(CHead c0 (Bind b) u1) (clear_gen_bind b c0 (CHead e1 k0 u0) u1 H4)) in ((let +H7 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u0 | (CHead _ _ t) \Rightarrow t])) (CHead e1 k0 +u0) (CHead c0 (Bind b) u1) (clear_gen_bind b c0 (CHead e1 k0 u0) u1 H4)) in +(\lambda (H8: (eq K k0 (Bind b))).(\lambda (H9: (eq C e1 c0)).(eq_ind_r K +(Bind b) (\lambda (k1: K).(ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl +O (CHead c3 (Bind b) u2) (CHead e2 k1 u3)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3))))) (eq_ind_r +T u1 (\lambda (t: T).(ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl O +(CHead c3 (Bind b) u2) (CHead e2 (Bind b) u3)))) (\lambda (e2: C).(\lambda +(_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 t u3))))) +(eq_ind_r C c0 (\lambda (c: C).(ex3_2 C T (\lambda (e2: C).(\lambda (u3: +T).(getl O (CHead c3 (Bind b) u2) (CHead e2 (Bind b) u3)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 c e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u1 +u3))))) (ex3_2_intro C T (\lambda (e2: C).(\lambda (u3: T).(getl O (CHead c3 +(Bind b) u2) (CHead e2 (Bind b) u3)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 c0 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u1 u3))) c3 u2 +(getl_refl b c3 u2) H0 H2) e1 H9) u0 H7) k0 H8)))) H6)) H5)))) (\lambda (f: +F).(\lambda (H4: (clear (CHead c0 (Flat f) u1) (CHead e1 k0 u0))).(let H5 +\def (H1 O e1 u0 k0 (getl_intro O c0 (CHead e1 k0 u0) c0 (drop_refl c0) +(clear_gen_flat f c0 (CHead e1 k0 u0) u1 H4))) in (ex3_2_ind C T (\lambda +(e2: C).(\lambda (u3: T).(getl O c3 (CHead e2 k0 u3)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u0 +u3))) (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl O (CHead c3 (Flat f) +u2) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) +(\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3)))) (\lambda (x0: C).(\lambda +(x1: T).(\lambda (H6: (getl O c3 (CHead x0 k0 x1))).(\lambda (H7: (wcpr0 e1 +x0)).(\lambda (H8: (pr0 u0 x1)).(ex3_2_intro C T (\lambda (e2: C).(\lambda +(u3: T).(getl O (CHead c3 (Flat f) u2) (CHead e2 k0 u3)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u0 +u3))) x0 x1 (getl_flat c3 (CHead x0 k0 x1) O H6 f u2) H7 H8)))))) H5)))) k +(getl_gen_O (CHead c0 k u1) (CHead e1 k0 u0) H3)))))) (K_ind (\lambda (k0: +K).(\forall (n: nat).(((\forall (e1: C).(\forall (u3: T).(\forall (k1: +K).((getl n (CHead c0 k0 u1) (CHead e1 k1 u3)) \to (ex3_2 C T (\lambda (e2: +C).(\lambda (u4: T).(getl n (CHead c3 k0 u2) (CHead e2 k1 u4)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u4: T).(pr0 +u3 u4))))))))) \to (\forall (e1: C).(\forall (u3: T).(\forall (k1: K).((getl +(S n) (CHead c0 k0 u1) (CHead e1 k1 u3)) \to (ex3_2 C T (\lambda (e2: +C).(\lambda (u4: T).(getl (S n) (CHead c3 k0 u2) (CHead e2 k1 u4)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u4: T).(pr0 +u3 u4))))))))))) (\lambda (b: B).(\lambda (n: nat).(\lambda (_: ((\forall +(e1: C).(\forall (u3: T).(\forall (k0: K).((getl n (CHead c0 (Bind b) u1) +(CHead e1 k0 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(getl n +(CHead c3 (Bind b) u2) (CHead e2 k0 u4)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u4: T).(pr0 u3 +u4)))))))))).(\lambda (e1: C).(\lambda (u0: T).(\lambda (k0: K).(\lambda (H4: +(getl (S n) (CHead c0 (Bind b) u1) (CHead e1 k0 u0))).(let H5 \def (H1 n e1 +u0 k0 (getl_gen_S (Bind b) c0 (CHead e1 k0 u0) u1 n H4)) in (ex3_2_ind C T +(\lambda (e2: C).(\lambda (u3: T).(getl n c3 (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u0 u3))) (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl (S n) (CHead c3 +(Bind b) u2) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 +e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3)))) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (H6: (getl n c3 (CHead x0 k0 x1))).(\lambda (H7: +(wcpr0 e1 x0)).(\lambda (H8: (pr0 u0 x1)).(ex3_2_intro C T (\lambda (e2: +C).(\lambda (u3: T).(getl (S n) (CHead c3 (Bind b) u2) (CHead e2 k0 u3)))) +(\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda +(u3: T).(pr0 u0 u3))) x0 x1 (getl_head (Bind b) n c3 (CHead x0 k0 x1) H6 u2) +H7 H8)))))) H5))))))))) (\lambda (f: F).(\lambda (n: nat).(\lambda (_: +((\forall (e1: C).(\forall (u3: T).(\forall (k0: K).((getl n (CHead c0 (Flat +f) u1) (CHead e1 k0 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: +T).(getl n (CHead c3 (Flat f) u2) (CHead e2 k0 u4)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u4: T).(pr0 u3 +u4)))))))))).(\lambda (e1: C).(\lambda (u0: T).(\lambda (k0: K).(\lambda (H4: +(getl (S n) (CHead c0 (Flat f) u1) (CHead e1 k0 u0))).(let H5 \def (H1 (S n) +e1 u0 k0 (getl_gen_S (Flat f) c0 (CHead e1 k0 u0) u1 n H4)) in (ex3_2_ind C T +(\lambda (e2: C).(\lambda (u3: T).(getl (S n) c3 (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u0 u3))) (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl (S n) (CHead c3 +(Flat f) u2) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 +e2))) (\lambda (_: C).(\lambda (u3: T).(pr0 u0 u3)))) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (H6: (getl (S n) c3 (CHead x0 k0 x1))).(\lambda +(H7: (wcpr0 e1 x0)).(\lambda (H8: (pr0 u0 x1)).(ex3_2_intro C T (\lambda (e2: +C).(\lambda (u3: T).(getl (S n) (CHead c3 (Flat f) u2) (CHead e2 k0 u3)))) +(\lambda (e2: C).(\lambda (_: T).(wcpr0 e1 e2))) (\lambda (_: C).(\lambda +(u3: T).(pr0 u0 u3))) x0 x1 (getl_head (Flat f) n c3 (CHead x0 k0 x1) H6 u2) +H7 H8)))))) H5))))))))) k) h)))))))))) c1 c2 H))). + +theorem wcpr0_getl_back: + \forall (c1: C).(\forall (c2: C).((wcpr0 c2 c1) \to (\forall (h: +nat).(\forall (e1: C).(\forall (u1: T).(\forall (k: K).((getl h c1 (CHead e1 +k u1)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u2: T).(getl h c2 (CHead e2 +k u2)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: +C).(\lambda (u2: T).(pr0 u2 u1))))))))))) +\def + \lambda (c1: C).(\lambda (c2: C).(\lambda (H: (wcpr0 c2 c1)).(wcpr0_ind +(\lambda (c: C).(\lambda (c0: C).(\forall (h: nat).(\forall (e1: C).(\forall +(u1: T).(\forall (k: K).((getl h c0 (CHead e1 k u1)) \to (ex3_2 C T (\lambda +(e2: C).(\lambda (u2: T).(getl h c (CHead e2 k u2)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u2: T).(pr0 u2 +u1))))))))))) (\lambda (c: C).(\lambda (h: nat).(\lambda (e1: C).(\lambda +(u1: T).(\lambda (k: K).(\lambda (H0: (getl h c (CHead e1 k +u1))).(ex3_2_intro C T (\lambda (e2: C).(\lambda (u2: T).(getl h c (CHead e2 +k u2)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: +C).(\lambda (u2: T).(pr0 u2 u1))) e1 u1 H0 (wcpr0_refl e1) (pr0_refl +u1)))))))) (\lambda (c0: C).(\lambda (c3: C).(\lambda (H0: (wcpr0 c0 +c3)).(\lambda (H1: ((\forall (h: nat).(\forall (e1: C).(\forall (u1: +T).(\forall (k: K).((getl h c3 (CHead e1 k u1)) \to (ex3_2 C T (\lambda (e2: +C).(\lambda (u2: T).(getl h c0 (CHead e2 k u2)))) (\lambda (e2: C).(\lambda +(_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u2: T).(pr0 u2 +u1))))))))))).(\lambda (u1: T).(\lambda (u2: T).(\lambda (H2: (pr0 u1 +u2)).(\lambda (k: K).(\lambda (h: nat).(nat_ind (\lambda (n: nat).(\forall +(e1: C).(\forall (u3: T).(\forall (k0: K).((getl n (CHead c3 k u2) (CHead e1 +k0 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(getl n (CHead c0 k +u1) (CHead e2 k0 u4)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) +(\lambda (_: C).(\lambda (u4: T).(pr0 u4 u3))))))))) (\lambda (e1: +C).(\lambda (u0: T).(\lambda (k0: K).(\lambda (H3: (getl O (CHead c3 k u2) +(CHead e1 k0 u0))).(K_ind (\lambda (k1: K).((clear (CHead c3 k1 u2) (CHead e1 +k0 u0)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl O (CHead c0 k1 +u1) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) +(\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0)))))) (\lambda (b: B).(\lambda +(H4: (clear (CHead c3 (Bind b) u2) (CHead e1 k0 u0))).(let H5 \def (f_equal C +C (\lambda (e: C).(match e in C return (\lambda (_: C).C) with [(CSort _) +\Rightarrow e1 | (CHead c _ _) \Rightarrow c])) (CHead e1 k0 u0) (CHead c3 +(Bind b) u2) (clear_gen_bind b c3 (CHead e1 k0 u0) u2 H4)) in ((let H6 \def +(f_equal C K (\lambda (e: C).(match e in C return (\lambda (_: C).K) with +[(CSort _) \Rightarrow k0 | (CHead _ k1 _) \Rightarrow k1])) (CHead e1 k0 u0) +(CHead c3 (Bind b) u2) (clear_gen_bind b c3 (CHead e1 k0 u0) u2 H4)) in ((let +H7 \def (f_equal C T (\lambda (e: C).(match e in C return (\lambda (_: C).T) +with [(CSort _) \Rightarrow u0 | (CHead _ _ t) \Rightarrow t])) (CHead e1 k0 +u0) (CHead c3 (Bind b) u2) (clear_gen_bind b c3 (CHead e1 k0 u0) u2 H4)) in +(\lambda (H8: (eq K k0 (Bind b))).(\lambda (H9: (eq C e1 c3)).(eq_ind_r K +(Bind b) (\lambda (k1: K).(ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl +O (CHead c0 (Bind b) u1) (CHead e2 k1 u3)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0))))) (eq_ind_r +T u2 (\lambda (t: T).(ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl O +(CHead c0 (Bind b) u1) (CHead e2 (Bind b) u3)))) (\lambda (e2: C).(\lambda +(_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 t))))) +(eq_ind_r C c3 (\lambda (c: C).(ex3_2 C T (\lambda (e2: C).(\lambda (u3: +T).(getl O (CHead c0 (Bind b) u1) (CHead e2 (Bind b) u3)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e2 c))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 +u2))))) (ex3_2_intro C T (\lambda (e2: C).(\lambda (u3: T).(getl O (CHead c0 +(Bind b) u1) (CHead e2 (Bind b) u3)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 e2 c3))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 u2))) c0 u1 +(getl_refl b c0 u1) H0 H2) e1 H9) u0 H7) k0 H8)))) H6)) H5)))) (\lambda (f: +F).(\lambda (H4: (clear (CHead c3 (Flat f) u2) (CHead e1 k0 u0))).(let H5 +\def (H1 O e1 u0 k0 (getl_intro O c3 (CHead e1 k0 u0) c3 (drop_refl c3) +(clear_gen_flat f c3 (CHead e1 k0 u0) u2 H4))) in (ex3_2_ind C T (\lambda +(e2: C).(\lambda (u3: T).(getl O c0 (CHead e2 k0 u3)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 +u0))) (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl O (CHead c0 (Flat f) +u1) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) +(\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0)))) (\lambda (x0: C).(\lambda +(x1: T).(\lambda (H6: (getl O c0 (CHead x0 k0 x1))).(\lambda (H7: (wcpr0 x0 +e1)).(\lambda (H8: (pr0 x1 u0)).(ex3_2_intro C T (\lambda (e2: C).(\lambda +(u3: T).(getl O (CHead c0 (Flat f) u1) (CHead e2 k0 u3)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 +u0))) x0 x1 (getl_flat c0 (CHead x0 k0 x1) O H6 f u1) H7 H8)))))) H5)))) k +(getl_gen_O (CHead c3 k u2) (CHead e1 k0 u0) H3)))))) (K_ind (\lambda (k0: +K).(\forall (n: nat).(((\forall (e1: C).(\forall (u3: T).(\forall (k1: +K).((getl n (CHead c3 k0 u2) (CHead e1 k1 u3)) \to (ex3_2 C T (\lambda (e2: +C).(\lambda (u4: T).(getl n (CHead c0 k0 u1) (CHead e2 k1 u4)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u4: T).(pr0 +u4 u3))))))))) \to (\forall (e1: C).(\forall (u3: T).(\forall (k1: K).((getl +(S n) (CHead c3 k0 u2) (CHead e1 k1 u3)) \to (ex3_2 C T (\lambda (e2: +C).(\lambda (u4: T).(getl (S n) (CHead c0 k0 u1) (CHead e2 k1 u4)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u4: T).(pr0 +u4 u3))))))))))) (\lambda (b: B).(\lambda (n: nat).(\lambda (_: ((\forall +(e1: C).(\forall (u3: T).(\forall (k0: K).((getl n (CHead c3 (Bind b) u2) +(CHead e1 k0 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: T).(getl n +(CHead c0 (Bind b) u1) (CHead e2 k0 u4)))) (\lambda (e2: C).(\lambda (_: +T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u4: T).(pr0 u4 +u3)))))))))).(\lambda (e1: C).(\lambda (u0: T).(\lambda (k0: K).(\lambda (H4: +(getl (S n) (CHead c3 (Bind b) u2) (CHead e1 k0 u0))).(let H5 \def (H1 n e1 +u0 k0 (getl_gen_S (Bind b) c3 (CHead e1 k0 u0) u2 n H4)) in (ex3_2_ind C T +(\lambda (e2: C).(\lambda (u3: T).(getl n c0 (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u3 u0))) (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl (S n) (CHead c0 +(Bind b) u1) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 +e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0)))) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (H6: (getl n c0 (CHead x0 k0 x1))).(\lambda (H7: +(wcpr0 x0 e1)).(\lambda (H8: (pr0 x1 u0)).(ex3_2_intro C T (\lambda (e2: +C).(\lambda (u3: T).(getl (S n) (CHead c0 (Bind b) u1) (CHead e2 k0 u3)))) +(\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda +(u3: T).(pr0 u3 u0))) x0 x1 (getl_head (Bind b) n c0 (CHead x0 k0 x1) H6 u1) +H7 H8)))))) H5))))))))) (\lambda (f: F).(\lambda (n: nat).(\lambda (_: +((\forall (e1: C).(\forall (u3: T).(\forall (k0: K).((getl n (CHead c3 (Flat +f) u2) (CHead e1 k0 u3)) \to (ex3_2 C T (\lambda (e2: C).(\lambda (u4: +T).(getl n (CHead c0 (Flat f) u1) (CHead e2 k0 u4)))) (\lambda (e2: +C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u4: T).(pr0 u4 +u3)))))))))).(\lambda (e1: C).(\lambda (u0: T).(\lambda (k0: K).(\lambda (H4: +(getl (S n) (CHead c3 (Flat f) u2) (CHead e1 k0 u0))).(let H5 \def (H1 (S n) +e1 u0 k0 (getl_gen_S (Flat f) c3 (CHead e1 k0 u0) u2 n H4)) in (ex3_2_ind C T +(\lambda (e2: C).(\lambda (u3: T).(getl (S n) c0 (CHead e2 k0 u3)))) (\lambda +(e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 +u3 u0))) (ex3_2 C T (\lambda (e2: C).(\lambda (u3: T).(getl (S n) (CHead c0 +(Flat f) u1) (CHead e2 k0 u3)))) (\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 +e1))) (\lambda (_: C).(\lambda (u3: T).(pr0 u3 u0)))) (\lambda (x0: +C).(\lambda (x1: T).(\lambda (H6: (getl (S n) c0 (CHead x0 k0 x1))).(\lambda +(H7: (wcpr0 x0 e1)).(\lambda (H8: (pr0 x1 u0)).(ex3_2_intro C T (\lambda (e2: +C).(\lambda (u3: T).(getl (S n) (CHead c0 (Flat f) u1) (CHead e2 k0 u3)))) +(\lambda (e2: C).(\lambda (_: T).(wcpr0 e2 e1))) (\lambda (_: C).(\lambda +(u3: T).(pr0 u3 u0))) x0 x1 (getl_head (Flat f) n c0 (CHead x0 k0 x1) H6 u1) +H7 H8)))))) H5))))))))) k) h)))))))))) c2 c1 H))). + diff --git a/matita/contribs/LAMBDA-TYPES/Makefile b/matita/contribs/LAMBDA-TYPES/Makefile new file mode 100644 index 000000000..93fba67ce --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Makefile @@ -0,0 +1,10 @@ +GOALS = all opt clean clean.opt + +DEVELS = Base-1 LambdaDelta-1 Base-2 Unified-Sub + +$(GOALS): + @$(foreach DEVEL, $(DEVELS), $(MAKE) -k -C $(DEVEL) $@;) + +.PHONY: (GOALS) + +.SUFFIXES: diff --git a/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/defs.ma b/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/defs.ma new file mode 100644 index 000000000..b8a4e2a85 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/defs.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Unified-Sub/Lift/defs". + +(* LIFT RELATION + - Usage: invoke with positive polarity +*) + +include "datatypes/Term.ma". + +inductive Lift (l: Nat): Nat \to Term \to Term \to Prop \def + | lift_sort : \forall i,h. + Lift l i (sort h) (sort h) + | lift_lref_gt: \forall i,j. i > j \to + Lift l i (lref j) (lref j) + | lift_lref_le: \forall i,j1. i <= j1 \to + \forall j2. (l + j1 == j2) \to + Lift l i (lref j1) (lref j2) + | lift_bind : \forall i,u1,u2. Lift l i u1 u2 \to + \forall t1,t2. Lift l (succ i) t1 t2 \to + \forall r. Lift l i (intb r u1 t1) (intb r u2 t2) + | lift_flat : \forall i,u1,u2. Lift l i u1 u2 \to + \forall t1,t2. Lift l i t1 t2 \to + \forall r. Lift l i (intf r u1 t1) (intf r u2 t2) +. diff --git a/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/fun.ma b/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/fun.ma new file mode 100644 index 000000000..86e8031b4 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/fun.ma @@ -0,0 +1,57 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Unified-Sub/Lift/fun". + +include "Lift/inv.ma". + +(* Functional properties ****************************************************) + +theorem lift_total: \forall l, t, i. \exists u. Lift l i t u. + intros 2. elim t; clear t; + [ autobatch + | lapply (nle_gt_or_le n i). decompose; + [ autobatch + | lapply (nplus_total l n). decompose. autobatch + ] + | lapply (H i1). lapply (H1 (succ i1)). decompose. autobatch + | lapply (H i1). lapply (H1 i1). decompose. autobatch + ]. +qed. + +theorem lift_mono: \forall l,i,t,t1. Lift l i t t1 \to + \forall t2. Lift l i t t2 \to + t1 = t2. + intros 5. elim H; clear H i t t1; + [ lapply linear lift_inv_sort_1 to H1 + | lapply linear lift_inv_lref_1_gt to H2, H1 + | lapply linear lift_inv_lref_1_le_nplus to H3, H1, H2 + | lapply linear lift_inv_bind_1 to H5. decompose + | lapply linear lift_inv_flat_1 to H5. decompose + ]; destruct; autobatch. +qed. + +theorem lift_inj: \forall l,i,t1,t. Lift l i t1 t \to + \forall t2. Lift l i t2 t \to + t2 = t1. + intros 5. elim H; clear H i t1 t; + [ lapply linear lift_inv_sort_2 to H1 + | lapply linear lift_inv_lref_2_gt to H2, H1 + | lapply nle_nplus to H2 as H. + lapply linear nle_trans to H1, H as H0. + lapply lift_inv_lref_2_le_nplus to H3, H0, H2 + | lapply linear lift_inv_bind_2 to H5. decompose + | lapply linear lift_inv_flat_2 to H5. decompose + ]; destruct; autobatch. +qed. diff --git a/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/inv.ma b/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/inv.ma new file mode 100644 index 000000000..95630e43e --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/inv.ma @@ -0,0 +1,149 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Unified-Sub/Lift/inv". + +include "Lift/defs.ma". + +(* Inversion properties *****************************************************) + +theorem lift_inv_sort_1: \forall l, i, h, x. + Lift l i (sort h) x \to + x = sort h. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem lift_inv_lref_1: \forall l, i, j1, x. + Lift l i (lref j1) x \to + (i > j1 \land x = lref j1) \lor + (i <= j1 \land + \exists j2. (l + j1 == j2) \land x = lref j2 + ). + intros. inversion H; clear H; intros; destruct; autobatch depth = 5 size = 7. +qed. + +theorem lift_inv_bind_1: \forall l, i, r, u1, t1, x. + Lift l i (intb r u1 t1) x \to + \exists u2, t2. + Lift l i u1 u2 \land + Lift l (succ i) t1 t2 \land + x = intb r u2 t2. + intros. inversion H; clear H; intros; destruct; autobatch depth = 5 size = 7. +qed. + +theorem lift_inv_flat_1: \forall l, i, r, u1, t1, x. + Lift l i (intf r u1 t1) x \to + \exists u2, t2. + Lift l i u1 u2 \land + Lift l i t1 t2 \land + x = intf r u2 t2. + intros. inversion H; clear H; intros; destruct. autobatch depth = 5 size = 7. +qed. + +theorem lift_inv_sort_2: \forall l, i, x, h. + Lift l i x (sort h) \to + x = sort h. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem lift_inv_lref_2: \forall l, i, x, j2. + Lift l i x (lref j2) \to + (i > j2 \land x = lref j2) \lor + (i <= j2 \land + \exists j1. (l + j1 == j2) \land x = lref j1 + ). + intros. inversion H; clear H; intros; destruct; autobatch depth = 5 size = 10. +qed. + +theorem lift_inv_bind_2: \forall l, i, r, x, u2, t2. + Lift l i x (intb r u2 t2) \to + \exists u1, t1. + Lift l i u1 u2 \land + Lift l (succ i) t1 t2 \land + x = intb r u1 t1. + intros. inversion H; clear H; intros; destruct. autobatch depth = 5 size = 7. +qed. + +theorem lift_inv_flat_2: \forall l, i, r, x, u2, t2. + Lift l i x (intf r u2 t2) \to + \exists u1, t1. + Lift l i u1 u2 \land + Lift l i t1 t2 \land + x = intf r u1 t1. + intros. inversion H; clear H; intros; destruct. autobatch depth = 5 size = 7. +qed. + +(* Corollaries of inversion properties ***************************************) + +theorem lift_inv_lref_1_gt: \forall l, i, j1, x. + Lift l i (lref j1) x \to + i > j1 \to x = lref j1. + intros. + lapply linear lift_inv_lref_1 to H. decompose; destruct; + [ autobatch + | lapply linear nle_false to H2, H1. decompose + ]. +qed. + +theorem lift_inv_lref_1_le: \forall l, i, j1, x. + Lift l i (lref j1) x \to i <= j1 \to + \exists j2. (l + j1 == j2) \land x = lref j2. + intros. + lapply linear lift_inv_lref_1 to H. decompose; destruct; + [ lapply linear nle_false to H1, H2. decompose + | autobatch + ]. +qed. + +theorem lift_inv_lref_1_le_nplus: \forall l, i, j1, x. + Lift l i (lref j1) x \to + i <= j1 \to \forall j2. (l + j1 == j2) \to + x = lref j2. + intros. + lapply linear lift_inv_lref_1 to H. decompose; destruct; + [ lapply linear nle_false to H1, H3. decompose + | lapply linear nplus_mono to H2, H4. destruct. autobatch + ]. +qed. + +theorem lift_inv_lref_2_gt: \forall l, i, x, j2. + Lift l i x (lref j2) \to + i > j2 \to x = lref j2. + intros. + lapply linear lift_inv_lref_2 to H. decompose; destruct; + [ autobatch + | lapply linear nle_false to H2, H1. decompose + ]. + qed. + +theorem lift_inv_lref_2_le: \forall l, i, x, j2. + Lift l i x (lref j2) \to i <= j2 \to + \exists j1. (l + j1 == j2) \land x = lref j1. + intros. + lapply linear lift_inv_lref_2 to H. decompose; destruct; + [ lapply linear nle_false to H1, H2. decompose + | autobatch + ]. +qed. + +theorem lift_inv_lref_2_le_nplus: \forall l, i, x, j2. + Lift l i x (lref j2) \to + i <= j2 \to \forall j1. (l + j1 == j2) \to + x = lref j1. + intros. + lapply linear lift_inv_lref_2 to H. decompose; destruct; + [ lapply linear nle_false to H1, H3. decompose + | lapply linear nplus_inj_2 to H2, H4. destruct. autobatch + ]. +qed. diff --git a/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/props.ma b/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/props.ma new file mode 100644 index 000000000..9df9cbd63 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/props.ma @@ -0,0 +1,83 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Unified-Sub/Lift/props". + +include "Lift/fun.ma". + +(* NOTE: this holds because of nplus_comm_1 *) +theorem lift_comp: \forall l1,i1,t1,t2. Lift l1 i1 t1 t2 \to + \forall l2,i2,u1. Lift l2 i2 t1 u1 \to + \forall x. Lift l2 i2 t2 x \to + \forall i,y. Lift l1 i u1 y \to + i1 >= i2 \to (l2 + i1 == i) \to x = y. + intros 5. elim H; clear H i1 t1 t2; + [ lapply lift_mono to H1, H2. clear H2. destruct. + lapply linear lift_inv_sort_1 to H1. destruct. + lapply linear lift_inv_sort_1 to H3. destruct. autobatch + | lapply lift_mono to H2, H3. clear H3. destruct. + lapply linear lift_inv_lref_1 to H2. + decompose; destruct; clear H2 H5; + lapply linear lift_inv_lref_1_gt to H4; destruct; autobatch width = 4 + | lapply lift_inv_lref_1_le to H3; [ 2: autobatch ]. clear H3. + lapply lift_inv_lref_1_le to H4; [ 2: autobatch ]. clear H4. + decompose. destruct. clear H6 i2. + lapply lift_inv_lref_1_le to H5; [ 2: autobatch depth = 4 width = 4 ]. + decompose. destruct. clear H5 H1 H7 i. autobatch depth = 4 size = 7 + | clear H1 H3. + lapply linear lift_inv_bind_1 to H5. + lapply linear lift_inv_bind_1 to H6. decompose. destruct. + lapply linear lift_inv_bind_1 to H7. decompose. destruct. + autobatch depth = 4 width = 6 size = 15 + | clear H1 H3. + lapply linear lift_inv_flat_1 to H5. + lapply linear lift_inv_flat_1 to H6. decompose. destruct. + lapply linear lift_inv_flat_1 to H7. decompose. destruct. + autobatch depth = 4 width = 6 size = 9 + ]. +qed. + +theorem lift_comp_rew_dx: \forall l1,i1,t1,t2. Lift l1 i1 t1 t2 \to + \forall l2,i2,u1. Lift l2 i2 t1 u1 \to + \forall u2. Lift l2 i2 t2 u2 \to + i1 >= i2 \to \forall i. (l2 + i1 == i) \to + Lift l1 i u1 u2. + intros. + lapply (lift_total l1 u1 i). decompose. + lapply lift_comp to H, H1, H2, H5, H3, H4. destruct. autobatch. +qed. + +theorem lift_comp_rew_sx: \forall l1,i1,t1,t2. Lift l1 i1 t1 t2 \to + \forall l2,i2,u1. Lift l2 i2 t1 u1 \to + \forall i,u2. Lift l2 i t2 u2 \to + i2 >= i1 \to (l1 + i2 == i) \to + Lift l1 i1 u1 u2. + intros. + lapply (lift_total l1 u1 i1). decompose. + lapply lift_comp to H1, H, H5, H2, H3, H4. destruct. autobatch. +qed. +(* +theorem lift_trans_le: \forall l1,i1,t1,t2. Lift l1 i1 t1 t2 \to + \forall l2,i2,z. Lift l2 i2 t2 t3 \to + i1 <= i2 \to + \forall i. \to i2 <= i \to (l1 + i1 == i) \to + \forall l. (l1 + l2 == l) \to Lift l i1 t1 t3. + +axiom lift_conf_back_ge: \forall l1,i1,u1,u2. Lift l1 i1 u1 u2 \to + \forall l2,i,t2. Lift l2 i t2 u2 \to + \forall i2. i2 >= i1 \to (l1 + i2 == i) \to + \exists t1. | Lift l2 i2 t1 u1 \land + Lift l1 i1 t1 t2. + +*) diff --git a/matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Context.ma b/matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Context.ma new file mode 100644 index 000000000..f5c63fd0b --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Context.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Unified-Sub/datatypes/Context". + +(* FLAT CONTEXTS + - Naming policy: + - contexts: c d +*) + +include "datatypes/Term.ma". + +inductive Context: Type \def + | leaf: Context + | intb: Context \to IntB \to Term \to Context +. diff --git a/matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Term.ma b/matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Term.ma new file mode 100644 index 000000000..a7f5e7f07 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Term.ma @@ -0,0 +1,53 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Unified-Sub/datatypes/Term". + +(* POLARIZED TERMS + - Naming policy: + - natural numbers : sorts h k, local references i j, lengths l o + - boolean values : p q + - generic binding items: r s + - generic flat items : r s + - generic head items : m n + - terms : t u +*) + +include "preamble.ma". + +inductive Bind: Type \def + | abbr: Bind + | abst: Bind + | excl: Bind +. + +inductive Flat: Type \def + | appl: Flat + | cast: Flat +. + +inductive IntB: Type \def + | bind: Bool \to Bind \to IntB +. + +inductive IntF: Type \def + | flat: Bool \to Flat \to IntF +. + +inductive Term: Type \def + | sort: Nat \to Term + | lref: Nat \to Term + | intb: IntB \to Term \to Term \to Term + | intf: IntF \to Term \to Term \to Term +. diff --git a/matita/contribs/LAMBDA-TYPES/Unified-Sub/makefile b/matita/contribs/LAMBDA-TYPES/Unified-Sub/makefile new file mode 100644 index 000000000..d7a63e5f1 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Unified-Sub/makefile @@ -0,0 +1,39 @@ +H=@ + +RT_BASEDIR=../../../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/contribs/LAMBDA-TYPES/Unified-Sub/preamble.ma b/matita/contribs/LAMBDA-TYPES/Unified-Sub/preamble.ma new file mode 100644 index 000000000..d889c3995 --- /dev/null +++ b/matita/contribs/LAMBDA-TYPES/Unified-Sub/preamble.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* Project started Tue Aug 22, 2006 ***************************************) + +set "baseuri" "cic:/matita/LAMBDA-TYPES/Unified-Sub/preamble". + +(* PREAMBLE +*) + +include "logic/equality.ma". +include "../../RELATIONAL/datatypes/Bool.ma". +include "../../RELATIONAL/NPlus/monoid.ma". +include "../../RELATIONAL/NLE/props.ma". +include "../../RELATIONAL/NLE/nplus.ma". + +axiom f_equal_3: \forall (A,B,C,D:Set). + \forall (f:A \to B \to C \to D). + \forall (x1,x2:A). + \forall (y1,y2:B). + \forall (z1,z2:C). + x1 = x2 \to y1 = y2 \to z1 = z2 \to + f x1 y1 z1 = f x2 y2 z2. diff --git a/matita/contribs/LOGIC/CLE/defs.ma b/matita/contribs/LOGIC/CLE/defs.ma new file mode 100644 index 000000000..5b3ba49b7 --- /dev/null +++ b/matita/contribs/LOGIC/CLE/defs.ma @@ -0,0 +1,29 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/CLE/defs". + +(* ORDER RELATION BETWEEN POSITIONS AND CONTEXTS +*) + +include "datatypes_defs/Context.ma". + +inductive CLE: Nat \to Context \to Prop \def + | cle_zero: \forall Q. CLE zero Q + | cle_succ: \forall Q,i. CLE i Q \to + \forall p1,p2,R. CLE (succ i) (abst Q p1 p2 R) +. + +interpretation "order relation between positions and contexts" + 'leq x y = (cic:/matita/LOGIC/CLE/defs/CLE.ind#xpointer(1/1) x y). diff --git a/matita/contribs/LOGIC/Insert/defs.ma b/matita/contribs/LOGIC/Insert/defs.ma new file mode 100644 index 000000000..821fd99c2 --- /dev/null +++ b/matita/contribs/LOGIC/Insert/defs.ma @@ -0,0 +1,30 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Insert/defs". + +(* INSERT RELATION FOR CONTEXTS +*) + +include "Lift/defs.ma". +include "datatypes_defs/Context.ma". + +inductive Insert (p,q:Proof) (S:Sequent): + Nat \to Context \to Context \to Prop \def + | insert_zero: \forall P. Insert p q S zero P (abst P p q S) + | insert_succ: \forall P,Q,i. Insert p q S i P Q \to + \forall p1,p2. Lift i (succ zero) p1 p2 \to + \forall q1,q2. Lift i (succ zero) q1 q2 \to \forall R. + Insert p q S (succ i) (abst P p1 q1 R) (abst Q p2 q2 R) +. diff --git a/matita/contribs/LOGIC/Insert/fun.ma b/matita/contribs/LOGIC/Insert/fun.ma new file mode 100644 index 000000000..7c7aba28a --- /dev/null +++ b/matita/contribs/LOGIC/Insert/fun.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Insert/fun". + +include "CLE/defs.ma". +include "Insert/inv.ma". + +(* Functional properties ****************************************************) +(* +theorem insert_total: \forall S,i,P. i <= P \to \exists Q. Insert S i P Q. + intros 4; elim H; clear H i P; + decompose; autobatch. +qed. + +theorem insert_inj: \forall S1,i,P, Q. Insert S1 i P Q \to + \forall S2. Insert S2 i P Q \to S1 = S2. + intros 5; elim H; clear H i P Q; + [ lapply linear insert_inv_zero to H1; destruct; autobatch + | lapply linear insert_inv_succ to H3; decompose; destruct; autobatch + ]. +qed. +*) diff --git a/matita/contribs/LOGIC/Insert/inv.ma b/matita/contribs/LOGIC/Insert/inv.ma new file mode 100644 index 000000000..9053183f9 --- /dev/null +++ b/matita/contribs/LOGIC/Insert/inv.ma @@ -0,0 +1,57 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Insert/inv". + +(* +*) + +include "Insert/defs.ma". +(* +theorem insert_inv_zero: \forall S,P,Q. Insert S zero P Q \to Q = abst P S. + intros; inversion H; clear H; intros; destruct; autobatch. +qed. + +theorem insert_inv_succ: \forall S,Q1,Q2,i. Insert S (succ i) Q1 Q2 \to + \exists P1,P2,R. Insert S i P1 P2 \land + Q1 = abst P1 R \land Q2 = abst P2 R. + intros; inversion H; clear H; intros; destruct; autobatch depth = 6 size = 8. +qed. + +theorem insert_inv_leaf_1: \forall Q,S,i. Insert S i leaf Q \to + i = zero \land Q = S. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem insert_inv_abst_1: \forall P,Q,R,S,i. Insert S i (abst P R) Q \to + (i = zero \land Q = (abst (abst P R) S)) \lor + \exists n, c1. + i = succ n \land Q = abst c1 R \land + Insert S n P c1. + intros. inversion H; clear H; intros; destruct; autobatch depth = 6 size = 8. +qed. + +theorem insert_inv_leaf_2: \forall P,S,i. Insert S i P leaf \to False. + intros. inversion H; clear H; intros; destruct. +qed. + +theorem insert_inv_abst_2: \forall P,i. \forall R,S:Sequent. + Insert S i P R \to + i = zero \land P = leaf \land R = S. + intros. inversion H; clear H; intros; destruct; + [ autobatch + | clear H1. lapply linear insert_inv_leaf_2 to H. decompose + ]. +qed. +*) diff --git a/matita/contribs/LOGIC/Insert/props.ma b/matita/contribs/LOGIC/Insert/props.ma new file mode 100644 index 000000000..17148e27e --- /dev/null +++ b/matita/contribs/LOGIC/Insert/props.ma @@ -0,0 +1,73 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Insert/props". + +(* +*) + +include "Insert/fun.ma". +(* +theorem insert_conf: \forall P,Q1,S1,i1. Insert S1 i1 P Q1 \to + \forall Q2,S2,i2. Insert S2 i2 P Q2 \to + \exists Q,j1,j2. + Insert S2 j2 Q1 Q \land Insert S1 j1 Q2 Q. + intros 5. elim H; clear H i1 P Q1; + [ elim H1; clear H1 i2 c Q2; decompose; autobatch depth = 7 size = 8 + | lapply linear insert_inv_abst_1 to H3. decompose; destruct; + [ autobatch depth = 7 size = 8 + | lapply linear H2 to H4. decompose. destruct. autobatch depth = 6 size = 8 + ] + ]. +qed. + +theorem insert_trans: \forall P1,Q1,S1,i1. Insert S1 i1 P1 Q1 \to + \forall Q2,S2,i2. Insert S2 i2 Q1 Q2 \to + \exists P2,j1,j2. + Insert S2 j2 P1 P2 \land Insert S1 j1 P2 Q2. + intros 5. elim H; clear H i1 P1 Q1; + [ lapply linear insert_inv_abst_1 to H1. decompose; destruct; autobatch depth = 6 size = 7 + | lapply linear insert_inv_abst_1 to H3. decompose; destruct; + [ clear H2. autobatch depth = 7 size = 8 + | lapply linear H2 to H4. decompose. destruct. autobatch depth = 6 size = 8 + ] + ]. +qed. + +theorem insert_conf_rev: \forall P1,Q,S1,i1. Insert S1 i1 P1 Q \to + \forall P2,S2,i2. Insert S2 i2 P2 Q \to + (i1 = i2 \land P1 = P2) \lor + \exists Q1,Q2,j1,j2. + Insert S2 j2 Q2 P1 \land Insert S1 j1 Q1 P2. + intros 5; elim H; clear H i1 P1 Q; + [ inversion H1; clear H1; intros; destruct; autobatch depth = 7 size = 8 + | inversion H3; clear H3; intros; destruct; + [ autobatch depth = 7 size = 8 + | clear H3; lapply linear H2 to H; decompose; destruct; + autobatch depth = 8 size = 10 + ] + ]. +qed. + +theorem insert_conf_rev_full: \forall P1,Q,S1,i1. Insert S1 i1 P1 Q \to + \forall P2,S2,i2. Insert S2 i2 P2 Q \to + (S1 = S2 \land i1 = i2 \land P1 = P2) \lor + \exists Q1,Q2,j1,j2. + Insert S2 j2 Q2 P1 \land Insert S1 j1 Q1 P2. + intros; lapply insert_conf_rev to H, H1; decompose; destruct; + [ lapply linear insert_inj to H, H1; destruct; autobatch depth = 4 + | autobatch depth = 7 size = 8 + ]. +qed. +*) diff --git a/matita/contribs/LOGIC/Lift/defs.ma b/matita/contribs/LOGIC/Lift/defs.ma new file mode 100644 index 000000000..f770bcf8d --- /dev/null +++ b/matita/contribs/LOGIC/Lift/defs.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Lift/defs". + +(* PROOF RELOCATION +*) + +include "datatypes_defs/Proof.ma". + +inductive Lift: Nat \to Nat \to Proof \to Proof \to Prop \def + | lift_lref_lt: \forall jd,jh,i. i < jd \to Lift jd jh (lref i) (lref i) + | lift_lref_ge: \forall jd,jh,i1,i2. jd <= i1 \to (i1 + jh == i2) \to + Lift jd jh (lref i1) (lref i2) + | lift_prin : \forall jd,jh,h. Lift jd jh (prin h) (prin h) + | lift_impw : \forall jd,jh,p1,p2. + Lift jd jh p1 p2 \to Lift jd jh (impw p1) (impw p2) + | lift_impr : \forall jd,jh,p1,p2. + Lift jd jh p1 p2 \to Lift jd jh (impr p1) (impr p2) + | lift_impi : \forall jd,jh,p1,p2. Lift jd jh p1 p2 \to + \forall q1,q2. Lift jd jh q1 q2 \to + \forall r1,r2. Lift (succ jd) jh r1 r2 \to + Lift jd jh (impi p1 q1 r1) (impi p2 q2 r2) + | lift_scut : \forall jd,jh,p1,p2. Lift jd jh p1 p2 \to + \forall q1,q2. Lift jd jh q1 q2 \to + Lift jd jh (scut p1 q1) (scut p2 q2) +. diff --git a/matita/contribs/LOGIC/NTrack/defs.ma b/matita/contribs/LOGIC/NTrack/defs.ma new file mode 100644 index 000000000..1bf18389f --- /dev/null +++ b/matita/contribs/LOGIC/NTrack/defs.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/NTrack/defs". + +(* NORMAL PROOF TREE TRACKS +*) + +include "Insert/defs.ma". +(* +inductive NTrack: Context \to Proof \to Sequent \to Prop \def + | ntrack_proj: \forall P,Q,S,i. Insert S i P Q \to NTrack Q (lref i) S + | ntrack_posr: \forall P,h. + NTrack P (parx h) (pair (posr h) (posr h)) + | ntrack_impw: \forall P,r,D,a,b. NTrack P r (pair lleaf D) \to + NTrack P (impw r) (pair (impl a b) D) + | ntrack_impr: \forall P,r. \forall a,b:Formula. + NTrack P r (pair a b) \to + NTrack P (impr r) (pair lleaf (impl a b)) + | ntrack_impi: \forall P,Q,p,q,r,A,B,D,i. \forall a,b:Formula. + NTrack P p (pair A a) \to + NTrack P q (pair b B) \to + NTrack Q r (pair lleaf D) \to + Insert (pair A B) i P Q \to + NTrack P (impi p q r) (pair (impl a b) D) +. +*) diff --git a/matita/contribs/LOGIC/NTrack/inv.ma b/matita/contribs/LOGIC/NTrack/inv.ma new file mode 100644 index 000000000..f272bd518 --- /dev/null +++ b/matita/contribs/LOGIC/NTrack/inv.ma @@ -0,0 +1,66 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/NTrack/inv". + +include "NTrack/defs.ma". +(* +theorem ntrack_inv_lref: \forall Q,S,i. NTrack Q (lref i) S \to + \exists P. Insert S i P Q. + intros; inversion H; clear H; intros; destruct; autobatch. +qed. + +theorem ntrack_inv_parx: \forall P,S,h. NTrack P (parx h) S \to + S = pair (posr h) (posr h). + intros; inversion H; clear H; intros; destruct; autobatch. +qed. + +theorem ntrack_inv_impw: \forall P,p,S. NTrack P (impw p) S \to + \exists B,a,b. + S = pair (impl a b) B \land + NTrack P p (pair lleaf B). + intros; inversion H; clear H; intros; destruct; autobatch depth = 5. +qed. + +theorem ntrack_inv_impr: \forall P,p,S. NTrack P (impr p) S \to + \exists a,b:Formula. + S = pair lleaf (impl a b) \land + NTrack P p (pair a b). + intros; inversion H; clear H; intros; destruct; autobatch depth = 4. +qed. + +theorem ntrack_inv_impi: \forall P,p,q,r,S. NTrack P (impi p q r) S \to + \exists Q,A,B,D,i. \exists a,b:Formula. + S = pair (impl a b) D \land + NTrack P p (pair A a) \land + NTrack P q (pair b B) \land + NTrack Q r (pair lleaf D) \land + Insert (pair A B) i P Q. + intros; inversion H; clear H; intros; destruct; autobatch depth = 12 width = 5 size = 16. +qed. + +theorem ntrack_inv_scut: \forall P,q,r,S. NTrack P (scut q r) S \to False. + intros; inversion H; clear H; intros; destruct. +qed. + +theorem ntrack_inv_lleaf_impl: + \forall Q,p,a,b. NTrack Q p (pair lleaf (impl a b)) \to + (\exists P,i. p = lref i \land Insert (pair lleaf (impl a b)) i P Q) \lor + (\exists r. p = impr r \land NTrack Q r (pair a b)). + intros; inversion H; clear H; intros; destruct; + [ autobatch depth = 5 + | destruct; autobatch depth = 4 + ]. +qed. +*) diff --git a/matita/contribs/LOGIC/NTrack/order.ma b/matita/contribs/LOGIC/NTrack/order.ma new file mode 100644 index 000000000..11868b6ef --- /dev/null +++ b/matita/contribs/LOGIC/NTrack/order.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/NTrack/order". + +include "Track/order.ma". +include "NTrack/props.ma". + +(* Order properties *********************************************************) +(* +theorem ntrack_refl: \forall P. \forall c:Formula. \exists r. + NTrack P r (pair c c). + intros; elim c; clear c; + [ autobatch + | lapply (insert_total (pair f f1) zero P); [2:autobatch]; + decompose; autobatch depth = 5 width = 4 size = 8 + ]. +qed. +(* +theorem ntrack_trans: \forall p,q,A,B. \forall c:Formula. + NTrack leaf p (pair A c) \to NTrack leaf q (pair c B) \to + \exists r. NTrack leaf r (pair A B). + intros; + lapply linear ntrack_track to H as H0; + lapply linear ntrack_track to H1 as H; + lapply linear track_trans to H0, H as H1; decompose; +*) +*) diff --git a/matita/contribs/LOGIC/NTrack/props.ma b/matita/contribs/LOGIC/NTrack/props.ma new file mode 100644 index 000000000..bdd23748f --- /dev/null +++ b/matita/contribs/LOGIC/NTrack/props.ma @@ -0,0 +1,63 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/NTrack/props". + +include "Insert/props.ma". +include "Track/defs.ma". +include "NTrack/inv.ma". +(* +theorem ntrack_weak: \forall R,p,P,Q,S,i. + NTrack P p S \to Insert R i P Q \to + \exists q. NTrack Q q S. + intros 2; elim p; clear p; + [ lapply linear ntrack_inv_lref to H as H0; decompose; + lapply linear insert_trans to H, H1; decompose; autobatch + | lapply linear ntrack_inv_parx to H; destruct; autobatch + | lapply linear ntrack_inv_impw to H1; decompose; destruct; + lapply linear H to H4, H2; decompose; autobatch + | lapply linear ntrack_inv_impr to H1; decompose; destruct; + lapply linear H to H4, H2; decompose; autobatch + | lapply linear ntrack_inv_impi to H3; decompose; destruct; + lapply insert_conf to H4, H6; clear H6; decompose; + lapply H to H9, H4; clear H H9; lapply linear H1 to H8, H4; + lapply linear H2 to H7, H6; decompose; autobatch width = 4 + | lapply linear ntrack_inv_scut to H2; decompose + ] +qed. + +theorem ntrack_comp: \forall R,q,p,P,Q,S,i. + NTrack P p R \to NTrack Q q S \to Insert R i P Q \to + \exists r. NTrack P r S. + intros 2; elim q; clear q; + [ lapply linear ntrack_inv_lref to H1 as H0; decompose; + lapply linear insert_conf_rev_full to H1,H2; decompose; destruct; autobatch + | lapply linear ntrack_inv_parx to H1; destruct; autobatch + | lapply linear ntrack_inv_impw to H2; decompose; destruct; + lapply linear H to H1, H5, H3; decompose; autobatch + | lapply linear ntrack_inv_impr to H2; decompose; destruct; + lapply linear H to H1, H5, H3; decompose; autobatch + | lapply linear ntrack_inv_impi to H4; decompose; destruct; + lapply insert_trans to H5, H7; clear H7; decompose; + lapply ntrack_weak to H3, H6; decompose; + lapply H to H3, H10, H5; clear H H10; lapply linear H1 to H3, H9, H5; + lapply linear H2 to H4, H8, H7; decompose; autobatch width = 4 + | lapply linear ntrack_inv_scut to H3; decompose + ]. +qed. + +theorem ntrack_track: \forall R,p,P. NTrack P p R \to Track P p R. + intros; elim H names 0; clear H P p R; intros; autobatch width = 4. +qed. +*) diff --git a/matita/contribs/LOGIC/PEq/defs.ma b/matita/contribs/LOGIC/PEq/defs.ma new file mode 100644 index 000000000..1ffe5b20b --- /dev/null +++ b/matita/contribs/LOGIC/PEq/defs.ma @@ -0,0 +1,35 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/PEq/defs". + +(* EQUALITY PREDICATE FOR PROOFS IN CONTEXT +*) + +include "datatypes_defs/Context.ma". + +inductive PEq (Q1:Context) (p1:Proof) (Q2:Context) (p2:Proof): Prop \def + | peq_intro: Q1 = Q2 \land p1 = p2 \to PEq Q1 p1 Q2 p2 +. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation + "leibniz equality between proofs in context" + 'eq2 x1 y1 x2 y2 = + (cic:/matita/LOGIC/PEq/defs/PEq.ind#xpointer(1/1) x1 y1 x2 y2) +. + +notation "hvbox([a1,b1] break = [a2,b2])" + non associative with precedence 45 +for @{ 'eq2 $a1 $b1 $a2 $b2 }. diff --git a/matita/contribs/LOGIC/PNF/defs.ma b/matita/contribs/LOGIC/PNF/defs.ma new file mode 100644 index 000000000..4f11e8c56 --- /dev/null +++ b/matita/contribs/LOGIC/PNF/defs.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/PNF/defs". + +(* NORMAL FORM PREDICATE FOR PROOFS IN CONTEXT + For cut elimination +*) + +include "PEq/defs.ma". +include "PRed/defs.ma". + +inductive PNF (P:Context) (p:Proof): Prop \def + | pnf: (\forall q,Q,S. [P, p, S] => [Q, q, S] \to [P, p] = [Q, q]) \to + PNF P p +. diff --git a/matita/contribs/LOGIC/PRed/defs.ma b/matita/contribs/LOGIC/PRed/defs.ma new file mode 100644 index 000000000..85a4c3bf9 --- /dev/null +++ b/matita/contribs/LOGIC/PRed/defs.ma @@ -0,0 +1,63 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/PRed/defs". + +(* SINGLE STEP PARALLEL REDUCTION + For cut elimination +*) + +include "Insert/defs.ma". + +inductive PRed: Context \to Proof \to Sequent \to + Context \to Proof \to Sequent \to Prop \def + | pred_lref: \forall P,i,S. PRed P (lref i) S P (lref i) S + | pred_prin: \forall P,h,S. PRed P (prin h) S P (prin h) S + | pred_impw: \forall Q1,Q2,p1,p2. (\forall S. PRed Q1 p1 S Q2 p2 S) \to + \forall S. PRed Q1 (impw p1) S Q2 (impw p2) S + | pred_impr: \forall Q1,Q2,p1,p2. (\forall S. PRed Q1 p1 S Q2 p2 S) \to + \forall S. PRed Q1 (impr p1) S Q2 (impr p2) S + | pred_impi: \forall Q1,Q2,p1,p2. (\forall S. PRed Q1 p1 S Q2 p2 S) \to + \forall q1,q2. (\forall S. PRed Q1 q1 S Q2 q2 S) \to + \forall r1,r2. (\forall S,R. PRed (abst Q1 p1 q1 R) r1 S (abst Q2 p2 q2 R) r2 S) \to + \forall S. PRed Q1 (impi p1 q1 r1) S Q2 (impi p2 q2 r2) S + | pred_scut: \forall Q1,Q2,p1,p2. (\forall S. PRed Q1 p1 S Q2 p2 S) \to + \forall q1,q2. (\forall S. PRed Q1 q1 S Q2 q2 S) \to + \forall S. PRed Q1 (scut p1 q1) S Q2 (scut p2 q2) S + | pred_a_sx: \forall p1,p2,R,P,Q1,i. Insert p1 p2 R i P Q1 \to + \forall q0,S,Q2. Insert p1 (scut p2 q0) S i P Q2 \to + \forall q. Lift zero i q0 q \to + PRed Q1 (scut (lref i) q) S Q2 (lref i) S + | pred_a_dx: \forall q1,q2,R,P,Q1,i. Insert q1 q2 R i P Q1 \to + \forall p0,S,Q2. Insert (scut p0 q1) q2 S i P Q2 \to + \forall p. Lift zero i p0 p \to + PRed Q1 (scut p (lref i)) S Q2 (lref i) S + | pred_b_sx: \forall q1,q2,P1,P2,S. PRed P1 q1 S P2 q2 S \to + \forall h. PRed P1 (scut (prin h) q1) S P2 q2 S + | pred_b_dx: \forall p1,p2,Q1,Q2,S. PRed Q1 p1 S Q2 p2 S \to + \forall h. PRed Q1 (scut p1 (prin h)) S Q2 p2 S + | pred_c : \forall p1,p2,Q1,Q2,S. PRed Q1 p1 S Q2 p2 S \to + \forall p. PRed Q1 (scut (impr p) (impw p1)) S Q2 p2 S +. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation + "single step parallel reduction in B->" + 'parred3 x1 y1 z1 x2 y2 z2 = + (cic:/matita/LOGIC/PRed/defs/PRed.ind#xpointer(1/1) x1 y1 z1 x2 y2 z2) +. + +notation "hvbox([a1,b1,c1] break => [a2,b2,c2])" + non associative with precedence 45 +for @{ 'parred3 $a1 $b1 $c1 $a2 $b2 $c2 }. diff --git a/matita/contribs/LOGIC/PRed/wlt.ma b/matita/contribs/LOGIC/PRed/wlt.ma new file mode 100644 index 000000000..3e7d727ed --- /dev/null +++ b/matita/contribs/LOGIC/PRed/wlt.ma @@ -0,0 +1,29 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/PRed/wlt". + +(**) + +include "PEq/defs.ma". +include "PRed/defs.ma". +include "WLT/defs.ma". +(* +theorem pred_wlt: \forall p1,p2,Q1,Q2,S. + [Q1, p1, S] => [Q2, p2, S] \to \lnot [Q1, p1] = [Q2, p2] \to + [Q2, p2] < [Q1, p1]. + intros 6; elim H; clear H; + [ unfold Not in H1; lapply linear depth = 1 H1; + [ decompose | autobatch ] +*) diff --git a/matita/contribs/LOGIC/Track/defs.ma b/matita/contribs/LOGIC/Track/defs.ma new file mode 100644 index 000000000..25cf7c0b5 --- /dev/null +++ b/matita/contribs/LOGIC/Track/defs.ma @@ -0,0 +1,41 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Track/defs". + +(* PROOF TREE TRACKS +*) + +include "Insert/defs.ma". + +inductive Track: Context \to Proof \to Sequent \to Prop \def + | track_proj: \forall P,Q,p1,p2,S,i. + Insert p1 p2 S i P Q \to Track Q (lref i) S + | track_posr: \forall P,h. + Track P (prin h) (pair (posr h) (posr h)) + | track_impw: \forall P,r,D,a,b. Track P r (pair lleaf D) \to + Track P (impw r) (pair (impl a b) D) + | track_impr: \forall P,r. \forall a,b:Formula. + Track P r (pair a b) \to + Track P (impr r) (pair lleaf (impl a b)) + | track_impi: \forall P,p,q,r,A,B,D. \forall a,b:Formula. + Track P p (pair A a) \to + Track P q (pair b B) \to + Track (abst P p q (pair A B)) r (pair lleaf D) \to + Track P (impi p q r) (pair (impl a b) D) + | track_scut: \forall P,p,q,A,B. \forall c:Formula. + Track P p (pair A c) \to + Track P q (pair c B) \to + Track P (scut p q) (pair A B) +. diff --git a/matita/contribs/LOGIC/Track/inv.ma b/matita/contribs/LOGIC/Track/inv.ma new file mode 100644 index 000000000..d38d3f120 --- /dev/null +++ b/matita/contribs/LOGIC/Track/inv.ma @@ -0,0 +1,60 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Track/inv". + +include "Track/defs.ma". + +(* Main inversion lemmas ****************************************************) + +theorem track_inv_lref: \forall Q,S,i. Track Q (lref i) S \to + \exists p1,p2,P. Insert p1 p2 S i P Q. + intros; inversion H; clear H; intros; destruct; autobatch depth = 4. +qed. + +theorem track_inv_prin: \forall P,S,h. Track P (prin h) S \to + S = pair (posr h) (posr h). + intros; inversion H; clear H; intros; destruct; autobatch. +qed. + +theorem track_inv_impw: \forall P,p,S. Track P (impw p) S \to + \exists B,a,b. + S = pair (impl a b) B \land + Track P p (pair lleaf B). + intros; inversion H; clear H; intros; destruct; autobatch depth = 5. +qed. + +theorem track_inv_impr: \forall Q,p,S. Track Q (impr p) S \to + \exists a,b:Formula. + S = pair lleaf (impl a b) \land + Track Q p (pair a b). + intros; inversion H; clear H; intros; destruct; autobatch depth = 4. +qed. + +theorem track_inv_impi: \forall P,p,q,r,S. Track P (impi p q r) S \to + \exists A,B,D. \exists a,b:Formula. + S = pair (impl a b) D \land + Track P p (pair A a) \land + Track P q (pair b B) \land + Track (abst P p q (pair A B)) r (pair lleaf D). + intros; inversion H; clear H; intros; destruct; autobatch depth = 9 width = 4 size = 12. +qed. + +theorem track_inv_scut: \forall P,q,r,S. Track P (scut q r) S \to + \exists A,B. \exists c:Formula. + S = pair A B \land + Track P q (pair A c) \land + Track P r (pair c B). + intros; inversion H; clear H; intros; destruct; autobatch depth = 6 size = 8. +qed. diff --git a/matita/contribs/LOGIC/Track/order.ma b/matita/contribs/LOGIC/Track/order.ma new file mode 100644 index 000000000..2c90f3303 --- /dev/null +++ b/matita/contribs/LOGIC/Track/order.ma @@ -0,0 +1,36 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Track/order". + +include "Insert/fun.ma". +include "Track/defs.ma". + +(* Order properties *********************************************************) +(* +theorem track_refl: \forall P. \forall c:Formula. \exists r. + Track P r (pair c c). + intros; elim c; clear c; + [ autobatch + | lapply (insert_total (pair f f1) zero P); [2:autobatch]; + decompose; autobatch depth = 5 width = 4 size = 8 + ]. +qed. + +theorem track_trans: \forall P,p,q,A,B. \forall c:Formula. + Track P p (pair A c) \to Track P q (pair c B) \to + \exists r. Track P r (pair A B). + intros; autobatch. +qed. +*) diff --git a/matita/contribs/LOGIC/Track/pred.ma b/matita/contribs/LOGIC/Track/pred.ma new file mode 100644 index 000000000..cce6c7800 --- /dev/null +++ b/matita/contribs/LOGIC/Track/pred.ma @@ -0,0 +1,46 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Track/pred". + +(**) + +include "datatypes_props/Sequent.ma". +include "Track/inv.ma". +include "PRed/defs.ma". + +theorem track_pred: \forall Q1,Q2,p1,p2,S1,S2. [Q1, p1, S1] => [Q2, p2, S2] \to + Track Q1 p1 S1 \to Track Q2 p2 S2. + intros 7; elim H; clear H Q1 Q2 p1 p2 S1 S2; + [ autobatch + | autobatch + | lapply linear track_inv_impw to H3; decompose; destruct; autobatch + | lapply linear track_inv_impr to H3; decompose; destruct; autobatch + | lapply linear track_inv_impi to H7; decompose; destruct; autobatch size = 7 + | lapply linear track_inv_scut to H5; decompose; destruct; autobatch + | lapply linear track_inv_scut to H4; decompose; destruct; + lapply linear track_inv_lref to H6; decompose; autobatch + | lapply linear track_inv_scut to H4; decompose; destruct; + lapply linear track_inv_lref to H5; decompose; autobatch + | lapply linear track_inv_scut to H3; decompose; destruct; + lapply linear track_inv_prin to H5; destruct; + lapply linear rinj_inj to Hcut1; destruct; autobatch + | lapply linear track_inv_scut to H3; decompose; destruct; + lapply linear track_inv_prin to H4; destruct; + lapply linear linj_inj to Hcut; destruct; autobatch + | lapply linear track_inv_scut to H3; decompose; destruct; + lapply linear track_inv_impw to H4; decompose; destruct; + lapply linear track_inv_impr to H5; decompose; destruct; autobatch + ]. +qed. diff --git a/matita/contribs/LOGIC/WLT/defs.ma b/matita/contribs/LOGIC/WLT/defs.ma new file mode 100644 index 000000000..5a844a60a --- /dev/null +++ b/matita/contribs/LOGIC/WLT/defs.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/WLT/defs". + +(* ORDER RELATION BETWEEN PROOFS IN CONTEXT +*) + +include "Weight/defs.ma". + +inductive WLT (Q1:Context) (p1:Proof) (Q2:Context) (p2:Proof): Prop \def + | wlt_intro: \forall m,m1. Weight m Q1 p1 m1 \to + \forall m2. Weight m Q2 p2 m2 \to + m1 < m2 \to WLT Q1 p1 Q2 p2 +. + +interpretation "order relation between proofs in context" + 'lt2 x1 y1 x2 y2 = + (cic:/matita/LOGIC/WLT/defs/WLT.ind#xpointer(1/1) x1 y1 x2 y2). + +notation "hvbox([a1, b1] break \lt [a2, b2])" + non associative with precedence 45 +for @{ 'lt2 $a1 $b1 $a2 $b2 }. diff --git a/matita/contribs/LOGIC/Weight/defs.ma b/matita/contribs/LOGIC/Weight/defs.ma new file mode 100644 index 000000000..5dfcdde5c --- /dev/null +++ b/matita/contribs/LOGIC/Weight/defs.ma @@ -0,0 +1,36 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/Weight/defs". + +(* PROOF WEIGHT + For cut elimination and confluence +*) + +include "datatypes_defs/Context.ma". + + +inductive Weight: Nat \to Context \to Proof \to Nat \to Prop \def + | weight_prin: \forall Q,n,m. Weight m Q (prin n) m + | weight_impw: \forall p,Q,m0,m1. Weight m0 Q p m1 \to + \forall m. (m1 + m0 == m) \to + Weight m0 Q (impw p) m + | weight_impr: \forall p,Q,m0,m1. Weight m0 Q p m1 \to + \forall m. (m1 + m0 == m) \to + Weight m0 Q (impr p) m + | weight_scut: \forall p1,Q,m0,m1. Weight (succ m0) Q p1 m1 \to + \forall p2,m2. Weight (succ m0) Q p2 m2 \to + \forall m. (m1 + m2 == m) \to + Weight m0 Q (scut p1 p2) m +. diff --git a/matita/contribs/LOGIC/datatypes_defs/Context.ma b/matita/contribs/LOGIC/datatypes_defs/Context.ma new file mode 100644 index 000000000..e5dba4aaf --- /dev/null +++ b/matita/contribs/LOGIC/datatypes_defs/Context.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/datatypes_defs/Context". + +(* FLAT CONTEXTS + - Naming policy: + - contexts: P Q +*) + +include "datatypes_defs/Proof.ma". +include "datatypes_defs/Sequent.ma". + +inductive Context: Type \def + | leaf: Context + | abst: Context \to Proof \to Proof \to Sequent \to Context +. +(* +definition inj: Sequent \to Context \def abst leaf. + +coercion cic:/matita/LOGIC/datatypes_defs/Context/inj.con. +*) diff --git a/matita/contribs/LOGIC/datatypes_defs/Formula.ma b/matita/contribs/LOGIC/datatypes_defs/Formula.ma new file mode 100644 index 000000000..ec6441dd1 --- /dev/null +++ b/matita/contribs/LOGIC/datatypes_defs/Formula.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/datatypes_defs/Formula". + +(* FORMULAE + - Naming policy: + - formulae: a b c d +*) + +include "preamble.ma". + +inductive Formula: Type \def + | posr: Nat \to Formula + | impl: Formula \to Formula \to Formula +. diff --git a/matita/contribs/LOGIC/datatypes_defs/Proof.ma b/matita/contribs/LOGIC/datatypes_defs/Proof.ma new file mode 100644 index 000000000..fa2c29ffa --- /dev/null +++ b/matita/contribs/LOGIC/datatypes_defs/Proof.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/datatypes_defs/Proof". + +(* PROOFS + - Naming policy: + - proofs: p q r s +*) + +include "preamble.ma". + +inductive Proof: Type \def + | lref: Nat \to Proof (* projection *) + | prin: Nat \to Proof (* pos rel inhabitant *) + | impw: Proof \to Proof (* weakening *) + | impr: Proof \to Proof (* right introduction *) + | impi: Proof \to Proof \to Proof \to Proof (* left introduction *) + | scut: Proof \to Proof \to Proof (* symmetric cut *) +. diff --git a/matita/contribs/LOGIC/datatypes_defs/Sequent.ma b/matita/contribs/LOGIC/datatypes_defs/Sequent.ma new file mode 100644 index 000000000..09d826991 --- /dev/null +++ b/matita/contribs/LOGIC/datatypes_defs/Sequent.ma @@ -0,0 +1,46 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/datatypes_defs/Sequent". + +(* SEQUENTS + - Naming policy: + - left hand sides (lhs): A C + - right hand sides (rhs): B D + - sequents : R S +*) + +include "datatypes_defs/Formula.ma". + +inductive LHS: Type \def + | lleaf: LHS + | labst: LHS \to Formula \to LHS +. + +inductive RHS: Type \def + | rleaf: RHS + | rabst: Formula \to RHS \to RHS +. + +inductive Sequent: Type \def + | pair: LHS \to RHS \to Sequent +. + +definition linj: Formula \to LHS \def labst lleaf. + +definition rinj: Formula \to RHS \def \lambda b. rabst b rleaf. + +coercion cic:/matita/LOGIC/datatypes_defs/Sequent/linj.con. + +coercion cic:/matita/LOGIC/datatypes_defs/Sequent/rinj.con. diff --git a/matita/contribs/LOGIC/datatypes_props/Sequent.ma b/matita/contribs/LOGIC/datatypes_props/Sequent.ma new file mode 100644 index 000000000..f7c44a81f --- /dev/null +++ b/matita/contribs/LOGIC/datatypes_props/Sequent.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/LOGIC/datatypes_props/Sequent". + +include "datatypes_defs/Sequent.ma". + +theorem linj_inj: \forall a,c. linj a = linj c \to a = c. + intros; whd in H:(? ? % %); destruct; autobatch. +qed. + +theorem rinj_inj: \forall b,d. rinj b = rinj d \to b = d. + intros; whd in H:(? ? % %); destruct; autobatch. +qed. diff --git a/matita/contribs/LOGIC/makefile b/matita/contribs/LOGIC/makefile new file mode 100644 index 000000000..e5ac91fc8 --- /dev/null +++ b/matita/contribs/LOGIC/makefile @@ -0,0 +1,39 @@ +H=@ + +RT_BASEDIR=../../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/contribs/LOGIC/preamble.ma b/matita/contribs/LOGIC/preamble.ma new file mode 100644 index 000000000..b1e50f811 --- /dev/null +++ b/matita/contribs/LOGIC/preamble.ma @@ -0,0 +1,22 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* Project started Sat Apr 7, 2007 ****************************************) + +set "baseuri" "cic:/matita/LOGIC/preamble". + +(* PREAMBLE +*) + +include "../RELATIONAL/NLE/defs.ma". diff --git a/matita/contribs/Makefile b/matita/contribs/Makefile new file mode 100644 index 000000000..9c104f361 --- /dev/null +++ b/matita/contribs/Makefile @@ -0,0 +1,10 @@ +GOALS = all opt clean clean.opt + +DEVELS = ../library ../legacy RELATIONAL LOGIC LAMBDA-TYPES + +$(GOALS): + @$(foreach DEVEL, $(DEVELS), $(MAKE) -C $(DEVEL) $@;) + +.PHONY: (GOALS) + +.SUFFIXES: diff --git a/matita/contribs/PREDICATIVE-TOPOLOGY/class_defs.ma b/matita/contribs/PREDICATIVE-TOPOLOGY/class_defs.ma new file mode 100644 index 000000000..62fc8bdfa --- /dev/null +++ b/matita/contribs/PREDICATIVE-TOPOLOGY/class_defs.ma @@ -0,0 +1,79 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* STATO: COMPILA *) + +(* Project started Wed Oct 12, 2005 ***************************************) + +set "baseuri" "cic:/matita/PREDICATIVE-TOPOLOGY/class_defs". + +include "logic/connectives.ma". + +(* ACZEL CATEGORIES: + - We use typoids with a compatible membership relation + - The category is intended to be the domain of the membership relation + - The membership relation is necessary because we need to regard the + domain of a propositional function (ie a predicative subset) as a + quantification domain and therefore as a category, but there is no + type in CIC representing the domain of a propositional function + - We set up a single equality predicate, parametric on the category, + defined as the reflexive, symmetic, transitive and compatible closure + of the cle1 predicate given inside the category. Then we prove the + properties of the equality that usually are axiomatized inside the + category structure. This makes categories easier to use +*) + +definition true_f \def \lambda (X:Type). \lambda (_:X). True. + +definition false_f \def \lambda (X:Type). \lambda (_:X). False. + +record Class: Type \def { + class:> Type; + cin: class \to Prop; + ceq: class \to class \to Prop; + cin_repl: \forall c1,c2. cin c1 \to ceq c1 c2 \to cin c2; + ceq_repl: \forall c1,c2,d1,d2. cin c1 \to + ceq c1 c2 \to ceq c1 d1 \to ceq c2 d2 \to ceq d1 d2; + ceq_refl: \forall c. cin c \to ceq c c +}. + +(* external universal quantification *) +inductive call (C:Class) (P:C \to Prop) : Prop \def + | call_intro: (\forall c. cin ? c \to P c) \to call C P. + +inductive call2 (C1,C2:Class) (P:C1 \to C2 \to Prop) : Prop \def + | call2_intro: + (\forall c1,c2. cin ? c1 \to cin ? c2 \to P c1 c2) \to call2 C1 C2 P. + +(* notations **************************************************************) + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "external for all" 'xforall \eta.x = + (cic:/matita/PREDICATIVE-TOPOLOGY/class_defs/call.ind#xpointer(1/1) _ x). + +notation > "hvbox(\xforall ident i opt (: ty) break . p)" + right associative with precedence 20 +for @{ 'xforall ${default + @{\lambda ${ident i} : $ty. $p} + @{\lambda ${ident i} . $p}}}. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "external for all 2" 'xforall2 \eta.x \eta.y = + (cic:/matita/PREDICATIVE-TOPOLOGY/class_defs/call2.ind#xpointer(1/1) _ _ x y). + +notation > "hvbox(\xforall ident i1 opt (: ty1) ident i2 opt (: ty2) break . p)" + right associative with precedence 20 +for @{ 'xforall2 ${default + @{\lambda ${ident i1} : $ty1. \lambda ${ident i2} : $ty2. $p} + @{\lambda ${ident i1}, ${ident i2}. $p}}}. diff --git a/matita/contribs/PREDICATIVE-TOPOLOGY/class_eq.ma b/matita/contribs/PREDICATIVE-TOPOLOGY/class_eq.ma new file mode 100644 index 000000000..b86e5f296 --- /dev/null +++ b/matita/contribs/PREDICATIVE-TOPOLOGY/class_eq.ma @@ -0,0 +1,32 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* STATO: NON COMPILA: dev'essere aggiornato *) + +set "baseuri" "cic:/matita/PREDICATIVE-TOPOLOGY/class_eq". + +include "class_defs.ma". + +theorem ceq_trans: \forall C. \xforall c1,c2. ceq C c1 c2 \to + \xforall c3. ceq ? c2 c3 \to ceq ? c1 c3. +intros. + +(* +apply ceq_intro; apply cle_trans; [|auto new timeout=100|auto new timeout=100||auto new timeout=100|auto new timeout=100]. +qed. + +theorem ceq_sym: \forall C,c1,c2. ceq C c1 c2 \to ceq C c2 c1. +intros; elim H; clear H.; auto new timeout=100. +qed. +*) diff --git a/matita/contribs/PREDICATIVE-TOPOLOGY/coa_defs.ma b/matita/contribs/PREDICATIVE-TOPOLOGY/coa_defs.ma new file mode 100644 index 000000000..1d6c763ab --- /dev/null +++ b/matita/contribs/PREDICATIVE-TOPOLOGY/coa_defs.ma @@ -0,0 +1,63 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* STATO: NON COMPILA: attendo che l'oggetto "pippo" venga accettato *) + +set "baseuri" "cic:/matita/PREDICATIVE-TOPOLOGY/coa_defs". + +include "iff.ma". +include "domain_data.ma". + +(* COMPLETE OVERLAP ALGEBRAS +*) + +record COA: Type \def { + coa:> Class; (* carrier *) + le: coa \to coa \to Prop; (* inclusion *) + ov: coa \to coa \to Prop; (* overlap *) + sup: \forall (D:Domain). (D \to coa) \to coa; (* supremum *) + inf: \forall (D:Domain). (D \to coa) \to coa; (* infimum *) + le_refl: \forall p. le p p; + le_trans: \forall p,r. le p r \to \forall q. le r q \to le p q; + le_antysym: \forall q,p. le q p \to le p q \to ceq ? p q; + ov_sym: \forall q,p. ov q p \to ov p q; + sup_le: \forall D,ps,q. le (sup D ps) q \liff \iforall d. le (ps d) q; + inf_le: \forall D,p,qs. le p (inf D qs) \liff \iforall d. le p (qs d); + sup_ov: \forall D,ps,q. ov (sup D ps) q \liff \iexists d. ov (ps d) q; + density: \forall p,q. (\forall r. ov p r \to ov q r) \to le p q +}. + +definition zero: \forall (P:COA). P \def + \lambda (P:COA). inf P ? (dvoid_ixfam P). + +definition one: \forall (P:COA). P \def + \lambda (P:COA). sup P ? (dvoid_ixfam P). + +definition binf: \forall (P:COA). P \to P \to P \def + \lambda (P:COA). \lambda p0,p1. + inf P ? (dbool_ixfam P p0 p1). + +definition bsup: \forall (P:COA). P \to P \to P \def + \lambda (P:COA). \lambda p0,p1. + sup P ? (dbool_ixfam P p0 p1). + +(* + inf_ov: forall p q, ov p q -> ov p (inf QDBool (bool_family _ p q)) + properness: ov zero zero -> False; + distributivity: forall I p q, id _ (inf QDBool (bool_family _ (sup I p) q)) (sup I (fun i => (inf QDBool (bool_family _ (p i) q)))); +*) + +inductive pippo : Prop \def + | Pippo: let x \def zero in zero = x \to pippo. + diff --git a/matita/contribs/PREDICATIVE-TOPOLOGY/coa_props.ma b/matita/contribs/PREDICATIVE-TOPOLOGY/coa_props.ma new file mode 100644 index 000000000..da2c1f678 --- /dev/null +++ b/matita/contribs/PREDICATIVE-TOPOLOGY/coa_props.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* STATO: NON COMPILA: perche' dipende da coa_defs *) + +set "baseuri" "cic:/matita/PREDICATIVE-TOPOLOGY/coa_props". + +include "coa_defs.ma". + +inductive True:Prop \def T:True. + +theorem zero_le: + \forall (P:COA). \forall (p:P). (le ? (zero P) p) \to True. + intros. + exact T. +qed. + + + + diff --git a/matita/contribs/PREDICATIVE-TOPOLOGY/domain_data.ma b/matita/contribs/PREDICATIVE-TOPOLOGY/domain_data.ma new file mode 100644 index 000000000..5bc9c2a7d --- /dev/null +++ b/matita/contribs/PREDICATIVE-TOPOLOGY/domain_data.ma @@ -0,0 +1,42 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* STATO: NON COMPILA: dev'essere aggiornato *) + +set "baseuri" "cic:/matita/PREDICATIVE-TOPOLOGY/domain_data". + +include "datatypes/constructors.ma". +include "datatypes/bool.ma". +include "domain_defs.ma". + +(* QUANTIFICATION DOMAINS + - Here we define some useful domains based on data types +*) + +definition DBool : Domain \def + mk_Domain (mk_Class bool (true_f ?) (eq ?)). + +definition dbool_ixfam : \forall (C:Class). C \to C \to (DBool \to C) \def + \lambda C,c0,c1,b. + match b in bool with + [ false \Rightarrow c0 + | true \Rightarrow c1 + ]. + +definition DVoid : Domain \def + mk_Domain (mk_Class void (true_f ?) (eq ?)). + +definition dvoid_ixfam : \forall (C:Class). (DVoid \to C) \def + \lambda C,v. + match v in void with []. diff --git a/matita/contribs/PREDICATIVE-TOPOLOGY/domain_defs.ma b/matita/contribs/PREDICATIVE-TOPOLOGY/domain_defs.ma new file mode 100644 index 000000000..dcdf84644 --- /dev/null +++ b/matita/contribs/PREDICATIVE-TOPOLOGY/domain_defs.ma @@ -0,0 +1,60 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* STATO: COMPILA *) + +set "baseuri" "cic:/matita/PREDICATIVE-TOPOLOGY/domain_defs". + +include "class_defs.ma". + +(* QUANTIFICATION DOMAINS + - These are the categories on which we allow quantification + - We set up single quantifiers, parametric on the domain, so they + already have the properties that usually are axiomatized inside the + domain structure. This makes domains easier to use +*) + +record Domain: Type \def { + qd:> Class +}. + +(* internal universal quantification *) +inductive dall (D:Domain) (P:D \to Prop) : Prop \def + | dall_intro: (\forall d:D. cin D d \to P d) \to dall D P. + +(* internal existential quantification *) +inductive dex (D:Domain) (P:D \to Prop) : Prop \def + | dex_intro: \forall d:D. cin D d \land P d \to dex D P. + +(* notations **************************************************************) + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "internal for all" 'iforall \eta.x = + (cic:/matita/PREDICATIVE-TOPOLOGY/domain_defs/dall.ind#xpointer(1/1) _ x). + +notation > "hvbox(\iforall ident i opt (: ty) break . p)" + right associative with precedence 20 +for @{ 'iforall ${default + @{\lambda ${ident i} : $ty. $p)} + @{\lambda ${ident i} . $p}}}. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "internal exists" 'dexists \eta.x = + (cic:/matita/PREDICATIVE-TOPOLOGY/domain_defs/dex.ind#xpointer(1/1) _ x). + +notation > "hvbox(\iexists ident i opt (: ty) break . p)" + right associative with precedence 20 +for @{ 'dexists ${default + @{\lambda ${ident i} : $ty. $p)} + @{\lambda ${ident i} . $p}}}. diff --git a/matita/contribs/PREDICATIVE-TOPOLOGY/iff.ma b/matita/contribs/PREDICATIVE-TOPOLOGY/iff.ma new file mode 100644 index 000000000..0e6205148 --- /dev/null +++ b/matita/contribs/PREDICATIVE-TOPOLOGY/iff.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* STATO: COMPILA *) + +set "baseuri" "cic:/matita/logic/iff". + +include "../../library/logic/connectives.ma". + +definition Iff : Prop \to Prop \to Prop \def + \lambda A,B. (A \to B) \land (B \to A). + + (*CSC: the URI must disappear: there is a bug now *) +interpretation "logical iff" 'iff x y = (cic:/matita/logic/iff/Iff.con x y). + +notation > "hvbox(a break \liff b)" + left associative with precedence 25 +for @{ 'iff $a $b }. + +notation < "hvbox(a break \leftrightarrow b)" + left associative with precedence 25 +for @{ 'iff $a $b }. diff --git a/matita/contribs/PREDICATIVE-TOPOLOGY/makefile b/matita/contribs/PREDICATIVE-TOPOLOGY/makefile new file mode 100644 index 000000000..711fba21c --- /dev/null +++ b/matita/contribs/PREDICATIVE-TOPOLOGY/makefile @@ -0,0 +1,33 @@ +H=@ + +RT_BASEDIR=../../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +all: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + diff --git a/matita/contribs/PREDICATIVE-TOPOLOGY/subset_defs.ma b/matita/contribs/PREDICATIVE-TOPOLOGY/subset_defs.ma new file mode 100644 index 000000000..7469f08af --- /dev/null +++ b/matita/contribs/PREDICATIVE-TOPOLOGY/subset_defs.ma @@ -0,0 +1,68 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* STATO: NON COMPILA: dev'essere aggiornato *) + +set "baseuri" "cic:/matita/PREDICATIVE-TOPOLOGY/subset_defs". + +include "domain_defs.ma". + +(* SUBSETS + - We use predicative subsets coded as propositional functions + according to G.Sambin and S.Valentini "Toolbox" +*) + +definition Subset \def \lambda (D:Domain). D \to Prop. + +(* subset membership (epsilon) *) +definition sin : \forall D. Subset D \to D \to Prop \def + \lambda (D:Domain). \lambda U,d. cin D d \and U d. + +(* subset top (full subset) *) +definition stop \def \lambda (D:Domain). true_f D. + +(* subset bottom (empty subset) *) +definition sbot \def \lambda (D:Domain). false_f D. + +(* subset and (binary intersection) *) +definition sand: \forall D. Subset D \to Subset D \to Subset D \def + \lambda D,U1,U2,d. U1 d \land U2 d. + +(* subset or (binary union) *) +definition sor: \forall D. Subset D \to Subset D \to Subset D \def + \lambda D,U1,U2,d. U1 d \lor U2 d. + +(* subset less or equal (inclusion) *) +definition sle: \forall D. Subset D \to Subset D \to Prop \def + \lambda D,U1,U2. \iforall d. U1 d \to U2 d. + +(* subset overlap *) +definition sover: \forall D. Subset D \to Subset D \to Prop \def + \lambda D,U1,U2. \iexists d. U1 d \land U2 d. + +(* coercions **************************************************************) + +(* +(* the class of the subsets of a domain (not an implicit coercion) *) +definition class_of_subsets_of \def + \lambda D. mk_Class (Subset D) (true_f ?) (sle ?). +*) + +(* the domain built upon a subset (not an implicit coercion) *) +definition domain_of_subset: \forall D. Subset D \to Domain \def + \lambda (D:Domain). \lambda U. + mk_Domain (mk_Class D (sin D U) (cle1 D)). + +(* the full subset of a domain *) +coercion stop. diff --git a/matita/contribs/RELATIONAL/NLE/defs.ma b/matita/contribs/RELATIONAL/NLE/defs.ma new file mode 100644 index 000000000..18fc87b10 --- /dev/null +++ b/matita/contribs/RELATIONAL/NLE/defs.ma @@ -0,0 +1,40 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NLE/defs". + +include "NPlus/defs.ma". + +inductive NLE: Nat \to Nat \to Prop \def + | nle_zero_1: \forall q. NLE zero q + | nle_succ_succ: \forall p,q. NLE p q \to NLE (succ p) (succ q) +. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural 'greater or equal to'" 'geq y x= + (cic:/matita/RELATIONAL/NLE/defs/NLE.ind#xpointer(1/1) x y). + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural 'greater than'" 'gt y x = + (cic:/matita/RELATIONAL/NLE/defs/NLE.ind#xpointer(1/1) + (cic:/matita/RELATIONAL/datatypes/Nat/Nat.ind#xpointer(1/1/2) x) y). + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural 'less or equal to'" 'leq x y = + (cic:/matita/RELATIONAL/NLE/defs/NLE.ind#xpointer(1/1) x y). + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural 'less than'" 'lt x y = + (cic:/matita/RELATIONAL/NLE/defs/NLE.ind#xpointer(1/1) + (cic:/matita/RELATIONAL/datatypes/Nat/Nat.ind#xpointer(1/1/2) x) y). diff --git a/matita/contribs/RELATIONAL/NLE/inv.ma b/matita/contribs/RELATIONAL/NLE/inv.ma new file mode 100644 index 000000000..013cd67f1 --- /dev/null +++ b/matita/contribs/RELATIONAL/NLE/inv.ma @@ -0,0 +1,40 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NLE/inv". + +include "NLE/defs.ma". + +theorem nle_inv_succ_1: \forall x,y. x < y \to + \exists z. y = succ z \land x <= z. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem nle_inv_succ_succ: \forall x,y. x < succ y \to x <= y. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem nle_inv_succ_zero: \forall x. x < zero \to False. + intros. inversion H; clear H; intros; destruct. +qed. + +theorem nle_inv_zero_2: \forall x. x <= zero \to x = zero. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem nle_inv_succ_2: \forall y,x. x <= succ y \to + x = zero \lor \exists z. x = succ z \land z <= y. + intros. inversion H; clear H; intros; destruct; + autobatch depth = 4. +qed. diff --git a/matita/contribs/RELATIONAL/NLE/nplus.ma b/matita/contribs/RELATIONAL/NLE/nplus.ma new file mode 100644 index 000000000..d90adb926 --- /dev/null +++ b/matita/contribs/RELATIONAL/NLE/nplus.ma @@ -0,0 +1,29 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NLE/nplus". + +include "NLE/defs.ma". + +theorem nle_nplus: \forall p, q, r. (p + q == r) \to q <= r. + intros. elim H; clear H q r; autobatch. +qed. + +axiom nle_nplus_comp: \forall x1, x2, x3. (x1 + x2 == x3) \to + \forall y1, y2, y3. (y1 + y2 == y3) \to + x1 <= y1 \to x2 <= y2 \to x3 <= y3. + +axiom nle_nplus_comp_lt_2: \forall x1, x2, x3. (x1 + x2 == x3) \to + \forall y1, y2, y3. (y1 + y2 == y3) \to + x1 <= y1 \to x2 < y2 \to x3 < y3. diff --git a/matita/contribs/RELATIONAL/NLE/order.ma b/matita/contribs/RELATIONAL/NLE/order.ma new file mode 100644 index 000000000..cc3cc3030 --- /dev/null +++ b/matita/contribs/RELATIONAL/NLE/order.ma @@ -0,0 +1,53 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NLE/order". + +include "NLE/inv.ma". + +theorem nle_refl: \forall x. x <= x. + intros; elim x; clear x; autobatch. +qed. + +theorem nle_trans: \forall x,y. x <= y \to + \forall z. y <= z \to x <= z. + intros 3. elim H; clear H x y; + [ autobatch + | lapply linear nle_inv_succ_1 to H3. decompose. destruct. + autobatch + ]. +qed. + +theorem nle_false: \forall x,y. x <= y \to y < x \to False. + intros 3; elim H; clear H x y; autobatch. +qed. + +theorem nle_irrefl: \forall x. x < x \to False. + intros. autobatch. +qed. + +theorem nle_irrefl_ei: \forall x, z. z <= x \to z = succ x \to False. + intros 3. elim H; clear H x z; destruct. autobatch. +qed. + +theorem nle_irrefl_smart: \forall x. x < x \to False. + intros 1. elim x; clear x; autobatch. +qed. + +theorem nle_lt_or_eq: \forall y, x. x <= y \to x < y \lor x = y. + intros. elim H; clear H x y; + [ elim n; clear n + | decompose + ]; autobatch. +qed. diff --git a/matita/contribs/RELATIONAL/NLE/props.ma b/matita/contribs/RELATIONAL/NLE/props.ma new file mode 100644 index 000000000..576a079ae --- /dev/null +++ b/matita/contribs/RELATIONAL/NLE/props.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NLE/props". + +include "NLE/order.ma". + +theorem nle_trans_succ: \forall x,y. x <= y \to x <= succ y. + intros. elim H; clear H x y; autobatch. +qed. + +theorem nle_gt_or_le: \forall x, y. y > x \lor y <= x. + intros 2; elim y; clear y; + [ autobatch + | decompose; + [ lapply linear nle_inv_succ_1 to H1 + | lapply linear nle_lt_or_eq to H1 + ]; decompose; destruct; autobatch depth = 4 + ]. +qed. diff --git a/matita/contribs/RELATIONAL/NPlus/defs.ma b/matita/contribs/RELATIONAL/NPlus/defs.ma new file mode 100644 index 000000000..8d8b304c3 --- /dev/null +++ b/matita/contribs/RELATIONAL/NPlus/defs.ma @@ -0,0 +1,29 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NPlus/defs". + +include "datatypes/Nat.ma". + +inductive NPlus (p:Nat): Nat \to Nat \to Prop \def + | nplus_zero_2: NPlus p zero p + | nplus_succ_2: \forall q, r. NPlus p q r \to NPlus p (succ q) (succ r). + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural plus predicate" 'rel_plus x y z = + (cic:/matita/RELATIONAL/NPlus/defs/NPlus.ind#xpointer(1/1) x y z). + +notation "hvbox(a break + b break == c)" + non associative with precedence 95 +for @{ 'rel_plus $a $b $c}. diff --git a/matita/contribs/RELATIONAL/NPlus/fun.ma b/matita/contribs/RELATIONAL/NPlus/fun.ma new file mode 100644 index 000000000..03dd7d0ef --- /dev/null +++ b/matita/contribs/RELATIONAL/NPlus/fun.ma @@ -0,0 +1,40 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NPlus/fun". + +include "NPlus/inv.ma". + +(* Functional properties ****************************************************) + +theorem nplus_total: \forall p,q. \exists r. p + q == r. + intros 2. elim q; clear q; + [ autobatch | decompose. autobatch ]. +qed. + +theorem nplus_mono: \forall p,q,r1. (p + q == r1) \to + \forall r2. (p + q == r2) \to r1 = r2. + intros 4. elim H; clear H q r1; + [ lapply linear nplus_inv_zero_2 to H1 + | lapply linear nplus_inv_succ_2 to H3. decompose + ]; destruct; autobatch. +qed. + +theorem nplus_inj_1: \forall p1, q, r. (p1 + q == r) \to + \forall p2. (p2 + q == r) \to p2 = p1. + intros 4. elim H; clear H q r; + [ lapply linear nplus_inv_zero_2 to H1 + | lapply linear nplus_inv_succ_2_3 to H3 + ]; autobatch. +qed. diff --git a/matita/contribs/RELATIONAL/NPlus/inv.ma b/matita/contribs/RELATIONAL/NPlus/inv.ma new file mode 100644 index 000000000..b6ac60873 --- /dev/null +++ b/matita/contribs/RELATIONAL/NPlus/inv.ma @@ -0,0 +1,81 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NPlus/inv". + +include "NPlus/defs.ma". + +(* Inversion lemmas *********************************************************) + +theorem nplus_inv_zero_1: \forall q,r. (zero + q == r) \to q = r. + intros. elim H; clear H q r; autobatch. +qed. + +theorem nplus_inv_succ_1: \forall p,q,r. ((succ p) + q == r) \to + \exists s. r = (succ s) \land p + q == s. + intros. elim H; clear H q r; intros; + [ autobatch depth = 4 + | clear H1. decompose. destruct. autobatch depth = 4 + ] +qed. + +theorem nplus_inv_zero_2: \forall p,r. (p + zero == r) \to p = r. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem nplus_inv_succ_2: \forall p,q,r. (p + (succ q) == r) \to + \exists s. r = (succ s) \land p + q == s. + intros. inversion H; clear H; intros; destruct. + autobatch depth = 4. +qed. + +theorem nplus_inv_zero_3: \forall p,q. (p + q == zero) \to + p = zero \land q = zero. + intros. inversion H; clear H; intros; destruct. autobatch. +qed. + +theorem nplus_inv_succ_3: \forall p,q,r. (p + q == (succ r)) \to + \exists s. p = succ s \land (s + q == r) \lor + q = succ s \land p + s == r. + intros. inversion H; clear H; intros; destruct; + autobatch depth = 4. +qed. + +(* Corollaries to inversion lemmas ******************************************) + +theorem nplus_inv_succ_2_3: \forall p,q,r. + (p + (succ q) == (succ r)) \to p + q == r. + intros. + lapply linear nplus_inv_succ_2 to H. decompose. destruct. autobatch. +qed. + +theorem nplus_inv_succ_1_3: \forall p,q,r. + ((succ p) + q == (succ r)) \to p + q == r. + intros. + lapply linear nplus_inv_succ_1 to H. decompose. destruct. autobatch. +qed. + +theorem nplus_inv_eq_2_3: \forall p,q. (p + q == q) \to p = zero. + intros 2. elim q; clear q; + [ lapply linear nplus_inv_zero_2 to H + | lapply linear nplus_inv_succ_2_3 to H1 + ]; autobatch. +qed. + +theorem nplus_inv_eq_1_3: \forall p,q. (p + q == p) \to q = zero. + intros 1. elim p; clear p; + [ lapply linear nplus_inv_zero_1 to H + | lapply linear nplus_inv_succ_1_3 to H1. + ]; autobatch. +qed. diff --git a/matita/contribs/RELATIONAL/NPlus/monoid.ma b/matita/contribs/RELATIONAL/NPlus/monoid.ma new file mode 100644 index 000000000..a521c9a1d --- /dev/null +++ b/matita/contribs/RELATIONAL/NPlus/monoid.ma @@ -0,0 +1,131 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NPlus/monoid". + +include "NPlus/fun.ma". + +(* Monoidal properties ******************************************************) + +theorem nplus_zero_1: \forall q. zero + q == q. + intros. elim q; clear q; autobatch. +qed. + +theorem nplus_succ_1: \forall p,q,r. (p + q == r) \to + (succ p) + q == (succ r). + intros. elim H; clear H q r; autobatch. +qed. + +theorem nplus_comm: \forall p, q, x. (p + q == x) \to + \forall y. (q + p == y) \to x = y. + intros 4; elim H; clear H q x; + [ lapply linear nplus_inv_zero_1 to H1 + | lapply linear nplus_inv_succ_1 to H3. decompose + ]; destruct; autobatch. +qed. + +theorem nplus_comm_rew: \forall p,q,r. (p + q == r) \to q + p == r. + intros. elim H; clear H q r; autobatch. +qed. + +theorem nplus_ass: \forall p1, p2, r1. (p1 + p2 == r1) \to + \forall p3, s1. (r1 + p3 == s1) \to + \forall r3. (p2 + p3 == r3) \to + \forall s3. (p1 + r3 == s3) \to s1 = s3. + intros 4. elim H; clear H p2 r1; + [ lapply linear nplus_inv_zero_1 to H2. destruct. + lapply nplus_mono to H1, H3. destruct. autobatch + | lapply linear nplus_inv_succ_1 to H3. decompose. destruct. + lapply linear nplus_inv_succ_1 to H4. decompose. destruct. + lapply linear nplus_inv_succ_2 to H5. decompose. destruct. autobatch + ]. +qed. + +(* Corollaries of functional properties **************************************) + +theorem nplus_inj_2: \forall p, q1, r. (p + q1 == r) \to + \forall q2. (p + q2 == r) \to q1 = q2. + intros. autobatch. +qed. + +(* Corollaries of nonoidal properties ***************************************) + +theorem nplus_comm_1: \forall p1, q, r1. (p1 + q == r1) \to + \forall p2, r2. (p2 + q == r2) \to + \forall x. (p2 + r1 == x) \to + \forall y. (p1 + r2 == y) \to + x = y. + intros 4. elim H; clear H q r1; + [ lapply linear nplus_inv_zero_2 to H1 + | lapply linear nplus_inv_succ_2 to H3. + lapply linear nplus_inv_succ_2 to H4. decompose. destruct. + lapply linear nplus_inv_succ_2 to H5. decompose + ]; destruct; autobatch. +qed. + +theorem nplus_comm_1_rew: \forall p1,q,r1. (p1 + q == r1) \to + \forall p2,r2. (p2 + q == r2) \to + \forall s. (p1 + r2 == s) \to (p2 + r1 == s). + intros 4. elim H; clear H q r1; + [ lapply linear nplus_inv_zero_2 to H1. destruct + | lapply linear nplus_inv_succ_2 to H3. decompose. destruct. + lapply linear nplus_inv_succ_2 to H4. decompose. destruct + ]; autobatch. +qed. + +(* +theorem nplus_shift_succ_sx: \forall p,q,r. + (p + (succ q) == r) \to (succ p) + q == r. + intros. + lapply linear nplus_inv_succ_2 to H as H0. + decompose. destruct. auto new timeout=100. +qed. + +theorem nplus_shift_succ_dx: \forall p,q,r. + ((succ p) + q == r) \to p + (succ q) == r. + intros. + lapply linear nplus_inv_succ_1 to H as H0. + decompose. destruct. auto new timeout=100. +qed. + +theorem nplus_trans_1: \forall p,q1,r1. (p + q1 == r1) \to + \forall q2,r2. (r1 + q2 == r2) \to + \exists q. (q1 + q2 == q) \land p + q == r2. + intros 2; elim q1; clear q1; intros; + [ lapply linear nplus_inv_zero_2 to H as H0. + destruct. + | lapply linear nplus_inv_succ_2 to H1 as H0. + decompose. destruct. + lapply linear nplus_inv_succ_1 to H2 as H0. + decompose. destruct. + lapply linear H to H4, H3 as H0. + decompose. + ]; apply ex_intro; [| auto new timeout=100 || auto new timeout=100 ]. (**) +qed. + +theorem nplus_trans_2: \forall p1,q,r1. (p1 + q == r1) \to + \forall p2,r2. (p2 + r1 == r2) \to + \exists p. (p1 + p2 == p) \land p + q == r2. + intros 2; elim q; clear q; intros; + [ lapply linear nplus_inv_zero_2 to H as H0. + destruct + | lapply linear nplus_inv_succ_2 to H1 as H0. + decompose. destruct. + lapply linear nplus_inv_succ_2 to H2 as H0. + decompose. destruct. + lapply linear H to H4, H3 as H0. + decompose. + ]; apply ex_intro; [| auto new timeout=100 || auto new timeout=100 ]. (**) +qed. +*) diff --git a/matita/contribs/RELATIONAL/NPlusList/defs.ma b/matita/contribs/RELATIONAL/NPlusList/defs.ma new file mode 100644 index 000000000..86d023165 --- /dev/null +++ b/matita/contribs/RELATIONAL/NPlusList/defs.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NPlusList/defs". + +include "datatypes/List.ma". +include "NPlus/defs.ma". + + +inductive NPlusList: (List Nat) \to Nat \to Prop \def + | nplus_nil: NPlusList (nil ?) zero + | nplus_cons: \forall l,p,q,r. + NPlusList l p \to NPlus p q r \to NPlusList (cons ? l q) r +. + +definition NPlusListEq: (List Nat) \to (List Nat) \to Prop \def + \lambda ns1,ns2. \exists n. NPlusList ns1 n \land NPlusList ns2 n. + +(* +(*CSC: the URI must disappear: there is a bug now *) +interpretation "ternary natural plus predicate" 'rel_plus3 x y z = + (cic:/matita/RELATIONAL/NPlus/defs/NPlus3.con w x y z). + +notation "hvbox(a break + b break + c == d)" + non associative with precedence 95 +for @{ 'rel_plus3 $a $b $c $d}. +*) diff --git a/matita/contribs/RELATIONAL/NPlusList/props.ma b/matita/contribs/RELATIONAL/NPlusList/props.ma new file mode 100644 index 000000000..f7fc4305e --- /dev/null +++ b/matita/contribs/RELATIONAL/NPlusList/props.ma @@ -0,0 +1,34 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/NPlusList/props". + +include "NPlusList/defs.ma". +(* +axiom npluslist_gen_cons: \forall l,q,r. + NPlusList (cons ? l q) r \to + \exists p. NPlusList l p \land NPlus p q r. +(* + intros. inversion H; clear H; intros; + [ id + | destruct. +*) + +theorem npluslist_inj_2: \forall ns1,ns2,n. + NPlusListEq (cons ? ns1 n) (cons ? ns2 n) \to + NPlusListEq ns1 ns2. + unfold NPlusListEq. intros. decompose. + lapply linear npluslist_gen_cons to H. decompose. + lapply linear npluslist_gen_cons to H2. decompose. +*) \ No newline at end of file diff --git a/matita/contribs/RELATIONAL/ZEq/defs.ma b/matita/contribs/RELATIONAL/ZEq/defs.ma new file mode 100644 index 000000000..6d270cab3 --- /dev/null +++ b/matita/contribs/RELATIONAL/ZEq/defs.ma @@ -0,0 +1,28 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/ZEq/defs". + +include "datatypes/Zah.ma". +include "NPlus/defs.ma". + +inductive ZEq: Zah \to Zah \to Prop := + | zeq: \forall m1,m2,m3,m4,n. + (m1 + m4 == n) \to (m3 + m2 == n) \to + ZEq \langle m1, m2 \rangle \langle m3, m4 \rangle +. + +interpretation "integer equality" 'eq x y = + (cic:/matita/RELATIONAL/ZEq/defs/ZEq.ind#xpointer(1/1) x y). + diff --git a/matita/contribs/RELATIONAL/ZEq/setoid.ma b/matita/contribs/RELATIONAL/ZEq/setoid.ma new file mode 100644 index 000000000..37ca8f619 --- /dev/null +++ b/matita/contribs/RELATIONAL/ZEq/setoid.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/ZEq/setoid". + +include "NPlus/fun.ma". +include "ZEq/defs.ma". + +theorem zeq_refl: \forall z. z = z. + intros. elim z. clear z. + lapply (nplus_total t t1). decompose. + autobatch. +qed. + +theorem zeq_sym: \forall z1,z2. z1 = z2 \to z2 = z1. + intros. elim H. clear H z1 z2. autobatch. +qed. +(* +theorem zeq_trans: \forall z1,z2. z1 = z2 \to + \forall z3. z2 = z3 \to z1 = z3. + intros 3. elim H. clear H z1 z2. + inversion H3. clear H3. intros. destruct. + lapply (nplus_total n5 n6). decompose. + lapply (nplus_total n4 n9). decompose. + apply zeq. +*) diff --git a/matita/contribs/RELATIONAL/datatypes/Bool.ma b/matita/contribs/RELATIONAL/datatypes/Bool.ma new file mode 100644 index 000000000..58345281b --- /dev/null +++ b/matita/contribs/RELATIONAL/datatypes/Bool.ma @@ -0,0 +1,22 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/datatypes/Bool". + +include "preamble.ma". + +inductive Bool: Type \def + | false: Bool + | true : Bool +. diff --git a/matita/contribs/RELATIONAL/datatypes/List.ma b/matita/contribs/RELATIONAL/datatypes/List.ma new file mode 100644 index 000000000..313362e5d --- /dev/null +++ b/matita/contribs/RELATIONAL/datatypes/List.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/datatypes/List". + +include "preamble.ma". + +inductive List (A: Type): Type \def + | nil: List A + | cons: List A \to A \to List A +. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "nil" 'nil = + (cic:/matita/RELATIONAL/datatypes/List/List.ind#xpointer(1/1) _). + +notation "hvbox([])" + non associative with precedence 95 +for @{ 'nil }. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "right cons" 'rcons x y = + (cic:/matita/RELATIONAL/datatypes/List/List.ind#xpointer(1/2) _ x y). + +notation "hvbox([a break @ b])" + non associative with precedence 95 +for @{ 'rcons $a $b}. + diff --git a/matita/contribs/RELATIONAL/datatypes/Nat.ma b/matita/contribs/RELATIONAL/datatypes/Nat.ma new file mode 100644 index 000000000..75a3c58d3 --- /dev/null +++ b/matita/contribs/RELATIONAL/datatypes/Nat.ma @@ -0,0 +1,22 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/datatypes/Nat". + +include "preamble.ma". + +inductive Nat: Type \def + | zero: Nat + | succ: Nat \to Nat +. diff --git a/matita/contribs/RELATIONAL/datatypes/Zah.ma b/matita/contribs/RELATIONAL/datatypes/Zah.ma new file mode 100644 index 000000000..87f61d7d1 --- /dev/null +++ b/matita/contribs/RELATIONAL/datatypes/Zah.ma @@ -0,0 +1,19 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/datatypes/Zah". + +include "datatypes/Nat.ma". + +definition Zah \def Nat \times Nat. diff --git a/matita/contribs/RELATIONAL/makefile b/matita/contribs/RELATIONAL/makefile new file mode 100644 index 000000000..e5ac91fc8 --- /dev/null +++ b/matita/contribs/RELATIONAL/makefile @@ -0,0 +1,39 @@ +H=@ + +RT_BASEDIR=../../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/contribs/RELATIONAL/preamble.ma b/matita/contribs/RELATIONAL/preamble.ma new file mode 100644 index 000000000..d52da9701 --- /dev/null +++ b/matita/contribs/RELATIONAL/preamble.ma @@ -0,0 +1,19 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/RELATIONAL/preamble". + +include "logic/equality.ma". +include "logic/connectives.ma". +include "datatypes/constructors.ma". diff --git a/matita/contribs/developments.txt b/matita/contribs/developments.txt new file mode 100644 index 000000000..f7e03520b --- /dev/null +++ b/matita/contribs/developments.txt @@ -0,0 +1,14 @@ +Root directories of current matita developments + +software/matita/legacy +software/matita/library +software/matita/library_auto +software/matita/tests +software/matita/dama +software/matita/contribs/PREDICATIVE-TOPOLOGY +software/matita/contribs/RELATIONAL +software/matita/contribs/LOGIC +software/matita/contribs/LAMBDA-TYPES/Unified-Sub +software/matita/contribs/LAMBDA-TYPES/Base-1 +software/matita/contribs/LAMBDA-TYPES/LambdaDelta-1 +software/matita/contribs/LAMBDA-TYPES/Base-2 diff --git a/matita/contribs/formal_topology/bin/Makefile b/matita/contribs/formal_topology/bin/Makefile new file mode 100644 index 000000000..3bfd0c9ee --- /dev/null +++ b/matita/contribs/formal_topology/bin/Makefile @@ -0,0 +1,2 @@ +theory_explorer: theory_explorer.ml + ocamlopt -rectypes -o theory_explorer unix.cmxa theory_explorer.ml diff --git a/matita/contribs/formal_topology/bin/formal_topology.ma b/matita/contribs/formal_topology/bin/formal_topology.ma new file mode 100644 index 000000000..1c1d94ad6 --- /dev/null +++ b/matita/contribs/formal_topology/bin/formal_topology.ma @@ -0,0 +1,61 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/formal_topology/". +include "logic/equality.ma". + +axiom S: Type. + +axiom leq: S → S → Prop. + +notation "hvbox(A break ⊆ B)" with precedence 59 +for @{ 'subseteq $A $B}. + +interpretation "Subseteq" 'subseteq A B = + (cic:/matita/formal_topology/leq.con A B). + +axiom leq_refl: ∀A. A ⊆ A. +axiom leq_antisym: ∀A,B. A ⊆ B → B ⊆ A → A=B. +axiom leq_tran: ∀A,B,C. A ⊆ B → B ⊆ C → A ⊆ C. + +axiom i: S → S. + +axiom i_contrattivita: ∀A. i A ⊆ A. +axiom i_idempotenza: ∀A. i (i A) = i A. +axiom i_monotonia: ∀A,B. A ⊆ B → i A ⊆ i B. + +axiom c: S → S. + +axiom c_espansivita: ∀A. A ⊆ c A. +axiom c_idempotenza: ∀A. c (c A) = c A. +axiom c_monotonia: ∀A,B. A ⊆ B → c A ⊆ c B. + +axiom m: S → S. + +axiom m_antimonotonia: ∀A,B. A ⊆ B → m B ⊆ m A. +axiom m_saturazione: ∀A. A ⊆ m (m A). +axiom m_puntofisso: ∀A. m A = m (m (m A)). + +lemma l1: ∀A,B. i A ⊆ B → i A ⊆ i B. + intros; rewrite < i_idempotenza; apply (i_monotonia (i A) B H). +qed. +lemma l2: ∀A,B. A ⊆ c B → c A ⊆ c B. + intros; rewrite < c_idempotenza in ⊢ (? ? %); apply (c_monotonia A (c B) H). +qed. + +axiom th1: ∀A. c (m A) ⊆ m (i A). +axiom th2: ∀A. i (m A) ⊆ m (c A). + +(************** start of generated part *********************) + diff --git a/matita/contribs/formal_topology/bin/theory_explorer.ml b/matita/contribs/formal_topology/bin/theory_explorer.ml new file mode 100644 index 000000000..39a021c9d --- /dev/null +++ b/matita/contribs/formal_topology/bin/theory_explorer.ml @@ -0,0 +1,568 @@ +(**** PROFILING ****) +let ok_time = ref 0.0;; +let ko_time = ref 0.0;; + +let profile f x = + let before = Unix.gettimeofday () in + let res = f x in + let after = Unix.gettimeofday () in + let delta = after -. before in + if res then + ok_time := !ok_time +. delta + else + ko_time := !ko_time +. delta; + res +;; + +let _ = + Sys.catch_break true; + at_exit + (function () -> + prerr_endline + ("\nTIME SPENT IN CHECKING GOOD CONJECTURES: " ^ string_of_float !ok_time); + prerr_endline + ("TIME SPENT IN CHECKING BAD CONJECTURES: " ^ string_of_float !ko_time);) +;; + +(**** END PROFILING ****) + +type rel = Equal | SubsetEqual | SupersetEqual + +let string_of_rel = + function + Equal -> "=" + | SubsetEqual -> "⊆" + | SupersetEqual -> "⊇" + +(* operator *) +type op = I | C | M + +let string_of_op = function I -> "i" | C -> "c" | M -> "-" +let matita_of_op = function I -> "i" | C -> "c" | M -> "m" + +(* compound operator *) +type compound_operator = op list + +let string_of_cop op = + if op = [] then "id" else String.concat "" (List.map string_of_op op) + +let dot_of_cop op = "\"" ^ string_of_cop op ^ "\"" + +let matita_of_cop v = + let rec aux = + function + | [] -> v + | [op] -> matita_of_op op ^ " " ^ v + | op::tl -> matita_of_op op ^ " (" ^ aux tl ^ ")" + in + aux + +let name_of_theorem cop rel cop' = + let cop,rel,cop' = + match rel with + Equal -> cop,"eq",cop' + | SubsetEqual -> cop,"leq",cop' + | SupersetEqual -> cop',"leq",cop + in + rel ^ "_" ^ + String.concat "" (List.map matita_of_op cop) ^ "_" ^ + String.concat "" (List.map matita_of_op cop') +;; + +(* representative, other elements in the equivalence class, + leq classes, geq classes *) +type equivalence_class = + compound_operator * compound_operator list * + equivalence_class list ref * equivalence_class list ref + +let (===) (repr,_,_,_) (repr',_,_,_) = repr = repr';; +let (<=>) (repr,_,_,_) (repr',_,_,_) = repr <> repr';; + +let string_of_equivalence_class (repr,others,leq,_) = + String.concat " = " (List.map string_of_cop (repr::others)) ^ + (if !leq <> [] then + "\n" ^ + String.concat "\n" + (List.map + (function (repr',_,_,_) -> + string_of_cop repr ^ " ⊆ " ^ string_of_cop repr') !leq) + else + "") + +let dot_of_equivalence_class (repr,others,leq,_) = + (if others <> [] then + let eq = String.concat " = " (List.map string_of_cop (repr::others)) in + dot_of_cop repr ^ "[label=\"" ^ eq ^ "\"];" ^ + if !leq = [] then "" else "\n" + else if !leq = [] then + dot_of_cop repr ^ ";" + else + "") ^ + String.concat "\n" + (List.map + (function (repr',_,_,_) -> + dot_of_cop repr' ^ " -> " ^ dot_of_cop repr ^ ";") !leq) + +(* set of equivalence classes, infima, suprema *) +type set = + equivalence_class list * equivalence_class list * equivalence_class list + +let string_of_set (s,_,_) = + String.concat "\n" (List.map string_of_equivalence_class s) + +let ps_of_set (to_be_considered,under_consideration,news) ?processing (s,inf,sup) = + let ch = open_out "xxx.dot" in + output_string ch "digraph G {\n"; + (match under_consideration with + None -> () + | Some repr -> + output_string ch (dot_of_cop repr ^ " [color=yellow];")); + List.iter + (function (repr,_,_,_) -> + if List.exists (function (repr',_,_,_) -> repr=repr') sup then + output_string ch (dot_of_cop repr ^ " [shape=Mdiamond];") + else + output_string ch (dot_of_cop repr ^ " [shape=diamond];") + ) inf ; + List.iter + (function (repr,_,_,_) -> + if not (List.exists (function (repr',_,_,_) -> repr=repr') inf) then + output_string ch (dot_of_cop repr ^ " [shape=polygon];") + ) sup ; + List.iter + (function repr -> output_string ch (dot_of_cop repr ^ " [color=green];") + ) to_be_considered ; + List.iter + (function repr -> output_string ch (dot_of_cop repr ^ " [color=navy];") + ) news ; + output_string ch (String.concat "\n" (List.map dot_of_equivalence_class s)); + output_string ch "\n"; + (match processing with + None -> () + | Some (repr,rel,repr') -> + output_string ch (dot_of_cop repr ^ " [color=red];"); + let repr,repr' = + match rel with + SupersetEqual -> repr',repr + | Equal + | SubsetEqual -> repr,repr' + in + output_string ch + (dot_of_cop repr' ^ " -> " ^ dot_of_cop repr ^ + " [" ^ + (match rel with Equal -> "arrowhead=none " | _ -> "") ^ + "style=dashed];\n")); + output_string ch "}\n"; + close_out ch; + (*ignore (Unix.system "tred xxx.dot > yyy.dot && dot -Tps yyy.dot > xxx.ps")*) + ignore (Unix.system "cp xxx.ps xxx_old.ps && dot -Tps xxx.dot > xxx.ps"); + (*ignore (read_line ())*) +;; + +(******** communication with matitawiki ************) +let min_ch,mout_ch = Unix.open_process "../../../matitawiki.opt 2> /dev/null";; + +let exec_cmd ?(undo=false) s = + let un = if undo then "un" else "" in +(*prerr_endline ("<" ^ un ^ "doitem>" ^ s ^ "\n");*) + output_string mout_ch ("<" ^ un ^ "doitem>" ^ s ^ "\n"); + flush mout_ch; + let rec aux v = + let l = input_line min_ch in + let last = String.length l - 1 in + assert (last > 0); + if l.[last] = Char.chr 249 then + int_of_string (String.sub l 0 last) + else + aux l + in + aux "x" +;; + +let exec_cmds = + let rec aux undopos = + function + [] -> true + | he::tl -> + let pos = exec_cmd he in + if pos = -1 then + begin + match undopos with + None -> assert false + | Some undopos -> + assert (exec_cmd ~undo:true (string_of_int (undopos - 1)) <> -1); + false + end + else + match undopos with + None -> aux (Some pos) tl + | _ -> aux undopos tl + in + aux None + +let _ = + assert (exec_cmd "set \"baseuri\" \"cic:/matita/theory_former\"." <> -1); + assert (exec_cmd "include \"formal_topology.ma\"." <> -1); +;; + +(********* testing a conjecture *******************) + +let test to_be_considered_and_now ((s,_,_) as set) rel candidate repr = + ps_of_set to_be_considered_and_now ~processing:(candidate,rel,repr) set; + print_string + (string_of_cop candidate ^ " " ^ string_of_rel rel ^ " " ^ string_of_cop repr ^ "? "); + flush stdout; +(* + assert (Unix.system "cat log.ma | sed s/^theorem/axiom/g | sed 's/\\. intros.*qed\\././g' > xxx.ma" = Unix.WEXITED 0); + let ch = open_out_gen [Open_append] 0 "xxx.ma" in +*) +(* + let i = ref 0 in + List.iter + (function (repr,others,leq,_) -> + List.iter + (function repr' -> + incr i; + output_string ch + ("axiom ax" ^ string_of_int !i ^ + ": \\forall A." ^ + matita_of_cop "A" repr ^ " = " ^ matita_of_cop "A" repr' ^ ".\n"); + ) others; + List.iter + (function (repr',_,_,_) -> + incr i; + output_string ch + ("axiom ax" ^ string_of_int !i ^ + ": \\forall A." ^ + matita_of_cop "A" repr ^ " ⊆ " ^ matita_of_cop "A" repr' ^ ".\n"); + ) !leq; + ) s; +*) + let candidate',rel',repr' = + match rel with + SupersetEqual -> repr,SubsetEqual,candidate + | Equal + | SubsetEqual -> candidate,rel,repr in + let query1 = + let name = name_of_theorem candidate' rel' repr' in + ("theorem " ^ name ^ ": \\forall A." ^ matita_of_cop "A" candidate' ^ + " " ^ string_of_rel rel' ^ " " ^ + matita_of_cop "A" repr' ^ ".") in + let query2 = "intros;" in + let query3 = "autobatch size=8 depth=3 width=2." in + let query4 = "qed." in + let query = query1 ^ query2 ^ query3 ^ query4 in +(* + output_string ch (query ^ "\n"); + close_out ch; +*) + let res = profile exec_cmds [query1; query2; query3; query4] in +(* + let res = + (*Unix.system "../../../matitac.opt xxx.ma >> log 2>&1" = Unix.WEXITED 0*) + profile Unix.system "../../../matitac.opt xxx.ma > /dev/null 2>&1" = Unix.WEXITED 0 + in +*) + ignore (Unix.system "echo '(*' >> log.ma && cat xxx.dot >> log.ma && echo '*)' >> log.ma"); + let ch = open_out_gen [Open_append] 0o0600 "log.ma" in + if res then + output_string ch (query ^ "\n") + else + output_string ch ("(* " ^ query ^ "*)\n"); + close_out ch; + print_endline (if res then "y" else "n"); + res + +let remove node = List.filter (fun node' -> node <=> node');; + +let add_leq_arc ((_,_,leq,_) as node) ((_,_,_,geq') as node') = + leq := node' :: !leq; + geq' := node :: !geq' +;; + +let add_geq_arc ((_,_,_,geq) as node) ((_,_,leq',_) as node') = + geq := node' :: !geq; + leq' := node :: !leq' +;; + +let remove_leq_arc ((_,_,leq,_) as node) ((_,_,_,geq') as node') = + leq := remove node' !leq; + geq' := remove node !geq' +;; + +let remove_geq_arc ((_,_,_,geq) as node) ((_,_,leq',_) as node') = + geq := remove node' !geq; + leq' := remove node !leq' +;; + +let leq_transitive_closure node node' = + add_leq_arc node node'; + let rec remove_transitive_arcs ((_,_,_,geq) as node) (_,_,leq',_) = + let rec remove_arcs_to_ascendents = + function + [] -> () + | (_,_,leq,_) as node'::tl -> + remove_leq_arc node node'; + remove_arcs_to_ascendents (!leq@tl) + in + remove_arcs_to_ascendents !leq'; + List.iter (function son -> remove_transitive_arcs son node) !geq + in + remove_transitive_arcs node node' +;; + +let geq_transitive_closure node node' = + add_geq_arc node node'; + let rec remove_transitive_arcs ((_,_,leq,_) as node) (_,_,_,geq') = + let rec remove_arcs_to_descendents = + function + [] -> () + | (_,_,_,geq) as node'::tl -> + remove_geq_arc node node'; + remove_arcs_to_descendents (!geq@tl) + in + remove_arcs_to_descendents !geq'; + List.iter (function father -> remove_transitive_arcs father node) !leq + in + remove_transitive_arcs node node' +;; + +let (@@) l1 n = if List.exists (function n' -> n===n') l1 then l1 else l1@[n] + +let rec leq_reachable node = + function + [] -> false + | node'::_ when node === node' -> true + | (_,_,leq,_)::tl -> leq_reachable node (!leq@tl) +;; + +let rec geq_reachable node = + function + [] -> false + | node'::_ when node === node' -> true + | (_,_,_,geq)::tl -> geq_reachable node (!geq@tl) +;; + +exception SameEquivalenceClass of set * equivalence_class * equivalence_class;; + +let locate_using_leq to_be_considered_and_now ((repr,_,leq,geq) as node) + set start += + let rec aux ((nodes,inf,sup) as set) already_visited = + function + [] -> set + | (repr',_,_,geq') as node' :: tl -> + if List.exists (function n -> n===node') already_visited then + aux set already_visited tl + else if repr=repr' then aux set (node'::already_visited) (!geq'@tl) + else if leq_reachable node' !leq then + aux set (node'::already_visited) (!geq'@tl) + else if (List.exists (function n -> not (geq_reachable n [node'])) !geq) + then + aux set (node'::already_visited) tl + else if test to_be_considered_and_now set SubsetEqual repr repr' then + begin + if List.exists (function n -> n===node') !geq then + (* We have found two equal nodes! *) + raise (SameEquivalenceClass (set,node,node')) + else + begin + let sup = remove node sup in + let inf = + if !geq' = [] then + let inf = remove node' inf in + if !geq = [] then + inf@@node + else + inf + else + inf + in + leq_transitive_closure node node'; + aux (nodes,inf,sup) (node'::already_visited) (!geq'@tl) + end + end + else + aux set (node'::already_visited) tl + in + aux set [] start +;; + +let locate_using_geq to_be_considered_and_now ((repr,_,leq,geq) as node) + set start += + let rec aux ((nodes,inf,sup) as set) already_visited = + function + [] -> set + | (repr',_,leq',_) as node' :: tl -> + if List.exists (function n -> n===node') already_visited then + aux set already_visited tl + else if repr=repr' then aux set (node'::already_visited) (!leq'@tl) + else if geq_reachable node' !geq then + aux set (node'::already_visited) (!leq'@tl) + else if (List.exists (function n -> not (leq_reachable n [node'])) !leq) + then + aux set (node'::already_visited) tl + else if test to_be_considered_and_now set SupersetEqual repr repr' then + begin + if List.exists (function n -> n===node') !leq then + (* We have found two equal nodes! *) + raise (SameEquivalenceClass (set,node,node')) + else + begin + let inf = remove node inf in + let sup = + if !leq' = [] then + let sup = remove node' sup in + if !leq = [] then + sup@@node + else + sup + else + sup + in + geq_transitive_closure node node'; + aux (nodes,inf,sup) (node'::already_visited) (!leq'@tl) + end + end + else + aux set (node'::already_visited) tl + in + aux set [] start +;; + +let analyze_one to_be_considered repr hecandidate (news,((nodes,inf,sup) as set)) = +if not (List.for_all (fun ((_,_,_,geq) as node) -> !geq = [] && let rec check_sups = function [] -> true | (_,_,leq,_) as node::tl -> if !leq = [] then List.exists (fun n -> n===node) sup && check_sups tl else check_sups (!leq@tl) in check_sups [node]) inf) then ((*ps_of_set ([],None,[]) set;*) assert false); +if not (List.for_all (fun ((_,_,leq,_) as node) -> !leq = [] && let rec check_infs = function [] -> true | (_,_,_,geq) as node::tl -> if !geq = [] then List.exists (fun n -> n===node) inf && check_infs tl else check_infs (!geq@tl) in check_infs [node]) sup) then (ps_of_set ([],None,[]) set; assert false); + let candidate = hecandidate::repr in + if List.length (List.filter ((=) M) candidate) > 1 then + news,set + else + try + let leq = ref [] in + let geq = ref [] in + let node = candidate,[],leq,geq in + let nodes = nodes@[node] in + let set = nodes,inf@[node],sup@[node] in + let set,start_inf,start_sup = + let repr_node = + match List.filter (fun (repr',_,_,_) -> repr=repr') nodes with + [node] -> node + | _ -> assert false + in + match hecandidate,repr with + I, I::_ -> raise (SameEquivalenceClass (set,node,repr_node)) + | I, _ -> + add_leq_arc node repr_node; + (nodes,remove repr_node inf@[node],sup),inf,sup + | C, C::_ -> raise (SameEquivalenceClass (set,node,repr_node)) + | C, _ -> + add_geq_arc node repr_node; + (nodes,inf,remove repr_node sup@[node]),inf,sup + | M, M::M::_ -> raise (SameEquivalenceClass (set,node,repr_node)) + | M, _ -> set,inf,sup + in + let set = + locate_using_leq (to_be_considered,Some repr,news) node set start_sup in +( +let _,inf,sup = set in +if not (List.for_all (fun ((_,_,_,geq) as node) -> !geq = [] && let rec check_sups = function [] -> true | (_,_,leq,_) as node::tl -> if !leq = [] then List.exists (fun n -> n===node) sup && check_sups tl else check_sups (!leq@tl) in check_sups [node]) inf) then (ps_of_set ([],None,[]) set; assert false); +if not (List.for_all (fun ((_,_,leq,_) as node) -> !leq = [] && let rec check_infs = function [] -> true | (_,_,_,geq) as node::tl -> if !geq = [] then List.exists (fun n -> n===node) inf && check_infs tl else check_infs (!geq@tl) in check_infs [node]) sup) then (ps_of_set ([],None,[]) set; assert false); +); + let set = + locate_using_geq (to_be_considered,Some repr,news) node set start_inf + in +( +let _,inf,sup = set in +if not (List.for_all (fun ((_,_,_,geq) as node) -> !geq = [] && let rec check_sups = function [] -> true | (_,_,leq,_) as node::tl -> if !leq = [] then List.exists (fun n -> n===node) sup && check_sups tl else check_sups (!leq@tl) in check_sups [node]) inf) then (ps_of_set ([],None,[]) set; assert false); +if not (List.for_all (fun ((_,_,leq,_) as node) -> !leq = [] && let rec check_infs = function [] -> true | (_,_,_,geq) as node::tl -> if !geq = [] then List.exists (fun n -> n===node) inf && check_infs tl else check_infs (!geq@tl) in check_infs [node]) sup) then ((*ps_of_set ([],None,[]) set;*) assert false); +); + news@[candidate],set + with + SameEquivalenceClass ((nodes,inf,sup) as set,((r,_,leq_d,geq_d) as node_to_be_deleted),node')-> +( +let _,inf,sup = set in +if not (List.for_all (fun ((_,_,_,geq) as node) -> !geq = [] && let rec check_sups = function [] -> true | (_,_,leq,_) as node::tl -> if !leq = [] then List.exists (fun n -> n===node) sup && check_sups tl else check_sups (!leq@tl) in check_sups [node]) inf) then (ps_of_set ([],None,[]) set; assert false); +if not (List.for_all (fun ((_,_,leq,_) as node) -> !leq = [] && let rec check_infs = function [] -> true | (_,_,_,geq) as node::tl -> if !geq = [] then List.exists (fun n -> n===node) inf && check_infs tl else check_infs (!geq@tl) in check_infs [node]) sup) then ((*ps_of_set ([],None,[]) set;*) assert false); +); + let rec clean inf sup res = + function + [] -> inf,sup,res + | node::tl when node===node_to_be_deleted -> + clean inf sup res tl + | (repr',others,leq,geq) as node::tl -> + leq := + (let rec aux res = + function + [] -> res + | (_,_,leq,_) as node::tl -> + if node_to_be_deleted <=> node then + aux (res@[node]) tl + else + (List.filter (fun n ->not (leq_reachable n (res@tl))) !leq)@tl + in + aux [] !leq); + let sup = if !leq = [] then sup@@node else sup in + geq := + (let rec aux res = + function + [] -> res + | (_,_,_,geq) as node::tl -> + if node_to_be_deleted <=> node then + aux (res@[node]) tl + else + (List.filter (fun n ->not (geq_reachable n (res@tl))) !geq)@tl + in + aux [] !geq); + let inf = if !geq = [] then inf@@node else inf in + if node===node' then + clean inf sup ((repr',others@[candidate],leq,geq)::res) tl + else + clean inf sup (node::res) tl + in + let inf,sup,nodes = clean inf sup [] nodes in + let inf = remove node_to_be_deleted inf in + let sup = remove node_to_be_deleted sup in +let set = nodes,inf,sup in +( +let _,inf,sup = set in +if not (List.for_all (fun ((_,_,_,geq) as node) -> !geq = [] && let rec check_sups = function [] -> true | (_,_,leq,_) as node::tl -> if !leq = [] then List.exists (fun n -> n===node) sup && check_sups tl else check_sups (!leq@tl) in check_sups [node]) inf) then (ps_of_set ([],None,[]) set; assert false); +if not (List.for_all (fun ((_,_,leq,_) as node) -> !leq = [] && let rec check_infs = function [] -> true | (_,_,_,geq) as node::tl -> if !geq = [] then List.exists (fun n -> n===node) inf && check_infs tl else check_infs (!geq@tl) in check_infs [node]) sup) then (ps_of_set ([],None,[]) set; assert false); +); + news,(nodes,inf,sup) +;; + +let rec explore i (set:set) news = + let rec aux news set = + function + [] -> news,set + | repr::tl -> + let news,set = + List.fold_right (analyze_one tl repr) [I;C;M] (news,set) + in + aux news set tl + in + let news,set = aux [] set news in + if news = [] then + begin + print_endline ("PUNTO FISSO RAGGIUNTO! i=" ^ string_of_int i); + print_endline (string_of_set set ^ "\n----------------"); + ps_of_set ([],None,[]) set + end + else + begin + print_endline ("NUOVA ITERAZIONE, i=" ^ string_of_int i); + print_endline (string_of_set set ^ "\n----------------"); + explore (i+1) set news + end +in + let id = [] in + let id_node = id,[],ref [], ref [] in + let set = [id_node],[id_node],[id_node] in + print_endline ("PRIMA ITERAZIONE, i=0, j=0"); + print_endline (string_of_set set ^ "\n----------------"); + (*ignore (Unix.system "rm -f log");*) + assert (Unix.system "cp formal_topology.ma log.ma" = Unix.WEXITED 0); + ps_of_set ([id],None,[]) set; + explore 1 set [id] +;; diff --git a/matita/contribs/formal_topology/bin/theory_explorer_do_not_trust_auto.ml b/matita/contribs/formal_topology/bin/theory_explorer_do_not_trust_auto.ml new file mode 100644 index 000000000..3a9dcde30 --- /dev/null +++ b/matita/contribs/formal_topology/bin/theory_explorer_do_not_trust_auto.ml @@ -0,0 +1,232 @@ +type rel = Equal | SubsetEqual | SupersetEqual + +let string_of_rel = + function + Equal -> "=" + | SubsetEqual -> "⊆" + | SupersetEqual -> "⊇" + +(* operator *) +type op = I | C | M + +let string_of_op = + function + I -> "i" + | C -> "c" + | M -> "-" + +(* compound operator *) +type compound_operator = op list + +let string_of_cop op = + if op = [] then "id" else String.concat "" (List.map string_of_op op) + +let dot_of_cop op = "\"" ^ string_of_cop op ^ "\"" + +let rec matita_of_cop v = + function + | [] -> v + | I::tl -> "i (" ^ matita_of_cop v tl ^ ")" + | C::tl -> "c (" ^ matita_of_cop v tl ^ ")" + | M::tl -> "m (" ^ matita_of_cop v tl ^ ")" + +(* representative, other elements in the equivalence class, + leq classes, geq classes *) +type equivalence_class = + compound_operator * compound_operator list * + equivalence_class list ref * equivalence_class list ref + +let string_of_equivalence_class (repr,others,leq,_) = + String.concat " = " (List.map string_of_cop (repr::others)) ^ + (if !leq <> [] then + "\n" ^ + String.concat "\n" + (List.map + (function (repr',_,_,_) -> + string_of_cop repr ^ " <= " ^ string_of_cop repr') !leq) + else + "") + +let dot_of_equivalence_class (repr,others,leq,_) = + (if others <> [] then + let eq = String.concat " = " (List.map string_of_cop (repr::others)) in + dot_of_cop repr ^ "[label=\"" ^ eq ^ "\"];" ^ + if !leq = [] then "" else "\n" + else if !leq = [] then + dot_of_cop repr ^ ";" + else + "") ^ + String.concat "\n" + (List.map + (function (repr',_,_,_) -> + dot_of_cop repr' ^ " -> " ^ dot_of_cop repr ^ ";") !leq) + +(* set of equivalence classes *) +type set = equivalence_class list + +let string_of_set s = + String.concat "\n" (List.map string_of_equivalence_class s) + +let ps_of_set (to_be_considered,under_consideration,news) ?processing s = + let ch = open_out "xxx.dot" in + output_string ch "digraph G {\n"; + (match under_consideration with + None -> () + | Some repr -> + output_string ch (dot_of_cop repr ^ " [color=yellow];")); + List.iter + (function repr -> output_string ch (dot_of_cop repr ^ " [color=green];") + ) to_be_considered ; + List.iter + (function repr -> output_string ch (dot_of_cop repr ^ " [color=navy];") + ) news ; + output_string ch (String.concat "\n" (List.map dot_of_equivalence_class s)); + output_string ch "\n"; + (match processing with + None -> () + | Some (repr,rel,repr') -> + output_string ch (dot_of_cop repr ^ " [color=red];"); + let repr,repr' = + match rel with + SupersetEqual -> repr',repr + | Equal + | SubsetEqual -> repr,repr' + in + output_string ch + (dot_of_cop repr' ^ " -> " ^ dot_of_cop repr ^ + " [" ^ + (match rel with Equal -> "arrowhead=none " | _ -> "") ^ + "style=dashed];\n")); + output_string ch "}\n"; + close_out ch; + ignore (Unix.system "tred xxx.dot > yyy.dot && dot -Tps yyy.dot > xxx.ps") + +let test to_be_considered_and_now set rel candidate repr = + ps_of_set to_be_considered_and_now ~processing:(candidate,rel,repr) set; + print_string + (string_of_cop candidate ^ " " ^ string_of_rel rel ^ " " ^ string_of_cop repr ^ "? "); + flush stdout; + assert (Unix.system "cp formal_topology.ma xxx.ma" = Unix.WEXITED 0); + let ch = open_out_gen [Open_append] 0 "xxx.ma" in + let i = ref 0 in + List.iter + (function (repr,others,leq,_) -> + List.iter + (function repr' -> + incr i; + output_string ch + ("axiom ax" ^ string_of_int !i ^ + ": \\forall A." ^ + matita_of_cop "A" repr ^ " = " ^ matita_of_cop "A" repr' ^ ".\n"); + ) others; + List.iter + (function (repr',_,_,_) -> + incr i; + output_string ch + ("axiom ax" ^ string_of_int !i ^ + ": \\forall A." ^ + matita_of_cop "A" repr ^ " ⊆ " ^ matita_of_cop "A" repr' ^ ".\n"); + ) !leq; + ) set; + let candidate',rel',repr' = + match rel with + SupersetEqual -> repr,SubsetEqual,candidate + | Equal + | SubsetEqual -> candidate,rel,repr + in + output_string ch + ("theorem foo: \\forall A." ^ matita_of_cop "A" candidate' ^ + " " ^ string_of_rel rel' ^ " " ^ + matita_of_cop "A" repr' ^ ". intros; auto size=6 depth=4. qed.\n"); + close_out ch; + let res = + (*Unix.system "../../../matitac.opt xxx.ma >> log 2>&1" = Unix.WEXITED 0*) + Unix.system "../../../matitac.opt xxx.ma > /dev/null 2>&1" = Unix.WEXITED 0 + in + print_endline (if res then "y" else "n"); + res + +let normalize to_be_considered_and_now candidate set = + let rec aux = + function + [] -> raise Not_found + | (repr,others,leq,geq) as eqclass :: tl -> + if test to_be_considered_and_now set Equal candidate repr then + (repr,others@[candidate],leq,geq)::tl + else + eqclass::(aux tl) + in + aux set +;; + +let locate to_be_considered_and_now ((repr,_,leq,geq) as node) set = + let rec aux = + function + [] -> () + | (repr',_,leq',geq') as node' :: tl -> + if repr = repr' then () + else if test to_be_considered_and_now set SubsetEqual repr repr' then + begin + leq := node' :: !leq; + geq' := node :: !geq' + end + else if test to_be_considered_and_now set SupersetEqual repr repr' then + begin + geq := node' :: !geq; + leq' := node :: !leq' + end ; + aux tl + in + aux set +;; + +let analyze_one to_be_considered repr hecandidate (news,set) = + let candidate = hecandidate::repr in + if List.length (List.filter ((=) M) candidate) > 1 then + news,set + else + try + let set = normalize (to_be_considered,Some repr,news) candidate set in + news,set + with + Not_found -> + let leq = ref [] in + let geq = ref [] in + let node = candidate,[],leq,geq in + let set = node::set in + locate (to_be_considered,Some repr,news) node set; + candidate::news,set +;; + +let rec explore i set news = + let rec aux news set = + function + [] -> news,set + | repr::tl -> + let news,set = + List.fold_right (analyze_one tl repr) [I;C;M] (news,set) + in + aux news set tl + in + let news,set = aux [] set news in + if news = [] then + begin + print_endline ("PUNTO FISSO RAGGIUNTO! i=" ^ string_of_int i); + print_endline (string_of_set set ^ "\n----------------"); + ps_of_set ([],None,[]) set + end + else + begin + print_endline ("NUOVA ITERAZIONE, i=" ^ string_of_int i); + print_endline (string_of_set set ^ "\n----------------"); + explore (i+1) set news + end +in + let id = [] in + let set = [id,[],ref [], ref []] in + print_endline ("PRIMA ITERAZIONE, i=0, j=0"); + print_endline (string_of_set set ^ "\n----------------"); + (*ignore (Unix.system "rm -f log");*) + ps_of_set ([id],None,[]) set; + explore 1 set [id] +;; diff --git a/matita/contribs/formal_topology/formal_topology.ma b/matita/contribs/formal_topology/formal_topology.ma new file mode 100644 index 000000000..89ab9484c --- /dev/null +++ b/matita/contribs/formal_topology/formal_topology.ma @@ -0,0 +1,114 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/formal_topology/". +include "logic/equality.ma". + +axiom S: Type. + +axiom leq: S → S → Prop. + +notation "hvbox(A break ⊆ B)" with precedence 59 +for @{ 'subseteq $A $B}. + +interpretation "Subseteq" 'subseteq A B = + (cic:/matita/formal_topology/leq.con A B). + +axiom leq_refl: ∀A. A ⊆ A. +axiom leq_antisym: ∀A,B. A ⊆ B → B ⊆ A → A=B. +axiom leq_tran: ∀A,B,C. A ⊆ B → B ⊆ C → A ⊆ C. + +axiom i: S → S. + +axiom i_contrattivita: ∀A. i A ⊆ A. +axiom i_idempotenza: ∀A. i (i A) = i A. +axiom i_monotonia: ∀A,B. A ⊆ B → i A ⊆ i B. + +axiom c: S → S. + +axiom c_espansivita: ∀A. A ⊆ c A. +axiom c_idempotenza: ∀A. c (c A) = c A. +axiom c_monotonia: ∀A,B. A ⊆ B → c A ⊆ c B. + +axiom m: S → S. + +axiom m_antimonotonia: ∀A,B. A ⊆ B → m B ⊆ m A. +axiom m_saturazione: ∀A. A ⊆ m (m A). +axiom m_puntofisso: ∀A. m A = m (m (m A)). + +lemma l1: ∀A,B. i A ⊆ B → i A ⊆ i B. intros; rewrite < i_idempotenza; auto. qed. +lemma l2: ∀A,B. A ⊆ c B → c A ⊆ c B. intros; rewrite < c_idempotenza in ⊢ (? ? %); auto. qed. + +theorem geq1: ∀A. i (i A) = i A. intros. auto. qed. +theorem geq2: ∀A. c (c A) = c A. intros. auto. qed. +theorem geq3: ∀A. i (i (c A)) = i (c A). intros. auto. qed. +theorem geq4: ∀A. c (c (i A)) = c (i A). intros. auto. qed. +theorem geq5: ∀A. i (c (i (c A))) = i (c A). intros. auto depth=4. qed. +theorem geq6: ∀A. c (i (c (i A))) = c (i A). intros. auto depth=4. qed. +theorem gse1: ∀A. i A ⊆ A. intros. auto. qed. +theorem gse2: ∀A. A ⊆ c A. intros. auto. qed. +theorem gse3: ∀A. i A ⊆ i (c (i A)). intros. auto. qed. +theorem gse4: ∀A. i (c (i A)) ⊆ i (c A). intros. auto. qed. +theorem gse5: ∀A. i (c (i A)) ⊆ c (i A). intros. auto. qed. +theorem gse6: ∀A. i (c A) ⊆ c (i (c A)). intros. auto. qed. +theorem gse7: ∀A. c (i A) ⊆ c (i (c A)). intros. auto. qed. +theorem gse8: ∀A. c (i (c A)) ⊆ c A. intros. auto. qed. + +axiom th1: ∀A. c (m A) ⊆ m (i A). +axiom th2: ∀A. i (m A) ⊆ m (c A). + +theorem se1: ∀A. i (c (m (c A))) ⊆ i (m (i (c A))). intros; auto. qed. +theorem se2: ∀A. i (m (i (c A))) ⊆ m (c (i (c A))). intros; auto. qed. +theorem se3: ∀A. c (i (m A)) ⊆ c (i (c (m (c A)))). intros; auto depth=4. qed. +theorem se4: ∀A. c (i (c (m (c A)))) ⊆ c (i (m (i (c A)))). intros; auto. qed. +theorem se5: ∀A. i (c (m (c A))) ⊆ c (i (c (m (c A)))). intros; auto. qed. +theorem se6: ∀A. i (m (i (c A))) ⊆ c (i (m (i (c A)))). intros; auto. qed. +theorem se7: ∀A. m (c A) ⊆ m A. intros; auto. qed. +theorem se8: ∀A. i (c (m (c A))) ⊆ i (c (m A)). intros; auto. qed. +theorem se9: ∀A. i (c (m A)) ⊆ i (m (i A)). intros; auto. qed. +theorem se10: ∀A. i (m (i (c A))) ⊆ i (m (i A)). intros; auto depth=4. qed. +theorem se11: ∀A. i (m (i A)) ⊆ m (c (i A)). intros; auto. qed. +theorem se12: ∀A. m (c (i (c A))) ⊆ m (c (i A)). intros; auto. qed. +theorem se13: ∀A. m (c A) ⊆ m (c (i (c A))). intros; auto. qed. +theorem se14: ∀A. i (c (m A)) ⊆ c (i (c (m A))). intros; auto. qed. +theorem se15: ∀A. c (i (c (m A))) ⊆ c (m A). intros; auto. qed. +theorem se16: ∀A. c (i (m (i A))) ⊆ c (m (c (i A))). intros; auto depth=4. qed. +theorem se17: ∀A. c (m (c (i A))) ⊆ m (i (c (i A))). intros; auto. qed. +theorem se18: ∀A. m (i (c A)) ⊆ m (i (c (i A))). intros; auto. qed. +theorem se19: ∀A. m (i (c (i A))) ⊆ m (i A). intros; auto. qed. +theorem se20: ∀A. c (m (c A)) ⊆ c (m A). intros; auto. qed. +theorem se21: ∀A. c (m (c A)) ⊆ c (m (c (i (c A)))). intros; auto. qed. +theorem se22: ∀A. c (m (c (i (c A)))) ⊆ m (i (c A)). intros; auto. qed. +theorem se23: ∀A. c (i (c (m (c A)))) ⊆ c (i (c (m A))). intros; auto. qed. +theorem se24: ∀A. c (i (c (m (c A)))) ⊆ c (m (c A)). intros; auto. qed. +theorem se25: ∀A. m (c A) ⊆ c (m (c A)). intros; auto. qed. +theorem se26: ∀A. c (i (m (i (c A)))) ⊆ c (i (m (c (i (c A))))). intros; auto. qed. +theorem se27: ∀A. m (c (i (c A))) ⊆ c (m (c (i (c A)))). intros; auto. qed. +theorem se28: ∀A. m (c (i A)) ⊆ c (m (c (i A))). intros; auto. qed. +theorem se29: ∀A. m A ⊆ c (m A). intros; auto. qed. +theorem se30: ∀A. i (m A) ⊆ i (c (i (m A))). intros; auto. qed. +theorem se31: ∀A. i (c (i (m A))) ⊆ c (i (m A)). intros; auto. qed. +theorem se32: ∀A. i (c (i (m A))) ⊆ i (c (m (c A))). intros; auto. qed. +theorem se33: ∀A. c (i (c (m A))) ⊆ c (i (m (i A))). intros; auto. qed. +theorem se34: ∀A. i (m (i A)) ⊆ c (i (m (i A))). intros; auto. qed. +theorem se35: ∀A. c (i (m (i (c A)))) ⊆ c (i (m (i A))). intros; auto. qed. +theorem se36: ∀A. c (m (c (i (c A)))) ⊆ c (m (c (i A))). intros; auto. qed. + +theorem th5: ∀A. i (m (c A)) = i (m A). intros; auto depth=4. qed. +theorem th6: ∀A. c (m (i A)) = m (i A). intros; auto width=2 depth=5. qed. +theorem th7: ∀A. i (m (i A)) = i (c (i (m (i A)))). intros; auto. qed. +theorem th8: ∀A. i (m (i A)) = i (m (i (c (i A)))). intros; auto. qed. +theorem th9: ∀A. i (c (m (c (i A)))) = i (m (i A)). intros; auto depth=4. qed. + +(* theorem th7: ∀A. i (m (i A)) = i (s (i A)). *) \ No newline at end of file diff --git a/matita/contribs/formal_topology/formal_topology2.ma b/matita/contribs/formal_topology/formal_topology2.ma new file mode 100644 index 000000000..b98865a5c --- /dev/null +++ b/matita/contribs/formal_topology/formal_topology2.ma @@ -0,0 +1,77 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/formal_topology/". +include "logic/equality.ma". + +axiom S: Type. + +axiom comp: S → S → S. +coercion cic:/matita/formal_topology/comp.con 1. + +axiom comp_assoc: ∀A,B,C:S. A (B C) = (A B) C. + +axiom one: S. + +notation "1" with precedence 89 +for @{ 'unit }. + +interpretation "Unit" 'unit = + cic:/matita/formal_topology/one.con. + +axiom one_left: ∀A. 1 A = A. +axiom one_right: ∀A:S. A 1 = A. + +axiom eps: S. +axiom eps_idempotent: eps = eps eps. + +notation "hvbox(A break ⊆ B)" with precedence 59 +for @{ 'subseteq $A $B}. + +interpretation "Subseteq" 'subseteq A B = + (cic:/matita/logic/equality/eq.ind#xpointer(1/1) _ A + (cic:/matita/formal_topology/comp.con + cic:/matita/formal_topology/eps.con B)). + +axiom leq_refl: ∀A. A ⊆ A. +axiom leq_antisym: ∀A,B. A ⊆ B → B ⊆ A → A=B. +axiom leq_tran: ∀A,B,C. A ⊆ B → B ⊆ C → A ⊆ C. + +axiom i: S. + +axiom i_contrattivita: i ⊆ 1. +axiom i_idempotenza: i i = i. +axiom i_monotonia: ∀A,B. A ⊆ B → i A ⊆ i B. + +axiom c: S. + +axiom c_espansivita: 1 ⊆ c. +axiom c_idempotenza: c c = c. +axiom c_monotonia: ∀A,B. A ⊆ B → c A ⊆ c B. + +axiom m: S. + +axiom m_antimonotonia: ∀A,B. A ⊆ B → m B ⊆ m A. +axiom m_saturazione: 1 ⊆ m m. +axiom m_puntofisso: m = m (m m). + +theorem th1: c m ⊆ m i. intros; auto. qed. +theorem th2: ∀A. i (m A) ⊆ (m (c A)). intros; auto. qed. +theorem th3: ∀A. i A ⊆ (m (c (m A))). intros; auto. qed. +theorem th4: ∀A. c A ⊆ (m (i (m A))). intros; auto. qed. + +theorem th5: ∀A. i (m A) = i (m (c A)). intros; auto. qed. +theorem th6: ∀A. m (i A) = c (m (i A)). intros; auto. qed. + +theorem th7: ∀A. i (m (i A)) = i (s (i A)). \ No newline at end of file diff --git a/matita/contribs/prova.ma b/matita/contribs/prova.ma new file mode 100644 index 000000000..a0cab9867 --- /dev/null +++ b/matita/contribs/prova.ma @@ -0,0 +1,236 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/prova". + +include "../legacy/coq.ma". + +theorem pippo: \forall (A,B:Prop). A \land B \to A. + intros; decompose; assumption. +qed. + +inline procedural "cic:/matita/test/prova/pippo.con". + +alias id "plus" = "cic:/Coq/Init/Peano/plus.con". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "eq" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)". +theorem plus_comm: \forall n:nat.\forall m:nat.eq nat (plus n m) (plus m n). + intros; alias id "plus_comm" = "cic:/Coq/Arith/Plus/plus_comm.con". +apply plus_comm. +qed. +(* +include "LAMBDA-TYPES/LambdaDelta-1/preamble.ma". +alias id "ty3" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/defs/ty3.ind#xpointer(1/1)". +alias id "pc3" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/defs/pc3.con". +alias id "THead" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/defs/T.ind#xpointer(1/1/3)". +alias id "T" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/defs/T.ind#xpointer(1/1)". +alias id "G" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/G/defs/G.ind#xpointer(1/1)". +alias id "Flat" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/defs/K.ind#xpointer(1/1/2)". +alias id "Cast" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/defs/F.ind#xpointer(1/1/2)". +alias id "C" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/C/defs/C.ind#xpointer(1/1)". +theorem ty3_gen_cast: + (\forall g:G + .\forall c:C + .\forall t1:T + .\forall t2:T + .\forall x:T + .ty3 g c (THead (Flat Cast) t2 t1) x + \rarr pc3 c t2 x\land ty3 g c t1 t2) +. +(* tactics: 80 *) +intros 6 (g c t1 t2 x H). +apply insert_eq;(* 6 P P P C I I 3 0 *) +[apply T(* dependent *) +|apply (THead (Flat Cast) t2 t1)(* dependent *) +|apply (\lambda t:T.ty3 g c t x)(* dependent *) +|intros 2 (y H0). +alias id "ty3_ind" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/ty3/defs/ty3_ind.con". +elim H0 using ty3_ind names 0;(* 13 P C I I I I I I I C C C I 12 3 *) +[intros 11 (c0 t0 t UNUSED UNUSED u t3 UNUSED H4 H5 H6). +letin H7 \def (f_equal T T (\lambda e:T.e) u (THead (Flat Cast) t2 t1) H6).(* 6 C C C C C I *) +rewrite > H7 in H4:(%) as (H8). +cut (pc3 c0 t2 t3\land ty3 g c0 t1 t2) as H10; +[id +|apply H8.(* 1 I *) +apply refl_equal(* 2 C C *) +]. +elim H10 using and_ind names 0.(* 5 P P C I I 3 0 *) +intros 2 (H11 H12). +apply conj;(* 4 C C I I *) +[alias id "pc3_t" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/props/pc3_t.con". +apply pc3_t;(* 6 P C C I C I *) +[apply t3(* dependent *) +|apply H11(* assumption *) +|apply H5(* assumption *) +] +|apply H12(* assumption *) +] +|intros 3 (c0 m H1). +alias id "K" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/defs/K.ind#xpointer(1/1)". +cut match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr True +|TLRef (_:nat)\rArr False +|THead (_:K) (_:T) (_:T)\rArr False] as H2; +[id +|rewrite < H1 in \vdash (%). +apply I +]. +clearbody H2. +change in H2:(%) with match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr True +|TLRef (_:nat)\rArr False +|THead (_:K) (_:T) (_:T)\rArr False]. +elim H2 using False_ind names 0(* 2 C I 2 0 *) +|intros 9 (n c0 d u UNUSED t UNUSED UNUSED H4). +cut match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr False +|TLRef (_:nat)\rArr True +|THead (_:K) (_:T) (_:T)\rArr False] as H5; +[id +|rewrite < H4 in \vdash (%). +apply I +]. +clearbody H5. +change in H5:(%) with match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr False +|TLRef (_:nat)\rArr True +|THead (_:K) (_:T) (_:T)\rArr False]. +elim H5 using False_ind names 0(* 2 C I 2 0 *) +|intros 9 (n c0 d u UNUSED t UNUSED UNUSED H4). +cut match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr False +|TLRef (_:nat)\rArr True +|THead (_:K) (_:T) (_:T)\rArr False] as H5; +[id +|rewrite < H4 in \vdash (%). +apply I +]. +clearbody H5. +change in H5:(%) with match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr False +|TLRef (_:nat)\rArr True +|THead (_:K) (_:T) (_:T)\rArr False]. +elim H5 using False_ind names 0(* 2 C I 2 0 *) +|intros 14 (c0 u t UNUSED UNUSED b t0 t3 UNUSED UNUSED t4 UNUSED UNUSED H7). +alias id "F" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/defs/F.ind#xpointer(1/1)". +alias id "B" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/T/defs/B.ind#xpointer(1/1)". +cut match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr False +|TLRef (_:nat)\rArr False +|THead (k:K) (_:T) (_:T)\rArr + match k in K return \lambda _:K.Prop with + [Bind (_:B)\rArr True|Flat (_:F)\rArr False]] as H8; +[id +|rewrite < H7 in \vdash (%). +apply I +]. +clearbody H8. +change in H8:(%) with match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr False +|TLRef (_:nat)\rArr False +|THead (k:K) (_:T) (_:T)\rArr + match k in K return \lambda _:K.Prop with + [Bind (_:B)\rArr True|Flat (_:F)\rArr False]]. +elim H8 using False_ind names 0(* 2 C I 2 0 *) +|intros 10 (c0 w u UNUSED UNUSED v t UNUSED UNUSED H5). +cut match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr False +|TLRef (_:nat)\rArr False +|THead (k:K) (_:T) (_:T)\rArr + match k in K return \lambda _:K.Prop with + [Bind (_:B)\rArr False + |Flat (f:F)\rArr + match f in F return \lambda _:F.Prop with + [Appl\rArr True|Cast\rArr False]]] as H6; +[id +|rewrite < H5 in \vdash (%). +apply I +]. +clearbody H6. +change in H6:(%) with match THead (Flat Cast) t2 t1 in T return \lambda _:T.Prop with +[TSort (_:nat)\rArr False +|TLRef (_:nat)\rArr False +|THead (k:K) (_:T) (_:T)\rArr + match k in K return \lambda _:K.Prop with + [Bind (_:B)\rArr False + |Flat (f:F)\rArr + match f in F return \lambda _:F.Prop with + [Appl\rArr True|Cast\rArr False]]]. +elim H6 using False_ind names 0(* 2 C I 2 0 *) +|intros 9 (c0 t0 t3 H1 H2 t4 UNUSED UNUSED H5). +letin H6 \def (f_equal T T + (\lambda e:T + .match e in T return \lambda _:T.T with + [TSort (_:nat)\rArr t3 + |TLRef (_:nat)\rArr t3 + |THead (_:K) (t:T) (_:T)\rArr t]) (THead (Flat Cast) t3 t0) + (THead (Flat Cast) t2 t1) H5).(* 6 C C C C C I *) +letin H7 \def (f_equal T T + (\lambda e:T + .match e in T return \lambda _:T.T with + [TSort (_:nat)\rArr t0 + |TLRef (_:nat)\rArr t0 + |THead (_:K) (_:T) (t:T)\rArr t]) (THead (Flat Cast) t3 t0) + (THead (Flat Cast) t2 t1) H5).(* 6 C C C C C I *) +cut (t3=t2\rarr pc3 c0 t2 t3\land ty3 g c0 t1 t2) as DEFINED; +[id +|intros 1 (H8). +rewrite > H8 in H2:(%) as (UNUSED). +rewrite > H8 in H1:(%) as (H12). +rewrite > H8 in \vdash (%). +clearbody H7. +change in H7:(%) with (match THead (Flat Cast) t3 t0 in T return \lambda _:T.T with + [TSort (_:nat)\rArr t0 + |TLRef (_:nat)\rArr t0 + |THead (_:K) (_:T) (t:T)\rArr t] + =match THead (Flat Cast) t2 t1 in T return \lambda _:T.T with + [TSort (_:nat)\rArr t0 + |TLRef (_:nat)\rArr t0 + |THead (_:K) (_:T) (t:T)\rArr t]). +rewrite > H7 in H12:(%) as (H14). +apply conj;(* 4 C C I I *) +[alias id "pc3_refl" = "cic:/matita/LAMBDA-TYPES/LambdaDelta-1/pc3/props/pc3_refl.con". +apply pc3_refl(* 2 C C *) +|apply H14(* assumption *) +] +]. +apply DEFINED.(* 1 I *) +apply H6(* assumption *) +] +|apply H(* assumption *) +]. +qed. +*) +(* +include "nat/orders.ma". + +theorem le_inv: + \forall P:nat \to Prop + .\forall p2 + .\forall p1 + .p2 <= p1 \to + (p1 = p2 \to P p2) \to + (\forall n1 + .p2 <= n1 \to + (p1 = n1 \to P n1) \to + p1 = S n1 \to P (S n1)) \to + P p1. + intros 4; elim H names 0; clear H p1; intros; + [ apply H; reflexivity + | apply H3; clear H3; intros; + [ apply H | apply H1; clear H1; intros; subst; + [ apply H2; apply H3 | ] + | reflexivity + ] +*) diff --git a/matita/core_notation.moo b/matita/core_notation.moo new file mode 100644 index 000000000..17d5993b1 --- /dev/null +++ b/matita/core_notation.moo @@ -0,0 +1,121 @@ +notation < "hvbox(\exists ident i opt (: ty) break . p)" + right associative with precedence 20 +for @{ 'exists ${default + @{\lambda ${ident i} : $ty. $p} + @{\lambda ${ident i} . $p}}}. + +notation "hvbox(a break \to b)" + right associative with precedence 20 +for @{ \forall $_:$a.$b }. + +notation < "hvbox(a break \to b)" + right associative with precedence 20 +for @{ \Pi $_:$a.$b }. + +notation "hvbox(a break = b)" + non associative with precedence 45 +for @{ 'eq $a $b }. + +notation "hvbox(a break \leq b)" + non associative with precedence 45 +for @{ 'leq $a $b }. + +notation "hvbox(a break \geq b)" + non associative with precedence 45 +for @{ 'geq $a $b }. + +notation "hvbox(a break \lt b)" + non associative with precedence 45 +for @{ 'lt $a $b }. + +notation "hvbox(a break \gt b)" + non associative with precedence 45 +for @{ 'gt $a $b }. + +notation "hvbox(a break \neq b)" + non associative with precedence 45 +for @{ 'neq $a $b }. + +notation "hvbox(a break \nleq b)" + non associative with precedence 45 +for @{ 'nleq $a $b }. + +notation "hvbox(a break \ngeq b)" + non associative with precedence 45 +for @{ 'ngeq $a $b }. + +notation "hvbox(a break \nless b)" + non associative with precedence 45 +for @{ 'nless $a $b }. + +notation "hvbox(a break \ngtr b)" + non associative with precedence 45 +for @{ 'ngtr $a $b }. + +notation "hvbox(a break \divides b)" + non associative with precedence 45 +for @{ 'divides $a $b }. + +notation "hvbox(a break \ndivides b)" + non associative with precedence 45 +for @{ 'ndivides $a $b }. + +notation "hvbox(a break + b)" + left associative with precedence 50 +for @{ 'plus $a $b }. + +notation "hvbox(a break - b)" + left associative with precedence 50 +for @{ 'minus $a $b }. + +notation "hvbox(a break * b)" + left associative with precedence 55 +for @{ 'times $a $b }. + +notation "hvbox(a break \mod b)" + left associative with precedence 55 +for @{ 'module $a $b }. + +notation "\frac a b" + non associative with precedence 90 +for @{ 'divide $a $b }. + +notation "a \over b" + left associative with precedence 55 +for @{ 'divide $a $b }. + +notation "hvbox(a break / b)" + left associative with precedence 55 +for @{ 'divide $a $b }. + +notation > "- a" + right associative with precedence 60 +for @{ 'uminus $a }. + +notation < "- a" + right associative with precedence 75 +for @{ 'uminus $a }. + +notation "a !" + non associative with precedence 80 +for @{ 'fact $a }. + +notation "(a \sup b)" + right associative with precedence 65 +for @{ 'exp $a $b}. + +notation "\sqrt a" + non associative with precedence 60 +for @{ 'sqrt $a }. + +notation "hvbox(a break \lor b)" + left associative with precedence 30 +for @{ 'or $a $b }. + +notation "hvbox(a break \land b)" + left associative with precedence 35 +for @{ 'and $a $b }. + +notation "hvbox(\lnot a)" + non associative with precedence 40 +for @{ 'not $a }. diff --git a/matita/dama/attic/fields.ma b/matita/dama/attic/fields.ma new file mode 100644 index 000000000..194a39110 --- /dev/null +++ b/matita/dama/attic/fields.ma @@ -0,0 +1,60 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/fields/". + +include "attic/rings.ma". + +record is_field (R:ring) (inv:∀x:R.x ≠ 0 → R) : Prop +≝ + { (* multiplicative abelian properties *) + mult_comm_: symmetric ? (mult R); + (* multiplicative group properties *) + inv_inverse_: ∀x.∀p: x ≠ 0. inv x p * x = 1 + }. + +lemma opp_opp: ∀R:ring. ∀x:R. --x=x. +intros; +apply (cancellationlaw ? (-x) ? ?); +rewrite > (opp_inverse R x); +rewrite > plus_comm; +rewrite > opp_inverse; +reflexivity. +qed. + +let rec sum (C:Type) (plus:C→C→C) (zero,one:C) (n:nat) on n ≝ + match n with + [ O ⇒ zero + | (S m) ⇒ plus one (sum C plus zero one m) + ]. + +record field : Type \def + { f_ring:> ring; + inv: ∀x:f_ring. x ≠ 0 → f_ring; + field_properties: is_field f_ring inv + }. + +theorem mult_comm: ∀F:field.symmetric ? (mult F). + intro; + apply (mult_comm_ ? ? (field_properties F)). +qed. + +theorem inv_inverse: ∀F:field.∀x:F.∀p: x ≠ 0. (inv ? x p)*x = 1. + intro; + apply (inv_inverse_ ? ? (field_properties F)). +qed. + +(*CSC: qua funzionava anche mettendo ? al posto della prima F*) +definition sum_field ≝ + λF:field. sum F (plus F) 0 1. diff --git a/matita/dama/attic/integration_algebras.ma b/matita/dama/attic/integration_algebras.ma new file mode 100644 index 000000000..50bf063a4 --- /dev/null +++ b/matita/dama/attic/integration_algebras.ma @@ -0,0 +1,368 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/integration_algebras/". + +include "attic/vector_spaces.ma". +include "lattice.ma". + +(**************** Riesz Spaces ********************) + +record pre_riesz_space (K:ordered_field_ch0) : Type \def + { rs_vector_space:> vector_space K; + rs_lattice_: lattice; + rs_ordered_abelian_group_: ordered_abelian_group; + rs_with1: + og_abelian_group rs_ordered_abelian_group_ = vs_abelian_group ? rs_vector_space; + rs_with2: + og_ordered_set rs_ordered_abelian_group_ = ordered_set_of_lattice rs_lattice_ + }. + +lemma rs_lattice: ∀K.pre_riesz_space K → lattice. + intros (K V); + cut (os_carrier (rs_lattice_ ? V) = V); + [ apply mk_lattice; + [ apply (carrier V) + | apply (eq_rect ? ? (λC:Type.C→C→C) ? ? Hcut); + apply l_join + | apply (eq_rect ? ? (λC:Type.C→C→C) ? ? Hcut); + apply l_meet + | apply + (eq_rect' ? ? + (λa:Type.λH:os_carrier (rs_lattice_ ? V)=a. + is_lattice a + (eq_rect Type (rs_lattice_ K V) (λC:Type.C→C→C) + (l_join (rs_lattice_ K V)) a H) + (eq_rect Type (rs_lattice_ K V) (λC:Type.C→C→C) + (l_meet (rs_lattice_ K V)) a H)) + ? ? Hcut); + simplify; + apply l_lattice_properties + ] + | transitivity (os_carrier (rs_ordered_abelian_group_ ? V)); + [ apply (eq_f ? ? os_carrier); + symmetry; + apply rs_with2 + | apply (eq_f ? ? carrier); + apply rs_with1 + ] + ]. +qed. + +coercion cic:/matita/integration_algebras/rs_lattice.con. + +lemma rs_ordered_abelian_group: ∀K.pre_riesz_space K → ordered_abelian_group. + intros (K V); + apply mk_ordered_abelian_group; + [ apply mk_pre_ordered_abelian_group; + [ apply (vs_abelian_group ? (rs_vector_space ? V)) + | apply (ordered_set_of_lattice (rs_lattice ? V)) + | reflexivity + ] + | simplify; + generalize in match + (og_ordered_abelian_group_properties (rs_ordered_abelian_group_ ? V)); + intro P; + unfold in P; + elim daemon(* + apply + (eq_rect ? ? + (λO:ordered_set. + ∀f,g,h. + os_le O f g → + os_le O + (plus (abelian_group_OF_pre_riesz_space K V) f h) + (plus (abelian_group_OF_pre_riesz_space K V) g h)) + ? ? (rs_with2 ? V)); + apply + (eq_rect ? ? + (λG:abelian_group. + ∀f,g,h. + os_le (ordered_set_OF_pre_riesz_space K V) f g → + os_le (ordered_set_OF_pre_riesz_space K V) + (plus (abelian_group_OF_pre_riesz_space K V) f h) + (plus (abelian_group_OF_pre_riesz_space K V) g h)) + ? ? (rs_with1 ? V)); + simplify; + apply og_ordered_abelian_group_properties*) + ] +qed. + +coercion cic:/matita/integration_algebras/rs_ordered_abelian_group.con. + +record is_riesz_space (K:ordered_field_ch0) (V:pre_riesz_space K) : Prop ≝ + { rs_compat_le_times: ∀a:K.∀f:V. 0≤a → 0≤f → 0≤a*f + }. + +record riesz_space (K:ordered_field_ch0) : Type \def + { rs_pre_riesz_space:> pre_riesz_space K; + rs_riesz_space_properties: is_riesz_space ? rs_pre_riesz_space + }. + +record is_positive_linear (K) (V:riesz_space K) (T:V→K) : Prop ≝ + { positive: ∀u:V. 0≤u → 0≤T u; + linear1: ∀u,v:V. T (u+v) = T u + T v; + linear2: ∀u:V.∀k:K. T (k*u) = k*(T u) + }. + +record sequentially_order_continuous (K) (V:riesz_space K) (T:V→K) : Prop ≝ + { soc_incr: + ∀a:nat→V.∀l:V.is_increasing ? a → is_sup V a l → + is_increasing K (λn.T (a n)) ∧ tends_to ? (λn.T (a n)) (T l) + }. + +definition absolute_value ≝ λK.λS:riesz_space K.λf:S.f ∨ -f. + +(**************** Normed Riesz spaces ****************************) + +definition is_riesz_norm ≝ + λR:real.λV:riesz_space R.λnorm:norm R V. + ∀f,g:V. absolute_value ? V f ≤ absolute_value ? V g → + n_function R V norm f ≤ n_function R V norm g. + +record riesz_norm (R:real) (V:riesz_space R) : Type ≝ + { rn_norm:> norm R V; + rn_riesz_norm_property: is_riesz_norm ? ? rn_norm + }. + +(*CSC: non fa la chiusura delle coercion verso funclass *) +definition rn_function ≝ + λR:real.λV:riesz_space R.λnorm:riesz_norm ? V. + n_function R V (rn_norm ? ? norm). + +coercion cic:/matita/integration_algebras/rn_function.con 1. + +(************************** L-SPACES *************************************) +(* +record is_l_space (R:real) (V:riesz_space R) (norm:riesz_norm ? V) : Prop ≝ + { ls_banach: is_complete ? V (induced_distance ? ? norm); + ls_linear: ∀f,g:V. le ? V 0 f → le ? V 0 g → norm (f+g) = norm f + norm g + }. +*) +(******************** ARCHIMEDEAN RIESZ SPACES ***************************) + +record is_archimedean_riesz_space (K) (S:riesz_space K) : Prop +\def + { ars_archimedean: ∃u:S.∀n.∀a.∀p:n > O. + absolute_value ? S a ≤ + (inv K (sum_field K n) (not_eq_sum_field_zero K n p))* u → + a = 0 + }. + +record archimedean_riesz_space (K:ordered_field_ch0) : Type \def + { ars_riesz_space:> riesz_space K; + ars_archimedean_property: is_archimedean_riesz_space ? ars_riesz_space + }. + +definition is_weak_unit ≝ +(* This definition is by Spitters. He cites Fremlin 353P, but: + 1. that theorem holds only in f-algebras (as in Spitters, but we are + defining it on Riesz spaces) + 2. Fremlin proves |x|/\u=0 \to u=0. How do we remove the absolute value? + λR:real.λV:archimedean_riesz_space R.λunit: V. + ∀x:V. meet x unit = 0 → u = 0. + 3. Fremlin proves u > 0 implies x /\ u > 0 > 0 for Archimedean spaces + only. We pick this definition for now. +*) λR:real.λV:archimedean_riesz_space R.λe:V. + ∀v:V. 0 archimedean_riesz_space R; + irs_unit: irs_archimedean_riesz_space; + irs_weak_unit: is_weak_unit ? ? irs_unit; + integral: irs_archimedean_riesz_space → R; + irs_positive_linear: is_positive_linear ? ? integral; + irs_limit1: + ∀f:irs_archimedean_riesz_space. + tends_to ? + (λn.integral (f ∧ ((sum_field R n)*irs_unit))) + (integral f); + irs_limit2: + ∀f:irs_archimedean_riesz_space. + tends_to ? + (λn. + integral (f ∧ + ((inv ? (sum_field R (S n)) + (not_eq_sum_field_zero R (S n) (le_S_S O n (le_O_n n))) + ) * irs_unit))) 0; + irs_quotient_space1: + ∀f,g:irs_archimedean_riesz_space. + integral (absolute_value ? irs_archimedean_riesz_space (f - g)) = 0 → f=g + }. + +definition induced_norm_fun ≝ + λR:real.λV:integration_riesz_space R.λf:V. + integral ? V (absolute_value ? ? f). + +lemma induced_norm_is_norm: + ∀R:real.∀V:integration_riesz_space R.is_norm R V (induced_norm_fun ? V). + elim daemon.(* + intros; + apply mk_is_norm; + [ apply mk_is_semi_norm; + [ unfold induced_norm_fun; + intros; + apply positive; + [ apply (irs_positive_linear ? V) + | (* difficile *) + elim daemon + ] + | intros; + unfold induced_norm_fun; + (* facile *) + elim daemon + | intros; + unfold induced_norm_fun; + (* difficile *) + elim daemon + ] + | intros; + unfold induced_norm_fun in H; + apply irs_quotient_space1; + unfold minus; + rewrite < plus_comm; + rewrite < eq_zero_opp_zero; + rewrite > zero_neutral; + assumption + ].*) +qed. + +definition induced_norm ≝ + λR:real.λV:integration_riesz_space R. + mk_norm ? ? (induced_norm_fun ? V) (induced_norm_is_norm ? V). + +lemma is_riesz_norm_induced_norm: + ∀R:real.∀V:integration_riesz_space R. + is_riesz_norm ? ? (induced_norm ? V). + intros; + unfold is_riesz_norm; + intros; + unfold induced_norm; + simplify; + unfold induced_norm_fun; + (* difficile *) + elim daemon. +qed. + +definition induced_riesz_norm ≝ + λR:real.λV:integration_riesz_space R. + mk_riesz_norm ? ? (induced_norm ? V) (is_riesz_norm_induced_norm ? V). + +definition distance_induced_by_integral ≝ + λR:real.λV:integration_riesz_space R. + induced_distance ? ? (induced_norm R V). + +definition is_complete_integration_riesz_space ≝ + λR:real.λV:integration_riesz_space R. + is_complete ? ? (distance_induced_by_integral ? V). + +record complete_integration_riesz_space (R:real) : Type ≝ + { cirz_integration_riesz_space:> integration_riesz_space R; + cirz_complete_integration_riesz_space_property: + is_complete_integration_riesz_space ? cirz_integration_riesz_space + }. + +(* now we prove that any complete integration riesz space is an L-space *) + +(*theorem is_l_space_l_space_induced_by_integral: + ∀R:real.∀V:complete_integration_riesz_space R. + is_l_space ? ? (induced_riesz_norm ? V). + intros; + constructor 1; + [ apply cirz_complete_integration_riesz_space_property + | intros; + unfold induced_riesz_norm; + simplify; + unfold induced_norm; + simplify; + unfold induced_norm_fun; + (* difficile *) + elim daemon + ]. +qed.*) + +(**************************** f-ALGEBRAS ********************************) + +record is_algebra (K: field) (V:vector_space K) (mult:V→V→V) (one:V) : Prop +≝ + { (* ring properties *) + a_ring: is_ring V mult one; + (* algebra properties *) + a_associative_left: ∀a,f,g. a * (mult f g) = mult (a * f) g; + a_associative_right: ∀a,f,g. a * (mult f g) = mult f (a * g) + }. + +record algebra (K: field) : Type \def + { a_vector_space:> vector_space K; + a_one: a_vector_space; + a_mult: a_vector_space → a_vector_space → a_vector_space; + a_algebra_properties: is_algebra ? ? a_mult a_one + }. + +interpretation "Algebra product" 'times a b = + (cic:/matita/integration_algebras/a_mult.con _ a b). + +definition ring_of_algebra ≝ + λK.λA:algebra K. + mk_ring A (a_mult ? A) (a_one ? A) + (a_ring ? ? ? ? (a_algebra_properties ? A)). + +coercion cic:/matita/integration_algebras/ring_of_algebra.con. + +record pre_f_algebra (K:ordered_field_ch0) : Type ≝ + { fa_archimedean_riesz_space:> archimedean_riesz_space K; + fa_algebra_: algebra K; + fa_with: a_vector_space ? fa_algebra_ = rs_vector_space ? fa_archimedean_riesz_space + }. + +lemma fa_algebra: ∀K:ordered_field_ch0.pre_f_algebra K → algebra K. + intros (K A); + apply mk_algebra; + [ apply (rs_vector_space ? A) + | elim daemon + | elim daemon + | elim daemon + ] + qed. + +coercion cic:/matita/integration_algebras/fa_algebra.con. + +record is_f_algebra (K) (A:pre_f_algebra K) : Prop ≝ +{ compat_mult_le: ∀f,g:A.0 ≤ f → 0 ≤ g → 0 ≤ f*g; + compat_mult_meet: + ∀f,g,h:A.(f ∧ g) = 0 → ((h*f) ∧ g) = 0 +}. + +record f_algebra (K:ordered_field_ch0) : Type ≝ +{ fa_pre_f_algebra:> pre_f_algebra K; + fa_f_algebra_properties: is_f_algebra ? fa_pre_f_algebra +}. + +(* to be proved; see footnote 2 in the paper by Spitters *) +axiom symmetric_a_mult: + ∀K.∀A:f_algebra K. symmetric ? (a_mult ? A). + +record integration_f_algebra (R:real) : Type \def + { ifa_integration_riesz_space:> integration_riesz_space R; + ifa_f_algebra_: f_algebra R; + ifa_with: + fa_archimedean_riesz_space ? ifa_f_algebra_ = + irs_archimedean_riesz_space ? ifa_integration_riesz_space + }. + +axiom ifa_f_algebra: ∀R:real.integration_f_algebra R → f_algebra R. + +coercion cic:/matita/integration_algebras/ifa_f_algebra.con. diff --git a/matita/dama/attic/ordered_fields_ch0.ma b/matita/dama/attic/ordered_fields_ch0.ma new file mode 100644 index 000000000..5be3c9da4 --- /dev/null +++ b/matita/dama/attic/ordered_fields_ch0.ma @@ -0,0 +1,151 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/ordered_fields_ch0/". + +include "attic/fields.ma". +include "ordered_group.ma". + +(*CSC: non capisco questi alias! Una volta non servivano*) +alias id "plus" = "cic:/matita/group/plus.con". +alias symbol "plus" = "Abelian group plus". + +record pre_ordered_field_ch0: Type ≝ + { of_field:> field; + of_ordered_abelian_group_: ordered_abelian_group; + of_cotransitively_ordered_set_: cotransitively_ordered_set; + of_with1_: + cos_ordered_set of_cotransitively_ordered_set_ = + og_ordered_set of_ordered_abelian_group_; + of_with2: + og_abelian_group of_ordered_abelian_group_ = r_abelian_group of_field + }. + +lemma of_ordered_abelian_group: pre_ordered_field_ch0 → ordered_abelian_group. + intro F; + apply mk_ordered_abelian_group; + [ apply mk_pre_ordered_abelian_group; + [ apply (r_abelian_group F) + | apply (og_ordered_set (of_ordered_abelian_group_ F)) + | apply (eq_f ? ? carrier); + apply (of_with2 F) + ] + | + apply + (eq_rect' ? ? + (λG:abelian_group.λH:og_abelian_group (of_ordered_abelian_group_ F)=G. + is_ordered_abelian_group + (mk_pre_ordered_abelian_group G (of_ordered_abelian_group_ F) + (eq_f abelian_group Type carrier (of_ordered_abelian_group_ F) G + H))) + ? ? (of_with2 F)); + simplify; + apply (og_ordered_abelian_group_properties (of_ordered_abelian_group_ F)) + ] +qed. + +coercion cic:/matita/ordered_fields_ch0/of_ordered_abelian_group.con. + +(*CSC: I am not able to prove this since unfold is undone by coercion composition*) +axiom of_with1: + ∀G:pre_ordered_field_ch0. + cos_ordered_set (of_cotransitively_ordered_set_ G) = + og_ordered_set (of_ordered_abelian_group G). + +lemma of_cotransitively_ordered_set : pre_ordered_field_ch0 → cotransitively_ordered_set. + intro F; + apply mk_cotransitively_ordered_set; + [ apply (og_ordered_set F) + | apply + (eq_rect ? ? (λa:ordered_set.cotransitive (os_carrier a) (os_le a)) + ? ? (of_with1 F)); + apply cos_cotransitive + ] +qed. + +coercion cic:/matita/ordered_fields_ch0/of_cotransitively_ordered_set.con. + +record is_ordered_field_ch0 (F:pre_ordered_field_ch0) : Type \def + { of_mult_compat: ∀a,b:F. 0≤a → 0≤b → 0≤a*b; + of_weak_tricotomy : ∀a,b:F. a≠b → a≤b ∨ b≤a; + (* 0 characteristics *) + of_char0: ∀n. n > O → sum ? (plus F) 0 1 n ≠ 0 + }. + +record ordered_field_ch0 : Type \def + { of_pre_ordered_field_ch0:> pre_ordered_field_ch0; + of_ordered_field_properties:> is_ordered_field_ch0 of_pre_ordered_field_ch0 + }. + +(* +lemma eq_opp_x_times_opp_one_x: ∀F:ordered_field_ch0.∀x:F.-x = -1*x. + intros; + +lemma not_eq_x_zero_to_lt_zero_mult_x_x: + ∀F:ordered_field_ch0.∀x:F. x ≠ 0 → 0 < x * x. + intros; + elim (of_weak_tricotomy ? ? ? ? ? ? ? ? F ? ? H); + [ generalize in match (le_x_zero_to_le_zero_opp_x F ? H1); intro; + generalize in match (of_mult_compat ? ? ? ? ? ? ? ? F ? ? H2 H2); intro; +*) + +axiom lt_zero_to_lt_inv_zero: + ∀F:ordered_field_ch0.∀x:F.∀p:x≠0. lt F 0 x → lt F 0 (inv ? x p). + +alias symbol "lt" = "natural 'less than'". + +(* The ordering is not necessary. *) +axiom not_eq_sum_field_zero: ∀F:ordered_field_ch0.∀n. O ordered_field_ch0; + r_real_properties: is_real r_ordered_field_ch0 + }. + +definition lim: ∀R:real.∀f:nat→R.is_cauchy_seq ? f → R. + intros; + elim (r_complete ? (r_real_properties R) ? H); + exact a. +qed. + +definition max_seq: ∀R:real.∀x,y:R. nat → R. + intros (R x y); + elim (cos_cotransitive R 0 (inv ? (sum_field ? (S n)) ?) (x-y)); + [ apply x + | apply not_eq_sum_field_zero ; + unfold; + autobatch + | apply y + | apply lt_zero_to_le_inv_zero + ]. +qed. + +axiom daemon: False. + +theorem cauchy_max_seq: ∀R:real.∀x,y:R. is_cauchy_seq ? (max_seq ? x y). +elim daemon. +(* + intros; + unfold; + intros; + exists; [ exact m | ]; (* apply (ex_intro ? ? m); *) + intros; + unfold max_seq; + elim (of_cotransitive R 0 +(inv R (sum_field R (S N)) + (not_eq_sum_field_zero R (S N) (le_S_S O N (le_O_n N)))) (x-y) +(lt_zero_to_le_inv_zero R (S N) + (not_eq_sum_field_zero R (S N) (le_S_S O N (le_O_n N))))); + [ simplify; + elim (of_cotransitive R 0 +(inv R (1+sum R (plus R) 0 1 m) + (not_eq_sum_field_zero R (S m) (le_S_S O m (le_O_n m)))) (x-y) +(lt_zero_to_le_inv_zero R (S m) + (not_eq_sum_field_zero R (S m) (le_S_S O m (le_O_n m))))); + [ simplify; + rewrite > (plus_comm ? x (-x)); + rewrite > opp_inverse; + split; + [ apply (le_zero_x_to_le_opp_x_zero R ?); + apply lt_zero_to_le_inv_zero + | apply lt_zero_to_le_inv_zero + ] + | simplify; + split; + [ apply (or_transitive ? ? R ? 0); + [ apply (le_zero_x_to_le_opp_x_zero R ?) + | assumption + ] + | assumption + ] + ] + | simplify; + elim (of_cotransitive R 0 +(inv R (1+sum R (plus R) 0 1 m) + (not_eq_sum_field_zero R (S m) (le_S_S O m (le_O_n m)))) (x-y) +(lt_zero_to_le_inv_zero R (S m) + (not_eq_sum_field_zero R (S m) (le_S_S O m (le_O_n m))))); + [ simplify; + split; + [ elim daemon + | generalize in match (le_zero_x_to_le_opp_x_zero R ? t1); + intro; + unfold minus in H1; + rewrite > eq_opp_plus_plus_opp_opp in H1; + rewrite > eq_opp_opp_x_x in H1; + rewrite > plus_comm in H1; + apply (or_transitive ? ? R ? 0); + [ assumption + | apply lt_zero_to_le_inv_zero + ] + ] + | simplify; + rewrite > (plus_comm ? y (-y)); + rewrite > opp_inverse; + split; + [ elim daemon + | apply lt_zero_to_le_inv_zero + ] + ] + ]. + elim daemon.*) +qed. + +definition max: ∀R:real.R → R → R. + intros (R x y); + apply (lim R (max_seq R x y)); + apply cauchy_max_seq. +qed. + +definition abs \def λR:real.λx:R. max R x (-x). + +lemma comparison: + ∀R:real.∀f,g:nat→R. is_cauchy_seq ? f → is_cauchy_seq ? g → + (∀n:nat.f n ≤ g n) → lim ? f ? ≤ lim ? g ?. + [ assumption + | assumption + | intros; + elim daemon + ]. +qed. + +definition to_zero ≝ + λR:real.λn. + -(inv R (sum_field R (S n)) + (not_eq_sum_field_zero R (S n) (le_S_S O n (le_O_n n)))). + +axiom is_cauchy_seq_to_zero: ∀R:real. is_cauchy_seq ? (to_zero R). + +lemma technical1: ∀R:real.lim R (to_zero R) (is_cauchy_seq_to_zero R) = 0. + intros; + unfold lim; + elim daemon. +qed. + +lemma abs_x_ge_O: ∀R:real.∀x:R. 0 ≤ abs ? x. + intros; + unfold abs; + unfold max; + rewrite < technical1; + apply comparison; + intros; + unfold to_zero; + unfold max_seq; + elim + (cos_cotransitive R 0 +(inv R (sum_field R (S n)) + (not_eq_sum_field_zero R (S n) (le_S_S O n (le_O_n n)))) (x--x) +(lt_zero_to_le_inv_zero R (S n) + (not_eq_sum_field_zero R (S n) (le_S_S O n (le_O_n n))))); + [ simplify; + (* facile *) + elim daemon + | simplify; + (* facile *) + elim daemon + ]. +qed. diff --git a/matita/dama/attic/rings.ma b/matita/dama/attic/rings.ma new file mode 100644 index 000000000..2ea188847 --- /dev/null +++ b/matita/dama/attic/rings.ma @@ -0,0 +1,103 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/rings/". + +include "group.ma". + +record is_ring (G:abelian_group) (mult:G→G→G) (one:G) : Prop +≝ + { (* multiplicative monoid properties *) + mult_assoc_: associative ? mult; + one_neutral_left_: left_neutral ? mult one; + one_neutral_right_: right_neutral ? mult one; + (* ring properties *) + mult_plus_distr_left_: distributive_left ? mult (plus G); + mult_plus_distr_right_: distributive_right ? mult (plus G); + not_eq_zero_one_: (0 ≠ one) + }. + +record ring : Type \def + { r_abelian_group:> abelian_group; + mult: r_abelian_group → r_abelian_group → r_abelian_group; + one: r_abelian_group; + r_ring_properties: is_ring r_abelian_group mult one + }. + +theorem mult_assoc: ∀R:ring.associative ? (mult R). + intros; + apply (mult_assoc_ ? ? ? (r_ring_properties R)). +qed. + +theorem one_neutral_left: ∀R:ring.left_neutral ? (mult R) (one R). + intros; + apply (one_neutral_left_ ? ? ? (r_ring_properties R)). +qed. + +theorem one_neutral_right: ∀R:ring.right_neutral ? (mult R) (one R). + intros; + apply (one_neutral_right_ ? ? ? (r_ring_properties R)). +qed. + +theorem mult_plus_distr_left: ∀R:ring.distributive_left ? (mult R) (plus R). + intros; + apply (mult_plus_distr_left_ ? ? ? (r_ring_properties R)). +qed. + +theorem mult_plus_distr_right: ∀R:ring.distributive_right ? (mult R) (plus R). + intros; + apply (mult_plus_distr_right_ ? ? ? (r_ring_properties R)). +qed. + +theorem not_eq_zero_one: ∀R:ring.0 ≠ one R. + intros; + apply (not_eq_zero_one_ ? ? ? (r_ring_properties R)). +qed. + +interpretation "Ring mult" 'times a b = + (cic:/matita/rings/mult.con _ a b). + +notation "1" with precedence 89 +for @{ 'one }. + +interpretation "Ring one" 'one = + (cic:/matita/rings/one.con _). + +lemma eq_mult_zero_x_zero: ∀R:ring.∀x:R.0*x=0. + intros; + generalize in match (zero_neutral R 0); intro; + generalize in match (eq_f ? ? (λy.y*x) ? ? H); intro; clear H; + rewrite > mult_plus_distr_right in H1; + generalize in match (eq_f ? ? (λy.-(0*x)+y) ? ? H1); intro; clear H1; + rewrite < plus_assoc in H; + rewrite > opp_inverse in H; + rewrite > zero_neutral in H; + assumption. +qed. + +lemma eq_mult_x_zero_zero: ∀R:ring.∀x:R.x*0=0. +intros; +generalize in match (zero_neutral R 0); +intro; +generalize in match (eq_f ? ? (λy.x*y) ? ? H); intro; clear H; +(*CSC: qua funzionava prima della patch all'unificazione!*) +rewrite > (mult_plus_distr_left R) in H1; +generalize in match (eq_f ? ? (λy. (-(x*0)) +y) ? ? H1);intro; +clear H1; +rewrite < plus_assoc in H; +rewrite > opp_inverse in H; +rewrite > zero_neutral in H; +assumption. +qed. + diff --git a/matita/dama/attic/vector_spaces.ma b/matita/dama/attic/vector_spaces.ma new file mode 100644 index 000000000..1e29bee24 --- /dev/null +++ b/matita/dama/attic/vector_spaces.ma @@ -0,0 +1,151 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/vector_spaces/". + +include "attic/reals.ma". + +record is_vector_space (K: field) (G:abelian_group) (emult:K→G→G) : Prop +≝ + { vs_nilpotent: ∀v. emult 0 v = 0; + vs_neutral: ∀v. emult 1 v = v; + vs_distributive: ∀a,b,v. emult (a + b) v = (emult a v) + (emult b v); + vs_associative: ∀a,b,v. emult (a * b) v = emult a (emult b v) + }. + +record vector_space (K:field): Type \def +{ vs_abelian_group :> abelian_group; + emult: K → vs_abelian_group → vs_abelian_group; + vs_vector_space_properties :> is_vector_space ? vs_abelian_group emult +}. + +interpretation "Vector space external product" 'times a b = + (cic:/matita/vector_spaces/emult.con _ _ a b). + +record is_semi_norm (R:real) (V: vector_space R) (semi_norm:V→R) : Prop \def + { sn_positive: ∀x:V. zero R ≤ semi_norm x; + sn_omogeneous: ∀a:R.∀x:V. semi_norm (a*x) = (abs ? a) * semi_norm x; + sn_triangle_inequality: ∀x,y:V. semi_norm (x + y) ≤ semi_norm x + semi_norm y + }. + +theorem eq_semi_norm_zero_zero: + ∀R:real.∀V:vector_space R.∀semi_norm:V→R. + is_semi_norm ? ? semi_norm → + semi_norm 0 = 0. + intros; + (* facile *) + elim daemon. +qed. + +record is_norm (R:real) (V:vector_space R) (norm:V → R) : Prop ≝ + { n_semi_norm:> is_semi_norm ? ? norm; + n_properness: ∀x:V. norm x = 0 → x = 0 + }. + +record norm (R:real) (V:vector_space R) : Type ≝ + { n_function:1> V→R; + n_norm_properties: is_norm ? ? n_function + }. + +record is_semi_distance (R:real) (C:Type) (semi_d: C→C→R) : Prop ≝ + { sd_positive: ∀x,y:C. zero R ≤ semi_d x y; + sd_properness: ∀x:C. semi_d x x = 0; + sd_triangle_inequality: ∀x,y,z:C. semi_d x z ≤ semi_d x y + semi_d z y + }. + +record is_distance (R:real) (C:Type) (d:C→C→R) : Prop ≝ + { d_semi_distance:> is_semi_distance ? ? d; + d_properness: ∀x,y:C. d x y = 0 → x=y + }. + +record distance (R:real) (V:vector_space R) : Type ≝ + { d_function:2> V→V→R; + d_distance_properties: is_distance ? ? d_function + }. + +definition induced_distance_fun ≝ + λR:real.λV:vector_space R.λnorm:norm ? V. + λf,g:V.norm (f - g). + +theorem induced_distance_is_distance: + ∀R:real.∀V:vector_space R.∀norm:norm ? V. + is_distance ? ? (induced_distance_fun ? ? norm). +elim daemon.(* + intros; + apply mk_is_distance; + [ apply mk_is_semi_distance; + [ unfold induced_distance_fun; + intros; + apply sn_positive; + apply n_semi_norm; + apply (n_norm_properties ? ? norm) + | unfold induced_distance_fun; + intros; + unfold minus; + rewrite < plus_comm; + rewrite > opp_inverse; + apply eq_semi_norm_zero_zero; + apply n_semi_norm; + apply (n_norm_properties ? ? norm) + | unfold induced_distance_fun; + intros; + (* ??? *) + elim daemon + ] + | unfold induced_distance_fun; + intros; + generalize in match (n_properness ? ? norm ? ? H); + [ intro; + (* facile *) + elim daemon + | apply (n_norm_properties ? ? norm) + ] + ].*) +qed. + +definition induced_distance ≝ + λR:real.λV:vector_space R.λnorm:norm ? V. + mk_distance ? ? (induced_distance_fun ? ? norm) + (induced_distance_is_distance ? ? norm). + +definition tends_to : + ∀R:real.∀V:vector_space R.∀d:distance ? V.∀f:nat→V.∀l:V.Prop. +apply + (λR:real.λV:vector_space R.λd:distance ? V.λf:nat→V.λl:V. + ∀n:nat.∃m:nat.∀j:nat. m ≤ j → + d (f j) l ≤ inv R (sum_field ? (S n)) ?); + apply not_eq_sum_field_zero; + unfold; + autobatch. +qed. + +definition is_cauchy_seq : ∀R:real.\forall V:vector_space R. +\forall d:distance ? V.∀f:nat→V.Prop. + apply + (λR:real.λV: vector_space R. \lambda d:distance ? V. + \lambda f:nat→V. + ∀m:nat. + ∃n:nat.∀N. n ≤ N → + -(inv R (sum_field ? (S m)) ?) ≤ d (f N) (f n) ∧ + d (f N) (f n)≤ inv R (sum_field R (S m)) ?); + apply not_eq_sum_field_zero; + unfold; + autobatch. +qed. + +definition is_complete ≝ + λR:real.λV:vector_space R. + λd:distance ? V. + ∀f:nat→V. is_cauchy_seq ? ? d f→ + ex V (λl:V. tends_to ? ? d f l). diff --git a/matita/dama/classical_pointfree/ordered_sets.ma b/matita/dama/classical_pointfree/ordered_sets.ma new file mode 100644 index 000000000..5d9c2da67 --- /dev/null +++ b/matita/dama/classical_pointfree/ordered_sets.ma @@ -0,0 +1,424 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/classical_pointwise/ordered_sets/". + +include "excess.ma". + +record is_dedekind_sigma_complete (O:excess) : Type ≝ + { dsc_inf: ∀a:nat→O.∀m:O. is_lower_bound ? a m → ex ? (λs:O.is_inf O a s); + dsc_inf_proof_irrelevant: + ∀a:nat→O.∀m,m':O.∀p:is_lower_bound ? a m.∀p':is_lower_bound ? a m'. + (match dsc_inf a m p with [ ex_intro s _ ⇒ s ]) = + (match dsc_inf a m' p' with [ ex_intro s' _ ⇒ s' ]); + dsc_sup: ∀a:nat→O.∀m:O. is_upper_bound ? a m → ex ? (λs:O.is_sup O a s); + dsc_sup_proof_irrelevant: + ∀a:nat→O.∀m,m':O.∀p:is_upper_bound ? a m.∀p':is_upper_bound ? a m'. + (match dsc_sup a m p with [ ex_intro s _ ⇒ s ]) = + (match dsc_sup a m' p' with [ ex_intro s' _ ⇒ s' ]) + }. + +record dedekind_sigma_complete_ordered_set : Type ≝ + { dscos_ordered_set:> excess; + dscos_dedekind_sigma_complete_properties:> + is_dedekind_sigma_complete dscos_ordered_set + }. + +definition inf: + ∀O:dedekind_sigma_complete_ordered_set. + bounded_below_sequence O → O. + intros; + elim + (dsc_inf O (dscos_dedekind_sigma_complete_properties O) b); + [ apply a + | apply (lower_bound ? b) + | apply lower_bound_is_lower_bound + ] +qed. + +lemma inf_is_inf: + ∀O:dedekind_sigma_complete_ordered_set. + ∀a:bounded_below_sequence O. + is_inf ? a (inf ? a). + intros; + unfold inf; + simplify; + elim (dsc_inf O (dscos_dedekind_sigma_complete_properties O) a +(lower_bound O a) (lower_bound_is_lower_bound O a)); + simplify; + assumption. +qed. + +lemma inf_proof_irrelevant: + ∀O:dedekind_sigma_complete_ordered_set. + ∀a,a':bounded_below_sequence O. + bbs_seq ? a = bbs_seq ? a' → + inf ? a = inf ? a'. + intros 3; + elim a 0; + elim a'; + simplify in H; + generalize in match i1; + clear i1; + rewrite > H; + intro; + simplify; + rewrite < (dsc_inf_proof_irrelevant O O f (ib_lower_bound ? f i) + (ib_lower_bound ? f i2) (ib_lower_bound_is_lower_bound ? f i) + (ib_lower_bound_is_lower_bound ? f i2)); + reflexivity. +qed. + +definition sup: + ∀O:dedekind_sigma_complete_ordered_set. + bounded_above_sequence O → O. + intros; + elim + (dsc_sup O (dscos_dedekind_sigma_complete_properties O) b); + [ apply a + | apply (upper_bound ? b) + | apply upper_bound_is_upper_bound + ]. +qed. + +lemma sup_is_sup: + ∀O:dedekind_sigma_complete_ordered_set. + ∀a:bounded_above_sequence O. + is_sup ? a (sup ? a). + intros; + unfold sup; + simplify; + elim (dsc_sup O (dscos_dedekind_sigma_complete_properties O) a +(upper_bound O a) (upper_bound_is_upper_bound O a)); + simplify; + assumption. +qed. + +lemma sup_proof_irrelevant: + ∀O:dedekind_sigma_complete_ordered_set. + ∀a,a':bounded_above_sequence O. + bas_seq ? a = bas_seq ? a' → + sup ? a = sup ? a'. + intros 3; + elim a 0; + elim a'; + simplify in H; + generalize in match i1; + clear i1; + rewrite > H; + intro; + simplify; + rewrite < (dsc_sup_proof_irrelevant O O f (ib_upper_bound ? f i2) + (ib_upper_bound ? f i) (ib_upper_bound_is_upper_bound ? f i2) + (ib_upper_bound_is_upper_bound ? f i)); + reflexivity. +qed. + +axiom daemon: False. + +theorem inf_le_sup: + ∀O:dedekind_sigma_complete_ordered_set. + ∀a:bounded_sequence O. inf ? a ≤ sup ? a. + intros (O'); + apply (or_transitive ? ? O' ? (a O)); + [ elim daemon (*apply (inf_lower_bound ? ? ? ? (inf_is_inf ? ? a))*) + | elim daemon (*apply (sup_upper_bound ? ? ? ? (sup_is_sup ? ? a))*) + ]. +qed. + +lemma inf_respects_le: + ∀O:dedekind_sigma_complete_ordered_set. + ∀a:bounded_below_sequence O.∀m:O. + is_upper_bound ? a m → inf ? a ≤ m. + intros (O'); + apply (or_transitive ? ? O' ? (sup ? (mk_bounded_sequence ? a ? ?))); + [ apply (bbs_is_bounded_below ? a) + | apply (mk_is_bounded_above ? ? m H) + | apply inf_le_sup + | apply + (sup_least_upper_bound ? ? ? + (sup_is_sup ? (mk_bounded_sequence O' a a + (mk_is_bounded_above O' a m H)))); + assumption + ]. +qed. + +definition is_sequentially_monotone ≝ + λO:excess.λf:O→O. + ∀a:nat→O.∀p:is_increasing ? a. + is_increasing ? (λi.f (a i)). + +record is_order_continuous + (O:dedekind_sigma_complete_ordered_set) (f:O→O) : Prop +≝ + { ioc_is_sequentially_monotone: is_sequentially_monotone ? f; + ioc_is_upper_bound_f_sup: + ∀a:bounded_above_sequence O. + is_upper_bound ? (λi.f (a i)) (f (sup ? a)); + ioc_respects_sup: + ∀a:bounded_above_sequence O. + is_increasing ? a → + f (sup ? a) = + sup ? (mk_bounded_above_sequence ? (λi.f (a i)) + (mk_is_bounded_above ? ? (f (sup ? a)) + (ioc_is_upper_bound_f_sup a))); + ioc_is_lower_bound_f_inf: + ∀a:bounded_below_sequence O. + is_lower_bound ? (λi.f (a i)) (f (inf ? a)); + ioc_respects_inf: + ∀a:bounded_below_sequence O. + is_decreasing ? a → + f (inf ? a) = + inf ? (mk_bounded_below_sequence ? (λi.f (a i)) + (mk_is_bounded_below ? ? (f (inf ? a)) + (ioc_is_lower_bound_f_inf a))) + }. + +theorem tail_inf_increasing: + ∀O:dedekind_sigma_complete_ordered_set. + ∀a:bounded_below_sequence O. + let y ≝ λi.mk_bounded_below_sequence ? (λj.a (i+j)) ? in + let x ≝ λi.inf ? (y i) in + is_increasing ? x. + [ apply (mk_is_bounded_below ? ? (ib_lower_bound ? a a)); + simplify; + intro; + apply (ib_lower_bound_is_lower_bound ? a a) + | intros; + unfold is_increasing; + intro; + unfold x in ⊢ (? ? ? %); + apply (inf_greatest_lower_bound ? ? ? (inf_is_inf ? (y (S n)))); + change with (is_lower_bound ? (y (S n)) (inf ? (y n))); + unfold is_lower_bound; + intro; + generalize in match (inf_lower_bound ? ? ? (inf_is_inf ? (y n)) (S n1)); + (*CSC: coercion per FunClass inserita a mano*) + suppose (inf ? (y n) ≤ bbs_seq ? (y n) (S n1)) (H); + cut (bbs_seq ? (y n) (S n1) = bbs_seq ? (y (S n)) n1); + [ rewrite < Hcut; + assumption + | unfold y; + simplify; + autobatch paramodulation library + ] + ]. +qed. + +definition is_liminf: + ∀O:dedekind_sigma_complete_ordered_set. + bounded_below_sequence O → O → Prop. + intros; + apply + (is_sup ? (λi.inf ? (mk_bounded_below_sequence ? (λj.b (i+j)) ?)) t); + apply (mk_is_bounded_below ? ? (ib_lower_bound ? b b)); + simplify; + intros; + apply (ib_lower_bound_is_lower_bound ? b b). +qed. + +definition liminf: + ∀O:dedekind_sigma_complete_ordered_set. + bounded_sequence O → O. + intros; + apply + (sup ? + (mk_bounded_above_sequence ? + (λi.inf ? + (mk_bounded_below_sequence ? + (λj.b (i+j)) ?)) ?)); + [ apply (mk_is_bounded_below ? ? (ib_lower_bound ? b b)); + simplify; + intros; + apply (ib_lower_bound_is_lower_bound ? b b) + | apply (mk_is_bounded_above ? ? (ib_upper_bound ? b b)); + unfold is_upper_bound; + intro; + change with + (inf O + (mk_bounded_below_sequence O (\lambda j:nat.b (n+j)) + (mk_is_bounded_below O (\lambda j:nat.b (n+j)) (ib_lower_bound O b b) + (\lambda j:nat.ib_lower_bound_is_lower_bound O b b (n+j)))) +\leq ib_upper_bound O b b); + apply (inf_respects_le O); + simplify; + intro; + apply (ib_upper_bound_is_upper_bound ? b b) + ]. +qed. + + +definition reverse_dedekind_sigma_complete_ordered_set: + dedekind_sigma_complete_ordered_set → dedekind_sigma_complete_ordered_set. + intros; + apply mk_dedekind_sigma_complete_ordered_set; + [ apply (reverse_ordered_set d) + | elim daemon + (*apply mk_is_dedekind_sigma_complete; + [ intros; + elim (dsc_sup ? ? d a m) 0; + [ generalize in match H; clear H; + generalize in match m; clear m; + elim d; + simplify in a1; + simplify; + change in a1 with (Type_OF_ordered_set ? (reverse_ordered_set ? o)); + apply (ex_intro ? ? a1); + simplify in H1; + change in m with (Type_OF_ordered_set ? o); + apply (is_sup_to_reverse_is_inf ? ? ? ? H1) + | generalize in match H; clear H; + generalize in match m; clear m; + elim d; + simplify; + change in t with (Type_OF_ordered_set ? o); + simplify in t; + apply reverse_is_lower_bound_is_upper_bound; + assumption + ] + | apply is_sup_reverse_is_inf; + | apply m + | + ]*) + ]. +qed. + +definition reverse_bounded_sequence: + ∀O:dedekind_sigma_complete_ordered_set. + bounded_sequence O → + bounded_sequence (reverse_dedekind_sigma_complete_ordered_set O). + intros; + apply mk_bounded_sequence; + [ apply bs_seq; + unfold reverse_dedekind_sigma_complete_ordered_set; + simplify; + elim daemon + | elim daemon + | elim daemon + ]. +qed. + +definition limsup ≝ + λO:dedekind_sigma_complete_ordered_set. + λa:bounded_sequence O. + liminf (reverse_dedekind_sigma_complete_ordered_set O) + (reverse_bounded_sequence O a). + +notation "hvbox(〈a〉)" + non associative with precedence 45 +for @{ 'hide_everything_but $a }. + +interpretation "mk_bounded_above_sequence" 'hide_everything_but a += (cic:/matita/ordered_set/bounded_above_sequence.ind#xpointer(1/1/1) _ _ a _). + +interpretation "mk_bounded_below_sequence" 'hide_everything_but a += (cic:/matita/ordered_set/bounded_below_sequence.ind#xpointer(1/1/1) _ _ a _). + +theorem eq_f_sup_sup_f: + ∀O':dedekind_sigma_complete_ordered_set. + ∀f:O'→O'. ∀H:is_order_continuous ? f. + ∀a:bounded_above_sequence O'. + ∀p:is_increasing ? a. + f (sup ? a) = sup ? (mk_bounded_above_sequence ? (λi.f (a i)) ?). + [ apply (mk_is_bounded_above ? ? (f (sup ? a))); + apply ioc_is_upper_bound_f_sup; + assumption + | intros; + apply ioc_respects_sup; + assumption + ]. +qed. + +theorem eq_f_sup_sup_f': + ∀O':dedekind_sigma_complete_ordered_set. + ∀f:O'→O'. ∀H:is_order_continuous ? f. + ∀a:bounded_above_sequence O'. + ∀p:is_increasing ? a. + ∀p':is_bounded_above ? (λi.f (a i)). + f (sup ? a) = sup ? (mk_bounded_above_sequence ? (λi.f (a i)) p'). + intros; + rewrite > (eq_f_sup_sup_f ? f H a H1); + apply sup_proof_irrelevant; + reflexivity. +qed. + +theorem eq_f_liminf_sup_f_inf: + ∀O':dedekind_sigma_complete_ordered_set. + ∀f:O'→O'. ∀H:is_order_continuous ? f. + ∀a:bounded_sequence O'. + let p1 := ? in + f (liminf ? a) = + sup ? + (mk_bounded_above_sequence ? + (λi.f (inf ? + (mk_bounded_below_sequence ? + (λj.a (i+j)) + ?))) + p1). + [ apply (mk_is_bounded_below ? ? (ib_lower_bound ? a a)); + simplify; + intro; + apply (ib_lower_bound_is_lower_bound ? a a) + | apply (mk_is_bounded_above ? ? (f (sup ? a))); + unfold is_upper_bound; + intro; + apply (or_transitive ? ? O' ? (f (a n))); + [ generalize in match (ioc_is_lower_bound_f_inf ? ? H); + intro H1; + simplify in H1; + rewrite > (plus_n_O n) in ⊢ (? ? ? (? (? ? ? %))); + apply (H1 (mk_bounded_below_sequence O' (\lambda j:nat.a (n+j)) +(mk_is_bounded_below O' (\lambda j:nat.a (n+j)) (ib_lower_bound O' a a) + (\lambda j:nat.ib_lower_bound_is_lower_bound O' a a (n+j)))) O); + | elim daemon (*apply (ioc_is_upper_bound_f_sup ? ? ? H)*) + ] + | intros; + unfold liminf; + clearbody p1; + generalize in match (\lambda n:nat +.inf_respects_le O' + (mk_bounded_below_sequence O' (\lambda j:nat.a (plus n j)) + (mk_is_bounded_below O' (\lambda j:nat.a (plus n j)) + (ib_lower_bound O' a a) + (\lambda j:nat.ib_lower_bound_is_lower_bound O' a a (plus n j)))) + (ib_upper_bound O' a a) + (\lambda n1:nat.ib_upper_bound_is_upper_bound O' a a (plus n n1))); + intro p2; + apply (eq_f_sup_sup_f' ? f H (mk_bounded_above_sequence O' +(\lambda i:nat + .inf O' + (mk_bounded_below_sequence O' (\lambda j:nat.a (plus i j)) + (mk_is_bounded_below O' (\lambda j:nat.a (plus i j)) + (ib_lower_bound O' a a) + (\lambda n:nat.ib_lower_bound_is_lower_bound O' a a (plus i n))))) +(mk_is_bounded_above O' + (\lambda i:nat + .inf O' + (mk_bounded_below_sequence O' (\lambda j:nat.a (plus i j)) + (mk_is_bounded_below O' (\lambda j:nat.a (plus i j)) + (ib_lower_bound O' a a) + (\lambda n:nat.ib_lower_bound_is_lower_bound O' a a (plus i n))))) + (ib_upper_bound O' a a) p2))); + unfold bas_seq; + change with + (is_increasing ? (\lambda i:nat +.inf O' + (mk_bounded_below_sequence O' (\lambda j:nat.a (plus i j)) + (mk_is_bounded_below O' (\lambda j:nat.a (plus i j)) + (ib_lower_bound O' a a) + (\lambda n:nat.ib_lower_bound_is_lower_bound O' a a (plus i n)))))); + apply tail_inf_increasing + ]. +qed. + diff --git a/matita/dama/classical_pointfree/ordered_sets2.ma b/matita/dama/classical_pointfree/ordered_sets2.ma new file mode 100644 index 000000000..d85a02cf4 --- /dev/null +++ b/matita/dama/classical_pointfree/ordered_sets2.ma @@ -0,0 +1,127 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/classical_pointfree/ordered_sets2". + +include "classical_pointfree/ordered_sets.ma". + +theorem le_f_inf_inf_f: + ∀O':dedekind_sigma_complete_ordered_set. + ∀f:O'→O'. ∀H:is_order_continuous ? f. + ∀a:bounded_below_sequence O'. + let p := ? in + f (inf ? a) ≤ inf ? (mk_bounded_below_sequence ? (λi. f (a i)) p). + [ apply mk_is_bounded_below; + [2: apply ioc_is_lower_bound_f_inf; + assumption + | skip + ] + | intros; + clearbody p; + apply (inf_greatest_lower_bound ? ? ? (inf_is_inf ? ?)); + simplify; + intro; + letin b := (λi.match i with [ O ⇒ inf ? a | S _ ⇒ a n]); + change with (f (b O) ≤ f (b (S O))); + apply (ioc_is_sequentially_monotone ? ? H); + simplify; + clear b; + intro; + elim n1; simplify; + [ apply (inf_lower_bound ? ? ? (inf_is_inf ? ?)); + | apply (or_reflexive O' ? (dscos_ordered_set O')) + ] + ]. +qed. + +theorem le_to_le_sup_sup: + ∀O':dedekind_sigma_complete_ordered_set. + ∀a,b:bounded_above_sequence O'. + (∀i.a i ≤ b i) → sup ? a ≤ sup ? b. + intros; + apply (sup_least_upper_bound ? ? ? (sup_is_sup ? a)); + unfold; + intro; + apply (or_transitive ? ? O'); + [2: apply H + | skip + | apply (sup_upper_bound ? ? ? (sup_is_sup ? b)) + ]. +qed. + +interpretation "mk_bounded_sequence" 'hide_everything_but a += (cic:/matita/ordered_set/bounded_sequence.ind#xpointer(1/1/1) _ _ a _ _). + +lemma reduce_bas_seq: + ∀O:ordered_set.∀a:nat→O.∀p.∀i. + bas_seq ? (mk_bounded_above_sequence ? a p) i = a i. + intros; + reflexivity. +qed. + +(*lemma reduce_bbs_seq: + ∀C.∀O:ordered_set C.∀a:nat→O.∀p.∀i. + bbs_seq ? ? (mk_bounded_below_sequence ? ? a p) i = a i. + intros; + reflexivity. +qed.*) + +axiom inf_extensional: + ∀O:dedekind_sigma_complete_ordered_set. + ∀a,b:bounded_below_sequence O. + (∀i.a i = b i) → inf ? a = inf O b. + +lemma eq_to_le: ∀O:ordered_set.∀x,y:O.x=y → x ≤ y. + intros; + rewrite > H; + apply (or_reflexive ? ? O). +qed. + +theorem fatou: + ∀O':dedekind_sigma_complete_ordered_set. + ∀f:O'→O'. ∀H:is_order_continuous ? f. + ∀a:bounded_sequence O'. + let pb := ? in + let pa := ? in + f (liminf ? a) ≤ liminf ? (mk_bounded_sequence ? (λi. f (a i)) pb pa). + [ letin bas ≝ (bounded_above_sequence_of_bounded_sequence ? a); + apply mk_is_bounded_above; + [2: apply (ioc_is_upper_bound_f_sup ? ? H bas) + | skip + ] + | letin bbs ≝ (bounded_below_sequence_of_bounded_sequence ? a); + apply mk_is_bounded_below; + [2: apply (ioc_is_lower_bound_f_inf ? ? H bbs) + | skip + ] + | intros; + rewrite > eq_f_liminf_sup_f_inf in ⊢ (? ? % ?); + [ unfold liminf; + apply le_to_le_sup_sup; + intro; + rewrite > reduce_bas_seq; + rewrite > reduce_bas_seq; + apply (or_transitive ? ? O'); + [2: apply le_f_inf_inf_f; + assumption + | skip + | apply eq_to_le; + apply inf_extensional; + intro; + reflexivity + ] + | assumption + ] + ]. +qed. diff --git a/matita/dama/classical_pointwise/sets.ma b/matita/dama/classical_pointwise/sets.ma new file mode 100644 index 000000000..ec6a1c774 --- /dev/null +++ b/matita/dama/classical_pointwise/sets.ma @@ -0,0 +1,102 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/sets/". + +include "nat/nat.ma". + +definition set ≝ λX:Type.X → Prop. + +definition member_of : ∀X.set X → X → Prop≝ λX.λA:set X.λx.A x. + +notation "hvbox(x break ∈ A)" with precedence 60 +for @{ 'member_of $x $A }. + +interpretation "Member of" 'member_of x A = + (cic:/matita/sets/member_of.con _ A x). + +notation "hvbox(x break ∉ A)" with precedence 60 +for @{ 'not_member_of $x $A }. + +interpretation "Not member of" 'not_member_of x A = + (cic:/matita/logic/connectives/Not.con + (cic:/matita/sets/member_of.con _ A x)). + +definition emptyset : ∀X.set X ≝ λX:Type.λx:X.False. + +notation "∅︀" with precedence 100 for @{ 'emptyset }. + +interpretation "Emptyset" 'emptyset = + (cic:/matita/sets/emptyset.con _). + +definition subset: ∀X. set X → set X → Prop≝ λX.λA,B:set X.∀x. x ∈ A → x ∈ B. + +notation "hvbox(A break ⊆ B)" with precedence 60 +for @{ 'subset $A $B }. + +interpretation "Subset" 'subset A B = + (cic:/matita/sets/subset.con _ A B). + +definition intersection: ∀X. set X → set X → set X ≝ + λX.λA,B:set X.λx. x ∈ A ∧ x ∈ B. + +notation "hvbox(A break ∩ B)" with precedence 70 +for @{ 'intersection $A $B }. + +interpretation "Intersection" 'intersection A B = + (cic:/matita/sets/intersection.con _ A B). + +definition union: ∀X. set X → set X → set X ≝ λX.λA,B:set X.λx. x ∈ A ∨ x ∈ B. + +notation "hvbox(A break ∪ B)" with precedence 65 +for @{ 'union $A $B }. + +interpretation "Union" 'union A B = + (cic:/matita/sets/union.con _ A B). + +definition seq ≝ λX:Type.nat → X. + +definition nth ≝ λX.λA:seq X.λi.A i. + +notation "hvbox(A \sub i)" with precedence 100 +for @{ 'nth $A $i }. + +interpretation "nth" 'nth A i = + (cic:/matita/sets/nth.con _ A i). + +definition countable_union: ∀X. seq (set X) → set X ≝ + λX.λA:seq (set X).λx.∃j.x ∈ A \sub j. + +notation "∪ \sub (ident i opt (: ty)) B" with precedence 65 +for @{ 'big_union ${default @{(λ${ident i}:$ty.$B)} @{(λ${ident i}.$B)}}}. + +interpretation "countable_union" 'big_union η.t = + (cic:/matita/sets/countable_union.con _ t). + +definition complement: ∀X. set X \to set X ≝ λX.λA:set X.λx. x ∉ A. + +notation "A \sup 'c'" with precedence 100 +for @{ 'complement $A }. + +interpretation "Complement" 'complement A = + (cic:/matita/sets/complement.con _ A). + +definition inverse_image: ∀X,Y.∀f: X → Y.set Y → set X ≝ + λX,Y,f,B,x. f x ∈ B. + +notation "hvbox(f \sup (-1))" with precedence 100 +for @{ 'finverse $f }. + +interpretation "Inverse image" 'finverse f = + (cic:/matita/sets/inverse_image.con _ _ f). \ No newline at end of file diff --git a/matita/dama/classical_pointwise/sigma_algebra.ma b/matita/dama/classical_pointwise/sigma_algebra.ma new file mode 100644 index 000000000..21db34e38 --- /dev/null +++ b/matita/dama/classical_pointwise/sigma_algebra.ma @@ -0,0 +1,40 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/sigma_algebra/". + +include "classical_pointwise/topology.ma". + +record is_sigma_algebra (X:Type) (A: set X) (M: set (set X)) : Prop ≝ + { siga_subset: ∀B.B ∈ M → B ⊆ A; + siga_full: A ∈ M; + siga_compl: ∀B.B ∈ M → B \sup c ∈ M; + siga_enumerable_union: + ∀B:seq (set X).(∀i.(B \sub i) ∈ M) → (∪ \sub i B \sub i) ∈ M + }. + +record sigma_algebra : Type ≝ + { siga_carrier:> Type; + siga_domain:> set siga_carrier; + M: set (set siga_carrier); + siga_is_sigma_algebra:> is_sigma_algebra ? siga_domain M + }. + +(*definition is_measurable_map ≝ + λX:sigma_algebra.λY:topological_space.λf:X → Y. + ∀V. V ∈ O Y → f \sup -1 V ∈ M X.*) +definition is_measurable_map ≝ + λX:sigma_algebra.λY:topological_space.λf:X → Y. + ∀V. V ∈ O Y → inverse_image ? ? f V ∈ M X. + diff --git a/matita/dama/classical_pointwise/topology.ma b/matita/dama/classical_pointwise/topology.ma new file mode 100644 index 000000000..c5ba9bbd6 --- /dev/null +++ b/matita/dama/classical_pointwise/topology.ma @@ -0,0 +1,45 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/topology/". + +include "classical_pointwise/sets.ma". + +record is_topology (X) (A: set X) (O: set (set X)) : Prop ≝ + { top_subset: ∀B. B ∈ O → B ⊆ A; + top_empty: ∅︀ ∈ O; + top_full: A ∈ O; + top_intersection: ∀B,C. B ∈ O → C ∈ O → B ∩ C ∈ O; + top_countable_union: + ∀B.(∀i.(B \sub i) ∈ O) → (∪ \sub i (B \sub i)) ∈ O + }. + +record topological_space : Type ≝ + { top_carrier:> Type; + top_domain:> set top_carrier; + O: set (set top_carrier); + top_is_topological_space:> is_topology ? top_domain O + }. + +(*definition is_continuous_map ≝ + λX,Y: topological_space.λf: X → Y. + ∀V. V ∈ O Y → (f \sup -1) V ∈ O X.*) +definition is_continuous_map ≝ + λX,Y: topological_space.λf: X → Y. + ∀V. V ∈ O Y → inverse_image ? ? f V ∈ O X. + +record continuous_map (X,Y: topological_space) : Type ≝ + { cm_f:> X → Y; + cm_is_continuous_map: is_continuous_map ? ? cm_f + }. diff --git a/matita/dama/constructive_connectives.ma b/matita/dama/constructive_connectives.ma new file mode 100644 index 000000000..8518d7ede --- /dev/null +++ b/matita/dama/constructive_connectives.ma @@ -0,0 +1,53 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/constructive_connectives/". + +inductive Or (A,B:Type) : Type ≝ + Left : A → Or A B + | Right : B → Or A B. + +interpretation "constructive or" 'or x y = + (cic:/matita/constructive_connectives/Or.ind#xpointer(1/1) x y). + +inductive And (A,B:Type) : Type ≝ + | Conj : A → B → And A B. + +interpretation "constructive and" 'and x y = + (cic:/matita/constructive_connectives/And.ind#xpointer(1/1) x y). + +inductive exT (A:Type) (P:A→Type) : Type ≝ + ex_introT: ∀w:A. P w → exT A P. + +inductive ex (A:Type) (P:A→Prop) : Type ≝ + ex_intro: ∀w:A. P w → ex A P. + +(* +notation < "hvbox(Σ ident i opt (: ty) break . p)" + right associative with precedence 20 +for @{ 'sigma ${default + @{\lambda ${ident i} : $ty. $p)} + @{\lambda ${ident i} . $p}}}. +*) + +interpretation "constructive exists" 'exists \eta.x = + (cic:/matita/constructive_connectives/ex.ind#xpointer(1/1) _ x). +interpretation "constructive exists (Type)" 'exists \eta.x = + (cic:/matita/constructive_connectives/exT.ind#xpointer(1/1) _ x). + +alias id "False" = "cic:/matita/logic/connectives/False.ind#xpointer(1/1)". +definition Not ≝ λx:Type.x → False. + +interpretation "constructive not" 'not x = + (cic:/matita/constructive_connectives/Not.con x). diff --git a/matita/dama/constructive_higher_order_relations.ma b/matita/dama/constructive_higher_order_relations.ma new file mode 100644 index 000000000..789c7c9c5 --- /dev/null +++ b/matita/dama/constructive_higher_order_relations.ma @@ -0,0 +1,50 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/constructive_higher_order_relations". + +include "constructive_connectives.ma". + +definition cotransitive ≝ + λC:Type.λlt:C→C→Type.∀x,y,z:C. lt x y → lt x z ∨ lt z y. + +definition coreflexive ≝ λC:Type.λlt:C→C→Type. ∀x:C. ¬ (lt x x). + +definition antisymmetric ≝ + λC:Type.λle:C→C→Type.λeq:C→C→Type.∀x,y:C.le x y → le y x → eq x y. + +definition symmetric ≝ + λC:Type.λle:C→C→Type.∀x,y:C.le x y → le y x. + +definition transitive ≝ + λC:Type.λle:C→C→Type.∀x,y,z:C.le x y → le y z → le x z. + +definition associative ≝ + λC:Type.λop:C→C→C.λeq:C→C→Type.∀x,y,z. eq (op x (op y z)) (op (op x y) z). + +definition commutative ≝ + λC:Type.λop:C→C→C.λeq:C→C→Type.∀x,y. eq (op x y) (op y x). + +alias id "antisymmetric" = "cic:/matita/higher_order_defs/relations/antisymmetric.con". +theorem antisimmetric_to_cotransitive_to_transitive: + ∀C:Type.∀le:C→C→Prop. antisymmetric ? le → cotransitive ? le → transitive ? le. +intros (T f Af cT); unfold transitive; intros (x y z fxy fyz); +lapply (cT ??z fxy) as H; cases H; [assumption] cases (Af ? ? fyz H1); +qed. + +lemma Or_symmetric: symmetric ? Or. +unfold; intros (x y H); cases H; [right|left] assumption; +qed. + + \ No newline at end of file diff --git a/matita/dama/constructive_pointfree/lebesgue.ma b/matita/dama/constructive_pointfree/lebesgue.ma new file mode 100644 index 000000000..766412819 --- /dev/null +++ b/matita/dama/constructive_pointfree/lebesgue.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/lebesgue/". + +include "metric_lattice.ma". +include "sequence.ma". +include "constructive_connectives.ma". + +(* Section 3.2 *) + +(* 3.21 *) + + +(* 3.17 *) + + +(* 3.20 *) +lemma uniq_sup: ∀O:ogroup.∀s:sequence O.∀x,y:O. is_sup ? s x → is_sup ? s y → x ≈ y. +intros; \ No newline at end of file diff --git a/matita/dama/divisible_group.ma b/matita/dama/divisible_group.ma new file mode 100644 index 000000000..6830ef4e1 --- /dev/null +++ b/matita/dama/divisible_group.ma @@ -0,0 +1,99 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/divisible_group/". + +include "nat/orders.ma". +include "group.ma". + +let rec gpow (G : abelian_group) (x : G) (n : nat) on n : G ≝ + match n with [ O ⇒ 0 | S m ⇒ x + gpow ? x m]. + +interpretation "additive abelian group pow" 'times n x = + (cic:/matita/divisible_group/gpow.con _ x n). + +record dgroup : Type ≝ { + dg_carr:> abelian_group; + dg_prop: ∀x:dg_carr.∀n:nat.∃y.S n * y ≈ x +}. + +lemma divide: ∀G:dgroup.G → nat → G. +intros (G x n); cases (dg_prop G x n); apply w; +qed. + +interpretation "divisible group divide" 'divide x n = + (cic:/matita/divisible_group/divide.con _ x n). + +lemma divide_divides: + ∀G:dgroup.∀x:G.∀n. S n * (x / n) ≈ x. +intro G; cases G; unfold divide; intros (x n); simplify; +cases (f x n); simplify; exact H; +qed. + +lemma feq_mul: ∀G:dgroup.∀x,y:G.∀n.x≈y → n * x ≈ n * y. +intros (G x y n H); elim n; [apply eq_reflexive] +simplify; apply (Eq≈ (x + (n1 * y)) H1); +apply (Eq≈ (y+n1*y) H (eq_reflexive ??)); +qed. + +lemma div1: ∀G:dgroup.∀x:G.x/O ≈ x. +intro G; cases G; unfold divide; intros; simplify; +cases (f x O); simplify; simplify in H; intro; apply H; +apply (ap_rewl ???? (plus_comm ???)); +apply (ap_rewl ???w (zero_neutral ??)); assumption; +qed. + +lemma apmul_ap: ∀G:dgroup.∀x,y:G.∀n.S n * x # S n * y → x # y. +intros 4 (G x y n); elim n; [2: + simplify in a; + cases (applus ????? a); [assumption] + apply f; assumption;] +apply (plus_cancr_ap ??? 0); assumption; +qed. + +lemma plusmul: ∀G:dgroup.∀x,y:G.∀n.n * (x+y) ≈ n * x + n * y. +intros (G x y n); elim n; [ + simplify; apply (Eq≈ 0 ? (zero_neutral ? 0)); apply eq_reflexive] +simplify; apply eq_sym; apply (Eq≈ (x+y+(n1*x+n1*y))); [ + apply (Eq≈ (x+(n1*x+(y+(n1*y))))); [ + apply eq_sym; apply plus_assoc;] + apply (Eq≈ (x+((n1*x+y+(n1*y))))); [ + apply feq_plusl; apply plus_assoc;] + apply (Eq≈ (x+(y+n1*x+n1*y))); [ + apply feq_plusl; apply feq_plusr; apply plus_comm;] + apply (Eq≈ (x+(y+(n1*x+n1*y)))); [ + apply feq_plusl; apply eq_sym; apply plus_assoc;] + apply plus_assoc;] +apply feq_plusl; apply eq_sym; assumption; +qed. + +lemma mulzero: ∀G:dgroup.∀n.n*0 ≈ 0. [2: apply dg_carr; apply G] +intros; elim n; [simplify; apply eq_reflexive] +simplify; apply (Eq≈ ? (zero_neutral ??)); assumption; +qed. + +let rec gpowS (G : abelian_group) (x : G) (n : nat) on n : G ≝ + match n with [ O ⇒ x | S m ⇒ gpowS ? x m + x]. + +lemma gpowS_gpow: ∀G:dgroup.∀e:G.∀n. S n * e ≈ gpowS ? e n. +intros (G e n); elim n; simplify; [ + apply (Eq≈ ? (plus_comm ???));apply zero_neutral] +apply (Eq≈ ?? (plus_comm ???)); +apply (Eq≈ (e+S n1*e) ? H); clear H; simplify; apply eq_reflexive; +qed. + +lemma divpow: ∀G:dgroup.∀e:G.∀n. e ≈ gpowS ? (e/n) n. +intros (G e n); apply (Eq≈ ?? (gpowS_gpow ?(e/n) n)); +apply eq_sym; apply divide_divides; +qed. diff --git a/matita/dama/doc/DIMOSTRAZIONE b/matita/dama/doc/DIMOSTRAZIONE new file mode 100644 index 000000000..197c3ff97 --- /dev/null +++ b/matita/dama/doc/DIMOSTRAZIONE @@ -0,0 +1,126 @@ +############### Costruttivizzazione di Fremlin ###################### + +Prerequisiti: + 1. definizione di exceeds + 2. definizione di <= in termini di < (sui reali) + 2. definizione di sup forte (sui reali) + +======================================== + +Lemma: liminf f a_n <= limsup f a_n +Per definizione di <= dobbiamo dimostrare: + ~(limsup f a_n < liminf f a_n) +Supponiamo limsup f a_n < liminf f a_n. +Ovvero inf_n sup_{k>n} f a_k < sup_m inf_{h>m} f a_h +? Quindi esiste un l tale che + inf_n sup_{k>n} f a_k + l/2 = sup_m inf_{h>m} f a_h - l/2 +? Per definizione di inf forte abbiamo + esiste un n' tale che + sup_{k>n'} f a_k < inf_n sup_{k>n} + l + = sup_m inf_{h>m} f a_h - l/2 +? Per definizione di sup forte abbiamo + esiste un n'' tale che + sup_{k>n'} f a_k < sup_m inf_{h>m} f a_h - l/2 < inf_{h>n''} f a_k + Sia N il max tra n' e n''. Allora: + sup_{k>N} f a_k < sup_{k>n'} f a_k < inf_{h>n''} f a_k < inf_{h>N} f a_k + Assurdo per lemma precedente. +Qed. + +======================================= + +Lebesgue costruttivo: + a_n bounded da b ovvero \forall n, a_n < b + f strongly monotone ovvero f x < f y => y -<= x + liminf f a_n # limsup f a_n => liminf a_n < (o #) limsup a_n +Dimostrazione: + per ipotesi + liminf f a_n # limsup f a_n + quindi + liminf f a_n > limsup f a_n \/ liminf f a_n < limsup f a_n. + per casi: + Caso 1: + Usiamo il lemma liminf f a_n <= limsup f a_n => assurdo + Caso 2: + Usiamo Fatou e Fatou rovesciato: + f (liminf a_n) <= liminf (f a_n) (per fatou) + < limsup (f a_n) (per ipotesi) + <= f (limsup a_n) (per fatou rovesciato) + Per monotonia forte della f otteniamo: + limsup a_n -<= liminf a_n + (Da cui: + liminf a_n # limsup a_n) +Qed. + +############### Costruttivizzazione di Weber-Zoli ###################### + +Prerequisiti: + 1. does_not_approach_zero x_n = + \exists delta. \exists sottosuccessione j. + \forall n. x_(j n) > delta + 2. does_not_have_sup = ??? (vedi prerequisito ????? sotto da soddisfare) + 3. sigma_and_esaustiva su [a,b] x_n = + d(a_n,x) does_not_approach_zero => a_n does_not_have_sup x + ????? inf x_i does_not_have_sup x => liminf x_i # x + +======================================= + +Sviluppi futuri: + Spezzare sigma_and_esaustiva in sigma + esaustiva o qualcosa del + genere. Probabilmente sigma diventa + d(a,a_1) ~<= \bigsum_{i=n}^\infty d(a_n,a_{n+1}) => + a_n does_not_have_sup a + La prova del lemma 5 in versione positiva e' ancora da fare. + L'esaustivita' deve essere rimpiazzata da un concetto tipo located. + +======================================= + +Due carabinieri: + a_n <= x_n <= b_n + d(x_n,x) does_not_approach_zero => + d(a_n,x) does_not_approach_zero \/ + d(b_n,x) does_not_approach_zero +Dimostrazione: + Per ipotesi esiste un \delta e una sottosuccessione y tale che + \delta < d(y_n,x) + <= d(y_n,a_n) + d(a_n,x) + <= d(b_n,a_n) + d(a_n,x) + <= d(b_n,x) + 2d(a_n,x) + We conclude (?????? costruttivamente vero per > 0 e vero classicamente) + d(b_n,x) > \delta/4 \/ d(a_n,x) > \delta/4 + and thus + d(a_n,x) does_not_approach_zero \/ + d(b_n,x) does_not_approach_zero +Qed. + +======================================= + +Lebsegue costruttivo: + x_n in [a,b], a_n <= x_n <= b_n per ogni n + d sigma_and_esaustiva su [a,b]; + d(x_n,liminf x_n) does_not_approach_zero \/ + d(x_n,limsup x_n) does_not_approach_zero => + liminf x_n # limsup x_n (possiamo concludere che eccede? forse no) +Dimostrazione: + Fissiamo un x tale che d(x_n,x) does_not_approach_zero. + Per ipotesi d(x_n,x) does_not_approach_zero + Siano a_n := inf_{i>=n} x_i e b_n := sup_{i>=n} x_i. + Per i due carabinieri: + d(a_n,x) does_not_approach_zero \/ d(b_n,x) does_not_approach_zero + Per definizione di sigma_and_esaustiva su [a,b] + a_n does_not_have_sup x \/ b_n does_not_have_inf x + Quindi, per definizione di liminf e limsup e per ????????? + liminf x_n # x \/ limsup x_n # x + Facendo discharging di x concludiamo + \forall x t.c. d(x_n,x) does_not_approach zero, + liminf x_n # x \/ limsup x_n # x + Per ipotesi possiamo istanziare x con liminf x_n oppure con + limsup x_n. + Nel primo caso otteniamo + liminf x_n # liminf x_n \/ limsup x_n # liminf x_n + Poiche' la prima ipotesi e' falsa concludiamo + limsup x_n # liminf x_n + Nel secondo caso otteniamo + liminf x_n # limsup x_n \/ limsup x_n # limsup x_n \/ + Poiche' la seconda ipotesi e' falsa concludiamo anche in questo caso + limsup x_n # liminf x_n +Qed. diff --git a/matita/dama/doc/NotaReticoli.pdf b/matita/dama/doc/NotaReticoli.pdf new file mode 100644 index 000000000..76a6842e9 --- /dev/null +++ b/matita/dama/doc/NotaReticoli.pdf @@ -0,0 +1,3078 @@ +%PDF-1.2 +7 0 obj +<< +/Type/Encoding +/Differences[33/exclam/quotedblright/numbersign/dollar/percent/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon/exclamdown/equal/questiondown/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/quotedblleft/bracketright/circumflex/dotaccent/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/endash/emdash/hungarumlaut/tilde/dieresis/Gamma/Delta/Theta/Lambda/Xi/Pi/Sigma/Upsilon/Phi/Psi/Omega/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/acute/caron/breve/macron/ring/cedilla/germandbls/ae/oe/oslash/AE/OE/Oslash/suppress/Gamma/Delta/Theta/Lambda/Xi/Pi/Sigma/Upsilon/Phi/Psi +173/Omega/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/acute/caron/breve/macron/ring/cedilla/germandbls/ae/oe/oslash/AE/OE/Oslash/suppress/dieresis +255/dieresis] +>> +endobj +10 0 obj +<< +/Encoding 7 0 R +/Type/Font +/Subtype/Type1 +/Name/F1 +/FontDescriptor 9 0 R +/BaseFont/NGVWLS+CMBX12 +/FirstChar 33 +/LastChar 196 +/Widths[342.6 581 937.5 562.5 937.5 875 312.5 437.5 437.5 562.5 875 312.5 375 312.5 +562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 562.5 312.5 312.5 342.6 +875 531.3 531.3 875 849.5 799.8 812.5 862.3 738.4 707.2 884.3 879.6 419 581 880.8 +675.9 1067.1 879.6 844.9 768.5 844.9 839.1 625 782.4 864.6 849.5 1162 849.5 849.5 +687.5 312.5 581 312.5 562.5 312.5 312.5 546.9 625 500 625 513.3 343.8 562.5 625 312.5 +343.8 593.8 312.5 937.5 625 562.5 625 593.8 459.5 443.8 437.5 625 593.8 812.5 593.8 +593.8 500 562.5 1125 562.5 562.5 562.5 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 0 0 0 0 0 675.9 937.5 875 787 750 879.6 812.5 875 812.5 875 0 0 812.5 +656.3 625 625 937.5 937.5 312.5 343.8 562.5 562.5 562.5 562.5 562.5 849.5 500 574.1 +812.5 875 562.5 1018.5 1143.5 875 312.5 562.5] +>> +endobj +13 0 obj +<< +/Encoding 7 0 R +/Type/Font +/Subtype/Type1 +/Name/F2 +/FontDescriptor 12 0 R +/BaseFont/ABTSXQ+CMR17 +/FirstChar 33 +/LastChar 196 +/Widths[249.6 458.6 772.1 458.6 772.1 719.8 249.6 354.1 354.1 458.6 719.8 249.6 301.9 +249.6 458.6 458.6 458.6 458.6 458.6 458.6 458.6 458.6 458.6 458.6 458.6 249.6 249.6 +249.6 719.8 432.5 432.5 719.8 693.3 654.3 667.6 706.6 628.2 602.1 726.3 693.3 327.6 +471.5 719.4 576 850 693.3 719.8 628.2 719.8 680.5 510.9 667.6 693.3 693.3 954.5 693.3 +693.3 563.1 249.6 458.6 249.6 458.6 249.6 249.6 458.6 510.9 406.4 510.9 406.4 275.8 +458.6 510.9 249.6 275.8 484.7 249.6 772.1 510.9 458.6 510.9 484.7 354.1 359.4 354.1 +510.9 484.7 667.6 484.7 484.7 406.4 458.6 917.2 458.6 458.6 458.6 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 0 0 0 0 0 576 772.1 719.8 641.1 615.3 693.3 +667.6 719.8 667.6 719.8 0 0 667.6 525.4 499.3 499.3 748.9 748.9 249.6 275.8 458.6 +458.6 458.6 458.6 458.6 693.3 406.4 458.6 667.6 719.8 458.6 837.2 941.7 719.8 249.6 +458.6] +>> +endobj +16 0 obj +<< +/Encoding 7 0 R +/Type/Font +/Subtype/Type1 +/Name/F3 +/FontDescriptor 15 0 R +/BaseFont/WIVPZW+CMR12 +/FirstChar 33 +/LastChar 196 +/Widths[272 489.6 816 489.6 816 761.6 272 380.8 380.8 489.6 761.6 272 326.4 272 489.6 +489.6 489.6 489.6 489.6 489.6 489.6 489.6 489.6 489.6 489.6 272 272 272 761.6 462.4 +462.4 761.6 734 693.4 707.2 747.8 666.2 639 768.3 734 353.2 503 761.2 611.8 897.2 +734 761.6 666.2 761.6 720.6 544 707.2 734 734 1006 734 734 598.4 272 489.6 272 489.6 +272 272 489.6 544 435.2 544 435.2 299.2 489.6 544 272 299.2 516.8 272 816 544 489.6 +544 516.8 380.8 386.2 380.8 544 516.8 707.2 516.8 516.8 435.2 489.6 979.2 489.6 489.6 +489.6 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 0 0 0 0 0 611.8 816 +761.6 679.6 652.8 734 707.2 761.6 707.2 761.6 0 0 707.2 571.2 544 544 816 816 272 +299.2 489.6 489.6 489.6 489.6 489.6 734 435.2 489.6 707.2 761.6 489.6 883.8 992.6 +761.6 272 489.6] +>> +endobj +19 0 obj +<< +/Type/Font +/Subtype/Type1 +/Name/F4 +/FontDescriptor 18 0 R +/BaseFont/XWWIDL+CMSY10 +/FirstChar 33 +/LastChar 196 +/Widths[1000 500 500 1000 1000 1000 777.8 1000 1000 611.1 611.1 1000 1000 1000 777.8 +275 1000 666.7 666.7 888.9 888.9 0 0 555.6 555.6 666.7 500 722.2 722.2 777.8 777.8 +611.1 798.5 656.8 526.5 771.4 527.8 718.7 594.9 844.5 544.5 677.8 762 689.7 1200.9 +820.5 796.1 695.6 816.7 847.5 605.6 544.6 625.8 612.8 987.8 713.3 668.3 724.7 666.7 +666.7 666.7 666.7 666.7 611.1 611.1 444.4 444.4 444.4 444.4 500 500 388.9 388.9 277.8 +500 500 611.1 500 277.8 833.3 750 833.3 416.7 666.7 666.7 777.8 777.8 444.4 444.4 +444.4 611.1 777.8 777.8 777.8 777.8 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 0 0 0 0 0 777.8 277.8 777.8 500 777.8 500 777.8 777.8 777.8 777.8 0 0 777.8 +777.8 777.8 1000 500 500 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 +777.8 777.8 1000 1000 777.8 777.8 1000 777.8] +>> +endobj +22 0 obj +<< +/Type/Font +/Subtype/Type1 +/Name/F5 +/FontDescriptor 21 0 R +/BaseFont/MVQYVL+CMMI12 +/FirstChar 33 +/LastChar 196 +/Widths[609.7 458.2 577.1 808.9 505 354.2 641.4 979.2 979.2 979.2 979.2 272 272 489.6 +489.6 489.6 489.6 489.6 489.6 489.6 489.6 489.6 489.6 489.6 489.6 272 272 761.6 489.6 +761.6 489.6 516.9 734 743.9 700.5 813 724.8 633.9 772.4 811.3 431.9 541.2 833 666.2 +947.3 784.1 748.3 631.1 775.5 745.3 602.2 573.9 665 570.8 924.4 812.6 568.1 670.2 +380.8 380.8 380.8 979.2 979.2 410.9 514 416.3 421.4 508.8 453.8 482.6 468.9 563.7 +334 405.1 509.3 291.7 856.5 584.5 470.7 491.4 434.1 441.3 461.2 353.6 557.3 473.4 +699.9 556.4 477.4 454.9 312.5 377.9 623.4 489.6 272 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 0 0 0 0 0 606.7 816 748.3 679.6 728.7 811.3 765.8 571.2 +652.8 598 0 0 757.6 622.8 552.8 507.9 433.7 395.4 427.7 483.1 456.3 346.1 563.7 571.2 +589.1 483.8 427.7 555.4 505 556.5 425.2 527.8 579.5 613.4 636.6 272] +>> +endobj +25 0 obj +<< +/Type/Font +/Subtype/Type1 +/Name/F6 +/FontDescriptor 24 0 R +/BaseFont/NFGEEG+MSBM10 +/FirstChar 0 +/LastChar 127 +/Widths[777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 +777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 +777.8 777.8 777.8 888.9 888.9 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 777.8 +777.8 777.8 777.8 500 277.8 222.2 388.9 611.1 722.2 611.1 722.2 777.8 777.8 777.8 +777.8 1000 1000 1000 1000 1000 1000 777.8 777.8 555.6 722.2 666.7 722.2 722.2 666.7 +611.1 777.8 777.8 388.9 500 777.8 666.7 944.4 722.2 777.8 611.1 777.8 722.2 555.6 +666.7 722.2 722.2 1000 722.2 722.2 666.7 1888.9 2333.3 1888.9 2333.3 0 555.6 638.9 +0 0 0 0 722.2 555.6 777.8 666.7 444.4 666.7 777.8 777.8 777.8 777.8 222.2 388.9 777.8 +777.8 777.8 777.8 777.8 777.8 1000 1000 777.8 666.7 555.6 540.3 540.3 429.2] +>> +endobj +28 0 obj +<< +/Type/Font +/Subtype/Type1 +/Name/F7 +/FontDescriptor 27 0 R +/BaseFont/UQCFNZ+CMSY7 +/FirstChar 33 +/LastChar 196 +/Widths[1138.9 585.3 585.3 1138.9 1138.9 1138.9 892.9 1138.9 1138.9 708.3 708.3 1138.9 +1138.9 1138.9 892.9 329.4 1138.9 769.8 769.8 1015.9 1015.9 0 0 646.8 646.8 769.8 +585.3 831.4 831.4 892.9 892.9 708.3 917.6 753.4 620.2 889.5 616.1 818.4 688.5 978.6 +646.5 782.1 871.7 791.7 1342.7 935.6 905.8 809.2 935.9 981 702.2 647.8 717.8 719.9 +1135.1 818.9 764.4 823.1 769.8 769.8 769.8 769.8 769.8 708.3 708.3 523.8 523.8 523.8 +523.8 585.3 585.3 462.3 462.3 339.3 585.3 585.3 708.3 585.3 339.3 938.5 859.1 954.4 +493.6 769.8 769.8 892.9 892.9 523.8 523.8 523.8 708.3 892.9 892.9 892.9 892.9 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 0 0 0 0 0 892.9 339.3 892.9 585.3 +892.9 585.3 892.9 892.9 892.9 892.9 0 0 892.9 892.9 892.9 1138.9 585.3 585.3 892.9 +892.9 892.9 892.9 892.9 892.9 892.9 892.9 892.9 892.9 892.9 892.9 1138.9 1138.9 892.9 +892.9 1138.9 892.9] +>> +endobj +31 0 obj +<< +/Encoding 7 0 R +/Type/Font +/Subtype/Type1 +/Name/F8 +/FontDescriptor 30 0 R +/BaseFont/PKAFIM+CMR10 +/FirstChar 33 +/LastChar 196 +/Widths[277.8 500 833.3 500 833.3 777.8 277.8 388.9 388.9 500 777.8 277.8 333.3 277.8 +500 500 500 500 500 500 500 500 500 500 500 277.8 277.8 277.8 777.8 472.2 472.2 777.8 +750 708.3 722.2 763.9 680.6 652.8 784.7 750 361.1 513.9 777.8 625 916.7 750 777.8 +680.6 777.8 736.1 555.6 722.2 750 750 1027.8 750 750 611.1 277.8 500 277.8 500 277.8 +277.8 500 555.6 444.4 555.6 444.4 305.6 500 555.6 277.8 305.6 527.8 277.8 833.3 555.6 +500 555.6 527.8 391.7 394.4 388.9 555.6 527.8 722.2 527.8 527.8 444.4 500 1000 500 +500 500 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 0 0 0 0 0 625 833.3 +777.8 694.4 666.7 750 722.2 777.8 722.2 777.8 0 0 722.2 583.3 555.6 555.6 833.3 833.3 +277.8 305.6 500 500 500 500 500 750 444.4 500 722.2 777.8 500 902.8 1013.9 777.8 +277.8 500] +>> +endobj +33 0 obj +<< +/Filter[/FlateDecode] +/Length 2056 +>> +stream +xÚåXK“ܶ¾çW°t§âùøˆ/–,)唒JI¤QRX»A‰CŽùX'ëüøô‹ÎrìÒ%§\†x6_wݘ RQÜôùcðòæÛ7qD*˂›» MT™û8ÎU”7¯>…?tÃØOãèüã£}ô]ëvû47aínÜìÊ4t]ïŽ4Î4v÷ùæOA© +ì­J‘ÕîÒ8|À×ß»öQv¼êŽ¾µ£ɞ¿oÝ-4`ép?9”÷í›ä¬jC«XIgO§Ý>É®;ØÅ¡ow‰ G×·ïOƒX«Tãþ½I•ÑÁ>5J¬^c§ÚãVòÞV®¯»Ñs÷Nòе,GÃÕJVCe£’˜d­7G¥™Ê8p^ôºí}%ç|ìÿTfV¨(?Ëü7ÏÇX‡@÷4.U +†ÊÊØNñ¬–èðG€8 +Ǟë‰-†Æx}CÖ½bUÒ+R"X–*â£>àuS×ÈÌNg€ý7h‹$lɦû4KÃƍ€¨§^Žvۏ¾¢¾+03`ƒ'­ëm묚Z^ÆêÓª"ÌA•34ìízÏ>;j¥5éÇ®µOŠ"<ú4HŠ2tüYfK²|bîûÙgqëyÁ‰¾|Qgá4¯ájè?$Pÿ4dk»þh›£“xÛàöke ){?y¤ >nT]?ÈXíÓp': +FmUÙÚ}åÕn¯£"ü«'”.Õqxê]å»èð&¦XîÝÖÞå ©µÜT÷[LhÉ.ÞcTFA +“‡Ãƒo«®(}Æ ,«-ßTæÎA,sëØñ˜«eKÓ8nÝM-Úåúž+f?$&oýHÜ…ÄßX˜bðè_E ¦² AÇKtHWáö¬ ÉÄB71Ûä·Þ0o¶Í½»ÅXݏørÓÝc«£mmãGŽëTÏÖÅæp个eèwã„œ2ö~6$-Haû8αxèÊm¤ÏwÃ5þ ì6k7 +6¢°÷Ï;uæƒ@J§xZ¤˜ށ%@‡ -û®­/³¤C^P¤=7dÝ;gѶi¡ õ<2Rz±Z_º“`ÊãoÝ5Ûѳ%ÚÇá›l´c7qŒS™M8a 8”0hè@^]Wc¿ò£í[™: j”`›jjÉ]qٓœÆ0kǃȀÏí'n)®Q….¶.‹:érÆ̀ÓRzÇ]¢:üvÄÕÐ:|(>ã.X‘9'¬˜Ã€L”…qþéNtY +“ÃUD“c-ì„î²Õò0K›<|;ýËñý¦þþ—X»å™OÅgnœÀQ‘Éu‡/ê%ØüðËË©ÿDðO‹çþ,ûbÙçðS°ùÀÀ·º|Ê>ó)ÿŒ +çLϗ¬—ê öV3á冎¬¦ñâ5¤ 2—.˜ôP҃·<"äc‡CKù °þh–ç!Ý\€¬+(MÁ·¶×Œ+A†Gé™%°«SÎ×æœhËL•DP|íöEøݜò—% <1²ä¹*s™Ün…Baþ÷¥ö¸²“€*$\@Q†¨HÏ´<^KA’­´‹eË žR`“{b;â‚ªFùS@…”•¢ÜU¤_AO#°ôz†`¥¨—Dzæ÷[øUü[àÍ¡vK6{S•&_ƒüôWÃ2¨õe£dc9<Û£(IC?Ilu‡)ÉÙwñqÇʋç[ˆpæÞKWí%b¿–ïáPuÇP9§«}FLÖ~ŒùväZ*Lìi„ô‡Ž çᷛ++‡Ð$§ìhÀœÆÜÖ­óRåùà*«Ð¸Hó ηs}6ô‡­€7Í»¯¸ƒÄ±íýVñĨ²¼ ÈÕI˜Á”ÎÖ`n/_bjýŠÀü˒‚«@ËùA‡ÍóÅ5úÑ.Õ&Nõ®Y^bÐe{áúš¹çè[ÞYFK©ÁµCÇMJå]_ûv{LÄú"_$Y¾El2› ¸^ÕÇ4n֔¡6fÓB%¿Î/¨À<[s‰R»9·‹MŸª_À{©üp*¸™NÎn†wBèñ+5$@_œ¡G]z¦¼"Vi±u6”q£\IÊL.ê𨂔G4‰I·Ž[¦g·CV¢4J¬””×X ¬7/¿j•g¿påtbImMNŒªóGª};—°ÂRíÁsÊ+DðE8gï–M±Œo¤Ó©ñÕÈð:“‘–ÕçrÞS0L"£¶›+&<¦“TÌ|²‹ÙBMbÄòLË µ›D[¾…š QŠò«÷kãf˜À)‹u®¬:(ûÆÉô°õw𺔦oø{YH*¤^ç–Ä,ï*£áï—Çð]ðóüŸ)À/‚c&Pé7Á{ú!GVÏ)wCYƒ}”1Ôå?$Åò‡dx™ªŒŸ ¯üÉö£Ÿ³eE#Y-ßWŠR_Æìõc{‡¡@”HiՄk½Ðß ÎDðrMž¿/1ÌZ uu–éðƒ—é?S%„G½ôÛ-ϒó'[ýˆï"¼• N%8<Þ ó¸§£8ɹy>Pƒ+¼Þ­o°ÕÀÈòÓ÷Õ  ½eP~d¬Îˆb@æÁžžm«‡Ö`ƆÀLþoÁtêžÀß_Áq×è“%<}—?cqõßý¡P‹˜ +endstream +endobj +35 0 obj +<< +/F1 10 0 R +/F2 13 0 R +/F3 16 0 R +/F4 19 0 R +/F5 22 0 R +/F6 25 0 R +/F7 28 0 R +/F8 31 0 R +>> +endobj +6 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 35 0 R +>> +endobj +38 0 obj +<< +/Type/Encoding +/Differences[0/Gamma/Delta/Theta/Lambda/Xi/Pi/Sigma/Upsilon/Phi/Psi/Omega/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/acute/caron/breve/macron/ring/cedilla/germandbls/ae/oe/oslash/AE/OE/Oslash/suppress/exclam/quotedblright/numbersign/sterling/percent/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon/exclamdown/equal/questiondown/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/quotedblleft/bracketright/circumflex/dotaccent/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/endash/emdash/hungarumlaut/tilde/dieresis/Gamma/Delta/Theta/Lambda/Xi/Pi/Sigma/Upsilon/Phi/Psi/Omega/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/acute/caron/breve/macron/ring/cedilla/germandbls/ae/oe/oslash/AE/OE/Oslash/suppress/Gamma/Delta/Theta/Lambda/Xi/Pi/Sigma/Upsilon/Phi/Psi +173/Omega/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/acute/caron/breve/macron/ring/cedilla/germandbls/ae/oe/oslash/AE/OE/Oslash/suppress/dieresis +255/dieresis] +>> +endobj +41 0 obj +<< +/Encoding 38 0 R +/Type/Font +/Subtype/Type1 +/Name/F9 +/FontDescriptor 40 0 R +/BaseFont/PFLRKF+CMTI12 +/FirstChar 33 +/LastChar 196 +/Widths[300 500 800 755.2 800 750 300 400 400 500 750 300 350 300 500 500 500 500 +500 500 500 500 500 500 500 300 300 300 750 500 500 750 726.9 688.4 700 738.4 663.4 +638.4 756.7 726.9 376.9 513.4 751.9 613.4 876.9 726.9 750 663.4 750 713.4 550 700 +726.9 726.9 976.9 726.9 726.9 600 300 500 300 500 300 300 500 450 450 500 450 300 +450 500 300 300 450 250 800 550 500 500 450 412.5 400 325 525 450 650 450 475 400 +500 1000 500 500 500 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 0 0 +0 0 0 613.4 800 750 676.9 650 726.9 700 750 700 750 0 0 700 600 550 575 862.5 875 +300 325 500 500 500 500 500 814.8 450 525 700 700 500 863.4 963.4 750 250 500] +>> +endobj +42 0 obj +<< +/Filter[/FlateDecode] +/Length 2664 +>> +stream +xÚ}YKã¸¾çWsihk%QÏìi;››Em$‡vØÇC@½zÌ¡}êEÙ²Ü9"‹ïbÕWË»(Œ¢ÝiGŸ_wŸž~úªvqVÙîéÛ.-ÃTíyÉîéËsðEÝÖso±ž ülõHÇ$Ïöi†ûŽ“žS›~ŸäŒÀBhIª wØë*YLó4iìöÃj¥UPcõ»tž{ÍKŸõ¼<ýcwˆ‹0Ëà“†iJ[m`;i’“n –pQ7XÍe=NƒÆU¨Ö˜¶}°²³Ó ß¬ë ?f¬mßȍn[3À>çAª?p´™&\£åME¼ŸŒ÷k€Ò< Æ3®€]~úš]´çØ7¢ÞÿáÖ«»¨Â4‘Æp(³$ø{ÓÁYÚi°<ód†Îö”–E ÐR˜ÛÛ9<õ`¤Y7Ü`Fӝ­#iؖg}ڗp…n€»e YX+ օʂώnóǞÖ;™þM¾8؏ž¤Fw¢òà7óÊ[O3*6*WVƒ]yïní«mE6šÓlÃsÌ= õù< y•A]³R½Þy—g4˜çÏâ,˜÷{4™†Ê@}íð"±Œ›ÄïŸ3ß–Gwö͵KUYòq²Ólú†:FÁ2€¯˜Ê½:tÛûVEFñ»~ö«³Ô fÃá–u |uöpÜw ¢Fit³pœ§è,¼ð?ñڃŸ÷‡.½Ùì"Qa’J×ã,/«R¶ R,{j­ìešëFËëÚNÌï÷/=lÏm Z@qܲ‹jí¹ƒ!D%§ jÜꏣªàoºQÿ%}¥Û5õUàŸÜè +‡H€6h—ÐVËâ?g¾~¡£¨'á2hÐ µÞ:òwì12à¦"0ƒóÌhæ¸é9Ž^Ÿãø%Dl¨ÈSU”¯³ë5Ñr4¸ î;Ž€ŸÆH |/d'NðŽÙMt\iÁE¬´f MºuÑ^D +†4îcØ8M§`((lR¤}ÜT™‹ª û$8@Ú|oœEx©TèýÈÆ4ó0Hs«ýêµ€å‚dwՕsä*¬”MNۊÍHãÕñØä÷`Éòwykö™ +Ër±ú[C³PygÄ#&°94p A–ƹ®AËbžIZ‚äìÁŠâ\²ŠV¥ ›±*“Õmb×Övˆ.rʼ +ã•c aâúl7ºËòËAù&@/`£€Ý+‚Õƒö ÖÆö†QtIæ¹Ìöï;ai04v•¿Ï쎰·ðØ ˜ÒÉ~y¢áÉE’@ä.i‚Ï®CEä +|Ëöµ=³æò4p¯B«¥K,¡Ó·¾¯;þ»ža…ˆ48ÆqyÐþ¢/jdŽoÑ8÷ÜBxÜŠÌkŸ‡ø0Šõ,8kÇT¶—¥^˜Í€5¡Ø,NtY8»u"é‰ EªRÂÒX;ÙÿÖ½ „1Žêáä:!Y"¢¨U7€ ·•— +¡ÑÒGá«ÃØ·7&BxxͱΎµtn®»³)Ošþ0žSAE=2·ê}{îÁ[lYq ÐR¦ˆ!ƒ:‚Zˆ¾“‹R9]N\a^ÂyX>Úþ„à¿ED=Žút ˜Ìh…ß\5n݊ÈHa°ã܂¯Z´z f!\ÆaZìT1a&Óg{ +£Ë7üòÈóàæþ„–Kv]x­`ãñ±æž(t˜®ÁÛÑÙªÂk‹ %§z\Y(:СvÝyžè\a ³¨"¨Mc°aº…n/TýÿEtwШeŒBÚ!¥Š‡ƒ¬ŠED@¤;œúÕ±› KØáq¿ +•”a.@1˜†}=¨Ÿ'fˆ9ò8æð¼/G‘‡älhЙiú Œ’`9¡$^W¤> +mžõ=¬2؅« oíçô……—,Ü c|Ò[ý`Dôk±¹i-ƒÛTÞ_·—Cï|Ì#Ñ AòR#&+ZahœÈ`­^Þ«n6ŸËú¤GîôÇÙâMŒ,~®^ „ÿc»§¸Ðø]³6р†ýjýv›+&G+½ª€Õ%ÙÇâ÷T¼y +àp±1©Q²:Ü°9KÂâ#q`ìcs‡÷‘Õdñՙ“,á&¿ä"z‡Á—3µÔjdz…m؟º+£Ý0:î⯤>%Ã=6o“m´…“ö<”¤†ç}x,Î;:¢º¬™pd_«@†‡jœw¡ I–à +ý›H$q”p0íü2û„eÎ KòvÓ02Ø TÜñþ¬,‘Aà$Ñnä€ S,(ΑÒó*V„>sB%7/ž„7Ð:ÝJQ^×KvD>àbÑMï!Às†>¦de p–ÏV£Î4Ø'Çݔ˜~¾Xîò«eK&­·.äwæÇó¹µùþÄøàÚdx=ÇsåKÏIcÎÖ{‚‘·Å P{é£.ï;®²»µ¶¹Ä_nh¼’Ë%ÏS‡¦6IüaÑ'þ¸ÆïvãKNʍ|ç;€€(þµ¼³V7ËÙ¡››ÅØâ³aù: ©wó:diž ó̽ÁìÇ}ü eIó,iS”"€Ž–­7¦Yà,žÊ%bÔù¨ì8ñ +endstream +endobj +43 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F9 41 0 R +/F6 25 0 R +>> +endobj +37 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 43 0 R +>> +endobj +46 0 obj +<< +/Filter[/FlateDecode] +/Length 2571 +>> +stream +xÚÍÛnÛ8ö}¿Â;/#cjŽHŠ¤˜¢-:³˜E±´ö¡iŠ¥¤Âڒ+ÉÙ¢_¿ç”D‡’ã&i¦‰$^ÏýêELâxq½0,^ÿú;]PE]œ_-xLÒt±’)Qlqþú}Ė+JY½Üíšz¹â4Z¯K|Q"jŠ®\כ¬)–Îÿ¹øíܜÆ”-¼ÓðŽzW\ï‹*‡Í K£/S—Ë“QÑà˜ŽÞÓøó÷”~xß"‰Ö¥‡-LÁÅûy)šb[ۙ²²§}Þm—Ù±¶øZÖUa'òbcG»¢†mnI^ˆãŊ&$I xoz`Z–É4ºª›í†ö›¬Ã ¥Œªb³ù93£—e?—lðd©Ì5ef·çEi¡J²\¥"þUWvA[fXRV]± +jŠ¶ÍºèÁu Xöo™¹«4Úfm[n͇Š®‹ªh²MÙ]0)–IšFfb€7´{÷âagv¶\ .£u]­‹ +'ºÆRڃÊr²šrXPÕmg¤ÞÛnŸ—ýû¾Ä`Yݖy^t]i'zBد›¥à€É¾Ë켈.¢ºßXÝ^c`¼X’QÖIJ€ F”²2†´gšÃI¸î×ßÅ(Œ)Ãìçv:§)G°Óÿ 6+¢•› · +Â7ùÑNòɝK ܾ²OGo–×Åe=MiØpc¥„ie¹]Úðy¤©>£¼âpJP£„ı[Ê#'U+%ˆô%«-¶;äã"zÏQãh*Xjô‘( Èà3/.˜PUéô +‡Üc㞻¦Ü¯5|½ê(³—€Î™y;—>ò\È#‡WI, +}˜`kB„pô}»\© öÀv&ŽqVã¬8äìÜÎCpÁ €2´/)J@f_@ö]·oÌ'p03…‰5²þ*eB'řrJ¸1Oïƒù#É´@ԑݒÉH™e3`ÔÖ]W{¼Ԍ$ÀÔRà‰(ÿ‹•ô9jŽB+g4‡«˜åKáÕ¾BU@^ÝABYÒ¤4Ä#×΂íoêY ÏïÏþ»•Þ, xk¯-%*à2¬b–UªFuÛØâ Dp)$¡³wõŽ6E‹ã6X¤Ð2k 7ŽŠIèe´µÑA¾7ˆÁÃ<À5ÖUÝÁߙå#ìCàù±Ý} Ï©¯«2´.‚¤½ß,“ô)´¥OƒÀ2$zÁIÌF×hBñ¢Õ0ñ›õÄWÙº4ñ¥F_®/7L6^º<ü0¿ÆÄu3„z:Pt¤ç›©°Cô鳈n^(V <)DÆÏÉî +yªe9œŽRÍÇpùYx.Xé 6ãã7Ú ¢SÈ$|öRÓðª#·ò£—²Ç±ŽóU!Î@M©­r”í~cĂjÂ‹/|,ŽòŸë&/û¯]Ö|-m²Dõ”`²˜Êöf*¢ÍOäŽ;W™ä.ȪQ#h:uƒ¦c¨?›|–k½Ûïlv]7CUeÅ!¡QyyiR{:T´0í*Z˜Ð¯Ñð~*&H¯‘žG4q•"Ÿz4FíIق/²Pv˜Ò…q]cqÏlÕþ½œð^Ô Rup<£ ˜ gL qJD`|âÂMìõCépEgÌIjmÌëÃúWIÄ%¾üú1il—’p+À¯‘ JÌ3=uÐ>šñê“èÁÆfÛ:ô¸tô/ù„‰ÓÓ\Ó!*¾”È1µí£é³Su8!~üÈí–çg£cOèŸô÷ÇéãÃqғ—’ShŒ/@cæßAˆ!C ®xTn·E^šr9ªVôªº]›0z£Ú6 +Ï#Hg@QE÷¤“ Ìõà¡£ØÂvˆ’þô»é + #{ÂØ10ôi©à<¡Ô¼—P*z]ZâìLíΊ 2Ú?sŽŒ+LÑ=G6Ô2°ðb#J©¢\ýõ>»Þ”YõՌaŸ>®kW¿¡ +H ø\ÁNáÁ™-"o*±¼Ü5î6p*õ¦Ã¥T¢@ϝb~3Q€’Ò,ðÒÛrµ-uæò"ÍÈmïÖqÇDm>Œ8 ýlôÜØùRƒ»6—ubl։aAœX’˜ònÿÓÂLáßd1LÔÄØ<hÍm»èPòùVÏF½ºÃÍd~ˉ~<]\O)AÂ'¼|òÛ}-£wTÝ@¦Ëy2AŽ!æbl/`Êe|oKS[pm/n+ñæ¹)L/Á~ Œë4zU6ÿýTCÔ#íð{þÁNô½b·Õ-ÏË-6-ûħL9_Ηi<êd¨ ?Î×)DÄ«_`÷´*m#U­ê¬ 6À†–l2ÆîØ1ï—Øä»iÇxóâb]Û^+µüdÇsgwmcÏpìgasì¦lº}¶k3¦§Z殛‹VÉôTÝ‚q 3¼ç®aëSSêÈÕìN웜7Åv46|ÖØĉ‰˜»‚öÚ* Q9õ궁ùfëà Ž‡ÎéIfö®žH!=gs¿2Do¾LìÖê‹z2°Ãn)€ÿrɒ˂:ÚÔ "4Q]A>êwl;Õ q ƒøa²ªÎф ÁH½˜ûiL¤šCz¾by쌳õq¡hlÿQYO½3Œn@µ—"Ž0‚ÂgÜø釘mŠ#ˆºê½ +›š£¸=€D_æ#ÎCN9ÑO•7†Þèi`\žÄ©dòŒk+ԓš ¤ÔOéúï¨Q%P¦R?šð?ÌÔæß՜—–Ê¡EÜöòòr²Ê°f +íWpó];gSƒ»êò‰zŠ÷¦Œ¸?eԏPJù2Aš±'öíÖ»øË«L‡R#žÊg_ÎûìC| ÁÄN‡üD‡t´É!È#m‰¿‚QŌ·¼h!Po².³x–ç%¤åÁÏèìB/ho;[E±?ºÜ˜=™uEU ¶<þ·H¨m +Z¶ã7ÇbúfñÎ[Çܸ2ëR¬{¹ï‰upóיodxÊ¿×}÷¾:_Ÿ ÅA T¬ƒáü¿ýb”›3 +endstream +endobj +47 0 obj +<< +/F1 10 0 R +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F6 25 0 R +/F9 41 0 R +>> +endobj +45 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 47 0 R +>> +endobj +52 0 obj +<< +/Type/Font +/Subtype/Type1 +/Name/F10 +/FontDescriptor 51 0 R +/BaseFont/FIVCRW+CMMI8 +/FirstChar 33 +/LastChar 196 +/Widths[660.7 490.6 632.1 882.1 544.1 388.9 692.4 1062.5 1062.5 1062.5 1062.5 295.1 +295.1 531.3 531.3 531.3 531.3 531.3 531.3 531.3 531.3 531.3 531.3 531.3 531.3 295.1 +295.1 826.4 531.3 826.4 531.3 559.7 795.8 801.4 757.3 871.7 778.7 672.4 827.9 872.8 +460.7 580.4 896 722.6 1020.4 843.3 806.2 673.6 835.7 800.2 646.2 618.6 718.8 618.8 +1002.4 873.9 615.8 720 413.2 413.2 413.2 1062.5 1062.5 434 564.4 454.5 460.2 546.7 +492.9 510.4 505.6 612.3 361.7 429.7 553.2 317.1 939.8 644.7 513.5 534.8 474.4 479.5 +491.3 383.7 615.2 517.4 762.5 598.1 525.2 494.2 349.5 400.2 673.4 531.3 295.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 0 0 0 0 0 642.9 885.4 806.2 736.8 +783.4 872.8 823.4 619.8 708.3 654.8 0 0 816.7 682.4 596.2 547.3 470.1 429.5 467 533.2 +495.7 376.2 612.3 619.8 639.2 522.3 467 610.1 544.1 607.2 471.5 576.4 631.6 659.7 +694.5 295.1] +>> +endobj +53 0 obj +<< +/Filter[/FlateDecode] +/Length 3078 +>> +stream +xÚÝ[K“㶾çW(›ƒ©ÊŠ&^°.b¯JʕJٓS”‡ÂβŠ"ǔ´‰÷קIP5šÇÚ[>ìÂ‹@?¿îÆ®²4ËVw+ûøëꛛ/¿'+BR-V7ïV,K•Zmr•Jººyûïä³ßë #,¡)w/Ûdg*÷º;|áÉ·EWÜVMeºj»N×ÿ¹ùûê»»ºW§T§Œ‡ËÿTM‹£¿üž» )U«ÌŽØ&®[ŒÝ<Â÷®“d+™j‰yJà $U¶¿™­-Ҝ¯úîíúÒâ_E&S~Õ¾ngûâ©Vì‹=°¯üùûú_„^¹xô¾žª”ô‹NåZd‰ýc‡ªmPJ²,©šÙž$Msêçý8[täN9…}ñ”s;èXÔ¸Z®’ò½™‘àq%|œ R)Ç3Ò\ÎÖ',Íèãhøäõ¯”€\”yê{KÿΫ]sÜ#f)'þ‹óʲßu½yÐKÒ\ûÞÌwÃp7®×¸]ôÌÓQæ ’Ê^¶w3ÌÓìEmX°_­7$Ï{î²ÉiUÚ^x¨ƒ­úã|.|¢ïÍb|£ù@©óÝéTªçSåJi o©"ãTù4DÙ0ES¡œî‹3‰a>5ð„ß?ŸŠ:&MR¥œMUu¢Šƒ s-$)ՋF©ïI×ßÿ˚ò¤†wÔm‡jVÌùGx> — ŽÔ—%Û÷?U´eªä%.R¹ÈE‘*1Ð ÑÀ†’?¶¡àÜ[ÿÙ!_[ûçÝ3„T’© pV¢S•{Ì@óä}ñ_dRÜß×UY4»ÖuTµ{Þ¬ˆMÛ‹`¨CÝ ³›Ž¬=ʁ®ûΔfgš54Íëea¾m(C¤ô;àlÜîùW?;;ŸŒ˜vÏô|!¶D( HIþ>êçËÊe?ò¸ó=‘•ìœ•t•òS‰ß‡V¾+<Ÿg“}̽-å©z ³,X +è£ë¡h0â |È f +™cS8¯Ržª×îíh ‚±ÞƹšÊ5·GsèÖÞ •mSÖ' ¡Ìà3Àÿ…H‡¤™¾·„FÌ^¯~ +FRß¡ÝH….»oˆŒ„5ùd¤kGº’“¯û†ñëñ”Q¥;È)P¥À#‹¥dÉ(FáÄ5vZf#M\A¤i\Gi˜9¸žæhæ"ÊøµÁòµvà’Ó9ÇEr@ͦ?ʽÝrWµÝÞîØ6×Õ¾:G{^   ÏÆnVÁTdùhKĚKîb °¥ƒëB*¡’o‹Sùþ¸R8€Ûµhw…ÝŠ©@ ^¸—(#˜ÉÎØöÎu,³ƒ*(ÿ%Íփú=É^¨0TTÍ»€Ž^™Æ=ô¹ƒI„;BŽ âÇX„Lz1¨[‡MG&y¼,‰ÅOƒËDêš7EÀ§²çÏ,`’©$ƒ¨H2£¢ãù—Á@—]»Vž9±LâìÛ¦=¶‡ñeÕ#t×dúcö–Öqpž½vä%Ì;`êϧªAEàD&ýy¿†UY+ŠÑŸÌdòö‹¢>v-ŽR ÄöK-¨g:0÷ØÛÆÒ/”nï]Ø<C%Òg1ÃÐMò0K7¢ð'‘-Œœ‹d€hJF"³ˆJy?`û··U±o#¡ÄÇJN Ñoþ‰ÃÓ _²¨‡Öa†x/“¯çäÎÆä§R³G%q'À“Ž€“XbD‹_eïQòª`ï pˆæaÆ>h 8qrh’­ãb#5&ªÂ‘¶a‡‚¯÷ Ã׿¹Yq›’ËçÌ·uÖ¸,¬’‰s¬’:[±a9ŸXlÛ°óvÂi&³¤3>¹Êg†1§‰Ÿ8,øUì7ÞJäL {s´„ 7Å¿o“*5)ì‘â’‡cg@m³¸ÊY\ƒìÙðL%?VeÛí¬ÖÛaΈúÕÀ_Úç¾8ødÀ߀—[Xùtt{ËÂà±ú°°oØ¢¬œP:i]KÓ⒌Lµ0¤óSo«Ú·mmڇ‚¯w͝ivƵ7I_À‘ÜïÃñgé|ï00:ËAöàs»=¶Ç¢6á!& Á|üX¼Ú®ß «~çZŸ¹¼փRVµÿ½ÝîÌöÙTy傄QD*5ôü‰òI2jôߞ‡#2‰í“«~…óÒd²J ¸vYuÙ֖T6ÂéókV–|ŒSYñ@“å@Þ¾Ë.på&€;½6 c‚|@9ÌFM¸ò‡µwgš¾£1¸œ4Í¡u¯;S×_ ö(hs ¾±Tˆ]³¾¿ÚÛô#žŽÛZ—]¾n:ÛL\`ÇT°EÔ¯† ¹gÓ²(i6÷´+êÚ¾‚æ™}µ}íPf;W)¹\‡ÙlÂ1WJ’ª¬íôÑVLM¸…»êµÞ£ ;©vÏí¶i-ëJàtݾêM G'úz,"ƒMLºêpªA:íOh%ô•¾±òV­CÅlZÜ5e–ñØ{0w§Ñîá¼û®½ï*sô–BYÛí»jÆlªr¸LþÎê";üÕ6Ǫ9UÇ_ft„àe¨\ Jåb€ïJ„6¬öPüÝ©ñtÅ_{GªÝÉ*ÍÜïB /9^’ ï\£ÞµÍ®èQ°ExœûÆ{á‹jQ¸7Þz{ÓïâˆÈÃu*R jÉ!ÞgîÄo«ÒyƲháƒ6;Ý´@–ëh{N„aÐh˼LôºvDÙQÉ©=æñŸJu\ÆíÔÇãîÇP?µ¿bá®Ó` !5Ùýpè+C¨ß,¡GÁŠfR)/ůcdá4dwÈXÄ86Þ|&’[‹¾ + àÿµÑå¤Úê9ôÓXB5ÓWeCål(ʆ ©˜sm*dCêT‡&ò ù<±P©dłñ«ÒÄBœ]t`“²±¤©ªy7— +°­ì‘D˜§õe©¸ª üڙD:yx+r̲^šÄcôâÀ‡ÀŒ8á¡âZ¤ÓçEžù³ ÑC)8É/܁ù‹ÄsY³ÉÃ( £"—£N¾ _Lk㍸v¦^ÇR‰>/°.“Êå |nwÆÀSÝß׋©´ä½8Åýø +”ƺhžOðºgÛ³;™ÓI•L32TiàT=DïrŠ•ÆOçq/ :ø<²|ÛzÏo°é‰I’â‚]phÄ.ó´ït±øÂ-:Ìf§yz k 1½í6ÒáUD¥‡Œæüœùx›!¾Î¯»f#RÂ>Ÿºo«‹²Ë·¥ÈÅÛRäº{6#ÁƲ f|DR”ÏM·ïC:lû`Ã=–‡¨";WÛÉó%°;Å,|‹¢Ÿ f±Pk7½(fjƒÅœ¹ƒ³6€ÐÛ@Î/#!qòw¹^º¸*^ Êü)¢l’™Ÿ0ð€Ã-ØΓïh FûøÛjÉ¼"ˆtmÒçǪ°™/Þ§ª±¾^îã×9¹ä遀Âç(C]®ˆ,ƒŸVóۅ۵Ca1z»–]º\KõbQGÖӇóŸü{?·‹"•½oõÀeµ+}âr‰ÄÆñ,ó}¢"I~%fþÌJ O‰æŸqSSD=țËW\„Ê°†#ÿ¶ëÓÌ%Ö@yžtÅèún²­bHº1˜!ä\&eqhݛ­³ÂÓ:|™”=pÎΜU5°1B`°ôxËþÿýbòßBìg|ÕsÍù/äªóáÎÀÜn)=Ioc~_?æ22‹BޅŠ˜Ðö~ÕX*Ç Ý¼Î%”ÄdñXçò ‘‘°&(r0Ò5Ì+bÁ×}Ãøõ1‡Ÿë9¬£Y÷6UwCJ³>“ß—84M¶ÛΠÐÕEW½rM;›Ü‡—ãp××%zíósëÌõáîäW5góúÛ¿Á¬ïñêp±T%;¶'ÑXÁj°xÅÑ*6eÛÙwi‘¶UÍ]gvUPã±?©öÏí¶l÷÷µqÅ!׶›{vœÓE™€ +5B»ÊϧÂ}½õ’Ì&7ëíñØzŠ¶}ái.ÅÙxaÿ‡X6 (Éw%.笉½Æ….H÷.ˆ{yýÃÿZ·î +endstream +endobj +54 0 obj +<< +/F1 10 0 R +/F9 41 0 R +/F3 16 0 R +/F5 22 0 R +/F10 52 0 R +/F4 19 0 R +/F6 25 0 R +>> +endobj +49 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 54 0 R +>> +endobj +59 0 obj +<< +/Type/Font +/Subtype/Type1 +/Name/F11 +/FontDescriptor 58 0 R +/BaseFont/LFIHUU+CMSY8 +/FirstChar 33 +/LastChar 196 +/Widths[1062.5 531.3 531.3 1062.5 1062.5 1062.5 826.4 1062.5 1062.5 649.3 649.3 1062.5 +1062.5 1062.5 826.4 288.2 1062.5 708.3 708.3 944.5 944.5 0 0 590.3 590.3 708.3 531.3 +767.4 767.4 826.4 826.4 649.3 849.5 694.7 562.6 821.7 560.8 758.3 631 904.2 585.5 +720.1 807.4 730.7 1264.5 869.1 841.6 743.3 867.7 906.9 643.4 586.3 662.8 656.2 1054.6 +756.4 705.8 763.6 708.3 708.3 708.3 708.3 708.3 649.3 649.3 472.2 472.2 472.2 472.2 +531.3 531.3 413.2 413.2 295.1 531.3 531.3 649.3 531.3 295.1 885.4 795.8 885.4 443.6 +708.3 708.3 826.4 826.4 472.2 472.2 472.2 649.3 826.4 826.4 826.4 826.4 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 0 0 0 0 0 826.4 295.1 826.4 531.3 826.4 +531.3 826.4 826.4 826.4 826.4 0 0 826.4 826.4 826.4 1062.5 531.3 531.3 826.4 826.4 +826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 1062.5 1062.5 826.4 826.4 +1062.5 826.4] +>> +endobj +62 0 obj +<< +/Encoding 7 0 R +/Type/Font +/Subtype/Type1 +/Name/F12 +/FontDescriptor 61 0 R +/BaseFont/DLLZPJ+CMR8 +/FirstChar 33 +/LastChar 196 +/Widths[295.1 531.3 885.4 531.3 885.4 826.4 295.1 413.2 413.2 531.3 826.4 295.1 354.2 +295.1 531.3 531.3 531.3 531.3 531.3 531.3 531.3 531.3 531.3 531.3 531.3 295.1 295.1 +295.1 826.4 501.7 501.7 826.4 795.8 752.1 767.4 811.1 722.6 693.1 833.5 795.8 382.6 +545.5 825.4 663.6 972.9 795.8 826.4 722.6 826.4 781.6 590.3 767.4 795.8 795.8 1091 +795.8 795.8 649.3 295.1 531.3 295.1 531.3 295.1 295.1 531.3 590.3 472.2 590.3 472.2 +324.7 531.3 590.3 295.1 324.7 560.8 295.1 885.4 590.3 531.3 590.3 560.8 414.1 419.1 +413.2 590.3 560.8 767.4 560.8 560.8 472.2 531.3 1062.5 531.3 531.3 531.3 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 0 0 0 0 0 663.6 885.4 826.4 736.8 +708.3 795.8 767.4 826.4 767.4 826.4 0 0 767.4 619.8 590.3 590.3 885.4 885.4 295.1 +324.7 531.3 531.3 531.3 531.3 531.3 795.8 472.2 531.3 767.4 826.4 531.3 958.7 1076.8 +826.4 295.1 531.3] +>> +endobj +63 0 obj +<< +/Filter[/FlateDecode] +/Length 3260 +>> +stream +xÚå[[sã¶~ï¯PӇP“5C\IìN:Óì6tv’NÖoqh‰ör"“.%mÓüúž€(€”d{½ÛöŦ—ƒs¾sÅ"K³lq»Ðÿþ¶øöòëïȂT‰Åå͂eiQ,.d‘ætqùæçäMuEEÞÔ¿×mS-/˜â M‹tùËåß½ÔŸ+÷9¡2ÍåèûzU—w-|)e²z_á‡_'Ü'ð*Ë™~ù'ÓëÈÒLÙÞ+*Œç"±ƒ0ïµ Ìk«öî~SíªÍ¿aRΒênIer½¼€¿Õz]­±™'u,…Ð"•ý0oõДqÛ»­^À0y–Ü/¹Jª÷'’Ü6µ¦Î£*¥@LÂSÎÍWûÕRd‰þSm·š¤‡[‘$Γ`<ý +KÓI²Ežª\›ó¥…îo‚±E*á—í¾Z;TiVØÁcäá©,æNJ0Û»®‘8EòºÜ¯Þã1ä*ٕ›Ê´Æ¸€dYJó¹ñ`cÜ_8Ьïþ"]¥ŠÇæ#ÞXŒ† ƒ:ÇÜÖü9Ȅzšþéùvë“ý—/,c0 4Œ- cãï¿/ƒáQ¦ŠÉ¥©”˹•Q5ÉpÀ¬ÄvŽàˆHά“R|ß|·¿¿$ȓ¶ë* KJ$áô³Lʍù¿«º»Ú žHÖÕfSšöm5 ¡ALyoÔó¿«võªÝ´!%E<퇍ˆ“ÔIšô9L³ÐÂRÊ}hA”ËP"b €«Èø¼ÙˆæE"89 çvIE¢éß웞Ћ”„Æõ~Sváæj…~k9‰â7ŸA–J9M8šŠ"F8XnÛ­58ÃâVmƒÙÁø´Höí~›Z)tC]PRJà?Vx¹WµÀ,°qž Ð~jRûÁJ(°-jã]]6!'0–’~?å«%|€ +êP6(@"›Ž‚Ï¡ñLZÝ´!U)Œ@fAÃcÇGð9Ùäý^†P”J5£|©ŽðMsvҚ~ÊOU?ùmÀ7±R8”w¨ÿ„@ý§ÿúß7ì{Bmê;sšužãA§¹~d'Œx˜®ï¡P&Ö°Ý߇kÈÁžd彶‘ËnW5·­ACÔ`r†gC”£íÙù’ù´|ÁDz7kžD°7é ñ +O=KYý°õÿ"˜ÔÚ3 ¡Sf0i2‰³À¯ŽpIá\žSÁq$ð’;p´$(cæ´ θ$„l,þÃ!œÊóGˆòJâ±txÓèùiëŸ;N ø°Í°`3×1Ñ ôÿîPãt tˆ¯áe ýèü£çIó?:mhé?7S.‰ÌS¡íK0ZM„äÇí¶ê>˜ (ٔ`[ïö»mé ðO󞈛Ö÷»{à‚ª?®›‡Uk)uS"üRôѬþ͗µwWmíÐÛ}hçqP°žÄFä|Ð,ÀŽx¤ÕVχ.hu»Ç•æ F¿®M3È9†¦°…߶Mj†\¸èÀÇËüãèpÞ³WÁ‰7_ÂzM "T]Ýv¶×Æ˨ñ§W£P·¯Ci–a´É#ÔºÒòθßÆ ov‘¬Aæ‚¿Fxlä YO8ŸU.cÚx`&0X{h!ÅÁìÆ?VcN'46óWsÓþÁPBÜy5ª&QÔö£ã›eɏÐr©Ld s"`ا†¡’ M²™(p~ÄW—ä ÁjrúðhSh7ô â,ÍØã-âYUþñ=¾Ù¨ æzL*ÃÉôsÛþìÄmâÒ³Öû¤fïbt÷¦c¼lÖ:G@“r ˆfŸu¶Et¹—)Š†À ¦L­[›LJöŠ +iš¿0*#"ey¶Áw`½¨yëŐ"2À‡¯ZïWQ ë‚1m{FÊç! ±ý(5' +CŒ0ªd1Ê,SΨQpŒ{I¶5;h¾¯ðxõr-Ì1…I.CWÔ."`ð iWšøïŸÃH{æb­™øuQ­œ¸èÀ]È ÌEݬÍ'£±à¢qƒ!GMGúñÀÑG»ˆvTÅS0Äѐ3õÏêpxîBÒ3ΟI¹}¨»ÍS‚ÈdoR^}²ºîڦݵM]šO´Ïÿ#Ô|Tœ/S3é–f2gÜãŠ0ªaWq» ÙÌÖÁÿ‰‚ |È ~²w¶Ó”÷wA%œA~FŒvŽÑ^'†™ò˜ +‚£eŽ›€LEòM(nÓOµ”èùirå2ÂØÛϧ]PJ{3Ô?†ÂÕ D—¬ž Ù£‚¬>R\{‚Ó¢’œ»á¿Šyƹ|3ðQR#ùT’µ Øóè“sÐs™×GCë‘@¹­DäúÅXóñ°ÚìuH!L² ž2¦ñ›)¶CR埚‘.8‹Ço G]ÀËt:èÁŽDpÕXùŽêÓx±ÿ/Hñ¡:Îãꘪ#äVŽÜ´îl҅K—ã~Ô}’üêˆ$KÕWá­­AºÚ×ÖJ‡ºBÿ:È`xEQrÎ-»ëcáu$÷.„+z; òIHø44?3AKþW²î³A^°>†ðöËr³ëZËXåÖ>é˜ :]¹ÛY¶«¯j±HÖöUpœÌƒM½âgeSnÚÛv˜:‚ý \d’fb˜þÎ5€tÙ,ÞyoRۑ›7 Œ>÷ ‘7 ]Xâ½iü7 Œ—ú³Û7»#‘È$ÆØu‚3ívk ò3•´’„dÉMÛé2ySÀ©û*Ó³®‡ü&¦Ú?àëU×WÈÁWW¶ôÞýÂ~¬I +;[B©Z’ã2ý¡u ßV×Æ[ÜÞî«°:3›ªËÄB|š’Ì<] .0üxÝ6K†«eV{[5¿c‡Tɛös<刯Æ>Õõô‚ÃQÍUsR—Н®æ$ʕ:ž[ꌥ–|¨æäj¢š“现G¶aM'×½Y A.¨²!ÚÐ¥Êíì·ÈºT>K”bºöž g…n…«_{¦ÂÒ8@ŸtÔu‹3UmÊ%¢Emò‘Em«ŸMç®ÜÔæhcՌ<Ã|Òi:†©Ç¤U@ßýß³lPѱ*‘9®y؄Ÿ0bosö1ø9÷¥Ëÿ8r±'“Yb >ȞJ6m§Ë*C‚‹'Y`…ÔXàF¾x‚ Ï‰…GbâN“åúߢ×ÔIY­ù|q).ÄøØ7—3]uNa˜P†¢µ¶1ux¯f]…†V÷·/xaµ,ôÝwÕªZ÷ÙXÓ¹”¤.k× Ð"s×>¢ÅÔ|ö&B>[¦ë*¢eºC®þ)ÊtÑ!x#ÊË1}ß´`ê5S}}Èv*,8% cÖK Z1¯›*] w˜u?¯nJ«›zxÎ_Œ‚…Ud‚ÂËËÇj$9m{REË™)žÊ?©†ÁMª{s Kšˆš(iò˜;žë sy¶¨ˆùĽÄYvŸ¬v£~4ãd^Ÿ,¬ˆ]½<ÐEã+0 Xýkl‘hq>‹Ë1=iŒ]”dr‰Ò]F“· É}C»¤<'˜”7m]½*—:9£6GBÒϪþãlMY`:rFS +?É ¤‰VÒ§!©Ìp,ó"¨Y"Œ2ÿÀ4ߏxÆ^€á涶WûfÝàõÞ^«|]våuÝÔUWû¡ïue‚›!¯ë™Gj´ðîR>Xäå µTçÞcxø S=cV˜ˆðHN‡]„Gb̌Dâ6Ø!‰·± ‘7aL2zÓ4„ovÛàfÿörA)Å¥ ™KI܆°ÛøÃ)R¾ +endstream +endobj +64 0 obj +<< +/F1 10 0 R +/F9 41 0 R +/F5 22 0 R +/F3 16 0 R +/F10 52 0 R +/F4 19 0 R +/F11 59 0 R +/F12 62 0 R +/F6 25 0 R +>> +endobj +56 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 64 0 R +>> +endobj +67 0 obj +<< +/Filter[/FlateDecode] +/Length 2185 +>> +stream +xÚÍYK“㶾çW({Yª²‚I$ˆÝò!vbWR®ÊÃs³¼.ŽÄ£Š$d>æ0¿>Ýh@$EJ35Þds"ݍ¯¿~@ÚÄ,Ž7÷ø~óÍÝWß%›D1žlî>mDÌò|³Ër¦øæî/?Eb»K.£om×·CߛGóôT<۔۟ïþ¾ùë!6IÂt:/°ÿ[³ÝIžFv»ã*:†“)j‹s*²mƒ,:–Uå‡û}ßÇÁ)xCS‡³êm*¢‚äÁúڗ¶-ë ÈÐó‡òÞé+»‡¡|ç 7»D2)U[—۝Hã¨ë‡£)zKo ‚ÃS[ÊcÙl¿¸tv±í.UôÃۢƯ÷Æm—šŒi5h²hÀ1ўgéVfIT҆ßPh—öKC‚Ú²7[¹7úk³«Ë¾5ÿýè¿óGùùh9èmÛgðpEgûÞ³ *ºQ̲,ú ÛGOŠXDZ‰‚ŽMK`°j¯£+ZB2×À‡zíGe¢¢¢9€8¡” ºg¤¶³4 ÜKtpï~ëmÁÖ_Kzi,‚§ã™ QÁ1È쇾÷2‘;&(8mU´åŠ“k”'Oµ÷ŠN—œÇI¢—V#çñ%ˆ™qþ ¢+3[ÇX6ò÷×a°4ËTÕÊAD-‹£êm >jž%!ýa0FžäS *}êz¿¸ ‹)ŸZK„°´¥oƒÄ¡ô¼ºjXcÑ=pZ®¥;5>$ó7•íš‰tŽc¢s«RPéIYÙ0Òǐ£ÎWßé1wñT0‘ZÔ÷:Z3Ío‹…_2êâ7G`¸Wx,p°ã¹fBOç-«"D †~kÛ£¡7œÌCè[ô¤àÑ¿Cˋ¦¨ SÄàB¿qŠpø˜¶ø¹7'ã5˜µ„è`¿€½O-&ç“"¥à„Éó×Ij¢xST£Ë=OUcFb’Ô—mm³RäA…žÂ†¯6§M¹º«»Á¯v1e«ÞÏï÷Þþ7~wq!}zšÁ_XUþ6`LJHŽçډ“¥«y +‘fê½ëèoMgëÚQRkJÀ°â~°[ ¸A .¶ðƒ©hö"ZDšÍK,qÈâ=¼0“¼Í}Iä˜t—ö ‚güBçîNFž™‰q|r«”à9”ä=y E¯ÂÒF—8qà‘#r2íÂò‰(ÿ²±ÏØȜI!¥K´[þOR†LÃ|…ˆEümÑRôÀTç'Óñ:¿ò0¸yÇï(pphº“$hÞQ@C¤»¤†Ÿöû¢±5D!É…8´Oi:;rÊ($ÝηH*(·Thì\¤È³i’EM×E{(úâ=0LCJàìeé+¹Ï«hÝPÓÌPt+Qf)†·uO@•|ìè¹*^È8úµÝ50ä:Nè±m]”Ä`ön›ÇѹZÁ^W­àìZÑÔ¹„,ŒÜ{#Že[ºìžGÅŸö—õÉX7«/ÔAϐ²ŒÖ¹B$â4ªÌ½ëÌbª!8õ Â¹ŸøÏû­—öhJ—•aIç;ž>l-ªÕ$J.RµP”)Ju>3Ÿ€ uÙáÏÚtCXì< Õ€ØàX;ņvIaѺ)–c+š‘^xº3ªrpLH¬r°IH–Ñ&Á ø3xÈÖ“EUà„JEo“¶´n?mgDY¤I†ÎsöAAU© "-œ:L xåaWCš§g®RJ–ÈiJX÷„¥¾n·[h‡Ñj|:Ë´¢ÓÔ͹]”þF*ñ2B£Ò}µ•"r%@î´äO)•NDq͒ êßÛ]} 5r²F2,þe!à +Êrk:îüx{ç.ây\9*¡Ë¡€Ð+ۑŽïb¥`šŸO´ÈYäQ)£ÎP¨Î‚R¦ô¬m:SÖ%µç{ª%’ǐ°l,ú@¥ Þ$gq>«®Ÿ”ÇӓR‹4oò±K°¤¸;a âÇ3¢ã dCV²wKkT>:{ë˜)µ‚ šú“ ÍãÄáº>Ãiì[”»æ]B ª®ºF³898¥ÈdÔ¯ Û<*L÷%Ë4ß"¨ºEP9'¨˜?¸dÉ3ÍÒ šÉ9ÍäK)–¾€d&®o»Â‰þ¸Ü›ãÏ$Wù2¨îè¦{„.éSáÈXL)£Q£îïÊÅÎÄ£§ÖB,ûñžûžgºÈ@zsÙÛ>·L͌koIá‰ïžÜj/Ï ™èì(¾I#"«Q­"Øô M¿ú‹O"c\æâýW$lšÄ'J²²Káüyz%J²1 W^bæO¼8aή³‚/3¬² azNèð¦I‚+}<ŠéñõÒ¤+SüÚãd7Ž£ôÕäþšó|ðK9f‚žó—ÐXg¾˜¿§ï—q¬H·dð¹ö™á‰œ¹:'W«Û®Ö¯wõKøøøø{$Éa6ŸDòhVÀ™4I7ãàž,ôÊ1åÑ%t&Xiþ¶àÃ<À¦°CQUsb]ÆmJܯwÞz›Ù‡…ڔţ?_œÆ2¬Iñëøjró[îË_ä¾Û‚o»/¿ÞŸLd¼Â}òeÆ=ç>\C«î³vâ>Êç"2‡æ8û¤íW1þ¿Ì“u¥× %€›ÿßVƒÏð/_àÀé8Ã? Ç"“>Cé Q™}ùNd=“ðϑ¯ñWÔ$úÓÚ¥ä|ÿ¢½ÇúٓÉX=»¸•âóɍY­ü¼2âú;@¹¸4‰ùE1;ÛÇÂÅ/ò;hxrú÷<ó¬ýÃùíÒ +endstream +endobj +68 0 obj +<< +/F1 10 0 R +/F3 16 0 R +/F9 41 0 R +/F5 22 0 R +/F4 19 0 R +>> +endobj +66 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 68 0 R +>> +endobj +71 0 obj +<< +/Filter[/FlateDecode] +/Length 2498 +>> +stream +xÚÝZݏ۸ï_áö¥2ºæIüV‚ëC‘»C‹ š¼uۃÖÖnȒcËéõþúΐ”D™”íìGrèËjÍϙáÌüf†\¤$M óùiñ—ßýÈYFr±øp¿àšp¶XIM]|xóÏäÕºÝoªbÛÞ,W\餀×ÉÝrEUR6å-j]µ¶uSÖøOžÔe×µûÒÍY/©L>–Ø¥’Ú­°nw»Êý›,ÿõáoßý(FJ¨J‰ä‹ÔR±\éäõr•I™lìPhšÆÜÈÛ¥ÝåPYB6Õº´{vů@'L^¬Xª‰ ‹UÆ çfÞ¡ÜV«mÙíßåŠå°B‰_mèeyžÜ˜ß”¥DR·H]–-]ï«`²&)˜4Ü›J =c”³pkJę錨ÜõþÞöJ¯Wu2—Mæ²~î¡5‡½ÙT‡û ŠçP>ˏ·«¬Øvûv·¯Êî–J±ä敕9eŒ8‘ ³ìV•I¹‡y°zûÐT YÝÓX¸ó¿3_JuÊ/ÍIÞKš†²ÊÍçù¥$Ï\ïç¥àIQ?´S œ’¤–ôŒ˜Ž>ûñ6‘)ÉÀ~2ʈ”3 +«èþPC½çDˆ Ç +l- V¦F?„"zè;Š1+{fS?C(/=ê퓙à7*Ô¨¼h¶T©ä{üè$}mŸ¥9jˊr’ZqÒK’çªw]_CòŽèÀy¥£®=Œ»yÙr ÃIKç„2+,ezØ%a© =ÄoBM¥Šy·AMAŸ<ÑÀuŒ>Nýä4ùSÌòg0„õ¼˜¡ãazgÖÃq–ƒ¨,Ný0ª+÷å}²äIÕØïý±;îM›Ì³m€}x«b_ìKÛVvuµ®ºb‹n[%k¯jûEüÛÜBE]»îЫ;UÈ £0A=eIY—ͺèL@YòéX4›Öv5åº< +X‘,W„â³ÅSd«­;¤G×¥mÜTÛöÐíƛªo2t¤> ݱ3`¬»Ï¾:ë®è[[ت©îªº²Ð³³±ÌÞöB$€"*mßííæXÔUÏxžÀra|:–uí~¨<ù˜Q 7<@fW{öÙxö)#±„¿1ÁTSÙ0cÅt +<…šÜ·IDÓ³õxï«ÂBÖD@[¢a°ÁB<Ù xz¤ä$ííΓƒ¾¼+ð00¾þ¢‹R„öÑ]“Ñ• Ì%u=ߟ ‡î"TҞÊC,Š#üœ‘ç_„vw[ˆp=Žj͟û9—Ê/,NîblÏä®hŠzëRâ²j+ܝÑr«F«>%'™šµøœH1áSf‰ÛåØCӗ2Š…ü¸Õ SXGúÖû ø¾¨ï½qÔµ 3Nªúß±qùdT>A¬ò÷ì÷{¢x=Õe)Ñp&LêÙääm¹Ý"sp¨Œ°Y¥MÁú²ÉÄ÷1>ì È概§1`dœq&Àç26ÓÇ­†!eô¨YˆÑ£u\…NaÎ¦=ÂPY±‚7f?œdc´÷ YÙµôB)ö•çèoŒqò(®)Þ:Hƒ…ØìBç#‡Þaiãé°rArku˜ë\F±Ã”gÄ#…•Ü©6==‹‡²‹_]8—¢yhk@é°¦É4Z$&(€¯¹<¦¸@Ÿ½¼åŸ¿)oq̽æÎߘ]μúCörõ‡YMÏ/iz~¥¦ç—4}Âê\©E=CÝlÎ>ŽÕi1ŸÒoÁ‰½öªR 9—X2”BÐÓ>Œ5¥›0¿•ÏSMŽ‰„Ÿw×úZo÷Ö:⬿Ã¹ä±@uòvŠg‚7b,uW6¶±Ý»^¡Bg¡¦ªP1eÍÒ¤)kÛ¼u—A€îv$ALnvÖX¦Ã*ÜgT‡ÖEÁUpšÖ³W2šHæå͈Da4‚@ØG#¿D²ýüê +ócÆ>¤2±pídæ´Ê ®Õ…_bûÇmO+@Ø í¹ù×ñX‘Ͳ,ñ^à$ÁŸ¦\ës.(:×0)à‚‘L{ykˆŒ„5åd¤m“ow×0îO#8DLT…i¿”Fxߙڰ‰³ $Ž^T*¼O¾¢Æ*õ—\PÆk¬ïJ”z6çÊ}ìgþ;$7uøڋ*[XŠ&{Yú¾ŠþøÝÌU¥½!@„e ÐEªˆ´*÷^s¸šB_>¨þBÓn_®ËM_f¸±¶¸»sEwtÐnä±éëN]{}?W þDåQ3Ê£¾r´õt¦ŸÒéS?? ܋iöùbu$Žñ‹ /y-{â3N¤–åŽãNý¿¸›HÌ-„Æ궡¼¨ë?u·͚s|aìš}k.ÕE§úÂo("úð®ì<g|°ëŸ£vMO;ëtØlíÒ+l>Þ°Ÿ¿$2¹›!Y~K½pÇöۆyËÎìþj&Hp.@âÛEûêÃøOÇjz¹„ÙÞLüî¦o½†ï®Â¨;´ô¢rש1ÊóGš†0~÷vï†Ýãñ»d¶!|!8…8^Ì¿Èñ˛?ó<‚#!—,žÒñæ…Æn§†<‘Ð}¼×‚Žo# ȾÐˆQ3ŒÛ±ŸO„7ð ®Jžy!ðŸ«6ÿ’ûs1¾‰]ÊçgÜBFtv7­»eJc-Æ+H”~ƒ•àÅ{ӕ[üãîâc"Hõx ôäÐk2“=Ïۃ<ê‰}òܛ‰{“&;sZÅôLÑk^J\D‹è;q¢d|z›+^úyǵTÏF—²½ÉÔޙ+Ìürô[8H9Ïô»ÿ ÿ› +endstream +endobj +72 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F6 25 0 R +/F1 10 0 R +/F9 41 0 R +/F11 59 0 R +>> +endobj +70 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 72 0 R +>> +endobj +75 0 obj +<< +/Filter[/FlateDecode] +/Length 2648 +>> +stream +xÚÍ[Y“Û¸~ϯÐÛRe KÜ`œMU\ÙM%å¤RëyËU‰ö²Š#É:&Ž}A‚xŒ†šÙ—ሸî¯¿n4)JÓÅç…yüiñþîûŸèc”ñÅݧSˆÑÅJ($ÉâîÿH>–Ë%"ُÅá±þ±^Ÿ_Šå¿îþòýO¼m- ¢‹Ô´Ëm!k 3ÄD]øO"dÐ$H]áޖzSHɺðXØYԏã®Úéÿ¤.¸ìTÀ2qÝnt*PªÜ”’ -Cœ÷®æS—ý;\IŠ„Û‡ûwËÂõà Ž¢Í†,—+"eòCÐIÉn»€ÿLZ@x$˜#œ €‡JRdkã¶öŠdI O‚²Ì4úûa·‡“KA¸Êoån«Tò„"aš/~¼3â™yCRØ´Å*ÃHbÓŇ%Oaq+ʲ䰄?E•Û®.×+`¯X=[Ñ +`§sÄܞ”ÛpS¢®ƒacŒoś/™dFBaNk=±Ýêt0“ÝËSù˜Û%®4Ä´»+ºÚÎüùÔÙÿà%âx±Â0)Yëi¾Ýs¦0+'c¹;Hó”0«Ë-"Ê\m®·’øs( 0§hë]¸{#Ƈ°A†gsM÷Áà¼=Z´\1ʓ®¶›ÝcÌ¡‚€=†Íâ¦V !ìfð;+Ê¡¶a…ø4më*=ë¨s£3qà SV êvÙ³lr^Ÿ$ƒK›ˆ‰Áð eÒGB’7aª­õ¢XNâXîõ€3”’i}DN°Y$¶ ÷l›xU[2¶äÁW¯¢Hé) ¾Rs¥›êSö™êê“z)Á¸ þÉÖ&‹HôŒèK!ÂJ/4ʎ¿5½3 ò¤HŸy„ìl«"¯+LORøøðïzèM‘R ñ +ëatÍC¹Î—às<–ùCÈ»8pØÁc͞lÐj¨lâ±^¶Žã„û÷¡PS”:…KÜràµûýù ‰.W±æE³›Š…BxÐò*u¥XŒn„ë8} «ÆE.óp¸EوKÛé÷0_Šˆì=Ë ×y} ܺç”~N}„wªM×x³¿äSümw2*þ_8€2Éïï] øîŸçÓ)?Õ?KýPàÑ>[­g§Ò|ÊOîßÇ%§I^•›Òv¾-*[`úTɦ¨ªº»õîxÒý—zÖ-Hí,­C}˜Å‰Ž¿×øϑxDc~»\qp96Ú } pZ=߂ +š| ú#aw’obä½qOþ +cÚRH³cz""2FZõ53!±™€Þe]™êë.Ó<¨³°Èä2ÄU¯+–⤪wjSϟÏùç +|×oyß(X{Ȫ&¢‰cÁŸÖh|í[c³¬Ï.pR8A‡Ö—ãâˤ‡3¸Z"Mü‰›è‰M\f:JÑñ)¿Æ¶§9’ÆÙp_ü£”ëÐӕÚ` áY->z5I]@lM¥õÖ½ˆÔ´¾°WÓ¾ðk*í”û£×/Úѵ•Ä•$L¢Œ Gxd'°Áƒ×Ç`$QL %fWßÉD‰ð ¼ëÀ%åO avÇuÓ.öU¹¶á ({h~žXI6„Ù„ $øµ!("S”Y7è£Áp‹éT¤VÏA¥Ö:öUǽʓÕ4¥ŒâpÐë[EAôé‹ì>~SÚX“`3%¬÷D3-Ê#’!ó«ÆÍ/4ÿbtü©/Neò!¯ñKp ã€íåCUå^ÃQ²;Gc;3þ ¨mêšÇu~8åÆ@Û¬8„½¼µ6çí—s—?ÇSn_׸Yº^+×{±Þm7yî— ÒÇ=)µìGÐ +„ôÑ̾ˆÔÔü¤SÓ¾ˆà^;zý¢=Ž{4U:¢oâÃŃÙkÉëT/Ö¥p8¸Ó0ˆX£î?ÄTMœcŠ6D=Õw&ùC±=¹Ÿ $S0h‚ç`1ÀWéÔaó`XÑâ¾C>P*®E>J±¶ºÙŸ·†—j-à `¦$†7 ÿÆÁY:Pxj€âh ·žÈÌQÆl0 +Ö0¸áÅËI}Lr–ŸBf=Öû‘;Äw–ÒQÝn@Kˆg ÑL–¥/õ#uV ksêY%˄ò˜ÝTøFwÉI#¨,\܏Q[6lõX><§C™‡›¨ q6€OM4ot^y䰍¤Æ»Æê%iOë%Ž2#WSø&x6 ôŽaü®IÄüm6–Í®D3Ñ +îð´'Þº¿uÞª‰I{zÕW SqޔùIÛüÖu…}Ý6Múªïò +ˆºkcÓxm= 8>"Ô#hä’ÒíÒœz´«~©©36:5틐 y£×/ÚÑ{š¢ˆ e½éŽ µ ?†Œ{zåob«›b Úê‹É:ðî¬;„ꭚ +ƒÎl,£¦‘¶IÄқ˜1Š##ۉ½µ,3¯´§–T;“¨‰”¦-´>ã’6²Pzý°`Ìw¿÷Ö9é´»rä|ÕØùŠ«|n´aü 6ib×˝‹Ió:RqËg©@wrá~É#—ÂX‡ÏLŠ ›ßl\™¡àm5è̅jú¦®p¥,w»÷£ÊHy½_™¿òkÊä»ÈEÀOI…xξ \…‹.’Ÿ‹»cKã}Kë—\¬]×aÉ£’K^WrçϼòwHj.5¸‹‹“¤HÎ~]ëOհקɻ—VʐǽF.ïçu®ä—sniðÎòÞcé”úr°*—œ'}QIÛMËyƒóYƔÇbõ¯HèË¿„±¿CªÛŽYÿnÆ|çR¶™TúАÛ&¼joOEsWµ7÷1:hÛÜÇÄ¢¿ûüp*×»*?<øíS`›Ny]ÉôÕòXß'¨ák œöRoFuJÆ&åâi¹¾a\¦›ê‹U7[—»lÝó6·|µ;†)Û|gÉë¦toö†Ë¾•yU»I+œaoº’op Âò÷ù6¯ÚVÉÚ¤Ãè •ÝûM¢WIM%¼I‹ã±´×è:à@Òä¯ú¢¼¾•W¬›èï[<ª´Š^9vsäO`ΤÎܽMȸuÚt´i1Šg‰öŒ'-³š_Ê(¿„9pŽñË[s õÐ× _ðŠ6òjú2G¦éÄ º_{^óüߨ´nOd ­†ÍéôÇí%"×Èû­¤Û¼Jªsêâ[ ÆÓܹ͔t<¾Ñ4¾!³'ÒΒ´ÙwF¬íây_$¼œ½Pb²²üZöðë‰É±"åŽï}>ir1æÊ>]Äþõ#®]r]÷Ѳkž)½Y!uÖÄgØõ‹°¦îSú5ë!ÍöF·/¼ÑãeA vûeª#ÊP¯×Â!QÚiÙóéi¿F»Á§[YGXÝ@§¼*í ï:òy§ÐÎJƞǥ²è׆KeÉ–„% zÀÎûδ½ÆšÁ1_GI}±O<'ßËbðCÞDLŒ4›w‰4C`=†?—Géõ"+Iõ€"€uUëÙoþ) î8 +endstream +endobj +76 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F1 10 0 R +/F9 41 0 R +/F6 25 0 R +/F11 59 0 R +>> +endobj +74 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 76 0 R +>> +endobj +79 0 obj +<< +/Filter[/FlateDecode] +/Length 2700 +>> +stream +xÚÕ[M“㶽çW¨r1U^ÑÄ7¸k§Ê[¶SIùxç–I\”ĝe%Ž)ɉ÷ק(€W£±/#F³ñúu£g‘¥Y¶xX蟿.ÞÞ}õC¾@(ÍÙâîý‚d©”‹—©À‹»ïþ•ü£]²,iôŸ÷éòßw_|§ß"ö-.R†Fo-1Ošj³Ä2ù°Ä"¹Çœ/)ÇI¹\†’º0¿Ûêpz8uUì?ê6œ[¸yhê¢-Õ|_ýÀìLHæ)¡‹Lϲ5]AÒLvïïeš2Ö=-Þ,Wˆód㠁xJq?ÆÒ<¦ö±LIÞ?Å\ø’‘ÛÉ·ÉG¸•o…Iž|é‹j’Oc­Å!5±»bL•B|dd>r–ÊÝJ[̊Pž‚Y!šRª_yl»>¿.MŠºÚ¯T|‘ÊXƺ8 Óg׎mюL' ˜Jª½2¼_•Å•í¡H—+–ñ䟧² ®l+˜“$êžæÉV  …ÌŒ|Ìèÿp¨šÆÛv¿my¬6Mݘ;X]µÚ•`­Ý"ô²U÷¢6?–»]a‘”¼ö-”©­0|6ý¥ò[ Æ!ƒ‘iί7>2>a0ÌCˆäo(œ¥8¿Þ¾)ï·åüÅg)ÇaEÒўÊð¬1üÕ³4£Ïö b‹ÿù‹ÿùI‹÷…“"Š¨ØŽýlˆãõ„ÿë¼&¢y*îù#`¦4ٞô³È$2õO]ë:nšÝc]‹}cîÜ©ßǶQ°fðÒ¼~PcÆG=€êö¡›a_Ö¦u§†5à—wŽ7 +aOÇc¥¡SÃS°§uÁo…ÕB2~ò)­™˜ã<ï= Ñ /¬`]Õ][ýE+®6ÅǪÙ<>ÅJ©fØÿy֓§ùEëéßþÍÿô™5Mê<={s4/åsçKí[œ‚J1~—ßý&4-%“Ë喛Ü/2—¥tñß…^à†`Ð±ÅÎ60®»^¼szâî5=¥¸oôäDIàô4 nO™R1š½k°³¿½[P©–·BR(õ«uü­6´á}q<6ƒP;íC©øXÞáTkKcÀbŠc¹7í¤£BíÁcO À©WÝE±ÝVGË3[I÷)÷‡n* 1›êP˜™…öüšï ¡@ÃÙ`uG`O¨wÊm©ñà¨$x̜ ð•¶Ü;§´Â>ћ¸iAb÷i.ÛåŠf€Aõˆˆ7Ú~ÐïE„PE¹B$Ýý±h›ºô)H¼C¨´ê€ C¨R´ßv—•R•.OR­{ÓZ`=¦éþþPíþlžµþz°£&jz¢.ÀÑ\&ßoTdc5Q>¬Çój¿©´ŠEr,ê]w¥åǬ7sÓËöða‡¢­š™ ,Ì-3½¶å˜V¦Ù¡ƒUjv²;¤Ã`Ù½sÐÆ@a-àQTåÄbؘÑ4×/¾«”[8ßó„œ{9qÎÃè!°%{À!üxDðù(¸|5èµRÛꃝÚ=+|.‘¥‚^¢7³ö¤ÈS9Ù0ö@37ܨÄäÄùäÄÔ"/&÷ížZiR7í~ŠËP·HDÐ4­BöÕàbÈõZ„ÅÈa1&H“4•#Ôúî¤7Ù8°¸ƒ¯oÁÕÅôê.{IùЈGœó`¨O›w˜„øÂDž½—¡˜³ÉÉ! ™\0n2þ¸ í:- +}Jfç¤w ?g­$V{åw«P$£¨Ã…ÈÖ÷u·ä«$aäg +E0š5ðz:Úf)ÊGa® ‡¹3“DŸI3¾à„5w0ÅéR¤9úC×+;f-Øˉh›É|›öN碄2%·æ_õ±íͦPÄ5˜u9«ãÉðh¸,öEÝ<4qB7‡À +±õ@ºì¿kô„1ɨ§iðãgö®Áήt‚|pð—Üå_DPÅ¿È4ÿBJãî› ¢b>'ƒÂói␓Ä+·^FQbpE³˜µÉê˜õƽË:ð&Îçn¸§ùæ'ÜMØÄ%MሦÈõþÆË1=‰|b_ ¹3$Êv¯$ȃ†PùŸŽ?ìvå¶*Ž£HW¥žtVÞ Íċ`&~zM¢•‘ÁA+ɔÛ` \ 2 ž0&õ4 ´²³w vö0ZQp—ðëF‹™:EnA+1zq2ZDò¬úcžîwë™EÖÉÁkx/‹\ çÉ»2äڏ…‹Ù¥p1Fæ‰lûói¼í奣¾³³Š|$5“N;%EXˆ˜E³÷’ßd ›±Êã³Y«÷Õ®%…šQûœ*´l>obٙ젓ÓT\vQ•P%öD]eøTºP'Ú±D†h"c®Šõº*vM ‘.í9Gp—ÑK¹‘ÁGnbyŒ+ޖ +a#YýlC)|KáóéÝqþ%\ab<ñXa„½È’+{£»@ßOû_N¡}FaŸñø>CYL 9½Ëà‚Ä-†y9Š‘òYG×ÿ +€áä¡->VÀ¨ &e#Øà7áÒdYWRfÉ·:¨±|ã•ïŒ 8ÏHÔ¡ix¸¨14Wc©qJóOTøx§ i˜ŒÉ¨â¥0ùIDz:1ëí¥;j ð"F¬5ß6xN_D"¾È#ÅX(¬Ù’b*tEŠOuÕŽªÛ5z˜hÔÓ4ø¤Ø™½k°³‡I1ËòÁ¶Í#@øÐCe΍Á÷i‚Ì& ²ÂB:e:œ3dfÈÃÞ2äáið\ŽUT}SðX]ÈG¡O‰ùÆû«—€{–”E›iÄxET:G Âsóƒ4Á¼ƒ¼Íó3Ô$¹ëa›ÇǓæxþç#ҖsÅ0îSåÃsùƘ•Îê)ýi';ÚÉeú™³G×®3fjq|F*C±ÅÍN{ž¸°ðYÔïÕ°ú$G*Ô¾2ÔaT(/mPÙ$y>tµ“Î!“:8¡Ü=XÊBÇ#ýgøÚäÒAƒT“>OÖsÅQȼáëŽBÐK…3¥O(0¼¤”Hu¥xÉc í´AÜpíÁ²ÚfÂ^‰žûü?ÿmöĵŵóꬷ¡˜ˆÌ¼˜äŽ€jè]\»/í¬úü¹¾Í-J|ßÄOV9ÒîJ ª“ò0Ûɯ Â~•gPkà4«_í_üW©Íi Lióu³†ûMÓ*:–a§z2CçÅÛÐF” 'óµqR~a3Fªô×tú2X 'cåØì̒H¸ :H/ˆ-yèv‹æ¨þhTzÃýZªtrǶôëÕÈCÛ¡Tʦ+ÏU•’“¦«ºÒÇV•½>öÕ«¶¤£l?öÿ¡tØÔ§Cóªëa²Æ¦4Äþ€*yJfÍy¬iTÿ¥5Y7Î)ìf'—Ä!& Õx¨v÷ÐÔÜúÁxnÉÜûi$;ow?Ìûö>VÑØ9WåJ[y'þŸþ‚&>[ +endstream +endobj +80 0 obj +<< +/F9 41 0 R +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F6 25 0 R +/F1 10 0 R +>> +endobj +78 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 80 0 R +>> +endobj +83 0 obj +<< +/Type/Encoding +/Differences[0/x0/x1/x2/x3/x4/x5/x6/x7/x8/x9/xa/xb/xc/xd/xe/xf/x10/x11/x12/x13/x14/x15/x16/x17/x18/x19/x1a/x1b/x1c/x1d/x1e/x1f/x20/x21/x22/x23/x24/x25/x26/x27/x28/x29/x2a/x2b/x2c/x2d/x2e/x2f/x30/x31/x32/x33/x34/x35/x36/x37/x38/x39/x3a/x3b/x3c/x3d/x3e/x3f/x40/x41/x42/x43/x44/x45/x46/x47/x48/x49/x4a/x4b/x4c/x4d/x4e/x4f/x50/x51/x52/x53/x54/x55/x56/x57/x58/x59/x5a/x5b/x5c/x5d/x5e/x5f/x60/x61/x62/x63/x64/x65/x66/x67/x68/x69/x6a/x6b/x6c/x6d/x6e/x6f/x70/x71/x72/x73/x74/x75/x76/x77/x78/x79/x7a/x7b/x7c/x7d/x7e/x7f/x80/x81/x82/x83/x84/x85/x86/x87/x88/x89/x8a/x8b/x8c/x8d/x8e/x8f/x90/x91/x92/x93/x94/x95/x96/x97/x98/x99/x9a/x9b/x9c/x9d/x9e/x9f/xa0/xa1/xa2/xa3/xa4/xa5/xa6/xa7/xa8/xa9/xaa/xab/xac/xad/xae/xaf/xb0/xb1/xb2/xb3/xb4/xb5/xb6/xb7/xb8/xb9/xba/xbb/xbc/xbd/xbe/xbf/xc0/xc1/xc2/xc3/xc4/xc5/xc6/xc7/xc8/xc9/xca/xcb/xcc/xcd/xce/xcf/xd0/xd1/xd2/xd3/xd4/xd5/xd6/xd7/xd8/xd9/xda/xdb/xdc/xdd/xde/xdf/xe0/xe1/xe2/xe3/xe4/xe5/xe6/xe7/xe8/xe9/xea/xeb/xec/xed/xee/xef/xf0/xf1/xf2/xf3/xf4/xf5/xf6/xf7/xf8/xf9/xfa/xfb/xfc/xfd/xfe/xff] +>> +endobj +85 0 obj +<< +/Filter[/FlateDecode] +/Length 2843 +>> +stream +xÚå[KÛ8¾ï¯ÐžFÆÆñM%˜2™Í‹ALú¶½ÅV:l«#ËÙt~ýT‘E[”úݓì^š2ŸÅªb=>²“<Ëóä"1ÅoÉ/g?¾f !Y!’³ ×gÉRêLÑäìק¿ÖÛfßµu¹mKFtÚ´¥ý¨7¶<[è<­š¶Úš•ž§+rèºúó‚Ê´9_؆uUÛ!ëC…EúªlË÷õ®®Ú:[,9£éïnö˶Á±Ÿ‚§å³ÅÎþ•,‰Ê„€‚gœâêuµ[P•võ +‡Q‘šB¥ŸÕfc¾%¬º±¿WÛ­k§¶XÒ¢HÏ© .IZÙ Úúl³+;×ÛÖT­fÕl/7UW}ýZfH׏¯ÉÀ¿>¸öü]E&ÅìÂêxá#=ô.(€f SNþ›p蕃#¡Tã‘Ø0§N6É» 'u ÌöÔòõ±ž +•<ìi*ž“žpõ¾Â¯‡ÅázTŒÛÃôrÐY8Ûj¿wßëڕÕ9jW·•ý½ù¡Ú_¶' 4/2)ÿ/Bóg·NT»µcÚ§Cå,ŒF3dãs-P™ÃóoÑJVµ}[íÁ”ÛÞxŒÑ}ízôrU¢€06_mJª "|/_ ŠdQÁ78*i,Lm̍R`yÚjë¾[˜£Ý»¥ëÝy¼**@yØÕ«º³P©Æ´Ìt]ÛTº©·5RŽßç–büöØÙM×M9âî«m½ÜV]3%*ÏèÍÀŒâÇ$­Ö¶Äý`éL-~®Ãh²9ËmòbçýaµêµÚökvz6 ïJFÉðœáÅ8Ϻ¶ƒ^•;?Žºzn÷ªdÆH¸×jµ2Ë @/ ˆVô‡Ýª.;§pÎVõÞµŸŠŒè׍‡| ¦q–h~Û6—ˆ¥Í¾þj÷'¤Æ„NMÁ˄Éà“cxœgàåÀÅ̃¸wƒJÙ,T +ÖZô’?ì@ˆf šV¶!š’œg„M"pÞsæ‘$˜oIt3¥OBœ«‘UAO,§ážÉxd¬ )MßUôWÂg*Ù_ž>)ºªˆj ú‰Y§T<)[®blaú±ñ¢gßC“Å4¶–#¹Sa[5þ ¼øIàU„|&üºÊMò}'èŠ)šYäêÝáÒÝÖíL,sJ ˜A.†žf9Ún>·Wè\Etʛd;G㻯Jczð@Œkٛ¤ätz­„œ ÁÎ"ýy´…p†{é›»rS/4ÒJö ðé´:ëá0FîÞtÖ´ŸÝ5(n02‰ç&_²|H_Øèz°wçT‘±]̇“¿‹;ŸI “à<>K +g»mǓ,qW2­M±žÓŒo±»½…Ö;‡Ô+Ìå9&àíŲ$ ‰ +,šQŠ— §Ü&b;.}…MT`N:ÌÙ)@ä2ô¡GvIqX—Pw±á¯êeG¨!‘37u>¨¡*óˆaö•Ï«šS»YWE¾üéÖ®êÞ +q/žAA-2&æĹ›‚GP1H1® Ô;ˆEɇ÷ÎS2L"îîÞ.¦¤bæøØOÿü'›¤m˱cdà6{}úQE¯lׁ1«éC…)yœfuÚý.b8 +<8Î?êýaӕýíÖŸ/V¶¨F4côÞ±â¬s¤³±ž¾),÷ÎûK Ž5™y¦'ôGã!ë›埶dGô…¹òôÍÚ1uŒK Ø6aÈ„ÁëÎr|E·MÂÍUô†, æú!°·ch»`):…Y2È),·w¡ž–k´ö3¤ø!'¤ƒ,õÄ̧†"Ӂ¼ƒî¹d˜àƒ¹@ۖøÔнêsOòàÔþпÊC¨~u³ ø+AÔ1ªŠ \¨ª«ˆô”Ôú"ßÓVŒñ×`uW1¬n¼Öx÷Ú a@ ã= ÔØw€Á,$³„ ;~Œmó0üˆAiPšQ”"(M¡2Ånˆ€¾Æð‘ð*äÆH>EØýh¯¡Tï)/‘åöÝÇ÷>.“:§§žÿ€úügž`qxâ~žcR“õŒ"óÁ¶‰WÜ<ÆBFòþxå¢6!”ÇXìÍ៮¼®<0O¯ñôK0ˆíûºkë&‚jj´9žPjOV<ð±D‡GmÌǒç4•11€8Ñg=>x‰¾ëñXTô]Wq‡`À^'Óh†¡ÚwœF‡Š͒”NŒÍò2µ¼EVeŽ–+lha eŸ£Å9¥å–y}>Ÿƒˆ¢À {¿ªý w^Ã_ÎC[ƒ¥Ã·+÷ÿAþ-b ý¿]+ÛkÜqpʂ{Æ ÀÞ‰È „Ú콺s „’Oºí {øox-NS·Ùµ»»>¾_hšNdoNÛ ‚ ñ㜠T˜“¹ŠXÏË°gqšÚd-X½¯ð«ÿráR¨ÓR*‰G7Lr·¿ý »µÏH +endstream +endobj +86 0 obj +<< +/F3 16 0 R +/F1 10 0 R +/F9 41 0 R +/F5 22 0 R +/F10 52 0 R +/F4 19 0 R +/F6 25 0 R +/F12 62 0 R +/F11 59 0 R +/F13 84 0 R +>> +endobj +82 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 86 0 R +>> +endobj +89 0 obj +<< +/Filter[/FlateDecode] +/Length 2675 +>> +stream +xÚÕZYsä¶~ϯ˜<…S^ÂÄI0Ž]åÄq*©”+•Ý·L’âÎP2«fHíŽ7¿>Ý8HpRÒJZ9/Òg£Ï¯X¤(V·+óïO«ß¿ûò{º¢‚p±zw³âÑz•+MJ¶z÷Ý?2NØ:§”‰ìoÇþÔl/ÿmû®YÿóÝ_V|gf󥤒ÁìÊüÃÙ?4ûuÎË2;5·—öÜ¿¯ªÈN—»»uÎʬ?›CCt¶¯íЗzw¼ÜÙOm2ÜìËïå¸ +‘rU˜-þ¾Îuö•#Æ1p"æ‡ü;Z¡$Ué:㩒0á:ÿµ<3§Je;;&`üàÌ Ú¬í©.=α9·Û~ß{¶ÚüМÐF Ss&aö*ú…4+üy¬âãÌk’`BÉnDÄ0´ë=µv©¶[3•›n×7LɵÐUV۾Ú!µ ,üÙ®ÙïûóØìks»r= +–,#:*Â*7àM4_å…53™ss¦Eöµ¥¨‰Vb%ñ+©h™Âõ¸Ù]}¾ëý¡qìðÌɝ$*J¨¶¢fÞ®?›QºÌvõ5ž.æ‡ÎNçætòçãåŒËÛ®]k›Gñ› ømÿ&û ii@0n£·µ8óÁ ݬÉh}+¡‘ï9å îÔÐøW´Á²®wóð·Çÿ e >À +6Ƕ?º8þm0š+xæùIÛ-œÒhiØ›ÓÖqÐ4QXd×8Ò-5`á0¼„ḫtfuPÑ ©`2»é»]íÅRï›7¶)іèh÷ö¿s-ÄJ›†ÒÎìk¶ý®Ù0Yv­ã‰, /+:²*Ðg.‰`H>'…5÷mÝõ‘Fß©Ẅ́§ +üÔώ¾Âº¯ô9%ÖUvÑڒ(Pl× ¬2ý!‘^/È\H‰ÂY‹*Û®e‘Y!5¶c{Ävà¼ééή¹í"Š©äèú'Þ¤š¸UáOÔàš»x…ª89´˜¸£Á7²x.'ŠÏn^‘Â/ìœ%ׂè‰~}×nÛÚh8èÕöÇ&ÚBU„^ɤš¸nÊFOZi¼ŒY틈iR)ώÁ¶ÊêÚ¶¢“H"½SÞaŒNš€WUI!Fþ° ’¾’ځ/ö[Ÿšß&‚óà«Ä^éÙ{¨oÓà’]…1ð¸ˆü¨êrÔ»6&<ЏOeJYÍs¾|‚-°¼c’؃ðêˆ ^¢Gyýhü?Ò1K911ÅæEàÌ èÎx…£#?n}p'FÌë úà ZM> "Z4ªÚ¦ˆ¶ë÷gë¬ÞĄèÓŨK‘B?«ôed®ß¿ŸSÀOW#ð»fUI´çã¯ã¹;}oqJ­&®/ß +0¦ –÷P@­Lƒ/ Ê"tZÅúígøáË3µ>»_#ð«6!hf ÀËÛ¦Á戈¥öÍ!À'¶çšÍFÕJbèÁ];¬Â„ í*fÁ‰`¤°†’ˆO8‰cSçÕÜ!˜vˆN8O6èÐ)t‚Í#̈́£1t ó2_Մ«'!ˆ·˜œÂN€p ` +7oOçÿ…¾¶€%‡xçÃÇ8+¡h“³¨‡Ž¹Qr±bÂém<¼Ç„óɹKO*"ãÕ]Èlló&éÍÝ4ZÿMbo"ÒL+Å ª–¸/ÒÊAˆ¹ê¿]3‘9eÏS§¢¯¦TMÌ!Ä} +¨Âԏ9ŠP1Õ)ZhŒñ¡‘…2næü·*Óå4X”V!³il¡`×Bæx†œ(HVM»MCñ§õ$XT=I©1Í)]ÙÅdLÐtnÀÇj¿²m„”۞ƒj€5…†¦ÀK»öí¡=7Ãa +8êVNƒ'眑Š®c“hzûÕÛ`$s̎Ô}Cb$¬YNFچp¤a]¸»kwsf."(þÈdÜ°Ùñã:Iƶ«$›ÚÃݾÝÖöc,Ç—»Ò™T¸~ŽypÓÏqvÀÀò˜‰`sx">)c™¥ûêgÁ¦qA<ApÜæ:`€óU…N:_³NĚ&z6ö÷ŵA¶w떲I6n²CksÀ"¤·“?ÏüP¶åX<ü˜Jw†zƒñ]°ñ˜²xP¦­«1r¿†b •ÝYñS"¯‚“ãšxH9t)â¥SH1®çVc"¼HÏsפ0J=[x +"ü½;'ƒü°ñÚCǂ“¢üÄ0/0 +‰ÁŸ„¼äÒ}¸$*Vÿ–8:d†és‘l÷Gž¥D9èþò폘Ò,$ÍzDЉ¤Yiñ†•Åâù€Y©³oâ0zȯ7Vbä¼Nq^ÁV³i탧ËYX§ÆÅ$X*¸óDåQ@X~¡ê…Š +z2ÊÕôãk2)†ßE€«>€ùRa¡6Ȭ08R‰¡‘™Àbˆo°È ÖdÚà ɷ]˜'( 9S‚Ÿ¤tr¸·±€êÛ÷ïM.Õâ)L"©AHz\r»ÇsÐg¬MéM|ÞB@U˄Ï +¯O¦B%(6{-ŠÂºòž<™"%,<§Tڜ³Dq~>«„!Ÿåc+MŒ±ì‹˜T=F›Ï^©äs•Êð¨0þž:3«Æuž&p`a’ú|Lzäáx½dæl3a0T/š_âPµ8i9ã…q_£Ù¼˜UˆÇÁØ_†ÀX¿ŸZ…®žQs–þå;¦H¡Š¢üӉÒ& <Á/H;Ù§hgõú>û^íäOòÙËÞH/½ÐÉ9qDtT! +ÝTÔ ó‘ù˜ ¨*d¸ÿvÅ9?H*ŸñĬB¢%^A6>1SOí©r{ù¢nH/{!ý@1ëe¤Ÿ+椏÷Õò?YV¸ Žôq¶ø¨çGWÎòÑHvt¬¼ºw+_Ś=ÄüobÊ8–»þ™I³¨¦"!K…ªv€t þ;‘e 34,.g²¬ +Kh&ųe#à—¶K\¤‚1Ó깞7¨‡VjøÂuLt9áT÷4˜”ñ•vT<¸rp ©‘‚°p¤iˆ/'‚Ý}ð»{Œ{ejª˜ÿá‰þÐûý¾>¶½}É c³•s&LVLŸyÃÆ^óÝLXLíáD²vŽ‰Ú96/ÖÎq@ò¦X,>t Þ©Í> +endobj +88 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 90 0 R +>> +endobj +95 0 obj +<< +/Type/Font +/Subtype/Type1 +/Name/F14 +/FontDescriptor 94 0 R +/BaseFont/SJGZEG+CMEX10 +/FirstChar 33 +/LastChar 196 +/Widths[791.7 583.3 583.3 638.9 638.9 638.9 638.9 805.6 805.6 805.6 805.6 1277.8 +1277.8 811.1 811.1 875 875 666.7 666.7 666.7 666.7 666.7 666.7 888.9 888.9 888.9 +888.9 888.9 888.9 888.9 666.7 875 875 875 875 611.1 611.1 833.3 1111.1 472.2 555.6 +1111.1 1511.1 1111.1 1511.1 1111.1 1511.1 1055.6 944.4 472.2 833.3 833.3 833.3 833.3 +833.3 1444.4 1277.8 555.6 1111.1 1111.1 1111.1 1111.1 1111.1 944.4 1277.8 555.6 1000 +1444.4 555.6 1000 1444.4 472.2 472.2 527.8 527.8 527.8 527.8 666.7 666.7 1000 1000 +1000 1000 1055.6 1055.6 1055.6 777.8 666.7 666.7 450 450 450 450 777.8 777.8 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 0 0 0 0 0 458.3 458.3 416.7 416.7 +472.2 472.2 472.2 472.2 583.3 583.3 0 0 472.2 472.2 333.3 555.6 577.8 577.8 597.2 +597.2 736.1 736.1 527.8 527.8 583.3 583.3 583.3 583.3 750 750 750 750 1044.4 1044.4 +791.7 777.8] +>> +endobj +96 0 obj +<< +/Filter[/FlateDecode] +/Length 3190 +>> +stream +xÚÝ[[³Û¶~ï¯PŸBM,†¸pâÎ4M™N'“Ö~«Û }DŸp"‰Ž.nÝ_ß]$AaII>ç$™¾Ø‡¸.v»ßîB‹"/ŠÅýÂý÷íâë×_¼´ Ær«¯ß-D‘³Xi“—|ñú›dßÈZ÷Ï»|ùÏ×Yüùµ›%†YºÌ‹g½:½¿\ñ2kwMµmqÚ/U4Áä[nì|¯záfC¯~Ãu™Ìg"72Œøè{crrÖu>[®dÁ²öphªåJÝ-¹Î~¬ñCeõ¡9«dy[ä¥ ++Àþ aeö‡d#dð0®Ë·»d9ÁsÝ´&¨-L·W–Ì•¹R“Œ²yÙñé_)€‹¼çÑJ¨ìËåŠé²['"8º¡o–Ä6¬gFYÂ·rË«ÒJ”6b±b2—Òõüñí[Tœ`"óZTïñ‹e þWd­·ÛÆ·8£o¬ûñ,%ѹ•c>²bQæ¶ô"Ð +hȍëß% 0¹Õ‹®›VHñ´BÃ|>-§"çgº<⽌4‘Þ˜7é–VÃM@†n+ϧŸOõáØzÖ¡ÎÂ¥8î+¼ }“We^H/ ,B‹RÑp©šÿ6í29g½}(r¹ø÷B0֖Ȝmÿm@oÙb³xã¾Ýúq&çe÷Žƒõd<ÎÇãL.Ëx_ÿ=ì‹ö‹%VqŽf ‰*¬–ãÁÄÈðÙøŽ¾g¾jªTóY$Åkî8¡›pÓ#åŒW¹†¯®¿»¾6V!S†åO;<””Ùát·”Œ!ØõŒ££”"»Ûc{}ð=»cíÇ¿ÉÖµ›°÷3únØÏÍkR³Ç¹Ìu·óßS²BO¾\•Bf¯ê`´D»Yg¤ëÔª2äдiì;9e¹$ÌËÔ÷« ê7öîǔ)Ðx=–a¿(t5º„î »¦ ;-;mØËA3~ŸÎUx¹:çvÎ$•›Ø²ƒªÍrÿmZ§A©S•Åà­RJ#y½@›_‚Š¾§W:žòf’¸ÈvíÑý%'* è²¼2‡DJ₮Ÿ¶*oËP‰‰ Õ J’’ò⣈®»÷ÁÄeî“óÐóbmKÁ`åtQL3Ô»uë?¼¥–ã`¨`‚—CZìvn„XÂô¶Íé̾>ÜÕ!ĉ¢6p1rû¦r 6µù¬Ú¿m0k꣝ FÍÞõ4DʂåZߊ]ƒ¯¬s·9­ÉT¼)tÉõœ ž5ÁâA&X<©£rÑ}Ç=_ ÓÄíͱùЌ€‡Óvinµ¯7UȸžÏÚýºÙÕ©¢6ÎÄtGgKxg&õ=JÜàÓؔNÛ¡úü‘ •¿ +Ïóö^ĬôÏ^Ä}šDŸƒoMy+r¦Ñ·¹}Âv?wé2üÒenC&Ç$™Î;¬<ýñ¢L¢ñõ”ϽXç`n ž¢'QˆÍSH„ÜD(4P#Kt¸ñHא‚§h÷®¡ßO²àˆ#ð¤4¾Îk? ž$f„ã™àIF‘Ð/^MÇ8]L¢'øC¨_ ?Å´9%­¥vœ—úC3«˜bCݕô¯ÖŒý+.O\"À"S~W•Ô&ùàÑJ?€HwD8ðv…‘6‹Q²gï5‰² îR3Ù1x)_És_‚Wh§*ϝ*|˜©‡ø6øÕz€A)IÓù`–‚jÖøb Èí¦ ºZ&N‚õb¬Ð¤êC—éŸÏ=%Pƒ½2 d'’@_ú.$F<€/!ܓ'›CûŒzÿxŽy¦Ì¥ò®wÂî ©Šé¡°tüâöQ¿þÒü¬B ÔÕ×®¡¤Õ*odòi™¼Ú]2ÈûæB¥ã±ù°T"ýY÷¶pô`Ä7vˆ­ëÁñy *6îÙØÏ÷µi‰éU=W›†³®taº•ü©RüN皏š\5y)âŸ*a…ü©’d¢Òš!Ï6û‹# ‹}ïK§ÅtR ±´½ Y Ñý„2Íðñè—)W½ð¶cÃÌǏT‰B)Hœ»Ú!ÈX> žF.#ºŸ3òEsdf>õaÙƏ^ –æڐäiÏÝÕ$ a©?uÝs˜ ³ Ì"ÌÙ£ +C>­0"óÃ죭«NûpaŒF+Ï Æøw¬Œ+1„98†uï@÷?#ÅšÏ +endstream +endobj +97 0 obj +<< +/F9 41 0 R +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F10 52 0 R +/F1 10 0 R +/F6 25 0 R +/F11 59 0 R +/F13 84 0 R +/F12 62 0 R +/F14 95 0 R +>> +endobj +92 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 97 0 R +>> +endobj +100 0 obj +<< +/Filter[/FlateDecode] +/Length 2801 +>> +stream +xÚÕZY“Û¸~ϯPžLUF4qÀºöagSI¥6N|¨Š]³\1š'Uý±Øï+œûú{1ÎZ1ž +ºXÑ<åfVa‡l!S-ÍÂ) žjÛÿ_³}¶XÉTiÓR»t˜!RÂ`vþŽØ^PÂӜ/¨ù#¾]®¨”É]ÐFr\Ï®ó)BV.+’J=Òõú{>N—©T‹¡ÿ?° %Éåt¹"¹ ~QJaÐs“_HƒÇ 8*í9™-´ë¬.‰4g#õwËÈñ(q³C²I†Ó6²Õ”ì©èùqÑ{§ú6¤›¦œ£;?%ré‹<Ø?Q80q¦‘€4ÂRýkSÇóåJRF&Újl:”/ÍRª¯gÒ1µïx–#;%@oöÊtnÏß]¤šŽí›GíÜ;¡6ŽüÛ®ßl}µTɶ°ßKpÜe[ÝQ!צM&›rk»uҕë¦Þ¸±E»/m;yUÖK*“C½®Š}sš`‡¼?ì÷\ÔŶ¹/z§Ê]°ûmµ+†¨“Aœø߂Ãi2”xªÝØ@~oqÔuP;~È¡!2֔“‘¶Á©R.'»»†qwd: ™žg)³âùk¹ÛÁ X!ƒm&aUûªÍÒ\Nf¾¯ŠÀ@˜ò¥žE͇°×ÝG=ÑúÁ85œ‰ƒéë%×ÉACÙuUS—؁H b64U}0ùG°¾N³¾3]®TF“÷‡‡\½©­ÖâºëÍ ŠØS¶¶µÁ?÷uxPÎÐi•3ö'ËzwAmo>ñ:C$ú!ä +E‡k{Ë®êöEm Á²¾YòÓ¡¨!Àïr[îÊ’ù·©"h„bt9ƒI7Á\tÞ+y 1OÙÄ3y˜Ž¡r¾ÌÄ@ ꂥ@Ñ|N´wå$†ÎOáÿؙ‹)K…Oå£û:Xþì)Ò -®ŒY;jϪÀ FâRÆ0Ž‡q µi–@çǏ1ŽgÜ°ò‡`oŽl¸ˆqb‚¡­óZ1ÅS%|/þݒŠ¼>á¶iÑCׅNô,ÏõEª L£ž"îKÛÓ\,¹ä F2¥¬3cJǝv¬Í™ÊÎöÔû҄:• )Û®«($ŸyàËUé‰EâÎsúěre… +e¹/ìukGÌH{E¢Üew—d’ƒ© :ï,A< ’&æÎy>:ŽÐë1¼DÝø€ ÅESÑ»«ÒD—Žœ5cgb˜ÙÌL½¸³kw_4Ïáì 8;þq +ùÕ)dÓԂ¾-·G¶TÁ·4½hh®ëʺð¤ù€*Þ·ÅS…fD |ÛÖ«#4:ò›H^Ãð׋𠸨iÆü0†_¨Æ ÷«áñ< ¯2vA(æwž¡ø¤òœÏÀãúØ¿üÂSƬ„ž´’­8#Éße(ß"$ÎSêÇÌMµkº}ëÜñ“æ]˜éó_Åë1CC¬TÉ¥*f$L.ƒ +ªµ9±±O@Œ‡øŽÉ}žôñݺ®Ð=ºÕ˜+ãÞZrÛâh/vnVcòƒ¨¼ì¬Š¥Ç+A$8« +ÎÚU»j[Z‹m_Œ(×å&`À´*ᘰóã°ÖYk ®!6R#0ôGš†°*áíÞ7 »{‚‚|ƒXoþ‡Æk«Òp]Ä2 + ?6Eëš #D(Y^WO £Ê rß[à×Þ Ó/Ûªég—á́¬ +ŒÃ¥0ÆB$Ð3–Q;ª^;ꦶ?뻊¶ÍIq×ÔÍôén™:EÁ‡¦o½ƒáTÆ1©Ùº £)C>ºÛŽXQâºf×)÷ÎVežè'0ŸMª2Œ¨XO¢U-±0r^Q†3e‘¶(ƒEl=R”PŸMdÌ_ž§%!'%™°À R=+R²SPƒ +YPx»VÂ/¸;Ù…à܀ÿŒii']ªç˜™Óôbg“ÒK/ Ë$5Wa¦*2…¶$´¿„IÃÊG£æds‰$l°Β·Õº¿ùÔ&r€µ åhT†s¡òc`£~EòS¬Ö:ä“rVXïš þ×Ö Lwo‚áå Äò3º)vÂMIîå×@c·n«GÃÀˆB)}ŽF9…ŽàV>šß´d Ø…Ós›«e¸hË©èmk¼g,¹ïS$«Œ&ëÆF¯¶Ùn –°›Œ±Áƒ•`®•‚{. +ˆ_ŸJhOÕû&¼….?É@¤DGÒ¦œàBÛè!< 6Z&!â35-ÛL¯Kùà¯û#Ø›T̬o?Ê §W/É&uʔ}f Ï ò*ÏDòöPÿt(-m–F6ARM( ù`YXÛ–¡.fU™ü³.R" ùèçfq·4åÒV(.ß°­¿|3íKÁÀY¹á£ð°¯ÚÚÖÞÃ`Ûsü†mˆñÛà ;ÈÃó¸BÄ¿°ÜC*WB7½¦˜7Oo0ęg7ÛWº" q&Œ¸³`“gæPσM–æ rš!ꚽÌFxóKߪTë ؔdlJ«ÝØ_Àк&dN+§&¥‘É©ÌÏD¬‚p/NK ÉÒT²ùX,#WNû(&a^,Gâl£DpPØÿ1ŽN‘‰Tå_-«Ð£x:w +ƒþ Ë +Ãu6Êã3^l&o¬>‚¥«‡³‚¥)׳‚•¥ì‹me©ŠÉ“Óqäçèëœ|ì$€P˜«¼@x¬ŽTáÃë´§X\V3˜'æåÀQu=’ \+Qe7öwU¿r^ˆñ®ür;ö&ësdêàŽO}ŠœfØõ|€Yå0MfûêPƒ ÙO0œÐî¦Âø€Èað]R÷Í]YwmíÊ]µÚ•û¶Z7º Qc(æ6㐢á,݆á¦ñ²‰¥ÂÜLfŽL¶ð³xp¡¼v¯yªƒšJþ¦ÄðÆy¨ÊŽ@zۍûó®mpØd@3Ð -CO »¾w#›®+ÛÇ*|îãPI…Ùßg$÷e]¶ÀÓ | ã…Vø$Ë +q(G>¢Ë/ð”yEÿ•»1÷)ö0mHX¢o(§÷ÛX5y°Õ ùAmµ‹1ÁœØÑCîúPY‡ørshÛ2bùøäteP_—<_ùb¸š%“Û¥" `ÓÂÖ"²e,7èió«j÷°­ÖÅÓX%®lÓÚfçjɽݸÊu³sµÜ¾æ¾oúÒ¡»íÊûƒ}¸¶w ïKÀ¶îõY¬rhÁØíRC4#­‘†ÉætÊâCi8RƎ9.¿bíP© œU‹Ã¹œFk‡¶òc› /çÇÅ#X*¼~>éQ((ä¹ÅK¥’÷‘Z œæÌÄß޽꙱-®Šb¸ ˆ=±ñ©`みÀKæ@ÌUI~?rpHëÒÐׁ–`µVâûB˜³Úßüx˜% +endstream +endobj +101 0 obj +<< +/F9 41 0 R +/F3 16 0 R +/F5 22 0 R +/F10 52 0 R +/F12 62 0 R +/F4 19 0 R +/F1 10 0 R +/F6 25 0 R +/F11 59 0 R +/F13 84 0 R +>> +endobj +99 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 101 0 R +>> +endobj +104 0 obj +<< +/Filter[/FlateDecode] +/Length 2843 +>> +stream +xÚåZ[“Û¶~ï¯PójÆBˆ "ž<ÔNÒIÇÓvâíS”v¸v©DnHj›ì¯ï9HKH^_¦µÛ—%…ëÁÁwnw•“<_Ý®ì㏫W_}¯V”U¬®nV<'UµÚ”‘luõíOÙ_»u‘g­ýsCÖ?_ýiõݕÅçY¥$f­Y™én½aReímcpâWßóQ¢XåvtãzÅÜKsÂ}'seÐI S¾÷Ï®—G½ªò½½©›v±5SD0?bËŠÒ  ùJ%qœ†­á<”.Ø¢"J­6ӽءšÏÈÄL¾eƒ*Ø`¯q•Æ ZåÙ®=j÷Ö·w]MÖÁòìGӟCí:Z¼€û{Su³f2–BnhUûPA„xGmw¥ˆ°[VÊÅ^”“’züºØ¡$ebêü°–ï~ëúï¥qeÁ)î@Á\–g,Ï×^‚/#¬:_Ž‚¸^ý ¶¯¤FzaŠÌ¸Ÿí {ól!•»Û/V/I>n½Í–'Š`ûD$ó R†Hx¾Þвï;6Ñj4àíz¡½ŠT¥ïýýrn‰7ézs§%´87öQ”ðD$ý7•àœ2hBážÖš‹Ñ {ԔyfødÙÕº¢™n;}¬±‚s1þå¤Ý—uW_›ÆèÎ ežÕ××àIZ7®>Ú®^ê¼?ã®ôóîAªó*‡Æ~«q™ÖøE…Õy…èò½Â½R~9Õεz½ôÆ_“茷ºoqܽ½ŽûuQd¨zp/ǶººÓSX͉Xýk%`ÛO žžÇ¹!„«Ãêu0’ùîFVˆŒ±!1at áȊíîæÝ_\­4"ÚxAhiOù—(Ü ’(Ëêf‡‘è B+¯²žœÚvwЃ~xÀ†\….ºû»úÁ¸Ž^Í樇ÎìlôcŠµ…û5÷ÆMºi›=î¿q×@%b*¸…¡>h§wsô.´êæ¡&qóuç« ãÄYÑ·>ø>˜¶ÁùŠfœp¥B*ôߜ¼} ŽÜ-’{ãáÙÎj^œ=ò¬[ •éÁìl†uh §Æþv H’z’Aý¸ÞT`‹%nÈ?–am/÷öôxjA˜ð¿<Óú¾}Ê9{dŠ*2Åéhö²¥|²Õ¸àÉ_;è”ÈÈ "ÐÚŘŽCw"òÌjŸæîPéÁñ÷[oð Ä»ÜÆÅ@àâü’b8]*ÆÊè$;ºÃBKr4úàÖë¦oÝ« À &`^ãŽx² Xê~4!%H.Bê½ÀPkv0úe}Ú½ùÍ½Û áiͼÈ+n4hª‰c†Šnx +sÎ>š{më‘[½]Ÿ+F¼gb¬ðüÚ:ˆ"kÚÁ¾•Ù쓠Ùù$ìMFìǑ‘£‚†úλªÆO3 .6t­Í÷í0ø‘7õâ@<à'ÒýîpêÍýNB‘|DAgnôm‰‚ëèÌèoñv™Â،»óHõ µs1ãuŸ²¬iÓ$“m5Áùñd}Ä(&¢xïÊÁ> %¬nŸ âAwõpê¼øA<€_Ûm‡.Ý£&h‚ÊPþžÚ/pK·}óà7_¾×ÿ4ÍÞýz4â·möª›½v§Æ=!à ¢ÇE"åQXÂ9¹‹Ø龯;q]ì(ÃûiÁÒ¡­÷‚—ˆ³ï:¨ïŒœ±WUV»É~q-Nì[àkMÓ}ÔK©úÓXԘ¶ ¤Áˆ¸…SßÌxC(vÌÑ µlêS ™‹¶A »•¥[y±âhª©ë"äÕZ‰9'…w°ìl€…tDBÕÊó’Hé ~š‡`Š[gˆÏÑÕ3¸¢”_€QåY?r œfßõ¦GépíÚGŽ¶KG +)ˆâ±†c†@Æw‘æ‹@`XÕæAŠˆâ`˜\Ü1wù5á÷&Úé´g P²Ùµ>(‘i”euIDŠX¡. ¹ zãbl Ó^AP)C«f‘ Q‹-$¬ÊÞ «çXB=À]°BgTùØAÑ%ÐÄ\ć'XÐn¶›P(¹©ú ӎԁ5‹kæ²·Ü¥œY ³¾O÷›JïýAîƝXT(-Ïfz)¢ìÑÖPþvÔƉxjË8pÎÎR<§˜ÓÕ7ÊXVÉ#£ä”Naoz†¤õgËl'Q_ÄIlJq–~˜ Ä_Èr8lîÍÈ,Içêåõ —TT†*òèaª@·máãcp=Bbfæé¶ $#©Cg:ªóVo¹,Èû~ZDA^3ž¤öG¹N};äc‘ðsâ+K„ÅdûY)ÿÜØ¿¥sqlºÄg˜@½¨ÝUØh/hüy&]’@’5óûDš«‹p‚‘Ó€ÄùüÉõ«‹Ýð‚9¦L¼ooµ>Æpc°LˆZO°U…Տý7ò‚|½Þ’†Ä­*Š/mÞ×ÏÆ…ãm=ÂOƒ9Ää#äs‡1¯k,Ÿ¹ 0{Ï_ü8·ÃIo|~Kžš3Ÿ÷–Ç‚gú gê|%¨ÄÙ²46ÙK’ãr²„ýL+;¶W¸OøìOV8‘m·øõ}@Öõ ?$ųy­W $OT¤²²’ÙšúÐÞF¼ 2tpÛfd µE 1§Ó\f·6¥È¡*2q½±‰ÏµMù1û]þ# D[ñ±Ì=¶‰Ì ‡Ÿƒ5‚¥?8k'éO?Œ¾ÔÑ0ÔS§Llüž A$Ë+˜’•øõãÿ)Çܕ¥É±ræÆ>ƒ„ð)éÔn _Ž¹1˜Ñá3§² â,_ÂoCÈXÛ£»G*J #͉À +™$[ +Ÿdüîßÿ²9 +endstream +endobj +105 0 obj +<< +/F9 41 0 R +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F6 25 0 R +/F10 52 0 R +/F1 10 0 R +>> +endobj +103 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 105 0 R +>> +endobj +108 0 obj +<< +/Filter[/FlateDecode] +/Length 3108 +>> +stream +xÚí[[Ûº~ï¯ðéKd fÄ«¨ž¶@šžiƒ¢m¶@³çZ[Ù•­$§Ùüúΐ”D­(Û{K“´/–DRÔp8—ofèELâxq¹0—?,~wöì¥XPJR¹8{»à1Ñz±Rš$lqöû£s¦’åOg|ö’Æ‹„¤ ŽJ K+J´òÚöËaE˜ZtÝßÛn>tKÂÄ"6¿ ÌM'S{ïHû¹¯–+¦¢¼^®×Q±Ûë¬Îñ)‰ÊܶÖy™}*ª]a›7OªzSì\gÞ5æï÷Ň¥äQVæ»O6+˜ÐŽ:&KdIJ„r«xíÖè1’rÂ\ï?'/›µÆ>wD;?~sE•Š6Â`Îñp´=çK˂ +‡-Vú©¦J¢º7Õ®r,ËÛ6w¢Ærٓ5§„Â(á’%Q J+Y üÅ+‹ò¦hZ3>öKF£uÕ´Ù9o_ Æ0€L7E ¢‰˜*°Žubü¯)õ -`<ÇmŠ$ÛÞ?MßMHÜÍÜf¥#iN2„Ä›ŽàJ`™”1ÚÁÃJûÑ©Îõ”rMbîFa˜h5(M·ìÁ1xóö›û{ziü,kIˆN-XÂÙmñ*a¡mQ$ýü»²â HVÀÑóáSu îíæÜR ›Nîñµìö”…½Ÿ# â1Qù݈Œ^Y‚šürŸ÷‰-e¾Ýº[k Ý8âǂ8Öz’DS‰“¯xn 9̎YÆ2â„sÏl?{™ú$s"à}£Àß쯮–2ŽX;fml¸”ÖØÁµZŠ4º4(º‹]›×²?•U`K$‰;Æü8aLKf8ŸDÓ9áþd{½eh¢´ëCƵ“ˆ¯ÒAóÁA¿˜¬.AÞzå&oR’v¼/³·K¬á‘Öçx>61›¢Ôt0ñS"Ò0èö‹ ¨žr7È&èj@Ð‘¡_g§_×ÅóÀ×}ùzòu‡a\?*ŸÐÑó%È,PV5ÒáhÚïÜM³_c³áHÞ4‹ó€ëӃ_?b³„£Òö„íà_ù&qüä€Ü ÂO×:5£ujVë’A«Á+È¥HDÔÁ @Ž\Ú3àæ‹l¿~w ÷ÀÔºh®Ãs*ۛ°ZBzêއ%O{’—ÛO»KS••»Ã&ý•Š ÝÐkºQÇøÃÉìÄæsس6_±ù,æ$ÿ·ù_²ÍKõÔèφ#V_œlõSzÔêëyÕ¬wMÖæ+°ùдùéQõÑóÚ#û/£Á×Iô¦ÈvSAlPÓ°¤¨£ö[6ßzÞzëN„­ÓF„œŽéyšaò#Yx©gã:0òc7O >Nt!Ä= ˜u¯‡¡ª÷/çA<Í-^Ýsñÿ dHƒa"0àtO•Û^ÓA`îˆ&FÒ(g¤Ññäc(g˜ž~²¹¬ë§Ö ³C^xbƒ¡òv†`6}õð'qT?K%у„ fj‚N ÈCAc4)%I”EE6¡ ‚aý˜ÈWtp˜Ãã¾ñ‰ Oì0Íx›Ý¾ucw¹/OŽafùÐvvd%ûNƒ?o¾mSEâI5@5ôàž{ t¹—K?Y™^å);¤tąj ԗÞÿÅêÂ8—”Ù(ÅäXº ÅU¨Fs$)Pـö¯C†0¦‡Böþ˜Í´€ÑˆÔD̅ì)ÓÀÃ4ÌÃ×òÆoS60,pämˆ Oütµâž@<®pci·!pD-âò¡mè ݇·!˜9ék¸.7u‡0½¡œ˜291ÑCd̘ô!˜<ï­ÛTbxÐãžvXúï‚ÍÕ¶ˆvÙAí§žo“üèVeçí‘ežÆÖÁ¥ô†ƒK[ŠƒNf+Ÿ5μITãD*Ò߅RVª—(ùÜ^Þïñô·½7°®à׃LYhŔ'C ç!Ü3à"áN\˜Â°¡dã(âs9rx‘Ò;ü¹¶ñ²=v®Bä*†å‹¯ÇePú ÞÇz­0 ðb@úB‰ž'ï÷î oe‡vá=/l+! Ífžà3'Îkw¼¸tþœ‚â£"Äk(\ë¨í¨° +9ͱŠd@^'&Yq1±pGౚïuzCX¡!$¬LªVXÙXXaáFtêDSõ¢‰}Ù®?&Ȝ£Õ;Íòí`Fë˜ôè/Þ¿P$5&]€Op•I¼µÇUW:N¢W»ªlëA3/ôÄaefghúôxÓºÖÕöªÌÛüÓ'×àsqo9SÞ8rœ`‰yÆçП`Ãï_6ã#õ'Á*¬!âpú93ÿc“ äÅÔÍLB˜G¯JË0§"0=ï {Ý끯áä;ÎJ?÷„ø\*¢õ6ê!ŠhOmýtcNۂsÚöØí&ßì×ÁRå½ðœü2ë㄰:$ÊtÀ´Ë:ûTtǦKÛÖ +4Ùc ²3˜¿þ€s¯žºtî* hÌ•Oö»b]´ÖïiBbæ/wÙ&“-é2P;ûR:ª¾Ö8ó@ú…œK8 +XC*£Ì•j&¢N€Ç-ã°1%ã@Ì;Ì|* ðÉQ©bâçE¥»HvJ †ØËuÚçÀ8˜OùãÌó4%:|×=÷ßÅ šÃêÂËÎËT¢1•p"`ï(¾¿£€%\X¾½*ªÃù}EM8‰3üð¡Ø¸?ÉåÛîæ) +:3@‚‰¤Ïë3¡#û7¸ÚLš„ÿš«÷mëþ÷jà»mâË ±q”nµ]çQe¾Ê£«Âôµ’°÷\Õùºh²1½Â}Q;²7Åv›oŠ¬uëª®Ê2«‹ÊTÖíl‰f¶ÓWÄúx=?w¼üe÷òn]çmõ+kb ûzŸ1ŽÕ¸ešý"ª.Š¼u!¬ xO­E€¾÷XÉì}“ã?Œ ª£Ô1¶¨mØ)€° +,–‚0äùnm³à¦ÕÝØÙË63¯wǵT€NñÜn½ù™tÒñ‹ÿ\@gA +endstream +endobj +109 0 obj +<< +/F4 19 0 R +/F10 52 0 R +/F5 22 0 R +/F3 16 0 R +/F12 62 0 R +/F1 10 0 R +/F9 41 0 R +/F6 25 0 R +>> +endobj +107 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 109 0 R +>> +endobj +112 0 obj +<< +/Filter[/FlateDecode] +/Length 3079 +>> +stream +xÚíZK¯ÛÆÞ÷W(ޘB-†óä0mã- +/j(%-¯¥H•¤Ü؋þöž3r(Rºò½NA÷’óÐ̙ó>ßp•¥Y¶º[ÙÇ«?¾þú{¶"$-Äêõ»ËR¥V©Òœ®^÷cÒOõšæI߬7\ÉÎÀ“ódK¥XsI ís§±E¢³ÛKà®Ü›U>™qßÝë¦Õ;;.én§Ý€?PŽêx(+Ó;5UER‚šqƓ×k•%eéV•É»óïucRKۋ×`+®PšB%Š I|iI“,éôÝÉ*<“|\ÞÀÇÆÏñúÖu~ì^öډ ^u¥Ú٘q?Cî•np×tf¿ù—nh»-«cÉS!bîÝé·-LãÈt¶®ÌÁôö  Y•‘:f NA)þ6Ó•Ê ËOž9»÷â7֊a§¾$„M<°Õq;VOËævž€]UvÙ•Ž4ÔôÁ³À¨ç•ÿ)ꀷî ÉÀñ©ƒeœúµ‘'%ª³(ð7³£"éʶ¬koHeU=m,e»]Ó¶^waÀÔ{ §7Ïpžô'd4z,S:s¬Á™x[Üy_†kmÍÝ&ö@Î$ÁÕue)j¦È“­_Š‘à:Iâ‡,Ù¸ŸPI埝Þk$JÊd×ê½)mæ›ì¼¦: ~®½kGsêÝîh(sÿŒÌu×T^ï­ÂàKP4¢:˜áÁ8êeã†" ç8[¤Õ õízɒ +¥%ãmWmj<H]Q½;¡ÃW –ê#{;}0çH7¾MœÖŠQk))£ƒRorpwvŸ§”û)of+äi‘žòü§"¥Âþ¼ôK9úXâÛϬ +^X0«íÚ ƒ–}A·iÏ_37Mk¼ß/ŠTÒXŒÇ¶9‚ë‹<ð>/lxeŠ ÓÑV+Tf£Ukޞ¬¸¤ô†AýÖÉ¡š(ÍKeJT ™ærv¨<ÍÂøÆꐕ$®ï´(êtÝù¾c«w¦Ã)îtœ¥TƧƒ ¢ò>ÝT/ŒGµùd@e\W×@(ÿÆCFb2\2%ο‹~†+1™°”å‘rN#4£0Š‘–¤9³+ü½v‘ÎÇbb`éë$Ž7syÓbÈԕ£”U]PVñ`eåה5¿EY騬çùŒJ³|P TÄ\X½nímšu¾ƒÏ£$jPËZQ´®Ñ`ã®6³Š"e!ºýâøÝh8ï§Ã@ú"X0-/TMÃåDuR’;ÈÝN˜O¯°Á›'„”‚8.̵і¶KSŒ1û—ÙàÈU…dc@ÿ¸°-ag’æ±²PrQ“pá %Ÿ0Qª8Õ¤a…ëf°x¨[7?ßVŒJ~ýToæG _§øãla•ª/A0ÆšçÉs|¨$sçsZ$zÎìá +uƒ>ýükéӛë}¸>Ýd$P§)³ØòºŸ¯Myq#³îS§Ë²ŸÇQð” Ç2rVgÁ”CY ÁT]¦,-ŠÆI˜åV0;—ï±Jý÷Ú½`º‡Ï… ©Íý!ÒJšÿfclAç1vÉ‚zíµ¯YNSÅâÄ +s=y5×ãEZ°ÏNõΉæy*Ã, Ú„«;ø eԊ¼t/ÝÉJՊ²V§YTaaû[7àƗ0 +!uH»¯K´×ˆdN6ö@«K´1œS/ؐy‡ñå4ˆÆ¨ÎÞÀ‘àƒD{RÊNŽÍ܁Ñ®¸)¿ù¼ùì¼2•ä¾ó²{Λ•ïËʗÜΘEvcr¦dzÍAf³œ…ÌÂ`D›³°«áe16©â ¤p×Cî%á>@—˜o±¥.ìOh¼ÿ„¦‹:Wyàې¢a#²Xh5K¥GAF_ÿøÚcI~_íy¤UÆàuK&ýr®çPIQ*Me>'—Žzqõ¤Mo/6^^Àè† G›Ñ æƒêŒö2ùæ"¶Ö]yviy–æa´¶.¬ÒΧ‚ÆA&ð,pg`i$/ úƒÙOml‡÷¾a}+<Ã÷ Æ]ØRIsð·˜]ïo«)PÅ'nÓÕ˜ý—.ʟ]fY/]L£x裱+ÛnADrò« áW–õ—²'{‘·¸OÝeµÿæ­ñPl· ÁûIúYhàÙó+.c~`#¤ÍXì]¯) »Q²¿5Ä.À«ãù®‰½3\zIœxùíâ(‘Ë)¬g×=Œp‘˜¼#R>æâ:¢g¿—‘(ºzŽ·*ž*ú(ÀM<€¢rÜæuêÈ̓ѱûÐÀA1çØ&fö ÀÚµliA²Ù]5tðúqN2ù&ÌGàbF¦ÂB™+þÏ<Qï ýŒý#ùôn@Äð˜È§qpšä˜ +r¶F qùçtüBâ«ùGK´ÿÑQ5µ<®ÚY8ù ¿ù™@ÙËgwÈçSpâIÆR†»a6 ß',ùðÊølRÿgñ—)xóø¿l„¢$X…Žþ·àqÑN"~l@E‘ZáR¶̬ êwYxøÕ[¡Ã1~'ð<›SÊQÁ€ëÊE˜Cø¸O"L8ò»œ°P¿Ö}émWÕ_Òù,^A¾¹<~ØMȂcžê™¼yÄ èÿÙz_ZÈuTàê]ÈØÀ£©Õ¿Á‘*ëT$U)ÏW‡“YÊøÐQ­^cçr‰ WBþ'Eìî¢ãÚ-Y(nM;°ë÷d¹ÄG¸“Ç‘'ö—„Sô§àÄÑÕÛcK´ßýæOj~ +endstream +endobj +113 0 obj +<< +/F3 16 0 R +/F9 41 0 R +/F6 25 0 R +/F5 22 0 R +/F4 19 0 R +/F1 10 0 R +/F10 52 0 R +/F11 59 0 R +/F14 95 0 R +/F12 62 0 R +>> +endobj +111 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 113 0 R +>> +endobj +118 0 obj +<< +/Type/Font +/Subtype/Type1 +/Name/F15 +/FontDescriptor 117 0 R +/BaseFont/IQPPWN+CMMI6 +/FirstChar 33 +/LastChar 196 +/Widths[779.9 586.7 750.7 1021.9 639 487.8 811.6 1222.2 1222.2 1222.2 1222.2 379.6 +379.6 638.9 638.9 638.9 638.9 638.9 638.9 638.9 638.9 638.9 638.9 638.9 638.9 379.6 +379.6 963 638.9 963 638.9 658.7 924.1 926.6 883.7 998.3 899.8 775 952.9 999.5 547.7 +681.6 1025.7 846.3 1161.6 967.1 934.1 780 966.5 922.1 756.7 731.1 838.1 729.6 1150.9 +1001.4 726.4 837.7 509.3 509.3 509.3 1222.2 1222.2 518.5 674.9 547.7 559.1 642.5 +589 600.7 607.7 725.7 445.6 511.6 660.9 401.6 1093.7 769.7 612.5 642.5 570.7 579.9 +584.5 476.8 737.3 625 893.2 697.9 633.1 596.1 445.6 479.2 787.2 638.9 379.6 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 0 0 0 0 0 742.6 1027.8 934.1 859.3 +907.4 999.5 951.6 736.1 833.3 781.2 0 0 946 804.5 698 652 566.2 523.3 571.8 644 590.3 +466.4 725.7 736.1 750 621.5 571.8 726.7 639 716.5 582.1 689.8 742.1 767.4 819.4 379.6] +>> +endobj +121 0 obj +<< +/Encoding 7 0 R +/Type/Font +/Subtype/Type1 +/Name/F16 +/FontDescriptor 120 0 R +/BaseFont/WLWYLA+CMR6 +/FirstChar 33 +/LastChar 196 +/Widths[351.8 611.1 1000 611.1 1000 935.2 351.8 481.5 481.5 611.1 935.2 351.8 416.7 +351.8 611.1 611.1 611.1 611.1 611.1 611.1 611.1 611.1 611.1 611.1 611.1 351.8 351.8 +351.8 935.2 578.7 578.7 935.2 896.3 850.9 870.4 915.7 818.5 786.1 941.7 896.3 442.6 +624.1 928.7 753.7 1090.7 896.3 935.2 818.5 935.2 883.3 675.9 870.4 896.3 896.3 1220.4 +896.3 896.3 740.7 351.8 611.1 351.8 611.1 351.8 351.8 611.1 675.9 546.3 675.9 546.3 +384.3 611.1 675.9 351.8 384.3 643.5 351.8 1000 675.9 611.1 675.9 643.5 481.5 488 +481.5 675.9 643.5 870.4 643.5 643.5 546.3 611.1 1222.2 611.1 611.1 611.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 0 0 0 0 0 753.7 1000 935.2 831.5 +805.5 896.3 870.4 935.2 870.4 935.2 0 0 870.4 736.1 703.7 703.7 1055.5 1055.5 351.8 +384.3 611.1 611.1 611.1 611.1 611.1 896.3 546.3 611.1 870.4 935.2 611.1 1077.8 1207.4 +935.2 351.8 611.1] +>> +endobj +122 0 obj +<< +/Filter[/FlateDecode] +/Length 2493 +>> +stream +xÚíZ[Û¸~ï¯ÐÛÊHÄïdƒ<´h·Ø"XÙy(Ði e¬LÈRjËÛdúÛ{© 5’e{ƙ̦y™‘ER<—çÊ(%iÝFîߟ¢ß_}ÿ(%VFWï#žc¢D¢Ytõ‡¿ÅoòÍ&[%\‹˜‘’Õ߯þýñÊ­³Ã: +OT„ ÿ’oa™°q½‚?·U+¿ÿAk„&’E©›ýñÕ*¡Jşü,1Ìb”pÑÎb“oÀ³íè[?RÅ íF·Ån_6™ŸÃŽ Q:‚‰ÒMûïd‹„‘TGI?c=ù„"©iw¹Ž§l©æ¹ >A I;Y\¯&BÐÄèn”)=#ª[þúäIôñ{ôÙÙox„$Ì2ä;a€á±]ÉЀޏp’ +˜ Q‹©ò«VLÅJLÆõ,ŒQÝæÕDr4%œŽá£ÆðéDóӔi`A܃Сâ¢zŸ5Má9¥T43I˜vs7Å –tD¾Ÿ° ‰5§ioF–tü}œÁîøÇÌÂt•lAESXdµßôG‰¶¡hyHµ‚­ºñÔº ~ƒÎí®†ÝÕdwªœn?šâÃö¯fÈcâ¤SùiFlŒ}[LgH3Ýî·«„i=oŽÀf[ú З׌<ɌÏš/‰M}Q±é#bǶç‹Û?Cçé=_mQÁˆ÷7õ&_%‚êx]lóý ^W»üvŸWwí‹u~[þq×ä»]ûœÁS½i¬ ÿ%øNqS—u;=ßÉ&o¶ðŽ¬MÓø Š€> ¤sÖ°ãM¹‡¯U@³&®·™XçÛ◕äq÷;+Ëïö·û (ʐ@¯À0‚Ká)2ÄvÝÏ ½Š½†‹N@´YÂCPÖJŒ<½t_§Ž°?Ó þúï¡ÈS"LôŸˆ)IR•¸å&b†Eûeô3j§Ÿ¦ JPasœËv€“źñŽ8ŒwgëCàBŠFÕQïM*} QF*b/å²X;Ië8«n0úW«‘›z×l÷MÒÆ[R£yTØ šDœmòjÅtÜä$HA)®Ð”HRè_(†qRf²vÀø™cîÅÌLø&·áLÿ"œiˆÐ£ÝÛÃî /9¼´5ŠlýˆYKÈK +ÿxƒì¡T¸`1ž“ºªñ‡€  p¹]gþ7?lëÛ"oÀ ȕ01Œ‹®;a¢Ì0ބSêÖy»G…¯÷À¾Ø栘Wm¨Ñ’Ç3ƒa"føb¶©ýϨ^ˆe›Ì}­©}P[ºÙxâ7HDv‡® -¬¤a,=ÎÊ豬Œq†$âʟ ”Æ}3ã½cÏZ;ön.†Uö¤Xz&ƒ:#[õ‚´qUW È SÄ ¤Œ'~ünÅD\³Ëz‹ÃÓÌ-±mÊف7Ÿ ¼éŒ?6ÝÊV$ÙôëkFD&ð1|uì?•c;“v&òÅ\­;åO•.ÐÊ>Kªáþçͼ¥;+¿@¢>™D=wxÒ!©¸]Ê;9ú`º™éÎ°Ã ŀ9A—Úû€ €:-ÌÉfâC*¡ÍþyÜ» e»ç‡®£¬[z3¡¬,Ε™ AÝ~·¿ÁªŠûƒÁ ø€ç.ä\—ƒODcšãÔ¬l§ öc¡!n}›Ñè·Ã°Â/ƒy7às'Lƒ7çKH™áZ„LYp}(Z§K7‹r5X/ìǗá¬Úøôó6ÌfÀËõ㜬ÖA{Ö§›{*Zõ!\:õ‘x"!P@­­G¡x@PPÀ`]zÿ: ։ò^™ž°5Má_-ÀÈN¤ñT›ðØL‚«ÚÑV|Vù2:àñ°ézæ<ž¡ÇÃF0àqƇµI2W.ÁqPÞ»¦ êmܹòàTH‹[ +E šÖ®X½m†ò‚cÊ]«¦±j)eötqòqˆC#Žìq‡óL ãQO;Ҋî´âô›{+5£]¡g‹‰ímÞÄÀQéZ QËs4äç6qrrüǎRöÇð“!5v”m.ÉæaTšePš“! +uù¬x<ÉÊÝã1Påë9 ÿ<ŽMÏÈ[=Ôöœ£å³-Y6<æ„&óÂ6fŠÞGcŠf^Æ`æŗJ/’&‚ÛÎc¼ñŽ'Ä=à +Íâ +k 2UŒ Þ7_éKˆmŸL¸>™f]C¯ïÆ´o³²ì&äØ}­Š»¶éæÖx ¤ =è£ b çC% Ûú»¬ÊÊú¶¥`ÒÅíàqÈðIpˆ ±×Ó 順GÂMv%ÛãpÃ&ŽW©oʅM¶ã3?cˆ8힛\ĝ9ˆ;KR:º~åÛËmóLúënSyb™Q}Ãi‹€€pÆÑ`#j"Á½÷—U·u‰“$!+ö˜›R—uSwS é¡oujç즔yb&ŽCž +æ£`lš@þ4±ÀÈôÎJº‡çõê%¶ e|ÓV‰¹2.Ãlûl‡Aã<®w»|ë{Ùi<èØâô̋ø—bÛ¸Ãä"b×ӏæþL*Û± ~áÝ}üŽ.;ŒÏtªL1ԞEýқƒÑ¥ÁÐRè–"¨[]ö*#jՕžã-E;ð5Í;€ëþvΡëIôHÈ' àøn=˜/ÝÛýð­.³|©Ë<¶…t7SRü«’Ú±ÝÏhËÉ¥ŒòÐ ÆÑy±î^ +^îh³¼oçå×t^>͜m¥ÆŸµÔÄ9E®„16WIsýÕHÚÓ ùá~Ր”7áìQ<»ð9Ú¢Ìø%ùÐ{7à\ùª÷7þ̀ÿú øg:/ ï^´~¬ÆÄ386_ÀÉ<±½ü¿ð1_É¡Y¼«9J„»ðÎ^÷t_×mIî7ÿ¥'à +endstream +endobj +123 0 obj +<< +/F1 10 0 R +/F9 41 0 R +/F5 22 0 R +/F4 19 0 R +/F3 16 0 R +/F6 25 0 R +/F10 52 0 R +/F14 95 0 R +/F11 59 0 R +/F12 62 0 R +/F15 118 0 R +/F16 121 0 R +>> +endobj +115 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 123 0 R +>> +endobj +126 0 obj +<< +/Filter[/FlateDecode] +/Length 2523 +>> +stream +xÚí[ÝsÛ6¿¿‚s/¡&J|“ñäî’ÜôÚétRO_ê¸CK´s鐔›ËÃýí·øI²äXVâ¶/6€Àb?~Ø],£%It™ÿŒþ~úÍ[aŒ2^F4AiÍEŠ$‰N_ÿ¿Îgsš²øÃZ½€§,‹ÛËfÝuyµ¬m*õ_¬Vn0EŒÀh–$q隖E«–E“w¹½Tíúj_•*¯>¹1]?®ê2oŠÙûÓEI4Ç 1f¹žÍ‰ˆ‹ÆôŠ‰(ÂÜôýO7~ó–÷û˜”ˆh¾±´#;(Ia݉fs™ˆøu4c {-Ú®ÖÏ"Î/.T¾ªmǪn;؂ûµ˜Aÿ¶¤â,Õó=ˆ"œ ÉIgDð$.,ë*·m±RóU¬Zä†n¿jsKp[S3'øf¹gW»™ ÌSg„Ë &ZEYšGWÅ¢hÛøo/êÕuÞ© UªÎ’’f±{ 8` I±-…ë贆¬ý¸¦èÔÂHêޜ‚ÖE,EŒ‰øbi|÷íÏo^¿y÷”û}nÿßR=äˆ0½Iýo;·å.ùgžÙñä}†8w½m'ë;3D]߯“AˆÂ÷~¡°ød6ÇBÄÿLC’;g!›Yn“ÎQ&=é3à1!ñsk%ô`fñlÁ®ó|ǎ6|‘wñå|w|=_nO+5²m¬KN͏!±Ó‚偘7VŠ!©ápÎ^2cÁPjµàTÝÌ8ӆÉd/scÏLb0Í«uQi|ê +۹Ȼ¢r½KåÿL«°m0!ó°Ú¾§aW#‡í­¯*5Ù°!^!« ß1˜©ß7±½bÄuâ÷ûCH&d#Ò¸UݨFãááP·mÑÜ(‹ u€ËæGÝ8±Ç–Årý»|¦ôÞÒ¸îàhÚ¼)ܛܞk0“ƒ¯z²o ÂCÞMi'ˆ§8w °y±î”æúlö2 nT" + +G¢Ù>(й áÀØÝ454²×¼p ;'ðLi^fúàB2ª®-`-ß °½lp +<©žõàÞkâm,áS–ŒžnúGGÂx¥´§rxÝ_•ö…þ#sîHÊô”Xroe’2~€§ÌpoŽ¥vä¾<ÝCòt›ä÷A1ºeù;õâSd9ú¾ÂÄ<¼/ºK^øN‘;7&>_`‡µ·³Ùó€­%ÌÎó{·µó?míiÙÚùÓ¶µi´B#“0‘l¨x4'ê(û}µ•?¶[}+ EÍD”Ù„fñ†`6X6‘a§s_öy•Wªhò6ô[ "êi¬FRD2©±/©p%ÏwIFN$#À»¼kºÃ»æ_q¨v0–üáBµ¯Z™îò~Î)r¾ë”2ä~ÎÇö8pÚá;>¾BÈbîíøÀ{<†ü¾€óx´m7®þ¼máC„iá?„¥ÿiiOÈÒΟ¶¥}¥AÚñlð¸AÚ1öØpÝsöeÁ…ªS(‡­H3²¯°µŸT]é*„,›Ü¹-êjQ®} ×({Ù§ò•+e!<Ϋ…»/”îúOlÊZàQ—µlJõ~‹Жð I«¾OdTF? Fבڑ©¾6õ ‘0'´ Ñ)br´ºkèWïK-¨q¥†mßêÍ1vëžX·4ª]—©q¡8õLıë^Õ¥ébšBUvÀ‡µn—±}ÅùuS؞¼´ÿOgiuS3S8Äí/œ¡œ¯x7·ºŒSÙs]›Ò.Ìo—ÏŠkåê“àY +íj¥`3ùjp®Ç(ûZ[wªZU¬\Ã2p» $dtû-¯!Ð!-¨Ñ+\ÖÍÊÕâP’™kÜ~+¿Lé 7w¥Ó¥¢>uö^g(˜0K¦Òx¹v¶$§/NºeÊF’í5HØc£«lšú•E '=‹»¼Ô×파ٯ)o몶O`ÊK¥9/7²s[v»Ü&Xuáx\ku¹1%B«m§nL›ÔuO°¬nçñٙr“7¶’¢,Õ_Ot5ÕQ7KW0c;]õ¦ßè*)=k_.?L¢†5EéQˆ‚—Ïô$U  MMc\L‘àwd!+]«F²¡¾°Öæ卦˕9,r_Üp7®K¹X tåMq6CЇB:O;'@.¶HkqYdhÑـH]Ï`ÃDââ'•Wu j¤×æÜÕ]j׎ŒOùCêؕ™éµn1cY\ONˆ.$qDL݌ÑôN7ƒ"îÿbBë“h6ç’Å?ê:šÐª¥áƒ¼,IfÛã¿Mt÷FœLwž î{‹Vµ]à?ãúÌÞ¬„-a•hÏäKM¡ìȜ†½Ö§­7 ­#z÷$¸Nâ9 RØY€c W{º~»+´ä^Z·ËÌä¾®©‘ðíùe¯t¼ øPÞ ¾ !DjJØÄN¬ŸË ±W ¹Å läizI^ÏxbjË´0·ÚÒÇíՔpN±1TÐ߈÷opüz2ÞOv%ûSu¡wUW!Kâ-c«/ž0‚÷ñòåz Òܞ%¦ýÇÆpÈü¹D[|} Ä,D´QÃ[Õ¶æ8žìTŠŽ@S§B“hçØA @2£\N¡£)õ÷Ÿ@˜n¯f¨ÙÁŠ@:±AÑ¡õc(6¾:I‘=˜‘Ÿ.è èq•à"Ml’=X G҂0 Èv Ðe±0åú#™ïV†ÎˆKn¤Ño†ÈmκŒW•Ôx÷®ÁæÆ)ÿ +…ƒ Ûâ¸KíÌ¥ˆì“ìá\h46熩•®‚gÖUÒcG3ªc/º—¯,cÈDB®œhߝ ERñX/âç8¨ZŽ-ÿþI¨V`äõ'(ÂLÆo‘‰§³2í¨Wt[ê§`K{rŽåN dÄ{$ïlvHǏ¾ п‚ߤYT}ÜþÅî“(äNÌ;DêD“›€ÝëÏ 4á: ¦L’ +šëU±ùJút¾ËD֔Ä6U°îT©< z¶).³^ºœ™¨tðí•É ð4¾nêëFþƒª4víyÛֆ“ •w.‰e{|v‡ƒwì™m’ *(Ë^¬¿,nãBŸLÞ\qœ‡œ–Í'¡”ÓÞ֔E}thöárdú±­mfýÄW*„æá\ˆWÿօ·:i(MæTdÙtNnÿåÿ +ËFU +endstream +endobj +127 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F6 25 0 R +/F10 52 0 R +/F1 10 0 R +/F9 41 0 R +/F12 62 0 R +>> +endobj +125 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 127 0 R +>> +endobj +130 0 obj +<< +/Filter[/FlateDecode] +/Length 2282 +>> +stream +xÚí[I“ÛƾçWàf°$´Ñ{w\IU6§œR%ÏͲSà¡ÌeÄő|ÈoÏ{ndƒ ‡R#U.š™^^¿å{K·’œäyò¸Oþ|÷õ·<¡”X™Üýœðœ“dÊ͒»¿þ»u±-ßN&?Þý#á‚Ø$cŠ7ËpðëoeK@#“ÜMÎêÉuErã'ߦÑVA¤ò³¾™dT©ôcD‚’³@c2ɘ6é"R,'ür.äY\ð.Œ¦¯"R°Êª²á¦E;­‰Ña–)}#£Üq˜QM‡M~ˆø`”•ý;RNTs&U½€æÀ½Õõ)„‰¶nÍ/‡’P–4óµ:Ø%ê°ç3:ŸmŒm´ãÉcÇÛ·…T´¶ð¢¥|ž5Å4Ä ]MÊ]£„7˜Ä§¡hÂÌ-]ê§SÊ֑4Q£éZp}EÇNžR6=P¶>âRbl6Nˆ™ÞÖ¥´}–=Y̧} +Cºî é N,ɳŠ'à ?ˆÆ1H:”= ¢ þ2t“/ÉÒ.—îÇIÆeðÈ^S}&¡c-€¼P̼u€<‚™·sOæ¹@j#…àËcÓ´'!WâÖaíCŸŠšã Ãþ4’›h÷ê&þŒx5=nŸö)'ß׿q.ð‰Š˜aÉü͏û? ´d·”Ó“‹^fa æœÖ¹FFò·»$'Â$ÿI”"³x‹’E¢Y½Åý9O¾?l›„åDlÚÎUƒÑ֝”]r”•A8†±(ø† +qø8ayôtJa¶e„‚R1ÀI³al‰Pì@‰'"'C"iÖ?U&`cêJaúùUºÒæ&­3ì¢æºõl$*ÇðH< Ê7ô@±3kp3c„ŸnÐ÷Ú£® !¤ß+äuuö¢[hŸUö)Ú*Oó-šW"ú}ˆ.ý× Œk¬fpå¿ÖÅkÈ|(K7¥Û$Éu •nþ¿=‰ɁÓfÅK¼€(­h»€Fô;–è[2 Ü ‰:×ÑqžFjBà\b¤V YÙ Ô±ºY%(¡¶ Y 5‰I•“ 享qª:óy8å+ÞgP–#^ЎÕ`›ÆÅ|¾Z ÎZÇÕ!A¼CxÃè ’ÞúÛXL +jt?äQqÀbˆ¬øº§;yÏ1™‰Ÿ|{0.· åjY'\¹¼9Ð5Þ›¬b*½_-'L§Ûu±®V¯ë±jùs±ÝVþ¯uµÙͷ府N1MIkè¤ ‹H'¤Ÿ zê<ÞΉéÔMZŽ 8¦E ´õu«–Ùœèε:&þÛOŸå”pÙ¡r¬Êöé7ËèïÙ˜Ë +9&0]ˆm¡^´&ò*ŽTby,07l"^QI{\:ˆø€èîw*?à>,‹û8#>àþÑñNÄ¸Ø՞„ç̵N–uÞѐoNòÍpvÃÑñë•ÕÜ{4úó»²ãÞ +Ý{³-pHº!77ÿªzt½Ú–› +q;÷v“ïwÕrV¹K8 jÏ©<];OW7{6r‰§»¾„í÷tH°ñÂÁX¡zOçÆujü@ðô°L²ý^DëéGèc“Cwé+§ºCúaÙý^ S—yz°0qð¾¬ë 9ö•ð•JDú…ß¼S"ŽÛEÞ»vD’ (×½ UáGb»ý[¼\hÏszý€wÈ°Êä(ò“ý˜ö¹[Þv)¿(o{! ™ÿ{Û'ñ¶ÃXäp"iyChVøïÕĕ<žº55§zÁŸÀv“Þ•ú궥þE=a!›‹Äï°*•¨•eµ­~HžºF±¤P,-°~šVKGB¦s,‘„N×å}9+ë«òdªÍîaW<Ì«bù[鈰.~Á¶ÕòŠ»“PVÐ~ì¿m.4Yß<hü°¦Cê?? ò…‡üè›G o¿y´ªûJÌ]ôžèžëÏ {ΆºçPþòÅtZ‹Uì: µ‘È~Ñrµcö^šÁ+Cõ¤Ë¤„Õ•ÈwóI&”…­ÖåŽ'tžnʇ]Yw„Ëzz³-¦Õ¼ÚܗõŠùWåû‚¤H‹y¹ü­ðTÖþ—¹_7Ûy‹r»®î$ߕ=¸gÛ¨9ë…4?éÛÎ }¬@ôúĽß9¸w[mLj(öqë½ëj³]O„MËí¶ŒßØ ìGz؀hë.V”k/¾z\úFýÞ9Œhß`½é¥< =ñ™D÷¿i‹3&<"ÝM¬H5C Âî$麁íÊÜâèL y-Äï«¢¯¡Úvã}öÍ$ÓáÊn?_j"Rœ”êöÒ2Þ*۝? ït`ÑkWü,lW¼"Ìî ?¹I½ªÁež®æ+Õà.‹*óó~t†¦QMwK¸‹MU$2+³Úâ¨Î±ãÙ±¸iMwQ.·±—Kš7o™Vúµél^-ªm±]‘I&5CÝ-ãe §§ýéÀÁC@{4c_l¸z±„f§má,Ýæé}׏<öêg>Úxë)ÓØeۊà „§š0‘"öV­œZ‹š·ÝÒÿ²Ù9m:U—VËØÁ!ÜSd»£Â³Š–ýŒ_¶w‚Ëž„_ñèNÐ ÈYÅ»/.FÎl®¹í½È‰ÐÒ]€äf¨mÞ_ŠÝý»õï=,Lió9@ˆz:„€rÂ즬%àlz¸ßüˆû€£b왵älÐ5—HLIL Iì`ç~nIÇ«&=>ÞÜ‘ØQ©æøN2ÅÑ!\#ØúÐ÷»ÿØdçØ +endstream +endobj +131 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F10 52 0 R +/F12 62 0 R +/F15 118 0 R +/F16 121 0 R +/F9 41 0 R +/F1 10 0 R +>> +endobj +129 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 131 0 R +>> +endobj +134 0 obj +<< +/Filter[/FlateDecode] +/Length 3112 +>> +stream +xÚÕZK“㶾çW¨r1UYÁēຜƒÇvÊñ–ËÉNN™$Ź³¨¢È1Imâ=ä·§IpI3kmœ\$F£_wc“’4ÝÜoìß6_Ý~þm¾¡”ärsûvÃS¢õf§4ÉØæöë¿&?v[™&­ýyK¶»ýãæ›[ûŸ¿R‘4üê/M±Ý1Îsx¨Í¾ø`Ú¦‚–T%wLÉ­P,ÁwÎ`j¦’÷ïMñÞ%MLãÚ: v ­]”jN„ÞpB¥]áßØúù·r&bÇHª6»iDéF„d’ToRÛy—¬¾DJßû¯/¶;ªTòój +ªIÊÇ9¶®[ÌÝÑÙØËT¶Zƒ2¢¨ð‹éË.ÓgÏàþ²¤êÜ[{ߘÕÜ2%¹ˆo>Ø£„$°õÞ(a¹ïýóŠ°Ïr"øfGÂïñUu8€ p8f8ÝônØFh;>ϐeNAV²DåÐnwöRVÔCWà‹XˆÙî2™%ߚ¾·£Óʨ$ŒÍ'Å` +•&¿_‘ÍÑ#cR·h喃‰›õÄXÏóÒõ‚P­y˜>òðûõ·ÊwíÛCåˆmAŽí¸ÈˆÈCUy+€#R¤É¨R( +¶kœd´CÕlìM?DÈRb«Vr‹ªGr¡B™_~Èꐏ{Šºräîñ”ßU`x–ҋ}QéÍYÚxá=¬…W!ƒÆ“ÉÒõ&9áü4©)QãF…3ØQ’¹Õ›µh+ýžOëyp|0ÏaE# Ôó¯ú¢è|ž&ªù4ÍGB…Z/ÀGü.æl3uÚQ0Dq°Rö©-љÿ#@¯ybáKļ¸Xƒ¥œd˜ŽT/B` xʈ@6J‰né°á0§Õ×àMÔ4L)„à'ÄÁ~¡‰³Q_¢ÉÐ1#ÛÊ^ž@û>F :5ýÆ8T¯s€óç$ ”f_Ëʁ»Ú‚¼,)Í¡í°YŒöÂõ•Åà!  ¹îîÎTƒŸP'…›°Œ6•/Ž˜¹E@\:ŸFJFŸŒJ崛Ãܐ1"…åó<’ùŽÌÔގنÈH˜“-Fº†p¤FÒÂÕ}üú …Yjmnã;ô +án·š&UÛUÖ7È}ƒt]{„zïŒ=ì1eUԇÊU¾ d/y茝>{(º¡z ®*e‰i"L×ç`>(Ó{€Ù8Ȏӷ_Ç(l +~.C¿Q‘º,‡!ï\í+w´}u0»C5tÆmeˆŒ`·N“á8€,a8i +7CÕ÷UóÁø}gnßÐ~¼?µq_Y ÿ탧¶ŽqãúvØY2ӐÀÁ4½RÀ¡óÆNg¥©¥ñýíJ_Á¯æ(à3œ±Ê¶6#„4ÌÏ0gm ò泥y(îïM1ø0e#>ËH›šqºTÏqQ„%tŠŠJï[F„=Â1 OV1!•Ú½°öSMDL§ò!^C£Î˜Ž/"_O·:#Û^Q&Iv‰0æ”=K^úx«6‡õ‚à’ÅÊWJ®7 Ž:—ÏÚö9:/”"åã<ß5þ½®<,B„Ɖ_}ÈWAÔ3!;윀;pçûL˜XS˜XéK0pÅ} êYAöÔîW‹¬‚…3Β¡âU«éÞ©À©¥r‘1X‰gE-Ì2œŠp4`iµmy„%e琢z@zuM°0ü*"ÞL]B‰úL$/P"6‡(ßc(‘}Z¸.ÖN¯W¯ü8|™Û¢È(šeŸ&‘Ž%Ô¯ž:éúäò9\í†bV +àhÓbäåù{)‹Ú=Œ'xÄbžï­:ãòÀnš£Är9S…é&Z2s¦g* ã”V÷©ÀX}hè&Ç*_\šXÙGŽøâU,hmp̒0LžT{ÓÏVĦæŒNfÊë¡ï‹7ÆAŸÔ—ó,@=Œ[°ÅÒ^2§ì$ÅA·Å<gÉ Nú\药,äŽ-XÚglŒpÃ0Û!=ˆT"5ø Û­Tò¹¹ì|μÖ6/¤—×€‚‡cç—ö%NÅ0ß{-}²µ‘|ý™ËGÙ]4EóÁ¬ÔL§sVÐß»ªCSEŠËÀÙÔ宧,B¸R¾(çZÇÊ°‰EÃ(Ï @څ…GÙaM+“¡_õB¼bqҟÀ"ÁŸPå +ò¶*‹Y«={š0òù{âI÷ +nVÇÎ.eÙ%-Åý ª¾è®dˆlµû#ìbdðdt~½=œóK;žæ(lÌ=çV‘„°D»xæuuosÃÕ¡*'ðæ3»š9w„Æz©vîÈ*|š¼¶·6Ü ÍÛb°·ŽÆþhg§ZóubÍOfl=Š5¹k…žGï +9˜ÏEœ?æ2›{8QaQél¤n"V| +¦ˆ»ó ¦Û]h¹‘ë°|´çìµúu ñÄH|DôËtúÿ> ² ÖGÀ[üޙ˜KŽ‘‹ )Bè“÷Š¿°¾ qo‹äLgª~_EÄPä6íáAò¥œËÉXF_ӮƲ UËÿÖ-È«TöÏè”>/NúŒbi¬Æ~Ò´Ë/珼ÀòÇJʗ/×…ÏÄ>?èÁ‚¾:V8“¬;R4/8„ñ–¯ÊA¤Ü¶ï¶aaÙÎUYˆDeâcT_ZöÁØÚÞ%ÅT~Ęòm‡5å¡EB3XÄØ'_|ÄIÆHy•B„SÁ²þ6”±ùaxl*$PbÉҖ¢qŒË8(yo0rËa•t¢¶3]kè"€ÁÞ8x²’Y*÷C'l +„ûÈZ’>K`qW¡ÀÍق¿m +K2Ž!Í|zÝnLæ¬$áÕýɌià,#RŸ«¢H>]Êõ)º( Ø9~뵓\^ ˆKPà4—Oºá¯ŒLý¾ŒÓ¹cÔý +I4_ºß…!Ìó¥ -êÚäñ¶NÄ°J õú úHËe {d?qWH E«B +Bb¹ÿƒíYpýǽGÆÁ|,gß×·„æuýû´îW·>X<¾S™BF[̔zúó7Wæ +endstream +endobj +135 0 obj +<< +/F9 41 0 R +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F6 25 0 R +/F10 52 0 R +/F1 10 0 R +>> +endobj +133 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 135 0 R +>> +endobj +138 0 obj +<< +/Filter[/FlateDecode] +/Length 2749 +>> +stream +xÚå[K“ÛƾçW°rXa`ސÊGŽSI©RªxoÙljDBë©ÂƒAÙÚC~{ºgÄ`bÉ]®¼®$3ƒyôóëîÙE'ÉâvaþºøóÕ7?ÐEšÆ_\}Z03ºX K²¸úþ_Ñû|¹bRE»¶Ù·í¾ñ¯㛷úÎÔþ9/ͪÌÛƬ}Ëu´ü÷Õß¿ù÷ ¤™ŒiºHìäTFoá!£›& gҍ³t±JcåGÛÁneœd‹®ûzé͏®Mx,©_ú½]UL¯J²~Õ÷£UELøhÕRWk]ùsÃsÝhüp±"S iÊbÆì'›¼(`“$Q•¯óÝN7Æ¿×[ø•QÞ U+ƒÒÒ;›¼Êu ‹n9ƒÝõ¾øüyf +᧐‡)\«©\+l!mw›¸}r»OSm궅i)´Ý4>Þ_Á҇,&,æžÌÿ1Á’Ùu¾}ÊcÂ|ç͈îð ºOaë#É¢±è–ýçèã,N:©{펱«‘]øä&A€o÷y…älÍ/ý ª··"4¦ŽBßçׄËÊ PìTјe±¥å_®¬reá~•’$΄áGƒBsÿ(”Æ*ó»ýu’ÝA¿…U)ŸT4+1œ#r´—™Pá±¾tý åv@Tv›ÈNj'1W¾÷ËÔ(;ë_FU¾Øþ7ûÜí"/ò2¯ZãÞ6f´'Åc~° £)AÓnÇ×SŸƒiáì`ûÆ;"ÝÜ×K'C+ªÀN‹Ðz|•ÓåXf@ìä=~³pnzT#Y‚eV†æÀu¾ù_NšÖ¤ßü©ÒlO¡É=ôOo‘ÌÉBú0ÐYawǎ +30íÂÞ¼|ÂÞ|u‚'è9°Šcȑr…Ùaš0p”½y5®Io½ó©´£­‡JxgÏ¡­Õ`ÄEÔÚWUp‹.ü ?8€†ÆõVµ¶oMaÐS$Y´®ËÜ©c*ñ<6‚½hn{é=‹÷#°ˆíâð[7y©ã‘SIBwrµÌXäFâ 8žu&©@'²J3FÅY$žD$è¤Y†Ç‚¦#~ZïÓ¡ȔgèÄ@®.èfòÓ®×qwôÑn¨òûëxÛÚ÷4Úí¦<;Šƒk?»ÓõO~þ‰iЫžd}`ÑV {;,€óYÈù;šßW &c!®`l¬{µè0ðEÁnÉ¥PÔ±/A`pÐôà=¶§b(:C»Gf)#zˆ>A”ß’&䁰@œFo©¨ £(͢Ɗ`s”&‹Ï)•a@…ýþ÷\n‹¼­=JHØNb÷¿UuÑ:Ù|=NP˜'Ë&ãƒ˜ãŸãƒù çdÓ;£ñٜ·?؋k"ø’IŽf“]÷Q Ú"Ÿz‚+Ð0ÁøéÐ^s%³ì$Bõô·–õ9‹ó?P‰Å ýÝ+ µýïÓ1x€†@aVÄû˜ ØD§¨JEä?.î"»J'“øŒôÐñÊ®c\w·_c‚ÀãhØøßwz¿Æ@õ'üï‹ûÊTG‰’ +†O]p¼RSJÍzÕ|6;š.l؄ýÿ}¼"qÞaÄfBDM+ž²èb/ éxÕ·Õ8Kš¢ +zåÕ¡óFÝÄõŠü –ÿclH16f·/Ú./ú ëƒü$éÌáÅɇŸ50Ï“Ñóâs~,>÷¤ÿuÊ©,˜hÌÜ»Ô>Ë Ͳ±¡ QtŸ”g"ÇØU=$â/›Ëçˆü˜}›có¸|É@“D²ªJRô[/„ƒÏ¬ÿNJ +ºÏDtg/FY/Ƌ9b¸§çˆ»¼ .cQäÄ< L?‹o{º I¬‚€MÔöcš1Å!·ôóF–zðݦT˜ÅPiÜr×0ÊxËÇ[n§jN²˜“Ë¥ÏW‘¥–DùÓÚ²ΡQq@£Øg‹KÓ‡hU°ŒÊ#`”=Œža>ŒŠ³À(K³è»Jõ­^ù(ˆd‡Pݙҗœò €üÆý6ú¤‚E]Åͽ¯†%¸qzCOΏVÒú!bf"zWWnîŸ÷ùΦFáYühK v?Ÿ¦6˜¶[ëÖ·Úï:¯V].‚¢à…™2ÝæwwÚ'Ió3êˆë¿‚{4Ñíf¦ P‡|¾\¬ÎŠ•ƒH·K~S©pö¦¨‹¢£Ä ·{}[@À{çÂZÏ]Ô@4Ïü±æY|9ðË^›/Ƈ 5½Ï·G’|o1@àÜÍóyÉÁf¶Âë= ÙtNGqtÏÉqÁâ|v<‰ÃMMâ°¾8„ƒ 5¨#âûÆ4yÛj÷²®+W¼ó èö^i‡ÜßR"}~zV&^ww8n>ô¸¸6楠‹Ñ}-Z¶z·Ó··Æ&®Ud‹–LF…)‚uèÖâ7ÖKâ`8±F•à×áŸYk÷¾®]MÌïh¤Ã En[ãø5ßf'…_K¹ÆÍàîçðèúÚî¹ÚÔîžNWgu[þã„ȁ;E¤F€02¤ã@AuNáýÞ Hgo\ô¦iÅؽ8† êÿÉ©5󀐍û(ç‰G%q*Ý<J']ÂxˆD'™øAaº¯ ?7톚˜ÐÍRFoƱ,Oà4.Ó¼®½ [Ñ)…e,ƒA„‡#¶Mvô‘Gº3uý• 4dSÈoÊ'Ô¶.T?—©Úc‚ùÆx¾ôæ›Cठðyï߇áQgôëlL©«îfaw“D`a °Žnz{QS ø€&Ü ²áóÒú oMi­{«'" +NÂ[f[zÏIJ4Ó/òP©>{Á¦+G <±ßQ=øèe…‹§b˜Ë€³cå \‘…·ðN3f|D}Ô;tóØë|ÌìùJÜ¥å_·{Çx1ãå r[˜u^7„ Ddk4„ɍ»q’J‰÷?žÁô±N QçGH#`íü×U^¸m®ëfg"-¤ÑþÑ •¿‹Mzëó쓺O¥ÙÜæSÝT&aXvñ˂Á>ž\p4%eßÀí՚bñc0’øåFBh  #aN:é‘ +®îúÕ]Söˆx¶ïœ†Z¨ÂbáL ÚÚw¹¢mî:k³Õ^|ð¢g\ïäe@«~oˆ< ‹éPñ¤þøS8áK½t®Á³Ú»?¶sn:„ícƒW' +DEÑnï/>ÖM“cJ7¯ð¯ 죩*ÀÒ~p‰†eJeße—sÃÇ&/º¿ èfØ{w=ú²o^…(‹ºõÆýbzÛ=ù –åðÎ#ø³Ú…5¸¨|ÂE êH…ו +<œ +ïôŸppˆì÷ jVT€ÖI·>ÿ²ÆþNÂ*!z<ø,yóGœýÞµþ!U®"-ŽÜ6&o=ÞÌ¢î´Æ“`Q_îN¾É?:Q/:ÂËðz[Ÿ3]ÿaý]k"ÅèúW6€Ûìàrʀ¾ø;ˆ—mš õBû‡ÿ;~Œ» +endstream +endobj +139 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F10 52 0 R +/F4 19 0 R +/F1 10 0 R +/F9 41 0 R +/F6 25 0 R +>> +endobj +137 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 139 0 R +>> +endobj +142 0 obj +<< +/Filter[/FlateDecode] +/Length 2960 +>> +stream +xÚí[Y“Û¸~ϯPòD•-,qv6UÙéd].W4ûSD&ƒÍAs˜¤¸³™ˆ†°FoR*¨‡–«zÉåp)<µ   +§@‚7‘àOãbmT6N;qkâÚF«ÁÜE'Î`¿¦\‡±½m¾Ãځ^3Ó °´Î#Ö<`6p 8N;áhω0³Íø}‹TPKr6ÛÀX:kÖ³w>R`íKÛ%L!‡ñÅ*"ݍ?q=_4º¨FtQ(¢›³lÏ6сaKÙ¹KÇö0®A9Q •H¡ƒ ªFÕ1e2GFä}ÛƒWÊ»*´C?Ó7¿ ÖÀ¬%‚~B­­!9í/yLÝ~“:®îaUìDÅüü1Ê14<Ù|bö§ôVcÙ³˜dÓ9¾$7íqó}’›ì|ßò$܌c2£#0’äç_cÆÀˆS§Ù@§ŠÙ|op¨GŸ--Ê_Èa x#÷øÅHP.>T b”›ùçõºÞϽzXpÐߒÐe†Åyß eÌé$d1”á(dÁË (®®ªbSÇ~\w täöñ@ÁŒœÐ`üÓ<þù6ÈÌ´ +›5øä(| ôcÆ '±ñýmÀš„‚§á¢˜¾™M£X¬A ‡ƒ§á²ÑǝfC I0T_Ž.½‰!ɃõyÂ÷Oæ¾ÎÞLß|Ì}=ô4Õy|<“÷Å6z’ ì##ð9bŠ´`¿cnèÿVýßfÕäiîfÔOÇÆ3ÏRÐý®ö‘‚ 1íÉ܌] ΉÐc1½•DãTA”†¨žæE× $Âú°@É&wp… ÚÆòÏR÷~I'/X¢àªO +„Ñ)RÚ% bn¡…MÓ"¨»Åw´|=IK³¤£…?cÇ={Ä(‹˜"¦YòàŒ1Ê¥ƒ;Z,#ÔLÒÒ,9¦/^ª¥æëÔ½Ktf®Ø-Df4j»+*ÔÛåúfåîb“ÉÉIêZ6°ÑÜô®Ý£õ£æڝC{B¡e˜¬äcÉÊ$ 0:,Œ$Ô¦aúιxS×{ƒÛ!:,j&ÀŽ*E”÷ª£ì\¿¾†^æ$¦­­>L +yB*ދ҄M1Þ%î¤^ô?­]êqp·)רû;½êòàº%¦tK}AºEHChԓ9+ÄΗÓØɹ%~»‘òþ)·+WßSÙ;8„v píˏ7å+;¾ú¥²Å¡™ôi.yV¬«fý¶¬üª] £~lYﻛáúT½Àr˜‚WúI ~bª±…±]ÄQ†>OË<·¡œ¯¨/ʦ૱Ž¹ÕO¦‰äýl~¯L-œÂñÀók÷9¢=G¨+Ç务XSŽï7­JºìfîHƒûØu1pårŠ%&fÉ vµ=ðÕ¡¾ÿMÛªy[ ­@ø"+6 +Â9 +—²õŸ×Õ&Žµ9GZN4æßӘX‹Ñ.?UI†Q'p„NqDt5²ÐÈÁtñQ§A¯ “¬ª Ú@ŠÃ̶ɲ¦Æäâ˜}AzQaöËC8vóºg΄u3™{@ÑÑàLãøR3AªÃ™n ?Ó ÷woÚÝ¿¹˜ ˆÅóƒR]ûŒc +Å{ü‚cÙ|§§€ Ëjí8ÁТ°Y¡V-‹ÍÛR²›ŽP„Swؼ„Kî[²ïBá}òö%öåö(Ñá}Ž_îÊUu(ü©W…Lœ^é®:z×®“‡>ûh׉?E±íõ €žHMÕoAYãq•Í®wõõ®*ÞnŒÉÂ86è0 <ÚïK§;›vÀت«D(,E Vø©yöϛr¨Ÿã ÃND¯›-Œº!šméÝÄÂþ®Ä«îuUíëÛº×’…ÍHØk'ìsï~‹¯+Àsø‰`ÙuÎìß}Eo‰gÂOÛ]L±«Â÷¡%øÅ­à—dk—è:îîܕw÷^#uŠÆós®U販ºl<ûeµÙ”»}ý‡ *Tëõ®‡ò$,˜®ôÿ:ɞã{ÕÓB8þëDö­Ÿ^᥈çÞ·Pqì[ÜP¹öÖåf¦ £8fԐÁÀ·ë(cíJ¬M«›º)˜T­ÂK*§ 0RxqhיÑؓWtôŽ øð:9LÄp¢1? bÆ*4~ìÝ}‡L[ôs½^—‡òógï)}³y¯‰2ì$ ÆÃLÇx³,s-6B ÂeÓH¹ëº´ˆF׋ Í«¸'&G96CB(?셴dÎ%\º^Ómª½6sŠÉö—d ’%Y…aÒj²(û·Øw›.´H]Ró^gÎHÉáÓ Öèî³d0.:~k–REì98:}•?‹¶Ÿ¡ieuíºíÑ@Ð˜Ç DhìÄIî*†:«Æqžqe˜?Э^¦‚²6gõcŒz÷?½Aºëñþ)ÑTߚî¬&P’j¤×ó¤xåȗëù­}UÃ{4¸!;n„[#ÞÎø»ÿ%Óh¸ìUՆœà&‹•÷¨ÅP¸N ˜î¥µ03mRh™wYŒœxý.Ñi þÑÐÑÎLÛ=L4fÒ®i;Ùi,ù°ÓØgù“Æ(VŒÄ!f ò1!SŽºaCÌdŽžß+G/¾ä<ª<ênÔ {ŽnöÈÂdÒÂþèKG“*S…*–Klë[HÉ •Ø7 o£ªHªÚ% +Â>ѝvئø2ÕOßràþþ)ù_%°§Uÿéüü˜Ê»K\Z¯Ì™zűFöôŠK à'Ôª]q¬V>Y2ðÒ8Sñ¢r©™êî«¿$úù[Vb*V•‡(ë+T.TvY ѤÙV>I]bþç&ó×5üp17´ýÝ!NÆ—¿bôï’+ÛªI ƒˆm߉§Úcñ‡ +ƒŸýê²m,òâkôKºU™Nᘻ¬üíYK½ŸFˆÎ?£#¹¨E»>mê2råü(­>$3ÎU{2ó~Ù{`V¦y…Ht®ÕżTû®éᏔ««c Aƒº5úö» a_Ý +endstream +endobj +143 0 obj +<< +/F1 10 0 R +/F9 41 0 R +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F10 52 0 R +/F6 25 0 R +/F12 62 0 R +/F11 59 0 R +/F13 84 0 R +>> +endobj +141 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 143 0 R +>> +endobj +146 0 obj +<< +/Filter[/FlateDecode] +/Length 2353 +>> +stream +xÚíYsã¶ù½¿‚} +9‰âwӇfÛd’ÝÉd&îSwh™Ñjªc«#ÙÍC{ñ + $˖-Åz±Lâ#Žï¾È$GyžŒóómòõ՗ßÐcTðäêׄæH©d ’$¹úÇÏ鏑iµÈ”ðt>š³_®¾ÿòÞ>Â,É ôÇ×Ù ‘~²P¬…"Qõ–ÕÿÂþ¬@©-Ý·áQá ~íŠt9¶¿ïK€NJ¡œ'ÂþF¼¥8RõRwvç‰D…„ArŒdaÞ{(/’fü: q…8£Ê?‰Þ&uP×Y6 R¦ ¦"y‹²èV‹çØ*!éçÁTª'¶ÕMþ”HÉz”¬¡gÕgúW"FŸ’A>Æd‰8 ‡ç̑hιukÂEp}:æá?Áüaâ! f0+´3Ìnô ¬« 0õeòC°¶E௽…áä‰q@Q¼•:d+uÄyQ‡÷Q§×`†rö5ûŠMöŇèË]ì‹÷åސ: +<qøñ‰C·‡Ľ]O…ªÆŒ„´PN5þOÌLÜ<ÌLÈÈÄEÌðƒŒÄIƒwÑ—6ü1l½ðîɛˆ›‡™ˆÃ˜÷$œ^Ñ¿ (+äOh)Ê%U×Öó¸Õ6&œAG¡¢Ø:9–£ü`Wc§éjÆ<£:m✐…zÙAxÄ&Š#)žÒ ÞÆ¿#µ# +?S=ö}¢$Òá–ùS¦NKe7ÏXî9Ñ©ežÖÜWÁQ”Ÿš‚ëq¼n#¹nq‰>Ýø1¦›Cî…[êã§èøþg½õ­ßv(ßÎ{ôpÞûSÙåmfg¯ +õ•Ž¤°€§t¶Ö/õ$$Â:MhaK ^[~qØ.ÛÅa;³xù$ë&—x9–ÒÝrºW¦QåŸW=m9„0Díý0©V%ò²’Éï ӋÀç^ÜÜÓö†&.LZ²…$n€ZH½õdö!Í R!&;«»íê__%LA/ç€kæ.lÉ仉=øªš/ª©Ã²­¡/L%ž*@Âä³jY®Vsë—³r2Íëú¼›ò*SyÚNËSª8ä¸Ç5i¬?!Ðp{ºÊ +Ö<È(ÑrŠ|’>ƒöLB‡“¶WI¡DS +}6¾š”‘~a>Ù°}Ü ö¢S4kr¦ñ`@ Í-ïÃÎ)ýƛ(cÁS@{âqH uº"˼úßm°Ó¢=#³€O•´‘ç1ÃçQog¤FÂzVº]®‡+ÒaÆ5_-!v$¹V‚~ÉxkWklè›ésÜa¯£ïØÒÇ4À›Çõ¦@Ù@(•þ=#,Ւ¤<™/àÜ!‰´8?˜Dj;…T?¨Ç¥Z9HÜĈÒJÄ6OߔëáûOp¯h(â­ ´Xy£‘*ëÆ5¶Y§î{ßH¶ò>Êۆª›íOzFŒža‰½Æ ›W™—•E’ûYÎ's÷_e1i®s¶é(VM÷ƒ$¾4œ'rI‹Ü^‡¢¹Þù¬áŒ„ò­Ì Ð#sóçWÔã0 úaY÷æýkVZšŒµ0֞PÃu¦QèL3ԙN«»q¹*§­15p‹ƒÞUÓ©›M['¥%_2‘¾û¬œ¬\æ€ +ÈøÄ´–˜Ès›6s ù4¸aì/ËqúaQ «;oi=8q+ê¯Mæ åH¢´Æ®—^#ž]dZÙaÍqæŽ3/·¢`Ú[a­'&ÿ:ëq•¦-²¹¦ +ñˆû÷¥çýØëƒÆÎ\‡NR»®»nօvLíOÀ‡×„`‚Œ#@ÝþÿòÄÎL +endstream +endobj +147 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F10 52 0 R +/F11 59 0 R +/F13 84 0 R +/F12 62 0 R +/F15 118 0 R +/F16 121 0 R +/F6 25 0 R +/F1 10 0 R +/F9 41 0 R +>> +endobj +145 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 147 0 R +>> +endobj +150 0 obj +<< +/Filter[/FlateDecode] +/Length 3004 +>> +stream +xÚí[[Û¸~ï¯pŸ"#1W¼“(¶À6éXA‹MŸš¦Ple*¬-O|™NòÐßÞsHJ¢,JÏ%»‹.ddñvîç#y4ËIžÏ®fîÏ_fzûÍ÷|F)±rööãL"øl¡ ÑlööÕ?²ïnæLge½ÚÎœ‹l»+üÃr[ïüs 2[b¿—¾±.×þaWªåvú¼Ëæÿ|ûÃ7ßËnA–+’ÛYî{9_PýÁw]'ʉa¡Ï¿Shbuh•„‰ÐøÞ7òäÈwsOð:p°:–žæMyØUÀœBæN—¶”ä&Ì°ò­4÷ÓB«ÂÆ%&0wº<<ÐYӜ˜œP;5·íæ~=˜{Á #—gD ש%ÈV®³]µ¿ž/Pµ‡Cu3—"+6e:lz¬ŠE”bDŸ&¬UhtÜÌhN¬˜qB¥{ùßÁ„ Fr´6=’sÊ0ç~[o=iå§#Ò̳bh®°AeŸŽ…·ÔÜ ‡0¿†¢ò¯÷Çmxªê…£rA•& ¬ž +"<‡rçe²^W/@L–eKÅ Z4˜=>ÊÌ p‹?À|sêÎ÷XU›-PQìJÿ»±#øÁ“ÞÚbêÞÀ§¼AMyƒì{ÃØHŠJ˜tæ()¢íˆQk4̶݊I½cJ΅¢Yཋ (–}¹©ÞѶ^%Н(ãU¬w³)w{Ô-ˆ°ªý߄a`뒯“Â{´H26rBv,’ÝÐi*?’ sDC)X€€±¾Û_wÛk4èl»¯¾TÛ$,8Í8‘Ÿýù­‹ò6‚àÄ¢t¹ÄÉp–«¢ÞØâœ4<ßÃWÞÌ·@ÊSú ‘YÝ&˜’‘HêÁ"`¼gN®ƒÓqÐé/žC„õŸSô qýŸôK¢Ï‘/ΑßÌ^ÕÃÅ1¦ ‰±M ó…·únÎ …Øl½ÝÍáÏ0ˆ E$ŸTªl…rÊ.¤¤¡÷å-uÇïçÉÐÁ´ñ#³!W€üOX­Ëï=p.öCÕB*bã¶i;増–ûLÖæå!ŠÐNìŽt Yõ}r.Á!Ý{^{»& ьí†ý½†Ì"Œ†`w½®–EãÎh™>€2  Â(˜ÂßÍMU@z’!"âH̀Øt:3µ–{G´’ N²•JÂQ‘fo] Ô)Ÿ3$çäDg@DRc=äAvq9àÒÞº ê<N]ÒGl¯êjˆtTFcq²†ˆaáØP”0Û +|$(´†×{–ÃÔʵþÍYŠÎ€‡ XçÙöúÚ¡-hX¨Û¯Ω«b“°* 3žWÉTΓQ„|$­pȀÓ9ËrdÏ$’ƒ -8K÷Yœó8tŸÎaˆlHü£g +¼‚¢b,¼8 ²¹nºç˜¤ó:U‰ GÁö'œ¿/o†& ™L÷MRõM²±7C&`‘Ðz(֕Çn݆‘Å„¿’dÀ{îêaäÈI+G¦ó¡™Â6ˆR° +ø±À®˜º>›â6喺áòã`Ù¥œUÂÊÛMîS…H&æ\’‰Áçm +|;˜FĦÖÍò>•[ñ½@Ÿ¢2Jª?%€bï<%‚ô棿_æìNRL5z©‡³xt4)EfŸXŒìŒåÃŨ.3Ƨæ_Žð?©&ñ@2ù£[»Hªé +#ŸI£›UÄæ¦AD´Ié€QÍì?3͸!g‚áÙfƵp(:¼XÏ~<…í؆`Ç# !Ðàx˜‡5Hiý¬ÜWûCY)<(XUT UU¥Ðî˜"J.:~™"ºéZî÷þ´òÁÒ-£³«b°Juh((Ö¾ííÜЬÜîÊMh/õO%B­³º8wź9큝Xx”úڃ/ìO ν~VÔsÖýëöð†ÓäÉüÏ郶ºý½",¤³ÒÿIupþv¦n™pÆO«ÀõËâè35þ÷ٷ҇¡;ˆ¬ð¢Ãœáæӝµ™ðH&KÓb"‚Ç"{ã€X^ÆÑC4°We-e_†é¥0A`ÞA¼÷©m¬¸S›ŒRÄÑlrr:ÍàVXĶÎÊèÉFöÆ]££ë÷_Êry5@ØÈFweÔa§T%¤ª_²¦Ô£hŠ=š;%ºbO§š³^DŸV7²¯9æEã¦Ë —¿™îy ¦ÇE fǀ˜ð77sÜ ç^d¼y‘bí€já>ĸ¢Í^Ø+:Võj¸¸vwiLàÙ×KiŸñAþדG| îgÎÊÝÑÐûÔ¹bÿ/YyÁ˞•d.8<hÇv0û>ÚQ¿ªh6ìu*Ø '¿Yï»ùóÄÁgž»}†É¯bRÊqUú§ú×­*~p9 ÿ/IœØ鳪Á•EiÒ15ÓpøÈƾ7`|f£TlÁJ ñ¥PÏS4äzš È4"ƒåÂ]ú“Ñ ¸œ5I ÃK%QÂ4ÚÞ8%í€SJ𨽣åÛTÝ!B•/§H܁#°°È6·àþz`ëevÅþ°í^¹‡þé ‰8uHŒ’\¶sn¢9ÞÏ"«]Oæ(–ZyÌÆtû"Õ´Óïé^Ä= ÞæÆ«7/ÚÕQt(E¼Üî¶ëu±«q-ðHKŽÖr0EdøH-멛±\g-±(×YŠ +Od0hP,Î`þEª§E|÷t/¹®[½yÑ®žÎuÒ_•œæ:É5æ:5žë,æŠx8äºáu튄î{Û~ÿŠ>0”¶<çè º —˜ý–ŠËý>Ôuixã²b¹÷-õ¡ôýSµ€Rt÷=Ãä AÉv…~Ñj˜myw²1´@nF'ÑmVÎ$.1£È8\çà—Ý…H²<‘Ê‹ +ûNöSí­ìþx¨ëŽžîx÷ݓ€í.}]PreGîOƒ$Ì’â1X~.É:–{Uˆù¬:ÌWk;®ŠP\†÷ÄånӔ4¢$nŠuxºv>° ¥ß°5·½:PçE® 4åEØ°*Ýûoˆ| “¾›Þ­°6|"`ÐïðþR`%ñF¾æ "–dä~PG_ªÃÑ]¤b[{Ë û®¸°zVkß%™ø·¾Â4|‚Zv,×ßãÄË]¹_4u·¨ÄHÜËî;™kEàÁÉþšTHÕ SØWüˆç¥÷çÎtæžÓV(‡ ö%Ç=û/ã« }‡kÒ×w8÷õ¬ÖÛÚ+ßY«¡½:dì.#Üs±Ay}¨®ŽÕÁ÷3!£ã0Tbdfu¹^?ó¦v¬—•ÿ òÃÊ};†Õ­™‡/!ú¥¬Š:ÿr~•€áª;„¸M–@é{§h¢T‡Ã4`YæËr]}¤Eá_Ý|Š\y®ÿ±^ãwzC™@:ШžÎí]˧ïSÅ(FªODoǯ–¢oA~?«:'ͽœ‚ìF.Ôðó?¼KÖª×ãžÊº^ÒS'á<(ù„® +ØLwóÇÙÚ`¶ù5?ùº0È ·¨š|l£Æ`eþ¶8ᆉô~÷?­~Åì +endstream +endobj +151 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F10 52 0 R +/F1 10 0 R +/F9 41 0 R +/F6 25 0 R +/F11 59 0 R +/F13 84 0 R +>> +endobj +149 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 151 0 R +>> +endobj +154 0 obj +<< +/Filter[/FlateDecode] +/Length 3237 +>> +stream +xÚÍZY¯ÛÆ~ï¯Pýb +½b8ûÐFgA £H㋠h”¼­2 È.Ní‡þöž3 94Gòµã y‘ÈÙç¬ß9‡›,ͲÍicþ¾Þ|~ûÉWlCHš‹ÍíË ×)g›Ô©¢›Û/¾O¾«å«-UIÙõÅÍv'˜Húñþ~»ƒ¶¶©Šs»ýáöoŸ|%æE©›Ì,ð_ÛìAXÊ´ëýÔö’l£Ò\aož’ÍŽ¤Út?_O¦ižo|?œd½{žJ²ÜœçHðàH‰U¬cÙ¹Ã|Óµ¨X:iûêÍL–½ß‚0j¡’o¬2º֖Ì4“xCfa¿Ýj¸cەgCo‹†ú›Ñ÷b‘$ÍÞÍ•_g‚ë·\и dÀ‘m*/2…PPyõN®¸3<[QÉ™ºŸ¢“‰5pe7 î>´†vÄm‚M@I(دªn€IÒ^N‘ŒÛƒEŽeg4Oíù¾.‡òÍ׀Çÿåy–j«g Ã +ζÒQ–jêÆü{µ„¡@æ®õöT‘Ro`~ŒÍ”ÓLc>Öt…ÁŒ½ƒ°Y2ÿÆ^¶ì«~(×äÜî׫ãæ©?-]“ +NÂ'JEü ñ—Šºt¬0Ú=û5¢´¸ñšõ¥6‰KÚä8ó:fg&1ì°½l×EÊ|o–:aW¹eõ$ì/ÊÓ¸¦{ùPÚ]ôˆ¿!íد§ÆU.ÒîÈfŸÈ$‡k€ýBôo,±Ö­7¾õ6cž—çsaYÊ5I|.ퟃZÕZêµD°vfe©b×`YsC,¦³€^¯cësO(o-í‰ëÇcSªÁZy'…#À…zÀ4‚U’ÔÕ¹ÐÂ[óƒÐz¬ŒTœ%Ϗ§±8ÕUѼYc3ÊiªÈeÚÐ4“ƒ Ï"î&dòâQ ¢“”]õj+xRØ{ ã ð6ó%wΉk…êgº=·œ[}üòÐ;ßü²á°U†R/@iÕæ<7p•rµ©7/‚‘ÔuH;R§TM ‘‘°&YŒ´ áH›„»»†y÷Ïo}HA”ÆQFؐ€Cm?t£g04ÿcƒÿ(ûò|_µ¶q¿?´Í¡+‡ö‘m˜•‰{Pÿ .êž_¡ë†Àw¸Aª“æWOq¢Ð¢¨©.Š1pµîÏq‰ ™~0@_•çÒx³ÌÊ0Ž<ÜbD[ǍÏË;«=Ì͉?ÔﱧB5E}.-Ò(í&*Ca™ž…‚ñ¸P-Œ¾±ISIrPœ¾ì¬à5G?f†QÌa@ö`fä†Â¾Ëc;½8ì³8ÉÏcÙæÎ<éK/®~ŠzèZÛÞ´ ²j û N„£ F‚‰§²)»¢®#Ëyï,ß¿øà&†WYç#ý!|}968¨Â7™œ«~슻ªvïåюª7Ns§i4ƒ¾ÏÖ`ÆÛhkƒ©G(ä»Xa׺/º¡êJû‚öÁ=.‰šPƒQu¦‚Ü%úÜá„ÃyUÓ;Éa—ïL p´¢8¹¯ ýJ•¥Ú«Y´ +ü³ÚÚå@ ËÉêÌÚ “ÓÌf^àzµ¹±Bi_ѹá¿U¸ºµopjw.‡ÚlK ùjãv,µ¾…°'|ù _ßøòkÀWEï[ÎÁ\ÃË<Œ3÷/êjº|ÈC.,ÖçXS`a¢ k>F9DÛâ´¹®[k#"ˆy–?L9;BfR'nÏÚý·Þºî.Øhí³˜yºâŠHòÑ⑥ÃöX£o›Ög¦—à cÕ@+îGK½Ñ™WeÍ+ˆû¼j–RºD¯, ?¤?ÝÂ~ùîô£‹+d(áN#÷.ÊSVõT z7Áœ¦í΅Gœ!êUÀ°TÉ g3È:{j~ 1,õr}ZYÍa´‘k¥’'œ¢EìRëÏÿå†Ð04„¡;xy³ ñ£Ós‘Wò¸ŒäjGü´1fÕ{‰§ãSNbabîIqZM°ûÕmŸÌÖpA=á:8L(Óà,#&Ä ©PZQ(0W֗[á\tHúä³NÜ Ùcç<žœÑ(铡T %ÿ % Êä˜íÁk+ðÚÕ݈ nÛÚÖґơ§6@Gk"Ðo禍± Üë‡~LƒV,Z€z=Á½ÊŠˆ·¼Y™æì¡ûû}Lë7=ÂDßÚGuàñ gâ<˜ÈcÚ>í!@À'9ûÞ¦½±7Ìyš-½ÉM™MgY£ý93¶KåAB°²Ã¼Ì-äIϜŸÕŒÄÕ¬‰ƒ«·Âë ôâ/sº©ú~Aø2 DXÐ)}çߣáð\8pö÷#K}Éÿp§_T ×è仕wfÁ-h>¸MěNᩃÏ@ #rÀs_Jûæ󝷜† 8?+\¹ôjiô[÷ *”`loð”ÒÉ:º',0jM„Xù\Ö@ ñØ_›#8d¼«ÝÙ^Kgi®Á¸k°ÿ·Úig»iD L«v«/!¶Ä* lÎî~Ã;lf’ƒ9>"² æˆ@·gëÝ8¨1gd°ëÔ¬óG¹œO „?›IM¿ÒüâU|3L$ËM’€Ì@}(Õ{ȳ¡Àœé=|À"¹NÉn±øÂßÊç²yÔ³ævMñr®Z¯Îâ~{s39O±òÌ’žâ:=Ù“s&ÆÕháéjÓ Î%‘ DѐơÁa9V&œÁaZOæÇœÅé© ¨“1ã“fA 8«s"WÍÆ_"Ñ•) +)æ›^Ž‹¸V5z?)2™ü<CÙ5æMÇôWesò÷Ì­eƒm¦ØöšûzHľÅ뫤«ú± +ûrFP4—o(…Ѷ`³Òcçhçûçd›„8Äy]ptj¸$\$·a&qpЗw.{mòç,c&ˆil¤ai®0 Ûڧʵ|Öu… +¾|[Z8‡ýµïÜ>²kmsD XFS-ß«nÜýš«@…)T»Zצÿ`ÀÀ†ÜðÈK³TèenöB¹·_lù‘+ûWâvŠÁf»§š&÷]y¨ú"¨Z`«a®faÖÞ|rƒä¨æIߞÏ>½ûÄg;]ÖÝl> +$e/a Ye$‘?—xßõ‰Ï³h˜9Gj&¦ÊVIAÐÍýþeÛ å£ÔÖÿ1“à„¢¶ÿ%ÁæˆDaF^ztð<ªo;ÒßDžÔµ/E®| 'Ÿj±l©P\†ñÎW¡"ž‚|DWFXc]Ô¤Š”-ºØ~Ò2lžµ ßÂ4¥hU± Šôa +ôÓÂʸ=ʜèN6¿É‰¿h+ðÊaîý?]#b6ēň·Ähicáú1#±®e­‹+m¹Ô‡)rŎ>Å|‘0æ+µù ·ÿìîÎ×cMÚd‡ÆòXùg+Ûa* Èø*ò]pÓö‡jZ; Ž³=U…`‹ÙЁ¦LÛ.¦úMÛ¹­ËUm{ªÔšâ G›ÝÔyò⾂õ`…$åaYùƖX ` ¶r}.ºƒ-•C_íþ1-$P½yãZ +ûçN¼ªÉžªñˆ™MKãUqIJ ¯NËœ»q¬)ñYwüº€j 4Ә×,yfQ‹&°gðU +ì—'ý}UžLæû›{ÅÇ©œMm نD†ÿãüIÀ öÛìŽÛï{“ÕzS<²«àçñ ŸhÎß h÷̀öß 0‡´EîÜå‹ ~JؼìZ'ÐO°ÖK.È1À¥i–Ï2Ã#š‹Çmw¬·Ç«Þ”€H3PMš#n7‘ƒpÿÓÿ•.© +endstream +endobj +155 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F10 52 0 R +/F4 19 0 R +/F14 95 0 R +/F12 62 0 R +/F1 10 0 R +/F11 59 0 R +/F13 84 0 R +>> +endobj +153 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 155 0 R +>> +endobj +158 0 obj +<< +/Filter[/FlateDecode] +/Length 2664 +>> +stream +xÚåXKÜƾçWL|ñ´É~‘”‰ „ pöæ±îL\ñ±òÛS&Ù#rVgeÈe†ýîªúªê«ÞÄ"Ž7§ ý}¿ùóÍ7oÔ&IDn67w‹,Ûìl&R¹¹yýcthê­L£üqíÉÕŠíNÅiT» +?²¨su×àg]UÜ»‡þs¹ÛoÏ®oËC!¶;-óèmÁ3ë¦ë[?>ú¾øP6µûz•5¼ +8ÝF}³ýéæo›x³K´Ðš.Ö=”Õp_ô°‹L2¼Oõ¢8ãôÛPçѕüѺ¾<4µr¾_¬„#¥N@ÎSU:ž|.N§²iώ÷½Õ ×u$pCw9¢.t’D7Û,‰\ÓºsÁ^#øù]CÛ]j^7ç²&9°…²kÐA ;´ãîŠÍŸKwt<î×ðÜý´9ô»¥–ú¡-¾"ÝÛèOd0É&µ¨ö¶lP㱍N¨,ÚS3 +N] ƒúç}Ù÷®í¸µ÷V’ÑíÐÔv`ÖÂCŠ®èýân@E,ï7ÛMŸòa í7¨IÐcE§ÀÀéOû-ªhP8<Ô<ö°5**ºÞw€8¢áÁL0àÆ>:¸¶/HØ­¼¸\í`rÔ(ÐØ耀¶ÃV‘]åM ¶¨·Ðø/J¢S;A\gˆ1žS75oCþ„=‡¢kø«óÊËî¥IÍ~ ƵRGEãæqt?°8(d–³:±»h{ï»AïhQ¼SlÀ w` ô•æp€5[meäxÑûÄix!m}:öû@Îä\:ÉÝ®¨Nîðør»3àrÙNêîQ5¸ã¸sýPºî­7÷ ï—ì#<à›7f]R%Â8ûa»K£W‚@!§šbç×¼sõ¢A0Ã¡Þ VL¢?.„ù4N؄XËêSŽ…Þ±?4gHåmY¹¯Ðáµ>(G%&¢ ‰×ån0ÐLjHR)äxèÛåL“£Zώ÷™à Gp8Ó gŽ_&rÓyÔüµî†Uƒáƒ„J22k CW´;f澤¿¡á^ +ËÏNˆàH¶æ…¦¥ˆÍ&Vy_Y…ónš è>¹²°Ñ™Ð +ð*Sa2V &`0EçàFGJô‰ŠþŽ±A0ԇ’B°´1§J Q¥Ó$®EUàÿ[wË!¯; ™¯X¥`î¿9Ý·Þ}¸ ƒ e{T‰òùKÉ0Ú)¥8òbÿ¥(‚ŠÖµåkËÐETÌpԔF?bF*ñÌfŒÌ>)4í±¬Wò p%’ßøtH‚çސ~ÿ†:ÓQ)×6S°÷«yì8–,ˆÞõåÌb`NÝ ÆÊq˜ÿ×D!Lä34Vä£wòº÷<‡­E­Št žèÝ·Üº"`ZH-GúWó|ѹ‹‡ v–ø­ß…Óƒ_ÜÂH$ÄSR÷~(h0œOô%ï4's"± $¾zD]4äš%F˜h!v”粇¸B‰×˜„í¤XÇ ‚üÓlßçíВ±¢#8®$¼Ð ãw `§6mï»öh ªpí +ˆ^;duD× „ÛXÈ1R}ûíZhó’˜œ@"í¼o“Žn õŠs«$gpâàÁñăqD e)$„uÞÝ«;øƒŠ‘î ææ2­u՘ 5„càH—i0™™3DºS‹|ŒæeíM SˤþÏ Izl¸é“ ½ìû8dl¢¹q†¯2#Ðj¦Ã¨Ô ò6•Eo_”gΌ`èb¤¢@ ôìá>ú§àš Æ*šcØÓ±ãÒÓ±gÔZé'\ÓÚG¬rT[s@½bÜA®ËiÎw+Ä  6?J®ì¯‚í—iÎ7óþ¥C$Hð½ oGqŠ1ŒÎ‚'Œe&~_”ر²Üúµ¾~àŠúЌ«‰µáù 07V‹$»+ØŽ=”COÅU¦ájT]¥—6I›@K }Lª}Y3àú®ï/d* ‰Îo1øՄ­eX`´!¬~v »iàu™·ÌqEíù8ÈñF’t£DÂhþ÷b¿ aœ±Üӊ8›Í+¦,Eš .•yv™“¥‰€ t§:7%Ubœ½Ð‰ü E`ø“¾˜B¢JÓe1Î@˜Wù+ÞH ³E¯ºæ&ça‹ä£b¨u¨Ž\ å7̳˜#­=¨h™‰,a÷Á`a)÷aÄ>ÊζŠÃ$(µ(Öb_çÆÐgú?²[ß?e@ÜØϙŸ<°Å¸&üù{Rà¢Ló¤ECdÄðϝ>e÷¾I7ÊЁN”:˜=Æ¥e?@x'(c×2Ε<àº÷å´Ý ø¼Ý`B?ö¥·!~ä8Ôï‰Gj)£±+–VØàR;§"¾QBH²ÞãÈõ²Õ÷ù +ÙÀ‚#ë̎ù̬¤JBTë²YŠŠÿŒ½ ì6ã.#ÜmuMviF~&9£E2%9N(õ‘A¦Àî\"²‚òÇ굒:Q¹0z.©³+%µy¬¤¶•Ô沤¾VŒïÍ{™&kÌEfAéíËÁk—ÀTÑ'.ýrq–R"›¤\©§"/|Ñ2¦ÒMK|´CŠèhü¤½CÓ7¯ÐÛrJØØçÑÇIàc…H&N?ÃûÖÿ£ Kñ3a’Kñõ…‚µZ”åæ’;ªëËxü~¥¾2¹®y¨G™° MWÞÄֈ$¿x_º(Ÿ/Ž1q”!]}ÃPöª~ì¼zU?J^ +hCg2½. œÝ«óu¹;®^0³ùZ£kð( ‰Yy[ºž™eQñ¤tX× Q9ÕËW ™ØY±…÷®[ú‡ºr‰Ê|vb¹4a2¿,%„êÐ $X¦Bq,LD˜*ÍE’€Ó-‘Æ_µU:ß}%di|ð’-$É&7_:WB!ãbåoItP a%þÇ¥^ãY¿ìêöK_à)º{÷¿è€zp_I~„¬OÁÂB¬°_·‹Cuøî‹VÉÖ­¢žÅ(·‹›§óåÖ¯.³Š¹´ÊÇ)Q~!$ÉÇԝýŠN𨾟à ¤Âwr_€|ÂòDاúÀŠl¹H’G̒æÏâK¥M9þñ‹ˆÕ³Ük~‚Fž#ïž#ÀÅ™ âþD¼±H¥œ«ÖeûBÉå‘h£ñQ÷‘t-'ÿ&HÞeû‹–|Zj™écN1nF²ù’u,ôo=Jýa¹EÌúebŸv•«º³ÏI¯iÀÃÒ¡âÅ K%õ üÝïˤ +endstream +endobj +159 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F1 10 0 R +/F14 95 0 R +/F9 41 0 R +/F10 52 0 R +/F6 25 0 R +>> +endobj +157 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 159 0 R +>> +endobj +162 0 obj +<< +/Filter[/FlateDecode] +/Length 2507 +>> +stream +xÚí[Ýoã¸ï_aôådôĊßÔ.¶í^‹+Å¡—·¦»ÐÚÚ¬ÙÊÚJ®¸¿¾’²¨ˆ’eGJZܽĊø9ÃùøÍp´JP’¬îVæço«?ßüñ¯t…1JùêæóŠq„Õ* +I²ºyÿ¯H õ¿oþ¾úîÆôämO‘ Lýž·DbèۙO¢„­ÛÙVo†8w­™mdm£Bʵ}ìM‹$è¤y?õæ•íн‘01q­›Þ²Ü£f}»îM bÍè["dzÒN¿8¿ÈúÔ[”¡TÈzÛL)Z~Ï‚gL®?c6‰Ï=c™ÏŸáŸ‹_ם±§Ó+¦Ózœ +„±iþ~S"¢c~÷ï×ú©.à >gµ}Ñ6?kN£l_ÙÆb·Ë·EVg;7(w=³»Ò ʎǢڹò2ßo2;ŸŒŽÕý!{c7ÛMÇX7bÂ3{û!ßí²uÌQÄeÇ6¥+ô“Äz8I·Tý˜ôRRD՚¥Ñݾè3^!,ο]ÇXˆè“ù•Ñæmï((Fªá(é†×úOÛêïOoÞ5ŠãCYg}¥(% IQŠ:fZ•¸Z픓ÏÓÄW¨E 5­ËY©´úñr²N~jݓ½j3­cNÒèýCVÆFªcÊD¤b-üÜôѪUçßöEE!Î^É@Ïà„_Å@¿˜C»Ž¬¤ð“¤ñÀ‚ˆÖ6þxXóD›7øó¹c½U„ƒcž"*¬ur(f‚DÅÞy&°¦=»¿/‹M¶ßVßêW©ˆî×±¶Ö`J¡÷1ßA{Qk…äk¦Ò(3ýX´«Êº²noËâ“Ö:‡ßÛ%ÊÌɺy0¢n‰¹?hPäÞÌÖÍhR™É6Ú×8d[¶yYf71^ÜÌ>/íÃ΃^•íµ©ŽõᡆY¸7‹óO‡<+‹æ ¼C$šDs] šþZ5N3RFïú¬aH±9]–/·{ÚB¢?ô©P(³l ˆŸä¤ ÈY,Ë$ûÐ9ÝÖ¢1‚#)Ÿ“3 ÄS!šðs‰ºˆÛ]¢Ò¢ÏÅ¢´a-Œi¬1•ìg3Q]eä]ÀW*#»^Õ ZƒI°îUw4ò]ÏÑ4ý¸T¥_ D“Õ‘“ºB;Aª2“¿)ãoÊø¿«ŒÏõŒóéâËÐôêàn +†º +n,wZ×ÄÙ:Žb(Ig7~„Ûô×l4^Ê,³÷pˆ™ ’þ?¤n‹¾ÈÊвŀ!à×$º¿ÉÊúPÙ\Ä&;º§£ËNԇ¬®]¶£Øw3.½‘í³²º«N‰ ±ÕÏ+¦×Løi©÷"?^®~òzӀáJz*“t/B=ݞæ…ßS4ä­Þ¼8­¬Á=ÖЄ"¢ü;*ܨ±;Ì:#íKGîLvçÉ@ßò¥@ÖHêÿ$£ÁÔ?Vgrÿ1&Æ<½d–iÀpžó•#7m–ž†s¯;-¹Ö6›þÜÛ÷æü(zš +» ¡àúš¸Ö:= E?e‹7ôÎÚÆ w‰~hüÖ.ûOoÝ.Õ{勤ïαW ³Wn@\)µcìåaö^'€b™¼å­ð½OÇŔ*à)šË/((‘öÎXû ÂÓè±8ÔÆ ™¼=Ç"z€ywÛÃYox„\ûn ~¿ôm!æ|ɌLÉ*¿8æí•s?ͨ<“pù¼|о{óžÏ2^Uâ²TùƒGÖNjÉêDxZØò­ýÍö¸ú’j6ëÝK-yRy¾ Ùº\´¡øh-}þÄáZ:M-Ã2èE_áZ¼ ÃƋØTs³ôa 𤽟T(VÀ4úKqºž… ƒƒuhâž$->¼ +€Ìcé óà;Œ \ÇT¤ˆâù Òb÷SZBeÑ÷¥ Fù±î„°2z\›’-B\nÜmý!»+ª=ÔØÿÛr±}ÈJ¿Ö` ´¥ŠÁŽÚЖJcÅû+4î¬îE §žSvzÚýÐÖ[ݽhW‡¶,IAãoïsàƾøEs!?…¸é`ˆK©©Áõfø©€Š¼^…iÕn™°6m˘˜ÆŽï‹M‘íŒQH¢MÀµJÑ&¡BvŠ5¢'g‰ky‚ì‰|¦ ¦fÒcÀ×c©u +û1÷6`E’‰ˆ¬Ëd߆(¼ébÎ7/@Ï×tñ×Uñ%jž=}˜5z’mçŸBîà$nIÀ™©`Ú/íAÀ;™ð«Ú[½aŒEž*뤪úâª4ÚPúáĬ€šhVÒA5Á^¸óU[ÜÊD„}–3í I7²ìœeËÖ ÅÓßüEÚß'küœ;¶ádM©›Pšçšñ_ŠÇ¬„²ËÚK¬Ù%+Ó+bÇ­<{'Ë8 VŠSø"hâYõê.'seÍÙ\7ë g&Æâi¨db(SãŠûybÒëÐó¤j´|­¡!B#©Òþ>³²}ö¶¦7Õ~Ûàè»-š1€øîmI›!v¨î’Ýß +Ü)k HßÕ¦-[ÍÇM¨†t‰Ý:È·!$U6ñ¥¥¹-è„f‘×M­¨!Pº¯xô°oJFó]ïòúPl2ƒ]yôCX5u;° +‘Ùª“Þ2e©@·^E™ž_EuÑùÄBã™TŸ‚†ªÑ3=ޖñz(¤û¡á;¸µ“ÑçlS”¹}֜?ÖYmy ÿŸx¬  À.3{:=s*ië‰ÆìiL’¤a‰Üb™eWPI~<–L»¼ëu„¯? ï4›¨¾ÿú; +Smªü#ÛÀ”_Ü 45»-†Ï°4ífg§Òßܝái¨÷%IâJ?Aٍ²E2Œ²¹IwrøÔ ¡lÖ^í £l¢=FÙ>§DÙmü®…TÊ´ÚL„¶¢ÞVÈ×6Z&™Þú¯ V`jSëÁBLZû27¯Æ|¦ñ8‰QZ< `Í ÜSJ_vsC=T`.C HT륟 Ä;#éìñ‘çmÀjŠE9Er÷€‰ªþµ)ÃdJ4wö£È`ØƟˆëHåK P?ºëÉp³÷5Ç ç‰ùÎ0¶šÿÇc~xtÿ4¶ôéî´­RxÎépUâöDÌ6Üϱ‚+ÌSKœ{‘ïÌ8S³†ï;»g.ò¦ßAº°|¥É$¾ +¹Ø‡o¢µ¡ûÂ_›­“±sÀÇ Îñ? ªîµK´†µ8Øb¦‘ÑjJí(O±á²q 6xBfBx±áI jE,’ìèY-rÕKu×0mÛo*óv[4oŒáοÚm¡¯bóm¥6ùˆZJ¤£÷wÿ¢Ë3 +endstream +endobj +163 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F1 10 0 R +/F9 41 0 R +>> +endobj +161 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 163 0 R +>> +endobj +166 0 obj +<< +/Filter[/FlateDecode] +/Length 2353 +>> +stream +xÚí[[oëÆ~ï¯úR +­6Üû²Aš&)Z¤@ø­n +‰>&@‰Iç×wö"ré%)Z¢l /–¼÷™ýæÛÑ*Fq¼ú¸2_}s÷Õ÷É +c”ðÕÝÊÆH©ÕF($ÉêîÛG?VkG¥ùó€Öÿ¹ûçê»;Ӌv½„Dû½þö˜§UºÏk"¢&Óݾúžy"«Ø4½'BÚzo@ø¢¼|͉²õ†PU9”ÄY]çŸÖœF)ZoXÌ£•uSåé¾Ô­T´Õ3?†3c*¾pn5Uz¨óFÏÌڙÎÓCi‡áÝ0 G2qäÁ2ÄD°¯7&Hœñ!Xâ†*ªØ`†3²p÷ð¦ñ's§ßÓs3W©E@Yô£–vV­7>sûñC¶ß»¯q©¿I-GW ì·:·i°jT‘pD©[©ÄÁZd·–û(‚!ÎGÏ@!åê~ ÏÀý:W"%[áÊxR¸ç÷4°«îd_sSÏ8ÔV†Õ ¼!RF † ±¯’7>h:¼ôéq·2‘Kˆd\(œè³Þ`‰Ø‚6à{n„™6„D ÷¢P"9›sÊ1 uí¼ ‡ 3_¦ƯVšÿ.¬4"™Ô:%+ékMp·­&g<^ÒÈúšÄ{š„G4I¼•&ákU‰-¥JïÜuŽžêD×?@C(1LjX¤ò]]g‡†i2‰Š>Uíòúøñ˜~,K}¡¦r£ã‹£ @-YœY·öë ê:Û?U™÷'‹×R[s¥‡mY¹£x҅ÌéÿòÂ~j4g¦DK}|r3…†s÷ë?YD·-Ûâ¸3P<ÔöØGßïÏÝÌÌļãrr,!ÂÅÉRaÅ h‹ë9Lj­þ·bÐnÒ \__û®€K½žbõ³×’¸ŠÄ¶„`C¶-aLÖki ü– +1ٛÝt³k·ƒC·£?I’–UYi•ƒç¡’Î +ҋg_L4º×ý‡5K@à +•þžéç¼û&@?ÿº&,•†›¡(+{Qû‘¿bÐÛ,–sw{ÝÊfô¤‡–è¨ç3«8­‡Ù ì4&¦@wë(lÈ%wR“êlçèí¢ã·S[eèìçûådqòz4À=Õ¹8¿Û1“ßš°z;I¾‡pþÃEAg u2¨³BU·ê,|ƒD9@ Óð‡²h*ž&δF·€§\Âa¿•…S†÷ɑþòå+ø¾`Lq€ƒOLľ\ýÆ$޽ҝ§×G_¿Ä"Gôòç•íqâ9稔_€JϽO^JÅLT:<Æ×ӗ# S·yéXŽ6ÃÄ OÇ[hÜ9B¸A:â€A%Õ +åÑ®` %ŒÉz-mAHx³»‚nöoîVLoÂӅ†RÔø™’è)O·z“”Fuöñ†aÔÿž^ôw@Þ{½«Æ¼™âS:üƒ­Œ pŸ>=…‘.‘žGÞ ÑNñé,k·´ûûZÏ©¢ìóçÜ­i·Ë›|ãÈ&D/´d”!î$œÕ} C9bmÓ&;hŠ“b=¤MSÚò´®óí±JK=msÓDFåaׁiюlªE´Kۑ5[åYc5G¹`vä=Èb z5ámcMr9Ýz8ÆPæëÓ¾ÙJì§+hn†øÁXËéœÁ¦˜"ªu)‘ÚïLSE}·!ŸÛí3ªˆNREb’*’Ϩ"9JM2Eì ý¡žQ¬=ŠB±QŠB3¨ã‰‰ŽŒLœŒNìÝL†e"³Y&:ÁSS<\q×up3ôr)z÷¼£ ¨bHõ,úÛ£±:kq,bá¥èîÛERúzÅ ÿüíðº7¿Þ¼- Ÿž9\°½O-CÎ¥&ÜYø?™xµ”`°ì¬×0pBœrƒ{“»¼(©èfáHNyÕ,†ºæÖëòôu°x6)Õ䳊qŠa“Pó¤Á%·bz؛¨È»ÉŽ8Ï Þ8Iñv²»€oÅ(’ Ÿ{º=]ëŠF¨8…$_.+öÍyßn…»1Ãvžz\À1M¦û_ñ0ðò¤™ùþKÿ:îV‚¤üͼ¿ó~‡LæyørcôpAÆÿñәžš†ñޙw?ÛãÉé‰^ø&µÜXÂsŽ…7ØadNßÖL(ëX¤wª .çù×c~8eÛõi¥‰¤çʯדŠrt‚U +˜z§»S/ôˆCIкBùIЮ` ¥~Êìµ´!SïÍî +ºÙ‡Süc(–>që2¥ù8q‹5Œð{Ž·°‘,$ŸmH:_I†n 2žÛ—t씎âY2±dZx×¾J_÷ Ûë8½«o´ 9÷ÇC’¢—ó†3:OÉ©õ*³R•ÆèñàçÙ81)(àÒ4î1ʬœýîÿ>ˆ€ +endstream +endobj +167 0 obj +<< +/F9 41 0 R +/F3 16 0 R +/F4 19 0 R +/F5 22 0 R +/F1 10 0 R +/F6 25 0 R +>> +endobj +165 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 167 0 R +>> +endobj +170 0 obj +<< +/Filter[/FlateDecode] +/Length 3210 +>> +stream +xÚå\Iä¶¾çWÔQ¸dq'=ðaœÄƒ˜dú–‰ê.M€Z:µL€ùõ梩â"ªw€\ºU×Ç·|ïñQ³ª¬ªÙËLÿûË짇ï3JAfŸg¨*9Ÿ-(/œ=üé_ŇݜTÅVÿù\Îÿýð×ٟt+d[QVà¶úe½n–m}¨P-¾ÿ™8uQ é¬ÒÕ>AL§3VVøô¾ðšã’îmm^bû’—ðôòW¯_ WÌ/ïø4çG¯¥ê˜uoŸ¼aq)úQçŸæód¬øÑëâ’ã«ÈB‡³w·§}ÓøªŠûíËùn·/gNïËykQ‚îõ‚òSÛ_6ÛÕa×|7_ ŠûÏ»ãáPo–[-) (p‰¤d\b¬ë·+Y“âoÍz]«GZ ’põĊ]û\Ï!+¾¶õz믁 ì- +ÐR® $h)hŠ–,“–^ǬDIáa"³ã Ĺ ¬ÄMDç)0÷~vW%>wp¡_2]ã/—ü=Xêñ^,õë=Xj˜d*j—Ün{K (µ +s—po}>2T%žýw†e­ŠÌB.ÌÖýo.Jf«ÙG§4åÂԓʜ~ûõdØ­g~»õx‰™;®ùmÇU xP(õÁôZ:Œ+&u2¥´ã`$ ŸØ áǶÞøú¡œÈT¿›/¥Å“þϊçîÿÒã J~BÐg çí?Í[gf§ý.ç EñїwH­äøòª,¦!”LPybËgô’œ8º è Σ²ÀíËØ°à´¶¥7®œ5éé,Í«„ª«ínŽÅi…Ã=A(º~QV(¥¯8½ÉžÊ@¤&Y«oŠŒ#-~V‘…Ôt¯/ê%–í(™Ð²¡Ud¡eÓ¼ýeS‹íŒœ.(.’ •˜Nv]áJ§éfsH‹f'M•ŒT›ÿvÛW©iy±Ý·ßÚí¦1ÅRMõŠfiþk|'ÿŸð|”•ˆyªŸž‚ÈNªg¥«b Øs!¥²P–l¤ujK±¦Ã="{$Ò¬ ‘Ëš!þb£b5°p.2‡Ö͓ȏÃèºÞ|§6Ëãæ?GŸX¢§¸s“7üU4»×²•;Dhñ²«¿µJT¤*͌ˆ ¢¥+S%ííûM½Ú¾Ôëf£¤ï ý)]'%r]©7Sd!ÁéD5ˆ0' g +_ó)rЍÍÜ¢±Ï%ޝÝ®_WÒã @'â(´7ZvH4XÖ°IɈ eÀ™v.&”âõq0àÚX Ü„jJû:¬© |ÌìŒÞØÑèÊ„]ԌVÍR¨àAËÚÊJœ¶U`íeÓú +RZgx¡}û(JÊS¹m2¤ïÚýqu€FjÙ"ōý8ˍ?†XÃç1=h‹(Ó ½•ÜÝz¥i•^ böì ¢´?ÊýɈÄÈá’G Ó,ç1‰0o§ˆÆv6$‰íLéÂQ›Åx*0vŌOû¢053`aƒ‘ÊG…%DÀDÿ8¶›e«bƒ†¤kˆÏâˆÀT6rÝ¡Ç;¢ˆ ¤å„ø¹$Þ¯V[I +‰¦ö‡f¿ïž¥ó¡¼˜åéUkþ5>Oû ö\›²g‰þJg…°›-b"Šº\£T8‹¥Í3”H]šÔµS 5 ]õ‚Çèv¡šBuåÖÔ¾yvF?ô£GÌ3ƒ*êå›g>jžmˉæ9µ—XåÓ[Í£r_|à ¹5üuiö㇭ºÚÒ]o^§Ì^Íû9F +aX)^›H‚*@¥£¢Í˱1öe½Ò‘ù¨” ­¤Fj¿¶ùH昫H|YËÆÖkVµ‰´øp)y9WhÀ>ý©FÓõ\·¦_%Ý£²æmӐ˜0ër4—RËCr-_`îʵ)ÔDœš¦  ìè]=¬Åd $™åEJ 1hi4…I ÀA@ï=Ü *èÏ‚ªÀFl#ñ3iÔAJ®X}ž«áH\÷O?¸N*šr0&Š€%´)*Á$•DÆb®!Rcâ,*¥<œSÉ9ò}×y« »]ZëպلBQDÒêÎj<˜¾Ò›éÜvhä6†ßÐօ‰„®?Íò©‡ÜF’ÜFÎL¬´­^jbaŠ´ªÙ·ë¦CòÛ×]±]]k»$œ*) X$õ‚SÇ"ušDŸÁ;5Mo»œÑ»;zÄvq â\ÛE´]¬ŠÛ®Jé6·¥±]%m€ÁóYˆþAa“Âp–Çm´AO gå´¾øl¹ídºˆ#’â^À¦È8vy›Ñ¬ŽCqmt¹Ÿ/EÎÃ&K9à.‡8‡ãI)W‡>ˆ{¹g_”ºöær~]úˆO ˜o Ò ÒRx8-ÝÙþ]D[Ô¸jR§‹‹U»R‘wª}³o÷¥ÞEUlâғj×ÛýaWë”C\Ñ¢~5‡(:¤#+´¦ÁÉͽ›#Œ›c +H×zÕ-Ý@ËvÑ!"ªÈâ0èþør¬_Vm½ùÖٜÀ60hó n*ÏåÙǜí ë™ Žý¼õ܎_q¡Æ””Þ¦PoZü_[UàÌ:pâ†o +‡, ®'Fða•æä+°47Á„zAÝDW¨iÒٜš¦À|Îè]= ø0¡Êû2ÚR%Ú ÊI´Á„+ð¢àkåöMÈ£ô ðu;€Ité„ÉÝë)+߄©óE_á,³ïÉëPš<9½ó¼@˜Ó! Å$#$½r<Ô+©õ1 Ås t‘—­;”m‘ O³;kÔþöùÅÀ•w—Ø„XÅN…]xfggkÎÌ´&f& –3±r¾ ˜ïçÒâJÏ!šJ¨2ª•o”›‘2U8gIYáë±ÝÀ®ÁÄYt–1’”§HJÕûÔf¿ñ)óÕËJ.º‚ ’$8Fú'ÕX`åµEeØÄS¶!¥ˆ·”óPHjïyêðð‚óÓ1¾ŒÏmYoBFÛ Ö“Ž½üç›ä—MàO¬”gJ ý¹]N·äžÖ“Ò¦„=?¼*Y+“Oã˙Ú4ŠQ§w•­`rŠ!‡:[ò>RÙë (jæX•_6úNØ\'<íéAN•§9+vÇíJ¥E@aÎóUٗÚü=î¦sçb”Ãb„×(›F¹A¸ §÷ œ2f³åsæ6°DÃÙÜ;E$ŸcÌöÖ$à ¥Y·[5 b©UëñâùØñâªãÅC³o#þ +©T¢ÒÚù ¤ìû>ˆ*w3&ÌïP=1¨%^Šóôû4fØG!*BD|ÄTʃqEI»½D|hÙ©>Jœ'®É¿x֐cººHÀ͒/&øgþ—N«² »royÅ9uÇz$øy“ñLj†b3+”‰T_x£†Ho Ñ¯`/Ñ{è‘Bœòûà¨Cz°¦1öúBÖRJŠýV'Ï©'ßP`Õeð²$c×mÄè>&æMyçøVc½Ԇp:ϝ~ø$TÝìRø÷@>u坟ãð¦Çf€¯¡¹Š~$M?žC@¥ßq¨³“ šwKâ¾ú,+âwÐt$­éæ!/ +~“OnLRÇç“|sÇò¾3ôÛî÷m@”…{Ù,< r+“zŸkî7ÜļeúŽ®ƒo) ÙÕ îÙ»‚@MÙ'Ô4 kGï +ìè¨+°"š9…ÜmW«z×JsHtZ=CQŒ …¾]á4`\ Ã2 .Š†á¹£j³¢ð(¥»¹;}…dÆöó+Ȍm>Z…—0…Ç^àbxXÕ+õæ!6õ5Ó< òµH?`?Gâûzê%ɚY<ŠF" è¸ºÂ…W—°]ƒ™¼7¢„†)¬îâ'äi£k¦‘gôÆϤ|©ªTÚÉtÃNžìŽUlýB?"S`]„mw}¿G§‡@‹£ztzxÔM‚|xÝ5ÏͲÑ1²Ck꽞ÝÖ×·†2¹W²Mè*ö; +wã 6ø Oäƒ@Üé3\ηzÂWù/?Ì&Š`úœŽÐ·Knõ9û¥Cý^_G›vøD¯;­cÓ#áT…à7£ÍÍæR´ùÿÑû,K1•¿-”¥ˆC°ªÜ½{n~êÉþ [OÿöQ¬·ûݏûӃTšBÅ ”Q•A«á›èæÿ‡ß]µÍz +endstream +endobj +171 0 obj +<< +/F9 41 0 R +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F1 10 0 R +/F11 59 0 R +>> +endobj +169 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 171 0 R +>> +endobj +174 0 obj +<< +/Filter[/FlateDecode] +/Length 2705 +>> +stream +xÚí\Is㸾çW¨r¢jZbƕKϒJ*‡To㑋–h7+é&©NÕ̟‰¤ ÒZ½LæÐ%ÄúÖ=‰QO&öç×ßþ„'#Í'×÷#¥&3¡$“ë~‰þ•®×ÉtF(’ M½þçäÇkÛO7ý0ŽçíŽÿNKӍˆ¨˜2=äôüö'Þôai9‰mëäj:ÃBDw®k¬‘P¾éa +Dû¯ŸÜ×öªÒØýš¬R׀6 E‚ø7Q…°'¿ÀÞÂÂÛuÝö×ûOw½9ÒÛ~7ÓÞ¨qýü¨IoT˜ðÿÖïG£c‘#S¢w÷¢Û]Õv/i`ID½CÚöGUˆŽ’–œg:¸+«q3ªRFÁ0CŒ¹ÙòdULy=$ë4¯Ó½uK¤>šÛÌC2±ÓšCy —/áäèÍÐAFh„ùˆ€sùNÉò!}9ò²Æ8Ï2#’#¦Í/FT;GR‚[I/î;þ§µz!ÇF;bKuèö}±NªŠÇ2ÙuŒ›üwÂLϘï:¬wZ Á'«ÉÏ­†ÄÕ+×ÎJnÿi»¡¯h·TˆÉÎÔ®¢™:ì”1áHӎW– ¼2ïP¥ã1¬ÓsÙc¼@ñžfºë£[C`¨h„Ò0Q„ˆÄˆ²Œù»—?¿$2br¼BÊ' +ّp.ºŽ Ÿ¥ÃÎ?€V(£N;¾fe fÉ0Jð)Ç"ÚxXE%`¤¬Z¦+ç6¶6ÖÍ)9‘-‚9EJ„<g(mÏà*-͘¼ÓÒU|H3»¯hfp"Š‚Kh9"81x´‹ ÇžölG$9ÛñFÂv~ÑEéD#-FÏxjìŒG¶BQz‹øtÚ^MàX ù È©ãÝĽ1B†,„ÀLKƒÓŽë`QñaTÍÇEoRÞ2h}O&‘Â](ÜW°“ ¼X¼…ÅÑ–GR¸5顧>>õ큕hç*u²Y㇀½ˆÒXÉçD€ ÉØÉO Š»n8u8‰é¥HLÆHÌ^›Ä‹‰[«ÚþŒ?㠷ݦÆkÛ¤6 ºÖ;‡nŠÆ¡s8>a˜À&ÃéiĺhXã ;ŒÏ"ƒœÔp#¸z0"À oÍČQ}Ùdù23˜‡aé0ÙãSÌà æ±ôp§GæJ‹l{LQOLÏ]RÙÓ#Ѻ¨ê2)á€Í¨á¬¡öçc܄C‚£GåYŠÇ»s7C«ÇIŽ}ßó“÷Aè&'ˆÂq¦š~Hpo ØÁ¨ÃŒ¶x©‹`ŒA[¦`Þò췬Ȉ_ÄðkVI‡€ò™ÀêíIç‚!$¤ª ¿^hïó=ö~ZPù9½0‚¡·H•DþZcó°+m[î[Icä¥ó#”h¿ e€FM8. ¨'æ­nPꡑWãqèà ª5î¡,}n½|?Q ¬Ø0ó™`q ̈Oâë0‚ PZ;7#Ø~zšaÎ3߄âÛ\œHí}?gR?ÿ£JýüIýü4©×ï†?3Pj¯ë åU•æËâƒs öl´MÙʞ^H{C`‘Ç„J¤uǯœÙ³ÒC®Z»vø ±ÍãüZ¡Íù¥"¹G ¶6j +D…äAó|»b/<¥á+Š‹%6¯)ó iÊíéšžôê gCÆg¸°½•ÀEQMq¬~¦Ê†|©;W=nÊôÜ6íö½Ù´Û·|]ó³ió?mÚ xÿùÛõþGÙ4F$$u@˕ÏHù²Irˆ|×Y½»~ðÑo›îØ `g +y´N²¢LjêׄÃ5ÿAQƒ ÏùoGoOQ†Ð97ásnBÒï^óé5š#qrqª¼%ðK_YŠÆr¤%}式á´áí¡ufœ,£ÿ¯6éOÛ×RóžŽÑ®Ž‰½ÖýÒ2Fނ¾9{}ï6f˜ ³žÝ0uS}ø^W`â,~ãrlä¡Ò[ÐÓpvÕ~·Ž§-à5<*±wÔ_ýÙ¿ ¿`r«M¶¾Ç /Æã™û+x…isŽüIt™¹d@››¾©^ùbµ©†ÞàùA×­Šøés—Ndûa„¯µ4 º-mE?ñª5û¶b7ûÇë S`Ûg ü³«¤ª6ë,Yh:“G?Cy:cŒGIiŽä™ûïíï&÷C§M]oJÿçÒ·+Ó:[+?Ä D,mÃÌ&·ŽcÖÍpÞÍ}ã,JV›:±yrD…„ÇÍÓÍOәrÁ†.jbxô•V6¦î*pWF†CPžV4ƒŠ /8Ôp’‚÷ îëc™}±ãÔÒ~-m¡PB[ºÚÊ!å¤ió°IVY’ÿæÛfy–yøïpc$®à鎒»;ËÞÝs!!Ü3Ój³X¤U•9^¬S•Et—·SÃ5ØâêøšäKÈE,2«‚ŒHeÅ:óÍì¦à{ÙlZ-3WÝÞ¬+nKE–‡ò‰Ÿæݵéoðk^Ðø«ÀÚʔԐM™¸ÒŸp¢âÈþšªb{qh—™¹™'B™§ýA£n1>—°u¥¨y©m׶]ö:y|ìºi¿-‘A›GCv$¯pE™¹¿·¤mPH9bªÍ Åw÷ây‘½!n·rò#¬ü°˜™ª¼pï7¹'0‹Eô»«Ì!‘ÛvMóªpŸÖIšƞ¸OKÇ>(ÛT¸²’ÅmDÐÛꞏí]Âå0Ì:ò;vyšYcœ~¹#;q`»À}çG[–”RâèOh±Xª-|‹›h +¥¯6ßn™|p͒¥«N«tý˜Ù[rÊܽ¸©]ew¥·ŠÁ1Ò~?h3Wiô1+ÿó¹0ú/àoýB½™B†3VѶ ‹³'AÿÛÙÛh™. «Œ0J’o“íí$«ÄµÉS0BI™%®ÙÍÍ¢X?1¸ËVíñ_ûæ¢.­Qô*ÍqO¥{G65–½s’·^ÜØ¥X 6¿Œáaý°ÉPÝxùèSêÞ/ÀËdd®lô®NœÚž¾•“‰Vn¹ù6ôցÄx ƒ8{/)TÛsôòùr¨ŒÈe³uZ—Ù"ùÎ=ðHFª=~ÂÊfÔ¤ F¢±VùewŽ¸ +endstream +endobj +175 0 obj +<< +/F1 10 0 R +/F9 41 0 R +/F5 22 0 R +/F4 19 0 R +/F3 16 0 R +/F6 25 0 R +>> +endobj +173 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 175 0 R +>> +endobj +178 0 obj +<< +/Filter[/FlateDecode] +/Length 3115 +>> +stream +xÚíZݏܶï_±ÍK´¨—¿DÒn +$—¤@‘E|}ê5†n¥\ìJ—•ÖE¾3$%JGj}vÎI ôeW"Å!9œùÍ79ÉóÍÝÆþýyóåõgßÐ ¥ÄÈÍõž­7»BÅ6×_ý3ûû©»ßîxžu}ó¦éÚ^”Ì8Qšlÿuý—Í×ז† 4¨à$gs"ßnež•0R˜ìXÞßoá¿Äџ}#Ã8ɉ›ÜŽ¨\/½ɍï¼É\¯½‚H9ö2Á"ڜpæû_Dƒ%a"̓ƒo¶®w¶]MŸFr+”Èj·×s‹›†½÷õ±ÙëáÔìÝÞmwÓF뤴 F{rßEs’Sß鸿ãÌ1ÿ´?1ävg~XœÑœ›šHµÙi8"–n)R’@©bÇ×ÛS*»-ÛòP»ç}×öC9”'û®³ý–©ìÇ:Þ ,ª0—NT?8Q™<ÑòÅvG‹"»H·xŽÆ®îóˆË ûË'¸õË(µŒ‘W[V¤xà ÂÔÓ±&±&E$XcÏ+'۝ &ûk׃D–ÇÎ<3 ^@!츟ÎM[5 ¬…Ê(´…Ϊ¦?ߝ˻CS¶o|RiïºH–Ež½„†.>V­žªýGNEz¢8*fyºmìbë9:ÔnUý¾> [ER4aÅRøEuҒP=çÁK¤ŽgX>s÷ÈĬ>¹·æ€ÿ*û¶>K×Ø(ŸEKɁÁ‚hù‘+ôŒEþ»ÎWÑHƒ8“T£8,:JÇ÷)cg¼wPs„èÅÒ&©œS  "ýMy,Bç«K¬Ø{íIr“ñw˜|ÉM5$*iö‡˜iêiì RqI>‚­_V€K§~Y‡%r'Zœµ/½ãç+îˆw;©Ê ×ìŠÝξ>½¶/t4¦Ïœù +@Œ}Ä"g#cx¿e¹ï¥àˆóRuîåX‘àí©ssUõáà‡>°r¸ê|nö]Óî› +¬Ð¢h×°Ê>„ŒÐšR˜øíá’dSóÑK¶ú?º¼ë$^Ë'Q“• sǸ$…þŸÑ†'™^ W,ü9ÿ§J:<>÷ñk(Ò>©ÏÅSDBLs¢]öªqiem²]P 7Ž÷‡zð©Ḿ#[5GÌç•6K?å}s"6ÿÞ oÝSGö”D¯û°y9û’ÙŽãüRc°;6$¾šÅâK×0ÿR¡³û†0û—×a3é;žcRúêÇæ\ÙåŽawŠÿ}í+ør*÷ûâ´º±­q?”Ãàû¿°™CÛ³¶>ŒÔîÎ!©ˆ]Cݝêcùܝ߬:‚ð%å<Ù~½ +îs,Œp Ìja·){Ctá£Ü8q‹}”~·ÝéD9¶ž@QÁÏKVBÖí€ +Êãà†)ë#L_*—¨LÎ-ÖAtvšH=@<†5‹CçZ_—‡óP«•øŠJßÄu# +:SÈ¥Z›|M›²º´£zŒKþæ†(:ûnn«a(?qÓWñì…q~à‡™³mH̻ÿØ2fx6Ù¡;͊as›kø8„ Rxx«—¥$Â<<µŽL +*^A ZøœŸ€E°N +¿ò°‰%žgV²`j[àPæîÜCêŸÃ”ÝeÄ9ü;åX@+eóSm}äÚ[Š…Â$“/¨ÔÃÀUe‹¶õ§sÝ[dÇâƈsn\ßTµ+׌„š¶¶E8|½™H˶©O‰¤PF ²%åЌʾk÷M_Z«ir²¶¾>O@›»…ãÃ~ÆGDÍÎ ¨×mùˆ #±Ñò1^‘ç,è…2ÒåüP<pc¾F(KÛl)ëÂ`W[•§ +3}à|̲‚ÐÙx*ÀkLæ¹Æ1Ï'Ý˜ ŠÖuj,‹^{nc¦©rVÖJ(ìõ¾:4o;o‡?ÅRi3öËx¢ìÍt皫q –×™F!¿k¼E¿™9Áºfvd4ŽBjĺÑvì¸f)|`" ¬›/®’Öfž¡A‚NàaÒ|žk‚mAÁÓ< ÉŬ\ŸüõçMÛ7õÑ£öhFºçý¾î{8èÆÍ,suJÁˆ0óãº*Ï.—‡?ÿ¯¹W(nRÜ)rø;Å[¹ƒð­XöO¹>Ô3À9Ý +—ys‰.Ï*#Xb‡……ã+›Š¯|¼H)õêö(€ßäÉú³¡¹CnëæR‰U~çÀ´ ‡"†±ÛŠO^U`p +tµ´ +Gœ;óéq@eåóüprr2ȂƒÖžºûSSÞÕՙo¯¸¬¦XÕþtwm“Ø;8¡ >±ÿS|°£…Ë1×~ð™â`Åç»q?mÒç™,ˆ¡¶K§Bfm9œA³'öÍUy8ŒExp1‹EîÖÕ÷q-³YZwG¥j‘z€Üx¯%ؗ™Ìi¾¾;jG¯.m\àý_(OIՑ³4Oäx/e•ÍÐ;²ùÔôgLô'.VЧ«å.õF Þ(3_\(ðbì_fftÐ;Ò3BÇh‘𥠄qä,ùøGr'%D‰Ê™ë >ÐW¥;ä¶ó×wL±z}G3¢×õ›9bhߌ—'r¼-³ôŸÇútW‚S) ÊÌèÌFt`Ž:÷º/[@ù}7}Û‰áꌚPéFw*çàX@Ü8 ꔕ½V&‚P;O¢÷ Ç×±l‰"¤1â’!b$¡~ŸL ¨w½…ÔRùÀŸž ” &(Áø$tdxSìô·ÄĔå„?"Ñûu±ìà!IêñÃ>í»û{tRð¹²mjiÕ±#eÀ +ò‘UD¾¦ˆ~8Q½:+pÀ"¿¶`¯Ño›ŽÇÓU~Î7)&ßDR™’p]„ûwÉ\ý¨‹?{æ‚cƊÑkàãöÊÊë"×f&]ôçt:ˆ‚ì2Ù™IYUbÂõ$xÓu¿¤“\­»B2Ü´ûË»:÷†©q±~8®³D[ˆ­ûÆî‹ûØg—¼éÜ>Oµwî—&†¯ñòcðBª„ŒåóC¿J`t>Çè'J["D?ÿÿevhŽ1QIø/¿Èø~¶?°m*¡+˜ka亂`— +óoÑߣü –Û骱uǬ„S”pAÙV»£ˆØxzËvrmðÕfùð;ëßýGUí-EoKεÄ:f(C HP†|üá"O´ Z°œ6ƀCƒúÁŽðì‚Y{çĆQ‰¨Æþ/qâE“ÎF>sN«…5 žE~2 ‚½A]ÄÚ¸ÇòöÖ-_õè¨ã6Nú£Ð$]ԏ}ƒÓ<á¡möù뭝-ÞC û¦Äàkƒ{ >îò0¾aŠÃ^"Ŏ +óÜt߆)ßí? +'êÓÝøù̎/ <¥Œ÷Pkpk„ +òù<ÆéPO¹Š“n ó‡ÓMržºh8ݱºJåì¦kˆÞ(ÞÜ‹&ã-Á‘¤°9‹1Á)5^±Ÿ Uˆê1Â̓‘8‚Óùt +¦òאR ×â)N]Z ÿFì(‹ËU€3!ºH™ü¯¤¿ŽÆ*¬ÕH\Qãþ½Û‡>”ý(º‰EanïA<—L‡L³€e1¤nûnLŠ ²@˜\Þl_à-5<+ÐL!Ʀ–_º÷ NÆà&ë,šAØX,µÒƒ®ÄÙMyª1?xœ…²ÜcìŠÎ> ž~y×´µGV“£0ό¬ã/h¾‹FõØ1ÅVù3'`&,å“©¥ø”ËôÍÜbÞbÅéÒáڅqÅ)ƒ¹ +›B¦Þñýݹ6† +endstream +endobj +179 0 obj +<< +/F1 10 0 R +/F9 41 0 R +/F5 22 0 R +/F3 16 0 R +/F4 19 0 R +/F10 52 0 R +/F11 59 0 R +/F13 84 0 R +/F6 25 0 R +>> +endobj +177 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 179 0 R +>> +endobj +182 0 obj +<< +/Filter[/FlateDecode] +/Length 3200 +>> +stream +xÚÅZ[³Û¶~ï¯Pújb!ą‘LÚØî´ãéxl¿ùø‘èŒ%Ræå4ñ¯ï..¼ˆ ŽNâL_$ +€€½ï· nR’¦›ûýúçæï¾É7”mÞ}܈œ¾Ùɜ(¶y÷ü}ò¦l»b»cš%ÿ}nê-SÉÃ6Iє8H“ý–ÉäÿãX»•í¹øbÂsy2»SÙ5fïGî’í‡wÿþþe6Ϙ&šnR{ôOÛUɏð)UrpkiºQD+\KaéfGIîÛù +ŠÐM˜½Û‘R$wLf[!i¨®OçcÙÕÏð§Nê¶5žÉÀìºÙ1%ˆp| »a}_·EÛï÷%ü¯®ÊU¶rM”ð\ F$¡b#çv¾Z0’)6»aå>wÞOEïˆE¥üææLµNKJäRÀòkþŋ¯÷ÍÉt^0¦Z# ©¹<@Æý$ÙîãÉ+¿ý2\6æŽej_¸£«ºrÚâ© Š:meößç¦lË +僶Ì3àþ*é¾>vÎ$ò<)~€3´Lö—(Gº)Nµûiÿ˜ƒÅ´]Ó4{E>ñûîÎqú×¥I犰 ü_Ý´§é¨¶ø/>°[ÄöËÁ¼»¦8íÞÕ¡ö² 9Ñzj¹Gd¤w—œMßuÀNíŽ}u_ ñÇÁœQt_´k¢Û£üœG̉ԚþãNs4"¥W­(՛a>b°‚dÙ5ßÉÐwÄÔw²™ïpë;n·õ_Tàƒ?Dp©$Eråg¿Yþ5#,̦ĊýÅ;ˆ«!–R&‰pÜý ­ECè4MF›»x”Q™ônâP­~tUk‚ujk~¸À,å131ó͒À4¬¡,ä6fþâ短”U‰¾¦” Õh9Sˆq)èd@§>ñkċuð„þ†g¨(öJ cOs˜+ŠÂ̓4Å9¤^éR/à’¶,»Î€äI<¸t³Ö驧Ÿø¶Ý,ú„VÅW£xi*“À 0%å°µý¾„RHñ¨‚åϚ Šë^ô´z^ùL؜ çnû£ƒ%ˆavU^”^n/%ºÕHµôeZñH¦7fÚüJªÍ1¦\Iµ2̦ˆy2€ðP` œUzI—‡Òç€"ÔAF»€(mÑEk‹bQ3!E_ø¥ˆÈ”f|7⾊_¬c‰Ñ(¹Ô.\ Þ]­7"þ-hKü +©€ÚpÄ)žy‘+®=a à•Á-_-v€³DÐÖΐÀ²ÊœÂ÷S¶_F”5#§$Ï1$¦¸‡e¡>aƕYR¸`böæ\`HÁ±ÊéR€0Œ›njƒ½¾`bYš&æè–lâ╠yF»²nÊSá~ •¸Ý«Òóö¾/C¾µô`Ê«dw]á@¸ŠM@†ÔÝþ+†€°©üÈaXT7¦ðcÞ.aã(,ïgø™ý¶8áÔÏƝ‡ v·$ð¾£²ðþ ’{ ÚB=øÅá˜Ö@v6ÉGÇ#]vøþhÜpÐ&Žúo«M,îr™¼S…/»`ÁçÞ<[’‡õ-Ϲ ¨«v?«ý±€³ƒ–J7¥ŒêÆú)-¡¹X”9¹eÃÍy½q2…~k¥/']„ e.)8uú"Ê¿Üæ4½Ž–lx/?<{¯>DŠÎ‘«¼F” È&K€hwÀì©*ã Æ¡²u'â2k~0/ö/~Ì9Ž}lœ…<81 ¡-¬ÇŒxøý¹/ üìm‚†õêQhž¾nl{´«æ¾žækW`:hÜoPîél¬`D0ÁƒA– ±g<¿à5g `&2õ}=U9Öa)V4¸Á[äœËAhí~ ¬.„ä#\óIOcžžÄ#ÜÁ˖gÀãÁŸñfËD‚FwÀ«1ø¶gÖç³)"u–ÙM˜üD¢÷ÿÒ¤Cahb‚á“Š 4°.J/’¯Žˆ4ƒjì!99T*RLÍáÅb+À^CñçübwéBx_¡‰ +ŠsŒñaºárÉ6ãˆGG¾ |C´ú´ †ec±é©#5…;µª›“lûX«j`hÉ®&\Mz1`ªÅá`ãú #•·T# /„ÆÆؐ÷¿‹X%‚½a?ÔVÑhã]@P¾™èªÀl¦}”Öӗ:Î&nT¹RÅÄ aÓÙ»k«â:‰!%±‘7‹LÏh¶[ …>æ!…®il-ÅýÃ=V†QX‡Á¾ó +„*f­?Sjá?‡baI 051$Ƃ!±¨!¥$ªè-YÁ!>˜ @:LŒÁ¼À +Ħ,Γº)ÜCaÓ&ãðEsÂuý1$$œ/—ë.²NÚ¬…s¯ÊÓÉolÄð é„ÔÕ=Y æo̾n>çÒlìTض$ÁBó"ß0C`G=2%yËåO³ì9 ÏåÄ´[ãÎ ¨Æõ‡€²@PX»'ßAjÑñp±Ž5Í ôÊ ŸUÌC[ú™+ m‘ñ»æÐê6DóYXä?#Qñi¼O‹(¨Ö‘/]ïc¤Óùj«yÒˆ¶š‡ÂëE¬c!ÃÆ?,#ÉÔ-§Þ1•F·É7]ºç˜ ï#ÅÑÀíIì(•(ÇO¼ÛjˆR¬È„­¢ ì  çŒdÌ£‰¥ÎÅÐj˜£ô‘Ö«;³O€4ÅP+( ¼¦€‚ph^‡õxVŠÑËfÜ, •´Mª–ÆÞFk¨‡Zy°5uÑùewXžøF ÏmÑ;úT-FMI]œÃÜðmÝà¾S•îrF»ÛiF¨|4ñǒ,/¡hòwD'>‰:*–jAØèµÕ¶©–îÊOӆžvJÀzÂtٚÖÞ³Éè=›co/b§ /(ܬß’rì–é6JÕjO_¾þß\?qqÑi;‘®Ÿ9ô~ù ¨j’‹)X’%âd}º!¶FhVú:Ñ~>º»š؉‚û[—BÙëý©¶×P`!(„vÏð~è2ѳ|¸´ÇÛï\Ûì™Ûr çf•¦½Om*f3ÃMMé–z¡ª¨®×†Ÿ&8>5s-GÁ…þu۟[qŽ)lÇHÎÖ/PÄ<B¬'@ðŸ ï3üΟÓޙ@ 9rb§3lN]f™(h¹ô`åb¯ßüQ9.ÇË¥QŽgÉA<³^"Þ¶ §_ Õå—/…+Ã}«çf=Pœ‹õ@•3Ãï0lÆ»-°s÷غé<1“—6.k·\¬w€ù˜2Ѿ2Á®‡/(Ž†kÑßÁ<ðɕ·ݾŸ›^\×ïm“Ë|¸‘®Ã"£7"Z WaTusÀZê¤ïÌÑXÝâ¯Ï½¶ðZ¥ÉÇÂfR¯Ê—¢g·¢i¥]ÿö†âsíþVR¼¢›¡#¾†ŽÙë6{Ãe4tÊzSÁž‹¦ƒpxÄ7˜.ãm6açy‰QöP~‚Jri ” ™|ZÆ„§sVú.ƒFÂÆÂr'E–¼ýØôP¼V¶¿©Uˆ»fhb.2yªñÕ·GHe³³è«®:Sõ¦ûmÜÔؽp®íQ¸ é!{ºÉ"mÊŬUÐÓ”ÁÆ”º]٘ھNÃl)ז÷}Y} -T Ç÷¯ç¾+­á²h—†j5¾ÏµÄÁþ·Ïü.¥oÑϘÂbÚ¾lvÃõ͐@L«¢I‡*òbEB¤Æc£U}ºfú±,˜Úâ^ßòA4fWr H6lK;{ƒ¼Sx%ÿ§¤@K©ßüÖ(ÖR`L)|ÐÉ*Ê ö­†ë~ +ȸ¼ûÔ«Wì9¡zx‘çO’¾¾&}öU¥Î㸝M^{[1qñ5ðÿ6q±fâ¬ù +ö¿öÓRP"N¯gþÜjéÇ%’¥p>¹]ÝÙ/‘þò?þÔì +endstream +endobj +183 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F10 52 0 R +/F4 19 0 R +/F11 59 0 R +/F12 62 0 R +/F1 10 0 R +/F9 41 0 R +/F13 84 0 R +>> +endobj +181 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 183 0 R +>> +endobj +186 0 obj +<< +/Filter[/FlateDecode] +/Length 2731 +>> +stream +xÚíZÝoÜ6¿¿bq/Õ¢^Uü”˜ I“-|½ 1p8Ä}PֲͳVòIZ§Í_3$%Q+i×ÞØ×p/»?†äp>~3ä" +£hqµ0?-^ýð–- •Xœ].X&Éb%“0¦‹³×ƒµ.—4ΩK.i-WTñ Oñ_MVk,Éà«2Œ¨õ¯ÑrîÓ6žÓ8&,¤l¸oE2T‰k<%HTºÞæM:š‡ó~¢›8TÒ5êâÒ6“«c³’%Llׁt(Šàî.<2ÉpŸ\ÂRíß'ÆJ1šÛÛ YÒ ¿.ÐÅ-ƒj÷êMGUHZ84ÛX|„¿Ø1#Aº(ï8ieäNW£‚€¦1_1®B¦¬° 3äÂjmڔ {e¡Ý§óMì´rþÆm„vÒrÁCfµèû©•*˜»ëáM]€B%Hr¤ØJЊR +âԖƜ QæçËÐìøÍØ0¾ø¼àÐ->+8{²Øt߉ +c²È¼~ÔÖ+Û/ iÜ~û=î÷³ß~¿yæÍk¿ûy_-8Ô18 +k"fý?çÈ4e•m—.´­<Í>’ «¯¶™­ºÈ*}·,0]y 7›ìB§MºÉ +´”MÛ/Í-­<ÛX²Â‘•ÁÛeB0’Û[_V©eâŠÄ¡¾‰|Wéá¢d`çÙkVyi)Tz]V°ŒMiû8{~âF¦Öúu&‰äPYÆKÅCS*¦”&CñdþP{– P»¥[“ZW #¢+Êb,‚S ù@…éP…y¨öH>GÁwž½À ã Þގm XßÖâ_Ž-{o}>ž†ôÞ"š°#‰pW£¡áçã3IBÉwìñ7/û̓‚’GÛOÌ?eŠv<ä,T?õ‹±§!§Ç™Ú$é‡w.Í'.M~ 'ˇ'+†HA üÕD99@ À<{1u‚2ޑ§û+N_˜¾Ÿ2±Ü'®bJ\ð J|qu4<›Àâ(Úp§Øél H±3ÖP߅˜·utðñcY,YÜ- w•_\÷×åF`¯=Dž¨[ù(B†1Zá$A“~ÐéXYÁ ’¡Tp·'³;x0ô´=òÓÑ`³­êÛ%WAúE£i— S‰&5º‚ùîã<ÍÌÑÃ<"±ˆt¾-<éÐùƒÆa¡Û5n`½øÑZ—Efr½Ñ ~€Â°Ã묨K[¼À:˜WVHåBLkÆOÀ&*T¯¡“gҝX“晝c}í +<ÕMzb?&¨C(“ uð@ÝxÕ#©“ ywԑMzÜÖn‹Æ¶‚…Š<ÀXù'¨F'èÚC¼€½/—€dr ‚Ü2z,\e¸i»eùF7éÑñÍ^£{Ï5ó¹5ßLŽ{y“û¬kÚðNŽìNkÄäQ f$†‡-ŽCù/ÍÏåÀðøÆ.Š~SgHLüӟá$Õ×Eôñ#¸èbzÏ1¼·©Â…/ÿÞêâBO`rí¡yTÃ…Ì?ÇINRtÃ+p)ä Î4½£<%E«Â*Fhø$Ú`–Êè6 +Ÿñ"ë6†ÖÓLf_:³]±ævɓGçqŒ(®£›'{ÚøÐβ®mY43Úg˽öÕ<Ûcñ¥Â›¡în/ᄤֲŽ¯*„wu2©€²¿øí/Ǒ(8VÅ×xI΁I±¬Êly*S¥Ž‰§û®wWõ-¦ 1¥T{×VßÞ +ukƪµ¶Ÿ©M–BéΦô9ñ:uWQIŒjìYAkïƶ„Fîqÿ<•Î"&¢=äuØ>¯CçòFC·³_k†ù6>.‡~œáxÌÕO+ȳ ®“–«ï–ž/ÒîVò´½•ŒÇ·’ö3ýôÉHÎÈs€ãbtiRhꆒ؞Õ¾BÁMód1̟ëÓGŽõùœêõÕ$óJcôn€ôïsPÕVDÊÉ<ÖçšÃWïª\²Gå 23äMý¼÷'­áœás óââ»4o*0»œª`Ýú‘̶ƒÝ½5P¾¸ÀváKÎHp~^ÙQF_ëµ.ÿjÇç¥íP7à*ܧ¿XDýÅÐßÈé/Žòôwøêêv[m¸RøÉëu$ßÙ¼Z+/™pfd{àfgë&• €¶úŠé8ÍNv4;ñ¹£ÙtW³'_Äýݑžƒ«Úò¦óPQDQ[èw§/0úŽƒ&Û´„_‘ ÖÚB¿$ }E$X—‡É*sé±é‹´˜„ÿ*ýàÒãŒ@Œ=%"˜Ã¦üÏGwÏ'n¢’vÝ6J‰MDÔ>µÑ2^¤Ì3›p‰Ö<|”¨7ˆTi•Í¼âD uíŸñ‰(FÀ>~Ÿ‡ \xô\ÅDOb,’×ÓVŒßòy³»Š~vTNbÞQ_9…#«ï³Kˆ«ŠuVOøñľ)¡Öp$¿yî\#³ ]˦—¹¾­ŸunëæÚv~y»jßš¹|Ï°Ã mtYà@ݼ1-eQnôº>™ˆiIÈÛ8îåbED5fê¿¥Íu¶šk³¨ùPšW“k5Ȳ?0°8± åb|7{'sâVj‰{+¥QÄÚ'‘ #ÞEúG:qT£´zø*­š¼}øø>üiââ¨Çg&‹ +Œ|“£ ojûU^ÚÿŸ‹&C¾\™ë{÷ ÞÒÇ°ÿÐyÖn/íÍ>ÛµüáYYݸz¢¤p;±Á^œ AAŒ¹-þå?«BA +endstream +endobj +187 0 obj +<< +/F3 16 0 R +/F5 22 0 R +/F4 19 0 R +/F6 25 0 R +/F10 52 0 R +/F11 59 0 R +/F12 62 0 R +/F1 10 0 R +/F9 41 0 R +/F13 84 0 R +>> +endobj +185 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 187 0 R +>> +endobj +190 0 obj +<< +/Filter[/FlateDecode] +/Length 1248 +>> +stream +xÚ}VËrÛ8¼ïW°öUY0ñ&s“ìø‘²³®µ6©Ú(J‚%”)ÒER~Ä?¿3iÑ1µ'‚C`ˆéîi ŠiGëÈ?ΣéìøLDŒÑTE³»HhjD4Ö 5<šþ ?ÄÏÑÏٗèó ¦FJÒôÝç©«î7åœ+=«˜“sz„ӏÏÒ}NRm¢ØÏ¿ɔdMã–# ‹XLf‹á²zi÷6”hʺœ­­Ü2+¯®³fc·¤Êò¹-Gcž¥³Íˆò2J9‚OR‘›ªqMÝØW3fJÑDÂSR)}ò•-–f ˜ÆRmh;1¡<s˜ÆrªL H½) M“ÏÆXƚL+·ZÛ:DO bœÃoB•'eQ7ÕnÙ¸G‹Ë2qIŠ,©]ý!Æc*;ˆn*W¬m5þ†ÅÛ*ÏÖ~ŠLáÅG¡*.9rÒ+Ÿ¥‰úPr¨X U,u‡È‰Ëÿl»²€ ¥É+Z’Sç.+€8À¶) WbHÁ=¡[IG:Ì5–íª0zrÍG@´WM-a4©0jQ^¨ \Qì¶í!s¯î…Ÿ] àÊ5Î ›p 9.b2Ÿ£¼È¬]Òuˆ—wødß±´²ºG1|‚]$†Ì¼&Að°íº»² +óCZ‰êȊÕۗu•më?;êü¶z\}=¹ ²åܘVÁ’½*~HÂzˆÐ4¥AÁg¸õÊn½Z` )(öb€%£¨î4;I@öz™—øX‡G +8 ü7JØÙú¼BøöÁû@0:ÄBŊ‘kïY „Àÿç\ˆ½Iœd[”Ù·\@ÄàWi³ +÷ˆtñ®õ +ÛMe뺅ðª,VeñæFh3€& UrN©$Â9€¦y3€ë Þ}ýRÊ^ý‚|óç»m;áòòrÀ”¡R´yW®êƒ\¸×ñ”<`Ée»<<”òS+7!©}잞ž(,±Ï4[ÒÝý1Xð¦>®ïÇw¡ÔX%CXAéГ^Ê»g»E:» +}‹§’|§ú…¶/ÿfYa½,S&s2hœJՖܓ`üƒì06€šI°äákY5›ñE™ç Ïv“ÎN¸f4~g'uc«U¶Ý«†jÂt +Á4å¢5r×4ޗ0J¦Cç*x™<4„H óÖvá½0ƒVô!W4^Dk/,89Ë?o[› Š‹»ßL +`6$ÈÍ®Â1@ãá!o‹ä&¥B¿3§ríÿŽ`sÂãXÏG$CD¿Â¹Ø¥€¿©¾dX<ßq°+ï´vÌhhg<îE.ÀÕµô?Xï&ƒ½åá>‚ç@"—o 1ž=øº¶… HæîW ÆÑõqZSz]}t> ï%èë »è+æwMŠÖ +…à‡3 8¦eøì¢A<þ‡. 0O"ÜKà +åGéÌB,ÐéƒLÇ!6%§  ZöÉz5i^… °Õ:cÂÍÅ2È¡`lCåü7¨÷bäIÄÁ_žº•­Âk{ih\±sÍK­Å[û¼Év54|h…$¦J÷Q Njի>-®x \ùWŽ¸ª®WñÖ LˆW%ú´LK*À¨•I s‹âÿF)ða +endstream +endobj +191 0 obj +<< +/F3 16 0 R +/F9 41 0 R +>> +endobj +189 0 obj +<< +/ProcSet[/PDF/Text/ImageC] +/Font 191 0 R +>> +endobj +9 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-53 -251 1139 750] +/FontName/NGVWLS+CMBX12 +/ItalicAngle 0 +/StemV 109 +/FontFile 8 0 R +/Flags 4 +>> +endobj +8 0 obj +<< +/Filter[/FlateDecode] +/Length1 716 +/Length2 7315 +/Length3 533 +/Length 7870 +>> +stream +xÚí—UT\ÝÖ¦qw Ná´pBpw € +©B +ÜÝÝÝÝ!w$8|‚:ç;ÿù{ô9}Ó£ïzôÞ7{Îùîw>k®=ö‹™^K—KÚf V€Aá\@nà€¬ºŒ!äæÅbf–uƒàT¿EEiw[/(ô†_à 3@æìí +±µƒØdÙÿ¡H;]!V (@·;ý1±9taV0ܛvtèüã7€Ø ìê¶æÆÂÖ+8Àl bñüJjÿ3míîü¯’ØÕí€í';à¥5 êè °Û`ñhÀþtÿaù?ÆúßPý»¹‚»££Èéöê?ê 'ˆ£÷)`NÎîp°+@f v…þ»ÔüO8˜ã´Q†ƒ!VÒP[G0€÷Ÿ)ˆ›Ä l­[Ùl@Žnà¿ó`¨õ¿#üÛß<Šï Ôt9þkKÿYÕA p=oçÿöý‡üïø?ã?ãq…xLx¹yy„î=½ÿ·nòP+˜5j Ѕƒ Ö WëÿNü'•Œ Ì˗KÀÅ'ü¢aA^¿ÿU¨…¸¸ƒ•å‚¼¼¼ÂB¢g­Ü]]ÁPøߟÁŸÿ+¶ü™ì¶ÂÊÎ!… šsÒpÜX\,3tM¯haõ–žeސ͎]b;¢r±uк^Å}8ъI¿c£“ŒhôWK¸5ûìíMY³AöÚf²Çd÷æMmì!׳3³<çP ¥Îá÷㵿‹˜±ôv†bL´c€™˜›a$mlªvï]à>…KäÜ}\®yª™ ¨ssÒ¬.–ÝÔ»ä÷[ýG^xß ºèFO‘kÙû£Ï1§Iy×>Ž¯Ziê–G=ýTbßz‹!¿[ÏíæÇTã¢îQùnfÅqQ6d¾¡ñröɐHÉ= }PkM›Óy#.vr!w[—ô03ìa˜™}Ig"µ@µ€˜Quøaâá­ç‚ Q6ØGuQûæ.=¢êÞì¶{T«HbЀñÌðå}5Ý~Žn¾P“k·%þ^¯pñ»½Ñ»—æªîØ’x¸j.*ÓÊdÐG&_^©÷6?¯zîJí%[Ž }Wûx™=tf¶-£Î¶VÙȨ¢Ik™V3Ò±Æ +¿Kè½Ýû>Ÿw@?<#uÄ{—€He…a3aaa·vĘvrCÕ¼G}Ç\r¦E.TOê~fí…6[UÄñWU ¦£?æàKŒÅ&rVr+I`àB¡´Ù¦`!êsâŒHŠwþ„œ@ÝǤ¹T§ÛšÅA gZDï…éûâÖp9UâK>óÈìøB3Âlù{À/ñÏÊ0§íM9òBrZo*åR6›Ñ\axJßK•œ4aOÉÇ£«÷»ÈCöî7À’óÇ·ÛȲ.¹óÃåÙÚ ²÷.éèB¾%q9Ú|¹}I+IâouÊ¡è0!æ¹G¾Y,¤YØƒ<ќ.ӚHÖþ¦•ÐJTý¶¿¼Ð&ü£®E$ŒU«sK"Ù³ ×7¦‘S+k¥-†#ÏÎKŽo+ {už”]ÎfÎQÇÍè’a0×¢7¦‰ë/8j%`üm™Ð +³à¥€Aá>Åâ€öÜ}Ñ ,IβYÿ‰ùÒrì¬Ú‚߆(ä?3 ‘2ZzsxÕ×ê¸äÇ¢.r¼ r¹c+p°ËÊôÆÙg T‰¾`–™K»|Eó'©»GTwE°u*»Ó¿ãÔ[ÐxÆH‹ÐS",2jfKÞpZÅ%/cEšK>£•þ°3m›™‚2²ø×yv7²tY•4[å.À»_÷ŇóWÔç#¼yòµ1»QÚƼڣ(À‹<¢U®‰‚]õ€ÂØ#ù¸ŒÃÁ€*‹žפõú‘ ì“Ë͐y1-á³î5v¿.Jч騌8+Žü;´UBy";/=]uˆÕ²1@dಸ@r¢ÍŸæh1¾²ZÙÕ ‰ù°y‚·éêT'pƒ¤¼¿é×ç]jՏËxºN÷ºþð3`œ=\Ùã·«`}áFÌzs`Ó1\?B58^›”sQYËl3õmpõ7[9Œ›w¹ÉnÓh¯eª·Ã*-•«Ò¨¸4¡¡ub+Œ:哽袃ÒGԹڄFäy/¿M ˜•†!'½áïpãú䓻ĝ\[TÊnl„®~[õ£˜ð]¤R…W¨¸Wó¥×€ÇÛ4Lƒ8T ÌàÃÒø¤%k¹Æ"8?þÀ!øsÇ%¤ŒálodZýû/¼Ü¯»Mçè›`‚åy·óèã:K®ç!)Káܱ³ç6…›¨ÕA:Þ·Þ£0êÏo³ËŒMd +¸?+’x†Õ‹8ž.ÌhR¬Myþ6ÿ\Vn,cb²ÿ¨ó]4V}Ì7„joòSºbÄEç4é‹Ñ>%ˆ Êœ‰üí#©·:¾OæQŒ}lÒâ'w~Ʀ—‹æ ¹$¦Œ-wÚäM²/^ò ˆí6d»d‚(l»êäÈ] ©Ì Šþl-kO´Ÿuô.´XŠ}|-u NŠC,ðÔvš”©+°ñïAŽ¤iC:8Q]º^æo½}/ªªÅû#YÄùÕã®fnx´Ç Hºk6O¾J!cb3sù¾²õ'1󸠒Àu•®¡xP¯ò/T•“âÌ8ŠìzÓB§ý¡ÂGç´H;­nT.ÝÃ8b¢;rn/IõÕӔµ9¨yod¨T/*zñ5¿¢Jvð¯"ŠµƒhÊ5}±ùïýÔá.)A/Ýëô–-Ü5qWÍt¡àÝe{P·Ö§¨A ÕnfþÆ|šå,ÎoQêw³ê"Ó­ˆ°esø‹?}…]ÉjÛϡɝ²¬ Ɛވãȅ¹Ï”µtô|b½2y@O÷dVÑ}±h´uÖ«qgíÎÜâî¶×‹YÍ$â¦Í¤Ó jr:~åêwTM7ó“š(\ï+íÅI½x·p?–pãzGž†‚¬ar½È—q§ã¥¨"}/F:\C¿üKÛ÷P[ðD‹¨Š{ú÷•‡¡„“:4^sÞå׌¹·:6\g¼Ý œ[E5 ¾ãª^ÔìøÂ“Ø̋÷H¶'¡²„O—l[æSÞpÊ)ιo¾–F­eDòt5Z!ڃ”Î,2h9Tëi äіø«cTøe ìMOÈ8ÈçùàâpÁUMš‚ÖÈÎ( ··Û¤ϲ/Öë«­ÁÓks=šÆe#5;ǁÎIÂr„¥R~¸’ÆÆËíœ °¿u1âT«ýBü“Èë!x±Ÿƒó¦Iû%Ð W4¿G"¯ þ2l({SlºÛ¦‚0>èQªz”ªVq›…ˆð­°Ó\¸ô±Ï ~çÅiCüL„êý•í_J¼içÏÜV­=vhsCXçÁ€·áÑÝåäë~g5­V–aTøI™êï]F/j™Içðã“Nâ¼3ޕ~¦Z[Û`e“O2ƒÄCÑv~¬¸%°ÆpÕe2fü+=PåóZ ã©IXâCÒÌôåo9vÄJFý[Miû™àª·»4r8Gï#ä"µ‚Šb_ß¾J&ÈB«ö­™$]YU$N8¶ &Žî ;ãI:1Ç+©W–/ÂS§U4r';ÜÒ¿r–²í\¾«Ûoх–Uf–¼uÀ)¶ûÚJ±QÈM‹="vá§£ØNa!Œáä)I>ˆÛïy“žðã‰=¼­¨4úZ±ä>›.ºŸ*®ä{¤ç”Ç\èu_„C³\¹ÍT#ÿÖÙ0âTî8/·è‹ ¹ÁGÌê7ý×"l߄iC¯Q(ƒÓ7}~ò…Þ·e9…Ù]F£;¶¢™ÅŽ•ÏK}…c8$ñ—QÉ]cˆaôè÷—¤·   , ·uæ܌†ê»r‚\¸{¸d›‚àú0 ìâÏ„”µ5^ÍP·ÜΤ’ÄJ¿: i~\~¶“ê‹\SG3#ӂ/Hð4š±¿4´Ö;½Ó ä~wx}}¯=¹D½™´Ù øF¬L1GÅù!413¹Ÿóɓj€¶ Ø7GszCòzy‹ÛÍæ#n¬ßNÚó+dTvõ«D˜³èÕFžãu†Rår,3ª,‡mRóËAEøjÇ·œ4œTa%Ñî¦cök`»jè76!”é…áîák6ëû·”— [DÑ  ô‰¦H£,ÛÉæÒé¦~4R©©F_zÌúùù#j3(ŽÜöÀµ»vœSÏõäÚ¬:}°è‘÷^{n ,wõ•ÃDµß{úG—@&(³u+N¸þökÃ8½ÇKM6ôXÚáQ/EKÝã±âIó.D lËÐ| ¯ùI~{Ž€!s;Ê*¶ˆ¶a)KVt„ì&|z['ßV»fí½zú†r ڔš`£DBǎi¶¬m¦™ÃԁeùÁ­dµŽÛò1ØY¶düÏÁc³¨™ÆԜ¯_ÐìY›²E;¼4“¥ñSØ{± g¨gµ86. œÍXwF¥Å‡g§>±êmÒÇôxCr‘ÆÍ¥žÈÈÂòì 0Cd—‡+†ô?¦ +én… •Y»š`œ8 겯ÍæC—»/uî™E$ãZt$փç)¤Ri÷£²AóZ‚ˆ?á»æŸnÝÞ9τNGû¤äñ4©¬—¥¨ï¿èroÅôf/³¨~:Ni…’- ˆ¯†Ïîð~`ŒyY1 F9t™ÀKªöpýýqüG‰ +Y-öR§Ãþ—ÆӅ{R²É½îrÇó<1†v Ÿ=A9¯×¨¯b¤ò–É1pÜÉãPÎSöU1žös–†­èIû׊¡ã«ä˜—yg‰ +×WbPabì6Vûó<° Fç%Û̋ͬŽˆd±©¬§õD!fE¹ÐÝ¢~Aëù&2µ}I>ÁǽÏÝÄ/ e$ 7•ñðzz·çÚ:…Êh,²Ñ=dc^¥}|K”wfCLæJ‹¯ë1ë4<y€„ñ`q,r’ôEJKHko,{St4¿]7½Þ‰˜½š95Ç8S­ò9’H;¤æa®¹ù»}¤!÷¨vçBFFÛn`°06ñQÓ܏©÷}™ï#Fû=*®‰ì_°ŽNÌé/ô¿<¬ É_ßð³»=y‹KldºR|gÀ àLœÂ{ýÝÎÅ-óWR®žRõ°‚¾E¯ð“š4úŠ!•ë¯Ö¿®T”?RFDw¶¸zuöµò YîÀµ¸ÃÛ¸²Ê•‡ÊK&èrÓß"_̦¾+=§ÍúæÒóºY¿€xâ­ßïBì¹8j|i6ìéZfˤ L8Н¹û}§¶" É#¦÷Úñ®֌5|ò¬TU^³;'&)Jý¤Ú&fzã ¥Lb[d©z<õ™¿¢ÞÑ õ£ß2NvJÿ–ÝFH鲖£Çè~´ûKôÈæG…¿)¬ý¨^Ùá“ÓòD¦õ°Âð0àîN^„ÆpöUrTÅXÙ¾LPÓ ¦~-ûAօ˜ “ òI;èñR7V@¸|ç^P´ãHÕ@Æ Í=4oÛÐt¯ýˆæ/eñgozgTçó½|ž/æbm†ª‰¼KÀB^“8§^räÇÈÉÓHqD˜3Sˆ"ÆA“žG¶üU’õYÓï~!V_…Õ“º°8=)WX¯K¿«3×ä±X]M«ï â-çîS[%ïkú7bCDÀnÆ¥»sQõSÐ]NØ\ÚÃÞ>Q8µ}×¢î›ÓWáJeÃTÊZ¯ÃEGó}ÆÉZ·<]uI2»Ažf8֒ÉÕZ„åü8ô ƒ;Pb„!G-ŠmrÐÙ +rD¥m®$F΀ï˜Æ &ÝxY ‚¿3 á§' ÒPmÊq±T:V±àµÁY‹€o•–ü×øCIaÈíj9p˜™Ÿ* p¼„j‹à¢ê­a³çJ±þnAßà8ô¬·*ØÅÙ.~Ò+œþ±,âùK*?hL¨yY#4²é3Òašúx ۜb‡Ò—º¦ùš¦v@!ýy²i‹YßEh dI$Álº<{aÁ&ÏÞ¾³Å<¨Mzq,R1H]Haӂ´×·=î¿çM˜¿kD~YKÉñójö«_p+QJeág‰>ù‹ˆc‘9½@¸PùÎóþS«FçzH€ím?sé àÏïHM¶ÒR…ÖÞív–Zbíî¾ù!&–¯9æ<^kh(êê EÀx‡<¦ÐÍÓÑÏØÿ +¥b&nOú H<ƞYñŽ ¯ù©…îõo1³ñHw+ ÍiL#÷/ì,n^·WÖ ‡ŒO.™IOâË^¦jð5m0—ž™wß6Êץ㑈u= J5é¡bMÇOæëÈ?¨{Êd¯éÕÿÌwÓ9ê²Q#?‘~\’’nx!¢ç2qeTV¨{!gkà£DÖ·2˜¥ÿ*nGuj7‹‘ãé~Rˆ œÓšq]ZÒ±Jeñ ,þ¹^Ö3혥$ÂBxúYCs¦dV˜ën]gý‘÷[Íõ.ßV*Ńb$ëCI, ÒªyÛ´&åGûÇ_ú ;÷ìP¨@ü!Rvš­OýàìAÿdŸ9µFÚ>jkSÃJ (Í÷Y¿à™U/pnOÉø™þ%nxªP!`I-¡É%{ƒ!ä´h##4®ýYã ¥¨˜Â•]-œóå-¿Y•öF5w°ÇÔJ/Í2èûi·¬1¼¤b{(\5bITîEåzBϳ4Þ[Ò=Öî¨èù|ò›#kìK‡ŸÊ@9xæs|J‰¦²þµ7QŒÞ¨¬ÿ5´Ž•º[£[(­,{8 ï(¬îLŒ[\íHfÒ°_)^Đ(½¸Ý#T¬;%Ö÷¼È÷±¹cËÔÀ!’ô]ŸçfðÁÕ{‘tð‚ŽD‘_ӊy¥œR¾0JÈ Â§)Ó6.½T%Û<@X–ÖjÀ”ËaW‘÷ˆ`2«:ÿ~Xµc1EJô…|€—vx(»ôÕdñpO’rAg±° ”õÁ0&xuÛ½g|΄Ãð³/Ai× + m-"Ë£Ÿ†Û%ïÄÞmjwχ±œ?â9ó’(Õ¸¿ÎÀÑ%* #vîM`c‚wP»@>^¥ú+ý*¼Iàiw½¦ÓéîÉó8ðCì’;|já¨^¢„‘Žò„‰qc¬<¨©æቋ%æœæNNa%NbN&¡ÕY^I±?Aè*ó¥–ALy9òGõX—n0ËïÅ/(¥Ijõ„ÏÃ<Ê¿¯nàJs«Y…åóÆ×bXJ}ÿY¼<7ٟsêãÃw68R(X8‡9Ю<^@Û;šL‰ÚÒÊQÀÝ¿ê2rֶޔjT߈Å_ç›<7íM͗Ùg.FLÍGfŒ¼³x~Røȑ1ïò5‡³ÿ,v4…Í*=<ћSe9Ú2r› ÀÿªɚÍ÷ÝKöEkû4~…ÿ*uh1ÎÃ4X–‚3_µ…4½b¢Þ‰ùæ|%HÖrçiÑüûXNÁ%…üÆz6¯ß¦èÌônûs(ê‘mV“åèFü(îõB?eWÁÊÓ0Ë<÷ÃW»£ˆÆµÇhàð²:Åñ×ÜjS¸Y9 ™^Àp–òÖFÖqG\ÌȞ«qÒ¤ß!áŸCNxùҜÙÃ¥mð›ÈÂT y8=èSNYóžO“—6<ârIh›³¦9{ޅjcúêdS #ódW%—êM3֞p…üsÚ +3eÅa?(ü”Ÿ—eçÍbJ]Ç)Ii¿É#}r¢ª‰x0úêýÏZÍÁ¥)Ǐ¤Šþ²¯hÚÍ>gÚPWô„ò«œ‘Ô®’Þ? 3yö“òÏ$z߉õ_ùÎÈ0’€>™~F›¨‡Z>¼¢ªÂ_Âî ¬œ]¦¤1ezà +‘kùE6»ˆ P½Õó®þTԃ$óõ#’Sáð¢F—o‘ŸáBB¢˜á:sepÊj’>^¦zš&Ý.FB@ym9r‘­ü×U˜p”î¹F5‹Þvä‘ô×X¶Ë¤'1=b‹ºN|F=½ rß#þÏâû1ë­W8…ºYŠFÝ*ÁLEI(K7 ÿø@ÑÉ!®¼¬ªáÜmPý²È~ ƒø™;uƒiè–K¦oþØB ›SZru5VP%¯ýQ…Õ¥\…‡ÓÈ@Û%+5?s­ÖÕäu@s‹â˜-2eÆÜ?-&£¬øYx(ƒM!õʊòþ˜æä­QììCéšEëÂt-ղڔ’SoA20MëãêÕ³˜bIoלp`öJ¯'O\£È«âùä-j€¡uÚê#ÑfžÈÒl[ Ga—S¹KÃí¾91­:«ç  GúuÛW`‰ Üå"ãKežW­7—t„|‰®Lèíw@£¾ï»“–"šÆPå Vاg]BQ‘ù}%5D3kÊ!§ùPçyqô½ó«½Ê _ñ{«Í™ +îùÅÉÌêi ËϜãÙ¶Þ½­~Pˆ ˆ˜š?΂r¸&õþelÅÕà–ÝØ[ºg"8zܸP"øi7рÝw¼Â=°b›ï"¤ÇNƒÈ}3’eyý™6Ç3ǏòñãDµ\û»Ç¨‹ÒB“zN눅”iZêð ÎË9JãûÝ«+ñ½ ߉©ä8ng:¬¹¦Ž¥¢ôI{ssZúËéún¼š&‡´ò2$˜{v à”lÉëì’yë;øò|"Aeu-ÚC­Ôþ«aM=ÛÜl7QùÜNïùÎÃãSø¶ž¢|äÈV|¸æý„½wÕ?µ:êk%—ð?¹4~?ú^ŸuåLwž½V+”,ц°ÊÞSœ§<Üà€¬Ò–9üͳÏõ£kêO­O(xÍ —OiE¨K¤ØÒ쁞Û5óÒè\T¨ÁhÃÈÆ]Ší?° 9YŸYœº§Ïe¹ïqÐMnÀÕaã|á¾Ëý…dG‹'¥K®aÁ>m%VL§Ü‚¶Ý׺ÆÎlï|ºüHhòUS$ –‹4~ñ/–I 3‚ÅTfè”õ„â*/]šiãB5f& é w(eýxÚ‡‡M«ex0]c|*pfLŸñ8µî3Úqg ªxM/„þŠCWi,«ð/—Í2#qj8@'LYK)´RˆzNËX3¾cDÇäJÿð^‘u”#y®ùy£`‹¡¹ûtdðîÍ&½emü‘ŽÍá70&YAârîê8¤%3·-ì憳¿æӏòm¦ì…—ºÑxŽêÓvܚ E9E×1 +Å ÁÊ^ôš}I³¾Ö<H¢tËvu¦›šm]]Շ NðeîU²»^ØèäŒWÌÔî—áG¦í¹1v4#ÕDãÕÇ Éñ‘º¯œ>WM~jC"t{mŠ~“0".çpÿ`_¦3v¢ û‹ëåÍî\\ÌÞD^> €½ ømw»½ù‰Ž4Ë6ÔÛë0a_zæ’ý~}éºÐ„q–÷I9ŸOÿ†¬tzŠ [Y¯ÖÅ­‚ÿÇɜ¬Ï[ÏæU_ Þf‰ŽC_]³‰O‡îï€_K5 DۋH‘=x'•×“7évù¢+Æ-§ÑK‘yÑÁT­™CÜê£~ø&©IÉý¤³a“õÔÕjçñ«!Q*(±è”±ã*¼ÿ—Öÿ7øÂÀÊ r…Ãœ@®XXÿ"™{¯ +endstream +endobj +12 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-33 -250 945 749] +/FontName/ABTSXQ+CMR17 +/ItalicAngle 0 +/StemV 53 +/FontFile 11 0 R +/Flags 4 +>> +endobj +11 0 obj +<< +/Filter[/FlateDecode] +/Length1 714 +/Length2 2433 +/Length3 533 +/Length 2973 +>> +stream +xÚí’y<”íDž,3…LHNvÆÌMÆٍ֠Șy0̘‘%ûK)•(ûš”T–W)¥(”Q©0ö´"²g-ËQ÷=ŸÓ{þ9Ÿóßùœçþç¹~×ïþÝßûzU‚.žÊò÷°˜]…,l ° +„¨ªZ°A2‡ÆbZ’9 @¢<×@#ÔœþN¨,ÿ6ÍۇhXh~wa<dÓ(d&`Kæø€Œµ +™XÈ AžN|ßAvHE@ (@¥Q8€'èMcBô¾3Y1½Xö§LåúÿÑ +فk\€Æ§&°FIe1é!ô‚èÙ±ÖN×Xþc¬Cõkø.nGf|ÿ>§¿´É =äßËـ-‹ +²™¿ZÁŸl¶ •ÆeüÚµâé4 +žéMäO‰¸‡ RhŠàE¦‚?tIýbmn?ôðæNGퟟôgӁLcrœBüÿŒýîþQ£þY¯‡M \‘$µf\[¼¹ýrØn&…E¥1½‡Ì¤’ÙÔ?…¿B™›³‚Ãtõõ]´0ÄXŒaø¿úˆLZ´² H$ÖÐà‡Já²Ù “óã/X»ïµmm:  R YÙ2´uGt”´g=fêøۜï>ïp€Ü/K7˜Ë—}Ñ4 ¥¯Gtúós˜éÚøõ³Cbڂ†²Ù‰Š[£¤º9÷ú­×ûdµ¼žÖ¸¾ŸÅÝ8=¤û +v‹$¨W;&Vq­ÔÎ7s_/ùzššÏñ0Õ¨"_õÿ$âA7õ:Iû¯«òãɁ{8 +÷Q›díœ#så"Ì * ¶%¤ gÄèÇ­¿ìÒ%F¶ÝÜç÷áà£lÜè¹ ¹Ù¶M±¦¾3½R¾½nŸNïzz¬Ö^’ýsE¬lÛ`vËä€p}†?w»AÜØ”º·é¥âj¹ Ó¤·$¼(A:>¶íʅáî¤åƒez‡µ ¢¶BEÛY×Ë G·¢ß9X¢ <­SëM¬ñNWsÎÍi>k +rt“-¹ú»ÐÝ yóýúÜéóY“CYž*ªz'SÉg¨¾åÑ¢Þ©ÑG~ØØ£Üí5W´£O£vqò”í”ñûÚ:…^éÊå¦AùnÂ%™9isf:á÷¥s-ˆ ú¸8ÈºÕԑßÏDn-OÓâ]N¸xÕzŸCò öì|Y³ÕýM;»Hi÷b»Du›¢¤–¤NyԈ´/³ b-ÆðÂ'¹àX'-¼âØÛ·Ò7°íB’úmÀeÐ5ᬧ|=ŤÓ!fzÊÇ_û]Öã ~üÉQ­›Åêl"ë«zKWÄ?‰o|S´ƒ!•²ÑÔ§™ð‘­<«g¶?Ø^G—/‰é~#Ð_Sº û±î[߇ô<ƒT›ý¢CÑaQ®+‰2“uŸ§Õ^̉Ti:MÎè®&ªXƒØk^ ՝ٖ½a.^–ÐڇØíçÏ'¾º±G=oÍú¶»ˆZ®Â†EŽÏÇt¿í|7x,5 »9×&g¹)âPƝøR#{‹É‚Gċkî#+ÝÓ!§Œzö©-TM +|–x±£˜šAø ÷t]-»V@G”¢íxáb…ºß‘o¥ÖÕH! ‡ä&Nõ« s²ÇúÈã3ÉÜ«PòØ0±•oÎÎìYäLêxæ؍¦˜77À·›öÄÄ&öó‚ÏÎôí}I´‘D›¢ù²ûN}¹¸‚áqìZøŽ‡wL‡¼‡TXg5Í iÈI-v•åè^¿pvnQoçu^6˚'B¼†­GÇäx¬TQ®¦ß:tp”+YhÐW+ã^vRܚ7?DíU<ÐS|µÈjüøí[›ÅnN¯¶ë·[+I_ȶ’ƒšeˆ¶Æ÷PÍ¿>’W÷–8fYËW>w{)¿çðK» ~¨E9™ÀJ53•ÕAT5  2›Lï@”²®½¨¾û•=Ý»{ȀxÏaê̄9|ªjÓ@k²ÿFøSñ-5}èCAVŠ$w³©@;³uúãÞlZ’ì;ý½î͝/YúmŽ[oš%©ò&­—½GvÑ=%ݺ®my4­o%a ®NÀó΂wñەe$ÃU'Ò-75å¶ï¹†rþØ¡Îä‘}û)áÍ›Ó B’'Då\호$u¬”R¬œ²ìnõ Üdö{ÌEOõ³Y•¿Ù®; Xwô+\HõÝ/ÓNÅR ˆçCnlA˜Î§äiñäÇ=; ªâÔ¥³Ë›7.MS™8`9®]U¬Ò+®ñêCíüÎ|G·æ%kòùò˜åLÃŒ™Rüüj1ßö•[Å®£êb˶±/—Ô׍%o¡Â7%„å={¨‘±TßõÈüSîmÖ-hºiñ›Ô±*Aœ¼yè}jI³'<˜Qtj¹úÒá }’â +ç‹ñáÇõËlFm'yZâ.` ëÉ0Z¼¸£EÚÉÐãÅ"ŠßÄíKÐIYŽ¡M•54Ä=?Y:Ôâ¬!…|þ·c5 C;‰à„"ôKæT}[ uÇ·g ӨѮ€Î^ ÄÊí$iüZïãû¥–õ%B‘ÔN†ÇG1ž$QMçíý$¡ù*•ga_zšP—!Ù“ª:Øç¨aqÕÐÍÄ¾× W|~3C£WNq­æ Y°¿iùe¡aë¼{÷ ç`\¼$ܕ|üv(T‡V”° ÆŸØñU9V$=ضՇ†q&|IãyJµmqIîÒݯ26ïï*S'pûD$«Ä«Ö) {ÚÃ󗜲òäéWTî/~]M¨z¿nPîŒmu ¦G¦õÒÔÖÖòÊÆTn;ǙÁ;ë†Zð>"❑8k 5™‚¼.[Œ§¥45ßɈpíRòŠxs–¹ôúޕ(p\¥çNáѯ¢®Ìú+W·ˆëáì's¸ cCÁ?õß!ðÁt¶ü΢ê§/Mp…ÑÁé¹_oMËa'ïÝaÎMÞ-½ °ƒò6?à¼É²ï™Y0ý´Ge£RCñÀè1éGSùük’u՝zuâ*_‘IJ•|Ú?dä.+[qG8oЯó,MÀ\+öÕè"nEWm•Þà ÿ/+’Ú¢l>sùñ~`¾Æ’iäž<¤=ê"Ü´%ÙÙáù&‘ssÙÉ<-õ!|!t0QÐ8¦ &st²…ŽEIVf¹8²ŒÆ´Rä„ÓŸÀf㩈þf +ûòÍ +Óm¨Ó!¹øC«;Ã¥¿‰Ï^÷ùÍ#j~¦OÂ>¹èáésOb¹žBþ!¬<ÍQXŸ hŒªIïÄsµ›Æ?Í©üîQªB?ìqÝî%ÿEP:m¸fè4¹_¼u½bî ;„t:Òí¤Z„ØôÒÄɁ±.¿A&Wûjp}E)J8®æŠ•¯™m^»Ãß;ê¢àn¹ˆÑèöä¢Ûëü1‚’ šÏ +'–ûmK}¼»Ïf+æùÐN¿%iqoÚWÕ$]i¼…AêàÉߖ,Ü ^Ú£vF“òž‹¢”ÈxºÉ8¶i»+'6Á™ç§ÄôKçµU%7yåˆ{ +Èÿòü?à"€BÉl‹AfûA ¦ÎùÁ +endstream +endobj +15 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-34 -251 988 750] +/FontName/WIVPZW+CMR12 +/ItalicAngle 0 +/StemV 65 +/FontFile 14 0 R +/Flags 4 +>> +endobj +14 0 obj +<< +/Filter[/FlateDecode] +/Length1 714 +/Length2 13724 +/Length3 533 +/Length 14282 +>> +stream +xÚí·UP&íÒ®‰»»óâ6î/îîîîîÒ¸Ó¸»7îNãîû[kÍ¿'æßs²cŸMLÕIeæ]÷s=YQY$Š* ¦öÆ@ {;F^€¨¼2 +€…‘Ž‚BÔ häbio'fää°ðð°„]ͬÌN^6n^f88 +€¨½ƒ§“¥¹… €Z”æ_*.€°-ÐÉÒÄÈ oäb´ýÇÄÄÈ bob tñd„mlÊÿºÅ  t:¹MáàXX¦–&.c ¹¥Ó¿˜¤íÌì\ÿI›º:üWÉ èäü€úNÀ?”¦öv6žS “‚ý?«ÿaùßÆú¡úïæ®66 +F¶ÿ²ÿWŸþ—²‘­¥çÿ%°·upu:äíMNvÿ]ªü›<ÐÔÒÕö¿W¥]Œl,M„íÌm€æÿ¤,%,=€¦Š–.&3#gà¿ó@;ÓÿñOßþÀ¤!­®¨­A÷ŸGúŸ¢¢‘¥‹ª§Ãÿ´ý—úß1ËÿÿÓ'K€3#33Ë?ÂÎÿºÒûo‹‰Û™Ø›ZڙT\ŒìLœLÿgâ…±÷ðf`c0°r°x¸¹\̾ÿOš¥£+PZ ÀÁÌÌÌÅÃþ﬉«“ÐÎåßoÁ?ûý¯ØÌòŸî@¸ìLKPzBºGǾ%RŽéeE¸îÒË Ž§¬?c7ð6Œ+Vá¡ÖŠ«ˆoçŠ1é/ÔĂ ~ò| }Oúƒžžx՛X´f“]:û¼5±Ç s迵Á˜z¯€1í:MtÞúÈ[w¦.=·Ã$¸-ïK£~=k¦ÕÚt=ã«M£;AxM–ÄÝe“èr žê¡ìfDMµÑq<ëYÑ}mƒØB¿Ôî…Ôüš¥,4K~L1â?ì—KIýàû£÷×g˜Ž7ͧڡ¬X'â·(&.!Y3”®—(MxrŒõe ŸSÉ@b´6[ÜQ¡ £ %ôé#y _*e_”àV[Ÿj¸„ÇbÕ¤nàóqóÂÓó»Qµ+zR¦k¬ThÐÅé)¹u g´¥AÁ>$`Õör™Dö×|Y ¨4U¯ÍY\ðRÅ/ޮՇn2<ƒ²Ûä„ó“Áaa%5ӊwê‹6_®òlZhkU–äè®î×ÐæèV¥²§bÓâå -ÝÇ%‘‹–ân¥=™ð„¢çVó8ª2öŸbØÌ®ûeµ¿PpÖÆÄWa_výʱBq +«äíH®ªaóZ¯%ÎÓ¹å ß›ÐùZqº`kËõ\”"î̚ü< M±.SvÕ°‹ILŽåºÓ6õêÍîJYømýa%Ôa&…$Ðwo4¡yo@»ßÞ{s ú–úhÙ%ï¦ûMˆØ)u)XªC»'G‡‰^/wèrpr”U^ŽE‚–oTVæ‚k±Ï°õõ»„ˆÌçñòÏÐs:ï;Ñ5GÑË4E›²,+éð¼Ó T¾Iç6ùv¼¦±ë +×IԃQF‚„›ùÁ{…dàërús\Û5»Ž1 À'¾èkÁ©*[À©e”|(·]ÛFž*+¶{d.`&dMm=<@ª7Ät~ë¡LyWiðdÇáIÂ^’³‚¨†ÿJÏ©út8+ x@­Hˆ¶åeô³äò`õ¬ÎRª¶ä ]å¦þº8£Žú!{E ŠãY7Œeä(1˜-oºcJÝ­óyÌ€ï¿Ü!öPX]|9ñ¾Ýv;E‡Ý_·”Lv«¿ÀûdiOÆ+áiXYÇ”ž—±š€P”‹Æ¢{°˜GÒhÛÅT(mueé!ÑÀ{êÝluÝ`f5»Ú¦y8Ê·ÈÞ/1.ÆÒ½~^nz'GZO3-Îyb!-[ ~…Ô_ +Lüð°¿vHÛ°2ÁïÆÖØӛ ’2½£S‡–@V¯öhÆ8ݳéo[ål³j-}.g2( Ÿ¨ÑA¬ +ï²w¹Âb¹ }ŽQÖ+àn5–ð!P<^:^’•*,<ꈕ‘¢* ÕoÅþt.Ì3è;iñZÉ.ª+YÕ¸=ÝëüPÆÊ»õrh²d}ü<ˆÝ 4ïÀ +eîGË_d*q5Ø35Å`z€lFj2}ðó$Çö=¿ur93ù2ì~„åTPç·©û!ù*àþÆåÁ±J%ӛ~ßR‰²;•.Ã¯É ‹Zª–“ãM”Îh¹c±ô&*šz¯ê^k€Ó ØÆõëhòÕ8á‘LÄ?Þ§¿'›»U9:cx²l¶øXe%•­Yü«=²²K&?…üGŸ@¾¦v'cp Özµn9^š‰‰§'r]k0hƒ@# –‘´ÄUtA•$ncµq#J‚9šÿ×ä£Dj¸œ/.ñ¥ôcØ%–,;µäPÍm‡F؅ÅþÚGžÐ{;H—ǐ'¥§4¾ì-‚>cÌfæ±=ýsç2DÓös +zú +Ma‹žƒÇË=›@þ® â°{XY¹xÄÒöVÇ«hÍ·gsO=?–• UËD¿€ü"ååá4Ó ³kØuò•<ܛ(ɐ㯨„ ®•7CæÞ1§HøYuYÌó-”•AÞGïêþ™Ì=™N¹f¸uÄ{•Óê¿à˜Š0cÍ:ŠÄ¢ ùËá¦ÜQaÁV4ڋËøƒ…–¯‰—i÷YРr߈ÐBÖj€ÓÝ¢.ò`Ñd¸ì4÷^d+cÇü„+Íq‚òý¾¦]òœMC#ú˜¿[3e.Áäþò…‚F}·+ޒÙŽt3Æh´öÚ(¿1A$¹ÚÎ +xz œcá[õ,‘£yJ9î×\ aËIʔa·²Rᥝ;:º%Aé®äµó­ E—Ú/FÝiÑ{š‡o1Ÿƒ0µ+>Á5&vZ½˜`³_R¶f%‹üӍ´ Ò-ãa&Ö\S0•¢Uþ¨ÿ ?†X+t/š‚ZÒ³2v‘QÙcõ‚flœVñ‹…á–¡gs<9&Í5]îçþD\Ñë\rªª77ÁؙƒuJ||}5íÈدÈçƎvc`XšxÀŽäyUTi~7‘{SŒғg3I۝W : 2cE¦ÕϺУB¾?âRJMôÅÿ‰Ãt¦¾¸í ×3ÎÀÁLTļÒ_[â©.¸k“Š©×Þòf(uÔ/¿ ëßÐÀ¼Ö†z«:Sí9¤/+Œ[“Dµs°¾cÃçA>w&&kƒÇ§zŒ½Ch0æå¼=w»|‡Õèñ;ÏåeQç»Ibší(&„j‘P;?p®’•¾×Š”ò]±æ8HÊöý·äÊêò—DLeš®—îŒ`)“yFP)xvhÖGjæë©ÖCkB+ÖüßMùԊ#$y›0¤¢?Ói ¾ŸÆ$ º~DØTMCuëkî„q*— :èåø”þ*ÐòÒLÃt²WŸb÷™ +ÌÜþ¶°¹™7ísz˜aaçÑ6Jz<²— ²u€i'þSÒ$f™HN¤V/vuÚ0›nÉ¢¤Éòn¹ŽŽ¸©‹#„aç(³Í‹vAê§ÅpD›÷h­J 8ZìzéÀ²PÕ}¹üQWB¹¶ëdnînw… .`5å,˜¼øZKڎ 4Dµ±po^ÓÑJ“Aa‹ÉkuÁjºâ†yÚ©Ò±0™¤áR‹&–kîNxzmr æPÚá²ä'§¥ŒÚé㐧 ¸¦1,F¡§†x¢Pøaøšû¨Ê¤|éû;kÝ®RÏ×̦Oøï|Î2§àIšˆÄAbúQ§—Pé,|Çß‹–3 ֟ݤ~•gȲ‹­ØÉ#éT1Ñ´.*‚ì{)¾Y”Ôàœ3¯NÌi¸ö%'Ä &g¾ñªBÔiÿZ ê•FôÍØïû•z +Ùˆ¯<ÆÆ;ôÒX’’7#A”>J1€µbp]H2Qcf~yþ‹¾ë»cÚ/¥{Q ^m w™³»BüP_f‰CNÏx‹8oÕҀ¼„ šm}/?ZGȟŒ¡Q"ãpÆ|ï )Q¯A‡ríÁ=#{ÿ—óK>&Å,GL²|Æ]ÈLjìq3ç+#˜{]K/†â)!ãè³oðjXD})î£×Ø ?$³ïl³O +šçãÂ÷µ!3rd†ŠZ/paž†cqxwÚ/YÊTJôå‚$uï(¤]‹ˆ=¹`¸¸˜.ž0ò¨£Öì ÒWsóØ_°ˆ{à9?I hõ´›Š„oX¼ûJ£á™k–Á•²%d+ú,B$ÞöÕü|Åë]N…‚~€™"Æ7ŠþLá”ANR¸Ib-¸ÂIFß­4²¹Ôæ}Lv¸¬Š´ ²CÁ:áòzWŠíKä’HKaxQ‚ «Ûù¢‰Ø)µÞŽ¾'iÅٙ¡±Eët˜Êñäb—Ä;ßÀ¾'¼‘°Í X#¼ +ƨŇça"ãþSžÑÞù6˜Lgj‰ìkiÀ@ä— æ0ô¶¹à%œ&–ãéOYÍú7Æ©möù—€ß§ƒ+ua¨#~ EÃÕu:•jÞyjµYÃK¬‹0aZE ÓvœO+0öÝO߆ЮÁ8&#.OÕ_Òî°ÖEg.tþ­à„p퉹ÀŸy‚¦YL_~ ±5 æWÛLáÇ Œž®p‰÷]Yø†cÄ^Q™‡Wü¡‡Mè¹a¥¦ÑZPsûDúBuµþ<‰^Uà‚É?ãú¹5†¥2 +G4*Eìžrø å'0³R(ö´’Å”=SÊUÝ[A¡z2È0Œ†àx—G9¨úT±mòè)=êœñ‘I£túÈ¿Àýd¬;ŒØlq9õªñÑ 34´ÌŠùØQ„q))J’”¦cï.-€w,Þvø FHv=tBÄk½¥Ö‰Un¡z#þx©ü‰q9wå¢òø‡ÆúÊã1å}é&ɸ_¿áÆö¯MÞΣ?¨ºÛÖó +´ïlœ@ôõžˆáßäç’Rjé‹#û}¨bò>äFö`ê/É>–”ᄲÑð¨Vq +išþvÍJ_Ø gpÝ)){S%IªÅÜ¿*¨£…1\íä­1‚”Ô¹©‘ Îse¨F α¶~øýÞFŽ\&­[Ë)ńNžì¸lz¶º>C´¤Ÿ'$ : m}8¦tè÷^-ýå´²=íkº$ô‘¡Tñš×~ž¬q2s£2>*#ëh ‚2¨Ã™½-•&®3léDÁ Ë­õ¬üóQ*3¿ëük{GQ¯C¼hpߘIôfI^<³Û[YŠxPöì>@åk;ü™a#ÊÑ;RÃïl8̈‡P™,ÐY ³|xبâ~3^qüõQ.k‡†òɶ¬U¤þÍöÝ¢„¨$£9;"ŒÞ¯µ2݀ç€Èðm³iLŽÈA¿÷T{qÅq›ˆå÷ëªLɶÚ'®Fá¨wáË7“]Û:t%F†*™t2BèŽ65ÙÓY-ç}•c§&"†Ø›r¢Þ³jå~­ÙëHŽÌºµ ׃ÔÍrߞj¹+¦P(6¥ †¯ÚŸt=*»?˜’“\µ³ŒÍ¨ßLjAj]¸Þ†ë.ì~Ÿ“ëBhˆ <þ¸æ¤Ã¸f7‘ÝKv;‹Ä} +âLrôs¬ÙDÉì;A†1¬pD°Ýwƒt˜~kZpqÆ¥Äû]RzX6[æKL:êÖTzYR°Ž»2Gg ǘQøtKD&Ao÷ú• ã?(–é¥Y™S>€Æ‘Ú˜ßõQ$[ïçtIÚA´ÞmPÚ¸\ȌÈ~§ÑO:ë…,Æ|Ép¼:ÊTX˜‡t'8b@³a~’Ó¹kÙ÷†ïEWÓ(22í·PB>!›ÂE9<àu7*Uµ_†EááH3-¥ÌIñ»Ìˆ÷§nÿ˕eg¤on1â}û«Šû—E<â,Æ:¡Á«÷»nìO~ƒÂ7‰ È¿Sš‚v?kÄØ_æÐzÅÒÄR{y‚ Óäü:‘½’"D?äàŸ šÉíT˜ØLêÌ +Á÷‰ð»C¤þ¤=JsÞöÚã wœuiI'¯¥IJOX%[d6ÏX½fH:{4% ø3õ¬4Ú/Bœb÷wmÅkt[Š¹žèN™lV:W҃«st °w×6{¹6–ÖFd$lã;Á­lë?Î[pPS™à¾‹±œ€Å`C@Tõ!>‡â:B´V˜\w;åÙí)nï/Z<…÷ë>ó(˜V¸³Ò\æ»0ÜPõ)D6ٜ=°_wh‰\ap)â_ځe``õÚNÌóc/Šæ]ða„e¤Xù"0 )ËÒŀÏý–rMUOAü8@Üáuç–W¾ä•¦Kb‹Qeу<ÕCì~ÔE‹÷i?¹ëÀ·àyXZFGËïƶ!]8ožæ»}q£H@ÖQ,ËuúQ×$] °²Z‚ŒiP¬\ ï%Ü ýh™99ï6ñGe'þ=wN@+5Û%ã´·ðÂ|òӞ€và ĥU»UL)åJ‹Ó×"Op–ëþ·&S ¿æ,<ÄzP³³€ú8ëÄÑ-êõÈóW¿N¥4Ç9©×Õp˜ˆ8ƒ¾¹n²Þ¾°•®—?䱑/Ë6 æÁñTMbä©FµHÀÎÎV‚×Oô­ðÌ·Tx¬@øZæµÍiÍTïQ4jCh¶C1ÏbÑO̱ ½NAžg"·ÇÉÀu))'ð.u`† î#Ëm/g3 ¢Á`$Œ†ãÛÙŝaS ®É~?3%uârm“pè0å”t¿|i±†©B~¡i°ì9¾Ñ˜½2Lv)Ÿt….z: + ™°¦ÎˆR²ò­Nå°£Ü”Ú»¼¬œ™º$ Ľ–ò÷Ñ!xPÓg1d¼]—÷þ7 ?’Ý(¨ˆæҜR–¥…2œÏ +x„²¸å×;…N*¡{¦0•]iF ^uôûR$Ù2¾VëBÑÐÃJ4éUU;¢|¿¯¡…Š¤=º}µ¼2@»Ã,âF.O„üÃP¯Ósxs;†Ã·"ñƒ×e-h<ÜfÈÇ3‡d.Zn„Ñ\ŸNؑ4YTN‚²bŽfûòG?€9ö±æÌ]M¸eƒDh² Ø´¤ÞáõãqÃü–Žüg>€Ü…RÚRéݓˆòNðìµ²ž²ËHŽ +’Lé,Ò®Fl)jïXå‰c­ïَ͵ÏOkgù#½Væ¯MkÖÙÔ$üJ[ú·> ó%6‰ÄÎP×YØ– +þ1ûë¶/å³H$)•ßµÆo¡=½èBõ +åQÿÇÓ;Ž#»%lŠ£*)…¢ÂµÊÜ˹wêo÷sadœì÷g|ú“Gr>ñJ{0°ËK=l³e*êój%Î ãô8ý¡چ ëbšUo°Êþhji“ž?òJ½ýKðcš‰Óâ.¢Yθâr¬B~ÇI@Âo3Á;+!Hþv8_A‹"êîÛÈh™øFƒi½sÒ× Ò, «MŒtZ±šHAvŸŸ«÷–}Bë7žÚKxx哇¤Œd\j+9ׄŒ~ ²{Wc2!G‡X®¡rƒÉ@«ÀNñšuù6Ó܊¯†)°¨ų̂ý¶X 1†-?ã=2á +X¨9ZX¼`рˆ-ó‹O5ÑËuâF¾ŠL‰wmÿ]b¸K¯ám>cÄïkv1 Z\ƒ?¾TuôHQ.´4+}<s½ôùl Þmqy£ +àˆq‘ ˜ÌbÖNµO+ ö3iëÕKÃ° Ž˜î/½Ò +!„LøèDqºÃ¬p NÚÐxW꣹PþГMÜ[)q:ٚ„$eÇóíÝF¹$#æ9èf#_‘i +eV61%õÓ¯çW`žöz2bùӑ gÏÛhÝ¥¨ºmúüÖq*g’댍ò™îËj âTW#ðY9A!„Ø»fâïß!“V>U¿2cƵ¬=7r’õaV‡\:̑ßCÙ8s¯o®}ýîïOÿʈZ[õLèÈA SŽ”ÿ…qk£\O!Ý5Þ«åÈzå²4^Âýؽ|l]ÖUãE¦¢àPv™=l½]ªyäBQæ´.¿‡_FuV 4Ÿ$µíN£™µ3=°­4~L”÷«ÿï,gMåÉM›ßFIs×ó×_·ÄL%Õ½i§2`j„w ˜1$ÇR÷³X"Ûªáó:áµ´¼Jo±ÍÁ›ÎB7¡U7’¿W?ÚÆIãÏoÀ°ùÐóa:÷Ÿ4÷=ÐjÉ/þ'>§Ðƒ~.¶;xVÏæ@ËÖÝq<¹Ü€ +†¶F#ú.NËaû»–®LïnÖOÓ»;­Ã$î*Ý%¬å³æ¬PÄ#ÙÁ0î…ô>å ÍåD¢³Ära`~–â'ÒkqŽ4‰B[+XM×G66šÅìÓç½UµYŠGãVRÑ~䜲šß…¹¯±V¾¡´N0Q ÀzÖn3y0¥z"!þˆ·î0´¥ÕÕNvÜÞ%̧ìÝp¡KŸ¹Ã˜'ðĹ’–8 +õºƒß»·ˆaµ2ñր}zÕCèY ×@+qaV† ÛZ±‡pµ¸×µkÁ»h«2fíd qgiýkJs»­<ïÈúl‡#aøÕÓëÒÊDÈՕ@"Õ¢IdVÅEdöÈô꩙Öö*ŠÖÒ=w/“Pâ>îñ(="dFB@a ÀIE’\÷—ABõe<{W•Ÿôdõ”•> +â&wßp¦ÍÇá2J›ÙZ§6ö¶ÿ/YWëߖ=FRNj¶ì›?  ŒòójëPÔñãºo&õ…¿u„Ì;I¼ n£¤h—rWðÏ¡¸ã¶Ü}“v®Z¼##¾ÙwN´Óè2Y³â9½ÔipwS+–D .¾Üv|TÝÅ`\‘[[n,(šª Ÿz ÁàyZøäô1„0ú È©+Ö¤/Xřs´£øâÆ}¨ù©jûÉçî:òÖ¿Q ÌZSL†rëî@ÀF‰†ýIÊ¿i±3Í'ØópF,ñ/+~Óõd² &’;"QªóoÊêÛ9¢@l>uEÆîŸ]³Gq¡ä™´|=m"Lë÷<ˆª¹f¥^9X)’®¿ ñ(Î?_qIº¡ _]rÄÐL¢+L#\œßCʲSDõì6P7¼ûÑqÐ;²6àΗãT®)°‡t>·¿‹~ƒ–AžcûËïs¶yDr%çoŽ”æH0D7¨[ÙÓÒ°ž7°çmŠaãÖ®{Mh‘I^'Tt¬~ùP¢¨±#|=—#,÷ܶvf”îè†Â¼= žÜ[”HÌ 6‚!¦ ¶ÏFýI +‡Ñ–à >þ¾©<’Q63Эۘ¾T)š¦ÿleMfœ¤T6é+>г–¶íjNµ_Í×د,ÎU\ð +S:ÒmýæÔ¶µ6ÀItï4¯í~› -?v-'Dƒ¨ +Pɱf»»åΠ‘½ÃG3œË‹û€§Æâ…‡ËoŸ[”qË´ ȏÁ›³H:‘=*äZ3júsÎ[0靈*"±' þÏ?ã™6¼Ðu®¤äD„z…Tѯ‹uT#éÓª ˜ °BBíìI;Ë>Þkõ±ÓéJä¥*ر²e€§´Â'OO¥¹„ן¬ Ì´ñú ö¿+¡C@­Øü¥Æ•6-—²c_Dô¢Ê$jd*.|ø“ЏzÎYd´Qw`9P_ÈxßÈeÏcȬËrLU{œ;Âñg¹HÚFû!ÙÖ-½æµ,¡Ž ¹»Èý=PŒÎ‹í5C¹¥WÂdwZm˜§DÔ9\Úõ|”[ò ûy'Œu+óÏ.׉®oùŠ à%9”Öñ´Ø0+h?3tSI¯o“”ÞinÉìVW 7•!tNCÚ~Ó=þàÏZüÓĐäP7·jÓ[þ1L37ÃÊö›4¡ø<Î-dѯ“ù`ývq3agÔ3¬;Â1§'< .‡øõêýdwìôlNÀØ‰5øB Jêãô 6Ëý͚<”OE5‰N!òïP ¶*ôæYœ*Dö;:aýY¿ÐHãŒÂ)rAÚïÙv Açٵ،7c«à”¤y¢ù·²:-óŒ(Æ|z|K"VHè.µ¤]uÞËpŽŠ¿ñâ>JdôSýu]xqwí‹b²1wՏHç ÈTШÊ^¤ó”Äëá£JWö{€Úø…UBñœZOñ6¯Õ͚{·ýpíâðs8DØl-ˆAD€€'Ìü؝©îdçá¤õ°ŒÖܝ¯üƒ¥DCÿ!ÇüÒÿ\ÞΛ3–¹»DÞ&L ¼2ى ò™¼ÈiŸÎ°Ÿòkàe&¼²d›q?’O—¼i®¬tú¥ƒ|á.ÿˆ7 å¹¼eÜzU"˾ž‹Ü ëÕ›Ò#fs‚6VvÚ +ÛL“hy!l÷-ÜÆø°òe¥{ØœdCD=×~âde¿¦ U^•JRPèx3ôLù!¾"¬½œyW±¯˜£¢…CãHß=×PŒmô^‹ |oCíWÕÄãa\oÀ‰ÅÂǁž*ñ ñ$]Áè©ôÖÖ¸ayªMèùfÆrT8ۑîÙ,°>8 Ç\zÜ ½¶`ÐüÐxҟ.MLžäËóË]QY*Ð,~”-òFԍ®×T_W[Òø©S§S )~ ŸÛïô bŠ+µÙ•¥Òਉ ×TÐ= ™î÷Š·ÜBïÝøÁ:%¼!‡b;}¹ž!ã!ÙSòPÜ)üä‡ú‘DÜHá}fmµ¸’2drgÇ4´ÈtîªP*­Ÿ< ,;%?¹ql7 +x_÷½7‡`©DA4Iµû›NÓ¨œ­f<Ìûց'A@ŸUÍ$P(›¨õ›0D(Ìłâ¥[ÁW²Ÿ~†pc>ȑ¦Gbȉfp\Ûò„ie`’§žߕ&…¾û.˜ZÚÛyÅÏbR=ç$_÷/dN͈­å¤¹UO´ÑÔ4ŽËÖþPú… ir29+Êy°Èïr~\µ?º‚ºêhŠWÅ%wQî +¼³%}^³ìf*Û)0U±Ôãߝ8;`¶µÃ¢sÎIøÑ®÷›­.<)ø¼6£µÚo˜¼àn„l€ãʼnžäšÅÏq +™ $Ïo'˜n³&¶j +2º +ëU¿ìãÞ·†@ÅMhק-Ó1KÅTր{á”"ûsšß2Øheœwb ?/¶û\³9p © £âŽ%²TÁzË[AA6ªy]K¬o¿:ëžUXYx&ZÔ+Û3mœà¢5 yÚ?ê[­–Ê&â_x¿sŸÊ&ْxìT½UBÀÖ¸SýHÓC¶ö¥t’ÏDZI×ÍÝÂYD š¡|èí uŸ([¶%x(%i'ì"Q‡I“xLJ¹øñq­ç/ÍG½P‡?ÃJ|› (j–ù¥t³¸ÿÔÈ þü’I]U ¦ËþÒõý.$™i˜VLVYÒƪT\zìüÝì«ÿ­Q3>ǚúر›í|ÅW„¿“Þø¼j ™Òn‚)¥§3#®Vé„|û¦ûBf ä~³Õ 1T"yèNӔ +–8íåú³3Èäºßu›Çr™Cê6îÑĖ;’šé*Ð^ƒí²Æ’¶âzjÃ0YÔH·‹4bˆµ?úäÉQnð‡]ÛQÒý“Á{€=YÏPljòÓëÍ;¦š¬N mT&Ùt˜åÃ÷Àþ¹Éy„C[úò¯¢h¼RDÏ>âþù+£e!Í3—çQÇ_2Í7Ÿx;5þÌeÞ½n¨/W ܟíWAà…nãjT¹Ž#ø¥ r밁쬟Qìö ê™RÚÜ6ëÙA‡¥˜²V|DhJò.]ЭCa….²¥,…4^¯¥à©;%`Jw àßôó_k—U°(ƒ¥Š÷|®ûE?&a7·œ"A6V;Yåhs 'âoM§¾cš—ø]5#÷€×ø‘‰Å5Œ6~!7@d]¾Üƒd³qؾs)²w¡vÑ|YPt~E]xіÞÿ¦dnsÌúG 4s_|ô҆t%VnyËá) (AÚ;³Ùëyƶ&¯T3"@roW¯N['‡¥ NñÉBÅ¹kÑ{˱él V;­2ÂÅø4©N)~‰Î)›ŒžÙ ïCñÄ«•#º:]pt®i2 +pxÛS7a2Õ€ÈÒ×iæÏ®˜Pâõï†B£§ ,ŒäÀŠž­"·ƒ[AªáÎ8½ŠÁ‰’=ÐÄû8}ºItÒ¨MGN<ëb +Á¥”‡¸1×R¿Î¥V¬Ñär;Á¡FÌõB…>KòØ>YØd)åoQ•M?5k¤rH#‡Ùeü ý6ßêQ_¶WhbµÓ8‚.ä׎ø^¾ëÖ•M?\2Š@"m~€ËݾÖ+VpÐÕÿ}¶7¤¯¥Ì'*ÞiÞ|ø{è9V0Dbózd·WÝ +†Èu„å¼hH–æ„áÌw@”ìæ=U6Ô2Ó1Œô +!èxÕÎÎ:Õý9eÌí䳚ÂÊwÜ #ƒ»ý»syÏMcKî}âX%©ÚG»œ1îráåp|Älc–zƒ£ú1>Z}‰Ò÷”/~)˜È#—G‡Â-|Ïs¢º¿dËFQfvæ“V¶5 *˜­:³e˜%Î#19¸,*% +¦vËi;¼>Ÿ8j×6åÏnJÖVÖíwŸw®Ü_> D{µ-§¦ocsöp ±îç®ëÄõeKv8ãØ-Y| +H@q1aÁDñ¹M–ïýgäºmÜßñJs¯šÚ*‘±ûÉÔé YCvNL×gËõ,º.U믈ÐôYWœ+ÃT@ù{ÆÊˊßHé‘`[„ÿtŒ¹ìå ºî$äüÁgtö„‹QÞqYR††s^Òl£ M)è7c^FäÝ"$ôŒzVý¹5bYãtî¡V!ÈA).´Í#T˜`K5ÉÔÀ؈´ôÖ¦ÆHsb°(&M9?pÔ¦¿ö áç׫‘­¼ݍťÎIb6„ñTä-ZËá^§ù©~.›3 ¬!|¦7 +À4ʚªy³°li6eX#«o]‹hÜß×ÙμsÏ[®&RO]™ñ:,Y'`î®÷S6?»^h 2‡ô‡åv‹~ÜEÜÜËn !g:%Ë IÀc(#¼ùÀªæÀª÷æŽ2Ï5  +¶·B×ƎO¼`6K$a£ïFFÙïhö@“ýµ~BÎÈoÆ:Õýp’YX_G±'jc´í/ð#a¼¬Ñ®Ì©Mé\¥”g_Ù$…£Ž…ÃÐ__ÃøãÞëg%{½ ñuQL›ŸCfž³À’¬ƒ|HÐÕiW›e³žJ¹¾Ì%_N´þpâfôVò‹š?¨”‘T¤¼ãÉê^{˶ù-¥Å1F¤_¾'ab銪<îà_"J!•ƒužD7°Ó»¨Óäâ& J€Îåi‰T +ä†j‰~}TRÒ3Ô½E^&í¼åMEm*m¶¬À5øÖȔ®½¥CÄDçôޕҽHQeˆŸ¥]r<àUsr¸†,ÆïRHïGYs3øEÛF®÷øqŠv*þ;e]v +ºU¿ŽÛÀŠ†éWuÀQ¢ÊÑ>3E–‘Û¨¹èÃ3½.9m3Åíď± E·E¤–^/â #ã³ðÛǵkT•í Zl¸ 'WëŒ&¾¬¤ñJ.ó>Pð™.F6àª!†b¹ ÜýavCGëì„Ïôô³cH¤kNñŒ‰óö©tÅõƒMñ5*­ê§i •I÷ö‘άëj$¶¡|q'øQCögE2‰^06<¨­½9 M…ø=$c§è©"¼”œ–ýU2yÓeÚ6ÔË0õŒl×=pZOÅd–6üÝ?4mú¬©+ÑÖ"y_p!r!î$ïJLxП±Øk>ëå a‹”—þ«Óm%C´%atÞÉØ.Œé'©®ìloÓQ’ÙHkšå!P¦.kCßÈå1špL#:ÓÖY’‹#Û´X£ôαMë=×JÊþæ›…麣²P +­¢NƒÀ'¦mpÀ ñ´û 󃳳’ÄÏÐEV×ðÅZ±UDÁµwތ!‘y8¶![TQ™¦Çnûyâ¸B''K­÷¯æ~ˆâ?F~µ€³3Qý ]›c”§RXrÒÀ܏íÆà6P¸ÁÐO>°-7ˆ_~>A%ÚÊg¬ðˆFÓVåõkç4‘ +;×1á$ý¿]=…W9Ý'ž”[¯ðÚã+ƒõ·ß!a kÍK×y#øllƱ2ömðÛ1iˆ,'l[ìѼ{Ö§•Ï¸!„¤DDL7™Æ=¯ïßŽË–>ôŠŒÃJØÿÔØÒ01¯êmx—µGt _\""t0à@ŠÌ1, ÉÛO_ £-Öã^]V»çÃ#‚ŒÈŸ¶ƒ>¥ÅB\Ȑdv¯wW/ÊÒxD©‡øçÇkúÙٚB³•:Ì0öu/rrLö!˜/ûm t{Üï=úçJýDÆ.Ÿ Y¢Á+B’Qšm"‘ 'ŗ`\ +Pz5þŒjáTƵ<·ãÁ֔kaÃ3M„‡+•:qæã‰*;o!½»c‰üO3ÞÛÏ[ŒPùº*Ãû' ݂t‘ÇX*IC¿ÐŸë“‰+[6o<Þ(3ª‰“KÒû Ð¤@É6吶芪oW¢-¨¹QÖfؖܠYaUԚ‰zõ”V4È$•Û¹˜Ê(Q‡Žl!³¯­Ýj1õƒæ‘—@ô&ÝPj/Y|•Ü·dR ¡Rh5 Ç¡¸Uµ!oû ÉÍQï9-³[_UðSÇ¿¤áp°ö÷®Â¥cèxÎ9ªô„:› BZ*¯Šüªß°š"9  p4o†%Põ Ǩ¸LoŽr–¼[Þ\ô|#µ–ÄÞIŸÎ;)í k;P2­"¬Ò$xK«ÅT3ƒžK^f.yáõ¥UÏÆ»~af{8Õ× J˜ªNz©E3$Æî7åVbÇÍÓˆßcñdCóúFDWê?å.ŽQ7ƅ4wJgºn¡lý"Lão)…rÞ§%Î5©âqíQÁýkxð +ŒØE@Õ µDpeiù(¤¶Z{¿³÷ïPj{õw‰y«ç§d>>Ù쏞¨>Í_nð3Vèr®I¤7Ò{°ß·žö…Â^ݽt툽Q’³£Ÿ®äôVB²·Gc~Ænó4 Å*EW:-fjìμ@¶'Y·ËàC…sBß0mV|“µÂ჻›Ç†&&bëJR0Õ4´ˆƒƒ-• +·½eI»»Ž§j"‚ƒ+"zþɝ‚c_ýð€®°¼. ™ÞH!ºÁˆÍó„ 1lY¢‡ÿ!Êfã¬øI8ÌJ¤#kEi·ö€ˆÖ×ÎÓ²Sy?±ÅўÁ©íÿË}i™Ðíº_»`<:7뱚ÇáݵÄ&Í֙-£~´RÜq9î'ò†»8£XúÐ0»¹†S皠Ê_©*KѩߌÌ?×æþC†U +Kx9€³šr\ƒ}3%­¼…ùÿð€ûÿ þ?a`b4rr±·5r²†ƒûų ] +endstream +endobj +18 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-29 -960 1116 775] +/FontName/XWWIDL+CMSY10 +/ItalicAngle -14.035 +/StemV 85 +/FontFile 17 0 R +/Flags 68 +>> +endobj +17 0 obj +<< +/Filter[/FlateDecode] +/Length1 1326 +/Length2 4050 +/Length3 533 +/Length 4923 +>> +stream +xÚíTi<”íÛ&kC(²UÜd+ëÌ`ìkÖ¬É.Œ™13Œf#!K$$²„HYC¶(û£’-»"KY!TֈÞiyÏóüß/ïïýöþޙ/÷uœÇ}\Çuœçu‹ +YXIk# n(}ž, –«º¦Vö`9,#Õ%¢àd,NF©`ee0 í‹À +€L"§¢D]‚w‹Æ ÝS?X0@Û EÄ"àxÀNÆ ¼¨"8°" °(r€ hãpÀ¹¯€s(Šè‡Bʀ@`0€Ä"Ȁ +Åƒd˜2»Ø/éëýgÉE$Q}TŸ§ªK$ (w¬ºŠêålë¿qõoq}_Î îõCþgPÿQ‡{aq¿/o_2Š˜("þßT[Ô/s¦($Ö×ëßU#2‡EhãÑ8 –—‘ƒ*ü*`IúX + +i%#0€;GBýÄQxä¿­PãûiDÖÎÖÖ茉äïÖþªZÀ±xòùo ·Oÿ¹ﯩ1±ÀQNFNL%Rÿ>]ø×nzx‰Å£ˆ‚"'á êQW +@ Àâ‘( +€¢P-ËÊà dê+5› À@ýè+X Èzañ¾¤øoÈzSF@"PxjŽ(äßjP*ÝGÆzS ì£ò€,œD¥bIžÔîbö+JTy"ʇ¢|ÝH(òß*T%ŠDBùøRga¦J¡Œ?ußT T>õ|ÿ_³õ,ÿ¦>ÿ…)üƐü_¨<øOÔ ÷O yùýŠáoöå•Y,Þ‹Ç’÷O« È¢p(/j6ûUBÿ¼´$œ´/A탬ܛD&ìCJԓÐ?îµ%Áʐ›QÏMB!~èìäÿâÃñû½PVø &÷”£Ê¸áªE÷¿Å-ý ÿóè`9E*ÿûû°Ÿ5Š} B G£Q¿xÿ9ï::J 4DVV¤Ž¬À` +Aÿ$Zã±>¾(£3Ôåä” ¿æáK$R“üù¡¡Þ¥?×îXêýC¡(((ãöQ,­‹Ô Éu×µæW¶uí=#åéâ•`>³Þ°›çÂf©zzÚ$¥Vï^Mëz+8¢Ð—ªz×Z£6a~²6ÿP•`š_ ‚è`_én4‰8°D“ƒ'G!L™ï¼tX˹f“«-¥ÊR¶½èøé흝‹®8 yËÛÔlëõ‰%ý¬äîí¬´¶oxŸ£\GÓÕ;Ï$C£X:«¼†Y¼J­Ñy=‚ÓQ½+®þ²šgœpúŒf÷™Ígù{Ê6åEãÒÖo“q¥¬~£™ :ÛÚknБùOÏ>±wyJydÜSYžøn¶÷ì-Ð8Îs†Ç[í=3,D4…mm)¼*ƒ¶†´š¯ÜC³j#œôϽ©¹¢ZÃ&™ù½`Ó]±mJÊð—C›ÙøÊ·>¯ÿÜ ·"6ÄÍ"»¦X!¯Æ‰Ð.Pä£×àØüøi©kŸUÏÛf:.~¥qÎë2 h.v¿nþñlˆCVõ§™æ«Ý¡×»ÌÏj}Œ¸uì ԕüÈD—öwsXuôÚÇÏÖr̎Òê8¹öíúÏÜÏls>­I7ÿœ÷,O¶nº`RCœ~ ü[¨M½Lü¥ÃHH¡þe6qD…ÇϤå>â0¥=n†òúJÛÞ-ÝÕÊ +n»¾‚5°°¼Gas9 +÷œý²Ÿ€Aü“…; œçåDÅrõR¸;.lè'ßà7^ç0<ì×S¨ ®Håt ?~ÐSâ­ƒŠÃ‘ØCì\›8ÓbÑ情EEâœO•¿L2M•¼ƒÜÑaBYñ '65­ë&gªûqXÔ4—ÔŽwÅ} Ÿ=·Møtk§æʈÒqýPÖnš-û´nU‰ FŒš†,Bªގ–s¥œOp8ÔFóìÚ¢EÚãz؊‹Í[×w±Ý c +ù¯gŸp9–F gœœ|ÓžSÇÀð ©Ñœ X6ù”Ýçc’„Êm ¦eµ«BߏjØk£¥ ´1º:âÅ+)ü÷w›zïî;pj}q4cÜåáç9£S3ƒi8ºó\ó_{ µ­Ì¡Ÿ@OÙi¹…®Œ¹>¿¦‚¸#ܑ°B2F2Ô£Ù×ÓÇ)KSá%ÂGå¡ÕÙÃ'…tvxΡ“Eê%w­y/ì\ ¿`©ÍèTpÿµ§;ý%‡û‘ÝéL¡rÄO| „? öËÊ@—’b‘Ñ€s’þú¼. uZ¯¼-àÀ͸Š _‹Vÿ6)ßúNÇBÜç>ö#Ë„$…®éÕïâÎCØãT¬1îjÅi‚P T‚@&h į$¼ŠÕ½á·Ü¦{9%Çì°ÏŽ*Í}¡á—GÎíØCsüf[:/kî±'ö’Xé騸 ~ÉÅ÷Õ:grCä5,ÒûÒä c6°OrtÃ:ß]xÀF„>ÌQ|*KõЇïØ®/Aüß^EI_ YL¦”£w¸HLÝZð3ê7Õ •„ú¤ª?žrçŽã&q7¡Ñë–éuß®»s¬/_:ño®8Iïº$xÖHîÍpŒI¼.ø‚¦c¤š\öêiín0„áó¤ø NÏ4aQ?´Ôë% tå†:‘)ːÜûJ–KQ ×i %o°æ¾Ä~–é¬z‚¡3ÃÇzî|‘‚þeè‘Ç•@$ûԃpËõÁüð–áC§a\,cK{\KΙ±˜géxÆ´ÙÆéFh¸sÖASÂbAqu F™£sǙ|ënß$9Y›¶nsäsóåúè5¥¨%ëÉ9mÖ¸%›6ìrLß!çoŒf…—ÔYM ´ùûË}¿^ž´>u´Ûw«2sj¾ù˜mØ*–çYzʷمõQ™çÀæ`(ÿóÔÊÀÏ®‹Q‹ãõÞÕs µtrèâý¬îb³ÎÈA߁©/‡¯ÐÃrá}àÛW÷œ)Τ›è +W†¾1¤NÃpµdÖUtë'Æ«ü;÷³_ã×õªXQÊÓcÜÚKIs+õ„ü¸[7+–Í4¶I‰!Iú7ˆl¤:ï8…Ü°¨ƒlʲ/Úòï#ƒc9dïó_¸(ÕoùýÔÏ܀N:ð†šER˜á]ƖT%‘¹õҔɮ'>–ÿ!½Ð÷f¼S¨es‡ƒM5¿øDCá“)»à£*¢U’¨Ý§Ì6ê᧽ÛfùíœMO…ZŠæþ p0¯|¿{ó`à“,ì†,˜æ+pvç‡_¥q»Õ™5ÿÑ ýì“e¼“ŒŠaZm‡ÊžI ³ùóݖXÊ 4^P™=Èl ‚ž·œ½?¢]ǕI_ÚZ‡)Œ¤©ëìQJ®Ì9e½tÊWÜ9gÌ5Ó«š“ît23¯ +÷í¤¼8eF(+/÷‰7g’ù.—›Ñ®yôÈëæI:“Î+q ¤7„D3JXó¹ÑcE[؛ÑÒ1_läõ±Îæð“nÖùŒÅÀáöÁmWHP2]ÿMûó㢾{'·eÙ¢¢[iqšVEü#Œn¾“·gÐD[̓¤šk²²ñ®¹K +ÖÜ•Ôt(ðñ‹ûê%ó²>E nyÍz{™¬ß;‘’0\fxóH)ÁÍöNM­ˆQ¿êŸ` tvLsÅÃ9¼Öz×J‚VÌÃòËÉe˗tè)¢=Ʊ^&RÁ؄ÅÇÕS¨«ÚWò½¾J|-´œ•bä¹]¸á¤Wϡöv`”®/Œ‘þAƒOV9ãsÎâq!w®Ó³£e°ÃÕÝé‰c+'#o4.ÙFêÒ¶u•ú¢TdÞi×ô<ÀV­›•0(m¹›Ä·HÇéþüÖåð˜WJœ¶´üpªÍ°ñã·ÎDÅ™å4Áû±¸¢‡*\ôÜ|ù2¢øÍ7ʌ‰ð•k#IîÆ寨 •¥VÊè¤Ø¹I…Á|iÙ¬Ýd̽‡´ÆÑqä—²š@­9QÖOXÝx˜w¶Í®î’0 •ê¬®?0 +eÕ· wÀòH²¾¾ËHˆêMS윘~tï%Ÿg§ÙÚã‰)…§¹_Ài—¬Â9äDË<†úz¯><Ý õö±<>róÞ #Â^ÀëRÉåÝQº=è/̓(ñÛFÔÜ{£Rd*–©U$8ý­8ÓTýÙÖ¬HìÈÆu7êaN ³j¥m¾mÄç…`Œ²)¡¨Î®£ãF2{$Nר +GŽë“_ßÈ=†2qŠ‘Jl1ÇóäXôÒ÷,ùՌ÷ù;ûS¬w[ƒ2ç ÍÊ z_0÷=®TØÕl×?°4ï^ZŸìyÇÁXÏäú° +¹‡¦Ø­9PŠš*ÂL 7P™ŠäOƒ÷æ"0™çƒ‹ü=\¦Z‹Û%»¶›²N„ñì”ØÖ§LŒ½'.l¢ÚD[WV`×èŸ/rÕ«¢étxi1bÕ4–Ö’¡x=Èú¾Ñ ±Öi^ñÚ4—³³‰C QôiŽR=¼Ø–¥³¨N?9—žúªiY%!í±`¶ã—º[Y9u×"®?gÔ,|‰‘EjèÙÙ¤`î ÛO= àÚÕćÂ@ÈX¬Ã®[˼øTn)£Ìjk"¼ésûZçUA¥»­—úÝ}Ħ3om—5Ÿ`šŽ1fß­ÒõS2|6hg‰K ýnØþèHUy+½bØód“²9¥Ar¤$£m°<ë®Ô½wBÛ`—ôèbõPU«G³Ö‘««*ôÛŒá¶vʽ­Ú·ÎôÓ}W>t;µOsüË)són…Õ¾©÷þK^¯9>¯z0¹öóóXo쾅} Áï*c{AdÂ$šaŠï_Ë0mªüCÁc´è}áþÝ#XöÇ b£)”€à§×€ g§µ“ñB©;|±CCùœ~yöyú‚|Œtgå? FE =Øb ˆ-à»(âÉgšá4‰±·¯ö]JywÛ9’9{F o‹ßó¥ã +R–ŽW))ŒY˜sì7{F¼ö©„;žiͬ]GVMÜá÷sõ‹lâÇèv]ÍAÏNË»Èc8å•äþ—?Ðÿ üŸ@àPp"™à'z‚@ÿßìO +endstream +endobj +21 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-30 -250 1026 750] +/FontName/MVQYVL+CMMI12 +/ItalicAngle -14.04 +/StemV 65 +/FontFile 20 0 R +/Flags 68 +>> +endobj +20 0 obj +<< +/Filter[/FlateDecode] +/Length1 1343 +/Length2 9670 +/Length3 533 +/Length 10524 +>> +stream +xÚí—UX\ݶ¦qBá.A*¸»»»»§ÐÂÝ%4HpwîîîÁ‚[‚;Ášï}vþ³OßôÓwýtÕÍzÇò1çZ«Šâƒ²ƒˆ™½ HÒÞ΅…‘…(¦  à+|»ffPPˆ9Œ]¬ìíč]@¼@N ¬+ÈÊdææåàâåà(€böžNV–.@j1š¿¼¸€"¶ '+Sc; ‚±‹%Èö-‰©1¨fojrñdEÀ` ê_!Î@U3ÈÉ dÆ°°Í¬L]€& +;Ó_²dìÌí\ÿ4›¹:üגÈÉùMúJi€o:ÍìíÀž@39€IÑþ­èMÍÿ±°ÿ®ÿL.é ++Ûþ•þÃúëƶV`ÏyØÛ:¸º€œ€ +öf '»ÿtÕýSœÈÌÊÕö?We\ŒÁV¦"v`…‘™ýŸv+gI+™²•‹©%ÐÜì ú‡dgöŸJÞæ÷L +š*:šòtÿÚÝ®*[Ù¹¨{:€€ÌÜÿÁ,ømJNV@=fFff–7Ç·ï]éÿG5 ;S{3+; +'ÐØÉÉØÀü–Š•ƒèÍ´²3yAo’™íì]ÞB€o£ñšÛ;þÚX.v “1ØÁÒø/û¿L@&Ëß-\@&3ø¿™¸L g+°½Ë+÷[¨­ëæa29[YØþ äx‹sx; öfL<@&S{Û¿9q¾…AÎÎ ,oyÀÆΖ,¬@&‹¿î“·mþ·íM¦ØzK+ñoú«)¹?Ä d’ÿCoq +èM¡â¿‰û­Žêz‹ÓüCožÚÿ¦·cÎô§ž·5“?ôW‹ÆÂü֟Ùßð­†ùßí­µ¿á[Më¿á[›¿á[ðßð­ídy+d÷7|+äð7|Û{§¿áۈþŒœ…õ-Öãoø¶ž÷T^ÿÀÿyúEEí=¼ؘ ¬ÌµÇù6~fßÿî¨agåè +’r0ss±½ ö/«©«“ÈÎåϝ·;ë¿ØÜêíf<@¦€vÏ 2ÑeæM«bddi"'ƒOȄn¹ŒÒv)).½ Tç_µH=¨®Åæ‚)é9‘6Ö78µÔxµÚp»ÚžšxA0Áê"ÏÃ\˲Ï3PŒ‚ÃØsõmÞþØÜ1¤ãÆ)g–ÙßëÄív¿­Q-L`“‡p+ÞÜľ®ˆ]Î ÅTGäyÕBê¹+Ô —?O°í£âFIb«aY×Su,®`¨ÉåxTxÀ`Å£8}ˆdvýúq Ÿ ý)„ùi~:š×Ú¶ví±’ORí`“Š™EªA–˜Æ–î,ÂS„è+ÅÊbýþÂÃ$\Xczz|Vb€Ÿ÷BœbÜoäÒhQ„Ò]øâÒQ£x“ÔrÙ²3¨‹wn†(qL¼Ï'\L“vrX8±Ø¸+1Lu#/^¡íö³àù† ¡UÒXÎ"~6É\A4ÎXú÷×L}¸Ã€.(€TxŸí.llΫx™­ªÌэê7ï&sbrJñ@aÈa1”CÄù_ævûb: ¦;µñ%f˜™¸Ôþà¢r7¿V¥ÝPnÖN&øl£ÛOÕ¶/T”ò8,‰s’)Hí9õ1p&Ö”œ:¼°­Âü[Ý÷µßóç?z|¡å +ª>Á\¾IÇ¶Çä¹O +Љ®²u— f‰3X¡sÒÆö¹ß©Ú•g%ÕYCw>#§Ö³™ˆà·¥óÐ9aº·ž©ô + P§3>m¥­÷µæ^1Ù8C‡IŒŸ:æ³­â6˸ޕw.ÓÂíÕq›NR }.0g}ŽÉó„‚W6ÚàelHw—ws ]mpßAÎ¥îp‡+à½ÿ<իـZbyçn]ŽXÈí‹þ‹Œ½çš.ã#ЯˆU1ôÚ 9 BIS1Ÿ3Gg¨I3ËTÈÛ‹z`\jÅ'To.F‘²À©æQõ»iÙC³pó}«Dûd£šÅ°ëZç{Àú—ñvÒÚ +‚ßgIÓ19š‰Ý¸)[ƒ‡3ïÞBÞï½íóZA_âä†îɎáid„a t‰ -áýúé;Šwüà˘—€‘D—¿N‰æNF 5Ìój$ÃÏç +Z5µ“<½ŠHàJë“.»›Çè¸òµÃ×Cx÷=õȪ4¿%0¶ð.ÜٝëqÃvq ]k©ƒ¾‰ÖÏ·Wr +þü.ì§÷ñÏ"’<™³ü–M¦|Ë{é •2|ÊXº•󤵺ºÅÅ` LTYÓIÕ×Ãi¨Ñº¨ï®ÕÁaðŠG„Ÿëf™ŸðÈõACZ„ìèðY°½»äåÎ!:Ì  hwãQË·¿lS”Ú~ÕNÀÉÝjèDÜL¨…å0³²ëjÐ3&Ê0ò+춖¿g:Ëi1ÆຘrÖ@ܘþ¼"#¶¹®*L0ŒT9@|ô<°–˜éQ­Ñ@7ª ×$g3·%Naٚ±kªópÇbßiÙ8.¦Þ®.å;…PE鄭 +A9WCI¿î*÷(ÒðÚ†/+?3ŠuþÚÝÑæfϨ…\OH…²¸‰_”>cV¨Áæs°çUuº{œˆ;ܼ‡2Ç+(|!ôʌ/4Q¥¼žT¨ß°Ùš‹…†ò",\%¢ŽFKŠÝ;{_7o~5l +õÝò<6®´ã^.ÊãSúÊØ¡ô8©bŒõÅê×õ÷-]>ñÊÁ¶á½…ïc1i 勍–0g¯ïØù—) +'Œ½QN/øñ?–’{4œÛw=½ôõÏm‰áb·~Œ¡É–`± [R³Ð5>ÜÍ \êKòy Ì1£†Ë#dReWð¬e–ò ÙI“7™Âãìâï´{H3ÅÂó»¹'?ÆÇ ¶„p™Y"¥(|¥¨AzWX§ÑuûÍÉaÉrœÃ£)Ü;lI{ÃuƜd€qkNBæî i?#þ~CVu:œg~’5‰ñ·‡§LçÔ'UÝ}ÆøLˬv™ú†#¶*q n<.\ÞVÁ]IE%’£aÒò g rM £7 ¦Þv$-R~rcä»÷Åtcñ4ßß qaOvœ`K¶ú'K§œóyØX°Z‡´Ñɟ¾”m\~ÏXJâC‡‘܅ù7„‹sxŵÏ)”Üp¡D¬àvf\ÙM6'¢fÐ@õ½FcPï+ᣪ²Jÿ*š4‰Íó(C¸Û焤R—>—vϸ‘Íz*ƊL¾Šå®2ÛýžKÜÃ(*Ákâ°¿ˆ<KÎfȘ5% Çé¤RC#‹ûöÒ~â/Á™ »(Iî¿´}:„äW881ôa;ö[ó '¬!¾\Õ Qqž/Á+De$&5uõÏø³¾Pµ­\ +uì³|6×û{¶K8 +£Q8N?͘Wƾ]¢˜, +ª"¯ó÷'7tr5þDàsð F4ôè‡ +ZE¾YbsÃ_žû΃pô¹€}T§¯XÃïÇÖQ€4³>óGªdqú)ÄdaXfd¥ÕþýÝÃþl~7ÜÞ‡˜!DÒæZUÊFɟ+Ø'6²?ÉÌ5ø1Îí#~K +hÃÔ¬}xßí=jßX£m‚ @967ž˜êGÖ±> ~;0¶_º*ÞVj€©r_¼ÃÓ¡1¢<\<&wø¶có9>žýÆʖî‡wÖѝBµâ“½wo¶ó‰©É$À'%dÔl/"ïü™*¨tåc÷dšn¾ã⊸–¹`ÞsÌRÚXxN‚¬ã$Qèø ïqÏIçë/SR$Êu‹Ý§o#ßGÄ 7¾”¸åÕçøYËA¿ãÐ?p“èÆ=²u žîsï (abDü¼Âd¤Pÿëz¦žUZ8yQ—@ÐT·òŽC=Ë4-?삶ƒÍnÏâ8Œ]ä‰Çj#c3{ÙqÀ“‰G«µHt:[М¥ØÞ¢;'­‡pŸÍžðK +ês¸tê ÜïLϒǧ“Ÿ\5G¡°P‚›Ã²Dˆ5‰RS¥¨ÓäœÉ_ * !úB[ôŒÐFd·§îs.³ÛMÏBŒš1DQpŒó`ãòØL:ƒ¨Sמ'ÌÀ@"^궟u³Qñ §ýj¼‚?Pê¼ò`j$ö\¦V”ê¤ڍ‰MEó8 `/tÙʻÈ8À@1܉ˆÃŠž'[¥¯t™§}Ñ_Èý« )4[IñÖê/9Ât0Í ÿøN‹Ì>+RÐ[eD[¢>ÈVO°¼@:ØwÆv\%:Dÿp€årNy +}\Ç6ÓEƒ+emi­Á¡*ÑE-c¾eèÉå4'K¢p¹ueÅ O™c{pB$ +)„x°YÙÔX¡ý=P¦6éAªô¦…L-»b®š$Ðudpö#´`€“ëÊWåÖ:ÈE´Açw alo?t¶é¤HÜñ°—VŽs­ÍÛìÔÇä¤Ïu$Q²?ºpð}âµ=%³ã×¥! ™%Hi•Œ1ûF‰]ŸÈå'z~!õÛ®Øÿîµýîsú bÃoh>Df»ÓÄOÒÏK^¥¹TÐK»˜Éý‰ª…¾ïÉð<êÀ¡E{œÕ(U¿d„¨00µý¿ÜîЏ¶–^A6Ü,KÙÜïƒ µ÷òùò[ÊxT­÷1Æ_ ± ;0qš¡Ðrê ²ðóÉø”,Gz™Ãɬçžè‡{çóž™ÛÖv»›7•Ÿ×Ihs*Õe Šªñ[F‘®PŒÖ³D‹ +n;6Xj·o¸ ý]k¨Ý:Ä޻خm¾×õˆ÷+ß5“¿½|„ÛL¿düd•!¨ÎÞ¦  ý +;F­¥6‰ðŽ‹½ê$_sœ›VTÙó¥%۝f/Ta£!E(é£(²«Níµ5EåÌ–gš˜£ª:ÏäýÃ3·CòBy/ åż¿c/~õ ôy"GôäR½ %@ ´Òçò¯ŸÚÏ6˜x ªÅ¢J–…Û¤3 _ñ‰kr­ã§í.àXTƒð³VðÃ+lûêKîU7àç H¤÷cP /ÜD‚ Üҏˆ9в'g¿ —¼œ¶ðšäQœ˜ÜÏÇ‹ÁþF䇶t`«ÌM1rbaJÕ}“¶` šö„ʏؤ´5à))Èð¦b-*ý\¢Å¬TkەÈi qYÓxd¬g˜7¥~ê[kwŽñ|!z¦C薿ÇkuqM¨7(‘LEˆd¥ðG¡_“ªü¶ä›(óö÷H“¿ÇRÙƒ6ƒm۞¤c¦ »á^¡&\œ"6ÖîÕçԏ­í$&ý:·°šÝïÌ¡ïýï ÂG‹,[8¯~ùÌ4ÿüEÇX‡R&Ók 8ÿÞa¥Þ¼€Ñ·]ìr[2+ tëu°ò0÷ S‡ÄÜ4´'ãÒÑùšrêkGD/±¥!‰äÊ&Ê ü„Ô‡.ÞÚ#¼s>Ü9·e×Dˆ¿À« U&0¡ÖöâzΧ+ègðڈ™uµ>xV Þ±½íŠë†¤¹ki‰Óu@‡ÃÝÀþ1EJÝ¢™ÆN$°‰ïôþ"vu4Gò,ÍPwªŒ3ò"wDÔòj6~}:åÄú…xòù(ékbš¶‰.>وò¡ +¤" œÐ{¡úÊkP »H$´k]ɲڹĬÙMXðç6^D,TÛÁ-™Kr4â×}0r‚éÐršªbÐ+ô=†-»Â×MÖF׆R =¢ÝÓO;[,k¼¢ß^Héбï!$¡øú.iۀ‚'â÷'š'ÒºYŠ÷Ulˆ|ýÕߢ»ò³P︡Çy”q0IwV~ΎÔ8E44†l7WÔãÕ/jnÁ‘À£äW%Å¥ú‘4CBqõêäEË&K ë›€íŸ¾v(´lڏÕÁ%s  ˆ«ØÛïx=FÀã9Ðw+&ò»¾§V!w‚ðôøUrª˜Üª«¦=W }óSG;ܲ³ÌÆ̂‡å~±'µwÙ JE!5Ë@Ïëcd:`l3ÿG….Œ¨¦dá;§ÚU‚ŽJ(_Õ¤£}‚¹ðU¬Ý}¿$¹nÀˆ:õïz±¹#d¬ÑUªoTa®¥P–¥ú3 (¼¢Éʼn~S$o8RF¨`‘öå«3Ó¯ØxӠÊRßGمezÙ=Ô× “|zB˜W_(™eožÄxî“;;³•<ÒG\c*ŠÁÉÀ&À`r^^ R{ÐÝo‰ò}.mÛïYXUÑ¡„=l‘¡G¹T_K­ Õ~†â”Ÿ1%¥†µà“$f¡Ç>\ ÛôeíÍíAü-ñ8ɑbÕ÷ÎùUO¹l-ÚÒ_k¤;/­n#Êsó…Œín˜=X³Zš–†Z”¸öÐ ¼÷P'¹‹Œei#·<ÌĖܸÊ]ò”Ð,æX¸8¼ØH'†ï¬·@AÀ¶¶<­Î:J’„Ty6røÈÄsOÐyæé¼þã›Î.äkXSS +.O1GÞo#ëÂxYŠ¥F^5åºLceÈ]ŽDDŽeÓw˜&öɨ,²Ò¤ì¯®>œÂ›´•¯1áÐî·B¨¿ÔÚ¥ 8g7#‰MӃOúF„‡ç=aÙÄkLÞÖC,#°^O®ÌËj,–}¨ù_¬ƒGÅü({3IßqÇ)u_QeJ‡ŽÁ°Zí†ÿ²‡BIy,<÷°EyØV€BI "¬éwÚçåcäé%,s4ŒêkÆHšìùÕkCÍ.âŒ3%]2Çê#_Ö<íaÈO¡ÇÉaù+m©!ÍÅÊ/ùC¾ ;öú SûÖµC5¦X*AWùô>9Úåé8˜SMCú&j—ƒ²õК}ùñû ¨…‘ñsèd bbè»ý¶YeEp¼æuÖ°x"M~ÙJãfqÂ¥7ÕÚ2|eªb<œñš/÷𰤿1Óè6‹ºÞŽnqhdGÔƒ;)îsÈÜm´Ë¸DƒÑ•}|~ƒýa!2WP%– ò‹)óÁ V6/Å ‹âuØd‡ÚÐé¬Îî|cò×Ò™ð¿EÅvß@’{ÊÈ"l÷@Íd{aý ¦E»S‹´0”ªYÖ¦è—<€.£:ZÆ$Épý’OËpí¤@÷بZ +]BS¼Ñfq¾i÷ó­F­éa´T56\Åùž¹øs¸î‚‰6lÃpä²2ês½³ày̋ç.ݨµ@ ¿=ʚjà˜”E@ÌøÝ¢d££¢DÒ͛2ØüÈmú†ª²’PÖY½Ch&Òz¦rp£‚*H•­5cP¦æ—¢RGzì*®ÂŸ¤ôK¸aùàù;Âen×Ôé~Ö·Ô³ ‹×Ðø­4)^‚ϺɑžmÂ܎~B2E”3Ì!ÃÑ¢;þ‚úmÕÇ1ôß,/þvÆf”ÒV¾}sìQû©A…'­?ˆÒ›/}„ },ý† Ò)>£®x)‹¹Là=6 §‹ƒ +aˆQ˜äcw«æïöÞǦ›3.}åºÙÓM»ËÔ)ÓL>ÌYÞW¸Š3ÖݙæHjêïøùŸO¶°Ñ\)ŒnGvÜ¡[8©'P­u’„ÇÍ10®c‹œiÉä➾¸KƇâ|N~?ãø)™k ×̇ÏXe¤ƒOvN¸ßÉ + @?YÜreÉ]ªØÌO =ÕÖ +Óú€Ò\,Š…â×OdIRÛÉ2:Oß9~5–9-U+Ñ'»c•BZ\ÀØÏNR_~~QëþŒßâ.ét•…ÿ&‘¦z¢è3ÜŒ„ŽžF’¹ŽÍ¹ºúë¼?¾à.âk~.)Møí{Sî-ßÿÔG©}útϲdÞø⑺ÇwT“‘¨IyTpúðËqo²»öpÚ:ցWç–U’jì^¸ÔŽçÓAü+L!ÛsMÌUÀIxÛÂÈ£‡¬ÅG…؝½áxvã+…Õz$€hK{Ã´M1pÌäÞøÚYÕ'¥¼›%hû§É6m¢Ø«ˆ®ƒ?sàHÍoq_ŸËÕ|£â…l Š!Á§/ŽU‚#ù¿!œhP9, 2‡ÂO³‹Î&IÏZ0vV$ŠÙX…—¥îâòƒÞ¡P‰Àoˆ"ÜNxK…2§ÝߟYŠ.•1%Ö|z ƒ•öˆŸtUø©5OEUqÑm=M½‰Ø…u a3áÓjÌžV˜03`üs;ÄLçÄùpud#M;dY:œ£¢’)­b?[Ê<ÐT¿‰A:m¡-®—ð?4ý’§Ü°)î\½‹Yˆî¶8©râÅaðþ¤86¿ q¨h28´‘5ÅÈÿÌýQ׸ðñ÷³:ÊS®׊ËV^'ü}Y^;9¦¯‹,è¯ÛcP/Þîà‘ZùFå†zHL*é"Ûn% +4*ÔMùäs³Vⱃ¸±²Î+øú{™Re©bG¸«Cù;·ô´AXGxN²cƒ¯µMÙh¦4  +a`ªÆËØë׃‹ÇÙ®eŸ¹É¾G×üââbÓ¬s@­[²ó`wôW„ÔhS]%æa¿ÀaS&õ@Á¬êTG˜‡ä¿°ª¤Ìq3¨Fµ…¤NÈû…©o¶$߇|NˆóÊÖü~²,zeCpÐ|bbûÉéE&ÈO4~B'•°p\4 á%NºEZO>í@›Ü>OXäiÐToôGbÞêÊ?&çàåÎ!x¶ÜÓBÞ×F:֝ê½VÓ'cñ°^âŸ)eSû¹;j¶ÈàhâÉY'~Ã(ày,z$kSJv"‰V=SÅr d·í‰æMxWžÝôk°Ü£RÞÕèóïYG6Gy´jp£~©_Ñ»Pí¤Þ稧š~2F((þ=›íAÏüÊÀSÜå)¼Çåï£k$ï=^s¯uƒ!S¯³ƒtnYBÙ-f§rcQÕ^n‹/oÀ̓øÄà7úIMÑpjܘüs©2n{ØöŽL Î—ÒñUh°lmUåˆÐT¹Ä•à·0©uŸÑ ²T<ñ¸ñ3Ž|ƒ¡:Ü¢C €íyôTT¬„KÞl–±çbää=­ú*ÂF\0ppúq¶+ÿÑ­nNJÒVY¡ÖB±‰mƒ“|šs^Jš‰’"ì!F¥kÌðÑÝ=+U]»;Š®$ÇG»øw*Ò|ÁÙéþ²¾ÿ' ˜4îmÂZD^ŒÖ1ĬØõ8Ë®ÀyFÚ.B±põ`gP5ēvڐÿ,ÒvF ú6¹½7žoºFPK‰„};[ÓÝðH›%eÿ1P¬¡T¯õ V³xžXóò-ýŠÓ;ÿ–þ‹}×5€ŠZ¹÷¨£õ®2€ˆ¯÷ƒ‰; ÞÙ6¡ù»mxHWÂ@ÐÅ.sõ€/µÇ}ᔈï,ÝõéÔûӎ=Ïâqw4›ñQh_ ؛ॹ¿Jsù)ÓÞきg'0WØZMäýj_u ì¬J²Ì¹åG«àü*•‰û+g†6ôõ´sÎðÏw(|†$‡†àe8s•A—bO÷”Î2&‘Ó©Õ¾DjN †½+”õ¥ÆË,º ”upQU +—U}n󤍢+ÍñÛdƊ¾ŠS%¹ÏˆQËíî&8AY¶IâšÓ2}íJiÉg›Ò†¯êy»nG.úÓ1ðë8¿"œèwæý 'ù~Rëw ”væÑßõÁþNßìÇÜÃ;]!EýõÔÈÓÃLœ.·<›lh´q‡£#žã¶ÔEË@½åä•íšA ?v“|*?)©^bý Œ<;Ën¹N èƒ,ˆS•e0BŸÙÙJí¼(Þ/¬­ô䦆ƒ"KóŠ€!uúÑ9JüÓÚ,¹Í„Kö™¢2±?ƒ `;m _Ã#gW>[´öh–üF%)Óv3ýˆ{-ÏČv\®[ÿË@cò]ÌÏÊEÿ/•Ú|)ö¨Lžic™¨ê²ÉêHòÅ +I©“S\z±Ï:ÔîÖ)Sª÷s‚Œ¼Z±Õ¨è”"‚ *ÇÄ`-|èªÞ» ½âa‘— 1 ÷SxÈb†Y˜@mÊÀP~n šÉMÙ@;½ýȟ%I¹Õo¼^Wë㙐å¸m£À gõÍ<ùä. ï!þ oML]´—qŽóáçÕ÷¥Å*!…~/]ŠÃÏ:Ívw-y›UlZqrîⷎçºdÇžc‰ßa$}òPóî+SfuV„WaòûéÞÁV ^&t5¯…u+-§›ì}1D µ ˜2 h]Ïbjp¶y,Þ윰ôº« Ü§@,%†è,8é)V%GÀ•Z¢6‹Õ(Ñ4ªJ-‚[?Rû^ÄQ&wj:‘âÔ>•n”¼8o$ë+ p´º}ž~ŽWY˜{+(ùû­Ü˜‡ïz\èéˆ*öã¼ü¹GÀ5:7'ƒÞ¨.SÆîÒ¥-‹_<_2£Ky4NP1“ù;vóW‡-Ð+@MÒ¦<õ…–ˆ„nPÌml',ä½ͦ3‰:öK×åIŒÚyPì$‚÷7iÛL7g²-C8~Âf9¶Õ¤iE°Îä[|Y=Y‹º‘x$ŠÃÔPf{œäÉ3üVlc $îßýŒó}’Ѳš_®$ ~š€¾>5%ÌʌœÇï^ªÜ`?o³©ØÂãÒ(„÷k+êÂç5)<—Eɀf…j®fZyÛþ<±¼Ó©J†ø¸ùxoo¥WzÂ#ØsþZ¾:à ‰¨‡úE›)Wß'ÌÚN¢f¦éÒÀÝ\dÍ÷Ü7’±gk遱÷ù°jÕ©ˆ:v±o]"þu—_ÁÄ×q4ãíïó#ïDÐ6¤€¸R7Ç„ˬ×÷¤þ)gõÙm¶ÔÀ2¼d°‚𪂡Ï@Övpã˜Rœ¿{Á7g0XHà›Èä_2A‘ÍÃäAíÿ,Åwd”oоË1ù!…9?L`«²‹=Æòšvv Üҝɡ¸€#®¿é„L³JUr)Œ©,Ê$yÛr1ÎáT$×$liÖdm@$ç&ôã2-Ù]²t™µ1H“Xðl$²‚¥EŽÔ-’ž7¬æL0xǚàó3~Kî—y>&‘]iP*¹¼ÖèÊ|NKD'Y¥Œ}K¢½"Ta¤ÉÇ/<’\T?'ËNs(D}ôªM%‹µûïæ*éW«È€U/CAbí= -_œzÙ礥GûHÜ°r°hci£¡ç•uó$-4/-\ê¡P:Œsô¥ ¤bè +=„bèúUH`=Ž|‚x³ƒ»›µ%aŸÐp´–cüdº2Àà/F¨Dy‘’`ÔJÜí*K$E}ÞÃÏűø࿉ƒ:lJ{Ó¡+r$ò¹#‰Ÿù´‚=×"A­¾ÉYÆLq;Y[àZþ ¼÷–ø/¯D]´^­#ð»)ÅÃΓ‚…T},wÅß~p ¹å +!3iQÔó4Ên‚¢p__îøœ&õO,³¼ÁýV¨JÂW•øl°n¥^¹ºÝæXùŽ5jkãTп3¿oöèÌ]Âû/ÅؐË^$+-×¹îߍjŒTy>m¤Æ)òÚ\8—¨ôTëºýNzص `GÓa5³JÏIL ï¹çbAÕ> :¢>\9 +»`Zj[F.;Šuº¹>5 ¤„¹îõçýœ:løÀc`‡ñ{ŒÃ.²ŒºPGŸ.+D”ä{{.sù| +W‚œÈ·P4ÐÍÂ|]/ÝÒoïj{9 +pz[4>)aÉKX¿ÿ†;>í]?l–›Ã776 ¥Ç„\l nÁÉ­ôŠ‡ONg°dŠâ?¤†Ë”ÏóÒXDÀTœŒ…n{9´›&´õuOP‹§ˆ³O!à›È]¢ºÎUXÂÌBÒ»’õ£¦+f‘q?µ&]/æÛM´–¾Ã¸Þ/)ÐQ4v0 fŠ™ÑN !ëŸ u„p@mO—ÄÃ'¦%£ÈŸß …hH]ŠŽïâ©”ƒ<›E ÕÖ*´> +endobj +23 0 obj +<< +/Filter[/FlateDecode] +/Length1 841 +/Length2 2106 +/Length3 533 +/Length 2723 +>> +stream +xÚíRgTS A”0È8ôÁÒIh!é QÀ ¨ CòO“—BEš""„¢¥ƒ* RAPŠRP)CQÛÐFêFÝÙ=ëì9{öì¿=ûޟ÷ÝûÝï~÷¾«ªDpѱ$Ó}@;:ÌÖAë¢q€£‹•#è뢪ªÖLÈ†è° ‘ â4k¸€ Ðh…3À ª€#‘í¸ðh>t*@±.È2Ȃ|a øð¶XÒ@&D"Â_ù M L"R: Ù<]Ž5ÁcB¾~l@ÝZãK7Ì¿©K*Øÿ¥„ìY 3$ë"h4@†HlÀô…`„Þ—áð0…`¾…ÉÆ©Ę́ æÕӒé0•'°NAè9ÑÝ@—ÿØÖ¿põ½¸‡Ju"Òòßþ§<‘Qy߶*ÈüžpüfÉ$CÚ÷Y<›H…H–°/PßBË +ɈMò(D* üaò÷­ëúÚXÏÉn·­ín­¿Ä·,ÁlWãïº_è_1úX°&Aé¢PhQðþñåù]7[˜D'C°/ od ™L"HéÁh‚É`  +,ëéÂt¶ `pØ¡‚;c"¾üGŒ‰Àæ—ÐWd¢èíÿŠþ<’•=0XG «c¨/¸oC« +ýgâòç€xÀe€Æ +ä¾DI&„Ù_oG°®?0,A"ܐYŒµ@@…’’öhEÿÄEiœÚd’r€ôÆ0ó°”{|jGcí1M{£L CÓÅþ“2¢ã&}:Xáñ Åñ…d'©òÁY+|§¦L†4ñY™1ê¯×'Ïšûîi¶žíªO³ŸW”SÁÉÎæمmtâkÃ³aÍ +¸ˆ czŸï/±RhÅg)QÝH7<®œ ¶Á,|¿¹{®¤¼w×¥ÌÎ}‹Ë´ƒø­CWÚbêaÛ ù˜ÇÅ\XdªðíAþÔ­ÊW—§EJ_4$ã4¯ŽÏ j—ZŸŠ?k½iõ㻤=ákm±5Rå’7ŒÏO”+ΜrKî»t&,r·üÚƁ§¶vJˆOªs>cÜ&»¬£ #‚ÐFÖµ©{l=ôz=£{õ£øä®ËC56cª +œ‡©²9ÍC‡([Ï1¾wüXÖIÚ>³¡Ý{GFvõLí~»NtÃÔG«Õ©ô„S¨Q½´t-ÂË´ @흷Ú偸ŒmïU×[å¿ïë<ŸþË#÷Â÷F\b+B£'/i>HÖhmihé¼VÎùԖºoehËËñ¦‰Ò »¤‘÷wd4s†Ô¨¾¬Ò͘ñ,찗ƒžü¾Aê‡ÌÇÂïëÅ7‰š8Xœ™Î”Î +êg™[àÌêrý@˜¶áŽœ>z×TvÜVö £ävŠG^éSíл5·^tmzT÷©èÚÎáWLß9.+¥W Lèæš&U]•¼Äí±Þ$zúœÔwʞºü—I\¤„T庥R‡‡×ö­ª¥½ÛHOYIU®ÚÐðãÔqìJ@ã„AùöMÇî­Á旙ƒ†J‰žFíʳ: KŒ>¼•ý’f”…‹óòQXUĤ*f zà™5פf=*Bkkzg=¥«z€ï”ãä éÈ}§®FT‰y«’©'MÞîcR—E~Y¶Ó¯'¤=ñãÂHÃ¾DS¾õæ[¥uåeÃêH1„¤FÛ¾*reƒ&hNÙþ™ØèÏCø`Wµ€íŽ2豸™ÏcÑ=Þ)$øA|ÅbY§é‚˜›*qÔÝkrFïאcœôCïô4:È«Âë«!̀æe§Ö¢L•Ís&Ôí wLs&#<ŸDkTœŸž5Ã8¶w£TInaݼwˆ¦Éæ0à· +¤FQµŸ9Q½ÁìFf.âýi±§‹nôM í³¡`Ûà˜eu A’ü¸iÌy§í*œ]ŽŸ2KŸ_ú°jœˆñ(œë·™‰¿ž‡Í|œ0ì*vM±-"Yêcó¼ÜŸ {ò÷r n[pH¢ðë¬.í±4Œ1Y>vD͕ m‰ÎY¬Ú¦áÁØDžÐbÆâ4…ö…?7-œ_½ÖW(#éô8+‘{Ž¿IÃûy]Q#knîü½r…–9ùÑúë`ÍÆôÒÈù²“öVÜ¢#íQ„ +„hÊ°WþÈóTc0êÉJ.ÓêSÉ£Åd/ÖòņyÕÎø%ÏóÈ­úâ +½:ìÜ­`ïsJM„,^Î/6è†[&d*øè`Qî³·x{ßY±-Ã4¿¦¼&ÿëÐF i[/ø¶G1[yAdé|X»iŠvªaþM«í)²ÙõŽ4³W'¼žpnÏi>mT¥‡êbáÊ0EòƓKý– ¬%³]#¢9nå5 ‚Ò,͇WäÞ¬w¿S´²v˜ö³F”€¹£sÓÚ릥t\J—‡ `hoJorB|}¨“a,÷ªÝ=u»Á¨›ãHýººò"·S[«Xš·X䨸ç=sI&d÷«ÓT +µÉÅÜ£_0ë_È=};û¨!64Á¿)Î5D©½&»¶uÀu›ôg­³(¼Hÿòe¥îÚÃÖvÏQ¿öÎ%^7\ŠÛ)WhÍ{)^<’8*‚NÜr—_i”3;³6r»eEXbîe|þSCÿ·iÙè)‡7wÆ-:4Káúú¨³3Æ+c Õ@&N3múÄ¢ª‹³„_÷ÖgĜJ­á–,÷¥¥F©{›Ç3¯oAJJ.8%_ùýR˜JZ`‰j ’Z°z+3èViÅý®×ÏÉL©7dÍ.†/á‹E¹KYç~ø-ö®BÏhÍýa‘HÂDÇGëùä×°’q|@ړ xpH¡×­7ÿª6*Z8×ý|H\Y‚ß9C)fCæÙ+ù„ži+•ãë=? ÝXï/š'éï¿”}NmD9ª £Ø§öp1+!bxÈêøh_¹_‚„µpùà"_¥˜=pBö6@j»6oö À.ÐÌN=‡ÿ)yüºEê¯G='îD›¥¯Ú>«ªì®tÞ!dÝ»^£»e7ï6ßsW6ª"‚»£;l³žØÎK:!våuz“¢wl¿^{Scuþ–é‚Øg=Èj=ù»ö•áÒJŸ§E·—Ï›6&ÝùªfŸPÞ¨e„~qû\sW¤!ì*háaL Þ㘠V—âӈži%‰²á»Õ]Éè¶üù{çN:NTžTöD۞¾W—)Ä:#±•3ýPÞ``oY$˜û¢V\xùÁ£ÚÁú­-D¦™ +·š/ÿÙþEns:®d:WŒ¶`\¹³ÿ³ÿšV~í‘ýÔòæO9̓ðµœÁ¿›w·JÕ>žá#ªüBú^²‰z¼#50"—¾*»{_y^;µ£y° ¨³Žߚµ‘j£•¡ÛÒ%³W=,¿›m̎Îh  ‘ÿôSÇþ$wŠ%G-Wú|ðd{‡œ„òûò\k†ünɆûiÎ΄SÊICÃMU}QìG-…r4Fç}¤8®ä]G_Ì-u5O[þ% õ_>ˆÿ üO¨ ‘ɦӈÌãÄ_²»– +endstream +endobj +27 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-15 -951 1252 782] +/FontName/UQCFNZ+CMSY7 +/ItalicAngle -14.035 +/StemV 93 +/FontFile 26 0 R +/Flags 68 +>> +endobj +26 0 obj +<< +/Filter[/FlateDecode] +/Length1 800 +/Length2 971 +/Length3 533 +/Length 1556 +>> +stream +xÚíRiTW¬ +A£(`µ>Ô *$3à@D!²©‰,"Š"„äF’˜L€ˆ‚»â҈€ˆJdSà˜º£µÚ‚»R°‚@¨zꂊ +n Øêñû§§ÿzúæÏû¾{ß}wî÷8Ö~öîR2z‘mrQ .䔋°8Å4N3Å4t¨³3 +ÜU2€bá»8 .˜‹Å2FMá²(Ø +&ô°øÀ])\"&€PLGA#"ËA )Á!­æà.—ƒ€ž#J•ŠƒR.‹…¢@ŠKhe8Áâõxò%"IÀïkKU1¡8H)_À–ñ90.¥$!W)ŒdñD$sd¼üc[㪿¸—J.‰=ò=9}‹¸\ý'TĨhH!)…џ û¼ ¡W)ú£¾´XŽKÜ ™{t2qÄú\é…'@©NK¢@¤X®„½}HHû[aÒë5 òx‰B&õ ¶ôã=Oò‰Ý[£Ÿj&$ +O‹.‚  ‘ù>îBû]æIHH)NȀ6ˆ)J¬f!Œ”†Dà„&˜À8æq ’fŽ&š$IR¬ž©¢S&žXɄ…+£™±DõÀ}ˆ +xR±LÆäØÓûü=<ȄD{æIÚ;c(ÃÇßÉ!é¯Ä UAߙCÄ å÷v%*Š‚Ýû¶˜ü>֑8“9„ PÂÊÙeŽë‡Ùšô2¼ãlí˜à“«t;LJB­D?§j¦’¢ÌЪª “ìÚóÖe_m݀U箜j$?µyîØò¡GFgǕ::H.Þj»vzÎ*ƒ'zûz­Dh¸çFHǾ óóÝí¦ìlM|Ö´§kÙªð3Þ!2KÝ×`Ïj› *.p ¢íj;ñµ[žtk€¦wÇUhÁ.Ö^W•G5J6èLqíõ¶tx7;`¹àk“ïÊ Øk}v\-´èvã, _]au9ª¼É VÙM”ñšÃévÉå•F%ê”GµKöl‰N» ·®¦S‘<Ƭq½í=㎳®S5GÍ5 *PZš^jýÌú®æf=hkúCn½eñ 㬧»nop .K"Žó +°ÛŠ®Š}k¶oXÌ)í8­%÷1ÿyÞ¹[›A&2Ø܀ßXxfÀ¬TYüÓ֖­f­Ý‹•ßŒðùΚwònƒ0%,tPÔ-lÙaw´(d–¦á„rùÜíZ3x©îõ‘Òmôò]íÒw?¹ûe˜†n›æ±cùìôWN—‡Þ´ò½Õ“epAنþÉÙ^}»yÈ0¿•CÐðMüǹFiÝÜïlX{½àb~á7ìû[rtÔµ!-Óí-uºRvÐ|K«õ»¼S‡6go2WkŒ +?ìë +—{@dNQú[9Äͤ˜nšó-5—+_0ƒ3K®U9kg¿Ìa:èµú¢þUòAYí<ÃLÐÔí–>ýÀ¬Õ—¦Ž[w34µ±ÜªDS*Â~tþÊþ§Ã§ë¾_sÍÇÀ'BavEÓÂrÊ=Ü5fþbc“‚Ýn¯ó6ô—ëcç|±HoÉä±êʺÖƙ5z +j*´7f%îîZQþ¨¢è´É.ç4͇Òáºãñ3÷Ÿp“QE’‡ÏkÙS¦fd*ûw ÒèìÚ¶(ïøq”èN‰iñ +?S]þ“ó9ïù Ó8ãgwv¨ˈ;•MfïҎ?ݛÕJTT¿ŽoL%Ñ_±«ªKZ«óK·?N¾qÌ?•wÔÊb¸gj¼í3¤©ân‹QâàLvÁþᗴ¦Í>—0—¢<^žՐ%©µ¥ ,Íî-œiõÆS8?–ÿ"qV£Z_ëûm}g¤Wý—AGƒ9h£±ÉI“³~'ß iÓÛýr"ÂJÞÛº#3xÓÐQñè“euíI{|Öx±3búΓIøJåÃ)Þ¼‰#ŽAìe{m–ç㟪?O8Ï7WWd[ðöˆï4N§¡1ò/ëÿ„€DÅM*ÄT4‹õÿWC +endstream +endobj +30 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-251 -250 1009 969] +/FontName/PKAFIM+CMR10 +/ItalicAngle 0 +/StemV 69 +/FontFile 29 0 R +/Flags 4 +>> +endobj +29 0 obj +<< +/Filter[/FlateDecode] +/Length1 720 +/Length2 8790 +/Length3 533 +/Length 9345 +>> +stream +xÚí’UT]Á¶¦!¸»ÛƝàNp‚m®6°q6.ÁÝÝ-¸Ü!¸;Á݂»—›sNßÛ£Ïí—ýÖ£W­±FÍ9ÿõ×W³Š–ò‹«¸©1XÆâÌÊÁÆ!ªr°8ØØÙ%ii%Á gK;ˆÈ,ààȀÿNþ¾‚<܂<œÈÈ´I;ûoŽ–æÎIƨøâ¶`GK9[€mÿš˜€ljv&–`çol€¸ @õ¿8TÁN`GW°)22ÀÔÒÄ` 6·„ ü•ÄÌÀ÷¯´©‹ý–\ÁŽN¹ ÿ$eüå4µƒØ|˜‚͐?*Ùý]ü—æÿìÃõïæ2.66J ÛØÿ£Wÿ­ ²µ´ùö?v¶ö.Î`GÐÎìùw©ø_l@°©¥‹í¿WåœA6–&âs0€ý_)K'Kw°éKg €ÈÆ üÏ<búï;÷O„_Äeä€Ìÿ:Ö¿€,!ÎêßìÿËöêÆÿ3þÛGKw€ûßþrüþÿ9ûúo‹ICLìL-!æ5gÄähú_‰ÿ%!açîÉÊÉÃøûù{ÏØÙ¼Þÿ«Rbéà–“ð°³³ó pý3kââè†8ÿó&üÝñÆf–û»ƒMýÔT€ § +øìø†t ³/%aþÂ|o6"+1{-©Û^5ô†DW­‘½h_x° o~<¿ûÊ󳤏ÇÎz Ë­tŒ&y\j¢ˆ)Ýcq×Ü,§s¿|GQ2`µNµhöŠ&Ç +ë~ìDÐö¦ÐrÍâTRy©ckV¦Áû²(FÞ7wSRm¢’&A8ÚÓ4!e»:¶Œ·šù¤ä®h}ϟ³,‚Jébí/íåcÜ3cyßÁýaÇlãEÈÀ;"ú£Þå›íºØ´Sü¦r¥¼áÚNs¬%3ãõA/t³˜%}Ü«9Js_•’CŁe6Œs ÿ”ïÏè=V6ÏF ÄÇî(ݶèŸòNlAÛ³{xZñèØ^ÒÖ¾ª–âÜ+ +:eÄóˆû£QŒõiëcºc³ |ÏR­4¿,ÀR–ÊÌÊSTѲ§J.ÈH¼H¼#Lo9†¯IèëكÙßåÝ*{¢Ò² g¯îÅøДµþðüñ”¥Þ9_Pþ©¨–ñ-¥Ó„A²µég|ž6qÚ×FkrèQ£sËф)}ĀÓ}¶•Ùmø%î0*1 ³jp,Ód:6 +S‹*Ó©»t +wÔÆáR˜IvêqÊ¬OÞÄåÝ-ó‡(Ü$7.«…yI²ÿuÝ –¯99›”ID*¾[™©Ç1~o%cÜ1׀ôÖ0Äö°Â +(V‚ã™ïr“þ–¿³ YÙ³ð8ãÇWè;g9ða Œ×!?)6+IúîM¾TQóC«±1¿Y%Ù3¥_í¬ye¯ú5¾Ð61v+ËŠ,x&I}unËÍtLTCS¤Ê¡§¦¼F×6KŽ4€ÆöctIë?Bƒ’ê3Þï¬7.T?OÜ TnjëÍþî2Œºc$¦°¼!xŽ.š@<úˆ Å¨^ԇopìÉ\ø›Ë’óÞ¨8Õ2¦~Æ)ò¹Ú£*¥Hû2T54´ ÇÞî™î‡ú~®——1‚1‰%é¹½þrù³ÈE](Eª„4”nºJ·£Õ‚z?ZΑ íUŠG„Gʂû@îàß$èzT§Æ8IGی5æùøú”¹ñ4⢥§ ªä)R8—ü*5N™÷f€'Ž/X¿­#½ ì“æGæ&óYÒm2ñöF ùy~õÍM+.Þ£ÕÒ$ÍòÂ*šþ¤yZeJ¥•¦ªé7·{akçð+8À î¶C Á§_*¬Å,šÊ¢âÿ+Drr 6î{Д«ƒs}÷ð©eyÎæOŒ¡³ÔSó%÷càÊðhÕë`"ë=e ñ_…fãç¹o âhf ñ±S2„î &•^ 2¬¡Î§N¿‚ÀÉ#Š(ò\Ü×Ëí•“È^µ¿_°Ä͏Qê´ªqE9Yô|ÃF¶èÊGI‰‚ÁIóiµb+gÁšZâß/—-ͶݸyÚΫqïL Åý`¯a•²ã¨uU)ó¬šå­^5ˆ¡®("wåÊú£ SÐ ƒ×éTéÿXqZĕ=ÉlJ Gí”ëƒÎov‘QU–ò”P!%Œø„vF×fq¤Ø+Üs—‰!ì«Ü=0:}_Àyð¨Áà1E¬–å þèÁ¸¼[ՋóAðlÇznÔÁ¢Ë)|ÕS¼?RRD_ҁ•¶˜º ó߯ËU­)%‡ðPŠ‚òSïÒh`–ٝÆà­53<~ÍUøÐA—Ý1{Qv˜IvSã^J¬á9$ÙÃDõzñ +ƒ +Ãæ¿Á!‘ß}¶ý󻦩ØÏS #Fýã‰y…éCëïKOýÒBãNnÛû?ªùJ ¢±:IÎ,ñnæÏ£iP¼Žj•§ªça)íèÖèŸ1@Úâ:åÈE¤ý-ÑÝ!Œf¢‚c+›¡‘û f‘^ÀV¹KKAÿrêË iä^Ä1`¿>%±M\\OQÙe/ ¸Þ,ԚE¸rSQcZD7a‚-Î+Bx±ºEà ë„¦_²tn » 7.& +y…X4UŸcÞ¶22ÂĨåo7 ÷CjàïÖ9¨ù:çø±_.:œ›ëN‘"%MÀÚVô”¹XBÌWKjO‘ðÌçùúƒHiS@þ† Q…1>Ê´¼”‘Ûë±½ àˆlҌÅç־ãý éµQU +ÁÃGÏOÃõÕS„­æ1í±ºI¿÷õ¿rplZÛ)ºœ¦©›õÿ òÅu!ÿXÜå"Ë·òáñÐâmÒ?KI¾ÌócÔi{,S<¡9X4ɑ¡^)6A0žë|d€ÅÂhñ}^¹«ÕžŽ÷yÉë«ÿµ;~hà—CÁú©…Ñ„í9//®£J*ŸÅWv>ŽÎⸯ®b2ç³VðCÚe ˆŠZNø­Á%®^îÈñbû[ac‰s‚²ñÒ0(7ÐIX;“•nq[5c…HÕÿ¼tїS³gÌ°a>rgÚTäÆýÊL2Óßhɼy²0zü1NÒ¦6$‰JþóSŠõ¤X4ƒ‚udf4™­ÿ+#¨\ý–ÓnØË ®fì'Mú—Ù’>µ…øEÏ\Ža±á[A*Ôç¬ßŠôñëÆ^¹Î.&3{©Ir¶U#v¯²Ç¯u9?£ãYçk(À'+0 +ŽD[©æð”p!ÆíOe]éÙ9{ýûŠíÎey!âÜ ˜˚°jué)7“xӔ4·ÆЋQýìMªSœ_åv²ÂòÈëo†j@Ï=+€·Zi™ÑYøQ}õXG¾kškéÒÔ8czÜ<å–ëT`è<®¢Ÿ å—Ìäc¼ñG÷` +܍@Äf6,ÂÄK® °ŸgÓ×ǗNt]©}ŽÎ:§áؤ)…"µƒ"Ÿ£‘m‹þìÊñ_’ÄcЖ~¤wþ=zt÷½“ò<ê}‹¢d}ÎÎç–íd~ÓX[N5­|^½Lfœ5‹‰Å]`ú’)-¸ö…Ï–M J¶ÎÃKªÉŸ€(8’ÕþÇL÷Àkǝ$ +ÃIZa(©V’ÍFP»½eì‚û+‡ûð4™5]—¯¬®¾Ð¬í4…@ ÷oŚç‰ÿËè–ô§àúÎ¥¾9cd¦ü•Ôeö¸£–#Óþø¾ª]=6¥Z– JäÄTÐiÃQtV^î1¸°9q:±¢ý E4kÏ_l:ùþ»RxUӓÑ×ÍZ­’$¤hm_ˆ§"„tîRÓpÊ5>RLm¶ 7´¾>C¥MB0pܔ~I¿›O’=>Å-Ug\^p{,ÎÿédA`뛳iµ‰H„Á] FÅ k aüº†¢í™óí%&å5[Çócn-hŸ;\Ð WùdX V‚¼~ä1âÃuá£û\ͱóNùihñ‡Š‡\vH H5Íğ§RÒOݞ"®å3ÃûXI@Hß7XAëX€Ä¬ º'D&u¤Hˆ¶¦1¶WRjRÉ1{nK<77dÆä=Õ7–9…Œ|VùóÂÑÈø §¯·ž˜‘wD Æò.·÷H óVÜÐ P‰΀C…ÑÙ K²·´ÌÛÚ'—t«_1é†0Iíª°Y&àì2­$Ž8ÉP ½ša—Œx;ž¥S´aä|+^DkãF»ï4 \‘Ç +Pyçä4~>û9âÕ¹Wô"-?úÁ<­"Â`«=Ïtm³×‚V]‘ÒÿêÚ{ôPBˋÊNoš$YjB…7rBÝ•ã ´Þ +ãñ î‘íð˜96Ë©Ś½l9ižYÀv/l  ƈ?€lԐR[‡*ÇA[ŠOöÂ9bhWsûM›©ŒÖí˹o F;H„Hp Óœ û©¾I¤:Á߈C—~Ò@jÉñ5Rì6>渠©#_`8ùØ3,„ܽ´‰*cÜr"R“«ÑL‹“ÑÓ¹M>¿3‚Óm´Žh¦s!Và 0‘h˜Í¨7i +"9˜~ A˜T¿Èu"ï‡âXÖ§,ÞE«©‰ö?ýý|¹óYˆ)’”ÿëaÈùéò“?ÍóÞäNƈa%~O\ÈÓ^E1ÈrÆ{ÏuÌD­rÉkú¦LXö%àA _•ÙqkT<½E"˜%«­ãŽs$ñ6,/=l¤ï.÷¬6ìÓ¡NëR6粬´bKØ=ƒjÎÄ ¦>p…”‚C%wwc‡ó‘ ùl·*£/^lwtið}E²óà`ŸIéó5™Åõøw„û¬GÖZ×8%Ls˜J/Ýä‰!Ê¼ê[×¹Ho}™ @º{Wäãsg]t’äí›Æê`MFÀ™^æ½^2^×, ¯h©Ý^Oã5“KÂÂÊAÕn±ÙGªOU'Ö5þôÝ-!š¥ÃeXLà|Ü<¹ƒp#žN‘—^á£3aøWҊ½îºohºÉ‹w½4cUîL.:³\| +8ì/€¯º„kŸ¹QÓÖ¿ü´î„•^wfwÍHglZCþàk“‰’M£dëe‹÷Τ…¦×Ó0ãÔÚý$ÂÖg:oRŽd™›ÇìâL%ÅÍî„J·{7èOá³ß½(¼¨à†×R‘¹4¼üÕ±r¶õLˆ܀âO¶OðbwÝÏu¿h(‘GT,7ã&®ùWܜê9õۘ¼f7|Àó|¢gsöH x÷¤o’s}u‰%Ç +qM÷Dƒc¿•…ùõq© +-F¶œ2+"ÅúNµġ|è'Ò+G>b„Tî}|×Æ(Ì®\Jj ¢‡G¨›íhèâШÍèøvbCõÎ/vS݊Ëð2ä¾åZšÓ&ûc¡¿+Rp!ÕpŒš;Î*•ΤY¯èTš;^]yÀ¹oÅ"Y>i…ŒH,yÆN4äCúI~o@CÚtƒKuAZ»‰Q܁þÇB3¢ºtçó€1”dÿ´öMn:Aeø}Ð;®ï,¥ð½™[=ñç=‡á`—”¦?î2¯bVa;#OC¨êR0·ÅDÈBÂŕ¸÷^AöRÑEôÓ¦C#›hÙKRÖ/˜3Øo¡eøTåéÙÎLoèËv—3\L…†ÕmÃöãóZ°¡¾è«”Þaîí7ZìFeš®<Ôf¨’,ޗç^Mü2Ì+þ·ƒƒàW Ùú±ÞöG‹õ +pæn"áÇ å Âyº’æ˜âN2¼ÎùŒ1W1ÌÂ.–cÀÓ¸7Ì4-Êš˜ŒÞ‚ä©Û‘ºD7`{¿o€ î1KÞ0nÐåšÔ™õªñÎU{} +\d.þ¤Ö>-~msed¶Žl—?$HPd«>³bhՀÊÆ'¡‘è<—qŽ¡ ÕPt¤5²a~î½U <—b0˜R\ô_ùýÅ 1xßpÆÑ)‘I q‰´Àý:mhþT‰ ++ñÚÂC”“gz隵yÌ¡Ír=¿˜’ˆœ_QŸDéFőKÁïjÅÓ6&(«}ф®3u϶4æ×O%vÞÄH/±¯®É‘"£ÿ5À¥(M${RýµÔsíG#çjM»°¦ˆÉ #ڗœu!µaÂlønYϤ„aâtkŸ„Nb=Ձº ƒ¶–€_k)®À®6–4ë+VS3ªmó°RÊõK׍oz *¿ÍJáÛÑý¢ÿuYQ„á/®«™Zގ¦Í˜¾âÄò ™ö…-Y•®<üho4 +L&šdäb5[w§¦Gþ +3Hі÷ÉÜÃO +»M¿7Î.üÓîÏÌ +³ääS}+œ1ôõ~•3ñÝ/¶H“ÞGÇ5‡äÓÐF¿ûàMt0Ñc· ñFÂýžçGªltć/Tqž>Ë¡Na=ÍýXt‚qÜ>ӗ +PÒV"ù³¹ñ£¶,„Æ´Ýõû–1™¤<óò7ýO Îðòã^Á+ì´(ZDôY2¡S³÷(YR-»þ8ɻͭ^b¾—¹@=å}ãOKq I£c¿Åkv šAJºÁºô¨ÛæÍŽ¨]vÞ[ ²QbÄJ‰úd«m´A‡VÐÜ1«Ö‘üB-QØL¯DN2…³ÒЀûÆ #¡(՝]Xöë’v¯-÷Ü.ÍbÈk+š U¶¡T¤ë$¾0ÇÂTB9ùŒ|~aª¼Faä,WX⍃™à”Mm‡È~.›f}‘Ø}âcœÆ(¡j„^ÀE¤.-Ÿ‡åy1¤åÃ]fé¯7Óݸ•7úѧ$Ò y½à1 ­«ÜØeTÜ=âäRüÖ¤®(0RûUM–W•ØAüàK¹`—¨–||µÞÔmb«.œÚ­vó´æ=ÜYÆ們{3+ê—ùƒl:*ù­+EtOÎöò&è}󏰦tÄëíؼba‚{F§ãÞ®ù¿†QWsIuü58ºíΪ¹JpþTÞ$¦¨ ƒ(‚Wkl79T4bÞgæ]Xљˆµðè<͋ȳ›ö¾äšn.OqH[ï³ñ†‹Õ=~ni—( È}ç[²ê_î3h+% D´}’¨ƒ&é“ÅÜôög1 Žê=Ô +›ýšzµ%¦µbuétz,ú\¬Óø­D"ácž˜Rµ;½98u1{½CVV”ˆøò]YØ8bjF'ø z3¾fE»&…â¬?ÏܙâÄy¸<çžLÔdړó˜ÖGÇ•…&:ÆÏø$ßcƒpÄr·+u_Xnez72m ›¹AU½ +©0L·­ö Õ¡ NWz.ÌïxÃ8³™C$‹2}¤£Ê`A όv"»þˀ%Xo¤¡G"¿ÔÙf…Qùûâá&>µÏAŸL5œ`àY \£y)xtË&šüùdb?H}gšApçêÆ ï—Àê_?ù +U:3£“´i_r«Þ^ýdÖʘv÷µF{ê{Z˜'øf=‡ñç¨Y‹§b‘Ÿ*7!`XõEB†ö iSöyI=sóãg¾ïzæp¤­ß±VòÛØaÜøeÑþ7ȇö¯öëÁá^hÅMwô Ó¯<¿ì;Ú?­û§btRՐ„x4—b}’ã(&Þ „oPûtÉKùЕse³xS)£}•u[ÎÖþ„ã/halê hùÙíx­[|:¨KpgC¢T–®@8]BzJÛGÑÙï²½ gñ5› ßWÒ_X׶GÊϐ¨›Ç¶Ó¿ÈSç1¾÷G®ô{Œ-HÕÍOlQS6½˜„Uð×ág9²n,ÏL§€nLbÑ.t›ºß‡åôæ±Ï»ß›ÎètRŸÜ°Øjpùo˜°ç«RÄ–mPÚ§ò…¬hÄÕëÚÒÉ\Y ž +Rcò±¥·¥j$'|B Q0ƒc÷Ô6ý{Øá°Dê ËåÙBô33'¿ƒ}0ßä#ªG&æ„7áREÕ_ÞOŒ£È@¢a[w¢eƒŽ37Nøë4~¿kW׶ñ…Â…³äðÓÙ¢°Xú72ù´_††r YÑkI7J„ z¾„åŒoŽúì!ɾ ÛKþôm¯`%ݓ­³Üñú½¹ôt}—éz©Û`—Ý–þÝ~æ&?`Í¥.÷Qæw•–edLR¢^¥v ™lÐ%˜Š}lŽfô4UF‰~÷v~ž:Ó +…Þ“q;|øý3<IÁšaZ‡IZât@Pl=G²Z9AÜ3fJ‰¯ÅTk7qÙ¦aÉKÃw?Ôbh°…‰©Dzy”î–fëú¡‚ä:ê}2¯ +›Ð¼¡ei»&…ô7ƒ6ÿpó¹¶EØÕ%vðøÁ Ôû\®Ñ±¨ yŸ†Év…W꘳<}Ží;u#P–Òýf¹uhhŠùIežSx-Îz·°4ŸY ŽƒY:åJј;ø}¯USŒŽDˆ&tvÒW~;†J,Ë;+íþØpH>Þg¿Åú(7ӊÚýH¿ÿ‘ÌúЖ‡™âÁqÕßIMq¥±Šq#>¿~²©ósWœt´0‹‰£ÊüœÒI‰z´ÝH؞I[ô·dóA| 4ìU +”²:#͌l3Ú:ý`û’>ÝRÏÀ¼»Â);öÛ½•×bêNȽ¹ñ6òCÿ#¶òÑÍçBte³¶³©ˆ5ôñèREgžÀü̖é·zêDýû[ºr¸Ò;g˜·Pž-ŽÙOTcù˜\"–ð{nÛBe~§PޛɁq\ÆGXÃ’›Ü*òRÑxz,‚a6ŠdU@9‰WYó…ù‹ÞÏ!Þ]ÙêŒäÄÎQÃ^uC­"×;÷{f +]Ϝ›„€¯£›¹Î9p£oR§.%^ªOô^ÊÊ\[“i&ÉÊ¢Ëux0òþ!ÖÙ¹=ÚO…@½ŸÕ'àr²Û“¯C îŠo-0ÒÚÄ^"FšSEÝÓu¹Â{x†¼?фlöð> 0ä´æ÷‚Ë{BÍ  h8qfÿÄÊ°1ӑÊ&®úòkû +â†|‚&|]ÇU~p9a_}ú£elÇK3=¶.j"ßÒYó…¼ëœúLɹWÄ Ü1ÔYk•^m¸Vk4µr ÑJ ,1—’öѐ}t¸ã¸°†ôîOۇöN°éʉV³í/öEÖ%–;D!û%äl‰|îÀô”ƒ½ø“¼¦SõÜ%–ëyÓ¯0·Ëڈ‚£ç:æ3zÈX=„uŨ‚ìI˜"Ďð 2àÀ4TÀš]–gñõ4%¹Ÿ0×À4õ +Á@œšÏ©LŽ¦P5’ð©è4á@XøñØ~U“$.,önž¦ZÕôÓ¢Ë\8PIoS8˜XÙ³»Œ××?ü”Z`­‘ Ü{÷íégÀÞíþÕý‡±“hQáÖe÷Mç¨Ø@¸c 7O š¦‡¿ŽÌd1£Ïo£À!Õ`¼üC²i÷2²L tz{“©oN®ð–ANý(»¿LÛttvo-4Ü(ˆ/(N±õÕ{©Ç‚(b_2ªÌ*½»¨ä½ø¿ã£FÒV‹§ ¼ª¶\Á÷È­%#„^mÈÿê½ÓÁµ)õKì ¸¬^ TMó +54T¸b¹¸+9%•ˆ§îë)x~ºÜáJÍÌðK¹Z²‹™\ó³ÙifFÿ Àš³Vâ'÷³Âˆ*Ô¥O68Ú´þÍËýæý*é£öÈÇÚEqƒ¦Qއ»¯Ë…4Éþù ÿƒÿ' LlÀ Gg;[£52òGì]é +endstream +endobj +40 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-36 -251 1103 750] +/FontName/PFLRKF+CMTI12 +/ItalicAngle -14.04 +/StemV 63 +/FontFile 39 0 R +/Flags 68 +>> +endobj +39 0 obj +<< +/Filter[/FlateDecode] +/Length1 723 +/Length2 10984 +/Length3 533 +/Length 11550 +>> +stream +xÚí·UT%íÖ¥™¸»CMÜÝÝÝ6¾qwMÜݝÄÝ]7’¸{" ‰»Kbýó×ß5êTÝôè»qk®ó}bÅ{AE¦¢Î(jîhj!åèàÆÈÊÄÊWԐee°2± RQ‰»XÝ@Ž@7 >+//+@ÔÝ +ÀÊ`cåcáâãdGD¤ˆ;:y»€¬¬Ý4â´ÿrqDí-\@f@€"ÐÍÚÂþŸ3 @ÝÑ dáæ͈ÚÙÔþu‹+@ÍÂÕÂÅÃœ ‘•`2s˜ZX™ÿ%ë`éàþ/ÙÜÝé¿[.®ÿphþá¤üCiîè`ç 0·°DdVrüg5‹Xþcý¨þ3\ÊÝÎN hÿ¯øêëíAvÞÿÃáhïäîfáPt4·pqøO«¶ÅÁ)Z˜ƒÜíÿ³+ë´™‰:XÙYY9˜X8þK¹J¼,ÌU@nfÖK «Å¿u óÿ$ùgzÿæ`V‘RP“—¢ÿoö¿º*@ƒ›†·“€åÚÿ]³þÏúŸ)¹€¼ú,L,,¬ÿÿ9ÿûÊð?V“t0s49XÔ݀æ@óÿ[øß©ÄĽ|Ù¹Œlœ¬VVv7'‹ÿÿjÔt9»[ÈJ8YXXxØxÿ­š¹»¸X8¸ý{7üóÄÿ][‚þ’……—…bN.˜˜þÁä~`™\»kæ ¤tœ—Wâ\K2i‰?ÉfDIƪKOň8O¼ýÀüÞpª´ˆ4*ö£Ñ+wC}9Ve!לYO+- ³5ÿCǓÒGÀȲj‘íñgf^Ô ò;ð +¾—;µ mo¡|Ïã~Úe­É t·€ž‡%úF]™œ-º/´xAqdLìP2[wÈH¯+øšy™2&ßäQŽ’¶^â^ ÓKAâîl$ÞR‹ j˜²% Ñ\hŠ¬fItÖ±¸Çp8sH ¾í “c9à šª¦‡Ôç6Ñ}ý\ݤ ¶t³Ëk()=Jª*åڍmYÈWv}Š3lUø+¾wCnõÓ¸kk6 Y߯­“2 +XO%¿¡þÚ4_Q¾b\*±§ÉÆáê̪j#8¬„ìŠU²“Q³4ò"2NêòU•ú>€UÐ^eh|ô¾‚Ò̽˜fPðð;b,@î<՟ù ÄæÓ©Ui‡*5}$Zý:šëYó ¿?EÈ;£p½¸‘­öÖÌȧ®Õ3 ܙ£7†õÚ tP÷YlA)· ÝáǪ̃Z½eT¿ÀÕ8ìzß ړ\…ék|ÛËö¹´@ö¾¿ä@"š’»¢æïb£½z]ß±ž‘êxO\B¶ðJsE½<;K‰ZÕH¥ÿEÕMhCÌ'°ó-šû¯!º}L“ÐàšÇ"§]çûË™¤ˆ‚Õò¸Çß¾i6cÄPŠ«Õ?¦¯C×ÅË¿!A¼[?ÓƒÖ +o,ñn¦0ýTÉJ,HC-uQ• E’Ød¸…]™··«Zí<|äÝßwôÿÎÐ~šøgÃrÙ¥Ü=Æ'QèQ #—w¹7+~I_\gsZÿ+,“¹.‘umËñÉØ¥*4’üî(Bh¤é¬RÅzDàcçí}‹¹9ɇÃGÜ÷ëZ;CàÅAs\Bgä|Æ" +UãJÅÌåUø­dЌR R‡è÷›¶®N)ÊÒ¥‡ÇúúìÐZ]²i,N’ñ™Ï\]ÿºî¨‚I’uZ#‡Ã-;v%•Á©.Ñá£Ãiì©É­ˆ^a˜¿'öµI8þðš±e—ƒË[¯; +вt]B֘²º6xç…Â$ÕΡ¼»ú­Š!Ì5·xÙ!ä +t…*GUÜÝØLKoàd‚Óp)=Ýû!~‰ý§{Š‘Š¨Èô‡DdI4êLϒsãy"œälle…v=#øóhs\ôUá…÷Ãr0 ŸÇíxgM·HÓÿó“mî8Ë2®Ð¨¹µ7ØÖ^!ù‰»3»›P¢ê·;«Ãos¤†—¢Ôƒ”Ì-ӗ³ä@:°Áp³y¦¤x,Oor‰°ë&I" ÇfùL·ËfÁjeæß½t%WAnŸ$ø<ÆÒ´gΖÇÎ +£¡ØçQˆ®‰©É Å̷ˌ¨0²‡µzÒ1Ñb†® \A$ö53±SfƒR#5MsšUèK†u÷“œ/uñrMϙ ßU{—Ü,Ü>ÇÿÛKY>ÍÕ;ª•9[ªÞÏ w§D›£X¹×PûÐўþ-½UJŽž‰=ËÊ«oùß%×æsb„·R×ek*Òݏ^û:$½T°á“³>Ç(ÞÝPøvHqB̍•«—'^©w +–G‰„Ïðw~'xª_ë¡Þvee)ZTXSâVM +¬§ÙŠJ¢šœ˜FÍ&Cjýɶ”UÁÖlÁ”Áš›²ä¡¯gÙk¢ÒHӞž›#1 + !öo¦Ì}¨ér^™°´”ìÁ©ÃŸV*iO9„ùˆò5ØÇëßú8!°ºjºÅò’Œx„ [O„â +Úü´ÃÆ1íxŒÎQ›žáeìýÌæZ{–#PV¡Vè„ü•ŠÊ\!M^—ž&Uœþ©I«g•²s¥$žë„#‡Ÿ;ŠPӄ&•m€³Ü¬ Œ7?z8¬þêK“ã8 QΦ1ÞIoTÄ\DáC§áwCòµBžBº•Z1{©× +çà^Á $੕pŠ +?2Ñ_Í(°»…M W@ÍØ£ëDðËÀNO®»®Þ݊å{ÑèQJyL®†­<…¹á™­%èPÔæài C™ íp\‹v^Š rxÜ8ÝS*Gîn=!5«v9 +D¬(!쉠neZäUüÚ´ÿ’Ӂ‹d3™£¼ìM”Sv²’ê/i«Š ýË[o•ø˜&ÍOÙ/d+i0͝Ý+@«û£øÔ.âÛÎWKùҁù˜E€z­40jê„x.(%ƒ~3þ}Ȕõ’S±J‘gv ¬4L*Û5D~ÿ³;Ad©žŸítÓ'‰z>i5)³óQK ±Yæúk´’©çF×Uė7[”‘ò…C‡‘oàÛ»•÷ ãt…ï&FÔyõ\‚M´ï£ì¼“%ÃbnMsŸ³PKX13ÕÅ÷WU¿úÎ%P¤,ô¾ •täî«<ÝnÒ0c{ëltH’MVŸ­ÙŠ¶¨bübژI.rbB:} EÌ<§ +Þe}(+-fÝÉÎܯO6®¤ëGëøÁlN@Üú‘ÀT<á«”b0‡ $–k4EJÃ`šî÷¬5#뤬æ>èz÷V:¨+³¥…ðYŠ¿]-æM›pIÁÊ3Ý­j1œDB‚ “ugw¹ø òlo–(ÒBß³Vô×Á‹WCZ˜NM.½W“TÎj‘d š8›®éù +LŸ}b/ßWû¦¯`Ç1ïSÃFøa¶›¾¸Ã(ý¢™¥9*»¿QÕ΃ÎWÚ}NV7í ;´°û %‘¤s@X©›È,ÖKYð›2Ú\†}´Hê“/QWåGq¿>ÅÍBÈüÕoA3Ñ$IÏkôHe>mÂãýâ;“Þzí˜P—Í#ø1ÁlXC|¬<ŠENOêé™H8|÷ƒ¬mFÁyÓ^¨jxHˆç~?ƒÆ*3b®¾RÀ 5Ç\®ÈD‘‹7Ö ÆçKÑøgõ6kdçÈ(BMøfU€àæà-²B÷ÂrëŒ(¼²5Q=eV'ö«3Z» QjŒC–²‘–â1Ê +ù¨ Y^ÔiE[ùVX›ƒÖòxq$7"Á²üë9>«€yè$ÚeÎϸ q}»Èa B÷o’¿Ž,!ñ+{ 8Z×ð×»l9»m™äܬ7 +(öÎÁ¬A ÎéÖäÜýݵ©¬OÌâné̼%™ý·}L7®Vý¥úFÁ +c~¨ñö>–Â2Øä=ú"—µ§†™g`Ìî^ÛK¢ÓäþC³/BoÝ[ú,Ô®Êéš%Ž¯¾¼oï ­å:ßpCh›Ñd6~&òBº~ú4‘)T©²¹ÿÉiú¶=­y‘ÙEö§!ûƒ@PÇSçÛlf“n-#QA x‹Xÿ ,c…0¾Ûû ¨Ä_< +ÕÔNjRo´ ¬Iæ=ÐÐòúâmð—ùܵObêl½ba‰²´hï—•læ¬ü܁ÄNA­G3ì0’|ƒ +9TÄçþʾӓչY¿y$Rèþ©ú¡—±”së®ñ )ÇÆÿ4¡ð¡Îf]6Ë%ŽÆ¼¥žš@í½½ +Äf«; f¯¸gM~²fð¬òP‰ ø*rqX!^\]¯UÄúN$¹A‰Ï™úf·IÔ6ß,=6ªï4/ˆÂÌãð±Î +ß¾r2ŽÍ7û鑣⏯¹[ó”ˆjSö«})©þê9v¬»“ɍB7Ë­±\IM^ž¯ãÔâo XQ¦É¯¦¶™Dœ6:Qý¬¦‚]Ý›<½xZC±;\þ:Ö D‘`Á Íy +#Xž½ü]oӉ¹÷,У‰Ï-ÕØf"ÁõÿY~s:9kÏ ål7O@µÔxû–K°A%gN =eX&ëM]W©š.:¬fÁ•Ñå¯u ¦f榑ÎñÝ*àÃ?'Ã:}i "CòYôZ4%*ü:ˎSÑ IœÃ¦±åÅ¿<|ºGâ×r¿eU'Už?=»á£?ÑîŒðz₿ì%øüÕYþŒ‹Fã5[ñMÊJ’ºHŠå.kz5›föj‘ç³·pÏLü×MN¹¡*éց¾:…Î+Tm¾ÁîßȤÐ)£ ѺL#í€i!~¿<ß _¼º¾QµÍïÆ:—ÓsËL4ÿàý"8¶{Ÿ•œƒ²5æ:CœêmNfÑ=¢â:Ç èՍì +8EŽDOª,‹É.j1»+Æz–;±X4Þ`«Ø³¯ÖÕ°ñAvhÔ}L%¢ÂÓQ”X° ’ÈÍ¢aµ,eŸì©Ô"¿ªcJo†±c5p¡f áÝv‚²ÿM~8œ>Rë¦Ôl¨Â›¸ C²ÄTú{ÙNÙ&ðãRRæíS<ëšêe }Ì·yÊ+6§ê-Ò¸sY »á£p”Vfd&†Ur#öá)?۟;·¾ºD½œ(úÙU»»&3F:èÛdg.EO©cç§^+' Ô48nÕ[ؼѥ™½6Ɯy6i¨¨Æ½š¾ nv¾ÿº¶ ‘1Iðûïó$°Àö×=?O%= +Œ’ÎÚxœÐg)–/ê%6_"á-¹tYcó8E“åZ«ïµ¥äbœ?Ëã˜Ô—Ä@i‡òçÍ}ÁMúp´=åµ@Vg/îLó;혁ˆ|9Æg);»Áõßýóͦ­Ã]0N' ÊԎ5›d‹^Wk‹]Á·Q³l«F¨R QзP÷gՍ>Œùáóïåü(‰^ÒÕGý¬ÐîMÔyèAG[M[^ˆ4™þÌçv3êÑ®^1¬NÍxR}ä\–,ç¤ CæÀX+Ú`ö#ùõ¨¬ÈÚVhuÃ<7ëќæF?3»Õœ˜õº˜Ü g²VØëgù†MX~E*Æˉ^œfÄTUÖ XЂ´H—ãyšg}n0ù,Ç’_3‹7å@î¬ÌÎýÊÂ,°‰‡áÀw/-""ßP·³ÛN׬(qQƘ.æ8ÓVE¹ù>´@&µ2\N̏};\ËQI¬¿I•] ÷q·xá·W0§'ÉÜTDJÎ¥è%QwŸÓ䑝gÝÆT5ʸ‹—^d!G¨|SӁðØî°X¿åe$eíŠ+iùýû§+_&{h¢%7Rï·©¿â¾¾­­¼z8Êp¯OY–í*P±Vêú¼~Ià¶Ås +ýH‹ÃF¿-êÒE2¦'rz¦s̼–ÜF~ô~[™ŽQ]‹XÊqœ0kq}Œ? [š8) +ÎûÔ!d3µ “Øwà‘ߍ@PÑ@¦’h®þ V€²(¶ó/ÇZ?} \ –¢D&WVk퉒\ÅÁ2áz’»j¾Œ3ÇfØ +‘à†ñÖH,gbDx³{àfql¾Š÷è¾f‡FT ÐÚºò`Ã2MX0^Fo%z¹ˆ°øä ü”Mv"¢CÊè:I/ÜGYšï,^0rk)nۄ‚ʧk|èæÎûb…G¥ß]XáK¼¬ÃàlwœÌÈÞÕ]såHÙ§´ŸLŒ"Oy–íÐU¤k¢ßQ4D\ÁŒh·#>™† ÌÚ`UŠZJxkQ‡ˆÝѽÕ'i°®hÔÚ#W쿾°‡&kÓsE2á.EÅÓ<Œs¸Î¨–­+ì’K?QÍpÆ +ýŠ^4iû÷”M“U'ÜOÅ-Ø(þøH>îìV8 󯍐k`fþœøFS/ÂßhÂÔ¦Ob‚e®¼“«ÊBæÚ:ú1BCULáµÐ»Œ¥£˜fÿwÞ}+H–ÿN¡Ë%$À̋èg†´¬€€@¹¡zTL!K ^‹½‹ûݨ­šçŠXb‘gsš”p­$ˆÔd¢WØ +ü( éù="óv¸±€»¦Aˆç‘ü5C®¤IÙÔþ"Mv©“ø'ß¹)tk™‹wgÛ%‰uA¯m[¦š¦ÜH®²gHåxXe98ɪ7šnûeýê4ÐêœO&’Ža`½Êð«ß1ýQ„Î5Mñz± •É¨ÂR…Q…ß= +EG]gˎo!Öè"éÈømyw”C-y[…”¢äa $§aÈ®­1f•ta‰ÐÄGŝÃ$Áí'%ÀDåû^!Í}ʋÜTHyvµP:}gqX^þ£xæÐJàþÜ|LËÄ¡!°Y~ÍûšÈ‡!=ͤìSn^Ö× ¹ÙŸkÓ ¯ÑÖNû+Ùaìœh¥Þ2­ ¦çÁå-Îþ‚¬þ-š›d¤{êv²nÿ$ª Öµm:*l¢åÌ`ã™Ѷ:·“(%äïìe¨ÙR?(²çšÃï ŒwRÒÀ¾o9_º0=ìÖ× DÜ©*6cwïÊ#Ò(o^ÖÀˆ h59]“£¦¾Ô lC+ð„”?:Vä›ö¦¼PÁ?”ÏQ#ÒùõÐE¼®Ê›°‹ù팛´‰ÉCø n‹0¦›ûaé‡Õ@W5¾íÍɺ¿l.Q+z¦áD&­-ғ. +N‘¬)’´·â´›®F,­TiÅdoª|Tz®8›ÍàÑMÑúWô¾×}ƒæ@1( wØ|΃þ³ë”ÆÊöwL»¹Š²}g3ÒœÁfEî›Ìԏ3œK™á¶j¡Î8 IŽÿµ¶zRN+üaVØV¥{€Õ“ë±þË×ýævïxwCV¤d¡›z“ÌÏøÏz̋‚¨tA¡…ÌyS1k6Í°£æ;DXö>£ã±õ •Qѵ?c7ZED"˜ ø@^ãdð.ÙܛR)þrà9›×º-*È K=^Ó¡3ƒS͝ÀòMnÁYÍ*Ia`Â{5£LÔ_;֔ݽ ášFïÆŸvÓu€ÿyAPu–ÊÍLݐÕГz$J@º=`’XƄWoŒX +퇑sþo«UŸ®Ÿ9dª+ˆQlÍ*Î!u›>ž…àjù9å!)ŽáÖÂY(¿íÕ,TmŽ¾)î×3¥VŽÛ=?v³GC3$ eU”‘Ø´KUÀ«š3<,-ôïÚr·ÊUIA[V]èëb¢—/C£ +ԕöÊD/žÜÌÜ Þû¡Mpót?!º`8í2× +}åè‚,él™+ +…è46Ø´»_=IJV„¡’â;{3} ôtÁµ¢wwgG]ha¨GD"6kôr:·ÖÖe1¸Èz©Ö¿¢pJÔ2)]6Š˜*Ì5¤–ˆÕáËJAç´¾-^Wž•a@f‡@t®©><@s–¥¸êVËtjû„â÷ŠØYlæÃÅ@'ˍ6 »àædÓB-Ap¿ˆ„^ÚIUÆ»k½ôCÁé s ´«ÇMøoUN2@ê+³ÁaiGï‰=ï/Õ­¢+à’M:)*¬„~‡.®èV ¼ŽÒ?ÒI½;ß½”pôiŒÂ BÏÉì¯| ½L=€Ÿ®øÛtä[ä;ª#žPóIÝRn†ø ñ2§7—Ý{´¸xO¸‚vâðpjj}6fä×ÂÇÅ¿@™¥—hú3-N¯ÛZX¬É…M0k¹¼¨\mLBBáJ3c«ÜK‘ƒZ™c»Ûe†EÀò÷ †áٌºÖtÑBƒŒiû|ސ:ë—Ëu¹¼oô£§ 69p„C&9áRPÏ ]B¨;Á—è¹UJéF%༳—Ê»Q‡H¢ÇqD.>™Fc¥“ðvŒ¶¿|DBÛt“A7#=¤%ˆ;¡ã…•¨[Ò±|ÉåÌáÝhAFÃ8oòç¯ô:Yô§ÆËnDœª.œdsÏ` Ûá‹G‹Ç‹¬*çfúDBký8ÜB×;Ïhɼ‚²Ýl¥8€öNPçØ®3<¹XÓâwÊÿ +é•ÌÆ£îïÀ´Y†¼z<ØS™Dà‘Æ3•HžÍ}÷«.¢/™{m¢•J.ºP»9y]øºÑˆÙ«î+žŽ¬;bÍù äžt½ٴÙMñy”ó¢Ìjí;¨Ã…Kìz|îû"Û- Ãfõ—~É4˜W]Þaò6È]FœÒÞÒ}ãшؚŽsdÉûg~¥Ö{‰7XÅ©g_…“”ùM:Jk{ö?OÁ’‹8§`f¹Fg,¡ò˜Ñ†O!~ìšNgÄe­ÛxÚF`41¤Ïx2XG/3JŠ<éf¤Ø/e°ÚMˆÜÎt U¯÷ûW'éâ ÌO3BÍ5³™àÇÚ¤åÆj1·'†ÝúàFœqéÊɦ|˜1Ô8©?,úy´IìS ‰{=j¸ 8ªÐÚMpø‰¯u‘`îèåð°Å}¥UâpÙK•$ø,qu$¤oEå$>Ù®ýÔ5­5Ñôµn'–˜?bvéKŸ¹¥qh––3„žÇ/m¬…zãÉ>ë¤ H£¯lÑ̇hTF÷«Ü[` My­ò9Çò³é/–¼B3…hž¸“]| æŒdív÷†ÇÁøýl¥d–9$Kþ*þC†®Ö0c=ó;YÜ$átU(\žU³É9Ȭž#ö–È‚ä®D¬€à¼TKxŸ#ká>ÅyCáR¨:'Úz[¬ÀÉd¾˜3êSMM—"9$ø®ú©½NkYhOôùì®yþbdš£¥Ü“åÍë™oÚã†|„[%‹~Xº3íÙ'Y„x58RZrkvñ ÃÅ*֖?ނñܹm&¾œï‹ž! kë@åc ïžBQ´Ž±D’ýk|ã µƗz¿R¤8ø;$“×äAG;^â¥æf£³VîMNž¨tR=QҖ·P!*Çù”´Y٘³n®5/-ýY™2²ðN¡f'±o]'¯`Ót+yòêi½÷ýlÚ|Đ0AA[ÙÇWÅ¡oïöR½ ¶7ÿdwVêÆí§|.šû·vÄj7ãDA¸š t“†?ê‘øà ‰>¡Ç‘ß~ãÓÊúŸ™ï,ª;¥ÔK]ÞV¼¿íÈ+^DFVô+Î$¢m“­Ñ‘û˪ïL"‡Ô£(V¾w;éW#ðÕÙªQÈð@f;ÆLëûâõ0b¾-Xfs[úàiÁ©³æ… ±œÍ]ç›ß/鐰4•d9ÆL¶“îÞÅ?Ð}<ŽMëƒ(ýÖÚGdP"%8÷i]GULÊ¡dkvžA¶•ù?b¶Ãm³¥9£‰®n“ŽóÊ-ƒ*¾Çq`ƒ–m ‘Ž'ÑäyJ4%jÚDçÓ¼†ñøÕÖ$Ø öï|X¸¹I‘ýÙs7¦Ï+úçœÀtf£æc·XÑ® ƒr/Š±•ß ¦°Ž¡T^’ŽDý€fÖ°Ó²¥Õ=0Ã$¶™Š®3ÿVì.°¦…ké$Ët¶ºåk±……\¿ +G[v;²ÑYK©ËÎ`±dŒÉg‡—{5q£H­W̙þOLD)óYØû¶Î ¿¼ñsgJy¦ÿóæH Aä¶oG¥†- ®(q¨#6ÈáÛtX_Þd ¢öÂlÞ{ìtUx6~Xj=Ås{V™¥ÈµFV·<û¯±ª_^­ _ÕV7(Çu2EäG•¤Ùd(RÖ.®ºŸÀþH"åÕB!(±Â¥å£‰F¾Ÿ(1ñÿ[ëçM}Ïûƒ@¨¦•Æ›5}ýPð[z|ww”Èù~eÕ¾Ïͩؽiž¯¢#`Êu]וÝÅ·†Bÿé&â>&ÖÖ¤EJCûw±qîO0ô—‹K<åV;G L1Ѻ$º¾úŒ«ËÜ< ÓD>O©JMXÝê¶{'繯¯²H:/­ ƒõêPj·ÃVsäðÜè3_s$âš°±Š ƒ£éê(¯I$ð)aÂåȜ„cÀ¼Ë‹ÒintŽãªê+²½HjN‹"{H›z1nOz Òôã‹œäô׊Î$XŒæ˜˜±pý{¼N7·ß82Œmþ‚ÌXœ­ÝAFùw¥°ÕH ò¦ž-¹ ˆ(—×fº›ÝGÒyí¥œJå  +J>‡Æ?ù žø³0ˆËjÙ®U„Šãø9ˆ§ ÝÐÚùËúol1yքJ§›½æ‹WkµöµÞËà%z?F¤N¤¸>®mä¶_éևªö{A¤.§m¯™tÐeçÜ_4]”B_»Qêùƒˆ»`Œˆ=O²¢>Æ}·0QB˜Û_/—?ÿjÍ®±ƒ©=šÊÂؚ ÁòPÙF”yx)^Zï@Í´,æô‘,!>¤ÿL†Ä!òcw]þ˜•[G®zŠ7úfUçïªRX\7åÜBÛ}‹EgÔg·ï‚w‹ò±ýÌ;~#‚ÍÆÒð{ЏQ‰;6=ôᗝ™yé-µò®ît £É ¥Ÿ®²—°”rûÞt´þSkD”¡¬‡1ÿùýÇÈ'(Eœ¸×>¢™kq‚Jo×јÐŸëÈ÷•†mŠQï«Õ„‘R);Sæq‘|­ì-8<™›@qpO.ÃçY=õ9yoªû’ð¨[¶åQ¼ºÁm°™¯Ò=Èâ×û3’™B…‘"ã¥^^¥Z“ð&ö» ÜñN—q–Ç®Nn%Y¿^~â–ÆV .ڐ0Òë7ù}ÌXxÝñŠ» ^̤’6/çüý Æü§/Æ-úE¾q©Iq³0œHôåÌj‡/›ª¹hQTT7z”›ˆ™¹êéQšjªÇ¸‡*% \ä*&ŽX`úÕLڔ?(ûÀv T{E<ÿ¨áÇ2…ˆ¥ÜÅ2ЄQ@q,èžcš¯½Þ‡›GŒ±ãoZn®Á)4r…ub–ìn+l¥í®óÉ ð`pñÖaŒíÄ:øù”óÞ¼0‘èýªøš 9²š»ä-B©õ7T…(ÒÃÜ×w¼uÍ5ab2¤F¯²8®À8·8}ñ”C0“ع>“¸®R@%îTÿ6/tUËr¿0ßÒøˆŒ¨?ÚñˆûßKe¸R֔ ݹÑYÌ0¤¾~1ˆhn†ñòv§ÍòuûÁC»L¨Cï¦SÝÂñžç G +Øêý›ôvœ'ž—£™/ðÎ"ù³S1ï#‘ûM~™ß(™ó"‹q¤·ï;`6 \Š3ŒuÈüÎUWƒ†V(ɤ¾6 mød7u)Š¥¸–¨ZâaÉvIxÌoI¥ô™÷~ 2å]Ëì|.ñr­¼º+BS®Qw›ªÚ€{¶Û‚&: {®'µ òYÄé–è²|öÅ뉳ݬ}8|*̅ɂžª¨ún#ü e|Ô"™°E—Q!›¯ˆ\õ*Z'»üÆMé0°\+]; àœ_ibtèÉò<Í$°•'O?Ýe[`šÐÖVÐ/jÙe”.šÒ̄,|`$"ñgD'äоm-žWÀpÒ·^ˆý <÷ +’Æì3 +„KL KL~& oaK3®Òböø3fxtÂÞ;Ä% { ®õÄ €OjÝ7`ÙԞbèJ»’ã°H0]»´SJƒõÅ$W7sÿ®t ë– œ>ðèmBîSðb"~ðy*û¤±ö~“©þrëöþòeù€TaÏØ-ññ‘Ô Ø­÷ùæmÐQexo^îëƒpãdmàTø˶øF#'—^½(³1”Vzã#è4<‡RcLl~wŠ˜÷È—“XÔvEýÈYÐ59½Uä‰é‡¨•ÖEÛaŸžG·a“©_L鎟‰æDí=áÙò3D)©:”?FH‚&‘/¤‚Ó½ªÛ`ùO\‚º~W•!ÙzÓqÕ' °D²µ±À»”ißnë«Ù‘ŒÒxݘ© ÿ¹Çí®ð˜ 6yϬ¤$òŒÍ½Ôj9Ìv L¶nü\ÁTº%Ói’wÝÂ7ìÙۄR¥Sç¿3P(¢½Xþ¼„®sÑaí{h@! 2feق"ô`)¯M 3—îl?XgÑý„¥‹œ’^‚H&ºìÒ%Zd¸ƒª_, ¡6 +\C¥ûMªíY?é#é5Ïä +Š•<1zκU˅a¦R¡¬dc‡MQ”4ZÀÃ/óôg)½Œ©ÈÇ1¶˜a@‚?‹HG@ÿÔ¿JsJ7?€cXù±Ã¿»LÉMwB±³?÷Vˆt~€ž4öR/Ž¥Åäâò7ÆÃÊÚG o¯S= ¬‹­>Æ&žšÆ™˜¤ÚÚ¶1{úD0yÔNã 9®üsˆ6FÀgú%M(4CFaTù¾Sˆ Bª–Y°î< ½¡,+có®­)z½çÿQW¿9õ%ôÏ ¤Çêâ-)ó„€IåK_œ6óžåÇ3—P㶋ˆ±Ú§ÇéhÕ2²ZÃÆ êó0Ý}œ ‘(ö¥¥»Ð±£§-!Pðy ·^ÆÎýÝ|uä·ä¢Í÷Ú£õš:Æ|QFj‡rk'MIÇÏt(’ +6ag·ª,gɛôïG’6Þ2¾ÓÕÞȘÊ.Ÿ)óþ_O]‹DÈNØ­ï0ɓEyìDq°æˆÌz63”Ê]d6…(äԉ‚ 4Up"ü—§‹‰xÓCœ:oW'ÜÄ.l}ŒL_îb +KíÑTç՞sö]˜@ë·úyý„Tó½J”â`8Á j8Õ4¸ß2kCÄѿʼÎ0ìLP´liœwÈm!aï…ωqÜÝ¿Ü$7‰7j=&¼䅢ÑÁC+¾4¤T9gyÁt ô tŒ°öÒÉҚóx²`¸­w–ŒÑ9‘Bù”ÿJ 3Yø’N77ñ³Ç(%«dœ¦¤¿E°¶°Ì¨Øý©Ä=š f•.·.wlы-S¿×·sËËNÊ¡¿íÇv‡uüc\äÛõÔû›9“‘JÑ÷Ã%ˆ& ökuò<†ÏÎîú$lQúï±Iñ˜[ó>mƒW·ª5)ŽèÛj2q7ÉWð¢Á§øa݄ƒ kRañÆ9vvsÅd*ÜcÔ&oßk8UêØô¥f{͐Fip“s…±ÓL 4Ý@B—ƒâÎäLÉ‰ëVŠ¹Ò-¡#äM¾…\U[ËMVÉ¥”¬õ* ʼ3ã³(*?GÚ¥Ña?ÇÝe6ª½ð;”́Îpš ƒúŸž½¨´ÕÂáW¨Ïcõ¬¼«¨‡­Ùß >ƒà<§Kû£?u©¿C,G5~áS+óߪ´«ú­ãò  }ÿé}EH㍬ËÉÒtt̎îÚÅzџ=¯Ó`ïYÞùR.ý+ÏqánEòʽ%…®‘C|òÞ]@¡ÁÐà ­”Fпv¸° àt›ÍîügaÉJ{ŒèQÞ£qKcœ¶$ï!BtA%Ö]z0øžÙ½‚¦¯w±>™@ÔǤ;²Ú„åÿåøÿü"ÀÌÎèâæht±EDü¿=± +endstream +endobj +51 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-24 -250 1110 750] +/FontName/FIVCRW+CMMI8 +/ItalicAngle -14.04 +/StemV 78 +/FontFile 50 0 R +/Flags 68 +>> +endobj +50 0 obj +<< +/Filter[/FlateDecode] +/Length1 929 +/Length2 3545 +/Length3 533 +/Length 4216 +>> +stream +xÚíTyV=³TjÖ¼zeŕÜUéXÃ×w!ޞµ¼~ӗ[\~úÙ¾ÙËçEgd»{ò_º9«gÌʜ5N$oÏ#߂­ñ(>å۟°×tvòe]Ѿ5¾}0‚œ/ß^ºeʀ¸äor{/’Ÿ±©ˆzü‡)Õu+µ¸øÂÓ¨–Êûg« XžÐs´)GN¥,k:+Àñ¨ÁòÎ琉_—}¨^xtº%¦vUðÁE,ÆßæjèqŠ˜u#JÄÌL«1¿¦ k¾sëñê‚LóU7ž;×u\¯%¯ÐvúØÒ?t–YÔºb̙¾ÂÓ´›Žr {ËðI47æl|B͂v×®նwO˜lú|´ËŽõ†¯dQÄܼOcÎÔËæSϊ™‡ç&w„mæ²¢LÉϔnªÅ.óYt+U¾òN}®T +6M°¿Exm…4¾:°õ´qBä.ËJ¡jEåþ1Kw¦‚ÄߞäO~#*Çës*l—§¶^b[•ØæL_@R‡ s2O5TÁN 3¾ÔT¾“¹]PÕè}2æ)×…AÀw~l§Éè®nw‹ç"퐥cŽƒf|Ýjmº˜‚¿€Ôã{`I&FfÂ_Pm »h´áLéðMGue2ûé0ÇX4ÄclNIÒ¶8CøÍQD¬Ð×Ìrr¸`Ã@ö‹Zk¾¤WD5zgo%‡]÷¾¼˜Ù¶þã†D!>@“«,y-ÕÒwàv%¢ÿ½þ4ÿ1%µÙ…Ë×oê¤ 8Ë):¿ºŸ(Ö”myw$ ¹í}eA֋ÛÐ`i•º@’…ó±nª#/‡UȆ1®|?•âƘøA|>±GW•#¨´®7jµà»!À>֘ ¦˜:Ü»9’›Ð«(xçT=ûYÓïB±½o‹M÷ᤝÄsw±Ä²õݔ/ 2ÉzÃŽМ ^֎'1k€õ1úú×JXšOYç,_Ö*vÚÕSüd´E¶eN§â‰ Æ캷‹—ƆfZ°9 òsf ä÷ÌÜÃ:ãD7«Åõ¹Üo7~‡Ã©¢bƒh±\=O—Ä\½‚16 +?ℚLJamž½äNxDγ}«ÿÛHhÞ~+y…ÓÜÈ¡ºÙUÞ8áqzÍ-QBk6k]&݉ñXëki-¶ÕÒ§=žµOœC‰Y\ŸŸBE8ì*ujFñ) èÂÓVHx4náÓFÏJîÖgï§íçivÙ êôé‡% ù~æÇw«ª–ÊàËÔë‚ýÓ}Œ5ê"Âg¦(²[Ÿž4tt}WÔ-³$ú4xxêûÊ°ÎÙ&1¾’õ»—,8#19ËE†£°5FZ/Lȵ¡Èæª&W8³ÙÙ1fWÕ>YÈá§r7´û*ÞºÍÇÞÞ0Õ­Õg5†–ž -ëÞñØæÿæ¡C-Éîš0P~Ÿ¾KèªWͦE¸1sC³ßTD;r[e;>]žéí€Ñ¯Üz½ž¯ŽÕOº"Â>3]àkYáÏJߔ¡A9P|,‡Lõ°6ëmPÕ©1qE»ÜÈ)ÿàÀÚz$@±ñ<»V˜¥(‰ù*›6×CU ’Á&¹®¥%¯tXN§ 3µ/ûŽ]i½—°òõ§QjUœ…Ó흼o,|.+w=JÛ:ûa0xÉg¦¼ytSyô¤Ñ£k7Põ‰;·àVu¦ ÝMNX›¦Ü֔¸IQ|ÅÃÅ|3%ã–ð!"ËrÏP›—:×GÞ9iŽ­­e†qÉ ´¢(E:É.¶éwso—‡«<¤½OëËugRXÄîù¹÷–‰‚…vÊŽmÈX›4.ÒÃ;-03Mk"%®÷½¦ò¿ÂZöAV®¹ÚÚëC'Ä ’;zmY3LýøR.Ë­†N ½âž%¹êoª4škøhß+Ño#í$¹0~ÃRøñ3C—W8mòo.,S¦âeb >ï=9hãÃÈ܀ύ— +?=9n0>C9EýúMáùnshè¥ðܸ5â{ù‰i3Ã>•CÃېó;Ýyo¹áðx«ä± wÚÞ(¯†mºfn„Ð#øCªÉ„þ64‚ß²J63hÙäûȑÄT\LÑ*‚ûô= H«8‘j·~+~âÇSB>—+Dr¯v:¬—»€±2–WÀMøl“Ù¬¨©#ÃÔ#`Ó>×I=GïÈYsW\¥ÅwׄŒ“ {=^rXaïÛe<÷úN³ 4‰›iP:äåO>Y‡}Ã<’?{ê’ַאÙôҐÿ‹tX_ÅÙLqzµ‡ßi1)RBåYË=]¬þÀ(3nZ—V빀”•Ë¡{ÏÝ>ˆÕºý¹È£žë]ù'ù +5Õ6qË/)·f@‹žµÖ^™¿%©Ž(噘’ˆx-¿fº›Ú"ésUº}T¢œç¦]ÝÑ«vÅ~)¤+r&ÂýÈz•ØZ­½'÷Ë7:”› æËÔš$¬îê»}+-«H D[~=1O IO*´ðy{Û+ƒ¡ð“·Ÿ¢Ú-N8¯2PzB…&ëâUR„Þ;”;¯]Wzd\f¢yñ³ž&ÊçœJ£w¢r¬½Šn‹™ïa›”“Ì®<îµ@¾¨ä\‹eE4~pÏVλ”ÇÆ·.—ª,ÙRèý‚;ºñD]ìmŠÛøïb·Ù/yŠKÜÍÔ”5¸ +?)/„œo™WnU€v¼Dk + ”¡{IMÚ¬þ®[_lä‘ò곟/x¿‹4ó‚j‹­¡ê™?nmÙ5Ò_5v¿ÝÇ9^sÚKšÍ*w›ºyõy9£¸xeNt§ƒXŸ#š`”Tb¹GÂ8BÛßú¥ñãS]+VÙH±¬¥ÂÞÓu{©ìƒþðòÌ2w£€‡µv䖒,R?],ƊGˆFs¼1ïÜF0-ŸfE¬bL ™Ï Ì0•¯›ßæÕ6läß d£èÊÞ÷}:MºïC~)1H¸dœ±®÷)úšÿ)6ûd±ù™'Â?žTdCì2Ð$uYâq[éè•÷/üʙstĕ«¤ÄƬªNUŸæۊ£ „-æƎ¦Ó‘˜Î9<6¼P·¿wÃÜ>Ëzˆ ûáýM‹OgŒêìRéLûC¨HL£âà²þìºÿ5°ÒÀ™e[hp‡öÌD¿[óÁÐä·ÅNüûÔÎÂy>ÎRâLFQÖÀuš6ªÞKÒëÖ;½¥°>Þ ÊK¯©•^Tˆ#ÿªñjQü¡Àe‹óý4'B¢3?ü†w_ÜW­ºlŽBñ‹:õðÞÒütö N¶CØ®,ëk#ÑfnpaÈL_0Ó8u#Xzo‡àQ¹+æ¡_‡ê0ߪ–."ˆpÜézq}՟Å!rZpŒ•Ö™nHBÔ§ºðœ±ŸŸ~<$8K©l¤(áBÞ0o›'òšêT ¹®Í#×°ñ9õ>1à}–à³°ï!Þq¥çú¸­êŸe©´“î)¢ïusK-ufzdâ*©!ó'XНzqÓʜæË{Ænç‹cŽ©‹7ÄZ#Ï$&˜Û„'çjÔ¼{þqISa¢QB«É°}.½*'~ìD”Xúœ„ö àˆ/ö÷ÄÍ|ŠçlY;e`Éj˜xô¤6öꚥ/ZC—wèJ³£•„Åckºþg2ޟ™øEC(ßQá#B;<—¿ž—ìæ ¸[œ5{9s‡yG3f恲ªÃË´¡f¦gԙUßøMŒXÒ‡¾&|ÿ’*Öó£[γ«€x…;w›ßz¤Õc¿-ѕQdßuÅqÝ3=õ®ã—8ÇÔc‚_Ý¿Aj<ٕ)ò‡ñµF§²¡ÜÃc§ËZñºÉ.ô៎O¼×«• 9M3Q¦/Â'ô2é=¥ ÿC3[ y£’Ç£¿îӰڔ'BI 7N(#ˆóiºqÜéAŠõ“3Ï"Òê ³”© =H Lu>¨ºË•d¢²Zë÷(zd"U°ï¹U ´©…0úRv²ð—Z("ùwküÃí¹^yóqí F„^åÞËáÒŒyµÛr¯¡Èš +ÝF-^»y&tpâ¯wpïaÑ1v,9©•.ö…søMdMPÓ»FûÔõÊ(lð¬€md¶ÀÿJeªhrâ<«ÔޒõªýÌoúû„©ÔRغk›öé²*-Š;x\Ÿu Ôª{\Ÿd'E°,o|Âà7ç/êˆÈVÌ>Läq§:.MR•~\–¤Ú)ݞѫÿÝNg»ž˜Ñÿq2I?41]^$Ç£Gf.mRíq*'P> +endobj +57 0 obj +<< +/Filter[/FlateDecode] +/Length1 904 +/Length2 1478 +/Length3 533 +/Length 2126 +>> +stream +xÚíR{<”ù–"MT4²Rù‘û\Ì`ŒjÝM†,‘û6fÞáÝÞyÇÜìŒk+Ñ**º¬ˆ³”¨S¡J–ÔJ%É¢”DÊý®(œ‘ÓöÙöüs>ç¿ó9ïûÏû}žçûüž÷ûýééxx™Ú²y!™͈ÖÀÞÍËÏ +Í=={ÄÁ<ԁ)‚¬‘J%[q( RÁҚD²&0=`Ï — +àÐ00°7œWY[.$€YL¸1EaWfÂb"À‹Ç‚!‘Ô [žó-Bà !AÄ6Ã`ˆDÀ†Y"…Â(?Ÿ‰ŽrxÀrf‹Ã?Q@(Ë d9 ,%›‡"RÀ†8¼;Ov$ËòÇú7©¾4w#ˆ;“;o??§¿ÐL.ŒHÿ%àqÃÅ"HÜxlH€~)Ý -dsƒØ°˜û%K1˜e‹†"0%’Íæ”:Áˆí‹Xa€ÃD„ÐGBÙ_F‘Mïc<Éîâím¼°Ø҃ £¢Òp>«?ÖÄϵlHXfQ&”½Ÿ¾‚¾8ÌeñØ0 +H À˜R AfE¢P@À(’H"KŒ7Cy"Y &pxÌüV‰D€ç¨X8/@Væ@B!ÄËvô&|èüµ„fÌezÙɼïvþ &[|¸–Íá„ +ð0ʁQX$ý¤B .„.´þu–vv?þMR'Í×6'=µÏwéL¿æ„ ör[–”<Ô­§Ø›vì@Ûš©°­ùÕC/¢›|¹:ËÔ=·{¿vúíÓÖ.eF‡a_8GòÀJÎj0¤ÜK!»„°®Bç÷$òý’Õ{+ZÞòƒò‚G Þõ´N5kŽöZ|˜Qt¯j86(Ç:çSuõk·œ˜ñµÜW}ÎÓ@S f¯1%LGÞ:Xu=®oè­wrA¹¥k´ýŒoÒ ü«`6cj‡ÓžÃÄu¬ù.Ê.xoŸՙÔÕ6¼ª%•qS½/$_”H»mJ5Whn¸«št°©gÒ´ ¸åURÔbǖRÿSµNèoÝû§ÊoZ¥®c6ÎhRzŒ”§Z4'ÕØÕÒõ 3‹t\Ÿ>«==Ùq(µŽÔ‘/gñl«Ó¹ai¯Ë䨞<ã>7äMÖ/ä}âқ.ú#:·Ÿ}pž4 ¹i>ž<í“r[Nµ°Ør5M|ïfâ–HÒl_8˺>Âî\ùš..µj.>¢ÃQ>¹Â®i™KLˆ{Ög9 }Å¢ ±‘ÌŽÐ÷£œ‹~Úïø\h³§Rò°}ãŒK~Wì‡8ì‡\ÿèåùNÍÔu'4ÎδLga–óù¬ÍɤùÞKèí®n×Ö0­ò€F“Ç&^cO{“o´Ö*1²Ú·¤>±5åÁÍè7f¥ÍÅ°½Á¶b÷•lW¯Z¥e÷8Q}ÝéRd]€n«ºP¨\îtûÐ,Š ÄY>Rê/×5Rä]áNWzY_Û;SöÞ´ÜÑ÷̒¬X!·§ +)Ûّ‚ 8¬ ¯?ï/jh©8û%ô¼üۓõ?“É3©KÍ=±%|Ã×Åú<ðkdškv~ŽüDÊY©¾TqK5mõÚ,%~a1ZPÕ»£aìf{ºh´Œ¯Æ˜ÕéÜû¹{y%¬Fã¥vãñ±+Ôâ¦=S×lCç²³ã·k«ÍÓ©$‡¼ÄÛ\ẩt¢¥µxC{³œá×[å¿?:W…Ó|ÎʹȍЉ&#-Ò#ì«%ŒÂ¨‘Œž°e{·¶ÑUÛ¹gÞŸ ¼óÐÃ8õÙ§þ€Òãà÷Znùۆ¼REîÉuÝÁèÞñé—ú£*¯TºÊHòØʆ¬§ï™ Îm?œ»)RÛU¡•u×v©hàMìd͜èфÊvÇh^ê+cîÜì™YóšÇoK 5~‚¢Ì;B°Ó4»ß+këä9Á‚o'cTפØürÁãä`çl‚á¿|0ÿ7øŸ0`!S âq™‚ÝÌ?Þàh +endstream +endobj +61 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-36 -250 1070 750] +/FontName/DLLZPJ+CMR8 +/ItalicAngle 0 +/StemV 76 +/FontFile 60 0 R +/Flags 4 +>> +endobj +60 0 obj +<< +/Filter[/FlateDecode] +/Length1 712 +/Length2 2085 +/Length3 533 +/Length 2619 +>> +stream +xÚí’y<”íÇÑ Þ(YâA¼–w“u”eìɾfmÌ<Ƙ1b*¦Tö-IdiMeM£d/dɚ„JS…z%Žê¼ïùœÞóÏùœÿÎç<Ï?Ïuý~ÏïþÞ×}«(:º@MqÔВJ¡Cµ`Z(ÀÌÎYЂ! **f4C'P)æ:ˆ´ ´Óp<€DZº¨}(m¢˜QC4>ˆ¨™©sé¦dFÀb(€†’7C°àBÅ@:¦$àüí—0À iGA ÑÒp,ñ +þ ɆHô~´qá!HGAZØ& ¶É©lRâ¨À¸=us5p“å?Æú7T?‡[†“Höò·øÍ1ýEŐ $Æ?t*9$œÒ;*¤Q~¶z€?Ðì@!œü³jCǐXS +žˆ-B˜%!Ä9èØ C +¿÷A +îgˆÍ±}G€›:äåxPóûþÐ1 +ݕògê7ó÷ZëŸõæph„HÀC ´6›ï_¾?­eAÁRq +p¡c(8 ÷gã¯Lh45ò8tŸ.Eêl^ „ÐÓADý«ÑB mÌ¡gðƒ +N£ú÷K°¹ß?ê@Âæt@0ÄBróvxýÛ£¹xd¡yHÉ£¶ç©#¤¡øC¶ÎkW_ǜ0I6w–è¸0"º2ã˜|qYMÁ8þV´azó’_ ƒ!Súb—Fà£zïñETYÊt@¢Ú‹ÞôL¾çï}[“¥sÜO@llÇ¢‡4~jS”¾³:ÔÝ8Š+õÒlì¹ý&ñm +;da›¡™ï¿T¹•Òk†ó’ØͨDJD‘cö]wûlucr¬ƒ<«ŠªYÝ0مñ"֔µõ~Ã>ß7'ÚT!¨¬¥!ì«ÞñÕf;¥÷ð+s¶ú3S;ŸLüPfH+Ã>8—Dñ¤,¢EíëÛm¦Ÿ-fu½ó¹Ñ°×=‘wðÞò6:0ÙªÜ*yûE/¹(e ã’{ä«þñù€B]YêýD,I;tÕsëe¡n!ÊíjV2(¶ ‡6L¢îçrnóɽ÷«^Ço+·+x2̍n¶èÛ+U:šuñ•rçÛÂäÆٖmL壨G±=Ã=ú2SöÖ6~í+Î#ÌĔGûcÂ-sƒxâ‚-¢£ä½ßáÛou—èɹQ3kÍù¢2È“ÚKÙ°L—Ó…²‘êîí[ÂœAžªy¨Æ‘²—ÐB[©¿9ùáêd5E8{~*·GuÞy–:6{ð¤HbYÇ°Ÿu×[E½W>[ðLßà˜ËÑù¯L÷§0Ÿ#^²‘Ù5&r¿•Êð*]é`ß|•%8ß6Ÿqž•›sØ ãtc‚€¤sBŒþ݈çو ³ÝW²«[¯í<]YÄ=•µ_ /Ýà®À¯ªVÊãUeo?ïð4Ÿ¢ž—(q1zM|du*ð¥ߝTÊýiŒø"rkŸÜz‘´‡,ŸÙ^[ä´~K> Ò°Ï*ù@[n¶†µ¢al¼ïüΡÏ7#øMÒ¥ú÷°<=s¦Ûê.’ˆ¨ )=ÕØ[õ…)¢ÐÝ*.¥ã>«Ó’ï]ïxÇ­ûFúΚö½ßI +N‚½W~¯Xucdš)Z¶÷´ )Ԓèû…;dÅ\Í1 ¾^5†¶Y{*±CAí/=ö ‚'° +*zèqz´ˆs.Œt—9r‚p=Ñøéó*«jmƒ× Ž(ÝH^Ê)C'ž‰u3Ùé6™5Ï²áAlïQµ#góO:Wà™É_ôж7›Oôñ¶Y ª<ÌZ{Çã|¿¢^”ãp·­p»9ì¥ù‘Í9û€'_¿Šá³¸ë•pݖ¢o +Džé…GZ;×h£Œà"¼FM˜˜}nô™/oÑãÈo/i‚Ç튑O!›tÊ:Å¥yl|~ðLßÕ¦³¾±6'­Ëv‚C«û'S§²Ÿ*ëwQä˜ÝB\z”@Nõ +ƒ Dgêg„NÕT`¶v—ðcÛôÊq¿¼»Å¯SñJR;gçR!–„º¤¨ö ‘!®ýE qï¹ú„Ž%lZ 2Dmnú€‚`×kÛ4íã2(ù aüêú‹«S1»òËâË_X±rž I¯n)A^÷ÂӔ kì&Õ£5Cj.Å)á0.?K¬<+ŽŸ6DÍ +åß=ìlx Œï¥ÈРÂQ +ãÕ7Š:<–o¾â‘YY1ÇBx +*ƒ ÷ß_‹}6¥ôZ¡õÂA0_YíÚþ¥9m}ÎL^yÏ 1Ó·‰gZÒÄ.E²/om.õ]éÆ綛!ýÅuØ%¬zêÒn!‡Èí#3óÆ8y½8¢¦÷Cé›Êl7áíZÂå¡íõÞÌ^åwYš!!÷²×MÇL¸¡Ç¹¿÷¡sЧäOÖ5›ˆÎ6'Û-œºgþG"­qýuœï9‘]gª8û‰pl¸zÏÜÁ…®Ôð¹û®™N“»Ç]Mx´z; Jٕ¥ÊÜm]0S Uïhsj¼‘©D^³‹ZHGÔà!-+÷؂líS¦Š~¥2ÚV¶ÝÑ­ÃÓóˆø€L¥nÝ°WˆVÿàrÒs¥“,<ÿØH‰#®½ûr´nisÃôœšø,ºªåmÔ5ÕA¿\dƒ»MŒÒZ`°É?€Ìi”ÍlÒù –ñiçî«¿N^Õ8n¹¬åìUÉíṏo‹|Œg$hK‡ùbÕKF’ISæ|tº{‚¼&> +endobj +93 0 obj +<< +/Filter[/FlateDecode] +/Length1 921 +/Length2 1989 +/Length3 534 +/Length 2624 +>> +stream +xÚíRi<”{î0T#"Ôä©8a,3“=’}‰IJ†B³<3F3ó0 &Y*ŽÝ¡ì*ÊR"Ž%IÖc+e=´0$[QÂ¢ä:k½_Þßûíý½Ïóå¹ï뺯ÿõ\÷_i§ÃuD-![­6Ìì-ph€Ö@¡àJJfLϦB s<4ÐúúÀ–C0{ ڃ1Ð҃Õ3țˤR<ـ²™Ê +K0¡ƒL*ÏìñlO.!âiÀˆHÙ\ 0¡ÑǕà²@¦/HҀÃÑh€D%²H¡2àš+®ldÐýÒ&q¼ÿ€|A&Kà P^1ªl’  @2\ Žfþc_ÿÆÖ×â– ‹§¯È¯Fõ Ž§SiÜßݛÙ€=D™Œ¯©Îàsö ‰Ê¡Ú°ñ4*фA¡êK‹Ê²¤úƒ$*›è ñ4¸Ú¤¯M’[µ yÄÖÊÕ +ùûZ¿ x*ƒ}”ëý§î +}µFÿU bRýã(AÀhQðþñåöÕi "D¢2(F[À3™x.\pƒ•6€¨ è€þ˚ ˆ-©dˆ _Y© +Ðdqèô՛ÆýÙ+ðh +¬‚&žöO@ïo#$*˛†çþ ê£þšúÓ4ieeëxéTûObþü6]SSÈ?@£¨côu«¥­èêbÿÉtbP}8 9 B¡tuµV»D“ 2Ø«WZ°º?j2U°hô‰ð-î¹}Óg¨aêuqqk4Â'~Q]ʇ֛''9ŝžÔŠÕmkeE»Âö4ܳUµÖ.Ôõ·kLº6¦WÞ§®ÿÝØiÄØü즲~¾©M§ªdã9UÕæ+3Bù•È¾CsßϪ÷£;kS¬ç²Š2üËàuØ8äƒܼÝàlÚh{žæBÓGV½ š|¾GšèSæðýÚý!ŽÆ.Ùâr™‡?яِM…  ïêõÅ*RÖ.¿|¬ «mº³aç;Nmi¥$iȞ¤>Q7ìÞöd3!1ÿR±˜ŒJu ýÄ]Ú ÔyÉÙc7ÿ–h֘;ú8B_Q¢6–ÎzêŸ9ƒË:m8cœCۅ:­©ëÎ÷Aoø$Ñ»]^&°Æã½d |Žñ`8¦ «ž¿<áQbe ãU$ë›cbkvhWC‰‹B8·xQtgÓ§ Gù6‰d¤ÂšébóŽS±ç—›ú]‹¯VOK•O—Ûj]u"àj~θG*Õ ýöÔ@$3èV»Æ¼ùäச…ÖË°Œ÷žÚ¯ü‘~`KÆ`¨|êÌ2¿óâќÁå¼È¡d„ŒŸbBkqMðòéµ¤–¸$ìx“S®'×å\Fc™\é–À©e²ZªyXsjýÉôZìMɑ­Õs¬éjëÂWJŒÛšÊ~ÞԜ½`¡Ž}nù(a€R¡Ø;ó Gèc¦D±ý՘1üúà¤^3Ý£”·RÍqîÍƄÊý j­NÅæu˜Ê€¨Éٙóêñ…ÅUíÊâ7—‹––éîËߓ3 +)ÓDNŽvmÝR¥flÄ*×Å𤗃öç?sõúXkG¹I?‚8Eo«¼è<²Qçé¼ÆÎÎYã!£Ì¥Íóù"¨%7شڛaĕ}~¡ŸÊ Ó|º•ÐAöôâÝR­IÍ4ÈÙÒusØEþæH™Dàùë¢ëÞMKc$ +k»¶d¼¦½•I|‡ª{s(äi·²‘¢yŠ‡¡Ðºò¬Ä¯'¸×½°¤ÍĈ‰D½X›¬q  Ê/Œñôþ)úiHE W‡Ô6§KuiWRg弬0bM’C-mi°°v­ŠôΖ™k·1àɝìÝÇ[:ãÆ`Þþb±_/óxŸ6A;Œ +^ì|gP߂šÞýÊTM€®–fD]F^—˜|5Ô»×fS7j§#Âö¶š×KŸzTÉ|WqêqCÿ𚾠Â‰»6/\iÎ áxøº àðŒˆ2vZŒLlóBžVЀSî ØQ’$œ*²·èŽvžÖÈÑøi͉Ço}c£æ¡–Âä·6"ë²cP^å‹¦¢­ˆØjWuc¡-7Ôð¾Ižè²¶8¶‚Aåz—GáÜÜЯª±üþ%§‡»™0lVøxq‘æÇÞ'Þê^`ãeQ@vŠœWøU[÷CÕQ5»îŠ5[ÉÖΌ"¿×l·? Ó¾~RsâJÖg׸‹Üs’î’¡)±·UXÏý®óƸøË¢çZKܧ¸-oÝmÞ¸GìFô[d°P[ólÙæá4ߓÃYÆ +Kä{¸awbGªªÃ^fžP_äÙÀ »­›×lm4_¿ôŒ¸>j=¨ró˜¯øô çlÕuã(»Qçæ„×,yÑ)Šm„vÉÁφŽ’ÍÈÊ#^22Û`gð[%OM(¾Ô 7eâ‹Ö† 4d"/µ‘>óa6ÌÚ¦¸¹5éù·f~Èqñ¬‡£™@éxç\Ÿ“Û½Z¯€‡½¹Â©JŒò‘ñ›6MiìØCÊu«‰ÎiŒNÜíÔ ‡9™§eÿ¶äÀ›ã”ÿ(3ӚóxV:ý{õ挅 nœ+ð¹¿-_JÌð9VyÀU„x]¬³¸Ï †ÍÜj–Ï—¼»Ž¦ß¥øÎê ;W¹»mûQ‰£3É[h&ˆöâûÛÜpéòÐpâLôx|ŸFލH '´t°ôýî1…¹VÒÚ ~o À5j}P3oõ£èmcU¦ZqÒéˆ{S¼—É>>¦Í–´ÂsfxZsmÕÇÊÞÞù4Ô#8S*¹Êkï·Yðú04¿Ã†Mž»³ÎòÅ`ëÍmAγÈ+Q»ºSXÓÚUPℴn‘ñr¥Ú%ý}¯É¯XRõ„¥8 +ïæ€v˾ªaÉ©¬ì}Q> +endobj +116 0 obj +<< +/Filter[/FlateDecode] +/Length1 786 +/Length2 1526 +/Length3 533 +/Length 2113 +>> +stream +xÚíR{8”i^‡d'js)½Îª5ŒaúŒsŒ4Z¼Í¼x™S¯͐ó1D(‡$ÅV”)[!£ƒ²v“´E±9Ô& ÙÁ×µ××~ÿ|×÷ß^û¾ÿ<÷ïw?÷ï~îçÑÕt÷4´¡³÷ClׇÆ[2ÙÙ/±X”®®-\˜Í²¹À™››Ûy ÀÈÀˆxc"Þ…ÒlÙrÛ͋,`Ę²2È „˜bÈ<Ù4â +Ð`Ã`”Å-! +PˆŽF¡p8€Ó¸À~(f¡0‹®œYþl€°\¦ó8_Z¡"ö,9Ý ˆ}ÒÙ,† Cþ(Œ[<»ùŸý__‹;ð 7¹(¿˜Õ_Ú fþM`39<.„d6BX_S©Ð²72D‡y̯»Î\ÓlX 0ę ±&Ëu8ÄæCtw˜K üAF´T‡Xô¯ˆã[òqöpw§ºm]¾Ûå¦;³¸^`ÿd/aܟXœó_,‹Å‰‰âÿËjÏWÃìY46fFxSDP€ÂŠ¥Œðx À,:Ä ¾Ø1ÍbsÅ[q2€?A-^+K0Á‹µeˆÃÖüë™H$6?\üT ðâF&8€€ÇFü'ϛàAÎvkF06[>‡ ‹»ô–Äq}Áþ°8aâC4T´‰ ö¢9©;Ÿ——wÂmDöÆÉo=ƒVpbåÌã6^ӟ̢jñ9úïí8¢x½ïMåž=}fJõ$Rk×Mcêkçjˆt¼„—Í|+áRïöÖÙI´uë[eQumx”²Y†ÖC0oâU`]Ñ£«v¬—¥ýú]mÊ: fnSSÙ1 }¶ï:ä2®¤‡UIø$WʗϷ¯QIsPöT +ªÖ¯ëîSðt9Í¿dŗVÊ^h¦byY»Ÿ«aÖÎ%`ç:_H¥ƒ˜Uý³—-<_ êcqn’׶klfnHØlÌÒíë®îšy,“|½ xmv½ÒñèÈ0€±H›‡ºå Ž’Ò§¥^ˆ¨ZwÊ6 L‡r¢­—<7¹E¶¥r¦úYÜwf¾‰‰F2z¨¿SëµQŒ«ùTdíÝÓ‰>”;F&îü<•3u4Xm L—ì^—nÙ¤¼ñÓíLL0óBC>7‰iž3¡* ®•¿²OùÅëñڒÞUTzƒÕïRD.þo-‚'0U¹„T][×5€§â›ŸÊ(“é—ñu¹~Ù »•+Há¤cCÖH3î¹:Áñ†«ÞyjÓ™oTòZÎb­¼t\r",TÇF?ø^³tżÚ뢮Ü(<’½Š”ÓºFöfŸ‚½Fz‘¬WÓÕ£gXú•êVöeÓè…ÔKcZ¤þ¬0p`0'æW×÷èy ë”ß'_Õ<Åd½Ôb™2øðpû5QBoùÙ]ۇ#º¯’SLO<‘¡G¥,$+uõ¶5lwÂg¦{àÞ½ýæ\;9Ê¡L“çú Nf¢œü/üC? ŽtÞznèðƒ¬íLñÔYѐ]͉DÓ!…{u:<´ Ú|~:Ôï¶s¡Þ}ßÜ|Þxäsµœl抲DïøúñjQÓ¨wÈ3õrI{€cè7Pò:”k2âìR ÌÔøä~+?³æ©;ªIߖzK¯t‰õÐyRx¼³ƒ¥ìs´{¯<û˜“áÖʖz¤l°x™Ö\:Éhj¬–É߅”Õ³©4–ß:×Ï:Ÿ.>"fp؇c­ŸQ(;Ç6Ô ˜°ðEé½$=žœµ½¡Y‹ºÇÒQsÚú³ ©ð˜Ì¤mĨhú‘¸Í5'sæÉs¯§k'ùP¿9>¿KF-£®Õ¢h¶Ì*f&~›å˜ÂSRÎXù0M1?ëúøÅ\MÛÄÎ+6óYÏÛ(³ÇD Jc°È‹‡åœ¸¦äÜ*h‚¯ÕŸàmïù46ëÐiF©âX¶ªßc|^O˜–fR±Ç0õ]¡Áǃ°\Qpù˜‡ò«ýlò$>ݨ^Ô­³?t–¤,\m~Ì›Qulã|[˜ÃNëDŽ¹²r6…{«ÔötP0+øfè÷‡Ÿxûve±Sfßûɗõ½©R°÷cî2 *õ/p iÛOy%ºµ·¨Ó¿ tOIÀHèNɵþ.§ªî«2‡Û¨êÊÂ7 +g™±—¯W¤ nØ5ÑJÜ룸`_–ŒjElg…tÍÑ£ð] +ùC&fRµ^÷š7ٗ¨„~ŽÏ¶œÜ³¡¶ãfa³ö©º}˜ÝHû€•º³~kw¶ÞÈz0å4…ü\Áˆ‘²\™Tè™s|úö jй"þÁeÌ wð÷ã§`\F¦|YX¦¶6Ôä†û@Ï«k^ôg(›î»%içßJWàô¿C~÷l¥vÖþ|û½ä™ Ó*ëY\ ûî­e²ó4#¶@¯ns¶£›¥¬¦öÿüPÿü-h D¸l&ˆ£PßrO +endstream +endobj +120 0 obj +<< +/Type/FontDescriptor +/CapHeight 850 +/Ascent 850 +/Descent -200 +/FontBBox[-20 -250 1193 750] +/FontName/WLWYLA+CMR6 +/ItalicAngle 0 +/StemV 83 +/FontFile 119 0 R +/Flags 4 +>> +endobj +119 0 obj +<< +/Filter[/FlateDecode] +/Length1 712 +/Length2 1468 +/Length3 533 +/Length 1999 +>> +stream +xÚí’{<”ùÇC¨Ùl4®Yëa—d3îF§ŒÉ`åe0˜y0Ì<3Í%„áTÖÝ*צu©†R¬Êes©»Y…•R ¹Öý’Rq&ö¼N{þÙ×þw^çyþy¾ŸïçùüÞÏ÷ùji¸¸éc) π8úh$à]M4ÓÒ±@‡Ê€’8 @[X ,70DhSŒ‘eƒi83œE â:¸½\f–²¨d8’8A ]B&Ñ7™ +r‘€¥Ñׯ°W ²N€$ †F*™øƒTfðÉ +`fe +—ù©ud±E\€Žˆs/ ¢¤0 Z8@`N Ñi ˆåOcýªÏÃñ\͉Dÿ/Óº$:•þ¯>ƒÎär@àÈ €,ès+üˆæR¨\úç]{‰F%c¡@ >JT6žR\¨r@¢±ÁM„(ŸCˆÆ¶‰`@8Dð<„ElþЏ=â gþžúÁ¼Y£ÿ]‹†Ã¢†D…B‹Œ¢ûÓÓ±ÏβÈ + +Ü8$ˆBbQ~þÈdmÍ‹Ð펾¡‰hÐF€™ *ê?G!êq.h0A¡Pfæ›*™Ëbgs Dßû© Š¦‚a váGª˜¯žbÅo¹¾O“PóË#؝™“WŠÚæ¿ I"ûƒãbC\–ˬý撜ýZGý@üMž£eZý+Ÿûáá»Kž)êtÖGV0¥)úÝðJ/qƒ{³`rµ/±Q`á#¹óù"¥€Ã¼»Ð¬¡Rõ¶¯•w÷ ¥Ä q·ýqùhâXí ¹Ï&Ôá"×÷Õ )¨ Gñ‚+‡ß0„GÑOÅ®]²Ò?Ý[aäqKPY Dª. +&ììöY>86Ù¬ ÃdE–0¯\&ÆWâTÔ¶~S!å}·7.=9d¦Ô’UJn<›yJ6<§:ÀABý@KÃߢ®ì9™Q#–z>§üy|Œ\a`Ÿ°´3-)ÓÍrà _ž~|Št;ã\˜<Û¶=dÉ[±ðÎáZ™;Ú|·ãðc¦AÇ^„uˆá«ª÷ŸwÿÙ1=×ɤr‚e>èÜޔ÷ÝñëS¨!·Ù·•€\(ó“ÅJÌÑìچÔrø.1+Ôòâür~^rô¢øwF±®©ÎSW&qdôÀØôš«ó.ž¯0,5tÜ/Ç(øQô¨°c^ːÕ÷"ü{‡åŸ;ùž}„Çur·‡Ä5~k@f:¨ã¡Òӂ¶ f:¹®xëVÙB}O¤ñ¬•ç³vN_ý÷k`&ü’ƒjl£ÆÅ8¢ÿÃÛy„ËA†ª1¸ÂCfÙ~Ü#Ä|)]e@˜¶ÝW8~yÛ„EŽ§Ý”)”˜qG +d¿ËŒpùò¶÷84ç wqîûòà…Ù¶ÊdãÅ×ïÎD,u½T`°•¤úV%$¨Œ‡ç½ƒRÖýîC¹ŒŸœçSzÐì{˵r«g··G=“L8¹º}J…Ÿön6y´õrQYi¶Þq¤÷íÕ%ë¬bbê×)/Ù”öøA/vRžä^“@iŽ7éH„¶¾“ìWR-c©¸‘‚7 +՚͉¼Ò®M úsB­÷òû:¦áçT¯ ŒÄ¢hYsê ‹’Ͷ§|8=º_Šç“.á\{òÈuŽÚ]vâʒÐ\®¿ïW«3ö6Jâû&»Ê˜]åe…œ¶Ú¤ÐÓÙÒºðêîýxóK͂)¨S8³u—¾ú†{ÝàÃ[BŸâøSC¯ÅÆÁû§åÇ%žÞ,´l)nóx´:ø…[Çlú·ô¹f¯m-&í=½1Ãüu‡ýï_jr…»s^]67j}š#“·çXí@¨’œ ²©©mÔx~à'³¥æºibG6ôà‹à¢fNán¯tTVHlÑÁ¥©+SÄhœZcÕRÕó°DcUÛõôŠ2uI?¥S“ú52¶ÒaѾÆÜ.n¹Sw8¬]z‡ü #ÖÌ|Ä®Bm`úY„iêÞ=y†wy3m2ÒÅh¯á0Ü=(Nsçyÿ“ÎK:EZâ.êìÞ#¬ê_z<å'O¨4¥rT$ðU¡ÚGO½q²†’Vµ1+ +´âŽ˜‡ ¬Âèø +d‘¤{ÿWfE˜Dß ¾Î¡¥_‰_ÉȾmƒ¾Í;[i+¾æáÁ[ݲªÜµÖ÷v•«”½*£wåj”™é‹.ùaÏg<+»ÒN®*Ê5æry¾ÃÏ5çζ- ×ù!ãM‰ÅÝNÃlw½FÐÊ0?Nöš¢{]țy$$ùûëæ·´Ögk¨¼)̀_±êæ*¦ÏÀlˆ*>›ûã¶Ãp>¡sW »"ê­Èí0…¿·1óò|“•EX÷îî"Ⱥ Æü¿‹ ØޙÆn,ÅJ+i‰“ã#Ï;íÛ}'!¸/çÌ>˵)ØJQ_ñšch†ÍLÇzG÷Dí2¥!/¯Ð)àü‚ÄévxÖaîëºvUïœÍ !d×ëkýC§ïJåD$´f¦+.á•Nßí^ǚçùÝV7¹:-ëIZçî=Û'·éÖ#MšÛSn¶n(ÎÆD?Þï9gônÁœÌ_¤¹©£þâûÀÿD™’XÄ +Áþ ç)û +endstream +endobj +192 0 obj +<< +/Filter[/FlateDecode] +/Length 270 +>> +stream +xÚUÌ¿JÄ@ðØn#–V™póçrYR-œŠ¦´º8ÅÊ"¢  .–VÁ'¸g¹*¥¯àÁv—kXvÜÙ`á ü†¯˜Oä9ÏsHyšÂ,åYGÓ)«œÏ+(…àó\gÐ@Y漐ú©àeñÿcuÇ5K–P,9‡B°¤¾€‡ûÇ–,.!óyŠõ DÚ(šì­ÂomœÄ/= D£­ŠIÙ;2þ!÷{ò̐·¹²dc•÷ÉIï ƤZ{_eÚ:rݓíŽì ÙäÎ6^ãÈÁe^«¼N}ò͋ñ†l·ä'}aèÄ~$Mp AûLºŠÄÉÃà»$âFÞ­Žöþ4ýŒšÖìêJãõŽ +endstream +endobj +193 0 obj +<< +/x4e 192 0 R +>> +endobj +84 0 obj +<< +/Type/Font +/Name/F13 +/Subtype/Type3 +/FirstChar 0 +/LastChar 127 +/Widths[826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 +826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 +826.4 826.4 826.4 944.46 944.46 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 826.4 +826.4 826.4 826.4 531.26 295.14 236.11 413.2 649.31 767.37 649.31 767.37 826.4 826.4 +826.4 826.4 1062.52 1062.52 1062.52 1062.52 1062.52 1062.52 826.4 826.4 590.29 722.22 +666.66 722.22 722.22 666.66 611.11 777.77 777.77 388.89 500 777.77 666.66 944.44 +722.22 777.77 611.11 777.77 722.22 555.55 666.66 722.22 722.22 1000 722.22 722.22 +666.66 2006.97 2479.2 2006.97 2479.2 0 590.29 678.83 0 0 0 0 767.37 590.29 826.4 +708.34 472.23 708.34 826.4 826.4 826.4 826.4 236.11 413.2 826.4 826.4 826.4 826.4 +826.4 826.4 1062.52 1062.52 826.4 708.34 555.55 576.4 576.4 456.6] +/FontBBox[-247.9 -763.6 2726.9 1118.8] +/FontMatrix[0.001 0 0 0.001 0 0] +/Encoding 83 0 R +/CharProcs 193 0 R +>> +endobj +1 0 obj +<< +/Creator( TeX output 2007.11.02:1122) +/Producer(dvipdfm 0.13.2, Copyright \251 1998, by Mark A. Wicks) +/CreationDate(D:20071102112308+01'00') +>> +endobj +5 0 obj +<< +/Type/Page +/Resources 6 0 R +/Contents[32 0 R 4 0 R 33 0 R 34 0 R] +/Parent 195 0 R +>> +endobj +36 0 obj +<< +/Type/Page +/Resources 37 0 R +/Contents[32 0 R 4 0 R 42 0 R 34 0 R] +/Parent 195 0 R +>> +endobj +195 0 obj +<< +/Type/Pages +/Count 2 +/Kids[5 0 R 36 0 R] +/Parent 194 0 R +>> +endobj +44 0 obj +<< +/Type/Page +/Resources 45 0 R +/Contents[32 0 R 4 0 R 46 0 R 34 0 R] +/Parent 196 0 R +>> +endobj +48 0 obj +<< +/Type/Page +/Resources 49 0 R +/Contents[32 0 R 4 0 R 53 0 R 34 0 R] +/Parent 196 0 R +>> +endobj +196 0 obj +<< +/Type/Pages +/Count 2 +/Kids[44 0 R 48 0 R] +/Parent 194 0 R +>> +endobj +55 0 obj +<< +/Type/Page +/Resources 56 0 R +/Contents[32 0 R 4 0 R 63 0 R 34 0 R] +/Parent 197 0 R +>> +endobj +65 0 obj +<< +/Type/Page +/Resources 66 0 R +/Contents[32 0 R 4 0 R 67 0 R 34 0 R] +/Parent 197 0 R +>> +endobj +197 0 obj +<< +/Type/Pages +/Count 2 +/Kids[55 0 R 65 0 R] +/Parent 194 0 R +>> +endobj +69 0 obj +<< +/Type/Page +/Resources 70 0 R +/Contents[32 0 R 4 0 R 71 0 R 34 0 R] +/Parent 198 0 R +>> +endobj +73 0 obj +<< +/Type/Page +/Resources 74 0 R +/Contents[32 0 R 4 0 R 75 0 R 34 0 R] +/Parent 198 0 R +>> +endobj +198 0 obj +<< +/Type/Pages +/Count 2 +/Kids[69 0 R 73 0 R] +/Parent 194 0 R +>> +endobj +194 0 obj +<< +/Type/Pages +/Count 8 +/Kids[195 0 R 196 0 R 197 0 R 198 0 R] +/Parent 3 0 R +>> +endobj +77 0 obj +<< +/Type/Page +/Resources 78 0 R +/Contents[32 0 R 4 0 R 79 0 R 34 0 R] +/Parent 200 0 R +>> +endobj +81 0 obj +<< +/Type/Page +/Resources 82 0 R +/Contents[32 0 R 4 0 R 85 0 R 34 0 R] +/Parent 200 0 R +>> +endobj +200 0 obj +<< +/Type/Pages +/Count 2 +/Kids[77 0 R 81 0 R] +/Parent 199 0 R +>> +endobj +87 0 obj +<< +/Type/Page +/Resources 88 0 R +/Contents[32 0 R 4 0 R 89 0 R 34 0 R] +/Parent 201 0 R +>> +endobj +91 0 obj +<< +/Type/Page +/Resources 92 0 R +/Contents[32 0 R 4 0 R 96 0 R 34 0 R] +/Parent 201 0 R +>> +endobj +201 0 obj +<< +/Type/Pages +/Count 2 +/Kids[87 0 R 91 0 R] +/Parent 199 0 R +>> +endobj +98 0 obj +<< +/Type/Page +/Resources 99 0 R +/Contents[32 0 R 4 0 R 100 0 R 34 0 R] +/Parent 202 0 R +>> +endobj +102 0 obj +<< +/Type/Page +/Resources 103 0 R +/Contents[32 0 R 4 0 R 104 0 R 34 0 R] +/Parent 202 0 R +>> +endobj +202 0 obj +<< +/Type/Pages +/Count 2 +/Kids[98 0 R 102 0 R] +/Parent 199 0 R +>> +endobj +106 0 obj +<< +/Type/Page +/Resources 107 0 R +/Contents[32 0 R 4 0 R 108 0 R 34 0 R] +/Parent 203 0 R +>> +endobj +110 0 obj +<< +/Type/Page +/Resources 111 0 R +/Contents[32 0 R 4 0 R 112 0 R 34 0 R] +/Parent 203 0 R +>> +endobj +114 0 obj +<< +/Type/Page +/Resources 115 0 R +/Contents[32 0 R 4 0 R 122 0 R 34 0 R] +/Parent 203 0 R +>> +endobj +203 0 obj +<< +/Type/Pages +/Count 3 +/Kids[106 0 R 110 0 R 114 0 R] +/Parent 199 0 R +>> +endobj +199 0 obj +<< +/Type/Pages +/Count 9 +/Kids[200 0 R 201 0 R 202 0 R 203 0 R] +/Parent 3 0 R +>> +endobj +124 0 obj +<< +/Type/Page +/Resources 125 0 R +/Contents[32 0 R 4 0 R 126 0 R 34 0 R] +/Parent 205 0 R +>> +endobj +128 0 obj +<< +/Type/Page +/Resources 129 0 R +/Contents[32 0 R 4 0 R 130 0 R 34 0 R] +/Parent 205 0 R +>> +endobj +205 0 obj +<< +/Type/Pages +/Count 2 +/Kids[124 0 R 128 0 R] +/Parent 204 0 R +>> +endobj +132 0 obj +<< +/Type/Page +/Resources 133 0 R +/Contents[32 0 R 4 0 R 134 0 R 34 0 R] +/Parent 206 0 R +>> +endobj +136 0 obj +<< +/Type/Page +/Resources 137 0 R +/Contents[32 0 R 4 0 R 138 0 R 34 0 R] +/Parent 206 0 R +>> +endobj +206 0 obj +<< +/Type/Pages +/Count 2 +/Kids[132 0 R 136 0 R] +/Parent 204 0 R +>> +endobj +140 0 obj +<< +/Type/Page +/Resources 141 0 R +/Contents[32 0 R 4 0 R 142 0 R 34 0 R] +/Parent 207 0 R +>> +endobj +144 0 obj +<< +/Type/Page +/Resources 145 0 R +/Contents[32 0 R 4 0 R 146 0 R 34 0 R] +/Parent 207 0 R +>> +endobj +207 0 obj +<< +/Type/Pages +/Count 2 +/Kids[140 0 R 144 0 R] +/Parent 204 0 R +>> +endobj +148 0 obj +<< +/Type/Page +/Resources 149 0 R +/Contents[32 0 R 4 0 R 150 0 R 34 0 R] +/Parent 208 0 R +>> +endobj +152 0 obj +<< +/Type/Page +/Resources 153 0 R +/Contents[32 0 R 4 0 R 154 0 R 34 0 R] +/Parent 208 0 R +>> +endobj +208 0 obj +<< +/Type/Pages +/Count 2 +/Kids[148 0 R 152 0 R] +/Parent 204 0 R +>> +endobj +204 0 obj +<< +/Type/Pages +/Count 8 +/Kids[205 0 R 206 0 R 207 0 R 208 0 R] +/Parent 3 0 R +>> +endobj +156 0 obj +<< +/Type/Page +/Resources 157 0 R +/Contents[32 0 R 4 0 R 158 0 R 34 0 R] +/Parent 210 0 R +>> +endobj +160 0 obj +<< +/Type/Page +/Resources 161 0 R +/Contents[32 0 R 4 0 R 162 0 R 34 0 R] +/Parent 210 0 R +>> +endobj +210 0 obj +<< +/Type/Pages +/Count 2 +/Kids[156 0 R 160 0 R] +/Parent 209 0 R +>> +endobj +164 0 obj +<< +/Type/Page +/Resources 165 0 R +/Contents[32 0 R 4 0 R 166 0 R 34 0 R] +/Parent 211 0 R +>> +endobj +168 0 obj +<< +/Type/Page +/Resources 169 0 R +/Contents[32 0 R 4 0 R 170 0 R 34 0 R] +/Parent 211 0 R +>> +endobj +211 0 obj +<< +/Type/Pages +/Count 2 +/Kids[164 0 R 168 0 R] +/Parent 209 0 R +>> +endobj +172 0 obj +<< +/Type/Page +/Resources 173 0 R +/Contents[32 0 R 4 0 R 174 0 R 34 0 R] +/Parent 212 0 R +>> +endobj +176 0 obj +<< +/Type/Page +/Resources 177 0 R +/Contents[32 0 R 4 0 R 178 0 R 34 0 R] +/Parent 212 0 R +>> +endobj +212 0 obj +<< +/Type/Pages +/Count 2 +/Kids[172 0 R 176 0 R] +/Parent 209 0 R +>> +endobj +180 0 obj +<< +/Type/Page +/Resources 181 0 R +/Contents[32 0 R 4 0 R 182 0 R 34 0 R] +/Parent 213 0 R +>> +endobj +184 0 obj +<< +/Type/Page +/Resources 185 0 R +/Contents[32 0 R 4 0 R 186 0 R 34 0 R] +/Parent 213 0 R +>> +endobj +188 0 obj +<< +/Type/Page +/Resources 189 0 R +/Contents[32 0 R 4 0 R 190 0 R 34 0 R] +/Parent 213 0 R +>> +endobj +213 0 obj +<< +/Type/Pages +/Count 3 +/Kids[180 0 R 184 0 R 188 0 R] +/Parent 209 0 R +>> +endobj +209 0 obj +<< +/Type/Pages +/Count 9 +/Kids[210 0 R 211 0 R 212 0 R 213 0 R] +/Parent 3 0 R +>> +endobj +3 0 obj +<< +/Type/Pages +/Count 34 +/Kids[194 0 R 199 0 R 204 0 R 209 0 R] +/MediaBox[0 0 612 792] +>> +endobj +32 0 obj +<< +/Length 1 +>> +stream + +endstream +endobj +34 0 obj +<< +/Length 1 +>> +stream + +endstream +endobj +4 0 obj +<< +/Length 30 +>> +stream +1.00028 0 0 1.00028 72 720 cm +endstream +endobj +214 0 obj +<< +>> +endobj +215 0 obj +null +endobj +216 0 obj +<< +>> +endobj +2 0 obj +<< +/Type/Catalog +/Pages 3 0 R +/Outlines 214 0 R +/Threads 215 0 R +/Names 216 0 R +>> +endobj +xref +0 217 +0000000000 65535 f +0000205846 00000 n +0000211711 00000 n +0000211359 00000 n +0000211564 00000 n +0000206009 00000 n +0000010679 00000 n +0000000009 00000 n +0000118624 00000 n +0000118437 00000 n +0000000908 00000 n +0000126793 00000 n +0000126607 00000 n +0000001853 00000 n +0000130066 00000 n +0000129880 00000 n +0000002847 00000 n +0000144659 00000 n +0000144464 00000 n +0000003764 00000 n +0000149891 00000 n +0000149697 00000 n +0000004698 00000 n +0000160719 00000 n +0000160531 00000 n +0000005651 00000 n +0000163750 00000 n +0000163556 00000 n +0000006530 00000 n +0000165607 00000 n +0000165419 00000 n +0000007522 00000 n +0000211464 00000 n +0000008439 00000 n +0000211514 00000 n +0000010569 00000 n +0000206112 00000 n +0000015432 00000 n +0000010740 00000 n +0000175260 00000 n +0000175066 00000 n +0000011825 00000 n +0000012628 00000 n +0000015366 00000 n +0000206297 00000 n +0000018227 00000 n +0000015494 00000 n +0000018139 00000 n +0000206402 00000 n +0000022524 00000 n +0000187119 00000 n +0000186926 00000 n +0000018289 00000 n +0000019272 00000 n +0000022424 00000 n +0000206588 00000 n +0000028036 00000 n +0000191643 00000 n +0000191449 00000 n +0000022586 00000 n +0000194069 00000 n +0000193883 00000 n +0000023577 00000 n +0000024578 00000 n +0000027912 00000 n +0000206693 00000 n +0000030434 00000 n +0000028098 00000 n +0000030357 00000 n +0000206879 00000 n +0000033168 00000 n +0000030496 00000 n +0000033068 00000 n +0000206984 00000 n +0000036052 00000 n +0000033230 00000 n +0000035952 00000 n +0000207267 00000 n +0000038976 00000 n +0000036114 00000 n +0000038888 00000 n +0000207372 00000 n +0000043152 00000 n +0000039038 00000 n +0000204833 00000 n +0000040099 00000 n +0000043016 00000 n +0000207558 00000 n +0000046075 00000 n +0000043214 00000 n +0000045963 00000 n +0000207663 00000 n +0000050526 00000 n +0000196991 00000 n +0000196802 00000 n +0000046137 00000 n +0000047114 00000 n +0000050378 00000 n +0000207849 00000 n +0000053601 00000 n +0000050588 00000 n +0000053464 00000 n +0000207955 00000 n +0000056683 00000 n +0000053664 00000 n +0000056582 00000 n +0000208145 00000 n +0000060043 00000 n +0000056747 00000 n +0000059930 00000 n +0000208253 00000 n +0000063398 00000 n +0000060107 00000 n +0000063261 00000 n +0000208361 00000 n +0000068170 00000 n +0000199923 00000 n +0000199729 00000 n +0000063462 00000 n +0000202339 00000 n +0000202151 00000 n +0000064436 00000 n +0000065439 00000 n +0000068007 00000 n +0000208657 00000 n +0000070945 00000 n +0000068234 00000 n +0000070832 00000 n +0000208765 00000 n +0000073494 00000 n +0000071009 00000 n +0000073366 00000 n +0000208956 00000 n +0000076846 00000 n +0000073558 00000 n +0000076745 00000 n +0000209064 00000 n +0000079835 00000 n +0000076910 00000 n +0000079734 00000 n +0000209255 00000 n +0000083071 00000 n +0000079899 00000 n +0000082934 00000 n +0000209363 00000 n +0000085726 00000 n +0000083135 00000 n +0000085563 00000 n +0000209554 00000 n +0000088994 00000 n +0000085790 00000 n +0000088869 00000 n +0000209662 00000 n +0000092497 00000 n +0000089058 00000 n +0000092370 00000 n +0000209950 00000 n +0000095413 00000 n +0000092561 00000 n +0000095300 00000 n +0000210058 00000 n +0000098137 00000 n +0000095477 00000 n +0000098059 00000 n +0000210249 00000 n +0000100718 00000 n +0000098201 00000 n +0000100629 00000 n +0000210357 00000 n +0000104157 00000 n +0000100782 00000 n +0000104067 00000 n +0000210548 00000 n +0000107090 00000 n +0000104221 00000 n +0000107001 00000 n +0000210656 00000 n +0000110469 00000 n +0000107154 00000 n +0000110344 00000 n +0000210847 00000 n +0000113934 00000 n +0000110533 00000 n +0000113808 00000 n +0000210955 00000 n +0000116941 00000 n +0000113998 00000 n +0000116804 00000 n +0000211063 00000 n +0000118373 00000 n +0000117005 00000 n +0000118328 00000 n +0000204453 00000 n +0000204797 00000 n +0000207170 00000 n +0000206217 00000 n +0000206507 00000 n +0000206798 00000 n +0000207089 00000 n +0000208560 00000 n +0000207477 00000 n +0000207768 00000 n +0000208063 00000 n +0000208469 00000 n +0000209853 00000 n +0000208873 00000 n +0000209172 00000 n +0000209471 00000 n +0000209770 00000 n +0000211262 00000 n +0000210166 00000 n +0000210465 00000 n +0000210764 00000 n +0000211171 00000 n +0000211643 00000 n +0000211666 00000 n +0000211688 00000 n +trailer +<< +/Size 217 +/Root 2 0 R +/Info 1 0 R +>> +startxref +211809 +%%EOF diff --git a/matita/dama/excess.ma b/matita/dama/excess.ma new file mode 100644 index 000000000..d8cf09766 --- /dev/null +++ b/matita/dama/excess.ma @@ -0,0 +1,249 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/excess/". + +include "higher_order_defs/relations.ma". +include "nat/plus.ma". +include "constructive_connectives.ma". +include "constructive_higher_order_relations.ma". + +record excess : Type ≝ { + exc_carr:> Type; + exc_relation: exc_carr → exc_carr → Type; + exc_coreflexive: coreflexive ? exc_relation; + exc_cotransitive: cotransitive ? exc_relation +}. + +interpretation "excess" 'nleq a b = + (cic:/matita/excess/exc_relation.con _ a b). + +definition le ≝ λE:excess.λa,b:E. ¬ (a ≰ b). + +interpretation "ordered sets less or equal than" 'leq a b = + (cic:/matita/excess/le.con _ a b). + +lemma le_reflexive: ∀E.reflexive ? (le E). +intros (E); unfold; cases E; simplify; intros (x); apply (H x); +qed. + +lemma le_transitive: ∀E.transitive ? (le E). +intros (E); unfold; cases E; simplify; unfold Not; intros (x y z Rxy Ryz H2); +cases (c x z y H2) (H4 H5); clear H2; [exact (Rxy H4)|exact (Ryz H5)] +qed. + +record apartness : Type ≝ { + ap_carr:> Type; + ap_apart: ap_carr → ap_carr → Type; + ap_coreflexive: coreflexive ? ap_apart; + ap_symmetric: symmetric ? ap_apart; + ap_cotransitive: cotransitive ? ap_apart +}. + +notation "a break # b" non associative with precedence 50 for @{ 'apart $a $b}. +interpretation "apartness" 'apart x y = + (cic:/matita/excess/ap_apart.con _ x y). + +definition strong_ext ≝ λA:apartness.λop:A→A.∀x,y. op x # op y → x # y. + +definition apart ≝ λE:excess.λa,b:E. a ≰ b ∨ b ≰ a. + +definition apart_of_excess: excess → apartness. +intros (E); apply (mk_apartness E (apart E)); +[1: unfold; cases E; simplify; clear E; intros (x); unfold; + intros (H1); apply (H x); cases H1; assumption; +|2: unfold; intros(x y H); cases H; clear H; [right|left] assumption; +|3: intros (E); unfold; cases E (T f _ cTf); simplify; intros (x y z Axy); + cases Axy (H H); lapply (cTf ? ? z H) as H1; cases H1; clear Axy H1; + [left; left|right; left|right; right|left; right] assumption] +qed. + +coercion cic:/matita/excess/apart_of_excess.con. + +definition eq ≝ λA:apartness.λa,b:A. ¬ (a # b). + +notation "a break ≈ b" non associative with precedence 50 for @{ 'napart $a $b}. +interpretation "alikeness" 'napart a b = + (cic:/matita/excess/eq.con _ a b). + +lemma eq_reflexive:∀E. reflexive ? (eq E). +intros (E); unfold; intros (x); apply ap_coreflexive; +qed. + +lemma eq_sym_:∀E.symmetric ? (eq E). +intros (E); unfold; intros (x y Exy); unfold; unfold; intros (Ayx); apply Exy; +apply ap_symmetric; assumption; +qed. + +lemma eq_sym:∀E:apartness.∀x,y:E.x ≈ y → y ≈ x ≝ eq_sym_. + +coercion cic:/matita/excess/eq_sym.con. + +lemma eq_trans_: ∀E.transitive ? (eq E). +(* bug. intros k deve fare whd quanto basta *) +intros 6 (E x y z Exy Eyz); intro Axy; cases (ap_cotransitive ???y Axy); +[apply Exy|apply Eyz] assumption. +qed. + +lemma eq_trans:∀E:apartness.∀x,z,y:E.x ≈ y → y ≈ z → x ≈ z ≝ + λE,x,y,z.eq_trans_ E x z y. + +notation > "'Eq'≈" non associative with precedence 50 for + @{'eqrewrite}. + +interpretation "eq_rew" 'eqrewrite = + (cic:/matita/excess/eq_trans.con _ _ _). + +(* BUG: vedere se ricapita *) +alias id "antisymmetric" = "cic:/matita/constructive_higher_order_relations/antisymmetric.con". +lemma le_antisymmetric: ∀E.antisymmetric ? (le E) (eq ?). +intros 5 (E x y Lxy Lyx); intro H; +cases H; [apply Lxy;|apply Lyx] assumption; +qed. + +definition lt ≝ λE:excess.λa,b:E. a ≤ b ∧ a # b. + +interpretation "ordered sets less than" 'lt a b = + (cic:/matita/excess/lt.con _ a b). + +lemma lt_coreflexive: ∀E.coreflexive ? (lt E). +intros 2 (E x); intro H; cases H (_ ABS); +apply (ap_coreflexive ? x ABS); +qed. + +lemma lt_transitive: ∀E.transitive ? (lt E). +intros (E); unfold; intros (x y z H1 H2); cases H1 (Lxy Axy); cases H2 (Lyz Ayz); +split; [apply (le_transitive ???? Lxy Lyz)] clear H1 H2; +cases Axy (H1 H1); cases Ayz (H2 H2); [1:cases (Lxy H1)|3:cases (Lyz H2)] +clear Axy Ayz;lapply (exc_cotransitive E) as c; unfold cotransitive in c; +lapply (exc_coreflexive E) as r; unfold coreflexive in r; +[1: lapply (c ?? y H1) as H3; cases H3 (H4 H4); [cases (Lxy H4)|cases (r ? H4)] +|2: lapply (c ?? x H2) as H3; cases H3 (H4 H4); [right; assumption|cases (Lxy H4)]] +qed. + +theorem lt_to_excess: ∀E:excess.∀a,b:E. (a < b) → (b ≰ a). +intros (E a b Lab); cases Lab (LEab Aab); +cases Aab (H H); [cases (LEab H)] fold normalize (b ≰ a); assumption; (* BUG *) +qed. + +lemma unfold_apart: ∀E:excess. ∀x,y:E. x ≰ y ∨ y ≰ x → x # y. +intros; assumption; +qed. + +lemma le_rewl: ∀E:excess.∀z,y,x:E. x ≈ y → x ≤ z → y ≤ z. +intros (E z y x Exy Lxz); apply (le_transitive ???? ? Lxz); +intro Xyz; apply Exy; apply unfold_apart; right; assumption; +qed. + +lemma le_rewr: ∀E:excess.∀z,y,x:E. x ≈ y → z ≤ x → z ≤ y. +intros (E z y x Exy Lxz); apply (le_transitive ???? Lxz); +intro Xyz; apply Exy; apply unfold_apart; left; assumption; +qed. + +notation > "'Le'≪" non associative with precedence 50 for + @{'lerewritel}. + +interpretation "le_rewl" 'lerewritel = + (cic:/matita/excess/le_rewl.con _ _ _). + +notation > "'Le'≫" non associative with precedence 50 for + @{'lerewriter}. + +interpretation "le_rewr" 'lerewriter = + (cic:/matita/excess/le_rewr.con _ _ _). + +lemma ap_rewl: ∀A:apartness.∀x,z,y:A. x ≈ y → y # z → x # z. +intros (A x z y Exy Ayz); cases (ap_cotransitive ???x Ayz); [2:assumption] +cases (Exy (ap_symmetric ??? a)); +qed. + +lemma ap_rewr: ∀A:apartness.∀x,z,y:A. x ≈ y → z # y → z # x. +intros (A x z y Exy Azy); apply ap_symmetric; apply (ap_rewl ???? Exy); +apply ap_symmetric; assumption; +qed. + +lemma exc_rewl: ∀A:excess.∀x,z,y:A. x ≈ y → y ≰ z → x ≰ z. +intros (A x z y Exy Ayz); elim (exc_cotransitive ???x Ayz); [2:assumption] +cases Exy; right; assumption; +qed. + +lemma exc_rewr: ∀A:excess.∀x,z,y:A. x ≈ y → z ≰ y → z ≰ x. +intros (A x z y Exy Azy); elim (exc_cotransitive ???x Azy); [assumption] +elim (Exy); left; assumption; +qed. + +notation > "'Ex'≪" non associative with precedence 50 for + @{'excessrewritel}. + +interpretation "exc_rewl" 'excessrewritel = + (cic:/matita/excess/exc_rewl.con _ _ _). + +notation > "'Ex'≫" non associative with precedence 50 for + @{'excessrewriter}. + +interpretation "exc_rewr" 'excessrewriter = + (cic:/matita/excess/exc_rewr.con _ _ _). + +lemma lt_rewr: ∀A:excess.∀x,z,y:A. x ≈ y → z < y → z < x. +intros (A x y z E H); split; elim H; +[apply (le_rewr ???? (eq_sym ??? E));|apply (ap_rewr ???? E)] assumption; +qed. + +lemma lt_rewl: ∀A:excess.∀x,z,y:A. x ≈ y → y < z → x < z. +intros (A x y z E H); split; elim H; +[apply (le_rewl ???? (eq_sym ??? E));| apply (ap_rewl ???? E);] assumption; +qed. + +notation > "'Lt'≪" non associative with precedence 50 for + @{'ltrewritel}. + +interpretation "lt_rewl" 'ltrewritel = + (cic:/matita/excess/lt_rewl.con _ _ _). + +notation > "'Lt'≫" non associative with precedence 50 for + @{'ltrewriter}. + +interpretation "lt_rewr" 'ltrewriter = + (cic:/matita/excess/lt_rewr.con _ _ _). + +lemma lt_le_transitive: ∀A:excess.∀x,y,z:A.x < y → y ≤ z → x < z. +intros (A x y z LT LE); cases LT (LEx APx); split; [apply (le_transitive ???? LEx LE)] +whd in LE LEx APx; cases APx (EXx EXx); [cases (LEx EXx)] +cases (exc_cotransitive ??? z EXx) (EXz EXz); [cases (LE EXz)] +right; assumption; +qed. + +lemma le_lt_transitive: ∀A:excess.∀x,y,z:A.x ≤ y → y < z → x < z. +intros (A x y z LE LT); cases LT (LEx APx); split; [apply (le_transitive ???? LE LEx)] +whd in LE LEx APx; cases APx (EXx EXx); [cases (LEx EXx)] +cases (exc_cotransitive ??? x EXx) (EXz EXz); [right; assumption] +cases LE; assumption; +qed. + +lemma le_le_eq: ∀E:excess.∀a,b:E. a ≤ b → b ≤ a → a ≈ b. +intros (E x y L1 L2); intro H; cases H; [apply L1|apply L2] assumption; +qed. + +lemma eq_le_le: ∀E:excess.∀a,b:E. a ≈ b → a ≤ b ∧ b ≤ a. +intros (E x y H); unfold apart_of_excess in H; unfold apart in H; +simplify in H; split; intro; apply H; [left|right] assumption. +qed. + +lemma ap_le_to_lt: ∀E:excess.∀a,c:E.c # a → c ≤ a → c < a. +intros; split; assumption; +qed. + +definition total_order_property : ∀E:excess. Type ≝ + λE:excess. ∀a,b:E. a ≰ b → b < a. + diff --git a/matita/dama/group.ma b/matita/dama/group.ma new file mode 100644 index 000000000..0e2668c2d --- /dev/null +++ b/matita/dama/group.ma @@ -0,0 +1,221 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/group/". + +include "excess.ma". + +definition left_neutral ≝ λC:apartness.λop.λe:C. ∀x:C. op e x ≈ x. +definition right_neutral ≝ λC:apartness.λop. λe:C. ∀x:C. op x e ≈ x. +definition left_inverse ≝ λC:apartness.λop.λe:C.λinv:C→C. ∀x:C. op (inv x) x ≈ e. +definition right_inverse ≝ λC:apartness.λop.λe:C.λ inv: C→ C. ∀x:C. op x (inv x) ≈ e. +(* ALLOW DEFINITION WITH SOME METAS *) + +definition distributive_left ≝ + λA:apartness.λf:A→A→A.λg:A→A→A. + ∀x,y,z. f x (g y z) ≈ g (f x y) (f x z). + +definition distributive_right ≝ + λA:apartness.λf:A→A→A.λg:A→A→A. + ∀x,y,z. f (g x y) z ≈ g (f x z) (f y z). + +record abelian_group : Type ≝ + { carr:> apartness; + plus: carr → carr → carr; + zero: carr; + opp: carr → carr; + plus_assoc_: associative ? plus (eq carr); + plus_comm_: commutative ? plus (eq carr); + zero_neutral_: left_neutral ? plus zero; + opp_inverse_: left_inverse ? plus zero opp; + plus_strong_ext: ∀z.strong_ext ? (plus z) +}. + +notation "0" with precedence 89 for @{ 'zero }. + +interpretation "Abelian group zero" 'zero = + (cic:/matita/group/zero.con _). + +interpretation "Abelian group plus" 'plus a b = + (cic:/matita/group/plus.con _ a b). + +interpretation "Abelian group opp" 'uminus a = + (cic:/matita/group/opp.con _ a). + +definition minus ≝ + λG:abelian_group.λa,b:G. a + -b. + +interpretation "Abelian group minus" 'minus a b = + (cic:/matita/group/minus.con _ a b). + +lemma plus_assoc: ∀G:abelian_group.∀x,y,z:G.x+(y+z)≈x+y+z ≝ plus_assoc_. +lemma plus_comm: ∀G:abelian_group.∀x,y:G.x+y≈y+x ≝ plus_comm_. +lemma zero_neutral: ∀G:abelian_group.∀x:G.0+x≈x ≝ zero_neutral_. +lemma opp_inverse: ∀G:abelian_group.∀x:G.-x+x≈0 ≝ opp_inverse_. + +definition ext ≝ λA:apartness.λop:A→A. ∀x,y. x ≈ y → op x ≈ op y. + +lemma strong_ext_to_ext: ∀A:apartness.∀op:A→A. strong_ext ? op → ext ? op. +intros 6 (A op SEop x y Exy); intro Axy; apply Exy; apply SEop; assumption; +qed. + +lemma feq_plusl: ∀G:abelian_group.∀x,y,z:G. y ≈ z → x+y ≈ x+z. +intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_ext ? x)); +assumption; +qed. + +coercion cic:/matita/group/feq_plusl.con nocomposites. + +lemma plus_strong_extr: ∀G:abelian_group.∀z:G.strong_ext ? (λx.x + z). +intros 5 (G z x y A); simplify in A; +lapply (plus_comm ? z x) as E1; lapply (plus_comm ? z y) as E2; +lapply (ap_rewl ???? E1 A) as A1; lapply (ap_rewr ???? E2 A1) as A2; +apply (plus_strong_ext ???? A2); +qed. + +lemma plus_cancl_ap: ∀G:abelian_group.∀x,y,z:G.z+x # z + y → x # y. +intros; apply plus_strong_ext; assumption; +qed. + +lemma plus_cancr_ap: ∀G:abelian_group.∀x,y,z:G.x+z # y+z → x # y. +intros; apply plus_strong_extr; assumption; +qed. + +lemma feq_plusr: ∀G:abelian_group.∀x,y,z:G. y ≈ z → y+x ≈ z+x. +intros (G x y z Eyz); apply (strong_ext_to_ext ?? (plus_strong_extr ? x)); +assumption; +qed. + +coercion cic:/matita/group/feq_plusr.con nocomposites. + +(* generation of coercions to make *_rew[lr] easier *) +lemma feq_plusr_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y → y+x ≈ z+x. +compose feq_plusr with eq_sym (H); apply H; assumption; +qed. +coercion cic:/matita/group/feq_plusr_sym_.con nocomposites. +lemma feq_plusl_sym_: ∀G:abelian_group.∀x,y,z:G.z ≈ y → x+y ≈ x+z. +compose feq_plusl with eq_sym (H); apply H; assumption; +qed. +coercion cic:/matita/group/feq_plusl_sym_.con nocomposites. + +lemma fap_plusl: ∀G:abelian_group.∀x,y,z:G. y # z → x+y # x+z. +intros (G x y z Ayz); apply (plus_strong_ext ? (-x)); +apply (ap_rewl ??? ((-x + x) + y)); +[1: apply plus_assoc; +|2: apply (ap_rewr ??? ((-x +x) +z)); + [1: apply plus_assoc; + |2: apply (ap_rewl ??? (0 + y)); + [1: apply (feq_plusr ???? (opp_inverse ??)); + |2: apply (ap_rewl ???? (zero_neutral ? y)); + apply (ap_rewr ??? (0 + z) (opp_inverse ??)); + apply (ap_rewr ???? (zero_neutral ??)); assumption;]]] +qed. + +lemma fap_plusr: ∀G:abelian_group.∀x,y,z:G. y # z → y+x # z+x. +intros (G x y z Ayz); apply (plus_strong_extr ? (-x)); +apply (ap_rewl ??? (y + (x + -x))); +[1: apply (eq_sym ??? (plus_assoc ????)); +|2: apply (ap_rewr ??? (z + (x + -x))); + [1: apply (eq_sym ??? (plus_assoc ????)); + |2: apply (ap_rewl ??? (y + (-x+x)) (plus_comm ? x (-x))); + apply (ap_rewl ??? (y + 0) (opp_inverse ??)); + apply (ap_rewl ??? (0 + y) (plus_comm ???)); + apply (ap_rewl ??? y (zero_neutral ??)); + apply (ap_rewr ??? (z + (-x+x)) (plus_comm ? x (-x))); + apply (ap_rewr ??? (z + 0) (opp_inverse ??)); + apply (ap_rewr ??? (0 + z) (plus_comm ???)); + apply (ap_rewr ??? z (zero_neutral ??)); + assumption]] +qed. + +lemma applus: ∀E:abelian_group.∀x,a,y,b:E.x + a # y + b → x # y ∨ a # b. +intros; cases (ap_cotransitive ??? (y+a) a1); [left|right] +[apply (plus_cancr_ap ??? a)|apply (plus_cancl_ap ??? y)] +assumption; +qed. + +lemma plus_cancl: ∀G:abelian_group.∀y,z,x:G. x+y ≈ x+z → y ≈ z. +intros 6 (G y z x E Ayz); apply E; apply fap_plusl; assumption; +qed. + +lemma plus_cancr: ∀G:abelian_group.∀y,z,x:G. y+x ≈ z+x → y ≈ z. +intros 6 (G y z x E Ayz); apply E; apply fap_plusr; assumption; +qed. + +theorem eq_opp_plus_plus_opp_opp: + ∀G:abelian_group.∀x,y:G. -(x+y) ≈ -x + -y. +intros (G x y); apply (plus_cancr ??? (x+y)); +apply (Eq≈ 0 (opp_inverse ??)); +apply (Eq≈ (-x + -y + x + y)); [2: apply (eq_sym ??? (plus_assoc ????))] +apply (Eq≈ (-y + -x + x + y)); [2: repeat apply feq_plusr; apply plus_comm] +apply (Eq≈ (-y + (-x + x) + y)); [2: apply feq_plusr; apply plus_assoc;] +apply (Eq≈ (-y + 0 + y)); + [2: apply feq_plusr; apply feq_plusl; apply eq_sym; apply opp_inverse] +apply (Eq≈ (-y + y)); + [2: apply feq_plusr; apply eq_sym; + apply (Eq≈ (0+-y)); [apply plus_comm|apply zero_neutral]] +apply eq_sym; apply opp_inverse. +qed. + +theorem eq_opp_opp_x_x: ∀G:abelian_group.∀x:G.--x ≈ x. +intros (G x); apply (plus_cancl ??? (-x)); +apply (Eq≈ (--x + -x) (plus_comm ???)); +apply (Eq≈ 0 (opp_inverse ??)); +apply eq_sym; apply opp_inverse; +qed. + +theorem eq_zero_opp_zero: ∀G:abelian_group.0 ≈ -0. [assumption] +intro G; apply (plus_cancr ??? 0); +apply (Eq≈ 0); [apply zero_neutral;] +apply eq_sym; apply opp_inverse; +qed. + +lemma feq_oppr: ∀G:abelian_group.∀x,y,z:G. y ≈ z → x ≈ -y → x ≈ -z. +intros (G x y z H1 H2); apply (plus_cancr ??? z); +(* apply (eq_trans ??? 0 ? (opp_inverse ??)); *) +apply (Eq≈ 0 ? (opp_inverse ??)); +apply (Eq≈ (-y + z) H2); +apply (Eq≈ (-y + y) H1); +apply (Eq≈ 0 (opp_inverse ??)); +apply eq_reflexive; +qed. + +lemma feq_oppl: ∀G:abelian_group.∀x,y,z:G. y ≈ z → -y ≈ x → -z ≈ x. +intros (G x y z H1 H2); apply eq_sym; apply (feq_oppr ??y); +[2:apply eq_sym] assumption; +qed. + +lemma feq_opp: ∀G:abelian_group.∀x,y:G. x ≈ y → -x ≈ -y. +intros (G x y H); apply (feq_oppl ??y ? H); apply eq_reflexive; +qed. + +coercion cic:/matita/group/feq_opp.con nocomposites. + +lemma eq_opp_sym: ∀G:abelian_group.∀x,y:G. y ≈ x → -x ≈ -y. +compose feq_opp with eq_sym (H); apply H; assumption; +qed. + +coercion cic:/matita/group/eq_opp_sym.con nocomposites. + +lemma eq_opp_plusr: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(x + z) ≈ -(y + z). +compose feq_plusr with feq_opp(H); apply H; assumption; +qed. + +coercion cic:/matita/group/eq_opp_plusr.con nocomposites. + +lemma eq_opp_plusl: ∀G:abelian_group.∀x,y,z:G. x ≈ y → -(z + x) ≈ -(z + y). +compose feq_plusl with feq_opp(H); apply H; assumption; +qed. + +coercion cic:/matita/group/eq_opp_plusl.con nocomposites. diff --git a/matita/dama/lattice.ma b/matita/dama/lattice.ma new file mode 100644 index 000000000..768c86df1 --- /dev/null +++ b/matita/dama/lattice.ma @@ -0,0 +1,87 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/lattice/". + +include "excess.ma". + +record lattice : Type ≝ { + l_carr:> apartness; + join: l_carr → l_carr → l_carr; + meet: l_carr → l_carr → l_carr; + join_refl: ∀x.join x x ≈ x; + meet_refl: ∀x.meet x x ≈ x; + join_comm: ∀x,y:l_carr. join x y ≈ join y x; + meet_comm: ∀x,y:l_carr. meet x y ≈ meet y x; + join_assoc: ∀x,y,z:l_carr. join x (join y z) ≈ join (join x y) z; + meet_assoc: ∀x,y,z:l_carr. meet x (meet y z) ≈ meet (meet x y) z; + absorbjm: ∀f,g:l_carr. join f (meet f g) ≈ f; + absorbmj: ∀f,g:l_carr. meet f (join f g) ≈ f; + strong_extj: ∀x.strong_ext ? (join x); + strong_extm: ∀x.strong_ext ? (meet x) +}. + +interpretation "Lattice meet" 'and a b = + (cic:/matita/lattice/meet.con _ a b). + +interpretation "Lattice join" 'or a b = + (cic:/matita/lattice/join.con _ a b). + +definition excl ≝ λl:lattice.λa,b:l.a # (a ∧ b). + +lemma excess_of_lattice: lattice → excess. +intro l; apply (mk_excess l (excl l)); +[ intro x; unfold; intro H; unfold in H; apply (ap_coreflexive l x); + apply (ap_rewr ??? (x∧x) (meet_refl l x)); assumption; +| intros 3 (x y z); unfold excl; intro H; + cases (ap_cotransitive ??? (x∧z∧y) H) (H1 H2); [2: + left; apply ap_symmetric; apply (strong_extm ? y); + apply (ap_rewl ???? (meet_comm ???)); + apply (ap_rewr ???? (meet_comm ???)); + assumption] + cases (ap_cotransitive ??? (x∧z) H1) (H2 H3); [left; assumption] + right; apply (strong_extm ? x); apply (ap_rewr ???? (meet_assoc ????)); + assumption] +qed. + +coercion cic:/matita/lattice/excess_of_lattice.con. + +lemma feq_ml: ∀ml:lattice.∀a,b,c:ml. a ≈ b → (c ∧ a) ≈ (c ∧ b). +intros (l a b c H); unfold eq in H ⊢ %; unfold Not in H ⊢ %; +intro H1; apply H; clear H; apply (strong_extm ???? H1); +qed. + +lemma feq_jl: ∀ml:lattice.∀a,b,c:ml. a ≈ b → (c ∨ a) ≈ (c ∨ b). +intros (l a b c H); unfold eq in H ⊢ %; unfold Not in H ⊢ %; +intro H1; apply H; clear H; apply (strong_extj ???? H1); +qed. + +lemma le_to_eqm: ∀ml:lattice.∀a,b:ml. a ≤ b → a ≈ (a ∧ b). +intros (l a b H); + unfold le in H; unfold excess_of_lattice in H; + unfold excl in H; simplify in H; +unfold eq; assumption; +qed. + +lemma le_to_eqj: ∀ml:lattice.∀a,b:ml. a ≤ b → b ≈ (a ∨ b). +intros (l a b H); lapply (le_to_eqm ??? H) as H1; +lapply (feq_jl ??? b H1) as H2; +apply (Eq≈ ?? (join_comm ???)); +apply (Eq≈ (b∨a∧b) ? H2); clear H1 H2 H; +apply (Eq≈ (b∨(b∧a)) ? (feq_jl ???? (meet_comm ???))); +apply eq_sym; apply absorbjm; +qed. + + + diff --git a/matita/dama/makefile b/matita/dama/makefile new file mode 100644 index 000000000..ce86d1360 --- /dev/null +++ b/matita/dama/makefile @@ -0,0 +1,33 @@ +H=@ + +RT_BASEDIR=../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +all: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + diff --git a/matita/dama/metric_lattice.ma b/matita/dama/metric_lattice.ma new file mode 100644 index 000000000..0bfc3db67 --- /dev/null +++ b/matita/dama/metric_lattice.ma @@ -0,0 +1,110 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/metric_lattice/". + +include "metric_space.ma". +include "lattice.ma". + +record mlattice_ (R : todgroup) : Type ≝ { + ml_mspace_: metric_space R; + ml_lattice:> lattice; + ml_with_: ms_carr ? ml_mspace_ = ap_carr (l_carr ml_lattice) +}. + +lemma ml_mspace: ∀R.mlattice_ R → metric_space R. +intros (R ml); apply (mk_metric_space R ml); unfold Type_OF_mlattice_; +cases (ml_with_ ? ml); simplify; +[apply (metric ? (ml_mspace_ ? ml));|apply (mpositive ? (ml_mspace_ ? ml)); +|apply (mreflexive ? (ml_mspace_ ? ml));|apply (msymmetric ? (ml_mspace_ ? ml)); +|apply (mtineq ? (ml_mspace_ ? ml))] +qed. + +coercion cic:/matita/metric_lattice/ml_mspace.con. + +record mlattice (R : todgroup) : Type ≝ { + ml_carr :> mlattice_ R; + ml_prop1: ∀a,b:ml_carr. 0 < δ a b → a # b; + ml_prop2: ∀a,b,c:ml_carr. δ (a∨b) (a∨c) + δ (a∧b) (a∧c) ≤ δ b c +}. + +lemma eq_to_ndlt0: ∀R.∀ml:mlattice R.∀a,b:ml. a ≈ b → ¬ 0 < δ a b. +intros (R ml a b E); intro H; apply E; apply ml_prop1; +assumption; +qed. + +lemma eq_to_dzero: ∀R.∀ml:mlattice R.∀x,y:ml.x ≈ y → δ x y ≈ 0. +intros (R ml x y H); intro H1; apply H; clear H; +apply ml_prop1; split [apply mpositive] apply ap_symmetric; +assumption; +qed. + +lemma meq_l: ∀R.∀ml:mlattice R.∀x,y,z:ml. x≈z → δx y ≈ δz y. +intros (R ml x y z); apply le_le_eq; +[ apply (le_transitive ???? (mtineq ???y z)); + apply (le_rewl ??? (0+δz y) (eq_to_dzero ???? H)); + apply (le_rewl ??? (δz y) (zero_neutral ??)); apply le_reflexive; +| apply (le_transitive ???? (mtineq ???y x)); + apply (le_rewl ??? (0+δx y) (eq_to_dzero ??z x H)); + apply (le_rewl ??? (δx y) (zero_neutral ??)); apply le_reflexive;] +qed. + +(* 3.3 *) +lemma meq_r: ∀R.∀ml:mlattice R.∀x,y,z:ml. x≈z → δy x ≈ δy z. +intros; apply (eq_trans ???? (msymmetric ??y x)); +apply (eq_trans ????? (msymmetric ??z y)); apply meq_l; assumption; +qed. + + +lemma dap_to_lt: ∀R.∀ml:mlattice R.∀x,y:ml. δ x y # 0 → 0 < δ x y. +intros; split [apply mpositive] apply ap_symmetric; assumption; +qed. + +lemma dap_to_ap: ∀R.∀ml:mlattice R.∀x,y:ml. δ x y # 0 → x # y. +intros (R ml x y H); apply ml_prop1; split; [apply mpositive;] +apply ap_symmetric; assumption; +qed. + +(* 3.11 *) +lemma le_mtri: + ∀R.∀ml:mlattice R.∀x,y,z:ml. x ≤ y → y ≤ z → δ x z ≈ δ x y + δ y z. +intros (R ml x y z Lxy Lyz); apply le_le_eq; [apply mtineq] +apply (le_transitive ????? (ml_prop2 ?? (y) ??)); +cut ( δx y+ δy z ≈ δ(y∨x) (y∨z)+ δ(y∧x) (y∧z)); [ + apply (le_rewr ??? (δx y+ δy z)); [assumption] apply le_reflexive] +lapply (le_to_eqm ??? Lxy) as Dxm; lapply (le_to_eqm ??? Lyz) as Dym; +lapply (le_to_eqj ??? Lxy) as Dxj; lapply (le_to_eqj ??? Lyz) as Dyj; clear Lxy Lyz; +apply (Eq≈ (δ(x∧y) y + δy z) (meq_l ????? Dxm)); +apply (Eq≈ (δ(x∧y) (y∧z) + δy z) (meq_r ????? Dym)); +apply (Eq≈ (δ(x∧y) (y∧z) + δ(x∨y) z) (meq_l ????? Dxj)); +apply (Eq≈ (δ(x∧y) (y∧z) + δ(x∨y) (y∨z))); [ + apply (feq_plusl ? (δ(x∧y) (y∧z)) ?? (meq_r ??? (x∨y) ? Dyj));] +apply (Eq≈ ? (plus_comm ???)); +apply (Eq≈ (δ(y∨x) (y∨z)+ δ(x∧y) (y∧z)) (meq_l ????? (join_comm ?x y))); +apply feq_plusl; +apply (Eq≈ (δ(y∧x) (y∧z)) (meq_l ????? (meet_comm ?x y))); +apply eq_reflexive; +qed. + + +(* 3.17 conclusione: δ x y ≈ 0 *) +(* 3.20 conclusione: δ x y ≈ 0 *) +(* 3.21 sup forte + strong_sup x ≝ ∀n. s n ≤ x ∧ ∀y x ≰ y → ∃n. s n ≰ y + strong_sup_zoli x ≝ ∀n. s n ≤ x ∧ ∄y. y#x ∧ y ≤ x +*) +(* 3.22 sup debole (più piccolo dei maggioranti) *) +(* 3.23 conclusion: δ x sup(...) ≈ 0 *) +(* 3.25 vero nel reticolo e basta (niente δ) *) +(* 3.36 conclusion: δ x y ≈ 0 *) \ No newline at end of file diff --git a/matita/dama/metric_space.ma b/matita/dama/metric_space.ma new file mode 100644 index 000000000..e2112d65b --- /dev/null +++ b/matita/dama/metric_space.ma @@ -0,0 +1,51 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/metric_space/". + +include "ordered_divisible_group.ma". + +record metric_space (R : todgroup) : Type ≝ { + ms_carr :> Type; + metric: ms_carr → ms_carr → R; + mpositive: ∀a,b:ms_carr. 0 ≤ metric a b; + mreflexive: ∀a. metric a a ≈ 0; + msymmetric: ∀a,b. metric a b ≈ metric b a; + mtineq: ∀a,b,c:ms_carr. metric a b ≤ metric a c + metric c b + (* manca qualcosa per essere una metrica e non una semimetrica *) +}. + +notation < "\nbsp \delta a \nbsp b" non associative with precedence 80 for @{ 'delta2 $a $b}. +interpretation "metric" 'delta2 a b = (cic:/matita/metric_space/metric.con _ _ a b). +notation "\delta" non associative with precedence 80 for @{ 'delta }. +interpretation "metric" 'delta = (cic:/matita/metric_space/metric.con _ _). + +definition apart_metric:= + λR.λms:metric_space R.λa,b:ms.0 < δ a b. + +lemma apart_of_metric_space: ∀R:todgroup.metric_space R → apartness. +intros (R ms); apply (mk_apartness ? (apart_metric ? ms)); unfold apart_metric; unfold; +[1: intros 2 (x H); cases H (H1 H2); + lapply (ap_rewr ???? (eq_sym ??? (mreflexive ??x)) H2); + apply (ap_coreflexive R 0); assumption; +|2: intros (x y H); cases H; split; + [1: apply (le_rewr ???? (msymmetric ????)); assumption + |2: apply (ap_rewr ???? (msymmetric ????)); assumption] +|3: simplify; intros (x y z H); cases H (LExy Axy); + lapply (mtineq ?? x y z) as H1; whd in Axy; cases Axy (H2 H2); [cases (LExy H2)] + clear LExy; lapply (lt_le_transitive ???? H H1) as LT0; + apply (lt0plus_orlt ????? LT0); apply mpositive;] +qed. + +coercion cic:/matita/metric_space/apart_of_metric_space.con. diff --git a/matita/dama/ordered_divisible_group.ma b/matita/dama/ordered_divisible_group.ma new file mode 100644 index 000000000..a6c13e189 --- /dev/null +++ b/matita/dama/ordered_divisible_group.ma @@ -0,0 +1,75 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/ordered_divisible_group/". + +include "nat/orders.ma". +include "nat/times.ma". +include "ordered_group.ma". +include "divisible_group.ma". + +record todgroup : Type ≝ { + todg_order:> togroup; + todg_division_: dgroup; + todg_with_: dg_carr todg_division_ = og_abelian_group todg_order +}. + +lemma todg_division: todgroup → dgroup. +intro G; apply (mk_dgroup G); unfold abelian_group_OF_todgroup; +cases (todg_with_ G); exact (dg_prop (todg_division_ G)); +qed. + +coercion cic:/matita/ordered_divisible_group/todg_division.con. + +lemma mul_ge: ∀G:todgroup.∀x:G.∀n.0 ≤ x → 0 ≤ n * x. +intros (G x n); elim n; simplify; [apply le_reflexive] +apply (le_transitive ???? H1); +apply (le_rewl ??? (0+(n1*x)) (zero_neutral ??)); +apply fle_plusr; assumption; +qed. + +lemma lt_ltmul: ∀G:todgroup.∀x,y:G.∀n. x < y → S n * x < S n * y. +intros; elim n; [simplify; apply flt_plusr; assumption] +simplify; apply (ltplus); [assumption] assumption; +qed. + +lemma ltmul_lt: ∀G:todgroup.∀x,y:G.∀n. S n * x < S n * y → x < y. +intros 4; elim n; [apply (plus_cancr_lt ??? 0); assumption] +simplify in l; cases (ltplus_orlt ????? l); [assumption] +apply f; assumption; +qed. + +lemma divide_preserves_lt: ∀G:todgroup.∀e:G.∀n.0 sym_plus; simplify; apply (lt_rewl ??? (0+(y+n*y))); [ + apply eq_sym; apply zero_neutral] + apply flt_plusr; assumption;] +apply (lt_transitive ???? l); rewrite > sym_plus; simplify; +rewrite > (sym_plus n); simplify; repeat apply flt_plusl; +apply (lt_rewl ???(0+(n1+n)*y)); [apply eq_sym; apply zero_neutral] +apply flt_plusr; assumption; +qed. + diff --git a/matita/dama/ordered_group.ma b/matita/dama/ordered_group.ma new file mode 100644 index 000000000..2129aa5c7 --- /dev/null +++ b/matita/dama/ordered_group.ma @@ -0,0 +1,328 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/ordered_group/". + +include "group.ma". + +record pogroup_ : Type ≝ { + og_abelian_group_: abelian_group; + og_excess:> excess; + og_with: carr og_abelian_group_ = apart_of_excess og_excess +}. + +lemma og_abelian_group: pogroup_ → abelian_group. +intro G; apply (mk_abelian_group G); [1,2,3: rewrite < (og_with G)] +[apply (plus (og_abelian_group_ G));|apply zero;|apply opp] +unfold apartness_OF_pogroup_; cases (og_with G); simplify; +[apply plus_assoc|apply plus_comm|apply zero_neutral|apply opp_inverse|apply plus_strong_ext] +qed. + +coercion cic:/matita/ordered_group/og_abelian_group.con. + +record pogroup : Type ≝ { + og_carr:> pogroup_; + plus_cancr_exc: ∀f,g,h:og_carr. f+h ≰ g+h → f ≰ g +}. + +lemma fexc_plusr: + ∀G:pogroup.∀x,y,z:G. x ≰ y → x+z ≰ y + z. +intros 5 (G x y z L); apply (plus_cancr_exc ??? (-z)); +apply (Ex≪ (x + (z + -z)) (plus_assoc ????)); +apply (Ex≪ (x + (-z + z)) (plus_comm ??z)); +apply (Ex≪ (x+0) (opp_inverse ??)); +apply (Ex≪ (0+x) (plus_comm ???)); +apply (Ex≪ x (zero_neutral ??)); +apply (Ex≫ (y + (z + -z)) (plus_assoc ????)); +apply (Ex≫ (y + (-z + z)) (plus_comm ??z)); +apply (Ex≫ (y+0) (opp_inverse ??)); +apply (Ex≫ (0+y) (plus_comm ???)); +apply (Ex≫ y (zero_neutral ??) L); +qed. + +coercion cic:/matita/ordered_group/fexc_plusr.con nocomposites. + +lemma plus_cancl_exc: ∀G:pogroup.∀f,g,h:G. h+f ≰ h+g → f ≰ g. +intros 5 (G x y z L); apply (plus_cancr_exc ??? z); +apply (exc_rewl ??? (z+x) (plus_comm ???)); +apply (exc_rewr ??? (z+y) (plus_comm ???) L); +qed. + +lemma fexc_plusl: + ∀G:pogroup.∀x,y,z:G. x ≰ y → z+x ≰ z+y. +intros 5 (G x y z L); apply (plus_cancl_exc ??? (-z)); +apply (exc_rewl ???? (plus_assoc ??z x)); +apply (exc_rewr ???? (plus_assoc ??z y)); +apply (exc_rewl ??? (0+x) (opp_inverse ??)); +apply (exc_rewr ??? (0+y) (opp_inverse ??)); +apply (exc_rewl ???? (zero_neutral ??)); +apply (exc_rewr ???? (zero_neutral ??) L); +qed. + +coercion cic:/matita/ordered_group/fexc_plusl.con nocomposites. + +lemma plus_cancr_le: + ∀G:pogroup.∀x,y,z:G.x+z ≤ y + z → x ≤ y. +intros 5 (G x y z L); +apply (le_rewl ??? (0+x) (zero_neutral ??)); +apply (le_rewl ??? (x+0) (plus_comm ???)); +apply (le_rewl ??? (x+(-z+z)) (opp_inverse ??)); +apply (le_rewl ??? (x+(z+ -z)) (plus_comm ??z)); +apply (le_rewl ??? (x+z+ -z) (plus_assoc ????)); +apply (le_rewr ??? (0+y) (zero_neutral ??)); +apply (le_rewr ??? (y+0) (plus_comm ???)); +apply (le_rewr ??? (y+(-z+z)) (opp_inverse ??)); +apply (le_rewr ??? (y+(z+ -z)) (plus_comm ??z)); +apply (le_rewr ??? (y+z+ -z) (plus_assoc ????)); +intro H; apply L; clear L; apply (plus_cancr_exc ??? (-z) H); +qed. + +lemma fle_plusl: ∀G:pogroup. ∀f,g,h:G. f≤g → h+f≤h+g. +intros (G f g h); +apply (plus_cancr_le ??? (-h)); +apply (le_rewl ??? (f+h+ -h) (plus_comm ? f h)); +apply (le_rewl ??? (f+(h+ -h)) (plus_assoc ????)); +apply (le_rewl ??? (f+(-h+h)) (plus_comm ? h (-h))); +apply (le_rewl ??? (f+0) (opp_inverse ??)); +apply (le_rewl ??? (0+f) (plus_comm ???)); +apply (le_rewl ??? (f) (zero_neutral ??)); +apply (le_rewr ??? (g+h+ -h) (plus_comm ? h ?)); +apply (le_rewr ??? (g+(h+ -h)) (plus_assoc ????)); +apply (le_rewr ??? (g+(-h+h)) (plus_comm ??h)); +apply (le_rewr ??? (g+0) (opp_inverse ??)); +apply (le_rewr ??? (0+g) (plus_comm ???)); +apply (le_rewr ??? (g) (zero_neutral ??) H); +qed. + +lemma fle_plusr: ∀G:pogroup. ∀f,g,h:G. f≤g → f+h≤g+h. +intros (G f g h H); apply (le_rewl ???? (plus_comm ???)); +apply (le_rewr ???? (plus_comm ???)); apply fle_plusl; assumption; +qed. + +lemma plus_cancl_le: + ∀G:pogroup.∀x,y,z:G.z+x ≤ z+y → x ≤ y. +intros 5 (G x y z L); +apply (le_rewl ??? (0+x) (zero_neutral ??)); +apply (le_rewl ??? ((-z+z)+x) (opp_inverse ??)); +apply (le_rewl ??? (-z+(z+x)) (plus_assoc ????)); +apply (le_rewr ??? (0+y) (zero_neutral ??)); +apply (le_rewr ??? ((-z+z)+y) (opp_inverse ??)); +apply (le_rewr ??? (-z+(z+y)) (plus_assoc ????)); +apply (fle_plusl ??? (-z) L); +qed. + +lemma plus_cancl_lt: + ∀G:pogroup.∀x,y,z:G.z+x < z+y → x < y. +intros 5 (G x y z L); elim L (A LE); split; [apply plus_cancl_le; assumption] +apply (plus_cancl_ap ???? LE); +qed. + +lemma plus_cancr_lt: + ∀G:pogroup.∀x,y,z:G.x+z < y+z → x < y. +intros 5 (G x y z L); elim L (A LE); split; [apply plus_cancr_le; assumption] +apply (plus_cancr_ap ???? LE); +qed. + + +lemma exc_opp_x_zero_to_exc_zero_x: + ∀G:pogroup.∀x:G.-x ≰ 0 → 0 ≰ x. +intros (G x H); apply (plus_cancr_exc ??? (-x)); +apply (exc_rewr ???? (plus_comm ???)); +apply (exc_rewr ???? (opp_inverse ??)); +apply (exc_rewl ???? (zero_neutral ??) H); +qed. + +lemma le_zero_x_to_le_opp_x_zero: + ∀G:pogroup.∀x:G.0 ≤ x → -x ≤ 0. +intros (G x Px); apply (plus_cancr_le ??? x); +apply (le_rewl ??? 0 (opp_inverse ??)); +apply (le_rewr ??? x (zero_neutral ??) Px); +qed. + +lemma lt_zero_x_to_lt_opp_x_zero: + ∀G:pogroup.∀x:G.0 < x → -x < 0. +intros (G x Px); apply (plus_cancr_lt ??? x); +apply (lt_rewl ??? 0 (opp_inverse ??)); +apply (lt_rewr ??? x (zero_neutral ??) Px); +qed. + +lemma exc_zero_opp_x_to_exc_x_zero: + ∀G:pogroup.∀x:G. 0 ≰ -x → x ≰ 0. +intros (G x H); apply (plus_cancl_exc ??? (-x)); +apply (exc_rewr ???? (plus_comm ???)); +apply (exc_rewl ???? (opp_inverse ??)); +apply (exc_rewr ???? (zero_neutral ??) H); +qed. + +lemma le_x_zero_to_le_zero_opp_x: + ∀G:pogroup.∀x:G. x ≤ 0 → 0 ≤ -x. +intros (G x Lx0); apply (plus_cancr_le ??? x); +apply (le_rewr ??? 0 (opp_inverse ??)); +apply (le_rewl ??? x (zero_neutral ??)); +assumption; +qed. + +lemma lt_x_zero_to_lt_zero_opp_x: + ∀G:pogroup.∀x:G. x < 0 → 0 < -x. +intros (G x Lx0); apply (plus_cancr_lt ??? x); +apply (lt_rewr ??? 0 (opp_inverse ??)); +apply (lt_rewl ??? x (zero_neutral ??)); +assumption; +qed. + +lemma lt_opp_x_zero_to_lt_zero_x: + ∀G:pogroup.∀x:G. -x < 0 → 0 < x. +intros (G x Lx0); apply (plus_cancr_lt ??? (-x)); +apply (lt_rewl ??? (-x) (zero_neutral ??)); +apply (lt_rewr ??? (-x+x) (plus_comm ???)); +apply (lt_rewr ??? 0 (opp_inverse ??)); +assumption; +qed. + +lemma lt0plus_orlt: + ∀G:pogroup. ∀x,y:G. 0 ≤ x → 0 ≤ y → 0 < x + y → 0 < x ∨ 0 < y. +intros (G x y LEx LEy LT); cases LT (H1 H2); cases (ap_cotransitive ??? y H2); +[right; split; assumption|left;split;[assumption]] +apply (plus_cancr_ap ??? y); apply (ap_rewl ???? (zero_neutral ??)); +assumption; +qed. + +lemma le0plus_le: + ∀G:pogroup.∀a,b,c:G. 0 ≤ b → a + b ≤ c → a ≤ c. +intros (G a b c L H); apply (le_transitive ????? H); +apply (plus_cancl_le ??? (-a)); +apply (le_rewl ??? 0 (opp_inverse ??)); +apply (le_rewr ??? (-a + a + b) (plus_assoc ????)); +apply (le_rewr ??? (0 + b) (opp_inverse ??)); +apply (le_rewr ??? b (zero_neutral ??)); +assumption; +qed. + +lemma le_le0plus: + ∀G:pogroup.∀a,b:G. 0 ≤ a → 0 ≤ b → 0 ≤ a + b. +intros (G a b L1 L2); apply (le_transitive ???? L1); +apply (plus_cancl_le ??? (-a)); +apply (le_rewl ??? 0 (opp_inverse ??)); +apply (le_rewr ??? (-a + a + b) (plus_assoc ????)); +apply (le_rewr ??? (0 + b) (opp_inverse ??)); +apply (le_rewr ??? b (zero_neutral ??)); +assumption; +qed. + +lemma flt_plusl: + ∀G:pogroup.∀x,y,z:G.x < y → z + x < z + y. +intros (G x y z H); cases H; split; [apply fle_plusl; assumption] +apply fap_plusl; assumption; +qed. + +lemma flt_plusr: + ∀G:pogroup.∀x,y,z:G.x < y → x + z < y + z. +intros (G x y z H); cases H; split; [apply fle_plusr; assumption] +apply fap_plusr; assumption; +qed. + + +lemma ltxy_ltyyxx: ∀G:pogroup.∀x,y:G. y < x → y+y < x+x. +intros; apply (lt_transitive ?? (y+x));[2: + apply (lt_rewl ???? (plus_comm ???)); + apply (lt_rewr ???? (plus_comm ???));] +apply flt_plusl;assumption; +qed. + +lemma lew_opp : ∀O:pogroup.∀a,b,c:O.0 ≤ b → a ≤ c → a + -b ≤ c. +intros (O a b c L0 L); +apply (le_transitive ????? L); +apply (plus_cancl_le ??? (-a)); +apply (le_rewr ??? 0 (opp_inverse ??)); +apply (le_rewl ??? (-a+a+-b) (plus_assoc ????)); +apply (le_rewl ??? (0+-b) (opp_inverse ??)); +apply (le_rewl ??? (-b) (zero_neutral ?(-b))); +apply le_zero_x_to_le_opp_x_zero; +assumption; +qed. + +lemma ltw_opp : ∀O:pogroup.∀a,b,c:O.0 < b → a < c → a + -b < c. +intros (O a b c P L); +apply (lt_transitive ????? L); +apply (plus_cancl_lt ??? (-a)); +apply (lt_rewr ??? 0 (opp_inverse ??)); +apply (lt_rewl ??? (-a+a+-b) (plus_assoc ????)); +apply (lt_rewl ??? (0+-b) (opp_inverse ??)); +apply (lt_rewl ??? ? (zero_neutral ??)); +apply lt_zero_x_to_lt_opp_x_zero; +assumption; +qed. + +record togroup : Type ≝ { + tog_carr:> pogroup; + tog_total: ∀x,y:tog_carr.x≰y → y < x +}. + +lemma lexxyy_lexy: ∀G:togroup. ∀x,y:G. x+x ≤ y+y → x ≤ y. +intros (G x y H); intro H1; lapply (tog_total ??? H1) as H2; +lapply (ltxy_ltyyxx ??? H2) as H3; lapply (lt_to_excess ??? H3) as H4; +cases (H H4); +qed. + +lemma eqxxyy_eqxy: ∀G:togroup.∀x,y:G. x + x ≈ y + y → x ≈ y. +intros (G x y H); cases (eq_le_le ??? H); apply le_le_eq; +apply lexxyy_lexy; assumption; +qed. + +lemma applus_orap: ∀G:abelian_group. ∀x,y:G. 0 # x + y → 0 #x ∨ 0#y. +intros; cases (ap_cotransitive ??? y a); [right; assumption] +left; apply (plus_cancr_ap ??? y); apply (ap_rewl ???y (zero_neutral ??)); +assumption; +qed. + +lemma ltplus: ∀G:pogroup.∀a,b,c,d:G. a < b → c < d → a+c < b + d. +intros (G a b c d H1 H2); +lapply (flt_plusr ??? c H1) as H3; +apply (lt_transitive ???? H3); +apply flt_plusl; assumption; +qed. + +lemma excplus_orexc: ∀G:pogroup.∀a,b,c,d:G. a+c ≰ b + d → a ≰ b ∨ c ≰ d. +intros (G a b c d H1 H2); +cases (exc_cotransitive ??? (a + d) H1); [ + right; apply (plus_cancl_exc ??? a); assumption] +left; apply (plus_cancr_exc ??? d); assumption; +qed. + +lemma leplus: ∀G:pogroup.∀a,b,c,d:G. a ≤ b → c ≤ d → a+c ≤ b + d. +intros (G a b c d H1 H2); intro H3; cases (excplus_orexc ????? H3); +[apply H1|apply H2] assumption; +qed. + +lemma leplus_lt_le: ∀G:togroup.∀x,y:G. 0 ≤ x + y → x < 0 → 0 ≤ y. +intros; intro; apply H; lapply (lt_to_excess ??? l); +lapply (tog_total ??? e); +lapply (tog_total ??? Hletin); +lapply (ltplus ????? Hletin2 Hletin1); +apply (exc_rewl ??? (0+0)); [apply eq_sym; apply zero_neutral] +apply lt_to_excess; assumption; +qed. + +lemma ltplus_orlt: ∀G:togroup.∀a,b,c,d:G. a+c < b + d → a < b ∨ c < d. +intros (G a b c d H1 H2); lapply (lt_to_excess ??? H1); +cases (excplus_orexc ????? Hletin); [left|right] apply tog_total; assumption; +qed. + +lemma excplus: ∀G:togroup.∀a,b,c,d:G.a ≰ b → c ≰ d → a + c ≰ b + d. +intros (G a b c d L1 L2); +lapply (fexc_plusr ??? (c) L1) as L3; +elim (exc_cotransitive ??? (b+d) L3); [assumption] +lapply (plus_cancl_exc ???? t); lapply (tog_total ??? Hletin); +cases Hletin1; cases (H L2); +qed. diff --git a/matita/dama/premetric_lattice.ma b/matita/dama/premetric_lattice.ma new file mode 100644 index 000000000..d985ec24f --- /dev/null +++ b/matita/dama/premetric_lattice.ma @@ -0,0 +1,69 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/premetric_lattice/". + +include "metric_space.ma". + +record premetric_lattice_ (R : todgroup) : Type ≝ { + pml_carr:> metric_space R; + meet: pml_carr → pml_carr → pml_carr; + join: pml_carr → pml_carr → pml_carr +}. + +interpretation "valued lattice meet" 'and a b = + (cic:/matita/premetric_lattice/meet.con _ _ a b). + +interpretation "valued lattice join" 'or a b = + (cic:/matita/premetric_lattice/join.con _ _ a b). + +record premetric_lattice_props (R : todgroup) (ml : premetric_lattice_ R) : Prop ≝ { + prop1a: ∀a : ml.δ (a ∧ a) a ≈ 0; + prop1b: ∀a : ml.δ (a ∨ a) a ≈ 0; + prop2a: ∀a,b: ml. δ (a ∨ b) (b ∨ a) ≈ 0; + prop2b: ∀a,b: ml. δ (a ∧ b) (b ∧ a) ≈ 0; + prop3a: ∀a,b,c: ml. δ (a ∨ (b ∨ c)) ((a ∨ b) ∨ c) ≈ 0; + prop3b: ∀a,b,c: ml. δ (a ∧ (b ∧ c)) ((a ∧ b) ∧ c) ≈ 0; + prop4a: ∀a,b: ml. δ (a ∨ (a ∧ b)) a ≈ 0; + prop4b: ∀a,b: ml. δ (a ∧ (a ∨ b)) a ≈ 0; + prop5: ∀a,b,c: ml. δ (a ∨ b) (a ∨ c) + δ (a ∧ b) (a ∧ c) ≤ δ b c +}. + +record pmlattice (R : todgroup) : Type ≝ { + carr :> premetric_lattice_ R; + ispremetriclattice:> premetric_lattice_props R carr +}. + +include "lattice.ma". + +lemma lattice_of_pmlattice: ∀R: todgroup. pmlattice R → lattice. +intros (R pml); apply (mk_lattice (apart_of_metric_space ? pml)); +[apply (join ? pml)|apply (meet ? pml) +|3,4,5,6,7,8,9,10: intros (x y z); whd; intro H; whd in H; cases H (LE AP);] +[apply (prop1b ? pml pml x); |apply (prop1a ? pml pml x); +|apply (prop2a ? pml pml x y); |apply (prop2b ? pml pml x y); +|apply (prop3a ? pml pml x y z);|apply (prop3b ? pml pml x y z); +|apply (prop4a ? pml pml x y); |apply (prop4b ? pml pml x y);] +try (apply ap_symmetric; assumption); intros 4 (x y z H); change with (0 < (δ y z)); +[ change in H with (0 < δ (x ∨ y) (x ∨ z)); + apply (lt_le_transitive ???? H); + apply (le0plus_le ???? (mpositive ? pml ??) (prop5 ? pml pml x y z)); +| change in H with (0 < δ (x ∧ y) (x ∧ z)); + apply (lt_le_transitive ???? H); + apply (le0plus_le ???? (mpositive ? pml (x∨y) (x∨z))); + apply (le_rewl ??? ? (plus_comm ???)); + apply (prop5 ? pml pml);] +qed. + +coercion cic:/matita/premetric_lattice/lattice_of_pmlattice.con. \ No newline at end of file diff --git a/matita/dama/prevalued_lattice.ma b/matita/dama/prevalued_lattice.ma new file mode 100644 index 000000000..5f1a062e0 --- /dev/null +++ b/matita/dama/prevalued_lattice.ma @@ -0,0 +1,243 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/prevalued_lattice/". + +include "ordered_group.ma". + +record vlattice (R : togroup) : Type ≝ { + wl_carr:> Type; + value: wl_carr → R; + join: wl_carr → wl_carr → wl_carr; + meet: wl_carr → wl_carr → wl_carr; + meet_refl: ∀x. value (meet x x) ≈ value x; + join_refl: ∀x. value (join x x) ≈ value x; + meet_comm: ∀x,y. value (meet x y) ≈ value (meet y x); + join_comm: ∀x,y. value (join x y) ≈ value (join y x); + join_assoc: ∀x,y,z. value (join x (join y z)) ≈ value (join (join x y) z); + meet_assoc: ∀x,y,z. value (meet x (meet y z)) ≈ value (meet (meet x y) z); + meet_wins1: ∀x,y. value (join x (meet x y)) ≈ value x; + meet_wins2: ∀x,y. value (meet x (join x y)) ≈ value x; + modular_mjp: ∀x,y. value (join x y) + value (meet x y) ≈ value x + value y; + join_meet_le: ∀x,y,z. value (join x (meet y z)) ≤ value (join x y); + meet_join_le: ∀x,y,z. value (meet x y) ≤ value (meet x (join y z)) +}. + +interpretation "valued lattice meet" 'and a b = + (cic:/matita/prevalued_lattice/meet.con _ _ a b). + +interpretation "valued lattice join" 'or a b = + (cic:/matita/prevalued_lattice/join.con _ _ a b). + +notation < "\nbsp \mu a" non associative with precedence 80 for @{ 'value2 $a}. +interpretation "lattice value" 'value2 a = (cic:/matita/prevalued_lattice/value.con _ _ a). + +notation "\mu" non associative with precedence 80 for @{ 'value }. +interpretation "lattice value" 'value = (cic:/matita/prevalued_lattice/value.con _ _). + +lemma feq_joinr: ∀R.∀L:vlattice R.∀x,y,z:L. + μ x ≈ μ y → μ (z ∧ x) ≈ μ (z ∧ y) → μ (z ∨ x) ≈ μ (z ∨ y). +intros (R L x y z H H1); +apply (plus_cancr ??? (μ(z∧x))); +apply (Eq≈ (μz + μx) (modular_mjp ????)); +apply (Eq≈ (μz + μy) H); clear H; +apply (Eq≈ (μ(z∨y) + μ(z∧y)) (modular_mjp ??z y)); +apply (plus_cancl ??? (- μ (z ∨ y))); +apply (Eq≈ ? (plus_assoc ????)); +apply (Eq≈ (0+ μ(z∧y)) (opp_inverse ??)); +apply (Eq≈ ? (zero_neutral ??)); +apply (Eq≈ (- μ(z∨y)+ μ(z∨y)+ μ(z∧x)) ? (plus_assoc ????)); +apply (Eq≈ (0+ μ(z∧x)) ? (opp_inverse ??)); +apply (Eq≈ (μ (z ∧ x)) H1 (zero_neutral ??)); +qed. + +lemma modularj: ∀R.∀L:vlattice R.∀y,z:L. μ(y∨z) ≈ μy + μz + -μ (y ∧ z). +intros (R L y z); +lapply (modular_mjp ?? y z) as H1; +apply (plus_cancr ??? (μ(y ∧ z))); +apply (Eq≈ ? H1); clear H1; +apply (Eq≈ ?? (plus_assoc ????)); +apply (Eq≈ (μy+ μz + 0) ? (opp_inverse ??)); +apply (Eq≈ ?? (plus_comm ???)); +apply (Eq≈ (μy + μz) ? (eq_sym ??? (zero_neutral ??))); +apply eq_reflexive. +qed. + +lemma modularm: ∀R.∀L:vlattice R.∀y,z:L. μ(y∧z) ≈ μy + μz + -μ (y ∨ z). +(* CSC: questa è la causa per cui la hint per cercare i duplicati ci sta 1 mese *) +(* exact modularj; *) +intros (R L y z); +lapply (modular_mjp ?? y z) as H1; +apply (plus_cancl ??? (μ(y ∨ z))); +apply (Eq≈ ? H1); clear H1; +apply (Eq≈ ?? (plus_comm ???)); +apply (Eq≈ ?? (plus_assoc ????)); +apply (Eq≈ (μy+ μz + 0) ? (opp_inverse ??)); +apply (Eq≈ ?? (plus_comm ???)); +apply (Eq≈ (μy + μz) ? (eq_sym ??? (zero_neutral ??))); +apply eq_reflexive. +qed. + +lemma modularmj: ∀R.∀L:vlattice R.∀x,y,z:L.μ(x∧(y∨z))≈(μx + μ(y ∨ z) + - μ(x∨(y∨z))). +intros (R L x y z); +lapply (modular_mjp ?? x (y ∨ z)) as H1; +apply (Eq≈ (μ(x∨(y∨z))+ μ(x∧(y∨z)) +-μ(x∨(y∨z))) ? (feq_plusr ???? H1)); clear H1; +apply (Eq≈ ? ? (plus_comm ???)); +apply (Eq≈ (- μ(x∨(y∨z))+ μ(x∨(y∨z))+ μ(x∧(y∨z))) ? (plus_assoc ????)); +apply (Eq≈ (0+μ(x∧(y∨z))) ? (opp_inverse ??)); +apply (Eq≈ (μ(x∧(y∨z))) ? (zero_neutral ??)); +apply eq_reflexive. +qed. + +lemma modularjm: ∀R.∀L:vlattice R.∀x,y,z:L.μ(x∨(y∧z))≈(μx + μ(y ∧ z) + - μ(x∧(y∧z))). +intros (R L x y z); +lapply (modular_mjp ?? x (y ∧ z)) as H1; +apply (Eq≈ (μ(x∧(y∧z))+ μ(x∨(y∧z)) +-μ(x∧(y∧z)))); [2: apply feq_plusr; apply (eq_trans ???? (plus_comm ???)); apply H1] clear H1; +apply (Eq≈ ? ? (plus_comm ???)); +apply (Eq≈ (- μ(x∧(y∧z))+ μ(x∧(y∧z))+ μ(x∨y∧z)) ? (plus_assoc ????)); +apply (Eq≈ (0+ μ(x∨y∧z)) ? (opp_inverse ??)); +apply eq_sym; apply zero_neutral; +qed. + +lemma step1_3_57': ∀R.∀L:vlattice R.∀x,y,z:L. + μ(x ∨ (y ∧ z)) ≈ (μ x) + (μ y) + μ z + -μ (y ∨ z) + -μ (z ∧ (x ∧ y)). +intros (R L x y z); +apply (Eq≈ ? (modularjm ?? x y z)); +apply (Eq≈ ( μx+ (μy+ μz+- μ(y∨z)) +- μ(x∧(y∧z)))); [ + apply feq_plusr; apply feq_plusl; apply (modularm ?? y z);] +apply (Eq≈ (μx+ μy+ μz+- μ(y∨z)+- μ(x∧(y∧z)))); [2: + apply feq_plusl; apply feq_opp; + apply (Eq≈ ? (meet_assoc ?????)); + apply (Eq≈ ? (meet_comm ????)); + apply eq_reflexive;] +apply feq_plusr; apply (Eq≈ ? (plus_assoc ????)); +apply feq_plusr; apply plus_assoc; +qed. + +lemma step1_3_57: ∀R.∀L:vlattice R.∀x,y,z:L. + μ(x ∧ (y ∨ z)) ≈ (μ x) + (μ y) + μ z + -μ (y ∧ z) + -μ (z ∨ (x ∨ y)). +intros (R L x y z); +apply (Eq≈ ? (modularmj ?? x y z)); +apply (Eq≈ ( μx+ (μy+ μz+- μ(y∧z)) +- μ(x∨(y∨z)))); [ + apply feq_plusr; apply feq_plusl; apply (modularj ?? y z);] +apply (Eq≈ (μx+ μy+ μz+- μ(y∧z)+- μ(x∨(y∨z)))); [2: + apply feq_plusl; apply feq_opp; + apply (Eq≈ ? (join_assoc ?????)); + apply (Eq≈ ? (join_comm ????)); + apply eq_reflexive;] +apply feq_plusr; apply (Eq≈ ? (plus_assoc ????)); +apply feq_plusr; apply plus_assoc; +qed. + +(* LEMMA 3.57 *) + +lemma join_meet_le_join: ∀R.∀L:vlattice R.∀x,y,z:L.μ (x ∨ (y ∧ z)) ≤ μ (x ∨ z). +intros (R L x y z); +apply (le_rewl ??? ? (eq_sym ??? (step1_3_57' ?????))); +apply (le_rewl ??? (μx+ μy+ μz+- μ(y∨z)+ -μ(z∧x∧y))); [ + apply feq_plusl; apply feq_opp; apply (eq_trans ?? ? ?? (eq_sym ??? (meet_assoc ?????))); apply eq_reflexive;] +apply (le_rewl ??? (μx+ μy+ μz+- μ(y∨z)+ (- ( μ(z∧x)+ μy+- μ((z∧x)∨y))))); [ + apply feq_plusl; apply feq_opp; apply eq_sym; apply modularm] +apply (le_rewl ??? (μx+ μy+ μz+- μ(y∨z)+ (- μ(z∧x)+ -μy+-- μ((z∧x)∨y)))); [ + apply feq_plusl; apply (Eq≈ (- (μ(z∧x)+ μy) + -- μ((z∧x)∨y))); [ + apply feq_plusr; apply eq_sym; apply eq_opp_plus_plus_opp_opp;] + apply eq_sym; apply eq_opp_plus_plus_opp_opp;] +apply (le_rewl ??? (μx+ μy+ μz+- μ(y∨z)+(- μ(z∧x)+- μy+ μ(y∨(z∧x))))); [ + repeat apply feq_plusl; apply eq_sym; apply (Eq≈ (μ((z∧x)∨y)) (eq_opp_opp_x_x ??)); + apply join_comm;] +apply (le_rewl ??? (μx+ μy+ μz+- μ(y∨z)+(- μ(z∧x)+- μy)+ μ(y∨(z∧x)))); [ + apply eq_sym; apply plus_assoc;] +apply (le_rewl ??? (μx+ μy+ μz+- μ(y∨z)+(- μy + - μ(z∧x))+ μ(y∨(z∧x)))); [ + repeat apply feq_plusr; repeat apply feq_plusl; apply plus_comm;] +apply (le_rewl ??? (μx+ μy+ μz+- μ(y∨z)+- μy + - μ(z∧x)+ μ(y∨(z∧x)))); [ + repeat apply feq_plusr; apply eq_sym; apply plus_assoc;] +apply (le_rewl ??? (μx+ μy+ μz+- μy + - μ(y∨z)+- μ(z∧x)+ μ(y∨(z∧x)))); [ + repeat apply feq_plusr; apply (eq_trans ?? ? ?? (plus_assoc ????)); + apply (Eq≈ ( μx+ μy+ μz+(- μy+- μ(y∨z))) (eq_sym ??? (plus_assoc ????))); + apply feq_plusl; apply plus_comm;] +apply (le_rewl ??? (μx+ μy+ -μy+ μz + - μ(y∨z)+- μ(z∧x)+ μ(y∨(z∧x)))); [ + repeat apply feq_plusr; apply (eq_trans ?? ? ?? (plus_assoc ????)); + apply (Eq≈ (μx+ μy+( -μy+ μz)) (eq_sym ??? (plus_assoc ????))); + apply feq_plusl; apply plus_comm;] +apply (le_rewl ??? (μx+ 0 + μz + - μ(y∨z)+- μ(z∧x)+ μ(y∨(z∧x)))); [ + repeat apply feq_plusr; apply (eq_trans ?? ? ?? (plus_assoc ????)); + apply feq_plusl; apply eq_sym; apply (eq_trans ?? ? ? (plus_comm ???)); + apply opp_inverse; apply eq_reflexive;] +apply (le_rewl ??? (μx+ μz + - μ(y∨z)+- μ(z∧x)+ μ(y∨(z∧x)))); [ + repeat apply feq_plusr; apply (eq_trans ?? ? ?? (plus_comm ???)); + apply eq_sym; apply zero_neutral;] +apply (le_rewl ??? (μz+ μx + - μ(y∨z)+- μ(z∧x)+ μ(y∨(z∧x)))); [ + repeat apply feq_plusr; apply plus_comm;] +apply (le_rewl ??? (μz+ μx +- μ(z∧x)+ - μ(y∨z)+ μ(y∨(z∧x)))); [ + repeat apply feq_plusr; apply (eq_trans ?? ? ?? (plus_assoc ????)); + apply (eq_trans ?? ? ? (eq_sym ??? (plus_assoc ????))); apply feq_plusl; + apply plus_comm;] +apply (le_rewl ??? (μ(z∨x)+ - μ(y∨z)+ μ(y∨(z∧x)))); [ + repeat apply feq_plusr; apply modularj;] +apply (le_rewl ??? (μ(z∨x)+ (- μ(y∨z)+ μ(y∨(z∧x)))) (plus_assoc ????)); +apply (le_rewr ??? (μ(x∨z) + 0)); [apply (eq_trans ?? ? ? (plus_comm ???)); apply zero_neutral] +apply (le_rewr ??? (μ(x∨z) + (-μ(y∨z) + μ(y∨z)))); [ apply feq_plusl; apply opp_inverse] +apply (le_rewr ??? (μ(z∨x) + (-μ(y∨z) + μ(y∨z)))); [ apply feq_plusr; apply join_comm;] +repeat apply fle_plusl; apply join_meet_le; +qed. + +lemma meet_le_meet_join: ∀R.∀L:vlattice R.∀x,y,z:L.μ (x ∧ z) ≤ μ (x ∧ (y ∨ z)). +intros (R L x y z); +apply (le_rewr ??? ? (eq_sym ??? (step1_3_57 ?????))); +apply (le_rewr ??? (μx+ μy+ μz+- μ(y∧z)+ -μ(z∨x∨y))); [ + apply feq_plusl; apply feq_opp; apply (eq_trans ?? ? ?? (eq_sym ??? (join_assoc ?????))); apply eq_reflexive;] +apply (le_rewr ??? (μx+ μy+ μz+- μ(y∧z)+ (- ( μ(z∨x)+ μy+- μ((z∨x)∧y))))); [ + apply feq_plusl; apply feq_opp; apply eq_sym; apply modularj] +apply (le_rewr ??? (μx+ μy+ μz+- μ(y∧z)+ (- μ(z∨x)+ -μy+-- μ((z∨x)∧y)))); [ + apply feq_plusl; apply (Eq≈ (- (μ(z∨x)+ μy) + -- μ((z∨x)∧y))); [ + apply feq_plusr; apply eq_sym; apply eq_opp_plus_plus_opp_opp;] + apply eq_sym; apply eq_opp_plus_plus_opp_opp;] +apply (le_rewr ??? (μx+ μy+ μz+- μ(y∧z)+(- μ(z∨x)+- μy+ μ(y∧(z∨x))))); [ + repeat apply feq_plusl; apply eq_sym; apply (Eq≈ (μ((z∨x)∧y)) (eq_opp_opp_x_x ??)); + apply meet_comm;] +apply (le_rewr ??? (μx+ μy+ μz+- μ(y∧z)+(- μ(z∨x)+- μy)+ μ(y∧(z∨x)))); [ + apply eq_sym; apply plus_assoc;] +apply (le_rewr ??? (μx+ μy+ μz+- μ(y∧z)+(- μy + - μ(z∨x))+ μ(y∧(z∨x)))); [ + repeat apply feq_plusr; repeat apply feq_plusl; apply plus_comm;] +apply (le_rewr ??? (μx+ μy+ μz+- μ(y∧z)+- μy + - μ(z∨x)+ μ(y∧(z∨x)))); [ + repeat apply feq_plusr; apply eq_sym; apply plus_assoc;] +apply (le_rewr ??? (μx+ μy+ μz+- μy + - μ(y∧z)+- μ(z∨x)+ μ(y∧(z∨x)))); [ + repeat apply feq_plusr; apply (eq_trans ?? ? ?? (plus_assoc ????)); + apply (Eq≈ ( μx+ μy+ μz+(- μy+- μ(y∧z))) (eq_sym ??? (plus_assoc ????))); + apply feq_plusl; apply plus_comm;] +apply (le_rewr ??? (μx+ μy+ -μy+ μz + - μ(y∧z)+- μ(z∨x)+ μ(y∧(z∨x)))); [ + repeat apply feq_plusr; apply (Eq≈ ?? (plus_assoc ????)); + apply (Eq≈ (μx+ μy+( -μy+ μz)) (eq_sym ??? (plus_assoc ????))); + apply feq_plusl; apply plus_comm;] +apply (le_rewr ??? (μx+ 0 + μz + - μ(y∧z)+- μ(z∨x)+ μ(y∧(z∨x)))); [ + repeat apply feq_plusr; apply (eq_trans ?? ? ?? (plus_assoc ????)); + apply feq_plusl; apply eq_sym; apply (eq_trans ?? ? ? (plus_comm ???)); + apply opp_inverse; apply eq_reflexive;] +apply (le_rewr ??? (μx+ μz + - μ(y∧z)+- μ(z∨x)+ μ(y∧(z∨x)))); [ + repeat apply feq_plusr; apply (eq_trans ?? ? ?? (plus_comm ???)); + apply eq_sym; apply zero_neutral;] +apply (le_rewr ??? (μz+ μx + - μ(y∧z)+- μ(z∨x)+ μ(y∧(z∨x)))); [ + repeat apply feq_plusr; apply plus_comm;] +apply (le_rewr ??? (μz+ μx +- μ(z∨x)+ - μ(y∧z)+ μ(y∧(z∨x)))); [ + repeat apply feq_plusr; apply (eq_trans ?? ? ?? (plus_assoc ????)); + apply (eq_trans ?? ? ? (eq_sym ??? (plus_assoc ????))); apply feq_plusl; + apply plus_comm;] +apply (le_rewr ??? (μ(z∧x)+ - μ(y∧z)+ μ(y∧(z∨x)))); [ + repeat apply feq_plusr; apply modularm;] +apply (le_rewr ??? (μ(z∧x)+ (- μ(y∧z)+ μ(y∧(z∨x)))) (plus_assoc ????)); +apply (le_rewl ??? (μ(x∧z) + 0)); [apply (eq_trans ?? ? ? (plus_comm ???)); apply zero_neutral] +apply (le_rewl ??? (μ(x∧z) + (-μ(y∧z) + μ(y∧z)))); [ apply feq_plusl; apply opp_inverse] +apply (le_rewl ??? (μ(z∧x) + (-μ(y∧z) + μ(y∧z)))); [ apply feq_plusr; apply meet_comm;] +repeat apply fle_plusl; apply meet_join_le; +qed. diff --git a/matita/dama/sandwich.ma b/matita/dama/sandwich.ma new file mode 100644 index 000000000..21499ee72 --- /dev/null +++ b/matita/dama/sandwich.ma @@ -0,0 +1,81 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/sandwich/". + +include "nat/plus.ma". +include "nat/orders.ma". + +lemma ltwl: ∀a,b,c:nat. b + a < c → a < c. +intros 3 (x y z); elim y (H z IH H); [apply H] +apply IH; apply lt_S_to_lt; apply H; +qed. + +lemma ltwr: ∀a,b,c:nat. a + b < c → a < c. +intros 3 (x y z); rewrite > sym_plus; apply ltwl; +qed. + +include "sequence.ma". +include "metric_lattice.ma". + +definition d2s ≝ + λR.λml:mlattice R.λs:sequence ml.λk.λn. δ (s n) k. + +notation "s ⇝ x" non associative with precedence 50 for @{'tends $s $x}. + +interpretation "tends to" 'tends s x = + (cic:/matita/sequence/tends0.con _ (cic:/matita/sandwich/d2s.con _ _ s x)). + +alias symbol "and" = "constructive and". +theorem sandwich: + ∀R.∀ml:mlattice R.∀an,bn,xn:sequence ml.∀x:ml. + (∀n. (an n ≤ xn n) ∧ (xn n ≤ bn n)) → + an ⇝ x → bn ⇝ x → xn ⇝ x. +intros (R ml an bn xn x H Ha Hb); +unfold tends0 in Ha Hb ⊢ %; unfold d2s in Ha Hb ⊢ %; intros (e He); +alias num (instance 0) = "natural number". +cases (Ha (e/2) (divide_preserves_lt ??? He)) (n1 H1); clear Ha; +cases (Hb (e/2) (divide_preserves_lt ??? He)) (n2 H2); clear Hb; +apply (ex_introT ?? (n1+n2)); intros (n3 Lt_n1n2_n3); +lapply (ltwr ??? Lt_n1n2_n3) as Lt_n1n3; lapply (ltwl ??? Lt_n1n2_n3) as Lt_n2n3; +cases (H1 ? Lt_n1n3) (c daxe); cases (H2 ? Lt_n2n3) (c dbxe); +cases (H n3) (H7 H8); clear Lt_n1n3 Lt_n2n3 Lt_n1n2_n3 c H1 H2 H n1 n2; +(* the main inequality *) +cut (δ (xn n3) x ≤ δ (bn n3) x + δ (an n3) x + δ (an n3) x) as main_ineq; [2: + apply (le_transitive ???? (mtineq ???? (an n3))); + cut ( δ(an n3) (bn n3)+- δ(xn n3) (bn n3)≈( δ(an n3) (xn n3))) as H11; [2: + lapply (le_mtri ????? H7 H8) as H9; clear H7 H8; + lapply (feq_plusr ? (- δ(xn n3) (bn n3)) ?? H9) as H10; clear H9; + apply (Eq≈ (0 + δ(an n3) (xn n3)) ? (zero_neutral ??)); + apply (Eq≈ (δ(an n3) (xn n3) + 0) ? (plus_comm ???)); + apply (Eq≈ (δ(an n3) (xn n3) + (-δ(xn n3) (bn n3) +  δ(xn n3) (bn n3))) ? (opp_inverse ??)); + apply (Eq≈ (δ(an n3) (xn n3) + (δ(xn n3) (bn n3) + -δ(xn n3) (bn n3))) ? (plus_comm ?? (δ(xn n3) (bn n3)))); + apply (Eq≈ ?? (eq_sym ??? (plus_assoc ????))); assumption;] + apply (Le≪ (δ(an n3) (xn n3)+ δ(an n3) x) (msymmetric ??(an n3)(xn n3))); + apply (Le≪ (δ(an n3) (bn n3)+- δ(xn n3) (bn n3)+ δ(an n3) x) H11); + apply (Le≪ (- δ(xn n3) (bn n3)+ δ(an n3) (bn n3)+δ(an n3) x) (plus_comm ??(δ(an n3) (bn n3)))); + apply (Le≪ (- δ(xn n3) (bn n3)+ (δ(an n3) (bn n3)+δ(an n3) x)) (plus_assoc ????)); + apply (Le≪ ((δ(an n3) (bn n3)+δ(an n3) x)+- δ(xn n3) (bn n3)) (plus_comm ???)); + apply lew_opp; [apply mpositive] apply fle_plusr; + apply (Le≫ ? (plus_comm ???)); + apply (Le≫ ( δ(an n3) x+ δx (bn n3)) (msymmetric ????)); + apply mtineq;] +split; [ (* first the trivial case: -e< δ(xn n3) x *) + apply (lt_le_transitive ????? (mpositive ????)); + apply lt_zero_x_to_lt_opp_x_zero; assumption;] +(* the main goal: δ(xn n3) x is_bounded_below ? a; + ib_bounded_above:> is_bounded_above ? a + }. + +record bounded_below_sequence (O:excess) : Type ≝ + { bbs_seq:> sequence O; + bbs_is_bounded_below:> is_bounded_below ? bbs_seq + }. + +record bounded_above_sequence (O:excess) : Type ≝ + { bas_seq:> sequence O; + bas_is_bounded_above:> is_bounded_above ? bas_seq + }. + +record bounded_sequence (O:excess) : Type ≝ + { bs_seq:> sequence O; + bs_is_bounded_below: is_bounded_below ? bs_seq; + bs_is_bounded_above: is_bounded_above ? bs_seq + }. + +definition bounded_below_sequence_of_bounded_sequence ≝ + λO:excess.λb:bounded_sequence O. + mk_bounded_below_sequence ? b (bs_is_bounded_below ? b). + +coercion cic:/matita/sequence/bounded_below_sequence_of_bounded_sequence.con. + +definition bounded_above_sequence_of_bounded_sequence ≝ + λO:excess.λb:bounded_sequence O. + mk_bounded_above_sequence ? b (bs_is_bounded_above ? b). + +coercion cic:/matita/sequence/bounded_above_sequence_of_bounded_sequence.con. + +definition lower_bound ≝ + λO:excess.λb:bounded_below_sequence O. + ib_lower_bound ? b (bbs_is_bounded_below ? b). + +lemma lower_bound_is_lower_bound: + ∀O:excess.∀b:bounded_below_sequence O. + is_lower_bound ? b (lower_bound ? b). +intros; unfold lower_bound; apply ib_lower_bound_is_lower_bound. +qed. + +definition upper_bound ≝ + λO:excess.λb:bounded_above_sequence O. + ib_upper_bound ? b (bas_is_bounded_above ? b). + +lemma upper_bound_is_upper_bound: + ∀O:excess.∀b:bounded_above_sequence O. + is_upper_bound ? b (upper_bound ? b). +intros; unfold upper_bound; apply ib_upper_bound_is_upper_bound. +qed. + +definition reverse_excess: excess → excess. +intros (E); apply (mk_excess E); [apply (λx,y.exc_relation E y x)] +cases E (T f cRf cTf); simplify; +[1: unfold Not; intros (x H); apply (cRf x); assumption +|2: intros (x y z); apply Or_symmetric; apply cTf; assumption;] +qed. + +definition reverse_excess: excess → excess. +intros (p); apply (mk_excess (reverse_excess p)); +generalize in match (reverse_excess p); intros (E); +apply mk_is_porder_relation; +[apply le_reflexive|apply le_transitive|apply le_antisymmetric] +qed. + +lemma is_lower_bound_reverse_is_upper_bound: + ∀O:excess.∀a:sequence O.∀l:O. + is_lower_bound O a l → is_upper_bound (reverse_excess O) a l. +intros (O a l H); unfold; intros (n); unfold reverse_excess; +unfold reverse_excess; simplify; fold unfold le (le ? l (a n)); apply H; +qed. + +lemma is_upper_bound_reverse_is_lower_bound: + ∀O:excess.∀a:sequence O.∀l:O. + is_upper_bound O a l → is_lower_bound (reverse_excess O) a l. +intros (O a l H); unfold; intros (n); unfold reverse_excess; +unfold reverse_excess; simplify; fold unfold le (le ? (a n) l); apply H; +qed. + +lemma reverse_is_lower_bound_is_upper_bound: + ∀O:excess.∀a:sequence O.∀l:O. + is_lower_bound (reverse_excess O) a l → is_upper_bound O a l. +intros (O a l H); unfold; intros (n); unfold reverse_excess in H; +unfold reverse_excess in H; simplify in H; apply H; +qed. + +lemma reverse_is_upper_bound_is_lower_bound: + ∀O:excess.∀a:sequence O.∀l:O. + is_upper_bound (reverse_excess O) a l → is_lower_bound O a l. +intros (O a l H); unfold; intros (n); unfold reverse_excess in H; +unfold reverse_excess in H; simplify in H; apply H; +qed. + +lemma is_inf_to_reverse_is_sup: + ∀O:excess.∀a:bounded_below_sequence O.∀l:O. + is_inf O a l → is_sup (reverse_excess O) a l. +intros (O a l H); apply (mk_is_sup (reverse_excess O)); +[1: apply is_lower_bound_reverse_is_upper_bound; apply inf_lower_bound; assumption +|2: unfold reverse_excess; simplify; unfold reverse_excess; simplify; + intros (m H1); apply (inf_greatest_lower_bound ? ? ? H); apply H1;] +qed. + +lemma is_sup_to_reverse_is_inf: + ∀O:excess.∀a:bounded_above_sequence O.∀l:O. + is_sup O a l → is_inf (reverse_excess O) a l. +intros (O a l H); apply (mk_is_inf (reverse_excess O)); +[1: apply is_upper_bound_reverse_is_lower_bound; apply sup_upper_bound; assumption +|2: unfold reverse_excess; simplify; unfold reverse_excess; simplify; + intros (m H1); apply (sup_least_upper_bound ? ? ? H); apply H1;] +qed. + +lemma reverse_is_sup_to_is_inf: + ∀O:excess.∀a:bounded_above_sequence O.∀l:O. + is_sup (reverse_excess O) a l → is_inf O a l. +intros (O a l H); apply mk_is_inf; +[1: apply reverse_is_upper_bound_is_lower_bound; + apply (sup_upper_bound (reverse_excess O)); assumption +|2: intros (v H1); apply (sup_least_upper_bound (reverse_excess O) a l H v); + apply is_lower_bound_reverse_is_upper_bound; assumption;] +qed. + +lemma reverse_is_inf_to_is_sup: + ∀O:excess.∀a:bounded_above_sequence O.∀l:O. + is_inf (reverse_excess O) a l → is_sup O a l. +intros (O a l H); apply mk_is_sup; +[1: apply reverse_is_lower_bound_is_upper_bound; + apply (inf_lower_bound (reverse_excess O)); assumption +|2: intros (v H1); apply (inf_greatest_lower_bound (reverse_excess O) a l H v); + apply is_upper_bound_reverse_is_lower_bound; assumption;] +qed. + +*) \ No newline at end of file diff --git a/matita/dama_didactic/bottom.ma b/matita/dama_didactic/bottom.ma new file mode 100644 index 000000000..bed8ec6b1 --- /dev/null +++ b/matita/dama_didactic/bottom.ma @@ -0,0 +1,117 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/decl". + +include "nat/times.ma". +include "nat/orders.ma". + +inductive L (T:Type):Type:= + bottom: L T + |j: T → L T. + +inductive eq (T:Type) : L T → L T → Prop := + eq_refl:∀x:T. eq T (j ? x) (j ? x). + +notation "hvbox(a break ≡ b)" + non associative with precedence 45 +for @{ 'equiv $a $b }. + +interpretation "uguaglianza parziale" 'equiv x y = + (cic:/matita/test/decl/eq.ind#xpointer(1/1) _ x y). + +coercion cic:/matita/test/decl/L.ind#xpointer(1/1/2). + +lemma sim: ∀T:Type. ∀x,y:T. (j ? x) ≡ (j ? y) → (j ? y) ≡ (j ? x). + intros. + inversion H. + intros. + apply eq_refl. +qed. + +lemma trans: ∀T:Type. ∀x,y,z:T. + (j ? x) ≡ (j ? y) → (j ? y) ≡ (j ? z) → (j ? x) ≡ (j ? z). + intros. + inversion H1. + intros. + rewrite > H2 in H. + assumption. +qed. + +axiom R:Type. +axiom R0:R. +axiom R1:R. +axiom Rplus: L R→L R→L R. +axiom Rmult: L R→L R→L R.(* +axiom Rdiv: L R→L R→L R.*) +axiom Rinv: L R→L R. +axiom Relev: L R→L R→L R. +axiom Rle: L R→L R→Prop. +axiom Rge: L R→L R→Prop. + +interpretation "real plus" 'plus x y = + (cic:/matita/test/decl/Rplus.con x y). + +interpretation "real leq" 'leq x y = + (cic:/matita/test/decl/Rle.con x y). + +interpretation "real geq" 'geq x y = + (cic:/matita/test/decl/Rge.con x y). + +let rec elev (x:L R) (n:nat) on n: L R ≝ + match n with + [O ⇒ match x with [bottom ⇒ bottom ? | j y ⇒ (j ? R1)] + | S n ⇒ Rmult x (elev x n) + ]. + +let rec real_of_nat (n:nat) : L R ≝ + match n with + [ O ⇒ (j ? R0) + | S n ⇒ real_of_nat n + (j ? R1) + ]. + +coercion cic:/matita/test/decl/real_of_nat.con. + +axiom Rplus_commutative: ∀x,y:R. (j ? x) + (j ? y) ≡ (j ? y) + (j ? x). +axiom R0_neutral: ∀x:R. (j ? x) + (j ? R0) ≡ (j ? x). +axiom Rmult_commutative: ∀x,y:R. Rmult (j ? x) (j ? y) ≡ Rmult (j ? y) (j ? x). +axiom R1_neutral: ∀x:R. Rmult (j ? x) (j ? R1) ≡ (j ? x). + +axiom Rinv_ok: + ∀x:R. ¬((j ? x) ≡ (j ? R0)) → Rmult (Rinv (j ? x)) (j ? x) ≡ (j ? R1). +definition is_defined := + λ T:Type. λ x:L T. ∃y:T. x = (j ? y). +axiom Rinv_ok2: ∀x:L R. ¬(x = bottom ?) → ¬(x ≡ (j ? R0)) → is_defined ? (Rinv x). + +definition Rdiv := + λ x,y:L R. Rmult x (Rinv y). + +(* +lemma pippo: ∀x:R. ¬((j ? x) ≡ (j ? R0)) → Rdiv (j ? R1) (j ? x) ≡ Rinv (j ? x). + intros. + unfold Rdiv. + elim (Rinv_ok2 ? ? H). + rewrite > H1. + rewrite > Rmult_commutative. + apply R1_neutral. +*) + +axiom Rdiv_le: ∀x,y:R. (j ? R1) ≤ (j ? y) → Rdiv (j ? x) (j ? y) ≤ (j ? x). +axiom R2_1: (j ? R1) ≤ S (S O). + + +axiom Rdiv_pos: ∀ x,y:R. + (j ? R0) ≤ (j ? x) → (j ? R1) ≤ (j ? y) → (j ? R0) ≤ Rdiv (j ? x) (j ? y). +axiom Rle_R0_R1: (j ? R0) ≤ (j ? R1). +axiom div: ∀x:R. (j ? x) = Rdiv (j ? x) (S (S O)) → (j ? x) = O. \ No newline at end of file diff --git a/matita/dama_didactic/deriv.ma b/matita/dama_didactic/deriv.ma new file mode 100644 index 000000000..9619b94ba --- /dev/null +++ b/matita/dama_didactic/deriv.ma @@ -0,0 +1,114 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/didactic/deriv". + +include "reals.ma". + +axiom F:Type.(*F=funzioni regolari*) +axiom fplus:F→F→F. +axiom fmult:F→F→F. +axiom fcomp:F→F→F. + +axiom De: F→F. (*funzione derivata*) +notation "a '" + non associative with precedence 80 +for @{ 'deriv $a }. +interpretation "function derivative" 'deriv x = + (cic:/matita/didactic/deriv/De.con x). +interpretation "function mult" 'mult x y = + (cic:/matita/didactic/deriv/fmult.con x y). +interpretation "function compositon" 'compose x y = + (cic:/matita/didactic/deriv/fcomp.con x y). + +notation "hvbox(a break + b)" + right associative with precedence 45 +for @{ 'oplus $a $b }. + +interpretation "function plus" 'plus x y = + (cic:/matita/didactic/deriv/fplus.con x y). + +axiom i:R→F. (*mappatura R in F*) +coercion cic:/matita/didactic/deriv/i.con. +axiom i_comm_plus: ∀x,y:R. (i (x+y)) = (i x) + (i y). +axiom i_comm_mult: ∀x,y:R. (i (Rmult x y)) = (i x) · (i y). + +axiom freflex:F. +notation "ρ" + non associative with precedence 100 +for @{ 'rho }. +interpretation "function flip" 'rho = + cic:/matita/didactic/deriv/freflex.con. +axiom reflex_ok: ∀f:F. ρ ∘ f = (i (-R1)) · f. +axiom dereflex: ρ ' = i (-R1). (*Togliere*) + +axiom id:F. (* Funzione identita' *) +axiom fcomp_id_neutral: ∀f:F. f ∘ id = f. +axiom fcomp_id_commutative: ∀f:F. f ∘ id = id ∘ f. +axiom deid: id ' = i R1. +axiom rho_id: ρ ∘ ρ = id. + +lemma rho_disp: ρ = ρ ∘ (ρ ∘ ρ). + we need to prove (ρ = ρ ∘ (ρ ∘ ρ)). + by _ done. +qed. + +lemma id_disp: id = ρ ∘ (id ∘ ρ). + we need to prove (id = ρ ∘ (id ∘ ρ)). + by _ done. +qed. + +let rec felev (f:F) (n:nat) on n: F ≝ + match n with + [ O ⇒ i R1 + | S n ⇒ f · (felev f n) + ]. + +(* Proprietà *) + +axiom fplus_commutative: ∀ f,g:F. f + g = g + f. +axiom fplus_associative: ∀ f,g,h:F. f + (g + h) = (f + g) + h. +axiom fplus_neutral: ∀f:F. (i R0) + f = f. +axiom fmult_commutative: ∀ f,g:F. f · g = g · f. +axiom fmult_associative: ∀ f,g,h:F. f · (g · h) = (f · g) · h. +axiom fmult_neutral: ∀f:F. (i R1) · f = f. +axiom fmult_assorb: ∀f:F. (i R0) · f = (i R0). +axiom fdistr: ∀ f,g,h:F. (f + g) · h = (f · h) + (g · h). +axiom fcomp_associative: ∀ f,g,h:F. f ∘ (g ∘ h) = (f ∘ g) ∘ h. + +axiom fcomp_distr1: ∀ f,g,h:F. (f + g) ∘ h = (f ∘ h) + (g ∘ h). +axiom fcomp_distr2: ∀ f,g,h:F. (f · g) ∘ h = (f ∘ h) · (g ∘ h). + +axiom demult: ∀ f,g:F. (f · g) ' = (f ' · g) + (f · g '). +axiom decomp: ∀ f,g:F. (f ∘ g) ' = (f ' ∘ g) · g '. +axiom deplus: ∀ f,g:F. (f + g) ' = (f ') + (g '). + +axiom cost_assorb: ∀x:R. ∀f:F. (i x) ∘ f = i x. +axiom cost_deriv: ∀x:R. (i x) ' = i R0. + + +definition fpari ≝ λ f:F. f = f ∘ ρ. +definition fdispari ≝ λ f:F. f = ρ ∘ (f ∘ ρ). +axiom cost_pari: ∀ x:R. fpari (i x). + +axiom meno_piu_i: (i (-R1)) · (i (-R1)) = i R1. + +notation "hvbox(a break ^ b)" + right associative with precedence 75 +for @{ 'elev $a $b }. + +interpretation "function power" 'elev x y = + (cic:/matita/didactic/deriv/felev.con x y). + +axiom tech1: ∀n,m. F_OF_nat n + F_OF_nat m = F_OF_nat (n + m). diff --git a/matita/dama_didactic/ex_deriv.ma b/matita/dama_didactic/ex_deriv.ma new file mode 100644 index 000000000..b451a0acc --- /dev/null +++ b/matita/dama_didactic/ex_deriv.ma @@ -0,0 +1,247 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/didactic/ex_deriv". + +include "deriv.ma". + +theorem p_plus_p_p: ∀f:F. ∀g:F. (fpari f ∧ fpari g) → fpari (f + g). + assume f:F. + assume g:F. + suppose (fpari f ∧ fpari g) (h). + by h we have (fpari f) (H) and (fpari g) (K). + we need to prove (fpari (f + g)) + or equivalently ((f + g) = (f + g) ∘ ρ). + conclude + (f + g) + = (f + (g ∘ ρ)) by _. + = ((f ∘ ρ) + (g ∘ ρ)) by _. + = ((f + g) ∘ ρ) by _ + done. +qed. + +theorem p_mult_p_p: ∀f:F. ∀g:F. (fpari f ∧ fpari g) → fpari (f · g). + assume f:F. + assume g:F. + suppose (fpari f ∧ fpari g) (h). + by h we have (fpari f) (H) and (fpari g) (K). + we need to prove (fpari (f · g)) + or equivalently ((f · g) = (f · g) ∘ ρ). + conclude + (f · g) + = (f · (g ∘ ρ)) by _. + = ((f ∘ ρ) · (g ∘ ρ)) by _. + = ((f · g) ∘ ρ) by _ + done. +qed. + +theorem d_plus_d_d: ∀f:F. ∀g:F. (fdispari f ∧ fdispari g) → fdispari (f + g). + assume f:F. + assume g:F. + suppose (fdispari f ∧ fdispari g) (h). + by h we have (fdispari f) (H) and (fdispari g) (K). + we need to prove (fdispari (f + g)) + or equivalently ((f + g) = (ρ ∘ ((f + g) ∘ ρ))). + conclude + (f + g) + = (f + (ρ ∘ (g ∘ ρ))) by _. + = ((ρ ∘ (f ∘ ρ)) + (ρ ∘ (g ∘ ρ))) by _. + = (((-R1) · (f ∘ ρ)) + (ρ ∘ (g ∘ ρ))) by _. + = (((i (-R1)) · (f ∘ ρ)) + ((i (-R1)) · (g ∘ ρ))) by _. + = (((f ∘ ρ) · (i (-R1))) + ((g ∘ ρ) · (i (-R1)))) by _. + = (((f ∘ ρ) + (g ∘ ρ)) · (i (-R1))) by _. + = ((i (-R1)) · ((f + g) ∘ ρ)) by _. + = (ρ ∘ ((f + g) ∘ ρ)) by _ + done. +qed. + +theorem d_mult_d_p: ∀f:F. ∀g:F. (fdispari f ∧ fdispari g) → fpari (f · g). + assume f:F. + assume g:F. + suppose (fdispari f ∧ fdispari g) (h). + by h we have (fdispari f) (h1) and (fdispari g) (h2). + we need to prove (fpari (f · g)) + or equivalently ((f · g) = (f · g) ∘ ρ). + conclude + (f · g) + = (f · (ρ ∘ (g ∘ ρ))) by _. + = ((ρ ∘ (f ∘ ρ)) · (ρ ∘ (g ∘ ρ))) by _. + = (((-R1) · (f ∘ ρ)) · (ρ ∘ (g ∘ ρ))) by _. + = (((-R1) · (f ∘ ρ)) · ((-R1) · (g ∘ ρ))) by _. + = ((-R1) · (f ∘ ρ) · (-R1) · (g ∘ ρ)) by _. + = ((-R1) · ((f ∘ ρ) · (-R1)) · (g ∘ ρ)) by _. + = ((-R1) · (-R1) · (f ∘ ρ) · (g ∘ ρ)) by _. + = (R1 · ((f ∘ ρ) · (g ∘ ρ))) by _. + = (((f ∘ ρ) · (g ∘ ρ))) by _. + = ((f · g) ∘ ρ) by _ + done. +qed. + +theorem p_mult_d_p: ∀f:F. ∀g:F. (fpari f ∧ fdispari g) → fdispari (f · g). + assume f:F. + assume g:F. + suppose (fpari f ∧ fdispari g) (h). + by h we have (fpari f) (h1) and (fdispari g) (h2). + we need to prove (fdispari (f · g)) + or equivalently ((f · g) = ρ ∘ ((f · g) ∘ ρ)). + conclude + (f · g) + = (f · (ρ ∘ (g ∘ ρ))) by _. + = ((f ∘ ρ) · (ρ ∘ (g ∘ ρ))) by _. + = ((f ∘ ρ) · ((-R1) · (g ∘ ρ))) by _. + = ((-R1) · ((f ∘ ρ) · (g ∘ ρ))) by _. + = ((-R1) · ((f · g) ∘ ρ)) by _. + = (ρ ∘ ((f · g) ∘ ρ)) by _ + done. +qed. + +theorem p_plus_c_p: ∀f:F. ∀x:R. fpari f → fpari (f + (i x)). + assume f:F. + assume x:R. + suppose (fpari f) (h). + we need to prove (fpari (f + (i x))) + or equivalently (f + (i x) = (f + (i x)) ∘ ρ). + by _ done. +qed. + +theorem p_mult_c_p: ∀f:F. ∀x:R. fpari f → fpari (f · (i x)). + assume f:F. + assume x:R. + suppose (fpari f) (h). + we need to prove (fpari (f · (i x))) + or equivalently ((f · (i x)) = (f · (i x)) ∘ ρ). + by _ done. +qed. + +theorem d_mult_c_d: ∀f:F. ∀x:R. fdispari f → fdispari (f · (i x)). + assume f:F. + assume x:R. + suppose (fdispari f) (h). + rewrite < fmult_commutative. + by _ done. +qed. + +theorem d_comp_d_d: ∀f,g:F. fdispari f → fdispari g → fdispari (f ∘ g). + assume f:F. + assume g:F. + suppose (fdispari f) (h1). + suppose (fdispari g) (h2). + we need to prove (fdispari (f ∘ g)) + or equivalently (f ∘ g = ρ ∘ ((f ∘ g) ∘ ρ)). + conclude + (f ∘ g) + = (ρ ∘ (f ∘ ρ) ∘ g) by _. + = (ρ ∘ (f ∘ ρ) ∘ ρ ∘ (g ∘ ρ)) by _. + = (ρ ∘ f ∘ (ρ ∘ ρ) ∘ (g ∘ ρ)) by _. + = (ρ ∘ f ∘ id ∘ (g ∘ ρ)) by _. + = (ρ ∘ ((f ∘ g) ∘ ρ)) by _ + done. +qed. + +theorem pari_in_dispari: ∀ f:F. fpari f → fdispari f '. + assume f:F. + suppose (fpari f) (h1). + we need to prove (fdispari f ') + or equivalently (f ' = ρ ∘ (f ' ∘ ρ)). + conclude + (f ') + = ((f ∘ ρ) ') by _. (*h1*) + = ((f ' ∘ ρ) · ρ ') by _. (*demult*) + = ((f ' ∘ ρ) · -R1) by _. (*deinv*) + = ((-R1) · (f ' ∘ ρ)) by _. (*fmult_commutative*) + = (ρ ∘ (f ' ∘ ρ)) (*reflex_ok*) by _ + done. +qed. + +theorem dispari_in_pari: ∀ f:F. fdispari f → fpari f '. + assume f:F. + suppose (fdispari f) (h1). + we need to prove (fpari f ') + or equivalently (f ' = f ' ∘ ρ). + conclude + (f ') + = ((ρ ∘ (f ∘ ρ)) ') by _. + = ((ρ ' ∘ (f ∘ ρ)) · ((f ∘ ρ) ')) by _. + = (((-R1) ∘ (f ∘ ρ)) · ((f ∘ ρ) ')) by _. + = (((-R1) ∘ (f ∘ ρ)) · ((f ' ∘ ρ) · (-R1))) by _. + = ((-R1) · ((f ' ∘ ρ) · (-R1))) by _. + = (((f ' ∘ ρ) · (-R1)) · (-R1)) by _. + = ((f ' ∘ ρ) · ((-R1) · (-R1))) by _. + = ((f ' ∘ ρ) · R1) by _. + = (f ' ∘ ρ) by _ + done. +qed. + +alias symbol "plus" = "natural plus". +alias num (instance 0) = "natural number". +theorem de_prodotto_funzioni: + ∀ n:nat. (id ^ (n + 1)) ' = ((n + 1)) · (id ^ n). + assume n:nat. + we proceed by induction on n to prove + ((id ^ (n + 1)) ' = (i (n + 1)) · (id ^ n)). + case O. + we need to prove ((id ^ (0 + 1)) ' = (i 1) · (id ^ 0)). + conclude + ((id ^ (0 + 1)) ') + = ((id ^ 1) ') by _. + = ((id · (id ^ 0)) ') by _. + = ((id · R1) ') by _. + = (id ') by _. + = (i R1) by _. + = (i R1 · R1) by _. + = (i (R0 + R1) · R1) by _. + = (1 · (id ^ 0)) by _ + done. + case S (n:nat). + by induction hypothesis we know + ((id ^ (n + 1)) ' = ((n + 1)) · (id ^ n)) (H). + we need to prove + ((id ^ ((n + 1)+1)) ' + = (i ((n + 1)+1)) · (id ^ (n+1))). + conclude + ((id ^ ((n + 1) + 1)) ') + = ((id ^ ((n + (S 1)))) ') by _. + = ((id ^ (S (n + 1))) ') by _. + = ((id · (id ^ (n + 1))) ') by _. + = ((id ' · (id ^ (n + 1))) + (id · (id ^ (n + 1)) ')) by _. + alias symbol "plus" (instance 1) = "function plus". + = ((R1 · (id ^ (n + 1))) + (id · (((n + 1)) · (id ^ n)))) by _. + = ((R1 · (id ^ (n + 1))) + (((n + 1) · id · (id ^ n)))) by _. + = ((R1 · (id ^ (n + 1))) + ((n + 1) · (id ^ (1 + n)))) by _. + = ((R1 · (id ^ (n + 1))) + ((n + 1) · (id ^ (n + 1)))) by _. + alias symbol "plus" (instance 2) = "function plus". + = (((R1 + (n + 1))) · (id ^ (n + 1))) by _. + = ((1 + (n + 1)) · (id ^ (n + 1))) by _; + = ((n + 1 + 1) · (id ^ (n + 1))) by _ + done. +qed. + +let rec times (n:nat) (x:R) on n: R ≝ + match n with + [ O ⇒ R0 + | S n ⇒ Rplus x (times n x) + ]. + +axiom invS: nat→R. +axiom invS1: ∀n:nat. Rmult (invS n) (real_of_nat (n + 1)) = R1. +axiom invS2: invS 1 + invS 1 = R1. (*forse*) + +axiom e:F. +axiom deriv_e: e ' = e. +axiom e1: e · (e ∘ ρ) = R1. + +(* +theorem decosh_senh: + (invS 1 · (e + (e ∘ ρ)))' = (invS 1 · (e + (ρ ∘ (e ∘ ρ)))). +*) diff --git a/matita/dama_didactic/ex_seq.ma b/matita/dama_didactic/ex_seq.ma new file mode 100644 index 000000000..61952d1b0 --- /dev/null +++ b/matita/dama_didactic/ex_seq.ma @@ -0,0 +1,201 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/didactic/ex_seq". + +include "sequences.ma". + +(* +ESERCIZI SULLE SUCCESSIONI + +Dimostrare che la successione alpha converge a 0 +*) + +definition F ≝ λ x:R.Rdiv x (S (S O)). + +definition alpha ≝ successione F R1. + +axiom cont: continuo F. + +lemma l1: monotone_not_increasing alpha. + we need to prove (monotone_not_increasing alpha) + or equivalently (∀n:nat. alpha (S n) ≤ alpha n). + assume n:nat. + we need to prove (alpha (S n) ≤ alpha n) + or equivalently (Rdiv (alpha n) (S (S O)) ≤ alpha n). + by _ done. +qed. + +lemma l2: inf_bounded alpha. + we need to prove (inf_bounded alpha) + or equivalently (∃m. ∀n:nat. m ≤ alpha n). + (* da trovare il modo giusto *) + cut (∀n:nat.R0 ≤ alpha n).by (ex_intro ? ? R0 Hcut) done. + (* fatto *) + we need to prove (∀n:nat. R0 ≤ alpha n). + assume n:nat. + we proceed by induction on n to prove (R0 ≤ alpha n). + case O. + (* manca il comando + the thesis becomes (R0 ≤ alpha O) + or equivalently (R0 ≤ R1). + by _ done. *) + (* approssimiamo con questo *) + we need to prove (R0 ≤ alpha O) + or equivalently (R0 ≤ R1). + by _ done. + case S (m:nat). + by induction hypothesis we know (R0 ≤ alpha m) (H). + we need to prove (R0 ≤ alpha (S m)) + or equivalently (R0 ≤ Rdiv (alpha m) (S (S O))). + by _ done. +qed. + +axiom xxx': +∀ F: R → R. ∀b:R. continuo F → + ∀ l. tends_to (successione F b) l → + punto_fisso F l. + +theorem dimostrazione: tends_to alpha O. + by _ let l:R such that (tends_to alpha l) (H). +(* unfold alpha in H. + change in match alpha in H with (successione F O). + check(xxx' F cont l H).*) + by (lim_punto_fisso F R1 cont l H) we proved (punto_fisso F l) (H2) + that is equivalent to (l = (Rdiv l (S (S O)))). + by _ we proved (tends_to alpha l = tends_to alpha O) (H4). + rewrite < H4. + by _ done. +qed. + +(******************************************************************************) + +(* Dimostrare che la successione alpha2 diverge *) + +definition F2 ≝ λ x:R. Rmult x x. + +definition alpha2 ≝ successione F2 (S (S O)). + +lemma uno: ∀n. alpha2 n ≥ R1. + we need to prove (∀n. alpha2 n ≥ R1). + assume n:nat. + we proceed by induction on n to prove (alpha2 n ≥ R1). + case O. + alias num (instance 0) = "natural number". + we need to prove (alpha2 0 ≥ R1) + or equivalently ((S (S O)) ≥ R1). + by _ done. + case S (m:nat). + by induction hypothesis we know (alpha2 m ≥ R1) (H). + we need to prove (alpha2 (S m) ≥ R1) + or equivalently (Rmult (alpha2 m) (alpha2 m) ≥ R1).letin xxx := (n ≤ n); + by _ we proved (R1 · R1 ≤ alpha2 m · alpha2 m) (H1). + by _ we proved (R1 · R1 = R1) (H2). + rewrite < H2. + by _ done. +qed. + +lemma mono1: monotone_not_decreasing alpha2. + we need to prove (monotone_not_decreasing alpha2) + or equivalently (∀n:nat. alpha2 n ≤ alpha2 (S n)). + assume n:nat. + we need to prove (alpha2 n ≤ alpha2 (S n)) + or equivalently (alpha2 n ≤ Rmult (alpha2 n) (alpha2 n)). + by _ done. +qed. + +(* +lemma due: ∀n. Relev (alpha2 0) n ≥ R0. + we need to prove (∀n. Relev (alpha2 0) n ≥ R0) + or equivalently (∀n. Relev (S (S O)) n ≥ R0). + by _ done. +qed. + +lemma tre: ∀n. alpha2 (S n) ≥ Relev (alpha2 0) (S n). + we need to prove (∀n. alpha2 (S n) ≥ Relev (alpha2 0) (S n)). + assume n:nat. + we proceed by induction on n to prove (alpha2 (S n) ≥ Relev (alpha2 0) (S n)). + case 0. + we need to prove (alpha2 1 ≥ Relev (alpha2 0) R1) + or equivalently (Rmult R2 R2 ≥ R2). + by _ done. + case S (m:nat). + by induction hypothesis we know (alpha2 (S m) ≥ Relev (alpha2 0) (S m)) (H). + we need to prove (alpha2 (S (S m)) ≥ Relev (alpha2 0) (S (S m))) + or equivalently + (*..TODO..*) + +theorem dim2: tends_to_inf alpha2. +(*..TODO..*) +qed. +*) + +(******************************************************************************) + +(* Dimostrare che la successione alpha3 converge a 0 *) +(* +definition alpha3 ≝ successione F2 (Rdiv (S 0) (S (S 0))). + +lemma quattro: ∀n. alpha3 n ≤ R1. + assume n:nat. + we need to prove (∀n. alpha3 n ≤ R1). + we proceed by induction on n to prove (alpha3 n ≤ R1). + case O. + we need to prove (alpha3 0 ≤ R1). + by _ done. + case S (m:nat). + by induction hypothesis we know (alpha3 m ≤ R1) (H). + we need to prove (alpha3 (S m) ≤ R1) + or equivalently (Rmult (alpha3 m) (alpha3 m) ≤ R1). + by _ done. + qed. + +lemma mono3: monotone_not_increasing alpha3. + we need to prove (monotone_not_increasing alpha3) + or equivalently (∀n:nat. alpha (S n) ≤ alpha n). + assume n:nat. + we need to prove (alpha (S n) ≤ alpha n) + or equivalently (Rmult (alpha3 n) (alpha3 n) ≤ alpha3 n). + by _ done. +qed. + +lemma bound3: inf_bounded alpha3. + we need to prove (inf_bounded alpha3) + or equivalently (∃m. ∀n:nat. m ≤ alpha3 n). + (* da trovare il modo giusto *) + cut (∀n:nat.R0 ≤ alpha3 n).by (ex_intro ? ? R0 Hcut) done. + (* fatto *) + we need to prove (∀n:nat. R0 ≤ alpha3 n). + assume n:nat. + we proceed by induction on n to prove (R0 ≤ alpha3 n). + case O. + (* manca il comando + the thesis becomes (R0 ≤ alpha O) + or equivalently (R0 ≤ R1). + by _ done. *) + (* approssimiamo con questo *) + we need to prove (R0 ≤ alpha3 O) + or equivalently (R0 ≤ Rdiv (S 0) (S (S 0))). + by _ done. + case S (m:nat). + by induction hypothesis we know (R0 ≤ alpha3 m) (H). + we need to prove (R0 ≤ alpha3 (S m)) + or equivalently (R0 ≤ Rmult (alpha3 m) (alpha3 m)). + by _ done. +qed. + +theorem dim3: tends_to alpha3 O. +(*..TODO..*) +qed. +*) \ No newline at end of file diff --git a/matita/dama_didactic/makefile b/matita/dama_didactic/makefile new file mode 100644 index 000000000..ce86d1360 --- /dev/null +++ b/matita/dama_didactic/makefile @@ -0,0 +1,33 @@ +H=@ + +RT_BASEDIR=../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +all: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + diff --git a/matita/dama_didactic/reals.ma b/matita/dama_didactic/reals.ma new file mode 100644 index 000000000..966747c76 --- /dev/null +++ b/matita/dama_didactic/reals.ma @@ -0,0 +1,103 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/didactic/reals". + +include "nat/plus.ma". + +axiom R:Type. +axiom R0:R. +axiom R1:R. +axiom Rplus: R→R→R. +axiom Ropp:R→R. (*funzione da x → -x*) +axiom Rmult: R→R→R. +axiom Rdiv: R→R→R. +axiom Relev: R→R→R. +axiom Rle: R→R→Prop. +axiom Rge: R→R→Prop. + +interpretation "real plus" 'plus x y = + (cic:/matita/didactic/reals/Rplus.con x y). + +interpretation "real opp" 'uminus x = + (cic:/matita/didactic/reals/Ropp.con x). + +notation "hvbox(a break · b)" + right associative with precedence 55 +for @{ 'mult $a $b }. + +interpretation "real mult" 'mult x y = + (cic:/matita/didactic/reals/Rmult.con x y). + +interpretation "real leq" 'leq x y = + (cic:/matita/didactic/reals/Rle.con x y). + +interpretation "real geq" 'geq x y = + (cic:/matita/didactic/reals/Rge.con x y). + +let rec elev (x:R) (n:nat) on n: R ≝ + match n with + [O ⇒ R1 + | S n ⇒ Rmult x (elev x n) + ]. + +let rec real_of_nat (n:nat) : R ≝ + match n with + [ O ⇒ R0 + | S n ⇒ + match n with + [ O ⇒ R1 + | _ ⇒ real_of_nat n + R1 + ] + ]. + +coercion cic:/matita/didactic/reals/real_of_nat.con. + +axiom Rplus_commutative: ∀x,y:R. x+y = y+x. +axiom R0_neutral: ∀x:R. x+R0=x. +axiom Rdiv_le: ∀x,y:R. R1 ≤ y → Rdiv x y ≤ x. +axiom R2_1: R1 ≤ S (S O). +(* assioma falso! *) +axiom Rmult_Rle: ∀x,y,z,w. x ≤ y → z ≤ w → Rmult x z ≤ Rmult y w. + +axiom Rdiv_pos: ∀ x,y:R. R0 ≤ x → R1 ≤ y → R0 ≤ Rdiv x y. +axiom Rle_R0_R1: R0 ≤ R1. +axiom div: ∀x:R. x = Rdiv x (S (S O)) → x = O. +(* Proprieta' elevamento a potenza NATURALE *) +axiom elev_incr: ∀x:R.∀n:nat. R1 ≤ x → elev x (S n) ≥ elev x n. +axiom elev_decr: ∀x:R.∀n:nat. R0 ≤ x ∧ x ≤ R1 → elev x (S n) ≤ elev x n. +axiom Rle_to_Rge: ∀x,y:R. x ≤ y → y ≥ x. +axiom Rge_to_Rle: ∀x,y:R. x ≥ y → y ≤ x. + +(* Proprieta' elevamento a potenza TRA REALI *) +(* +axiom Relev_ge: ∀x,y:R. + (x ≥ R1 ∧ y ≥ R1) ∨ (x ≤ R1 ∧ y ≤ R1) → Relev x y ≥ x. +axiom Relev_le: ∀x,y:R. + (x ≥ R1 ∧ y ≤ R1) ∨ (x ≤ R1 ∧ y ≥ R1) → Relev x y ≤ x. +*) + +lemma stupido: ∀x:R.R0+x=x. + assume x:R. + conclude (R0+x) = (x+R0) by _. + = x by _ + done. +qed. + +axiom opposto1: ∀x:R. x + -x = R0. +axiom opposto2: ∀x:R. -x = Rmult x (-R1). +axiom meno_piu: Rmult (-R1) (-R1) = R1. +axiom R1_neutral: ∀x:R.Rmult R1 x = x. +(* assioma falso *) +axiom uffa: ∀x,y:R. R1 ≤ x → y ≤ x · y. diff --git a/matita/dama_didactic/sequences.ma b/matita/dama_didactic/sequences.ma new file mode 100644 index 000000000..66b64e5bc --- /dev/null +++ b/matita/dama_didactic/sequences.ma @@ -0,0 +1,57 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/didactic/sequences". + +include "reals.ma". + +axiom continuo: (R → R) → Prop. +axiom tends_to: (nat → R) → R → Prop. +axiom tends_to_inf: (nat → R) → Prop. + +definition monotone_not_increasing ≝ + λ alpha:nat→R. + ∀n:nat.alpha (S n) ≤ alpha n. + +definition inf_bounded ≝ + λ alpha:nat → R. + ∃ m. ∀ n:nat. m ≤ alpha n. + +axiom converge: ∀ alpha. + monotone_not_increasing alpha → + inf_bounded alpha → + ∃ l. tends_to alpha l. + +definition punto_fisso := + λ F:R→R. λ x. x = F x. + +let rec successione F x (n:nat) on n : R ≝ + match n with + [ O ⇒ x + | S n ⇒ F (successione F x n) + ]. + +axiom lim_punto_fisso: +∀ F: R → R. ∀b:R. continuo F → + let alpha := successione F b in + ∀ l. tends_to alpha l → + punto_fisso F l. + +definition monotone_not_decreasing ≝ + λ alpha:nat→R. + ∀n:nat.alpha n ≤ alpha (S n). + +definition sup_bounded ≝ + λ alpha:nat → R. + ∃ m. ∀ n:nat. alpha n ≤ m. diff --git a/matita/dep2dot.rb b/matita/dep2dot.rb new file mode 100755 index 000000000..813b2afeb --- /dev/null +++ b/matita/dep2dot.rb @@ -0,0 +1,30 @@ +#!/usr/bin/ruby -w +# filter converting from .depend to .dot +# tested on .depend generated by ocamldep +# $Id$ + +require 'set' + +edges = Set.new +$stdin.each {|line| + target, deps = line.split(/\s*:\s*/) + while deps =~ /\\\s*$/ # deal with lines continued with trailing \ + deps.sub!(/\s*\\\s*$/, '') + line = $stdin.readline + deps += ' ' + line.lstrip + end + sources, targets = target.split, deps.split + for src in sources + for tgt in targets # ignore file extensions + src.sub!(/\.[^.]+/, '') + tgt.sub!(/\.[^.]+/, '') + edges << [src, tgt] unless src == tgt # ignore self deps + end + end +} +puts 'digraph G {' +for src, tgt in edges + print "\"#{src}\" -> \"#{tgt}\";\n" +end +puts '}' + diff --git a/matita/dictionary-matita.xml b/matita/dictionary-matita.xml new file mode 100644 index 000000000..35903486b --- /dev/null +++ b/matita/dictionary-matita.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/matita/dist/BUGS b/matita/dist/BUGS new file mode 100644 index 000000000..6a6bbb6f2 --- /dev/null +++ b/matita/dist/BUGS @@ -0,0 +1,5 @@ + +Matita bugs are managed using the Bugzilla bug tracker available at: + + http://bugs.mowgli.cs.unibo.it/ + diff --git a/matita/dist/COPYING b/matita/dist/COPYING new file mode 100644 index 000000000..b7b5f53df --- /dev/null +++ b/matita/dist/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/matita/dist/ChangeLog b/matita/dist/ChangeLog new file mode 100644 index 000000000..a8d380ad8 --- /dev/null +++ b/matita/dist/ChangeLog @@ -0,0 +1,5 @@ +0.4.98 - ??/11/2007 - bugfix release + * compiles against camlp5 >= 5.0 + * changed lablgtksourceview module name since it is now part of lablgtk2 + +0.4.97 - 16/11/2007 - initial release diff --git a/matita/dist/INSTALL b/matita/dist/INSTALL new file mode 100644 index 000000000..dfec3e141 --- /dev/null +++ b/matita/dist/INSTALL @@ -0,0 +1,191 @@ + +Tiny Matita logoMatita Home + + Chapter 2. Installation +Prev     Next + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +Chapter 2. Installation + +Table of Contents + +Installing from sources + + Getting the source code + Requirements + Database setup + Compiling and installing + +Configuring Matita + +Installing from sources + +Currently, the only intended way to install Matita is starting from its source +code. + +Getting the source code + +You can get the Matita source code in two ways: + + 1. go to the download page and get the latest released source tarball; + + 2. get the development sources from our SVN repository. You will need the + components/ and matita/ directories from the trunk/helm/software/ + directory, plus the configure and Makefile* stuff from the same directory. + + In this case you will need to run autoconf before proceding with the + building instructions below. + +Requirements + +In order to build Matita from sources you will need some tools and libraries. +They are listed below. + +Note for Debian users + +If you are running a Debian GNU/Linux distribution you can have APT install all +the required tools and libraries by adding the following repository to your / +etc/apt/sources.list: + + deb http://people.debian.org/~zack unstable helm + + +and installing the helm-matita-deps package. + +Required tools and libraries + +OCaml + + the Objective Caml compiler, version 3.09 or above + +Findlib + + OCaml package manager, version 1.1.1 or above + +OCaml Expat + + OCaml bindings for the expat library + +GMetaDOM + + OCaml bindings for the Gdome 2 library + +OCaml HTTP + + OCaml library to write HTTP daemons (and clients) + +LablGTK + + OCaml bindings for the GTK+ library , version 2.6.0 or above + +GtkMathView , LablGtkMathView + + GTK+ widget to render MathML documents and its OCaml bindings + +GtkSourceView , LablGtkSourceView + + extension for the GTK+ text widget (adding the typical features of source + code editors) and its OCaml bindings + +MySQL , OCaml MySQL + + SQL database and OCaml bindings for its client-side library + + The SQL database itself is not strictly needed to run Matita, but we + stronly encourage its use since a lot of features are disabled without it. + Still, the OCaml bindings of the library are needed at compile time. + +Ocamlnet + + collection of OCaml libraries to deal with application-level Internet + protocols and conventions + +ulex + + Unicode lexer generator for OCaml + +CamlZip + + OCaml library to access .gz files + +Database setup + +To fully exploit Matita indexing and search capabilities you will need a +working MySQL database. Detalied instructions on how to do it can be found in +the MySQL documentation. Here you can find a quick howto. + +In order to create a database you need administrator permissions on your MySQL +installation, usually the root account has them. Once you have the permissions, +a new database can be created executing mysqladmin create matita (matita is the +default database name, you can change it using the db.user key of the +configuration file). + +Then you need to grant the necessary access permissions to the database user of +Matita, typing echo "grant all privileges on matita.* to helm;" | mysql matita +should do the trick (helm is the default user name used by Matita to access the +database, you can change it using the db.user key of the configuration file). + +Note + +This way you create a database named matita on which anyone claiming to be the +helm user can do everything (like adding dummy data or destroying the contained +one). It is strongly suggested to apply more fine grained permissions, how to +do it is out of the scope of this manual. + +Compiling and installing + +Once you get the source code the installations steps should be quite familiar. + +First of all you need to configure the build process executing ./configure. +This will check that all needed tools and library are installed and prepare the +sources for compilation and installation. + +Quite a few (optional) arguments may be passed to the configure command line to +change build time parameters. They are listed below, together with their +default values: + +configure command line arguments + +--with-runtime-dir=dir + + (Default: /usr/local/matita) Runtime base directory where all Matita stuff + (executables, configuration files, standard library, ...) will be installed + +--with-dbhost=host + + (Default: localhost) Default SQL server hostname. Will be used while + building the standard library during the installation and to create the + default Matita configuration. May be changed later in configuration file. + +--enable-debug + + (Default: disabled) Enable debugging code. Not for the casual user. + +Then you will manage the build and install process using make as usual. Below +are reported the targets you have to invoke in sequence to build and install: + +make targets + +world + + builds components needed by Matita and Matita itself (in bytecode or native + code depending on the availability of the OCaml native code compiler) + +install + + installs Matita related tools, standard library and the needed runtime + stuff in the proper places on the filesystem. + + As a part of the installation process the Matita standard library will be + compiled, thus testing that the just built matitac compiler works properly. + + For this step you will need a working SQL database (for indexing the + standard library while you are compiling it). See Database setup for + instructions on how to set it up. + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +Prev     Next +Matita vs Coq  Home  Configuring Matita + diff --git a/matita/dist/Makefile b/matita/dist/Makefile new file mode 100644 index 000000000..33aeac735 --- /dev/null +++ b/matita/dist/Makefile @@ -0,0 +1,27 @@ +MYSQL_FLAGS = --extended_insert --lock-tables=off --no-create-info +DB = -u helm -h mowgli.cs.unibo.it matita +TABLE_CREATOR = ../../components/binaries/table_creator/table_creator +TABLES := $(shell $(TABLE_CREATOR) list all) +MANUAL_DIR = ../help/C +WEB_DIR = ../../../www/matita + +all: static_link +clean: static_link_clean +.PHONY: static_link +static_link: + $(MAKE) -C static_link/ +static_link_clean: + $(MAKE) -C static_link/ clean +dist: matita_stdlib.sql.gz +.PHONY: matita_stdlib.sql +matita_stdlib.sql: + mysqldump $(MYSQL_FLAGS) $(DB) $(TABLES) > $@ +%.gz: % + gzip -c $< > $@ + +dist_pre: INSTALL README +INSTALL: $(MANUAL_DIR)/txt-stamp + cp $(MANUAL_DIR)/sec_install.txt $@ +$(MANUAL_DIR)/txt-stamp: + $(MAKE) -C $(MANUAL_DIR) txt-stamp + diff --git a/matita/dist/README b/matita/dist/README new file mode 100644 index 000000000..a27350d32 --- /dev/null +++ b/matita/dist/README @@ -0,0 +1,53 @@ + +MATITA +------ + +Matita is a new document-centric interactive theorem prover that integrates +several Mathematical Knowledge Management tools and techniques. + +Matita is traditional. Its logical foundation is the Calculus of (Co)Inductive +Constructions (CIC). It can re-use mathematical concepts produced by other +proof assistants like Coq and encoded in an XML encoding of CIC. The +interaction paradigm of Matita is familiar, being inspired by CtCoq and Proof +General. Its proof language is procedural in the same spirit of LCF. + +Matita is innovative: + +- the user interface sports high quality bidimensional rendering of proofs and + formulae transformed on-the-fly to MathML markup, on which direct + manipulation of the underlying CIC terms is still possible; + +- the knowledge base is distributed: every authored concepts can be published + becoming part of the Matita library which can be browsed as an hypertext + (locally or on the World Wide Web) and searched by means of content-based + queries; + +- the tactical language, part of the proof language, has step-by-step + semantics, enabling inspection and replaying of deeply structured proof + scripts. + +More information are available on the Matita web site: + + http://matita.cs.unibo.it/ + + +INSTALLATION +------------ + +See the file INSTALL for building and installation instructions. + + +BUGS +---- + +Bugs reporting is handled using the Bugzilla bug tracker available at: + + http://bugs.mowgli.cs.unibo.it/ + + +LICENSE +------- + +Matita and its documentation are free software. +See the file COPYING for copying conditions. + diff --git a/matita/dist/configure.ac.sed b/matita/dist/configure.ac.sed new file mode 100644 index 000000000..cae098b5c --- /dev/null +++ b/matita/dist/configure.ac.sed @@ -0,0 +1,4 @@ +s|^\(DEBUG_DEFAULT\)=.*|\1="false"| +s|^\(DEFAULT_DBHOST\)=.*|\1="localhost"| +s|^\(RT_BASE_DIR_DEFAULT\)=.*|\1="/usr/local/matita"| +s|^\(DISTRIBUTED\)=.*|\1="yes"| diff --git a/matita/dist/fill_db.sh b/matita/dist/fill_db.sh new file mode 100755 index 000000000..1ae28d336 --- /dev/null +++ b/matita/dist/fill_db.sh @@ -0,0 +1,53 @@ +#!/bin/bash +set -e + +MYSQL="mysql" +DBHOST="localhost" +DBNAME="matita" +DBUSER="helm" +DBPASS="" + +TABLE_CREATOR="../../ocaml/metadata/table_creator/table_creator" + +SQL="matita_db.sql" +STDLIB_DATA="matita_stdlib.sql.gz" + +grant_sql="GRANT ALL PRIVILEGES ON $DBNAME.* TO $DBUSER@$DBHOST" +create_sql="CREATE DATABASE $DBNAME" +drop_sql="DROP DATABASE $DBNAME" + +function appendsql() +{ + echo "$1" >> $SQL +} + +echo "Step 0." +echo " Dropping old databases, if any." +echo " You can ignore errors output by this step" +echo "$drop_sql" | $MYSQL -f +echo "Step 1." +echo " Creating database and users." +echo "# SQL statements to create Matita DB and users" > $SQL +appendsql "$create_sql;" +if [ -z "$DBPASS" ]; then + appendsql "$grant_sql;" +else + appendsql "$grant_sql IDENTIFIED BY '$DBPASS';" +fi +$MYSQL < $SQL +echo "Step 2." +echo " Creating database structure." +echo "# SQL statements to create Matita DB structure" > $SQL +creator_args="table fill index" +for arg in $creator_args; do + appendsql "`$TABLE_CREATOR $arg all`" +done +$MYSQL $DBNAME < $SQL +echo "Step 3." +echo " Filling database with standard library metadata." +if [ -f "$STDLIB_DATA" ]; then + gunzip -c "$STDLIB_DATA" | $MYSQL $DBNAME +else + echo " Standard library metadata file $STDLIB_DATA not found, skipping this step." +fi + diff --git a/matita/dist/static_link/Makefile b/matita/dist/static_link/Makefile new file mode 100644 index 000000000..5a02bb3b7 --- /dev/null +++ b/matita/dist/static_link/Makefile @@ -0,0 +1,5 @@ +all: static_link +static_link: static_link.ml + ocamlfind ocamlc -package unix,str -linkpkg -o $@ $< +clean: + rm -f static_link.cm* static_link diff --git a/matita/dist/static_link/static_link.ml b/matita/dist/static_link/static_link.ml new file mode 100644 index 000000000..8b1d57668 --- /dev/null +++ b/matita/dist/static_link/static_link.ml @@ -0,0 +1,162 @@ + +open Printf + +exception Found of string list + +let ocamlobjinfo = "ocamlobjinfo" +let noautolink = "-noautolink" +let dummy_opt_cmd = "dummy_ocamlopt" +let opt_cmd = "ocamlopt" +let libdirs = [ "/lib"; "/usr/lib"; "/usr/lib/gcc/i486-linux-gnu/4.0.2" ] +let exceptions = [ "threads.cma", [ "-lthreads", "-lthreadsnat" ] ] + +let blanks_RE = Str.regexp "[ \t\r\n]+" +let cmxa_RE = Str.regexp "\\.cmxa$" +let extra_cfiles_RE = Str.regexp "^.*Extra +C +object +files:\\(.*\\)$" +let extra_copts_RE = Str.regexp "^.*Extra +C +options:\\(.*\\)$" +let lib_RE = Str.regexp "^lib" +let l_RE = Str.regexp "^-l" +let opt_line_RE = Str.regexp (sprintf "^\\+ +%s +\\(.*\\)$" dummy_opt_cmd) +let trailing_cmxa_RE = Str.regexp ".*\\.cmxa$" + +let message s = prerr_endline ("STATIC_LINK: " ^ s) +let warning s = message ("WARNING: " ^ s) + +let handle_exceptions ~cma cflag = + try + let cma_exns = List.assoc (Filename.basename cma) exceptions in + let cflag' = List.assoc cflag cma_exns in + message (sprintf "using %s exception %s -> %s" cma cflag cflag'); + cflag' + with Not_found -> cflag + +let parse_cmdline () = + let mine, rest = ref [], ref [] in + let is_mine = ref true in + Array.iter + (function + | "--" -> is_mine := false + | s when !is_mine -> + if Str.string_match lib_RE s 0 then + warning (sprintf + ("libraries to be statically linked must be specified " + ^^ "without heading \"lib\", \"%s\" argument may be wrong") s); + mine := s :: !mine + | s -> rest := s :: !rest) + Sys.argv; + if !rest = [] then begin + prerr_endline "Usage: static_link [ CLIB .. ] -- COMMAND [ ARG .. ]"; + prerr_endline ("Example: static_link pcre expat --" + ^ " ocamlfind opt -package pcre,expat -linkpkg -o foo foo.ml"); + exit 0 + end; + List.tl (List.rev !mine), List.rev !rest + +let extract_opt_flags cmd = + let ic = Unix.open_process_in cmd in + (try + while true do + let l = input_line ic in + if Str.string_match opt_line_RE l 0 then begin + message ("got ocamlopt line: " ^ l); + raise (Found (Str.split blanks_RE (Str.matched_group 1 l))); + end + done; + [] (* dummy value *) + with + | End_of_file -> failwith "compiler command not found" + | Found flags -> + close_in ic; + flags) + +let cma_of_cmxa = Str.replace_first cmxa_RE ".cma" + +let find_clib libname = + let rec aux = + function + | [] -> raise Not_found + | libdir :: tl -> + let fname = sprintf "%s/lib%s.a" libdir libname in + if Sys.file_exists fname then fname else aux tl + in + aux libdirs + +let a_of_cflag cflag = (* "-lfoo" -> "/usr/lib/libfoo.a" *) + let libname = Str.replace_first l_RE "" cflag in + find_clib libname + +let cflags_of_cma fname = + let ic = Unix.open_process_in (sprintf "%s %s" ocamlobjinfo fname) in + let extra_copts = ref "" in + let extra_cfiles = ref "" in + (try + while true do + match input_line ic with + | s when Str.string_match extra_copts_RE s 0 -> + extra_copts := Str.matched_group 1 s + | s when Str.string_match extra_cfiles_RE s 0 -> + extra_cfiles := Str.matched_group 1 s + | _ -> () + done + with End_of_file -> ()); + close_in ic; + let extra_cfiles = List.rev (Str.split blanks_RE !extra_cfiles) in + let extra_copts = Str.split blanks_RE !extra_copts in + extra_copts @ extra_cfiles + +let staticize static_libs flags = + let static_flags = List.map ((^) "-l") static_libs in + let aux ~add_cclib ~cma cflag = + let cflag = + if List.mem cflag static_flags + then + (try + let a = a_of_cflag cflag in + message (sprintf "using static %s instead of shared %s" a cflag); + a + with Not_found -> warning ("can't find lib for " ^ cflag); cflag) + else (handle_exceptions ~cma cflag) + in + if add_cclib then [ "-cclib"; cflag ] else [ cflag ] + in + List.fold_right + (fun flag acc -> + let cma = cma_of_cmxa flag in + if Str.string_match trailing_cmxa_RE flag 0 then begin + message ("processing native archive: " ^ flag); + let cflags = cflags_of_cma cma in + let cflags' = + List.fold_right + (fun cflag acc -> (aux ~add_cclib:true ~cma cflag) @ acc) + cflags [] + in + flag :: (cflags' @ acc) + end else + (aux ~add_cclib:false ~cma flag) @ acc) + flags [] + +let quote_if_needed s = + try + ignore (Str.search_forward blanks_RE s 0); + "\"" ^ s ^ "\"" + with Not_found -> s + +let main () = + let static_libs, args = parse_cmdline () in + printf "C libraries to be linked-in: %s\n" (String.concat " " static_libs); + flush stdout; + let verbose_cmd = + sprintf "OCAMLFIND_COMMANDS='ocamlopt=%s' %s -verbose 2>&1" dummy_opt_cmd + (String.concat " " (List.map quote_if_needed args)) + in + let orig_opt_flags = extract_opt_flags verbose_cmd in + message ("original ocamlopt flags: " ^ String.concat " " orig_opt_flags); + let opt_flags = staticize static_libs orig_opt_flags in + message ("new ocamlopt flags: " ^ String.concat " " opt_flags); + let flags = noautolink :: opt_flags in + let cmd = String.concat " " (opt_cmd :: flags) in + message ("executing command: " ^ cmd); + exit (Sys.command cmd) + +let _ = main () + diff --git a/matita/doc/primer.txt b/matita/doc/primer.txt new file mode 100644 index 000000000..e6d4c40a9 --- /dev/null +++ b/matita/doc/primer.txt @@ -0,0 +1,720 @@ + *********************************** + * * + * A M a t i t a p r i m e r * + * * + * (with useful ??? exercises) * + *********************************** + +================================= +Learning to use the on-line help: +================================= +* Select the menu Help and then the menu Contents or press F1 +* In the menu you can find the syntax for lambda terms and the syntax + and semantics of every tactic and tactical available in the system + +================================= +Learning to type Unicode symbols: +================================= +* Unicode symbols are written like this: \lambda \eta \leq ... +* Optional: to get the gliph corresponding to the Unicode symbol, + type Alt+L (for ligature) just after the \something stuff +* Additional ligatures (use Alt+L to get the gliph) + := for \def + -> for \to + => for \Rightarrow + <= for \leq + >= for \geq +* Commonly used Unicode symbols: + \to for logical implication and function space + \forall + \exists + \Pi for dependent product + \lambda + \land for logical and, both on propositions and booleans + \lor for logical or, both on propositions and booleans + \lnot for logical not, both on propositions and booleans + +============================== +How to set up the environment: +============================== +* Every file must start with a line like this: + + set "baseuri" "cic:/matita/nat/plus/". + + that says that every definition and lemma in the current file + will be put in the cic:/matita/nat/plus namespace. + For an exercise put in a foo.ma file, use the namespace + cic:/matita/foo/ +* Files can start with inclusion lines like this: + + include "nat/plus.ma". + + This is required to activate the notation given in the nat/times.ma file. + If you do not include "nat/times.ma", you will still be able to use all + the definitions and lemmas given in "nat/plus.ma", but without the nice + infix '+' notation for addition. + +==================================== +How to browse and search the library: +==================================== +* Open the menu View and then New CIC Browser. You will get a browser-like + window with integrated searching functionalities +* To explore the library, type the URI "cic:" in the URI field and start + browsing. Definitions will be rendered as such. Theorems will be rendered + in a declarative style even if initially produced in a procedural style. +* To get a nice notation for addition and natural numbers, put in your + script include "nat/plus.ma" and execute it. Then use the browser to + render cic:/matita/nat/plus/associative_plus.con. The declarative proof + you see is not fully expanded. Every time you see a "Proof" or a + "proof of xxx" you can click on it to expand the proof. Every constant and + symbol is an hyperlink. Follow the hyperlinks to see the definition of + natural numbers and addition. +* The home button visualizes in declarative style the proof under development. + It shows nothin when the system is not in proof mode. +* Theorems and definitions can be looked for by name using wildcards. Write + "*associative*" in the seach bar, select "Locate" and press Enter. + You will see the result list of URIs. Click on them to follow the hyperlink. +* If you know the exact statement of a theorem, but not its name, you can write + its statement in the search bar and select match. Try with + "\forall n,m:nat. n + m = m + n". Sometimes you can find a theorem that is + just close enough to what you were looking for. Try with + "\forall n:nat. O = n + O" (O is the letter O, not the number 0) +* Sometimes you may want to obtain an hint on what theorems can be applied + to prove something. Write the statement to prove in the search bar and select + Hint. Try with "S O + O = O + S O". As before, you can get some useful + results that are not immediately usable in their current form. +* Sometimes you may want to look for the theorems and definitions that are + instances of a given statement. Write the statement in the search bar + using lambda abstractions in front to quantify the variables to be + instantiated. Then use Instance. Try with "\lambda n.\forall x:nat.x+n=x". + +===================== +How to define things: +===================== +* Look in the manual for Syntax and then Definitions and declarations. + Often you can omit the types of binders if they can be inferred. + Use question marks "?" to ask the system to infer an argument of an + application. Non recursive definitions must be given using "definition". + Structural recursive definitions must be given using "let rec". + Try the following examples: + + axiom f: nat \to nat + + definition square := \lambda A:Type.\lambda f:A \to A. \lambda x. f (f x). + + definition square_f : nat \to nat \def square ? f. + + inductive tree (A:Type) : Type \def + Empty: tree A + | Cons: A \to tree A \to tree A \to tree A. + + let rec size (A:Type) (t: tree A) on t : nat \def + match t with + [ Empty \Rightarrow O + | Cons _ l r \Rightarrow size ? l + size ? r + ]. + +==================== +How to prove things: +==================== +* Elementary proofs can be done by directly writing the lambda-terms + (as in Agda or Epigram). Try to complete the following proofs: + + lemma ex1: + \forall A,B:Prop. + ((\forall X:Prop.X \to X) \to A \to B) \to A \to B \def + λA,B:Prop.λH. ... + + lemma ex2: \forall n,m. m + n = m + (n + O) \def + ... + + Hint: to solve ex2 use eq_f and plus_n_O. Look for their types using + the browser. + +* The usual way to write proofs is by using either the procedural style + (as in Coq and Isabelle) or the still experimental declarative style + (as in Isar and Mizar). Let's start with the declarative style. + Look in the manual for the following declarative tactics: + + assume id:type. (* new assumption *) + suppose formula (id). (* new hypothesis *) + by lambda-term done. (* concludes the proof *) + by lambda-term we proved formula (id). (* intermediate step *) + by _ done. (* concludes the proof *) + by _ we proved formula (id). (* intermediate step *) + + Declarative tactics must always be terminated by a dot. + When automation fails (last two tactics), you can always help the system + by adding new intermediate steps or by writing the lambda-term by hand. + + Prove again ex1 and ex2 in declarative style. A proof in declarative + style starts with + + lemma id: formula. + theorem id: formula. + + (the two forms are totally equivalent) and ends with + + qed. + + Hint: you can select well-formed sub-formulae in the sequents window, + copy them (using the Edit/Paste menu item or the contextual menu item) + and paste them in the text (using the Edit/Copy menu item or the + contextual menu item). + +* The most used style to write proofs in Matita is the procedural one. + In the rest of this tutorial we will only present the procedural style. + Look in the manual for the following procedural tactics: + + intros + apply lambda-term + autobatch (* in the manual autobatch is called auto *) + + Prove again ex1 and ex2 in procedural style. A proof in procedural style + starts and ends as a proof in declarative style. The two styles can be + mixed. + +* Some tactics open multiple new goals. For instance, copy the following + lemma: + + lemma ex3: \forall A,B:Prop. A \to B \to (A \land B) \land (A \land B). + intros; + split; + + Look for the split tactic in the manual. The split tactic of the previous + script has created two new goals, both of type (A \land B). Notice that + the labels ?8 and ?9 of both goals are now in bold. This means that both + goals are currently active and that the next tactic will be applied to + both goals. The ";" tactical used after "intros" and "split" has exactly + this meaning: it activates all goals created by the previous tactic. + Look for it in the manual, then execute "split;" again. Now you can see + four active goals. The first and third one ask to prove A; the reamining + ones ask to prove B. To apply different tactics to the selected goal, we + need to branch over the selected goals. This is achieved by using the + tactical "[" (branching). Now type "[" and exec it. Only the first goal + is now active (in bold), and all the previously active goals have now + subscripts ranging from 1 to 4. Use the "apply H;" tactic to solve the goal. + No goals are now selected. Use the "|" (next goal) tactical to activate + the next goal. Since we are able to solve the new active goal and the + last goal at once, we want to select the two branches at the same time. + Use the "2,4:" tactical to select the goals having as subscripts 2 and 4. + Now solve the goals with "apply H1;" and select the last remaining goal + with "|". Solve the goal with "apply H;". Finally, close the branching + section using the tactical "]" and complete the proof with "qed.". + Look for all this tacticals in the manual. The "*:" tactical is also + useful: it is used just after a "[" or "|" tactical to activate all the + remaining goals with a subscript (i.e. all the goals in the innermost + branch). + + If a tactic "T" opens multiple goals, then "T;" activates all the new + goals opened by "T". Instead "T." just activates the first goal opened + by "T", postponing the remaining goals without marking them with subscripts. + In case of doubt, always use "." in declarative scripts and only all the + other tacticals in procedural scripts. + +========================== +Computation and rewriting: +========================== +* State the following theorem: + + lemma ex4: \forall n,m. S (S n) + m = S (S (n + m)). + + and introduce the hypotheses with "intros". To complete the proof, we + can simply compute "S (S n) + m" to obtain "S (S (n + m))". Using the + browser (click on the "+" hyperlink), look at the definition of addition: + since addition is defined by recursion on the first argument, and since + the first argument starts with two constructors "S", computation can be + made. Look for the "simplify" tactic in the manual and use it to + obtain a trivial equality. Solve the equality using "reflexivity", after + having looked for it in the manual. +* State the following theorem: + + lemma ex5: \forall n,m. n + S (S m) = S (S (n + m)). + + Try to use simplify to complete the proof as before. Why is "simplify" + not useful in this case? To progress in the proof we need a lemma + stating that "\forall n,m. S (n + m) = n + S m". Using the browser, + look for its name in the library. Since the lemma states an equality, + it is possible to use it to replace an instance of its left hand side + with an instance of its right hand side (or the other way around) in the + current sequent. Look for the "rewrite" tactic in the manual, and use + it to solve the exercise. There are two possible solutions: one only + uses rewriting from left to right ("rewrite >"), the other rewriting + from right to left ("rewrite <"). Find both of them. +* It may happen that "simplify" fails to yield the simplified form you + expect. In some situations, simplify can even make your goal more complex. + In these cases you can use the "change" tactic to convert the goal into + any other goal which is equivalent by computation only. State again + exercise ex4 and solve the goal without using "simplify" by means of + "change with (S (S (n + m)) = S (S (n + m))". +* Simplify does nothing to expand definitions that are not given by + structural recursion. To expand definition "X" in the goal, use the + "unfold X" tactic. + + State the following lemma and use "unfold Not" to unfold the definition + of negation in terms of implication and False. Then complete the proof + of the theorem. + + lemma ex6: \forall A:Prop. \lnot A \to A \to False. + +* Sometimes you may be interested in simplifying, changing, unfolding or even + substituting (by means of rewrite) only a sub-expression of the + goal. Moreover, you may be interested in simplifying, changing, unfolding or + substituting a (sub-)expression of one hypothesis. Look in the manual + for these tactics: all of them have an optional argument that is a + pattern. You can generate a pattern by: 1) selecting the sub-expression you + want to act on in the sequent; 2) copying it (using the Edit/Copy menu + item or the contextual menu); 3) pasting it as a pattern using the + "Edit/Paste as pattern" menu item. Other tactics also have pattern arguments. + State and solve the following exercise: + + lemma ex7: \forall n. (n + O) + (n + O) = n + (n + O). + + The proof of the lemma must rewrite the conclusion of the sequent to + n + (n + O) = n + (n + O) and prove it by reflexivity. + + Hint: use the browser to look for the theorem that proves + \forall n. n = n + O and then use a pattern to control the behaviour + of "rewrite <". + +==================== +Proofs by induction: +==================== +* Functions can be defined by structural recursion over arguments whose + type is inductive. To prove properties of these functions, a common + strategy is to proceed by induction over the recursive argument of the + function. To proceed by induction over an inductive argument "x", use + the "elim x" tactic. + + Now include "nat/orders.ma" to activate the notation \leq. + Then state and prove the following lemma by induction over n: + + lemma ex8: \forall n,m. m \leq n + m. + + Hint 1: use "autobatch" to automatically prove trivial facts + Hint 2: "autobatch" never performs computations. In inductive proofs + you often need to "simplify" the inductive step before using + "autobatch". Indeed, the goal of proceeding by induction over the + recursive argument of a structural recursive definition is exactly + that of allowing computation both in the base and inductive cases. +* Using the browser, look at the definition of addition over natural + numbers. You can notice that all the parameters are fixed during + recursion, but the one we are recurring on. This is the reason why + it is possible to prove a property of addition using a simple induction + over the recursive argument. When other arguments of the structural + recursive functions change in recursive calls, it is necessary to + proceed by induction over generalized predicates where the additional + arguments are universally quantified. + + Give the following tail recursive definition of addition between natural + numbers: + + let rec plus' n m on n \def + match n with + [ O \Rightarrow m + | S n' \Rightarrow plus' n' (S m) + ]. + + Note that both parameters of plus' change during recursion. + Now state the following lemma, and try to prove it copying the proof + given for ex8 (that started with "intros; elim n;") + + lemma ex9: \forall n,m. m \leq plus' n m. + + Why is it impossible to prove the goal in this way? + Now start the proof with "intros 1;", obtaining the generalized goal + "\forall m. m \leq plus' n m", and proceed by induction on n using + "elim n" as before. Complete the proof by means of simplification and + autobatch. Why is it now possible to prove the goal in this way? +* Sometimes it is not possible to obtain a generalized predicate using the + "intros n;" trick. However, it is always possible to generalize the + conclusion of the goal using the "generalize" tactic. Look for it in the + manual. + + State again ex9 and find a proof that starts with + "intros; generalize in match m;". +* Some predicates can also be given as inductive predicates. + In this case, remember that you can proceed by induction over the + proof of the predicate. In particular, if H is a proof of + False/And/Or/Exists, then "elim H" corresponds to False/And/Or/Exists + elimination. + + State and prove the following lemma: + + lemma ex10: \forall A,B:Prop. A \lor (False \land B) \to A. + +==================== +Proofs by inversion: +==================== +* Some predicates defined by induction are really defined as dependent + families of predicates. For instance, the \leq relation over natural + numbers is defined as follow: + + inductive le (n:nat) : nat \to Prop \def + le_n: le n n + | le_S: \forall m. le n m \to le n (S m). + + In Matita we say that the first parameter of le is a left parameter + (since it is at the left of the ":" sign), and that the second parameter + is a right parameter. Dependent families of predicates are inductive + definitions having a right parameter. + + Now, consider a proof H of (le n E) for some expression E. + Differently from what happens in Agda, proceeding by elimination of H + (i.e. doing an "elim H") ignores the fact that the second argument of + the type of H was E. Equivalently, eliminating H of type (le n E) and + H' of type (le n E'), you obtain exactly the same new goals even if + E and E' are different. + + State the following exercise and try to prove it by elimination of + the first premise (i.e. by doing an "intros; elim H;"). + + lemma ex11: \forall n. n \leq O \to n = O. + + Why cannot you solve the exercise? + To exploit hypotheses whose type is inductive and whose right parameters + are instantiated, you can sometimes use the "inversion" tactic. Look + for it in the manual. Solve exercise ex11 starting with + "intros; inversion H;". As usual, autobatch is your friend to automate + the proof of trivial facts. However, autobatch never performs introduction + of hypotheses. Thus you often need to use "intros;" just before "autobatch;". + + Note: most of the time the "inductive hypotheses" generated by inversion + are completely useless. To remove a useless hypothesis H from the context + you can use the "clear H" tactic. Look for it in the manual. +* The "inversion" tactic is based on the t_inv lemma that is automatically + generated for every inductive family of predicates t. Look for the + t_inv lemma using the browser and study the clever trick (a funny + generalization) that is used to prove it. Brave students can try to + prove t_inv using the tactics described so far. + +========================================================= +Proofs by injectivity and discrimination of constructors: +========================================================= +* It is not unusual to obtain hypotheses of the form k1 args1 = k2 args2 + where k1 and k2 are either equal or different constructors of the same + inductive type. If k1 and k2 are different constructors, the hypothesis + k1 args1 = k2 args2 is contradictory (discrimination of constructors); + otherwise we can derive the equality between corresponding arguments + in args1 and args2 (injectivity of constructors). Both operations are + performed by the "destruct" tactic. Look for it in the manual. + + State and prove the following lemma using the destruct tactic twice: + + lemma ex12: \forall n,m. \lnot (O = S n) \land (S (S n) = S (S m) \to n = m). +* The destruct tactic is able to prove things by means of a very clever trick + you already saw in the course by Coquand. Using the browser, look at the + proof of ex12. Brave students can try to prove ex12 without using the + destruct tactic. + +============================================ +Conjecturing and proving intermediate facts: +============================================ +* Look for the "cut" tactic in the manual. It is used to assume a new fact + that needs to be proved later on in order to finish the goal. The name + "cut" comes from the cut rule of sequent calculus. As you know from theory, + the "cut" tactic is handy, but not necessary. Moreover, remember that you + can use axioms at your own risk to assume that some facts are provable. +* Given a term "t" that proves an implication or universal quantification, + it is possible to do forward reasoning in procedural style by means of + the "lapply (t args)" tactic that introduces the instantiated version of + the assumption in the context. Look for lapply in the manual. As the + "cut" tactic, lapply is quite handy, but not a necessary tactic. + +===================================================== +Overloading existent notations and creating new ones: +===================================================== +* Mathematical notation is highly overloaded and full of ambiguities. + In Matita you can freely overload notations. The type system is used + to efficiently disambiguate formulae written by the user. In case no + interpretation of the formula makes sense, the user is faced with a set + of errors, corresponding to the different interpretations. In case multiple + interpretations make sense, the system asks the user a minimal amount of + questions to understand the intended meaning. Finally, the system remembers + the history of disambiguations and the answers of the user to 1) avoid + asking the user the same questions the next time the script is executed + 2) avoid asking the user many questions by guessing the intended + interpretation according to recent history. + + State the following lemma: + + lemma foo: + \forall n,m:nat. + n = m \lor (\lnot n = m \land ((leb n m \lor leb m n) = true)). + + Following the hyperlink, look at the type inferred for leb. + What interpretation Matita choosed for the first and second \lor sign? + Click on the hyperlinks of the two occurrences of \lor to confirm your answer. +* The basic idea behind overloading of mathematical notations is the following: + 1. during pretty printing of formulae, the internal logical representation + of mathematical notions is mapped to MathML Content (an infinitary XML + based standard for the description of abstract syntax tree of mathematical + formulae). E.g. both Or (a predicate former) and orb (a function over + booleans) are mapped to the same MathML Content symbol "'or". + 2. then, the MathML Content abstract syntax tree of a formula is mapped + to concrete syntax in MathML Presentation (a finitary XML based standard + for the description of concrete syntax trees of mathematical formulae). + E.g. the "'or x y" abstract syntax tree is mapped to "x \lor y". + The sequent window and the browser are based on a widget that is able + to render and interact MathML Presentation. + 3. during parsing, the two phases are reversed: starting from the concrete + syntax tree (which is in plain Unicode text), the abstract syntax tree + in MathML Content is computed unambiguously. Then the abstract syntax tree + is efficiently translated to every well-typed logical representation. + E.g. "x \lor y" is first translated to "'or x y" and then interpreted as + "Or x y" or "orb x y", depending on which interpretation finally yields + well-typed lambda-terms. +* Using leb and cases analysis over booleans, define the two new non + recursive predicates: + + min: nat \to nat \to nat + max: nat \to nat \to nat + + Now overload the \land notation (associated to the "'and x y" MathML + Content formula) to work also for min: + + interpretation "min of two natural numbers" 'and x y = + (cic:/matita/exercise/min.con x y). + + Note: you have to substitute "cic:/matita/exercise/min.con" with the URI + determined by the baseuri you picked at the beginning of the file. + + Overload also the notation for \lor (associated to "'or x y") in the + same way. + + To check if everything works correctly, state the following lemma: + + lemma foo: \forall b,n. (false \land b) = false \land (O \land n) = O. + + How the system interpreted the instances of \land? + + Now try to state the following ill-typed statement: + + lemma foo: \forall b,n. (false \land O) = false \land (O \land n) = O. + + Click on the three error locations before trying to read the errors. + Then click on the errors and read them in the error message window + (just below the sequent window). Which error messages did you expect? + Which ones make sense to you? Which error message do you consider to be + the "right" one? In what sense? +* Defining a new notation (i.e. associating to a new MathML Content tree + some MathML Presentation tree) is more involved. + + Suppose we want to use the "a \middot b" notation for multiplication + between natural numbers. Type: + + notation "hvbox(a break \middot b)" + non associative with precedence 55 + for @{ 'times $a $b }. + + interpretation "times over natural numbers" 'times x y = + (cic:/matita/nat/times/times.con x y). + + To check if everything was correct, state the following lemma: + + lemma foo: \forall n. n \middot O = O. + + The "hvbox (a break \middot b)" contains more information than just + "a \middot b". The "hvbox" tells the system to write "a", "\middot" and + "b" in an horizontal row if there is enough space, or vertically otherwise. + The "break" keyword tells the system where to break the formula in case + of need. The syntax for defining new notations is not documented in the + manual yet. + +===================================== +Using notions without including them: +===================================== +* Using the browser, look for the "fact" function. + Notice that it is defined in the "cic:/matita/nat/factorial" namespace + that has not been included yet. Now state the following lemma: + + lemma fact_O_S_O: fact O = 1. + + Note that Matita automatically introduces in the script some informations + to remember where "fact" comes from. However, you do not get the nice + notation for factorial. Remove the lines automatically added by Matita + and replace them with + + include "nat/factorial.ma" + + before stating again the lemma. Now the lines are no longer added and you + get the nice notation. In the future we plan to activate all notation without + the need of including anything. + +============================= +A relatively simple exercise: +============================= +* Start from an empty .ma file, change the baseuri and include the following + files for auxiliary notation: + + include "nat/plus.ma". + include "nat/compare.ma". + include "list/sort.ma". + include "datatypes/constructors.ma". + + In particular, the following notations for lists and pairs are introduced: + [] is the empty list + hd::tl is the list obtained putting a new element hd in + front of the list tl + @ list concatenation + \times is the cartesian product + \langle l,r \rangle is the pair (l,r) +* Define an inductive data type of propositional formulae built from + a denumerable set of atoms, conjunction, disjunction, negation, truth and + falsity (no primitive implication). + + Hint: complete the following inductive definition. + + inductive Formula : Type \def + FTrue: Formula + | FFalse: Formula + | FAtom: nat \to Formula + | FAnd: Formula \to Formula \to Formula + | ... +* Define a classical interpretation as a function from atom indexes to booleans: + + definition interp \def nat \to bool. +* Define by structural recursion over formulas an evaluation function + parameterized over an interpretation. + + Hint: complete the following definition. The order of the + different cases should be exactly the order of the constructors in the + definition of the inductive type. + + let rec eval (i:interp) F on F : bool \def + match F with + [ FTrue \Rightarrow true + | FFalse \Rightarrow false + | FAtom n \Rightarrow interp n + | ... +* We are interested in formulas in a particular normal form where only atoms + can be negated. Define the "being in normal form" not_nf predicate as an + inductive predicate with one right parameter. + + Hint: complete the following definition. + + inductive not_nf : Formula \to Prop \def + NTrue: not_nf FTrue + | NFalse: not_nf FFalse + | NAtom: \forall n. not_nf (FAtom n) + ... + | NNot: \forall n. not_nf (FNot (FAtom n)) +* We want to describe a procedure that reduces a formula to an equivalent + not_nf normal form. Define two mutually recursive functions elim_not and + negate over formulas that respectively 1: put the formula in normal form + and 2: put the negated of a formula in normal form. + + Hint: complete the following definition. + + let rec negate F \def + match F with + [ FTrue \Rightarrow FFalse + | FFalse \Rightarrow FTrue + | ... + | FNot f \Rightarrow elim_not f] + and elim_not F \def + match F with + [ FTrue \Rightarrow FTrue + | FFalse \Rightarrow FFalse + | ... + | FNot f \Rightarrow negate f + ]. + + Why is not possible to only define elim_not by changing the FNot case + to "FNot f \Rightarrow elim_not (FNot f)"? +* Prove that the procedures just given correctly produce normal forms. + I.e. prove the following theorem. + + theorem not_nf_elim_not: + \forall F.not_nf (elim_not F) \land not_nf (negate F). + + Why is not possible to prove that one function produces normal forms + without proving the other part of the statement? Try and see what happens. + + Hint: use the "n1,...,nm:" tactical to activate similar cases and solve + all of them at once. +* Finally prove that the procedures just given preserve the semantics of the + formula. I.e. prove the following theorem. + + theorem eq_eval_elim_not_eval: + \forall i,F. + eval i (elim_not F) = eval i F \land eval i (negate F) = eval i (FNot F). + + Hint: you may need to prove (or assume axiomatically) additional lemmas on + booleans such as the two demorgan laws. + +================================ +A moderately difficult exercise: +================================ +* Consider the inductive type of propositional formulae of the previous + exercise. Describe with an inductive type the set of well types derivation + trees for classical propositional sequent calculus without implication. + + Hint: complete the following definitions. + + definition sequent \def (list Formula) × (list Formula). + + inductive derive: sequent \to Prop \def + ExchangeL: + \forall l,l1,l2,f. derive 〈f::l1@l2,l〉 \to derive 〈l1 @ [f] @ l2,l〉 + | ExchangeR: ... + | Axiom: \forall l1,l2,f. derive 〈f::l1, f::l2〉 + | TrueR: \forall l1,l2. derive 〈l1,FTrue::l2〉 + | ... + | AndR: \forall l1,l2,f1,f2. + derive 〈l1,f1::l2〉 \to derive 〈l1,f2::l2〉 \to + derive 〈l1,FAnd f1 f2::l2〉 + | ... + + Note that while the exchange rules are explicit, weakening and contraction + are embedded in the other rules. +* Define two functions that transform the left hand side and the right hand + side of a sequent into a logically equivalent formula obtained by making + the conjunction (respectively disjunction) of all formulae in the + left hand side (respectively right hand side). From those, define a function + that folds a sequent into a logically equivalent formula obtained by + negating the conjunction of all formulae in the left hand side and putting + the result in disjunction with the disjunction of all formuale in the + right hand side. +* Define a predicate is_tautology for formulae. +* Prove the soundness of the sequent calculus. I.e. prove + + theorem soundness: + \forall F. derive F \to is_tautology (formula_of_sequent F). + + Hint: you may need to axiomatically assume or prove several lemmas on + booleans that are missing from the library. You also need to prove some + lemmas on the functions you have just defined. + +========================== +A long and tough exercise: +========================== +* Prove the completeness of the sequent calculus studied in the previous + exercise. I.e. prove + + theorem completeness: + \forall S. is_tautology (formula_of_sequent S) \to derive S. + + Hint: the proof is by induction on the size of the sequent, defined as the + size of all formulae in the sequent. The size of a formula is the number of + unary and binary connectives in the formula. In the inductive case you have + to pick one formula with a positive size, bring it in front using the + exchange rule, and construct the tree applying the appropriate elimination + rules. The subtrees are obtained by inductive hypotheses. In the base case, + since the formula is a tautology, either there is a False formula in the + left hand side of the sequent, or there is a True formula in the right hand + side, or there is a formula both in the left and right hand sides. In all + cases you can construct a tree by applying once or twice the exchange rules + and once the FalseL/TrueR/Axiom rule. The computational content of the proof + is a search strategy. + + The main difficulty of the proof is to proceed by induction on something (the + size of the sequent) that does not reflect the structure of the sequent (made + of a pair of lists). Moreover, from the fact that the size of the sequent is + greater than 0, you need to detect the exact positions of a non atomic + formula in the sequent and this needs to be done by structural recursion + on the appropriate side, which is a list. Finally, from the fact that a + sequent of size 0 is a tautology, you need to detect the False premise or + the True conclusion or the two occurrences of a formula that form an axiom, + excluding all other cases. This last proof is already quite involved, and + finding the right inductive predicate is quite challenging. diff --git a/matita/dump_moo.ml b/matita/dump_moo.ml new file mode 100644 index 000000000..54eaea4ba --- /dev/null +++ b/matita/dump_moo.ml @@ -0,0 +1,60 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let arg_spec = + let std_arg_spec = [] in + let debug_arg_spec = [] in + std_arg_spec @ debug_arg_spec + +let usage = + sprintf "MatitaC v%s\nUsage: dump_moo [option ...] file.moo\nOptions:" + BuildTimeConf.version + +let _ = + let moos = ref [] in + let add_moo fname = moos := fname :: !moos in + Arg.parse arg_spec add_moo usage; + if !moos = [] then begin print_endline usage; exit 1 end; + List.iter + (fun fname -> + if not (Sys.file_exists fname) then + HLog.error (sprintf "Can't find moo '%s', skipping it." fname) + else begin + printf "%s:\n" fname; flush stdout; + let commands = GrafiteMarshal.load_moo ~fname in + List.iter + (fun cmd -> + printf " %s\n%!" + (GrafiteAstPp.pp_command + ~term_pp:(fun _ -> assert false) + ~obj_pp:(fun _ -> assert false) cmd)) + commands; + end) + (List.rev !moos) + diff --git a/matita/gragrep.ml b/matita/gragrep.ml new file mode 100644 index 000000000..d44c08d27 --- /dev/null +++ b/matita/gragrep.ml @@ -0,0 +1,67 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Printf + +let is_notation = function GrafiteParser.LNone _ -> true | _ -> false + +let grep () = + let recursive = ref false in + let spec = [ + "-r", Arg.Set recursive, "enable directory recursion"; + ] in + MatitaInit.add_cmdline_spec spec; + MatitaInit.initialize_all (); + let include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" in + let status = + CicNotation2.load_notation ~include_paths + BuildTimeConf.core_notation_script in + let path = + match Helm_registry.get_list Helm_registry.string "matita.args" with + | [ path ] -> path + | _ -> MatitaInit.die_usage () in + let grep_fun = + if !recursive then + (fun dirname -> + ignore (GrafiteWalker.rgrep_statement ~status + ~callback:(fun (fname, s) -> printf "%s: %s\n%!" fname s) + ~dirname is_notation)) + else + (fun fname -> + ignore (GrafiteWalker.grep_statement ~status + ~callback:(fun s -> printf "%s\n%!" s) + ~fname is_notation)) in + grep_fun path + +let handle_localized_exns f arg = + try + f arg + with HExtlib.Localized (loc, exn) -> + let loc_begin, loc_end = HExtlib.loc_of_floc loc in + eprintf "Error at %d-%d: %s\n%!" loc_begin loc_end (Printexc.to_string exn) + +let main () = handle_localized_exns grep () + diff --git a/matita/gragrep.mli b/matita/gragrep.mli new file mode 100644 index 000000000..f762adb22 --- /dev/null +++ b/matita/gragrep.mli @@ -0,0 +1,27 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val main: unit -> unit + diff --git a/matita/gtkmathview.matita.conf.xml.in b/matita/gtkmathview.matita.conf.xml.in new file mode 100644 index 000000000..5935eaafc --- /dev/null +++ b/matita/gtkmathview.matita.conf.xml.in @@ -0,0 +1,31 @@ + + +
    + @RT_BASE_DIR@/dictionary-matita.xml +
    + + +
    diff --git a/matita/help/C/Makefile b/matita/help/C/Makefile new file mode 100644 index 000000000..491bae61b --- /dev/null +++ b/matita/help/C/Makefile @@ -0,0 +1,105 @@ + +include ../../../Makefile.defs + +XSLTPROC=xsltproc +XHTML_XSL=xsl/matita-xhtml.xsl +FO_XSL=xsl/matita-fo.xsl +TEX_XSL=xsl/matita-tex.xsl +TEX_UNICODE_PATH=$(SRCROOT)/share/texmf/unicode +TEX_ENV=TEXINPUTS=.:$(TEX_UNICODE_PATH):$(TEX_UNICODE_PATH)/data: +MAIN=matita.xml +DEPS := $(wildcard *.xml) + +DESTDIR = /usr/local/share/doc/matita/ + +all: quickref + +quickref: tactics_quickref.xml declarative_tactics_quickref.xml + +tactics_quickref.xml: xsl/tactic_quickref.xsl sec_tactics.xml + $(XSLTPROC) --param declarative "''" $< matita.xml > tactics_quickref.xml +declarative_tactics_quickref.xml: xsl/tactic_quickref.xsl sec_declarative_tactics.xml + $(XSLTPROC) --param declarative "'declarative_'" $< matita.xml > declarative_tactics_quickref.xml + +# one of: "fop", "pdflatex" +PDF_METHOD=pdflatex + +# one of: "docbook2tex", "xsl" +TEX_METHOD=xsl + +clean: + rm -f *.html *.fo *.pdf + rm -rf $(filter-out version.txt,$(wildcard *.txt)) + rm -f *-stamp + rm -f matita.out matita.log matita.glo matita.dvi matita.idx + rm -f matita.aux matita.tex + +# test (dumb implementation) +test: + SP_ENCODING=UTF-8 docbook2txt matita.xml + +# XHTMLs generation + +.PHONY: html +html: html-stamp +html-stamp: $(MAIN) $(DEPS) $(XHTML_XSL) + $(XSLTPROC) $(XHTML_XSL) $< + touch $@ + +# TXTs generation + +TXTS = $(patsubst %.html,%.txt,$(wildcard *.html)) +.PHONY: txt +txt: txt-stamp +txt-stamp: html-stamp + $(MAKE) txt-stamp-rec + touch $@ +txt-stamp-rec: $(TXTS) +%.txt: %.html + w3m -dump -no-graph $< > $@ + +# PDF generation + +pdf: pdf-stamp +pdf-stamp: $(patsubst %.xml,%.pdf,$(MAIN)) + touch $@ + +%.fo: %.xml + $(XSLTPROC) $(FO_XSL) $< | xmllint --format - > $@ +ifeq ($(TEX_METHOD),docbook2tex) +%.tex: %.xml $(DEPS) + docbook2tex $< +else ifeq ($(TEX_METHOD),xsl) +%.tex: %.xml $(TEX_XSL) $(DEPS) + $(XSLTPROC) $(TEX_XSL) $< > $@ +endif + +ifeq ($(PDF_METHOD),fop) +%.pdf: %.fo + fop $< $@ +else ifeq ($(PDF_METHOD),pdflatex) +%.pdf: %.tex + $(TEX_ENV) pdflatex $< +endif + +%.dvi: %.tex + $(TEX_ENV) latex $< +%.ps: %.dvi + dvips $< + +# installation + +install: install-html +install-html: html-stamp + cp *.html *.css $(DESTDIR) + test -d $(DESTDIR)/figures || mkdir $(DESTDIR)/figures + cp figures/* $(DESTDIR)/figures/ + +# shotcuts + +tex: $(patsubst %.xml,%.tex,$(MAIN)) +dvi: $(patsubst %.xml,%.dvi,$(MAIN)) +ps: $(patsubst %.xml,%.ps,$(MAIN)) + +.PRECIOUS: matita.tex matita.dvi + diff --git a/matita/help/C/TODO b/matita/help/C/TODO new file mode 100644 index 000000000..73c4146d9 --- /dev/null +++ b/matita/help/C/TODO @@ -0,0 +1,12 @@ + +1) in order to generated chunked html directly + XHTML_XSL=http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl + +2) to obtain a better pdf, package db2latex-xsl + +3) write a separate XSLT that includes the standard one + +4) have a look at: + svn checkout svn://svn.debian.org/svn/ddp/refcard/trunk + http://people.debian.org/~debacle/ (thanks Debacle!) + diff --git a/matita/help/C/declarative_tactics_quickref.xml b/matita/help/C/declarative_tactics_quickref.xml new file mode 100644 index 000000000..2d09883af --- /dev/null +++ b/matita/help/C/declarative_tactics_quickref.xml @@ -0,0 +1,71 @@ +
    + tactics + + + + &tactic; + ::= + we need to prove term + + + + | + we proceed by induction on term to prove term + + + + | + assume id : sterm + + + + | + by term done + + + + | + by induction hypothesis we know term ( id ) + + + + | + by term we proved term + ( id ) + + + + | + case id ( id : term ) + + + + | + by term let id + : term such that term + ( id ) + + + + | + [obtain id | conclude term] = term by [ term | _ [(auto_params)]] [done] + + + + | + suppose term ( id + ) [ that is equivalent to term ] + + + + | + the thesis becomes sterm + + + + | + we proceed by cases on term to prove term + + + +
    diff --git a/matita/help/C/docbook.css b/matita/help/C/docbook.css new file mode 100644 index 000000000..a6ea52fe6 --- /dev/null +++ b/matita/help/C/docbook.css @@ -0,0 +1,56 @@ + +body { + background: url(../../images/sheetbg.png); +} + +ul.authorgroup { + list-style-type: none; + padding-left: 1em; +} + +div.titlepage { + background: #eaeaea; +} + +div.titlepage hr { + display: none; +} + +div.navheader hr { + display: none; +} + +div.navfooter hr { + display: none; +} + +div.navheader { + padding-left: 150px; + background: #eaeaea; +} + +div.navfooter { + background: #eaeaea; +} + +div.matita_logo { + position: absolute; + top: 3px; + left: 5px; +} + +div.matita_logo img { + border-style: none; +} + +div.matita_logo span { + position: absolute; + top: 13px; + left: 65px; + text-decoration: underline; +} + +div.figure { + text-align: center; +} + diff --git a/matita/help/C/figures/database.dia b/matita/help/C/figures/database.dia new file mode 100644 index 0000000000000000000000000000000000000000..652ea01eb80226a77267362527a7fbeac6145aba GIT binary patch literal 5538 zcmV;T6ydl=YxWdBepRe0{^`%ZKTJ=*mepc1pM5wZ z2%nvnvzz(tWOn!A?4SSm`A2>B=Z`0Ux}6k1!9RCZ@o)-%W45rLKAhdx_2W+$7vH{p zL(}I)QO_$hojjpMdGX(3IxQ~XqKmVSC#R?DH@Ge8!v1dg+oG|%MFi;es2x%XpnS6)|T@oV_j7=DcD zbL+>l+P>|><9soJOX}yxol64uvHxDXW_i^DE}Gqa{NYns*JbrX^H|GYuI}f1*dS2- zP*iu5*)A5mpK0?lC=$%rA4#-em@4-2Ub@3wr-hrQg{#uSO%_*=^Qx|jNxchsJ)cj@ zV%DJ6)l=CYXK_uV!CKEfacfVXI$6Wdsj_v_fOu9D*|`< zHo2|uuYTY6x-b&`Us!Yh=h5!}b+VXTPfOnjCbN3*_x*DF=Qy|D{)QZjum1W#i)ii^ zTqbUHDN50OnYeqJ+?I<2rnY%a;7<3;%PtPR_3i80zL@4$TZ^`Xm=@1vwY>dbR?GG2 z@(W(F&e~g;U;n$jsh7k1To<$3qPji(@$@hA-_KU+1GLBF_QTo#;my~xJs`Llu;0%6 zd7Q6|NFjc%kl7ydE^CDDe|^1u`w9k7%G(5N%)%!*R&&;J(v2NIcFY+VyF8>iPduG^CL(>VyP)2dv|pQ@X3 z5zzU27RHd$n$KzHPE5-#3rSLN*1 zjiuuVy%#aiG8~rXevbp+`_1F_Q}_gamz#ncT3$JB3fmd!XJ>X1f7}4y_>IpRf1XUs z#q**rAHW{%2ai3n!wbT$O?pKiM;a^yBTff$)Q*V;)h$3`;V>_W1QQkfoKiFp-mh`T z9kN&R`lKk5d_x(=z-_bW(JfWV*)U)?QCbXmzZ&k1Y*)LdB}rsZ$K@_6E5UAWr(FC`G~`APxF`)%D+c9 z1W82m1kp8EV=~QWntxL?zZ1e}8|vs5?$`-=1Y;Zr2GJ$f5h32u_i4P`&?olM_W^d7 zp8yw2r|?A_R9`ftHAVCV4Mj%wyNaz415uK!r#yP9`Q5Hp-7(xO4sC$>#FfvkVcm7Y z2Fn3E?jBtgaGZs-coa#&v=vrTH~2iCVT!@J~<|1sz ztal!Yw$3`)h$wE8-4>Ve*i!yRcjuurlWNA~Q&WT18J|_$|#v6Q& zH)cmPJEB=1j}UKE5!qe|!z|&+q-?JkZ%`fE3#6$K=fogFld^rh!RN4JX8X+cIqaCj zj=jTqZ|N^VLY}9DRIO(Z|k_MiYY&sX-EB7ig1w2qCp3M8Ff^>p4777q%FHD(T{j zYD;Z&!w-3zqYXIVXLgDy_CWM7RHtZS$C6#YZ`ska?1AZV^IEV{*IHM{zn9 z$CHd*9vtu?4^$$=s~_H@X8TtXch<2(iDIXB%wMZ zxUzWMXrMZbv{KaVbYpf@RQIo6K4pe`9fn(4tl3Ir%MACPyz#?@u7pN$#s$KZTGy0P zD#m9(hBU+4CD~}jFD<-K#M(2FjP}P57Qc2GvgcZOUfIkyLiGSAWxEPI z?aN%-`dzQCFNC#OqWl>Sp6I1Uk}Fto1)@9K{Cx<_o97S+!~-^^4Ym!$+X5#{8pGR7 zu!F@2V@mA5DjqVA~5$~{{QJc zaP4wt)bmEOov!}(hqD012M_|uu@|GNOc8T2pajv^QkfQeLuE1~UQ1<0e-Bw@W|etl zDpN)!7K+#_sZ5y5QmB>4w8e+&y=cs3Vp*1%Z&PNj%s$J^EHhU!QyiVlR8dz0h75j@ zSA?cr4j9sUDKn*{mlPHPxs;h)@x(ea_KV0mGwaMF)0sLdvn;p7Kxc{=>aGj1aKtck z*c@}WBd9oTlqNR(=#^%9SKMTw`BsJIce~f%Nt)^mp^QmZ{~vSkZR`IvXytX~B+_+zA$mhL%3;8J6yxX} z0J_%5M<`z1Clh;!#KCPs4$DJ|W3hyd#n5J=7{YlXmasbsit%&TNUsS$GO78}{WQnf zY~V`;nyj4NE^^m__7ZTst^@0qEe+3I2S)BX;8lA2b>3?f{nIF=1t4pvD>^mc&T2J& zVl8+w#uBE1KW%(YAuhD*s?IT?$5dKiEB&vFMR~G#x^4=RbEQH0N`o~67I<4A=SqWj zR7*wU6cSKyZfrv}Wn+kRe8K~TsHJwbRA8T0AyPuLt)(J(2;rtDyociP5&k2y+$*r$ z%4#)Q5G8$MlM~|v~-^p(d5{3IDUEl{P#~eh2xE; zaIEZ}Q!H~1N6z7JIUJzUjx1T2%E+A$zDvB+Z4VS}kU?95H;R|qk`bD`=|RL-kOgKI zm`5fsRpgEbS}p}9$1-`#1AAr+c#2vR+wp*F;aEk2tslF-{QTP#0J6Y*vpo;K+r1H4 zU}k~26qxcYBngM8Uq{RTBS^or1Kx=%jFg=5M8v*IPE z|Gk;?zm;JNZ{Q%O|Gn$tK4Nc-{pGX9#Of;yt z$sKo1kHIJfmg!Q7Vh+A-E|HBW?K$^yv{WK{;=npC;W?FPoKzxkGsY{w3lIX0=6%Dr z_0oSl9U)j$=NbX3BLrKk+Z@qD6Xq619ei6tu*p!#PUR+aeJT>2IpBR%<%YC$yoBRr zBVGw|F_lUHNV;qRXt=s`$vsRpvs3e--(^r&cNx6j(Ns&X6tjVW!(DN`S6=r#jeXqt z8_}A1%o_8=)@&UvqLm{HHQc9cN1OM1fG%%4aR3{-mqp7QM1Vx zwM2*RRdk_e%^Fmo=OzTGc#~a?by9=gH~#ScsxMC`oAe-)mJv4rfi0VGEf)#h5Q>+m zt_QJYKcbvTQ<2o9_l@5>11N7ER2!O2I-*IdXeP~&7NTJ(iFGQIX0|$yG~B3M)w0%Z z57Mxq>a?3h?;CzN%X+s~C)@KNd)6`SSuNc$K@-}uW=yO$THv!WzI~Pi_8c63!2GrL z?YI0fO}g9u%l;jhp&R!@56lb%Wut8D+k_;0))u^KGyZXz7EL)YWz`So8lasD8qi=P z6o4IRsDZ$1r=0m7h@Jp!w>_x z)Y`w0Sf-fkQb;%3!Rv8J?nXAV-w;NQsiDoc`*Ql2+u6KAJDZiwN)n?8IJdKj+|Fiy z-ua=NbI>s1obzD5dD|n&yXh&u%6e(Zu^ti56qZ)e$o2I;v^=yT*MOJ8xM+af2?LUH z@WCnkxh|x-;QB?>7$fxRrw;0=Gu95rbTm#Ipe^EGYbL3OZjJh6Pb<;W6(}Tl_RF0E;gub! z(`9b#$eggq*>_v7z&RvuKvIO{O+egqB*Z`zmb1Zx_#(V*9=D`p5+b;V%4p{n8mVnq zh)^4*VMt*u`mR}lP;2XPdN0)sbC=Fbdp_58WHlI7?Q&CZG<7u50dMuHsH*w5@RS;Q z=c{QsyW2k+wlx?&6!PHv>xtNlH@4j(8Jjo$r@Hac1|Lit1aWHfdA4Ir@o9q~W{5-L zT1wY0lwdcJjSy;V+6awv&pJN9Wx9E)zLr&rdG6~2Sl8BDPU^)_3x04iZ9Uw`e&kZsJOLj>O(i}cpWXa6fbQBt==Td{D zv2=tHF?4)BvYXe`CJzzL6qkKDA}u3%cZtJ0#F^~g7TIm{RX4KRVoKVV><;Yj|2&zN z&1o<|fcArr0cDJhKPHfJ4i2Z|@9+bdRL!P7QR0#*#6X5vr-=|H#^2p zDIUU<>60=3I{)po`Mwr8B_n-G#&@eVSmb<+HnLT%-r z2H*A)J{x68kHTb8M@4e~`sGt5x7Q)J#$H+GwjO zE#3Y!qn4b3OSG-;vq`(hrA?m}WpxT)(#bDHJ*kWAjK88@T^X^;iuL_^L%k3cyHFn!WMNZf)3YX|J5-VB@=W$p2Q>-{#e?K!2a> zc~#u`9CAS;ZG{VgL3P2Onv)dUE`o{%PZ;91!$s3dN-LUXJ3P*S+xp~62_g(~VFp-bAre)Hx=1fwi%zu zEPGV$URUNDTz1A7qLzhhuRJwom9ack-UNl}*wr=*mZwkU$zwmmj$ zldyEvXq)2ujo6JcYz#9@Y9h2SxezTEq9rawQ=JOYWTZm0jyxwLv_W&d zwOzvuLdR{U)Fe?TM5WM{=d={!+#P;GgkDBGgc}A{r@S=P<~FF*^hh0otqSERPB0mljtG#~w`e?Ks$)s{*6+ zTqqIY#+^|}DbtDj17Mn|DpS?iRJA3nSQk|m{=1{noE}Vb%TuYWSiz$@pTHnY8%H)u zsY`ce5aU*p5ju7wl;9}6M8}mq5}J?S1jPtx1eTmjZX_d;XO_z>mzd>b7nWnM!*V7< zA74hA6PBf6YE0LYBWkd=NK7$h8$L48T!}Ql=;pXUTsm9iGAm^ks3R6i8 z2gW0P`*-FBbnmVK9Uah<$-GJ=OyW3g#dV5^KOn(;b4YG$(jJ(B-EqJM{v4l={NwcI zbaQI?NFuqBt2vVNvX!quLyR*{q%kJ*QRX9GXkHHBBOIHL0*MlG@ChZ1AmZx9K)sBb zC;_s=DAn|dS(ZCeL%9W(y^&KUOWaIue!BSU{I?5)P(JKn^hAl3T{4!BI(Vg{4kED> zjS#C+(vk&1y7z8byI7U6K`B>1OWg@|%rr-C2yz4*_4)6gPJVkTtLIEmV-wVxNlNnG zQn~(k6vZOsI2fbc0RU8tebgHT!?R%=&{6i714SLK!N;JZnr|l4RH8$pR%VGwCaL2f zDgSYla`<5^5>f5WP94|P0~n#2whlm08o9U=v4zj09z{8LbZrizB-=^jYSe=$)n){V z^W!*(a*4N183!wi^I?}gw2O$4@g#*3=Nc(Iu6L!7kq(Fnn+L!+d@x{jN1$7p-d0($ zjP6*ij8SC2>e&6N;kn}qm{mDHn{Y91iHv1%ryoqCTdeI{U~Y~kK;5uZj!`G^tyZQ< kGf%w{o@zc%i|4ZXc+z};f9|T{;p55w11^&3Y6VCE0Q^MI>i_@% literal 0 HcmV?d00001 diff --git a/matita/help/C/figures/database.png b/matita/help/C/figures/database.png new file mode 100644 index 0000000000000000000000000000000000000000..7e9b1ca78cb82e22bdda362875df303fb3ef0d2a GIT binary patch literal 15256 zcmb7r1yqz>+wKs;AR#G8Nh3%}cMC{&m!vR&lyrlHv~;614Ba3NA|>4&f|4TLXY;<_ z_x|61&cD_(6& zB51)cBq#A#>QE?jepP7&0-=Dsk`z;SOW(`zwkMc&zZ-Te&wcK2f+%JD#9wm7(Enww z7(p%0Ej9T%|EG}{j}MqwxaXLMxF!^oWm}dJoT6Wq12Hl=@x&_m#bl~F@XG6f2rmS@4H3@t4!tY3bMd)&9n zaMsqD`FT0$6Cxt*dOHIPi_JonoF%t)%)~!RzL(?6*F(#>`T3V#txvC4P2M2M6EY9^Cot&QvlmFer)KIJ>&?$Q_m6U6zj*C@IOy4-O42R$D6Z z%9-s`UNH=bqk*vHm|ytz+y{yFAn#YyYRg`xHD*W*<0%gCuGrYaQx9H zovpDN?|tgKFgogR@#n{|$X$9~x`^+s9BYg7(dH0q>p2xG>)XYqcQ{oy!*|!ir>Cc@ ztE;7Y^>wwiwe|JBhdqRSeSK}`J*?URV`F0}}$ zR-`;Ix_p!yr+f49s+&z8<_*h}^3=zjSNW-OX&FhBy_5R>JmPCtfBdi#WnWzIy&(DU z$_m9iIT4ZZR$K2nSPL;^j(;}#q{-dQHonEmCnJkxulDFJoO-m7NB6EDR?K_3;O8CZ zL<^^avGqP%Jj*!n+WHnty~>0}KQ)#i3zK+U%%mb+6Iy$0DKn5~C2m(@)nreG!)}>? zS=c&YcJ=RhY>x4m0wZTOpOKOANbolVbNxKxsYq*C+5Yzofv&DDBkvOpnZMTQKp z;I^`S$-hT{3Cod=UIJ6H%5><_;(D-TF3@)UXCUT1V`-#vVT~l&s2p5Ems|rb!JUzs z-j(pV3SrVUh3PH^N#6WZs18!np9wXkN}1!KG#;?TvxIMs$Ae<3s;aWCH|XzYGef|2 zs?1&T$h>jKQJdWx^R`vurB=gW6D%YlJ`zUN&}wQqxBUWPxuIgIu- z+n-!nG3J$fh>m`@`toKPbbM|DGLg8hxjibY|n`W@gSVE?<+X`%xw; z2POy~4ih(^I}Dy39}9w@Q1n+D7QV7kQhJnE)7ExZAae8T=V*>}Byp{2FIM88mb0a+ z@2;)uhi-I==?$=Hme1d-$%%>Qn%=<_6&1zBJCA>j?`&_++#;c3ZT$G*-m-LkeZAfr z9a5d!(&GI!;)!874?X>sR@xvmGtOGp++;v?YL}+{-1bhEFzDPwXyQ>DS3@a6|rH@xGKKjM!a>YzKxpkDw&SXxWN|L@NBhkTLh1_cza!=SjckS2Qb6_UY+lcUa1=!>FIj^F zF_t*@5iQt6$f1D7(J5^2?$QK#oi#7-?e1c@hq6BxY(aKd&+G`)+EeJd$mF6l`<~8s z@a0HRLZWM-(JAlhftZY<;u6@$B=(*4F>gb%kLl&C-d}*;u!b)|$jZyh3!ot7wWpw` zm-hGu0@n5UdbClqi^8C6Bc+^`yoO(npCzVqFG1!>JcAmT^Khb>rnOJZiG zu=nLL2nUkF`rfh-2phDu{EkrwW<`8x>FD^UFOL4|>dJB`^(BLXy!`d?xKedhRX6e) zxsI#^3^^S^5SA@a_8Tsts;SBCdAggLN_^@Bf@K`NQljDmoU?BrA^BbW_P%kAzC%3k z6r#qVHZ$|C&n*AGSx`oL@9aAP{JH6ik%3pm+r41U_I4bB-0Sqj{p9 z0K-N>XeU@1i1~t4iPFw2THc6ag6S9TXLy7T(wZwm%O*ZZa%D&!L)0K$EkKV`1;9Kt z;Q!<@GR_2VP^7b%-g2>u!o_S>7B*v{1}Iypgy1`MJ7%%`&_v<>n(F*>BhHW-kQr5Y zJ&u1iIIMq-ByruHc~MsYhchuVmwx)>e`ChDFgM5lx-$susHcK%F?$C;e?DVm{NvGL z^ZFrT3yLU`SMO6C5iWmG3S|wAmrxy$X5OO{B8$DTwx$Y#8@1hDUmR`B8@m1OKwb9O zDUFDTpwII9^XJDvP)uiMr)8FR-Ip(d3=Cln@ap4YI9lXpvCk@T>lNDiAo3T(xA&WR z;^6EN1_m@>WO`bfK|x9BU~i9h`7~g9hc*b~(W7u*JY3w?%k7f*c>KiZ5`J_OOlQ>B z*x2u1#nIK))Nu0fY;A5<2{D7`DJ@-7l42tg^g93D-VRZ-7MJny@p<>|osrSgtCW}+ z`va4uAV0F4&5(@zV0q9A`Hnc^Q2>B;g zCxtc6uK(l^ML~A9F-WnRdaEpnOgdGr2ZnVmmcyB}a*5dD$YL{9=IHZ{?nf35g+xLY zHoSBh50?owIwT9)2dj2%kdy-rg$UTQK-&HI@nik6PZ~B@rY_qPMH3V1V%T&FsS~ra zub>zEu5I(Pvwc_*)?rd=@85RmJ8VJJ1Ez-%D$v)(!kei;-qH#Y}9 zT<81u9>vOY-d|{xul0{xnOCcBv@C5_LmEycT-#wN(w06AXUOBQ7$g$%aE8H3+;#!D zkdu>pAjWIIBC4o}B?t@gPv(M5QF~J0Xk7W+>==QGI6Xcl<#(1@;4|-!55uG1+}My$ z=N)|};s5UUUQtIi%BiHeQr}00mWh}P{brZa+}w?cBDKZEMJ2(*?qA~ty%A4x1|MeD zcKKPBA_3?#U2gQ&)|LQy735O@xV%>UQD@pTOLY^{)Ae<9`g|A(M~tBX6ngeunw*@R zxp{fa22JXGy`s=swonQvYzmHp{2C0`E?G)PM~5-no7f9(+FaRUl@^T>%@(kxKo=dx zU|pO%*D8z9#on~xMQEY7OZ$*=D*X%wM&|DD>0PC9M?jL1Ph&;JZ;<3KciL`YE;6R3 zrkxeZ&qG26GnIAW$n<*AbVd<%Pf z`(I;uyBeuNo~MK9eB-$5%#`{{Jsx8zBkRQB_I?q+5tr*HxzPe`78*u(PWG4E?&6e$ z(U1{+FOqzpV4yr_WJDGtA}6=-!4%M}^9w#U)TmpLQYSGvNvPpeS5;L7fHQAm>qw<< zh%3*zI}}H~@_rnUkdO?^&jwRCz#>I`L~d3hcJotOVLo~DbCXHNzzMzZgZe2_zdRgGUj>_j|_df2>ZyFyrNQW2(PjA;t7^F5WF#sNn($pC;dKs`UKER z>&@vr85tSqGgW>A;RT)XPm+ks05&M=3Z|53=!ThE(H!I9g;!5c55U=W%GQWOh*F4^ zbq`MY`pkNL=DQ6B~dywcB80qn(-suJk;F zz(D~2Or2m;Vv8nbR`NYlNWi=wAJ?a6>%1z#9LsMM#AMyp6cIBKLIFpLwVSi$yW6w2 z;W~g`1=#M}@A>6hZha5)4SI3!yc8tkXV@@o5|@}=Fub2XQq8@2Kumi27tb@h!)L!dCB}rRx~m2e*dBLT*r)lYoa!yA1kJ#! znK+BGv$Knfi|gyPY9t%uMi&?N&aUpRw?wMV0Psxbf@!{b)mM<^!^m|DGB?;9V+-PT z-*DwPl0In-B#(3whgYnAi$G#gR2@W72|p!&H-lK9j@!fCXy|*r{?y2A^?hz`ZlQpl zo}ML$FCf02#+9B6nsh@QdbXwwJxf8?B_(o0kpWDVOir%i47GaNOv27jy2jr7-N*E7 zH0z$gUVzTFx3^ncTMGpeUi@fkYMPtVJ>06Zofp3T-KAEb7)GxRK;6mCbY4iPr&$ih~lC0w5$IK0XZ{-R6%Ul_c9Bz>3_SuM20r1&IPwhk3! z2DR8V2-}2=L*y19SBFP@H zV-bD&B&gM6=xivJmM6{K-F;Z-Y=JsjP*quZwB8{Zjh6k+YrF_yd=Z^@83a(x0d4HK)p9Z z=-34+Nm3 zF{m`@$yZ3DBKhi>R??ArLnw=14N+57wYIhfd*IFaaNqMIoaK6&An=TJ_4Sr! zW);2+BDx2<@^28xf`eFGwBOSP!t3g|i7-4`mWvJDFh^Y->`X=y1Vj-&L~CW$IVnGJdBbKZ{hXyJ=HhaVO_?7x?QB8 zeA81^{nLT^G}IGW?6*ft{8%r!C%mc21K^T1+(1f(=g-rGJY5tN6dI5d5)!~Pz{|_0 zXPu2Pyp(2Fo%?Z&EatoC3N2=~^+LI=IJ0r_F6BINwBJ4AMGmF5=Y|GCT07*$R&ZBz zkXrpEF!d1yVd&YU!ln@jCr3g;!jK2hd&3TmC__}W7gxi!2zNQ7Xeylr%$ zN-MT`Vy^b=NaYAIa}1-GlUVL|Cpzmc$m;cNH+yrnu)JSrlptVCml?>m$zH_e#cwW5 zOmO}^zvMz5>Vp*k;DS+UZ8fyk1K7*O(S#tW@5qjV#R1>SXeTW2gaXNNF#*)zP%mrv>3M?~`XbA!&uB_+`hiMjaV z{Yg7KUgCNst{K!^hUQLyk>cj&)&M}#sPxkWa`LKmiYXN~+xUse$%~uYsw(!%ZiO^% zu$TezsucPgUQ=FWzHb45!!qHJILyY<*0yx{!1wZ3!R)|0^-=saRE!=>b7I#ITzSVu z1(~`vZ(=!H9K{~#1h1-o0GrUIoca_>8MOCGR`%m2MRVKV^oNF~n0_3M{>$@iVq)uG znf4mzljS}qT~BX+e+nVzcl({qnfLdt`NntauC1)Bfc}q;j%E>+bgQZ!a=EmgEqM;Y zs;4lnuy=}{-^Mflq+E&$Me7!-ilNuFVveo0nT2b+PEo_=!K)}h#2?Uxvd9+H+@SC2wos;`a2B7V9W`aiHllMMt zZFO~1x*Rqy7fhJ1{F*M6O2bL{9BDZ2Tb$5r{_F(?* zW2e?Mo0&xjyffedI(VV04#dhESKl+&{&>~Os0I8vy|4oUj0Qu0f5LTJlLCc7^kT1kda=B!^m<_a~SUbv!l%qhukfeu!qw7;GVW^zytfO+Yn?xyxQ}A8Q?^EjScbRaF{`4{|y&&-ep_MSS3XO z|0nxv2R{4ByT%oag|mjL;vnV5PlFA6?l8|G<*QO2SXvZ&Ehh zcG-jzkjgsTAKpU2aAN25&s%l1HM@Z|S0lI9qJwj?Y*Mw^S`>Q3cay|=lMVPfPw&_L}+7J+Xh&j<<4#cW%u-qDXe!%I~`{|&cA zK&f=WNL`|D(d*^XpslhGsr^b6bPYBG zDhmp0H8r(?{{DD^_&l1R_{2m|B~49FS0nGnfcgpWy(&3UEm!-^Hol&oR}oJ*1j(c2 z-Tsbl$wZP&w;uC;+DbGl;?A+V=MNJY8y+JuiCKt5YbdWBx}l(==6QlBH8yeI@S(`h z@;Z!TZq%o=50<(!QCNt+Z8OEv z(BoGgm=gfcExUp-gJS-Z1;G^uHJP5SuCAV5LT|q+uDG`BAw4w_2Dz}8o3XJU0~aNY zh)5ei)Zo^zKmJXK)cGE+_0TJ2$}1>nz*=M-57(7t|^lC?50$XGsj^rSlR@5#Nq@zEK)><+^N znRo8b-&lP2Lxac3_Qr-8Rik%`kY}Cj`h|-iwZM1#5;2*z)>$o)&uph|^i$+t{s~bI zbbQ7%gy<*dwd|Zg9t36e-z$h>QDUe;lrs?JB?gexZfa z`bHDfBzL!0_uzP$-eHLKar8U-%BT;SndE^?I1X@2Oi}eUmrCZ`oSdA(!f!h#>}j*h zF#>3m00sN5h0#MPug(s9!Oj3wAv-%eC_SX0eE*F>6PJ;YkkHkg16U)WS1LFsf1Rv# z@dMNj=YSlK?MVWX)Uug_vbOd)*g0U(=xJ%g9`w1e--1fZ(%gKp!NC-aond)>dAZW1 zp%evnVR13w(hQnUfdm3@KG-u9L4#>L(W;C>+|~+VIhI$msI3H;fccV)+}CEA8hh1j zB36|VK`kAnuAxz>^QQ7UYa%(xlh9f#3Jk<{o=_E>63nn5=P|pDjInGd_))k4c|{!q zW5M}s9Q5?akjt17M-ek&y}x0VKBMOOV|>T0jlQ_yOre3O5AS>`kF}{%YD?j%NM=EV z=TQXRWGI!5XUNX!qTTvcReM~;O>g20hDIx!!{8c2*C)*(+;AGE%m(kDUz6qK=X`_4)K z*ZXXo;*w z!tQ^}@+l@KCwHbw@dyjFRCRP3?N>W5FFj7xu#wBB(Oq8&EiV*`m;1l|?OnZ@$p#$> z7=4YcgIKrv5h0i@)T+H2MO2AGubl$S+0Td)@tFqR6coTpOJtX&gkrXEqXK4HYL$_Y zga{M7iqye`lTEmPqZ)ycmaa&7@NCb9q%zXI`|H^{{?iPERDbQer-@lIIO@aS>u^Yt zrFWf&pkYLvbrO0AIL+v4&xE%k=c+qln>CCplY6up;9wj_YQo+qW0 z!r+mKep$&(eZK_qugm-MvE%-u$HG3o08EtXxx(SR6dXYx%k8=_4h~Mnw6@fq^sNqX?1T;0YKm<6@cFdQ{Kby)i(5n@uSFw_Q~{$2zzbE!gRpMRDIIKlnJW*a^0*9`${b!?gu*asn* zW)KL8UF_TivZJ97UaEXa%+1DE92uU}xGz@x2^J7nB$Zd&{xzT1^Ru;^^1r0|Iq zg zLk4?H01@mukAoZovMzJVqiIC&QW{m})(9*ICr!7wxRSeBKK9)K7uc6|!HqMg6R?n; zsf0MJ8qzWWpdRgFk@M*WEb8j9OkFAt)a%*$i_NUsVp%@o4yq7?4(s+}3mBOWIQE1I zzF3f#i;>3hsGb*;vl+q8-l-5w&td-;Gnn zxRk&fe)>-a2SH@Xo-TiJhiexT@{)6qvpH@U!FuTuY8&zAK7}=WwX;KDLx|H{bef#0 zs;e5)=!REOvMXDAI}E4%a2(X5ntbnJ>*Kw5pe#}Ju0yB*7yHG#%vuF;WDKX^W?K4$ zp<%P5q3XVvaddN}xvd(+udm_SA%e_%Y!&hx?W9`Mn^;_{9pX_j+&M$6gQC(H_&d;W zbP}z?MK+Hz0z#@cAp;z)-5#luGSOdMQ7Xe~QxSqi}bS~hQU(9``HE2FG# zL>CE3oFPp+T&(O0Hg9uD+Q+EAQ+&|w9qlzSiFm}ozs*I6Iq*JqAE8{B-|wf|+1kDV z2Ktk^B+B|bQfrj>x!|7-4}~j&ewvWE9++r9i*0#MiudIi1z{4ND`LxL>dzOjqK0nb z>aP{hSMZ}D_gJfd-mp5SWm~-SLVE<(+HTnbrwK50a;9=HD@G67#w3d88zBp=^)D2BLd7fGlxj+` zD&NzG;b$lckEFG$UF$K3G^Up(B!TQkyUXPwN_X}UJb<7YM{0L%;fg^JAlWDbf-t$M zP1L49MdWr;CagfwDxBXBAcY;5$z1zqjVOz#etg=jQ!Kq7lerdLAfXJ)vXh5De4h6Z zE2e1tocS~2-OjZ(aMl!U_Cl#ekq6eTtDk`BQ7UY~4DAHOKj7}#;>YuB-+Uf`K%FWx zGy#`^L}r^U;5zAnkAyMe{E&&kHqxvjbvE?*xD;*^%`PS%B&cti$yhyB8Q(B!BJr)v z%Eo5*=TE?%*nk2^Ep_E@uA9jm)F+@B8fN~XPtd0WB+~r+JO?}b%zs5XV zej+Za=oD%1lnFkS*c_Rh>$7*x{N;NnW-#qIn@Ql2`JLf z%UfH8Wvzfc>FwL{-2&}G_AJ1$@9*2m77cHWFL}tGb^jqBjoOFN20O34Ie%#iZlv1n z&_rAYgf$0;7Xz#B2@UV*L1_kC7;L`LiC&|=ER*azjzIeWyIGyv;==8a89R=q>qlEQ z0CZh|)8+Q|R;Svc@?KI6iUH(uj7Y*0c1K4?ZP~qi_IRxy-x~Se(iFn0ICVCp&coZz z!@*<%^_U~i!e*wz|3NtxDQ|_-mZB|PGkR3O%Q|crPfoZXz+OX{LY^Q!u4RG>1W;sQ zhYGX9_Uh{DO!^J>OJCd#%PEm0hP;EL8lOnY?>P0C<)(JG-JX=+vnLA;4nIdewcX6O znF|!ir?3N(4To9^NQ)}o4lE(mDHf8^GTpAx*sIUT2p_x?CF%}xH04_Vz1jsR+dqKX zJ>imYh4arIV+MA|cL7pHR#sLqgMV^y@unM3DP7pxV=(!}Y7@z8Y_8CpZ?_7cPOA+a z(upcHg~ijqcg&Rb2T+{f+%8{l@@SIal9jLoZ4xq80XkdD$eZi=eS`fiA>vz}2L&a) zfxow(;B6Ax3I8N>^T8fSnSY+ZZ7bage@5*;B8nX7z;{;-jqQ0Rae=uHk7l>Ao{~X=ue2`%Oqrlam=E1S4TO83-f< z&o#|Jv#@Br*i54%di><-L#^D({vRwqBxR>1+l7WhP`F=h#3`{DesMe5*1&^*2-rPw zl6x4L2G#kcExV9Bo?O?ny~%@|a584-jYq6ZNS!e^8b5Zp-fPt4{Hm#-sL1LsvN;N< z70>c&z)}QkBpg1NF16yhk9BbLRa`Of#~V8)>HO^n`TKp26yM1pf7La^>xZG9fQZ!4 zAfPk@TOQcbz6}h_SDK%KaB~>n0+t%EC>H9RbgI z;B(dtWSel$|7H^S+5B5aeV4p?^9^bDL-HX6W6Mk+93+9F_}<#Ezc5?z8i~?uEcX>y zyFkvfQK$jy7qAOJ#dq4RY}Uq;-r-uXh78i=*nE}ErSLhnfFG6?a2%uo%&3PZ6oLV4p-iZqVFKoFJX4)mBoE;ZC3e`# z))4uwC;X4iCxx!kV@@lPA?<`xB_Vv<_<@$pS13EFTrgZbydJZ$^4c<;YANg>0F|&F zJ;DFw%bcsodSap;G;|gy=SQ^9T08jJ z*xH3}bFX!uUrhr(8wfO54N>nU5XQwbXVC-NwHE<{in)^#Zv=?fD{ z4*uFF>P~I!11yCQ05}s3pnN}sl^!pZw}5RA8Y!q&*P}(I&eo_oSoIOf%^;f<=r>WN|pB|O*4&&}NheEDpZIp9so+iv-D)l#cH z*TZ}xI!$TJ&A3-zk$Nv?IsW*-$34?1K}{kB{ckxU?glnjV+Ga}h^dW@js0H0kO!pc zo;pxf{FO7}I3qd5f=t(oR2HPAdj27JdCEeeH=ispQUt$u5?Ic!mPs}jk!o<$oD#w~ z!t1KFrGv5A1qGSrjqm;dLOVLdy?g8i%(uLp9QE?jQ#DyI23MeJ^YqjqHV=UIel>Mk zke>60n!YEj+%*niUCJ~e8*eOMNanWHH8ouaKF7a&F?(}d_t^vng9*Ibj!$L>jFEs#gwP;* z3Poq-;l%TO>OF{bCfGP+9F^EdJx%`>k&|xH+07p|pI{*)9?#ET0EQ?c0z+rih8i0x z^WdeC&9kXWml((OzeynY9FPg);^NRKfmnHV;RURKCjCuK{B6suWtOG#*sC+VBX=pa zDZ?FkaT;dtt=)rR$jQi`-wJEKzO{)73JNN3y=0`NeSZ^QI>zulNh1^8rfb7o(BDDQ zeKDPS7mkRMv3jU6`yDfn1`BpkY^)9>o05`}fq{Xzj~~C)mpFsHR;|JRs>bROA0Ho> zOS%~=zNjo|qBLz7A0~#-d$(Q6D9-oPY8kyEH{&9poVEdRYu7Njbgb{RgzwAe&nBy# z??F*zT3&%8eU`7b(?cZ2o8kEF5tc9yQ@7AjX!wT@x4<1DmtM){dwUJ+b0E+;fgedK zrB&|7%({Rdya8s*Fe5>S?KjTWEw_*Qx8l2E+-1+6-Q{iCQ$uw=%$!$c06QG;Jf57K zjAi_-4XM9);dcW-(g85_&W(+I1X0U+q7Zn4wFH&b z;E!6aiP|&NiWx~xb&h^qndfCTJO;ZwmT!uJu-DG6z(fNU{F%+<+}Fb)?Jc|hPfWwf zw*+d$kwMR?(gUi|4FLvnZgYDbr+`5b1PIk@KwK4k7+};G#8Wm@_(yeJD-ri99Aw_8 z&5})}>Z}zpgpJ zDP7LI`IkwXCq8nr6nbghv~^lhIs|TD+TNw zun1^qXufqyN)cK=*Vi&C!5j%X>Tas30hYD!4$ay3z;afaoh{1$GE7z1z~Ck>>sr!9 zC+}fpqJhG%dc&jL+3NK|@rA-cWvfy+1C{=j`4AC1LdiMczT)@t!*A$*hB{(mYlS84 zpLv~z9E3eoNs@^a#OoSyC*FjozIi5<+^=#XVUk6wy6%aC@mmfe?-;m4U+RHUKPsQHI z)l{eJ%{n&hmrtODK#VdynzUTN6YF9PlTt0Cd1<)+yuBQeB+VZNnm2U%!Y_W5=LLM# zpp23?$pcmw0LrZcZF2shbP|2;JzQnJe~HC)H8nETxHLPV4D@o)RYGhtJhl~`u8$0awFbV#B?W$1yS%3UT^Qf522k68`90F(xM2T&#AG623y zOG}%Y<|Jo>?Oj`|aV_&9`4(gmkd=IXBxp%Rkv1B4Aew95E3xH9^snjUo~<*tJB|>t zFFc=$&_?YBkPQ9dLjWL-{`|3q!QKtdzWJAZ@IK1$9+?q*@xD3*iFp6$0w~r_SEsfw zp07t7|4Z(Vz^($77jO}R6(K6Gtff^C2ti=QFu(kdBuw-v(W2Jt;@&fh9-wSs&|H_W&#wHT+*QHC+P>7exrkZG;AmpkEvtN>^7S~oh> zRD4xLbLIUDh~50v0I9wDv5)b5!D$#MPiug7daem~yS>=b&@HSqS~CX5I6%={TwH*w zr8ZbUkNGSOGbIpxqGYjZ; z0T)1}-^y@ZvU>9-S-_R$FTa2PEBva5++19?GZmDyv_G~)?k>Q|3V4+uqj1*2N=M*5 zLY!1?XJ}Xq3!2nISCFhQQkV?wEQs<@x3shb_IB`{%s4q9O~DHZCr%`u(%*M#x^dm*>lpW>b=O zxJv9io8tT$dln*c{Th@U>W2z(_9msb;WS^v{!8UPKLYGs)hm1|cmOClTf8pV^N#P& zpX9!ZQ`d!7ZnmT{j;g>7#!PfYi8k)C8P_Q9eMPK>UuLGK0S0dT^odej#?FoC@_-44+H zPuv8-0S&^e#g}9v#8*Av3v05@tc$x5h&yqLH3i02Qz`iB-wiT%KF}Ge)lHEaATVS- z5H%HkK_<+}SpyhsU~_HG$)WDdY4p9S_w@vl7jV+0rKA*%qAYnoO91MHLIQLyF?Q6g zVV>=s760NDib?6=ZvYV1*4BV{e*ofrbaQvI&5A(}#guAIcrA(UE7mV`Nzysqgt10$ z@QL50&@y)57im)Cm0Lm&olsypskT#4w9M(Q*WPX65bk3Y%^6V`7Mw|B(T; z=J)DgL!=e*6=hiWE@}k3&H0znKRY3%x=4`7nLXq!!s;IWT>QBL0b7$`Df<=#?hfIC zIwUp?IQ3u)*Eoh{pcB#zg8cV!vQm>$Da*z2*WZt*e@8tDMcT@Mx=<)qKIYQ>F|WUk zhotAvg5==$+7$Uk_&d_F#N?S^yVQLgq9A7~(~>1rev_{1`Pbd+I=zceUD8S{zcbQ8 zcnP>SaWc6>+%|Q3nH%ac=M7!x~qOgZ$z6?SyvEbW{7OYJqx^Hy$Op%Hg; zu6eaTLzgI#-<4VLLZp`er8shsnEh@$Gecl7xLleaqgg134L^c5;CD?P?=?vTU18V& zYT0>c-)u2v9vxIkFR}*~m<+jw;n}+!nOw7tK&RI1hf_O_b&c8}hElxg8|Kwb4LZ5$ z6KP*esfXuAs>Q$PO}|jWScCHBIOwyCLzU(ql7w-E-7q-8DX}61;~Wa~w*7PkvLAl$ zih7MLuFhhYwGpc~c6pa+> zRM3UHJ;uB4j>x_YRe=W9^pHKlo%63vqqkf}mf1tG+;pznj}fA_sf0<_dW=PFe&{?8 zQIt>e9voheO`c+|VE!`rJ1#hP?=5r8Yk^^1S@=5I(NRP2a{i|Hc|$|GA9O|+o>!PP zS>PaP5=%TFM)>o64ee;=m##={)7B8rmddF3;6EX?IZsZeN5d98qeSd$5#Q3$+3vm$~z2e>Ajmc!Rb_`8d zE&oKfN!@~nQIDDKKYyvt|Bbo4cAj`ycMTu*%Qq+SQzaClzNWrcksvDPU>!J*NAJsk z(tz13m=gb_d;!7|lr~EN>6YYOtxF3XFmXjzQWhlweuoR0TGrgqfeC%r(g^!nziAA0 zL~!1THdk48Iz{CuS9i#zq2vK%d-T#zy{@??~um9t)-M`L1K1c``=fedQc(gd6Vjg1$UB3DnY-a0rO0;aH34xF%AQCxE$ zPHQ1kWFUKCf-LZ*uFeJ6mVkl}&^$QXKz)B)pt>!90s{lXtwlQs8B*XsJv2l^KFkkX zc0lW`tW;S5+}Ij8+yQ#v=HUT#cUQzgo0x>8y1E)L0sxVvXJp)H`JQNjT7xD?@O&lkZOe(K zl+;(?8h5|=V?G%ddE07%0}KEIKo zdnKT+{yAXtF)mIiQ*d^9Sp+u4l*rD?S`Hio*zB(RfTQ^LcZ6Laa03!@}^-@u?Ox!r&e*x9(p}7D6 literal 0 HcmV?d00001 diff --git a/matita/help/C/figures/developments.png b/matita/help/C/figures/developments.png new file mode 100644 index 0000000000000000000000000000000000000000..f72458940cfb5082d5043e713989269806535701 GIT binary patch literal 15793 zcmb`uWmFtdur4};;2PX53GO7g1rHtw5ZpDm`{1s@gM|PAg1coHTr#-(3=Hn>@+Rk; z``*28-TUjFHEX7O_wMQLs$F~6_f=I#tEeMvg|A z1zi}vltMf`AgH0?oni>S6nfd#WD0zZ5Z|8t=@yyw?*j_dY@pUzF$-~88t)HjbgPjZ zBZrLRosL|!(FeB01oJhUSqH&O1}SuUt-lEYVAI**J#bD)$xO}gYP9bw`Y?PA;ux?| zwY-5pgJ42^8IpJ+8mToCdia*grbUrPTam`S!_gN2z#Q8bMAORpUSpCM-{+bhH>V>! z(>|a$YhcZdf41dPBPBg6Y1`<5ufDFveS~XV(n1sYiUD~wz~PNuYx_i&MA^5y%Y8Ie zy0F|rrjYE$9!MeTTKQGijoZM-gN~9aqVr4-7s_Q}kZ$3ul8S+qlp=(Qj?C-zYsJT$ zaLAMByog{|S0jI?3rrA~>g;J7kO1F&97CdtjQpfip#3$bLCX56h&5T@2oIT$?%@+_ z)!04K)RuBL1X&oiwhe~8Bh-rVsfb=8I+R!N;Fxb>t@6%pGA|p{_lsxfGk!z#BjB8_ z!EuE`l%{$-6ghDKEfL-cKkYpAp6@V3Nv_%9d6|2g@_XYW&;tqZ&~*Ju5BIWvN5|FK zvjppnnK`Xj1w4H1(EpWz5)w;3J&O=E(%FEX*lhbCXFs;1}CU>7$Y_qo6e3$0|1{N1pu%{+5Tr) zS0?OTiYP`8svoK7KSoFTa_=z&12;KG#fE>WD%)Kkh3z5*?Yi~lK9c(N&~iOjKo7e3 zp2pxvqDEcL!e&e}huE6b9ymb)2ak8J`TPm7kuFV+$wR6m-pP)FrfzKhszrU&h8MfI zovK#jIxFfX(iVE(xH&O&qx$^(wBN3vj}%2r0FaD)RRsv5WCP2rv#^M^C)O^e7yG!E zE)g03Sw`2rRx`a@Du0##x@#~I+#iLMOZQ~@x~U{n?K6{7sX`2;y39rgD|l$5Pk1lFLxg$Dc#h=czK8;9F8>Dit&eqmfe9t> ziJ%7!jon&5&yE$Lmnm95`78kj&;TcW9zi)GNecqf&!+M8>p^|_{;}-_0nFJ=oqbW1 zl4?#3)c7Hm`B1sp9(0S{uU)HNqI<=hA0kSaZluuSD&7Wv$d9%xA)vz~Gt<<+I=YhG za_MBl>DmtB$mi$}h^Nh=XzcDlZsy@`dGCv(X|}|Rvw>R|VjFmWXT3ae*HiXM{y@x` z5;;U4Uc5GX<55O}DW9c#FHyA||3+6ya3+}uTffm6<6AKYtQ5byldSizdg*Jg&JII) z0Q045#q)){!NhbpZxQJ_Z@e)lqlY7!)--2JM2ETsD6?Z5+VugwpN#h#Asy}!R`eti z&mMcloh?U_HxBQZ>2&hPG}hH(vG(RoKk5CznYrcs zy=})^btQ?C2Te5P6aZ6fB9W57+pu~=g592496VS;@;QqI=0XKP%48%EB990Bn1;A8 z8=`ztK(=WV8n<&h!)pKVXRmr`OmjB z4P*4~C_jkMNYlq2uwulkQ1=bB(w^uLQ_-JewTW&lWfuFYF3urC!2JR?-v(}{OqEPFWLu7Y| zsj?p)@4c#aKfJSnN49^8uk+*XizyYo0f4-`PNvgVM2HW|q3aGAY-8ifLJG@)qzd0?{4zM3#dhT<$7sCnJLN<_V^he`_%yqMLwm*10ZG|) zcmTfaQG3yLNw{~}J%Ehev9L9(2?vtjqzp;U(pwic!A3!&{57>@QDi2q%%ENQKqCsm zeTo-0e~L7x{}e&@xXd^x{asU@@$-#?D1cex0mm2Fj8?oijV&Xe2$-VuY^8(ZO{Jl! z(b>5(od4O@6^(SzLgU8I@5eUQp042T6C=(3nQ7b)ZHjo_-eh=~1Xn?}$I@2M3?3F|2C)vN zO@FG5Kb@QHsy=_i1;hkStFgjEDy zNwHCpUEQ=4J}M0yrrg)KLQrKG`Jw{ax_^wyBrMLCFmZt+3JO%XT?_=6EnjR{Siasn z5~EsdLM_`Klhgo5*3Q#PU^sl?Lf?GB9g4~J?Dw+6Z!YBU=R1ciV=cjO+kHoq&ygfI z>nn@+F221IF+FVvY_okifIs8p)N~lo%7o^GvyVdSCFDA(S>v$DVBhu~(^OIN1@WdH zZ_7Bs?%nWO{1cyIM>Zgh%CY}kiIMykh;rQOS7H4e`y9sS^Rs~at8jA@ zH;WZ8hG7+EPVXy?WA4GPt$M><7w_$qx)4{I@7*hKPJ+ijFE4=qKJLuI-j|KXK zUs1~gXA+aP2QTW+VzxqA@TKhCZJ|zTpc@Ib+rIp#-?a2IR1UFWN!@vhr?lhrFGZR- zO58DgR709L&J^xqVHzKo3ll8<~BqOP~nU}8W(R@T=vvXbcZVbkogqYu?N zVv1!5=t@7MkTPrfmJ|rsng5FZRu<9!8Cl-**~o&-@QMlXFFP{UC&UJw7>GDIO#SrV zvHzu^;KBMtHK6;Lm9+O}e@$a>B|>K?&{6n!ETwokPp*m>6qqL$_z65B6_icwEozju z;-noBc=>M5L*=&{Vl`FZ=?3eD-Z_nwo}C*lcp7NY&z0~b!l6bXiFm6lHz~VXwLe55 z9@a|Y#L1>wtD}%YW$57;S>a#F-yosvW0SoRy6@MnH4W9Jn62XRKB8#_UA6cEi;Q_v z`Mwm8&nx=|S)&hFv<`>QrmWv@+oa#%ca1a)iR*d&8oXhe9h1!4jv#R5zWY^ zik2n3@BG9bmaAlV5de34V}tWnRfKI2<2Xl=nb){22fbxz*;zzKJ}ov?$#Yqe3Vz*d zBcR(=lR~*&U`}W}80N1)#Azd8!cb*lH_{w#IW;~!M=jNXf7CI;ZQfVFu++V)V*KMP zgl-U?b!<&bNoaVCT z)6f*xROJ=0y3n!f%lvR3zj+8-HA`D)Kvki7NDYjdA{&lSJ89_g!sCN9a&deG|BlL0 z`VReeSGnu9xx3VNIY6PgovQfOJg&B(NS>Wz_m#+>ec&(wJUD4H-}1I*KqJvML;_mPM2WjA>9tMa z^zWoXmf++~)FBPy&Cl@SmHNAXFfCVcincv`SHNq7zvRLjvT1X{&c^aR;MvN2i>9r? zBxk46JahVOoPz{)-)Ft|?QU0UvlFs^`<=jFXA?q!z^2D}kM!c%+MEV7`x!ruOv$|g zgBQvXC9BpFs&=EIi(Fip{7*Mb%Iue>O3%WOx@ig$KL@;hZKcs)PuJsne@F)wuLQ=m z`d4+^Gu~R2W~%0nIOeYO{KB&}{ioS>_J5iUzy4@BGCwJ*r!S{J+g{AhUP-F82#n)W zuS2sl?5Y`5S;?H&9d2{@W5}(X8yFUSxWpYGbX~l8sIxh=kbcXd!olhQZEC9gTq5k{ zJ@<@h_b@sl!CR~`#9DMS_UD^DzvJ1A?r_y8QN2r`f0FH#^4^S#a*>Uh$D+XAVy)J% zo=c$$5Gb=UcI4+@*}s*E^{JHssg|>N%}iUF@r96h3;zPQu45-3=J`0Kk5=$EhTlht z@|?08>)(pEtBXwZuVKhWp35GgfPp*k&R^6~?gcDppNN-Lkn4Y!{|d2z_%=7*@b%BPHy+L>h2DnijG?ywU12=X8$nghrH{Vt;AQ~lIgoqJa|jj-!^X?W%&kVK0^!*SvCYu0pGvxIFE-E8mTTtvMf6EDDln(} z&yPogZn_c=TsNfCD`!cl7Un%IO3bB2m*;n}-y`M|d7vWyl{&i?r-tLUxXmzyikSYd z^?bcjbTTjet75y7qAS98cbM5;`b`r3WbIyowE9gZoPHiQTwBFSbx-wp^ACS)^*4uR z7G0O>#%e5EivMG-S6ojL0ksyz`$>iCzcl7OjxXkdJlRLTpeKO(m-RR;g=fTmrQX-E zg9;GCL%dRLPi~ZV+h|FJc>E^inX*x_#`Whet#b%H%bd7{rw60HAva5+`L3{Zff9?G zeMbf1`Iz&pcRx$|Eli%V3C~i<7x|wA$c9DsvIP*krh_O(Z)VKVVa&VpG+kNF`wWjr zAyA&!J;R+#*|uS)i?UAtVYPy(qS)w-lumZOfJ6Czu2otO93zE|mJOC5ec#9RSuFE7 zm5NFeuH)rSBHY6-j)5Z++jX9}u1${H0PXhkSx}%w1`WXmm}T zf67Y`&$zs>?@jk8@6ii%iT+K((tHr6qP#v|sVvg410CSb@*{16FH^&toS(R6`wX== zBEWS=+=QwDqjuqOX6>WP7P@v~Qx+w)SZK|4&3EruT~>RjdJiJ&uVW2j8ZGa!b{|QW zJZ}h;#wK`k_jp9we1ub4aq4bwADaHAls9fxm985v|BvNlj>{3m-T&q0n|go7i7teT zD;o#=Agk1$akh}Dc}m>$Z<%IQGj6gBjD-xOyHqqfL3p)Fgs-P#o`FgwHH_kpabs}4 zZC{o7VJ#;6J#1aPC-c|s{FYZ{NN^0x3Zov+gOvC3N*>bk8(d=KY9?cx*0!at$*%3( z?JQrpPd{gQx!-pH^WUF(TKXr98Gy3uY$3Rx=W$bb`i~Bcdr;kNda2&LU`$%9@25ts z+XNbNxU4!keeZuEmKrzUVs*Gs_ZWU`)Q1}W-VF0qe)Ohlg;w*#0koZ*Um_o>?c>H_ z+sgL)hEyPNHhm)f(sB1PR-dcC9P62v#<+`La%3Vd+6x_P)vhMq z&YsA=!+v2BG`K|^sh^{u1ogJ7Uu~+id{#6$XFRgMdyIR|zRL$8HfpzmTtH3=jduQ!)ST$4^-P2j2cqz5nKmJ-&s42&2KxP6h7h^t~al zP5@@GsN1V%1|=~S=!YH{oYVw#vrYP>M#|1LgEgEjR69L|Fg-0kr!AS65$}rW2HjYm zEXzjH5#*BS`Jua7dvku-d%dR}MIysW7!kr&RKE5I6Xhx{tA|7V(e`z!JN@{qGYlTi zc|r@6`Lt$t|Jm-D{hobUEVx8RtXC`wVZwQ__43!Sa7W~VPn#t7d z-T%0i2lSb^YO3i7*`e(q|9G@={{+ikA>(n#O+MohgTCRJuX?O_;W^ED!Pv>g`*ZJ% zSw5SsuoSD5!g-T|S_0RpH9~E()=%Mk6^(5MM|{t9G|7l*PQS66dz+!1ybkpm=SB>~ zD}+8vlyQE$*4d2w>sI?{yLWIm!#3_UUc=BMgn)gMlas@oS(C<>ufvkoClH%4Y1s!Y z@c$r%T=(}kC`7lf0soknPoUB7&L(dnrhisaPb74%mH<@vPa+qkR4I%ga``_PQwjdV zhAe)Sq#8V6CH^CQNqga|=l{6d|7JoL*%5r6CFdi%82_#H-m?$AkKn}H|8E3uu|KoG z-;A@$nqgLt(=p=$7Z;cJXI~@kaVb#M)YM|xYJOQuXK9G1Qf?~UrgPLQ8b7G$?37@o z&$XlpIBoTY5HqL$Wug3=dRDN^Z2Y%*IZNwq9WR0HOTqioZ=*K?&@O})xYt0osW_I3 zx9X0mT$}nlSz1@?V=h#JG-v>mVfEKKbOZ2C7b?sD_dePRR%zgyP-HHrew>K!tr|X5 zXt@8s?v9&KKiBDQ%*xNXs*zz~G8PtAUmWBZQ@U10a0sG{_NZH3s7!VTE5q!SH#asI zgx-=v(knZm?VcYPk|nF>q${-xJss5iAJ!sm7JdpH92|7QXX4cS(*>rctVdy;!J%L7 zdhqb0dv|8)(H0{jep)9UIeU1Z=_5>yo*Y6IB({R5J6 zbK^5J$ts?0sSy{WrU-v0*AqdHZaa_P(IK7$*_;UsWp?;=OJ<(Q<3>W2s)$WBjz>d7 zGvD}CpvmDGnV{??$oDG9fU|lMO~Z18iIg1#JG;3f;450%#OqZ*G=Zu}>B`Z*AHe}No{wDf_10XA5lz7g%wY;|et)`^ zk&`ps{dudP6xEjoA?0z~LemlswO*-K?pu!Sy2T6NZb`&0H?^1Od2*OW{9V6p*PzJgIhVcbzp@=_?o>%YUA=y1-E<3CvEP!gy{11|%}Y z?lp&>@5(8f3lS)@jrJaW$?G9B5Yz_0s?={G^&pAJK`*jilD3$m5K@QVCi8=kvhykl)WtFDRF$-lHkMaa?bDwyN)|go{3JIA`mwv+k_~yp_NYtj`JA(s7CXz=0^0?iFaO~Kogz>T)@guXKE87+$ zsnP;>g0$o#puve2v$&AZz(92E5RNASrhDfwiI4QOs?K@{+uMsm%=r@^|M{gMdZM$n ztvzfn0eKl{Jg4WvIc;E9{5V5}h@9F3I+zBXYwAo4!VXEXeUf$>59LAjJYJ2jsIYIa zS;YqVl0y|^d`|EY8CKl|-Eo`u6fm7iIhR{rlf_rtoVu-^ z&ZMj?3~G1*@Ord`(4|#sZt3tf7!I0?DAa;%onYAnC28k!UsU4NUV2Zv?JE(_RAUbZ z8Q$Z5aM}(=fmVmeQ~?IOB=ypf?=C2VOr?#xe$c-zAQ6yMWYXUN?i&r3}HgwlHhI*k9IV@A4vH<>CPV)V%*{0eEszUA(GIrv&&Wyy~bE zIQKQLL>-1^y9F(WO02IP6#_2+)}uLcV|k$Q={ah`)$dVSY#C{O0gu;*Fa4cmLe#93 z2bf}C6r}FFa)UDj>Vwdy`Y(EaJUryBdFm!V?kV1=h$;_BK@zB)&ko)`bhzOeQH#H< z;#5^1B;HvqXYv+Ba^F)P&RRqX91RLG7pwu&UL8t=wC0cWz`D4k-w^2@=pYm^Ji_-y z(1RkP6jbXbS04kFQ(8Ly%k8Lp&QTH2-bBW0|7J8#IN=WI38g2EvoY>|{J`GiZrW~w z%V%aS0=#~o;4@+EWBmvdZP4nAWot`by6GrgLJ$QzSPLC}3>dGq=2AXdq}F`ek2yB} zZD3_~7OrHD||4lC$6Yc6*O{~aCbYAt`I z?t9bKH9_vWt>=yZ44`a2>Yt|%fE{eaiHjL`Lmowb2J5g21_%>yMid5TAmzuo_7}@H zt{oHwvFd0Q-DF>}94Fy^x!7m2Ia?R#j4Qb&ZXupQWAkl)|K3>==>Iq()!=yl0#Ot) zf++!@67&4Cc%h_USC*6Ur~-wsFrVEfKA2etb^VC^;1u+snycl&iF?PCduMHDCklgb zwfD?Y0@f~z#bZ5M;(a*df{%II5+Fh#oI6@!2*6i(QS0f590$CdO z#3v&Pu`+$+0YWyJ#vVnnIqsc!D2=OCCBM{XB>kAp#(6GvaI5f1)!JyZZyV}!r|3^g zDVLHmqhes-WDtE2r4fw^mP3rmSg0J<#_tQ*Y470ZEKK!64B=@}*4EYr2M0s6%Nvs# zH!a72&QjLHPaRCS0j)h-_KMlX%|P|81>jTRyK1dGWffX~aa!83@6or$0l`R*cWdFK zMv_yE@jSlM%of|fosS-TE{+y(a)muQn+}(11L2JRyw;poPtCMKLP97`A9W$AozY5|udwBWaw~k3bNC0D* zF@0VIV&y%X-YT-|{dqZ{mc!0_m{o7>0+*9XUIPMKh(R6M7--_wr|)}KbwBNOq&}+` zulDT;5stTfK&NQf3)7L%3zmsrWgo*@$}m?rCVfRV4G4~xIz7{Ob9t?#N#DAQgBm6; zvt}g4n6o0<32>&ubCnm6VcJ~JsBFg%I2K>^cVke^>4=VP?lbY12T0nty%f;c`{|JJ z3LV=HT|Cjc(KtHSS2D#7^f>?%kl=7f0TOPM|0meaJACMa(SxVGu!GgGsWSO9=J)rG z*kDwZiCU;&#l!yZ1$Q+*=sFG3Q{b0BHl`mYjKQbY^;aZZdNz&mbypDc?5#qblB<(y z+K}{IR9LyOYPOgYM}5rV+&|b&Irb1Q3vD=|j6*|4h2J;$BhexN<;ls3B*^zt9UKTC zausS2rp88vWLW(1^$%amV&l2~B2`+ZsGr@RzGGnEdTOpBebw-R<_Cr{*3dqc6b zBY3Yhx+3X zi+4_5Ols=OH@y;)8tc-%eSNU2N=Ve70OE-Wfmg)D(Jk_)-bDFfH#gX&)2Lw{-UZX; ze|c=MT?wCSgt8~Cd<1xZ!k!=Gb&bm#vPkl@S<@J50s-RR-y`#tfbfuvgVHPYetK0O z+04`78yV4*(!xU9Jof1tRQNWwwqQH8a0N9WHps}>6*&9#gn5sE1SEmv=)kBmXhj4( zP>Q=bqWI7~$`Gc@RCfniT@Q&IxL-rzS9WTt8?%&jiEt z{oB2Hs+QYgEZKC{hZo$erWRNZ=u#jt4cBhU{6<)uD@z@c5c6of)lI;lu!>>kfP=6w!-o*zm6NtG}0C$=0KKVbd#fb?7iXo*QA#smkaY&-8yvOHYeepOhK zxX#+t|K?&YNBr>c)Ig3R@%*&JWi>`z!v1*Hm8a|d80oC6_rTU&ZQT1$MSmwTGFt^^ zw}x5mjdgYroZWFla#h!%3%UPit}*Nq;gx(tpN2-bP(x3#V|dVCzBsw{7ZjZD8dXI~ zhz!{tUJ5wVbE?t}LDpnq&?|1ddAPI9=CQi8irc4pQKk-P4!Zi%v59P-*MV<>ZHDlL zyY`(Kq~FeeO_;CEk@6g8EC}9TdU0*{%7 zn_6g}K6(9^+5I#JA=J&vf}P*m;1i*zDO$2Wg>MZo(Y3(VD5qZ@`X+SV)qCEYMt02B z3s4&kk9`%tBZSX#b;r^-(ywEwH-92!hjRbUJpBD|`)9tG@0UL}r97vsRDN0vp7qGf z6ta_{4B8*pK{VsM9A;)_fc~V+%&6A$4oPQqx;-BsV%z;-IW#AFaPJ(Orm-3J8j~js z^i)YtdiKNls=qwHO6~v{JF@t&HRp7qq3INbLRIv4k?e9vqsYkk6MgGjCMNhz*?H+c z>1SuPXhd-tNS|7UY1?E~Cl6buV&VpM zmsy)%4{L9hP^=Df#9WBDJPysK8Z37+Bu4M?;QZ{eiHt`0+YXUz{BgZiK3^S1D}G*i zXu-vvACB!g{UcJJfls=DMz!0@dDcE-2v)JvvJH-QinqWsZiq6URQ4hyfoc?19wF}NvG6Xzt2qNdim#nmbGpKowbGJ z*sc;YR%%BMkS7*sly$9nTk+Bw^gU5h^Md~%j?PA@f+WFClm91*?Iay zeX!={eiL?jOZITq$&e3B>cI%PrpfFs2gQ_HL@HMV8SL;S!KE4;qWARF54j&0mF$``Sy@agH3o|#Dn-{qv!-fK zw?~}a+@uqaxUw2G<==FQ#p5Co?6;RrUc6PAbzr~s$9NJ8#HeKswzVpiY|xNOP#=pD_<>C&ybww8oE>>Jh_#WDOuUihznrI&r%*{)`y&pD*G)FC zU*fqCh$4Wz1uo%&Wgi6T);b^u9mD!|PTk11@^O1A_^YhOzLNJWoP2eDb;b^&P4?P- zHY^&+50)7L9NeC$x!;?Kbdt&WpECFYZv=ilE}}qa7vP`8!Z$^R9a^U?O`rPA=!*z= z>~6goSa@DFirV!IeL@fKrirJV>p?_m){c(iQd8XlL5jr@xw*rxetj0^tdCoagUe{? ztOy6GyS%?7>LA1$A06FwCE;bZbR}VWY?3%Q$oxmx6MNLSCCG85t-xmrAN?hjyDu`0 zSWIML;cLAHY*`JB7ouXz$$3v?EG%V%!-HYDQlGj-&(<_V@ST957tm%hyc%)sdM^I_ z2Zx_0Sy{W@#53ENpUOW+wYZ_JR!XnwLcM#SL$6CrO8nxg#c3kLAx&!sSyNGe+()lw`V34=q=*27Ix98iBDt1Mf``BqH#j=>@==!MZgP^|+@%siR534#CZ4C7gpLyQ z0S5}(YFcSELTdf^mLQJo3ez2I-#-BsC_IjuOV0Wp)o|knvwZv0us&kv;g0m=sw!4# zdvxugE7aTn7?(yoD)fVsWGv}op$E9bX5u$7k>`~xXMjAk&9Rk;C$&Q@>(Nmky#KUd zMMdUMfTm{Ll~yQHqe`UrmkkR@&V0L8wA9<8T*czoa=5e+KNdab@9)(HqjBV8+c1@VzEa60QbZ)l(JQEY?3vXn zhdsk^f4%fI|A44{`{{%4|N3=}%aeeh&%+y6tyca^wyDUWSzP$4RM*@lEfHDXGM>pFyv~abqY?T77Djd+8Aw9B^VG$bCU z%$EGckh)f>DC24|skI({{W)n}zJQCJSK8HvXo-4`h|uRN)qJ7&q=*kT^W5lm@f2BE zSvxZ&ctox!1_n8wpioLt)krK-Rq4u4p~$f9{ZKi29J&lh#f5;FhMAMuWrY`vM7Yu9 zrX7ds^k`21)%_QgP}T4qwn*-PjROKt5aUANDjH?K+CcD0mwnzIh)Y`bPMVSQY7wzc?-}I4lyQj7;Ju+P?ri0@+3?R)(~d17C>_Tl0ym^s%I1K#! zlM)(KbJyW)vw-SKON-via3do0qgFfqgm54^HPr%MAk5~G&wG`NHcrvt?fr<)7=KTW zycOTLcF?XQzpU^7pxlW?O_)1{M!>8|P$Wj>< z6_<)E^Ogy4<_MVHzwGxz#)M{m>fTI=fNRq=$desqiyklEs63obc>0S2S$`R{#~P?& zKPRbU10N~t`S-4XX!cK^{e>3i>|35Qg_1ad$n_!Au^ohW)N|Uugv`SwgoWDgyuH;p3DPF#8yOq~m{XzR1(K7F=J&L^ zk&c7>yk6ei!@I-TS^^(YEnLY7*5UXxfz%`4--YQFcD1@?z_gliH8iG@zkkPURYooQ zVqlSX#y0{y9$hWQT?Djj_ zca5cxz^6V+pL+T;rsh5E2(0<#+?|bJ4h@`H0^e5|MoB8#@$R)Nar-(m$qe+q9tR_` zYd$6rDAStZ7$IT*W!F|^q{~|O+uv-9`(?g(SbXh6%n-|Vhkt^+<@B!3S6JKQaGL~_%Kx``$e8|R$r&~`!wm@=TUP7CZ z5kE*aV{BHu(Kke*BTtmTX`r~LBV8gwSuZrp^ho=D<@$AKjm2(crpsFj-{2R)9Njf% z*JJrU9VifyE3NtMN7Lr10X+InXtl{hMw@597uL4<9yUAx8_JR6^d3BUrBqF0Y^HUF zkWKW(aj#g!Bp(17svCi4eAXaTAG0*4b++zwb*q9U@M*_g*rri$=TaCR;Vav{_xXL;L!8oNX(U8NY_TVx@~npQJ*|0Ua&f7a3N z14|uCPGjTg{$+kbz+;KNzl#1WVxikSzm1BC>F!qn(;bAX$I%LqI369{>{o;FNl6o* z9`Dyjb8T{j+-OuN1o|i7);}ifCV1GfPN5|gm)d>`vWGTO8-etmj9em(N*(fgtiVM5=4p7!!kq|k|CY3U1Ek(Xw*=z7Q} z16|I{skkcXCxUVM4FK7&q@o|NFi$?Vlpv#)2UARK@IjJy9EV)!|mp|9O-c@kfGX#P>J1X|wCw zxh(S(%9{=EB)>fp`Mboml=wXuEI-1`uk`gl+@B)x^UuCmdI15_*49?;9gi(E0iW<( zxFFe?_^9$J-^t=FKK z!FaYDB=ef)W_e#PXc>L$8V3qe7 zU)I0j;i37IEI_w$em2{B8UlQxuB1XE!&d7!9W>z%^wV*5C7`jk_#C~iwaC>3JHK)E z@(5R8?kSWXQczY7Q!SB}vm$w?M@__-5qyRhbq4m{S_R45%oe>BM9AeM%XzC4-u?8B zck|R6k-U{Tw^DJr+2Pq~peXt!CRb8}iwLQaiLb7fYPR#gA>jG*=MO%`A_X~l7C!oo zv%7oPmp38m%wg)x>}UK+mctD{JCuuM&#lxG1F1 zQe%VuUWEQl)726@9|OlusqbV@{IQ#p^R!~L8p}fzp0dRajKvXCp>8}vHbHMYe`tTD zOZ&TK*zCA^{c?xx@NfMluFljgDJIH45y7hgwTEL8HI6IC2qDJz$foUx4GeQTw<*WY zj#mSM+P!EQI5{y8IY5x#h1?ux?vEr0-K*#>_$jLg{}`(#0KI}Xi2PVhu6>-pg_<0r zpKLL_DY(9#4}oP6se5`N^f==}R+104P7gb2l5~K?0lp5S)g`qVp8WN&Cdcsc*-B@a zIwA)iN6UtTS&^6&frHs!#u-q-;Kny|y!rHn#0B}@2`Zm4gWAg|>(`hck6$1f7=ZmYhLEkY&rbxSq5=`I_KhA zT39I1=I}yff6giD+@w7-~XT|i*&|EWmEG>dwrnb4eR^mhgH5D!lKdq}yYQDH&-S1R7795WQNzYzWZ zP-s~8?Ij>7k17#STBJdNCjMU_VNmJtO^at^BHQ=MHs!WxX HNyz^Ld%_o7 literal 0 HcmV?d00001 diff --git a/matita/help/C/legal.xml b/matita/help/C/legal.xml new file mode 100644 index 000000000..115ae002d --- /dev/null +++ b/matita/help/C/legal.xml @@ -0,0 +1,20 @@ + Both &appname; and this document are part of HELM, an Hypertextual, + Electronic Library of Mathematics, developed at the Computer Science + Department, University of Bologna, Italy. + + HELM is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + HELM is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + + You should have received a copy of the GNU General Public License along + with HELM; if not, write to the Free Software Foundation, Inc., 51 Franklin + St, Fifth Floor, Boston, MA 02110-1301 USA. A copy of the GNU General + Public License is available at this link. + diff --git a/matita/help/C/matita.xml b/matita/help/C/matita.xml new file mode 100644 index 000000000..30d37b3ba --- /dev/null +++ b/matita/help/C/matita.xml @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + Matita"> + + + + TODO"> + MySQL "> + Sqlite "> + + + id"> + uri"> + char"> + uri-step"> + nat"> + term"> + rec_def"> + match_pattern"> + match_branch"> + args"> + args2"> + sterm"> + intros-spec"> + pattern"> + reduction-kind"> + path"> + proof-script"> + proof-step"> + tactic"> + LCF-tactical"> + qstring"> + interpretation"> + auto_params"> +]> + + + + + + &app; V&appversion; User Manual (rev. &manrevision;) + + + + + 2006 + The HELM team. + + + + + Andrea + Asperti + +
    asperti@cs.unibo.it
    +
    +
    + + Claudio + Sacerdoti Coen + +
    sacerdot@cs.unibo.it
    +
    +
    + + Ferruccio + Guidi + +
    fguidi@cs.unibo.it
    +
    +
    + + Enrico + Tassi + +
    tassi@cs.unibo.it
    +
    +
    + + Stefano + Zacchiroli + +
    zacchiro@cs.unibo.it
    +
    +
    +
    + + + Both &appname; and this document are free software, you can + redistribute them and/or modify them under the terms of the GNU General + Public License as published by the Free Software Foundation. See for more information. + + + + + &manrevision; + &date; + + + +
    + + + +&intro; +&install; +&gettingstarted; +&terms; +&usernotation; +&tacticals; +&tactics; +&declarative_tactics; +&othercommands; +&license; + +
    + + diff --git a/matita/help/C/sec_commands.xml b/matita/help/C/sec_commands.xml new file mode 100644 index 000000000..5e55de999 --- /dev/null +++ b/matita/help/C/sec_commands.xml @@ -0,0 +1,374 @@ + + + + Other commands + + alias + alias id "s" = "def" + alias symbol "s" (instance n) = "def" + alias num (instance n) = "def" + + + + Synopsis: + + alias + [id &qstring; = &qstring; + | symbol &qstring; [(instance &nat;)] = &qstring; + | num [(instance &nat;)] = &qstring; + ] + + + + + Action: + + Used to give an hint to the disambiguating parser. + When the parser is faced to the identifier (or symbol) + s or to any number, it will prefer + interpretations that "map s (or the + number) to def". For identifiers, + "def" is the URI of the interpretation. + E.g.: cic:/matita/nat/nat.ind#xpointer(1/1/1) + for the first constructor of the first inductive type defined + in the block of inductive type(s) + cic:/matita/nat/nat.ind. + For symbols and numbers, "def" is the label used to + mark the wanted + interpretation. + + When a symbol or a number occurs several times in the + term to be parsed, it is possible to give an hint only for the + instance n. When the instance is omitted, + the hint is valid for every occurrence. + + + Hints are automatically inserted in the script by Matita every + time the user is interactively asked a question to disambiguate + a term. This way the user won't be posed the same question twice + when the script will be executed again. + + + + + + + check + check t + + + + Synopsis: + + check &term; + + + + Action: + + Opens a CIC browser window that shows t + together with its type. The command is immediately removed from + the script. + + + + + + + coercion + coercion u + + + + Synopsis: + + coercion &uri; + + + + Action: + + Declares u as an implicit coercion + from the type of its last argument (source) + to its codomain (target). Every time a term x + of type source is used with expected type target, Matita + automatically replaces x with + (u ? … ? x) to avoid a typing error. + Implicit coercions are not displayed to the user: + (u ? … ? x) is rendered simply + as x. + When a coercion u is declared + from source s to target t + and there is already a coercion u' of + target s or source t, + a composite implicit coercion is automatically computed + by Matita. + + + + + + + default + default "s" u1 … un + + + + Synopsis: + + default + &qstring; &uri; [&uri;]… + + + + + Action: + + It registers a cluster of related definitions and + theorems to be used by tactics and the rendering engine. + Some functionalities of Matita are not available when some + clusters have not been registered. Overloading a cluster + registration is possible: the last registration will be the + default one, but the previous ones are still in effect. + + s is an identifier of the cluster and + u1 … un + are the URIs of the definitions and theorems of the cluster. + The number n of required URIs depends on the + cluster. The following clusters are supported. + + + clusters + + + + name + expected object for 1st URI + expected object for 2nd URI + expected object for 3rd URI + expected object for 4th URI + expected object for 5th URI + expected object for 6th URI + expected object for 7th URI + expected object for 8th URI + expected object for 9th URI + expected object for 10th URI + expected object for 11th URI + + + + + equality + an inductive type (say, of type eq) of type ∀A:Type.A → Prop with one family parameter and one constructor of type ∀x:A.eq A x + a theorem of type ∀A.∀x,y:A.eq A x y → eq A y x + a theorem of type ∀A.∀x,y,z:A.eq A x y → eq A y z → eq A x z + ∀A.∀a.∀ P:A → Prop.P x → ∀y.eq A x y → P y + ∀A.∀a.∀ P:A → Prop.P x → ∀y.eq A y x → P y + ∀A.∀a.∀ P:A → Set.P x → ∀y.eq A x y → P y + ∀A.∀a.∀ P:A → Set.P x → ∀y.eq A y x → P y + ∀A.∀a.∀ P:A → Type.P x → ∀y.eq A x y → P y + ∀A.∀a.∀ P:A → Type.P x → ∀y.eq A y x → P y + ∀A.∀B.∀ f:A → B.∀x,y:A.eq A x y → eq B (f x) (f y) + ∀A.∀B.∀ f:A → B.∀x,y:A.eq A x y → eq B (f y) (f x) + + + true + an inductive type of type Prop with only one constructor that has no arguments + + + + + + + false + an inductive type of type Prop without constructors + + + + + + + absurd + a theorem of type ∀A:Prop.∀B:Prop.A → Not A → B + + + + + + + +
    +
    +
    +
    +
    +
    + + hint + hint + + + + Synopsis: + + hint + + + + + Action: + + Displays a list of theorems that can be successfully + applied to the current selected sequent. The command is + removed from the script, but the window that displays the + theorems allow to add to the script the application of the + selected theorem. + + + + + + + + include + include "s" + + + + Synopsis: + + include &qstring; + + + + Action: + + Every coercion, + notation and + interpretation that was active + when the file s was compiled last time + is made active. The same happens for declarations of + default definitions and + theorems and disambiguation + hints (aliases). + On the contrary, theorem and definitions declared in a file can be + immediately used without including it. + The file s is automatically compiled + if it is not compiled yet and if it is handled by a + development. + + + + + + + + include' "s" + + + + + Synopsis: + + include' &qstring; + + + + Action: + + Not documented (&TODO;), do not use it. + + + + + + + set + set "baseuri" "s" + + + + Synopsis: + + set &qstring; &qstring; + + + + Action: + + Sets to s the baseuri of all the + theorems and definitions stated in the current file. + The baseuri should be a/b/c/foo + if the file is named foo and it is in + the subtree a/b/c of the current + development. + This requirement is not enforced, but it could be in the future. + + Currently, baseuri is the only + property that can be set even if the parser accepts + arbitrary property names. + + + + + + + whelp + whelp locate "s" + whelp hint t + whelp elim t + whelp match t + whelp instance t + + + + Synopsis: + + whelp + [locate &qstring; + | hint &term; + | elim &term; + | match &term; + | instance &term; + ] + + + + + Action: + + Performs the corresponding query, + showing the result in the CIC browser. The command is removed + from the script. + + + + + + + + qed + + + + + Synopsis: + + qed + + + + + Action: + + Saves and indexes the current interactive theorem or + definition. + In order to do this, the set of sequents still to be proved + must be empty. + + + + + +
    + diff --git a/matita/help/C/sec_declarative_tactics.xml b/matita/help/C/sec_declarative_tactics.xml new file mode 100644 index 000000000..b8b877779 --- /dev/null +++ b/matita/help/C/sec_declarative_tactics.xml @@ -0,0 +1,471 @@ + + + Declarative Tactics + + + Quick reference card + + &declarativetacticref; + + + + + + assume + assume + assume x : t + + + + Synopsis: + + assume &id; : &sterm; + + + + Pre-conditions: + + The conclusion of the current proof must be + ∀x:T.P or + T→P where T is + a data type (i.e. T has type + Set or Type). + + + + Action: + + It adds to the context of the current sequent to prove a new + declaration x : T . The new conclusion becomes + P. + + + + New sequents to prove: + + None. + + + + + + + + suppose + suppose + suppose t(x) + + + + Synopsis: + + suppose &term; ( &id; + ) [ that is equivalent to &term; ] + + + + Pre-condition: + + Da Fare + + + + Action: + + Da Fare + + + + New sequents to prove: + + None. + + + + + + + + by done + by done + by [ t | _ ] done + + + + Synopsis: + + by &term; done + + + + Pre-condition: + + The term can be omitted with a "_", the running term will come found automatically. + + + + Action: + + It closes the current sequent by applying t, taht it can be one under proof or the main proof. + + + + New sequents to prove: + + None. + + + + + + + + we need to prove + we need to prove + we need to prove t [(id)] [or equivalent t] + + + + Synopsis: + + we need to prove &term; + + + + Pre-condition: + + Da Fare + + + + Action: + + Da Fare + + + + New sequents to prove: + + None. + + + + + + + + we proceed by induction + we proceed by induction + we proceed by induction on t to prove th + + + + Synopsis: + + we proceed by induction on &term; to prove &term; + + + + Pre-condition: + + t must inhabit an inductive type and th must be an elimination principle for that inductive type. + + + + Action: + + It proceed on the values of t. + + + + New sequents to prove: + + It opens one new sequent to demonstrate. + + + + + + + + we proceed by cases + we proceed by cases + we proceed by cases on t to prove t + + + + Synopsis: + + we proceed by cases on &term; to prove &term; + + + + Pre-condition: + + Da Fare + + + + Action: + + Da Fare + + + + New sequents to prove: + + None. + + + + + + + + by induction + by induction + by induction hypothesis we know t (id) + + + + Synopsis: + + by induction hypothesis we know &term; ( &id; ) + + + + Pre-condition: + + Da Fare + + + + Action: + + Da Fare + + + + New sequents to prove: + + None. + + + + + + + + thesis becomes + thesis becomes + the thesis becomes t + + + + Synopsis: + + the thesis becomes &sterm; + + + + Pre-condition: + + Each subterm must be convertible with the term t disambiguate in the context of the matched subterm. + + + + Action: + + It replaces the subterm of the current sequent with the new term + + + + New sequence to prove: + + None. + + + + + + + + case + case + case id (id:t)list + + + + Synopsis: + + case &id; ( &id; : &term; ) + + + + Pre-condition: + + Da Fare + + + + Action: + + Da Fare + + + + New sequents to prove: + + Da Fare + + + + + + + + obtain/conclude + obtain/conclude + obtain H t=t by [t|_] done + + + + Synopsis: + + [obtain &id; | conclude &term;] = &term; by [ &term; | _ [(&autoparams;)]] [done] + + + + Pre-condition: + + Da Fare + + + + Action: + + Da Fare + + + + New sequence to prove: + + Da Fare + + + + + + + + by term we proved + by term we proved + by th we proved t [""|(id)] + + + + Synopsis: + + by &term; we proved &term; + ( &id; ) + + + + Pre-condition: + + thmust have type Prop. + idcan to be omitted with null + + + + Action: + + It closes the current sequent by applyingth to t. + + + + New sequence to prove: + + Da fare + + + + + + + + exits elim + exits elim + by t let id:t such that t (id) + + + + Synopsis: + + by &term; let &id; + : &term; such that &term; + ( &id; ) + + + + Pre-condition: + + t must be an inductive type,existential and + t (id) must be an elimanation priciple for that inductive type. + + + + + Action: + + it proceeds on t to the elimination of the existential one + + + + New sequence to prove: + + It opens one new sequent. The names of the new hypotheses are picked byt (id) + + + + + + + + and elim + and elim + by t we have t (id) and t (id) + + + + Synopsis: + + by &term; we have &term; + ( &id; ) and &term; + ( &id; ) + + + + Pre-condition: + + t must be an logical type,type and + + + + Action: + + It proceeds on the values of t, according to the elimination principle + + + + New sequence to prove: + + It opens one new sequent, the names of the new hypotheses are picked by t(id) and t(id) + + + + + + + diff --git a/matita/help/C/sec_gettingstarted.xml b/matita/help/C/sec_gettingstarted.xml new file mode 100644 index 000000000..0066449b0 --- /dev/null +++ b/matita/help/C/sec_gettingstarted.xml @@ -0,0 +1,226 @@ + + + + + Getting started + If you are already familiar with the Calculus of (Co)Inductive + Constructions (CIC) and with interactive theorem provers with procedural + proof languages (expecially Coq), getting started with Matita is relatively + easy. You just need to learn how to type Unicode symbols, how to browse + and search the library and how to author a proof script. + + + How to type Unicode symbols + Unicode characters can be typed in several ways: + + Using the "Ctrl+Shift+Unicode code" standard Gnome shortcut. E.g. Ctrl+Shift+3a9 generates "Ω". + + Typing the ligature "\name" where "name" + is a standard Unicode or LaTeX name for the character. Pressing + "Alt+L" just after the last character of the name converts + the ligature to the Unicode symbol. This operation is + not required since Matita understands also the "\name" + sequences. E.g. "\Omega" followed by Alt+L generates + "Ω". + + Typing one of the following ligatures (and optionally + converting the ligature to the Unicode character has described before): + ":=" (which stands for ≝); "->" (which stands for + "→"); "=>" (which stands for "⇒"). + + + + + Browsing and searching + The CIC browser is used to browse and search the library. + You can open a new CIC browser selecting "New Cic Browser" + from the "View" menu of Matita, or by pressing "F3". + The CIC browser is similar to a traditional Web browser. + + Browsing the library + To browse the library, type in the location bar the absolute URI of + the theorem, definition or library fragment you are interested in. + "cic:/" is the root of the library. Contributions developed + in Matita are under "cic:/matita"; all the others are + part of the library of Coq. + Following the hyperlinks it is possible to navigate in the Web + of mathematical notions. Proof are rendered in pseudo-natural language + and mathematical notation is used for formulae. For now, mathematical + notation must be included in the current script to be activated, but we + plan to remove this limitation. + + + Looking at a proof under development + A proof under development is not yet part of the library. + The special URI "about:proof" can be used to browse the + proof currently under development, if there is one. + The "home" button of the CIC browser sets the location bar to + "about:proof". + + + + Searching the library + The query bar of the CIC browser can be used to search the library + of Matita for theorems or definitions that match certain criteria. + The criteria is given by typing a term in the query bar and selecting + an action in the drop down menu right of it. + + Searching by name + &TODO; + + + List of lemmas that can be applied + &TODO; + + + Searching by exact match + &TODO; + + + List of elimination principles for a given type + &TODO; + + + Searching by instantiation + &TODO; + + + + + Authoring + + How to use developments + + A development is a set of scripts files that are strictly related (i.e. + they depend on each other). &appname; is able to automatically manage + dependencies among the scripts in a development, compiling them in the + correct order. + + + The include statement can be performed by &appname; only if the mentioned + script is compiled. If both scripts (the one that includes and the included) + are part of the same development, the included script (and recursively all + its dependencies) can be compiled automatically. Dependencies among scripts + belonging to different developments is not implemented yet. + + + The "Developments..." item the File menu (or pressing + Ctrl+D) opens the Developments window. + +
    The Developments window + + + + + Screenshot of the Developments window. + +
    + + Developments window buttons + New + + + To create a new Development the user needs to specify a name + + The name of the Development should be the name of the directory in + which it lives. This is not a requirement, but the makefile + automatically generated by matita in the root directory of the + development will eventually generate a new Development with a name + that follows this convention. Having more than one development for + the same set of files is not an issue. + + + and the root directory in which all scripts will be placed, + eventually organized in subdirectories. The Development should be + named as the directory in which it lives. A "makefile" + file is placed in the specified root directory. That makefile + supports the following targets: + + all + + + Build the whole development. + + + + clean + + + Cleans the whole development. + + + + cleanall + + + Resets the user environment (i.e. deleting all the results + of compilation of every development, including the contents + of the database). This target should be used only in case + something goes wrong and &appname; behaves incorrectly. + + + + scriptname.mo + + + Compiles "scriptname.ma" + + + + + + + + Delete + + + Decompiles the whole development and removes it. + + + + Build + + + Compiles all the scripts in the development. + + + + Clean + + + Decompiles the whole development. + + + + Publish + + + All the user developments live in the "user" space. That is, the + result of the compilation of scripts is placed in his home directory + and the tuples are placed in personal tables inside the database. + Publishing a development means putting it in the "library" space. This + means putting the result of compilation in the same place where the + standard library lives. This feature will be improved in the future + to support publishing the development in the "distributed + library" space (making your development public). + + + + Close + + + Closes the Developments window + + + + + +
    + + The authoring interface + &TODO; + +
    +
    + + diff --git a/matita/help/C/sec_install.xml b/matita/help/C/sec_install.xml new file mode 100644 index 000000000..7dc37937b --- /dev/null +++ b/matita/help/C/sec_install.xml @@ -0,0 +1,501 @@ + + + + + Installation + + + Installing from sources + + Currently, the only intended way to install &appname; is starting + from its source code. + + + Getting the source code + + You can get the &appname; source code in two ways: + + + go to the download + page and get the latest released source tarball; + + get the development sources from our + SVN repository. You will need the + components/ and + matita/ directories from the + trunk/helm/software/ directory, plus the + configure and Makefile* + stuff from the same directory. + + In this case you will need to run + autoconf before proceding with the building + instructions below. + + + + + + + + Requirements + + In order to build &appname; from sources you will need some + tools and libraries. They are listed below. + + + Note for Debian (and derivatives) users + + If you are running a + Debian GNU/Linux + distribution, + or any of its derivative like Ubuntu, + you can use APT to install all the required tools and + libraries since they are all part of the Debian archive. + + + apt-get install ocaml ocaml-findlib libgdome2-ocaml-dev liblablgtk2-ocaml-dev liblablgtkmathview-ocaml-dev liblablgtksourceview-ocaml-dev libsqlite3-ocaml-dev libocamlnet-ocaml-dev libzip-ocaml-dev libhttp-ocaml-dev ocaml-ulex08 libexpat-ocaml-dev libmysql-ocaml-dev camlp5 + + + An official debian package is going to be added to the + archive too. + + + + + + Required tools and libraries + + + + OCaml + + + the Objective Caml compiler, version 3.09 or above + + + + + + Findlib + + + + OCaml package manager, version 1.1.1 or above + + + + + + OCaml + Expat + + + OCaml bindings for the expat + library + + + + + + GMetaDOM + + + + OCaml bindings for the Gdome 2 + library + + + + + + OCaml + HTTP + + + OCaml library to write HTTP daemons (and clients) + + + + + + LablGTK + + + + OCaml bindings for the GTK+ library + , version 2.6.0 or above + + + + + + GtkMathView + + + + LablGtkMathView + + + + GTK+ widget to render MathML documents and its + OCaml bindings + + + + + + GtkSourceView + + + + LablGtkSourceView + + + + extension for the GTK+ text widget (adding the typical + features of source code editors) and its OCaml bindings + + + + + &MYSQL; + + OCaml + MySQL + + + SQL database and OCaml bindings for its client-side library + + The SQL database itself is not strictly needed to run + &appname;, but the client libraries are. + + + + + &Sqlite; + + + + OCaml Sqlite3 + + + + Sqlite database and OCaml bindings + + + + + + + Ocamlnet + + + + collection of OCaml libraries to deal with + application-level Internet protocols and conventions + + + + + + ulex + + + + Unicode lexer generator for OCaml + + + + + + CamlZip + + + + OCaml library to access .gz files + + + + + + + + + + (optional) &MYSQL; setup + + To fully exploit &appname; indexing and search capabilities + on a huge metadata set you may + need a working &MYSQL; database. Detalied instructions on how to do + it can be found in the MySQL documentation. Here you + can find a quick howto. + + In order to create a database you need administrator permissions on + your MySQL installation, usually the root account has them. Once you + have the permissions, a new database can be created executing + mysqladmin create matita + (matita is the default database name, you can + change it using the db.user key of the + configuration file). + + Then you need to grant the necessary access permissions to the + database user of &appname;, typing echo "grant all privileges + on matita.* to helm;" | mysql matita should do the trick + (helm is the default user name used by &appname; to + access the database, you can change it using the + db.user key of the configuration file). + + + + This way you create a database named matita + on which anyone claiming to be the helm user can + do everything (like adding dummy data or destroying the contained + one). It is strongly suggested to apply more fine grained permissions, + how to do it is out of the scope of this manual. + + + + + + Compiling and installing + + Once you get the source code the installations steps should be + quite familiar. + + First of all you need to configure the build process executing + ./configure. This will check that all needed + tools and library are installed and prepare the sources for compilation + and installation. + + Quite a few (optional) arguments may be passed to the + configure command line to change build time + parameters. They are listed below, together with their + default values: + + + <application>configure</application> command line + arguments + + + + --with-runtime-dir=dir + + + + (Default: + /usr/local/matita) Runtime base directory + where all &appname; stuff (executables, configuration files, + standard library, ...) will be installed + + + + + + + --with-dbhost=host + + + + (Default: localhost) Default SQL server + hostname. Will be used while building the standard library + during the installation and to create the default &appname; + configuration. May be changed later in configuration file. + + + + + + + --enable-debug + + + + (Default: disabled) Enable debugging code. + Not for the casual user. + + + + + + Then you will manage the build and install process using + make + as usual. Below are reported the targets you have to invoke in sequence + to build and install: + + + + <application>make</application> targets + + + world + + builds components needed by &appname; and &appname; itself + (in bytecode or native code depending + on the availability of the OCaml native code compiler) + + + + + install + + installs &appname; related tools, standard library and the + needed runtime stuff in the proper places on the filesystem. + + As a part of the installation process the &appname; + standard library will be compiled, thus testing that the just + built matitac compiler works + properly. + For this step you will need a working SQL database (for + indexing the standard library while you are compiling it). See + Database setup + for instructions on how to set it up. + + + + + + + + + + + + Configuring &appname; + + The configuration file is divided in four sections. The user and + matita ones are self explicative and does not need user + intervention. Here we report a sample snippet for these two + sections. The remaining db and getter sections will be explained in + details later. + + + $(HOME) + $(USER) + +
    + $(user.home)/.matita + /usr/share/matita/ + $(user.name) +
    +]]>
    +
    + + &appname; needs to store/fetch data and metadata. Data is essentially + composed of XML files, metadata is a set of tuples for a relational + model. Data and metadata can produced by the user or be already + available. Both kind of data/metadata can be local and/or remote. + + + The db section tells &appname; where to store and retrieve metadata, + while the getter section describes where XML files have to be + found. The following picture describes the suggested configuration. + Dashed arrows are determined by the configuration file. + +
    Configuring the Databases + + + + + How to configure the databases. + +
    + The getter + + Consider the following snippet and the URI + cic:/matita/foo/bar.con. If &appname; + is asked to read that object it will resolve the object trough + the getter. Since the first two entries are equally specific + (longest match rule applies) first the path + file://$(matita.rt_base_dir)/xml/standard-library/foo/bar.con + and then file://$(user.home)/.matita/xml/matita/foo/bar.con + are inspected. + + + $(user.home)/.matita/getter/cache + + cic:/matita/ + file://$(matita.rt_base_dir)/xml/standard-library/ + ro + + + cic:/matita/ + file://$(user.home)/.matita/xml/matita/ + + + cic:/Coq/ + http://mowgli.cs.unibo.it/xml/ + legacy + + +]]> + + if the same URI has to be written, the former prefix is skipped + since it is marked as readonly (ro). + Objects resolved using the third prefix are readonly too, and are + retrieved using the network. There is no limit to the number of + prefixes the user can define. The distinction between prefixes marked + as readonly and legacy is that, legacy ones are really read only, while + the ones marked with ro are considered for + writing when &appname; is started in system mode (used to publish user + developments in the library space). + + The db + + The database subsystem has three fron ends: library, user and + legacy. The latter is the only optional one. Every query is done on + every frontend, making the duplicate free union of the results. + The user front end kepps metadata produced by the user, and is thus + heavily accessed in read/write mode, while the library and legacy + fron ends are read only. Every front end can be connected to + backend, the storage actually. + Consider the following snippet. + + + mysql://mowgli.cs.unibo.it matita helm none legacy + file://$(matita.rt_base_dir) metadata.db helm helm library + file://$(matita.basedir) user.db helm helm user + +]]> + + Here the usr database is a file (thus locally accessed trough the + Sqlite library) placed in the user's home directory. The library one is + placed in the &appname; runtime directory. The legacy fron end is + connected to a remote &MYSQL; based storage. Every metadata key + takes a path to the storage, the name of the database, the user name, + a password (or none) and the name of the front + end to which it is attached. + +
    + +
    + diff --git a/matita/help/C/sec_intro.xml b/matita/help/C/sec_intro.xml new file mode 100644 index 000000000..6c22f4664 --- /dev/null +++ b/matita/help/C/sec_intro.xml @@ -0,0 +1,96 @@ + + + + + Introduction + + Features + Matita is an interactive theorem prover + (or proof assistant) with the following characteristics: + + + It is based on a variant of the Calculus of (Co)Inductive Constructions (CIC). CIC is also the logic of the Coq proof assistant. + + + It adopts a procedural proof language, but it has a new set of small step tacticals that improve proof structuring and debugging. + + + It has a stand-alone graphical user interface (GUI) inspired by +CtCoq/Proof General. The GUI is implemented according to the state +of the art. In particular: + + + It is based and fully integrated with Gtk/Gnome. + + + An on-line help can be browsed via the Gnome documentation browser. + + + Mathematical formulae are rendered in two dimensional notation via MathML and Unicode. + + + + + It integrates advanced browsing and searching procedures. + + + It allows the use of the typical ambiguous mathematical notation by means of a disambiguating parser. + + + It is compatible with the library of Coq (definitions and proof objects). + + + + + Matita vs Coq + + The system shares a common look&feel with the Coq proof assistant + and its graphical user interface. The two systems have the same logic, + very close proof languages and similar sets of tactics. Moreover, + Matita is compatible with the library of Coq. + From the user point of view the main lacking features + with respect to Coq are: + + + + proof extraction; + + + an extensible language of tactics; + + + automatic implicit arguments; + + + several ad-hoc decision procedures; + + + several rarely used variants for most of the tactics; + + + sections and local variables. To maintain compatibility with the library of Coq, theorems defined inside sections are abstracted by name over the section variables; their instances are explicitly applied to actual arguments by means of explicit named substitutions. + + + + Still from the user point of view, the main differences with respect + to Coq are: + + + + the language of tacticals that allows execution of partial tactical application; + + + the unification of the concept of metavariable and existential variable; + + + terms with subterms that cannot be inferred are always allowed as arguments of tactics or other commands; + + + ambiguous terms are disambiguated by direct interaction with the user; + + + theorems and definitions in the library are always accessible without needing to require/include them; right now, only notation needs to be included to become active, but we plan to remove this limitation. + + + + diff --git a/matita/help/C/sec_license.xml b/matita/help/C/sec_license.xml new file mode 100644 index 000000000..47e146126 --- /dev/null +++ b/matita/help/C/sec_license.xml @@ -0,0 +1,8 @@ + + + + + License + &legal; + + diff --git a/matita/help/C/sec_tacticals.xml b/matita/help/C/sec_tacticals.xml new file mode 100644 index 000000000..2f84ae736 --- /dev/null +++ b/matita/help/C/sec_tacticals.xml @@ -0,0 +1,305 @@ + + + + Tacticals + + Interactive proofs and definitions + + An interactive definition is started by giving a + definition command omitting + the definiens. + An interactive proof is started by using one of the + proof commands omitting + an explicit proof term. + + An interactive proof or definition can and must be terminated by + a qed command when no more sequents are + left to prove. Between the command that starts the interactive session and + the qed command the user must provide a procedural proof script made + of tactics structured by means of + tacticals. + In the tradition of the LCF system, tacticals can be considered + higher order tactics. Their syntax is structured and they are executed + atomically. On the contrary, in Matita the syntax of several tacticals is + destructured into a sequence of tokens and tactics in such a way that is + is possible to stop execution after every single token or tactic. + The original semantics is preserved: the execution of the whole sequence + yields the result expected by the original LCF-like tactical. + + + The proof status + + During an interactive proof, the proof status is made of + the set of sequents to prove and the partial proof built so far. + + The partial proof can be inspected + on demand in the CIC browser. It will be shown in pseudo-natural language + produced on the fly from the proof term. + The set of sequents to prove is shown in the notebook of the + authoring interface, in the + top-right corner of the main window of Matita. Each tab shows a different + sequent, named with a question mark followed by a number. The current + role of the sequent, according to the following description, is also + shown in the tab tag. + + + + + Selected sequents + (name in boldface, e.g. ?3). + The next tactic will be applied to every selected sequent, producing + new selected sequents. Tacticals + such as branching ("[") + or "focus" can be used + to change the set of selected sequents. + + + + + Sibling sequents + (name prefixed by a vertical bar and their position, e.g. + |3?2). When the set of selected sequents + has more than one element, the user can decide to focus in turn on each + of them. The branching tactical + ("[") selects the first + sequent only, marking every previously selected sequent as a sibling + sequent. Each sibling sequent is given a different position. The + tactical "2,3:" can be used to + select one or more sibling sequents, different from the one proposed, + according to their position. Once the user starts to work on the + selected sibling sequents it becomes impossible to select a new + set of siblings until the ("|") + tactical is used to end work on the current one. + + + + + Automatically solved sibling sequents + (name strokethrough, e.g. |3?2). + Sometimes a tactic can close by side effects a sibling sequent the + user has not selected yet. The sequent is left in the automatically + solved status in order for the user to explicitly accept + (using the "skip" + tactical) the automatic + instantiation in the proof script. This way the correspondence between + the number of branches in the proof script and the number of sequents + generated in the proof is preserved. + + + + + + Tacticals + + proof script + + + + &proofscript; + ::= + &proofstep; [&proofstep;]… + + + +
    + Every proof step can be immediately executed. + + proof steps + + + + &proofstep; + ::= + &LCFtactical; + The tactical is applied to each + selected sequent. + Each new sequent becomes a selected sequent. + + + + | + . + The first + selected sequent becomes + the only one selected. All the remaining previously selected sequents + are proposed to the user one at a time when the next + "." is used. + + + + + | + ; + Nothing changes. Use this proof step as a separator in + concrete syntax. + + + + | + [ + Every selected sequent + becomes a sibling sequent + that constitute a branch in the proof. + Moreover, the first sequent is also selected. + + + + + | + | + Stop working on the current branch of the innermost branching + proof. + The sibling branches become the sibling + sequents and the first one is also selected. + + + + + | + &nat;[,&nat;]…: + The sibling sequents + specified by the user become the next + selected sequents. + + + + + | + *: + Every sibling branch not considered yet in the innermost + branching proof becomes a + selected sequent. + + + + + | + skip + Accept the automatically provided instantiation (not shown + to the user) for the currently selected + automatically closed sibling sequent. + + + + + | + ] + Stop analyzing branches for the innermost branching proof. + Every sequent opened during the branching proof and not closed yet + becomes a selected sequent. + + + + + | + focus &nat; [&nat;]… + + Selects the sequents specified by the user. The selected sequents + must be completely closed (no new sequents left open) before doing an + "unfocus that restores + the current set of sibling branches. + + + + + | + unfocus + + Used to match the innermost + "focus" tactical + when all the sequents selected by it have been closed. + Until "unfocus" is + performed, it is not possible to progress in the rest of the + proof. + + + + +
    + + tactics and LCF tacticals + + + + &LCFtactical; + ::= + &tactic; + Applies the specified tactic. + + + + | + &LCFtactical; ; &LCFtactical; + Applies the first tactical first and the second tactical + to each sequent opened by the first one. + + + + | + &LCFtactical; + [ + [&LCFtactical;] + [| &LCFtactical;]… + ] + + Applies the first tactical first and each tactical in the + list of tacticals to the corresponding sequent opened by the + first one. The number of tacticals provided in the list must be + equal to the number of sequents opened by the first tactical. + + + + | + do &nat; + &LCFtactical; + + &TODO; + + + + | + repeat + &LCFtactical; + + &TODO; + + + + | + + first [ + [&LCFtactical;] + [| &LCFtactical;]… + ] + + &TODO; + + + + | + try &LCFtactical; + &TODO; + + + + | + + solve [ + [&LCFtactical;] + [| &LCFtactical;]… + ] + + &TODO; + + + + | + (&LCFtactical;) + Used for grouping during parsing. + + + +
    +
    +
    + diff --git a/matita/help/C/sec_tactics.xml b/matita/help/C/sec_tactics.xml new file mode 100644 index 000000000..364401aa5 --- /dev/null +++ b/matita/help/C/sec_tactics.xml @@ -0,0 +1,1824 @@ + + + + Tactics + + + Quick reference card + + &tacticref; + + + + + absurd + absurd + absurd P + + + + Synopsis: + + absurd &sterm; + + + + Pre-conditions: + + P must have type Prop. + + + + Action: + + It closes the current sequent by eliminating an + absurd term. + + + + New sequents to prove: + + It opens two new sequents of conclusion P + and ¬P. + + + + + + + apply + apply + apply t + + + + Synopsis: + + apply &sterm; + + + + Pre-conditions: + + t must have type + T1 → ... → + Tn → G + where G can be unified with the conclusion + of the current sequent. + + + + Action: + + It closes the current sequent by applying t to n implicit arguments (that become new sequents). + + + + New sequents to prove: + + It opens a new sequent for each premise + Ti that is not + instantiated by unification. Ti is + the conclusion of the i-th new sequent to + prove. + + + + + + + applyS + applyS + applyS t auto_params + + + + Synopsis: + + applyS &sterm; &autoparams; + + + + Pre-conditions: + + t must have type + T1 → ... → + Tn → G. + + + + Action: + + applyS is useful when + apply fails because the current goal + and the conclusion of the applied theorems are extensionally + equivalent up to instantiation of metavariables, but cannot + be unified. E.g. the goal is P(n*O+m) and + the theorem to be applied proves ∀m.P(m+O). + + + It tries to automatically rewrite the current goal using + auto paramodulation + to make it unifiable with G. + Then it closes the current sequent by applying + t to n + implicit arguments (that become new sequents). + The auto_params parameters are passed + directly to auto paramodulation. + + + + + New sequents to prove: + + It opens a new sequent for each premise + Ti that is not + instantiated by unification. Ti is + the conclusion of the i-th new sequent to + prove. + + + + + + + assumption + assumption + assumption + + + + Synopsis: + + assumption + + + + Pre-conditions: + + There must exist an hypothesis whose type can be unified with + the conclusion of the current sequent. + + + + Action: + + It closes the current sequent exploiting an hypothesis. + + + + New sequents to prove: + + None + + + + + + + auto + auto + auto params + + + + Synopsis: + + auto &autoparams; + + + + Pre-conditions: + + None, but the tactic may fail finding a proof if every + proof is in the search space that is pruned away. Pruning is + controlled by the optional params. + Moreover, only lemmas whose type signature is a subset of the + signature of the current sequent are considered. The signature of + a sequent is ...&TODO; + + + + Action: + + It closes the current sequent by repeated application of + rewriting steps (unless paramodulation is + omitted), hypothesis and lemmas in the library. + + + + New sequents to prove: + + None + + + + + + + cases + cases + + cases t hyps + + + + + Synopsis: + + + cases + &term; [([&id;]…)] + + + + + Pre-conditions: + + + t must inhabit an inductive type + + + + + Action: + + + It proceed by cases on t. The new generated + hypothesis in each branch are named according to + hyps. + + + + + New sequents to prove: + + One new sequent for each constructor of the type of + t. Each sequent has a new hypothesis for + each argument of the constructor. + + + + + + + clear + clear + + clear H1 ... Hm + + + + + Synopsis: + + + clear + &id; [&id;…] + + + + + Pre-conditions: + + + + H1 ... Hm + must be hypotheses of the + current sequent to prove. + + + + + Action: + + + It hides the hypotheses + + H1 ... Hm + from the current sequent. + + + + + New sequents to prove: + + None + + + + + + + clearbody + clearbody + clearbody H + + + + Synopsis: + + clearbody &id; + + + + Pre-conditions: + + H must be an hypothesis of the + current sequent to prove. + + + + Action: + + It hides the definiens of a definition in the current + sequent context. Thus the definition becomes an hypothesis. + + + + New sequents to prove: + + None. + + + + + + + compose + compose + compose n t1 with t2 hyps + + + + Synopsis: + + compose [&nat;] &sterm; [with &sterm;] [&intros-spec;] + + + + Pre-conditions: + + + + + + Action: + + Composes t1 with t2 in every possible way + n times introducing generated terms + as if intros hyps was issued. + If t1:∀x:A.B[x] and + t2:∀x,y:A.B[x]→B[y]→C[x,y] it generates: + + + λx,y:A.t2 x y (t1 x) : ∀x,y:A.B[y]→C[x,y] + + + λx,y:A.λH:B[x].t2 x y H (t1 y) : ∀x,y:A.B[x]→C[x,y] + + + + + If t2 is omitted it composes + t1 + with every hypothesis that can be introduced. + n iterates the process. + + + + New sequents to prove: + + The same, but with more hypothesis eventually introduced + by the &intros-spec;. + + + + + + + change + change + change patt with t + + + + Synopsis: + + change &pattern; with &sterm; + + + + Pre-conditions: + + Each subterm matched by the pattern must be convertible + with the term t disambiguated in the context + of the matched subterm. + + + + Action: + + It replaces the subterms of the current sequent matched by + patt with the new term t. + For each subterm matched by the pattern, t is + disambiguated in the context of the subterm. + + + + New sequents to prove: + + None. + + + + + + + constructor + constructor + constructor n + + + + Synopsis: + + constructor &nat; + + + + Pre-conditions: + + The conclusion of the current sequent must be + an inductive type or the application of an inductive type with + at least n constructors. + + + + Action: + + It applies the n-th constructor of the + inductive type of the conclusion of the current sequent. + + + + New sequents to prove: + + It opens a new sequent for each premise of the constructor + that can not be inferred by unification. For more details, + see the apply tactic. + + + + + + + contradiction + contradiction + contradiction + + + + Synopsis: + + contradiction + + + + Pre-conditions: + + There must be in the current context an hypothesis of type + False. + + + + Action: + + It closes the current sequent by applying an hypothesis of + type False. + + + + New sequents to prove: + + None + + + + + + + cut + cut + cut P as H + + + + Synopsis: + + cut &sterm; [as &id;] + + + + Pre-conditions: + + P must have type Prop. + + + + Action: + + It closes the current sequent. + + + + New sequents to prove: + + It opens two new sequents. The first one has an extra + hypothesis H:P. If H is + omitted, the name of the hypothesis is automatically generated. + The second sequent has conclusion P and + hypotheses the hypotheses of the current sequent to prove. + + + + + + + decompose + decompose + + decompose as H1 ... Hm + + + + + Synopsis: + + + decompose + [as &id;…] + + + + + Pre-conditions: + + None. + + + + Action: + + + For each each premise H of type + T in the current context where + T is a non-recursive inductive type without + right parameters and of sort Prop or CProp, the tactic runs + + elim H as H1 ... Hm + , clears H and runs itself + recursively on each new premise introduced by + elim in the opened sequents. + + + + + New sequents to prove: + + + The ones generated by all the elim tactics run. + + + + + + + + demodulate + demodulate + demodulate + + + + Synopsis: + + demodulate + + + + Pre-conditions: + + None. + + + + Action: + + &TODO; + + + + New sequents to prove: + + None. + + + + + + + destruct + destruct + destruct p + + + + Synopsis: + + destruct &sterm; + + + + Pre-conditions: + + p must have type E1 = E2 where the two sides of the equality are possibly applied constructors of an inductive type. + + + + Action: + + The tactic recursively compare the two sides of the equality + looking for different constructors in corresponding position. + If two of them are found, the tactic closes the current sequent + by proving the absurdity of p. Otherwise + it adds a new hypothesis for each leaf of the formula that + states the equality of the subformulae in the corresponding + positions on the two sides of the equality. + + + + + New sequents to prove: + + None. + + + + + + + elim + elim + elim t using th hyps + + + + Synopsis: + + elim &sterm; [using &sterm;] &intros-spec; + + + + Pre-conditions: + + t must inhabit an inductive type and + th must be an elimination principle for that + inductive type. If th is omitted the appropriate + standard elimination principle is chosen. + + + + Action: + + It proceeds by cases on the values of t, + according to the elimination principle th. + + + + + New sequents to prove: + + It opens one new sequent for each case. The names of + the new hypotheses are picked by hyps, if + provided. If hyps specifies also a number of hypotheses that + is less than the number of new hypotheses for a new sequent, + then the exceeding hypothesis will be kept as implications in + the conclusion of the sequent. + + + + + + + elimType + elimType + elimType T using th hyps + + + + Synopsis: + + elimType &sterm; [using &sterm;] &intros-spec; + + + + Pre-conditions: + + T must be an inductive type. + + + + Action: + + TODO (severely bugged now). + + + + New sequents to prove: + + TODO + + + + + + + exact + exact + exact p + + + + Synopsis: + + exact &sterm; + + + + Pre-conditions: + + The type of p must be convertible + with the conclusion of the current sequent. + + + + Action: + + It closes the current sequent using p. + + + + New sequents to prove: + + None. + + + + + + + exists + exists + exists + + + + Synopsis: + + exists + + + + Pre-conditions: + + The conclusion of the current sequent must be + an inductive type or the application of an inductive type + with at least one constructor. + + + + Action: + + Equivalent to constructor 1. + + + + New sequents to prove: + + It opens a new sequent for each premise of the first + constructor of the inductive type that is the conclusion of the + current sequent. For more details, see the constructor tactic. + + + + + + + fail + fail + fail + + + + Synopsis: + + fail + + + + Pre-conditions: + + None. + + + + Action: + + This tactic always fail. + + + + New sequents to prove: + + N.A. + + + + + + + fold + fold + fold red t patt + + + + Synopsis: + + fold &reduction-kind; &sterm; &pattern; + + + + Pre-conditions: + + The pattern must not specify the wanted term. + + + + Action: + + First of all it locates all the subterms matched by + patt. In the context of each matched subterm + it disambiguates the term t and reduces it + to its red normal form; then it replaces with + t every occurrence of the normal form in the + matched subterm. + + + + New sequents to prove: + + None. + + + + + + + fourier + fourier + fourier + + + + Synopsis: + + fourier + + + + Pre-conditions: + + The conclusion of the current sequent must be a linear + inequation over real numbers taken from standard library of + Coq. Moreover the inequations in the hypotheses must imply the + inequation in the conclusion of the current sequent. + + + + Action: + + It closes the current sequent by applying the Fourier method. + + + + New sequents to prove: + + None. + + + + + + + fwd + fwd + fwd H as H0 ... Hn + + + + Synopsis: + + fwd &id; [as &id; [&id;]…] + + + + Pre-conditions: + + + The type of H must be the premise of a + forward simplification theorem. + + + + + Action: + + + This tactic is under development. + It simplifies the current context by removing + H using the following methods: + forward application (by lapply) of a suitable + simplification theorem, chosen automatically, of which the type + of H is a premise, + decomposition (by decompose), + rewriting (by rewrite). + H0 ... Hn + are passed to the tactics fwd invokes, as + names for the premise they introduce. + + + + + New sequents to prove: + + + The ones opened by the tactics fwd invokes. + + + + + + + + generalize + generalize + generalize patt as H + + + + Synopsis: + + generalize &pattern; [as &id;] + + + + Pre-conditions: + + All the terms matched by patt must be + convertible and close in the context of the current sequent. + + + + Action: + + It closes the current sequent by applying a stronger + lemma that is proved using the new generated sequent. + + + + New sequents to prove: + + It opens a new sequent where the current sequent conclusion + G is generalized to + ∀x.G{x/t} where {x/t} + is a notation for the replacement with x of all + the occurrences of the term t matched by + patt. If patt matches no + subterm then t is defined as the + wanted part of the pattern. + + + + + + + id + id + id + + + + Synopsis: + + id + + + + Pre-conditions: + + None. + + + + Action: + + This identity tactic does nothing without failing. + + + + New sequents to prove: + + None. + + + + + + + intro + intro + intro H + + + + Synopsis: + + intro [&id;] + + + + Pre-conditions: + + The conclusion of the sequent to prove must be an implication + or a universal quantification. + + + + Action: + + It applies the right introduction rule for implication, + closing the current sequent. + + + + New sequents to prove: + + It opens a new sequent to prove adding to the hypothesis + the antecedent of the implication and setting the conclusion + to the consequent of the implicaiton. The name of the new + hypothesis is H if provided; otherwise it + is automatically generated. + + + + + + + intros + intros + intros hyps + + + + Synopsis: + + intros &intros-spec; + + + + Pre-conditions: + + If hyps specifies a number of hypotheses + to introduce, then the conclusion of the current sequent must + be formed by at least that number of imbricated implications + or universal quantifications. + + + + Action: + + It applies several times the right introduction rule for + implication, closing the current sequent. + + + + New sequents to prove: + + It opens a new sequent to prove adding a number of new + hypotheses equal to the number of new hypotheses requested. + If the user does not request a precise number of new hypotheses, + it adds as many hypotheses as possible. + The name of each new hypothesis is either popped from the + user provided list of names, or it is automatically generated when + the list is (or becomes) empty. + + + + + + + inversion + inversion + inversion t + + + + Synopsis: + + inversion &sterm; + + + + Pre-conditions: + + The type of the term t must be an inductive + type or the application of an inductive type. + + + + Action: + + It proceeds by cases on t paying attention + to the constraints imposed by the actual "right arguments" + of the inductive type. + + + + New sequents to prove: + + It opens one new sequent to prove for each case in the + definition of the type of t. With respect to + a simple elimination, each new sequent has additional hypotheses + that states the equalities of the "right parameters" + of the inductive type with terms originally present in the + sequent to prove. + + + + + + + lapply + lapply + + lapply linear depth=d t + to t1, ..., tn as H + + + + + Synopsis: + + + lapply + [linear] + [depth=&nat;] + &sterm; + [to + &sterm; + [,&sterm;…] + ] + [as &id;] + + + + + Pre-conditions: + + + t must have at least d + independent premises and n must not be + greater than d. + + + + + Action: + + + Invokes letin H ≝ (t ? ... ?) + with enough ?'s to reach the + d-th independent premise of + t + (d is maximum if unspecified). + Then istantiates (by apply) with + t1, ..., tn + the ?'s corresponding to the first + n independent premises of + t. + Usually the other ?'s preceding the + n-th independent premise of + t are istantiated as a consequence. + If the linear flag is specified and if + t, t1, ..., tn + are (applications of) premises in the current context, they are + cleared. + + + + + New sequents to prove: + + + The ones opened by the tactics lapply invokes. + + + + + + + + left + left + left + + + + Synopsis: + + left + + + + Pre-conditions: + + The conclusion of the current sequent must be + an inductive type or the application of an inductive type + with at least one constructor. + + + + Action: + + Equivalent to constructor 1. + + + + New sequents to prove: + + It opens a new sequent for each premise of the first + constructor of the inductive type that is the conclusion of the + current sequent. For more details, see the constructor tactic. + + + + + + + letin + letin + letin x ≝ t + + + + Synopsis: + + letin &id; ≝ &sterm; + + + + Pre-conditions: + + None. + + + + Action: + + It adds to the context of the current sequent to prove a new + definition x ≝ t. + + + + New sequents to prove: + + None. + + + + + + + normalize + normalize + normalize patt + + + + Synopsis: + + normalize &pattern; + + + + Pre-conditions: + + None. + + + + Action: + + It replaces all the terms matched by patt + with their βδιζ-normal form. + + + + New sequents to prove: + + None. + + + + + + + reduce + reduce + reduce patt + + + + Synopsis: + + reduce &pattern; + + + + Pre-conditions: + + None. + + + + Action: + + It replaces all the terms matched by patt + with their βδιζ-normal form. + + + + New sequents to prove: + + None. + + + + + + + reflexivity + reflexivity + reflexivity + + + + Synopsis: + + reflexivity + + + + Pre-conditions: + + The conclusion of the current sequent must be + t=t for some term t + + + + Action: + + It closes the current sequent by reflexivity + of equality. + + + + New sequents to prove: + + None. + + + + + + + replace + change + change patt with t + + + + Synopsis: + + replace &pattern; with &sterm; + + + + Pre-conditions: + + None. + + + + Action: + + It replaces the subterms of the current sequent matched by + patt with the new term t. + For each subterm matched by the pattern, t is + disambiguated in the context of the subterm. + + + + New sequents to prove: + + For each matched term t' it opens + a new sequent to prove whose conclusion is + t'=t. + + + + + + + rewrite + rewrite + rewrite dir p patt + + + + Synopsis: + + rewrite [<|>] &sterm; &pattern; + + + + Pre-conditions: + + p must be the proof of an equality, + possibly under some hypotheses. + + + + Action: + + It looks in every term matched by patt + for all the occurrences of the + left hand side of the equality that p proves + (resp. the right hand side if dir is + <). Every occurence found is replaced with + the opposite side of the equality. + + + + New sequents to prove: + + It opens one new sequent for each hypothesis of the + equality proved by p that is not closed + by unification. + + + + + + + right + right + right + + + + Synopsis: + + right + + + + Pre-conditions: + + The conclusion of the current sequent must be + an inductive type or the application of an inductive type with + at least two constructors. + + + + Action: + + Equivalent to constructor 2. + + + + New sequents to prove: + + It opens a new sequent for each premise of the second + constructor of the inductive type that is the conclusion of the + current sequent. For more details, see the constructor tactic. + + + + + + + ring + ring + ring + + + + Synopsis: + + ring + + + + Pre-conditions: + + The conclusion of the current sequent must be an + equality over Coq's real numbers that can be proved using + the ring properties of the real numbers only. + + + + Action: + + It closes the current sequent veryfying the equality by + means of computation (i.e. this is a reflexive tactic, implemented + exploiting the "two level reasoning" technique). + + + + New sequents to prove: + + None. + + + + + + + simplify + simplify + simplify patt + + + + Synopsis: + + simplify &pattern; + + + + Pre-conditions: + + None. + + + + Action: + + It replaces all the terms matched by patt + with other convertible terms that are supposed to be simpler. + + + + New sequents to prove: + + None. + + + + + + + split + split + split + + + + Synopsis: + + split + + + + Pre-conditions: + + The conclusion of the current sequent must be + an inductive type or the application of an inductive type with + at least one constructor. + + + + Action: + + Equivalent to constructor 1. + + + + New sequents to prove: + + It opens a new sequent for each premise of the first + constructor of the inductive type that is the conclusion of the + current sequent. For more details, see the constructor tactic. + + + + + + + + subst + subst + subst + + + + Synopsis: + + subst + + + + Pre-conditions: + + None. + + + + Action: + + For each premise of the form + H: x = t or H: t = x + where x is a local variable and + t does not depend on x, + the tactic rewrites H wherever + x appears clearing H and + x afterwards. + + + + New sequents to prove: + + The one opened by the applied tactics. + + + + + + + symmetry + symmetry + The tactic symmetry + symmetry + + + + Synopsis: + + symmetry + + + + Pre-conditions: + + The conclusion of the current proof must be an equality. + + + + Action: + + It swaps the two sides of the equalityusing the symmetric + property. + + + + New sequents to prove: + + None. + + + + + + + transitivity + transitivity + transitivity t + + + + Synopsis: + + transitivity &sterm; + + + + Pre-conditions: + + The conclusion of the current proof must be an equality. + + + + Action: + + It closes the current sequent by transitivity of the equality. + + + + New sequents to prove: + + It opens two new sequents l=t and + t=r where l and r are the left and right hand side of the equality in the conclusion of +the current sequent to prove. + + + + + + + unfold + unfold + unfold t patt + + + + Synopsis: + + unfold [&sterm;] &pattern; + + + + Pre-conditions: + + None. + + + + Action: + + It finds all the occurrences of t + (possibly applied to arguments) in the subterms matched by + patt. Then it δ-expands each occurrence, + also performing β-reduction of the obtained term. If + t is omitted it defaults to each + subterm matched by patt. + + + + New sequents to prove: + + None. + + + + + + + whd + whd + whd patt + + + + Synopsis: + + whd &pattern; + + + + Pre-conditions: + + None. + + + + Action: + + It replaces all the terms matched by patt + with their βδιζ-weak-head normal form. + + + + New sequents to prove: + + None. + + + + + + + + diff --git a/matita/help/C/sec_terms.xml b/matita/help/C/sec_terms.xml new file mode 100644 index 000000000..3cae2f84c --- /dev/null +++ b/matita/help/C/sec_terms.xml @@ -0,0 +1,760 @@ + + + + + Syntax + To describe syntax in this manual we use the following conventions: + + Non terminal symbols are emphasized and have a link to their + definition. E.g.: &term; + Terminal symbols are in bold. E.g.: + theorem + Optional sequences of elements are put in square brackets. + E.g.: [in &term;] + Alternatives are put in square brakets and they are + separated by vertical bars. E.g.: [<|>] + Repetitions of a sequence of elements are given by putting the + sequence in square brackets, that are followed by three dots. The empty + sequence is a valid repetition. + E.g.: [and &term;]… + Characters belonging to a set of characters are given + by listing the set elements in square brackets. Hyphens are used to + specify ranges of characters in the set. + E.g.: [a-zA-Z0-9_-] + + + Terms & co. + + Lexical conventions + + qstring + + + + &qstring; + ::= + "〈〈any sequence of characters excluded "〉〉" + + + +
    + + id + + + + &id; + ::= + 〈〈any sequence of letters, underscores or valid XML digits prefixed by a latin letter ([a-zA-Z]) and post-fixed by a possible empty sequence of decorators ([?'`])〉〉 + + + +
    + + nat + + + + &nat; + ::= + 〈〈any sequence of valid XML digits〉〉 + + + +
    + + char + + + + &char; + ::= + [a-zA-Z0-9_-] + + + +
    + + uri-step + + + + &uri-step; + ::= + &char;[&char;]… + + + +
    + + uri + + + + &uri; + ::= + [cic:/|theory:/]&uri-step;[/&uri-step;]….&id;[.&id;]…[#xpointer(&nat;/&nat;[/&nat;]…)] + + + +
    +
    + + Terms + + + + + + + Terms + + + + &term; + ::= + &sterm; + simple or delimited term + + + + | + &term; &term; + application + + + + | + λ&args;.&term; + λ-abstraction + + + + | + Π&args;.&term; + dependent product meant to define a datatype + + + + | + ∀&args;.&term; + dependent product meant to define a proposition + + + + | + &term; → &term; + non-dependent product (logical implication or function space) + + + + | + let [&id;|(&id;: &term;)] ≝ &term; in &term; + local definition + + + + | + + let + [co]rec + &rec_def; + + (co)recursive definitions + + + + + + [and &rec_def;]… + + + + + + + + in &term; + + + + + + | + … + user provided notation + + + &rec_def; + ::= + + &id; [&id;|_|(&id;[,&id;]… :&term;)]… + + + + + + + + [on &id;] + [: &term;] + ≝ &term;] + + + + + +
    + + + Simple terms + + + + &sterm; + ::= + (&term;) + + + + + | + &id;[\subst[ + &id;≔&term; + [;&id;≔&term;]… + ]] + + identifier with optional explicit named substitution + + + + | + &uri; + a qualified reference + + + + | + Prop + the impredicative sort of propositions + + + + | + Set + the impredicate sort of datatypes + + + + | + CProp + one fixed predicative sort of constructive propositions + + + + | + Type + one predicative sort of datatypes + + + + | + ? + implicit argument + + + + | + ?n + [[ + [_|&term;]… + ]] + metavariable + + + + | + match &term; + [ in &id; ] + [ return &term; ] + with + + case analysis + + + + + + [ + &match_branch;[|&match_branch;]… + ] + + + + + + | + (&term;:&term;) + cast + + + + | + … + user provided notation at precedence 90 + + + +
    + + + Arguments + + + + &args; + ::= + + _[: &term;] + + ignored argument + + + + | + + (_[: &term;]) + + ignored argument + + + + | + &id;[,&id;]…[: &term;] + + + + + | + (&id;[,&id;]…[: &term;]) + + + + &args2; + ::= + &id; + + + + + | + (&id;[,&id;]…: &term;) + + + + +
    + + + Pattern matching + + + + &match_branch; + ::= + &match_pattern; ⇒ &term; + + + + &match_pattern; + ::= + &id; + 0-ary constructor + + + + | + (&id; &id; [&id;]…) + n-ary constructor (binds the n arguments) + + + + | + &id; &id; [&id;]… + n-ary constructor (binds the n arguments) + + + + | + _ + any remaining constructor (ignoring its arguments) + + + +
    +
    + +
    +
    + + + Definitions and declarations + + <emphasis role="bold">axiom</emphasis> &id;<emphasis role="bold">:</emphasis> &term; + axiom + axiom H: P + H is declared as an axiom that states P + + + <emphasis role="bold">definition</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;] + definition + definition f: T ≝ t + f is defined as t; + T is its type. An error is raised if the type of + t is not convertible to T. + T is inferred from t if + omitted. + t can be omitted only if T is + given. In this case Matita enters in interactive mode and + f must be defined by means of tactics. + Notice that the command is equivalent to theorem f: T ≝ t. + + + <emphasis role="bold">letrec</emphasis> &TODO; + &TODO; + &TODO; + + + [<emphasis role="bold">inductive</emphasis>|<emphasis role="bold">coinductive</emphasis>] &id; [&args2;]… <emphasis role="bold">:</emphasis> &term; <emphasis role="bold">≝</emphasis> [<emphasis role="bold">|</emphasis>] [&id;<emphasis role="bold">:</emphasis>&term;] [<emphasis role="bold">|</emphasis> &id;<emphasis role="bold">:</emphasis>&term;]… +[<emphasis role="bold">with</emphasis> &id; <emphasis role="bold">:</emphasis> &term; <emphasis role="bold">≝</emphasis> [<emphasis role="bold">|</emphasis>] [&id;<emphasis role="bold">:</emphasis>&term;] [<emphasis role="bold">|</emphasis> &id;<emphasis role="bold">:</emphasis>&term;]…]… + + (co)inductive types declaration + inductive i x y z: S ≝ k1:T1 | … | kn:Tn with i' : S' ≝ k1':T1' | … | km':Tm' + Declares a family of two mutually inductive types + i and i' whose types are + S and S', which must be convertible + to sorts. + The constructors ki of type Ti + and ki' of type Ti' are also + simultaneously declared. The declared types i and + i' may occur in the types of the constructors, but + only in strongly positive positions according to the rules of the + calculus. + The whole family is parameterized over the arguments x,y,z. + If the keyword coinductive is used, the declared + types are considered mutually coinductive. + Elimination principles for the record are automatically generated + by Matita, if allowed by the typing rules of the calculus according to + the sort S. If generated, + they are named i_ind, i_rec and + i_rect according to the sort of their induction + predicate. + + + <emphasis role="bold">record</emphasis> &id; [&args2;]… <emphasis role="bold">:</emphasis> &term; <emphasis role="bold">≝</emphasis><emphasis role="bold">{</emphasis>[&id; [<emphasis role="bold">:</emphasis>|<emphasis role="bold">:></emphasis>] &term;] [<emphasis role="bold">;</emphasis>&id; [<emphasis role="bold">:</emphasis>|<emphasis role="bold">:></emphasis>] &term;]…<emphasis role="bold">}</emphasis> + record + record id x y z: S ≝ { f1: T1; …; fn:Tn } + Declares a new record family id parameterized over + x,y,z. + S is the type of the record + and it must be convertible to a sort. + Each field fi is declared by giving its type + Ti. A record without any field is admitted. + Elimination principles for the record are automatically generated + by Matita, if allowed by the typing rules of the calculus according to + the sort S. If generated, + they are named i_ind, i_rec and + i_rect according to the sort of their induction + predicate. + For each field fi a record projection + fi is also automatically generated if projection + is allowed by the typing rules of the calculus according to the + sort S, the type T1 and + the definability of depending record projections. + If the type of a field is declared with :>, + the corresponding record projection becomes an implicit coercion. + This is just syntactic sugar and it has the same effect of declaring the + record projection as a coercion later on. + + + + + Proofs + + <emphasis role="bold">theorem</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;] + theorem + theorem f: P ≝ p + Proves a new theorem f whose thesis is + P. + If p is provided, it must be a proof term for + P. Otherwise an interactive proof is started. + P can be omitted only if the proof is not + interactive. + Proving a theorem already proved in the library is an error. + To provide an alternative name and proof for the same theorem, use + variant f: P ≝ p. + A warning is raised if the name of the theorem cannot be obtained + by mangling the name of the constants in its thesis. + Notice that the command is equivalent to definition f: T ≝ t. + + + <emphasis role="bold">variant</emphasis> &id;<emphasis role="bold">:</emphasis> &term; <emphasis role="bold">≝</emphasis> &term; + variant + variant f: T ≝ t + Same as theorem f: T ≝ t, but it does not + complain if the theorem has already been proved. To be used to give + an alternative name or proof to a theorem. + + + <emphasis role="bold">lemma</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;] + lemma + lemma f: T ≝ t + Same as theorem f: T ≝ t + + + <emphasis role="bold">fact</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;] + fact + fact f: T ≝ t + Same as theorem f: T ≝ t + + + <emphasis role="bold">remark</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;] + remark + remark f: T ≝ t + Same as theorem f: T ≝ t + + + + + Tactic arguments + This section documents the syntax of some recurring arguments for + tactics. + + + intros-spec + + intros-spec + + + + &intros-spec; + ::= + [&nat;] [([&id;]…)] + + + +
    + The natural number is the number of new hypotheses to be introduced. The list of identifiers gives the name for the first hypotheses. +
    + + + pattern + + pattern + + + + &pattern; + ::= + in + [&id;[: &path;]]… + [⊢ &path;]] + simple pattern + + + + | + in match &path; + [in + [&id;[: &path;]]… + [⊢ &path;]] + full pattern + + + +
    + + path + + + + &path; + ::= + 〈〈any &sterm; without occurrences of Set, Prop, CProp, Type, &id;, &uri; and user provided notation; however, % is now an additional production for &sterm;〉〉 + + + +
    + A path locates zero or more subterms of a given term by mimicking the term structure up to: + + Occurrences of the subterms to locate that are + represented by %. + Subterms without any occurrence of subterms to locate + that can be represented by ?. + + + Warning: the format for a path for a match … with + expression is restricted to: match &path; + with + [ + _ + ⇒ + &path; + | … + | + _ + ⇒ + &path; + ] + Its semantics is the following: the n-th + "_ + ⇒ + &path;" branch is matched against the n-th constructor of the + inductive data type. The head λ-abstractions of &path; are matched + against the corresponding constructor arguments. + + For instance, the path + ∀_,_:?.(? ? % ?)→(? ? ? %) + locates at once the subterms + x+y and x*y in the + term ∀x,y:nat.x+y=1→0=x*y + (where the notation A=B hides the term + (eq T A B) for some type T). + + A simple pattern extends paths to locate + subterms in a whole sequent. In particular, the pattern + in H: p K: q ⊢ r locates at once all the subterms + located by the pattern r in the conclusion of the + sequent and by the patterns p and + q in the hypotheses H + and K of the sequent. + + If no list of hypotheses is provided in a simple pattern, no subterm + is selected in the hypothesis. If the ⊢ p + part of the pattern is not provided, no subterm will be matched in the + conclusion if at least one hypothesis is provided; otherwise the whole + conclusion is selected. + + Finally, a full pattern is interpreted in three + steps. In the first step the match T in + part is ignored and a set S of subterms is + located as for the case of + simple patterns. In the second step the term T + is parsed and interpreted in the context of each subterm + s ∈ S. In the last term for each + s ∈ S the interpreted term T + computed in the previous step is looked for. The final set of subterms + located by the full pattern is the set of occurrences of + the interpreted T in the subterms s. + + A full pattern can always be replaced by a simple pattern, + often at the cost of increased verbosity or decreased readability. + Example: the pattern + ⊢ in match x+y in ∀_,_:?.(? ? % ?) + locates only the first occurrence of x+y + in the sequent x,y: nat ⊢ ∀z,w:nat. (x+y) * (z+w) = + z * (x+y) + w * (x+y). The corresponding simple pattern + is ⊢ ∀_,_:?.(? ? (? % ?) ?). + + Every tactic that acts on subterms of the selected sequents have + a pattern argument for uniformity. To automatically generate a simple + pattern: + + Select in the current goal the subterms to pass to the + tactic by using the mouse. In order to perform a multiple selection of + subterms, hold the Ctrl key while selecting every subterm after the + first one. + From the contextual menu select "Copy". + From the "Edit" or the contextual menu select + "Paste as pattern" + +
    + + + reduction-kind + Reduction kinds are normalization functions that transform a term + to a convertible but simpler one. Each reduction kind can be used both + as a tactic argument and as a stand-alone tactic. + + reduction-kind + + + + &reduction-kind; + ::= + normalize + Computes the βδιζ-normal form + + + + | + reduce + Computes the βδιζ-normal form + + + + | + simplify + Computes a form supposed to be simpler + + + + | + unfold [&sterm;] + δ-reduces the constant or variable if specified, or that + in head position + + + + | + whd + Computes the βδιζ-weak-head normal form + + + +
    +
    + + + auto-params + &TODO; + + reduction-kind + + + + &autoparams; + ::= + depth=&nat; + &TODO; + + + + | + width=&nat; + &TODO; + + + + | + &TODO; + &TODO; + + + +
    +
    +
    + +
    + diff --git a/matita/help/C/sec_usernotation.xml b/matita/help/C/sec_usernotation.xml new file mode 100644 index 000000000..147edc084 --- /dev/null +++ b/matita/help/C/sec_usernotation.xml @@ -0,0 +1,18 @@ + + + + Extending the syntax + + Introduction + + &TODO; + + + notation: &TODO; + + + interpretation: &TODO; + + + + diff --git a/matita/help/C/tactic_quickref.xml b/matita/help/C/tactic_quickref.xml new file mode 100644 index 000000000..e1ff24b38 --- /dev/null +++ b/matita/help/C/tactic_quickref.xml @@ -0,0 +1,6 @@ + + tacticssec__tactics + + + +
    diff --git a/matita/help/C/tactics_quickref.xml b/matita/help/C/tactics_quickref.xml new file mode 100644 index 000000000..e6f2e2f79 --- /dev/null +++ b/matita/help/C/tactics_quickref.xml @@ -0,0 +1,312 @@ + + tactics + + + + &tactic; + ::= + absurd sterm + + + + | + apply sterm + + + + | + applyS sterm auto_params + + + + | + + + assumption + + + + + + | + auto auto_params + + + + | + + cases + term [([id]…)] + + + + + | + change pattern with sterm + + + + | + + clear + id [id…] + + + + + | + clearbody id + + + + | + compose [nat] sterm [with sterm] [intros-spec] + + + + | + constructor nat + + + + | + + + contradiction + + + + + + | + cut sterm [as id] + + + + | + + decompose + [as id…] + + + + + | + + + demodulate + + + + + + | + destruct sterm + + + + | + elim sterm [using sterm] intros-spec + + + + | + elimType sterm [using sterm] intros-spec + + + + | + exact sterm + + + + | + + + exists + + + + + + | + + + fail + + + + + + | + fold reduction-kind sterm pattern + + + + | + + + fourier + + + + + + | + fwd id [as id [id]…] + + + + | + generalize pattern [as id] + + + + | + + + id + + + + + + | + intro [id] + + + + | + intros intros-spec + + + + | + inversion sterm + + + + | + + lapply + [linear] + [depth=nat] + sterm + [to + sterm + [,sterm…] + ] + [as id] + + + + + | + + + left + + + + + + | + letin id ≝ sterm + + + + | + normalize pattern + + + + | + reduce pattern + + + + | + + + reflexivity + + + + + + | + replace pattern with sterm + + + + | + rewrite [<|>] sterm pattern + + + + | + + + right + + + + + + | + + + ring + + + + + + | + simplify pattern + + + + | + + + split + + + + + + | + + + subst + + + + + + | + + + symmetry + + + + + + | + transitivity sterm + + + + | + unfold [sterm] pattern + + + + | + whd pattern + + + +
    diff --git a/matita/help/C/version.txt.in b/matita/help/C/version.txt.in new file mode 100644 index 000000000..c275a8ce8 --- /dev/null +++ b/matita/help/C/version.txt.in @@ -0,0 +1 @@ +@MATITA_VERSION@ diff --git a/matita/help/C/xhtml1-transitional.dtd b/matita/help/C/xhtml1-transitional.dtd new file mode 100644 index 000000000..388a59434 --- /dev/null +++ b/matita/help/C/xhtml1-transitional.dtd @@ -0,0 +1,1717 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/matita/help/C/xsl/matita-fo.xsl b/matita/help/C/xsl/matita-fo.xsl new file mode 100644 index 000000000..3e564b4b7 --- /dev/null +++ b/matita/help/C/xsl/matita-fo.xsl @@ -0,0 +1,5 @@ + + + + + diff --git a/matita/help/C/xsl/matita-tex.xsl b/matita/help/C/xsl/matita-tex.xsl new file mode 100644 index 000000000..5f51e7cbc --- /dev/null +++ b/matita/help/C/xsl/matita-tex.xsl @@ -0,0 +1,31 @@ + + + + + + + /usr/share/xml/docbook/stylesheet/db2latex/latex/figures + + utf8x + \usepackage{txfonts} +\SetUnicodeOption{mathletters} % prefer math-mode letters + + 0 + + + + + \begin{tabular}{rcll} + + + \end{tabular} + + + + + \paragraph*{ + + } + + + diff --git a/matita/help/C/xsl/matita-xhtml.xsl b/matita/help/C/xsl/matita-xhtml.xsl new file mode 100644 index 000000000..099c390f0 --- /dev/null +++ b/matita/help/C/xsl/matita-xhtml.xsl @@ -0,0 +1,73 @@ + + + + + + + + + docbook.css + + + + + + +
      + +
    +
    + +
  • + + + + < + + + mailto: + + + + + > +
  • +
    + + + + + +
    + +
    +
    + + + Revision: + + + + , + + + + + + + + + + + + + + +
    + diff --git a/matita/help/C/xsl/tactic_quickref.xsl b/matita/help/C/xsl/tactic_quickref.xsl new file mode 100644 index 000000000..3a46261e0 --- /dev/null +++ b/matita/help/C/xsl/tactic_quickref.xsl @@ -0,0 +1,75 @@ + + + + + + + + + tactics + + + + + + + +
    +
    + + + + + + + + + + + + grammar.tactic + &tactic; + + + + + + + ::= + + + | + + + + + + + + + + + tac_ + + + + + + + + + + + + + + + + + +
    diff --git a/matita/icons/matita-32.xpm b/matita/icons/matita-32.xpm new file mode 100644 index 000000000..a33050e93 --- /dev/null +++ b/matita/icons/matita-32.xpm @@ -0,0 +1,70 @@ +/* XPM */ +static char * matita_32_xpm[] = { +"32 32 35 1", +" c None", +". c #000000", +"+ c #808080", +"@ c #404040", +"# c #7F7F7F", +"$ c #FFFFFF", +"% c #666666", +"& c #CDCDCD", +"* c #F0F0F0", +"= c #5F5F5F", +"- c #0E0E0E", +"; c #131313", +"> c #898989", +", c #EAEAEA", +"' c #565656", +") c #0B0B0B", +"! c #7A7A7A", +"~ c #FEFEFE", +"{ c #4D4D4D", +"] c #AAAAAA", +"^ c #333333", +"/ c #989898", +"( c #353535", +"_ c #D8D8D8", +": c #F6F6F6", +"< c #717171", +"[ c #0D0D0D", +"} c #363636", +"| c #CECECE", +"1 c #0C0C0C", +"2 c #FCFCFC", +"3 c #654040", +"4 c #A36666", +"5 c #CB8080", +"6 c #3F3F3F", +" ", +" .. ", +" ............................ ", +" .++++++++++++@...#$$$+.++++. ", +" .++++++++%@...&$$$$$$$.++++. ", +" .+++++%....&$$$$$$$$$$.%+++. ", +" .++%...+&$$$$$$$$$$$$$+.+++. ", +" ....#&$$$$$$$$$$$$$$$$&.+++. ", +" ..#&$$$$$$$$$$$$$$$$$$$$.%++. ", +" ..$$$$$$$$$$$$$$$$$$$$$$+.++. ", +" ..$$$$$$$$$$$$$$$$$$$$$$&.++. ", +" .$$$$$$..*=-;>$,');!~$$$.%+. ", +" .&$$$$$..{....]^..../$$$+.+. ", +" ..$$$$$..(_:<.[(_:<.}$$$&.+. ", +" ..$$$$$..|$$,..|$$,.1$$$$.%. ", +" ..&$$$$..2$$$..2$$$..$$$$.@. ", +" .3.$$$$..$$$$..$$$$..$$$$&.. ", +" .4.$$$$..$$$$..$$$$..$$$$$.. ", +" .5.&$$$..$$$$..$$$$..$$$$$.. ", +" .53.$$$..$$$$..$$$$..$$$$$&. ", +" .54.$$$..$$$$..$$$$..$$$$$$. ", +" .55.$$$$$$$$$$$$$$$$$$$$$$$.. ", +" .55.+$$$$$$$$$$$$$$$$$$$$$$.. ", +" .554.$$$$$$$$$$$$$$$$$$$$$+.. ", +" .555.$$$$$$$$$$$$$$$$$&+.... ", +" .555.+$$$$$$$$$$$$$&+...%++. ", +" .5553.$$$$$$$$$$&+...%+++++. ", +" .5555.$$$$$$$+....%++++++++. ", +" .5555.&$$$+...6++++++++++++. ", +" ............................ ", +" .. ", +" "}; diff --git a/matita/icons/matita-bulb-high.png b/matita/icons/matita-bulb-high.png new file mode 100644 index 0000000000000000000000000000000000000000..03b6e7f8664372aafa75a27eae71f36ba634ec49 GIT binary patch literal 1149 zcmV-@1cLjCP)%fi@DfG-xEFX>zUi z;TN&(erzOO3J78agP@|eE@B(1#%gn=bVZ)l`-6=etDPW?q&gCjwyF*d5F<947PcL= zRyuL_mPp(cY~mDA5sZigBF0EiGg9k`G*)F{d0h+Ymrirj_Npd7LqT2UJy6eF5rJRe1+?eil&$b*L7q>QQuF3=en%6lhh| zte=(Hq|)L9s#NF8p9h}#>b=jrRujdg>RgExmx+)AB~Th5!xu$6(Zlgz%lPRIJ|B5? zxl>j3s?MuA?^S(OI4wqAvwiPo1EW<|)FXE+h7?H8g?)^=b`s2z(98DG%O6&HHV)Kh zsOnmz78rxJaA{+y9&T@s_Bz3< zpW3bEk37w*9urwH26dSs?c*n}IP7nR*?4FFYS(Rs0mHedCqQL^0T81us>#HxEjIq# zIe2<|GTy&(`Tf;MBoYKfbMkDK?DzYrDGpz+E|kxb(C--|gE`{@cm$luM=On(6l)8$ z{P{uAteI{dsc_|#s?3>=k7PX9Ia*&f8}-O+8zX&S4;apeQduCIR{*HMXMv_^mXWH< z!6?2u#g#dEo^gCKofh4suNv-x?9Ox3v)nUaG1pOl{$q?3?M{nmai%f%09T11f}UI5_zEo9`YyxcAxTL6ukX@AF-K{Kt#aSj*pH{P?~Ke)H}8vW)-$1HDN^ zK~y-)g;ZN>TvZrd`*LRHOy)3YGD(`G(Ns#4Xwq0RNwi`S`%-*RAB6r41z*({@j*lo zY7x;FL8(o>A|j^JO08O26&&=TnxxfSX3}IXXXcza*S$X;ZyLEsmP#kC7J{wRL#da40HwfC|%AePJZ9T>m& z&8dt+nM;pphylS{u9@*Ab{IRF6w`WN7Ee@e{c z=bwA#+2=>cC+=gWnb=DNFAP;lYiJ^Z(m)hbG_ZH1nMjJE!cX6rUZ8&_Lijfh-8dKYn@cyVaWOoBgwQT zD5aB(p^q_^lai-72a}RVjG+-KNdbjn9H~$#iWx(umEjH`5osclQKTWI=77#g$$L2$ zNzN%jL=B?Y;1V^K1OowDE7oos*>YcASy_JIuKkmO7)3@zRiy%HrY(m6BMkgR6f4I^ z?COM4h#8CHKxmCh>y}$J{PwHGPkNipM!Ft)q3!!6$M-GH~EWH0}!;P;3cWmg64wTllQ$xn<+@Lr+)oC&9^x^Zpr z)N60BPd`5U-g>EWQYqSM|If00OT}&9&UGhV-r8K5zh@si2-yv%@++Kr8Kvt5{5Grx?M#aq3^-- z6+G{j?m}>l|ES#nNh#*IUI4}g{J=*LgeX@X?FY)c9a$Y2id_Jinbcx!b@iz(tCyF{ zCHCFr0)6)7mD;uC?Kg?=3jnWU<8IWgE}0U7AD){(@^m)a{m|m#x$nckKjQ`J5`c1h qu>LP#%hLJ*i~%U#J}!V=b^Hr?bl%|m6rzLx0000QqI_B^_$r@E`UZryv%VPmoQ>bv`pe)W%!z+8a49KIYQh2Cn-H%{jK$4JA2 zHewt@@MO(8_cSYP_iTU5JuC}9Hx5g1Sc17Cpa#%5z~(Tf1lfVcFj%zi&Ere+?$+*| z$!NSS#uXh>yG~5ng=RFHpa1Rt^XGd9JNmqZ;Hb~@ePc<{V_ujzDC$>y+G zt~Se@s#+q+X7g%N3=Uo!3^s^*+Yagz%9}*RE)h8=?YYqU#9C#5gHET+C#R=}mrH%v z8y1zdh@{*(^20(^%9o4z{@&q8Ni_jb^rnV3?^^f`0{|u)sc>LTwNf^)6qa#vW7=D` zr#l?OGYbMBaNt%6sxijGk|6~E0pR);rmz4k0Kj@7KLC*d(keiLaBP*^&Z~HkkU~`* z@_~nlgRP-t4P0Lp1jH4Qb_U1*0N_ZFU?4H6M1`>cSt9EJTUumU214c#ss@UpurgoQ zS2z3pp`mi3Sf8^j{!6BR0Kh=Q8R_zu1dXbOL?N0|5{GVSxM>mEHGs8)a0JlqZDmJK z&o15>P4+;sPEZRp#|HIrg7w5*t|W0XO`pI#5TBJkIsw5{Kb=7ubF$L3D+dN2J!@Q z(Ls0(1>g!d?CIIFlh~!M*}h~e31aD0kiU2o!*+-Z)WFD7hbQZH|WEAg=mYb>$y2OJw2UH?7z20 z#YaLl3=)@ziLmLe`v8Y>#ZHOzCxCF1S zLDazK5k6;tItP^i5eATuR&&Hv3sE1FsahrwIfTdvQE^qZx@=-Cf~9h-0NX*C0d%l7 zfif`=X`u)JS}g9LKw?Eem70t1KK|s3^vlsqUtHGs@!_$4`R)H|Px52G^fO0Tf>Q$y zH3$JJ0oFv)&p!AQ00+Rox&>e_u4De`zvg#Nnw@{TV&mIO)ML|uO5>e0~ zK}8TEN=E@oLjybjR8UX>L5YHLacqa!bN)jyv+Hr}+>mG(>1e&H+4G(MTxJdb&6=5+ zSpfV5yE!&KRy(iXBKz$RAKf3i>C5M@JbAoAF;d)c`J3|qM)I4>moCz7?bB{HXzlOO zZ0yl!>@quhg~dC!arx_0ROWVlsDhvC>o|Zr?%;CdqQ)rHic=$QHe0k>2fSE*1yIxn zHte?}%^iT9od&BbYkyta0YIyL&<9vuS!4P6Q|9NdA&FpyyW>)Il{=Df7l)nS{P@1k zt%b!wz`eUm0};GjdB)t_RW>%iAvwVUl8^~Wn1sv-!H^l<5ZK!KHC(~RPal|^oC0?g z3xMNnZ*O9G ziOCZns<0r;W0BpfB9GRS^9utCEIC$xajRM=SCFMp5t`O?9jF0Q<&zLXR?HqCe_4uY z^E`kM0eIgWOw`kfI+_DwpL=goj{wWa%XY35;?zb)NTXM!NWdY$yZ3KtwVNr|>L0W! zWrn9H<7CGfiG%DEMZw0#RuymANz=fCbDZ^Ou_a)pNL^F|#Hq)$ literal 0 HcmV?d00001 diff --git a/matita/icons/matita-object.png b/matita/icons/matita-object.png new file mode 100644 index 0000000000000000000000000000000000000000..fe89a30e81ef3c6651b4256010395eed9caa9159 GIT binary patch literal 893 zcmV-@1A_dCP)cYZ;4h{~6z$-vUMY{rTlGJp4{fXYX^_`YVB~?`|7K=JO zJnVpcgQSJ2udi=g|5P=dMZ~XRb90m4-d+GkMn;&LnhJV)daeO|fXVJu7*+Kl7!#l> zcrLQpEOA_?P$;xN_C8PmV$+JH9f5D&{1#Qk7~_>B_nkdE&i(uMc=Yfgzs}#r0FT2J zuFrfE0v`YmvfVOP1y$kPxsO{3R53w797PNa3~==58|>ZpGUalaCu@HJya;4ES|s99 z;09SP*SR+T{JlKPr_CRFZ42A2~uMlL0bRs}*cL z=Fq`|^fx!k)4M1o@F6OQ2wz>f0>BraPbb$@SYG~}IF5+oh`1i7&%btHe`9Gn6F7$x zhjR{b3E1)Xj&u3)C5p4NOizE=OhAM^7dPAa`MCpR#sM6 zT3Vu7ts){=YY`EGz@)vgBSEK8E|-~`o8$1|LwtJveA-yM8Bgi5&Nd6{i~PskyWE(W z;iK_!&YbxW=N#77)2>z#)c>5g?g|p`9nRWhEy9Hh7b%tgYg|cN=Nt;D2 z1aTav8Q}pj@cj=(42ILEPcb|DBdUqQ(b1EMO^sTpqTMXo*x2wsDwrhuAP5*cHHtCG zRva4}MMN;ZUaIQn=GnDvk;59K4O zO)^&B|H*$Q^}7KoD$L*cEiGSreLs7~mwvan2pj`)rcKR0A3gu`OQsI20c-yOdfwOL Tclo~_00000NkvXXu0mjf+{>YP literal 0 HcmV?d00001 diff --git a/matita/icons/matita-theory.png b/matita/icons/matita-theory.png new file mode 100644 index 0000000000000000000000000000000000000000..389152ef306f55bf5322ad4102da6526e33e2f79 GIT binary patch literal 1287 zcmV+i1^D`jP)`cH5LoX(LOkA`mekloD!`3Q_C> z@IXKxOh^+n8hL4e2x_93Xp9uwR3eGKXca*dASn{kDv?Sph1%P8d)xbEZr{xM z(AnBTQTQh(GY|9qzWobSN=aseBG^FaPCA_hc(Ffafd03^p9;7iIXtHW;}Z)0>a zMov-CbPZM2(RB??)6jJNwnZMdM0#SFOXq&d$H)3NNq2y^wX_~X(RDQ4V0bKws;a1} zief*7FaU5%(hOKP1ZHd$NpcBbk#in!uqaU0w0v0&sZ5UWcofq#5q6k%6l4g2Aq08y zD5)rkc!bH3zWsnQAN-RY&+P{wtEkgZVPFb@DFi|Y@_B3S0Xe5J!q5o@{1)&j@b|6o zGGJ%pmTg2P6GSExwrgvS^MY(9Zns1#Izeps8c%I)az47D9w2lp{GDfCI808_$mVhg z+o?G#EbCvmWr4%tK$2VtL#N2?%y(YC#GXBS0g7kCOM#ZnPi(ak=^SHI$(j6$SutOQ zq@v@*!#%8Bvr?_9uI9@VpHKhUtna#7THhqA=uSmZXYxD8xhZagOD-3NF!9T7Qpu!m z<%*Sbb#(#+3#GUW2(8~x&s0Jqn#|0pj61oOBo}HXPJHMp+nXBk$!=kWR#?xv!4ii{Bf-7ll&v1A7u=4nxv{xy|5G^1cqTC zOhGQEFd0u`nRA^hs!n)l0CU_=d9a+Snh+m-eAo$`0+K*ja(KMEHf?Fycl|fE-4UtR54cqk~kd=ykzPg^?UMgG}%4M0-7jg|`fV^|j!bPY` zj$qvedZI3F_7C8eJv>yqoK>M}ULFxV)7;G9;2?=ulte5_Y-*B*hK-!-xJ)RtoZru$ zRLNT>fmFdYfOMm;_sJXYzkXKo6vfsx?eaLluU0H|7$p^?A|s^bB>VQigyi)id)$-+ zil^_1_daCp>N*qyrXoWQ;LL2-g^4o^v{|MxIMVk=nPrNa=RHZMHqb|EJi<3=k9Bjx z(9U#p89$!ybh|xnihME+_3P=qeuG1=9u?VS^ef;B&||{^C`=-^UGEEkj&C0+4@Oke zS0TF`yRSqIKn2V-jm>hPq+ALH%aJ@@Q!~-p+uoJ)rm+vW3S0+fO0LlU29U6K?YI!r zc05?@%#Y^`tFFkE=*yWsz^N-2zFQA$04f2?Zu1X-xII7T%)a?%=;l?$(uvml7L?>H z%kyxlS8ljCmH>9!IrRe-fX`m90R6y-ZSp@Q0b^GitJEbPhyH8Bk_<2fJZ%pXFHmf! xaDn~qzU$6&z(HUX_*$Ay*Abuz2;55t{{!UdqH-zUjSBz(002ovPDHLkV1jP)TPOek literal 0 HcmV?d00001 diff --git a/matita/icons/matita.png b/matita/icons/matita.png new file mode 100644 index 0000000000000000000000000000000000000000..342bcb44c8e314b1be4b0e2272267d43b7215717 GIT binary patch literal 17605 zcmb{aXIPU<*9HtnQ9uD3D!r&Q(a@#$9;pg~5Q+$)hu%AiAW97wq>CU3QY1h^2SEW7 ziUg$>5ouDT7lC&!_WgW6zF+T;cOS=n>@e4qH8X2gInQEcp{iu)m$5YFAC$b=uzlp)a_MA8V_g_(LP<%@nWd-KRIT~li#H|CRZC-s z0fd6HRl~!5>kIQGZw8G<_BR^OKl{`WOiDwpU0uZqZue@_(xc7gRYCWNa{`Myr)v?pSUw)-?pac;D*)`~SW z^^uDh4Azp{kSCZdoqUVyj_@7M1l^qZ6R>8U6ixoS>vDF8KPxS_6?LgmFeP`R$ccf@ z-kUI3SnaJ%3`>eE)KI6H z3PJ_N##0tsEZS9x{jN;DhoItOD?adjny1$pW1>NUpy1j}yyIlEY=qOL4CR_xYs}lM z%08c)j|sTzcyr-$SfbX;>IID9t6v^w{VUCl!=!ryAtzytb|T4vTKqnKOzB*i-BVi( zcWc$j#@w+9-v54TFTL70j}Szp@h+Shp-a(Z=AOTgV7OVAs;3#C)o*olh`e7o*6Ocn zjCjgTSJXg@-F!@n_Kk~M&{otCI5O_1Avka9`y6GLcatW?RXog$__K)t7pb|(hW)#x z=>rzmIT*C0Z+;Ntsx|x?aH4b4YW<_q5XVc25v>obGmh66BtIQhy2l-04$bdJvCe!| z^+fn~jJIzj=bgs2jIE^ItwoT7OsI~0_qGMbP>+yUwV4i_jW<$7^tB>kGW{l8h&X&Xg}czvF-VsQQuu zkLAp+CwHB5<>YLY7L`fUHqGyU>ks~+Uac!w2>IPijzR>CJoCSva)iCYyj!i*AK*l= z9p@@^%@VE4smRlqZs3e-(C++ehnx-{T5tGGPmEeO+bWjDvQ4(FW6e|a&^!L?y=q1d z4|xksXV{}2=pMcCIlCWeaT;@|LLT$*)!O)qYq74xSJDfVS+M>yK}U7a|yE^zM)Zv1YIhAn&42X48HX>{$~0F`Ab z4^<6>mJK>_@k$q}f%!<4EOxOY?4~g(An*u|Aly7sl)vT_k2S~PNm5y}2fNA-(>=J% zBAK$LG%(|dV!TgR8Xl6bOA*Q+=2LbI2kh9kdTRDx{i~-bJ+Z;5_&oF0{CQ%?57lRR zT{xpyHGynRX`?`?S3kv1-P2t79k|7WFgJ)2x(I@_SSy?uoZEf|vwU}Tm%tS)F&mAM znQsnm<4@jj#e~3bF^ZNyAg^OA61>eK(r%}iW~R%{mWvquTod?tXN_05(O#JBwgfR`*jq^FPmQ=wd zSJ;_FL9{^!N$HV&c%#lf5h^hdNT@pJA2F|VsoLQFy(c|{lplX&YGicPOB446U4}IS z)J};!x^IjqyA{mon&ka2V%?_UId6jKh5Y=Wf?~Rh9`1(yx^uT|(EjyWWIJ5{%2sg$ zEoK8f?eqCv1y``S5v)D!R$-tny;dE!+>QCF;doz!G}pp;E|GO^-1v*`%`ZcDFyo}Z z_@O_13v>1qY}G5dpgmNpU;0qwhukTLXT>GItp_Z>9M&nOHU(4d3~`!-Mit`GQk+f; z3;x8zC5Ii&XxxMX9GAVOZ-QJy1@4Cuhy8L8k)rsd4d-*D!o&^z(cps~*5zE&evX!R zxN)YA&yNrsGm`7Km;`QE0v&3wn{9kqrnT2tJoUtG?;*EA;xvwTrl#IZyVFBmK_RvK z{;%xzxP#>N$?Y2fnSu+ep9(|lvXVE?WuMvRN&PAqU$&CWN6>ei=I)F7Xj88e(9^pW_uK zM4&JwZ{KF6wxplfspVBsY@hM_+Hf~SJ8BA-_4F4ZN;q79EBxrbEsMni(y-=&{LnUjY)Wc$CJ52g zwHmlh45%CK-mG2std2Fv8CC6fxm+WC)2Zp(U!0MKZQbY$tao#q*+fnS zl2ch~4rv+Rxw;?1v(TaMGtB!z*skKv7KaTRy-em=6C`G&;pHa{snNDV{YH(NraK{q zi9GpZ#I10*Ukk(T?vB;IKs@nLIr@B{U5c5q zKxVe)ULD2uEh$k~fspG?A9kJD61`H3`xa`R<;QUH8?F&b;ya}KG6(SAc$0&d6Y_3) zY%!3Q6OaOS1h-<0x6#!kQ^cM{9N{1}FCLx2O^-IWVE-BEjuTJNw#hH1xa3clv*@Xi zP*t9sv^MrareDcK@Op;rY-i0*Rx!M{ViS{hg!jj4`^`)K2{R8#`@P1jMW*n?WUgfgff0@@R(2Xg~$*20L z#i+6ykvE?o)j^gviRz)PT_%?J9~Kl_W9mv?=6TZIW^lV-oRDJW8D)_ik`iw?0?H9N-2rNxlO-Yfu&p#m{|LFN8#?EDEcG0CWre_dNQ zMKlc5zvb<*csUw(2Hi1OgMSI;)y@erB_9dPsbc%Tjs?5u{CT^0{AFIcHyQ=*4v3`DoTmr;`+P znD@cJCcoiiHSXSdqF9DRi-jWYi^ z&QI}+%ZWH!C#@C`ZFB?f7JQcKlw9)pubnp!)+PxI7kzGm2ri`~b7FG;@;BpYhf@c; zCpNihrpNC#)+LXWrfihCXMafC2&AYO6qpP3vXJX~$iD*aHQ~HxwT>2I;$vWfq(b7x zt*DgA2eYZ{u+ou?-|MH>+EQP?;Of#|-8JS4UR=8!M;*WyxcRW8aL3(NW-+l+IBG|rJ>4OuaBbHyRiGz^s|b$2ZqrS_!ehtTXl+TRtxihwWG44m($DpD?uIvE&g)8if$wW|tpDrK(l^!q5oj$5hK45}E5;`+WE6aZ9n_Y;c^)-Ms|e-gry{z-UBu&gX(6VXr01aPK4jr;d4_~y|F1%sJT79{rp4{7?h zhk9|)^d%wz@h5H8g9VCUKb-C8FZY*B{Jq{~mU+D)#UQBb^HA?ut}g6`;F-p)4(*%t7>b}|2-O9YCyUc~(%Q9YakMV!FVmMn} z-1L2X0Jt%{cE7q~1FGulV*~|CF3y(}u(-J85~nbG!sJA{Kt|oyfN&8#qg&cumM@+E z`C|}UzIJ<`#fnpt+3qJME8mHuuz@7mGeYZChUaokQ*VmP9)=ePd=MF|iwl~zR9 zKE_#PmtNGm|DseEsx(FLQjoyNjpVV+S=vO>HN-8h147;eVy_9Oykl)rwzFQd0++6s zupN+HS6Ga}@ZN?3!byvC{RUUX(X? ztwo4G&7vz`d1-&0^`4sZnRu|~>ubxsb2xr;W^?%B*ONIwqUhJ-0b=0LS|;xt5f;yU z9@MJBja>MUniqVo(`sP)P2RG*=t{Xi6R%B`oy=yHf18WW`Yy(;h6AQdM^k*S=PncXKz^q({?a#hwc}V{0;Ui|an0Q(&wr z0h#}EaeR)6n|OG>spP+fkAy^R*}9VdG00?Vy(OfRcgra}e|r{UywDgEE!KzQ!9xl* z4(9oz134r9CV!fHuDa{Km^LCw^Wtw7ik}@V`4=xdrbo{9vd#VCh_LLLIt(C6XId8> zk$7Lp@`-xmi(}z>?;duK+&#)T^ms9H#MQ%eu|Rd`XfoX*J^{^FCL(GpS2&I*Zm#*n zRmd(j->xx>)7&#nGdXft7qR@hoI@NuD);X;6V!EiUUTz{hu&9HhAijwBp#eNk$I-s zj1I+iUwp{<3eF;idzeEaRUE_95pbyKl|90Jr^|Y#_wJGM^2g#_v^Vir2#t+gcMtzT z)_GUHiUt^_r1pK`0n^pH%xS;zaIUd8VOf{RXTaISXX$tAXqh0XMs`mH-K}B!)~Mf4 zY0A@T{ZeGa-mMzr>YYJ)cfXs}Ew}1^6MViORYReG{7ewZm`o^ctrJMuNGpzo-8hQU zW63Dd?mt|avS}z8yWhXJYJsz0jZ4}HD`u!mEuQh0>`CRlSuwHHhs$aYxjmnbJ9HT) z2Hg9m*Ds@^fc0K`eqN-yi5bK&qGKs_&x+CVKdvKo{>aYk;)@S1jnT&T;rf+qE6O{MKKfG@=;{p_)hr#_4ot&MM(89R zOtM7TF`iU;JJwkhD9>HPA=kdd4sKlN(>B8t5rnnp>vbye+apWC<-vvEVSJ462q`t( z+e8eRg`~{NHrO;2c~70OiuE}EStj`)ToYrSKP#!iW7;w7J5a(q#Efv79$!|_;V$X+ z98WygWyI;E;LFRgFa;93K*Fz;;(r`{UMY?y$lTeAtiAL8-EMa5q;s+0MKoU`?k?~x zJYw~6X0>T=B+%Kg;oVE<*12lyuQ|yXHwwJk$fsMEtWh%jyonpfdHzB8lodCfrk~Ao zxxMgQzsBY3(UFYo#ATC(#HFBmk`0=H{Nqzi*{cJ=1U;g3M!tDe&OzcO4vA|?FAYXK zPu-2ig+4li+V@KN;pNL;mpz|QyeZy*g`-K`{DD#TV#}~j{~23(l3P|h>cEmw z<~7Ye`WnL$YKh9fv6w-=#OBW6S~ZDRy5e17(pePx-mW0d=V*?9At4+6z&GZAQmrza3jA>56}WI*3WsVlYu?4KabQQS(wcpVItZpS zJeZhtG-=|c;%*RJ$jlr-9SHEsOg>{tBk}7Re;syg$SrRAG)PxTM4|OJYryXmC&7L5 zwDNbw4<03IQJBPA|6WsCGE=`uq{b2>a<^WlxF_hBZq(8OENmhJ~$Ue0Wqf z&5mKGhk6xqRzkflQ2#~yM+~{+$OfP<=c9l9Sc7MOJ+H@{fXUCK;4=hbsM1;JV6gqq z_~}=XcF`J)6fos4FVU$&l(2~Y?BB6?ZK$Qk3%PuAz6=_cV3QB0Z-c?Oe%eCv^}GN* zoBtknOSo1r>>+p&e6;E6KAwBp{|JE3ra{O?v8a7cF#02+^my)O+gZLk{HPXrLKV#a z^SOpMkC~gae?W1`Rk|$=8<}@YNKQ)h?5=+A=YpRuYv+(0qKE!SL|)Arb(=EX-+UJN~no1>)%8 z*Q}pBx0XfzNm)!4*%`eF4rz-$4}NSjS!r^Vz~JQ1y{k-QbF)8I#|z5R(Jfq88t&+AFG2oYFM`K_26!+7)um$BNy%1XmaXr}Qm z(qOX0uhLUE9Ip7J)Z^hwhu(M-0&Usbn-oF<=At1$cro{1pX;%`1Xs(=l?h8E-Z@bf z87Xm*2#eXB%Z;z}n!m5nD%rm{RFSLHS&QZ9~2e@Y5QxPM-qY;_>5-d1J`v#!6~R&GyPY3XvR-*i_fT_eS z&QCoAk7Q}Ms`fWVi&pR1#~aBfe#0Ly`p$h*Ixo8#=F)WFLy^SIFo88Lv(Vvdl~iU@ z>?S|^8^a{Jk+~Ao-fWYa18;Q#%!A2#AfpB?hrAgDCG9tGo7}xvEA|{(PHUwzQx7Zb zdh+3|qM)0@Y2la~K$J^hqWencrXB)OPUq0R$@&=KehSTGp~Oe=d~db&d==O_o0Lc1 z_`nm!W7$uF0qr*O+33aognRqS|6~ivJ)qq`GR%W8+ zY>`x`M7>t#qd1|=I1+`Yr9Z249>y8k9>>;KY*HcSI$jU-C`X0rV6!ar$82_}E~ni! zGWLd1nFZQ~F@iFOc4sh(BjmkFg{{MEcjjhGwRL-3gnQOZXDa=HBpG{x_wUx7pDKmp z`OAalxwf6Jl`f1t0_s$ZjQl{2YSsWp+nFlrJ%T1My}n%yM&(YnMrl1B6UorvqmWM! zh^g~gDgy5leBFtpW62MvpmOZX*TLA6+^#MppE&=rSX8(2gfS3zb7v~vX`(Us&v4a; zoHMOfTZ==-+Q-`qy6ydZdcM+m2$$Ej^NEV%dkJCO@e$7LExZ*TA@cKDM7b|`Ch6WJ zH`W|lKbX~Ga3!ibT%VHmdd$HyJT1_=uoDsG3cc7#F=ZyVdqqOa-wTs$yE71sf#5`S zuP2{i$fKE};t0~G=g}4tV#28*Ba^`Hlt%FAzO`x6nW->vIdMRKo@hL6AefE<>|5o$ zT;AWQc9z$)KGmx&G!7&;KpYJ|7djWega6mY;yOpx61*dOsdZ8`Bp7fC;ht?)sNL_YVWKormf@u(sP6sA0|HX?J0hTvn zT9;aA1i!ygdb%+lxPo{Kzo8Hzl5o;0M!OU28&8V_Ds(bJ7^j4cGzUtfUMrM!#|i6F zGkujJ>C*z3og#Hd^eJ*ttG?pF+sp1Uuj{~&4u6Kh!9Z@ z7m7sMlRBt!VidKmv}MZp_Jh5uGPe47&UE%ZW3b?h#>XsPAX0O+F!GqYeL7u<`W>OK z{sx>Oq(-CF?vy+#gP#f01D2uYH#FkJWUti6>8o>IXj@I&!Pnb%F)K4UTqLem0gGix zN)gm!Zi8%|OXIFBMbZiKXpN`$r_&6YV3(p1B0M;@noh6t|NXK84vd{-=hb7;wu3#@eL;|c!zg<-R?ABWN!3s@+roqPKd zGS}_wft}3} z{u1PdS_|}wuc<^brgH!K{WZz)`}=!y*-pRixQq_Yt;I%q6zFEgG?{Lsfm10$5?ua# z%XvC~FJ`dT`vX?cvNTsCzJK2oJj_ktCM*mJbnghI66Cf9t(osQCWB>B;DJiJ{Z!o8 zdw%hT;r;uMowEeYYgGr}+0x#3Q7BaHB90W(Wng5KKh++;&dOSV!;$CKhQ85cCGf}8 zdCk8CiZTDg*z(6CUT~aMc0KIkKb1Lwq2b;8`!$JobJ(ejDTC5N)gbcXeA?gE^9sf3F125qZNfb5 zNt#jmz%*G$jAcl9zFolHK&L)Z2M^QuLR;7~e2gJAN)kjte}JYlDKo`!#)SU{Ln8Gf zOQ@|mMJrKU%6zR?BZL#!hD9!2OHO2HVeDW-GyP@0>v(JaF5&}Mu!|4t&S@*!-|_eu zKRWIP{=%lbE)1nsk+}3lS-3gl(cyN}0HJXc4m9~t%y-!g1R0QX?Y9!YVJFYX8EwsU zJ;y7m)$HS=aA4t7I4Mk+MQol^o@Zxm=-$P)mgtk83J-+djEjn8oNw7lwadB|6E548 zDI>8b-2V9-K^YN$_eI7;akf24f5s|kDprCy?LyuU1Hu2R1)x4REOPxUH(QdJ=!|F6 zCA3uK{bzrN?6P$jDbD4PU6xRWep3LWr{7ZuRG<%ISocbf{quYH*^2UTiB|-izZR zS}H-@bsWT>@`}iFgdP3T%V;V6>sJ3dMSHktr|hzWu|kxxJdN<9DUKr{30kvPd~Ob; z6A2EC6K<_^kvyjov_b5c+r$+wW z9I$k?SB4F}fkzqO^h=Y)Zp=uxf8OG2VWbuq_SnfgJG^s%bs({0_+xscW?4aV*r%sd z8hQ(SKvd2LV0t;eB%$#tCk89pQ=cIn;poFY6*TXV=XVHQYOh2+1^Xxl=KfNfV#haZ zE4Mjc1vlQR+$v~suv{9L;&8V|V;+7smp+1XjJGG1f=F4FmRamMp7l~{ga~>_4LpZ5 zQ9E6-kVUoIH7nYP3uq};5jx{xTSiu*o%{ zV0xMmXjKOG{Nf5Ly`PwDUEb-G;t37r!jaRC`K5^H|$gRi2e+prOAtkzZE_5Bx!3H{<$m3 zslQlQg4X$!)|*2_;cX|vwuY7F!l|?xb66*^6u#Pv+O2+_uZ4kX zT<}>Wu(JA`vUf%K?7P6N5cP@p1p4=Koibm zinEEntEF|u2G*gJ2iK@y@0Ot~P!e$wLluS~^7r8#`_O`O#*p z6ztLv3`Z~^_SD}BRyzK;3qqELy{)AWB}jrJc&h?&)9|vU!&=~S|CdE}gD7yL<3{{@ z;D|wjmjT5iqPCryN3qw|pr9{FPd?fr^iN?yWynFmQ+oe)V0%mC0=G0V{lzA^>aomB zSsgOh<6qu%iC9wusM!1;Rm=LL!+r1F>6AL5NQIz{UJYjXpz2!R6_`O&;Gl- z(EHctGr1&Rk>sRj?y-;0apJrejC9h)yFLm3Lk;0j%#vRQ zXdRIHL4kZad#gcznPr)t!hu*ogI>10ta?@Cd5+Sfo%o~Yjkjt*z!b|Q+O}#qu5V<7 zJxpi){aJeYB{w{&QrDYeR|^rESjo4Qp6&PR%!3CHqyYH9nL2T}Md*!h`nRUl4-bsU z%wat^aExMCqp3 zzAlI1X<^HCz<@&5yWv{4e&a*3$Mi)gQG~f!MxA35a~}K%oEgr)Cc?v+F;sMB-6YCA z-L?zrf1)|Kd>`J2?IQ6c1MDIc@h6A2Rq~h24GndP)_gcc*giNEJ>*t`wla99hmCo~ z@dN#Ds~@IpEiyIeA}L|pz1W5u5BPX#rjm%FG1g-eKDW_KFxt29K#jNhjjDyM)dkMf zQ_uUm(xJtKhH(;~BR#lcCX#8aSYHCkZNc~)eKIH0*(vH_5!h=Dq9*Rmb2L z+4Z7uTnGF!wD+MK<3JC|Wt~SsX8|&ID27UB;c1rTAcDvVrv1{DRwml(*i?9 zD>0#mq#DnnKpF?j@5N?L)#>Yg$KJYii%$0xY?3~d^5!s3E{K763Hg{J%prJx>m6LC zIpzNr-C9TSX_3n$pI(MBsv+^&t|~PT`tl(uV(`v_6aU*ZWIkRB)ba&n;xjlbqmD(h zZbI$vNGEg8H!hSKD24w>aUj8dHtyg%cd?$c`}!_Jm4%JN6?PlaU>~ClbuPQW+Eh-n z?#d^>8}=p%qf>K(PK4F%ZOj{#!3Vy7XUyoxK6#M{uDP%v>n*rgl09jcM)kiFfj7dN zc4yKnr*EI;Ne1gYVn<6UgrE7pJ+ITh|8G6!iU~-zQ4M6b`5R@EBDtrR!JjcX@L2)3 z|J!lR8MFU8=8Sa3NDmUo5bl6$0^9Gl;8Zcegdo6u{$gs!ENw)v)HWzLuu$q(c9?l`-)A>^sc0s;! zy7QELGB>0P{RMg)=0ShI^e$9Re^$Oogr|%D7zo&ov&dEml?Sq#iTf^(&b9yd5wk%O zwuUqq#9IyD{?iESF%QR_|LuHpc`O~Dq5NLC2Gy6p2OV_G-h$;3Gth1`I4>eKP{w@rb;SMqM2Uo0u9iL&G@y= zv6Ya4Rj>tt%IUqcw6{Iu@}eD!9&46)%K?*4a-ExL`4!v% zPW6u4oAT-Srr(#wcG?y0VjLYED?^V$4yFY|g~j8!x?T&bfH=koJolLHNwvNLy#aII zv3EX8!>PbI_^gbVSRU;SKtc^w*ew84^V}j^()}%PR1QF>A%I<66|^V@_L;Q72SCR3 zasOF1gc0Ak&j`BLS7Zzi9RHxcPiC*ai;-boe^(k4GGxKF%aB|UZ{#|{gD|c4D}V9w z<&S!QPixUTPW{^G;mUh~Pggko9=N-g4_7(0TPG>ryLT~OE2E-YS_@>yy$b+E{U!Y3 z9>_p#yVCrB3Hz^o<^56TBa;n;cY^T3UoURObY9w*u~xPpxT*2c1sIG!KR%=g)cnTG zZ3>kk&js@l_ykHTxVN61rWw4%0yDcBs=fHpC7NyT|7RJM`ACi=Zs@_kz-#kqjA{L+ z{1G08Z}CAJbN8OopHSS1Xn@lbg_qf6jGnR5v%q4`1cJ=QnrrwH0BT^%XFb7RQ=bW_ zexP4PaS z{EZg+rvLKS<5%Cnn}5HP8`Q8t)}kyZ=g7%;76?sk7|$-}HUBO}z3gZ``-s*MY`Wrj z^FK7*ajzV}b!fkeA)4~eD{gvoB%D}lg-#B(>BUlhNEqyqEhW7q%sMGI`#NLGv zQ-U_%NDO2|zAO_K3&1vHI2+-5sUlyFtw;zO%u10a;qW#z+JV#~w+*mLnAuD_)bBSt zWQ3=We{%un>+$>fvGWC#(HRug7Xk|ZnG)v9?MN!n%NCcs=NN%|dc2DuyXHQ{${phh74uQ5#v&jf2c%-|kip(;XF^liAp%Pk)wt}Y4yN`s#zgNGnqZ6C2n^^>mX(~I(6A)4P z1z7=i;ii=kjg^eW_De;}|#^5zJ^b>Q$|KX(8)%MW_;yPtomj(hy>xVSXlkUo*l2n^ZF^V5U8 zEPyR~LMW4atCu3+UD~wSkBsCw5#}c4{U;e@JSmG}afyV&o|ITu177ROn^Q57&z}8Z z?89y^4&^5C>H&J9`5N$b86!tvp&46^OcZ#QeZaJ z)D+VANNFR$#3U7XMs|>yX`xW>+G1HCW-$$THTnHT(Xo)ge??_($Xc&L;Epdhg#375 z?C|Z45+(0{dj)yOK*Sk(?f74{MMeB_dvm#_6}CD&8mnmn3(cGegArYIl^Wv$-P&Sf z!K530y4wKpY)7Fmd4K_N0FU1BN71Xv!g?!^d)2NHZ~XxL9>AWvL6Dt)FIPPkWLrLq zgEKqM4dg&Hdqz*b7vRj0a+}t8pcV_L z5VcC=3YX3fX;l2KW0}PZ=XeWq^AdoUvSd=h{*~fz_n~+417O>7hdWc7Cu;yjR=ZGI zCuY@h3PPcK&HvrS+^RcUt~&&9U+4E1^TM~Y=f=$`NwZq^HaEOMh6GiLAseEv>3=1l6Z7PWG}*A&pr~>%~KY@ zqtb9u;Ek!hygCm!M#r(*s>!dg=HS9KcO@mIN+t;a#xJWKDUtQKs}g@;U6VIr#%L1l ziCOKnD3}#sR~ar}e($?7etcFT|NMAQniNf7*+yJb^|z`adZE%j@f@494e+3D?d8_( z+EMPs3U^<~?y3*tmZ(u20B$qL*A@m6N%CH51A)q#GNVQ{8CYr#dsD-_TVSszyK}8r z7tVWB1D_)Qmu6TbEKJ&G@wH3Crja0EPwz>AI02OnQaI|gL7^-O*Q}IQNo+1~bz2uf zU(QtrMh)QMklVn`21nol(iOzsRt_){*bwBivVoUcP4}`I1@UxKgnNWFG>{2cuqMfX z4SRK~AQGIg!yRKSbu7~_K1*2rZ6GL;aPBdq1|R`}p!{)8q?ZhWz!?iI&-Lb}30WzB zYn3z#LLM45`fBp+gVZ6+_;ci60Dmw=3dKqC&wqNo;J*Sq-0>#|jd=DSJAbEI0XOR|IEC29&s!v0`hjEHf9QTMu~GPuB9sY*C5fDw0@m#r5N!x@Y}xx? zss_NLm*h_u5)cp&mn;;eD z?ln`a1Nc$y=N0Q3h$EiDlDtEV3r0+#kAwd4{o; zev_yBtWT`I266PCZkd(u#8h+f*XM3{0G^31~@uWosVeFoqq za7hWpLXFc{-|Z*@7>#j8pV`Q{%jwI|{;E-Fhs`qe`K)Hfc76UPbqy zzm#jV4j+{^u*tPA@U)7Btq(CEM%G}InY}pu4LXBb5P3$J*4mB&+FmD1)&wLFoH3b6 z2H+AX_(1gFxBBP>5=Q+*yTuOxKg<#?8EIk;kKM@MIs(SPspHCkH8a*R&A*UsZxZy&=>aU z57{6%R+i#gZrn1x!&iA&H*|?*^=gZx7#R;W{~~+_8a;!$)CRHy-k7J{C~zbyzh^5^ z&Gfi4*5{&_ByU1`a~(9?Zegs#K%;EzNn!ic)}IkjOqzi3N){Xz`56Ov&N;y8^TZ@} z+`wGdYwQKviPCpQmKGL**C#FmA~cuUd7dhVK6RR_w>e`HHCu9n?ud!e(!QviMy)jP zg4zrh!0`dg6bf~QJo{``V5#l}ExQ&72|p!#ojq|w6tQGD0xa&eE62f9LfxP(#IbyL zYCG85?Aw^{^Iq?gpznANK8GR<&J}jtYs8{Q`Q|&ZgOw;wPciF3PCVTAda}ymGSF6{ zPP$iZt@JRKLD0fE;C3?rsR!p?=dp0>By311OMOlga|AdJPLZ+onvqe_ zzkdzb+FeGdxIz^eWl#&@2#RX*+fO=!i9t;P)Cj042jKA>CmI{Tc?1IDSX!CMn+pWY z$jFIIS^xVWddap3T)NZ3n5E8_8^;sNJf99K3vQyBPPnc8Ml^sx0>CMH4P_VGRJZQ9N%a&j~@FvtbU=Kx5#wwdVn@85re zsA3Zn2LO%&w`=I&PzZR?+_!I)<7L;LkB1%|L|Cr$=0=rP|2hklxv;3{F2Fbi^z1Fv z)Sdx`$Lsa%Pw6-g1sAVfbrt`Eg6uy+dLO-=$Lfq<@#?+@u#x)gTz_e%{7{o61_00e zT^UjaI&?ji{_D1&IHrAv)nemsJI8`v=w8yiaLoR%mx7g#znq0)wKGlQpu}f$u2+SQ zS?pV2)hzw_55Pn%{QUG3!V*9r_O7_N6C!=rULEW^ZG6iC0ZK+wu|-Mf(tzHWjF*sf zJ6nonDQ4n8x4>zj=@k~sY)San%5kUTQBnn6ufa!QI5G5Kb|;qL50 zi6}PjD%{i_p#Fcx>ImWU_26K%0h#;&frtjnqFN*Ah8u(H%BLBaks`7sh+OsBfNyW+ zHaluj%~~LU@CI~c5r}lp#OsZ{Rigoj401NZGY%LWXZyRHo)IFLGRGv;nN-&qPyGq$cFqP8)hGy~9g zk}vhu)kAcVkx$QY$QR!<$e#lR5}J%{2m9Ltz)_yDKE<9B6LT5Vp1@id--FI=pa_G; zik3^A?}oJ+(AzYnrw& z-@!SZv2NxCEpd2fb}QN)`W)JkUToL3m=mElk|(K$ado;Gk~ttuyVMrebCKwF3O&S@ zXbV!aw@{(YiKA=DlZ?YS&vUGjZ@_JGq1!+>{=I6z0+6HfDtxWN(Zg$iT!q-6)}&pC zL`H)DYx@P~zS0_Xy0ayg6`Dx(EoiW?b=!LoE0|W=-^)}K;N#OLVd383fh|O`xNs(% z-~htB2f?EsC^)HdosfS@zpLfU*v|3n!<#pXK+DNvz7r)Np-LB`JQ+qPo2+&iFv~@; zNc=JEtew7c%jh*bsSjEPg!fK>_Nv#Ri=fV-ZNJivsSX2WoEp%77XVy@)8l@)#<0i& zcHw0N#O?tz2ZbQQ7lI;0%#@J2u|kxb;1JHBrG#4;6+!J?X%0LaoVjL%ex%cN@Nj?TV8Lp1aotMBBo?eAO=|D*&k3Xa0sY4@m#bg z0i*zAnzb`&PSn=0ET|DvHLZQ24fZcaKav+fIe%(S`00W&OYCSl%9^*U=#*z)aKg>VAK5;@8L;z_6-N zq^okP%@kl#MG+1ji27$D!3q^g~;tiVYwH)8%v`mG}fh-0Fpe@R0cvT05e7~ zi#xvud1p+w2g1F6^+#4-5MVsv6k2&rRKw?t9JqIjBVYz9=CIO#d7V2qoT* zxp5Yhs)IxahVKAL1V~R|9R~E%3~d*IF;Am!Jqf#@3eFveo1l4A50VI&O=t8mQwEYx zL#uz~Ycx>3Ck%#h1J$z7_s{M!|4ox{rA+~wDip_;T=@X>P}KCl7GwPdKYak8MVNB4 zlNGBHfWRWuxnj2Y-5K>TpeqDko=W3rfl5O4BxKIPU|XvOjP1~XldWa{4cM`uM;sYM zxBAu9bF`JaTm*>UPZg#AXu@V=sInB~ES?opFqpn2DDvYAje?3$VLwf*K+!6YBdj3e zxLg$m)1&tMZ|<0DF$?_3l@Qz&MiRJSl|c;+s6FCtkxT@7r~^&b@+cuM7$bk#ighI& mL*y<=`c7WG4ND*&QC#;N-F3}K{s)!cBh++NOO+oz`F{Y==@bwE literal 0 HcmV?d00001 diff --git a/matita/icons/matita_medium.png b/matita/icons/matita_medium.png new file mode 100644 index 0000000000000000000000000000000000000000..335688af2fcb78e03fa2fe3daf54a42e44ffe55b GIT binary patch literal 12270 zcmZ`DALwb35-|{AU|^7H!_^JJ^ArXKCI$f>_-lZU7yN^P zhrFkyj`8pIx3Hr;1H3}$2{-ov&+z{qnnRD2FffF@wAEFN1Lybif&w8k+11Ot)14St zggB~Lk?!4M@-j~NDol0R%xf}IZSnCLEqZG?{c}!Y*&}&F4oH2Z?E-vd=(~W;?9U{G zNNw#Pahnvy6+hQQ&iZQWi0)2UHDUOyh&1b%{Z~DTAWr4Ds36I7)bCX zXA#@6c&G2a0E~fRzvoa28@0WB?O?~18b#n1!in{Tv71jlBAC7=$dje=hEBGd8OC31 zIf-F~P4siHQf!5RKTcpC7D6A3!3Rsfp?2>gdvUJc(2;BscUkl*+4?PA2=jMFxttrh z7HU!lHnGP#cQ+r`6*TonJSx;G#9@5_UmcwPm!x9Vbmyv^{y4V*Q#bJZsb8Y7>MrpH zC(A6F=pk-0#vX-AxhAU};Sq*NPng1mk}szxOCVt&3w!L?m?&i+K{M?qb%IYcG{;9Q znEBZL3&M8#JGe>sKd|a3ICh^?q)d$lG%#M}-^dxa-2CIUV^ozmAa}6MTVKR$*W9}J z_>5vwGum^p1wW0#^Is&M0HKb9!E=M4H=ifqK5=o~rU*y*_Y z7z3D1*lLs)cNvb87CZ-@j>i4`LE9}HnbM(9uncdqwfYt{{%;~|#9jbdQ{D6NunEfp zWGtVtt(tSHiedj(aDtWOZ%R{ZF%b@!zi^GW!TtOk&DsVpQU7n$8i}GOW!w z>U%89qZd!+yS9{IRahTgl#`7$w)EUpN{$rY)nVPo>%<<>`fkLCoVW~+;81t*WMs3hybCAnUd($s7)znma$}Sjwr7yIts3E3tZ;?v{jY;Zowkg` zE5lNbZ)TZdQN-ibp-PAQdCo=4jiyaQRw>qG9zi{)?smzONdi$WjoiHSuXEhT~tzxQC9v6L9^-)R24@ybmQiJ$x3EtXd(=pZg%%;(ZAR66i=?7R;vQ< zFHM@~1myj^@O0>tu1c&ZiqJ{<#jr5SK$=;Pe{IhQzIKsS6?S~#;$Ye6!b+JBA3Xap zjp4!hXEx?Myd2Xf!UOYW@w4QelISSCrQ)rk8f>z^0~%(}4tYh^WhGZ`irOqFA? zKXXVMH&9RIrQbNWclfSNeKM4U@j;mSpy?6yiY>+YfgIrpjrxpAb?F}db<UR|s5GfJ&4CkE~$U5X09)3xab1E|8~qFZ$8_u&dzOHK~GkmV?QN%l1wk9f5{!QCV5RjwntHe*942Q${+YB=tRCZLn*m|{jeSqb`++^?;SI#=ne#Iln{v=go$sOgUfBXOcdQn!b=KnYzleII{(W zA*H#Qnur>_VCwgFQ&X-A354N=)Z!;*=n^Sb83$e%sVgog1|zajDsGNlG05gnGhAUp zm`60}8nT13tR~KirFedqH;z>M$EycRo~888hVO(srQw7!&&9?j#GSwN zyRe&lsq-zBFMTC#e^ER(K1E?(a_}IcnnQD?BRlVaF!(Ix7}--?w2huYSXBUCl~&m_)@G6j91O!So*g;9hPM_G-+3$uoI2FYfB zR#~8AYWKJA!;+fGi?5#FwCaUUQ5a>$&URI^slSeOc~O9EgQt1vxnF$j&V-))Ti$r* z6XI{IkJJcJyHBa{3Zh#=eSEtqj$V9Tk@&N9ec1g$^P%U*VgBNAj-OFa2HgtRPcZf4 zH1E6l30sP*3b4-pyOv~TeT5>pJ82o<%UoOWOLm1k?(rIJUhdZ2ZmvG;q9(mf#w4v>8N}ta>rW<>5s`NBbcY57Q{M?#6OquLPlk3i< zey+H2Sc>!FtU#Y{v1y;;)4spIG|oecvBJ01I!Lti;RP!Tu#)^#w+JiN;j*Svmr+hI$bF!RSQ{TbyMwlAXF!zpqYjiBLK$_jKB={6BAErQJ-I77N<+gaWGuzsawX9aP{qymc zmkJ7dZOiV;`kdB@gRw5rWE?CNB;?7Y9J0r@+aCOek+af8@?w$7Z7(OCy21oyG~CoA z%W+dmlpGo!MsI<5&C~%!vtOvEwObpK8PZ_kw)9N;&KM4-O=qpryS^ z6@4(~R^jV%2lhX+@j`=-RDE58#n|NOCPQB(1wJUIAdDENyw|r}{Oh+B5r=;>c^VdL zq$eYE?O|KA3-<+ktA|HQmhGsuGA$9#7D6;CRnP*_W_cxpdyVKCAuLK5f(ard$48SutC3 zim?`VK8td!YQNSj(WNk%&1%QK)#h;!esL|Mqp~J-Zx0z;qr}l}HtBA|9v)JqIZE|P zFh_wKkMgR2^{MBcSL4h4wfVa<7ACfFjaheD*uV1RUN!x;Cs%$yW*{SNcA9CHCHBno zo!rxcGo)Xo4`;E;uT7S|HD9T^0X}Z3cy*36IM@I8L?y??mRWwe=T4uGRH=ILI@#mi z3U_)Tk^nhys+lq7tTJN!&$;hU@zV`|$8?eI1hc9Dit#3fU%14`pkHtQQid-n0`B`;;Jt zu=Kd@XP%|xN292c2rer5&OV*j5q}A5Ws`W=^rg+y;Jsvmrhg(1!~=;$sLCUfR~Cgd zsI<+*DQj~k|LFZ)eg;WZpAs}(3Gnsh)`fNT&Ba{V!ZEeE^2GAb(GpmfT78W@-fSlL zw&x9u@W9SQt+l=cim?ZF$~7cj;{ohTZbcoxJ|{^l;XSixe;Sk8q?&-2ZwPTL>PH@5 z4Zm(xGckd18(!2)+|e+20Kv@})wHx^Bv>usPk8ptO~d4yrA&aEKro-n35r3N&{Vk_2kJokI7gkh!Z}y6M`4UoGJQDg|*T+Zv+qZ8eWel=3 z?>Q5SJ@+yLf7u@{br_h~OJRP)F*Y^TeE5*P>B%CpI|5TeN^0u+_mL{|y6tb32v!r5 zt5*hx)6=F;mfE%5+$wgEa>1v(<@yB&DOoRK^z|K2nxPPN+L;SQTz;EU_!fWNP2cGIZ2w$2Q{P!<7`&`Pt%8+rc@|P~YHrJ=vPk8;cxP1Zy&QURJSKnW zIb$6#S&68IAtbj`Rf(|WeAskh%hx}oJMN_J)!N(JGoy{o%szn$+}Cf%kvD|1CzWF{ z$a*_8SvMcN5_8nSN2J%LQ}dNjsO!VDQdmlxn_q?9{HgWZGo40T@6lqqZY3rr+OH41 z*tgPNQzzn!-qwMIUY$GcO}{6@KWQZ1A~Y)3+l1QwCOYiALi=({m!zr^=)&gj-uO4vh*c8peK+g9O=StDZ-@JG^KmIpWk-OxFp)uo zu)H;VN^h<%v>xN>6Ah93-Yp!>k(NgmKG^T|i^=Q>*~$yxkcy%W3;3qqO7)=Hren6= zHG}g7vmRN=;OWkn-zQmJBO!+!v}v{JkaTk2Em#^C+Y9*kiZ=W22%f@(1R^ae6`#U} zM>FXe8Pu7#iKG-Ncd-;AeAscp60qn;3veM)DBV?kY4HFvkI)5V4;g-fI;LxL+tf=w zBaQ*o)7HJn&jZauf+D|i?s{yIOeV{iXv z$MTM}wDgzRS(o|Dev2D^DD?M6hJN$Y-(m&^232OY&;0hLMT1XWii?ZizJD*daeXJT z-|Oe=*9>2F-D}O>zI#_xS{n1`PjE$LrQ%=oH#f(#-EZy31B?&|M8tK9t9p3x`}d#C zGfv9(@87>y3Z1#j?wa#CXB0%u021@+6`fiei3RP!zzfEgnVH@@Q{2I4yZs*=hd+&u zI$j>Fs%vQ(85$y8LIG%OjThjnuRE5dj^!)fGcln-RNIukefz2M@M3=FElcwg3bH;(}q~f6mpJ*Ex}b#g{2fSTF>EoGr_j78OnV`qem=oOLX#^OU=~)1$${)z$Uk z=xa%16BAMI4S03**RNlrzqxU9a(+A&vN25eIGp$;D<;*(y4QL=zq~cQL~d+g&{Jza z$ji&?$wfI`Z95L8!6zul&CgG?-*4$u$FM>AqBod5<=+&lAD->Y-C91+c$D)Z8dUY3$PsD6Bh)PIIY}v{W z!LsJ+DpquqiiVEjAKd+9t<4C3UsbgM*gaRq>seo)I!o|2`|WVEwf3bE&nVojcB06Y zRsa)_KoQ=d^LlK^Qa>E?suJBr&%76*KWA&nuo%Rhl79B$iV_kMK3;0i2Iw7=2W=sG zM;b_J7Ux;o4x=4YjQ8A|76kCY%g4vg&K_AEezW&@wnjzn0fFdk^v3cQ#!$VO7v+aC zy(lR#MnrRZ$Snxi4<@I*e946i>1}p8l0XnWC&|Au+J4<5zKD{eegHPr%gbxy$B&bn z!|;NkjJv}^Rs`ZcKSs!E4d1?*$z|1YIGVOkhx+jpQs31}O-=2d={%R5es8IzrWTbH z)r+BsAUf+{K8@bU?-3tCwNg)j#eM=iK_~r$=}uxyiqaq64dG_>!WYn(dwA7#7;1^A z>4$}2aqxTggM)*=R-(v1gxv&#%H8s0ZDHYUhr{99D>_B@omHpA0*NE~VV%l)KUxdN ztYKiH3P;`8WccZeO-EY8E6fUkA{+LlXhWO92x(8JqbHZaR2@ROZ4pvWzJK~J`Wyru zUZoHATLZYc1f$AdK!f&m@(JK_4;V`9^yU;@_rD2x!COWF-<)# zF>$@p_J$wu(@U&$8DuHg4g+Ij$cI|P0M!rdx!c^)&>Lq&mjEu;aZI+jbE8iw?5FdL zkwW$zPZCP#d+a4FIbY-%j_>uQS2C;e0mZ~^IF!TMA*m(UXfz;@5s)m{)?C%c>ToGL z{3BX*ylOR;R&mVt=5+(Bu%g+|@DckTBiXmRGO5KX`t8E%^EK=VqV_`L@2+m{wnS4 z%wJnW8tv^q3SEpTA>5YC#cE{@q>_oJQ!~^oDfc-(b+rlp?f8YCFP>?BejZ3hB2d4p zpVBy!58OrG5V}$vxkqEW_wT^aSl+1_X+4W`bM2RFiIkfYh$<3FXOhT5BT-fNBPeDe64N^clG z5&BwlJ%l5X$meE!ba_Kl8N!3EwNu&RVo`TRNdOi}1#@u;nzqWz=P=9re=-C21(5!D zv5ke0aK3G7xVoKc`wzSq5`Z9TJg`oQ+4!_V%FI8A;)+cJBH}B3I}5S4iOF-QwL+*x zYkHrE(|GmFzZHk7529?Q+F^J5@1#yWOjCnmD=V zh8;dWKJtA!OVi(yW?E$~+Z!{BD-r$LiZ%Kg264#=NHaHn;r1geP;p$6lHZ_v4Reok z6@sWh`Kziv(?^}*Y8bplqknvF@hR)-{DQ3YJoqk)vAegY8_L)Z5WCrH9S_LBt)tbC zWz%h-zNV%OK}yw_DR}I?H-%n&_aXP_x{)dfJ*Vf?Ogg%J?Mg^wYqYII$fv{;TfgB@ z{q>Ovgyof3jP1|4k3Hnd8#$Iu!Dn`}kEPJoZ3Eqr*t+4$;D#Ikh)5VDKE3pDGZVNo zxaW;W%HU9u3M8&J9A2njpj0+(X#jD1^yv3mqA;C=ODaOu5E3K#X!@uJpY>?yZh;6; zgh0q{9$%Q4oVC=Rn!|5G&U&HL#*nhbF!_wc50e%^o7#(V>c(@Zo+VVhvwe)5+lRI@r*b#n(sD%?ES8*;>I>hrfotU=@od zJU9C<^MF1b`4527DaRlb?2-5IJf^tD^5nQd$6>sVMW#f&;*>{dDPz*8zWfUtKa9~xYUocjr_M8ct z8lp2nFtmue9S{NpI2E7`sXZtxXP@Gws&^99(MisV@1+#~%V@j<^akfmWV{L=mx+mX z&3KQzkzwyxo_uL4SFDJ~k^-2?K_aviGbd6JX7hk(h!Q%twX(TzL6U_`zhoRm-L`Zu zP*%97*eld_Mh}Px=f_F1Ks4Z1*6$MM$XvU5?4(s;&m&OX0g-Ad(A!B$2iDj(MhVM% z=x|xD%AtLa*EBBv>1hzSkRNfbh}2+Rl6gX0qFCBr^dhJ3iV7v8GVc0-1UTPc0Gp_R zZ2C~{;j+CGH0l6WH1b;V-a@vChRlR!E|y$0#l(8IXyLcBE2aG#YjdNIlZmvtl~q7@ zfS$ec<|^o7F<@t=y5L>T_N^@XdmZ%4w%n!GbF~*21K4b?yF7oK$MbJ(D}WhF*GFnb zd)BtL;{a4@<{p5(a+Xg6!!pL1(b z?-iKHJvhN}ezSMXF*T1TuqSfm2;&2o;kM|x(a)3xbG|Dx&XX>Tx9(4n{jPYmZTh5|8U<%d%6Vx9tYkDK|!wnT>C`d&2GU@W0{!6*&MOI0L7k%Az4*WaK`uDL|iv*-UUB$D48}_6gxTs}GF{ z=e}N|ZT^R3zFu7H&nhacT7Bbf|NWU6DNrsb_;RAY|Uxo>8 zV)9rjCuF99Y&H@uHKIn+>#q%$O|Pin>Kpj*^u%FR$Gan49Up;jQDcXxd^I-?U7C~cPaz-XXNm=gOgeeV|K(&9qt@w0d7u9@2R9!8dShs0giB7YwT|u+HKdU6 zQ(btgZ)vIz7wITUCouthg3f|!Rl4idYJ5Xw1#coq#W_8)wEx&Ws>()xyg1 z;%?3=5ufAYk41Xh4pD0%<>1xNugp#5QftF6V9t8jY?^ak5T zOv&UJU6-0oJ| zt%i2TUn8H@6VK4RhPtcu=~TzO;8eNFUIp7B01Ud#o$>;w)!rB~e2W%u$G0Gs7FG3> za56@)XK0Dw3AP;_o;R`+(CYSHzyZJwbNrObUS-vi&aM`V6U_8!*@eD+D-!qNCY*t= zwpO4(BHkz_W(sv5mKZ64|7Vpv91c1dC<5)U`5E=yf5E*cbKsnomF?XBQqN2_J=Wf8 z$dSzE-`^W->#7Rosow&%2!;@^Q_WX)_`$J~+fDp@QQoDqf;cvdBW<%xipzV9LUEAsVK;?NEk_ zInF=H1}YWBuL2YL`XHdo9<2L%1z)+awl<9hY8o9vvLV_jYZxK)^4SfFbz(n%ect9< z#&c3?pQE2`b$@ns(k?xD6I3-caJ&B991e|-Z*2@^>@)H5@C^7FX>?h?f!RE=9pBGL zeQjy^&h;_muB7WdOPaSHPs$o=)1-1n*MC_E-Z@}ad>tONPHGc+W^(Iifxc4VkC4nV zfq{|HdZ2i;IS{n_p^CTNwAcZ%)(lvO-tAMHqteSI6%`4Q*!UkjS5==!SXf#DfAje2 zH;qP7OH1~TA5IL6jHK1odqE~9r40=WwEEj?8L1VF3^E9Vhi=0UjZDx>?eX7`>_T$$ zm4{_K++JE14El;U67=-+;P@%1q1+GXCqOuCqN0;uZw=0|0%da8qeqoRs#D0@I`jb$2jq4i=$mfOA%M^Ly*=p5QShT`zgs8wEV!~l2RK;z%V*l~ciP%XL!Wz* zYf!!VU*FU6^^lLN5L*ov0uuH0N52$9-oAZnHIW87HZWdX8F!%xsvyCD8SLQX^!ksOyom`P zKmW0H1)O;`Oj_Pr9%T7VXo!#t*~@|geQj+*fKvjtow-0(Qc+W{ zZ}-N02}v7a<6t73uSW34!w{`uH*(_&zep1A2(HE7%`a?h%-kH#s`K8|IcQ!dD}M7v zEmX=M7EhpsRSwl18*@7Cj#TQ`DFX0udrXHcOi!l*vO-?wLG-A)NOYVR7X=})d!w4R z3TDW~!Tzym6l!m#`WL{?4=$4&ofjR4vP>@DDomJ};6!h?)RQcRXeP=n_{0)QNA)Y}^YC!cLCcm|d!Sbn8JB2&oDY}Fp^og% z4m&mUU4@Q@M$E^^+k-8Iz?yZM3*Z+sQSQJQ=9>+9`*ct!lmciR1uW|04xetxe{c0m zbR5pC4L)*K+9;B1X{fVxB_z|y*xvRMNnPSL!jr&656I?D0NHCmz&dcE_ zmV66+>f7kPFaRbV0s&j``30jikTGk0grLTOwH*s*Z&{H;pC*EKxM9ZT*BpwUpMSP3 zKo~4xy)T}+m5eKcU^NPoPK-vs%*a1@MSn1=$%e+_=jF9q>5ddI{}2sy#}FNFQkv=% z`;d~jl}{*rV>C}d?(I(rj?w=YCIJKcx79gN|P}E zO0{JqkIEqY&(Irw%ftZRFj&*=}szKFYH&D?)fZlw^a?hZ5}@UI-OR zyTm5$_44OrdCbWKC%^q12O)d$1?54i-CD~Qb^+!`tWZj>$jyJ)pNpq{V}B93{T4o@ nuZEegk%yCSz(a3G3?mN*S5NSGxlTI)-o((>&{IdN+CBRp>Ww$1 literal 0 HcmV?d00001 diff --git a/matita/icons/matita_small.png b/matita/icons/matita_small.png new file mode 100644 index 0000000000000000000000000000000000000000..cfb017b0f220319617cfd8a4236b19e097be346e GIT binary patch literal 4786 zcmV;j5>4%iP)y4h*a%<6aSC4?KjPTN`07$|s*W!2qi6+q*WuTWmLxb&%jY2DBr692Z2+v0PhFNfUg6Uz_arGF`2GTTbg{pMwz!t z`M)9a@dIGgEqMXpS7oA$flq;Bz@Gp&$(PQTi3$S02Ye6M4qQSg=Qc!j`6lqLE$#)9 zoW~@|eZT;sU0VTM1zwcoHOM&gWZNIl&9m0CxhHfqvj4;OD>tz!G3Ha9(D1kNp0wR7Vx?noQ&$ z+TzUv{!)_r8L&$hMhQ?aRd-olL%wIFBqa=d0IZkSRwAmg9pAU9%Z{gje@v0rQsBqH zpUJ|pqZVjG)I>)(DK8>3ry#0Gr40A5BnpID&P$T-0sb7J7^}TH3T#8D*uqAH;;sTu z1N$ar!Y>K8a7lib$?N05Cz41fC@HS1q;4x8kl)`UxeZ@H>JBO%v738)5Y@z<(3t!_ zizr!pL$5o;cL$<$4*_pZy0=E&Gaa6@r$Zxm(133M2XOBERv^qHGgSoX$g>cW2Z^QDFTYnJ zswjxk|7}FaU^+Zw|KDdzuS&8C6;i9j>3S3x!MRP_glK!OOou!b7?T7#5oD%#!G!$Y z0(=`-giz=u;Fp2F27VX#2jH&|X3s~6s{3t3Z*O5hzJC>>S9}`ySKwO?1TAn#O9;^^ zS?zm)45!O9ZAY~07V3dN0CpqV*>oeDlvsi2I8GyMJUhI=Pl0O)%YHH%o0{njm$><@q! z5ccP9$$Le>-^%y>F~Xkxi7c1^@Iypz`~t$1NkFO|3Pew{L1y#=Nre5mdKuwKU@!&w zs}a@XIM)@r3iz5N=e&$NBuUzUurGTM&4JbNcx8dCl<7DJe2l0S7CbWE3i<2>+r1j# zcKMD^fD>HrBzy?tcqO75AGJNZ2vLQ@zK`t%!*}^vv z=0|^;Fbbmc+9v<*$;FGOGM_isa1k+y@d?SJAO&IU-Y)-sSBA?8z6j)fiWoQ70w2n2 zPNbbBd2Vr9_#%*JA|^raLfC%QTqms!VH3^>oQ&jUnx?IrZARQeRaJCdR}910s;a6- zRn-NiX&yl+Ez0#t&}l)}^$$s$eNK+l>-9c%*Ijr0eMw0PhLKw3ilSf`1``t#`2Bt| zK~WSUkqC;Ske8Q-X_^_I35Ubv=jS`dr6>xzuG81o$H>SCrKP3ng$oxv>({T3YMQ2- zrkQr!K0ZE<&*wu`)wF3*Rh5B(0S+8E@N^^+`4{`Wq-v{anp#y=<*lfwa7EtO*ckKX z%_9>OMIjsxqpB)CpU)L}*REYlhwwMP9nJ zTX7c_7P=y@u&@wK(~=4!i9FLZF$@F4Fw#b94`&z#ijux&Sm6OOWo&Z%7HP3qjLVlV zGc+_rU0oedKKUf|_4TN#%CTd|*t&Hq2M->kq@)Co$KxvQOi0JYobNC!h1*HnxpQZn zGz+?}vuf2UMn^|Eefl)ZmMwEtsMEomBhNI=xY7*6ptrY|t5>g5UtiBN&pbn2U0nic zcBraKQ&SU%4<9BPjiy!K7m7TKG*wlJ#bWgJ_0ikg%cf16GLmM&FbryHYS_4OBWKT^ zopJTeI(bf{4Gj%ZTU*P64?aj^Vwy< zD^pU z)YjH!Y}2wqFc?fwpBuX}Tcjkqq^_`$heIBOU+JUq<0b?azqYDyq& zwh;^lX=rHRFWICA6&(P%Vh>h~a) z9h^WcgZ*(P(yZR|^5x51y?T{Zt5&gN#|~<1YiD!@W4f5EzFd(9VlBzzh}A?1-Jla` zR`uMqYZs-ZrIeSKXZzmI9ah_CsV^4=ZIKs7sP7J^mrf>a`}XauS+fR!%a<>^vX|xp zYHDg|XlUT{>C-G+xNzF>*}I-&h;_%MfT1XgYA0>|`t|WP%_1rmbFFP zewzw;Vc>+KD9;;)VfOU&Ff=rjK-y&3Z96w`Yd_kmV>bLY;fx8Hs{k38}St5>f^(=g?z6mp>3kR(!sFf$jYdP8Hf`d$=bnoX*i%(c zUDsVZfUNM~&H-c?2D+}J>$)q`#~RMLiMzVGnhhH^aQ^&xs;a8eK9jDnJ&1i-8xbom z5BfbG?X#07e?Tvy00P@RR7$%V3;OrD=Yc9wUwUUUe^h_(V!>_+qP{Z6ben* z?n`b=Op`*tpXI8`{+5;*nSq@PFbpFr^*O<@CH^w0uc@hN%Ib3@&ooU6{C;XQ?F+BI z<;$0|dGqEesZUK8aeYO_7hZkVjLTHim)3wP{1T`Sn6moPl4qFamri}w8bVjkrMh8~ z*!I2A+>Bwfy{7U3ruF>b_cj|(hLj?5DtgqQ)HRY-`}6$Q&AL!+its! z*49=6fk1rBo0aQP1?K1Hv#_ubU5@!m=FOvSc$j1Fzt5vjJP{A8>pF^}P*zsvO6p#( z*Y)ts8Z(!bmAM+*78e)e_xmX;E6W(x8UvS=l_gBcmzI{&*x1O)lP9UJuEsD7R8>tm zb>)~URZ&nC1x;1aWWv{0R`N+l2fddrp=lbLrlG28{BJiO%QcwIGcy_Yv(VT>R z%o~YB(uQ^IBm6R|&+2(o!8Lht^;K4KrnQyso}M}9pUo94^@YP>qS0u|a9QQvG))S8 zK7x69>~CqA?L5vX?CMLofIOQB6WYGkRyw=7ZU~p-R4}>iOEr_66)g3w$jjr6=H@Rf zc_7qx>#esswS9|$yOYV2HeRZa-R?Wr-kz2EEPKigvRPhc5AO!n3W!W;Q51#k+qV;m zM9gS3Y9iM2d=vO}AeuD7&<%snGnZdDW zl-T$U%GUOy?gi4+S-cG z=i}y^Z#K@JJ?oFfVl~)S(I&ggO%p?Y(z@diRlK&moQ^|>=-j%MWlNW)O|a$kb_4rr z_-vfsZeUFe=(?V;VxYUbJ5HLWX;f5HP*6}ncXzj9n&$h6Ll@5=PdA$O8dIz1-QV2I zV^2PLL-oG)>S-r!*|KH${r)(~a^v$w#BoV$5sRXxPo80#)KygQdV4!v_uiXPeRBa; zZ`@)t8f{;ksem5bEph?xv-sg|@afB9REeV37R${7j@xMjPVP+*3JQS3j54*VWa< z-o1NiYio;F&sZ#m*XxaUGFhaz3!%PEIU~>B_I2KSFI96ueO+B$w6wI)-rkZ>I2yqM&ISJv}|V{PN2jI&=t+$3s#GL}|j;_aHo9i(h zbkk&5y5+1_sH#d?EXIHT=tt~$_~C@`!^6X9n&!&&Xcz|l{rxG2P*%niMWM5^lij;_ z^WJ;!v1G{-mMmF<-|r_Hji#)gGqUSZ1p@i`EGQ_*I6Tu0LmUxXPyp8AZs3++kk?O~ zAoRckRM|F+cs!o0T#vf0Q(9V@M4px5&dyF+T3YDn=wNVgkm~AcR<2y>YOAYhnmO6^ zn9R1EdQx0eFU<;TE5UhwKfmDf@%Fxb32mR<#pi}RkH>?@<4MY3S63I!&CRs8x09Eb zM=%&95D3I4Ei(~f-!RHRuQ!E8CAW`sP;*AZ9WefMRpK2=re>gwXvS6}7bci(j+ zEt^d)Hw<}TQ=iWlSD#ySc6QR-+{{~Vy+t4pm~*7fIC*jPm6ylWS2TaVE7CeTI`DWr zR905TH`vW3(q^1INL1hc=4Kw)vBNRk#ful?CWlo$y$v_X_|z?VMa$sU6FU?$`xXY9~$xhQpBX<4U1f!O>`U3gg9cn8Sx8xPF`*u z@v}5Ra(Kx7Y~cR^wP#WPcJUAU0000HbVXQnQ*UN;cVTj608?*dX>f03X_Vs^&;S4c M07*qoM6N<$g4i)e%K!iX literal 0 HcmV?d00001 diff --git a/matita/icons/matita_very_small.png b/matita/icons/matita_very_small.png new file mode 100644 index 0000000000000000000000000000000000000000..5a6807126668ebc1049087effbe27523f4d964be GIT binary patch literal 3650 zcmV-I4!!Y-P)1^@s6IB1=b00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru)&Ud>4VmHF4b-RBj6}t0RJwy{C&Z_)4)5xFz`d* z3E&d&&p=7+)c_m@jsq=X&m!=bKr8U4z(FCA(|{@P7lA(nG%?-+8~}a*+y?Fd6Ttrf z4v-VlZxIZO04IUDda1bJ0LwyMegZTKqqd=A_IekabkU%cZgaMmN?hI-=sRPYagJTNV! z7!zFlN^tPULXzJDJ_G(l;Qo=o`3oQ;xcO&7Dt&@!8Q@<8b5cTWUE6B~{!TE})vBL~ zce{`V{uX%AgO>&V2^jDr#tWu+0DdhvV+(b$fy=;qg43E<>%L?NxC@*Ts;B_Zd2GuT zQnJNk0F_OcjZ0iosHiQ*8h}ne`pLgFz<^c@mO_EWJuVaca5w5VX;Q3 zb2#TI`FT+e**st{0;D3 zA?Zos6@LM|Eu4nSoH)=gqyw-5JO%6%wpJFl`La;;?*rcvHr^-pmAo$9PZc!aqEIt; zOc$FhiLtUUU>TSa4&)Y)5Oe_J}>F z#M34`c?ft{*nW>-#-b}lDS)_;;G|PGX4k2z>>0N_@y)egTg=O1-uBqKi)VV?8< zNn)+!+0Tn_iE($GdyfDA5ZWf^a6^I}aK@y^?l+a|Z3k!)4nwLlk6j{=e^4AZPzsluu&r6cD=H-s#U>FABa5!*t%d!ZCg3Y)d-+j-@$_n{> zK2oh#o3q)hoXKPs6-Ch;$MMB?&r?Sj)6>(VV`F3gXc$Ie6>*B9gmbyv;J$tPjs_i2 z(==kSSP<8!R;xrJ5$c)ahi}_9l}ZJ}Fv#U{96EG}ix)34Ha13cb947*-)~tKKxJZL zB5WAOYMXN$N2=#&{o&p5pm}$0Bm8o?jIQf+baXH>GD2@}FOK6-C=|%&^Q^3_5Rb<< z^?pA(w#=b8j)Si2=(D~MWI zS;4X_T3T8-e*8FneSJiuQQ!65-Q9F|cQZFPS0jAe5$8&3d3l+=d-pOtJWOL_BfEF+ zURSN6(I`VhL%j9YTVG3mQx98yXsX4;PI_Nu^R`G8s~-6adGL9plY6 z-$Ye^pELz|QPVWnBp8Zl)qSv0{BYx!ZQE3&78> z55IZuoIBsw*TT zE|=r(-MgC(>WXOKtXP(n^LCIN$Dvdz)m-|)g9mACZDr@qom*NlL?RK69XrPBufM)- z(jG*d4U9XE^8?GWR7sN1G>t-`Ku=E(2M->kzrUYYEJm?dT$ST(6?AoV(c0R|%*@Oq z#kry^%k%kseosE1r@g(MS6+FA{{H?NA*N|!nr5JFS(b%mS(v677$@C%Kjyf5yYKNr zJRWCwc$kwXPm)TdeDQ7DUc-2|vy`&VzC(Ia(NYUsZ^@fQ+~v` z-ZCgou7_VPm(etha=GklTYL8Gp|P=%VzIcUV(>E8%UDJ9;?p5XnvR*~S4}&1Jk{9P z=*t<~wn?Ycfs&JDnPf5%Q7ArgrMsZ@$&GU@9%j~qF|+i$;3I2>N{4$HDo z6lE3TWYH-7Frlhnb;e@mwR7jFR;$Re?E6TPwC-Hcyf=nDDt>o&H=UiGR4NtUxLBVW z$|4k09NVTbohCFt&&^Li-Bb>@RS=8Cc;ST?*4X4jxAxi+3C2G9i2L{NZ#&}LilMc& z6;0DNPh2b<#+jYv%gM=Y*+q`UVvLN8)WXuHhzm&)t&s?$zx?HzEPJ~^e}6wcJw234 zrF98hL!1MoV=?4~1#XRxud1`W^<2=i(fmeF5WaU@Q51%ThHADKM4;j&N~>16uj@oY zA)2F6E}S|=wxNMkDur#^>)N3k=M2LLjB|xTVZ(YZpU>mA=IWtPC}7(*vMkq9!KI}o zR8f?(yHU-Uj=Y!U5gkQf#mSqM8254_@uX)aTrpxR2U9zzl))!y!*{xgK(y=It!jU6K zFbu=j?$#}kWLc&wo8{`+vy>kqu6!G?ckfx#2XBoSCbz5dF>2#XI zhYznx@*kQw2WSq5xjj0HzD=dq*Vo6cUAwq{|Gw+2B0%@5P+(XV6~n-;lTb7iV&${X zxcTX)q%)boP@rjA&DewbnnAq~x06;Xl>&?5a=E-F^LJr*c$ibCPDM3M+slJ5C5koT zEZb(WSmgG?0*a3-uWA~e*HS5qoYhsO_4|>Xl`z1ZfQ_89Fc5gh z_H{$CSY&*BoHJ+6Fh4&}Lqh}EY&NJ}F>P7a)4&Wmz;eHLcs6m1Wrwt&`42x}WPxr@8vU2efx~20DnxmDKIqw|W2l_gPq2Ae+sS zPN&gz{b75iQ^2u@zMreF*5&zmKA)Ii|MSnU!Py8uXuevla{2OQu3Wjo?CdPjXwU1~oc<3hLCCcvIThRTUJLj$o zsu_ds_uRz2{(kO(U6^L&#`N@MN0dK)C68_xsNpbpZ3P^|vecPEAvbgNs$FrM>1Z@+ zxTVP|=6JrB^gCR!SY&Bw$@f!{jqq*TW_o)1vT2$XZ+LTmk)z>oDy%3GX`RfX_B9Vk zwrz*2rn$#)obHe;FBz5&8lG-%OY~|sLCG)I(YDb z^$HLES)w4S;O_w+^5CB!zEyaXPw#gCBRu#Feu4-8-{y9XbRPU)je__p>Dz?=18_pJ UYE;!ktN;K207*qoM6N<$g01Tlr2qf` literal 0 HcmV?d00001 diff --git a/matita/icons/meegg.png b/matita/icons/meegg.png new file mode 100644 index 0000000000000000000000000000000000000000..4c2be73fbb0d0528f8a0bce7452494d329bdf0d9 GIT binary patch literal 157131 zcmXVXc{J4D|Nm>oU@$R*M4>SxTZ~3T4SoWiS{e`!benh3sX?z73(w zq{4WU5fLFv#3aej=X-wloaepw+;i@^f82YY_xXH09yig#%KEX5ij&!{Lv&4Lok$|Ic``-!P6l_#l0oAWPR!r2joXPp>;3$e?h452UNV zzoHVr`Txf_k^ff|RXJ5u)K%4#)!fuCqS0u@V^cY{1d(v~lSaAVJW>Xrzi^&>rs^2*tt=12lwP58hs;MCnEu zB0f29Ww>WF;p~tn9;0+cfAy^#bdP(~W?fuv{q5@RS<4{EhWwayZ1#3kS{B|p^X2!T z`c}{1oGI1~km0wWSh#6z{+`4pW!vs&s99JSynZ8p-`=hwR2Gw-QpS zrLpuXgG%b7jz6fGDEx&^D&toU3`M-n+2~r<(jC~%K%rO>iK$f`2WXfl-A=sJZjgSu z5uVnOV~KMw%-_nqY&qd7M;(u3_jePF=S7StiN8U^0Q6{})rB(CF_qCq+i^SVEK1_-i)K&H@WW;L_ESTm-r~vkk6}d8?Smm*2%xO2>?vRNYu0)Bt+( zs3kk(bLNIF;IG*-G&Iz<)*uH`f$1?HUMiy95iAe)+Q8t#B(bETV+I`hDlVnzDeL9wN=8!$JNOa5ny#BMMdHJo_a|`NXf3e`A*q4UgVN-ES2N z_QHLzV)F+zg#myt+(2gmA}xT?NfLAwJxwPOluF6Y3Y|Mj z`MKj*{cFKa*}jh`gkd2RY=)8F9;urM{Y8Q%A6mP73?!~|%~DA(=n-uWC@`??bgM~` z3oRhsR+(mm17oaDtpllNB*Y2v`Ci2=Veyg{flQdU(Am@h#Ec^Y2?wzu)*V0ae-I;~ zNf1R+9K~K4_9S(Sdl=xxz$HCgxc!6t4S-}jGNd2&L1_4`kj5~wmx_cFQX#!U9KDIe zVH(&$42=RmGGs@xOJUdu(YjC|dhLl7i?W_%X*3+3lvrIHEDM7ywG+>j1QzT4r<9SO zpX+T=$T`f9H@gi@Du%*mg(1BNpbr73h{5~BpxW28Ah~R)m@~R)FrR?fy6d#aM=G*_ zBLTG`@QMU+gKN5u#~@rheMuzBzNJ7kU_tKFp`v5Jy~0$EM3CMU8Uhh5_>mfMLy`mq z3}FLEuz&;>FoeYX^#Y1JZn}hyguSX?@*g6VT=NV%!M-_CM*C;VR*aH$iA!7^!>=dSd8Nt z6mRj(!H^c{Jus&CZ^lrlfr>&I5TDRo==UE&52rL2Z-{Gp-TEvyOUc2`a1QwHsHzP{ zTogv3DYQF<%ZESM0c%=Ry_S2I1$>FRW^j*P`SDg#TO{;9SKLEoa2-p)!wVw~Lu;;r zyi)Mql@-K?>IrBHG?Y~mK(d9767tR07-l0krM`$JOVo6Q#+1B7?}dBq?1x24Y%w># zFg;oy1cydO+6)&>&n#VMS9yGJpng+lcGlE9r2-1U0x1wl?jLp{kv_0t5~ZPwNkHqm z;tbBCQ+m+`?!-4s{#>EZ&-LU4rHjg^ut1FtxI$}wA)m`pixjxR+J#5 zR9sUmzL)TPeuE8Eo_7P}z#-l%g`)O}u3#S)^g9JfvDw0U7vLOsWaV9~x{Ph7y3=*p6P!x-Xra{E%I_B=- zj_A%$5uwV2rGR+=RbH%1zQI+RP}*!ZAVm;ISYKzFbMWNvK#C zQmPvUX$_XZU~okL-eK8C7{KN+5}ayCJk!?U725B=S({}!7%*;D)$Z_qfI#YcMncC< zv0f!lF%TDK(nuTt(t#08$!**9?TS7Fj`wLrSs>JuLs@W=5D1U@8d#Wo>I4XkASaS| z>rk~nz3eRsaIL?iTq6Ud7hP>vTNTBK9kvKj$?)BVe;qyl9!LE%|993oYIh`uT?oqc z3;PrdcB@i_p1M1y!OuY|did*}uNoFMKlBJ{TFkvzhnvF@L{szgV!$)XVjzqEW@YBu zW%%Yn00QYoXjcZImDBWz-eBodqA%^%==Od~o{JmPTD*#{I+*1z|Dp5%2ogZS`$Y{{ zsO^tnLdqrxlwEeWIPK)PpJHfiQR~7}SaVxL?i5wYWModNO!!h^ysK1MtIsCG5fqbK zmU%(h0(W}k#mC4^JrN>8n7din06VtRA3McccTAuett&rN0;#0C zjaFB^o4c)%VCWzJu@`z1-V5}% zc%cRV%thXJx1iXx?*L(r{~CBeAIc$B0|GES{|Q`lLjqQU@rFpU4-)RC!Fj%J3&5ZO zB*2cDOM13;mkWso8}qtosq=%xV2C)C9RxQcCVYS0TDA zHQ|q6Zq1g_^+ZOOGh!95d2ZYV-IRG&`3OpO^IwYfj0fUyeU~g)u-npk;+B9c~ zS%&7Ln)3vwe$Jns{<}w;q-uz8rt^K?-v$Qjox2N0clPJ+D~r_X$HsGi#m;#%7)J1f zDo-QLHZ5NFm>)F4up?O9TqeG+>M@=Gj!8ffri7p z_%X#;eplAq;VIMyXbh(M=529x&RA8M7}gg;e7OmqOFz%243h-mc>EkUW)9EhE#S(C zO$DoHkHfI(>3Z)7Iib~Oco9lsoUuYO&z3Jy{8jX^oGd*4?1sn35a{&>peY+{Y}~rK znA;DQEQufKNj$=?Czj#3?+4gZMQM3gH73a-6b4`oP;MksznjYj z%34ahYXv?!qlodJ;lZeQ4>LngHB)iG&X1~c#mdvt^=48om#0Ct{Yyu=*EG2f(AGO9F$~1o_VUq2`~hs6{$%S=~Rjy zBaM>8#R3rHqqTaCb=dWgVNOMzQ0_ixmpY1fiDa?9AsS72QQnOz9zKys5}lvN5jlR* zF{k5Z3xDA6wqX&tO0&za?~9P(ZZ;84DkK)A^mGUp)&_&8#ew>0@K|1dclybX zkwwb_y?RgW`e)BZ^0;pG`h(pmZlcp!0fz(}Z`#F&FCsSEJ+;XSrxP8C8~{TMOjY_Q zHs2n=^uYu%-2o;f>L~JPiQAExq13x1G=3T~p&M_xhD<7{iot>Aqe0ko(;@>|QsevP zueXXi|NUG(%MgwK_Uk!V!D;68K1T^muld`(hhgXAh$$8ODx-l*op;;ha%?*mG`xyx zr6Yo%7fO=LV#Xu57#h+L*T6mrCQ|0HS#kpO@jgD z(Z_IvyXX=$T9+T^yC`v>`Cm1r4eTvF`sNW~w*tx$m3wha0EL}beFoW*_zei6``z57 zJ{R9M2*nMH@Q^^SmI6o+Lh}B12oKRG;*gt+zntRc(hzacJM}JLNz)y!Ev$4*G`L6dHP-*TqyxY9(Z+&?tg< zUMJ76*MI~7(BC3R*zLO)i{$ZHUXPFvdCLr#elK9LOaIgG>yc4OO=enETciL=&5d)r zf8kpI`Vo`^Och~&Kl`?IYVO; z(>M?lAgFRg7y+JvR@O?5Q0L;|8mWl7)DM6uiK%dSG(4Idi;4l0q}E(;?(^Z!LP&OMiQ0gRv}9sNy-VowD)q@P(~&-{mffe-T$^?tjY zmdmHuXagV-4VCO)_u5D#1P7U8-~3Uno)G>^JTxW=o-5JXId`y#K~ zciQC=8wZz@0pIdzeH(J*SWZj*!|i8hqketm3$iiGY5CIg;DFIFwy^((@z~Nwnw2%N z?^$G!9P;Layk(?z_k9k_4fBe&{Bh&q&P^U9#LXRi?|CaW@Ku-X1UIl@tC%1sU)d&9 z>1y8;sysA%r!aC;O`&SlQ3srwYYUAdr+#2$z}Ya$JnWDv51UhGKK)VWRcyD_SbU_q z3;l2PeR2DBBHx>OH(ubqwq!lJW;AQkio7$ul+ydO8eb{LDm+7DG&hGAivRultJUGX zFXwz$%gDD*2T{cz8b2TB4CN@Ks9PbxOwqb3PQ-wFd6k_pXrQ7ZFh4c``C`X*w8BK% z>cT>UiacxFtJG)tz;zf0%MM!7UDCE*00p>0l}nYaq{~PWozaBX4A`(rs zX(d5H;($1pbt!5XLgfCgn@ltv0Pu47nvErHqvr@MT_}5C%Izf`aIT5Sc#I7>&K9b% z{fmcR0t^eiF@l65%I$2Vlt4mlV^d>Ero(GHl%tN!|B)}EG zHC4kPz)*#qmq7GX``Px3>|$cr z7->#0RK?~ZEPl}f1m)n!jaVDT5x5ac(Y@S=7pF-We*Cac-I-(zD9|s_iZq}DxCpWh zYSRHJl!cBQhK!_qh-{5L1NQfPlw`I+hz9W|F9D)rKyorU_dJLVUXzdu1Oxt1bryF* zchhyMjdwiMlN)k3MAI3{hJmuAz!5yks%}bmgN4Z&{?Wr)+@ADlx#JmJCs^cp=h&_r zUsb=sik$}&UF&8uwz_#$OYn+To&haeTOa(P{!j>McHBXaMG(Tu`tjq($Jbb%6>sPW zgZnPX=j_+dKKQv`QS?vY=-1_gt}p-gL%$qOXYc&=KU$xR+S%IL^41u?3Y@svMy*va zDSOdO*PWg1(R#?F`5ncY`#t@_7#&l2Y90td-3?$P;ZrMpxBy(TKk&$Xs&BL+Jnv;@ zOfM0pJN>|xdZN7MAhMaPu_pm*3J?SWx2Xp_+0_v!S)RncMuv9^j2;} zX|w7n@j|UC%1pJr-3{r#s*)n{VsEV9HYo+xX0?&us8}PsasvHMpA)i$TET7- zjiW!>`^;)u!Nj?r3G)OOJTi>DZ|4wMsh#{RPe-RPO}bYGhAPX}OUi1~?v5Jwtam9X%F^8^bUaPY8fKFP;Hp7+zd-B6gFVaB7WcZGg+OU>~rxvZ5(U4Uv&c><2-V8toq{`gmHoeuw5EpIWS~239r`^AT zYl;PJHwKYh>^vz1%f{cgo^hAt2|2T~jk=Tnkk!^v2t#U&aUr%{?Yb0DnEW~d3&7ZWjg%pC!|LjrgLkciar}8y(@Q%xRqOTWKI(A6qb>j% zGn>6(=X2ra1qvhhLc>+Ie%MGQ`KL@=YCp_~{Psi>ldggkjN@Q|f=JJy;vBqfESxF* z?(-WKL(zD-neh|Y=U`V2l{;>D_=DB?M*8I|+MZ@9UPoMKcH>2mi zRp<0R_g$E`Shb0Nbw(w2<@eXH18}9h$tD{JCx!T)yyVNq5J?)RC|o{o^Qp@->t16P3MSB+kNr!Yjfnv+`M4bk(rM=meY%(RcwSR0Z<$7 z3=5De?GbMKAqDo=X!_1pV7_=|1jPZ3gOR2p~_lWAWCpl-d=e3 z?M>WExn;ZGVZuBKAd0=#7lugGznvbYeb4^>^5uVvjiZ;^yUuWw_~=nT^-y?A|z~Bh0WvDm;K6>|`b7j`xizS6J|ivi6I7J~yCJmgN6vK9!*g z8>uf;t#|GxpyJBLU9UAmrf?3cy_TsOz0346&NR8&+>0iOgprx&*XvYC*>yU>Bssz& zXn=C`+x#InlwT0eUs)nXkrmxjyA?EoecK>4{yzGv7Sm2kfKtA zL0pqmT3RbVn?&QrE76Nx3QN&~qOSBb8zPMb3GNlqZeuK}CL(t9&QHHPf%inXiZ1zr zL|tF4-r4>$S026tG^sx8#dle6eC9u#GnTFEl=~6DPd?XZmVn=um%fUUL=jcnqBFnv z{!l=$h+zaGENJOSg7sR~Ba86EkLS&EM*7DVDjnr_{;ub5j_z!)EEo0s`JGY5r03ff zDBQxhl(+bOQA`i^qeZf3mvFaGW4(#b*dqv9r;9;C1QySqV^mUDo}{N@aLZz#G?>vx zvlgF_^3_m?(0n?&ytA*wtRr1pD_+8NGJJVH{B5cG4XzWrMZX{N&Z}A%(fC|2la%Ps zlk>LNv3j5|Dm0QB>=l&be;#_Ftj2?lS(0qY$=8;jf72$rKz2t(AjU@iR*Tw|-7)ja z`)|!JAN&|gaf%8GjMPH7`rVpvGRZB!35l3PCoRllb0m3O|+|*C)xv}iXl9%|(V8J1; z?^kwIuHLxIKpUt=_+Cln0NJNQ0+EJ z00e@OGj-osYNrPJMqyk8q~Bg^jRZ7~7B25U9lu>(Ani5%oIPC{Hu|YyIoXu=BuX0w zkZ$yOTqj*m78BBZR|SW-2ls;%kJy4#t=5*x>Dx~tS`#W|;Rda7Aczt#pG#O+y2?KK z>-ZBP0-F#R?)py`vi;IC#-Xh^TAjqrYMk{ca?(P=O$_-976{`mq3fVNT$phHA#yD( z-75!A*ciEgrCZZz{le+0*F(9^MPoYtEDRHf(P=pvm1lT{dBpXFh2e=pXzGOAw>R*) z>Rz6m?@zX%JO)Nzd4$pMRJfOpGI^3L8h%;POWIQ`8|osE{b{1TE=+z(0&mMYb}%NM z^36XIFpzOaRCsU?^#6>{eViHIU0_!63O2L?g(kSVyJKtx>`x0`Xw72)kDYkGSPWT!>L!Cx^8kF?Cj z${FgM7*0uEkgITlce{gph2617ynGnh^K)$U(jm!$Cqc>V%`=}hLLneCe-RQn*YHbQ zKlQ`?Y|b(PX*|CuTM14V|G*1=iEf9(TxgG;vf#8VZ}I8AE$VnzQy3tT5(29F@e*(U zyuus&089{Y_##I?R<1xc?J+!qkL_6?Cv#?|AuCQWyqZ-vn^g=Ap221*a;7b!_G~JB zNUykUqXCE;7!uf$^j*s1MYEZJFPq2l`{_P!8LxD$G~LFAQ%m!tsJC=8e%`WdoI;77 zpIh>jh6V?=Kr=F}`|UjZ$7(G7!DYc>VuX%7TX75|2Wp7Ng zOtK^ikqB`*6h-8z+jM0ZLx;yFBnBFi0w`fvZv^_|f|tj`l$Xsgp|jpm(l@?$4axAr zrmw!uj*)mV?}#P$40kd$B(oE0gQY499^CrcXmIJV(;?B^ z^Ol0%5r)(#i<-Rd*k~tA1?$CqedsGx+k>I}xcuWD8=^p&T5 z(JAD*k*%pN@=k+$tl^i@YSQ66?eKGcOH1hG(<9&U^TpiBb4dhuJUqnf@jz9h-<6%% zNxR6Ftf>^-Us5mT`7~9_jfA%R<=drDbviYu2f+NE{f(Qt)Zv`abxT@dMf9JW&t0s| zCO*vITUYps5OJ_PKb}YaK$)LbmhbplODFHjBf9EGHa#Ru0umCPrv@7pEy&NG{GX@0 zbogs*1(}kPQX4thS|F;hV`Q!O*{Wb@{`-c&wC7saGvqdDK4%}N4J!j{S!BjQSODlF zI9WeU$sfd~97wX01;$S|C)w8+0xvuy_yL)+Rz06U?7hmk#9_>Y{pQEhe0S|m7te6p z(!~KlsOtPj*Fp$hbi93{X7cseuK&)}uoJwVbMK*43Qqfq?A7jovHi8G>+TpF^xcLv zRwTZJ{%-K#QdJiixZ(82q2icP-FTZ(wK}84*7`Z3CZeW;D;I6&_6NM_>#|oiN?k+S$7#u7z9Lo^*S8;fitPmk^j>7bgmeD z_{s8yJF@Qwl|J)i-&}37Z?WW5Hq=m_u;b(cs5_lk52hA9Js*La1sZ(?T$d0y2>1M@ z6DI-6Ny@n$(pDXpa-DsDyB4MVE(L1)Oa@$YrSH3IISJ2iU+;?{R+q=e8>vOR*398a zQ1S?Uy5r&P=I54^u~KV9wkdqxBRA7^NrX~bFi!$>R3}gME0U8FNa_69TIIk2u-^3P z4qu`o9!YQ+A)@Cf$Lu6N^C?#PA}5q9#sB{9*Ejq3ABNqo9SssZJ9^6JaAWV>NYZ%)ad`6-v=%%kjNEwdpCmo0-3 z_=zq{KIXpOma0`Sl8|d7UpyFgH%a^`536!r01p%T^8d()dVTGe|c-*yAkTs3s zI#Fy%sdI1ydQlbKfY?rzP)l8jr+0ekkC!$q@?cH2;U%~EjmiuO%odb=sP~7-pt^p5uEx>B{b^R)J8LV$$-AktuXRszN| zSw7vKYmER|z)+QCg*oS~R8=1VSo5EJY_5=a8;LKePYWU63BtvK5SO+d4pu3omiwd= zlh{oq@h{FJ@N)q1d+Y9;bKH362OkeQ1LwUrc}v#&l4zgv3?tPaCpS_$onw27K*Glv z3V_IX2IVQ%fp+13EsMLl5Dr&6AwtmviWff`3S2inhf^o+@f^inIG zFcYi-5aEjR<3({-Ih8X*7CMVQ9i`F!nFk;0j4Nq0yzES>G%&*?MYBEBp+l>u&3 z2>QR_MN4(yjQ`2&mWW)Q*)+R zlD0QKEA&J$_ukMX^yTjg#aAZxKOOF1uK(Kly_D~FIpVMl03+Dsh_-pdcDaU4;R45@ zyPuz5h1b1=v6ZInM7D#9;rfMuMdPmgN_GM?i$eV{exrFjgsr}(*|EUqMVQELox;=H z=-$1K$nelCki*f}*@W#Dzbj6&orYzZmd0+S)^(d~)%q}ad?dlAHKpv%Jj*rJCs*T9 z#|(=`(d@2)wQ+X|eL37$Pp7=jn9;5_kHxb+47~p~iAZiActtO{ek0#pS((o@uahjK zWH2!A&!1*$9I?65deykiLB3YCFOVGe&t4BDQ(_Er=4`n8QG*>zhWcZN}akQ zBIqI|T_P#YUrO%-%Mp+_Ibzs3l@Pq~I}u#tKhUDB!+DA}IAWUEujhHRQYI@xABsVx zkG!9C#!ykdy1MM_!1{*Hx4dg>cpN|R4)h0IM9l5V2G>bBghL`ILaklx22E3pi?u|n zX||EuHaRxtXVKByP3+#Quh)sDyi#Qi1JVdq6scJ&kp#UhTYw&$XqO$!96-NF#R14O#-Std3*Iv z(mseV-lBrPB+n6K`ESC8d&J<{NGWZK>p{z=u%f5lv_a@?zm>Lh-YLm*$GbGyxf;t(@c>hT(9r@CVDJ=Db8AIUGIWt`;s^bUMSoa*Ji&r zecpC+PPDu$a`SF(ZK(g|UE3ut1Af<;OQ-AYj4|g`gjUemuM|XLeN#elopMjocoJ4x z9xhZAJ@}V+a4*-KjZ2IeD$Qb?rPN@0H(=e&#;GUljU|pV<9R9!&QV&Vuydb{6p)uZ z)IT5QQaYPo<-0Bv9ocfOH6g@4!q4&GQ}%vCQyl;rHhK;Q(j`h(MDb_cznm3)n14I* zq7c>Jr3zP2;_8v14V}{I|E~NKocdr?w;Fba`4GNkV=g-DIcP|Gw!S{P5J1Ua%l*bVv}nPPs}>%mz!xz3T&3oLgco+#NXti$6xBbs< z4QKkFAkZqeQ$;ApMi+xtU+6|-Ep4<WMgrfckFms%w7$fqX>B z=VUoc)>0_XhB3nfG1U40CQtym?0WFR<)ek7`aAUdbh!(6JaL;;nHAr`Y?0462Bx+mMMc;(J+LX*n?3D7s1bM9j@CY-d?|Zi#}_e zML^T7M=a_0L_sLEyJ;fHa{^0n6u%TuSxps9jTLy#!YyDu2fA;Ag(|l(w?I zcX!K4xES9@4bew19~R1>HJC`k?4^|&&MpL>0-pq7cjZD5Y~Fiw_50r+S?~CquAoBr zPD8M2rW;Syj3Vm3sB4)fP|~46!b5*wjHx*4O+P*V#O21lCqb)vL`#$OR8vdN;I;m1 z54XoghxFQdqM|Nde!AS4=OoXSI>YEfPgW#U%x0TM{q-t;!#zu}!U%w{-$kp1Pa}n| z1s5)R7=1iflcr*gf}Yl)ATAzU8kYld2Ux_Ba)1#X45?bPNT})gW_!A=8XTf)4I$OI zs)$RXB+0znP@IbV!quOh>Gh?jiPu+%sxG>=n4Z4~_ zvj8M0(DS0{&?yDy*{+9gE>*vt&2Os?Ut_S~ARGw+1?75`RMeOTcQaYnx%5KSWBFR! z(CipY#ZFw}B%hy-O+LLcKjJR!XD4ubHB zn*4~GD`y_BlroS6X(-<(WT50iuCBl5Ym#SSI|E{D8)1@F)KS~KynMMjK$L~UBrRS4 z&ldda_!`J1%st8;m-#AWZD|F;x|+8_Hk`9-KaWJYVPkrs&#qhp=70@XP$6%5-Ie3) zo^)FPhacFuYJBc%xYJB*TdQGh|9x8kU3M4V>wxMtWs%DeuXLZK1#81Rq-dvc!xp4) zug12k9>F82XXbL%^a*W~uI|z%lV!{RK_8KZAD7H--ucQd0FwN|dD@ao(N^B76!j%s(dmtPq9W2Px#T;9CJ2PUT zZ|qY=3tpLyu$QN3PlyHcmqC%uvsXko8tq4E;@FN`3OC2-))%O>?AJI5f*5V@9?`_2 zC>G;C)@_*!y6bd%O`Do9VL9X~@jM_8z+bp2Btcb4>6#zXsXsrKcO}>M?9jYFdHZ`B z3U6Tyf~G0KICwasBQ^)z=Y3t_#F;CRr=LTbW>Z-c$79K>8munPDlkR~Q^j2o{O+#X z#>(|qX}-R`a;4dXcoDaa^-s&90&{r~6p=+k!{e3|)?WT^%F!az>admfaX$A|qSsic zgo|`prX8(8A*y<}W*f3?yM{{2MI_rTTp06(<%z)$i@}m7-H)RMp6rRAD4e22o}v^%!mM2CbweK_SNfVR4?X zCP-a$EOEoL9D{)4q)=?x@tWl9@OiSpI7sVAxB5E&rv)g|{@#VO{ny6xj9fDuG33F&M0_bZ2wxq_IB98 zudQEuG<%e^rFAXylBl8E{iCgi+OUP7*2v?0rFzogU4tA!*l!o13x zwIY%hG_H)HVMb>8%pacx6G}4sKw?tD2QuMQ2@Cg~f0oLgeL>Iu6McDFlun_(JbiI- z>QR0G&!BI)P+FbV=Vm*T#~tYsYP(i-i%wKo@ih{c16rU_;a8so^HS3<= z(x3IU)*9V8I5_a@+5fY&=dUenT*ihDlr5mQyiFlE?{g>gRePDmpsyPAfn&6l?4RnocXZAszLbp1v84nf}6^>6r&ougBg= zrcZAANBPUI-EzivZWp#T%ueYkAhN7G3WGKpujQlp+TCT0?>V&PGJ>1`5{4(gRH~%$ zB0POk?q5frs5M?X%xinheY8WmY%>@J6k2>WLNO4HF4V3ylc?Ka9mcckLU9s~rCH`5@Gf zdu)Cu4q z@y2QauioX8_2mc5u`8PSF*?i9H7D2qYaZk1Z^;>M$=R-LMs@D?{E+-SzhOKg_f)p#iLv{(#?nn)XNk*9wd9+|Tqe>9 z{jS180m3{(mE+g++~ch%&n|R@J}o~3Y(e&XW!>P3v@NarRVVWs>s9U6%XArG3_52S zpZ{1Fk5dZyAz6E4V*jjh@xA;k%RSE~)mAdQO{J-6zeR3q^-`6Tob(f!=J5dG!L-K` zG{};v98kMk7QFTp8XquxPuIu9eyN;6qjNrCxg&b5?UT|33+Wfp?DEli49-vIdUIQy zWx~s4$Faywk$}bl{X4Y^Bk3w4Kok8_byH@;&y`nvOwZS!uljArT92hKnC}hMm!VqcuW+1kdh0^js#ysuzvZcO^jy(` z?R&6cP50HX2Xa7-q&TIZeNIGL3GrBNBwfRxt_iu~G4d7;D%UuUP;{FLC0q3~M0B64 z_MU8fcmh<##4bBCVpox$q|vj66CcVth^#4FXIH9pkI zzT-0V$yi%WD=2*=w|D0|i)BE2mWnV~;|+MuOD7|IY=@dyJS-=Wi@zp9rpqsqeuX@y z70RY`&)8*(ydzawL^r!4w)f6mdXUZO7|l9k?Y1J@?l?LlvvK)FVM!jy(gh+02gSu! zhFb9Fw6(krORGGib7{}gk0)WWc~<9A*P0~Z;Zcw#vHSl1Htitlh|%Kw@aJSyoc8#N zzDPU(+ff^JVDprhtM>NQQ}IeZk76>JJUl%0&YgdM-YT-%|MmG;#{YBD`QhPi3(w|R zg&Z>n=bncbowIGUTCX46a?av^^*9w^i1)7as~UCajqOtWLow%{lRCeIG?R;5SF#7# z?`+T#W#e8l@kRomCOWJb9jbm0&2Hk?GOoj_QCHaA#RQZaEq{jv?(9x}dA~eT-}8I- zagJB!&;t6(*w&W+il$#P(g0^@F?MI+{l09asj-HiN(Lh&bX#oirrrw6L%1qP_U zKI(NGOVFyULQ{&VDT$=#?jwUC3ob48RNz$MhL!C$8o6c~cfX_tH5o)2JP%AQ`X*e`5ovCI`&8b|2Z`#2ct%_Z7&CMy?%2l zG)L#D-psu||4_+9+9wSf0X_-j7_p4EsTD{PXPGkhH*>YRXHAPNh6&Fqqnfa?!v2R`pTYv0%@m#yjMm`G3U9PJ24I_ zG;0iQZF>+Nc>kns`L*YAS2zMxQ`)wzr#YNa?{p(?iugJSv-}AY{$F4n8aYI*7~8+E zX^7br0oihnR4Hu(T!y&E%M&NlI4{-cO*x@IpQR7q_Vtw|8l?|S%D(nEJ9^@GfeonT zQrA-@JpDP773p2;^_oUqu<2062pW5&W#JxupZ3c5S;eedg<8I|@F{ciyjuu5eDnBo zO4P5_-I4qS+E!S^sbYeBj3rr+VjXGn2&Fz=o;P4=Y+%~zM%9t)c&)9Hf0{*(f(~w& zooKJDAbRG~u{d z0FGplsfm?#T_0~bL7x}JPCDhOhD**Yg)VL>oKU|46?o-p?w}v}P~_G^d)Ky1$>#tm zltB3F%_kQI^>No!2>r6p5Za z(wsBM3DE9@x3z`ud)Me8iCR*N#2X_@$uHa9XrE`MKeONb(!C%S?@YlvNpRq@U(UMH*YHREFI)BL)hdE=gh{&BH{qLgZC zg~M;b6+3E`eL2(M@IEv@N=Cmx#^ScdZeevF3+)Fw>22;yE8L&kyg+Arm(Petx3)eG zcUd_8o_b87-zJ;&s-vAxS9Km@=$MC60reghf-&3_EDo6dqyRNkN812|G_rKF?rG7N zva6upv=~;Mem-8sG4G|G>2Ghkw|SHNPIQWXj5M4PaZ*~+tUX82VHnI{=jm3j*#Wk+=gf1cuGwbkUAY(7@qV$|4(t4?YPHXqI~%7z z|M+yjXessmgM%Hb*Dk&n)Y4+T(bYCKJ~~g$mgIM|b1c2Hv@69?e#dZq^Yt`WzacZN zH!J?8$pApd_Q?p__wA{<2Ry+U`A9~!Y=$7-j%~MZG*z6@GKsU#A?Kdx_rDN46FZ`+ z^x$DS^h@jb;lY_t)XgZ&!p09=%s_Q4_hFmqk%K)FWnfIC!znL#G*vJJ84zJJuxHKwUI&zdUW{G@!l;p z|19OLrTlLPimF&kp})$f11z4hP+Ejuo^^10BZI+mu7Rx9Pc z(|=}``9X}!I^7-hCI{|HPVdbXoVw9>mq#)#zYh2Hy^ebhqZ`Y=nazO}SFM_LjEr0V zgR~L13oYMo1cgolW+~U4FKA8579VPxvZtk^wKuP_b;zl&=lC}BJ$JaX##LK=&0R1) zyfE~BsH5$^?oV6m+;GA8gaqckZ1ZgLP1-{%=e79Gz{~^9q1yb1j>}7)bkNzeXO*4S z)fHX0zukLuM}4|``%=DbuXQAIFjORE2(pm7(-tWvFmG3#cMPW+_GF+~a6j6E?nV~7 zItBVq(5GXdLkm~dbb@!Z+TTJu{C?|vax~n4wO)KK7CrbVzwUwJUg(7%2os-LrcH&c zeRAED_q&zIrV#t}9<$GZsE5ORn`_n%>LlKMHv|=#^JqQE?unX=+u| z)^_TxdW}*2`WWCPE1YFHJs4?#>#-!%hjUtFze>}HY;CvQWBiD@^ju}{7FH&%UoY}} zJnBc?=Ildu*Y$hh%tPkkz3|-dfYN$y7_E!M%(VJW&7GZL2-N>_Gx{+FDUxM zu?+3lbMW&1`@U;<`Ebhb@1WnmB^qsgB`7?s({L$0s|AfH{7j|x+q8JddD=a4u)SIH z*E+j|DcBx@X}@(TzcQAT`3^|C=%>kEAu)0-?qV~apgh$!NgmbAiOAF9%J0})+Gq;- zy8ScE9cL|4A%jXWH+Rgjl%RZS$%IDq2=gqQKO1$8RjiFgb|d zpKLmpc9i|+TW{j-_~G0mN9R(K;E*CuNx@Nu4?obL-TuhrHT%)r_P;sH%~Q*MN1MCB zBlTW+a70YqNX-V)W_l(d)k`qz)mj4)Jjhu8InOw#U@}KmUWG;;EZGZKPV^%;3uk+J zdZILswX&NA@K0I7oH;9dZ!l$`-c!zhw{v>_dRQI(bpCfN!fibI%kyvUlpdn-tMA>y zlXTPs1$WowadH-NDC*Z5zc^O9m|B)4=a>-} zJ~T7!3IJmro;g{fV9pG9&jp`Rv)W#~-8p4|t;QeE8!ev!JW45vLt(QD1AtNr6;V}+ z5WE__i)+^vCoyMch{3$p<}$5L={;;8I$pIeRsp^Zgac>vO@%of*S16-e%Gnp7rb z^hq1144p(NX3Au8d-GC~HABR1Ejn>kjFhRMAdsmo%-q`Y?%mt( zzWQdK7vXsE>Ta5j-@keL8i-N(Tb8F4a|JgtN ze+Jm`c>Kfv#VZ7CQn!UM7k2|OI46!CS;4*(D_6JjX?qPPju zDB}Uz1!5%5KzSU>P3yB8FcjvJI;7;{E->$3ik|h`v=v z+%!rN-a=0hX1}6AID#W+_-dt$lq$=8Be(g2&%%%AO=_n5`V^6^ks5Mj9t62Tcn|{u zG1Gi$`QYYCYuN{vwm47(29XC+AVfyk$ayVbmgN~CXxh4W3){?A!X3;kJ4{7tYEgF` zah4Fa(yQ-6PXf%$BLQsYh;ZfYNfG?N`44|rpaL`$z6wH@bZVxkQvfb_>^Q!|D1S*5I1GVYH4tMUYb6 zqxUup14Q)RhhYGK%lXXAoMhXTXc1Qpe?$asL@I4NIG)`)H#EB4k>{E|&<9VsU&*Zn zuoe-d)8#TR^EgdqDDyJk-@g|^0eb)b?c49Z4*(Lme|q}ji!Z+T>tB8I?RTfsYz9)N zQl_TPTo%=(^`*70JwT^vxVyW3`{vEtH*Y`t?9-qB{?F%Sd3bz(JRV=Xx|^4o2x_gv zP{^U{;%10YiF1yR=+htF-rWUQ>s^Xu z_gAfHJF>b-?wQAC517=R?+9xTqnQmP*>_FTLm&t8YT*vqULj0Us8(4!cXl`4RYZkV ziU>1N6**2*DT3h4S)1`J;xThh-T=g$kl2^*rc6}oINjX((gD+FKtO~NPs}ASizbMIrmj_sjyW z-`I0N_p2vKt80<9lO*4jnaP^$KliTW7ZI5z^yVbT5mDD!@r=lj@)}qrL;zVpPpQp1 zV}_Y)sn5|iB7nuw-Irw<$1&%yk5!V(&&Vz!EU2onx()4Ovu9!KGyMEp&9bm_qlkpE zC!|-P47Xe_Pb?+C9O;rqsLgz7CM@b$>xeAa?J(WUt^fL~FE3_D^6tC0@7}(j=Z3&6 zW2qyfAgfyV<_Xr9?x7A55jQtSRr~d?fAv@Y=70XtXP@8R9>=K$m2l z8OJ&dgR0JR19}92d1+h=VyL#>mshXvq)dCFrHO^CI|vEFokVoL4sQFWx1SB zr&DWsI-Sm!69CXQXquUM73y^}Ltw;JoU;+^=_={W!bnUdVijW{Yi|l4v~{gIO1NrY z+|`8co+Irda!L*$ZTtrEp6@boI5h1ZcAO4-3|*xG7>EJE5bW;SegAcUJZ~JpGKpS0 zdLt~Hfe^WC*WR}sRJ%2}VjhS{SP=2?;gm5kLRGtVOLq3E-n*&;eIo&KbaqNVZ5kJsh$yw(}fe;^>uA2ofZGiYnI zz9uw(z>QvCqYng6_)LCZ$9umbJ|LcToxTz@;GVX9d4~uQRF?=$ktl6*>fuV0`25BK zAuxwK0f4W%Q6wTa+eW9Y@r-`oH|2fBz4Eak`wp z`1P+p{`lk8ns@De-~eV$&Cq;0Ptzo|_N6uL#9WBobBsX)@Yc_7-h6*Lorud9U;K)Q zQfHHPodBz{Z&k~#Lq39t)K(9NA0+iVw!*DLY%5GL0HGo?XXc)Xewy$U7ITfT)R3C3 z)Fk8D^9n$M6zknw-LgxO6ee1L5ckkJ5Fn3ISdNe0PN&ni-+p^Djkmw^+l&MV;cD7o z3)v!~>Q7Hk4-XHm>2ulBV#m>0;n_5Kt2Y%A=D=qpEQJ7|wU$dq)w5hqn-(&)_gjAy z^xpIO>=9?LhSyXy+p{O>Ud83Bua$qaRQSdA;N&RLAys-{7OFrP2o3;dNF~?lv;N=I zRCQoUM8C0-KkTTC&5wASDt+b70R-?|ec9c3vqEEA;ePFf0T_nC%&c|Z+9r2(VWN^} z89_Q|)mlZQ^_dv5f85=Po(Z^T4({&?qp;Dpt3;rbwJh$>g|=%tZ$Mmn_ni17D`HJs zsqha%#^&_|*1aRpKl`zk?CuYef_u^d}zvmh$!db)LNL+ zKR05%6zqP56ZauVm~|TjNL{gJjjo%f-o*?faGqO&Q0<=JOI3M`n;F)#0iU)(fqzF5 za8)_=t1wDefAkx_{aaEB z5-e>d;b|O+D4G&s>&yH5chLRr?(XKr-E}jfJz(!J#ebUr^m-Jj2A)pam( z)&x>azF!<#85K;U?%wsoBxhaBESU9GBFaW;%oe6iY)k;-IF4g=cQeiY&K!okQZca0 z+o;wmLg*3RGe$4-4B(|!61>da-KCHRa6uM14nrNV&@1oC1oJ#UK0Y3fbr>Z57u_wO zyF2qSeN`f2Yo9|R>aFc)F+=Fun&CO35)oG74kY)xFUyiDEHgKAW|2~2v!=wYe<`={ z9yIpG?rq=kRuS6!M<@ali4v`rnA?8L{9qHF;yMNi0ES@-2jQqCvhWZQrf5DCxs12sofh)6Q#hrWf_KH9LJ^2%zQi^0kC%^`oIkvuFOFYIA@0DMM*9Y z5L0uyhtVCGUbn>NDU*A;ut+IFyt;bjRFB;hdjA_B`w(y)8vPt(vJAO?qSPYedY3k} zKzEC@XiX5h^}L&#Z~hdpcf#d00f0#tN{vZMeHzBpF+wYvXj+1+| zwuo@Jt6Qd-BIWk>ZWYGW5&*sRd<&QJ1AqSG&tJZJJsl1|{mIYnUcNk^ zm)qmr;c%n9FRe|7!|ly26PuffA{7s zAPjW?z-8&_K9yRW)|PdgkLubQ-nEp%EX=Z-%Me4}*>SAXG^RTSfcLKLveYsVp{X*{ z?d|P24r)zXW1%)*TAwLA{ZA1h$FvH`G>nIFAOdhFf}xgqKD*m=7;52pnIWu7F}Das z2w@5{5xhB0wUjjH6QOY&Kvw;05;+d+PA#YY26VO7Rn598(rR|o`zGNm1sU_Hwxr%= z?Jz`D9qMpA9&>}2Qi@3HIYu|FA<`7Qtp3d#E4nkMiCupPTsBQ!Ceb^l1AsID4cPt8 zHrs2+H5pr0x>kEUTnYlXX*cbNa2STeVVcI_;qhU8A^;YVBIdrdB`|#FY9Reawf8;_ z69AZ|rj3~?0L*&RUZ=5+gF{%Bl9-SP0!o#oEnWLK3=y6~6?6V3|8M`3-(x}Ib;94~ zb?eDP1cZm@)W+7jhu1Rf#yMLiONhiI?veVC^x;#r)|!VGk@OR7noc|MoIhvW2gK0Q4>jN@S7r^{&=s=Ig9037NlTrO?t>UGFTDytV%+AP)K zC}lt_k;6^^O06O#6HMZqC%pQw6)cdlurS)c^#PW1L0bm_Qb5M8FIM2)NiyI)E=LLZ3Fh+oy zODVl|7OW&0;|OzekTxaYlnNr#(k_?zgc7yNFxKfXl)~=ns!TKuV@`M;594$giM;FV z*1^@i3C8W=aC>tYn8OS_3d_s8m!lL02v_h(i%r#DYbixi(pXC=!rA8z5rc@SLJq>w zuG$HG802sqdtZu(F74@bo~9$q=pl2n(|Nwktu+gvQi^O65jC@%#L2i0RraOZtk%?e zY6F_K)A?lGRZY99Dz9d|VFq=WN*yBLGGDZNz}n)s+0j2+jjZQ%q-q8CvJw%9@G#Wm zF?T9Yq>7ZZyC*Kh$$xPAArVupLr#e;RZ{K40?a<2pDyPUgbTB)wq@zPMMT#g5aHI- zvK{e!Ik(m+6&oI5>r7HpPhdw(X_&93Y0S(+RSOR&b@1@><)W^`I3Plx=U`DYRa4>s zjJaJrRNOTOBCTb+>)hswecQ6*tb2ZFJCfxTNd3q23_s>lYYkf{KIkLb0aQlfozvYR zZJQT&Po04f2Zp<=>7Jp7h;2O*zR!=(_vsN^lh58uj8~=q)URzv6PkyInc3xXiHP3Y zE+{ka)Jev=7Z$rU#5~E%X+HJ7&@j|07623$8n_BDnX!}tOa#HqX0~@|ySqW)X1b0P zxVruMs=x^C-BuL{L=ZcmdRTx#6ryksFk;&3jB6KGDMh%tyXKCSQfhrTUB<(()ooi| zAZE%^7$8L0mWUuR^`*HxtbLULVT@9krB0=k?tWU@rK?5qVwsPrs%sAb@7;Uv3_gxk zNK6}&-QH9pM{;8N^wr0G?mzkQXTSf4fB2)1KWg*hhS_xR$)}(HdRlhdGj4mOw&-t;r7Mdi)kRJ8-@YU*H%tn4R&`mJ_JPMnleCS=JR|;Mivla224#Q zpl3n{0KG4+$P_}zg%|<}DBM~PL_&~SnYk^OjWAhv44^}J1P2B|dR#tp`_nMa^K9A< zhr=M{X}*|sxjCFJ=W@?EXKXBWs3VjSOuzp2yYsx9&!=TsV&yIXF=xnZ%|*{lx)VbL zggGK6v!4lQmQ4t-)>>%u$HZdsj#9s$-3!itcH2xsq4lGlju`+G=vHjAwoiOORttB z?vhZ}bgkQITtoy$cQ6RvnqOHY?HGds);gi5)r>_J^Z@`QX^YLR2Hc%_pBo&>YiuTR zfQY8H3#PWuzy2x!B-y%^D*!P-*wcS!FBTy@SBf_a;jF7LGZAM`#Xde{r!%fe*j;Y5 z3DhH3m?LCd+-r#I(oMPO8X!L4aAP;8*|gsoY6YlBUD^eK0qDBgkZ&*ZeMBrW5Q)1J zu6|3Y58GMlT*^Dwo?YYspsLeh5D`KlDhLF?*~D^1Hm$L8KdY8y$+e=+_SF_;7pny_5|Q=>IcNx1W8+e|Rv8Y%;V_AC7AsQI(|cz^ z2h<+D8v}%ObVq_(NQAU?7JT*c7~!Y$Jv+R-IXvj&&2jwfM@)QdmkUz`)Gf`fklk0Uqk+z`@8wEQBmb4(19-rEskS3D1`$ z(s&91bHZ5;+0AKO0BPGD02Xe$i42grYq*Ac__8d=Y3!!pF)xd|w>HncT`tSx<7w%- zVyml6+BW_ozrSN6LZm>?y7^YU*tOf~{miruqc-5YgGYd3akmCU?W*lG!uJzP8ScwI&C z&64U`kiNetFfA z&Ao)O6{);;9maBHNkF&`?p)n8(yur+|>49fsx$N6y1Os3KI`d7>}us z9H(04<}j$u-pOXI0LP&gMAvy5WID<(zx?{&fAOn-^3VSJfBRSe?z`{aw0Y^h-y9C( zI4-BlD2yIAH+P4_=wMGz4{x5H-oAN%d;5Z=zJ2@MzyJ4t{V)Fe|M&0y?mzh7{~!L3 zzyBZn;`e{=_uhT?usr?6{oD5lCmF_4YI+Svr0q^}_khR%=&7mRR*r~_(=-kvc+Lln zhz16&HElg-ua{DoNm#-ZFlQ))3`43eRU0FXQ>|qP1P~5F+Qb`x9+5t_L4fJB9~d6A zQDL5<0<&n*N*TKO{o_MxEpKif-t*-|MDwzg;n37_7{(SbJR;JaU=O3)Mo4>BPl?-B zk5~n#uvxKe>aH-?u^wa759Prbn_W?!zx)2$!`2=vuH(b5eAwegKFPAoQg~glzKgii z>Bw^?b>#TH)vti};~_)Gj(ZYd!shjnwc=f=vbRzFKqIv4k&?NCFd_knT`+^|jEQx` z(XQ@V<4IQl5JJvLAOJwAXGKCFrqz9G9e8JvpiemCv0XVC12b*95l18dzP^ZSJtXPa z^#B8lu z9IoxpDeHta6-YDr*M++eWAPdlW z?tM|WWw|)QFv$J8_pd(s_|w-PABOWX>%ad0{^gf{^Xvcmzxr?f^ndl|pZ)k}FK+La zb6=JY<`xYAS_V+Ch{y?^ghX4PaT+XT`A&!tU>F8OaQDz~>u!c&3+0kM5yh zfQZ9T65Zym-?F+78lA6`^y}>E`Z4+2Ddfvpx56SU8X6IV44C%_X-kn2IX!I>pY0kf zGc)U(?};a*!>dk{*eXAW)Y@_lN>+fm;u}v6H{1!)AyidX$I5VbaKs?WhdBa(T$kFf zvD**8@b%@mLZixD$7WGx+6qH%(D3Nk!Y4Bsb_tDPMOI* z;*7%EeDnRB+%+!OYyhuQPVqUS#cDpXkCorZ&9%;+C*-;;wrkaUw{w(I5`wgDy*Ef} z+tnT^?VX>yp8V{L{}q`Mi5PJw26L_0l{Q@;i=7#7zj`h>}DzqPY7!&xgYZ9^mF`9?pPR z3ZY<>UBinAEHsuX1&6T=Lm6u}IAL~65M!7jZEjjfNQALD%(|LkGW!{l-J#YpFXvk8 z?d>f=wAO|yd+Kv~eCoYV({!8$AVidI&j!OEq_Oe5XRop`kAT%N|3iIuLSSC)lecVA zU9UVVcy-&@Oo4VcHNRFd``%^ugW$gNuzLz`X6pdWjW(ps(?iuGcAwm}^WEJ6jEF^6 z1C-qXU^Dz&cj#(+Rx3KHUino=BuaZ$rfdq9=k~TO?D)D7AR-8^FXMH7&Hx|)lu>Vc z6A2!j8S@z1Q6M5RQ@S~B${uiVaP$ZVLs)@b-V|w^Fjtbu&N+U?d?{33c~S1Pq7( zGq>pW`0##6_YDR_bco(f+ojOpk-ag&f^{fkfx}qHmr4=V)Ppey+`2Pht@Y`0_Va1h zet$ZD^X{F_^P$#DGuL)`I(doSby=4A-1l-s?(m$TIWO($e3|FDmLbb`%kut-PQx(% z=Ffi8jK2EvS8v~Z|J%RwyTA8)zZk}YnIldf>d&(Pz+sheMwkMY54XLlE|)nXz|FdX zD@Ky_FqRqt2u=h;DZ{|iVJL;hp&;h?LW)3l1p;9b0_4s3dF@>y058n0&>>*0)gWMT zAQ3KJ5=nrYh%gBNeD>p?o=%U`H1*zcAbB7ML^iFa85OU6B^nW99d=lN&+*Q29ms)* zNI_e(D+!lfii9M@0_fzOR!{qt9!;>ehaOz<@^g0#MaBwwW@btDn*L4(W@tsk>`#6E zbs`aC&RI#jZ)E-mJta4=f8TfC-clF-VfVwo3PwAwGA+Gm~1shNagLy7!*e9=kqN)zT>N z8pFo(yu2Jtes(N|65D_?>FQ=4NA>zxs7Y|S8ufKc4!vPd#T~q>sRUHCLt>??dBWb%1 z0A`95fi#Ub5z)I7QIRswv#Py(HL9L#so?Wp|MkDoKL75|fB*ICkK23-U_kJ7(v*RN zXWa3?fGd+4PP&7+5O^4pg}G%nI{~&nBd`=I!qYSyj&+)9smusDYcmTY=ADRyd8+d4 zk{?<5^N6Uz7K(=I>n#Ar2nO(Rtfkb}W^H{OM`pTQF7rGi^3BandM5$^V^V(EHKe{7 z@nty_uDGvj5Os}M>3Qtw2Ox1z`?lO^P4Bk#W@!rvTiN+KD*{_xDd73gLfkBdRW&m_#-Uc#j_#7 z+`4v=vfCFVjh)W<$zNpP*KnZK$j`!`XMP~8?YBg@(^b#9v$g*+;<>+V4TT866bQTx ziIP%?sH-AitrZYkZ-6+ABQY<_g8T4_%{z9l-t6=ZY@RfDOerl*Jdr^ok1`0~Zgs~5LI{`7P&gyHt|__$n_ z<+Lo9#mpZbo=)>TtCAF;a+&Azyv&z=I?tEW>_Lbng2Oq0y2oW{K*Ul#uys{)79ke3 zAY=d{7DO@+7Aa-$Py`E9)%I}z?#-KT=jD9&;_fFu{mFDZw%(Vvl~olDSlC4Uxxj3c~Yz>FRYD>mYfh(lsVMi1R$#39B6D zkdpZ#l5U!irbW$FF7X>c6JVHk3X%+3Z}@fB#Q8Q-!B-CApH z8HT}3Pp4Bv9FIpLOh8klYSU>Nr)fH$PY)0G<2Z`QH{X17bCb}gpH5GiL|-nKr>Cdm z?Ts+?-dbA<6GHT^v8fsm$;`E>sUZ+E6B0zKueNqB+)U)IvEGM}^V!{cM>MdNynhgh zb|m#IjoKzz0>EBo*=XRkgoW4sp;s@x%Q@q!)%V`s$2`BKpsv^{?D#hX_zKL+B* z`v=Qe@S3(`aXO!=NF9gP=Euj!7suf+kchOlXkVD*<;xeB%lysPZ$xN39EWk5=Xo)J zrD4;{(l4`y;aHD7D1d_mse}WAd2|o7ZUD|w1I!}4XStGB26Cgz4T21il-G{D)|Tb* z{`-gf@0R(qQjcRT+U>F|c3GsBQcC*o!LH3%r8W=-QUu%>qZS#86kf^nHn%d!G!Dn( zG)-e2#9doAB4FO9$0kvPjC7jM!!T4LC`>`)AliCpo97uL5QCA5fB-YIR7zvFT7*Pg z12G3r%#V+cxoC%B7;8-vhE$9s8U=u|ie7YCmc!wos;$kfHMsJJ7o@!mo!_CtKS)M% zxu&UOzRJcS@*XR;L1fSCe18cE4)#CcJ*u9aSzjOV+z~KQzZs3r@YK{m`$joUSzlZ5`ncw@n)+dauNnsDT`)A2z znsE(*+#NB8-{SSh+z%B^^Ro2*LU(rzLBQDN@Z>FiW;`4*FalF`m!}{SVmJn;Pmr6N z=kyUEB49|lShz*ld^&&o)z_z|*#h3bdsvn(ToGLr)V-M=j}uEgyq)K^ID`x}yk3_1 z>#r{_?)Z=Y_)ms9{pDZ&Pw(E{8^U;VYs}isN!;Nw>#}IAHy)_XF0Cmjh!K~xBhTxT z9(okqbK$4E|>Y6Z~x|Re*N*Qk3PP+`Di-c-P|5|X%WaG zS+`VG_|RM&11RS{s9G38RN^BK=fhgym- zhm#ut2tp|m5`_Z+h#;q#g*g%+)444HEJ(nZjAw*l_+cDiE7YWp#oZ5wsm(1JFxWgb zmPLE-H;3bH8iLP5w|Je)8QD*TVWF6u2@^>Wb~gx0PHD?tbz8Y>AxLCPQnM^_?WX3> z`q1@zknx3T-+l9!c8Nq!5FxWC0wQG z8g5{6ZPs$lHSD1J12hUAU~3&|ixKHYc%2ttBiS9XK7aG-wXP?yZ`kmMj-}U6_=7M6 z5mH2B6Uq|lW}g268ANE|7*{@n+rgX9y1(0psqmhMO}}s*BPQ3K7xV6Hc00 zPIFy9I6j9|?dx#Cd{57aSbZN2fI$0@8Iih67p|{H7Qt2-3OrLWf5&xRWq~PUdLHY9 zY)H(40p{V?$im%v??E9Vx3{;}mK;iMW?z2!Wo!C$S}sqg2y`HGgTTwYkgzSw+>FVe zE;EH)PWP9`hw}yg-rxV^AN;{Dn94VA-Wy5)G=z`}p}`UX4#grUXldFlEXV__cTjiC zZZ{NUVn}O4z#8U2;cDrWju@+@G7w-F4gf{Oq3|qlIX}Gl{}J}5KawO_o*?!v5mhsH zkBGb~tGcS|nCWABrn_h70(WLOyUPy*u>=7E{J?*i00Dj(vd`&b>dY%LBf{OyR8>UY zd;IW3)HEV{Nk^i}!w+*cRgov}_#NMT_3bxbw+bQ?@|1{)B*rdr8)I@}W~CG&no^Fg zohw0eFxOfYJWna->F)lV63=sR@zI?C0y=d=iTEKqJ54j7vD++6L=4VCL?Cw$04@X} zV5F;Q$yoWa`D)4QDK^ZD*_xo+E%^Ni@V zZmpHj5j9g9<-A8bbx;z~-z%<R+)I0b6zy5cJ77t>F z73{=2IGBl!LgT{&U^FlyXLMC_qZ+1C0=*9n5KIg}V3JP4^IO#n_#rUO4;ok}qSFrKT{Hw@N;_juwZ;XzD|1L~#mH!m^37D6HttgM zWK5y*rK*o_-#%a0=gYPg9R@$_2&eN&tycBvG@sA2IXz$21emH35};d)nOg`K z2~Sf#F_TjlPNdU3Z_Cvb!L!?xCLsnSV8mK2g4@3S9oZe46$S^9hx>C%skamv(3A*R zP!f;;5Oed^6aZQ)rD<~oR|F77Caz$6Q>eBUkm{IahyBqWOo?co=b(FbI_6E=*F^-> z2uP5fg1qdA_wF@vK5B}(1eENeQZrk?awr#mwgwmX+beH!?>GC^(3)q;NKLEj3=s$%DS+P*od?Bw`bC z7jMz+3Hyr9n)ETSb$1aKn#^*ovTd97F)TAPdMF6j_sSH+(`hctI+R4Z(p^f)hsp5h ztwjeDw6#4=i{W(eHd(i;q&q-^n2Q*wH*!Wo z2W`z&d%o`)NFFvb?+^OJf;jf45JCKRoKeR;jGMpjVnhn%(-BWG*h)RqKDZel1Hqm= z;!rf{VeX&}x`$CB3=Q^UxU>TS6c0gg|1R(T0qFZ!9|=Xo0YdF6M)|c?9KF$7@ij8J zIB$<)g_P!LD(j}&h4Ww_ zw4&+^3vX@SLRrH>%_fTe15T4@+pgF3lMy?h^2^`+ z?zicjfA))?J+JGxZ{ECp`#8;afK#5PEVJ>-l1nLTDOww%=aiCQA`=9JMo2lK8>yRV z1J|5b)dIc(V^Hi6%7@uZ-AL7I)#bWfo|j+!>Q{NXH#0N`Y+&wcrB%rjYIkxZl$>)C ziX%B%9PFg6*}%uVe03&{`rV=Pxov-5ecVEfoT6{f%=46YK=|oA(P@IR(p`p7{q+W} z;N3?4l;)h+l+*ywz}%W^Yo)D36z0rj+gdHmoMh7Gp}7?3p(qv+k$ZIOhG}EV;~{zU zy{Ab;j_d}06f%eRfGd&A?!CJsRA>l=M>Q4#Z--LOA@Iu`P69Qu(NIS<1B`yL`?ghP zPALfccu0Re|BSbT4v`K9e}ITAh{d~J#KC|sexx;P zO&JK$RCQZxewYyrfHW*L#(Ih)G(KnQg5>TjLL+y?k(>g?fEI|zj_>ynF5jyIi1)9L zZzbbh#h_~?B9l2ev6|M(|Ad-?IFZ{NQC&F_Bq%P+q9 z)o>UNr51Xqg1NdVBEFHh4nrOZGfQD{T} zf}8Rw#F=Rn3!oD>|`0swYBCB zt+g5lk1!F%;ZU?q6NjMZ*mqrBl9`7k8~`Bmp;-sEBOD@jBVuVWpb2)kx_8uP->i&? zDGK)8<02p*?rw@XWkOk&MMQuRDRip5wGaks(=>%(Gf~*88346rW+k3uh!2Df7c?lX z`BlSyNGbdsiC`D+w&(dICS~YoVqeY$R6|m^l$&b z5zV}+meMT1csWCOM`DbS5E+rs5m-3Xv(=-m;)qd32y`wZ5(+XS5D>IlIYO;gS3?AE zx~|JKWf;U6`u5v5ufKVFy;cALlx;IN7ffnSDQ%@#YpvC7T?zfg{ps%h{Ij3_><|C& zk5WE8KQEW(_05~dU;XlT|BwIY|Ld>*;aBs+`Tpf;I^BKxgCD(o@#=b6E>BOFr)RX5 zh=hS$*)!E9E?&66f_= z1m!>e$N%!#r=P!lygVERuleG~Y?e%W|#tf>v5xnS9C#!A+Y8fxEVf;B!ih zT(-@crj$e&5Krf`q_nQ9s-`3nD}1Pdgc+lw0ho}4QaiJhQlq;XqN~i3Bnu}5GLOyY zgc7o$NaSGV4O|@>k^v}!cK&>{OdVtL5+3q|;^wU?A-Mq|m9lN?iU6inTazSa&_#31 z$q@m;0hwD<2Mo41xYt@+*;LiR9KEU5rbz67wKX-*(?rb6x^AVgBnQ|^ap2`r2DX}+ za{#b&o|uGHPUW-c5U)+`^l-SIy96yNnHbU%((L zpu=#<@CJPyeD>B_*bB!$wOVUcm{0TEs+sBr8zOS*3(tm-8XhFL;>uIXp)a}DLD80Q zw^E7-rIb#2S`gb-%6gqhCP`Dyj#w&GYeeYOgtH)C*UL9wfBX8IZ@&8KtM9&h`~0-5 z>(&~mc{~C)R8Rm~%Qj6Dp=W|q;y16qee-Vl^i#Zl`D&U^cXtmjUVi-g_3MB5w-m3W#vd!kK~4 z3Ee>5m=IVflxNuhoKW376fI+r(u$gypyZU?kq}#J&D0Dy8K;zUzFrMUW38JPwPtP< zz)Ux^_mBgzBml@9vAZ;y6B9zj0q&UFPP8#|Cf*51yU;}R9}nFEClpRjL|aie3w;|v z3;QSl@b2grn-}+KYt&C&3p$EJM0eO*XTd#j*QO;Xmh4JWiopk#hycOEInLZ%Z_Cci$Dv68y3fjX{L?XY z{UGupKzJ~P6t1ZP5bl&P1YtJ!S_5N0dR6bsNtl^dV`d=1P+%D!`?O)dZ*fHJP2|0G z#V8`k2)b_D^J1Fk)+TVCJb?PM7(#oba3H;!PpZ&qlfB#?q>7ShM9)A71FJ6E17jGZmeeuOt|M1`c z`?74)>0I5qqM_QhF1A$wKv!+?8kL1vXc87eLT|cCPE$_RRJESZXSqMur6QQJ19?;M zW-Zt)V5idr=7=;&Vk830Io;piuSMW3dHPBc?ae9GK^MC|KUwP5V+*Rqw}nl>Z%m1ONnl=)<9R2009kbqCNu zr-m)@ja$)K{2o#@?0xpoyHycJ_YqlB3yo4RBviXunT9uss>P{56v3qHA@@-j+&YT; zuHUJidre8*xU8C)9LFhpTToS}c{-e6BaAv~H6SNvU}vQ0hg!gC(FrKz{|K5v_x3vf#M9(8LDh3`lGz?XBN7tDd5))AAYR9c_Ji7Bo<1E&8%((QW8RIl@d+UB*{fYLQZzb z#H5r`W^P1`IcKc}y+$k3-8kiWo~NAhGy$WVnl%(A$->ZTF>`caLSh4JT5Buy`SG$| zx4?u*l0Y@NI}tE(VnL>g+El%@+Ezhw^y9+Vxjp-m9!nzrO~KA|^bnK*077YA`!+N* z??DFX))cCl8JQax6Mk?v4)yDY-zr-R*h_qI58wN}#RDv| z&$|LLf#zr)^z;}v#|Sx81#dIB0UE8#xB|=2=*%`K-E&0E6qG7In9%|WnC`s-n}W7P>%orfB;EEK~!6=&!2s&bDGuc z`n0XohnKOOa!P_}3QbT|K>~9#Sg%{zRETTS zw{PEm`Q_K=`%e(5lrnL8`S2>G#Z(c1dyfTDVi5*4Bu8}O&YXGtbZL^d)h00x#Q zLV<`{*{l^r=Pv9-iMdN6F#~zHQ;<82?5jh@qE}|_YM>sS05d_%zDaiw?1QgTT5x0l z+#$3ml)zXx@w}Dh07ibquH6>EVKIa*t-JRYR=|_h59|yaHWPqI0i|5G6#&lXvxq!D zKbzS+=Y56m>Cp`yJ_Phsl@6D&$E-+(cJNSy*AYhJH+-Lo1&$>?AqJ$;O6$MUV^ik@ z1B7rpS-&;|6O@}&zJoioYOUEkoolTD)Fq-_q0QT^)Z1YRd-&SpX5cP@;fmq;@%;dV zh(o{fJ#r)fArKls(6oY3hD@&Jh-w-gRO_%PQvlz)bv+2)qS)b+9^?$tlv-=nb+9|) z42QWZ4hs+(=FF{i*)Af~<^VcE4EKQO;W6CDsBox3VuIzn+^p{!`1>sWpa4BSj(IB# zd}vQIU7e1R^!*S%{CR!Y97Y!yckKN*0C(y=4c6x|vpC+meVHDcBz<)1?g;1e{P^xo zSs^E4aX?iq1p3|Uub!Wu-n@I8raN=W)9Ky2ci(*b^%r0N_UZEY+h70Yt8ZRw>vf_7 z8jz`~qk*Y5MF%DWl}RR?uh(bG`Q@vR%eGwB?W0#8FUuk+-@Ux+=xvd;)aA{aQtHe5 z>7$Q7VU{c*v5_{BpUh>sreS0LVbjrL~xLszWKYHA}?Lmy1N4N(q=8 z4c!>s@D^es=j@E^U23Ab0$CoP-YPVM4IxQ z0H(xDAOh2rSR6qm@tm>uMXxPv6KPSiI2|*dstxnL}grLzp-s z0$OcbtpyQs&LPbg75$Nl0z0t;_s`u2!f%9>+qOMsV?Jbyao9vhh}` zk{$P$`+WTdbVYYC3o~cK&~l^*g3%V(TjL#Q5PEJs*^K*ujNY3Y+zr$K$;~~$?TMwC z*IKpqU>dEK)9DnpPN60lGp1lG0(HcG`1F~YnYscAhXNZ(@BIhNNfJ*pq3KqhAD_N0 z+m+ay>ScZRF|(ZK(iDkAq-razIIsbh zRso49E0~ocB35wQw!~c>ajngeo|etA8F*<5Bu(vFG!b#04C&qD^PBJ9wPy4Aguo9E z5ANP-DcY(jATu*&dR`YL0COTtl97x6Ip<|r1S=6qB4$SEM^3q3S~VitmSwq=b<^qe z>eEj@{^LLX!%sf>q$r%vXLY_@E@_sR4=-?V@>oa+%oH8+lr!=)B|^=@r#Z0zK+BWl zoJ2yRw+Ufj*qLmeX95Rw2G1$YNhI~y<_Jg(?z{69bo-Dvq!C6aAV6e(INv4W>-8EV zfiRJdye#-H%otQ}vnrCI0a4GYLM#!1iL}cpVFyPeKumtHQ;)p+cebXAB-~>t`IzdM zDoj&Xy^20Ve12@f4`_3T?Aef&0)U>>BLZ4r(UAy&!^=KCwyhjO=omve?2(ITpr_+I zZU)eMqp{6A@Xs*5*%Q?e1yNOVK;#`9z>Gwq>WG|@Kp!M@K=&RN%-o_i?qKG%ws`wy zKDN9^4$HlgJ_2Iqnjvw<9ppMDHPaTy|9M0s!P6dX@x8KRn+REDm-OETyd1WuE5{%ZM9ADC@e` z(#$N+F$7RE%kxABTF#RhbvVJ(No=OJESHCe`}usjJUzdC zeD~_b%lU44zFy~?*Ro3Hluw&&TT=v{?_VU+wYG0wzXkJc)12}&orLMKY_8!0(Eu5Q z6~G!)Cz8~vx|%z=d26jHf@1?mQ!)^dIpujuBGRfAs)(r5biEdLzdxNn|NQfx|Fd7z zx_$Ze+mAl|!93+}-oAb{ee|Or{pfdJ{MsFbF_92at*fbK0i0%G6k#C~TwpDHJ&XkC#tI3R_B(N~}{>NT9#VU+u41Ng`rsO$~a26@u_l%YT3?-{1Sr+upyvH*;mk)2!;Lj`VU&uj^+t87WJ`sZwL|*g~~qyfFOg1eYAz;l#qmd3IQ=@ zp)8aM#1+FLoSBX}aL5}EyAj*R)IY4pAl14Th|hhl5Hy- z2O-0hQX+b|yZ`LdPd@*_=a28+)~!5Wu4?|{-}~vm{}2D8q)DC9G%vN3Rv%tIq%4=q zlQ4@=Yo(M$TS0`BaGvG)rh+=XAY3mr|xF zm$mE-#NiotleyWp6`*IVO>53M)NGmKAU6OI?x^@NNOwXO3A|R`i6nu{8Fjav&!^oA z(?M%1?w)ckrCOLrgGbdFcv~}da7PCW4xWOkqnE9E_oRcU_F8MxG+nRP4<>TGwD<4F z^e*qehc6of{=2A^V^`J8=6Q|@$!?{2l=B#e+pXyk5$bpzjNNDe@6F@(ZVL@T z+4#f#~;o;_lVQpR&wv-u@QA z)@3PGi4#eJ=17SX0CH1oicP_Q9LS)#ldBn$8W-;dkr-9x{Yx>c&pMy#!(AyNCN))WBg3Pxe_*EYw}i2N9=f5|J=L zLAXiN+sGQsYj6ysOJG3eez`uGH$X3?gef=jzNq-vTQu7XwLV&i)@^Oo-Sc#!9zz2o zs1C4$r3^jj&Nie>h;CVA{8rTUPft(L_+npzjYzOQlo!LUa}U`S2x`=Yx9 z9p2O)`gYHy{nhpn$lhh%BVpuo%q*pKiw+D(oLMt$>hqjqWVd%OLs7Kp=spmI^NI$* z)^-lQclZ$kn5C45iQEphG9p>m?I1xPQNikhf~3xGEBpAp(LLS_8*! zt$Dkp=7t8*6jsJ=3Wlzzs?7{rw5j8I`;$_`s_2exWbTl<8$q{`Kuj_*rCxQIZp-y@ zSp+GiDJ097rdl^Z*%}zAkhzPym36yZmcRJ_{N<}xufF{Ht8ZVwA=)>c_ahyXZAWQ~+E*Sd*JJt0NTIi-v#ArV9-2jGN;WMIw+ zu2n>Y2*6N?at0LeHiT~w9LNDJdOiI-3I$>y#6XDZw*$-2$kK&?BnrV8Cl^`N2-G^hk?#dAm7K{?z~xC66&6UrT*jHeozXGEIqdA|r5ndS00? z+p0zV<5w?!`tv{d$&Y`U=QGOP^QEkHE!B8}^OUCPOazz5M+uEX3e7;unNL&J+Okj* z5~0M*0@wxCnyV=~f)N;acR+Fnvn~l^W~2&;21+T*z|Rp8AciujTZ4fZM?e4p@2kcM zn;V%TQ=-fwAj~=O(2z8<+%&4o-kWNQh(j_CAf5(d8DVr^D$|rk?2BAMYzSB~C+K>K zfZ@J}A-?xsQWncRs-l>=+pvU#A++WYEJS5yur@9g&}k1i$K<9DMFVi_ZGXYNh>m2U z^}fV=l194{Ux(zILGRLn_gw>fB%!V=2>WRSLt!~eY8zdPL+bXPto!kc(QGs`u~B}z zJ0TGgpzV4O*hgSvq>cdQh)NhzwcZmH_fQrYrqb3;UcFl`?U%AY)Onuw{B%#jV&~%^ znT<>DZHxHD$W^_|)r23Jn%3IZoHJA4_;!Z_1L(7!U=OkYQX`JkDx8hYtce6wLz@=p z4u!&$Rb3>TK}<{I1a7UBQsO8prFc9EK}mGIHpH&M5W6P43~Sx&)>3JuY^p8IS(}Cd z_pST!J||=^?ZG|Nz;K|WXt*rw1%6!HAsKgfB$7nw&6_vRWqbMR)gS-yzk2)j@t42+ z<=c0cS{rm%iJ+6XDOF{27hptgU}{*+7%9wo0WCH&BidNF=)j|@h>)67isPd%R#Md( zPrPhJ2(n1PBgjFBb57bEyh}MmFM$)4)`Vv^nuX{2RJOL1nx{$KWWFPUhWfO%O-;9w znLeHG=jnyWwp=0q@ci*7KS=rX_3Lk6e3StBeD^Q|2i^I)u8e+ve?Mn3-^?i`BJLJu zIq^JCdok2n1xG>_VhArXFaqy#j9}3m1BXEAE$bTT#3?602+2DjbW^}?a1coMF+d)$ z72%8$3rtcm2 z&p|#sQ@a-Ch#jhrqGFquYiD4~P!qca0@H^3Z`Q zbqfeKb7DpjQbi(a)#~tb+&|3B5xVE=2pS_Zbs!AxWoUM&b;^i{{G2Lt!|uIJEpDou=<q*fE-BsIM;A^zPHw#P@EA0jpp&N9v>gO^N%DU zZf+r|003GGBTbSBG!af&2!TVu#Tq&!CXsyR8JVxk6A^hc!juz(dC}%X?kMvt!mX^2 z>w@N>?bYf0+uyyuKCN#b-(4zv^6?LT@$-NF>1RLL+E;JBdz{X%?(Xj~=XKkz+iLD4 ze0O&@XEK-Ch_DeDn47hUQ!EVko=OnWJWp;7jm#T*fUH7%;@})f1N*~_f~JZP4J#vI zcQbFyqd7A6Jw>kJK$IXnjH@vrGPPPuDf1~KVu)Iz1270PI0B~ZguRf8;;+FN`=ELB z_xDmMHg*4N@kIm#CX%SHlT3)Bsxgb&eI)Eglj~c!)@pX^&UgDo4#bX&gs2<1qliRX z6a9u2-KQ&KE7`b0J%)%FW9-w^y+;8sG?#|lgd_MNk&OBfyX7tIX!%GXPp8wK!@)qj zv}z1D@Y1pT+D8r_B&tL0G*5_V)*$RqQtHP`m)P(ir*}=f!$*I`_%Z?l5Tm<+Dxg7l zy+Lm;?nOZa<$=JmJr)cOC{Z^8iC7RLwws@wHV@(CUQKI71Qwv?NQ$J0*jjbpiLKq2 z9ElKt*a5Za5|4b_s)&R)^0Hi~X$sO?Yt+jSw3vVgJc3ASRkId977Ht-WT4mUHB`NG z7I$~uvvR_Nm1!v@r4+UYDd)H$1TGZTT^hMTYt6;?(gRzIihdRrkv3MtUQoh+gb5WySMT9O{h&&K8BV|GY^AIQ8=bwl`45|izNyMr-ni~Y&jiUqutJ{i*j#P>= zOUjv3HZ+RB7aE{Q2JV5LbPs*JE?Gn!w73VC`0LTmLMG|ieWWb`v(uQJ67!T#?jGVD zF=g7eO;wpOXK4*Ic4ZgkWPmo%JQ$~N$`gXRhuyCbNuY@c#h~r@P#CQ+5m}Z+6?O|E zL`*5ETdfs){DM-7YmH3}0Dx~FupZI2yc*|u$GR-_d2mxSo+ zcD?mR$7IUG3G0Y6?F0fGS!&dn80}FQG>nKHFdC*2M|Pynt-44;1ZEwJ4ghAw-I;J* z%CK9>f%dAks@gQ=NK|)~fjD!bPjoy?kQ^wWEhVOzW{pTrr&FypJOX_T^4wiSauzqN zb!*LX7G_@8YlP10wqCDS5xKj&6Ql(Z%mX2-s@1B7tOPJ3GjY>KPRmvw9v(Oex#gUz zX{j3-^K>Gj)(RkTN=>n8ag@MMX(%#8XM?bnLPR`GiP_`unf`A=m&>!ZN(A#MO_FL^ixzkP?eD%S4gSTy`tv{h!+&jl`sTaW zz-hX>zixH8JhSAK(ws682>G&Hl1x(~VM@$yiO`eC!^6Y*G>H(S0km4Hwk=OQF{w7y zs_2~uhzBWLY(Hbu9}Ex3NItAwOUIxgpNm}&=e4r z9TC~hf?LE$c}gPUj%E#9tzv6f0S&tl9x#aHWm%&5=&x@az58w3(4!mf%d%OE)L{aE za4HK@fAa=FVcM~WQNWI?xn3_3e{!B9MQGjUf@o+<@18)tC5oLo5aN3VQ6M%FVd7Au zkC4NRwW=Sa18zxipS;27)!w?1dm$fl6pKL?k(%*;`SV}2TJO&1ySuq;i<{;wZaS1a zAQb)FaCnAljNw86u{A42Q<}_Bn}bu%Gf^rHQ<{>2sVOl5fx0^STGnQ*S*xu! zYoW%Z+ENn3hD2&sY9UI~d~#p_&Uqr1(#lpgBuEpdEUoEvS!+|4gd~WZ(wy?CH3t+T z0p!q>41C^{Pa$#`$W8}b*K)aBQ=XUw5Y!Y9Qcf%!MybRkNsyeG=Q$JM{eATB}wTR?||phll%ZTU%=^j7-hc+=%IP znox*EpxR#mHkTJT290dd>57Ksxv5xaw`)#gmx zNoWI<%fg)G>G82>&C?_~U)NRD=hJzbW=U*d4xTgTMA|mfZJtxp^78(CcXyhTobrSQ zS}M3rlT>S8fA!7l@4n?}%F_hQ4=?WDJ$|=s7x0?1d0QN|k6)cX{piKt{pH_U#eel@ z|KUIV=l|n$_nFc;-Mv`U-&`-#`6QWJUBN9gC3FIP_2Tr=tB2DhS~ql?a=x2Sr#vTQ z)0SAyck}5yoz7`GF`<{bx@(>?3$C>kZH8FQIOo#Lk*3p$nAf@?;_3b#(7-g%nyxL( zR-u_THFFI33vw4+^hVYIS_~;PTze%%Z|6{?MP!tW4r(ZA0wxd!aMc3nDJOTkEYB=- zI!$@XK+cKh^9%@E-9)&yYHm5n>2%5x^e;b6XL}4yl>HbmZoCF!xbzzpyacHp;0U$97a~966C_0|!dso<&k~nuM z;68~-fln(+-wjS9MoJ9kU-oG zKma^+@nJ{@!ay2~w3GoAAwci8!`+wl8j!Jl`Vo|X-n)5UNddqWnwb&a2ofQqY26ni zAV;>hSw$q?EkJl)+#0}Rcy=t6$U+35yWrB^wAC?%-y5=Vsit`7A?Pjw5_GJ6Vg_mu zy&Ff1UdYa6CL%-wk2zzsZ>okW{VsptI|iAV0ln&bLrKJrti~t^%mIddjB0eS;C(5Y zoHOV2?RW1Wl$O@ZM=$T({psn6nAfGOTisN*8hX$PMNq>Oz<|I*bvGRL5P<}D6^IxF zQ6}#;vDEckZv`6X)LPqW8TT38uxY8SAt|}7=F|Q3aDT_Hm*x8DtCxUY>Pmp?bz7b< zi2UNC7tha6kJrn)r=?Wb^gDUFrqlVwtB*eW9Kp`L)c!TV?yBmOZ zcS%U2Bn(JRos3%W%Lpe5*q;Htr5h)70%50OFIKoC}A+{jI@9-J5Wq>X7|L{z8aWR4;%6lFSBv`@hl&rg+4$j@kGIy&r@U?Y?ee@`%FLhTBxwHa z>#r~C^5(lYwLvj2Yr}@%XxcS)h{y+V`FM-Kcbr{BM-G%&c;3dW*@i$@t+mx~6=!C) z02`(R=z(X{X03*yay0~RZmlv>;`#h=FDNOc`{|Xl5KpRJn_rf#wdcU5-=81cl?8Ja zVYpl_s_@VM;K%>NfBfJ5(Vzb5eEt-0zO2p4c7L98W(PI&Jf*w4)10LhQllxkq-X~7 zG^Lz{3Eeg4vj|Q}oT|Hnc}jVnQxL{u0py%TWSUL@u(M)(ph|)bu6;Cr`{>=xUOD1G zx;VI#0|M_`Z;UsYh+6BZ10qt)a-q|XkLo%5l52%T5~sv8fw|RHSf_jn08luXA{vo6 z`M~+7Boh#t)!i;kQAu!;WC~hJqlQS57`00}>`R?lAn?(pMgz*#s+ze+7fx02d)qL2 zdPiZMy(xK+8IAsBGliUIW)4k0?q=f_4)w=vJK{iOgl&J-NG)&kSnR@e5lr2k=!OnD zzTn2+ka43jjSXX^pO~b^IC`lINo?e zqw8@96T6J-_djl!(4mUrpxwY3ZMa;sSAis{+jioKl{!{+|j7!8P- z8|}Zl!whaZ_U}*0naG>^hwrG<0pelo<24_8h44PlWIQ%IhUq;#xjLj9+Rn_>ZA`|R zyYFdow1Yo-`Qo>~{jQel_4&!lnkC(z@BZ=c|6wiV@^sybnUie}D&P#Q8OJL#5{32{ z4%|v4BG8C|RmHUmyT;KqZN(Y@)3h?7h}4N9y}$@4tVp{mWyV9bmJ&H+9L6Jhrp z)}9@GS0nP?ixDo4v1>Ec(rG8qZEjvOG5!*?9lh1**G*tR1b_M2XK%`Wn-)yztgIl z0uy)ljlK>P3Ed6)#r16;$7Og%vru;x0Vj%^g3Z*7_J|NC4+Kf;{lM23<7!&0lIZte`S$uF@b>%J8UW1m zy#K(yV)oE{+#92+InwWJe{V;M0C(;p65BYx)5kB%NM`> zjkfaY;l+AgiP)N>v8$V*U?$<_0LbQ5cVE3I10BW*I!F!QyPy3n944EwQ6*&}+G@N7 zWaedA05uUJVl_nqmV9@2SC(te`8=Pm0N3YbD+Lj^TFYiem{JlE=Je6aSEuQ`ZQINH zyOZ!{#6|=>=evLLM?d^e|I`2Sr~mfffA?;EUfS7A+~#?nX3i7md{*0*WkI);$%Du4 zE-4cmAtc80Da|>#8UoDoPV9&YPi(R@Ep9^XRz>D}oC zhVDRA**vg~;|ckGobEuj_(KQRqgw*faqo2d)BA@V!Z8e-#QuUGyw0A&?0KknflCPW zNfNnb({y`}fll3z(^jhL_Q@w7ef#zOUtOMFfAh`noXiY~x3y~XT2##e*bz}N_;Mb7 zXb8YvcVRi)#+yXeu@1QXZ?6V==1xTJVInQeT(wL&38U7H3D4(KO6l=(xtpfne(@Em zO~TQAODvQGRkdns8^Fd$_viB`FJHxxc6s|~t)8Y?oPYY`pZ(dN{n@|y_y6&CZyv7& zGv7JjvaRRyd7kE0*F0s{q_w!iJZBLqmEG#y{gj!}s}N2}gfWzg<|K^_07aO^oskb0{Z!uODw@KmXslWANS=8GtYvot^d6SH^8u9)7pAhQY{ZMmw~U zIPlsMjYi=RoZ{a30dB3;bt|Q)X&{^&4VggWz>}`)XT5FTOc9w_u)BD6RgT;BV<(B? z`@F=M)N~MDpGm|*rJQpe3D$A59B1Ag`|5|?|^DRK-4<=BttI; z5ZxT*)p4jIWglXNg?+<|xRo|*NNS1&*N?6Xfl{q(CZ zzW(x?FU|aPy4$u;d$8IR360bgW7rgl0QA1Fo5wKGhK1t?SM?qMZa>dD8Kn!%-md^(+ks3E9h zTes)ZPN(~KZyx{Rzy8I-({%r8die^NRIOP}fF$^IdCCc$)T|-tH0NnPgV$3QVRtoQ zVhNLXC&J712@w+$2%7^8!~2qU>$(&e?amObg+7~$ z`-Zm-6AJ-|kVhf5YgX)c7<_yu_G~0j!(WL+L;w(&!Q4x6b4eLN0HBouhGEESK#mNA zK&?-1M=3)%~2f?fq{u{u`fa@60&G5rZpN|h+bQb?A|r_ZJ@oK z3X}*1b!mI9Fgg-JKkXpJ2wy(vHi#IG^N6U;-H<6^sJz^w@IkhD^i_J1HyE5D(AV2d zHrg-9%laJI+VRZuf$M_Nr-Jushq6b{{S)tSsP`Px4oN9?XVjr`ipbG0BxE9VueW4a z0r^&|?o*nb+4{ZL->d8%*#H}Q+(aE>%s6D~J3aX}{Mw1_X2;h*e)QmRBYus!&2Y-w zo0ZXUT&|lQ4&L}Y{zM!$M-;B9C83zh?RzPHac?*8e69GL{;4o(W~R4eVE--=ftsqz zppn3V2g1yNxGYO4g_-AhZe{!K+t;P6IZdB`{-eMC>%VPgrttMQ-`<^H0uwS}hg?e| zOit<*fZPB%6n4X4#p~Q$dO@u_Xem4I3WP24yh`DobzS9cr7^*h4cnZFJFH0 z^ya(!7Z3CT8GS9Ax|Nh`GoDUO3lp)>wXDyVr&CHy7@CUPw!M4zcz1rGwSE27>!-E- z@E3nfir$pOIe}_zYUjJ@+i$;>bT669R+qAhV4g&T)GDHr8zKrZGbYI*QkFHPH0MbY zS1qm8U z=#&Li$4`#%O=Mdk0B^c13n)g%Jk-(3*0ybC?OQ3*nmv{A zG0@WwM-qK;nwhFII{>-2JzEb!bm*2zdkU-rihm4E2mm4y{oEbfvtO7Y@c;f_|Lj;- z9?Ridudf%&0Dz1FT^bq!KWGZXU5zw}0KmEy1WJ<3OfB@HF&4od&O_#XAI6P?sEf0> zdw}oMV$ulB2sZ6ViLqC$T<0h}|#>%%&Pltq?$rj`-0+Hn>I+Olz%fAHFyq z5K;RB?tg+=)xbQAAwmlc%)wlUd(%V>+=V#IygLlVJr+dZv;udwv!{mTC+D17Z8;|( zXsr@s&It(v(bhHly(8V+El;_%^5)Ik>vg$Yub1oc_;mU9ySI5hSM_FI4V!y4sAdih z1kFR-8`Zs4H4kQqHERG)IFJL}TNkPgaSZ<4_F&rQ9zkY?-kA3gMq(lWt;)>zr_*^p z5&D#pyCKot-Tmo&QnPJa4Um`sJqZIif}T(LH0Q7gefRX(n&o*erER6&-#>ix@u#1C z`lHW2`TR#e_&s-j^Y$$XobU2luk&d_1Y$}OjadaS)CS%Fd`jtjo)QxhgkqMpHqUd; zDWry`DFOPjTvJYIn!%x#no5!T#0fHi! zgQ=OKn|Y|dJ4?8OxCldde1&|XoAuv?F0tbf=+0JaYl?{AeXIoNggCl{P*t~5nl?Zb znNrGIDXlf8ba}om*Hwh(IVrT-v?I}pQktfD5~f;D_vYw0Yc*$a-N7d zY9K)0w$=KODzYwYO>0qb3>2nn2vEd~)XfwE{sXbLy*t*49MM?EjUQNQ{?C8@v-i`$ z8|%wI{D@A+-X0{T6nG#+@&W62GgAw-P9ipkqv^^XuOnm}^+x0WM>P#dK!nsWo?i`ZU*z6-n5Q|V6b>SBVC+e&juUy$sZ&ZXU%oW3-~8rx|LyPp;mx~u zTWMQq?x+UMz#J67k-Wpd!J=CaXyD*z-3Y9!{f{KUMw=^i5$OncqTZK?eG~gS9$}bf zs<~Nfrb-A|k_e&uG|fyjrD-}%l7@9LN90ivPQu_yh z&gXNUq*{qJ>+Xn@Bm}Yv2G2bjSTPIHR+)hT%`B93(8108P_i61g1fcWBC!qV-o9bC zvhGD*h^=@>w&Ud#{3{*w(h3VVNKxfOsTf5R%Px{CfHdbHxIkLfIR{Z z-cR5M&I3Y9WPBGfP#_}+(*DEd`X1K(d!Kxe>Jv)1kEbM~5#D_}96V5agaQELrrZ7^ ze!yhxosi>)|5JbQxPXrT97og5%X7au0N@6@dH@XXmRjrGd`CpPCYYJg=;(jItataz z<#Km-_v+(M=hK&KZI74hyQhmfa!OlS)X{>?ZJ;*#N7i%bA)^I>7a3O)rTy_H@6Y1B z5_RuVjpGF!D8wTI(GR1hYgNVZ`T5yF(R|sKuDdht5V!&u5E+80DpESn4L2ivUY2XK zZLOs$@%HxZ+poX+uTSqTfA=?k_lJM{FMjW*KhB6-yIwC(^PHo;L*OJrB#6$0gu>(@ z_hV*6Y42df)>Ty&1SVo+v>-9Z)s2>g#-Z0*BZ>pkHGDp#dlA9782}CzHxL03V^$YE zXA6<>z~}&k`Z$KDF913TfupH{12PA-9y)D2Qq;Ob4?#^pkR+10ZCe30E|et^Q8;%I zS(?%`%^@Xo-7X=|sI|@WeBx7UExNRX2I@pCISGlXO5!jtM>4g&vaHa|&05`5wSwsg zYB^_c(+&rU$l|6@x9#JPXOUFOTC0l)@hx}_6lXk|pzU+W?+(UI2#!Q{xqIqpB$y%s z8n7Y^H|gE=sMIy0xpp1D20#O{*)gQybswF98wS)YR6h1=FaZ8P{JTHciSwgj@m_iu z7exI76L(YiTWm3i>Nq?A;x$Z7P2F9FAN@EkXpgENZdonzd1u6tS8k6H2Oa| zr}{9Ey}!Nt#mE?T@8E&sNb1-hIKlw;-2RXx9!5jhaV!77Bk3{sJZ7Wg$0C?^DC^MG zPjS);Nw1C$NU6B0X_{!vmrkdXnLRx{0n;a+d@3oK*_*eIUwrvhYep$AYjGrVFoUW# zLLRC1y0C{#=r^5$p>RkjXdLEyQQyz{j?IrxL!wHEf|-gUOiV%~EJ;K}vLs^EP(o^T zS=L&cBtD%_^J#9~k(|t$#ElKZfyB+oi9%B2a`3wNjWTP-E9mt10iNc}K7UgdYFcHFKUH9$j zU4^ghDofThSc_u=_UGVmbK)8OP}_s%_p{O1RwEIHUDwKh0D%AJfBSR9K&Xx60yu0n zVYH1$G%`RJmYqZu=}Fk+A?@^)o`GspcSt$!mF)4|9s|em6Ypa(KPGVQKqw>G#zEx- zI279N*To+KiEghyijgCLiHD)_er+EFyJMi=|L#AL_9Bk{$%h|!7-YZqen+?Q@bw<< zcOymsn5LO>f=;qDwo5MKfCT1#t{2=C8lSG}%lt@Z0~UjODdzkObo>vdty z0AvoT-a6Noh^W=!lGx>LMuqb|XioR7j!SlfaNi#9q{9b8ca;+}M;HwgAx7Y600S^$ zl;6Z)uC+CDOL>wcOr))a*L*1zk*4|V%v){mp0CZ(K_cET=WW}*`|j<}e)_Xzxqk8G z7r*?~f4^KFfB1t>e)Pl7gg_9zscsJHXt-Y2ZP^I1X`6BmG?2T6VwpQg5=68vf~n0~ zDP=9IFoT1eHx2w?;LOdu({cj;IARBmZbvjtV9!GdXlI0h#bE`#z6(R47#cAk;P?uH zo12Eta^L6!FaQ8Z$b_xcbzPV-Jf75Ampd|bH$u!gabh!7b0Px9W=h1861X|oX`Wcf zLgtgvqER011Yu(bkVI0J(>#kXU=yLtgy2>inDudUPYIa`)mqpkAwu-$5FuE^%mH^* z76j-z&C`_3G`KL#$V{U?2oz^f#yi+%nkF}l8)#+`MwwC7TbOmU)x*iPxnui?<0T7}QN{HH(vi4q$ zD^ZRi58@G0dPq6PsQQB#3IJ6r-aJZ!+8w3!m~aeFk?~vaRmA(NeK3pPKlZloPKVfY z z0vv%Pu%AX?7TC8iO6%EZKa-+38c8Z(56yuu53=A2;I6HfsqxSn)63-rCW`!}z@`t{de z{Kx;(|N6h?`IM$pBWi{Mk~nWoYgGm)t%j<9NHh zas(h%ZLL^S2Swz0&Y_dPx8|cYp{h(0+}7PAvzC@7(Fy?vB4o!<;3j6$rbw<(Yu&Eb zi&_P>ZCNv>eP`*ADppk+ea}5zhT&k!i9=iM^!W`%U{^;Q##RzmJF`8;umw1 zpuM-dKiK5-!JlYqJH{U1JqpTR;~ypEk1*K%h91M{2eA_H!|eDNc|Z8|=u#cS=w7z; zdHo^K$A~FfEsi(U1{n7|+IG`4Ez9z|-~I0EufKlx?%nHezEW$1{QA4^zW(}~r{~MI zmics!^b%YvhG4LG{OBP~U6Fmte|#wmz-EC?RzBp!?>>mbHJ zfJeqk0AvGM1;Zm=Bl5Kl`_xuitF;!@iWuEhP;0elpgU?UW)=pg&04&>6rHZ7?#_gO zShO`WB4){MzOI|Liipc~ac_j(@tO#e5FuJo*KX@pOVQTMt!pWaLXvo&sX&q}oMO^B zW-5`##N48{n_+aW=6MQ$kh>E~JS)>4*ogaZFZzD1wWuz3mgzpl+SU?w2H`F{ zv6y48$6$?yINmW0+Cy;E8^V-vK-QUs0rB8z0f2^lfC@T#MF=t88#mkyQc5}J0G+8S zF`5Rz*qlj_ENBh{3^sBGGc>VhIdcFSHpZ(d7e)M~9 zzkTgmv!vy61+3@u9Uyxk0Z71_0(#e=(vT@P002Wr2Lp8{Jf2vQd86Mj9>BNLvEMWs z*ir`qHaE&7)_Yz?WKsGcMJO!h0EB&V!pyQI|r^gvb(z!;uuXmWhGL)z-DRDaMx~K+gFz&xo)r%jL4w zVzpKvR&@;fCJs2WZQGVv(Bb*{ImB~It2|{uAd-|)E47pohA65^%mCxabYMmopiIpx z40#Im$QY4OG-LspdXekq>L3{Izw5g0NhJ}Pwc&K@vFn-BG-0iEP_w#95dt9cx~|NO z7}y~e3C}dw64fnyKZWc9>TPS+*0c~&lDuuz2O2s6EKx@hVQV^uG(F`HSQ`NGfB2K1 z6ERaVgR*XAEpClMV#KY7DklVXBmf3PNi%V7YPAL05Y?gM%7`7Xs+t=~qBv%KfR`NI z932VC)d>j_~IN@hoJ zx6pZqKI;@_HzOn_b~9}%%sJ&4pvZxFN!>M1Yb(U)V6_%C?HyqRPND#&W(b6WA_$}a zZq7Noc~uRxw!5d45J{V6NmI%Qm?TYkatuI# zcP#00y{x5>v#GmTo~9|!0Jtu7U5YjYm#tJ{5zfS^sa>y2Z7qdyC{o*2Q$5WS0%)zm z3{f(L$)h2JOFJ4A&AJ#m zg$Rh|zHSAOhy@AFz}yg-gf+AqF|i~724JF$$dWP=Blf{%YprS(0Qx`$zh*RGVkSWV zx2{`2MAMwMZGFC8npGq+P&IAVc(_qU3pIQ`-HjNBA$AlJiUi!d4a)!JU;hz{FbN_E z5;IOIB@s76fG}7_Cr1q8l&K>PxCW9)N-0OrXlG%%ca1Mc0PQ9`k;YI5%7KUoON<$q zIj1BdNEGE8bL7ZLgoy;ei6p3=?uIBSC8A_zIJ6o*sJnNn!?B`Ayya7SZ|GQ1AG-k& zi?7Ra>|^GfQ|f%`DED@Fe1LL@r8oZ$U@=4_5|ISmR&2uVP9|vJ=FGw*QDqRZsc&^- z=CBAn;(mj3GBWF6ZK;`+QfjTlkdm}kzWeUm@4owXU6)oHB9X(}w{O1q_3xgZu1WGV zP1{yVtLCU?O>OY!gS%?sMh=lS(-^_y@CFNGGB@{@hyyX^?yep4003?#ND`}0)lJdV z+zj1d?->LDIJ&7^YHL*yDdh}^0K_7UA}p=h^L1I)wW;?tNz!*6A+ZpX0yfwABmkC$ zU3GbWPDx%oyl{Ybk57{2$G`XEk3RVXm>q$q^y<@Bc}{??4z<-^3b8odU(>$LKpfL*@cJ`IinwC;)ts=RFH!XuZ)V6tZ5k#QY zHmlm|)@lnKzpa$(x^R-5a`4b&{Jm{kPML)w>BFd(qoX@iLJ`qB6On*PI6I&^y7d~n znQ1d(M8}hm!~^&{(90j#Ci8HM8jpo4}i*J zgo?ely9P!61pqPWI_k8J&V96TVOPMRFd-uVYh7v_ z47^5K}PN|F!}flH|@0t2&QW?%-|S|iX#$kYtXL?p0ZZ{EE7;)^eS z^PAsHr~6Mn|KVq!efCtAr>Cd;7w7AGS(YUU2}CN?@daBg%{M1z5(5lBKjyTqL2@%| zrIalv$(dEXl(lJ@=Ui)p>M^UyDMd-w=h7YKxgX~il=?mW0idq#6rYUH5~iA*$Q@cM zNS?A-Yb+-y)oW8#M*|9agQ=T(*JF=yN>ft@A>ZoihA0!EY-JHj`E&;ebuF#Lsp^QX zMK9~3;HP{?jMmLxU0WpvNfZeLa};%IW{g3-S2_%MMHo0V0y;RdGpaRA-jZYU?m*|` zkj5A*A>zR8gu5DA7+1fCYjglli4n!!)e5*VGdj3htnQsP5TS66q?ib&X$1^^XO%bt_ieXRmey3GU_onKA@{()C1Agn+1C6n144{s$ zANO-t>f7JZ-t?%o0?^&v-K$rx*6U(LnW(MRnx60GyYquNJzdr*<{D!H-%Xwq@dwL*h@634^`?Q)<3p!5M^gx4t4az0 zA%EKXL1k`$Zs2Z3n>i=~IjI}CcSB0|Qc7l8*L5a&`S4IndHeS5t5>i7@DKm+n{U4P z%fI}~AN}|z|Lo<15o)cb?aiBakC!I`yFZ_DP7ZE>fGl~UBt+!Q4cr)!*ua;qT%NC` z6iLkB!%LVWjEBBNDNVJ;37R-L?W-=bQj8%jxPnJA8A=?ZezKr4v3C+(K-?&jaPX>H zGiOQyrjS^d^?JRA9$nV?L9}K^?(yXJd_t5O|oh znwfd1Ed!Bi4Tjxb5CZ`^F?V}*E#R)iNKUP(Y9->tsg1EA5Qs=^+pdXW2T6_Nbbde& z-wPD`SoOFiB}C7BFz_8f!FxCd7>=kt=ErP#2WspIAne*42RXP8LfC$Bdwu#rS#4(K zkP-t0v9uQnM8vqOH*(5SYb|9E%VK;1q~5yF6ox{y~i z==nzB-{}cNRLUkIssLyyr62zA_lRW9r*Eb&t+uZ*E!TBfwslt%VqZx8qP_wOFx{N3OE z?dk6P@X4pAhr8?by0u!g36d(72G(jJz|$#Bc$)80>f4V+n3E#ZrIe=4oE%t$2}u}` z%#kH0nMKI7nNpIRCyApO`@O^W^xO_uKtOW<#57nBH^f_nYT_{Rar9`E0)%2gS(dUq zU7u7Hk#{=D9=O$_&W=iw)oPlPyEkv(fQ$}yS)N72(Kt~Tb$39-G>Igl=$DqwiQF}d zoaS7%hUDlLQ^daA5W0&v6SzfP7e_3(8Mr!#q)g)OrPgSPIs{~)_agVUTL9_bM;tm* zheCEVqzBHyYun7(%xc}t8X3BKt2Jl&09F&>!bbM%?%)Be33c67ke*E5Tn>w~W1e&X$dQTtBb)6&B}he#8SU*7}y@z)2&$cTC> zP2+!qtPyYo2%TA1vu1|w`oT5qn{&VHBh~Vl^nLKZJ74JdI?!!VdfcZ$?kluxMb>FMd^%aNa+dus0fAHzY zpS^r>U&?B2ozlzewHYFle@3~EnM`~(>TYa~Jv zdhDh2ra7frO840g56~S|((hpm^m?ymd~P1VK7`P7K?Dlbv!;N~%%Eo1rPjJFHB579 zsHPo(&yj{kW6=k;H|1nz%d(hRD0Hmr8u-m)m6LPMIj^PWoa5&KV49{W&F<<@%}9NC z6RWmXL5+r?d^{Z;t+1T)S~f6q>YcsXTB{o;F$-_{U~Tp!T12dybn0Fvj{RJ*E~EfHsG`1~jgBC8OA3Y1M+@AV8)^sf zFrazYc^!T6DAV2(`i@VIG|K(!dvd3pqJc=%?XnQ!zaE_jnFkb_u7nH-7cfR~tE>3xNVOrvRUjG!3}%r@v4}9q-hYTr${shP zl-^GlBFb5i5ilrt@ke!FFMFf9wHEX{B5Jj{ci294LvskuMwCSnhQh7eU14Oh$D3?s zA|VXuh|ro|o|jtN>2!CO@67DQ!^`RJL8kd1{{Fu|Kd-@Zi@!KPo$-Dtq+Q2-qX9^6 z6rSdw0Kh)_O^4G_Rihta#Ni{>XZ>U4sTmLkVf_f4>SqQLAd(~lwPpka$mR`@T-5-b zm?#0?7-Q}b)O8xLIEcQrsv(o1Auw~wjDk;3@BZ%Z{*M2M{^U>oNC_@nm`}H`a zOKF1@dOKeMfFy3L*Jkc6i5$^@O6x(^(W5>}X(FO!TSMPdgsdqeFr#X9ZD#1?pn&G8 z%~ZSQjP-DAj-`~=%xds-$lcLx+ZHoxwE=+Y=2l`_U7Vu}Abhr0y{^i5y2gdp3I8KjXKe&n*GefO!6DI7Hbgv~W&poluPJ4G|Kk|JkASCJcL8tLynpPy(f7dlo#K4EY$6JX z@5n1VhOX9%2veT&G>5Wv44p=B#9F)ROs%z)8kjZJ)>>gk4R-*JP#8!$c6UGujl~E( zL>NAZ(Fr<|3up-PhrIvwy3|?|rzF#|Zsst}X9QYHyIM3aPO4tiU)Cos5SuDtw|FLIjrl-bi2HL52%@uk68i?pQ{*bGIQ_|v1yG4 zY^f~{J0ucG0Vx@P{|=M4Apz;`wH9Vc#MUYS&QmU}K0ZCVd$Yzwt=3=v@|Sr^|L))X z+mAkad0m#L%Yx2mCdhZ^b51z`+Ga7S>oOv>wCi26qW_Gz=mt`^2EbLYsv}=I{ z*Hv3-FiMz9OwYp=M;5hKvOOO4Xbc?PrG~fG}d#bp9 zB?_qcdMU+**3{@%zULSkN^x;g9y0Emv0Yr%JkJqOL{d}JR>47-L&K1WQ%cN~l4vtG zKg~0^mu*7~T7`F6P5==`z*6co&mnvlD*bV&5D^RE0hED=M1n}IsYqfLL`o@7(`@F? zmrHGC0NV7`$De-u@yG9;E^pqx+iG2w_3gXIJWV8dT}yDn0bI3;(3BH%I5jCFCrNIg zS_26O7+x$*L_%yYCCNEO%Z3PIBokzvokQ*9hR!)5QRggotVO&LvYT7kLHW?!0W8cA zJn*=qNzL3laptZ@fJt~tSwd8C2rC&_)Asv6`TdmSt1rHor|IRxL#gHA;eMKDG}6)n z>E3F~lFp~Is}T@75hpXRYt`0jsgLiTOI@9S5c8By^Hj@rU9QZ4;LGK@EDH(F^Xv$% zQ~=B=_bnq-wyo9z;M$rZ(dFrRnol^*P;0p?=s2Yr zNm^|?;mtiLa8hfhQARs&p3eZdEK6%OB$t-!R$GmXtW_nVQd%hmoe0Td!2_Ec6D3Ju z+B2W>G-uPcE{llNS{Oja`OVC=v{uvsnG*nRTdB3BDc|4UQ;>RGYb~aBKFz0js&xae z#I&m;#mBHOZm~mmB&Dhnu{-uU4{qo&M2LR+p}PgvY?=~uG**C~(Y!-h5Rq5_y4H5| zLxm)e6>x)L1$orMOFJZK!b!e0Wv12||BwIj_c7EVahF%=HE%R@5Qir3*t~S0obR6> z8war_I-t_*NCet5+5Oh9sFDPE0* zLRAF%snDTOW=bNadogDHaiR?~p5yck_oQ#<0>)p-X>QHt(>bmu<%~$*zWMfV{^oD) z@9(!#0kLdlD_hPvNg_ss3a$i@MUsfBYwPO2fsQa!^JpDZ?7f8!l?(A9L2|!==ZHEm zG`a@J(QdppmYqcSOFq?a=O;xL@JJi~?Woy-H)unDRh^?yO zDj0K^ySuxm$H%6P2&OyF-f?42I&D0I!_^D0J7^s-=lu{ZVIWhJKs&OO-lq3nK zt!!o*svn_>6grcknUuQc`zQ`-b6_E9%>ev-zDI<0+uZ%({za`-O=(DccEC<+(dYAV zRL183XyyP&eVPOTb%|=a7ngAGA3h9`cC;+GGgF|k_7Jp3#@IR^v_5w#H{4cf|IwY3 z8hR6>%yKgoQ!uuOaJAM5!2}$6lv zrIbY20E)KO+QgI*!NrY{D9k7kn2-R?v^Q#n#obLoo2yowyI*`Hq5D~c2d4a9-6LXa z)fG(v0o+jCOLGuyLVgmlHa}e<}j2zDb%!d^!R&Qc5jA^ z^1&TwOl3pW-&<=D^W)l>Qw$tvSWWKtd4H+anj4C+8@6g9az4)h;sCX3Y4!Pfxh&6& zkTS6Vu?5K^u_tt5IOlx-@apOExGbC34Jb`anPxy-Ym0t|S=$RA0Lb%nt45mv}%&?d9+e-QQDGrc`Q+3^cf{(u78FDW`}d-}F_QsTQJGQ52IY|ZR&Qqf-bzXv%OS+)~Vz)D9GfJOpqLsTO2 z^gi7lGAsQL^m}go`RuQZ*bzmo)ji`r#?t+4WR_`~h$vb%L{ghRJw2`KN`&8h^VP3^ z^^Xqvqt8D5?#;JC_~|E~eDvz&-D$o%Pp|IpKl}8RX$3G)XQad|EC`_H!W^Q#YKnxx zJw>KzPS`uCNQgOf*NHvsE5^a&BOwLCJsXXJET}n5jO3Cy6M~y`sSC(SQqEI~FsMz< zn}T(qh{z!)Wfo#VWa1PwAqVs3VPXOPC}rEWt66h*)9^-yfR64H9R%8oYcn?;-7n&UNdB$XJfQdYjZY8|=uzdv zsDSp`+TXYDg)rv3;dyT5wU0Qk7qxpoA-WLRUA>P4jhK-cSu89;I-ju%Q0@-S@ct-i zkEe%db?Zp_pepTM%e^Sx=f%5YZI9ZB{a#TF^&v?%J7V%NNR7-caMKArHb?eb9R2V3 z=QK@-U19){qSKmEKBUz*kv(^pG##UJXUjmBg9>T5y@>84rKsfr2yEywgS(P*=die9 zKw_N@(F}WyGSEMWXs&TIhJFTei(HR#eOG5W=?|=;XAZ|P|eM)Fxn}x+@+81 zrs?AsuU>w#Y;~O_PbYUWfEN!RZ`<9QcbCU^Pg^kyib|`TCplOo5D_pTgaW*Q8k#3! z08~Im0t_chh@H@xOSl^=99}9E8xhPvu>0&`Fhv{@oY9340G%)~*+^ReG4f4D@?GKE zB3D5Ku#kNml3+xjT62~k|LBLMl(JqQ-@c*gF3)qQ<@TC^kdTbn6x0#I7&Ck_0a>PA z&T}$#Qw3GGrWxo&mJnRPg)qev$%(dYD`i#H=;e(q5Zej+w8Sk$3jk<9V!W4_2H?2W z^>jKV5o=9bDcjO&(bhH(Ne=cf%&NVsGi>R6M8nSCHE?kPa|X}CM2t>(lFReb+D1H4 zA|Zk<77t}BrEF#fCMhuywV=R8Q!DgGnyFf>JvFauo2JBq&rk2%?Zt~1MD+Cb2>_-k znKf%0bv-8?`fdA4wviL;-qgLn*QXU8e#p1{VX#P}9K=Bnjdm{d(<2l*@WT}3y%^eE zha+RV#n3=)w=Vj3d<7)J$iRe%S_{Z&IJ$E9IQP;xCiS=941r2LUdJ(v`unIWA6j$K zh}_e+9k8}z*Sq{j3$Su;2twEtIL4IBToH(cFaY7+Q!pGS&VD@+KK3klzrsBq+}ohX zpRr-FxAy^dSi+tv(l8<&6Sf;&DnhDAKh5?wLQJ#+#=mRB?3da>MSfG~8|ia5^FwkZ zcL+W&4WS@E;9+}u7w;%!o&i84i)4r8qn9tXvS=+o{mGAi@AHqp`{woE{Pkb{$shgV zd_IHAZ+`PT5P$VBFU$7rcW;04^Iv>xN>*E0%4UG1afrS%98T@%YXRCAAbJ%AN|1}YAcU#-~7>^|NiOzl{-FNuK!=U{`AR~ zB)bp9&f@M7cgf`~_3G8$T~*y^^a2nI31Ucs1Ub}z8esHI8p&q(MW1$ z#6>c3MgY<1Mt4_t*Y@_@^WF$|Kj-Mf@rWCl)st5CEGu8Wd*ep9A3w`)Q6!9*C>1eL z5K%Qjz}jN78Xzc^N{oQ0phf_Jy1-%B4_%1JU5tH-Ju^$yoQEzohtzQ#Bk{c2eY={m znSdf#001NloEnh~>TFmtsqP~Hl+% zPBZlEUO>B>Ihh?w&*e185XsN1AfmNa_cw1GcC+lE*MKKqCaHo<5G>2Dc&@=XKYMpJw$3cpqiIq zbbgRCWO}}tz~m*_l=TZDhe)-!*$yq9_n}0X-jN-mZYEj_t)kW$jBpG1uE+1koz$C?h~b z4s1}Xf-w?;vD9h+9LNwn14Rf35iy!VDK(cm4!5FN6~?h>xv4d;*X!fs}VV*rH~VzNmb?@;?sY45b)d6~JY8lsvJGuJ9%Mk^CV(CSd(GUga3i8g5D ziupiTrkwNlbAAUCq_l-FM49LaHVtI~vAPAD|6GJbcyTICWCro$+RReoT1}+n>|z`~ z=qHcQw%}{}^-Q`6%_;D3UTJGGEIO4zC(EjNygvV{7~@0}XhCX{@;zW4r+e*LbZzaB z3E0RKU9^0Xo3yDXi@p+25qw;41mI;328vm;R5O+-yQC0;lstEjz`c(AK{Q2YbT+1% znP?gFgVW=2++Uo%xw<^RxOn~Q#d8MRZr5b+`t@rQ0H9LK`Nb=#_V~%${n3N-n;U`i z5L4>93Yk??*X81JiQci`5CT*%lbVY%N&y8GHZ>4YGtr4bY@mh=rmecCLk#t}>3W4N zhJrQ;%T~@oOvyk^0o59%rB)H^QZTcYF^UI_!hk6yQ&Op5-c1F8s#>q)O7m!A`PO?M zlv4ldum5_r*`)RQ?DqEY)BQW|eGt2T6?n7Vr1fS$6uGdR2ZN@MgNTWp_U8}?j?BCL zl~zC#QB5f^M*u2fSt_Gds97^=4lb#Qm}?#L*sWKwPi>s*Mb|Wg1AQKpmwr7E<U|rB**~tEi{}5+J!UDH0I} z4#7#6YOq@O!?+g}4y>l4f&`*6<`D@+rPSieVQNZI#~Q zM5-3MRTUk^OdMkBkOFbw7`tvg=CU8gm^vh`qJg*zNvj5A0+gzOLrR^Ri8R?g*Nj18 z0Mx39XT)KPHB1T>y+oQ|N3lS+f|IJT+^7CK(ysAEW z^5ofz=YRR1f3{wyPd@!5B!2$-^_$C^U6x$sb{KZ!P|Xx^SF)m3&`J0eeQFMBpcp9i zVTDFMS~J9=W=usji)0fqRD?!{uR0DRAw>#O3#i8EfO%nW&Q$SNMnfh-4oJupo6Uim zikeDFNlGbsRJ9aiO3`7uBHE-@2z44_B?=52F_^&RJ$QI}d~$SidmTbtZF)eeQiura0E>H64pT^{o| zj-HW-h<8iODx&*(m0{SIQW1H+LaAE4#6Sci6`TAAS{KiS$jrxtllm4i`2Z2X#6&$Z z8W#R_LP&kmNFkE4eU9U%yXH%%rU_ZB>H6${TqMZ z)aLg0Jy?R9dJ|C$$%#h(O0HPsEwHXz&D5`w#YpF+)3nSH1YANKvNdo{B({UJy z$u+SX+_I_SW6c@VV77jrM&t-hrWZW_5HVF(vE1+Xu}kaC_VmGnAN=TtKls599=-Ks zHx5@fH^VT#{mxq-fAYzrx86EFJ$d`-J72v#yT0A;#v#N+p>u#_=sIVL&g~qp<(U~P z1&R&Q0ES2kq+o6(q!Ts@oAVk5AX5#*%xuoTa0r))_mRxZ$>)p&NN%PkRcftL>I{tS zLh`bJnK(o@P(wsTYYDkG1HfhffRPZ;Ohr`1M6K4c+wXt<`RC7{eSLm$na6Rn*`A)B zGE*QFl`e%YaUSxxAJ_fr(donWdi~{>Up#(%8rUw*UaAh8RU$+c>0-(vA%)HH)`Fg2 zy*a-=D`kAJJ=t#7Cl5}Kj*t3v*RT7oPe@cs1^|&#q-dR-iPKKHt_0 z+ajAZSYftV@gL508cdQzQygfUv6NEXAubSrRS^S=A-b2UV_=+a;ZRnm)y#Dyx>Vid zBR}`X94|aIwHhwLOw}qPpjS>V?(3+21pv%r5fNEnNWC?O6REhtYaF>sR7Gsggr~|L zut^#(cM;dObr^Pls5&sn;doa_`r zV3$x5ty=uUnc1wLr9o)nN#_xNiNl{?c8;yM05mLrXKwi|os(O)bn(A)oLw|Z?)0ri z#4-6Pr4T6RR-5E9ghU>8Bl5%`qj5jeNT#-$PYnc1yaJQLz_{p8Njssy3 z4O}w9kdQ+lHnZXf#U!e>Y*iz=35#lTHr3YfnFL}8shaM`LBS|e3ej@CKEHVW^D>?B9LzR@uvLw;yk>IL3G1d3169au{zOJvjd0y>H)KU7WwUc=+J435Ft` zHV&okZgZ(4_lQTx;HYVpTF|sf=Q1KFfl+9(hf>fy)0w+x)5GVW3H2 zGEnQiA|g}g-493Ox_8sOr~nV#P5qDNhIhGy{eJVvIAiZ4Tn|^P(p6(@wi;db&9o zvYuVutk?ZpPv05G@#`0_Qi^ZC`yn$2X7>lbydD1X$3OX(|N4L2?TZ1M*?vD#fYh%{ zd6%=QD%?5q%-p)^?w1juV|Ngd(TwQML1m0fJnY<0r)1U$J$d->fdF2ey-6Ha+s*OGN$C1o z$|iJ=j*e`LUwxU+&dwF|!IOs<7q3P0=G`X`9~}qMaU79pKa9*#!7eYZ_hp9|w%gOA zE=CSuT5I-Q-Qcc_!=PoDAn5+5fNGtMZ||+=8I0_kF2>k(9iWCtITu=uVsMDHZpq`?6qX0@@5{M-USA0K%E+Qvi&>gt`8nI=6PXG`jsG^t1Ue~*so$p5jVT$+C%=xai zOzRucMa#VKn^AT7SMv)ZVweNOyt0>ZWDY>k(A~VOFZ}wJvz_~K3Z_x4iiufOL?z=% zZL--XAlPJ`28dW2bex!|l%gUrMpJE)c@t;|CXmg&qr)bPy7`mqLUTkKf1yc?&)+xQ z-$@S^rfJv=rdi(BWl#Fv85N>WT-nsb-CzROTKkwHvH6~NfnS8C22W_!k?CY+z7X#v zxsEV2a0gAars>@-5{a@@ziHLfbtlb?j4y6(jH3VxhSlao;dUrB^{dx!E=nCAK6rd` za`KB`{PJJ^%YXTw{?q?@eLH%U%nT%l^I27ERYQh@BbGmb`kRu_$qmnF9+*2I%a#3r z$;1Jgtz1P!Vuz|6n4*4H$DtUxv?v&YOcwCWK|$3tVmn-IN=p<34$KH+bc|g);mlCA zh^a`4%rXoCu#UPLa)|w_7caY2e|&O+$QYObLrCk@X0acIs3`6Xahzn^^Ejdu|mVCcncdOpahFr(p*hFVc zrY4Y?Rsya?o0r}MA((-BFkxW)!hCf#RPq!D+6_M#XIK-Qo;FjAQCo#YF?Om@%IFpf zv$i~9^U5T0FX`Z!xK5H9u!zgJfGzq|3L7B7t2#hXL~16R2bv7bW*jm#4d(E5Acst= z-{ptMW0oD};2zv^t;`(!Jxa;T(e`|I=F@U12kY0gj9=dj((TWQw9+PMAnr;54u`~c z?+gS14FnBbE@95V=b~Wt-Ch=h{#SG3X71JAYZ@#Qw+SwG=ZDKru`D^gSh)8A{q;SG zn>)5M4L|nH<-&i$-0<)-Eozxio0&Trnwdu^RULB%fY_ybsqvgyFMimL?hxE@q#2aE zj(P}zQ@R~W>{jceW7YcAv*!TXbzLrUd~zH@K;$pKe)%^){n@X-c(xnz_T+>#O$KeCh+Mpi~>L-)FJ|6 zZF(jk09}ejDu7|&6q1T)sfuc7E`r(abs#XEAFG(M5B~k`nFzqy>o;ew&v*MVb?a9z z*JG|kP*mP}>#g_Rd++VH-zkK*SJ$T4ZB`$D>%(`RKK|gn_YL*U#rgTg)$Q#*tE$od zW*0)(t~bPSzuyPOqps(k44{-!tC?vaFq0T4rKDn$Zkd`H1w^G>iz1+!`&_$ku2Hj! zueA;(qgu75i8J2ZfYhlA=Q39nh`RMEb}4p!>briu;@H(%SujQoA%IFQ15Cm<+Is2g zhA}g88ySaTXgLk@Fbuw`eV*)ZI+x@#i3ZRdw}b@qlb=%B=9T1PULw->SS!`4^G;vZ zSWE|)kw;b0aT$ozs#kbRw&eWJMT8meg?mpv+HIfMO>;tR@|)A9W&OAOg$5b={ZHS; zNmFM6$+z(2XN$kV+ywEh-YCX;5au}KO?NpqNKi#+Qf+~$u}I(0H1SWx6hIUK2v9`` zF>-J;Pa|$4buqbSZVEA%iKlrZYY-R>R>}R-zzyeyOAVLTY6o3eX z6KAkdhZ`x~spFpN5wp1^USLO1A|i3<`b`!QlfLVGmQ8@y*O$k~C$-Awzy9(+{>T6L z;~)QI9J2vjo?mTNo0j_`tGRZ%)5^#vMf2g;@b>0+3=fAcwjQ)Mv900UoCoRrSEwq6 z5CS`di2@VhVNrXC0|2uaI%WoMhB)%nTb~5`aj&&@DfTJ4m=>UMWCQgFNp3 z_VD?P38*R~hvP7Gj5lh%ZJ<(JCHX^Y;poRPG#E{%`xf_mkP*w22iW=A4IN@YYpJTEiVg?Y+aJ>pEt3K`_OGHq|8E zfy-mbtU(N?D`|4kwN}LT*+U3mR7%M?LoU3sA(xszlV8J^0~ofA8l%|M`!9 z{F7h(>Q~p-w^!$v*Sj48KYaLjcfCugBf{P7z8Zus5yoME8)K&c3OIWmwuA8Q>3#1s zy?3`8MHb|nOX#o$?tR|IA(5<7opp_9sAg13u_{%vSx?}&GYJ&LWe;t7lqw=ZDF6W2 zG|d3fqNpMUeMsBwx;?&e6sfDO+udB@W_6ZtpMU*T->;uOednVO-~G-f-+un}v+aYE zGL$dB{CX5c2nOMHmv3$dW;Udpa~I=wd)!ANfb;WRh9|)W&pqw&jRo-jyLZzw=I$PZg0&ntR1Wh?v6e zu;0t{W!8eAs`5b>VrIv>j6ck31D+JeK86s6VeoQ(7Vw;PEa!@CE>&lBQCJB5v?oG5 z>DlTxcm4AGK(~cKthMq#{GCsIC(dh~2T;%2;GT&cV0%pNt2u$plq}iCLi^=&o=uWwQ_!87w zfyohSb3Zr6sAl6h)?64Vh9)xVr)EmYmx$RxWEzqD@GGUb3Y4mbn0CA2^ug(N-QQka zqSnWcPB-f==kfpdzx*#>e*SAje0cgm#jY-|YN_Zl5bCWrXdeB98g2b-xi&Q}E*F6PF zU5AJ%g%rXnhFS`m_FcEz-)1Qyl@R>lff)f2Q7uj4Q&m+e2TCcW7**=gW(z=L&f0u< zOlmdIi;J`CtIMP9`knXQIXON?!eJO=*Mp%U@Au=`n~Sq^cPuqCOsSKq2GFOtyS?7s z-kuz-ADpZKe1cd_#I*`-s#=?9u_+P{In(0!pV#f2>^p33YFS!fN+E5J zj@Rq0s);%ZBzFKoM6WMPIcNw>X%?74j0XZ?+ov(j|EmiDjTYs-W?=$!8QW%q z;f$do72MuEC2HEwqN-sTai>>5O!V(X#`zRl<_@+Pg5Rs_y{4Mmlye&e7QKvR2%a+S zLwLdo7<;FKb{Bgzzt{3IyoWHuts2_Y8xh}NgDum^J82Zi41%+}U+pyeMglc`mOGtU zILze^Fbg6A!m*Y)7oJ~pK0@bysF~@sBIkuNzY8c=z4Y z^=5^p22x8IOao&vSNV1KO(P;?Ml%c{rQ{d@L*RfR5CO*ZI;Kvvj>oGDz;&oQ;XW*HdHwSX>H-MA zEQMhj%uFdQ0YEs6*bbrdAf|cmZDvi+WzY3q==_ZrHz)t|GgyvFmJtvUWqMwSXs*G= zEFuEtQOyy={wFOClivtXozL)go$k4W=w6HlVvQQM{54Z^_Xx+*-#0O}W>k3(U$y8? z;Ni2kCFOc9ZH4(E;qT>wx~{;~o`qNiG-_Fa>Jw=ld%itwIc;R24fIz;Fm)?mCs3 zo1_Rfy+rT8fU%dTK5eKXih&-rNj~)`W&d$zuL#}{EA@wWZP$pUe zGY@$;3c*spDxiN@hgWKjo5!5mdW z2sUMD(_Z%3uS^@Zok>7pnFuZ;nAx2e4giLSDbs`j12LB(tfiC``xZu*J&rl*O>c7t zQMH_a9~uOUcb$K7IJ?XsC{r|0=d&ZYuo(e1&r1YGag6#$CL&HlDzz-=Eud|0RkYzClYR&o_E zW_Hg}v5L$ort7O)n6SgMy^RA!{f77xZ@?ALybRRLL6*K<)U02x_Tx~-VhEg~%g2|^}004jhNkl%<6HUS~Vc{eJmNEr4zF z8_%bOvzu)ZN#{>@kNj}x1vehW!s;F!YEx;VyiLh+6;)*fu(>1d?@~%3K$m^@3nFwk z1vE1hoj#QhoxHee*djzQ6^E_}Lbpom)rxTy8D2g6`q#hw)mLA9x$5G@#nq6D3Z*WU zYUh_%`yo^4kdou0Ysur7i%H-VQjn@(>I5=y>1zNpVT=Ik_9v=s9FORpo#4Pk0GcD@ zTrVuoZ!>ehrU+*N-1OM3tNC zi*XzfF{Ky-2V@N(Y6QT5Obp3yyQB~R712TAC2~9cG zt7K13;h@N3CScg+@5}UadD_fJ(=s)_N06t5hwA`2Uu!)0ufJq=C8q|e*;JmCu2=1f1%tn2*>K8EP zJW5v8r%&I0`uOqV#}A)AefL+t{PnY!uWoL~7tdesN0ADYQmKakVnLn0yto1V%%oOA zH>q>%jZH$y-W3r5p639ttWoYBZ*VYVr$ce`&Cc?CpAGuHXM|d79t$CyY}QAsz7G4p z_!ocn_T$rk^Kbt3%aS5hsbh`;7DFg?JUQKV>zG#DaTi7tB}QO`42n1w zA)pX2AObOJBPPVy0Vo9~4gjXrR5bvk>CP-0XaL}oXk37}{g_82Gy>3CYa?zTh=>d7 z#~3R%SuzC+Aq@L$q6kccZo6bAQjG(Om|OKQM-fq}NJa}C^kunlZ%5$W;eqEuO*4Pm z!ib8%ld`fQ5Y8rDcTzE&moXmZMY>cKfX2F(d0;a|10N`n7x&h*;}81rX00KxWE0Hm zQ~|_e5zUkb^JcApSu?jZ0Rw4QDW;}+XN)yHr-m3GAvqDyJ^AqUUph7Up`(YrfY9SiZ*)P-a)Ts;$54TEECD>p^o1zvdF{t`CjlqzXh1xn(5h zp69Wu$?fg!xW8Ga_`UCa?_{&xZr7jx>Wg6*N-4uI+}`dTaW(9A>&=O{sf8ar1S+78 znYES-5fPFD?-fK zVte~f6~t6$zM#!#CIBHGZMIz>yicuWOuSyN9~>V)e0Q~|BcD%m59W%ATjK+t6uvhb{~QqNzwT zrSKOyJSZD;vm2X(pqGug6k?7ckeQmfG!P)VA(f9ZW*QnI5yN zf@EfQkYz3YLU2;~y>lgmxHvg$1K|=ekv0_$GXZ2EU;~}7a?NM~0L)NCQw&qqIios^ z$iPSq4G1ZKiA!n`!7z^N^}6qSDLJKX)o*vh`26LoFTecy`eq>RO1*t`esQ}SyVYhB zB2z%Oqo_qh42?NZpovM{Oiwu=0g^$HY=&B`f@(Dd2nK|#=pJK>lEn`j?{^qDs{z!I z8A081e9CkboPGy-es$T$C|Vid>63@w{mv(k9v;7b`QktP`>XfgfA`xTe{}lb_}PmW zpMCZjGk^a1=L}S8MSu{{mT0z*Jw5*5gAd+*>q%D2<9@f>?{4dE7&-K-&GzjlkFIZSx~?OJ>)mBo^(ULHl}x5& z0BT;&Dnba68HTa!_d8%)qxGv55jnmU0NfCan^$?8F0R+T7x<-!3rRBp2Og&^buLZ( z`&^5v7A-b8z5r0Q5?djujW|RYC^55CkfGFEV?;nz!qBCZ!p+S!d?SYH-Ok$_@}}yi zO;Al0&;x5zp`DTvCuJE;IAX^=F0e-kPI?jX@re^M5wWO*iT?qu`iw-BbDkXNT=Css z08$9m00aaiU@!y*y_ZcNk|6+4Bx1&9Der1(2xtvo)uvjaJ_*wz{&| zQ|iZY48ft`5diWy)xstK9%PLgNZeyi^>{@@%!__3I~3-~Pvc`lnxg_3Zicm&0Bn zcC`+Xxz-vm83AYxv6H$J_rx^K1&AXMQwpdS7)=y|d(kO(82YuD^f6T_!!YdkyBNC% z4<3B`!;e1v@WbcNUx(P0QqIoKcelgl_~hO9K79D-^wrm2ht#1cCw{Ox?pKK`Mhv^F zb0b_odaz!tav42%p~-sFAqR?N3cKAdgpeYYQivd}l9qaNbK7-Yh*bAw97l&jBbsS- zZ+Fv@$C6?)RpMYqwPp`2IS+`OLJSZ}DJmL}5J>54*C}4{2q=iMKs)8aijYW!7 zAK#f-nXFLe;*v0|LddyRs4+%1E@Kh1lu|&dwHhiDBeN+WGsl>71xTSCk$7i7G%*+N zP@bnuVKF{ZM4n^$%&(s)Kt_O8>o_NiO;Ls*U~rQFkI3_%06-39b>6*u5rY_*J6wYX zZ*W`71&tHw467nk1R?~)p=2U*^dY$7HMIJ2Lir;gka_LBfUmm9r?eBzjA#G9`MC4y z*;DmpLOR`<1DN4(ukHfBd>)D*vFjPwz&wE^*AYFKzS`6+#2L@K=tH#>+ziDq#z=u3 zKP06pcNBPkbF)g_cRv24?-Lq*_58*2XRkt9cPqZW8Qz>-7O{}JTm%tUtJUqzn5$OR z+Kk(nnVZJaBHwY#MMR!C9c1nkjQ~i1ar z06jTAy}7*DXL#^9y#4lDr^nmtYZ>$Y!RhhQ$u_0_#fukj-n=-D;f zdnv#Kl(_E_GsO^GY6aDR7|8(9fb4J(s=8tal7Rri&3>12E;V=k>g~sGz5Vt(DW%(+ zoB#Zu|9Z1MCcx|K>so7IWRpJ76=)!oQg3dqa-X{JC~&A_-mcbQ#hWL@7-M8cVklBE zaEu|wU}#7Uinv{Gd?3>IJ(8&^Gp<%0Gdgk$K`U@;l87jXDFIY~!`#A~+K7m11PJC9 zE`|rRIRcOZc?m=U$b?`(sAk!uS`{)TiyVCvy6p11gy6l>-V;&^YzssL)>^EGpHkZXR>nVyZPqf$7Hi zFvL4qIE{2@@q&slh53cRhfhEJWV;uprz+5Vi?u)T0NS6!Yb)tpY#ji77}-pt5CO}W z7p8KII>}z#9V{-ZA@~h_A8(}~P7DlH7jXx~aBmsS6QOT5i07Zr&4+0yKVd%ShcX%P zP8Nx12f@?1^Mi1JIje_d0C3+IkzyvbiV?0-JUZG~se$qK=IZ?Q`PW~6d2w;|@ZrPV z_08+^i|5Z@UYwnw>3Y>M!7vO?WUf+W!Up+UGP5jBg8A_9Q`i8+kE=E{a`CPOOrkMb zTm(;<>5$7%8`pYEnZfDz?bx`!zLr{3fR8@<=;Mz+{_w*OZ*H!xZf{ab3|2~g{`~p* z`DIFRyIs2#H-I7o1q>8w?Nrr3UG&$9{s4ePV6O3cNBq<~Hp^Ns#u#JV@Asd5_F0yn zpIzU+c==LAQixBUJUKZ&0;y-OUw-`Yr*FIF6&A>!mhna3T&NIirN#L)05bV4|eZeAy9gT3Nyznl&mK z@w{N1u@7$dFiXIQ3X&UElPJ`hMXKX`Yn58_f-J)T6hh$O0GmV0Ywql;Hbwbm7gD4i z7Wc%3bMmMzP~H<`$bZM5h4>iLz*LnO9XC49Aw6Pv55!u{tG;lT`SRT~@j%R(+plJ3 zAV{d_;_jXyse8|h7WGc@;lmypZU^Vfd+E|r8FT(CJh*00A;1oEw#7eh;c^bmOU$qz zXurvC{Sb_rfU&n=KwzQMB_h}aQw|Q#aCcrbH*1!fPxs>Wy+}9jqI>o@1do%oa!ftZP?nyRVY zmFYcv7Nn)vf-bZc4>5FF9z;w8#O%FbUwTWH8iB)65I~TC+Gz@12M-=R*lxF{r>74e zp1wXmJHNOK}0VJKY+>+PoNB7gx|w@QhC zkX*4C7!*}i6Lu-3e&syo0Wlx}5yaSZ7y`D!({D~GO|u-4eMmN~D|NZ$`MJ#4Am+GO zhldB@8ujg{XdO&Y758Tifk4RRHeBVy>YZ`9?}&wC?l*vvc=+DW1}$y|WpDt#&8+~e zGKWytt8Obtq$~)Uw#T&^nM%RA!mIO{x z(93!B@=F>Z=I|4m)LYHWRYJVjcNC_!)~{#u^H3PL=@AhlK?5xu>>2KLDxl#f4%y|L z06Gk9F<|jCnX2UZ`*uGk9n59WT)y4>J5x*{L{zJ0cE~TtObp4OnMk|Z3^=tB=A^>V zZRHWkj6{ln5m8kMA@p%&KxG_D!C^mMoV~ujz8=SM-LHPKL{!KQzvwyI+5>TKQEyHv=);Gr>7b!Ahq0ZS~&n19JwuR zNKXW0M2t-E`fNNsp&$I<2OoU!!G0Wb&ci-$jR>(u0pr-Elu#{?72JMZK^0_L>2BQ8yb@H2u~reS28!sa$zBUKV3XNI z!~rxzu(>8Sm1aIlY<0}cp4nE{^aFsL^Ei&;|m z*)k!R4x#FyMB6oaNHs-8LQ>CQ2zf>!C;)^hRJU-uWPRNW2kk7HB7NJ<4JoKI*C2_RE?03096$o z(Wd4yOzMH6l#$W4C&zu?NT`|m&d^6SsP_+{6nz(5H^>S*AAN&x3R zDF0NxyG zXO~;TQ8OE^g^1C3S>P;h-@QmWA<0d(aljDKXKtQ9PM=Yie6p#>_ZvRf994*LdMa=a zdwwtI9AF)bUvN;dkGTLtJ9j5RRSi=JG)bG(T1qLpV6eD!N0WiPOCX+M#UX@o9B1{ZISp4;1Sfu= zXA|hnOaT)>*AXRG0|hV>(VX?;k5B)}Klvw5pFTZ1yC|Z^rzejdJsN7UJPt!f#LZ^& zTfg;Nl1qsAAOFMuoby0{wN?g33Iw!Tt;Vq^y4)CogIr1PJ*H_@fSGN#TL7n78aDYg zWU#Y0uTD=k-Gh^1zyIv#fBV+sxBu`D|Naku_xHc`(TA_EF3-L^<1Y2<6%eUmirZZF zx5J)@oarB8AjTqP97h9*Oa>B=R?s8jkjM6DGD>UcAhFyXf;lAUZN&+>!K8ZM4)7-hrJ9yAw)LRQgf|A#7qsLTlE}+h=mw! z;v?DQZ{}Y$XAgunJDaH?V$OpD&gUr6XfmeO8bNadt--Z@H-lFWF!g=m5Mh?*dIPpE zH!lJJj3(q#VbBoD9)ERW_sl~JQ7u|#ao={G=n2YXqTc@ZkQI4M2zMj#LQ3xt74IZd z4yT`56$XZGG6O)fBldDUCDkpw8^poP92R#EzJ7=}c(~gx-&f_(W~D{q(;OmGTBd$; zHnBML4xIGaH03uYr1M`bjs%-ZE?Y7eT`h2V9No*pe$(;Ls7m*k0@I0if9iFw3%NL) z8b;Va{pOpInW97b1388+=fMyVW9;MR=;-R|>gMWFYwfyKTCLuE@#VheVH_{7_vhEU zVXSJXW;eTizdea55fKm?VUfBYM>BIL?G{}p!j*YacQ-Bd+HkkqExR%8m(^klsvy;f z77Xxq@*xv48=#`97FDbJJ$(DqPk#8rAKvVDZ(hDSJw5HZ`1O)vFh;&(6-q-F_G{sKwYhjb2?(notcv6+qBHe^X_%-|u6L zsfz%hr5&6xMvQiQef8?NE+C?bdJZ*?BPwjSM^{%@W`^qdMAM@t zG#{1COHn6523OL$SG0knC_Iycw)CKNt2`NUQ#oRafXqCmBt%UFJ;n}^MTU}PN_hP( z4i$;JLM$frFlSDlAk3trHa!cBhz%|dbBZUE6C!#x)`Ce>pSpvY_mx*`5ik**C{6cM zlR0blpU)}XoQ?V=MGD?VYfkkpQUumisbC&19pL={z<=jE?;;@wa(T^(^lR>Bn9FEj zAqF*5(=Mfw^E5=BpPY&M*u53t*oX&JL{itO>Tb6a5#Nfln#OEcLX(&v5rq(;Asb*~ z!Zu1$*L4Ww&#CWwcR=wS?s3`cAZ9l)#SnNFRv?BLLkK+PGLB;iq3`=yhPGt@?)MvG z*L72m!nG_Wln<&yfMSf}IL!IDfdCpaaUdekUA#0<14RN3#Ew=46LCefYM=&MrOr~} zbD;MBmOA{-QXhu>>?KP?fUbgLX2y}7pDc$aGRBXN7rqq4)_1CXozv))} z`Q_D*|K=xOeED@29gFVAQ85^@A%|`SL>wX#8li~X?sj9&DJ6~}m%Lf8iD(=K0AQrP z>xyJz5*0uTF;uC;I2ah9sY#VmrKtOQfXg6o3>^{GTA85h5}NIHH!At$^vJZJRj|rv zYWeix@sp<~Kl;%R{)<2QDma~?-kMTDI5{&t6m zeczeset$iV`*q*{@Q2_3@Bh31{?GsX&yo07pZ|J$a(Z!fb$NRwCL9S-%qlZ=UDvPr z;C}EiI-n$_SjNJE9bFe=;t*=7IgjMcL0~TsnK^`5YDEgf0f0o!U4xx}Rq6<66INfB zFqru;_MMV*W+tSTnGzud0&EONZ9d6D#9iMrb17A8?NY}fsDT;~M*}p#kUDoPW{ype z1`#R5z_pY`J>?Bf@N6m;fbPecF{Ce~(@gH4sS`p|O;ok=N; z<2d(v?==K!tp+Yc52X~qW=vR0X(~|D3_GRd6@k0UPKRDgT^$-W`>dMlA<;n(-^1v^ z$92*T@M~+Q4YTRw`nS+tny;3KVBt+POYSd`WK$wf_lW02G|wjQCFV}C_vPi+Hg^(; z$h#;=jqKr3$r18%&WntF-@kctKGu?R-tG7OW_@ve_1VvV^*4X}Gbvg`fjO-=wZLv1 z!6>8zhSk)nI5oRYjsSkIyu;P{Ty|&3ZqoqNfB&1D<>^zKS_J@NXMYwXO&!-#Z*MNT z5UP&nXT$sNA3c5ab}8lL^uhb@y!-Is!x-Z^;@R0*HH}^36vuJ&v-!ghKiu8iUYx!D ztH1iI)W@9bcfb4H{eJ(|7hi+wdc7^BNL3<24rZbP;?EOw8kx3L>wvae>uR;~C>CR6 zz?}2>`T5PwH4yxr-}$Zo%YXZS{%3#sr-b3BKmFTZ{Nk5c@a+1wJ33k&ZDW^AYZ;aL zL=34*qJ{=BhLjSS)-vXtA3S)l+uw})eTseGMP>%klzMCk-DQd7wO5NX2fTzG{Dj*N z4dyy*R<`%izXSM*s1d|H^;CaGXzD6U>}O2QRkfN@NNa?`1Thj~B?IXur7>E-EaGpfQbhb&?=(K?Ea2 zn@Hpfyym1|X(YrCW8S6oU!?9N23dQCDkkUHSQ~{Tq)~<2X(pHSFo_93m%{Tbsps zehLc@C?dMOz3uy++|zUsgKTnxp@q_|-@aw^TrMe{}4Yh=u(A;!p&j*d1Vq%Xhx^78s>wcYG*_E`%Os@gt}`(fz1Rq8tg9!geKaaA6G zloAjgT24y=1Tzjil}RjOy3>fTUxuyLKfRYg%1M&v+*rdkjzCS#^yf4%NEBBfUN z=!18@_uJq7^%q|}e(Rm@eeZk6$J?u`s}>^wR{dHL)F77wrthuq1EfcTeQ6Y6YeU#^Yrm|zx%y+-+lKN zzx?ID`d9z@Z~o>dAARfNKlr1+|M1B>o8#lO>i5I2+uxcANEV}Y*H;2EU<9(mmR_&d zqJ{wOQHsSX~(KBJZvJHhz1CRtOdcBIgr{#l|!@jMB;36bQZByPU8sn`8eQBW?m9 zaiSq0wB82-VUzu5jFjB4(vvpND8iI3+460?;d-xC>Q5sVXQABJoDU(GHZ-`uq*Fyr z>>j*{h<3Z3uhF?tGXHIhKH&}=N*6ZHezS7Ugl?QoIcG$hJFuk`aj!&}aT1;#w^Wxf z%xJQ?e+Sb5$K$mpbj~%J@66PqT>|v#+(-7)!mrTPmF7gUHMtg|uJf&<#chN|vvrQ_ z{uUgWU=H=~hKsvjGx z)hfnl$X2rLZnGqYT1~ZH;<>E-eG4>2vTcBmB194 zASP3}xe-Qq^5n^b2M=Dqe*OM?@4fr(yEivCpMU;28Lf}DrAjqLA`vMio7t*QC+qEZ zzVn?=KmC*fUtC?idi83vTE`g2aa7e9qfL@L2w-HPc{N$BdCuCFOWF$*L@cG0oDuQp z=qSe1M~_aguCD%v|Kb1o;~)Pxr1E3_gv47z5rnI$bhDXI<+7@>m?!;BM4x?6nw;hlh|cST%6%A;s&~YbB)>Q=c+n! zBM|^X2({KZQ-HY_*`;|0nJ%vXj%nL8wwY*W=oF8|P+nDXEnsMbOD|Yns1bd$_Wcc! z)W~Idz>N|8Seg3MhyqeP8<ZIO zH+k1}%vfs`6=b@)xn@SsB}EiOmnXd0A)_=qXbyQ~_fl@zE0}iIK>}8-&e#TPumRUL zITTsTi0P-<^2zy2l{%d|E^IQ<+f*&a;9|YC)>7(xgs8R!r|LNfsvf#y*5naFt(tQd zEwvUj-0%0#zy9*#>~-GnuCH&qv@W$&K~+g9tky?ew;FO8@-XHRrm?0U2}LTX`BcFs z-MQ&-6_=zz1Vra?nrfX-#wm53SDBb8Ai93ONU8GDQe0aLw?@K8UA3ok}HoN^GV5Jm8K&D9SG2-g#;`a9T>C-2F_AmZ-pMUSW zU;O&>XJ0+fdD!QD&N+nypv{8-n}rD>+2nKSd9G825V7Qf=;i|E&rY=t!|+#s_17`- zcDwzZ-~BuP)xY?&zw-yb->){eV>ZNG$FYtvaF+ssmeJ5m%AR9~-u2RoM1d#;tY!35 zPoxyd$iT$NKjjIkP6%sH66RAk$nBg>&51g?UE%&b!|vS~o63XY18G3GoVM&cPo0nEr8kb?@$ za4yd`J&&9H0%=ibFKwV^m^~tTtZ|8Qn~<=6IOm+_&TIo7EsS25$A*W?sDGp{!55Q4WvSA7S43?YD)T8nD!`j~TEtvV5@rJ7W< z7y~2d?d|o=Zcsq-B$_8kikZ~f5()rponI6?+^%`?%pHljj=B4}rsq4EHiDUm$ynFj zY8(XtK6vlj@4oX<2%%pczw`7x&*e`}PL7X{Z+5r4-H!XD;07U)r?c5_?A!0Y{rK(2 z+f_dd!+y7OarF>FZS;YRh&Hi1Ls5k2bglb2>~|=&i?JA>RWOTzDX?SOhq0s( z5yhpH&8%O=hRU>7f4Bk;BGzilBYBRkHu3Z(!YG;ITs+Ml7l9QqcG_6iYf_q4rgCQBD zl>Bb{g9yu2P78|?j}h*kYm13TAeV@QsY^I%uQvYa;j%nHNX=gGdZ9|w3}o&G+{><= zdpCzUM~cmvxh|Y9ee(>%089Yx4W~pvh+{3?dW8*6WJu^UN+#9{9`C$F^~ua!^2~A5 zYjCr}TQA#!^8=m^7*(zQI8zFUMuc4#=VxXHuFXEz_0zfMevLRCfD1rx2(^mHFm*F% z`c23=cd4~6h$y6#$6CbPR>5Ck3JtaEH+jFicysam>t|fYu~w>)x>^IE@*ndXxRR%-Q`cDZNZcryQKUju9~=ieUvNs#eQ5 z?6r(UAfR0tL%{xcv#nLn&(CkJZda?-IF9FM7qx0aTyHjtT1pvfO_5L5+eeQcz4g{3 zPW;(tpZ(&qpZ)4rpS^hY?CR=9OO3HZ;Fj7Tu(xHv#K){5Oet71Jyq59dX3nq=)2wS z;^Ly~x{p43`se@q|N5W&>7RV}d*3m$=U;wNRUg0g*5&Q){PJQ7PX)%2%+@J%U6NtX z#DNV-K@G_WjhRXvkP;veyDd`mfEXy4BB0Oc8;M@k2^PReA$TI9YJ$dIhaxbdgDcFM zRxC}nBcS3WSVADCFe$*Bww`9g$sB-F4%;LkBNeC>Oo0eh2no%g7V$2v2Y~}hv;k{O zt5`F2cSPJo+gl>OU0c2BkI>?%rAD#>ANNejgsC;*MQg-DH2_%3v$j#hWTRbcwFMz^ znRD7iTAiJtJaKMDCWweM*@z(`=Uhq=z+z@aWtyWDp9%(WDV|0|bYQm`0ee9wmZgFy zF}Y6*$6$8Qe?wf7c?hftM+2BC8o+)(GIIlGWC0^gOc)RtfxrZe=1waZb^U6$yQxJ} zN3-GyPg1hAO06=%Ccw;w{q6c_+l4rkjH<{HRCdGg_`$=mj#5TN?Lq_ysFoq4rkwL6 zJ9co0_2}%VSZ}R*(J_vLkFMM+YL5OfbmKUdEQq5YZYia%>vp>Vr#*m(KHr}5W}f5A ze0r67KLPizln&P!I1wXZ03#5Ttj2%=wPpy3098sYvN}2GVj4@4v3M&!#;{5KtLM*t z@;85dc6KIWo6RbP?&#?Fi!WYYUR)!_etiTOnWKm*;A+*cwi{F&OY!tmN>!0S963}f zG%Z#%1z<6a6m!j5G+-bDGYo-r!4_M769Nl>R1+zTlsEzgtwKR%%pHeBj<&L+qt)?) zEkgqfGcyCOSF4y3Fy)%TC5>YwgO@K~{?)T*FJ3&m+3yTht37@CZVKJy#l`M==T_CV zYONKJA_rs=F@;*k5vRd%6Vy?xRY9feVi%)`?DE*f@b~`iAN<8%{Kap7|98Ir`s;uH z@BTke-+OwqyM6xp)!XmA|K7JgytuqJgj#c{z!+1)qPn}@ITe*d5|LU85^c7t&1UuW z*IzR8dcE$tXlBev1Ox$*yoc%8C;$`|Q$-A_l_AZk^L+~FVMME&sfQ)~4CTtvn^ zRw)QnrS#N;n$+UyBocX>-NZXHPPs0KNQ@zblA--3^87BUkWvI}+R0`{1SzF1MySQu zTwNCc$co3&VaT=CKz`675_5=v(W5^ZR8uVNdtj1W#5vGR{lCB*Jv!vwrtiTfZ%CfyyU`9cahgWWr53A3G4vrxuzzo)M2r+;3`7713QP>DU>1mD2xf%H#7rER15KhjrBt;^f6P#gL{Sy{ zeoYjd=@&vmbSq#KF%c_85V`ACM4?u#RmU*{5OXvG!jNJ@pkW+pttoY2B%;jGX*|p! zFh{Sun9)o{7_slW+v^(& z7L}sPOh!14*#Kfn-r|lir4R|p!OJQ-><8u;LJA=fvMHDXArpldQV0nQMa=VK5gUfQ zS+B=oAjDPQo0^J7PBA1o&luv;TQdGh2j0w9=FK{Es#_j}ESiBQ#QO+YC` zQ;Q)!dGhpke)so(@Pprb`^nQjt+hfa8bYk1UFuzxLxD^ z?KUS4@B>SIfBfL&Ntd>&OxX2(UrHr}Rli~)H+9!qwHld4W)scBfCgRa7^&}iFfg%N z>aZKeVU(%}6gfByIWQrZ)817oB2ZJ45Cj8LLhAZhb*NTMtC<)mArMla5IKreH0b({ zDei}H$fZRXtq7)4Ysrj2h-J*HZq;{*i4iDpG{st!jG$WN(8o?|9fvUx2M&2GF~q=; zLf{aIQV}cFkOCm>hjAS9ei(^qwOQvp?8kkGVJLelHWNZ+jkhg!0fieQnsPpM5q%*+%_Cp|KYf%n4>!MZ*nSd}t`Q6z(Q-^@ve*nkk` zQi2>fAfQ%diUe4T1Vm&cW8@apz5CwOFub$a*rd~>v-vsQb$f3K=|Od+<08Yf+8Xi215ZOgQkr*r3uab zN5yGuj=6Z#h6RL>$VAop6mPC>4B+uw55D`IZ+-jQAB=Sz z@_2Q16}vtVGoy%T5R{VDG{oRI z#c>>qQ~+nynSe5gO(K{8fXL{&pg`z0od5_S1T@1^M5{G6v0AR#N#Qz))x*TZ2Zq^p zTU9}u$&HJR&I_Btr&)(7zh47b>(r{6sRm~XnaNbs+!5x(1)_5~a-BiKbCYyJ?i|$4 zeYWESC!8St2l^JdzC5UE6?cnuhUH9VpGkVn_;m7pokvdxB<;laaNwJF*=_DF`BdF! zV&01O%kx=~x5Js!JYNbS5Shzvswx>wV1S;8YN;?yB#exZCS|Us9HMS8bKn{Q5|*5U zQ&C+x(bS-c^}?d>K8MkJE#t!>rdY6bOtRK$V(4|gGI1>xk=L6JBE7yidvkvF>cvX} zeEQ_cg9i@);Khpn2YXIQ#2a0TMb%_ww&Ffmi-saLa4~uYuReGqM zNdY1NSJeWSZK@R zQ2|k{0&0~?GNFN(8PK7k$XG@(Z4-D=anG(v+|OO3)IkskFb+cq6jBnTl1CGjQi&Li z%w1lpfSSu+wGk5{Gz`U|+vx*3pBS?f1WFmlF~yZONWT}=Fe7D}-nrN${6x*mXX=wI zBjHTlywhE6p2Zd>Y}%a}@p3HSoEf+~D7ZIMo__7{xAO{^hedPpG9Riq!BOW#tTih^ zO--aYK6-v-okW!m5egiQ%!`BCT#>$%>_;dz6*vsR*`Z-pjLta|QQ%Z-C5qSx7l&Ae zh~qGD2(>zjQ$(a>S&mRtbs}7dnK7k%_hH6$FCNK(xv*U2-)tt{qePn-8aso{Ts8#_ z5VA>#K>#2?*LU29Hy5wJ`tqxb>#LN~Z@>4wzDwtqXV1QVadCdNyB+qsvFod!LI^P)fUC=ESbl}TVw3ok`cZFcfTo~AO}dJ*)LJWW2%H?mQI*Ib z01|?jRh2Q@b`u^vdaK`T#w`1xhOX=TzKZ2)XqvNd3^8>KCPh<7OdW*W#hxQ+HA4s~ zoo=_FdV7043`4FZ#_0H2Gn=NXN&rM0*6ZDHI{~)Zqfs+N+a9e0!tS=3*4U+f6<1xP zNZpg8pnyPr-e8PGUFZ_mJO-qIL@stf5+Vl*Awm^O zi2_rt*=8JNHLK#-G7pHW)hhNqOvdKEbmx5(LeMG>GQkNP;%4s4@%Z7Rsj7+L1O`9I z=wK^)CxS!tItmTZ<}f{jTO4RS<7d3H>^oYdxZ1R;2&idABqR%y%(;k}3W%CXZGtHc zDWL+0>S%%a#b>TIA~N7T0fgnUJbbU{8K{aWgBn?zuqn(?B4w~(22xRlOaa<>R_9^w zQojl(%*mk+(?g;Y0F;>k!u)KSuThIriU^2zB$k&k^xph>{^1<^X7=R0kF875=|#?^ zDsFyhjb-nDp-5&R4$*L}8e(=9a0ukwc~@>Hc2G!il!o^N5GinS)@_mM1nR2d?zmz) zHVjrXa{v@(=75eg3dE`^rTW8;9ExYz?aEso2>>7m2f*byvAkFJpb;~+qXkwy;DlzX z;`|G(^k8yrJU{>@F)^{e?;-L~$D6a8^YinYvQK^d=!5rTjIUq5{Mk=`{^b{6xm-<3 zD?$bcfaJ!X+N`E*0(i-Myv-rz-Xr$CS48|m6$~f)P(r9#385vW2y1L%`t`qfdeDW!(3|`R0;rRSC=UulWx}C z)2DBL=hJUJedn#!YP~*s^zkPjJbrR=b$j#b^^Rjirqjod%xo;VY8ACwatMJC0x7lp zNmQ$fF(aoa3Q`A%y{d|q&}wj^K)c}vCpJA1#grf=sMYmm<_y5oE&y0<);>ipr6^dD zD%G;%tf%Us4WkjDbq@d|nVA*`bp#@E*D`HTLK7|Oe(@%-z}UENlQ!uv~I3 zqpF%Y|HTb~wC3#pb}Zu9L;$dgeM|sgwb`8pWF%%_6KgDPBUEjMmJUoX@uR}E+@O(V z#j8)}uWQi;qip7q&c31ff_*Q-0WMEdEq^F;-N6A46?9XCZW4hmPLE8kb1|oK(=XFv z!_zWo!ky~=jyN72Bth?(E#Jd7-A%P@8Chmof14DfT=IRkCOteYRaGT2ky6Ttn3il= zpRiAP>mfh)rI5!44)yyrvzWB$NX^_3ys>?k|4! zv!DL-r!T&GISiRNA`k-PBC%WbF_Ge!>u$dnFaTVyx3%U{iY-JHzY#;*dJsc#DT?Wf zs3{i;3p%L)ygy7X3j)L_2*ii-iV12dq5u%P6k{w|a;}KnckA0>A42ky*4eaTZpQ;A zR#X6pVhAC`*d5dH=6Jo`u3x`+{`u#>dh_O`)S@AvYRMy$i#H3R)han>mVi7p7UmKd z6iomWI368sA3ZvH^3IcQfAXylKYC9U9zK5i<*QdO-@FVdot&J!_28uIdnQDr-M*BZ z0idduS=tIoi5&1}Rs)3)8PHe(usS4&fkmViHDUz-=G|WO}fWxu4;FBMENrPKa(ObhsCw-Yd4oY@LJP@->zP zz6+Jk@49R~fcG?~@>eI^7*4?mCrQBuKr@qC8)smOBX_P?L|kFrOKijz5Y=j_<~jgK zXl65Cewk%7W~a`~zgAOEg!fiEcog;yvWWDl(<-eyBI+lLKVt_WwlWaBQwlM}={)c| zFlXOV>m;f|WbFv8h!Z?^0wm8W(SFL@&qk-S$FJO3%+4SfhFz9A){!F}pB^0@9myy! zo;~~QXTQ8WyE-{}5WCI!&ZTA_oG_ zXdEa@JwOOu?niCvc}a-WbA&I26jTuQmU zy$l? z%O2<)cjjDaK{+^Nqw{Mn`K`0xod3?8ipI!OugahazaJ>i^H7qAh_u$)_sKw(yod$e zb(X)3Q*!6h>W3bMs;U%lDFb&km?Z99ac;9(mthpEh$y1YE*-~l(n(xOiUygog@Jj*$6SL@Zo)q1_IS+1_G ze)ZFzfBoy{u}cpgJuWX_4f|Y``qjDuma5}8h(Rt=R01&~=bV=~Wm_m${ib6XBS*gl z>hoT=p9C|Hr#^>5b9pF4m0S!6Ob```kQ@Rg>n`46k(xzH-^JtY(aml*?DiZ(SaqmS zY6a0O8B|l>mvMv``;?4~46@WN@^-ua;)`E?`PJwD_W${>{^~FPlSu)!JQ}Dze)twM zm%U_niLk0BF48`G%iu!fe2P1?IofWIH%{h$@aW+OAAIuU={sij<+HB=F?0zLpFDm0 z;_~wR{G5n_vr9`gKqStkxKoRnjCoh;PHHbAo6QOUw5TKG2m_JE7~L*-=~Si@ml^;> zWEcjoUK`J9F%_8fgQ~Mj=F{4jkn>!bA~P|vs^UVZw5>^3bYAFpgb>`;)CcsgxiiDA zsl6yW12E@-Sdfem#YDAY2wpQ%jED|VYZHI3`bxWV~HuM zK`x_1dqgELky|EmVCEPT5g8ye6SIgQp{HrC15j(NxjKwrn#>{qpiKG2l)~F`-TMvn zwWzAh!PoA*P7do8DN>M9O@x_CAOk+GDqRG(Zs)S#5?$nB-|foT=y{qB+!zFI^H~fc$yery&0aIuKwg7{ewUH zqd$r%ou8c_A0HhZAKl(w)trxyx9e3eQnXfP1l1T3K?$LjF-AT)KFWFj>tFxu|M7qS zzy0{H|LWvq`{=>x)zt-<9&a}YP{zSqT{pw7s&*+Em=SV_UK%^_E)d<^UXR26^ufvZ ze(Tfk{?>QieedZ9AH4t3w?2IE@KFd|tu~HX)b_)0bGysATwGi+F&L_-5A7YLbF|r1 z#|fjY*8S0T#RR1kmui+;MHG=zNd0P!1~)f1rza=r_!vc86?ebiUtL|fHEGj=Q*~{m zHoRr(`Yv^y0Sx0fi~}O2E~%-gR8b@hF%q+=4CA=&`^eElA#nsi0gGL#;rhIm)c}wQiPS7C z)7@oeI`yy*Vx6;Q%-kAV=EL{&CGYh;zZvG|cFdd@FIz2>(19EH84(S`kWzB3QMCS&%b)} z=FM)mGu02j^-)#(>g#8(&o9POEgHwP?p9YfyGA^Az=M(VCIATFjym76wY_{so>kW| zBce=6+$=R}?!D3O46;9QKr=y85j3bVKqOQQUeZXCzIyiT#kEv;^5isiF_)^PGPN@UjXXk)$De-s>3i?J(``~99ZNlX zd7k?9YPF7CI${oaC{@gK7)EA7!<=(K$F$;pKe}j^YTfN_0;6N{0LbwkL_rmXA&07J zno`Qc7)AXMZQ_ssrIa~ESmq)kvLA=p{D<^BfX$P>) z0}q|sDXKavX8EG^W#H#4A{yB3uDB*vpr%w3x~}U}9kZF$DzI=Q+YN&^zUOrnV{|0*!RIZu3qM;Ha{*zB=T0|v~3a0q_yBs9r>FWJ>@abvlfkEnkMw{5fXSWwmNB%AgWw?KGv#}&H@pm6^JvUMAXO@* zOr6svWiq`Ex&oLl5mz&r_Oq8c0HA&B_xqhwTx%`fkQ&Fa?|Tn_rBtcbbt!O^Ixeon zCe5LPxaT2u5P9dzyCGocFfsE*N>u!mHbB=>H=W754jOgo4KVWdF&-?NrcUCl%xbpG z$<+W0jp^U|h zSq+2;)h&{pV`nC6KnA9U1_Y=snc#irmcz|m$M2_8Ot^rP>8|H+fLfBv^W`*;7-zq`J^?N*zA@DIMTS)W|pT)%m9UdHO~ z9jm@4qMBv5+o|bxyCtyq-uvLgZ+-msJMW!5d_cj*;r8nKYIAgg%m$=ph8$CuIwpdf zn_bt%K*^-^X|-B)s93a^2#~2r8FC1;-t@_Z1d)kSFtX-3g-}o?ucjQAIzZ0l?spEyA5v3(eO$$KQMD=RLraEv(F!8R8t{eQrR+fU3pC z4I=bdji!Yy<5z39BSDD30~-(dMoRK*nM zgb_jKW9r`PcrGvloXFjG4(4AnDTJaEv=Gg8J?1-ri2h#pve85H+u+d4LquQz1yN*< zoXjwf!a%Fk%c#5E^^o=Y_V#8NL%-qBjiOSEDOd>31`|W@hLK+-p&892h~=Z1!B5ku zfq>eS5LBxwnpRWCiUtJ%V?YetIUahtS0WWq5KKTcXEyD+?!ocV&E-`H!F^0$pPlEN zIfU);aY&H^2I{2NTr-+-45pPhf{B8aVb3ufA8$`iPEL-t<8J@@)yq}to;-T=_|c=1 z$Jei4yP*C1AAb0w-~HVb*FX8&pTB&4CZ_#reS3R5?Du`&A8$`mO4qyF{eJ)UlgFQY z^2v9<``wcV4-5#vQn!lzejJ4iW3&*WiO6WB?9Ht2`@Ub3m}=_#zU%rrX01wrksuMp z7(>7=b&N=)c@(KYHo-Ybi69c1={OdDzRlNYQjeUGbMsm2!FLY0ZJgbjEltF7-kz<; zJ?SSgv!U-4awK+)#x8L*1&YAyH-e5#T-01vs68pdPb#LZ% zuduzB72o^)`4(_v#v?A;{6wTyW8zwC$<@qKLL?>vK&`dJ#HExfweQy67D*|JXwI1_ z#u&}8RyC`xS?eKc1`GPtaf;|Id7~=ggE`0W`|;Lp8bDz5L5edg$g$^YZgy;D&X@28 zzc!36Hs6QCgP;Br2dy9K8V{q>O}jho@qx{J(>&Iji2+nSK04`Q9QHZuxb8Nnp;mbD z=8Ih}e*TZ5V^QL09K0)})f7}rwGAYlYB3!cbm&FQVcj2-h!a)OvvO$vo?6=jpyaG( ziaI&dBM<{v>!czQlSs|OkeDc>_2y{3-uB(P$r>@o$Uv~#^hT@(p59XoAhnwIDOJ;& zD|75tJqErVZZDsmJ$Ue_3n}kM%TjZ_cyoSzeVzAN6;etsUc7wyul@~DstUtctLQKc zZmS6Z!!TT3UF~jmeTs+(hC?pnP(mcDx>|Lc?I|Cpagdzze#jzX23^1Ix-O7|7R6iT zd6&mws9L+&mzn`ICMKi2&rO)FViu`15>X%pgEH==jD&F>vv`xr`_W$J&mqG@XRWng zue|d22V-XL0TW|HMN_azMORczgo#B=0f>Tl(+nHr=w1?pD*BtGj_1+HG`|gpNqx?e zYa1Rp<&qgfvI&n|YbEg^k5_q8RS_+Oh=c-$MnFM9RT>eIBAYp{RE5X9FRC0az(@c5H6dnWASI_rmCu#Ty_>)YMU?Kqap%gfhq z&dx3_-BJz_hFo(|N}be#!BLF>1_+F(-mY*ot#dg{T2E%aJZKhMtXgf7v%|T)cYqrWDx? z*Sq~#)Hdsr)q2A*ot*U7*Vi$|*e3ueW7%Eblrg{c=<)CW-XA`G{CFISDsYTdYwB0q zlZS6!Uv#UuJwEbu?CR>ud#U}=F@Worg&3oj8bat|;x5RjwdPt>q0QU_r!IE2iV84s z;DDr}Qfp;s18ZCGLCtI!hN(`cc`E_oZnyL7!xxOImLdzv+?+P4I-^{*jv1KTYpbZZ zkH9?yj!gjbaTstK0(EpkRicE=nR?}gE+J!+1!5;IZ* zG6hsK5#3!~gJK`k$;pHBvx_{Iu@(x9YK%;w>%fePaop{8tWYPRVrEcPG+y4Kg*_K6 zfEh-U_<~gM+P@=Ei# zJw8qSS_}h6tvf@kN+9N1J3!cM&55c?>_X7!t=34S0OL4*_0_Y0;UE6-Km4P=`-k8E z{ts_&Z_8M}{PKAWX~=t3+N`(h&GDFP-QV_`^=h@cxw+Zh>=BVMAR=>Euh-xI{`bH2 z?GO8PH;!c}!&n9Y=+~8qvQ#O86^CKC9c}@j?|TIyCv$=N-s!p+yCkGt*Dv`LC$ALqxNgmC}Sr<~88k#J!B>TD~QTlP2YIfBD1m_38F-%WMk)YpnSXju zs7bvLqFU?Z3Q7P?ewBy;Dol*8Wf|RK1^Ey~=aAhh)O%5R{)U|z!pWy8b4V>&fRF$c z%tRH843VjfBQgcz<~|-EU@(wc6i~tZUre~IMZa>+M(4wAS-d#5Yko)$FmfTq=>Xtb zOG<$$I&31wm~(c>&TL`Q&bK->fSj+e_+rMXQ}66%M3hn-Eannh=7UoqV{Vm;gacX@ z5mk-Qb27AM{ilEc?0u1G*@I2eI|r)R;S5~l1-9r|wUiJVGJpgC6b->#TtQ12`?NZK za9l_I{L3$%zj?JEa_susoBhph7dx$$vIrWCbyk6YmjKHLm)!T3uYT%Yj)}pmGC&v~>!F`9x3|s*U5JHT&uw^YZ zwc?8VB`}U-zEMOB#1N8+MNTPnlE6B^Edc7hdFYTRnKqy%2vlGT#O~_Oi4b_mV{E9&jELLqc0b(icDwbuXWrzTMG8?!X)?Gs3Xuq7 z$tqN0O!HCctfbkC&DC6Dj0T07z(iD-V@k=)a?WCg2qFcMIR-;4RRTxHub5e_U`k8` zMztycQn0EOR1Fo3id5zxra)xSJY;}CpzO1oo+G=e7%;Tp3`NEeLX1tkM^(+L7f{Vr z0>C{{0ARB@s#$8SF$D&!V-Ar*U{D}NTqPvDy1BTy+27WkMjMAxcNoLE>u5h@F&M^N z#a8PTGD)>s>o^L5Qxenw%2+~3BA}unC8ySbkqQt76#>u~BL=HkB9nokX;mN~g{mSH zLYJD+R+Wm5dLfD-Amdo~#7JJ9RV-B~^ROQz(2u_Ny{8Y~lZ~yX z6HR8IM2a#PMG_Q4UjN>0qxEq2bIxwoS{m%*e(y^t2G8!j8R_A1{G7Gd z`qtNMU#-_Ct@GRcj=i6zsqK63S_RQ!&Ux<}0EjUv2pSm%Ff9cQj9r5SqBYyDWzIRJ zl%wW(x-Y7TWZuP;Qp)6A5=C?|Ml@LVi?&&exjLv&O0`Shn;NQIeaUp5V*QJ16C;@py&*Q z0YJ4pQZPFlC2t%EaI{c*v(-9&!vT%p;r-siQjMo6H!&?-h54} zbb~5Ig}KRsnnGcRIFQ5l>tRogb})~cEm5F;BmjUp7Y3VYzg$UL1i(@Rz>KUqHsfn9 z2g1Q4!j#O)ft*2lh%$!Pdp16@n%=~=a?Z0ZrA`5LwPp2^BM`Z+s!l%=&-2l_IuR) z_Jgy2v9y$~?rz3uQn1CzD#oa0UFuvD?%#iSescEXKlkHh)79Paix)2nU=-WO^z!n$ zX~Na@-8h1C@ZiD8Z~xA3J$n2W`u6PJgWv!CKlsT{escQwF&L!V+poU(vgsFH*Kp&v z+uI_xUawO2`*By#=KX%Js#XN6;4+sfO1J1m?DG0D#@H_x%&?y#GsY~AuQMKmgEnK4nSM1OQ#rgy4t`5vFlp=ei=P#=0RA zF-JM1(WN$e@ai zXTIc2wmFQhWMs&mnB2EgBM$}`M|`$+YOkS>BU9*bOV7mBW3t|{>{P1wA-A!j8#DCD zM0T*mXF$U_>dp>=Z6}hC!y~@Vr-Z}EX$PFO{*^?P$ zWxh#>NTg=9U|szKkcg?7%=~Dp?lxkoNc-J>b#l^li&(DrL)vV|{eIl_jA&?9id}j9kY^0U%Eg9^HHE$)jh_zy9p2pI=|RBF5#(iF2;$+TGs1_{Gib?X7Rx zllA)K>>PvZoOixK#JC@gbJw)bzxw86wW`g*Zo3`#V@}e9{`3L1>z{r0kAicJ55q9sTwOkS_pOujdj)JCN7xUG zuIU!5&Gxo3^%2c^@12uerfG6GTYR#^j=D8f9>iWVP&f`v-N%~Q@oM9XEUIGBm3=AudtLkQ0M zlH)9;E=WkGvl(;F8F22y3`iA9(U`>(n_A7#RHY)Q;GJ{i>UtIgjH=1|yg#UuS-myt zqhZWwP&dZ&U=4;fPSm-;e0b6Y2#bgy*%%E7XM-!6Yl4C?AyjjF1W;6{`4}~EdR_wQ z9F$CEhUCn!hFKt5sl%zS%_O-uS66Ssqi?Q>j%6DWK@jM57$iU~>IY9&n>qXyO+%_; z!C#6S0ywbGj`a=>%R!klT3My201_eEA*|`JsRXX+YFLf+4s}i6a6g=%_7z41W} z)bzMQY_Rx2eZ`@F{Y9Mp*2P4 z8|OkPnzAsn;{brFRybcvje-p7ie(4+Z2CE(fZ`?m`@-be&?c)n51Rth6 z^yX__uHlCo$%Jw5%`|HfbcwO{*lgpPw>EEc{A zCnqPH?e1s);Q#BJZrS%KrI_b@!^LWO@7`HT({{i2ZL?Um%$OxlX(Dp237)v5Ohz<^ zq(WAa>O05mn;_FvRNByb?_!KKfm}q)wDxhT>YPKK1Kp|zlBxodf~plfJo~C@Qjobu zw+ci(zw0x6{!v*XaUt%@vK7={?fs9+%k z$2rICnBsDA!rrxQ?|ow^MWP{xfYX?nJTn(0uw0U)l1n7-eKA8TCIU6VtY|4}hXBcH zPN{|p&beTsGeMl40U|i(UDGtvG$5nRF%QUd7pRhscTt@VXP8nBUpDVYp>nYg>*cwO z&MHJOrg=d^Z&=#^K!tSc{?stMuE zvGK^lotxWZ(+IEY6dp(hWK@*^1Vq5IZMS0WOshR%l#Py#$e0oKKgRgGHxbNwrTisbq}50G}% z&JuD>B2lQCHdP`zKfjk^dG_?xr=NWJ^2Ozp3Q_QmhRMoqP%uPBKvi&#y=R?mSh3zk zh)jTRP&X@BwEz@-ZJ}`Z9bOy6F!Ri6`j>}CofXpIBxy( zix*!%{d^pz`)A=de)C7vOYUKJ$0e=O~^&=w%e(cVT>V! z{kW4HSF6>d2lv&ALvoI$VF0wyI5QdcyPV_6YVqK~gIBL!F*6vXl1s{s_l`V!H%-%O zv6{wob93XpuNl|lI3o7*g#xZ0SIH_WZD{HiQpCs%4H-zlkjP9y%s>H6>-Yg$7t*9f zN-8l)9vqqLLf*my8XDVb{DEmZa9=H}7)a`nMuW*(<$9LL=_#CR9L zF1~pM#C^9sIXmyWMMs(?mR;0{#6i771drwevk%_;VHm7BDL2K`6qV;iBQ&Dq{0Za`5$p@zffT#wdHV5ATs8p@}fe>@BE3NH5Vx^WN0^>}Q zCOU5F=dJj^#2q{GC+60}=62)A4@aP5Ku`4wv^Q8ph$y8xF1}``;Mx4?Fov2oUf=xd1K$aRGSYuApb z?`y}YW5uW0b@a7;7Q)d(d)9^>+PAr&9)6Hf-OC9=Wo|MMc^}xZE0PchP*uP{K%L}B zt|b7irt*NQ09uT>Yx-x;Uw-}d(_uHP*Jn$^VVJhN(Yt0GV-c$-orsJv6_o>3pdQ7p z-atp9A{^NMZ#JHA#H8RglFqATWvnYSfwuk5mPBzN^sOHn$3O-lFm<8 zzxjiY-hc0%W#_MMuC89boNl*l@aU}vj~+c5$MGNk!#}#bzPh}=RfWfIKYZuychByf zzy0W)Cr_Su@3*%Xm(RXhuTI%J1q>l{t^4lB@B6kpJH4ltZ?EsV<-+-f*y1?cTwmY6 zfB(tDa|GJ$w^K|ZxFWjUZco-rNpYJdW?U`%<)WGPyDvVw>X+4OlbmxVssQz*>AJ3t zIDOw&T1*WhEu|o`D#Vzf7DOUK2T+ZeQ;gA}tM`U;u4W&jnn9`7wPf{kQjn4*gBB+1 zTCa+r1|?Uk2QveeqEhd-(70R*07xm*KJIRA%q&hr*Ld@q&4&GM7>042N-4exXMGrB z95)yHn+wOjTlDMo*4FT0O#*(KPW2t&4>X(a(O9D~g={WyM0aep%M(Dw*iHM|F z+O`ExulJ~AWHiJH9ouXRY+|ZXM6!wE{DcV+0a~@)1DKtFj?mMwIdyI}MXdtUgWO4D zRx`^vSIw1u+Yaf?LI(f}Skw-id@|K)Mrt)^;`Oj~fDLV49l3+2sa5;9VbA(s7E3RTO|XJy78K+Uk;UcWrNA9$A)MtPHM;9S7j?I|4iq(J0|9Af2d z&JG%cNL+RI3ivvCsXpn4LRsISGqa)h9b#0W#wXXpYj8a3#38`}Nv^+W zy<5y)iyw|y``6c7+yjnzUjQ)M(q zR7wT8$yBu%15EpAyV>O__3g^Q?e;^7`;x3*G^Hpx1wzYGR8%CFOz0{COg5Y0&QcfE zO3bcMvZ{&}0GJJ8kBhHr8A`|wMS%_?`h#ib>uUl42Lz)sILOq*Y*r*76flP*h&kJK z9QQH3y1e|^)z#JID+ktMkeD{Rum9vvKY8^ky8!RMfA;am-ywpBj~_jH^vHYfNUkoP z-Q3*7aawf!dU*m&DU0`hb$-4+IrF(=$VS}vOUvW)m(PYcot>RMJYQ^HJ;kA)#`NOl zGemsrt+)EVcQ(BG=GB9H_fHo=wUA~h6M~$rmt%@)8r3-@nAfu+RY5mR6A`V?PDE@N z2Gv4DC1qFbL{lUNW<&$$Ip>@+NXlRU4lBDH5%=32&2x`ZeZtrgkz zoHUo-HP!1`RZS#|5GVlbu47e>7)YG5nS~G>=y-c|@y+LVcXyl3W*kRyo|$7x-Z!iD z+1c5d4?(q*?dIz4?gG9sY<#y^E|=}1U!EX zoU;@KG!>gOR|o~Hn0kaNU2)7~ic?NAN6O8PIxLW;JU40wwIj@Cqx718rmua1sx6Ug z+g?FTK&+V5HU||HkqrfvfB=zeM4p(^x6RWI4XhqKKr6eDk5f6a1E?DkInIN2G_^ad zosI(_6Pp5}9q3(TRuh#0k*k6Kp>`u8PSZpLT#@gYuvPWNwerr+j;NdvST4leK*>BIMZnMgfWrN-j9()FY8d zB}Ho`C)77tIRmrE`i(L=dy9zB8{WOgdw>q(#Q~Uq&Be2WgtRts-ZfJka$UbPftU?6 zWf8;my)(5Mqou=f!FX&JV*-@Akl<8tRzY ze!s6*W3$9HMQoFU)@EJEy?zFRC; zuI-!)1|W5d08B*8j>t8kk5kT3B#AJR8rN0q!6^zv!Fk^{h&WALN-;t`;(m0n=&Xl# zjR!?EQ%0)C5<5C7YmN)|`bdhHNCroUrleH}P<@Mz#j5sON5c?iu493!YF1FLC?8_^ zR_8bS4^(d;d;Mor0Kos#|K{J)%CMLVsi2~wf`EW{^5`&6*~lEaBKcSds)x!Eg-j`h z;F!7EK^7e$=a0f(-; z9wSf*j{u-bB0|Wa@hMHm8l8$%EU^GKE|U9sEY|5P+(xi^XCbM>DG|;(DZa-6Ex8qLsYq z10$lOoTNN|_HvwZOu8N7_08QFvnotE7cgUoO!b_Pq9RhnfY9c+#5yijDLj;-08kG8 z?Hs&Fo~8*@yRHk4MFd5e+4CH9`r10ts`_|_ZYsm&^{{VfCX5tgtUJ?GGI?s-)=EYK zE!oOMI)~?0l*?0?rqqV;`0=CDvt`b4x4lbgavr8(*EC_V=%ge7T`rf4u020F8+ZGh zbKCY^*M+WKuh*xir^7JBREVg?+hr*i7Z=Z;e)GvMe(o9GefPbe{NyLU{X4&N@4@}H zZ5OLm2;sl~(?9*$&wim`eczke^5pdW4?oC7x5FM0Pfkvnrin31QSZHH9)5Xs&wvlhc)mY&JK~zWVaz)2|nOTLs5m zw{XshC@~Milv3*ZWz#gNl=JiZZ@>LE`*8Z;(fZ!~ta5pEHB2$9r~&!_Kt6<6q-1Hj z-Z@uk9)wNTEvj0yvUIXY&beDGE3pp|+oluK{eGWSiWUK>3_nSkh)~LYzc*1NtM?>` z8YorI2H#F8)&(5^y!Ks1j4{?_)G$o-0THn*!0aopv1-TbqeMh?4NyhB^9zcWXnfFi zRwCLwSIs4xN+|+%1Q60P0*|b)^(Fse~>7Kqg-^ zutdl)AsI2KArk>AVF>Nv9KbhCi0e`X5B=c0(Rsa;_~kY65j{9e>xu{MU3H>+1Cy;) zo{z1PDjk8&H#@;Mp77ZdU~Ztkh3KIv8&&=0>#u`{uBnQ~TsMgo>jon`$SjV7?Js!? z99m#R^Z+PQO-yQkPG%URRK{CMwTERyDn%VJvO^O@bV$y*F_%2WQdC3;scqZ!3Yw5( z5tt@HC}0XWLkDO`#AK?oTjK%vRF(}T*p%0qn(I3ufo$-Lc=3RbAS z;jwW1;A)F60LXQxqR5^QRRD<76ama(>l$JLvRYLQ+a*)V0Izn#)qY5MDlr|0N-9OJ?jj1L;c4TcYp_}$)x)3-PDJ{?Z`-zSJ0iNdx!G**yo1xe`Q6|Bt-t-Z z|IP1y|9ck~7q2c}6oXXqfBj$mHxC{?eDdD=@4o-RYPGt)y}P-&dGY+!`Tcuc*EPKp^w>^_O$YRkak!IWqz{N+rh_+t9Ra zYk9i5xw10cTP{pf6Zrn>A*kpyc(s}-041ZuhQasVv+EZ9cDo&?$q_c5JnC-P4EsAI zZQC%Xj>`d+I&?zQH03PI<#MrFEfyW3<8a;E}&x) zXY4hl-R;%wem`DcZJMTAtyZhms%bjsT-)@ERkz!1)G);iMg(YpCFPhR1~xPhEh$aY zp)c!vbWWPpyzK(&g|XLrB(tj*Tt8J2&*)Hel-K#D~`Trsf0`Nom;Qj=XOg=Mn7g_67h&1k^x96#_d&qUtRxsznS00aGdj zK!l~*2G4ywsY=b25>(M51jZz$DJ8PZ1VqFRL5xc>EomI5anziyudhQ0b)Ch`M(B`y z+f>jj_#Vv0VRLoybhFtE!=Q{~ZI9TpWQWG=O3`d!?6Sd_OMl=acU`yHZC^fny1U!- z%LO{_R!iqRTlVC+-p{O_)VIz*ILW8o#mg_AU4EIT)OFozweFWE_wPNr|L{@Vr^RCB znlS9A?agf!>ICm^?lw&qy2XNtq!cTX08P}hD@kUj3uZ(t#bPcl)QI|7pjiDEMWnj% zJLjfps@1?brvkD|3}{FOSOs;SxTtwzb>7SnPyv~kk${O=362CrJ$8OIITR79jT;hz z8lrVw0{{+@fgH|DFa=^lskXW(&Jl|#SX3}aT#LAKBuL~AH0-&+mx@6+RXBvnNU_@S zn3-y+yK+@Nls`S}#9vb^8Jr#dFNb8Y1Dn?b0C47gSM+UWJ{_%9j~o0_UUP2XV0$$i z$<)c3nb;pyQuz?f_hv5)RmpTPGJVrOrc&gb3y30`5$D{*Z#B92`n?@7(s|1SQn!-~ z9RPrlSpg#;LtsENMdt~DMYAcAoBs@;$o0iBt7uNel)O7XJBzubtm$Su#_4u@D}ss` zB?A+1RsGg3xmZPHk*e(};5^scfip`)Mu??aaFO?Zjx7>-Bi!6(wHnNuym_#A0~|P> zJ;wuI!RmPoHltvrl*;rKV=yRUHd}pjB?Kd}RgWs~Lfe8`j8iF!=*`L$m07#c5RrHa zE=;1+J_9NWF=F+3V27ooBHVY)TMr+dovlCm@WWsK^&j4Qc;Z|4AOFAp-+%N+f3zF+ z>+`b@Km717|JA>;Iyr5cW|-o3KZpqCoMIfu5lp&8U(wPr4Nce9wwH)qrAV7G5FdJB z1XVHvsj2W$L+twn^%tdUPCRKRw_|ba3TCKXehBTF2QZ8wTv51AxRv3ZJoMB4I z6vCoobW@C%H@B1Id(-&dd+$AdaR0@N7yHd^oQABjT%WA(-FJ*}+=UPnAg7dU7eeUT zcD?L>^83H}v!DI!7eD>Q<;#of3m1I*yjyk4_38TF{RfYlZk0vV$Pk?io;VP)0Ru8| zU{}P@K+Q_2fqD*+Tn$fSR$u^RLNF;R^V$YcM2MUjrc`pCiLMnxs2h3j{UMxnex8rs zsj73p8W9mN20S2vdbC>CgNe^!F;i_y3}@$QaLzZ1vzrSs@ZryCoY05B&IrAW)sDB6 z0;sB`N=FX)LI>^(bN$R;A^EhC0%pj;SOU(2=7`?IA|fo2$#qSI?&Hji&MH-6S}s?8<49Fdr#z)Jnn^ibg!i629M9LDyZ}yP-tVrj;*h3& z+b;5B63=9&jhO*JDyb3<>Y5%A4;rYt1(pNg`#P~20FH7)JGcRUyBb#Q6A@97 z*M5DkRgd3B@!tG1Gu0JV9a@jeCuXJ^xdY^Vqjq5J6T`fuQZR>ysP@{5&XF&0>_JFv zhFXXY!eXcw5Dxy?71IDSC5L)UI3-g=RV1R|+UgAXW;*Y>qX10lI^O z!0Q>mdXDGAEp&vpM5Ma%7|lOgiIEYJEG37i1ORYwQ>4%|%tt~%B4jlAY685I*?m#=>CgYTWJ*I-zENJG<503ruO=t#DiIS%Mu-R->b_ow_pzc!|axMrYNlKQ$E_7`lYE~!bTmTS(37wgV%syfY6q-iB z2+eUNXhUVqI7hWmGS|?j;+R*}aeVgB_VzXGUK$)tRI z9cHfnSI*TSrCBx$ulFnS51bKOs7FO*HO-!?s?@eEldJFCxlmJEYt&aQ^DwuafcUNV z1_$K_6EV9fW}Fezc`iPba#a%qoYSCD0gM=m3K3~Jd<4O(>R8h4ZhLWieQ|S@imI_P zCCfQxwNSE7Ij5XOM6e>pkc-s5zS_uQji^B|F+7w%nyuIKY~Uio2+T}?l@Z0igjl=@ zUL2BL=28Ce3mQ<)!bpsmOC};ms6|5S%}i8^N-+gQavaEc=THn37#)%DAtF3Uv1u$N zXDJ~BU@$@op4(t4sg}VCnt>v1k3SNZu@Uw(e?{zKpQ>yr}@y|}oDF}7{rgiu|D%(RXh zl1s_Ch#*1;0bmY;tFhuDqJ$L;JwC&#>cBCQnqW}{RU|AfrRn3r{cRnudQa?QmLZQr+3tp`F+~GtmuDxdcRg|ALmL`UEGl(C=|Xo% z(;;SG*F*|v3PnT}nL_20nkgXysuUHeB*yCT2qCls#>V^LL(aLRTr;AFVNes#4h>8W z$!5n$XHpe`H!Vj|5As5*SRE3WDq>ZWi$khbwOnx;Rh3ExCsx&L#7b(6V91V~Ef$Lk z`WOhpF>4;ZXFxQSW5|Uep_l_v)#{3Brc70yRF4-2s8;ZR$^jyVE|^)pg7Xn{(BK~$ zKu|zL&kl(wPX)2Y*&mffuh&fnPCnKc4@C1mh{6oa9r%ny_R|QBhkjA=7=3`gX&n*>bY1uO z;r-Lo^E}1PZu`!YCl4MyY}@{JdkZo4>lGN?Twa{rzgJ>1!!{upSHJ)OfB;EEK~yyC zh!BX;141rc*QpjYDJ3Dz#}b0fPWa^Cy#9UDkGl8l99SB6o7- zWN~P_^*tQY3o^*rZZ`wp4ZAy-+TA-3ZLwGg==JsODL`ne4Ad5jMJdHVQqH*~_RH0J zu~?m0VKKbf?5AmBz)HgH7c24(#t|9L`>tE`F{de|&@69v(|$KzP1C{5rCF_3P18CK zIp>rLA_qTj%)|hFuv$B+A-^e@5&;K4<}u~TdtYGW$x-tIHOdcS9BRI!xQZRbnDwWI{Sma;|9rfdAUR@)y-0<}}4*hTb;{Zj7br zR&9F{Cy7y(s}moZVH!vAq`J=2z+6f$MNQi-0H}eILp6zM zh-oUCRC1AgbP1^#uyd~DVxlD{Lg>4W5X_|O8Xp`Hu&1_bLf0BX5-CMPV9|m^29RPz z#I|jZgj+BzC2LhF5gJa;_>hN8E;v zi6rKd(&^dhu;1pKyG0uUXDwNhs4}}M!G%idF(I?yy-H!iHZ)9R25s8`^6l-dsGY1= z#FR_!yUqtrV^k6EoMWzJ6eQQQz4P9P7Tr=sn8>>Zj0wUx$n&SyUwr;zvxz{>e$s5< zn*M6L9aCxBlbAGS>D$GkU*?pDVGOQOQSXCyPR(*PcQOUioTHSaBBn(}ie%I3?2Dyj zsVkfVhnX}ggKN3bY}0-qpwsnPnR3oj!=v`Y zh)hOwadEZ1nc5H@K0IG9NF{j!CKz_G+wX>9dh4C{{?cFitKa|L54)~kELP6D{WKs! z-}jB@lA=l>RME_YZ5xO&=1J=@q*9Fx$2f@;?;SuXCDo}yrBv+4X2G_JXenCM5I`iV zq~Nu2qGgLZ?Y9?b38bi`lFKwr25_=Il_Dx8TBB)DU^d_J&O7G}$T?5Wv-5yHblvsM zP05*=g9~XYDn_mmfbA5+qR&9UwCtBnXe~|KTX^ro2koLgJzIyaNhzw8#bVKQogs#{ z?YgdAEc(TgozDtIaLkr~kUcjohDO;LIdGxrmq5;i7SY8iB2W|BQZ$w9Tk4nGFL-^@ ztX977sckK$&F1dK)z#De{$h9c>YHzVvAuiQ_Y^#trc$P9+@-ij5br58JPaGNf}o~F zO+)Z5_>z*8)HNYZQ6w+=UL|k$Tklyc4bx66BV*3R4A_MtB1K_NIIZav)v1n#{aA{i zVRf5xT$6^)`5*wUZI{(kx;7D_V1RAsk-REou^iKWHwFh}Km?9_tKwT-^jo>&qh{#xDHDxzAJ~eiHEZ_W@WX1ejfz>ha zQ^}&4(CO&2>kEU>(7dLvIi3x#+Lo-kFV{9gad|y%cWV`hQmS+@Sh!UEoZA_|1JNF* z5mSe<;3@Fw&W}=+ng_~!AAIC_FA$y7U(MS2=F5-!-Zey@%tXdB7IIy{YcaWn7rQN# zmvcAAHel3#*KOr-yEqiRN)?@%7kj};!rPiW?V|Y(p0o<~S(6eAtyt)7o+d2{BNcm+ zdWv8&<6;?!T3?PRdpkI87`D|Jkj0}O8^dv5$^XBa*?UUAEvvG8#`a?#w*I#2zE5X9 znK_>9S%ux}NsO&Ay19??Z6Q~1{m=DT;i;>HKBlD;c7|Na=0P9K!rClF?}${)``6hQ zt(EZ0^ar>z7M$#BPdKl3Q_k?*19jD&TLyY@^errAYL>UJ#>G@q;Bq;5-%n0czA5yb zki$(ureB+ZN7d*4%|f!vY(mdAd;hV7BfO8k1>q;s13JZCBid}jPJPhvp1r;|`}?5* zZFn&*6)o=sP;8fHqvjF<#$r+plNOFDDe53WnTX1)AIdvPv4eFrtjQTougtIl9321A zC>hu2R&%i`OR3%dFR`ODEh`>F$C!UqtR zYW+I*!>;DS4vx|_u3Ud1iIjNe9&yM~YD$Wmu%?y_CUTMfC~%@85};b;XmQ8jttJfI z#5X@hmk{MKdH0o2@Nl^rLbn*~A5=zLv8dPzwDe8C7m#4=Q#fp-;ZGLMeTMYnZeP9n zv=STV5DOWqj)<&$)J~zZ00XPj6w*cTS%m0U`Ztx%P>_sJ(Zs|ATDOq?chsx9^htFa zd4~j1G!K*FhpT!G(<&dNSX;56mI<$25ZT0{u*b>$AADrThFjD!5^VVepCwgArKydP zC6J-)wvb=GxvIBR<$~`s(cj@V8{vUlz(1KVz1}JyEsb>q>lEb}GaD22pUBtQ&x~)2 z{9XL%kQMi!aXyJTz30mR=fDecv!zz6Ig_}BBlV;Sh%Sa_;$9H5SPsf1FB;g|_6Z0; zFJXgm*@E4<)o`LEODnx_(K>9g)`>fris|^<`s@0qE{i} zk&rCd%tQ=xI4_xg75o36N6+a z(LR2BpGe~h)L3b#n05F@?{ohcvIr$3d&sycjawVekhoR)>Ug(B0QvGW$;jAZD`RTT zUNndr7OxxR7k#Sso&O;#fy)`~ZFY8>R1}_2P6Zac>zY$!V_8_xzPS_Z8=xVGUBb!t z^aP);4Fn>-i*pu%SFwl!luORwN4C7P_q`V&qJ%Fc7PGaC+b(h5y__8H%km5jk{!eb z+2iR!V+PF*rd|&k$EJmGW+v+y&pVcbE11Y_dC2N5)SmuP@H<$$*sa0kBRZbP61*kB zz@~gr`k;|K*1Svvd1_a`^v8vDSk7dC=fC$f4HqsoLXsS&@h6D3v|lDiDaNKl zd;OTL<zCyjI?+cT?HVOCT0)WTS6+;S%9jrXVT zvIX3lI4a-P2} znD3iPcJxLPMA9jSE{72xbs13^y%)!O4Lz5x1y6DEskC3?z-W+I~*4t zg1cVe1okJE-GPhSX$(3zMPxV<@TDqdSRvlQK+UTkM3N(EkAZe%bXLl#h`9>zoYN0_ ziTtK05kPgYspUnwJo!SOswHf9i|UrC{vD+n0aL&Es`>lN(We6s@#{)AL}Y2Z{wmKy z$VeXo&~3{Pt?DxwIdmt~7Xq?d7jX*ht!^MlCYg?TV;l*w=`xos`r0ASToJSb~AJl)C3d#F#f$>3~tJxiIJfyy+fd$&jzIpy?|ZI8sZ6^5O6= zv{|~=C?o-A{(5O1+3kPCgwccS=Qz=zi$?95JY1(=) zb)tuxDI*CHYQto%{M7dXc{KK^I2fd42cuz0Z#LMwc;7%1dG0M7Dq7xmAaU<hWifVQ*qgw;+yL2s-YE z;Z)Y$o*YHGbx?V>*x3A|I^yz- z0$-_@dAS@WPV5ebCIUVaZ(OvhE%sjEJk(USbLAyr+xaMEx>9$awA#J=@dL4n=9LvI zOH27+zcb44KTCiKxtAi#!?Qu*{QUb({>?>i=(&pB&&u|d*Z2v0%o#ZQW0pyNJ+qOj z@7O-P<*oDJ8yh>5VA<^&Piyj|px{R_xFiqrC!1Qx)b2m(^ z&n+aF$L?g{%Ge+S*Z+`%3WM zt3R*uq6>hN{n8JjZU8nMn}+a`q;{;@ixCYqRZ`dxv3H4<3|;{XU`{^Jm}iig!6qlR zXzanM$+}gZosJPz4=%euLgxeO=s`K`(E=E2yuy=!f z-HeZyK4mklGUGj!{ad<~_q~78SFW$|J-&?=DK0vyQ^R2b5>mcYr2Nh5yXp=51tFbE6;Z9@O^+;=Mmkx(?4@QR+3}b;xEoGt3Z;< z#lI~Ai`86b1HbG0Y_If?|9&KQIYXhZ<(E7fw;w*(Sl&-HRpY0NOcAW!dc*Z;W#1AD z@p{I_nT4un!$~O|jh>4r7n(|AcyB;!F3~Af zB3;`fbsS$$Jk8dpOO|#U6pZ`YJP7}ck2YtvOHk*Qy_IC5L|kCM@>ZCS-*4jy$wSsA z-^8{uBe56x=mS}*dBCgH-9a32`YfQ8mPH)Uf_yK!8T7pTHw5J4lCSYM=vD4Wf#}mSW=DvxBqJjQMPE*Q4B3C1JI9AUc#OW-O7K4?&nMUMy@Zfn z{KMYk!s44tCz<@0{P;CH-e-LiP{wuHBtNfh9pEYFx>azp zI|Zvk+ocHSdVlr$G+k8ygNOuA-idMqadru6sHqzo#DZg=s-UsUdYEA)b3+rSPjoe% z*q@+~Z50tlnA<#Ixmt-up66Bx6aTlwboD)!*<~8j7wxB)JY|-@$hL`jj!9=UQXW7>h14zcpD@rFiPI+1LhC{`6;LS}C_y^bl z{{mgMT+#7nM?nT+b63JHvm*5%cSR@At<*6k!svs-C`pi9{q=>fUBxY4hFewiIkmZr zhI~V5>E&iWWbb_O@J0F}{X_iyJIyL&xmiDt!uUrhs!$lF*qC9++|J547wXmzcESt$ zoup@3(a&q^PLjGk^H$#oqP~&C^4g)gMun3#{MgG}lb~WDVvb*Ae5XYfUzhUTQZrE8 zLsWUvDA^x&-HHx*L(Ae(o^)MSWx)QKAG0}B}=dEyMX23 zOThXI^cCcRWkkT?^vPE&a65F2ry_+H#}3My9yA{3Vxi`q##%5Zn?_2>g)w3_a`S|j zAs|Lr&P=gMn*7o(y%a+=34@dzqfz=j)!JCh`}3>elqaoa{y9}f3MPFoZ*e`Yaj+ao z6TMCES9;XX7?C3(34sYH?0=*$JuTg0%`)ukBlPLiXvJWlANBR9PCP0N0fx}P&d$h) z>*vSjRa$LkG!W$Z=}cIjx`0J7-}mDoti0yJgHEU%fA3N~n7Gcp%b^IV;`Et9Qq(C?W}k=>aQpH~-{3 z0Z-Zo&db#h;LDDWJF=ZEGv+Zp>kD<@znkjKKGXboqJp)O)px@8*lr+bnlC%Yr`{*o z&`t|77&i5y*8d56?$-xnT3QhlWa`>uM#3QF;i<5BnNkQv1C35R za0kR#V1mnI;ga3v;G8it+A;3yx$8f8j$hq`ZO)#Xje|DM)A;CIYWL5Uaf=?k@emLE z5^Lpv>&OK0%sUpAOkq0pPZ&%(<}}u+{vHXS>}o#}lRYLHou$-I9O^kTwPT}vG?m7t zkq~Vm|7wLy$Z>u-)n!lR4{h_sOne^0uM8dtag^zCg1v)S1(*F&E7k|Jh*F5#Fw-Td z>rcRN`K<>RKyXMGBa5R3(IcrQlhD1HJbL?rv5m`6 zWLVhaM1qrkZ%^oHm)Kux`S3@t1Ck#shyMkV`a3QROnpK8GpEZT2E<e)lLy2t;{=bJRIYh;}3*i`Zq zUgE>_wtEZ4ewp8mS1)JCKU%GYQ^6zD2(S1Y>b7S4ytPVqfbYYi^1`^=Q^gqt7S1`b zloEMJ6Kv_!z4HQL3CW!)VXwR6s=lnNuBA*0GB5z!8Tt~-26A>uO%4Wq*HdQ)Qip&j zFQOFee3#j=e3gWlK0PDDZlA=`a&i3h1!wr*e&C1ht5A*k>G8$I?iR&7^`rz1cglvE zt?=>Lk|*A()^L7meJHt8eNMEq-h~{htxUAt9XZ-jC2W}ah>PT_EXcPa*!1-;sv$+r`ixW+Mj_?P+4&_a;^o5iJJ)7%K4G8mf<^t58N(yP!m!w!0(;L zmbteDkZkVn`=OT-z62s#t?ROpb69jh@6LZ`9#XXE^qK!4TCp(wwz=$ms@V9uO12uV zX@*edAwOU(9vr;&=xrJX(bi&^*II~@rQywiZCS>}d^%CvpWn88@mGjhiPF@B#HiM? z_P6{@GuUTeRU$p(Lu9nTbir*X*~zjr7g@wIxk>(D^@c;)IyB)+Sl&~BFOh*_9hw3~ zQMsK}(Z199s3su|_GUM(aPOi^qVM{!Iv;Yli1I|Ej!bOQQB0LpBsvpJ<(iIZrr(>> zq@p?$Z$f$nO|wR?r(V*j&h1BE$=(6K8mo4|9vsf2f%^k0tstwm?XK!x*2Yz#H`Gnd%Awbzq>LU2f`$Zp0|;E{e3(^4ZTC26uY zQf9uRoX*Rmi($`>*4XzH8&ZqO@nL$X%M!JRt_QoYoxL1MC3=E>)ZTNTWK53Ak@HyU z8GW?J)&IOdt~!TgJX*hnT<)3*p6u+ynvo|^at~A;7aPa_u%Gf#%lOt7VDD>Rq07et z0o#stA6vjw`n!85SuXl}*aap7VY(KE)_sOXbSOOW)m^F6^R({zckX0E+t$Wm^x&!X z?76~y6CRMt9ev)XLo`)(l%}f*D|$4lU&;N?Y*+|QTfXCVNdBBV-W1mevC7`-e36jvZPo}so!4XpaNQ^W3?|Nxw|0-@l2bH^)J+^(@lVeNntlGusZFA#Hg74E zYxES{GsaVFu)T`^Or;DW^PlvqJsok$5`ksXtkdT+_F6Yox&)tHo+Ek{y90V8mk#i{ zn1aHhtem@6E3I`W)_q)2zDcCX>s1!#$&ZrO;l6WzPttD=H8?v2n%xNlm4LkSnqA3P zX8;PlMFjIrupj5(Da#NrsasV|Ew8b3`d*+We4d%~%<*|#F1Oc6P!fcNUMi))h>Y>S z8rEThlHrU&ur7TRBWOh3By+W>|o2!M{z4n#P|oIV>J{08DZgMZ)&Y{wAg} z`9V=HVdJ1r%)KpU44K>~^F`O{+VpOlCkZ3b3`O}gjf?=VcF|W+i)ZGExl=F(HKmit z&_DKLJ$Z}7a@)f4PH&MIM%Zz^`%*n_&u8#mbw-rVM2B!2%O_y~fS$oN@iFe>Fl|hV zlT&XerP5OYN}_~EnNymi1of52lmTdNUDCWWtCx125AC9z@P|OL6H66{v$}nD@qj@h zZC8-gmq^;Mf|Nc)Z8}YrN)wu-%0_{hSt-#oG}Y?p>A9QA7wp^J5qNGGzwv6(%6iCM zzPtD0A2wh)WDm6H7tp5sFtKve?%+F1?PfJyJom`i#o=~w_|b`eZ;qYyqxjFyO@Bvm z8XagjJpkoGU`l^=Up^y|7U>_0%e<8{J(=oy+)!iwwvcpN%~6=->jw3F_0HB=t9vk! z5ZG~CcP@S1I{~5(%|9NWA5H!B_ogi&DlNAx*Oy)8O$=C<$8g7FIfPHF!h_SzjcWon zxC$|7qq4NhC|8@jzDkqDpQn+Gz#(#3mR z^D5E(V=q}c<6p?YlqW9!=Cc%EuHDwZzPt?mEL;7w)ZBGT9=2^oHSzA%Pc~D2lJUE- znqLcy1b7OK!d+>tuySA!vDEDI=MX+Wtwgtp3C^r`9BF3rxAg}^^C1q)uiIAS)497t z=g9p+ecO;nYcriTV%ehub|96UaXb*75DQ&Lx#)m-+gAw#B&t-dlh8W6LgLZx+V0xS zrcX=NeA`$gi=h^e54WsT>}Mi+p{fl#+vp^EWuqds=SuYLIaRT_%6k6Q4|$f^co`sE z#x1hCqZ74knqU{n^aA^ldmvV2pD9D*8QW#=T(g99djZije8r&Dh0dPK}Y8Qu7QYP-45Wok8n9s4b~lYo_P7N+fFb~Ppdi6`_>|No&AtV(Ob1M&&0B{9Fo6;N$DCb`GYG~v1JFL z_jR;%azQH2`g*47nK_Apa(dO8Z=OUe3C9l@*5+re(_2UxL2y@7ug%naCT7+Yn{}}a zvkA(^bqgHP4e2jemmn2G%tQA@*!?5b4NT(TnugV8k=0U4SIucQy-5mqf9J9DrvoJFMHI{|L@Dc?s|<&Rx3Y$GJQ5| zzN5fm^u}bau;H$!Vi$h(H3!K6cL+{89NLiH9BIAlcS zM)M3+*0tKJU>TVolGMP1JU%)avh`bTt!qbXV{8%;e0e?;pL!0ArGelk#9r+4-edS9 zsFG+$1oiCGy+X_NDeR+mbBDP}Vwgct{@UE^34j*$Ez{20nA(bq);a4(Mtbh&08NjvM$QjH zam2C>RQYK1tDl8M4J$!-Y;y0(m8GB7d9W|Kd!cll;DrBv_~efoshSqK($rTPc2G#~ z(#mE5Ha=c^yK3(V9s3Erv}m?A4*3n^A!mGje&MhXP@2KeDKa^4YLb`?LGx5ccV%+{rf;Ox!2}n;CEYLo2B~Xj19ilq zrN#?{%N8E7V!a{i?};w7uIdcgpI1xLJX`<;l*VF)$3_7zP2<@(&n>?GETr%~IO)wd zn#WXApU#jo(~M)2aokl-b|lKYN>6vAJlVBJtbmc6P3TC_=EA*{-0Ij&8I zy{W5ue}Qw4@Y`7|dyHIuJsr7g+cu$BGcw|5s$g=ammYV27CZ$RX+=B}*^IT6;FI%W z(`7DijX93?zs~{I8y)aLV@+=v-?==RICx)5R7wnbHen$dBJkeo58+C|;@LVG#bj$e zHPiE!vGQ0MCdQ%6t9(blYw=$hb`vDR#*&O|5dj-Hp-UuXeRH*HQj|3zJuXe*DrQfaJM-wOf1>uZTRe12&P<(-|e$ z?DGWMM8M2?L0X$0=28OC(BjGBtUX zRd1I&yxECMzM1J+gLUDz3iN2Xew-S0FG*J?f3L;s@6D_Y|vYB7UH8=fXR|FwW+pZ1dDdMNLh<^mb2u zE4j|Tw4wpcSOncd){x|d0PpemRdmf=W>x>9oM-k4E@S)*CCr~c9=L=ff*TI9Z(*%ss?v=bOLmT;J)Gy(*M?L z#wLC^Q6dxEJDifE<4a~~@Gu^=n`)^|hYV)REa~@NUSPgk9|%&3vXax*l7*!eFewYY zc}jH59e)pOOr`vb9%?K0DV$eka)0=K?ZRG#H562Rr-rUBC(?}l{iA=g@6b#6^31@> z;8yudmQ0s~M|X5Fj`Zb3IvV{y^1G&FsLzM!qTZaiuh)EOb#ApZd=QW?2CeDq`#s;p zA`!tLvBBWmshxFd&5WBlKx}E*tYKe|BWwEk2Ov`qe(0W63?_t*Siust~1hdLALt57t{g1Cr zzYGSCDAOi}CoY8Dx%(kE*3^H+=d~8W}w^mE&N&ru(CfhJNjt+OC?>k2y{fa42Cb-_s{aa8$vM zSb1E8Wr0q$0QDyA&Q#TZBsIJDN&n+9yVHj%up4td+ZbUa=7zAav+6+(5vt(e0Ayvy zSJwDvxTVcChhO<&R%+Ek3Etn*Oa-wo^_Ro`tbTO4Iz8PC>*X9uT_`L%C4wdf*o1~% z0a3|KA8dg3_Tredz&EWC6p_y1{$)=jmvFGX7c*@Nwm5$X}o}{xiAf=7S9q z|0OvT1H=>Zv8{Q-79-#aludDNOTT~J(6&t$G!O?`pnpvJ%%Kv`dJZCn6Z)k)geaQxR$l0~_I(O2<9aco$P=Z4eH2KU^&u}U zm$&MbLQ?gS4zSaF6=tlemIU)`%g1_X*TfB&4R+-Z9+Vrc;KOEc{NcyrnD0H87c(xvjAfX655j@U5tUuF>;8j4|n;YbYHBWN`gr@A(`Nk%y#CzB@3VUZuP4T((a=X51K&kD`t{@7Y@-2fdq=(+323Cy6iKd9x?? zbbWzRtYjG0sPxUyIbUZiqzY~;LzwA#?E=q*uh-JW!~T82&E9cXYUTN~a(I8PxS+r} z4;!wZH45aoPLajF5AeKl8j1F}lw6MYld?nRX%Va3PhS_MXdM-qC?CI`_W65OuOnAy zP8B0%VY2%7@BS5?LZDY`XGbWa-vV_7Tmg%ZgwC@Y#3m*t02NE~<0r_o{hiIx7v6F4 zAy)s-EwuQGJ+e1o#sEL~)6F#YW9C!~I?WCwqu#IOfgRMA7%qFvqaJU5M>yG}3!Bz6 zlV4@7!v)$TL~Bp)Xq&!Q>(AC&sI^ivAl)90zbo?)3Y7X~)T{t91=c*e>3VMwwZYnH zT3(*9TW#lG%iDB`9SbG3vxpnW8L-X!0r!>C`Lp_~8=M5*YRr6<=Zcr3tIO}?jEjwa(_ut5PgO4ooRFT z5`;&@^#_^U=jH0K+Z}{%rP0^nmJn0HjfPs!g4pa<5Xk$FWab*I<$D89*R}>^9`CPM z$Z36c$-Nk8N5AVLrL-7q{gr;|ny_r!PM^jT1%B9}3%?RS4-=7^PH5(%|%@(LO!*{B= zM=lL8f5$2|1|g*bBLm)AE|1O6_PkKHXkwVO#{gi4CHs%7lcobiQ%SvfI{^DS%6j83 zSh)A!!T8|<(2~oKUGfU{w3<$YIQ}Q3w9MUXdkdJNgTZvF7-%%v`;}Q%h{hgdDogdQ>=$6Be&(hn*HgNNIs^Ssn(GUy<)A|9FR@=BC+3! zmjCY@rT|1@u@Y9+R#ne1i0!>5|6W%W=RDNc@){m>P-kCsAHYyV@3TzkV^}LQFd2l? z-TnRjlkbW)q9HsvsAnyHy11_I&lXYD=a4TF8zN&xF>1GXGCmT~%hxD@Z;>tAkCZ+4 zy=rDs=k*id8FJEUsmgOzhNfQ5zVr;jE%ks>``RWUM4{X_t3 zH&3!dNo|3u@cN751*WWzru0N7DgUrgV|yFF+=2i7=6!NeK~cSLEKoXExC{e5s!m7u z(j0dgJ;LaCwhi(c@RU8k+B^yM3JXI34+fLwm<%R+vI=%1z0VF0)w}UJ%TjFial0NK zHV|Jgk4ed-P}Z>9LYoYN;nyqIAI4{DHSiO2+q&rpb-Xucyt%4FRT|2&OxdCk z;dFr94e8Q$!U8tCE8rFIY8TB3c!R}z7wJF+E7sO!FS|}2>I-nW$*oQ!1_grHQIg)D z(@u6Spv_mC@s+4n1;vLhY7dh+i)p|7+ufW?`sf)d#s$lC;Y)2^YV2=xbM>@?14b%W zyAcATM2AygqB z_{SCqakux#+7$DyL3Ixd(H_cWx4JlY1IsOQPfQa*AVm}Gj+#RVq zv1J=lHnjHBoqG!&vg8A{K3uciyr#w`UI?PcvA}TTdcjE%z}{VUhhi94duJY|#ZCuY(e)CpIj=W{ z#Cxy*F31$$TqlPU4k(iquKu3vA8gI8bOm?1Vt0ar&`b9Toeg(Q4AdR?D2X=Uj_Dj} zR>GysF+MN?DASl8?OBbX)@{odfx9}&KN|MY+`z@Kl01WoV*kH)8~v} z!z`p(VZF?pxF_zA=(GF1IGPW-UwYg~h=&eLE2jhE;VoKVbHnFMp9|uvGQjEU^?RSJ z$XN0aS2Kq@P21Tx{ii1Gs@wS` zHD6eX`ywK8Vwh5BV%ZtrK=NNenEfWsZMlR&Y=_!4w%Xi0J~_T>GyuqmfJRa&8|&O= z*hhpgT8X___h64cI`m+veA`q{SINXo6G2uO$cic$$caVb-`EhYM@FjcJvIB=dZ?FW z>doQ1EjGABe0oAUn}qP7q2+4Y2YZ3HNAP^q<)4kIg#eZW)d%m##YmnDBcxyZ-u-@u z&8nv}_;l?DQ#SSo%&Cl3CBR46Rtze(&E7<;bPog7eL8!Zm-tPB%UnJhBUY8gF8Dp>w-0-3z>9{M8Lzx!C~AD% z>MjJ~*?m=R_18ixDQ=>nQ{hg?_I+|bTV3yO|Lrfe9uUqhb~EXIzNKBF$fY;e9goW? zwaAKc-9TcX6#!)ZO9)>3!ILPhAKqQe1~UV8slEc+4>KjVEvLJDbumov?ff+Ru~eRE z5m7k&&-0Ue+SSiXoVE*AJReOkRvoi{B!|P_+84~X)Zec2<@=pOe8`urzT(j)GnZY) zfS%3We8q~e2kzEP;m0fPXD*8F`Oy)1eatD+IJdVo8?sz>d-Ah^s%pv%RnJ9CX1clqVlw0Q3QQs|FprB$u{c!h)cpIRDKb4aH9h=07B8 z;*^rCsFLLKDJi34${k*(fLh#_G6d8R>@;tOK`QGn)pP)O(*A8?y*j3uvfPf7JH^X# zR>ciAG;_bbgOYXr&TI}WT=;!9OEIt&gjiu;r@DMLn~8XIY!$EMFTmT`y&R*$m=~~e z^ZWV({_Y;e!@KdZqT)z;cVKJ2z-K$Eij2Yc3W376W`;&<-ifS7u73nJ;Z-56!hFiS zPDQLFlsI!Wl;l9c7()$x>h1cADnPDNGt1Ag5Q@l3dn6OkU~OITS(8|8#m~*BKphyC z+7Y;^Bksu#4%nUk*X-1vr|s3#k}+|WV^?jtMja%wV5a?RhTB|QW1rcz6pNL32Y#>9*RKZ4TpfDs zw`Ixj*OWLQ1#=;IgPjAqMU6Uy>(>hs-hb{CreqoO4Tw~`4(3*Si@k1Lhb!Ka#^${k zm6q!5Y;T@K!=F7Up;Dsfn@bBwv`74eCK#fO`_uri-R^HwkQhf1NKTtr(h%GU>t{^Cdt|Fs;uRt)J#7y{JdP}5cahHZm)Qt_NC7?dq!Pdh*7_npoxbpqza_7= z&I`?9ns}QQfC@A@eFtV|5zpApZhqsgSb%rm4Q$&31X3gdT(CT3G zvu#$a!>)b-Z-@2b*3GQLhsDL0f1Q@{bvpxEZTx@Ly{FUboEYo#V;{;#j~`&g0Q>{p z+goNI{Co^o{`;Lt=W{_2zwlsaHX91RncwiXMSI=&oe zD(`Rs(9N{oy(=G-sc5Ho?M4Cd=%RJqhN zzQ&yQRnai}lXhUAYgnqdkQlufLP@22*y6HFRC|%SS-G#EK|N1!-v|&=;_bJom{kj57_B%V1(1 z@n&}q37Mgw4HJbW*{colk6&if{`aM*>$$_)QJ+W<6U5No6zP z^RW_uhB-UU_h*P23H95&^zw|#DXsdjaDOWQ2^b=R3qpL6F*z1>LQ_@KLh7jWLD;F# zh}&d(th3c%1S6{l;dul4h3Bl19K=CU>Hc8RD&$7{&HIKh?4LaLj zI0e|{5a5Z^moo`NtP7=`aOFNBHr1hb&0&&4rG0vw8^>Xn<#gbsM-4I&-4-z?2ox07 zu^>+l(fW((Hvsn*-iG}1XBn#dy|+i!ywB$RMfm#4#mk$;^tSKUe|v8#(+~y+PKtzu zQI@&zV?mpqQ1W}WpIr|X|GaZf@bPW4`ItRpcJf=@kcIlWuI{c~{jmd$QYp3WT)=t` zLiPGwT;YkL6>=K@+yrkI0=3~GbyRt+cyA!U0Ksztd1T6!E1T=@*R!6N7s=P+H`n2R zMkby+*B73bEmD1^WDk}VZJHxX8{X;U<_H24#Pb7t^iaaC(m;;rCA097I^p#Ny$6F zT9Ov7GH*TZ&n8|r%-NBGUIWDAJ5Tm<^u8;pKIn-R%?Pp>1Ch)q1=7(f3iB##ff{K(PoZM!T#R8f}O2 z=)eb;UhDr#upjk%1AAO3Gns>|srda3{NS2YeKs*&kP6Kdo_DK;T86ugRTN8S@SI&0 zt$R^Th+*FjGm$g8vmyoLZb5FsUG*#j8X5yI_2oeLf*9_cM>ArWJljwh94qvW^=AY% z7*(8&VMv)2o_mK6Yr70c^XIYC(VTew3H(k8V#ro-Kv<3zYUg3DG2oo%5j zNWfcnD;AD_YfMO0(VXSSp<87Pw}$yDG-Gre(4o&%GH4QgAx~RIl~5^mYY7>)*0v6; zTwJ_f+)7HT#H?CL1t5N0dcc$*3C{#S58%O~xw6eey!=hV7q1g*8L!(t;g4!J+sB!x zTRW^>9G~mo?CuPlpHwFIR%K_eTe>~{0^d_jDdoDuQL+55wQ2C3CX?jbh@3+yk;9%(tZr{mTnz48Wd-ycU zm(d>OFJOYhwzHXYcEu|Z^C&rW1WL zB0$_EvwBZ&K*O*PSdHiVbFN|5l7lO_9FdBN?oz*KLp=kRg!u-bhuiIWsPREEbD4m0 zp^!<4V~|}RRv{@zq_0aO^`qA%SUo;d6`@hzQ@=xy?Q|DGO?B+~rkW7a(#cD(5 zn`<9X_qT6k82a(05UWPB-#bi7q$&U%e`QD+_Tm0x=W>I^U7x>fkiR?&!F7ca^u%7F z%`YVOIdO!oH7CUm%YvVZW(hslEiw)D-^C}2jnjjQT(nBrOj>b1g^|Xy7WO(atlSy1 z7t4i!Uj;MzkcSGsO0*I3bjvF|VPvs>xt?qO>|pNjfaB+_RQJ|s?Fy6Gm+MF-L*MGS zvKT62$h!^Xd~Ca#U4+{5n>33}L+=4{9@uw8x1o*>Byvripri$c0n}u^4Ki+t!Q7wb zZYO1vR=woaNgllydMXY_6$E_LP7nV7hU_=u@}E@x#BfPk=?JgoFh~$_Z4}^iL{sBa z%IM34;>du}pKWN6+R$jwTN z>&hF)zZ+vbYV}2~yiaM*(9xu~*y1NvO-P_`kI9hVhdT2-wNo-AB0XNNWQC|Z-BBNf zZFY!Arm93INLE|Vdr>ETR#o)F+IGc9Hc!|mL=h9o+ShSJ`F9@}FrQa3t< z=XfBZV-tQkMX4BkBMyvgO2`5+n{nED{br)-1`aXwj8OL`OBr3cuU`@EaUz^UeDq9F zMoTi9Wa6#1qiKaqbH{vg%Vb*j-nV{> zKWcxwA-k%Vob>fu&9KTYB|2mPv~B23#7b7?;F#%{OTz7FP=_wv;m`s{@Rrfd&PPhI zgGL)gh)LF?s4peE+wYs2s&{mCnu#|Q-s{?n3`Iq-GA2N{?BAdI>|D@-sgls&$dKpI zpWw@woLLK}j?;th8j62OGRDE(eGhJPTWgXByqGDF8qD~{s{J^9c)@mma>*TODq}@e zULkokIr}n6;@)>udhEeo|8xwKeP_?|>)FJ#j&H-P7<1o~S#JZT;_&P9nSseW4_R`3 zDM0>3E~1fdzQs-AQ$Le=JGH`T5I@SP_?UyY-x;HAlC@5MXv`M ztY5tu*)F!0imbh z^aN;V1-<#Of>@gL*owazFt$1SwOqHJ{$*!ifLX2bZGD@2w{>EzfddVrB$K+r-Je0( z!=O1kU;pt4j>E*>)0qaW9L#lYw31GN!|nW=wv0{C4x)r>HAqf&uFfC!$^jf{S}`$* zwGAzMTiqlu>cbgDpFj;Js+hLWoPfAMQ9Hw?_v z3=&E`CCylGl?lW$bM#MGF++O_5v!9t-yg`dE-AYAkrUgocx;A_0FzPz$S|&dXqAh? zj>$4PMOOQN9G!9*Y$cmUvMoPjIs-X+)QKxSJ%%Nuba{1fK&+# zpn>Jzq+IYXP}4CRpD5?-;eEouR#HjRc(Nj_r+mJe1h^jfNv9KEF*7<<03OA-(11%% zD6PG8rSKv8_x#_3YEBiN3y9`V?wTA?GogL21KZPv+ zkXwTa#=bF05a3-dOYJqdZ(nbA&uE+&Q<@I9g@vcnkwxS97Iep@S!d3`Q1v84c&t|J zjYTAQ3Y7*Ww)@Tq-%fFS2nVS6q8bo-ii)8BY{U3$^4x8|nPY@uf(WOn)3voXXzxdT z-Il!mxMcF)_BT^SRZVCtcWWlUZA+XonU$OJ%MW|-4b?yNa%rhI?%B?ZP(F6>?Tmy9 zqG*_+Y*TL}I&$Om9@WM%ejKOk-@uclzy;di^PM4@`F}eX@#~wTqqpiRp6BqU8@R8cOSM>m zSIb(ASD#LG<`k4?*XT=dXRx?BeKmW$#;H0zF@YNUM0UE8XTN<|6+e60)_GX%J9|8A z5hNke74-FJXGr;Cm{Ga8)y?2r!c@IWXn9ggIHCciNseLD7_IR|@ zeccj>8a_^{sqlsts025+1W|DbrS)A}TiCVy3Q$(m>T=Ri7GU*9eWHz}ecr;Ltf9#3 z(HCWFDw5&&#oSCePY(Brf1ziyrikd;A5{U4b^7L<=n*hJjlSc=j}I&H zDWM>_ELbY5iCee4MfD3vWU_p78y)5qTn4$42S-U!%kMWjREuo> zYdVy~;Is|<`6P_R6fsAeOsfN8iI3rXM9+HddNf}%ITX^pn0AzDJx7DwUL7WX>ZZmM z!Ou4p$PKCt+ zB{K>oMVbvkMeK#qVna#9z&p;KjUddqFK>M zs6#%RdXcvVV)`f3yyf(pw#v6#YXOEwc;j(JuM`*7`2M+0dgVnmc=Hy8L z!9S*HAex4Rg@TxgO3xI^evc-w=Pgn&^^~l7DJ+p@3el(kESzg3koTm?aff}cO2Iag z=asn5xPQQa$J?r?S zai*!6H-P)YYQXnVgN65fdb$C87tqu@YAm>Ct~NTd6V(e8QF%>y(#70P%z2)@PqiVD zVgpQU)>8RP>JFz?;OGh4prD|a8S>qdoEcMtb?ax{myaIg1nsUyB&lHg>B{QP=lk0) zGTLg}gT~KrM-Se9HWuf(+`zTDc3f1u2Jfw%*G)GD?p+MFmUZRdz|cZ&sol2T#!=FR zOD6_B$F#c8D4+LB1TVY}iM%hlViCN0Xzzb8F?5Ii)$!)+`SR>}hQ-DU;=%5kn|qM| zm!R#HiP!h#JG@ac7COs;Q#IJ;4(1lWgM+L@myLA_ws?az$$dv8zQsPIR^bni1Fa$6 z^PW_nRG&QFJ;x}cd{M+0`iQPy;OYG|eIdW%Il6lh52k%Q_f{6i`VxlyO3N}$A{V0; zM-y+pOi(#rNjsViF<>qJgr9QW4EphW%=emVs%h8UGx|I$I%T6Dxrbx_W>hY#J0H88 z{Y&Zy*?Vn0xo&U+u>O7qPMg4dyRoR&t#goPzL8ybN;k--Be}yt5Y?wh=VEG`3ds7M z+FG4n5S`KGh~E@O19#*8an2r3zH;rXpLS^r)*=%fdK%Y!c1Qabv>P0`2&Z$@jdM}B zb1Ua#lOy4M?^2M=Bji+o%_i^lLcN|mO;W=1$$+LwC$G#5L*wxWS#@G}tM~F9#Yz!O zUkTMogr01l|J(^t0;u<8(JQMyfjH3wWWiBB8+qg+wVMh)QHO$Mf@dXxhD@`UOi1 zeYOg(($xi(1Fonsk5U}nzRyuXUZyzWzqmB9`U;9s{-M2}%tG-Df(KcL_A;?7#JUOd zX%??Uu(yIAx?ymSB;|!xZwfKP>nO#AbnYaxe~S#j#CM*!<^~@WeZt?zeHrQBv_8@UA&>1Za%N^{ zRTTdEs*z5`k$8hQ>-a#GT%9No>H}NE!Kjvt0_xfJ9UWI)*IU2pm(-iu3ldR-zb*~; zdS*`#B`&{ro;B(2)m|R!g(PSH*QKd`iz%;OJm9~42N?}p`ag#CH^m9~vgO?=i!;2> zLDUzamo8I-?V%PYZ%OC#O`Y!O!|aVYv#UAWHO|*x220qWJ*-s&=z3v7nDPxw|oh3kYpr3FLcl^0v(uu5qd9`29$(m{I`evn4-M`_wv z>(9`#_TJdfwM_t>uJ|bcot_O|y~Hig>zn)04G!Z2GfJOKrr1 zb<}pA<+#YmK)O0=F8=|&WvRaxtyz5IFrBGnXyQ{_cF<5goaqL=p)FL1)S3w$EZv6u znJY^ttJst=8JM_FnmnD~w=%YUdsYHR8S?HaFMdobkTuy5KP0;v_i)%gBd1N`jhNO zi{!q&TQm&Td>PPim=Y8tQ;ri_oKtdIhxlT)37Ty>XnfSQ>ZQz)5$;LE?m)1i z4gwX1(LpH2>58+)DWS6Gw*G6>#J~TB`{uVrG?=4o^GXmDB;&YLN%`?W;WD^&vLrb< zjF(r35_2QPZ+B4x1f^Pq$*?H%5lUnX@%n<J@y7QH2SzwLj3%XfdrJH#SeK-Vu!eg*Q;;B#3w!OHr=h6Czv}4hLUjQo~*E;r^|O zgn}6%k_2BTlVUS+7N3_xoU$%XO%M1)1>ZKh6KE4LxYGb_#KMl;Kpiows+B#6m+ies z&$k~Fs|WR(sM^k;{jI6m#o}haeT?9knVALGoteOsYQ?j?qw8vAEidqjWS`YsBZga2 z^EMGYIiDs2*p(89C0V4IHlSJb{okjlW0kY-Dna|({@vSmYdh+|Y{VfwrttK6+{jRQ zV9&yYmz&Gf!NhA*H}8hOs&G;XbAZB~Yh*^}mhOvz7Q5}{uBNZ_gwyn4yE1=jIFov~ z&b8dvH%ki9lw2-<6MpBz0eou!YY?LX(&Bv5=B{BTCV@$7VdHFL%;pkZ6@~)KS*GAPwP=h z5;bFiBd~rkKO(>+kiz>;R8ZPR=taWa;24EjWcC`616(fNa7H z(f>OrP9Bm-fJFQ2b8~Uos#{gFE%5mg!jeql;M&D2pW+GEEaMzxd-(Y%1r|k;!J;*h zAjR)?G!UVlSZzVDV03dl#DfrJ%N4^kfg_WG2t-gq$OSWFz|qNhzR(cVo#@vK4dCdYxT!#5*eq3zFS5fy!Es39=2K_p;aZrWMHr%+$E4Cnd zajKNAE1vMe#}zTX@;%80nAq^S)}O{`biN%sBr==kPkDu`?mGfXe0##HNZ?`c_PNB> z?)iM*i3FOs*(RI#QV0Ksx-j_9*x+Uww#fo}#-?%^gDTG(WHEwiM?a!{f=Rt5K(h$( zWB5nt!_{6LTsi#_PxBoI#HUFG63CPI*~{*rfu={dBN0$U=A&X&UPGCj zdx=y3j#uW-cjL%aSllU^Z+OInvrY%-{y|iR=J1IkV^_} z?YDEw0Rtv@xNXO8zq%HCwD?c6kJBx`w0QA-I@eO5x_-HcoPmE>mf4O$S$Mn=tNeINuq!V3gB~|E5>kZ ziVOP2l7Zy-D9RA&AUQU0c$ShQz_op+^bGTot+i6*8CXfOCymRLn!nH!IokY8X-?zA-!;oZ>ZjB#79k< z#?Wa^H)kn)Pt`%`&TQbSUG-kMBh#=VPxvg(-AB+G@fUJ-$zmb`%!la4K7YI3#fpK^ zKLvV{u8Obh{f%FEG$ka!j(^J7w>bDj8fPp4vp5?XXct?L2N_3F4-DV2S!X)kfeutI zl#qSJ$9!O4)j-Iw*6Qm9J!E2ST}hZIvjT&{fC>1cV18G zOM|bqNLQrDzf3o43fk}1D+~%=$M?;@&a|j*v}_Wy!m}g8Xk_>(=x`h;a^5sLuwW#J zLcOz;!y^c(UKqM4Q$?gR<+9TItakn<`@c-hQOvx!P5yI7i;yF>&V!q=t82S0 z>>Q*`$xkHgVTNnSQT|YY@~5}tZa?37rri7&g(+YvO^kTJOIX>x@BC(lI>==-nHOa3lidF%P(cTaI};NN z_2U-7cNd~y8v5StA38yW&s*DDLOjm4-C%cg8?x<#+RR>!Oe?(Ok-+;uU{*Lg|97ps zyY`}A0=sW<^}Xq1Ni^P+ zVyNzu(jOHo({3<}qvz74AYc=3Y3R157I=2~Cq-naa* z5R0K{>5X^aui-H%sw@USCJzROhV{#RNdF58nxoH|TXf>XFr~z&n|IBz^YeW2R6<+> zM_O{pk$Iy_C^xbT6ahg{humbK3P*xa$(Jz`H|0A?@^gSLGLhdjgTF|C$tU8dg9pQJ zYpgGY&r3qu>ClNk@aS-!H?-9+3I+Re|?H9U$mx!ORA=(>I&QRO%Qy=Gg6UQ(4 zJ|r$mwJ#Y4*UAoOj3)n*F1g8kL%BOYGc$WmB79dhH1?XLPI#DfHFK={+L`mzr=#2T zioULN0fwp-25iI4X!-a!%5zr8@yYla3qC)l>MHy(a{Ceb$R~{JvoNb7> zRx{@9iXAuM;t`(-xL9_*JgvPPo4p$JH4i!2o%aGvz^wr!w|~z*>B<`apy;Zvs)uCL z(8_@xVPa`wezsb*IY^U-EM#?@PF=NGGz~7Dp6(>gTwVSgubu5Y!(SK;HuAh#;I1CK zx5`JGA8Bb2Hb-mu+1w45qbr^7J^j>GR&Dm)@?J>f8)(pJ}I0P2bdwbv5@cir>BeIrae;0C|q=q7m`ac|`6~Bd!9B^33YRSaUP| zQ~L7M>hMQubOq|~)1wLI7WZV=eV#w*IBal5A1QWrA%guI=#}qqaVJ*Aei@S=lFu?F znSqfAOEGsaz7ts08|~lJmzwz|_}jZ!5PjvXuJKH=Y6RHC{do z_?zp%I#EK=9FaQj=aSe)j}P+$WnHF?xd<+^*n_d$+7rwCb^CgE{Yu>Z$f8fX&h^0j zo4{_{B}W$vjRxsvLc7DH=fLa;tvd!GIoAucYJ_mANY%LHaLaEZkn37Zw8_kTs2HRpJ_RNamrVg@#>hPmtmm?N z$_(0AT`g%emareG{IU7-Eui&Dq=yv}_6Zh{)eXL9kjeHLG;GrN}=*{2TTQx7Z1uO61F(A9={eUA$SQ?1wLm)%nf1L*w zFP@#~g!&FAgM#_gd8~t&sL6}PM)F`p(->%^o5unbvAtsbgWjFm%&fgtKjlJs>HAXw zQaLY5Dp%X$*VmoLT}?c_xs!);U9qRW!3##62Mx9RgQGkbZ)ef_6PnQ0ixPF23XS@{ z#@eidH|^OUMFWGq$69Cfb+lw63E7A_(@Cc>`nmDorLB;irmMa2EuMmh7aKd@lk^Hh zU^R8F?R#6zBItEGLv2In09g>Dsk&{KI)*m62Z51>s?#vQo(QQMSDpkZ06)87jS zjz3*txIOCiNyqo${@uhz(UZ+r)UZEwVnQSCG!;Lp`uxUjK1`b*UJ%wRRGQ7@={Pu4 z^f!JOaJZqVaddIH7!@Lq1#q8CF4Eii*Mbr_3>CISYJiP{t(pZVuql?nd(>{u<=*l zB71pPMC7`9`F&JWa#ZrnyAGFg(8e6LsIhT;{DJ=AbOB2X%eE zx(?1$7uDkS-Uwer7nqVHa>|`%fl?rcMVm^hT2f@p!`(^u)Kxe#a#F{@sGFq%WuME5 zc`V_cE-1B=-7o(|Tg_n-dTc0HS`*1L7gBV;vPUoZ1O}tg4JM2;)T-;;SyD{q660)a z-YKXim+56p?RZtm_q3y#v*jRnkO9XKF+M_Ff5|Rqb2Fi7stO#9y$~H}*)z+mf0J$@ zQCpj3gg*>@B>9w?i2}~b1>#TD>r)sHR6)4HJtP7!DL%Hf*~P2|6+h@3*IOI8^O98O z)aYR_R+_(lC`^0`h+VRPISTZQ4xb&oLad)~tnFwI`Akh8X^TWfe(MYlTtmk|9P+QR zRq3MLu}%rET-I9G&v5KSv`%a&8O;QNgOo=!c!Foasc(~qX+vxD?%(X{C zo_tRgZb0#@Wz4-$0b$Cn*I3SC9?I`JNF2Kws99Q4GEp%ZV{6K5qj)YLK%u22BLAkk zffzt^Ym}v*q6Xw_~hIgGZ9*}l`>Qa{3582=}nN*#kE*%<6Ci(_^*WI zcyH`rT+r1quT_B0>DSG75f^IJ4SP@A2+7xpQi4M2eM~yznf?$k&*_Zuwch?>t^_2s zG?fd=tPYK0b){z}7N(|tr0Ybpw#}(c z9B$?^2-r#ZzwIQju#Eunn({62n#ny+-pJZc->a=^{_gLmr}r6d3MsPRGWarZU_bSh zk>_FMRO83~?2it)xEAMW<18`(0S4M#u^|DT)8(bM)2s8@^DNhnfFoRw3bw=V^wJ{e zYHX)3w-y_GwD_XF@;V*y+OyVogIqRy7ZH)P>{O_*7^bHf+{xgZ>p%?s=!{b(rDLO` zYr>0m*Cr$`Nao#>_;T!4+oo4~LM44zo~LWb()6m6)u%$j?cP83ud+)1YxcP>zNf^a zhw?Wz7a!*d+1akA)>Fvp-+4*nwC2`sae=SBSOXrQ-MHGixSbcGbn-H>;Wf%Mnk?*6p2GCL@NsY81~L5UyT@S|MO3ZPK-KzV8w?0eqs);Yo&P}h znJhPvf^2;1uy3M!$pc$Gg=+<~uu*_cgSB7@J!y4fplb`?DCx z?VYMv17;_Ro^*_Jumz5sIMqd@5r`vVL+OM{egCuNgo|#tmWC=lZ0Nuq>p{3qDrUqf zB5BFwSjMOlrB45hK4jMEk*=;QlAZZeBs(m8?-p63vn+kI$aN$H5z2Nt11|PeKA!tj z-88lH`uw!2_73;P-HNZN;RB64$?lhj!`U~kV?uTo`+6*tUis*P;ClA&_Xyo~)AyRD z8&_L#!gD%rvY6A1ji1E$jWdMD>MWJ>L_RfuBJSIN9+QgBVWseM6KG~OAWLPGDQ1hy z*1Gs?2aZyWri5tllsv`>I$q<|6l&KSqvA`{VgC2?CdQrjD_#|2@EV~^KSnv^{YWPf z6$sDLow}Rhxd=zey39}#xVl5V%xd{=7>i3|Y9>V98>f`)l!!4xC}}1{hVb%sAFJB) zUM#G>UU{o>Ho~(th%#{;IY7o~XHGR*L2S7sk1Z1ry7YwqsKz>HlSP7gyF!wjeV%i^F?`B9IYyyZ5}8A2E`Ng?o?-HQO7$7 z{q)&Uq45jXTXYcq^ijM2{gdj>Bgd=Jt4kj9{CsmIv`qh= zPYZ;_^`6U&Vr!ue^S7`Pev2~(X_@?_GDHmIU5A*|J#{aa^sI%tIC0DXl2=bzs#yC$ zrN>Q}R_t5h9?IeDULZoo3C7_45x^+0 zzK&0fgS)#QF79Ro{=bJfE##c>ax6%!Y5aq8{jI-tbg^*y&nDvX&qh{@yt}dw$v-8D z|Fmu8P1i;B@7UhYH@C>AM$wgtv~I4oK79krx6)FR#Z(z+PainPx!$?%AI<9H> zXR_!|$r!|$_SaO58%>?qo+li2_()FGW0$&$6EH97yCOl@_#{0ZW&asxE?|Z~17Hs4 zErJ#lXRq5rak~L%w6`}JeX=+l!KiXPHylxzuN=_PBr9=^(1YyLk%UC`OP7^#L^H@g zGmz?fPeHbED3tCu?hR@Alx(n*9qt(hKruH(B0v_+F0id+Y&zcwYs}M1jAu(*q`p){ zI*p|f*VnOtp=@i@TX=@=pclEGq>}nopuvtoQM+RIyt9Yiu2T<`D|TG`8tfAw+oc@o z^W%NfIN0biZMjVS*4WrG^8uky!sz?hG?1x$&@>}HQ0KV0Ic6qm1t0FaYkd(L*l9LMCB0D_ zYc{CTfeOkO$H1rx;aZT$;n(};t0M;i>}f2;q62(XP396|YUZp!50I3R%%#NN?EO_v zc_L(g8`Wqwt29GQp9#5oyYL2(VNNf#h8&+r+wSiU_#O%Ep^^&j=ld@#WfiKt$~S8; zb&M)@8S6T^c=dMnWOAx%o@wdl76N(4Swn5YL396Z;|zt3f7$RJP!hQ4@eCd6 zmDgXl5zVreRNL0}BrxaLCx5%2#>;-~b~v#YtS0FH!qywxSCuF2+WM|rvT&%a9C)nN z!B=mT6t}x-YK_SGJ!rl(0l^moioRPLJlyErZq(HdW5_mO=w3OmL~$iCCcf?9r{3dw za>zIveBeDbI-WHyToQHLzurY={36J-Ik{DL5FB)nurO}X@@iMoiD2I8>qh#YpY^nl zTIC#4{Jjg=>>p(|6a3PrY%bGzoAFUZMPJM@L?QC?sQ%Y;R-3m?n%ik!#J~P%9fy?|uQI+V4>ANfFhR`*-s^*_nA&cOhGormDc*7aqyR zum`rGOQDe?!f8l0vqxGwj=Hf&YJn4`{zRXSh7~2Y@EE?$m1m#7(`oAdy*0l5E zxYi^m%YJ3O!xJsbkzgLMkYHbbalD|Xa=C#@JDI7@+QJ_E8pv%$Z%>pAd|;Dx`Fpx# zaW=Smz8!K5pe$b3E1PVT{G{chlh1|-Afa6d7&Grc12Y|5CwKI;L{Ay`&_fx%tJ1d> z33v55alj?@)^wqw6S5Y0ET8no2s?Vc;Su0ee!Tgvq?(C1=!=#F__?ebm}p?&YU>pDP$ z$6zn}u@Mmwt*gcLE&aFN&$>)j-DryPUzIMZzP11=^>wu&DCX2uWUE8&D>szMh6A==ZfUoF@c`w!>_=qql_or$vzT4~c zSN_>_67T)CH6U&?KHO+1yc{;o?lAKRF5%}YC#;mifzm8GK z{(*>=m5;c?-cc5o{>M6P`EKX6hnt%hx&dLG!h8DL=lj9IZh#@nqZc%0+jU~XCHnfT z@mP6cP<=<``sv~#!f`q`%v1i3UOk`dWMhSFmXTw1|AbR{9Frg=0VGdesdG*859GeN zEj4YJc6Fy%fdQqesw%@b3@qJxTiNeB_y+6*^vTiGHN}z|wljR4?z86}MKjnSlKbs= z_Z&6}#`}~e*3UBhEL|q|CR2v-y0kZ6QjR)zW&5xspMyc-NndqiFb9ZNh z7YfhoLk^eQEKUF>{AitqcnyzofsTDzie}gAn+u=iIu3xm&fCd^ znhy-&HOPD3&w%9&h>Uz6H77O1G>nQGa>nStiKd6U#i}C3n-N<01I2(2Y96>irq4&2 z90$S|=fSO8VZG0g{sp8iPe`QIN}Wzp&jM&V0DC9EQCA0=LoUZ@ZJ9Mb#q;*4^DN(D zGLTrlK6nx#JQ_qU6EHiCUU<;iuAmsg0TqbJUj@MQ78f|4^UEORt6Qf-H?-4s&hOUF z$Uw}@3fVP%&HY!6F7dPHa~GX{0X_<%b=u`?!J(?^#{Q0AjsLW0gS;RDY`o-Q@pELWh7o^aKN{ic@(;>FA z!L_=A+w4Wu;}-H}TRn;RgjWMghU4RV6Sgw!-ny?gHnHcs17;(aGo*{{)myCcG~^aa za(D3)elo_RRXo@$w%MSg=^B^I{WF!;W}Vr9qp_=(y2Br(1P$_95196^+AGf189Q+E$4V*RV@PDrQjDo|heYz0dWlO~L)2CA zWpu0xj*8<+LUvQm#SR0-WGF(@RBKJyZ^ZEABhM66f53>$E3!&FKM96tF?UwESj4^M z2^l-IlKkoOo-&fG>ldeM=gy{Ui0A93fq~J@DS(#2R*2qbk-A8@{+c08JJ?3qymmYu zIW*u@Jn`+L1;7>>PGXNUi0Qm)x@v8BA#F5XHTP~6!T4XGW9>LGY*}{eZ?6=$bsgTz ztm(%6+@kLYvF@UZ;kOYdrJ^4&`b7dBwq#l`b!$ulK5ej7R-AHyR$fXgIaCt+lM6v9 zkeN&Yn3ukH{ccXh?CyxL$gVE|(yWt{y*)rLZsu$jlLGYLbWSg3FU%lc92=VwU0xX8 zqPhyX>b&$NvauZjDHg!wOim8)etm+`GUYwNsTI$CqRme?LH2-8|wS7gU2zBIS#xSSS!dEV~7;-iK8N;nClHqU2W3> zp|@dAgZ|w{l%`wL2$hvSNP@`>PJ*+7Ea~OhQg6UB4LpXe;MOZ>%4jIgGJvSW1aSQg zb_SmM&mNhL_oP2bOtSD_%E;R4ta~Z;sbMBCi_c916Snw`9mYBkZU6RoS&>xm7u)7A znG}4OGj~eBW@$Bhk9bAoKKTHynD}j`*bLtK0XVczkEuylE7Tz;m-PU-W~8#l4tsNk z{`*h&iezbVPbe!NBlHkmA3r}eH>?Q})v}}_2C*J&)gTx3+f+#x+q30ZQSZN55H)an3d z0IGqI^@9)~&F;eq={)zUg_}y}i?B)+Qt$U6cXt;MXhIHQqK#F!n^k4#*oMVoC;YnP z?cs8$)&maqC5pS%>PR)&mo|~l4PP)l%hRS(Dq{_*Q{KnFl;zqW$tHZYU&peUcBzh; zFhCj9>L-@{Ta0e4JZzr%efQ4hu(bxLwpP3bZYq&QO--G?jlbCtqIQo#uQa`C6UhcB z4t~V=cuvX#zlqFQ}4#8K7GL*(EEF|u?>q}mOg5-lvTYxC0lvOFpp7X`5oJIZDgu(T;SymnV9j7}4QObWX`CJ- z_*KWJE#xW;Q4W>xB!3H>ZFJ6LixCs#fj>8(;Opwj{sv~hb}#$+U+R%u1u3uVE z+KfT1bJ|=sw|qT%^vyHZDJ^Z9FMsYbBpos)F)jzDS*=9ZB*Bn<+}*|fdv)0aRNI}0 zutigfFB4u8L!N!=+rb}_Xkl_$F{(5iW%ErVh!y@@xd0Z^*x?*^{lNcIm7EM_lra8o!N+)sd@)*%qELr z9ocszBePA{Mm&0cgOWWg2>kVhy1rIo+mtHCHgG_$6w%hj$H)BrxOkj9;y@A60>ihh zm?02lb?Fo~PWL$s4ehG2ttJJ97RNDm`lacWI$xdFKN%tq#{XGd4ulL+UVXTlzmjV6 zKHrcC-tGqGIt40c7b?e$t{pp*ffgaPT!uVX8^E3YG`aVQs6Wv*c>Q>8WB+79xX?mL zd?t`oZ8YPDo@%KdK(R|$1T1CLwx7+E45@6&jOYCqX*JzsfPw}jhTmY~J!UOQf-t)e z`<9DDyBlwF&-`VaIY>5ma3`r!tn78PI6^eeV2M2iqe^&(d%4aJnR;lQCk>&LmUB(u zc{%0u&ZkN;AyU*klR3pVa0Dr$4ovy5tG}{TJ#0=#Mn+6;b)FA&=II_%=ob)0{@B+m zJPb5=BR`uPywgVwDYdvNtL-?*sQs&ubG0wgIZLmbqD?s2sa8}-qo)aPfPjA4uMl3W z^R9eWG3VOI8U-_3X_XO#>e-*gG4BzWiVWxgrRhsjx+NvZT8F^Q#G*75zghkWL9m_j zYOF3JXfF9lDV4R|Hu-z4`V{DsmZZ7sK z-IWv5P&a>375|LPGUsrH>bpD^tkZdUS~arzRcv579x@Q`ZZ4xc!r+~yH-kheQJ(XT=jOrHJsc%OYkLL{@GV->h|JvO}676(? zy|F%2U`ugU`5v0D%qG2aSjH6ow7eS-PzpKIBg{--t`@Q^eHjB0iaUl6f+*Yx-UWL) z!uV%Mv}<%tOMAPixfvt2j7E0^Pg9TW>+9RGhSdt$72M5t59PgnEmU70OY`(@S=79N zcK$0zcHrWVmm?N`th562GTDelM)vx;A8=dbcornLdy5~hL>wgEh|Rku6|2Jdo`sL$ zJ8#*2{HGTK9X!F8kVvIcElOGujkwQhE&N?8rZfNp^pOrOkc4G4&UC02u3yFBaKIA` z=E{B;k%zpS@fyQu@Rtjge*20M=Ythpmt<{9+Q}t#c&@+xq7c~F-Z43)0@f`bDl9a6 z7?_M&YUYqQWQ*_H2=KpD0aE^UXD!X-z9r;o z7kLZC7pp>Y++e5E?9@+ba*SnP^2`(HBwiXma-CZ{ogk8~wDmJW0Ndgz?yZVlc<1G= z{>nH{`xUXxWvsd+qEF5ft;l0%G;}BAa#-)W5dhU6j5zba`kiA|DxMfa)l#No)iuUZcE4S5-&d=9g!?=?M zXueiS%E^9OuTJ-H4FPge1EsyxXtevB8k=~_)@llMgnYMVish7!izjM~YNncl<>Xs; z06~MU{pe_#1bz?OcRBx-bhR|veNsIoyVbcfQ~!Zcukc}XOr9s~&aIY^VE==aKESCC zG#TCvu^AfMcfAe%d9GgjXx$Wgi+NKCPe#jb0NBp>=D+a^0;Km$^&#_SvQSTGloVDs z62e4Qk`1;2EYJH3nnSYyt7eJ0<03!J;+PPK8w=Te+evJ1@%OMXv8qXaB-`w)pNV(6 zJf{xX|ITx@GB&L^s$`QZqHk;b#nibL2qOtTl#Z_G&#_K-%vg#mg6A03X+?7V40NP! z+tqe}6-qS!@_*5qEI?t?%g(8%VS;o#XJDJUpRgS)O>};gdwhN_}!dL+*oaCz)I);>cUZ z&KPCv9%10Erfi{#iXuArHpHKpwb>~4ynxsvEPHs!h*^~#$k*5wt=vc z5KYBsLzy53#j1)ApVKhBT+HjCfeKoN!@{x+B70vVovtje0QVq(kRDu~-|&AW%Zi(L zAN5Yh{_N~b)`g3-Nz(4C=8W#}%w(3Y_QZo(Ozk*YKyasV?;7t1cWzbaFu`eH3dA4w z3w+79r8Ht#n{6>A2hn^Rl)VUBY8EI=H4ciT*D;C<^6tf~w3Dr|kWEtqbf+$qn}=t%&6hOyx>F>s+Zx7^5D5sdJPG+`dD234 zl{#&DV#stP9UVjxLi330$%mf!iGNPf!w&<01#N$)&UN0K!<9^U?fmapn54 z{C;)ndO3Ktdpu0ED+pQG9IqIK&*Nr*7W1dGij>kmxSnLcvP2qUN-A;HN-a@M3+_ z*7V-t(T5TLn3u8|i!BE=tDNt(Xd*W4sQ9mk9A0!bo8}J^N2->*U)Y}ozSSMUXa-Uu zC@JJM6T<{^#g1~<%d4gbbEz{5luj2^u1J?WR~J3NMD!y6=mi^bcmg{imsVUEhiA+( zGD>s51$~nPF~Wmwlx%eFc9*e2AjG!Z{d9XoN=#)Xhps68^Va10XdF!cNtLy!OKVYm z#7`5poEj-$RKf^RAcAcOEuTb%(%b`1C>RH?? z?~$lp9_CK6DF^za<2QksiJ$W0K2y`*(1V!!qW9yM)^@GU6J5D}c#?~~bEt{74@CR_ zdmF4Ut0>p*zPGIXe;i$RIGgYLjZtEh1SQ%cVn$Vk*4|R9MjN#D-fHhXipHp2qc%lp z(GNxKy?3qJ)Rv;P(wM*Z`|~H)<$AB=e%|N4&pG!wOFl!>YO2dK3s{H+y5h;K*Q{5b z>~|kpXVw*U3enlmZ<;Makz^66;ljOK@Pfy{N*5^FLw?|%W%ePSsb{ayC?$IR$r$6qrKK`uq^yp~%mFW*+n{_^Ibyqc{Q~Em(x72q*)CyR2dyw5l zi6ePMRL4KqdFtw_Stoeji3*A#Rheq4OmJ5H}O=*?{t7g$8-eoG0eaMUB1Tqk)Eff4|Iu>>;VKkBPlBynlB7h0+0P zv->P8*^7;UdH4D6zbQZh_lq)@mBtR3une{0cD5xos9^bZ-Kqa$zF34K?j19AV07Wn zC-mepUU~5YTQSK!|s)-912O+fPd{905C-Ig@M1MNiOGTS%A)Qz{{U{N$m}b&o0G1*>*)lUi+}5Y0n+8(iKo~9TEmc2 z;9MMDUmsqLDzjY{m%ZY-ND(y+D8tYd-TUCQGNm}%msnl?Q&Q@~?}r&b)U9WV>(~Yh z2V*U2E49X|EY&*XSA3}Lr1-uuEbH4k6}C4()IheqksT6j7AtohTkt6E7^s3;oNBSh z=*NVz!;4C`x`loBTDQ>$Ifr@oZLN#Hd3MZdNPkyB8_DSpSfmn>wSWJacR0d>Jck8l z>fV1^d1Qz5?e2HVYn-o4t5}_uz2dpq-%oElm%V8V-uAg3!2=@Z+3WfGkh0xbzo`3m z5@j@J+u8D1R#2kb_M2m9hLsU_dm>(5TwKkoN!7c6vSlFwB+7fj9I>j9U20JnvKqw@BvSMS6`{jkwEpF zUE@D*?llJQkWZezfvAC@ieGSzmG{cf`gcaX)dbn%_M3!;m{JCo?c9N2_>I+kzUmzd zPjlGo*~i%5XDtC26tx%Kk;j@%;uoi%e>*B>+Yx@ugU>4(8kndWeqXX)Q8}Jxhm><)9P4NDG*g4D)3E%iI^`(_vw4wut6-?h%#rlkpDx;J9PH3n>d|O z6y*IdDW%$gnB}!o|)j&0gDQOLLxu z@2QvHnu(KeiLZmP%TE!{)!wFlx!o^DL|o`40Oe9sT#>ZZRx@59E>h_Tu+3rqJ^t+- zv%j3{=v~WZpRVyNKnWw%oss;5uNR`t5dKWSoP3JbzQ(EED~rxfSILY$oVLu-39G_; zK6(zT`2y_nym?ePHhMm5(sVj|1L&5|t8PY2&x=g~XThq)29JwBe?S1FCN*TC)(gwQ z?Y>5QbRXqXK|U>hEToS7aZm@*|C37xo}~p$IlHuE3E%DO*hzD2-(#xp+E*}J#)VQb zg!53S39ZaJyQcj0O?yXfotmibYMhEG15A0EMHLnLt6z&O`-wmRc~X)E3Tr3^cO<;k}EJw|62tv zgvXMtfx*VJTg8Sxri}zlyang2KGKfwkKyvV8?ilw_8)LV&!PY?!-!BYlAQ$2Jy>l; zeZL1%;njNJ-(Z3oXe_|9$JNA_Z1sNq4Wbc29< zbQ2aXVFDT`9t!y&pWo<2g#~0&s4R?=H0kJu|zUCb>VD`?N|u<2p%i&4lNWD%Uyo(QODdOB(4hxgoqBl@FB9@A9-xp?UZE-3FU zn$rRIDwm;fvY!ISv@2a)|cU53J6#2{_8b)b)XvL#Xcv3eMEkl6K(LVjxFvIcPNUl7DTnx;| zqKXuTA*Eyogs0>KT7Z5#+e4wB={y_oq+-AIFx0irMlFsVL?uJr^?XYgtLd)G@N|_u zVzosJ6sMSm+(107p7CD#>eN(FkK0cZ&fG3O-3YRZQ!R@~{p{u8>iYcM)baKhYoHsF z6dn9qU?NOS zX)rZ)65po&=bX2xK$%Rp9^~?!A(<))+z%G)wQ9jtRSmuX+WwRH!HOw6iO7t!Ask`Z zA|yo1ky#N09~C3#BpS`MYnKGGGRMf}Ked6>jb2xU{9%*5nPZYAtdSF28=J~pHfvjh zNB=>-)J7z36FiM>*?Q)dl2WjL?3UxqhlEq1w39hfFm#)8tt@fUY?bvmAVZA37*fbg zc5^wU_aHS_v-H$v8t~4mJw@)bW&eK1L-Eh%QzZYl!S@(sX`l|`mv>W(nCy~?vD3ML z|KX*prN5qLU&O9+OmZ|!yi2_ted6GWr$m{Oey*eCuy-x>vX9r8%Ke9D=>U!6CY=}m zxtxyA78E%XJNNtVZjoCQgZ=cER7`;N*=bdC@V3?UE>GSqOI+j2>gN(30+m@x2Dl`u zGMM;=odiKIR z=ITCA8^mDpu=hk=JiM7exzYjEOW*unBA?K(t1D-wsVZAh7Z;jI6WMdcNYSGF4xg4l z2o4Qf*$F&F)%=#8*hI`HLo#(&B=f|(Ig=Ofwqi-R|Cve1ajK&lT1`>;sc^kE`JOOf z`uihl62c5>#(&;CpDXIKWnvoJt~o0{AFVK~afrhryCFZUgzjnCqKf4>-`^!`au(hA zaca}#tezHKZN|Xi-b?Dz#9f&^TC@9lv7Uv3C|cnodO&zvQ4L7}c;Hljf#};;oQ4^j z0DeYidk*3!tG`Uj(x#J_m$ua<+_GtLe4IK%^|f-;9u&;p2ulzUA*DxWw&r==M^s> zL=@Y_l`XU$l8-iHZYiHxBZ;A;o<7-y@i5J99o(sq@@Ax zlr!X+jou?m%2!v{1#DlosvSQ-jB~eRTY}8~0UX120xRA6(--hRxS^p<@6X?eyS)Y3 z#RL+M!%@sQ&W*EgLmElqfZ^ID*e?B$o(7v2j2t3n2Px-5|hPG(R<&NVNBPejzWY9p5rFXn+fRHS1(t-z%vW z=Z37w1_cOrCxYNmgY`Jn`rnPUuF~u-z=FH&5`VqyvfS)<{3h@6-xWT@*U!&HbYa)G zx~=Ukw$%3E{AiErAtO+NS)%VTNtoP+O4eoHzjhcNVpRmMH-AgYS;S3f?(rN||5*-j zX`w>(=Fq~c$|q}LjjccN2@9lJbVv3J>%J`7ky13;1$w%A>$j zK!=R_{pe8AP9wX*E6wqMMS-ksro63bV@F|I>U4!?NtjTE_jK!jeH)CB>rqxM^#eQ| zoR$g{nHGZVzjf@Q5eUlnBqg6W8IyqJ)^~$*zR8%QnbWNKlPh1T-1xqL^|D{Xw}adT z(iK2%YEoPRVwMQ`Y>mDYw-*~i{*yB`Kr3s`|2fbgey{ON1VrB-{Vd09XE+q>w*u@v zyeP4v7KqGHjl`U7yvmvhK$9)g0v>AF*~7GW2Bslg?3=DK`ylRruXT)#jDyeDv@*Nz zi6&5SJ+XY6cJJOxoY$ZKKE#9UrI7m1CbB*c33s>(Wo{%Bb*a0D{kRZ&yuhL+J==i! z;rY-knYd)VS|<~b6I83e<0;zrmdr}X_FyNBH*J?D;O1NZ#$0aIw;ofiT%B2W|S(NDw{mcZ>t9k>!<*yLB%KP$rs@y}aNJ|BmcKHZ<*K<%%O5Lut18oGnSiw0^o85+`d$ltP}vdR zR$Nl1S0Rm7c(7*l^TWQch_rYE;pF#amzGRC1r2RNj@u}C2iGe;QXXAyFJ~jYsu{I` z^77O{o0?2W3>7nlwnZFOFPc-LZQjJh*c_3> zn>PAf9E`O12Wc`G{|QUhQB#Ws&AxiT{xLPVARjIHf&(>N{p(ivBX_h)G#!^f1}$q6 zdppfV7Uqvk1SB(&&ab3lM&iZS8F#Bp0RX>?BSIk%u15pHz1}@xbvRt({zYrOKm?$& zE{p!e=5Ki)POm_Ky>mnLPHOG>EH_*%v|R!G?Wj+sz*xxk%|+Yg29GS@R0?Yh7OJ#K zc`^ICcE-nfd54=`;oqbzfg{r%ovqGY@4U>c(VH@`v9Wc#=eb>rN1C2v1s+wx@SdTe zmL_EX)E-L%s#dpWkLHa^#Qc!5jbrCvhjmTiozz9fj^FeImoVIdMRkb3HR6nbsBST9 zOMC=}8sK1-t|o3_;g0NK7}p?bCD#%z_lV~Hp9h2Y&6tw@qKZ>9o;RUhs72T0lx9Uj zyqWK!8IplfVtd|T;jzY&$Y=wsXq9hBs5q4_#$$QL5LkM|U8IErTk2mZi}iIkNAE>h zxQg_0>h{)t7~bk_aNe2y?1&xkY_Y%n%r#Iz;8!0XSL3wcb2UDt z*kWI|Fi)ci*0pJfH5Wa*6$M;AnL63L{ewk!|k=@XLFr@ETlMG#|G6L5jmR=9Hbmwu?9f}9yRw}-gsiy4zrn03J}vz(Hw39=_iyT6q%M&tl=W^z5f$1RbufW7w46KO2bq>>iv+N2T$*G&fk{P?X5<3Vsmy=}^3%?n;BRZQ0f?0@?X+XAiu=}?HTPZY4pUUhwjZwtCP zFv_UgKPRj!=X~XNd@nLR!k-A8V4pcufhzB7T?y_TNR@_2<0c^WD?a)5%h;(o$QH zZ$q=OKswrZ(M&q;`rz=o@|(dBv3d(&g-H!(%<*h6`WtffiV7p}?NbG3KM_c@MrpbH@k8W{}W?tG!BaI|LF1LF<6iYxgqN z5AKc|7^W3}o8RU{_^9;RLn+>h^9auxKqrhc{q%nn{FjdL&uhW+Z)Fkysx?Pbq?Ca& zr>e@dGQGa&uRNrzIQ2AezHYzHh2|rpwLUR6vukyCS0{1CpfX)FCx?0IG*AWzyADls zp!kJzdQ{Aw$k*Ir6byWTRe7e&fL$k1LDaJtsK1Y(jra6R>o#M!C(_;F^n&(qSz4N$ zc&a?KZ2xMliA@t|!hjiiGUR-Fa<@BMgc8;3>lg5(X4|LKM^?(Ts*2y&U~vEFZ1Z?q zTk`6>&s6dG;qmDyMs3&Qru2Vd1^AiysRBylU??HbnE)M z?E-hRA415x?l}x$((bDZ@e8tm~OSqS+@d$Y!Ny(XK>NT|A=K76(bw7emHEr@TY zCr0xP52=!uoa>zyWSRqR4wlH_frQJaOAh+Wl}sRq3RLvwH8Ij-bYZ_vDrbb79L)MT zr{TH2)hKI3>9L=99_1aMzIq}EW^>0uo85$KfrTAcJ?=|jYs3$ z8;m-C69^4o7X@Y?wY|PM0=z+ILyj+w2`9Lf%ae7NkW;`e@8&Pt%}U6X&&~b?TWfvj zZ2i#b{#l>ww2dXkD62K>SKwz@K1$7>~cBeN(x92H> zPd^_W5Z*Y%RhEC<4;mdPE|$z@uqau+*gvXc6x03p$2b7r%s{5HGKyNVw|{WU$rAC$ zT_U<4;1e@-pF3(8)T;w1mKkhqY`h?f0vsYcOKt|#y%EMz-0KbrF_p|b{Egll*@Ju5WL(x?n5a#z5@~E zPdD<%zVmBoH8xop-9Em+AL`!e`p)R#8yrj)T3;`!d%F{L;@?y(4fhz}DwEU6Ac=IH zb0)a~KA8HU9}caXv-K0TiTo9)_txTsDU=VCo${ChBqxNYF>hc<1fkI%UR#p=db~f0 zkV6Zl&Gw2&2-UG|v%S(c%zd_n*puZO9#i@6b zQ~0K*gn2Pa2|g^ovb;=eUiR?U*H&j;-sTnO$iLsd$mxwf5HuF32afa0G`5g`cZAzo zO@y2_h)HyV0s?R?kG8G-Odk8MoLSqq5l$0q{=Y_s($i@V+uDqrO0bYND+`>8go;|hoEq7jdl*oAV>Z!-Kdv6v`YyK#tgX$9C{6_$R;+LE&D#Io z$)`wp7|3Dh!|lO}LmXklc}X)vxVbheY8x_IVq@(Fyi7|zfh`Wy4(`b7l(+O=wQ&fn1K=qyG`l!Lo?(QLHH$~ z!`v|&?|>%b`h8iz!vxPJBPH8Lbqu_7WOGJ=|6tkz`~>;UDT&tLye}>ZmWJsofMEY} z>s6Zt_U0tvW<`cP{ru>>aZFXOzCt!9F9hGz<|k9(%y*wO*zdxv+P6$&m zL^uH`rq}*yR4%3_%O)mTrIUofI`N+VlG>T5(aq-Te>l@yB#%z_y@OhujJFB9`X2#~ zVF`Z)TxI{euDpXDL_Xcv-vmzbseel_;b_ypWybpIv?};wDWQ!re_`3w^bwnE5b%eg z3;fEJ=*^bt%{1WWbaVu~jxJ5NzIq!}&EAISP6u*F)1m4XxVF6g2zITqIZVBNegPxl zP+~`8&(2o-{LCQ`LNn9oWGGQt?oe?j5-6v-iUCVpoW&hm&+G1OeByA@8e5TM*$ z{aF6PfkYW?*UfRrH4B0c4rK`lWkH0$fFy-YCh{R7l1NRfT+ndd;p}_l$2ZmOayN|_ zN}6aMDAyN10|Unqule6Lbpq3;ddLr!VmU!^Yi3y9kw6vn`tpQR;UahlE4WP>TE}1U#0O@%=-h+_SkrIX2g!=v z+7DNx^ORNs4jVdYBbOAGu$=d|vu)TB6;D9FJ%aI9Z}BTFxR#sC<1vYrRE377PU$Ix zyF?-M+Eb=203Y!?)U9dB#MHDa(AcnIdWqt{nHW}R7{CTB2SDm-4~n+GZ|&~d>!)Ee zCWHT7zp7u@A6l@EdtoS7m%!FHURqjOoHn%S-n0bDuST1Z!d;gyjTns`N4Aq=-4GVy6}U$3>+h#6hr;-t zQSoA3s;kR$3rnD-$W7A0Vxhp;Hg?ArMP6DRTTIlql zo+VY^v%iEPt$Cxk zYR+e(5W?x{lkDL05mO4Fd8GtFfp54MHf*G(8VKCq%uwJ|IoGo&e0*s$I+8$W_Rss_ zAZBx^dT~d0NqMF2UFPxV?2qKIys`7mO|E*w_=56v-diTJ4FTr%IARb545511Qb~2| zE-6%F+BN-$XE+CCJ_&-f5B2()@*S~U6rAqWCuVi!JTx^a*$&i-garJo;mmdVPSAU0csZ~3$)=hA0*?e|453m}eHg4G^F`&?7Y_G84_*D+ zoUcwiM|afGXg^ADsMMAA?#GNZrYoBPdDbAj%WAHLURc%JgI@9}DcKs`mKk{jW zn!Sf+j`wkq{HXZx?ot!O6XQx?7^6?J)}PUCF%sy$6Z*Aj&4r@eHv z7J$~bj;R-8ck=g8+u0X1MBU0WKDWJ|2t)5VOx_P`l7AHor}`c6$Scwn5xy#CX5Sr# z-NV9ZpfvKs!|?)``c}n6GZ0#gm)IuP6U|AfZmDfyBL~LH_~&sjsUV0+ffk|QEeDpt z=ZP@wEp3dM4TAj(79HW?oh95EkpvDJw$=v*8;tK+?&%{c)-081EN@Fs1{Fe~GC-S$ zPW#m<*p71u;gBQ}4%#?a3vKUwBCUU%qsf^5_KhV>jP+6tZIxP^)7dWF+iJX0$;?R9 zzXj55eBi@Uked8Ee761p!n(C=NFf}prv}`?&muP8n}LMW74!|?V}!WSZ@N5Zc>Gco z2zgjuQE-G~b*6A&N^0Vr7*qgTfTM;QhXCWM_S1+=Agu)RkvOI4aAC1BfSWbPJPM6! zJeAN5S^&gH)%;XH3cdvdT)0a-;_oo3GQ`6SnVy;4O*g&%9To`;uxd^?HO#oQ&%)+K z+EWWsbbDjvL43pT)z4n~@)YKj-tSI8MLe5g1^r+`b^WzmbA*FZGEwQ6pDfPxL)l8C zr2L%4-(K!<#972feX(T3VrVc$INY@ z;};u0G>00W<7$9ZYUUIym}+r9afBM)Igx`-hTmyuhekTstB3Pe&E5lvC6~;r#xxW$ zR6fLY7_t!xG9nx9^Z9q@FBwdsTE!cfOCG1Hqu>|Hwn&>|K?ss1+JmCb|weQCL3n5qXt4|hM7|EKmb9h}`0Pg3K`Wi;rrR*-xoUh`SjfK!>S4 zsU2ir+9eQ9tO{8_-e#I+uVpVRSMH8sFfU+*Va1j@Nz@cUK5QjWd63Z%#e<`XJI0f- z%lrq1{l^aU)vkDDvO(HNEI*a+r-IK3yEcj}NrO9C<@ON)Dvny)9>(*nhsCLJafB|m z=Ps>ubG(Zj-!lpS+ql~L-5#(1%Z+wd?@!jDEh*`Xq*@WP#@5!BR+IKX@w}P&kJGhv zDvn%WGAmA+@6E03zuXNn34jjZj{y$oUB-sVP`%FqShbMDKa}LwMnLW1#i{?TP~b*! zCM-TfDrB%8dgOWdy@fd}MF<4}6r@%uO=TN&f~Nk&sLiAcLxgHJP;G2!GTX!P`+rHW`Tocyb>jlnmu$MXec5{qW-<+opuvi9<=Z>T z+3d;K_2ngxV5^qQAarYYNz$Di(UH3)^$&z&zmCFfltk(b_{2_vJ~^btc-#enq4e~K z^gXe}XU2jFpL<^1Z)keD^Z4+JH{B?SHeMcSJ)hwbUjY5jxDva=T5eD*B`sY$1M2MS zrC+DXhEjmkX-_~{XAsB^El<`Ny6GAIr;-tz5r;a~`I3Or)h%VRK+?g$c6LUD@9yBx zM1#FXptU!mdPPQN^;J$7>$;&tMAI9oRupJGu_O&4!je#6*@?MetEZc_@4NmR>Qu<# zMT>!01n)0)bk?IzPYXqoCK;KwvgzXbAgj^}j6vXCIyF1Y-u~Un6nP>DcrP0N;7+YCZ_`Zg+C3#S!$eiHtrPtb8&d zT>lPbVq#iqpR9*KfT5@^KeAMyuiYMeGO;FJs-{W@Y=6BLGOq*=X&3xg7hC`LjoZo4=Yerp2 z{adrMVID=eYPRJ0yOV}K7ZuKOMl-mow`JO|;NvQ6YFzF?nSMohhEhm@+KEub^kC>J z%|SlR!SV$usGb>Yapon!AeY-D1wwN|i0z4~bFyd<7UfYi?KEalJM3F2p>RYv3X6qC zlZL|iD>Cpw^{C9UG`g?~R}ucuzEl}oH3rwqaO{rCZi3^pnhDO4VeuL=w|?D^*>eo8o3}i6_UM@T%AVlcKdB&79uc&NCh?=7NcTq#pgr;%9=!t zjvX#Nsisl;M*_ug(cO)2*zwe7^f?S7|2s3tGAe11#hD6bY6ooK?-vLbk$fOSs3uvz z=j*$Ws9m4JJ{P636>hgocPXj!S}#~-ByXRWgF%<)&I z;{b;LEiD@`riIAl0Eo-x{=i|pE$kMCMq@q@T+L~2@mK)go0 zLd?ULFKTD9?OIw}ORij53okxv`W0>cMt{p?L`wDM!fl*2X#~*_RS(QT6XI!vhBldk zeB^Vify&6D;5#qGYxR8zXnFCwx0y{O=a#>I9pD`)Y{=l~$J57zIsUp4*8RJ}pUasK zE@VnKO;%rn=?DXP`fAAH@A5)gP*m{&!6@EA2b?jY0qnDZI^}dyV$zp}llF-cGgOEv zh}5>ch9&eoN5P`E-+@k>w~3|GVcb0I&GQ4!8+DRU(teC}P;+Fz znOkVZ7+Y?FO#B2#b%R-l)#pup|A+!?Xuxy=cJ(jVR(|6E{}W{YAWOXpPOd=Rq`_O7oOr#Y$1pS;}GxGBiJ2 zMQLMe>n_CW#kWr~wM@JCrTU86Q|qZ0x3h88KrLhovA}&->okxL5kJ@3yXBuDLmT?3 z7BG2(4fs~4d))@uZFSht5)n#>9~h!x;yjt5%*SOf_0tXbw)I&ot$H<7L~ZeYhSfEw z+bl|<9;2PZShP-taw{1$?x)&-bLv5|JCwP6G7g(&{U4Aiq5US~&dbVac{Hhl@@%#u zF@i$~rk;gH&=ENP#xKBovQxl96sqqrj%gYtMAQ)I79=bb!pI60v7IdlqG1@c);I`W za-KV$!NA6+1NTl?pt0CI|NAGCPTV!1_urre;8g?cv`v&u1pQZcj z|3`(Qf^X@p=zmQEAn|gOsw`%BXZoYOXPd=!n2c8Y_|~oeIE+IgX^5IrF`rLNOjbs>Q#J=Z0_cjQ7sh(QIEh0)%mVNVz?c;$b zSWps?6ahci%<0*P?t#1vE;8!zWlo zLdJV$yhh&hmG9-Q+befly+ITJ!LXXgS4lyxGS}4mqA)>$DCYVg8YVF+GeBi z7>Wh5b_#l&=_H9{U){E!EV$_s7Iov)tRFphS0O73|Tkx4Gr z*4ny!ChhX7oOafWYmMByV2z?KR0%fhH|0j#fbV!HENLWL?I|IIs-HoZ@4+lTAkq9o zLe{Nvngq%G4>*apK#;;(vP$&0%162Ph+CPNf|^bg$FCV-f)Af!&Gi|l z*BrVNS^QZKmjiNpl}pn)zRkpdp@P8rSzJRCQU2_V8dCqz>eB$By(r_U#2yuz6aAW80NHl>^P;4@-0}lLNokDSD62qQcUNXvKP{4& z)h=Gp*6s|<@h3ny_QXr6BcouN)$6?IUZZpUiC1qv2?qybSw(Gj6x20YMQyVn%W{K4 zr*_65sqU~Tpd?eMH)9=p2xY%T5#N;3UCYO1`jWN=wf);KL=71k`L(vrL?B&!+ueYk z9w58f+L~KrR+$)?Eq`BBirB0ayC!`gmI1lG873m|)6{zpJF4vLVSD`Yj(-{nr1uF+ z{G&z>Ki$LZA%+zLGE!X4<)b=(Y*%{NRA_X@F_^zYDsp0eFTkS=7>^qSY>&ko;~S`E z>lna4{(FTae~Z@)9okNQz%=Wn0eFu3Yq+bx#)Ga7uaI`Z$1j{eZ|O+i;OiICsHJ?; z4KOR&dEaLEfMc1}aW@RcrMO}Fr!e?At*MELb5IEB$|Xhd^oBi@?G7EsG+%h?vH|{l z0>%6Aw|7pV~}S`LA54Nb;oh>1wv|bTqu46K+8& z;1twk(hDP?YNTB%xV%nOhG|!X-oAVVQnR?sF{Et4|NhyTfM>^<(y_v5`UrypkYSEr zffB}5ukO{PR!=dmnnUIE7_}0A#mh!m!cT%B<-OVZOv?EHg%BO1B4!xx77igwddRy- zhmmeJl)4WmrkH?2?<0z8%<0Zw6U*t@QFD587aBOK*>*sAd5L*LVby0(vX~8*{>uEl zl!yuHjt|h*vOIYsarcAO<1Z@cVhSjGXw#70DlIS0-lFlcLXdhrcdcN_L;tz4PFk-YDe!NtzhJAS{fp$W3Gc1Lfpqve(-w%fTx zQ7m@Lj^<6$T04<3dU%?@{dUsg;@17WpkXN^ptMHtN`M=B$k#m8U1J7rj#>P{8 zN+5TUcgtxId=>Xok-GfFX+pNNqTONftPaA};X~@`)Krg{iHJh2rz>RjrV|u%f8y)A zzii0X&3LL`MkVbZgroTnyd`poR`&t7*=yv`~flz zOR0-!Tyow$J_|Li{=gvs-ctQ5IKF$gWUsUiEk?FM=_ARQ=qvH5T7@LrDs!KuWkm!O z>PihGLU;G0b<#z)D$+JDr_OF`X9i2;_#dJxW~`vlP!d54Jw1g+g6eUw&GFycKfpeL zQl)-m6+Q@rU` zV!e7!TKJX2EFy!P&Q}ipSN_2*pFB$$R^5or;tf&?NCD+Gw-y@oDfyO;vqC2(0t@dn zz8#7J@d|=Eq`P8dw+ac-BRMe01P6RvDv2MCmiy`|CX>NZuPaDM)<4gb8Hf2k-#ol> zD||<@<42*4bsf$TjGk5bJo#{1FaGUtG&XQ2TbkJL0k7S<*|HdVMh#kk7gv&D%{eH5 zcBq(|`s5Lng-ErcsvfopKgxhoNDZ@GRv-E)9DJ`yXgRbzaKJbqM_7m-w&-&djuAzm zf0+Y(N9%=-{S)p3lI~{T6M%=v((-YsNOjA1ABY7}PWd)93$on_GWUz~8O#}`3S9+d zJOJ~U@tHsN62L#l#qc+WR5pT3Isjm2j^aRlT9wM|0Z$<`3}yA zol2QOdyRBxS#_M(UgngO=nI7{*SLP?IegUTmhGRk4kg=)LyRfy^$GD=PhO4x_(=Ci zQEvw9lfV0@mGwXV2XD}v2c@Iya^HxUiy8Q+L0(SLh9sdU%pDGWiJVn?FJg&8<1;%> zUc8ab%VQrNVUXIKkN&UjB|3LT{q>*k_oPbAA!Kkl^G=06u;!bLqh@wrM*c8>%Xd?r zPNpE01Cv3~q3Y%|e!Q8gbd68ss%qJPWk`bf9Y^#h<+r3-4{n>j4<~m>@PQmAdMyc) zvM){W#EE^E5?Otbg7}LXlN%=5N;)MW4aE|*ivcm$$-bQ!>DQxvId2Px7rX8wC@?Eh zx}YsNJlK=7FHXlt;&~{Vv~!|klSB{;eo$ZkWOo<5gz?~Ztm{s{O> zvf|64;3xTCyIFRc`=s(E`xf0}=>2M;!(qIj_%NaYj=$jMw>?F6x0NTKd*MNHV0T*W zEHh<3#e_fE+SZ&86^7&5S607%0|qY9)a;F|8q!IW5@YUfa+7Q9#6iBpaYsUmr_isH z3;W`&CmUkYS}eb2|J(&v(hCy1zioJ$-`Mz}NyuX0Oco@Fwql=g`c}tHvreYo-3iK{ z^pf}$p%|c4&0qY@%dc`@P8iAz+P0#-qq@PVEiG7-Dfv^z=WZWFTym#*K3;DJuDSVk zkjLCb)TWi51c-NOaQqD{4k0YoR7w0#nDJq88k4Tda_#-3fj;tYzc8`?s=UR%MI1`* zf$B7V+Ry)=2(--RaqsfQ>j$!1|N1Ue>C6#N3VsfEVpnM_hdWpI8iGVjC&axppCR&9 zCA4z?x{3LjmO4g>lky4EG0SN%mFkK6H?2~FlSB{iy+jML0S zwUkh0U*xp<@eh#T9am@=+9SBQdrSJ!W=4E>(B@IgGWBGpRE~NX7KOrc600)C>~59h zsteuj$-i{`BZH>_kq*X>Ko5up>3N>&pi|6L`0mj$+CbC5l#KS>v!>`U=}l9wFgpKrqPTHA^Xfre?B4 z@wfthEL!#U=m)HdK^em0?0tXlq9iHMw~gb|y)@%M+|tJkvzj{3Q2QSG3qv`ICo?VlG9LEo{F4R;}A;cRLD z$%TihkQEDvc(LLN|0C9AR{(e(ehbytC1_fZoR^erp6=Tw4{M5nG)Cs{5WP?F^$T1b zO&H&@k={jD|5Z<6;e;^G@;&fQ7(>6#XE2MDhz%ohI6?)q#;THvj=`$@kl>ghV}+K8 z7~Y~|Jt#Rc>0}=2nagKV0-gK&Z>Zc zv-=M=Lt@J2s0Ah{*`gSH$BcC$H+H$71Tz%Ez(~Z{XL8$zq~400?dQs@!iJ3hEvpXx zSvYvSc*E5=%Xqg6-gAK?oG0 z7TOT@_L+T2S0Dm|RHmm-$}p*u&Ik}@%Xsp=00eQE&lUqc*UQiM%XrI81G6II8e&nF zqmBp=EZ#l;zQ*dBAV?a@2#21T)p2a;d=O-og^`Al_JiB?AEXtpBXIwxb0T^>&idqgwk%OvDe~W6hfO*EzkgCkFPs z7;tP8M`FOoA~g{U^*_A-*VDPiGyVR5{IeOGXa`A@W@d$&+E6(+Gv*va4yg>y`H(q= za+p&&%z2I>b1EH(oGPbKhDxZM&rz02sZ`(p{&#*iu3PWx=I3!;@6Yvqy`C?u>M1lP zWl|x|M+@$K4BaJz_3wd~A}>7fdKN zD(kQuiG5>t1?WmUXeZe>j3+-xBj=GqVBbIGDO(MJGwphYPQ2^Ryvhe5?dJ4G`=r>5B#&8w8W;*23?%^?bi#nAPj>b(+Im=P>eq z$Yvb*jyjXj7;Y+6!2s>E9y$zE-%N+)(PX=-TgnHB70;!##b_=Npz_Z4eA&6OYd`-* zW*(todJ}z4zb)Ib1^1N!1{4^1fwy%lK!AGbmktOBNES@cw)J-OBIS79>Z4CcV=3=; z%Q{zY>s^La7;#jj=~PENm7B$VC8RXi^YLnG5t68RCL>G~6<{x1P7sc-J^3bk=!EZU zLK5Lwptw+cAQaa-P-_avQ$&zv6DXYp;ns-si5S?_v-6G`Gnwi z?N96FDHoFjG-BlQcuFsRO%*!w1GcM|WsXC}#v14nKQ$|Twg7Gb~z1c!c zV^#X){tHRL}024H@kes;=p<>G?^JewID*O`K)LV)o+>Tr)@ z?iG$-IHS5ag$_wnxO}!NsW8+sI_71D#RZBxWIHghGRb$}+eNDfhEve;FnYyrJ?dwz z6JTkeJHk9fjw&ohaFqy!75Mi!Q>GS{zc+l|5pc=Ay`u|%(`-^GOb+)9HGrDvk+TB@ z%Ko}_I9i%y3>)w+XBLJq;NY(QBgXwbPO*O0qk8Nqj_e-}{A z8h2q^EuT#vlt+GL{w_9Il{oe;wn7s#Z36=Uhfq%ddJ`8zLdpeI$vU;h#~js?cRZPm zOeV3coVsK?MWq&aTn4JjzeluSe^LtDSS2+;*~5rUL*xcrFtLa7{D%37$^IyJpc1t{ z=f#yk#xjOekOtv3k%5$x-7E=dez_Vn=($zpB`^Q7%)3f53Wx>N0?`}uVnG^&;v3Xa z?o6LQ!Sfx~wXVYxz3V9}{O$p9lsh`2n9%KZ_L%X4*Dr9eedU}W%&S24MtkeKjnK*M z1E`X`BNALm29BMh)4)zs#ybw;5bA23lN;}MrnaN&6tDy$n@lNNAz4Way>Xp|0>WSO zNA9hUI|-FJ?Q0ZhKVK0!L|&%+^2pllJegGoIp|zxTyH{jC|>Z9C;I!@p%5A58is&cY171m(SX}8dp^xfEZ=jV_t5=ssvFao_2jYs_i$sEy(ty zv&b+sT)v8#PGXHi^t%m0Dsdx{7GXw*^r~{U() z+bEx-^OcqQK*Zth#}ALSF<>g?{617>PSC9-d|2Z5dbI;KF|nagAoa?YtW}-R+*CQO3+a5a zL795*G$>&lDrxaHsj&L17H@h=NJw<&(@OIlpL6+otDI~Ky9MFqMU$#@O}8;n!Ba=j zE2tQ_o<-8IS6e_MLhTs=g$pzOI~?!(X);QFnnFRJy{~hd>PH@j;gtRKDPqz#7iW(_ z^KF)D_U>tCKJDmeQ{K~>U};D>{L4FMFAImybpTLo+k?g&h)JISOzE9>$b<~*l>nGE z>*W*0RTGoV8`DC+IgxTP!H@k&w&${GLIkwLAk(JVyr@d*cBe*4C3>-9hPIr4M#FtI>z=jVU)k#jqYfztiGZ7ed8NKjW# zzw9r?`jadGK}SiIyx)d{x))Z=r@Z$_*$9TNZeVcGg^qw7jzMEu+Eh=ftJLE&f$AY8 zi34s*Dfq$b6v4x$eA+9a#xyLYPNs zQwBp$K93Q&;pH=2+-WkV!bD8WzMn+6xuf?(&n{rHIU|-;f8s=BM8veeHlf6FRdcoZ zGqcLt6?BY6A>~gDeqxNSY%T{MYl{9Y&~Q7&5&=8AqylbUfrLKmd6Hf138I0!eUAF_gYx=4})m2=`* zfi7B%$|QXoFHrb&7!-GG6#ocb9c>BG>a;!RcDH&@3dUq%7yGZrXyFq|--qJl|egs&2$s=A-0tvC#m3sM!06o3`Ck?qcI#?a~IXkMZT`r?YyQW_~ zx%OT1tKgexR4Q>S4y22G$xAq@wkNj?a7&7b(NRKeszm+xP$$tisPlu=uo8I6&N5^z zR^_^jfYD@q1A1D}z2p{m0rFrFNC zM?_=B-@le}5`_)YQd5i_)Psg>p`! zXa`56Pdei2U(&M{W3xo7lW)wLFw}sPm)L1^_S^Chs5LoY0 zIt1i(4?t`ApP!r^$M>Z3NTpvq)XyL*AMi_7db` zcvGfpfu0Y}`9OEgx48~_FVUSvpi#w`G z0hRnj9$)JGUDhgHIfDjxI=tT>qJ2Lv|2p@pug7FRI%ripUN?kSXX7Vpbub&(l2`FI zqWBEcY@9i#8)&m@s8_)@a=6BA~fM^J5{G7 zGbHzMp-CYJ8GTrE4H|+ohLLc#umlxZ(VR|YKI<*1GDnts0NPqa#mGPV)v@qIPPO@4 zP{ma7fZ+duLc#6VN;HxkXG)TID|!~7nvrsU+6~2ikyx{N8W3XzbYdbxVmSfEv`aiZ zC4Di^fUIW5@cZ|JSmJgJ3z;+4ucew?h-%oscs?bS z8fwo^b5ftDUM@mRqy(#(d73PJj4KG}aZEqUx*d4wIx6Y%-<~F);fPjeyQZd4y?Znm zaXdsNVYOI!%J}+|ogP1oW|TK0Uu>p&cfasbqgh(#BParuMsV)h8`I#M&=V9M)f0Ga zYAMGo%MxmZb#4Asv6A{YAiBmlJ$3bqefXR>Ac?YRNk8v#)!|I!;wGo(`)!BLJ+-#q zNrWxp*fdvgZV5>lp|+5wro0m#wYr#a`M(>4UDPFg1FSv$ShBpc#O)_X?cnF3Q3tiN+CkDb?Ps2M;{n8; zsBat)dge*WGyY*ET+khBu=M%u=$3Q9%11+7rui)rQ~0`5Q1Vn4Z8>c92G&8ti9*?> zw5Vh$WZSr6p=A%a01`rh$RID{@=?3pA6(M+x?_WELK=U1KmEZ0uvjR!vUXx>+xZ zdcyNHqW#2&P|kKCo|Lw$w=|!ba|ST_^}sGI>3zn@;v6#NY{`K0Io-Y?k$Jwfvxd5# znhtiiT&D`MOGXyNVP9|8#+n=o9fO65!Jto%M~L>zdQ-o?jwxs{7NtVqBPW;HeeQb= z9WU6BmGTZ*A8~!^cS%CJxX0$mC;$1FaHYJ2Jsa*M48+A)>z2jHNi4c_77&?FPAnf4 zCm06*$n`>N-qGveH~3#N`SX$3Kd8zloIFBHse!dewy26?$>KHy@FRjD8Eo8jNGkX~ zC$G6ff;BqSDVDN|`*Uo9-U~}4Flw8cn!!Pt`fsQ=*HI|LLgU9b#vJSrTU{z_&?^N3 zCONB#FOpX{tMS4pHGXU)>}iJVoe|BW_7t3sZyMv1Ne}PvQH8Ps5RbOLc(rwU4URPG zGUqRW;L=Dq9WG7W)>W}OwE5xat?c&=E`6DR5S2k$B8J`+kbHqKaw0}ZjN79Cbvz+!pLy_^EkH$w`myaYyeD0z0wq zbZ#2~McjH`*II;9@E-T@aGROE7S~>hAN~MI%6(i&S3dOo z2vU4LxwU1X%Vf|$lXv9@31sZt@T74wo_wlW0Y)_X8CW`s|F{t4p7-Yc_}l57k}}gA zTzT=n13=DMl^ePB8AKi<_w12L+eT$2{n!Bl6#aW5CdWZUUR8s@yq#7s^u_?x9Z!g7sYiSquiPx1S0H$(IWBn+(nwV~a5>*`qh-C&3GHiAv?+E3|CJ!lszZ`rbtHpu z<^D$8pCdjsirI(Zr;;6{>{z9mc%a(+qtvU~xj!1V^wrK^B2&7SjD+>z_^ z5GD)MkOM0o#a09k>Ezg9bj-CI|0KADf7OU~k?#d#lEu6Hdn8lku}0f&+j)frUwHt!X3GtdU&R)V{;;hEtDEqVn$U!5nN*d?0RT zFMMj(O9B|z{il?50t*)dLkFhEMcv(3^zb5Cx<%2a=rg96R6q=YP(68CcK4enW7JW5 zap4CagDU|@TRVVzD)lTACR(82>J+ZwJr@{u$&zx40z>(q^T@$e_S5J_`Y!?X&sxH@ z$bA)S^KcwErW}pLOMLJ*P4KR#r&D4+@l6OA41(7YoMViO@#N2s?(S2!J2Xu2mez+J z*T{9#Ukm5FJ*Gqy>ilG&0Kc8{)cI%O#n$}+e%1YiRnK-fKjQh2=4_`Oe6C=Ohh2M! z(9Ur8Sv}lKlb*YuYdgj*VSSXX8lCQ(exemGo0WLyiYeSBW$yA(^wWXyfAsQAm;2S< z?p(@UDmdzOSGVI=R0aJ0z-)9K{16cn z5dLX^+&iPFM#Z3N+X@z=4Gv|sdpe3(=U%`{bpm(NT`XTeLP=e$%|5UxX6;GqTQT}I}YV}jpBco_J5 zD_Cbe-X2|>E*@RMRp4)dN?Ls%TP%mYM-TK;cJ9S zoKvx~T-%2G$-86+=2zxYU0srS!iMhM;%T%O0;~4LryV+a`ErTpq2GTKYnOJkVrrlG zO%|{FW4j@Ybb3lDG#sKx<_PEz^cbWzYxdN^a^rtkzEyN+e`|7h?MFA;-!*y-ylarD zq%eKT!z-?O0tW@ZO=fM>lY!m%@;8NB_^hqeaOuk9LhkS(2PvpyDl{zMW0tn7 z^2=D+4&&Y1;ve{>pKFaxHrNFUSp^%BBaa?78Rh&@A8AdywYK#w;;{j;HfvKri;>`% zIxi&CDv?T@ccZ^`{MPTI+f%}MzTX|{yl##@0NY$HV!&%A$ItnMc!{$W^m<(+u=ctQ z!h*-%eopi!3ft>=KuGCOfM4#$lWPRTgwWBQv)O0ehx9ufy+b!^YOOJZR)P$@pa8Z? zxYF`%W{+Ppe)iucbvZKl_H5|FPpeM%U$X9uP+Qv&Ka~Evj@jCHiu&K$anQ>LZV91s;m@Q#tgF-tPt%G(E=t|Eyef?l)T8h!<)BC*d^ZfGv zzc-2yg8z!QnwoZ3SS%mQ0GA+@UZ0Le4;|_0xwKg=vvH!auI`cg%F2#HmCE1?hfjQa z>eQL78ckP4QITVMVFB!xEl=kWauk5O#^EU0RbBnQQmIs32?UOw_js;TnF=Y2qK~z; z&6XOC=IL-4B?bfe{_^EFUUWLYHt2LR|J)qP&1THSVryrHhF*TDuI_|Mt5xuVfaOGj z=N1<~%*#~we0}|E4x7!~@AE+rMaUV3+F4!w?49N1YXBf+{xP(YO8s8XvIk6Btzv3n z0mFVjG%A(ErdGEz08m?1Wi{*d6{F+hX9G^>mlYO^RuDxH0Kr)7!lcjFe_s?oV1T+v zA~D3x%zW{L#nJ}=Gm!`wng#&Ssni4X+T`Tn9d`T4r|k9?YjN=&Unum6N-o!ersG^F zbaHHdF<4SryE9d2REGr&Uke0=fA05iW}QyuvRZc~MG-Z2I{@J3y?Z}U-?X>S#(CZ* zh$0>>E5nao@9RB%ecdfBZ+~81?mob>62g_>@HZ(lviVF z#%Io@Z%XF1*}M0ZgU!vYT?&OFEiIKwAyet#;4j#=ts$L9qj!@RFP?qj^y%K803gd# zX(_uS69xcRuVz08o=;}w8jVhBwU#xl=UL79`D%8fwP*K7?Ar`xP13-P|oJONVL4gJ|O+%^7hhA^Y0fxi3y=kYJr|fb)Zri{A z%}Xr%ur;UaUt(fnY~uLwBkrlGsWo83p?JMlf+HipeiV%^CH@aA5}E(Y@8@1!hvg_- zkA3^vnjMasPN%cFd^36P6eVkIedjZS!Qz(56eTpx rXbBO*i9~!h61hFt-F@uvW_^DH`f-J8V)-bD00000NkvXXu0mjf^%?m= literal 0 HcmV?d00001 diff --git a/matita/icons/whelp.svg b/matita/icons/whelp.svg new file mode 100644 index 000000000..c1da66f6d --- /dev/null +++ b/matita/icons/whelp.svg @@ -0,0 +1,221 @@ + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + h + + e + + l + + p + + W + + + diff --git a/matita/lablGraphviz.ml b/matita/lablGraphviz.ml new file mode 100644 index 000000000..d67584c8c --- /dev/null +++ b/matita/lablGraphviz.ml @@ -0,0 +1,162 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +type attribute = string * string (* pair *) + +let png_flags = "-Tpng" +let map_flags = "-Tcmapx" + +let tempfile () = Filename.temp_file "matita_" "" + +class type graphviz_widget = + object + method load_graph_from_file: ?gviz_cmd:string -> string -> unit + method connect_href: + (GdkEvent.Button.t -> (string * string) list -> unit) -> unit + method center_on_href: string -> unit + method as_image: GMisc.image + method as_viewport: GBin.viewport + end + +class graphviz_impl ?packing () = + let viewport = GBin.viewport ?packing () in + let mk_gviz_cmd gviz_cmd flags src_fname dest_fname = + sprintf "cat %s | %s %s > %s" src_fname gviz_cmd flags + dest_fname in + let image = + GMisc.image ~packing:viewport#add ~xalign:0. ~yalign:0. ~xpad:0 ~ypad:0 () + in + let parse_coords s = + let xys = HExtlib.split ~sep:' ' s in + let xys = List.flatten (List.map (HExtlib.split ~sep:',') xys) in + match List.map float_of_string xys with + | [x1; y1; x2; y2 ] -> x1, y1, x2, y2 + | _ -> assert false in + object (self) + val mutable href_cb = fun _ _ -> () + val mutable map = [] (* list of associative list attr name -> attr value *) + + initializer + ignore (viewport#event#connect#button_press (fun button -> + (*eprintf "x: %f; y: %f;\n%!" (GdkEvent.Button.x button +. viewport#hadjustment#value) (GdkEvent.Button.y button +. viewport#vadjustment#value);*) + (* compute coordinates relative to image origin *) + let x = GdkEvent.Button.x button +. viewport#hadjustment#value in + let y = GdkEvent.Button.y button +. viewport#vadjustment#value in + (try href_cb button (self#find_href x y) with Not_found -> ()); + false)) + + method load_graph_from_file ?(gviz_cmd = "dot") fname = + let tmp_png = tempfile () in + let rc = Sys.command (mk_gviz_cmd gviz_cmd png_flags fname tmp_png) in + if rc <> 0 then + eprintf + ("Graphviz command failed (exit code: %d) on the following graph:\n" + ^^ "%s\n%!") + rc (HExtlib.input_file fname); + image#set_file tmp_png; + HExtlib.safe_remove tmp_png; + let tmp_map = tempfile () in + ignore (Sys.command (mk_gviz_cmd gviz_cmd map_flags fname tmp_map)); + self#load_map tmp_map; + HExtlib.safe_remove tmp_map + + method private load_map fname = + let areas = ref [] in + let is_rect l = + try List.assoc "shape" l = "rect" with Not_found -> false + in + let is_poly l = + try List.assoc "shape" l = "poly" with Not_found -> false + in + let rectify l = + List.map ( + function "coords",c -> + let xys = HExtlib.split ~sep:' ' c in + let xys = + List.map + (fun s -> + match HExtlib.split ~sep:',' s with + | [x; y] -> int_of_string x, int_of_string y + | _ -> assert false) + xys + in + let xs, ys = List.split xys in + let max_x = string_of_int (List.fold_left max 0 xs) in + let max_y = string_of_int (List.fold_left max 0 ys) in + let min_x = string_of_int (List.fold_left min max_int xs) in + let min_y = string_of_int (List.fold_left min max_int ys) in + "coords", min_x^","^min_y^" "^max_x^","^max_y + | x -> x) l + in + let p = + XmlPushParser.create_parser + { XmlPushParser.default_callbacks with + XmlPushParser.start_element = + Some (fun elt attrs -> + match elt with + | "area" when is_rect attrs -> areas := attrs :: !areas + | "area" when is_poly attrs -> areas := rectify attrs :: !areas + | _ -> ()) } in + XmlPushParser.parse p (`File fname); + map <- !areas + + method private find_href x y = + List.find + (fun attrs -> + let x1, y1, x2, y2 = parse_coords (List.assoc "coords" attrs) in + x1 <= x && x <= x2 && y1 <= y && y <= y2) + map + + method connect_href + (cb: GdkEvent.Button.t -> (string * string) list -> unit) + = + href_cb <- cb + + method center_on_href href = + (*eprintf "Centering viewport on uri %s\n%!" href;*) + try + let attrs = + List.find + (fun attrs -> + try List.assoc "href" attrs = href with Not_found -> false) + map + in + let x1, y1, x2, y2 = parse_coords (List.assoc "coords" attrs) in + viewport#hadjustment#clamp_page ~lower:x1 ~upper:x2; + viewport#vadjustment#clamp_page ~lower:y1 ~upper:y2; + with Not_found -> () + + method as_image = image + method as_viewport = viewport + + end + +let graphviz ?packing () = + (new graphviz_impl ?packing () :> graphviz_widget) + diff --git a/matita/lablGraphviz.mli b/matita/lablGraphviz.mli new file mode 100644 index 000000000..7b90eec12 --- /dev/null +++ b/matita/lablGraphviz.mli @@ -0,0 +1,72 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +(** {1 LablGtk "widget" for rendering Graphviz graphs and connecting to clicks + * on nodes, edges, ...} *) + +type attribute = string * string (* pair *) + +class type graphviz_widget = + object + + (** Load graphviz markup from file and then: + * 1) render it to PNG, loading the risulting image in the embedded + * GtkImage widget + * 2) render it to a (HTML) map, internalizing its data. + * Remember that map entries are generated only for nodes, (edges, ...) + * that have an "href" (or "URL", a synonym) attribute + * Interesting values for gviz_cmd are: + * 'neato' + * 'dot' + * 'tred | dot' + *) + method load_graph_from_file: ?gviz_cmd:string -> string -> unit + + (** Callback invoked when a click on a node listed in the map is received. + * @param gdk's button event + * @param attrs attributes of the node clicked on, as they appear on the map + * (e.g.: [ "shape","rect"; "href","http://foo.bar.com/"; + * "title","foo"; "alt","description"; "coords","41,6,113,54" ] *) + method connect_href: + (GdkEvent.Button.t -> attribute list -> unit) -> unit + + (** Center the viewport on the node having the given href value, if any *) + method center_on_href: string -> unit + + (** {3 low level access to embedded widgets} + * Containment hierarchy: + * viewport + * \- image *) + + method as_image: GMisc.image + method as_viewport: GBin.viewport + end + +(** {2 Constructors} *) + +val graphviz: ?packing:(GObj.widget -> unit) -> unit -> graphviz_widget + diff --git a/matita/legacy/coq.ma b/matita/legacy/coq.ma new file mode 100644 index 000000000..4ea9919f1 --- /dev/null +++ b/matita/legacy/coq.ma @@ -0,0 +1,94 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/legacy/coq/". + +default "equality" + cic:/Coq/Init/Logic/eq.ind + cic:/Coq/Init/Logic/sym_eq.con + cic:/Coq/Init/Logic/trans_eq.con + cic:/Coq/Init/Logic/eq_ind.con + cic:/Coq/Init/Logic/eq_ind_r.con + cic:/Coq/Init/Logic/eq_rec.con + cic:/Coq/Init/Logic/eq_rec_r.con + cic:/Coq/Init/Logic/eq_rect.con + cic:/Coq/Init/Logic/eq_rect_r.con + cic:/Coq/Init/Logic/f_equal.con + cic:/matita/legacy/coq/f_equal1.con. + +default "true" + cic:/Coq/Init/Logic/True.ind. +default "false" + cic:/Coq/Init/Logic/False.ind. +default "absurd" + cic:/Coq/Init/Logic/absurd.con. + +(* aritmetic operators *) + +interpretation "Coq's natural plus" 'plus x y = (cic:/Coq/Init/Peano/plus.con x y). +interpretation "Coq's real plus" 'plus x y = (cic:/Coq/Reals/Rdefinitions/Rplus.con x y). +interpretation "Coq's binary integer plus" 'plus x y = (cic:/Coq/ZArith/BinInt/Zplus.con x y). +interpretation "Coq's binary positive plus" 'plus x y = (cic:/Coq/NArith/BinPos/Pplus.con x y). +interpretation "Coq's natural minus" 'minus x y = (cic:/Coq/Init/Peano/minus.con x y). +interpretation "Coq's real minus" 'minus x y = (cic:/Coq/Reals/Rdefinitions/Rminus.con x y). +interpretation "Coq's binary integer minus" 'minus x y = (cic:/Coq/ZArith/BinInt/Zminus.con x y). +interpretation "Coq's binary positive minus" 'minus x y = (cic:/Coq/NArith/BinPos/Pminus.con x y). +interpretation "Coq's natural times" 'times x y = (cic:/Coq/Init/Peano/mult.con x y). +interpretation "Coq's real times" 'times x y = (cic:/Coq/Reals/Rdefinitions/Rmult.con x y). +interpretation "Coq's binary positive times" 'times x y = (cic:/Coq/NArith/BinPos/Pmult.con x y). +interpretation "Coq's binary integer times" 'times x y = (cic:/Coq/ZArith/BinInt/Zmult.con x y). +interpretation "Coq's real power" 'power x y = (cic:/Coq/Reals/Rfunctions/pow.con x y). +interpretation "Coq's integer power" 'power x y = (cic:/Coq/ZArith/Zpower/Zpower.con x y). +interpretation "Coq's real divide" 'divide x y = (cic:/Coq/Reals/Rdefinitions/Rdiv.con x y). +interpretation "Coq's real unary minus" 'uminus x = (cic:/Coq/Reals/Rdefinitions/Ropp.con x). +interpretation "Coq's binary integer negative sign" 'uminus x = (cic:/Coq/ZArith/BinInt/Z.ind#xpointer(1/1/3) x). +interpretation "Coq's binary integer unary minus" 'uminus x = (cic:/Coq/ZArith/BinInt/Zopp.con x). + +(* logical operators *) + +interpretation "Coq's logical and" 'and x y = (cic:/Coq/Init/Logic/and.ind#xpointer(1/1) x y). +interpretation "Coq's logical or" 'or x y = (cic:/Coq/Init/Logic/or.ind#xpointer(1/1) x y). +interpretation "Coq's logical not" 'not x = (cic:/Coq/Init/Logic/not.con x). +interpretation "Coq's exists" 'exists \eta.x = (cic:/Coq/Init/Logic/ex.ind#xpointer(1/1) _ x). + +(* relational operators *) + +interpretation "Coq's natural 'less or equal to'" 'leq x y = (cic:/Coq/Init/Peano/le.ind#xpointer(1/1) x y). +interpretation "Coq's real 'less or equal to'" 'leq x y = (cic:/Coq/Reals/Rdefinitions/Rle.con x y). +interpretation "Coq's natural 'greater or equal to'" 'geq x y = (cic:/Coq/Init/Peano/ge.con x y). +interpretation "Coq's real 'greater or equal to'" 'geq x y = (cic:/Coq/Reals/Rdefinitions/Rge.con x y). +interpretation "Coq's natural 'less than'" 'lt x y = (cic:/Coq/Init/Peano/lt.con x y). +interpretation "Coq's real 'less than'" 'lt x y = (cic:/Coq/Reals/Rdefinitions/Rlt.con x y). +interpretation "Coq's natural 'greater than'" 'gt x y = (cic:/Coq/Init/Peano/gt.con x y). +interpretation "Coq's real 'greater than'" 'gt x y = (cic:/Coq/Reals/Rdefinitions/Rgt.con x y). + +interpretation "Coq's leibnitz's equality" 'eq x y = (cic:/Coq/Init/Logic/eq.ind#xpointer(1/1) _ x y). +interpretation "Coq's not equal to (leibnitz)" 'neq x y = (cic:/Coq/Init/Logic/not.con (cic:/Coq/Init/Logic/eq.ind#xpointer(1/1) _ x y)). + +interpretation "Coq's natural 'not less or equal than'" + 'nleq x y = (cic:/Coq/Init/Logic/not.con + (cic:/Coq/Init/Peano/le.ind#xpointer(1/1) x y)). + +theorem f_equal1 : \forall A,B:Type.\forall f:A\to B.\forall x,y:A. + x = y \to (f y) = (f x). + intros. + symmetry. + apply cic:/Coq/Init/Logic/f_equal.con. + assumption. +qed. +(* aliases *) + +(* FG: This is because "and" is a reserved keyword of the parser *) +alias id "land" = "cic:/Coq/Init/Logic/and.ind#xpointer(1/1)". + diff --git a/matita/legacy/makefile b/matita/legacy/makefile new file mode 100644 index 000000000..a1dd3ca33 --- /dev/null +++ b/matita/legacy/makefile @@ -0,0 +1,39 @@ +H=@ + +RT_BASEDIR=../ +OPTIONS=-bench -onepass -system +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/library/Fsub/defn.ma b/matita/library/Fsub/defn.ma new file mode 100644 index 000000000..4ab638b8c --- /dev/null +++ b/matita/library/Fsub/defn.ma @@ -0,0 +1,393 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + +include "Fsub/util.ma". + +(*** representation of Fsub types ***) +inductive Typ : Set \def + | TVar : nat \to Typ (* type var *) + | TFree: nat \to Typ (* free type name *) + | Top : Typ (* maximum type *) + | Arrow : Typ \to Typ \to Typ (* functions *) + | Forall : Typ \to Typ \to Typ. (* universal type *) + +(* representation of bounds *) + +record bound : Set \def { + istype : bool; (* is subtyping bound? *) + name : nat ; (* name *) + btype : Typ (* type to which the name is bound *) + }. + +(*** Various kinds of substitution, not all will be used probably ***) + +(* substitutes i-th dangling index in type T with type U *) +let rec subst_type_nat T U i \def + match T with + [ (TVar n) \Rightarrow match (eqb n i) with + [ true \Rightarrow U + | false \Rightarrow T] + | (TFree X) \Rightarrow T + | Top \Rightarrow T + | (Arrow T1 T2) \Rightarrow (Arrow (subst_type_nat T1 U i) (subst_type_nat T2 U i)) + | (Forall T1 T2) \Rightarrow (Forall (subst_type_nat T1 U i) (subst_type_nat T2 U (S i))) ]. + +(*** height of T's syntactic tree ***) + +let rec t_len T \def + match T with + [(TVar n) \Rightarrow (S O) + |(TFree X) \Rightarrow (S O) + |Top \Rightarrow (S O) + |(Arrow T1 T2) \Rightarrow (S (max (t_len T1) (t_len T2))) + |(Forall T1 T2) \Rightarrow (S (max (t_len T1) (t_len T2)))]. + +(*** definitions about lists ***) + +definition fv_env : (list bound) \to (list nat) \def + \lambda G.(map ? ? (\lambda b.match b with + [(mk_bound B X T) \Rightarrow X]) G). + +let rec fv_type T \def + match T with + [(TVar n) \Rightarrow [] + |(TFree x) \Rightarrow [x] + |Top \Rightarrow [] + |(Arrow U V) \Rightarrow ((fv_type U) @ (fv_type V)) + |(Forall U V) \Rightarrow ((fv_type U) @ (fv_type V))]. + +(*** Type Well-Formedness judgement ***) + +inductive WFType : (list bound) \to Typ \to Prop \def + | WFT_TFree : \forall X,G.(in_list ? X (fv_env G)) + \to (WFType G (TFree X)) + | WFT_Top : \forall G.(WFType G Top) + | WFT_Arrow : \forall G,T,U.(WFType G T) \to (WFType G U) \to + (WFType G (Arrow T U)) + | WFT_Forall : \forall G,T,U.(WFType G T) \to + (\forall X:nat. + (\lnot (in_list ? X (fv_env G))) \to + (\lnot (in_list ? X (fv_type U))) \to + (WFType ((mk_bound true X T) :: G) + (subst_type_nat U (TFree X) O))) \to + (WFType G (Forall T U)). + +(*** Environment Well-Formedness judgement ***) + +inductive WFEnv : (list bound) \to Prop \def + | WFE_Empty : (WFEnv (nil ?)) + | WFE_cons : \forall B,X,T,G.(WFEnv G) \to + \lnot (in_list ? X (fv_env G)) \to + (WFType G T) \to (WFEnv ((mk_bound B X T) :: G)). + +(*** Subtyping judgement ***) +inductive JSubtype : (list bound) \to Typ \to Typ \to Prop \def + | SA_Top : \forall G.\forall T:Typ.(WFEnv G) \to + (WFType G T) \to (JSubtype G T Top) + | SA_Refl_TVar : \forall G.\forall X:nat.(WFEnv G) + \to (in_list ? X (fv_env G)) + \to (JSubtype G (TFree X) (TFree X)) + | SA_Trans_TVar : \forall G.\forall X:nat.\forall T:Typ. + \forall U:Typ. + (in_list ? (mk_bound true X U) G) \to + (JSubtype G U T) \to (JSubtype G (TFree X) T) + | SA_Arrow : \forall G.\forall S1,S2,T1,T2:Typ. + (JSubtype G T1 S1) \to (JSubtype G S2 T2) \to + (JSubtype G (Arrow S1 S2) (Arrow T1 T2)) + | SA_All : \forall G.\forall S1,S2,T1,T2:Typ. + (JSubtype G T1 S1) \to + (\forall X:nat.\lnot (in_list ? X (fv_env G)) \to + (JSubtype ((mk_bound true X T1) :: G) + (subst_type_nat S2 (TFree X) O) (subst_type_nat T2 (TFree X) O))) \to + (JSubtype G (Forall S1 S2) (Forall T1 T2)). + +notation "hvbox(e ⊢ break ta ⊴ break tb)" + non associative with precedence 30 for @{ 'subjudg $e $ta $tb }. +interpretation "Fsub subtype judgement" 'subjudg e ta tb = + (cic:/matita/Fsub/defn/JSubtype.ind#xpointer(1/1) e ta tb). + +notation > "hvbox(\Forall S.T)" + non associative with precedence 60 for @{ 'forall $S $T}. +notation < "hvbox('All' \sub S. break T)" + non associative with precedence 60 for @{ 'forall $S $T}. +interpretation "universal type" 'forall S T = + (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/5) S T). + +notation "#x" with precedence 79 for @{'tvar $x}. +interpretation "bound tvar" 'tvar x = + (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/1) x). + +notation "!x" with precedence 79 for @{'tname $x}. +interpretation "bound tname" 'tname x = + (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/2) x). + +notation "⊤" with precedence 90 for @{'toptype}. +interpretation "toptype" 'toptype = + (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/3)). + +notation "hvbox(s break ⇛ t)" + right associative with precedence 55 for @{ 'arrow $s $t }. +interpretation "arrow type" 'arrow S T = + (cic:/matita/Fsub/defn/Typ.ind#xpointer(1/1/4) S T). + +notation "hvbox(S [# n ↦ T])" + non associative with precedence 80 for @{ 'substvar $S $T $n }. +interpretation "subst bound var" 'substvar S T n = + (cic:/matita/Fsub/defn/subst_type_nat.con S T n). + +notation "hvbox(|T|)" + non associative with precedence 30 for @{ 'tlen $T }. +interpretation "type length" 'tlen T = + (cic:/matita/Fsub/defn/t_len.con T). + +notation "hvbox(!X ⊴ T)" + non associative with precedence 60 for @{ 'subtypebound $X $T }. +interpretation "subtyping bound" 'subtypebound X T = + (cic:/matita/Fsub/defn/bound.ind#xpointer(1/1/1) true X T). + +(****** PROOFS ********) + +(*** theorems about lists ***) + +lemma boundinenv_natinfv : \forall x,G. + (\exists B,T.(in_list ? (mk_bound B x T) G)) \to + (in_list ? x (fv_env G)). +intros 2;elim G + [elim H;elim H1;lapply (in_list_nil ? ? H2);elim Hletin + |elim H1;elim H2;elim (in_cons_case ? ? ? ? H3) + [rewrite < H4;simplify;apply in_Base + |simplify;apply in_Skip;apply H;apply (ex_intro ? ? a); + apply (ex_intro ? ? a1);assumption]] +qed. + +lemma natinfv_boundinenv : \forall x,G.(in_list ? x (fv_env G)) \to + \exists B,T.(in_list ? (mk_bound B x T) G). +intros 2;elim G 0 + [simplify;intro;lapply (in_list_nil ? ? H);elim Hletin + |intros 3;elim t;simplify in H1;elim (in_cons_case ? ? ? ? H1) + [rewrite < H2;apply (ex_intro ? ? b);apply (ex_intro ? ? t1);apply in_Base + |elim (H H2);elim H3;apply (ex_intro ? ? a); + apply (ex_intro ? ? a1);apply in_Skip;assumption]] +qed. + +lemma incl_bound_fv : \forall l1,l2.(incl ? l1 l2) \to + (incl ? (fv_env l1) (fv_env l2)). +intros.unfold in H.unfold.intros.apply boundinenv_natinfv. +lapply (natinfv_boundinenv ? ? H1).elim Hletin.elim H2.apply ex_intro + [apply a + |apply ex_intro + [apply a1 + |apply (H ? H3)]] +qed. + +lemma incl_cons : \forall x,l1,l2. + (incl ? l1 l2) \to (incl nat (x :: l1) (x :: l2)). +intros.unfold in H.unfold.intros.elim (in_cons_case ? ? ? ? H1) + [rewrite > H2;apply in_Base|apply in_Skip;apply (H ? H2)] +qed. + +lemma WFT_env_incl : \forall G,T.(WFType G T) \to + \forall H.(incl ? (fv_env G) (fv_env H)) \to (WFType H T). +intros 3.elim H + [apply WFT_TFree;unfold in H3;apply (H3 ? H1) + |apply WFT_Top + |apply WFT_Arrow [apply (H2 ? H6)|apply (H4 ? H6)] + |apply WFT_Forall + [apply (H2 ? H6) + |intros;apply (H4 ? ? H8) + [unfold;intro;apply H7;apply(H6 ? H9) + |simplify;apply (incl_cons ? ? ? H6)]]] +qed. + +lemma fv_env_extends : \forall H,x,B,C,T,U,G. + (fv_env (H @ ((mk_bound B x T) :: G))) = + (fv_env (H @ ((mk_bound C x U) :: G))). +intros;elim H + [simplify;reflexivity|elim t;simplify;rewrite > H1;reflexivity] +qed. + +lemma lookup_env_extends : \forall G,H,B,C,D,T,U,V,x,y. + (in_list ? (mk_bound D y V) (H @ ((mk_bound C x U) :: G))) \to + (y \neq x) \to + (in_list ? (mk_bound D y V) (H @ ((mk_bound B x T) :: G))). +intros 10;elim H + [simplify in H1;elim (in_cons_case ? ? ? ? H1) + [destruct H3;elim (H2);reflexivity + |simplify;apply (in_Skip ? ? ? ? H3);] + |simplify in H2;simplify;elim (in_cons_case ? ? ? ? H2) + [rewrite > H4;apply in_Base + |apply (in_Skip ? ? ? ? (H1 H4 H3))]] +qed. + +lemma in_FV_subst : \forall x,T,U,n.(in_list ? x (fv_type T)) \to + (in_list ? x (fv_type (subst_type_nat T U n))). +intros 3;elim T + [simplify in H;elim (in_list_nil ? ? H) + |2,3:simplify;simplify in H;assumption + |*:simplify in H2;simplify;elim (append_to_or_in_list ? ? ? ? H2) + [1,3:apply in_list_append1;apply (H ? H3) + |*:apply in_list_append2;apply (H1 ? H3)]] +qed. + +(*** lemma on fresh names ***) + +lemma fresh_name : \forall l:(list nat).\exists n.\lnot (in_list ? n l). +cut (\forall l:(list nat).\exists n.\forall m. + (n \leq m) \to \lnot (in_list ? m l)) + [intros;lapply (Hcut l);elim Hletin;apply ex_intro + [apply a + |apply H;constructor 1] + |intros;elim l + [apply (ex_intro ? ? O);intros;unfold;intro;elim (in_list_nil ? ? H1) + |elim H; + apply (ex_intro ? ? (S (max a t))). + intros.unfold. intro. + elim (in_cons_case ? ? ? ? H3) + [rewrite > H4 in H2.autobatch + |elim H4 + [apply (H1 m ? H4).apply (trans_le ? (max a t));autobatch + |assumption]]]] +qed. + +(*** lemmata on well-formedness ***) + +lemma fv_WFT : \forall T,x,G.(WFType G T) \to (in_list ? x (fv_type T)) \to + (in_list ? x (fv_env G)). +intros 4.elim H + [simplify in H2;elim (in_cons_case ? ? ? ? H2) + [rewrite > H3;assumption|elim (in_list_nil ? ? H3)] + |simplify in H1;elim (in_list_nil ? x H1) + |simplify in H5;elim (append_to_or_in_list ? ? ? ? H5);autobatch + |simplify in H5;elim (append_to_or_in_list ? ? ? ? H5) + [apply (H2 H6) + |elim (fresh_name ((fv_type t1) @ (fv_env l))); + cut (¬ (a ∈ (fv_type t1)) ∧ ¬ (a ∈ (fv_env l))) + [elim Hcut;lapply (H4 ? H9 H8) + [cut (x ≠ a) + [simplify in Hletin;elim (in_cons_case ? ? ? ? Hletin) + [elim (Hcut1 H10) + |assumption] + |intro;apply H8;applyS H6] + |apply in_FV_subst;assumption] + |split + [intro;apply H7;apply in_list_append1;assumption + |intro;apply H7;apply in_list_append2;assumption]]]] +qed. + +(*** lemmata relating subtyping and well-formedness ***) + +lemma JS_to_WFE : \forall G,T,U.(G \vdash T ⊴ U) \to (WFEnv G). +intros;elim H;assumption. +qed. + +lemma JS_to_WFT : \forall G,T,U.(JSubtype G T U) \to ((WFType G T) \land + (WFType G U)). +intros;elim H + [split [assumption|apply WFT_Top] + |split;apply WFT_TFree;assumption + |split + [apply WFT_TFree;apply boundinenv_natinfv;apply ex_intro + [apply true | apply ex_intro [apply t1 |assumption]] + |elim H3;assumption] + |elim H2;elim H4;split;apply WFT_Arrow;assumption + |elim H2;split + [apply (WFT_Forall ? ? ? H6);intros;elim (H4 X H7); + apply (WFT_env_incl ? ? H9);simplify;unfold;intros;assumption + |apply (WFT_Forall ? ? ? H5);intros;elim (H4 X H7); + apply (WFT_env_incl ? ? H10);simplify;unfold;intros;assumption]] +qed. + +lemma JS_to_WFT1 : \forall G,T,U.(JSubtype G T U) \to (WFType G T). +intros;lapply (JS_to_WFT ? ? ? H);elim Hletin;assumption. +qed. + +lemma JS_to_WFT2 : \forall G,T,U.(JSubtype G T U) \to (WFType G U). +intros;lapply (JS_to_WFT ? ? ? H);elim Hletin;assumption. +qed. + +lemma WFE_Typ_subst : \forall H,x,B,C,T,U,G. + (WFEnv (H @ ((mk_bound B x T) :: G))) \to (WFType G U) \to + (WFEnv (H @ ((mk_bound C x U) :: G))). +intros 7;elim H 0 + [simplify;intros;(*FIXME*)generalize in match H1;intro;inversion H1;intros + [lapply (nil_cons ? G (mk_bound B x T));elim (Hletin H4) + |destruct H8;apply (WFE_cons ? ? ? ? H4 H6 H2)] + |intros;simplify;generalize in match H2;elim t;simplify in H4; + inversion H4;intros + [destruct H5 + |destruct H9;apply WFE_cons + [apply (H1 H5 H3) + |rewrite < (fv_env_extends ? x B C T U); assumption + |apply (WFT_env_incl ? ? H8); + rewrite < (fv_env_extends ? x B C T U);unfold;intros; + assumption]]] +qed. + +lemma WFE_bound_bound : \forall B,x,T,U,G. (WFEnv G) \to + (in_list ? (mk_bound B x T) G) \to + (in_list ? (mk_bound B x U) G) \to T = U. +intros 6;elim H + [lapply (in_list_nil ? ? H1);elim Hletin + |elim (in_cons_case ? ? ? ? H6) + [destruct H7;destruct;elim (in_cons_case ? ? ? ? H5) + [destruct H7;reflexivity + |elim H7;elim H3;apply boundinenv_natinfv;apply (ex_intro ? ? B); + apply (ex_intro ? ? T);assumption] + |elim (in_cons_case ? ? ? ? H5) + [destruct H8;elim H3;apply boundinenv_natinfv;apply (ex_intro ? ? B); + apply (ex_intro ? ? U);assumption + |apply (H2 H8 H7)]]] +qed. + +lemma WFT_to_incl: ∀G,T,U. + (∀X.(¬(X ∈ fv_env G)) → (¬(X ∈ fv_type U)) → + (WFType (mk_bound true X T::G) (subst_type_nat U (TFree X) O))) + → incl ? (fv_type U) (fv_env G). +intros.elim (fresh_name ((fv_type U)@(fv_env G))).lapply(H a) + [unfold;intros;lapply (fv_WFT ? x ? Hletin) + [simplify in Hletin1;inversion Hletin1;intros + [destruct H4;elim H1;autobatch + |destruct H6;assumption] + |apply in_FV_subst;assumption] + |*:intro;apply H1;autobatch] +qed. + +lemma incl_fv_env: ∀X,G,G1,U,P. + incl ? (fv_env (G1@(mk_bound true X U::G))) + (fv_env (G1@(mk_bound true X P::G))). +intros.rewrite < fv_env_extends.apply incl_A_A. +qed. + +lemma JSubtype_Top: ∀G,P.G ⊢ ⊤ ⊴ P → P = ⊤. +intros.inversion H;intros + [assumption|reflexivity + |destruct H5|*:destruct H6] +qed. + +(* elim vs inversion *) +lemma JS_trans_TFree: ∀G,T,X.G ⊢ T ⊴ (TFree X) → + ∀U.G ⊢ (TFree X) ⊴ U → G ⊢ T ⊴ U. +intros 4.cut (∀Y.TFree Y = TFree X → ∀U.G ⊢ (TFree Y) ⊴ U → G ⊢ T ⊴ U) + [apply Hcut;reflexivity + |elim H;intros + [rewrite > H3 in H4;rewrite > (JSubtype_Top ? ? H4);apply SA_Top;assumption + |rewrite < H3;assumption + |apply (SA_Trans_TVar ? ? ? ? H1);apply (H3 Y);assumption + |*:destruct H5]] +qed. + +lemma fv_append : ∀G,H.fv_env (G @ H) = (fv_env G @ fv_env H). +intro;elim G;simplify;autobatch paramodulation; +qed. \ No newline at end of file diff --git a/matita/library/Fsub/part1a.ma b/matita/library/Fsub/part1a.ma new file mode 100644 index 000000000..7ceee15d0 --- /dev/null +++ b/matita/library/Fsub/part1a.ma @@ -0,0 +1,134 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + +include "Fsub/defn.ma". + +(*** Lemma A.1 (Reflexivity) ***) +theorem JS_Refl : ∀T,G.WFType G T → WFEnv G → G ⊢ T ⊴ T. +intros 3.elim H + [apply SA_Refl_TVar [apply H2|assumption] + |apply SA_Top [assumption|apply WFT_Top] + |apply (SA_Arrow ? ? ? ? ? (H2 H5) (H4 H5)) + |apply (SA_All ? ? ? ? ? (H2 H5));intros;apply (H4 ? H6) + [intro;apply H6;apply (fv_WFT ? ? ? (WFT_Forall ? ? ? H1 H3)); + simplify;autobatch + |autobatch]] +qed. + +(* + * A slightly more general variant to lemma A.2.2, where weakening isn't + * defined as concatenation of any two disjoint environments, but as + * set inclusion. + *) + +lemma JS_weakening : ∀G,T,U.G ⊢ T ⊴ U → ∀H.WFEnv H → incl ? G H → H ⊢ T ⊴ U. +intros 4;elim H + [apply (SA_Top ? ? H4);apply (WFT_env_incl ? ? H2 ? (incl_bound_fv ? ? H5)) + |apply (SA_Refl_TVar ? ? H4);apply (incl_bound_fv ? ? H5 ? H2) + |apply (SA_Trans_TVar ? ? ? ? ? (H3 ? H5 H6));apply H6;assumption + |apply (SA_Arrow ? ? ? ? ? (H2 ? H6 H7) (H4 ? H6 H7)) + |apply (SA_All ? ? ? ? ? (H2 ? H6 H7));intros;apply H4 + [unfold;intro;apply H8;apply (incl_bound_fv ? ? H7 ? H9) + |apply (WFE_cons ? ? ? ? H6 H8);autobatch + |unfold;intros;inversion H9;intros + [destruct H11;apply in_Base + |destruct H13;apply in_Skip;apply (H7 ? H10)]]] +qed. + +theorem narrowing:∀X,G,G1,U,P,M,N. + G1 ⊢ P ⊴ U → (∀G2,T.G2@G1 ⊢ U ⊴ T → G2@G1 ⊢ P ⊴ T) → G ⊢ M ⊴ N → + ∀l.G=l@(mk_bound true X U::G1) → l@(mk_bound true X P::G1) ⊢ M ⊴ N. +intros 10.elim H2 + [apply SA_Top + [rewrite > H5 in H3; + apply (WFE_Typ_subst ? ? ? ? ? ? ? H3 (JS_to_WFT1 ? ? ? H)) + |rewrite > H5 in H4;apply (WFT_env_incl ? ? H4);apply incl_fv_env] + |apply SA_Refl_TVar + [rewrite > H5 in H3;apply (WFE_Typ_subst ? ? ? ? ? ? ? H3); + apply (JS_to_WFT1 ? ? ? H) + |rewrite > H5 in H4;rewrite < fv_env_extends;apply H4] + |elim (decidable_eq_nat X n) + [apply (SA_Trans_TVar ? ? ? P) + [rewrite < H7;elim l1;simplify + [constructor 1|constructor 2;assumption] + |rewrite > append_cons;apply H1; + lapply (WFE_bound_bound true n t1 U ? ? H3) + [apply (JS_to_WFE ? ? ? H4) + |rewrite < Hletin;rewrite < append_cons;apply (H5 ? H6) + |rewrite < H7;rewrite > H6;elim l1;simplify + [constructor 1|constructor 2;assumption]]] + |apply (SA_Trans_TVar ? ? ? t1) + [rewrite > H6 in H3;apply (lookup_env_extends ? ? ? ? ? ? ? ? ? ? H3); + unfold;intro;apply H7;symmetry;assumption + |apply (H5 ? H6)]] + |apply (SA_Arrow ? ? ? ? ? (H4 ? H7) (H6 ? H7)) + |apply (SA_All ? ? ? ? ? (H4 ? H7));intros; + apply (H6 ? ? (mk_bound true X1 t2::l1)) + [rewrite > H7;rewrite > fv_env_extends;apply H8 + |simplify;rewrite < H7;reflexivity]] +qed. + +lemma JS_trans_prova: ∀T,G1.WFType G1 T → +∀G,R,U.incl ? (fv_env G1) (fv_env G) → G ⊢ R ⊴ T → G ⊢ T ⊴ U → G ⊢ R ⊴ U. +intros 3;elim H;clear H; try autobatch; + [rewrite > (JSubtype_Top ? ? H3);autobatch + |generalize in match H7;generalize in match H4;generalize in match H2; + generalize in match H5;clear H7 H4 H2 H5; + generalize in match (refl_eq ? (Arrow t t1)); + elim H6 in ⊢ (? ? ? %→%); clear H6; intros; destruct; + [apply (SA_Trans_TVar ? ? ? ? H);apply (H4 ? ? H8 H9);autobatch + |inversion H11;intros; destruct; autobatch depth=4 width=4 size=9; + ] + |generalize in match H7;generalize in match H4;generalize in match H2; + generalize in match H5;clear H7 H4 H2 H5; + generalize in match (refl_eq ? (Forall t t1));elim H6 in ⊢ (? ? ? %→%);destruct; + [apply (SA_Trans_TVar ? ? ? ? H);apply (H4 ? H7 H8 H9 H10);reflexivity + |inversion H11;intros;destruct; + [apply SA_Top + [autobatch + |apply WFT_Forall + [autobatch + |intros;lapply (H4 ? H13);autobatch]] + |apply SA_All + [autobatch paramodulation + |intros;apply (H10 X) + [intro;apply H15;apply H8;assumption + |intro;apply H15;apply H8;apply (WFT_to_incl ? ? ? H3); + assumption + |simplify;autobatch + |apply (narrowing X (mk_bound true X t::l1) + ? ? ? ? ? H7 ? ? []) + [intros;apply H9 + [unfold;intros;lapply (H8 ? H17);rewrite > fv_append; + autobatch + |apply (JS_weakening ? ? ? H7) + [autobatch + |unfold;intros;autobatch] + |assumption] + |*:autobatch] + |autobatch]]]]] +qed. + +theorem JS_trans : ∀G,T,U,V.G ⊢ T ⊴ U → G ⊢ U ⊴ V → G ⊢ T ⊴ V. +intros 5;apply (JS_trans_prova ? G);autobatch; +qed. + +theorem JS_narrow : ∀G1,G2,X,P,Q,T,U. + (G2 @ (mk_bound true X Q :: G1)) ⊢ T ⊴ U → G1 ⊢ P ⊴ Q → + (G2 @ (mk_bound true X P :: G1)) ⊢ T ⊴ U. +intros;apply (narrowing ? ? ? ? ? ? ? H1 ? H) [|autobatch] +intros;apply (JS_trans ? ? ? ? ? H2);apply (JS_weakening ? ? ? H1); + [autobatch|unfold;intros;autobatch] +qed. diff --git a/matita/library/Fsub/part1a_inversion.ma b/matita/library/Fsub/part1a_inversion.ma new file mode 100644 index 000000000..af39f4a74 --- /dev/null +++ b/matita/library/Fsub/part1a_inversion.ma @@ -0,0 +1,156 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + +include "Fsub/defn.ma". + +(*** Lemma A.1 (Reflexivity) ***) +theorem JS_Refl : ∀T,G.WFType G T → WFEnv G → G ⊢ T ⊴ T. +intros 3.elim H + [apply SA_Refl_TVar [apply H2|assumption] + |apply SA_Top [assumption|apply WFT_Top] + |apply (SA_Arrow ? ? ? ? ? (H2 H5) (H4 H5)) + |apply (SA_All ? ? ? ? ? (H2 H5));intros;apply (H4 ? H6) + [intro;apply H6;apply (fv_WFT ? ? ? (WFT_Forall ? ? ? H1 H3)); + simplify;autobatch + |autobatch]] +qed. + +(* + * A slightly more general variant to lemma A.2.2, where weakening isn't + * defined as concatenation of any two disjoint environments, but as + * set inclusion. + *) + +lemma JS_weakening : ∀G,T,U.G ⊢ T ⊴ U → ∀H.WFEnv H → incl ? G H → H ⊢ T ⊴ U. +intros 4;elim H + [apply (SA_Top ? ? H4);apply (WFT_env_incl ? ? H2 ? (incl_bound_fv ? ? H5)) + |apply (SA_Refl_TVar ? ? H4);apply (incl_bound_fv ? ? H5 ? H2) + |apply (SA_Trans_TVar ? ? ? ? ? (H3 ? H5 H6));apply H6;assumption + |apply (SA_Arrow ? ? ? ? ? (H2 ? H6 H7) (H4 ? H6 H7)) + |apply (SA_All ? ? ? ? ? (H2 ? H6 H7));intros;apply H4 + [unfold;intro;apply H8;apply (incl_bound_fv ? ? H7 ? H9) + |apply (WFE_cons ? ? ? ? H6 H8);autobatch + |unfold;intros;inversion H9;intros + [destruct H11;apply in_Base + |destruct H13;apply in_Skip;apply (H7 ? H10)]]] +qed. + +theorem narrowing:∀X,G,G1,U,P,M,N. + G1 ⊢ P ⊴ U → (∀G2,T.G2@G1 ⊢ U ⊴ T → G2@G1 ⊢ P ⊴ T) → G ⊢ M ⊴ N → + ∀l.G=l@(mk_bound true X U::G1) → l@(mk_bound true X P::G1) ⊢ M ⊴ N. +intros 10.elim H2 + [apply SA_Top + [rewrite > H5 in H3; + apply (WFE_Typ_subst ? ? ? ? ? ? ? H3 (JS_to_WFT1 ? ? ? H)) + |rewrite > H5 in H4;apply (WFT_env_incl ? ? H4);apply incl_fv_env] + |apply SA_Refl_TVar + [rewrite > H5 in H3;apply (WFE_Typ_subst ? ? ? ? ? ? ? H3); + apply (JS_to_WFT1 ? ? ? H) + |rewrite > H5 in H4;rewrite < fv_env_extends;apply H4] + |elim (decidable_eq_nat X n) + [apply (SA_Trans_TVar ? ? ? P) + [rewrite < H7;elim l1;simplify + [constructor 1|constructor 2;assumption] + |rewrite > append_cons;apply H1; + lapply (WFE_bound_bound true n t1 U ? ? H3) + [apply (JS_to_WFE ? ? ? H4) + |rewrite < Hletin;rewrite < append_cons;apply (H5 ? H6) + |rewrite < H7;rewrite > H6;elim l1;simplify + [constructor 1|constructor 2;assumption]]] + |apply (SA_Trans_TVar ? ? ? t1) + [rewrite > H6 in H3;apply (lookup_env_extends ? ? ? ? ? ? ? ? ? ? H3); + unfold;intro;apply H7;symmetry;assumption + |apply (H5 ? H6)]] + |apply (SA_Arrow ? ? ? ? ? (H4 ? H7) (H6 ? H7)) + |apply (SA_All ? ? ? ? ? (H4 ? H7));intros; + apply (H6 ? ? (mk_bound true X1 t2::l1)) + [rewrite > H7;rewrite > fv_env_extends;apply H8 + |simplify;rewrite < H7;reflexivity]] +qed. + +lemma JSubtype_Arrow_inv: + ∀G:list bound.∀T1,T2,T3:Typ. + ∀P:list bound → Typ → Prop. + (∀n,t1. + (mk_bound true n t1) ∈ G → G ⊢ t1 ⊴ (Arrow T2 T3) → P G t1 → P G (TFree n)) → + (∀t,t1. G ⊢ T2 ⊴ t → G ⊢ t1 ⊴ T3 → P G (Arrow t t1)) → + G ⊢ T1 ⊴ (Arrow T2 T3) → P G T1. + intros; + generalize in match (refl_eq ? (Arrow T2 T3)); + change in ⊢ (% → ?) with (Arrow T2 T3 = Arrow T2 T3); + generalize in match (refl_eq ? G); + change in ⊢ (% → ?) with (G = G); + elim H2 in ⊢ (? ? ? % → ? ? ? % → %); + [1,2: destruct H6 + |5: destruct H8 + | lapply (H5 H6 H7); destruct; clear H5; + apply H; + assumption + | destruct; + clear H4 H6; + apply H1; + assumption + ] +qed. + +lemma JS_trans_prova: ∀T,G1.WFType G1 T → +∀G,R,U.incl ? (fv_env G1) (fv_env G) → G ⊢ R ⊴ T → G ⊢ T ⊴ U → G ⊢ R ⊴ U. +intros 3;elim H;clear H; try autobatch; + [rewrite > (JSubtype_Top ? ? H3);autobatch + |apply (JSubtype_Arrow_inv ? ? ? ? ? ? ? H6); intros; + [ autobatch + | inversion H7;intros; destruct; autobatch depth=4 width=4 size=9 + ] + |generalize in match H7;generalize in match H4;generalize in match H2; + generalize in match H5;clear H7 H4 H2 H5; + generalize in match (refl_eq ? (Forall t t1));elim H6 in ⊢ (? ? ? %→%);destruct; + [apply (SA_Trans_TVar ? ? ? ? H);apply (H4 ? H7 H8 H9 H10);reflexivity + |inversion H11;intros;destruct; + [apply SA_Top + [autobatch + |apply WFT_Forall + [autobatch + |intros;lapply (H4 ? H13);autobatch]] + |apply SA_All + [autobatch paramodulation + |intros;apply (H10 X) + [intro;apply H15;apply H8;assumption + |intro;apply H15;apply H8;apply (WFT_to_incl ? ? ? H3); + assumption + |simplify;autobatch + |apply (narrowing X (mk_bound true X t::l1) + ? ? ? ? ? H7 ? ? []) + [intros;apply H9 + [unfold;intros;lapply (H8 ? H17);rewrite > fv_append; + autobatch + |apply (JS_weakening ? ? ? H7) + [autobatch + |unfold;intros;autobatch] + |assumption] + |*:autobatch] + |autobatch]]]]] +qed. + +theorem JS_trans : ∀G,T,U,V.G ⊢ T ⊴ U → G ⊢ U ⊴ V → G ⊢ T ⊴ V. +intros 5;apply (JS_trans_prova ? G);autobatch; +qed. + +theorem JS_narrow : ∀G1,G2,X,P,Q,T,U. + (G2 @ (mk_bound true X Q :: G1)) ⊢ T ⊴ U → G1 ⊢ P ⊴ Q → + (G2 @ (mk_bound true X P :: G1)) ⊢ T ⊴ U. +intros;apply (narrowing ? ? ? ? ? ? ? H1 ? H) [|autobatch] +intros;apply (JS_trans ? ? ? ? ? H2);apply (JS_weakening ? ? ? H1); + [autobatch|unfold;intros;autobatch] +qed. diff --git a/matita/library/Fsub/util.ma b/matita/library/Fsub/util.ma new file mode 100644 index 000000000..c3ce75b7f --- /dev/null +++ b/matita/library/Fsub/util.ma @@ -0,0 +1,134 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + +include "logic/equality.ma". +include "nat/compare.ma". +include "list/list.ma". + +(*** useful definitions and lemmas not really related to Fsub ***) + +definition max \def +\lambda m,n. + match (leb m n) with + [true \Rightarrow n + |false \Rightarrow m]. + +lemma le_n_max_m_n: \forall m,n:nat. n \le max m n. +intros. +unfold max. +apply (leb_elim m n) + [simplify.intros.apply le_n + |simplify.intros.autobatch + ] +qed. + +lemma le_m_max_m_n: \forall m,n:nat. m \le max m n. +intros. +unfold max. +apply (leb_elim m n) + [simplify.intro.assumption + |simplify.intros.autobatch + ] +qed. + +inductive in_list (A:Type): A → (list A) → Prop ≝ +| in_Base : ∀ x,l.(in_list A x (x::l)) +| in_Skip : ∀ x,y,l.(in_list A x l) → (in_list A x (y::l)). + +notation > "hvbox(x ∈ l)" + non associative with precedence 30 for @{ 'inlist $x $l }. +notation < "hvbox(x \nbsp ∈ \nbsp l)" + non associative with precedence 30 for @{ 'inlist $x $l }. +interpretation "item in list" 'inlist x l = + (cic:/matita/Fsub/util/in_list.ind#xpointer(1/1) _ x l). + +definition incl : \forall A.(list A) \to (list A) \to Prop \def + \lambda A,l,m.\forall x.(in_list A x l) \to (in_list A x m). + +(* FIXME: use the map in library/list (when there will be one) *) +definition map : \forall A,B,f.((list A) \to (list B)) \def + \lambda A,B,f.let rec map (l : (list A)) : (list B) \def + match l in list return \lambda l0:(list A).(list B) with + [nil \Rightarrow (nil B) + |(cons (a:A) (t:(list A))) \Rightarrow + (cons B (f a) (map t))] in map. + +lemma in_list_nil : \forall A,x.\lnot (in_list A x []). +intros.unfold.intro.inversion H + [intros;lapply (sym_eq ? ? ? H2);destruct Hletin + |intros;destruct H4] +qed. + +lemma in_cons_case : ∀A.∀x,h:A.∀t:list A.x ∈ h::t → x = h ∨ (x ∈ t). +intros;inversion H;intros + [destruct H2;left;symmetry;reflexivity + |destruct H4;right;applyS H1] +qed. + +lemma append_nil:\forall A:Type.\forall l:list A. l@[]=l. +intros. +elim l;intros;autobatch. +qed. + +lemma append_cons:\forall A.\forall a:A.\forall l,l1. +l@(a::l1)=(l@[a])@l1. +intros. +rewrite > associative_append. +reflexivity. +qed. + +lemma in_list_append1: \forall A.\forall x:A. +\forall l1,l2. x \in l1 \to x \in l1@l2. +intros. +elim H + [simplify.apply in_Base + |simplify.apply in_Skip.assumption + ] +qed. + +lemma in_list_append2: \forall A.\forall x:A. +\forall l1,l2. x \in l2 \to x \in l1@l2. +intros 3. +elim l1 + [simplify.assumption + |simplify.apply in_Skip.apply H.assumption + ] +qed. + +theorem append_to_or_in_list: \forall A:Type.\forall x:A. +\forall l,l1. x \in l@l1 \to (x \in l) \lor (x \in l1). +intros 3. +elim l + [right.apply H + |simplify in H1.inversion H1;intros; destruct; + [left.apply in_Base + | elim (H l2) + [left.apply in_Skip. assumption + |right.assumption + |assumption + ] + ] + ] +qed. + +lemma max_case : \forall m,n.(max m n) = match (leb m n) with + [ true \Rightarrow n + | false \Rightarrow m ]. +intros;elim m;simplify;reflexivity; +qed. + +lemma incl_A_A: ∀T,A.incl T A A. +intros.unfold incl.intros.assumption. +qed. \ No newline at end of file diff --git a/matita/library/Q/Qaxioms.ma b/matita/library/Q/Qaxioms.ma new file mode 100644 index 000000000..b7bca88cf --- /dev/null +++ b/matita/library/Q/Qaxioms.ma @@ -0,0 +1,71 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "Z/compare.ma". +include "Z/times.ma". +include "nat/iteration2.ma". + +(* a fraction is a list of Z-coefficients for primes, in natural +order. The last coefficient must eventually be different from 0 *) + +axiom Q:Type. +axiom Qopp:Q \to Q. +axiom Qinv:Q \to Q. +axiom Qplus:Q \to Q \to Q. +axiom Qtimes:Q \to Q \to Q. +axiom QO:Q. +axiom Q1:Q. +axiom Qlt:Q \to Q \to Prop. + +axiom num: Q \to Z. +axiom denom: Q \to nat. +axiom frac: Z \to nat \to Q. + +(* plus *) +axiom symmetric_Qplus: symmetric ? Qplus. +axiom associative_Qplus: associative ? Qplus. +axiom Qplus_QO: \forall q:Q.Qplus q QO = q. +axiom Qplus_Qopp: \forall q:Q.Qplus q (Qopp q) = QO. + +(* times *) +axiom symmetric_Qtimes: symmetric ? Qtimes. +axiom associative_Qtimes: associative ? Qtimes. +axiom Qtimes_Q1: \forall q:Q.Qtimes q Q1 = q. +axiom Qtimes_Qinv: \forall q:Q.q \neq QO \to Qtimes q (Qinv q) = Q1. + +(* plus times *) +axiom distributive_Qtimes_Qplus: distributive ? Qtimes Qplus. + +axiom frac_num_denom: \forall q.frac (num q) (denom q) = q. +axiom frac_O: \forall n. frac O n = QO. +axiom frac_n: \forall n. n\neq O \to frac n n = Q1. +axiom Qtimes_frac : \forall a,b,c,d.Qtimes (frac a b) (frac c d) = +(frac (a * c) (b * d)). +alias symbol "times" = "natural times". +axiom Qplus_frac:\forall a,b,c,d.Qplus (frac a b) (frac c d) = +(frac (a * d + b * c) (b * d)). +axiom Qlt_fracl:\forall a,b,c,d.Qlt (frac a b) (frac c d) \to +a*d \lt b*c. +axiom Qlt_fracr:\forall a,b,c,d.a*d \lt b*c \to Qlt (frac a b) (frac c d). +axiom frac_Qopp: \forall a,b.Qopp(frac a b) = frac (Zopp a) b. +axiom frac_Qinv1: \forall a,b:nat.Qinv(frac a b) = frac b a. +axiom frac_Qinv2: \forall a,b:nat.Qinv(frac (Zopp a) b) = frac (Zopp b) a. + +definition sigma_Q \def \lambda n,p,f.iter_p_gen n p Q f QO Qplus. +(* +theorem geometric: \forall q.\exists k. +Qlt q (sigma_Q k (\lambda x.true) (\lambda x. frac (S O) x)). +*) \ No newline at end of file diff --git a/matita/library/Q/q.ma b/matita/library/Q/q.ma new file mode 100644 index 000000000..a6bb71fe2 --- /dev/null +++ b/matita/library/Q/q.ma @@ -0,0 +1,341 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "Z/compare.ma". +include "Z/plus.ma". + +(* a fraction is a list of Z-coefficients for primes, in natural +order. The last coefficient must eventually be different from 0 *) + +inductive fraction : Set \def + pp : nat \to fraction +| nn: nat \to fraction +| cons : Z \to fraction \to fraction. + +inductive ratio : Set \def + one : ratio + | frac : fraction \to ratio. + +(* a rational number is either O or a ratio with a sign *) +inductive Q : Set \def + OQ : Q + | Qpos : ratio \to Q + | Qneg : ratio \to Q. + +(* double elimination principles *) +theorem fraction_elim2: +\forall R:fraction \to fraction \to Prop. +(\forall n:nat.\forall g:fraction.R (pp n) g) \to +(\forall n:nat.\forall g:fraction.R (nn n) g) \to +(\forall x:Z.\forall f:fraction.\forall m:nat.R (cons x f) (pp m)) \to +(\forall x:Z.\forall f:fraction.\forall m:nat.R (cons x f) (nn m)) \to +(\forall x,y:Z.\forall f,g:fraction.R f g \to R (cons x f) (cons y g)) \to +\forall f,g:fraction. R f g. +intros 7.elim f. + apply H. + apply H1. + elim g. + apply H2. + apply H3. + apply H4.apply H5. +qed. + +(* boolean equality *) +let rec eqfb f g \def +match f with +[ (pp n) \Rightarrow + match g with + [ (pp m) \Rightarrow eqb n m + | (nn m) \Rightarrow false + | (cons y g1) \Rightarrow false] +| (nn n) \Rightarrow + match g with + [ (pp m) \Rightarrow false + | (nn m) \Rightarrow eqb n m + | (cons y g1) \Rightarrow false] +| (cons x f1) \Rightarrow + match g with + [ (pp m) \Rightarrow false + | (nn m) \Rightarrow false + | (cons y g1) \Rightarrow andb (eqZb x y) (eqfb f1 g1)]]. + +(* discrimination *) +definition aux \def + \lambda f. match f with + [ (pp n) \Rightarrow n + | (nn n) \Rightarrow n + | (cons x f) \Rightarrow O]. + +definition fhd \def +\lambda f. match f with + [ (pp n) \Rightarrow (pos n) + | (nn n) \Rightarrow (neg n) + | (cons x f) \Rightarrow x]. + +definition ftl \def +\lambda f. match f with + [ (pp n) \Rightarrow (pp n) + | (nn n) \Rightarrow (nn n) + | (cons x f) \Rightarrow f]. + +theorem injective_pp : injective nat fraction pp. +unfold injective.intros. +change with ((aux (pp x)) = (aux (pp y))). +apply eq_f.assumption. +qed. + +theorem injective_nn : injective nat fraction nn. +unfold injective.intros. +change with ((aux (nn x)) = (aux (nn y))). +apply eq_f.assumption. +qed. + +theorem eq_cons_to_eq1: \forall f,g:fraction.\forall x,y:Z. +(cons x f) = (cons y g) \to x = y. +intros. +change with ((fhd (cons x f)) = (fhd (cons y g))). +apply eq_f.assumption. +qed. + +theorem eq_cons_to_eq2: \forall x,y:Z.\forall f,g:fraction. +(cons x f) = (cons y g) \to f = g. +intros. +change with ((ftl (cons x f)) = (ftl (cons y g))). +apply eq_f.assumption. +qed. + +theorem not_eq_pp_nn: \forall n,m:nat. pp n \neq nn m. +intros.unfold Not. intro. +change with match (pp n) with +[ (pp n) \Rightarrow False +| (nn n) \Rightarrow True +| (cons x f) \Rightarrow True]. +rewrite > H. +simplify.exact I. +qed. + +theorem not_eq_pp_cons: +\forall n:nat.\forall x:Z. \forall f:fraction. +pp n \neq cons x f. +intros.unfold Not. intro. +change with match (pp n) with +[ (pp n) \Rightarrow False +| (nn n) \Rightarrow True +| (cons x f) \Rightarrow True]. +rewrite > H. +simplify.exact I. +qed. + +theorem not_eq_nn_cons: +\forall n:nat.\forall x:Z. \forall f:fraction. +nn n \neq cons x f. +intros.unfold Not. intro. +change with match (nn n) with +[ (pp n) \Rightarrow True +| (nn n) \Rightarrow False +| (cons x f) \Rightarrow True]. +rewrite > H. +simplify.exact I. +qed. + +theorem decidable_eq_fraction: \forall f,g:fraction. +decidable (f = g). +intros.unfold decidable. +apply (fraction_elim2 (\lambda f,g. f=g \lor (f=g \to False))). + intros.elim g1. + elim ((decidable_eq_nat n n1) : n=n1 \lor (n=n1 \to False)). + left.apply eq_f. assumption. + right.intro.apply H.apply injective_pp.assumption. + right.apply not_eq_pp_nn. + right.apply not_eq_pp_cons. + intros. elim g1. + right.intro.apply (not_eq_pp_nn n1 n).apply sym_eq. assumption. + elim ((decidable_eq_nat n n1) : n=n1 \lor (n=n1 \to False)). + left. apply eq_f. assumption. + right.intro.apply H.apply injective_nn.assumption. + right.apply not_eq_nn_cons. + intros.right.intro.apply (not_eq_pp_cons m x f1).apply sym_eq.assumption. + intros.right.intro.apply (not_eq_nn_cons m x f1).apply sym_eq.assumption. + intros.elim H. + elim ((decidable_eq_Z x y) : x=y \lor (x=y \to False)). + left.apply eq_f2.assumption. + assumption. + right.intro.apply H2.apply (eq_cons_to_eq1 f1 g1).assumption. + right.intro.apply H1.apply (eq_cons_to_eq2 x y f1 g1).assumption. +qed. + +theorem eqfb_to_Prop: \forall f,g:fraction. +match (eqfb f g) with +[true \Rightarrow f=g +|false \Rightarrow f \neq g]. +intros.apply (fraction_elim2 +(\lambda f,g.match (eqfb f g) with +[true \Rightarrow f=g +|false \Rightarrow f \neq g])). + intros.elim g1. + simplify.apply eqb_elim. + intro.simplify.apply eq_f.assumption. + intro.simplify.unfold Not.intro.apply H.apply injective_pp.assumption. + simplify.apply not_eq_pp_nn. + simplify.apply not_eq_pp_cons. + intros.elim g1. + simplify.unfold Not.intro.apply (not_eq_pp_nn n1 n).apply sym_eq. assumption. + simplify.apply eqb_elim.intro.simplify.apply eq_f.assumption. + intro.simplify.unfold Not.intro.apply H.apply injective_nn.assumption. + simplify.apply not_eq_nn_cons. + intros.simplify.unfold Not.intro.apply (not_eq_pp_cons m x f1).apply sym_eq. assumption. + intros.simplify.unfold Not.intro.apply (not_eq_nn_cons m x f1).apply sym_eq. assumption. + intros. + simplify. + apply eqZb_elim. + intro.generalize in match H.elim (eqfb f1 g1). + simplify.apply eq_f2.assumption. + apply H2. + simplify.unfold Not.intro.apply H2.apply (eq_cons_to_eq2 x y).assumption. + intro.simplify.unfold Not.intro.apply H1.apply (eq_cons_to_eq1 f1 g1).assumption. +qed. + +let rec finv f \def + match f with + [ (pp n) \Rightarrow (nn n) + | (nn n) \Rightarrow (pp n) + | (cons x g) \Rightarrow (cons (Zopp x) (finv g))]. + +definition Z_to_ratio :Z \to ratio \def +\lambda x:Z. match x with +[ OZ \Rightarrow one +| (pos n) \Rightarrow frac (pp n) +| (neg n) \Rightarrow frac (nn n)]. + +let rec ftimes f g \def + match f with + [ (pp n) \Rightarrow + match g with + [(pp m) \Rightarrow Z_to_ratio (pos n + pos m) + | (nn m) \Rightarrow Z_to_ratio (pos n + neg m) + | (cons y g1) \Rightarrow frac (cons (pos n + y) g1)] + | (nn n) \Rightarrow + match g with + [(pp m) \Rightarrow Z_to_ratio (neg n + pos m) + | (nn m) \Rightarrow Z_to_ratio (neg n + neg m) + | (cons y g1) \Rightarrow frac (cons (neg n + y) g1)] + | (cons x f1) \Rightarrow + match g with + [ (pp m) \Rightarrow frac (cons (x + pos m) f1) + | (nn m) \Rightarrow frac (cons (x + neg m) f1) + | (cons y g1) \Rightarrow + match ftimes f1 g1 with + [ one \Rightarrow Z_to_ratio (x + y) + | (frac h) \Rightarrow frac (cons (x + y) h)]]]. + +theorem symmetric2_ftimes: symmetric2 fraction ratio ftimes. +unfold symmetric2. intros.apply (fraction_elim2 (\lambda f,g.ftimes f g = ftimes g f)). + intros.elim g. + change with (Z_to_ratio (pos n + pos n1) = Z_to_ratio (pos n1 + pos n)). + apply eq_f.apply sym_Zplus. + change with (Z_to_ratio (pos n + neg n1) = Z_to_ratio (neg n1 + pos n)). + apply eq_f.apply sym_Zplus. + change with (frac (cons (pos n + z) f) = frac (cons (z + pos n) f)). + rewrite < sym_Zplus.reflexivity. + intros.elim g. + change with (Z_to_ratio (neg n + pos n1) = Z_to_ratio (pos n1 + neg n)). + apply eq_f.apply sym_Zplus. + change with (Z_to_ratio (neg n + neg n1) = Z_to_ratio (neg n1 + neg n)). + apply eq_f.apply sym_Zplus. + change with (frac (cons (neg n + z) f) = frac (cons (z + neg n) f)). + rewrite < sym_Zplus.reflexivity. + intros.change with (frac (cons (x1 + pos m) f) = frac (cons (pos m + x1) f)). + rewrite < sym_Zplus.reflexivity. + intros.change with (frac (cons (x1 + neg m) f) = frac (cons (neg m + x1) f)). + rewrite < sym_Zplus.reflexivity. + intros. + (*CSC: simplify does something nasty here because of a redex in Zplus *) + change with + (match ftimes f g with + [ one \Rightarrow Z_to_ratio (x1 + y1) + | (frac h) \Rightarrow frac (cons (x1 + y1) h)] = + match ftimes g f with + [ one \Rightarrow Z_to_ratio (y1 + x1) + | (frac h) \Rightarrow frac (cons (y1 + x1) h)]). + rewrite < H.rewrite < sym_Zplus.reflexivity. +qed. + +theorem ftimes_finv : \forall f:fraction. ftimes f (finv f) = one. +intro.elim f. + change with (Z_to_ratio (pos n + - (pos n)) = one). + rewrite > Zplus_Zopp.reflexivity. + change with (Z_to_ratio (neg n + - (neg n)) = one). + rewrite > Zplus_Zopp.reflexivity. + (*CSC: simplify does something nasty here because of a redex in Zplus *) +(* again: we would need something to help finding the right change *) + change with + (match ftimes f1 (finv f1) with + [ one \Rightarrow Z_to_ratio (z + - z) + | (frac h) \Rightarrow frac (cons (z + - z) h)] = one). + rewrite > H.rewrite > Zplus_Zopp.reflexivity. +qed. + +definition rtimes : ratio \to ratio \to ratio \def +\lambda r,s:ratio. + match r with + [one \Rightarrow s + | (frac f) \Rightarrow + match s with + [one \Rightarrow frac f + | (frac g) \Rightarrow ftimes f g]]. + +theorem symmetric_rtimes : symmetric ratio rtimes. +change with (\forall r,s:ratio. rtimes r s = rtimes s r). +intros. +elim r. elim s. +reflexivity. +reflexivity. +elim s. +reflexivity. +simplify.apply symmetric2_ftimes. +qed. + +definition rinv : ratio \to ratio \def +\lambda r:ratio. + match r with + [one \Rightarrow one + | (frac f) \Rightarrow frac (finv f)]. + +theorem rtimes_rinv: \forall r:ratio. rtimes r (rinv r) = one. +intro.elim r. +reflexivity. +simplify.apply ftimes_finv. +qed. + +definition Qtimes : Q \to Q \to Q \def +\lambda p,q. + match p with + [OQ \Rightarrow OQ + |Qpos p1 \Rightarrow + match q with + [OQ \Rightarrow OQ + |Qpos q1 \Rightarrow Qpos (rtimes p1 q1) + |Qneg q1 \Rightarrow Qneg (rtimes p1 q1) + ] + |Qneg p1 \Rightarrow + match q with + [OQ \Rightarrow OQ + |Qpos q1 \Rightarrow Qneg (rtimes p1 q1) + |Qneg q1 \Rightarrow Qpos (rtimes p1 q1) + ] + ] +. + \ No newline at end of file diff --git a/matita/library/Z/compare.ma b/matita/library/Z/compare.ma new file mode 100644 index 000000000..7fe60248d --- /dev/null +++ b/matita/library/Z/compare.ma @@ -0,0 +1,143 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "Z/orders.ma". +include "nat/compare.ma". + +(* boolean equality *) +definition eqZb : Z \to Z \to bool \def +\lambda x,y:Z. + match x with + [ OZ \Rightarrow + match y with + [ OZ \Rightarrow true + | (pos q) \Rightarrow false + | (neg q) \Rightarrow false] + | (pos p) \Rightarrow + match y with + [ OZ \Rightarrow false + | (pos q) \Rightarrow eqb p q + | (neg q) \Rightarrow false] + | (neg p) \Rightarrow + match y with + [ OZ \Rightarrow false + | (pos q) \Rightarrow false + | (neg q) \Rightarrow eqb p q]]. + +theorem eqZb_to_Prop: +\forall x,y:Z. +match eqZb x y with +[ true \Rightarrow x=y +| false \Rightarrow x \neq y]. +intros. +elim x. + elim y. + simplify.reflexivity. + simplify.apply not_eq_OZ_pos. + simplify.apply not_eq_OZ_neg. + elim y. + simplify.unfold Not.intro.apply (not_eq_OZ_pos n).apply sym_eq.assumption. + simplify.apply eqb_elim. + intro.simplify.apply eq_f.assumption. + intro.simplify.unfold Not.intro.apply H.apply inj_pos.assumption. + simplify.apply not_eq_pos_neg. + elim y. + simplify.unfold Not.intro.apply (not_eq_OZ_neg n).apply sym_eq.assumption. + simplify.unfold Not.intro.apply (not_eq_pos_neg n1 n).apply sym_eq.assumption. + simplify.apply eqb_elim. + intro.simplify.apply eq_f.assumption. + intro.simplify.unfold Not.intro.apply H.apply inj_neg.assumption. +qed. + +theorem eqZb_elim: \forall x,y:Z.\forall P:bool \to Prop. +(x=y \to (P true)) \to (x \neq y \to (P false)) \to P (eqZb x y). +intros. +cut +(match (eqZb x y) with +[ true \Rightarrow x=y +| false \Rightarrow x \neq y] \to P (eqZb x y)). +apply Hcut. +apply eqZb_to_Prop. +elim (eqZb). +apply (H H2). +apply (H1 H2). +qed. + +definition Z_compare : Z \to Z \to compare \def +\lambda x,y:Z. + match x with + [ OZ \Rightarrow + match y with + [ OZ \Rightarrow EQ + | (pos m) \Rightarrow LT + | (neg m) \Rightarrow GT ] + | (pos n) \Rightarrow + match y with + [ OZ \Rightarrow GT + | (pos m) \Rightarrow (nat_compare n m) + | (neg m) \Rightarrow GT] + | (neg n) \Rightarrow + match y with + [ OZ \Rightarrow LT + | (pos m) \Rightarrow LT + | (neg m) \Rightarrow nat_compare m n ]]. + +theorem Z_compare_to_Prop : +\forall x,y:Z. match (Z_compare x y) with +[ LT \Rightarrow x < y +| EQ \Rightarrow x=y +| GT \Rightarrow y < x]. +intros. +elim x. + elim y. + simplify.apply refl_eq. + simplify.exact I. + simplify.exact I. + elim y. + simplify.exact I. + simplify. + cut (match (nat_compare n n1) with + [ LT \Rightarrow n assoc_times. + rewrite > sym_times in \vdash (? ? ? (? ? %)). + rewrite > divides_to_div + [rewrite > sym_times. + rewrite > divides_to_div + [reflexivity + |apply divides_b_true_to_divides. + assumption + ] + |apply divides_b_true_to_divides. + assumption + ] + ] + |apply divides_to_divides_b_true + [apply (divides_b_true_to_lt_O ? ? H H3) + |apply (witness ? ? j). + reflexivity + ] + ] + |reflexivity + ] + |rewrite < sym_times. + rewrite > (plus_n_O (j*i)). + apply div_plus_times. + apply (divides_b_true_to_lt_O ? ? H H3) + ] + |apply (le_to_lt_to_lt ? (i*(n/i))) + [apply le_times + [apply le_n + |apply divides_to_le + [elim (le_to_or_lt_eq ? ? (le_O_n (n/i))) + [assumption + |apply False_ind. + apply (lt_to_not_le ? ? H). + rewrite < (divides_to_div i n) + [rewrite < H5. + apply le_n + |apply divides_b_true_to_divides. + assumption + ] + ] + |apply divides_b_true_to_divides. + assumption + ] + ] + |rewrite < sym_times. + rewrite > divides_to_div + [apply le_n + |apply divides_b_true_to_divides. + assumption + ] + ] + ] + |assumption + ] + |intros. + split + [split + [split + [split + [split + [apply divides_to_divides_b_true1 + [assumption + |apply (transitive_divides ? i) + [apply divides_b_true_to_divides. + assumption + |apply divides_b_true_to_divides. + assumption + ] + ] + |apply divides_to_divides_b_true + [apply (divides_b_true_to_lt_O i (i/j)) + [apply (divides_b_true_to_lt_O ? ? ? H3). + assumption + |apply divides_to_divides_b_true1 + [apply (divides_b_true_to_lt_O ? ? ? H3). + assumption + |apply (witness ? ? j). + apply sym_eq. + apply divides_to_div. + apply divides_b_true_to_divides. + assumption + ] + ] + |apply (witness ? ? (n/i)). + apply (inj_times_l1 j) + [apply (divides_b_true_to_lt_O ? ? ? H4). + apply (divides_b_true_to_lt_O ? ? ? H3). + assumption + |rewrite > divides_to_div + [rewrite > sym_times in \vdash (? ? ? (? % ?)). + rewrite > assoc_times. + rewrite > divides_to_div + [rewrite > divides_to_div + [reflexivity + |apply divides_b_true_to_divides. + assumption + ] + |apply divides_b_true_to_divides. + assumption + ] + |apply (transitive_divides ? i) + [apply divides_b_true_to_divides. + assumption + |apply divides_b_true_to_divides. + assumption + ] + ] + ] + ] + ] + |rewrite < sym_times. + apply divides_to_div. + apply divides_b_true_to_divides. + assumption + ] + |reflexivity + ] + |assumption + ] + |apply (le_to_lt_to_lt ? i) + [apply le_div. + apply (divides_b_true_to_lt_O ? ? ? H4). + apply (divides_b_true_to_lt_O ? ? ? H3). + assumption + |assumption + ] + ] + ] + |apply eq_sigma_p1 + [intros.reflexivity + |intros. + apply eq_sigma_p1 + [intros.reflexivity + |intros. + apply eq_f2 + [apply eq_f2 + [reflexivity + |apply eq_f. + rewrite > sym_times. + rewrite > (plus_n_O (x1*x)). + apply div_plus_times. + apply (divides_b_true_to_lt_O ? ? ? H2). + assumption + ] + |apply eq_f. + cut (O < x) + [cut (O < x1) + [apply (inj_times_l1 (x*x1)) + [rewrite > (times_n_O O). + apply lt_times;assumption + |rewrite > divides_to_div + [rewrite > sym_times in \vdash (? ? ? (? ? %)). + rewrite < assoc_times. + rewrite > divides_to_div + [rewrite > divides_to_div + [reflexivity + |apply divides_b_true_to_divides. + assumption + ] + |apply divides_b_true_to_divides. + assumption + ] + |elim (divides_b_true_to_divides ? ? H4). + apply (witness ? ? n2). + rewrite > assoc_times. + rewrite < H5. + rewrite < sym_times. + apply sym_eq. + apply divides_to_div. + apply divides_b_true_to_divides. + assumption + ] + ] + |apply (divides_b_true_to_lt_O ? ? ? H4). + apply (lt_times_n_to_lt x) + [assumption + |simplify. + rewrite > divides_to_div + [assumption + |apply (divides_b_true_to_divides ? ? H2). + assumption + ] + ] + ] + |apply (divides_b_true_to_lt_O ? ? ? H2). + assumption + ] + ] + ] + ] + ] + |apply eq_sigma_p1 + [intros.reflexivity + |intros. + apply (trans_eq ? ? + (sigma_p (S n) (\lambda d1:nat.divides_b d1 (n/x)) (\lambda d1:nat.f x*(g d1*h (n/x/d1))))) + [apply eq_sigma_p + [intros.reflexivity + |intros.apply assoc_Ztimes + ] + |apply (trans_eq ? ? + (sigma_p (S (n/x)) (\lambda d1:nat.divides_b d1 (n/x)) (\lambda d1:nat.f x*(g d1*h (n/x/d1))))) + [apply false_to_eq_sigma_p + [apply le_S_S. + cut (O < x) + [apply (le_times_to_le x) + [assumption + |rewrite > sym_times. + rewrite > divides_to_div + [apply le_times_n. + assumption + |apply divides_b_true_to_divides. + assumption + ] + ] + |apply (divides_b_true_to_lt_O ? ? ? H2). + assumption + ] + |intros. + apply not_divides_to_divides_b_false + [apply (trans_le ? ? ? ? H3). + apply le_S_S. + apply le_O_n + |unfold Not.intro. + apply (le_to_not_lt ? ? H3). + apply le_S_S. + apply divides_to_le + [apply (lt_times_n_to_lt x) + [apply (divides_b_true_to_lt_O ? ? ? H2). + assumption + |simplify. + rewrite > divides_to_div + [assumption + |apply (divides_b_true_to_divides ? ? H2). + assumption + ] + ] + |assumption + ] + ] + ] + |apply sym_eq. + apply Ztimes_sigma_pl + ] + ] + ] + ] + ] +qed. + +definition is_one: nat \to Z \def +\lambda n. + match n with + [O \Rightarrow OZ + | (S p) \Rightarrow + match p with + [ O \Rightarrow pos O + | (S q) \Rightarrow OZ]] +. + +theorem is_one_OZ: \forall n. n \neq S O \to is_one n = OZ. +intro.apply (nat_case n) + [intro.reflexivity + |intro. apply (nat_case m) + [intro.apply False_ind.apply H.reflexivity + |intros.reflexivity + ] + ] +qed. + +theorem sigma_p_OZ: +\forall p: nat \to bool.\forall n.sigma_p n p (\lambda m.OZ) = OZ. +intros.elim n + [reflexivity + |apply (bool_elim ? (p n1));intro + [rewrite > true_to_sigma_p_Sn + [rewrite > sym_Zplus. + rewrite > Zplus_z_OZ. + assumption + |assumption + ] + |rewrite > false_to_sigma_p_Sn + [assumption + |assumption + ] + ] + ] +qed. + +theorem dirichlet_product_is_one_r: +\forall f:nat\to Z.\forall n:nat. + dirichlet_product f is_one n = f n. +intros. +elim n + [unfold dirichlet_product. + rewrite > true_to_sigma_p_Sn + [rewrite > Ztimes_Zone_r. + rewrite > Zplus_z_OZ. + reflexivity + |reflexivity + ] + |unfold dirichlet_product. + rewrite > true_to_sigma_p_Sn + [rewrite > div_n_n + [rewrite > Ztimes_Zone_r. + rewrite < Zplus_z_OZ in \vdash (? ? ? %). + apply eq_f2 + [reflexivity + |apply (trans_eq ? ? (sigma_p (S n1) + (\lambda d:nat.divides_b d (S n1)) (\lambda d:nat.OZ))) + [apply eq_sigma_p1;intros + [reflexivity + |rewrite > is_one_OZ + [apply Ztimes_z_OZ + |unfold Not.intro. + apply (lt_to_not_le ? ? H1). + rewrite > (times_n_SO x). + rewrite > sym_times. + rewrite < H3. + rewrite > (div_mod ? x) in \vdash (? % ?) + [rewrite > divides_to_mod_O + [rewrite < plus_n_O. + apply le_n + |apply (divides_b_true_to_lt_O ? ? ? H2). + apply lt_O_S + |apply divides_b_true_to_divides. + assumption + ] + |apply (divides_b_true_to_lt_O ? ? ? H2). + apply lt_O_S + ] + ] + ] + |apply sigma_p_OZ + ] + ] + |apply lt_O_S + ] + |apply divides_to_divides_b_true + [apply lt_O_S + |apply divides_n_n + ] + ] + ] +qed. + +theorem commutative_dirichlet_product: \forall f,g:nat \to Z.\forall n. O < n \to +dirichlet_product f g n = dirichlet_product g f n. +intros. +unfold dirichlet_product. +apply (trans_eq ? ? + (sigma_p (S n) (\lambda d:nat.divides_b d n) + (\lambda d:nat.g (n/d) * f (n/(n/d))))) + [apply eq_sigma_p1;intros + [reflexivity + |rewrite > div_div + [apply sym_Ztimes. + |assumption + |apply divides_b_true_to_divides. + assumption + ] + ] + |apply (eq_sigma_p_gh ? (\lambda d.(n/d)) (\lambda d.(n/d))) + [intros. + apply divides_b_div_true;assumption + |intros. + apply div_div + [assumption + |apply divides_b_true_to_divides. + assumption + ] + |intros. + apply le_S_S. + apply le_div. + apply (divides_b_true_to_lt_O ? ? H H2) + |intros. + apply divides_b_div_true;assumption + |intros. + apply div_div + [assumption + |apply divides_b_true_to_divides. + assumption + ] + |intros. + apply le_S_S. + apply le_div. + apply (divides_b_true_to_lt_O ? ? H H2) + ] + ] +qed. + +theorem dirichlet_product_is_one_l: +\forall f:nat\to Z.\forall n:nat. +O < n \to dirichlet_product is_one f n = f n. +intros. +rewrite > commutative_dirichlet_product. +apply dirichlet_product_is_one_r. +assumption. +qed. + +theorem dirichlet_product_one_r: +\forall f:nat\to Z.\forall n:nat. O < n \to +dirichlet_product f (\lambda n.Zone) n = +sigma_p (S n) (\lambda d.divides_b d n) f. +intros. +unfold dirichlet_product. +apply eq_sigma_p;intros + [reflexivity + |simplify in \vdash (? ? (? ? %) ?). + apply Ztimes_Zone_r + ] +qed. + +theorem dirichlet_product_one_l: +\forall f:nat\to Z.\forall n:nat. O < n \to +dirichlet_product (\lambda n.Zone) f n = +sigma_p (S n) (\lambda d.divides_b d n) f. +intros. +rewrite > commutative_dirichlet_product + [apply dirichlet_product_one_r. + assumption + |assumption + ] +qed. diff --git a/matita/library/Z/inversion.ma b/matita/library/Z/inversion.ma new file mode 100644 index 000000000..3aa994dfb --- /dev/null +++ b/matita/library/Z/inversion.ma @@ -0,0 +1,101 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "Z/dirichlet_product.ma". +include "Z/moebius.ma". + +definition sigma_div: (nat \to Z) \to nat \to Z \def +\lambda f.\lambda n. sigma_p (S n) (\lambda d.divides_b d n) f. + +theorem sigma_div_moebius: +\forall n:nat. O < n \to sigma_div moebius n = is_one n. +intros.elim H + [reflexivity + |rewrite > is_one_OZ + [unfold sigma_div. + apply sigma_p_moebius. + apply le_S_S. + assumption + |unfold Not.intro. + apply (lt_to_not_eq ? ? H1). + apply injective_S. + apply sym_eq. + assumption + ] + ] +qed. + +(* moebius inversion theorem *) +theorem inversion: \forall f:nat \to Z.\forall n:nat.O < n \to +dirichlet_product moebius (sigma_div f) n = f n. +intros. +rewrite > commutative_dirichlet_product + [apply (trans_eq ? ? (dirichlet_product (dirichlet_product f (\lambda n.Zone)) moebius n)) + [unfold dirichlet_product. + apply eq_sigma_p1;intros + [reflexivity + |apply eq_f2 + [apply sym_eq. + unfold sigma_div. + apply dirichlet_product_one_r. + apply (divides_b_true_to_lt_O ? ? H H2) + |reflexivity + ] + ] + |rewrite > associative_dirichlet_product + [apply (trans_eq ? ? (dirichlet_product f (sigma_div moebius) n)) + [unfold dirichlet_product. + apply eq_sigma_p1;intros + [reflexivity + |apply eq_f2 + [reflexivity + |unfold sigma_div. + apply dirichlet_product_one_l. + apply (lt_times_n_to_lt x) + [apply (divides_b_true_to_lt_O ? ? H H2) + |rewrite > divides_to_div + [assumption + |apply (divides_b_true_to_divides ? ? H2) + ] + ] + ] + ] + |apply (trans_eq ? ? (dirichlet_product f is_one n)) + [unfold dirichlet_product. + apply eq_sigma_p1;intros + [reflexivity + |apply eq_f2 + [reflexivity + |apply sigma_div_moebius. + apply (lt_times_n_to_lt x) + [apply (divides_b_true_to_lt_O ? ? H H2) + |rewrite > divides_to_div + [assumption + |apply (divides_b_true_to_divides ? ? H2) + ] + ] + ] + ] + |apply dirichlet_product_is_one_r + ] + ] + |assumption + ] + ] + |assumption + ] +qed. + \ No newline at end of file diff --git a/matita/library/Z/moebius.ma b/matita/library/Z/moebius.ma new file mode 100644 index 000000000..a82b68e59 --- /dev/null +++ b/matita/library/Z/moebius.ma @@ -0,0 +1,368 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/factorization.ma". +include "Z/sigma_p.ma". + +let rec moebius_aux p n : Z \def + match p with + [ O \Rightarrow pos O + | (S p1) \Rightarrow + match p_ord n (nth_prime p1) with + [ (pair q r) \Rightarrow + match q with + [ O \Rightarrow moebius_aux p1 r + | (S q1) \Rightarrow + match q1 with + [ O \Rightarrow Zopp (moebius_aux p1 r) + | (S q2) \Rightarrow OZ + ] + ] + ] + ] +. + +definition moebius : nat \to Z \def +\lambda n. + let p \def (max n (\lambda p:nat.eqb (n \mod (nth_prime p)) O)) in + moebius_aux (S p) n. + +(* +theorem moebius_O : moebius O = pos O. +simplify. reflexivity. +qed. + +theorem moebius_SO : moebius (S O) = pos O. +simplify.reflexivity. +qed. + +theorem moebius_SSO : moebius (S (S O)) = neg O. +simplify.reflexivity. +qed. + +theorem moebius_SSSO : moebius (S (S (S O))) = neg O. +simplify.reflexivity. +qed. + +theorem moebius_SSSSO : moebius (S (S (S (S O)))) = OZ. +simplify.reflexivity. +qed. +*) + +theorem not_divides_to_eq_moebius_aux: \forall n,p,p1.p \le p1 \to +(\forall i. p \le i \to i \le p1 \to Not (divides (nth_prime i) n)) +\to moebius_aux p n = moebius_aux p1 n. +intros 4. +elim H + [reflexivity + |simplify. + rewrite > not_divides_to_p_ord_O + [simplify.apply H2.intros. + apply H3[assumption|apply le_S.assumption] + |apply H3[assumption|apply le_n_Sn] + ] + ] +qed. + +theorem eq_moebius_moebius_aux: \forall n,p. +max_prime_factor n < p \to p \le n \to +moebius n = moebius_aux p n. +intros. +unfold moebius. +change with +(moebius_aux (S (max n (\lambda p:nat.eqb (n\mod nth_prime p) O))) n += moebius_aux p n). +apply not_divides_to_eq_moebius_aux + [assumption + |intros. + apply divides_b_false_to_not_divides. + unfold divides_b. + apply (lt_max_to_false ? n i) + [assumption + |apply (trans_le ? p)[assumption|assumption] + ] + ] +qed. + +theorem moebius_aux_SO: \forall p.moebius_aux p (S O) = pos O. +intros. +elim p + [simplify.reflexivity + |rewrite < H. + apply sym_eq. + apply not_divides_to_eq_moebius_aux + [apply le_n_Sn + |intros.unfold.intro. + absurd (nth_prime i \le S O) + [apply divides_to_le + [apply le_n|assumption] + |apply lt_to_not_le. + apply lt_SO_nth_prime_n. + ] + ] + ] +qed. + +theorem p_ord_SO_SO_to_moebius : \forall n,p. + (S O) < n \to + p = max_prime_factor n \to + p_ord n (nth_prime p) = pair nat nat (S O) (S O) \to + moebius n = Zopp (pos O). +intros. +change with + (moebius_aux (S (max_prime_factor n)) n = neg O). +rewrite < H1.simplify. +rewrite > H2.simplify. +rewrite > moebius_aux_SO. +reflexivity. +qed. + +theorem p_ord_SO_r_to_moebius1 : \forall n,p,r. + (S O) < n \to + p = max_prime_factor n \to + (S O) < r \to + p_ord n (nth_prime p) = pair nat nat (S O) r \to + moebius n = Zopp (moebius r). +intros. +change with + (moebius_aux (S (max_prime_factor n)) n = -(moebius r)). +rewrite < H1.simplify. +rewrite > H3.simplify. +apply eq_f. +apply sym_eq. +change with + (moebius_aux (S (max_prime_factor r)) r = moebius_aux p r). +apply not_divides_to_eq_moebius_aux + [apply (p_ord_to_lt_max_prime_factor n p (S O) ? ? H1) + [apply (trans_lt ? (S O))[apply lt_O_S|assumption] + |apply sym_eq. assumption + |assumption + ] + |intros. + lapply (decidable_le i r). + elim Hletin + [apply divides_b_false_to_not_divides. + apply (lt_max_to_false ? r i)[assumption|assumption] + |unfold.intro.apply H6. + apply (trans_le ? (nth_prime i)) + [apply lt_to_le. + apply lt_n_nth_prime_n + |apply divides_to_le + [apply (trans_lt ? (S O))[apply lt_O_S|assumption] + |assumption + ] + ] + ] + ] +qed. + +theorem p_ord_SO_r_to_moebius : \forall n,p,r. + (S O) < n \to + p = max_prime_factor n \to + p_ord n (nth_prime p) = pair nat nat (S O) r \to + moebius n = Zopp (moebius r). +intros 5. +apply (nat_case r);intro + [apply False_ind. + apply (p_ord_to_not_eq_O ? ? ? ? H H2). + reflexivity + |apply (nat_case m);intros + [simplify.apply (p_ord_SO_SO_to_moebius ? ? H H1 H2) + |apply (p_ord_SO_r_to_moebius1 ? ? ? H H1 ? H2). + apply le_S_S.apply le_S_S.apply le_O_n + ] + ] +qed. + +theorem p_ord_SSq_r_to_moebius : \forall n,p,q,r. + (S O) < n \to + p = max_prime_factor n \to + p_ord n (nth_prime p) = pair nat nat (S (S q)) r \to + moebius n = OZ. +intros. +change with + (moebius_aux (S (max n (\lambda p:nat.eqb (n\mod nth_prime p) O))) n =OZ). +rewrite < H1.simplify. +rewrite > H2.simplify. +reflexivity. +qed. + +theorem moebius_exp: \forall p,q,r:nat. O < r \to +r = (S O) \lor (max_prime_factor r) < p \to +(* r = (S O) \lor (max r (\lambda p:nat.eqb (r \mod (nth_prime p)) O)) < p \to *) +sigma_p (S (S q)) (\lambda y.true) (\lambda y.moebius (r*(exp (nth_prime p) y))) = O. +intros. +elim q + [rewrite > true_to_sigma_p_Sn + [rewrite > true_to_sigma_p_Sn + [rewrite > Zplus_z_OZ. + rewrite < times_n_SO. + rewrite > (p_ord_SO_r_to_moebius ? p r) + [rewrite > sym_Zplus. + rewrite > Zplus_Zopp. + reflexivity + |rewrite < exp_n_SO. + rewrite > sym_times. + rewrite > times_n_SO. + apply lt_to_le_to_lt_times + [apply lt_SO_nth_prime_n + |assumption + |assumption + ] + |apply eq_p_max + [apply le_n|assumption|assumption] + |apply p_ord_exp1 + [apply lt_O_nth_prime_n + |apply lt_max_prime_factor_to_not_divides;assumption + |apply sym_times + ] + ] + |reflexivity + ] + |reflexivity + ] + |rewrite > true_to_sigma_p_Sn + [rewrite > H2. + rewrite > Zplus_z_OZ. + apply (p_ord_SSq_r_to_moebius ? p n r) + [rewrite > times_n_SO. + rewrite > sym_times in \vdash (? ? %). + apply lt_to_le_to_lt_times + [apply (trans_lt ? (nth_prime p)) + [apply lt_SO_nth_prime_n + |rewrite > exp_n_SO in \vdash (? % ?). + apply lt_exp + [apply lt_SO_nth_prime_n + |apply le_S_S.apply le_S_S.apply le_O_n + ] + ] + |assumption + |assumption + ] + |apply eq_p_max + [apply le_S_S.apply le_O_n|assumption|assumption] + |apply p_ord_exp1 + [apply lt_O_nth_prime_n + |apply lt_max_prime_factor_to_not_divides;assumption + |apply sym_times + ] + ] + |reflexivity + ] + ] +qed. + +theorem sigma_p_moebius1: \forall n,m,p:nat.O < n \to O < m \to +n = (S O) \lor max_prime_factor n < p \to +sigma_p (S (n*(exp (nth_prime p) m))) (\lambda y.divides_b y (n*(exp (nth_prime p) m))) moebius = O. +intros. +rewrite > sigma_p_divides_b + [apply (trans_eq ? ? (sigma_p (S n) (\lambda x:nat.divides_b x n) (\lambda x:nat.OZ))) + [apply eq_sigma_p1 + [intros.reflexivity + |apply (lt_O_n_elim m H1). + intros.apply moebius_exp + [apply (divides_b_true_to_lt_O ? ? ? H4). + assumption + |elim H2 + [left.rewrite > H5 in H3. + elim (le_to_or_lt_eq ? ? (le_S_S_to_le ? ? H3)) + [apply False_ind. + apply (lt_to_not_le O x) + [apply (divides_b_true_to_lt_O n x H H4) + |apply le_S_S_to_le.assumption + ] + |assumption + ] + |right. + apply (le_to_lt_to_lt ? ? ? ? H5). + apply (divides_to_max_prime_factor1 x n) + [apply (divides_b_true_to_lt_O ? ? H H4) + |assumption + |apply divides_b_true_to_divides. + assumption + ] + ] + ] + ] + |generalize in match (\lambda x:nat.divides_b x n). + intro. + elim n + [simplify.elim (f O);reflexivity + |apply (bool_elim ? (f (S n1))) + [intro. + rewrite > true_to_sigma_p_Sn + [rewrite > H3.reflexivity|assumption] + |intro. + rewrite > false_to_sigma_p_Sn + [apply H3|assumption] + ] + ] + ] + |assumption + |apply prime_nth_prime + |apply lt_max_prime_factor_to_not_divides;assumption + ] +qed. + +theorem sigma_p_moebius: \forall n. (S O) < n \to +sigma_p (S n) (\lambda y.divides_b y n) moebius = O. +intros. +lapply (exp_ord (nth_prime (max_prime_factor n)) n) + [rewrite > sym_times in Hletin. + rewrite > Hletin. + apply sigma_p_moebius1 + [apply lt_O_ord_rem + [apply lt_SO_nth_prime_n + |apply lt_to_le.assumption + ] + |unfold lt. + change with + (fst ? ? (pair ? ? (S O) (S O)) \leq ord n (nth_prime (max_prime_factor n))). + rewrite < (p_ord_p (nth_prime (max_prime_factor n))) + [apply (divides_to_le_ord ? (nth_prime (max_prime_factor n)) n) + [apply lt_O_nth_prime_n + |apply lt_to_le.assumption + |apply prime_nth_prime + |apply divides_max_prime_factor_n. + assumption + ] + |apply lt_SO_nth_prime_n + ] + |lapply (lt_O_ord_rem (nth_prime (max_prime_factor n)) n) + [elim (le_to_or_lt_eq ? ? Hletin1) + [right. + apply (p_ord_to_lt_max_prime_factor1 n (max_prime_factor n) + (ord n (nth_prime (max_prime_factor n))) + (ord_rem n (nth_prime (max_prime_factor n)))) + [apply lt_to_le.assumption + |apply le_n + |autobatch + |assumption + ] + |left.apply sym_eq.assumption + ] + |apply lt_SO_nth_prime_n + |apply lt_to_le.assumption + ] + ] + |apply lt_SO_nth_prime_n + |apply lt_to_le.assumption + ] +qed. + + + diff --git a/matita/library/Z/orders.ma b/matita/library/Z/orders.ma new file mode 100644 index 000000000..8802d889c --- /dev/null +++ b/matita/library/Z/orders.ma @@ -0,0 +1,245 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "Z/z.ma". +include "nat/orders.ma". + +definition Zle : Z \to Z \to Prop \def +\lambda x,y:Z. + match x with + [ OZ \Rightarrow + match y with + [ OZ \Rightarrow True + | (pos m) \Rightarrow True + | (neg m) \Rightarrow False ] + | (pos n) \Rightarrow + match y with + [ OZ \Rightarrow False + | (pos m) \Rightarrow n \leq m + | (neg m) \Rightarrow False ] + | (neg n) \Rightarrow + match y with + [ OZ \Rightarrow True + | (pos m) \Rightarrow True + | (neg m) \Rightarrow m \leq n ]]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "integer 'less or equal to'" 'leq x y = (cic:/matita/Z/orders/Zle.con x y). +(*CSC: the URI must disappear: there is a bug now *) +interpretation "integer 'neither less nor equal to'" 'nleq x y = + (cic:/matita/logic/connectives/Not.con (cic:/matita/Z/orders/Zle.con x y)). + +definition Zlt : Z \to Z \to Prop \def +\lambda x,y:Z. + match x with + [ OZ \Rightarrow + match y with + [ OZ \Rightarrow False + | (pos m) \Rightarrow True + | (neg m) \Rightarrow False ] + | (pos n) \Rightarrow + match y with + [ OZ \Rightarrow False + | (pos m) \Rightarrow n Zplus_z_OZ.reflexivity. +elim y.simplify.reflexivity. +simplify. +rewrite < plus_n_Sm. rewrite < plus_n_Sm.rewrite < sym_plus.reflexivity. +simplify. +rewrite > nat_compare_n_m_m_n. +simplify.elim nat_compare.simplify.reflexivity. +simplify. reflexivity. +simplify. reflexivity. +elim y.simplify.reflexivity. +simplify.rewrite > nat_compare_n_m_m_n. +simplify.elim nat_compare.simplify.reflexivity. +simplify. reflexivity. +simplify. reflexivity. +simplify.rewrite < plus_n_Sm. rewrite < plus_n_Sm.rewrite < sym_plus.reflexivity. +qed. + +theorem Zpred_Zplus_neg_O : \forall z:Z. Zpred z = (neg O)+z. +intros.elim z. + simplify.reflexivity. + elim n. + simplify.reflexivity. + simplify.reflexivity. + simplify.reflexivity. +qed. + +theorem Zsucc_Zplus_pos_O : \forall z:Z. Zsucc z = (pos O)+z. +intros.elim z. + simplify.reflexivity. + simplify.reflexivity. + elim n. + simplify.reflexivity. + simplify.reflexivity. +qed. + +theorem Zplus_pos_pos: +\forall n,m. (pos n)+(pos m) = (Zsucc (pos n))+(Zpred (pos m)). +intros. +elim n.elim m. +simplify.reflexivity. +simplify.reflexivity. +elim m. +simplify.rewrite < plus_n_Sm. +rewrite < plus_n_O.reflexivity. +simplify.rewrite < plus_n_Sm. +rewrite < plus_n_Sm.reflexivity. +qed. + +theorem Zplus_pos_neg: +\forall n,m. (pos n)+(neg m) = (Zsucc (pos n))+(Zpred (neg m)). +intros.reflexivity. +qed. + +theorem Zplus_neg_pos : +\forall n,m. (neg n)+(pos m) = (Zsucc (neg n))+(Zpred (pos m)). +intros. +elim n.elim m. +simplify.reflexivity. +simplify.reflexivity. +elim m. +simplify.reflexivity. +simplify.reflexivity. +qed. + +theorem Zplus_neg_neg: +\forall n,m. (neg n)+(neg m) = (Zsucc (neg n))+(Zpred (neg m)). +intros. +elim n.elim m. +simplify.reflexivity. +simplify.reflexivity. +elim m. +simplify.rewrite > plus_n_Sm.reflexivity. +simplify.rewrite > plus_n_Sm.reflexivity. +qed. + +theorem Zplus_Zsucc_Zpred: +\forall x,y. x+y = (Zsucc x)+(Zpred y). +intros.elim x. + elim y. + simplify.reflexivity. + rewrite < Zsucc_Zplus_pos_O.rewrite > Zsucc_Zpred.reflexivity. + simplify.reflexivity. + elim y. + simplify.reflexivity. + apply Zplus_pos_pos. + apply Zplus_pos_neg. + elim y. + rewrite < sym_Zplus.rewrite < (sym_Zplus (Zpred OZ)). + rewrite < Zpred_Zplus_neg_O.rewrite > Zpred_Zsucc.simplify.reflexivity. + apply Zplus_neg_pos. + rewrite < Zplus_neg_neg.reflexivity. +qed. + +theorem Zplus_Zsucc_pos_pos : +\forall n,m. (Zsucc (pos n))+(pos m) = Zsucc ((pos n)+(pos m)). +intros.reflexivity. +qed. + +theorem Zplus_Zsucc_pos_neg: +\forall n,m. (Zsucc (pos n))+(neg m) = (Zsucc ((pos n)+(neg m))). +intros. +apply (nat_elim2 +(\lambda n,m. (Zsucc (pos n))+(neg m) = (Zsucc ((pos n)+(neg m))))).intro. +intros.elim n1. +simplify. reflexivity. +elim n2.simplify. reflexivity. +simplify. reflexivity. +intros. elim n1. +simplify. reflexivity. +simplify.reflexivity. +intros. +rewrite < (Zplus_pos_neg ? m1). +elim H.reflexivity. +qed. + +theorem Zplus_Zsucc_neg_neg : +\forall n,m. Zsucc (neg n) + neg m = Zsucc (neg n + neg m). +intros. +apply (nat_elim2 +(\lambda n,m. Zsucc (neg n) + neg m = Zsucc (neg n + neg m))).intro. +intros.elim n1. +simplify. reflexivity. +elim n2.simplify. reflexivity. +simplify. reflexivity. +intros. elim n1. +simplify. reflexivity. +simplify.reflexivity. +intros. +rewrite < (Zplus_neg_neg ? m1). +reflexivity. +qed. + +theorem Zplus_Zsucc_neg_pos: +\forall n,m. Zsucc (neg n)+(pos m) = Zsucc ((neg n)+(pos m)). +intros. +apply (nat_elim2 +(\lambda n,m. Zsucc (neg n) + (pos m) = Zsucc (neg n + pos m))). +intros.elim n1. +simplify. reflexivity. +elim n2.simplify. reflexivity. +simplify. reflexivity. +intros. elim n1. +simplify. reflexivity. +simplify.reflexivity. +intros. +rewrite < H. +rewrite < (Zplus_neg_pos ? (S m1)). +reflexivity. +qed. + +theorem Zplus_Zsucc : \forall x,y:Z. (Zsucc x)+y = Zsucc (x+y). +intros.elim x. + elim y. + simplify. reflexivity. + simplify.reflexivity. + rewrite < Zsucc_Zplus_pos_O.reflexivity. + elim y. + rewrite < (sym_Zplus OZ).reflexivity. + apply Zplus_Zsucc_pos_pos. + apply Zplus_Zsucc_pos_neg. + elim y. + rewrite < sym_Zplus.rewrite < (sym_Zplus OZ).simplify.reflexivity. + apply Zplus_Zsucc_neg_pos. + apply Zplus_Zsucc_neg_neg. +qed. + +theorem Zplus_Zpred: \forall x,y:Z. (Zpred x)+y = Zpred (x+y). +intros. +cut (Zpred (x+y) = Zpred ((Zsucc (Zpred x))+y)). +rewrite > Hcut. +rewrite > Zplus_Zsucc. +rewrite > Zpred_Zsucc. +reflexivity. +rewrite > Zsucc_Zpred. +reflexivity. +qed. + + +theorem associative_Zplus: associative Z Zplus. +change with (\forall x,y,z:Z. (x + y) + z = x + (y + z)). +(* simplify. *) +intros.elim x. + simplify.reflexivity. + elim n. + rewrite < Zsucc_Zplus_pos_O.rewrite < Zsucc_Zplus_pos_O. + rewrite > Zplus_Zsucc.reflexivity. + rewrite > (Zplus_Zsucc (pos n1)).rewrite > (Zplus_Zsucc (pos n1)). + rewrite > (Zplus_Zsucc ((pos n1)+y)).apply eq_f.assumption. + elim n. + rewrite < (Zpred_Zplus_neg_O (y+z)).rewrite < (Zpred_Zplus_neg_O y). + rewrite < Zplus_Zpred.reflexivity. + rewrite > (Zplus_Zpred (neg n1)).rewrite > (Zplus_Zpred (neg n1)). + rewrite > (Zplus_Zpred ((neg n1)+y)).apply eq_f.assumption. +qed. + +variant assoc_Zplus : \forall x,y,z:Z. (x+y)+z = x+(y+z) +\def associative_Zplus. + +(* Zopp *) +definition Zopp : Z \to Z \def +\lambda x:Z. match x with +[ OZ \Rightarrow OZ +| (pos n) \Rightarrow (neg n) +| (neg n) \Rightarrow (pos n) ]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "integer unary minus" 'uminus x = (cic:/matita/Z/plus/Zopp.con x). + +theorem eq_OZ_Zopp_OZ : OZ = (- OZ). +reflexivity. +qed. + +theorem Zopp_Zplus: \forall x,y:Z. -(x+y) = -x + -y. +intros. +elim x.elim y. +simplify. reflexivity. +simplify. reflexivity. +simplify. reflexivity. +elim y. +simplify. reflexivity. +simplify. reflexivity. +simplify. apply nat_compare_elim. +intro.simplify.reflexivity. +intro.simplify.reflexivity. +intro.simplify.reflexivity. +elim y. +simplify. reflexivity. +simplify. apply nat_compare_elim. +intro.simplify.reflexivity. +intro.simplify.reflexivity. +intro.simplify.reflexivity. +simplify.reflexivity. +qed. + +theorem Zopp_Zopp: \forall x:Z. --x = x. +intro. elim x. +reflexivity.reflexivity.reflexivity. +qed. + +theorem Zplus_Zopp: \forall x:Z. x+ -x = OZ. +intro.elim x. +apply refl_eq. +simplify. +rewrite > nat_compare_n_n. +simplify.apply refl_eq. +simplify. +rewrite > nat_compare_n_n. +simplify.apply refl_eq. +qed. + +theorem injective_Zplus_l: \forall x:Z.injective Z Z (\lambda y.y+x). +intro.simplify.intros (z y). +rewrite < Zplus_z_OZ. +rewrite < (Zplus_z_OZ y). +rewrite < (Zplus_Zopp x). +rewrite < (Zplus_Zopp x). +rewrite < assoc_Zplus. +rewrite < assoc_Zplus. +apply eq_f2 + [assumption|reflexivity] +qed. + +theorem injective_Zplus_r: \forall x:Z.injective Z Z (\lambda y.x+y). +intro.simplify.intros (z y). +apply (injective_Zplus_l x). +rewrite < sym_Zplus. +rewrite > H. +apply sym_Zplus. +qed. + +(* minus *) +definition Zminus : Z \to Z \to Z \def \lambda x,y:Z. x + (-y). + +interpretation "integer minus" 'minus x y = (cic:/matita/Z/plus/Zminus.con x y). diff --git a/matita/library/Z/sigma_p.ma b/matita/library/Z/sigma_p.ma new file mode 100644 index 000000000..9d5ffeb37 --- /dev/null +++ b/matita/library/Z/sigma_p.ma @@ -0,0 +1,823 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "Z/times.ma". +include "nat/primes.ma". +include "nat/ord.ma". +include "nat/generic_iter_p.ma". + +(* sigma_p in Z is a specialization of iter_p_gen *) +definition sigma_p: nat \to (nat \to bool) \to (nat \to Z) \to Z \def +\lambda n, p, g. (iter_p_gen n p Z g OZ Zplus). + +theorem symmetricZPlus: symmetric Z Zplus. +change with (\forall a,b:Z. (Zplus a b) = (Zplus b a)). +intros. +rewrite > sym_Zplus. +reflexivity. +qed. + +theorem true_to_sigma_p_Sn: +\forall n:nat. \forall p:nat \to bool. \forall g:nat \to Z. +p n = true \to sigma_p (S n) p g = +(g n)+(sigma_p n p g). +intros. +unfold sigma_p. +apply true_to_iter_p_gen_Sn. +assumption. +qed. + +theorem false_to_sigma_p_Sn: +\forall n:nat. \forall p:nat \to bool. \forall g:nat \to Z. +p n = false \to sigma_p (S n) p g = sigma_p n p g. +intros. +unfold sigma_p. +apply false_to_iter_p_gen_Sn. +assumption. +qed. + +theorem eq_sigma_p: \forall p1,p2:nat \to bool. +\forall g1,g2: nat \to Z.\forall n. +(\forall x. x < n \to p1 x = p2 x) \to +(\forall x. x < n \to g1 x = g2 x) \to +sigma_p n p1 g1 = sigma_p n p2 g2. +intros. +unfold sigma_p. +apply eq_iter_p_gen; + assumption. +qed. + +theorem eq_sigma_p1: \forall p1,p2:nat \to bool. +\forall g1,g2: nat \to Z.\forall n. +(\forall x. x < n \to p1 x = p2 x) \to +(\forall x. x < n \to p1 x = true \to g1 x = g2 x) \to +sigma_p n p1 g1 = sigma_p n p2 g2. +intros. +unfold sigma_p. +apply eq_iter_p_gen1; + assumption. +qed. + +theorem sigma_p_false: +\forall g: nat \to Z.\forall n.sigma_p n (\lambda x.false) g = O. +intros. +unfold sigma_p. +apply iter_p_gen_false. +qed. + +theorem sigma_p_plus: \forall n,k:nat.\forall p:nat \to bool. +\forall g: nat \to Z. +sigma_p (k+n) p g += sigma_p k (\lambda x.p (x+n)) (\lambda x.g (x+n)) + sigma_p n p g. +intros. +unfold sigma_p. +apply (iter_p_gen_plusA Z n k p g OZ Zplus) +[ apply symmetricZPlus. +| intros. + apply cic:/matita/Z/plus/Zplus_z_OZ.con +| apply associative_Zplus +] +qed. + +theorem false_to_eq_sigma_p: \forall n,m:nat.n \le m \to +\forall p:nat \to bool. +\forall g: nat \to Z. (\forall i:nat. n \le i \to i < m \to +p i = false) \to sigma_p m p g = sigma_p n p g. +intros. +unfold sigma_p. +apply (false_to_eq_iter_p_gen); + assumption. +qed. + +theorem sigma_p2 : +\forall n,m:nat. +\forall p1,p2:nat \to bool. +\forall g: nat \to nat \to Z. +sigma_p (n*m) + (\lambda x.andb (p1 (div x m)) (p2 (mod x m))) + (\lambda x.g (div x m) (mod x m)) = +sigma_p n p1 + (\lambda x.sigma_p m p2 (g x)). +intros. +unfold sigma_p. +apply (iter_p_gen2 n m p1 p2 Z g OZ Zplus) +[ apply symmetricZPlus +| apply associative_Zplus +| intros. + apply Zplus_z_OZ +] +qed. + +(* a stronger, dependent version, required e.g. for dirichlet product *) + +theorem sigma_p2' : +\forall n,m:nat. +\forall p1:nat \to bool. +\forall p2:nat \to nat \to bool. +\forall g: nat \to nat \to Z. +sigma_p (n*m) + (\lambda x.andb (p1 (div x m)) (p2 (div x m) (mod x m))) + (\lambda x.g (div x m) (mod x m)) = +sigma_p n p1 + (\lambda x.sigma_p m (p2 x) (g x)). +intros. +unfold sigma_p. +apply (iter_p_gen2' n m p1 p2 Z g OZ Zplus) +[ apply symmetricZPlus +| apply associative_Zplus +| intros. + apply Zplus_z_OZ +] +qed. + +lemma sigma_p_gi: \forall g: nat \to Z. +\forall n,i.\forall p:nat \to bool.i < n \to p i = true \to +sigma_p n p g = g i + sigma_p n (\lambda x. andb (p x) (notb (eqb x i))) g. +intros. +unfold sigma_p. +apply (iter_p_gen_gi) +[ apply symmetricZPlus +| apply associative_Zplus +| intros. + apply Zplus_z_OZ +| assumption +| assumption +] +qed. + +theorem eq_sigma_p_gh: +\forall g: nat \to Z. +\forall h,h1: nat \to nat.\forall n,n1. +\forall p1,p2:nat \to bool. +(\forall i. i < n \to p1 i = true \to p2 (h i) = true) \to +(\forall i. i < n \to p1 i = true \to h1 (h i) = i) \to +(\forall i. i < n \to p1 i = true \to h i < n1) \to +(\forall j. j < n1 \to p2 j = true \to p1 (h1 j) = true) \to +(\forall j. j < n1 \to p2 j = true \to h (h1 j) = j) \to +(\forall j. j < n1 \to p2 j = true \to h1 j < n) \to +sigma_p n p1 (\lambda x.g(h x)) = sigma_p n1 p2 g. +intros. +unfold sigma_p. +apply (eq_iter_p_gen_gh Z OZ Zplus ? ? ? g h h1 n n1 p1 p2) +[ apply symmetricZPlus +| apply associative_Zplus +| intros. + apply Zplus_z_OZ +| assumption +| assumption +| assumption +| assumption +| assumption +| assumption +] +qed. + + +theorem divides_exp_to_lt_ord:\forall n,m,j,p. O < n \to prime p \to +p \ndivides n \to j \divides n*(exp p m) \to ord j p < S m. +intros. +cut (m = ord (n*(exp p m)) p) + [apply le_S_S. + rewrite > Hcut. + apply divides_to_le_ord + [elim (le_to_or_lt_eq ? ? (le_O_n j)) + [assumption + |apply False_ind. + apply (lt_to_not_eq ? ? H). + elim H3. + rewrite < H4 in H5.simplify in H5. + elim (times_O_to_O ? ? H5) + [apply sym_eq.assumption + |apply False_ind. + apply (not_le_Sn_n O). + rewrite < H6 in \vdash (? ? %). + apply lt_O_exp. + elim H1.apply lt_to_le.assumption + ] + ] + |rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.apply (prime_to_lt_O ? H1)] + |assumption + |assumption + ] + |unfold ord. + rewrite > (p_ord_exp1 p ? m n) + [reflexivity + |apply (prime_to_lt_O ? H1) + |assumption + |apply sym_times + ] + ] +qed. + +theorem divides_exp_to_divides_ord_rem:\forall n,m,j,p. O < n \to prime p \to +p \ndivides n \to j \divides n*(exp p m) \to ord_rem j p \divides n. +intros. +cut (O < j) + [cut (n = ord_rem (n*(exp p m)) p) + [rewrite > Hcut1. + apply divides_to_divides_ord_rem + [assumption + |rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.apply (prime_to_lt_O ? H1)] + |assumption + |assumption + ] + |unfold ord_rem. + rewrite > (p_ord_exp1 p ? m n) + [reflexivity + |apply (prime_to_lt_O ? H1) + |assumption + |apply sym_times + ] + ] + |elim (le_to_or_lt_eq ? ? (le_O_n j)) + [assumption + |apply False_ind. + apply (lt_to_not_eq ? ? H). + elim H3. + rewrite < H4 in H5.simplify in H5. + elim (times_O_to_O ? ? H5) + [apply sym_eq.assumption + |apply False_ind. + apply (not_le_Sn_n O). + rewrite < H6 in \vdash (? ? %). + apply lt_O_exp. + elim H1.apply lt_to_le.assumption + ] + ] + ] +qed. + + +theorem sigma_p_divides_b: +\forall n,m,p:nat.O < n \to prime p \to Not (divides p n) \to +\forall g: nat \to Z. +sigma_p (S (n*(exp p m))) (\lambda x.divides_b x (n*(exp p m))) g = +sigma_p (S n) (\lambda x.divides_b x n) + (\lambda x.sigma_p (S m) (\lambda y.true) (\lambda y.g (x*(exp p y)))). +intros. +unfold sigma_p. +apply (iter_p_gen_divides Z OZ Zplus n m p ? ? ? g) +[ assumption +| assumption +| assumption +| apply symmetricZPlus +| apply associative_Zplus +| intros. + apply Zplus_z_OZ +] +qed. + + +(* sigma_p and Ztimes *) +lemma Ztimes_sigma_pl: \forall z:Z.\forall n:nat.\forall p. \forall f. +z * (sigma_p n p f) = sigma_p n p (\lambda i.z*(f i)). +intros. +apply (distributive_times_plus_iter_p_gen Z Zplus OZ Ztimes n z p f) +[ apply symmetricZPlus +| apply associative_Zplus +| intros. + apply Zplus_z_OZ +| apply symmetric_Ztimes +| apply distributive_Ztimes_Zplus +| intros. + rewrite > (Ztimes_z_OZ a). + reflexivity +] +qed. + +lemma Ztimes_sigma_pr: \forall z:Z.\forall n:nat.\forall p. \forall f. +(sigma_p n p f) * z = sigma_p n p (\lambda i.(f i)*z). +intros. +rewrite < sym_Ztimes. +rewrite > Ztimes_sigma_pl. +apply eq_sigma_p + [intros.reflexivity + |intros.apply sym_Ztimes + ] +qed. + + +theorem sigma_p_knm: +\forall g: nat \to Z. +\forall h2:nat \to nat \to nat. +\forall h11,h12:nat \to nat. +\forall k,n,m. +\forall p1,p21:nat \to bool. +\forall p22:nat \to nat \to bool. +(\forall x. x < k \to p1 x = true \to +p21 (h11 x) = true \land p22 (h11 x) (h12 x) = true +\land h2 (h11 x) (h12 x) = x +\land (h11 x) < n \land (h12 x) < m) \to +(\forall i,j. i < n \to j < m \to p21 i = true \to p22 i j = true \to +p1 (h2 i j) = true \land +h11 (h2 i j) = i \land h12 (h2 i j) = j +\land h2 i j < k) \to +sigma_p k p1 g= +sigma_p n p21 (\lambda x:nat.sigma_p m (p22 x) (\lambda y. g (h2 x y))). +intros. +unfold sigma_p. +unfold sigma_p in \vdash (? ? ? (? ? ? ? (\lambda x:?.%) ? ?)). +apply iter_p_gen_knm + [ apply symmetricZPlus + |apply associative_Zplus + | intro. + apply (Zplus_z_OZ a) + | exact h11 + | exact h12 + | assumption + | assumption + ] +qed. + + +theorem sigma_p2_eq: +\forall g: nat \to nat \to Z. +\forall h11,h12,h21,h22: nat \to nat \to nat. +\forall n1,m1,n2,m2. +\forall p11,p21:nat \to bool. +\forall p12,p22:nat \to nat \to bool. +(\forall i,j. i < n2 \to j < m2 \to p21 i = true \to p22 i j = true \to +p11 (h11 i j) = true \land p12 (h11 i j) (h12 i j) = true +\land h21 (h11 i j) (h12 i j) = i \land h22 (h11 i j) (h12 i j) = j +\land h11 i j < n1 \land h12 i j < m1) \to +(\forall i,j. i < n1 \to j < m1 \to p11 i = true \to p12 i j = true \to +p21 (h21 i j) = true \land p22 (h21 i j) (h22 i j) = true +\land h11 (h21 i j) (h22 i j) = i \land h12 (h21 i j) (h22 i j) = j +\land (h21 i j) < n2 \land (h22 i j) < m2) \to +sigma_p n1 p11 (\lambda x:nat .sigma_p m1 (p12 x) (\lambda y. g x y)) = +sigma_p n2 p21 (\lambda x:nat .sigma_p m2 (p22 x) (\lambda y. g (h11 x y) (h12 x y))). +intros. +unfold sigma_p. +unfold sigma_p in \vdash (? ? (? ? ? ? (\lambda x:?.%) ? ?) ?). +unfold sigma_p in \vdash (? ? ? (? ? ? ? (\lambda x:?.%) ? ?)). + +apply(iter_p_gen_2_eq Z OZ Zplus ? ? ? g h11 h12 h21 h22 n1 m1 n2 m2 p11 p21 p12 p22) +[ apply symmetricZPlus +| apply associative_Zplus +| intro. + apply (Zplus_z_OZ a) +| assumption +| assumption +] +qed. + + + + +(* + + + + + +rewrite < sigma_p2'. +letin ha:= (\lambda x,y.(((h11 x y)*m1) + (h12 x y))). +letin ha12:= (\lambda x.(h21 (x/m1) (x \mod m1))). +letin ha22:= (\lambda x.(h22 (x/m1) (x \mod m1))). + +apply (trans_eq ? ? +(sigma_p n2 p21 (\lambda x:nat. sigma_p m2 (p22 x) + (\lambda y:nat.(g (((h11 x y)*m1+(h12 x y))/m1) (((h11 x y)*m1+(h12 x y))\mod m1)) ) ) )) +[ + apply (sigma_p_knm (\lambda e. (g (e/m1) (e \mod m1))) ha ha12 ha22);intros + [ elim (and_true ? ? H3). + cut(O \lt m1) + [ cut(x/m1 < n1) + [ cut((x \mod m1) < m1) + [ elim (H1 ? ? Hcut1 Hcut2 H4 H5). + elim H6.clear H6. + elim H8.clear H8. + elim H6.clear H6. + elim H8.clear H8. + split + [ split + [ split + [ split + [ assumption + | assumption + ] + | rewrite > H11. + rewrite > H10. + apply sym_eq. + apply div_mod. + assumption + ] + | assumption + ] + | assumption + ] + | apply lt_mod_m_m. + assumption + ] + | apply (lt_times_n_to_lt m1) + [ assumption + | apply (le_to_lt_to_lt ? x) + [ apply (eq_plus_to_le ? ? (x \mod m1)). + apply div_mod. + assumption + | assumption + ] + ] + ] + | apply not_le_to_lt.unfold.intro. + generalize in match H2. + apply (le_n_O_elim ? H6). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n. + ] + | elim (H ? ? H2 H3 H4 H5). + elim H6.clear H6. + elim H8.clear H8. + elim H6.clear H6. + elim H8.clear H8. + cut(((h11 i j)*m1 + (h12 i j))/m1 = (h11 i j)) + [ cut(((h11 i j)*m1 + (h12 i j)) \mod m1 = (h12 i j)) + [ split + [ split + [ split + [ apply true_to_true_to_andb_true + [ rewrite > Hcut. + assumption + | rewrite > Hcut1. + rewrite > Hcut. + assumption + ] + | rewrite > Hcut1. + rewrite > Hcut. + assumption + ] + | rewrite > Hcut1. + rewrite > Hcut. + assumption + ] + | cut(O \lt m1) + [ cut(O \lt n1) + [ apply (lt_to_le_to_lt ? ((h11 i j)*m1 + m1) ) + [ apply (lt_plus_r). + assumption + | rewrite > sym_plus. + rewrite > (sym_times (h11 i j) m1). + rewrite > times_n_Sm. + rewrite > sym_times. + apply (le_times_l). + assumption + ] + | apply not_le_to_lt.unfold.intro. + generalize in match H9. + apply (le_n_O_elim ? H8). + apply le_to_not_lt. + apply le_O_n + ] + | apply not_le_to_lt.unfold.intro. + generalize in match H7. + apply (le_n_O_elim ? H8). + apply le_to_not_lt. + apply le_O_n + ] + ] + | rewrite > (mod_plus_times m1 (h11 i j) (h12 i j)). + reflexivity. + assumption + ] + | rewrite > (div_plus_times m1 (h11 i j) (h12 i j)). + reflexivity. + assumption + ] + ] +| apply (eq_sigma_p1) + [ intros. reflexivity + | intros. + apply (eq_sigma_p1) + [ intros. reflexivity + | intros. + rewrite > (div_plus_times) + [ rewrite > (mod_plus_times) + [ reflexivity + | elim (H x x1 H2 H4 H3 H5). + assumption + ] + | elim (H x x1 H2 H4 H3 H5). + assumption + ] + ] + ] +] +qed. + +rewrite < sigma_p2' in \vdash (? ? ? %). +apply sym_eq. +letin h := (\lambda x.(h11 (x/m2) (x\mod m2))*m1 + (h12 (x/m2) (x\mod m2))). +letin h1 := (\lambda x.(h21 (x/m1) (x\mod m1))*m2 + (h22 (x/m1) (x\mod m1))). +apply (trans_eq ? ? + (sigma_p (n2*m2) (\lambda x:nat.p21 (x/m2)\land p22 (x/m2) (x\mod m2)) + (\lambda x:nat.g ((h x)/m1) ((h x)\mod m1)))) + [clear h.clear h1. + apply eq_sigma_p1 + [intros.reflexivity + |intros. + cut (O < m2) + [cut (x/m2 < n2) + [cut (x \mod m2 < m2) + [elim (and_true ? ? H3). + elim (H ? ? Hcut1 Hcut2 H4 H5). + elim H6.clear H6. + elim H8.clear H8. + elim H6.clear H6. + elim H8.clear H8. + apply eq_f2 + [apply sym_eq. + apply div_plus_times. + assumption + | + apply sym_eq. + apply mod_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m2) + [assumption + |apply (le_to_lt_to_lt ? x) + [apply (eq_plus_to_le ? ? (x \mod m2)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H2. + apply (le_n_O_elim ? H4). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + ] + |apply (eq_sigma_p_gh ? h h1);intros + [cut (O < m2) + [cut (i/m2 < n2) + [cut (i \mod m2 < m2) + [elim (and_true ? ? H3). + elim (H ? ? Hcut1 Hcut2 H4 H5). + elim H6.clear H6. + elim H8.clear H8. + elim H6.clear H6. + elim H8.clear H8. + cut ((h11 (i/m2) (i\mod m2)*m1+h12 (i/m2) (i\mod m2))/m1 = + h11 (i/m2) (i\mod m2)) + [cut ((h11 (i/m2) (i\mod m2)*m1+h12 (i/m2) (i\mod m2))\mod m1 = + h12 (i/m2) (i\mod m2)) + [rewrite > Hcut3. + rewrite > Hcut4. + rewrite > H6. + rewrite > H12. + reflexivity + |apply mod_plus_times. + assumption + ] + |apply div_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m2) + [assumption + |apply (le_to_lt_to_lt ? i) + [apply (eq_plus_to_le ? ? (i \mod m2)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H2. + apply (le_n_O_elim ? H4). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m2) + [cut (i/m2 < n2) + [cut (i \mod m2 < m2) + [elim (and_true ? ? H3). + elim (H ? ? Hcut1 Hcut2 H4 H5). + elim H6.clear H6. + elim H8.clear H8. + elim H6.clear H6. + elim H8.clear H8. + cut ((h11 (i/m2) (i\mod m2)*m1+h12 (i/m2) (i\mod m2))/m1 = + h11 (i/m2) (i\mod m2)) + [cut ((h11 (i/m2) (i\mod m2)*m1+h12 (i/m2) (i\mod m2))\mod m1 = + h12 (i/m2) (i\mod m2)) + [rewrite > Hcut3. + rewrite > Hcut4. + rewrite > H10. + rewrite > H11. + apply sym_eq. + apply div_mod. + assumption + |apply mod_plus_times. + assumption + ] + |apply div_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m2) + [assumption + |apply (le_to_lt_to_lt ? i) + [apply (eq_plus_to_le ? ? (i \mod m2)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H2. + apply (le_n_O_elim ? H4). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m2) + [cut (i/m2 < n2) + [cut (i \mod m2 < m2) + [elim (and_true ? ? H3). + elim (H ? ? Hcut1 Hcut2 H4 H5). + elim H6.clear H6. + elim H8.clear H8. + elim H6.clear H6. + elim H8.clear H8. + apply lt_times_plus_times + [assumption|assumption] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m2) + [assumption + |apply (le_to_lt_to_lt ? i) + [apply (eq_plus_to_le ? ? (i \mod m2)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H2. + apply (le_n_O_elim ? H4). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m1) + [cut (j/m1 < n1) + [cut (j \mod m1 < m1) + [elim (and_true ? ? H3). + elim (H1 ? ? Hcut1 Hcut2 H4 H5). + elim H6.clear H6. + elim H8.clear H8. + elim H6.clear H6. + elim H8.clear H8. + cut ((h21 (j/m1) (j\mod m1)*m2+h22 (j/m1) (j\mod m1))/m2 = + h21 (j/m1) (j\mod m1)) + [cut ((h21 (j/m1) (j\mod m1)*m2+h22 (j/m1) (j\mod m1))\mod m2 = + h22 (j/m1) (j\mod m1)) + [rewrite > Hcut3. + rewrite > Hcut4. + rewrite > H6. + rewrite > H12. + reflexivity + |apply mod_plus_times. + assumption + ] + |apply div_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m1) + [assumption + |apply (le_to_lt_to_lt ? j) + [apply (eq_plus_to_le ? ? (j \mod m1)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H2. + apply (le_n_O_elim ? H4). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m1) + [cut (j/m1 < n1) + [cut (j \mod m1 < m1) + [elim (and_true ? ? H3). + elim (H1 ? ? Hcut1 Hcut2 H4 H5). + elim H6.clear H6. + elim H8.clear H8. + elim H6.clear H6. + elim H8.clear H8. + cut ((h21 (j/m1) (j\mod m1)*m2+h22 (j/m1) (j\mod m1))/m2 = + h21 (j/m1) (j\mod m1)) + [cut ((h21 (j/m1) (j\mod m1)*m2+h22 (j/m1) (j\mod m1))\mod m2 = + h22 (j/m1) (j\mod m1)) + [rewrite > Hcut3. + rewrite > Hcut4. + rewrite > H10. + rewrite > H11. + apply sym_eq. + apply div_mod. + assumption + |apply mod_plus_times. + assumption + ] + |apply div_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m1) + [assumption + |apply (le_to_lt_to_lt ? j) + [apply (eq_plus_to_le ? ? (j \mod m1)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H2. + apply (le_n_O_elim ? H4). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m1) + [cut (j/m1 < n1) + [cut (j \mod m1 < m1) + [elim (and_true ? ? H3). + elim (H1 ? ? Hcut1 Hcut2 H4 H5). + elim H6.clear H6. + elim H8.clear H8. + elim H6.clear H6. + elim H8.clear H8. + apply (lt_times_plus_times ? ? ? m2) + [assumption|assumption] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m1) + [assumption + |apply (le_to_lt_to_lt ? j) + [apply (eq_plus_to_le ? ? (j \mod m1)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H2. + apply (le_n_O_elim ? H4). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + ] + ] +qed. +*) + + diff --git a/matita/library/Z/times.ma b/matita/library/Z/times.ma new file mode 100644 index 000000000..f9ffc7a47 --- /dev/null +++ b/matita/library/Z/times.ma @@ -0,0 +1,253 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/lt_arith.ma". +include "Z/plus.ma". + +definition Ztimes :Z \to Z \to Z \def +\lambda x,y. + match x with + [ OZ \Rightarrow OZ + | (pos m) \Rightarrow + match y with + [ OZ \Rightarrow OZ + | (pos n) \Rightarrow (pos (pred ((S m) * (S n)))) + | (neg n) \Rightarrow (neg (pred ((S m) * (S n))))] + | (neg m) \Rightarrow + match y with + [ OZ \Rightarrow OZ + | (pos n) \Rightarrow (neg (pred ((S m) * (S n)))) + | (neg n) \Rightarrow (pos (pred ((S m) * (S n))))]]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "integer times" 'times x y = (cic:/matita/Z/times/Ztimes.con x y). + +theorem Ztimes_z_OZ: \forall z:Z. z*OZ = OZ. +intro.elim z. +simplify.reflexivity. +simplify.reflexivity. +simplify.reflexivity. +qed. + +definition Zone \def pos O. + +theorem Ztimes_neg_Zopp: \forall n:nat.\forall x:Z. +neg n * x = - (pos n * x). +intros.elim x. +simplify.reflexivity. +simplify.reflexivity. +simplify.reflexivity. +qed. + +theorem symmetric_Ztimes : symmetric Z Ztimes. +change with (\forall x,y:Z. x*y = y*x). +intros.elim x.rewrite > Ztimes_z_OZ.reflexivity. +elim y.simplify.reflexivity. +change with (pos (pred ((S n) * (S n1))) = pos (pred ((S n1) * (S n)))). +rewrite < sym_times.reflexivity. +change with (neg (pred ((S n) * (S n1))) = neg (pred ((S n1) * (S n)))). +rewrite < sym_times.reflexivity. +elim y.simplify.reflexivity. +change with (neg (pred ((S n) * (S n1))) = neg (pred ((S n1) * (S n)))). +rewrite < sym_times.reflexivity. +change with (pos (pred ((S n) * (S n1))) = pos (pred ((S n1) * (S n)))). +rewrite < sym_times.reflexivity. +qed. + +variant sym_Ztimes : \forall x,y:Z. x*y = y*x +\def symmetric_Ztimes. + +theorem Ztimes_Zone_l: \forall z:Z. Ztimes Zone z = z. +intro.unfold Zone.simplify. +elim z;simplify + [reflexivity + |rewrite < plus_n_O.reflexivity + |rewrite < plus_n_O.reflexivity + ] +qed. + +theorem Ztimes_Zone_r: \forall z:Z. Ztimes z Zone = z. +intro. +rewrite < sym_Ztimes. +apply Ztimes_Zone_l. +qed. + +theorem associative_Ztimes: associative Z Ztimes. +unfold associative. +intros.elim x. + simplify.reflexivity. + elim y. + simplify.reflexivity. + elim z. + simplify.reflexivity. + change with + (pos (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + pos (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred.rewrite < S_pred.rewrite < assoc_times.reflexivity. + apply lt_O_times_S_S.apply lt_O_times_S_S. + change with + (neg (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + neg (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred.rewrite < S_pred.rewrite < assoc_times.reflexivity. + apply lt_O_times_S_S.apply lt_O_times_S_S. + elim z. + simplify.reflexivity. + change with + (neg (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + neg (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred.rewrite < S_pred.rewrite < assoc_times.reflexivity. + apply lt_O_times_S_S.apply lt_O_times_S_S. + change with + (pos (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + pos(pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred.rewrite < S_pred.rewrite < assoc_times.reflexivity. + apply lt_O_times_S_S.apply lt_O_times_S_S. + elim y. + simplify.reflexivity. + elim z. + simplify.reflexivity. + change with + (neg (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + neg (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred.rewrite < S_pred.rewrite < assoc_times.reflexivity. + apply lt_O_times_S_S.apply lt_O_times_S_S. + change with + (pos (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + pos (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred.rewrite < S_pred.rewrite < assoc_times.reflexivity. + apply lt_O_times_S_S.apply lt_O_times_S_S. + elim z. + simplify.reflexivity. + change with + (pos (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + pos (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred.rewrite < S_pred.rewrite < assoc_times.reflexivity. + apply lt_O_times_S_S.apply lt_O_times_S_S. + change with + (neg (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + neg(pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred.rewrite < S_pred.rewrite < assoc_times.reflexivity. + apply lt_O_times_S_S.apply lt_O_times_S_S. +qed. + +variant assoc_Ztimes : \forall x,y,z:Z. +(x * y) * z = x * (y * z) \def +associative_Ztimes. + +lemma times_minus1: \forall n,p,q:nat. lt q p \to +(S n) * (S (pred ((S p) - (S q)))) = +pred ((S n) * (S p)) - pred ((S n) * (S q)). +intros. +rewrite < S_pred. +rewrite > minus_pred_pred. +rewrite < distr_times_minus. +reflexivity. +(* we now close all positivity conditions *) +apply lt_O_times_S_S. +apply lt_O_times_S_S. +simplify.unfold lt. +apply le_SO_minus. exact H. +qed. + +lemma Ztimes_Zplus_pos_neg_pos: \forall n,p,q:nat. +(pos n)*((neg p)+(pos q)) = (pos n)*(neg p)+ (pos n)*(pos q). +intros. +simplify. +change in match (p + n * (S p)) with (pred ((S n) * (S p))). +change in match (q + n * (S q)) with (pred ((S n) * (S q))). +rewrite < nat_compare_pred_pred. +rewrite < nat_compare_times_l. +rewrite < nat_compare_S_S. +apply (nat_compare_elim p q). +intro. +(* uff *) +change with (pos (pred ((S n) * (S (pred ((S q) - (S p)))))) = + pos (pred ((pred ((S n) * (S q))) - (pred ((S n) * (S p)))))). +rewrite < (times_minus1 n q p H).reflexivity. +intro.rewrite < H.simplify.reflexivity. +intro. +change with (neg (pred ((S n) * (S (pred ((S p) - (S q)))))) = + neg (pred ((pred ((S n) * (S p))) - (pred ((S n) * (S q)))))). +rewrite < (times_minus1 n p q H).reflexivity. +(* two more positivity conditions from nat_compare_pred_pred *) +apply lt_O_times_S_S. +apply lt_O_times_S_S. +qed. + +lemma Ztimes_Zplus_pos_pos_neg: \forall n,p,q:nat. +(pos n)*((pos p)+(neg q)) = (pos n)*(pos p)+ (pos n)*(neg q). +intros. +rewrite < sym_Zplus. +rewrite > Ztimes_Zplus_pos_neg_pos. +apply sym_Zplus. +qed. + +lemma distributive2_Ztimes_pos_Zplus: +distributive2 nat Z (\lambda n,z. (pos n) * z) Zplus. +change with (\forall n,y,z. +(pos n) * (y + z) = (pos n) * y + (pos n) * z). +intros.elim y. + reflexivity. + elim z. + reflexivity. + change with + (pos (pred ((S n) * ((S n1) + (S n2)))) = + pos (pred ((S n) * (S n1) + (S n) * (S n2)))). + rewrite < distr_times_plus.reflexivity. + apply Ztimes_Zplus_pos_pos_neg. + elim z. + reflexivity. + apply Ztimes_Zplus_pos_neg_pos. + change with + (neg (pred ((S n) * ((S n1) + (S n2)))) = + neg (pred ((S n) * (S n1) + (S n) * (S n2)))). + rewrite < distr_times_plus.reflexivity. +qed. + +variant distr_Ztimes_Zplus_pos: \forall n,y,z. +(pos n) * (y + z) = ((pos n) * y + (pos n) * z) \def +distributive2_Ztimes_pos_Zplus. + +lemma distributive2_Ztimes_neg_Zplus : +distributive2 nat Z (\lambda n,z. (neg n) * z) Zplus. +change with (\forall n,y,z. +(neg n) * (y + z) = (neg n) * y + (neg n) * z). +intros. +rewrite > Ztimes_neg_Zopp. +rewrite > distr_Ztimes_Zplus_pos. +rewrite > Zopp_Zplus. +rewrite < Ztimes_neg_Zopp. rewrite < Ztimes_neg_Zopp. +reflexivity. +qed. + +variant distr_Ztimes_Zplus_neg: \forall n,y,z. +(neg n) * (y + z) = (neg n) * y + (neg n) * z \def +distributive2_Ztimes_neg_Zplus. + +theorem distributive_Ztimes_Zplus: distributive Z Ztimes Zplus. +change with (\forall x,y,z:Z. x * (y + z) = x*y + x*z). +intros.elim x. +(* case x = OZ *) +simplify.reflexivity. +(* case x = pos n *) +apply distr_Ztimes_Zplus_pos. +(* case x = neg n *) +apply distr_Ztimes_Zplus_neg. +qed. + +variant distr_Ztimes_Zplus: \forall x,y,z. +x * (y + z) = x*y + x*z \def +distributive_Ztimes_Zplus. diff --git a/matita/library/Z/z.ma b/matita/library/Z/z.ma new file mode 100644 index 000000000..a08fcd87e --- /dev/null +++ b/matita/library/Z/z.ma @@ -0,0 +1,180 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "datatypes/bool.ma". +include "nat/nat.ma". + +inductive Z : Set \def + OZ : Z +| pos : nat \to Z +| neg : nat \to Z. + +definition Z_of_nat \def +\lambda n. match n with +[ O \Rightarrow OZ +| (S n)\Rightarrow pos n]. + +coercion cic:/matita/Z/z/Z_of_nat.con. + +definition neg_Z_of_nat \def +\lambda n. match n with +[ O \Rightarrow OZ +| (S n)\Rightarrow neg n]. + +lemma pos_n_eq_S_n : \forall n : nat. + (pos n) = (S n). +intro.reflexivity. +qed. + +definition abs \def +\lambda z. + match z with +[ OZ \Rightarrow O +| (pos n) \Rightarrow (S n) +| (neg n) \Rightarrow (S n)]. + +definition OZ_test \def +\lambda z. +match z with +[ OZ \Rightarrow true +| (pos n) \Rightarrow false +| (neg n) \Rightarrow false]. + +theorem OZ_test_to_Prop :\forall z:Z. +match OZ_test z with +[true \Rightarrow z=OZ +|false \Rightarrow z \neq OZ]. +intros.elim z. +simplify.reflexivity. +simplify. unfold Not. intros (H). +destruct H. +simplify. unfold Not. intros (H). +destruct H. +qed. + +(* discrimination *) +theorem injective_pos: injective nat Z pos. +unfold injective. +intros. +apply inj_S. +change with (abs (pos x) = abs (pos y)). +apply eq_f.assumption. +qed. + +variant inj_pos : \forall n,m:nat. pos n = pos m \to n = m +\def injective_pos. + +theorem injective_neg: injective nat Z neg. +unfold injective. +intros. +apply inj_S. +change with (abs (neg x) = abs (neg y)). +apply eq_f.assumption. +qed. + +variant inj_neg : \forall n,m:nat. neg n = neg m \to n = m +\def injective_neg. + +theorem not_eq_OZ_pos: \forall n:nat. OZ \neq pos n. +unfold Not.intros (n H). +destruct H. +qed. + +theorem not_eq_OZ_neg :\forall n:nat. OZ \neq neg n. +unfold Not.intros (n H). +destruct H. +qed. + +theorem not_eq_pos_neg :\forall n,m:nat. pos n \neq neg m. +unfold Not.intros (n m H). +destruct H. +qed. + +theorem decidable_eq_Z : \forall x,y:Z. decidable (x=y). +intros.unfold decidable. +elim x. +(* goal: x=OZ *) + elim y. + (* goal: x=OZ y=OZ *) + left.reflexivity. + (* goal: x=OZ 2=2 *) + right.apply not_eq_OZ_pos. + (* goal: x=OZ 2=3 *) + right.apply not_eq_OZ_neg. +(* goal: x=pos *) + elim y. + (* goal: x=pos y=OZ *) + right.unfold Not.intro. + apply (not_eq_OZ_pos n). symmetry. assumption. + (* goal: x=pos y=pos *) + elim (decidable_eq_nat n n1:((n=n1) \lor ((n=n1) \to False))). + left.apply eq_f.assumption. + right.unfold Not.intros (H_inj).apply H. destruct H_inj. reflexivity. + (* goal: x=pos y=neg *) + right.unfold Not.intro.apply (not_eq_pos_neg n n1). assumption. +(* goal: x=neg *) + elim y. + (* goal: x=neg y=OZ *) + right.unfold Not.intro. + apply (not_eq_OZ_neg n). symmetry. assumption. + (* goal: x=neg y=pos *) + right. unfold Not.intro. apply (not_eq_pos_neg n1 n). symmetry. assumption. + (* goal: x=neg y=neg *) + elim (decidable_eq_nat n n1:((n=n1) \lor ((n=n1) \to False))). + left.apply eq_f.assumption. + right.unfold Not.intro.apply H.apply injective_neg.assumption. +qed. + +(* end discrimination *) + +definition Zsucc \def +\lambda z. match z with +[ OZ \Rightarrow pos O +| (pos n) \Rightarrow pos (S n) +| (neg n) \Rightarrow + match n with + [ O \Rightarrow OZ + | (S p) \Rightarrow neg p]]. + +definition Zpred \def +\lambda z. match z with +[ OZ \Rightarrow neg O +| (pos n) \Rightarrow + match n with + [ O \Rightarrow OZ + | (S p) \Rightarrow pos p] +| (neg n) \Rightarrow neg (S n)]. + +theorem Zpred_Zsucc: \forall z:Z. Zpred (Zsucc z) = z. +intros. +elim z. + reflexivity. + reflexivity. + elim n. + reflexivity. + reflexivity. +qed. + +theorem Zsucc_Zpred: \forall z:Z. Zsucc (Zpred z) = z. +intros. +elim z. + reflexivity. + elim n. + reflexivity. + reflexivity. + reflexivity. +qed. + diff --git a/matita/library/algebra/CoRN/SemiGroups.ma b/matita/library/algebra/CoRN/SemiGroups.ma new file mode 100644 index 000000000..149e4b972 --- /dev/null +++ b/matita/library/algebra/CoRN/SemiGroups.ma @@ -0,0 +1,400 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +(* $Id: CSemiGroups.v,v 1.10 2004/09/24 15:30:34 loeb Exp $ *) +(* printing [+] %\ensuremath+% #+# *) +(* printing {+} %\ensuremath+% #+# *) + +(* Require Export CSetoidInc. *) + +(* Begin_SpecReals *) + + +include "algebra/CoRN/SetoidInc.ma". + +(*------------------------------------------------------------------*) +(* Semigroups - Definition of the notion of Constructive Semigroup *) +(*------------------------------------------------------------------*) + +definition is_CSemiGroup : \forall A : CSetoid. \forall op: CSetoid_bin_op A. Prop \def +\lambda A : CSetoid. \lambda op: CSetoid_bin_op A. CSassociative A (csbf_fun A A A op). + +record CSemiGroup : Type \def + {csg_crr :> CSetoid; + csg_op : CSetoid_bin_op csg_crr; + csg_proof : is_CSemiGroup csg_crr csg_op}. + +(* +Implicit Arguments csg_op [c]. +Infix "[+]" := csg_op (at level 50, left associativity). +End_SpecReals *) + + + +(*--------------------------------------------------------------*) +(* Semigroup axioms - The axiomatic properties of a semi group *) +(*--------------------------------------------------------------*) +(* Variable G : CSemiGroup. *) + +lemma CSemiGroup_is_CSemiGroup : \forall G : CSemiGroup. is_CSemiGroup (csg_crr G) (csg_op G). +intro. +elim G. simplify. exact H. +qed. +(* CoRN +Lemma CSemiGroup_is_CSemiGroup : is_CSemiGroup G csg_op.*) + +lemma plus_assoc : \forall G : CSemiGroup. +CSassociative G (csbf_fun G G G (csg_op G)). +exact CSemiGroup_is_CSemiGroup. +qed. + +(*--------------------------------------------------------------*) +(* Semigroup basics *) +(*--------------------------------------------------------------*) + +lemma plus_assoc_unfolded : \forall G : CSemiGroup. \forall x,y,z : ?. + (csbf_fun G G G (csg_op G) x (csbf_fun G G G (csg_op G) y z)) = + (csbf_fun G G G (csg_op G) (csbf_fun G G G (csg_op G) x y) z). + intros. + apply plus_assoc. +qed. + +(* Section p71R1. *) + +(* Morphism +%\begin{convention}% +Let [S1 S2:CSemiGroup]. +%\end{convention}% +*) + +(* Variable S1:CSemiGroup. +Variable S2:CSemiGroup. *) + +definition morphism_of_CSemiGroups: \forall S1,S2: CSemiGroup. \forall f: CSetoid_fun S1 S2. + Prop \def + \lambda S1,S2: CSemiGroup. \lambda f: CSetoid_fun S1 S2. + (\forall a,b:S1. (csf_fun S1 S2 f (csbf_fun ? ? ? (csg_op ?) a b)) = + (csbf_fun ? ? ? (csg_op ?) (csf_fun S1 S2 f a) (csf_fun S1 S2 f b))). + +(* End p71R1. *) + +(* About the unit *) + +(* Zero ????? *) + +definition is_rht_unit: \forall S: CSemiGroup. \forall op : CSetoid_bin_op S. \forall Zero: ?. Prop + \def + \lambda S: CSemiGroup. \lambda op : CSetoid_bin_op S. \lambda Zero: ?. + \forall x:?. (csbf_fun ? ? ? op x Zero) = x. + +(* Definition is_rht_unit S (op : CSetoid_bin_op S) Zero : Prop := forall x, op x Zero [=] x. *) + +(* End_SpecReals *) + +definition is_lft_unit: \forall S: CSemiGroup. \forall op : CSetoid_bin_op S. \forall Zero: ?. Prop + \def + \lambda S: CSemiGroup. \lambda op : CSetoid_bin_op S. \lambda Zero: ?. + \forall x:?. (csbf_fun ? ? ? op Zero x) = x. + + +(* Implicit Arguments is_lft_unit [S]. *) + +(* Begin_SpecReals *) + +(* Implicit Arguments is_rht_unit [S]. *) + +(* An alternative definition: +*) + +definition is_unit: \forall S:CSemiGroup. S \to Prop \def +\lambda S:CSemiGroup. +\lambda e. (\forall (a:S). (csbf_fun ? ? ? (csg_op ?) e a) = a \and (csbf_fun ? ? ? (csg_op ?) a e) + = a). + +lemma cs_unique_unit : \forall S:CSemiGroup. \forall e,f:S. +(is_unit S e) \and (is_unit S f) \to e = f. +intros 3 (S e f). +unfold is_unit. +intro H. +elim H 0. +clear H. +intros (H0 H1). +elim (H0 f) 0. +clear H0. +intros (H2 H3). +elim (H1 e) 0. +clear H1. +intros (H4 H5). +autobatch new. +qed. +(* +astepr (e[+]f). +astepl (e[+]f). +apply eq_reflexive. +Qed. +*) + +(* End_SpecReals *) + +(* Hint Resolve plus_assoc_unfolded: algebra. *) + +(* Functional operations +We can also define a similar addition operator, which will be denoted by [{+}], on partial functions. + +%\begin{convention}% Whenever possible, we will denote the functional construction corresponding to an algebraic operation by the same symbol enclosed in curly braces. +%\end{convention}% + +At this stage, we will always consider autobatchmorphisms; we %{\em %could%}% treat this in a more general setting, but we feel that it wouldn't really be a useful effort. + +%\begin{convention}% Let [G:CSemiGroup] and [F,F':(PartFunct G)] and denote by [P] and [Q], respectively, the predicates characterizing their domains. +%\end{convention}% +*) + +(* Section Part_Function_Plus. *) + +(* Variable G : CSemiGroup. +Variables F F' : PartFunct G. *) + +(* begin hide *) +(*Let P := Dom F. +Let Q := Dom F'.*) +(* end hide *) +definition NP : \forall G:CSemiGroup. \forall F,F': PartFunct G. ? \def + \lambda G:CSemiGroup. \lambda F,F': PartFunct G. + pfdom ? F. +definition NQ : \forall G:CSemiGroup. \forall F,F': PartFunct G. ? \def + \lambda G:CSemiGroup. \lambda F,F': PartFunct G. + pfdom ? F'. + +lemma part_function_plus_strext : \forall G:CSemiGroup. \forall F,F': PartFunct G. +\forall x, y:G. \forall Hx : conjP G (pfdom G F) (pfdom G F') x. +\forall Hy : conjP G (pfdom G F) (pfdom G F') y. +(csbf_fun ? ? ? (csg_op G) (pfpfun ? F x (prj1 G (pfdom G F) (pfdom G F') x Hx)) + (pfpfun ? F' x (prj2 G (pfdom G F) (pfdom G F') x Hx))) + \neq (csbf_fun ? ? ? (csg_op G) (pfpfun ? F y (prj1 G (pfdom G F) (pfdom G F') y Hy)) + (pfpfun ? F' y (prj2 G (pfdom G F) (pfdom G F') y Hy))) + \to x \neq y. +intros (G F F' x y Hx Hy H). +elim (bin_op_strext_unfolded ? ? ? ? ? ? H)[ +apply pfstrx[apply F|elim Hx.apply t|elim Hy.apply t|exact H1]| +apply pfstrx[apply F'|elim Hx.apply t1|elim Hy.apply t1|exact H1]] +qed. + +definition Fplus : \forall G:CSemiGroup. \forall F,F': PartFunct G. ? \def + \lambda G:CSemiGroup. \lambda F,F': PartFunct G. +mk_PartFunct G ? (conj_wd ? ? ? (dom_wd ? F) (dom_wd ? F')) + (\lambda x,Hx. (csbf_fun ? ? ? (csg_op ?) + (pfpfun ? F x (prj1 ? ? ? ? Hx)) (pfpfun ? F' x (prj2 ? ? ? ? Hx)))) + (part_function_plus_strext G F F'). + +(* +%\begin{convention}% Let [R:G->CProp]. +%\end{convention}% +*) + +(* Variable R : G -> CProp. *) + +lemma included_FPlus : \forall G:CSemiGroup. \forall R : G \to Type. \forall F,F': PartFunct G. +included ? R (NP G F F' ) -> included ? R (NQ G F F') \to included ? R (pfdom ? (Fplus G F F')). +intros; unfold Fplus;simplify. apply included_conj; assumption. +qed. + +lemma included_FPlus' : \forall G:CSemiGroup. \forall R : G \to Type. \forall F,F': PartFunct G. + included ? R (pfdom ? (Fplus G F F')) \to included ? R (NP G F F'). +intros. unfold Fplus in i. simplify in i; unfold NP. + apply (included_conj_lft ? ? ? ? i); apply H. +qed. + +lemma included_FPlus'' : \forall G:CSemiGroup. \forall R : G \to Type. \forall F,F': PartFunct G. + included ? R (pfdom ? (Fplus G F F')) -> included ? R (NQ G F F'). +intros (G R F F'H); unfold Fplus in H. simplify in H; +unfold NQ. apply (included_conj_rht ? (pfdom G F)); apply H. +qed. + +(* End Part_Function_Plus. *) + +(* Implicit Arguments Fplus [G]. +Infix "{+}" := Fplus (at level 50, left associativity). + +Hint Resolve included_FPlus : included. + +Hint Immediate included_FPlus' included_FPlus'' : included. +*) + +(* Subsemigroups +%\begin{convention}% +Let [csg] a semi-group and [P] a non-empty +predicate on the semi-group which is preserved by [[+]]. +%\end{convention}% +*) + +(* Section SubCSemiGroups. *) + +(* Variable csg : CSemiGroup. + Variable P : csg -> CProp. + Variable op_pres_P : bin_op_pres_pred _ P csg_op. *) + +definition subcrr : \forall csg: CSemiGroup. \forall P : csg -> Prop. CSetoid \def + \lambda csg: CSemiGroup. \lambda P : csg -> Prop. + mk_SubCSetoid ? P. +definition mk_SubCSemiGroup :\forall csg: CSemiGroup. \forall P : csg -> Prop. + \forall op_pres_P : bin_op_pres_pred csg P (csg_op csg). CSemiGroup \def + \lambda csg: CSemiGroup. \lambda P : csg -> Prop. + \lambda op_pres_P : bin_op_pres_pred csg P (csg_op csg). + mk_CSemiGroup (subcrr csg P) (mk_SubCSetoid_bin_op ? ? ? op_pres_P ) + (restr_f_assoc csg P ? op_pres_P (plus_assoc csg)). +(* Section D9S. *) + +(* Direct Product +%\begin{convention}% +Let [M1 M2:CSemiGroup] +%\end{convention}% +*) + +(* Variable M1 M2: CSemiGroup. *) + +definition dprod: \forall M1,M2:CSemiGroup. \forall x:ProdCSetoid (csg_crr M1) (csg_crr M2). + \forall y:ProdCSetoid (csg_crr M1) (csg_crr M2). (ProdCSetoid (csg_crr M1) (csg_crr M2)) \def + \lambda M1,M2:CSemiGroup. \lambda x:ProdCSetoid (csg_crr M1) (csg_crr M2). + \lambda y:ProdCSetoid (csg_crr M1) (csg_crr M2). + match x with + [pairT (x1: (cs_crr (csg_crr M1))) (x2: (cs_crr (csg_crr M2))) \Rightarrow + match y with + [pairT (y1: (cs_crr (csg_crr M1))) (y2: (cs_crr (csg_crr M2))) \Rightarrow + pairT (cs_crr (csg_crr M1)) (cs_crr (csg_crr M2)) +(csbf_fun ? ? ? (csg_op M1) x1 y1) (csbf_fun ? ? ? (csg_op M2) x2 y2)]]. + +lemma dprod_strext: \forall M1,M2:CSemiGroup. +(bin_fun_strext (ProdCSetoid M1 M2)(ProdCSetoid M1 M2) + (ProdCSetoid M1 M2) (dprod M1 M2)). +unfold bin_fun_strext. +intros 6 (M1 M2 x1 x2 y1 y2). +unfold dprod. +elim x1 0. +intros 2 (a1 a2). +elim x2 0. +intros 2 (b1 b2). +elim y1 0. +intros 2 (c1 c2). +elim y2 0. +intros 2 (d1 d2). +simplify. +intro H. +elim H 0[simplify. +clear H. +intro H. +cut (a1 \neq b1 \lor c1 \neq d1). +elim Hcut[left.left.assumption|right.left.assumption] +|intros.simplify in H1. +clear H. +cut (a2 \neq b2 \lor c2 \neq d2). +elim Hcut [left.right.assumption|right.right.assumption] +][ +letin H0 \def (csg_op M1). +unfold csg_op in H0. +unfold CSetoid_bin_op in H0. +letin H1 \def (csbf_strext M1 M1 M1 H0). +unfold csbf_strext in H1. +unfold bin_fun_strext in H1. +apply H1. +exact H| +letin H0 \def (csg_op M2). +unfold csg_op in H0. +unfold CSetoid_bin_op in H0. +letin H2 \def (csbf_strext M2 M2 M2 H0). +unfold csbf_strext in H2. +unfold bin_fun_strext in H2. +apply H2. +exact H1] +qed. + +definition dprod_as_csb_fun: \forall M1,M2:CSemiGroup. + CSetoid_bin_fun (ProdCSetoid M1 M2) (ProdCSetoid M1 M2)(ProdCSetoid M1 M2)\def + \lambda M1,M2:CSemiGroup. + mk_CSetoid_bin_fun (ProdCSetoid M1 M2)(ProdCSetoid M1 M2) + (ProdCSetoid M1 M2) (dprod M1 M2) (dprod_strext M1 M2). + +lemma direct_product_is_CSemiGroup: \forall M1,M2:CSemiGroup. + (is_CSemiGroup (ProdCSetoid M1 M2) (dprod_as_csb_fun M1 M2)). + intros. +unfold is_CSemiGroup. +unfold CSassociative. +intros (x y z). +elim x 0. +intros (x1 x2). +elim y 0. +intros (y1 y2). +elim z 0. +intros (z1 z2). +split[unfold dprod_as_csb_fun. simplify.apply CSemiGroup_is_CSemiGroup| + unfold dprod_as_csb_fun. simplify.apply CSemiGroup_is_CSemiGroup]. +qed. + +definition direct_product_as_CSemiGroup : \forall M1,M2:CSemiGroup. ? \def + \lambda M1,M2: CSemiGroup. + mk_CSemiGroup (ProdCSetoid M1 M2) (dprod_as_csb_fun M1 M2) + (direct_product_is_CSemiGroup M1 M2). + +(* End D9S. *) + +(* The SemiGroup of Setoid functions *) + +lemma FS_is_CSemiGroup:\forall X:CSetoid. + is_CSemiGroup (FS_as_CSetoid X X) (comp_as_bin_op X ). + intro. +unfold is_CSemiGroup. +apply assoc_comp. +qed. + +definition FS_as_CSemiGroup : \forall A : CSetoid. ? \def \lambda A:CSetoid. + mk_CSemiGroup (FS_as_CSetoid A A) (comp_as_bin_op A) (assoc_comp A). + +(* Section p66E2b4. *) + +(* The Free SemiGroup +%\begin{convention}% Let [A:CSetoid]. +%\end{convention}% +*) + +(* Variable A:CSetoid. *) + +lemma Astar_is_CSemiGroup: \forall A:CSetoid. + (is_CSemiGroup (free_csetoid_as_csetoid A) (app_as_csb_fun A)). + intro. +unfold is_CSemiGroup. +unfold CSassociative. +intro x. +unfold app_as_csb_fun. +simplify. +elim x 0. +simplify. +intros (x y). +elim x. +simplify. +apply eq_reflexive_unfolded. +simplify. left. apply eq_reflexive_unfolded.assumption. + +simplify. +intros.unfold appA in H. +generalize in match (H y z).intros.unfold appA in H1.left. +apply eq_reflexive_unfolded. +assumption. +qed. + +definition Astar_as_CSemiGroup: \forall A:CSetoid. ? \def + \lambda A:CSetoid. + mk_CSemiGroup (free_csetoid_as_csetoid A) (app_as_csb_fun A) + (Astar_is_CSemiGroup A). + +(* End p66E2b4. *) diff --git a/matita/library/algebra/CoRN/SetoidFun.ma b/matita/library/algebra/CoRN/SetoidFun.ma new file mode 100644 index 000000000..cdc6af0b2 --- /dev/null +++ b/matita/library/algebra/CoRN/SetoidFun.ma @@ -0,0 +1,1303 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +(* $Id: CSetoidFun.v,v 1.12 2004/09/22 11:06:10 loeb Exp $ *) + + +include "algebra/CoRN/Setoids.ma". +include "higher_order_defs/relations.ma". + +definition ap_fun : \forall A,B : CSetoid. \forall f,g : CSetoid_fun A B. Prop \def +\lambda A,B : CSetoid. \lambda f,g : CSetoid_fun A B. + \exists a:A. (csf_fun A B f) a \neq (csf_fun A B g) a. +(* Definition ap_fun (A B : CSetoid) (f g : CSetoid_fun A B) := + {a : A | f a[#]g a}. *) + +definition eq_fun : \forall A,B : CSetoid. \forall f,g : CSetoid_fun A B. Prop \def +\lambda A,B : CSetoid. \lambda f,g : CSetoid_fun A B. + \forall a:A. (csf_fun A B f) a = (csf_fun A B g) a. +(* Definition eq_fun (A B : CSetoid) (f g : CSetoid_fun A B) := + forall a : A, f a[=]g a. *) + +lemma irrefl_apfun : \forall A,B : CSetoid. + irreflexive (CSetoid_fun A B) (ap_fun A B). +intros. +unfold irreflexive. intro f. +unfold ap_fun. +unfold. +intro. +elim H. +cut (csf_fun A B f a = csf_fun A B f a) +[ apply (eq_imp_not_ap A) + [ + assumption|assumption|apply eq_reflexive_unfolded| + apply (csf_strext_unfolded A B f). + exact H1 + ] +|apply eq_reflexive_unfolded +] +qed. + +lemma cotrans_apfun : \forall A,B : CSetoid. cotransitive (CSetoid_fun A B) (ap_fun A B). +intros (A B). +unfold. +unfold ap_fun. +intros (f g H h). +elim H. +lapply (ap_cotransitive ? ? ? H1 (csf_fun A B h a)). +elim Hletin. +left. +apply (ex_intro ? ? a H2). +right. +apply (ex_intro ? ? a H2). +qed. + +lemma ta_apfun : \forall A, B : CSetoid. tight_apart (CSetoid_fun A B) (eq_fun A B) (ap_fun A B). +unfold tight_apart. +intros (A B f g). +unfold ap_fun. +unfold eq_fun. +split +[ intros. apply not_ap_imp_eq. +unfold.intro.apply H. +apply (ex_intro ? ? a).assumption. + | intros.unfold.intro. + elim H1. + apply (eq_imp_not_ap ? ? ? ? H2). + apply H. +] +qed. + +lemma sym_apfun : \forall A, B : CSetoid. symmetric ? (ap_fun A B). +unfold symmetric. +unfold ap_fun. +intros 5 (A B f g H). +elim H 0. +clear H. +intros 2 (a H). +apply (ex_intro ? ? a). +apply ap_symmetric_unfolded. +exact H. +qed. + +definition FS_is_CSetoid : \forall A, B : CSetoid. ? \def + \lambda A, B : CSetoid. + mk_is_CSetoid (CSetoid_fun A B) (eq_fun A B) (ap_fun A B) + (irrefl_apfun A B) (sym_apfun A B) (cotrans_apfun A B) (ta_apfun A B). + +definition FS_as_CSetoid : \forall A, B : CSetoid. ? \def + \lambda A, B : CSetoid. + mk_CSetoid (CSetoid_fun A B) (eq_fun A B) (ap_fun A B) + (FS_is_CSetoid A B). + +(* Nullary and n-ary operations *) + +definition is_nullary_operation : \forall S:CSetoid. \forall s:S. Prop \def +\lambda S:CSetoid. \lambda s:S. True. + +let rec n_ary_operation (n:nat) (V:CSetoid) on n : CSetoid \def +match n with +[ O \Rightarrow V +|(S m) \Rightarrow (FS_as_CSetoid V (n_ary_operation m V))]. + + +(* Section unary_function_composition. *) + +(* Composition of Setoid functions + +Let [S1], [S2] and [S3] be setoids, [f] a +setoid function from [S1] to [S2], and [g] from [S2] +to [S3] in the following definition of composition. *) + +(* Variables S1 S2 S3 : CSetoid. +Variable f : CSetoid_fun S1 S2. +Variable g : CSetoid_fun S2 S3. *) + + +definition compose_CSetoid_fun : \forall S1,S2,S3 :CSetoid. \forall f: (CSetoid_fun S1 S2). \forall g: (CSetoid_fun S2 S3). +CSetoid_fun S1 S3. +intros (S1 S2 S3 f g). +apply (mk_CSetoid_fun ? ? (\lambda x :cs_crr S1. csf_fun S2 S3 g (csf_fun S1 S2 f x))). +unfold fun_strext. +intros (x y H). +apply (csf_strext ? ? f). +apply (csf_strext ? ? g). +assumption. +qed. + +(* End unary_function_composition. *) + +(* Composition as operation *) +definition comp : \forall A, B, C : CSetoid. +FS_as_CSetoid A B \to FS_as_CSetoid B C \to FS_as_CSetoid A C. +intros (A B C f g). +letin H \def (compose_CSetoid_fun A B C f g). +exact H. +qed. + +definition comp_as_bin_op : \forall A:CSetoid. CSetoid_bin_op (FS_as_CSetoid A A). +intro A. +unfold CSetoid_bin_op. +apply (mk_CSetoid_bin_fun ? ? ? (comp A A A)). +unfold bin_fun_strext. +unfold comp. +intros 4 (f1 f2 g1 g2). +simplify. +unfold compose_CSetoid_fun. +simplify. +elim f1 0. +unfold fun_strext. +clear f1. +intros 2 (f1 Hf1). +elim f2 0. +unfold fun_strext. +clear f2. +intros 2 (f2 Hf2). +elim g1 0. +unfold fun_strext. +clear g1. +intros 2 (g1 Hg1). +elim g2 0. +unfold fun_strext. +clear g2. +intros 2 (g2 Hg2). +simplify. +intro H. +elim H 0. +clear H. +intros 2 (a H). +letin H0 \def (ap_cotransitive A (g1 (f1 a)) (g2 (f2 a)) H (g2 (f1 a))). +elim H0 0. +clear H0. +intro H0. +right. +exists. +apply (f1 a). +exact H0. + +clear H0. +intro H0. +left. +exists. +apply a. +apply Hg2. +exact H0. +qed. + + +(* Questa coercion composta non e' stata generata autobatchmaticamente *) +lemma mycor: ∀S. CSetoid_bin_op S → (S → S → S). + intros; + unfold in c; + apply (c c1 c2). +qed. +coercion cic:/matita/algebra/CoRN/SetoidFun/mycor.con 2. + +(* Mettendola a mano con una beta-espansione funzionerebbe *) +(*lemma assoc_comp : \forall A : CSetoid. (CSassociative ? (\lambda e.mycor ? (comp_as_bin_op A) e)).*) +(* Questo sarebbe anche meglio: senza beta-espansione *) +(*lemma assoc_comp : \forall A : CSetoid. (CSassociative ? (mycor ? (comp_as_bin_op A))).*) +(* QUESTO E' QUELLO ORIGINALE MA NON FUNZIONANTE *) +(* lemma assoc_comp : \forall A : CSetoid. (CSassociative ? (comp_as_bin_op A)). *) +lemma assoc_comp : \forall A : CSetoid. (CSassociative ? (mycor ? (comp_as_bin_op A))). +unfold CSassociative. +unfold comp_as_bin_op. +intros 4 (A f g h). +simplify. +elim f. +elim g. +elim h. +whd.intros. +simplify. +apply eq_reflexive_unfolded. +qed. + +definition compose_CSetoid_bin_un_fun: \forall A,B,C : CSetoid. +\forall f : CSetoid_bin_fun B B C. \forall g : CSetoid_fun A B. +CSetoid_bin_fun A A C. +intros 5 (A B C f g). +apply (mk_CSetoid_bin_fun A A C (\lambda a0,a1 : cs_crr A. f (csf_fun ? ? g a0) (csf_fun ? ? g a1))). +unfold. +intros 5 (x1 x2 y1 y2 H0). +letin H10 \def (csbf_strext B B C f). +unfold in H10. +letin H40 \def (csf_strext A B g). +unfold in H40. +elim (H10 (csf_fun ? ? g x1) (csf_fun ? ? g x2) (csf_fun ? ? g y1) (csf_fun ? ? g y2) H0); +[left | right]; autobatch. +qed. + +definition compose_CSetoid_bin_fun: \forall A, B, C : CSetoid. +\forall f,g : CSetoid_fun A B.\forall h : CSetoid_bin_fun B B C. +CSetoid_fun A C. +intros (A B C f g h). +apply (mk_CSetoid_fun A C (λa : cs_crr A. csbf_fun ? ? ? h (csf_fun ? ? f a) (csf_fun ? ? g a))). +unfold. +intros (x y H). +elim (csbf_strext ? ? ? ? ? ? ? ? H)[ + apply (csf_strext A B f).exact H1 + |apply (csf_strext A B g).exact H1] +qed. + +definition compose_CSetoid_un_bin_fun: \forall A,B,C :CSetoid. \forall f : CSetoid_bin_fun B B C. + ∀ g : CSetoid_fun C A. CSetoid_bin_fun B B A. +intros (A0 B0 C f g). +apply (mk_CSetoid_bin_fun ? ? ? (\lambda x,y : B0. csf_fun ? ? g (f x y))). +unfold. +intros 4 (x1 x2 y1 y2). +elim f 0. +unfold bin_fun_strext. +elim g 0. +unfold fun_strext. +intros 5 (gu gstrext fu fstrext H). +apply fstrext. +apply gstrext. +exact H. +qed. + +(* End unary_and_binary_function_composition.*) + +(*Projections*) + +(*Section function_projection.*) + +lemma proj_bin_fun : \forall A, B, C: CSetoid. +\forall f : CSetoid_bin_fun A B C. \forall a: ?. +fun_strext ? ? (f a). +intros (A B C f a). +unfold. +elim f 0. +intro fo. +simplify. +intros 4 (csbf_strext0 x y H). +elim (csbf_strext0 ? ? ? ? H) 0; intro H0. + elim (ap_irreflexive_unfolded ? ? H0). +exact H0. +qed. + + +definition projected_bin_fun: \forall A,B,C : CSetoid. \forall f : CSetoid_bin_fun A B C. +\forall a : A. ? \def +\lambda A,B,C : CSetoid. \lambda f : CSetoid_bin_fun A B C. +\lambda a : A. + mk_CSetoid_fun B C (f a) (proj_bin_fun A B C f a). + +(* End function_projection. *) + +(* Section BinProj. *) + +(* Variable S : CSetoid. *) + +definition binproj1 : \forall S: CSetoid. \forall x,y:S. ? \def +\lambda S:CSetoid. \lambda x,y:S. + x. + +lemma binproj1_strext :\forall S:CSetoid. bin_fun_strext ? ? ? (binproj1 S). +intro.unfold; +intros 4.unfold binproj1.intros.left.exact H. +qed. + +definition cs_binproj1 :\forall S:CSetoid. CSetoid_bin_op S. +intro. +unfold. +apply (mk_CSetoid_bin_op ? (binproj1 S)). +apply binproj1_strext. +qed. + +(* End BinProj. *) + +(*Combining operations +%\begin{convention}% Let [S1], [S2] and [S3] be setoids. +%\end{convention}% +*) + +(* Section CombiningOperations. +Variables S1 S2 S3 : CSetoid.*) + +(* +In the following definition, we assume [f] is a setoid function from +[S1] to [S2], and [op] is an unary operation on [S2]. +Then [opOnFun] is the composition [op] after [f]. +*) + +(* Section CombiningUnaryOperations. +Variable f : CSetoid_fun S1 S2. +Variable op : CSetoid_un_op S2. *) + +definition opOnFun : \forall S1,S2,S3 :CSetoid. \forall f : CSetoid_fun S1 S2. + \forall op : CSetoid_un_op S2. + CSetoid_fun S1 S2. +intros (S1 S2 S3 f op). +apply (mk_CSetoid_fun S1 S2 (\lambda x : cs_crr S1. csf_fun ? ? op (csf_fun ? ? f x))). +unfold fun_strext; intros (x y H). +apply (csf_strext ? ? f x y). +apply (csf_strext ? ? op ? ? H). +qed. +(* +End CombiningUnaryOperations. + +End CombiningOperations. + +Section p66E2b4. +*) +(* The Free Setoid +%\begin{convention}% Let [A:CSetoid]. +%\end{convention}% +*) + +(* Variable A:CSetoid. *) + +(* TODO from listtype.ma!!!!!!!! *) +inductive Tlist (A : Type) : Type \def + Tnil : Tlist A + | Tcons : A \to Tlist A \to Tlist A. + +definition Astar: \forall A: CSetoid. ? \def +\lambda A:CSetoid. + Tlist A. + + +definition empty_word : \forall A: Type. ? \def +\lambda A:Type. (Tnil A). + +(* from listtype.ma!!!!!!!! *) +let rec Tapp (A:Type) (l,m: Tlist A) on l \def + match l with + [ Tnil \Rightarrow m + | (Tcons a l1) \Rightarrow (Tcons A a (Tapp A l1 m))]. + +definition appA : \forall A: CSetoid. ? \def +\lambda A:CSetoid. + (Tapp A). + +let rec eq_fm (A:CSetoid) (m:Astar A) (k:Astar A) on m : Prop \def +match m with +[ Tnil ⇒ match k with + [ Tnil ⇒ True + | (Tcons a l) ⇒ False] +| (Tcons b n) ⇒ match k with + [Tnil ⇒ False + |(Tcons a l) ⇒ b=a ∧ (eq_fm A n l)] +]. + +let rec CSap_fm (A:CSetoid)(m:Astar A)(k:Astar A) on m: Prop \def +match m with +[Tnil ⇒ match k with + [Tnil ⇒ False + |(Tcons a l) ⇒ True] +|(Tcons b n) ⇒ match k with + [Tnil ⇒ True + |(Tcons a l) ⇒ b ≠ a ∨ (CSap_fm A n l)] +]. + +lemma ap_fm_irreflexive: \forall A:CSetoid. (irreflexive (Astar A) (CSap_fm A) ). +unfold irreflexive. +intros 2 (A x). +elim x[ +simplify. +unfold. +intro Hy. +exact Hy| +simplify. +unfold. +intro H1. +apply H. +elim H1[ +clear H1. +generalize in match (ap_irreflexive A). +unfold irreflexive. +unfold Not. +intro. +unfold in H. +apply False_ind. +apply H1.apply t. +exact H2|exact H2] +] +qed. + +lemma ap_fm_symmetric: \forall A:CSetoid. (symmetric (Astar A) (CSap_fm A)). +intro A. +unfold symmetric. +intro x. +elim x 0 [ +intro y. + elim y 0[ + simplify. + intro. + exact H| + simplify. + intros. + exact H1]| + intros 4 (t t1 H y). + elim y 0[ + simplify. + intro. + exact H1| + simplify. + intros. + elim H2 0 [ + generalize in match (ap_symmetric A). + unfold symmetric. + intros. + left. + apply ap_symmetric.exact H4| + intro. + right. + apply H. + exact H3] + ] + ] +qed. + +lemma ap_fm_cotransitive : \forall A:CSetoid. (cotransitive (Astar A) (CSap_fm A)). +intro A. +unfold cotransitive. +intro x. +elim x 0 [ +intro y. +elim y 0 [ +intro.simplify in H.intro.elim z.simplify.left. exact H|intros (c l H1 H z). +elim z 0[ +simplify. +right. apply I|intros (a at).simplify. left. apply I]] +simplify. +left. +autobatch new|intros 2 (c l). +intros 2 (Hy). +elim y 0[ +intros 2 (H z). +elim z 0 [simplify. left.apply I| +intros 2 ( a at). +intro H1. +simplify. +right. apply I]| +intros (a at bo H z). +elim z 0[ +simplify.left. +apply I| +intros 2 (c0 l0). +elim H 0 [ +clear H. +intro.intro Hn.simplify. +generalize in match (ap_cotransitive A c a H c0). +intros.elim H1 0[intros.left. left.exact H2| +intro.right.left.exact H2]|intros. +simplify. +generalize in match (Hy at H1 l0). +intros. +elim H3[ +left.right.exact H4| +right.right.exact H4]]]]] +qed. + +lemma ap_fm_tight : \forall A:CSetoid. (tight_apart (Astar A) (eq_fm A) (CSap_fm A)). +intro A. +unfold tight_apart. +intro x. +unfold Not. +elim x 0[ + intro y. + elim y 0[ + split[simplify.intro.autobatch new|simplify.intros.exact H1]| +intros (a at). +simplify. +split[intro.autobatch new|intros. exact H1] +] +| +intros (a at IHx). +elim y 0[simplify. + split[intro.autobatch new|intros.exact H] + | +intros 2 (c l). +generalize in match (IHx l). +intro H0. +elim H0. +split. +intro H3. +split. +generalize in match (ap_tight A a c). +intros. +elim H4. +clear H4.apply H5. +unfold.intro.simplify in H3. +apply H3.left.exact H4. +intros.elim H2. +apply H.intro.apply H3.simplify. right. exact H6. +intro H3. +elim H3 0. +clear H3. +intros. +elim H5. +generalize in match (ap_tight A a c). +intro. +elim H7.clear H7. +unfold Not in H9.simplify in H5. +apply H9. +exact H3.exact H6. +apply H1. +exact H4.exact H6.]] +qed. + +definition free_csetoid_is_CSetoid: \forall A:CSetoid. + (is_CSetoid (Astar A) (eq_fm A) (CSap_fm A)) \def + \lambda A:CSetoid. + (mk_is_CSetoid (Astar A) (eq_fm A) (CSap_fm A) (ap_fm_irreflexive A) (ap_fm_symmetric A) + (ap_fm_cotransitive A) (ap_fm_tight A )). + +definition free_csetoid_as_csetoid: \forall A:CSetoid. CSetoid \def +\lambda A:CSetoid. +(mk_CSetoid (Astar A) (eq_fm A) (CSap_fm A) (free_csetoid_is_CSetoid A)). + +lemma app_strext: \forall A:CSetoid. + (bin_fun_strext (free_csetoid_as_csetoid A) (free_csetoid_as_csetoid A) + (free_csetoid_as_csetoid A) (appA A)). +intro A. +unfold bin_fun_strext. +intro x1. +elim x1 0[simplify.intro x2. + elim x2 0[simplify.intros.right.exact H|simplify.intros.left.left] + |intros 6 (a at IHx1 x2 y1 y2). + simplify. + elim x2 0 [ + elim y2 0 [simplify.intros.left.exact H|intros.left.left] + |elim y2 0[simplify.simplify in IHx1. + intros (c l H). + elim H1 0 [intros.left.left.exact H2| clear H1. + generalize in match (IHx1 l y1 (Tnil A)). + simplify.intros.elim H1 0 [intros.left.right.exact H3| + intros.right.exact H3|exact H2] + ] + |simplify. + intros (c l H c0 l0). + elim H2 0 [intros.left.left.exact H3| + generalize in match (IHx1 l0 y1 (Tcons A c l)).intros. + elim H3 0 [intros.left.right.exact H5|intros.right.exact H5|exact H4] + ] + ] + ] +] +qed. + +definition app_as_csb_fun: \forall A:CSetoid. +(CSetoid_bin_fun (free_csetoid_as_csetoid A) (free_csetoid_as_csetoid A) + (free_csetoid_as_csetoid A)) \def + \lambda A:CSetoid. + (mk_CSetoid_bin_fun (free_csetoid_as_csetoid A) (free_csetoid_as_csetoid A) + (free_csetoid_as_csetoid A) (appA A) (app_strext A)). + +(* TODO : Can't qed +lemma eq_fm_reflexive: \forall A:CSetoid. \forall (x:Astar A). (eq_fm A x x). +intros (A x). +elim x. +simplify.left. +simplify. left. apply eq_reflexive_unfolded.assumption. +qed. +*) +(* End p66E2b4. *) + +(* Partial Functions + +In this section we define a concept of partial function for an +arbitrary setoid. Essentially, a partial function is what would be +expected---a predicate on the setoid in question and a total function +from the set of points satisfying that predicate to the setoid. There +is one important limitations to this approach: first, the record we +obtain has type [Type], meaning that we can't use, for instance, +elimination of existential quantifiers. + +Furthermore, for reasons we will explain ahead, partial functions will +not be defined via the [CSetoid_fun] record, but the whole structure +will be incorporated in a new record. + +Finally, notice that to be completely general the domains of the +functions have to be characterized by a [CProp]-valued predicate; +otherwise, the use you can make of a function will be %\emph{%##a +priori##%}% restricted at the moment it is defined. + +Before we state our definitions we need to do some work on domains. +*) + +(* Section SubSets_of_G. *) + +(* Subsets of Setoids + +Subsets of a setoid will be identified with predicates from the +carrier set of the setoid into [CProp]. At this stage, we do not make +any assumptions about these predicates. + +We will begin by defining elementary operations on predicates, along +with their basic properties. In particular, we will work with well +defined predicates, so we will prove that these operations preserve +welldefinedness. + +%\begin{convention}% Let [S:CSetoid] and [P,Q:S->CProp]. +%\end{convention}% +*) + +(* Variable S : CSetoid. + +Section Conjunction. + +Variables P Q : S -> CProp. +*) + +(* From CLogic.v *) +inductive CAnd (A,B : Type): Type \def +|CAnd_intro : A \to B \to CAnd A B. + +definition conjP : \forall S:CSetoid. \forall P,Q: S \to Type. \forall x : S. Type +\def +\lambda S:CSetoid. \lambda P,Q: S \to Type. \lambda x : S. + CAnd (P x) (Q x). + +lemma prj1 : \forall S:CSetoid. \forall P,Q : S \to Type. \forall x : S. + (conjP S P Q x) \to (P x). +intros;elim c.assumption. +qed. + +lemma prj2 : \forall S:CSetoid. \forall P,Q : S \to Type. \forall x : S. + conjP S P Q x \to Q x. +intros. elim c. assumption. +qed. + +lemma conj_wd : \forall S:CSetoid. \forall P,Q : S \to Type. + pred_wd ? P \to pred_wd ? Q \to pred_wd ? (conjP S P Q). + intros 3. + unfold pred_wd. + unfold conjP. + intros.elim c. + split [ apply (f x ? t).assumption|apply (f1 x ? t1). assumption] +qed. + +(* End Conjunction. *) + +(* Section Disjunction. *) +(* Variables P Q : S -> CProp.*) + +(* +Although at this stage we never use it, for completeness's sake we also treat disjunction (corresponding to union of subsets). +*) + +definition disj : \forall S:CSetoid. \forall P,Q : S \to Prop. \forall x : S. + Prop \def + \lambda S:CSetoid. \lambda P,Q : S \to Prop. \lambda x : S. + P x \lor Q x. + +lemma inj1 : \forall S:CSetoid. \forall P,Q : S \to Prop. \forall x : S. + P x \to (disj S P Q x). +intros. +left. +assumption. +qed. + +lemma inj2 : \forall S:CSetoid. \forall P,Q : S \to Prop. \forall x : S. + Q x \to disj S P Q x. +intros. +right. +assumption. +qed. + +lemma disj_wd : \forall S:CSetoid. \forall P,Q : S \to Prop. + pred_wd ? P \to pred_wd ? Q \to pred_wd ? (disj S P Q). +intros 3. +unfold pred_wd. +unfold disj. +intros. +elim H2 [left; apply (H x ); assumption| + right; apply (H1 x). assumption. exact H3] +qed. +(* End Disjunction. *) + +(* Section Extension. *) + +(* +The next definition is a bit tricky, and is useful for choosing among the elements that satisfy a predicate [P] those that also satisfy [R] in the case where [R] is only defined for elements satisfying [P]---consider [R] to be a condition on the image of an object via a function with domain [P]. We chose to call this operation [extension]. +*) + +(* +Variable P : S -> CProp. +Variable R : forall x : S, P x -> CProp. +*) + +definition extend : \forall S:CSetoid. \forall P: S \to Type. + \forall R : (\forall x:S. P x \to Type). \forall x : S. ? + \def + \lambda S:CSetoid. \lambda P: S \to Type. + \lambda R : (\forall x:S. P x \to Type). \lambda x : S. + CAnd (P x) (\forall H : P x. (R x H) ). + +lemma ext1 : \forall S:CSetoid. \forall P: S \to Prop. + \forall R : (\forall x:S. P x \to Prop). \forall x : S. + extend S P R x \to P x. +intros. +elim e. +assumption. +qed. + +inductive sigT (A:Type) (P:A -> Type) : Type \def + |existT : \forall x:A. P x \to sigT A P. + +lemma ext2_a : \forall S:CSetoid. \forall P: S \to Prop. + \forall R : (\forall x:S. P x \to Prop). \forall x : S. + extend S P R x \to (sigT ? (λH : P x. R x H)). +intros. +elim e. +apply (existT).assumption. +apply (t1 t). +qed. + +(* +lemma ext2_a : \forall S:CSetoid. \forall P: S \to Prop. + \forall R : (\forall x:S. P x \to Prop). \forall x : S. + extend S P R x \to (ex ? (λH : P x. R x H)). +intros. +elim H. +apply (ex_intro). +exact H1.apply H2. +qed. +*) +definition proj1_sigT: \forall A : Type. \forall P : A \to Type. + \forall e : sigT A P. ? \def + \lambda A : Type. \lambda P : A \to Type. + \lambda e : sigT A P. + match e with + [existT a b \Rightarrow a]. + +(* original def in CLogic.v +Definition proj1_sigT (A : Type) (P : A -> CProp) (e : sigT P) := + match e with + | existT a b => a + end. +*) +(* _ *) +definition proj2_sigTm : \forall A : Type. \forall P : A \to Type. + \forall e : sigT A P. ? \def + \lambda A : Type. \lambda P : A \to Type. + \lambda e : sigT A P. + match e return \lambda s:sigT A P. P (proj1_sigT A P s) with + [ existT a b \Rightarrow b]. + +definition projT1: \forall A: Type. \forall P: A \to Type.\forall H: sigT A P. A \def + \lambda A: Type. \lambda P: A \to Type.\lambda H: sigT A P. + match H with + [existT x b \Rightarrow x]. + +definition projT2m : \forall A: Type. \forall P: A \to Type. \forall x:sigT A P. + P (projT1 A P x) \def + \lambda A: Type. \lambda P: A \to Type. + (\lambda H:sigT A P.match H return \lambda s:sigT A P. P (projT1 A P s) with + [existT (x:A) (h:(P x))\Rightarrow h]). + +lemma ext2 : \forall S:CSetoid. \forall P: S \to Prop. +\forall R : (\forall x:S. P x \to Prop). +\forall x: S. + \forall Hx:extend S P R x. + R x (proj1_sigT ? ? (ext2_a S P R x Hx)). + intros. + elim ext2_a. + apply (projT2m (P x) (\lambda Hbeta:P x.R x a)). + apply (existT (P x) ).assumption.assumption. +qed. + +(* +Lemma ext2 : forall (x : S) (Hx : extend x), R x (ProjT1 (ext2_a x Hx)). +intros; apply projT2. + +Qed. +*) + +lemma extension_wd :\forall S:CSetoid. \forall P: S \to Prop. + \forall R : (\forall x:S. P x \to Prop). + pred_wd ? P \to + (\forall (x,y : S).\forall Hx : (P x). + \forall Hy : (P y). x = y \to R x Hx \to R y Hy) \to + pred_wd ? (extend S P R) . +intros (S P R H H0). +unfold. +intros (x y H1 H2). +elim H1;split[apply (H x).assumption. exact H2| + intro H5.apply (H0 x ? t)[apply H2|apply t1] + ] +qed. + +(*End Extension. *) + +(*End SubSets_of_G.*) + +(* Notation Conj := (conjP _). +Implicit Arguments disj [S]. + +Implicit Arguments extend [S]. +Implicit Arguments ext1 [S P R x]. +Implicit Arguments ext2 [S P R x]. +*) +(**Operations + +We are now ready to define the concept of partial function between arbitrary setoids. +*) +lemma block : \forall y:nat. \forall x:nat. y = x \to x = y. +intros. +symmetry.exact H. +qed. + +record BinPartFunct (S1, S2 : CSetoid) : Type \def + {bpfdom : S1 \to Type; + bdom_wd : pred_wd S1 bpfdom; + bpfpfun :> \forall x : S1. (bpfdom x) \to S2; + bpfstrx : \forall x,y,Hx,Hy. + bpfpfun x Hx ≠ bpfpfun y Hy \to (x \neq y)}. + +(* Notation BDom := (bpfdom _ _). +Implicit Arguments bpfpfun [S1 S2]. *) + +(* +The next lemma states that every partial function is well defined. +*) + +lemma bpfwdef: \forall S1,S2 : CSetoid. \forall F : (BinPartFunct S1 S2). + \forall x,y,Hx,Hy. + x = y \to (bpfpfun S1 S2 F x Hx ) = (bpfpfun S1 S2 F y Hy). +intros. +apply not_ap_imp_eq;unfold. intro H0. +generalize in match (bpfstrx ? ? ? ? ? ? ? H0). +exact (eq_imp_not_ap ? ? ? H). +qed. + +(* Similar for autobatchmorphisms. *) + +record PartFunct (S : CSetoid) : Type \def + {pfdom : S -> Type; + dom_wd : pred_wd S pfdom; + pfpfun :> \forall x : S. pfdom x \to S; + pfstrx : \forall x, y, Hx, Hy. pfpfun x Hx \neq pfpfun y Hy \to x \neq y}. + + +(* Notation Dom := (pfdom _). +Notation Part := (pfpfun _). +Implicit Arguments pfpfun [S]. *) + +(* +The next lemma states that every partial function is well defined. +*) + +lemma pfwdef : \forall S:CSetoid. \forall F : PartFunct S. \forall x, y, Hx, Hy. + x = y \to (pfpfun S F x Hx ) = (pfpfun S F y Hy). +intros. +apply not_ap_imp_eq;unfold. intro H0. +generalize in match (pfstrx ? ? ? ? ? ? H0). +exact (eq_imp_not_ap ? ? ? H). +qed. + +(* +A few characteristics of this definition should be explained: + - The domain of the partial function is characterized by a predicate +that is required to be well defined but not strongly extensional. The +motivation for this choice comes from two facts: first, one very +important subset of real numbers is the compact interval +[[a,b]]---characterized by the predicate [ fun x : IR => a [<=] x /\ x +[<=] b], which is not strongly extensional; on the other hand, if we +can apply a function to an element [s] of a setoid [S] it seems +reasonable (and at some point we do have to do it) to apply that same +function to any element [s'] which is equal to [s] from the point of +view of the setoid equality. + - The last two conditions state that [pfpfun] is really a subsetoid +function. The reason why we do not write it that way is the +following: when applying a partial function [f] to an element [s] of +[S] we also need a proof object [H]; with this definition the object +we get is [f(s,H)], where the proof is kept separate from the object. +Using subsetoid notation, we would get $f(\langle +s,H\rangle)$#f(⟨s,H⟩)#; from this we need to apply two +projections to get either the original object or the proof, and we +need to apply an extra constructor to get $f(\langle +s,H\rangle)$#f(⟨s,H⟩)# from [s] and [H]. This amounts +to spending more resources when actually working with these objects. + - This record has type [Type], which is very unfortunate, because it +means in particular that we cannot use the well behaved set +existential quantification over partial functions; however, later on +we will manage to avoid this problem in a way that also justifies that +we don't really need to use that kind of quantification. Another +approach to this definition that completely avoid this complication +would be to make [PartFunct] a dependent type, receiving the predicate +as an argument. This does work in that it allows us to give +[PartFunct] type [Set] and do some useful stuff with it; however, we +are not able to define something as simple as an operator that gets a +function and returns its domain (because of the restrictions in the +type elimination rules). This sounds very unnatural, and soon gets us +into strange problems that yield very unlikely definitions, which is +why we chose to altogether do away with this approach. + +%\begin{convention}% All partial functions will henceforth be denoted by capital letters. +%\end{convention}% + +We now present some methods for defining partial functions. +*) + +(* Hint Resolve CI: core. *) + +(* Section CSetoid_Ops.*) + +(*Variable S : CSetoid.*) + +(* +To begin with, we want to be able to ``see'' each total function as a partial function. +*) + +definition total_eq_part :\forall S:CSetoid. CSetoid_un_op S \to PartFunct S. +intros (S f). +apply (mk_PartFunct ? + (\lambda x : S. True) + ? + (\lambda (x : S). \lambda (H : True).(csf_fun ? ? f x))). +unfold. intros;left. +intros (x y Hx Hy H). +exact (csf_strext_unfolded ? ? f ? ? H). +qed. +(*Section Part_Function_Const.*) + +(* +In any setoid we can also define constant functions (one for each element of the setoid) and an identity function: + +%\begin{convention}% Let [c:S]. +%\end{convention}% +*) + +(*Variable c : S.*) + +definition Fconst: \forall S:CSetoid. \forall c: S. ? \def + \lambda S:CSetoid. \lambda c: S. + total_eq_part ? (Const_CSetoid_fun ? ? c). + +(* End Part_Function_Const. *) + +(* Section Part_Function_Id. *) + +definition Fid : \forall S:CSetoid. ? \def + \lambda S:CSetoid.total_eq_part ? (id_un_op S). + +(* End Part_Function_Id. *) + +(* +(These happen to be always total functions, but that is more or less obvious, +as we have no information on the setoid; however, we will be able to define +partial functions just applying other operators to these ones.) + +If we have two setoid functions [F] and [G] we can always compose them. +The domain of our new function will be the set of points [s] in the domain of [F] +for which [F(s)] is in the domain of [G]#. + +#%\footnote{%Notice that the use of extension here is essential.%}.% +The inversion in the order of the variables is done to maintain uniformity +with the usual mathematical notation. + +%\begin{convention}% +Let [G,F:(PartFunct S)] and denote by [Q] and [P], respectively, the predicates characterizing +their domains. +%\end{convention}% +*) + +(* Section Part_Function_Composition. *) + +(* Variables G F : PartFunct S. *) + +(* begin hide *) + +definition UP : \forall S:CSetoid. \forall F: PartFunct S. ? \def + \lambda S:CSetoid. \lambda F: PartFunct S. + pfdom ? F. +(* Let P := Dom F. *) +definition UQ : \forall S:CSetoid. \forall G : PartFunct S. ? \def + \lambda S:CSetoid. \lambda G: PartFunct S. + pfdom ? G. +(* Let Q := Dom G. *) +definition UR : \forall S:CSetoid. \forall F,G: PartFunct S. \forall x: S. ? \def + \lambda S:CSetoid. \lambda F,G: PartFunct S. \lambda x: S. + (sigT ? (\lambda Hx : UP S F x. UQ S G (pfpfun S F x Hx))). +(*Let R x := {Hx : P x | Q (F x Hx)}.*) + +(* end hide *) + +(* TODO ProjT1 *) +lemma part_function_comp_strext : \forall S:CSetoid. \forall F,G: PartFunct S. +\forall x,y:S. \forall Hx : UR S F G x. \forall Hy : (UR S F G y). + (pfpfun ? G (pfpfun ? F x (proj1_sigT ? ? Hx)) (proj2_sigTm ? ? Hx)) + \neq (pfpfun ? G (pfpfun ? F y (proj1_sigT ? ? Hy)) (proj2_sigTm ? ? Hy)) \to x \neq y. +intros (S F G x y Hx Hy H). +exact (pfstrx ? ? ? ? ? ? (pfstrx ? ? ? ? ? ? H)). +qed. +(* +definition TempR : \forall S:CSetoid. \forall F,G: PartFunct S. \forall x: S. ? \def + \lambda S:CSetoid. \lambda F,G: PartFunct S. \lambda x: S. + (ex ? (\lambda Hx : UP S F x. UQ S G (pfpfun S F x Hx))). *) + +lemma part_function_comp_dom_wd :\forall S:CSetoid. \forall F,G: PartFunct S. + pred_wd S (UR S F G). + intros.unfold. + intros (x y H H0). + unfold UR. + elim H. + unfold in a. + unfold UP.unfold UQ. + apply (existT). + apply (dom_wd S F x y a H0). +apply (dom_wd S G (pfpfun S F x a)). +assumption. +apply pfwdef; assumption. +qed. + +definition Fcomp : \forall S:CSetoid. \forall F,G : PartFunct S. ? \def +\lambda S:CSetoid. \lambda F,G : PartFunct S. +mk_PartFunct ? (UR S F G) (part_function_comp_dom_wd S F G) +(\lambda x. \lambda Hx : UR S F G x. (pfpfun S G (pfpfun S F x (proj1_sigT ? ? Hx)) (proj2_sigTm ? ? Hx))) +(part_function_comp_strext S F G). + +(*End Part_Function_Composition.*) + +(*End CSetoid_Ops.*) + +(* +%\begin{convention}% Let [F:(BinPartFunct S1 S2)] and [G:(PartFunct S2 S3)], and denote by [Q] and [P], respectively, the predicates characterizing their domains. +%\end{convention}% +*) + +(* Section BinPart_Function_Composition.*) + +(*Variables S1 S2 S3 : CSetoid. + +Variable G : BinPartFunct S2 S3. +Variable F : BinPartFunct S1 S2. +*) +(* begin hide *) +(* Let P := BDom F. +Let Q := BDom G.*) +(* end hide *) +(*Let R x := {Hx : P x | Q (F x Hx)}.*) + +definition BP : \forall S1,S2:CSetoid. \forall F: BinPartFunct S1 S2. ? \def + \lambda S1,S2:CSetoid. \lambda F: BinPartFunct S1 S2. + bpfdom ? ? F. +(* Let P := Dom F. *) +definition BQ : \forall S2,S3:CSetoid. \forall G: BinPartFunct S2 S3. ? \def + \lambda S2,S3:CSetoid. \lambda G: BinPartFunct S2 S3. + bpfdom ? ? G. +(* Let Q := BDom G.*) +definition BR : \forall S1,S2,S3:CSetoid. \forall F: BinPartFunct S1 S2. +\forall G: BinPartFunct S2 S3. + \forall x: ?. ? \def + \lambda S1,S2,S3:CSetoid. \lambda F: BinPartFunct S1 S2. + \lambda G: BinPartFunct S2 S3. \lambda x: ?. + (sigT ? (\lambda Hx : BP S1 S2 F x. BQ S2 S3 G (bpfpfun S1 S2 F x Hx))). +(*Let R x := {Hx : P x | Q (F x Hx)}.*) + +lemma bin_part_function_comp_strext : \forall S1,S2,S3:CSetoid. \forall F: BinPartFunct S1 S2. +\forall G: BinPartFunct S2 S3. \forall x,y. \forall Hx : BR S1 S2 S3 F G x. +\forall Hy : (BR S1 S2 S3 F G y). +(bpfpfun ? ? G (bpfpfun ? ? F x (proj1_sigT ? ? Hx)) (proj2_sigTm ? ? Hx)) \neq +(bpfpfun ? ? G (bpfpfun ? ? F y (proj1_sigT ? ? Hy)) (proj2_sigTm ? ? Hy)) \to x \neq y. +intros (S1 S2 S3 x y Hx Hy H). +exact (bpfstrx ? ? ? ? ? ? ? (bpfstrx ? ? ? ? ? ? ? H1)). +qed. + +lemma bin_part_function_comp_dom_wd : \forall S1,S2,S3:CSetoid. + \forall F: BinPartFunct S1 S2. \forall G: BinPartFunct S2 S3. + pred_wd ? (BR S1 S2 S3 F G). +intros. +unfold.intros (x y H H0). +unfold BR; elim H 0.intros (x0). +apply (existT ? ? (bdom_wd ? ? F x y x0 H0)). +apply (bdom_wd ? ? G (bpfpfun ? ? F x x0)). +assumption. +apply bpfwdef; assumption. +qed. + +definition BinFcomp : \forall S1,S2,S3:CSetoid. \forall F: BinPartFunct S1 S2. + \forall G: BinPartFunct S2 S3. ? +\def +\lambda S1,S2,S3:CSetoid. \lambda F: BinPartFunct S1 S2. \lambda G: BinPartFunct S2 S3. +mk_BinPartFunct ? ? (BR S1 S2 S3 F G) (bin_part_function_comp_dom_wd S1 S2 S3 F G) + (\lambda x. \lambda Hx : BR S1 S2 S3 F G x.(bpfpfun ? ? G (bpfpfun ? ? F x (proj1_sigT ? ? Hx)) (proj2_sigTm ? ? Hx))) + (bin_part_function_comp_strext S1 S2 S3 F G). +(*End BinPart_Function_Composition.*) +(* Different tokens for compatibility with coqdoc *) + +(* +Implicit Arguments Fconst [S]. +Notation "[-C-] x" := (Fconst x) (at level 2, right associativity). + +Notation FId := (Fid _). + +Implicit Arguments Fcomp [S]. +Infix "[o]" := Fcomp (at level 65, no associativity). + +Hint Resolve pfwdef bpfwdef: algebra. +*) +(*Section bijections.*) +(*Bijections *) + + +definition injective : \forall A, B :CSetoid. \forall f : CSetoid_fun A B. + ? \def + \lambda A, B :CSetoid. \lambda f : CSetoid_fun A B. + (\forall a0: A.\forall a1 : A. a0 \neq a1 \to + (csf_fun A B f a0) \neq (csf_fun A B f a1)). + +definition injective_weak: \forall A, B :CSetoid. \forall f : CSetoid_fun A B. + ? \def + \lambda A, B :CSetoid. \lambda f : CSetoid_fun A B. + (\forall a0, a1 : A. + (csf_fun ? ? f a0) = (csf_fun ? ? f a1) -> a0 = a1). + +definition surjective : \forall A, B :CSetoid. \forall f : CSetoid_fun A B. + ? \def + \lambda A, B :CSetoid. \lambda f : CSetoid_fun A B. + (\forall b : B. (\exists a : A. (csf_fun ? ? f a) = b)). + +(* Implicit Arguments injective [A B]. + Implicit Arguments injective_weak [A B]. + Implicit Arguments surjective [A B]. *) + +lemma injective_imp_injective_weak: \forall A, B :CSetoid. \forall f : CSetoid_fun A B. + injective A B f \to injective_weak A B f. +intros 3 (A B f). +unfold injective. +intro H. +unfold injective_weak. +intros 3 (a0 a1 H0). +apply not_ap_imp_eq. +unfold. +intro H1. +letin H2 \def (H a0 a1 H1). +letin H3 \def (ap_imp_neq B (csf_fun ? ? f a0) (csf_fun ? ? f a1) H2). +letin H4 \def (eq_imp_not_neq B (csf_fun ? ? f a0) (csf_fun ? ? f a1) H0). +apply H4. +exact H3. +qed. + +definition bijective : \forall A, B :CSetoid. \forall f : CSetoid_fun A B. +? \def \lambda A, B :CSetoid. \lambda f : CSetoid_fun A B. +injective A B f \and surjective A B f. + + +(* Implicit Arguments bijective [A B]. *) + +lemma id_is_bij : \forall A:CSetoid. bijective ? ? (id_un_op A). +intro A. +split [unfold. simplify; intros. exact H| +unfold.intro. apply (ex_intro ).exact b. apply eq_reflexive] +qed. + +lemma comp_resp_bij :\forall A,B,C,f,g. + bijective ? ? f \to bijective ? ? g \to bijective ? ? (compose_CSetoid_fun A B C f g). +intros 5 (A B C f g). +intros 2 (H0 H1). +elim H0 0; clear H0;intros 2 (H00 H01). +elim H1 0; clear H1; intros 2 (H10 H11). +split[unfold. intros 2 (a0 a1); simplify; intro. +unfold compose_CSetoid_fun.simplify. + apply H10; apply H00;exact H|unfold. + intro c; unfold compose_CSetoid_fun.simplify. +elim (H11 c) 0;intros (b H20). +elim (H01 b) 0.intros (a H30). +apply ex_intro.apply a. +apply (eq_transitive_unfolded ? ? (csf_fun B C g b)). +apply csf_wd_unfolded.assumption.assumption] +qed. + +(* Implicit Arguments invfun [A B]. *) + +record CSetoid_bijective_fun (A,B:CSetoid): Type \def +{ direct :2> CSetoid_fun A B; + inverse: CSetoid_fun B A; + inv1: \forall x:A.(csf_fun ? ? inverse (csf_fun ? ? direct x)) = x; + inv2: \forall x:B.(csf_fun ? ? direct (csf_fun ? ? inverse x)) = x + }. + +lemma invfun : \forall A,B:CSetoid. \forall f:CSetoid_bijective_fun A B. + B \to A. + intros (A B f ). + elim (inverse A B f).apply f1.apply c. +qed. + +lemma inv_strext : \forall A,B. \forall f : CSetoid_bijective_fun A B. + fun_strext B A (invfun A B f). +intros.unfold invfun. +elim (inverse A B f).simplify.intros. +unfold in H.apply H.assumption. +qed. + + + +definition Inv: \forall A, B:CSetoid. +\forall f:CSetoid_bijective_fun A B. \forall H : (bijective ? ? (direct ? ? f)). ? \def +\lambda A, B:CSetoid. \lambda f:CSetoid_bijective_fun A B. \lambda H : (bijective ? ? (direct ? ? f)). + mk_CSetoid_fun B A (invfun ? ? f) (inv_strext ? ? f). + +lemma eq_to_ap_to_ap: \forall A:CSetoid.\forall a,b,c:A. +a = b \to b \neq c \to a \neq c. +intros. +generalize in match (ap_cotransitive_unfolded ? ? ? H1 a). +intro.elim H2.apply False_ind.apply (eq_imp_not_ap ? ? ? H). +apply ap_symmetric_unfolded. assumption. +assumption. +qed. + +lemma Dir_bij : \forall A, B:CSetoid. + \forall f : CSetoid_bijective_fun A B. + bijective ? ? (direct ? ? f). + intros.unfold bijective.split + [unfold injective.intros. + apply (csf_strext_unfolded ? ? (inverse ? ? f)). + elim f. + apply (eq_to_ap_to_ap ? ? ? ? (H1 ?)). + apply ap_symmetric_unfolded. + apply (eq_to_ap_to_ap ? ? ? ? (H1 ?)). + apply ap_symmetric_unfolded.assumption + |unfold surjective.intros. + elim f.autobatch. + ] +qed. + +lemma Inv_bij : \forall A, B:CSetoid. + \forall f : CSetoid_bijective_fun A B. + bijective ? ? (inverse A B f). + intros; + elim f 2; + elim c2 0; + elim c3 0; + simplify; + intros; + split; + [ intros; + apply H1; + apply (eq_to_ap_to_ap ? ? ? ? (H3 ?)). + apply ap_symmetric_unfolded. + apply (eq_to_ap_to_ap ? ? ? ? (H3 ?)). + apply ap_symmetric_unfolded.assumption| + intros.autobatch] +qed. + +(* End bijections.*) + +(* Implicit Arguments bijective [A B]. +Implicit Arguments injective [A B]. +Implicit Arguments injective_weak [A B]. +Implicit Arguments surjective [A B]. +Implicit Arguments inv [A B]. +Implicit Arguments invfun [A B]. +Implicit Arguments Inv [A B]. + +Implicit Arguments conj_wd [S P Q]. +*) + +(* Notation Prj1 := (prj1 _ _ _ _). + Notation Prj2 := (prj2 _ _ _ _). *) diff --git a/matita/library/algebra/CoRN/SetoidInc.ma b/matita/library/algebra/CoRN/SetoidInc.ma new file mode 100644 index 000000000..16bc9acfc --- /dev/null +++ b/matita/library/algebra/CoRN/SetoidInc.ma @@ -0,0 +1,150 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + +include "algebra/CoRN/SetoidFun.ma". + +(* $Id: CSetoidInc.v,v 1.3 2004/04/22 14:49:43 lcf Exp $ *) + +(* printing included %\ensuremath{\subseteq}% #⊆# *) + +(* Section inclusion. *) + +(* Inclusion + +Let [S] be a setoid, and [P], [Q], [R] be predicates on [S]. *) + +(* Variable S : CSetoid. *) + +definition included : \forall S : CSetoid. \forall P,Q : S \to Type. Type \def + \lambda S : CSetoid. \lambda P,Q : S \to Type. + \forall x : S. P x \to Q x. + +(* Section Basics. *) + +(* Variables P Q R : S -> CProp. *) +lemma included_refl : \forall S : CSetoid. \forall P : S \to Type. + included S P P. +intros. +unfold. +intros. +assumption. +qed. + +lemma included_trans : \forall S : CSetoid. \forall P,Q,R : S \to Type. + included S P Q \to included S Q R \to included S P R. +intros. +unfold. +intros. +apply i1. +apply i. +assumption. +qed. + +lemma included_conj : \forall S : CSetoid. \forall P,Q,R : S \to Type. + included S P Q \to included S P R \to included S P (conjP S Q R). +intros 4. +unfold included. +intros; +unfold. +split [apply f.assumption|apply f1.assumption] +qed. + +lemma included_conj' : \forall S : CSetoid. \forall P,Q,R : S \to Type. + included S (conjP S P Q) P. + intros. +exact (prj1 S P Q). +qed. + +lemma included_conj'' : \forall S : CSetoid. \forall P,Q,R : S \to Type. + included S (conjP S P Q) Q. + intros. +exact (prj2 S P Q). +qed. + +lemma included_conj_lft : \forall S : CSetoid. \forall P,Q,R : S \to Type. + included S R (conjP S P Q) -> included S R P. +intros 4. +unfold included. +unfold conjP.intros (f1 x H2). +elim (f1 x ); assumption. +qed. + +lemma included_conj_rht : \forall S : CSetoid. \forall P,Q,R : S \to Type. + included S R (conjP S P Q) \to included S R Q. + intros 4. + unfold included. + unfold conjP. +intros (H1 x H2). +elim (H1 x); assumption. +qed. +lemma included_extend : \forall S : CSetoid. \forall P,Q,R : S \to Type. + \forall H : \forall x. P x \to Type. + included S R (extend S P H) \to included S R P. +intros 4. +intros (H0 H1). +unfold. +unfold extend in H1. +intros. +elim (H1 x);assumption. +qed. + + +(* End Basics. *) + +(* +%\begin{convention}% Let [I,R:S->CProp] and [F G:(PartFunct S)], and denote +by [P] and [Q], respectively, the domains of [F] and [G]. +%\end{convention}% +*) + +(* Variables F G : (PartFunct S). *) + +(* begin hide *) +(* Let P := Dom F. *) +(* Let Q := Dom G. *) +(* end hide *) + +(* Variable R : S -> CProp. *) +lemma included_FComp : \forall S : CSetoid. \forall F,G: PartFunct S. +\forall R : S \to Type. + included S R (UP ? F) \to (\forall x: S. \forall Hx. (R x) \to UQ ? G (pfpfun ? F x Hx)) \to + included S R (pfdom ? (Fcomp ? F G)). +intros (S F G R HP HQ). +unfold Fcomp. +simplify. +unfold included. intros (x Hx). +apply (existT ? ? (HP x Hx)). +apply HQ. +assumption. +qed. + +lemma included_FComp': \forall S : CSetoid. \forall F,G: PartFunct S. +\forall R : S \to Type. +included S R (pfdom ? (Fcomp ? F G)) \to included S R (UP ? F). +intros (S F G R H). +unfold Fcomp in H. +simplify in H. +unfold. intros (x Hx). +elim (H x Hx); +assumption. +qed. + +(* End inclusion. *) + +(* Implicit Arguments included [S]. + +Hint Resolve included_refl included_FComp : included. + +Hint Immediate included_trans included_FComp' : included. *) diff --git a/matita/library/algebra/CoRN/Setoids.ma b/matita/library/algebra/CoRN/Setoids.ma new file mode 100644 index 000000000..669d5e2c8 --- /dev/null +++ b/matita/library/algebra/CoRN/Setoids.ma @@ -0,0 +1,1282 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + + +include "higher_order_defs/relations.ma". +include "Z/plus.ma". + +include "datatypes/constructors.ma". +include "nat/nat.ma". +include "logic/equality.ma". +(*include "Z/Zminus.ma".*) + +(* Setoids +Definition of a constructive setoid with apartness, +i.e. a set with an equivalence relation and an apartness relation compatible with it. +*) + +(* Definition of Setoid +Apartness, being the main relation, needs to be [CProp]-valued. Equality, +as it is characterized by a negative statement, lives in [Prop]. + +N.B. for the moment we use Prop for both (Matita group) +*) + +record is_CSetoid (A : Type) (eq : relation A) (ap : relation A) : Prop \def + {ax_ap_irreflexive : irreflexive A ap; + ax_ap_symmetric : symmetric A ap; + ax_ap_cotransitive : cotransitive A ap; + ax_ap_tight : tight_apart A eq ap}. + +record CSetoid : Type \def + {cs_crr :> Type; + cs_eq : relation cs_crr; + cs_ap : relation cs_crr; + cs_proof : is_CSetoid cs_crr cs_eq cs_ap}. + +interpretation "setoid equality" + 'eq x y = (cic:/matita/algebra/CoRN/Setoid/cs_eq.con _ x y). + +interpretation "setoid apart" + 'neq x y = (cic:/matita/algebra/CoRN/Setoid/cs_ap.con _ x y). + +(* visto che sia "ap" che "eq" vanno in Prop e data la "tight-apartness", +"cs_neq" e "ap" non sono la stessa cosa? *) +definition cs_neq : \forall S : CSetoid. relation S \def + \lambda S : CSetoid. \lambda x,y : S. \not x = y. + +lemma CSetoid_is_CSetoid : + \forall S : CSetoid. is_CSetoid S (cs_eq S) (cs_ap S). +intro. apply (cs_proof S). +qed. + +lemma ap_irreflexive: \forall S : CSetoid. irreflexive S (cs_ap S). +intro. elim (CSetoid_is_CSetoid S). assumption. +qed. + +lemma ap_symmetric : \forall S : CSetoid. symmetric S(cs_ap S). +intro. elim (CSetoid_is_CSetoid S). assumption. +qed. + +lemma ap_cotransitive : \forall S : CSetoid. cotransitive S (cs_ap S). +intro. elim (CSetoid_is_CSetoid S). assumption. +qed. + +lemma ap_tight : \forall S : CSetoid. tight_apart S (cs_eq S) (cs_ap S). +intro. elim (CSetoid_is_CSetoid S). assumption. +qed. + +definition ex_unq : \forall S : CSetoid. (S \to Prop) \to Prop \def + \lambda S : CSetoid. \lambda P : S \to Prop. + ex2 S (\lambda x. \forall y : S. P y \to x = y) P. + + +lemma eq_reflexive : \forall S : CSetoid. reflexive S (cs_eq S). +intro. unfold. intro. +generalize in match (ap_tight S x x). +intro. +generalize in match (ap_irreflexive S x); +elim H. apply H1. assumption. +qed. + +axiom eq_symmetric : \forall S : CSetoid. symmetric S (cs_eq S). +(* +lemma eq_symmetric : \forall S : CSetoid. symmetric S (cs_eq S). +intro. unfold. intros. +generalize in match (ap_tight S x y). intro. +generalize in match (ap_tight S y x). intro. +generalize in match (ap_symmetric S y x). intro. +elim H1. clear H1. +elim H2. clear H2. +apply H1. unfold. intro. autobatch. +qed. +*) +lemma eq_transitive : \forall S : CSetoid. transitive S (cs_eq S). +intro. unfold. intros (x y z H H0). +generalize in match (ap_tight S x y). intro. +generalize in match (ap_tight S y z). intro. +generalize in match (ap_tight S x z). intro. +elim H3. +apply H4. unfold. intro. +generalize in match (ap_cotransitive ? ? ? H6 y). intro H7. +elim H1 (H1' H1''). clear H1. +elim H2 (H2' H2''). clear H2. +elim H3 (H3' H3''). clear H3. +elim H7 (H1). clear H7. +generalize in match H1. apply H1''. assumption. (*non ho capito il secondo passo*) +generalize in match H1. apply H2''. assumption. +qed. + +lemma eq_reflexive_unfolded : \forall S:CSetoid. \forall x:S. x = x. +apply eq_reflexive. +qed. + +lemma eq_symmetric_unfolded : \forall S:CSetoid. \forall x,y:S. x = y \to y = x. +apply eq_symmetric. +qed. + +lemma eq_transitive_unfolded : \forall S:CSetoid. \forall x,y,z:S. x = y \to y = z \to x = z. +apply eq_transitive. +qed. + + +lemma eq_wdl : \forall S:CSetoid. \forall x,y,z:S. x = y \to x = z \to z = y. +intros. +(* perche' autobatch non arriva in fondo ??? *) +apply (eq_transitive_unfolded ? ? x). +apply eq_symmetric_unfolded. +exact H1. +exact H. +qed. + + +lemma ap_irreflexive_unfolded : \forall S:CSetoid. \forall x:S. \not (x \neq x). +apply ap_irreflexive. +qed. + +lemma ap_cotransitive_unfolded : \forall S:CSetoid. \forall a,b:S. a \neq b \to + \forall c:S. a \neq c \or c \neq b. +apply ap_cotransitive. +qed. + +lemma ap_symmetric_unfolded : \forall S:CSetoid. \forall x,y:S. + x \neq y \to y \neq x. +apply ap_symmetric. +qed. + +lemma eq_imp_not_ap : \forall S:CSetoid. \forall x,y:S. + x = y \to \not (x \neq y). +intros. +elim (ap_tight S x y). +apply H2. assumption. +qed. + +lemma not_ap_imp_eq : \forall S:CSetoid. \forall x,y:S. + \not (x \neq y) \to x = y. +intros. +elim (ap_tight S x y). +apply H1. assumption. +qed. + +lemma neq_imp_notnot_ap : \forall S:CSetoid. \forall x,y:S. + (cs_neq S x y) \to \not \not (x \neq y). +intros. unfold. intro. +apply H. +apply not_ap_imp_eq. +assumption. +qed. + +lemma notnot_ap_imp_neq: \forall S:CSetoid. \forall x,y:S. + (\not \not (x \neq y)) \to (cs_neq S x y). +intros. unfold. unfold. intro. +apply H. +apply eq_imp_not_ap. +assumption. +qed. + +lemma ap_imp_neq : \forall S:CSetoid. \forall x,y:S. + x \neq y \to (cs_neq S x y). +intros. unfold. unfold. intro. +apply (eq_imp_not_ap S ? ? H1). +assumption. +qed. + +lemma not_neq_imp_eq : \forall S:CSetoid. \forall x,y:S. + \not (cs_neq S x y) \to x = y. +intros. +apply not_ap_imp_eq. +unfold. intro. +apply H. +apply ap_imp_neq. +assumption. +qed. + +lemma eq_imp_not_neq : \forall S:CSetoid. \forall x,y:S. + x = y \to \not (cs_neq S x y). +intros. unfold. intro. +apply H1. +assumption. +qed. + + + +(* -----------------The product of setoids----------------------- *) + +definition prod_ap: \forall A,B : CSetoid.\forall c,d: ProdT A B. Prop \def +\lambda A,B : CSetoid.\lambda c,d: ProdT A B. + ((cs_ap A (fstT A B c) (fstT A B d)) \or + (cs_ap B (sndT A B c) (sndT A B d))). + +definition prod_eq: \forall A,B : CSetoid.\forall c,d: ProdT A B. Prop \def +\lambda A,B : CSetoid.\lambda c,d: ProdT A B. + ((cs_eq A (fstT A B c) (fstT A B d)) \and + (cs_eq B (sndT A B c) (sndT A B d))). + + +lemma prodcsetoid_is_CSetoid: \forall A,B: CSetoid. + is_CSetoid (ProdT A B) (prod_eq A B) (prod_ap A B). +intros. +apply (mk_is_CSetoid ? (prod_eq A B) (prod_ap A B)) + [unfold. + intros. + elim x. + unfold. + unfold prod_ap. simplify. + intros. + elim H + [apply (ap_irreflexive A t H1) + |apply (ap_irreflexive B t1 H1) + ] + |unfold. + intros 2. + elim x 2. + elim y 2. + unfold prod_ap. simplify. + intro. + elim H + [left. apply ap_symmetric. assumption. + |right. apply ap_symmetric. assumption + ] + |unfold. + intros 2. + elim x 2. + elim y 4. + elim z. + unfold prod_ap in H. simplify in H. + unfold prod_ap. simplify. + elim H + [cut ((t \neq t4) \or (t4 \neq t2)) + [elim Hcut + [left. left. assumption + |right. left. assumption + ] + |apply (ap_cotransitive A). assumption + ] + |cut ((t1 \neq t5) \or (t5 \neq t3)) + [elim Hcut + [left. right. assumption + |right. right. assumption + ] + |apply (ap_cotransitive B). assumption. + ] + ] +|unfold. + intros 2. + elim x 2. + elim y 2. + unfold prod_ap. simplify. + split + [intro. + left + [apply not_ap_imp_eq. + unfold. intro. apply H. + left. assumption + |apply not_ap_imp_eq. + unfold. intro. apply H. + right. assumption + ] + |intro. unfold. intro. + elim H. + elim H1 + [apply (eq_imp_not_ap A t t2 H2). assumption + |apply (eq_imp_not_ap B t1 t3 H3). assumption + ] + ] +] +qed. + + +definition ProdCSetoid : \forall A,B: CSetoid. CSetoid \def + \lambda A,B: CSetoid. + mk_CSetoid (ProdT A B) (prod_eq A B) (prod_ap A B) (prodcsetoid_is_CSetoid A B). + + + +(* Relations and predicates +Here we define the notions of well-definedness and strong extensionality +on predicates and relations. +*) + + + +(*-----------------------------------------------------------------------*) +(*-------------------------- Predicates on Setoids ----------------------*) +(*-----------------------------------------------------------------------*) + +(* throughout this section consider (S : CSetoid) and (P : S -> Prop) *) + +(* Definition pred_strong_ext : CProp := forall x y : S, P x -> P y or x [#] y. *) +definition pred_strong_ext : \forall S: CSetoid. (S \to Prop) \to Prop \def + \lambda S: CSetoid. \lambda P: S \to Prop. \forall x,y: S. + P x \to (P y \or (x \neq y)). + +(* Definition pred_wd : CProp := forall x y : S, P x -> x [=] y -> P y. *) +definition pred_wd : \forall S: CSetoid. \forall P :S \to Type. Type \def + \lambda S: CSetoid. \lambda P: S \to Type. \forall x,y : S. + P x \to x = y \to P y. + +record wd_pred (S: CSetoid) : Type \def + {wdp_pred :> S \to Prop; + wdp_well_def : pred_wd S wdp_pred}. + +record CSetoid_predicate (S: CSetoid) : Type \def + {csp_pred :> S \to Prop; + csp_strext : pred_strong_ext S csp_pred}. + +lemma csp_wd : \forall S: CSetoid. \forall P: CSetoid_predicate S. + pred_wd S (csp_pred S P). +intros. +elim P. +simplify.unfold pred_wd. +intros. +elim (H x y H1) + [assumption|apply False_ind.apply (eq_imp_not_ap S x y H2 H3)] +qed. + + +(* Same result with CProp instead of Prop: but we just work with Prop (Matita group) *) +(* +Definition pred_strong_ext' : CProp := forall x y : S, P x -> P y or x [#] y. +Definition pred_wd' : Prop := forall x y : S, P x -> x [=] y -> P y. + +Record CSetoid_predicate' : Type := + {csp'_pred :> S -> Prop; + csp'_strext : pred_strong_ext' csp'_pred}. + +Lemma csp'_wd : forall P : CSetoid_predicate', pred_wd' P. +intro P. +intro x; intros y H H0. +elim (csp'_strext P x y H). + +autobatch. + +intro H1. +elimtype False. +generalize H1. +exact (eq_imp_not_ap _ _ _ H0). +Qed. +*) + + + +(*------------------------------------------------------------------------*) +(* --------------------------- Relations on Setoids --------------------- *) +(*------------------------------------------------------------------------*) +(* throughout this section consider (S : CSetoid) and (R : S -> S -> Prop) *) + + +(* Definition rel_wdr : Prop := forall x y z : S, R x y -> y [=] z -> R x z. *) +(* + primo tentativo ma R non e' ben tipato: si puo' fare il cast giusto (carrier di S) + in modo da sfruttare "relation"? + e' concettualmente sbagliato lavorare ad un livello piu' alto (Type) ? *) +(* +definition rel_wdr : \forall S: CSetoid. \forall x,y,z: S. \lambda R: relation S. Prop \def + \lambda S: CSetoid. \lambda x,y,z: S. \lambda R: relation S. + R S x y \to y = z \to R S x z. + +definition rel_wdr : \forall S: CSetoid. \forall x,y,z: (cs_crr S). \lambda R: relation (cs_crr S). Prop \def + \lambda S: CSetoid. \lambda x,y,z: (cs_crr S). \lambda R: relation (cs_crr S). + R (cs_crr S) x y \to y = z \to R (cs_crr S) x z. +*) +definition rel_wdr : \forall S: CSetoid. (S \to S \to Prop) \to Prop \def + \lambda S: CSetoid. \lambda R: (S \to S \to Prop). \forall x,y,z: S. + R x y \to y = z \to R x z. + +(*Definition rel_wdl : Prop := forall x y z : S, R x y -> x [=] z -> R z y.*) +definition rel_wdl : \forall S: CSetoid. (S \to S \to Prop) \to Prop \def + \lambda S: CSetoid. \lambda R: (S \to S \to Prop). \forall x,y,z: S. + R x y \to x = z \to R z y. + +(* Definition rel_strext : CProp := forall x1 x2 y1 y2 : S, R x1 y1 -> (x1 [#] x2 or y1 [#] y2) or R x2 y2. *) +definition rel_strext : \forall S: CSetoid. (S \to S \to Prop) \to Prop \def + \lambda S: CSetoid. \lambda R: (S \to S \to Prop). \forall x1,x2,y1,y2: S. + R x1 y1 \to (x1 \neq x2 \or y1 \neq y2) \or R x2 y2. + + +(* Definition rel_strext_lft : CProp := forall x1 x2 y : S, R x1 y -> x1 [#] x2 or R x2 y. *) +definition rel_strext_lft : \forall S: CSetoid. (S \to S \to Prop) \to Prop \def + \lambda S: CSetoid. \lambda R: (S \to S \to Prop). \forall x1,x2,y: S. + R x1 y \to (x1 \neq x2 \or R x2 y). + +(* Definition rel_strext_rht : CProp := forall x y1 y2 : S, R x y1 -> y1 [#] y2 or R x y2. *) +definition rel_strext_rht : \forall S: CSetoid. (S \to S \to Prop) \to Prop \def + \lambda S: CSetoid. \lambda R: (S \to S \to Prop). \forall x,y1,y2: S. + R x y1 \to (y1 \neq y2 \or R x y2). + + +lemma rel_strext_imp_lftarg : \forall S: CSetoid. \forall R: S \to S \to Prop. + rel_strext S R \to rel_strext_lft S R. +unfold rel_strext. +unfold rel_strext_lft. +intros. +elim (H x1 x2 y y H1) +[elim H2 + [left. assumption + |absurd (y \neq y) [assumption | apply (ap_irreflexive S y)] + ] +|right. assumption +] +qed. + + +lemma rel_strext_imp_rhtarg : \forall S: CSetoid. \forall R: S \to S \to Prop. + rel_strext S R \to rel_strext_rht S R. +unfold rel_strext. +unfold rel_strext_rht. +intros. +elim (H x x y1 y2 H1) +[elim H2 + [absurd (x \neq x) [assumption | apply (ap_irreflexive S x)] + |left. assumption + ] +|right. assumption +] +qed. + + +lemma rel_strextarg_imp_strext : \forall S: CSetoid. \forall R: S \to S \to Prop. + (rel_strext_rht S R) \to (rel_strext_lft S R) \to (rel_strext S R). +unfold rel_strext_rht. +unfold rel_strext_lft. +unfold rel_strext. +intros. +elim ((H x1 y1 y2) H2) +[left. right. assumption +|elim ((H1 x1 x2 y1) H2) + [left. left. assumption + |elim ((H x2 y1 y2) H4) + [left. right. assumption + |right. assumption. + ] + ] +] +qed. + +(* ---------- Definition of a setoid relation ----------------- *) +(* The type of relations over a setoid. *) + +(* TODO +record CSetoid_relation1 (S: CSetoid) : Type \def + {csr_rel : S \to S \to Prop; + csr_wdr : rel_wdr S csr_rel; + csr_wdl : rel_wdl S csr_rel; + csr_strext : rel_strext S csr_rel}. +*) +(* CORN +Record CSetoid_relation : Type := + {csr_rel :> S -> S -> Prop; + csr_wdr : rel_wdr csr_rel; + csr_wdl : rel_wdl csr_rel; + csr_strext : rel_strext csr_rel}. +*) + + +(* ---------- gli stessi risultati di prima ma in CProp ---------*) +(* +Variable R : S -> S -> CProp. +Definition Crel_wdr : CProp := forall x y z : S, R x y -> y [=] z -> R x z. +Definition Crel_wdl : CProp := forall x y z : S, R x y -> x [=] z -> R z y. +Definition Crel_strext : CProp := forall x1 x2 y1 y2 : S, + R x1 y1 -> R x2 y2 or x1 [#] x2 or y1 [#] y2. + +Definition Crel_strext_lft : CProp := forall x1 x2 y : S, R x1 y -> R x2 y or x1 [#] x2. +Definition Crel_strext_rht : CProp := forall x y1 y2 : S, R x y1 -> R x y2 or y1 [#] y2. + +Lemma Crel_strext_imp_lftarg : Crel_strext -> Crel_strext_lft. +Proof. +unfold Crel_strext, Crel_strext_lft in |- *; intros H x1 x2 y H0. +generalize (H x1 x2 y y). +intro H1. +elim (H1 H0). + +autobatch. + +intro H3. +elim H3; intro H4. + +autobatch. +elim (ap_irreflexive _ _ H4). +Qed. + +Lemma Crel_strext_imp_rhtarg : Crel_strext -> Crel_strext_rht. +unfold Crel_strext, Crel_strext_rht in |- *; intros H x y1 y2 H0. +generalize (H x x y1 y2 H0); intro H1. +elim H1; intro H2. + +autobatch. + +elim H2; intro H3. + +elim (ap_irreflexive _ _ H3). + +autobatch. +Qed. + +Lemma Crel_strextarg_imp_strext : + Crel_strext_rht -> Crel_strext_lft -> Crel_strext. +unfold Crel_strext, Crel_strext_lft, Crel_strext_rht in |- *; + intros H H0 x1 x2 y1 y2 H1. +elim (H x1 y1 y2 H1); autobatch. +intro H2. +elim (H0 x1 x2 y2 H2); autobatch. +Qed. +*) + + + + +(* ---- e questo ??????? -----*) + +(*Definition of a [CProp] setoid relation +The type of relations over a setoid. *) +(* +Record CCSetoid_relation : Type := + {Ccsr_rel :> S -> S -> CProp; + Ccsr_strext : Crel_strext Ccsr_rel}. + +Lemma Ccsr_wdr : forall R : CCSetoid_relation, Crel_wdr R. +intro R. +red in |- *; intros x y z H H0. +elim (Ccsr_strext R x x y z H). + +autobatch. + +intro H1; elimtype False. +elim H1; intro H2. + +exact (ap_irreflexive_unfolded _ _ H2). + +generalize H2. +exact (eq_imp_not_ap _ _ _ H0). +Qed. + +Lemma Ccsr_wdl : forall R : CCSetoid_relation, Crel_wdl R. +intro R. +red in |- *; intros x y z H H0. +elim (Ccsr_strext R x z y y H). + +autobatch. + +intro H1; elimtype False. +elim H1; intro H2. + +generalize H2. +exact (eq_imp_not_ap _ _ _ H0). + +exact (ap_irreflexive_unfolded _ _ H2). +Qed. + +Lemma ap_wdr : Crel_wdr (cs_ap (c:=S)). +red in |- *; intros x y z H H0. +generalize (eq_imp_not_ap _ _ _ H0); intro H1. +elim (ap_cotransitive_unfolded _ _ _ H z); intro H2. + +assumption. + +elim H1. +apply ap_symmetric_unfolded. +assumption. +Qed. + +Lemma ap_wdl : Crel_wdl (cs_ap (c:=S)). +red in |- *; intros x y z H H0. +generalize (ap_wdr y x z); intro H1. +apply ap_symmetric_unfolded. +apply H1. + +apply ap_symmetric_unfolded. +assumption. + +assumption. +Qed. + +Lemma ap_wdr_unfolded : forall x y z : S, x [#] y -> y [=] z -> x [#] z. +Proof ap_wdr. + +Lemma ap_wdl_unfolded : forall x y z : S, x [#] y -> x [=] z -> z [#] y. +Proof ap_wdl. + +Lemma ap_strext : Crel_strext (cs_ap (c:=S)). +red in |- *; intros x1 x2 y1 y2 H. +case (ap_cotransitive_unfolded _ _ _ H x2); intro H0. + +autobatch. + +case (ap_cotransitive_unfolded _ _ _ H0 y2); intro H1. + +autobatch. + +right; right. +apply ap_symmetric_unfolded. +assumption. +Qed. + +Definition predS_well_def (P : S -> CProp) : CProp := forall x y : S, + P x -> x [=] y -> P y. + +End CSetoid_relations_and_predicates. + +Declare Left Step ap_wdl_unfolded. +Declare Right Step ap_wdr_unfolded. +*) + + + + + + + + + +(*------------------------------------------------------------------------*) +(* ------------------------- Functions between setoids ------------------ *) +(*------------------------------------------------------------------------*) + +(* Such functions must preserve the setoid equality +and be strongly extensional w.r.t. the apartness, i.e. +if f(x,y) # f(x1,y1), then x # x1 or y # y1. +For every arity this has to be defined separately. *) + +(* throughout this section consider (S1,S2,S3 : CSetoid) and (f : S1 \to S2) *) + +(* First we consider unary functions. *) + +(* +In the following two definitions, +f is a function from (the carrier of) S1 to (the carrier of) S2 *) + +(* Nota: senza le parentesi di (S1 \to S2) non funziona, perche'? *) +definition fun_wd : \forall S1,S2 : CSetoid. (S1 \to S2) \to Prop \def + \lambda S1,S2 : CSetoid.\lambda f : S1 \to S2. \forall x,y : S1. + x = y \to f x = f y. + +definition fun_strext : \forall S1,S2 : CSetoid. (S1 \to S2) \to Prop \def + \lambda S1,S2 : CSetoid.\lambda f : S1 \to S2. \forall x,y : S1. + (f x \neq f y) \to (x \neq y). + +lemma fun_strext_imp_wd : \forall S1,S2 : CSetoid. \forall f : S1 \to S2. + fun_strext S1 S2 f \to fun_wd S1 S2 f. +unfold fun_strext. +unfold fun_wd. +intros. +apply not_ap_imp_eq. +unfold.intro. +apply (eq_imp_not_ap ? ? ? H1). +apply H.assumption. +qed. + +(* funzioni tra setoidi *) +record CSetoid_fun (S1,S2 : CSetoid) : Type \def + {csf_fun : S1 \to S2; + csf_strext : (fun_strext S1 S2 csf_fun)}. + +lemma csf_wd : \forall S1,S2 : CSetoid. \forall f : CSetoid_fun S1 S2. fun_wd S1 S2 (csf_fun S1 S2 f). +intros. +apply fun_strext_imp_wd. +apply csf_strext. +qed. + +definition Const_CSetoid_fun : \forall S1,S2: CSetoid. S2 \to CSetoid_fun S1 S2. +intros. apply (mk_CSetoid_fun S1 S2 (\lambda x:S1.c)). +unfold.intros. +elim (ap_irreflexive ? ? H). +qed. + + +(* ---- Binary functions ------*) +(* throughout this section consider (S1,S2,S3 : CSetoid) and (f : S1 \to S2 \to S3) *) + +definition bin_fun_wd : \forall S1,S2,S3 : CSetoid. (S1 \to S2 \to S3) \to Prop \def + \lambda S1,S2,S3 : CSetoid. \lambda f : S1 \to S2 \to S3. \forall x1,x2: S1. \forall y1,y2: S2. + x1 = x2 \to y1 = y2 \to f x1 y1 = f x2 y2. + +(* +Definition bin_fun_strext : CProp := forall x1 x2 y1 y2, + f x1 y1 [#] f x2 y2 -> x1 [#] x2 or y1 [#] y2. +*) + +definition bin_fun_strext: \forall S1,S2,S3 : CSetoid. (S1 \to S2 \to S3) \to Prop \def + \lambda S1,S2,S3 : CSetoid. \lambda f : S1 \to S2 \to S3. \forall x1,x2: S1. \forall y1,y2: S2. + f x1 y1 \neq f x2 y2 \to x1 \neq x2 \lor y1 \neq y2. + +lemma bin_fun_strext_imp_wd : \forall S1,S2,S3: CSetoid.\forall f:S1 \to S2 \to S3. +bin_fun_strext ? ? ? f \to bin_fun_wd ? ? ? f. +intros.unfold in H. +unfold.intros. +apply not_ap_imp_eq.unfold.intro. +elim (H x1 x2 y1 y2 H3). +apply (eq_imp_not_ap ? ? ? H1 H4). +apply (eq_imp_not_ap ? ? ? H2 H4). +qed. + + + +record CSetoid_bin_fun (S1,S2,S3: CSetoid) : Type \def + {csbf_fun :2> S1 \to S2 \to S3; + csbf_strext : (bin_fun_strext S1 S2 S3 csbf_fun)}. + +lemma csbf_wd : \forall S1,S2,S3: CSetoid. \forall f : CSetoid_bin_fun S1 S2 S3. + bin_fun_wd S1 S2 S3 (csbf_fun S1 S2 S3 f). +intros. +apply bin_fun_strext_imp_wd. +apply csbf_strext. +qed. + +lemma csf_wd_unfolded : \forall S1,S2: CSetoid. \forall f : CSetoid_fun S1 S2. \forall x,x' : S1. + x = x' \to (csf_fun S1 S2 f) x = (csf_fun S1 S2 f) x'. +intros. +apply (csf_wd S1 S2 f x x'). +assumption. +qed. + +lemma csf_strext_unfolded : \forall S1,S2: CSetoid. \forall f : CSetoid_fun S1 S2. \forall x,y : S1. +(csf_fun S1 S2 f) x \neq (csf_fun S1 S2 f) y \to x \neq y. +intros. +apply (csf_strext S1 S2 f x y). +assumption. +qed. + +lemma csbf_wd_unfolded : \forall S1,S2,S3 : CSetoid. \forall f : CSetoid_bin_fun S1 S2 S3. \forall x,x':S1. +\forall y,y' : S2. x = x' \to y = y' \to (csbf_fun S1 S2 S3 f) x y = (csbf_fun S1 S2 S3 f) x' y'. +intros. +apply (csbf_wd S1 S2 S3 f x x' y y'); assumption. +qed. + +(* Hint Resolve csf_wd_unfolded csbf_wd_unfolded: algebra_c.*) + +(* The unary and binary (inner) operations on a csetoid +An operation is a function with domain(s) and co-domain equal. *) + +(* Properties of binary operations *) + +definition commutes : \forall S: CSetoid. (S \to S \to S) \to Prop \def + \lambda S: CSetoid. \lambda f : S \to S \to S. + \forall x,y : S. f x y = f y x. + +definition CSassociative : \forall S: CSetoid. \forall f: S \to S \to S. Prop \def +\lambda S: CSetoid. \lambda f : S \to S \to S. +\forall x,y,z : S. + f x (f y z) = f (f x y) z. + +definition un_op_wd : \forall S:CSetoid. (S \to S) \to Prop \def +\lambda S: CSetoid. \lambda f: (S \to S). fun_wd S S f. + + +definition un_op_strext: \forall S:CSetoid. (S \to S) \to Prop \def +\lambda S:CSetoid. \lambda f: (S \to S). fun_strext S S f. + + +definition CSetoid_un_op : CSetoid \to Type \def +\lambda S:CSetoid. CSetoid_fun S S. + +definition mk_CSetoid_un_op : \forall S:CSetoid. \forall f: S \to S. fun_strext S S f \to CSetoid_fun S S + \def +\lambda S:CSetoid. \lambda f: S \to S. mk_CSetoid_fun S S f. + +lemma id_strext : \forall S:CSetoid. un_op_strext S (\lambda x:S. x). +unfold un_op_strext. +unfold fun_strext. +intros. +simplify in H. +exact H. +qed. + +lemma id_pres_eq : \forall S:CSetoid. un_op_wd S (\lambda x : S.x). +unfold un_op_wd. +unfold fun_wd. +intros. +simplify. +exact H. +qed. + +definition id_un_op : \forall S:CSetoid. CSetoid_un_op S + \def \lambda S: CSetoid. mk_CSetoid_un_op S (\lambda x : cs_crr S.x) (id_strext S). + +definition un_op_fun: \forall S:CSetoid. CSetoid_un_op S \to CSetoid_fun S S +\def \lambda S.\lambda f.f. + +coercion cic:/matita/algebra/CoRN/Setoid/un_op_fun.con. + +definition cs_un_op_strext : \forall S:CSetoid. \forall f: CSetoid_fun S S. fun_strext S S (csf_fun S S f) \def +\lambda S:CSetoid. \lambda f : CSetoid_fun S S. csf_strext S S f. + +lemma un_op_wd_unfolded : \forall S:CSetoid. \forall op : CSetoid_un_op S. +\forall x, y : S. +x = y \to (csf_fun S S op) x = (csf_fun S S op) y. +intros. +apply (csf_wd S S ?).assumption. +qed. + +lemma un_op_strext_unfolded : \forall S:CSetoid. \forall op : CSetoid_un_op S. +\forall x, y : S. + (csf_fun S S op) x \neq (csf_fun S S op) y \to x \neq y. +exact cs_un_op_strext. +qed. + + +(* Well-defined binary operations on a setoid. *) + +definition bin_op_wd : \forall S:CSetoid. (S \to S \to S) \to Prop \def +\lambda S:CSetoid. bin_fun_wd S S S. + +definition bin_op_strext : \forall S:CSetoid. (S \to S \to S) \to Prop \def +\lambda S:CSetoid. bin_fun_strext S S S. + +definition CSetoid_bin_op : CSetoid \to Type \def +\lambda S:CSetoid. CSetoid_bin_fun S S S. + + +definition mk_CSetoid_bin_op : \forall S:CSetoid. \forall f: S \to S \to S. +bin_fun_strext S S S f \to CSetoid_bin_fun S S S \def + \lambda S:CSetoid. \lambda f: S \to S \to S. + mk_CSetoid_bin_fun S S S f. + +(* da controllare che sia ben tipata +definition cs_bin_op_wd : \forall S:CSetoid. ? \def +\lambda S:CSetoid. csbf_wd S S S. +*) +definition cs_bin_op_wd : \forall S:CSetoid. \forall f: CSetoid_bin_fun S S S. bin_fun_wd S S S (csbf_fun S S S f) \def +\lambda S:CSetoid. csbf_wd S S S. + +definition cs_bin_op_strext : \forall S:CSetoid. \forall f: CSetoid_bin_fun S S S. bin_fun_strext S S S (csbf_fun S S S f) \def +\lambda S:CSetoid. csbf_strext S S S. + + + +(* Identity Coercion bin_op_bin_fun : CSetoid_bin_op >-> CSetoid_bin_fun. *) + +definition bin_op_bin_fun: \forall S:CSetoid. CSetoid_bin_op S \to CSetoid_bin_fun S S S +\def \lambda S.\lambda f.f. + +coercion cic:/matita/algebra/CoRN/Setoid/bin_op_bin_fun.con. + + + + +lemma bin_op_wd_unfolded :\forall S:CSetoid. \forall op : CSetoid_bin_op S. \forall x1, x2, y1, y2 : S. + x1 = x2 \to y1 = y2 \to (csbf_fun S S S op) x1 y1 = (csbf_fun S S S op) x2 y2. +exact cs_bin_op_wd. +qed. + +lemma bin_op_strext_unfolded : \forall S:CSetoid. \forall op : CSetoid_bin_op S. \forall x1, x2, y1, y2 : S. + (csbf_fun S S S op) x1 y1 \neq (csbf_fun S S S op) x2 y2 \to x1 \neq x2 \lor y1 \neq y2. +exact cs_bin_op_strext. +qed. + +lemma bin_op_is_wd_un_op_lft : \forall S:CSetoid. \forall op : CSetoid_bin_op S. \forall c : cs_crr S. + un_op_wd S (\lambda x : cs_crr S. ((csbf_fun S S S op) x c)). +intros. unfold. unfold. +intros. apply bin_op_wd_unfolded [ assumption | apply eq_reflexive_unfolded ] +qed. + +lemma bin_op_is_wd_un_op_rht : \forall S:CSetoid. \forall op : CSetoid_bin_op S. \forall c : cs_crr S. + un_op_wd S (\lambda x : cs_crr S. ((csbf_fun S S S op) c x)). +intros. unfold. unfold. +intros. apply bin_op_wd_unfolded [ apply eq_reflexive_unfolded | assumption ] +qed. + + +lemma bin_op_is_strext_un_op_lft : \forall S:CSetoid. \forall op : CSetoid_bin_op S. \forall c : cs_crr S. + un_op_strext S (\lambda x : cs_crr S. ((csbf_fun S S S op) x c)). +intros. unfold un_op_strext. unfold fun_strext. +intros. +cut (x \neq y \lor c \neq c) +[ elim Hcut + [ assumption + | generalize in match (ap_irreflexive_unfolded ? ? H1). intro. elim H2 + ] +| apply (bin_op_strext_unfolded S op x y c c). assumption. +] +qed. + +lemma bin_op_is_strext_un_op_rht : \forall S:CSetoid. \forall op : CSetoid_bin_op S. \forall c : cs_crr S. + un_op_strext S (\lambda x : cs_crr S. ((csbf_fun S S S op) c x)). +intros. unfold un_op_strext. unfold fun_strext. +intros. +cut (c \neq c \lor x \neq y) +[ elim Hcut + [ generalize in match (ap_irreflexive_unfolded ? ? H1). intro. elim H2 + | assumption + ] +| apply (bin_op_strext_unfolded S op c c x y). assumption. +] +qed. + +definition bin_op2un_op_rht : \forall S:CSetoid. \forall op : CSetoid_bin_op S. +\forall c : cs_crr S. CSetoid_un_op S \def + \lambda S:CSetoid. \lambda op: CSetoid_bin_op S. \lambda c : cs_crr S. + mk_CSetoid_un_op S (\lambda x:cs_crr S. ((csbf_fun S S S op) c x)) + (bin_op_is_strext_un_op_rht S op c). + +definition bin_op2un_op_lft : \forall S:CSetoid. \forall op : CSetoid_bin_op S. +\forall c : cs_crr S. CSetoid_un_op S \def + \lambda S:CSetoid. \lambda op: CSetoid_bin_op S. \lambda c : cs_crr S. + mk_CSetoid_un_op S (\lambda x:cs_crr S. ((csbf_fun S S S op) x c)) + (bin_op_is_strext_un_op_lft S op c). + +(* +Definition bin_op2un_op_rht (op : CSetoid_bin_op) (c : S) : CSetoid_un_op := + Build_CSetoid_un_op (fun x : S => op c x) (bin_op_is_strext_un_op_rht op c). + + +Definition bin_op2un_op_lft (op : CSetoid_bin_op) (c : S) : CSetoid_un_op := + Build_CSetoid_un_op (fun x : S => op x c) (bin_op_is_strext_un_op_lft op c). +*) + + +(* +Implicit Arguments commutes [S]. +Implicit Arguments associative [S]. +Hint Resolve bin_op_wd_unfolded un_op_wd_unfolded: algebra_c. +*) + +(*The binary outer operations on a csetoid*) + + +(* +Well-defined outer operations on a setoid. +*) +definition outer_op_well_def : \forall S1,S2:CSetoid. (S1 \to S2 \to S2) \to Prop \def +\lambda S1,S2:CSetoid. bin_fun_wd S1 S2 S2. + +definition outer_op_strext : \forall S1,S2:CSetoid. (S1 \to S2 \to S2) \to Prop \def +\lambda S1,S2:CSetoid. bin_fun_strext S1 S2 S2. + +definition CSetoid_outer_op : \forall S1,S2:CSetoid.Type \def +\lambda S1,S2:CSetoid. + CSetoid_bin_fun S1 S2 S2. + +definition mk_CSetoid_outer_op : \forall S1,S2:CSetoid. +\forall f : S1 \to S2 \to S2. +bin_fun_strext S1 S2 S2 f \to CSetoid_bin_fun S1 S2 S2 \def +\lambda S1,S2:CSetoid. +mk_CSetoid_bin_fun S1 S2 S2. + +definition csoo_wd : \forall S1,S2:CSetoid. \forall f : CSetoid_bin_fun S1 S2 S2. +bin_fun_wd S1 S2 S2 (csbf_fun S1 S2 S2 f) \def +\lambda S1,S2:CSetoid. +csbf_wd S1 S2 S2. + +definition csoo_strext : \forall S1,S2:CSetoid. +\forall f : CSetoid_bin_fun S1 S2 S2. +bin_fun_strext S1 S2 S2 (csbf_fun S1 S2 S2 f) \def +\lambda S1,S2:CSetoid. +csbf_strext S1 S2 S2. + + +definition outer_op_bin_fun: \forall S:CSetoid. +CSetoid_outer_op S S \to CSetoid_bin_fun S S S +\def \lambda S.\lambda f.f. + +coercion cic:/matita/algebra/CoRN/Setoid/outer_op_bin_fun.con. +(* begin hide +Identity Coercion outer_op_bin_fun : CSetoid_outer_op >-> CSetoid_bin_fun. +end hide *) + +lemma csoo_wd_unfolded :\forall S:CSetoid. \forall op : CSetoid_outer_op S S. +\forall x1, x2, y1, y2 : S. + x1 = x2 -> y1 = y2 -> (csbf_fun S S S op) x1 y1 = (csbf_fun S S S op) x2 y2. +intros. +apply csoo_wd[assumption|assumption] +qed. + +(* +Hint Resolve csoo_wd_unfolded: algebra_c. +*) + + + +(*---------------------------------------------------------------*) +(*--------------------------- Subsetoids ------------------------*) +(*---------------------------------------------------------------*) + +(* Let S be a setoid, and P a predicate on the carrier of S *) +(* Variable P : S -> CProp *) + +record subcsetoid_crr (S: CSetoid) (P: S \to Prop) : Type \def + {scs_elem :> S; + scs_prf : P scs_elem}. + +definition restrict_relation : \forall S:CSetoid. \forall R : S \to S \to Prop. + \forall P: S \to Prop. relation (subcsetoid_crr S P) \def + \lambda S:CSetoid. \lambda R : S \to S \to Prop. + \lambda P: S \to Prop. \lambda a,b: subcsetoid_crr S P. + match a with + [ (mk_subcsetoid_crr x H) \Rightarrow + match b with + [ (mk_subcsetoid_crr y H) \Rightarrow R x y ] + ]. +(* CPROP +definition Crestrict_relation (R : Crelation S) : Crelation subcsetoid_crr := + fun a b : subcsetoid_crr => + match a, b with + | Build_subcsetoid_crr x _, Build_subcsetoid_crr y _ => R x y + end. +*) + +definition subcsetoid_eq : \forall S:CSetoid. \forall P: S \to Prop. + relation (subcsetoid_crr S P)\def + \lambda S:CSetoid. + restrict_relation S (cs_eq S). + +definition subcsetoid_ap : \forall S:CSetoid. \forall P: S \to Prop. + relation (subcsetoid_crr S P)\def + \lambda S:CSetoid. + restrict_relation S (cs_ap S). + +(* N.B. da spostare in relations.ma... *) +definition equiv : \forall A: Type. \forall R: relation A. Prop \def + \lambda A: Type. \lambda R: relation A. + (reflexive A R) \land (transitive A R) \land (symmetric A R). + +remark subcsetoid_equiv : \forall S:CSetoid. \forall P: S \to Prop. +equiv ? (subcsetoid_eq S P). +intros. unfold equiv. split +[split + [unfold. intro. elim x. simplify. apply (eq_reflexive S) + |unfold. intros 3. elim y 2. + elim x 2. elim z 2. simplify. + exact (eq_transitive ? c1 c c2) + ] +| unfold. intros 2. elim x 2. elim y 2. simplify. exact (eq_symmetric ? c c1). +] +qed. + +(* +axiom subcsetoid_is_CSetoid : \forall S:CSetoid. \forall P: S \to Prop. +is_CSetoid ? (subcsetoid_eq S P) (subcsetoid_ap S P). +*) + +lemma subcsetoid_is_CSetoid : \forall S:CSetoid. \forall P: S \to Prop. +is_CSetoid ? (subcsetoid_eq S P) (subcsetoid_ap S P). +intros. +apply (mk_is_CSetoid ? (subcsetoid_eq S P) (subcsetoid_ap S P)) +[ unfold. intros.unfold. elim x. exact (ap_irreflexive_unfolded S ? ?) + [ assumption | simplify in H1. exact H1 ] + (* irreflexive *) +|unfold. intros 2. elim x. generalize in match H1. elim y.simplify in H3. simplify. +exact (ap_symmetric ? ? ? H3) +(* cotransitive *) +|unfold.intros 2. elim x.generalize in match H1. elim y. elim z.simplify. simplify in H3. +apply (ap_cotransitive ? ? ? H3) +(* tight *) +|unfold.intros.elim x. elim y.simplify. +apply (ap_tight S ? ?)] +qed. + + +definition mk_SubCSetoid : \forall S:CSetoid. \forall P: S \to Prop. CSetoid \def +\lambda S:CSetoid. \lambda P:S \to Prop. +mk_CSetoid (subcsetoid_crr S P) (subcsetoid_eq S P) (subcsetoid_ap S P) (subcsetoid_is_CSetoid S P). + +(* Subsetoid unary operations +%\begin{convention}% +Let [f] be a unary setoid operation on [S]. +%\end{convention}% +*) + +(* Section SubCSetoid_unary_operations. +Variable f : CSetoid_un_op S. +*) + +definition un_op_pres_pred : \forall S:CSetoid. \forall P: S \to Prop. + CSetoid_un_op S \to Prop \def + \lambda S:CSetoid. \lambda P: S \to Prop. \lambda f: CSetoid_un_op S. + \forall x : cs_crr S. P x \to P ((csf_fun S S f) x). + +definition restr_un_op : \forall S:CSetoid. \forall P: S \to Prop. + \forall f: CSetoid_un_op S. \forall pr: un_op_pres_pred S P f. + subcsetoid_crr S P \to subcsetoid_crr S P \def + \lambda S:CSetoid. \lambda P: S \to Prop. \lambda f: CSetoid_un_op S. + \lambda pr : un_op_pres_pred S P f.\lambda a: subcsetoid_crr S P. + match a with + [ (mk_subcsetoid_crr x p) \Rightarrow + (mk_subcsetoid_crr ? ? ((csf_fun S S f) x) (pr x p))]. + +(* TODO *) +lemma restr_un_op_wd : \forall S:CSetoid. \forall P: S \to Prop. +\forall f: CSetoid_un_op S. \forall pr: un_op_pres_pred S P f. +un_op_wd (mk_SubCSetoid S P) (restr_un_op S P f pr). +intros. +unfold.unfold.intros 2.elim x 2.elim y 2. +simplify. +intro. +reduce in H2. +apply (un_op_wd_unfolded ? f ? ? H2). +qed. + +lemma restr_un_op_strext : \forall S:CSetoid. \forall P: S \to Prop. +\forall f: CSetoid_un_op S. \forall pr: un_op_pres_pred S P f. +un_op_strext (mk_SubCSetoid S P) (restr_un_op S P f pr). +intros.unfold.unfold. intros 2.elim y 2. elim x 2. +intros.reduce in H2. +apply (cs_un_op_strext ? f ? ? H2). +qed. + +definition mk_SubCSetoid_un_op : \forall S:CSetoid. \forall P: S \to Prop. \forall f: CSetoid_un_op S. + \forall pr:un_op_pres_pred S P f. CSetoid_un_op (mk_SubCSetoid S P). + intros (S P f pr). + apply (mk_CSetoid_un_op (mk_SubCSetoid S P) (restr_un_op S P f pr) (restr_un_op_strext S P f pr)). + qed. + +(* BUG Universe Inconsistency detected + definition mk_SubCSetoid_un_op : \forall S:CSetoid. \forall P: S \to Prop. \forall f: CSetoid_un_op S. + \forall pr:un_op_pres_pred S P f. CSetoid_un_op (mk_SubCSetoid S P) \def + \lambda S:CSetoid. \lambda P: S \to Prop. \lambda f: CSetoid_un_op S. + \lambda pr:un_op_pres_pred S P f. + mk_CSetoid_un_op (mk_SubCSetoid S P) (restr_un_op S P f pr) (restr_un_op_strext S P f pr). +*) + +(* Subsetoid binary operations +Let [f] be a binary setoid operation on [S]. +*) + +(* Section SubCSetoid_binary_operations. +Variable f : CSetoid_bin_op S. +*) + +definition bin_op_pres_pred : \forall S:CSetoid. \forall P: S \to Prop. +(CSetoid_bin_op S) \to Prop \def + \lambda S:CSetoid. \lambda P: S \to Prop. \lambda f: CSetoid_bin_op S. + \forall x,y : S. P x \to P y \to P ( (csbf_fun S S S f) x y). + +(* +Assume [bin_op_pres_pred]. +*) + +(* Variable pr : bin_op_pres_pred. *) + +definition restr_bin_op : \forall S:CSetoid. \forall P:S \to Prop. + \forall f: CSetoid_bin_op S.\forall op : (bin_op_pres_pred S P f). + \forall a, b : subcsetoid_crr S P. subcsetoid_crr S P \def + \lambda S:CSetoid. \lambda P:S \to Prop. + \lambda f: CSetoid_bin_op S. \lambda pr : (bin_op_pres_pred S P f). + \lambda a, b : subcsetoid_crr S P. + match a with + [ (mk_subcsetoid_crr x p) \Rightarrow + match b with + [ (mk_subcsetoid_crr y q) \Rightarrow + (mk_subcsetoid_crr ? ? ((csbf_fun S S S f) x y) (pr x y p q))] + ]. + + +(* TODO *) +lemma restr_bin_op_well_def : \forall S:CSetoid. \forall P: S \to Prop. +\forall f: CSetoid_bin_op S. \forall pr: bin_op_pres_pred S P f. +bin_op_wd (mk_SubCSetoid S P) (restr_bin_op S P f pr). +intros. +unfold.unfold.intros 2.elim x1 2. elim x2 2.intros 2. elim y1 2. elim y2 2. +simplify. +intros. +reduce in H4. +reduce in H5. +apply (cs_bin_op_wd ? f ? ? ? ? H4 H5). +qed. + +lemma restr_bin_op_strext : \forall S:CSetoid. \forall P: S \to Prop. +\forall f: CSetoid_bin_op S. \forall pr: bin_op_pres_pred S P f. +bin_op_strext (mk_SubCSetoid S P) (restr_bin_op S P f pr). +intros.unfold.unfold. intros 2.elim x1 2. elim x2 2.intros 2. elim y1 2. elim y2 2. +simplify.intros. +reduce in H4. +apply (cs_bin_op_strext ? f ? ? ? ? H4). +qed. + +definition mk_SubCSetoid_bin_op : \forall S:CSetoid. \forall P: S \to Prop. + \forall f: CSetoid_bin_op S. \forall pr: bin_op_pres_pred S P f. + CSetoid_bin_op (mk_SubCSetoid S P). + intros (S P f pr). + apply (mk_CSetoid_bin_op (mk_SubCSetoid S P) (restr_bin_op S P f pr)(restr_bin_op_strext S P f pr)). + qed. + +(* BUG Universe Inconsistency detected +definition mk_SubCSetoid_bin_op : \forall S:CSetoid. \forall P: S \to Prop. + \forall f: CSetoid_bin_op S. \forall pr: bin_op_pres_pred S P f. + CSetoid_bin_op (mk_SubCSetoid S P) \def + \lambda S:CSetoid. \lambda P: S \to Prop. + \lambda f: CSetoid_bin_op S. \lambda pr: bin_op_pres_pred S P f. + mk_CSetoid_bin_op (mk_SubCSetoid S P) (restr_bin_op S P f pr)(restr_bin_op_strext S P f pr). +*) + +lemma restr_f_assoc : \forall S:CSetoid. \forall P: S \to Prop. + \forall f: CSetoid_bin_op S. \forall pr: bin_op_pres_pred S P f. + CSassociative S (csbf_fun S S S f) + \to CSassociative (mk_SubCSetoid S P) (csbf_fun (mk_SubCSetoid S P) (mk_SubCSetoid S P) (mk_SubCSetoid S P) (mk_SubCSetoid_bin_op S P f pr)). +intros 4. +intro. +unfold. +intros 3. +elim z 2.elim y 2. elim x 2. +whd. +apply H. +qed. + +definition caseZ_diff: \forall A:Type.Z \to (nat \to nat \to A) \to A \def +\lambda A:Type.\lambda z:Z.\lambda f:nat \to nat \to A. + match z with + [OZ \Rightarrow f O O + |(pos n) \Rightarrow f (S n) O + |(neg n) \Rightarrow f O (S n)]. + +(* Zminus.ma *) +theorem Zminus_S_S : \forall n,m:nat. +Z_of_nat (S n) - S m = Z_of_nat n - m. +intros. +elim n.elim m.simplify. reflexivity.reflexivity. +elim m.simplify.reflexivity.reflexivity. +qed. + + + +lemma proper_caseZ_diff_CS : \forall CS : CSetoid. \forall f : nat \to nat \to CS. + (\forall m,n,p,q : nat. eq nat (plus m q) (plus n p) \to (f m n) = (f p q)) \to + \forall m,n : nat. caseZ_diff CS (Zminus (Z_of_nat m) (Z_of_nat n)) f = (f m n). +intros. +(* perche' apply nat_elim2 non funziona?? *) +apply (nat_elim2 (\lambda m,n.caseZ_diff CS (Zminus (Z_of_nat m) (Z_of_nat n)) f = f m n)). +intro.simplify. +apply (nat_case n1).simplify. +apply eq_reflexive. +intro.simplify.apply eq_reflexive. +intro.simplify.apply eq_reflexive. +intros 2. +rewrite > (Zminus_S_S n1 m1). +intros. +cut (f n1 m1 = f (S n1) (S m1)). +apply eq_symmetric_unfolded. +apply eq_transitive. +apply f. apply n1. apply m1. +apply eq_symmetric_unfolded.assumption. +apply eq_symmetric_unfolded.assumption. +apply H. +autobatch new. +qed. + +(* +Finally, we characterize functions defined on the natural numbers also as setoid functions, similarly to what we already did for predicates. +*) + + +definition nat_less_n_fun : \forall S:CSetoid. \forall n:nat. ? \def + \lambda S:CSetoid. \lambda n:nat. \lambda f: \forall i:nat. i < n \to S. + \forall i,j : nat. eq nat i j \to (\forall H : i < n. + \forall H' : j < n . (f i H) = (f j H')). + +definition nat_less_n_fun' : \forall S:CSetoid. \forall n:nat. ? \def + \lambda S:CSetoid. \lambda n:nat. \lambda f: \forall i: nat. i <= n \to S. + \forall i,j : nat. eq nat i j \to \forall H : i <= n. + \forall H' : j <= n. f i H = f j H'. diff --git a/matita/library/algebra/finite_groups.ma b/matita/library/algebra/finite_groups.ma new file mode 100644 index 000000000..4048803e6 --- /dev/null +++ b/matita/library/algebra/finite_groups.ma @@ -0,0 +1,401 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "algebra/groups.ma". + +record finite_enumerable (T:Type) : Type≝ + { order: nat; + repr: nat → T; + index_of: T → nat; + index_of_sur: ∀x.index_of x ≤ order; + index_of_repr: ∀n. n≤order → index_of (repr n) = n; + repr_index_of: ∀x. repr (index_of x) = x + }. + +notation "hvbox(C \sub i)" with precedence 89 +for @{ 'repr $C $i }. + +(* CSC: multiple interpretations in the same file are not considered in the + right order +interpretation "Finite_enumerable representation" 'repr C i = + (cic:/matita/algebra/finite_groups/repr.con C _ i).*) + +notation < "hvbox(|C|)" with precedence 89 +for @{ 'card $C }. + +interpretation "Finite_enumerable order" 'card C = + (cic:/matita/algebra/finite_groups/order.con C _). + +record finite_enumerable_SemiGroup : Type≝ + { semigroup:> SemiGroup; + is_finite_enumerable:> finite_enumerable semigroup + }. + +interpretation "Finite_enumerable representation" 'repr S i = + (cic:/matita/algebra/finite_groups/repr.con S + (cic:/matita/algebra/finite_groups/is_finite_enumerable.con S) i). + +notation "hvbox(ι e)" with precedence 60 +for @{ 'index_of_finite_enumerable_semigroup $e }. + +interpretation "Index_of_finite_enumerable representation" + 'index_of_finite_enumerable_semigroup e += + (cic:/matita/algebra/finite_groups/index_of.con _ + (cic:/matita/algebra/finite_groups/is_finite_enumerable.con _) e). + + +(* several definitions/theorems to be moved somewhere else *) + +theorem pigeonhole: + ∀n:nat.∀f:nat→nat. + (∀x,y.x≤n → y≤n → f x = f y → x=y) → + (∀m. m ≤ n → f m ≤ n) → + ∀x. x≤n → ∃y.f y = x ∧ y ≤ n. +intro; +elim n; +[ apply (ex_intro ? ? O); + split; + [ rewrite < (le_n_O_to_eq ? H2); + rewrite < (le_n_O_to_eq ? (H1 O ?)); + [ reflexivity + | apply le_n + ] + | apply le_n + ] +| clear n; + letin f' ≝ + (λx. + let fSn1 ≝f (S n1) in + let fx ≝f x in + match ltb fSn1 fx with + [ true ⇒ pred fx + | false ⇒ fx + ]); + cut (∀x,y. x ≤ n1 → y ≤ n1 → f' x = f' y → x=y); + [ cut (∀x. x ≤ n1 → f' x ≤ n1); + [ apply (nat_compare_elim (f (S n1)) x); + [ intro; + elim (H f' ? ? (pred x)); + [ simplify in H5; + clear Hcut; + clear Hcut1; + clear f'; + elim H5; + clear H5; + apply (ex_intro ? ? a); + split; + [ generalize in match (eq_f ? ? S ? ? H6); + clear H6; + intro; + rewrite < S_pred in H5; + [ generalize in match H4; + clear H4; + rewrite < H5; + clear H5; + apply (ltb_elim (f (S n1)) (f a)); + [ simplify; + intros; + rewrite < S_pred; + [ reflexivity + | apply (ltn_to_ltO ? ? H4) + ] + | simplify; + intros; + generalize in match (not_lt_to_le ? ? H4); + clear H4; + intro; + generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5); + intro; + generalize in match (H1 ? ? ? ? H4); + [ intro; + generalize in match (le_n_m_to_lt_m_Sn_to_eq_n_m ? ? H6 H5); + intro; + generalize in match (H1 ? ? ? ? H9); + [ intro; + rewrite > H10 in H7; + elim (not_le_Sn_n ? H7) + | rewrite > H8; + apply le_n + | apply le_n + ] + | apply le_S; + assumption + | apply le_n + ] + ] + | apply (ltn_to_ltO ? ? H4) + ] + | apply le_S; + assumption + ] + | apply Hcut + | apply Hcut1 + | apply le_S_S_to_le; + rewrite < S_pred; + [ assumption + | apply (ltn_to_ltO ? ? H4) + ] + ] + | intros; + apply (ex_intro ? ? (S n1)); + split; + [ assumption + | constructor 1 + ] + | intro; + elim (H f' ? ? x); + [ simplify in H5; + clear Hcut; + clear Hcut1; + clear f'; + elim H5; + clear H5; + apply (ex_intro ? ? a); + split; + [ generalize in match H4; + clear H4; + rewrite < H6; + clear H6; + apply (ltb_elim (f (S n1)) (f a)); + [ simplify; + intros; + generalize in match (lt_to_lt_S_S ? ? H5); + intro; + rewrite < S_pred in H6; + [ elim (lt_n_m_to_not_lt_m_Sn ? ? H4 H6) + | apply (ltn_to_ltO ? ? H4) + ] + | simplify; + intros; + reflexivity + ] + | apply le_S; + assumption + ] + | apply Hcut + | apply Hcut1 + | rewrite > (pred_Sn n1); + simplify; + generalize in match (H2 (S n1)); + intro; + generalize in match (lt_to_le_to_lt ? ? ? H4 (H5 (le_n ?))); + intro; + unfold lt in H6; + apply le_S_S_to_le; + assumption + ] + ] + | unfold f'; + simplify; + intro; + apply (ltb_elim (f (S n1)) (f x1)); + simplify; + intros; + [ generalize in match (H2 x1); + intro; + change in match n1 with (pred (S n1)); + apply le_to_le_pred; + apply H6; + apply le_S; + assumption + | generalize in match (H2 (S n1) (le_n ?)); + intro; + generalize in match (not_lt_to_le ? ? H4); + intro; + generalize in match (transitive_le ? ? ? H7 H6); + intro; + cut (f x1 ≠ f (S n1)); + [ generalize in match (not_eq_to_le_to_lt ? ? Hcut1 H7); + intro; + unfold lt in H9; + generalize in match (transitive_le ? ? ? H9 H6); + intro; + apply le_S_S_to_le; + assumption + | unfold Not; + intro; + generalize in match (H1 ? ? ? ? H9); + [ intro; + rewrite > H10 in H5; + apply (not_le_Sn_n ? H5) + | apply le_S; + assumption + | apply le_n + ] + ] + ] + ] + | intros 4; + unfold f'; + simplify; + apply (ltb_elim (f (S n1)) (f x1)); + simplify; + apply (ltb_elim (f (S n1)) (f y)); + simplify; + intros; + [ cut (f x1 = f y); + [ apply (H1 ? ? ? ? Hcut); + apply le_S; + assumption + | alias id "eq_pred_to_eq" = "cic:/matita/nat/relevant_equations/eq_pred_to_eq.con". +apply eq_pred_to_eq; + [ apply (ltn_to_ltO ? ? H7) + | apply (ltn_to_ltO ? ? H6) + | assumption + ] + ] + | (* pred (f x1) = f y absurd since y ≠ S n1 and thus f y ≠ f (S n1) + so that f y < f (S n1) < f x1; hence pred (f x1) = f y is absurd *) + cut (y < S n1); + [ generalize in match (lt_to_not_eq ? ? Hcut); + intro; + cut (f y ≠ f (S n1)); + [ cut (f y < f (S n1)); + [ rewrite < H8 in Hcut2; + unfold lt in Hcut2; + unfold lt in H7; + generalize in match (le_S_S ? ? Hcut2); + intro; + generalize in match (transitive_le ? ? ? H10 H7); + intros; + rewrite < (S_pred (f x1)) in H11; + [ elim (not_le_Sn_n ? H11) + | fold simplify ((f (S n1)) < (f x1)) in H7; + apply (ltn_to_ltO ? ? H7) + ] + | apply not_eq_to_le_to_lt; + [ assumption + | apply not_lt_to_le; + assumption + ] + ] + | unfold Not; + intro; + apply H9; + apply (H1 ? ? ? ? H10); + [ apply lt_to_le; + assumption + | constructor 1 + ] + ] + | unfold lt; + apply le_S_S; + assumption + ] + | (* f x1 = pred (f y) absurd since it implies S (f x1) = f y and + f x1 ≤ f (S n1) < f y = S (f x1) so that f x1 = f (S n1); by + injectivity x1 = S n1 that is absurd since x1 ≤ n1 *) + generalize in match (eq_f ? ? S ? ? H8); + intro; + rewrite < S_pred in H9; + [ rewrite < H9 in H6; + generalize in match (not_lt_to_le ? ? H7); + intro; + unfold lt in H6; + generalize in match (le_S_S ? ? H10); + intro; + generalize in match (antisym_le ? ? H11 H6); + intro; + generalize in match (inj_S ? ? H12); + intro; + generalize in match (H1 ? ? ? ? H13); + [ intro; + rewrite > H14 in H4; + elim (not_le_Sn_n ? H4) + | apply le_S; + assumption + | apply le_n + ] + | apply (ltn_to_ltO ? ? H6) + ] + | apply (H1 ? ? ? ? H8); + apply le_S; + assumption + ] + ] +]. +qed. +(* demo *) +theorem finite_enumerable_SemiGroup_to_left_cancellable_to_right_cancellable_to_isMonoid: + ∀G:finite_enumerable_SemiGroup. + left_cancellable ? (op G) → + right_cancellable ? (op G) → + ∃e:G. isMonoid (mk_PreMonoid G e). +intros; +letin f ≝(λn.ι(G \sub O · G \sub n)); +cut (∀n.n ≤ order ? (is_finite_enumerable G) → ∃m.f m = n); +[ letin EX ≝(Hcut O ?); + [ apply le_O_n + | clearbody EX; + clear Hcut; + unfold f in EX; + elim EX; + clear EX; + letin HH ≝(eq_f ? ? (repr ? (is_finite_enumerable G)) ? ? H2); + clearbody HH; + rewrite > (repr_index_of ? (is_finite_enumerable G)) in HH; + apply (ex_intro ? ? (G \sub a)); + letin GOGO ≝(refl_eq ? (repr ? (is_finite_enumerable G) O)); + clearbody GOGO; + rewrite < HH in GOGO; + rewrite < HH in GOGO:(? ? % ?); + rewrite > (op_associative ? G) in GOGO; + letin GaGa ≝(H ? ? ? GOGO); + clearbody GaGa; + clear GOGO; + constructor 1; + [ simplify; + apply (semigroup_properties G) + | unfold is_left_unit; intro; + letin GaxGax ≝(refl_eq ? (G \sub a ·x)); + clearbody GaxGax; (* demo *) + rewrite < GaGa in GaxGax:(? ? % ?); + rewrite > (op_associative ? (semigroup_properties G)) in GaxGax; + apply (H ? ? ? GaxGax) + | unfold is_right_unit; intro; + letin GaxGax ≝(refl_eq ? (x·G \sub a)); + clearbody GaxGax; + rewrite < GaGa in GaxGax:(? ? % ?); + rewrite < (op_associative ? (semigroup_properties G)) in GaxGax; + apply (H1 ? ? ? GaxGax) + ] + ] +| intros; + elim (pigeonhole (order ? G) f ? ? ? H2); + [ apply (ex_intro ? ? a); + elim H3; + assumption + | intros; + simplify in H5; + cut (G \sub (ι(G \sub O · G \sub x)) = G \sub (ι(G \sub O · G \sub y))); + [ rewrite > (repr_index_of ? ? (G \sub O · G \sub x)) in Hcut; + rewrite > (repr_index_of ? ? (G \sub O · G \sub y)) in Hcut; + generalize in match (H ? ? ? Hcut); + intro; + generalize in match (eq_f ? ? (index_of ? G) ? ? H6); + intro; + rewrite > index_of_repr in H7; + rewrite > index_of_repr in H7; + assumption + | apply eq_f; + assumption + ] + | intros; + apply index_of_sur + ] +]. +qed. diff --git a/matita/library/algebra/groups.ma b/matita/library/algebra/groups.ma new file mode 100644 index 000000000..7774508ee --- /dev/null +++ b/matita/library/algebra/groups.ma @@ -0,0 +1,326 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "algebra/monoids.ma". +include "nat/le_arith.ma". +include "datatypes/bool.ma". +include "nat/compare.ma". + +record PreGroup : Type ≝ + { premonoid:> PreMonoid; + inv: premonoid -> premonoid + }. + +record isGroup (G:PreGroup) : Prop ≝ + { is_monoid:> isMonoid G; + inv_is_left_inverse: is_left_inverse (mk_Monoid ? is_monoid) (inv G); + inv_is_right_inverse: is_right_inverse (mk_Monoid ? is_monoid) (inv G) + }. + +record Group : Type ≝ + { pregroup:> PreGroup; + group_properties:> isGroup pregroup + }. + +notation "hvbox(x \sup (-1))" with precedence 89 +for @{ 'ginv $x }. + +interpretation "Group inverse" 'ginv x = + (cic:/matita/algebra/groups/inv.con _ x). + +definition left_cancellable ≝ + λT:Type. λop: T -> T -> T. + ∀x. injective ? ? (op x). + +definition right_cancellable ≝ + λT:Type. λop: T -> T -> T. + ∀x. injective ? ? (λz.op z x). + +theorem eq_op_x_y_op_x_z_to_eq: + ∀G:Group. left_cancellable G (op G). +intros; +unfold left_cancellable; +unfold injective; +intros (x y z); +rewrite < (e_is_left_unit ? G); +rewrite < (e_is_left_unit ? G z); +rewrite < (inv_is_left_inverse ? G x); +rewrite > (op_associative ? G); +rewrite > (op_associative ? G); +apply eq_f; +assumption. +qed. + + +theorem eq_op_x_y_op_z_y_to_eq: + ∀G:Group. right_cancellable G (op G). +intros; +unfold right_cancellable; +unfold injective; +simplify;fold simplify (op G); +intros (x y z); +rewrite < (e_is_right_unit ? G); +rewrite < (e_is_right_unit ? G z); +rewrite < (inv_is_right_inverse ? G x); +rewrite < (op_associative ? G); +rewrite < (op_associative ? G); +rewrite > H; +reflexivity. +qed. + +theorem eq_inv_inv_x_x: ∀G:Group. ∀x:G. x \sup -1 \sup -1 = x. +intros; +apply (eq_op_x_y_op_z_y_to_eq ? (x \sup -1)); +rewrite > (inv_is_right_inverse ? G); +rewrite > (inv_is_left_inverse ? G); +reflexivity. +qed. + +theorem eq_opxy_e_to_eq_x_invy: + ∀G:Group. ∀x,y:G. x·y=1 → x=y \sup -1. +intros; +apply (eq_op_x_y_op_z_y_to_eq ? y); +rewrite > (inv_is_left_inverse ? G); +assumption. +qed. + +theorem eq_opxy_e_to_eq_invx_y: + ∀G:Group. ∀x,y:G. x·y=1 → x \sup -1=y. +intros; +apply (eq_op_x_y_op_x_z_to_eq ? x); +rewrite > (inv_is_right_inverse ? G); +symmetry; +assumption. +qed. + +theorem eq_opxy_z_to_eq_x_opzinvy: + ∀G:Group. ∀x,y,z:G. x·y=z → x = z·y \sup -1. +intros; +apply (eq_op_x_y_op_z_y_to_eq ? y); +rewrite > (op_associative ? G); +rewrite > (inv_is_left_inverse ? G); +rewrite > (e_is_right_unit ? G); +assumption. +qed. + +theorem eq_opxy_z_to_eq_y_opinvxz: + ∀G:Group. ∀x,y,z:G. x·y=z → y = x \sup -1·z. +intros; +apply (eq_op_x_y_op_x_z_to_eq ? x); +rewrite < (op_associative ? G); +rewrite > (inv_is_right_inverse ? G); +rewrite > (e_is_left_unit ? G); +assumption. +qed. + +theorem eq_inv_op_x_y_op_inv_y_inv_x: + ∀G:Group. ∀x,y:G. (x·y) \sup -1 = y \sup -1 · x \sup -1. +intros; +apply (eq_op_x_y_op_z_y_to_eq ? (x·y)); +rewrite > (inv_is_left_inverse ? G); +rewrite < (op_associative ? G); +rewrite > (op_associative ? G (y \sup -1)); +rewrite > (inv_is_left_inverse ? G); +rewrite > (e_is_right_unit ? G); +rewrite > (inv_is_left_inverse ? G); +reflexivity. +qed. + +(* Morphisms *) + +record morphism (G,G':Group) : Type ≝ + { image: G → G'; + f_morph: ∀x,y:G.image(x·y) = image x · image y + }. + +notation "hvbox(f˜ x)" with precedence 79 +for @{ 'morimage $f $x }. + +interpretation "Morphism image" 'morimage f x = + (cic:/matita/algebra/groups/image.con _ _ f x). + +theorem morphism_to_eq_f_1_1: + ∀G,G'.∀f:morphism G G'.f˜1 = 1. +intros; +apply (eq_op_x_y_op_z_y_to_eq ? (f˜1)); +rewrite > (e_is_left_unit ? G'); +rewrite < f_morph; +rewrite > (e_is_left_unit ? G); +reflexivity. +qed. + +theorem eq_image_inv_inv_image: + ∀G,G'.∀f:morphism G G'. + ∀x.f˜(x \sup -1) = (f˜x) \sup -1. +intros; +apply (eq_op_x_y_op_z_y_to_eq ? (f˜x)); +rewrite > (inv_is_left_inverse ? G'); +rewrite < f_morph; +rewrite > (inv_is_left_inverse ? G); +apply (morphism_to_eq_f_1_1 ? ? f). +qed. + +record monomorphism (G,G':Group) : Type ≝ + { morphism:> morphism G G'; + injective: injective ? ? (image ? ? morphism) + }. + +(* Subgroups *) + +record subgroup (G:Group) : Type ≝ + { group:> Group; + embed:> monomorphism group G + }. + +notation "hvbox(x \sub H)" with precedence 79 +for @{ 'subgroupimage $H $x }. + +interpretation "Subgroup image" 'subgroupimage H x = + (cic:/matita/algebra/groups/image.con _ _ + (cic:/matita/algebra/groups/morphism_OF_subgroup.con _ H) x). + +definition member_of_subgroup ≝ + λG.λH:subgroup G.λx:G.∃y.x=y \sub H. + +notation "hvbox(x break ∈ H)" with precedence 79 +for @{ 'member_of $x $H }. + +notation "hvbox(x break ∉ H)" with precedence 79 +for @{ 'not_member_of $x $H }. + +interpretation "Member of subgroup" 'member_of x H = + (cic:/matita/algebra/groups/member_of_subgroup.con _ H x). + +interpretation "Not member of subgroup" 'not_member_of x H = + (cic:/matita/logic/connectives/Not.con + (cic:/matita/algebra/groups/member_of_subgroup.con _ H x)). + +(* Left cosets *) + +record left_coset (G:Group) : Type ≝ + { element: G; + subgrp: subgroup G + }. + +(* Here I would prefer 'magma_op, but this breaks something in the next definition *) +interpretation "Left_coset" 'times x C = + (cic:/matita/algebra/groups/left_coset.ind#xpointer(1/1/1) _ x C). + +definition member_of_left_coset ≝ + λG:Group.λC:left_coset G.λx:G. + ∃y.x=(element ? C)·y \sub (subgrp ? C). + +interpretation "Member of left_coset" 'member_of x C = + (cic:/matita/algebra/groups/member_of_left_coset.con _ C x). + +definition left_coset_eq ≝ + λG.λC,C':left_coset G. + ∀x.((element ? C)·x \sub (subgrp ? C)) ∈ C'. + +interpretation "Left cosets equality" 'eq C C' = + (cic:/matita/algebra/groups/left_coset_eq.con _ C C'). + +definition left_coset_disjoint ≝ + λG.λC,C':left_coset G. + ∀x.¬(((element ? C)·x \sub (subgrp ? C)) ∈ C'). + +notation "hvbox(a break ∥ b)" + non associative with precedence 45 +for @{ 'disjoint $a $b }. + +interpretation "Left cosets disjoint" 'disjoint C C' = + (cic:/matita/algebra/groups/left_coset_disjoint.con _ C C'). + +(* The following should be a one-shot alias! *) +alias symbol "member_of" (instance 0) = "Member of subgroup". +theorem member_of_subgroup_op_inv_x_y_to_left_coset_eq: + ∀G.∀x,y.∀H:subgroup G. (x \sup -1 ·y) ∈ H → x*H = y*H. +intros; +simplify; +intro; +unfold member_of_subgroup in H1; +elim H1; +clear H1; +exists; +[ apply (a\sup-1 · x1) +| rewrite > f_morph; + rewrite > eq_image_inv_inv_image; + rewrite < H2; + rewrite > eq_inv_op_x_y_op_inv_y_inv_x; + rewrite > eq_inv_inv_x_x; + rewrite < (op_associative ? G); + rewrite < (op_associative ? G); + rewrite > (inv_is_right_inverse ? G); + rewrite > (e_is_left_unit ? G); + reflexivity +]. +qed. + +theorem Not_member_of_subgroup_to_left_coset_disjoint: + ∀G.∀x,y.∀H:subgroup G.(x \sup -1 ·y) ∉ H → x*H ∥ y*H. +intros; +simplify; +unfold Not; +intros (x'); +apply H1; +unfold member_of_subgroup; +elim H2; +apply (ex_intro ? ? (x'·a \sup -1)); +rewrite > f_morph; +apply (eq_op_x_y_op_z_y_to_eq ? (a \sub H)); +rewrite > (op_associative ? G); +rewrite < H3; +rewrite > (op_associative ? G); +rewrite < f_morph; +rewrite > (inv_is_left_inverse ? H); +rewrite < (op_associative ? G); +rewrite > (inv_is_left_inverse ? G); +rewrite > (e_is_left_unit ? G); +rewrite < (f_morph ? ? H); +rewrite > (e_is_right_unit ? H); +reflexivity. +qed. + +(*CSC: here the coercion Type_of_Group cannot be omitted. Why? *) +theorem in_x_mk_left_coset_x_H: + ∀G.∀x:Type_OF_Group G.∀H:subgroup G.x ∈ (x*H). +intros; +simplify; +apply (ex_intro ? ? 1); +rewrite > morphism_to_eq_f_1_1; +rewrite > (e_is_right_unit ? G); +reflexivity. +qed. + +(* Normal Subgroups *) + +record normal_subgroup (G:Group) : Type ≝ + { ns_subgroup:> subgroup G; + normal:> ∀x:G.∀y:ns_subgroup.(x·y \sub ns_subgroup·x \sup -1) ∈ ns_subgroup + }. + +(*CSC: I have not defined yet right cosets +theorem foo: + ∀G.∀H:normal_subgroup G.∀x.x*H=H*x. +*) +(* +theorem member_of_left_coset_mk_left_coset_x_H_a_to_member_of_left_coset_mk_left_coset_y_H_b_to_member_of_left_coset_mk_left_coset_op_x_y_H_op_a_b: + ∀G.∀H:normal_subgroup G.∀x,y,a,b. + a ∈ (x*H) → b ∈ (y*H) → (a·b) ∈ ((x·y)*H). +intros; +simplify; +qed. +*) diff --git a/matita/library/algebra/monoids.ma b/matita/library/algebra/monoids.ma new file mode 100644 index 000000000..582ba3978 --- /dev/null +++ b/matita/library/algebra/monoids.ma @@ -0,0 +1,69 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "algebra/semigroups.ma". + +record PreMonoid : Type ≝ + { magma:> Magma; + e: magma + }. + +record isMonoid (M:PreMonoid) : Prop ≝ + { is_semi_group:> isSemiGroup M; + e_is_left_unit: + is_left_unit (mk_SemiGroup ? is_semi_group) (e M); + e_is_right_unit: + is_right_unit (mk_SemiGroup ? is_semi_group) (e M) + }. + +record Monoid : Type ≝ + { premonoid:> PreMonoid; + monoid_properties:> isMonoid premonoid + }. + +notation "1" with precedence 89 +for @{ 'munit }. + +interpretation "Monoid unit" 'munit = + (cic:/matita/algebra/monoids/e.con _). + +definition is_left_inverse ≝ + λM:Monoid. + λopp: M → M. + ∀x:M. (opp x)·x = 1. + +definition is_right_inverse ≝ + λM:Monoid. + λopp: M → M. + ∀x:M. x·(opp x) = 1. + +theorem is_left_inverse_to_is_right_inverse_to_eq: + ∀M:Monoid. ∀l,r. + is_left_inverse M l → is_right_inverse M r → + ∀x:M. l x = r x. + intros; + generalize in match (H x); intro; + generalize in match (eq_f ? ? (λy.y·(r x)) ? ? H2); + simplify; fold simplify (op M); + intro; clear H2; + generalize in match (op_associative ? (is_semi_group ? (monoid_properties M))); + intro; + rewrite > H2 in H3; clear H2; + rewrite > H1 in H3; + rewrite > (e_is_left_unit ? (monoid_properties M)) in H3; + rewrite > (e_is_right_unit ? (monoid_properties M)) in H3; + assumption. +qed. diff --git a/matita/library/algebra/semigroups.ma b/matita/library/algebra/semigroups.ma new file mode 100644 index 000000000..2e653efbb --- /dev/null +++ b/matita/library/algebra/semigroups.ma @@ -0,0 +1,56 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "higher_order_defs/functions.ma". + +(* Magmas *) + +record Magma : Type≝ + { carrier:> Type; + op: carrier → carrier → carrier + }. + +notation "hvbox(a break \middot b)" + left associative with precedence 55 +for @{ 'magma_op $a $b }. + +interpretation "magma operation" 'magma_op a b = + (cic:/matita/algebra/semigroups/op.con _ a b). + +(* Semigroups *) + +record isSemiGroup (M:Magma) : Prop≝ + { op_associative: associative ? (op M) }. + +record SemiGroup : Type≝ + { magma:> Magma; + semigroup_properties:> isSemiGroup magma + }. + +definition is_left_unit ≝ + λS:SemiGroup. λe:S. ∀x:S. e·x = x. + +definition is_right_unit ≝ + λS:SemiGroup. λe:S. ∀x:S. x·e = x. + +theorem is_left_unit_to_is_right_unit_to_eq: + ∀S:SemiGroup. ∀e,e':S. + is_left_unit ? e → is_right_unit ? e' → e=e'. + intros; + rewrite < (H e'); + rewrite < (H1 e) in \vdash (? ? % ?). + reflexivity. +qed. diff --git a/matita/library/assembly/byte.ma b/matita/library/assembly/byte.ma new file mode 100644 index 000000000..9b482689c --- /dev/null +++ b/matita/library/assembly/byte.ma @@ -0,0 +1,334 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "assembly/exadecimal.ma". + +record byte : Type ≝ { + bh: exadecimal; + bl: exadecimal +}. + +notation "〈 x, y 〉" non associative with precedence 80 for @{ 'mk_byte $x $y }. +interpretation "mk_byte" 'mk_byte x y = + (cic:/matita/assembly/byte/byte.ind#xpointer(1/1/1) x y). + +definition eqbyte ≝ + λb,b'. eqex (bh b) (bh b') ∧ eqex (bl b) (bl b'). + +definition plusbyte ≝ + λb1,b2,c. + match plusex (bl b1) (bl b2) c with + [ couple l c' ⇒ + match plusex (bh b1) (bh b2) c' with + [ couple h c'' ⇒ couple ? ? (mk_byte h l) c'' ]]. + +definition nat_of_byte ≝ λb:byte. 16*(bh b) + (bl b). + +coercion cic:/matita/assembly/byte/nat_of_byte.con. + +definition byte_of_nat ≝ + λn. mk_byte (exadecimal_of_nat (n / 16)) (exadecimal_of_nat n). + +interpretation "byte_of_nat" 'byte_of_opcode a = + (cic:/matita/assembly/byte/byte_of_nat.con a). + +lemma byte_of_nat_nat_of_byte: ∀b. byte_of_nat (nat_of_byte b) = b. + intros; + elim b; + elim e; + elim e1; + reflexivity. +qed. + +lemma lt_nat_of_byte_256: ∀b. nat_of_byte b < 256. + intro; + unfold nat_of_byte; + letin H ≝ (lt_nat_of_exadecimal_16 (bh b)); clearbody H; + letin K ≝ (lt_nat_of_exadecimal_16 (bl b)); clearbody K; + unfold lt in H K ⊢ %; + letin H' ≝ (le_S_S_to_le ? ? H); clearbody H'; clear H; + letin K' ≝ (le_S_S_to_le ? ? K); clearbody K'; clear K; + apply le_S_S; + cut (16*bh b ≤ 16*15); + [ letin Hf ≝ (le_plus ? ? ? ? Hcut K'); clearbody Hf; + simplify in Hf:(? ? %); + assumption + | apply le_times_r. apply H'. + ] +qed. + +lemma nat_of_byte_byte_of_nat: ∀n. nat_of_byte (byte_of_nat n) = n \mod 256. + intro; + letin H ≝ (lt_nat_of_byte_256 (byte_of_nat n)); clearbody H; + rewrite < (lt_to_eq_mod ? ? H); clear H; + unfold byte_of_nat; + unfold nat_of_byte; + change with ((16*(exadecimal_of_nat (n/16)) + exadecimal_of_nat n) \mod 256 = n \mod 256); + letin H ≝ (div_mod n 16 ?); clearbody H; [ autobatch | ]; + rewrite > symmetric_times in H; + rewrite > nat_of_exadecimal_exadecimal_of_nat in ⊢ (? ? (? (? % ?) ?) ?); + rewrite > nat_of_exadecimal_exadecimal_of_nat in ⊢ (? ? (? (? ? %) ?) ?); + rewrite > H in ⊢ (? ? ? (? % ?)); clear H; + rewrite > mod_plus in ⊢ (? ? % ?); + rewrite > mod_plus in ⊢ (? ? ? %); + apply eq_mod_to_eq_plus_mod; + rewrite < mod_mod in ⊢ (? ? ? %); [ | autobatch]; + rewrite < mod_mod in ⊢ (? ? % ?); [ | autobatch]; + rewrite < (eq_mod_times_times_mod ? ? 16 256) in ⊢ (? ? (? % ?) ?); [2: reflexivity | ]; + rewrite < mod_mod in ⊢ (? ? % ?); + [ reflexivity + | autobatch + ]. +qed. + +lemma eq_nat_of_byte_n_nat_of_byte_mod_n_256: + ∀n. byte_of_nat n = byte_of_nat (n \mod 256). + intro; + unfold byte_of_nat; + apply eq_f2; + [ rewrite > exadecimal_of_nat_mod in ⊢ (? ? % ?); + rewrite > exadecimal_of_nat_mod in ⊢ (? ? ? %); + apply eq_f; + elim daemon + | rewrite > exadecimal_of_nat_mod; + rewrite > exadecimal_of_nat_mod in ⊢ (? ? ? %); + rewrite > divides_to_eq_mod_mod_mod; + [ reflexivity + | apply (witness ? ? 16). reflexivity. + ] + ] +qed. + +lemma plusbyte_ok: + ∀b1,b2,c. + match plusbyte b1 b2 c with + [ couple r c' ⇒ b1 + b2 + nat_of_bool c = nat_of_byte r + nat_of_bool c' * 256 + ]. + intros; elim daemon. + (* + unfold plusbyte; + generalize in match (plusex_ok (bl b1) (bl b2) c); + elim (plusex (bl b1) (bl b2) c); + simplify in H ⊢ %; + generalize in match (plusex_ok (bh b1) (bh b2) t1); + elim (plusex (bh b1) (bh b2) t1); + simplify in H1 ⊢ %; + change in ⊢ (? ? ? (? (? % ?) ?)) with (16 * t2); + unfold nat_of_byte; + letin K ≝ (eq_f ? ? (λy.16*y) ? ? H1); clearbody K; clear H1; + rewrite > distr_times_plus in K:(? ? ? %); + rewrite > symmetric_times in K:(? ? ? (? ? (? ? %))); + rewrite < associative_times in K:(? ? ? (? ? %)); + normalize in K:(? ? ? (? ? (? % ?))); + rewrite > symmetric_times in K:(? ? ? (? ? %)); + rewrite > sym_plus in ⊢ (? ? ? (? % ?)); + rewrite > associative_plus in ⊢ (? ? ? %); + letin K' ≝ (eq_f ? ? (plus t) ? ? K); clearbody K'; clear K; + apply transitive_eq; [3: apply K' | skip | ]; + clear K'; + rewrite > sym_plus in ⊢ (? ? (? (? ? %) ?) ?); + rewrite > associative_plus in ⊢ (? ? (? % ?) ?); + rewrite > associative_plus in ⊢ (? ? % ?); + rewrite > associative_plus in ⊢ (? ? (? ? %) ?); + rewrite > associative_plus in ⊢ (? ? (? ? (? ? %)) ?); + rewrite > sym_plus in ⊢ (? ? (? ? (? ? (? ? %))) ?); + rewrite < associative_plus in ⊢ (? ? (? ? (? ? %)) ?); + rewrite < associative_plus in ⊢ (? ? (? ? %) ?); + rewrite < associative_plus in ⊢ (? ? (? ? (? % ?)) ?); + rewrite > H; clear H; + autobatch paramodulation. + *) +qed. + +definition bpred ≝ + λb. + match eqex (bl b) x0 with + [ true ⇒ mk_byte (xpred (bh b)) (xpred (bl b)) + | false ⇒ mk_byte (bh b) (xpred (bl b)) + ]. + +lemma plusbyte_O_x: + ∀b. plusbyte (mk_byte x0 x0) b false = couple ? ? b false. + intros; + elim b; + elim e; + elim e1; + reflexivity. +qed. + +definition plusbytenc ≝ + λx,y. + match plusbyte x y false with + [couple res _ ⇒ res]. + +definition plusbytec ≝ + λx,y. + match plusbyte x y false with + [couple _ c ⇒ c]. + +lemma plusbytenc_O_x: + ∀x. plusbytenc (mk_byte x0 x0) x = x. + intros; + unfold plusbytenc; + rewrite > plusbyte_O_x; + reflexivity. +qed. + +lemma eq_nat_of_byte_mod: ∀b. nat_of_byte b = nat_of_byte b \mod 256. + intro; + lapply (lt_nat_of_byte_256 b); + rewrite > (lt_to_eq_mod ? ? Hletin) in ⊢ (? ? ? %); + reflexivity. +qed. + +theorem plusbytenc_ok: + ∀b1,b2:byte. nat_of_byte (plusbytenc b1 b2) = (b1 + b2) \mod 256. + intros; + unfold plusbytenc; + generalize in match (plusbyte_ok b1 b2 false); + elim (plusbyte b1 b2 false); + simplify in H ⊢ %; + change with (nat_of_byte t = (b1 + b2) \mod 256); + rewrite < plus_n_O in H; + rewrite > H; clear H; + rewrite > mod_plus; + letin K ≝ (eq_nat_of_byte_mod t); clearbody K; + letin K' ≝ (eq_mod_times_n_m_m_O (nat_of_bool t1) 256 ?); clearbody K'; + [ autobatch | ]; + autobatch paramodulation. +qed. + + + +lemma eq_eqbyte_x0_x0_byte_of_nat_S_false: + ∀b. b < 255 → eqbyte (mk_byte x0 x0) (byte_of_nat (S b)) = false. + intros; + unfold byte_of_nat; + cut (b < 15 ∨ b ≥ 15); + [ elim Hcut; + [ unfold eqbyte; + change in ⊢ (? ? (? ? %) ?) with (eqex x0 (exadecimal_of_nat (S b))); + rewrite > eq_eqex_S_x0_false; + [ elim (eqex (bh (mk_byte x0 x0)) + (bh (mk_byte (exadecimal_of_nat (S b/16)) (exadecimal_of_nat (S b))))); + simplify; + reflexivity + | assumption + ] + | unfold eqbyte; + change in ⊢ (? ? (? % ?) ?) with (eqex x0 (exadecimal_of_nat (S b/16))); + letin K ≝ (leq_m_n_to_eq_div_n_m_S (S b) 16 ? ?); + [ autobatch + | unfold in H1; + apply le_S_S; + assumption + | clearbody K; + elim K; clear K; + rewrite > H2; + rewrite > eq_eqex_S_x0_false; + [ reflexivity + | unfold lt; + unfold lt in H; + rewrite < H2; + clear H2; clear a; clear H1; clear Hcut; + apply (le_times_to_le 16) [ autobatch | ] ; + rewrite > (div_mod (S b) 16) in H;[2:autobatch|] + rewrite > (div_mod 255 16) in H:(? ? %);[2:autobatch|] + lapply (le_to_le_plus_to_le ? ? ? ? ? H); + [apply lt_S_to_le; + apply lt_mod_m_m;autobatch + |rewrite > sym_times; + rewrite > sym_times in ⊢ (? ? %); (* just to speed up qed *) + normalize in ⊢ (? ? %);apply Hletin; + ] + ] + ] + ] + | elim (or_lt_le b 15);unfold ge;autobatch + ]. +qed. + +axiom eq_mod_O_to_exists: ∀n,m. n \mod m = 0 → ∃z. n = z*m. + +lemma eq_bpred_S_a_a: + ∀a. a < 255 → bpred (byte_of_nat (S a)) = byte_of_nat a. + intros; + unfold bpred; + apply (bool_elim ? (eqex (bl (byte_of_nat (S a))) x0)); intros; + [ change with (mk_byte (xpred (bh (byte_of_nat (S a)))) (xpred (bl (byte_of_nat (S a)))) + = byte_of_nat a); + rewrite > (eqex_true_to_eq ? ? H1); + normalize in ⊢ (? ? (? ? %) ?); + unfold byte_of_nat; + change with (mk_byte (xpred (exadecimal_of_nat (S a/16))) xF = + mk_byte (exadecimal_of_nat (a/16)) (exadecimal_of_nat a)); + lapply (eqex_true_to_eq ? ? H1); clear H1; + unfold byte_of_nat in Hletin; + change in Hletin with (exadecimal_of_nat (S a) = x0); + lapply (eq_f ? ? nat_of_exadecimal ? ? Hletin); clear Hletin; + normalize in Hletin1:(? ? ? %); + rewrite > nat_of_exadecimal_exadecimal_of_nat in Hletin1; + elim (eq_mod_O_to_exists ? ? Hletin1); clear Hletin1; + rewrite > H1; + rewrite > lt_O_to_div_times; [2: autobatch | ] + lapply (eq_f ? ? (λx.x/16) ? ? H1); + rewrite > lt_O_to_div_times in Hletin; [2: autobatch | ] + lapply (eq_f ? ? (λx.x \mod 16) ? ? H1); + rewrite > eq_mod_times_n_m_m_O in Hletin1; + elim daemon + | change with (mk_byte (bh (byte_of_nat (S a))) (xpred (bl (byte_of_nat (S a)))) + = byte_of_nat a); + unfold byte_of_nat; + change with (mk_byte (exadecimal_of_nat (S a/16)) (xpred (exadecimal_of_nat (S a))) + = mk_byte (exadecimal_of_nat (a/16)) (exadecimal_of_nat a)); + lapply (eqex_false_to_not_eq ? ? H1); + unfold byte_of_nat in Hletin; + change in Hletin with (exadecimal_of_nat (S a) ≠ x0); + cut (nat_of_exadecimal (exadecimal_of_nat (S a)) ≠ 0); + [2: intro; + apply Hletin; + lapply (eq_f ? ? exadecimal_of_nat ? ? H2); + rewrite > exadecimal_of_nat_nat_of_exadecimal in Hletin1; + apply Hletin1 + | ]; + + elim daemon + ] +qed. + +lemma plusbytenc_S: + ∀x:byte.∀n.plusbytenc (byte_of_nat (x*n)) x = byte_of_nat (x * S n). + intros; + rewrite < byte_of_nat_nat_of_byte; + rewrite > (plusbytenc_ok (byte_of_nat (x*n)) x); + rewrite < times_n_Sm; + rewrite > nat_of_byte_byte_of_nat in ⊢ (? ? (? (? (? % ?) ?)) ?); + rewrite > eq_nat_of_byte_n_nat_of_byte_mod_n_256 in ⊢ (? ? ? %); + rewrite > mod_plus in ⊢ (? ? (? %) ?); + rewrite > mod_plus in ⊢ (? ? ? (? %)); + rewrite < mod_mod in ⊢ (? ? (? (? (? % ?) ?)) ?); [2: autobatch | ]; + rewrite > sym_plus in ⊢ (? ? (? (? % ?)) ?); + reflexivity. +qed. + +lemma eq_plusbytec_x0_x0_x_false: + ∀x.plusbytec (mk_byte x0 x0) x = false. + intro; + elim x; + elim e; + elim e1; + reflexivity. +qed. diff --git a/matita/library/assembly/exadecimal.ma b/matita/library/assembly/exadecimal.ma new file mode 100644 index 000000000..a8227b34d --- /dev/null +++ b/matita/library/assembly/exadecimal.ma @@ -0,0 +1,926 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "assembly/extra.ma". + +inductive exadecimal : Type ≝ + x0: exadecimal + | x1: exadecimal + | x2: exadecimal + | x3: exadecimal + | x4: exadecimal + | x5: exadecimal + | x6: exadecimal + | x7: exadecimal + | x8: exadecimal + | x9: exadecimal + | xA: exadecimal + | xB: exadecimal + | xC: exadecimal + | xD: exadecimal + | xE: exadecimal + | xF: exadecimal. + +definition eqex ≝ + λb1,b2. + match b1 with + [ x0 ⇒ + match b2 with + [ x0 ⇒ true | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | x1 ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ true | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | x2 ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ true | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | x3 ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ true + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | x4 ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ true | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | x5 ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ true | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | x6 ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ true | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | x7 ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ true + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | x8 ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ true | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | x9 ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ true | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | xA ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ true | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | xB ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ true + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | xC ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ true | xD ⇒ false | xE ⇒ false | xF ⇒ false ] + | xD ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ true | xE ⇒ false | xF ⇒ false ] + | xE ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ true | xF ⇒ false ] + | xF ⇒ + match b2 with + [ x0 ⇒ false | x1 ⇒ false | x2 ⇒ false | x3 ⇒ false + | x4 ⇒ false | x5 ⇒ false | x6 ⇒ false | x7 ⇒ false + | x8 ⇒ false | x9 ⇒ false | xA ⇒ false | xB ⇒ false + | xC ⇒ false | xD ⇒ false | xE ⇒ false | xF ⇒ true ]]. + +definition plusex ≝ + λb1,b2,c. + match c with + [ true ⇒ + match b1 with + [ x0 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x1 false + | x1 ⇒ couple exadecimal bool x2 false + | x2 ⇒ couple exadecimal bool x3 false + | x3 ⇒ couple exadecimal bool x4 false + | x4 ⇒ couple exadecimal bool x5 false + | x5 ⇒ couple exadecimal bool x6 false + | x6 ⇒ couple exadecimal bool x7 false + | x7 ⇒ couple exadecimal bool x8 false + | x8 ⇒ couple exadecimal bool x9 false + | x9 ⇒ couple exadecimal bool xA false + | xA ⇒ couple exadecimal bool xB false + | xB ⇒ couple exadecimal bool xC false + | xC ⇒ couple exadecimal bool xD false + | xD ⇒ couple exadecimal bool xE false + | xE ⇒ couple exadecimal bool xF false + | xF ⇒ couple exadecimal bool x0 true ] + | x1 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x2 false + | x1 ⇒ couple exadecimal bool x3 false + | x2 ⇒ couple exadecimal bool x4 false + | x3 ⇒ couple exadecimal bool x5 false + | x4 ⇒ couple exadecimal bool x6 false + | x5 ⇒ couple exadecimal bool x7 false + | x6 ⇒ couple exadecimal bool x8 false + | x7 ⇒ couple exadecimal bool x9 false + | x8 ⇒ couple exadecimal bool xA false + | x9 ⇒ couple exadecimal bool xB false + | xA ⇒ couple exadecimal bool xC false + | xB ⇒ couple exadecimal bool xD false + | xC ⇒ couple exadecimal bool xE false + | xD ⇒ couple exadecimal bool xF false + | xE ⇒ couple exadecimal bool x0 true + | xF ⇒ couple exadecimal bool x1 true ] + | x2 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x3 false + | x1 ⇒ couple exadecimal bool x4 false + | x2 ⇒ couple exadecimal bool x5 false + | x3 ⇒ couple exadecimal bool x6 false + | x4 ⇒ couple exadecimal bool x7 false + | x5 ⇒ couple exadecimal bool x8 false + | x6 ⇒ couple exadecimal bool x9 false + | x7 ⇒ couple exadecimal bool xA false + | x8 ⇒ couple exadecimal bool xB false + | x9 ⇒ couple exadecimal bool xC false + | xA ⇒ couple exadecimal bool xD false + | xB ⇒ couple exadecimal bool xE false + | xC ⇒ couple exadecimal bool xF false + | xD ⇒ couple exadecimal bool x0 true + | xE ⇒ couple exadecimal bool x1 true + | xF ⇒ couple exadecimal bool x2 true ] + | x3 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x4 false + | x1 ⇒ couple exadecimal bool x5 false + | x2 ⇒ couple exadecimal bool x6 false + | x3 ⇒ couple exadecimal bool x7 false + | x4 ⇒ couple exadecimal bool x8 false + | x5 ⇒ couple exadecimal bool x9 false + | x6 ⇒ couple exadecimal bool xA false + | x7 ⇒ couple exadecimal bool xB false + | x8 ⇒ couple exadecimal bool xC false + | x9 ⇒ couple exadecimal bool xD false + | xA ⇒ couple exadecimal bool xE false + | xB ⇒ couple exadecimal bool xF false + | xC ⇒ couple exadecimal bool x0 true + | xD ⇒ couple exadecimal bool x1 true + | xE ⇒ couple exadecimal bool x2 true + | xF ⇒ couple exadecimal bool x3 true ] + | x4 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x5 false + | x1 ⇒ couple exadecimal bool x6 false + | x2 ⇒ couple exadecimal bool x7 false + | x3 ⇒ couple exadecimal bool x8 false + | x4 ⇒ couple exadecimal bool x9 false + | x5 ⇒ couple exadecimal bool xA false + | x6 ⇒ couple exadecimal bool xB false + | x7 ⇒ couple exadecimal bool xC false + | x8 ⇒ couple exadecimal bool xD false + | x9 ⇒ couple exadecimal bool xE false + | xA ⇒ couple exadecimal bool xF false + | xB ⇒ couple exadecimal bool x0 true + | xC ⇒ couple exadecimal bool x1 true + | xD ⇒ couple exadecimal bool x2 true + | xE ⇒ couple exadecimal bool x3 true + | xF ⇒ couple exadecimal bool x4 true ] + | x5 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x6 false + | x1 ⇒ couple exadecimal bool x7 false + | x2 ⇒ couple exadecimal bool x8 false + | x3 ⇒ couple exadecimal bool x9 false + | x4 ⇒ couple exadecimal bool xA false + | x5 ⇒ couple exadecimal bool xB false + | x6 ⇒ couple exadecimal bool xC false + | x7 ⇒ couple exadecimal bool xD false + | x8 ⇒ couple exadecimal bool xE false + | x9 ⇒ couple exadecimal bool xF false + | xA ⇒ couple exadecimal bool x0 true + | xB ⇒ couple exadecimal bool x1 true + | xC ⇒ couple exadecimal bool x2 true + | xD ⇒ couple exadecimal bool x3 true + | xE ⇒ couple exadecimal bool x4 true + | xF ⇒ couple exadecimal bool x5 true ] + | x6 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x7 false + | x1 ⇒ couple exadecimal bool x8 false + | x2 ⇒ couple exadecimal bool x9 false + | x3 ⇒ couple exadecimal bool xA false + | x4 ⇒ couple exadecimal bool xB false + | x5 ⇒ couple exadecimal bool xC false + | x6 ⇒ couple exadecimal bool xD false + | x7 ⇒ couple exadecimal bool xE false + | x8 ⇒ couple exadecimal bool xF false + | x9 ⇒ couple exadecimal bool x0 true + | xA ⇒ couple exadecimal bool x1 true + | xB ⇒ couple exadecimal bool x2 true + | xC ⇒ couple exadecimal bool x3 true + | xD ⇒ couple exadecimal bool x4 true + | xE ⇒ couple exadecimal bool x5 true + | xF ⇒ couple exadecimal bool x6 true ] + | x7 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x8 false + | x1 ⇒ couple exadecimal bool x9 false + | x2 ⇒ couple exadecimal bool xA false + | x3 ⇒ couple exadecimal bool xB false + | x4 ⇒ couple exadecimal bool xC false + | x5 ⇒ couple exadecimal bool xD false + | x6 ⇒ couple exadecimal bool xE false + | x7 ⇒ couple exadecimal bool xF false + | x8 ⇒ couple exadecimal bool x0 true + | x9 ⇒ couple exadecimal bool x1 true + | xA ⇒ couple exadecimal bool x2 true + | xB ⇒ couple exadecimal bool x3 true + | xC ⇒ couple exadecimal bool x4 true + | xD ⇒ couple exadecimal bool x5 true + | xE ⇒ couple exadecimal bool x6 true + | xF ⇒ couple exadecimal bool x7 true ] + | x8 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x9 false + | x1 ⇒ couple exadecimal bool xA false + | x2 ⇒ couple exadecimal bool xB false + | x3 ⇒ couple exadecimal bool xC false + | x4 ⇒ couple exadecimal bool xD false + | x5 ⇒ couple exadecimal bool xE false + | x6 ⇒ couple exadecimal bool xF false + | x7 ⇒ couple exadecimal bool x0 true + | x8 ⇒ couple exadecimal bool x1 true + | x9 ⇒ couple exadecimal bool x2 true + | xA ⇒ couple exadecimal bool x3 true + | xB ⇒ couple exadecimal bool x4 true + | xC ⇒ couple exadecimal bool x5 true + | xD ⇒ couple exadecimal bool x6 true + | xE ⇒ couple exadecimal bool x7 true + | xF ⇒ couple exadecimal bool x8 true ] + | x9 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xA false + | x1 ⇒ couple exadecimal bool xB false + | x2 ⇒ couple exadecimal bool xC false + | x3 ⇒ couple exadecimal bool xD false + | x4 ⇒ couple exadecimal bool xE false + | x5 ⇒ couple exadecimal bool xF false + | x6 ⇒ couple exadecimal bool x0 true + | x7 ⇒ couple exadecimal bool x1 true + | x8 ⇒ couple exadecimal bool x2 true + | x9 ⇒ couple exadecimal bool x3 true + | xA ⇒ couple exadecimal bool x4 true + | xB ⇒ couple exadecimal bool x5 true + | xC ⇒ couple exadecimal bool x6 true + | xD ⇒ couple exadecimal bool x7 true + | xE ⇒ couple exadecimal bool x8 true + | xF ⇒ couple exadecimal bool x9 true ] + | xA ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xB false + | x1 ⇒ couple exadecimal bool xC false + | x2 ⇒ couple exadecimal bool xD false + | x3 ⇒ couple exadecimal bool xE false + | x4 ⇒ couple exadecimal bool xF false + | x5 ⇒ couple exadecimal bool x0 true + | x6 ⇒ couple exadecimal bool x1 true + | x7 ⇒ couple exadecimal bool x2 true + | x8 ⇒ couple exadecimal bool x3 true + | x9 ⇒ couple exadecimal bool x4 true + | xA ⇒ couple exadecimal bool x5 true + | xB ⇒ couple exadecimal bool x6 true + | xC ⇒ couple exadecimal bool x7 true + | xD ⇒ couple exadecimal bool x8 true + | xE ⇒ couple exadecimal bool x9 true + | xF ⇒ couple exadecimal bool xA true ] + | xB ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xC false + | x1 ⇒ couple exadecimal bool xD false + | x2 ⇒ couple exadecimal bool xE false + | x3 ⇒ couple exadecimal bool xF false + | x4 ⇒ couple exadecimal bool x0 true + | x5 ⇒ couple exadecimal bool x1 true + | x6 ⇒ couple exadecimal bool x2 true + | x7 ⇒ couple exadecimal bool x3 true + | x8 ⇒ couple exadecimal bool x4 true + | x9 ⇒ couple exadecimal bool x5 true + | xA ⇒ couple exadecimal bool x6 true + | xB ⇒ couple exadecimal bool x7 true + | xC ⇒ couple exadecimal bool x8 true + | xD ⇒ couple exadecimal bool x9 true + | xE ⇒ couple exadecimal bool xA true + | xF ⇒ couple exadecimal bool xB true ] + | xC ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xD false + | x1 ⇒ couple exadecimal bool xE false + | x2 ⇒ couple exadecimal bool xF false + | x3 ⇒ couple exadecimal bool x0 true + | x4 ⇒ couple exadecimal bool x1 true + | x5 ⇒ couple exadecimal bool x2 true + | x6 ⇒ couple exadecimal bool x3 true + | x7 ⇒ couple exadecimal bool x4 true + | x8 ⇒ couple exadecimal bool x5 true + | x9 ⇒ couple exadecimal bool x6 true + | xA ⇒ couple exadecimal bool x7 true + | xB ⇒ couple exadecimal bool x8 true + | xC ⇒ couple exadecimal bool x9 true + | xD ⇒ couple exadecimal bool xA true + | xE ⇒ couple exadecimal bool xB true + | xF ⇒ couple exadecimal bool xC true ] + | xD ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xE false + | x1 ⇒ couple exadecimal bool xF false + | x2 ⇒ couple exadecimal bool x0 true + | x3 ⇒ couple exadecimal bool x1 true + | x4 ⇒ couple exadecimal bool x2 true + | x5 ⇒ couple exadecimal bool x3 true + | x6 ⇒ couple exadecimal bool x4 true + | x7 ⇒ couple exadecimal bool x5 true + | x8 ⇒ couple exadecimal bool x6 true + | x9 ⇒ couple exadecimal bool x7 true + | xA ⇒ couple exadecimal bool x8 true + | xB ⇒ couple exadecimal bool x9 true + | xC ⇒ couple exadecimal bool xA true + | xD ⇒ couple exadecimal bool xB true + | xE ⇒ couple exadecimal bool xC true + | xF ⇒ couple exadecimal bool xD true ] + | xE ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xF false + | x1 ⇒ couple exadecimal bool x0 true + | x2 ⇒ couple exadecimal bool x1 true + | x3 ⇒ couple exadecimal bool x2 true + | x4 ⇒ couple exadecimal bool x3 true + | x5 ⇒ couple exadecimal bool x4 true + | x6 ⇒ couple exadecimal bool x5 true + | x7 ⇒ couple exadecimal bool x6 true + | x8 ⇒ couple exadecimal bool x7 true + | x9 ⇒ couple exadecimal bool x8 true + | xA ⇒ couple exadecimal bool x9 true + | xB ⇒ couple exadecimal bool xA true + | xC ⇒ couple exadecimal bool xB true + | xD ⇒ couple exadecimal bool xC true + | xE ⇒ couple exadecimal bool xD true + | xF ⇒ couple exadecimal bool xE true ] + | xF ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x0 true + | x1 ⇒ couple exadecimal bool x1 true + | x2 ⇒ couple exadecimal bool x2 true + | x3 ⇒ couple exadecimal bool x3 true + | x4 ⇒ couple exadecimal bool x4 true + | x5 ⇒ couple exadecimal bool x5 true + | x6 ⇒ couple exadecimal bool x6 true + | x7 ⇒ couple exadecimal bool x7 true + | x8 ⇒ couple exadecimal bool x8 true + | x9 ⇒ couple exadecimal bool x9 true + | xA ⇒ couple exadecimal bool xA true + | xB ⇒ couple exadecimal bool xB true + | xC ⇒ couple exadecimal bool xC true + | xD ⇒ couple exadecimal bool xD true + | xE ⇒ couple exadecimal bool xE true + | xF ⇒ couple exadecimal bool xF true ] + ] + | false ⇒ + match b1 with + [ x0 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x0 false + | x1 ⇒ couple exadecimal bool x1 false + | x2 ⇒ couple exadecimal bool x2 false + | x3 ⇒ couple exadecimal bool x3 false + | x4 ⇒ couple exadecimal bool x4 false + | x5 ⇒ couple exadecimal bool x5 false + | x6 ⇒ couple exadecimal bool x6 false + | x7 ⇒ couple exadecimal bool x7 false + | x8 ⇒ couple exadecimal bool x8 false + | x9 ⇒ couple exadecimal bool x9 false + | xA ⇒ couple exadecimal bool xA false + | xB ⇒ couple exadecimal bool xB false + | xC ⇒ couple exadecimal bool xC false + | xD ⇒ couple exadecimal bool xD false + | xE ⇒ couple exadecimal bool xE false + | xF ⇒ couple exadecimal bool xF false ] + | x1 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x1 false + | x1 ⇒ couple exadecimal bool x2 false + | x2 ⇒ couple exadecimal bool x3 false + | x3 ⇒ couple exadecimal bool x4 false + | x4 ⇒ couple exadecimal bool x5 false + | x5 ⇒ couple exadecimal bool x6 false + | x6 ⇒ couple exadecimal bool x7 false + | x7 ⇒ couple exadecimal bool x8 false + | x8 ⇒ couple exadecimal bool x9 false + | x9 ⇒ couple exadecimal bool xA false + | xA ⇒ couple exadecimal bool xB false + | xB ⇒ couple exadecimal bool xC false + | xC ⇒ couple exadecimal bool xD false + | xD ⇒ couple exadecimal bool xE false + | xE ⇒ couple exadecimal bool xF false + | xF ⇒ couple exadecimal bool x0 true ] + | x2 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x2 false + | x1 ⇒ couple exadecimal bool x3 false + | x2 ⇒ couple exadecimal bool x4 false + | x3 ⇒ couple exadecimal bool x5 false + | x4 ⇒ couple exadecimal bool x6 false + | x5 ⇒ couple exadecimal bool x7 false + | x6 ⇒ couple exadecimal bool x8 false + | x7 ⇒ couple exadecimal bool x9 false + | x8 ⇒ couple exadecimal bool xA false + | x9 ⇒ couple exadecimal bool xB false + | xA ⇒ couple exadecimal bool xC false + | xB ⇒ couple exadecimal bool xD false + | xC ⇒ couple exadecimal bool xE false + | xD ⇒ couple exadecimal bool xF false + | xE ⇒ couple exadecimal bool x0 true + | xF ⇒ couple exadecimal bool x1 true ] + | x3 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x3 false + | x1 ⇒ couple exadecimal bool x4 false + | x2 ⇒ couple exadecimal bool x5 false + | x3 ⇒ couple exadecimal bool x6 false + | x4 ⇒ couple exadecimal bool x7 false + | x5 ⇒ couple exadecimal bool x8 false + | x6 ⇒ couple exadecimal bool x9 false + | x7 ⇒ couple exadecimal bool xA false + | x8 ⇒ couple exadecimal bool xB false + | x9 ⇒ couple exadecimal bool xC false + | xA ⇒ couple exadecimal bool xD false + | xB ⇒ couple exadecimal bool xE false + | xC ⇒ couple exadecimal bool xF false + | xD ⇒ couple exadecimal bool x0 true + | xE ⇒ couple exadecimal bool x1 true + | xF ⇒ couple exadecimal bool x2 true ] + | x4 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x4 false + | x1 ⇒ couple exadecimal bool x5 false + | x2 ⇒ couple exadecimal bool x6 false + | x3 ⇒ couple exadecimal bool x7 false + | x4 ⇒ couple exadecimal bool x8 false + | x5 ⇒ couple exadecimal bool x9 false + | x6 ⇒ couple exadecimal bool xA false + | x7 ⇒ couple exadecimal bool xB false + | x8 ⇒ couple exadecimal bool xC false + | x9 ⇒ couple exadecimal bool xD false + | xA ⇒ couple exadecimal bool xE false + | xB ⇒ couple exadecimal bool xF false + | xC ⇒ couple exadecimal bool x0 true + | xD ⇒ couple exadecimal bool x1 true + | xE ⇒ couple exadecimal bool x2 true + | xF ⇒ couple exadecimal bool x3 true ] + | x5 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x5 false + | x1 ⇒ couple exadecimal bool x6 false + | x2 ⇒ couple exadecimal bool x7 false + | x3 ⇒ couple exadecimal bool x8 false + | x4 ⇒ couple exadecimal bool x9 false + | x5 ⇒ couple exadecimal bool xA false + | x6 ⇒ couple exadecimal bool xB false + | x7 ⇒ couple exadecimal bool xC false + | x8 ⇒ couple exadecimal bool xD false + | x9 ⇒ couple exadecimal bool xE false + | xA ⇒ couple exadecimal bool xF false + | xB ⇒ couple exadecimal bool x0 true + | xC ⇒ couple exadecimal bool x1 true + | xD ⇒ couple exadecimal bool x2 true + | xE ⇒ couple exadecimal bool x3 true + | xF ⇒ couple exadecimal bool x4 true ] + | x6 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x6 false + | x1 ⇒ couple exadecimal bool x7 false + | x2 ⇒ couple exadecimal bool x8 false + | x3 ⇒ couple exadecimal bool x9 false + | x4 ⇒ couple exadecimal bool xA false + | x5 ⇒ couple exadecimal bool xB false + | x6 ⇒ couple exadecimal bool xC false + | x7 ⇒ couple exadecimal bool xD false + | x8 ⇒ couple exadecimal bool xE false + | x9 ⇒ couple exadecimal bool xF false + | xA ⇒ couple exadecimal bool x0 true + | xB ⇒ couple exadecimal bool x1 true + | xC ⇒ couple exadecimal bool x2 true + | xD ⇒ couple exadecimal bool x3 true + | xE ⇒ couple exadecimal bool x4 true + | xF ⇒ couple exadecimal bool x5 true ] + | x7 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x7 false + | x1 ⇒ couple exadecimal bool x8 false + | x2 ⇒ couple exadecimal bool x9 false + | x3 ⇒ couple exadecimal bool xA false + | x4 ⇒ couple exadecimal bool xB false + | x5 ⇒ couple exadecimal bool xC false + | x6 ⇒ couple exadecimal bool xD false + | x7 ⇒ couple exadecimal bool xE false + | x8 ⇒ couple exadecimal bool xF false + | x9 ⇒ couple exadecimal bool x0 true + | xA ⇒ couple exadecimal bool x1 true + | xB ⇒ couple exadecimal bool x2 true + | xC ⇒ couple exadecimal bool x3 true + | xD ⇒ couple exadecimal bool x4 true + | xE ⇒ couple exadecimal bool x5 true + | xF ⇒ couple exadecimal bool x6 true ] + | x8 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x8 false + | x1 ⇒ couple exadecimal bool x9 false + | x2 ⇒ couple exadecimal bool xA false + | x3 ⇒ couple exadecimal bool xB false + | x4 ⇒ couple exadecimal bool xC false + | x5 ⇒ couple exadecimal bool xD false + | x6 ⇒ couple exadecimal bool xE false + | x7 ⇒ couple exadecimal bool xF false + | x8 ⇒ couple exadecimal bool x0 true + | x9 ⇒ couple exadecimal bool x1 true + | xA ⇒ couple exadecimal bool x2 true + | xB ⇒ couple exadecimal bool x3 true + | xC ⇒ couple exadecimal bool x4 true + | xD ⇒ couple exadecimal bool x5 true + | xE ⇒ couple exadecimal bool x6 true + | xF ⇒ couple exadecimal bool x7 true ] + | x9 ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool x9 false + | x1 ⇒ couple exadecimal bool xA false + | x2 ⇒ couple exadecimal bool xB false + | x3 ⇒ couple exadecimal bool xC false + | x4 ⇒ couple exadecimal bool xD false + | x5 ⇒ couple exadecimal bool xE false + | x6 ⇒ couple exadecimal bool xF false + | x7 ⇒ couple exadecimal bool x0 true + | x8 ⇒ couple exadecimal bool x1 true + | x9 ⇒ couple exadecimal bool x2 true + | xA ⇒ couple exadecimal bool x3 true + | xB ⇒ couple exadecimal bool x4 true + | xC ⇒ couple exadecimal bool x5 true + | xD ⇒ couple exadecimal bool x6 true + | xE ⇒ couple exadecimal bool x7 true + | xF ⇒ couple exadecimal bool x8 true ] + | xA ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xA false + | x1 ⇒ couple exadecimal bool xB false + | x2 ⇒ couple exadecimal bool xC false + | x3 ⇒ couple exadecimal bool xD false + | x4 ⇒ couple exadecimal bool xE false + | x5 ⇒ couple exadecimal bool xF false + | x6 ⇒ couple exadecimal bool x0 true + | x7 ⇒ couple exadecimal bool x1 true + | x8 ⇒ couple exadecimal bool x2 true + | x9 ⇒ couple exadecimal bool x3 true + | xA ⇒ couple exadecimal bool x4 true + | xB ⇒ couple exadecimal bool x5 true + | xC ⇒ couple exadecimal bool x6 true + | xD ⇒ couple exadecimal bool x7 true + | xE ⇒ couple exadecimal bool x8 true + | xF ⇒ couple exadecimal bool x9 true ] + | xB ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xB false + | x1 ⇒ couple exadecimal bool xC false + | x2 ⇒ couple exadecimal bool xD false + | x3 ⇒ couple exadecimal bool xE false + | x4 ⇒ couple exadecimal bool xF false + | x5 ⇒ couple exadecimal bool x0 true + | x6 ⇒ couple exadecimal bool x1 true + | x7 ⇒ couple exadecimal bool x2 true + | x8 ⇒ couple exadecimal bool x3 true + | x9 ⇒ couple exadecimal bool x4 true + | xA ⇒ couple exadecimal bool x5 true + | xB ⇒ couple exadecimal bool x6 true + | xC ⇒ couple exadecimal bool x7 true + | xD ⇒ couple exadecimal bool x8 true + | xE ⇒ couple exadecimal bool x9 true + | xF ⇒ couple exadecimal bool xA true ] + | xC ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xC false + | x1 ⇒ couple exadecimal bool xD false + | x2 ⇒ couple exadecimal bool xE false + | x3 ⇒ couple exadecimal bool xF false + | x4 ⇒ couple exadecimal bool x0 true + | x5 ⇒ couple exadecimal bool x1 true + | x6 ⇒ couple exadecimal bool x2 true + | x7 ⇒ couple exadecimal bool x3 true + | x8 ⇒ couple exadecimal bool x4 true + | x9 ⇒ couple exadecimal bool x5 true + | xA ⇒ couple exadecimal bool x6 true + | xB ⇒ couple exadecimal bool x7 true + | xC ⇒ couple exadecimal bool x8 true + | xD ⇒ couple exadecimal bool x9 true + | xE ⇒ couple exadecimal bool xA true + | xF ⇒ couple exadecimal bool xB true ] + | xD ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xD false + | x1 ⇒ couple exadecimal bool xE false + | x2 ⇒ couple exadecimal bool xF false + | x3 ⇒ couple exadecimal bool x0 true + | x4 ⇒ couple exadecimal bool x1 true + | x5 ⇒ couple exadecimal bool x2 true + | x6 ⇒ couple exadecimal bool x3 true + | x7 ⇒ couple exadecimal bool x4 true + | x8 ⇒ couple exadecimal bool x5 true + | x9 ⇒ couple exadecimal bool x6 true + | xA ⇒ couple exadecimal bool x7 true + | xB ⇒ couple exadecimal bool x8 true + | xC ⇒ couple exadecimal bool x9 true + | xD ⇒ couple exadecimal bool xA true + | xE ⇒ couple exadecimal bool xB true + | xF ⇒ couple exadecimal bool xC true ] + | xE ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xE false + | x1 ⇒ couple exadecimal bool xF false + | x2 ⇒ couple exadecimal bool x0 true + | x3 ⇒ couple exadecimal bool x1 true + | x4 ⇒ couple exadecimal bool x2 true + | x5 ⇒ couple exadecimal bool x3 true + | x6 ⇒ couple exadecimal bool x4 true + | x7 ⇒ couple exadecimal bool x5 true + | x8 ⇒ couple exadecimal bool x6 true + | x9 ⇒ couple exadecimal bool x7 true + | xA ⇒ couple exadecimal bool x8 true + | xB ⇒ couple exadecimal bool x9 true + | xC ⇒ couple exadecimal bool xA true + | xD ⇒ couple exadecimal bool xB true + | xE ⇒ couple exadecimal bool xC true + | xF ⇒ couple exadecimal bool xD true ] + | xF ⇒ + match b2 with + [ x0 ⇒ couple exadecimal bool xF false + | x1 ⇒ couple exadecimal bool x0 true + | x2 ⇒ couple exadecimal bool x1 true + | x3 ⇒ couple exadecimal bool x2 true + | x4 ⇒ couple exadecimal bool x3 true + | x5 ⇒ couple exadecimal bool x4 true + | x6 ⇒ couple exadecimal bool x5 true + | x7 ⇒ couple exadecimal bool x6 true + | x8 ⇒ couple exadecimal bool x7 true + | x9 ⇒ couple exadecimal bool x8 true + | xA ⇒ couple exadecimal bool x9 true + | xB ⇒ couple exadecimal bool xA true + | xC ⇒ couple exadecimal bool xB true + | xD ⇒ couple exadecimal bool xC true + | xE ⇒ couple exadecimal bool xD true + | xF ⇒ couple exadecimal bool xE true ] + ] + ] +. + +definition nat_of_exadecimal ≝ + λb. + match b with + [ x0 ⇒ 0 + | x1 ⇒ 1 + | x2 ⇒ 2 + | x3 ⇒ 3 + | x4 ⇒ 4 + | x5 ⇒ 5 + | x6 ⇒ 6 + | x7 ⇒ 7 + | x8 ⇒ 8 + | x9 ⇒ 9 + | xA ⇒ 10 + | xB ⇒ 11 + | xC ⇒ 12 + | xD ⇒ 13 + | xE ⇒ 14 + | xF ⇒ 15 + ]. + +coercion cic:/matita/assembly/exadecimal/nat_of_exadecimal.con. + +let rec exadecimal_of_nat b ≝ + match b with [ O ⇒ x0 | S b ⇒ + match b with [ O ⇒ x1 | S b ⇒ + match b with [ O ⇒ x2 | S b ⇒ + match b with [ O ⇒ x3 | S b ⇒ + match b with [ O ⇒ x4 | S b ⇒ + match b with [ O ⇒ x5 | S b ⇒ + match b with [ O ⇒ x6 | S b ⇒ + match b with [ O ⇒ x7 | S b ⇒ + match b with [ O ⇒ x8 | S b ⇒ + match b with [ O ⇒ x9 | S b ⇒ + match b with [ O ⇒ xA | S b ⇒ + match b with [ O ⇒ xB | S b ⇒ + match b with [ O ⇒ xC | S b ⇒ + match b with [ O ⇒ xD | S b ⇒ + match b with [ O ⇒ xE | S b ⇒ + match b with [ O ⇒ xF | S b ⇒ exadecimal_of_nat b ]]]]]]]]]]]]]]]]. + +lemma lt_nat_of_exadecimal_16: ∀b. nat_of_exadecimal b < 16. + intro; + elim b; + simplify; + [ + |*: repeat (apply lt_to_lt_S_S) + ]; + autobatch. +qed. + +lemma exadecimal_of_nat_mod: + ∀n.exadecimal_of_nat n = exadecimal_of_nat (n \mod 16). + intros; + apply (nat_elim1 n); intro; + cases m; [ intro; reflexivity | ]; + cases n1; [ intro; reflexivity | ]; + cases n2; [ intro; reflexivity | ]; + cases n3; [ intro; reflexivity | ]; + cases n4; [ intro; reflexivity | ]; + cases n5; [ intro; reflexivity | ]; + cases n6; [ intro; reflexivity | ]; + cases n7; [ intro; reflexivity | ]; + cases n8; [ intro; reflexivity | ]; + cases n9; [ intro; reflexivity | ]; + cases n10; [ intro; reflexivity | ]; + cases n11; [ intro; reflexivity | ]; + cases n12; [ intro; reflexivity | ]; + cases n13; [ intro; reflexivity | ]; + cases n14; [ intro; reflexivity | ]; + cases n15; [ intro; reflexivity | ]; + intros; + change in ⊢ (? ? % ?) with (exadecimal_of_nat n16); + change in ⊢ (? ? ? (? (? % ?))) with (16 + n16); + rewrite > mod_plus; + change in ⊢ (? ? ? (? (? % ?))) with (n16 \mod 16); + rewrite < mod_mod; + [ apply H; + unfold lt; + autobatch. + | autobatch + ] +qed. + +lemma nat_of_exadecimal_exadecimal_of_nat: + ∀n. nat_of_exadecimal (exadecimal_of_nat n) = n \mod 16. + intro; + rewrite > exadecimal_of_nat_mod; + generalize in match (lt_mod_m_m n 16 ?); [2: autobatch | ] + generalize in match (n \mod 16); intro; + cases n1; [ intro; reflexivity | ]; + cases n2; [ intro; reflexivity | ]; + cases n3; [ intro; reflexivity | ]; + cases n4; [ intro; reflexivity | ]; + cases n5; [ intro; reflexivity | ]; + cases n6; [ intro; reflexivity | ]; + cases n7; [ intro; reflexivity | ]; + cases n8; [ intro; reflexivity | ]; + cases n9; [ intro; reflexivity | ]; + cases n10; [ intro; reflexivity | ]; + cases n11 [ intro; reflexivity | ]; + cases n12; [ intro; reflexivity | ]; + cases n13; [ intro; reflexivity | ]; + cases n14; [ intro; reflexivity | ]; + cases n15; [ intro; reflexivity | ]; + cases n16; [ intro; reflexivity | ]; + intro; + unfold lt in H; + cut False; + [ elim Hcut + | autobatch + ] +qed. + +lemma exadecimal_of_nat_nat_of_exadecimal: + ∀b.exadecimal_of_nat (nat_of_exadecimal b) = b. + intro; + elim b; + reflexivity. +qed. + +lemma plusex_ok: + ∀b1,b2,c. + match plusex b1 b2 c with + [ couple r c' ⇒ b1 + b2 + nat_of_bool c = nat_of_exadecimal r + nat_of_bool c' * 16 ]. + intros; + elim b1; (elim b2; (elim c; normalize; reflexivity)). +qed. + +definition xpred ≝ + λb. + match b with + [ x0 ⇒ xF + | x1 ⇒ x0 + | x2 ⇒ x1 + | x3 ⇒ x2 + | x4 ⇒ x3 + | x5 ⇒ x4 + | x6 ⇒ x5 + | x7 ⇒ x6 + | x8 ⇒ x7 + | x9 ⇒ x8 + | xA ⇒ x9 + | xB ⇒ xA + | xC ⇒ xB + | xD ⇒ xC + | xE ⇒ xD + | xF ⇒ xE ]. + +lemma eq_eqex_S_x0_false: + ∀n. n < 15 → eqex x0 (exadecimal_of_nat (S n)) = false. + intro; + cases n 0; [ intro; simplify; reflexivity | clear n]; + cases n1 0; [ intro; simplify; reflexivity | clear n1]; + cases n 0; [ intro; simplify; reflexivity | clear n]; + cases n1 0; [ intro; simplify; reflexivity | clear n1]; + cases n 0; [ intro; simplify; reflexivity | clear n]; + cases n1 0; [ intro; simplify; reflexivity | clear n1]; + cases n 0; [ intro; simplify; reflexivity | clear n]; + cases n1 0; [ intro; simplify; reflexivity | clear n1]; + cases n 0; [ intro; simplify; reflexivity | clear n]; + cases n1 0; [ intro; simplify; reflexivity | clear n1]; + cases n 0; [ intro; simplify; reflexivity | clear n]; + cases n1 0; [ intro; simplify; reflexivity | clear n1]; + cases n 0; [ intro; simplify; reflexivity | clear n]; + cases n1 0; [ intro; simplify; reflexivity | clear n1]; + cases n 0; [ intro; simplify; reflexivity | clear n]; + intro; + unfold lt in H; + cut (S n1 ≤ 0); + [ elim (not_le_Sn_O ? Hcut) + | do 15 (apply le_S_S_to_le); + assumption + ] +qed. + +lemma eqex_true_to_eq: ∀b,b'. eqex b b' = true → b=b'. + intros 2; + elim b 0; + elim b' 0; + simplify; + intro; + first [ reflexivity | destruct H ]. +qed. + +lemma eqex_false_to_not_eq: ∀b,b'. eqex b b' = false → b ≠ b'. + intros 2; + elim b 0; + elim b' 0; + simplify; + intro; + try (destruct H); + intro K; + destruct K. +qed. + +(* +lemma xpred_S: ∀b. xpred (exadecimal_of_nat (S b)) = exadecimal_of_nat b. + intros; + rewrite > exadecimal_of_nat_mod; + rewrite > exadecimal_of_nat_mod in ⊢ (? ? ? %); +*) diff --git a/matita/library/assembly/extra.ma b/matita/library/assembly/extra.ma new file mode 100644 index 000000000..fb384d2f2 --- /dev/null +++ b/matita/library/assembly/extra.ma @@ -0,0 +1,84 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "nat/div_and_mod.ma". +include "nat/primes.ma". +include "list/list.ma". + +axiom mod_plus: ∀a,b,m. (a + b) \mod m = (a \mod m + b \mod m) \mod m. +axiom mod_mod: ∀a,n,m. n∣m → a \mod n = a \mod n \mod m. +axiom eq_mod_times_n_m_m_O: ∀n,m. O < m → n * m \mod m = O. +axiom eq_mod_to_eq_plus_mod: ∀a,b,c,m. a \mod m = b \mod m → (a+c) \mod m = (b+c) \mod m. +axiom eq_mod_times_times_mod: ∀a,b,n,m. m = a*n → (a*b) \mod m = a * (b \mod n). +axiom divides_to_eq_mod_mod_mod: ∀a,n,m. n∣m → a \mod m \mod n = a \mod n. +axiom le_to_le_plus_to_le : ∀a,b,c,d.b\leq d\rarr a+b\leq c+d\rarr a\leq c. +axiom or_lt_le : ∀n,m. n < m ∨ m ≤ n. + +inductive cartesian_product (A,B: Type) : Type ≝ + couple: ∀a:A.∀b:B. cartesian_product A B. + +lemma le_to_lt: ∀n,m. n ≤ m → n < S m. + intros; + autobatch. +qed. + +alias num (instance 0) = "natural number". +definition nat_of_bool ≝ + λb. match b with [ true ⇒ 1 | false ⇒ 0 ]. + +theorem lt_trans: ∀x,y,z. x < y → y < z → x < z. + unfold lt; + intros; + autobatch. +qed. + +lemma leq_m_n_to_eq_div_n_m_S: ∀n,m:nat. 0 < m → m ≤ n → ∃z. n/m = S z. + intros; + unfold div; + apply (ex_intro ? ? (div_aux (pred n) (n-m) (pred m))); + cut (∃w.m = S w); + [ elim Hcut; + rewrite > H2; + rewrite > H2 in H1; + clear Hcut; clear H2; clear H; (*clear m;*) + simplify; + unfold in ⊢ (? ? % ?); + cut (∃z.n = S z); + [ elim Hcut; clear Hcut; + rewrite > H in H1; + rewrite > H; clear m; + change in ⊢ (? ? % ?) with + (match leb (S a1) a with + [ true ⇒ O + | false ⇒ S (div_aux a1 ((S a1) - S a) a)]); + cut (S a1 ≰ a); + [ apply (leb_elim (S a1) a); + [ intro; + elim (Hcut H2) + | intro; + simplify; + reflexivity + ] + | intro; + autobatch + ] + | elim H1; autobatch + ] + | autobatch + ]. +qed. + +axiom daemon: False. diff --git a/matita/library/assembly/test.ma b/matita/library/assembly/test.ma new file mode 100644 index 000000000..61e8be4a8 --- /dev/null +++ b/matita/library/assembly/test.ma @@ -0,0 +1,289 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "assembly/vm.ma". + +definition mult_source : list byte ≝ + [#LDAi; 〈x0, x0〉; (* A := 0 *) + #STAd; 〈x2, x0〉; (* Z := A *) + #LDAd; 〈x1, xF〉; (* (l1) A := Y *) + #BEQ; 〈x0, xA〉; (* if A == 0 then goto l2 *) + #LDAd; 〈x2, x0〉; (* A := Z *) + #DECd; 〈x1, xF〉; (* Y := Y - 1 *) + #ADDd; 〈x1, xE〉; (* A += X *) + #STAd; 〈x2, x0〉; (* Z := A *) + #BRA; 〈xF, x2〉; (* goto l1 *) + #LDAd; 〈x2, x0〉].(* (l2) *) + +definition mult_memory ≝ + λx,y.λa:addr. + match leb a 29 with + [ true ⇒ nth ? mult_source 〈x0, x0〉 a + | false ⇒ + match eqb a 30 with + [ true ⇒ x + | false ⇒ y + ] + ]. + +definition mult_status ≝ + λx,y. + mk_status 〈x0, x0〉 0 0 false false (mult_memory x y) 0. + +notation " 'M' \sub (x y)" non associative with precedence 80 for + @{ 'memory $x $y }. + +interpretation "mult_memory" 'memory x y = + (cic:/matita/assembly/test/mult_memory.con x y). + +notation " 'M' \sub (x y) \nbsp a" non associative with precedence 80 for + @{ 'memory4 $x $y $a }. + +interpretation "mult_memory4" 'memory4 x y a = + (cic:/matita/assembly/test/mult_memory.con x y a). + +notation " \Sigma \sub (x y)" non associative with precedence 80 for + @{ 'status $x $y }. + +interpretation "mult_status" 'status x y = + (cic:/matita/assembly/test/mult_status.con x y). + +lemma test_O_O: + let i ≝ 14 in + let s ≝ execute (mult_status 〈x0, x0〉 〈x0, x0〉) i in + pc s = 20 ∧ mem s 32 = byte_of_nat 0. + split; + reflexivity. +qed. + +lemma test_0_2: + let x ≝ 〈x0, x0〉 in + let y ≝ 〈x0, x2〉 in + let i ≝ 14 + 23 * nat_of_byte y in + let s ≝ execute (mult_status x y) i in + pc s = 20 ∧ mem s 32 = plusbytenc x x. + intros; + split; + reflexivity. +qed. + +lemma test_x_1: + ∀x. + let y ≝ 〈x0, x1〉 in + let i ≝ 14 + 23 * nat_of_byte y in + let s ≝ execute (mult_status x y) i in + pc s = 20 ∧ mem s 32 = x. + intros; + split; + [ reflexivity + | change in ⊢ (? ? % ?) with (plusbytenc 〈x0, x0〉 x); + rewrite > plusbytenc_O_x; + reflexivity + ]. +qed. + +lemma test_x_2: + ∀x. + let y ≝ 〈x0, x2〉 in + let i ≝ 14 + 23 * nat_of_byte y in + let s ≝ execute (mult_status x y) i in + pc s = 20 ∧ mem s 32 = plusbytenc x x. + intros; + split; + [ reflexivity + | change in ⊢ (? ? % ?) with + (plusbytenc (plusbytenc 〈x0, x0〉 x) x); + rewrite > plusbytenc_O_x; + reflexivity + ]. +qed. + +lemma loop_invariant': + ∀x,y:byte.∀j:nat. j ≤ y → + execute (mult_status x y) (5 + 23*j) + = + mk_status (byte_of_nat (x * j)) 4 0 (eqbyte 〈x0, x0〉 (byte_of_nat (x*j))) + (plusbytec (byte_of_nat (x*pred j)) x) + (update (update (update (mult_memory x y) 30 x) 31 (byte_of_nat (y - j))) 32 + (byte_of_nat (x * j))) + 0. + intros 3; + elim j; + [ do 2 (rewrite < times_n_O); + apply status_eq; + [1,2,3,4,7: normalize; reflexivity + | rewrite > eq_plusbytec_x0_x0_x_false; + normalize; + reflexivity + | intro; + rewrite < minus_n_O; + normalize in ⊢ (? ? (? (? ? %) ?) ?); + change in ⊢ (? ? % ?) with (update (mult_memory x y) 32 〈x0, x0〉 a); + simplify in ⊢ (? ? ? %); + change in ⊢ (? ? ? (? (? (? ? ? %) ? ?) ? ? ?)) with (mult_memory x y 30); + rewrite > byte_of_nat_nat_of_byte; + change in ⊢ (? ? ? (? (? ? ? %) ? ? ?)) with (mult_memory x y 31); + apply inj_update; + intro; + rewrite > (eq_update_s_a_sa (update (mult_memory x y) 30 (mult_memory x y 30)) + 31 a); + rewrite > eq_update_s_a_sa; + reflexivity + ] + | cut (5 + 23 * S n = 5 + 23 * n + 23); + [ rewrite > Hcut; clear Hcut; + rewrite > breakpoint; + rewrite > H; clear H; + [2: apply le_S_S_to_le; + apply le_S; + apply H1 + | cut (∃z.y-n=S z ∧ z < 255); + [ elim Hcut; clear Hcut; + elim H; clear H; + rewrite > H2; + (* instruction LDAd *) + change in ⊢ (? ? (? ? %) ?) with (3+20); + rewrite > breakpoint in ⊢ (? ? % ?); + whd in ⊢ (? ? (? % ?) ?); + normalize in ⊢ (? ? (? (? ? % ? ? ? ? ?) ?) ?); + change in ⊢ (? ? (? (? % ? ? ? ? ? ?) ?) ?) + with (byte_of_nat (S a)); + change in ⊢ (? ? (? (? ? ? ? (? ? %) ? ? ?) ?) ?) with + (byte_of_nat (S a)); + (* instruction BEQ *) + change in ⊢ (? ? (? ? %) ?) with (3+17); + rewrite > breakpoint in ⊢ (? ? % ?); + whd in ⊢ (? ? (? % ?) ?); + letin K ≝ (eq_eqbyte_x0_x0_byte_of_nat_S_false ? H3); clearbody K; + rewrite > K; clear K; + simplify in ⊢ (? ? (? (? ? % ? ? ? ? ?) ?) ?); + (* instruction LDAd *) + change in ⊢ (? ? (? ? %) ?) with (3+14); + rewrite > breakpoint in ⊢ (? ? % ?); + whd in ⊢ (? ? (? % ?) ?); + change in ⊢ (? ? (? (? % ? ? ? ? ? ?) ?) ?) with (byte_of_nat (x*n)); + normalize in ⊢ (? ? (? (? ? % ? ? ? ? ?) ?) ?); + change in ⊢ (? ? (? (? ? ? ? % ? ? ?) ?) ?) with (eqbyte 〈x0, x0〉 (byte_of_nat (x*n))); + (* instruction DECd *) + change in ⊢ (? ? (? ? %) ?) with (5+9); + rewrite > breakpoint in ⊢ (? ? % ?); + whd in ⊢ (? ? (? % ?) ?); + change in ⊢ (? ? (? (? ? ? ? (? ? %) ? ? ?) ?) ?) with (bpred (byte_of_nat (S a))); + rewrite > (eq_bpred_S_a_a ? H3); + normalize in ⊢ (? ? (? (? ? % ? ? ? ? ?) ?) ?); + normalize in ⊢ (? ? (? (? ? ? ? ? ? (? ? % ?) ?) ?) ?); + cut (y - S n = a); + [2: rewrite > eq_minus_S_pred; + rewrite > H2; + reflexivity | ]; + rewrite < Hcut; clear Hcut; clear H3; clear H2; clear a; + (* instruction ADDd *) + change in ⊢ (? ? (? ? %) ?) with (3+6); + rewrite > breakpoint in ⊢ (? ? % ?); + whd in ⊢ (? ? (? % ?) ?); + change in ⊢ (? ? (? (? % ? ? ? ? ? ?) ?) ?) with + (plusbytenc (byte_of_nat (x*n)) x); + change in ⊢ (? ? (? (? ? ? ? (? ? %) ? ? ?) ?) ?) with + (plusbytenc (byte_of_nat (x*n)) x); + normalize in ⊢ (? ? (? (? ? % ? ? ? ? ?) ?) ?); + change in ⊢ (? ? (? (? ? ? ? ? % ? ?) ?) ?) + with (plusbytec (byte_of_nat (x*n)) x); + rewrite > plusbytenc_S; + (* instruction STAd *) + rewrite > (breakpoint ? 3 3); + whd in ⊢ (? ? (? % ?) ?); + normalize in ⊢ (? ? (? (? ? % ? ? ? ? ?) ?) ?); + (* instruction BRA *) + whd in ⊢ (? ? % ?); + normalize in ⊢ (? ? (? ? % ? ? ? ? ?) ?); + rewrite < pred_Sn; + apply status_eq; + [1,2,3,4,7: normalize; reflexivity + | change with (plusbytec #(x*n) x = plusbytec #(x*n) x); + reflexivity + |6: intro; + simplify in ⊢ (? ? ? %); + normalize in ⊢ (? ? (? (? ? ? ? ? ? (? ? (? %) ?) ?) ?) ?); + change in ⊢ (? ? % ?) with + ((mult_memory x y){30↦x}{31↦#(S (y-S n))}{32↦#(x*n)}{31↦#(y-S n)} + {〈x2,x0〉↦ #(x*S n)} a); + apply inj_update; + intro; + apply inj_update; + intro; + rewrite > not_eq_a_b_to_eq_update_a_b; [2: apply H | ]; + rewrite > not_eq_a_b_to_eq_update_a_b; + [ reflexivity + | assumption + ] + ] + | exists; + [ apply (y - S n) + | split; + [ rewrite < (minus_S_S y n); + apply (minus_Sn_m (nat_of_byte y) (S n) H1) + | letin K ≝ (lt_nat_of_byte_256 y); clearbody K; + letin K' ≝ (lt_minus_m y (S n) ? ?); clearbody K'; + [ apply (lt_to_le_to_lt O (S n) (nat_of_byte y) ? ?); + autobatch + | autobatch + | autobatch + ] + ] + ] + ] + ] + | rewrite > associative_plus; + rewrite < times_n_Sm; + rewrite > sym_plus in ⊢ (? ? ? (? ? %)); + reflexivity + ] + ] +qed. + + +theorem test_x_y: + ∀x,y:byte. + let i ≝ 14 + 23 * y in + execute (mult_status x y) i = + mk_status (#(x*y)) 20 0 + (eqbyte 〈x0, x0〉 (#(x*y))) + (plusbytec (byte_of_nat (x*pred y)) x) + (update + (update (mult_memory x y) 31 〈x0, x0〉) + 32 (byte_of_nat (x*y))) + 0. + intros; + cut (14 + 23 * y = 5 + 23*y + 9); + [2: autobatch paramodulation; + | rewrite > Hcut; (* clear Hcut; *) + rewrite > (breakpoint (mult_status x y) (5 + 23*y) 9); + rewrite > loop_invariant'; + [2: apply le_n + | rewrite < minus_n_n; + apply status_eq; + [1,2,3,4,5,7: normalize; reflexivity + | intro; + simplify in ⊢ (? ? ? %); + change in ⊢ (? ? % ?) with + (update (update (update (mult_memory x y) 30 x) 31 (byte_of_nat O)) 32 +(byte_of_nat (nat_of_byte x*nat_of_byte y)) a); + repeat (apply inj_update; intro); + apply (eq_update_s_a_sa ? 30) + ] + ] + ]. +qed. \ No newline at end of file diff --git a/matita/library/assembly/vm.ma b/matita/library/assembly/vm.ma new file mode 100644 index 000000000..ebe62196a --- /dev/null +++ b/matita/library/assembly/vm.ma @@ -0,0 +1,282 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "assembly/byte.ma". + +definition addr ≝ nat. + +definition addr_of_byte : byte → addr ≝ λb. nat_of_byte b. + +coercion cic:/matita/assembly/vm/addr_of_byte.con. + +inductive opcode: Type ≝ + ADDd: opcode (* 3 clock, 171 *) + | BEQ: opcode (* 3, 55 *) + | BRA: opcode (* 3, 48 *) + | DECd: opcode (* 5, 58 *) + | LDAi: opcode (* 2, 166 *) + | LDAd: opcode (* 3, 182 *) + | STAd: opcode. (* 3, 183 *) + +let rec cycles_of_opcode op : nat ≝ + match op with + [ ADDd ⇒ 3 + | BEQ ⇒ 3 + | BRA ⇒ 3 + | DECd ⇒ 5 + | LDAi ⇒ 2 + | LDAd ⇒ 3 + | STAd ⇒ 3 + ]. + +definition opcodemap ≝ + [ couple ? ? ADDd (mk_byte xA xB); + couple ? ? BEQ (mk_byte x3 x7); + couple ? ? BRA (mk_byte x3 x0); + couple ? ? DECd (mk_byte x3 xA); + couple ? ? LDAi (mk_byte xA x6); + couple ? ? LDAd (mk_byte xB x6); + couple ? ? STAd (mk_byte xB x7) ]. + +definition opcode_of_byte ≝ + λb. + let rec aux l ≝ + match l with + [ nil ⇒ ADDd + | cons c tl ⇒ + match c with + [ couple op n ⇒ + match eqbyte n b with + [ true ⇒ op + | false ⇒ aux tl + ]]] + in + aux opcodemap. + +definition magic_of_opcode ≝ + λop1. + match op1 with + [ ADDd ⇒ 0 + | BEQ ⇒ 1 + | BRA ⇒ 2 + | DECd ⇒ 3 + | LDAi ⇒ 4 + | LDAd ⇒ 5 + | STAd ⇒ 6 ]. + +definition opcodeeqb ≝ + λop1,op2. eqb (magic_of_opcode op1) (magic_of_opcode op2). + +definition byte_of_opcode : opcode → byte ≝ + λop. + let rec aux l ≝ + match l with + [ nil ⇒ mk_byte x0 x0 + | cons c tl ⇒ + match c with + [ couple op' n ⇒ + match opcodeeqb op op' with + [ true ⇒ n + | false ⇒ aux tl + ]]] + in + aux opcodemap. + +notation "hvbox(# break a)" + non associative with precedence 80 +for @{ 'byte_of_opcode $a }. +interpretation "byte_of_opcode" 'byte_of_opcode a = + (cic:/matita/assembly/vm/byte_of_opcode.con a). + +record status : Type ≝ { + acc : byte; + pc : addr; + spc : addr; + zf : bool; + cf : bool; + mem : addr → byte; + clk : nat +}. + +notation "{hvbox('Acc' ≝ acc ; break 'Pc' ≝ pc ; break 'Spc' ≝ spc ; break 'Fz' ≝ fz ; break 'Fc' ≝ fc ; break 'M' ≝ m ; break 'Clk' ≝ clk)}" +non associative with precedence 80 for + @{ 'mkstatus $acc $pc $spc $fz $fc $m $clk }. + +interpretation "mk_status" 'mkstatus acc pc spc fz fc m clk = + (cic:/matita/assembly/vm/status.ind#xpointer(1/1/1) acc pc spc fz fc m clk). + +definition update ≝ + λf: addr → byte.λa.λv.λx. + match eqb x a with + [ true ⇒ v + | false ⇒ f x ]. + +notation "hvbox(m break {a ↦ break v})" non associative with precedence 80 for + @{ 'update $m $a $v }. + +notation "hvbox(m break {a ↦ break v} \nbsp x)" non associative with precedence 80 for + @{ 'update4 $m $a $v $x }. + +interpretation "update" 'update m a v = + (cic:/matita/assembly/vm/update.con m a v). + +interpretation "update4" 'update4 m a v x = + (cic:/matita/assembly/vm/update.con m a v x). + +lemma update_update_a_a: + ∀s,a,v1,v2,b. + update (update s a v1) a v2 b = update s a v2 b. + intros; + unfold update; + unfold update; + elim (eqb b a); + reflexivity. +qed. + +lemma update_update_a_b: + ∀s,a1,v1,a2,v2,b. + a1 ≠ a2 → + update (update s a1 v1) a2 v2 b = update (update s a2 v2) a1 v1 b. + intros; + unfold update; + unfold update; + apply (bool_elim ? (eqb b a1)); intros; + apply (bool_elim ? (eqb b a2)); intros; + simplify; + [ elim H; + rewrite < (eqb_true_to_eq ? ? H1); + apply eqb_true_to_eq; + assumption + |*: reflexivity + ]. +qed. + +lemma eq_update_s_a_sa: ∀s,a,b. update s a (s a) b = s b. + intros; + unfold update; + apply (bool_elim ? (eqb b a) ? ?); simplify; intros; + [ rewrite > (eqb_true_to_eq ? ? H); + reflexivity + | reflexivity + ] +qed. + +lemma inj_update: + ∀s,s',a,v,b. (a ≠ b → s b = s' b) → update s a v b = update s' a v b. + intros; + unfold update; + apply (bool_elim ? (eqb b a) ? ?); simplify; intros; + [ reflexivity + | apply H; + intro; + autobatch + ] +qed. + +lemma not_eq_a_b_to_eq_update_a_b: ∀s,a,b,v. a ≠ b → update s a v b = s b. + intros; + unfold update; + rewrite > not_eq_to_eqb_false; simplify; + [ reflexivity + | intro; + autobatch + ] +qed. + +definition mmod16 ≝ λn. nat_of_byte (byte_of_nat n). + +definition tick ≝ + λs:status. match s with [ mk_status acc pc spc zf cf mem clk ⇒ + let opc ≝ opcode_of_byte (mem pc) in + let op1 ≝ mem (S pc) in + let clk' ≝ cycles_of_opcode opc in + match eqb (S clk) clk' with + [ true ⇒ + match opc with + [ ADDd ⇒ + let res ≝ plusbyte acc (mem op1) false in (* verify carrier! *) + let acc' ≝ match res with [ couple acc' _ ⇒ acc' ] in + let c' ≝ match res with [ couple _ c' ⇒ c'] in + mk_status acc' (2 + pc) spc + (eqbyte (mk_byte x0 x0) acc') c' mem 0 (* verify carrier! *) + | BEQ ⇒ + mk_status + acc + (match zf with + [ true ⇒ mmod16 (2 + op1 + pc) (*\mod 256*) (* signed!!! *) + (* FIXME: can't work - address truncated to 8 bits *) + | false ⇒ 2 + pc + ]) + spc + zf + cf + mem + 0 + | BRA ⇒ + mk_status + acc (mmod16 (2 + op1 + pc) (*\mod 256*)) (* signed!!! *) + (* FIXME: same as above *) + spc + zf + cf + mem + 0 + | DECd ⇒ + let x ≝ bpred (mem op1) in (* signed!!! *) + let mem' ≝ update mem op1 x in + mk_status acc (2 + pc) spc + (eqbyte (mk_byte x0 x0) x) cf mem' 0 (* check zb!!! *) + | LDAi ⇒ + mk_status op1 (2 + pc) spc (eqbyte (mk_byte x0 x0) op1) cf mem 0 + | LDAd ⇒ + let x ≝ mem op1 in + mk_status x (2 + pc) spc (eqbyte (mk_byte x0 x0) x) cf mem 0 + | STAd ⇒ + mk_status acc (2 + pc) spc zf cf + (update mem op1 acc) 0 + ] + | false ⇒ + mk_status + acc pc spc zf cf mem (S clk) + ]]. + +let rec execute s n on n ≝ + match n with + [ O ⇒ s + | S n' ⇒ execute (tick s) n' + ]. + +lemma breakpoint: + ∀s,n1,n2. execute s (n1 + n2) = execute (execute s n1) n2. + intros; + generalize in match s; clear s; + elim n1; + [ reflexivity + | simplify; + apply H; + ] +qed. + +axiom status_eq: + ∀s,s'. + acc s = acc s' → + pc s = pc s' → + spc s = spc s' → + zf s = zf s' → + cf s = cf s' → + (∀a. mem s a = mem s' a) → + clk s = clk s' → + s=s'. diff --git a/matita/library/datatypes/bool.ma b/matita/library/datatypes/bool.ma new file mode 100644 index 000000000..80b3d72d6 --- /dev/null +++ b/matita/library/datatypes/bool.ma @@ -0,0 +1,199 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "logic/equality.ma". +include "higher_order_defs/functions.ma". + +inductive bool : Set \def + | true : bool + | false : bool. + +theorem bool_elim: \forall P:bool \to Prop. \forall b:bool. + (b = true \to P true) + \to (b = false \to P false) + \to P b. + intros 2 (P b). + elim b; + [ apply H; reflexivity + | apply H1; reflexivity + ] +qed. + +theorem not_eq_true_false : true \neq false. +unfold Not.intro. +change with +match true with +[ true \Rightarrow False +| false \Rightarrow True]. +rewrite > H.simplify.exact I. +qed. + +definition notb : bool \to bool \def +\lambda b:bool. + match b with + [ true \Rightarrow false + | false \Rightarrow true ]. + +theorem notb_elim: \forall b:bool.\forall P:bool \to Prop. +match b with +[ true \Rightarrow P false +| false \Rightarrow P true] \to P (notb b). +intros 2.elim b.exact H. exact H. +qed. + +theorem notb_notb: \forall b:bool. notb (notb b) = b. +intros. +elim b;reflexivity. +qed. + +theorem injective_notb: injective bool bool notb. +unfold injective. +intros. +rewrite < notb_notb. +rewrite < (notb_notb y). +apply eq_f. +assumption. +qed. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "boolean not" 'not x = (cic:/matita/datatypes/bool/notb.con x). + +definition andb : bool \to bool \to bool\def +\lambda b1,b2:bool. + match b1 with + [ true \Rightarrow b2 + | false \Rightarrow false ]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "boolean and" 'and x y = (cic:/matita/datatypes/bool/andb.con x y). + +theorem andb_elim: \forall b1,b2:bool. \forall P:bool \to Prop. +match b1 with +[ true \Rightarrow P b2 +| false \Rightarrow P false] \to P (b1 \land b2). +intros 3.elim b1.exact H. exact H. +qed. + +theorem and_true: \forall a,b:bool. +andb a b =true \to a =true \land b= true. +intro.elim a + [split + [reflexivity|assumption] + |apply False_ind. + apply not_eq_true_false. + apply sym_eq. + assumption + ] +qed. + +theorem andb_true_true: \forall b1,b2. (b1 \land b2) = true \to b1 = true. +intro. elim b1. +reflexivity. +assumption. +qed. + +theorem andb_true_true_r: \forall b1,b2. (b1 \land b2) = true \to b2 = true. +intro. elim b1 + [assumption + |apply False_ind.apply not_eq_true_false. + apply sym_eq.assumption + ] +qed. + +definition orb : bool \to bool \to bool\def +\lambda b1,b2:bool. + match b1 with + [ true \Rightarrow true + | false \Rightarrow b2]. + +theorem orb_elim: \forall b1,b2:bool. \forall P:bool \to Prop. +match b1 with +[ true \Rightarrow P true +| false \Rightarrow P b2] \to P (orb b1 b2). +intros 3.elim b1.exact H. exact H. +qed. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "boolean or" 'or x y = (cic:/matita/datatypes/bool/orb.con x y). + +definition if_then_else : bool \to Prop \to Prop \to Prop \def +\lambda b:bool.\lambda P,Q:Prop. +match b with +[ true \Rightarrow P +| false \Rightarrow Q]. + +(*CSC: missing notation for if_then_else *) + +theorem bool_to_decidable_eq: + \forall b1,b2:bool. decidable (b1=b2). + intros. + unfold decidable. + elim b1. + elim b2. + left. reflexivity. + right. exact not_eq_true_false. + elim b2. + right. unfold Not. intro. + apply not_eq_true_false. + symmetry. exact H. + left. reflexivity. +qed. + +theorem P_x_to_P_x_to_eq: + \forall A:Set. \forall P: A \to bool. + \forall x:A. \forall p1,p2:P x = true. p1 = p2. + intros. + apply eq_to_eq_to_eq_p_q. + exact bool_to_decidable_eq. +qed. + + +(* some basic properties of and - or*) +theorem andb_sym: \forall A,B:bool. +(A \land B) = (B \land A). +intros. +elim A; + elim B; + simplify; + reflexivity. +qed. + +theorem andb_assoc: \forall A,B,C:bool. +(A \land (B \land C)) = ((A \land B) \land C). +intros. +elim A; + elim B; + elim C; + simplify; + reflexivity. +qed. + +theorem orb_sym: \forall A,B:bool. +(A \lor B) = (B \lor A). +intros. +elim A; + elim B; + simplify; + reflexivity. +qed. + +theorem true_to_true_to_andb_true: \forall A,B:bool. +A = true \to B = true \to (A \land B) = true. +intros. +rewrite > H. +rewrite > H1. +reflexivity. +qed. \ No newline at end of file diff --git a/matita/library/datatypes/compare.ma b/matita/library/datatypes/compare.ma new file mode 100644 index 000000000..bfef10a62 --- /dev/null +++ b/matita/library/datatypes/compare.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +inductive compare :Set \def +| LT : compare +| EQ : compare +| GT : compare. + +definition compare_invert: compare \to compare \def + \lambda c. + match c with + [ LT \Rightarrow GT + | EQ \Rightarrow EQ + | GT \Rightarrow LT ]. diff --git a/matita/library/datatypes/constructors.ma b/matita/library/datatypes/constructors.ma new file mode 100644 index 000000000..2ec0a5c46 --- /dev/null +++ b/matita/library/datatypes/constructors.ma @@ -0,0 +1,79 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + +include "logic/equality.ma". + +inductive void : Set \def. + +inductive unit : Set ≝ something: unit. + +inductive Prod (A,B:Type) : Type \def +pair : A \to B \to Prod A B. + +interpretation "Pair construction" 'pair x y = + (cic:/matita/datatypes/constructors/Prod.ind#xpointer(1/1/1) _ _ x y). + +notation "hvbox(\langle x break , y \rangle )" with precedence 89 +for @{ 'pair $x $y}. + +interpretation "Product" 'product x y = + (cic:/matita/datatypes/constructors/Prod.ind#xpointer(1/1) x y). + +notation "hvbox(x break \times y)" with precedence 89 +for @{ 'product $x $y}. + +definition fst \def \lambda A,B:Set.\lambda p: Prod A B. +match p with +[(pair a b) \Rightarrow a]. + +definition snd \def \lambda A,B:Set.\lambda p: Prod A B. +match p with +[(pair a b) \Rightarrow b]. + +interpretation "First projection" 'fst x = + (cic:/matita/datatypes/constructors/fst.con _ _ x). + +notation "\fst x" with precedence 89 +for @{ 'fst $x}. + +interpretation "Second projection" 'snd x = + (cic:/matita/datatypes/constructors/snd.con _ _ x). + +notation "\snd x" with precedence 89 +for @{ 'snd $x}. + +theorem eq_pair_fst_snd: \forall A,B:Set.\forall p:Prod A B. +p = 〈 (\fst p), (\snd p) 〉. +intros.elim p.simplify.reflexivity. +qed. + +inductive Sum (A,B:Set) : Set \def + inl : A \to Sum A B +| inr : B \to Sum A B. + +inductive ProdT (A,B:Type) : Type \def +pairT : A \to B \to ProdT A B. + +definition fstT \def \lambda A,B:Type.\lambda p: ProdT A B. +match p with +[(pairT a b) \Rightarrow a]. + +definition sndT \def \lambda A,B:Type.\lambda p: ProdT A B. +match p with +[(pairT a b) \Rightarrow b]. + +inductive option (A:Type) : Type ≝ + None : option A + | Some : A → option A. \ No newline at end of file diff --git a/matita/library/decidable_kit/decidable.ma b/matita/library/decidable_kit/decidable.ma new file mode 100644 index 000000000..9bb82f034 --- /dev/null +++ b/matita/library/decidable_kit/decidable.ma @@ -0,0 +1,197 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +(* classical connectives for decidable properties *) + +include "decidable_kit/streicher.ma". +include "datatypes/bool.ma". +include "logic/connectives.ma". +include "nat/compare.ma". + +(* se non includi connectives accade un errore in modo reproducibile*) + +(* ### Prop <-> bool reflection predicate and lemmas for switching ### *) +inductive reflect (P : Prop) : bool → Type ≝ + | reflect_true : P → reflect P true + | reflect_false: ¬P → reflect P false. + +lemma b2pT : ∀P,b. reflect P b → b = true → P. +intros 3 (P b H); +(* XXX generalize in match H; clear H; rewrite > Db;*) +(* la rewrite pare non andare se non faccio la generalize *) +(* non va inversion: intros (H);inversion H; *) +cases H; [intros; assumption | intros 1 (ABS); destruct ABS ] +qed. + +lemma b2pF : ∀P,b. reflect P b → b = false → ¬P. +intros 3 (P b H); +cases H; [intros 1 (ABS); destruct ABS| intros; assumption] +qed. + +lemma p2bT : ∀P,b. reflect P b → P → b = true. +intros 4 (P b H Hp); +cases H (Ht Hf); [ intros; reflexivity | cases (Hf Hp)] +qed. + +lemma p2bF : ∀P,b. reflect P b → ¬P → b = false. +intros 4 (P b H Hp); +cases H (Ht Hf); [ cases (Hp Ht) | reflexivity ] +qed. + +lemma idP : ∀b:bool.reflect (b=true) b. +intros (b); cases b; [ constructor 1; reflexivity | constructor 2;] +unfold Not; intros (H); destruct H; +qed. + +lemma prove_reflect : ∀P:Prop.∀b:bool. + (b = true → P) → (b = false → ¬P) → reflect P b. +intros 2 (P b); cases b; intros; [left|right] autobatch. +qed. + +(* ### standard connectives/relations with reflection predicate ### *) + +definition negb : bool → bool ≝ λb.match b with [ true ⇒ false | false ⇒ true]. + +lemma negbP : ∀b:bool.reflect (b = false) (negb b). +intros (b); cases b; simplify; [apply reflect_false | apply reflect_true] +[unfold Not; intros (H); destruct H | reflexivity] +qed. + +definition andb : bool → bool → bool ≝ + λa,b:bool. match a with [ true ⇒ b | false ⇒ false ]. + +lemma andbP : ∀a,b:bool. reflect (a = true ∧ b = true) (andb a b). +intros (a b); apply prove_reflect; cases a; cases b; simplify; intros (H); +[1,2,3,4: rewrite > H; split; reflexivity; +|5,6,7,8: unfold Not; intros (H1); cases H1; + [destruct H|destruct H3|destruct H2|destruct H2]] +qed. + +lemma andbPF : ∀a,b:bool. reflect (a = false ∨ b = false) (negb (andb a b)). +intros (a b); apply prove_reflect; cases a; cases b; simplify; intros (H); +[1,2,3,4: rewrite > H; [1,2:right|3,4:left] reflexivity +|5,6,7,8: unfold Not; intros (H1); [2,3,4: destruct H]; cases H1; destruct H2] +qed. + +definition orb : bool → bool → bool ≝ + λa,b.match a in bool with [true ⇒ true | false ⇒ b]. + +lemma orbP : ∀a,b:bool. reflect (a = true ∨ b = true) (orb a b). +intros (a b); cases a; cases b; simplify; +[1,2,3: apply reflect_true; [1,2: left | right ]; reflexivity +| apply reflect_false; unfold Not; intros (H); cases H (E E); destruct E] +qed. + +lemma orbC : ∀a,b. orb a b = orb b a. +intros (a b); cases a; cases b; autobatch. qed. + +lemma lebP: ∀x,y. reflect (x ≤ y) (leb x y). +intros (x y); generalize in match (leb_to_Prop x y); +cases (leb x y); simplify; intros (H); +[apply reflect_true | apply reflect_false ] assumption. +qed. + +lemma leb_refl : ∀n.leb n n = true. +intros (n); apply (p2bT ? ? (lebP ? ?)); apply le_n; qed. + +lemma lebW : ∀n,m. leb (S n) m = true → leb n m = true. +intros (n m H); lapply (b2pT ? ? (lebP ? ?) H); clear H; +apply (p2bT ? ? (lebP ? ?)); apply lt_to_le; assumption. +qed. + +definition ltb ≝ λx,y.leb (S x) y. + +lemma ltbP: ∀x,y. reflect (x < y) (ltb x y). +intros (x y); apply (lebP (S x) y); +qed. + +lemma ltb_refl : ∀n.ltb n n = false. +intros (n); apply (p2bF ? ? (ltbP ? ?)); autobatch; +qed. + +(* ### = between booleans as <-> in Prop ### *) +lemma eq_to_bool : + ∀a,b:bool. a = b → (a = true → b = true) ∧ (b = true → a = true). +intros (a b Eab); split; rewrite > Eab; intros; assumption; +qed. + +lemma bool_to_eq : + ∀a,b:bool. (a = true → b = true) ∧ (b = true → a = true) → a = b. +intros (a b Eab); decompose; +generalize in match H; generalize in match H1; clear H; clear H1; +cases a; cases b; intros (H1 H2); +[2: rewrite > (H2 ?) | 3: rewrite > (H1 ?)] reflexivity; +qed. + + +lemma leb_eqb : ∀n,m. orb (eqb n m) (leb (S n) m) = leb n m. +intros (n m); apply bool_to_eq; split; intros (H); +[1:cases (b2pT ? ? (orbP ? ?) H); [2: autobatch] + rewrite > (eqb_true_to_eq ? ? H1); autobatch +|2:cases (b2pT ? ? (lebP ? ?) H); + [ elim n; [reflexivity|assumption] + | simplify; rewrite > (p2bT ? ? (lebP ? ?) H1); rewrite > orbC ] + reflexivity] +qed. + + +(* OUT OF PLACE *) +lemma ltW : ∀n,m. n < m → n < (S m). +intros; unfold lt; unfold lt in H; autobatch. qed. + +lemma ltbW : ∀n,m. ltb n m = true → ltb n (S m) = true. +intros (n m H); letin H1 ≝ (b2pT ? ? (ltbP ? ?) H); clearbody H1; +apply (p2bT ? ? (ltbP ? ?) (ltW ? ? H1)); +qed. + +lemma ltS : ∀n,m.n < m → S n < S m. +intros (n m H); apply (b2pT ? ? (ltbP ? ?)); simplify; apply (p2bT ? ? (ltbP ? ?) H); +qed. + +lemma ltS' : ∀n,m.S n < S m → n < m. +intros (n m H); apply (b2pT ? ? (ltbP ? ?)); simplify; apply (p2bT ? ? (ltbP ? ?) H); +qed. + +lemma ltb_n_Sm : ∀m.∀n:nat. (orb (ltb n m) (eqb n m)) = ltb n (S m). +intros (m n); apply bool_to_eq; split; +[1: intros; cases (b2pT ? ? (orbP ? ?) H); [1: apply ltbW; assumption] + rewrite > (eqb_true_to_eq ? ? H1); simplify; + rewrite > leb_refl; reflexivity +|2: generalize in match m; clear m; elim n 0; + [1: simplify; intros; cases n1; reflexivity; + |2: intros 1 (m); elim m 0; + [1: intros; apply (p2bT ? ? (orbP ? ?)); + lapply (H (pred n1) ?); [1: reflexivity] clear H; + generalize in match H1; + generalize in match Hletin; + cases n1; [1: simplify; intros; destruct H2] + intros; unfold pred in H; simplify in H; + cases (b2pT ? ? (orbP ? ?) H); [left|right] assumption; + |2: clear m; intros (m IH1 IH2 w); + lapply (IH1 ? (pred w)); + [3: generalize in match H; cases w; [2: intros; assumption] + simplify; intros; destruct H1; + |1: intros; apply (IH2 (S n1)); assumption; + |2: generalize in match H; generalize in match Hletin; + cases w; [1: simplify; intros; destruct H2] + intros (H H1); cases (b2pT ? ? (orbP ? ?) H); + apply (p2bT ? ? (orbP ? ?));[left|right] assumption]]]] +qed. + +(* non mi e' chiaro a cosa serva ... *) +lemma congr_S : ∀n,m.n = m → S n = S m. +intros 1; cases n; intros; rewrite > H; reflexivity. +qed. diff --git a/matita/library/decidable_kit/eqtype.ma b/matita/library/decidable_kit/eqtype.ma new file mode 100644 index 000000000..27037b2fc --- /dev/null +++ b/matita/library/decidable_kit/eqtype.ma @@ -0,0 +1,156 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "decidable_kit/decidable.ma". +include "datatypes/constructors.ma". + +(* ### types with a decidable AND rewrite (leibniz) compatible ### *) + +definition eq_compatible ≝ λT:Type.λa,b:T. reflect (a = b). + +record eqType : Type ≝ { + sort :> Type; + cmp : sort → sort → bool ; + eqP : ∀x,y:sort. eq_compatible sort x y (cmp x y) +}. + +lemma cmp_refl : ∀d:eqType.∀x. cmp d x x = true. +intros (d x); generalize in match (eqP d x x); intros (H); +unfold in H; (* inversion non fa whd!!! *) +inversion H; [ intros; reflexivity | intros (ABS); cases (ABS (refl_eq ? ?)) ] +qed. + +(* to use streicher *) +lemma eqType_decidable : ∀d:eqType. decT d. +intros (d); unfold decT; intros (x y); unfold decidable; +generalize in match (eqP d x y); intros (H); +cases H; [left | right] assumption; +qed. + +lemma eqbP : ∀x,y:nat. eq_compatible nat x y (eqb x y). +intros (x y); +generalize in match (refl_eq ? (eqb x y)); +generalize in match (eqb x y) in ⊢ (? ? ? % → %); intros 1 (b); +cases b; intros (H); [ apply reflect_true | apply reflect_false ]; +[ apply (eqb_true_to_eq ? ? H) | apply (eqb_false_to_not_eq ? ? H) ] +qed. + +definition nat_eqType : eqType ≝ mk_eqType ? ? eqbP. +(* XXX le coercion nel cast non vengono inserite *) +definition nat_canonical_eqType : nat → nat_eqType := + λn : nat.(n : sort nat_eqType). +coercion cic:/matita/decidable_kit/eqtype/nat_canonical_eqType.con. + +definition bcmp ≝ λx,y:bool. match x with [ true ⇒ y | false => notb y ]. + +lemma bcmpP : ∀x,y:bool. eq_compatible bool x y (bcmp x y). +intros (x y); +generalize in match (refl_eq ? (bcmp x y)); +generalize in match (bcmp x y) in ⊢ (? ? ? % → %); intros 1 (b); +cases b; intros (H); [ apply reflect_true | apply reflect_false ]; +generalize in match H; clear H; +cases x; cases y; simplify; intros (H); [1,4: reflexivity]; +(* non va: try destruct H; *) +[1,2,3,6: destruct H | *: unfold Not; intros (H1); destruct H1] +qed. + +definition bool_eqType : eqType ≝ mk_eqType ? ? bcmpP. +definition bool_canonical_eqType : bool → bool_eqType := + λb : bool.(b : sort bool_eqType). +coercion cic:/matita/decidable_kit/eqtype/bool_canonical_eqType.con. + +(* ### subtype of an eqType ### *) + +record sigma (d : eqType) (p : d -> bool) : Type ≝ { + sval : d; + sprop : p sval = true +}. + +notation "{x, h}" + right associative with precedence 80 +for @{'sig $x $h}. + +interpretation "sub_eqType" 'sig x h = + (cic:/matita/decidable_kit/eqtype/sigma.ind#xpointer(1/1/1) _ _ x h). + +(* restricting an eqType gives an eqType *) +lemma sigma_eq_dec : ∀d:eqType.∀p.∀x,y:sigma d p. + eq_compatible ? x y (cmp ? (sval ? ? x) (sval ? ?y)). +intros (d p x y); +cases (eqP d (sval ? ? x) (sval ? ? y)); generalize in match H; clear H; +cases x (s ps); cases y (t pt); simplify; intros (Est); +[1: constructor 1; generalize in match ps; rewrite > Est; intros (pt'); + rewrite < (pirrel ? ? ? pt pt' (eqType_decidable bool_eqType)); reflexivity; +|2: constructor 2; unfold Not; intros (H); destruct H; + cases (Est); reflexivity] +qed. + +definition sub_eqType ≝ λd : eqType.λp. mk_eqType ? ? (sigma_eq_dec d p). + +inductive in_sub (d : eqType) (p : d → bool) (x : d) : option (sigma d p) → Type ≝ +| in_sig : ∀s : sigma d p. sval ? ? s = x → in_sub d p x (Some ? s) +| out_sig : p x = false → in_sub d p x (None ?). + +definition if_p ≝ λd:eqType.λp:d→bool.λx:d. + match (eqP bool_eqType (p x) true) with + [ (reflect_true H) ⇒ Some ? {?,H} + | (reflect_false _) ⇒ None ?]. + +lemma in_sub_eq : ∀d,p,x. in_sub d p x (if_p d p x). +intros (d p x); unfold if_p; +cases (eqP bool_eqType (p x) true); simplify; +[ apply in_sig; reflexivity; | apply out_sig; apply (p2bF ? ? (idP ?) H)] +qed. + +definition ocmp : ∀d:eqType.∀a,b:option d.bool ≝ + λd:eqType.λa,b:option d. + match a with + [ None ⇒ match b with [ None ⇒ true | (Some _) ⇒ false] + | (Some x) ⇒ match b with [ None ⇒ false | (Some y) ⇒ cmp d x y]]. + +lemma ocmpP : ∀d:eqType.∀a,b:option d.eq_compatible ? a b (ocmp d a b). +intros (d a b); +generalize in match (refl_eq ? (ocmp ? a b)); +generalize in match (ocmp ? a b) in ⊢ (? ? ? % → %); intros 1 (c); +cases c; intros (H); [ apply reflect_true | apply reflect_false ]; +generalize in match H; clear H; +cases a; cases b; simplify; intros (H); +[1: reflexivity; +|2,3,5: destruct H; +|4: rewrite > (b2pT ? ? (eqP d ? ?) H); reflexivity; +|6,7: unfold Not; intros (H1); destruct H1 +|8: unfold Not; intros (H1); destruct H1;rewrite > cmp_refl in H; destruct H;] +qed. + +definition option_eqType : eqType → eqType ≝ λd:eqType.mk_eqType ? ? (ocmpP d). +definition option_canonical_eqType : ∀d:eqType.d → option_eqType d ≝ + λd:eqType.λx:d.(Some ? x : sort (option_eqType d)). +coercion cic:/matita/decidable_kit/eqtype/option_canonical_eqType.con. + +(* belle le coercions! *) +definition test_canonical_option_eqType ≝ + (eq (option_eqType nat_eqType) O (S O)). + +lemma cmpP : ∀d:eqType.∀x,y:d.∀P:bool → Prop. + (x=y → P true) → (cmp d x y = false → P false) → P (cmp d x y). +intros; cases (eqP ? x y); [2:apply H1; apply (p2bF ? ? (eqP d ? ?))] autobatch; +qed. + +lemma cmpC : ∀d:eqType.∀x,y:d. cmp d x y = cmp d y x. +intros; apply (cmpP ? x y); apply (cmpP ? y x); [1,4: intros; reflexivity] +[intros (H2 H1) | intros (H1 H2)] rewrite > H1 in H2; rewrite > cmp_refl in H2; +destruct H2. +qed. diff --git a/matita/library/decidable_kit/fgraph.ma b/matita/library/decidable_kit/fgraph.ma new file mode 100644 index 000000000..98987dc5e --- /dev/null +++ b/matita/library/decidable_kit/fgraph.ma @@ -0,0 +1,259 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "decidable_kit/fintype.ma". + +definition setA : ∀T:eqType.T → bool := λT,x.true. + +inductive fgraphType (d1 : finType) (d2 : eqType) : Type := + | Fgraph : ∀val:list d2. (length ? val) = (count ? (setA d1) (enum d1)) -> fgraphType d1 d2. + +definition fval : ∀d1: finType. ∀d2 : eqType. fgraphType d1 d2 → list d2 := + λd1,d2,x. match x with [ (Fgraph val _) ⇒ val]. + +definition fproof : ∀d1:finType.∀d2:eqType.∀u. length ? (fval d1 d2 u) = (count ? (setA d1) ?) := + λd1:finType.λd2,u. match u return (λx. length ? (fval d1 d2 x) = (count ? (setA d1) (enum d1))) with [ + (Fgraph _ proof) ⇒ proof]. + +lemma fgraph_eqP : ∀d1:finType.∀d2:eqType.∀f1,f2:fgraphType d1 d2. + eq_compatible ? f1 f2 (cmp (list_eqType d2) (fval d1 d2 f1) (fval d1 d2 f2)). +intros (d1 d2 f1 f2); cases f1; cases f2; simplify; clear f1 f2; +apply prove_reflect; intros; + [1: generalize in match H; rewrite > (b2pT ? ? (eqP (list_eqType d2) ? ?) H2); + intros; clear H H2; rewrite < (pirrel ? ? ? H1 H3 (eqType_decidable nat_eqType)); + reflexivity + |2: unfold Not; intros (H3); destruct H3; + rewrite > (cmp_refl (list_eqType d2)) in H2; destruct H2;] +qed. + +definition fgraph_eqType : finType → eqType → eqType ≝ + λd1,d2. mk_eqType ? ? (fgraph_eqP d1 d2). + +lemma fval_eqE : + ∀d1:finType.∀d2:eqType.∀u,v:fgraph_eqType d1 d2. cmp (list_eqType d2) (fval ? ? u) (fval ? ? v) = cmp ? u v. +intros; reflexivity; qed. + +(* +lemma fval_inj : injective fval. +Proof. by move => u v; move/eqP; move/fgraph_eqP. Qed. +*) + + (* if the domain is not empty the default is the first elem of the graph *) +lemma fgraph_default : ∀d1:finType.∀d2:eqType. d1 -> fgraph_eqType d1 d2 -> d2. +intros 4 (d1 d2 x f); cases f; fold unfold sort (sort d2); +generalize in match H; clear H; cases val; clear val; + [2: intros; assumption + |1: simplify; generalize in match (enum_uniq d1); cases (enum d1); + unfold setA; simplify; intros (H H1); [1: destruct (H x) | destruct H1]] +qed. + +definition infgraph : ∀d1,d2:finType.∀s : list_eqType d2. option (fgraph_eqType d1 d2) := + λd1,d2:finType.λs:list d2. + match eqbP (length ? s) (count ? (setA d1) (enum d1)) + with + [ (reflect_true p) ⇒ Some ? (Fgraph ? ? ? p) + | (reflect_false p) ⇒ None ?]. + +inductive infgraph_spec (d1, d2 : finType) (s : list_eqType d2) : option (fgraph_eqType d1 d2) -> Type := + | Some_tup : ∀u : fgraphType d1 d2. length ? s = (count ? (setA d1) (enum d1)) -> fval ? ? u = s -> infgraph_spec ? ? s (Some ? u) + | None_tup: notb (eqb (length ? s) (count ? (setA d1) (enum d1))) = true -> infgraph_spec ? ? s (None ?). + +lemma infgraphP : ∀d1,d2:finType.∀s:list_eqType d2. infgraph_spec d1 d2 s (infgraph ? ? s). +unfold infgraph; intros; cases (eqbP (length d2 s) (count d1 (setA d1) (enum d1))); +simplify; + [1: apply (Some_tup d1 d2 s ? H); reflexivity; + |2: apply None_tup; rewrite > (p2bF ? ? (eqbP ? ?) H). reflexivity] +qed. + +definition infgraphseq : + ∀d1,d2:finType.list_eqType (list_eqType d2) -> list_eqType (fgraph_eqType d1 d2) := + λd1,d2:finType. + (foldr ? ? + (λs: list d2.λts:list (fgraphType d1 d2). + match infgraph d1 d2 s with + [ None ⇒ ts + | (Some u) ⇒ u::ts]) (nil ?)). + +lemma count_setA : ∀d:eqType.∀l. count ? (setA d) l = length ? l. +intros; elim l; [reflexivity] simplify; rewrite > H; clear H; reflexivity; qed. + +lemma mem_infgraphseq : + ∀d1,d2:finType.∀a:list_eqType (list_eqType d2).∀x:fgraph_eqType d1 d2. + mem ? x (infgraphseq d1 d2 a) = mem (list_eqType d2) (fval d1 d2 x) a. +intros 3 (d1 d2 l); elim l (x hd tl IH x); [1: reflexivity] +simplify; cases (infgraphP d1 d2 hd); simplify; +rewrite > IH; clear IH; [1: rewrite < H1; reflexivity;] +lapply (b2pT ? ? (negbP ?) H) as H1; clear H; +lapply (b2pF ? ? (eqbP ? ?) H1) as H2; clear H1; +cases (mem (list_eqType d2) (fval d1 d2 x) tl); rewrite > orbC; simplify; [reflexivity] +symmetry; apply (p2bF ? ? (eqP ? ? ?)); unfold Not; intros (Exhd); +apply H2; rewrite < Exhd; clear Exhd H2 tl hd l; +generalize in match x; clear x; cases d1 0; simplify; intros; cases s; +simplify; clear s; rewrite > H1; simplify; reflexivity; +qed. + +lemma uniq_infgraphseq : ∀d1,d2,s. uniq ? s = true -> uniq ? (infgraphseq d1 d2 s) = true. +intros 3 (d1 d2 l); elim l (H hd tl IH H); [reflexivity] simplify; +rewrite > (uniq_tail) in H; lapply (b2pT ? ? (andbP ? ?) H); clear H; decompose; +cases (infgraphP d1 d2 hd); simplify; + [1: rewrite > IH; [2:assumption] rewrite > andbC; simplify; + rewrite < H3 in H; rewrite > mem_infgraphseq; assumption + |2: apply IH; assumption] +qed. + +definition multes : + ∀d:finType.∀e:d.list_eqType (list_eqType d) -> list_eqType (list_eqType d) + := + λd:finType.λe:d.λl:list (list d). map ? ? (λl. e :: l) l. + +definition multss : + ∀d:finType.∀e:list_eqType d.list_eqType (list_eqType d) -> list_eqType (list_eqType d) +:= + λd:finType.λe:list d.λl:list (list d). + foldr ? ? (λx,acc. (multes ? x l) @ acc) [] e. + +(* +Eval compute in multss (Seq x1 x2) (Seq (Seq x3 x4) (Seq x5 x6)). +-> Seq (Seq x1 x3 x4) (Seq x1 x5 x6) (Seq x2 x3 x4) (Seq x2 x5 x6) +*) + +definition iter := + λB:eqType.λn:nat.λf:nat→B→B.λacc:B.foldr ? B f acc (iota O n). + +(* the sequence of all the strings of length m on the d alphabet *) +definition mkpermr := + λd:finType.λm:nat. iter ? m (λx,acc.multss d (enum d) acc) [[]]. + +lemma mem_multes : + ∀d:finType.∀e:d.∀l:list_eqType (list_eqType d).∀s:list_eqType d. + mem ? s (multes ? e l) = + match s in list with [ nil ⇒ false | (cons e1 tl) ⇒ andb (cmp ? e e1) (mem ? tl l)]. +intros (d e l s); elim l (hd tl IH); [cases s;simplify;[2: rewrite > andbC] reflexivity] +simplify; rewrite > IH; cases s; simplify; [reflexivity] +unfold list_eqType; simplify; +apply (cmpP ? e s1); cases (lcmp d l1 hd); intros (E); +[1,2: rewrite > E; simplify; rewrite > cmp_refl; reflexivity +|3,4: rewrite > cmpC; rewrite > E; simplify; reflexivity;] +qed. + +lemma mem_concat: + ∀d:eqType. ∀x.∀l1,l2:list d. + mem d x (l1 @ l2) = orb (mem d x l1) (mem d x l2). +intros; elim l1; [reflexivity] simplify; cases (cmp d x t); simplify; [reflexivity|assumption] +qed. + +lemma orb_refl : ∀x.orb x x = x. intros (x); cases x; reflexivity; qed. + +lemma mem_multss : + ∀d:finType.∀s:list_eqType d.∀l:list_eqType (list_eqType d).∀x:list_eqType d. + mem ? x (multss ? s l) = + match x in list with [ nil ⇒ false | (cons he tl) ⇒ andb (mem ? he s) (mem ? tl l)]. +intros (d s l x); elim s; [cases x] simplify; try reflexivity; rewrite > mem_concat; +rewrite > H; clear H; rewrite > mem_multes; cases x; simplify; [reflexivity] +unfold list_eqType; simplify; apply (cmpP ? t s1); intros (E); +cases (mem d s1 l1); +[1,2: rewrite > E; rewrite > cmp_refl; simplify; + [rewrite > orb_refl | rewrite > orbC ] reflexivity +|3,4: simplify; rewrite > orbC; simplify; [reflexivity] symmetry; + apply (p2bF ? ? (andbP ? ?)); unfold Not; intros (H); decompose; + rewrite > cmpC in H1; rewrite > E in H1; destruct H1;] +qed. + +lemma mem_mkpermr_size : + ∀d:finType.∀m,x. mem (list_eqType d) x (mkpermr d m) = (eqb (length ? x) m). +intros 2 (d m); elim m 0; simplify; [intros (x); cases x; reflexivity] +intros (n IH x); elim x; rewrite > mem_multss; simplify; [reflexivity] +rewrite > mem_finType; simplify; rewrite > IH; reflexivity; +qed. +(* +axiom uniq_concat : ∀d:eqType.∀l1,l2. uniq d (l1@l1) = (andb (uniq ? l1) (andb (uniq ? l2) ())). + +lemma uniq_mkpermr : ∀d:finType.∀m. uniq ? (mkpermr d m) = true. +intros; elim m; [reflexivity] simplify; fold simplify (mkpermr d n); +generalize in match (enum_uniq d); elim (enum d); [reflexivity]; +simplify; rewrite + +unfold multss; +lapply (b2pT ? ? (uniqP (list_eqType d) (mkpermr d n)) H) as H1; clear H; + +Proof. +elim=> //= i IHi; elim: enum (uniq_enum d) => //= x e IHe. +move/andP=> [Hx He]; rewrite uniq_cat {}IHe {He}// andbT. +rewrite {1}/multes uniq_maps ?{}IHi; last move=> _ _ [] //. +apply/hasP; case=> s Hs. +by move/mapsP => [s' _ Ds]; rewrite mem_multss -Ds (negbET Hx) in Hs. +Qed. + + +definition finfgraph_enum := + λd1,d2:finType.infgraphseq (mkpermr d2 (count ? (setA d1) (enum d1))). + +Lemma maps_tval_fintuple_enum: + maps (@fval d1 d2) finfgraph_enum = mkpermr d2 (card (setA d1)). +Proof. +rewrite /finfgraph_enum. +have: all (fun s => size s == (card (setA d1))) (mkpermr d2 (card (setA d1))). + by apply/allP => s; rewrite mem_mkpermr_size. +elim: (mkpermr d2 (card (setA d1))) => //= s s2 IHs; move/andP => [Hs Hs2]. +by case: infgraphP => [_ _ /= ->|]; [rewrite (IHs Hs2)|rewrite Hs]. +Qed. + + (* good enumeration *) +Lemma finfgraph_enumP : forall u, count (set1 u) finfgraph_enum = 1. +Proof. +move => [s ps]. +rewrite /finfgraph_enum count_set1_uniq; last exact (uniq_infgraphseq (uniq_mkpermr d2 (card (setA d1)))). +by rewrite mem_infgraphseq /= mem_mkpermr_size ps set11. +Qed. + +Canonical Structure fgraph_finType := FinType finfgraph_enumP. + +End FinGraph. + +Definition fgraph_of_fun := + locked (fun (d1 :finType) (d2 :eqType) (f : d1 -> d2) => Fgraph (size_maps f _)). + +Definition fun_of_fgraph := + locked + (fun d1 (d2:eqType) g x => + sub (@fgraph_default d1 d2 x g) (fval g) (index x (enum d1))). + +Coercion fun_of_fgraph : fgraphType >-> Funclass. +Lemma fgraphP : forall (d1 : finType) (d2 :eqType) (f g : fgraphType d1 d2), f =1 g <-> f = g. +Proof. +move=> d1 d2 f g; split; last by move=>->. +move=> Efg; rewrite -(can_fun_of_fgraph f) -(can_fun_of_fgraph g). +by apply: fval_inj; unlock fgraph_of_fun => /=; apply: eq_maps. +Qed. + +CoInductive setType : Type := Sett : fgraphType G bool_finType -> setType. + +Definition sval (s : setType) := match s with Sett g => g end. + +Lemma can_sval : cancel sval Sett. +Proof. by rewrite /cancel; case => /=. Qed. + +Lemma sval_inj : injective sval. +Proof. exact: can_inj can_sval. Qed. + +Canonical Structure set_eqType := EqType (can_eq can_sval). + +Canonical Structure set_finType := FinType (can_uniq can_sval). + +Definition iset_of_fun (f : G -> bool_finType) : setType := + locked Sett (fgraph_of_fun f). + +*) diff --git a/matita/library/decidable_kit/fintype.ma b/matita/library/decidable_kit/fintype.ma new file mode 100644 index 000000000..b16faa9d6 --- /dev/null +++ b/matita/library/decidable_kit/fintype.ma @@ -0,0 +1,230 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "decidable_kit/eqtype.ma". +include "decidable_kit/list_aux.ma". + +record finType : Type ≝ { + fsort :> eqType; + enum : list fsort; + enum_uniq : ∀x:fsort. count fsort (cmp fsort x) enum = (S O) +}. + +definition segment : nat → eqType ≝ + λn.sub_eqType nat_eqType (λx:nat_eqType.ltb x n). + +definition is_some : ∀d:eqType. option d → bool ≝ + λd:eqType.λo:option d.notb (cmp (option_eqType d) (None ?) o). + +definition filter ≝ + λA,B:Type.λp:A→option B.λl:list A. + foldr A ? + (λx,acc. match (p x) with [None ⇒ acc | (Some y) ⇒ cons B y acc]) (nil B) l. + +definition segment_enum ≝ + λbound.filter ? ? (if_p nat_eqType (λx.ltb x bound)) (iota O bound). + +lemma iota_ltb : ∀x,p:nat. mem nat_eqType x (iota O p) = ltb x p. +intros (x p); elim p; simplify;[reflexivity] +apply (cmpP nat_eqType x n); intros (E); rewrite > H; clear H; simplify; +[1: symmetry; apply (p2bT ? ? (lebP ? ?)); rewrite > E; apply le_n; +|2: rewrite < (leb_eqb x n); rewrite > E; reflexivity;] +qed. + +lemma mem_filter : + ∀d1,d2:eqType.∀x:d2.∀l:list d1.∀p:d1 → option d2. + (∀y.mem d1 y l = true → + match (p y) with [None ⇒ false | (Some q) ⇒ cmp d2 x q] = false) → + mem d2 x (filter d1 d2 p l) = false. +intros 5 (d1 d2 x l p); +elim l; simplify; [reflexivity] +generalize in match (refl_eq ? (p t)); +generalize in match (p t) in ⊢ (? ? ? % → %); intros 1 (b); cases b; clear b; intros (Hpt); +[1: apply H; intros (y Hyl); + apply H1; simplify; + rewrite > Hyl; rewrite > orbC; reflexivity; +|2: simplify; apply (cmpP d2 x s); simplify; intros (E); + [1: rewrite < (H1 t); simplify; [rewrite > Hpt; rewrite > E] + simplify; rewrite > cmp_refl; reflexivity + |2: apply H; intros; apply H1; simplify; rewrite > H2; + rewrite > orbC; reflexivity]] +qed. + +lemma count_O : + ∀d:eqType.∀p:d→bool.∀l:list d. + (∀x:d.mem d x l = true → notb (p x) = true) → count d p l = O. +intros 3 (d p l); elim l; simplify; [1: reflexivity] +generalize in match (refl_eq ? (p t)); +generalize in match (p t) in ⊢ (? ? ? % → %); intros 1 (b); +cases b; simplify; +[2:intros (Hpt); apply H; intros; apply H1; simplify; + apply (cmpP d x t); [2: rewrite > H2;]; intros; reflexivity; +|1:intros (H2); lapply (H1 t); [2:simplify; rewrite > cmp_refl; simplify; autobatch] + rewrite > H2 in Hletin; simplify in Hletin; destruct Hletin] +qed. + +lemma segment_finType : nat → finType. +intros (bound); +letin fsort ≝ (segment bound); +letin enum ≝ (segment_enum bound); +cut (∀x:fsort. count fsort (cmp fsort x) enum = (S O)); + [ apply (mk_finType fsort enum Hcut) + | intros (x); cases x (n Hn); simplify in Hn; clear x; + generalize in match Hn; generalize in match Hn; clear Hn; + unfold segment_enum; + generalize in match bound in ⊢ (% → ? → ? ? (? ? ? (? ? ? ? %)) ?); + intros 1 (m); elim m (Hm Hn p IH Hm Hn); [ simplify in Hm; destruct Hm ] + simplify; cases (eqP bool_eqType (ltb p bound) true); simplify; + [1:unfold segment in ⊢ (? ? match ? % ? ? with [_ ⇒ ?|_ ⇒ ?] ?); + unfold nat_eqType in ⊢ (? ? match % with [_ ⇒ ?|_ ⇒ ?] ?); + simplify; apply (cmpP nat_eqType n p); intros (Enp); simplify; + [2:rewrite > IH; [1,3: autobatch] + rewrite < ltb_n_Sm in Hm; rewrite > Enp in Hm; + rewrite > orbC in Hm; assumption; + |1:clear IH; rewrite > (count_O fsort); [reflexivity] + intros 1 (x); rewrite < Enp; cases x (y Hy); + intros (ABS); clear x; unfold segment; unfold notb; simplify; + apply (cmpP ? n y); intros (Eny); simplify; [2:reflexivity] + rewrite < ABS; symmetry; clear ABS; + generalize in match Hy; clear Hy;rewrite < Eny; + simplify; intros (Hn); apply (mem_filter nat_eqType fsort); intros (w Hw); + fold simplify (sort nat_eqType); (* CANONICAL?! *) + cases (in_sub_eq nat_eqType (λx:nat_eqType.ltb x bound) w); + simplify; [2: reflexivity] + generalize in match H1; clear H1; cases s; clear s; intros (H1); + unfold segment; simplify; simplify in H1; rewrite > H1; + rewrite > iota_ltb in Hw; apply (p2bF ? ? (eqP nat_eqType ? ?)); + unfold Not; intros (Enw); rewrite > Enw in Hw; + rewrite > ltb_refl in Hw; destruct Hw] + |2:rewrite > IH; [1:reflexivity|3:assumption] + rewrite < ltb_n_Sm in Hm; + cases (b2pT ? ?(orbP ? ?) Hm);[1: assumption] + rewrite > (b2pT ? ? (eqbP ? ?) H1) in Hn; + rewrite > Hn in H; cases (H ?); reflexivity]] +qed. + +let rec uniq (d:eqType) (l:list d) on l : bool ≝ + match l with + [ nil ⇒ true + | (cons x tl) ⇒ andb (notb (mem d x tl)) (uniq d tl)]. + +lemma uniq_mem : ∀d:eqType.∀x:d.∀l:list d.uniq d (x::l) = true → mem d x l = false. +intros (d x l H); simplify in H; lapply (b2pT ? ? (andbP ? ?) H) as H1; clear H; +cases H1 (H2 H3); lapply (b2pT ? ?(negbP ?) H2); assumption; +qed. + +lemma andbA : ∀a,b,c.andb a (andb b c) = andb (andb a b) c. +intros; cases a; cases b; cases c; reflexivity; qed. + +lemma andbC : ∀a,b. andb a b = andb b a. +intros; cases a; cases b; reflexivity; qed. + +lemma uniq_tail : + ∀d:eqType.∀x:d.∀l:list d. uniq d (x::l) = andb (negb (mem d x l)) (uniq d l). +intros (d x l); elim l; simplify; [reflexivity] +apply (cmpP d x t); intros (E); simplify ; rewrite > E; [reflexivity] +rewrite > andbA; rewrite > andbC in ⊢ (? ? (? % ?) ?); rewrite < andbA; +rewrite < H; rewrite > andbC in ⊢ (? ? ? (? % ?)); rewrite < andbA; reflexivity; +qed. + +lemma count_O_mem : ∀d:eqType.∀x:d.∀l:list d.ltb O (count d (cmp d x) l) = mem d x l. +intros 3 (d x l); elim l [reflexivity] simplify; rewrite < H; cases (cmp d x t); +reflexivity; qed. + +lemma uniqP : ∀d:eqType.∀l:list d. + reflect (∀x:d.mem d x l = true → count d (cmp d x) l = (S O)) (uniq d l). +intros (d l); apply prove_reflect; elim l; [1: simplify in H1; destruct H1 | 3: simplify in H; destruct H] +[1: generalize in match H2; simplify in H2; + lapply (b2pT ? ? (orbP ? ?) H2) as H3; clear H2; + cases H3; clear H3; intros; + [2: lapply (uniq_mem ? ? ? H1) as H4; simplify; apply (cmpP d x t); + intros (H5); simplify; + [1: rewrite > count_O; [reflexivity] + intros (y Hy); rewrite > H5 in H2 H3 H4 ⊢ %; clear H5; clear x; + rewrite > H2 in H4; destruct H4; + |2: simplify; rewrite > H5; simplify; apply H; + rewrite > uniq_tail in H1; cases (b2pT ? ? (andbP ? ?) H1); + assumption;] + |1: simplify; rewrite > H2; simplify; rewrite > count_O; [reflexivity] + intros (y Hy); rewrite > (b2pT ? ? (eqP d ? ?) H2) in H3 ⊢ %; + clear H2; clear x; lapply (uniq_mem ? ? ? H1) as H4; + apply (cmpP d t y); intros (E); [2: reflexivity]. + rewrite > E in H4; rewrite > H4 in Hy; destruct Hy;] +|2: rewrite > uniq_tail in H1; + generalize in match (refl_eq ? (uniq d l1)); + generalize in match (uniq d l1) in ⊢ (? ? ? % → %); intros 1 (b); cases b; clear b; + [1: intros (E); rewrite > E in H1; rewrite > andbC in H1; simplify in H1; + unfold Not; intros (A); lapply (A t) as A'; + [1: simplify in A'; rewrite > cmp_refl in A'; simplify in A'; + destruct A'; rewrite < count_O_mem in H1; + rewrite > Hcut in H1; simplify in H1; destruct H1; + |2: simplify; rewrite > cmp_refl; reflexivity;] + |2: intros (Ul1); lapply (H Ul1); unfold Not; intros (A); apply Hletin; + intros (r Mrl1); lapply (A r); + [2: simplify; rewrite > Mrl1; cases (cmp d r t); reflexivity] + generalize in match Hletin1; simplify; apply (cmpP d r t); + simplify; intros (E Hc); [2: assumption] + destruct Hc; rewrite < count_O_mem in Mrl1; + rewrite > Hcut in Mrl1; simplify in Mrl1; destruct Mrl1;]] +qed. + +lemma mem_finType : ∀d:finType.∀x:d. mem d x (enum d) = true. +intros 1 (d); cases d; simplify; intros; rewrite < count_O_mem; +rewrite > H; reflexivity; +qed. + +lemma uniq_fintype_enum : ∀d:finType. uniq d (enum d) = true. +intros; cases d; simplify; apply (p2bT ? ? (uniqP ? ?)); intros; apply H; +qed. + +lemma sub_enumP : ∀d:finType.∀p:d→bool.∀x:sub_eqType d p. + count (sub_eqType d p) (cmp ? x) (filter ? ? (if_p ? p) (enum d)) = (S O). +intros (d p x); cases x (t Ht); clear x; +generalize in match (mem_finType d t); +generalize in match (uniq_fintype_enum d); +elim (enum d); [simplify in H1; destruct H1] simplify; +cases (in_sub_eq d p t1); simplify; +[1:generalize in match H3; clear H3; cases s (r Hr); clear s; + simplify; intros (Ert1); generalize in match Hr; clear Hr; + rewrite > Ert1; clear Ert1; clear r; intros (Ht1); + unfold sub_eqType in ⊢ (? ? match ? (% ? ?) ? ? with [_ ⇒ ?|_ ⇒ ?] ?); + simplify; apply (cmpP ? t t1); simplify; intros (Ett1); + [1: cut (count (sub_eqType d p) (cmp (sub_eqType d p) {t,Ht}) + (filter d (sigma d p) (if_p d p) l) = O); [1:rewrite > Hcut; reflexivity] + lapply (uniq_mem ? ? ? H1); + generalize in match Ht; + rewrite > Ett1; intros (Ht1'); clear Ht1; + generalize in match Hletin; elim l; [ reflexivity] + simplify; cases (in_sub_eq d p t2); simplify; + [1: generalize in match H5; cases s; simplify; intros; clear H5; + unfold sub_eqType in ⊢ (? ? match ? (% ? ?) ? ? with [_ ⇒ ?|_ ⇒ ?] ?); + simplify; rewrite > H7; simplify in H4; + generalize in match H4; clear H4; apply (cmpP ? t1 t2); + simplify; intros; [destruct H5] apply H3; assumption; + |2: apply H3; + generalize in match H4; clear H4; simplify; apply (cmpP ? t1 t2); + simplify; intros; [destruct H6] assumption;] + |2: apply H; [ rewrite > uniq_tail in H1; cases (b2pT ? ? (andbP ? ?) H1); assumption] + simplify in H2; rewrite > Ett1 in H2; simplify in H2; assumption] +|2:rewrite > H; [1:reflexivity|2: rewrite > uniq_tail in H1; cases (b2pT ? ? (andbP ? ?) H1); assumption] + simplify in H2; generalize in match H2; apply (cmpP ? t t1); + intros (E) [2:assumption] clear H; rewrite > E in Ht; rewrite > H3 in Ht; + destruct Ht;] +qed. + +definition sub_finType : ∀d:finType.∀p:d→bool.finType ≝ + λd:finType.λp:d→bool. mk_finType (sub_eqType d p) (filter ? ? (if_p ? p) (enum d)) (sub_enumP d p). + diff --git a/matita/library/decidable_kit/list_aux.ma b/matita/library/decidable_kit/list_aux.ma new file mode 100644 index 000000000..1f73192bd --- /dev/null +++ b/matita/library/decidable_kit/list_aux.ma @@ -0,0 +1,105 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "list/list.ma". +include "decidable_kit/eqtype.ma". +include "nat/plus.ma". + +(* ### some functions on lists (some can be moved to list.ma ### *) + +let rec foldr (A,B:Type) (f : A → B → B) (b : B) (l : list A) on l : B := + match l with [ nil ⇒ b | (cons a l) ⇒ f a (foldr ? ? f b l)]. + +definition length ≝ λT:Type.λl:list T.foldr T nat (λx,c.S c) O l. + +definition count : ∀T : eqType.∀f : T → bool.∀l : list T. nat := + λT:eqType.λf,l. + foldr T nat (λx,acc. match (f x) with [ true ⇒ S acc | false ⇒ acc ]) O l. + +let rec mem (d : eqType) (x : d) (l : list d) on l : bool ≝ + match l with + [ nil ⇒ false + | cons y tl ⇒ orb (cmp d x y) (mem d x tl)]. + +definition iota : nat → nat → list nat ≝ + λn,m. nat_rect (λ_.list ?) (nil ?) (λx,acc.cons ? (n+x) acc) m. + +let rec map (A,B:Type) (f: A → B) (l : list A) on l : list B ≝ + match l with [ nil ⇒ nil ? | cons x tl ⇒ f x :: (map A B f tl)]. + +(* ### induction principle for functions visiting 2 lists in parallel *) +lemma list_ind2 : + ∀T1,T2:Type.∀l1:list T1.∀l2:list T2.∀P:list T1 → list T2 → Prop. + length ? l1 = length ? l2 → + (P (nil ?) (nil ?)) → + (∀tl1,tl2,hd1,hd2. P tl1 tl2 → P (hd1::tl1) (hd2::tl2)) → + P l1 l2. +intros (T1 T2 l1 l2 P Hl Pnil Pcons); +generalize in match Hl; clear Hl; generalize in match l2; clear l2; +elim l1 1 (l2 x1); [ cases l2; intros (Hl); [assumption| simplify in Hl; destruct Hl]] +intros 3 (tl1 IH l2); cases l2; [1: simplify; intros 1 (Hl); destruct Hl] +intros 1 (Hl); apply Pcons; apply IH; simplify in Hl; destruct Hl; assumption; +qed. + +lemma eq_map : ∀A,B,f,g,l. (∀x.f x = g x) → map A B f l = map A B g l. +intros (A B f g l Efg); elim l; simplify; [1: reflexivity ]; +rewrite > (Efg t); rewrite > H; reflexivity; +qed. + +(* ### eqtype for lists ### *) +let rec lcmp (d : eqType) (l1,l2 : list d) on l1 : bool ≝ + match l1 with + [ nil ⇒ match l2 with [ nil ⇒ true | (cons _ _) ⇒ false] + | (cons x1 tl1) ⇒ match l2 with + [ nil ⇒ false | (cons x2 tl2) ⇒ andb (cmp d x1 x2) (lcmp d tl1 tl2)]]. + +lemma lcmp_length : + ∀d:eqType.∀l1,l2:list d. + lcmp ? l1 l2 = true → length ? l1 = length ? l2. +intros 2 (d l1); elim l1 1 (l2 x1); +[1: cases l2; simplify; intros; [reflexivity|destruct H] +|2: intros 3 (tl1 IH l2); cases (l2); intros; [1:simplify in H; destruct H] + simplify; (* XXX la apply non fa simplify? *) + apply congr_S; apply (IH l); + (* XXX qualcosa di enorme e' rotto! la regola di convertibilita?! *) + simplify in H; cases (b2pT ? ? (andbP ? ?) H); assumption] +qed. + +lemma lcmpP : ∀d:eqType.∀l1,l2:list d. eq_compatible (list d) l1 l2 (lcmp d l1 l2). +intros (d l1 l2); +generalize in match (refl_eq ? (lcmp d l1 l2)); +generalize in match (lcmp d l1 l2) in ⊢ (? ? ? % → %); intros 1 (c); +cases c; intros (H); [ apply reflect_true | apply reflect_false ] +[ lapply (lcmp_length ? ? ? H) as Hl; + generalize in match H; clear H; + apply (list_ind2 ? ? ? ? ? Hl); [1: intros; reflexivity] + simplify; intros (tl1 tl2 hd1 hd2 IH H); cases (b2pT ? ? (andbP ? ?) H); + rewrite > (IH H2); rewrite > (b2pT ? ? (eqP d ? ?) H1); reflexivity +| generalize in match H; clear H; generalize in match l2; clear l2; + elim l1 1 (l1 x1); + [ cases l1; simplify; [intros; destruct H | unfold Not; intros; destruct H1;] + | intros 3 (tl1 IH l2); cases l2; + [ unfold Not; intros; destruct H1; + | simplify; intros; + cases (b2pT ? ? (andbPF ? ?) (p2bT ? ? (negbP ?) H)); clear H; + [ intros; lapply (b2pF ? ? (eqP d ? ?) H1) as H'; clear H1; + destruct H; apply H'; reflexivity; + | intros; lapply (IH ? H1) as H'; destruct H; + apply H'; reflexivity;]]]] +qed. + +definition list_eqType : eqType → eqType ≝ λd:eqType.mk_eqType ? ? (lcmpP d). + \ No newline at end of file diff --git a/matita/library/decidable_kit/streicher.ma b/matita/library/decidable_kit/streicher.ma new file mode 100644 index 000000000..ba62c672c --- /dev/null +++ b/matita/library/decidable_kit/streicher.ma @@ -0,0 +1,56 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "logic/connectives.ma". +include "logic/equality.ma". + +definition step ≝ λT:Type.λa,b,c:T.λH1:a=b.λH2:a=c. eq_ind T ? (λx.b = x) H1 ? H2. + +lemma stepH : ∀T:Type.∀a:T.∀H:a=a. step ? ? ? ? H H = refl_eq T a. +intros (T a H); cases H; reflexivity. +qed. + +definition decT ≝ λT:Type.∀x,y:T. decidable (x=y). + +lemma nu : ∀T:Type.∀a,b:T. decT T → ∀E:a=b. a=b. +intros (T a b decT E); cases (decT a b) (Ecanonical Abs); [ exact Ecanonical | cases (Abs E) ] +qed. + +lemma nu_k : ∀T:Type.∀a,b:T.∀E1,E2:a=b. ∀d : decT T. nu ? ? ? d E1 = nu ? ? ? d E2. +intros (T a b E1 E2 decT); unfold nu; +cases (decT a b); simplify; [ reflexivity | cases (H E1) ] +qed. + +definition nu_inv ≝ λT:Type.λa,b:T. λd: decT T.λE:a=b. + step ? ? ? ? (nu ? ? ? d (refl_eq ? a)) E. + +definition cancel ≝ λT:Type.λA,B:Type.λf.λg:A→B.∀x:A.f (g x) = x. + +(* non inferisce Prop?!??! *) +lemma cancel_nu_nu_inv : ∀T:Type.∀a,b:T.∀d: decT T. + cancel Prop (a=b) (a=b) (nu_inv ? a b d) (nu ? a b d). +intros (T a b); unfold cancel; intros (E); cases E; +unfold nu_inv; rewrite > stepH; reflexivity. +qed. + +theorem pirrel : ∀T:Type.∀a,b:T.∀E1,E2:a=b.∀d: decT T. E1 = E2. +intros (T a b E1 E2 decT); +rewrite < (cancel_nu_nu_inv ? ? ? decT); +rewrite < (cancel_nu_nu_inv ? ? ? decT) in ⊢ (? ? ? %); +rewrite > (nu_k ? ? ? E1 E2 decT). +reflexivity. +qed. + diff --git a/matita/library/demo/power_derivative.ma b/matita/library/demo/power_derivative.ma new file mode 100644 index 000000000..64a9a7009 --- /dev/null +++ b/matita/library/demo/power_derivative.ma @@ -0,0 +1,330 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "nat/plus.ma". +include "nat/orders.ma". +include "nat/compare.ma". + +axiom R: Type. +axiom R0: R. +axiom R1: R. +axiom Rplus: R→R→R. +axiom Rmult: R→R→R. + +notation "0" with precedence 89 +for @{ 'zero }. +interpretation "Rzero" 'zero = + (cic:/matita/demo/power_derivative/R0.con). +interpretation "Nzero" 'zero = + (cic:/matita/nat/nat/nat.ind#xpointer(1/1/1)). + +notation "1" with precedence 89 +for @{ 'one }. +interpretation "Rone" 'one = + (cic:/matita/demo/power_derivative/R1.con). +interpretation "None" 'one = + (cic:/matita/nat/nat/nat.ind#xpointer(1/1/2) + cic:/matita/nat/nat/nat.ind#xpointer(1/1/1)). + +interpretation "Rplus" 'plus x y = + (cic:/matita/demo/power_derivative/Rplus.con x y). + +notation "hvbox(a break \middot b)" + left associative with precedence 55 +for @{ 'times $a $b }. + +interpretation "Rmult" 'times x y = + (cic:/matita/demo/power_derivative/Rmult.con x y). + +definition Fplus ≝ + λf,g:R→R.λx:R.f x + g x. + +definition Fmult ≝ + λf,g:R→R.λx:R.f x · g x. + +interpretation "Fplus" 'plus x y = + (cic:/matita/demo/power_derivative/Fplus.con x y). +interpretation "Fmult" 'times x y = + (cic:/matita/demo/power_derivative/Fmult.con x y). + +notation "2" with precedence 89 +for @{ 'two }. +interpretation "Rtwo" 'two = + (cic:/matita/demo/power_derivative/Rplus.con + cic:/matita/demo/power_derivative/R1.con + cic:/matita/demo/power_derivative/R1.con). +interpretation "Ntwo" 'two = + (cic:/matita/nat/nat/nat.ind#xpointer(1/1/2) + (cic:/matita/nat/nat/nat.ind#xpointer(1/1/2) + (cic:/matita/nat/nat/nat.ind#xpointer(1/1/1)))). + +let rec Rpower (x:R) (n:nat) on n ≝ + match n with + [ O ⇒ 1 + | S n ⇒ x · (Rpower x n) + ]. + +interpretation "Rpower" 'exp x n = + (cic:/matita/demo/power_derivative/Rpower.con x n). + +let rec inj (n:nat) on n : R ≝ + match n with + [ O ⇒ 0 + | S n ⇒ + match n with + [ O ⇒ 1 + | S m ⇒ 1 + inj n + ] + ]. + +coercion cic:/matita/demo/power_derivative/inj.con. + +axiom Rplus_Rzero_x: ∀x:R.0+x=x. +axiom Rplus_comm: symmetric ? Rplus. +axiom Rplus_assoc: associative ? Rplus. +axiom Rmult_Rone_x: ∀x:R.1*x=x. +axiom Rmult_Rzero_x: ∀x:R.0*x=0. +axiom Rmult_assoc: associative ? Rmult. +axiom Rmult_comm: symmetric ? Rmult. +axiom Rmult_Rplus_distr: distributive ? Rmult Rplus. + +alias symbol "times" = "Rmult". +alias symbol "plus" = "natural plus". + +definition monomio ≝ + λn.λx:R.x\sup n. + +definition costante : nat → R → R ≝ + λa:nat.λx:R.inj a. + +coercion cic:/matita/demo/power_derivative/costante.con 1. + +axiom f_eq_extensional: + ∀f,g:R→R.(∀x:R.f x = g x) → f=g. + +lemma Fmult_one_f: ∀f:R→R.1·f=f. + intro; + unfold Fmult; + simplify; + apply f_eq_extensional; + intro; + autobatch. +qed. + +lemma Fmult_zero_f: ∀f:R→R.0·f=0. + intro; + unfold Fmult; + simplify; + apply f_eq_extensional; + intro; + autobatch. +qed. + +lemma Fmult_commutative: symmetric ? Fmult. + unfold; + intros; + unfold Fmult; + apply f_eq_extensional; + intros; + autobatch. +qed. + +lemma Fmult_associative: associative ? Fmult. + unfold; + intros; + unfold Fmult; + unfold Fmult; + apply f_eq_extensional; + intros; + autobatch. +qed. + +lemma Fmult_Fplus_distr: distributive ? Fmult Fplus. + unfold; + intros; + unfold Fmult; + unfold Fplus; + apply f_eq_extensional; + intros; + simplify; + autobatch. +qed. + +lemma monomio_product: + ∀n,m.monomio (n+m) = monomio n · monomio m. + intros; + unfold monomio; + unfold Fmult; + simplify; + elim n; + [ simplify; + apply f_eq_extensional; + intro; + autobatch + | simplify; + apply f_eq_extensional; + intro; + cut (x\sup (n1+m) = x \sup n1 · x \sup m); + [ rewrite > Hcut; + autobatch + | change in ⊢ (? ? % ?) with ((λx:R.x\sup(n1+m)) x); + rewrite > H; + reflexivity + ] + ]. +qed. + +lemma costante_sum: + ∀n,m.costante n + costante m = costante (n+m). + intros; + unfold Fplus; + unfold costante; + apply f_eq_extensional; + intros; + elim n; + [ simplify; + autobatch + | simplify; + clear x; + clear H; + clear n; + elim n1; + [ simplify; + elim m; + [ simplify; + autobatch + | simplify; + rewrite < H; + autobatch + ] + | simplify; + rewrite < H; + clear H; + elim n; + [ simplify; + autobatch + | simplify; + autobatch + ] + ] + ]. +qed. + +axiom derivative: (R→R) → R → R. + +notation "hvbox('D'[f])" + non associative with precedence 90 +for @{ 'derivative $f }. + +interpretation "Rderivative" 'derivative f = + (cic:/matita/demo/power_derivative/derivative.con f). + +notation "hvbox('x' \sup n)" + non associative with precedence 60 +for @{ 'monomio $n }. + +notation "hvbox('x')" + non associative with precedence 60 +for @{ 'monomio 1 }. + +interpretation "Rmonomio" 'monomio n = + (cic:/matita/demo/power_derivative/monomio.con n). + +axiom derivative_x0: D[x \sup 0] = 0. +axiom derivative_x1: D[x] = 1. +axiom derivative_mult: ∀f,g:R→R. D[f·g] = D[f]·g + f·D[g]. + +alias symbol "times" = "Fmult". + +theorem derivative_power: ∀n:nat. D[x \sup n] = n·x \sup (pred n). + assume n:nat. + (*we proceed by induction on n to prove + (D[x \sup n] = n · x \sup (pred n)).*) + elim n 0. + case O. + the thesis becomes (D[x \sup 0] = 0·x \sup (pred 0)). + by _ + done. + case S (m:nat). + by induction hypothesis we know + (D[x \sup m] = m·x \sup (pred m)) (H). + the thesis becomes + (D[x \sup (1+m)] = (1+m) · x \sup m). + we need to prove + (m · (x \sup (1+ pred m)) = m · x \sup m) (Ppred). + by _ we proved (0 < m ∨ 0=m) (cases). + we proceed by induction on cases + to prove (m · (x \sup (1+ pred m)) = m · x \sup m). + case left. + suppose (0 < m) (m_pos). + by (S_pred m m_pos) we proved (m = 1 + pred m) (H1). + by _ + done. + case right. + suppose (0=m) (m_zero). by _ done. + conclude + (D[x \sup (1+m)]) + = (D[x · x \sup m]) by _. + = (D[x] · x \sup m + x · D[x \sup m]) by _. + = (x \sup m + x · (m · x \sup (pred m))) by _. +clear H. + = (x \sup m + m · (x \sup (1 + pred m))) by _. + = (x \sup m + m · x \sup m) by _. + = ((1+m) · x \sup m) by _ (timeout=30) + done. +qed. + +(* +notation "hvbox(\frac 'd' ('d' ident i) break p)" + right associative with precedence 90 +for @{ 'derivative ${default + @{\lambda ${ident i} : $ty. $p)} + @{\lambda ${ident i} . $p}}}. + +interpretation "Rderivative" 'derivative \eta.f = + (cic:/matita/demo/power_derivative/derivative.con f). +*) + +notation "hvbox(\frac 'd' ('d' 'x') break p)" + right associative with precedence 90 +for @{ 'derivative $p}. + +interpretation "Rderivative" 'derivative f = + (cic:/matita/demo/power_derivative/derivative.con f). + +theorem derivative_power': ∀n:nat. D[x \sup (1+n)] = (1+n) · x \sup n. + assume n:nat. + (*we proceed by induction on n to prove + (D[x \sup (1+n)] = (1+n) · x \sup n).*) elim n 0. + case O. + the thesis becomes (D[x \sup 1] = 1 · x \sup 0). + by _ + done. + case S (m:nat). + by induction hypothesis we know + (D[x \sup (1+m)] = (1+m) · x \sup m) (H). + the thesis becomes + (D[x \sup (2+m)] = (2+m) · x \sup (1+m)). + conclude + (D[x \sup (2+m)]) + = (D[x · x \sup (1+m)]) by _. + = (D[x] · x \sup (1+m) + x · D[x \sup (1+m)]) by _. + = (x \sup (1+m) + x · (costante (1+m) · x \sup m)) by _. +clear H. + = (x \sup (1+m) + costante (1+m) · x \sup (1+m)) by _. + = (x \sup (1+m) · (costante (2 + m))) by _ + done. +qed. \ No newline at end of file diff --git a/matita/library/demo/propositional_sequent_calculus.ma b/matita/library/demo/propositional_sequent_calculus.ma new file mode 100644 index 000000000..ede2604fa --- /dev/null +++ b/matita/library/demo/propositional_sequent_calculus.ma @@ -0,0 +1,917 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "nat/plus.ma". +include "nat/compare.ma". +include "list/sort.ma". +include "datatypes/constructors.ma". + +inductive Formula : Type ≝ + FTrue: Formula + | FFalse: Formula + | FAtom: nat → Formula + | FAnd: Formula → Formula → Formula + | FOr: Formula → Formula → Formula + | FNot: Formula → Formula. + +definition interp ≝ nat → bool. + +let rec eval (interp:interp) F on F : bool ≝ + match F with + [ FTrue ⇒ true + | FFalse ⇒ false + | FAtom n ⇒ interp n + | FAnd f1 f2 ⇒ eval interp f1 ∧ eval interp f2 + | FOr f1 f2 ⇒ eval interp f1 ∨ eval interp f2 + | FNot f ⇒ ¬ eval interp f + ]. + +inductive not_nf : Formula → Prop ≝ + NTrue: not_nf FTrue + | NFalse: not_nf FFalse + | NAtom: ∀n. not_nf (FAtom n) + | NAnd: ∀f1,f2. not_nf f1 → not_nf f2 → not_nf (FAnd f1 f2) + | NOr: ∀f1,f2. not_nf f1 → not_nf f2 → not_nf (FOr f1 f2) + | NNot: ∀n.not_nf (FNot (FAtom n)). + +let rec negate F ≝ + match F with + [ FTrue ⇒ FFalse + | FFalse ⇒ FTrue + | FAtom n ⇒ FNot (FAtom n) + | FAnd f1 f2 ⇒ FOr (negate f1) (negate f2) + | FOr f1 f2 ⇒ FAnd (negate f1) (negate f2) + | FNot f ⇒ elim_not f] +and elim_not F ≝ + match F with + [ FTrue ⇒ FTrue + | FFalse ⇒ FFalse + | FAtom n ⇒ FAtom n + | FAnd f1 f2 ⇒ FAnd (elim_not f1) (elim_not f2) + | FOr f1 f2 ⇒ FOr (elim_not f1) (elim_not f2) + | FNot f ⇒ negate f + ]. + +theorem not_nf_elim_not: ∀F.not_nf (elim_not F) ∧ not_nf (negate F). + intros; + elim F; + [1,2,3: simplify; autobatch + |4,5: + simplify; + elim H; clear H; + elim H1; clear H1; + split; + autobatch + |elim H; clear H; + split; + [ assumption + | assumption + ] + ] +qed. + +theorem demorgan1: ∀b1,b2:bool. (¬ (b1 ∧ b2)) = ¬ b1 ∨ ¬ b2. + intros; + elim b1; + simplify; + reflexivity. +qed. + +theorem demorgan2: ∀b1,b2:bool. (¬ (b1 ∨ b2)) = ¬ b1 ∧ ¬ b2. + intros; + elim b1; + simplify; + reflexivity. +qed. + +theorem eq_notb_notb_b_b: ∀b:bool. (¬ ¬ b) = b. + intro; + elim b; + reflexivity. +qed. + +theorem eq_eval_elim_not_eval: + ∀i,F. eval i (elim_not F) = eval i F ∧ eval i (negate F) = eval i (FNot F). + intros; + elim F; + [1,2,3: split; reflexivity + |4,5: + simplify; + elim H; clear H; + elim H1; clear H1; + split; + [1,3: autobatch + |replace with ((eval i (FNot f) ∨ eval i (FNot f1)) = ¬ (eval i f ∧ eval i f1)); + [ simplify; + autobatch + | autobatch + ] + |replace with ((eval i (FNot f) ∧ eval i (FNot f1)) = ¬ (eval i f ∨ eval i f1)); + [ simplify; + autobatch + | autobatch + ] + ] + |elim H; clear H; + split; + [ assumption + | change with (eval i (elim_not f) = ¬ ¬ eval i f); + autobatch + ] + ] +qed. + +definition sequent ≝ (list Formula) × (list Formula). + +inductive derive: sequent → Prop ≝ + ExchangeL: ∀l,l1,l2,f. derive 〈f::l1@l2,l〉 → derive 〈l1 @ [f] @ l2,l〉 + | ExchangeR: ∀l,l1,l2,f. derive 〈l,f::l1@l2〉 → derive 〈l,l1 @ [f] @ l2〉 + | Axiom: ∀l1,l2,f. derive 〈f::l1, f::l2〉 + | TrueR: ∀l1,l2. derive 〈l1,FTrue::l2〉 + | FalseL: ∀l1,l2. derive 〈FFalse::l1,l2〉 + | AndR: ∀l1,l2,f1,f2. + derive 〈l1,f1::l2〉 → derive 〈l1,f2::l2〉 → + derive 〈l1,FAnd f1 f2::l2〉 + | AndL: ∀l1,l2,f1,f2. + derive 〈f1 :: f2 :: l1,l2〉 → derive 〈FAnd f1 f2 :: l1,l2〉 + | OrL: ∀l1,l2,f1,f2. + derive 〈f1::l1,l2〉 → derive 〈f2::l1,l2〉 → + derive 〈FOr f1 f2 :: l1,l2〉 + | OrR: ∀l1,l2,f1,f2. + derive 〈l1,f1 :: f2 :: l2〉 → derive 〈l1,FOr f1 f2 :: l2〉 + | NotR: ∀l1,l2,f. + derive 〈f::l1,l2〉 → derive 〈l1,FNot f :: l2〉 + | NotL: ∀l1,l2,f. + derive 〈l1,f::l2〉 → derive 〈FNot f :: l1,l2〉. + +let rec and_of_list l ≝ + match l with + [ nil ⇒ FTrue + | cons F l' ⇒ FAnd F (and_of_list l') + ]. + +let rec or_of_list l ≝ + match l with + [ nil ⇒ FFalse + | cons F l' ⇒ FOr F (or_of_list l') + ]. + +definition formula_of_sequent ≝ + λs.match s with [pair l1 l2 ⇒ FOr (FNot (and_of_list l1)) (or_of_list l2)]. + +definition is_tautology ≝ + λF. ∀i. eval i F = true. + +axiom assoc_orb: associative ? orb. +axiom symm_orb: symmetric ? orb. +axiom orb_not_b_b: ∀b:bool. (¬b ∨ b) = true. +axiom distributive_orb_andb: distributive ? orb andb. +axiom symm_andb: symmetric ? andb. +axiom associative_andb: associative ? andb. +axiom distributive_andb_orb: distributive ? andb orb. + +lemma and_of_list_permut: + ∀i,f,l1,l2. eval i (and_of_list (l1 @ (f::l2))) = eval i (and_of_list (f :: l1 @ l2)). + intros; + elim l1; + [ simplify; + reflexivity + | simplify in H ⊢ %; + rewrite > H; + autobatch paramodulation + ] +qed. + +lemma or_of_list_permut: + ∀i,f,l1,l2. eval i (or_of_list (l1 @ (f::l2))) = eval i (or_of_list (f :: l1 @ l2)). + intros; + elim l1; + [ simplify; + reflexivity + | simplify in H ⊢ %; + rewrite > H; + autobatch paramodulation + ] +qed. + +theorem soundness: ∀F. derive F → is_tautology (formula_of_sequent F). + intros; + elim H; + [ simplify in H2 ⊢ %; + intros; + lapply (H2 i); clear H2; + rewrite > and_of_list_permut; + simplify; + autobatch + | simplify in H2 ⊢ %; + intros; + lapply (H2 i); clear H2; + rewrite > or_of_list_permut; + simplify; + autobatch + | simplify; + intro; + rewrite > demorgan1; + rewrite < assoc_orb; + rewrite > assoc_orb in ⊢ (? ? (? % ?) ?); + rewrite > symm_orb in ⊢ (? ? (? (? ? %) ?) ?); + rewrite < assoc_orb; + rewrite > orb_not_b_b; + reflexivity + | simplify; + intros; + rewrite > symm_orb; + reflexivity + | simplify; + intros; + reflexivity + | simplify in H2 H4 ⊢ %; + intros; + lapply (H2 i); clear H2; + lapply (H4 i); clear H4; + rewrite > symm_orb in ⊢ (? ? (? ? %) ?); + rewrite > distributive_orb_andb; + autobatch paramodulation + | simplify in H2 ⊢ %; + intros; + lapply (H2 i); clear H2; + autobatch + | simplify in H2 H4 ⊢ %; + intros; + lapply (H2 i); clear H2; + lapply (H4 i); clear H4; + rewrite > symm_andb; + rewrite > distributive_andb_orb; + rewrite > demorgan2; + rewrite > symm_orb; + rewrite > distributive_orb_andb; + autobatch paramodulation + | simplify in H2 ⊢ %; + intros; + lapply (H2 i); clear H2; + autobatch + | simplify in H2 ⊢ %; + intros; + lapply (H2 i); clear H2; + autobatch paramodulation + | simplify in H2 ⊢ %; + intros; + lapply (H2 i); clear H2; + autobatch paramodulation + ] +qed. + +alias num (instance 0) = "natural number". +let rec size F ≝ + match F with + [ FTrue ⇒ 0 + | FFalse ⇒ 0 + | FAtom n ⇒ 0 + | FAnd f1 f2 ⇒ S (size f1 + size f2) + | FOr f1 f2 ⇒ S (size f1 + size f2) + | FNot f ⇒ S (size f) + ]. + +let rec sizel l ≝ + match l with + [ nil ⇒ 0 + | cons F l' ⇒ size F + sizel l' + ]. + +definition size_of_sequent ≝ + λS.match S with [ pair l r ⇒ sizel l + sizel r]. + +axiom weakeningR: + ∀l1,l2,F. derive 〈l1,l2〉 → derive 〈l1,F::l2〉. + +definition same_atom : Formula → Formula → bool. + intros; + elim f; + [3: elim f1; + [3: apply (eqb n n1) + |*: apply false + ] + |*: apply false + ] +qed. + +definition symmetricb ≝ + λA:Type.λeq:A → A → bool. ∀x,y. eq x y = eq y x. + +theorem symmetricb_eqb: symmetricb ? eqb. + intro; + elim x; + elim y; + [1,2,3: reflexivity + | simplify; + autobatch + ] +qed. + +theorem symmetricb_same_atom: symmetricb ? same_atom. + intro; + elim x; + [3: + elim y; + [3: + simplify; + apply symmetricb_eqb + |*: reflexivity + ] + |*: elim y; reflexivity + ] +qed. + +definition transitiveb ≝ + λA:Type.λeq:A → A → bool. + ∀x,y,z. eq x y = true → eq y z = eq x z. + +theorem transitiveb_same_atom: transitiveb ? same_atom. + intro; + elim x 0; + [3: + intros 2; + elim y 0; + [3: + intros 3; + simplify in H; + rewrite > (eqb_true_to_eq ? ? H); + reflexivity + |1,2: + intros; + simplify in H; + destruct H + |4,5: + intros; + simplify in H2; + destruct H2 + | intros; + simplify in H1; + destruct H1 + ] + |1,2: + intros; + simplify in H; + destruct H + |4,5: + intros; + simplify in H2; + destruct H2 + | intros; + simplify in H1; + destruct H1 + ] +qed. + +theorem eq_to_eq_mem: + ∀A.∀eq: A → A → bool.transitiveb ? eq → + ∀x,y,l.eq x y = true → mem ? eq x l = mem ? eq y l. + intros; + elim l; + [ reflexivity + | simplify; + rewrite > (H ? ? ? H1); + rewrite > H2; + reflexivity + ] +qed. + +theorem mem_to_exists_l1_l2: + ∀A,eq,n,l. (∀x,y. eq x y = true → x = y) → mem A eq n l = true → ∃l1,l2. l = l1 @ (n :: l2). + intros 4; + elim l; + [ simplify in H1; + destruct H1 + | simplify in H2; + apply (bool_elim ? (eq n t)); + intro; + [ apply (ex_intro ? ? []); + apply (ex_intro ? ? l1); + simplify; + rewrite > (H1 ? ? H3); + reflexivity + | rewrite > H3 in H2; + simplify in H2; + elim (H H1 H2); + elim H4; + rewrite > H5; + apply (ex_intro ? ? (t::a)); + apply (ex_intro ? ? a1); + simplify; + reflexivity + ] + ] +qed. + +lemma same_atom_to_eq: ∀f1,f2. same_atom f1 f2 = true → f1=f2. + intro; + elim f1; + [1,2: + simplify in H; + destruct H + | generalize in match H; clear H; + elim f2; + [1,2: + simplify in H; + destruct H + | simplify in H; + rewrite > (eqb_true_to_eq ? ? H); + reflexivity + |4,5: + simplify in H2; + destruct H2 + | simplify in H1; + destruct H1 + ] + |4,5: + simplify in H2; + destruct H2 + |6: + simplify in H1; + destruct H1 + ] +qed. + +lemma same_atom_to_exists: ∀f1,f2. same_atom f1 f2 = true → ∃n. f1 = FAtom n. + intro; + elim f1; + [1,2: + simplify in H; + destruct H + | autobatch + |4,5: + simplify in H2; + destruct H2 + | simplify in H1; + destruct H1 + ] +qed. + +lemma mem_same_atom_to_exists: + ∀f,l. mem ? same_atom f l = true → ∃n. f = FAtom n. + intros 2; + elim l; + [ simplify in H; + destruct H + | simplify in H1; + apply (bool_elim ? (same_atom f t)); + intros; + [ elim (same_atom_to_exists ? ? H2); + autobatch + | rewrite > H2 in H1; + simplify in H1; + elim (H H1); + autobatch + ] + ] +qed. + +lemma look_for_axiom: + ∀l1,l2. + (∃n,ll1,ll2,lr1,lr2. l1 = ll1 @ (FAtom n :: ll2) ∧ l2 = lr1 @ (FAtom n :: lr2)) + ∨ ∀n1. (mem ? same_atom (FAtom n1) l1 ∧ mem ? same_atom (FAtom n1) l2) = false. + intro; + elim l1 1; clear l1; + [ intros; + right; + intros; + simplify; + reflexivity + | intros; + generalize in match (refl_eq ? (mem ? same_atom t l2)); + elim (mem ? same_atom t l2) in ⊢ (? ? ? %→?); + [ left; + elim (mem_to_exists_l1_l2 ? ? ? ? same_atom_to_eq H1); + elim H2; clear H2; + elim (mem_same_atom_to_exists ? ? H1); + rewrite > H2 in H3; + apply (ex_intro ? ? a2); + rewrite > H2; + apply (ex_intro ? ? []); + simplify; + autobatch depth=5 + | elim (H l2); + [ left; + decompose; + apply (ex_intro ? ? a); + apply (ex_intro ? ? (t::a1)); + simplify; + apply (ex_intro ? ? a2); + apply (ex_intro ? ? a3); + autobatch + | right; + intro; + apply (bool_elim ? (same_atom t (FAtom n1))); + [ intro; + rewrite > (eq_to_eq_mem ? ? transitiveb_same_atom ? ? ? H3) in H1; + rewrite > H1; + autobatch + | intro; + change in ⊢ (? ? (? % ?) ?) with + (match same_atom (FAtom n1) t with + [true ⇒ true + |false ⇒ mem ? same_atom (FAtom n1) l + ]); + rewrite > symmetricb_same_atom; + rewrite > H3; + simplify; + apply H2 + ] + ] + ] + ] +qed. + +lemma eq_plus_n_m_O_to_eq_m_O: ∀n,m.n+m=0 → m=0. + intros 2; + elim n; + [ assumption + | simplify in H1; + destruct H1 + ] +qed. + +lemma not_eq_nil_append_cons: ∀A.∀l1,l2.∀x:A.¬ [] = l1 @ (x :: l2). + intros; + elim l1; + simplify; + intro; + [ destruct H + | destruct H1 + ] +qed. + +(*lemma foo: ∀x,l. + (¬eval + (λn:nat + .match eqb n x with  + [true⇒true|false⇒mem Formula same_atom (FAtom n) l]) (and_of_list l)) = + (¬eval + (λn:nat.mem Formula same_atom (FAtom n) l) (and_of_list l)). + intros; + elim l; + [ reflexivity + | simplify in ⊢ (? ? (? (? ? %)) ?); + change in ⊢ (? ? (? %) ?) with + (eval (λn:nat + .match eqb n x in bool return λb:bool.bool with  + [true⇒true|false⇒mem Formula same_atom (FAtom n) (t::l1)]) t + ∧ + eval (λn:nat + .match eqb n x in bool return λb:bool.bool with  + [true⇒true|false⇒mem Formula same_atom (FAtom n) (t::l1)]) + (and_of_list l1)); + + + ] +qed.*) + +axiom daemon: False. + +lemma sizel_0_no_axiom_is_tautology: + ∀l1,l2. size_of_sequent 〈l1,l2〉 = 0 → is_tautology (formula_of_sequent 〈l1,l2〉) → + (∀n. (mem ? same_atom (FAtom n) l1 ∧ mem ? same_atom (FAtom n) l2) = false) → + (∃ll1,ll2. l1 = ll1 @ (FFalse :: ll2)) ∨ (∃ll1,ll2. l2 = ll1 @ (FTrue :: ll2)). + intros; + lapply (H1 (λn.mem ? same_atom (FAtom n) l1)); clear H1; + simplify in Hletin; + generalize in match Hletin; clear Hletin; + generalize in match H2; clear H2; + generalize in match H; clear H; + elim l1 0; + [ intros; + simplify in H2; + generalize in match H2; clear H2; + generalize in match H1; clear H1; + generalize in match H; clear H; + elim l2 0; + [ intros; + simplify in H2; + destruct H2 + | simplify; + intro; + elim t; + [ right; + apply (ex_intro ? ? []); + simplify; + autobatch + | simplify in H3; + simplify in H1; + elim H; + [ elim H4; + elim H5; + elim (not_eq_nil_append_cons ? ? ? ? H6) + | elim H4; + right; + apply (ex_intro ? ? (FFalse::a)); + simplify; + elim H5; + apply (ex_intro ? ? a1); + autobatch + |3,4: autobatch + | assumption + ] + | simplify in H1 H3; + elim (H H1 H2 H3); clear H; + [ elim H4; + elim H; + elim (not_eq_nil_append_cons ? ? ? ? H5) + | right; + elim H4; + apply (ex_intro ? ? (FAtom n::a)); + simplify; + elim H; + autobatch + ] + |4,5: + simplify in H3; + destruct H3 + | simplify in H2; + destruct H2 + ] + ] + | intro; + elim t; + [ elim H; + [ left; + elim H4; + apply (ex_intro ? ? (FTrue::a)); + simplify; + elim H5; + autobatch + | right; + assumption + | assumption + | lapply (H2 n); clear H2; + simplify in Hletin; + assumption + | simplify in H3; + assumption + ] + | left; + apply (ex_intro ? ? []); + simplify; + autobatch + | elim H; + [ left; + elim H4; + apply (ex_intro ? ? (FAtom n::a)); + simplify; + elim H5; + autobatch + | right; + assumption + | assumption + | lapply (H2 n1); clear H2; + simplify in Hletin; + generalize in match Hletin; clear Hletin; + elim (eqb n1 n); + [ simplify in H2; + rewrite > H2; + autobatch + | simplify in H2; + assumption + ] + | simplify in H2; + lapply (H2 n); clear H2; + rewrite > eqb_n_n in Hletin; + simplify in Hletin; + simplify in H3; + rewrite > eqb_n_n in H3; + simplify in H3; +(* + generalize in match H3; + generalize in match H1; clear H1; + generalize in match H; clear H; + elim l 0; + [ elim l2 0; + [ intros; + simplify in H2; + destruct H2 + | intros; + simplify in H4 ⊢ %; + simplify in H; + rewrite > H; + [ autobatch + | intros; + apply H1; + | simplify in H2; + apply (eq_plus_n_m_O_to_eq_m_O ? ? H2) + | + ] + + [ autobatch + | generalize in match H4; clear H4; + generalize in match H2; clear H2; + elim t1; + [ + | + | + |4,5: + simplify in H5; + destruct H5 + | simplify in H4; + destruct H4 + ] + ] + ] + | + ] +*) elim daemon + ] + |4,5: + simplify in H3; + destruct H3 + | simplify in H2; + destruct H2 + ] + ] +qed. + +lemma completeness_base: + ∀S. size_of_sequent S = 0 → is_tautology (formula_of_sequent S) → derive S. + intro; + elim S 1; clear S; + simplify in ⊢ (?→%→?); + intros; + elim (look_for_axiom t t1); + [ decompose; + rewrite > H2; clear H2; + rewrite > H4; clear H4; + apply (ExchangeL ? a1 a2 (FAtom a)); + apply (ExchangeR ? a3 a4 (FAtom a)); + apply Axiom + | elim (sizel_0_no_axiom_is_tautology t t1 H H1 H2); + [ decompose; + rewrite > H3; + apply (ExchangeL ? a a1 FFalse); + apply FalseL + | decompose; + rewrite > H3; + apply (ExchangeR ? a a1 FTrue); + apply TrueR + ] + ] +qed. + +(* +lemma completeness_step: + ∀l1,l2,n. size_of_sequent 〈l1,l2〉 = S n → + (∃ll1,ll2,f. l1 = ll1 @ (f::ll2) ∧ size f > 0) ∨ + (∃ll1,ll2,f. l2 = ll1 @ (f::ll2) ∧ size f > 0). + intros 3; + elim l1 0; + [ elim l2 0; + [ intros; + simplify in H; + destruct H + | intros 3; + elim t; + [ elim (H H1); + [ left; + assumption + | right; + decompose; + apply (ex_intro ? ? (FTrue::a)); + simplify; + autobatch depth=5 + ] + | elim (H H1); + [ left; + assumption + | right; + decompose; + apply (ex_intro ? ? (FFalse::a)); + simplify; + autobatch depth=5 + ] + | elim (H H1); + [ left; + assumption + | right; + decompose; + apply (ex_intro ? ? (FAtom n1::a)); + simplify; + autobatch depth=5 + ] + | right; + apply (ex_intro ? ? []); + simplify; + apply (ex_intro ? ? l); + apply (ex_intro ? ? (FAnd f f1)); + simplify; + split; + [ reflexivity + | unfold gt; + autobatch + ] + | right; + apply (ex_intro ? ? []); + simplify; + apply (ex_intro ? ? l); + apply (ex_intro ? ? (FOr f f1)); + simplify; + split; + [ reflexivity + | unfold gt; + autobatch + ] + | right; + apply (ex_intro ? ? []); + simplify; + apply (ex_intro ? ? l); + apply (ex_intro ? ? (FNot f)); + simplify; + split; + [ reflexivity + | unfold gt; + autobatch + ] + ] + ] + | intros 2; + elim t; + [1,2:(*,2,3:*) + elim (H H1); + decompose; + [ left; + autobatch depth=5 + | right; + autobatch depth=5 + ] + | left; + apply (ex_intro ? ? []); + simplify; + apply (ex_intro ? ? l); + apply (ex_intro ? ? (FAnd f f1)); + unfold gt; + simplify; + autobatch + | left; + apply (ex_intro ? ? []); + simplify; + apply (ex_intro ? ? l); + apply (ex_intro ? ? (FOr f f1)); + unfold gt; + simplify; + autobatch + | left; + apply (ex_intro ? ? []); + simplify; + apply (ex_intro ? ? l); + apply (ex_intro ? ? (FNot f)); + unfold gt; + simplify; + autobatch + ] + ] +qed. + +theorem completeness: ∀S. is_tautology (formula_of_sequent S) → derive S. + intro; + generalize in match (refl_eq ? (size_of_sequent S)); + elim (size_of_sequent S) in ⊢ (? ? ? %→?); + [ apply completeness_base; + assumption + | + ] +qed. + + elim F; + [ autobatch + | simplify in H; + lapply (H (λx.true)); + destruct Hletin + | simplify in H; + lapply (H (λx.false)); + destruct Hletin + | apply AndR; + [ apply H; + intro; + lapply (H2 i); clear H2; + simplify in Hletin; + autobatch + | apply H1; + intro; + lapply (H2 i); clear H2; + simplify in Hletin; + autobatch + ] + | apply OrR; + simplify in H2; + | apply NotR; + simplify in H1; +*) diff --git a/matita/library/higher_order_defs/functions.ma b/matita/library/higher_order_defs/functions.ma new file mode 100644 index 000000000..ce0f9ac66 --- /dev/null +++ b/matita/library/higher_order_defs/functions.ma @@ -0,0 +1,67 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "logic/equality.ma". + +definition compose \def + \lambda A,B,C:Type.\lambda f:(B\to C).\lambda g:(A\to B).\lambda x:A. + f (g x). + +notation "hvbox(a break \circ b)" + left associative with precedence 70 +for @{ 'compose $a $b }. + +interpretation "function composition" 'compose f g = + (cic:/matita/higher_order_defs/functions/compose.con _ _ _ f g). + +definition injective: \forall A,B:Type.\forall f:A \to B.Prop +\def \lambda A,B.\lambda f. + \forall x,y:A.f x = f y \to x=y. + +definition surjective: \forall A,B:Type.\forall f:A \to B.Prop +\def \lambda A,B.\lambda f. + \forall z:B. \exists x:A.z=f x. + +definition symmetric: \forall A:Type.\forall f:A \to A\to A.Prop +\def \lambda A.\lambda f.\forall x,y.f x y = f y x. + +definition symmetric2: \forall A,B:Type.\forall f:A \to A\to B.Prop +\def \lambda A,B.\lambda f.\forall x,y.f x y = f y x. + +definition associative: \forall A:Type.\forall f:A \to A\to A.Prop +\def \lambda A.\lambda f.\forall x,y,z.f (f x y) z = f x (f y z). + +theorem eq_f_g_h: + \forall A,B,C,D:Type. + \forall f:C \to D.\forall g:B \to C.\forall h:A \to B. + f \circ (g \circ h) = (f \circ g) \circ h. + intros. + reflexivity. +qed. + +(* functions and relations *) +definition monotonic : \forall A:Type.\forall R:A \to A \to Prop. +\forall f:A \to A.Prop \def +\lambda A. \lambda R. \lambda f. \forall x,y:A.R x y \to R (f x) (f y). + +(* functions and functions *) +definition distributive: \forall A:Type.\forall f,g:A \to A \to A.Prop +\def \lambda A.\lambda f,g.\forall x,y,z:A. f x (g y z) = g (f x y) (f x z). + +definition distributive2: \forall A,B:Type.\forall f:A \to B \to B. +\forall g: B\to B\to B. Prop +\def \lambda A,B.\lambda f,g.\forall x:A.\forall y,z:B. f x (g y z) = g (f x y) (f x z). + diff --git a/matita/library/higher_order_defs/ordering.ma b/matita/library/higher_order_defs/ordering.ma new file mode 100644 index 000000000..382465269 --- /dev/null +++ b/matita/library/higher_order_defs/ordering.ma @@ -0,0 +1,22 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "logic/equality.ma". + +definition antisymmetric: \forall A:Type.\forall R:A \to A \to Prop.Prop +\def +\lambda A.\lambda R.\forall x,y:A.R x y \to R y x \to x=y. + diff --git a/matita/library/higher_order_defs/relations.ma b/matita/library/higher_order_defs/relations.ma new file mode 100644 index 000000000..01dc07860 --- /dev/null +++ b/matita/library/higher_order_defs/relations.ma @@ -0,0 +1,51 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "logic/connectives.ma". + +definition relation : Type \to Type +\def \lambda A:Type.A \to A \to Prop. + +definition reflexive: \forall A:Type.\forall R :relation A.Prop +\def +\lambda A.\lambda R.\forall x:A.R x x. + +definition symmetric: \forall A:Type.\forall R: relation A.Prop +\def +\lambda A.\lambda R.\forall x,y:A.R x y \to R y x. + +definition transitive: \forall A:Type.\forall R:relation A.Prop +\def +\lambda A.\lambda R.\forall x,y,z:A.R x y \to R y z \to R x z. + +definition irreflexive: \forall A:Type.\forall R:relation A.Prop +\def +\lambda A.\lambda R.\forall x:A.\lnot (R x x). + +definition cotransitive: \forall A:Type.\forall R:relation A.Prop +\def +\lambda A.\lambda R.\forall x,y:A.R x y \to \forall z:A. R x z \lor R z y. + +definition tight_apart: \forall A:Type.\forall eq,ap:relation A.Prop +\def +\lambda A.\lambda eq,ap.\forall x,y:A. (\not (ap x y) \to eq x y) \land +(eq x y \to \not (ap x y)). + +definition antisymmetric: \forall A:Type.\forall R:relation A.Prop +\def +\lambda A.\lambda R.\forall x,y:A. R x y \to \not (R y x). + + diff --git a/matita/library/library_notation.ma b/matita/library/library_notation.ma new file mode 100644 index 000000000..eb32e36ac --- /dev/null +++ b/matita/library/library_notation.ma @@ -0,0 +1,54 @@ + + +include "Q/q.ma". +include "higher_order_defs/functions.ma". +include "higher_order_defs/ordering.ma". +include "higher_order_defs/relations.ma". +include "nat/nth_prime.ma". +include "nat/plus.ma". +include "nat/ord.ma". +include "nat/congruence.ma". +include "nat/compare.ma". +include "nat/totient.ma". +include "nat/le_arith.ma". +include "nat/count.ma". +include "nat/orders.ma". +include "nat/minus.ma". +include "nat/exp.ma". +include "nat/gcd.ma". +include "nat/div_and_mod.ma". +include "nat/primes.ma". +include "nat/relevant_equations.ma". +include "nat/chinese_reminder.ma". +include "nat/factorial.ma". +include "nat/lt_arith.ma". +include "nat/minimization.ma". +include "nat/permutation.ma". +include "nat/sigma_and_pi.ma". +include "nat/factorization.ma". +include "nat/times.ma". +include "nat/fermat_little_theorem.ma". +include "nat/nat.ma". +(* FG: coq non c'entra con library, o sbaglio? *) +(* include "legacy/coq.ma". *) +include "Z/compare.ma". +include "Z/plus.ma". +include "Z/times.ma". +include "Z/z.ma". +include "Z/orders.ma". +include "list/sort.ma". +include "list/list.ma". +include "algebra/semigroups.ma". +include "algebra/monoids.ma". +include "algebra/groups.ma". +include "algebra/finite_groups.ma". +include "logic/connectives.ma". +include "logic/equality.ma". +include "datatypes/constructors.ma". +include "datatypes/compare.ma". +include "datatypes/bool.ma". + +notation "hvbox(x break \middot y)" + left associative with precedence 55 +for @{ 'times $x $y }. + diff --git a/matita/library/list/list.ma b/matita/library/list/list.ma new file mode 100644 index 000000000..b7a38ed99 --- /dev/null +++ b/matita/library/list/list.ma @@ -0,0 +1,145 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + +include "logic/equality.ma". +include "higher_order_defs/functions.ma". + +inductive list (A:Type) : Type := + | nil: list A + | cons: A -> list A -> list A. + +notation "hvbox(hd break :: tl)" + right associative with precedence 46 + for @{'cons $hd $tl}. + +notation "[ list0 x sep ; ]" + non associative with precedence 90 + for ${fold right @'nil rec acc @{'cons $x $acc}}. + +notation "hvbox(l1 break @ l2)" + right associative with precedence 47 + for @{'append $l1 $l2 }. + +interpretation "nil" 'nil = (cic:/matita/list/list.ind#xpointer(1/1/1) _). +interpretation "cons" 'cons hd tl = + (cic:/matita/list/list.ind#xpointer(1/1/2) _ hd tl). + +(* theorem test_notation: [O; S O; S (S O)] = O :: S O :: S (S O) :: []. *) + +theorem nil_cons: + \forall A:Type.\forall l:list A.\forall a:A. + a::l <> []. + intros; + unfold Not; + intros; + destruct H. +qed. + +let rec id_list A (l: list A) on l := + match l with + [ nil => [] + | (cons hd tl) => hd :: id_list A tl ]. + +let rec append A (l1: list A) l2 on l1 := + match l1 with + [ nil => l2 + | (cons hd tl) => hd :: append A tl l2 ]. + +definition tail := \lambda A:Type. \lambda l: list A. + match l with + [ nil => [] + | (cons hd tl) => tl]. + +interpretation "append" 'append l1 l2 = (cic:/matita/list/append.con _ l1 l2). + +theorem append_nil: \forall A:Type.\forall l:list A.l @ [] = l. + intros; + elim l; + [ reflexivity; + | simplify; + rewrite > H; + reflexivity; + ] +qed. + +theorem associative_append: \forall A:Type.associative (list A) (append A). + intros; unfold; intros; + elim x; + [ simplify; + reflexivity; + | simplify; + rewrite > H; + reflexivity; + ] +qed. + +theorem cons_append_commute: + \forall A:Type.\forall l1,l2:list A.\forall a:A. + a :: (l1 @ l2) = (a :: l1) @ l2. + intros; + reflexivity; +qed. + +inductive permutation (A:Type) : list A -> list A -> Prop \def + | refl : \forall l:list A. permutation ? l l + | swap : \forall l:list A. \forall x,y:A. + permutation ? (x :: y :: l) (y :: x :: l) + | trans : \forall l1,l2,l3:list A. + permutation ? l1 l2 -> permut1 ? l2 l3 -> permutation ? l1 l3 +with permut1 : list A -> list A -> Prop \def + | step : \forall l1,l2:list A. \forall x,y:A. + permut1 ? (l1 @ (x :: y :: l2)) (l1 @ (y :: x :: l2)). + +include "nat/nat.ma". + +definition x1 \def S O. +definition x2 \def S x1. +definition x3 \def S x2. + +theorem tmp : permutation nat (x1 :: x2 :: x3 :: []) (x1 :: x3 :: x2 :: []). + apply (trans ? (x1 :: x2 :: x3 :: []) (x1 :: x2 :: x3 :: []) ?). + apply refl. + apply (step ? (x1::[]) [] x2 x3). + qed. + + +(* +theorem nil_append_nil_both: + \forall A:Type.\forall l1,l2:list A. + l1 @ l2 = [] \to l1 = [] \land l2 = []. +*) + +(* +include "nat/nat.ma". + +theorem test_notation: [O; S O; S (S O)] = O :: S O :: S (S O) :: []. +reflexivity. +qed. + +theorem test_append: [O;O;O;O;O;O] = [O;O;O] @ [O;O] @ [O]. +simplify. +reflexivity. +qed. +*) + +let rec nth (A:Type) l d n on n ≝ + match n with + [ O ⇒ + match l with + [ nil ⇒ d + | cons (x : A) _ ⇒ x + ] + | S n' ⇒ nth A (tail ? l) d n' + ]. diff --git a/matita/library/list/sort.ma b/matita/library/list/sort.ma new file mode 100644 index 000000000..180daa444 --- /dev/null +++ b/matita/library/list/sort.ma @@ -0,0 +1,172 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "datatypes/bool.ma". +include "datatypes/constructors.ma". +include "list/list.ma". + +let rec mem (A:Type) (eq: A → A → bool) x (l: list A) on l ≝ + match l with + [ nil ⇒ false + | (cons a l') ⇒ + match eq x a with + [ true ⇒ true + | false ⇒ mem A eq x l' + ] + ]. + +let rec ordered (A:Type) (le: A → A → bool) (l: list A) on l ≝ + match l with + [ nil ⇒ true + | (cons x l') ⇒ + match l' with + [ nil ⇒ true + | (cons y l'') ⇒ + le x y \land ordered A le l' + ] + ]. + +let rec insert (A:Type) (le: A → A → bool) x (l: list A) on l ≝ + match l with + [ nil ⇒ [x] + | (cons he l') ⇒ + match le x he with + [ true ⇒ x::l + | false ⇒ he::(insert A le x l') + ] + ]. + +lemma insert_ind : + ∀A:Type. ∀le: A → A → bool. ∀x. + ∀P:(list A → list A → Prop). + ∀H:(∀l: list A. l=[] → P [] [x]). + ∀H2: + (∀l: list A. ∀he. ∀l'. P l' (insert ? le x l') → + le x he = false → l=he::l' → P (he::l') (he::(insert ? le x l'))). + ∀H3: + (∀l: list A. ∀he. ∀l'. P l' (insert ? le x l') → + le x he = true → l=he::l' → P (he::l') (x::he::l')). + ∀l:list A. P l (insert ? le x l). + intros. + apply ( + let rec insert_ind (l: list A) \def + match l in list + return + λli. + l = li → P li (insert ? le x li) + with + [ nil ⇒ H l + | (cons he l') ⇒ + match le x he + return + λb. le x he = b → l = he::l' → + P (he::l') + (match b with + [ true ⇒ x::he::l' + | false ⇒ he::(insert ? le x l') ]) + with + [ true ⇒ H2 l he l' (insert_ind l') + | false ⇒ H1 l he l' (insert_ind l') + ] + (refl_eq ? (le x he)) + ] (refl_eq ? l) in insert_ind l). +qed. + + +let rec insertionsort (A:Type) (le: A → A → bool) (l: list A) on l ≝ + match l with + [ nil ⇒ [] + | (cons he l') ⇒ + let l'' ≝ insertionsort A le l' in + insert A le he l'' + ]. + +lemma ordered_injective: + ∀A:Type. ∀le:A → A → bool. + ∀l:list A. ordered A le l = true → ordered A le (tail A l) = true. + intros 3 (A le l). + elim l + [ simplify; reflexivity; + | simplify; + generalize in match H1; + clear H1; + elim l1; + [ simplify; reflexivity; + | cut ((le t t1 \land ordered A le (t1::l2)) = true); + [ generalize in match Hcut; + apply andb_elim; + elim (le t t1); + [ simplify; + fold simplify (ordered ? le (t1::l2)); + intros; assumption; + | simplify; + intros (Habsurd); + apply False_ind; + apply (not_eq_true_false); + symmetry; + assumption + ] + | exact H2; + ] + ] + ]. +qed. + +lemma insert_sorted: + \forall A:Type. \forall le:A\to A\to bool. + (\forall a,b:A. le a b = false \to le b a = true) \to + \forall l:list A. \forall x:A. + ordered A le l = true \to ordered A le (insert A le x l) = true. + intros 5 (A le H l x). + apply (insert_ind ? ? ? (λl,il. ordered ? le l = true → ordered ? le il = true)); + clear l; intros; simplify; intros; + [2: rewrite > H1; + [ generalize in match (H ? ? H2); clear H2; intro; + generalize in match H4; clear H4; + elim l'; simplify; + [ rewrite > H5; + reflexivity + | elim (le x t); simplify; + [ rewrite > H5; + reflexivity + | simplify in H4; + rewrite > (andb_true_true ? ? H4); + reflexivity + ] + ] + | apply (ordered_injective ? ? ? H4) + ] + | reflexivity + | rewrite > H2; + rewrite > H4; + reflexivity + ]. +qed. + +theorem insertionsort_sorted: + ∀A:Type. + ∀le:A → A → bool.∀eq:A → A → bool. + (∀a,b:A. le a b = false → le b a = true) \to + ∀l:list A. + ordered A le (insertionsort A le l) = true. + intros 5 (A le eq le_tot l). + elim l; + [ simplify; + reflexivity; + | apply (insert_sorted ? ? le_tot (insertionsort ? le l1) t); + assumption; + ] +qed. \ No newline at end of file diff --git a/matita/library/logic/coimplication.ma b/matita/library/logic/coimplication.ma new file mode 100644 index 000000000..5c686e6c1 --- /dev/null +++ b/matita/library/logic/coimplication.ma @@ -0,0 +1,47 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "logic/connectives.ma". + +definition Iff : Prop \to Prop \to Prop \def + \lambda A,B. (A \to B) \land (B \to A). + + (*CSC: the URI must disappear: there is a bug now *) +interpretation "logical iff" 'iff x y = (cic:/matita/logic/coimplication/Iff.con x y). + +notation > "hvbox(a break \liff b)" + left associative with precedence 25 +for @{ 'iff $a $b }. + +notation < "hvbox(a break \leftrightarrow b)" + left associative with precedence 25 +for @{ 'iff $a $b }. + +theorem iff_intro: \forall A,B. (A \to B) \to (B \to A) \to (A \liff B). + unfold Iff. intros. split; intros; autobatch. +qed. + +theorem iff_refl: \forall A. A \liff A. + intros. apply iff_intro; intros; autobatch. +qed. + +theorem iff_sym: \forall A,B. A \liff B \to B \liff A. + intros. elim H. apply iff_intro[assumption|assumption] +qed. + +theorem iff_trans: \forall A,B,C. A \liff B \to B \liff C \to A \liff C. + intros. elim H. elim H1. apply iff_intro;intros;autobatch. +qed. diff --git a/matita/library/logic/connectives.ma b/matita/library/logic/connectives.ma new file mode 100644 index 000000000..5cc4c7611 --- /dev/null +++ b/matita/library/logic/connectives.ma @@ -0,0 +1,86 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +inductive True: Prop \def +I : True. + +default "true" cic:/matita/logic/connectives/True.ind. + +inductive False: Prop \def . + +default "false" cic:/matita/logic/connectives/False.ind. + +definition Not: Prop \to Prop \def +\lambda A. (A \to False). + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "logical not" 'not x = (cic:/matita/logic/connectives/Not.con x). + +theorem absurd : \forall A,C:Prop. A \to \lnot A \to C. +intros. elim (H1 H). +qed. + +default "absurd" cic:/matita/logic/connectives/absurd.con. + +inductive And (A,B:Prop) : Prop \def + conj : A \to B \to (And A B). + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "logical and" 'and x y = (cic:/matita/logic/connectives/And.ind#xpointer(1/1) x y). + +theorem proj1: \forall A,B:Prop. A \land B \to A. +intros. elim H. assumption. +qed. + +theorem proj2: \forall A,B:Prop. A \land B \to B. +intros. elim H. assumption. +qed. + +inductive Or (A,B:Prop) : Prop \def + or_introl : A \to (Or A B) + | or_intror : B \to (Or A B). + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "logical or" 'or x y = + (cic:/matita/logic/connectives/Or.ind#xpointer(1/1) x y). + +theorem Or_ind': + \forall A,B:Prop. + \forall P: A \lor B \to Prop. + (\forall p:A. P (or_introl ? ? p)) \to + (\forall q:B. P (or_intror ? ? q)) \to + \forall p:A \lor B. P p. + intros. + apply + (match p return \lambda p.P p with + [(or_introl p) \Rightarrow H p + |(or_intror q) \Rightarrow H1 q]). +qed. + +definition decidable : Prop \to Prop \def \lambda A:Prop. A \lor \lnot A. + +inductive ex (A:Type) (P:A \to Prop) : Prop \def + ex_intro: \forall x:A. P x \to ex A P. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "exists" 'exists \eta.x = + (cic:/matita/logic/connectives/ex.ind#xpointer(1/1) _ x). + +inductive ex2 (A:Type) (P,Q:A \to Prop) : Prop \def + ex_intro2: \forall x:A. P x \to Q x \to ex2 A P Q. + +definition iff := + \lambda A,B. (A -> B) \land (B -> A). \ No newline at end of file diff --git a/matita/library/logic/connectives2.ma b/matita/library/logic/connectives2.ma new file mode 100644 index 000000000..afaf275e1 --- /dev/null +++ b/matita/library/logic/connectives2.ma @@ -0,0 +1,44 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "higher_order_defs/relations.ma". + +theorem reflexive_iff: reflexive ? iff. + unfold reflexive; + intro; + split; + intro; + assumption. +qed. + +theorem symmetric_iff: symmetric ? iff. + unfold symmetric; + intros; + elim H; + split; + assumption. +qed. + +theorem transitive_iff: transitive ? iff. + unfold transitive; + intros; + elim H; + elim H1; + split; + intro; + autobatch. +qed. + diff --git a/matita/library/logic/equality.ma b/matita/library/logic/equality.ma new file mode 100644 index 000000000..55840cd50 --- /dev/null +++ b/matita/library/logic/equality.ma @@ -0,0 +1,247 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "higher_order_defs/relations.ma". + +inductive eq (A:Type) (x:A) : A \to Prop \def + refl_eq : eq A x x. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "leibnitz's equality" + 'eq x y = (cic:/matita/logic/equality/eq.ind#xpointer(1/1) _ x y). +(*CSC: the URI must disappear: there is a bug now *) +interpretation "leibnitz's non-equality" + 'neq x y = (cic:/matita/logic/connectives/Not.con + (cic:/matita/logic/equality/eq.ind#xpointer(1/1) _ x y)). + +theorem eq_rect': + \forall A. \forall x:A. \forall P: \forall y:A. x=y \to Type. + P ? (refl_eq ? x) \to \forall y:A. \forall p:x=y. P y p. + intros. + exact + (match p1 return \lambda y. \lambda p.P y p with + [refl_eq \Rightarrow p]). +qed. + +variant reflexive_eq : \forall A:Type. reflexive A (eq A) +\def refl_eq. +(* simplify.intros.apply refl_eq. *) + +theorem symmetric_eq: \forall A:Type. symmetric A (eq A). +unfold symmetric.intros.elim H. apply refl_eq. +qed. + +variant sym_eq : \forall A:Type.\forall x,y:A. x=y \to y=x +\def symmetric_eq. + +theorem transitive_eq : \forall A:Type. transitive A (eq A). +unfold transitive.intros.elim H1.assumption. +qed. + +variant trans_eq : \forall A:Type.\forall x,y,z:A. x=y \to y=z \to x=z +\def transitive_eq. + +theorem eq_elim_r: + \forall A:Type.\forall x:A. \forall P: A \to Prop. + P x \to \forall y:A. y=x \to P y. +intros. elim (sym_eq ? ? ? H1).assumption. +qed. + +theorem eq_elim_r': + \forall A:Type.\forall x:A. \forall P: A \to Set. + P x \to \forall y:A. y=x \to P y. +intros. elim (sym_eq ? ? ? H).assumption. +qed. + +theorem eq_elim_r'': + \forall A:Type.\forall x:A. \forall P: A \to Type. + P x \to \forall y:A. y=x \to P y. +intros. elim (sym_eq ? ? ? H).assumption. +qed. + +theorem eq_f: \forall A,B:Type.\forall f:A\to B. +\forall x,y:A. x=y \to f x = f y. +intros.elim H.apply refl_eq. +qed. + +theorem eq_f': \forall A,B:Type.\forall f:A\to B. +\forall x,y:A. x=y \to f y = f x. +intros.elim H.apply refl_eq. +qed. + +(* *) +coercion cic:/matita/logic/equality/sym_eq.con. +coercion cic:/matita/logic/equality/eq_f.con. +(* *) + +default "equality" + cic:/matita/logic/equality/eq.ind + cic:/matita/logic/equality/sym_eq.con + cic:/matita/logic/equality/transitive_eq.con + cic:/matita/logic/equality/eq_ind.con + cic:/matita/logic/equality/eq_elim_r.con + cic:/matita/logic/equality/eq_rec.con + cic:/matita/logic/equality/eq_elim_r'.con + cic:/matita/logic/equality/eq_rect.con + cic:/matita/logic/equality/eq_elim_r''.con + cic:/matita/logic/equality/eq_f.con +(* *) + cic:/matita/logic/equality/eq_OF_eq.con. +(* *) +(* + cic:/matita/logic/equality/eq_f'.con. (* \x.sym (eq_f x) *) + *) + +theorem eq_f2: \forall A,B,C:Type.\forall f:A\to B \to C. +\forall x1,x2:A. \forall y1,y2:B. +x1=x2 \to y1=y2 \to f x1 y1 = f x2 y2. +intros.elim H1.elim H.reflexivity. +qed. + +definition comp \def + \lambda A. + \lambda x,y,y':A. + \lambda eq1:x=y. + \lambda eq2:x=y'. + eq_ind ? ? (\lambda a.a=y') eq2 ? eq1. + +lemma trans_sym_eq: + \forall A. + \forall x,y:A. + \forall u:x=y. + comp ? ? ? ? u u = refl_eq ? y. + intros. + apply (eq_rect' ? ? ? ? ? u). + reflexivity. +qed. + +definition nu \def + \lambda A. + \lambda H: \forall x,y:A. decidable (x=y). + \lambda x,y. \lambda p:x=y. + match H x y with + [ (or_introl p') \Rightarrow p' + | (or_intror K) \Rightarrow False_ind ? (K p) ]. + +theorem nu_constant: + \forall A. + \forall H: \forall x,y:A. decidable (x=y). + \forall x,y:A. + \forall u,v:x=y. + nu ? H ? ? u = nu ? H ? ? v. + intros. + unfold nu. + unfold decidable in H. + apply (Or_ind' ? ? ? ? ? (H x y)); simplify. + intro; reflexivity. + intro; elim (q u). +qed. + +definition nu_inv \def + \lambda A. + \lambda H: \forall x,y:A. decidable (x=y). + \lambda x,y:A. + \lambda v:x=y. + comp ? ? ? ? (nu ? H ? ? (refl_eq ? x)) v. + +theorem nu_left_inv: + \forall A. + \forall H: \forall x,y:A. decidable (x=y). + \forall x,y:A. + \forall u:x=y. + nu_inv ? H ? ? (nu ? H ? ? u) = u. + intros. + apply (eq_rect' ? ? ? ? ? u). + unfold nu_inv. + apply trans_sym_eq. +qed. + +theorem eq_to_eq_to_eq_p_q: + \forall A. \forall x,y:A. + (\forall x,y:A. decidable (x=y)) \to + \forall p,q:x=y. p=q. + intros. + rewrite < (nu_left_inv ? H ? ? p). + rewrite < (nu_left_inv ? H ? ? q). + elim (nu_constant ? H ? ? q). + reflexivity. +qed. + +(*CSC: alternative proof that does not pollute the environment with + technical lemmata. Unfortunately, it is a pain to do without proper + support for let-ins. +theorem eq_to_eq_to_eq_p_q: + \forall A. \forall x,y:A. + (\forall x,y:A. decidable (x=y)) \to + \forall p,q:x=y. p=q. +intros. +letin nu \def + (\lambda x,y. \lambda p:x=y. + match H x y with + [ (or_introl p') \Rightarrow p' + | (or_intror K) \Rightarrow False_ind ? (K p) ]). +cut + (\forall q:x=y. + eq_ind ? ? (\lambda z. z=y) (nu ? ? q) ? (nu ? ? (refl_eq ? x)) + = q). +focus 8. + clear q; clear p. + intro. + apply (eq_rect' ? ? ? ? ? q); + fold simplify (nu ? ? (refl_eq ? x)). + generalize in match (nu ? ? (refl_eq ? x)); intro. + apply + (eq_rect' A x + (\lambda y. \lambda u. + eq_ind A x (\lambda a.a=y) u y u = refl_eq ? y) + ? x H1). + reflexivity. +unfocus. +rewrite < (Hcut p); fold simplify (nu ? ? p). +rewrite < (Hcut q); fold simplify (nu ? ? q). +apply (Or_ind' (x=x) (x \neq x) + (\lambda p:decidable (x=x). eq_ind A x (\lambda z.z=y) (nu x y p) x + ([\lambda H1.eq A x x] + match p with + [(or_introl p') \Rightarrow p' + |(or_intror K) \Rightarrow False_ind (x=x) (K (refl_eq A x))]) = + eq_ind A x (\lambda z.z=y) (nu x y q) x + ([\lambda H1.eq A x x] + match p with + [(or_introl p') \Rightarrow p' + |(or_intror K) \Rightarrow False_ind (x=x) (K (refl_eq A x))])) + ? ? (H x x)). +intro; simplify; reflexivity. +intro q; elim (q (refl_eq ? x)). +qed. +*) + +(* +theorem a:\forall x.x=x\land True. +[ +2:intros; + split; + [ + exact (refl_eq Prop x); + | + exact I; + ] +1: + skip +] +qed. +*) + diff --git a/matita/library/makefile b/matita/library/makefile new file mode 100644 index 000000000..ec9f8cb26 --- /dev/null +++ b/matita/library/makefile @@ -0,0 +1,39 @@ +H=@ + +RT_BASEDIR=../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/library/nat/binomial.ma b/matita/library/nat/binomial.ma new file mode 100644 index 000000000..606d6e859 --- /dev/null +++ b/matita/library/nat/binomial.ma @@ -0,0 +1,229 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/iteration2.ma". +include "nat/factorial2.ma". + +definition bc \def \lambda n,k. n!/(k!*(n-k)!). + +theorem bc_n_n: \forall n. bc n n = S O. +intro.unfold bc. +rewrite < minus_n_n. +simplify in ⊢ (? ? (? ? (? ? %)) ?). +rewrite < times_n_SO. +apply div_n_n. +apply lt_O_fact. +qed. + +theorem bc_n_O: \forall n. bc n O = S O. +intro.unfold bc. +rewrite < minus_n_O. +simplify in ⊢ (? ? (? ? %) ?). +rewrite < plus_n_O. +apply div_n_n. +apply lt_O_fact. +qed. + +theorem fact_minus: \forall n,k. k < n \to +(n-k)*(n - S k)! = (n - k)!. +intros 2.cases n + [intro.apply False_ind. + apply (lt_to_not_le ? ? H). + apply le_O_n + |intros. + rewrite > minus_Sn_m. + reflexivity. + apply le_S_S_to_le. + assumption + ] +qed. + +theorem bc2 : \forall n. +\forall k. k \leq n \to divides (k!*(n-k)!) n!. +intro;elim n + [rewrite < (le_n_O_to_eq ? H);apply reflexive_divides + |generalize in match H1;cases k + [intro;simplify in ⊢ (? (? ? (? %)) ?);simplify in ⊢ (? (? % ?) ?); + rewrite > sym_times;rewrite < times_n_SO;apply reflexive_divides + |intro;elim (decidable_eq_nat n2 n1) + [rewrite > H3;rewrite < minus_n_n; + rewrite > times_n_SO in ⊢ (? ? %);apply reflexive_divides + |lapply (H n2) + [lapply (H (n1 - (S n2))) + [change in ⊢ (? ? %) with ((S n1)*n1!); + rewrite > (plus_minus_m_m n1 n2) in ⊢ (? ? (? (? %) ?)) + [rewrite > sym_plus; + change in ⊢ (? ? (? % ?)) with ((S n2) + (n1 - n2)); + rewrite > sym_times in \vdash (? ? %); + rewrite > distr_times_plus in ⊢ (? ? %); + simplify in ⊢ (? (? ? (? %)) ?); + apply divides_plus + [rewrite > sym_times; + change in ⊢ (? (? ? %) ?) with ((S n2)*n2!); + rewrite > sym_times in ⊢ (? (? ? %) ?); + rewrite < assoc_times; + apply divides_times + [rewrite > sym_times;assumption + |apply reflexive_divides] + |rewrite < fact_minus in ⊢ (? (? ? %) ?) + [rewrite > sym_times in ⊢ (? (? ? %) ?); + rewrite < assoc_times; + apply divides_times + [rewrite < eq_plus_minus_minus_minus in Hletin1; + [rewrite > sym_times;rewrite < minus_n_n in Hletin1; + rewrite < plus_n_O in Hletin1;assumption + |lapply (le_S_S_to_le ? ? H2); + elim (le_to_or_lt_eq ? ? Hletin2); + [assumption + |elim (H3 H4)] + |constructor 1] + |apply reflexive_divides] + |lapply (le_S_S_to_le ? ? H2); + elim (le_to_or_lt_eq ? ? Hletin2); + [assumption + |elim (H3 H4)]]] + |apply le_S_S_to_le;assumption] + |apply le_minus_m;apply le_S_S_to_le;assumption] + |apply le_S_S_to_le;assumption]]]] +qed. + +theorem bc1: \forall n.\forall k. k < n \to bc (S n) (S k) = (bc n k) + (bc n (S k)). +intros.unfold bc. +rewrite > (lt_to_lt_to_eq_div_div_times_times ? ? (S k)) in ⊢ (? ? ? (? % ?)) + [rewrite > sym_times in ⊢ (? ? ? (? (? ? %) ?)). + rewrite < assoc_times in ⊢ (? ? ? (? (? ? %) ?)). + rewrite > (lt_to_lt_to_eq_div_div_times_times ? ? (n - k)) in ⊢ (? ? ? (? ? %)) + [rewrite > assoc_times in ⊢ (? ? ? (? ? (? ? %))). + rewrite > sym_times in ⊢ (? ? ? (? ? (? ? (? ? %)))). + rewrite > fact_minus + [rewrite < eq_div_plus + [rewrite < distr_times_plus. + simplify in ⊢ (? ? ? (? (? ? %) ?)). + rewrite > sym_plus in ⊢ (? ? ? (? (? ? (? %)) ?)). + rewrite < plus_minus_m_m + [rewrite > sym_times in ⊢ (? ? ? (? % ?)). + reflexivity + |apply lt_to_le. + assumption + ] + |rewrite > (times_n_O O). + apply lt_times;apply lt_O_fact + |change in ⊢ (? (? % ?) ?) with ((S k)*k!); + rewrite < sym_times in ⊢ (? ? %); + rewrite > assoc_times;apply divides_times + [apply reflexive_divides + |apply bc2;apply le_S_S_to_le;constructor 2;assumption] + |rewrite < fact_minus + [rewrite > sym_times in ⊢ (? (? ? %) ?);rewrite < assoc_times; + apply divides_times + [apply bc2;assumption + |apply reflexive_divides] + |assumption]] + |assumption] + |apply lt_to_lt_O_minus;assumption + |rewrite > (times_n_O O). + apply lt_times;apply lt_O_fact] +|apply lt_O_S +|rewrite > (times_n_O O). + apply lt_times;apply lt_O_fact] +qed. + +theorem exp_plus_sigma_p:\forall a,b,n. +exp (a+b) n = sigma_p (S n) (\lambda k.true) + (\lambda k.(bc n k)*(exp a (n-k))*(exp b k)). +intros.elim n + [simplify.reflexivity + |simplify in ⊢ (? ? % ?). + rewrite > true_to_sigma_p_Sn + [rewrite > H;rewrite > sym_times in ⊢ (? ? % ?); + rewrite > distr_times_plus in ⊢ (? ? % ?); + rewrite < minus_n_n in ⊢ (? ? ? (? (? (? ? (? ? %)) ?) ?)); + rewrite > sym_times in ⊢ (? ? (? % ?) ?); + rewrite > sym_times in ⊢ (? ? (? ? %) ?); + rewrite > distributive_times_plus_sigma_p in ⊢ (? ? (? % ?) ?); + rewrite > distributive_times_plus_sigma_p in ⊢ (? ? (? ? %) ?); + rewrite > true_to_sigma_p_Sn in ⊢ (? ? (? ? %) ?) + [rewrite < assoc_plus;rewrite < sym_plus in ⊢ (? ? (? % ?) ?); + rewrite > assoc_plus; + apply eq_f2 + [rewrite > sym_times;rewrite > assoc_times;autobatch paramodulation + |rewrite > (sigma_p_gi ? ? O); + [rewrite < (eq_sigma_p_gh ? S pred n1 (S n1) (λx:nat.true)) in ⊢ (? ? (? (? ? %) ?) ?) + [rewrite > (sigma_p_gi ? ? O) in ⊢ (? ? ? %); + [rewrite > assoc_plus;apply eq_f2 + [autobatch paramodulation; + |rewrite < sigma_p_plus_1; + rewrite < (eq_sigma_p_gh ? S pred n1 (S n1) (λx:nat.true)) in \vdash (? ? ? %); + [apply eq_sigma_p + [intros;reflexivity + |intros;rewrite > sym_times;rewrite > assoc_times; + rewrite > sym_times in ⊢ (? ? (? (? ? %) ?) ?); + rewrite > assoc_times;rewrite < assoc_times in ⊢ (? ? (? (? ? %) ?) ?); + rewrite > sym_times in ⊢ (? ? (? (? ? (? % ?)) ?) ?); + change in ⊢ (? ? (? (? ? (? % ?)) ?) ?) with (exp a (S (n1 - S x))); + rewrite < (minus_Sn_m ? ? H1);rewrite > minus_S_S; + rewrite > sym_times in \vdash (? ? (? ? %) ?); + rewrite > assoc_times; + rewrite > sym_times in ⊢ (? ? (? ? (? ? %)) ?); + change in \vdash (? ? (? ? (? ? %)) ?) with (exp b (S x)); + rewrite > assoc_times in \vdash (? ? (? ? %) ?); + rewrite > sym_times in \vdash (? ? (? % ?) ?); + rewrite > sym_times in \vdash (? ? (? ? %) ?); + rewrite > assoc_times in \vdash (? ? ? %); + rewrite > sym_times in \vdash (? ? ? %); + rewrite < distr_times_plus; + rewrite > sym_plus;rewrite < bc1; + [reflexivity|assumption]] + |intros;simplify;reflexivity + |intros;simplify;reflexivity + |intros;apply le_S_S;assumption + |intros;reflexivity + |intros 2;elim j + [simplify in H2;destruct H2 + |simplify;reflexivity] + |intro;elim j + [simplify in H2;destruct H2 + |simplify;apply le_S_S_to_le;assumption]]] + |apply le_S_S;apply le_O_n + |reflexivity] + |intros;simplify;reflexivity + |intros;simplify;reflexivity + |intros;apply le_S_S;assumption + |intros;reflexivity + |intros 2;elim j + [simplify in H2;destruct H2 + |simplify;reflexivity] + |intro;elim j + [simplify in H2;destruct H2 + |simplify;apply le_S_S_to_le;assumption]] + |apply le_S_S;apply le_O_n + |reflexivity]] + |reflexivity] + |reflexivity]] +qed. + +theorem exp_S_sigma_p:\forall a,n. +exp (S a) n = sigma_p (S n) (\lambda k.true) (\lambda k.(bc n k)*(exp a (n-k))). +intros. +rewrite > plus_n_SO. +rewrite > exp_plus_sigma_p. +apply eq_sigma_p;intros + [reflexivity + |rewrite < exp_SO_n. + rewrite < times_n_SO. + reflexivity + ] +qed. \ No newline at end of file diff --git a/matita/library/nat/chebyshev.ma b/matita/library/nat/chebyshev.ma new file mode 100644 index 000000000..9ee9e40b5 --- /dev/null +++ b/matita/library/nat/chebyshev.ma @@ -0,0 +1,1544 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/log.ma". +include "nat/pi_p.ma". +include "nat/factorization.ma". +include "nat/factorial2.ma". + +definition prim: nat \to nat \def +\lambda n. sigma_p (S n) primeb (\lambda p.(S O)). + +(* This is chebishev psi funcion *) +definition A: nat \to nat \def +\lambda n. pi_p (S n) primeb (\lambda p.exp p (log p n)). + +theorem le_Al1: \forall n. +A n \le pi_p (S n) primeb (\lambda p.n). +intro.unfold A. +cases n + [simplify.apply le_n + |apply le_pi_p. + intros. + apply le_exp_log. + apply lt_O_S + ] +qed. + +theorem le_Al: \forall n. +A n \le exp n (prim n). +intro.unfold prim. +rewrite < exp_sigma_p. +apply le_Al1. +qed. + +theorem leA_r2: \forall n. +exp n (prim n) \le A n * A n. +intro.unfold prim. +elim (le_to_or_lt_eq ? ? (le_O_n n)) + [rewrite < (exp_sigma_p (S n) n primeb). + unfold A. + rewrite < times_pi_p. + apply le_pi_p. + intros. + rewrite < exp_plus_times. + apply (trans_le ? (exp i (S(log i n)))) + [apply lt_to_le. + apply lt_exp_log. + apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + |apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |rewrite > plus_n_O. + simplify. + rewrite > plus_n_Sm. + apply le_plus_r. + apply lt_O_log + [assumption + |apply le_S_S_to_le. + apply H1 + ] + ] + ] + |rewrite < H. apply le_n + ] +qed. + +(* an equivalent formulation for psi *) +definition A': nat \to nat \def +\lambda n. pi_p (S n) primeb + (\lambda p.(pi_p (log p n) (\lambda i.true) (\lambda i.p))). + +theorem eq_A_A': \forall n.A n = A' n. +intro.unfold A.unfold A'. +apply eq_pi_p + [intros.reflexivity + |intros. + apply (trans_eq ? ? (exp x (sigma_p (log x n) (λi:nat.true) (λi:nat.(S O))))) + [apply eq_f.apply sym_eq.apply sigma_p_true + |apply sym_eq.apply exp_sigma_p + ] + ] +qed. + +theorem eq_pi_p_primeb_divides_b: \forall n,m. +pi_p n (\lambda p.primeb p \land divides_b p m) (\lambda p.exp p (ord m p)) += pi_p n primeb (\lambda p.exp p (ord m p)). +intro. +elim n + [reflexivity + |apply (bool_elim ? (primeb n1));intro + [rewrite > true_to_pi_p_Sn in ⊢ (? ? ? %) + [apply (bool_elim ? (divides_b n1 m));intro + [rewrite > true_to_pi_p_Sn + [apply eq_f. + apply H + |apply true_to_true_to_andb_true;assumption + ] + |rewrite > false_to_pi_p_Sn + [rewrite > not_divides_to_ord_O + [simplify in ⊢ (? ? ? (? % ?)). + rewrite > sym_times. + rewrite < times_n_SO. + apply H + |apply primeb_true_to_prime.assumption + |apply divides_b_false_to_not_divides. + assumption + ] + |rewrite > H1.rewrite > H2.reflexivity + ] + ] + |assumption + ] + |rewrite > false_to_pi_p_Sn + [rewrite > false_to_pi_p_Sn + [apply H + |assumption + ] + |rewrite > H1.reflexivity + ] + ] + ] +qed. + +theorem lt_max_to_pi_p_primeb: \forall q,m. O < m \to max m (\lambda i.primeb i \land divides_b i m) < q \to +m = pi_p q (\lambda i.primeb i \land divides_b i m) (\lambda p.exp p (ord m p)). +intro.elim q + [apply False_ind. + apply (not_le_Sn_O ? H1) + |apply (bool_elim ? (primeb n∧divides_b n m));intro + [rewrite > true_to_pi_p_Sn + [rewrite > (exp_ord n m) in ⊢ (? ? % ?) + [apply eq_f. + rewrite > (H (ord_rem m n)) + [apply eq_pi_p1 + [intros. + apply (bool_elim ? (primeb x));intro + [simplify. + apply (bool_elim ? (divides_b x (ord_rem m n)));intro + [apply sym_eq. + apply divides_to_divides_b_true + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply (trans_divides ? (ord_rem m n)) + [apply divides_b_true_to_divides. + assumption + |apply divides_ord_rem + [apply (trans_lt ? x) + [apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + |assumption + ] + |assumption + ] + ] + ] + |apply sym_eq. + apply not_divides_to_divides_b_false + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply ord_O_to_not_divides + [assumption + |apply primeb_true_to_prime. + assumption + |rewrite < (ord_ord_rem n) + [apply not_divides_to_ord_O + [apply primeb_true_to_prime. + assumption + |apply divides_b_false_to_not_divides. + assumption + ] + |assumption + |apply primeb_true_to_prime. + apply (andb_true_true ? ? H3) + |apply primeb_true_to_prime. + assumption + |assumption + ] + ] + ] + ] + |reflexivity + ] + |intros. + apply eq_f. + apply ord_ord_rem + [assumption + |apply primeb_true_to_prime. + apply (andb_true_true ? ? H3) + |apply primeb_true_to_prime. + apply (andb_true_true ? ? H5) + |assumption + ] + ] + |apply lt_O_ord_rem + [apply prime_to_lt_SO. + apply primeb_true_to_prime. + apply (andb_true_true ? ? H3) + |assumption + ] + |apply not_eq_to_le_to_lt + [elim (exists_max_forall_false (λi:nat.primeb i∧divides_b i (ord_rem m n)) (ord_rem m n)) + [elim H4. + intro.rewrite > H7 in H6.simplify in H6. + apply (not_divides_ord_rem m n) + [assumption + |apply prime_to_lt_SO. + apply primeb_true_to_prime. + apply (andb_true_true ? ? H3) + |apply divides_b_true_to_divides. + apply (andb_true_true_r ? ? H6) + ] + |elim H4.rewrite > H6. + apply lt_to_not_eq. + apply prime_to_lt_O. + apply primeb_true_to_prime. + apply (andb_true_true ? ? H3) + ] + |apply (trans_le ? (max m (λi:nat.primeb i∧divides_b i (ord_rem m n)))) + [apply le_to_le_max. + apply divides_to_le + [assumption + |apply divides_ord_rem + [apply prime_to_lt_SO. + apply primeb_true_to_prime. + apply (andb_true_true ? ? H3) + |assumption + ] + ] + |apply (trans_le ? (max m (λi:nat.primeb i∧divides_b i m))) + [apply le_max_f_max_g. + intros. + apply (bool_elim ? (primeb i));intro + [simplify. + apply divides_to_divides_b_true + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply (trans_divides ? (ord_rem m n)) + [apply divides_b_true_to_divides. + apply (andb_true_true_r ? ? H5) + |apply divides_ord_rem + [apply prime_to_lt_SO. + apply primeb_true_to_prime. + apply (andb_true_true ? ? H3) + |assumption + ] + ] + ] + |rewrite > H6 in H5. + assumption + ] + |apply le_S_S_to_le. + assumption + ] + ] + ] + ] + |apply prime_to_lt_SO. + apply primeb_true_to_prime. + apply (andb_true_true ? ? H3) + |assumption + ] + |assumption + ] + |elim (le_to_or_lt_eq ? ? H1) + [rewrite > false_to_pi_p_Sn + [apply H + [assumption + |apply false_to_lt_max + [apply (lt_to_le_to_lt ? (max m (λi:nat.primeb i∧divides_b i m))) + [apply lt_to_le. + apply lt_SO_max_prime. + assumption + |apply le_S_S_to_le. + assumption + ] + |assumption + |apply le_S_S_to_le. + assumption + ] + ] + |assumption + ] + |rewrite < H4. + rewrite < (pi_p_false (λp:nat.p\sup(ord (S O) p)) (S n) ) in ⊢ (? ? % ?). + apply eq_pi_p + [intros. + apply (bool_elim ? (primeb x));intro + [apply sym_eq. + change with (divides_b x (S O) =false). + apply not_divides_to_divides_b_false + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |intro. + apply (le_to_not_lt x (S O)) + [apply divides_to_le + [apply lt_O_S.assumption + |assumption + ] + |elim (primeb_true_to_prime ? H6). + assumption + ] + ] + |reflexivity + ] + |intros.reflexivity + ] + ] + ] + ] +qed. + +(* factorization of n into primes *) +theorem pi_p_primeb_divides_b: \forall n. O < n \to +n = pi_p (S n) (\lambda i.primeb i \land divides_b i n) (\lambda p.exp p (ord n p)). +intros. +apply lt_max_to_pi_p_primeb + [assumption + |apply le_S_S. + apply le_max_n + ] +qed. + +theorem pi_p_primeb: \forall n. O < n \to +n = pi_p (S n) primeb (\lambda p.exp p (ord n p)). +intros. +rewrite < eq_pi_p_primeb_divides_b. +apply pi_p_primeb_divides_b. +assumption. +qed. + +theorem le_ord_log: \forall n,p. O < n \to S O < p \to +ord n p \le log p n. +intros. +rewrite > (exp_ord p) in ⊢ (? ? (? ? %)) + [rewrite > log_exp + [apply le_plus_n_r + |assumption + |apply lt_O_ord_rem;assumption + ] + |assumption + |assumption + ] +qed. + +theorem sigma_p_divides_b: +\forall m,n,p. O < n \to prime p \to \lnot divides p n \to +m = sigma_p m (λi:nat.divides_b (p\sup (S i)) ((exp p m)*n)) (λx:nat.S O). +intro.elim m + [reflexivity + |simplify in ⊢ (? ? ? (? % ? ?)). + rewrite > true_to_sigma_p_Sn + [rewrite > sym_plus.rewrite < plus_n_SO. + apply eq_f. + rewrite > (H n1 p H1 H2 H3) in ⊢ (? ? % ?). + apply eq_sigma_p1 + [intros. + apply (bool_elim ? (divides_b (p\sup(S x)) (p\sup n*n1)));intro + [apply sym_eq. + apply divides_to_divides_b_true + [apply lt_O_exp. + apply prime_to_lt_O. + assumption + |apply (witness ? ? ((exp p (n - x))*n1)). + rewrite < assoc_times. + rewrite < exp_plus_times. + apply eq_f2 + [apply eq_f.simplify. + apply eq_f. + rewrite > sym_plus. + apply plus_minus_m_m. + apply lt_to_le.assumption + |reflexivity + ] + ] + |apply sym_eq. + apply False_ind. + apply (divides_b_false_to_not_divides ? ? H5). + apply (witness ? ? ((exp p (n - S x))*n1)). + rewrite < assoc_times. + rewrite < exp_plus_times. + apply eq_f2 + [apply eq_f. + rewrite > sym_plus. + apply plus_minus_m_m. + assumption + |reflexivity + ] + ] + |intros.reflexivity + ] + |apply divides_to_divides_b_true + [apply lt_O_exp. + apply prime_to_lt_O.assumption + |apply (witness ? ? n1).reflexivity + ] + ] + ] +qed. + +theorem sigma_p_divides_b1: +\forall m,n,p,k. O < n \to prime p \to \lnot divides p n \to m \le k \to +m = sigma_p k (λi:nat.divides_b (p\sup (S i)) ((exp p m)*n)) (λx:nat.S O). +intros. +lapply (prime_to_lt_SO ? H1) as H4. +lapply (prime_to_lt_O ? H1) as H5. +rewrite > (false_to_eq_sigma_p m k) + [apply sigma_p_divides_b;assumption + |assumption + |intros. + apply not_divides_to_divides_b_false + [apply lt_O_exp.assumption + |intro.apply (le_to_not_lt ? ? H6). + unfold lt. + rewrite < (ord_exp p) + [rewrite > (plus_n_O m). + rewrite < (not_divides_to_ord_O ? ? H1 H2). + rewrite < (ord_exp p ? H4) in ⊢ (? ? (? % ?)). + rewrite < ord_times + [apply divides_to_le_ord + [apply lt_O_exp.assumption + |rewrite > (times_n_O O). + apply lt_times + [apply lt_O_exp.assumption + |assumption + ] + |assumption + |assumption + ] + |apply lt_O_exp.assumption + |assumption + |assumption + ] + |assumption + ] + ] + ] +qed. + +theorem eq_ord_sigma_p: +\forall n,m,x. O < n \to prime x \to +exp x m \le n \to n < exp x (S m) \to +ord n x=sigma_p m (λi:nat.divides_b (x\sup (S i)) n) (λx:nat.S O). +intros. +lapply (prime_to_lt_SO ? H1). +rewrite > (exp_ord x n) in ⊢ (? ? ? (? ? (λi:?.? ? %) ?)) + [apply sigma_p_divides_b1 + [apply lt_O_ord_rem;assumption + |assumption + |apply not_divides_ord_rem;assumption + |apply lt_S_to_le. + apply (le_to_lt_to_lt ? (log x n)) + [apply le_ord_log;assumption + |apply (lt_exp_to_lt x) + [assumption + |apply (le_to_lt_to_lt ? n ? ? H3). + apply le_exp_log. + assumption + ] + ] + ] + |assumption + |assumption + ] +qed. + +theorem pi_p_primeb1: \forall n. O < n \to +n = pi_p (S n) primeb + (\lambda p.(pi_p (log p n) + (\lambda i.divides_b (exp p (S i)) n) (\lambda i.p))). +intros. +rewrite > (pi_p_primeb n H) in ⊢ (? ? % ?). +apply eq_pi_p1 + [intros.reflexivity + |intros. + rewrite > exp_sigma_p. + apply eq_f. + apply eq_ord_sigma_p + [assumption + |apply primeb_true_to_prime. + assumption + |apply le_exp_log.assumption + |apply lt_exp_log. + apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + ] + ] +qed. + +(* the factorial function *) +theorem eq_fact_pi_p:\forall n. fact n = +pi_p (S n) (\lambda i.leb (S O) i) (\lambda i.i). +intro.elim n + [reflexivity + |change with ((S n1)*n1! = pi_p (S (S n1)) (λi:nat.leb (S O) i) (λi:nat.i)). + rewrite > true_to_pi_p_Sn + [apply eq_f.assumption + |reflexivity + ] + ] +qed. + +theorem eq_sigma_p_div: \forall n,q.O < q \to +sigma_p (S n) (λm:nat.leb (S O) m∧divides_b q m) (λx:nat.S O) +=n/q. +intros. +apply (div_mod_spec_to_eq n q ? (n \mod q) ? (n \mod q)) + [apply div_mod_spec_intro + [apply lt_mod_m_m.assumption + |elim n + [simplify.elim q;reflexivity + |elim (or_div_mod1 n1 q) + [elim H2.clear H2. + rewrite > divides_to_mod_O + [rewrite < plus_n_O. + rewrite > true_to_sigma_p_Sn + [rewrite > H4 in ⊢ (? ? % ?). + apply eq_f2 + [rewrite < sym_plus. + rewrite < plus_n_SO. + apply eq_f. + apply (div_mod_spec_to_eq n1 q (div n1 q) (mod n1 q) ? (mod n1 q)) + [apply div_mod_spec_div_mod. + assumption + |apply div_mod_spec_intro + [apply lt_mod_m_m.assumption + |assumption + ] + ] + |reflexivity + ] + |apply true_to_true_to_andb_true + [reflexivity + |apply divides_to_divides_b_true;assumption + ] + ] + |assumption + |assumption + ] + |elim H2.clear H2. + rewrite > false_to_sigma_p_Sn + [rewrite > mod_S + [rewrite < plus_n_Sm. + apply eq_f. + assumption + |assumption + |elim (le_to_or_lt_eq (S (mod n1 q)) q) + [assumption + |apply False_ind. + apply H3. + apply (witness ? ? (S(div n1 q))). + rewrite < times_n_Sm. + rewrite < sym_plus. + rewrite < H2 in ⊢ (? ? ? (? ? %)). + rewrite > sym_times. + assumption + |apply lt_mod_m_m. + assumption + ] + ] + |rewrite > not_divides_to_divides_b_false + [rewrite < andb_sym in ⊢ (? ? % ?).reflexivity + |assumption + |assumption + ] + ] + |assumption + ] + ] + ] + |apply div_mod_spec_div_mod. + assumption + ] +qed. + +(* still another characterization of the factorial *) +theorem fact_pi_p: \forall n. fact n = +pi_p (S n) primeb + (\lambda p.(pi_p (log p n) + (\lambda i.true) (\lambda i.(exp p (n /(exp p (S i))))))). +intros. +rewrite > eq_fact_pi_p. +apply (trans_eq ? ? + (pi_p (S n) (λi:nat.leb (S O) i) + (λn.pi_p (S n) primeb + (\lambda p.(pi_p (log p n) + (\lambda i.divides_b (exp p (S i)) n) (\lambda i.p)))))) + [apply eq_pi_p1;intros + [reflexivity + |apply pi_p_primeb1. + apply leb_true_to_le.assumption + ] + |apply (trans_eq ? ? + (pi_p (S n) (λi:nat.leb (S O) i) + (λn:nat + .pi_p (S n) (\lambda p.primeb p\land leb p n) + (λp:nat.pi_p (log p n) (λi:nat.divides_b ((p)\sup(S i)) n) (λi:nat.p))))) + [apply eq_pi_p1 + [intros.reflexivity + |intros.apply eq_pi_p1 + [intros.elim (primeb x1) + [simplify.apply sym_eq. + apply le_to_leb_true. + apply le_S_S_to_le. + assumption + |reflexivity + ] + |intros.reflexivity + ] + ] + |apply (trans_eq ? ? + (pi_p (S n) (λi:nat.leb (S O) i) + (λm:nat + .pi_p (S n) (λp:nat.primeb p∧leb p m) + (λp:nat.pi_p (log p m) (λi:nat.divides_b ((p)\sup(S i)) m) (λi:nat.p))))) + [apply eq_pi_p1 + [intros.reflexivity + |intros. + apply sym_eq. + apply false_to_eq_pi_p + [assumption + |intros.rewrite > lt_to_leb_false + [elim primeb;reflexivity|assumption] + ] + ] + |(* make a general theorem *) + apply (trans_eq ? ? + (pi_p (S n) primeb + (λp:nat + .pi_p (S n) (λm.leb p m) + (λm:nat.pi_p (log p m) (λi:nat.divides_b ((p)\sup(S i)) m) (λi:nat.p))) + )) + [apply pi_p_pi_p1. + intros. + apply (bool_elim ? (primeb y \land leb y x));intros + [rewrite > (le_to_leb_true (S O) x) + [reflexivity + |apply (trans_le ? y) + [apply prime_to_lt_O. + apply primeb_true_to_prime. + apply (andb_true_true ? ? H2) + |apply leb_true_to_le. + apply (andb_true_true_r ? ? H2) + ] + ] + |elim (leb (S O) x);reflexivity + ] + |apply eq_pi_p1 + [intros.reflexivity + |intros. + apply (trans_eq ? ? + (pi_p (S n) (λm:nat.leb x m) + (λm:nat.pi_p (log x n) (λi:nat.divides_b (x\sup(S i)) m) (λi:nat.x)))) + [apply eq_pi_p1 + [intros.reflexivity + |intros. + apply sym_eq. + apply false_to_eq_pi_p + [apply le_log + [apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + |apply le_S_S_to_le. + assumption + ] + |intros. + apply not_divides_to_divides_b_false + [apply lt_O_exp. + apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |intro. + apply (lt_to_not_le x1 (exp x (S i))) + [apply (lt_to_le_to_lt ? (exp x (S(log x x1)))) + [apply lt_exp_log. + apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + |apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply le_S_S. + assumption + ] + ] + |apply divides_to_le + [apply (lt_to_le_to_lt ? x) + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply leb_true_to_le. + assumption + ] + |assumption + ] + ] + ] + ] + ] + |apply + (trans_eq ? ? + (pi_p (log x n) (λi:nat.true) + (λi:nat.pi_p (S n) (λm:nat.leb x m \land divides_b (x\sup(S i)) m) (λm:nat.x)))) + [apply (pi_p_pi_p1 (\lambda m,i.x)). + intros. + reflexivity + |apply eq_pi_p1 + [intros.reflexivity + |intros. + rewrite > exp_sigma_p. + apply eq_f. + apply (trans_eq ? ? + (sigma_p (S n) (λm:nat.leb (S O) m∧divides_b (x\sup(S x1)) m) (λx:nat.S O))) + [apply eq_sigma_p1 + [intros. + apply (bool_elim ? (divides_b (x\sup(S x1)) x2));intro + [apply (bool_elim ? (leb x x2));intro + [rewrite > le_to_leb_true + [reflexivity + |apply (trans_le ? x) + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply leb_true_to_le. + assumption + ] + ] + |rewrite > lt_to_leb_false + [reflexivity + |apply not_le_to_lt.intro. + apply (leb_false_to_not_le ? ? H6). + apply (trans_le ? (exp x (S x1))) + [rewrite > times_n_SO in ⊢ (? % ?). + change with (exp x (S O) \le exp x (S x1)). + apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply le_S_S.apply le_O_n. + ] + |apply divides_to_le + [assumption + |apply divides_b_true_to_divides. + assumption + ] + ] + ] + ] + |rewrite < andb_sym. + rewrite < andb_sym in ⊢ (? ? ? %). + reflexivity + ] + |intros.reflexivity + ] + |apply eq_sigma_p_div. + apply lt_O_exp. + apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + ] + ] + ] + ] + ] + ] + ] + ] + ] +qed. + +(* odd n is just mod n (S(S O)) +let rec odd n \def + match n with + [ O \Rightarrow O + | S m \Rightarrow (S O) - odd m + ]. + +theorem le_odd_SO: \forall n. odd n \le S O. +intro.elim n + [apply le_O_n + |simplify.cases (odd n1) + [simplify.apply le_n. + |apply le_O_n + ] + ] +qed. + +theorem SSO_odd: \forall n. n = (n/(S(S O)))*(S(S O)) + odd n. +intro.elim n + [apply (lt_O_n_elim ? H). + intro.simplify.reflexivity + | +*) + +theorem fact_pi_p2: \forall n. fact ((S(S O))*n) = +pi_p (S ((S(S O))*n)) primeb + (\lambda p.(pi_p (log p ((S(S O))*n)) + (\lambda i.true) (\lambda i.(exp p ((S(S O))*(n /(exp p (S i))))*(exp p (mod ((S(S O))*n /(exp p (S i))) (S(S O)))))))). +intros.rewrite > fact_pi_p. +apply eq_pi_p1 + [intros.reflexivity + |intros.apply eq_pi_p + [intros.reflexivity + |intros. + rewrite < exp_plus_times. + apply eq_f. + rewrite > sym_times in ⊢ (? ? ? (? % ?)). + apply SSO_mod. + apply lt_O_exp. + apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + ] + ] +qed. + +theorem fact_pi_p3: \forall n. fact ((S(S O))*n) = +pi_p (S ((S(S O))*n)) primeb + (\lambda p.(pi_p (log p ((S(S O))*n)) + (\lambda i.true) (\lambda i.(exp p ((S(S O))*(n /(exp p (S i))))))))* +pi_p (S ((S(S O))*n)) primeb + (\lambda p.(pi_p (log p ((S(S O))*n)) + (\lambda i.true) (\lambda i.(exp p (mod ((S(S O))*n /(exp p (S i))) (S(S O))))))). +intros. +rewrite < times_pi_p. +rewrite > fact_pi_p2. +apply eq_pi_p;intros + [reflexivity + |apply times_pi_p + ] +qed. + +theorem pi_p_primeb4: \forall n. S O < n \to +pi_p (S ((S(S O))*n)) primeb + (\lambda p.(pi_p (log p ((S(S O))*n)) + (\lambda i.true) (\lambda i.(exp p ((S(S O))*(n /(exp p (S i)))))))) += +pi_p (S n) primeb + (\lambda p.(pi_p (log p (S(S O)*n)) + (\lambda i.true) (\lambda i.(exp p ((S(S O))*(n /(exp p (S i)))))))). +intros. +apply or_false_eq_SO_to_eq_pi_p + [apply le_S_S. + apply le_times_n. + apply lt_O_S + |intros. + right. + rewrite > log_i_SSOn + [change with (i\sup((S(S O))*(n/i\sup(S O)))*(S O) = S O). + rewrite < times_n_SO. + rewrite > eq_div_O + [reflexivity + |simplify.rewrite < times_n_SO.assumption + ] + |assumption + |assumption + |apply le_S_S_to_le.assumption + ] + ] +qed. + +theorem pi_p_primeb5: \forall n. S O < n \to +pi_p (S ((S(S O))*n)) primeb + (\lambda p.(pi_p (log p ((S(S O))*n)) + (\lambda i.true) (\lambda i.(exp p ((S(S O))*(n /(exp p (S i)))))))) += +pi_p (S n) primeb + (\lambda p.(pi_p (log p n) + (\lambda i.true) (\lambda i.(exp p ((S(S O))*(n /(exp p (S i)))))))). +intros. +rewrite > (pi_p_primeb4 ? H). +apply eq_pi_p1;intros + [reflexivity + |apply or_false_eq_SO_to_eq_pi_p + [apply le_log + [apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + |apply le_times_n. + apply lt_O_S + ] + |intros.right. + rewrite > eq_div_O + [simplify.reflexivity + |apply (lt_to_le_to_lt ? (exp x (S(log x n)))) + [apply lt_exp_log. + apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + |apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply le_S_S. + assumption + ] + ] + ] + ] + ] +qed. + +theorem exp_fact_SSO: \forall n. +exp (fact n) (S(S O)) += +pi_p (S n) primeb + (\lambda p.(pi_p (log p n) + (\lambda i.true) (\lambda i.(exp p ((S(S O))*(n /(exp p (S i)))))))). +intros. +rewrite > fact_pi_p. +rewrite < exp_pi_p. +apply eq_pi_p;intros + [reflexivity + |apply sym_eq. + apply exp_times_pi_p + ] +qed. + +definition B \def +\lambda n. +pi_p (S n) primeb + (\lambda p.(pi_p (log p n) + (\lambda i.true) (\lambda i.(exp p (mod (n /(exp p (S i))) (S(S O))))))). + +theorem eq_fact_B:\forall n.S O < n \to +fact ((S(S O))*n) = exp (fact n) (S(S O)) * B((S(S O))*n). +intros. unfold B. +rewrite > fact_pi_p3. +apply eq_f2 + [apply sym_eq. + rewrite > pi_p_primeb5 + [apply exp_fact_SSO + |assumption + ] + |reflexivity + ] +qed. + +theorem le_B_A: \forall n. B n \le A n. +intro.unfold B. +rewrite > eq_A_A'. +unfold A'. +apply le_pi_p.intros. +apply le_pi_p.intros. +rewrite > exp_n_SO in ⊢ (? ? %). +apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply le_S_S_to_le. + apply lt_mod_m_m. + apply lt_O_S + ] +qed. + +theorem le_fact_A:\forall n.S O < n \to +fact ((S(S O))*n) \le exp (fact n) (S(S O)) * A ((S(S O))*n). +intros. +rewrite > eq_fact_B + [apply le_times_r. + apply le_B_A + |assumption + ] +qed. + +theorem lt_SO_to_le_B_exp: \forall n.S O < n \to +B ((S(S O))*n) \le exp (S(S O)) ((S(S O))*n). +intros. +apply (le_times_to_le (exp (fact n) (S(S O)))) + [apply lt_O_exp. + apply lt_O_fact + |rewrite < eq_fact_B + [rewrite < sym_times in ⊢ (? ? %). + rewrite > exp_SSO. + rewrite < assoc_times. + apply fact1 + |assumption + ] + ] +qed. + +theorem le_B_exp: \forall n. +B ((S(S O))*n) \le exp (S(S O)) ((S(S O))*n). +intro.cases n + [apply le_n + |cases n1 + [simplify.apply le_S.apply le_S.apply le_n + |apply lt_SO_to_le_B_exp. + apply le_S_S.apply lt_O_S. + ] + ] +qed. + +theorem lt_SO_to_le_exp_B: \forall n. S O < n \to +exp (S(S O)) ((S(S O))*n) \le (S(S O)) * n * B ((S(S O))*n). +intros. +apply (le_times_to_le (exp (fact n) (S(S O)))) + [apply lt_O_exp. + apply lt_O_fact + |rewrite < assoc_times in ⊢ (? ? %). + rewrite > sym_times in ⊢ (? ? (? % ?)). + rewrite > assoc_times in ⊢ (? ? %). + rewrite < eq_fact_B + [rewrite < sym_times. + apply fact3. + apply lt_to_le.assumption + |assumption + ] + ] +qed. + +theorem le_exp_B: \forall n. O < n \to +exp (S(S O)) ((S(S O))*n) \le (S(S O)) * n * B ((S(S O))*n). +intros. +elim H + [apply le_n + |apply lt_SO_to_le_exp_B. + apply le_S_S.assumption + ] +qed. + +theorem eq_A_SSO_n: \forall n.O < n \to +A((S(S O))*n) = + pi_p (S ((S(S O))*n)) primeb + (\lambda p.(pi_p (log p ((S(S O))*n) ) + (\lambda i.true) (\lambda i.(exp p (bool_to_nat (leb (S n) (exp p (S i)))))))) + *A n. +intro. +rewrite > eq_A_A'.rewrite > eq_A_A'. +unfold A'.intros. +cut ( + pi_p (S n) primeb (λp:nat.pi_p (log p n) (λi:nat.true) (λi:nat.p)) + = pi_p (S ((S(S O))*n)) primeb + (λp:nat.pi_p (log p ((S(S O))*n)) (λi:nat.true) (λi:nat.(p)\sup(bool_to_nat (\lnot (leb (S n) (exp p (S i)))))))) + [rewrite > Hcut. + rewrite < times_pi_p. + apply eq_pi_p1;intros + [reflexivity + |rewrite < times_pi_p. + apply eq_pi_p;intros + [reflexivity + |apply (bool_elim ? (leb (S n) (exp x (S x1))));intro + [simplify.rewrite < times_n_SO.apply times_n_SO + |simplify.rewrite < plus_n_O.apply times_n_SO + ] + ] + ] + |apply (trans_eq ? ? (pi_p (S n) primeb + (\lambda p:nat.pi_p (log p n) (\lambda i:nat.true) (\lambda i:nat.(p)\sup(bool_to_nat (¬leb (S n) (exp p (S i)))))))) + [apply eq_pi_p1;intros + [reflexivity + |apply eq_pi_p1;intros + [reflexivity + |rewrite > lt_to_leb_false + [simplify.apply times_n_SO + |apply le_S_S. + apply (trans_le ? (exp x (log x n))) + [apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |assumption + ] + |apply le_exp_log. + assumption + ] + ] + ] + ] + |apply (trans_eq ? ? + (pi_p (S ((S(S O))*n)) primeb + (λp:nat.pi_p (log p n) (λi:nat.true) + (λi:nat.(p)\sup(bool_to_nat (¬leb (S n) ((p)\sup(S i)))))))) + [apply sym_eq. + apply or_false_eq_SO_to_eq_pi_p + [apply le_S_S. + simplify. + apply le_plus_n_r + |intros.right. + rewrite > lt_to_log_O + [reflexivity + |assumption + |assumption + ] + ] + |apply eq_pi_p1;intros + [reflexivity + |apply sym_eq. + apply or_false_eq_SO_to_eq_pi_p + [apply le_log + [apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + |simplify. + apply le_plus_n_r + ] + |intros.right. + rewrite > le_to_leb_true + [simplify.reflexivity + |apply (lt_to_le_to_lt ? (exp x (S (log x n)))) + [apply lt_exp_log. + apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + |apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply le_S_S.assumption + ] + ] + ] + ] + ] + ] + ] + ] +qed. + +theorem le_A_BA1: \forall n. O < n \to +A((S(S O))*n) \le B((S(S O))*n)*A n. +intros. +rewrite > eq_A_SSO_n + [apply le_times_l. + unfold B. + apply le_pi_p.intros. + apply le_pi_p.intros. + apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply (bool_elim ? (leb (S n) (exp i (S i1))));intro + [simplify in ⊢ (? % ?). + cut ((S(S O))*n/i\sup(S i1) = S O) + [rewrite > Hcut.apply le_n + |apply (div_mod_spec_to_eq + ((S(S O))*n) (exp i (S i1)) + ? (mod ((S(S O))*n) (exp i (S i1))) + ? (minus ((S(S O))*n) (exp i (S i1))) ) + [apply div_mod_spec_div_mod. + apply lt_O_exp. + apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |cut (i\sup(S i1)≤(S(S O))*n) + [apply div_mod_spec_intro + [apply lt_plus_to_lt_minus + [assumption + |simplify in ⊢ (? % ?). + rewrite < plus_n_O. + apply lt_plus + [apply leb_true_to_le.assumption + |apply leb_true_to_le.assumption + ] + ] + |rewrite > sym_plus. + rewrite > sym_times in ⊢ (? ? ? (? ? %)). + rewrite < times_n_SO. + apply plus_minus_m_m. + assumption + ] + |apply (trans_le ? (exp i (log i ((S(S O))*n)))) + [apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |assumption + ] + |apply le_exp_log. + rewrite > (times_n_O O) in ⊢ (? % ?). + apply lt_times + [apply lt_O_S + |assumption + ] + ] + ] + ] + ] + |apply le_O_n + ] + ] + |assumption + ] +qed. + +theorem le_A_BA: \forall n. A((S(S O))*n) \le B((S(S O))*n)*A n. +intros.cases n + [apply le_n + |apply le_A_BA1.apply lt_O_S + ] +qed. + +theorem le_A_exp: \forall n. +A((S(S O))*n) \le (exp (S(S O)) ((S(S O)*n)))*A n. +intro. +apply (trans_le ? (B((S(S O))*n)*A n)) + [apply le_A_BA + |apply le_times_l. + apply le_B_exp + ] +qed. + +theorem le_A_exp1: \forall n. +A(exp (S(S O)) n) \le (exp (S(S O)) ((S(S O))*(exp (S(S O)) n))). +intro.elim n + [simplify.apply le_S_S.apply le_O_n + |change with (A ((S(S O))*((S(S O)))\sup n1)≤ ((S(S O)))\sup((S(S O))*((S(S O))\sup(S n1)))). + apply (trans_le ? ((exp (S(S O)) ((S(S O)*(exp (S(S O)) n1))))*A (exp (S(S O)) n1))) + [apply le_A_exp + |apply (trans_le ? ((S(S O))\sup((S(S O))*((S(S O)))\sup(n1))*(S(S O))\sup((S(S O))*((S(S O)))\sup(n1)))) + [apply le_times_r. + assumption + |rewrite < exp_plus_times. + simplify.rewrite < plus_n_O in ⊢ (? ? (? ? (? ? %))). + apply le_n + ] + ] + ] +qed. + +theorem monotonic_A: monotonic nat le A. +unfold.intros. +elim H + [apply le_n + |apply (trans_le ? (A n1)) + [assumption + |unfold A. + cut (pi_p (S n1) primeb (λp:nat.(p)\sup(log p n1)) + ≤pi_p (S n1) primeb (λp:nat.(p)\sup(log p (S n1)))) + [apply (bool_elim ? (primeb (S n1)));intro + [rewrite > (true_to_pi_p_Sn ? ? ? H3). + rewrite > times_n_SO in ⊢ (? % ?). + rewrite > sym_times. + apply le_times + [apply lt_O_exp.apply lt_O_S + |assumption + ] + |rewrite > (false_to_pi_p_Sn ? ? ? H3). + assumption + ] + |apply le_pi_p.intros. + apply le_exp + [apply prime_to_lt_O. + apply primeb_true_to_prime. + assumption + |apply le_log + [apply prime_to_lt_SO. + apply primeb_true_to_prime. + assumption + |apply le_S.apply le_n + ] + ] + ] + ] + ] +qed. + +theorem le_A_exp2: \forall n. O < n \to +A(n) \le (exp (S(S O)) ((S(S O)) * (S(S O)) * n)). +intros. +apply (trans_le ? (A (exp (S(S O)) (S(log (S(S O)) n))))) + [apply monotonic_A. + apply lt_to_le. + apply lt_exp_log. + apply le_n + |apply (trans_le ? ((exp (S(S O)) ((S(S O))*(exp (S(S O)) (S(log (S(S O)) n))))))) + [apply le_A_exp1 + |apply le_exp + [apply lt_O_S + |rewrite > assoc_times.apply le_times_r. + change with ((S(S O))*((S(S O))\sup(log (S(S O)) n))≤(S(S O))*n). + apply le_times_r. + apply le_exp_log. + assumption + ] + ] + ] +qed. + +(* example *) +theorem A_SO: A (S O) = S O. +reflexivity. +qed. + +theorem A_SSO: A (S(S O)) = S (S O). +reflexivity. +qed. + +theorem A_SSSO: A (S(S(S O))) = S(S(S(S(S(S O))))). +reflexivity. +qed. + +theorem A_SSSSO: A (S(S(S(S O)))) = S(S(S(S(S(S(S(S(S(S(S(S O))))))))))). +reflexivity. +qed. + +(* da spostare *) +theorem or_eq_eq_S: \forall n.\exists m. +n = (S(S O))*m \lor n = S ((S(S O))*m). +intro.elim n + [apply (ex_intro ? ? O). + left.reflexivity + |elim H.elim H1 + [apply (ex_intro ? ? a). + right.apply eq_f.assumption + |apply (ex_intro ? ? (S a)). + left.rewrite > H2. + apply sym_eq. + apply times_SSO + ] + ] +qed. + +(* a better result *) +theorem le_A_exp3: \forall n. S O < n \to +A(n) \le exp (pred n) (S(S O))*(exp (S(S O)) ((S(S O)) * n)). +intro. +apply (nat_elim1 n). +intros. +elim (or_eq_eq_S m). +elim H2 + [elim (le_to_or_lt_eq (S O) a) + [rewrite > H3 in ⊢ (? % ?). + apply (trans_le ? ((exp (S(S O)) ((S(S O)*a)))*A a)) + [apply le_A_exp + |apply (trans_le ? (((S(S O)))\sup((S(S O))*a)* + ((pred a)\sup((S(S O)))*((S(S O)))\sup((S(S O))*a)))) + [apply le_times_r. + apply H + [rewrite > H3. + rewrite > times_n_SO in ⊢ (? % ?). + rewrite > sym_times. + apply lt_times_l1 + [apply lt_to_le.assumption + |apply le_n + ] + |assumption + ] + |rewrite > sym_times. + rewrite > assoc_times. + rewrite < exp_plus_times. + apply (trans_le ? + (pred a\sup((S(S O)))*(S(S O))\sup(S(S O))*(S(S O))\sup((S(S O))*m))) + [rewrite > assoc_times. + apply le_times_r. + rewrite < exp_plus_times. + apply le_exp + [apply lt_O_S + |rewrite < H3. + simplify. + rewrite < plus_n_O. + apply le_S.apply le_S. + apply le_n + ] + |apply le_times_l. + rewrite > times_exp. + apply monotonic_exp1. + rewrite > H3. + rewrite > sym_times. + cases a + [apply le_n + |simplify. + rewrite < plus_n_Sm. + apply le_S. + apply le_n + ] + ] + ] + ] + |rewrite < H4 in H3. + simplify in H3. + rewrite > H3. + simplify. + apply le_S_S.apply le_S_S.apply le_O_n + |apply not_lt_to_le.intro. + apply (lt_to_not_le ? ? H1). + rewrite > H3. + apply (le_n_O_elim a) + [apply le_S_S_to_le.assumption + |apply le_O_n + ] + ] + |elim (le_to_or_lt_eq O a (le_O_n ?)) + [apply (trans_le ? (A ((S(S O))*(S a)))) + [apply monotonic_A. + rewrite > H3. + rewrite > times_SSO. + apply le_n_Sn + |apply (trans_le ? ((exp (S(S O)) ((S(S O)*(S a))))*A (S a))) + [apply le_A_exp + |apply (trans_le ? (((S(S O)))\sup((S(S O))*S a)* + (a\sup((S(S O)))*((S(S O)))\sup((S(S O))*(S a))))) + [apply le_times_r. + apply H + [rewrite > H3. + apply le_S_S. + simplify. + rewrite > plus_n_SO. + apply le_plus_r. + rewrite < plus_n_O. + assumption + |apply le_S_S.assumption + ] + |rewrite > sym_times. + rewrite > assoc_times. + rewrite < exp_plus_times. + apply (trans_le ? + (a\sup((S(S O)))*(S(S O))\sup(S(S O))*(S(S O))\sup((S(S O))*m))) + [rewrite > assoc_times. + apply le_times_r. + rewrite < exp_plus_times. + apply le_exp + [apply lt_O_S + |rewrite > times_SSO. + rewrite < H3. + simplify. + rewrite < plus_n_Sm. + rewrite < plus_n_O. + apply le_n + ] + |apply le_times_l. + rewrite > times_exp. + apply monotonic_exp1. + rewrite > H3. + rewrite > sym_times. + apply le_n + ] + ] + ] + ] + |rewrite < H4 in H3.simplify in H3. + apply False_ind. + apply (lt_to_not_le ? ? H1). + rewrite > H3. + apply le_n + ] + ] +qed. + +theorem eq_sigma_pi_SO_n: \forall n. +sigma_p n (\lambda i.true) (\lambda i.S O) = n. +intro.elim n + [reflexivity + |rewrite > true_to_sigma_p_Sn + [rewrite > H.reflexivity + |reflexivity + ] + ] +qed. + +theorem leA_prim: \forall n. +exp n (prim n) \le A n * pi_p (S n) primeb (λp:nat.p). +intro. +unfold prim. +rewrite < (exp_sigma_p (S n) n primeb). +unfold A. +rewrite < times_pi_p. +apply le_pi_p. +intros. +rewrite > sym_times. +change in ⊢ (? ? %) with (exp i (S (log i n))). +apply lt_to_le. +apply lt_exp_log. +apply prime_to_lt_SO. +apply primeb_true_to_prime. +assumption. +qed. + + +(* the inequalities *) +theorem le_exp_priml: \forall n. O < n \to +exp (S(S O)) ((S(S O))*n) \le exp ((S(S O))*n) (S(prim ((S(S O))*n))). +intros. +apply (trans_le ? ((((S(S O))*n*(B ((S(S O))*n)))))) + [apply le_exp_B.assumption + |change in ⊢ (? ? %) with ((((S(S O))*n))*(((S(S O))*n))\sup (prim ((S(S O))*n))). + apply le_times_r. + apply (trans_le ? (A ((S(S O))*n))) + [apply le_B_A + |apply le_Al + ] + ] +qed. + +theorem le_priml: \forall n. O < n \to +(S(S O))*n \le (S (log (S(S O)) ((S(S O))*n)))*S(prim ((S(S O))*n)). +intros. +rewrite < (eq_log_exp (S(S O))) in ⊢ (? % ?) + [apply (trans_le ? ((log (S(S O)) (exp ((S(S O))*n) (S(prim ((S(S O))*n))))))) + [apply le_log + [apply le_n + |apply le_exp_priml.assumption + ] + |rewrite > sym_times in ⊢ (? ? %). + apply log_exp1. + apply le_n + ] + |apply le_n + ] +qed. + +theorem le_exp_primr: \forall n. S O < n \to +exp n (prim n) \le exp (pred n) ((S(S O))*(S(S O)))*(exp (S(S O)) ((S(S O))*(S(S O)) * n)). +intros. +apply (trans_le ? (exp (A n) (S(S O)))) + [change in ⊢ (? ? %) with ((A n)*((A n)*(S O))). + rewrite < times_n_SO. + apply leA_r2 + |apply (trans_le ? (exp (exp (pred n) (S(S O))*(exp (S(S O)) ((S(S O)) * n))) (S(S O)))) + [apply monotonic_exp1. + apply le_A_exp3. + assumption + |rewrite < times_exp. + rewrite > exp_exp_times. + rewrite > exp_exp_times. + rewrite > sym_times in ⊢ (? (? ? (? ? %)) ?). + rewrite < assoc_times in ⊢ (? (? ? (? ? %)) ?). + apply le_n + ] + ] +qed. + diff --git a/matita/library/nat/chebyshev_thm.ma b/matita/library/nat/chebyshev_thm.ma new file mode 100644 index 000000000..40e5f57bc --- /dev/null +++ b/matita/library/nat/chebyshev_thm.ma @@ -0,0 +1,345 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "nat/neper.ma". + +definition C \def \lambda n.pi_p (S n) primeb + (\lambda p.match (leb (p*p) n) with + [ true => p + | false => S (n/p) ]). + +theorem asdasd : \forall n. exp n (prim n) \leq (A n)*(C n). +intro;unfold prim;rewrite < exp_sigma_p;unfold A;unfold C;rewrite < times_pi_p; +apply le_pi_p;intros; +apply (bool_elim ? (leb (i*i) n));intro + [change in \vdash (? ? (? ? %)) with i; + rewrite > sym_times;change in \vdash (? ? %) with (exp i (S (log i n))); + apply lt_to_le;apply lt_exp_log;apply prime_to_lt_SO; + apply primeb_true_to_prime;assumption + |change in \vdash (? ? (? ? %)) with (S (n/i)); + cut (log i n = S O) + [rewrite > Hcut;rewrite < exp_n_SO; + apply lt_to_le;rewrite > sym_times;apply lt_div_S;apply prime_to_lt_O; + apply primeb_true_to_prime;assumption + |apply antisymmetric_le + [apply le_S_S_to_le;apply not_le_to_lt;intro; + apply (leb_false_to_not_le ? ? H2);apply (trans_le ? (exp i (log i n))) + [rewrite < exp_SSO;apply le_exp; + [apply prime_to_lt_O; + apply primeb_true_to_prime;assumption + |assumption] + |apply le_exp_log;apply (trans_le ? i) + [apply prime_to_lt_O;apply primeb_true_to_prime;assumption + |apply le_S_S_to_le;assumption]] + |apply (trans_le ? (log i i)) + [rewrite > log_n_n; + [apply le_n + |apply prime_to_lt_SO;apply primeb_true_to_prime;assumption] + |apply le_log + [apply prime_to_lt_SO;apply primeb_true_to_prime;assumption + |apply le_S_S_to_le;assumption]]]]] +qed. + +definition theta_pi \def + \lambda n.pi_p (S n) primeb (\lambda p.p). + +definition C1 \def + \lambda n. pi_p (S n) (\lambda x. (primeb x) \land (leb (x*x) n)) (\lambda p.p). + +definition C2 \def + \lambda n. pi_p (S n) (\lambda x. (primeb x) \land (leb (S n) (x*x))) (\lambda p.S (n/p)). + + +theorem jj : \forall n.C n = C1 n * C2 n. +intro;unfold C;unfold C1;unfold C2; +cut (\forall m.pi_p (S n) primeb +(λp:nat + .match leb (p*p) m in bool return λb:bool.nat with  + [true⇒p|false⇒S (m/p)]) +=pi_p (S n) (λx:nat.primeb x∧leb (x*x) m) (λp:nat.p) + *pi_p (S n) (λx:nat.primeb x∧leb (S m) (x*x)) (λp:nat.S (m/p))) + [apply Hcut; + |intro;elim n 0 + [simplify;reflexivity + |intro;apply (bool_elim ? (primeb (S n1))) + [intros;rewrite > true_to_pi_p_Sn + [apply (bool_elim ? (leb ((S n1)*(S n1)) m)) + [intro;rewrite > true_to_pi_p_Sn in \vdash (? ? ? (? % ?)) + [rewrite > false_to_pi_p_Sn in \vdash (? ? ? (? ? %)) + [rewrite > H1;rewrite > H2;rewrite < assoc_times;reflexivity + |rewrite > H;lapply (leb_true_to_le ? ? H2); + lapply (le_to_not_lt ? ? Hletin); + apply (bool_elim ? (leb (S m) (S n1 * S n1))) + [intro;apply False_ind;apply Hletin1; + apply leb_true_to_le;assumption + |intro;reflexivity]] + |rewrite > H2;rewrite > H;reflexivity] + |intro;rewrite > false_to_pi_p_Sn in \vdash (? ? ? (? % ?)) + [rewrite > true_to_pi_p_Sn in \vdash (? ? ? (? ? %)) + [rewrite > H1;rewrite < assoc_times; + rewrite > sym_times in \vdash (? ? (? % ?) ?); + rewrite > assoc_times;reflexivity + |rewrite > H; + change in \vdash (? ? % ?) with (leb (S m) (S n1* S n1)); + apply le_to_leb_true;apply not_le_to_lt; + apply leb_false_to_not_le;assumption] + |rewrite > H;rewrite > H2;reflexivity]] + |assumption] + |intros;rewrite > false_to_pi_p_Sn + [rewrite > false_to_pi_p_Sn in \vdash (? ? ? (? % ?)) + [rewrite > false_to_pi_p_Sn in \vdash (? ? ? (? ? %)) + [rewrite > H1;reflexivity + |rewrite > H;elim (leb (S m) (S n1*S n1));simplify;reflexivity] + |rewrite > H;elim (leb (S n1*S n1) m);simplify;reflexivity] + |assumption]]]] +qed. + +theorem log_pi_p : \forall n,b,f,g.S O < b \to + log b (pi_p n f g) \leq + (sigma_p n f (\lambda x.S O)) + (sigma_p n f (\lambda x.log b (g x))). +intros;elim n + [simplify;rewrite < times_n_SO;apply (leb_elim b (S O)) + [intro;elim (lt_to_not_le ? ? H);assumption + |intro;simplify;apply le_n] + |apply (bool_elim ? (f n1)) + [intro;rewrite > true_to_pi_p_Sn + [rewrite > true_to_sigma_p_Sn + [rewrite > true_to_sigma_p_Sn + [apply (trans_le ? (S ((log b (g n1)) + (log b (pi_p n1 f g))))) + [apply log_times;assumption + |rewrite > assoc_plus; + change in \vdash (? ? %) with (S (sigma_p n1 f (\lambda x.S O)+(log b (g n1)+sigma_p n1 f (\lambda x.log b (g x))))); + apply le_S_S;rewrite < assoc_plus; + rewrite > sym_plus in \vdash (? ? (? % ?)); + rewrite > assoc_plus;apply le_plus; + [apply le_n]]]]] + assumption + |intro;rewrite > false_to_pi_p_Sn + [rewrite > false_to_sigma_p_Sn + [rewrite > false_to_sigma_p_Sn]] + assumption]] +qed. + +axiom daemon : False. +(* +lemma lt_log_to_lt : \forall b,m,n.S O < b \to log b m < log b n \to m < n. +intros;apply not_le_to_lt;intro;elim (le_to_not_lt ? ? (le_log ? ? ? H H2)); +assumption. +qed. + +theorem ababbs: \forall n,a,b.S O < b \to O < n \to n < exp b a \to log b n < a. +intros;unfold log;apply not_le_to_lt;intro;apply (lt_to_not_le ? ? H2); +elim (le_to_or_lt_eq ? ? H3) + [apply lt_to_le;apply (lt_log_to_lt b ? ? H);rewrite > eq_log_exp;assumption + |apply (trans_le ? (exp b (log b n))) + [rewrite < H4;apply le_n + |apply le_exp_log;assumption]] +qed. + +theorem exp_exp_to_log : \forall b,n,k.S O < b \to +exp b k \leq n \to n < exp b (S k) \to log b n = k. +intros;unfold log;lapply (ababbs ? ? ? H ? H2) + [apply (trans_le ? ? ? ? H1);apply lt_O_exp + |unfold log in Hletin;lapply (le_to_leb_true ? ? H1); + lapply (f_m_to_le_max (λx:nat.leb ((b)\sup(x)) n) n ? ? Hletin1) + [ + elim (le_to_or_lt_eq ? ? (le_S_S_to_le ? ? Hletin)) + [unfold log in H3; +]]elim daemon. +qed. + +theorem xxx_log : \forall a,b.S O < b \to O < a \to log b (b*a) = S (log b a). +intros 3;elim a + [elim (not_le_Sn_O ? H1); + |apply (inj_exp_r b) + [assumption + |*) + +theorem le_log_C2_sigma_p : \forall n,b. S O < b \to +log b (C2 n) \leq +(sigma_p (S n) (\lambda x.(primeb x) \land (leb (S n) (x*x))) (\lambda x.S O)) + +(prim n + (((sigma_p n (\lambda x.leb (S n) (x*x)) (\lambda i.prim i * S (n!/i))) + *(S (log b 3)))/n!)). +intros;unfold C2; +apply (trans_le ? (sigma_p (S n) (λx:nat.primeb x∧leb (S n) (x*x)) (λx:nat.1) ++sigma_p (S n) (λx:nat.primeb x∧leb (S n) (x*x)) + (λi.log b (S (n/i))))) + [apply log_pi_p;assumption + |apply le_plus + [apply le_n + |apply (trans_le ? (sigma_p (S n) (λx:nat.primeb x∧leb (S n) (x*x)) (λi:nat.S (log b (n/i))))) + [apply le_sigma_p;intros;cut (log b (b*(n/i)) = S (log b (n/i))) + [rewrite < Hcut;apply le_log + [assumption + |elim H + [rewrite < times_SSO_n;change in \vdash (? % ?) with (S O + (n/i)); + apply le_plus; + [apply le_times_to_le_div + [apply (prime_to_lt_O i (primeb_true_to_prime ? (andb_true_true ? ? H2))); + |rewrite < times_n_SO;apply le_S_S_to_le;assumption] + |apply le_n] + |apply (trans_le ? ? ? H4);apply le_times_l;apply le_S;apply le_n]] + |rewrite > exp_n_SO in ⊢ (? ? (? ? (? % ?)) ?); + rewrite > log_exp; + [reflexivity + |assumption + |apply le_times_to_le_div; + [apply (prime_to_lt_O i (primeb_true_to_prime ? (andb_true_true ? ? H2))); + |rewrite < times_n_SO;apply le_S_S_to_le;assumption]]] + |change in ⊢ (? (? ? ? (λi:?.%)) ?) with ((S O) + (log b (n/i))); + rewrite > (sigma_p_plus_1 ? (\lambda x.S O)); + apply le_plus + [unfold prim;apply le_sigma_p1;intros;elim (leb (S n) (i*i)); + [rewrite > andb_sym;apply le_n + |rewrite > andb_sym;apply le_O_n] + |apply sigma_p_log_div;assumption]]]] +qed. + +lemma le_prim_n_stima : \forall n,b. S O < b \to b \leq n \to +prim n \leq (S (((S (S (S (S O))))*(S (log b (pred n)))) + + ((S (S (S (S O))))*n)))/(log b n). +(* la stima del secondo addendo è ottenuta considerando che + logreale 2 è sempre <= 1 (si dimostra per casi: b = 2, b > 2) *) +intros;apply le_times_to_le_div; + [apply lt_O_log; + [apply (trans_le ? b) + [apply lt_to_le;assumption + |assumption] + |assumption] + |apply (trans_le ? (log b (exp n (prim n)))) + [rewrite > sym_times;apply log_exp2 + [assumption + |apply (trans_le ? b ? ? H1);apply lt_to_le;assumption] + |apply (trans_le ? (log b ((exp (pred n) (S (S (S (S O))))) + *(exp (S (S O)) ((S (S (S (S O))))*n))))) + [apply le_log + [assumption + |apply le_exp_primr;apply (trans_le ? ? ? H H1)] + |apply (trans_le ? (S ((log b (exp (pred n) (S (S (S (S O)))))) + + (log b (exp (S (S O)) ((S (S (S (S O))))*n)))))) + [apply log_times;assumption + |apply le_S_S;apply le_plus + [apply log_exp1;assumption + |cases H + [rewrite > times_n_SO in \vdash (? (? ? %) ?); + rewrite > log_exp + [rewrite < plus_n_O;apply le_n + |apply le_n + |apply le_n] + |apply (trans_le ? (((S (S (S (S O))))*n)*(S (log (S m) (S (S O)))))) + [apply log_exp1;apply le_S;assumption + |rewrite > times_n_SO in \vdash (? ? %); + apply le_times_r;apply le_S_S; + rewrite > lt_to_log_O + [apply le_n + |apply lt_O_S + |apply le_S_S;assumption]]]]]]]] +qed. + +(* + +theorem le_log_C2_stima : \forall n,b. S O < b \to +log b (C2 n) \leq +(sigma_p (S n) (\lambda x.(primeb x) \land (leb (S n) (x*x))) (\lambda x.S O)) + +(((S (((S (S (S (S O))))*(S (log b (pred n)))) + + ((S (S (S (S O))))*n)))/(log b n)) + + (((sigma_p n (\lambda x.leb (S n) (x*x)) + (\lambda i.((S (((S (S (S (S O))))*(S (log b (pred n)))) + + ((S (S (S (S O))))*n)))/(log b n))* S (n!/i))) + *(S (log b 3)))/n!)). +elim daemon. + +theorem le_log_C2_sigma_p : \forall n,b. S O < b \to +log b (C2 n) \leq +(sigma_p (S n) (\lambda x.(primeb x) \land (leb (S n) (x*x))) (\lambda x.S O)) + +(sigma_p (S n) (\lambda x.(primeb x) \land (leb (S n) (x*x))) + (\lambda p.(sigma_p (n+p) (\lambda i.leb p i) + (\lambda i.S ((n+p)!/i*(S (log b 3)))))/(n+p)!)). +intros;unfold C2; +apply (trans_le ? (sigma_p (S n) (λx:nat.primeb x∧leb (S n) (x*x)) (λx:nat.1) ++sigma_p (S n) (λx:nat.primeb x∧leb (S n) (x*x)) + (λi.log b (S (n/i))))) + [apply log_pi_p;assumption + |apply le_plus + [apply le_n + |apply le_sigma_p;intros;cut (S (n/i) = (n+i)/i) + [rewrite > Hcut;apply le_log_div_sigma_p + [assumption + |apply prime_to_lt_O;apply primeb_true_to_prime; + elim (and_true ? ? H2);assumption + |apply le_plus_n + |apply le_n] + |lapply (prime_to_lt_O i (primeb_true_to_prime ? (andb_true_true ? ? H2))) as H3; + apply (div_mod_spec_to_eq (n+i) i (S (n/i)) (n \mod i) ? ((n+i) \mod i)) + [constructor 1 + [apply lt_mod_m_m;assumption + |simplify;rewrite > assoc_plus;rewrite < div_mod; + [apply sym_plus + |assumption]] + |apply div_mod_spec_div_mod;assumption]]]] +qed. +*) + +definition sqrt \def + \lambda n.max n (\lambda x.leb (x*x) n). + +theorem le_sqrt_to_le_times_l : \forall m,n.n \leq sqrt m \to n*n \leq m. +intros;apply (trans_le ? (sqrt m * sqrt m)) + [apply le_times;assumption + |apply leb_true_to_le;apply (f_max_true (λx:nat.leb (x*x) m) m); + apply (ex_intro ? ? O);split + [apply le_O_n + |simplify;reflexivity]] +qed. + +theorem le_sqrt_to_le_times_r : \forall m,n.sqrt m < n \to m < n*n. +intros;apply not_le_to_lt;intro; +apply ((leb_false_to_not_le ? ? + (lt_max_to_false (\lambda x.leb (x*x) m) m n H ?)) + H1); +apply (trans_le ? ? ? ? H1);cases n + [apply le_n + |rewrite > times_n_SO in \vdash (? % ?);rewrite > sym_times;apply le_times + [apply le_S_S;apply le_O_n + |apply le_n]] +qed. + +theorem eq_theta_pi_sqrt_C1 : \forall n. theta_pi (sqrt n) = C1 n. +intro;unfold theta_pi;unfold C1;rewrite > (false_to_eq_pi_p (S (sqrt n)) (S n)) + [generalize in match (le_sqrt_to_le_times_l n);elim (sqrt n) + [simplify;reflexivity + |apply (bool_elim ? (primeb (S n1))) + [intro;rewrite > true_to_pi_p_Sn + [rewrite > true_to_pi_p_Sn in \vdash (? ? ? %) + [apply eq_f2 + [reflexivity + |apply H;intros;apply H1;apply le_S;assumption] + |apply (andb_elim (primeb (S n1)) (leb (S n1 * S n1) n)); + rewrite > H2;whd;apply le_to_leb_true;apply H1;apply le_n] + |assumption] + |intro;rewrite > false_to_pi_p_Sn + [rewrite > false_to_pi_p_Sn in \vdash (? ? ? %) + [apply H;intros;apply H1;apply le_S;assumption + |apply (andb_elim (primeb (S n1)) (leb (S n1 * S n1) n)); + rewrite > H2;whd;reflexivity] + |assumption]]] + |apply le_S_S;unfold sqrt;apply le_max_n + |intros;apply (andb_elim (primeb i) (leb (i*i) n));elim (primeb i);simplify + [rewrite > lt_to_leb_false + [reflexivity + |apply le_sqrt_to_le_times_r;assumption] + |reflexivity]] +qed. diff --git a/matita/library/nat/chinese_reminder.ma b/matita/library/nat/chinese_reminder.ma new file mode 100644 index 000000000..31f2f0160 --- /dev/null +++ b/matita/library/nat/chinese_reminder.ma @@ -0,0 +1,249 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/exp.ma". +include "nat/gcd.ma". +include "nat/permutation.ma". +include "nat/congruence.ma". + +theorem and_congruent_congruent: \forall m,n,a,b:nat. O < n \to O < m \to +gcd n m = (S O) \to ex nat (\lambda x. congruent x a m \land congruent x b n). +intros. +cut (\exists c,d.c*n - d*m = (S O) \lor d*m - c*n = (S O)). +elim Hcut.elim H3.elim H4. +apply (ex_intro nat ? ((a+b*m)*a1*n-b*a2*m)). +split. +(* congruent to a *) +cut (a1*n = a2*m + (S O)). +rewrite > assoc_times. +rewrite > Hcut1. +rewrite < (sym_plus ? (a2*m)). +rewrite > distr_times_plus. +rewrite < times_n_SO. +rewrite > assoc_plus. +rewrite < assoc_times. +rewrite < times_plus_l. +rewrite > eq_minus_plus_plus_minus. +rewrite < times_minus_l. +rewrite > sym_plus. +apply (eq_times_plus_to_congruent ? ? ? ((b+(a+b*m)*a2)-b*a2)). +assumption.reflexivity. +apply le_times_l. +apply (trans_le ? ((a+b*m)*a2)). +apply le_times_l. +apply (trans_le ? (b*m)). +rewrite > times_n_SO in \vdash (? % ?). +apply le_times_r.assumption. +apply le_plus_n. +apply le_plus_n. +apply minus_to_plus. +apply lt_to_le. +change with (O + a2*m < a1*n). +apply lt_minus_to_plus. +rewrite > H5.unfold lt.apply le_n. +assumption. +(* congruent to b *) +cut (a2*m = a1*n - (S O)). +rewrite > (assoc_times b a2). +rewrite > Hcut1. +rewrite > distr_times_minus. +rewrite < assoc_times. +rewrite < eq_plus_minus_minus_minus. +rewrite < times_n_SO. +rewrite < times_minus_l. +rewrite < sym_plus. +apply (eq_times_plus_to_congruent ? ? ? ((a+b*m)*a1-b*a1)). +assumption.reflexivity. +rewrite > assoc_times. +apply le_times_r. +apply (trans_le ? (a1*n - a2*m)). +rewrite > H5.apply le_n. +apply (le_minus_m ? (a2*m)). +apply le_times_l. +apply le_times_l. +apply (trans_le ? (b*m)). +rewrite > times_n_SO in \vdash (? % ?). +apply le_times_r.assumption. +apply le_plus_n. +apply sym_eq. apply plus_to_minus. +rewrite > sym_plus. +apply minus_to_plus. +apply lt_to_le. +change with (O + a2*m < a1*n). +apply lt_minus_to_plus. +rewrite > H5.unfold lt.apply le_n. +assumption. +(* and now the symmetric case; the price to pay for working + in nat instead than Z *) +apply (ex_intro nat ? ((b+a*n)*a2*m-a*a1*n)). +split. +(* congruent to a *) +cut (a1*n = a2*m - (S O)). +rewrite > (assoc_times a a1). +rewrite > Hcut1. +rewrite > distr_times_minus. +rewrite < assoc_times. +rewrite < eq_plus_minus_minus_minus. +rewrite < times_n_SO. +rewrite < times_minus_l. +rewrite < sym_plus. +apply (eq_times_plus_to_congruent ? ? ? ((b+a*n)*a2-a*a2)). +assumption.reflexivity. +rewrite > assoc_times. +apply le_times_r. +apply (trans_le ? (a2*m - a1*n)). +rewrite > H5.apply le_n. +apply (le_minus_m ? (a1*n)). +rewrite > assoc_times.rewrite > assoc_times. +apply le_times_l. +apply (trans_le ? (a*n)). +rewrite > times_n_SO in \vdash (? % ?). +apply le_times_r.assumption. +apply le_plus_n. +apply sym_eq.apply plus_to_minus. +rewrite > sym_plus. +apply minus_to_plus. +apply lt_to_le. +change with (O + a1*n < a2*m). +apply lt_minus_to_plus. +rewrite > H5.unfold lt.apply le_n. +assumption. +(* congruent to a *) +cut (a2*m = a1*n + (S O)). +rewrite > assoc_times. +rewrite > Hcut1. +rewrite > (sym_plus (a1*n)). +rewrite > distr_times_plus. +rewrite < times_n_SO. +rewrite < assoc_times. +rewrite > assoc_plus. +rewrite < times_plus_l. +rewrite > eq_minus_plus_plus_minus. +rewrite < times_minus_l. +rewrite > sym_plus. +apply (eq_times_plus_to_congruent ? ? ? ((a+(b+a*n)*a1)-a*a1)). +assumption.reflexivity. +apply le_times_l. +apply (trans_le ? ((b+a*n)*a1)). +apply le_times_l. +apply (trans_le ? (a*n)). +rewrite > times_n_SO in \vdash (? % ?). +apply le_times_r. +assumption. +apply le_plus_n. +apply le_plus_n. +apply minus_to_plus. +apply lt_to_le. +change with (O + a1*n < a2*m). +apply lt_minus_to_plus. +rewrite > H5.unfold lt.apply le_n. +assumption. +(* proof of the cut *) +rewrite < H2. +apply eq_minus_gcd. +qed. + +theorem and_congruent_congruent_lt: \forall m,n,a,b:nat. O < n \to O < m \to +gcd n m = (S O) \to +ex nat (\lambda x. (congruent x a m \land congruent x b n) \land + (x < m*n)). +intros.elim (and_congruent_congruent m n a b). +elim H3. +apply (ex_intro ? ? (a1 \mod (m*n))). +split.split. +apply (transitive_congruent m ? a1). +unfold congruent. +apply sym_eq. +change with (congruent a1 (a1 \mod (m*n)) m). +rewrite < sym_times. +apply congruent_n_mod_times. +assumption.assumption.assumption. +apply (transitive_congruent n ? a1). +unfold congruent. +apply sym_eq. +change with (congruent a1 (a1 \mod (m*n)) n). +apply congruent_n_mod_times. +assumption.assumption.assumption. +apply lt_mod_m_m. +rewrite > (times_n_O O). +apply lt_times.assumption.assumption. +assumption.assumption.assumption. +qed. + +definition cr_pair : nat \to nat \to nat \to nat \to nat \def +\lambda n,m,a,b. +min (pred (n*m)) (\lambda x. andb (eqb (x \mod n) a) (eqb (x \mod m) b)). + +theorem cr_pair1: cr_pair (S (S O)) (S (S (S O))) O O = O. +reflexivity. +qed. + +theorem cr_pair2: cr_pair (S(S O)) (S(S(S O))) (S O) O = (S(S(S O))). +simplify. +reflexivity. +qed. + +theorem cr_pair3: cr_pair (S(S O)) (S(S(S O))) (S O) (S(S O)) = (S(S(S(S(S O))))). +reflexivity. +qed. + +theorem cr_pair4: cr_pair (S(S(S(S(S O))))) (S(S(S(S(S(S(S O))))))) (S(S(S O))) (S(S O)) = +(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S O))))))))))))))))))))))). +reflexivity. +qed. + +theorem mod_cr_pair : \forall m,n,a,b. a \lt m \to b \lt n \to +gcd n m = (S O) \to +(cr_pair m n a b) \mod m = a \land (cr_pair m n a b) \mod n = b. +intros. +cut (andb (eqb ((cr_pair m n a b) \mod m) a) + (eqb ((cr_pair m n a b) \mod n) b) = true). +generalize in match Hcut. +apply andb_elim. +apply eqb_elim.intro. +rewrite > H3. +simplify. +intro.split.reflexivity. +apply eqb_true_to_eq.assumption. +intro. +simplify. +intro.apply False_ind. +apply not_eq_true_false.apply sym_eq.assumption. +apply (f_min_aux_true +(\lambda x. andb (eqb (x \mod m) a) (eqb (x \mod n) b)) (pred (m*n)) O). +elim (and_congruent_congruent_lt m n a b). +apply (ex_intro ? ? a1).split.split. +apply le_O_n. +elim H3.apply le_S_S_to_le.apply (trans_le ? (m*n)). +assumption.apply (nat_case (m*n)).apply le_O_n. +intro. +rewrite < pred_Sn. +rewrite < plus_n_O.apply le_n. +elim H3.elim H4. +apply andb_elim. +cut (a1 \mod m = a). +cut (a1 \mod n = b). +rewrite > (eq_to_eqb_true ? ? Hcut). +rewrite > (eq_to_eqb_true ? ? Hcut1). +simplify.reflexivity. +rewrite < (lt_to_eq_mod b n).assumption. +assumption. +rewrite < (lt_to_eq_mod a m).assumption. +assumption. +apply (le_to_lt_to_lt ? b).apply le_O_n.assumption. +apply (le_to_lt_to_lt ? a).apply le_O_n.assumption. +assumption. +qed. \ No newline at end of file diff --git a/matita/library/nat/compare.ma b/matita/library/nat/compare.ma new file mode 100644 index 000000000..d4f38971a --- /dev/null +++ b/matita/library/nat/compare.ma @@ -0,0 +1,321 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "datatypes/bool.ma". +include "datatypes/compare.ma". +include "nat/orders.ma". + +let rec eqb n m \def +match n with + [ O \Rightarrow + match m with + [ O \Rightarrow true + | (S q) \Rightarrow false] + | (S p) \Rightarrow + match m with + [ O \Rightarrow false + | (S q) \Rightarrow eqb p q]]. + +theorem eqb_to_Prop: \forall n,m:nat. +match (eqb n m) with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m]. +intros. +apply (nat_elim2 +(\lambda n,m:nat.match (eqb n m) with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m])). +intro.elim n1. +simplify.reflexivity. +simplify.apply not_eq_O_S. +intro. +simplify.unfold Not. +intro. apply (not_eq_O_S n1).apply sym_eq.assumption. +intros.simplify. +generalize in match H. +elim ((eqb n1 m1)). +simplify.apply eq_f.apply H1. +simplify.unfold Not.intro.apply H1.apply inj_S.assumption. +qed. + +theorem eqb_elim : \forall n,m:nat.\forall P:bool \to Prop. +(n=m \to (P true)) \to (n \neq m \to (P false)) \to (P (eqb n m)). +intros. +cut +(match (eqb n m) with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m] \to (P (eqb n m))). +apply Hcut.apply eqb_to_Prop. +elim (eqb n m). +apply ((H H2)). +apply ((H1 H2)). +qed. + +theorem eqb_n_n: \forall n. eqb n n = true. +intro.elim n.simplify.reflexivity. +simplify.assumption. +qed. + +theorem eqb_true_to_eq: \forall n,m:nat. +eqb n m = true \to n = m. +intros. +change with +match true with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m]. +rewrite < H. +apply eqb_to_Prop. +qed. + +theorem eqb_false_to_not_eq: \forall n,m:nat. +eqb n m = false \to n \neq m. +intros. +change with +match false with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m]. +rewrite < H. +apply eqb_to_Prop. +qed. + +theorem eq_to_eqb_true: \forall n,m:nat. +n = m \to eqb n m = true. +intros.apply (eqb_elim n m). +intros. reflexivity. +intros.apply False_ind.apply (H1 H). +qed. + +theorem not_eq_to_eqb_false: \forall n,m:nat. +\lnot (n = m) \to eqb n m = false. +intros.apply (eqb_elim n m). +intros. apply False_ind.apply (H H1). +intros.reflexivity. +qed. + +let rec leb n m \def +match n with + [ O \Rightarrow true + | (S p) \Rightarrow + match m with + [ O \Rightarrow false + | (S q) \Rightarrow leb p q]]. + +theorem leb_elim: \forall n,m:nat. \forall P:bool \to Prop. +(n \leq m \to (P true)) \to (n \nleq m \to (P false)) \to +P (leb n m). +apply nat_elim2; intros; simplify + [apply H.apply le_O_n + |apply H1.apply not_le_Sn_O. + |apply H;intros + [apply H1.apply le_S_S.assumption. + |apply H2.unfold Not.intros.apply H3.apply le_S_S_to_le.assumption + ] + ] +qed. + +theorem leb_true_to_le:\forall n,m. +leb n m = true \to (n \le m). +intros 2. +apply leb_elim + [intros.assumption + |intros.destruct H1. + ] +qed. + +theorem leb_false_to_not_le:\forall n,m. +leb n m = false \to \lnot (n \le m). +intros 2. +apply leb_elim + [intros.destruct H1 + |intros.assumption + ] +qed. +(* +theorem decidable_le: \forall n,m. n \leq m \lor n \nleq m. +intros. +apply (leb_elim n m) + [intro.left.assumption + |intro.right.assumption + ] +qed. +*) + +theorem le_to_leb_true: \forall n,m. n \leq m \to leb n m = true. +intros.apply leb_elim;intros + [reflexivity + |apply False_ind.apply H1.apply H. + ] +qed. + +theorem lt_to_leb_false: \forall n,m. m < n \to leb n m = false. +intros.apply leb_elim;intros + [apply False_ind.apply (le_to_not_lt ? ? H1). assumption + |reflexivity + ] +qed. + +theorem leb_to_Prop: \forall n,m:nat. +match (leb n m) with +[ true \Rightarrow n \leq m +| false \Rightarrow n \nleq m]. +apply nat_elim2;simplify + [exact le_O_n + |exact not_le_Sn_O + |intros 2.simplify. + elim ((leb n m));simplify + [apply le_S_S.apply H + |unfold Not.intros.apply H.apply le_S_S_to_le.assumption + ] + ] +qed. + +(* +theorem leb_elim: \forall n,m:nat. \forall P:bool \to Prop. +(n \leq m \to (P true)) \to (n \nleq m \to (P false)) \to +P (leb n m). +intros. +cut +(match (leb n m) with +[ true \Rightarrow n \leq m +| false \Rightarrow n \nleq m] \to (P (leb n m))). +apply Hcut.apply leb_to_Prop. +elim (leb n m). +apply ((H H2)). +apply ((H1 H2)). +qed. +*) + +definition ltb ≝λn,m. leb n m ∧ notb (eqb n m). + +theorem ltb_to_Prop : + ∀n,m. + match ltb n m with + [ true ⇒ n < m + | false ⇒ n ≮ m + ]. +intros; +unfold ltb; +apply leb_elim; +apply eqb_elim; +intros; +simplify; +[ rewrite < H; + apply le_to_not_lt; + constructor 1 +| apply (not_eq_to_le_to_lt ? ? H H1) +| rewrite < H; + apply le_to_not_lt; + constructor 1 +| apply le_to_not_lt; + generalize in match (not_le_to_lt ? ? H1); + clear H1; + intro; + apply lt_to_le; + assumption +]. +qed. + +theorem ltb_elim: ∀n,m:nat. ∀P:bool → Prop. +(n < m → (P true)) → (n ≮ m → (P false)) → +P (ltb n m). +intros. +cut +(match (ltb n m) with +[ true ⇒ n < m +| false ⇒ n ≮ m] → (P (ltb n m))). +apply Hcut.apply ltb_to_Prop. +elim (ltb n m). +apply ((H H2)). +apply ((H1 H2)). +qed. + +let rec nat_compare n m: compare \def +match n with +[ O \Rightarrow + match m with + [ O \Rightarrow EQ + | (S q) \Rightarrow LT ] +| (S p) \Rightarrow + match m with + [ O \Rightarrow GT + | (S q) \Rightarrow nat_compare p q]]. + +theorem nat_compare_n_n: \forall n:nat. nat_compare n n = EQ. +intro.elim n. +simplify.reflexivity. +simplify.assumption. +qed. + +theorem nat_compare_S_S: \forall n,m:nat. +nat_compare n m = nat_compare (S n) (S m). +intros.simplify.reflexivity. +qed. + +theorem nat_compare_pred_pred: +\forall n,m:nat.lt O n \to lt O m \to +eq compare (nat_compare n m) (nat_compare (pred n) (pred m)). +intros. +apply (lt_O_n_elim n H). +apply (lt_O_n_elim m H1). +intros. +simplify.reflexivity. +qed. + +theorem nat_compare_to_Prop: \forall n,m:nat. +match (nat_compare n m) with + [ LT \Rightarrow n < m + | EQ \Rightarrow n=m + | GT \Rightarrow m < n ]. +intros. +apply (nat_elim2 (\lambda n,m.match (nat_compare n m) with + [ LT \Rightarrow n < m + | EQ \Rightarrow n=m + | GT \Rightarrow m < n ])). +intro.elim n1.simplify.reflexivity. +simplify.unfold lt.apply le_S_S.apply le_O_n. +intro.simplify.unfold lt.apply le_S_S. apply le_O_n. +intros 2.simplify.elim ((nat_compare n1 m1)). +simplify. unfold lt. apply le_S_S.apply H. +simplify. apply eq_f. apply H. +simplify. unfold lt.apply le_S_S.apply H. +qed. + +theorem nat_compare_n_m_m_n: \forall n,m:nat. +nat_compare n m = compare_invert (nat_compare m n). +intros. +apply (nat_elim2 (\lambda n,m. nat_compare n m = compare_invert (nat_compare m n))). +intros.elim n1.simplify.reflexivity. +simplify.reflexivity. +intro.elim n1.simplify.reflexivity. +simplify.reflexivity. +intros.simplify.elim H.reflexivity. +qed. + +theorem nat_compare_elim : \forall n,m:nat. \forall P:compare \to Prop. +(n < m \to P LT) \to (n=m \to P EQ) \to (m < n \to P GT) \to +(P (nat_compare n m)). +intros. +cut (match (nat_compare n m) with +[ LT \Rightarrow n < m +| EQ \Rightarrow n=m +| GT \Rightarrow m < n] \to +(P (nat_compare n m))). +apply Hcut.apply nat_compare_to_Prop. +elim ((nat_compare n m)). +apply ((H H3)). +apply ((H1 H3)). +apply ((H2 H3)). +qed. diff --git a/matita/library/nat/congruence.ma b/matita/library/nat/congruence.ma new file mode 100644 index 000000000..dae99057f --- /dev/null +++ b/matita/library/nat/congruence.ma @@ -0,0 +1,195 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/relevant_equations.ma". +include "nat/primes.ma". + +definition S_mod: nat \to nat \to nat \def +\lambda n,m:nat. (S m) \mod n. + +definition congruent: nat \to nat \to nat \to Prop \def +\lambda n,m,p:nat. mod n p = mod m p. + +interpretation "congruent" 'congruent n m p = + (cic:/matita/nat/congruence/congruent.con n m p). + +notation < "hvbox(n break \cong\sub p m)" + (*non associative*) with precedence 45 +for @{ 'congruent $n $m $p }. + +theorem congruent_n_n: \forall n,p:nat.congruent n n p. +intros.unfold congruent.reflexivity. +qed. + +theorem transitive_congruent: \forall p:nat. transitive nat +(\lambda n,m. congruent n m p). +intros.unfold transitive.unfold congruent.intros. +whd.apply (trans_eq ? ? (y \mod p)). +apply H.apply H1. +qed. + +theorem le_to_mod: \forall n,m:nat. n \lt m \to n = n \mod m. +intros. +apply (div_mod_spec_to_eq2 n m O n (n/m) (n \mod m)). +constructor 1.assumption.simplify.reflexivity. +apply div_mod_spec_div_mod. +apply (le_to_lt_to_lt O n m).apply le_O_n.assumption. +qed. + +theorem mod_mod : \forall n,p:nat. O

    (div_mod (n \mod p) p) in \vdash (? ? % ?). +rewrite > (eq_div_O ? p).reflexivity. +(* uffa: hint non lo trova lt vs. le*) +apply lt_mod_m_m. +assumption. +assumption. +qed. + +theorem mod_times_mod : \forall n,m,p:nat. O

    times_plus_l. +rewrite > assoc_plus. +rewrite < div_mod. +rewrite > assoc_times. +rewrite < div_mod. +reflexivity. +rewrite > (times_n_O O). +apply lt_times. +assumption.assumption.assumption. +qed. + +theorem congruent_n_mod_n : +\forall n,p:nat. O < p \to congruent n (n \mod p) p. +intros.unfold congruent. +apply mod_mod.assumption. +qed. + +theorem congruent_n_mod_times : +\forall n,m,p:nat. O < p \to O < m \to congruent n (n \mod (m*p)) p. +intros.unfold congruent. +apply mod_times_mod.assumption.assumption. +qed. + +theorem eq_times_plus_to_congruent: \forall n,m,p,r:nat. O< p \to +n = r*p+m \to congruent n m p. +intros.unfold congruent. +apply (div_mod_spec_to_eq2 n p (div n p) (mod n p) (r +(div m p)) (mod m p)). +apply div_mod_spec_div_mod.assumption. +constructor 1. +apply lt_mod_m_m.assumption. +(*cut (n = r * p + (m / p * p + m \mod p)).*) +(*lapply (div_mod m p H). +rewrite > sym_times. +rewrite > distr_times_plus. +(*rewrite > (sym_times p (m/p)).*) +(*rewrite > sym_times.*) +rewrite > assoc_plus. +autobatch paramodulation. +rewrite < div_mod. +assumption. +assumption. +*) +rewrite > sym_times. +rewrite > distr_times_plus. +rewrite > sym_times. +rewrite > (sym_times p). +rewrite > assoc_plus. +rewrite < div_mod. +assumption.assumption. +qed. + +theorem divides_to_congruent: \forall n,m,p:nat. O < p \to m \le n \to +divides p (n - m) \to congruent n m p. +intros.elim H2. +apply (eq_times_plus_to_congruent n m p n2). +assumption. +rewrite < sym_plus. +apply minus_to_plus.assumption. +rewrite > sym_times. assumption. +qed. + +theorem congruent_to_divides: \forall n,m,p:nat. +O < p \to congruent n m p \to divides p (n - m). +intros.unfold congruent in H1. +apply (witness ? ? ((n / p)-(m / p))). +rewrite > sym_times. +rewrite > (div_mod n p) in \vdash (? ? % ?). +rewrite > (div_mod m p) in \vdash (? ? % ?). +rewrite < (sym_plus (m \mod p)). +rewrite < H1. +rewrite < (eq_minus_minus_minus_plus ? (n \mod p)). +rewrite < minus_plus_m_m. +apply sym_eq. +apply times_minus_l. +assumption.assumption. +qed. + +theorem mod_times: \forall n,m,p:nat. +O < p \to mod (n*m) p = mod ((mod n p)*(mod m p)) p. +intros. +change with (congruent (n*m) ((mod n p)*(mod m p)) p). +apply (eq_times_plus_to_congruent ? ? p +((n / p)*p*(m / p) + (n / p)*(m \mod p) + (n \mod p)*(m / p))). +assumption. +apply (trans_eq ? ? (((n/p)*p+(n \mod p))*((m/p)*p+(m \mod p)))). +apply eq_f2. +apply div_mod.assumption. +apply div_mod.assumption. +apply (trans_eq ? ? (((n/p)*p)*((m/p)*p) + (n/p)*p*(m \mod p) + +(n \mod p)*((m / p)*p) + (n \mod p)*(m \mod p))). +apply times_plus_plus. +apply eq_f2. +rewrite < assoc_times. +rewrite > (assoc_times (n/p) p (m \mod p)). +rewrite > (sym_times p (m \mod p)). +rewrite < (assoc_times (n/p) (m \mod p) p). +rewrite < times_plus_l. +rewrite < (assoc_times (n \mod p)). +rewrite < times_plus_l. +apply eq_f2. +apply eq_f2.reflexivity. +reflexivity.reflexivity. +reflexivity. +qed. + +theorem congruent_times: \forall n,m,n1,m1,p. O < p \to congruent n n1 p \to +congruent m m1 p \to congruent (n*m) (n1*m1) p. +unfold congruent. +intros. +rewrite > (mod_times n m p H). +rewrite > H1. +rewrite > H2. +apply sym_eq. +apply mod_times.assumption. +qed. + +theorem congruent_pi: \forall f:nat \to nat. \forall n,m,p:nat.O < p \to +congruent (pi n f m) (pi n (\lambda m. mod (f m) p) m) p. +intros. +elim n. simplify. +apply congruent_n_mod_n.assumption. +simplify. +apply congruent_times. +assumption. +apply congruent_n_mod_n.assumption. +assumption. +qed. diff --git a/matita/library/nat/count.ma b/matita/library/nat/count.ma new file mode 100644 index 000000000..be199ca67 --- /dev/null +++ b/matita/library/nat/count.ma @@ -0,0 +1,243 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/relevant_equations.ma". +include "nat/sigma_and_pi.ma". +include "nat/permutation.ma". + +theorem sigma_f_g : \forall n,m:nat.\forall f,g:nat \to nat. +sigma n (\lambda p.f p + g p) m = sigma n f m + sigma n g m. +intros.elim n. +simplify.reflexivity. +simplify.rewrite > H. +rewrite > assoc_plus. +rewrite < (assoc_plus (g (S (n1+m)))). +rewrite > (sym_plus (g (S (n1+m)))). +rewrite > (assoc_plus (sigma n1 f m)). +rewrite < assoc_plus. +reflexivity. +qed. + +theorem sigma_plus: \forall n,p,m:nat.\forall f:nat \to nat. +sigma (S (p+n)) f m = sigma p (\lambda x.(f ((S n) + x))) m + sigma n f m. +intros. elim p. +simplify. +rewrite < (sym_plus n m).reflexivity. +simplify. +rewrite > assoc_plus in \vdash (? ? ? %). +rewrite < H. +simplify. +rewrite < plus_n_Sm. +rewrite > (sym_plus n). +rewrite > assoc_plus. +rewrite < (sym_plus m). +rewrite < (assoc_plus n1). +reflexivity. +qed. + +theorem sigma_plus1: \forall n,p,m:nat.\forall f:nat \to nat. +sigma (p+(S n)) f m = sigma p (\lambda x.(f ((S n) + x))) m + sigma n f m. +intros. elim p. +simplify.reflexivity. +simplify. +rewrite > assoc_plus in \vdash (? ? ? %). +rewrite < H. +rewrite < plus_n_Sm. +rewrite < plus_n_Sm.simplify. +rewrite < (sym_plus n). +rewrite > assoc_plus. +rewrite < (sym_plus m). +rewrite < (assoc_plus n). +reflexivity. +qed. + +theorem eq_sigma_sigma : \forall n,m:nat.\forall f:nat \to nat. +sigma (pred ((S n)*(S m))) f O = +sigma m (\lambda a.(sigma n (\lambda b.f (b*(S m) + a)) O)) O. +intro.elim n.simplify. +rewrite < plus_n_O. +apply eq_sigma.intros.reflexivity. +simplify. +rewrite > sigma_f_g. +rewrite < plus_n_O. +rewrite < H. +rewrite > (S_pred ((S n1)*(S m))). +apply sigma_plus1. +simplify.unfold lt.apply le_S_S.apply le_O_n. +qed. + +theorem eq_sigma_sigma1 : \forall n,m:nat.\forall f:nat \to nat. +sigma (pred ((S n)*(S m))) f O = +sigma n (\lambda a.(sigma m (\lambda b.f (b*(S n) + a)) O)) O. +intros. +rewrite > sym_times. +apply eq_sigma_sigma. +qed. + +theorem sigma_times: \forall n,m,p:nat.\forall f:nat \to nat. +(sigma n f m)*p = sigma n (\lambda i.(f i) * p) m. +intro. elim n.simplify.reflexivity. +simplify.rewrite < H. +apply times_plus_l. +qed. + +definition bool_to_nat: bool \to nat \def +\lambda b. match b with +[ true \Rightarrow (S O) +| false \Rightarrow O ]. + +theorem bool_to_nat_andb: \forall a,b:bool. +bool_to_nat (andb a b) = (bool_to_nat a)*(bool_to_nat b). +intros. elim a.elim b. +simplify.reflexivity. +reflexivity. +reflexivity. +qed. + +definition count : nat \to (nat \to bool) \to nat \def +\lambda n.\lambda f. sigma (pred n) (\lambda n.(bool_to_nat (f n))) O. + +theorem count_times:\forall n,m:nat. +\forall f,f1,f2:nat \to bool. +\forall g:nat \to nat \to nat. +\forall g1,g2: nat \to nat. +(\forall a,b:nat. a < (S n) \to b < (S m) \to (g b a) < (S n)*(S m)) \to +(\forall a,b:nat. a < (S n) \to b < (S m) \to (g1 (g b a)) = a) \to +(\forall a,b:nat. a < (S n) \to b < (S m) \to (g2 (g b a)) = b) \to +(\forall a,b:nat. a < (S n) \to b < (S m) \to f (g b a) = andb (f2 b) (f1 a)) \to +(count ((S n)*(S m)) f) = (count (S n) f1)*(count (S m) f2). +intros.unfold count. +rewrite < eq_map_iter_i_sigma. +rewrite > (permut_to_eq_map_iter_i plus assoc_plus sym_plus ? ? ? + (\lambda i.g (div i (S n)) (mod i (S n)))). +rewrite > eq_map_iter_i_sigma. +rewrite > eq_sigma_sigma1. +apply (trans_eq ? ? +(sigma n (\lambda a. + sigma m (\lambda b.(bool_to_nat (f2 b))*(bool_to_nat (f1 a))) O) O)). +apply eq_sigma.intros. +apply eq_sigma.intros. +rewrite > (div_mod_spec_to_eq (i1*(S n) + i) (S n) ((i1*(S n) + i)/(S n)) + ((i1*(S n) + i) \mod (S n)) i1 i). +rewrite > (div_mod_spec_to_eq2 (i1*(S n) + i) (S n) ((i1*(S n) + i)/(S n)) + ((i1*(S n) + i) \mod (S n)) i1 i). +rewrite > H3. +apply bool_to_nat_andb. +unfold lt.apply le_S_S.assumption. +unfold lt.apply le_S_S.assumption. +apply div_mod_spec_div_mod. +unfold lt.apply le_S_S.apply le_O_n. +constructor 1.unfold lt.apply le_S_S.assumption. +reflexivity. +apply div_mod_spec_div_mod. +unfold lt.apply le_S_S.apply le_O_n. +constructor 1.unfold lt.apply le_S_S.assumption. +reflexivity. +apply (trans_eq ? ? +(sigma n (\lambda n.((bool_to_nat (f1 n)) * +(sigma m (\lambda n.bool_to_nat (f2 n)) O))) O)). +apply eq_sigma. +intros. +rewrite > sym_times. +apply (trans_eq ? ? +(sigma m (\lambda n.(bool_to_nat (f2 n))*(bool_to_nat (f1 i))) O)). +reflexivity. +apply sym_eq. apply sigma_times. +simplify. +apply sym_eq. apply sigma_times. +unfold permut. +split. +intros. +rewrite < plus_n_O. +apply le_S_S_to_le. +rewrite < S_pred in \vdash (? ? %). +change with ((g (i/(S n)) (i \mod (S n))) \lt (S n)*(S m)). +apply H. +apply lt_mod_m_m. +unfold lt. apply le_S_S.apply le_O_n. +apply (lt_times_to_lt_l n). +apply (le_to_lt_to_lt ? i). +rewrite > (div_mod i (S n)) in \vdash (? ? %). +rewrite > sym_plus. +apply le_plus_n. +unfold lt. apply le_S_S.apply le_O_n. +unfold lt. +rewrite > S_pred in \vdash (? ? %). +apply le_S_S. +rewrite > plus_n_O in \vdash (? ? %). +rewrite > sym_times. assumption. +rewrite > (times_n_O O). +apply lt_times. +unfold lt. apply le_S_S.apply le_O_n. +unfold lt. apply le_S_S.apply le_O_n. +rewrite > (times_n_O O). +apply lt_times. +unfold lt. apply le_S_S.apply le_O_n. +unfold lt. apply le_S_S.apply le_O_n. +rewrite < plus_n_O. +unfold injn. +intros. +cut (i < (S n)*(S m)). +cut (j < (S n)*(S m)). +cut ((i \mod (S n)) < (S n)). +cut ((i/(S n)) < (S m)). +cut ((j \mod (S n)) < (S n)). +cut ((j/(S n)) < (S m)). +rewrite > (div_mod i (S n)). +rewrite > (div_mod j (S n)). +rewrite < (H1 (i \mod (S n)) (i/(S n)) Hcut2 Hcut3). +rewrite < (H2 (i \mod (S n)) (i/(S n)) Hcut2 Hcut3) in \vdash (? ? (? % ?) ?). +rewrite < (H1 (j \mod (S n)) (j/(S n)) Hcut4 Hcut5). +rewrite < (H2 (j \mod (S n)) (j/(S n)) Hcut4 Hcut5) in \vdash (? ? ? (? % ?)). +rewrite > H6.reflexivity. +unfold lt. apply le_S_S.apply le_O_n. +unfold lt. apply le_S_S.apply le_O_n. +apply (lt_times_to_lt_l n). +apply (le_to_lt_to_lt ? j). +rewrite > (div_mod j (S n)) in \vdash (? ? %). +rewrite > sym_plus. +apply le_plus_n. +unfold lt. apply le_S_S.apply le_O_n. +rewrite < sym_times. assumption. +apply lt_mod_m_m. +unfold lt. apply le_S_S.apply le_O_n. +apply (lt_times_to_lt_l n). +apply (le_to_lt_to_lt ? i). +rewrite > (div_mod i (S n)) in \vdash (? ? %). +rewrite > sym_plus. +apply le_plus_n. +unfold lt. apply le_S_S.apply le_O_n. +rewrite < sym_times. assumption. +apply lt_mod_m_m. +unfold lt. apply le_S_S.apply le_O_n. +unfold lt. +rewrite > S_pred in \vdash (? ? %). +apply le_S_S.assumption. +rewrite > (times_n_O O). +apply lt_times. +unfold lt. apply le_S_S.apply le_O_n. +unfold lt. apply le_S_S.apply le_O_n. +unfold lt. +rewrite > S_pred in \vdash (? ? %). +apply le_S_S.assumption. +rewrite > (times_n_O O). +apply lt_times. +unfold lt. apply le_S_S.apply le_O_n. +unfold lt. apply le_S_S.apply le_O_n. +intros. +apply False_ind. +apply (not_le_Sn_O m1 H4). +qed. diff --git a/matita/library/nat/div_and_mod.ma b/matita/library/nat/div_and_mod.ma new file mode 100644 index 000000000..944f55996 --- /dev/null +++ b/matita/library/nat/div_and_mod.ma @@ -0,0 +1,400 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "datatypes/constructors.ma". +include "nat/minus.ma". + + +let rec mod_aux p m n: nat \def +match (leb m n) with +[ true \Rightarrow m +| false \Rightarrow + match p with + [O \Rightarrow m + |(S q) \Rightarrow mod_aux q (m-(S n)) n]]. + +definition mod : nat \to nat \to nat \def +\lambda n,m. +match m with +[O \Rightarrow n +| (S p) \Rightarrow mod_aux n n p]. + +interpretation "natural remainder" 'module x y = + (cic:/matita/nat/div_and_mod/mod.con x y). + +let rec div_aux p m n : nat \def +match (leb m n) with +[ true \Rightarrow O +| false \Rightarrow + match p with + [O \Rightarrow O + |(S q) \Rightarrow S (div_aux q (m-(S n)) n)]]. + +definition div : nat \to nat \to nat \def +\lambda n,m. +match m with +[O \Rightarrow S n +| (S p) \Rightarrow div_aux n n p]. + +interpretation "natural divide" 'divide x y = + (cic:/matita/nat/div_and_mod/div.con x y). + +theorem le_mod_aux_m_m: +\forall p,n,m. n \leq p \to (mod_aux p n m) \leq m. +intro.elim p. +apply (le_n_O_elim n H (\lambda n.(mod_aux O n m) \leq m)). +simplify.apply le_O_n. +simplify. +apply (leb_elim n1 m). +simplify.intro.assumption. +simplify.intro.apply H. +cut (n1 \leq (S n) \to n1-(S m) \leq n). +apply Hcut.assumption. +elim n1. +simplify.apply le_O_n. +simplify.apply (trans_le ? n2 n). +apply le_minus_m.apply le_S_S_to_le.assumption. +qed. + +theorem lt_mod_m_m: \forall n,m. O < m \to (n \mod m) < m. +intros 2.elim m.apply False_ind. +apply (not_le_Sn_O O H). +simplify.unfold lt.apply le_S_S.apply le_mod_aux_m_m. +apply le_n. +qed. + +theorem div_aux_mod_aux: \forall p,n,m:nat. +(n=(div_aux p n m)*(S m) + (mod_aux p n m)). +intro.elim p. +simplify.elim (leb n m). +simplify.apply refl_eq. +simplify.apply refl_eq. +simplify. +apply (leb_elim n1 m). +simplify.intro.apply refl_eq. +simplify.intro. +rewrite > assoc_plus. +elim (H (n1-(S m)) m). +change with (n1=(S m)+(n1-(S m))). +rewrite < sym_plus. +apply plus_minus_m_m. +change with (m < n1). +apply not_le_to_lt.exact H1. +qed. + +theorem div_mod: \forall n,m:nat. O < m \to n=(n / m)*m+(n \mod m). +intros 2.elim m.elim (not_le_Sn_O O H). +simplify. +apply div_aux_mod_aux. +qed. + +theorem eq_times_div_minus_mod: +\forall a,b:nat. O \lt b \to +(a /b)*b = a - (a \mod b). +intros. +rewrite > (div_mod a b) in \vdash (? ? ? (? % ?)) +[ apply (minus_plus_m_m (times (div a b) b) (mod a b)) +| assumption +] +qed. + +inductive div_mod_spec (n,m,q,r:nat) : Prop \def +div_mod_spec_intro: r < m \to n=q*m+r \to (div_mod_spec n m q r). + +(* +definition div_mod_spec : nat \to nat \to nat \to nat \to Prop \def +\lambda n,m,q,r:nat.r < m \land n=q*m+r). +*) + +theorem div_mod_spec_to_not_eq_O: \forall n,m,q,r.(div_mod_spec n m q r) \to m \neq O. +intros 4.unfold Not.intros.elim H.absurd (le (S r) O). +rewrite < H1.assumption. +exact (not_le_Sn_O r). +qed. + +theorem div_mod_spec_div_mod: +\forall n,m. O < m \to (div_mod_spec n m (n / m) (n \mod m)). +intros. +apply div_mod_spec_intro. +apply lt_mod_m_m.assumption. +apply div_mod.assumption. +qed. + +theorem div_mod_spec_to_eq :\forall a,b,q,r,q1,r1. +(div_mod_spec a b q r) \to (div_mod_spec a b q1 r1) \to +(eq nat q q1). +intros.elim H.elim H1. +apply (nat_compare_elim q q1).intro. +apply False_ind. +cut (eq nat ((q1-q)*b+r1) r). +cut (b \leq (q1-q)*b+r1). +cut (b \leq r). +apply (lt_to_not_le r b H2 Hcut2). +elim Hcut.assumption. +apply (trans_le ? ((q1-q)*b)). +apply le_times_n. +apply le_SO_minus.exact H6. +rewrite < sym_plus. +apply le_plus_n. +rewrite < sym_times. +rewrite > distr_times_minus. +rewrite > plus_minus. +rewrite > sym_times. +rewrite < H5. +rewrite < sym_times. +apply plus_to_minus. +apply H3. +apply le_times_r. +apply lt_to_le. +apply H6. +(* eq case *) +intros.assumption. +(* the following case is symmetric *) +intro. +apply False_ind. +cut (eq nat ((q-q1)*b+r) r1). +cut (b \leq (q-q1)*b+r). +cut (b \leq r1). +apply (lt_to_not_le r1 b H4 Hcut2). +elim Hcut.assumption. +apply (trans_le ? ((q-q1)*b)). +apply le_times_n. +apply le_SO_minus.exact H6. +rewrite < sym_plus. +apply le_plus_n. +rewrite < sym_times. +rewrite > distr_times_minus. +rewrite > plus_minus. +rewrite > sym_times. +rewrite < H3. +rewrite < sym_times. +apply plus_to_minus. +apply H5. +apply le_times_r. +apply lt_to_le. +apply H6. +qed. + +theorem div_mod_spec_to_eq2 :\forall a,b,q,r,q1,r1. +(div_mod_spec a b q r) \to (div_mod_spec a b q1 r1) \to +(eq nat r r1). +intros.elim H.elim H1. +apply (inj_plus_r (q*b)). +rewrite < H3. +rewrite > (div_mod_spec_to_eq a b q r q1 r1 H H1). +assumption. +qed. + +theorem div_mod_spec_times : \forall n,m:nat.div_mod_spec ((S n)*m) (S n) m O. +intros.constructor 1. +unfold lt.apply le_S_S.apply le_O_n. +rewrite < plus_n_O.rewrite < sym_times.reflexivity. +qed. + +lemma div_plus_times: \forall m,q,r:nat. r < m \to (q*m+r)/ m = q. +intros. +apply (div_mod_spec_to_eq (q*m+r) m ? ((q*m+r) \mod m) ? r) + [apply div_mod_spec_div_mod. + apply (le_to_lt_to_lt ? r) + [apply le_O_n|assumption] + |apply div_mod_spec_intro[assumption|reflexivity] + ] +qed. + +lemma mod_plus_times: \forall m,q,r:nat. r < m \to (q*m+r) \mod m = r. +intros. +apply (div_mod_spec_to_eq2 (q*m+r) m ((q*m+r)/ m) ((q*m+r) \mod m) q r) + [apply div_mod_spec_div_mod. + apply (le_to_lt_to_lt ? r) + [apply le_O_n|assumption] + |apply div_mod_spec_intro[assumption|reflexivity] + ] +qed. + +(* some properties of div and mod *) +theorem div_times: \forall n,m:nat. ((S n)*m) / (S n) = m. +intros. +apply (div_mod_spec_to_eq ((S n)*m) (S n) ? ? ? O); +[2: apply div_mod_spec_div_mod. + unfold lt.apply le_S_S.apply le_O_n. +| skip +| apply div_mod_spec_times +] +qed. + +(*a simple variant of div_times theorem *) +theorem lt_O_to_div_times: \forall a,b:nat. O \lt b \to +a*b/b = a. +intros. +rewrite > sym_times. +rewrite > (S_pred b H). +apply div_times. +qed. + +theorem div_n_n: \forall n:nat. O < n \to n / n = S O. +intros. +apply (div_mod_spec_to_eq n n (n / n) (n \mod n) (S O) O). +apply div_mod_spec_div_mod.assumption. +constructor 1.assumption. +rewrite < plus_n_O.simplify.rewrite < plus_n_O.reflexivity. +qed. + +theorem eq_div_O: \forall n,m. n < m \to n / m = O. +intros. +apply (div_mod_spec_to_eq n m (n/m) (n \mod m) O n). +apply div_mod_spec_div_mod. +apply (le_to_lt_to_lt O n m). +apply le_O_n.assumption. +constructor 1.assumption.reflexivity. +qed. + +theorem mod_n_n: \forall n:nat. O < n \to n \mod n = O. +intros. +apply (div_mod_spec_to_eq2 n n (n / n) (n \mod n) (S O) O). +apply div_mod_spec_div_mod.assumption. +constructor 1.assumption. +rewrite < plus_n_O.simplify.rewrite < plus_n_O.reflexivity. +qed. + +theorem mod_S: \forall n,m:nat. O < m \to S (n \mod m) < m \to +((S n) \mod m) = S (n \mod m). +intros. +apply (div_mod_spec_to_eq2 (S n) m ((S n) / m) ((S n) \mod m) (n / m) (S (n \mod m))). +apply div_mod_spec_div_mod.assumption. +constructor 1.assumption.rewrite < plus_n_Sm. +apply eq_f. +apply div_mod. +assumption. +qed. + +theorem mod_O_n: \forall n:nat.O \mod n = O. +intro.elim n.simplify.reflexivity. +simplify.reflexivity. +qed. + +theorem lt_to_eq_mod:\forall n,m:nat. n < m \to n \mod m = n. +intros. +apply (div_mod_spec_to_eq2 n m (n/m) (n \mod m) O n). +apply div_mod_spec_div_mod. +apply (le_to_lt_to_lt O n m).apply le_O_n.assumption. +constructor 1. +assumption.reflexivity. +qed. + +theorem mod_SO: \forall n:nat. mod n (S O) = O. +intro. +apply sym_eq. +apply le_n_O_to_eq. +apply le_S_S_to_le. +apply lt_mod_m_m. +apply le_n. +qed. + +theorem div_SO: \forall n:nat. div n (S O) = n. +intro. +rewrite > (div_mod ? (S O)) in \vdash (? ? ? %) + [rewrite > mod_SO. + rewrite < plus_n_O. + apply times_n_SO + |apply le_n + ] +qed. + +theorem or_div_mod: \forall n,q. O < q \to +((S (n \mod q)=q) \land S n = (S (div n q)) * q \lor +((S (n \mod q) sym_plus. + rewrite < H1 in ⊢ (? ? ? (? ? %)). + rewrite < plus_n_Sm. + apply eq_f. + apply div_mod. + assumption + ] + ] +qed. + +(* injectivity *) +theorem injective_times_r: \forall n:nat.injective nat nat (\lambda m:nat.(S n)*m). +change with (\forall n,p,q:nat.(S n)*p = (S n)*q \to p=q). +intros. +rewrite < (div_times n). +rewrite < (div_times n q). +apply eq_f2.assumption. +reflexivity. +qed. + +variant inj_times_r : \forall n,p,q:nat.(S n)*p = (S n)*q \to p=q \def +injective_times_r. + +theorem lt_O_to_injective_times_r: \forall n:nat. O < n \to injective nat nat (\lambda m:nat.n*m). +simplify. +intros 4. +apply (lt_O_n_elim n H).intros. +apply (inj_times_r m).assumption. +qed. + +variant inj_times_r1:\forall n. O < n \to \forall p,q:nat.n*p = n*q \to p=q +\def lt_O_to_injective_times_r. + +theorem injective_times_l: \forall n:nat.injective nat nat (\lambda m:nat.m*(S n)). +simplify. +intros. +apply (inj_times_r n x y). +rewrite < sym_times. +rewrite < (sym_times y). +assumption. +qed. + +variant inj_times_l : \forall n,p,q:nat. p*(S n) = q*(S n) \to p=q \def +injective_times_l. + +theorem lt_O_to_injective_times_l: \forall n:nat. O < n \to injective nat nat (\lambda m:nat.m*n). +simplify. +intros 4. +apply (lt_O_n_elim n H).intros. +apply (inj_times_l m).assumption. +qed. + +variant inj_times_l1:\forall n. O < n \to \forall p,q:nat.p*n = q*n \to p=q +\def lt_O_to_injective_times_l. + + +(* n_divides computes the pair (div,mod) *) + +(* p is just an upper bound, acc is an accumulator *) +let rec n_divides_aux p n m acc \def + match n \mod m with + [ O \Rightarrow + match p with + [ O \Rightarrow pair nat nat acc n + | (S p) \Rightarrow n_divides_aux p (n / m) m (S acc)] + | (S a) \Rightarrow pair nat nat acc n]. + +(* n_divides n m = if m divides n q times, with remainder r *) +definition n_divides \def \lambda n,m:nat.n_divides_aux n n m O. + diff --git a/matita/library/nat/div_and_mod_diseq.ma b/matita/library/nat/div_and_mod_diseq.ma new file mode 100644 index 000000000..eceb275ac --- /dev/null +++ b/matita/library/nat/div_and_mod_diseq.ma @@ -0,0 +1,341 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/lt_arith.ma". + +(* the proof that + n \mod m < m, + called lt_mod_m_m, is in div_and_mod. +Other inequalities are also in lt_arith.ma. +*) + +theorem lt_div_S: \forall n,m. O < m \to +n < S(n / m)*m. +intros. +change with (n < m +(n/m)*m). +rewrite > sym_plus. +rewrite > (div_mod n m H) in ⊢ (? % ?). +apply lt_plus_r. +apply lt_mod_m_m. +assumption. +qed. + +theorem le_div: \forall n,m. O < n \to m/n \le m. +intros. +rewrite > (div_mod m n) in \vdash (? ? %) + [apply (trans_le ? (m/n*n)) + [rewrite > times_n_SO in \vdash (? % ?). + apply le_times + [apply le_n|assumption] + |apply le_plus_n_r + ] + |assumption + ] +qed. + +theorem le_plus_mod: \forall m,n,q. O < q \to +(m+n) \mod q \le m \mod q + n \mod q . +intros. +elim (decidable_le q (m \mod q + n \mod q)) + [apply not_lt_to_le.intro. + apply (le_to_not_lt q q) + [apply le_n + |apply (le_to_lt_to_lt ? (m\mod q+n\mod q)) + [assumption + |apply (trans_lt ? ((m+n)\mod q)) + [assumption + |apply lt_mod_m_m.assumption + ] + ] + ] + |cut ((m+n)\mod q = m\mod q+n\mod q) + [rewrite < Hcut.apply le_n + |apply (div_mod_spec_to_eq2 (m+n) q ((m+n)/q) ((m+n) \mod q) (m/q + n/q)) + [apply div_mod_spec_div_mod. + assumption + |apply div_mod_spec_intro + [apply not_le_to_lt.assumption + |rewrite > (div_mod n q H) in ⊢ (? ? (? ? %) ?). + rewrite < assoc_plus. + rewrite < assoc_plus in ⊢ (? ? ? %). + apply eq_f2 + [rewrite > (div_mod m q) in ⊢ (? ? (? % ?) ?) + [rewrite > sym_times in ⊢ (? ? ? (? % ?)). + rewrite > distr_times_plus. + rewrite > sym_times in ⊢ (? ? ? (? (? % ?) ?)). + rewrite > assoc_plus. + rewrite > assoc_plus in ⊢ (? ? ? %). + apply eq_f. + rewrite > sym_plus. + rewrite > sym_times. + reflexivity + |assumption + ] + |reflexivity + ] + ] + ] + ] + ] +qed. + +theorem le_plus_div: \forall m,n,q. O < q \to +m/q + n/q \le (m+n)/q. +intros. +apply (le_times_to_le q) + [assumption + |rewrite > distr_times_plus. + rewrite > sym_times. + rewrite > sym_times in ⊢ (? (? ? %) ?). + rewrite > sym_times in ⊢ (? ? %). + apply (le_plus_to_le ((m+n) \mod q)). + rewrite > sym_plus in ⊢ (? ? %). + rewrite < (div_mod ? ? H). + rewrite > (div_mod n q H) in ⊢ (? ? (? ? %)). + rewrite < assoc_plus. + rewrite > sym_plus in ⊢ (? ? (? ? %)). + rewrite < assoc_plus in ⊢ (? ? %). + apply le_plus_l. + rewrite > (div_mod m q H) in ⊢ (? ? (? % ?)). + rewrite > assoc_plus. + rewrite > sym_plus. + apply le_plus_r. + apply le_plus_mod. + assumption + ] +qed. + +theorem le_times_to_le_div: \forall a,b,c:nat. +O \lt b \to (b*c) \le a \to c \le (a /b). +intros. +apply lt_S_to_le. +apply (lt_times_n_to_lt b) + [assumption + |rewrite > sym_times. + apply (le_to_lt_to_lt ? a) + [assumption + |simplify. + rewrite > sym_plus. + rewrite > (div_mod a b) in ⊢ (? % ?) + [apply lt_plus_r. + apply lt_mod_m_m. + assumption + |assumption + ] + ] + ] +qed. + +theorem le_times_to_le_div2: \forall m,n,q. O < q \to +n \le m*q \to n/q \le m. +intros. +apply (le_times_to_le q ? ? H). +rewrite > sym_times. +rewrite > sym_times in ⊢ (? ? %). +apply (le_plus_to_le (n \mod q)). +rewrite > sym_plus. +rewrite < div_mod + [apply (trans_le ? (m*q)) + [assumption + |apply le_plus_n + ] + |assumption + ] +qed. + +(* da spostare *) +theorem lt_m_nm: \forall n,m. O < m \to S O < n \to +m < n*m. +intros. +elim H1 + [simplify.rewrite < plus_n_O. + rewrite > plus_n_O in ⊢ (? % ?). + apply lt_plus_r.assumption + |simplify. + rewrite > plus_n_O in ⊢ (? % ?). + rewrite > sym_plus. + apply lt_plus + [assumption + |assumption + ] + ] +qed. + +theorem lt_times_to_lt: \forall i,n,m. O < i \to +i * n < i * m \to n < m. +intros. +apply not_le_to_lt.intro. +apply (lt_to_not_le ? ? H1). +apply le_times_r. +assumption. +qed. + +theorem lt_times_to_lt_div: \forall m,n,q. n < m*q \to n/q < m. +intros. +apply (lt_times_to_lt q ? ? (lt_times_to_lt_O ? ? ? H)). +rewrite > sym_times. +rewrite > sym_times in ⊢ (? ? %). +apply (le_plus_to_le (n \mod q)). +rewrite < plus_n_Sm. +rewrite > sym_plus. +rewrite < div_mod + [apply (trans_le ? (m*q)) + [assumption + |apply le_plus_n + ] + |apply (lt_times_to_lt_O ? ? ? H) + ] +qed. + +theorem lt_div: \forall n,m. O < m \to S O < n \to m/n < m. +intros. +apply lt_times_to_lt_div. +rewrite < sym_times. +apply lt_m_nm;assumption. +qed. + +theorem le_div_plus_S: \forall m,n,q. O < q \to +(m+n)/q \le S(m/q + n/q). +intros. +apply le_S_S_to_le. +apply lt_times_to_lt_div. +change in ⊢ (? ? %) with (q + (q + (m/q+n/q)*q)). +rewrite > sym_times. +rewrite > distr_times_plus. +rewrite > sym_times. +rewrite < assoc_plus in ⊢ (? ? (? ? %)). +rewrite < assoc_plus. +rewrite > sym_plus in ⊢ (? ? (? % ?)). +rewrite > assoc_plus. +apply lt_plus + [change with (m < S(m/q)*q). + apply lt_div_S. + assumption + |rewrite > sym_times. + change with (n < S(n/q)*q). + apply lt_div_S. + assumption + ] +qed. + +theorem le_div_S_S_div: \forall n,m. O < m \to +(S n)/m \le S (n /m). +intros. +apply le_times_to_le_div2 + [assumption + |simplify. + rewrite > (div_mod n m H) in ⊢ (? (? %) ?). + rewrite > plus_n_Sm. + rewrite > sym_plus. + apply le_plus_l. + apply lt_mod_m_m. + assumption. + ] +qed. + +theorem le_times_div_div_times: \forall a,n,m.O < m \to +a*(n/m) \le a*n/m. +intros. +apply le_times_to_le_div + [assumption + |rewrite > sym_times. + rewrite > assoc_times. + apply le_times_r. + rewrite > (div_mod n m H) in ⊢ (? ? %). + apply le_plus_n_r. + ] +qed. + +theorem monotonic_div: \forall n.O < n \to +monotonic nat le (\lambda m.div m n). +unfold monotonic.simplify.intros. +apply le_times_to_le_div + [assumption + |apply (trans_le ? x) + [rewrite > sym_times. + rewrite > (div_mod x n H) in ⊢ (? ? %). + apply le_plus_n_r + |assumption + ] + ] +qed. + +theorem le_div_times_m: \forall a,i,m. O < i \to O < m \to +(a * (m / i)) / m \le a / i. +intros. +apply (trans_le ? ((a*m/i)/m)) + [apply monotonic_div + [assumption + |apply le_times_div_div_times. + assumption + ] + |rewrite > eq_div_div_div_times + [rewrite > sym_times in ⊢ (? (? ? %) ?). + rewrite < eq_div_div_div_times + [apply monotonic_div + [assumption + |rewrite > lt_O_to_div_times + [apply le_n + |assumption + ] + ] + |assumption + |assumption + ] + |assumption + |assumption + ] + ] +qed. + +theorem le_div_times_Sm: \forall a,i,m. O < i \to O < m \to +a / i \le (a * S (m / i))/m. +intros. +apply (trans_le ? ((a * S (m / i))/((S (m/i))*i))) + [rewrite < (eq_div_div_div_times ? i) + [rewrite > lt_O_to_div_times + [apply le_n + |apply lt_O_S + ] + |apply lt_O_S + |assumption + ] + |apply le_times_to_le_div + [assumption + |apply (trans_le ? (m*(a*S (m/i))/(S (m/i)*i))) + [apply le_times_div_div_times. + rewrite > (times_n_O O). + apply lt_times + [apply lt_O_S + |assumption + ] + |rewrite > sym_times. + apply le_times_to_le_div2 + [rewrite > (times_n_O O). + apply lt_times + [apply lt_O_S + |assumption + ] + |apply le_times_r. + apply lt_to_le. + apply lt_div_S. + assumption + ] + ] + ] + ] +qed. + diff --git a/matita/library/nat/div_and_mod_new.ma.dontcompile b/matita/library/nat/div_and_mod_new.ma.dontcompile new file mode 100644 index 000000000..546e92e17 --- /dev/null +++ b/matita/library/nat/div_and_mod_new.ma.dontcompile @@ -0,0 +1,360 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/nat/div_and_mod_new". + +include "datatypes/constructors.ma". +include "nat/minus.ma". + +let rec mod_aux t m n: nat \def +match (leb (S m) n) with +[ true \Rightarrow m +| false \Rightarrow + match t with + [O \Rightarrow m (* if t is large enough this case never happens *) + |(S t1) \Rightarrow mod_aux t1 (m-n) n + ] +]. + +definition mod: nat \to nat \to nat \def +\lambda m,n.mod_aux m m n. + +interpretation "natural remainder" 'module x y = + (cic:/matita/nat/div_and_mod_new/mod.con x y). + +lemma O_to_mod_aux: \forall m,n. mod_aux O m n = m. +intros. +simplify.elim (leb (S m) n);reflexivity. +qed. + +lemma lt_to_mod_aux: \forall t,m,n. m < n \to mod_aux (S t) m n = m. +intros. +change with +( match (leb (S m) n) with + [ true \Rightarrow m | false \Rightarrow mod_aux t (m-n) n] = m). +rewrite > (le_to_leb_true ? ? H). +reflexivity. +qed. + +lemma le_to_mod_aux: \forall t,m,n. n \le m \to +mod_aux (S t) m n = mod_aux t (m-n) n. +intros. +change with +(match (leb (S m) n) with +[ true \Rightarrow m | false \Rightarrow mod_aux t (m-n) n] = mod_aux t (m-n) n). +apply (leb_elim (S m) n);intro + [apply False_ind.apply (le_to_not_lt ? ? H).apply H1 + |reflexivity + ] +qed. + +let rec div_aux p m n : nat \def +match (leb (S m) n) with +[ true \Rightarrow O +| false \Rightarrow + match p with + [O \Rightarrow O + |(S q) \Rightarrow S (div_aux q (m-n) n)]]. + +definition div : nat \to nat \to nat \def +\lambda n,m.div_aux n n m. + +interpretation "natural divide" 'divide x y = + (cic:/matita/nat/div_and_mod_new/div.con x y). + +theorem lt_mod_aux_m_m: +\forall n. O < n \to \forall t,m. m \leq t \to (mod_aux t m n) < n. +intros 3. +elim t + [rewrite > O_to_mod_aux. + apply (le_n_O_elim ? H1). + assumption + |apply (leb_elim (S m) n);intros + [rewrite > lt_to_mod_aux[assumption|assumption] + |rewrite > le_to_mod_aux + [apply H1. + apply le_plus_to_minus. + apply (trans_le ? ? ? H2). + apply (lt_O_n_elim ? H).intro. + rewrite < plus_n_Sm. + apply le_S_S. + apply le_plus_n_r + |apply not_lt_to_le. + assumption + ] + ] + ] +qed. + +theorem lt_mod_m_m: \forall n,m. O < m \to (n \mod m) < m. +intros.unfold mod. +apply lt_mod_aux_m_m[assumption|apply le_n] +qed. + +lemma mod_aux_O: \forall p,n:nat. mod_aux p n O = n. +intros. +elim p + [reflexivity + |simplify.rewrite < minus_n_O.assumption + ] +qed. + +theorem div_aux_mod_aux: \forall m,p,n:nat. +(n=(div_aux p n m)*m + (mod_aux p n m)). +intro. +apply (nat_case m) + [intros.rewrite < times_n_O.simplify.apply sym_eq.apply mod_aux_O + |intros 2.elim p + [simplify.elim (leb n m1);reflexivity + |simplify.apply (leb_elim n1 m1);intro + [reflexivity + |simplify. + rewrite > assoc_plus. + rewrite < (H (n1-(S m1))). + change with (n1=(S m1)+(n1-(S m1))). + rewrite < sym_plus. + apply plus_minus_m_m. + change with (m1 < n1). + apply not_le_to_lt.exact H1. + ] + ] + ] +qed. + +theorem div_mod: \forall n,m:nat. O < m \to n=(n / m)*m+(n \mod m). +intros.apply (div_aux_mod_aux m n n). +qed. + +inductive div_mod_spec (n,m,q,r:nat) : Prop \def +div_mod_spec_intro: r < m \to n=q*m+r \to (div_mod_spec n m q r). + +(* +definition div_mod_spec : nat \to nat \to nat \to nat \to Prop \def +\lambda n,m,q,r:nat.r < m \land n=q*m+r). +*) + +theorem div_mod_spec_to_not_eq_O: \forall n,m,q,r.(div_mod_spec n m q r) \to m \neq O. +intros 4.unfold Not.intros.elim H.absurd (le (S r) O) + [rewrite < H1.assumption|exact (not_le_Sn_O r)] +qed. + +theorem div_mod_spec_div_mod: +\forall n,m. O < m \to (div_mod_spec n m (n / m) (n \mod m)). +intros.autobatch. +(* +apply div_mod_spec_intro. +apply lt_mod_m_m.assumption. +apply div_mod.assumption. +*) +qed. + +theorem div_mod_spec_to_eq :\forall a,b,q,r,q1,r1. +(div_mod_spec a b q r) \to (div_mod_spec a b q1 r1) \to q = q1. +intros.elim H.elim H1. +apply (nat_compare_elim q q1);intro + [apply False_ind. + cut ((q1-q)*b+r1 = r) + [cut (b \leq (q1-q)*b+r1) + [cut (b \leq r) + [apply (lt_to_not_le r b H2 Hcut2) + |elim Hcut.assumption + ] + |autobatch depth=4. apply (trans_le ? ((q1-q)*b)) + [apply le_times_n. + apply le_SO_minus.exact H6 + |rewrite < sym_plus. + apply le_plus_n + ] + ] + |rewrite < sym_times. + rewrite > distr_times_minus. + rewrite > plus_minus + [autobatch. + (* + rewrite > sym_times. + rewrite < H5. + rewrite < sym_times. + apply plus_to_minus. + apply H3 + *) + |autobatch. + (* + apply le_times_r. + apply lt_to_le. + apply H6 + *) + ] + ] +(* eq case *) + |assumption. +(* the following case is symmetric *) +intro. +apply False_ind. +cut (eq nat ((q-q1)*b+r) r1). +cut (b \leq (q-q1)*b+r). +cut (b \leq r1). +apply (lt_to_not_le r1 b H4 Hcut2). +elim Hcut.assumption. +apply (trans_le ? ((q-q1)*b)). +apply le_times_n. +apply le_SO_minus.exact H6. +rewrite < sym_plus. +apply le_plus_n. +rewrite < sym_times. +rewrite > distr_times_minus. +rewrite > plus_minus. +rewrite > sym_times. +rewrite < H3. +rewrite < sym_times. +apply plus_to_minus. +apply H5. +apply le_times_r. +apply lt_to_le. +apply H6. +qed. + +theorem div_mod_spec_to_eq2 :\forall a,b,q,r,q1,r1. +(div_mod_spec a b q r) \to (div_mod_spec a b q1 r1) \to +(eq nat r r1). +intros.elim H.elim H1. +apply (inj_plus_r (q*b)). +rewrite < H3. +rewrite > (div_mod_spec_to_eq a b q r q1 r1 H H1). +assumption. +qed. + +theorem div_mod_spec_times : \forall n,m:nat.div_mod_spec ((S n)*m) (S n) m O. +intros.constructor 1. +unfold lt.apply le_S_S.apply le_O_n. +rewrite < plus_n_O.rewrite < sym_times.reflexivity. +qed. + +(* some properties of div and mod *) +theorem div_times: \forall n,m:nat. ((S n)*m) / (S n) = m. +intros. +apply (div_mod_spec_to_eq ((S n)*m) (S n) ? ? ? O). +goal 15. (* ?11 is closed with the following tactics *) +apply div_mod_spec_div_mod. +unfold lt.apply le_S_S.apply le_O_n. +apply div_mod_spec_times. +qed. + +theorem div_n_n: \forall n:nat. O < n \to n / n = S O. +intros. +apply (div_mod_spec_to_eq n n (n / n) (n \mod n) (S O) O). +apply div_mod_spec_div_mod.assumption. +constructor 1.assumption. +rewrite < plus_n_O.simplify.rewrite < plus_n_O.reflexivity. +qed. + +theorem eq_div_O: \forall n,m. n < m \to n / m = O. +intros. +apply (div_mod_spec_to_eq n m (n/m) (n \mod m) O n). +apply div_mod_spec_div_mod. +apply (le_to_lt_to_lt O n m). +apply le_O_n.assumption. +constructor 1.assumption.reflexivity. +qed. + +theorem mod_n_n: \forall n:nat. O < n \to n \mod n = O. +intros. +apply (div_mod_spec_to_eq2 n n (n / n) (n \mod n) (S O) O). +apply div_mod_spec_div_mod.assumption. +constructor 1.assumption. +rewrite < plus_n_O.simplify.rewrite < plus_n_O.reflexivity. +qed. + +theorem mod_S: \forall n,m:nat. O < m \to S (n \mod m) < m \to +((S n) \mod m) = S (n \mod m). +intros. +apply (div_mod_spec_to_eq2 (S n) m ((S n) / m) ((S n) \mod m) (n / m) (S (n \mod m))). +apply div_mod_spec_div_mod.assumption. +constructor 1.assumption.rewrite < plus_n_Sm. +apply eq_f. +apply div_mod. +assumption. +qed. + +theorem mod_O_n: \forall n:nat.O \mod n = O. +intro.elim n.simplify.reflexivity. +simplify.reflexivity. +qed. + +theorem lt_to_eq_mod:\forall n,m:nat. n < m \to n \mod m = n. +intros. +apply (div_mod_spec_to_eq2 n m (n/m) (n \mod m) O n). +apply div_mod_spec_div_mod. +apply (le_to_lt_to_lt O n m).apply le_O_n.assumption. +constructor 1. +assumption.reflexivity. +qed. + +(* injectivity *) +theorem injective_times_r: \forall n:nat.injective nat nat (\lambda m:nat.(S n)*m). +change with (\forall n,p,q:nat.(S n)*p = (S n)*q \to p=q). +intros. +rewrite < (div_times n). +rewrite < (div_times n q). +apply eq_f2.assumption. +reflexivity. +qed. + +variant inj_times_r : \forall n,p,q:nat.(S n)*p = (S n)*q \to p=q \def +injective_times_r. + +theorem lt_O_to_injective_times_r: \forall n:nat. O < n \to injective nat nat (\lambda m:nat.n*m). +simplify. +intros 4. +apply (lt_O_n_elim n H).intros. +apply (inj_times_r m).assumption. +qed. + +variant inj_times_r1:\forall n. O < n \to \forall p,q:nat.n*p = n*q \to p=q +\def lt_O_to_injective_times_r. + +theorem injective_times_l: \forall n:nat.injective nat nat (\lambda m:nat.m*(S n)). +simplify. +intros. +apply (inj_times_r n x y). +rewrite < sym_times. +rewrite < (sym_times y). +assumption. +qed. + +variant inj_times_l : \forall n,p,q:nat. p*(S n) = q*(S n) \to p=q \def +injective_times_l. + +theorem lt_O_to_injective_times_l: \forall n:nat. O < n \to injective nat nat (\lambda m:nat.m*n). +simplify. +intros 4. +apply (lt_O_n_elim n H).intros. +apply (inj_times_l m).assumption. +qed. + +variant inj_times_l1:\forall n. O < n \to \forall p,q:nat.p*n = q*n \to p=q +\def lt_O_to_injective_times_l. + +(* n_divides computes the pair (div,mod) *) + +(* p is just an upper bound, acc is an accumulator *) +let rec n_divides_aux p n m acc \def + match n \mod m with + [ O \Rightarrow + match p with + [ O \Rightarrow pair nat nat acc n + | (S p) \Rightarrow n_divides_aux p (n / m) m (S acc)] + | (S a) \Rightarrow pair nat nat acc n]. + +(* n_divides n m = if m divides n q times, with remainder r *) +definition n_divides \def \lambda n,m:nat.n_divides_aux n n m O. diff --git a/matita/library/nat/euler_theorem.ma b/matita/library/nat/euler_theorem.ma new file mode 100644 index 000000000..bf1aac268 --- /dev/null +++ b/matita/library/nat/euler_theorem.ma @@ -0,0 +1,411 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/map_iter_p.ma". +include "nat/totient.ma". + +(* +lemma count_card: \forall p.\forall n. +p O = false \to count (S n) p = card n p. +intros.elim n + [simplify.rewrite > H. reflexivity + |simplify. + rewrite < plus_n_O. + apply eq_f.assumption + ] +qed. + +lemma count_card1: \forall p.\forall n. +p O = false \to p n = false \to count n p = card n p. +intros 3.apply (nat_case n) + [intro.simplify.rewrite > H. reflexivity + |intros.rewrite > (count_card ? ? H). + simplify.rewrite > H1.reflexivity + ] +qed. + + +( a reformulation of totient using card insted of count ) + +lemma totient_card: \forall n. +totient n = card n (\lambda i.eqb (gcd i n) (S O)). +intro.apply (nat_case n) + [reflexivity + |intro.apply (nat_case m) + [reflexivity + |intro.apply count_card1 + [reflexivity + |rewrite > gcd_n_n.reflexivity + ] + ] + ] +qed. +*) + +(*this obvious property is useful because simplify, sometimes, + "simplifies too much", and doesn't allow to obtain this simple result. + *) +theorem card_Sn: \forall n:nat. \forall p:nat \to bool. +card (S n) p = (bool_to_nat (p (S n))) + (card n p). +intros. +simplify. +reflexivity. +qed. + +(* a reformulation of totient using card insted of sigma_p *) + +theorem totient_card_aux: \forall n,m: nat. +m = n \to +sigma_p (S (S n)) (\lambda m:nat.eqb (gcd m (S (S n))) (S O)) (\lambda x:nat. (S O)) += card (S n) (\lambda m:nat.eqb (gcd m (S (S n))) (S O)). +intros. +rewrite < H in \vdash (? ? (? % ? ?) ?). +rewrite < H in \vdash (? ? ? (? % ?)). +elim (m) +[ rewrite > card_Sn. + cut ((eqb (gcd (S O)(S (S n))) (S O) ) = true) + [ rewrite > Hcut. + simplify in \vdash (? ? ? %). + rewrite > true_to_sigma_p_Sn + [ rewrite > false_to_sigma_p_Sn in \vdash (? ? (? ? %) ?) + [ simplify in \vdash (? ? % ?). + reflexivity + | rewrite > gcd_O_n. + apply not_eq_to_eqb_false. + apply cic:/matita/nat/nat/not_eq_S.con. + unfold Not. + intro. + cut ( (S n) \le O) + [ apply (not_le_Sn_n n ?). + apply (transitive_le (S n) O n ? ?); + [ apply (Hcut1) + | apply (le_O_n n) + ] + | rewrite > H1. + apply le_n + ] + ] + | assumption + ] + | apply eq_to_eqb_true. + rewrite > gcd_SO_n. + reflexivity + ] +| cut ((eqb (gcd (S (S n1)) (S (S n))) (S O)) = true + \lor (eqb (gcd (S (S n1)) (S (S n))) (S O)) = false) + [ elim Hcut + [ rewrite > card_Sn. + rewrite > true_to_sigma_p_Sn + [ rewrite > H2. + simplify in \vdash (? ? ? (? % ?)). + apply eq_f. + assumption + | assumption + ] + | rewrite > card_Sn. + rewrite > false_to_sigma_p_Sn + [ rewrite > H2. + simplify in \vdash (? ? ? (? % ?)). + rewrite > sym_plus. + rewrite < plus_n_O. + assumption + | assumption + ] + ] + | elim (eqb (gcd (S (S n1)) (S (S n))) (S O)) + [ left. + reflexivity + | right. + reflexivity + ] + ] +] +qed. + +lemma totient_card: \forall n. +totient n = card n (\lambda i.eqb (gcd i n) (S O)). +intros. +elim n +[ simplify. + reflexivity +| elim n1 + [ simplify. + reflexivity + | + (*unfold card. + intros.*) + (* here simplify creates problems: it seems it simplifies too much. I had to + * introduce the obvious theorem card_Sn. + *) + rewrite > card_Sn. + rewrite > (gcd_n_n (S (S n2))). + cut ((eqb (S (S n2)) (S O)) = false) + [ rewrite > Hcut. + simplify in \vdash (? ? ? (? % ?)). + rewrite > sym_plus. + rewrite < (plus_n_O). + unfold totient. + apply (totient_card_aux n2 n2). + reflexivity + | apply not_eq_to_eqb_false. + apply cic:/matita/nat/nat/not_eq_S.con. + unfold Not. + intro. + cut ( (S n2) \le O) + [ apply (not_le_Sn_n n2 ?). + apply (transitive_le (S n2) O n2 ? ?); + [ apply (Hcut) + | apply (le_O_n n2) + ] + | rewrite > H2. + apply le_n + ] + ] + ] +] +qed. + +theorem gcd_pi_p: \forall n,k. O < k \to k \le n \to +gcd n (pi_p (\lambda i.eqb (gcd i n) (S O)) k) = (S O). +intros 3.elim H + [rewrite > pi_p_S. + cut (eqb (gcd (S O) n) (S O) = true) + [rewrite > Hcut. + change with ((gcd n (S O)) = (S O)). + apply (transitive_eq nat (gcd n (S O)) (gcd (S O) n) (S O) ? ?); + [ apply (sym_eq nat (gcd (S O) n) (gcd n (S O)) ?). + apply (symmetric_gcd (S O) n). + | apply (gcd_SO_n n). + ] + |apply eq_to_eqb_true. + apply (gcd_SO_n n) + ] + |rewrite > pi_p_S. + apply eqb_elim + [intro. + change with + ((gcd n ((S n1)*(pi_p (\lambda i.eqb (gcd i n) (S O)) n1))) = (S O)). + apply eq_gcd_times_SO + [unfold.apply le_S.assumption + |apply lt_O_pi_p. + |rewrite > sym_gcd. assumption. + |apply H2. + apply (trans_le ? (S n1))[apply le_n_Sn|assumption] + ] + |intro. + change with + (gcd n (pi_p (\lambda i.eqb (gcd i n) (S O)) n1) = (S O)). + apply H2. + apply (trans_le ? (S n1))[apply le_n_Sn|assumption] + ] + ] +qed. + +theorem congruent_map_iter_p_times:\forall f:nat \to nat. \forall a,n:nat. +O < a \to +congruent +(map_iter_p n (\lambda i.eqb (gcd i a) (S O)) (\lambda x.f x) (S O) times) +(map_iter_p n (\lambda i.eqb (gcd i a) (S O)) + (\lambda x.f x \mod a) (S O) times) a. +intros. +elim n + [rewrite > map_iter_p_O. + apply (congruent_n_n ? a) + |apply (eqb_elim (gcd (S n1) a) (S O)) + [intro. + rewrite > map_iter_p_S_true + [rewrite > map_iter_p_S_true + [apply congruent_times + [assumption + |apply congruent_n_mod_n.assumption + |assumption + ] + |apply eq_to_eqb_true.assumption + ] + |apply eq_to_eqb_true.assumption + ] + |intro. + rewrite > map_iter_p_S_false + [rewrite > map_iter_p_S_false + [assumption + |apply not_eq_to_eqb_false.assumption + ] + |apply not_eq_to_eqb_false.assumption + ] + ] + ] +qed. + +theorem permut_p_mod: \forall a,n. S O < n \to O < a \to gcd a n = (S O) \to +permut_p (\lambda x:nat.a*x \mod n) (\lambda i:nat.eqb (gcd i n) (S O)) n. +intros. +lapply (lt_S_to_lt ? ? H) as H3. +unfold permut_p. +simplify. +intros. +split + [split + [apply lt_to_le. + apply lt_mod_m_m. + assumption + |rewrite > sym_gcd. + rewrite > gcd_mod + [apply eq_to_eqb_true. + rewrite > sym_gcd. + apply eq_gcd_times_SO + [assumption + |apply (gcd_SO_to_lt_O i n H). + apply eqb_true_to_eq. + assumption + |rewrite > sym_gcd.assumption + |rewrite > sym_gcd.apply eqb_true_to_eq. + assumption + ] + |assumption + ] + ] + |intros. + lapply (gcd_SO_to_lt_n ? ? H H4 (eqb_true_to_eq ? ? H5)) as H9. + lapply (gcd_SO_to_lt_n ? ? H H7 (eqb_true_to_eq ? ? H6)) as H10. + lapply (gcd_SO_to_lt_O ? ? H (eqb_true_to_eq ? ? H5)) as H11. + lapply (gcd_SO_to_lt_O ? ? H (eqb_true_to_eq ? ? H6)) as H12. + unfold Not.intro. + apply H8. + apply (nat_compare_elim i j) + [intro. + absurd (j < n) + [assumption + |apply le_to_not_lt. + apply (trans_le ? (j -i)) + [apply divides_to_le + [(*fattorizzare*) + apply (lt_plus_to_lt_l i). + simplify. + rewrite < (plus_minus_m_m) + [assumption|apply lt_to_le.assumption] + |apply (gcd_SO_to_divides_times_to_divides a) + [assumption + |rewrite > sym_gcd.assumption + |apply mod_O_to_divides + [assumption + |rewrite > distr_times_minus. + apply (divides_to_mod_O n (minus (times a j) (times a i)) ? ?); + [ apply (H3). + | apply (eq_mod_to_divides (times a j) (times a i) n ? ?); + [ apply (H3). + |apply (sym_eq nat (mod (times a i) n) (mod (times a j) n) ?). + apply (H13). + ] + ] + ] + ] + ] + | apply (le_minus_m j i). + ] + ] + |intro.assumption + |intro. + absurd (i < n) + [assumption + |apply le_to_not_lt. + apply (trans_le ? (i -j)) + [apply divides_to_le + [(*fattorizzare*) + apply (lt_plus_to_lt_l j). + simplify. + rewrite < (plus_minus_m_m) + [assumption|apply lt_to_le.assumption] + |apply (gcd_SO_to_divides_times_to_divides a) + [assumption + |rewrite > sym_gcd.assumption + |apply mod_O_to_divides + [assumption + |rewrite > distr_times_minus. + apply (divides_to_mod_O n (minus (times a i) (times a j)) ? ?); + [apply (H3). + | apply (eq_mod_to_divides (times a i) (times a j) n ? ?); + [apply (H3). + |apply (H13). + ] + ] + ] + ] + ] + | apply (le_minus_m i j). + ] + ] + ] + ] +qed. + +theorem congruent_exp_totient_SO: \forall n,a:nat. (S O) < n \to +gcd a n = (S O) \to congruent (exp a (totient n)) (S O) n. +intros. +cut (O < a) + [ apply divides_to_congruent + [apply (trans_lt ? (S O)).apply lt_O_S. assumption + |change with (O < exp a (totient n)).apply lt_O_exp.assumption + |apply (gcd_SO_to_divides_times_to_divides (pi_p (\lambda i.eqb (gcd i n) (S O)) n)) + [apply (trans_lt ? (S O)).apply lt_O_S. assumption + |apply gcd_pi_p + [apply (trans_lt ? (S O)).apply lt_O_S. assumption + |apply le_n + ] + |rewrite < sym_times. + rewrite > times_minus_l. + rewrite > (sym_times (S O)). + rewrite < times_n_SO. + rewrite > totient_card. + rewrite > a_times_pi_p. + apply congruent_to_divides + [apply (trans_lt ? (S O)).apply lt_O_S. assumption + | apply (transitive_congruent n ? + (map_iter_p n (\lambda i.eqb (gcd i n) (S O)) (\lambda x.a*x \mod n) (S O) times)) + [apply (congruent_map_iter_p_times ? n n). + apply (trans_lt ? (S O)) + [apply lt_O_S|assumption] + |unfold pi_p. + cut ( (map_iter_p n (\lambda i:nat.eqb (gcd i n) (S O)) (\lambda n:nat.n) (S O) times) + = (map_iter_p n (\lambda i:nat.eqb (gcd i n) (S O)) (\lambda x:nat.a*x\mod n) (S O) times)) + [rewrite < Hcut1.apply congruent_n_n + |apply (eq_map_iter_p_permut ? ? ? ? ? (λm.m)) + [apply assoc_times + |apply sym_times + |apply (permut_p_mod ? ? H Hcut H1) + |simplify. + apply not_eq_to_eqb_false. + unfold.intro. + apply (lt_to_not_eq (S O) n) + [assumption|apply sym_eq.assumption] + ] + ] + ] + ] + ] + ] + |elim (le_to_or_lt_eq O a (le_O_n a)) + [assumption + |absurd (gcd a n = S O) + [assumption + |rewrite < H2. + simplify. + unfold.intro. + apply (lt_to_not_eq (S O) n) + [assumption|apply sym_eq.assumption] + ] + ] + ] +qed. diff --git a/matita/library/nat/exp.ma b/matita/library/nat/exp.ma new file mode 100644 index 000000000..6c25461c1 --- /dev/null +++ b/matita/library/nat/exp.ma @@ -0,0 +1,237 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/div_and_mod.ma". +include "nat/lt_arith.ma". + +let rec exp n m on m\def + match m with + [ O \Rightarrow (S O) + | (S p) \Rightarrow (times n (exp n p)) ]. + +interpretation "natural exponent" 'exp a b = (cic:/matita/nat/exp/exp.con a b). + +theorem exp_plus_times : \forall n,p,q:nat. +n \sup (p + q) = (n \sup p) * (n \sup q). +intros.elim p. +simplify.rewrite < plus_n_O.reflexivity. +simplify.rewrite > H.symmetry. +apply assoc_times. +qed. + +theorem exp_n_O : \forall n:nat. S O = n \sup O. +intro.simplify.reflexivity. +qed. + +theorem exp_n_SO : \forall n:nat. n = n \sup (S O). +intro.simplify.rewrite < times_n_SO.reflexivity. +qed. + +theorem exp_SO_n : \forall n:nat. S O = (S O) \sup n. +intro.elim n + [reflexivity + |simplify.rewrite < plus_n_O.assumption + ] +qed. + +theorem exp_SSO: \forall n. exp n (S(S O)) = n*n. +intro.simplify. +rewrite < times_n_SO. +reflexivity. +qed. + +theorem exp_exp_times : \forall n,p,q:nat. +(n \sup p) \sup q = n \sup (p * q). +intros. +elim q.simplify.rewrite < times_n_O.simplify.reflexivity. +simplify.rewrite > H.rewrite < exp_plus_times. +rewrite < times_n_Sm.reflexivity. +qed. + +theorem lt_O_exp: \forall n,m:nat. O < n \to O < n \sup m. +intros.elim m.simplify.unfold lt.apply le_n. +simplify.unfold lt.rewrite > times_n_SO. +apply le_times.assumption.assumption. +qed. + +theorem lt_m_exp_nm: \forall n,m:nat. (S O) < n \to m < n \sup m. +intros.elim m.simplify.unfold lt.apply le_n. +simplify.unfold lt. +apply (trans_le ? ((S(S O))*(S n1))). +simplify. +rewrite < plus_n_Sm.apply le_S_S.apply le_S_S. +rewrite < sym_plus. +apply le_plus_n. +apply le_times.assumption.assumption. +qed. + +theorem exp_to_eq_O: \forall n,m:nat. (S O) < n +\to n \sup m = (S O) \to m = O. +intros.apply antisym_le.apply le_S_S_to_le. +rewrite < H1.change with (m < n \sup m). +apply lt_m_exp_nm.assumption. +apply le_O_n. +qed. + +theorem injective_exp_r: \forall n:nat. (S O) < n \to +injective nat nat (\lambda m:nat. n \sup m). +simplify.intros 4. +apply (nat_elim2 (\lambda x,y.n \sup x = n \sup y \to x = y)). +intros.apply sym_eq.apply (exp_to_eq_O n).assumption. +rewrite < H1.reflexivity. +intros.apply (exp_to_eq_O n).assumption.assumption. +intros.apply eq_f. +apply H1. +(* esprimere inj_times senza S *) +cut (\forall a,b:nat.O < n \to n*a=n*b \to a=b). +apply Hcut.simplify.unfold lt.apply le_S_S_to_le. apply le_S. assumption. +assumption. +intros 2. +apply (nat_case n). +intros.apply False_ind.apply (not_le_Sn_O O H3). +intros. +apply (inj_times_r m1).assumption. +qed. + +variant inj_exp_r: \forall p:nat. (S O) < p \to \forall n,m:nat. +p \sup n = p \sup m \to n = m \def +injective_exp_r. + +theorem le_exp: \forall n,m,p:nat. O < p \to n \le m \to exp p n \le exp p m. +apply nat_elim2 + [intros. + apply lt_O_exp.assumption + |intros. + apply False_ind. + apply (le_to_not_lt ? ? ? H1). + apply le_O_n + |intros. + simplify. + apply le_times + [apply le_n + |apply H[assumption|apply le_S_S_to_le.assumption] + ] + ] +qed. + +theorem lt_exp: \forall n,m,p:nat. S O < p \to n < m \to exp p n < exp p m. +apply nat_elim2 + [intros. + apply (lt_O_n_elim ? H1).intro. + simplify.unfold lt. + rewrite > times_n_SO. + apply le_times + [assumption + |apply lt_O_exp. + apply (trans_lt ? (S O))[apply le_n|assumption] + ] + |intros. + apply False_ind. + apply (le_to_not_lt ? ? ? H1). + apply le_O_n + |intros.simplify. + apply lt_times_r1 + [apply (trans_lt ? (S O))[apply le_n|assumption] + |apply H + [apply H1 + |apply le_S_S_to_le.assumption + ] + ] + ] +qed. + +theorem lt_exp1: \forall n,m,p:nat. O < p \to n < m \to exp n p < exp m p. +intros. +elim H + [rewrite < exp_n_SO.rewrite < exp_n_SO.assumption + |simplify. + apply lt_times;assumption + ] +qed. + +theorem le_exp_to_le: +\forall a,n,m. S O < a \to exp a n \le exp a m \to n \le m. +intro. +apply nat_elim2;intros + [apply le_O_n + |apply False_ind. + apply (le_to_not_lt ? ? H1). + simplify. + rewrite > times_n_SO. + apply lt_to_le_to_lt_times + [assumption + |apply lt_O_exp.apply lt_to_le.assumption + |apply lt_O_exp.apply lt_to_le.assumption + ] + |simplify in H2. + apply le_S_S. + apply H + [assumption + |apply (le_times_to_le a) + [apply lt_to_le.assumption|assumption] + ] + ] +qed. + +theorem le_exp_to_le1 : \forall n,m,p.O < p \to exp n p \leq exp m p \to n \leq m. +intros;apply not_lt_to_le;intro;apply (lt_to_not_le ? ? ? H1); +apply lt_exp1;assumption. +qed. + +theorem lt_exp_to_lt: +\forall a,n,m. S O < a \to exp a n < exp a m \to n < m. +intros. +elim (le_to_or_lt_eq n m) + [assumption + |apply False_ind. + apply (lt_to_not_eq ? ? H1). + rewrite < H2. + reflexivity + |apply (le_exp_to_le a) + [assumption + |apply lt_to_le. + assumption + ] + ] +qed. + +theorem times_exp: +\forall n,m,p. exp n p * exp m p = exp (n*m) p. +intros.elim p + [simplify.reflexivity + |simplify. + rewrite > assoc_times. + rewrite < assoc_times in ⊢ (? ? (? ? %) ?). + rewrite < sym_times in ⊢ (? ? (? ? (? % ?)) ?). + rewrite > assoc_times in ⊢ (? ? (? ? %) ?). + rewrite < assoc_times. + rewrite < H. + reflexivity + ] +qed. + +theorem monotonic_exp1: \forall n. +monotonic nat le (\lambda x.(exp x n)). +unfold monotonic. intros. +simplify.elim n + [apply le_n + |simplify. + apply le_times;assumption + ] +qed. + + + \ No newline at end of file diff --git a/matita/library/nat/factorial.ma b/matita/library/nat/factorial.ma new file mode 100644 index 000000000..a1fbc863d --- /dev/null +++ b/matita/library/nat/factorial.ma @@ -0,0 +1,61 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/le_arith.ma". + +let rec fact n \def + match n with + [ O \Rightarrow (S O) + | (S m) \Rightarrow (S m)*(fact m)]. + +interpretation "factorial" 'fact n = (cic:/matita/nat/factorial/fact.con n). + +theorem le_SO_fact : \forall n. (S O) \le n!. +intro.elim n.simplify.apply le_n. +change with ((S O) \le (S n1)*n1!). +apply (trans_le ? ((S n1)*(S O))).simplify. +apply le_S_S.apply le_O_n. +apply le_times_r.assumption. +qed. + +theorem le_SSO_fact : \forall n. (S O) < n \to (S(S O)) \le n!. +intro.apply (nat_case n).intro.apply False_ind.apply (not_le_Sn_O (S O) H). +intros.change with ((S (S O)) \le (S m)*m!). +apply (trans_le ? ((S(S O))*(S O))).apply le_n. +apply le_times.exact H.apply le_SO_fact. +qed. + +theorem le_n_fact_n: \forall n. n \le n!. +intro. elim n.apply le_O_n. +change with (S n1 \le (S n1)*n1!). +apply (trans_le ? ((S n1)*(S O))). +rewrite < times_n_SO.apply le_n. +apply le_times.apply le_n. +apply le_SO_fact. +qed. + +theorem lt_n_fact_n: \forall n. (S(S O)) < n \to n < n!. +intro.apply (nat_case n).intro.apply False_ind.apply (not_le_Sn_O (S(S O)) H). +intros.change with ((S m) < (S m)*m!). +apply (lt_to_le_to_lt ? ((S m)*(S (S O)))). +rewrite < sym_times. +simplify.unfold lt. +apply le_S_S.rewrite < plus_n_O. +apply le_plus_n. +apply le_times_r.apply le_SSO_fact. +simplify.unfold lt.apply le_S_S_to_le.exact H. +qed. + diff --git a/matita/library/nat/factorial2.ma b/matita/library/nat/factorial2.ma new file mode 100644 index 000000000..b6c3076c0 --- /dev/null +++ b/matita/library/nat/factorial2.ma @@ -0,0 +1,216 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/exp.ma". +include "nat/factorial.ma". + +theorem factS: \forall n. fact (S n) = (S n)*(fact n). +intro.simplify.reflexivity. +qed. + +theorem exp_S: \forall n,m. exp m (S n) = m*exp m n. +intros.reflexivity. +qed. + +lemma times_SSO: \forall n.(S(S O))*(S n) = S(S((S(S O))*n)). +intro.simplify.rewrite < plus_n_Sm.reflexivity. +qed. + +theorem fact1: \forall n. +fact ((S(S O))*n) \le (exp (S(S O)) ((S(S O))*n))*(fact n)*(fact n). +intro.elim n + [rewrite < times_n_O.apply le_n + |rewrite > times_SSO. + rewrite > factS. + rewrite > factS. + rewrite < assoc_times. + rewrite > factS. + apply (trans_le ? (((S(S O))*(S n1))*((S(S O))*(S n1))*(fact (((S(S O))*n1))))) + [apply le_times_l. + rewrite > times_SSO. + apply le_times_r. + apply le_n_Sn + |rewrite > assoc_times. + rewrite > assoc_times. + rewrite > assoc_times in ⊢ (? ? %). + rewrite > exp_S. + rewrite > assoc_times in ⊢ (? ? %). + apply le_times_r. + rewrite < assoc_times. + rewrite < assoc_times. + rewrite < sym_times in ⊢ (? (? (? % ?) ?) ?). + rewrite > assoc_times. + rewrite > assoc_times. + rewrite > exp_S. + rewrite > assoc_times in ⊢ (? ? %). + apply le_times_r. + rewrite > sym_times in ⊢ (? ? %). + rewrite > assoc_times in ⊢ (? ? %). + rewrite > assoc_times in ⊢ (? ? %). + apply le_times_r. + rewrite < assoc_times in ⊢ (? ? %). + rewrite < assoc_times in ⊢ (? ? %). + rewrite < sym_times in ⊢ (? ? (? (? % ?) ?)). + rewrite > assoc_times in ⊢ (? ? %). + rewrite > assoc_times in ⊢ (? ? %). + apply le_times_r. + rewrite > sym_times in ⊢ (? ? (? ? %)). + rewrite > sym_times in ⊢ (? ? %). + assumption + ] + ] +qed. + +theorem lt_O_fact: \forall n. O < fact n. +intro.elim n + [simplify.apply lt_O_S + |rewrite > factS. + rewrite > (times_n_O O). + apply lt_times + [apply lt_O_S + |assumption + ] + ] +qed. + +theorem fact2: \forall n.O < n \to +(exp (S(S O)) ((S(S O))*n))*(fact n)*(fact n) < fact (S((S(S O))*n)). +intros.elim H + [simplify.apply le_S.apply le_n + |rewrite > times_SSO. + rewrite > factS. + rewrite > factS. + rewrite < assoc_times. + rewrite > factS. + rewrite < times_SSO in ⊢ (? ? %). + apply (trans_lt ? (((S(S O))*S n1)*((S(S O))*S n1*(S ((S(S O))*n1))!))) + [rewrite > assoc_times in ⊢ (? ? %). + rewrite > exp_S. + rewrite > assoc_times. + rewrite > assoc_times. + rewrite > assoc_times. + apply lt_times_r. + rewrite > exp_S. + rewrite > assoc_times. + rewrite > sym_times in ⊢ (? ? %). + rewrite > assoc_times in ⊢ (? ? %). + rewrite > assoc_times in ⊢ (? ? %). + apply lt_times_r. + rewrite > sym_times. + rewrite > assoc_times. + rewrite > assoc_times. + apply lt_times_r. + rewrite < assoc_times. + rewrite < assoc_times. + rewrite > sym_times in ⊢ (? (? (? % ?) ?) ?). + rewrite > assoc_times. + rewrite > assoc_times. + rewrite > sym_times in ⊢ (? ? %). + apply lt_times_r. + rewrite < assoc_times. + rewrite < sym_times. + rewrite < assoc_times. + assumption + |apply lt_times_l1 + [rewrite > (times_n_O O) in ⊢ (? % ?). + apply lt_times + [rewrite > (times_n_O O) in ⊢ (? % ?). + apply lt_times + [apply lt_O_S + |apply lt_O_S + ] + |apply lt_O_fact + ] + |apply le_n + ] + ] + ] +qed. + +(* a slightly better result *) +theorem fact3: \forall n.O < n \to +(exp (S(S O)) ((S(S O))*n))*(exp (fact n) (S(S O))) \le (S(S O))*n*fact ((S(S O))*n). +intros. +elim H + [simplify.apply le_n + |rewrite > times_SSO. + rewrite > factS. + rewrite < times_exp. + change in ⊢ (? (? % ?) ?) with ((S(S O))*((S(S O))*(exp (S(S O)) ((S(S O))*n1)))). + rewrite > assoc_times. + rewrite > assoc_times in ⊢ (? (? ? %) ?). + rewrite < assoc_times in ⊢ (? (? ? (? ? %)) ?). + rewrite < sym_times in ⊢ (? (? ? (? ? (? % ?))) ?). + rewrite > assoc_times in ⊢ (? (? ? (? ? %)) ?). + apply (trans_le ? (((S(S O))*((S(S O))*((S n1)\sup((S(S O)))*((S(S O))*n1*((S(S O))*n1)!)))))) + [apply le_times_r. + apply le_times_r. + apply le_times_r. + assumption + |rewrite > factS. + rewrite > factS. + rewrite < times_SSO. + rewrite > assoc_times in ⊢ (? ? %). + apply le_times_r. + rewrite < assoc_times. + change in ⊢ (? (? (? ? %) ?) ?) with ((S n1)*((S n1)*(S O))). + rewrite < assoc_times in ⊢ (? (? % ?) ?). + rewrite < times_n_SO. + rewrite > sym_times in ⊢ (? (? (? % ?) ?) ?). + rewrite < assoc_times in ⊢ (? ? %). + rewrite < assoc_times in ⊢ (? ? (? % ?)). + apply le_times_r. + apply le_times_l. + apply le_S.apply le_n + ] + ] +qed. + +(* +theorem stirling: \forall n,k.k \le n \to +log (fact n) < n*log n - n + k*log n. +intro. +apply (nat_elim1 n). +intros. +elim (lt_O_to_or_eq_S m) + [elim H2.clear H2. + elim H4.clear H4. + rewrite > H2. + apply (le_to_lt_to_lt ? (log ((exp (S(S O)) ((S(S O))*a))*(fact a)*(fact a)))) + [apply monotonic_log. + apply fact1 + |rewrite > assoc_times in ⊢ (? (? %) ?). + rewrite > log_exp. + apply (le_to_lt_to_lt ? ((S(S O))*a+S(log a!+log a!))) + [apply le_plus_r. + apply log_times + |rewrite < plus_n_Sm. + rewrite > plus_n_O in ⊢ (? (? (? ? (? ? %))) ?). + change with + (S((S(S O))*a+((S(S O))*log a!)) < (S(S O))*a*log ((S(S O))*a)-(S(S O))*a+k*log ((S(S O))*a)). + apply (trans_lt ? (S ((S(S O))*a+(S(S O))*(a*log a-a+k*log a)))) + [apply le_S_S. + apply lt_plus_r. + apply lt_times_r. + apply H. + assumption + | + + [ + + a*log a-a+k*log a + +*) \ No newline at end of file diff --git a/matita/library/nat/factorization.ma b/matita/library/nat/factorization.ma new file mode 100644 index 000000000..e9193c451 --- /dev/null +++ b/matita/library/nat/factorization.ma @@ -0,0 +1,760 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/ord.ma". + +(* the following factorization algorithm looks for the largest prime + factor. *) +definition max_prime_factor \def \lambda n:nat. +(max n (\lambda p:nat.eqb (n \mod (nth_prime p)) O)). + +theorem lt_SO_max_prime: \forall m. S O < m \to +S O < max m (λi:nat.primeb i∧divides_b i m). +intros. +apply (lt_to_le_to_lt ? (smallest_factor m)) + [apply lt_SO_smallest_factor.assumption + |apply f_m_to_le_max + [apply le_smallest_factor_n + |apply true_to_true_to_andb_true + [apply prime_to_primeb_true. + apply prime_smallest_factor_n. + assumption + |apply divides_to_divides_b_true + [apply lt_O_smallest_factor.apply lt_to_le.assumption + |apply divides_smallest_factor_n. + apply lt_to_le.assumption + ] + ] + ] + ] +qed. +(* max_prime_factor is indeed a factor *) +theorem divides_max_prime_factor_n: + \forall n:nat. (S O) < n + \to nth_prime (max_prime_factor n) \divides n. +intros. +apply divides_b_true_to_divides. +apply (f_max_true (\lambda p:nat.eqb (n \mod (nth_prime p)) O) n); +cut (\exists i. nth_prime i = smallest_factor n); + [ elim Hcut. + apply (ex_intro nat ? a); + split; + [ apply (trans_le a (nth_prime a)); + [ apply le_n_fn; + exact lt_nth_prime_n_nth_prime_Sn; + | rewrite > H1; + apply le_smallest_factor_n; ] + | rewrite > H1; + change with (divides_b (smallest_factor n) n = true); + apply divides_to_divides_b_true; + [ apply (trans_lt ? (S O)); + [ unfold lt; apply le_n; + | apply lt_SO_smallest_factor; assumption; ] + | letin x \def le.autobatch new. + (* + apply divides_smallest_factor_n; + apply (trans_lt ? (S O)); + [ unfold lt; apply le_n; + | assumption; ] *) ] ] + | autobatch. + (* + apply prime_to_nth_prime; + apply prime_smallest_factor_n; + assumption; *) ] +qed. + +theorem divides_to_max_prime_factor : \forall n,m. (S O) < n \to O < m \to n \divides m \to +max_prime_factor n \le max_prime_factor m. +intros.unfold max_prime_factor. +apply f_m_to_le_max. +apply (trans_le ? n). +apply le_max_n.apply divides_to_le.assumption.assumption. +change with (divides_b (nth_prime (max_prime_factor n)) m = true). +apply divides_to_divides_b_true. +cut (prime (nth_prime (max_prime_factor n))). +apply lt_O_nth_prime_n.apply prime_nth_prime. +cut (nth_prime (max_prime_factor n) \divides n). +autobatch. +autobatch. +(* + [ apply (transitive_divides ? n); + [ apply divides_max_prime_factor_n. + assumption. + | assumption. + ] + | apply divides_b_true_to_divides; + [ apply lt_O_nth_prime_n. + | apply divides_to_divides_b_true; + [ apply lt_O_nth_prime_n. + | apply divides_max_prime_factor_n. + assumption. + ] + ] + ] +*) +qed. + +theorem divides_to_max_prime_factor1 : \forall n,m. O < n \to O < m \to n \divides m \to +max_prime_factor n \le max_prime_factor m. +intros 3. +elim (le_to_or_lt_eq ? ? H) + [apply divides_to_max_prime_factor + [assumption|assumption|assumption] + |rewrite < H1. + simplify.apply le_O_n. + ] +qed. + +theorem max_prime_factor_to_not_p_ord_O : \forall n,p,r. + (S O) < n \to + p = max_prime_factor n \to + p_ord n (nth_prime p) \neq pair nat nat O r. +intros.unfold Not.intro. +apply (p_ord_O_to_not_divides ? ? ? ? H2) + [apply (trans_lt ? (S O))[apply lt_O_S|assumption] + |rewrite > H1. + apply divides_max_prime_factor_n. + assumption + ] +qed. + +theorem p_ord_to_lt_max_prime_factor: \forall n,p,q,r. O < n \to +p = max_prime_factor n \to +(pair nat nat q r) = p_ord n (nth_prime p) \to +(S O) < r \to max_prime_factor r < p. +intros. +rewrite > H1. +cut (max_prime_factor r \lt max_prime_factor n \lor + max_prime_factor r = max_prime_factor n). +elim Hcut.assumption. +absurd (nth_prime (max_prime_factor n) \divides r). +rewrite < H4. +apply divides_max_prime_factor_n. +assumption.unfold Not. +intro. +cut (r \mod (nth_prime (max_prime_factor n)) \neq O); + [unfold Not in Hcut1.autobatch new. + (* + apply Hcut1.apply divides_to_mod_O; + [ apply lt_O_nth_prime_n. + | assumption. + ] + *) + |letin z \def le. + cut(pair nat nat q r=p_ord_aux n n (nth_prime (max_prime_factor n))); + [2: rewrite < H1.assumption.|letin x \def le.autobatch width = 4 depth = 2] + (* CERCA COME MAI le_n non lo applica se lo trova come Const e non Rel *) + ]. +(* + apply (p_ord_aux_to_not_mod_O n n ? q r); + [ apply lt_SO_nth_prime_n. + | assumption. + | apply le_n. + | rewrite < H1.assumption. + ] + ]. +*) +apply (le_to_or_lt_eq (max_prime_factor r) (max_prime_factor n)). +apply divides_to_max_prime_factor. +assumption.assumption. +apply (witness r n ((nth_prime p) \sup q)). +rewrite < sym_times. +apply (p_ord_aux_to_exp n n ? q r). +apply lt_O_nth_prime_n.assumption. +qed. + +theorem p_ord_to_lt_max_prime_factor1: \forall n,p,q,r. O < n \to +max_prime_factor n \le p \to +(pair nat nat q r) = p_ord n (nth_prime p) \to +(S O) < r \to max_prime_factor r < p. +intros. +cut (max_prime_factor n < p \lor max_prime_factor n = p). +elim Hcut.apply (le_to_lt_to_lt ? (max_prime_factor n)). +apply divides_to_max_prime_factor.assumption.assumption. +apply (witness r n ((nth_prime p) \sup q)). +rewrite > sym_times. +apply (p_ord_aux_to_exp n n). +apply lt_O_nth_prime_n. +assumption.assumption. +apply (p_ord_to_lt_max_prime_factor n ? q). +assumption.apply sym_eq.assumption.assumption.assumption. +apply (le_to_or_lt_eq ? p H1). +qed. + +lemma lt_max_prime_factor_to_not_divides: \forall n,p:nat. +O < n \to n=S O \lor max_prime_factor n < p \to +(nth_prime p \ndivides n). +intros.unfold Not.intro. +elim H1 + [rewrite > H3 in H2. + apply (le_to_not_lt (nth_prime p) (S O)) + [apply divides_to_le[apply le_n|assumption] + |apply lt_SO_nth_prime_n + ] + |apply (not_le_Sn_n p). + change with (p < p). + apply (le_to_lt_to_lt ? ? ? ? H3). + unfold max_prime_factor. + apply f_m_to_le_max + [apply (trans_le ? (nth_prime p)) + [apply lt_to_le. + apply lt_n_nth_prime_n + |apply divides_to_le;assumption + ] + |apply eq_to_eqb_true. + apply divides_to_mod_O + [apply lt_O_nth_prime_n|assumption] + ] + ] +qed. + +(* datatypes and functions *) + +inductive nat_fact : Set \def + nf_last : nat \to nat_fact + | nf_cons : nat \to nat_fact \to nat_fact. + +inductive nat_fact_all : Set \def + nfa_zero : nat_fact_all + | nfa_one : nat_fact_all + | nfa_proper : nat_fact \to nat_fact_all. + +let rec factorize_aux p n acc \def + match p with + [ O \Rightarrow acc + | (S p1) \Rightarrow + match p_ord n (nth_prime p1) with + [ (pair q r) \Rightarrow + factorize_aux p1 r (nf_cons q acc)]]. + +definition factorize : nat \to nat_fact_all \def \lambda n:nat. + match n with + [ O \Rightarrow nfa_zero + | (S n1) \Rightarrow + match n1 with + [ O \Rightarrow nfa_one + | (S n2) \Rightarrow + let p \def (max (S(S n2)) (\lambda p:nat.eqb ((S(S n2)) \mod (nth_prime p)) O)) in + match p_ord (S(S n2)) (nth_prime p) with + [ (pair q r) \Rightarrow + nfa_proper (factorize_aux p r (nf_last (pred q)))]]]. + +let rec defactorize_aux f i \def + match f with + [ (nf_last n) \Rightarrow (nth_prime i) \sup (S n) + | (nf_cons n g) \Rightarrow + (nth_prime i) \sup n *(defactorize_aux g (S i))]. + +definition defactorize : nat_fact_all \to nat \def +\lambda f : nat_fact_all. +match f with +[ nfa_zero \Rightarrow O +| nfa_one \Rightarrow (S O) +| (nfa_proper g) \Rightarrow defactorize_aux g O]. + +theorem lt_O_defactorize_aux: + \forall f:nat_fact. + \forall i:nat. + O < defactorize_aux f i. +intro; elim f; +[1,2: + simplify; unfold lt; + rewrite > times_n_SO; + apply le_times; + [ change with (O < nth_prime i); + apply lt_O_nth_prime_n; + |2,3: + change with (O < exp (nth_prime i) n); + apply lt_O_exp; + apply lt_O_nth_prime_n; + | change with (O < defactorize_aux n1 (S i)); + apply H; ] ] +qed. + +theorem lt_SO_defactorize_aux: \forall f:nat_fact.\forall i:nat. +S O < defactorize_aux f i. +intro.elim f.simplify.unfold lt. +rewrite > times_n_SO. +apply le_times. +change with (S O < nth_prime i). +apply lt_SO_nth_prime_n. +change with (O < exp (nth_prime i) n). +apply lt_O_exp. +apply lt_O_nth_prime_n. +simplify.unfold lt. +rewrite > times_n_SO. +rewrite > sym_times. +apply le_times. +change with (O < exp (nth_prime i) n). +apply lt_O_exp. +apply lt_O_nth_prime_n. +change with (S O < defactorize_aux n1 (S i)). +apply H. +qed. + +theorem defactorize_aux_factorize_aux : +\forall p,n:nat.\forall acc:nat_fact.O < n \to +((n=(S O) \land p=O) \lor max_prime_factor n < p) \to +defactorize_aux (factorize_aux p n acc) O = n*(defactorize_aux acc p). +intro.elim p.simplify. +elim H1.elim H2.rewrite > H3. +rewrite > sym_times. apply times_n_SO. +apply False_ind.apply (not_le_Sn_O (max_prime_factor n) H2). +simplify. +(* generalizing the goal: I guess there exists a better way *) +cut (\forall q,r.(pair nat nat q r) = (p_ord_aux n1 n1 (nth_prime n)) \to +defactorize_aux match (p_ord_aux n1 n1 (nth_prime n)) with +[(pair q r) \Rightarrow (factorize_aux n r (nf_cons q acc))] O = +n1*defactorize_aux acc (S n)). +apply (Hcut (fst ? ? (p_ord_aux n1 n1 (nth_prime n))) +(snd ? ? (p_ord_aux n1 n1 (nth_prime n)))). +apply sym_eq.apply eq_pair_fst_snd. +intros. +rewrite < H3. +simplify. +cut (n1 = r * (nth_prime n) \sup q). +rewrite > H. +simplify.rewrite < assoc_times. +rewrite < Hcut.reflexivity. +cut (O < r \lor O = r). +elim Hcut1.assumption.absurd (n1 = O). +rewrite > Hcut.rewrite < H4.reflexivity. +unfold Not. intro.apply (not_le_Sn_O O). +rewrite < H5 in \vdash (? ? %).assumption. +apply le_to_or_lt_eq.apply le_O_n. +cut ((S O) < r \lor (S O) \nlt r). +elim Hcut1. +right. +apply (p_ord_to_lt_max_prime_factor1 n1 ? q r). +assumption.elim H2. +elim H5. +apply False_ind. +apply (not_eq_O_S n).apply sym_eq.assumption. +apply le_S_S_to_le. +exact H5. +assumption.assumption. +cut (r=(S O)). +apply (nat_case n). +left.split.assumption.reflexivity. +intro.right.rewrite > Hcut2. +simplify.unfold lt.apply le_S_S.apply le_O_n. +cut (r < (S O) ∨ r=(S O)). +elim Hcut2.absurd (O=r). +apply le_n_O_to_eq.apply le_S_S_to_le.exact H5. +unfold Not.intro. +cut (O=n1). +apply (not_le_Sn_O O). +rewrite > Hcut3 in ⊢ (? ? %). +assumption.rewrite > Hcut. +rewrite < H6.reflexivity. +assumption. +apply (le_to_or_lt_eq r (S O)). +apply not_lt_to_le.assumption. +apply (decidable_lt (S O) r). +rewrite > sym_times. +apply (p_ord_aux_to_exp n1 n1). +apply lt_O_nth_prime_n.assumption. +qed. + +theorem defactorize_factorize: \forall n:nat.defactorize (factorize n) = n. +intro. +apply (nat_case n).reflexivity. +intro.apply (nat_case m).reflexivity. +intro. +change with +(let p \def (max (S(S m1)) (\lambda p:nat.eqb ((S(S m1)) \mod (nth_prime p)) O)) in +defactorize (match p_ord (S(S m1)) (nth_prime p) with +[ (pair q r) \Rightarrow + nfa_proper (factorize_aux p r (nf_last (pred q)))])=(S(S m1))). +intro. +(* generalizing the goal; find a better way *) +cut (\forall q,r.(pair nat nat q r) = (p_ord (S(S m1)) (nth_prime p)) \to +defactorize (match p_ord (S(S m1)) (nth_prime p) with +[ (pair q r) \Rightarrow + nfa_proper (factorize_aux p r (nf_last (pred q)))])=(S(S m1))). +apply (Hcut (fst ? ? (p_ord (S(S m1)) (nth_prime p))) +(snd ? ? (p_ord (S(S m1)) (nth_prime p)))). +apply sym_eq.apply eq_pair_fst_snd. +intros. +rewrite < H. +simplify. +cut ((S(S m1)) = (nth_prime p) \sup q *r). +cut (O defactorize_aux_factorize_aux. +change with (r*(nth_prime p) \sup (S (pred q)) = (S(S m1))). +cut ((S (pred q)) = q). +rewrite > Hcut2. +rewrite > sym_times. +apply sym_eq. +apply (p_ord_aux_to_exp (S(S m1))). +apply lt_O_nth_prime_n. +assumption. +(* O < q *) +apply sym_eq. apply S_pred. +cut (O < q \lor O = q). +elim Hcut2.assumption. +absurd (nth_prime p \divides S (S m1)). +apply (divides_max_prime_factor_n (S (S m1))). +unfold lt.apply le_S_S.apply le_S_S. apply le_O_n. +cut ((S(S m1)) = r). +rewrite > Hcut3 in \vdash (? (? ? %)). +change with (nth_prime p \divides r \to False). +intro. +apply (p_ord_aux_to_not_mod_O (S(S m1)) (S(S m1)) (nth_prime p) q r). +apply lt_SO_nth_prime_n. +unfold lt.apply le_S_S.apply le_O_n.apply le_n. +assumption. +apply divides_to_mod_O.apply lt_O_nth_prime_n.assumption. +rewrite > times_n_SO in \vdash (? ? ? %). +rewrite < sym_times. +rewrite > (exp_n_O (nth_prime p)). +rewrite > H1 in \vdash (? ? ? (? (? ? %) ?)). +assumption. +apply le_to_or_lt_eq.apply le_O_n.assumption. +(* e adesso l'ultimo goal. TASSI: che ora non e' piu' l'ultimo :P *) +cut ((S O) < r \lor S O \nlt r). +elim Hcut2. +right. +apply (p_ord_to_lt_max_prime_factor1 (S(S m1)) ? q r). +unfold lt.apply le_S_S. apply le_O_n. +apply le_n. +assumption.assumption. +cut (r=(S O)). +apply (nat_case p). +left.split.assumption.reflexivity. +intro.right.rewrite > Hcut3. +simplify.unfold lt.apply le_S_S.apply le_O_n. +cut (r \lt (S O) \or r=(S O)). +elim Hcut3.absurd (O=r). +apply le_n_O_to_eq.apply le_S_S_to_le.exact H2. +unfold Not.intro. +apply (not_le_Sn_O O). +rewrite > H3 in \vdash (? ? %).assumption.assumption. +apply (le_to_or_lt_eq r (S O)). +apply not_lt_to_le.assumption. +apply (decidable_lt (S O) r). +(* O < r *) +cut (O < r \lor O = r). +elim Hcut1.assumption. +apply False_ind. +apply (not_eq_O_S (S m1)). +rewrite > Hcut.rewrite < H1.rewrite < times_n_O.reflexivity. +apply le_to_or_lt_eq.apply le_O_n. +(* prova del cut *) +apply (p_ord_aux_to_exp (S(S m1))). +apply lt_O_nth_prime_n. +assumption. +(* fine prova cut *) +qed. + +let rec max_p f \def +match f with +[ (nf_last n) \Rightarrow O +| (nf_cons n g) \Rightarrow S (max_p g)]. + +let rec max_p_exponent f \def +match f with +[ (nf_last n) \Rightarrow n +| (nf_cons n g) \Rightarrow max_p_exponent g]. + +theorem divides_max_p_defactorize: \forall f:nat_fact.\forall i:nat. +nth_prime ((max_p f)+i) \divides defactorize_aux f i. +intro. +elim f.simplify.apply (witness ? ? ((nth_prime i) \sup n)). +reflexivity. +change with +(nth_prime (S(max_p n1)+i) \divides +(nth_prime i) \sup n *(defactorize_aux n1 (S i))). +elim (H (S i)). +rewrite > H1. +rewrite < sym_times. +rewrite > assoc_times. +rewrite < plus_n_Sm. +apply (witness ? ? (n2* (nth_prime i) \sup n)). +reflexivity. +qed. + +lemma eq_p_max: \forall n,p,r:nat. O < n \to +O < r \to +r = (S O) \lor (max r (\lambda p:nat.eqb (r \mod (nth_prime p)) O)) < p \to +p = max_prime_factor (r*(nth_prime p)\sup n). +intros. +apply sym_eq. +unfold max_prime_factor. +apply max_spec_to_max. +split + [split + [rewrite > times_n_SO in \vdash (? % ?). + rewrite > sym_times. + apply le_times + [assumption + |apply lt_to_le. + apply (lt_to_le_to_lt ? (nth_prime p)) + [apply lt_n_nth_prime_n + |rewrite > exp_n_SO in \vdash (? % ?). + apply le_exp + [apply lt_O_nth_prime_n + |assumption + ] + ] + ] + |apply eq_to_eqb_true. + apply divides_to_mod_O + [apply lt_O_nth_prime_n + |apply (lt_O_n_elim ? H). + intro. + apply (witness ? ? (r*(nth_prime p \sup m))). + rewrite < assoc_times. + rewrite < sym_times in \vdash (? ? ? (? % ?)). + rewrite > exp_n_SO in \vdash (? ? ? (? (? ? %) ?)). + rewrite > assoc_times. + rewrite < exp_plus_times. + reflexivity + ] + ] + |intros. + apply not_eq_to_eqb_false. + unfold Not.intro. + lapply (mod_O_to_divides ? ? ? H5) + [apply lt_O_nth_prime_n + |cut (Not (divides (nth_prime i) ((nth_prime p)\sup n))) + [elim H2 + [rewrite > H6 in Hletin. + simplify in Hletin. + rewrite < plus_n_O in Hletin. + apply Hcut.assumption + |elim (divides_times_to_divides ? ? ? ? Hletin) + [apply (lt_to_not_le ? ? H3). + apply lt_to_le. + apply (le_to_lt_to_lt ? ? ? ? H6). + apply f_m_to_le_max + [apply (trans_le ? (nth_prime i)) + [apply lt_to_le. + apply lt_n_nth_prime_n + |apply divides_to_le[assumption|assumption] + ] + |apply eq_to_eqb_true. + apply divides_to_mod_O + [apply lt_O_nth_prime_n|assumption] + ] + |apply prime_nth_prime + |apply Hcut.assumption + ] + ] + |unfold Not.intro. + apply (lt_to_not_eq ? ? H3). + apply sym_eq. + elim (prime_nth_prime p). + apply injective_nth_prime. + apply H8 + [apply (divides_exp_to_divides ? ? ? ? H6). + apply prime_nth_prime. + |apply lt_SO_nth_prime_n + ] + ] + ] + ] +qed. + +theorem not_divides_defactorize_aux: \forall f:nat_fact. \forall i,j:nat. +i < j \to nth_prime i \ndivides defactorize_aux f j. +intro.elim f. +change with +(nth_prime i \divides (nth_prime j) \sup (S n) \to False). +intro.absurd ((nth_prime i) = (nth_prime j)). +apply (divides_exp_to_eq ? ? (S n)). +apply prime_nth_prime.apply prime_nth_prime. +assumption.unfold Not. +intro.cut (i = j). +apply (not_le_Sn_n i).rewrite > Hcut in \vdash (? ? %).assumption. +apply (injective_nth_prime ? ? H2). +unfold Not.simplify. +intro. +cut (nth_prime i \divides (nth_prime j) \sup n +\lor nth_prime i \divides defactorize_aux n1 (S j)). +elim Hcut. +absurd ((nth_prime i) = (nth_prime j)). +apply (divides_exp_to_eq ? ? n). +apply prime_nth_prime.apply prime_nth_prime. +assumption.unfold Not. +intro. +cut (i = j). +apply (not_le_Sn_n i).rewrite > Hcut1 in \vdash (? ? %).assumption. +apply (injective_nth_prime ? ? H4). +apply (H i (S j)). +apply (trans_lt ? j).assumption.unfold lt.apply le_n. +assumption. +apply divides_times_to_divides. +apply prime_nth_prime.assumption. +qed. + +lemma not_eq_nf_last_nf_cons: \forall g:nat_fact.\forall n,m,i:nat. +\lnot (defactorize_aux (nf_last n) i= defactorize_aux (nf_cons m g) i). +intros. +change with +(exp (nth_prime i) (S n) = defactorize_aux (nf_cons m g) i \to False). +intro. +cut (S(max_p g)+i= i). +apply (not_le_Sn_n i). +rewrite < Hcut in \vdash (? ? %). +simplify.apply le_S_S. +apply le_plus_n. +apply injective_nth_prime. +apply (divides_exp_to_eq ? ? (S n)). +apply prime_nth_prime.apply prime_nth_prime. +rewrite > H. +change with (divides (nth_prime ((max_p (nf_cons m g))+i)) +(defactorize_aux (nf_cons m g) i)). +apply divides_max_p_defactorize. +qed. + +lemma not_eq_nf_cons_O_nf_cons: \forall f,g:nat_fact.\forall n,i:nat. +\lnot (defactorize_aux (nf_cons O f) i= defactorize_aux (nf_cons (S n) g) i). +intros. +simplify.unfold Not.rewrite < plus_n_O. +intro. +apply (not_divides_defactorize_aux f i (S i) ?). +unfold lt.apply le_n. +rewrite > H. +rewrite > assoc_times. +apply (witness ? ? ((exp (nth_prime i) n)*(defactorize_aux g (S i)))). +reflexivity. +qed. + +theorem eq_defactorize_aux_to_eq: \forall f,g:nat_fact.\forall i:nat. +defactorize_aux f i = defactorize_aux g i \to f = g. +intro. +elim f. +generalize in match H. +elim g. +apply eq_f. +apply inj_S. apply (inj_exp_r (nth_prime i)). +apply lt_SO_nth_prime_n. +assumption. +apply False_ind. +apply (not_eq_nf_last_nf_cons n2 n n1 i H2). +generalize in match H1. +elim g. +apply False_ind. +apply (not_eq_nf_last_nf_cons n1 n2 n i). +apply sym_eq. assumption. +simplify in H3. +generalize in match H3. +apply (nat_elim2 (\lambda n,n2. +((nth_prime i) \sup n)*(defactorize_aux n1 (S i)) = +((nth_prime i) \sup n2)*(defactorize_aux n3 (S i)) \to +nf_cons n n1 = nf_cons n2 n3)). +intro. +elim n4. apply eq_f. +apply (H n3 (S i)). +simplify in H4. +rewrite > plus_n_O. +rewrite > (plus_n_O (defactorize_aux n3 (S i))).assumption. +apply False_ind. +apply (not_eq_nf_cons_O_nf_cons n1 n3 n5 i).assumption. +intros. +apply False_ind. +apply (not_eq_nf_cons_O_nf_cons n3 n1 n4 i). +apply sym_eq.assumption. +intros. +cut (nf_cons n4 n1 = nf_cons m n3). +cut (n4=m). +cut (n1=n3). +rewrite > Hcut1.rewrite > Hcut2.reflexivity. +change with +(match nf_cons n4 n1 with +[ (nf_last m) \Rightarrow n1 +| (nf_cons m g) \Rightarrow g ] = n3). +rewrite > Hcut.simplify.reflexivity. +change with +(match nf_cons n4 n1 with +[ (nf_last m) \Rightarrow m +| (nf_cons m g) \Rightarrow m ] = m). +rewrite > Hcut.simplify.reflexivity. +apply H4.simplify in H5. +apply (inj_times_r1 (nth_prime i)). +apply lt_O_nth_prime_n. +rewrite < assoc_times.rewrite < assoc_times.assumption. +qed. + +theorem injective_defactorize_aux: \forall i:nat. +injective nat_fact nat (\lambda f.defactorize_aux f i). +simplify. +intros. +apply (eq_defactorize_aux_to_eq x y i H). +qed. + +theorem injective_defactorize: +injective nat_fact_all nat defactorize. +unfold injective. +change with (\forall f,g.defactorize f = defactorize g \to f=g). +intro.elim f. +generalize in match H.elim g. +(* zero - zero *) +reflexivity. +(* zero - one *) +simplify in H1. +apply False_ind. +apply (not_eq_O_S O H1). +(* zero - proper *) +simplify in H1. +apply False_ind. +apply (not_le_Sn_n O). +rewrite > H1 in \vdash (? ? %). +change with (O < defactorize_aux n O). +apply lt_O_defactorize_aux. +generalize in match H. +elim g. +(* one - zero *) +simplify in H1. +apply False_ind. +apply (not_eq_O_S O).apply sym_eq. assumption. +(* one - one *) +reflexivity. +(* one - proper *) +simplify in H1. +apply False_ind. +apply (not_le_Sn_n (S O)). +rewrite > H1 in \vdash (? ? %). +change with ((S O) < defactorize_aux n O). +apply lt_SO_defactorize_aux. +generalize in match H.elim g. +(* proper - zero *) +simplify in H1. +apply False_ind. +apply (not_le_Sn_n O). +rewrite < H1 in \vdash (? ? %). +change with (O < defactorize_aux n O). +apply lt_O_defactorize_aux. +(* proper - one *) +simplify in H1. +apply False_ind. +apply (not_le_Sn_n (S O)). +rewrite < H1 in \vdash (? ? %). +change with ((S O) < defactorize_aux n O). +apply lt_SO_defactorize_aux. +(* proper - proper *) +apply eq_f. +apply (injective_defactorize_aux O). +exact H1. +qed. + +theorem factorize_defactorize: +\forall f: nat_fact_all. factorize (defactorize f) = f. +intros. +apply injective_defactorize. +apply defactorize_factorize. +qed. diff --git a/matita/library/nat/fermat_little_theorem.ma b/matita/library/nat/fermat_little_theorem.ma new file mode 100644 index 000000000..e14a8e443 --- /dev/null +++ b/matita/library/nat/fermat_little_theorem.ma @@ -0,0 +1,259 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/exp.ma". +include "nat/gcd.ma". +include "nat/permutation.ma". +include "nat/congruence.ma". + +theorem permut_S_mod: \forall n:nat. permut (S_mod (S n)) n. +intro.unfold permut.split.intros. +unfold S_mod. +apply le_S_S_to_le. +change with ((S i) \mod (S n) < S n). +apply lt_mod_m_m. +unfold lt.apply le_S_S.apply le_O_n. +unfold injn.intros. +apply inj_S. +rewrite < (lt_to_eq_mod i (S n)). +rewrite < (lt_to_eq_mod j (S n)). +cut (i < n \lor i = n). +cut (j < n \lor j = n). +elim Hcut. +elim Hcut1. +(* i < n, j< n *) +rewrite < mod_S. +rewrite < mod_S. +apply H2.unfold lt.apply le_S_S.apply le_O_n. +rewrite > lt_to_eq_mod. +unfold lt.apply le_S_S.assumption. +unfold lt.apply le_S_S.assumption. +unfold lt.apply le_S_S.apply le_O_n. +rewrite > lt_to_eq_mod. +unfold lt.apply le_S_S.assumption. +unfold lt.apply le_S_S.assumption. +(* i < n, j=n *) +unfold S_mod in H2. +simplify. +apply False_ind. +apply (not_eq_O_S (i \mod (S n))). +apply sym_eq. +rewrite < (mod_n_n (S n)). +rewrite < H4 in \vdash (? ? ? (? %?)). +rewrite < mod_S.assumption. +unfold lt.apply le_S_S.apply le_O_n. +rewrite > lt_to_eq_mod. +unfold lt.apply le_S_S.assumption. +unfold lt.apply le_S_S.assumption. +unfold lt.apply le_S_S.apply le_O_n. +(* i = n, j < n *) +elim Hcut1. +apply False_ind. +apply (not_eq_O_S (j \mod (S n))). +rewrite < (mod_n_n (S n)). +rewrite < H3 in \vdash (? ? (? %?) ?). +rewrite < mod_S.assumption. +unfold lt.apply le_S_S.apply le_O_n. +rewrite > lt_to_eq_mod. +unfold lt.apply le_S_S.assumption. +unfold lt.apply le_S_S.assumption. +unfold lt.apply le_S_S.apply le_O_n. +(* i = n, j= n*) +rewrite > H3. +rewrite > H4. +reflexivity. +apply le_to_or_lt_eq.assumption. +apply le_to_or_lt_eq.assumption. +unfold lt.apply le_S_S.assumption. +unfold lt.apply le_S_S.assumption. +qed. + +(* +theorem eq_fact_pi: \forall n,m:nat. n < m \to n! = pi n (S_mod m). +intro.elim n. +simplify.reflexivity. +change with (S n1)*n1!=(S_mod m n1)*(pi n1 (S_mod m)). +unfold S_mod in \vdash (? ? ? (? % ?)). +rewrite > lt_to_eq_mod. +apply eq_f.apply H.apply (trans_lt ? (S n1)). +simplify. apply le_n.assumption.assumption. +qed. +*) + +theorem prime_to_not_divides_fact: \forall p:nat. prime p \to \forall n:nat. +n \lt p \to \not divides p n!. +intros 3.elim n.unfold Not.intros. +apply (lt_to_not_le (S O) p). +unfold prime in H.elim H. +assumption.apply divides_to_le.unfold lt.apply le_n. +assumption. +change with (divides p ((S n1)*n1!) \to False). +intro. +cut (divides p (S n1) \lor divides p n1!). +elim Hcut.apply (lt_to_not_le (S n1) p). +assumption. +apply divides_to_le.unfold lt.apply le_S_S.apply le_O_n. +assumption.apply H1. +apply (trans_lt ? (S n1)).unfold lt. apply le_n. +assumption.assumption. +apply divides_times_to_divides. +assumption.assumption. +qed. + +theorem permut_mod: \forall p,a:nat. prime p \to +\lnot divides p a\to permut (\lambda n.(mod (a*n) p)) (pred p). +unfold permut.intros. +split.intros.apply le_S_S_to_le. +apply (trans_le ? p). +change with (mod (a*i) p < p). +apply lt_mod_m_m. +unfold prime in H.elim H. +unfold lt.apply (trans_le ? (S (S O))). +apply le_n_Sn.assumption. +rewrite < S_pred.apply le_n. +unfold prime in H. +elim H. +apply (trans_lt ? (S O)).unfold lt.apply le_n.assumption. +unfold injn.intros. +apply (nat_compare_elim i j). +(* i < j *) +intro. +absurd (j-i \lt p). +unfold lt. +rewrite > (S_pred p). +apply le_S_S. +apply le_plus_to_minus. +apply (trans_le ? (pred p)).assumption. +rewrite > sym_plus. +apply le_plus_n. +unfold prime in H. +elim H. +apply (trans_lt ? (S O)).unfold lt.apply le_n.assumption. +apply (le_to_not_lt p (j-i)). +apply divides_to_le.unfold lt. +apply le_SO_minus.assumption. +cut (divides p a \lor divides p (j-i)). +elim Hcut.apply False_ind.apply H1.assumption.assumption. +apply divides_times_to_divides.assumption. +rewrite > distr_times_minus. +apply eq_mod_to_divides. +unfold prime in H. +elim H. +apply (trans_lt ? (S O)).unfold lt.apply le_n.assumption. +apply sym_eq. +apply H4. +(* i = j *) +intro. assumption. +(* j < i *) +intro. +absurd (i-j \lt p). +unfold lt. +rewrite > (S_pred p). +apply le_S_S. +apply le_plus_to_minus. +apply (trans_le ? (pred p)).assumption. +rewrite > sym_plus. +apply le_plus_n. +unfold prime in H. +elim H. +apply (trans_lt ? (S O)).unfold lt.apply le_n.assumption. +apply (le_to_not_lt p (i-j)). +apply divides_to_le.unfold lt. +apply le_SO_minus.assumption. +cut (divides p a \lor divides p (i-j)). +elim Hcut.apply False_ind.apply H1.assumption.assumption. +apply divides_times_to_divides.assumption. +rewrite > distr_times_minus. +apply eq_mod_to_divides. +unfold prime in H. +elim H. +apply (trans_lt ? (S O)).unfold lt.apply le_n.assumption. +apply H4. +qed. + +theorem congruent_exp_pred_SO: \forall p,a:nat. prime p \to \lnot divides p a \to +congruent (exp a (pred p)) (S O) p. +intros. +cut (O < a) + [cut (O < p) + [cut (O < pred p) + [apply divides_to_congruent + [assumption + |change with (O < exp a (pred p)).apply lt_O_exp.assumption + |cut (divides p (exp a (pred p)-(S O)) \lor divides p (pred p)!) + [elim Hcut3 + [assumption + |apply False_ind. + apply (prime_to_not_divides_fact p H (pred p)) + [unfold lt.rewrite < (S_pred ? Hcut1).apply le_n. + |assumption + ] + ] + |apply divides_times_to_divides + [assumption + |rewrite > times_minus_l. + rewrite > (sym_times (S O)). + rewrite < times_n_SO. + rewrite > (S_pred (pred p) Hcut2). + rewrite > eq_fact_pi. + rewrite > exp_pi_l. + apply congruent_to_divides + [assumption + | apply (transitive_congruent p ? + (pi (pred (pred p)) (\lambda m. a*m \mod p) (S O))) + [ apply (congruent_pi (\lambda m. a*m)).assumption + |cut (pi (pred(pred p)) (\lambda m.m) (S O) + = pi (pred(pred p)) (\lambda m.a*m \mod p) (S O)) + [rewrite > Hcut3.apply congruent_n_n + |rewrite < eq_map_iter_i_pi. + rewrite < eq_map_iter_i_pi. + apply (permut_to_eq_map_iter_i ? ? ? ? ? (λm.m)) + [apply assoc_times + |apply sym_times + |rewrite < plus_n_Sm. + rewrite < plus_n_O. + rewrite < (S_pred ? Hcut2). + apply permut_mod[assumption|assumption] + |intros. + cut (m=O) + [rewrite > Hcut3. + rewrite < times_n_O. + apply mod_O_n. + |apply sym_eq.apply le_n_O_to_eq.apply le_S_S_to_le.assumption + ] + ] + ] + ] + ] + ] + ] + ] + |unfold lt.apply le_S_S_to_le.rewrite < (S_pred ? Hcut1). + unfold prime in H.elim H.assumption + ] + |unfold prime in H.elim H. + apply (trans_lt ? (S O))[unfold lt.apply le_n|assumption] + ] + |cut (O < a \lor O = a) + [elim Hcut + [assumption + |apply False_ind.apply H1.rewrite < H2.apply (witness ? ? O).apply times_n_O + ] + |apply le_to_or_lt_eq.apply le_O_n + ] + ] +qed. + diff --git a/matita/library/nat/gcd.ma b/matita/library/nat/gcd.ma new file mode 100644 index 000000000..8e067de9e --- /dev/null +++ b/matita/library/nat/gcd.ma @@ -0,0 +1,906 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/primes.ma". +include "nat/lt_arith.ma". + +let rec gcd_aux p m n: nat \def +match divides_b n m with +[ true \Rightarrow n +| false \Rightarrow + match p with + [O \Rightarrow n + |(S q) \Rightarrow gcd_aux q n (m \mod n)]]. + +definition gcd : nat \to nat \to nat \def +\lambda n,m:nat. + match leb n m with + [ true \Rightarrow + match n with + [ O \Rightarrow m + | (S p) \Rightarrow gcd_aux (S p) m (S p) ] + | false \Rightarrow + match m with + [ O \Rightarrow n + | (S p) \Rightarrow gcd_aux (S p) n (S p) ]]. + +theorem divides_mod: \forall p,m,n:nat. O < n \to p \divides m \to p \divides n \to +p \divides (m \mod n). +intros.elim H1.elim H2. +(* apply (witness ? ? (n2 - n1*(m / n))). *) +apply witness[| +rewrite > distr_times_minus. +rewrite < H3 in \vdash (? ? ? (? % ?)). +rewrite < assoc_times. +rewrite < H4 in \vdash (? ? ? (? ? (? % ?))). +apply sym_eq.apply plus_to_minus. +rewrite > sym_times. +letin x \def div. +rewrite < (div_mod ? ? H). +reflexivity. +] +qed. + +theorem divides_mod_to_divides: \forall p,m,n:nat. O < n \to +p \divides (m \mod n) \to p \divides n \to p \divides m. +intros.elim H1.elim H2. +apply (witness p m ((n1*(m / n))+n2)). +rewrite > distr_times_plus. +rewrite < H3. +rewrite < assoc_times. +rewrite < H4.rewrite < sym_times. +apply div_mod.assumption. +qed. + +theorem divides_gcd_aux_mn: \forall p,m,n. O < n \to n \le m \to n \le p \to +gcd_aux p m n \divides m \land gcd_aux p m n \divides n. +intro.elim p. +absurd (O < n).assumption.apply le_to_not_lt.assumption. +cut ((n1 \divides m) \lor (n1 \ndivides m)). +simplify. +elim Hcut.rewrite > divides_to_divides_b_true. +simplify. +split.assumption.apply (witness n1 n1 (S O)).apply times_n_SO. +assumption.assumption. +rewrite > not_divides_to_divides_b_false. +simplify. +cut (gcd_aux n n1 (m \mod n1) \divides n1 \land +gcd_aux n n1 (m \mod n1) \divides mod m n1). +elim Hcut1. +split.apply (divides_mod_to_divides ? ? n1). +assumption.assumption.assumption.assumption. +apply H. +cut (O \lt m \mod n1 \lor O = mod m n1). +elim Hcut1.assumption. +apply False_ind.apply H4.apply mod_O_to_divides. +assumption.apply sym_eq.assumption. +apply le_to_or_lt_eq.apply le_O_n. +apply lt_to_le. +apply lt_mod_m_m.assumption. +apply le_S_S_to_le. +apply (trans_le ? n1). +change with (m \mod n1 < n1). +apply lt_mod_m_m.assumption.assumption. +assumption.assumption. +apply (decidable_divides n1 m).assumption. +qed. + +theorem divides_gcd_nm: \forall n,m. +gcd n m \divides m \land gcd n m \divides n. +intros. +(*CSC: simplify simplifies too much because of a redex in gcd *) +change with +(match leb n m with + [ true \Rightarrow + match n with + [ O \Rightarrow m + | (S p) \Rightarrow gcd_aux (S p) m (S p) ] + | false \Rightarrow + match m with + [ O \Rightarrow n + | (S p) \Rightarrow gcd_aux (S p) n (S p) ] ] \divides m +\land +match leb n m with + [ true \Rightarrow + match n with + [ O \Rightarrow m + | (S p) \Rightarrow gcd_aux (S p) m (S p) ] + | false \Rightarrow + match m with + [ O \Rightarrow n + | (S p) \Rightarrow gcd_aux (S p) n (S p) ] ] \divides n). +apply (leb_elim n m). +apply (nat_case1 n). +simplify.intros.split. +apply (witness m m (S O)).apply times_n_SO. +apply (witness m O O).apply times_n_O. +intros.change with +(gcd_aux (S m1) m (S m1) \divides m +\land +gcd_aux (S m1) m (S m1) \divides (S m1)). +apply divides_gcd_aux_mn. +unfold lt.apply le_S_S.apply le_O_n. +assumption.apply le_n. +simplify.intro. +apply (nat_case1 m). +simplify.intros.split. +apply (witness n O O).apply times_n_O. +apply (witness n n (S O)).apply times_n_SO. +intros.change with +(gcd_aux (S m1) n (S m1) \divides (S m1) +\land +gcd_aux (S m1) n (S m1) \divides n). +cut (gcd_aux (S m1) n (S m1) \divides n +\land +gcd_aux (S m1) n (S m1) \divides S m1). +elim Hcut.split.assumption.assumption. +apply divides_gcd_aux_mn. +unfold lt.apply le_S_S.apply le_O_n. +apply not_lt_to_le.unfold Not. unfold lt.intro.apply H. +rewrite > H1.apply (trans_le ? (S n)). +apply le_n_Sn.assumption.apply le_n. +qed. + +theorem divides_gcd_n: \forall n,m. gcd n m \divides n. +intros. +exact (proj2 ? ? (divides_gcd_nm n m)). +qed. + +theorem divides_gcd_m: \forall n,m. gcd n m \divides m. +intros. +exact (proj1 ? ? (divides_gcd_nm n m)). +qed. + + +theorem divides_times_gcd_aux: \forall p,m,n,d,c. +O \lt c \to O < n \to n \le m \to n \le p \to +d \divides (c*m) \to d \divides (c*n) \to d \divides c*gcd_aux p m n. +intro. +elim p +[ absurd (O < n) + [ assumption + | apply le_to_not_lt. + assumption + ] +| simplify. + cut (n1 \divides m \lor n1 \ndivides m) + [ elim Hcut + [ rewrite > divides_to_divides_b_true + [ simplify. + assumption + | assumption + | assumption + ] + | rewrite > not_divides_to_divides_b_false + [ simplify. + apply H + [ assumption + | cut (O \lt m \mod n1 \lor O = m \mod n1) + [ elim Hcut1 + [ assumption + | absurd (n1 \divides m) + [ apply mod_O_to_divides + [ assumption + | apply sym_eq. + assumption + ] + | assumption + ] + ] + | apply le_to_or_lt_eq. + apply le_O_n + ] + | apply lt_to_le. + apply lt_mod_m_m. + assumption + | apply le_S_S_to_le. + apply (trans_le ? n1) + [ change with (m \mod n1 < n1). + apply lt_mod_m_m. + assumption + | assumption + ] + | assumption + | rewrite < times_mod + [ rewrite < (sym_times c m). + rewrite < (sym_times c n1). + apply divides_mod + [ rewrite > (S_pred c) + [ rewrite > (S_pred n1) + [ apply (lt_O_times_S_S) + | assumption + ] + | assumption + ] + | assumption + | assumption + ] + | assumption + | assumption + ] + ] + | assumption + | assumption + ] + ] + | apply (decidable_divides n1 m). + assumption + ] +] +qed. + +(*a particular case of the previous theorem (setting c=1)*) +theorem divides_gcd_aux: \forall p,m,n,d. O < n \to n \le m \to n \le p \to +d \divides m \to d \divides n \to d \divides gcd_aux p m n. +intros. +rewrite > (times_n_SO (gcd_aux p m n)). +rewrite < (sym_times (S O)). +apply (divides_times_gcd_aux) +[ apply (lt_O_S O) +| assumption +| assumption +| assumption +| rewrite > (sym_times (S O)). + rewrite < (times_n_SO m). + assumption +| rewrite > (sym_times (S O)). + rewrite < (times_n_SO n). + assumption +] +qed. + +theorem divides_d_times_gcd: \forall m,n,d,c. +O \lt c \to d \divides (c*m) \to d \divides (c*n) \to d \divides c*gcd n m. +intros. +change with +(d \divides c * +match leb n m with + [ true \Rightarrow + match n with + [ O \Rightarrow m + | (S p) \Rightarrow gcd_aux (S p) m (S p) ] + | false \Rightarrow + match m with + [ O \Rightarrow n + | (S p) \Rightarrow gcd_aux (S p) n (S p) ]]). +apply (leb_elim n m) +[ apply (nat_case1 n) + [ simplify. + intros. + assumption + | intros. + change with (d \divides c*gcd_aux (S m1) m (S m1)). + apply divides_times_gcd_aux + [ assumption + | unfold lt. + apply le_S_S. + apply le_O_n + | assumption + | apply (le_n (S m1)) + | assumption + | rewrite < H3. + assumption + ] + ] +| apply (nat_case1 m) + [ simplify. + intros. + assumption + | intros. + change with (d \divides c * gcd_aux (S m1) n (S m1)). + apply divides_times_gcd_aux + [ unfold lt. + change with (O \lt c). + assumption + | apply lt_O_S + | apply lt_to_le. + apply not_le_to_lt. + assumption + | apply (le_n (S m1)). + | assumption + | rewrite < H3. + assumption + ] + ] +] +qed. + +(*a particular case of the previous theorem (setting c=1)*) +theorem divides_d_gcd: \forall m,n,d. +d \divides m \to d \divides n \to d \divides gcd n m. +intros. +rewrite > (times_n_SO (gcd n m)). +rewrite < (sym_times (S O)). +apply (divides_d_times_gcd) +[ apply (lt_O_S O) +| rewrite > (sym_times (S O)). + rewrite < (times_n_SO m). + assumption +| rewrite > (sym_times (S O)). + rewrite < (times_n_SO n). + assumption +] +qed. + +theorem eq_minus_gcd_aux: \forall p,m,n.O < n \to n \le m \to n \le p \to +\exists a,b. a*n - b*m = gcd_aux p m n \lor b*m - a*n = gcd_aux p m n. +intro. +elim p + [absurd (O < n) + [assumption + |apply le_to_not_lt.assumption + ] + |cut (O < m) + [cut (n1 \divides m \lor n1 \ndivides m) + [simplify. + elim Hcut1 + [rewrite > divides_to_divides_b_true + [simplify. + apply (ex_intro ? ? (S O)). + apply (ex_intro ? ? O). + left. + simplify. + rewrite < plus_n_O. + apply sym_eq. + apply minus_n_O + |assumption + |assumption + ] + |rewrite > not_divides_to_divides_b_false + [change with + (\exists a,b.a*n1 - b*m = gcd_aux n n1 (m \mod n1) + \lor b*m - a*n1 = gcd_aux n n1 (m \mod n1)). + cut + (\exists a,b.a*(m \mod n1) - b*n1= gcd_aux n n1 (m \mod n1) + \lor b*n1 - a*(m \mod n1) = gcd_aux n n1 (m \mod n1)) + [elim Hcut2.elim H5.elim H6 + [(* first case *) + rewrite < H7. + apply (ex_intro ? ? (a1+a*(m / n1))). + apply (ex_intro ? ? a). + right. + rewrite < sym_plus. + rewrite < (sym_times n1). + rewrite > distr_times_plus. + rewrite > (sym_times n1). + rewrite > (sym_times n1). + rewrite > (div_mod m n1) in \vdash (? ? (? % ?) ?) + [rewrite > assoc_times. + rewrite < sym_plus. + rewrite > distr_times_plus. + rewrite < eq_minus_minus_minus_plus. + rewrite < sym_plus. + rewrite < plus_minus + [rewrite < minus_n_n.reflexivity + |apply le_n + ] + |assumption + ] + |(* second case *) + rewrite < H7. + apply (ex_intro ? ? (a1+a*(m / n1))). + apply (ex_intro ? ? a). + left. + (* clear Hcut2.clear H5.clear H6.clear H. *) + rewrite > sym_times. + rewrite > distr_times_plus. + rewrite > sym_times. + rewrite > (sym_times n1). + rewrite > (div_mod m n1) in \vdash (? ? (? ? %) ?) + [rewrite > distr_times_plus. + rewrite > assoc_times. + rewrite < eq_minus_minus_minus_plus. + rewrite < sym_plus. + rewrite < plus_minus + [rewrite < minus_n_n.reflexivity + |apply le_n + ] + |assumption + ] + ] + |apply (H n1 (m \mod n1)) + [cut (O \lt m \mod n1 \lor O = m \mod n1) + [elim Hcut2 + [assumption + |absurd (n1 \divides m) + [apply mod_O_to_divides + [assumption + |symmetry.assumption + ] + |assumption + ] + ] + |apply le_to_or_lt_eq. + apply le_O_n + ] + |apply lt_to_le. + apply lt_mod_m_m. + assumption + |apply le_S_S_to_le. + apply (trans_le ? n1) + [change with (m \mod n1 < n1). + apply lt_mod_m_m. + assumption + |assumption + ] + ] + ] + |assumption + |assumption + ] + ] + |apply (decidable_divides n1 m). + assumption + ] + |apply (lt_to_le_to_lt ? n1);assumption + ] + ] +qed. + +theorem eq_minus_gcd: + \forall m,n.\exists a,b.a*n - b*m = (gcd n m) \lor b*m - a*n = (gcd n m). +intros. +unfold gcd. +apply (leb_elim n m). +apply (nat_case1 n). +simplify.intros. +apply (ex_intro ? ? O). +apply (ex_intro ? ? (S O)). +right.simplify. +rewrite < plus_n_O. +apply sym_eq.apply minus_n_O. +intros. +change with +(\exists a,b. +a*(S m1) - b*m = (gcd_aux (S m1) m (S m1)) +\lor b*m - a*(S m1) = (gcd_aux (S m1) m (S m1))). +apply eq_minus_gcd_aux. +unfold lt. apply le_S_S.apply le_O_n. +assumption.apply le_n. +apply (nat_case1 m). +simplify.intros. +apply (ex_intro ? ? (S O)). +apply (ex_intro ? ? O). +left.simplify. +rewrite < plus_n_O. +apply sym_eq.apply minus_n_O. +intros. +change with +(\exists a,b. +a*n - b*(S m1) = (gcd_aux (S m1) n (S m1)) +\lor b*(S m1) - a*n = (gcd_aux (S m1) n (S m1))). +cut +(\exists a,b. +a*(S m1) - b*n = (gcd_aux (S m1) n (S m1)) +\lor +b*n - a*(S m1) = (gcd_aux (S m1) n (S m1))). +elim Hcut.elim H2.elim H3. +apply (ex_intro ? ? a1). +apply (ex_intro ? ? a). +right.assumption. +apply (ex_intro ? ? a1). +apply (ex_intro ? ? a). +left.assumption. +apply eq_minus_gcd_aux. +unfold lt. apply le_S_S.apply le_O_n. +apply lt_to_le.apply not_le_to_lt.assumption. +apply le_n. +qed. + +(* some properties of gcd *) + +theorem gcd_O_n: \forall n:nat. gcd O n = n. +intro.simplify.reflexivity. +qed. + +theorem gcd_O_to_eq_O:\forall m,n:nat. (gcd m n) = O \to +m = O \land n = O. +intros.cut (O \divides n \land O \divides m). +elim Hcut.elim H2.split. +assumption.elim H1.assumption. +rewrite < H. +apply divides_gcd_nm. +qed. + +theorem lt_O_gcd:\forall m,n:nat. O < n \to O < gcd m n. +intros. +apply (nat_case1 (gcd m n)). +intros. +generalize in match (gcd_O_to_eq_O m n H1). +intros.elim H2. +rewrite < H4 in \vdash (? ? %).assumption. +intros.unfold lt.apply le_S_S.apply le_O_n. +qed. + +theorem gcd_n_n: \forall n.gcd n n = n. +intro.elim n + [reflexivity + |apply le_to_le_to_eq + [apply divides_to_le + [apply lt_O_S + |apply divides_gcd_n + ] + |apply divides_to_le + [apply lt_O_gcd.apply lt_O_S + |apply divides_d_gcd + [apply divides_n_n|apply divides_n_n] + ] + ] + ] +qed. + +theorem gcd_SO_to_lt_O: \forall i,n. (S O) < n \to gcd i n = (S O) \to +O < i. +intros. +elim (le_to_or_lt_eq ? ? (le_O_n i)) + [assumption + |absurd ((gcd i n) = (S O)) + [assumption + |rewrite < H2. + simplify. + unfold.intro. + apply (lt_to_not_eq (S O) n H). + apply sym_eq.assumption + ] + ] +qed. + +theorem gcd_SO_to_lt_n: \forall i,n. (S O) < n \to i \le n \to gcd i n = (S O) \to +i < n. +intros. +elim (le_to_or_lt_eq ? ? H1) + [assumption + |absurd ((gcd i n) = (S O)) + [assumption + |rewrite > H3. + rewrite > gcd_n_n. + unfold.intro. + apply (lt_to_not_eq (S O) n H). + apply sym_eq.assumption + ] + ] +qed. + +theorem gcd_n_times_nm: \forall n,m. O < m \to gcd n (n*m) = n. +intro.apply (nat_case n) + [intros.reflexivity + |intros. + apply le_to_le_to_eq + [apply divides_to_le + [apply lt_O_S|apply divides_gcd_n] + |apply divides_to_le + [apply lt_O_gcd.rewrite > (times_n_O O). + apply lt_times[apply lt_O_S|assumption] + |apply divides_d_gcd + [apply (witness ? ? m1).reflexivity + |apply divides_n_n + ] + ] + ] + ] +qed. + +theorem symmetric_gcd: symmetric nat gcd. +(*CSC: bug here: unfold symmetric does not work *) +change with +(\forall n,m:nat. gcd n m = gcd m n). +intros. +cut (O < (gcd n m) \lor O = (gcd n m)). +elim Hcut. +cut (O < (gcd m n) \lor O = (gcd m n)). +elim Hcut1. +apply antisym_le. +apply divides_to_le.assumption. +apply divides_d_gcd.apply divides_gcd_n.apply divides_gcd_m. +apply divides_to_le.assumption. +apply divides_d_gcd.apply divides_gcd_n.apply divides_gcd_m. +rewrite < H1. +cut (m=O \land n=O). +elim Hcut2.rewrite > H2.rewrite > H3.reflexivity. +apply gcd_O_to_eq_O.apply sym_eq.assumption. +apply le_to_or_lt_eq.apply le_O_n. +rewrite < H. +cut (n=O \land m=O). +elim Hcut1.rewrite > H1.rewrite > H2.reflexivity. +apply gcd_O_to_eq_O.apply sym_eq.assumption. +apply le_to_or_lt_eq.apply le_O_n. +qed. + +variant sym_gcd: \forall n,m:nat. gcd n m = gcd m n \def +symmetric_gcd. + +theorem le_gcd_times: \forall m,n,p:nat. O< p \to gcd m n \le gcd m (n*p). +intros. +apply (nat_case n).apply le_n. +intro. +apply divides_to_le. +apply lt_O_gcd. +rewrite > (times_n_O O). +apply lt_times.unfold lt.apply le_S_S.apply le_O_n.assumption. +apply divides_d_gcd. +apply (transitive_divides ? (S m1)). +apply divides_gcd_m. +apply (witness ? ? p).reflexivity. +apply divides_gcd_n. +qed. + +theorem gcd_times_SO_to_gcd_SO: \forall m,n,p:nat. O < n \to O < p \to +gcd m (n*p) = (S O) \to gcd m n = (S O). +intros. +apply antisymmetric_le. +rewrite < H2. +apply le_gcd_times.assumption. +change with (O < gcd m n). +apply lt_O_gcd.assumption. +qed. + +(* for the "converse" of the previous result see the end of this development *) + +theorem eq_gcd_SO_to_not_divides: \forall n,m. (S O) < n \to +(gcd n m) = (S O) \to \lnot (divides n m). +intros.unfold.intro. +elim H2. +generalize in match H1. +rewrite > H3. +intro. +cut (O < n2) + [elim (gcd_times_SO_to_gcd_SO n n n2 ? ? H4) + [cut (gcd n (n*n2) = n) + [apply (lt_to_not_eq (S O) n) + [assumption|rewrite < H4.assumption] + |apply gcd_n_times_nm.assumption + ] + |apply (trans_lt ? (S O))[apply le_n|assumption] + |assumption + ] + |elim (le_to_or_lt_eq O n2 (le_O_n n2)); + [assumption + |apply False_ind. + apply (le_to_not_lt n (S O)) + [rewrite < H4. + apply divides_to_le + [rewrite > H4.apply lt_O_S + |apply divides_d_gcd + [apply (witness ? ? n2).reflexivity + |apply divides_n_n + ] + ] + |assumption + ] + ] + ] +qed. + +theorem gcd_SO_n: \forall n:nat. gcd (S O) n = (S O). +intro. +apply antisym_le.apply divides_to_le.unfold lt.apply le_n. +apply divides_gcd_n. +cut (O < gcd (S O) n \lor O = gcd (S O) n). +elim Hcut.assumption. +apply False_ind. +apply (not_eq_O_S O). +cut ((S O)=O \land n=O). +elim Hcut1.apply sym_eq.assumption. +apply gcd_O_to_eq_O.apply sym_eq.assumption. +apply le_to_or_lt_eq.apply le_O_n. +qed. + +theorem divides_gcd_mod: \forall m,n:nat. O < n \to +divides (gcd m n) (gcd n (m \mod n)). +intros. +apply divides_d_gcd. +apply divides_mod.assumption. +apply divides_gcd_n. +apply divides_gcd_m. +apply divides_gcd_m. +qed. + +theorem divides_mod_gcd: \forall m,n:nat. O < n \to +divides (gcd n (m \mod n)) (gcd m n) . +intros. +apply divides_d_gcd. +apply divides_gcd_n. +apply (divides_mod_to_divides ? ? n). +assumption. +apply divides_gcd_m. +apply divides_gcd_n. +qed. + +theorem gcd_mod: \forall m,n:nat. O < n \to +(gcd n (m \mod n)) = (gcd m n) . +intros. +apply antisymmetric_divides. +apply divides_mod_gcd.assumption. +apply divides_gcd_mod.assumption. +qed. + +(* gcd and primes *) + +theorem prime_to_gcd_SO: \forall n,m:nat. prime n \to n \ndivides m \to +gcd n m = (S O). +intros.unfold prime in H. +elim H. +apply antisym_le. +apply not_lt_to_le.unfold Not.unfold lt. +intro. +apply H1.rewrite < (H3 (gcd n m)). +apply divides_gcd_m. +apply divides_gcd_n.assumption. +cut (O < gcd n m \lor O = gcd n m). +elim Hcut.assumption. +apply False_ind. +apply (not_le_Sn_O (S O)). +cut (n=O \land m=O). +elim Hcut1.rewrite < H5 in \vdash (? ? %).assumption. +apply gcd_O_to_eq_O.apply sym_eq.assumption. +apply le_to_or_lt_eq.apply le_O_n. +qed. + +(* primes and divides *) +theorem divides_times_to_divides: \forall n,p,q:nat.prime n \to n \divides p*q \to +n \divides p \lor n \divides q. +intros. +cut (n \divides p \lor n \ndivides p) + [elim Hcut + [left.assumption + |right. + cut (\exists a,b. a*n - b*p = (S O) \lor b*p - a*n = (S O)) + [elim Hcut1.elim H3.elim H4 + [(* first case *) + rewrite > (times_n_SO q).rewrite < H5. + rewrite > distr_times_minus. + rewrite > (sym_times q (a1*p)). + rewrite > (assoc_times a1). + elim H1. + (* + rewrite > H6. + applyS (witness n (n*(q*a-a1*n2)) (q*a-a1*n2)) + reflexivity. *); + applyS (witness n ? ? (refl_eq ? ?)) (* timeout=50 *). + (* + rewrite < (sym_times n).rewrite < assoc_times. + rewrite > (sym_times q).rewrite > assoc_times. + rewrite < (assoc_times a1).rewrite < (sym_times n). + rewrite > (assoc_times n). + rewrite < distr_times_minus. + apply (witness ? ? (q*a-a1*n2)).reflexivity + *) + |(* second case *) + rewrite > (times_n_SO q).rewrite < H5. + rewrite > distr_times_minus. + rewrite > (sym_times q (a1*p)). + rewrite > (assoc_times a1). + elim H1.rewrite > H6. + rewrite < sym_times.rewrite > assoc_times. + rewrite < (assoc_times q). + rewrite < (sym_times n). + rewrite < distr_times_minus. + apply (witness ? ? (n2*a1-q*a)).reflexivity + ](* end second case *) + |rewrite < (prime_to_gcd_SO n p) + [apply eq_minus_gcd|assumption|assumption + ] + ] + ] + |apply (decidable_divides n p). + apply (trans_lt ? (S O)) + [unfold lt.apply le_n + |unfold prime in H.elim H. assumption + ] + ] +qed. + +theorem divides_exp_to_divides: +\forall p,n,m:nat. prime p \to +p \divides n \sup m \to p \divides n. +intros 3.elim m.simplify in H1. +apply (transitive_divides p (S O)).assumption. +apply divides_SO_n. +cut (p \divides n \lor p \divides n \sup n1). +elim Hcut.assumption. +apply H.assumption.assumption. +apply divides_times_to_divides.assumption. +exact H2. +qed. + +theorem divides_exp_to_eq: +\forall p,q,m:nat. prime p \to prime q \to +p \divides q \sup m \to p = q. +intros. +unfold prime in H1. +elim H1.apply H4. +apply (divides_exp_to_divides p q m). +assumption.assumption. +unfold prime in H.elim H.assumption. +qed. + +theorem eq_gcd_times_SO: \forall m,n,p:nat. O < n \to O < p \to +gcd m n = (S O) \to gcd m p = (S O) \to gcd m (n*p) = (S O). +intros. +apply antisymmetric_le. +apply not_lt_to_le. +unfold Not.intro. +cut (divides (smallest_factor (gcd m (n*p))) n \lor + divides (smallest_factor (gcd m (n*p))) p). +elim Hcut. +apply (not_le_Sn_n (S O)). +change with ((S O) < (S O)). +rewrite < H2 in \vdash (? ? %). +apply (lt_to_le_to_lt ? (smallest_factor (gcd m (n*p)))). +apply lt_SO_smallest_factor.assumption. +apply divides_to_le. +rewrite > H2.unfold lt.apply le_n. +apply divides_d_gcd.assumption. +apply (transitive_divides ? (gcd m (n*p))). +apply divides_smallest_factor_n. +apply (trans_lt ? (S O)). unfold lt. apply le_n. assumption. +apply divides_gcd_n. +apply (not_le_Sn_n (S O)). +change with ((S O) < (S O)). +rewrite < H3 in \vdash (? ? %). +apply (lt_to_le_to_lt ? (smallest_factor (gcd m (n*p)))). +apply lt_SO_smallest_factor.assumption. +apply divides_to_le. +rewrite > H3.unfold lt.apply le_n. +apply divides_d_gcd.assumption. +apply (transitive_divides ? (gcd m (n*p))). +apply divides_smallest_factor_n. +apply (trans_lt ? (S O)). unfold lt. apply le_n. assumption. +apply divides_gcd_n. +apply divides_times_to_divides. +apply prime_smallest_factor_n. +assumption. +apply (transitive_divides ? (gcd m (n*p))). +apply divides_smallest_factor_n. +apply (trans_lt ? (S O)).unfold lt. apply le_n. assumption. +apply divides_gcd_m. +change with (O < gcd m (n*p)). +apply lt_O_gcd. +rewrite > (times_n_O O). +apply lt_times.assumption.assumption. +qed. + +theorem gcd_SO_to_divides_times_to_divides: \forall m,n,p:nat. O < n \to +gcd n m = (S O) \to n \divides (m*p) \to n \divides p. +intros. +cut (n \divides p \lor n \ndivides p) + [elim Hcut + [assumption + |cut (\exists a,b. a*n - b*m = (S O) \lor b*m - a*n = (S O)) + [elim Hcut1.elim H4.elim H5 + [(* first case *) + rewrite > (times_n_SO p).rewrite < H6. + rewrite > distr_times_minus. + rewrite > (sym_times p (a1*m)). + rewrite > (assoc_times a1). + elim H2. + applyS (witness n ? ? (refl_eq ? ?)) (* timeout=50 *). + |(* second case *) + rewrite > (times_n_SO p).rewrite < H6. + rewrite > distr_times_minus. + rewrite > (sym_times p (a1*m)). + rewrite > (assoc_times a1). + elim H2. + applyS (witness n ? ? (refl_eq ? ?)). + ](* end second case *) + |rewrite < H1.apply eq_minus_gcd. + ] + ] + |apply (decidable_divides n p). + assumption. + ] +qed. + diff --git a/matita/library/nat/gcd_properties1.ma b/matita/library/nat/gcd_properties1.ma new file mode 100644 index 000000000..88abb4782 --- /dev/null +++ b/matita/library/nat/gcd_properties1.ma @@ -0,0 +1,352 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "nat/gcd.ma". + +(* this file contains some important properites of gcd in N *) + +(* an alternative characterization for gcd *) +theorem gcd1: \forall a,b,c:nat. +c \divides a \to c \divides b \to +(\forall d:nat. d \divides a \to d \divides b \to d \divides c) \to (gcd a b) = c. +intros. +elim (H2 ((gcd a b))) +[ apply (antisymmetric_divides (gcd a b) c) + [ apply (witness (gcd a b) c n2). + assumption + | apply divides_d_gcd; + assumption + ] +| apply divides_gcd_n +| rewrite > sym_gcd. + apply divides_gcd_n +] +qed. + + +theorem eq_gcd_times_times_times_gcd: \forall a,b,c:nat. +(gcd (c*a) (c*b)) = c*(gcd a b). +intros. +apply (nat_case1 c) +[ intros. + simplify. + reflexivity +| intros. + rewrite < H. + apply gcd1 + [ apply divides_times + [ apply divides_n_n + | apply divides_gcd_n. + ] + | apply divides_times + [ apply divides_n_n + | rewrite > sym_gcd. + apply divides_gcd_n + ] + | intros. + apply (divides_d_times_gcd) + [ rewrite > H. + apply lt_O_S + | assumption + | assumption + ] + ] +] +qed. + +theorem associative_nat_gcd: associative nat gcd. +change with (\forall a,b,c:nat. (gcd (gcd a b) c) = (gcd a (gcd b c))). +intros. +apply gcd1 +[ apply divides_d_gcd + [ apply (trans_divides ? (gcd b c) ?) + [ apply divides_gcd_m + | apply divides_gcd_n + ] + | apply divides_gcd_n + ] +| apply (trans_divides ? (gcd b c) ?) + [ apply divides_gcd_m + | apply divides_gcd_m + ] +| intros. + cut (d \divides a \land d \divides b) + [ elim Hcut. + cut (d \divides (gcd b c)) + [ apply (divides_d_gcd (gcd b c) a d Hcut1 H2) + | apply (divides_d_gcd c b d H1 H3) + ] + | split + [ apply (trans_divides d (gcd a b) a H). + apply divides_gcd_n + | apply (trans_divides d (gcd a b) b H). + apply divides_gcd_m + ] + ] +] +qed. + + +theorem eq_gcd_div_div_div_gcd: \forall a,b,m:nat. +O \lt m \to m \divides a \to m \divides b \to +(gcd (a/m) (b/m)) = (gcd a b) / m. +intros. +apply (inj_times_r1 m H). +rewrite > (sym_times m ((gcd a b)/m)). +rewrite > (divides_to_div m (gcd a b)) +[ rewrite < eq_gcd_times_times_times_gcd. + rewrite > (sym_times m (a/m)). + rewrite > (sym_times m (b/m)). + rewrite > (divides_to_div m a H1). + rewrite > (divides_to_div m b H2). + reflexivity +| apply divides_d_gcd; + assumption +] +qed. + + + +theorem divides_times_to_divides_div_gcd: \forall a,b,c:nat. +a \divides (b*c) \to (a/(gcd a b)) \divides c. +intros. +apply (nat_case1 a) +[ intros. + apply (nat_case1 b) + [ (*It's an impossible situation*) + intros. + simplify. + apply divides_SO_n + | intros. + cut (c = O) + [ rewrite > Hcut. + apply (divides_n_n O) + | apply (lt_times_eq_O b c) + [ rewrite > H2. + apply lt_O_S + | apply antisymmetric_divides + [ apply divides_n_O + | rewrite < H1. + assumption + ] + ] + ] + ] +| intros. + rewrite < H1. + elim H. + cut (O \lt a) + [ cut (O \lt (gcd a b)) + [ apply (gcd_SO_to_divides_times_to_divides (b/(gcd a b)) (a/(gcd a b)) c) + [ apply (O_lt_times_to_O_lt (a/(gcd a b)) (gcd a b)). + rewrite > (divides_to_div (gcd a b) a) + [ assumption + | apply divides_gcd_n + ] + | rewrite < (div_n_n (gcd a b)) in \vdash (? ? ? %) + [ apply eq_gcd_div_div_div_gcd + [ assumption + | apply divides_gcd_n + | apply divides_gcd_m + ] + | assumption + ] + | apply (witness ? ? n2). + apply (inj_times_r1 (gcd a b) Hcut1). + rewrite < assoc_times. + rewrite < sym_times in \vdash (? ? (? % ?) ?). + rewrite > (divides_to_div (gcd a b) b) + [ rewrite < assoc_times in \vdash (? ? ? %). + rewrite < sym_times in \vdash (? ? ? (? % ?)). + rewrite > (divides_to_div (gcd a b) a) + [ assumption + | apply divides_gcd_n + ] + | apply divides_gcd_m + ] + ] + | rewrite > sym_gcd. + apply lt_O_gcd. + assumption + ] + | rewrite > H1. + apply lt_O_S + ] +] +qed. + +theorem gcd_plus_times_gcd: \forall a,b,d,m:nat. +(gcd (a+m*b) b) = (gcd a b). +intros. +apply gcd1 +[ apply divides_plus + [ apply divides_gcd_n + | apply (trans_divides ? b ?) + [ apply divides_gcd_m + | rewrite > sym_times. + apply (witness b (b*m) m). + reflexivity + ] + ] +| apply divides_gcd_m +| intros. + apply divides_d_gcd + [ assumption + | rewrite > (minus_plus_m_m a (m*b)). + apply divides_minus + [ assumption + | apply (trans_divides ? b ?) + [ assumption + | rewrite > sym_times. + apply (witness b (b*m) m). + reflexivity + ] + ] + ] +] +qed. + + + +theorem gcd_SO_to_divides_to_divides_to_divides_times: \forall c,e,f:nat. +(gcd e f) = (S O) \to e \divides c \to f \divides c \to +(e*f) \divides c. +intros. +apply (nat_case1 c); intros +[ apply divides_n_O +| rewrite < H3. + elim H1. + elim H2. + rewrite > H5. + rewrite > (sym_times e f). + apply (divides_times) + [ apply (divides_n_n) + | rewrite > H5 in H1. + apply (gcd_SO_to_divides_times_to_divides f e n) + [ rewrite < H5 in H1. + rewrite > H3 in H1. + apply (divides_to_lt_O e (S m)) + [ apply lt_O_S + | assumption + ] + | assumption + | assumption + ] + ] +] +qed. +(* the following theorem shows that gcd is a multiplicative function in + the following sense: if a1 and a2 are relatively prime, then + gcd(a1·a2, b) = gcd(a1, b)·gcd(a2, b). + *) +theorem gcd_SO_to_eq_gcd_times_times_gcd_gcd: \forall a,b,c:nat. +(gcd a b) = (S O) \to (gcd (a*b) c) = (gcd a c) * (gcd b c). +intros. +apply gcd1 +[ apply divides_times; + apply divides_gcd_n +| apply (gcd_SO_to_divides_to_divides_to_divides_times c (gcd a c) (gcd b c)) + [ apply gcd1 + [ apply divides_SO_n + | apply divides_SO_n + | intros. + cut (d \divides a) + [ cut (d \divides b) + [ rewrite < H. + apply (divides_d_gcd b a d Hcut1 Hcut) + | apply (trans_divides d (gcd b c) b) + [ assumption + | apply (divides_gcd_n) + ] + ] + | apply (trans_divides d (gcd a c) a) + [ assumption + | apply (divides_gcd_n) + ] + ] + ] + | apply (divides_gcd_m) + | apply (divides_gcd_m) + ] +| intros. + rewrite < (eq_gcd_times_times_times_gcd b c (gcd a c)). + rewrite > (sym_times (gcd a c) b). + rewrite > (sym_times (gcd a c) c). + rewrite < (eq_gcd_times_times_times_gcd a c b). + rewrite < (eq_gcd_times_times_times_gcd a c c). + apply (divides_d_gcd) + [ apply (divides_d_gcd) + [ rewrite > (times_n_SO d). + apply (divides_times) + [ assumption + | apply divides_SO_n + ] + | rewrite > (times_n_SO d). + apply (divides_times) + [ assumption + | apply divides_SO_n + ] + ] + | apply (divides_d_gcd) + [ rewrite > (times_n_SO d). + rewrite > (sym_times d (S O)). + apply (divides_times) + [ apply (divides_SO_n) + | assumption + ] + | rewrite < (sym_times a b). + assumption + ] + ] +] +qed. + + +theorem eq_gcd_gcd_minus: \forall a,b:nat. +a \lt b \to (gcd a b) = (gcd (b - a) b). +intros. +apply sym_eq. +apply gcd1 +[ apply (divides_minus (gcd a b) b a) + [ apply divides_gcd_m + | apply divides_gcd_n + ] +| apply divides_gcd_m +| intros. + elim H1. + elim H2. + cut(b = (d*n2) + a) + [ cut (b - (d*n2) = a) + [ rewrite > H4 in Hcut1. + rewrite < (distr_times_minus d n n2) in Hcut1. + apply divides_d_gcd + [ assumption + | apply (witness d a (n - n2)). + apply sym_eq. + assumption + ] + | apply (plus_to_minus ? ? ? Hcut) + ] + | rewrite > sym_plus. + apply (minus_to_plus) + [ apply lt_to_le. + assumption + | assumption + ] + ] +] +qed. + diff --git a/matita/library/nat/generic_iter_p.ma b/matita/library/nat/generic_iter_p.ma new file mode 100644 index 000000000..c139568a0 --- /dev/null +++ b/matita/library/nat/generic_iter_p.ma @@ -0,0 +1,1763 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "nat/div_and_mod_diseq.ma". +include "nat/primes.ma". +include "nat/ord.ma". + +(*a generic definition of summatory indexed over natural numbers: + * n:N is the advanced end in the range of the sommatory + * p: N -> bool is a predicate. if (p i) = true, then (g i) is summed, else it isn't + * A is the type of the elements of the sum. + * g:nat -> A, is the function which associates the nth element of the sum to the nth natural numbers + * baseA (of type A) is the neutral element of A for plusA operation + * plusA: A -> A -> A is the sum over elements in A. + *) + +let rec iter_p_gen (n:nat) (p: nat \to bool) (A:Type) (g: nat \to A) + (baseA: A) (plusA: A \to A \to A) \def + match n with + [ O \Rightarrow baseA + | (S k) \Rightarrow + match p k with + [true \Rightarrow (plusA (g k) (iter_p_gen k p A g baseA plusA)) + |false \Rightarrow iter_p_gen k p A g baseA plusA] + ]. + +theorem true_to_iter_p_gen_Sn: +\forall n:nat. \forall p:nat \to bool. \forall A:Type. \forall g:nat \to A. +\forall baseA:A. \forall plusA: A \to A \to A. +p n = true \to iter_p_gen (S n) p A g baseA plusA = +(plusA (g n) (iter_p_gen n p A g baseA plusA)). +intros. +simplify. +rewrite > H. +reflexivity. +qed. + +theorem false_to_iter_p_gen_Sn: +\forall n:nat. \forall p:nat \to bool. \forall A:Type. \forall g:nat \to A. +\forall baseA:A. \forall plusA: A \to A \to A. +p n = false \to iter_p_gen (S n) p A g baseA plusA = iter_p_gen n p A g baseA plusA. +intros. +simplify. +rewrite > H. +reflexivity. +qed. + +theorem eq_iter_p_gen: \forall p1,p2:nat \to bool. \forall A:Type. +\forall g1,g2: nat \to A. \forall baseA: A. +\forall plusA: A \to A \to A. \forall n:nat. +(\forall x. x < n \to p1 x = p2 x) \to +(\forall x. x < n \to g1 x = g2 x) \to +iter_p_gen n p1 A g1 baseA plusA = iter_p_gen n p2 A g2 baseA plusA. +intros 8. +elim n +[ reflexivity +| apply (bool_elim ? (p1 n1)) + [ intro. + rewrite > (true_to_iter_p_gen_Sn ? ? ? ? ? ? H3). + rewrite > true_to_iter_p_gen_Sn + [ apply eq_f2 + [ apply H2.apply le_n. + | apply H + [ intros.apply H1.apply le_S.assumption + | intros.apply H2.apply le_S.assumption + ] + ] + | rewrite < H3.apply sym_eq.apply H1.apply le_n + ] + | intro. + rewrite > (false_to_iter_p_gen_Sn ? ? ? ? ? ? H3). + rewrite > false_to_iter_p_gen_Sn + [ apply H + [ intros.apply H1.apply le_S.assumption + | intros.apply H2.apply le_S.assumption + ] + | rewrite < H3.apply sym_eq.apply H1.apply le_n + ] + ] +] +qed. + +theorem eq_iter_p_gen1: \forall p1,p2:nat \to bool. \forall A:Type. +\forall g1,g2: nat \to A. \forall baseA: A. +\forall plusA: A \to A \to A.\forall n:nat. +(\forall x. x < n \to p1 x = p2 x) \to +(\forall x. x < n \to p1 x = true \to g1 x = g2 x) \to +iter_p_gen n p1 A g1 baseA plusA = iter_p_gen n p2 A g2 baseA plusA. +intros 8. +elim n +[ reflexivity +| apply (bool_elim ? (p1 n1)) + [ intro. + rewrite > (true_to_iter_p_gen_Sn ? ? ? ? ? ? H3). + rewrite > true_to_iter_p_gen_Sn + [ apply eq_f2 + [ apply H2 + [ apply le_n + | assumption + ] + | apply H + [ intros.apply H1.apply le_S.assumption + | intros.apply H2 + [ apply le_S.assumption + | assumption + ] + ] + ] + | rewrite < H3. + apply sym_eq.apply H1.apply le_n + ] + | intro. + rewrite > (false_to_iter_p_gen_Sn ? ? ? ? ? ? H3). + rewrite > false_to_iter_p_gen_Sn + [ apply H + [ intros.apply H1.apply le_S.assumption + | intros.apply H2 + [ apply le_S.assumption + | assumption + ] + ] + | rewrite < H3.apply sym_eq. + apply H1.apply le_n + ] + ] +] +qed. + +theorem iter_p_gen_false: \forall A:Type. \forall g: nat \to A. \forall baseA:A. +\forall plusA: A \to A \to A. \forall n. +iter_p_gen n (\lambda x.false) A g baseA plusA = baseA. +intros. +elim n +[ reflexivity +| simplify. + assumption +] +qed. + +theorem iter_p_gen_plusA: \forall A:Type. \forall n,k:nat.\forall p:nat \to bool. +\forall g: nat \to A. \forall baseA:A. \forall plusA: A \to A \to A. +(symmetric A plusA) \to (\forall a:A. (plusA a baseA) = a) \to (associative A plusA) +\to +iter_p_gen (k + n) p A g baseA plusA += (plusA (iter_p_gen k (\lambda x.p (x+n)) A (\lambda x.g (x+n)) baseA plusA) + (iter_p_gen n p A g baseA plusA)). +intros. + +elim k +[ rewrite < (plus_n_O n). + simplify. + rewrite > H in \vdash (? ? ? %). + rewrite > (H1 ?). + reflexivity +| apply (bool_elim ? (p (n1+n))) + [ intro. + rewrite > (true_to_iter_p_gen_Sn ? ? ? ? ? ? H4). + rewrite > (true_to_iter_p_gen_Sn n1 (\lambda x.p (x+n)) ? ? ? ? H4). + rewrite > (H2 (g (n1 + n)) ? ?). + rewrite < H3. + reflexivity + | intro. + rewrite > (false_to_iter_p_gen_Sn ? ? ? ? ? ? H4). + rewrite > (false_to_iter_p_gen_Sn n1 (\lambda x.p (x+n)) ? ? ? ? H4). + assumption + ] +] +qed. + +theorem false_to_eq_iter_p_gen: \forall A:Type. \forall n,m:nat.\forall p:nat \to bool. +\forall g: nat \to A. \forall baseA:A. \forall plusA: A \to A \to A. +n \le m \to (\forall i:nat. n \le i \to i < m \to p i = false) +\to iter_p_gen m p A g baseA plusA = iter_p_gen n p A g baseA plusA. +intros 8. +elim H +[ reflexivity +| simplify. + rewrite > H3 + [ simplify. + apply H2. + intros. + apply H3 + [ apply H4 + | apply le_S. + assumption + ] + | assumption + |apply le_n + ] +] +qed. + +(* a therem slightly more general than the previous one *) +theorem or_false_eq_baseA_to_eq_iter_p_gen: \forall A:Type. \forall n,m:nat.\forall p:nat \to bool. +\forall g: nat \to A. \forall baseA:A. \forall plusA: A \to A \to A. +(\forall a. plusA baseA a = a) \to +n \le m \to (\forall i:nat. n \le i \to i < m \to p i = false \lor g i = baseA) +\to iter_p_gen m p A g baseA plusA = iter_p_gen n p A g baseA plusA. +intros 9. +elim H1 +[reflexivity +|apply (bool_elim ? (p n1));intro + [elim (H4 n1) + [apply False_ind. + apply not_eq_true_false. + rewrite < H5. + rewrite < H6. + reflexivity + |rewrite > true_to_iter_p_gen_Sn + [rewrite > H6. + rewrite > H. + apply H3.intros. + apply H4 + [assumption + |apply le_S.assumption + ] + |assumption + ] + |assumption + |apply le_n + ] + |rewrite > false_to_iter_p_gen_Sn + [apply H3.intros. + apply H4 + [assumption + |apply le_S.assumption + ] + |assumption + ] + ] +] +qed. + +theorem iter_p_gen2 : +\forall n,m:nat. +\forall p1,p2:nat \to bool. +\forall A:Type. +\forall g: nat \to nat \to A. +\forall baseA: A. +\forall plusA: A \to A \to A. +(symmetric A plusA) \to (associative A plusA) \to (\forall a:A.(plusA a baseA) = a) +\to +iter_p_gen (n*m) + (\lambda x.andb (p1 (div x m)) (p2 (mod x m))) + A + (\lambda x.g (div x m) (mod x m)) + baseA + plusA = +iter_p_gen n p1 A + (\lambda x.iter_p_gen m p2 A (g x) baseA plusA) + baseA plusA. +intros. +elim n +[ simplify. + reflexivity +| apply (bool_elim ? (p1 n1)) + [ intro. + rewrite > (true_to_iter_p_gen_Sn ? ? ? ? ? ? H4). + simplify in \vdash (? ? (? % ? ? ? ? ?) ?). + rewrite > iter_p_gen_plusA + [ rewrite < H3. + apply eq_f2 + [ apply eq_iter_p_gen + [ intros. + rewrite > sym_plus. + rewrite > (div_plus_times ? ? ? H5). + rewrite > (mod_plus_times ? ? ? H5). + rewrite > H4. + simplify. + reflexivity + | intros. + rewrite > sym_plus. + rewrite > (div_plus_times ? ? ? H5). + rewrite > (mod_plus_times ? ? ? H5). + rewrite > H4. + simplify.reflexivity. + ] + | reflexivity + ] + | assumption + | assumption + | assumption + ] + | intro. + rewrite > (false_to_iter_p_gen_Sn ? ? ? ? ? ? H4). + simplify in \vdash (? ? (? % ? ? ? ? ?) ?). + rewrite > iter_p_gen_plusA + [ rewrite > H3. + apply (trans_eq ? ? (plusA baseA + (iter_p_gen n1 p1 A (\lambda x:nat.iter_p_gen m p2 A (g x) baseA plusA) baseA plusA ))) + [ apply eq_f2 + [ rewrite > (eq_iter_p_gen ? (\lambda x.false) A ? (\lambda x:nat.g ((x+n1*m)/m) ((x+n1*m)\mod m))) + [ apply iter_p_gen_false + | intros. + rewrite > sym_plus. + rewrite > (div_plus_times ? ? ? H5). + rewrite > (mod_plus_times ? ? ? H5). + rewrite > H4. + simplify.reflexivity + | intros.reflexivity. + ] + | reflexivity + ] + | rewrite < H. + rewrite > H2. + reflexivity. + ] + | assumption + | assumption + | assumption + ] + ] +] +qed. + +theorem iter_p_gen2': +\forall n,m:nat. +\forall p1: nat \to bool. +\forall p2: nat \to nat \to bool. +\forall A:Type. +\forall g: nat \to nat \to A. +\forall baseA: A. +\forall plusA: A \to A \to A. +(symmetric A plusA) \to (associative A plusA) \to (\forall a:A.(plusA a baseA) = a) +\to +iter_p_gen (n*m) + (\lambda x.andb (p1 (div x m)) (p2 (div x m)(mod x m))) + A + (\lambda x.g (div x m) (mod x m)) + baseA + plusA = +iter_p_gen n p1 A + (\lambda x.iter_p_gen m (p2 x) A (g x) baseA plusA) + baseA plusA. +intros. +elim n +[ simplify. + reflexivity +| apply (bool_elim ? (p1 n1)) + [ intro. + rewrite > (true_to_iter_p_gen_Sn ? ? ? ? ? ? H4). + simplify in \vdash (? ? (? % ? ? ? ? ?) ?). + rewrite > iter_p_gen_plusA + [ rewrite < H3. + apply eq_f2 + [ apply eq_iter_p_gen + [ intros. + rewrite > sym_plus. + rewrite > (div_plus_times ? ? ? H5). + rewrite > (mod_plus_times ? ? ? H5). + rewrite > H4. + simplify. + reflexivity + | intros. + rewrite > sym_plus. + rewrite > (div_plus_times ? ? ? H5). + rewrite > (mod_plus_times ? ? ? H5). + rewrite > H4. + simplify.reflexivity. + ] + | reflexivity + ] + | assumption + | assumption + | assumption + ] + | intro. + rewrite > (false_to_iter_p_gen_Sn ? ? ? ? ? ? H4). + simplify in \vdash (? ? (? % ? ? ? ? ?) ?). + rewrite > iter_p_gen_plusA + [ rewrite > H3. + apply (trans_eq ? ? (plusA baseA + (iter_p_gen n1 p1 A (\lambda x:nat.iter_p_gen m (p2 x) A (g x) baseA plusA) baseA plusA ))) + [ apply eq_f2 + [ rewrite > (eq_iter_p_gen ? (\lambda x.false) A ? (\lambda x:nat.g ((x+n1*m)/m) ((x+n1*m)\mod m))) + [ apply iter_p_gen_false + | intros. + rewrite > sym_plus. + rewrite > (div_plus_times ? ? ? H5). + rewrite > (mod_plus_times ? ? ? H5). + rewrite > H4. + simplify.reflexivity + | intros.reflexivity. + ] + | reflexivity + ] + | rewrite < H. + rewrite > H2. + reflexivity. + ] + | assumption + | assumption + | assumption + ] + ] +] +qed. + +lemma iter_p_gen_gi: +\forall A:Type. +\forall g: nat \to A. +\forall baseA:A. +\forall plusA: A \to A \to A. +\forall n,i:nat. +\forall p:nat \to bool. +(symmetric A plusA) \to (associative A plusA) \to (\forall a:A.(plusA a baseA) = a) + \to + +i < n \to p i = true \to +(iter_p_gen n p A g baseA plusA) = +(plusA (g i) (iter_p_gen n (\lambda x:nat. andb (p x) (notb (eqb x i))) A g baseA plusA)). +intros 5. +elim n +[ apply False_ind. + apply (not_le_Sn_O i). + assumption +| apply (bool_elim ? (p n1));intro + [ elim (le_to_or_lt_eq i n1) + [ rewrite > true_to_iter_p_gen_Sn + [ rewrite > true_to_iter_p_gen_Sn + [ rewrite < (H2 (g i) ? ?). + rewrite > (H1 (g i) (g n1)). + rewrite > (H2 (g n1) ? ?). + apply eq_f2 + [ reflexivity + | apply H + [ assumption + | assumption + | assumption + | assumption + | assumption + ] + ] + | rewrite > H6.simplify. + change with (notb (eqb n1 i) = notb false). + apply eq_f. + apply not_eq_to_eqb_false. + unfold Not.intro. + apply (lt_to_not_eq ? ? H7). + apply sym_eq.assumption + ] + | assumption + ] + | rewrite > true_to_iter_p_gen_Sn + [ rewrite > H7. + apply eq_f2 + [ reflexivity + | rewrite > false_to_iter_p_gen_Sn + [ apply eq_iter_p_gen + [ intros. + elim (p x) + [ simplify. + change with (notb false = notb (eqb x n1)). + apply eq_f. + apply sym_eq. + apply not_eq_to_eqb_false. + apply (lt_to_not_eq ? ? H8) + | reflexivity + ] + | intros. + reflexivity + ] + | rewrite > H6. + rewrite > (eq_to_eqb_true ? ? (refl_eq ? n1)). + reflexivity + ] + ] + | assumption + ] + | apply le_S_S_to_le. + assumption + ] + | rewrite > false_to_iter_p_gen_Sn + [ elim (le_to_or_lt_eq i n1) + [ rewrite > false_to_iter_p_gen_Sn + [ apply H + [ assumption + | assumption + | assumption + | assumption + | assumption + ] + | rewrite > H6.reflexivity + ] + | apply False_ind. + apply not_eq_true_false. + rewrite < H5. + rewrite > H7. + assumption + | apply le_S_S_to_le. + assumption + ] + | assumption + ] + ] +] +qed. + +(* invariance under permutation; single sum *) +theorem eq_iter_p_gen_gh: +\forall A:Type. +\forall baseA: A. +\forall plusA: A \to A \to A. +(symmetric A plusA) \to (associative A plusA) \to (\forall a:A.(plusA a baseA) = a) \to +\forall g: nat \to A. +\forall h,h1: nat \to nat. +\forall n,n1:nat. +\forall p1,p2:nat \to bool. +(\forall i. i < n \to p1 i = true \to p2 (h i) = true) \to +(\forall i. i < n \to p1 i = true \to h1 (h i) = i) \to +(\forall i. i < n \to p1 i = true \to h i < n1) \to +(\forall j. j < n1 \to p2 j = true \to p1 (h1 j) = true) \to +(\forall j. j < n1 \to p2 j = true \to h (h1 j) = j) \to +(\forall j. j < n1 \to p2 j = true \to h1 j < n) \to + +iter_p_gen n p1 A (\lambda x.g(h x)) baseA plusA = +iter_p_gen n1 p2 A g baseA plusA. +intros 10. +elim n +[ generalize in match H8. + elim n1 + [ reflexivity + | apply (bool_elim ? (p2 n2));intro + [ apply False_ind. + apply (not_le_Sn_O (h1 n2)). + apply H10 + [ apply le_n + | assumption + ] + | rewrite > false_to_iter_p_gen_Sn + [ apply H9. + intros. + apply H10 + [ apply le_S. + apply H12 + | assumption + ] + | assumption + ] + ] + ] +| apply (bool_elim ? (p1 n1));intro + [ rewrite > true_to_iter_p_gen_Sn + [ rewrite > (iter_p_gen_gi A g baseA plusA n2 (h n1)) + [ apply eq_f2 + [ reflexivity + | apply H3 + [ intros. + rewrite > H4 + [ simplify. + change with ((\not eqb (h i) (h n1))= \not false). + apply eq_f. + apply not_eq_to_eqb_false. + unfold Not. + intro. + apply (lt_to_not_eq ? ? H11). + rewrite < H5 + [ rewrite < (H5 n1) + [ apply eq_f. + assumption + | apply le_n + | assumption + ] + | apply le_S. + assumption + | assumption + ] + | apply le_S.assumption + | assumption + ] + | intros. + apply H5 + [ apply le_S. + assumption + | assumption + ] + | intros. + apply H6 + [ apply le_S.assumption + | assumption + ] + | intros. + apply H7 + [ assumption + | generalize in match H12. + elim (p2 j) + [ reflexivity + | assumption + ] + ] + | intros. + apply H8 + [ assumption + | generalize in match H12. + elim (p2 j) + [ reflexivity + | assumption + ] + ] + | intros. + elim (le_to_or_lt_eq (h1 j) n1) + [ assumption + | generalize in match H12. + elim (p2 j) + [ simplify in H13. + absurd (j = (h n1)) + [ rewrite < H13. + rewrite > H8 + [ reflexivity + | assumption + | autobatch + ] + | apply eqb_false_to_not_eq. + generalize in match H14. + elim (eqb j (h n1)) + [ apply sym_eq.assumption + | reflexivity + ] + ] + | simplify in H14. + apply False_ind. + apply not_eq_true_false. + apply sym_eq.assumption + ] + | apply le_S_S_to_le. + apply H9 + [ assumption + | generalize in match H12. + elim (p2 j) + [ reflexivity + | assumption + ] + ] + ] + ] + ] + | assumption + | assumption + | assumption + | apply H6 + [ apply le_n + | assumption + ] + | apply H4 + [ apply le_n + | assumption + ] + ] + | assumption + ] + | rewrite > false_to_iter_p_gen_Sn + [ apply H3 + [ intros. + apply H4[apply le_S.assumption|assumption] + | intros. + apply H5[apply le_S.assumption|assumption] + | intros. + apply H6[apply le_S.assumption|assumption] + | intros. + apply H7[assumption|assumption] + | intros. + apply H8[assumption|assumption] + | intros. + elim (le_to_or_lt_eq (h1 j) n1) + [ assumption + | absurd (j = (h n1)) + [ rewrite < H13. + rewrite > H8 + [ reflexivity + | assumption + | assumption + ] + | unfold Not.intro. + apply not_eq_true_false. + rewrite < H10. + rewrite < H13. + rewrite > H7 + [ reflexivity + | assumption + | assumption + ] + ] + | apply le_S_S_to_le. + apply H9 + [ assumption + | assumption + ] + ] + ] + | assumption + ] + ] +] +qed. + +theorem eq_iter_p_gen_pred: +\forall A:Type. +\forall baseA: A. +\forall plusA: A \to A \to A. +\forall n,p,g. +p O = true \to +(symmetric A plusA) \to (associative A plusA) \to (\forall a:A.(plusA a baseA) = a) \to +iter_p_gen (S n) (\lambda i.p (pred i)) A (\lambda i.g(pred i)) baseA plusA = +plusA (iter_p_gen n p A g baseA plusA) (g O). +intros. +elim n + [rewrite > true_to_iter_p_gen_Sn + [simplify.apply H1 + |assumption + ] + |apply (bool_elim ? (p n1));intro + [rewrite > true_to_iter_p_gen_Sn + [rewrite > true_to_iter_p_gen_Sn in ⊢ (? ? ? %) + [rewrite > H2 in ⊢ (? ? ? %). + apply eq_f.assumption + |assumption + ] + |assumption + ] + |rewrite > false_to_iter_p_gen_Sn + [rewrite > false_to_iter_p_gen_Sn in ⊢ (? ? ? %);assumption + |assumption + ] + ] + ] +qed. + +definition p_ord_times \def +\lambda p,m,x. + match p_ord x p with + [pair q r \Rightarrow r*m+q]. + +theorem eq_p_ord_times: \forall p,m,x. +p_ord_times p m x = (ord_rem x p)*m+(ord x p). +intros.unfold p_ord_times. unfold ord_rem. +unfold ord. +elim (p_ord x p). +reflexivity. +qed. + +theorem div_p_ord_times: +\forall p,m,x. ord x p < m \to p_ord_times p m x / m = ord_rem x p. +intros.rewrite > eq_p_ord_times. +apply div_plus_times. +assumption. +qed. + +theorem mod_p_ord_times: +\forall p,m,x. ord x p < m \to p_ord_times p m x \mod m = ord x p. +intros.rewrite > eq_p_ord_times. +apply mod_plus_times. +assumption. +qed. + +lemma lt_times_to_lt_O: \forall i,n,m:nat. i < n*m \to O < m. +intros. +elim (le_to_or_lt_eq O ? (le_O_n m)) + [assumption + |apply False_ind. + rewrite < H1 in H. + rewrite < times_n_O in H. + apply (not_le_Sn_O ? H) + ] +qed. + +theorem iter_p_gen_knm: +\forall A:Type. +\forall baseA: A. +\forall plusA: A \to A \to A. +(symmetric A plusA) \to +(associative A plusA) \to +(\forall a:A.(plusA a baseA) = a)\to +\forall g: nat \to A. +\forall h2:nat \to nat \to nat. +\forall h11,h12:nat \to nat. +\forall k,n,m. +\forall p1,p21:nat \to bool. +\forall p22:nat \to nat \to bool. +(\forall x. x < k \to p1 x = true \to +p21 (h11 x) = true \land p22 (h11 x) (h12 x) = true +\land h2 (h11 x) (h12 x) = x +\land (h11 x) < n \land (h12 x) < m) \to +(\forall i,j. i < n \to j < m \to p21 i = true \to p22 i j = true \to +p1 (h2 i j) = true \land +h11 (h2 i j) = i \land h12 (h2 i j) = j +\land h2 i j < k) \to +iter_p_gen k p1 A g baseA plusA = +iter_p_gen n p21 A (\lambda x:nat.iter_p_gen m (p22 x) A (\lambda y. g (h2 x y)) baseA plusA) baseA plusA. +intros. +rewrite < (iter_p_gen2' n m p21 p22 ? ? ? ? H H1 H2). +apply sym_eq. +apply (eq_iter_p_gen_gh A baseA plusA H H1 H2 g ? (\lambda x.(h11 x)*m+(h12 x))) + [intros. + elim (H4 (i/m) (i \mod m));clear H4 + [elim H7.clear H7. + elim H4.clear H4. + assumption + |apply (lt_times_to_lt_div ? ? ? H5) + |apply lt_mod_m_m. + apply (lt_times_to_lt_O ? ? ? H5) + |apply (andb_true_true ? ? H6) + |apply (andb_true_true_r ? ? H6) + ] + |intros. + elim (H4 (i/m) (i \mod m));clear H4 + [elim H7.clear H7. + elim H4.clear H4. + rewrite > H10. + rewrite > H9. + apply sym_eq. + apply div_mod. + apply (lt_times_to_lt_O ? ? ? H5) + |apply (lt_times_to_lt_div ? ? ? H5) + |apply lt_mod_m_m. + apply (lt_times_to_lt_O ? ? ? H5) + |apply (andb_true_true ? ? H6) + |apply (andb_true_true_r ? ? H6) + ] + |intros. + elim (H4 (i/m) (i \mod m));clear H4 + [elim H7.clear H7. + elim H4.clear H4. + assumption + |apply (lt_times_to_lt_div ? ? ? H5) + |apply lt_mod_m_m. + apply (lt_times_to_lt_O ? ? ? H5) + |apply (andb_true_true ? ? H6) + |apply (andb_true_true_r ? ? H6) + ] + |intros. + elim (H3 j H5 H6). + elim H7.clear H7. + elim H9.clear H9. + elim H7.clear H7. + rewrite > div_plus_times + [rewrite > mod_plus_times + [rewrite > H9. + rewrite > H12. + reflexivity. + |assumption + ] + |assumption + ] + |intros. + elim (H3 j H5 H6). + elim H7.clear H7. + elim H9.clear H9. + elim H7.clear H7. + rewrite > div_plus_times + [rewrite > mod_plus_times + [assumption + |assumption + ] + |assumption + ] + |intros. + elim (H3 j H5 H6). + elim H7.clear H7. + elim H9.clear H9. + elim H7.clear H7. + apply (lt_to_le_to_lt ? ((h11 j)*m+m)) + [apply monotonic_lt_plus_r. + assumption + |rewrite > sym_plus. + change with ((S (h11 j)*m) \le n*m). + apply monotonic_le_times_l. + assumption + ] + ] +qed. + +theorem iter_p_gen_divides: +\forall A:Type. +\forall baseA: A. +\forall plusA: A \to A \to A. +\forall n,m,p:nat.O < n \to prime p \to Not (divides p n) \to +\forall g: nat \to A. +(symmetric A plusA) \to (associative A plusA) \to (\forall a:A.(plusA a baseA) = a) + +\to + +iter_p_gen (S (n*(exp p m))) (\lambda x.divides_b x (n*(exp p m))) A g baseA plusA = +iter_p_gen (S n) (\lambda x.divides_b x n) A + (\lambda x.iter_p_gen (S m) (\lambda y.true) A (\lambda y.g (x*(exp p y))) baseA plusA) baseA plusA. +intros. +cut (O < p) + [rewrite < (iter_p_gen2 ? ? ? ? ? ? ? ? H3 H4 H5). + apply (trans_eq ? ? + (iter_p_gen (S n*S m) (\lambda x:nat.divides_b (x/S m) n) A + (\lambda x:nat.g (x/S m*(p)\sup(x\mod S m))) baseA plusA) ) + [apply sym_eq. + apply (eq_iter_p_gen_gh ? ? ? ? ? ? g ? (p_ord_times p (S m))) + [ assumption + | assumption + | assumption + |intros. + lapply (divides_b_true_to_lt_O ? ? H H7). + apply divides_to_divides_b_true + [rewrite > (times_n_O O). + apply lt_times + [assumption + |apply lt_O_exp.assumption + ] + |apply divides_times + [apply divides_b_true_to_divides.assumption + |apply (witness ? ? (p \sup (m-i \mod (S m)))). + rewrite < exp_plus_times. + apply eq_f. + rewrite > sym_plus. + apply plus_minus_m_m. + autobatch + ] + ] + |intros. + lapply (divides_b_true_to_lt_O ? ? H H7). + unfold p_ord_times. + rewrite > (p_ord_exp1 p ? (i \mod (S m)) (i/S m)) + [change with ((i/S m)*S m+i \mod S m=i). + apply sym_eq. + apply div_mod. + apply lt_O_S + |assumption + |unfold Not.intro. + apply H2. + apply (trans_divides ? (i/ S m)) + [assumption| + apply divides_b_true_to_divides;assumption] + |apply sym_times. + ] + |intros. + apply le_S_S. + apply le_times + [apply le_S_S_to_le. + change with ((i/S m) < S n). + apply (lt_times_to_lt_l m). + apply (le_to_lt_to_lt ? i) + [autobatch|assumption] + |apply le_exp + [assumption + |apply le_S_S_to_le. + apply lt_mod_m_m. + apply lt_O_S + ] + ] + |intros. + cut (ord j p < S m) + [rewrite > div_p_ord_times + [apply divides_to_divides_b_true + [apply lt_O_ord_rem + [elim H1.assumption + |apply (divides_b_true_to_lt_O ? ? ? H7). + rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + ] + |cut (n = ord_rem (n*(exp p m)) p) + [rewrite > Hcut2. + apply divides_to_divides_ord_rem + [apply (divides_b_true_to_lt_O ? ? ? H7). + rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |assumption + |apply divides_b_true_to_divides. + assumption + ] + |unfold ord_rem. + rewrite > (p_ord_exp1 p ? m n) + [reflexivity + |assumption + |assumption + |apply sym_times + ] + ] + ] + |assumption + ] + |cut (m = ord (n*(exp p m)) p) + [apply le_S_S. + rewrite > Hcut1. + apply divides_to_le_ord + [apply (divides_b_true_to_lt_O ? ? ? H7). + rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |assumption + |apply divides_b_true_to_divides. + assumption + ] + |unfold ord. + rewrite > (p_ord_exp1 p ? m n) + [reflexivity + |assumption + |assumption + |apply sym_times + ] + ] + ] + |intros. + cut (ord j p < S m) + [rewrite > div_p_ord_times + [rewrite > mod_p_ord_times + [rewrite > sym_times. + apply sym_eq. + apply exp_ord + [elim H1.assumption + |apply (divides_b_true_to_lt_O ? ? ? H7). + rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + ] + |cut (m = ord (n*(exp p m)) p) + [apply le_S_S. + rewrite > Hcut2. + apply divides_to_le_ord + [apply (divides_b_true_to_lt_O ? ? ? H7). + rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |assumption + |apply divides_b_true_to_divides. + assumption + ] + |unfold ord. + rewrite > (p_ord_exp1 p ? m n) + [reflexivity + |assumption + |assumption + |apply sym_times + ] + ] + ] + |assumption + ] + |cut (m = ord (n*(exp p m)) p) + [apply le_S_S. + rewrite > Hcut1. + apply divides_to_le_ord + [apply (divides_b_true_to_lt_O ? ? ? H7). + rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |assumption + |apply divides_b_true_to_divides. + assumption + ] + |unfold ord. + rewrite > (p_ord_exp1 p ? m n) + [reflexivity + |assumption + |assumption + |apply sym_times + ] + ] + ] + |intros. + rewrite > eq_p_ord_times. + rewrite > sym_plus. + apply (lt_to_le_to_lt ? (S m +ord_rem j p*S m)) + [apply lt_plus_l. + apply le_S_S. + cut (m = ord (n*(p \sup m)) p) + [rewrite > Hcut1. + apply divides_to_le_ord + [apply (divides_b_true_to_lt_O ? ? ? H7). + rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |assumption + |apply divides_b_true_to_divides. + assumption + ] + |unfold ord. + rewrite > sym_times. + rewrite > (p_ord_exp1 p ? m n) + [reflexivity + |assumption + |assumption + |reflexivity + ] + ] + |change with (S (ord_rem j p)*S m \le S n*S m). + apply le_times_l. + apply le_S_S. + cut (n = ord_rem (n*(p \sup m)) p) + [rewrite > Hcut1. + apply divides_to_le + [apply lt_O_ord_rem + [elim H1.assumption + |rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + ] + |apply divides_to_divides_ord_rem + [apply (divides_b_true_to_lt_O ? ? ? H7). + rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |rewrite > (times_n_O O). + apply lt_times + [assumption|apply lt_O_exp.assumption] + |assumption + |apply divides_b_true_to_divides. + assumption + ] + ] + |unfold ord_rem. + rewrite > sym_times. + rewrite > (p_ord_exp1 p ? m n) + [reflexivity + |assumption + |assumption + |reflexivity + ] + ] + ] + ] + |apply eq_iter_p_gen + + [intros. + elim (divides_b (x/S m) n);reflexivity + |intros.reflexivity + ] + ] +|elim H1.apply lt_to_le.assumption +] +qed. + +(*distributive property for iter_p_gen*) +theorem distributive_times_plus_iter_p_gen: \forall A:Type. +\forall plusA: A \to A \to A. \forall basePlusA: A. +\forall timesA: A \to A \to A. +\forall n:nat. \forall k:A. \forall p:nat \to bool. \forall g:nat \to A. +(symmetric A plusA) \to (associative A plusA) \to (\forall a:A.(plusA a basePlusA) = a) \to +(symmetric A timesA) \to (distributive A timesA plusA) \to +(\forall a:A. (timesA a basePlusA) = basePlusA) + + \to + +((timesA k (iter_p_gen n p A g basePlusA plusA)) = + (iter_p_gen n p A (\lambda i:nat.(timesA k (g i))) basePlusA plusA)). +intros. +elim n +[ simplify. + apply H5 +| cut( (p n1) = true \lor (p n1) = false) + [ elim Hcut + [ rewrite > (true_to_iter_p_gen_Sn ? ? ? ? ? ? H7). + rewrite > (true_to_iter_p_gen_Sn ? ? ? ? ? ? H7) in \vdash (? ? ? %). + rewrite > (H4). + rewrite > (H3 k (g n1)). + apply eq_f. + assumption + | rewrite > (false_to_iter_p_gen_Sn ? ? ? ? ? ? H7). + rewrite > (false_to_iter_p_gen_Sn ? ? ? ? ? ? H7) in \vdash (? ? ? %). + assumption + ] + | elim ((p n1)) + [ left. + reflexivity + | right. + reflexivity + ] + ] +] +qed. + +(* old version - proved without theorem iter_p_gen_knm +theorem iter_p_gen_2_eq: +\forall A:Type. +\forall baseA: A. +\forall plusA: A \to A \to A. +(symmetric A plusA) \to +(associative A plusA) \to +(\forall a:A.(plusA a baseA) = a)\to +\forall g: nat \to nat \to A. +\forall h11,h12,h21,h22: nat \to nat \to nat. +\forall n1,m1,n2,m2. +\forall p11,p21:nat \to bool. +\forall p12,p22:nat \to nat \to bool. +(\forall i,j. i < n2 \to j < m2 \to p21 i = true \to p22 i j = true \to +p11 (h11 i j) = true \land p12 (h11 i j) (h12 i j) = true +\land h21 (h11 i j) (h12 i j) = i \land h22 (h11 i j) (h12 i j) = j +\land h11 i j < n1 \land h12 i j < m1) \to +(\forall i,j. i < n1 \to j < m1 \to p11 i = true \to p12 i j = true \to +p21 (h21 i j) = true \land p22 (h21 i j) (h22 i j) = true +\land h11 (h21 i j) (h22 i j) = i \land h12 (h21 i j) (h22 i j) = j +\land (h21 i j) < n2 \land (h22 i j) < m2) \to +iter_p_gen n1 p11 A + (\lambda x:nat .iter_p_gen m1 (p12 x) A (\lambda y. g x y) baseA plusA) + baseA plusA = +iter_p_gen n2 p21 A + (\lambda x:nat .iter_p_gen m2 (p22 x) A (\lambda y. g (h11 x y) (h12 x y)) baseA plusA ) + baseA plusA. +intros. +rewrite < (iter_p_gen2' ? ? ? ? ? ? ? ? H H1 H2). +rewrite < (iter_p_gen2' ? ? ? ? ? ? ? ? H H1 H2). +apply sym_eq. +letin h := (\lambda x.(h11 (x/m2) (x\mod m2))*m1 + (h12 (x/m2) (x\mod m2))). +letin h1 := (\lambda x.(h21 (x/m1) (x\mod m1))*m2 + (h22 (x/m1) (x\mod m1))). +apply (trans_eq ? ? + (iter_p_gen (n2*m2) (\lambda x:nat.p21 (x/m2)\land p22 (x/m2) (x\mod m2)) A + (\lambda x:nat.g ((h x)/m1) ((h x)\mod m1)) baseA plusA )) + [clear h.clear h1. + apply eq_iter_p_gen1 + [intros.reflexivity + |intros. + cut (O < m2) + [cut (x/m2 < n2) + [cut (x \mod m2 < m2) + [elim (and_true ? ? H6). + elim (H3 ? ? Hcut1 Hcut2 H7 H8). + elim H9.clear H9. + elim H11.clear H11. + elim H9.clear H9. + elim H11.clear H11. + apply eq_f2 + [apply sym_eq. + apply div_plus_times. + assumption + | apply sym_eq. + apply mod_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m2) + [assumption + |apply (le_to_lt_to_lt ? x) + [apply (eq_plus_to_le ? ? (x \mod m2)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H5. + apply (le_n_O_elim ? H7). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + ] + |apply (eq_iter_p_gen_gh ? ? ? H H1 H2 ? h h1);intros + [cut (O < m2) + [cut (i/m2 < n2) + [cut (i \mod m2 < m2) + [elim (and_true ? ? H6). + elim (H3 ? ? Hcut1 Hcut2 H7 H8). + elim H9.clear H9. + elim H11.clear H11. + elim H9.clear H9. + elim H11.clear H11. + cut ((h11 (i/m2) (i\mod m2)*m1+h12 (i/m2) (i\mod m2))/m1 = + h11 (i/m2) (i\mod m2)) + [cut ((h11 (i/m2) (i\mod m2)*m1+h12 (i/m2) (i\mod m2))\mod m1 = + h12 (i/m2) (i\mod m2)) + [rewrite > Hcut3. + rewrite > Hcut4. + rewrite > H9. + rewrite > H15. + reflexivity + |apply mod_plus_times. + assumption + ] + |apply div_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m2) + [assumption + |apply (le_to_lt_to_lt ? i) + [apply (eq_plus_to_le ? ? (i \mod m2)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H5. + apply (le_n_O_elim ? H7). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m2) + [cut (i/m2 < n2) + [cut (i \mod m2 < m2) + [elim (and_true ? ? H6). + elim (H3 ? ? Hcut1 Hcut2 H7 H8). + elim H9.clear H9. + elim H11.clear H11. + elim H9.clear H9. + elim H11.clear H11. + cut ((h11 (i/m2) (i\mod m2)*m1+h12 (i/m2) (i\mod m2))/m1 = + h11 (i/m2) (i\mod m2)) + [cut ((h11 (i/m2) (i\mod m2)*m1+h12 (i/m2) (i\mod m2))\mod m1 = + h12 (i/m2) (i\mod m2)) + [rewrite > Hcut3. + rewrite > Hcut4. + rewrite > H13. + rewrite > H14. + apply sym_eq. + apply div_mod. + assumption + |apply mod_plus_times. + assumption + ] + |apply div_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m2) + [assumption + |apply (le_to_lt_to_lt ? i) + [apply (eq_plus_to_le ? ? (i \mod m2)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H5. + apply (le_n_O_elim ? H7). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m2) + [cut (i/m2 < n2) + [cut (i \mod m2 < m2) + [elim (and_true ? ? H6). + elim (H3 ? ? Hcut1 Hcut2 H7 H8). + elim H9.clear H9. + elim H11.clear H11. + elim H9.clear H9. + elim H11.clear H11. + apply lt_times_plus_times + [assumption|assumption] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m2) + [assumption + |apply (le_to_lt_to_lt ? i) + [apply (eq_plus_to_le ? ? (i \mod m2)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H5. + apply (le_n_O_elim ? H7). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m1) + [cut (j/m1 < n1) + [cut (j \mod m1 < m1) + [elim (and_true ? ? H6). + elim (H4 ? ? Hcut1 Hcut2 H7 H8). + elim H9.clear H9. + elim H11.clear H11. + elim H9.clear H9. + elim H11.clear H11. + cut ((h21 (j/m1) (j\mod m1)*m2+h22 (j/m1) (j\mod m1))/m2 = + h21 (j/m1) (j\mod m1)) + [cut ((h21 (j/m1) (j\mod m1)*m2+h22 (j/m1) (j\mod m1))\mod m2 = + h22 (j/m1) (j\mod m1)) + [rewrite > Hcut3. + rewrite > Hcut4. + rewrite > H9. + rewrite > H15. + reflexivity + |apply mod_plus_times. + assumption + ] + |apply div_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m1) + [assumption + |apply (le_to_lt_to_lt ? j) + [apply (eq_plus_to_le ? ? (j \mod m1)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H5. + apply (le_n_O_elim ? H7). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m1) + [cut (j/m1 < n1) + [cut (j \mod m1 < m1) + [elim (and_true ? ? H6). + elim (H4 ? ? Hcut1 Hcut2 H7 H8). + elim H9.clear H9. + elim H11.clear H11. + elim H9.clear H9. + elim H11.clear H11. + cut ((h21 (j/m1) (j\mod m1)*m2+h22 (j/m1) (j\mod m1))/m2 = + h21 (j/m1) (j\mod m1)) + [cut ((h21 (j/m1) (j\mod m1)*m2+h22 (j/m1) (j\mod m1))\mod m2 = + h22 (j/m1) (j\mod m1)) + [rewrite > Hcut3. + rewrite > Hcut4. + rewrite > H13. + rewrite > H14. + apply sym_eq. + apply div_mod. + assumption + |apply mod_plus_times. + assumption + ] + |apply div_plus_times. + assumption + ] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m1) + [assumption + |apply (le_to_lt_to_lt ? j) + [apply (eq_plus_to_le ? ? (j \mod m1)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H5. + apply (le_n_O_elim ? H7). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + |cut (O < m1) + [cut (j/m1 < n1) + [cut (j \mod m1 < m1) + [elim (and_true ? ? H6). + elim (H4 ? ? Hcut1 Hcut2 H7 H8). + elim H9.clear H9. + elim H11.clear H11. + elim H9.clear H9. + elim H11.clear H11. + apply (lt_times_plus_times ? ? ? m2) + [assumption|assumption] + |apply lt_mod_m_m. + assumption + ] + |apply (lt_times_n_to_lt m1) + [assumption + |apply (le_to_lt_to_lt ? j) + [apply (eq_plus_to_le ? ? (j \mod m1)). + apply div_mod. + assumption + |assumption + ] + ] + ] + |apply not_le_to_lt.unfold.intro. + generalize in match H5. + apply (le_n_O_elim ? H7). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n + ] + ] + ] +qed.*) + + +theorem iter_p_gen_2_eq: +\forall A:Type. +\forall baseA: A. +\forall plusA: A \to A \to A. +(symmetric A plusA) \to +(associative A plusA) \to +(\forall a:A.(plusA a baseA) = a)\to +\forall g: nat \to nat \to A. +\forall h11,h12,h21,h22: nat \to nat \to nat. +\forall n1,m1,n2,m2. +\forall p11,p21:nat \to bool. +\forall p12,p22:nat \to nat \to bool. +(\forall i,j. i < n2 \to j < m2 \to p21 i = true \to p22 i j = true \to +p11 (h11 i j) = true \land p12 (h11 i j) (h12 i j) = true +\land h21 (h11 i j) (h12 i j) = i \land h22 (h11 i j) (h12 i j) = j +\land h11 i j < n1 \land h12 i j < m1) \to +(\forall i,j. i < n1 \to j < m1 \to p11 i = true \to p12 i j = true \to +p21 (h21 i j) = true \land p22 (h21 i j) (h22 i j) = true +\land h11 (h21 i j) (h22 i j) = i \land h12 (h21 i j) (h22 i j) = j +\land (h21 i j) < n2 \land (h22 i j) < m2) \to +iter_p_gen n1 p11 A + (\lambda x:nat .iter_p_gen m1 (p12 x) A (\lambda y. g x y) baseA plusA) + baseA plusA = +iter_p_gen n2 p21 A + (\lambda x:nat .iter_p_gen m2 (p22 x) A (\lambda y. g (h11 x y) (h12 x y)) baseA plusA ) + baseA plusA. + +intros. +rewrite < (iter_p_gen2' ? ? ? ? ? ? ? ? H H1 H2). +letin ha:= (\lambda x,y.(((h11 x y)*m1) + (h12 x y))). +letin ha12:= (\lambda x.(h21 (x/m1) (x \mod m1))). +letin ha22:= (\lambda x.(h22 (x/m1) (x \mod m1))). + +apply (trans_eq ? ? +(iter_p_gen n2 p21 A (\lambda x:nat. iter_p_gen m2 (p22 x) A + (\lambda y:nat.(g (((h11 x y)*m1+(h12 x y))/m1) (((h11 x y)*m1+(h12 x y))\mod m1))) baseA plusA ) baseA plusA)) +[ + apply (iter_p_gen_knm A baseA plusA H H1 H2 (\lambda e. (g (e/m1) (e \mod m1))) ha ha12 ha22);intros + [ elim (and_true ? ? H6). + cut(O \lt m1) + [ cut(x/m1 < n1) + [ cut((x \mod m1) < m1) + [ elim (H4 ? ? Hcut1 Hcut2 H7 H8). + elim H9.clear H9. + elim H11.clear H11. + elim H9.clear H9. + elim H11.clear H11. + split + [ split + [ split + [ split + [ assumption + | assumption + ] + | rewrite > H14. + rewrite > H13. + apply sym_eq. + apply div_mod. + assumption + ] + | assumption + ] + | assumption + ] + | apply lt_mod_m_m. + assumption + ] + | apply (lt_times_n_to_lt m1) + [ assumption + | apply (le_to_lt_to_lt ? x) + [ apply (eq_plus_to_le ? ? (x \mod m1)). + apply div_mod. + assumption + | assumption + ] + ] + ] + | apply not_le_to_lt.unfold.intro. + generalize in match H5. + apply (le_n_O_elim ? H9). + rewrite < times_n_O. + apply le_to_not_lt. + apply le_O_n. + ] + | elim (H3 ? ? H5 H6 H7 H8). + elim H9.clear H9. + elim H11.clear H11. + elim H9.clear H9. + elim H11.clear H11. + cut(((h11 i j)*m1 + (h12 i j))/m1 = (h11 i j)) + [ cut(((h11 i j)*m1 + (h12 i j)) \mod m1 = (h12 i j)) + [ split + [ split + [ split + [ apply true_to_true_to_andb_true + [ rewrite > Hcut. + assumption + | rewrite > Hcut1. + rewrite > Hcut. + assumption + ] + | rewrite > Hcut1. + rewrite > Hcut. + assumption + ] + | rewrite > Hcut1. + rewrite > Hcut. + assumption + ] + | cut(O \lt m1) + [ cut(O \lt n1) + [ apply (lt_to_le_to_lt ? ((h11 i j)*m1 + m1) ) + [ apply (lt_plus_r). + assumption + | rewrite > sym_plus. + rewrite > (sym_times (h11 i j) m1). + rewrite > times_n_Sm. + rewrite > sym_times. + apply (le_times_l). + assumption + ] + | apply not_le_to_lt.unfold.intro. + generalize in match H12. + apply (le_n_O_elim ? H11). + apply le_to_not_lt. + apply le_O_n + ] + | apply not_le_to_lt.unfold.intro. + generalize in match H10. + apply (le_n_O_elim ? H11). + apply le_to_not_lt. + apply le_O_n + ] + ] + | rewrite > (mod_plus_times m1 (h11 i j) (h12 i j)). + reflexivity. + assumption + ] + | rewrite > (div_plus_times m1 (h11 i j) (h12 i j)). + reflexivity. + assumption + ] + ] +| apply (eq_iter_p_gen1) + [ intros. reflexivity + | intros. + apply (eq_iter_p_gen1) + [ intros. reflexivity + | intros. + rewrite > (div_plus_times) + [ rewrite > (mod_plus_times) + [ reflexivity + | elim (H3 x x1 H5 H7 H6 H8). + assumption + ] + | elim (H3 x x1 H5 H7 H6 H8). + assumption + ] + ] + ] +] +qed. + +theorem iter_p_gen_iter_p_gen: +\forall A:Type. +\forall baseA: A. +\forall plusA: A \to A \to A. +(symmetric A plusA) \to +(associative A plusA) \to +(\forall a:A.(plusA a baseA) = a)\to +\forall g: nat \to nat \to A. +\forall n,m. +\forall p11,p21:nat \to bool. +\forall p12,p22:nat \to nat \to bool. +(\forall x,y. x < n \to y < m \to + (p11 x \land p12 x y) = (p21 y \land p22 y x)) \to +iter_p_gen n p11 A + (\lambda x:nat.iter_p_gen m (p12 x) A (\lambda y. g x y) baseA plusA) + baseA plusA = +iter_p_gen m p21 A + (\lambda y:nat.iter_p_gen n (p22 y) A (\lambda x. g x y) baseA plusA ) + baseA plusA. +intros. +apply (iter_p_gen_2_eq A baseA plusA H H1 H2 (\lambda x,y. g x y) (\lambda x,y.y) (\lambda x,y.x) (\lambda x,y.y) (\lambda x,y.x) + n m m n p11 p21 p12 p22) + [intros.split + [split + [split + [split + [split + [apply (andb_true_true ? (p12 j i)). + rewrite > H3 + [rewrite > H6.rewrite > H7.reflexivity + |assumption + |assumption + ] + |apply (andb_true_true_r (p11 j)). + rewrite > H3 + [rewrite > H6.rewrite > H7.reflexivity + |assumption + |assumption + ] + ] + |reflexivity + ] + |reflexivity + ] + |assumption + ] + |assumption + ] + |intros.split + [split + [split + [split + [split + [apply (andb_true_true ? (p22 j i)). + rewrite < H3 + [rewrite > H6.rewrite > H7.reflexivity + |assumption + |assumption + ] + |apply (andb_true_true_r (p21 j)). + rewrite < H3 + [rewrite > H6.rewrite > H7.reflexivity + |assumption + |assumption + ] + ] + |reflexivity + ] + |reflexivity + ] + |assumption + ] + |assumption + ] + ] +qed. + + + diff --git a/matita/library/nat/iteration2.ma b/matita/library/nat/iteration2.ma new file mode 100644 index 000000000..c0e0edbc5 --- /dev/null +++ b/matita/library/nat/iteration2.ma @@ -0,0 +1,983 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/primes.ma". +include "nat/ord.ma". +include "nat/generic_iter_p.ma". +include "nat/count.ma".(*necessary just to use bool_to_nat and bool_to_nat_andb*) + + +(* sigma_p on nautral numbers is a specialization of sigma_p_gen *) +definition sigma_p: nat \to (nat \to bool) \to (nat \to nat) \to nat \def +\lambda n, p, g. (iter_p_gen n p nat g O plus). + +theorem symmetricIntPlus: symmetric nat plus. +change with (\forall a,b:nat. (plus a b) = (plus b a)). +intros. +rewrite > sym_plus. +reflexivity. +qed. + +(*the following theorems on sigma_p in N are obtained by the more general ones + * in sigma_p_gen.ma + *) +theorem true_to_sigma_p_Sn: +\forall n:nat. \forall p:nat \to bool. \forall g:nat \to nat. +p n = true \to sigma_p (S n) p g = +(g n)+(sigma_p n p g). +intros. +unfold sigma_p. +apply true_to_iter_p_gen_Sn. +assumption. +qed. + +theorem false_to_sigma_p_Sn: +\forall n:nat. \forall p:nat \to bool. \forall g:nat \to nat. +p n = false \to sigma_p (S n) p g = sigma_p n p g. +intros. +unfold sigma_p. +apply false_to_iter_p_gen_Sn. +assumption. +qed. + +theorem eq_sigma_p: \forall p1,p2:nat \to bool. +\forall g1,g2: nat \to nat.\forall n. +(\forall x. x < n \to p1 x = p2 x) \to +(\forall x. x < n \to g1 x = g2 x) \to +sigma_p n p1 g1 = sigma_p n p2 g2. +intros. +unfold sigma_p. +apply eq_iter_p_gen; + assumption. +qed. + +theorem eq_sigma_p1: \forall p1,p2:nat \to bool. +\forall g1,g2: nat \to nat.\forall n. +(\forall x. x < n \to p1 x = p2 x) \to +(\forall x. x < n \to p1 x = true \to g1 x = g2 x) \to +sigma_p n p1 g1 = sigma_p n p2 g2. +intros. +unfold sigma_p. +apply eq_iter_p_gen1; + assumption. +qed. + +theorem sigma_p_false: +\forall g: nat \to nat.\forall n.sigma_p n (\lambda x.false) g = O. +intros. +unfold sigma_p. +apply iter_p_gen_false. +qed. + +theorem sigma_p_plus: \forall n,k:nat.\forall p:nat \to bool. +\forall g: nat \to nat. +sigma_p (k+n) p g += sigma_p k (\lambda x.p (x+n)) (\lambda x.g (x+n)) + sigma_p n p g. +intros. +unfold sigma_p. +apply (iter_p_gen_plusA nat n k p g O plus) +[ apply symmetricIntPlus. +| intros. + apply sym_eq. + apply plus_n_O +| apply associative_plus +] +qed. + +theorem false_to_eq_sigma_p: \forall n,m:nat.n \le m \to +\forall p:nat \to bool. +\forall g: nat \to nat. (\forall i:nat. n \le i \to i < m \to +p i = false) \to sigma_p m p g = sigma_p n p g. +intros. +unfold sigma_p. +apply (false_to_eq_iter_p_gen); + assumption. +qed. + +theorem or_false_to_eq_sigma_p: +\forall n,m:nat.\forall p:nat \to bool. +\forall g: nat \to nat. +n \le m \to (\forall i:nat. n \le i \to i < m \to p i = false \lor g i = O) +\to sigma_p m p g = sigma_p n p g. +intros. +unfold sigma_p. +apply or_false_eq_baseA_to_eq_iter_p_gen + [intros.reflexivity + |assumption + |assumption + ] +qed. + +theorem bool_to_nat_to_eq_sigma_p: +\forall n:nat.\forall p1,p2:nat \to bool. +\forall g1,g2: nat \to nat. +(\forall i:nat. +bool_to_nat (p1 i)*(g1 i) = bool_to_nat (p2 i)*(g2 i)) +\to sigma_p n p1 g1 = sigma_p n p2 g2. +intros.elim n + [reflexivity + |generalize in match (H n1). + apply (bool_elim ? (p1 n1));intro + [apply (bool_elim ? (p2 n1));intros + [rewrite > true_to_sigma_p_Sn + [rewrite > true_to_sigma_p_Sn + [apply eq_f2 + [simplify in H4. + rewrite > plus_n_O. + rewrite > plus_n_O in ⊢ (? ? ? %). + assumption + |assumption + ] + |assumption + ] + |assumption + ] + |rewrite > true_to_sigma_p_Sn + [rewrite > false_to_sigma_p_Sn + [change in ⊢ (? ? ? %) with (O + sigma_p n1 p2 g2). + apply eq_f2 + [simplify in H4. + rewrite > plus_n_O. + assumption + |assumption + ] + |assumption + ] + |assumption + ] + ] + |apply (bool_elim ? (p2 n1));intros + [rewrite > false_to_sigma_p_Sn + [rewrite > true_to_sigma_p_Sn + [change in ⊢ (? ? % ?) with (O + sigma_p n1 p1 g1). + apply eq_f2 + [simplify in H4. + rewrite < plus_n_O in H4. + assumption + |assumption + ] + |assumption + ] + |assumption + ] + |rewrite > false_to_sigma_p_Sn + [rewrite > false_to_sigma_p_Sn + [assumption + |assumption + ] + |assumption + ] + ] + ] + ] +qed. + +theorem sigma_p2 : +\forall n,m:nat. +\forall p1,p2:nat \to bool. +\forall g: nat \to nat \to nat. +sigma_p (n*m) + (\lambda x.andb (p1 (div x m)) (p2 (mod x m))) + (\lambda x.g (div x m) (mod x m)) = +sigma_p n p1 + (\lambda x.sigma_p m p2 (g x)). +intros. +unfold sigma_p. +apply (iter_p_gen2 n m p1 p2 nat g O plus) +[ apply symmetricIntPlus +| apply associative_plus +| intros. + apply sym_eq. + apply plus_n_O +] +qed. + +theorem sigma_p2' : +\forall n,m:nat. +\forall p1:nat \to bool. +\forall p2:nat \to nat \to bool. +\forall g: nat \to nat \to nat. +sigma_p (n*m) + (\lambda x.andb (p1 (div x m)) (p2 (div x m) (mod x m))) + (\lambda x.g (div x m) (mod x m)) = +sigma_p n p1 + (\lambda x.sigma_p m (p2 x) (g x)). +intros. +unfold sigma_p. +apply (iter_p_gen2' n m p1 p2 nat g O plus) +[ apply symmetricIntPlus +| apply associative_plus +| intros. + apply sym_eq. + apply plus_n_O +] +qed. + +lemma sigma_p_gi: \forall g: nat \to nat. +\forall n,i.\forall p:nat \to bool.i < n \to p i = true \to +sigma_p n p g = g i + sigma_p n (\lambda x. andb (p x) (notb (eqb x i))) g. +intros. +unfold sigma_p. +apply (iter_p_gen_gi) +[ apply symmetricIntPlus +| apply associative_plus +| intros. + apply sym_eq. + apply plus_n_O +| assumption +| assumption +] +qed. + +theorem eq_sigma_p_gh: +\forall g,h,h1: nat \to nat.\forall n,n1. +\forall p1,p2:nat \to bool. +(\forall i. i < n \to p1 i = true \to p2 (h i) = true) \to +(\forall i. i < n \to p1 i = true \to h1 (h i) = i) \to +(\forall i. i < n \to p1 i = true \to h i < n1) \to +(\forall j. j < n1 \to p2 j = true \to p1 (h1 j) = true) \to +(\forall j. j < n1 \to p2 j = true \to h (h1 j) = j) \to +(\forall j. j < n1 \to p2 j = true \to h1 j < n) \to +sigma_p n p1 (\lambda x.g(h x)) = sigma_p n1 p2 g. +intros. +unfold sigma_p. +apply (eq_iter_p_gen_gh nat O plus ? ? ? g h h1 n n1 p1 p2) +[ apply symmetricIntPlus +| apply associative_plus +| intros. + apply sym_eq. + apply plus_n_O +| assumption +| assumption +| assumption +| assumption +| assumption +| assumption +] +qed. + +theorem eq_sigma_p_pred: +\forall n,p,g. p O = true \to +sigma_p (S n) (\lambda i.p (pred i)) (\lambda i.g(pred i)) = +plus (sigma_p n p g) (g O). +intros. +unfold sigma_p. +apply eq_iter_p_gen_pred + [assumption + |apply symmetricIntPlus + |apply associative_plus + |intros.apply sym_eq.apply plus_n_O + ] +qed. + +(* monotonicity *) +theorem le_sigma_p: +\forall n:nat. \forall p:nat \to bool. \forall g1,g2:nat \to nat. +(\forall i. i < n \to p i = true \to g1 i \le g2 i ) \to +sigma_p n p g1 \le sigma_p n p g2. +intros. +generalize in match H. +elim n + [apply le_n. + |apply (bool_elim ? (p n1));intros + [rewrite > true_to_sigma_p_Sn + [rewrite > true_to_sigma_p_Sn in ⊢ (? ? %) + [apply le_plus + [apply H2[apply le_n|assumption] + |apply H1. + intros. + apply H2[apply le_S.assumption|assumption] + ] + |assumption + ] + |assumption + ] + |rewrite > false_to_sigma_p_Sn + [rewrite > false_to_sigma_p_Sn in ⊢ (? ? %) + [apply H1. + intros. + apply H2[apply le_S.assumption|assumption] + |assumption + ] + |assumption + ] + ] + ] +qed. + +(* a slightly more general result *) +theorem le_sigma_p1: +\forall n:nat. \forall p1,p2:nat \to bool. \forall g1,g2:nat \to nat. +(\forall i. i < n \to +bool_to_nat (p1 i)*(g1 i) \le bool_to_nat (p2 i)*g2 i) \to +sigma_p n p1 g1 \le sigma_p n p2 g2. +intros. +generalize in match H. +elim n + [apply le_n. + |apply (bool_elim ? (p1 n1));intros + [apply (bool_elim ? (p2 n1));intros + [rewrite > true_to_sigma_p_Sn + [rewrite > true_to_sigma_p_Sn in ⊢ (? ? %) + [apply le_plus + [lapply (H2 n1) as H5 + [rewrite > H3 in H5. + rewrite > H4 in H5. + simplify in H5. + rewrite < plus_n_O in H5. + rewrite < plus_n_O in H5. + assumption + |apply le_S_S.apply le_n + ] + |apply H1.intros. + apply H2.apply le_S.assumption + ] + |assumption + ] + |assumption + ] + |rewrite > true_to_sigma_p_Sn + [rewrite > false_to_sigma_p_Sn in ⊢ (? ? %) + [change in ⊢ (? ? %) with (O + sigma_p n1 p2 g2). + apply le_plus + [lapply (H2 n1) as H5 + [rewrite > H3 in H5. + rewrite > H4 in H5. + simplify in H5. + rewrite < plus_n_O in H5. + assumption + |apply le_S_S.apply le_n + ] + |apply H1.intros. + apply H2.apply le_S.assumption + ] + |assumption + ] + |assumption + ] + ] + |apply (bool_elim ? (p2 n1));intros + [rewrite > false_to_sigma_p_Sn + [rewrite > true_to_sigma_p_Sn in ⊢ (? ? %) + [change in ⊢ (? % ?) with (O + sigma_p n1 p1 g1). + apply le_plus + [lapply (H2 n1) as H5 + [rewrite > H3 in H5. + rewrite > H4 in H5. + simplify in H5. + rewrite < plus_n_O in H5. + assumption + |apply le_S_S.apply le_n + ] + |apply H1.intros. + apply H2.apply le_S.assumption + ] + |assumption + ] + |assumption + ] + |rewrite > false_to_sigma_p_Sn + [rewrite > false_to_sigma_p_Sn in ⊢ (? ? %) + [apply H1.intros. + apply H2.apply le_S.assumption + |assumption + ] + |assumption + ] + ] + ] + ] +qed. + +theorem lt_sigma_p: +\forall n:nat. \forall p:nat \to bool. \forall g1,g2:nat \to nat. +(\forall i. i < n \to p i = true \to g1 i \le g2 i ) \to +(\exists i. i < n \and (p i = true) \and (g1 i < g2 i)) \to +sigma_p n p g1 < sigma_p n p g2. +intros 4. +elim n + [elim H1.clear H1. + elim H2.clear H2. + elim H1.clear H1. + apply False_ind. + apply (lt_to_not_le ? ? H2). + apply le_O_n + |apply (bool_elim ? (p n1));intros + [apply (bool_elim ? (leb (S (g1 n1)) (g2 n1)));intros + [rewrite > true_to_sigma_p_Sn + [rewrite > true_to_sigma_p_Sn in ⊢ (? ? %) + [change with + (S (g1 n1)+sigma_p n1 p g1 \le g2 n1+sigma_p n1 p g2). + apply le_plus + [apply leb_true_to_le.assumption + |apply le_sigma_p.intros. + apply H1 + [apply lt_to_le.apply le_S_S.assumption + |assumption + ] + ] + |assumption + ] + |assumption + ] + |rewrite > true_to_sigma_p_Sn + [rewrite > true_to_sigma_p_Sn in ⊢ (? ? %) + [unfold lt. + rewrite > plus_n_Sm. + apply le_plus + [apply H1 + [apply le_n + |assumption + ] + |apply H + [intros.apply H1 + [apply lt_to_le.apply le_S_S.assumption + |assumption + ] + |elim H2.clear H2. + elim H5.clear H5. + elim H2.clear H2. + apply (ex_intro ? ? a). + split + [split + [elim (le_to_or_lt_eq a n1) + [assumption + |absurd (g1 a < g2 a) + [assumption + |apply leb_false_to_not_le. + rewrite > H2. + assumption + ] + |apply le_S_S_to_le. + assumption + ] + |assumption + ] + |assumption + ] + ] + ] + |assumption + ] + |assumption + ] + ] + |rewrite > false_to_sigma_p_Sn + [rewrite > false_to_sigma_p_Sn in ⊢ (? ? %) + [apply H + [intros.apply H1 + [apply lt_to_le.apply le_S_S.assumption + |assumption + ] + |elim H2.clear H2. + elim H4.clear H4. + elim H2.clear H2. + apply (ex_intro ? ? a). + split + [split + [elim (le_to_or_lt_eq a n1) + [assumption + |apply False_ind. + apply not_eq_true_false. + rewrite < H6. + rewrite < H3. + rewrite < H2. + reflexivity + |apply le_S_S_to_le. + assumption + ] + |assumption + ] + |assumption + ] + ] + |assumption + ] + |assumption + ] + ] + ] +qed. + +theorem sigma_p_divides: +\forall n,m,p:nat.O < n \to prime p \to Not (divides p n) \to +\forall g: nat \to nat. +sigma_p (S (n*(exp p m))) (\lambda x.divides_b x (n*(exp p m))) g = +sigma_p (S n) (\lambda x.divides_b x n) + (\lambda x.sigma_p (S m) (\lambda y.true) (\lambda y.g (x*(exp p y)))). +intros. +unfold sigma_p. +apply (iter_p_gen_divides nat O plus n m p ? ? ? g) +[ assumption +| assumption +| assumption +| apply symmetricIntPlus +| apply associative_plus +| intros. + apply sym_eq. + apply plus_n_O +] +qed. + +theorem distributive_times_plus_sigma_p: \forall n,k:nat. \forall p:nat \to bool. \forall g:nat \to nat. +k*(sigma_p n p g) = sigma_p n p (\lambda i:nat.k * (g i)). +intros. +apply (distributive_times_plus_iter_p_gen nat plus O times n k p g) +[ apply symmetricIntPlus +| apply associative_plus +| intros. + apply sym_eq. + apply plus_n_O +| apply symmetric_times +| apply distributive_times_plus +| intros. + rewrite < (times_n_O a). + reflexivity +] +qed. + +(*some properties of sigma_p invoked with an "always true" predicate (in this + way sigma_p just counts the elements, without doing any control) or with + the nat \to nat function which always returns (S O). + It 's not easily possible proving these theorems in a general form + in generic_sigma_p.ma + *) + +theorem sigma_p_true: \forall n:nat. +(sigma_p n (\lambda x.true) (\lambda x.S O)) = n. +intros. +elim n +[ simplify. + reflexivity +| rewrite > (true_to_sigma_p_Sn n1 (\lambda x:nat.true) (\lambda x:nat.S O)) + [ rewrite > H. + simplify. + reflexivity + | reflexivity + ] +] +qed. + +theorem sigma_P_SO_to_sigma_p_true: \forall n:nat. \forall g:nat \to bool. +sigma_p n g (\lambda n:nat. (S O)) = +sigma_p n (\lambda x:nat.true) (\lambda i:nat.bool_to_nat (g i)). +intros. +elim n +[ simplify. + reflexivity +| cut ((g n1) = true \lor (g n1) = false) + [ rewrite > true_to_sigma_p_Sn in \vdash (? ? ? %) + [ elim Hcut + [ rewrite > H1. + rewrite > true_to_sigma_p_Sn in \vdash (? ? % ?) + [ simplify. + apply eq_f. + assumption + | assumption + ] + | rewrite > H1. + rewrite > false_to_sigma_p_Sn in \vdash (? ? % ?) + [ simplify. + assumption + | assumption + ] + ] + | reflexivity + ] + | elim (g n1) + [ left. + reflexivity + | right. + reflexivity + ] + ] +] +qed. + +(* I introduce an equivalence in the form map_iter_i in order to use + * the existing result about permutation in that part of the library. + *) + +theorem eq_map_iter_i_sigma_p_alwaysTrue: \forall n:nat.\forall g:nat \to nat. +map_iter_i n g plus O = sigma_p (S n) (\lambda c:nat.true) g. +intros. +elim n +[ simplify. + rewrite < plus_n_O. + reflexivity +| rewrite > true_to_sigma_p_Sn + [ simplify in \vdash (? ? % ?). + rewrite < plus_n_O. + apply eq_f. + assumption + | reflexivity + ] +] +qed. + +theorem sigma_p_plus_1: \forall n:nat. \forall f,g:nat \to nat. +\forall p. +sigma_p n p (\lambda a:nat.(f a) + (g a)) = +sigma_p n p f + sigma_p n p g. +intros. +elim n +[ simplify. + reflexivity +| apply (bool_elim ? (p n1)); intro; + [ rewrite > true_to_sigma_p_Sn + [ rewrite > (true_to_sigma_p_Sn n1 p f) + [ rewrite > (true_to_sigma_p_Sn n1 p g) + [ rewrite > assoc_plus in \vdash (? ? ? %). + rewrite < assoc_plus in \vdash (? ? ? (? ? %)). + rewrite < sym_plus in \vdash (? ? ? (? ? (? % ?))). + rewrite > assoc_plus in \vdash (? ? ? (? ? %)). + rewrite < assoc_plus in \vdash (? ? ? %). + apply eq_f. + assumption]]] + assumption + | rewrite > false_to_sigma_p_Sn + [ rewrite > (false_to_sigma_p_Sn n1 p f) + [ rewrite > (false_to_sigma_p_Sn n1 p g) + [assumption]]] + assumption +]] +qed. + +theorem eq_sigma_p_sigma_p_times1 : \forall n,m:nat.\forall f:nat \to nat. +sigma_p (n*m) (\lambda x:nat.true) f = +sigma_p m (\lambda x:nat.true) + (\lambda a.(sigma_p n (\lambda x:nat.true) (\lambda b.f (b*m + a)))). +intro. +elim n +[ simplify. + elim m + [ simplify. + reflexivity + | rewrite > true_to_sigma_p_Sn + [ rewrite < H. + reflexivity + | reflexivity + ] + ] +| change in \vdash (? ? ? (? ? ? (\lambda a:?.%))) with ((f ((n1*m)+a)) + + (sigma_p n1 (\lambda x:nat.true) (\lambda b:nat.f (b*m +a)))). + rewrite > sigma_p_plus_1 in \vdash (? ? ? %). + rewrite > (sym_times (S n1) m). + rewrite < (times_n_Sm m n1). + rewrite > sigma_p_plus in \vdash (? ? % ?). + apply eq_f2 + [ rewrite < (sym_times m n1). + apply eq_sigma_p + [ intros. + reflexivity + | intros. + rewrite < (sym_plus ? (m * n1)). + reflexivity + ] + | rewrite > (sym_times m n1). + apply H + ] +] +qed. + +theorem eq_sigma_p_sigma_p_times2 : \forall n,m:nat.\forall f:nat \to nat. +sigma_p (n *m) (\lambda c:nat.true) f = +sigma_p n (\lambda c:nat.true) + (\lambda a.(sigma_p m (\lambda c:nat.true) (\lambda b:nat.f (b* n + a)))). +intros. +rewrite > sym_times. +apply eq_sigma_p_sigma_p_times1. +qed. + +theorem sigma_p_times:\forall n,m:nat. +\forall f,f1,f2:nat \to bool. +\forall g:nat \to nat \to nat. +\forall g1,g2: nat \to nat. +(\forall a,b:nat. a < (S n) \to b < (S m) \to (g b a) < (S n)*(S m)) \to +(\forall a,b:nat. a < (S n) \to b < (S m) \to (g1 (g b a)) = a) \to +(\forall a,b:nat. a < (S n) \to b < (S m) \to (g2 (g b a)) = b) \to +(\forall a,b:nat. a < (S n) \to b < (S m) \to f (g b a) = andb (f2 b) (f1 a)) \to +(sigma_p ((S n) * (S m)) f (\lambda c:nat.(S O))) = +sigma_p (S n) f1 (\lambda c:nat.(S O)) * sigma_p (S m) f2 (\lambda c:nat.(S O)). +intros. + +rewrite > (sigma_P_SO_to_sigma_p_true ). +rewrite > (S_pred ((S n)*(S m))) in \vdash (? ? (? % ? ?) ?) +[ rewrite < (eq_map_iter_i_sigma_p_alwaysTrue (pred ((S n)* (S m)))). + rewrite > (permut_to_eq_map_iter_i plus assoc_plus sym_plus ? ? ? + (\lambda i.g (div i (S n)) (mod i (S n)))) + [ rewrite > eq_map_iter_i_sigma_p_alwaysTrue. + rewrite < S_pred + [ rewrite > eq_sigma_p_sigma_p_times2. + apply (trans_eq ? ? (sigma_p (S n) (\lambda c:nat.true) + (\lambda a. sigma_p (S m) (\lambda c:nat.true) + (\lambda b.(bool_to_nat (f2 b))*(bool_to_nat (f1 a)))))) + [ apply eq_sigma_p;intros + [ reflexivity + | apply eq_sigma_p;intros + [ reflexivity + | + rewrite > (div_mod_spec_to_eq (x1*(S n) + x) (S n) ((x1*(S n) + x)/(S n)) + ((x1*(S n) + x) \mod (S n)) x1 x) + [ rewrite > (div_mod_spec_to_eq2 (x1*(S n) + x) (S n) ((x1*(S n) + x)/(S n)) + ((x1*(S n) + x) \mod (S n)) x1 x) + [ rewrite > H3 + [ apply bool_to_nat_andb + | assumption + | assumption + ] + | apply div_mod_spec_div_mod. + apply lt_O_S + | constructor 1 + [ assumption + | reflexivity + ] + ] + | apply div_mod_spec_div_mod. + apply lt_O_S + | constructor 1 + [ assumption + | reflexivity + ] + ] + ] + ] + | apply (trans_eq ? ? + (sigma_p (S n) (\lambda c:nat.true) (\lambda n.((bool_to_nat (f1 n)) * + (sigma_p (S m) (\lambda c:nat.true) (\lambda n.bool_to_nat (f2 n))))))) + [ apply eq_sigma_p;intros + [ reflexivity + | rewrite > distributive_times_plus_sigma_p. + apply eq_sigma_p;intros + [ reflexivity + | rewrite > sym_times. + reflexivity + ] + ] + | apply sym_eq. + rewrite > sigma_P_SO_to_sigma_p_true. + rewrite > sigma_P_SO_to_sigma_p_true in \vdash (? ? (? ? %) ?). + rewrite > sym_times. + rewrite > distributive_times_plus_sigma_p. + apply eq_sigma_p;intros + [ reflexivity + | rewrite > distributive_times_plus_sigma_p. + rewrite < sym_times. + rewrite > distributive_times_plus_sigma_p. + apply eq_sigma_p; + intros; reflexivity + ] + ] + ] + | apply lt_O_times_S_S + ] + + | unfold permut. + split + [ intros. + rewrite < plus_n_O. + apply le_S_S_to_le. + rewrite < S_pred in \vdash (? ? %) + [ change with ((g (i/(S n)) (i \mod (S n))) \lt (S n)*(S m)). + apply H + [ apply lt_mod_m_m. + unfold lt. + apply le_S_S. + apply le_O_n + | apply (lt_times_to_lt_l n). + apply (le_to_lt_to_lt ? i) + [ rewrite > (div_mod i (S n)) in \vdash (? ? %) + [ rewrite > sym_plus. + apply le_plus_n + | unfold lt. + apply le_S_S. + apply le_O_n + ] + | unfold lt. + rewrite > S_pred in \vdash (? ? %) + [ apply le_S_S. + rewrite > plus_n_O in \vdash (? ? %). + rewrite > sym_times. + assumption + | apply lt_O_times_S_S + ] + ] + ] + | apply lt_O_times_S_S + ] + | rewrite < plus_n_O. + unfold injn. + intros. + cut (i < (S n)*(S m)) + [ cut (j < (S n)*(S m)) + [ cut ((i \mod (S n)) < (S n)) + [ cut ((i/(S n)) < (S m)) + [ cut ((j \mod (S n)) < (S n)) + [ cut ((j/(S n)) < (S m)) + [ rewrite > (div_mod i (S n)) + [ rewrite > (div_mod j (S n)) + [ rewrite < (H1 (i \mod (S n)) (i/(S n)) Hcut2 Hcut3). + rewrite < (H2 (i \mod (S n)) (i/(S n)) Hcut2 Hcut3) in \vdash (? ? (? % ?) ?). + rewrite < (H1 (j \mod (S n)) (j/(S n)) Hcut4 Hcut5). + rewrite < (H2 (j \mod (S n)) (j/(S n)) Hcut4 Hcut5) in \vdash (? ? ? (? % ?)). + rewrite > H6. + reflexivity + | unfold lt. + apply le_S_S. + apply le_O_n + ] + | unfold lt. + apply le_S_S. + apply le_O_n + ] + | apply (lt_times_to_lt_l n). + apply (le_to_lt_to_lt ? j) + [ rewrite > (div_mod j (S n)) in \vdash (? ? %) + [ rewrite > sym_plus. + apply le_plus_n + | unfold lt. apply le_S_S. + apply le_O_n + ] + | rewrite < sym_times. + assumption + ] + ] + | apply lt_mod_m_m. + unfold lt. + apply le_S_S. + apply le_O_n + ] + | apply (lt_times_to_lt_l n). + apply (le_to_lt_to_lt ? i) + [ rewrite > (div_mod i (S n)) in \vdash (? ? %) + [ rewrite > sym_plus. + apply le_plus_n + | unfold lt. + apply le_S_S. + apply le_O_n + ] + | rewrite < sym_times. + assumption + ] + ] + | apply lt_mod_m_m. + unfold lt. + apply le_S_S. + apply le_O_n + ] + | unfold lt. + rewrite > S_pred in \vdash (? ? %) + [ apply le_S_S. + assumption + | apply lt_O_times_S_S + ] + ] + | unfold lt. + rewrite > S_pred in \vdash (? ? %) + [ apply le_S_S. + assumption + | apply lt_O_times_S_S + ] + ] + ] + | intros. + apply False_ind. + apply (not_le_Sn_O m1 H4) + ] +| apply lt_O_times_S_S +] +qed. + +theorem sigma_p_knm: +\forall g: nat \to nat. +\forall h2:nat \to nat \to nat. +\forall h11,h12:nat \to nat. +\forall k,n,m. +\forall p1,p21:nat \to bool. +\forall p22:nat \to nat \to bool. +(\forall x. x < k \to p1 x = true \to +p21 (h11 x) = true \land p22 (h11 x) (h12 x) = true +\land h2 (h11 x) (h12 x) = x +\land (h11 x) < n \land (h12 x) < m) \to +(\forall i,j. i < n \to j < m \to p21 i = true \to p22 i j = true \to +p1 (h2 i j) = true \land +h11 (h2 i j) = i \land h12 (h2 i j) = j +\land h2 i j < k) \to +sigma_p k p1 g= +sigma_p n p21 (\lambda x:nat.sigma_p m (p22 x) (\lambda y. g (h2 x y))). +intros. +unfold sigma_p. +unfold sigma_p in \vdash (? ? ? (? ? ? ? (\lambda x:?.%) ? ?)). +apply iter_p_gen_knm + [apply symmetricIntPlus + |apply associative_plus + |intro.rewrite < plus_n_O.reflexivity + |exact h11 + |exact h12 + |assumption + |assumption + ] +qed. + + +theorem sigma_p2_eq: +\forall g: nat \to nat \to nat. +\forall h11,h12,h21,h22: nat \to nat \to nat. +\forall n1,m1,n2,m2. +\forall p11,p21:nat \to bool. +\forall p12,p22:nat \to nat \to bool. +(\forall i,j. i < n2 \to j < m2 \to p21 i = true \to p22 i j = true \to +p11 (h11 i j) = true \land p12 (h11 i j) (h12 i j) = true +\land h21 (h11 i j) (h12 i j) = i \land h22 (h11 i j) (h12 i j) = j +\land h11 i j < n1 \land h12 i j < m1) \to +(\forall i,j. i < n1 \to j < m1 \to p11 i = true \to p12 i j = true \to +p21 (h21 i j) = true \land p22 (h21 i j) (h22 i j) = true +\land h11 (h21 i j) (h22 i j) = i \land h12 (h21 i j) (h22 i j) = j +\land (h21 i j) < n2 \land (h22 i j) < m2) \to +sigma_p n1 p11 (\lambda x:nat .sigma_p m1 (p12 x) (\lambda y. g x y)) = +sigma_p n2 p21 (\lambda x:nat .sigma_p m2 (p22 x) (\lambda y. g (h11 x y) (h12 x y))). +intros. +unfold sigma_p. +unfold sigma_p in \vdash (? ? (? ? ? ? (\lambda x:?.%) ? ?) ?). +unfold sigma_p in \vdash (? ? ? (? ? ? ? (\lambda x:?.%) ? ?)). + +apply(iter_p_gen_2_eq nat O plus ? ? ? g h11 h12 h21 h22 n1 m1 n2 m2 p11 p21 p12 p22) +[ apply symmetricIntPlus +| apply associative_plus +| intro. + rewrite < (plus_n_O). + reflexivity +| assumption +| assumption +] +qed. + +theorem sigma_p_sigma_p: +\forall g: nat \to nat \to nat. +\forall n,m. +\forall p11,p21:nat \to bool. +\forall p12,p22:nat \to nat \to bool. +(\forall x,y. x < n \to y < m \to + (p11 x \land p12 x y) = (p21 y \land p22 y x)) \to +sigma_p n p11 (\lambda x:nat.sigma_p m (p12 x) (\lambda y. g x y)) = +sigma_p m p21 (\lambda y:nat.sigma_p n (p22 y) (\lambda x. g x y)). +intros. +unfold sigma_p.unfold sigma_p. +apply (iter_p_gen_iter_p_gen ? ? ? sym_plus assoc_plus) + [intros.apply sym_eq.apply plus_n_O. + |assumption + ] +qed. \ No newline at end of file diff --git a/matita/library/nat/le_arith.ma b/matita/library/nat/le_arith.ma new file mode 100644 index 000000000..7e101cc13 --- /dev/null +++ b/matita/library/nat/le_arith.ma @@ -0,0 +1,170 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/times.ma". +include "nat/orders.ma". + +(* plus *) +theorem monotonic_le_plus_r: +\forall n:nat.monotonic nat le (\lambda m.n + m). +simplify.intros.elim n + [simplify.assumption. + |simplify.apply le_S_S.assumption + ] +qed. + +theorem le_plus_r: \forall p,n,m:nat. n \le m \to p + n \le p + m +\def monotonic_le_plus_r. + +theorem monotonic_le_plus_l: +\forall m:nat.monotonic nat le (\lambda n.n + m). +simplify.intros. +rewrite < sym_plus.rewrite < (sym_plus m). +apply le_plus_r.assumption. +qed. + +theorem le_plus_l: \forall p,n,m:nat. n \le m \to n + p \le m + p +\def monotonic_le_plus_l. + +theorem le_plus: \forall n1,n2,m1,m2:nat. n1 \le n2 \to m1 \le m2 +\to n1 + m1 \le n2 + m2. +intros. +(** +auto. +*) +apply (transitive_le (plus n1 m1) (plus n1 m2) (plus n2 m2) ? ?); + [apply (monotonic_le_plus_r n1 m1 m2 ?). + apply (H1). + |apply (monotonic_le_plus_l m2 n1 n2 ?). + apply (H). + ] +(* end auto($Revision$) proof: TIME=0.61 SIZE=100 DEPTH=100 *) +(* +apply (trans_le ? (n2 + m1)). +apply le_plus_l.assumption. +apply le_plus_r.assumption. +*) +qed. + +theorem le_plus_n :\forall n,m:nat. m \le n + m. +intros.change with (O+m \le n+m). +apply le_plus_l.apply le_O_n. +qed. + +theorem le_plus_n_r :\forall n,m:nat. m \le m + n. +intros.rewrite > sym_plus. +apply le_plus_n. +qed. + +theorem eq_plus_to_le: \forall n,m,p:nat.n=m+p \to m \le n. +intros.rewrite > H. +rewrite < sym_plus. +apply le_plus_n. +qed. + +theorem le_plus_to_le: +\forall a,n,m. a + n \le a + m \to n \le m. +intro. +elim a + [assumption + |apply H. + apply le_S_S_to_le.assumption + ] +qed. + +(* times *) +theorem monotonic_le_times_r: +\forall n:nat.monotonic nat le (\lambda m. n * m). +simplify.intros.elim n. +simplify.apply le_O_n. +simplify.apply le_plus. +assumption. +assumption. +qed. + +theorem le_times_r: \forall p,n,m:nat. n \le m \to p*n \le p*m +\def monotonic_le_times_r. + +theorem monotonic_le_times_l: +\forall m:nat.monotonic nat le (\lambda n.n*m). +simplify.intros. +rewrite < sym_times.rewrite < (sym_times m). +apply le_times_r.assumption. +qed. + +theorem le_times_l: \forall p,n,m:nat. n \le m \to n*p \le m*p +\def monotonic_le_times_l. + +theorem le_times: \forall n1,n2,m1,m2:nat. n1 \le n2 \to m1 \le m2 +\to n1*m1 \le n2*m2. +intros. +apply (trans_le ? (n2*m1)). +apply le_times_l.assumption. +apply le_times_r.assumption. +qed. + +theorem le_times_n: \forall n,m:nat.(S O) \le n \to m \le n*m. +intros.elim H.simplify. +elim (plus_n_O ?).apply le_n. +simplify.rewrite < sym_plus.apply le_plus_n. +qed. + +theorem le_times_to_le: +\forall a,n,m. S O \le a \to a * n \le a * m \to n \le m. +intro. +apply nat_elim2;intros + [apply le_O_n + |apply False_ind. + rewrite < times_n_O in H1. + generalize in match H1. + apply (lt_O_n_elim ? H). + intros. + simplify in H2. + apply (le_to_not_lt ? ? H2). + apply lt_O_S + |apply le_S_S. + apply H + [assumption + |rewrite < times_n_Sm in H2. + rewrite < times_n_Sm in H2. + apply (le_plus_to_le a). + assumption + ] + ] +qed. + +theorem le_S_times_SSO: \forall n,m.O < m \to +n \le m \to S n \le (S(S O))*m. +intros. +simplify. +rewrite > plus_n_O. +simplify.rewrite > plus_n_Sm. +apply le_plus + [assumption + |rewrite < plus_n_O. + assumption + ] +qed. +(*0 and times *) +theorem O_lt_const_to_le_times_const: \forall a,c:nat. +O \lt c \to a \le a*c. +intros. +rewrite > (times_n_SO a) in \vdash (? % ?). +apply le_times +[ apply le_n +| assumption +] +qed. diff --git a/matita/library/nat/log.ma b/matita/library/nat/log.ma new file mode 100644 index 000000000..8ae0957d5 --- /dev/null +++ b/matita/library/nat/log.ma @@ -0,0 +1,474 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "datatypes/constructors.ma". +include "nat/minimization.ma". +include "nat/relevant_equations.ma". +include "nat/primes.ma". +include "nat/iteration2.ma". +include "nat/div_and_mod_diseq.ma". + +definition log \def \lambda p,n. +max n (\lambda x.leb (exp p x) n). + +theorem le_exp_log: \forall p,n. O < n \to +exp p (log p n) \le n. +intros. +apply leb_true_to_le. +unfold log. +apply (f_max_true (\lambda x.leb (exp p x) n)). +apply (ex_intro ? ? O). +split + [apply le_O_n + |apply le_to_leb_true.simplify.assumption + ] +qed. + +theorem log_SO: \forall n. S O < n \to log n (S O) = O. +intros. +apply sym_eq.apply le_n_O_to_eq. +apply (le_exp_to_le n) + [assumption + |simplify in ⊢ (? ? %). + apply le_exp_log. + apply le_n + ] +qed. + +theorem lt_to_log_O: \forall n,m. O < m \to m < n \to log n m = O. +intros. +apply sym_eq.apply le_n_O_to_eq. +apply le_S_S_to_le. +apply (lt_exp_to_lt n) + [apply (le_to_lt_to_lt ? m);assumption + |simplify in ⊢ (? ? %). + rewrite < times_n_SO. + apply (le_to_lt_to_lt ? m) + [apply le_exp_log.assumption + |assumption + ] + ] +qed. + +theorem lt_log_n_n: \forall p, n. S O < p \to O < n \to log p n < n. +intros. +cut (log p n \le n) + [elim (le_to_or_lt_eq ? ? Hcut) + [assumption + |absurd (exp p n \le n) + [rewrite < H2 in ⊢ (? (? ? %) ?). + apply le_exp_log. + assumption + |apply lt_to_not_le. + apply lt_m_exp_nm. + assumption + ] + ] + |unfold log.apply le_max_n + ] +qed. + +theorem lt_O_log: \forall p,n. O < n \to p \le n \to O < log p n. +intros. +unfold log. +apply not_lt_to_le. +intro. +apply (leb_false_to_not_le ? ? ? H1). +rewrite > (exp_n_SO p). +apply (lt_max_to_false ? ? ? H2). +assumption. +qed. + +theorem le_log_n_n: \forall p,n. S O < p \to log p n \le n. +intros. +cases n + [apply le_n + |apply lt_to_le. + apply lt_log_n_n + [assumption|apply lt_O_S] + ] +qed. + +theorem lt_exp_log: \forall p,n. S O < p \to n < exp p (S (log p n)). +intros.cases n + [simplify.rewrite < times_n_SO.apply lt_to_le.assumption + |apply not_le_to_lt. + apply leb_false_to_not_le. + apply (lt_max_to_false ? (S n1) (S (log p (S n1)))) + [apply le_S_S.apply le_n + |apply lt_log_n_n + [assumption|apply lt_O_S] + ] + ] +qed. + +theorem log_times1: \forall p,n,m. S O < p \to O < n \to O < m \to +log p (n*m) \le S(log p n+log p m). +intros. +unfold in ⊢ (? (% ? ?) ?). +apply f_false_to_le_max + [apply (ex_intro ? ? O). + split + [apply le_O_n + |apply le_to_leb_true. + simplify. + rewrite > times_n_SO. + apply le_times;assumption + ] + |intros. + apply lt_to_leb_false. + apply (lt_to_le_to_lt ? ((exp p (S(log p n)))*(exp p (S(log p m))))) + [apply lt_times;apply lt_exp_log;assumption + |rewrite < exp_plus_times. + apply le_exp + [apply lt_to_le.assumption + |simplify. + rewrite < plus_n_Sm. + assumption + ] + ] + ] +qed. + +theorem log_times: \forall p,n,m.S O < p \to log p (n*m) \le S(log p n+log p m). +intros. +cases n + [apply le_O_n + |cases m + [rewrite < times_n_O. + apply le_O_n + |apply log_times1 + [assumption + |apply lt_O_S + |apply lt_O_S + ] + ] + ] +qed. + +theorem log_times_l: \forall p,n,m.O < n \to O < m \to S O < p \to +log p n+log p m \le log p (n*m) . +intros. +unfold log in ⊢ (? ? (% ? ?)). +apply f_m_to_le_max + [elim H + [rewrite > log_SO + [simplify. + rewrite < plus_n_O. + apply le_log_n_n. + assumption + |assumption + ] + |elim H1 + [rewrite > log_SO + [rewrite < plus_n_O. + rewrite < times_n_SO. + apply le_log_n_n. + assumption + |assumption + ] + |apply (trans_le ? (S n1 + S n2)) + [apply le_plus;apply le_log_n_n;assumption + |simplify. + apply le_S_S. + rewrite < plus_n_Sm. + change in ⊢ (? % ?) with ((S n1)+n2). + rewrite > sym_plus. + apply le_plus_r. + change with (n1 < n1*S n2). + rewrite > times_n_SO in ⊢ (? % ?). + apply lt_times_r1 + [assumption + |apply le_S_S.assumption + ] + ] + ] + ] + |apply le_to_leb_true. + rewrite > exp_plus_times. + apply le_times;apply le_exp_log;assumption + ] +qed. + +theorem log_exp: \forall p,n,m.S O < p \to O < m \to +log p ((exp p n)*m)=n+log p m. +intros. +unfold log in ⊢ (? ? (% ? ?) ?). +apply max_spec_to_max. +unfold max_spec. +split + [split + [elim n + [simplify. + rewrite < plus_n_O. + apply le_log_n_n. + assumption + |simplify. + rewrite > assoc_times. + apply (trans_le ? ((S(S O))*(p\sup n1*m))) + [apply le_S_times_SSO + [rewrite > (times_n_O O) in ⊢ (? % ?). + apply lt_times + [apply lt_O_exp. + apply lt_to_le. + assumption + |assumption + ] + |assumption + ] + |apply le_times + [assumption + |apply le_n + ] + ] + ] + |simplify. + apply le_to_leb_true. + rewrite > exp_plus_times. + apply le_times_r. + apply le_exp_log. + assumption + ] + |intros. + simplify. + apply lt_to_leb_false. + apply (lt_to_le_to_lt ? ((exp p n)*(exp p (S(log p m))))) + [apply lt_times_r1 + [apply lt_O_exp.apply lt_to_le.assumption + |apply lt_exp_log.assumption + ] + |rewrite < exp_plus_times. + apply le_exp + [apply lt_to_le.assumption + |rewrite < plus_n_Sm. + assumption + ] + ] + ] +qed. + +theorem eq_log_exp: \forall p,n.S O < p \to +log p (exp p n)=n. +intros. +rewrite > times_n_SO in ⊢ (? ? (? ? %) ?). +rewrite > log_exp + [rewrite > log_SO + [rewrite < plus_n_O.reflexivity + |assumption + ] + |assumption + |apply le_n + ] +qed. + +theorem log_exp1: \forall p,n,m.S O < p \to +log p (exp n m) \le m*S(log p n). +intros.elim m + [simplify in ⊢ (? (? ? %) ?). + rewrite > log_SO + [apply le_O_n + |assumption + ] + |simplify. + apply (trans_le ? (S (log p n+log p (n\sup n1)))) + [apply log_times.assumption + |apply le_S_S. + apply le_plus_r. + assumption + ] + ] +qed. + +theorem log_exp2: \forall p,n,m.S O < p \to O < n \to +m*(log p n) \le log p (exp n m). +intros. +apply le_S_S_to_le. +apply (lt_exp_to_lt p) + [assumption + |rewrite > sym_times. + rewrite < exp_exp_times. + apply (le_to_lt_to_lt ? (exp n m)) + [elim m + [simplify.apply le_n + |simplify.apply le_times + [apply le_exp_log. + assumption + |assumption + ] + ] + |apply lt_exp_log. + assumption + ] + ] +qed. + +lemma le_log_plus: \forall p,n.S O < p \to log p n \leq log p (S n). +intros;apply (bool_elim ? (leb (p*(exp p n)) (S n))) + [simplify;intro;rewrite > H1;simplify;apply (trans_le ? n) + [apply le_log_n_n;assumption + |apply le_n_Sn] + |intro;unfold log;simplify;rewrite > H1;simplify;apply le_max_f_max_g; + intros;apply le_to_leb_true;constructor 2;apply leb_true_to_le;assumption] +qed. + +theorem le_log: \forall p,n,m. S O < p \to n \le m \to +log p n \le log p m. +intros.elim H1 + [constructor 1 + |apply (trans_le ? ? ? H3);apply le_log_plus;assumption] +qed. + +theorem log_div: \forall p,n,m. S O < p \to O < m \to m \le n \to +log p (n/m) \le log p n -log p m. +intros. +apply le_plus_to_minus_r. +apply (trans_le ? (log p ((n/m)*m))) + [apply log_times_l + [apply le_times_to_le_div + [assumption + |rewrite < times_n_SO. + assumption + ] + |assumption + |assumption + ] + |apply le_log + [assumption + |rewrite > (div_mod n m) in ⊢ (? ? %) + [apply le_plus_n_r + |assumption + ] + ] + ] +qed. + +theorem log_n_n: \forall n. S O < n \to log n n = S O. +intros. +rewrite > exp_n_SO in ⊢ (? ? (? ? %) ?). +rewrite > times_n_SO in ⊢ (? ? (? ? %) ?). +rewrite > log_exp + [rewrite > log_SO + [reflexivity + |assumption + ] + |assumption + |apply le_n + ] +qed. + +theorem log_i_SSOn: \forall n,i. S O < n \to n < i \to i \le ((S(S O))*n) \to +log i ((S(S O))*n) = S O. +intros. +apply antisymmetric_le + [apply not_lt_to_le.intro. + apply (lt_to_not_le ((S(S O)) * n) (exp i (S(S O)))) + [rewrite > exp_SSO. + apply lt_times + [apply (le_to_lt_to_lt ? n);assumption + |assumption + ] + |apply (trans_le ? (exp i (log i ((S(S O))*n)))) + [apply le_exp + [apply (ltn_to_ltO ? ? H1) + |assumption + ] + |apply le_exp_log. + rewrite > (times_n_O O) in ⊢ (? % ?). + apply lt_times + [apply lt_O_S + |apply lt_to_le.assumption + ] + ] + ] + |apply (trans_le ? (log i i)) + [rewrite < (log_n_n i) in ⊢ (? % ?) + [apply le_log + [apply (trans_lt ? n);assumption + |apply le_n + ] + |apply (trans_lt ? n);assumption + ] + |apply le_log + [apply (trans_lt ? n);assumption + |assumption + ] + ] + ] +qed. + +theorem exp_n_O: \forall n. O < n \to exp O n = O. +intros.apply (lt_O_n_elim ? H).intros. +simplify.reflexivity. +qed. + +(* +theorem tech1: \forall n,i.O < n \to +(exp (S n) (S(S i)))/(exp n (S i)) \le ((exp n i) + (exp (S n) (S i)))/(exp n i). +intros. +simplify in ⊢ (? (? ? %) ?). +rewrite < eq_div_div_div_times + [apply monotonic_div + [apply lt_O_exp.assumption + |apply le_S_S_to_le. + apply lt_times_to_lt_div. + change in ⊢ (? % ?) with ((exp (S n) (S i)) + n*(exp (S n) (S i))). + + + |apply (trans_le ? ((n)\sup(i)*(S n)\sup(S i)/(n)\sup(S i))) + [apply le_times_div_div_times. + apply lt_O_exp.assumption + |apply le_times_to_le_div2 + [apply lt_O_exp.assumption + |simplify. + +theorem tech1: \forall a,b,n,m.O < m \to +n/m \le b \to (a*n)/m \le a*b. +intros. +apply le_times_to_le_div2 + [assumption + | + +theorem tech2: \forall n,m. O < n \to +(exp (S n) m) / (exp n m) \le (n + m)/n. +intros. +elim m + [rewrite < plus_n_O.simplify. + rewrite > div_n_n.apply le_n + |apply le_times_to_le_div + [assumption + |apply (trans_le ? (n*(S n)\sup(S n1)/(n)\sup(S n1))) + [apply le_times_div_div_times. + apply lt_O_exp + |simplify in ⊢ (? (? ? %) ?). + rewrite > sym_times in ⊢ (? (? ? %) ?). + rewrite < eq_div_div_div_times + [apply le_times_to_le_div2 + [assumption + | + + +theorem le_log_sigma_p:\forall n,m,p. O < m \to S O < p \to +log p (exp n m) \le sigma_p n (\lambda i.true) (\lambda i. (m / i)). +intros. +elim n + [rewrite > exp_n_O + [simplify.apply le_n + |assumption + ] + |rewrite > true_to_sigma_p_Sn + [apply (trans_le ? (m/n1+(log p (exp n1 m)))) + [ +*) \ No newline at end of file diff --git a/matita/library/nat/lt_arith.ma b/matita/library/nat/lt_arith.ma new file mode 100644 index 000000000..514163b37 --- /dev/null +++ b/matita/library/nat/lt_arith.ma @@ -0,0 +1,588 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/div_and_mod.ma". + +(* plus *) +theorem monotonic_lt_plus_r: +\forall n:nat.monotonic nat lt (\lambda m.n+m). +simplify.intros. +elim n.simplify.assumption. +simplify.unfold lt. +apply le_S_S.assumption. +qed. + +variant lt_plus_r: \forall n,p,q:nat. p < q \to n + p < n + q \def +monotonic_lt_plus_r. + +theorem monotonic_lt_plus_l: +\forall n:nat.monotonic nat lt (\lambda m.m+n). +simplify. +intros. +rewrite < sym_plus. rewrite < (sym_plus n). +apply lt_plus_r.assumption. +qed. + +variant lt_plus_l: \forall n,p,q:nat. p < q \to p + n < q + n \def +monotonic_lt_plus_l. + +theorem lt_plus: \forall n,m,p,q:nat. n < m \to p < q \to n + p < m + q. +intros. +apply (trans_lt ? (n + q)). +apply lt_plus_r.assumption. +apply lt_plus_l.assumption. +qed. + +theorem lt_plus_to_lt_l :\forall n,p,q:nat. p+n < q+n \to p plus_n_O. +rewrite > (plus_n_O q).assumption. +apply H. +unfold lt.apply le_S_S_to_le. +rewrite > plus_n_Sm. +rewrite > (plus_n_Sm q). +exact H1. +qed. + +theorem lt_plus_to_lt_r :\forall n,p,q:nat. n+p < n+q \to p sym_plus. +rewrite > (sym_plus q).assumption. +qed. + +theorem le_to_lt_to_plus_lt: \forall a,b,c,d:nat. +a \le c \to b \lt d \to (a + b) \lt (c+d). +intros. +cut (a \lt c \lor a = c) +[ elim Hcut + [ apply (lt_plus ); + assumption + | rewrite > H2. + apply (lt_plus_r c b d). + assumption + ] +| apply le_to_or_lt_eq. + assumption +] +qed. + + +(* times and zero *) +theorem lt_O_times_S_S: \forall n,m:nat.O < (S n)*(S m). +intros.simplify.unfold lt.apply le_S_S.apply le_O_n. +qed. + +theorem lt_times_eq_O: \forall a,b:nat. +O \lt a \to (a * b) = O \to b = O. +intros. +apply (nat_case1 b) +[ intros. + reflexivity +| intros. + rewrite > H2 in H1. + rewrite > (S_pred a) in H1 + [ apply False_ind. + apply (eq_to_not_lt O ((S (pred a))*(S m))) + [ apply sym_eq. + assumption + | apply lt_O_times_S_S + ] + | assumption + ] +] +qed. + +theorem O_lt_times_to_O_lt: \forall a,c:nat. +O \lt (a * c) \to O \lt a. +intros. +apply (nat_case1 a) +[ intros. + rewrite > H1 in H. + simplify in H. + assumption +| intros. + apply lt_O_S +] +qed. + +lemma lt_times_to_lt_O: \forall i,n,m:nat. i < n*m \to O < m. +intros. +elim (le_to_or_lt_eq O ? (le_O_n m)) + [assumption + |apply False_ind. + rewrite < H1 in H. + rewrite < times_n_O in H. + apply (not_le_Sn_O ? H) + ] +qed. + +(* times *) +theorem monotonic_lt_times_r: +\forall n:nat.monotonic nat lt (\lambda m.(S n)*m). +simplify. +intros.elim n. +simplify.rewrite < plus_n_O.rewrite < plus_n_O.assumption. +apply lt_plus.assumption.assumption. +qed. + +(* a simple variant of the previus monotionic_lt_times *) +theorem monotonic_lt_times_variant: \forall c:nat. +O \lt c \to monotonic nat lt (\lambda t.(t*c)). +intros. +apply (increasing_to_monotonic). +unfold increasing. +intros. +simplify. +rewrite > sym_plus. +rewrite > plus_n_O in \vdash (? % ?). +apply lt_plus_r. +assumption. +qed. + +theorem lt_times_r: \forall n,p,q:nat. p < q \to (S n) * p < (S n) * q +\def monotonic_lt_times_r. + +theorem monotonic_lt_times_l: +\forall m:nat.monotonic nat lt (\lambda n.n * (S m)). +simplify. +intros. +rewrite < sym_times.rewrite < (sym_times (S m)). +apply lt_times_r.assumption. +qed. + +variant lt_times_l: \forall n,p,q:nat. p nat_compare_n_n.reflexivity. +intro.apply nat_compare_elim.intro. +absurd (p (plus_n_O ((S m1)*(n / (S m1)))). +rewrite < H2. +rewrite < sym_times. +rewrite < div_mod. +rewrite > H2. +assumption. +unfold lt.apply le_S_S.apply le_O_n. +qed. + +theorem lt_div_n_m_n: \forall n,m:nat. (S O) < m \to O < n \to n / m \lt n. +intros. +apply (nat_case1 (n / m)).intro. +assumption.intros.rewrite < H2. +rewrite > (div_mod n m) in \vdash (? ? %). +apply (lt_to_le_to_lt ? ((n / m)*m)). +apply (lt_to_le_to_lt ? ((n / m)*(S (S O)))). +rewrite < sym_times. +rewrite > H2. +simplify.unfold lt. +rewrite < plus_n_O. +rewrite < plus_n_Sm. +apply le_S_S. +apply le_S_S. +apply le_plus_n. +apply le_times_r. +assumption. +rewrite < sym_plus. +apply le_plus_n. +apply (trans_lt ? (S O)). +unfold lt. apply le_n.assumption. +qed. + +theorem eq_div_div_div_times: \forall n,m,q. O < n \to O < m \to +q/n/m = q/(n*m). +intros. +apply (div_mod_spec_to_eq q (n*m) ? (q\mod n+n*(q/n\mod m)) ? (mod q (n*m))) + [apply div_mod_spec_intro + [apply (lt_to_le_to_lt ? (n*(S (q/n\mod m)))) + [rewrite < times_n_Sm. + apply lt_plus_l. + apply lt_mod_m_m. + assumption + |apply le_times_r. + apply lt_mod_m_m. + assumption + ] + |rewrite > sym_times in ⊢ (? ? ? (? (? ? %) ?)). + rewrite < assoc_times. + rewrite > (eq_times_div_minus_mod ? ? H1). + rewrite > sym_times. + rewrite > distributive_times_minus. + rewrite > sym_times. + rewrite > (eq_times_div_minus_mod ? ? H). + rewrite < sym_plus in ⊢ (? ? ? (? ? %)). + rewrite < assoc_plus. + rewrite < plus_minus_m_m + [rewrite < plus_minus_m_m + [reflexivity + |apply (eq_plus_to_le ? ? ((q/n)*n)). + rewrite < sym_plus. + apply div_mod. + assumption + ] + |apply (trans_le ? (n*(q/n))) + [apply le_times_r. + apply (eq_plus_to_le ? ? ((q/n)/m*m)). + rewrite < sym_plus. + apply div_mod. + assumption + |rewrite > sym_times. + rewrite > eq_times_div_minus_mod + [apply le_n + |assumption + ] + ] + ] + ] + |apply div_mod_spec_div_mod. + rewrite > (times_n_O O). + apply lt_times;assumption + ] +qed. + +theorem eq_div_div_div_div: \forall n,m,q. O < n \to O < m \to +q/n/m = q/m/n. +intros. +apply (trans_eq ? ? (q/(n*m))) + [apply eq_div_div_div_times;assumption + |rewrite > sym_times. + apply sym_eq. + apply eq_div_div_div_times;assumption + ] +qed. + +theorem SSO_mod: \forall n,m. O < m \to (S(S O))*n/m = (n/m)*(S(S O)) + mod ((S(S O))*n/m) (S(S O)). +intros. +rewrite < (lt_O_to_div_times n (S(S O))) in ⊢ (? ? ? (? (? (? % ?) ?) ?)) + [rewrite > eq_div_div_div_div + [rewrite > sym_times in ⊢ (? ? ? (? (? (? (? % ?) ?) ?) ?)). + apply div_mod. + apply lt_O_S + |apply lt_O_S + |assumption + ] + |apply lt_O_S + ] +qed. +(* Forall a,b : N. 0 < b \to b * (a/b) <= a < b * (a/b +1) *) +(* The theorem is shown in two different parts: *) + +theorem lt_to_div_to_and_le_times_lt_S: \forall a,b,c:nat. +O \lt b \to a/b = c \to (b*c \le a \land a \lt b*(S c)). +intros. +split +[ rewrite < H1. + rewrite > sym_times. + rewrite > eq_times_div_minus_mod + [ apply (le_minus_m a (a \mod b)) + | assumption + ] +| rewrite < (times_n_Sm b c). + rewrite < H1. + rewrite > sym_times. + rewrite > (div_mod a b) in \vdash (? % ?) + [ rewrite > (sym_plus b ((a/b)*b)). + apply lt_plus_r. + apply lt_mod_m_m. + assumption + | assumption + ] +] +qed. + +theorem lt_to_le_times_to_lt_S_to_div: \forall a,c,b:nat. +O \lt b \to (b*c) \le a \to a \lt (b*(S c)) \to a/b = c. +intros. +apply (le_to_le_to_eq) +[ apply (leb_elim (a/b) c);intros + [ assumption + | cut (c \lt (a/b)) + [ apply False_ind. + apply (lt_to_not_le (a \mod b) O) + [ apply (lt_plus_to_lt_l ((a/b)*b)). + simplify. + rewrite < sym_plus. + rewrite < div_mod + [ apply (lt_to_le_to_lt ? (b*(S c)) ?) + [ assumption + | rewrite > (sym_times (a/b) b). + apply le_times_r. + assumption + ] + | assumption + ] + | apply le_O_n + ] + | apply not_le_to_lt. + assumption + ] + ] +| apply (leb_elim c (a/b));intros + [ assumption + | cut((a/b) \lt c) + [ apply False_ind. + apply (lt_to_not_le (a \mod b) b) + [ apply (lt_mod_m_m). + assumption + | apply (le_plus_to_le ((a/b)*b)). + rewrite < (div_mod a b) + [ apply (trans_le ? (b*c) ?) + [ rewrite > (sym_times (a/b) b). + rewrite > (times_n_SO b) in \vdash (? (? ? %) ?). + rewrite < distr_times_plus. + rewrite > sym_plus. + simplify in \vdash (? (? ? %) ?). + apply le_times_r. + assumption + | assumption + ] + | assumption + ] + ] + | apply not_le_to_lt. + assumption + ] + ] +] +qed. + + +theorem lt_to_lt_to_eq_div_div_times_times: \forall a,b,c:nat. +O \lt c \to O \lt b \to (a/b) = (a*c)/(b*c). +intros. +apply sym_eq. +cut (b*(a/b) \le a \land a \lt b*(S (a/b))) +[ elim Hcut. + apply lt_to_le_times_to_lt_S_to_div + [ rewrite > (S_pred b) + [ rewrite > (S_pred c) + [ apply (lt_O_times_S_S) + | assumption + ] + | assumption + ] + | rewrite > assoc_times. + rewrite > (sym_times c (a/b)). + rewrite < assoc_times. + rewrite > (sym_times (b*(a/b)) c). + rewrite > (sym_times a c). + apply (le_times_r c (b*(a/b)) a). + assumption + | rewrite > (sym_times a c). + rewrite > (assoc_times ). + rewrite > (sym_times c (S (a/b))). + rewrite < (assoc_times). + rewrite > (sym_times (b*(S (a/b))) c). + apply (lt_times_r1 c a (b*(S (a/b)))); + assumption + ] +| apply (lt_to_div_to_and_le_times_lt_S) + [ assumption + | reflexivity + ] +] +qed. + +theorem times_mod: \forall a,b,c:nat. +O \lt c \to O \lt b \to ((a*c) \mod (b*c)) = c*(a\mod b). +intros. +apply (div_mod_spec_to_eq2 (a*c) (b*c) (a/b) ((a*c) \mod (b*c)) (a/b) (c*(a \mod b))) +[ rewrite > (lt_to_lt_to_eq_div_div_times_times a b c) + [ apply div_mod_spec_div_mod. + rewrite > (S_pred b) + [ rewrite > (S_pred c) + [ apply lt_O_times_S_S + | assumption + ] + | assumption + ] + | assumption + | assumption + ] +| apply div_mod_spec_intro + [ rewrite > (sym_times b c). + apply (lt_times_r1 c) + [ assumption + | apply (lt_mod_m_m). + assumption + ] + | rewrite < (assoc_times (a/b) b c). + rewrite > (sym_times a c). + rewrite > (sym_times ((a/b)*b) c). + rewrite < (distr_times_plus c ? ?). + apply eq_f. + apply (div_mod a b). + assumption + ] +] +qed. + + + + +(* general properties of functions *) +theorem monotonic_to_injective: \forall f:nat\to nat. +monotonic nat lt f \to injective nat nat f. +unfold injective.intros. +apply (nat_compare_elim x y). +intro.apply False_ind.apply (not_le_Sn_n (f x)). +rewrite > H1 in \vdash (? ? %). +change with (f x < f y). +apply H.apply H2. +intros.assumption. +intro.apply False_ind.apply (not_le_Sn_n (f y)). +rewrite < H1 in \vdash (? ? %). +change with (f y < f x). +apply H.apply H2. +qed. + +theorem increasing_to_injective: \forall f:nat\to nat. +increasing f \to injective nat nat f. +intros.apply monotonic_to_injective. +apply increasing_to_monotonic.assumption. +qed. + diff --git a/matita/library/nat/map_iter_p.ma b/matita/library/nat/map_iter_p.ma new file mode 100644 index 000000000..04eb5022c --- /dev/null +++ b/matita/library/nat/map_iter_p.ma @@ -0,0 +1,870 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/permutation.ma". +include "nat/count.ma". + +let rec map_iter_p n p (g:nat \to nat) (a:nat) f \def + match n with + [ O \Rightarrow a + | (S k) \Rightarrow + match p (S k) with + [true \Rightarrow f (g (S k)) (map_iter_p k p g a f) + |false \Rightarrow map_iter_p k p g a f] + ]. + +theorem eq_map_iter_p: \forall g1,g2:nat \to nat. +\forall p:nat \to bool. +\forall f:nat \to nat \to nat. \forall a,n:nat. +(\forall m:nat. m \le n \to g1 m = g2 m) \to +map_iter_p n p g1 a f = map_iter_p n p g2 a f. +intros 6.elim n + [simplify.reflexivity. + |simplify.elim (p (S n1)) + [simplify.apply eq_f2 + [apply H1.apply le_n + |simplify.apply H.intros.apply H1. + apply le_S.assumption + ] + |simplify.apply H.intros.apply H1. + apply le_S.assumption + ] + ] +qed. + +(* useful since simplify simpifies too much *) + +theorem map_iter_p_O: \forall p.\forall g.\forall f. \forall a:nat. +map_iter_p O p g a f = a. +intros.simplify.reflexivity. +qed. + +theorem map_iter_p_S_true: \forall p.\forall g.\forall f. \forall a,n:nat. +p (S n) = true \to +map_iter_p (S n) p g a f = f (g (S n)) (map_iter_p n p g a f). +intros.simplify.rewrite > H.reflexivity. +qed. + +theorem map_iter_p_S_false: \forall p.\forall g.\forall f. \forall a,n:nat. +p (S n) = false \to +map_iter_p (S n) p g a f = map_iter_p n p g a f. +intros.simplify.rewrite > H.reflexivity. +qed. + +(* map_iter examples *) +definition pi_p \def \lambda p. \lambda n. +map_iter_p n p (\lambda n.n) (S O) times. + +lemma pi_p_S: \forall n.\forall p. +pi_p p (S n) = + match p (S n) with + [true \Rightarrow (S n)*(pi_p p n) + |false \Rightarrow (pi_p p n) + ]. +intros.reflexivity. +qed. + +lemma lt_O_pi_p: \forall n.\forall p. +O < pi_p p n. +intros.elim n + [simplify.apply le_n + |rewrite > pi_p_S. + elim p (S n1) + [change with (O < (S n1)*(pi_p p n1)). + rewrite >(times_n_O n1). + apply lt_times[apply le_n|assumption] + | assumption + ] + ] +qed. + +let rec card n p \def + match n with + [O \Rightarrow O + |(S m) \Rightarrow + (bool_to_nat (p (S m))) + (card m p)]. + +lemma count_card: \forall p.\forall n. +p O = false \to count (S n) p = card n p. +intros.elim n + [simplify.rewrite > H. reflexivity + |simplify. + rewrite < plus_n_O. + apply eq_f.assumption + ] +qed. + +lemma count_card1: \forall p.\forall n. +p O = false \to p n = false \to count n p = card n p. +intros 3.apply (nat_case n) + [intro.simplify.rewrite > H. reflexivity + |intros.rewrite > (count_card ? ? H). + simplify.rewrite > H1.reflexivity + ] +qed. + +lemma a_times_pi_p: \forall p. \forall a,n. +exp a (card n p) * pi_p p n = map_iter_p n p (\lambda n.a*n) (S O) times. +intros.elim n + [simplify.reflexivity + |simplify.apply (bool_elim ? (p (S n1))) + [intro. + change with + (a*exp a (card n1 p) * ((S n1) * (pi_p p n1)) = + a*(S n1)*map_iter_p n1 p (\lambda n.a*n) (S O) times). + rewrite < H. + autobatch + |intro.assumption + ] + ] +qed. + +definition permut_p \def \lambda f. \lambda p:nat\to bool. \lambda n. +\forall i. i \le n \to p i = true \to ((f i \le n \land p (f i) = true) +\land (\forall j. p j = true \to j \le n \to i \neq j \to (f i \neq f j))). + +definition extentional_eq_n \def \lambda f,g:nat \to nat.\lambda n. +\forall x. x \le n \to f x = g x. + +lemma extentional_eq_n_to_permut_p: \forall f,g. \forall p. \forall n. +extentional_eq_n f g n\to permut_p f p n \to permut_p g p n. +intros.unfold permut_p. +intros. +elim (H1 i H2 H3). +split + [elim H4.split + [rewrite < (H i H2).assumption + |rewrite < (H i H2).assumption + ] + |intros. + unfold.intro.apply (H5 j H6 H7 H8). + rewrite > (H i H2). + rewrite > (H j H7).assumption + ] +qed. + +theorem permut_p_compose: \forall f,g.\forall p.\forall n. +permut_p f p n \to permut_p g p n \to permut_p (compose ? ? ? g f) p n. +intros.unfold permut_p.intros. +elim (H i H2 H3). +elim H4. +elim (H1 (f i) H6 H7). +elim H8. +split + [split + [unfold compose.assumption + |unfold compose.rewrite < H11.reflexivity + ] + |intros. + unfold compose. + apply (H9 (f j)) + [elim (H j H13 H12).elim H15.rewrite < H18.reflexivity + |elim (H j H13 H12).elim H15.assumption. + |apply (H5 j H12 H13 H14) + ] + ] +qed. + +theorem permut_p_S_to_permut_p: \forall f.\forall p.\forall n. +permut_p f p (S n) \to (f (S n)) = (S n) \to permut_p f p n. +intros. +unfold permut_p. +intros. +split + [elim (H i (le_S i n H2) H3).split + [elim H4. + elim (le_to_or_lt_eq (f i) (S n)) + [apply le_S_S_to_le.assumption + |absurd (f i = (S n)) + [assumption + |rewrite < H1. + apply H5 + [rewrite < H8.assumption + |apply le_n + |unfold.intro.rewrite > H8 in H2. + apply (not_le_Sn_n n).rewrite < H9.assumption + ] + ] + |assumption + ] + |elim H4.assumption + ] + |intros. + elim (H i (le_S i n H2) H3). + apply H8 + [assumption|apply le_S.assumption|assumption] + ] +qed. + +lemma permut_p_transpose: \forall p.\forall i,j,n. +i \le n \to j \le n \to p i = p j \to +permut_p (transpose i j) p n. +unfold permut_p.intros. +split + [split + [unfold transpose. + apply (eqb_elim i1 i) + [intro. + apply (eqb_elim i1 j) + [simplify.intro.assumption + |simplify.intro.assumption + ] + |intro. + apply (eqb_elim i1 j) + [simplify.intro.assumption + |simplify.intro.assumption + ] + ] + |unfold transpose. + apply (eqb_elim i1 i) + [intro. + apply (eqb_elim i1 j) + [simplify.intro.rewrite < H6.assumption + |simplify.intro.rewrite < H2.rewrite < H5.assumption + ] + |intro. + apply (eqb_elim i1 j) + [simplify.intro.rewrite > H2.rewrite < H6.assumption + |simplify.intro.assumption + ] + ] + ] + |intros.unfold Not. + intro.apply H7. + apply (injective_transpose ? ? ? ? H8). + ] +qed. + +theorem eq_map_iter_p_k: \forall f,g.\forall p.\forall a,k,n:nat. +p (S n-k) = true \to (\forall i. (S n)-k < i \to i \le (S n) \to (p i) = false) \to +map_iter_p (S n) p g a f = map_iter_p (S n-k) p g a f. +intros 5. +elim k 3 + [rewrite < minus_n_O.reflexivity + |apply (nat_case n1) + [intros. + rewrite > map_iter_p_S_false + [reflexivity + |apply H2[simplify.apply lt_O_S.|apply le_n] + ] + |intros. + rewrite > map_iter_p_S_false + [rewrite > (H m H1) + [reflexivity + |intros. + apply (H2 i H3). + apply le_S. + assumption + ] + |apply H2[autobatch|apply le_n] + ] + ] + ] +qed. + +theorem eq_map_iter_p_a: \forall p.\forall f.\forall g. \forall a,n:nat. +(\forall i.i \le n \to p i = false) \to map_iter_p n p g a f = a. +intros 5. +elim n + [simplify.reflexivity + |rewrite > map_iter_p_S_false + [apply H. + intros. + apply H1.apply le_S.assumption + |apply H1.apply le_n + ] + ] +qed. + +theorem eq_map_iter_p_transpose: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall g. \forall a,k,n:nat. k < n \to +(p (S n) = true) \to (p (n-k)) = true \to (\forall i. n-k < i \to i \le n \to (p i) = false) +\to map_iter_p (S n) p g a f = map_iter_p (S n) p (\lambda m. g (transpose (n-k) (S n) m)) a f. +intros 8. +apply (nat_case n) + [intro.absurd (k < O) + [assumption|apply le_to_not_lt.apply le_O_n] + |intros. + rewrite > (map_iter_p_S_true ? ? ? ? ? H3). + rewrite > (map_iter_p_S_true ? ? ? ? ? H3). + rewrite > (eq_map_iter_p_k ? ? ? ? ? ? H4 H5). + rewrite > (eq_map_iter_p_k ? ? ? ? ? ? H4 H5). + generalize in match H4. + rewrite > minus_Sn_m + [intro. + rewrite > (map_iter_p_S_true ? ? ? ? ? H6). + rewrite > (map_iter_p_S_true ? ? ? ? ? H6). + rewrite > transpose_i_j_j. + rewrite > transpose_i_j_i. + cut (map_iter_p (m-k) p g a f = + map_iter_p (m-k) p (\lambda x.g (transpose (S(m-k)) (S(S m)) x)) a f) + [rewrite < Hcut. + rewrite < H. + rewrite < H1 in \vdash (? ? (? % ?) ?). + rewrite > H. + reflexivity + |apply eq_map_iter_p. + intros.unfold transpose. + cut (eqb m1 (S (m-k)) =false) + [cut (eqb m1 (S (S m)) =false) + [rewrite > Hcut. + rewrite > Hcut1. + reflexivity + |apply not_eq_to_eqb_false. + apply lt_to_not_eq. + apply (le_to_lt_to_lt ? m) + [apply (trans_le ? (m-k)) + [assumption|autobatch] + |apply le_S.apply le_n + ] + ] + |apply not_eq_to_eqb_false. + apply lt_to_not_eq. + unfold.autobatch + ] + ] + |apply le_S_S_to_le.assumption + ] + ] +qed. + +theorem eq_map_iter_p_transpose1: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall g. \forall a,k1,k2,n:nat. O < k1 \to k1 < k2 \to k2 \le n \to +(p k1) = true \to (p k2) = true \to (\forall i. k1 < i \to i < k2 \to (p i) = false) +\to map_iter_p n p g a f = map_iter_p n p (\lambda m. g (transpose k1 k2 m)) a f. +intros 10. +elim n 2 + [absurd (k2 \le O) + [assumption|apply lt_to_not_le.apply (trans_lt ? k1 ? H2 H3)] + |apply (eqb_elim (S n1) k2) + [intro. + rewrite < H4. + intros. + cut (k1 = n1 - (n1 -k1)) + [rewrite > Hcut. + apply (eq_map_iter_p_transpose p f H H1 g a (n1-k1)) + [cut (k1 \le n1)[autobatch|autobatch] + |assumption + |rewrite < Hcut.assumption + |rewrite < Hcut.intros. + apply (H9 i H10).unfold.autobatch + ] + |apply sym_eq. + apply plus_to_minus. + autobatch. + ] + |intros. + cut ((S n1) \neq k1) + [apply (bool_elim ? (p (S n1))) + [intro. + rewrite > map_iter_p_S_true + [rewrite > map_iter_p_S_true + [cut ((transpose k1 k2 (S n1)) = (S n1)) + [rewrite > Hcut1. + apply eq_f. + apply (H3 H5) + [elim (le_to_or_lt_eq ? ? H6) + [autobatch + |absurd (S n1=k2)[apply sym_eq.assumption|assumption] + ] + |assumption + |assumption + |assumption + ] + |unfold transpose. + rewrite > (not_eq_to_eqb_false ? ? Hcut). + rewrite > (not_eq_to_eqb_false ? ? H4). + reflexivity + ] + |assumption + ] + |assumption + ] + |intro. + rewrite > map_iter_p_S_false + [rewrite > map_iter_p_S_false + [apply (H3 H5) + [elim (le_to_or_lt_eq ? ? H6) + [autobatch + |absurd (S n1=k2)[apply sym_eq.assumption|assumption] + ] + |assumption + |assumption + |assumption + ] + |assumption + ] + |assumption + ] + ] + |unfold.intro. + absurd (k1 < k2) + [assumption + |apply le_to_not_lt. + rewrite < H10. + assumption + ] + ] + ] + ] +qed. + +lemma decidable_n:\forall p.\forall n. +(\forall m. m \le n \to (p m) = false) \lor +(\exists m. m \le n \land (p m) = true \land +\forall i. m < i \to i \le n \to (p i) = false). +intros. +elim n + [apply (bool_elim ? (p O)) + [intro.right. + apply (ex_intro ? ? O). + split + [split[apply le_n|assumption] + |intros.absurd (O H4.assumption + ] + |right. + elim H1.elim H3.elim H4. + apply (ex_intro ? ? a). + split + [split[apply le_S.assumption|assumption] + |intros.elim (le_to_or_lt_eq i (S n1) H9) + [apply H5[assumption|apply le_S_S_to_le.assumption] + |rewrite > H10.assumption + ] + ] + ] + ] + ] +qed. + +lemma decidable_n1:\forall p.\forall n,j. j \le n \to (p j)=true \to +(\forall m. j < m \to m \le n \to (p m) = false) \lor +(\exists m. j < m \land m \le n \land (p m) = true \land +\forall i. m < i \to i \le n \to (p i) = false). +intros. +elim (decidable_n p n) + [absurd ((p j)=true) + [assumption + |unfold.intro. + apply not_eq_true_false. + rewrite < H3. + apply H2.assumption + ] + |elim H2.clear H2. + apply (nat_compare_elim j a) + [intro. + right. + apply (ex_intro ? ? a). + elim H3.clear H3. + elim H4.clear H4. + split + [split + [split + [assumption|assumption] + |assumption + ] + |assumption + ] + |intro. + rewrite > H2. + left. + elim H3 2.assumption + |intro. + absurd (p j = true) + [assumption + |unfold.intro. + apply not_eq_true_false. + rewrite < H4. + elim H3.clear H3. + apply (H6 j H2).assumption + ] + ] + ] +qed. + +lemma decidable_n2:\forall p.\forall n,j. j \le n \to (p j)=true \to +(\forall m. j < m \to m \le n \to (p m) = false) \lor +(\exists m. j < m \land m \le n \land (p m) = true \land +\forall i. j < i \to i < m \to (p i) = false). +intros 3. +elim n + [left. + apply (le_n_O_elim j H).intros. + absurd (m \le O) + [assumption|apply lt_to_not_le.assumption] + |elim (le_to_or_lt_eq ? ? H1) + [cut (j \le n1) + [elim (H Hcut H2) + [apply (bool_elim ? (p (S n1))) + [intro. + right. + apply (ex_intro ? ? (S n1)). + split + [split + [split + [assumption|apply le_n] + |assumption + ] + |intros. + apply (H4 i H6). + apply le_S_S_to_le. + assumption + ] + |intro. + left. + intros. + elim (le_to_or_lt_eq ? ? H7) + [apply H4 + [assumption|apply le_S_S_to_le.assumption] + |rewrite > H8.assumption + ] + ] + |right. + elim H4.clear H4. + elim H5.clear H5. + elim H4.clear H4. + elim H5.clear H5. + apply (ex_intro ? ? a). + split + [split + [split[assumption|apply le_S.assumption] + |assumption + ] + |assumption + ] + ] + |apply le_S_S_to_le. + assumption + ] + |left. + intros. + absurd (j < m) + [assumption + |apply le_to_not_lt. + rewrite > H3. + assumption + ] + ] + ] +qed. + +theorem eq_map_iter_p_transpose2: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall g. \forall a,k,n:nat. O < k \to k \le n \to +(p (S n) = true) \to (p k) = true +\to map_iter_p (S n) p g a f = map_iter_p (S n) p (\lambda m. g (transpose k (S n) m)) a f. +intros 10. +cut (k = (S n)-(S n -k)) + [generalize in match H3.clear H3. + generalize in match g. + generalize in match H2.clear H2. + rewrite > Hcut. + (*generalize in match Hcut.clear Hcut.*) + (* generalize in match H3.clear H3.*) + (* something wrong here + rewrite > Hcut in \vdash (?\rarr ?\rarr %). *) + apply (nat_elim1 (S n - k)). + intros. + elim (decidable_n2 p n (S n -m) H4 H6) + [apply (eq_map_iter_p_transpose1 p f H H1 f1 a) + [assumption. + |unfold.autobatch. + |apply le_n + |assumption + |assumption + |intros.apply H7 + [assumption|apply le_S_S_to_le.assumption] + ] + |elim H7.clear H7. + elim H8.clear H8. + elim H7.clear H7. + elim H8.clear H8. + apply (trans_eq ? ? + (map_iter_p (S n) p (\lambda i.f1 (transpose a1 (S n) (transpose (S n -m) a1 i))) a f)) + [apply (trans_eq ? ? + (map_iter_p (S n) p (\lambda i.f1 (transpose a1 (S n) i)) a f)) + [cut (a1 = (S n -(S n -a1))) + [rewrite > Hcut1. + apply H2 + [apply lt_plus_to_lt_minus + [apply le_S.assumption + |rewrite < sym_plus. + apply lt_minus_to_lt_plus. + assumption + ] + |rewrite < Hcut1. + apply (trans_lt ? (S n -m))[assumption|assumption] + |rewrite < Hcut1.assumption + |assumption + |rewrite < Hcut1.assumption + ] + |apply minus_m_minus_mn. + apply le_S.assumption + ] + |apply (eq_map_iter_p_transpose1 p f H H1) + [assumption + |assumption + |apply le_S.assumption + |assumption + |assumption + |assumption + ] + ] + |apply (trans_eq ? ? + (map_iter_p (S n) p (\lambda i.f1 (transpose a1 (S n) (transpose (S n -m) a1 (transpose (S n -(S n -a1)) (S n) i)))) a f)) + [cut (a1 = (S n) -(S n -a1)) + [apply H2 + [apply lt_plus_to_lt_minus + [apply le_S.assumption + |rewrite < sym_plus. + apply lt_minus_to_lt_plus. + assumption + ] + |rewrite < Hcut1. + apply (trans_lt ? (S n -m))[assumption|assumption] + |rewrite < Hcut1.assumption + |assumption + |rewrite < Hcut1.assumption + ] + |apply minus_m_minus_mn. + apply le_S.assumption + ] + |apply eq_map_iter_p. + cut (a1 = (S n) -(S n -a1)) + [intros. + apply eq_f. + rewrite < Hcut1. + rewrite < transpose_i_j_j_i. + rewrite > (transpose_i_j_j_i (S n -m)). + rewrite > (transpose_i_j_j_i a1 (S n)). + rewrite > (transpose_i_j_j_i (S n -m)). + apply sym_eq. + apply eq_transpose + [unfold.intro. + apply (not_le_Sn_n n). + rewrite < H12.assumption + |unfold.intro. + apply (not_le_Sn_n n). + rewrite > H12.assumption + |unfold.intro. + apply (not_le_Sn_n a1). + rewrite < H12 in \vdash (? (? %) ?).assumption + ] + |apply minus_m_minus_mn. + apply le_S.assumption + ] + ] + ] + ] + |apply minus_m_minus_mn. + apply le_S.assumption + ] +qed. + +theorem eq_map_iter_p_transpose3: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall g. \forall a,k,n:nat. O < k \to k \le (S n) \to +(p (S n) = true) \to (p k) = true +\to map_iter_p (S n) p g a f = map_iter_p (S n) p (\lambda m. g (transpose k (S n) m)) a f. +intros. +elim (le_to_or_lt_eq ? ? H3) + [apply (eq_map_iter_p_transpose2 p f H H1 g a k n H2) + [apply le_S_S_to_le.assumption|assumption|assumption] + |rewrite > H6. + apply eq_map_iter_p. + intros. + apply eq_f.apply sym_eq. apply transpose_i_i. + ] +qed. + +lemma permut_p_O: \forall p.\forall h.\forall n. +permut_p h p n \to p O = false \to \forall m. (S m) \le n \to p (S m) = true \to O < h(S m). +intros.unfold permut_p in H. +apply not_le_to_lt.unfold.intro. +elim (H (S m) H2 H3). +elim H5. +absurd (p (h (S m)) = true) + [assumption + |apply (le_n_O_elim ? H4). + unfold.intro. + apply not_eq_true_false. + rewrite < H9.rewrite < H1.reflexivity + ] +qed. + +theorem eq_map_iter_p_permut: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall n.\forall g. \forall h.\forall a:nat. +permut_p h p n \to p O = false \to +map_iter_p n p g a f = map_iter_p n p (compose ? ? ? g h) a f . +intros 5. +elim n + [simplify.reflexivity + |apply (bool_elim ? (p (S n1))) + [intro. + apply (trans_eq ? ? (map_iter_p (S n1) p (\lambda m.g ((transpose (h (S n1)) (S n1)) m)) a f)) + [unfold permut_p in H3. + elim (H3 (S n1) (le_n ?) H5). + elim H6. clear H6. + apply (eq_map_iter_p_transpose3 p f H H1 g a (h(S n1)) n1) + [apply (permut_p_O ? ? ? H3 H4) + [apply le_n|assumption] + |assumption + |assumption + |assumption + ] + |apply (trans_eq ? ? (map_iter_p (S n1) p (\lambda m. + (g(transpose (h (S n1)) (S n1) + (transpose (h (S n1)) (S n1) (h m)))) ) a f)) + [rewrite > (map_iter_p_S_true ? ? ? ? ? H5). + rewrite > (map_iter_p_S_true ? ? ? ? ? H5). + apply eq_f2 + [rewrite > transpose_i_j_j. + rewrite > transpose_i_j_i. + rewrite > transpose_i_j_j. + reflexivity + |apply (H2 (\lambda m.(g(transpose (h (S n1)) (S n1) m))) ?) + [unfold.intros. + split + [split + [simplify. + unfold permut_p in H3. + elim (H3 i (le_S ? ? H6) H7). + elim H8. clear H8. + elim (le_to_or_lt_eq ? ? H10) + [unfold transpose. + rewrite > (not_eq_to_eqb_false ? ? (lt_to_not_eq ? ? H8)). + cut (h i \neq h (S n1)) + [rewrite > (not_eq_to_eqb_false ? ? Hcut). + simplify. + apply le_S_S_to_le. + assumption + |apply H9 + [apply H5 + |apply le_n + |apply lt_to_not_eq. + unfold.apply le_S_S.assumption + ] + ] + |rewrite > H8. + apply (eqb_elim (S n1) (h (S n1))) + [intro. + absurd (h i = h (S n1)) + [rewrite > H8. + assumption + |apply H9 + [assumption + |apply le_n + |apply lt_to_not_eq. + unfold.apply le_S_S.assumption + ] + ] + |intro. + unfold transpose. + rewrite > (not_eq_to_eqb_false ? ? H12). + rewrite > (eq_to_eqb_true ? ? (refl_eq ? (S n1))). + simplify. + elim (H3 (S n1) (le_n ? ) H5). + elim H13.clear H13. + elim (le_to_or_lt_eq ? ? H15) + [apply le_S_S_to_le.assumption + |apply False_ind. + apply H12. + apply sym_eq.assumption + ] + ] + ] + |simplify. + unfold permut_p in H3. + unfold transpose. + apply (eqb_elim (h i) (S n1)) + [intro. + apply (eqb_elim (h i) (h (S n1))) + [intro.simplify.assumption + |intro.simplify. + elim (H3 (S n1) (le_n ? ) H5). + elim H10. assumption + ] + |intro. + apply (eqb_elim (h i) (h (S n1))) + [intro.simplify.assumption + |intro.simplify. + elim (H3 i (le_S ? ? H6) H7). + elim H10. assumption + ] + ] + ] + |simplify.intros.unfold Not.intro. + unfold permut_p in H3. + elim (H3 i (le_S i ? H6) H7). + apply (H13 j H8 (le_S j ? H9) H10). + apply (injective_transpose ? ? ? ? H11) + ] + |assumption + ] + ] + |apply eq_map_iter_p. + intros. + rewrite > transpose_transpose.reflexivity + ] + ] + |intro. + rewrite > (map_iter_p_S_false ? ? ? ? ? H5). + rewrite > (map_iter_p_S_false ? ? ? ? ? H5). + apply H2 + [unfold permut_p. + unfold permut_p in H3. + intros. + elim (H3 i (le_S i ? H6) H7). + elim H8. + split + [split + [elim (le_to_or_lt_eq ? ? H10) + [apply le_S_S_to_le.assumption + |absurd (p (h i) = true) + [assumption + |rewrite > H12. + rewrite > H5. + unfold.intro.apply not_eq_true_false. + apply sym_eq.assumption + ] + ] + |assumption + ] + |intros. + apply H9 + [assumption|apply (le_S ? ? H13)|assumption] + ] + |assumption + ] + ] + ] +qed. + diff --git a/matita/library/nat/minimization.ma b/matita/library/nat/minimization.ma new file mode 100644 index 000000000..3e60d466e --- /dev/null +++ b/matita/library/nat/minimization.ma @@ -0,0 +1,435 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/minus.ma". + +let rec max i f \def + match (f i) with + [ true \Rightarrow i + | false \Rightarrow + match i with + [ O \Rightarrow O + | (S j) \Rightarrow max j f ]]. + +theorem max_O_f : \forall f: nat \to bool. max O f = O. +intro. simplify. +elim (f O). +simplify.reflexivity. +simplify.reflexivity. +qed. + +theorem max_S_max : \forall f: nat \to bool. \forall n:nat. +(f (S n) = true \land max (S n) f = (S n)) \lor +(f (S n) = false \land max (S n) f = max n f). +intros.simplify.elim (f (S n)). +simplify.left.split.reflexivity.reflexivity. +simplify.right.split.reflexivity.reflexivity. +qed. + +theorem le_max_n : \forall f: nat \to bool. \forall n:nat. +max n f \le n. +intros.elim n.rewrite > max_O_f.apply le_n. +simplify.elim (f (S n1)).simplify.apply le_n. +simplify.apply le_S.assumption. +qed. + +theorem le_to_le_max : \forall f: nat \to bool. \forall n,m:nat. +n\le m \to max n f \le max m f. +intros.elim H. +apply le_n. +apply (trans_le ? (max n1 f)).apply H2. +cut ((f (S n1) = true \land max (S n1) f = (S n1)) \lor +(f (S n1) = false \land max (S n1) f = max n1 f)). +elim Hcut.elim H3. +rewrite > H5. +apply le_S.apply le_max_n. +elim H3.rewrite > H5.apply le_n. +apply max_S_max. +qed. + +theorem f_m_to_le_max: \forall f: nat \to bool. \forall n,m:nat. +m\le n \to f m = true \to m \le max n f. +intros 3.elim n.apply (le_n_O_elim m H). +apply le_O_n. +apply (le_n_Sm_elim m n1 H1). +intro.apply (trans_le ? (max n1 f)). +apply H.apply le_S_S_to_le.assumption.assumption. +apply le_to_le_max.apply le_n_Sn. +intro.simplify.rewrite < H3. +rewrite > H2.simplify.apply le_n. +qed. + +theorem max_f_g: \forall f,g,n. (\forall i. i \le n \to f i = g i) \to +max n f = max n g. +intros 3. +elim n + [simplify. + rewrite > (H O) + [reflexivity + |apply le_n + ] + |simplify. + rewrite > H + [rewrite > H1 + [reflexivity + |apply le_n + ] + |intros. + apply H1. + apply le_S. + assumption + ] + ] +qed. + +theorem le_max_f_max_g: \forall f,g,n. (\forall i. i \le n \to f i = true \to g i =true) \to +max n f \le max n g. +intros 3. +elim n + [simplify. + elim (f O);apply le_O_n + |simplify. + apply (bool_elim ? (f (S n1)));intro + [rewrite > (H1 (S n1) ? H2) + [apply le_n + |apply le_n + ] + |cases (g(S n1)) + [simplify. + apply le_S. + apply le_max_n + |simplify. + apply H. + intros. + apply H1 + [apply le_S.assumption + |assumption + ] + ] + ] + ] +qed. + + +theorem max_O : \forall f:nat \to bool. \forall n:nat. +(\forall i:nat. le i n \to f i = false) \to max n f = O. +intros 2.elim n + [simplify.rewrite > H + [reflexivity + |apply le_O_n + ] + |simplify.rewrite > H1 + [simplify.apply H. + intros. + apply H1. + apply le_S. + assumption + |apply le_n + ] + ] +qed. + +theorem f_max_true : \forall f:nat \to bool. \forall n:nat. +(\exists i:nat. le i n \land f i = true) \to f (max n f) = true. +intros 2. +elim n.elim H.elim H1.generalize in match H3. +apply (le_n_O_elim a H2).intro.simplify.rewrite > H4. +simplify.assumption. +simplify. +apply (bool_ind (\lambda b:bool. +(f (S n1) = b) \to (f (match b in bool with +[ true \Rightarrow (S n1) +| false \Rightarrow (max n1 f)])) = true)). +simplify.intro.assumption. +simplify.intro.apply H. +elim H1.elim H3.generalize in match H5. +apply (le_n_Sm_elim a n1 H4). +intros. +apply (ex_intro nat ? a). +split.apply le_S_S_to_le.assumption.assumption. +intros.apply False_ind.apply not_eq_true_false. +rewrite < H2.rewrite < H7.rewrite > H6. reflexivity. +reflexivity. +qed. + +theorem exists_forall_le:\forall f,n. +(\exists i. i \le n \land f i = true) \lor +(\forall i. i \le n \to f i = false). +intros. +elim n + [apply (bool_elim ? (f O));intro + [left.apply (ex_intro ? ? O). + split[apply le_n|assumption] + |right.intros. + apply (le_n_O_elim ? H1). + assumption + ] + |elim H + [elim H1.elim H2. + left.apply (ex_intro ? ? a). + split[apply le_S.assumption|assumption] + |apply (bool_elim ? (f (S n1)));intro + [left.apply (ex_intro ? ? (S n1)). + split[apply le_n|assumption] + |right.intros. + elim (le_to_or_lt_eq ? ? H3) + [apply H1. + apply le_S_S_to_le. + apply H4 + |rewrite > H4. + assumption + ] + ] + ] + ] +qed. + +theorem exists_max_forall_false:\forall f,n. +((\exists i. i \le n \land f i = true) \land (f (max n f) = true))\lor +((\forall i. i \le n \to f i = false) \land (max n f) = O). +intros. +elim (exists_forall_le f n) + [left.split + [assumption + |apply f_max_true.assumption + ] + |right.split + [assumption + |apply max_O.assumption + ] + ] +qed. + +theorem false_to_lt_max: \forall f,n,m.O < n \to +f n = false \to max m f \le n \to max m f < n. +intros. +elim (le_to_or_lt_eq ? ? H2) + [assumption + |elim (exists_max_forall_false f m) + [elim H4. + apply False_ind. + apply not_eq_true_false. + rewrite < H6. + rewrite > H3. + assumption + |elim H4. + rewrite > H6. + assumption + ] + ] +qed. + +theorem lt_max_to_false : \forall f:nat \to bool. +\forall n,m:nat. (max n f) < m \to m \leq n \to f m = false. +intros 2. +elim n.absurd (le m O).assumption. +cut (O < m).apply (lt_O_n_elim m Hcut).exact not_le_Sn_O. +rewrite < (max_O_f f).assumption. +generalize in match H1. +elim (max_S_max f n1). +elim H3. +absurd (m \le S n1).assumption. +apply lt_to_not_le.rewrite < H6.assumption. +elim H3. +apply (le_n_Sm_elim m n1 H2). +intro. +apply H.rewrite < H6.assumption. +apply le_S_S_to_le.assumption. +intro.rewrite > H7.assumption. +qed. + +theorem f_false_to_le_max: \forall f,n,p. (∃i:nat.i≤n∧f i=true) \to +(\forall m. p < m \to f m = false) +\to max n f \le p. +intros. +apply not_lt_to_le.intro. +apply not_eq_true_false. +rewrite < (H1 ? H2). +apply sym_eq. +apply f_max_true. +assumption. +qed. + +definition max_spec \def \lambda f:nat \to bool.\lambda n,m: nat. +m \le n \land (f m)=true \land (\forall i. m < i \to i \le n \to (f i = false)). + +theorem max_spec_to_max: \forall f:nat \to bool.\forall n,m:nat. +max_spec f n m \to max n f = m. +intros 2. +elim n + [elim H.elim H1.apply (le_n_O_elim ? H3). + apply max_O_f + |elim H1. + elim (max_S_max f n1) + [elim H4. + rewrite > H6. + apply le_to_le_to_eq + [apply not_lt_to_le. + unfold Not.intro. + apply not_eq_true_false. + rewrite < H5. + apply H3 + [assumption|apply le_n] + |elim H2.assumption + ] + |elim H4. + rewrite > H6. + apply H. + elim H2. + split + [split + [elim (le_to_or_lt_eq ? ? H7) + [apply le_S_S_to_le.assumption + |apply False_ind. + apply not_eq_true_false. + rewrite < H8. + rewrite > H9. + assumption + ] + |assumption + ] + |intros. + apply H3 + [assumption|apply le_S.assumption] + ] + ] + ] +qed. + +let rec min_aux off n f \def + match f n with + [ true \Rightarrow n + | false \Rightarrow + match off with + [ O \Rightarrow n + | (S p) \Rightarrow min_aux p (S n) f]]. + +definition min : nat \to (nat \to bool) \to nat \def +\lambda n.\lambda f. min_aux n O f. + +theorem min_aux_O_f: \forall f:nat \to bool. \forall i :nat. +min_aux O i f = i. +intros.simplify. +elim (f i).reflexivity. +simplify.reflexivity. +qed. + +theorem min_O_f : \forall f:nat \to bool. +min O f = O. +intro.apply (min_aux_O_f f O). +qed. + +theorem min_aux_S : \forall f: nat \to bool. \forall i,n:nat. +((f n) = true \land min_aux (S i) n f = n) \lor +((f n) = false \land min_aux (S i) n f = min_aux i (S n) f). +intros.simplify.elim (f n). +simplify.left.split.reflexivity.reflexivity. +simplify.right.split.reflexivity.reflexivity. +qed. + +theorem f_min_aux_true: \forall f:nat \to bool. \forall off,m:nat. +(\exists i. le m i \land le i (off + m) \land f i = true) \to +f (min_aux off m f) = true. +intros 2. +elim off.elim H.elim H1.elim H2. +cut (a = m). +rewrite > (min_aux_O_f f).rewrite < Hcut.assumption. +apply (antisym_le a m).assumption.assumption. +simplify. +apply (bool_ind (\lambda b:bool. +(f m = b) \to (f (match b in bool with +[ true \Rightarrow m +| false \Rightarrow (min_aux n (S m) f)])) = true)). +intro; assumption. +intro. apply H. +elim H1.elim H3.elim H4. +elim (le_to_or_lt_eq ? a H6). +apply (ex_intro nat ? a). +split.split. +assumption. +rewrite < plus_n_Sm; assumption. +assumption. +absurd (f a = false).rewrite < H8.assumption. +rewrite > H5. +apply not_eq_true_false. +reflexivity. +qed. + +theorem lt_min_aux_to_false : \forall f:nat \to bool. +\forall n,off,m:nat. n \leq m \to m < (min_aux off n f) \to f m = false. +intros 3. +generalize in match n; clear n. +elim off.absurd (le n1 m).assumption. +apply lt_to_not_le.rewrite < (min_aux_O_f f n1).assumption. +elim (le_to_or_lt_eq ? ? H1); + [ unfold lt in H3; + apply (H (S n1)); + [ assumption + | elim (min_aux_S f n n1); + [ elim H4; + elim (not_le_Sn_n n1); + rewrite > H6 in H2; + apply (lt_to_le (S n1) n1 ?). + apply (le_to_lt_to_lt (S n1) m n1 ? ?); + [apply (H3). + |apply (H2). + ] + | elim H4; + rewrite < H6; + assumption + ] + ] + | rewrite < H3 in H2 ⊢ %. + elim (min_aux_S f n n1); + [ elim H4; + rewrite > H6 in H2; + unfold lt in H2; + elim (not_le_Sn_n ? H2) + | elim H4; + assumption + ] + ] +qed. + + +lemma le_min_aux : \forall f:nat \to bool. +\forall n,off:nat. n \leq (min_aux off n f). +intros 3. +generalize in match n. clear n. +elim off. +rewrite > (min_aux_O_f f n1).apply le_n. +elim (min_aux_S f n n1). +elim H1.rewrite > H3.apply le_n. +elim H1.rewrite > H3. +apply (transitive_le ? (S n1)); + [ apply le_n_Sn + | apply (H (S n1)) + ] +qed. + +theorem le_min_aux_r : \forall f:nat \to bool. +\forall n,off:nat. (min_aux off n f) \le n+off. +intros. +generalize in match n. clear n. +elim off.simplify. +elim (f n1).simplify.rewrite < plus_n_O.apply le_n. +simplify.rewrite < plus_n_O.apply le_n. +simplify.elim (f n1). +simplify. +apply (le_plus_n_r (S n) n1). +simplify.rewrite < plus_n_Sm. +apply (H (S n1)). +qed. \ No newline at end of file diff --git a/matita/library/nat/minus.ma b/matita/library/nat/minus.ma new file mode 100644 index 000000000..415dccaac --- /dev/null +++ b/matita/library/nat/minus.ma @@ -0,0 +1,401 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + + +include "nat/le_arith.ma". +include "nat/compare.ma". + +let rec minus n m \def + match n with + [ O \Rightarrow O + | (S p) \Rightarrow + match m with + [O \Rightarrow (S p) + | (S q) \Rightarrow minus p q ]]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural minus" 'minus x y = (cic:/matita/nat/minus/minus.con x y). + +theorem minus_n_O: \forall n:nat.n=n-O. +intros.elim n.simplify.reflexivity. +simplify.reflexivity. +qed. + +theorem minus_n_n: \forall n:nat.O=n-n. +intros.elim n.simplify. +reflexivity. +simplify.apply H. +qed. + +theorem minus_Sn_n: \forall n:nat. S O = (S n)-n. +intro.elim n. +simplify.reflexivity. +elim H.reflexivity. +qed. + +theorem minus_Sn_m: \forall n,m:nat. m \leq n \to (S n)-m = S (n-m). +intros 2. +apply (nat_elim2 +(\lambda n,m.m \leq n \to (S n)-m = S (n-m))). +intros.apply (le_n_O_elim n1 H). +simplify.reflexivity. +intros.simplify.reflexivity. +intros.rewrite < H.reflexivity. +apply le_S_S_to_le. assumption. +qed. + +theorem eq_minus_S_pred: \forall n,m. n - (S m) = pred(n -m). +apply nat_elim2 + [intro.reflexivity + |intro.simplify.autobatch + |intros.simplify.assumption + ] +qed. + +theorem plus_minus: +\forall n,m,p:nat. m \leq n \to (n-m)+p = (n+p)-m. +intros 2. +apply (nat_elim2 +(\lambda n,m.\forall p:nat.m \leq n \to (n-m)+p = (n+p)-m)). +intros.apply (le_n_O_elim ? H). +simplify.rewrite < minus_n_O.reflexivity. +intros.simplify.reflexivity. +intros.simplify.apply H.apply le_S_S_to_le.assumption. +qed. + +theorem minus_plus_m_m: \forall n,m:nat.n = (n+m)-m. +intros 2. +generalize in match n. +elim m. +rewrite < minus_n_O.apply plus_n_O. +elim n2.simplify. +apply minus_n_n. +rewrite < plus_n_Sm. +change with (S n3 = (S n3 + n1)-n1). +apply H. +qed. + +theorem plus_minus_m_m: \forall n,m:nat. +m \leq n \to n = (n-m)+m. +intros 2. +apply (nat_elim2 (\lambda n,m.m \leq n \to n = (n-m)+m)). +intros.apply (le_n_O_elim n1 H). +reflexivity. +intros.simplify.rewrite < plus_n_O.reflexivity. +intros.simplify.rewrite < sym_plus.simplify. +apply eq_f.rewrite < sym_plus.apply H. +apply le_S_S_to_le.assumption. +qed. + +theorem minus_to_plus :\forall n,m,p:nat.m \leq n \to n-m = p \to +n = m+p. +intros.apply (trans_eq ? ? ((n-m)+m)). +apply plus_minus_m_m. +apply H.elim H1. +apply sym_plus. +qed. + +theorem plus_to_minus :\forall n,m,p:nat. +n = m+p \to n-m = p. +intros. +apply (inj_plus_r m). +rewrite < H. +rewrite < sym_plus. +symmetry. +apply plus_minus_m_m.rewrite > H. +rewrite > sym_plus. +apply le_plus_n. +qed. + +theorem minus_S_S : \forall n,m:nat. +eq nat (minus (S n) (S m)) (minus n m). +intros. +reflexivity. +qed. + +theorem minus_pred_pred : \forall n,m:nat. lt O n \to lt O m \to +eq nat (minus (pred n) (pred m)) (minus n m). +intros. +apply (lt_O_n_elim n H).intro. +apply (lt_O_n_elim m H1).intro. +simplify.reflexivity. +qed. + +theorem eq_minus_n_m_O: \forall n,m:nat. +n \leq m \to n-m = O. +intros 2. +apply (nat_elim2 (\lambda n,m.n \leq m \to n-m = O)). +intros.simplify.reflexivity. +intros.apply False_ind. +apply not_le_Sn_O; +[2: apply H | skip]. +intros. +simplify.apply H.apply le_S_S_to_le. apply H1. +qed. + +theorem le_SO_minus: \forall n,m:nat.S n \leq m \to S O \leq m-n. +intros.elim H.elim (minus_Sn_n n).apply le_n. +rewrite > minus_Sn_m. +apply le_S.assumption. +apply lt_to_le.assumption. +qed. + +theorem minus_le_S_minus_S: \forall n,m:nat. m-n \leq S (m-(S n)). +intros.apply (nat_elim2 (\lambda n,m.m-n \leq S (m-(S n)))). +intro.elim n1.simplify.apply le_n_Sn. +simplify.rewrite < minus_n_O.apply le_n. +intros.simplify.apply le_n_Sn. +intros.simplify.apply H. +qed. + +theorem lt_minus_S_n_to_le_minus_n : \forall n,m,p:nat. m-(S n) < p \to m-n \leq p. +intros 3.simplify.intro. +apply (trans_le (m-n) (S (m-(S n))) p). +apply minus_le_S_minus_S. +assumption. +qed. + +theorem le_minus_m: \forall n,m:nat. n-m \leq n. +intros.apply (nat_elim2 (\lambda m,n. n-m \leq n)). +intros.rewrite < minus_n_O.apply le_n. +intros.simplify.apply le_n. +intros.simplify.apply le_S.assumption. +qed. + +theorem lt_minus_m: \forall n,m:nat. O < n \to O < m \to n-m \lt n. +intros.apply (lt_O_n_elim n H).intro. +apply (lt_O_n_elim m H1).intro. +simplify.unfold lt.apply le_S_S.apply le_minus_m. +qed. + +theorem minus_le_O_to_le: \forall n,m:nat. n-m \leq O \to n \leq m. +intros 2. +apply (nat_elim2 (\lambda n,m:nat.n-m \leq O \to n \leq m)). +intros.apply le_O_n. +simplify.intros. assumption. +simplify.intros.apply le_S_S.apply H.assumption. +qed. + +(* galois *) +theorem monotonic_le_minus_r: +\forall p,q,n:nat. q \leq p \to n-p \le n-q. +simplify.intros 2.apply (nat_elim2 +(\lambda p,q.\forall a.q \leq p \to a-p \leq a-q)). +intros.apply (le_n_O_elim n H).apply le_n. +intros.rewrite < minus_n_O. +apply le_minus_m. +intros.elim a.simplify.apply le_n. +simplify.apply H.apply le_S_S_to_le.assumption. +qed. + +theorem le_minus_to_plus: \forall n,m,p. (le (n-m) p) \to (le n (p+m)). +intros 2.apply (nat_elim2 (\lambda n,m.\forall p.(le (n-m) p) \to (le n (p+m)))). +intros.apply le_O_n. +simplify.intros.rewrite < plus_n_O.assumption. +intros. +rewrite < plus_n_Sm. +apply le_S_S.apply H. +exact H1. +qed. + +theorem le_plus_to_minus: \forall n,m,p. (le n (p+m)) \to (le (n-m) p). +intros 2.apply (nat_elim2 (\lambda n,m.\forall p.(le n (p+m)) \to (le (n-m) p))). +intros.simplify.apply le_O_n. +intros 2.rewrite < plus_n_O.intro.simplify.assumption. +intros.simplify.apply H. +apply le_S_S_to_le.rewrite > plus_n_Sm.assumption. +qed. + +(* the converse of le_plus_to_minus does not hold *) +theorem le_plus_to_minus_r: \forall n,m,p. (le (n+m) p) \to (le n (p-m)). +intros 3.apply (nat_elim2 (\lambda m,p.(le (n+m) p) \to (le n (p-m)))). +intro.rewrite < plus_n_O.rewrite < minus_n_O.intro.assumption. +intro.intro.cut (n=O).rewrite > Hcut.apply le_O_n. +apply sym_eq. apply le_n_O_to_eq. +apply (trans_le ? (n+(S n1))). +rewrite < sym_plus. +apply le_plus_n.assumption. +intros.simplify. +apply H.apply le_S_S_to_le. +rewrite > plus_n_Sm.assumption. +qed. + +(* minus and lt - to be completed *) +theorem lt_minus_l: \forall m,l,n:nat. + l < m \to m \le n \to n - m < n - l. +apply nat_elim2 + [intros.apply False_ind.apply (not_le_Sn_O ? H) + |intros.rewrite < minus_n_O. + autobatch + |intros. + generalize in match H2. + apply (nat_case n1) + [intros.apply False_ind.apply (not_le_Sn_O ? H3) + |intros.simplify. + apply H + [ + apply lt_S_S_to_lt. + assumption + |apply le_S_S_to_le.assumption + ] + ] + ] +qed. + +theorem lt_minus_r: \forall n,m,l:nat. + n \le l \to l < m \to l -n < m -n. +intro.elim n + [applyS H1 + |rewrite > eq_minus_S_pred. + rewrite > eq_minus_S_pred. + apply lt_pred + [unfold lt.apply le_plus_to_minus_r.applyS H1 + |apply H[autobatch|assumption] + ] + ] +qed. + +lemma lt_to_lt_O_minus : \forall m,n. + n < m \to O < m - n. +intros. +unfold. apply le_plus_to_minus_r. unfold in H. rewrite > sym_plus. +rewrite < plus_n_Sm. +rewrite < plus_n_O. +assumption. +qed. + +theorem lt_minus_to_plus: \forall n,m,p. (lt n (p-m)) \to (lt (n+m) p). +intros 3.apply (nat_elim2 (\lambda m,p.(lt n (p-m)) \to (lt (n+m) p))). +intro.rewrite < plus_n_O.rewrite < minus_n_O.intro.assumption. +simplify.intros.apply False_ind.apply (not_le_Sn_O n H). +simplify.intros.unfold lt. +apply le_S_S. +rewrite < plus_n_Sm. +apply H.apply H1. +qed. + +theorem lt_O_minus_to_lt: \forall a,b:nat. +O \lt b-a \to a \lt b. +intros. +rewrite > (plus_n_O a). +rewrite > (sym_plus a O). +apply (lt_minus_to_plus O a b). +assumption. +qed. + +theorem lt_minus_to_lt_plus: +\forall n,m,p. n - m < p \to n < m + p. +intros 2. +apply (nat_elim2 ? ? ? ? n m) + [simplify.intros.autobatch. + |intros 2.rewrite < minus_n_O. + intro.assumption + |intros. + simplify. + cut (n1 < m1+p) + [autobatch + |apply H. + apply H1 + ] + ] +qed. + +theorem lt_plus_to_lt_minus: +\forall n,m,p. m \le n \to n < m + p \to n - m < p. +intros 2. +apply (nat_elim2 ? ? ? ? n m) + [simplify.intros 3. + apply (le_n_O_elim ? H). + simplify.intros.assumption + |simplify.intros.assumption. + |intros. + simplify. + apply H + [apply le_S_S_to_le.assumption + |apply le_S_S_to_le.apply H2 + ] + ] +qed. + +theorem minus_m_minus_mn: \forall n,m. n\le m \to n=m-(m-n). +intros. +apply sym_eq. +apply plus_to_minus. +autobatch. +qed. + +theorem distributive_times_minus: distributive nat times minus. +unfold distributive. +intros. +apply ((leb_elim z y)). + intro.cut (x*(y-z)+x*z = (x*y-x*z)+x*z). + apply (inj_plus_l (x*z)).assumption. + apply (trans_eq nat ? (x*y)). + rewrite < distr_times_plus.rewrite < (plus_minus_m_m ? ? H).reflexivity. + rewrite < plus_minus_m_m. + reflexivity. + apply le_times_r.assumption. + intro.rewrite > eq_minus_n_m_O. + rewrite > (eq_minus_n_m_O (x*y)). + rewrite < sym_times.simplify.reflexivity. + apply le_times_r.apply lt_to_le.apply not_le_to_lt.assumption. + apply lt_to_le.apply not_le_to_lt.assumption. +qed. + +theorem distr_times_minus: \forall n,m,p:nat. n*(m-p) = n*m-n*p +\def distributive_times_minus. + +theorem eq_minus_plus_plus_minus: \forall n,m,p:nat. p \le m \to (n+m)-p = n+(m-p). +intros. +apply plus_to_minus. +rewrite > sym_plus in \vdash (? ? ? %). +rewrite > assoc_plus. +rewrite < plus_minus_m_m. +reflexivity.assumption. +qed. + +theorem eq_minus_minus_minus_plus: \forall n,m,p:nat. (n-m)-p = n-(m+p). +intros. +cut (m+p \le n \or m+p \nleq n). + elim Hcut. + symmetry.apply plus_to_minus. + rewrite > assoc_plus.rewrite > (sym_plus p).rewrite < plus_minus_m_m. + rewrite > sym_plus.rewrite < plus_minus_m_m. + reflexivity. + apply (trans_le ? (m+p)). + rewrite < sym_plus.apply le_plus_n. + assumption. + apply le_plus_to_minus_r.rewrite > sym_plus.assumption. + rewrite > (eq_minus_n_m_O n (m+p)). + rewrite > (eq_minus_n_m_O (n-m) p). + reflexivity. + apply le_plus_to_minus.apply lt_to_le. rewrite < sym_plus. + apply not_le_to_lt. assumption. + apply lt_to_le.apply not_le_to_lt.assumption. + apply (decidable_le (m+p) n). +qed. + +theorem eq_plus_minus_minus_minus: \forall n,m,p:nat. p \le m \to m \le n \to +p+(n-m) = n-(m-p). +intros. +apply sym_eq. +apply plus_to_minus. +rewrite < assoc_plus. +rewrite < plus_minus_m_m. +rewrite < sym_plus. +rewrite < plus_minus_m_m.reflexivity. +assumption.assumption. +qed. diff --git a/matita/library/nat/nat.ma b/matita/library/nat/nat.ma new file mode 100644 index 000000000..a15827afe --- /dev/null +++ b/matita/library/nat/nat.ma @@ -0,0 +1,107 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "higher_order_defs/functions.ma". + +inductive nat : Set \def + | O : nat + | S : nat \to nat. + +definition pred: nat \to nat \def + \lambda n:nat. match n with + [ O \Rightarrow O + | (S p) \Rightarrow p ]. + +theorem pred_Sn : \forall n:nat.n=(pred (S n)). + intros. simplify. reflexivity. +qed. + +theorem injective_S : injective nat nat S. + unfold injective. + intros. + rewrite > pred_Sn. + rewrite > (pred_Sn y). + apply eq_f. assumption. +qed. + +theorem inj_S : \forall n,m:nat.(S n)=(S m) \to n=m \def + injective_S. + +theorem not_eq_S : \forall n,m:nat. + \lnot n=m \to S n \neq S m. + intros. unfold Not. intros. + apply H. apply injective_S. assumption. +qed. + +definition not_zero : nat \to Prop \def + \lambda n: nat. + match n with + [ O \Rightarrow False + | (S p) \Rightarrow True ]. + +theorem not_eq_O_S : \forall n:nat. O \neq S n. + intros. unfold Not. intros. + cut (not_zero O). + exact Hcut. + rewrite > H.exact I. +qed. + +theorem not_eq_n_Sn : \forall n:nat. n \neq S n. + intros.elim n. + apply not_eq_O_S. + apply not_eq_S.assumption. +qed. + +theorem nat_case: + \forall n:nat.\forall P:nat \to Prop. + P O \to (\forall m:nat. P (S m)) \to P n. +intros.elim n + [ assumption + | apply H1 ] +qed. + +theorem nat_case1: + \forall n:nat.\forall P:nat \to Prop. + (n=O \to P O) \to (\forall m:nat. (n=(S m) \to P (S m))) \to P n. +intros 2; elim n + [ apply H;reflexivity + | apply H2;reflexivity ] +qed. + +theorem nat_elim2 : + \forall R:nat \to nat \to Prop. + (\forall n:nat. R O n) + \to (\forall n:nat. R (S n) O) + \to (\forall n,m:nat. R n m \to R (S n) (S m)) + \to \forall n,m:nat. R n m. +intros 5;elim n + [ apply H + | apply (nat_case m) + [ apply H1 + | intro; apply H2; apply H3 ] ] +qed. + +theorem decidable_eq_nat : \forall n,m:nat.decidable (n=m). + intros.unfold decidable. + apply (nat_elim2 (\lambda n,m.(Or (n=m) ((n=m) \to False)))) + [ intro; elim n1 + [ left; reflexivity + | right; apply not_eq_O_S ] + | intro; right; intro; apply (not_eq_O_S n1); apply sym_eq; assumption + | intros; elim H + [ left; apply eq_f; assumption + | right; intro; apply H1; apply inj_S; assumption ] ] +qed. diff --git a/matita/library/nat/neper.ma b/matita/library/nat/neper.ma new file mode 100644 index 000000000..6662742c9 --- /dev/null +++ b/matita/library/nat/neper.ma @@ -0,0 +1,747 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/iteration2.ma". +include "nat/div_and_mod_diseq.ma". +include "nat/binomial.ma". +include "nat/log.ma". +include "nat/chebyshev.ma". + +theorem sigma_p_div_exp: \forall n,m. +sigma_p n (\lambda i.true) (\lambda i.m/(exp (S(S O)) i)) \le +((S(S O))*m*(exp (S(S O)) n) - (S(S O))*m)/(exp (S(S O)) n). +intros. +elim n + [apply le_O_n. + |rewrite > true_to_sigma_p_Sn + [apply (trans_le ? (m/(S(S O))\sup(n1)+((S(S O))*m*(S(S O))\sup(n1)-(S(S O))*m)/(S(S O))\sup(n1))) + [apply le_plus_r.assumption + |rewrite > assoc_times in ⊢ (? ? (? (? % ?) ?)). + rewrite < distr_times_minus. + change in ⊢ (? ? (? ? %)) with ((S(S O))*(exp (S(S O)) n1)). + rewrite > sym_times in ⊢ (? ? (? % ?)). + rewrite > sym_times in ⊢ (? ? (? ? %)). + rewrite < lt_to_lt_to_eq_div_div_times_times + [apply (trans_le ? ((m+((S(S O))*m*((S(S O)))\sup(n1)-(S(S O))*m))/((S(S O)))\sup(n1))) + [apply le_plus_div. + apply lt_O_exp. + apply lt_O_S + |change in ⊢ (? (? (? ? (? ? %)) ?) ?) with (m + (m +O)). + rewrite < plus_n_O. + rewrite < eq_minus_minus_minus_plus. + rewrite > sym_plus. + rewrite > sym_times in ⊢ (? (? (? (? (? (? % ?) ?) ?) ?) ?) ?). + rewrite > assoc_times. + rewrite < plus_minus_m_m + [apply le_n + |apply le_plus_to_minus_r. + rewrite > plus_n_O in ⊢ (? (? ? %) ?). + change in ⊢ (? % ?) with ((S(S O))*m). + rewrite > sym_times. + apply le_times_r. + rewrite > times_n_SO in ⊢ (? % ?). + apply le_times_r. + apply lt_O_exp. + apply lt_O_S + ] + ] + |apply lt_O_S + |apply lt_O_exp. + apply lt_O_S + ] + ] + |reflexivity + ] + ] +qed. + +theorem le_fact_exp: \forall i,m. i \le m \to m!≤ m \sup i*(m-i)!. +intro.elim i + [rewrite < minus_n_O. + simplify.rewrite < plus_n_O. + apply le_n + |simplify. + apply (trans_le ? ((m)\sup(n)*(m-n)!)) + [apply H. + apply lt_to_le.assumption + |rewrite > sym_times in ⊢ (? ? (? % ?)). + rewrite > assoc_times. + apply le_times_r. + generalize in match H1. + cases m;intro + [apply False_ind. + apply (lt_to_not_le ? ? H2). + apply le_O_n + |rewrite > minus_Sn_m. + simplify. + apply le_plus_r. + apply le_times_l. + apply le_minus_m. + apply le_S_S_to_le. + assumption + ] + ] + ] +qed. + +theorem le_fact_exp1: \forall n. S O < n \to (S(S O))*n!≤ n \sup n. +intros.elim H + [apply le_n + |change with ((S(S O))*((S n1)*(fact n1)) \le (S n1)*(exp (S n1) n1)). + rewrite < assoc_times. + rewrite < sym_times in ⊢ (? (? % ?) ?). + rewrite > assoc_times. + apply le_times_r. + apply (trans_le ? (exp n1 n1)) + [assumption + |apply monotonic_exp1. + apply le_n_Sn + ] + ] +qed. + +theorem le_exp_sigma_p_exp: \forall n. (exp (S n) n) \le +sigma_p (S n) (\lambda k.true) (\lambda k.(exp n n)/k!). +intro. +rewrite > exp_S_sigma_p. +apply le_sigma_p. +intros.unfold bc. +apply (trans_le ? ((exp n (n-i))*((n \sup i)/i!))) + [rewrite > sym_times. + apply le_times_r. + rewrite > sym_times. + rewrite < eq_div_div_div_times + [apply monotonic_div + [apply lt_O_fact + |apply le_times_to_le_div2 + [apply lt_O_fact + |apply le_fact_exp. + apply le_S_S_to_le. + assumption + ] + ] + |apply lt_O_fact + |apply lt_O_fact + ] + |rewrite > (plus_minus_m_m ? i) in ⊢ (? ? (? (? ? %) ?)) + [rewrite > exp_plus_times. + apply le_times_div_div_times. + apply lt_O_fact + |apply le_S_S_to_le. + assumption + ] + ] +qed. + +theorem lt_exp_sigma_p_exp: \forall n. S O < n \to +(exp (S n) n) < +sigma_p (S n) (\lambda k.true) (\lambda k.(exp n n)/k!). +intros. +rewrite > exp_S_sigma_p. +apply lt_sigma_p + [intros.unfold bc. + apply (trans_le ? ((exp n (n-i))*((n \sup i)/i!))) + [rewrite > sym_times. + apply le_times_r. + rewrite > sym_times. + rewrite < eq_div_div_div_times + [apply monotonic_div + [apply lt_O_fact + |apply le_times_to_le_div2 + [apply lt_O_fact + |apply le_fact_exp. + apply le_S_S_to_le. + assumption + ] + ] + |apply lt_O_fact + |apply lt_O_fact + ] + |rewrite > (plus_minus_m_m ? i) in ⊢ (? ? (? (? ? %) ?)) + [rewrite > exp_plus_times. + apply le_times_div_div_times. + apply lt_O_fact + |apply le_S_S_to_le. + assumption + ] + ] + |apply (ex_intro ? ? n). + split + [split + [apply le_n + |reflexivity + ] + |rewrite < minus_n_n. + rewrite > bc_n_n. + simplify.unfold lt. + apply le_times_to_le_div + [apply lt_O_fact + |rewrite > sym_times. + apply le_fact_exp1. + assumption + ] + ] + ] +qed. + +theorem le_exp_SSO_fact:\forall n. +exp (S(S O)) (pred n) \le n!. +intro.elim n + [apply le_n + |change with ((S(S O))\sup n1 ≤(S n1)*n1!). + apply (nat_case1 n1);intros + [apply le_n + |change in ⊢ (? % ?) with ((S(S O))*exp (S(S O)) (pred (S m))). + apply le_times + [apply le_S_S.apply le_S_S.apply le_O_n + |rewrite < H1.assumption + ] + ] + ] +qed. + +theorem lt_SO_to_lt_exp_Sn_n_SSSO: \forall n. S O < n \to +(exp (S n) n) < (S(S(S O)))*(exp n n). +intros. +apply (lt_to_le_to_lt ? (sigma_p (S n) (\lambda k.true) (\lambda k.(exp n n)/k!))) + [apply lt_exp_sigma_p_exp.assumption + |apply (trans_le ? (sigma_p (S n) (\lambda i.true) (\lambda i.(exp n n)/(exp (S(S O)) (pred i))))) + [apply le_sigma_p.intros. + apply le_times_to_le_div + [apply lt_O_exp. + apply lt_O_S + |apply (trans_le ? ((S(S O))\sup (pred i)* n \sup n/i!)) + [apply le_times_div_div_times. + apply lt_O_fact + |apply le_times_to_le_div2 + [apply lt_O_fact + |rewrite < sym_times. + apply le_times_r. + apply le_exp_SSO_fact + ] + ] + ] + |rewrite > eq_sigma_p_pred + [rewrite > div_SO. + rewrite > sym_plus. + change in ⊢ (? ? %) with ((exp n n)+(S(S O)*(exp n n))). + apply le_plus_r. + apply (trans_le ? (((S(S O))*(exp n n)*(exp (S(S O)) n) - (S(S O))*(exp n n))/(exp (S(S O)) n))) + [apply sigma_p_div_exp + |apply le_times_to_le_div2 + [apply lt_O_exp. + apply lt_O_S. + |apply le_minus_m + ] + ] + |reflexivity + ] + ] + ] +qed. + +theorem lt_exp_Sn_n_SSSO: \forall n. +(exp (S n) n) < (S(S(S O)))*(exp n n). +intro.cases n;intros + [simplify.apply le_S.apply le_n + |cases n1;intros + [simplify.apply le_n + |apply lt_SO_to_lt_exp_Sn_n_SSSO. + apply le_S_S.apply le_S_S.apply le_O_n + ] + ] +qed. + +theorem lt_exp_Sn_m_SSSO: \forall n,m. O < m \to +divides n m \to +(exp (S n) m) < (exp (S(S(S O))) (m/n)) *(exp n m). +intros. +elim H1.rewrite > H2. +rewrite < exp_exp_times. +rewrite < exp_exp_times. +rewrite > sym_times in ⊢ (? ? (? (? ? (? % ?)) ?)). +rewrite > lt_O_to_div_times + [rewrite > times_exp. + apply lt_exp1 + [apply (O_lt_times_to_O_lt ? n). + rewrite > sym_times. + rewrite < H2. + assumption + |apply lt_exp_Sn_n_SSSO + ] + |apply (O_lt_times_to_O_lt ? n2). + rewrite < H2. + assumption + ] +qed. + +theorem le_log_exp_Sn_log_exp_n: \forall n,m,p. O < m \to S O < p \to +divides n m \to +log p (exp (S n) m) \le S((m/n)*S(log p (S(S(S O))))) + log p (exp n m). +intros. +apply (trans_le ? (log p (((S(S(S O))))\sup(m/n)*((n)\sup(m))))) + [apply le_log + [assumption + |apply lt_to_le. + apply lt_exp_Sn_m_SSSO;assumption + ] + |apply (trans_le ? (S(log p (exp (S(S(S O))) (m/n)) + log p (exp n m)))) + [apply log_times. + assumption + |change in ⊢ (? ? %) with (S (m/n*S (log p (S(S(S O))))+log p ((n)\sup(m)))). + apply le_S_S. + apply le_plus_l. + apply log_exp1. + assumption + ] + ] +qed. + +theorem le_log_exp_fact_sigma_p: \forall a,b,n,p. S O < p \to +O < a \to a \le b \to b \le n \to +log p (exp b n!) - log p (exp a n!) \le +sigma_p b (\lambda i.leb a i) (\lambda i.S((n!/i)*S(log p (S(S(S O)))))). +intros 7. +elim b + [simplify. + apply (lt_O_n_elim ? (lt_O_fact n)).intro. + apply le_n. + |apply (bool_elim ? (leb a n1));intro + [rewrite > true_to_sigma_p_Sn + [apply (trans_le ? (S (n!/n1*S (log p (S(S(S O)))))+(log p ((n1)\sup(n!))-log p ((a)\sup(n!))))) + [rewrite > sym_plus. + rewrite > plus_minus + [apply le_plus_to_minus_r. + rewrite < plus_minus_m_m + [rewrite > sym_plus. + apply le_log_exp_Sn_log_exp_n + [apply lt_O_fact + |assumption + |apply divides_fact; + [apply (trans_le ? ? ? H1);apply leb_true_to_le;assumption + |apply lt_to_le;assumption]] + |apply le_log + [assumption + |cut (O = exp O n!) + [rewrite > Hcut;apply monotonic_exp1;constructor 2; + apply leb_true_to_le;assumption + |elim n + [reflexivity + |simplify;rewrite > exp_plus_times;rewrite < H6; + rewrite > sym_times;rewrite < times_n_O;reflexivity]]]] + |apply le_log + [assumption + |apply monotonic_exp1;apply leb_true_to_le;assumption]] + |rewrite > sym_plus;rewrite > sym_plus in \vdash (? ? %);apply le_minus_to_plus; + rewrite < minus_plus_m_m;apply H3;apply lt_to_le;assumption] + |assumption] + |lapply (not_le_to_lt ? ? (leb_false_to_not_le ? ? H5)); + rewrite > eq_minus_n_m_O + [apply le_O_n + |apply le_log + [assumption + |apply monotonic_exp1;assumption]]]] +qed. + +theorem le_exp_div:\forall n,m,q. O < m \to +exp (n/m) q \le (exp n q)/(exp m q). +intros. +apply le_times_to_le_div + [apply lt_O_exp. + assumption + |rewrite > times_exp. + rewrite < sym_times. + apply monotonic_exp1. + rewrite > (div_mod n m) in ⊢ (? ? %) + [apply le_plus_n_r + |assumption + ] + ] +qed. + +theorem le_log_div_sigma_p: \forall a,b,n,p. S O < p \to +O < a \to a \le b \to b \le n \to +log p (b/a) \le +(sigma_p b (\lambda i.leb a i) (\lambda i.S((n!/i)*S(log p (S(S(S O)))))))/n!. +intros. +apply le_times_to_le_div + [apply lt_O_fact + |apply (trans_le ? (log p (exp (b/a) n!))) + [apply log_exp2 + [assumption + |apply le_times_to_le_div + [assumption + |rewrite < times_n_SO. + assumption + ] + ] + |apply (trans_le ? (log p ((exp b n!)/(exp a n!)))) + [apply le_log + [assumption + |apply le_exp_div.assumption + ] + |apply (trans_le ? (log p (exp b n!) - log p (exp a n!))) + [apply log_div + [assumption + |apply lt_O_exp. + assumption + |apply monotonic_exp1. + assumption + ] + |apply le_log_exp_fact_sigma_p;assumption + ] + ] + ] + ] +qed. + +theorem sigma_p_log_div1: \forall n,b. S O < b \to +sigma_p (S n) (\lambda p.(primeb p \land (leb (S n) (p*p)))) (\lambda p.(log b (n/p))) +\le sigma_p (S n) (\lambda p.primeb p \land (leb (S n) (p*p))) (\lambda p.(sigma_p n (\lambda i.leb p i) (\lambda i.S((n!/i)*S(log b (S(S(S O)))))))/n! +). +intros. +apply le_sigma_p.intros. +apply le_log_div_sigma_p + [assumption + |apply prime_to_lt_O. + apply primeb_true_to_prime. + apply (andb_true_true ? ? H2) + |apply le_S_S_to_le. + assumption + |apply le_n + ] +qed. + +theorem sigma_p_log_div2: \forall n,b. S O < b \to +sigma_p (S n) (\lambda p.(primeb p \land (leb (S n) (p*p)))) (\lambda p.(log b (n/p))) +\le +(sigma_p (S n) (\lambda p.primeb p \land (leb (S n) (p*p))) (\lambda p.(sigma_p n (\lambda i.leb p i) (\lambda i.S((n!/i)))))*S(log b (S(S(S O))))/n!). +intros. +apply (trans_le ? (sigma_p (S n) (\lambda p.primeb p \land (leb (S n) (p*p))) (\lambda p.(sigma_p n (\lambda i.leb p i) (\lambda i.S((n!/i)*S(log b (S(S(S O)))))))/n! +))) + [apply sigma_p_log_div1.assumption + |apply le_times_to_le_div + [apply lt_O_fact + |rewrite > distributive_times_plus_sigma_p. + rewrite < sym_times in ⊢ (? ? %). + rewrite > distributive_times_plus_sigma_p. + apply le_sigma_p.intros. + apply (trans_le ? ((n!*(sigma_p n (λj:nat.leb i j) (λi:nat.S (n!/i*S (log b (S(S(S O)))))))/n!))) + [apply le_times_div_div_times. + apply lt_O_fact + |rewrite > sym_times. + rewrite > lt_O_to_div_times + [rewrite > distributive_times_plus_sigma_p. + apply le_sigma_p.intros. + rewrite < times_n_Sm in ⊢ (? ? %). + rewrite > plus_n_SO. + rewrite > sym_plus. + apply le_plus + [apply le_S_S.apply le_O_n + |rewrite < sym_times. + apply le_n + ] + |apply lt_O_fact + ] + ] + ] + ] +qed. + +theorem sigma_p_log_div: \forall n,b. S O < b \to +sigma_p (S n) (\lambda p.(primeb p \land (leb (S n) (p*p)))) (\lambda p.(log b (n/p))) +\le (sigma_p n (\lambda i.leb (S n) (i*i)) (\lambda i.(prim i)*S(n!/i)))*S(log b (S(S(S O))))/n! +. +intros. +apply (trans_le ? (sigma_p (S n) (\lambda p.primeb p \land (leb (S n) (p*p))) (\lambda p.(sigma_p n (\lambda i.leb p i) (\lambda i.S((n!/i)))))*S(log b (S(S(S O))))/n!)) + [apply sigma_p_log_div2.assumption + |apply monotonic_div + [apply lt_O_fact + |apply le_times_l. + unfold prim. + cut + (sigma_p (S n) (λp:nat.primeb p∧leb (S n) (p*p)) + (λp:nat.sigma_p n (λi:nat.leb p i) (λi:nat.S (n!/i))) + = sigma_p n (λi:nat.leb (S n) (i*i)) + (λi:nat.sigma_p (S n) (\lambda p.primeb p \land leb (S n) (p*p) \land leb p i) (λp:nat.S (n!/i)))) + [rewrite > Hcut. + apply le_sigma_p.intros. + rewrite < sym_times. + rewrite > distributive_times_plus_sigma_p. + rewrite < times_n_SO. + cut + (sigma_p (S n) (λp:nat.primeb p∧leb (S n) (p*p) \land leb p i) (λp:nat.S (n!/i)) + = sigma_p (S i) (\lambda p.primeb p \land leb (S n) (p*p) \land leb p i) (λp:nat.S (n!/i))) + [rewrite > Hcut1. + apply le_sigma_p1.intros. + rewrite < andb_sym. + rewrite < andb_sym in ⊢ (? (? (? (? ? %)) ?) ?). + apply (bool_elim ? (leb i1 i));intros + [apply (bool_elim ? (leb (S n) (i1*i1)));intros + [apply le_n + |apply le_O_n + ] + |apply le_O_n + ] + |apply or_false_to_eq_sigma_p + [apply le_S.assumption + |intros. + left.rewrite > (lt_to_leb_false i1 i) + [rewrite > andb_sym.reflexivity + |assumption + ] + ] + ] + |apply sigma_p_sigma_p.intros. + apply (bool_elim ? (leb x y));intros + [apply (bool_elim ? (leb (S n) (x*x)));intros + [rewrite > le_to_leb_true in ⊢ (? ? ? (? % ?)) + [reflexivity + |apply (trans_le ? (x*x)) + [apply leb_true_to_le.assumption + |apply le_times;apply leb_true_to_le;assumption + ] + ] + |rewrite < andb_sym in ⊢ (? ? (? % ?) ?). + rewrite < andb_sym in ⊢ (? ? ? (? ? (? % ?))). + rewrite < andb_sym in ⊢ (? ? ? %). + reflexivity + ] + |rewrite < andb_sym. + rewrite > andb_assoc in ⊢ (? ? ? %). + rewrite < andb_sym in ⊢ (? ? ? (? % ?)). + reflexivity + ] + ] + ] + ] +qed. + +theorem le_sigma_p_div_log_div_pred_log : \forall n,b,m. S O < b \to b*b \leq n \to +sigma_p (S n) (\lambda i.leb (S n) (i*i)) (\lambda i.m/(log b i)) +\leq ((S (S O)) * n * m)/(pred (log b n)). +intros. +apply (trans_le ? (sigma_p (S n) + (\lambda i.leb (S n) (i*i)) (\lambda i.(S (S O))*m/(pred (log b n))))) + [apply le_sigma_p;intros;apply le_times_to_le_div + [rewrite > minus_n_O in ⊢ (? ? (? %));rewrite < eq_minus_S_pred; + apply le_plus_to_minus_r;simplify; + rewrite < (eq_log_exp b ? H); + apply le_log; + [assumption + |simplify;rewrite < times_n_SO;assumption] + |apply (trans_le ? ((pred (log b n) * m)/log b i)) + [apply le_times_div_div_times;apply lt_O_log + [elim (le_to_or_lt_eq ? ? (le_O_n i)) + [assumption + |apply False_ind;apply not_eq_true_false;rewrite < H3;rewrite < H4; + reflexivity] + |apply (le_exp_to_le1 ? ? (S (S O))) + [apply lt_O_S; + |apply (trans_le ? (S n)) + [apply le_S;simplify;rewrite < times_n_SO;assumption + |rewrite > exp_SSO;apply leb_true_to_le;assumption]]] + |apply le_times_to_le_div2 + [apply lt_O_log + [elim (le_to_or_lt_eq ? ? (le_O_n i)) + [assumption + |apply False_ind;apply not_eq_true_false;rewrite < H3;rewrite < H4; + reflexivity] + |apply (le_exp_to_le1 ? ? (S (S O))) + [apply lt_O_S; + |apply (trans_le ? (S n)) + [apply le_S;simplify;rewrite < times_n_SO;assumption + |rewrite > exp_SSO;apply leb_true_to_le;assumption]]] + |rewrite > sym_times in \vdash (? ? %);rewrite < assoc_times; + apply le_times_l;rewrite > sym_times; + rewrite > minus_n_O in \vdash (? (? %) ?); + rewrite < eq_minus_S_pred;apply le_plus_to_minus; + simplify;rewrite < plus_n_O;apply (trans_le ? (log b (i*i))) + [apply le_log + [assumption + |apply lt_to_le;apply leb_true_to_le;assumption] + |rewrite > sym_plus;simplify;apply log_times;assumption]]]] + |rewrite > times_n_SO in \vdash (? (? ? ? (\lambda i:?.%)) ?); + rewrite < distributive_times_plus_sigma_p; + apply (trans_le ? ((((S (S O))*m)/(pred (log b n)))*n)) + [apply le_times_r;apply (trans_le ? (sigma_p (S n) (\lambda i:nat.leb (S O) (i*i)) (\lambda Hbeta1:nat.S O))) + [apply le_sigma_p1;intros;do 2 rewrite < times_n_SO; + apply (bool_elim ? (leb (S n) (i*i))) + [intro;cut (leb (S O) (i*i) = true) + [rewrite > Hcut;apply le_n + |apply le_to_leb_true;apply (trans_le ? (S n)) + [apply le_S_S;apply le_O_n + |apply leb_true_to_le;assumption]] + |intro;simplify in \vdash (? % ?);apply le_O_n] + |elim n + [simplify;apply le_n + |apply (bool_elim ? (leb (S O) ((S n1)*(S n1))));intro + [rewrite > true_to_sigma_p_Sn + [change in \vdash (? % ?) with (S (sigma_p (S n1) (\lambda i:nat.leb (S O) (i*i)) (\lambda Hbeta1:nat.S O))); + apply le_S_S;assumption + |assumption] + |rewrite > false_to_sigma_p_Sn + [apply le_S;assumption + |assumption]]]] + |rewrite > sym_times in \vdash (? % ?); + rewrite > sym_times in \vdash (? ? (? (? % ?) ?)); + rewrite > assoc_times; + apply le_times_div_div_times; + rewrite > minus_n_O in ⊢ (? ? (? %));rewrite < eq_minus_S_pred; + apply le_plus_to_minus_r;simplify; + rewrite < (eq_log_exp b ? H); + apply le_log; + [assumption + |simplify;rewrite < times_n_SO;assumption]]] +qed. + +(* theorem le_log_exp_Sn_log_exp_n: \forall n,m,a,p. O < m \to S O < p \to +divides n m \to +log p (exp n m) - log p (exp a m) \le +sigma_p (S n) (\lambda i.leb (S a) i) (\lambda i.S((m/i)*S(log p (S(S(S O)))))). +intros. +elim n + [rewrite > false_to_sigma_p_Sn. + simplify. + apply (lt_O_n_elim ? H).intro. + simplify.apply le_O_n + |apply (bool_elim ? (leb a n1));intro + [rewrite > true_to_sigma_p_Sn + [apply (trans_le ? (S (m/S n1*S (log p (S(S(S O)))))+(log p ((n1)\sup(m))-log p ((a)\sup(m))))) + [rewrite > sym_plus. + rewrite > plus_minus + [apply le_plus_to_minus_r. + rewrite < plus_minus_m_m + [rewrite > sym_plus. + apply le_log_exp_Sn_log_exp_n. + + +* a generalization +theorem le_exp_sigma_p_exp_m: \forall m,n. (exp (S m) n) \le +sigma_p (S n) (\lambda k.true) (\lambda k.((exp m (n-k))*(exp n k))/(k!)). +intros. +rewrite > exp_S_sigma_p. +apply le_sigma_p. +intros.unfold bc. +apply (trans_le ? ((exp m (n-i))*((n \sup i)/i!))) + [rewrite > sym_times. + apply le_times_r. + rewrite > sym_times. + rewrite < eq_div_div_div_times + [apply monotonic_div + [apply lt_O_fact + |apply le_times_to_le_div2 + [apply lt_O_fact + |apply le_fact_exp. + apply le_S_S_to_le. + assumption + ] + ] + |apply lt_O_fact + |apply lt_O_fact + ] + |apply le_times_div_div_times. + apply lt_O_fact + ] +qed. + +theorem lt_exp_sigma_p_exp_m: \forall m,n. S O < n \to +(exp (S m) n) < +sigma_p (S n) (\lambda k.true) (\lambda k.((exp m (n-k))*(exp n k))/(k!)). +intros. +rewrite > exp_S_sigma_p. +apply lt_sigma_p + [intros.unfold bc. + apply (trans_le ? ((exp m (n-i))*((n \sup i)/i!))) + [rewrite > sym_times. + apply le_times_r. + rewrite > sym_times. + rewrite < eq_div_div_div_times + [apply monotonic_div + [apply lt_O_fact + |apply le_times_to_le_div2 + [apply lt_O_fact + |apply le_fact_exp. + apply le_S_S_to_le. + assumption + ] + ] + |apply lt_O_fact + |apply lt_O_fact + ] + |apply le_times_div_div_times. + apply lt_O_fact + ] + |apply (ex_intro ? ? n). + split + [split + [apply le_n + |reflexivity + ] + |rewrite < minus_n_n. + rewrite > bc_n_n. + simplify.unfold lt. + apply le_times_to_le_div + [apply lt_O_fact + |rewrite > sym_times. + rewrite < plus_n_O. + apply le_fact_exp1. + assumption + ] + ] + ] +qed. + +theorem lt_SO_to_lt_exp_Sn_n_SSSO_bof: \forall m,n. S O < n \to +(exp (S m) n) < (S(S(S O)))*(exp m n). +intros. +apply (lt_to_le_to_lt ? (sigma_p (S n) (\lambda k.true) (\lambda k.((exp m (n-k))*(exp n k))/(k!)))) + [apply lt_exp_sigma_p_exp_m.assumption + |apply (trans_le ? (sigma_p (S n) (\lambda i.true) (\lambda i.(exp n n)/(exp (S(S O)) (pred i))))) + [apply le_sigma_p.intros. + apply le_times_to_le_div + [apply lt_O_exp. + apply lt_O_S + |apply (trans_le ? ((S(S O))\sup (pred i)* n \sup n/i!)) + [apply le_times_div_div_times. + apply lt_O_fact + |apply le_times_to_le_div2 + [apply lt_O_fact + |rewrite < sym_times. + apply le_times_r. + apply le_exp_SSO_fact + ] + ] + ] + |rewrite > eq_sigma_p_pred + [rewrite > div_SO. + rewrite > sym_plus. + change in ⊢ (? ? %) with ((exp n n)+(S(S O)*(exp n n))). + apply le_plus_r. + apply (trans_le ? (((S(S O))*(exp n n)*(exp (S(S O)) n) - (S(S O))*(exp n n))/(exp (S(S O)) n))) + [apply sigma_p_div_exp + |apply le_times_to_le_div2 + [apply lt_O_exp. + apply lt_O_S. + |apply le_minus_m + ] + ] + |reflexivity + ] + ] + ] +qed. +*) \ No newline at end of file diff --git a/matita/library/nat/nth_prime.ma b/matita/library/nat/nth_prime.ma new file mode 100644 index 000000000..bf6364456 --- /dev/null +++ b/matita/library/nat/nth_prime.ma @@ -0,0 +1,203 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/primes.ma". +include "nat/lt_arith.ma". + +(* upper bound by Bertrand's conjecture. *) +(* Too difficult to prove. +let rec nth_prime n \def +match n with + [ O \Rightarrow (S(S O)) + | (S p) \Rightarrow + let previous_prime \def S (nth_prime p) in + min_aux previous_prime ((S(S O))*previous_prime) primeb]. + +theorem example8 : nth_prime (S(S O)) = (S(S(S(S(S O))))). +normalize.reflexivity. +qed. + +theorem example9 : nth_prime (S(S(S O))) = (S(S(S(S(S(S(S O))))))). +normalize.reflexivity. +qed. + +theorem example10 : nth_prime (S(S(S(S O)))) = (S(S(S(S(S(S(S(S(S(S(S O))))))))))). +normalize.reflexivity. +qed. *) + +theorem smallest_factor_fact: \forall n:nat. +n < smallest_factor (S n!). +intros. +apply not_le_to_lt.unfold Not. +intro. +apply (not_divides_S_fact n (smallest_factor(S n!))). +apply lt_SO_smallest_factor. +unfold lt.apply le_S_S.apply le_SO_fact. +assumption. +apply divides_smallest_factor_n. +unfold lt.apply le_S_S.apply le_O_n. +qed. + +theorem ex_prime: \forall n. (S O) \le n \to \exists m. +n < m \land m \le S n! \land (prime m). +intros. +elim H. +apply (ex_intro nat ? (S(S O))). +split.split.apply (le_n (S(S O))). +apply (le_n (S(S O))).apply (primeb_to_Prop (S(S O))). +apply (ex_intro nat ? (smallest_factor (S (S n1)!))). +split.split. +apply smallest_factor_fact. +apply le_smallest_factor_n. +(* Andrea: ancora hint non lo trova *) +apply prime_smallest_factor_n.unfold lt. +apply le_S.apply le_SSO_fact. +unfold lt.apply le_S_S.assumption. +qed. + +let rec nth_prime n \def +match n with + [ O \Rightarrow (S(S O)) + | (S p) \Rightarrow + let previous_prime \def (nth_prime p) in + let upper_bound \def S previous_prime! in + min_aux upper_bound (S previous_prime) primeb]. + +(* it works +theorem example11 : nth_prime (S(S O)) = (S(S(S(S(S O))))). +normalize.reflexivity. +qed. + +theorem example12: nth_prime (S(S(S O))) = (S(S(S(S(S(S(S O))))))). +normalize.reflexivity. +qed. + +theorem example13 : nth_prime (S(S(S(S O)))) = (S(S(S(S(S(S(S(S(S(S(S O))))))))))). +normalize.reflexivity. +qed. + +alias num (instance 0) = "natural number". +theorem example14 : nth_prime 18 = 67. +normalize.reflexivity. +qed. +*) + +theorem prime_nth_prime : \forall n:nat.prime (nth_prime n). +intro. +apply (nat_case n).simplify. +apply (primeb_to_Prop (S(S O))). +intro. +change with +(let previous_prime \def (nth_prime m) in +let upper_bound \def S previous_prime! in +prime (min_aux upper_bound (S previous_prime) primeb)). +apply primeb_true_to_prime. +apply f_min_aux_true. +apply (ex_intro nat ? (smallest_factor (S (nth_prime m)!))). +split.split. +apply smallest_factor_fact. +apply transitive_le; + [2: apply le_smallest_factor_n + | skip + | apply (le_plus_n_r (S (nth_prime m)) (S (fact (nth_prime m)))) + ]. +apply prime_to_primeb_true. +apply prime_smallest_factor_n.unfold lt. +apply le_S_S.apply le_SO_fact. +qed. + +(* properties of nth_prime *) +theorem increasing_nth_prime: increasing nth_prime. +unfold increasing. +intros. +change with +(let previous_prime \def (nth_prime n) in +let upper_bound \def S previous_prime! in +(S previous_prime) \le min_aux upper_bound (S previous_prime) primeb). +intros. +apply le_min_aux. +qed. + +variant lt_nth_prime_n_nth_prime_Sn :\forall n:nat. +(nth_prime n) < (nth_prime (S n)) \def increasing_nth_prime. + +theorem injective_nth_prime: injective nat nat nth_prime. +apply increasing_to_injective. +apply increasing_nth_prime. +qed. + +theorem lt_SO_nth_prime_n : \forall n:nat. (S O) \lt nth_prime n. +intros. elim n.unfold lt.apply le_n. +apply (trans_lt ? (nth_prime n1)). +assumption.apply lt_nth_prime_n_nth_prime_Sn. +qed. + +theorem lt_O_nth_prime_n : \forall n:nat. O \lt nth_prime n. +intros.apply (trans_lt O (S O)). +unfold lt. apply le_n.apply lt_SO_nth_prime_n. +qed. + +theorem lt_n_nth_prime_n : \forall n:nat. n \lt nth_prime n. +intro. +elim n + [apply lt_O_nth_prime_n + |apply (lt_to_le_to_lt ? (S (nth_prime n1))) + [unfold.apply le_S_S.assumption + |apply lt_nth_prime_n_nth_prime_Sn + ] + ] +qed. + +theorem ex_m_le_n_nth_prime_m: +\forall n: nat. nth_prime O \le n \to +\exists m. nth_prime m \le n \land n < nth_prime (S m). +intros. +apply increasing_to_le2. +exact lt_nth_prime_n_nth_prime_Sn.assumption. +qed. + +theorem lt_nth_prime_to_not_prime: \forall n,m. nth_prime n < m \to m < nth_prime (S n) +\to \lnot (prime m). +intros. +apply primeb_false_to_not_prime. +letin previous_prime \def (nth_prime n). +letin upper_bound \def (S previous_prime!). +apply (lt_min_aux_to_false primeb (S previous_prime) upper_bound m). +assumption. +unfold lt. +apply (transitive_le (S m) (nth_prime (S n)) (min_aux (S (fact (nth_prime n))) (S (nth_prime n)) primeb) ? ?); + [apply (H1). + |apply (le_n (min_aux (S (fact (nth_prime n))) (S (nth_prime n)) primeb)). + ] +qed. + +(* nth_prime enumerates all primes *) +theorem prime_to_nth_prime : \forall p:nat. prime p \to +\exists i. nth_prime i = p. +intros. +cut (\exists m. nth_prime m \le p \land p < nth_prime (S m)). +elim Hcut.elim H1. +cut (nth_prime a < p \lor nth_prime a = p). +elim Hcut1. +absurd (prime p). +assumption. +apply (lt_nth_prime_to_not_prime a).assumption.assumption. +apply (ex_intro nat ? a).assumption. +apply le_to_or_lt_eq.assumption. +apply ex_m_le_n_nth_prime_m. +simplify.unfold prime in H.elim H.assumption. +qed. + diff --git a/matita/library/nat/ord.ma b/matita/library/nat/ord.ma new file mode 100644 index 000000000..9dd28ea1a --- /dev/null +++ b/matita/library/nat/ord.ma @@ -0,0 +1,617 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "datatypes/constructors.ma". +include "nat/exp.ma". +include "nat/nth_prime.ma". +include "nat/gcd.ma". (* for some properties of divides *) +include "nat/relevant_equations.ma". (* required by autobatch paramod *) + +let rec p_ord_aux p n m \def + match n \mod m with + [ O \Rightarrow + match p with + [ O \Rightarrow pair nat nat O n + | (S p) \Rightarrow + match (p_ord_aux p (n / m) m) with + [ (pair q r) \Rightarrow pair nat nat (S q) r] ] + | (S a) \Rightarrow pair nat nat O n]. + +(* p_ord n m = if m divides n q times, with remainder r *) +definition p_ord \def \lambda n,m:nat.p_ord_aux n n m. + +theorem p_ord_aux_to_Prop: \forall p,n,m. O < m \to + match p_ord_aux p n m with + [ (pair q r) \Rightarrow n = m \sup q *r ]. +intro. +elim p.simplify. +apply (nat_case (n \mod m)). +simplify.apply plus_n_O. +intros. +simplify.apply plus_n_O. +simplify. +apply (nat_case1 (n1 \mod m)).intro. +simplify. +generalize in match (H (n1 / m) m). +elim (p_ord_aux n (n1 / m) m). +simplify. +rewrite > assoc_times. +rewrite < H3.rewrite > (plus_n_O (m*(n1 / m))). +rewrite < H2. +rewrite > sym_times. +rewrite < div_mod.reflexivity. +assumption.assumption. +intros.simplify.apply plus_n_O. +qed. + +theorem p_ord_aux_to_exp: \forall p,n,m,q,r. O < m \to + (pair nat nat q r) = p_ord_aux p n m \to n = m \sup q * r. +intros. +change with +match (pair nat nat q r) with + [ (pair q r) \Rightarrow n = m \sup q * r ]. +rewrite > H1. +apply p_ord_aux_to_Prop. +assumption. +qed. + +(* questo va spostato in primes1.ma *) +theorem p_ord_exp: \forall n,m,i. O < m \to n \mod m \neq O \to +\forall p. i \le p \to p_ord_aux p (m \sup i * n) m = pair nat nat i n. +intros 5. +elim i. +simplify. +rewrite < plus_n_O. +apply (nat_case p). +simplify. +elim (n \mod m).simplify.reflexivity.simplify.reflexivity. +intro. +simplify. +cut (O < n \mod m \lor O = n \mod m). +elim Hcut.apply (lt_O_n_elim (n \mod m) H3). +intros. simplify.reflexivity. +apply False_ind. +apply H1.apply sym_eq.assumption. +apply le_to_or_lt_eq.apply le_O_n. +generalize in match H3. +apply (nat_case p).intro.apply False_ind.apply (not_le_Sn_O n1 H4). +intros. +simplify. fold simplify (m \sup (S n1)). +cut (((m \sup (S n1)*n) \mod m) = O). +rewrite > Hcut. +simplify.fold simplify (m \sup (S n1)). +cut ((m \sup (S n1) *n) / m = m \sup n1 *n). +rewrite > Hcut1. +rewrite > (H2 m1). simplify.reflexivity. +apply le_S_S_to_le.assumption. +(* div_exp *) +simplify. +rewrite > assoc_times. +apply (lt_O_n_elim m H). +intro.apply div_times. +(* mod_exp = O *) +apply divides_to_mod_O. +assumption. +simplify.rewrite > assoc_times. +apply (witness ? ? (m \sup n1 *n)).reflexivity. +qed. + +theorem p_ord_aux_to_Prop1: \forall p,n,m. (S O) < m \to O < n \to n \le p \to + match p_ord_aux p n m with + [ (pair q r) \Rightarrow r \mod m \neq O]. +intro.elim p.absurd (O < n).assumption. +apply le_to_not_lt.assumption. +simplify. +apply (nat_case1 (n1 \mod m)).intro. +generalize in match (H (n1 / m) m). +elim (p_ord_aux n (n1 / m) m). +apply H5.assumption. +apply eq_mod_O_to_lt_O_div. +apply (trans_lt ? (S O)).unfold lt.apply le_n. +assumption.assumption.assumption. +apply le_S_S_to_le. +apply (trans_le ? n1).change with (n1 / m < n1). +apply lt_div_n_m_n.assumption.assumption.assumption. +intros.simplify. +rewrite > H4. +unfold Not.intro. +apply (not_eq_O_S m1). +rewrite > H5.reflexivity. +qed. + +theorem p_ord_aux_to_not_mod_O: \forall p,n,m,q,r. (S O) < m \to O < n \to n \le p \to + pair nat nat q r = p_ord_aux p n m \to r \mod m \neq O. +intros. +change with + match (pair nat nat q r) with + [ (pair q r) \Rightarrow r \mod m \neq O]. +rewrite > H3. +apply p_ord_aux_to_Prop1. +assumption.assumption.assumption. +qed. + +theorem p_ord_exp1: \forall p,n,q,r. O < p \to \lnot p \divides r \to +n = p \sup q * r \to p_ord n p = pair nat nat q r. +intros.unfold p_ord. +rewrite > H2. +apply p_ord_exp + [assumption + |unfold.intro.apply H1. + apply mod_O_to_divides[assumption|assumption] + |apply (trans_le ? (p \sup q)). + cut ((S O) \lt p). + elim q.simplify.apply le_n_Sn. + simplify. + generalize in match H3. + apply (nat_case n1).simplify. + rewrite < times_n_SO.intro.assumption. + intros. + apply (trans_le ? (p*(S m))). + apply (trans_le ? ((S (S O))*(S m))). + simplify.rewrite > plus_n_Sm. + rewrite < plus_n_O. + apply le_plus_n. + apply le_times_l. + assumption. + apply le_times_r.assumption. + apply not_eq_to_le_to_lt. + unfold.intro.apply H1. + rewrite < H3. + apply (witness ? r r ?).simplify.apply plus_n_O. + assumption. + rewrite > times_n_SO in \vdash (? % ?). + apply le_times_r. + change with (O \lt r). + apply not_eq_to_le_to_lt. + unfold.intro. + apply H1.rewrite < H3. + apply (witness ? ? O ?).rewrite < times_n_O.reflexivity. + apply le_O_n. + ] +qed. + +theorem p_ord_to_exp1: \forall p,n,q,r. (S O) \lt p \to O \lt n \to p_ord n p = pair nat nat q r\to +\lnot p \divides r \land n = p \sup q * r. +intros. +unfold p_ord in H2. +split.unfold.intro. +apply (p_ord_aux_to_not_mod_O n n p q r).assumption.assumption. +apply le_n.symmetry.assumption. +apply divides_to_mod_O.apply (trans_lt ? (S O)). +unfold.apply le_n.assumption.assumption. +apply (p_ord_aux_to_exp n).apply (trans_lt ? (S O)). +unfold.apply le_n.assumption.symmetry.assumption. +qed. + +theorem p_ord_times: \forall p,a,b,qa,ra,qb,rb. prime p +\to O \lt a \to O \lt b +\to p_ord a p = pair nat nat qa ra +\to p_ord b p = pair nat nat qb rb +\to p_ord (a*b) p = pair nat nat (qa + qb) (ra*rb). +intros. +cut ((S O) \lt p). +elim (p_ord_to_exp1 ? ? ? ? Hcut H1 H3). +elim (p_ord_to_exp1 ? ? ? ? Hcut H2 H4). +apply p_ord_exp1. +apply (trans_lt ? (S O)).unfold.apply le_n.assumption. +unfold.intro. +elim (divides_times_to_divides ? ? ? H H9). +apply (absurd ? ? H10 H5). +apply (absurd ? ? H10 H7). +(* rewrite > H6. +rewrite > H8. *) +autobatch paramodulation. +unfold prime in H. elim H. assumption. +qed. + +theorem fst_p_ord_times: \forall p,a,b. prime p +\to O \lt a \to O \lt b +\to fst ? ? (p_ord (a*b) p) = (fst ? ? (p_ord a p)) + (fst ? ? (p_ord b p)). +intros. +rewrite > (p_ord_times p a b (fst ? ? (p_ord a p)) (snd ? ? (p_ord a p)) +(fst ? ? (p_ord b p)) (snd ? ? (p_ord b p)) H H1 H2). +simplify.reflexivity. +apply eq_pair_fst_snd. +apply eq_pair_fst_snd. +qed. + +theorem p_ord_p : \forall p:nat. (S O) \lt p \to p_ord p p = pair ? ? (S O) (S O). +intros. +apply p_ord_exp1. +apply (trans_lt ? (S O)). unfold.apply le_n.assumption. +unfold.intro. +apply (absurd ? ? H). +apply le_to_not_lt. +apply divides_to_le.unfold.apply le_n.assumption. +rewrite < times_n_SO. +apply exp_n_SO. +qed. + +(* p_ord and divides *) +theorem divides_to_p_ord: \forall p,a,b,c,d,n,m:nat. +O < n \to O < m \to prime p +\to divides n m \to p_ord n p = pair ? ? a b \to +p_ord m p = pair ? ? c d \to divides b d \land a \le c. +intros. +cut (S O < p) + [lapply (p_ord_to_exp1 ? ? ? ? Hcut H H4). + lapply (p_ord_to_exp1 ? ? ? ? Hcut H1 H5). + elim Hletin. clear Hletin. + elim Hletin1. clear Hletin1. + rewrite > H9 in H3. + split + [apply (gcd_SO_to_divides_times_to_divides (exp p c)) + [elim (le_to_or_lt_eq ? ? (le_O_n b)) + [assumption + |apply False_ind. + apply (lt_to_not_eq O ? H). + rewrite > H7. + rewrite < H10. + autobatch + ] + |elim c + [rewrite > sym_gcd. + apply gcd_SO_n + |simplify. + apply eq_gcd_times_SO + [apply lt_to_le.assumption + |apply lt_O_exp.apply lt_to_le.assumption + |rewrite > sym_gcd. + (* hint non trova prime_to_gcd_SO e + autobatch non chiude il goal *) + apply prime_to_gcd_SO + [assumption|assumption] + |assumption + ] + ] + |apply (trans_divides ? n) + [apply (witness ? ? (exp p a)). + rewrite > sym_times. + assumption + |assumption + ] + ] + |apply (le_exp_to_le p) + [assumption + |apply divides_to_le + [apply lt_O_exp.apply lt_to_le.assumption + |apply (gcd_SO_to_divides_times_to_divides d) + [apply lt_O_exp.apply lt_to_le.assumption + |elim a + [apply gcd_SO_n + |simplify.rewrite < sym_gcd. + apply eq_gcd_times_SO + [apply lt_to_le.assumption + |apply lt_O_exp.apply lt_to_le.assumption + |rewrite > sym_gcd. + (* hint non trova prime_to_gcd_SO e + autobatch non chiude il goal *) + apply prime_to_gcd_SO + [assumption|assumption] + |rewrite > sym_gcd. assumption + ] + ] + |apply (trans_divides ? n) + [apply (witness ? ? b).assumption + |rewrite > sym_times.assumption + ] + ] + ] + ] + ] + |elim H2.assumption + ] +qed. + +(* p_ord and primes *) +theorem not_divides_to_p_ord_O: \forall n,i. +Not (divides (nth_prime i) n) \to p_ord n (nth_prime i) = +pair nat nat O n. +intros. +apply p_ord_exp1 + [apply lt_O_nth_prime_n + |assumption + |autobatch + ] +qed. + +theorem p_ord_O_to_not_divides: \forall n,i,r. +O < n \to +p_ord n (nth_prime i) = pair nat nat O r +\to Not (divides (nth_prime i) n). +intros. +lapply (p_ord_to_exp1 ? ? ? ? ? ? H1) + [apply lt_SO_nth_prime_n + |assumption + |elim Hletin. + simplify in H3. + rewrite > H3. + rewrite < plus_n_O. + assumption + ] +qed. + +theorem p_ord_to_not_eq_O : \forall n,p,q,r. + (S O) < n \to + p_ord n (nth_prime p) = pair nat nat q r \to + Not (r=O). +intros. +unfold.intro. +cut (O < n) + [lapply (p_ord_to_exp1 ? ? ? ? ? ? H1) + [apply lt_SO_nth_prime_n. + |assumption + |elim Hletin. + apply (lt_to_not_eq ? ? Hcut). + rewrite > H4. + rewrite > H2. + apply times_n_O + ] + |apply (trans_lt ? (S O))[apply lt_O_S|assumption] + ] +qed. + +definition ord :nat \to nat \to nat \def +\lambda n,p. fst ? ? (p_ord n p). + +definition ord_rem :nat \to nat \to nat \def +\lambda n,p. snd ? ? (p_ord n p). + +theorem divides_to_ord: \forall p,n,m:nat. +O < n \to O < m \to prime p +\to divides n m +\to divides (ord_rem n p) (ord_rem m p) \land (ord n p) \le (ord m p). +intros. +apply (divides_to_p_ord p ? ? ? ? n m H H1 H2 H3) + [unfold ord.unfold ord_rem.apply eq_pair_fst_snd + |unfold ord.unfold ord_rem.apply eq_pair_fst_snd + ] +qed. + +theorem divides_to_divides_ord_rem: \forall p,n,m:nat. +O < n \to O < m \to prime p \to divides n m \to +divides (ord_rem n p) (ord_rem m p). +intros. +elim (divides_to_ord p n m H H1 H2 H3).assumption. +qed. + +theorem divides_to_le_ord: \forall p,n,m:nat. +O < n \to O < m \to prime p \to divides n m \to +(ord n p) \le (ord m p). +intros. +elim (divides_to_ord p n m H H1 H2 H3).assumption. +qed. + +theorem exp_ord: \forall p,n. (S O) \lt p +\to O \lt n \to n = p \sup (ord n p) * (ord_rem n p). +intros. +elim (p_ord_to_exp1 p n (ord n p) (ord_rem n p)) + [assumption + |assumption + |assumption + |unfold ord.unfold ord_rem. + apply eq_pair_fst_snd + ] +qed. + +theorem divides_ord_rem: \forall p,n. (S O) < p \to O < n +\to divides (ord_rem n p) n. +intros. +apply (witness ? ? (p \sup (ord n p))). +rewrite > sym_times. +apply exp_ord[assumption|assumption] +qed. + +theorem lt_O_ord_rem: \forall p,n. (S O) < p \to O < n \to O < ord_rem n p. +intros. +elim (le_to_or_lt_eq O (ord_rem n p)) + [assumption + |apply False_ind. + apply (lt_to_not_eq ? ? H1). + lapply (divides_ord_rem ? ? H H1). + rewrite < H2 in Hletin. + elim Hletin. + rewrite > H3. + reflexivity + |apply le_O_n + ] +qed. + +(* properties of ord e ord_rem *) + +theorem ord_times: \forall p,m,n.O (p_ord_times ? ? ? (ord m p) (ord_rem m p) (ord n p) (ord_rem n p)) + [reflexivity + |assumption + |assumption + |assumption + |unfold ord.unfold ord_rem.apply eq_pair_fst_snd + |unfold ord.unfold ord_rem.apply eq_pair_fst_snd + ] +qed. + +theorem ord_exp: \forall p,m.S O < p \to +ord (exp p m) p = m. +intros. +unfold ord. +rewrite > (p_ord_exp1 p (exp p m) m (S O)) + [reflexivity + |apply lt_to_le.assumption + |intro.apply (lt_to_not_le ? ? H). + apply divides_to_le + [apply lt_O_S + |assumption + ] + |apply times_n_SO + ] +qed. + +theorem not_divides_to_ord_O: +\forall p,m. prime p \to \lnot (divides p m) \to +ord m p = O. +intros.unfold ord. +rewrite > (p_ord_exp1 p m O m) + [reflexivity + |apply prime_to_lt_O.assumption + |assumption + |simplify.apply plus_n_O + ] +qed. + +theorem ord_O_to_not_divides: +\forall p,m. O < m \to prime p \to ord m p = O \to +\lnot (divides p m). +intros. +lapply (p_ord_to_exp1 p m (ord m p) (ord_rem m p)) + [elim Hletin. + rewrite > H4. + rewrite > H2. + rewrite > sym_times. + rewrite < times_n_SO. + assumption + |apply prime_to_lt_SO.assumption + |assumption + |unfold ord.unfold ord_rem.apply eq_pair_fst_snd + ] +qed. + +theorem divides_to_not_ord_O: +\forall p,m. O < m \to prime p \to divides p m \to +\lnot(ord m p = O). +intros.intro. +apply (ord_O_to_not_divides ? ? H H1 H3). +assumption. +qed. + +theorem not_ord_O_to_divides: +\forall p,m. O < m \to prime p \to \lnot (ord m p = O) \to +divides p m. +intros. +rewrite > (exp_ord p) in ⊢ (? ? %) + [apply (trans_divides ? (exp p (ord m p))) + [generalize in match H2. + cases (ord m p);intro + [apply False_ind.apply H3.reflexivity + |simplify.autobatch + ] + |autobatch + ] + |apply prime_to_lt_SO. + assumption + |assumption + ] +qed. + +theorem not_divides_ord_rem: \forall m,p.O< m \to S O < p \to +\lnot (divides p (ord_rem m p)). +intros. +elim (p_ord_to_exp1 p m (ord m p) (ord_rem m p)) + [assumption + |assumption + |assumption + |unfold ord.unfold ord_rem.apply eq_pair_fst_snd + ] +qed. + +theorem ord_ord_rem: \forall p,q,m. O < m \to +prime p \to prime q \to +q < p \to ord (ord_rem m p) q = ord m q. +intros. +rewrite > (exp_ord p) in ⊢ (? ? ? (? % ?)) + [rewrite > ord_times + [rewrite > not_divides_to_ord_O in ⊢ (? ? ? (? % ?)) + [reflexivity + |assumption + |intro. + apply (lt_to_not_eq ? ? H3). + apply (divides_exp_to_eq ? ? ? H2 H1 H4) + ] + |apply lt_O_exp. + apply (ltn_to_ltO ? ? H3) + |apply lt_O_ord_rem + [elim H1.assumption + |assumption + + ] + |assumption + ] + |elim H1.assumption + |assumption + ] +qed. + +theorem lt_ord_rem: \forall n,m. prime n \to O < m \to +divides n m \to ord_rem m n < m. +intros. +elim (le_to_or_lt_eq (ord_rem m n) m) + [assumption + |apply False_ind. + apply (ord_O_to_not_divides ? ? H1 H ? H2). + apply (inj_exp_r n) + [apply prime_to_lt_SO.assumption + |apply (inj_times_l1 m) + [assumption + |rewrite > sym_times in ⊢ (? ? ? %). + rewrite < times_n_SO. + rewrite < H3 in ⊢ (? ? (? ? %) ?). + apply sym_eq. + apply exp_ord + [apply prime_to_lt_SO.assumption + |assumption + ] + ] + ] + |apply divides_to_le + [assumption + |apply divides_ord_rem + [apply prime_to_lt_SO.assumption + |assumption + ] + ] + ] +qed. + +(* p_ord_inv is used to encode the pair ord and rem into + a single natural number. *) + +definition p_ord_inv \def +\lambda p,m,x. + match p_ord x p with + [pair q r \Rightarrow r*m+q]. + +theorem eq_p_ord_inv: \forall p,m,x. +p_ord_inv p m x = (ord_rem x p)*m+(ord x p). +intros.unfold p_ord_inv. unfold ord_rem. +unfold ord. +elim (p_ord x p). +reflexivity. +qed. + +theorem div_p_ord_inv: +\forall p,m,x. ord x p < m \to p_ord_inv p m x / m = ord_rem x p. +intros.rewrite > eq_p_ord_inv. +apply div_plus_times. +assumption. +qed. + +theorem mod_p_ord_inv: +\forall p,m,x. ord x p < m \to p_ord_inv p m x \mod m = ord x p. +intros.rewrite > eq_p_ord_inv. +apply mod_plus_times. +assumption. +qed. diff --git a/matita/library/nat/orders.ma b/matita/library/nat/orders.ma new file mode 100644 index 000000000..6b9648504 --- /dev/null +++ b/matita/library/nat/orders.ma @@ -0,0 +1,447 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/nat.ma". +include "higher_order_defs/ordering.ma". + +(* definitions *) +inductive le (n:nat) : nat \to Prop \def + | le_n : le n n + | le_S : \forall m:nat. le n m \to le n (S m). + +interpretation "natural 'less or equal to'" 'leq x y = (cic:/matita/nat/orders/le.ind#xpointer(1/1) x y). + +interpretation "natural 'neither less nor equal to'" 'nleq x y = + (cic:/matita/logic/connectives/Not.con + (cic:/matita/nat/orders/le.ind#xpointer(1/1) x y)). + +definition lt: nat \to nat \to Prop \def +\lambda n,m:nat.(S n) \leq m. + +interpretation "natural 'less than'" 'lt x y = (cic:/matita/nat/orders/lt.con x y). + +interpretation "natural 'not less than'" 'nless x y = + (cic:/matita/logic/connectives/Not.con (cic:/matita/nat/orders/lt.con x y)). + +definition ge: nat \to nat \to Prop \def +\lambda n,m:nat.m \leq n. + +interpretation "natural 'greater or equal to'" 'geq x y = (cic:/matita/nat/orders/ge.con x y). + +definition gt: nat \to nat \to Prop \def +\lambda n,m:nat.m (S_pred m); + [ apply le_S_S; + assumption + | assumption + ] +]. +qed. + +theorem le_to_le_pred: + ∀n,m. n ≤ m → pred n ≤ pred m. +intros 2; +elim n; +[ simplify; + apply le_O_n +| simplify; + generalize in match H1; + clear H1; + elim m; + [ elim (not_le_Sn_O ? H1) + | simplify; + apply le_S_S_to_le; + assumption + ] +]. +qed. + +(* le to lt or eq *) +theorem le_to_or_lt_eq : \forall n,m:nat. +n \leq m \to n < m \lor n = m. +intros.elim H. +right.reflexivity. +left.unfold lt.apply le_S_S.assumption. +qed. + +theorem Not_lt_n_n: ∀n. n ≮ n. +intro; +unfold Not; +intro; +unfold lt in H; +apply (not_le_Sn_n ? H). +qed. + +(* not eq *) +theorem lt_to_not_eq : \forall n,m:nat. n H in H1. +apply (lt_to_not_eq b b) +[ assumption +| reflexivity +] +qed. + +theorem lt_n_m_to_not_lt_m_Sn: ∀n,m. n < m → m ≮ S n. +intros; +unfold Not; +intro; +unfold lt in H; +unfold lt in H1; +generalize in match (le_S_S ? ? H); +intro; +generalize in match (transitive_le ? ? ? H2 H1); +intro; +apply (not_le_Sn_n ? H3). +qed. + +(* le vs. lt *) +theorem lt_to_le : \forall n,m:nat. n H7. +apply H. +apply le_to_or_lt_eq.apply H6. +qed. diff --git a/matita/library/nat/permutation.ma b/matita/library/nat/permutation.ma new file mode 100644 index 000000000..bd447ca7c --- /dev/null +++ b/matita/library/nat/permutation.ma @@ -0,0 +1,755 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/compare.ma". +include "nat/sigma_and_pi.ma". + +definition injn: (nat \to nat) \to nat \to Prop \def +\lambda f:nat \to nat.\lambda n:nat.\forall i,j:nat. +i \le n \to j \le n \to f i = f j \to i = j. + +theorem injn_Sn_n: \forall f:nat \to nat. \forall n:nat. +injn f (S n) \to injn f n.unfold injn. +intros.apply H. +apply le_S.assumption. +apply le_S.assumption. +assumption. +qed. + +theorem injective_to_injn: \forall f:nat \to nat. \forall n:nat. +injective nat nat f \to injn f n. +unfold injective.unfold injn.intros.apply H.assumption. +qed. + +definition permut : (nat \to nat) \to nat \to Prop +\def \lambda f:nat \to nat. \lambda m:nat. +(\forall i:nat. i \le m \to f i \le m )\land injn f m. + +theorem permut_O_to_eq_O: \forall h:nat \to nat. +permut h O \to (h O) = O. +intros.unfold permut in H. +elim H.apply sym_eq.apply le_n_O_to_eq. +apply H1.apply le_n. +qed. + +theorem permut_S_to_permut: \forall f:nat \to nat. \forall m:nat. +permut f (S m) \to f (S m) = (S m) \to permut f m. +unfold permut.intros. +elim H. +split.intros. +cut (f i < S m \lor f i = S m). +elim Hcut. +apply le_S_S_to_le.assumption. +apply False_ind. +apply (not_le_Sn_n m). +cut ((S m) = i). +rewrite > Hcut1.assumption. +apply H3.apply le_n.apply le_S.assumption. +rewrite > H5.assumption. +apply le_to_or_lt_eq.apply H2.apply le_S.assumption. +apply (injn_Sn_n f m H3). +qed. + +(* transpositions *) + +definition transpose : nat \to nat \to nat \to nat \def +\lambda i,j,n:nat. +match eqb n i with + [ true \Rightarrow j + | false \Rightarrow + match eqb n j with + [ true \Rightarrow i + | false \Rightarrow n]]. + +notation < "(❲i↹j❳)n" + right associative with precedence 71 +for @{ 'transposition $i $j $n}. + +notation < "(❲i \atop j❳)n" + right associative with precedence 71 +for @{ 'transposition $i $j $n}. + +interpretation "natural transposition" 'transposition i j n = + (cic:/matita/nat/permutation/transpose.con i j n). + +lemma transpose_i_j_i: \forall i,j:nat. transpose i j i = j. +intros.unfold transpose. +rewrite > (eqb_n_n i).simplify. reflexivity. +qed. + +lemma transpose_i_j_j: \forall i,j:nat. transpose i j j = i. +intros.unfold transpose. +apply (eqb_elim j i).simplify.intro.assumption. +rewrite > (eqb_n_n j).simplify. +intros. reflexivity. +qed. + +theorem transpose_i_i: \forall i,n:nat. (transpose i i n) = n. +intros.unfold transpose. +apply (eqb_elim n i). +intro.simplify.apply sym_eq. assumption. +intro.simplify.reflexivity. +qed. + +theorem transpose_i_j_j_i: \forall i,j,n:nat. +transpose i j n = transpose j i n. +intros.unfold transpose. +apply (eqb_elim n i). +apply (eqb_elim n j). +intros. simplify.rewrite < H. rewrite < H1. +reflexivity. +intros.simplify.reflexivity. +apply (eqb_elim n j). +intros.simplify.reflexivity. +intros.simplify.reflexivity. +qed. + +theorem transpose_transpose: \forall i,j,n:nat. +(transpose i j (transpose i j n)) = n. +intros.unfold transpose. unfold transpose. +apply (eqb_elim n i).simplify. +intro. +apply (eqb_elim j i). +simplify.intros.rewrite > H. rewrite > H1.reflexivity. +rewrite > (eqb_n_n j).simplify.intros. +apply sym_eq. +assumption. +apply (eqb_elim n j).simplify. +rewrite > (eqb_n_n i).intros.simplify. +apply sym_eq. assumption. +simplify.intros. +rewrite > (not_eq_to_eqb_false n i H1). +rewrite > (not_eq_to_eqb_false n j H). +simplify.reflexivity. +qed. + +theorem injective_transpose : \forall i,j:nat. +injective nat nat (transpose i j). +unfold injective. +intros. +rewrite < (transpose_transpose i j x). +rewrite < (transpose_transpose i j y). +apply eq_f.assumption. +qed. + +variant inj_transpose: \forall i,j,n,m:nat. +transpose i j n = transpose i j m \to n = m \def +injective_transpose. + +theorem permut_transpose: \forall i,j,n:nat. i \le n \to j \le n \to +permut (transpose i j) n. +unfold permut.intros. +split.unfold transpose. +intros. +elim (eqb i1 i).simplify.assumption. +elim (eqb i1 j).simplify.assumption. +simplify.assumption. +apply (injective_to_injn (transpose i j) n). +apply injective_transpose. +qed. + +theorem permut_fg: \forall f,g:nat \to nat. \forall n:nat. +permut f n \to permut g n \to permut (\lambda m.(f(g m))) n. +unfold permut. intros. +elim H.elim H1. +split.intros.simplify.apply H2. +apply H4.assumption. +simplify.intros. +apply H5.assumption.assumption. +apply H3.apply H4.assumption.apply H4.assumption. +assumption. +qed. + +theorem permut_transpose_l: +\forall f:nat \to nat. \forall m,i,j:nat. +i \le m \to j \le m \to permut f m \to permut (\lambda n.transpose i j (f n)) m. +intros.apply (permut_fg (transpose i j) f m ? ?). +apply permut_transpose.assumption.assumption. +assumption. +qed. + +theorem permut_transpose_r: +\forall f:nat \to nat. \forall m,i,j:nat. +i \le m \to j \le m \to permut f m \to permut (\lambda n.f (transpose i j n)) m. +intros.apply (permut_fg f (transpose i j) m ? ?). +assumption.apply permut_transpose.assumption.assumption. +qed. + +theorem eq_transpose : \forall i,j,k,n:nat. \lnot j=i \to + \lnot i=k \to \lnot j=k \to +transpose i j n = transpose i k (transpose k j (transpose i k n)). +(* uffa: triplo unfold? *) +intros.unfold transpose.unfold transpose.unfold transpose. +apply (eqb_elim n i).intro. +simplify.rewrite > (eqb_n_n k). +simplify.rewrite > (not_eq_to_eqb_false j i H). +rewrite > (not_eq_to_eqb_false j k H2). +reflexivity. +intro.apply (eqb_elim n j). +intro. +cut (\lnot n = k). +cut (\lnot n = i). +rewrite > (not_eq_to_eqb_false n k Hcut). +simplify. +rewrite > (not_eq_to_eqb_false n k Hcut). +rewrite > (eq_to_eqb_true n j H4). +simplify. +rewrite > (not_eq_to_eqb_false k i). +rewrite > (eqb_n_n k). +simplify.reflexivity. +unfold Not.intro.apply H1.apply sym_eq.assumption. +assumption. +unfold Not.intro.apply H2.apply (trans_eq ? ? n). +apply sym_eq.assumption.assumption. +intro.apply (eqb_elim n k).intro. +simplify. +rewrite > (not_eq_to_eqb_false i k H1). +rewrite > (not_eq_to_eqb_false i j). +simplify. +rewrite > (eqb_n_n i). +simplify.assumption. +unfold Not.intro.apply H.apply sym_eq.assumption. +intro.simplify. +rewrite > (not_eq_to_eqb_false n k H5). +rewrite > (not_eq_to_eqb_false n j H4). +simplify. +rewrite > (not_eq_to_eqb_false n i H3). +rewrite > (not_eq_to_eqb_false n k H5). +simplify.reflexivity. +qed. + +theorem permut_S_to_permut_transpose: \forall f:nat \to nat. +\forall m:nat. permut f (S m) \to permut (\lambda n.transpose (f (S m)) (S m) +(f n)) m. +unfold permut.intros. +elim H. +split.intros.simplify.unfold transpose. +apply (eqb_elim (f i) (f (S m))). +intro.apply False_ind. +cut (i = (S m)). +apply (not_le_Sn_n m). +rewrite < Hcut.assumption. +apply H2.apply le_S.assumption.apply le_n.assumption. +intro.simplify. +apply (eqb_elim (f i) (S m)). +intro. +cut (f (S m) \lt (S m) \lor f (S m) = (S m)). +elim Hcut.apply le_S_S_to_le.assumption. +apply False_ind.apply H4.rewrite > H6.assumption. +apply le_to_or_lt_eq.apply H1.apply le_n. +intro.simplify. +cut (f i \lt (S m) \lor f i = (S m)). +elim Hcut.apply le_S_S_to_le.assumption. +apply False_ind.apply H5.assumption. +apply le_to_or_lt_eq.apply H1.apply le_S.assumption. +unfold injn.intros. +apply H2.apply le_S.assumption.apply le_S.assumption. +apply (inj_transpose (f (S m)) (S m)). +apply H5. +qed. + +(* bounded bijectivity *) + +definition bijn : (nat \to nat) \to nat \to Prop \def +\lambda f:nat \to nat. \lambda n. \forall m:nat. m \le n \to +ex nat (\lambda p. p \le n \land f p = m). + +theorem eq_to_bijn: \forall f,g:nat\to nat. \forall n:nat. +(\forall i:nat. i \le n \to (f i) = (g i)) \to +bijn f n \to bijn g n. +intros 4.unfold bijn. +intros.elim (H1 m). +apply (ex_intro ? ? a). +rewrite < (H a).assumption. +elim H3.assumption.assumption. +qed. + +theorem bijn_Sn_n: \forall f:nat \to nat. \forall n:nat. +bijn f (S n) \to f (S n) = (S n) \to bijn f n. +unfold bijn.intros.elim (H m). +elim H3. +apply (ex_intro ? ? a).split. +cut (a < S n \lor a = S n). +elim Hcut.apply le_S_S_to_le.assumption. +apply False_ind. +apply (not_le_Sn_n n). +rewrite < H1.rewrite < H6.rewrite > H5.assumption. +apply le_to_or_lt_eq.assumption.assumption. +apply le_S.assumption. +qed. + +theorem bijn_n_Sn: \forall f:nat \to nat. \forall n:nat. +bijn f n \to f (S n) = (S n) \to bijn f (S n). +unfold bijn.intros. +cut (m < S n \lor m = S n). +elim Hcut. +elim (H m). +elim H4. +apply (ex_intro ? ? a).split. +apply le_S.assumption.assumption. +apply le_S_S_to_le.assumption. +apply (ex_intro ? ? (S n)). +split.apply le_n. +rewrite > H3.assumption. +apply le_to_or_lt_eq.assumption. +qed. + +theorem bijn_fg: \forall f,g:nat\to nat. \forall n:nat. +bijn f n \to bijn g n \to bijn (\lambda p.f(g p)) n. +unfold bijn. +intros.simplify. +elim (H m).elim H3. +elim (H1 a).elim H6. +apply (ex_intro ? ? a1). +split.assumption. +rewrite > H8.assumption. +assumption.assumption. +qed. + +theorem bijn_transpose : \forall n,i,j. i \le n \to j \le n \to +bijn (transpose i j) n. +intros.unfold bijn.unfold transpose.intros. +cut (m = i \lor \lnot m = i). +elim Hcut. +apply (ex_intro ? ? j). +split.assumption. +apply (eqb_elim j i). +intro.simplify.rewrite > H3.rewrite > H4.reflexivity. +rewrite > (eqb_n_n j).simplify. +intros. apply sym_eq.assumption. +cut (m = j \lor \lnot m = j). +elim Hcut1. +apply (ex_intro ? ? i). +split.assumption. +rewrite > (eqb_n_n i).simplify. +apply sym_eq. assumption. +apply (ex_intro ? ? m). +split.assumption. +rewrite > (not_eq_to_eqb_false m i). +rewrite > (not_eq_to_eqb_false m j). +simplify. reflexivity. +assumption. +assumption. +apply (decidable_eq_nat m j). +apply (decidable_eq_nat m i). +qed. + +theorem bijn_transpose_r: \forall f:nat\to nat.\forall n,i,j. i \le n \to j \le n \to +bijn f n \to bijn (\lambda p.f (transpose i j p)) n. +intros. +apply (bijn_fg f ?).assumption. +apply (bijn_transpose n i j).assumption.assumption. +qed. + +theorem bijn_transpose_l: \forall f:nat\to nat.\forall n,i,j. i \le n \to j \le n \to +bijn f n \to bijn (\lambda p.transpose i j (f p)) n. +intros. +apply (bijn_fg ? f). +apply (bijn_transpose n i j).assumption.assumption. +assumption. +qed. + +theorem permut_to_bijn: \forall n:nat.\forall f:nat\to nat. +permut f n \to bijn f n. +intro. +elim n.unfold bijn.intros. +apply (ex_intro ? ? m). +split.assumption. +apply (le_n_O_elim m ? (\lambda p. f p = p)). +assumption.unfold permut in H. +elim H.apply sym_eq. apply le_n_O_to_eq.apply H2.apply le_n. +apply (eq_to_bijn (\lambda p. +(transpose (f (S n1)) (S n1)) (transpose (f (S n1)) (S n1) (f p))) f). +intros.apply transpose_transpose. +apply (bijn_fg (transpose (f (S n1)) (S n1))). +apply bijn_transpose. +unfold permut in H1. +elim H1.apply H2.apply le_n.apply le_n. +apply bijn_n_Sn. +apply H. +apply permut_S_to_permut_transpose. +assumption.unfold transpose. +rewrite > (eqb_n_n (f (S n1))).simplify.reflexivity. +qed. + +let rec invert_permut n f m \def + match eqb m (f n) with + [true \Rightarrow n + |false \Rightarrow + match n with + [O \Rightarrow O + |(S p) \Rightarrow invert_permut p f m]]. + +theorem invert_permut_f: \forall f:nat \to nat. \forall n,m:nat. +m \le n \to injn f n\to invert_permut n f (f m) = m. +intros 4. +elim H. +apply (nat_case1 m). +intro.simplify. +rewrite > (eqb_n_n (f O)).simplify.reflexivity. +intros.simplify. +rewrite > (eqb_n_n (f (S m1))).simplify.reflexivity. +simplify. +rewrite > (not_eq_to_eqb_false (f m) (f (S n1))). +simplify.apply H2. +apply injn_Sn_n. assumption. +unfold Not.intro.absurd (m = S n1). +apply H3.apply le_S.assumption.apply le_n.assumption. +unfold Not.intro. +apply (not_le_Sn_n n1).rewrite < H5.assumption. +qed. + +theorem injective_invert_permut: \forall f:nat \to nat. \forall n:nat. +permut f n \to injn (invert_permut n f) n. +intros. +unfold injn.intros. +cut (bijn f n). +unfold bijn in Hcut. +generalize in match (Hcut i H1).intro. +generalize in match (Hcut j H2).intro. +elim H4.elim H6. +elim H5.elim H9. +rewrite < H8. +rewrite < H11. +apply eq_f. +rewrite < (invert_permut_f f n a). +rewrite < (invert_permut_f f n a1). +rewrite > H8. +rewrite > H11. +assumption.assumption. +unfold permut in H.elim H. assumption. +assumption. +unfold permut in H.elim H. assumption. +apply permut_to_bijn.assumption. +qed. + +theorem permut_invert_permut: \forall f:nat \to nat. \forall n:nat. +permut f n \to permut (invert_permut n f) n. +intros.unfold permut.split. +intros.simplify.elim n. +simplify.elim (eqb i (f O)).simplify.apply le_n.simplify.apply le_n. +simplify.elim (eqb i (f (S n1))).simplify.apply le_n. +simplify.apply le_S. assumption. +apply injective_invert_permut.assumption. +qed. + +theorem f_invert_permut: \forall f:nat \to nat. \forall n,m:nat. +m \le n \to permut f n\to f (invert_permut n f m) = m. +intros. +apply (injective_invert_permut f n H1). +unfold permut in H1.elim H1. +apply H2. +cut (permut (invert_permut n f) n).unfold permut in Hcut. +elim Hcut.apply H4.assumption. +apply permut_invert_permut.assumption.assumption. +apply invert_permut_f. +cut (permut (invert_permut n f) n).unfold permut in Hcut. +elim Hcut.apply H2.assumption. +apply permut_invert_permut.assumption. +unfold permut in H1.elim H1.assumption. +qed. + +theorem permut_n_to_eq_n: \forall h:nat \to nat.\forall n:nat. +permut h n \to (\forall m:nat. m < n \to h m = m) \to h n = n. +intros.unfold permut in H.elim H. +cut (invert_permut n h n < n \lor invert_permut n h n = n). +elim Hcut. +rewrite < (f_invert_permut h n n) in \vdash (? ? ? %). +apply eq_f. +rewrite < (f_invert_permut h n n) in \vdash (? ? % ?). +apply H1.assumption.apply le_n.assumption.apply le_n.assumption. +rewrite < H4 in \vdash (? ? % ?). +apply (f_invert_permut h).apply le_n.assumption. +apply le_to_or_lt_eq. +cut (permut (invert_permut n h) n). +unfold permut in Hcut.elim Hcut. +apply H4.apply le_n. +apply permut_invert_permut.assumption. +qed. + +theorem permut_n_to_le: \forall h:nat \to nat.\forall k,n:nat. +k \le n \to permut h n \to (\forall m:nat. m < k \to h m = m) \to +\forall j. k \le j \to j \le n \to k \le h j. +intros.unfold permut in H1.elim H1. +cut (h j < k \lor \not(h j < k)). +elim Hcut.absurd (k \le j).assumption. +apply lt_to_not_le. +cut (h j = j).rewrite < Hcut1.assumption. +apply H6.apply H5.assumption.assumption. +apply H2.assumption. +apply not_lt_to_le.assumption. +apply (decidable_lt (h j) k). +qed. + +(* applications *) + +let rec map_iter_i k (g:nat \to nat) f (i:nat) \def + match k with + [ O \Rightarrow g i + | (S k) \Rightarrow f (g (S (k+i))) (map_iter_i k g f i)]. + +theorem eq_map_iter_i: \forall g1,g2:nat \to nat. +\forall f:nat \to nat \to nat. \forall n,i:nat. +(\forall m:nat. i\le m \to m \le n+i \to g1 m = g2 m) \to +map_iter_i n g1 f i = map_iter_i n g2 f i. +intros 5.elim n.simplify.apply H.apply le_n. +apply le_n.simplify.apply eq_f2.apply H1.simplify. +apply le_S.apply le_plus_n.simplify.apply le_n. +apply H.intros.apply H1.assumption.simplify.apply le_S.assumption. +qed. + +(* map_iter examples *) + +theorem eq_map_iter_i_sigma: \forall g:nat \to nat. \forall n,m:nat. +map_iter_i n g plus m = sigma n g m. +intros.elim n.simplify.reflexivity. +simplify. +apply eq_f.assumption. +qed. + +theorem eq_map_iter_i_pi: \forall g:nat \to nat. \forall n,m:nat. +map_iter_i n g times m = pi n g m. +intros.elim n.simplify.reflexivity. +simplify. +apply eq_f.assumption. +qed. + +theorem eq_map_iter_i_fact: \forall n:nat. +map_iter_i n (\lambda m.m) times (S O) = (S n)!. +intros.elim n. +simplify.reflexivity. +change with +(((S n1)+(S O))*(map_iter_i n1 (\lambda m.m) times (S O)) = (S(S n1))*(S n1)!). +rewrite < plus_n_Sm.rewrite < plus_n_O. +apply eq_f.assumption. +qed. + +theorem eq_map_iter_i_transpose_l : \forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall g:nat \to nat. \forall n,k:nat. +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose (k+n) (S k+n) m)) f n. +intros.apply (nat_case1 k). +intros.simplify.fold simplify (transpose n (S n) (S n)). +rewrite > transpose_i_j_i. +rewrite > transpose_i_j_j. +apply H1. +intros. +change with +(f (g (S (S (m+n)))) (f (g (S (m+n))) (map_iter_i m g f n)) = +f (g (transpose (S m + n) (S (S m) + n) (S (S m)+n))) +(f (g (transpose (S m + n) (S (S m) + n) (S m+n))) +(map_iter_i m (\lambda m1. g (transpose (S m+n) (S (S m)+n) m1)) f n))). +rewrite > transpose_i_j_i. +rewrite > transpose_i_j_j. +rewrite < H. +rewrite < H. +rewrite < (H1 (g (S m + n))). +apply eq_f. +apply eq_map_iter_i. +intros.simplify.unfold transpose. +rewrite > (not_eq_to_eqb_false m1 (S m+n)). +rewrite > (not_eq_to_eqb_false m1 (S (S m)+n)). +simplify. +reflexivity. +apply (lt_to_not_eq m1 (S ((S m)+n))). +unfold lt.apply le_S_S.change with (m1 \leq S (m+n)).apply le_S.assumption. +apply (lt_to_not_eq m1 (S m+n)). +simplify.unfold lt.apply le_S_S.assumption. +qed. + +theorem eq_map_iter_i_transpose_i_Si : \forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall g:nat \to nat. \forall n,k,i:nat. n \le i \to i \le k+n \to +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose i (S i) m)) f n. +intros 6.elim k.cut (i=n). +rewrite > Hcut. +apply (eq_map_iter_i_transpose_l f H H1 g n O). +apply antisymmetric_le.assumption.assumption. +cut (i < S n1 + n \lor i = S n1 + n). +elim Hcut. +change with +(f (g (S (S n1)+n)) (map_iter_i (S n1) g f n) = +f (g (transpose i (S i) (S (S n1)+n))) (map_iter_i (S n1) (\lambda m. g (transpose i (S i) m)) f n)). +apply eq_f2.unfold transpose. +rewrite > (not_eq_to_eqb_false (S (S n1)+n) i). +rewrite > (not_eq_to_eqb_false (S (S n1)+n) (S i)). +simplify.reflexivity. +simplify.unfold Not.intro. +apply (lt_to_not_eq i (S n1+n)).assumption. +apply inj_S.apply sym_eq. assumption. +simplify.unfold Not.intro. +apply (lt_to_not_eq i (S (S n1+n))).simplify.unfold lt. +apply le_S_S.assumption. +apply sym_eq. assumption. +apply H2.assumption.apply le_S_S_to_le. +assumption. +rewrite > H5. +apply (eq_map_iter_i_transpose_l f H H1 g n (S n1)). +apply le_to_or_lt_eq.assumption. +qed. + +theorem eq_map_iter_i_transpose: +\forall f:nat\to nat \to nat. +associative nat f \to symmetric2 nat nat f \to \forall n,k,o:nat. +\forall g:nat \to nat. \forall i:nat. n \le i \to S (o + i) \le S k+n \to +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose i (S(o + i)) m)) f n. +intros 6. +apply (nat_elim1 o). +intro. +apply (nat_case m ?). +intros. +apply (eq_map_iter_i_transpose_i_Si ? H H1). +exact H3.apply le_S_S_to_le.assumption. +intros. +apply (trans_eq ? ? (map_iter_i (S k) (\lambda m. g (transpose i (S(m1 + i)) m)) f n)). +apply H2. +unfold lt. apply le_n.assumption. +apply (trans_le ? (S(S (m1+i)))). +apply le_S.apply le_n.assumption. +apply (trans_eq ? ? (map_iter_i (S k) (\lambda m. g +(transpose i (S(m1 + i)) (transpose (S(m1 + i)) (S(S(m1 + i))) m))) f n)). +apply (H2 O ? ? (S(m1+i))). +unfold lt.apply le_S_S.apply le_O_n.id. +apply (trans_le ? i).assumption. +change with (i \le (S m1)+i).apply le_plus_n. +exact H4. +apply (trans_eq ? ? (map_iter_i (S k) (\lambda m. g +(transpose i (S(m1 + i)) +(transpose (S(m1 + i)) (S(S(m1 + i))) +(transpose i (S(m1 + i)) m)))) f n)). +apply (H2 m1). +unfold lt. apply le_n.assumption. +apply (trans_le ? (S(S (m1+i)))). +apply le_S.apply le_n.assumption. +apply eq_map_iter_i. +intros.apply eq_f. +apply sym_eq. apply eq_transpose. +unfold Not. intro. +apply (not_le_Sn_n i). +rewrite < H7 in \vdash (? ? %). +apply le_S_S.apply le_S. +apply le_plus_n. +unfold Not. intro. +apply (not_le_Sn_n i). +rewrite > H7 in \vdash (? ? %). +apply le_S_S. +apply le_plus_n. +unfold Not. intro. +apply (not_eq_n_Sn (S m1+i)). +apply sym_eq.assumption. +qed. + +theorem eq_map_iter_i_transpose1: \forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall n,k,i,j:nat. +\forall g:nat \to nat. n \le i \to i < j \to j \le S k+n \to +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose i j m)) f n. +intros. +simplify in H3. +cut ((S i) < j \lor (S i) = j). +elim Hcut. +cut (j = S ((j - (S i)) + i)). +rewrite > Hcut1. +apply (eq_map_iter_i_transpose f H H1 n k (j - (S i)) g i). +assumption. +rewrite < Hcut1.assumption. +rewrite > plus_n_Sm. +apply plus_minus_m_m.apply lt_to_le.assumption. +rewrite < H5. +apply (eq_map_iter_i_transpose_i_Si f H H1 g). +simplify. +assumption.apply le_S_S_to_le. +apply (trans_le ? j).assumption.assumption. +apply le_to_or_lt_eq.assumption. +qed. + +theorem eq_map_iter_i_transpose2: \forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall n,k,i,j:nat. +\forall g:nat \to nat. n \le i \to i \le (S k+n) \to n \le j \to j \le (S k+n) \to +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose i j m)) f n. +intros. +apply (nat_compare_elim i j). +intro.apply (eq_map_iter_i_transpose1 f H H1 n k i j g H2 H6 H5). +intro.rewrite > H6. +apply eq_map_iter_i.intros. +rewrite > (transpose_i_i j).reflexivity. +intro. +apply (trans_eq ? ? (map_iter_i (S k) (\lambda m:nat.g (transpose j i m)) f n)). +apply (eq_map_iter_i_transpose1 f H H1 n k j i g H4 H6 H3). +apply eq_map_iter_i. +intros.apply eq_f.apply transpose_i_j_j_i. +qed. + +theorem permut_to_eq_map_iter_i:\forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall k,n:nat.\forall g,h:nat \to nat. +permut h (k+n) \to (\forall m:nat. m \lt n \to h m = m) \to +map_iter_i k g f n = map_iter_i k (\lambda m.g(h m)) f n. +intros 4.elim k + [simplify.rewrite > (permut_n_to_eq_n h) + [reflexivity|assumption|assumption] + |apply (trans_eq ? ? (map_iter_i (S n) (\lambda m.g ((transpose (h (S n+n1)) (S n+n1)) m)) f n1)) + [unfold permut in H3. + elim H3. + apply (eq_map_iter_i_transpose2 f H H1 n1 n ? ? g) + [apply (permut_n_to_le h n1 (S n+n1)) + [apply le_plus_n|assumption|assumption|apply le_plus_n|apply le_n] + |apply H5.apply le_n + |apply le_plus_n + |apply le_n + ] + |apply (trans_eq ? ? (map_iter_i (S n) (\lambda m. + (g(transpose (h (S n+n1)) (S n+n1) + (transpose (h (S n+n1)) (S n+n1) (h m)))) )f n1)) + [simplify.fold simplify (transpose (h (S n+n1)) (S n+n1) (S n+n1)). + apply eq_f2 + [apply eq_f. + rewrite > transpose_i_j_j. + rewrite > transpose_i_j_i. + rewrite > transpose_i_j_j. + reflexivity. + |apply (H2 n1 (\lambda m.(g(transpose (h (S n+n1)) (S n+n1) m)))) + [apply permut_S_to_permut_transpose.assumption + |intros. + unfold transpose. + rewrite > (not_eq_to_eqb_false (h m) (h (S n+n1))) + [rewrite > (not_eq_to_eqb_false (h m) (S n+n1)) + [simplify.apply H4.assumption + |rewrite > H4 + [apply lt_to_not_eq. + apply (trans_lt ? n1) + [assumption|simplify.unfold lt.apply le_S_S.apply le_plus_n] + |assumption + ] + ] + |unfold permut in H3.elim H3. + simplify.unfold Not.intro. + apply (lt_to_not_eq m (S n+n1)) + [apply (trans_lt ? n1) + [assumption|simplify.unfold lt.apply le_S_S.apply le_plus_n] + |unfold injn in H7. + apply (H7 m (S n+n1)) + [apply (trans_le ? n1) + [apply lt_to_le.assumption|apply le_plus_n] + |apply le_n + |assumption + ] + ] + ] + ] + ] + |apply eq_map_iter_i.intros. + rewrite > transpose_transpose.reflexivity + ] + ] + ] +qed. \ No newline at end of file diff --git a/matita/library/nat/pi_p.ma b/matita/library/nat/pi_p.ma new file mode 100644 index 000000000..882b67118 --- /dev/null +++ b/matita/library/nat/pi_p.ma @@ -0,0 +1,395 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/primes.ma". +(* include "nat/ord.ma". *) +include "nat/generic_iter_p.ma". +(* include "nat/count.ma". necessary just to use bool_to_nat and bool_to_nat_andb*) +include "nat/iteration2.ma". + +(* pi_p on nautral numbers is a specialization of iter_p_gen *) +definition pi_p: nat \to (nat \to bool) \to (nat \to nat) \to nat \def +\lambda n, p, g. (iter_p_gen n p nat g (S O) times). + +theorem true_to_pi_p_Sn: +\forall n:nat. \forall p:nat \to bool. \forall g:nat \to nat. +p n = true \to pi_p (S n) p g = (g n)*(pi_p n p g). +intros. +unfold pi_p. +apply true_to_iter_p_gen_Sn. +assumption. +qed. + +theorem false_to_pi_p_Sn: +\forall n:nat. \forall p:nat \to bool. \forall g:nat \to nat. +p n = false \to pi_p (S n) p g = pi_p n p g. +intros. +unfold pi_p. +apply false_to_iter_p_gen_Sn. +assumption. +qed. + +theorem eq_pi_p: \forall p1,p2:nat \to bool. +\forall g1,g2: nat \to nat.\forall n. +(\forall x. x < n \to p1 x = p2 x) \to +(\forall x. x < n \to g1 x = g2 x) \to +pi_p n p1 g1 = pi_p n p2 g2. +intros. +unfold pi_p. +apply eq_iter_p_gen; +assumption. +qed. + +theorem eq_pi_p1: \forall p1,p2:nat \to bool. +\forall g1,g2: nat \to nat.\forall n. +(\forall x. x < n \to p1 x = p2 x) \to +(\forall x. x < n \to p1 x = true \to g1 x = g2 x) \to +pi_p n p1 g1 = pi_p n p2 g2. +intros. +unfold pi_p. +apply eq_iter_p_gen1; +assumption. +qed. + +theorem pi_p_false: +\forall g: nat \to nat.\forall n.pi_p n (\lambda x.false) g = S O. +intros. +unfold pi_p. +apply iter_p_gen_false. +qed. + +theorem pi_p_times: \forall n,k:nat.\forall p:nat \to bool. +\forall g: nat \to nat. +pi_p (k+n) p g += pi_p k (\lambda x.p (x+n)) (\lambda x.g (x+n)) * pi_p n p g. +intros. +unfold pi_p. +apply (iter_p_gen_plusA nat n k p g (S O) times) +[ apply sym_times. +| intros. + apply sym_eq. + apply times_n_SO +| apply associative_times +] +qed. + +theorem false_to_eq_pi_p: \forall n,m:nat.n \le m \to +\forall p:nat \to bool. +\forall g: nat \to nat. (\forall i:nat. n \le i \to i < m \to +p i = false) \to pi_p m p g = pi_p n p g. +intros. +unfold pi_p. +apply (false_to_eq_iter_p_gen); +assumption. +qed. + +theorem or_false_eq_SO_to_eq_pi_p: +\forall n,m:nat.\forall p:nat \to bool. +\forall g: nat \to nat. +n \le m \to (\forall i:nat. n \le i \to i < m \to p i = false \lor g i = S O) +\to pi_p m p g = pi_p n p g. +intros. +unfold pi_p. +apply or_false_eq_baseA_to_eq_iter_p_gen + [intros.simplify.rewrite < plus_n_O.reflexivity + |assumption + |assumption + ] +qed. + +theorem pi_p2 : +\forall n,m:nat. +\forall p1,p2:nat \to bool. +\forall g: nat \to nat \to nat. +pi_p (n*m) + (\lambda x.andb (p1 (div x m)) (p2 (mod x m))) + (\lambda x.g (div x m) (mod x m)) = +pi_p n p1 + (\lambda x.pi_p m p2 (g x)). +intros. +unfold pi_p. +apply (iter_p_gen2 n m p1 p2 nat g (S O) times) +[ apply sym_times +| apply associative_times +| intros. + apply sym_eq. + apply times_n_SO +] +qed. + +theorem pi_p2' : +\forall n,m:nat. +\forall p1:nat \to bool. +\forall p2:nat \to nat \to bool. +\forall g: nat \to nat \to nat. +pi_p (n*m) + (\lambda x.andb (p1 (div x m)) (p2 (div x m) (mod x m))) + (\lambda x.g (div x m) (mod x m)) = +pi_p n p1 + (\lambda x.pi_p m (p2 x) (g x)). +intros. +unfold pi_p. +apply (iter_p_gen2' n m p1 p2 nat g (S O) times) +[ apply sym_times +| apply associative_times +| intros. + apply sym_eq. + apply times_n_SO +] +qed. + +lemma pi_p_gi: \forall g: nat \to nat. +\forall n,i.\forall p:nat \to bool.i < n \to p i = true \to +pi_p n p g = g i * pi_p n (\lambda x. andb (p x) (notb (eqb x i))) g. +intros. +unfold pi_p. +apply (iter_p_gen_gi) +[ apply sym_times +| apply associative_times +| intros. + apply sym_eq. + apply times_n_SO +| assumption +| assumption +] +qed. + +theorem eq_pi_p_gh: +\forall g,h,h1: nat \to nat.\forall n,n1. +\forall p1,p2:nat \to bool. +(\forall i. i < n \to p1 i = true \to p2 (h i) = true) \to +(\forall i. i < n \to p1 i = true \to h1 (h i) = i) \to +(\forall i. i < n \to p1 i = true \to h i < n1) \to +(\forall j. j < n1 \to p2 j = true \to p1 (h1 j) = true) \to +(\forall j. j < n1 \to p2 j = true \to h (h1 j) = j) \to +(\forall j. j < n1 \to p2 j = true \to h1 j < n) \to +pi_p n p1 (\lambda x.g(h x)) = pi_p n1 p2 g. +intros. +unfold pi_p. +apply (eq_iter_p_gen_gh nat (S O) times ? ? ? g h h1 n n1 p1 p2) +[ apply sym_times +| apply associative_times +| intros. + apply sym_eq. + apply times_n_SO +| assumption +| assumption +| assumption +| assumption +| assumption +| assumption +] +qed. + +(* monotonicity *) +theorem le_pi_p: +\forall n:nat. \forall p:nat \to bool. \forall g1,g2:nat \to nat. +(\forall i. i < n \to p i = true \to g1 i \le g2 i ) \to +pi_p n p g1 \le pi_p n p g2. +intros. +generalize in match H. +elim n + [apply le_n. + |apply (bool_elim ? (p n1));intros + [rewrite > true_to_pi_p_Sn + [rewrite > true_to_pi_p_Sn in ⊢ (? ? %) + [apply le_times + [apply H2[apply le_n|assumption] + |apply H1. + intros. + apply H2[apply le_S.assumption|assumption] + ] + |assumption + ] + |assumption + ] + |rewrite > false_to_pi_p_Sn + [rewrite > false_to_pi_p_Sn in ⊢ (? ? %) + [apply H1. + intros. + apply H2[apply le_S.assumption|assumption] + |assumption + ] + |assumption + ] + ] + ] +qed. + +theorem exp_sigma_p: \forall n,a,p. +pi_p n p (\lambda x.a) = (exp a (sigma_p n p (\lambda x.S O))). +intros. +elim n + [reflexivity + |apply (bool_elim ? (p n1)) + [intro. + rewrite > true_to_pi_p_Sn + [rewrite > true_to_sigma_p_Sn + [simplify. + rewrite > H. + reflexivity. + |assumption + ] + |assumption + ] + |intro. + rewrite > false_to_pi_p_Sn + [rewrite > false_to_sigma_p_Sn + [simplify.assumption + |assumption + ] + |assumption + ] + ] + ] +qed. + +theorem times_pi_p: \forall n,p,f,g. +pi_p n p (\lambda x.f x*g x) = pi_p n p f * pi_p n p g. +intros. +elim n + [simplify.reflexivity + |apply (bool_elim ? (p n1)) + [intro. + rewrite > true_to_pi_p_Sn + [rewrite > true_to_pi_p_Sn + [rewrite > true_to_pi_p_Sn + [rewrite > H.autobatch + |assumption + ] + |assumption + ] + |assumption + ] + |intro. + rewrite > false_to_pi_p_Sn + [rewrite > false_to_pi_p_Sn + [rewrite > false_to_pi_p_Sn;assumption + |assumption + ] + |assumption + ] + ] + ] +qed. + +theorem pi_p_SO: \forall n,p. +pi_p n p (\lambda i.S O) = S O. +intros.elim n + [reflexivity + |simplify.elim (p n1) + [simplify.rewrite < plus_n_O.assumption + |simplify.assumption + ] + ] +qed. + +theorem exp_pi_p: \forall n,m,p,f. +pi_p n p (\lambda x.exp (f x) m) = exp (pi_p n p f) m. +intros. +elim m + [simplify.apply pi_p_SO + |simplify. + rewrite > times_pi_p. + rewrite < H. + reflexivity + ] +qed. + +theorem exp_times_pi_p: \forall n,m,k,p,f. +pi_p n p (\lambda x.exp k (m*(f x))) = +exp (pi_p n p (\lambda x.exp k (f x))) m. +intros. +apply (trans_eq ? ? (pi_p n p (\lambda x.(exp (exp k (f x)) m)))) + [apply eq_pi_p;intros + [reflexivity + |apply sym_eq.rewrite > sym_times. + apply exp_exp_times + ] + |apply exp_pi_p + ] +qed. + + +theorem pi_p_knm: +\forall g: nat \to nat. +\forall h2:nat \to nat \to nat. +\forall h11,h12:nat \to nat. +\forall k,n,m. +\forall p1,p21:nat \to bool. +\forall p22:nat \to nat \to bool. +(\forall x. x < k \to p1 x = true \to +p21 (h11 x) = true \land p22 (h11 x) (h12 x) = true +\land h2 (h11 x) (h12 x) = x +\land (h11 x) < n \land (h12 x) < m) \to +(\forall i,j. i < n \to j < m \to p21 i = true \to p22 i j = true \to +p1 (h2 i j) = true \land +h11 (h2 i j) = i \land h12 (h2 i j) = j +\land h2 i j < k) \to +pi_p k p1 g = +pi_p n p21 (\lambda x:nat.pi_p m (p22 x) (\lambda y. g (h2 x y))). +intros. +unfold pi_p.unfold pi_p. +apply (iter_p_gen_knm nat (S O) times sym_times assoc_times ? ? ? h11 h12) + [intros.apply sym_eq.apply times_n_SO. + |assumption + |assumption + ] +qed. + +theorem pi_p_pi_p: +\forall g: nat \to nat \to nat. +\forall h11,h12,h21,h22: nat \to nat \to nat. +\forall n1,m1,n2,m2. +\forall p11,p21:nat \to bool. +\forall p12,p22:nat \to nat \to bool. +(\forall i,j. i < n2 \to j < m2 \to p21 i = true \to p22 i j = true \to +p11 (h11 i j) = true \land p12 (h11 i j) (h12 i j) = true +\land h21 (h11 i j) (h12 i j) = i \land h22 (h11 i j) (h12 i j) = j +\land h11 i j < n1 \land h12 i j < m1) \to +(\forall i,j. i < n1 \to j < m1 \to p11 i = true \to p12 i j = true \to +p21 (h21 i j) = true \land p22 (h21 i j) (h22 i j) = true +\land h11 (h21 i j) (h22 i j) = i \land h12 (h21 i j) (h22 i j) = j +\land (h21 i j) < n2 \land (h22 i j) < m2) \to +pi_p n1 p11 + (\lambda x:nat .pi_p m1 (p12 x) (\lambda y. g x y)) = +pi_p n2 p21 + (\lambda x:nat .pi_p m2 (p22 x) (\lambda y. g (h11 x y) (h12 x y))). +intros. +unfold pi_p.unfold pi_p. +apply (iter_p_gen_2_eq ? ? ? sym_times assoc_times ? ? ? ? h21 h22) + [intros.apply sym_eq.apply times_n_SO. + |assumption + |assumption + ] +qed. + +theorem pi_p_pi_p1: +\forall g: nat \to nat \to nat. +\forall n,m. +\forall p11,p21:nat \to bool. +\forall p12,p22:nat \to nat \to bool. +(\forall x,y. x < n \to y < m \to + (p11 x \land p12 x y) = (p21 y \land p22 y x)) \to +pi_p n p11 (\lambda x:nat.pi_p m (p12 x) (\lambda y. g x y)) = +pi_p m p21 (\lambda y:nat.pi_p n (p22 y) (\lambda x. g x y)). +intros. +unfold pi_p.unfold pi_p. +apply (iter_p_gen_iter_p_gen ? ? ? sym_times assoc_times) + [intros.apply sym_eq.apply times_n_SO. + |assumption + ] +qed. \ No newline at end of file diff --git a/matita/library/nat/plus.ma b/matita/library/nat/plus.ma new file mode 100644 index 000000000..265d20729 --- /dev/null +++ b/matita/library/nat/plus.ma @@ -0,0 +1,77 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/nat.ma". + +let rec plus n m \def + match n with + [ O \Rightarrow m + | (S p) \Rightarrow S (plus p m) ]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural plus" 'plus x y = (cic:/matita/nat/plus/plus.con x y). + +theorem plus_n_O: \forall n:nat. n = n+O. +intros.elim n. +simplify.reflexivity. +simplify.apply eq_f.assumption. +qed. + +theorem plus_n_Sm : \forall n,m:nat. S (n+m) = n+(S m). +intros.elim n. +simplify.reflexivity. +simplify.apply eq_f.assumption. +qed. + +theorem plus_n_SO : \forall n:nat. S n = n+(S O). +intro.rewrite > plus_n_O. +apply plus_n_Sm. +qed. + +theorem sym_plus: \forall n,m:nat. n+m = m+n. +intros.elim n. +simplify.apply plus_n_O. +simplify.rewrite > H.apply plus_n_Sm. +qed. + +theorem associative_plus : associative nat plus. +unfold associative.intros.elim x. +simplify.reflexivity. +simplify.apply eq_f.assumption. +qed. + +theorem assoc_plus : \forall n,m,p:nat. (n+m)+p = n+(m+p) +\def associative_plus. + +theorem injective_plus_r: \forall n:nat.injective nat nat (\lambda m.n+m). +intro.simplify.intros 2.elim n. +exact H. +apply H.apply inj_S.apply H1. +qed. + +theorem inj_plus_r: \forall p,n,m:nat. p+n = p+m \to n=m +\def injective_plus_r. + +theorem injective_plus_l: \forall m:nat.injective nat nat (\lambda n.n+m). +intro.simplify.intros. +apply (injective_plus_r m). +rewrite < sym_plus. +rewrite < (sym_plus y). +assumption. +qed. + +theorem inj_plus_l: \forall p,n,m:nat. n+p = m+p \to n=m +\def injective_plus_l. diff --git a/matita/library/nat/primes.ma b/matita/library/nat/primes.ma new file mode 100644 index 000000000..540654c41 --- /dev/null +++ b/matita/library/nat/primes.ma @@ -0,0 +1,784 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/div_and_mod.ma". +include "nat/minimization.ma". +include "nat/sigma_and_pi.ma". +include "nat/factorial.ma". + +inductive divides (n,m:nat) : Prop \def +witness : \forall p:nat.m = times n p \to divides n m. + +interpretation "divides" 'divides n m = (cic:/matita/nat/primes/divides.ind#xpointer(1/1) n m). +interpretation "not divides" 'ndivides n m = + (cic:/matita/logic/connectives/Not.con (cic:/matita/nat/primes/divides.ind#xpointer(1/1) n m)). + +theorem reflexive_divides : reflexive nat divides. +unfold reflexive. +intros. +exact (witness x x (S O) (times_n_SO x)). +qed. + +theorem divides_to_div_mod_spec : +\forall n,m. O < n \to n \divides m \to div_mod_spec m n (m / n) O. +intros.elim H1.rewrite > H2. +constructor 1.assumption. +apply (lt_O_n_elim n H).intros. +rewrite < plus_n_O. +rewrite > div_times.apply sym_times. +qed. + +theorem div_mod_spec_to_divides : +\forall n,m,p. div_mod_spec m n p O \to n \divides m. +intros.elim H. +apply (witness n m p). +rewrite < sym_times. +rewrite > (plus_n_O (p*n)).assumption. +qed. + +theorem divides_to_mod_O: +\forall n,m. O < n \to n \divides m \to (m \mod n) = O. +intros.apply (div_mod_spec_to_eq2 m n (m / n) (m \mod n) (m / n) O). +apply div_mod_spec_div_mod.assumption. +apply divides_to_div_mod_spec.assumption.assumption. +qed. + +theorem mod_O_to_divides: +\forall n,m. O< n \to (m \mod n) = O \to n \divides m. +intros. +apply (witness n m (m / n)). +rewrite > (plus_n_O (n * (m / n))). +rewrite < H1. +rewrite < sym_times. +(* Andrea: perche' hint non lo trova ?*) +apply div_mod. +assumption. +qed. + +theorem divides_n_O: \forall n:nat. n \divides O. +intro. apply (witness n O O).apply times_n_O. +qed. + +theorem divides_n_n: \forall n:nat. n \divides n. +intro. apply (witness n n (S O)).apply times_n_SO. +qed. + +theorem divides_SO_n: \forall n:nat. (S O) \divides n. +intro. apply (witness (S O) n n). simplify.apply plus_n_O. +qed. + +theorem divides_plus: \forall n,p,q:nat. +n \divides p \to n \divides q \to n \divides p+q. +intros. +elim H.elim H1. apply (witness n (p+q) (n2+n1)). +rewrite > H2.rewrite > H3.apply sym_eq.apply distr_times_plus. +qed. + +theorem divides_minus: \forall n,p,q:nat. +divides n p \to divides n q \to divides n (p-q). +intros. +elim H.elim H1. apply (witness n (p-q) (n2-n1)). +rewrite > H2.rewrite > H3.apply sym_eq.apply distr_times_minus. +qed. + +theorem divides_times: \forall n,m,p,q:nat. +n \divides p \to m \divides q \to n*m \divides p*q. +intros. +elim H.elim H1. apply (witness (n*m) (p*q) (n2*n1)). +rewrite > H2.rewrite > H3. +apply (trans_eq nat ? (n*(m*(n2*n1)))). +apply (trans_eq nat ? (n*(n2*(m*n1)))). +apply assoc_times. +apply eq_f. +apply (trans_eq nat ? ((n2*m)*n1)). +apply sym_eq. apply assoc_times. +rewrite > (sym_times n2 m).apply assoc_times. +apply sym_eq. apply assoc_times. +qed. + +theorem transitive_divides: transitive ? divides. +unfold. +intros. +elim H.elim H1. apply (witness x z (n2*n)). +rewrite > H3.rewrite > H2. +apply assoc_times. +qed. + +variant trans_divides: \forall n,m,p. + n \divides m \to m \divides p \to n \divides p \def transitive_divides. + +theorem eq_mod_to_divides:\forall n,m,p. O< p \to +mod n p = mod m p \to divides p (n-m). +intros. +cut (n \le m \or \not n \le m). +elim Hcut. +cut (n-m=O). +rewrite > Hcut1. +apply (witness p O O). +apply times_n_O. +apply eq_minus_n_m_O. +assumption. +apply (witness p (n-m) ((div n p)-(div m p))). +rewrite > distr_times_minus. +rewrite > sym_times. +rewrite > (sym_times p). +cut ((div n p)*p = n - (mod n p)). +rewrite > Hcut1. +rewrite > eq_minus_minus_minus_plus. +rewrite > sym_plus. +rewrite > H1. +rewrite < div_mod.reflexivity. +assumption. +apply sym_eq. +apply plus_to_minus. +rewrite > sym_plus. +apply div_mod. +assumption. +apply (decidable_le n m). +qed. + +theorem antisymmetric_divides: antisymmetric nat divides. +unfold antisymmetric.intros.elim H. elim H1. +apply (nat_case1 n2).intro. +rewrite > H3.rewrite > H2.rewrite > H4. +rewrite < times_n_O.reflexivity. +intros. +apply (nat_case1 n).intro. +rewrite > H2.rewrite > H3.rewrite > H5. +rewrite < times_n_O.reflexivity. +intros. +apply antisymmetric_le. +rewrite > H2.rewrite > times_n_SO in \vdash (? % ?). +apply le_times_r.rewrite > H4.apply le_S_S.apply le_O_n. +rewrite > H3.rewrite > times_n_SO in \vdash (? % ?). +apply le_times_r.rewrite > H5.apply le_S_S.apply le_O_n. +qed. + +(* divides le *) +theorem divides_to_le : \forall n,m. O < m \to n \divides m \to n \le m. +intros. elim H1.rewrite > H2.cut (O < n2). +apply (lt_O_n_elim n2 Hcut).intro.rewrite < sym_times. +simplify.rewrite < sym_plus. +apply le_plus_n. +elim (le_to_or_lt_eq O n2). +assumption. +absurd (O H2.rewrite < H3.rewrite < times_n_O. +apply (not_le_Sn_n O). +apply le_O_n. +qed. + +theorem divides_to_lt_O : \forall n,m. O < m \to n \divides m \to O < n. +intros.elim H1. +elim (le_to_or_lt_eq O n (le_O_n n)). +assumption. +rewrite < H3.absurd (O < m).assumption. +rewrite > H2.rewrite < H3. +simplify.exact (not_le_Sn_n O). +qed. + +(*a variant of or_div_mod *) +theorem or_div_mod1: \forall n,q. O < q \to +(divides q (S n)) \land S n = (S (div n q)) * q \lor +(\lnot (divides q (S n)) \land S n= (div n q) * q + S (n\mod q)). +intros.elim (or_div_mod n q H);elim H1 + [left.split + [apply (witness ? ? (S (n/q))). + rewrite > sym_times.assumption + |assumption + ] + |right.split + [intro. + apply (not_eq_O_S (n \mod q)). + (* come faccio a fare unfold nelleipotesi ? *) + cut ((S n) \mod q = O) + [rewrite < Hcut. + apply (div_mod_spec_to_eq2 (S n) q (div (S n) q) (mod (S n) q) (div n q) (S (mod n q))) + [apply div_mod_spec_div_mod. + assumption + |apply div_mod_spec_intro;assumption + ] + |apply divides_to_mod_O;assumption + ] + |assumption + ] + ] +qed. + +theorem divides_to_div: \forall n,m.divides n m \to m/n*n = m. +intro. +elim (le_to_or_lt_eq O n (le_O_n n)) + [rewrite > plus_n_O. + rewrite < (divides_to_mod_O ? ? H H1). + apply sym_eq. + apply div_mod. + assumption + |elim H1. + generalize in match H2. + rewrite < H. + simplify. + intro. + rewrite > H3. + reflexivity + ] +qed. + +theorem divides_div: \forall d,n. divides d n \to divides (n/d) n. +intros. +apply (witness ? ? d). +apply sym_eq. +apply divides_to_div. +assumption. +qed. + +theorem div_div: \forall n,d:nat. O < n \to divides d n \to +n/(n/d) = d. +intros. +apply (inj_times_l1 (n/d)) + [apply (lt_times_n_to_lt d) + [apply (divides_to_lt_O ? ? H H1). + |rewrite > divides_to_div;assumption + ] + |rewrite > divides_to_div + [rewrite > sym_times. + rewrite > divides_to_div + [reflexivity + |assumption + ] + |apply (witness ? ? d). + apply sym_eq. + apply divides_to_div. + assumption + ] + ] +qed. + +theorem divides_to_eq_times_div_div_times: \forall a,b,c:nat. +O \lt b \to c \divides b \to a * (b /c) = (a*b)/c. +intros. +elim H1. +rewrite > H2. +rewrite > (sym_times c n2). +cut(O \lt c) +[ rewrite > (lt_O_to_div_times n2 c) + [ rewrite < assoc_times. + rewrite > (lt_O_to_div_times (a *n2) c) + [ reflexivity + | assumption + ] + | assumption + ] +| apply (divides_to_lt_O c b); + assumption. +] +qed. + +theorem eq_div_plus: \forall n,m,d. O < d \to +divides d n \to divides d m \to +(n + m ) / d = n/d + m/d. +intros. +elim H1. +elim H2. +rewrite > H3.rewrite > H4. +rewrite < distr_times_plus. +rewrite > sym_times. +rewrite > sym_times in ⊢ (? ? ? (? (? % ?) ?)). +rewrite > sym_times in ⊢ (? ? ? (? ? (? % ?))). +rewrite > lt_O_to_div_times + [rewrite > lt_O_to_div_times + [rewrite > lt_O_to_div_times + [reflexivity + |assumption + ] + |assumption + ] + |assumption + ] +qed. + +(* boolean divides *) +definition divides_b : nat \to nat \to bool \def +\lambda n,m :nat. (eqb (m \mod n) O). + +theorem divides_b_to_Prop : +\forall n,m:nat. O < n \to +match divides_b n m with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m]. +intros.unfold divides_b. +apply eqb_elim. +intro.simplify.apply mod_O_to_divides.assumption.assumption. +intro.simplify.unfold Not.intro.apply H1.apply divides_to_mod_O.assumption.assumption. +qed. + +theorem divides_b_true_to_divides1: +\forall n,m:nat. O < n \to +(divides_b n m = true ) \to n \divides m. +intros. +change with +match true with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m]. +rewrite < H1.apply divides_b_to_Prop. +assumption. +qed. + +theorem divides_b_true_to_divides: +\forall n,m:nat. divides_b n m = true \to n \divides m. +intros 2.apply (nat_case n) + [apply (nat_case m) + [intro.apply divides_n_n + |simplify.intros.apply False_ind. + apply not_eq_true_false.apply sym_eq. + assumption + ] + |intros. + apply divides_b_true_to_divides1 + [apply lt_O_S|assumption] + ] +qed. + +theorem divides_b_false_to_not_divides1: +\forall n,m:nat. O < n \to +(divides_b n m = false ) \to n \ndivides m. +intros. +change with +match false with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m]. +rewrite < H1.apply divides_b_to_Prop. +assumption. +qed. + +theorem divides_b_false_to_not_divides: +\forall n,m:nat. divides_b n m = false \to n \ndivides m. +intros 2.apply (nat_case n) + [apply (nat_case m) + [simplify.unfold Not.intros. + apply not_eq_true_false.assumption + |unfold Not.intros.elim H1. + apply (not_eq_O_S m1).apply sym_eq. + assumption + ] + |intros. + apply divides_b_false_to_not_divides1 + [apply lt_O_S|assumption] + ] +qed. + +theorem decidable_divides: \forall n,m:nat.O < n \to +decidable (n \divides m). +intros.unfold decidable. +cut +(match divides_b n m with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m] \to n \divides m \lor n \ndivides m). +apply Hcut.apply divides_b_to_Prop.assumption. +elim (divides_b n m).left.apply H1.right.apply H1. +qed. + +theorem divides_to_divides_b_true : \forall n,m:nat. O < n \to +n \divides m \to divides_b n m = true. +intros. +cut (match (divides_b n m) with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m] \to ((divides_b n m) = true)). +apply Hcut.apply divides_b_to_Prop.assumption. +elim (divides_b n m).reflexivity. +absurd (n \divides m).assumption.assumption. +qed. + +theorem divides_to_divides_b_true1 : \forall n,m:nat. +O < m \to n \divides m \to divides_b n m = true. +intro. +elim (le_to_or_lt_eq O n (le_O_n n)) + [apply divides_to_divides_b_true + [assumption|assumption] + |apply False_ind. + rewrite < H in H2. + elim H2. + simplify in H3. + apply (not_le_Sn_O O). + rewrite > H3 in H1. + assumption + ] +qed. + +theorem not_divides_to_divides_b_false: \forall n,m:nat. O < n \to +\lnot(n \divides m) \to (divides_b n m) = false. +intros. +cut (match (divides_b n m) with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m] \to ((divides_b n m) = false)). +apply Hcut.apply divides_b_to_Prop.assumption. +elim (divides_b n m). +absurd (n \divides m).assumption.assumption. +reflexivity. +qed. + +theorem divides_b_div_true: +\forall d,n. O < n \to + divides_b d n = true \to divides_b (n/d) n = true. +intros. +apply divides_to_divides_b_true1 + [assumption + |apply divides_div. + apply divides_b_true_to_divides. + assumption + ] +qed. + +theorem divides_b_true_to_lt_O: \forall n,m. O < n \to divides_b m n = true \to O < m. +intros. +elim (le_to_or_lt_eq ? ? (le_O_n m)) + [assumption + |apply False_ind. + elim H1. + rewrite < H2 in H1. + simplify in H1. + apply (lt_to_not_eq O n H). + apply sym_eq. + apply eqb_true_to_eq. + assumption + ] +qed. + +(* divides and pi *) +theorem divides_f_pi_f : \forall f:nat \to nat.\forall n,m,i:nat. +m \le i \to i \le n+m \to f i \divides pi n f m. +intros 5.elim n.simplify. +cut (i = m).rewrite < Hcut.apply divides_n_n. +apply antisymmetric_le.assumption.assumption. +simplify. +cut (i < S n1+m \lor i = S n1 + m). +elim Hcut. +apply (transitive_divides ? (pi n1 f m)). +apply H1.apply le_S_S_to_le. assumption. +apply (witness ? ? (f (S n1+m))).apply sym_times. +rewrite > H3. +apply (witness ? ? (pi n1 f m)).reflexivity. +apply le_to_or_lt_eq.assumption. +qed. + +(* +theorem mod_S_pi: \forall f:nat \to nat.\forall n,i:nat. +i < n \to (S O) < (f i) \to (S (pi n f)) \mod (f i) = (S O). +intros.cut (pi n f) \mod (f i) = O. +rewrite < Hcut. +apply mod_S.apply trans_lt O (S O).apply le_n (S O).assumption. +rewrite > Hcut.assumption. +apply divides_to_mod_O.apply trans_lt O (S O).apply le_n (S O).assumption. +apply divides_f_pi_f.assumption. +qed. +*) + +(* divides and fact *) +theorem divides_fact : \forall n,i:nat. +O < i \to i \le n \to i \divides n!. +intros 3.elim n.absurd (O H3. +apply (witness ? ? n1!).reflexivity. +qed. + +theorem mod_S_fact: \forall n,i:nat. +(S O) < i \to i \le n \to (S n!) \mod i = (S O). +intros.cut (n! \mod i = O). +rewrite < Hcut. +apply mod_S.apply (trans_lt O (S O)).apply (le_n (S O)).assumption. +rewrite > Hcut.assumption. +apply divides_to_mod_O.apply (trans_lt O (S O)).apply (le_n (S O)).assumption. +apply divides_fact.apply (trans_lt O (S O)).apply (le_n (S O)).assumption. +assumption. +qed. + +theorem not_divides_S_fact: \forall n,i:nat. +(S O) < i \to i \le n \to i \ndivides S n!. +intros. +apply divides_b_false_to_not_divides. +unfold divides_b. +rewrite > mod_S_fact[simplify.reflexivity|assumption|assumption]. +qed. + +(* prime *) +definition prime : nat \to Prop \def +\lambda n:nat. (S O) < n \land +(\forall m:nat. m \divides n \to (S O) < m \to m = n). + +theorem not_prime_O: \lnot (prime O). +unfold Not.unfold prime.intro.elim H.apply (not_le_Sn_O (S O) H1). +qed. + +theorem not_prime_SO: \lnot (prime (S O)). +unfold Not.unfold prime.intro.elim H.apply (not_le_Sn_n (S O) H1). +qed. + +theorem prime_to_lt_O: \forall p. prime p \to O < p. +intros.elim H.apply lt_to_le.assumption. +qed. + +theorem prime_to_lt_SO: \forall p. prime p \to S O < p. +intros.elim H. +assumption. +qed. + +(* smallest factor *) +definition smallest_factor : nat \to nat \def +\lambda n:nat. +match n with +[ O \Rightarrow O +| (S p) \Rightarrow + match p with + [ O \Rightarrow (S O) + | (S q) \Rightarrow min_aux q (S (S O)) (\lambda m.(eqb ((S(S q)) \mod m) O))]]. + +(* it works ! +theorem example1 : smallest_factor (S(S(S O))) = (S(S(S O))). +normalize.reflexivity. +qed. + +theorem example2: smallest_factor (S(S(S(S O)))) = (S(S O)). +normalize.reflexivity. +qed. + +theorem example3 : smallest_factor (S(S(S(S(S(S(S O))))))) = (S(S(S(S(S(S(S O))))))). +simplify.reflexivity. +qed. *) + +theorem lt_SO_smallest_factor: +\forall n:nat. (S O) < n \to (S O) < (smallest_factor n). +intro. +apply (nat_case n).intro.apply False_ind.apply (not_le_Sn_O (S O) H). +intro.apply (nat_case m).intro. apply False_ind.apply (not_le_Sn_n (S O) H). +intros. +change with +(S O < min_aux m1 (S (S O)) (\lambda m.(eqb ((S(S m1)) \mod m) O))). +apply (lt_to_le_to_lt ? (S (S O))). +apply (le_n (S(S O))). +cut ((S(S O)) = (S(S m1)) - m1). +rewrite > Hcut. +apply le_min_aux. +apply sym_eq.apply plus_to_minus. +rewrite < sym_plus.simplify.reflexivity. +qed. + +theorem lt_O_smallest_factor: \forall n:nat. O < n \to O < (smallest_factor n). +intro. +apply (nat_case n).intro.apply False_ind.apply (not_le_Sn_n O H). +intro.apply (nat_case m).intro. +simplify.unfold lt.apply le_n. +intros.apply (trans_lt ? (S O)). +unfold lt.apply le_n. +apply lt_SO_smallest_factor.unfold lt. apply le_S_S. +apply le_S_S.apply le_O_n. +qed. + +theorem divides_smallest_factor_n : +\forall n:nat. O < n \to smallest_factor n \divides n. +intro. +apply (nat_case n).intro.apply False_ind.apply (not_le_Sn_O O H). +intro.apply (nat_case m).intro. simplify. +apply (witness ? ? (S O)). simplify.reflexivity. +intros. +apply divides_b_true_to_divides. +change with +(eqb ((S(S m1)) \mod (min_aux m1 (S (S O)) + (\lambda m.(eqb ((S(S m1)) \mod m) O)))) O = true). +apply f_min_aux_true. +apply (ex_intro nat ? (S(S m1))). +split.split. +apply (le_S_S_to_le (S (S O)) (S (S m1)) ?). +apply (minus_le_O_to_le (S (S (S O))) (S (S (S m1))) ?). +apply (le_n O). +rewrite < sym_plus. simplify. apply le_n. +apply (eq_to_eqb_true (mod (S (S m1)) (S (S m1))) O ?). +apply (mod_n_n (S (S m1)) ?). +apply (H). +qed. + +theorem le_smallest_factor_n : +\forall n:nat. smallest_factor n \le n. +intro.apply (nat_case n).simplify.apply le_n. +intro.apply (nat_case m).simplify.apply le_n. +intro.apply divides_to_le. +unfold lt.apply le_S_S.apply le_O_n. +apply divides_smallest_factor_n. +unfold lt.apply le_S_S.apply le_O_n. +qed. + +theorem lt_smallest_factor_to_not_divides: \forall n,i:nat. +(S O) < n \to (S O) < i \to i < (smallest_factor n) \to i \ndivides n. +intros 2. +apply (nat_case n).intro.apply False_ind.apply (not_le_Sn_O (S O) H). +intro.apply (nat_case m).intro. apply False_ind.apply (not_le_Sn_n (S O) H). +intros. +apply divides_b_false_to_not_divides. +apply (lt_min_aux_to_false +(\lambda i:nat.eqb ((S(S m1)) \mod i) O) (S (S O)) m1 i). +assumption. +assumption. +qed. + +theorem prime_smallest_factor_n : +\forall n:nat. (S O) < n \to prime (smallest_factor n). +intro.change with ((S(S O)) \le n \to (S O) < (smallest_factor n) \land +(\forall m:nat. m \divides smallest_factor n \to (S O) < m \to m = (smallest_factor n))). +intro.split. +apply lt_SO_smallest_factor.assumption. +intros. +cut (le m (smallest_factor n)). +elim (le_to_or_lt_eq m (smallest_factor n) Hcut). +absurd (m \divides n). +apply (transitive_divides m (smallest_factor n)). +assumption. +apply divides_smallest_factor_n. +apply (trans_lt ? (S O)). unfold lt. apply le_n. exact H. +apply lt_smallest_factor_to_not_divides. +exact H.assumption.assumption.assumption. +apply divides_to_le. +apply (trans_lt O (S O)). +apply (le_n (S O)). +apply lt_SO_smallest_factor. +exact H. +assumption. +qed. + +theorem prime_to_smallest_factor: \forall n. prime n \to +smallest_factor n = n. +intro.apply (nat_case n).intro.apply False_ind.apply (not_prime_O H). +intro.apply (nat_case m).intro.apply False_ind.apply (not_prime_SO H). +intro. +change with +((S O) < (S(S m1)) \land +(\forall m:nat. m \divides S(S m1) \to (S O) < m \to m = (S(S m1))) \to +smallest_factor (S(S m1)) = (S(S m1))). +intro.elim H.apply H2. +apply divides_smallest_factor_n. +apply (trans_lt ? (S O)).unfold lt. apply le_n.assumption. +apply lt_SO_smallest_factor. +assumption. +qed. + +(* a number n > O is prime iff its smallest factor is n *) +definition primeb \def \lambda n:nat. +match n with +[ O \Rightarrow false +| (S p) \Rightarrow + match p with + [ O \Rightarrow false + | (S q) \Rightarrow eqb (smallest_factor (S(S q))) (S(S q))]]. + +(* it works! +theorem example4 : primeb (S(S(S O))) = true. +normalize.reflexivity. +qed. + +theorem example5 : primeb (S(S(S(S(S(S O)))))) = false. +normalize.reflexivity. +qed. + +theorem example6 : primeb (S(S(S(S((S(S(S(S(S(S(S O)))))))))))) = true. +normalize.reflexivity. +qed. + +theorem example7 : primeb (S(S(S(S(S(S((S(S(S(S((S(S(S(S(S(S(S O))))))))))))))))))) = true. +normalize.reflexivity. +qed. *) + +theorem primeb_to_Prop: \forall n. +match primeb n with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)]. +intro. +apply (nat_case n).simplify.unfold Not.unfold prime.intro.elim H.apply (not_le_Sn_O (S O) H1). +intro.apply (nat_case m).simplify.unfold Not.unfold prime.intro.elim H.apply (not_le_Sn_n (S O) H1). +intro. +change with +match eqb (smallest_factor (S(S m1))) (S(S m1)) with +[ true \Rightarrow prime (S(S m1)) +| false \Rightarrow \lnot (prime (S(S m1)))]. +apply (eqb_elim (smallest_factor (S(S m1))) (S(S m1))). +intro.simplify. +rewrite < H. +apply prime_smallest_factor_n. +unfold lt.apply le_S_S.apply le_S_S.apply le_O_n. +intro.simplify. +change with (prime (S(S m1)) \to False). +intro.apply H. +apply prime_to_smallest_factor. +assumption. +qed. + +theorem primeb_true_to_prime : \forall n:nat. +primeb n = true \to prime n. +intros.change with +match true with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)]. +rewrite < H. +apply primeb_to_Prop. +qed. + +theorem primeb_false_to_not_prime : \forall n:nat. +primeb n = false \to \lnot (prime n). +intros.change with +match false with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)]. +rewrite < H. +apply primeb_to_Prop. +qed. + +theorem decidable_prime : \forall n:nat.decidable (prime n). +intro.unfold decidable. +cut +(match primeb n with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)] \to (prime n) \lor \lnot (prime n)). +apply Hcut.apply primeb_to_Prop. +elim (primeb n).left.apply H.right.apply H. +qed. + +theorem prime_to_primeb_true: \forall n:nat. +prime n \to primeb n = true. +intros. +cut (match (primeb n) with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)] \to ((primeb n) = true)). +apply Hcut.apply primeb_to_Prop. +elim (primeb n).reflexivity. +absurd (prime n).assumption.assumption. +qed. + +theorem not_prime_to_primeb_false: \forall n:nat. +\lnot(prime n) \to primeb n = false. +intros. +cut (match (primeb n) with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)] \to ((primeb n) = false)). +apply Hcut.apply primeb_to_Prop. +elim (primeb n). +absurd (prime n).assumption.assumption. +reflexivity. +qed. + diff --git a/matita/library/nat/relevant_equations.ma b/matita/library/nat/relevant_equations.ma new file mode 100644 index 000000000..5a64fbac6 --- /dev/null +++ b/matita/library/nat/relevant_equations.ma @@ -0,0 +1,62 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/times.ma". +include "nat/minus.ma". +include "nat/gcd.ma". +(* if gcd is compiled before this, the applys will take too much *) + +theorem times_plus_l: \forall n,m,p:nat. (n+m)*p = n*p + m*p. +intros. +apply (trans_eq ? ? (p*(n+m))). +apply sym_times. +apply (trans_eq ? ? (p*n+p*m)). +apply distr_times_plus. +apply eq_f2. +apply sym_times. +apply sym_times. +qed. + +theorem times_minus_l: \forall n,m,p:nat. (n-m)*p = n*p - m*p. +intros. +apply (trans_eq ? ? (p*(n-m))). +apply sym_times. +apply (trans_eq ? ? (p*n-p*m)). +apply distr_times_minus. +apply eq_f2. +apply sym_times. +apply sym_times. +qed. + +theorem times_plus_plus: \forall n,m,p,q:nat. (n + m)*(p + q) = +n*p + n*q + m*p + m*q. +intros. +apply (trans_eq nat ? ((n*(p+q) + m*(p+q)))). +apply times_plus_l. +rewrite > distr_times_plus. +rewrite > distr_times_plus. +rewrite < assoc_plus.reflexivity. +qed. + +theorem eq_pred_to_eq: + ∀n,m. O < n → O < m → pred n = pred m → n = m. +intros; +generalize in match (eq_f ? ? S ? ? H2); +intro; +rewrite < S_pred in H3; +rewrite < S_pred in H3; +assumption. +qed. diff --git a/matita/library/nat/sigma_and_pi.ma b/matita/library/nat/sigma_and_pi.ma new file mode 100644 index 000000000..dc4cfed60 --- /dev/null +++ b/matita/library/nat/sigma_and_pi.ma @@ -0,0 +1,79 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/factorial.ma". +include "nat/exp.ma". +include "nat/lt_arith.ma". + +let rec sigma n f m \def + match n with + [ O \Rightarrow (f m) + | (S p) \Rightarrow (f (S p+m))+(sigma p f m)]. + +let rec pi n f m \def + match n with + [ O \Rightarrow f m + | (S p) \Rightarrow (f (S p+m))*(pi p f m)]. + +theorem eq_sigma: \forall f,g:nat \to nat. +\forall n,m:nat. +(\forall i:nat. m \le i \to i \le m+n \to f i = g i) \to +(sigma n f m) = (sigma n g m). +intros 3.elim n. +simplify.apply H.apply le_n.rewrite < plus_n_O.apply le_n. +simplify. +apply eq_f2.apply H1. +change with (m \le (S n1)+m).apply le_plus_n. +rewrite > (sym_plus m).apply le_n. +apply H.intros.apply H1.assumption. +rewrite < plus_n_Sm. +apply le_S.assumption. +qed. + +theorem eq_pi: \forall f,g:nat \to nat. +\forall n,m:nat. +(\forall i:nat. m \le i \to i \le m+n \to f i = g i) \to +(pi n f m) = (pi n g m). +intros 3.elim n. +simplify.apply H.apply le_n.rewrite < plus_n_O.apply le_n. +simplify. +apply eq_f2.apply H1. +change with (m \le (S n1)+m).apply le_plus_n. +rewrite > (sym_plus m).apply le_n. +apply H.intros.apply H1.assumption. +rewrite < plus_n_Sm. +apply le_S.assumption. +qed. + +theorem eq_fact_pi: \forall n. (S n)! = pi n (\lambda m.m) (S O). +intro.elim n. +simplify.reflexivity. +change with ((S(S n1))*(S n1)! = ((S n1)+(S O))*(pi n1 (\lambda m.m) (S O))). +rewrite < plus_n_Sm.rewrite < plus_n_O. +apply eq_f.assumption. +qed. + +theorem exp_pi_l: \forall f:nat\to nat.\forall n,m,a:nat. +(exp a (S n))*pi n f m= pi n (\lambda p.a*(f p)) m. +intros.elim n.simplify.rewrite < times_n_SO.reflexivity. +simplify. +rewrite < H. +rewrite > assoc_times. +rewrite > assoc_times in\vdash (? ? ? %). +apply eq_f.rewrite < assoc_times. +rewrite < assoc_times. +apply eq_f2.apply sym_times.reflexivity. +qed. diff --git a/matita/library/nat/times.ma b/matita/library/nat/times.ma new file mode 100644 index 000000000..df5c08871 --- /dev/null +++ b/matita/library/nat/times.ma @@ -0,0 +1,104 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/plus.ma". + +let rec times n m \def + match n with + [ O \Rightarrow O + | (S p) \Rightarrow m+(times p m) ]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural times" 'times x y = (cic:/matita/nat/times/times.con x y). + +theorem times_n_O: \forall n:nat. O = n*O. +intros.elim n. +simplify.reflexivity. +simplify.assumption. +qed. + +theorem times_n_Sm : +\forall n,m:nat. n+(n*m) = n*(S m). +intros.elim n. +simplify.reflexivity. +simplify.apply eq_f.rewrite < H. +transitivity ((n1+m)+n1*m).symmetry.apply assoc_plus. +transitivity ((m+n1)+n1*m). +apply eq_f2. +apply sym_plus. +reflexivity. +apply assoc_plus. +qed. + +theorem times_O_to_O: \forall n,m:nat.n*m = O \to n = O \lor m= O. +apply nat_elim2;intros + [left.reflexivity + |right.reflexivity + |apply False_ind. + simplify in H1. + apply (not_eq_O_S ? (sym_eq ? ? ? H1)) + ] +qed. + +theorem times_n_SO : \forall n:nat. n = n * S O. +intros. +rewrite < times_n_Sm. +rewrite < times_n_O. +rewrite < plus_n_O. +reflexivity. +qed. + +theorem times_SSO_n : \forall n:nat. n + n = S (S O) * n. +intros. +simplify. +rewrite < plus_n_O. +reflexivity. +qed. + +theorem symmetric_times : symmetric nat times. +unfold symmetric. +intros.elim x. +simplify.apply times_n_O. +simplify.rewrite > H.apply times_n_Sm. +qed. + +variant sym_times : \forall n,m:nat. n*m = m*n \def +symmetric_times. + +theorem distributive_times_plus : distributive nat times plus. +unfold distributive. +intros.elim x. +simplify.reflexivity. +simplify.rewrite > H. rewrite > assoc_plus.rewrite > assoc_plus. +apply eq_f.rewrite < assoc_plus. rewrite < (sym_plus ? z). +rewrite > assoc_plus.reflexivity. +qed. + +variant distr_times_plus: \forall n,m,p:nat. n*(m+p) = n*m + n*p +\def distributive_times_plus. + +theorem associative_times: associative nat times. +unfold associative.intros. +elim x.simplify.apply refl_eq. +simplify.rewrite < sym_times. +rewrite > distr_times_plus. +rewrite < sym_times. +rewrite < (sym_times (times n y) z). +rewrite < H.apply refl_eq. +qed. + +variant assoc_times: \forall n,m,p:nat. (n*m)*p = n*(m*p) \def +associative_times. diff --git a/matita/library/nat/totient.ma b/matita/library/nat/totient.ma new file mode 100644 index 000000000..88b05173b --- /dev/null +++ b/matita/library/nat/totient.ma @@ -0,0 +1,139 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + + +include "nat/chinese_reminder.ma". +include "nat/iteration2.ma". + +(*a new definition of totient, which uses sigma_p instead of sigma *) +(*there's a little difference between this definition and the classic one: + the classic definition of totient is: + + phi (n) is the number of naturals i (less or equal than n) so then gcd (i,n) = 1. + (so this definition considers the values i=1,2,...,n) + + sigma_p doesn't work on the value n (but the first value it works on is (pred n)) + but works also on 0. That's not a problem, in fact + - if n <> 1, gcd (n,0) <>1 and gcd (n,n) = n <> 1. + - if n = 1, then Phi(n) = 1, and (totient n), as defined below, returns 1. + + *) +definition totient : nat \to nat \def +\lambda n.sigma_p n (\lambda m. eqb (gcd m n) (S O)) (\lambda m.S O). + +lemma totient1: totient (S(S(S(S(S(S O)))))) = ?. +[|simplify. + +theorem totient_times: \forall n,m:nat. (gcd m n) = (S O) \to +totient (n*m) = (totient n)*(totient m). +intros. +unfold totient. +apply (nat_case1 n) +[ apply (nat_case1 m) + [ intros. + simplify. + reflexivity + | intros. + simplify. + reflexivity + ] +| apply (nat_case1 m) + [ intros. + change in \vdash (? ? ? (? ? %)) with (O). + rewrite > (sym_times (S m1) O). + rewrite > sym_times in \vdash (? ? ? %). + simplify. + reflexivity + | intros. + rewrite > H2 in H. + rewrite > H1 in H. + apply (sigma_p_times m2 m1 ? ? ? + (\lambda b,a. cr_pair (S m2) (S m1) a b) + (\lambda x. x \mod (S m2)) (\lambda x. x \mod (S m1))) + [intros.unfold cr_pair. + apply (le_to_lt_to_lt ? (pred ((S m2)*(S m1)))) + [unfold min. + apply transitive_le; + [2: apply le_min_aux_r | skip | apply le_n] + |unfold lt. + apply (nat_case ((S m2)*(S m1))) + [apply le_n|intro.apply le_n] + ] + |intros. + generalize in match (mod_cr_pair (S m2) (S m1) a b H3 H4 H). + intro.elim H5. + apply H6 + |intros. + generalize in match (mod_cr_pair (S m2) (S m1) a b H3 H4 H). + intro.elim H5. + apply H7 + |intros. + generalize in match (mod_cr_pair (S m2) (S m1) a b H3 H4 H). + intro.elim H5. + apply eqb_elim + [intro. + rewrite > eq_to_eqb_true + [rewrite > eq_to_eqb_true + [reflexivity + |rewrite < H6. + rewrite > sym_gcd. + rewrite > gcd_mod + [apply (gcd_times_SO_to_gcd_SO ? ? (S m1)) + [unfold lt.apply le_S_S.apply le_O_n + |unfold lt.apply le_S_S.apply le_O_n + |assumption + ] + |unfold lt.apply le_S_S.apply le_O_n + ] + ] + |rewrite < H7. + rewrite > sym_gcd. + rewrite > gcd_mod + [apply (gcd_times_SO_to_gcd_SO ? ? (S m2)) + [unfold lt.apply le_S_S.apply le_O_n + |unfold lt.apply le_S_S.apply le_O_n + |rewrite > sym_times.assumption + ] + |unfold lt.apply le_S_S.apply le_O_n + ] + ] + |intro. + apply eqb_elim + [intro.apply eqb_elim + [intro.apply False_ind. + apply H8. + apply eq_gcd_times_SO + [unfold lt.apply le_S_S.apply le_O_n. + |unfold lt.apply le_S_S.apply le_O_n. + |rewrite < gcd_mod + [rewrite > H6. + rewrite > sym_gcd.assumption + |unfold lt.apply le_S_S.apply le_O_n + ] + |rewrite < gcd_mod + [rewrite > H7. + rewrite > sym_gcd.assumption + |unfold lt.apply le_S_S.apply le_O_n + ] + ] + |intro.reflexivity + ] + |intro.reflexivity + ] + ] + ] + ] + ] +qed. diff --git a/matita/library/nat/totient1.ma b/matita/library/nat/totient1.ma new file mode 100644 index 000000000..2883af06c --- /dev/null +++ b/matita/library/nat/totient1.ma @@ -0,0 +1,243 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + + + +include "nat/totient.ma". +include "nat/iteration2.ma". +include "nat/gcd_properties1.ma". + +(* This file contains the proof of the following theorem about Euler's totient + * function: + + The sum of the applications of Phi function over the divisor of a natural + number n is equal to n + *) + +(*simple auxiliary properties*) +theorem lt_O_to_divides_to_lt_O_div: +\forall a,b:nat. +O \lt b \to a \divides b \to O \lt (b/a). +intros. +apply (O_lt_times_to_O_lt ? a). +rewrite > (divides_to_div a b); + assumption. +qed. + +(*tha main theorem*) +theorem sigma_p_Sn_divides_b_totient_n: \forall n. O \lt n \to sigma_p (S n) (\lambda d.divides_b d n) totient = n. +intros. +unfold totient. +apply (trans_eq ? ? +(sigma_p (S n) (\lambda d:nat.divides_b d n) +(\lambda d:nat.sigma_p (S n) (\lambda m:nat.andb (leb (S m) d) (eqb (gcd m d) (S O))) (\lambda m:nat.S O)))) +[ apply eq_sigma_p1 + [ intros. + reflexivity + | intros. + apply sym_eq. + apply (trans_eq ? ? + (sigma_p x (\lambda m:nat.leb (S m) x\land eqb (gcd m x) (S O)) (\lambda m:nat.S O))) + [ apply false_to_eq_sigma_p + [ apply lt_to_le. + assumption + | intros. + rewrite > lt_to_leb_false + [ reflexivity + | apply le_S_S. + assumption + ] + ] + | apply eq_sigma_p + [ intros. + rewrite > le_to_leb_true + [ reflexivity + | assumption + ] + | intros. + reflexivity + ] + ] + ] +| apply (trans_eq ? ? (sigma_p n (\lambda x.true) (\lambda x.S O))) + [ apply sym_eq. + apply (sigma_p_knm + (\lambda x. (S O)) + (\lambda i,j.j*(n/i)) + (\lambda p. n / (gcd p n)) + (\lambda p. p / (gcd p n)) + );intros + [ cut (O \lt (gcd x n)) + [split + [ split + [ split + [ split + [ apply divides_to_divides_b_true + [ apply (O_lt_times_to_O_lt ? (gcd x n)). + rewrite > (divides_to_div (gcd x n) n) + [ assumption + | apply (divides_gcd_m) + ] + | rewrite > sym_gcd. + apply (divides_times_to_divides_div_gcd). + apply (witness n (x * n) x). + apply (symmetric_times x n) + ] + | apply (true_to_true_to_andb_true) + [ apply (le_to_leb_true). + change with (x/(gcd x n) \lt n/(gcd x n)). + apply (lt_times_n_to_lt (gcd x n) ? ?) + [ assumption + | rewrite > (divides_to_div (gcd x n) x) + [ rewrite > (divides_to_div (gcd x n) n) + [ assumption + | apply divides_gcd_m + ] + | apply divides_gcd_n + ] + ] + | apply cic:/matita/nat/compare/eq_to_eqb_true.con. + rewrite > (eq_gcd_div_div_div_gcd x n (gcd x n)) + [ apply (div_n_n (gcd x n) Hcut) + | assumption + | apply divides_gcd_n + | apply divides_gcd_m + ] + ] + ] + | apply (inj_times_l1 (n/(gcd x n))) + [ apply lt_O_to_divides_to_lt_O_div + [ assumption + | apply divides_gcd_m + ] + | rewrite > associative_times. + rewrite > (divides_to_div (n/(gcd x n)) n) + [ rewrite > sym_times. + rewrite > (divides_to_eq_times_div_div_times x) + [ apply (inj_times_l1 (gcd x n) Hcut). + rewrite > (divides_to_div (gcd x n) (x * n)) + [ rewrite > assoc_times. + rewrite > (divides_to_div (gcd x n) x) + [ apply sym_times + | apply divides_gcd_n + ] + | apply (trans_divides ? x) + [ apply divides_gcd_n + | apply (witness ? ? n). + reflexivity + ] + ] + | assumption + | apply divides_gcd_m + ] + | apply (witness ? ? (gcd x n)). + rewrite > divides_to_div + [ reflexivity + | apply divides_gcd_m + ] + ] + ] + ] + | apply (le_to_lt_to_lt ? n) + [ apply le_div. + assumption + | change with ((S n) \le (S n)). + apply le_n + ] + ] + | apply (le_to_lt_to_lt ? x) + [ apply le_div. + assumption + | apply (trans_lt ? n ?) + [ assumption + | change with ((S n) \le (S n)). + apply le_n + ] + ] + ] + | apply (divides_to_lt_O ? n) + [ assumption + | apply divides_gcd_m + ] + ] + | cut (i \divides n) + [ cut (j \lt i) + [ cut ((gcd j i) = (S O) ) + [ cut ((gcd (j*(n/i)) n) = n/i) + [ split + [ split + [ split + [ reflexivity + | rewrite > Hcut3. + apply (div_div); + assumption + ] + | rewrite > Hcut3. + rewrite < divides_to_eq_times_div_div_times + [ rewrite > div_n_n + [ apply sym_eq. + apply times_n_SO. + | apply lt_O_to_divides_to_lt_O_div; + assumption + ] + | apply lt_O_to_divides_to_lt_O_div; + assumption + | apply divides_n_n + ] + ] + | rewrite < (divides_to_div i n) in \vdash (? ? %) + [ rewrite > sym_times. + apply (lt_times_r1) + [ apply lt_O_to_divides_to_lt_O_div; + assumption + | assumption + ] + | assumption + ] + ] + | rewrite < (divides_to_div i n) in \vdash (? ? (? ? %) ?) + [ rewrite > (sym_times j). + rewrite > times_n_SO in \vdash (? ? ? %). + rewrite < Hcut2. + apply eq_gcd_times_times_times_gcd + | assumption + ] + ] + | apply eqb_true_to_eq. + apply (andb_true_true_r (leb (S j) i)). + assumption + ] + | change with ((S j) \le i). + cut((leb (S j) i) = true) + [ change with( + match (true) with + [ true \Rightarrow ((S j) \leq i) + | false \Rightarrow ((S j) \nleq i)] + ). + rewrite < Hcut1. + apply (leb_to_Prop) + | apply (andb_true_true (leb (S j) i) (eqb (gcd j i) (S O))). + assumption + ] + ] + | apply (divides_b_true_to_divides). + assumption + ] + ] + | apply (sigma_p_true). + ] +] +qed. + + diff --git a/matita/library/technicalities/setoids.ma b/matita/library/technicalities/setoids.ma new file mode 100644 index 000000000..db2502ca9 --- /dev/null +++ b/matita/library/technicalities/setoids.ma @@ -0,0 +1,1056 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti. C.Sacerdoti Coen. *) +(* ||A|| E.Tassi. S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +(* Code ported from the Coq theorem prover by Claudio Sacerdoti Coen *) +(* Original author: Claudio Sacerdoti Coen. for the Coq system *) + + + +include "datatypes/constructors.ma". +include "logic/connectives2.ma". +include "logic/coimplication.ma". + +(* DEFINITIONS OF Relation_Class AND n-ARY Morphism_Theory *) + +(* X will be used to distinguish covariant arguments whose type is an *) +(* Asymmetric* relation from contravariant arguments of the same type *) +inductive X_Relation_Class (X: Type) : Type ≝ + SymmetricReflexive : + ∀A,Aeq. symmetric A Aeq → reflexive ? Aeq → X_Relation_Class X + | AsymmetricReflexive : X → ∀A,Aeq. reflexive A Aeq → X_Relation_Class X + | SymmetricAreflexive : ∀A,Aeq. symmetric A Aeq → X_Relation_Class X + | AsymmetricAreflexive : X → ∀A.∀Aeq : relation A. X_Relation_Class X + | Leibniz : Type → X_Relation_Class X. + +inductive variance : Set ≝ + Covariant : variance + | Contravariant : variance. + +definition Argument_Class ≝ X_Relation_Class variance. +definition Relation_Class ≝ X_Relation_Class unit. + +inductive Reflexive_Relation_Class : Type := + RSymmetric : + ∀A,Aeq. symmetric A Aeq → reflexive ? Aeq → Reflexive_Relation_Class + | RAsymmetric : + ∀A,Aeq. reflexive A Aeq → Reflexive_Relation_Class + | RLeibniz : Type → Reflexive_Relation_Class. + +inductive Areflexive_Relation_Class : Type := + | ASymmetric : ∀A,Aeq. symmetric A Aeq → Areflexive_Relation_Class + | AAsymmetric : ∀A.∀Aeq : relation A. Areflexive_Relation_Class. + +definition relation_class_of_argument_class : Argument_Class → Relation_Class. + intros (a); cases a; + [ apply (SymmetricReflexive ? ? ? H H1) + | apply (AsymmetricReflexive ? something ? ? H) + | apply (SymmetricAreflexive ? ? ? H) + | apply (AsymmetricAreflexive ? something ? r) + | apply (Leibniz ? T) + ] +qed. + +definition carrier_of_relation_class : ∀X. X_Relation_Class X → Type. + intros (X x); cases x (A o o o o A o o A o o o A o A); exact A. +qed. + +definition relation_of_relation_class: + ∀X,R. carrier_of_relation_class X R → carrier_of_relation_class X R → Prop. +intros 2; cases R; simplify; [1,2,3,4: assumption | apply (eq T) ] +qed. + +lemma about_carrier_of_relation_class_and_relation_class_of_argument_class : + ∀R. + carrier_of_relation_class ? (relation_class_of_argument_class R) = + carrier_of_relation_class ? R. +intro; cases R; reflexivity. +qed. + +inductive nelistT (A : Type) : Type := + singl : A → nelistT A + | cons : A → nelistT A → nelistT A. + +definition Arguments := nelistT Argument_Class. + +definition function_type_of_morphism_signature : + Arguments → Relation_Class → Type. + intros (In Out); elim In; + [ exact (carrier_of_relation_class ? t → carrier_of_relation_class ? Out) + | exact (carrier_of_relation_class ? t → T) + ] +qed. + +definition make_compatibility_goal_aux: + ∀In,Out.∀f,g:function_type_of_morphism_signature In Out.Prop. + intros 2; + elim In (a); simplify in f f1; + generalize in match f1; clear f1; + generalize in match f; clear f; + [ elim a; simplify in f f1; + [ exact (∀x1,x2. r x1 x2 → relation_of_relation_class ? Out (f x1) (f1 x2)) + | cases t; + [ exact (∀x1,x2. r x1 x2 → relation_of_relation_class ? Out (f x1) (f1 x2)) + | exact (∀x1,x2. r x2 x1 → relation_of_relation_class ? Out (f x1) (f1 x2)) + ] + | exact (∀x1,x2. r x1 x2 → relation_of_relation_class ? Out (f x1) (f1 x2)) + | cases t; + [ exact (∀x1,x2. r x1 x2 → relation_of_relation_class ? Out (f x1) (f1 x2)) + | exact (∀x1,x2. r x2 x1 → relation_of_relation_class ? Out (f x1) (f1 x2)) + ] + | exact (∀x. relation_of_relation_class ? Out (f x) (f1 x)) + ] + | change with + ((carrier_of_relation_class ? t → function_type_of_morphism_signature n Out) → + (carrier_of_relation_class ? t → function_type_of_morphism_signature n Out) → + Prop). + elim t; simplify in f f1; + [1,3: exact (∀x1,x2. r x1 x2 → R (f x1) (f1 x2)) + |2,4: cases t1; + [1,3: exact (∀x1,x2. r x1 x2 → R (f x1) (f1 x2)) + |2,4: exact (∀x1,x2. r x2 x1 → R (f x1) (f1 x2)) + ] + | exact (∀x. R (f x) (f1 x)) + ] + ] +qed. + +definition make_compatibility_goal := + λIn,Out,f. make_compatibility_goal_aux In Out f f. + +record Morphism_Theory (In: Arguments) (Out: Relation_Class) : Type := + { Function : function_type_of_morphism_signature In Out; + Compat : make_compatibility_goal In Out Function + }. + +definition list_of_Leibniz_of_list_of_types: nelistT Type → Arguments. + intro; + elim n; + [ apply (singl ? (Leibniz ? t)) + | apply (cons ? (Leibniz ? t) a) + ] +qed. + +(* every function is a morphism from Leibniz+ to Leibniz *) +definition morphism_theory_of_function : + ∀In: nelistT Type.∀Out: Type. + let In' := list_of_Leibniz_of_list_of_types In in + let Out' := Leibniz ? Out in + function_type_of_morphism_signature In' Out' → + Morphism_Theory In' Out'. + intros; + apply (mk_Morphism_Theory ? ? f); + unfold In' in f; clear In'; + unfold Out' in f; clear Out'; + generalize in match f; clear f; + elim In; + [ unfold make_compatibility_goal; + whd; intros; + reflexivity + | simplify; + intro; + unfold In' in f; + unfold Out' in f; + exact (H (f1 x)) + ] +qed. + +(* THE iff RELATION CLASS *) + +definition Iff_Relation_Class : Relation_Class. + apply (SymmetricReflexive unit ? iff); + [ exact symmetric_iff + | exact reflexive_iff + ] +qed. + +(* THE impl RELATION CLASS *) + +definition impl \def \lambda A,B:Prop. A → B. + +theorem impl_refl: reflexive ? impl. + unfold reflexive; + intros; + unfold impl; + intro; + assumption. +qed. + +definition Impl_Relation_Class : Relation_Class. + unfold Relation_Class; + apply (AsymmetricReflexive unit something ? impl); + exact impl_refl. +qed. + +(* UTILITY FUNCTIONS TO PROVE THAT EVERY TRANSITIVE RELATION IS A MORPHISM *) + +definition equality_morphism_of_symmetric_areflexive_transitive_relation: + ∀A: Type.∀Aeq: relation A.∀sym: symmetric ? Aeq.∀trans: transitive ? Aeq. + let ASetoidClass := SymmetricAreflexive ? ? ? sym in + (Morphism_Theory (cons ? ASetoidClass (singl ? ASetoidClass)) + Iff_Relation_Class). + intros; + apply mk_Morphism_Theory; + [ exact Aeq + | unfold make_compatibility_goal; + simplify; + intros; + split; + unfold transitive in H; + unfold symmetric in sym; + intro; + [ apply (H x2 x1 x3 ? ?); + [apply (sym x1 x2 ?). + apply (H1). + |apply (H x1 x x3 ? ?); + [apply (H3). + |apply (H2). + ] + ] + | apply (H x1 x3 x ? ?); + [apply (H x1 x2 x3 ? ?); + [apply (H1). + |apply (H3). + ] + |apply (sym x x3 ?). + apply (H2). + ] + ] + ]. +qed. + +definition equality_morphism_of_symmetric_reflexive_transitive_relation: + ∀A: Type.∀Aeq: relation A.∀refl: reflexive ? Aeq.∀sym: symmetric ? Aeq. + ∀trans: transitive ? Aeq. + let ASetoidClass := SymmetricReflexive ? ? ? sym refl in + (Morphism_Theory (cons ? ASetoidClass (singl ? ASetoidClass)) Iff_Relation_Class). + intros; + apply mk_Morphism_Theory; + reduce; + [ exact Aeq + | intros; + split; + intro; + unfold transitive in H; + unfold symmetric in sym; + [ apply (H x2 x1 x3 ? ?); + [apply (sym x1 x2 ?). + apply (H1). + |apply (H x1 x x3 ? ?); + [apply (H3). + |apply (H2). + ] + ] + | apply (H x1 x2 x ? ?); + [apply (H1). + |apply (H x2 x3 x ? ?); + [apply (H3). + |apply (sym x x3 ?). + apply (H x x3 x3 ? ?); + [apply (H2). + |apply (refl x3). + ] + ] + ] + ] + ] +qed. + +definition equality_morphism_of_asymmetric_areflexive_transitive_relation: + ∀A: Type.∀Aeq: relation A.∀trans: transitive ? Aeq. + let ASetoidClass1 := AsymmetricAreflexive ? Contravariant ? Aeq in + let ASetoidClass2 := AsymmetricAreflexive ? Covariant ? Aeq in + (Morphism_Theory (cons ? ASetoidClass1 (singl ? ASetoidClass2)) Impl_Relation_Class). + intros; + apply mk_Morphism_Theory; + [ simplify; + apply Aeq + | simplify; + intros; + whd; + intros; + apply (H x2 x1 x3 ? ?); + [apply (H1). + |apply (H x1 x x3 ? ?); + [apply (H3). + |apply (H2). + ] + ] + ]. +qed. + +definition equality_morphism_of_asymmetric_reflexive_transitive_relation: + ∀A: Type.∀Aeq: relation A.∀refl: reflexive ? Aeq.∀trans: transitive ? Aeq. + let ASetoidClass1 := AsymmetricReflexive ? Contravariant ? ? refl in + let ASetoidClass2 := AsymmetricReflexive ? Covariant ? ? refl in + (Morphism_Theory (cons ? ASetoidClass1 (singl ? ASetoidClass2)) Impl_Relation_Class). + intros; + apply mk_Morphism_Theory; + [ simplify; + apply Aeq + | simplify; + intros; + whd; + intro; + apply (H x2 x1 x3 ? ?); + [apply (H1). + |apply (H x1 x x3 ? ?); + [apply (H3). + |apply (H2). + ] + ] + ]. +qed. + +(* iff AS A RELATION *) + +(*DA PORTARE:Add Relation Prop iff + reflexivity proved by iff_refl + symmetry proved by iff_sym + transitivity proved by iff_trans + as iff_relation.*) + +(* every predicate is morphism from Leibniz+ to Iff_Relation_Class *) +definition morphism_theory_of_predicate : + ∀(In: nelistT Type). + let In' := list_of_Leibniz_of_list_of_types In in + function_type_of_morphism_signature In' Iff_Relation_Class → + Morphism_Theory In' Iff_Relation_Class. + intros; + apply mk_Morphism_Theory; + [ apply f + | generalize in match f; clear f; + unfold In'; clear In'; + elim In; + [ reduce; + intro; + apply iff_refl + | simplify; + intro x; + apply (H (f1 x)) + ] + ]. +qed. + +(* impl AS A RELATION *) + +theorem impl_trans: transitive ? impl. + whd; + unfold impl; + intros; + apply (H1 ?).apply (H ?).apply (H2). + autobatch. +qed. + +(*DA PORTARE: Add Relation Prop impl + reflexivity proved by impl_refl + transitivity proved by impl_trans + as impl_relation.*) + +(* THE CIC PART OF THE REFLEXIVE TACTIC (SETOID REWRITE) *) + +inductive rewrite_direction : Type := + Left2Right: rewrite_direction + | Right2Left: rewrite_direction. + +definition variance_of_argument_class : Argument_Class → option variance. + intros; + elim a; + [ apply None + | apply (Some ? t) + | apply None + | apply (Some ? t) + | apply None + ] +qed. + +definition opposite_direction := + λdir. + match dir with + [ Left2Right ⇒ Right2Left + | Right2Left ⇒ Left2Right + ]. + +lemma opposite_direction_idempotent: + ∀dir. opposite_direction (opposite_direction dir) = dir. + intros; + elim dir; + reflexivity. +qed. + +inductive check_if_variance_is_respected : + option variance → rewrite_direction → rewrite_direction → Prop +:= + MSNone : ∀dir,dir'. check_if_variance_is_respected (None ?) dir dir' + | MSCovariant : ∀dir. check_if_variance_is_respected (Some ? Covariant) dir dir + | MSContravariant : + ∀dir. + check_if_variance_is_respected (Some ? Contravariant) dir (opposite_direction dir). + +definition relation_class_of_reflexive_relation_class: + Reflexive_Relation_Class → Relation_Class. + intro; + elim r; + [ apply (SymmetricReflexive ? ? ? H H1) + | apply (AsymmetricReflexive ? something ? ? H) + | apply (Leibniz ? T) + ] +qed. + +definition relation_class_of_areflexive_relation_class: + Areflexive_Relation_Class → Relation_Class. + intro; + elim a; + [ apply (SymmetricAreflexive ? ? ? H) + | apply (AsymmetricAreflexive ? something ? r) + ] +qed. + +definition carrier_of_reflexive_relation_class := + λR.carrier_of_relation_class ? (relation_class_of_reflexive_relation_class R). + +definition carrier_of_areflexive_relation_class := + λR.carrier_of_relation_class ? (relation_class_of_areflexive_relation_class R). + +definition relation_of_areflexive_relation_class := + λR.relation_of_relation_class ? (relation_class_of_areflexive_relation_class R). + +inductive Morphism_Context (Hole: Relation_Class) (dir:rewrite_direction) : Relation_Class → rewrite_direction → Type := + App : + ∀In,Out,dir'. + Morphism_Theory In Out → Morphism_Context_List Hole dir dir' In → + Morphism_Context Hole dir Out dir' + | ToReplace : Morphism_Context Hole dir Hole dir + | ToKeep : + ∀S,dir'. + carrier_of_reflexive_relation_class S → + Morphism_Context Hole dir (relation_class_of_reflexive_relation_class S) dir' + | ProperElementToKeep : + ∀S,dir'.∀x: carrier_of_areflexive_relation_class S. + relation_of_areflexive_relation_class S x x → + Morphism_Context Hole dir (relation_class_of_areflexive_relation_class S) dir' +with Morphism_Context_List : + rewrite_direction → Arguments → Type +:= + fcl_singl : + ∀S,dir',dir''. + check_if_variance_is_respected (variance_of_argument_class S) dir' dir'' → + Morphism_Context Hole dir (relation_class_of_argument_class S) dir' → + Morphism_Context_List Hole dir dir'' (singl ? S) + | fcl_cons : + ∀S,L,dir',dir''. + check_if_variance_is_respected (variance_of_argument_class S) dir' dir'' → + Morphism_Context Hole dir (relation_class_of_argument_class S) dir' → + Morphism_Context_List Hole dir dir'' L → + Morphism_Context_List Hole dir dir'' (cons ? S L). + +lemma Morphism_Context_rect2: + ∀Hole,dir. + ∀P: + ∀r:Relation_Class.∀r0:rewrite_direction.Morphism_Context Hole dir r r0 → Type. + ∀P0: + ∀r:rewrite_direction.∀a:Arguments.Morphism_Context_List Hole dir r a → Type. + (∀In,Out,dir'. + ∀m:Morphism_Theory In Out.∀m0:Morphism_Context_List Hole dir dir' In. + P0 dir' In m0 → P Out dir' (App Hole ? ? ? ? m m0)) → + P Hole dir (ToReplace Hole dir) → + (∀S:Reflexive_Relation_Class.∀dir'.∀c:carrier_of_reflexive_relation_class S. + P (relation_class_of_reflexive_relation_class S) dir' + (ToKeep Hole dir S dir' c)) → + (∀S:Areflexive_Relation_Class.∀dir'. + ∀x:carrier_of_areflexive_relation_class S. + ∀r:relation_of_areflexive_relation_class S x x. + P (relation_class_of_areflexive_relation_class S) dir' + (ProperElementToKeep Hole dir S dir' x r)) → + (∀S:Argument_Class.∀dir',dir''. + ∀c:check_if_variance_is_respected (variance_of_argument_class S) dir' dir''. + ∀m:Morphism_Context Hole dir (relation_class_of_argument_class S) dir'. + P (relation_class_of_argument_class S) dir' m -> + P0 dir'' (singl ? S) (fcl_singl ? ? S ? ? c m)) → + (∀S:Argument_Class.∀L:Arguments.∀dir',dir''. + ∀c:check_if_variance_is_respected (variance_of_argument_class S) dir' dir''. + ∀m:Morphism_Context Hole dir (relation_class_of_argument_class S) dir'. + P (relation_class_of_argument_class S) dir' m → + ∀m0:Morphism_Context_List Hole dir dir'' L. + P0 dir'' L m0 → P0 dir'' (cons ? S L) (fcl_cons ? ? S ? ? ? c m m0)) → + ∀r:Relation_Class.∀r0:rewrite_direction.∀m:Morphism_Context Hole dir r r0. + P r r0 m +≝ + λHole,dir,P,P0,f,f0,f1,f2,f3,f4. + let rec + F (rc:Relation_Class) (r0:rewrite_direction) + (m:Morphism_Context Hole dir rc r0) on m : P rc r0 m + ≝ + match m return λrc.λr0.λm0.P rc r0 m0 with + [ App In Out dir' m0 m1 ⇒ f In Out dir' m0 m1 (F0 dir' In m1) + | ToReplace ⇒ f0 + | ToKeep S dir' c ⇒ f1 S dir' c + | ProperElementToKeep S dir' x r1 ⇒ f2 S dir' x r1 + ] + and + F0 (r:rewrite_direction) (a:Arguments) + (m:Morphism_Context_List Hole dir r a) on m : P0 r a m + ≝ + match m return λr.λa.λm0.P0 r a m0 with + [ fcl_singl S dir' dir'' c m0 ⇒ + f3 S dir' dir'' c m0 (F (relation_class_of_argument_class S) dir' m0) + | fcl_cons S L dir' dir'' c m0 m1 ⇒ + f4 S L dir' dir'' c m0 (F (relation_class_of_argument_class S) dir' m0) + m1 (F0 dir'' L m1) + ] +in F. + +lemma Morphism_Context_List_rect2: + ∀Hole,dir. + ∀P: + ∀r:Relation_Class.∀r0:rewrite_direction.Morphism_Context Hole dir r r0 → Type. + ∀P0: + ∀r:rewrite_direction.∀a:Arguments.Morphism_Context_List Hole dir r a → Type. + (∀In,Out,dir'. + ∀m:Morphism_Theory In Out.∀m0:Morphism_Context_List Hole dir dir' In. + P0 dir' In m0 → P Out dir' (App Hole ? ? ? ? m m0)) → + P Hole dir (ToReplace Hole dir) → + (∀S:Reflexive_Relation_Class.∀dir'.∀c:carrier_of_reflexive_relation_class S. + P (relation_class_of_reflexive_relation_class S) dir' + (ToKeep Hole dir S dir' c)) → + (∀S:Areflexive_Relation_Class.∀dir'. + ∀x:carrier_of_areflexive_relation_class S. + ∀r:relation_of_areflexive_relation_class S x x. + P (relation_class_of_areflexive_relation_class S) dir' + (ProperElementToKeep Hole dir S dir' x r)) → + (∀S:Argument_Class.∀dir',dir''. + ∀c:check_if_variance_is_respected (variance_of_argument_class S) dir' dir''. + ∀m:Morphism_Context Hole dir (relation_class_of_argument_class S) dir'. + P (relation_class_of_argument_class S) dir' m -> + P0 dir'' (singl ? S) (fcl_singl ? ? S ? ? c m)) → + (∀S:Argument_Class.∀L:Arguments.∀dir',dir''. + ∀c:check_if_variance_is_respected (variance_of_argument_class S) dir' dir''. + ∀m:Morphism_Context Hole dir (relation_class_of_argument_class S) dir'. + P (relation_class_of_argument_class S) dir' m → + ∀m0:Morphism_Context_List Hole dir dir'' L. + P0 dir'' L m0 → P0 dir'' (cons ? S L) (fcl_cons ? ? S ? ? ? c m m0)) → + ∀r:rewrite_direction.∀a:Arguments.∀m:Morphism_Context_List Hole dir r a. + P0 r a m +≝ + λHole,dir,P,P0,f,f0,f1,f2,f3,f4. + let rec + F (rc:Relation_Class) (r0:rewrite_direction) + (m:Morphism_Context Hole dir rc r0) on m : P rc r0 m + ≝ + match m return λrc.λr0.λm0.P rc r0 m0 with + [ App In Out dir' m0 m1 ⇒ f In Out dir' m0 m1 (F0 dir' In m1) + | ToReplace ⇒ f0 + | ToKeep S dir' c ⇒ f1 S dir' c + | ProperElementToKeep S dir' x r1 ⇒ f2 S dir' x r1 + ] + and + F0 (r:rewrite_direction) (a:Arguments) + (m:Morphism_Context_List Hole dir r a) on m : P0 r a m + ≝ + match m return λr.λa.λm0.P0 r a m0 with + [ fcl_singl S dir' dir'' c m0 ⇒ + f3 S dir' dir'' c m0 (F (relation_class_of_argument_class S) dir' m0) + | fcl_cons S L dir' dir'' c m0 m1 ⇒ + f4 S L dir' dir'' c m0 (F (relation_class_of_argument_class S) dir' m0) + m1 (F0 dir'' L m1) + ] +in F0. + +definition product_of_arguments : Arguments → Type. + intro; + elim a; + [ apply (carrier_of_relation_class ? t) + | apply (Prod (carrier_of_relation_class ? t) T) + ] +qed. + +definition get_rewrite_direction: rewrite_direction → Argument_Class → rewrite_direction. + intros (dir R); + cases (variance_of_argument_class R) (a); + [ exact dir + | cases a; + [ exact dir (* covariant *) + | exact (opposite_direction dir) (* contravariant *) + ] + ] +qed. + +definition directed_relation_of_relation_class: + ∀dir:rewrite_direction.∀R: Relation_Class. + carrier_of_relation_class ? R → carrier_of_relation_class ? R → Prop. + intros; + cases r; + [ exact (relation_of_relation_class ? ? c c1) + | apply (relation_of_relation_class ? ? c1 c) + ] +qed. + +definition directed_relation_of_argument_class: + ∀dir:rewrite_direction.∀R: Argument_Class. + carrier_of_relation_class ? R → carrier_of_relation_class ? R → Prop. + intros (dir R c c1); + rewrite < (about_carrier_of_relation_class_and_relation_class_of_argument_class R) in c c1; + exact (directed_relation_of_relation_class dir (relation_class_of_argument_class R) c c1). +qed. + + +definition relation_of_product_of_arguments: + ∀dir:rewrite_direction.∀In. + product_of_arguments In → product_of_arguments In → Prop. + intros 2; + elim In 0; + [ simplify; + intro; + exact (directed_relation_of_argument_class (get_rewrite_direction r t) t) + | intros; + change in p with (Prod (carrier_of_relation_class variance t) (product_of_arguments n)); + change in p1 with (Prod (carrier_of_relation_class variance t) (product_of_arguments n)); + cases p (c p2); + cases p1 (c1 p3); + apply And; + [ exact + (directed_relation_of_argument_class (get_rewrite_direction r t) t c c1) + | exact (R p2 p3) + ] + ] +qed. + +definition apply_morphism: + ∀In,Out.∀m: function_type_of_morphism_signature In Out. + ∀args: product_of_arguments In. carrier_of_relation_class ? Out. + intro; + elim In; + [ exact (f p) + | change in p with (Prod (carrier_of_relation_class variance t) (product_of_arguments n)); + elim p; + change in f1 with (carrier_of_relation_class variance t → function_type_of_morphism_signature n Out); + exact (f ? (f1 t1) t2) + ] +qed. + +theorem apply_morphism_compatibility_Right2Left: + ∀In,Out.∀m1,m2: function_type_of_morphism_signature In Out. + ∀args1,args2: product_of_arguments In. + make_compatibility_goal_aux ? ? m1 m2 → + relation_of_product_of_arguments Right2Left ? args1 args2 → + directed_relation_of_relation_class Right2Left ? + (apply_morphism ? ? m2 args1) + (apply_morphism ? ? m1 args2). + intro; + elim In; + [ simplify in m1 m2 args1 args2 ⊢ %; + change in H1 with + (directed_relation_of_argument_class + (get_rewrite_direction Right2Left t) t args1 args2); + generalize in match H1; clear H1; + generalize in match H; clear H; + generalize in match args2; clear args2; + generalize in match args1; clear args1; + generalize in match m2; clear m2; + generalize in match m1; clear m1; + elim t 0; simplify; + [ intros (T1 r Hs Hr m1 m2 args1 args2 H H1); + apply H; + exact H1 + | intros 8 (v T1 r Hr m1 m2 args1 args2); + cases v; + simplify; + intros (H H1); + apply (H ? ? H1); + | intros; + apply H1; + exact H2 + | intros 7 (v); + cases v; simplify; + intros (H H1); + apply H; + exact H1 + | intros; + simplify in H1; + rewrite > H1; + apply H; + exact H1 + ] + | change in m1 with + (carrier_of_relation_class variance t → + function_type_of_morphism_signature n Out); + change in m2 with + (carrier_of_relation_class variance t → + function_type_of_morphism_signature n Out); + change in args1 with + ((carrier_of_relation_class ? t) × (product_of_arguments n)); + change in args2 with + ((carrier_of_relation_class ? t) × (product_of_arguments n)); + generalize in match H2; clear H2; + elim args2 0; clear args2; + elim args1; clear args1; + elim H2; clear H2; + change in H4 with + (relation_of_product_of_arguments Right2Left n t2 t4); + change with + (relation_of_relation_class unit Out (apply_morphism n Out (m1 t3) t4) + (apply_morphism n Out (m2 t1) t2)); + generalize in match H3; clear H3; + generalize in match t3; clear t3; + generalize in match t1; clear t1; + generalize in match H1; clear H1; + generalize in match m2; clear m2; + generalize in match m1; clear m1; + elim t 0; + [ intros (T1 r Hs Hr m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x1 x2 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + | intro v; + elim v 0; + [ intros (T1 r Hr m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x1 x2 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + | intros (T1 r Hr m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x2 x1 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + ] + | intros (T1 r Hs m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x1 x2 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + | intro v; + elim v 0; + [ intros (T1 r m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x1 x2 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + | intros (T1 r m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x2 x1 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + ] + | intros (T m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x:T. make_compatibility_goal_aux n Out (m1 x) (m2 x)); + rewrite > H3; + simplify in H; + apply H; + [ apply H1 + | assumption + ] + ] ; + simplify in H; + apply H; + [1,3,5,7,9,11: + apply H1; + assumption + |2,4,6,8,10,12: + assumption + ] + ] +qed. + +theorem apply_morphism_compatibility_Left2Right: + ∀In,Out.∀m1,m2: function_type_of_morphism_signature In Out. + ∀args1,args2: product_of_arguments In. + make_compatibility_goal_aux ? ? m1 m2 → + relation_of_product_of_arguments Left2Right ? args1 args2 → + directed_relation_of_relation_class Left2Right ? + (apply_morphism ? ? m1 args1) + (apply_morphism ? ? m2 args2). + intro; + elim In 0; simplify; intros; + [ change in H1 with + (directed_relation_of_argument_class + (get_rewrite_direction Left2Right t) t args1 args2); + generalize in match H1; clear H1; + generalize in match H; clear H; + generalize in match args2; clear args2; + generalize in match args1; clear args1; + generalize in match m2; clear m2; + generalize in match m1; clear m1; + elim t 0; simplify; + [ intros (T1 r Hs Hr m1 m2 args1 args2 H H1); + apply H; + exact H1 + | intros 8 (v T1 r Hr m1 m2 args1 args2); + cases v; + intros (H H1); + simplify in H1; + apply H; + exact H1 + | intros; + apply H1; + exact H2 + | intros 7 (v); + cases v; + intros (H H1); + simplify in H1; + apply H; + exact H1 + | intros; + simplify in H1; + rewrite > H1; + apply H; + exact H1 + ] + | change in m1 with + (carrier_of_relation_class variance t → + function_type_of_morphism_signature n Out); + change in m2 with + (carrier_of_relation_class variance t → + function_type_of_morphism_signature n Out); + change in args1 with + ((carrier_of_relation_class ? t) × (product_of_arguments n)); + change in args2 with + ((carrier_of_relation_class ? t) × (product_of_arguments n)); + generalize in match H2; clear H2; + elim args2 0; clear args2; + elim args1; clear args1; + elim H2; clear H2; + change in H4 with + (relation_of_product_of_arguments Left2Right n t2 t4); + change with + (relation_of_relation_class unit Out (apply_morphism n Out (m1 t1) t2) + (apply_morphism n Out (m2 t3) t4)); + generalize in match H3; clear H3; + generalize in match t3; clear t3; + generalize in match t1; clear t1; + generalize in match H1; clear H1; + generalize in match m2; clear m2; + generalize in match m1; clear m1; + elim t 0; + [ intros (T1 r Hs Hr m1 m2 H1 t1 t3 H3); + change in H1 with + (∀x1,x2:T1.r x1 x2 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + | intro v; + elim v 0; + [ intros (T1 r Hr m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x1 x2 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + | intros (T1 r Hr m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x2 x1 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + ] + | intros (T1 r Hs m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x1 x2 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + | intro v; + elim v 0; + [ intros (T1 r m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x1 x2 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + | intros (T1 r m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x1,x2:T1.r x2 x1 → make_compatibility_goal_aux n Out (m1 x1) (m2 x2)); + ] + | intros (T m1 m2 H1 t1 t3 H3); + simplify in H3; + change in H1 with + (∀x:T. make_compatibility_goal_aux n Out (m1 x) (m2 x)); + rewrite > H3; + simplify in H; + apply H; + [ apply H1 + | assumption + ] + ] ; + simplify in H; + apply H; + [1,3,5,7,9,11: + apply H1; + assumption + |2,4,6,8,10,12: + assumption + ] + ] +qed. + +definition interp : + ∀Hole,dir,Out,dir'. carrier_of_relation_class ? Hole → + Morphism_Context Hole dir Out dir' → carrier_of_relation_class ? Out. + intros (Hole dir Out dir' H t). + apply + (Morphism_Context_rect2 Hole dir (λS,xx,yy. carrier_of_relation_class ? S) + (λxx,L,fcl.product_of_arguments L)); + intros; + [8: apply t + |7: skip + | exact (apply_morphism ? ? (Function ? ? m) p) + | exact H + | exact c + | exact x + | simplify; + rewrite < + (about_carrier_of_relation_class_and_relation_class_of_argument_class S); + exact c1 + | split; + [ rewrite < + (about_carrier_of_relation_class_and_relation_class_of_argument_class S); + exact c1 + | exact p + ] + ] +qed. + + +(*CSC: interp and interp_relation_class_list should be mutually defined. since + the proof term of each one contains the proof term of the other one. However + I cannot do that interactively (I should write the Fix by hand) *) +definition interp_relation_class_list : + ∀Hole,dir,dir'.∀L: Arguments. carrier_of_relation_class ? Hole → + Morphism_Context_List Hole dir dir' L → product_of_arguments L. + intros (Hole dir dir' L H t); + apply + (Morphism_Context_List_rect2 Hole dir (λS,xx,yy.carrier_of_relation_class ? S) + (λxx,L,fcl.product_of_arguments L)); + intros; + [8: apply t + |7: skip + | exact (apply_morphism ? ? (Function ? ? m) p) + | exact H + | exact c + | exact x + | simplify; + rewrite < + (about_carrier_of_relation_class_and_relation_class_of_argument_class S); + exact c1 + | split; + [ rewrite < + (about_carrier_of_relation_class_and_relation_class_of_argument_class S); + exact c1 + | exact p + ] + ] +qed. + +(* +Theorem setoid_rewrite: + ∀Hole dir Out dir' (E1 E2: carrier_of_relation_class Hole) + (E: Morphism_Context Hole dir Out dir'). + (directed_relation_of_relation_class dir Hole E1 E2) → + (directed_relation_of_relation_class dir' Out (interp E1 E) (interp E2 E)). + intros. + elim E using + (@Morphism_Context_rect2 Hole dir + (fun S dir'' E => directed_relation_of_relation_class dir'' S (interp E1 E) (interp E2 E)) + (fun dir'' L fcl => + relation_of_product_of_arguments dir'' ? + (interp_relation_class_list E1 fcl) + (interp_relation_class_list E2 fcl))); intros. + change (directed_relation_of_relation_class dir'0 Out0 + (apply_morphism ? ? (Function m) (interp_relation_class_list E1 m0)) + (apply_morphism ? ? (Function m) (interp_relation_class_list E2 m0))). + destruct dir'0. + apply apply_morphism_compatibility_Left2Right. + exact (Compat m). + exact H0. + apply apply_morphism_compatibility_Right2Left. + exact (Compat m). + exact H0. + + exact H. + + unfold interp. Morphism_Context_rect2. + (*CSC: reflexivity used here*) + destruct S; destruct dir'0; simpl; (apply r || reflexivity). + + destruct dir'0; exact r. + + destruct S; unfold directed_relation_of_argument_class; simpl in H0 |- *; + unfold get_rewrite_direction; simpl. + destruct dir'0; destruct dir''; + (exact H0 || + unfold directed_relation_of_argument_class; simpl; apply s; exact H0). + (* the following mess with generalize/clear/intros is to help Coq resolving *) + (* second order unification problems. *) + generalize m c H0; clear H0 m c; inversion c; + generalize m c; clear m c; rewrite <- H1; rewrite <- H2; intros; + (exact H3 || rewrite (opposite_direction_idempotent dir'0); apply H3). + destruct dir'0; destruct dir''; + (exact H0 || + unfold directed_relation_of_argument_class; simpl; apply s; exact H0). +(* the following mess with generalize/clear/intros is to help Coq resolving *) + (* second order unification problems. *) + generalize m c H0; clear H0 m c; inversion c; + generalize m c; clear m c; rewrite <- H1; rewrite <- H2; intros; + (exact H3 || rewrite (opposite_direction_idempotent dir'0); apply H3). + destruct dir'0; destruct dir''; (exact H0 || hnf; symmetry; exact H0). + + change + (directed_relation_of_argument_class (get_rewrite_direction dir'' S) S + (eq_rect ? (fun T : Type => T) (interp E1 m) ? + (about_carrier_of_relation_class_and_relation_class_of_argument_class S)) + (eq_rect ? (fun T : Type => T) (interp E2 m) ? + (about_carrier_of_relation_class_and_relation_class_of_argument_class S)) /\ + relation_of_product_of_arguments dir'' ? + (interp_relation_class_list E1 m0) (interp_relation_class_list E2 m0)). + split. + clear m0 H1; destruct S; simpl in H0 |- *; unfold get_rewrite_direction; simpl. + destruct dir''; destruct dir'0; (exact H0 || hnf; apply s; exact H0). + inversion c. + rewrite <- H3; exact H0. + rewrite (opposite_direction_idempotent dir'0); exact H0. + destruct dir''; destruct dir'0; (exact H0 || hnf; apply s; exact H0). + inversion c. + rewrite <- H3; exact H0. + rewrite (opposite_direction_idempotent dir'0); exact H0. + destruct dir''; destruct dir'0; (exact H0 || hnf; symmetry; exact H0). + exact H1. +Qed. + +(* A FEW EXAMPLES ON iff *) + +(* impl IS A MORPHISM *) + +Add Morphism impl with signature iff ==> iff ==> iff as Impl_Morphism. +unfold impl; tautobatch. +Qed. + +(* and IS A MORPHISM *) + +Add Morphism and with signature iff ==> iff ==> iff as And_Morphism. + tautobatch. +Qed. + +(* or IS A MORPHISM *) + +Add Morphism or with signature iff ==> iff ==> iff as Or_Morphism. + tautobatch. +Qed. + +(* not IS A MORPHISM *) + +Add Morphism not with signature iff ==> iff as Not_Morphism. + tautobatch. +Qed. + +(* THE SAME EXAMPLES ON impl *) + +Add Morphism and with signature impl ++> impl ++> impl as And_Morphism2. + unfold impl; tautobatch. +Qed. + +Add Morphism or with signature impl ++> impl ++> impl as Or_Morphism2. + unfold impl; tautobatch. +Qed. + +Add Morphism not with signature impl -→ impl as Not_Morphism2. + unfold impl; tautobatch. +Qed. + +*) diff --git a/matita/library_auto/auto/Q/q.ma b/matita/library_auto/auto/Q/q.ma new file mode 100644 index 000000000..eee29ace2 --- /dev/null +++ b/matita/library_auto/auto/Q/q.ma @@ -0,0 +1,523 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/Q/q". + +include "auto/Z/compare.ma". +include "auto/Z/plus.ma". + +(* a fraction is a list of Z-coefficients for primes, in natural +order. The last coefficient must eventually be different from 0 *) + +inductive fraction : Set \def + pp : nat \to fraction +| nn: nat \to fraction +| cons : Z \to fraction \to fraction. + +inductive ratio : Set \def + one : ratio + | frac : fraction \to ratio. + +(* a rational number is either O or a ratio with a sign *) +inductive Q : Set \def + OQ : Q + | Qpos : ratio \to Q + | Qneg : ratio \to Q. + +(* double elimination principles *) +theorem fraction_elim2: +\forall R:fraction \to fraction \to Prop. +(\forall n:nat.\forall g:fraction.R (pp n) g) \to +(\forall n:nat.\forall g:fraction.R (nn n) g) \to +(\forall x:Z.\forall f:fraction.\forall m:nat.R (cons x f) (pp m)) \to +(\forall x:Z.\forall f:fraction.\forall m:nat.R (cons x f) (nn m)) \to +(\forall x,y:Z.\forall f,g:fraction.R f g \to R (cons x f) (cons y g)) \to +\forall f,g:fraction. R f g. +intros 7. +elim f +[ apply H +| apply H1 +| elim g + [ apply H2 + | apply H3 + | autobatch + (*apply H4. + apply H5*) + ] +] +qed. + +(* boolean equality *) +let rec eqfb f g \def +match f with +[ (pp n) \Rightarrow + match g with + [ (pp m) \Rightarrow eqb n m + | (nn m) \Rightarrow false + | (cons y g1) \Rightarrow false] +| (nn n) \Rightarrow + match g with + [ (pp m) \Rightarrow false + | (nn m) \Rightarrow eqb n m + | (cons y g1) \Rightarrow false] +| (cons x f1) \Rightarrow + match g with + [ (pp m) \Rightarrow false + | (nn m) \Rightarrow false + | (cons y g1) \Rightarrow andb (eqZb x y) (eqfb f1 g1)]]. + +(* discrimination *) +definition aux \def + \lambda f. match f with + [ (pp n) \Rightarrow n + | (nn n) \Rightarrow n + | (cons x f) \Rightarrow O]. + +definition fhd \def +\lambda f. match f with + [ (pp n) \Rightarrow (pos n) + | (nn n) \Rightarrow (neg n) + | (cons x f) \Rightarrow x]. + +definition ftl \def +\lambda f. match f with + [ (pp n) \Rightarrow (pp n) + | (nn n) \Rightarrow (nn n) + | (cons x f) \Rightarrow f]. + +theorem injective_pp : injective nat fraction pp. +unfold injective. +intros. +change with ((aux(pp x)) = (aux (pp y))). +autobatch. +(*apply eq_f. +assumption.*) +qed. + +theorem injective_nn : injective nat fraction nn. +unfold injective. +intros. +change with ((aux (nn x)) = (aux (nn y))). +autobatch. +(*apply eq_f. +assumption.*) +qed. + +theorem eq_cons_to_eq1: \forall f,g:fraction.\forall x,y:Z. +(cons x f) = (cons y g) \to x = y. +intros. +change with ((fhd (cons x f)) = (fhd (cons y g))). +autobatch. +(*apply eq_f.assumption.*) +qed. + +theorem eq_cons_to_eq2: \forall x,y:Z.\forall f,g:fraction. +(cons x f) = (cons y g) \to f = g. +intros. +change with ((ftl (cons x f)) = (ftl (cons y g))). +autobatch. +(*apply eq_f.assumption.*) +qed. + +theorem not_eq_pp_nn: \forall n,m:nat. pp n \neq nn m. +intros. +unfold Not. +intro. +change with match (pp n) with +[ (pp n) \Rightarrow False +| (nn n) \Rightarrow True +| (cons x f) \Rightarrow True]. +rewrite > H. +simplify. +exact I. +qed. + +theorem not_eq_pp_cons: +\forall n:nat.\forall x:Z. \forall f:fraction. +pp n \neq cons x f. +intros. +unfold Not. +intro. +change with match (pp n) with +[ (pp n) \Rightarrow False +| (nn n) \Rightarrow True +| (cons x f) \Rightarrow True]. +rewrite > H. +simplify. +exact I. +qed. + +theorem not_eq_nn_cons: +\forall n:nat.\forall x:Z. \forall f:fraction. +nn n \neq cons x f. +intros. +unfold Not. +intro. +change with match (nn n) with +[ (pp n) \Rightarrow True +| (nn n) \Rightarrow False +| (cons x f) \Rightarrow True]. +rewrite > H. +simplify. +exact I. +qed. + +theorem decidable_eq_fraction: \forall f,g:fraction. +decidable (f = g). +intros. +unfold decidable. +apply (fraction_elim2 (\lambda f,g. f=g \lor (f=g \to False))) +[ intros. + elim g1 + [ elim ((decidable_eq_nat n n1) : n=n1 \lor (n=n1 \to False)) + [ autobatch + (*left. + apply eq_f. + assumption*) + | right. + intro. + autobatch + (*apply H. + apply injective_pp. + assumption*) + ] + | autobatch + (*right. + apply not_eq_pp_nn*) + | autobatch + (*right. + apply not_eq_pp_cons*) + ] +| intros. + elim g1 + [ right. + intro. + apply (not_eq_pp_nn n1 n). + autobatch + (*apply sym_eq. + assumption*) + | elim ((decidable_eq_nat n n1) : n=n1 \lor (n=n1 \to False)) + [ autobatch + (*left. + apply eq_f. + assumption*) + | right. + intro. + autobatch + (*apply H. + apply injective_nn. + assumption*) + ] + | autobatch + (*right. + apply not_eq_nn_cons*) + ] +| intros. + right. + intro. + apply (not_eq_pp_cons m x f1). + autobatch + (*apply sym_eq. + assumption*) +| intros. + right. + intro. + apply (not_eq_nn_cons m x f1). + autobatch + (*apply sym_eq. + assumption*) +| intros. + elim H + [ elim ((decidable_eq_Z x y) : x=y \lor (x=y \to False)) + [ autobatch + (*left. + apply eq_f2; + assumption*) + | right. + intro. + autobatch + (*apply H2. + apply (eq_cons_to_eq1 f1 g1). + assumption*) + ] + | right. + intro. + autobatch + (*apply H1. + apply (eq_cons_to_eq2 x y f1 g1). + assumption*) + ] +] +qed. + +theorem eqfb_to_Prop: \forall f,g:fraction. +match (eqfb f g) with +[true \Rightarrow f=g +|false \Rightarrow f \neq g]. +intros. +apply (fraction_elim2 +(\lambda f,g.match (eqfb f g) with +[true \Rightarrow f=g +|false \Rightarrow f \neq g])) +[ intros. + elim g1 + [ simplify. + apply eqb_elim + [ intro. + simplify. + autobatch + (*apply eq_f. + assumption*) + | intro. + simplify. + unfold Not. + intro. + autobatch + (*apply H. + apply injective_pp. + assumption*) + ] + | simplify. + apply not_eq_pp_nn + | simplify. + apply not_eq_pp_cons + ] +| intros. + elim g1 + [ simplify. + unfold Not. + intro. + apply (not_eq_pp_nn n1 n). + autobatch + (*apply sym_eq. + assumption*) + | simplify. + apply eqb_elim + [ intro. + simplify. + autobatch + (*apply eq_f. + assumption*) + | intro. + simplify. + unfold Not. + intro. + autobatch + (*apply H. + apply injective_nn. + assumption*) + ] + | simplify. + apply not_eq_nn_cons + ] +| intros. + simplify. + unfold Not. + intro. + apply (not_eq_pp_cons m x f1). + autobatch + (*apply sym_eq. + assumption*) +| intros. + simplify. + unfold Not. + intro. + apply (not_eq_nn_cons m x f1). + autobatch + (*apply sym_eq. + assumption*) +| intros. + simplify. + apply eqZb_elim + [ intro. + generalize in match H. + elim (eqfb f1 g1) + [ simplify. + apply eq_f2 + [ assumption + | (*qui autobatch non chiude il goal*) + apply H2 + ] + | simplify. + unfold Not. + intro. + apply H2. + autobatch + (*apply (eq_cons_to_eq2 x y). + assumption*) + ] + | intro. + simplify. + unfold Not. + intro. + autobatch + (*apply H1. + apply (eq_cons_to_eq1 f1 g1). + assumption*) + ] +] +qed. + +let rec finv f \def + match f with + [ (pp n) \Rightarrow (nn n) + | (nn n) \Rightarrow (pp n) + | (cons x g) \Rightarrow (cons (Zopp x) (finv g))]. + +definition Z_to_ratio :Z \to ratio \def +\lambda x:Z. match x with +[ OZ \Rightarrow one +| (pos n) \Rightarrow frac (pp n) +| (neg n) \Rightarrow frac (nn n)]. + +let rec ftimes f g \def + match f with + [ (pp n) \Rightarrow + match g with + [(pp m) \Rightarrow Z_to_ratio (pos n + pos m) + | (nn m) \Rightarrow Z_to_ratio (pos n + neg m) + | (cons y g1) \Rightarrow frac (cons (pos n + y) g1)] + | (nn n) \Rightarrow + match g with + [(pp m) \Rightarrow Z_to_ratio (neg n + pos m) + | (nn m) \Rightarrow Z_to_ratio (neg n + neg m) + | (cons y g1) \Rightarrow frac (cons (neg n + y) g1)] + | (cons x f1) \Rightarrow + match g with + [ (pp m) \Rightarrow frac (cons (x + pos m) f1) + | (nn m) \Rightarrow frac (cons (x + neg m) f1) + | (cons y g1) \Rightarrow + match ftimes f1 g1 with + [ one \Rightarrow Z_to_ratio (x + y) + | (frac h) \Rightarrow frac (cons (x + y) h)]]]. + +theorem symmetric2_ftimes: symmetric2 fraction ratio ftimes. +unfold symmetric2. +intros. +apply (fraction_elim2 (\lambda f,g.ftimes f g = ftimes g f)) +[ intros. + elim g + [ change with (Z_to_ratio (pos n + pos n1) = Z_to_ratio (pos n1 + pos n)). + autobatch + (*apply eq_f. + apply sym_Zplus*) + | change with (Z_to_ratio (pos n + neg n1) = Z_to_ratio (neg n1 + pos n)). + autobatch + (*apply eq_f. + apply sym_Zplus*) + | change with (frac (cons (pos n + z) f) = frac (cons (z + pos n) f)). + autobatch + (*rewrite < sym_Zplus. + reflexivity*) + ] +| intros. + elim g + [ change with (Z_to_ratio (neg n + pos n1) = Z_to_ratio (pos n1 + neg n)). + autobatch + (*apply eq_f. + apply sym_Zplus*) + | change with (Z_to_ratio (neg n + neg n1) = Z_to_ratio (neg n1 + neg n)). + autobatch + (*apply eq_f. + apply sym_Zplus*) + | change with (frac (cons (neg n + z) f) = frac (cons (z + neg n) f)). + autobatch + (*rewrite < sym_Zplus. + reflexivity*) + ] +| intros. + change with (frac (cons (x1 + pos m) f) = frac (cons (pos m + x1) f)). + autobatch + (*rewrite < sym_Zplus. + reflexivity*) +| intros. + change with (frac (cons (x1 + neg m) f) = frac (cons (neg m + x1) f)). + autobatch + (*rewrite < sym_Zplus. + reflexivity*) +| intros. + (*CSC: simplify does something nasty here because of a redex in Zplus *) + change with + (match ftimes f g with + [ one \Rightarrow Z_to_ratio (x1 + y1) + | (frac h) \Rightarrow frac (cons (x1 + y1) h)] = + match ftimes g f with + [ one \Rightarrow Z_to_ratio (y1 + x1) + | (frac h) \Rightarrow frac (cons (y1 + x1) h)]). + rewrite < H. + rewrite < sym_Zplus. + reflexivity +] +qed. + +theorem ftimes_finv : \forall f:fraction. ftimes f (finv f) = one. +intro. +elim f +[ change with (Z_to_ratio (pos n + - (pos n)) = one). + autobatch + (*rewrite > Zplus_Zopp. + reflexivity*) +| change with (Z_to_ratio (neg n + - (neg n)) = one). + autobatch + (*rewrite > Zplus_Zopp. + reflexivity*) +| + (*CSC: simplify does something nasty here because of a redex in Zplus *) + (* again: we would need something to help finding the right change *) + change with + (match ftimes f1 (finv f1) with + [ one \Rightarrow Z_to_ratio (z + - z) + | (frac h) \Rightarrow frac (cons (z + - z) h)] = one). + rewrite > H. + rewrite > Zplus_Zopp. + reflexivity +] +qed. + +definition rtimes : ratio \to ratio \to ratio \def +\lambda r,s:ratio. + match r with + [one \Rightarrow s + | (frac f) \Rightarrow + match s with + [one \Rightarrow frac f + | (frac g) \Rightarrow ftimes f g]]. + +theorem symmetric_rtimes : symmetric ratio rtimes. +change with (\forall r,s:ratio. rtimes r s = rtimes s r). +intros. +elim r +[ elim s;reflexivity +| elim s + [ reflexivity + | simplify. + apply symmetric2_ftimes + ] +] +qed. + +definition rinv : ratio \to ratio \def +\lambda r:ratio. + match r with + [one \Rightarrow one + | (frac f) \Rightarrow frac (finv f)]. + +theorem rtimes_rinv: \forall r:ratio. rtimes r (rinv r) = one. +intro. +elim r +[ reflexivity +| simplify. + apply ftimes_finv +] +qed. diff --git a/matita/library_auto/auto/Z/compare.ma b/matita/library_auto/auto/Z/compare.ma new file mode 100644 index 000000000..4096af1ee --- /dev/null +++ b/matita/library_auto/auto/Z/compare.ma @@ -0,0 +1,234 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/Z/compare". + +include "auto/Z/orders.ma". +include "auto/nat/compare.ma". + +(* boolean equality *) +definition eqZb : Z \to Z \to bool \def +\lambda x,y:Z. + match x with + [ OZ \Rightarrow + match y with + [ OZ \Rightarrow true + | (pos q) \Rightarrow false + | (neg q) \Rightarrow false] + | (pos p) \Rightarrow + match y with + [ OZ \Rightarrow false + | (pos q) \Rightarrow eqb p q + | (neg q) \Rightarrow false] + | (neg p) \Rightarrow + match y with + [ OZ \Rightarrow false + | (pos q) \Rightarrow false + | (neg q) \Rightarrow eqb p q]]. + +theorem eqZb_to_Prop: +\forall x,y:Z. +match eqZb x y with +[ true \Rightarrow x=y +| false \Rightarrow x \neq y]. +intros. +elim x +[ elim y + [ simplify. + reflexivity + | simplify. + apply not_eq_OZ_pos + | simplify. + apply not_eq_OZ_neg + ] +| elim y + [ simplify. + unfold Not. + intro. + apply (not_eq_OZ_pos n). + autobatch + (*apply sym_eq. + assumption*) + | simplify. + apply eqb_elim + [ intro. + simplify. + autobatch + (*apply eq_f. + assumption*) + | intro. + simplify. + unfold Not. + intro. + autobatch + (*apply H. + apply inj_pos. + assumption*) + ] + | simplify. + apply not_eq_pos_neg + ] +| elim y + [ simplify. + unfold Not. + intro. + apply (not_eq_OZ_neg n). + autobatch + (*apply sym_eq. + assumption*) + | simplify. + unfold Not. + intro. + apply (not_eq_pos_neg n1 n). + autobatch + (*apply sym_eq. + assumption*) + | simplify. + apply eqb_elim + [ intro. + simplify. + autobatch + (*apply eq_f. + assumption*) + | intro. + simplify. + unfold Not. + intro. + autobatch + (*apply H. + apply inj_neg. + assumption*) + ] + ] +] +qed. + +theorem eqZb_elim: \forall x,y:Z.\forall P:bool \to Prop. +(x=y \to (P true)) \to (x \neq y \to (P false)) \to P (eqZb x y). +intros. +cut +(match (eqZb x y) with +[ true \Rightarrow x=y +| false \Rightarrow x \neq y] \to P (eqZb x y)) +[ apply Hcut. + (*NB qui autobatch non chiude il goal*) + apply eqZb_to_Prop +| elim (eqZb) + [ (*NB qui autobatch non chiude il goal*) + apply (H H2) + | (*NB qui autobatch non chiude il goal*) + apply (H1 H2) + ] +] +qed. + +definition Z_compare : Z \to Z \to compare \def +\lambda x,y:Z. + match x with + [ OZ \Rightarrow + match y with + [ OZ \Rightarrow EQ + | (pos m) \Rightarrow LT + | (neg m) \Rightarrow GT ] + | (pos n) \Rightarrow + match y with + [ OZ \Rightarrow GT + | (pos m) \Rightarrow (nat_compare n m) + | (neg m) \Rightarrow GT] + | (neg n) \Rightarrow + match y with + [ OZ \Rightarrow LT + | (pos m) \Rightarrow LT + | (neg m) \Rightarrow nat_compare m n ]]. + +theorem Z_compare_to_Prop : +\forall x,y:Z. match (Z_compare x y) with +[ LT \Rightarrow x < y +| EQ \Rightarrow x=y +| GT \Rightarrow y < x]. +intros. +elim x +[ elim y + [ simplify. + apply refl_eq + | simplify. + exact I + | simplify. + exact I + ] +| elim y + [ simplify. + exact I + | simplify. + cut (match (nat_compare n n1) with + [ LT \Rightarrow n Zplus_z_OZ. + reflexivity*) +| elim y + [ autobatch + (*simplify. + reflexivity*) + | simplify. + autobatch + (*rewrite < plus_n_Sm. + rewrite < plus_n_Sm. + rewrite < sym_plus. + reflexivity*) + | simplify. + rewrite > nat_compare_n_m_m_n. + simplify. + elim nat_compare;autobatch + (*[ simplify. + reflexivity + | simplify. + reflexivity + | simplify. + reflexivity + ]*) + ] +| elim y + [ autobatch + (*simplify. + reflexivity*) + | simplify. + rewrite > nat_compare_n_m_m_n. + simplify. + elim nat_compare;autobatch + (*[ simplify. + reflexivity + | simplify. + reflexivity + | simplify. + reflexivity + ]*) + | simplify. + autobatch + (*rewrite < plus_n_Sm. + rewrite < plus_n_Sm. + rewrite < sym_plus. + reflexivity*) + ] +] +qed. + +theorem Zpred_Zplus_neg_O : \forall z:Z. Zpred z = (neg O)+z. +intros. +elim z +[ autobatch + (*simplify. + reflexivity*) +| elim n;autobatch + (*[ simplify. + reflexivity + | simplify. + reflexivity + ]*) +| simplify. + reflexivity +] +qed. + +theorem Zsucc_Zplus_pos_O : \forall z:Z. Zsucc z = (pos O)+z. +intros. +elim z +[ autobatch + (*simplify. + reflexivity*) +| autobatch + (*simplify. + reflexivity*) +| elim n;autobatch + (*[ simplify. + reflexivity + | simplify. + reflexivity + ]*) +] +qed. + +theorem Zplus_pos_pos: +\forall n,m. (pos n)+(pos m) = (Zsucc (pos n))+(Zpred (pos m)). +intros. +elim n +[ elim m;autobatch + (*[ simplify. + reflexivity + | simplify. + reflexivity + ]*) +| elim m + [ autobatch + (*simplify. + rewrite < plus_n_Sm. + rewrite < plus_n_O. + reflexivity*) + | simplify. + autobatch + (*rewrite < plus_n_Sm. + rewrite < plus_n_Sm. + reflexivity*) + ] +] +qed. + +theorem Zplus_pos_neg: +\forall n,m. (pos n)+(neg m) = (Zsucc (pos n))+(Zpred (neg m)). +intros. +reflexivity. +qed. + +theorem Zplus_neg_pos : +\forall n,m. (neg n)+(pos m) = (Zsucc (neg n))+(Zpred (pos m)). +intros. +elim n +[ elim m;autobatch + (*[ simplify. + reflexivity + | simplify. + reflexivity + ]*) +| elim m;autobatch + (*[ simplify. + reflexivity + | simplify. + reflexivity + ]*) +] +qed. + +theorem Zplus_neg_neg: +\forall n,m. (neg n)+(neg m) = (Zsucc (neg n))+(Zpred (neg m)). +intros. +elim n +[ autobatch + (*elim m + [ simplify. + reflexivity + | simplify. + reflexivity + ]*) +| elim m + [ autobatch + (*simplify. + rewrite > plus_n_Sm. + reflexivity*) + | simplify. + autobatch + (*rewrite > plus_n_Sm. + reflexivity*) + ] +] +qed. + +theorem Zplus_Zsucc_Zpred: +\forall x,y. x+y = (Zsucc x)+(Zpred y). +intros. +elim x +[ autobatch + (*elim y + [ simplify. + reflexivity + | rewrite < Zsucc_Zplus_pos_O. + rewrite > Zsucc_Zpred. + reflexivity + | simplify. + reflexivity + ]*) +| elim y;autobatch + (*[ simplify. + reflexivity + | apply Zplus_pos_pos + | apply Zplus_pos_neg + ]*) +| elim y;autobatch + (*[ rewrite < sym_Zplus. + rewrite < (sym_Zplus (Zpred OZ)). + rewrite < Zpred_Zplus_neg_O. + rewrite > Zpred_Zsucc. + simplify. + reflexivity + | apply Zplus_neg_pos + | rewrite < Zplus_neg_neg. + reflexivity + ]*) +] +qed. + +theorem Zplus_Zsucc_pos_pos : +\forall n,m. (Zsucc (pos n))+(pos m) = Zsucc ((pos n)+(pos m)). +intros. +reflexivity. +qed. + +theorem Zplus_Zsucc_pos_neg: +\forall n,m. (Zsucc (pos n))+(neg m) = (Zsucc ((pos n)+(neg m))). +intros. +apply (nat_elim2 +(\lambda n,m. (Zsucc (pos n))+(neg m) = (Zsucc ((pos n)+(neg m))))) +[ intro. + elim n1;autobatch + (*[ simplify. + reflexivity + | elim n2; simplify; reflexivity + ]*) +| intros. + autobatch + (*elim n1;simplify;reflexivity*) +| intros. + rewrite < (Zplus_pos_neg ? m1). + elim H. + reflexivity +] +qed. + +theorem Zplus_Zsucc_neg_neg : +\forall n,m. Zsucc (neg n) + neg m = Zsucc (neg n + neg m). +intros. +apply (nat_elim2 +(\lambda n,m. Zsucc (neg n) + neg m = Zsucc (neg n + neg m))) +[ intros. + autobatch + (*elim n1 + [ simplify. + reflexivity + | elim n2;simplify;reflexivity + ]*) +| intros. + autobatch + (*elim n1;simplify;reflexivity*) +| intros. + autobatch. + (*rewrite < (Zplus_neg_neg ? m1). + reflexivity*) +] +qed. + +theorem Zplus_Zsucc_neg_pos: +\forall n,m. Zsucc (neg n)+(pos m) = Zsucc ((neg n)+(pos m)). +intros. +apply (nat_elim2 +(\lambda n,m. Zsucc (neg n) + (pos m) = Zsucc (neg n + pos m))) +[ intros. + autobatch + (*elim n1 + [ simplify. + reflexivity + | elim n2;simplify;reflexivity + ]*) +| intros. + autobatch + (*elim n1;simplify;reflexivity*) +| intros. + autobatch + (*rewrite < H. + rewrite < (Zplus_neg_pos ? (S m1)). + reflexivity*) +] +qed. + +theorem Zplus_Zsucc : \forall x,y:Z. (Zsucc x)+y = Zsucc (x+y). +intros. +elim x +[ autobatch + (*elim y + [ simplify. + reflexivity + | simplify. + reflexivity + | rewrite < Zsucc_Zplus_pos_O. + reflexivity + ]*) +| elim y;autobatch + (*[ rewrite < (sym_Zplus OZ). + reflexivity + | apply Zplus_Zsucc_pos_pos + | apply Zplus_Zsucc_pos_neg + ]*) +| elim y;autobatch + (*[ rewrite < sym_Zplus. + rewrite < (sym_Zplus OZ). + simplify. + reflexivity + | apply Zplus_Zsucc_neg_pos + | apply Zplus_Zsucc_neg_neg + ]*) +] +qed. + +theorem Zplus_Zpred: \forall x,y:Z. (Zpred x)+y = Zpred (x+y). +intros. +cut (Zpred (x+y) = Zpred ((Zsucc (Zpred x))+y));autobatch. +(*[ rewrite > Hcut. + rewrite > Zplus_Zsucc. + rewrite > Zpred_Zsucc. + reflexivity +| rewrite > Zsucc_Zpred. + reflexivity +]*) +qed. + + +theorem associative_Zplus: associative Z Zplus. +change with (\forall x,y,z:Z. (x + y) + z = x + (y + z)). +(* simplify. *) +intros. +elim x +[ autobatch + (*simplify. + reflexivity*) +| elim n + [ rewrite < Zsucc_Zplus_pos_O. + autobatch + (*rewrite < Zsucc_Zplus_pos_O. + rewrite > Zplus_Zsucc. + reflexivity*) + | rewrite > (Zplus_Zsucc (pos n1)). + rewrite > (Zplus_Zsucc (pos n1)). + autobatch + (*rewrite > (Zplus_Zsucc ((pos n1)+y)). + apply eq_f. + assumption*) + ] +| elim n + [ rewrite < (Zpred_Zplus_neg_O (y+z)). + autobatch + (*rewrite < (Zpred_Zplus_neg_O y). + rewrite < Zplus_Zpred. + reflexivity*) + | rewrite > (Zplus_Zpred (neg n1)). + rewrite > (Zplus_Zpred (neg n1)). + autobatch + (*rewrite > (Zplus_Zpred ((neg n1)+y)). + apply eq_f. + assumption*) + ] +] +qed. + +variant assoc_Zplus : \forall x,y,z:Z. (x+y)+z = x+(y+z) +\def associative_Zplus. + +(* Zopp *) +definition Zopp : Z \to Z \def +\lambda x:Z. match x with +[ OZ \Rightarrow OZ +| (pos n) \Rightarrow (neg n) +| (neg n) \Rightarrow (pos n) ]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "integer unary minus" 'uminus x = (cic:/matita/library_autobatch/Z/plus/Zopp.con x). + +theorem Zopp_Zplus: \forall x,y:Z. -(x+y) = -x + -y. +intros. +elim x +[ elim y;autobatch + (*simplify;reflexivity*) +| elim y + [ autobatch + (*simplify. + reflexivity*) + | autobatch + (*simplify. + reflexivity*) + | simplify. + apply nat_compare_elim; + intro;autobatch (*simplify;reflexivity*) + ] +| elim y + [ autobatch + (*simplify. + reflexivity*) + | simplify. + apply nat_compare_elim; + intro;autobatch + (*simplify;reflexivity*) + | autobatch + (*simplify. + reflexivity*) + ] +] +qed. + +theorem Zopp_Zopp: \forall x:Z. --x = x. +intro. +elim x;reflexivity. +qed. + +theorem Zplus_Zopp: \forall x:Z. x+ -x = OZ. +intro. +elim x +[ apply refl_eq +| simplify. + rewrite > nat_compare_n_n. + autobatch + (*simplify. + apply refl_eq*) +| simplify. + rewrite > nat_compare_n_n. + autobatch + (*simplify. + apply refl_eq*) +] +qed. + +(* minus *) +definition Zminus : Z \to Z \to Z \def \lambda x,y:Z. x + (-y). + +interpretation "integer minus" 'minus x y = (cic:/matita/library_autobatch/Z/plus/Zminus.con x y). diff --git a/matita/library_auto/auto/Z/times.ma b/matita/library_auto/auto/Z/times.ma new file mode 100644 index 000000000..1fa633d9f --- /dev/null +++ b/matita/library_auto/auto/Z/times.ma @@ -0,0 +1,352 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/Z/times". + +include "auto/nat/lt_arith.ma". +include "auto/Z/plus.ma". + +definition Ztimes :Z \to Z \to Z \def +\lambda x,y. + match x with + [ OZ \Rightarrow OZ + | (pos m) \Rightarrow + match y with + [ OZ \Rightarrow OZ + | (pos n) \Rightarrow (pos (pred ((S m) * (S n)))) + | (neg n) \Rightarrow (neg (pred ((S m) * (S n))))] + | (neg m) \Rightarrow + match y with + [ OZ \Rightarrow OZ + | (pos n) \Rightarrow (neg (pred ((S m) * (S n)))) + | (neg n) \Rightarrow (pos (pred ((S m) * (S n))))]]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "integer times" 'times x y = (cic:/matita/library_autobatch/Z/times/Ztimes.con x y). + +theorem Ztimes_z_OZ: \forall z:Z. z*OZ = OZ. +intro. +elim z;autobatch. + (*simplify;reflexivity.*) +qed. + +theorem Ztimes_neg_Zopp: \forall n:nat.\forall x:Z. +neg n * x = - (pos n * x). +intros. +elim x;autobatch. + (*simplify;reflexivity.*) +qed. + +theorem symmetric_Ztimes : symmetric Z Ztimes. +change with (\forall x,y:Z. x*y = y*x). +intros. +elim x +[ autobatch + (*rewrite > Ztimes_z_OZ. + reflexivity*) +| elim y + [ autobatch + (*simplify. + reflexivity*) + | change with (pos (pred ((S n) * (S n1))) = pos (pred ((S n1) * (S n)))). + autobatch + (*rewrite < sym_times. + reflexivity*) + | change with (neg (pred ((S n) * (S n1))) = neg (pred ((S n1) * (S n)))). + autobatch + (*rewrite < sym_times. + reflexivity*) + ] +| elim y + [ autobatch + (*simplify. + reflexivity*) + | change with (neg (pred ((S n) * (S n1))) = neg (pred ((S n1) * (S n)))). + autobatch + (*rewrite < sym_times. + reflexivity*) + | change with (pos (pred ((S n) * (S n1))) = pos (pred ((S n1) * (S n)))). + autobatch + (*rewrite < sym_times. + reflexivity*) + ] +] +qed. + +variant sym_Ztimes : \forall x,y:Z. x*y = y*x +\def symmetric_Ztimes. + +theorem associative_Ztimes: associative Z Ztimes. +unfold associative. +intros. +elim x +[ autobatch + (*simplify. + reflexivity*) +| elim y + [ autobatch + (*simplify. + reflexivity*) + | elim z + [ autobatch + (*simplify. + reflexivity*) + | change with + (pos (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + pos (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred + [ rewrite < S_pred;autobatch + (*[ rewrite < assoc_times. + reflexivity + | apply lt_O_times_S_S + ]*) + | apply lt_O_times_S_S + ] + | change with + (neg (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + neg (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred + [ rewrite < S_pred;autobatch + (*[ rewrite < assoc_times. + reflexivity + | apply lt_O_times_S_S + ]*) + | apply lt_O_times_S_S + ] + ] + | elim z + [ autobatch + (*simplify. + reflexivity*) + | change with + (neg (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + neg (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred + [ rewrite < S_pred;autobatch + (*[ rewrite < assoc_times. + reflexivity + | apply lt_O_times_S_S + ]*) + | apply lt_O_times_S_S + ] + | change with + (pos (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + pos(pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred + [ rewrite < S_pred;autobatch + (*[ rewrite < assoc_times. + reflexivity + | apply lt_O_times_S_S + ]*) + | apply lt_O_times_S_S + ] + ] + ] +| elim y + [ autobatch + (*simplify. + reflexivity*) + | elim z + [ autobatch + (*simplify. + reflexivity*) + | change with + (neg (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + neg (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred + [ rewrite < S_pred;autobatch + (*[ rewrite < assoc_times. + reflexivity + | apply lt_O_times_S_S + ]*) + | apply lt_O_times_S_S + ] + | change with + (pos (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + pos (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred + [ rewrite < S_pred;autobatch + (*[ rewrite < assoc_times. + reflexivity + | apply lt_O_times_S_S + ]*) + | apply lt_O_times_S_S + ] + ] + | elim z + [ autobatch + (*simplify. + reflexivity*) + | change with + (pos (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + pos (pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred + [ rewrite < S_pred;autobatch + (*[ rewrite < assoc_times. + reflexivity + | apply lt_O_times_S_S + ]*) + | apply lt_O_times_S_S + ] + | change with + (neg (pred ((S (pred ((S n) * (S n1)))) * (S n2))) = + neg(pred ((S n) * (S (pred ((S n1) * (S n2))))))). + rewrite < S_pred + [ rewrite < S_pred;autobatch + (*[ rewrite < assoc_times. + reflexivity + | apply lt_O_times_S_S + ]*) + | apply lt_O_times_S_S + ] + ] + ] +] +qed. + +variant assoc_Ztimes : \forall x,y,z:Z. +(x * y) * z = x * (y * z) \def +associative_Ztimes. + +lemma times_minus1: \forall n,p,q:nat. lt q p \to +(S n) * (S (pred ((S p) - (S q)))) = +pred ((S n) * (S p)) - pred ((S n) * (S q)). +intros. +rewrite < S_pred +[ rewrite > minus_pred_pred + [ autobatch + (*rewrite < distr_times_minus. + reflexivity*) + + (* we now close all positivity conditions *) + | apply lt_O_times_S_S + | apply lt_O_times_S_S + ] +| unfold lt.autobatch + (*simplify. + unfold lt. + apply le_SO_minus. + exact H*) +] +qed. + +lemma Ztimes_Zplus_pos_neg_pos: \forall n,p,q:nat. +(pos n)*((neg p)+(pos q)) = (pos n)*(neg p)+ (pos n)*(pos q). +intros. +simplify. +change in match (p + n * (S p)) with (pred ((S n) * (S p))). +change in match (q + n * (S q)) with (pred ((S n) * (S q))). +rewrite < nat_compare_pred_pred +[ rewrite < nat_compare_times_l. + rewrite < nat_compare_S_S. + apply (nat_compare_elim p q) + [ intro. + (* uff *) + change with (pos (pred ((S n) * (S (pred ((S q) - (S p)))))) = + pos (pred ((pred ((S n) * (S q))) - (pred ((S n) * (S p)))))). + rewrite < (times_minus1 n q p H). + reflexivity + | intro. + autobatch + (*rewrite < H. + simplify. + reflexivity*) + | intro. + change with (neg (pred ((S n) * (S (pred ((S p) - (S q)))))) = + neg (pred ((pred ((S n) * (S p))) - (pred ((S n) * (S q)))))). + rewrite < (times_minus1 n p q H). + reflexivity + ] + (* two more positivity conditions from nat_compare_pred_pred *) + +| apply lt_O_times_S_S +| apply lt_O_times_S_S +] +qed. + +lemma Ztimes_Zplus_pos_pos_neg: \forall n,p,q:nat. +(pos n)*((pos p)+(neg q)) = (pos n)*(pos p)+ (pos n)*(neg q). +intros. +autobatch. +(*rewrite < sym_Zplus. +rewrite > Ztimes_Zplus_pos_neg_pos. +apply sym_Zplus.*) +qed. + +lemma distributive2_Ztimes_pos_Zplus: +distributive2 nat Z (\lambda n,z. (pos n) * z) Zplus. +change with (\forall n,y,z. +(pos n) * (y + z) = (pos n) * y + (pos n) * z). +intros. +elim y +[ reflexivity +| elim z + [ reflexivity + | change with + (pos (pred ((S n) * ((S n1) + (S n2)))) = + pos (pred ((S n) * (S n1) + (S n) * (S n2)))). + autobatch + (*rewrite < distr_times_plus. + reflexivity*) + | apply Ztimes_Zplus_pos_pos_neg + ] +| elim z + [ reflexivity + | apply Ztimes_Zplus_pos_neg_pos + | change with + (neg (pred ((S n) * ((S n1) + (S n2)))) = + neg (pred ((S n) * (S n1) + (S n) * (S n2)))). + autobatch + (*rewrite < distr_times_plus. + reflexivity*) + ] +] +qed. + +variant distr_Ztimes_Zplus_pos: \forall n,y,z. +(pos n) * (y + z) = ((pos n) * y + (pos n) * z) \def +distributive2_Ztimes_pos_Zplus. + +lemma distributive2_Ztimes_neg_Zplus : +distributive2 nat Z (\lambda n,z. (neg n) * z) Zplus. +change with (\forall n,y,z. +(neg n) * (y + z) = (neg n) * y + (neg n) * z). +intros. +rewrite > Ztimes_neg_Zopp. +rewrite > distr_Ztimes_Zplus_pos. +autobatch. +(*rewrite > Zopp_Zplus. +rewrite < Ztimes_neg_Zopp. +rewrite < Ztimes_neg_Zopp. +reflexivity.*) +qed. + +variant distr_Ztimes_Zplus_neg: \forall n,y,z. +(neg n) * (y + z) = (neg n) * y + (neg n) * z \def +distributive2_Ztimes_neg_Zplus. + +theorem distributive_Ztimes_Zplus: distributive Z Ztimes Zplus. +change with (\forall x,y,z:Z. x * (y + z) = x*y + x*z). +intros. +elim x;autobatch. +(*[ simplify. + reflexivity +| apply distr_Ztimes_Zplus_pos +| apply distr_Ztimes_Zplus_neg +]*) +qed. + +variant distr_Ztimes_Zplus: \forall x,y,z. +x * (y + z) = x*y + x*z \def +distributive_Ztimes_Zplus. diff --git a/matita/library_auto/auto/Z/z.ma b/matita/library_auto/auto/Z/z.ma new file mode 100644 index 000000000..079d5701b --- /dev/null +++ b/matita/library_auto/auto/Z/z.ma @@ -0,0 +1,251 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/Z/z". + +include "datatypes/bool.ma". +include "auto/nat/nat.ma". + +inductive Z : Set \def + OZ : Z +| pos : nat \to Z +| neg : nat \to Z. + +definition Z_of_nat \def +\lambda n. match n with +[ O \Rightarrow OZ +| (S n)\Rightarrow pos n]. + +coercion cic:/matita/library_autobatch/Z/z/Z_of_nat.con. + +definition neg_Z_of_nat \def +\lambda n. match n with +[ O \Rightarrow OZ +| (S n)\Rightarrow neg n]. + +definition abs \def +\lambda z. + match z with +[ OZ \Rightarrow O +| (pos n) \Rightarrow (S n) +| (neg n) \Rightarrow (S n)]. + +definition OZ_test \def +\lambda z. +match z with +[ OZ \Rightarrow true +| (pos n) \Rightarrow false +| (neg n) \Rightarrow false]. + +theorem OZ_test_to_Prop :\forall z:Z. +match OZ_test z with +[true \Rightarrow z=OZ +|false \Rightarrow z \neq OZ]. +intros. +elim z +[ (*qui autobatch non chiude il goal*) + simplify. + reflexivity +| simplify. + unfold Not. + intros (H). + (*qui autobatch non chiude il goal*) + destruct H +| simplify. + unfold Not. + intros (H). + (*qui autobatch non chiude il goal*) + destruct H +] +qed. + +(* discrimination *) +theorem injective_pos: injective nat Z pos. +unfold injective. +intros. +apply inj_S. +change with (abs (pos x) = abs (pos y)). +autobatch. +(*apply eq_f. +assumption.*) +qed. + +variant inj_pos : \forall n,m:nat. pos n = pos m \to n = m +\def injective_pos. + +theorem injective_neg: injective nat Z neg. +unfold injective. +intros. +apply inj_S. +change with (abs (neg x) = abs (neg y)). +autobatch. +(*apply eq_f. +assumption.*) +qed. + +variant inj_neg : \forall n,m:nat. neg n = neg m \to n = m +\def injective_neg. + +theorem not_eq_OZ_pos: \forall n:nat. OZ \neq pos n. +unfold Not. +intros (n H). +(*qui autobatch non chiude il goal*) +destruct H. +qed. + +theorem not_eq_OZ_neg :\forall n:nat. OZ \neq neg n. +unfold Not. +intros (n H). +(*qui autobatch non chiude il goal*) +destruct H. +qed. + +theorem not_eq_pos_neg :\forall n,m:nat. pos n \neq neg m. +unfold Not. +intros (n m H). +(*qui autobatch non chiude il goal*) +destruct H. +qed. + +theorem decidable_eq_Z : \forall x,y:Z. decidable (x=y). +intros. +unfold decidable. +elim x +[ (* goal: x=OZ *) + elim y + [ (* goal: x=OZ y=OZ *) + autobatch + (*left. + reflexivity*) + | (* goal: x=OZ 2=2 *) + autobatch + (*right. + apply not_eq_OZ_pos*) + | (* goal: x=OZ 2=3 *) + autobatch + (*right. + apply not_eq_OZ_neg*) + ] +| (* goal: x=pos *) + elim y + [ (* goal: x=pos y=OZ *) + right. + unfold Not. + intro. + apply (not_eq_OZ_pos n). + autobatch + (*symmetry. + assumption*) + | (* goal: x=pos y=pos *) + elim (decidable_eq_nat n n1:((n=n1) \lor ((n=n1) \to False))) + [ autobatch + (*left. + apply eq_f. + assumption*) + | right. + unfold Not. + intros (H_inj). + autobatch + (*apply H. + destruct H_inj. + assumption*) + ] + | (* goal: x=pos y=neg *) + autobatch + (*right. + unfold Not. + intro. + apply (not_eq_pos_neg n n1). + assumption*) + ] +| (* goal: x=neg *) + elim y + [ (* goal: x=neg y=OZ *) + right. + unfold Not. + intro. + apply (not_eq_OZ_neg n). + autobatch + (*symmetry. + assumption*) + | (* goal: x=neg y=pos *) + right. + unfold Not. + intro. + apply (not_eq_pos_neg n1 n). + autobatch + (*symmetry. + assumption*) + | (* goal: x=neg y=neg *) + elim (decidable_eq_nat n n1:((n=n1) \lor ((n=n1) \to False))) + [ autobatch + (*left. + apply eq_f. + assumption*) + | right. + unfold Not. + intro. + autobatch + (*apply H. + apply injective_neg. + assumption*) + ] + ] +] +qed. + +(* end discrimination *) + +definition Zsucc \def +\lambda z. match z with +[ OZ \Rightarrow pos O +| (pos n) \Rightarrow pos (S n) +| (neg n) \Rightarrow + match n with + [ O \Rightarrow OZ + | (S p) \Rightarrow neg p]]. + +definition Zpred \def +\lambda z. match z with +[ OZ \Rightarrow neg O +| (pos n) \Rightarrow + match n with + [ O \Rightarrow OZ + | (S p) \Rightarrow pos p] +| (neg n) \Rightarrow neg (S n)]. + +theorem Zpred_Zsucc: \forall z:Z. Zpred (Zsucc z) = z. +intros. +elim z +[ reflexivity +| reflexivity +| elim n + [ reflexivity + | reflexivity + ] +] +qed. + +theorem Zsucc_Zpred: \forall z:Z. Zsucc (Zpred z) = z. +intros. +elim z +[ reflexivity +| elim n + [ reflexivity + | reflexivity + ] +| reflexivity +] +qed. + diff --git a/matita/library_auto/auto/nat/chinese_reminder.ma b/matita/library_auto/auto/nat/chinese_reminder.ma new file mode 100644 index 000000000..809881034 --- /dev/null +++ b/matita/library_auto/auto/nat/chinese_reminder.ma @@ -0,0 +1,364 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/chinese_reminder". + +include "auto/nat/exp.ma". +include "auto/nat/gcd.ma". +include "auto/nat/permutation.ma". +include "auto/nat/congruence.ma". + +theorem and_congruent_congruent: \forall m,n,a,b:nat. O < n \to O < m \to +gcd n m = (S O) \to ex nat (\lambda x. congruent x a m \land congruent x b n). +intros. +cut (\exists c,d.c*n - d*m = (S O) \lor d*m - c*n = (S O)) +[ elim Hcut. + elim H3. + elim H4 + [ + apply (ex_intro nat ? ((a+b*m)*a1*n-b*a2*m)). + split + [ (* congruent to a *) + cut (a1*n = a2*m + (S O)) + [ rewrite > assoc_times. + rewrite > Hcut1. + rewrite < (sym_plus ? (a2*m)). + rewrite > distr_times_plus. + rewrite < times_n_SO. + rewrite > assoc_plus. + rewrite < assoc_times. + rewrite < times_plus_l. + rewrite > eq_minus_plus_plus_minus + [ autobatch + (*rewrite < times_minus_l. + rewrite > sym_plus. + apply (eq_times_plus_to_congruent ? ? ? ((b+(a+b*m)*a2)-b*a2)) + [ assumption + | reflexivity + ]*) + | apply le_times_l. + apply (trans_le ? ((a+b*m)*a2)) + [ apply le_times_l. + apply (trans_le ? (b*m));autobatch + (*[ rewrite > times_n_SO in \vdash (? % ?). + apply le_times_r. + assumption + | apply le_plus_n + ]*) + | apply le_plus_n + ] + ] + | apply minus_to_plus + [ apply lt_to_le. + change with (O + a2*m < a1*n). + apply lt_minus_to_plus. + autobatch + (*rewrite > H5. + unfold lt. + apply le_n*) + | assumption + ] + ] + | (* congruent to b *) + cut (a2*m = a1*n - (S O)) + [ rewrite > (assoc_times b a2). + rewrite > Hcut1. + rewrite > distr_times_minus. + rewrite < assoc_times. + rewrite < eq_plus_minus_minus_minus + [ autobatch + (*rewrite < times_n_SO. + rewrite < times_minus_l. + rewrite < sym_plus. + apply (eq_times_plus_to_congruent ? ? ? ((a+b*m)*a1-b*a1)) + [ assumption + | reflexivity + ]*) + | rewrite > assoc_times. + apply le_times_r. + (*autobatch genera un'esecuzione troppo lunga*) + apply (trans_le ? (a1*n - a2*m));autobatch + (*[ rewrite > H5. + apply le_n + | apply (le_minus_m ? (a2*m)) + ]*) + | apply le_times_l. + apply le_times_l. + autobatch + (*apply (trans_le ? (b*m)) + [ rewrite > times_n_SO in \vdash (? % ?). + apply le_times_r. + assumption + | apply le_plus_n + ]*) + ] + | apply sym_eq. + apply plus_to_minus. + rewrite > sym_plus. + apply minus_to_plus + [ apply lt_to_le. + change with (O + a2*m < a1*n). + apply lt_minus_to_plus. + autobatch + (*rewrite > H5. + unfold lt. + apply le_n*) + | assumption + ] + ] + ] + | (* and now the symmetric case; the price to pay for working + in nat instead than Z *) + apply (ex_intro nat ? ((b+a*n)*a2*m-a*a1*n)). + split + [(* congruent to a *) + cut (a1*n = a2*m - (S O)) + [ rewrite > (assoc_times a a1). + rewrite > Hcut1. + rewrite > distr_times_minus. + rewrite < assoc_times. + rewrite < eq_plus_minus_minus_minus + [ autobatch + (*rewrite < times_n_SO. + rewrite < times_minus_l. + rewrite < sym_plus. + apply (eq_times_plus_to_congruent ? ? ? ((b+a*n)*a2-a*a2)) + [ assumption + | reflexivity + ]*) + | rewrite > assoc_times. + apply le_times_r. + apply (trans_le ? (a2*m - a1*n));autobatch + (*[ rewrite > H5. + apply le_n + | apply (le_minus_m ? (a1*n)) + ]*) + | rewrite > assoc_times. + rewrite > assoc_times. + apply le_times_l. + autobatch + (*apply (trans_le ? (a*n)) + [ rewrite > times_n_SO in \vdash (? % ?). + apply le_times_r. + assumption. + | apply le_plus_n. + ]*) + ] + | apply sym_eq. + apply plus_to_minus. + rewrite > sym_plus. + apply minus_to_plus + [ apply lt_to_le. + change with (O + a1*n < a2*m). + apply lt_minus_to_plus. + autobatch + (*rewrite > H5. + unfold lt. + apply le_n*) + | assumption + ] + ] + | (* congruent to b *) + cut (a2*m = a1*n + (S O)) + [ rewrite > assoc_times. + rewrite > Hcut1. + rewrite > (sym_plus (a1*n)). + rewrite > distr_times_plus. + rewrite < times_n_SO. + rewrite < assoc_times. + rewrite > assoc_plus. + rewrite < times_plus_l. + rewrite > eq_minus_plus_plus_minus + [ autobatch + (*rewrite < times_minus_l. + rewrite > sym_plus. + apply (eq_times_plus_to_congruent ? ? ? ((a+(b+a*n)*a1)-a*a1)) + [ assumption + | reflexivity + ]*) + | apply le_times_l. + apply (trans_le ? ((b+a*n)*a1)) + [ apply le_times_l. + autobatch + (*apply (trans_le ? (a*n)) + [ rewrite > times_n_SO in \vdash (? % ?). + apply le_times_r. + assumption + | apply le_plus_n + ]*) + | apply le_plus_n + ] + ] + | apply minus_to_plus + [ apply lt_to_le. + change with (O + a1*n < a2*m). + apply lt_minus_to_plus. + autobatch + (*rewrite > H5. + unfold lt. + apply le_n*) + | assumption + ] + ] + ] + ] +(* proof of the cut *) +| (* qui autobatch non conclude il goal *) + rewrite < H2. + apply eq_minus_gcd +] +qed. + +theorem and_congruent_congruent_lt: \forall m,n,a,b:nat. O < n \to O < m \to +gcd n m = (S O) \to +ex nat (\lambda x. (congruent x a m \land congruent x b n) \land + (x < m*n)). +intros. +elim (and_congruent_congruent m n a b) +[ elim H3. + apply (ex_intro ? ? (a1 \mod (m*n))). + split + [ split + [ apply (transitive_congruent m ? a1) + [ unfold congruent. + apply sym_eq. + change with (congruent a1 (a1 \mod (m*n)) m). + rewrite < sym_times. + autobatch + (*apply congruent_n_mod_times;assumption*) + | assumption + ] + | apply (transitive_congruent n ? a1) + [ unfold congruent. + apply sym_eq. + change with (congruent a1 (a1 \mod (m*n)) n). + autobatch + (*apply congruent_n_mod_times;assumption*) + | assumption + ] + ] + | apply lt_mod_m_m. + autobatch + (*rewrite > (times_n_O O). + apply lt_times;assumption*) + ] +| assumption +| assumption +| assumption +] +qed. + +definition cr_pair : nat \to nat \to nat \to nat \to nat \def +\lambda n,m,a,b. +min (pred (n*m)) (\lambda x. andb (eqb (x \mod n) a) (eqb (x \mod m) b)). + +theorem cr_pair1: cr_pair (S (S O)) (S (S (S O))) O O = O. +reflexivity. +qed. + +theorem cr_pair2: cr_pair (S(S O)) (S(S(S O))) (S O) O = (S(S(S O))). +autobatch. +(*simplify. +reflexivity.*) +qed. + +theorem cr_pair3: cr_pair (S(S O)) (S(S(S O))) (S O) (S(S O)) = (S(S(S(S(S O))))). +reflexivity. +qed. + +theorem cr_pair4: cr_pair (S(S(S(S(S O))))) (S(S(S(S(S(S(S O))))))) (S(S(S O))) (S(S O)) = +(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S(S O))))))))))))))))))))))). +reflexivity. +qed. + +theorem mod_cr_pair : \forall m,n,a,b. a \lt m \to b \lt n \to +gcd n m = (S O) \to +(cr_pair m n a b) \mod m = a \land (cr_pair m n a b) \mod n = b. +intros. +cut (andb (eqb ((cr_pair m n a b) \mod m) a) + (eqb ((cr_pair m n a b) \mod n) b) = true) +[ generalize in match Hcut. + apply andb_elim. + apply eqb_elim;intro + [ rewrite > H3. + simplify. + intro. + autobatch + (*split + [ reflexivity + | apply eqb_true_to_eq. + assumption + ]*) + | simplify. + intro. + (* l'invocazione di autobatch qui genera segmentation fault *) + apply False_ind. + (* l'invocazione di autobatch qui genera segmentation fault *) + apply not_eq_true_false. + (* l'invocazione di autobatch qui genera segmentation fault *) + apply sym_eq. + assumption + ] +| apply (f_min_aux_true + (\lambda x. andb (eqb (x \mod m) a) (eqb (x \mod n) b)) (pred (m*n)) (pred (m*n))). + elim (and_congruent_congruent_lt m n a b) + [ apply (ex_intro ? ? a1). + split + [ split + [ autobatch + (*rewrite < minus_n_n. + apply le_O_n*) + | elim H3. + apply le_S_S_to_le. + apply (trans_le ? (m*n)) + [ assumption + | apply (nat_case (m*n)) + [ apply le_O_n + | intro. + autobatch + (*rewrite < pred_Sn. + apply le_n*) + ] + ] + ] + | elim H3. + elim H4. + apply andb_elim. + cut (a1 \mod m = a) + [ cut (a1 \mod n = b) + [ rewrite > (eq_to_eqb_true ? ? Hcut). + rewrite > (eq_to_eqb_true ? ? Hcut1). + (* l'invocazione di autobatch qui non chiude il goal *) + simplify. + reflexivity + | rewrite < (lt_to_eq_mod b n); + assumption + ] + | rewrite < (lt_to_eq_mod a m);assumption + ] + ] + | autobatch + (*apply (le_to_lt_to_lt ? b) + [ apply le_O_n + | assumption + ]*) + | autobatch + (*apply (le_to_lt_to_lt ? a) + [ apply le_O_n + | assumption + ]*) + | assumption + ] +] +qed. \ No newline at end of file diff --git a/matita/library_auto/auto/nat/compare.ma b/matita/library_auto/auto/nat/compare.ma new file mode 100644 index 000000000..dca43d1ec --- /dev/null +++ b/matita/library_auto/auto/nat/compare.ma @@ -0,0 +1,320 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/compare". + +include "datatypes/bool.ma". +include "datatypes/compare.ma". +include "auto/nat/orders.ma". + +let rec eqb n m \def +match n with + [ O \Rightarrow + match m with + [ O \Rightarrow true + | (S q) \Rightarrow false] + | (S p) \Rightarrow + match m with + [ O \Rightarrow false + | (S q) \Rightarrow eqb p q]]. + +theorem eqb_to_Prop: \forall n,m:nat. +match (eqb n m) with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m]. +intros. +apply (nat_elim2 +(\lambda n,m:nat.match (eqb n m) with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m])) +[ intro. + elim n1;simplify;autobatch + (*[ simplify + reflexivity + | simplify. + apply not_eq_O_S + ]*) +| intro. + simplify. + unfold Not. + intro. + apply (not_eq_O_S n1). + autobatch + (*apply sym_eq. + assumption*) +| intros. + simplify. + generalize in match H. + elim ((eqb n1 m1));simplify + [ apply eq_f. + apply H1 + | unfold Not. + intro. + apply H1. + autobatch + (*apply inj_S. + assumption*) + ] +] +qed. + +theorem eqb_elim : \forall n,m:nat.\forall P:bool \to Prop. +(n=m \to (P true)) \to (n \neq m \to (P false)) \to (P (eqb n m)). +intros. +cut +(match (eqb n m) with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m] \to (P (eqb n m))) +[ apply Hcut. + (* qui autobatch non conclude il goal*) + apply eqb_to_Prop +| elim (eqb n m) + [ (*qui autobatch non conclude il goal*) + apply ((H H2)) + | (*qui autobatch non conclude il goal*) + apply ((H1 H2)) + ] +] +qed. + +theorem eqb_n_n: \forall n. eqb n n = true. +intro. +elim n;simplify;autobatch. +(*[ simplify.reflexivity +| simplify.assumption. +]*) +qed. + +theorem eqb_true_to_eq: \forall n,m:nat. +eqb n m = true \to n = m. +intros. +change with +match true with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m]. +rewrite < H. +(*qui autobatch non conclude il goal*) +apply eqb_to_Prop. +qed. + +theorem eqb_false_to_not_eq: \forall n,m:nat. +eqb n m = false \to n \neq m. +intros. +change with +match false with +[ true \Rightarrow n = m +| false \Rightarrow n \neq m]. +rewrite < H. +(*qui autobatch non conclude il goal*) +apply eqb_to_Prop. +qed. + +theorem eq_to_eqb_true: \forall n,m:nat. +n = m \to eqb n m = true. +intros. +autobatch. +(*apply (eqb_elim n m) +[ intros. reflexivity +| intros.apply False_ind.apply (H1 H) +]*) +qed. + +theorem not_eq_to_eqb_false: \forall n,m:nat. +\lnot (n = m) \to eqb n m = false. +intros.apply (eqb_elim n m);intros +[ apply False_ind. + apply (H H1) +| reflexivity +] +qed. + +let rec leb n m \def +match n with + [ O \Rightarrow true + | (S p) \Rightarrow + match m with + [ O \Rightarrow false + | (S q) \Rightarrow leb p q]]. + +theorem leb_to_Prop: \forall n,m:nat. +match (leb n m) with +[ true \Rightarrow n \leq m +| false \Rightarrow n \nleq m]. +intros. +apply (nat_elim2 +(\lambda n,m:nat.match (leb n m) with +[ true \Rightarrow n \leq m +| false \Rightarrow n \nleq m])) +[ simplify. + exact le_O_n +| simplify. + exact not_le_Sn_O +| intros 2. + simplify. + elim ((leb n1 m1));simplify + [ apply le_S_S. + (*qui autobatch non conclude il goal*) + apply H + | unfold Not. + intros. + apply H. + autobatch + (*apply le_S_S_to_le. + assumption*) + ] +] +qed. + +theorem leb_elim: \forall n,m:nat. \forall P:bool \to Prop. +(n \leq m \to (P true)) \to (n \nleq m \to (P false)) \to +P (leb n m). +intros. +cut +(match (leb n m) with +[ true \Rightarrow n \leq m +| false \Rightarrow n \nleq m] \to (P (leb n m))) +[ apply Hcut. + (*qui autobatch non conclude il goal*) + apply leb_to_Prop +| elim (leb n m) + [ (*qui autobatch non conclude il goal*) + apply ((H H2)) + | (*qui autobatch non conclude il goal*) + apply ((H1 H2)) + ] +] +qed. + +let rec nat_compare n m: compare \def +match n with +[ O \Rightarrow + match m with + [ O \Rightarrow EQ + | (S q) \Rightarrow LT ] +| (S p) \Rightarrow + match m with + [ O \Rightarrow GT + | (S q) \Rightarrow nat_compare p q]]. +(**********) +theorem nat_compare_n_n: \forall n:nat. nat_compare n n = EQ. +intro.elim n +[ autobatch + (*simplify. + reflexivity*) +| simplify. + assumption +] +qed. + +theorem nat_compare_S_S: \forall n,m:nat. +nat_compare n m = nat_compare (S n) (S m). +intros.autobatch. +(*simplify.reflexivity.*) +qed. + +theorem S_pred: \forall n:nat.lt O n \to eq nat n (S (pred n)). +intro. +elim n;autobatch. +(*[ apply False_ind. + exact (not_le_Sn_O O H) +| apply eq_f. + apply pred_Sn +]*) +qed. + +theorem nat_compare_pred_pred: +\forall n,m:nat.lt O n \to lt O m \to +eq compare (nat_compare n m) (nat_compare (pred n) (pred m)). +intros. +apply (lt_O_n_elim n H). +apply (lt_O_n_elim m H1). +intros. +autobatch. +(*simplify.reflexivity.*) +qed. + +theorem nat_compare_to_Prop: \forall n,m:nat. +match (nat_compare n m) with + [ LT \Rightarrow n < m + | EQ \Rightarrow n=m + | GT \Rightarrow m < n ]. +intros. +apply (nat_elim2 (\lambda n,m.match (nat_compare n m) with + [ LT \Rightarrow n < m + | EQ \Rightarrow n=m + | GT \Rightarrow m < n ])) +[ intro. + elim n1;simplify;autobatch + (*[ reflexivity + | unfold lt. + apply le_S_S. + apply le_O_n + ]*) +| intro. + simplify. + autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) +| intros 2. + simplify. + elim ((nat_compare n1 m1));simplify + [ unfold lt. + apply le_S_S. + (*qui autobatch non chiude il goal*) + apply H + | apply eq_f. + (*qui autobatch non chiude il goal*) + apply H + | unfold lt. + apply le_S_S. + (*qui autobatch non chiude il goal*) + apply H + ] +] +qed. + +theorem nat_compare_n_m_m_n: \forall n,m:nat. +nat_compare n m = compare_invert (nat_compare m n). +intros. +apply (nat_elim2 (\lambda n,m. nat_compare n m = compare_invert (nat_compare m n)));intros +[ elim n1;autobatch(*;simplify;reflexivity*) +| elim n1;autobatch(*;simplify;reflexivity*) +| autobatch + (*simplify.elim H.reflexivity*) +] +qed. + +theorem nat_compare_elim : \forall n,m:nat. \forall P:compare \to Prop. +(n < m \to P LT) \to (n=m \to P EQ) \to (m < n \to P GT) \to +(P (nat_compare n m)). +intros. +cut (match (nat_compare n m) with +[ LT \Rightarrow n < m +| EQ \Rightarrow n=m +| GT \Rightarrow m < n] \to +(P (nat_compare n m))) +[ apply Hcut. + (*autobatch non chiude il goal*) + apply nat_compare_to_Prop +| elim ((nat_compare n m)) + [ (*autobatch non chiude il goal*) + apply ((H H3)) + | (*autobatch non chiude il goal*) + apply ((H1 H3)) + | (*autobatch non chiude il goal*) + apply ((H2 H3)) + ] +] +qed. diff --git a/matita/library_auto/auto/nat/congruence.ma b/matita/library_auto/auto/nat/congruence.ma new file mode 100644 index 000000000..305778bf8 --- /dev/null +++ b/matita/library_auto/auto/nat/congruence.ma @@ -0,0 +1,259 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/congruence". + +include "auto/nat/relevant_equations.ma". +include "auto/nat/primes.ma". + +definition S_mod: nat \to nat \to nat \def +\lambda n,m:nat. (S m) \mod n. + +definition congruent: nat \to nat \to nat \to Prop \def +\lambda n,m,p:nat. mod n p = mod m p. + +interpretation "congruent" 'congruent n m p = + (cic:/matita/library_autobatch/nat/congruence/congruent.con n m p). + +notation < "hvbox(n break \cong\sub p m)" + (*non associative*) with precedence 45 +for @{ 'congruent $n $m $p }. + +theorem congruent_n_n: \forall n,p:nat.congruent n n p. +intros. +unfold congruent. +reflexivity. +qed. + +theorem transitive_congruent: \forall p:nat. transitive nat +(\lambda n,m. congruent n m p). +intros.unfold transitive. +unfold congruent. +intros. +whd. +apply (trans_eq ? ? (y \mod p)) +[ (*qui autobatch non chiude il goal*) + apply H +| (*qui autobatch non chiude il goal*) + apply H1 +] +qed. + +theorem le_to_mod: \forall n,m:nat. n \lt m \to n = n \mod m. +intros. +autobatch. +(*apply (div_mod_spec_to_eq2 n m O n (n/m) (n \mod m)) +[ constructor 1 + [ assumption + | simplify. + reflexivity + ] +| apply div_mod_spec_div_mod. + apply (le_to_lt_to_lt O n m) + [ apply le_O_n + | assumption + ] +]*) +qed. + +theorem mod_mod : \forall n,p:nat. O

    (div_mod (n \mod p) p) in \vdash (? ? % ?) +[ rewrite > (eq_div_O ? p) + [ reflexivity + | apply lt_mod_m_m. + assumption + ] +| assumption +]*) +qed. + +theorem mod_times_mod : \forall n,m,p:nat. O

    times_plus_l. + rewrite > assoc_plus. + rewrite < div_mod + [ rewrite > assoc_times. + rewrite < div_mod;autobatch + (*[ reflexivity + | rewrite > (times_n_O O). + apply lt_times;assumption + ]*) + | assumption + ] + ] +] +qed. + +theorem congruent_n_mod_n : +\forall n,p:nat. O < p \to congruent n (n \mod p) p. +intros. +unfold congruent. +autobatch. +(*apply mod_mod. +assumption.*) +qed. + +theorem congruent_n_mod_times : +\forall n,m,p:nat. O < p \to O < m \to congruent n (n \mod (m*p)) p. +intros.unfold congruent. +apply mod_times_mod;assumption. +qed. + +theorem eq_times_plus_to_congruent: \forall n,m,p,r:nat. O< p \to +n = r*p+m \to congruent n m p. +intros. +unfold congruent. +apply (div_mod_spec_to_eq2 n p (div n p) (mod n p) (r +(div m p)) (mod m p)) +[ autobatch + (*apply div_mod_spec_div_mod. + assumption*) +| constructor 1 + [ autobatch + (*apply lt_mod_m_m. + assumption*) + | +(*cut (n = r * p + (m / p * p + m \mod p)).*) +(*lapply (div_mod m p H). +rewrite > sym_times. +rewrite > distr_times_plus. +(*rewrite > (sym_times p (m/p)).*) +(*rewrite > sym_times.*) + rewrite > assoc_plus. + autobatch paramodulation. + rewrite < div_mod. + assumption. + assumption. +*) + rewrite > sym_times. + rewrite > distr_times_plus. + rewrite > sym_times. + rewrite > (sym_times p). + rewrite > assoc_plus. + rewrite < div_mod;assumption. + ] +] +qed. + +theorem divides_to_congruent: \forall n,m,p:nat. O < p \to m \le n \to +divides p (n - m) \to congruent n m p. +intros. +elim H2. +apply (eq_times_plus_to_congruent n m p n2) +[ assumption +| rewrite < sym_plus. + apply minus_to_plus;autobatch + (*[ assumption + | rewrite > sym_times. assumption + ]*) +] +qed. + +theorem congruent_to_divides: \forall n,m,p:nat. +O < p \to congruent n m p \to divides p (n - m). +intros. +unfold congruent in H1. +apply (witness ? ? ((n / p)-(m / p))). +rewrite > sym_times. +rewrite > (div_mod n p) in \vdash (? ? % ?) +[ rewrite > (div_mod m p) in \vdash (? ? % ?) + [ rewrite < (sym_plus (m \mod p)). + autobatch + (*rewrite < H1. + rewrite < (eq_minus_minus_minus_plus ? (n \mod p)). + rewrite < minus_plus_m_m. + apply sym_eq. + apply times_minus_l*) + | assumption + ] +| assumption +] +qed. + +theorem mod_times: \forall n,m,p:nat. +O < p \to mod (n*m) p = mod ((mod n p)*(mod m p)) p. +intros. +change with (congruent (n*m) ((mod n p)*(mod m p)) p). +apply (eq_times_plus_to_congruent ? ? p +((n / p)*p*(m / p) + (n / p)*(m \mod p) + (n \mod p)*(m / p))) +[ assumption +| apply (trans_eq ? ? (((n/p)*p+(n \mod p))*((m/p)*p+(m \mod p)))) + [ apply eq_f2;autobatch(*;apply div_mod.assumption.*) + | apply (trans_eq ? ? (((n/p)*p)*((m/p)*p) + (n/p)*p*(m \mod p) + + (n \mod p)*((m / p)*p) + (n \mod p)*(m \mod p))) + [ apply times_plus_plus + | apply eq_f2 + [ rewrite < assoc_times. + autobatch + (*rewrite > (assoc_times (n/p) p (m \mod p)). + rewrite > (sym_times p (m \mod p)). + rewrite < (assoc_times (n/p) (m \mod p) p). + rewrite < times_plus_l. + rewrite < (assoc_times (n \mod p)). + rewrite < times_plus_l. + apply eq_f2 + [ apply eq_f2 + [ reflexivity + | reflexivity + ] + | reflexivity + ]*) + | reflexivity + ] + ] + ] +] +qed. + +theorem congruent_times: \forall n,m,n1,m1,p. O < p \to congruent n n1 p \to +congruent m m1 p \to congruent (n*m) (n1*m1) p. +unfold congruent. +intros. +rewrite > (mod_times n m p H). +rewrite > H1. +rewrite > H2. +autobatch. +(* +apply sym_eq. +apply mod_times. +assumption.*) +qed. + +theorem congruent_pi: \forall f:nat \to nat. \forall n,m,p:nat.O < p \to +congruent (pi n f m) (pi n (\lambda m. mod (f m) p) m) p. +intros. +elim n;simplify +[ autobatch + (*apply congruent_n_mod_n. + assumption*) +| apply congruent_times + [ assumption + | autobatch + (*apply congruent_n_mod_n. + assumption*) + | (*NB: QUI AUTO NON RIESCE A CHIUDERE IL GOAL*) + assumption + ] +] +qed. diff --git a/matita/library_auto/auto/nat/count.ma b/matita/library_auto/auto/nat/count.ma new file mode 100644 index 000000000..de2e52807 --- /dev/null +++ b/matita/library_auto/auto/nat/count.ma @@ -0,0 +1,347 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/count". + +include "auto/nat/relevant_equations.ma". +include "auto/nat/sigma_and_pi.ma". +include "auto/nat/permutation.ma". + +theorem sigma_f_g : \forall n,m:nat.\forall f,g:nat \to nat. +sigma n (\lambda p.f p + g p) m = sigma n f m + sigma n g m. +intros. +elim n;simplify +[ reflexivity +| rewrite > H. + autobatch + (*rewrite > assoc_plus. + rewrite < (assoc_plus (g (S (n1+m)))). + rewrite > (sym_plus (g (S (n1+m)))). + rewrite > (assoc_plus (sigma n1 f m)). + rewrite < assoc_plus. + reflexivity*) +] +qed. + +theorem sigma_plus: \forall n,p,m:nat.\forall f:nat \to nat. +sigma (S (p+n)) f m = sigma p (\lambda x.(f ((S n) + x))) m + sigma n f m. +intros. +elim p;simplify +[ autobatch + (*rewrite < (sym_plus n m). + reflexivity*) +| rewrite > assoc_plus in \vdash (? ? ? %). + rewrite < H. + autobatch + (*simplify. + rewrite < plus_n_Sm. + rewrite > (sym_plus n). + rewrite > assoc_plus. + rewrite < (sym_plus m). + rewrite < (assoc_plus n1). + reflexivity*) +] +qed. + +theorem sigma_plus1: \forall n,p,m:nat.\forall f:nat \to nat. +sigma (p+(S n)) f m = sigma p (\lambda x.(f ((S n) + x))) m + sigma n f m. +intros. +elim p;simplify +[ reflexivity +| rewrite > assoc_plus in \vdash (? ? ? %). + rewrite < H. + rewrite < plus_n_Sm. + autobatch + (*rewrite < plus_n_Sm.simplify. + rewrite < (sym_plus n). + rewrite > assoc_plus. + rewrite < (sym_plus m). + rewrite < (assoc_plus n). + reflexivity*) +] +qed. + +theorem eq_sigma_sigma : \forall n,m:nat.\forall f:nat \to nat. +sigma (pred ((S n)*(S m))) f O = +sigma m (\lambda a.(sigma n (\lambda b.f (b*(S m) + a)) O)) O. +intro. +elim n;simplify +[ rewrite < plus_n_O. + apply eq_sigma. + intros. + reflexivity +| rewrite > sigma_f_g. + rewrite < plus_n_O. + rewrite < H. + autobatch + + (*rewrite > (S_pred ((S n1)*(S m))) + [ apply sigma_plus1 + | simplify. + unfold lt. + apply le_S_S. + apply le_O_n + ]*) +] +qed. + +theorem eq_sigma_sigma1 : \forall n,m:nat.\forall f:nat \to nat. +sigma (pred ((S n)*(S m))) f O = +sigma n (\lambda a.(sigma m (\lambda b.f (b*(S n) + a)) O)) O. +intros. +rewrite > sym_times. +apply eq_sigma_sigma. +qed. + +theorem sigma_times: \forall n,m,p:nat.\forall f:nat \to nat. +(sigma n f m)*p = sigma n (\lambda i.(f i) * p) m. +intro. +elim n;simplify +[ reflexivity +| rewrite < H. + apply times_plus_l +] +qed. + +definition bool_to_nat: bool \to nat \def +\lambda b. match b with +[ true \Rightarrow (S O) +| false \Rightarrow O ]. + +theorem bool_to_nat_andb: \forall a,b:bool. +bool_to_nat (andb a b) = (bool_to_nat a)*(bool_to_nat b). +intros. +elim a;autobatch. +(*[elim b + [ simplify. + reflexivity + | reflexivity + ] +| reflexivity +]*) +qed. + +definition count : nat \to (nat \to bool) \to nat \def +\lambda n.\lambda f. sigma (pred n) (\lambda n.(bool_to_nat (f n))) O. + +theorem count_times:\forall n,m:nat. +\forall f,f1,f2:nat \to bool. +\forall g:nat \to nat \to nat. +\forall g1,g2: nat \to nat. +(\forall a,b:nat. a < (S n) \to b < (S m) \to (g b a) < (S n)*(S m)) \to +(\forall a,b:nat. a < (S n) \to b < (S m) \to (g1 (g b a)) = a) \to +(\forall a,b:nat. a < (S n) \to b < (S m) \to (g2 (g b a)) = b) \to +(\forall a,b:nat. a < (S n) \to b < (S m) \to f (g b a) = andb (f2 b) (f1 a)) \to +(count ((S n)*(S m)) f) = (count (S n) f1)*(count (S m) f2). +intros.unfold count. +rewrite < eq_map_iter_i_sigma. +rewrite > (permut_to_eq_map_iter_i plus assoc_plus sym_plus ? ? ? + (\lambda i.g (div i (S n)) (mod i (S n)))) +[ rewrite > eq_map_iter_i_sigma. + rewrite > eq_sigma_sigma1. + apply (trans_eq ? ? + (sigma n (\lambda a. + sigma m (\lambda b.(bool_to_nat (f2 b))*(bool_to_nat (f1 a))) O) O)) + [ apply eq_sigma.intros. + apply eq_sigma.intros. + rewrite > (div_mod_spec_to_eq (i1*(S n) + i) (S n) ((i1*(S n) + i)/(S n)) + ((i1*(S n) + i) \mod (S n)) i1 i) + [ rewrite > (div_mod_spec_to_eq2 (i1*(S n) + i) (S n) ((i1*(S n) + i)/(S n)) + ((i1*(S n) + i) \mod (S n)) i1 i) + [ rewrite > H3;autobatch (*qui autobatch impiega parecchio tempo*) + (*[ apply bool_to_nat_andb + | unfold lt. + apply le_S_S. + assumption + | unfold lt. + apply le_S_S. + assumption + ]*) + | autobatch + (*apply div_mod_spec_div_mod. + unfold lt. + apply le_S_S. + apply le_O_n*) + | constructor 1;autobatch + (*[ unfold lt. + apply le_S_S. + assumption + | reflexivity + ]*) + ] + | autobatch + (*apply div_mod_spec_div_mod. + unfold lt. + apply le_S_S. + apply le_O_n*) + | constructor 1;autobatch + (*[ unfold lt. + apply le_S_S. + assumption + | reflexivity + ]*) + ] + | apply (trans_eq ? ? + (sigma n (\lambda n.((bool_to_nat (f1 n)) * + (sigma m (\lambda n.bool_to_nat (f2 n)) O))) O)) + [ apply eq_sigma. + intros. + autobatch + (*rewrite > sym_times. + apply (trans_eq ? ? + (sigma m (\lambda n.(bool_to_nat (f2 n))*(bool_to_nat (f1 i))) O)) + [ reflexivity. + | apply sym_eq. + apply sigma_times + ]*) + | autobatch + (*simplify. + apply sym_eq. + apply sigma_times*) + ] + ] +| unfold permut. + split + [ intros. + rewrite < plus_n_O. + apply le_S_S_to_le. + rewrite < S_pred in \vdash (? ? %) + [ change with ((g (i/(S n)) (i \mod (S n))) \lt (S n)*(S m)). + apply H + [ autobatch + (*apply lt_mod_m_m. + unfold lt. + apply le_S_S. + apply le_O_n*) + | apply (lt_times_to_lt_l n). + apply (le_to_lt_to_lt ? i) + [ autobatch + (*rewrite > (div_mod i (S n)) in \vdash (? ? %) + [ rewrite > sym_plus. + apply le_plus_n + | unfold lt. + apply le_S_S. + apply le_O_n + ]*) + | unfold lt. + rewrite > S_pred in \vdash (? ? %) + [ apply le_S_S. + autobatch + (*rewrite > plus_n_O in \vdash (? ? %). + rewrite > sym_times. + assumption*) + | autobatch + (*rewrite > (times_n_O O). + apply lt_times; + unfold lt;apply le_S_S;apply le_O_n*) + ] + ] + ] + | autobatch + (*rewrite > (times_n_O O). + apply lt_times; + unfold lt;apply le_S_S;apply le_O_n *) + ] + | rewrite < plus_n_O. + unfold injn. + intros. + cut (i < (S n)*(S m)) + [ cut (j < (S n)*(S m)) + [ cut ((i \mod (S n)) < (S n)) + [ cut ((i/(S n)) < (S m)) + [ cut ((j \mod (S n)) < (S n)) + [ cut ((j/(S n)) < (S m)) + [ rewrite > (div_mod i (S n)) + [ rewrite > (div_mod j (S n)) + [ rewrite < (H1 (i \mod (S n)) (i/(S n)) Hcut2 Hcut3). + rewrite < (H2 (i \mod (S n)) (i/(S n)) Hcut2 Hcut3) in \vdash (? ? (? % ?) ?). + rewrite < (H1 (j \mod (S n)) (j/(S n)) Hcut4 Hcut5). + rewrite < (H2 (j \mod (S n)) (j/(S n)) Hcut4 Hcut5) in \vdash (? ? ? (? % ?)). + autobatch + (*rewrite > H6. + reflexivity*) + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + ] + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + ] + | apply (lt_times_to_lt_l n). + apply (le_to_lt_to_lt ? j) + [ autobatch. + (*rewrite > (div_mod j (S n)) in \vdash (? ? %) + [ rewrite > sym_plus. + apply le_plus_n + | unfold lt. + apply le_S_S. + apply le_O_n + ]*) + | rewrite < sym_times. + assumption + ] + ] + | autobatch + (*apply lt_mod_m_m. + unfold lt. apply le_S_S. + apply le_O_n*) + ] + | apply (lt_times_to_lt_l n). + apply (le_to_lt_to_lt ? i) + [ autobatch + (*rewrite > (div_mod i (S n)) in \vdash (? ? %) + [ rewrite > sym_plus. + apply le_plus_n + | unfold lt. + apply le_S_S. + apply le_O_n + ]*) + | rewrite < sym_times. + assumption + ] + ] + | autobatch + (*apply lt_mod_m_m. + unfold lt. apply le_S_S. + apply le_O_n*) + ] + | unfold lt. + autobatch + (*rewrite > S_pred in \vdash (? ? %) + [ apply le_S_S. + assumption + | rewrite > (times_n_O O). + apply lt_times; + unfold lt; apply le_S_S;apply le_O_n + ]*) + ] + | unfold lt. + autobatch + (*rewrite > S_pred in \vdash (? ? %) + [ apply le_S_S. + assumption + | rewrite > (times_n_O O). + apply lt_times; + unfold lt; apply le_S_S;apply le_O_n + ]*) + ] + ] +| intros. + apply False_ind. + apply (not_le_Sn_O m1 H4) +] +qed. diff --git a/matita/library_auto/auto/nat/div_and_mod.ma b/matita/library_auto/auto/nat/div_and_mod.ma new file mode 100644 index 000000000..bbb3d49b1 --- /dev/null +++ b/matita/library_auto/auto/nat/div_and_mod.ma @@ -0,0 +1,425 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/div_and_mod". + +include "datatypes/constructors.ma". +include "auto/nat/minus.ma". + +let rec mod_aux p m n: nat \def +match (leb m n) with +[ true \Rightarrow m +| false \Rightarrow + match p with + [O \Rightarrow m + |(S q) \Rightarrow mod_aux q (m-(S n)) n]]. + +definition mod : nat \to nat \to nat \def +\lambda n,m. +match m with +[O \Rightarrow m +| (S p) \Rightarrow mod_aux n n p]. + +interpretation "natural remainder" 'module x y = + (cic:/matita/library_autobatch/nat/div_and_mod/mod.con x y). + +let rec div_aux p m n : nat \def +match (leb m n) with +[ true \Rightarrow O +| false \Rightarrow + match p with + [O \Rightarrow O + |(S q) \Rightarrow S (div_aux q (m-(S n)) n)]]. + +definition div : nat \to nat \to nat \def +\lambda n,m. +match m with +[O \Rightarrow S n +| (S p) \Rightarrow div_aux n n p]. + +interpretation "natural divide" 'divide x y = + (cic:/matita/library_autobatch/nat/div_and_mod/div.con x y). + +theorem le_mod_aux_m_m: +\forall p,n,m. n \leq p \to (mod_aux p n m) \leq m. +intro. +elim p +[ apply (le_n_O_elim n H (\lambda n.(mod_aux O n m) \leq m)). + autobatch + (*simplify. + apply le_O_n*) +| simplify. + apply (leb_elim n1 m);simplify;intro + [ assumption + | apply H. + cut (n1 \leq (S n) \to n1-(S m) \leq n) + [ autobatch + (*apply Hcut. + assumption*) + | elim n1;simplify;autobatch + (*[ apply le_O_n. + | apply (trans_le ? n2 n) + [ apply le_minus_m + | apply le_S_S_to_le. + assumption + ] + ]*) + ] + ] +] +qed. + +theorem lt_mod_m_m: \forall n,m. O < m \to (n \mod m) < m. +intros 2. +elim m +[ apply False_ind. + apply (not_le_Sn_O O H) +| simplify. + autobatch + (*unfold lt. + apply le_S_S. + apply le_mod_aux_m_m. + apply le_n*) +] +qed. + +theorem div_aux_mod_aux: \forall p,n,m:nat. +(n=(div_aux p n m)*(S m) + (mod_aux p n m)). +intro. +elim p;simplify +[ elim (leb n m);autobatch + (*simplify;apply refl_eq.*) +| apply (leb_elim n1 m);simplify;intro + [ apply refl_eq + | rewrite > assoc_plus. + elim (H (n1-(S m)) m). + change with (n1=(S m)+(n1-(S m))). + rewrite < sym_plus. + autobatch + (*apply plus_minus_m_m. + change with (m < n1). + apply not_le_to_lt. + exact H1*) + ] +] +qed. + +theorem div_mod: \forall n,m:nat. O < m \to n=(n / m)*m+(n \mod m). +intros 2. +elim m +[ elim (not_le_Sn_O O H) +| simplify. + apply div_aux_mod_aux +] +qed. + +inductive div_mod_spec (n,m,q,r:nat) : Prop \def +div_mod_spec_intro: r < m \to n=q*m+r \to (div_mod_spec n m q r). + +(* +definition div_mod_spec : nat \to nat \to nat \to nat \to Prop \def +\lambda n,m,q,r:nat.r < m \land n=q*m+r). +*) + +theorem div_mod_spec_to_not_eq_O: \forall n,m,q,r.(div_mod_spec n m q r) \to m \neq O. +intros 4. +unfold Not. +intros. +elim H. +absurd (le (S r) O);autobatch. +(*[ rewrite < H1. + assumption +| exact (not_le_Sn_O r). +]*) +qed. + +theorem div_mod_spec_div_mod: +\forall n,m. O < m \to (div_mod_spec n m (n / m) (n \mod m)). +intros. +autobatch. +(*apply div_mod_spec_intro +[ apply lt_mod_m_m. + assumption +| apply div_mod. + assumption +]*) +qed. + +theorem div_mod_spec_to_eq :\forall a,b,q,r,q1,r1. +(div_mod_spec a b q r) \to (div_mod_spec a b q1 r1) \to +(eq nat q q1). +intros. +elim H. +elim H1. +apply (nat_compare_elim q q1) +[ intro. + apply False_ind. + cut (eq nat ((q1-q)*b+r1) r) + [ cut (b \leq (q1-q)*b+r1) + [ cut (b \leq r) + [ apply (lt_to_not_le r b H2 Hcut2) + | elim Hcut. + assumption + ] + | apply (trans_le ? ((q1-q)*b));autobatch + (*[ apply le_times_n. + apply le_SO_minus. + exact H6 + | rewrite < sym_plus. + apply le_plus_n + ]*) + ] + | rewrite < sym_times. + rewrite > distr_times_minus. + rewrite > plus_minus;autobatch + (*[ rewrite > sym_times. + rewrite < H5. + rewrite < sym_times. + apply plus_to_minus. + apply H3 + | apply le_times_r. + apply lt_to_le. + apply H6 + ]*) + ] +| (* eq case *) + autobatch + (*intros. + assumption*) +| (* the following case is symmetric *) + intro. + apply False_ind. + cut (eq nat ((q-q1)*b+r) r1) + [ cut (b \leq (q-q1)*b+r) + [ cut (b \leq r1) + [ apply (lt_to_not_le r1 b H4 Hcut2) + | elim Hcut. + assumption + ] + | apply (trans_le ? ((q-q1)*b));autobatch + (*[ apply le_times_n. + apply le_SO_minus. + exact H6 + | rewrite < sym_plus. + apply le_plus_n + ]*) + ] + | rewrite < sym_times. + rewrite > distr_times_minus. + rewrite > plus_minus;autobatch + (*[ rewrite > sym_times. + rewrite < H3. + rewrite < sym_times. + apply plus_to_minus. + apply H5 + | apply le_times_r. + apply lt_to_le. + apply H6 + ]*) + ] +] +qed. + +theorem div_mod_spec_to_eq2 :\forall a,b,q,r,q1,r1. +(div_mod_spec a b q r) \to (div_mod_spec a b q1 r1) \to +(eq nat r r1). +intros. +elim H. +elim H1. +apply (inj_plus_r (q*b)). +rewrite < H3. +rewrite > (div_mod_spec_to_eq a b q r q1 r1 H H1). +assumption. +qed. + +theorem div_mod_spec_times : \forall n,m:nat.div_mod_spec ((S n)*m) (S n) m O. +intros. +autobatch. +(*constructor 1 +[ unfold lt. + apply le_S_S. + apply le_O_n +| rewrite < plus_n_O. + rewrite < sym_times. + reflexivity +]*) +qed. + + +(*il corpo del seguente teorema non e' stato strutturato *) +(* some properties of div and mod *) +theorem div_times: \forall n,m:nat. ((S n)*m) / (S n) = m. +intros. +apply (div_mod_spec_to_eq ((S n)*m) (S n) ? ? ? O); +[2: apply div_mod_spec_div_mod.autobatch. +| skip +| autobatch +] +(*unfold lt.apply le_S_S.apply le_O_n. +apply div_mod_spec_times.*) +qed. + +theorem div_n_n: \forall n:nat. O < n \to n / n = S O. +intros. +apply (div_mod_spec_to_eq n n (n / n) (n \mod n) (S O) O);autobatch. +(*[ apply div_mod_spec_div_mod. + assumption +| constructor 1 + [ assumption + | rewrite < plus_n_O. + simplify. + rewrite < plus_n_O. + reflexivity + ] +] *) +qed. + +theorem eq_div_O: \forall n,m. n < m \to n / m = O. +intros. +apply (div_mod_spec_to_eq n m (n/m) (n \mod m) O n);autobatch. +(*[ apply div_mod_spec_div_mod. + apply (le_to_lt_to_lt O n m) + [ apply le_O_n + | assumption + ] +| constructor 1 + [ assumption + | reflexivity + ] +]*) +qed. + +theorem mod_n_n: \forall n:nat. O < n \to n \mod n = O. +intros. +apply (div_mod_spec_to_eq2 n n (n / n) (n \mod n) (S O) O);autobatch. +(*[ apply div_mod_spec_div_mod. + assumption +| constructor 1 + [ assumption. + | rewrite < plus_n_O. + simplify. + rewrite < plus_n_O. + reflexivity + ] +]*) +qed. + +theorem mod_S: \forall n,m:nat. O < m \to S (n \mod m) < m \to +((S n) \mod m) = S (n \mod m). +intros. +apply (div_mod_spec_to_eq2 (S n) m ((S n) / m) ((S n) \mod m) (n / m) (S (n \mod m))) +[ autobatch + (*apply div_mod_spec_div_mod. + assumption*) +| constructor 1 + [ assumption + | rewrite < plus_n_Sm. + autobatch + (*apply eq_f. + apply div_mod. + assumption*) + ] +] +qed. + +theorem mod_O_n: \forall n:nat.O \mod n = O. +intro. +elim n;autobatch. + (*simplify;reflexivity*) + +qed. + +theorem lt_to_eq_mod:\forall n,m:nat. n < m \to n \mod m = n. +intros. +apply (div_mod_spec_to_eq2 n m (n/m) (n \mod m) O n);autobatch. +(*[ apply div_mod_spec_div_mod. + apply (le_to_lt_to_lt O n m) + [ apply le_O_n + | assumption + ] +| constructor 1. + [ assumption + | reflexivity + ] +]*) +qed. + +(* injectivity *) +theorem injective_times_r: \forall n:nat.injective nat nat (\lambda m:nat.(S n)*m). +change with (\forall n,p,q:nat.(S n)*p = (S n)*q \to p=q). +intros. +rewrite < (div_times n). +autobatch. +(*rewrite < (div_times n q). +apply eq_f2 +[ assumption +| reflexivity +]*) +qed. + +variant inj_times_r : \forall n,p,q:nat.(S n)*p = (S n)*q \to p=q \def +injective_times_r. + +theorem lt_O_to_injective_times_r: \forall n:nat. O < n \to injective nat nat (\lambda m:nat.n*m). +simplify. +intros 4. +apply (lt_O_n_elim n H). +intros. +autobatch. +(*apply (inj_times_r m). +assumption.*) +qed. + +variant inj_times_r1:\forall n. O < n \to \forall p,q:nat.n*p = n*q \to p=q +\def lt_O_to_injective_times_r. + +theorem injective_times_l: \forall n:nat.injective nat nat (\lambda m:nat.m*(S n)). +simplify. +intros. +autobatch. +(*apply (inj_times_r n x y). +rewrite < sym_times. +rewrite < (sym_times y). +assumption.*) +qed. + +variant inj_times_l : \forall n,p,q:nat. p*(S n) = q*(S n) \to p=q \def +injective_times_l. + +theorem lt_O_to_injective_times_l: \forall n:nat. O < n \to injective nat nat (\lambda m:nat.m*n). +simplify. +intros 4. +apply (lt_O_n_elim n H). +intros. +autobatch. +(*apply (inj_times_l m). +assumption.*) +qed. + +variant inj_times_l1:\forall n. O < n \to \forall p,q:nat.p*n = q*n \to p=q +\def lt_O_to_injective_times_l. + +(* n_divides computes the pair (div,mod) *) + +(* p is just an upper bound, acc is an accumulator *) +let rec n_divides_aux p n m acc \def + match n \mod m with + [ O \Rightarrow + match p with + [ O \Rightarrow pair nat nat acc n + | (S p) \Rightarrow n_divides_aux p (n / m) m (S acc)] + | (S a) \Rightarrow pair nat nat acc n]. + +(* n_divides n m = if m divides n q times, with remainder r *) +definition n_divides \def \lambda n,m:nat.n_divides_aux n n m O. diff --git a/matita/library_auto/auto/nat/euler_theorem.ma b/matita/library_auto/auto/nat/euler_theorem.ma new file mode 100644 index 000000000..71c1481d6 --- /dev/null +++ b/matita/library_auto/auto/nat/euler_theorem.ma @@ -0,0 +1,329 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/euler_theorem". + +include "auto/nat/map_iter_p.ma". +include "auto/nat/totient.ma". + +(* a reformulation of totient using card insted of count *) +lemma totient_card: \forall n. +totient n = card n (\lambda i.eqb (gcd i n) (S O)). +intro. +apply (nat_case n) +[ reflexivity +| intro. + apply (nat_case m) + [ reflexivity + | intro. + apply count_card1;autobatch + (*[ reflexivity + | autobatch.rewrite > gcd_n_n. + reflexivity + ]*) + ] +] +qed. + +theorem gcd_pi_p: \forall n,k. O < k \to k \le n \to +gcd n (pi_p (\lambda i.eqb (gcd i n) (S O)) k) = (S O). +intros 3. +elim H +[ rewrite > pi_p_S. + cut (eqb (gcd (S O) n) (S O) = true) + [ rewrite > Hcut. + autobatch + (*change with ((gcd n (S O)) = (S O)). + autobatch*) + | autobatch + (*apply eq_to_eqb_true.autobatch*) + ] +| rewrite > pi_p_S. + apply eqb_elim + [ intro. + change with + ((gcd n ((S n1)*(pi_p (\lambda i.eqb (gcd i n) (S O)) n1))) = (S O)). + apply eq_gcd_times_SO + [ autobatch + (*unfold. + apply le_S. + assumption*) + | apply lt_O_pi_p. + | autobatch + (*rewrite > sym_gcd. + assumption.*) + | apply H2. + autobatch + (*apply (trans_le ? (S n1)) + [ apply le_n_Sn + | assumption + ]*) + ] + | intro. + change with + (gcd n (pi_p (\lambda i.eqb (gcd i n) (S O)) n1) = (S O)). + apply H2. + autobatch + (*apply (trans_le ? (S n1)) + [ apply le_n_Sn + | assumption + ]*) + ] +] +qed. + +theorem congruent_map_iter_p_times:\forall f:nat \to nat. \forall a,n:nat. +O < a \to +congruent +(map_iter_p n (\lambda i.eqb (gcd i a) (S O)) (\lambda x.f x) (S O) times) +(map_iter_p n (\lambda i.eqb (gcd i a) (S O)) + (\lambda x.f x \mod a) (S O) times) a. +intros. +elim n +[ autobatch + (*rewrite > map_iter_p_O. + apply (congruent_n_n ? a)*) +| apply (eqb_elim (gcd (S n1) a) (S O)) + [ intro. + rewrite > map_iter_p_S_true + [ rewrite > map_iter_p_S_true + [ apply congruent_times + [ assumption + | autobatch + (*apply congruent_n_mod_n. + assumption*) + | (*NB qui autobatch non chiude il goal*) + assumption + ] + | autobatch + (*apply eq_to_eqb_true. + assumption*) + ] + | autobatch + (*apply eq_to_eqb_true. + assumption*) + ] + | intro. + rewrite > map_iter_p_S_false + [ rewrite > map_iter_p_S_false + [ (*BN qui autobatch non chiude il goal*) + assumption + | autobatch + (*apply not_eq_to_eqb_false. + assumption*) + ] + | autobatch + (*apply not_eq_to_eqb_false. + assumption*) + ] + ] +] +qed. + +theorem permut_p_mod: \forall a,n. S O < n \to O < a \to gcd a n = (S O) \to +permut_p (\lambda x:nat.a*x \mod n) (\lambda i:nat.eqb (gcd i n) (S O)) n. +intros. +lapply (lt_S_to_lt ? ? H) as H3. +unfold permut_p. +simplify. +intros. +split +[ split + [ autobatch + (*apply lt_to_le. + apply lt_mod_m_m. + assumption*) + | rewrite > sym_gcd. + rewrite > gcd_mod + [ apply eq_to_eqb_true. + rewrite > sym_gcd. + apply eq_gcd_times_SO + [ assumption + | apply (gcd_SO_to_lt_O i n H). + autobatch + (*apply eqb_true_to_eq. + assumption*) + | autobatch + (*rewrite > sym_gcd. + assumption*) + | autobatch + (*rewrite > sym_gcd. + apply eqb_true_to_eq. + assumption*) + ] + | assumption + ] + ] +| intros. + lapply (gcd_SO_to_lt_n ? ? H H4 (eqb_true_to_eq ? ? H5)) as H9. + lapply (gcd_SO_to_lt_n ? ? H H7 (eqb_true_to_eq ? ? H6)) as H10. + lapply (gcd_SO_to_lt_O ? ? H (eqb_true_to_eq ? ? H5)) as H11. + lapply (gcd_SO_to_lt_O ? ? H (eqb_true_to_eq ? ? H6)) as H12. + unfold Not. + intro. + apply H8. + apply (nat_compare_elim i j) + [ intro. + absurd (j < n) + [ assumption + | apply le_to_not_lt. + apply (trans_le ? (j -i)) + [ apply divides_to_le + [(*fattorizzare*) + unfold lt.autobatch. + (*apply (lt_plus_to_lt_l i). + simplify. + rewrite < (plus_minus_m_m) + [ assumption + | apply lt_to_le. + assumption + ]*) + | apply (gcd_SO_to_divides_times_to_divides a) + [ assumption + | autobatch + (*rewrite > sym_gcd. + assumption*) + | apply mod_O_to_divides + [ assumption + | rewrite > distr_times_minus. + autobatch + ] + ] + ] + | autobatch + ] + ] + | autobatch + (*intro. + assumption*) + | intro. + absurd (i < n) + [ assumption + | apply le_to_not_lt. + apply (trans_le ? (i -j)) + [ apply divides_to_le + [(*fattorizzare*) + unfold lt.autobatch. + (*apply (lt_plus_to_lt_l j). + simplify. + rewrite < (plus_minus_m_m) + [ assumption + | apply lt_to_le. + assumption + ]*) + | apply (gcd_SO_to_divides_times_to_divides a) + [ assumption + | autobatch + (*rewrite > sym_gcd. + assumption*) + | apply mod_O_to_divides + [ assumption + | rewrite > distr_times_minus. + autobatch + ] + ] + ] + | autobatch + ] + ] + ] +] +qed. + +theorem congruent_exp_totient_SO: \forall n,a:nat. (S O) < n \to +gcd a n = (S O) \to congruent (exp a (totient n)) (S O) n. +intros. +cut (O < a) +[ apply divides_to_congruent + [ autobatch + (*apply (trans_lt ? (S O)). + apply lt_O_S. + assumption*) + | autobatch + (*change with (O < exp a (totient n)). + apply lt_O_exp. + assumption*) + | apply (gcd_SO_to_divides_times_to_divides (pi_p (\lambda i.eqb (gcd i n) (S O)) n)) + [ autobatch + (*apply (trans_lt ? (S O)). + apply lt_O_S. + assumption*) + | autobatch + (*apply gcd_pi_p + [ apply (trans_lt ? (S O)). + apply lt_O_S. + assumption + | apply le_n + ]*) + | rewrite < sym_times. + rewrite > times_minus_l. + rewrite > (sym_times (S O)). + rewrite < times_n_SO. + rewrite > totient_card. + rewrite > a_times_pi_p. + apply congruent_to_divides + [ autobatch + (*apply (trans_lt ? (S O)). + apply lt_O_S. + assumption*) + | apply (transitive_congruent n ? + (map_iter_p n (\lambda i.eqb (gcd i n) (S O)) (\lambda x.a*x \mod n) (S O) times)) + [ autobatch + (*apply (congruent_map_iter_p_times ? n n). + apply (trans_lt ? (S O)) + [ apply lt_O_S + | assumption + ]*) + | unfold pi_p. + cut ( (map_iter_p n (\lambda i:nat.eqb (gcd i n) (S O)) (\lambda n:nat.n) (S O) times) + = (map_iter_p n (\lambda i:nat.eqb (gcd i n) (S O)) (\lambda x:nat.a*x\mod n) (S O) times)) + [ rewrite < Hcut1. + apply congruent_n_n + | apply (eq_map_iter_p_permut ? ? ? ? ? (λm.m)) + [ apply assoc_times + | apply sym_times + | apply (permut_p_mod ? ? H Hcut H1) + | simplify. + apply not_eq_to_eqb_false. + unfold. + intro. + autobatch + (*apply (lt_to_not_eq (S O) n) + [ assumption + | apply sym_eq. + assumption + ]*) + ] + ] + ] + ] + ] + ] +| elim (le_to_or_lt_eq O a (le_O_n a));autobatch + (*[ assumption + | autobatch.absurd (gcd a n = S O) + [ assumption + | rewrite < H2. + simplify. + unfold.intro. + apply (lt_to_not_eq (S O) n) + [ assumption + | apply sym_eq. + assumption + ] + ] + ]*) +] +qed. + \ No newline at end of file diff --git a/matita/library_auto/auto/nat/exp.ma b/matita/library_auto/auto/nat/exp.ma new file mode 100644 index 000000000..69667b715 --- /dev/null +++ b/matita/library_auto/auto/nat/exp.ma @@ -0,0 +1,154 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/exp". + +include "auto/nat/div_and_mod.ma". + +let rec exp n m on m\def + match m with + [ O \Rightarrow (S O) + | (S p) \Rightarrow (times n (exp n p)) ]. + +interpretation "natural exponent" 'exp a b = (cic:/matita/library_autobatch/nat/exp/exp.con a b). + +theorem exp_plus_times : \forall n,p,q:nat. +n \sup (p + q) = (n \sup p) * (n \sup q). +intros. +elim p;simplify;autobatch. +(*[ rewrite < plus_n_O. + reflexivity +| rewrite > H. + symmetry. + apply assoc_times +]*) +qed. + +theorem exp_n_O : \forall n:nat. S O = n \sup O. +intro. +autobatch. +(*simplify. +reflexivity.*) +qed. + +theorem exp_n_SO : \forall n:nat. n = n \sup (S O). +intro. +autobatch. +(*simplify. +rewrite < times_n_SO. +reflexivity.*) +qed. + +theorem exp_exp_times : \forall n,p,q:nat. +(n \sup p) \sup q = n \sup (p * q). +intros. +elim q;simplify +[ autobatch. + (*rewrite < times_n_O. + simplify. + reflexivity*) +| rewrite > H. + rewrite < exp_plus_times. + autobatch + (*rewrite < times_n_Sm. + reflexivity*) +] +qed. + +theorem lt_O_exp: \forall n,m:nat. O < n \to O < n \sup m. +intros. +elim m;simplify;autobatch. + (*unfold lt +[ apply le_n +| rewrite > times_n_SO. + apply le_times;assumption +]*) +qed. + +theorem lt_m_exp_nm: \forall n,m:nat. (S O) < n \to m < n \sup m. +intros. +elim m;simplify;unfold lt; +[ apply le_n. +| apply (trans_le ? ((S(S O))*(S n1))) + [ simplify. + rewrite < plus_n_Sm. + apply le_S_S. + autobatch + (*apply le_S_S. + rewrite < sym_plus. + apply le_plus_n*) + | autobatch + (*apply le_times;assumption*) + ] +] +qed. + +theorem exp_to_eq_O: \forall n,m:nat. (S O) < n +\to n \sup m = (S O) \to m = O. +intros. +apply antisym_le +[ apply le_S_S_to_le. + rewrite < H1. + autobatch + (*change with (m < n \sup m). + apply lt_m_exp_nm. + assumption*) +| apply le_O_n +] +qed. + +theorem injective_exp_r: \forall n:nat. (S O) < n \to +injective nat nat (\lambda m:nat. n \sup m). +simplify. +intros 4. +apply (nat_elim2 (\lambda x,y.n \sup x = n \sup y \to x = y)) +[ intros. + autobatch + (*apply sym_eq. + apply (exp_to_eq_O n) + [ assumption + | rewrite < H1. + reflexivity + ]*) +| intros. + apply (exp_to_eq_O n);assumption +| intros. + apply eq_f. + apply H1. + (* esprimere inj_times senza S *) + cut (\forall a,b:nat.O < n \to n*a=n*b \to a=b) + [ apply Hcut + [ autobatch + (*simplify. + unfold lt. + apply le_S_S_to_le. + apply le_S. + assumption*) + | (*NB qui autobatch non chiude il goal, chiuso invece chiamando solo la tattica assumption*) + assumption + ] + | intros 2. + apply (nat_case n);intros;autobatch + (*[ apply False_ind. + apply (not_le_Sn_O O H3) + | apply (inj_times_r m1). + assumption + ]*) + ] +] +qed. + +variant inj_exp_r: \forall p:nat. (S O) < p \to \forall n,m:nat. +p \sup n = p \sup m \to n = m \def +injective_exp_r. diff --git a/matita/library_auto/auto/nat/factorial.ma b/matita/library_auto/auto/nat/factorial.ma new file mode 100644 index 000000000..a5610aef1 --- /dev/null +++ b/matita/library_auto/auto/nat/factorial.ma @@ -0,0 +1,105 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/factorial". + +include "auto/nat/le_arith.ma". + +let rec fact n \def + match n with + [ O \Rightarrow (S O) + | (S m) \Rightarrow (S m)*(fact m)]. + +interpretation "factorial" 'fact n = (cic:/matita/library_autobatch/nat/factorial/fact.con n). + +theorem le_SO_fact : \forall n. (S O) \le n!. +intro. +elim n +[ autobatch + (*simplify. + apply le_n*) +| change with ((S O) \le (S n1)*n1!). + autobatch + (*apply (trans_le ? ((S n1)*(S O))) + [ simplify. + apply le_S_S. + apply le_O_n + | apply le_times_r. + assumption + ]*) +] +qed. + +theorem le_SSO_fact : \forall n. (S O) < n \to (S(S O)) \le n!. +intro. +apply (nat_case n) +[ intro. + autobatch + (*apply False_ind. + apply (not_le_Sn_O (S O) H).*) +| intros. + change with ((S (S O)) \le (S m)*m!). + apply (trans_le ? ((S(S O))*(S O)));autobatch + (*[ apply le_n + | apply le_times + [ exact H + | apply le_SO_fact + ] + ]*) +] +qed. + +theorem le_n_fact_n: \forall n. n \le n!. +intro. +elim n +[ apply le_O_n +| change with (S n1 \le (S n1)*n1!). + apply (trans_le ? ((S n1)*(S O)));autobatch + (*[ rewrite < times_n_SO. + apply le_n + | apply le_times. + apply le_n. + apply le_SO_fact + ]*) +] +qed. + +theorem lt_n_fact_n: \forall n. (S(S O)) < n \to n < n!. +intro. +apply (nat_case n) +[ intro. + autobatch + (*apply False_ind. + apply (not_le_Sn_O (S(S O)) H)*) +| intros. + change with ((S m) < (S m)*m!). + apply (lt_to_le_to_lt ? ((S m)*(S (S O)))) + [ rewrite < sym_times. + simplify. + unfold lt. + apply le_S_S. + autobatch + (*rewrite < plus_n_O. + apply le_plus_n*) + | apply le_times_r. + autobatch + (*apply le_SSO_fact. + simplify. + unfold lt. + apply le_S_S_to_le. + exact H*) + ] +] +qed. + diff --git a/matita/library_auto/auto/nat/factorization.ma b/matita/library_auto/auto/nat/factorization.ma new file mode 100644 index 000000000..e09a30e13 --- /dev/null +++ b/matita/library_auto/auto/nat/factorization.ma @@ -0,0 +1,972 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/factorization". + +include "auto/nat/ord.ma". +include "auto/nat/gcd.ma". +include "auto/nat/nth_prime.ma". + +(* the following factorization algorithm looks for the largest prime + factor. *) +definition max_prime_factor \def \lambda n:nat. +(max n (\lambda p:nat.eqb (n \mod (nth_prime p)) O)). + +(* max_prime_factor is indeed a factor *) +theorem divides_max_prime_factor_n: + \forall n:nat. (S O) < n + \to nth_prime (max_prime_factor n) \divides n. +intros. +apply divides_b_true_to_divides +[ apply lt_O_nth_prime_n +| apply (f_max_true (\lambda p:nat.eqb (n \mod (nth_prime p)) O) n); + cut (\exists i. nth_prime i = smallest_factor n) + [ elim Hcut. + apply (ex_intro nat ? a). + split + [ apply (trans_le a (nth_prime a)) + [ autobatch + (*apply le_n_fn. + exact lt_nth_prime_n_nth_prime_Sn*) + | rewrite > H1. + apply le_smallest_factor_n + ] + | rewrite > H1. + (*CSC: simplify here does something nasty! *) + change with (divides_b (smallest_factor n) n = true). + apply divides_to_divides_b_true + [ autobatch + (*apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | apply lt_SO_smallest_factor. + assumption + ]*) + | autobatch + (*letin x \def le. + autobatch new*) + (* + apply divides_smallest_factor_n; + apply (trans_lt ? (S O)); + [ unfold lt; apply le_n; + | assumption; ] *) + ] + ] + | autobatch + (* + apply prime_to_nth_prime; + apply prime_smallest_factor_n; + assumption; *) + ] +] +qed. + +theorem divides_to_max_prime_factor : \forall n,m. (S O) < n \to O < m \to n \divides m \to +max_prime_factor n \le max_prime_factor m. +intros. +unfold max_prime_factor. +apply f_m_to_le_max +[ autobatch + (*apply (trans_le ? n) + [ apply le_max_n + | apply divides_to_le;assumption + ]*) +| change with (divides_b (nth_prime (max_prime_factor n)) m = true). + apply divides_to_divides_b_true + [ autobatch + (*cut (prime (nth_prime (max_prime_factor n))) + [ apply lt_O_nth_prime_n + | apply prime_nth_prime + ]*) + | autobatch + (*cut (nth_prime (max_prime_factor n) \divides n) + [ autobatch + | autobatch + ] *) + (* + [ apply (transitive_divides ? n); + [ apply divides_max_prime_factor_n. + assumption. + | assumption. + ] + | apply divides_b_true_to_divides; + [ apply lt_O_nth_prime_n. + | apply divides_to_divides_b_true; + [ apply lt_O_nth_prime_n. + | apply divides_max_prime_factor_n. + assumption. + ] + ] + ] + *) + ] +] +qed. + +theorem p_ord_to_lt_max_prime_factor: \forall n,p,q,r. O < n \to +p = max_prime_factor n \to +(pair nat nat q r) = p_ord n (nth_prime p) \to +(S O) < r \to max_prime_factor r < p. +intros. +rewrite > H1. +cut (max_prime_factor r \lt max_prime_factor n \lor + max_prime_factor r = max_prime_factor n) +[ elim Hcut + [ assumption + | absurd (nth_prime (max_prime_factor n) \divides r) + [ rewrite < H4. + autobatch + (*apply divides_max_prime_factor_n. + assumption*) + | unfold Not. + intro. + cut (r \mod (nth_prime (max_prime_factor n)) \neq O) + [ autobatch + (*unfold Not in Hcut1. + autobatch new*) + (* + apply Hcut1.apply divides_to_mod_O; + [ apply lt_O_nth_prime_n. + | assumption. + ] + *) + | letin z \def le. + cut(pair nat nat q r=p_ord_aux n n (nth_prime (max_prime_factor n))); + [ 2: rewrite < H1. + assumption + | letin x \def le. + autobatch width = 4 new + ] + (* CERCA COME MAI le_n non lo applica se lo trova come Const e non Rel *) + ] + (* + apply (p_ord_aux_to_not_mod_O n n ? q r); + [ apply lt_SO_nth_prime_n. + | assumption. + | apply le_n. + | rewrite < H1.assumption. + ] + ]. + *) + ] + ] +| apply (le_to_or_lt_eq (max_prime_factor r) (max_prime_factor n)). + apply divides_to_max_prime_factor + [ assumption + | assumption + | apply (witness r n ((nth_prime p) \sup q)). + rewrite < sym_times. + apply (p_ord_aux_to_exp n n ? q r) + [ apply lt_O_nth_prime_n + | assumption + ] + ] +] +qed. + +theorem p_ord_to_lt_max_prime_factor1: \forall n,p,q,r. O < n \to +max_prime_factor n \le p \to +(pair nat nat q r) = p_ord n (nth_prime p) \to +(S O) < r \to max_prime_factor r < p. +intros. +cut (max_prime_factor n < p \lor max_prime_factor n = p) +[ elim Hcut + [ apply (le_to_lt_to_lt ? (max_prime_factor n)) + [ apply divides_to_max_prime_factor + [ assumption + | assumption + | apply (witness r n ((nth_prime p) \sup q)). + rewrite > sym_times. + (*qui autobatch non chiude il goal*) + apply (p_ord_aux_to_exp n n) + [ apply lt_O_nth_prime_n. + | assumption + ] + ] + | assumption + ] + | apply (p_ord_to_lt_max_prime_factor n ? q);autobatch + (*[ assumption + | apply sym_eq. + assumption + | assumption + | assumption + ]*) + ] +| apply (le_to_or_lt_eq ? p H1) +] +qed. + +(* datatypes and functions *) + +inductive nat_fact : Set \def + nf_last : nat \to nat_fact + | nf_cons : nat \to nat_fact \to nat_fact. + +inductive nat_fact_all : Set \def + nfa_zero : nat_fact_all + | nfa_one : nat_fact_all + | nfa_proper : nat_fact \to nat_fact_all. + +let rec factorize_aux p n acc \def + match p with + [ O \Rightarrow acc + | (S p1) \Rightarrow + match p_ord n (nth_prime p1) with + [ (pair q r) \Rightarrow + factorize_aux p1 r (nf_cons q acc)]]. + +definition factorize : nat \to nat_fact_all \def \lambda n:nat. + match n with + [ O \Rightarrow nfa_zero + | (S n1) \Rightarrow + match n1 with + [ O \Rightarrow nfa_one + | (S n2) \Rightarrow + let p \def (max (S(S n2)) (\lambda p:nat.eqb ((S(S n2)) \mod (nth_prime p)) O)) in + match p_ord (S(S n2)) (nth_prime p) with + [ (pair q r) \Rightarrow + nfa_proper (factorize_aux p r (nf_last (pred q)))]]]. + +let rec defactorize_aux f i \def + match f with + [ (nf_last n) \Rightarrow (nth_prime i) \sup (S n) + | (nf_cons n g) \Rightarrow + (nth_prime i) \sup n *(defactorize_aux g (S i))]. + +definition defactorize : nat_fact_all \to nat \def +\lambda f : nat_fact_all. +match f with +[ nfa_zero \Rightarrow O +| nfa_one \Rightarrow (S O) +| (nfa_proper g) \Rightarrow defactorize_aux g O]. + +theorem lt_O_defactorize_aux: + \forall f:nat_fact. + \forall i:nat. + O < defactorize_aux f i. +intro. +elim f +[1,2: + simplify; + unfold lt; + rewrite > times_n_SO;autobatch + (*apply le_times + [ change with (O < nth_prime i). + apply lt_O_nth_prime_n + |2,3: + change with (O < exp (nth_prime i) n); + apply lt_O_exp; + apply lt_O_nth_prime_n + | change with (O < defactorize_aux n1 (S i)). + apply H + ] *) +] +qed. + +theorem lt_SO_defactorize_aux: \forall f:nat_fact.\forall i:nat. +S O < defactorize_aux f i. +intro. +elim f +[ simplify. + unfold lt. + rewrite > times_n_SO. + autobatch + (*apply le_times + [ change with (S O < nth_prime i). + apply lt_SO_nth_prime_n + | change with (O < exp (nth_prime i) n). + apply lt_O_exp. + apply lt_O_nth_prime_n + ]*) +| simplify. + unfold lt. + rewrite > times_n_SO. + rewrite > sym_times. + autobatch + (*apply le_times + [ change with (O < exp (nth_prime i) n). + apply lt_O_exp. + apply lt_O_nth_prime_n + | change with (S O < defactorize_aux n1 (S i)). + apply H + ]*) +] +qed. + +theorem defactorize_aux_factorize_aux : +\forall p,n:nat.\forall acc:nat_fact.O < n \to +((n=(S O) \land p=O) \lor max_prime_factor n < p) \to +defactorize_aux (factorize_aux p n acc) O = n*(defactorize_aux acc p). +intro. +elim p +[ simplify. + elim H1 + [ elim H2. + autobatch + (*rewrite > H3. + rewrite > sym_times. + apply times_n_SO*) + | apply False_ind. + apply (not_le_Sn_O (max_prime_factor n) H2) + ] +| simplify. + (* generalizing the goal: I guess there exists a better way *) + cut (\forall q,r.(pair nat nat q r) = (p_ord_aux n1 n1 (nth_prime n)) \to + defactorize_aux match (p_ord_aux n1 n1 (nth_prime n)) with + [(pair q r) \Rightarrow (factorize_aux n r (nf_cons q acc))] O = + n1*defactorize_aux acc (S n)) + [ (*invocando autobatch in questo punto, dopo circa 7 minuti l'esecuzione non era ancora terminata + ne' con un errore ne' chiudendo il goal + *) + apply (Hcut (fst ? ? (p_ord_aux n1 n1 (nth_prime n))) + (snd ? ? (p_ord_aux n1 n1 (nth_prime n)))). + autobatch + (*apply sym_eq.apply eq_pair_fst_snd*) + | intros. + rewrite < H3. + simplify. + cut (n1 = r * (nth_prime n) \sup q) + [ rewrite > H + [ simplify. + autobatch + (*rewrite < assoc_times. + rewrite < Hcut. + reflexivity.*) + | autobatch + (*cut (O < r \lor O = r) + [ elim Hcut1 + [ assumption + | absurd (n1 = O) + [ rewrite > Hcut. + rewrite < H4. + reflexivity + | unfold Not. + intro. + apply (not_le_Sn_O O). + rewrite < H5 in \vdash (? ? %). + assumption + ] + ] + | apply le_to_or_lt_eq. + apply le_O_n + ]*) + | cut ((S O) < r \lor (S O) \nlt r) + [ elim Hcut1 + [ right. + apply (p_ord_to_lt_max_prime_factor1 n1 ? q r) + [ assumption + | elim H2 + [ elim H5. + apply False_ind. + apply (not_eq_O_S n). + autobatch + (*apply sym_eq. + assumption*) + | autobatch + (*apply le_S_S_to_le. + exact H5*) + ] + | assumption + | assumption + ] + | cut (r=(S O)) + [ apply (nat_case n) + [ autobatch + (*left. + split + [ assumption + | reflexivity + ]*) + | intro. + right. + rewrite > Hcut2. + autobatch + (*simplify. + unfold lt. + apply le_S_S. + apply le_O_n*) + ] + | cut (r < (S O) ∨ r=(S O)) + [ elim Hcut2 + [ absurd (O=r) + [ autobatch + (*apply le_n_O_to_eq. + apply le_S_S_to_le. + exact H5*) + | unfold Not. + intro. + autobatch + (*cut (O=n1) + [ apply (not_le_Sn_O O). + rewrite > Hcut3 in ⊢ (? ? %). + assumption + | rewrite > Hcut. + rewrite < H6. + reflexivity + ]*) + ] + | assumption + ] + | autobatch + (*apply (le_to_or_lt_eq r (S O)). + apply not_lt_to_le. + assumption*) + ] + ] + ] + | apply (decidable_lt (S O) r) + ] + ] + | rewrite > sym_times. + apply (p_ord_aux_to_exp n1 n1) + [ apply lt_O_nth_prime_n + | assumption + ] + ] + ] +] +qed. + +theorem defactorize_factorize: \forall n:nat.defactorize (factorize n) = n. +intro. +apply (nat_case n) +[ reflexivity +| intro. + apply (nat_case m) + [ reflexivity + | intro.(*CSC: simplify here does something really nasty *) + change with + (let p \def (max (S(S m1)) (\lambda p:nat.eqb ((S(S m1)) \mod (nth_prime p)) O)) in + defactorize (match p_ord (S(S m1)) (nth_prime p) with + [ (pair q r) \Rightarrow + nfa_proper (factorize_aux p r (nf_last (pred q)))])=(S(S m1))). + intro. + (* generalizing the goal; find a better way *) + cut (\forall q,r.(pair nat nat q r) = (p_ord (S(S m1)) (nth_prime p)) \to + defactorize (match p_ord (S(S m1)) (nth_prime p) with + [ (pair q r) \Rightarrow + nfa_proper (factorize_aux p r (nf_last (pred q)))])=(S(S m1))) + [ (*invocando autobatch qui, dopo circa 300 secondi non si ottiene alcun risultato*) + apply (Hcut (fst ? ? (p_ord (S(S m1)) (nth_prime p))) + (snd ? ? (p_ord (S(S m1)) (nth_prime p)))). + autobatch + (*apply sym_eq. + apply eq_pair_fst_snd*) + | intros. + rewrite < H. + simplify. + cut ((S(S m1)) = (nth_prime p) \sup q *r) + [ cut (O defactorize_aux_factorize_aux + [ (*CSC: simplify here does something really nasty *) + change with (r*(nth_prime p) \sup (S (pred q)) = (S(S m1))). + cut ((S (pred q)) = q) + [ (*invocando autobatch qui, dopo circa 300 secondi non si ottiene ancora alcun risultato*) + rewrite > Hcut2. + autobatch + (*rewrite > sym_times. + apply sym_eq. + apply (p_ord_aux_to_exp (S(S m1))) + [ apply lt_O_nth_prime_n + | assumption + ]*) + | (* O < q *) + apply sym_eq. + apply S_pred. + cut (O < q \lor O = q) + [ elim Hcut2 + [ assumption + | absurd (nth_prime p \divides S (S m1)) + [ apply (divides_max_prime_factor_n (S (S m1))). + autobatch + (*unfold lt. + apply le_S_S. + apply le_S_S. + apply le_O_n.*) + | cut ((S(S m1)) = r) + [ rewrite > Hcut3 in \vdash (? (? ? %)). + (*CSC: simplify here does something really nasty *) + change with (nth_prime p \divides r \to False). + intro. + apply (p_ord_aux_to_not_mod_O (S(S m1)) (S(S m1)) (nth_prime p) q r) [ apply lt_SO_nth_prime_n + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | apply le_n + | assumption + | (*invocando autobatch qui, dopo circa 300 secondi non si ottiene ancora alcun risultato*) + apply divides_to_mod_O + [ apply lt_O_nth_prime_n + | assumption + ] + ] + | rewrite > times_n_SO in \vdash (? ? ? %). + rewrite < sym_times. + rewrite > (exp_n_O (nth_prime p)). + rewrite > H1 in \vdash (? ? ? (? (? ? %) ?)). + assumption + ] + ] + ] + | autobatch + (*apply le_to_or_lt_eq. + apply le_O_n*) + ] + ] + | assumption + | (* e adesso l'ultimo goal. TASSI: che ora non e' piu' l'ultimo :P *) + cut ((S O) < r \lor S O \nlt r) + [ elim Hcut2 + [ right. + apply (p_ord_to_lt_max_prime_factor1 (S(S m1)) ? q r);autobatch + (*[ unfold lt. + apply le_S_S. + apply le_O_n + | apply le_n + | assumption + | assumption + ]*) + | cut (r=(S O)) + [ apply (nat_case p) + [ autobatch + (*left. + split + [ assumption + | reflexivity + ]*) + | intro. + right. + rewrite > Hcut3. + autobatch + (*simplify. + unfold lt. + apply le_S_S. + apply le_O_n*) + ] + | cut (r \lt (S O) \or r=(S O)) + [ elim Hcut3 + [ absurd (O=r);autobatch + (*[ apply le_n_O_to_eq. + apply le_S_S_to_le. + exact H2 + | unfold Not. + intro. + apply (not_le_Sn_O O). + rewrite > H3 in \vdash (? ? %). + assumption + ]*) + | assumption + ] + | autobatch + (*apply (le_to_or_lt_eq r (S O)). + apply not_lt_to_le. + assumption*) + ] + ] + ] + | apply (decidable_lt (S O) r) + ] + ] + | (* O < r *) + cut (O < r \lor O = r) + [ elim Hcut1 + [ assumption + | apply False_ind. + apply (not_eq_O_S (S m1)). + rewrite > Hcut. + rewrite < H1. + autobatch + (*rewrite < times_n_O. + reflexivity*) + ] + | autobatch + (*apply le_to_or_lt_eq. + apply le_O_n*) + ] + ] + | (* prova del cut *) + apply (p_ord_aux_to_exp (S(S m1)));autobatch + (*[ apply lt_O_nth_prime_n + | assumption + ]*) + (* fine prova cut *) + ] + ] + ] +] +qed. + +let rec max_p f \def +match f with +[ (nf_last n) \Rightarrow O +| (nf_cons n g) \Rightarrow S (max_p g)]. + +let rec max_p_exponent f \def +match f with +[ (nf_last n) \Rightarrow n +| (nf_cons n g) \Rightarrow max_p_exponent g]. + +theorem divides_max_p_defactorize: \forall f:nat_fact.\forall i:nat. +nth_prime ((max_p f)+i) \divides defactorize_aux f i. +intro. +elim f +[ simplify. + autobatch + (*apply (witness ? ? ((nth_prime i) \sup n)). + reflexivity*) +| change with + (nth_prime (S(max_p n1)+i) \divides + (nth_prime i) \sup n *(defactorize_aux n1 (S i))). + elim (H (S i)). + rewrite > H1. + rewrite < sym_times. + rewrite > assoc_times. + autobatch + (*rewrite < plus_n_Sm. + apply (witness ? ? (n2* (nth_prime i) \sup n)). + reflexivity*) +] +qed. + +theorem divides_exp_to_divides: +\forall p,n,m:nat. prime p \to +p \divides n \sup m \to p \divides n. +intros 3. +elim m +[ simplify in H1. + autobatch + (*apply (transitive_divides p (S O)) + [ assumption + | apply divides_SO_n + ]*) +| cut (p \divides n \lor p \divides n \sup n1) + [ elim Hcut + [ assumption + | autobatch + (*apply H;assumption*) + ] + | autobatch + (*apply divides_times_to_divides + [ assumption + | exact H2 + ]*) + ] +] +qed. + +theorem divides_exp_to_eq: +\forall p,q,m:nat. prime p \to prime q \to +p \divides q \sup m \to p = q. +intros. +unfold prime in H1. +elim H1. +apply H4 +[ apply (divides_exp_to_divides p q m);assumption +| (*invocando autobatch in questo punto, dopo piu' di 8 minuti la computazione non + * era ancora terminata. + *) + unfold prime in H. + (*invocando autobatch anche in questo punto, dopo piu' di 10 minuti la computazione + * non era ancora terminata. + *) + elim H. + assumption +] +qed. + +theorem not_divides_defactorize_aux: \forall f:nat_fact. \forall i,j:nat. +i < j \to nth_prime i \ndivides defactorize_aux f j. +intro. +elim f +[ change with + (nth_prime i \divides (nth_prime j) \sup (S n) \to False). + intro. + absurd ((nth_prime i) = (nth_prime j)) + [ apply (divides_exp_to_eq ? ? (S n));autobatch + (*[ apply prime_nth_prime + | apply prime_nth_prime + | assumption + ]*) + | unfold Not. + intro. + cut (i = j) + [ apply (not_le_Sn_n i). + rewrite > Hcut in \vdash (? ? %). + assumption + | apply (injective_nth_prime ? ? H2) + ] + ] +| unfold Not. + simplify. + intro. + cut (nth_prime i \divides (nth_prime j) \sup n + \lor nth_prime i \divides defactorize_aux n1 (S j)) + [ elim Hcut + [ absurd ((nth_prime i) = (nth_prime j)) + [ apply (divides_exp_to_eq ? ? n);autobatch + (*[ apply prime_nth_prime + | apply prime_nth_prime + | assumption + ]*) + | unfold Not. + intro. + cut (i = j) + [ apply (not_le_Sn_n i). + rewrite > Hcut1 in \vdash (? ? %). + assumption + | apply (injective_nth_prime ? ? H4) + ] + ] + | apply (H i (S j)) + [ autobatch + (*apply (trans_lt ? j) + [ assumption + | unfold lt. + apply le_n + ]*) + | assumption + ] + ] + | autobatch + (*apply divides_times_to_divides. + apply prime_nth_prime. + assumption*) + ] +] +qed. + +lemma not_eq_nf_last_nf_cons: \forall g:nat_fact.\forall n,m,i:nat. +\lnot (defactorize_aux (nf_last n) i= defactorize_aux (nf_cons m g) i). +intros. +change with +(exp (nth_prime i) (S n) = defactorize_aux (nf_cons m g) i \to False). +intro. +cut (S(max_p g)+i= i) +[ apply (not_le_Sn_n i). + rewrite < Hcut in \vdash (? ? %). (*chiamando autobatch qui da uno strano errore "di tipo"*) + simplify. + autobatch + (*apply le_S_S. + apply le_plus_n*) +| apply injective_nth_prime. + apply (divides_exp_to_eq ? ? (S n)) + [ apply prime_nth_prime + | apply prime_nth_prime + | rewrite > H. + change with (divides (nth_prime ((max_p (nf_cons m g))+i)) + (defactorize_aux (nf_cons m g) i)). + apply divides_max_p_defactorize + ] +] +qed. + +lemma not_eq_nf_cons_O_nf_cons: \forall f,g:nat_fact.\forall n,i:nat. +\lnot (defactorize_aux (nf_cons O f) i= defactorize_aux (nf_cons (S n) g) i). +intros. +simplify. +unfold Not. +rewrite < plus_n_O. +intro. +apply (not_divides_defactorize_aux f i (S i) ?) +[ autobatch + (*unfold lt. + apply le_n*) +| autobatch + (*rewrite > H. + rewrite > assoc_times. + apply (witness ? ? ((exp (nth_prime i) n)*(defactorize_aux g (S i)))). + reflexivity*) +] +qed. + +theorem eq_defactorize_aux_to_eq: \forall f,g:nat_fact.\forall i:nat. +defactorize_aux f i = defactorize_aux g i \to f = g. +intro. +elim f +[ generalize in match H. + elim g + [ apply eq_f. + apply inj_S. + apply (inj_exp_r (nth_prime i)) + [ apply lt_SO_nth_prime_n + | (*qui autobatch non conclude il goal attivo*) + assumption + ] + | apply False_ind. + (*autobatch chiamato qui NON conclude il goal attivo*) + apply (not_eq_nf_last_nf_cons n2 n n1 i H2) + ] +| generalize in match H1. + elim g + [ apply False_ind. + apply (not_eq_nf_last_nf_cons n1 n2 n i). + autobatch + (*apply sym_eq. + assumption*) + | simplify in H3. + generalize in match H3. + apply (nat_elim2 (\lambda n,n2. + ((nth_prime i) \sup n)*(defactorize_aux n1 (S i)) = + ((nth_prime i) \sup n2)*(defactorize_aux n3 (S i)) \to + nf_cons n n1 = nf_cons n2 n3)) + [ intro. + elim n4 + [ autobatch + (*apply eq_f. + apply (H n3 (S i)) + simplify in H4. + rewrite > plus_n_O. + rewrite > (plus_n_O (defactorize_aux n3 (S i))). + assumption*) + | apply False_ind. + apply (not_eq_nf_cons_O_nf_cons n1 n3 n5 i). + (*autobatch chiamato qui NON chiude il goal attivo*) + assumption + ] + | intros. + apply False_ind. + apply (not_eq_nf_cons_O_nf_cons n3 n1 n4 i). + apply sym_eq. + (*autobatch chiamato qui non chiude il goal*) + assumption + | intros. + cut (nf_cons n4 n1 = nf_cons m n3) + [ cut (n4=m) + [ cut (n1=n3) + [ autobatch + (*rewrite > Hcut1. + rewrite > Hcut2. + reflexivity*) + | change with + (match nf_cons n4 n1 with + [ (nf_last m) \Rightarrow n1 + | (nf_cons m g) \Rightarrow g ] = n3). + rewrite > Hcut. + autobatch + (*simplify. + reflexivity*) + ] + | change with + (match nf_cons n4 n1 with + [ (nf_last m) \Rightarrow m + | (nf_cons m g) \Rightarrow m ] = m). + (*invocando autobatch qui, dopo circa 8 minuti la computazione non era ancora terminata*) + rewrite > Hcut. + autobatch + (*simplify. + reflexivity*) + ] + | apply H4. + simplify in H5. + apply (inj_times_r1 (nth_prime i)) + [ apply lt_O_nth_prime_n + | rewrite < assoc_times. + rewrite < assoc_times. + assumption + ] + ] + ] + ] +] +qed. + +theorem injective_defactorize_aux: \forall i:nat. +injective nat_fact nat (\lambda f.defactorize_aux f i). +simplify. +intros. +apply (eq_defactorize_aux_to_eq x y i H). +qed. + +theorem injective_defactorize: +injective nat_fact_all nat defactorize. +unfold injective. +change with (\forall f,g.defactorize f = defactorize g \to f=g). +intro. +elim f +[ generalize in match H. + elim g + [ (* zero - zero *) + reflexivity + | (* zero - one *) + simplify in H1. + apply False_ind. + apply (not_eq_O_S O H1) + | (* zero - proper *) + simplify in H1. + apply False_ind. + apply (not_le_Sn_n O). + rewrite > H1 in \vdash (? ? %). + autobatch + (*change with (O < defactorize_aux n O). + apply lt_O_defactorize_aux*) + ] +| generalize in match H. + elim g + [ (* one - zero *) + simplify in H1. + apply False_ind. + autobatch + (*apply (not_eq_O_S O). + apply sym_eq. + assumption*) + | (* one - one *) + reflexivity + | (* one - proper *) + simplify in H1. + apply False_ind. + apply (not_le_Sn_n (S O)). + rewrite > H1 in \vdash (? ? %). + autobatch + (*change with ((S O) < defactorize_aux n O). + apply lt_SO_defactorize_aux*) + ] +| generalize in match H. + elim g + [ (* proper - zero *) + simplify in H1. + apply False_ind. + apply (not_le_Sn_n O). + rewrite < H1 in \vdash (? ? %). + autobatch + (*change with (O < defactorize_aux n O). + apply lt_O_defactorize_aux.*) + | (* proper - one *) + simplify in H1. + apply False_ind. + apply (not_le_Sn_n (S O)). + rewrite < H1 in \vdash (? ? %). + autobatch + (*change with ((S O) < defactorize_aux n O). + apply lt_SO_defactorize_aux.*) + | (* proper - proper *) + apply eq_f. + apply (injective_defactorize_aux O). + (*invocata qui la tattica autobatch NON chiude il goal, chiuso invece + *da exact H1 + *) + exact H1 + ] +] +qed. + +theorem factorize_defactorize: +\forall f,g: nat_fact_all. factorize (defactorize f) = f. +intros. +autobatch. +(*apply injective_defactorize. +apply defactorize_factorize. +*) +qed. diff --git a/matita/library_auto/auto/nat/fermat_little_theorem.ma b/matita/library_auto/auto/nat/fermat_little_theorem.ma new file mode 100644 index 000000000..a04adaad8 --- /dev/null +++ b/matita/library_auto/auto/nat/fermat_little_theorem.ma @@ -0,0 +1,448 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/fermat_little_theorem". + +include "auto/nat/exp.ma". +include "auto/nat/gcd.ma". +include "auto/nat/permutation.ma". +include "auto/nat/congruence.ma". + +theorem permut_S_mod: \forall n:nat. permut (S_mod (S n)) n. +intro. +unfold permut. +split +[ intros. + unfold S_mod. + autobatch + (*apply le_S_S_to_le. + change with ((S i) \mod (S n) < S n). + apply lt_mod_m_m. + unfold lt. + apply le_S_S. + apply le_O_n*) +| unfold injn. + intros. + apply inj_S. + rewrite < (lt_to_eq_mod i (S n)) + [ rewrite < (lt_to_eq_mod j (S n)) + [ cut (i < n \lor i = n) + [ cut (j < n \lor j = n) + [ elim Hcut + [ elim Hcut1 + [ (* i < n, j< n *) + rewrite < mod_S + [ rewrite < mod_S + [ (*qui autobatch non chiude il goal, chiuso invece dalla tattica + * apply H2 + *) + apply H2 + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | rewrite > lt_to_eq_mod; + unfold lt;autobatch.(*apply le_S_S;assumption*) + ] + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | rewrite > lt_to_eq_mod + [ unfold lt.autobatch + (*apply le_S_S. + assumption*) + | unfold lt.autobatch + (*apply le_S_S. + assumption*) + ] + ] + | (* i < n, j=n *) + unfold S_mod in H2. + simplify. + apply False_ind. + apply (not_eq_O_S (i \mod (S n))). + apply sym_eq. + rewrite < (mod_n_n (S n)) + [ rewrite < H4 in \vdash (? ? ? (? %?)). + rewrite < mod_S + [ assumption + | unfold lt.autobatch + (*apply le_S_S. + apply le_O_n*) + | rewrite > lt_to_eq_mod; + unfold lt;autobatch;(*apply le_S_S;assumption*) + ] + | unfold lt.autobatch + (*apply le_S_S. + apply le_O_n*) + ] + ] + | (* i = n, j < n *) + elim Hcut1 + [ apply False_ind. + apply (not_eq_O_S (j \mod (S n))). + rewrite < (mod_n_n (S n)) + [ rewrite < H3 in \vdash (? ? (? %?) ?). + rewrite < mod_S + [ assumption + | unfold lt.autobatch + (*apply le_S_S. + apply le_O_n*) + | rewrite > lt_to_eq_mod; + unfold lt;autobatch(*apply le_S_S;assumption*) + ] + | unfold lt.autobatch + (*apply le_S_S. + apply le_O_n*) + ] + |(* i = n, j= n*) + autobatch + (*rewrite > H3. + rewrite > H4. + reflexivity*) + ] + ] + | autobatch + (*apply le_to_or_lt_eq. + assumption*) + ] + | autobatch + (*apply le_to_or_lt_eq. + assumption*) + ] + | unfold lt.autobatch + (*apply le_S_S. + assumption*) + ] + | unfold lt.autobatch + (*apply le_S_S. + assumption*) + ] +] +qed. + +(* +theorem eq_fact_pi: \forall n,m:nat. n < m \to n! = pi n (S_mod m). +intro.elim n. +simplify.reflexivity. +change with (S n1)*n1!=(S_mod m n1)*(pi n1 (S_mod m)). +unfold S_mod in \vdash (? ? ? (? % ?)). +rewrite > lt_to_eq_mod. +apply eq_f.apply H.apply (trans_lt ? (S n1)). +simplify. apply le_n.assumption.assumption. +qed. +*) + +theorem prime_to_not_divides_fact: \forall p:nat. prime p \to \forall n:nat. +n \lt p \to \not divides p n!. +intros 3. +elim n +[ unfold Not. + intros. + apply (lt_to_not_le (S O) p) + [ unfold prime in H. + elim H. + assumption + | autobatch + (*apply divides_to_le. + unfold lt. + apply le_n. + assumption*) + ] +| change with (divides p ((S n1)*n1!) \to False). + intro. + cut (divides p (S n1) \lor divides p n1!) + [ elim Hcut + [ apply (lt_to_not_le (S n1) p) + [ assumption + | autobatch + (*apply divides_to_le + [ unfold lt. + apply le_S_S. + apply le_O_n + | assumption + ]*) + ] + | autobatch + (*apply H1 + [ apply (trans_lt ? (S n1)) + [ unfold lt. + apply le_n + | assumption + ] + | assumption + ]*) + ] + | autobatch + (*apply divides_times_to_divides; + assumption*) + ] +] +qed. + +theorem permut_mod: \forall p,a:nat. prime p \to +\lnot divides p a\to permut (\lambda n.(mod (a*n) p)) (pred p). +unfold permut. +intros. +split +[ intros. + apply le_S_S_to_le. + apply (trans_le ? p) + [ change with (mod (a*i) p < p). + apply lt_mod_m_m. + unfold prime in H. + elim H. + autobatch + (*unfold lt. + apply (trans_le ? (S (S O))) + [ apply le_n_Sn + | assumption + ]*) + | rewrite < S_pred + [ apply le_n + | unfold prime in H. + elim H. + autobatch + (*apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ]*) + ] + ] +| unfold injn. + intros. + apply (nat_compare_elim i j) + [ (* i < j *) + intro. + absurd (j-i \lt p) + [ unfold lt. + rewrite > (S_pred p) + [ autobatch + (*apply le_S_S. + apply le_plus_to_minus. + apply (trans_le ? (pred p)) + [ assumption + | rewrite > sym_plus. + apply le_plus_n + ]*) + | unfold prime in H. elim H. autobatch. + (* + apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ]*) + ] + | apply (le_to_not_lt p (j-i)). + apply divides_to_le + [ unfold lt.autobatch + (*apply le_SO_minus. + assumption*) + | cut (divides p a \lor divides p (j-i)) + [ elim Hcut + [ apply False_ind. + autobatch + (*apply H1. + assumption*) + | assumption + ] + | apply divides_times_to_divides + [ assumption + | rewrite > distr_times_minus. + apply eq_mod_to_divides + [ unfold prime in H.elim H.autobatch + (*apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ]*) + | autobatch + (*apply sym_eq. + apply H4*) + ] + ] + ] + ] + ] + |(* i = j *) + autobatch + (*intro. + assumption*) + | (* j < i *) + intro. + absurd (i-j \lt p) + [ unfold lt. + rewrite > (S_pred p) + [ autobatch + (*apply le_S_S. + apply le_plus_to_minus. + apply (trans_le ? (pred p)) + [ assumption + | rewrite > sym_plus. + apply le_plus_n + ]*) + | unfold prime in H.elim H.autobatch. + (* + apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ]*) + ] + | apply (le_to_not_lt p (i-j)). + apply divides_to_le + [ unfold lt.autobatch + (*apply le_SO_minus. + assumption*) + | cut (divides p a \lor divides p (i-j)) + [ elim Hcut + [ apply False_ind. + autobatch + (*apply H1. + assumption*) + | assumption + ] + | apply divides_times_to_divides + [ assumption + | rewrite > distr_times_minus. + apply eq_mod_to_divides + [ unfold prime in H.elim H.autobatch. + (* + apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ]*) + | apply H4 + ] + ] + ] + ] + ] + ] +] +qed. + +theorem congruent_exp_pred_SO: \forall p,a:nat. prime p \to \lnot divides p a \to +congruent (exp a (pred p)) (S O) p. +intros. +cut (O < a) +[ cut (O < p) + [ cut (O < pred p) + [ apply divides_to_congruent + [ assumption + | autobatch + (*change with (O < exp a (pred p)). + apply lt_O_exp. + assumption*) + | cut (divides p (exp a (pred p)-(S O)) \lor divides p (pred p)!) + [ elim Hcut3 + [ assumption + | apply False_ind. + apply (prime_to_not_divides_fact p H (pred p)) + [ unfold lt. + autobatch + (*rewrite < (S_pred ? Hcut1). + apply le_n*) + | assumption + ] + ] + | apply divides_times_to_divides + [ assumption + | rewrite > times_minus_l. + rewrite > (sym_times (S O)). + rewrite < times_n_SO. + rewrite > (S_pred (pred p) Hcut2). + rewrite > eq_fact_pi. + rewrite > exp_pi_l. + apply congruent_to_divides + [ assumption + | apply (transitive_congruent p ? + (pi (pred (pred p)) (\lambda m. a*m \mod p) (S O))) + [ apply (congruent_pi (\lambda m. a*m)). + assumption + | cut (pi (pred(pred p)) (\lambda m.m) (S O) + = pi (pred(pred p)) (\lambda m.a*m \mod p) (S O)) + [ rewrite > Hcut3. + apply congruent_n_n + | rewrite < eq_map_iter_i_pi. + rewrite < eq_map_iter_i_pi. + apply (permut_to_eq_map_iter_i ? ? ? ? ? (λm.m)) + [ apply assoc_times + | (*NB qui autobatch non chiude il goal, chiuso invece dalla sola + ( tattica apply sys_times + *) + apply sym_times + | rewrite < plus_n_Sm. + rewrite < plus_n_O. + rewrite < (S_pred ? Hcut2). + autobatch + (*apply permut_mod + [ assumption + | assumption + ]*) + | intros. + cut (m=O) + [ autobatch + (*rewrite > Hcut3. + rewrite < times_n_O. + apply mod_O_n.*) + | autobatch + (*apply sym_eq. + apply le_n_O_to_eq. + apply le_S_S_to_le. + assumption*) + ] + ] + ] + ] + ] + ] + ] + ] + | unfold lt. + apply le_S_S_to_le. + rewrite < (S_pred ? Hcut1). + unfold prime in H. + elim H. + assumption + ] + | unfold prime in H. + elim H. + autobatch + (*apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ]*) + ] +| cut (O < a \lor O = a) + [ elim Hcut + [ assumption + | apply False_ind. + apply H1. + rewrite < H2. + autobatch + (*apply (witness ? ? O). + apply times_n_O*) + ] + | autobatch + (*apply le_to_or_lt_eq. + apply le_O_n*) + ] +] +qed. + diff --git a/matita/library_auto/auto/nat/gcd.ma b/matita/library_auto/auto/nat/gcd.ma new file mode 100644 index 000000000..e9c4752d6 --- /dev/null +++ b/matita/library_auto/auto/nat/gcd.ma @@ -0,0 +1,1088 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/gcd". + +include "auto/nat/primes.ma". + +let rec gcd_aux p m n: nat \def +match divides_b n m with +[ true \Rightarrow n +| false \Rightarrow + match p with + [O \Rightarrow n + |(S q) \Rightarrow gcd_aux q n (m \mod n)]]. + +definition gcd : nat \to nat \to nat \def +\lambda n,m:nat. + match leb n m with + [ true \Rightarrow + match n with + [ O \Rightarrow m + | (S p) \Rightarrow gcd_aux (S p) m (S p) ] + | false \Rightarrow + match m with + [ O \Rightarrow n + | (S p) \Rightarrow gcd_aux (S p) n (S p) ]]. + +theorem divides_mod: \forall p,m,n:nat. O < n \to p \divides m \to p \divides n \to +p \divides (m \mod n). +intros.elim H1.elim H2. +apply (witness ? ? (n2 - n1*(m / n))). +(*apply witness[|*) + rewrite > distr_times_minus. + rewrite < H3 in \vdash (? ? ? (? % ?)). + rewrite < assoc_times. + rewrite < H4 in \vdash (? ? ? (? ? (? % ?))). + apply sym_eq. + apply plus_to_minus. + rewrite > sym_times. + autobatch. + (*letin x \def div. + rewrite < (div_mod ? ? H). + reflexivity.*) +(*]*) +qed. + +theorem divides_mod_to_divides: \forall p,m,n:nat. O < n \to +p \divides (m \mod n) \to p \divides n \to p \divides m. +intros. +elim H1. +elim H2. +apply (witness p m ((n1*(m / n))+n2)). +rewrite > distr_times_plus. +rewrite < H3. +rewrite < assoc_times. +rewrite < H4. +rewrite < sym_times. +autobatch. +(*apply div_mod. +assumption.*) +qed. + + +theorem divides_gcd_aux_mn: \forall p,m,n. O < n \to n \le m \to n \le p \to +gcd_aux p m n \divides m \land gcd_aux p m n \divides n. +intro. +elim p +[ absurd (O < n);autobatch + (*[ assumption + | apply le_to_not_lt. + assumption + ]*) +| cut ((n1 \divides m) \lor (n1 \ndivides m)) + [ simplify. + elim Hcut + [ rewrite > divides_to_divides_b_true + [ simplify. + autobatch + (*split + [ assumption + | apply (witness n1 n1 (S O)). + apply times_n_SO + ]*) + | assumption + | assumption + ] + | rewrite > not_divides_to_divides_b_false + [ simplify. + cut (gcd_aux n n1 (m \mod n1) \divides n1 \land + gcd_aux n n1 (m \mod n1) \divides mod m n1) + [ elim Hcut1. + autobatch width = 4. + (*split + [ apply (divides_mod_to_divides ? ? n1);assumption + | assumption + ]*) + | apply H + [ cut (O \lt m \mod n1 \lor O = mod m n1) + [ elim Hcut1 + [ assumption + | apply False_ind. + autobatch + (*apply H4. + apply mod_O_to_divides + [ assumption + | apply sym_eq. + assumption + ]*) + ] + | autobatch + (*apply le_to_or_lt_eq. + apply le_O_n*) + ] + | autobatch + (*apply lt_to_le. + apply lt_mod_m_m. + assumption*) + | apply le_S_S_to_le. + apply (trans_le ? n1);autobatch + (*[ autobatch.change with (m \mod n1 < n1). + apply lt_mod_m_m. + assumption + | assumption + ]*) + ] + ] + | assumption + | assumption + ] + ] + | autobatch + (*apply (decidable_divides n1 m). + assumption*) + ] +] +qed. + +theorem divides_gcd_nm: \forall n,m. +gcd n m \divides m \land gcd n m \divides n. +intros. +(*CSC: simplify simplifies too much because of a redex in gcd *) +change with +(match leb n m with + [ true \Rightarrow + match n with + [ O \Rightarrow m + | (S p) \Rightarrow gcd_aux (S p) m (S p) ] + | false \Rightarrow + match m with + [ O \Rightarrow n + | (S p) \Rightarrow gcd_aux (S p) n (S p) ] ] \divides m +\land +match leb n m with + [ true \Rightarrow + match n with + [ O \Rightarrow m + | (S p) \Rightarrow gcd_aux (S p) m (S p) ] + | false \Rightarrow + match m with + [ O \Rightarrow n + | (S p) \Rightarrow gcd_aux (S p) n (S p) ] ] \divides n). +apply (leb_elim n m) +[ apply (nat_case1 n) + [ simplify. + intros. + autobatch + (*split + [ apply (witness m m (S O)). + apply times_n_SO + | apply (witness m O O). + apply times_n_O + ]*) + | intros. + change with + (gcd_aux (S m1) m (S m1) \divides m + \land + gcd_aux (S m1) m (S m1) \divides (S m1)). + autobatch + (*apply divides_gcd_aux_mn + [ unfold lt. + apply le_S_S. + apply le_O_n + | assumption + | apply le_n + ]*) + ] +| simplify. + intro. + apply (nat_case1 m) + [ simplify. + intros. + autobatch + (*split + [ apply (witness n O O). + apply times_n_O + | apply (witness n n (S O)). + apply times_n_SO + ]*) + | intros. + change with + (gcd_aux (S m1) n (S m1) \divides (S m1) + \land + gcd_aux (S m1) n (S m1) \divides n). + cut (gcd_aux (S m1) n (S m1) \divides n + \land + gcd_aux (S m1) n (S m1) \divides S m1) + [ elim Hcut. + autobatch + (*split;assumption*) + | apply divides_gcd_aux_mn + [ autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | apply not_lt_to_le. + unfold Not. + unfold lt. + intro. + apply H. + rewrite > H1. + autobatch + (*apply (trans_le ? (S n)) + [ apply le_n_Sn + | assumption + ]*) + | apply le_n + ] + ] + ] +] +qed. + +theorem divides_gcd_n: \forall n,m. gcd n m \divides n. +intros. +exact (proj2 ? ? (divides_gcd_nm n m)). (*autobatch non termina la dimostrazione*) +qed. + +theorem divides_gcd_m: \forall n,m. gcd n m \divides m. +intros. +exact (proj1 ? ? (divides_gcd_nm n m)). (*autobatch non termina la dimostrazione*) +qed. + +theorem divides_gcd_aux: \forall p,m,n,d. O < n \to n \le m \to n \le p \to +d \divides m \to d \divides n \to d \divides gcd_aux p m n. +intro. +elim p +[ absurd (O < n);autobatch + (*[ assumption + | apply le_to_not_lt. + assumption + ]*) +| simplify. + cut (n1 \divides m \lor n1 \ndivides m) + [ elim Hcut. + rewrite > divides_to_divides_b_true; + simplify; autobatch. + (*[ simplify. + assumption. + | assumption. + | assumption. + ]*) + rewrite > not_divides_to_divides_b_false + [ simplify. + apply H + [ cut (O \lt m \mod n1 \lor O = m \mod n1) + [ elim Hcut1 + [ assumption + | + absurd (n1 \divides m);autobatch + (*[ apply mod_O_to_divides + [ assumption. + | apply sym_eq.assumption. + ] + | assumption + ]*) + ] + | autobatch + (*apply le_to_or_lt_eq. + apply le_O_n*) + ] + | autobatch + (*apply lt_to_le. + apply lt_mod_m_m. + assumption*) + | apply le_S_S_to_le. + autobatch + (*apply (trans_le ? n1) + [ change with (m \mod n1 < n1). + apply lt_mod_m_m. + assumption + | assumption + ]*) + | assumption + | autobatch + (*apply divides_mod; + assumption*) + ] + | assumption + | assumption + ] + | autobatch + (*apply (decidable_divides n1 m). + assumption*) + ] +]qed. + +theorem divides_d_gcd: \forall m,n,d. +d \divides m \to d \divides n \to d \divides gcd n m. +intros. +(*CSC: here simplify simplifies too much because of a redex in gcd *) +change with +(d \divides +match leb n m with + [ true \Rightarrow + match n with + [ O \Rightarrow m + | (S p) \Rightarrow gcd_aux (S p) m (S p) ] + | false \Rightarrow + match m with + [ O \Rightarrow n + | (S p) \Rightarrow gcd_aux (S p) n (S p) ]]). +apply (leb_elim n m) +[ apply (nat_case1 n) + [ simplify. + intros. + assumption + | intros. + change with (d \divides gcd_aux (S m1) m (S m1)). + apply divides_gcd_aux + [ unfold lt.autobatch + (*apply le_S_S. + apply le_O_n.*) + | assumption. + | apply le_n. (*chiude il goal anche con autobatch*) + | assumption. + | rewrite < H2. + assumption + ] + ] +| apply (nat_case1 m) + [ simplify. + intros. + assumption + | intros. + change with (d \divides gcd_aux (S m1) n (S m1)). + apply divides_gcd_aux + [ unfold lt.autobatch + (*apply le_S_S. + apply le_O_n*) + | autobatch + (*apply lt_to_le. + apply not_le_to_lt. + assumption*) + | apply le_n (*chiude il goal anche con autobatch*) + | assumption + | rewrite < H2. + assumption + ] + ] +] +qed. + +theorem eq_minus_gcd_aux: \forall p,m,n.O < n \to n \le m \to n \le p \to +\exists a,b. a*n - b*m = gcd_aux p m n \lor b*m - a*n = gcd_aux p m n. +intro. +elim p +[ absurd (O < n);autobatch + (*[ assumption + | apply le_to_not_lt + assumption. + ]*) +| cut (O < m) + [ cut (n1 \divides m \lor n1 \ndivides m) + [ simplify. + elim Hcut1 + [ rewrite > divides_to_divides_b_true + [ simplify. + apply (ex_intro ? ? (S O)). + apply (ex_intro ? ? O). + autobatch + (*left. + simplify. + rewrite < plus_n_O. + apply sym_eq.apply minus_n_O*) + | assumption + | assumption + ] + | rewrite > not_divides_to_divides_b_false + [ change with + (\exists a,b. + a*n1 - b*m = gcd_aux n n1 (m \mod n1) + \lor + b*m - a*n1 = gcd_aux n n1 (m \mod n1)). + cut + (\exists a,b. + a*(m \mod n1) - b*n1= gcd_aux n n1 (m \mod n1) + \lor + b*n1 - a*(m \mod n1) = gcd_aux n n1 (m \mod n1)) + [ elim Hcut2. + elim H5. + elim H6 + [ (* first case *) + rewrite < H7. + apply (ex_intro ? ? (a1+a*(m / n1))). + apply (ex_intro ? ? a). + right. + rewrite < sym_plus. + rewrite < (sym_times n1). + rewrite > distr_times_plus. + rewrite > (sym_times n1). + rewrite > (sym_times n1). + rewrite > (div_mod m n1) in \vdash (? ? (? % ?) ?);autobatch + (*[ rewrite > assoc_times. + rewrite < sym_plus. + rewrite > distr_times_plus. + rewrite < eq_minus_minus_minus_plus. + rewrite < sym_plus.autobatch. + rewrite < plus_minus + [ rewrite < minus_n_n. + reflexivity + | apply le_n + ] + | assumption + ]*) + | (* second case *) + rewrite < H7. + apply (ex_intro ? ? (a1+a*(m / n1))). + apply (ex_intro ? ? a). + left. + (* clear Hcut2.clear H5.clear H6.clear H. *) + rewrite > sym_times. + rewrite > distr_times_plus. + rewrite > sym_times. + rewrite > (sym_times n1). + rewrite > (div_mod m n1) in \vdash (? ? (? ? %) ?) + [ rewrite > distr_times_plus. + rewrite > assoc_times. + rewrite < eq_minus_minus_minus_plus. + autobatch + (*rewrite < sym_plus. + rewrite < plus_minus + [ rewrite < minus_n_n. + reflexivity + | apply le_n + ]*) + | assumption + ] + ] + | apply (H n1 (m \mod n1)) + [ cut (O \lt m \mod n1 \lor O = m \mod n1) + [ elim Hcut2 + [ assumption + | absurd (n1 \divides m);autobatch + (*[ apply mod_O_to_divides + [ assumption + | symmetry. + assumption + ] + | assumption + ]*) + ] + | autobatch + (*apply le_to_or_lt_eq. + apply le_O_n*) + ] + | autobatch + (*apply lt_to_le. + apply lt_mod_m_m. + assumption*) + | apply le_S_S_to_le. + autobatch + (*apply (trans_le ? n1) + [ change with (m \mod n1 < n1). + apply lt_mod_m_m. + assumption + | assumption + ]*) + ] + ] + | assumption + | assumption + ] + ] + | autobatch + (*apply (decidable_divides n1 m). + assumption*) + ] + | autobatch + (*apply (lt_to_le_to_lt ? n1);assumption *) + ] +] +qed. + +theorem eq_minus_gcd: + \forall m,n.\exists a,b.a*n - b*m = (gcd n m) \lor b*m - a*n = (gcd n m). +intros. +unfold gcd. +apply (leb_elim n m) +[ apply (nat_case1 n) + [ simplify. + intros. + apply (ex_intro ? ? O). + apply (ex_intro ? ? (S O)). + autobatch + (*right.simplify. + rewrite < plus_n_O. + apply sym_eq. + apply minus_n_O*) + | intros. + change with + (\exists a,b. + a*(S m1) - b*m = (gcd_aux (S m1) m (S m1)) + \lor b*m - a*(S m1) = (gcd_aux (S m1) m (S m1))). + autobatch + (*apply eq_minus_gcd_aux + [ unfold lt. + apply le_S_S. + apply le_O_n + | assumption + | apply le_n + ]*) + ] +| apply (nat_case1 m) + [ simplify. + intros. + apply (ex_intro ? ? (S O)). + apply (ex_intro ? ? O). + autobatch + (*left.simplify. + rewrite < plus_n_O. + apply sym_eq. + apply minus_n_O*) + | intros. + change with + (\exists a,b. + a*n - b*(S m1) = (gcd_aux (S m1) n (S m1)) + \lor b*(S m1) - a*n = (gcd_aux (S m1) n (S m1))). + cut + (\exists a,b. + a*(S m1) - b*n = (gcd_aux (S m1) n (S m1)) + \lor + b*n - a*(S m1) = (gcd_aux (S m1) n (S m1))) + [ elim Hcut. + elim H2. + elim H3;apply (ex_intro ? ? a1);autobatch + (*[ apply (ex_intro ? ? a1). + apply (ex_intro ? ? a). + right. + assumption + | apply (ex_intro ? ? a1). + apply (ex_intro ? ? a). + left. + assumption + ]*) + | apply eq_minus_gcd_aux;autobatch + (*[ unfold lt. + apply le_S_S. + apply le_O_n + | autobatch.apply lt_to_le. + apply not_le_to_lt. + assumption + | apply le_n. + ]*) + ] + ] +] +qed. + +(* some properties of gcd *) + +theorem gcd_O_n: \forall n:nat. gcd O n = n. +autobatch. +(*intro.simplify.reflexivity.*) +qed. + +theorem gcd_O_to_eq_O:\forall m,n:nat. (gcd m n) = O \to +m = O \land n = O. +intros. +cut (O \divides n \land O \divides m) +[ elim Hcut. + autobatch size = 7; + (* + split; + [ apply antisymmetric_divides + [ apply divides_n_O + | assumption + ] + | apply antisymmetric_divides + [ apply divides_n_O + | assumption + ] + ]*) +| rewrite < H. + apply divides_gcd_nm +] +qed. + +theorem lt_O_gcd:\forall m,n:nat. O < n \to O < gcd m n. +intros. +autobatch. +(* +apply (divides_to_lt_O (gcd m n) n ? ?); + [apply (H). + |apply (divides_gcd_m m n). + ] +*) +qed. + +theorem gcd_n_n: \forall n.gcd n n = n. +intro. +autobatch. +(* +apply (antisymmetric_divides (gcd n n) n ? ?); + [apply (divides_gcd_n n n). + |apply (divides_d_gcd n n n ? ?); + [apply (reflexive_divides n). + |apply (reflexive_divides n). + ] + ] +*) +qed. + +theorem gcd_SO_to_lt_O: \forall i,n. (S O) < n \to gcd i n = (S O) \to +O < i. +intros. +elim (le_to_or_lt_eq ? ? (le_O_n i)) +[ assumption +| absurd ((gcd i n) = (S O)) + [ assumption + | rewrite < H2. + simplify. + unfold. + intro. + apply (lt_to_not_eq (S O) n H). + autobatch + (*apply sym_eq. + assumption*) + ] +] +qed. + +theorem gcd_SO_to_lt_n: \forall i,n. (S O) < n \to i \le n \to gcd i n = (S O) \to +i < n. +intros. +elim (le_to_or_lt_eq ? ? H1) + [assumption + |absurd ((gcd i n) = (S O)) + [assumption + |rewrite > H3. + rewrite > gcd_n_n. + unfold.intro. + apply (lt_to_not_eq (S O) n H). + apply sym_eq.assumption + ] + ] +qed. + +theorem gcd_n_times_nm: \forall n,m. O < m \to gcd n (n*m) = n. +intro.apply (nat_case n) + [intros.reflexivity + |intros. + apply le_to_le_to_eq + [apply divides_to_le + [apply lt_O_S|apply divides_gcd_n] + |apply divides_to_le + [apply lt_O_gcd.rewrite > (times_n_O O). + apply lt_times[apply lt_O_S|assumption] + |apply divides_d_gcd + [apply (witness ? ? m1).reflexivity + |apply divides_n_n + ] + ] + ] + ] +qed. + +theorem symmetric_gcd: symmetric nat gcd. +(*CSC: bug here: unfold symmetric does not work *) +change with +(\forall n,m:nat. gcd n m = gcd m n). +intros. +autobatch size = 7. +(* +apply (antisymmetric_divides (gcd n m) (gcd m n) ? ?); + [apply (divides_d_gcd n m (gcd n m) ? ?); + [apply (divides_gcd_n n m). + |apply (divides_gcd_m n m). + ] + |apply (divides_d_gcd m n (gcd m n) ? ?); + [apply (divides_gcd_n m n). + |apply (divides_gcd_m m n). + ] + ] +*) +qed. + +variant sym_gcd: \forall n,m:nat. gcd n m = gcd m n \def +symmetric_gcd. + +theorem le_gcd_times: \forall m,n,p:nat. O< p \to gcd m n \le gcd m (n*p). +intros. +apply (nat_case n) +[ apply le_n +| intro. + apply divides_to_le + [ apply lt_O_gcd. + autobatch + (*rewrite > (times_n_O O). + apply lt_times + [ autobatch.unfold lt. + apply le_S_S. + apply le_O_n + | assumption + ]*) + | apply divides_d_gcd;autobatch + (*[ apply (transitive_divides ? (S m1)) + [ apply divides_gcd_m + | apply (witness ? ? p). + reflexivity + ] + | apply divides_gcd_n + ]*) + ] +] +qed. + +theorem gcd_times_SO_to_gcd_SO: \forall m,n,p:nat. O < n \to O < p \to +gcd m (n*p) = (S O) \to gcd m n = (S O). +intros. +apply antisymmetric_le +[ rewrite < H2. + autobatch + (*apply le_gcd_times. + assumption*) +| autobatch + (*change with (O < gcd m n). + apply lt_O_gcd. + assumption*) +] +qed. + +(* for the "converse" of the previous result see the end of this development *) + +theorem eq_gcd_SO_to_not_divides: \forall n,m. (S O) < n \to +(gcd n m) = (S O) \to \lnot (divides n m). +intros.unfold.intro. +elim H2. +generalize in match H1. +rewrite > H3. +intro. +cut (O < n2) +[ elim (gcd_times_SO_to_gcd_SO n n n2 ? ? H4) + [ cut (gcd n (n*n2) = n);autobatch + (*[ autobatch.apply (lt_to_not_eq (S O) n) + [ assumption + | rewrite < H4. + assumption + ] + | apply gcd_n_times_nm. + assumption + ]*) + | autobatch + (*apply (trans_lt ? (S O)) + [ apply le_n + | assumption + ]*) + | assumption + ] +| elim (le_to_or_lt_eq O n2 (le_O_n n2)) + [ assumption + | apply False_ind. + apply (le_to_not_lt n (S O)) + [ rewrite < H4. + apply divides_to_le;autobatch + (*[ rewrite > H4. + apply lt_O_S + | apply divides_d_gcd + [ apply (witness ? ? n2). + reflexivity + | apply divides_n_n + ] + ]*) + | assumption + ] + ] +] +qed. + +theorem gcd_SO_n: \forall n:nat. gcd (S O) n = (S O). +intro. +autobatch. +(* +apply (symmetric_eq nat (S O) (gcd (S O) n) ?). +apply (antisymmetric_divides (S O) (gcd (S O) n) ? ?); + [apply (divides_SO_n (gcd (S O) n)). + |apply (divides_gcd_n (S O) n). + ] +*) +qed. + +theorem divides_gcd_mod: \forall m,n:nat. O < n \to +divides (gcd m n) (gcd n (m \mod n)). +intros. +autobatch width = 4. +(*apply divides_d_gcd +[ apply divides_mod + [ assumption + | apply divides_gcd_n + | apply divides_gcd_m + ] +| apply divides_gcd_m. +]*) +qed. + +theorem divides_mod_gcd: \forall m,n:nat. O < n \to +divides (gcd n (m \mod n)) (gcd m n) . +intros. +autobatch. +(*apply divides_d_gcd +[ apply divides_gcd_n +| apply (divides_mod_to_divides ? ? n) + [ assumption + | apply divides_gcd_m + | apply divides_gcd_n + ] +]*) +qed. + +theorem gcd_mod: \forall m,n:nat. O < n \to +(gcd n (m \mod n)) = (gcd m n) . +intros. +autobatch. +(*apply antisymmetric_divides +[ apply divides_mod_gcd. + assumption +| apply divides_gcd_mod. + assumption +]*) +qed. + +(* gcd and primes *) + +theorem prime_to_gcd_SO: \forall n,m:nat. prime n \to n \ndivides m \to +gcd n m = (S O). +intros.unfold prime in H. +elim H. +apply antisym_le +[ apply not_lt_to_le.unfold Not.unfold lt. + intro. + apply H1. + rewrite < (H3 (gcd n m)); + [autobatch|autobatch| unfold lt; autobatch] + (*[ apply divides_gcd_m + | apply divides_gcd_n + | assumption + ]*) +| cut (O < gcd n m \lor O = gcd n m) + [ elim Hcut + [ assumption + | apply False_ind. + apply (not_le_Sn_O (S O)). + cut (n=O \land m=O) + [ elim Hcut1. + rewrite < H5 in \vdash (? ? %). + assumption + | autobatch + (*apply gcd_O_to_eq_O. + apply sym_eq. + assumption*) + ] + ] + | autobatch + (*apply le_to_or_lt_eq. + apply le_O_n*) + ] +] +qed. + +theorem divides_times_to_divides: \forall n,p,q:nat.prime n \to n \divides p*q \to +n \divides p \lor n \divides q. +intros. +cut (n \divides p \lor n \ndivides p) +[elim Hcut + [left.assumption + |right. + cut (\exists a,b. a*n - b*p = (S O) \lor b*p - a*n = (S O)) + [elim Hcut1.elim H3.elim H4 + [(* first case *) + rewrite > (times_n_SO q).rewrite < H5. + rewrite > distr_times_minus. + rewrite > (sym_times q (a1*p)). + rewrite > (assoc_times a1). + elim H1. + (* + rewrite > H6. + applyS (witness n (n*(q*a-a1*n2)) (q*a-a1*n2)) + reflexivity. *) + applyS (witness n ? ? (refl_eq ? ?)) (* timeout=50 *) + (* + rewrite < (sym_times n).rewrite < assoc_times. + rewrite > (sym_times q).rewrite > assoc_times. + rewrite < (assoc_times a1).rewrite < (sym_times n). + rewrite > (assoc_times n). + rewrite < distr_times_minus. + apply (witness ? ? (q*a-a1*n2)).reflexivity + *) + |(* second case *) + rewrite > (times_n_SO q).rewrite < H5. + rewrite > distr_times_minus. + rewrite > (sym_times q (a1*p)). + rewrite > (assoc_times a1). + elim H1. + autobatch + (*rewrite > H6. + rewrite < sym_times.rewrite > assoc_times. + rewrite < (assoc_times q). + rewrite < (sym_times n). + rewrite < distr_times_minus. + apply (witness ? ? (n2*a1-q*a)). + reflexivity*) + ](* end second case *) + | rewrite < (prime_to_gcd_SO n p);autobatch + (* [ apply eq_minus_gcd + | assumption + | assumption + ]*) + ] + ] + | apply (decidable_divides n p). + apply (trans_lt ? (S O)) + [ autobatch + (*unfold lt. + apply le_n*) + | unfold prime in H. + elim H. + assumption + ] + ] +qed. + +theorem eq_gcd_times_SO: \forall m,n,p:nat. O < n \to O < p \to +gcd m n = (S O) \to gcd m p = (S O) \to gcd m (n*p) = (S O). +intros. +apply antisymmetric_le +[ apply not_lt_to_le. + unfold Not.intro. + cut (divides (smallest_factor (gcd m (n*p))) n \lor + divides (smallest_factor (gcd m (n*p))) p) + [ elim Hcut + [ apply (not_le_Sn_n (S O)). + change with ((S O) < (S O)). + rewrite < H2 in \vdash (? ? %). + apply (lt_to_le_to_lt ? (smallest_factor (gcd m (n*p)))) + [ autobatch + (*apply lt_SO_smallest_factor. + assumption*) + | apply divides_to_le; + [ autobatch | + apply divides_d_gcd + [ assumption + | apply (transitive_divides ? (gcd m (n*p))) + [ autobatch. + | autobatch. + ] + ] + ] + (*[ rewrite > H2. + unfold lt. + apply le_n + | apply divides_d_gcd + [ assumption + | apply (transitive_divides ? (gcd m (n*p))) + [ apply divides_smallest_factor_n. + apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ] + | apply divides_gcd_n + ] + ] + ]*) + ] + | apply (not_le_Sn_n (S O)). + change with ((S O) < (S O)). + rewrite < H3 in \vdash (? ? %). + apply (lt_to_le_to_lt ? (smallest_factor (gcd m (n*p)))) + [ apply lt_SO_smallest_factor. + assumption + | apply divides_to_le; + [ autobatch | + apply divides_d_gcd + [ assumption + | apply (transitive_divides ? (gcd m (n*p))) + [ autobatch. + | autobatch. + ] + ] + ] + (*[ rewrite > H3. + unfold lt. + apply le_n + | apply divides_d_gcd + [ assumption + | apply (transitive_divides ? (gcd m (n*p))) + [ apply divides_smallest_factor_n. + apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ] + | apply divides_gcd_n + ] + ] + ]*) + ] + ] + | apply divides_times_to_divides; + [ autobatch | + apply (transitive_divides ? (gcd m (n*p))) + [ autobatch. + | autobatch. + ] + ] + ] + (*[ apply prime_smallest_factor_n. + assumption + | autobatch.apply (transitive_divides ? (gcd m (n*p))) + [ apply divides_smallest_factor_n. + apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ] + | apply divides_gcd_m + ] + ]*) +| autobatch + (*change with (O < gcd m (n*p)). + apply lt_O_gcd. + rewrite > (times_n_O O). + apply lt_times;assumption.*) +] +qed. + +theorem gcd_SO_to_divides_times_to_divides: \forall m,n,p:nat. O < n \to +gcd n m = (S O) \to n \divides (m*p) \to n \divides p. +intros. +cut (n \divides p \lor n \ndivides p) +[ elim Hcut + [ assumption + | cut (\exists a,b. a*n - b*m = (S O) \lor b*m - a*n = (S O)) + [ elim Hcut1.elim H4.elim H5 + [(* first case *) + rewrite > (times_n_SO p).rewrite < H6. + rewrite > distr_times_minus. + rewrite > (sym_times p (a1*m)). + rewrite > (assoc_times a1). + elim H2. + applyS (witness n ? ? (refl_eq ? ?)) (* timeout=50 *). + |(* second case *) + rewrite > (times_n_SO p).rewrite < H6. + rewrite > distr_times_minus. + rewrite > (sym_times p (a1*m)). + rewrite > (assoc_times a1). + elim H2. + applyS (witness n ? ? (refl_eq ? ?)). + ](* end second case *) + | rewrite < H1. + apply eq_minus_gcd + ] + ] +| autobatch + (*apply (decidable_divides n p). + assumption.*) +] +qed. \ No newline at end of file diff --git a/matita/library_auto/auto/nat/le_arith.ma b/matita/library_auto/auto/nat/le_arith.ma new file mode 100644 index 000000000..13b4f3ac4 --- /dev/null +++ b/matita/library_auto/auto/nat/le_arith.ma @@ -0,0 +1,135 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/le_arith". + +include "auto/nat/times.ma". +include "auto/nat/orders.ma". + +(* plus *) +theorem monotonic_le_plus_r: +\forall n:nat.monotonic nat le (\lambda m.n + m). +simplify.intros. +elim n;simplify +[ assumption +| autobatch + (*apply le_S_S.assumption*) +] +qed. + +theorem le_plus_r: \forall p,n,m:nat. n \le m \to p + n \le p + m +\def monotonic_le_plus_r. + +theorem monotonic_le_plus_l: +\forall m:nat.monotonic nat le (\lambda n.n + m). +simplify.intros. + (*rewrite < sym_plus. + rewrite < (sym_plus m).*) + applyS le_plus_r. + assumption. +qed. + +(* IN ALTERNATIVA: + +theorem monotonic_le_plus_l: +\forall m:nat.monotonic nat le (\lambda n.n + m). +simplify.intros. + rewrite < sym_plus. + rewrite < (sym_plus m). + autobatch. +qed. +*) +theorem le_plus_l: \forall p,n,m:nat. n \le m \to n + p \le m + p +\def monotonic_le_plus_l. + +theorem le_plus: \forall n1,n2,m1,m2:nat. n1 \le n2 \to m1 \le m2 +\to n1 + m1 \le n2 + m2. +intros. +autobatch. +(*apply (trans_le ? (n2 + m1)). +apply le_plus_l.assumption. +apply le_plus_r.assumption.*) +qed. + +theorem le_plus_n :\forall n,m:nat. m \le n + m. +intros. +change with (O+m \le n+m). +autobatch. +(*apply le_plus_l. + apply le_O_n.*) +qed. + +theorem eq_plus_to_le: \forall n,m,p:nat.n=m+p \to m \le n. +intros. +rewrite > H. +rewrite < sym_plus. +apply le_plus_n. (* a questo punto funziona anche: autobatch.*) +qed. + +(* times *) +theorem monotonic_le_times_r: +\forall n:nat.monotonic nat le (\lambda m. n * m). +simplify.intros.elim n;simplify +[ apply le_O_n. +| autobatch. +(*apply le_plus; + assumption. *) (* chiudo entrambi i goal attivi in questo modo*) +] +qed. + +theorem le_times_r: \forall p,n,m:nat. n \le m \to p*n \le p*m +\def monotonic_le_times_r. + +theorem monotonic_le_times_l: +\forall m:nat.monotonic nat le (\lambda n.n*m). +simplify.intros. +(*rewrite < sym_times. + rewrite < (sym_times m). +*) +applyS le_times_r. +assumption. +qed. + +(* IN ALTERNATIVA: +theorem monotonic_le_times_l: +\forall m:nat.monotonic nat le (\lambda n.n*m). +simplify.intros. +rewrite < sym_times. +rewrite < (sym_times m). +autobatch. +qed. +*) + +theorem le_times_l: \forall p,n,m:nat. n \le m \to n*p \le m*p +\def monotonic_le_times_l. + +theorem le_times: \forall n1,n2,m1,m2:nat. n1 \le n2 \to m1 \le m2 +\to n1*m1 \le n2*m2. +intros. +autobatch. +(*apply (trans_le ? (n2*m1)). +apply le_times_l.assumption. +apply le_times_r.assumption.*) +qed. + +theorem le_times_n: \forall n,m:nat.(S O) \le n \to m \le n*m. +intros.elim H;simplify +[ autobatch + (*elim (plus_n_O ?). + apply le_n....*) +| autobatch + (*rewrite < sym_plus. + apply le_plus_n.*) +] +qed. diff --git a/matita/library_auto/auto/nat/lt_arith.ma b/matita/library_auto/auto/nat/lt_arith.ma new file mode 100644 index 000000000..4c24196ae --- /dev/null +++ b/matita/library_auto/auto/nat/lt_arith.ma @@ -0,0 +1,329 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/lt_arith". + +include "auto/nat/div_and_mod.ma". + +(* plus *) +theorem monotonic_lt_plus_r: +\forall n:nat.monotonic nat lt (\lambda m.n+m). +simplify.intros. +elim n;simplify +[ assumption +| autobatch. + (*unfold lt. + apply le_S_S. + assumption.*) +] +qed. + +variant lt_plus_r: \forall n,p,q:nat. p < q \to n + p < n + q \def +monotonic_lt_plus_r. + +theorem monotonic_lt_plus_l: +\forall n:nat.monotonic nat lt (\lambda m.m+n). +simplify. +intros. +(*rewrite < sym_plus. + rewrite < (sym_plus n).*) +applyS lt_plus_r.assumption. +qed. +(* IN ALTERNATIVA: mantengo le 2 rewrite, e concludo con autobatch. *) + +variant lt_plus_l: \forall n,p,q:nat. p < q \to p + n < q + n \def +monotonic_lt_plus_l. + +theorem lt_plus: \forall n,m,p,q:nat. n < m \to p < q \to n + p < m + q. +intros. +autobatch. +(*apply (trans_lt ? (n + q)). +apply lt_plus_r.assumption. +apply lt_plus_l.assumption.*) +qed. + +theorem lt_plus_to_lt_l :\forall n,p,q:nat. p+n < q+n \to p plus_n_O. + rewrite > (plus_n_O q). + assumption. +| apply H. + unfold lt. + apply le_S_S_to_le. + rewrite > plus_n_Sm. + rewrite > (plus_n_Sm q). + exact H1. +] +qed. + +theorem lt_plus_to_lt_r :\forall n,p,q:nat. n+p < n+q \to p sym_plus. +rewrite > (sym_plus q). +assumption. +qed. + +(* times and zero *) +theorem lt_O_times_S_S: \forall n,m:nat.O < (S n)*(S m). +intros. +autobatch. +(*simplify. +unfold lt. +apply le_S_S. +apply le_O_n.*) +qed. + +(* times *) +theorem monotonic_lt_times_r: +\forall n:nat.monotonic nat lt (\lambda m.(S n)*m). +simplify. +intros.elim n +[ autobatch + (*simplify. + rewrite < plus_n_O. + rewrite < plus_n_O. + assumption.*) +| apply lt_plus;assumption (* chiudo con assumption entrambi i sottogoal attivi*) +] +qed. + +theorem lt_times_r: \forall n,p,q:nat. p < q \to (S n) * p < (S n) * q +\def monotonic_lt_times_r. + +theorem monotonic_lt_times_l: +\forall m:nat.monotonic nat lt (\lambda n.n * (S m)). +simplify. +intros. +(*rewrite < sym_times. + rewrite < (sym_times (S m)).*) +applyS lt_times_r.assumption. +qed. + +(* IN ALTERNATIVA: mantengo le 2 rewrite, e concludo con autobatch. *) + + +variant lt_times_l: \forall n,p,q:nat. p nat_compare_n_n. + reflexivity*) +| intro. + apply nat_compare_elim + [ intro. + absurd (p (plus_n_O ((S m1)*(n / (S m1)))). +rewrite < H2. +rewrite < sym_times. +rewrite < div_mod +[ rewrite > H2. + assumption. +| autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n.*) +] +qed. + +theorem lt_div_n_m_n: \forall n,m:nat. (S O) < m \to O < n \to n / m \lt n. +intros. +apply (nat_case1 (n / m)) +[ intro. + assumption +| intros. + rewrite < H2. + rewrite > (div_mod n m) in \vdash (? ? %) + [ apply (lt_to_le_to_lt ? ((n / m)*m)) + [ apply (lt_to_le_to_lt ? ((n / m)*(S (S O)))) + [ rewrite < sym_times. + rewrite > H2. + simplify. + unfold lt. + autobatch. + (*rewrite < plus_n_O. + rewrite < plus_n_Sm. + apply le_S_S. + apply le_S_S. + apply le_plus_n*) + | autobatch + (*apply le_times_r. + assumption*) + ] + | autobatch + (*rewrite < sym_plus. + apply le_plus_n*) + ] + | autobatch + (*apply (trans_lt ? (S O)). + unfold lt. + apply le_n. + assumption*) + ] +] +qed. + +(* general properties of functions *) +theorem monotonic_to_injective: \forall f:nat\to nat. +monotonic nat lt f \to injective nat nat f. +unfold injective.intros. +apply (nat_compare_elim x y) +[ intro. + apply False_ind. + apply (not_le_Sn_n (f x)). + rewrite > H1 in \vdash (? ? %). + change with (f x < f y). + autobatch + (*apply H. + apply H2*) +| intros. + assumption +| intro. + apply False_ind. + apply (not_le_Sn_n (f y)). + rewrite < H1 in \vdash (? ? %). + change with (f y < f x). + autobatch + (*apply H. + apply H2*) +] +qed. + +theorem increasing_to_injective: \forall f:nat\to nat. +increasing f \to injective nat nat f. +intros. +autobatch. +(*apply monotonic_to_injective. +apply increasing_to_monotonic. +assumption.*) +qed. diff --git a/matita/library_auto/auto/nat/map_iter_p.ma b/matita/library_auto/auto/nat/map_iter_p.ma new file mode 100644 index 000000000..d5ab380d1 --- /dev/null +++ b/matita/library_auto/auto/nat/map_iter_p.ma @@ -0,0 +1,1279 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/map_iter_p.ma". + +include "auto/nat/permutation.ma". +include "auto/nat/count.ma". + +let rec map_iter_p n p (g:nat \to nat) (a:nat) f \def + match n with + [ O \Rightarrow a + | (S k) \Rightarrow + match p (S k) with + [true \Rightarrow f (g (S k)) (map_iter_p k p g a f) + |false \Rightarrow map_iter_p k p g a f] + ]. + +theorem eq_map_iter_p: \forall g1,g2:nat \to nat. +\forall p:nat \to bool. +\forall f:nat \to nat \to nat. \forall a,n:nat. +(\forall m:nat. m \le n \to g1 m = g2 m) \to +map_iter_p n p g1 a f = map_iter_p n p g2 a f. +intros 6. +elim n +[ autobatch + (*simplify. + reflexivity*) +| simplify. + elim (p (S n1)) + [ simplify. + apply eq_f2 + [ autobatch + (*apply H1. + apply le_n*) + | simplify. + apply H. + intros. + autobatch + (*apply H1. + apply le_S. + assumption*) + ] + | simplify. + apply H. + intros. + autobatch + (*apply H1. + apply le_S. + assumption*) + ] +] +qed. + +(* useful since simplify simpifies too much *) + +theorem map_iter_p_O: \forall p.\forall g.\forall f. \forall a:nat. +map_iter_p O p g a f = a. +intros. +autobatch. +(*simplify.reflexivity.*) +qed. + +theorem map_iter_p_S_true: \forall p.\forall g.\forall f. \forall a,n:nat. +p (S n) = true \to +map_iter_p (S n) p g a f = f (g (S n)) (map_iter_p n p g a f). +intros.simplify.rewrite > H.reflexivity. +qed. + +theorem map_iter_p_S_false: \forall p.\forall g.\forall f. \forall a,n:nat. +p (S n) = false \to +map_iter_p (S n) p g a f = map_iter_p n p g a f. +intros.simplify.rewrite > H.reflexivity. +qed. + +(* map_iter examples *) +definition pi_p \def \lambda p. \lambda n. +map_iter_p n p (\lambda n.n) (S O) times. + +lemma pi_p_S: \forall n.\forall p. +pi_p p (S n) = + match p (S n) with + [true \Rightarrow (S n)*(pi_p p n) + |false \Rightarrow (pi_p p n) + ]. +intros.reflexivity. +qed. + +lemma lt_O_pi_p: \forall n.\forall p. +O < pi_p p n. +intros. +elim n +[ autobatch + (*simplify. + apply le_n*) +| rewrite > pi_p_S. + elim p (S n1) + [ change with (O < (S n1)*(pi_p p n1)). + autobatch + (*rewrite >(times_n_O n1). + apply lt_times + [ apply le_n + | assumption + ]*) + | assumption + ] +] +qed. + +let rec card n p \def + match n with + [O \Rightarrow O + |(S m) \Rightarrow + (bool_to_nat (p (S m))) + (card m p)]. + +lemma count_card: \forall p.\forall n. +p O = false \to count (S n) p = card n p. +intros. +elim n +[ simplify. + autobatch + (*rewrite > H. + reflexivity*) +| simplify. + rewrite < plus_n_O. + apply eq_f. + (*qui autobatch non chiude un goal chiuso invece dal solo assumption*) + assumption +] +qed. + +lemma count_card1: \forall p.\forall n. +p O = false \to p n = false \to count n p = card n p. +intros 3. +apply (nat_case n) +[ intro. + simplify. + autobatch + (*rewrite > H. + reflexivity*) +| intros.rewrite > (count_card ? ? H). + simplify. + autobatch + (*rewrite > H1. + reflexivity*) +] +qed. + +lemma a_times_pi_p: \forall p. \forall a,n. +exp a (card n p) * pi_p p n = map_iter_p n p (\lambda n.a*n) (S O) times. +intros. +elim n +[ autobatch + (*simplify. + reflexivity*) +| simplify. + apply (bool_elim ? (p (S n1))) + [ intro. + change with + (a*exp a (card n1 p) * ((S n1) * (pi_p p n1)) = + a*(S n1)*map_iter_p n1 p (\lambda n.a*n) (S O) times). + rewrite < H. + autobatch + | intro. + (*la chiamata di autobatch in questo punto dopo circa 8 minuti non aveva + * ancora generato un risultato + *) + assumption + ] +] +qed. + +definition permut_p \def \lambda f. \lambda p:nat\to bool. \lambda n. +\forall i. i \le n \to p i = true \to ((f i \le n \land p (f i) = true) +\land (\forall j. p j = true \to j \le n \to i \neq j \to (f i \neq f j))). + +definition extentional_eq_n \def \lambda f,g:nat \to nat.\lambda n. +\forall x. x \le n \to f x = g x. + +lemma extentional_eq_n_to_permut_p: \forall f,g. \forall p. \forall n. +extentional_eq_n f g n\to permut_p f p n \to permut_p g p n. +intros. +unfold permut_p. +intros. +elim (H1 i H2 H3). +split +[ elim H4. + split + [ rewrite < (H i H2). + assumption + | rewrite < (H i H2). + assumption + ] +| intros. + unfold. + intro. + apply (H5 j H6 H7 H8). + rewrite > (H i H2). + rewrite > (H j H7). + assumption +] +qed. + +theorem permut_p_compose: \forall f,g.\forall p.\forall n. +permut_p f p n \to permut_p g p n \to permut_p (compose ? ? ? g f) p n. +intros. +unfold permut_p. +intros. +elim (H i H2 H3). +elim H4. +elim (H1 (f i) H6 H7). +elim H8. +split +[ split + [ unfold compose. + assumption + | unfold compose. + autobatch + (*rewrite < H11. + reflexivity*) + ] +| intros. + unfold compose. + apply (H9 (f j)) + [ elim (H j H13 H12). + autobatch + (*elim H15. + rewrite < H18. + reflexivity*) + | elim (H j H13 H12). + elim H15. + assumption. + | apply (H5 j H12 H13 H14) + ] +] +qed. + + +theorem permut_p_S_to_permut_p: \forall f.\forall p.\forall n. +permut_p f p (S n) \to (f (S n)) = (S n) \to permut_p f p n. +intros. +unfold permut_p. +intros. +split +[ elim (H i (le_S i n H2) H3). + split + [ elim H4. + elim (le_to_or_lt_eq (f i) (S n)) + [ autobatch + (*apply le_S_S_to_le. + assumption*) + | absurd (f i = (S n)) + [ assumption + | rewrite < H1. + apply H5 + [ autobatch + (*rewrite < H8. + assumption*) + | apply le_n + | unfold.intro.rewrite > H8 in H2. + apply (not_le_Sn_n n).rewrite < H9. + assumption + ] + ] + | assumption + ] + | autobatch + (*elim H4. + assumption*) + ] +| intros. + elim (H i (le_S i n H2) H3). + autobatch + (*apply H8 + [ assumption + | apply le_S. + assumption + | assumption + ]*) +] +qed. + +lemma permut_p_transpose: \forall p.\forall i,j,n. +i \le n \to j \le n \to p i = p j \to +permut_p (transpose i j) p n. +unfold permut_p. +intros. +split +[ split + [ unfold transpose. + apply (eqb_elim i1 i) + [ intro. + apply (eqb_elim i1 j) + [ simplify.intro.assumption + | simplify.intro.assumption + ] + | intro. + apply (eqb_elim i1 j) + [ simplify.intro.assumption + | simplify.intro.assumption + ] + ] + | unfold transpose. + apply (eqb_elim i1 i) + [ intro. + apply (eqb_elim i1 j) + [ simplify.intro. + autobatch + (*rewrite < H6. + assumption*) + | simplify.intro. + autobatch + (*rewrite < H2. + rewrite < H5. + assumption*) + ] + | intro. + apply (eqb_elim i1 j) + [ simplify.intro. + autobatch + (*rewrite > H2. + rewrite < H6. + assumption*) + | simplify.intro. + assumption + ] + ] + ] +| intros. + unfold Not. + intro. + autobatch + (*apply H7. + apply (injective_transpose ? ? ? ? H8)*) +] +qed. + + +theorem eq_map_iter_p_k: \forall f,g.\forall p.\forall a,k,n:nat. +p (S n-k) = true \to (\forall i. (S n)-k < i \to i \le (S n) \to (p i) = false) \to +map_iter_p (S n) p g a f = map_iter_p (S n-k) p g a f. +intros 5. +elim k 3 +[ autobatch + (*rewrite < minus_n_O. + reflexivity*) +| apply (nat_case n1) + [ intros. + rewrite > map_iter_p_S_false + [ reflexivity + | autobatch + (*apply H2 + [ simplify. + apply lt_O_S. + | apply le_n + ]*) + ] + | intros. + rewrite > map_iter_p_S_false + [ rewrite > (H m H1) + [ reflexivity + | intros. + apply (H2 i H3). + autobatch + (*apply le_S. + assumption*) + ] + | autobatch + (*apply H2 + [ autobatch + | apply le_n + ]*) + ] + ] +] +qed. + + + +theorem eq_map_iter_p_a: \forall p.\forall f.\forall g. \forall a,n:nat. +(\forall i.i \le n \to p i = false) \to map_iter_p n p g a f = a. +intros 5. +elim n +[ autobatch + (*simplify. + reflexivity*) +| rewrite > map_iter_p_S_false + [ apply H. + intros. + autobatch + (*apply H1. + apply le_S. + assumption*) + | autobatch + (*apply H1. + apply le_n*) + ] +] +qed. + +theorem eq_map_iter_p_transpose: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall g. \forall a,k,n:nat. k < n \to +(p (S n) = true) \to (p (n-k)) = true \to (\forall i. n-k < i \to i \le n \to (p i) = false) +\to map_iter_p (S n) p g a f = map_iter_p (S n) p (\lambda m. g (transpose (n-k) (S n) m)) a f. +intros 8. +apply (nat_case n) +[ intro. + absurd (k < O) + [ assumption + | autobatch + (*apply le_to_not_lt. + apply le_O_n*) + ] +| intros. + rewrite > (map_iter_p_S_true ? ? ? ? ? H3). + rewrite > (map_iter_p_S_true ? ? ? ? ? H3). + rewrite > (eq_map_iter_p_k ? ? ? ? ? ? H4 H5). + rewrite > (eq_map_iter_p_k ? ? ? ? ? ? H4 H5). + generalize in match H4. + rewrite > minus_Sn_m + [ intro. + rewrite > (map_iter_p_S_true ? ? ? ? ? H6). + rewrite > (map_iter_p_S_true ? ? ? ? ? H6). + rewrite > transpose_i_j_j. + rewrite > transpose_i_j_i. + cut (map_iter_p (m-k) p g a f = + map_iter_p (m-k) p (\lambda x.g (transpose (S(m-k)) (S(S m)) x)) a f) + [ rewrite < Hcut. + rewrite < H. + rewrite < H1 in \vdash (? ? (? % ?) ?). + autobatch + (*rewrite > H. + reflexivity*) + | apply eq_map_iter_p. + intros. + unfold transpose. + cut (eqb m1 (S (m-k)) =false) + [ cut (eqb m1 (S (S m)) =false) + [ rewrite > Hcut. + rewrite > Hcut1. + reflexivity + | apply not_eq_to_eqb_false. + apply lt_to_not_eq. + apply (le_to_lt_to_lt ? m) + [ autobatch + (*apply (trans_le ? (m-k)) + [ assumption + | autobatch + ]*) + | autobatch + (*apply le_S. + apply le_n*) + ] + ] + | apply not_eq_to_eqb_false. + apply lt_to_not_eq. + autobatch + (*unfold. + autobatch*) + ] + ] + | autobatch + (*apply le_S_S_to_le. + assumption*) + ] +] +qed. + +theorem eq_map_iter_p_transpose1: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall g. \forall a,k1,k2,n:nat. O < k1 \to k1 < k2 \to k2 \le n \to +(p k1) = true \to (p k2) = true \to (\forall i. k1 < i \to i < k2 \to (p i) = false) +\to map_iter_p n p g a f = map_iter_p n p (\lambda m. g (transpose k1 k2 m)) a f. +intros 10. +elim n 2 +[ absurd (k2 \le O) + [ assumption + | autobatch + (*apply lt_to_not_le. + apply (trans_lt ? k1 ? H2 H3)*) + ] +| apply (eqb_elim (S n1) k2) + [ intro. + rewrite < H4. + intros. + cut (k1 = n1 - (n1 -k1)) + [ rewrite > Hcut. + apply (eq_map_iter_p_transpose p f H H1 g a (n1-k1)) + [ cut (k1 \le n1);autobatch + | assumption + | autobatch + (*rewrite < Hcut. + assumption*) + | rewrite < Hcut. + intros. + apply (H9 i H10). + autobatch + (*unfold. + autobatch*) + ] + | apply sym_eq. + autobatch + (*apply plus_to_minus. + autobatch*) + ] + | intros. + cut ((S n1) \neq k1) + [ apply (bool_elim ? (p (S n1))) + [ intro. + rewrite > map_iter_p_S_true + [ rewrite > map_iter_p_S_true + [ cut ((transpose k1 k2 (S n1)) = (S n1)) + [ rewrite > Hcut1. + apply eq_f. + apply (H3 H5) + [ elim (le_to_or_lt_eq ? ? H6) + [ autobatch + | absurd (S n1=k2) + [ autobatch + (*apply sym_eq. + assumption*) + | assumption + ] + ] + | assumption + | assumption + | assumption + ] + | unfold transpose. + rewrite > (not_eq_to_eqb_false ? ? Hcut). + rewrite > (not_eq_to_eqb_false ? ? H4). + reflexivity + ] + | assumption + ] + | assumption + ] + | intro. + rewrite > map_iter_p_S_false + [ rewrite > map_iter_p_S_false + [ apply (H3 H5) + [ elim (le_to_or_lt_eq ? ? H6) + [ autobatch + | (*l'invocazione di autobatch qui genera segmentation fault*) + absurd (S n1=k2) + [ autobatch + (*apply sym_eq. + assumption*) + | assumption + ] + ] + | assumption + | assumption + | assumption + ] + | assumption + ] + | assumption + ] + ] + | unfold. + intro. + absurd (k1 < k2) + [ assumption + | apply le_to_not_lt. + rewrite < H10. + assumption + ] + ] + ] +] +qed. + +lemma decidable_n:\forall p.\forall n. +(\forall m. m \le n \to (p m) = false) \lor +(\exists m. m \le n \land (p m) = true \land +\forall i. m < i \to i \le n \to (p i) = false). +intros. +elim n +[ apply (bool_elim ? (p O)) + [ intro. + right. + apply (ex_intro ? ? O). + split + [ autobatch + (*split + [ apply le_n + | assumption + ]*) + | intros. + absurd (O H4. + assumption*) + ] + | right. + elim H1. + elim H3. + elim H4. + apply (ex_intro ? ? a). + split + [ autobatch + (*split + [ apply le_S. + assumption + | assumption + ]*) + | intros. + elim (le_to_or_lt_eq i (S n1) H9) + [ autobatch + (*apply H5 + [ assumption + | apply le_S_S_to_le. + assumption + ]*) + | autobatch + (*rewrite > H10. + assumption*) + ] + ] + ] + ] +] +qed. + +lemma decidable_n1:\forall p.\forall n,j. j \le n \to (p j)=true \to +(\forall m. j < m \to m \le n \to (p m) = false) \lor +(\exists m. j < m \land m \le n \land (p m) = true \land +\forall i. m < i \to i \le n \to (p i) = false). +intros. +elim (decidable_n p n) +[ absurd ((p j)=true) + [ assumption + | unfold. + intro. + apply not_eq_true_false. + autobatch + (*rewrite < H3. + apply H2. + assumption*) + ] +| elim H2. + clear H2. + apply (nat_compare_elim j a) + [ intro. + right. + apply (ex_intro ? ? a). + elim H3.clear H3. + elim H4.clear H4. + split + [ autobatch + (*split + [ split + [ assumption + | assumption + ] + | assumption + ]*) + | assumption + ] + | intro. + rewrite > H2. + left. + elim H3 2. + (*qui la tattica autobatch non conclude il goal, concluso invece con l'invocazione + *della sola tattica assumption + *) + assumption + | intro. + absurd (p j = true) + [ assumption + | unfold. + intro. + apply not_eq_true_false. + rewrite < H4. + elim H3. + autobatch + (*clear H3. + apply (H6 j H2).assumption*) + ] + ] +] +qed. + +lemma decidable_n2:\forall p.\forall n,j. j \le n \to (p j)=true \to +(\forall m. j < m \to m \le n \to (p m) = false) \lor +(\exists m. j < m \land m \le n \land (p m) = true \land +\forall i. j < i \to i < m \to (p i) = false). +intros 3. +elim n +[ left. + apply (le_n_O_elim j H). + intros. + absurd (m \le O) + [ assumption + | autobatch + (*apply lt_to_not_le. + assumption*) + ] +| elim (le_to_or_lt_eq ? ? H1) + [ cut (j \le n1) + [ elim (H Hcut H2) + [ apply (bool_elim ? (p (S n1))) + [ intro. + right. + apply (ex_intro ? ? (S n1)). + split + [ autobatch + (*split + [ split + [ assumption + | apply le_n + ] + | assumption + ]*) + | intros. + autobatch + (*apply (H4 i H6). + apply le_S_S_to_le. + assumption*) + ] + | intro. + left. + intros. + elim (le_to_or_lt_eq ? ? H7) + [ autobatch + (*apply H4 + [ assumption + | apply le_S_S_to_le. + assumption + ]*) + | autobatch + (*rewrite > H8. + assumption*) + ] + ] + | right. + elim H4.clear H4. + elim H5.clear H5. + elim H4.clear H4. + elim H5.clear H5. + apply (ex_intro ? ? a). + split + [ split + [ autobatch + (*split + [ assumption + | apply le_S. + assumption + ]*) + | assumption + ] + | (*qui autobatch non chiude il goal, chiuso invece mediante l'invocazione + *della sola tattica assumption + *) + assumption + ] + ] + | autobatch + (*apply le_S_S_to_le. + assumption*) + ] + | left. + intros. + absurd (j < m) + [ assumption + | apply le_to_not_lt. + rewrite > H3. + assumption + ] + ] +] +qed. + +(* tutti d spostare *) +theorem lt_minus_to_lt_plus: +\forall n,m,p. n - m < p \to n < m + p. +intros 2. +apply (nat_elim2 ? ? ? ? n m) +[ simplify. + intros. + autobatch +| intros 2. + autobatch + (*rewrite < minus_n_O. + intro. + assumption*) +| intros. + simplify. + cut (n1 < m1+p) + [ autobatch + | apply H. + apply H1 + ] +] +qed. + +theorem lt_plus_to_lt_minus: +\forall n,m,p. m \le n \to n < m + p \to n - m < p. +intros 2. +apply (nat_elim2 ? ? ? ? n m) +[ simplify. + intros 3. + apply (le_n_O_elim ? H). + autobatch + (*simplify. + intros. + assumption*) +| simplify. + intros. + assumption +| intros. + simplify. + apply H + [ autobatch + (*apply le_S_S_to_le. + assumption*) + | apply le_S_S_to_le. + apply H2 + ] +] +qed. + +theorem minus_m_minus_mn: \forall n,m. n\le m \to n=m-(m-n). +intros. +apply sym_eq. +autobatch. +(*apply plus_to_minus. +autobatch.*) +qed. + +theorem eq_map_iter_p_transpose2: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall g. \forall a,k,n:nat. O < k \to k \le n \to +(p (S n) = true) \to (p k) = true +\to map_iter_p (S n) p g a f = map_iter_p (S n) p (\lambda m. g (transpose k (S n) m)) a f. +intros 10. +cut (k = (S n)-(S n -k)) +[ generalize in match H3. + clear H3. + generalize in match g. + generalize in match H2. + clear H2. + rewrite > Hcut. + (*generalize in match Hcut.clear Hcut.*) + (* generalize in match H3.clear H3.*) + (* something wrong here + rewrite > Hcut in \vdash (?\rarr ?\rarr %). *) + apply (nat_elim1 (S n - k)). + intros. + elim (decidable_n2 p n (S n -m) H4 H6) + [ apply (eq_map_iter_p_transpose1 p f H H1 f1 a) + [ assumption + | autobatch + (*unfold. + autobatch*) + | apply le_n + | assumption + | assumption + | intros. + autobatch + (*apply H7 + [ assumption + | apply le_S_S_to_le. + assumption + ]*) + ] + | elim H7. + clear H7. + elim H8.clear H8. + elim H7.clear H7. + elim H8.clear H8. + apply (trans_eq ? ? + (map_iter_p (S n) p (\lambda i.f1 (transpose a1 (S n) (transpose (S n -m) a1 i))) a f)) + [ apply (trans_eq ? ? + (map_iter_p (S n) p (\lambda i.f1 (transpose a1 (S n) i)) a f)) + [ cut (a1 = (S n -(S n -a1))) + [ rewrite > Hcut1. + apply H2 + [ apply lt_plus_to_lt_minus + [ autobatch + (*apply le_S. + assumption*) + | rewrite < sym_plus. + autobatch + (*apply lt_minus_to_lt_plus. + assumption*) + ] + | rewrite < Hcut1. + autobatch + (*apply (trans_lt ? (S n -m)); + assumption*) + | rewrite < Hcut1. + assumption + | assumption + | autobatch + (*rewrite < Hcut1. + assumption*) + ] + | autobatch + (*apply minus_m_minus_mn. + apply le_S. + assumption*) + ] + | apply (eq_map_iter_p_transpose1 p f H H1) + [ assumption + | assumption + | autobatch + (*apply le_S. + assumption*) + | assumption + | assumption + | (*qui autobatch non chiude il goal, chiuso dall'invocazione della singola + * tattica assumption + *) + assumption + ] + ] + | apply (trans_eq ? ? + (map_iter_p (S n) p (\lambda i.f1 (transpose a1 (S n) (transpose (S n -m) a1 (transpose (S n -(S n -a1)) (S n) i)))) a f)) + [ cut (a1 = (S n) -(S n -a1)) + [ apply H2 + [ apply lt_plus_to_lt_minus + [ autobatch + (*apply le_S. + assumption*) + | rewrite < sym_plus. + autobatch + (*apply lt_minus_to_lt_plus. + assumption*) + ] + | rewrite < Hcut1. + autobatch + (*apply (trans_lt ? (S n -m)) + [ assumption + | assumption + ]*) + | rewrite < Hcut1. + assumption + | assumption + | autobatch + (*rewrite < Hcut1. + assumption*) + ] + | autobatch + (*apply minus_m_minus_mn. + apply le_S. + assumption*) + ] + | apply eq_map_iter_p. + cut (a1 = (S n) -(S n -a1)) + [ intros. + apply eq_f. + rewrite < Hcut1. + rewrite < transpose_i_j_j_i. + rewrite > (transpose_i_j_j_i (S n -m)). + rewrite > (transpose_i_j_j_i a1 (S n)). + rewrite > (transpose_i_j_j_i (S n -m)). + apply sym_eq. + apply eq_transpose + [ unfold. + intro. + apply (not_le_Sn_n n). + rewrite < H12. + assumption + | unfold. + intro. + apply (not_le_Sn_n n). + rewrite > H12. + assumption + | unfold. + intro. + apply (not_le_Sn_n a1). + rewrite < H12 in \vdash (? (? %) ?). + assumption + ] + | autobatch + (*apply minus_m_minus_mn. + apply le_S. + assumption*) + ] + ] + ] + ] +| autobatch + (*apply minus_m_minus_mn. + apply le_S. + assumption*) +] +qed. + +theorem eq_map_iter_p_transpose3: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall g. \forall a,k,n:nat. O < k \to k \le (S n) \to +(p (S n) = true) \to (p k) = true +\to map_iter_p (S n) p g a f = map_iter_p (S n) p (\lambda m. g (transpose k (S n) m)) a f. +intros. +elim (le_to_or_lt_eq ? ? H3) +[ apply (eq_map_iter_p_transpose2 p f H H1 g a k n H2);autobatch + (*[ apply le_S_S_to_le. + assumption + | assumption + | assumption + ]*) +| rewrite > H6. + apply eq_map_iter_p. + intros. + autobatch + (*apply eq_f. + apply sym_eq. + apply transpose_i_i.*) +] +qed. + +lemma permut_p_O: \forall p.\forall h.\forall n. +permut_p h p n \to p O = false \to \forall m. (S m) \le n \to p (S m) = true \to O < h(S m). +intros. +unfold permut_p in H. +apply not_le_to_lt.unfold. +intro. +elim (H (S m) H2 H3). +elim H5. +absurd (p (h (S m)) = true) +[ assumption +| apply (le_n_O_elim ? H4). + unfold. + intro. + (*l'invocazione di autobatch in questo punto genera segmentation fault*) + apply not_eq_true_false. + (*l'invocazione di autobatch in questo punto genera segmentation fault*) + rewrite < H9. + (*l'invocazione di autobatch in questo punto genera segmentation fault*) + rewrite < H1. + (*l'invocazione di autobatch in questo punto genera segmentation fault*) + reflexivity +] +qed. + +theorem eq_map_iter_p_permut: \forall p.\forall f.associative nat f \to +symmetric2 nat nat f \to \forall n.\forall g. \forall h.\forall a:nat. +permut_p h p n \to p O = false \to +map_iter_p n p g a f = map_iter_p n p (compose ? ? ? g h) a f . +intros 5. +elim n +[ autobatch + (*simplify. + reflexivity*) +| apply (bool_elim ? (p (S n1))) + [ intro. + apply (trans_eq ? ? (map_iter_p (S n1) p (\lambda m.g ((transpose (h (S n1)) (S n1)) m)) a f)) + [ unfold permut_p in H3. + elim (H3 (S n1) (le_n ?) H5). + elim H6. + clear H6. + apply (eq_map_iter_p_transpose3 p f H H1 g a (h(S n1)) n1) + [ apply (permut_p_O ? ? ? H3 H4);autobatch + (*[ apply le_n + | assumption + ]*) + | assumption + | assumption + | assumption + ] + | apply (trans_eq ? ? (map_iter_p (S n1) p (\lambda m. + (g(transpose (h (S n1)) (S n1) + (transpose (h (S n1)) (S n1) (h m)))) ) a f)) + [ rewrite > (map_iter_p_S_true ? ? ? ? ? H5). + rewrite > (map_iter_p_S_true ? ? ? ? ? H5). + apply eq_f2 + [ rewrite > transpose_i_j_j. + rewrite > transpose_i_j_i. + rewrite > transpose_i_j_j. + reflexivity + | apply (H2 (\lambda m.(g(transpose (h (S n1)) (S n1) m))) ?) + [ unfold. + intros. + split + [ split + [ simplify. + unfold permut_p in H3. + elim (H3 i (le_S ? ? H6) H7). + elim H8. + clear H8. + elim (le_to_or_lt_eq ? ? H10) + [ unfold transpose. + rewrite > (not_eq_to_eqb_false ? ? (lt_to_not_eq ? ? H8)). + cut (h i \neq h (S n1)) + [ rewrite > (not_eq_to_eqb_false ? ? Hcut). + simplify. + autobatch + (*apply le_S_S_to_le. + assumption*) + | apply H9 + [ apply H5 + | apply le_n + | apply lt_to_not_eq. + autobatch + (*unfold. + apply le_S_S. + assumption*) + ] + ] + | rewrite > H8. + apply (eqb_elim (S n1) (h (S n1))) + [ intro. + absurd (h i = h (S n1)) + [ autobatch + (*rewrite > H8. + assumption*) + | apply H9 + [ assumption + | apply le_n + | apply lt_to_not_eq. + autobatch + (*unfold. + apply le_S_S. + assumption*) + ] + ] + | intro. + unfold transpose. + rewrite > (not_eq_to_eqb_false ? ? H12). + rewrite > (eq_to_eqb_true ? ? (refl_eq ? (S n1))). + simplify. + elim (H3 (S n1) (le_n ? ) H5). + elim H13.clear H13. + elim (le_to_or_lt_eq ? ? H15) + [ autobatch + (*apply le_S_S_to_le. + assumption*) + | apply False_ind. + autobatch + (*apply H12. + apply sym_eq. + assumption*) + ] + ] + ] + + | simplify. + unfold permut_p in H3. + unfold transpose. + apply (eqb_elim (h i) (S n1)) + [ intro. + apply (eqb_elim (h i) (h (S n1))) + [ intro. + (*NB: qui autobatch non chiude il goal*) + simplify. + assumption + | intro. + simplify. + elim (H3 (S n1) (le_n ? ) H5). + autobatch + (*elim H10. + assumption*) + ] + | intro. + apply (eqb_elim (h i) (h (S n1))) + [ intro. + (*NB: qui autobatch non chiude il goal*) + simplify. + assumption + | intro. + simplify. + elim (H3 i (le_S ? ? H6) H7). + autobatch + (*elim H10. + assumption*) + ] + ] + ] + | simplify. + intros. + unfold Not. + intro. + unfold permut_p in H3. + elim (H3 i (le_S i ? H6) H7). + apply (H13 j H8 (le_S j ? H9) H10). + apply (injective_transpose ? ? ? ? H11) + ] + | assumption + ] + ] + | apply eq_map_iter_p. + intros. + autobatch + (*rewrite > transpose_transpose. + reflexivity*) + ] + ] + | intro. + rewrite > (map_iter_p_S_false ? ? ? ? ? H5). + rewrite > (map_iter_p_S_false ? ? ? ? ? H5). + apply H2 + [ unfold permut_p. + unfold permut_p in H3. + intros. + elim (H3 i (le_S i ? H6) H7). + elim H8. + split + [ split + [ elim (le_to_or_lt_eq ? ? H10) + [ autobatch + (*apply le_S_S_to_le.assumption*) + | absurd (p (h i) = true) + [ assumption + | rewrite > H12. + rewrite > H5. + unfold.intro. + (*l'invocazione di autobatch qui genera segmentation fault*) + apply not_eq_true_false. + (*l'invocazione di autobatch qui genera segmentation fault*) + apply sym_eq. + (*l'invocazione di autobatch qui genera segmentation fault*) + assumption + ] + ] + | assumption + ] + | intros. + apply H9;autobatch + (*[ assumption + | apply (le_S ? ? H13) + | assumption + ]*) + ] + | assumption + + ] + + ] + +] +qed. + diff --git a/matita/library_auto/auto/nat/minimization.ma b/matita/library_auto/auto/nat/minimization.ma new file mode 100644 index 000000000..61cbaf45a --- /dev/null +++ b/matita/library_auto/auto/nat/minimization.ma @@ -0,0 +1,406 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/minimization". + +include "auto/nat/minus.ma". + +let rec max i f \def + match (f i) with + [ true \Rightarrow i + | false \Rightarrow + match i with + [ O \Rightarrow O + | (S j) \Rightarrow max j f ]]. + +theorem max_O_f : \forall f: nat \to bool. max O f = O. +intro. simplify. +elim (f O); autobatch. +(*[ simplify. + reflexivity +| simplify. + reflexivity +]*) +qed. + +theorem max_S_max : \forall f: nat \to bool. \forall n:nat. +(f (S n) = true \land max (S n) f = (S n)) \lor +(f (S n) = false \land max (S n) f = max n f). +intros.simplify.elim (f (S n));autobatch. +(*[ simplify. + left. + split;reflexivity +| simplify. + right. + split;reflexivity. +]*) +qed. + +theorem le_max_n : \forall f: nat \to bool. \forall n:nat. +max n f \le n. +intros. +elim n +[ rewrite > max_O_f. + apply le_n +| simplify. + elim (f (S n1));simplify;autobatch. + (*[ simplify. + apply le_n + | simplify. + apply le_S. + assumption + ]*) +] +qed. + +theorem le_to_le_max : \forall f: nat \to bool. \forall n,m:nat. +n\le m \to max n f \le max m f. +intros. +elim H +[ apply le_n +| apply (trans_le ? (max n1 f)) + [ apply H2 + | cut ((f (S n1) = true \land max (S n1) f = (S n1)) \lor + (f (S n1) = false \land max (S n1) f = max n1 f)) + [ elim Hcut;elim H3;rewrite > H5;autobatch + (*[ elim H3. + rewrite > H5. + apply le_S. + apply le_max_n. + | elim H3. + rewrite > H5. + apply le_n. + ]*) + | apply max_S_max. + ] + ] +] +qed. + +theorem f_m_to_le_max: \forall f: nat \to bool. \forall n,m:nat. +m\le n \to f m = true \to m \le max n f. +intros 3. +elim n +[ autobatch. + (*apply (le_n_O_elim m H). + apply le_O_n.*) +| apply (le_n_Sm_elim m n1 H1);intro + [ apply (trans_le ? (max n1 f)); autobatch + (*[ apply H + [apply le_S_S_to_le. + assumption + | assumption + ] + | apply le_to_le_max. + apply le_n_Sn. + ]*) + | simplify. + rewrite < H3. + rewrite > H2. + autobatch + (*simplify. + apply le_n.*) + ] +] +qed. + + +definition max_spec \def \lambda f:nat \to bool.\lambda n: nat. +\exists i. (le i n) \land (f i = true) \to +(f n) = true \land (\forall i. i < n \to (f i = false)). + +theorem f_max_true : \forall f:nat \to bool. \forall n:nat. +(\exists i:nat. le i n \land f i = true) \to f (max n f) = true. +intros 2. +elim n +[ elim H. + elim H1. + generalize in match H3. + apply (le_n_O_elim a H2). + autobatch + (*intro. + simplify. + rewrite > H4. + simplify. + assumption.*) +| simplify. + apply (bool_ind (\lambda b:bool. + (f (S n1) = b) \to (f (match b in bool with + [ true \Rightarrow (S n1) + | false \Rightarrow (max n1 f)])) = true)) + + [ autobatch + (*simplify. + intro. + assumption.*) + | simplify. + intro. + apply H. + elim H1. + elim H3. + generalize in match H5. + apply (le_n_Sm_elim a n1 H4) + [ intros. + apply (ex_intro nat ? a). + autobatch + (*split + [ apply le_S_S_to_le. + assumption. + | assumption. + ]*) + | intros. + (* una chiamata di autobatch in questo punto genera segmentation fault*) + apply False_ind. + (* una chiamata di autobatch in questo punto genera segmentation fault*) + apply not_eq_true_false. + (* una chiamata di autobatch in questo punto genera segmentation fault*) + rewrite < H2. + (* una chiamata di autobatch in questo punto genera segmentation fault*) + rewrite < H7. + (* una chiamata di autobatch in questo punto genera segmentation fault*) + rewrite > H6. + reflexivity. + ] + | reflexivity. + ] +] +qed. + +theorem lt_max_to_false : \forall f:nat \to bool. +\forall n,m:nat. (max n f) < m \to m \leq n \to f m = false. +intros 2. +elim n +[ absurd (le m O);autobatch + (*[ assumption + | cut (O < m) + [ apply (lt_O_n_elim m Hcut). + exact not_le_Sn_O. + | rewrite < (max_O_f f). + assumption. + ] + ]*) +| generalize in match H1. + elim (max_S_max f n1) + [ elim H3. + absurd (m \le S n1) + [ assumption + | apply lt_to_not_le. + rewrite < H6. + assumption + ] + | elim H3. + apply (le_n_Sm_elim m n1 H2) + [ intro. + apply H;autobatch + (*[ rewrite < H6. + assumption + | apply le_S_S_to_le. + assumption + ]*) + | intro. + autobatch + (*rewrite > H7. + assumption*) + ] + ] +]qed. + +let rec min_aux off n f \def + match f (n-off) with + [ true \Rightarrow (n-off) + | false \Rightarrow + match off with + [ O \Rightarrow n + | (S p) \Rightarrow min_aux p n f]]. + +definition min : nat \to (nat \to bool) \to nat \def +\lambda n.\lambda f. min_aux n n f. + +theorem min_aux_O_f: \forall f:nat \to bool. \forall i :nat. +min_aux O i f = i. +intros.simplify. +(*una chiamata di autobatch a questo punto porta ad un'elaborazione molto lunga (forse va + in loop): dopo circa 3 minuti non era ancora terminata. + *) +rewrite < minus_n_O. +(*una chiamata di autobatch a questo punto porta ad un'elaborazione molto lunga (forse va + in loop): dopo circa 3 minuti non era ancora terminata. + *) +elim (f i); autobatch. +(*[ reflexivity. + simplify +| reflexivity +]*) +qed. + +theorem min_O_f : \forall f:nat \to bool. +min O f = O. +intro. +(* una chiamata di autobatch a questo punto NON conclude la dimostrazione*) +apply (min_aux_O_f f O). +qed. + +theorem min_aux_S : \forall f: nat \to bool. \forall i,n:nat. +(f (n -(S i)) = true \land min_aux (S i) n f = (n - (S i))) \lor +(f (n -(S i)) = false \land min_aux (S i) n f = min_aux i n f). +intros.simplify.elim (f (n - (S i)));autobatch. +(*[ simplify. + left. + split;reflexivity. +| simplify. + right. + split;reflexivity. +]*) +qed. + +theorem f_min_aux_true: \forall f:nat \to bool. \forall off,m:nat. +(\exists i. le (m-off) i \land le i m \land f i = true) \to +f (min_aux off m f) = true. +intros 2. +elim off +[ elim H. + elim H1. + elim H2. + cut (a = m) + [ autobatch. + (*rewrite > (min_aux_O_f f). + rewrite < Hcut. + assumption*) + | apply (antisym_le a m) + [ assumption + | rewrite > (minus_n_O m). + assumption + ] + ] +| simplify. + apply (bool_ind (\lambda b:bool. + (f (m-(S n)) = b) \to (f (match b in bool with + [ true \Rightarrow m-(S n) + | false \Rightarrow (min_aux n m f)])) = true)) + [ autobatch + (*simplify. + intro. + assumption.*) + | simplify. + intro. + apply H. + elim H1. + elim H3. + elim H4. + elim (le_to_or_lt_eq (m-(S n)) a H6) + [ apply (ex_intro nat ? a). + split;autobatch + (*[ autobatch.split + [ apply lt_minus_S_n_to_le_minus_n. + assumption + | assumption + ] + | assumption + ]*) + | absurd (f a = false) + [ (* una chiamata di autobatch in questo punto genera segmentation fault*) + rewrite < H8. + assumption. + | rewrite > H5. + apply not_eq_true_false + ] + ] + | reflexivity. + ] +] +qed. + +theorem lt_min_aux_to_false : \forall f:nat \to bool. +\forall n,off,m:nat. (n-off) \leq m \to m < (min_aux off n f) \to f m = false. +intros 3. +elim off +[absurd (le n m) + [ rewrite > minus_n_O. + assumption + | apply lt_to_not_le. + rewrite < (min_aux_O_f f n). + assumption + ] +| generalize in match H1. + elim (min_aux_S f n1 n) + [ elim H3. + absurd (n - S n1 \le m) + [ assumption + | apply lt_to_not_le. + rewrite < H6. + assumption + ] + | elim H3. + elim (le_to_or_lt_eq (n -(S n1)) m) + [ apply H + [ autobatch + (*apply lt_minus_S_n_to_le_minus_n. + assumption*) + | rewrite < H6. + assumption + ] + | rewrite < H7. + assumption + | assumption + ] + ] +] +qed. + +theorem le_min_aux : \forall f:nat \to bool. +\forall n,off:nat. (n-off) \leq (min_aux off n f). +intros 3. +elim off +[ rewrite < minus_n_O. + autobatch + (*rewrite > (min_aux_O_f f n). + apply le_n.*) +| elim (min_aux_S f n1 n) + [ elim H1. + autobatch + (*rewrite > H3. + apply le_n.*) + | elim H1. + rewrite > H3. + autobatch + (*apply (trans_le (n-(S n1)) (n-n1)) + [ apply monotonic_le_minus_r. + apply le_n_Sn. + | assumption. + ]*) + ] +] +qed. + +theorem le_min_aux_r : \forall f:nat \to bool. +\forall n,off:nat. (min_aux off n f) \le n. +intros. +elim off +[ simplify. + rewrite < minus_n_O. + elim (f n);autobatch + (*[simplify. + apply le_n. + | simplify. + apply le_n. + ]*) +| simplify. + elim (f (n -(S n1)));simplify;autobatch + (*[ apply le_plus_to_minus. + rewrite < sym_plus. + apply le_plus_n + | assumption + ]*) +] +qed. diff --git a/matita/library_auto/auto/nat/minus.ma b/matita/library_auto/auto/nat/minus.ma new file mode 100644 index 000000000..8a3d893f1 --- /dev/null +++ b/matita/library_auto/auto/nat/minus.ma @@ -0,0 +1,514 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + + +set "baseuri" "cic:/matita/library_autobatch/nat/minus". + +include "auto/nat/le_arith.ma". +include "auto/nat/compare.ma". + +let rec minus n m \def + match n with + [ O \Rightarrow O + | (S p) \Rightarrow + match m with + [O \Rightarrow (S p) + | (S q) \Rightarrow minus p q ]]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural minus" 'minus x y = (cic:/matita/library_autobatch/nat/minus/minus.con x y). + +theorem minus_n_O: \forall n:nat.n=n-O. +intros. +elim n; +autobatch. (* applico autobatch su entrambi i goal aperti*) +(*simplify;reflexivity.*) +qed. + +theorem minus_n_n: \forall n:nat.O=n-n. +intros. +elim n;simplify +[ reflexivity +| apply H +] +qed. + +theorem minus_Sn_n: \forall n:nat. S O = (S n)-n. +intro. +elim n +[ autobatch + (*simplify.reflexivity.*) +| elim H. + reflexivity +] +qed. + + +theorem minus_Sn_m: \forall n,m:nat. m \leq n \to (S n)-m = S (n-m). +intros 2. +apply (nat_elim2 +(\lambda n,m.m \leq n \to (S n)-m = S (n-m)));intros +[ apply (le_n_O_elim n1 H). + autobatch + (*simplify. + reflexivity.*) +| autobatch + (*simplify. + reflexivity.*) +| rewrite < H + [ reflexivity + | autobatch + (*apply le_S_S_to_le. + assumption.*) + ] +] +qed. + +theorem plus_minus: +\forall n,m,p:nat. m \leq n \to (n-m)+p = (n+p)-m. +intros 2. +apply (nat_elim2 +(\lambda n,m.\forall p:nat.m \leq n \to (n-m)+p = (n+p)-m));intros +[ apply (le_n_O_elim ? H). + autobatch + (*simplify. + rewrite < minus_n_O. + reflexivity.*) +| autobatch + (*simplify. + reflexivity.*) +| simplify. + autobatch + (*apply H. + apply le_S_S_to_le. + assumption.*) +] +qed. + +theorem minus_plus_m_m: \forall n,m:nat.n = (n+m)-m. +intros 2. +generalize in match n. +elim m +[ rewrite < minus_n_O. + apply plus_n_O. +| elim n2 + [ autobatch + (*simplify. + apply minus_n_n.*) + | rewrite < plus_n_Sm. + change with (S n3 = (S n3 + n1)-n1). + apply H + ] +] +qed. + +theorem plus_minus_m_m: \forall n,m:nat. +m \leq n \to n = (n-m)+m. +intros 2. +apply (nat_elim2 (\lambda n,m.m \leq n \to n = (n-m)+m));intros +[ apply (le_n_O_elim n1 H). + reflexivity +| autobatch + (*simplify. + rewrite < plus_n_O. + reflexivity.*) +| simplify. + rewrite < sym_plus. + simplify. + apply eq_f. + rewrite < sym_plus. + autobatch + (*apply H. + apply le_S_S_to_le. + assumption.*) +] +qed. + +theorem minus_to_plus :\forall n,m,p:nat.m \leq n \to n-m = p \to +n = m+p. +intros.apply (trans_eq ? ? ((n-m)+m));autobatch. +(*[ apply plus_minus_m_m. + apply H. +| elim H1. + apply sym_plus. +]*) +qed. + +theorem plus_to_minus :\forall n,m,p:nat. +n = m+p \to n-m = p. +intros. +apply (inj_plus_r m). +rewrite < H. +rewrite < sym_plus. +symmetry. +autobatch. +(*apply plus_minus_m_m. +rewrite > H. +rewrite > sym_plus. +apply le_plus_n.*) +qed. + +theorem minus_S_S : \forall n,m:nat. +eq nat (minus (S n) (S m)) (minus n m). +intros. +reflexivity. +qed. + +theorem minus_pred_pred : \forall n,m:nat. lt O n \to lt O m \to +eq nat (minus (pred n) (pred m)) (minus n m). +intros. +apply (lt_O_n_elim n H). +intro. +apply (lt_O_n_elim m H1). +intro. +autobatch. +(*simplify.reflexivity.*) +qed. + +theorem eq_minus_n_m_O: \forall n,m:nat. +n \leq m \to n-m = O. +intros 2. +apply (nat_elim2 (\lambda n,m.n \leq m \to n-m = O));intros +[ autobatch + (*simplify. + reflexivity.*) +| apply False_ind. + autobatch + (*apply not_le_Sn_O. + goal 15.*) (*prima goal 13*) +(* effettuando un'esecuzione passo-passo, quando si arriva a dover + considerare questa tattica, la finestra di dimostrazione scompare + e viene generato il seguente errore: + Uncaught exception: File "matitaMathView.ml", line 677, characters + 6-12: Assertion failed. + + tuttavia l'esecuzione continua, ed il teorema viene comunque + dimostrato. + *) + (*apply H.*) +| simplify. + autobatch + (*apply H. + apply le_S_S_to_le. + apply H1.*) +] +qed. + +theorem le_SO_minus: \forall n,m:nat.S n \leq m \to S O \leq m-n. +intros. +elim H +[ elim (minus_Sn_n n).apply le_n +| rewrite > minus_Sn_m;autobatch + (*apply le_S.assumption. + apply lt_to_le.assumption.*) +] +qed. + +theorem minus_le_S_minus_S: \forall n,m:nat. m-n \leq S (m-(S n)). +intros.apply (nat_elim2 (\lambda n,m.m-n \leq S (m-(S n))));intros +[ elim n1;simplify + [ apply le_n_Sn. + | rewrite < minus_n_O. + apply le_n. + ] +| autobatch + (*simplify.apply le_n_Sn.*) +| simplify.apply H. +] +qed. + +theorem lt_minus_S_n_to_le_minus_n : \forall n,m,p:nat. m-(S n) < p \to m-n \leq p. +intros 3. +autobatch. +(*simplify. +intro. +apply (trans_le (m-n) (S (m-(S n))) p). +apply minus_le_S_minus_S. +assumption.*) +qed. + +theorem le_minus_m: \forall n,m:nat. n-m \leq n. +intros.apply (nat_elim2 (\lambda m,n. n-m \leq n));intros +[ autobatch + (*rewrite < minus_n_O. + apply le_n.*) +| autobatch + (*simplify. + apply le_n.*) +| simplify. + autobatch + (*apply le_S. + assumption.*) +] +qed. + +theorem lt_minus_m: \forall n,m:nat. O < n \to O < m \to n-m \lt n. +intros. +apply (lt_O_n_elim n H). +intro. +apply (lt_O_n_elim m H1). +intro. +simplify. +autobatch. +(*unfold lt. +apply le_S_S. +apply le_minus_m.*) +qed. + +theorem minus_le_O_to_le: \forall n,m:nat. n-m \leq O \to n \leq m. +intros 2. +apply (nat_elim2 (\lambda n,m:nat.n-m \leq O \to n \leq m)) +[ intros. + apply le_O_n +| simplify. + intros. + assumption +| simplify. + intros. + autobatch + (*apply le_S_S. + apply H. + assumption.*) +] +qed. + +(* galois *) +theorem monotonic_le_minus_r: +\forall p,q,n:nat. q \leq p \to n-p \le n-q. +(*simplify*). +intros 2. +apply (nat_elim2 +(\lambda p,q.\forall a.q \leq p \to a-p \leq a-q));intros +[ apply (le_n_O_elim n H). + apply le_n. +| rewrite < minus_n_O. + apply le_minus_m. +| elim a + [ autobatch + (*simplify. + apply le_n.*) + | simplify. + autobatch + (*apply H. + apply le_S_S_to_le. + assumption.*) + ] +] +qed. + +theorem le_minus_to_plus: \forall n,m,p. (le (n-m) p) \to (le n (p+m)). +intros 2. +apply (nat_elim2 (\lambda n,m.\forall p.(le (n-m) p) \to (le n (p+m))));intros +[ apply le_O_n. +| rewrite < plus_n_O. + assumption. +| rewrite < plus_n_Sm. + apply le_S_S. + apply H. + exact H1. +] +qed. + +theorem le_plus_to_minus: \forall n,m,p. (le n (p+m)) \to (le (n-m) p). +intros 2. +apply (nat_elim2 (\lambda n,m.\forall p.(le n (p+m)) \to (le (n-m) p))) +[ intros. + autobatch + (*simplify. + apply le_O_n.*) +| intros 2. + rewrite < plus_n_O. + autobatch + (*intro. + simplify. + assumption.*) +| intros. + simplify. + apply H. + apply le_S_S_to_le. + rewrite > plus_n_Sm. + assumption +] +qed. + +(* the converse of le_plus_to_minus does not hold *) +theorem le_plus_to_minus_r: \forall n,m,p. (le (n+m) p) \to (le n (p-m)). +intros 3. +apply (nat_elim2 (\lambda m,p.(le (n+m) p) \to (le n (p-m))));intro +[ rewrite < plus_n_O. + rewrite < minus_n_O. + autobatch + (*intro. + assumption.*) +| intro. + cut (n=O) + [ autobatch + (*rewrite > Hcut. + apply le_O_n.*) + | apply sym_eq. + apply le_n_O_to_eq. + autobatch + (*apply (trans_le ? (n+(S n1))) + [ rewrite < sym_plus. + apply le_plus_n + | assumption + ]*) + ] +| intros. + simplify. + apply H. + apply le_S_S_to_le. + rewrite > plus_n_Sm. + assumption +] +qed. + +(* minus and lt - to be completed *) +theorem lt_minus_to_plus: \forall n,m,p. (lt n (p-m)) \to (lt (n+m) p). +intros 3. +apply (nat_elim2 (\lambda m,p.(lt n (p-m)) \to (lt (n+m) p))) +[ intro. + rewrite < plus_n_O. + rewrite < minus_n_O. + autobatch + (*intro. + assumption.*) +| simplify. + intros. + apply False_ind. + apply (not_le_Sn_O n H) +| (*simplify.*) + intros. + unfold lt. + apply le_S_S. + rewrite < plus_n_Sm. + autobatch + (*apply H. + apply H1.*) +] +qed. + +theorem distributive_times_minus: distributive nat times minus. +unfold distributive. +intros. +apply ((leb_elim z y));intro +[ cut (x*(y-z)+x*z = (x*y-x*z)+x*z) + [ autobatch + (*apply (inj_plus_l (x*z)). + assumption.*) + | apply (trans_eq nat ? (x*y)) + [ rewrite < distr_times_plus. + autobatch + (*rewrite < (plus_minus_m_m ? ? H). + reflexivity.*) + | rewrite < plus_minus_m_m;autobatch + (*[ reflexivity. + | apply le_times_r. + assumption. + ]*) + ] + ] +| rewrite > eq_minus_n_m_O + [ rewrite > (eq_minus_n_m_O (x*y)) + [ autobatch + (*rewrite < sym_times. + simplify. + reflexivity.*) + | apply le_times_r. + apply lt_to_le. + autobatch + (*apply not_le_to_lt. + assumption.*) + ] + | autobatch + (*apply lt_to_le. + apply not_le_to_lt. + assumption.*) + ] +] +qed. + +theorem distr_times_minus: \forall n,m,p:nat. n*(m-p) = n*m-n*p +\def distributive_times_minus. + +theorem eq_minus_plus_plus_minus: \forall n,m,p:nat. p \le m \to (n+m)-p = n+(m-p). +intros. +apply plus_to_minus. +rewrite > sym_plus in \vdash (? ? ? %). +rewrite > assoc_plus. +autobatch. +(*rewrite < plus_minus_m_m. +reflexivity. +assumption. +*) +qed. + +theorem eq_minus_minus_minus_plus: \forall n,m,p:nat. (n-m)-p = n-(m+p). +intros. +cut (m+p \le n \or m+p \nleq n) +[ elim Hcut + [ symmetry. + apply plus_to_minus. + rewrite > assoc_plus. + rewrite > (sym_plus p). + rewrite < plus_minus_m_m + [ rewrite > sym_plus. + rewrite < plus_minus_m_m ; autobatch + (*[ reflexivity. + | apply (trans_le ? (m+p)) + [ rewrite < sym_plus. + apply le_plus_n + | assumption + ] + ]*) + | apply le_plus_to_minus_r. + rewrite > sym_plus. + assumption. + ] + | rewrite > (eq_minus_n_m_O n (m+p)) + [ rewrite > (eq_minus_n_m_O (n-m) p) + [ reflexivity + | apply le_plus_to_minus. + apply lt_to_le. + rewrite < sym_plus. + autobatch + (*apply not_le_to_lt. + assumption.*) + ] + | autobatch + (*apply lt_to_le. + apply not_le_to_lt. + assumption.*) + ] + ] +| apply (decidable_le (m+p) n) +] +qed. + +theorem eq_plus_minus_minus_minus: \forall n,m,p:nat. p \le m \to m \le n \to +p+(n-m) = n-(m-p). +intros. +apply sym_eq. +apply plus_to_minus. +rewrite < assoc_plus. +rewrite < plus_minus_m_m; +[ rewrite < sym_plus. + autobatch + (*rewrite < plus_minus_m_m + [ reflexivity + | assumption + ]*) +| assumption +] +qed. diff --git a/matita/library_auto/auto/nat/nat.ma b/matita/library_auto/auto/nat/nat.ma new file mode 100644 index 000000000..f915759f7 --- /dev/null +++ b/matita/library_auto/auto/nat/nat.ma @@ -0,0 +1,151 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/nat". + +include "higher_order_defs/functions.ma". + +inductive nat : Set \def + | O : nat + | S : nat \to nat. + +definition pred: nat \to nat \def + \lambda n:nat. match n with + [ O \Rightarrow O + | (S p) \Rightarrow p ]. + +theorem pred_Sn : \forall n:nat.n=(pred (S n)). + autobatch. + (*intros. reflexivity.*) +qed. + +theorem injective_S : injective nat nat S. + unfold injective. + intros. + rewrite > pred_Sn. + rewrite > (pred_Sn y). + autobatch. + (*apply eq_f. + assumption.*) +qed. + +theorem inj_S : \forall n,m:nat.(S n)=(S m) \to n=m \def + injective_S. + +theorem not_eq_S : \forall n,m:nat. + \lnot n=m \to S n \neq S m. + intros. + unfold Not. + intros. + autobatch. + (*apply H. + apply injective_S. + assumption.*) +qed. + +definition not_zero : nat \to Prop \def + \lambda n: nat. + match n with + [ O \Rightarrow False + | (S p) \Rightarrow True ]. + +theorem not_eq_O_S : \forall n:nat. O \neq S n. + intros. + unfold Not. + intros. + cut (not_zero O) + [exact Hcut + |rewrite > H.exact I] +qed. + +theorem not_eq_n_Sn : \forall n:nat. n \neq S n. + intros. + elim n + [apply not_eq_O_S + |apply not_eq_S.assumption] +qed. + +theorem nat_case: + \forall n:nat.\forall P:nat \to Prop. + P O \to (\forall m:nat. P (S m)) \to P n. + intros. + + elim n + [ assumption + | apply H1 ] +qed. + +theorem nat_case1: + \forall n:nat.\forall P:nat \to Prop. + (n=O \to P O) \to (\forall m:nat. (n=(S m) \to P (S m))) \to P n. +intros 2; +elim n + [ autobatch + (*apply H; + reflexivity*) + | autobatch + (*apply H2; + reflexivity*) ] +qed. + +theorem nat_elim2 : + \forall R:nat \to nat \to Prop. + (\forall n:nat. R O n) + \to (\forall n:nat. R (S n) O) + \to (\forall n,m:nat. R n m \to R (S n) (S m)) + \to \forall n,m:nat. R n m. + intros 5; + elim n + [ apply H + | apply (nat_case m) + [ apply H1 + |intro; + autobatch + (*apply H2; + apply H3*) + ] + ] +qed. + +theorem decidable_eq_nat : \forall n,m:nat.decidable (n=m). + intros.unfold decidable. + apply (nat_elim2 (\lambda n,m.(Or (n=m) ((n=m) \to False)))) + [ intro; elim n1 + [autobatch + (*left; + reflexivity*) + |autobatch + (*right; + apply not_eq_O_S*) ] + | intro; + right; + intro; + apply (not_eq_O_S n1); + autobatch + (*apply sym_eq; + assumption*) + | intros; elim H + [ autobatch + (*left; + apply eq_f; + assumption*) + | right; + intro; + autobatch + (*apply H1; + apply inj_S; + assumption*) + ] + ] +qed. diff --git a/matita/library_auto/auto/nat/nth_prime.ma b/matita/library_auto/auto/nat/nth_prime.ma new file mode 100644 index 000000000..88234154b --- /dev/null +++ b/matita/library_auto/auto/nat/nth_prime.ma @@ -0,0 +1,275 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/nth_prime". + +include "auto/nat/primes.ma". +include "auto/nat/lt_arith.ma". + +(* upper bound by Bertrand's conjecture. *) +(* Too difficult to prove. +let rec nth_prime n \def +match n with + [ O \Rightarrow (S(S O)) + | (S p) \Rightarrow + let previous_prime \def S (nth_prime p) in + min_aux previous_prime ((S(S O))*previous_prime) primeb]. + +theorem example8 : nth_prime (S(S O)) = (S(S(S(S(S O))))). +normalize.reflexivity. +qed. + +theorem example9 : nth_prime (S(S(S O))) = (S(S(S(S(S(S(S O))))))). +normalize.reflexivity. +qed. + +theorem example10 : nth_prime (S(S(S(S O)))) = (S(S(S(S(S(S(S(S(S(S(S O))))))))))). +normalize.reflexivity. +qed. *) + +theorem smallest_factor_fact: \forall n:nat. +n < smallest_factor (S n!). +intros. +apply not_le_to_lt. +unfold Not. +intro. +apply (not_divides_S_fact n (smallest_factor(S n!))) +[ apply lt_SO_smallest_factor. + unfold lt.autobatch + (*apply le_S_S. + apply le_SO_fact*) +| assumption +| autobatch + (*apply divides_smallest_factor_n. + unfold lt. + apply le_S_S. + apply le_O_n*) +] +qed. + +theorem ex_prime: \forall n. (S O) \le n \to \exists m. +n < m \land m \le S n! \land (prime m). +intros. +elim H +[ apply (ex_intro nat ? (S(S O))). + split;autobatch + (*[ split + [ apply (le_n (S(S O))) + | apply (le_n (S(S O))) + ] + | apply (primeb_to_Prop (S(S O))) + ]*) +| apply (ex_intro nat ? (smallest_factor (S (S n1)!))). + split + [ autobatch + (*split + [ apply smallest_factor_fact + | apply le_smallest_factor_n + ]*) + | (* Andrea: ancora hint non lo trova *) + apply prime_smallest_factor_n. + unfold lt.autobatch + (*apply le_S. + apply le_SSO_fact. + unfold lt. + apply le_S_S. + assumption*) + ] +] +qed. + +let rec nth_prime n \def +match n with + [ O \Rightarrow (S(S O)) + | (S p) \Rightarrow + let previous_prime \def (nth_prime p) in + let upper_bound \def S previous_prime! in + min_aux (upper_bound - (S previous_prime)) upper_bound primeb]. + +(* it works, but nth_prime 4 takes already a few minutes - +it must compute factorial of 7 ...*) +(* +theorem example11 : nth_prime (S(S O)) = (S(S(S(S(S O))))). +autobatch. +(*normalize.reflexivity.*) +qed. + +theorem example12: nth_prime (S(S(S O))) = (S(S(S(S(S(S(S O))))))). +autobatch. +(*normalize.reflexivity.*) +qed. + +theorem example13 : nth_prime (S(S(S(S O)))) = (S(S(S(S(S(S(S(S(S(S(S O))))))))))). +autobatch. +(*normalize.reflexivity.*) +qed. +*) +(* +theorem example14 : nth_prime (S(S(S(S(S O))))) = (S(S(S(S(S(S(S(S(S(S(S O))))))))))). +normalize.reflexivity. +*) + +theorem prime_nth_prime : \forall n:nat.prime (nth_prime n). +intro. +apply (nat_case n) +[ autobatch + (*simplify. + apply (primeb_to_Prop (S(S O)))*) +| intro. + change with + (let previous_prime \def (nth_prime m) in + let upper_bound \def S previous_prime! in + prime (min_aux (upper_bound - (S previous_prime)) upper_bound primeb)). + apply primeb_true_to_prime. + apply f_min_aux_true. + apply (ex_intro nat ? (smallest_factor (S (nth_prime m)!))). + split + [ split + [ cut (S (nth_prime m)!-(S (nth_prime m)! - (S (nth_prime m))) = (S (nth_prime m))) + [ rewrite > Hcut. + exact (smallest_factor_fact (nth_prime m)) + | (* maybe we could factorize this proof *) + apply plus_to_minus. + autobatch + (*apply plus_minus_m_m. + apply le_S_S. + apply le_n_fact_n*) + ] + | apply le_smallest_factor_n + ] + | apply prime_to_primeb_true. + apply prime_smallest_factor_n. + unfold lt.autobatch + (*apply le_S_S. + apply le_SO_fact*) + ] +] +qed. + +(* properties of nth_prime *) +theorem increasing_nth_prime: increasing nth_prime. +unfold increasing. +intros. +change with +(let previous_prime \def (nth_prime n) in +let upper_bound \def S previous_prime! in +(S previous_prime) \le min_aux (upper_bound - (S previous_prime)) upper_bound primeb). +intros. +cut (upper_bound - (upper_bound -(S previous_prime)) = (S previous_prime)) +[ rewrite < Hcut in \vdash (? % ?). + apply le_min_aux +| apply plus_to_minus. + autobatch + (*apply plus_minus_m_m. + apply le_S_S. + apply le_n_fact_n*) +] +qed. + +variant lt_nth_prime_n_nth_prime_Sn :\forall n:nat. +(nth_prime n) < (nth_prime (S n)) \def increasing_nth_prime. + +theorem injective_nth_prime: injective nat nat nth_prime. +autobatch. +(*apply increasing_to_injective. +apply increasing_nth_prime.*) +qed. + +theorem lt_SO_nth_prime_n : \forall n:nat. (S O) \lt nth_prime n. +intros. +(*usando la tattica autobatch qui, dopo svariati minuti la computazione non era + * ancora terminata + *) +elim n +[ unfold lt.autobatch + (*apply le_n*) +| autobatch + (*apply (trans_lt ? (nth_prime n1)) + [ assumption + | apply lt_nth_prime_n_nth_prime_Sn + ]*) +] +qed. + +theorem lt_O_nth_prime_n : \forall n:nat. O \lt nth_prime n. +intros. +autobatch. +(*apply (trans_lt O (S O)) +[ unfold lt. + apply le_n +| apply lt_SO_nth_prime_n +]*) +qed. + +theorem ex_m_le_n_nth_prime_m: +\forall n: nat. nth_prime O \le n \to +\exists m. nth_prime m \le n \land n < nth_prime (S m). +autobatch. +(*intros. +apply increasing_to_le2 +[ exact lt_nth_prime_n_nth_prime_Sn +| assumption +]*) +qed. + +theorem lt_nth_prime_to_not_prime: \forall n,m. nth_prime n < m \to m < nth_prime (S n) +\to \lnot (prime m). +intros. +apply primeb_false_to_not_prime. +letin previous_prime \def (nth_prime n). +letin upper_bound \def (S previous_prime!). +apply (lt_min_aux_to_false primeb upper_bound (upper_bound - (S previous_prime)) m) +[ cut (S (nth_prime n)!-(S (nth_prime n)! - (S (nth_prime n))) = (S (nth_prime n))) + [ rewrite > Hcut. + assumption + | apply plus_to_minus. + autobatch + (*apply plus_minus_m_m. + apply le_S_S. + apply le_n_fact_n*) + ] +| assumption +] +qed. + +(* nth_prime enumerates all primes *) +theorem prime_to_nth_prime : \forall p:nat. prime p \to +\exists i. nth_prime i = p. +intros. +cut (\exists m. nth_prime m \le p \land p < nth_prime (S m)) +[ elim Hcut. + elim H1. + cut (nth_prime a < p \lor nth_prime a = p) + [ elim Hcut1 + [ absurd (prime p) + [ assumption + | autobatch + (*apply (lt_nth_prime_to_not_prime a);assumption*) + ] + | autobatch + (*apply (ex_intro nat ? a). + assumption*) + ] + | autobatch + (*apply le_to_or_lt_eq. + assumption*) + ] +| apply ex_m_le_n_nth_prime_m. + simplify. + unfold prime in H. + elim H. + assumption +] +qed. + diff --git a/matita/library_auto/auto/nat/ord.ma b/matita/library_auto/auto/nat/ord.ma new file mode 100644 index 000000000..8a4de9f1f --- /dev/null +++ b/matita/library_auto/auto/nat/ord.ma @@ -0,0 +1,389 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/ord". + +include "datatypes/constructors.ma". +include "auto/nat/exp.ma". +include "auto/nat/gcd.ma". +include "auto/nat/relevant_equations.ma". (* required by autobatch paramod *) + +(* this definition of log is based on pairs, with a remainder *) + +let rec p_ord_aux p n m \def + match n \mod m with + [ O \Rightarrow + match p with + [ O \Rightarrow pair nat nat O n + | (S p) \Rightarrow + match (p_ord_aux p (n / m) m) with + [ (pair q r) \Rightarrow pair nat nat (S q) r] ] + | (S a) \Rightarrow pair nat nat O n]. + +(* p_ord n m = if m divides n q times, with remainder r *) +definition p_ord \def \lambda n,m:nat.p_ord_aux n n m. + +theorem p_ord_aux_to_Prop: \forall p,n,m. O < m \to + match p_ord_aux p n m with + [ (pair q r) \Rightarrow n = m \sup q *r ]. +intro. +elim p +[ simplify. + apply (nat_case (n \mod m)) + [ simplify. + apply plus_n_O + | intros. + simplify. + apply plus_n_O + ] +| simplify. + apply (nat_case1 (n1 \mod m)) + [ intro. + simplify. + generalize in match (H (n1 / m) m). + elim (p_ord_aux n (n1 / m) m). + simplify. + rewrite > assoc_times. + rewrite < H3 + [ rewrite > (plus_n_O (m*(n1 / m))). + rewrite < H2. + rewrite > sym_times. + autobatch + (*rewrite < div_mod + [ reflexivity + | assumption + ]*) + | assumption + ] + | intros. + simplify. + apply plus_n_O + ] +] +qed. + +theorem p_ord_aux_to_exp: \forall p,n,m,q,r. O < m \to + (pair nat nat q r) = p_ord_aux p n m \to n = m \sup q * r. +intros. +change with +match (pair nat nat q r) with + [ (pair q r) \Rightarrow n = m \sup q * r ]. +rewrite > H1. +apply p_ord_aux_to_Prop. +assumption. +qed. + +(* questo va spostato in primes1.ma *) +theorem p_ord_exp: \forall n,m,i. O < m \to n \mod m \neq O \to +\forall p. i \le p \to p_ord_aux p (m \sup i * n) m = pair nat nat i n. +intros 5. +elim i +[ simplify. + rewrite < plus_n_O. + apply (nat_case p) + [ simplify. + elim (n \mod m);autobatch + (*[ simplify. + reflexivity + | simplify. + reflexivity + ]*) + | intro. + simplify. + cut (O < n \mod m \lor O = n \mod m) + [ elim Hcut + [ apply (lt_O_n_elim (n \mod m) H3). + intros.autobatch + (*simplify. + reflexivity*) + | apply False_ind.autobatch + (*apply H1. + apply sym_eq. + assumption*) + ] + | autobatch + (*apply le_to_or_lt_eq. + apply le_O_n*) + ] + ] +| generalize in match H3. + apply (nat_case p) + [ intro. + apply False_ind. + apply (not_le_Sn_O n1 H4) + | intros. + simplify. + fold simplify (m \sup (S n1)). + cut (((m \sup (S n1)*n) \mod m) = O) + [ rewrite > Hcut. + simplify. + fold simplify (m \sup (S n1)). + cut ((m \sup (S n1) *n) / m = m \sup n1 *n) + [ rewrite > Hcut1. + rewrite > (H2 m1);autobatch + (*[ simplify. + reflexivity + | apply le_S_S_to_le. + assumption + ]*) + | (* div_exp *) + simplify. + rewrite > assoc_times. + apply (lt_O_n_elim m H). + intro. + apply div_times + ] + | (* mod_exp = O *) + apply divides_to_mod_O + [ assumption + | simplify.autobatch + (*rewrite > assoc_times. + apply (witness ? ? (m \sup n1 *n)). + reflexivity*) + ] + ] + ] +] +qed. + +theorem p_ord_aux_to_Prop1: \forall p,n,m. (S O) < m \to O < n \to n \le p \to + match p_ord_aux p n m with + [ (pair q r) \Rightarrow r \mod m \neq O]. +intro. +elim p +[ absurd (O < n);autobatch + (*[ assumption + | apply le_to_not_lt. + assumption + ]*) +| simplify. + apply (nat_case1 (n1 \mod m)) + [ intro. + generalize in match (H (n1 / m) m). + elim (p_ord_aux n (n1 / m) m). + apply H5 + [ assumption + | autobatch + (*apply eq_mod_O_to_lt_O_div + [ apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ] + | assumption + | assumption + ]*) + | apply le_S_S_to_le.autobatch + (*apply (trans_le ? n1) + [ change with (n1 / m < n1). + apply lt_div_n_m_n;assumption + | assumption + ]*) + ] + | intros. + simplify.autobatch + (*rewrite > H4. + unfold Not. + intro. + apply (not_eq_O_S m1). + rewrite > H5. + reflexivity.*) + ] +] +qed. + +theorem p_ord_aux_to_not_mod_O: \forall p,n,m,q,r. (S O) < m \to O < n \to n \le p \to + pair nat nat q r = p_ord_aux p n m \to r \mod m \neq O. +intros. +change with + match (pair nat nat q r) with + [ (pair q r) \Rightarrow r \mod m \neq O]. +rewrite > H3. +apply p_ord_aux_to_Prop1; + assumption. +qed. + +axiom not_eq_to_le_to_lt: ∀n,m. n≠m → n≤m → n H2. +apply p_ord_exp +[ assumption +| unfold. + intro. + autobatch + (*apply H1. + apply mod_O_to_divides + [ assumption + | assumption + ]*) +| apply (trans_le ? (p \sup q)) + [ cut ((S O) \lt p) + [ autobatch + (*elim q + [ simplify. + apply le_n_Sn + | simplify. + generalize in match H3. + apply (nat_case n1) + [ simplify. + rewrite < times_n_SO. + intro. + assumption + | intros. + apply (trans_le ? (p*(S m))) + [ apply (trans_le ? ((S (S O))*(S m))) + [ simplify. + rewrite > plus_n_Sm. + rewrite < plus_n_O. + apply le_plus_n + | apply le_times_l. + assumption + ] + | apply le_times_r. + assumption + ] + ] + ]*) + | apply not_eq_to_le_to_lt + [ unfold. + intro. + autobatch + (*apply H1. + rewrite < H3. + apply (witness ? r r ?). + simplify. + apply plus_n_O*) + | assumption + ] + ] + | rewrite > times_n_SO in \vdash (? % ?). + apply le_times_r. + change with (O \lt r). + apply not_eq_to_le_to_lt + [ unfold. + intro.autobatch + (*apply H1.rewrite < H3. + apply (witness ? ? O ?).rewrite < times_n_O. + reflexivity*) + | apply le_O_n + ] + ] +] +qed. + +theorem p_ord_to_exp1: \forall p,n,q,r. (S O) \lt p \to O \lt n \to p_ord n p = pair nat nat q r\to +\lnot p \divides r \land n = p \sup q * r. +intros. +unfold p_ord in H2. +split +[ unfold.intro. + apply (p_ord_aux_to_not_mod_O n n p q r);autobatch + (*[ assumption + | assumption + | apply le_n + | symmetry. + assumption + | apply divides_to_mod_O + [ apply (trans_lt ? (S O)) + [ unfold. + apply le_n + | assumption + ] + | assumption + ] + ]*) +| apply (p_ord_aux_to_exp n);autobatch + (*[ apply (trans_lt ? (S O)) + [ unfold. + apply le_n + | assumption + ] + | symmetry. + assumption + ]*) +] +qed. + +theorem p_ord_times: \forall p,a,b,qa,ra,qb,rb. prime p +\to O \lt a \to O \lt b +\to p_ord a p = pair nat nat qa ra +\to p_ord b p = pair nat nat qb rb +\to p_ord (a*b) p = pair nat nat (qa + qb) (ra*rb). +intros. +cut ((S O) \lt p) +[ elim (p_ord_to_exp1 ? ? ? ? Hcut H1 H3). + elim (p_ord_to_exp1 ? ? ? ? Hcut H2 H4). + apply p_ord_exp1 + [ autobatch + (*apply (trans_lt ? (S O)) + [ unfold. + apply le_n + | assumption + ]*) + | unfold. + intro. + elim (divides_times_to_divides ? ? ? H H9);autobatch + (*[ apply (absurd ? ? H10 H5) + | apply (absurd ? ? H10 H7) + ]*) + | (* rewrite > H6. + rewrite > H8. *) + autobatch paramodulation + ] +| unfold prime in H. + elim H. + assumption +] +qed. + +theorem fst_p_ord_times: \forall p,a,b. prime p +\to O \lt a \to O \lt b +\to fst ? ? (p_ord (a*b) p) = (fst ? ? (p_ord a p)) + (fst ? ? (p_ord b p)). +intros. +rewrite > (p_ord_times p a b (fst ? ? (p_ord a p)) (snd ? ? (p_ord a p)) +(fst ? ? (p_ord b p)) (snd ? ? (p_ord b p)) H H1 H2);autobatch. +(*[ simplify. + reflexivity +| apply eq_pair_fst_snd +| apply eq_pair_fst_snd +]*) +qed. + +theorem p_ord_p : \forall p:nat. (S O) \lt p \to p_ord p p = pair ? ? (S O) (S O). +intros. +apply p_ord_exp1 +[ autobatch + (*apply (trans_lt ? (S O)) + [ unfold. + apply le_n + | assumption + ]*) +| unfold. + intro. + apply (absurd ? ? H).autobatch + (*apply le_to_not_lt. + apply divides_to_le + [ unfold. + apply le_n + | assumption + ]*) +| autobatch + (*rewrite < times_n_SO. + apply exp_n_SO*) +] +qed. diff --git a/matita/library_auto/auto/nat/orders.ma b/matita/library_auto/auto/nat/orders.ma new file mode 100644 index 000000000..0f99c1a65 --- /dev/null +++ b/matita/library_auto/auto/nat/orders.ma @@ -0,0 +1,568 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/orders". + +include "auto/nat/nat.ma". +include "higher_order_defs/ordering.ma". + +(* definitions *) +inductive le (n:nat) : nat \to Prop \def + | le_n : le n n + | le_S : \forall m:nat. le n m \to le n (S m). + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural 'less or equal to'" 'leq x y = (cic:/matita/library_autobatch/nat/orders/le.ind#xpointer(1/1) x y). +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural 'neither less nor equal to'" 'nleq x y = + (cic:/matita/logic/connectives/Not.con + (cic:/matita/library_autobatch/nat/orders/le.ind#xpointer(1/1) x y)). + +definition lt: nat \to nat \to Prop \def +\lambda n,m:nat.(S n) \leq m. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural 'less than'" 'lt x y = (cic:/matita/library_autobatch/nat/orders/lt.con x y). +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural 'not less than'" 'nless x y = + (cic:/matita/logic/connectives/Not.con (cic:/matita/library_autobatch/nat/orders/lt.con x y)). + +definition ge: nat \to nat \to Prop \def +\lambda n,m:nat.m \leq n. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural 'greater or equal to'" 'geq x y = (cic:/matita/library_autobatch/nat/orders/ge.con x y). + +definition gt: nat \to nat \to Prop \def +\lambda n,m:nat.m H7. + apply H*) + ] + ] + | autobatch + (*apply le_to_or_lt_eq. + apply H6*) + ] +] +qed. diff --git a/matita/library_auto/auto/nat/permutation.ma b/matita/library_auto/auto/nat/permutation.ma new file mode 100644 index 000000000..01e340c6b --- /dev/null +++ b/matita/library_auto/auto/nat/permutation.ma @@ -0,0 +1,1432 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/permutation". + +include "auto/nat/compare.ma". +include "auto/nat/sigma_and_pi.ma". + +definition injn: (nat \to nat) \to nat \to Prop \def +\lambda f:nat \to nat.\lambda n:nat.\forall i,j:nat. +i \le n \to j \le n \to f i = f j \to i = j. + +theorem injn_Sn_n: \forall f:nat \to nat. \forall n:nat. +injn f (S n) \to injn f n. +unfold injn. +intros. +apply H;autobatch. +(*[ apply le_S. + assumption +| apply le_S. + assumption +| assumption +]*) +qed. + +theorem injective_to_injn: \forall f:nat \to nat. \forall n:nat. +injective nat nat f \to injn f n. +unfold injective. +unfold injn. +intros.autobatch. +(*apply H. +assumption.*) +qed. + +definition permut : (nat \to nat) \to nat \to Prop +\def \lambda f:nat \to nat. \lambda m:nat. +(\forall i:nat. i \le m \to f i \le m )\land injn f m. + +theorem permut_O_to_eq_O: \forall h:nat \to nat. +permut h O \to (h O) = O. +intros. +unfold permut in H. +elim H. +apply sym_eq.autobatch. +(*apply le_n_O_to_eq. +apply H1. +apply le_n.*) +qed. + +theorem permut_S_to_permut: \forall f:nat \to nat. \forall m:nat. +permut f (S m) \to f (S m) = (S m) \to permut f m. +unfold permut. +intros. +elim H. +split +[ intros. + cut (f i < S m \lor f i = S m) + [ elim Hcut + [ autobatch + (*apply le_S_S_to_le. + assumption*) + | apply False_ind. + apply (not_le_Sn_n m). + cut ((S m) = i) + [ rewrite > Hcut1. + assumption + | apply H3 + [ apply le_n + | autobatch + (*apply le_S. + assumption*) + | autobatch + (*rewrite > H5. + assumption*) + ] + ] + ] + | apply le_to_or_lt_eq. + autobatch + (*apply H2. + apply le_S. + assumption*) + ] +| apply (injn_Sn_n f m H3) +] +qed. + +(* transpositions *) + +definition transpose : nat \to nat \to nat \to nat \def +\lambda i,j,n:nat. +match eqb n i with + [ true \Rightarrow j + | false \Rightarrow + match eqb n j with + [ true \Rightarrow i + | false \Rightarrow n]]. + +notation < "(❲i↹j❳)n" + right associative with precedence 71 +for @{ 'transposition $i $j $n}. + +notation < "(❲i \atop j❳)n" + right associative with precedence 71 +for @{ 'transposition $i $j $n}. + +interpretation "natural transposition" 'transposition i j n = + (cic:/matita/library_autobatch/nat/permutation/transpose.con i j n). + +lemma transpose_i_j_i: \forall i,j:nat. transpose i j i = j. +intros. +unfold transpose. +(*dopo circa 6 minuti, l'esecuzione di autobatch in questo punto non era ancora terminata*) +rewrite > (eqb_n_n i).autobatch. +(*simplify. +reflexivity.*) +qed. + +lemma transpose_i_j_j: \forall i,j:nat. transpose i j j = i. +intros. +unfold transpose. +apply (eqb_elim j i) +[ autobatch + (*simplify. + intro. + assumption*) +| rewrite > (eqb_n_n j). + simplify. + intros. + reflexivity +] +qed. + +theorem transpose_i_i: \forall i,n:nat. (transpose i i n) = n. +intros. +unfold transpose. +apply (eqb_elim n i) +[ autobatch + (*intro. + simplify. + apply sym_eq. + assumption*) +| intro. + autobatch + (*simplify. + reflexivity*) +] +qed. + +theorem transpose_i_j_j_i: \forall i,j,n:nat. +transpose i j n = transpose j i n. +intros. +unfold transpose. +apply (eqb_elim n i) +[ apply (eqb_elim n j) + [ intros. + (*l'esecuzione di autobatch in questo punto, dopo circa 300 secondi, non era ancora terminata*) + simplify.autobatch + (*rewrite < H. + rewrite < H1. + reflexivity*) + | intros. + autobatch + (*simplify. + reflexivity*) + ] +| apply (eqb_elim n j) + [ intros.autobatch + (*simplify.reflexivity *) + | intros.autobatch + (*simplify.reflexivity*) + ] +] +qed. + +theorem transpose_transpose: \forall i,j,n:nat. +(transpose i j (transpose i j n)) = n. +intros. +unfold transpose. +unfold transpose. +apply (eqb_elim n i) +[ simplify. + intro. + apply (eqb_elim j i) + [ simplify. + intros. + autobatch + (*rewrite > H. + rewrite > H1. + reflexivity*) + | rewrite > (eqb_n_n j). + simplify. + intros. + autobatch + (*apply sym_eq. + assumption*) + ] +| apply (eqb_elim n j) + [ simplify. + rewrite > (eqb_n_n i). + intros. + autobatch + (*simplify. + apply sym_eq. + assumption*) + | simplify. + intros. + (*l'esecuzione di autobatch in questo punto, dopo piu' di 6 minuti non era ancora terminata*) + rewrite > (not_eq_to_eqb_false n i H1). + (*l'esecuzione di autobatch in questo punto, dopo piu' alcuni minuti non era ancora terminata*) + rewrite > (not_eq_to_eqb_false n j H).autobatch + (*simplify. + reflexivity*) + ] +] +qed. + +theorem injective_transpose : \forall i,j:nat. +injective nat nat (transpose i j). +unfold injective. +intros.autobatch. +(*rewrite < (transpose_transpose i j x). +rewrite < (transpose_transpose i j y). +apply eq_f. +assumption.*) +qed. + +variant inj_transpose: \forall i,j,n,m:nat. +transpose i j n = transpose i j m \to n = m \def +injective_transpose. + +theorem permut_transpose: \forall i,j,n:nat. i \le n \to j \le n \to +permut (transpose i j) n. +unfold permut. +intros. +split +[ unfold transpose. + intros. + elim (eqb i1 i) + [ (*qui autobatch non chiude il goal*) + simplify. + assumption + | elim (eqb i1 j) + [ (*aui autobatch non chiude il goal*) + simplify. + assumption + | (*aui autobatch non chiude il goal*) + simplify. + assumption + ] + ] +| autobatch + (*apply (injective_to_injn (transpose i j) n). + apply injective_transpose*) +] +qed. + +theorem permut_fg: \forall f,g:nat \to nat. \forall n:nat. +permut f n \to permut g n \to permut (\lambda m.(f(g m))) n. +unfold permut. +intros. +elim H. +elim H1. +split +[ intros. + simplify. + autobatch + (*apply H2. + apply H4. + assumption*) +| simplify. + intros. + apply H5 + [ assumption + | assumption + | apply H3 + [ autobatch + (*apply H4. + assumption*) + | autobatch + (*apply H4. + assumption*) + | assumption + ] + ] +] +qed. + +theorem permut_transpose_l: +\forall f:nat \to nat. \forall m,i,j:nat. +i \le m \to j \le m \to permut f m \to permut (\lambda n.transpose i j (f n)) m. +intros. +autobatch. +(*apply (permut_fg (transpose i j) f m ? ?) +[ apply permut_transpose;assumption +| assumption +]*) +qed. + +theorem permut_transpose_r: +\forall f:nat \to nat. \forall m,i,j:nat. +i \le m \to j \le m \to permut f m \to permut (\lambda n.f (transpose i j n)) m. +intros.autobatch. +(*apply (permut_fg f (transpose i j) m ? ?) +[ assumption +| apply permut_transpose;assumption +]*) +qed. + +theorem eq_transpose : \forall i,j,k,n:nat. \lnot j=i \to + \lnot i=k \to \lnot j=k \to +transpose i j n = transpose i k (transpose k j (transpose i k n)). +(* uffa: triplo unfold? *) +intros.unfold transpose. +unfold transpose. +unfold transpose. +apply (eqb_elim n i) +[ intro. + simplify. + rewrite > (eqb_n_n k). + simplify. + rewrite > (not_eq_to_eqb_false j i H). + rewrite > (not_eq_to_eqb_false j k H2). + reflexivity +| intro. + apply (eqb_elim n j) + [ intro. + cut (\lnot n = k) + [ cut (\lnot n = i) + [ rewrite > (not_eq_to_eqb_false n k Hcut). + simplify. + rewrite > (not_eq_to_eqb_false n k Hcut). + rewrite > (eq_to_eqb_true n j H4). + simplify. + rewrite > (not_eq_to_eqb_false k i) + [ rewrite > (eqb_n_n k). + autobatch + (*simplify. + reflexivity*) + | unfold Not. + intro.autobatch + (*apply H1. + apply sym_eq. + assumption*) + ] + | assumption + ] + | unfold Not. + intro.autobatch + (*apply H2. + apply (trans_eq ? ? n) + [ apply sym_eq. + assumption + | assumption + ]*) + ] + | intro. + apply (eqb_elim n k) + [ intro. + simplify. + rewrite > (not_eq_to_eqb_false i k H1). + rewrite > (not_eq_to_eqb_false i j) + [ simplify. + rewrite > (eqb_n_n i). + autobatch + (*simplify. + assumption*) + | unfold Not. + intro.autobatch + (*apply H. + apply sym_eq. + assumption*) + ] + | intro. + simplify. + rewrite > (not_eq_to_eqb_false n k H5). + rewrite > (not_eq_to_eqb_false n j H4). + simplify. + rewrite > (not_eq_to_eqb_false n i H3). + rewrite > (not_eq_to_eqb_false n k H5). + autobatch + (*simplify. + reflexivity*) + ] + ] +] +qed. + +theorem permut_S_to_permut_transpose: \forall f:nat \to nat. +\forall m:nat. permut f (S m) \to permut (\lambda n.transpose (f (S m)) (S m) +(f n)) m. +unfold permut. +intros. +elim H. +split +[ intros. + simplify. + unfold transpose. + apply (eqb_elim (f i) (f (S m))) + [ intro. + apply False_ind. + cut (i = (S m)) + [ apply (not_le_Sn_n m). + rewrite < Hcut. + assumption + | apply H2;autobatch + (*[ apply le_S. + assumption + | apply le_n + | assumption + ]*) + ] + | intro. + simplify. + apply (eqb_elim (f i) (S m)) + [ intro. + cut (f (S m) \lt (S m) \lor f (S m) = (S m)) + [ elim Hcut + [ apply le_S_S_to_le. + (*NB qui autobatch non chiude il goal*) + assumption + | apply False_ind. + autobatch + (*apply H4. + rewrite > H6. + assumption*) + ] + | autobatch + (*apply le_to_or_lt_eq. + apply H1. + apply le_n*) + ] + | intro.simplify. + cut (f i \lt (S m) \lor f i = (S m)) + [ elim Hcut + [ autobatch + (*apply le_S_S_to_le. + assumption*) + | apply False_ind. + autobatch + (*apply H5. + assumption*) + ] + | apply le_to_or_lt_eq. + autobatch + (*apply H1. + apply le_S. + assumption*) + ] + ] + ] +| unfold injn. + intros. + apply H2;autobatch + (*[ apply le_S. + assumption + | apply le_S. + assumption + | apply (inj_transpose (f (S m)) (S m)). + apply H5 + ]*) +] +qed. + +(* bounded bijectivity *) + +definition bijn : (nat \to nat) \to nat \to Prop \def +\lambda f:nat \to nat. \lambda n. \forall m:nat. m \le n \to +ex nat (\lambda p. p \le n \land f p = m). + +theorem eq_to_bijn: \forall f,g:nat\to nat. \forall n:nat. +(\forall i:nat. i \le n \to (f i) = (g i)) \to +bijn f n \to bijn g n. +intros 4. +unfold bijn. +intros. +elim (H1 m) +[ apply (ex_intro ? ? a). + rewrite < (H a) + [ assumption + | elim H3. + assumption + ] +| assumption +] +qed. + +theorem bijn_Sn_n: \forall f:nat \to nat. \forall n:nat. +bijn f (S n) \to f (S n) = (S n) \to bijn f n. +unfold bijn. +intros. +elim (H m) +[ elim H3. + apply (ex_intro ? ? a). + split + [ cut (a < S n \lor a = S n) + [ elim Hcut + [ autobatch + (*apply le_S_S_to_le. + assumption*) + | apply False_ind. + apply (not_le_Sn_n n). + rewrite < H1. + rewrite < H6. + rewrite > H5. + assumption + ] + | autobatch + (*apply le_to_or_lt_eq. + assumption*) + ] + | assumption + ] +| autobatch + (*apply le_S. + assumption*) +] +qed. + +theorem bijn_n_Sn: \forall f:nat \to nat. \forall n:nat. +bijn f n \to f (S n) = (S n) \to bijn f (S n). +unfold bijn. +intros. +cut (m < S n \lor m = S n) +[ elim Hcut + [ elim (H m) + [ elim H4. + apply (ex_intro ? ? a). + autobatch + (*split + [ apply le_S. + assumption + | assumption + ]*) + | autobatch + (*apply le_S_S_to_le. + assumption*) + ] + | autobatch + (*apply (ex_intro ? ? (S n)). + split + [ apply le_n + | rewrite > H3. + assumption + ]*) + ] +| autobatch + (*apply le_to_or_lt_eq. + assumption*) +] +qed. + +theorem bijn_fg: \forall f,g:nat\to nat. \forall n:nat. +bijn f n \to bijn g n \to bijn (\lambda p.f(g p)) n. +unfold bijn. +intros. +simplify. +elim (H m) +[ elim H3. + elim (H1 a) + [ elim H6. + autobatch + (*apply (ex_intro ? ? a1). + split + [ assumption + | rewrite > H8. + assumption + ]*) + | assumption + ] +| assumption +] +qed. + +theorem bijn_transpose : \forall n,i,j. i \le n \to j \le n \to +bijn (transpose i j) n. +intros. +unfold bijn. +unfold transpose. +intros. +cut (m = i \lor \lnot m = i) +[ elim Hcut + [ apply (ex_intro ? ? j). + split + [ assumption + | apply (eqb_elim j i) + [ intro. + (*dopo circa 360 secondi l'esecuzione di autobatch in questo punto non era ancora terminata*) + simplify. + autobatch + (*rewrite > H3. + rewrite > H4. + reflexivity*) + | rewrite > (eqb_n_n j). + simplify. + intros. + autobatch + (*apply sym_eq. + assumption*) + ] + ] + | cut (m = j \lor \lnot m = j) + [ elim Hcut1 + [ apply (ex_intro ? ? i). + split + [ assumption + | (*dopo circa 5 minuti, l'esecuzione di autobatch in questo punto non era ancora terminata*) + rewrite > (eqb_n_n i). + autobatch + (*simplify. + apply sym_eq. + assumption*) + ] + | apply (ex_intro ? ? m). + split + [ assumption + | rewrite > (not_eq_to_eqb_false m i) + [ (*dopo circa 5 minuti, l'esecuzione di autobatch in questo punto non era ancora terminata*) + rewrite > (not_eq_to_eqb_false m j) + [ autobatch + (*simplify. + reflexivity*) + | assumption + ] + | assumption + ] + ] + ] + | apply (decidable_eq_nat m j) + ] + ] +| apply (decidable_eq_nat m i) +] +qed. + +theorem bijn_transpose_r: \forall f:nat\to nat.\forall n,i,j. i \le n \to j \le n \to +bijn f n \to bijn (\lambda p.f (transpose i j p)) n. +intros.autobatch. +(*apply (bijn_fg f ?) +[ assumption +| apply (bijn_transpose n i j) + [ assumption + | assumption + ] +]*) +qed. + +theorem bijn_transpose_l: \forall f:nat\to nat.\forall n,i,j. i \le n \to j \le n \to +bijn f n \to bijn (\lambda p.transpose i j (f p)) n. +intros. +autobatch. +(*apply (bijn_fg ? f) +[ apply (bijn_transpose n i j) + [ assumption + | assumption + ] +| assumption +]*) +qed. + +theorem permut_to_bijn: \forall n:nat.\forall f:nat\to nat. +permut f n \to bijn f n. +intro. +elim n +[ unfold bijn. + intros. + apply (ex_intro ? ? m). + split + [ assumption + | apply (le_n_O_elim m ? (\lambda p. f p = p)) + [ assumption + | unfold permut in H. + elim H. + apply sym_eq. + autobatch + (*apply le_n_O_to_eq. + apply H2. + apply le_n*) + ] + ] +| apply (eq_to_bijn (\lambda p. + (transpose (f (S n1)) (S n1)) (transpose (f (S n1)) (S n1) (f p))) f) + [ intros. + apply transpose_transpose + | apply (bijn_fg (transpose (f (S n1)) (S n1))) + [ apply bijn_transpose + [ unfold permut in H1. + elim H1.autobatch + (*apply H2. + apply le_n*) + | apply le_n + ] + | apply bijn_n_Sn + [ apply H. + autobatch + (*apply permut_S_to_permut_transpose. + assumption*) + | autobatch + (*unfold transpose. + rewrite > (eqb_n_n (f (S n1))). + simplify. + reflexivity*) + ] + ] + ] +] +qed. + +let rec invert_permut n f m \def + match eqb m (f n) with + [true \Rightarrow n + |false \Rightarrow + match n with + [O \Rightarrow O + |(S p) \Rightarrow invert_permut p f m]]. + +theorem invert_permut_f: \forall f:nat \to nat. \forall n,m:nat. +m \le n \to injn f n\to invert_permut n f (f m) = m. +intros 4. +elim H +[ apply (nat_case1 m) + [ intro. + simplify. + (*l'applicazione di autobatch in questo punto, dopo alcuni minuti, non aveva ancora dato risultati*) + rewrite > (eqb_n_n (f O)). + autobatch + (*simplify. + reflexivity*) + | intros.simplify. + (*l'applicazione di autobatch in questo punto, dopo alcuni minuti, non aveva ancora dato risultati*) + rewrite > (eqb_n_n (f (S m1))). + autobatch + (*simplify. + reflexivity*) + ] +| simplify. + rewrite > (not_eq_to_eqb_false (f m) (f (S n1))) + [ (*l'applicazione di autobatch in questo punto, dopo parecchi secondi, non aveva ancora prodotto un risultato*) + simplify. + autobatch + (*apply H2. + apply injn_Sn_n. + assumption*) + | unfold Not. + intro. + absurd (m = S n1) + [ apply H3;autobatch + (*[ apply le_S. + assumption + | apply le_n + | assumption + ]*) + | unfold Not. + intro. + apply (not_le_Sn_n n1). + rewrite < H5. + assumption + ] + ] +] +qed. + +theorem injective_invert_permut: \forall f:nat \to nat. \forall n:nat. +permut f n \to injn (invert_permut n f) n. +intros. +unfold injn. +intros. +cut (bijn f n) +[ unfold bijn in Hcut. + generalize in match (Hcut i H1). + intro. + generalize in match (Hcut j H2). + intro. + elim H4. + elim H6. + elim H5. + elim H9. + rewrite < H8. + rewrite < H11. + apply eq_f. + rewrite < (invert_permut_f f n a) + [ rewrite < (invert_permut_f f n a1) + [ rewrite > H8. + rewrite > H11. + assumption + | assumption + | unfold permut in H.elim H. + assumption + ] + | assumption + | unfold permut in H. + elim H. + assumption + ] +| autobatch + (*apply permut_to_bijn. + assumption*) +] +qed. + +theorem permut_invert_permut: \forall f:nat \to nat. \forall n:nat. +permut f n \to permut (invert_permut n f) n. +intros. +unfold permut. +split +[ intros. + simplify. + elim n + [ simplify. + elim (eqb i (f O));autobatch + (*[ simplify. + apply le_n + | simplify. + apply le_n + ]*) + | simplify. + elim (eqb i (f (S n1))) + [ autobatch + (*simplify. + apply le_n*) + | simplify. + autobatch + (*apply le_S. + assumption*) + ] + ] +| autobatch + (*apply injective_invert_permut. + assumption.*) +] +qed. + +theorem f_invert_permut: \forall f:nat \to nat. \forall n,m:nat. +m \le n \to permut f n\to f (invert_permut n f m) = m. +intros. +apply (injective_invert_permut f n H1) +[ unfold permut in H1. + elim H1. + apply H2. + cut (permut (invert_permut n f) n) + [ unfold permut in Hcut. + elim Hcut.autobatch + (*apply H4. + assumption*) + | apply permut_invert_permut. + (*NB qui autobatch non chiude il goal*) + assumption + ] +| assumption +| apply invert_permut_f + [ cut (permut (invert_permut n f) n) + [ unfold permut in Hcut. + elim Hcut. + autobatch + (*apply H2. + assumption*) + | autobatch + (*apply permut_invert_permut. + assumption*) + ] + | unfold permut in H1. + elim H1. + assumption + ] +] +qed. + +theorem permut_n_to_eq_n: \forall h:nat \to nat.\forall n:nat. +permut h n \to (\forall m:nat. m < n \to h m = m) \to h n = n. +intros. +unfold permut in H. +elim H. +cut (invert_permut n h n < n \lor invert_permut n h n = n) +[ elim Hcut + [ rewrite < (f_invert_permut h n n) in \vdash (? ? ? %) + [ apply eq_f. + rewrite < (f_invert_permut h n n) in \vdash (? ? % ?) + [ autobatch + (*apply H1. + assumption*) + | apply le_n + | (*qui autobatch NON chiude il goal*) + assumption + ] + | apply le_n + | (*qui autobatch NON chiude il goal*) + assumption + ] + | rewrite < H4 in \vdash (? ? % ?). + apply (f_invert_permut h) + [ apply le_n + | (*qui autobatch NON chiude il goal*) + assumption + ] + ] +| apply le_to_or_lt_eq. + cut (permut (invert_permut n h) n) + [ unfold permut in Hcut. + elim Hcut. + autobatch + (*apply H4. + apply le_n*) + | apply permut_invert_permut. + (*NB aui autobatch non chiude il goal*) + assumption + ] +] +qed. + +theorem permut_n_to_le: \forall h:nat \to nat.\forall k,n:nat. +k \le n \to permut h n \to (\forall m:nat. m < k \to h m = m) \to +\forall j. k \le j \to j \le n \to k \le h j. +intros. +unfold permut in H1. +elim H1. +cut (h j < k \lor \not(h j < k)) +[ elim Hcut + [ absurd (k \le j) + [ assumption + | apply lt_to_not_le. + cut (h j = j) + [ rewrite < Hcut1. + assumption + | apply H6;autobatch + (*[ apply H5. + assumption + | assumption + | apply H2. + assumption + ]*) + ] + ] + | autobatch + (*apply not_lt_to_le. + assumption*) + ] +| apply (decidable_lt (h j) k) +] +qed. + +(* applications *) + +let rec map_iter_i k (g:nat \to nat) f (i:nat) \def + match k with + [ O \Rightarrow g i + | (S k) \Rightarrow f (g (S (k+i))) (map_iter_i k g f i)]. + +theorem eq_map_iter_i: \forall g1,g2:nat \to nat. +\forall f:nat \to nat \to nat. \forall n,i:nat. +(\forall m:nat. i\le m \to m \le n+i \to g1 m = g2 m) \to +map_iter_i n g1 f i = map_iter_i n g2 f i. +intros 5. +elim n +[ simplify. + autobatch + (*apply H + [ apply le_n + | apply le_n + ]*) +| simplify. + apply eq_f2 + [ autobatch + (*apply H1 + [ simplify. + apply le_S. + apply le_plus_n + | simplify. + apply le_n + ]*) + | apply H. + intros. + apply H1;autobatch + (*[ assumption + | simplify. + apply le_S. + assumption + ]*) + ] +] +qed. + +(* map_iter examples *) + +theorem eq_map_iter_i_sigma: \forall g:nat \to nat. \forall n,m:nat. +map_iter_i n g plus m = sigma n g m. +intros. +elim n +[ autobatch + (*simplify. + reflexivity*) +| simplify. + autobatch + (*apply eq_f. + assumption*) +] +qed. + +theorem eq_map_iter_i_pi: \forall g:nat \to nat. \forall n,m:nat. +map_iter_i n g times m = pi n g m. +intros. +elim n +[ autobatch + (*simplify. + reflexivity*) +| simplify. + autobatch + (*apply eq_f. + assumption*) +] +qed. + +theorem eq_map_iter_i_fact: \forall n:nat. +map_iter_i n (\lambda m.m) times (S O) = (S n)!. +intros. +elim n +[ autobatch + (*simplify. + reflexivity*) +| change with + (((S n1)+(S O))*(map_iter_i n1 (\lambda m.m) times (S O)) = (S(S n1))*(S n1)!). + rewrite < plus_n_Sm. + rewrite < plus_n_O. + apply eq_f. + (*NB: qui autobatch non chiude il goal!!!*) + assumption +] +qed. + + +theorem eq_map_iter_i_transpose_l : \forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall g:nat \to nat. \forall n,k:nat. +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose (k+n) (S k+n) m)) f n. +intros. +apply (nat_case1 k) +[ intros. + simplify. + fold simplify (transpose n (S n) (S n)). + autobatch + (*rewrite > transpose_i_j_i. + rewrite > transpose_i_j_j. + apply H1*) +| intros. + change with + (f (g (S (S (m+n)))) (f (g (S (m+n))) (map_iter_i m g f n)) = + f (g (transpose (S m + n) (S (S m) + n) (S (S m)+n))) + (f (g (transpose (S m + n) (S (S m) + n) (S m+n))) + (map_iter_i m (\lambda m1. g (transpose (S m+n) (S (S m)+n) m1)) f n))). + rewrite > transpose_i_j_i. + rewrite > transpose_i_j_j. + rewrite < H. + rewrite < H. + rewrite < (H1 (g (S m + n))). + apply eq_f. + apply eq_map_iter_i. + intros. + simplify. + unfold transpose. + rewrite > (not_eq_to_eqb_false m1 (S m+n)) + [ rewrite > (not_eq_to_eqb_false m1 (S (S m)+n)) + [ autobatch + (*simplify. + reflexivity*) + | apply (lt_to_not_eq m1 (S ((S m)+n))). + autobatch + (*unfold lt. + apply le_S_S. + change with (m1 \leq S (m+n)). + apply le_S. + assumption*) + ] + | apply (lt_to_not_eq m1 (S m+n)). + simplify.autobatch + (*unfold lt. + apply le_S_S. + assumption*) + ] +] +qed. + +theorem eq_map_iter_i_transpose_i_Si : \forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall g:nat \to nat. \forall n,k,i:nat. n \le i \to i \le k+n \to +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose i (S i) m)) f n. +intros 6. +elim k +[ cut (i=n) + [ rewrite > Hcut. + (*qui autobatch non chiude il goal*) + apply (eq_map_iter_i_transpose_l f H H1 g n O) + | apply antisymmetric_le + [ assumption + | assumption + ] + ] +| cut (i < S n1 + n \lor i = S n1 + n) + [ elim Hcut + [ change with + (f (g (S (S n1)+n)) (map_iter_i (S n1) g f n) = + f (g (transpose i (S i) (S (S n1)+n))) (map_iter_i (S n1) (\lambda m. g (transpose i (S i) m)) f n)). + apply eq_f2 + [ unfold transpose. + rewrite > (not_eq_to_eqb_false (S (S n1)+n) i) + [ rewrite > (not_eq_to_eqb_false (S (S n1)+n) (S i)) + [ autobatch + (*simplify. + reflexivity*) + | simplify. + unfold Not. + intro. + apply (lt_to_not_eq i (S n1+n)) + [ assumption + | autobatch + (*apply inj_S. + apply sym_eq. + assumption*) + ] + ] + | simplify. + unfold Not. + intro. + apply (lt_to_not_eq i (S (S n1+n))) + [ autobatch + (*simplify. + unfold lt. + apply le_S_S. + assumption*) + | autobatch + (*apply sym_eq. + assumption*) + ] + ] + | apply H2;autobatch + (*[ assumption + | apply le_S_S_to_le. + assumption + ]*) + ] + | rewrite > H5. + (*qui autobatch non chiude il goal*) + apply (eq_map_iter_i_transpose_l f H H1 g n (S n1)). + ] + | autobatch + (*apply le_to_or_lt_eq. + assumption*) + ] +] +qed. + +theorem eq_map_iter_i_transpose: +\forall f:nat\to nat \to nat. +associative nat f \to symmetric2 nat nat f \to \forall n,k,o:nat. +\forall g:nat \to nat. \forall i:nat. n \le i \to S (o + i) \le S k+n \to +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose i (S(o + i)) m)) f n. +intros 6. +apply (nat_elim1 o). +intro. +apply (nat_case m ?) +[ intros. + apply (eq_map_iter_i_transpose_i_Si ? H H1);autobatch + (*[ exact H3 + | apply le_S_S_to_le. + assumption + ]*) +| intros. + apply (trans_eq ? ? (map_iter_i (S k) (\lambda m. g (transpose i (S(m1 + i)) m)) f n)) + [ apply H2 + [ autobatch + (*unfold lt. + apply le_n*) + | assumption + | apply (trans_le ? (S(S (m1+i)))) + [ autobatch + (*apply le_S. + apply le_n*) + | (*qui autobatch non chiude il goal, chiuso invece da assumption*) + assumption + ] + ] + | apply (trans_eq ? ? (map_iter_i (S k) (\lambda m. g + (transpose i (S(m1 + i)) (transpose (S(m1 + i)) (S(S(m1 + i))) m))) f n)) + [ (*qui autobatch dopo alcuni minuti non aveva ancora terminato la propria esecuzione*) + apply (H2 O ? ? (S(m1+i))) + [ autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | autobatch + (*apply (trans_le ? i) + [ assumption + | change with (i \le (S m1)+i). + apply le_plus_n + ]*) + | (*qui autobatch non chiude il goal*) + exact H4 + ] + | apply (trans_eq ? ? (map_iter_i (S k) (\lambda m. g + (transpose i (S(m1 + i)) + (transpose (S(m1 + i)) (S(S(m1 + i))) + (transpose i (S(m1 + i)) m)))) f n)) + [ (*qui autobatch dopo alcuni minuti non aveva ancora terminato la propria esecuzione*) + apply (H2 m1) + [ autobatch + (*unfold lt. + apply le_n*) + | assumption + | apply (trans_le ? (S(S (m1+i)))) + [ autobatch + (*apply le_S. + apply le_n*) + | (*qui autobatch NON CHIUDE il goal*) + assumption + ] + ] + | apply eq_map_iter_i. + intros. + apply eq_f. + apply sym_eq. + apply eq_transpose + [ unfold Not. + intro. + apply (not_le_Sn_n i). + rewrite < H7 in \vdash (? ? %). + autobatch + (*apply le_S_S. + apply le_S. + apply le_plus_n*) + | unfold Not. + intro. + apply (not_le_Sn_n i). + rewrite > H7 in \vdash (? ? %). + autobatch + (*apply le_S_S. + apply le_plus_n*) + | unfold Not. + intro. + autobatch + (*apply (not_eq_n_Sn (S m1+i)). + apply sym_eq. + assumption*) + ] + ] + ] + ] +] +qed. + +theorem eq_map_iter_i_transpose1: \forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall n,k,i,j:nat. +\forall g:nat \to nat. n \le i \to i < j \to j \le S k+n \to +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose i j m)) f n. +intros. +simplify in H3. +cut ((S i) < j \lor (S i) = j) +[ elim Hcut + [ cut (j = S ((j - (S i)) + i)) + [ rewrite > Hcut1. + apply (eq_map_iter_i_transpose f H H1 n k (j - (S i)) g i) + [ assumption + | rewrite < Hcut1. + assumption + ] + | rewrite > plus_n_Sm. + autobatch + (*apply plus_minus_m_m. + apply lt_to_le. + assumption*) + ] + | rewrite < H5. + apply (eq_map_iter_i_transpose_i_Si f H H1 g) + [ autobatch + (*simplify. + assumption*) + | apply le_S_S_to_le. + autobatch + (*apply (trans_le ? j) + [ assumption + | assumption + ]*) + ] + ] +| autobatch + (*apply le_to_or_lt_eq. + assumption*) +] +qed. + +theorem eq_map_iter_i_transpose2: \forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall n,k,i,j:nat. +\forall g:nat \to nat. n \le i \to i \le (S k+n) \to n \le j \to j \le (S k+n) \to +map_iter_i (S k) g f n = map_iter_i (S k) (\lambda m. g (transpose i j m)) f n. +intros. +apply (nat_compare_elim i j) +[ intro. + (*qui autobatch non chiude il goal*) + apply (eq_map_iter_i_transpose1 f H H1 n k i j g H2 H6 H5) +| intro. + rewrite > H6. + apply eq_map_iter_i. + intros. + autobatch + (*rewrite > (transpose_i_i j). + reflexivity*) +| intro. + apply (trans_eq ? ? (map_iter_i (S k) (\lambda m:nat.g (transpose j i m)) f n)) + [ apply (eq_map_iter_i_transpose1 f H H1 n k j i g H4 H6 H3) + | apply eq_map_iter_i. + intros. + autobatch + (*apply eq_f. + apply transpose_i_j_j_i*) + ] +] +qed. + +theorem permut_to_eq_map_iter_i:\forall f:nat\to nat \to nat.associative nat f \to +symmetric2 nat nat f \to \forall k,n:nat.\forall g,h:nat \to nat. +permut h (k+n) \to (\forall m:nat. m \lt n \to h m = m) \to +map_iter_i k g f n = map_iter_i k (\lambda m.g(h m)) f n. +intros 4. +elim k +[ simplify. + rewrite > (permut_n_to_eq_n h) + [ reflexivity + | (*qui autobatch non chiude il goal*) + assumption + | (*qui autobatch non chiude il goal*) + assumption + ] +| apply (trans_eq ? ? (map_iter_i (S n) (\lambda m.g ((transpose (h (S n+n1)) (S n+n1)) m)) f n1)) + [ unfold permut in H3. + elim H3. + apply (eq_map_iter_i_transpose2 f H H1 n1 n ? ? g) + [ apply (permut_n_to_le h n1 (S n+n1)) + [ apply le_plus_n + | (*qui autobatch non chiude il goal*) + assumption + | (*qui autobatch non chiude il goal*) + assumption + | apply le_plus_n + | apply le_n + ] + | autobatch + (*apply H5. + apply le_n*) + | apply le_plus_n + | apply le_n + ] + | apply (trans_eq ? ? (map_iter_i (S n) (\lambda m. + (g(transpose (h (S n+n1)) (S n+n1) + (transpose (h (S n+n1)) (S n+n1) (h m)))) )f n1)) + [ simplify. + fold simplify (transpose (h (S n+n1)) (S n+n1) (S n+n1)). + apply eq_f2 + [ autobatch + (*apply eq_f. + rewrite > transpose_i_j_j. + rewrite > transpose_i_j_i. + rewrite > transpose_i_j_j. + reflexivity.*) + | apply (H2 n1 (\lambda m.(g(transpose (h (S n+n1)) (S n+n1) m)))) + [ apply permut_S_to_permut_transpose. + (*qui autobatch non chiude il goal*) + assumption + | intros. + unfold transpose. + rewrite > (not_eq_to_eqb_false (h m) (h (S n+n1))) + [ rewrite > (not_eq_to_eqb_false (h m) (S n+n1)) + [ simplify. + autobatch + (*apply H4. + assumption*) + | rewrite > H4 + [ autobatch + (*apply lt_to_not_eq. + apply (trans_lt ? n1) + [ assumption + | simplify. + unfold lt. + apply le_S_S. + apply le_plus_n + ]*) + | assumption + ] + ] + | unfold permut in H3. + elim H3. + simplify. + unfold Not. + intro. + apply (lt_to_not_eq m (S n+n1)) + [ autobatch + (*apply (trans_lt ? n1) + [ assumption + | simplify. + unfold lt. + apply le_S_S. + apply le_plus_n + ]*) + | unfold injn in H7. + apply (H7 m (S n+n1)) + [ autobatch + (*apply (trans_le ? n1) + [ apply lt_to_le. + assumption + | apply le_plus_n + ]*) + | apply le_n + | assumption + ] + ] + ] + ] + ] + | apply eq_map_iter_i. + intros. + autobatch + (*rewrite > transpose_transpose. + reflexivity*) + ] + ] +] +qed. \ No newline at end of file diff --git a/matita/library_auto/auto/nat/plus.ma b/matita/library_auto/auto/nat/plus.ma new file mode 100644 index 000000000..59259ca68 --- /dev/null +++ b/matita/library_auto/auto/nat/plus.ma @@ -0,0 +1,97 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/plus". + +include "auto/nat/nat.ma". + +let rec plus n m \def + match n with + [ O \Rightarrow m + | (S p) \Rightarrow S (plus p m) ]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural plus" 'plus x y = (cic:/matita/library_autobatch/nat/plus/plus.con x y). + +theorem plus_n_O: \forall n:nat. n = n+O. +intros.elim n +[ autobatch + (*simplify. + reflexivity*) +| autobatch + (*simplify. + apply eq_f. + assumption.*) +] +qed. + +theorem plus_n_Sm : \forall n,m:nat. S (n+m) = n+(S m). +intros.elim n +[ autobatch + (*simplify. + reflexivity.*) +| simplify. + autobatch + (* + apply eq_f. + assumption.*)] +qed. + +theorem sym_plus: \forall n,m:nat. n+m = m+n. +intros.elim n +[ autobatch + (*simplify. + apply plus_n_O.*) +| simplify. + autobatch + (*rewrite > H. + apply plus_n_Sm.*)] +qed. + +theorem associative_plus : associative nat plus. +unfold associative.intros.elim x +[autobatch + (*simplify. + reflexivity.*) +|simplify. + autobatch + (*apply eq_f. + assumption.*) +] +qed. + +theorem assoc_plus : \forall n,m,p:nat. (n+m)+p = n+(m+p) +\def associative_plus. + +theorem injective_plus_r: \forall n:nat.injective nat nat (\lambda m.n+m). +intro.simplify.intros 2.elim n +[ exact H +| autobatch + (*apply H.apply inj_S.apply H1.*) +] +qed. + +theorem inj_plus_r: \forall p,n,m:nat. p+n = p+m \to n=m +\def injective_plus_r. + +theorem injective_plus_l: \forall m:nat.injective nat nat (\lambda n.n+m). +intro.simplify.intros.autobatch. +(*apply (injective_plus_r m). +rewrite < sym_plus. +rewrite < (sym_plus y). +assumption.*) +qed. + +theorem inj_plus_l: \forall p,n,m:nat. n+p = m+p \to n=m +\def injective_plus_l. diff --git a/matita/library_auto/auto/nat/primes.ma b/matita/library_auto/auto/nat/primes.ma new file mode 100644 index 000000000..21d752f71 --- /dev/null +++ b/matita/library_auto/auto/nat/primes.ma @@ -0,0 +1,999 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/primes". + +include "auto/nat/div_and_mod.ma". +include "auto/nat/minimization.ma". +include "auto/nat/sigma_and_pi.ma". +include "auto/nat/factorial.ma". + +inductive divides (n,m:nat) : Prop \def +witness : \forall p:nat.m = times n p \to divides n m. + +interpretation "divides" 'divides n m = (cic:/matita/library_autobatch/nat/primes/divides.ind#xpointer(1/1) n m). +interpretation "not divides" 'ndivides n m = + (cic:/matita/logic/connectives/Not.con (cic:/matita/library_autobatch/nat/primes/divides.ind#xpointer(1/1) n m)). + +theorem reflexive_divides : reflexive nat divides. +unfold reflexive. +intros. +exact (witness x x (S O) (times_n_SO x)). +qed. + +theorem divides_to_div_mod_spec : +\forall n,m. O < n \to n \divides m \to div_mod_spec m n (m / n) O. +intros. +elim H1. +rewrite > H2. +constructor 1 +[ assumption +| apply (lt_O_n_elim n H). + intros. + autobatch + (*rewrite < plus_n_O. + rewrite > div_times. + apply sym_times*) +] +qed. + +theorem div_mod_spec_to_divides : +\forall n,m,p. div_mod_spec m n p O \to n \divides m. +intros. +elim H. +autobatch. +(*apply (witness n m p). +rewrite < sym_times. +rewrite > (plus_n_O (p*n)). +assumption*) +qed. + +theorem divides_to_mod_O: +\forall n,m. O < n \to n \divides m \to (m \mod n) = O. +intros. +apply (div_mod_spec_to_eq2 m n (m / n) (m \mod n) (m / n) O) +[ autobatch + (*apply div_mod_spec_div_mod. + assumption*) +| autobatch + (*apply divides_to_div_mod_spec;assumption*) +] +qed. + +theorem mod_O_to_divides: +\forall n,m. O< n \to (m \mod n) = O \to n \divides m. +intros. +apply (witness n m (m / n)). +rewrite > (plus_n_O (n * (m / n))). +rewrite < H1. +rewrite < sym_times. +autobatch. +(* Andrea: perche' hint non lo trova ?*) +(*apply div_mod. +assumption.*) +qed. + +theorem divides_n_O: \forall n:nat. n \divides O. +intro. +autobatch. +(*apply (witness n O O). +apply times_n_O.*) +qed. + +theorem divides_n_n: \forall n:nat. n \divides n. +autobatch. +(*intro. +apply (witness n n (S O)). +apply times_n_SO.*) +qed. + +theorem divides_SO_n: \forall n:nat. (S O) \divides n. +intro. +autobatch. +(*apply (witness (S O) n n). +simplify. +apply plus_n_O.*) +qed. + +theorem divides_plus: \forall n,p,q:nat. +n \divides p \to n \divides q \to n \divides p+q. +intros. +elim H. +elim H1. +apply (witness n (p+q) (n2+n1)). +autobatch. +(*rewrite > H2. +rewrite > H3. +apply sym_eq. +apply distr_times_plus.*) +qed. + +theorem divides_minus: \forall n,p,q:nat. +divides n p \to divides n q \to divides n (p-q). +intros. +elim H. +elim H1. +apply (witness n (p-q) (n2-n1)). +autobatch. +(*rewrite > H2. +rewrite > H3. +apply sym_eq. +apply distr_times_minus.*) +qed. + +theorem divides_times: \forall n,m,p,q:nat. +n \divides p \to m \divides q \to n*m \divides p*q. +intros. +elim H. +elim H1. +apply (witness (n*m) (p*q) (n2*n1)). +rewrite > H2. +rewrite > H3. +apply (trans_eq nat ? (n*(m*(n2*n1)))) +[ apply (trans_eq nat ? (n*(n2*(m*n1)))) + [ apply assoc_times + | apply eq_f. + apply (trans_eq nat ? ((n2*m)*n1)) + [ autobatch + (*apply sym_eq. + apply assoc_times*) + | rewrite > (sym_times n2 m). + apply assoc_times + ] + ] +| autobatch + (*apply sym_eq. + apply assoc_times*) +] +qed. + +theorem transitive_divides: transitive ? divides. +unfold. +intros. +elim H. +elim H1. +apply (witness x z (n2*n)). +autobatch. +(*rewrite > H3. +rewrite > H2. +apply assoc_times.*) +qed. + +variant trans_divides: \forall n,m,p. + n \divides m \to m \divides p \to n \divides p \def transitive_divides. + +theorem eq_mod_to_divides:\forall n,m,p. O< p \to +mod n p = mod m p \to divides p (n-m). +intros. +cut (n \le m \or \not n \le m) +[ elim Hcut + [ cut (n-m=O) + [ autobatch + (*rewrite > Hcut1. + apply (witness p O O). + apply times_n_O*) + | autobatch + (*apply eq_minus_n_m_O. + assumption*) + ] + | apply (witness p (n-m) ((div n p)-(div m p))). + rewrite > distr_times_minus. + rewrite > sym_times. + rewrite > (sym_times p). + cut ((div n p)*p = n - (mod n p)) + [ rewrite > Hcut1. + rewrite > eq_minus_minus_minus_plus. + rewrite > sym_plus. + rewrite > H1. + autobatch + (*rewrite < div_mod + [ reflexivity + | assumption + ]*) + | apply sym_eq. + apply plus_to_minus. + rewrite > sym_plus. + autobatch + (*apply div_mod. + assumption*) + ] + ] +| apply (decidable_le n m) +] +qed. + +theorem antisymmetric_divides: antisymmetric nat divides. +unfold antisymmetric. +intros. +elim H. +elim H1. +apply (nat_case1 n2) +[ intro. + rewrite > H3. + rewrite > H2. + rewrite > H4. + rewrite < times_n_O. + reflexivity +| intros. + apply (nat_case1 n) + [ intro. + rewrite > H2. + rewrite > H3. + rewrite > H5. + autobatch + (*rewrite < times_n_O. + reflexivity*) + | intros. + apply antisymmetric_le + [ rewrite > H2. + rewrite > times_n_SO in \vdash (? % ?). + apply le_times_r. + rewrite > H4. + autobatch + (*apply le_S_S. + apply le_O_n*) + | rewrite > H3. + rewrite > times_n_SO in \vdash (? % ?). + apply le_times_r. + rewrite > H5. + autobatch + (*apply le_S_S. + apply le_O_n*) + ] + ] +] +qed. + +(* divides le *) +theorem divides_to_le : \forall n,m. O < m \to n \divides m \to n \le m. +intros. +elim H1. +rewrite > H2. +cut (O < n2) +[ apply (lt_O_n_elim n2 Hcut). + intro. + autobatch + (*rewrite < sym_times. + simplify. + rewrite < sym_plus. + apply le_plus_n*) +| elim (le_to_or_lt_eq O n2) + [ assumption + | absurd (O H2. + rewrite < H3. + rewrite < times_n_O. + apply (not_le_Sn_n O) + ] + | apply le_O_n + ] +] +qed. + +theorem divides_to_lt_O : \forall n,m. O < m \to n \divides m \to O < n. +intros. +elim H1. +elim (le_to_or_lt_eq O n (le_O_n n)) +[ assumption +| rewrite < H3. + absurd (O < m) + [ assumption + | rewrite > H2. + rewrite < H3. + autobatch + (*simplify. + exact (not_le_Sn_n O)*) + ] +] +qed. + +(* boolean divides *) +definition divides_b : nat \to nat \to bool \def +\lambda n,m :nat. (eqb (m \mod n) O). + +theorem divides_b_to_Prop : +\forall n,m:nat. O < n \to +match divides_b n m with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m]. +intros. +unfold divides_b. +apply eqb_elim +[ intro. + simplify. + autobatch + (*apply mod_O_to_divides;assumption*) +| intro. + simplify. + unfold Not. + intro. + autobatch + (*apply H1. + apply divides_to_mod_O;assumption*) +] +qed. + +theorem divides_b_true_to_divides : +\forall n,m:nat. O < n \to +(divides_b n m = true ) \to n \divides m. +intros. +change with +match true with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m]. +rewrite < H1. +apply divides_b_to_Prop. +assumption. +qed. + +theorem divides_b_false_to_not_divides : +\forall n,m:nat. O < n \to +(divides_b n m = false ) \to n \ndivides m. +intros. +change with +match false with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m]. +rewrite < H1. +apply divides_b_to_Prop. +assumption. +qed. + +theorem decidable_divides: \forall n,m:nat.O < n \to +decidable (n \divides m). +intros. +unfold decidable. +cut +(match divides_b n m with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m] \to n \divides m \lor n \ndivides m) +[ apply Hcut. + apply divides_b_to_Prop. + assumption +| elim (divides_b n m) + [ left. + (*qui autobatch non chiude il goal, chiuso dalla sola apply H1*) + apply H1 + | right. + (*qui autobatch non chiude il goal, chiuso dalla sola apply H1*) + apply H1 + ] +] +qed. + +theorem divides_to_divides_b_true : \forall n,m:nat. O < n \to +n \divides m \to divides_b n m = true. +intros. +cut (match (divides_b n m) with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m] \to ((divides_b n m) = true)) +[ apply Hcut. + apply divides_b_to_Prop. + assumption +| elim (divides_b n m) + [ reflexivity + | absurd (n \divides m) + [ assumption + | (*qui autobatch non chiude il goal, chiuso dalla sola applicazione di assumption*) + assumption + ] + ] +] +qed. + +theorem not_divides_to_divides_b_false: \forall n,m:nat. O < n \to +\lnot(n \divides m) \to (divides_b n m) = false. +intros. +cut (match (divides_b n m) with +[ true \Rightarrow n \divides m +| false \Rightarrow n \ndivides m] \to ((divides_b n m) = false)) +[ apply Hcut. + apply divides_b_to_Prop. + assumption +| elim (divides_b n m) + [ absurd (n \divides m) + [ (*qui autobatch non chiude il goal, chiuso dalla sola tattica assumption*) + assumption + | assumption + ] + | reflexivity + ] +] +qed. + +(* divides and pi *) +theorem divides_f_pi_f : \forall f:nat \to nat.\forall n,m,i:nat. +m \le i \to i \le n+m \to f i \divides pi n f m. +intros 5. +elim n +[ simplify. + cut (i = m) + [ autobatch + (*rewrite < Hcut. + apply divides_n_n*) + | apply antisymmetric_le + [ assumption + | assumption + ] + ] +| simplify. + cut (i < S n1+m \lor i = S n1 + m) + [ elim Hcut + [ apply (transitive_divides ? (pi n1 f m)) + [ apply H1. + autobatch + (*apply le_S_S_to_le. + assumption*) + | autobatch + (*apply (witness ? ? (f (S n1+m))). + apply sym_times*) + ] + | autobatch + (*rewrite > H3. + apply (witness ? ? (pi n1 f m)). + reflexivity*) + ] + | autobatch + (*apply le_to_or_lt_eq. + assumption*) + ] +] +qed. + +(* +theorem mod_S_pi: \forall f:nat \to nat.\forall n,i:nat. +i < n \to (S O) < (f i) \to (S (pi n f)) \mod (f i) = (S O). +intros.cut (pi n f) \mod (f i) = O. +rewrite < Hcut. +apply mod_S.apply trans_lt O (S O).apply le_n (S O).assumption. +rewrite > Hcut.assumption. +apply divides_to_mod_O.apply trans_lt O (S O).apply le_n (S O).assumption. +apply divides_f_pi_f.assumption. +qed. +*) + +(* divides and fact *) +theorem divides_fact : \forall n,i:nat. +O < i \to i \le n \to i \divides n!. +intros 3. +elim n +[ absurd (O H3. + apply (witness ? ? n1!). + reflexivity*) + ] +] +qed. + +theorem mod_S_fact: \forall n,i:nat. +(S O) < i \to i \le n \to (S n!) \mod i = (S O). +intros. +cut (n! \mod i = O) +[ rewrite < Hcut. + apply mod_S + [ autobatch + (*apply (trans_lt O (S O)) + [ apply (le_n (S O)) + | assumption + ]*) + | rewrite > Hcut. + assumption + ] +| autobatch(* + apply divides_to_mod_O + [ apply ltn_to_ltO [| apply H] + | apply divides_fact + [ apply ltn_to_ltO [| apply H] + | assumption + ] + ]*) +] +qed. + +theorem not_divides_S_fact: \forall n,i:nat. +(S O) < i \to i \le n \to i \ndivides S n!. +intros. +apply divides_b_false_to_not_divides +[ autobatch + (*apply (trans_lt O (S O)) + [ apply (le_n (S O)) + | assumption + ]*) +| unfold divides_b. + rewrite > mod_S_fact;autobatch + (*[ simplify. + reflexivity + | assumption + | assumption + ]*) +] +qed. + +(* prime *) +definition prime : nat \to Prop \def +\lambda n:nat. (S O) < n \land +(\forall m:nat. m \divides n \to (S O) < m \to m = n). + +theorem not_prime_O: \lnot (prime O). +unfold Not. +unfold prime. +intro. +elim H. +apply (not_le_Sn_O (S O) H1). +qed. + +theorem not_prime_SO: \lnot (prime (S O)). +unfold Not. +unfold prime. +intro. +elim H. +apply (not_le_Sn_n (S O) H1). +qed. + +(* smallest factor *) +definition smallest_factor : nat \to nat \def +\lambda n:nat. +match n with +[ O \Rightarrow O +| (S p) \Rightarrow + match p with + [ O \Rightarrow (S O) + | (S q) \Rightarrow min_aux q (S(S q)) (\lambda m.(eqb ((S(S q)) \mod m) O))]]. + +(* it works ! +theorem example1 : smallest_prime_factor (S(S(S O))) = (S(S(S O))). +normalize.reflexivity. +qed. + +theorem example2: smallest_prime_factor (S(S(S(S O)))) = (S(S O)). +normalize.reflexivity. +qed. + +theorem example3 : smallest_prime_factor (S(S(S(S(S(S(S O))))))) = (S(S(S(S(S(S(S O))))))). +simplify.reflexivity. +qed. *) + +theorem lt_SO_smallest_factor: +\forall n:nat. (S O) < n \to (S O) < (smallest_factor n). +intro. +apply (nat_case n) +[ autobatch + (*intro. + apply False_ind. + apply (not_le_Sn_O (S O) H)*) +| intro. + apply (nat_case m) + [ autobatch + (*intro. apply False_ind. + apply (not_le_Sn_n (S O) H)*) + | intros. + change with + (S O < min_aux m1 (S(S m1)) (\lambda m.(eqb ((S(S m1)) \mod m) O))). + apply (lt_to_le_to_lt ? (S (S O))) + [ apply (le_n (S(S O))) + | cut ((S(S O)) = (S(S m1)) - m1) + [ rewrite > Hcut. + apply le_min_aux + | apply sym_eq. + apply plus_to_minus. + autobatch + (*rewrite < sym_plus. + simplify. + reflexivity*) + ] + ] + ] +] +qed. + +theorem lt_O_smallest_factor: \forall n:nat. O < n \to O < (smallest_factor n). +intro. +apply (nat_case n) +[ autobatch + (*intro. + apply False_ind. + apply (not_le_Sn_n O H)*) +| intro. + apply (nat_case m) + [ autobatch + (*intro. + simplify. + unfold lt. + apply le_n*) + | intros. + apply (trans_lt ? (S O)) + [ autobatch + (*unfold lt. + apply le_n*) + | apply lt_SO_smallest_factor. + unfold lt.autobatch + (*apply le_S_S. + apply le_S_S. + apply le_O_n*) + ] + ] +] +qed. + +theorem divides_smallest_factor_n : +\forall n:nat. O < n \to smallest_factor n \divides n. +intro. +apply (nat_case n) +[ intro. + autobatch + (*apply False_ind. + apply (not_le_Sn_O O H)*) +| intro. + apply (nat_case m) + [ intro. + autobatch + (*simplify. + apply (witness ? ? (S O)). + simplify. + reflexivity*) + | intros. + apply divides_b_true_to_divides + [ apply (lt_O_smallest_factor ? H) + | change with + (eqb ((S(S m1)) \mod (min_aux m1 (S(S m1)) + (\lambda m.(eqb ((S(S m1)) \mod m) O)))) O = true). + apply f_min_aux_true. + apply (ex_intro nat ? (S(S m1))). + split + [ autobatch + (*split + [ apply le_minus_m + | apply le_n + ]*) + | autobatch + (*rewrite > mod_n_n + [ reflexivity + | apply (trans_lt ? (S O)) + [ apply (le_n (S O)) + | unfold lt. + apply le_S_S. + apply le_S_S. + apply le_O_n + ] + ]*) + ] + ] + ] +] +qed. + +theorem le_smallest_factor_n : +\forall n:nat. smallest_factor n \le n. +intro. +apply (nat_case n) +[ autobatch + (*simplify. + apply le_n*) +| intro. + autobatch + (*apply (nat_case m) + [ simplify. + apply le_n + | intro. + apply divides_to_le + [ unfold lt. + apply le_S_S. + apply le_O_n + | apply divides_smallest_factor_n. + unfold lt. + apply le_S_S. + apply le_O_n + ] + ]*) +] +qed. + +theorem lt_smallest_factor_to_not_divides: \forall n,i:nat. +(S O) < n \to (S O) < i \to i < (smallest_factor n) \to i \ndivides n. +intros 2. +apply (nat_case n) +[ intro. + apply False_ind. + apply (not_le_Sn_O (S O) H) +| intro. + apply (nat_case m) + [ intro. + apply False_ind. + apply (not_le_Sn_n (S O) H) + | intros. + apply divides_b_false_to_not_divides + [ autobatch + (*apply (trans_lt O (S O)) + [ apply (le_n (S O)) + | assumption + ]*) + | unfold divides_b. + apply (lt_min_aux_to_false + (\lambda i:nat.eqb ((S(S m1)) \mod i) O) (S(S m1)) m1 i) + [ cut ((S(S O)) = (S(S m1)-m1)) + [ rewrite < Hcut. + exact H1 + | apply sym_eq. + apply plus_to_minus. + autobatch + (*rewrite < sym_plus. + simplify. + reflexivity*) + ] + | exact H2 + ] + ] + ] +] +qed. + +theorem prime_smallest_factor_n : +\forall n:nat. (S O) < n \to prime (smallest_factor n). +intro. +change with ((S(S O)) \le n \to (S O) < (smallest_factor n) \land +(\forall m:nat. m \divides smallest_factor n \to (S O) < m \to m = (smallest_factor n))). +intro. +split +[ apply lt_SO_smallest_factor. + assumption +| intros. + cut (le m (smallest_factor n)) + [ elim (le_to_or_lt_eq m (smallest_factor n) Hcut) + [ absurd (m \divides n) + [ apply (transitive_divides m (smallest_factor n)) + [ assumption + | apply divides_smallest_factor_n. + autobatch + (*apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | exact H + ]*) + ] + | apply lt_smallest_factor_to_not_divides;autobatch + (*[ exact H + | assumption + | assumption + ]*) + ] + | assumption + ] + | apply divides_to_le + [ apply (trans_lt O (S O)) + [ apply (le_n (S O)) + | apply lt_SO_smallest_factor. + exact H + ] + | assumption + ] + ] +] +qed. + +theorem prime_to_smallest_factor: \forall n. prime n \to +smallest_factor n = n. +intro. +apply (nat_case n) +[ intro. + autobatch + (*apply False_ind. + apply (not_prime_O H)*) +| intro. + apply (nat_case m) + [ intro. + autobatch + (*apply False_ind. + apply (not_prime_SO H)*) + | intro. + change with + ((S O) < (S(S m1)) \land + (\forall m:nat. m \divides S(S m1) \to (S O) < m \to m = (S(S m1))) \to + smallest_factor (S(S m1)) = (S(S m1))). + intro. + elim H. + autobatch + (*apply H2 + [ apply divides_smallest_factor_n. + apply (trans_lt ? (S O)) + [ unfold lt. + apply le_n + | assumption + ] + | apply lt_SO_smallest_factor. + assumption + ]*) + ] +] +qed. + +(* a number n > O is prime iff its smallest factor is n *) +definition primeb \def \lambda n:nat. +match n with +[ O \Rightarrow false +| (S p) \Rightarrow + match p with + [ O \Rightarrow false + | (S q) \Rightarrow eqb (smallest_factor (S(S q))) (S(S q))]]. + +(* it works! +theorem example4 : primeb (S(S(S O))) = true. +normalize.reflexivity. +qed. + +theorem example5 : primeb (S(S(S(S(S(S O)))))) = false. +normalize.reflexivity. +qed. + +theorem example6 : primeb (S(S(S(S((S(S(S(S(S(S(S O)))))))))))) = true. +normalize.reflexivity. +qed. + +theorem example7 : primeb (S(S(S(S(S(S((S(S(S(S((S(S(S(S(S(S(S O))))))))))))))))))) = true. +normalize.reflexivity. +qed. *) + +theorem primeb_to_Prop: \forall n. +match primeb n with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)]. +intro. +apply (nat_case n) +[ simplify. + autobatch + (*unfold Not. + unfold prime. + intro. + elim H. + apply (not_le_Sn_O (S O) H1)*) +| intro. + apply (nat_case m) + [ simplify. + autobatch + (*unfold Not. + unfold prime. + intro. + elim H. + apply (not_le_Sn_n (S O) H1)*) + | intro. + change with + match eqb (smallest_factor (S(S m1))) (S(S m1)) with + [ true \Rightarrow prime (S(S m1)) + | false \Rightarrow \lnot (prime (S(S m1)))]. + apply (eqb_elim (smallest_factor (S(S m1))) (S(S m1))) + [ intro. + simplify. + rewrite < H. + apply prime_smallest_factor_n. + unfold lt.autobatch + (*apply le_S_S. + apply le_S_S. + apply le_O_n*) + | intro. + simplify. + change with (prime (S(S m1)) \to False). + intro. + autobatch + (*apply H. + apply prime_to_smallest_factor. + assumption*) + ] + ] +] +qed. + +theorem primeb_true_to_prime : \forall n:nat. +primeb n = true \to prime n. +intros. +change with +match true with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)]. +rewrite < H. +(*qui autobatch non chiude il goal*) +apply primeb_to_Prop. +qed. + +theorem primeb_false_to_not_prime : \forall n:nat. +primeb n = false \to \lnot (prime n). +intros. +change with +match false with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)]. +rewrite < H. +(*qui autobatch non chiude il goal*) +apply primeb_to_Prop. +qed. + +theorem decidable_prime : \forall n:nat.decidable (prime n). +intro. +unfold decidable. +cut +(match primeb n with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)] \to (prime n) \lor \lnot (prime n)) +[ apply Hcut. + (*qui autobatch non chiude il goal*) + apply primeb_to_Prop +| elim (primeb n) + [ left. + (*qui autobatch non chiude il goal*) + apply H + | right. + (*qui autobatch non chiude il goal*) + apply H + ] +] +qed. + +theorem prime_to_primeb_true: \forall n:nat. +prime n \to primeb n = true. +intros. +cut (match (primeb n) with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)] \to ((primeb n) = true)) +[ apply Hcut. + (*qui autobatch non chiude il goal*) + apply primeb_to_Prop +| elim (primeb n) + [ reflexivity. + | absurd (prime n) + [ assumption + | (*qui autobatch non chiude il goal*) + assumption + ] + ] +] +qed. + +theorem not_prime_to_primeb_false: \forall n:nat. +\lnot(prime n) \to primeb n = false. +intros. +cut (match (primeb n) with +[ true \Rightarrow prime n +| false \Rightarrow \lnot (prime n)] \to ((primeb n) = false)) +[ apply Hcut. + (*qui autobatch non chiude il goal*) + apply primeb_to_Prop +| elim (primeb n) + [ absurd (prime n) + [ (*qui autobatch non chiude il goal*) + assumption + | assumption + ] + | reflexivity + ] +] +qed. + diff --git a/matita/library_auto/auto/nat/relevant_equations.ma b/matita/library_auto/auto/nat/relevant_equations.ma new file mode 100644 index 000000000..8dee78c4f --- /dev/null +++ b/matita/library_auto/auto/nat/relevant_equations.ma @@ -0,0 +1,57 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/relevant_equations". + +include "auto/nat/times.ma". +include "auto/nat/minus.ma". +include "auto/nat/gcd.ma". +(* if gcd is compiled before this, the applys will take too much *) + +theorem times_plus_l: \forall n,m,p:nat. (n+m)*p = n*p + m*p. +intros. +apply (trans_eq ? ? (p*(n+m))) +[ apply sym_times +| apply (trans_eq ? ? (p*n+p*m));autobatch + (*[ apply distr_times_plus + | apply eq_f2; + apply sym_times + ]*) +] +qed. + +theorem times_minus_l: \forall n,m,p:nat. (n-m)*p = n*p - m*p. +intros. +apply (trans_eq ? ? (p*(n-m))) +[ apply sym_times +| apply (trans_eq ? ? (p*n-p*m));autobatch + (*[ apply distr_times_minus + | apply eq_f2; + apply sym_times + ]*) +] +qed. + +theorem times_plus_plus: \forall n,m,p,q:nat. (n + m)*(p + q) = +n*p + n*q + m*p + m*q. +intros. +autobatch. +(*apply (trans_eq nat ? ((n*(p+q) + m*(p+q)))) +[ apply times_plus_l +| rewrite > distr_times_plus. + rewrite > distr_times_plus. + rewrite < assoc_plus. + reflexivity +]*) +qed. diff --git a/matita/library_auto/auto/nat/sigma_and_pi.ma b/matita/library_auto/auto/nat/sigma_and_pi.ma new file mode 100644 index 000000000..2bf73d4c3 --- /dev/null +++ b/matita/library_auto/auto/nat/sigma_and_pi.ma @@ -0,0 +1,139 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/sigma_and_pi". + +include "auto/nat/factorial.ma". +include "auto/nat/exp.ma". +include "auto/nat/lt_arith.ma". + +let rec sigma n f m \def + match n with + [ O \Rightarrow (f m) + | (S p) \Rightarrow (f (S p+m))+(sigma p f m)]. + +let rec pi n f m \def + match n with + [ O \Rightarrow f m + | (S p) \Rightarrow (f (S p+m))*(pi p f m)]. + +theorem eq_sigma: \forall f,g:nat \to nat. +\forall n,m:nat. +(\forall i:nat. m \le i \to i \le m+n \to f i = g i) \to +(sigma n f m) = (sigma n g m). +intros 3. +elim n +[ simplify. + autobatch + (*apply H + [ apply le_n + | rewrite < plus_n_O. + apply le_n + ]*) +| simplify. + apply eq_f2 + [ apply H1 + [ autobatch + (*change with (m \le (S n1)+m). + apply le_plus_n*) + | autobatch + (*rewrite > (sym_plus m). + apply le_n*) + ] + | apply H. + intros. + apply H1 + [ assumption + | autobatch + (*rewrite < plus_n_Sm. + apply le_S. + assumption*) + ] + ] +] +qed. + +theorem eq_pi: \forall f,g:nat \to nat. +\forall n,m:nat. +(\forall i:nat. m \le i \to i \le m+n \to f i = g i) \to +(pi n f m) = (pi n g m). +intros 3. +elim n +[ simplify. + autobatch + (*apply H + [ apply le_n + | rewrite < plus_n_O. + apply le_n + ] *) +| simplify. + apply eq_f2 + [ apply H1 + [ autobatch + (*change with (m \le (S n1)+m). + apply le_plus_n*) + | autobatch + (*rewrite > (sym_plus m). + apply le_n*) + ] + | apply H. + intros. + apply H1 + [ assumption + | autobatch + (*rewrite < plus_n_Sm. + apply le_S. + assumption*) + ] + ] +] +qed. + +theorem eq_fact_pi: \forall n. (S n)! = pi n (\lambda m.m) (S O). +intro. +elim n +[ autobatch + (*simplify. + reflexivity*) +| change with ((S(S n1))*(S n1)! = ((S n1)+(S O))*(pi n1 (\lambda m.m) (S O))). + rewrite < plus_n_Sm. + rewrite < plus_n_O. + autobatch + (*apply eq_f. + assumption*) +] +qed. + +theorem exp_pi_l: \forall f:nat\to nat.\forall n,m,a:nat. +(exp a (S n))*pi n f m= pi n (\lambda p.a*(f p)) m. +intros. +elim n +[ autobatch + (*simplify. + rewrite < times_n_SO. + reflexivity*) +| simplify. + rewrite < H. + rewrite > assoc_times. + rewrite > assoc_times in\vdash (? ? ? %). + apply eq_f. + rewrite < assoc_times. + rewrite < assoc_times. + autobatch + (*apply eq_f2 + [ apply sym_times + | reflexivity + ]*) +] +qed. diff --git a/matita/library_auto/auto/nat/times.ma b/matita/library_auto/auto/nat/times.ma new file mode 100644 index 000000000..c8e2a4066 --- /dev/null +++ b/matita/library_auto/auto/nat/times.ma @@ -0,0 +1,131 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/times". + +include "auto/nat/plus.ma". + +let rec times n m \def + match n with + [ O \Rightarrow O + | (S p) \Rightarrow m+(times p m) ]. + +(*CSC: the URI must disappear: there is a bug now *) +interpretation "natural times" 'times x y = (cic:/matita/library_autobatch/nat/times/times.con x y). + +theorem times_n_O: \forall n:nat. O = n*O. +intros.elim n +[ autobatch + (*simplify. + reflexivity.*) +| simplify. (* qui autobatch non funziona: Uncaught exception: Invalid_argument ("List.map2")*) + assumption. +] +qed. + +theorem times_n_Sm : +\forall n,m:nat. n+(n*m) = n*(S m). +intros.elim n +[ autobatch. + (*simplify.reflexivity.*) +| simplify. + autobatch + (*apply eq_f. + rewrite < H. + transitivity ((n1+m)+n1*m) + [ symmetry. + apply assoc_plus. + | transitivity ((m+n1)+n1*m) + [ apply eq_f2. + apply sym_plus. + reflexivity. + | apply assoc_plus. + ] + ]*) +] +qed. + +(* NOTA: + se non avessi semplificato con autobatch tutto il secondo ramo della tattica + elim n, avrei comunque potuto risolvere direttamente con autobatch entrambi + i rami generati dalla prima applicazione della tattica transitivity + (precisamente transitivity ((n1+m)+n1*m) + *) + +theorem times_n_SO : \forall n:nat. n = n * S O. +intros. +rewrite < times_n_Sm. +autobatch paramodulation. (*termina la dim anche solo con autobatch*) +(*rewrite < times_n_O. +rewrite < plus_n_O. +reflexivity.*) +qed. + +theorem times_SSO_n : \forall n:nat. n + n = S (S O) * n. +intros. +simplify. +autobatch paramodulation. (* termina la dim anche solo con autobatch*) +(*rewrite < plus_n_O. +reflexivity.*) +qed. + +theorem symmetric_times : symmetric nat times. +unfold symmetric. +intros.elim x +[ autobatch + (*simplify.apply times_n_O.*) +| simplify. + autobatch + (*rewrite > H.apply times_n_Sm.*) +] +qed. + +variant sym_times : \forall n,m:nat. n*m = m*n \def +symmetric_times. + +theorem distributive_times_plus : distributive nat times plus. +unfold distributive. +intros.elim x;simplify +[ reflexivity. +| autobatch + (*rewrite > H. + rewrite > assoc_plus. + rewrite > assoc_plus. + apply eq_f. + rewrite < assoc_plus. + rewrite < (sym_plus ? z). + rewrite > assoc_plus. + reflexivity.*) +] +qed. + +variant distr_times_plus: \forall n,m,p:nat. n*(m+p) = n*m + n*p +\def distributive_times_plus. + +theorem associative_times: associative nat times. +unfold associative.intros. +elim x;simplify +[ apply refl_eq +| autobatch + (*rewrite < sym_times. + rewrite > distr_times_plus. + rewrite < sym_times. + rewrite < (sym_times (times n y) z). + rewrite < H. + apply refl_eq.*) +] +qed. + +variant assoc_times: \forall n,m,p:nat. (n*m)*p = n*(m*p) \def +associative_times. diff --git a/matita/library_auto/auto/nat/totient.ma b/matita/library_auto/auto/nat/totient.ma new file mode 100644 index 000000000..98b374676 --- /dev/null +++ b/matita/library_auto/auto/nat/totient.ma @@ -0,0 +1,172 @@ +(**************************************************************************) +(* __ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/library_autobatch/nat/totient". + +include "auto/nat/count.ma". +include "auto/nat/chinese_reminder.ma". + +definition totient : nat \to nat \def +\lambda n. count n (\lambda m. eqb (gcd m n) (S O)). + +theorem totient3: totient (S(S(S O))) = (S(S O)). +reflexivity. +qed. + +theorem totient6: totient (S(S(S(S(S(S O)))))) = (S(S O)). +reflexivity. +qed. + +theorem totient_times: \forall n,m:nat. (gcd m n) = (S O) \to +totient (n*m) = (totient n)*(totient m). +intro. +apply (nat_case n) +[ intros. + autobatch + (*simplify. + reflexivity*) +| intros 2. + apply (nat_case m1) + [ rewrite < sym_times. + rewrite < (sym_times (totient O)). + simplify. + intro. + reflexivity + | intros. + unfold totient. + apply (count_times m m2 ? ? ? + (\lambda b,a. cr_pair (S m) (S m2) a b) + (\lambda x. x \mod (S m)) (\lambda x. x \mod (S m2))) + [ intros. + unfold cr_pair. + apply (le_to_lt_to_lt ? (pred ((S m)*(S m2)))) + [ unfold min. + apply le_min_aux_r + | autobatch + (*unfold lt. + apply (nat_case ((S m)*(S m2))) + [ apply le_n + | intro. + apply le_n + ]*) + ] + | intros. + generalize in match (mod_cr_pair (S m) (S m2) a b H1 H2 H). + intro. + elim H3. + apply H4 + | intros. + generalize in match (mod_cr_pair (S m) (S m2) a b H1 H2 H). + intro. + elim H3. + apply H5 + | intros. + generalize in match (mod_cr_pair (S m) (S m2) a b H1 H2 H). + intro. + elim H3. + apply eqb_elim + [ intro. + rewrite > eq_to_eqb_true + [ rewrite > eq_to_eqb_true + [ reflexivity + | rewrite < H4. + rewrite > sym_gcd. + rewrite > gcd_mod + [ apply (gcd_times_SO_to_gcd_SO ? ? (S m2)) + [ autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | assumption + ] + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + ] + ] + | rewrite < H5. + rewrite > sym_gcd. + rewrite > gcd_mod + [ apply (gcd_times_SO_to_gcd_SO ? ? (S m)) + [ autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | autobatch + (*rewrite > sym_times. + assumption*) + ] + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + ] + ] + | intro. + apply eqb_elim + [ intro. + apply eqb_elim + [ intro. + apply False_ind. + apply H6. + apply eq_gcd_times_SO + [ autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + | rewrite < gcd_mod + [ autobatch + (*rewrite > H4. + rewrite > sym_gcd. + assumption*) + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + ] + | rewrite < gcd_mod + [ autobatch + (*rewrite > H5. + rewrite > sym_gcd. + assumption*) + | autobatch + (*unfold lt. + apply le_S_S. + apply le_O_n*) + ] + ] + | intro. + reflexivity + ] + | intro. + reflexivity + ] + ] + ] + ] +] +qed. \ No newline at end of file diff --git a/matita/library_auto/makefile b/matita/library_auto/makefile new file mode 100644 index 000000000..ec9f8cb26 --- /dev/null +++ b/matita/library_auto/makefile @@ -0,0 +1,39 @@ +H=@ + +RT_BASEDIR=../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/matita.conf.xml.in b/matita/matita.conf.xml.in new file mode 100644 index 000000000..3d2630199 --- /dev/null +++ b/matita/matita.conf.xml.in @@ -0,0 +1,125 @@ + + +

    + + $(HOME) + + $(USER) +
    +
    + + + + + $(user.home)/.matita + + @RT_BASE_DIR@ + + $(user.name) + + + + +
    +
    + + + + + @DBHOST@ matita helm none legacy + @DBHOST@ public helm none library + @DBHOST@ matita helm none user + + + + +
    +
    + + $(user.home)/.matita/getter/cache + + + cic:/matita/ + file:///projects/helm/library/matita_contribs/matita + ro + + + cic:/matita/ + file://$(matita.rt_base_dir)/xml/standard-library/ + ro + + + cic:/matita/ + file://$(user.home)/.matita/xml/matita/ + + + cic:/ + file://@RT_BASE_DIR@/xml/legacy-library/coq/ + legacy + + + cic:/ + file:///projects/helm/library/coq_contribs/ + legacy + + + cic:/ + http://mowgli.cs.unibo.it/xml/ + legacy + +
    + diff --git a/matita/matita.glade b/matita/matita.glade new file mode 100644 index 000000000..72ba3db8c --- /dev/null +++ b/matita/matita.glade @@ -0,0 +1,3393 @@ + + + + + + True + Cic browser + GTK_WIN_POS_CENTER_ON_PARENT + 500 + 500 + + + True + + + True + + + True + + + True + _File + True + + + + + True + gtk-new + True + True + + + + + True + Open _Location ... + True + + + + + + True + + + + + True + gtk-close + True + True + + + + + + + + + True + _Edit + True + + + + + True + gtk-copy + True + True + + + + + + + + + True + _View + True + + + + + True + _Metadata + True + + + + + True + View the graph of objects on which the current one depends on + (Direct) Dependencies + True + + + + + True + View the graph of objects which depends on the current one + (Inverse) Dependencies + True + + + + + True + + + + + True + HBugs Tutors + True + + + + + + + + + False + False + + + + + True + 0 + 0 + GTK_SHADOW_NONE + + + True + + + True + True + GTK_RELIEF_NONE + 0 + + + True + gtk-new + + + + + False + False + + + + + True + True + GTK_RELIEF_NONE + 0 + + + True + gtk-go-back + + + + + False + False + 1 + + + + + True + True + GTK_RELIEF_NONE + 0 + + + True + gtk-go-forward + + + + + False + False + 2 + + + + + True + True + True + refresh + GTK_RELIEF_NONE + 0 + + + True + gtk-refresh + + + + + False + False + 3 + + + + + True + True + True + home + GTK_RELIEF_NONE + 0 + + + True + gtk-home + + + + + False + False + 4 + + + + + True + gtk-jump-to + 2 + + + False + False + 3 + 5 + + + + + True + + + + + + 6 + + + + + + + False + 1 + + + + + True + 3 + 6 + + + True + gtk-missing-image + + + False + + + + + True + True + * + + + 1 + + + + + True + + + True + + + + + + False + False + + + + + False + 2 + + + + + False + 2 + + + + + True + True + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + + + + False + + + + + True + MathView + + + tab + False + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + False + + + + + 1 + False + + + + + True + WhelpResults + + + tab + 1 + False + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + GTK_SHADOW_NONE + + + True + gtk-missing-image + + + + + + + 2 + False + + + + + True + WhelpEasterEgg + + + tab + 2 + False + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + + + + 3 + False + + + + + True + Graph + + + tab + 3 + False + False + + + + + True + + + True + True + + + True + True + + + + + + + True + GTK_TOOLBAR_BOTH + + + True + + + True + True + gtk-refresh + True + 0 + + + + + False + False + + + + + True + + + True + True + gtk-remove + True + 0 + + + + + False + False + + + + + True + + + True + True + gtk-add + True + 0 + + + + + False + False + + + + + False + False + 1 + + + + + 4 + False + + + + + True + HBugs + + + tab + 4 + False + False + + + + + 3 + + + + + + + + + DUMMY + False + True + GTK_WIN_POS_CENTER + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + + + True + DUMMY + GTK_JUSTIFY_CENTER + + + False + False + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + True + True + True + gtk-ok + True + -5 + + + 1 + + + + + False + GTK_PACK_END + + + + + + + True + DUMMY + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + + + True + DUMMY + + + False + False + 2 + + + + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + True + True + True + gtk-ok + True + -5 + + + 1 + + + + + False + GTK_PACK_END + + + + + + + 10 + Select File + True + GTK_WIN_POS_CENTER + GDK_WINDOW_TYPE_HINT_DIALOG + True + + + True + True + True + 0 + + + + + True + True + True + 0 + + + + + Matita + + + True + + + True + + + True + GTK_SHADOW_OUT + + + True + + + True + _File + True + + + + + True + _New + True + + + + True + gtk-new + 1 + + + + + + + True + _Open... + True + + + + True + gtk-open + 1 + + + + + + + True + _Save + True + + + + True + gtk-save + 1 + + + + + + + True + Save _as ... + True + + + + True + gtk-save-as + 1 + + + + + + + True + _Developments... + True + + + + True + gtk-execute + 1 + + + + + + + True + + + + + True + _Quit + True + + + + True + gtk-quit + 1 + + + + + + + + + + + True + _Edit + True + + + + + True + False + _Undo + True + + + + True + gtk-undo + 1 + + + + + + + True + False + _Redo + True + + + + True + gtk-redo + 1 + + + + + + + True + + + + + True + Cu_t + True + + + + True + gtk-cut + 1 + + + + + + + True + _Copy + True + + + + True + gtk-copy + 1 + + + + + + + True + _Paste + True + + + + True + gtk-paste + 1 + + + + + + + True + Paste as pattern + True + + + + + True + Paste Unicode as TeX + True + False + + + + + True + _Delete + True + + + True + gtk-delete + 1 + + + + + + + True + + + + + True + Select _All + True + + + + + True + + + + + True + _Find & replace ... + True + + + + True + gtk-find-and-replace + 1 + + + + + + + True + + + + + True + Next ligature + True + + + + + + True + Edit with e_xternal editor + True + + + + + + + + + True + _Script + True + + + + + True + Execute 1 phrase + True + + + + + + True + Retract 1 phrase + True + + + + + + True + + + + + True + Execute all + True + + + + + + True + Restart + True + + + + + + True + + + + + True + Execute until cursor + True + + + + + + + + + + True + _View + True + + + + + True + Show _tactics bar + True + True + + + + + + True + New CIC _browser + True + + + + + + True + + + + + True + _Fullscreen + True + + + + + + True + + + + + True + Zoom _in + True + + + + True + gtk-zoom-in + 1 + + + + + + + True + Zoom _out + True + + + + True + gtk-zoom-out + 1 + + + + + + + True + _Normal size + True + + + + True + gtk-zoom-100 + 1 + + + + + + + True + + + + + True + Pretty print notation + True + True + + + + + True + Hide coercions + True + True + + + + + True + + + + + True + Displays the graph of coercions + Coercions Graph + True + + + + + True + Displays a window helpful to drive automation + Auto GUI + True + + + gtk-media-pause + + + + + + + + + + + True + _Debug + True + + + + + True + + + + + + + + + True + _Help + True + + + + + True + _Contents + True + + + + True + gtk-help + 1 + + + + + + + True + _About + True + + + True + gtk-about + 1 + + + + + + + + + + + + + False + False + + + + + True + + + True + True + + + True + + + True + GTK_SHADOW_OUT + GTK_POS_TOP + + + True + 17 + 2 + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + + + + + 15 + 16 + GTK_FILL + + + + + True + + + + + + 13 + 14 + GTK_FILL + + + + + True + + + + + + 10 + 11 + GTK_FILL + + + + + True + + + + + + 7 + 8 + GTK_FILL + + + + + True + + + + + + 5 + 6 + GTK_FILL + + + + + True + + + + + + 3 + 4 + GTK_FILL + + + + + True + + + + + + 1 + 2 + GTK_FILL + + + + + True + True + + + True + True + Split + ∧ + True + 0 + + + + + True + True + Left + L + True + 0 + + + 1 + + + + + 6 + 7 + GTK_FILL + GTK_FILL + + + + + True + True + + + True + True + Right + R + True + 0 + + + + + True + True + Exists + ∃ + True + 0 + + + 1 + + + + + 1 + 2 + 6 + 7 + GTK_FILL + GTK_FILL + + + + + True + True + ElimType + elimTy + True + 0 + + + 1 + 2 + 4 + 5 + GTK_FILL + + + + + + True + True + Replace + repl + True + 0 + + + 1 + 2 + 16 + 17 + GTK_FILL + + + + + + True + True + Cut + cut + True + 0 + + + 16 + 17 + GTK_FILL + + + + + + True + True + Auto + auto + True + 0 + + + 1 + 2 + 14 + 15 + GTK_FILL + + + + + + True + True + Assumption + assum + True + 0 + + + 14 + 15 + GTK_FILL + + + + + + True + True + Whd + whd + True + 0 + + + 12 + 13 + GTK_FILL + + + + + + True + True + Reduce + red + True + 0 + + + 1 + 2 + 11 + 12 + GTK_FILL + + + + + + True + True + Simplify + simpl + True + 0 + + + 11 + 12 + GTK_FILL + + + + + + True + True + Transitivity + trans + True + 0 + + + 9 + 10 + GTK_FILL + + + + + + True + True + Symmetry + sym + True + 0 + + + 1 + 2 + 8 + 9 + GTK_FILL + + + + + + True + True + Reflexivity + refl + True + 0 + + + 8 + 9 + GTK_FILL + + + + + + True + True + Elim + elim + True + 0 + + + 4 + 5 + GTK_FILL + + + + + + True + True + Exact + exact + True + 0 + + + 2 + 3 + GTK_FILL + + + + + + True + True + Intros + intro + True + 0 + + + GTK_FILL + + + + + + True + True + Apply + apply + True + 0 + + + 1 + 2 + GTK_FILL + + + + + + + + False + + + + + 400 + True + + + True + + + True + GTK_TOOLBAR_BOTH + + + True + + + True + True + Restart + GTK_RELIEF_NONE + 0 + + + True + gtk-goto-top + + + + + + + False + False + + + + + True + + + True + True + Retract 1 phrase + GTK_RELIEF_NONE + 0 + + + True + gtk-go-up + + + + + + + False + False + + + + + True + + + True + True + Execute until point + GTK_RELIEF_NONE + 0 + + + True + gtk-jump-to + + + + + + + False + False + + + + + True + + + True + True + Execute 1 phrase + GTK_RELIEF_NONE + 0 + + + True + gtk-go-down + + + + + + + False + False + + + + + True + + + True + True + Execute all + GTK_RELIEF_NONE + 0 + + + True + gtk-goto-bottom + + + + + + + False + False + + + + + + + True + GTK_ORIENTATION_VERTICAL + + + True + + + True + True + GTK_RELIEF_NONE + 0 + + + True + gtk-stop + + + + + + + False + False + + + + + False + 1 + + + + + False + False + + + + + True + True + GTK_POS_BOTTOM + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + + + + False + + + + + True + script + + + tab + False + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + + + True + Not implemented. + + + + + + + 1 + False + + + + + True + outline + + + tab + 1 + False + False + + + + + 1 + + + + + 1 + + + + + False + True + + + + + 250 + 500 + True + True + 380 + + + True + True + + + False + True + + + + + True + + + True + True + GTK_POLICY_NEVER + GTK_SHADOW_IN + + + True + True + False + GTK_WRAP_CHAR + False + + + + + + + True + True + + + + + True + True + + + + + + + 1 + + + + + True + + + True + False + + + + + True + False + + + True + gtk-missing-image + + + False + + + + + True + label14 + + + tab + False + False + + + + + True + gtk-missing-image + + + 1 + False + + + + + True + label15 + + + tab + 1 + False + False + + + + + True + gtk-missing-image + + + 2 + False + + + + + True + label16 + + + tab + 2 + False + False + + + + + False + 1 + + + + + False + False + 2 + + + + + + + + + DUMMY + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + + + True + DUMMY + + + False + False + 2 + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + + + + + 3 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + True + True + True + gtk-ok + True + -5 + + + 1 + + + + + False + GTK_PACK_END + + + + + + + 280 + Uri choice + True + GTK_WIN_POS_CENTER + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + 4 + + + True + 3 + + + True + some informative message here ... + + + False + False + + + + + 400 + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + False + + + + + 1 + + + + + True + + + True + URI: + + + False + False + + + + + True + True + * + + + 1 + + + + + False + 2 + + + + + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + + + True + True + True + 0 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-index + + + False + False + + + + + True + Try _Selected + True + + + False + False + 1 + + + + + + + + + 1 + + + + + True + False + True + True + Try Constants + True + 0 + + + 2 + + + + + True + True + gtk-copy + True + 0 + + + 3 + + + + + True + True + True + 0 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-ok + + + False + False + + + + + True + bla bla bla + True + + + False + False + 1 + + + + + + + + + 4 + + + + + True + True + True + gtk-go-forward + True + 0 + + + 5 + + + + + False + GTK_PACK_END + + + + + + + 5 + Find & Replace + False + GTK_WIN_POS_MOUSE + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + 3 + 2 + 5 + + + True + 5 + + + True + + + + + + + + + + + True + True + gtk-find + True + 0 + + + False + False + 1 + + + + + True + True + 0 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-find-and-replace + + + False + False + + + + + True + _Replace + True + + + False + False + 1 + + + + + + + + + False + False + 2 + + + + + True + True + gtk-cancel + True + 0 + + + False + False + 3 + + + + + 2 + 2 + 3 + 5 + + + + + True + True + * + + + 1 + 2 + 1 + 2 + + + + + + True + True + True + True + True + * + + + 1 + 2 + + + + + + True + 0 + Replace with: + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Find: + + + GTK_FILL + + + + + + + + Create development + False + True + GTK_WIN_POS_CENTER_ALWAYS + GDK_WINDOW_TYPE_HINT_UTILITY + + + True + + + True + 3 + 2 + 3 + 5 + 5 + + + + + + True + True + ... + True + 0 + + + 2 + 3 + 1 + 2 + GTK_FILL + + + + + + True + True + * + + + 1 + 2 + 1 + 2 + + + + + + True + True + * + + + 1 + 2 + + + + + + True + 0 + Root directory + + + 1 + 2 + GTK_FILL + + + + + + True + 0 + Name + + + GTK_FILL + + + + + + False + + + + + True + + + False + 2 + 1 + + + + + True + 3 + 5 + + + True + + + + + + + + + + + True + True + gtk-add + True + 0 + + + False + False + 1 + + + + + True + True + gtk-cancel + True + 0 + + + False + False + 2 + + + + + False + 2 + + + + + + + Developments + GTK_WIN_POS_CENTER + + + True + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + False + + + + + + + True + + + False + 2 + 1 + + + + + True + 3 + 4 + + + True + + + + + + + + + + + True + True + gtk-new + True + 0 + + + False + False + 1 + + + + + True + True + gtk-delete + True + 0 + + + False + False + 2 + + + + + True + True + 0 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-execute + + + False + False + + + + + True + _Build + True + + + False + False + 1 + + + + + + + + + False + False + 3 + + + + + True + True + 0 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-clear + + + False + False + + + + + True + C_lean + True + + + False + False + 1 + + + + + + + + + False + False + 4 + + + + + True + True + 0 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-convert + + + False + False + + + + + True + Publish + True + + + False + False + 1 + + + + + + + + + False + False + 5 + + + + + True + True + 0 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-zoom-fit + + + False + False + + + + + True + Graph + True + + + False + False + 1 + + + + + + + + + False + False + 6 + + + + + True + True + gtk-close + True + 0 + + + False + False + 7 + + + + + False + 2 + + + + + + + 450 + 400 + title + True + GDK_WINDOW_TYPE_HINT_DIALOG + + + True + + + True + + + True + some informative message here ... + + + False + False + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + False + + + + + 1 + + + + + 2 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-help + True + -11 + + + + + True + True + True + -6 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-zoom-in + + + False + False + + + + + True + More + True + + + False + False + 1 + + + + + + + + + 1 + + + + + True + True + True + True + gtk-cancel + True + -6 + + + 2 + + + + + True + True + True + gtk-ok + True + -5 + + + 3 + + + + + False + GTK_PACK_END + + + + + + + 600 + 400 + True + Auto + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_SOUTH_EAST + + + True + + + True + 2 + + + True + True + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + + + True + 3 + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + + True + True + 0 + + + True + 0 + 0 + + + True + 2 + + + True + gtk-go-up + + + False + False + + + + + True + True + + + False + False + 1 + + + + + + + + + + + True + True + 0 + + + True + gtk-go-down + + + + + 1 + + + + + False + False + 1 + + + + + + + True + + + False + 3 + 1 + + + + + True + + + True + 0 + Last: + + + + + True + 4 + 4 + GTK_BUTTONBOX_END + + + True + True + True + gtk-media-pause + True + 0 + + + + + True + True + True + gtk-media-play + True + 0 + + + 1 + + + + + True + True + True + gtk-media-next + True + 0 + + + 2 + + + + + True + True + True + gtk-close + True + 0 + + + 3 + + + + + 1 + + + + + False + 2 + + + + + + diff --git a/matita/matita.gtkrc b/matita/matita.gtkrc new file mode 100644 index 000000000..91081c311 --- /dev/null +++ b/matita/matita.gtkrc @@ -0,0 +1,80 @@ +# Based on /usr/share/themes/Emacs/gtk-2.0-key/, +# modified by Zack for matita + +# +# A keybinding set implementing emacs-like keybindings +# + +# +# Bindings for GtkTextView and GtkEntry +# +binding "gtk-emacs-text-entry" +{ + bind "b" { "move-cursor" (logical-positions, -1, 0) } + bind "b" { "move-cursor" (logical-positions, -1, 1) } + bind "f" { "move-cursor" (logical-positions, 1, 0) } + bind "f" { "move-cursor" (logical-positions, 1, 1) } + + bind "b" { "move-cursor" (words, -1, 0) } + bind "b" { "move-cursor" (words, -1, 1) } + bind "f" { "move-cursor" (words, 1, 0) } + bind "f" { "move-cursor" (words, 1, 1) } + + bind "a" { "move-cursor" (paragraph-ends, -1, 0) } + bind "a" { "move-cursor" (paragraph-ends, -1, 1) } + bind "e" { "move-cursor" (paragraph-ends, 1, 0) } + bind "e" { "move-cursor" (paragraph-ends, 1, 1) } + + bind "w" { "cut-clipboard" () } + bind "y" { "paste-clipboard" () } + + bind "d" { "delete-from-cursor" (chars, 1) } + bind "d" { "delete-from-cursor" (word-ends, 1) } + bind "k" { "delete-from-cursor" (paragraph-ends, 1) } + bind "backslash" { "delete-from-cursor" (whitespace, 1) } + + bind "space" { "delete-from-cursor" (whitespace, 1) + "insert-at-cursor" (" ") } + bind "KP_Space" { "delete-from-cursor" (whitespace, 1) + "insert-at-cursor" (" ") } + + # + # Some non-Emacs keybindings people are attached to + # + bind "u" { + "move-cursor" (paragraph-ends, -1, 0) + "delete-from-cursor" (paragraph-ends, 1) + } + bind "h" { "delete-from-cursor" (chars, -1) } + bind "w" { "delete-from-cursor" (word-ends, -1) } +} + +# +# Bindings for GtkTextView +# +binding "gtk-emacs-text-view" +{ +# bind "p" { "move-cursor" (display-lines, -1, 0) } + bind "p" { "move-cursor" (display-lines, -1, 1) } +# bind "n" { "move-cursor" (display-lines, 1, 0) } + bind "n" { "move-cursor" (display-lines, 1, 1) } + + bind "space" { "set-anchor" () } + bind "KP_Space" { "set-anchor" () } +} + +# +# Bindings for GtkTreeView +# +binding "gtk-emacs-tree-view" +{ + bind "s" { "start-interactive-search" () } + bind "f" { "move-cursor" (logical-positions, 1) } + bind "b" { "move-cursor" (logical-positions, -1) } +} + +class "GtkEntry" binding "gtk-emacs-text-entry" +class "GtkTextView" binding "gtk-emacs-text-entry" +class "GtkTextView" binding "gtk-emacs-text-view" +class "GtkTreeView" binding "gtk-emacs-tree-view" + diff --git a/matita/matita.lang b/matita/matita.lang new file mode 100644 index 000000000..5f2c09b8f --- /dev/null +++ b/matita/matita.lang @@ -0,0 +1,223 @@ + + + + \ + + + \(\*\*[^\)] + [^\(]\*\*\) + + + + \(\* + \*\) + + + + theorem + definition + lemma + fact + remark + variant + axiom + + + + alias + and + as + coercion + nocomposites + coinductive + corec + default + for + include + include' + inductive + in + interpretation + let + match + names + notation + on + qed + rec + record + return + to + using + with + + + + \[ + + + \| + + + \] + + + \{ + + + \} + + + @ + + + \$ + + + + Set + Prop + Type + + + + absurd + apply + assumption + autobatch + cases + clear + clearbody + change + compose + constructor + contradiction + cut + decompose + destruct + elim + elimType + exact + exists + fail + fold + fourier + fwd + generalize + id + intro + intros + inversion + lapply + linear + left + letin + normalize + reduce + reflexivity + replace + rewrite + ring + right + symmetry + simplify + split + to + transitivity + unfold + whd + assume + suppose + by + is + or + equivalent + equivalently + we + prove + proved + need + proceed + induction + inductive + case + base + let + such + that + by + have + and + the + thesis + becomes + hypothesis + know + case + obtain + conclude + done + + + + try + solve + do + repeat + first + focus + unfocus + progress + skip + + + + + inline + procedural + check + hint + set + auto + + + + elim + hint + instance + locate + match + + + + def + forall + lambda + to + exists + Rightarrow + Assign + land + lor + lnot + liff + subst + vdash + iforall + iexists + + + + " + " + + + diff --git a/matita/matita.ma.templ b/matita/matita.ma.templ new file mode 100644 index 000000000..ec1bc8006 --- /dev/null +++ b/matita/matita.ma.templ @@ -0,0 +1,16 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/". + diff --git a/matita/matita.ml b/matita/matita.ml new file mode 100644 index 000000000..60b112d98 --- /dev/null +++ b/matita/matita.ml @@ -0,0 +1,319 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open MatitaGtkMisc +open GrafiteTypes + +(** {2 Initialization} *) + +let _ = + MatitaInit.add_cmdline_spec + ["-tptppath",Arg.String + (fun s -> Helm_registry.set_string "matita.tptppath" s), + "Where to find the Axioms/ and Problems/ directory"]; + MatitaInit.initialize_all () +;; + +(* let _ = Saturation.init () (* ALB to link paramodulation *) *) + +(** {2 GUI callbacks} *) + +let gui = MatitaGui.instance () + +let script = + let s = + MatitaScript.script + ~source_view:gui#sourceView + ~mathviewer:(MatitaMathView.mathViewer ()) + ~urichooser:(fun uris -> + try + MatitaGui.interactive_uri_choice ~selection_mode:`SINGLE + ~title:"Matita: URI chooser" + ~msg:"Select the URI" ~hide_uri_entry:true + ~hide_try:true ~ok_label:"_Apply" ~ok_action:`SELECT + ~copy_cb:(fun s -> gui#sourceView#buffer#insert ("\n"^s^"\n")) + () ~id:"boh?" uris + with MatitaTypes.Cancel -> []) + ~set_star:gui#setStar + ~ask_confirmation: + (fun ~title ~message -> + MatitaGtkMisc.ask_confirmation ~title ~message + ~parent:gui#main#toplevel ()) + ~develcreator:gui#createDevelopment + () + in + gui#sourceView#source_buffer#begin_not_undoable_action (); + s#reset (); + s#template (); + gui#sourceView#source_buffer#end_not_undoable_action (); + s + + (* math viewers *) +let _ = + let cic_math_view = MatitaMathView.cicMathView_instance () in + let sequents_viewer = MatitaMathView.sequentsViewer_instance () in + sequents_viewer#load_logo; + cic_math_view#set_href_callback + (Some (fun uri -> (MatitaMathView.cicBrowser ())#load + (`Uri (UriManager.uri_of_string uri)))); + let browser_observer _ _ = MatitaMathView.refresh_all_browsers () in + let sequents_observer _ grafite_status = + sequents_viewer#reset; + match grafite_status.proof_status with + | Incomplete_proof ({ stack = stack } as incomplete_proof) -> + sequents_viewer#load_sequents incomplete_proof; + (try + script#setGoal (Some (Continuationals.Stack.find_goal stack)); + let goal = + match script#goal with + None -> assert false + | Some n -> n + in + sequents_viewer#goto_sequent goal + with Failure _ -> script#setGoal None); + | Proof proof -> sequents_viewer#load_logo_with_qed + | No_proof -> sequents_viewer#load_logo + | Intermediate _ -> assert false (* only the engine may be in this state *) + in + script#addObserver sequents_observer; + script#addObserver browser_observer + + (** {{{ Debugging *) +let _ = + if BuildTimeConf.debug then begin + gui#main#debugMenu#misc#show (); + let addDebugItem ~label callback = + let item = + GMenu.menu_item ~packing:gui#main#debugMenu_menu#append ~label () in + ignore (item#connect#activate callback) in + let addDebugSeparator () = + ignore (GMenu.separator_item ~packing:gui#main#debugMenu_menu#append ()) + in + addDebugItem "dump environment to \"env.dump\"" (fun _ -> + let oc = open_out "env.dump" in + CicEnvironment.dump_to_channel oc; + close_out oc); + addDebugItem "load environment from \"env.dump\"" (fun _ -> + let ic = open_in "env.dump" in + CicEnvironment.restore_from_channel ic; + close_in ic); + addDebugItem "dump universes" (fun _ -> + List.iter (fun (u,_,g) -> + prerr_endline (UriManager.string_of_uri u); + CicUniv.print_ugraph g) (CicEnvironment.list_obj ()) + ); + addDebugItem "dump environment content" (fun _ -> + List.iter (fun (u,_,_) -> + prerr_endline (UriManager.string_of_uri u)) + (CicEnvironment.list_obj ())); + addDebugItem "dump script status" script#dump; + addDebugItem "dump configuration file to ./foo.conf.xml" (fun _ -> + Helm_registry.save_to "./foo.conf.xml"); + addDebugItem "dump metasenv" + (fun _ -> + if script#onGoingProof () then + HLog.debug (CicMetaSubst.ppmetasenv [] script#proofMetasenv)); + addDebugItem "print top-level grammar entries" + CicNotationParser.print_l2_pattern; + addDebugItem "dump moo to stderr" (fun _ -> + let grafite_status = (MatitaScript.current ())#grafite_status in + let moo = grafite_status.moo_content_rev in + List.iter + (fun cmd -> + prerr_endline + (GrafiteAstPp.pp_command + ~term_pp:(fun _ -> assert false) + ~obj_pp:(fun _ -> assert false) + cmd)) + (List.rev moo)); + addDebugItem "print metasenv goals and stack to stderr" + (fun _ -> + prerr_endline ("metasenv goals: " ^ String.concat " " + (List.map (fun (g, _, _) -> string_of_int g) + (MatitaScript.current ())#proofMetasenv)); + prerr_endline ("stack: " ^ Continuationals.Stack.pp + (GrafiteTypes.get_stack (MatitaScript.current ())#grafite_status))); + addDebugItem "Print current proof term" + (fun _ -> + HLog.debug + (CicPp.ppterm + (match + (MatitaScript.current ())#grafite_status.GrafiteTypes.proof_status + with + | GrafiteTypes.No_proof -> (Cic.Implicit None) + | Incomplete_proof i -> let _,_,_subst,p,_, _ = i.GrafiteTypes.proof in p + | Proof p -> let _,_,_subst,p,_, _ = p in p + | Intermediate _ -> assert false))); + addDebugItem "Print current proof (natural language) to stderr" + (fun _ -> + prerr_endline + (ApplyTransformation.txt_of_cic_object 120 GrafiteAst.Declarative "" + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + (match + (MatitaScript.current ())#grafite_status.GrafiteTypes.proof_status + with + | GrafiteTypes.No_proof -> assert false + | Incomplete_proof i -> + let _,m,_subst,p,ty, attrs = i.GrafiteTypes.proof in + Cic.CurrentProof ("current (incomplete) proof",m,p,ty,[],attrs) + | Proof (_,m,_subst,p,ty, attrs) -> + Cic.CurrentProof ("current proof",m,p,ty,[],attrs) + | Intermediate _ -> assert false))); +(* addDebugItem "ask record choice" + (fun _ -> + HLog.debug (string_of_int + (MatitaGtkMisc.ask_record_choice ~gui ~title:"title" ~message:"msg" + ~fields:["a"; "b"; "c"] + ~records:[ + ["0"; "0"; "0"]; ["0"; "0"; "1"]; ["0"; "1"; "0"]; ["0"; "1"; "1"]; + ["1"; "0"; "0"]; ["1"; "0"; "1"]; ["1"; "1"; "0"]; ["1"; "1"; "1"]] + ()))); *) +(* addDebugItem "rotate light bulbs" + (fun _ -> + let nb = gui#main#hintNotebook in + nb#goto_page ((nb#current_page + 1) mod 3)); *) + addDebugSeparator (); +(* + addDebugItem "meets between L and R" + (fun _ -> + let l = CoercDb.coerc_carr_of_term (CicUtil.term_of_uri + (UriManager.uri_of_string "cic:/matita/test/L.ind#xpointer(1/1)" )) + in + let r = CoercDb.coerc_carr_of_term (CicUtil.term_of_uri + (UriManager.uri_of_string "cic:/matita/test/R.ind#xpointer(1/1)" )) + in + let meets = CoercGraph.meets l r in + prerr_endline "MEETS:"; + List.iter (fun carr -> prerr_endline (CicPp.ppterm (CoercDb.term_of_carr + carr))) meets + ); + addDebugSeparator (); +*) + addDebugItem "disable high level pretty printer" + (fun _ -> CicMetaSubst.use_low_level_ppterm_in_context := true); + addDebugItem "enable high level pretty printer" + (fun _ -> CicMetaSubst.use_low_level_ppterm_in_context := false); +(* ZACK moved to the View menu + addDebugItem "disable all (pretty printing) notations" + (fun _ -> CicNotation.set_active_notations []); + addDebugItem "enable all (pretty printing) notations" + (fun _ -> + CicNotation.set_active_notations + (List.map fst (CicNotation.get_all_notations ()))); +*) + addDebugSeparator (); + addDebugItem "enable multiple disambiguation passes (default)" + (fun _ -> GrafiteDisambiguator.only_one_pass := false); + addDebugItem "enable only one disambiguation pass" + (fun _ -> GrafiteDisambiguator.only_one_pass := true); + addDebugItem "always show all disambiguation errors" + (fun _ -> MatitaGui.all_disambiguation_passes := true); + addDebugItem "prune disambiguation errors" + (fun _ -> MatitaGui.all_disambiguation_passes := false); + addDebugSeparator (); +(* ZACK moved to the View menu + addDebugItem "enable coercions hiding" + (fun _ -> Acic2content.hide_coercions := true); + addDebugItem "disable coercions hiding" + (fun _ -> Acic2content.hide_coercions := false); +*) + addDebugItem "show coercions graph" (fun _ -> + let c = MatitaMathView.cicBrowser () in + c#load (`About `Coercions)); + addDebugItem "show coercions graph (full)" (fun _ -> + let c = MatitaMathView.cicBrowser () in + c#load (`About `CoercionsFull)); + addDebugItem "dump coercions Db" (fun _ -> + List.iter + (fun (s,t,ul) -> + HLog.debug + ((String.concat "," + (List.map + (fun u,saturations -> + UriManager.name_of_uri u ^ + "(" ^ string_of_int saturations ^ ")") + ul)) ^ ":" + ^ CoercDb.name_of_carr s ^ " -> " ^ CoercDb.name_of_carr t)) + (CoercDb.to_list ())); + addDebugSeparator (); + let mview () = (MatitaMathView.sequentsViewer_instance ())#cicMathView in +(* addDebugItem "save (sequent) MathML to matita.xml" + (fun _ -> ignore ((Gdome.domImplementation ())#saveDocumentToFile + ~doc:(HExtlib.unopt (mview ())#get_document) ~name:"matita.xml" ())); *) + addDebugItem "load (sequent) MathML from matita.xml" + (fun _ -> (mview ())#load_uri ~filename:"matita.xml"); + addDebugItem "autoWin" + (fun _ -> MatitaAutoGui.auto_dialog Auto.get_auto_status); + end + (** Debugging }}} *) + + (** {2 Command line parsing} *) + +let set_matita_mode () = + let matita_mode = + if Filename.basename Sys.argv.(0) = "cicbrowser" || + Filename.basename Sys.argv.(0) = "cicbrowser.opt" + then "cicbrowser" + else "matita" + in + Helm_registry.set "matita.mode" matita_mode + + (** {2 Main} *) + +let _ = + set_matita_mode (); + at_exit (fun () -> print_endline "\nThanks for using Matita!\n"); + Sys.catch_break true; + let args = Helm_registry.get_list Helm_registry.string "matita.args" in + if Helm_registry.get "matita.mode" = "cicbrowser" then (* cicbrowser *) + let browser = MatitaMathView.cicBrowser () in + let uri = match args with [] -> "cic:/" | _ -> String.concat " " args in + browser#loadInput uri + else begin (* matita *) + (try gui#loadScript (List.hd args) with Failure _ -> ()); + gui#main#mainWin#show (); + end; + try + GtkThread.main () + with Sys.Break -> + Sys.set_signal Sys.sigint + (Sys.Signal_handle + (fun _ -> + prerr_endline "Still cleaning the library: don't be impatient!")); + prerr_endline "Matita is cleaning up. Please wait."; + try + let baseuri = + GrafiteTypes.get_string_option + (MatitaScript.current ())#grafite_status "baseuri" + in + LibraryClean.clean_baseuris [baseuri] + with GrafiteTypes.Option_error _ -> () + +(* vim:set foldmethod=marker: *) diff --git a/matita/matita.txt b/matita/matita.txt new file mode 100644 index 000000000..378fa5a4b --- /dev/null +++ b/matita/matita.txt @@ -0,0 +1,458 @@ +### + Regole di eliminazione per tipi induttivi: + > - as you point it out, unit implies small, hence the clause "if + > Environ.engagement ..." is useles; revision 1.46 apparently missed + > this point; + and I was wrong. Components of constructors that are arities in Prop + (i.e. of the form ... -> Prop) are considered as unit (at least in + Coq). Hence you can have non small unit types. The typical example is + + Inductive T : Prop := C : Prop -> T. + + As a consequence, my modification of the code of Indtypes.allowed_sorts + introduced a consistency hole (with elimination from T to Type, Prop + becomes equivalent to T and system Type:Type becomes a subsystem of + Coq). If you have a similar allowance in Matita, it may be problematic + too. + + + +** introdurre una tattica primitiva "enlarge_metasenv" che cambia il metasenv + aggiungendo nuove meta e tenendo traccia dei nuovi goal aperti; usarla + ovunque rimuovendo ProofEngineHelpers.compare_metasenv. Questo dovrebbe + anche permettere a lungo termine di rendere lo stato un tipo opaco. + + +Possibile causa di rallentamenti: +1. The last commit that fixed unification of compound coercions with + applied atomic coercions used to introduce too many compound coercions + at the end. In this commit we fix the problem in a brutal way by + mergin coercions every time CicMetaSubst.apply_subst is called. + To be refined later on. + + Ferruccio ha cambiato matita.lang: + > iforall + > iexists + +TODO + NUCLEO + - http://mowgli.cs.unibo.it:58084/proofCheck?uri=cic:/Coq/Reals/Rtopology/interior_P3.con + - i files di coq non hanno gli universi e hanno Type senza l'id numerico + per ora vengono considerati come con grafo vuoto... + - limit_mul non compila (usare test_library per testare l'intera libreria) + (15:06:07) Zack: http://www.cs.unibo.it/cgi-bin/viewcvs.cgi/helm/gTopLevel/testlibrary.ml?rev=1.20&hideattic=0&content-type=text/vnd.viewcvs-markup + - PREOCCUPANTE: per + inductive i : Prop := K : True (*-> i*) -> i. + noi generiamo i_rec e i_rect con e senza il commento qui sopra; Coq NON + genera i_rec e i_rect quando c'e' un argomento ricorsivo. + (CSC: manca vincolo aggiuntivo non dipendente dalla sorta per il caso in + questione) -> CSC, parzialmente risolto, da finire + - Set predicativo + - bug universi e tipi induttivi (anche in cicElim.ml!!!) + + TATTICHE + - coercions verso sorte: + 1. coercere a una sorta in posizione controvariante: andare verso Prop, + altrimenti verso {Type,Set,CProp} (indifferentemente?) + 2. coercere a una sorta in posizione covariante: la scelta piu' safe e' + andare verso Type, poi verso CProp, poi verso Set, poi verso Prop. + Unico problema: la scelta piu' safe e' anche quella pessima dal punto + di vista dell'estrazione di codice :-( + - fare normalize_pattern : pattern -> goal -> pattern e usarla per + abilitare fase 2 in fold e rewrite + - apply puo' generare termini non ben tipati. + Esempio: p = q e fare apply eq_ind' di p! + - generazione di principi di co-induzione per co-induttivi + - ARGOMENTI IMPLICIT: li vogliamo? come? come disabilitarli localmente? + - file elim.ma: vengono creati lambda dummy e referenziati nell'outtype di + un case + - tattiche e fallimenti: una tattica che non progredisce dovrebbe fallire + - comportamento di tutte le tattiche nei confronti dei let-in + - elim con pattern + - Dare errore significativo al posto di NotWellTypedInterpreation -> CSC + - elim_intros_simpl e rewrite_simpl: ora non viene usata dal + ^^^^^^ ^^^^^^ + toplevel la variante che semplifica. Capire quali sono i problemi + e/o cosa fare delle varianti con semplificazione. + (con sintassi concreta alla \section*, analogamente cut e similia che fanno + intros... ) -> CSC + - eta_expand non usata da nessuno? (ask Andrea?) + - eliminare eta_fix? (aspettare notazione) (correlato con sopra?) + - bug di ferruccio: fare un refresh dei nomi dopo l'applicazione + di una tattica. Di quali nomi fare refresh? (Andrea) di quelli + veramente ambigui, ovvero dell'ultimo binder tale che sotto di + esso un nome viene usato in maniera ambigua. Esempio: + \lambda x. \lambda x. (x x) (dove una x e' -2) ==> fare refresh + \lambda x. \lambda x. (x x) (dove entrambe sono -1) ==> non fare refresh + Capita quando un tipo dall'environment (e.g. \lambda x.T) + viene inserito in un contesto (e.g. x:nat) dove le variabili + sono gia' state legate in precedenza. + + GUI GRAFICA + - cut & paste di pattern profondi nelle ipotesi + - cut & paste di inner-types non chiusi non funzionanti + - cut & paste di congetture nello script delle prove non funzionante + - keybinding globali: CTRL-{su,giu,...} devono fungere anche quando altre + finestre hanno il focus (e.g. cicBrowser). C'e' gia' da qualche parte il + codice che aggiunge i keybinding a tutte le eventBox, e' da ripristinare + - la finestrella per i development ha i pulsanti non sensitive. + - l'entry "Save" da menu non e' context sensitive (ti fa salvare anche + quando il file non e' stato modificato) + - non semplificherebbe le cose fare in modo che matitaScript sia un widget + (cosi' come lo e' matitaMathView) che eredita da GtkSourceView e mantiene + internamente lo status di matita etc. Appositi segnali permetterebbero di + evitare tutte le chiamate al singleton #instance di matitaScript, che + verrebbe creato dentro a matitaGui (o forse meglio dentro a matita e passato + a matitaGui). Si semplificherebbe forse anche la gestione di script + multipli? Forse no, perche' comunque ci puo' essere sempre solamente uno + ed un solo matitaScript (da spostare da un tab a un altro). + - la barra di stato: c'e' ma non funziona? + + - feedback su hyperlink nei sequenti e nel browser: rendere visibili gli + hyperlink (cursore a "manina"? hyperlink evidenziati?). La maction che + collassa la prova e' fastidiosa: la prova si chiude se non si clicca + correttamente su un hyperlink (anche tooltip sui bottoni) + + - che farne della palette delle tattiche? + - script outline, o meglio: modulo per la gestione del testo dello script + -> Zack + - riattaccare hbugs (brrr...) -> Zack + + - supportare l'apertura di piu' script contemporaneamente in tab/finestre + diversi/e + + GUI LOGICA + - -nodb non usato da disambiguazione: dopo il primo errore si ottiene + un errore di identificatore non trovato (dalla locate?) + - generazione di dipendenze verso .moo di Coq (non esistenti!) -> Zack + - proposta di Zack: NON calcolare (ed esportare) per default gli inner-types; + aggiungere un'opzione per questo a matitac (riduce drasticamente il tempo + di qed) + - la funzione alias_diff e' lentissima (anche se CSC l'ha accellerata di + un fattore 3x) e puo' essere evitata: chi vuole aggiungere alias (la + disambiguazione, il comando "alias" e l'add_obj) deve indicare + esplicitamente quali sono i nuovi alias, evitando cosi' la diff per + scoprirlo + - matitac deve fallire quando matita vuole aggiungere un alias! + - default equality e famiglia non e' undo-aware + - le coercion non sono undo-aware + - nuovo pretty-printer testuale: non stampa usando la notazione + (e.g. guardare output di matitac) + - matitamake foo/a.ma non funziona; bisogna chiamarlo con + matitamake /x/y/z/foo/a.ma + - notazione per i numeri -> Luca e Zack + - non chiudere transitivamente i moo ?? + + DEMONI E ALTRO + +DONE +- compilare Whelp -> Gares, Zack, CSC +- assiomi (manca sintassi concreta e AST) -> CSC +- in MatitaEngine unificare/rimuovere eval_string, eval_from_stream e + eval_from_stream_greedy -> CSC +- menu contestuale (tasto dx) nel sequent viewer -> Zack +- in generale: invece di spiegare gli errori nel momento in cui si sollevano + le eccezioni, farlo quando vengono presentate all'utente. Motivo: il calcolo + del messaggio di errore puo' essere estremamente costoso (e' gia' successo!) + quando poi il messaggio non serve!!! -> CSC +- matitaclean all (non troglie i moo?) -> Gares +- matitaclean (e famiglia) non cancellano le directory vuote + (e per giunta il cicbrowser le mostra :-) -> Gares +- missing feature unification: applicazione di teoremi (~A) quando il goal + e' False o di teoremi $symmetric R P$ quando il goal e' $P(x,y)$. + Fare un passo di delta[-beta?][-iota-etc.] quando da una parte c'e' una + testa rigida (che si espande in una freccia)? Ma il punto e' che il bug + non e' di unificazione, bensi' nella fase di preparazione del goal per + la apply -> CSC, Gares +- Guardare il commento + (*CSC: this code is suspect and/or bugged: we try first without reduction + and then using whd. However, the saturate_term always tries with full + reduction without delta. *) + in primitiveTactics.ml. Potrebbe essere causa di rallentamento della apply + oltre che di bug! -> CSC, Gares +- codice di inizializzazione di matita, matitac, matitatop replicato e non + in sync -> Gares +- tutte gli script che parsano (e.g. matitaclean, matitadep) debbono + processare la notazione per evitare errori di parsing (visibili ora + che e' stata committata la contrib list)! -> Gares +- E' possibile fare "Build" senza selezionare nulla, ottenendo un + assert false -> Gares +- disambiguazione: attualmente io (CSC) ho committato la versione di + disambiguate.ml che NON ricorda gli alias in caso di disambiguazione + univoca (senza scelte per l'utente). [ cercare commento "Experimental" ] + Il problema di questa soluzione e' che rallenta in maniera significativa + l'esecuzione degli script. DOMANDA: quanto costano le fasi di + fetch/decode/execute delle linee dello script? + Una possibile alternativa e' avere alias "soft": se la disambiguazione + fallisce gli alias soft vengono ripuliti e si riprova. + Altra soluzione (Gares): avere alias multipli e provare tutti gli alias + multipli. Da combinare con il "ritenta con istanze multiple in caso di + fallimento". + SOLUZIONE PENSATA CON ANDREA: 1. la interpretate aggiunge un alias + implicito; 2. gli alias vengono ricordati come nella soluzione originale + (e veloce); 3. se la disambiguazione fallisce, allora gli alias vengono + dimenticati (quali? tutti? tutti tranne quelli chiesti all'utente?) + e si ritenta; se fallisce ancora si generano + istanze differenti e si ritenta; 4. ritentare anche senza e poi con + coercions? oppure ordinare preferendo la soluzione che non ha introdotto + coercions?; 5. che fare se alla fine restano piu' scelte? se si mettono + gli alias nello script viene un paciugo, credo! in particolare quando + vengono usate n istanze -> Zack, CSC +- theorem t: True. elim O. ==> BOOM! unificazione di una testa flessibile con + True -> Gares +- parsing contestuale (tattiche replace, change e forse altre) + capire dove fare la select per avere i contesti in cui disambiguare gli + altri argomenti. -> Zack +- tattica unfold su rel a let-in bound variables: c'e' ancora un bug + aperto: "unfold x in H:..." la x passata alla unfold vive nel contesto + del goal e non in quello del pattern. Pertanto invece di cercare di + fare unfolding di x viene fatto unfolding di altro. + Soluzione: la funzione ProofEngineHelpers.select deve tornare una + funzione per rilocare i termini nel contesto giusto. + Esempio: + theorem t: let uno \def S O in uno + uno = S uno \to uno=uno. + intros. unfold uno in H. + NOTA: questo bug e' legato a quello di parsing in presenza di tattiche + con pattern, visto che in tal caso e' l'intero parsing a dover essere + fatto in un contesto differente. Risolvendo quel bug si risolve + automaticamente anche questo. + -> Zack +- Usare il cicbrowser per fare "Whelp instance": lui riscrive la barra + con la notazione alla Coq V7.0 che non riesce piu' a riparsare! -> Zack +- implementare inclusione file di configurazione (perche' ora tutti + i demoni scopiazzano venti righe per via del getter embedded :-( -> Zack +- simplify non debbono zeta-espandere i let-in -> CSC, Gares +- integrare nuova contrib ferruccio nel bench notturno e rilocarla in + contribs o qualcosa del genere -> CSC +- CRITICO: quando l'environment non e' trusted non compila la library di + matita!!! -> Gares, CSC +- bug di unsharing -> CSC +- CRITICO (trovato anche da Ferruccio): typechecking di + cic:/Coq/ring/Quote/index_eq_prop.con + asserzione del nucleo (applicazione senza argomenti). -> CSC +- verificare se tutte le query sono ora ottimizzate (usando il comando + explain) e usano gli indici in maniera ottimale; inoltre migliorare gli + indici sulle tabelle hits and count -> CSC +- ???????????? Perche'? + mowgli:~# du -s /var/lib/mysql/mowgli/ + 250696 /var/lib/mysql/mowgli/ + mowgli:~# du -s /var/lib/mysql/matita/ + 455096 /var/lib/mysql/matita/ -> CSC +- library/nat/primes.ma: ex_prime ci mette un secolo il db (binding) a fare + la Mysql.exec che ritorna una lista vuota di risultati. Investigare. + Anche peggio in library/nat/minimization/f_max_true. -> CSC +- integrare il famoso logo mancante (anche nell'About dialog) -> CSC +- invertibilita' dell'inserimento automatico di alias: quando si torna + su bisognerebbe tornare su di un passo e non fare undo degli alias + (Zack: nella history ci sono anche gli offset per sapere a che pezzo di + script uno stato appartiene) -> CSC +- bug di refresh del widget quando si avanza ("swap" tra la finestra dei + sequenti e la finestra dello script) -> CSC +- sensitiveness per goto begin/end/etc. (???) -> Gares +- cut&paste stile "X": rimane la parte blu e lockata! -> CSC +- highlight degli errori di parsing nello script -> CSC +- quando si fa una locate nel cicbrowser viene mangiato un pezzo di testo + dalla finestra principale!!! -> CSC +- sensitiveness per copy/paste/cut/delete nel menu Edit -> CSC +- fare "matita foo" (dove foo non esiste), cambiare qualcosa e uscire senza + salvare. In verita' foo e' stato scritto lo stesso! -> CSC +- matitaclean deve rimuovere anche i .moo; in alternativa il makefile + non deve basarsi sui .moo per decidere se qualcosa e' stato compilato o meno + -> CSC, Gares +- matitaclean all (o matitamake cleanall) dovrebbe radere al suolo la + directory .matita -> CSC, Gares +- icone standard per zoom-in/out/= e piu' aderenza alle Gnome Interface + Guidelines (e.g. about dialog) -> CSC +- salvare la parte di testo lockata dagli effetti di undo/redo con + (shift-)ctrl-Z e anche usando il menu che si apre con il tasto destro -> CSC +- fare in modo che il testo caricato inizialmente da matita non sia + undoable (usando i metodi begin/end_not_undoable_action di gtk_source_view) + -> Gares +- Implementare menu edit: cut/copy/undo/etc. -> CSC +- gestione dei path per include: il path deve essere assoluto? da decidere ... + ( -I ?? o chiedere a matitamake la root e farci una find? ) -> Gares +- freeze durante avanzamento -> Gares, CSC +- tornare indietro (verso il cursore) in matita dovrebbe essere O(1) e non un + Undo passo passo (sembra che il collo di bottiglia sia fare iterare su ogni + uri da togliere (accorpare almeno il lavoro sul db magari aiuta) -> Gares, CSC +- quando si sposta il punto di esecuzione dello script cambiare la parte di + script visibile nella finestra dello script -> Gares, CSC +- find & replace -> Gares +- Bug di cut&paste: se si fa cut&paste di testo lockato si ottiene testo + lockato! -> Gares +- Bug: non disambigua + inductive i (x:nat) : bool \to Prop \def K : bool \to (i x true) \to (i x false). + perche' non inserisce nat nel domain di disambiguazione. Deve esserci un bug + stupido da qualche parte -> CSC +- Bug vari nella generazione dei principi di eliminazione: + 1. generazione nomi (usa ref incrementata localmente) -> Andrea + 2. prodotti dipendenti come non-dipendenti (visibili eseguendo passo + passo il test inversion.ma) -> CSC, Gares + 3. usato trucco outtype non dipendenti per il case -> CSC, Gares +- controllo per script modificato o meno prima di uscire -> Gares +- LApply deve prendere in input gli identificatori che va a generare; + lascio a Ferruccio la scelta della sintassi concreta -> Ferruccio +- fare tornare a matitac -1 quando lo stato finale e' + diverso da No_proof, non eseguire comandi quando lo + stato e' diverso da No_proof -> CSC +- uri_of_term and term_of_uri: cambiare il tipo per far + tornare delle uri!!! -> CSC +- intro = intros 1 -> Gares +- timetravel (urimanager) -> Gares +- implementare macro in matitaScript.ml -> Gares +- history deve aggiornare anche la whelp bar -> Gares +- commenti exeguibili (forse devono essere una lista e non + un singolo executable e forse devono contenere anche Note + e non solo Executable) -> Gares +- spostare il codice di creazione delle tabelle da + MatitaDb, al momento quelle create da matita possono + andare out of sync con quelle create dai file .sql -> Gares +- tree update in background -> Gares +- update del getter in background -> Zack +- agganciare href_callback del sequent_viewer -> Zack +- shortcut varie per script handling -> Zack +- operazioni rimanenti su script (top, bottom, jump) -> Zack +- lighting-ls-getter in matita -> Gares +- riagganciare toolbar -> Zack +- evitare che n-mila tattiche Goal siano nello script + (una per ogni cambio di tab) -> Zack +- implementazione comandi rimanenti in matitaEngine.ml -> Gares +- sintassi per gli alias -> Gares +- implementazione script handling (sopra engine) -> Zack +- matitaSync all'indietro -> Gares +- riagganciare GUI -> Zack + +(**********************************************************************) + +comandi: + - interattivi (solo da gui) + - Macro/Comandi (check, print, hint, undo, locate, match) + potrebbero anche non avere sintassi concreta, del tipo che + check e' solo un bottone che apre una finetra in cui puoi + scrivere un termine o selezionarlo dalla prova corrente + - batch (sono gli unici che stanno nel .ma) + - Tattiche, theorem, alias (cambiano la prova) + + + MOUSE +-------------------------------------------+ + gui (macro: hint) | SHELL + (disambiguatore) | + +-----------------+---------------+----------------------------------- + | matita (status) | | matitac + | (log) (sync) | but2log | fold ( fun s l -> engine l s) file + +-----------------+---------------+----------------------------------- + | lingua:/sintassi concreta non ambigua delle tattiche+Qed,Thm,alias/ + +---------------------------------------------------------- + | engine: TacticAst (cic) -> status -> status + | ma non usa il campo alias dello status +---------+---------------------------------------------------------- + ocaml +-------------------------------------------------------------------- + + +engine: + - accetta solo linee non ambigue + - alias: + alias ident nat = "cic:/matita/gares/nat.ind#(1/1)". + alias number = (natural|real|positive|integer). + + + +matita: + - mantiene uno stack di stati + - mantiene un log sync con gli stati + - offre delle api per generare la sintassi concreta che puo' servire + alla gui (la gui fa una chiamata a funzione e matita genera "auto." + cosi' la sintassi la gui non la vede mai e la tratta al massimo come un + testo semplice e basta (insomma, metterei in matita il generatore di + sintassi concreta) but2log + - ha il controllo... ovvero anche la gui viene usata da matita, o per sapere + la prossima azione o per chidere di scegliere il termine tra una lista + + (stato :: tl) (log , (start,end) :: tl) + + +----------+ + | | + +----------+ + +gui: + - step + - choose + +stato: + - alias + - proof status option + - metadati relativi allo script per il sync + - settings "baseuri/url/" eccc + - + +alias + - sintassi concreta + +engine prende in input + - AST di Cic (tactic ast) + +sync: + - presi 2 stati fa il diff e lo somma/sottrae al DB + +(**********************************************************************) + +script handling +- ad ogni script sul quale l'utente sta lavorando corrispondono + - un modello (vedi sotto) + - un buffer di testo gtk + attributi (usati principalmente per distinguere la + parte di testo immodificabile da quella modificabile) + - una lista di observer che vengono notificati ad ogni cambiamento di stato +- un modello di script e' composto da: + - una lista di stringhe (inizialmente vuota) detta "statement list". Ogni + elemento della lista corrisponde ad uno statement (nel senso di + TacticAst.statement) gia' valutato dall'engine. La parte immodificabile del + buffer di testo corrisponde con le stringhe contenute nella lista + - una lista di stati (inizialmente contenente lo stato vuoto) detta "state + list". Si ha l'invariante che la lunghezza di tale lista e' uguale alla + lunghezza della statements list + 1. Lo stato i-esimo della lista di stati + e' lo stato di matita _prima_ dell'esecuzione dell i-esimo statement + - una stringa, detta "future text", corrispondente alla parte di testo dello + script non ancora valutata. L'ultimo stato della state list e' lo stato + corrente di matita +- relazione tra modello e buffer di testo gtk + - le modifiche al testo del buffer sono possibili solo nella parta non ancora + valutata. Ognuna di esse viene apportata _anche_ al future text + - invariante: e' sempre possibile riscrivere ("redraw") l'intero contenuto del + buffer di testo a partire dal modello, attributi compresi +- oggetto script + - metodi + - new: gtk_text_buffer -> script + - redraw: unit (* ridisegna il contenuto del buffer di testo *) + - advance: ?statement:string -> unit -> unit + (* valuta il primo statement del future text (usando eval_statement + (puo' fallire con una eccezione)), rimuove il testo corrispondente dal + future text, aggiunge alla statement list una entry per ogni statement + ritornato da eval_statement, aggiunge il nuovo stato alla state list, + invoka tutti gli observer + Se c'e' l'argomento opzionale statement, quello e' il testo che viene + passato ad eval_statement, se ha successo nessuna rimozione dal future + text viene effettuata *) + - retract: unit -> unit + (* sposta l'ultimo statement della statement list al future text, toglie + l'ultimo stato della state list, MatitaSync.time_travel + ~present:ultimo_stato ~past:stato_precedente *) + - private eval_statement: string -> MatitaTypes.status * string list + (* parsa lo statement + - se e' un Command o un Tactical (vedi TacticAst) invoca MatitaEngine + passando lo stato corrente + - se e' una Macro la gestisce (= tutte le Macro sono implementate qua) + Ritorna una lista di coppie . La proiezione sulla + prima componente rappresenta gli stati da aggiungere alla state list; + quella sulla seconda gli statement da aggiungere alla statement list. + *) + (* gestione degli observer *) + - add_observer: (MatitaTypes.status -> unit) -> observer_id + - remove_observer: observer_id -> unit + (* gestione del salvataggio *) + - save_to: string -> unit (* ridisegna su file *) + - load_from: string -> unit + (* retract fino allo stato zero, nuovo stato con future text pari al + contenuto del file passato *) + diff --git a/matita/matitaAutoGui.ml b/matita/matitaAutoGui.ml new file mode 100644 index 000000000..c7b06645b --- /dev/null +++ b/matita/matitaAutoGui.ml @@ -0,0 +1,217 @@ +(* Copyright (C) 2003, HELM Team. + * + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +type status = + Cic.context * (int * Cic.term * bool * int * (int * Cic.term) list) list * + (int * Cic.term * int) list * + Cic.term list +let fake_goal = Cic.Implicit None;; +let fake_candidates = [];; + +let start = ref 0;; +let len = ref 10;; + +let pp c t = + let t = + ProofEngineReduction.replace + ~equality:(fun a b -> match b with Cic.Meta _ -> true | _ -> false) + ~what:[Cic.Rel 1] ~with_what:[Cic.Implicit None] ~where:t + in + ApplyTransformation.txt_of_cic_term ~map_unicode_to_tex:false + max_int [] c t +;; +let pp_goal context x = + if x == fake_goal then "" else pp context x +;; +let pp_candidate context x = pp context x + +let sublist start len l = + let rec aux pos len = function + | [] when pos < start -> aux (pos+1) len [] + | [] when len > 0 -> + (0,fake_goal, false, 0, fake_candidates) :: aux (pos+1) (len-1) [] + | [] (* when len <= 0 *) -> [] + | he::tl when pos < start -> aux (pos+1) len tl + | he::tl when pos >= start && len > 0 -> he::aux (pos+1) (len-1) tl + | he::tl (* when pos >= start && len <= 0 *) -> [] + in + aux 0 len l +;; + +let cell_of_candidate height context ?(active=false) g id c = + let tooltip = GData.tooltips () in (* should be only one isn't it? *) + let button = + GButton.button + ~label:(pp_candidate context c(* ^ " - " ^ string_of_int id*)) + () + in + button#misc#set_size_request ~height (); + if active then + button#misc#set_sensitive false; + let text = + "Follow computation of "^pp_candidate context c^" on "^pp_goal context g + in + tooltip#set_tip ~text (button :> GObj.widget); + ignore(button#connect#clicked + (fun _ -> + let menu = GMenu.menu () in + let follow = GMenu.menu_item ~label:"Follow" () in + let prune = GMenu.menu_item ~label:"Prune" () in + ignore (follow#connect#activate + (fun _ -> HLog.warn (string_of_int id); Auto.give_hint id)); + ignore (prune#connect#activate + (fun _ -> HLog.warn (string_of_int id); Auto.give_prune_hint id)); + menu#append follow; + menu#append prune; + menu#popup 0 (GtkMain.Main.get_current_event_time ()))); + button +;; +let cell_of_goal height win_width context goal = + GMisc.label + ~markup:(pp_goal context goal) ~xalign:0.0 + ~width:(min (win_width * 60 / 100) 500) + ~line_wrap:false + ~ellipsize:`END + ~height + () +;; +let cell_of_row_header height n k id = + GMisc.label + ~markup:("" ^ string_of_int n ^ "(" ^ + string_of_int id ^ "|" ^ string_of_int k ^ ")") + ~line_wrap:true ~justify:`LEFT ~height ~width:80 () +;; +let cell_of_candidates height grey context goal cads = + let hbox = GPack.hbox () in + match cads with + | [] -> hbox + | (id,c)::tl -> + hbox#pack + (cell_of_candidate height ~active:grey + context goal id c :> GObj.widget); + List.iter + (fun (id,c) -> + hbox#pack (cell_of_candidate height context goal id c :> GObj.widget)) tl; + hbox +;; + +let elems_to_rows height context win_width (table : GPack.table) (or_list) = + let height = height / ((List.length or_list) + 1) in + let _ = + List.fold_left + (fun position (goal_id, goal, grey, depth, candidates) -> + table#attach ~left:0 ~top:position + (cell_of_row_header height (position + !start) + depth goal_id :> GObj.widget); + table#attach ~left:1 ~top:position ~fill:`BOTH + (cell_of_goal height win_width context goal :> GObj.widget); + table#attach ~left:2 ~top:position + (cell_of_candidates height grey context goal candidates :> GObj.widget); + position+1) + 0 or_list + in + () +;; + +let old_displayed_status = ref [];; +let old_size = ref 0;; + +let fill_win (win : MatitaGeneratedGui.autoWin) cb = + let init = Unix.gettimeofday () in + try + let (status : status) = cb () in + let win_size = win#toplevel#misc#allocation.Gtk.width in + let ctx, or_list, and_list, last_moves = status in + let displayed_status = + sublist !start !len + (or_list @ (List.map (fun (id,x,d) -> id,x,false,d,[]) and_list)) + in + if displayed_status <> !old_displayed_status || !old_size <> win_size then + begin + old_displayed_status := displayed_status; + old_size := win_size; + win#labelLAST#set_text + (String.concat ";" (List.map (pp_candidate ctx) last_moves)); + List.iter win#table#remove win#table#children; + let height = win#viewportAREA#misc#allocation.Gtk.height in + elems_to_rows height ctx win_size win#table displayed_status; + Printf.eprintf + "REDRAW COST: %2.1f\n%!" (Unix.gettimeofday () -. init); + end + with exn -> prerr_endline (Printexc.to_string exn); () +;; + +let auto_dialog elems = + let win = new MatitaGeneratedGui.autoWin () in + let width = Gdk.Screen.width () in + let height = Gdk.Screen.height () in + let main_w = width * 70 / 100 in + let main_h = height * 60 / 100 in + win#toplevel#resize ~width:main_w ~height:main_h; + win#check_widgets (); + win#table#set_columns 3; + win#table#set_col_spacings 6; + win#table#set_row_spacings 4; + ignore(win#buttonUP#connect#clicked + (fun _ -> start := max 0 (!start -1); fill_win win elems)); + ignore(win#buttonDOWN#connect#clicked + (fun _ -> incr start; fill_win win elems)); + ignore(win#buttonCLOSE#connect#clicked + (fun _ -> + Auto.pause false; + Auto.step (); + win#toplevel#destroy (); + GMain.Main.quit ())); + ignore(win#toplevel#event#connect#delete + (fun _ -> + Auto.pause false; + Auto.step (); + win#toplevel#destroy (); + GMain.Main.quit ();true)); + let redraw_callback _ = fill_win win elems;true in + let redraw = GMain.Timeout.add ~ms:400 ~callback:redraw_callback in + ignore(win#buttonPAUSE#connect#clicked + (fun _ -> + Auto.pause true; + win#buttonPLAY#misc#set_sensitive true; + win#buttonPAUSE#misc#set_sensitive false;)); + ignore(win#buttonPLAY#connect#clicked + (fun _ -> + Auto.pause false; + Auto.step (); + win#buttonPLAY#misc#set_sensitive false; + win#buttonPAUSE#misc#set_sensitive true;)); + ignore(win#buttonNEXT#connect#clicked + (fun _ -> Auto.step ())); + Auto.pause true; + win#buttonPLAY#misc#set_sensitive true; + win#buttonPAUSE#misc#set_sensitive false; + fill_win win elems; + win#toplevel#show (); + GtkThread.main (); + GMain.Timeout.remove redraw; +;; + diff --git a/matita/matitaAutoGui.mli b/matita/matitaAutoGui.mli new file mode 100644 index 000000000..6715298e2 --- /dev/null +++ b/matita/matitaAutoGui.mli @@ -0,0 +1,32 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type status = + Cic.context * + (int * Cic.term * bool * int * (int * Cic.term) list) list * + (int * Cic.term * int) list * Cic.term list +val auto_dialog : (unit -> status) -> unit diff --git a/matita/matitaEngine.ml b/matita/matitaEngine.ml new file mode 100644 index 000000000..74c857caf --- /dev/null +++ b/matita/matitaEngine.ml @@ -0,0 +1,159 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let debug = false ;; +let debug_print = if debug then prerr_endline else ignore ;; + +let disambiguate_tactic text prefix_len lexicon_status_ref grafite_status goal tac = + let metasenv,tac = + GrafiteDisambiguate.disambiguate_tactic + lexicon_status_ref + (GrafiteTypes.get_proof_context grafite_status goal) + (GrafiteTypes.get_proof_metasenv grafite_status) + tac + in + GrafiteTypes.set_metasenv metasenv grafite_status,tac + +let disambiguate_command lexicon_status_ref grafite_status cmd = + let baseuri, grafite_status = GrafiteTypes.get_baseuri grafite_status in + let lexicon_status,metasenv,cmd = + GrafiteDisambiguate.disambiguate_command ~baseuri + !lexicon_status_ref (GrafiteTypes.get_proof_metasenv grafite_status) cmd + in + lexicon_status_ref := lexicon_status; + GrafiteTypes.set_metasenv metasenv grafite_status,cmd + +let disambiguate_macro lexicon_status_ref grafite_status macro context = + let metasenv,macro = + GrafiteDisambiguate.disambiguate_macro + lexicon_status_ref + (GrafiteTypes.get_proof_metasenv grafite_status) + context macro + in + GrafiteTypes.set_metasenv metasenv grafite_status,macro + +let eval_ast ?do_heavy_checks ?clean_baseuri lexicon_status + grafite_status (text,prefix_len,ast) += + let lexicon_status_ref = ref lexicon_status in + let baseuri, grafite_status = GrafiteTypes.get_baseuri grafite_status in + let new_grafite_status,new_objs = + GrafiteEngine.eval_ast + ~disambiguate_tactic:(disambiguate_tactic text prefix_len lexicon_status_ref) + ~disambiguate_command:(disambiguate_command lexicon_status_ref) + ~disambiguate_macro:(disambiguate_macro lexicon_status_ref) + ?do_heavy_checks ?clean_baseuri grafite_status (text,prefix_len,ast) in + let new_lexicon_status = + LexiconSync.add_aliases_for_objs !lexicon_status_ref new_objs in + let new_aliases = + LexiconSync.alias_diff ~from:lexicon_status new_lexicon_status in + let _,intermediate_states = + List.fold_left + (fun (lexicon_status,acc) (k,((v,_) as value)) -> + let b = + try + (* this hack really sucks! *) + UriManager.buri_of_uri (UriManager.uri_of_string v) = + baseuri + with + UriManager.IllFormedUri _ -> false (* v is a description, not a URI *) + in + if b then + lexicon_status,acc + else + + let new_lexicon_status = + LexiconEngine.set_proof_aliases lexicon_status [k,value] + in + new_lexicon_status, + ((grafite_status,new_lexicon_status),Some (k,value))::acc + ) (lexicon_status,[]) new_aliases + in + ((new_grafite_status,new_lexicon_status),None)::intermediate_states + +exception TryingToAdd of string + +let out = ref ignore + +let set_callback f = out := f + +let eval_from_stream ~first_statement_only ~include_paths ?(prompt=false) + ?do_heavy_checks ?clean_baseuri ?(enforce_no_new_aliases=true) + ?(watch_statuses=fun _ _ -> ()) lexicon_status grafite_status str cb += + let rec loop lexicon_status grafite_status statuses = + let loop = + if first_statement_only then + fun _ _ statuses -> statuses + else + loop + in + if prompt then (print_string "matita> "; flush stdout); + let cont = + try + Some (GrafiteParser.parse_statement ~include_paths str lexicon_status) + with + End_of_file -> None + in + match cont with + | None -> statuses + | Some (lexicon_status,ast) -> + (match ast with + GrafiteParser.LNone _ -> + watch_statuses lexicon_status grafite_status ; + loop lexicon_status grafite_status + (((grafite_status,lexicon_status),None)::statuses) + | GrafiteParser.LSome ast -> + !out ast; + cb grafite_status ast; + let new_statuses = + eval_ast ?do_heavy_checks ?clean_baseuri lexicon_status + grafite_status ("",0,ast) in + if enforce_no_new_aliases then + List.iter + (fun (_,alias) -> + match alias with + None -> () + | Some (k,((v,_) as value)) -> + let newtxt = + DisambiguatePp.pp_environment + (DisambiguateTypes.Environment.add k value + DisambiguateTypes.Environment.empty) + in + raise (TryingToAdd newtxt)) new_statuses; + let grafite_status,lexicon_status = + match new_statuses with + [] -> assert false + | (s,_)::_ -> s + in + watch_statuses lexicon_status grafite_status ; + loop lexicon_status grafite_status (new_statuses @ statuses)) + in + loop lexicon_status grafite_status [] +;; diff --git a/matita/matitaEngine.mli b/matita/matitaEngine.mli new file mode 100644 index 000000000..83b549ec4 --- /dev/null +++ b/matita/matitaEngine.mli @@ -0,0 +1,65 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val eval_ast : + ?do_heavy_checks:bool -> + ?clean_baseuri:bool -> + LexiconEngine.status -> + GrafiteTypes.status -> + string * int * + ((CicNotationPt.term, CicNotationPt.term, + CicNotationPt.term GrafiteAst.reduction, CicNotationPt.term CicNotationPt.obj, string) + GrafiteAst.statement) -> + ((GrafiteTypes.status * LexiconEngine.status) * + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) option + ) list + + +(* heavy checks slow down the compilation process but give you some interesting + * infos like if the theorem is a duplicate *) + +(* should be used only by the compiler since it looses the + * disambiguation_context (text,prefix_len,_) *) +val eval_from_stream : + first_statement_only:bool -> + include_paths:string list -> + ?prompt:bool -> + ?do_heavy_checks:bool -> + ?clean_baseuri:bool -> + ?enforce_no_new_aliases:bool -> (* default true *) + ?watch_statuses:(LexiconEngine.status -> GrafiteTypes.status -> unit) -> + LexiconEngine.status -> + GrafiteTypes.status -> + Ulexing.lexbuf -> + (GrafiteTypes.status -> + (CicNotationPt.term, CicNotationPt.term, + CicNotationPt.term GrafiteAst.reduction, CicNotationPt.term CicNotationPt.obj, string) + GrafiteAst.statement -> unit) -> + ((GrafiteTypes.status * LexiconEngine.status) * + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) option + ) list + +(* this callback is called on every grafite command *) +val set_callback: (GrafiteParser.ast_statement -> unit) -> unit diff --git a/matita/matitaExcPp.ml b/matita/matitaExcPp.ml new file mode 100644 index 000000000..8888b8dfe --- /dev/null +++ b/matita/matitaExcPp.ml @@ -0,0 +1,212 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let compact_disambiguation_errors all_passes errorll = + let choices = + List.flatten + (List.map + (fun (pass,l) -> + List.map + (fun (env,diff,offset,msg,significant) -> + offset, [[pass], [[pass], env, diff], msg, significant]) l + ) errorll) in + (* Here we are doing a stable sort and list_uniq returns the latter + "equal" element. I.e. we are showing the error corresponding to the + most advanced disambiguation pass *) + let choices = + let choices_compare (o1,_) (o2,_) = compare o1 o2 in + let choices_compare_by_passes (p1,_,_,_) (p2,_,_,_) = + compare p1 p2 in + let rec uniq = + function + [] -> [] + | h::[] -> [h] + | (o1,res1)::(o2,res2)::tl when o1 = o2 -> + let merge_by_name errors = + let merge_by_env errors = + let choices_compare_by_env (_,e1,_) (_,e2,_) = compare e1 e2 in + let choices_compare_by_passes (p1,_,_) (p2,_,_) = + compare p1 p2 in + let rec uniq_by_env = + function + [] -> [] + | h::[] -> [h] + | (p1,e1,_)::(p2,e2,d2)::tl when e1 = e2 -> + uniq_by_env ((p1@p2,e2,d2) :: tl) + | h1::tl -> h1 :: uniq_by_env tl + in + List.sort choices_compare_by_passes + (uniq_by_env (List.stable_sort choices_compare_by_env errors)) + in + let choices_compare_by_msg (_,_,m1,_) (_,_,m2,_) = + compare (Lazy.force m1) (Lazy.force m2) in + let rec uniq_by_msg = + function + [] -> [] + | h::[] -> [h] + | (p1,i1,m1,s1)::(p2,i2,m2,s2)::tl + when Lazy.force m1 = Lazy.force m2 && s1 = s2 -> + uniq_by_msg ((p1@p2,merge_by_env (i1@i2),m2,s2) :: tl) + | h1::tl -> h1 :: uniq_by_msg tl + in + List.sort choices_compare_by_msg + (uniq_by_msg (List.stable_sort choices_compare_by_msg errors)) + in + let res = merge_by_name (res1@res2) in + uniq ((o1,res) :: tl) + | h1::tl -> h1 :: uniq tl + in + (* Errors in phase 3 that are not also in phase 4 are filtered out *) + let filter_phase_3 choices = + if all_passes then choices + else + let filter = + HExtlib.filter_map + (function + (loffset,messages) -> + let filtered_messages = + HExtlib.filter_map + (function + [3],_,_,_ -> None + | item -> Some item + ) messages + in + if filtered_messages = [] then + None + else + Some (loffset,filtered_messages)) + in + filter choices + in + filter_phase_3 + (List.map (fun o,l -> o,List.sort choices_compare_by_passes l) + (uniq (List.stable_sort choices_compare choices))) + in + choices +;; + +let rec to_string = + function + | HExtlib.Localized (floc,exn) -> + let _,msg = to_string exn in + let (x, y) = HExtlib.loc_of_floc floc in + Some floc, sprintf "Error at %d-%d: %s" x y msg + | GrafiteTypes.Option_error ("baseuri", "not found" ) -> + None, + "Baseuri not set for this script. " + ^ "Use 'set \"baseuri\" \"\".' to set it." + | GrafiteTypes.Command_error msg -> None, "Error: " ^ msg + | CicNotationParser.Parse_error err -> + None, sprintf "Parse error: %s" err + | UriManager.IllFormedUri uri -> None, sprintf "invalid uri: %s" uri + | CicEnvironment.Object_not_found uri -> + None, sprintf "object not found: %s" (UriManager.string_of_uri uri) + | Unix.Unix_error (code, api, param) -> + let err = Unix.error_message code in + None, "Unix Error (" ^ api ^ "): " ^ err + | HMarshal.Corrupt_file fname -> None, sprintf "file '%s' is corrupt" fname + | HMarshal.Format_mismatch fname + | HMarshal.Version_mismatch fname -> + None, + sprintf "format/version mismatch for file '%s', please recompile it'" + fname + | ProofEngineTypes.Fail msg -> None, "Tactic error: " ^ Lazy.force msg + | Continuationals.Error s -> None, "Tactical error: " ^ Lazy.force s + | ProofEngineHelpers.Bad_pattern msg -> + None, "Bad pattern: " ^ Lazy.force msg + | CicRefine.RefineFailure msg + | CicRefine.AssertFailure msg -> + None, "Refiner error: " ^ Lazy.force msg + | CicTypeChecker.TypeCheckerFailure msg -> + None, "Type checking error: " ^ Lazy.force msg + | CicTypeChecker.AssertFailure msg -> + None, "Type checking assertion failed: " ^ Lazy.force msg + | LibrarySync.AlreadyDefined s -> + None, "Already defined: " ^ UriManager.string_of_uri s + | CoercDb.EqCarrNotImplemented msg -> + None, ("EqCarrNotImplemented: " ^ Lazy.force msg) + | GrafiteDisambiguator.DisambiguationError (offset,errorll) -> + let loc = + match errorll with + ((_,_,Some floc,_,_)::_)::_ -> + let (x, y) = HExtlib.loc_of_floc floc in + let x = x + offset in + let y = y + offset in + let floc = HExtlib.floc_of_loc (x,y) in + Some floc + | _ -> None in + let annotated_errorll = + List.rev + (snd + (List.fold_left (fun (pass,res) item -> pass+1,(pass+1,item)::res) + (0,[]) errorll)) in + let choices = compact_disambiguation_errors true annotated_errorll in + let errorll = + (List.map + (function (loffset,l) -> + List.map + (function + passes,envs_and_diffs,msg,significant -> + let _,env,diff = List.hd envs_and_diffs in + passes,env,diff,loffset,msg,significant + ) l + ) choices) in + let rec aux = + function + [] -> [] + | phase::tl -> + let msg = + (List.map (fun (passes,_,_,floc,msg,significant) -> + let loc_descr = + match floc with + None -> "" + | Some floc -> + let (x, y) = HExtlib.loc_of_floc floc in + sprintf " at %d-%d" (x+offset) (y+offset) + in + "*" ^ (if not significant then "(Spurious?) " else "") + ^ "Error" ^ loc_descr ^ ": " ^ Lazy.force msg, + passes) phase) + in + msg@aux tl in + let rec explain = + function + [] -> "" + | (msg,phases)::tl -> + explain tl ^ + "***** Errors obtained during phase" ^ + (if phases = [] then " " else "s ") ^ + String.concat "," (List.map string_of_int phases) ^": *****\n"^ + msg ^ "\n\n" + in + loc, + "********** DISAMBIGUATION ERRORS: **********\n" ^ + explain (aux errorll) + | exn -> None, "Uncaught exception: " ^ Printexc.to_string exn + diff --git a/matita/matitaExcPp.mli b/matita/matitaExcPp.mli new file mode 100644 index 000000000..419b04c73 --- /dev/null +++ b/matita/matitaExcPp.mli @@ -0,0 +1,33 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val compact_disambiguation_errors : + bool -> + (int * ((Stdpp.location list * string * string) list * + (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list * + Stdpp.location option * string Lazy.t * bool) list) list -> + (Stdpp.location option * (int list * (int list * (Stdpp.location list * string * string) list * (DisambiguateTypes.domain_item * DisambiguateTypes.codomain_item) list) list * string Lazy.t * bool) list) list + +val to_string: exn -> Stdpp.location option * string diff --git a/matita/matitaGtkMisc.ml b/matita/matitaGtkMisc.ml new file mode 100644 index 000000000..9c00dfdde --- /dev/null +++ b/matita/matitaGtkMisc.ml @@ -0,0 +1,414 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +exception PopupClosed +open Printf + +let wrap_callback0 f = fun _ -> try f () with Not_found -> assert false +let wrap_callback1 f = fun _ -> try f () with Not_found -> assert false +let wrap_callback2 f = fun _ -> try f () with Not_found -> assert false + +let connect_button (button: #GButton.button) callback = + ignore (button#connect#clicked (wrap_callback0 callback)) + +let connect_toggle_button (button: #GButton.toggle_button) callback = + ignore (button#connect#toggled (wrap_callback1 callback)) + +let connect_menu_item (menu_item: #GMenu.menu_item) callback = + ignore (menu_item#connect#activate (wrap_callback2 callback)) + +let connect_key (ev:GObj.event_ops) ?(modifiers = []) ?(stop = false) key + callback += + ignore (ev#connect#key_press (fun key' -> + let modifiers' = GdkEvent.Key.state key' in + (match key' with + | key' when GdkEvent.Key.keyval key' = key + && List.for_all (fun m -> List.mem m modifiers') modifiers -> + callback (); + stop + | _ -> false))) + +let toggle_widget_visibility ~(widget: GObj.widget) + ~(check: GMenu.check_menu_item) += + ignore (check#connect#toggled (fun _ -> + if check#active then widget#misc#show () else widget#misc#hide ())) + +let toggle_window_visibility ~(window: GWindow.window) + ~(check: GMenu.check_menu_item) += + ignore (check#connect#toggled (fun _ -> + if check#active then window#show () else window#misc#hide ())); + ignore (window#event#connect#delete (fun _ -> + window#misc#hide (); + check#set_active false; + true)) + +let toggle_win ?(check: GMenu.check_menu_item option) (win: GWindow.window) () = + if win#is_active then win#misc#hide () else win#show (); + match check with + | None -> () + | Some check -> check#set_active (not check#active) + +let toggle_callback ~callback ~(check: GMenu.check_menu_item) = + ignore (check#connect#toggled (fun _ -> callback check#active)) + +let add_key_binding key callback (evbox: GBin.event_box) = + ignore (evbox#event#connect#key_press (function + | key' when GdkEvent.Key.keyval key' = key -> + callback (); + false + | _ -> false)) + +class multiStringListModel ~cols (tree_view: GTree.view) = + let column_list = new GTree.column_list in + let text_columns = + let rec aux = function + | 0 -> [] + | n -> column_list#add Gobject.Data.string :: aux (n - 1) + in + aux cols + in + let list_store = GTree.list_store column_list in + let renderers = + List.map + (fun text_column -> + (GTree.cell_renderer_text [], ["text", text_column])) + text_columns + in + let view_columns = + List.map + (fun renderer -> GTree.view_column ~renderer ()) + renderers + in + object (self) + val text_columns = text_columns + + initializer + tree_view#set_model (Some (list_store :> GTree.model)); + List.iter + (fun view_column -> ignore (tree_view#append_column view_column)) + view_columns + + method list_store = list_store + + method easy_mappend slist = + let tree_iter = list_store#append () in + List.iter2 + (fun s text_column -> + list_store#set ~row:tree_iter ~column:text_column s) + slist text_columns + + method easy_minsert pos s = + let tree_iter = list_store#insert pos in + List.iter2 + (fun s text_column -> + list_store#set ~row:tree_iter ~column:text_column s) + s text_columns + + method easy_mselection () = + List.map + (fun tree_path -> + let iter = list_store#get_iter tree_path in + List.map + (fun text_column -> + list_store#get ~row:iter ~column:text_column) + text_columns) + tree_view#selection#get_selected_rows + end + +class stringListModel (tree_view: GTree.view) = + object (self) + inherit multiStringListModel ~cols:1 tree_view as multi + + method list_store = multi#list_store + + method easy_append s = + multi#easy_mappend [s] + + method easy_insert pos s = + multi#easy_minsert pos [s] + + method easy_selection () = + let m = List.map + (fun tree_path -> + let iter = self#list_store#get_iter tree_path in + List.map + (fun text_column -> + self#list_store#get ~row:iter ~column:text_column) + text_columns) + tree_view#selection#get_selected_rows + in + List.map (function [x] -> x | _ -> assert false) m + end + +class taggedStringListModel ~(tags:(string * GdkPixbuf.pixbuf) list) + (tree_view: GTree.view) += + let column_list = new GTree.column_list in + let tag_column = column_list#add Gobject.Data.gobject in + let text_column = column_list#add Gobject.Data.string in + let list_store = GTree.list_store column_list in + let text_renderer = (GTree.cell_renderer_text [], ["text", text_column]) in + let tag_renderer = (GTree.cell_renderer_pixbuf [], ["pixbuf", tag_column]) in + let text_vcolumn = GTree.view_column ~renderer:text_renderer () in + let tag_vcolumn = GTree.view_column ~renderer:tag_renderer () in + let lookup_pixbuf tag = + try List.assoc tag tags with Not_found -> assert false + in + object (self) + initializer + tree_view#set_model (Some (list_store :> GTree.model)); + ignore (tree_view#append_column tag_vcolumn); + ignore (tree_view#append_column text_vcolumn) + + method list_store = list_store + + method easy_append ~tag s = + let tree_iter = list_store#append () in + list_store#set ~row:tree_iter ~column:text_column s; + list_store#set ~row:tree_iter ~column:tag_column (lookup_pixbuf tag) + + method easy_insert pos ~tag s = + let tree_iter = list_store#insert pos in + list_store#set ~row:tree_iter ~column:text_column s; + list_store#set ~row:tree_iter ~column:tag_column (lookup_pixbuf tag) + + method easy_selection () = + List.map + (fun tree_path -> + let iter = list_store#get_iter tree_path in + list_store#get ~row:iter ~column:text_column) + tree_view#selection#get_selected_rows + end + +class recordModel (tree_view:GTree.view) = + let cols_list = new GTree.column_list in + let text_col = cols_list#add Gobject.Data.string in +(* let combo_col = cols_list#add (Gobject.Data.gobject_by_name "GtkListStore") in *) + let combo_col = cols_list#add Gobject.Data.int in + let toggle_col = cols_list#add Gobject.Data.boolean in + let list_store = GTree.list_store cols_list in + let text_rend = (GTree.cell_renderer_text [], ["text", text_col]) in + let combo_rend = GTree.cell_renderer_combo [] in +(* let combo_rend = (GTree.cell_renderer_combo [], [|+"model", combo_col+|]) in *) + let toggle_rend = + (GTree.cell_renderer_toggle [`ACTIVATABLE true], ["active", toggle_col]) + in + let text_vcol = GTree.view_column ~renderer:text_rend () in + let combo_vcol = GTree.view_column ~renderer:(combo_rend, []) () in + let _ = + combo_vcol#set_cell_data_func combo_rend + (fun _ _ -> + prerr_endline "qui"; + let model, col = + GTree.store_of_list Gobject.Data.string ["a"; "b"; "c"] + in + combo_rend#set_properties [ + `MODEL (Some (model :> GTree.model)); + `TEXT_COLUMN col + ]) + in + let toggle_vcol = GTree.view_column ~renderer:toggle_rend () in + object (self) + initializer + tree_view#set_model (Some (list_store :> GTree.model)); + ignore (tree_view#append_column text_vcol); + ignore (tree_view#append_column combo_vcol); + ignore (tree_view#append_column toggle_vcol) + + method list_store = list_store + + method easy_append s (combo:int) (toggle:bool) = + let tree_iter = list_store#append () in + list_store#set ~row:tree_iter ~column:text_col s; + list_store#set ~row:tree_iter ~column:combo_col combo; + list_store#set ~row:tree_iter ~column:toggle_col toggle + end + +class type gui = + object + method newUriDialog: unit -> MatitaGeneratedGui.uriChoiceDialog + method newConfirmationDialog: unit -> MatitaGeneratedGui.confirmationDialog + method newEmptyDialog: unit -> MatitaGeneratedGui.emptyDialog + end + +let popup_message + ~title ~message ~buttons ~callback + ?(message_type=`QUESTION) ?parent ?(use_markup=true) + ?(destroy_with_parent=true) ?(allow_grow=false) ?(allow_shrink=false) + ?icon ?(modal=true) ?(resizable=false) ?screen ?type_hint + ?(position=`CENTER_ON_PARENT) ?wm_name ?wm_class ?border_width ?width + ?height ?(show=true) () += + let m = + GWindow.message_dialog + ~message ~use_markup ~message_type ~buttons ?parent ~destroy_with_parent + ~title ~allow_grow ~allow_shrink ?icon ~modal ~resizable ?screen + ?type_hint ~position ?wm_name ?wm_class ?border_width ?width ?height + ~show () + in + ignore(m#connect#response + ~callback:(fun a -> GMain.Main.quit ();callback a)); + ignore(m#connect#close + ~callback:(fun _ -> GMain.Main.quit ();raise PopupClosed)); + GtkThread.main (); + m#destroy () + +let popup_message_lowlevel + ~title ~message ?(no_separator=true) ~callback ~message_type ~buttons + ?parent ?(destroy_with_parent=true) ?(allow_grow=false) ?(allow_shrink=false) + ?icon ?(modal=true) ?(resizable=false) ?screen ?type_hint + ?(position=`CENTER_ON_PARENT) ?wm_name ?wm_class ?border_width ?width + ?height ?(show=true) () += + let m = + GWindow.dialog + ~no_separator + ?parent ~destroy_with_parent + ~title ~allow_grow ~allow_shrink ?icon ~modal ~resizable ?screen + ?type_hint ~position ?wm_name ?wm_class ?border_width ?width ?height + ~show:false () + in + let stock = + match message_type with + | `WARNING -> `DIALOG_WARNING + | `INFO -> `DIALOG_INFO + | `ERROR ->`DIALOG_ERROR + | `QUESTION -> `DIALOG_QUESTION + in + let image = GMisc.image ~stock ~icon_size:`DIALOG () in + let label = GMisc.label ~markup:message () in + label#set_line_wrap true; + let hbox = GPack.hbox ~spacing:10 () in + hbox#pack ~from:`START ~expand:true ~fill:true (image:>GObj.widget); + hbox#pack ~from:`START ~expand:true ~fill:true (label:>GObj.widget); + m#vbox#pack ~from:`START + ~padding:20 ~expand:true ~fill:true (hbox:>GObj.widget); + List.iter (fun (x, y) -> + m#add_button_stock x y; + if y = `CANCEL then + m#set_default_response y + ) buttons; + ignore(m#connect#response + ~callback:(fun a -> GMain.Main.quit ();callback a)); + ignore(m#connect#close + ~callback:(fun _ -> GMain.Main.quit ();callback `POPUPCLOSED)); + if show = true then + m#show (); + GtkThread.main (); + m#destroy () + + +let ask_confirmation ~title ~message ?parent () = + let rc = ref `YES in + let callback = + function + | `YES -> rc := `YES + | `NO -> rc := `NO + | `CANCEL -> rc := `CANCEL + | `DELETE_EVENT -> rc := `CANCEL + | `POPUPCLOSED -> rc := `CANCEL + in + let buttons = [`YES,`YES ; `NO,`NO ; `CANCEL,`CANCEL] in + popup_message_lowlevel + ~title ~message ~message_type:`WARNING ~callback ~buttons ?parent (); + !rc + +let report_error ~title ~message ?parent () = + let callback _ = () in + let buttons = GWindow.Buttons.ok in + try + popup_message + ~title ~message ~message_type:`ERROR ~callback ~buttons ?parent () + with + | PopupClosed -> () + + +let ask_text ~(gui:#gui) ?(title = "") ?(message = "") ?(multiline = false) + ?default () += + let dialog = gui#newEmptyDialog () in + dialog#emptyDialog#set_title title; + dialog#emptyDialogLabel#set_label message; + let result = ref None in + let return r = + result := r; + dialog#emptyDialog#destroy (); + GMain.Main.quit () + in + ignore (dialog#emptyDialog#event#connect#delete (fun _ -> true)); + if multiline then begin (* multiline input required: use a TextView widget *) + let win = + GBin.scrolled_window ~width:400 ~height:150 ~hpolicy:`NEVER + ~vpolicy:`ALWAYS ~packing:dialog#emptyDialogVBox#add () + in + let view = GText.view ~wrap_mode:`CHAR ~packing:win#add () in + let buffer = view#buffer in + (match default with + | None -> () + | Some text -> + buffer#set_text text; + buffer#select_range buffer#start_iter buffer#end_iter); + view#misc#grab_focus (); + connect_button dialog#emptyDialogOkButton (fun _ -> + return (Some (buffer#get_text ()))) + end else begin (* monoline input required: use a TextEntry widget *) + let entry = GEdit.entry ~packing:dialog#emptyDialogVBox#add () in + (match default with + | None -> () + | Some text -> + entry#set_text text; + entry#select_region ~start:0 ~stop:max_int); + entry#misc#grab_focus (); + connect_button dialog#emptyDialogOkButton (fun _ -> + return (Some entry#text)) + end; + connect_button dialog#emptyDialogCancelButton (fun _ ->return None); + dialog#emptyDialog#show (); + GtkThread.main (); + (match !result with None -> raise MatitaTypes.Cancel | Some r -> r) + +let utf8_parsed_text s floc = + let start, stop = HExtlib.loc_of_floc floc in + let start_bytes = Glib.Utf8.offset_to_pos s ~pos:0 ~off:start in + let stop_bytes = Glib.Utf8.offset_to_pos s ~pos:0 ~off:stop in + assert(stop_bytes >= start_bytes); + let bytes = stop_bytes - start_bytes in + try + String.sub s start_bytes bytes, bytes + with Invalid_argument _ -> + Printf.eprintf "%s/%d/%d\n" s start_bytes bytes; + assert false + + +let utf8_string_length s = + if BuildTimeConf.debug then + assert(Glib.Utf8.validate s); + Glib.Utf8.length s + diff --git a/matita/matitaGtkMisc.mli b/matita/matitaGtkMisc.mli new file mode 100644 index 000000000..0f78a4a61 --- /dev/null +++ b/matita/matitaGtkMisc.mli @@ -0,0 +1,154 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 Gtk helpers} *) + + (** given a window and a check menu item it links the two so that the former + * is only hidden on delete and the latter toggle show/hide of the former *) +val toggle_window_visibility: + window:GWindow.window -> check:GMenu.check_menu_item -> unit + + (** given a window and a check menu item it links the two so that the former + * is only hidden on delete and the latter toggle show/hide of the former *) +val toggle_widget_visibility: + widget:GObj.widget -> check:GMenu.check_menu_item -> unit + +val toggle_callback: + callback:(bool -> unit) -> check:GMenu.check_menu_item -> unit + +val toggle_win: + ?check:GMenu.check_menu_item -> GWindow.window -> unit -> unit + +val add_key_binding: Gdk.keysym -> (unit -> 'a) -> GBin.event_box -> unit + +(** Connect a callback to the clicked signal of a button, ignoring its return + * value *) +val connect_button: #GButton.button -> (unit -> unit) -> unit + + +(** Connect a callback to the toggled signal of a button, ignoring its return + * value *) +val connect_toggle_button: #GButton.toggle_button -> (unit -> unit) -> unit + +(** Like connect_button above, but connects a callback to the activate signal of + * a menu item *) +val connect_menu_item: #GMenu.menu_item -> (unit -> unit) -> unit + + (** connect a unit -> unit callback to a particular key press event. Event can + * be specified using its keysym and a list of modifiers which must be in + * effect for the callback to be executed. Further signal processing of other + * key press events remains unchanged; further signal processing of the + * specified key press depends on the stop parameter *) +val connect_key: + GObj.event_ops -> + ?modifiers:Gdk.Tags.modifier list -> + ?stop:bool -> (* stop signal handling when the given key has been pressed? + * Defaults to false *) + Gdk.keysym -> (* (= int) the key, see GdkKeysyms.ml *) + (unit -> unit) -> (* callback *) + unit + + (** n-ary string column list *) +class multiStringListModel: + cols:int -> + GTree.view -> + object + method list_store: GTree.list_store (** list_store forwarding *) + + method easy_mappend: string list -> unit (** append + set *) + method easy_minsert: int -> string list -> unit (** insert + set *) + method easy_mselection: unit -> string list list + end + + (** single string column list *) +class stringListModel: + GTree.view -> + object + inherit multiStringListModel + + method easy_append: string -> unit (** append + set *) + method easy_insert: int -> string -> unit (** insert + set *) + method easy_selection: unit -> string list + end + + + (** as above with Pixbuf associated to each row. Each time an insert is + * performed a string tag should be specified, the corresponding pixbuf in the + * tags associative list will be shown on the left of the inserted row *) +class taggedStringListModel: + tags:((string * GdkPixbuf.pixbuf) list) -> + GTree.view -> + object + method list_store: GTree.list_store (** list_store forwarding *) + + method easy_append: tag:string -> string -> unit + method easy_insert: int -> tag:string -> string -> unit + method easy_selection: unit -> string list + end + +(** {2 Matita GUI components} *) + +class type gui = + object (* minimal gui object requirements *) + method newUriDialog: unit -> MatitaGeneratedGui.uriChoiceDialog + method newConfirmationDialog: unit -> MatitaGeneratedGui.confirmationDialog + method newEmptyDialog: unit -> MatitaGeneratedGui.emptyDialog + end + + (** {3 Dialogs} + * In functions below: + * @param title window title + * @param message content of the text label shown to the user *) + + (** @param parent to center the window on it *) +val ask_confirmation: + title:string -> message:string -> + ?parent:#GWindow.window_skel -> + unit -> + [`YES | `NO | `CANCEL] + + (** @param multiline (default: false) if true a TextView widget will be used + * for prompting the user otherwise a TextEntry widget will be + * @return the string given by the user *) +val ask_text: + gui:#gui -> + ?title:string -> ?message:string -> + ?multiline:bool -> ?default:string -> unit -> + string + +val report_error: + title:string -> message:string -> + ?parent:#GWindow.window_skel -> + unit -> + unit + + (* given an utf8 string a floc returns the parsed substring and its length + * in bytes *) +val utf8_parsed_text: string -> Stdpp.location -> string * int + + (* the length in characters, not bytes *) +val utf8_string_length: string -> int + + diff --git a/matita/matitaGui.ml b/matita/matitaGui.ml new file mode 100644 index 000000000..1b1c136b9 --- /dev/null +++ b/matita/matitaGui.ml @@ -0,0 +1,1701 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open MatitaGeneratedGui +open MatitaGtkMisc +open MatitaMisc + +exception Found of int + +let all_disambiguation_passes = ref false + +let gui_instance = ref None + +class type browserWin = + (* this class exists only because GEdit.combo_box_entry is not supported by + * lablgladecc :-(((( *) +object + inherit MatitaGeneratedGui.browserWin + method browserUri: GEdit.combo_box_entry +end + +class console ~(buffer: GText.buffer) () = + object (self) + val error_tag = buffer#create_tag [ `FOREGROUND "red" ] + val warning_tag = buffer#create_tag [ `FOREGROUND "orange" ] + val message_tag = buffer#create_tag [] + val debug_tag = buffer#create_tag [ `FOREGROUND "#888888" ] + method message s = buffer#insert ~iter:buffer#end_iter ~tags:[message_tag] s + method error s = buffer#insert ~iter:buffer#end_iter ~tags:[error_tag] s + method warning s = buffer#insert ~iter:buffer#end_iter ~tags:[warning_tag] s + method debug s = buffer#insert ~iter:buffer#end_iter ~tags:[debug_tag] s + method clear () = + buffer#delete ~start:buffer#start_iter ~stop:buffer#end_iter + method log_callback (tag: HLog.log_tag) s = + match tag with + | `Debug -> self#debug (s ^ "\n") + | `Error -> self#error (s ^ "\n") + | `Message -> self#message (s ^ "\n") + | `Warning -> self#warning (s ^ "\n") + end + +let clean_current_baseuri grafite_status = + try + let baseuri = GrafiteTypes.get_string_option grafite_status "baseuri" in + LibraryClean.clean_baseuris [baseuri] + with GrafiteTypes.Option_error _ -> () + +let ask_and_save_moo_if_needed parent fname lexicon_status grafite_status = + let baseuri = + try Some (GrafiteTypes.get_string_option grafite_status "baseuri") + with GrafiteTypes.Option_error _ -> None + in + if (MatitaScript.current ())#eos && + grafite_status.GrafiteTypes.proof_status = GrafiteTypes.No_proof && + baseuri <> None + then + begin + let baseuri = match baseuri with Some b -> b | None -> assert false in + let moo_fname = + LibraryMisc.obj_file_of_baseuri ~must_exist:false ~baseuri + ~writable:true in + let save () = + let lexicon_fname = + LibraryMisc.lexicon_file_of_baseuri + ~must_exist:false ~baseuri ~writable:true + in + GrafiteMarshal.save_moo moo_fname + grafite_status.GrafiteTypes.moo_content_rev; + LexiconMarshal.save_lexicon lexicon_fname + lexicon_status.LexiconEngine.lexicon_content_rev + in + begin + let rc = + MatitaGtkMisc.ask_confirmation + ~title:"A .moo can be generated" + ~message:(Printf.sprintf + "%s can be generated for %s.\nShould I generate it?" + (Filename.basename moo_fname) (Filename.basename fname)) + ~parent () + in + let b = + match rc with + | `YES -> true + | `NO -> false + | `CANCEL -> raise MatitaTypes.Cancel + in + if b then + save () + else + clean_current_baseuri grafite_status + end + end + else + clean_current_baseuri grafite_status + +let ask_unsaved parent = + MatitaGtkMisc.ask_confirmation + ~parent ~title:"Unsaved work!" + ~message:("Your work is unsaved!\n\n"^ + "Do you want to save the script before continuing?") + () + +class interpErrorModel = + let cols = new GTree.column_list in + let id_col = cols#add Gobject.Data.string in + let dsc_col = cols#add Gobject.Data.string in + let interp_no_col = cols#add Gobject.Data.caml in + let tree_store = GTree.tree_store cols in + let id_renderer = GTree.cell_renderer_text [], ["text", id_col] in + let dsc_renderer = GTree.cell_renderer_text [], ["text", dsc_col] in + let id_view_col = GTree.view_column ~renderer:id_renderer () in + let dsc_view_col = GTree.view_column ~renderer:dsc_renderer () in + fun (tree_view: GTree.view) choices -> + object + initializer + tree_view#set_model (Some (tree_store :> GTree.model)); + ignore (tree_view#append_column id_view_col); + ignore (tree_view#append_column dsc_view_col); + tree_store#clear (); + let idx1 = ref ~-1 in + List.iter + (fun _,lll -> + incr idx1; + let loc_row = + if List.length choices = 1 then + None + else + (let loc_row = tree_store#append () in + begin + match lll with + [passes,envs_and_diffs,_,_] -> + tree_store#set ~row:loc_row ~column:id_col + ("Error location " ^ string_of_int (!idx1+1) ^ + ", error message " ^ string_of_int (!idx1+1) ^ ".1" ^ + " (in passes " ^ + String.concat " " (List.map string_of_int passes) ^ + ")"); + tree_store#set ~row:loc_row ~column:interp_no_col + (!idx1,Some 0,None); + | _ -> + tree_store#set ~row:loc_row ~column:id_col + ("Error location " ^ string_of_int (!idx1+1)); + tree_store#set ~row:loc_row ~column:interp_no_col + (!idx1,None,None); + end ; + Some loc_row) in + let idx2 = ref ~-1 in + List.iter + (fun passes,envs_and_diffs,_,_ -> + incr idx2; + let msg_row = + if List.length lll = 1 then + loc_row + else + let msg_row = tree_store#append ?parent:loc_row () in + (tree_store#set ~row:msg_row ~column:id_col + ("Error message " ^ string_of_int (!idx1+1) ^ "." ^ + string_of_int (!idx2+1) ^ + " (in passes " ^ + String.concat " " (List.map string_of_int passes) ^ + ")"); + tree_store#set ~row:msg_row ~column:interp_no_col + (!idx1,Some !idx2,None); + Some msg_row) in + let idx3 = ref ~-1 in + List.iter + (fun (passes,env,_) -> + incr idx3; + let interp_row = + match envs_and_diffs with + _::_::_ -> + let interp_row = tree_store#append ?parent:msg_row () in + tree_store#set ~row:interp_row ~column:id_col + ("Interpretation " ^ string_of_int (!idx3+1) ^ + " (in passes " ^ + String.concat " " (List.map string_of_int passes) ^ + ")"); + tree_store#set ~row:interp_row ~column:interp_no_col + (!idx1,Some !idx2,Some !idx3); + Some interp_row + | [_] -> msg_row + | [] -> assert false + in + List.iter + (fun (_, id, dsc) -> + let row = tree_store#append ?parent:interp_row () in + tree_store#set ~row ~column:id_col id; + tree_store#set ~row ~column:dsc_col dsc; + tree_store#set ~row ~column:interp_no_col + (!idx1,Some !idx2,Some !idx3) + ) env + ) envs_and_diffs + ) lll ; + if List.length lll > 1 then + HExtlib.iter_option + (fun p -> tree_view#expand_row (tree_store#get_path p)) + loc_row + ) choices + + method get_interp_no tree_path = + let iter = tree_store#get_iter tree_path in + tree_store#get ~row:iter ~column:interp_no_col + end + + +let rec interactive_error_interp ~all_passes (source_buffer:GSourceView.source_buffer) notify_exn offset errorll script_fname += + (* hook to save a script for each disambiguation error *) + if false then + (let text = + source_buffer#get_text ~start:source_buffer#start_iter + ~stop:source_buffer#end_iter () in + let md5 = Digest.to_hex (Digest.string text) in + let filename = match script_fname with Some s -> s | None -> "unnamed.ma" in + let filename = + Filename.chop_extension filename ^ ".error." ^ md5 ^ ".ma" in + let ch = open_out filename in + output_string ch text; + close_out ch + ); + assert (List.flatten errorll <> []); + let errorll' = + let remove_non_significant = + List.filter (fun (_env,_diff,_loc,_msg,significant) -> significant) in + let annotated_errorll () = + List.rev + (snd + (List.fold_left (fun (pass,res) item -> pass+1,(pass+1,item)::res) (0,[]) + errorll)) in + if all_passes then annotated_errorll () else + let safe_list_nth l n = try List.nth l n with Failure _ -> [] in + (* We remove passes 1,2 and 5,6 *) + let res = + (1,[])::(2,[]) + ::(3,remove_non_significant (safe_list_nth errorll 2)) + ::(4,remove_non_significant (safe_list_nth errorll 3)) + ::(5,[])::(6,[])::[] + in + if List.flatten (List.map snd res) <> [] then res + else + (* all errors (if any) are not significant: we keep them *) + let res = + (1,[])::(2,[]) + ::(3,(safe_list_nth errorll 2)) + ::(4,(safe_list_nth errorll 3)) + ::(5,[])::(6,[])::[] + in + if List.flatten (List.map snd res) <> [] then + begin + HLog.warn + "All disambiguation errors are not significant. Showing them anyway." ; + res + end + else + begin + HLog.warn + "No errors in phases 2 and 3. Showing all errors in all phases" ; + annotated_errorll () + end + in + let choices = MatitaExcPp.compact_disambiguation_errors all_passes errorll' in + match choices with + [] -> assert false + | [loffset,[_,envs_and_diffs,msg,significant]] -> + let _,env,diff = List.hd envs_and_diffs in + notify_exn + (GrafiteDisambiguator.DisambiguationError + (offset,[[env,diff,loffset,msg,significant]])); + | _::_ -> + let dialog = new disambiguationErrors () in + dialog#check_widgets (); + if all_passes then + dialog#disambiguationErrorsMoreErrors#misc#set_sensitive false; + let model = new interpErrorModel dialog#treeview choices in + dialog#disambiguationErrors#set_title "Disambiguation error"; + dialog#disambiguationErrorsLabel#set_label + "Click on an error to see the corresponding message:"; + ignore (dialog#treeview#connect#cursor_changed + (fun _ -> + let tree_path = + match fst (dialog#treeview#get_cursor ()) with + None -> assert false + | Some tp -> tp in + let idx1,idx2,idx3 = model#get_interp_no tree_path in + let loffset,lll = List.nth choices idx1 in + let _,envs_and_diffs,msg,significant = + match idx2 with + Some idx2 -> List.nth lll idx2 + | None -> + [],[],lazy "Multiple error messages. Please select one.",true + in + let _,env,diff = + match idx3 with + Some idx3 -> List.nth envs_and_diffs idx3 + | None -> [],[],[] (* dymmy value, used *) in + let script = MatitaScript.current () in + let error_tag = script#error_tag in + source_buffer#remove_tag error_tag + ~start:source_buffer#start_iter + ~stop:source_buffer#end_iter; + notify_exn + (GrafiteDisambiguator.DisambiguationError + (offset,[[env,diff,loffset,msg,significant]])) + )); + let return _ = + dialog#disambiguationErrors#destroy (); + GMain.Main.quit () + in + let fail _ = return () in + ignore(dialog#disambiguationErrors#event#connect#delete (fun _ -> true)); + connect_button dialog#disambiguationErrorsOkButton + (fun _ -> + let tree_path = + match fst (dialog#treeview#get_cursor ()) with + None -> assert false + | Some tp -> tp in + let idx1,idx2,idx3 = model#get_interp_no tree_path in + let diff = + match idx2,idx3 with + Some idx2, Some idx3 -> + let _,lll = List.nth choices idx1 in + let _,envs_and_diffs,_,_ = List.nth lll idx2 in + let _,_,diff = List.nth envs_and_diffs idx3 in + diff + | _,_ -> assert false + in + let newtxt = + String.concat "\n" + ("" :: + List.map + (fun k,value -> + DisambiguatePp.pp_environment + (DisambiguateTypes.Environment.add k value + DisambiguateTypes.Environment.empty)) + diff) ^ "\n" + in + source_buffer#insert + ~iter: + (source_buffer#get_iter_at_mark + (`NAME "beginning_of_statement")) newtxt ; + return () + ); + connect_button dialog#disambiguationErrorsMoreErrors + (fun _ -> return () ; + interactive_error_interp ~all_passes:true source_buffer + notify_exn offset errorll script_fname); + connect_button dialog#disambiguationErrorsCancelButton fail; + dialog#disambiguationErrors#show (); + GtkThread.main () + + +(** Selection handling + * Two clipboards are used: "clipboard" and "primary". + * "primary" is used by X, when you hit the middle button mouse is content is + * pasted between applications. In Matita this selection always contain the + * textual version of the selected term. + * "clipboard" is used inside Matita only and support ATM two different targets: + * "TERM" and "PATTERN", in the future other targets like "MATHMLCONTENT" may + * be added + *) + +class gui () = + (* creation order _is_ relevant for windows placement *) + let main = new mainWin () in + let fileSel = new fileSelectionWin () in + let findRepl = new findReplWin () in + let develList = new develListWin () in + let newDevel = new newDevelWin () in + let keyBindingBoxes = (* event boxes which should receive global key events *) + [ main#mainWinEventBox ] + in + let console = new console ~buffer:main#logTextView#buffer () in + let (source_view: GSourceView.source_view) = + GSourceView.source_view + ~auto_indent:true + ~insert_spaces_instead_of_tabs:true ~tabs_width:2 + ~margin:80 ~show_margin:true + ~smart_home_end:true + ~packing:main#scriptScrolledWin#add + () + in + let default_font_size = + Helm_registry.get_opt_default Helm_registry.int + ~default:BuildTimeConf.default_font_size "matita.font_size" + in + let source_buffer = source_view#source_buffer in + object (self) + val mutable chosen_file = None + val mutable _ok_not_exists = false + val mutable _only_directory = false + val mutable script_fname = None + val mutable font_size = default_font_size + val mutable next_devel_must_contain = None + val mutable next_ligatures = [] + val clipboard = GData.clipboard Gdk.Atom.clipboard + val primary = GData.clipboard Gdk.Atom.primary + + initializer + (* glade's check widgets *) + List.iter (fun w -> w#check_widgets ()) + (let c w = (w :> unit>) in + [ c fileSel; c main; c findRepl]); + (* key bindings *) + List.iter (* global key bindings *) + (fun (key, callback) -> self#addKeyBinding key callback) +(* + [ GdkKeysyms._F3, + toggle_win ~check:main#showProofMenuItem proof#proofWin; + GdkKeysyms._F4, + toggle_win ~check:main#showCheckMenuItem check#checkWin; +*) + [ ]; + (* about win *) + let parse_txt_file file = + let ch = open_in (BuildTimeConf.runtime_base_dir ^ "/" ^ file) in + let l_rev = ref [] in + try + while true do + l_rev := input_line ch :: !l_rev; + done; + assert false + with + End_of_file -> + close_in ch; + List.rev !l_rev in + let about_dialog = + GWindow.about_dialog + ~authors:(parse_txt_file "AUTHORS") + (*~comments:"comments"*) + ~copyright:"Copyright (C) 2005, the HELM team" + ~license:(String.concat "\n" (parse_txt_file "LICENSE")) + ~logo:(GdkPixbuf.from_file (MatitaMisc.image_path "/matita_medium.png")) + ~name:"Matita" + ~version:BuildTimeConf.version + ~website:"http://helm.cs.unibo.it" + () + in + connect_menu_item main#contentsMenuItem (fun () -> + let cmd = + sprintf "gnome-help ghelp://%s/C/matita.xml &" BuildTimeConf.help_dir + in + ignore (Sys.command cmd)); + connect_menu_item main#aboutMenuItem about_dialog#present; + (* findRepl win *) + let show_find_Repl () = + findRepl#toplevel#misc#show (); + findRepl#toplevel#misc#grab_focus () + in + let hide_find_Repl () = findRepl#toplevel#misc#hide () in + let find_forward _ = + let highlight start end_ = + source_buffer#move_mark `INSERT ~where:start; + source_buffer#move_mark `SEL_BOUND ~where:end_; + source_view#scroll_mark_onscreen `INSERT + in + let text = findRepl#findEntry#text in + let iter = source_buffer#get_iter `SEL_BOUND in + match iter#forward_search text with + | None -> + (match source_buffer#start_iter#forward_search text with + | None -> () + | Some (start,end_) -> highlight start end_) + | Some (start,end_) -> highlight start end_ + in + let replace _ = + let text = findRepl#replaceEntry#text in + let ins = source_buffer#get_iter `INSERT in + let sel = source_buffer#get_iter `SEL_BOUND in + if ins#compare sel < 0 then + begin + ignore(source_buffer#delete_selection ()); + source_buffer#insert text + end + in + connect_button findRepl#findButton find_forward; + connect_button findRepl#findReplButton replace; + connect_button findRepl#cancelButton (fun _ -> hide_find_Repl ()); + ignore(findRepl#toplevel#event#connect#delete + ~callback:(fun _ -> hide_find_Repl ();true)); + let safe_undo = + fun () -> + (* phase 1: we save the actual status of the marks and we undo *) + let locked_mark = `MARK ((MatitaScript.current ())#locked_mark) in + let locked_iter = source_view#buffer#get_iter_at_mark locked_mark in + let locked_iter_offset = locked_iter#offset in + let mark2 = + `MARK + (source_view#buffer#create_mark ~name:"lock_point" + ~left_gravity:true locked_iter) in + source_view#source_buffer#undo (); + (* phase 2: we save the cursor position and we redo, restoring + the previous status of all the marks *) + let cursor_iter = source_view#buffer#get_iter_at_mark `INSERT in + let mark = + `MARK + (source_view#buffer#create_mark ~name:"undo_point" + ~left_gravity:true cursor_iter) + in + source_view#source_buffer#redo (); + let mark_iter = source_view#buffer#get_iter_at_mark mark in + let mark2_iter = source_view#buffer#get_iter_at_mark mark2 in + let mark2_iter = mark2_iter#set_offset locked_iter_offset in + source_view#buffer#move_mark locked_mark ~where:mark2_iter; + source_view#buffer#delete_mark mark; + source_view#buffer#delete_mark mark2; + (* phase 3: if after the undo the cursor was in the locked area, + then we move it there again and we perform a goto *) + if mark_iter#offset < locked_iter_offset then + begin + source_view#buffer#move_mark `INSERT ~where:mark_iter; + (MatitaScript.current ())#goto `Cursor (); + end; + (* phase 4: we perform again the undo. This time we are sure that + the text to undo is not locked *) + source_view#source_buffer#undo (); + source_view#misc#grab_focus () in + let safe_redo = + fun () -> + (* phase 1: we save the actual status of the marks, we redo and + we undo *) + let locked_mark = `MARK ((MatitaScript.current ())#locked_mark) in + let locked_iter = source_view#buffer#get_iter_at_mark locked_mark in + let locked_iter_offset = locked_iter#offset in + let mark2 = + `MARK + (source_view#buffer#create_mark ~name:"lock_point" + ~left_gravity:true locked_iter) in + source_view#source_buffer#redo (); + source_view#source_buffer#undo (); + (* phase 2: we save the cursor position and we restore + the previous status of all the marks *) + let cursor_iter = source_view#buffer#get_iter_at_mark `INSERT in + let mark = + `MARK + (source_view#buffer#create_mark ~name:"undo_point" + ~left_gravity:true cursor_iter) + in + let mark_iter = source_view#buffer#get_iter_at_mark mark in + let mark2_iter = source_view#buffer#get_iter_at_mark mark2 in + let mark2_iter = mark2_iter#set_offset locked_iter_offset in + source_view#buffer#move_mark locked_mark ~where:mark2_iter; + source_view#buffer#delete_mark mark; + source_view#buffer#delete_mark mark2; + (* phase 3: if after the undo the cursor is in the locked area, + then we move it there again and we perform a goto *) + if mark_iter#offset < locked_iter_offset then + begin + source_view#buffer#move_mark `INSERT ~where:mark_iter; + (MatitaScript.current ())#goto `Cursor (); + end; + (* phase 4: we perform again the redo. This time we are sure that + the text to redo is not locked *) + source_view#source_buffer#redo (); + source_view#misc#grab_focus () + in + connect_menu_item main#undoMenuItem safe_undo; + ignore(source_view#source_buffer#connect#can_undo + ~callback:main#undoMenuItem#misc#set_sensitive); + connect_menu_item main#redoMenuItem safe_redo; + ignore(source_view#source_buffer#connect#can_redo + ~callback:main#redoMenuItem#misc#set_sensitive); + ignore(source_view#connect#after#populate_popup + ~callback:(fun pre_menu -> + let menu = new GMenu.menu pre_menu in + let menuItems = menu#children in + let undoMenuItem, redoMenuItem = + match menuItems with + [undo;redo;sep1;cut;copy;paste;delete;sep2; + selectall;sep3;inputmethod;insertunicodecharacter] -> + List.iter menu#remove [ copy; cut; delete; paste ]; + undo,redo + | _ -> assert false in + let add_menu_item = + let i = ref 2 in (* last occupied position *) + fun ?label ?stock () -> + incr i; + GMenu.image_menu_item ?label ?stock ~packing:(menu#insert ~pos:!i) + () + in + let copy = add_menu_item ~stock:`COPY () in + let cut = add_menu_item ~stock:`CUT () in + let delete = add_menu_item ~stock:`DELETE () in + let paste = add_menu_item ~stock:`PASTE () in + let paste_pattern = add_menu_item ~label:"Paste as pattern" () in + copy#misc#set_sensitive self#canCopy; + cut#misc#set_sensitive self#canCut; + delete#misc#set_sensitive self#canDelete; + paste#misc#set_sensitive self#canPaste; + paste_pattern#misc#set_sensitive self#canPastePattern; + connect_menu_item copy self#copy; + connect_menu_item cut self#cut; + connect_menu_item delete self#delete; + connect_menu_item paste self#paste; + connect_menu_item paste_pattern self#pastePattern; + let new_undoMenuItem = + GMenu.image_menu_item + ~image:(GMisc.image ~stock:`UNDO ()) + ~use_mnemonic:true + ~label:"_Undo" + ~packing:(menu#insert ~pos:0) () in + new_undoMenuItem#misc#set_sensitive + (undoMenuItem#misc#get_flag `SENSITIVE); + menu#remove (undoMenuItem :> GMenu.menu_item); + connect_menu_item new_undoMenuItem safe_undo; + let new_redoMenuItem = + GMenu.image_menu_item + ~image:(GMisc.image ~stock:`REDO ()) + ~use_mnemonic:true + ~label:"_Redo" + ~packing:(menu#insert ~pos:1) () in + new_redoMenuItem#misc#set_sensitive + (redoMenuItem#misc#get_flag `SENSITIVE); + menu#remove (redoMenuItem :> GMenu.menu_item); + connect_menu_item new_redoMenuItem safe_redo)); + + connect_menu_item main#editMenu (fun () -> + main#copyMenuItem#misc#set_sensitive self#canCopy; + main#cutMenuItem#misc#set_sensitive self#canCut; + main#deleteMenuItem#misc#set_sensitive self#canDelete; + main#pasteMenuItem#misc#set_sensitive self#canPaste; + main#pastePatternMenuItem#misc#set_sensitive self#canPastePattern); + connect_menu_item main#copyMenuItem self#copy; + connect_menu_item main#cutMenuItem self#cut; + connect_menu_item main#deleteMenuItem self#delete; + connect_menu_item main#pasteMenuItem self#paste; + connect_menu_item main#pastePatternMenuItem self#pastePattern; + connect_menu_item main#selectAllMenuItem (fun () -> + source_buffer#move_mark `INSERT source_buffer#start_iter; + source_buffer#move_mark `SEL_BOUND source_buffer#end_iter); + connect_menu_item main#findReplMenuItem show_find_Repl; + connect_menu_item main#externalEditorMenuItem self#externalEditor; + connect_menu_item main#ligatureButton self#nextLigature; + ignore (findRepl#findEntry#connect#activate find_forward); + (* interface lockers *) + let lock_world _ = + main#buttonsToolbar#misc#set_sensitive false; + develList#buttonsHbox#misc#set_sensitive false; + main#scriptMenu#misc#set_sensitive false; + source_view#set_editable false + in + let unlock_world _ = + main#buttonsToolbar#misc#set_sensitive true; + develList#buttonsHbox#misc#set_sensitive true; + main#scriptMenu#misc#set_sensitive true; + source_view#set_editable true; + (*The next line seems sufficient to avoid some unknown race condition *) + GtkThread.sync (fun () -> ()) () + in + let worker_thread = ref None in + let notify_exn exn = + let floc, msg = MatitaExcPp.to_string exn in + begin + match floc with + None -> () + | Some floc -> + let (x, y) = HExtlib.loc_of_floc floc in + let script = MatitaScript.current () in + let locked_mark = script#locked_mark in + let error_tag = script#error_tag in + let baseoffset = + (source_buffer#get_iter_at_mark (`MARK locked_mark))#offset in + let x' = baseoffset + x in + let y' = baseoffset + y in + let x_iter = source_buffer#get_iter (`OFFSET x') in + let y_iter = source_buffer#get_iter (`OFFSET y') in + source_buffer#apply_tag error_tag ~start:x_iter ~stop:y_iter; + let id = ref None in + id := Some (source_buffer#connect#changed ~callback:(fun () -> + source_buffer#remove_tag error_tag + ~start:source_buffer#start_iter + ~stop:source_buffer#end_iter; + match !id with + | None -> assert false (* a race condition occurred *) + | Some id -> + (new GObj.gobject_ops source_buffer#as_buffer)#disconnect id)); + source_buffer#place_cursor + (source_buffer#get_iter (`OFFSET x')); + end; + HLog.error msg in + let locker f () = + let thread_main = + fun () -> + lock_world (); + try + f (); + unlock_world () + with + | GrafiteDisambiguator.DisambiguationError (offset,errorll) -> + (try + interactive_error_interp ~all_passes:!all_disambiguation_passes source_buffer + notify_exn offset errorll script_fname + with + exc -> notify_exn exc); + unlock_world () + | exc -> + notify_exn exc; + unlock_world () + in + (*thread_main ();*) + worker_thread := Some (Thread.create thread_main ()) + in + let kill_worker = + (* the following lines are from Xavier Leroy: http://alan.petitepomme.net/cwn/2005.11.08.html *) + let interrupt = ref None in + let old_callback = ref (function _ -> ()) in + let force_interrupt n = + (* This function is called just before the thread's timeslice ends *) + !old_callback n; + if Some(Thread.id(Thread.self())) = !interrupt then + (interrupt := None; raise Sys.Break) in + let _ = + match Sys.signal Sys.sigvtalrm (Sys.Signal_handle force_interrupt) with + Sys.Signal_handle f -> old_callback := f + | Sys.Signal_ignore + | Sys.Signal_default -> assert false + in + fun () -> + match !worker_thread with + None -> assert false + | Some t -> interrupt := Some (Thread.id t) in + let keep_focus f = + fun () -> + try + f (); source_view#misc#grab_focus () + with + exc -> source_view#misc#grab_focus (); raise exc in + (* developments win *) + let model = + new MatitaGtkMisc.multiStringListModel + ~cols:2 develList#developmentsTreeview + in + let refresh_devels_win () = + model#list_store#clear (); + List.iter + (fun (name, root) -> model#easy_mappend [name;root]) + (MatitamakeLib.list_known_developments ()) + in + let get_devel_selected () = + match model#easy_mselection () with + | [[name;_]] -> MatitamakeLib.development_for_name name + | _ -> None + in + let refresh () = + while Glib.Main.pending () do + ignore(Glib.Main.iteration false); + done + in + connect_button develList#newButton + (fun () -> + next_devel_must_contain <- None; + newDevel#toplevel#misc#show()); + connect_button develList#deleteButton + (locker (fun () -> + (match get_devel_selected () with + | None -> () + | Some d -> MatitamakeLib.destroy_development_in_bg refresh d); + refresh_devels_win ())); + connect_button develList#buildButton + (locker (fun () -> + match get_devel_selected () with + | None -> () + | Some d -> + let build = locker + (fun () -> MatitamakeLib.build_development_in_bg refresh d) + in + ignore(build ()))); + connect_button develList#cleanButton + (locker (fun () -> + match get_devel_selected () with + | None -> () + | Some d -> + let clean = locker + (fun () -> MatitamakeLib.clean_development_in_bg refresh d) + in + ignore(clean ()))); + (* publish button hidden, use command line + connect_button develList#publishButton + (locker (fun () -> + match get_devel_selected () with + | None -> () + | Some d -> + let publish = locker (fun () -> + MatitamakeLib.publish_development_in_bg refresh d) in + ignore(publish ()))); + *) + develList#publishButton#misc#hide (); + connect_button develList#graphButton (fun () -> + match get_devel_selected () with + | None -> () + | Some d -> + (match MatitamakeLib.dot_for_development d with + | None -> () + | Some _ -> + let browser = MatitaMathView.cicBrowser () in + browser#load (`Development + (MatitamakeLib.name_for_development d)))); + connect_button develList#closeButton + (fun () -> develList#toplevel#misc#hide()); + ignore(develList#toplevel#event#connect#delete + (fun _ -> develList#toplevel#misc#hide();true)); + connect_menu_item main#developmentsMenuItem + (fun () -> refresh_devels_win ();develList#toplevel#misc#show ()); + + (* add development win *) + let check_if_root_contains root = + match next_devel_must_contain with + | None -> true + | Some path -> + let is_prefix_of d1 d2 = + let d1 = MatitamakeLib.normalize_path d1 in + let d2 = MatitamakeLib.normalize_path d2 in + let len1 = String.length d1 in + let len2 = String.length d2 in + if len2 < len1 then + false + else + let pref = String.sub d2 0 len1 in + pref = d1 + in + is_prefix_of root path + in + connect_button newDevel#addButton + (fun () -> + let name = newDevel#nameEntry#text in + let root = newDevel#rootEntry#text in + if check_if_root_contains root then + begin + ignore (MatitamakeLib.initialize_development name root); + refresh_devels_win (); + newDevel#nameEntry#set_text ""; + newDevel#rootEntry#set_text ""; + newDevel#toplevel#misc#hide() + end + else + HLog.error ("The selected root does not contain " ^ + match next_devel_must_contain with + | Some x -> x + | _ -> assert false)); + connect_button newDevel#chooseRootButton + (fun () -> + let path = self#chooseDir () in + match path with + | Some path -> newDevel#rootEntry#set_text path + | None -> ()); + connect_button newDevel#cancelButton + (fun () -> newDevel#toplevel#misc#hide ()); + ignore(newDevel#toplevel#event#connect#delete + (fun _ -> newDevel#toplevel#misc#hide();true)); + + (* file selection win *) + ignore (fileSel#fileSelectionWin#event#connect#delete (fun _ -> true)); + ignore (fileSel#fileSelectionWin#connect#response (fun event -> + let return r = + chosen_file <- r; + fileSel#fileSelectionWin#misc#hide (); + GMain.Main.quit () + in + match event with + | `OK -> + let fname = fileSel#fileSelectionWin#filename in + if Sys.file_exists fname then + begin + if HExtlib.is_regular fname && not (_only_directory) then + return (Some fname) + else if _only_directory && HExtlib.is_dir fname then + return (Some fname) + end + else + begin + if _ok_not_exists then + return (Some fname) + end + | `CANCEL -> return None + | `HELP -> () + | `DELETE_EVENT -> return None)); + (* menus *) + List.iter (fun w -> w#misc#set_sensitive false) [ main#saveMenuItem ]; + (* console *) + let adj = main#logScrolledWin#vadjustment in + ignore (adj#connect#changed + (fun _ -> adj#set_value (adj#upper -. adj#page_size))); + console#message (sprintf "\tMatita version %s\n" BuildTimeConf.version); + (* TO BE REMOVED *) + main#tacticsButtonsHandlebox#misc#hide (); + main#tacticsBarMenuItem#misc#hide (); + main#scriptNotebook#remove_page 1; + main#scriptNotebook#set_show_tabs false; + (* / TO BE REMOVED *) + let module Hr = Helm_registry in + MatitaGtkMisc.toggle_callback ~check:main#fullscreenMenuItem + ~callback:(function + | true -> main#toplevel#fullscreen () + | false -> main#toplevel#unfullscreen ()); + main#fullscreenMenuItem#set_active false; + MatitaGtkMisc.toggle_callback ~check:main#ppNotationMenuItem + ~callback:(function + | true -> + CicNotation.set_active_notations + (List.map fst (CicNotation.get_all_notations ())) + | false -> + CicNotation.set_active_notations []); + MatitaGtkMisc.toggle_callback ~check:main#hideCoercionsMenuItem + ~callback:(fun enabled -> Acic2content.hide_coercions := enabled); + MatitaGtkMisc.toggle_callback ~check:main#unicodeAsTexMenuItem + ~callback:(fun enabled -> + Helm_registry.set_bool "matita.paste_unicode_as_tex" enabled); + main#unicodeAsTexMenuItem#set_active + (Helm_registry.get_bool "matita.paste_unicode_as_tex"); + (* log *) + HLog.set_log_callback self#console#log_callback; + GtkSignal.user_handler := + (function + | MatitaScript.ActionCancelled s -> HLog.error s + | exn -> + if not (Helm_registry.get_bool "matita.debug") then + notify_exn exn + else raise exn); + (* script *) + ignore (source_buffer#connect#mark_set (fun _ _ -> next_ligatures <- [])); + let _ = + match GSourceView.source_language_from_file BuildTimeConf.lang_file with + | None -> + HLog.warn (sprintf "can't load language file %s" + BuildTimeConf.lang_file) + | Some matita_lang -> + source_buffer#set_language matita_lang; + source_buffer#set_highlight true + in + let s () = MatitaScript.current () in + let disableSave () = + script_fname <- None; + main#saveMenuItem#misc#set_sensitive false + in + let saveAsScript () = + let script = s () in + match self#chooseFile ~ok_not_exists:true () with + | Some f -> + script#assignFileName f; + script#saveToFile (); + console#message ("'"^f^"' saved.\n"); + self#_enableSaveTo f + | None -> () + in + let saveScript () = + match script_fname with + | None -> saveAsScript () + | Some f -> + (s ())#assignFileName f; + (s ())#saveToFile (); + console#message ("'"^f^"' saved.\n"); + in + let abandon_script () = + let lexicon_status = (s ())#lexicon_status in + let grafite_status = (s ())#grafite_status in + if source_view#buffer#modified then + (match ask_unsaved main#toplevel with + | `YES -> saveScript () + | `NO -> () + | `CANCEL -> raise MatitaTypes.Cancel); + (match script_fname with + | None -> () + | Some fname -> + ask_and_save_moo_if_needed main#toplevel fname + lexicon_status grafite_status); + in + let loadScript () = + let script = s () in + try + match self#chooseFile () with + | Some f -> + abandon_script (); + script#reset (); + script#assignFileName f; + source_view#source_buffer#begin_not_undoable_action (); + script#loadFromFile f; + source_view#source_buffer#end_not_undoable_action (); + console#message ("'"^f^"' loaded.\n"); + self#_enableSaveTo f + | None -> () + with MatitaTypes.Cancel -> () + in + let newScript () = + abandon_script (); + source_view#source_buffer#begin_not_undoable_action (); + (s ())#reset (); + (s ())#template (); + source_view#source_buffer#end_not_undoable_action (); + disableSave (); + script_fname <- None + in + let cursor () = + source_buffer#place_cursor + (source_buffer#get_iter_at_mark (`NAME "locked")) in + let advance _ = (MatitaScript.current ())#advance (); cursor () in + let retract _ = (MatitaScript.current ())#retract (); cursor () in + let top _ = (MatitaScript.current ())#goto `Top (); cursor () in + let bottom _ = (MatitaScript.current ())#goto `Bottom (); cursor () in + let jump _ = (MatitaScript.current ())#goto `Cursor (); cursor () in + let advance = locker (keep_focus advance) in + let retract = locker (keep_focus retract) in + let top = locker (keep_focus top) in + let bottom = locker (keep_focus bottom) in + let jump = locker (keep_focus jump) in + (* quit *) + self#setQuitCallback (fun () -> + let lexicon_status = (MatitaScript.current ())#lexicon_status in + let grafite_status = (MatitaScript.current ())#grafite_status in + if source_view#buffer#modified then + begin + let rc = ask_unsaved main#toplevel in + try + match rc with + | `YES -> saveScript (); + if not source_view#buffer#modified then + begin + (match script_fname with + | None -> () + | Some fname -> + ask_and_save_moo_if_needed main#toplevel + fname lexicon_status grafite_status); + GMain.Main.quit () + end + | `NO -> GMain.Main.quit () + | `CANCEL -> raise MatitaTypes.Cancel + with MatitaTypes.Cancel -> () + end + else + begin + (match script_fname with + | None -> clean_current_baseuri grafite_status; GMain.Main.quit () + | Some fname -> + try + ask_and_save_moo_if_needed main#toplevel fname lexicon_status + grafite_status; + GMain.Main.quit () + with MatitaTypes.Cancel -> ()) + end); + connect_button main#scriptAdvanceButton advance; + connect_button main#scriptRetractButton retract; + connect_button main#scriptTopButton top; + connect_button main#scriptBottomButton bottom; + connect_button main#scriptJumpButton jump; + connect_button main#scriptAbortButton kill_worker; + connect_menu_item main#scriptAdvanceMenuItem advance; + connect_menu_item main#scriptRetractMenuItem retract; + connect_menu_item main#scriptTopMenuItem top; + connect_menu_item main#scriptBottomMenuItem bottom; + connect_menu_item main#scriptJumpMenuItem jump; + connect_menu_item main#openMenuItem loadScript; + connect_menu_item main#saveMenuItem saveScript; + connect_menu_item main#saveAsMenuItem saveAsScript; + connect_menu_item main#newMenuItem newScript; + connect_menu_item main#showCoercionsGraphMenuItem + (fun _ -> + let c = MatitaMathView.cicBrowser () in + c#load (`About `Coercions)); + connect_menu_item main#showAutoGuiMenuItem + (fun _ -> MatitaAutoGui.auto_dialog Auto.get_auto_status); + (* script monospace font stuff *) + self#updateFontSize (); + (* debug menu *) + main#debugMenu#misc#hide (); + (* HBUGS *) + main#hintNotebook#misc#hide (); + (* + main#hintLowImage#set_file (image_path "matita-bulb-low.png"); + main#hintMediumImage#set_file (image_path "matita-bulb-medium.png"); + main#hintHighImage#set_file (image_path "matita-bulb-high.png"); + *) + (* focus *) + self#sourceView#misc#grab_focus (); + (* main win dimension *) + let width = Gdk.Screen.width () in + let height = Gdk.Screen.height () in + let main_w = width * 90 / 100 in + let main_h = height * 80 / 100 in + let script_w = main_w * 6 / 10 in + main#toplevel#resize ~width:main_w ~height:main_h; + main#hpaneScriptSequent#set_position script_w; + (* source_view *) + ignore(source_view#connect#after#paste_clipboard + ~callback:(fun () -> (MatitaScript.current ())#clean_dirty_lock)); + (* clean_locked is set to true only "during" a PRIMARY paste + operation (i.e. by clicking with the second mouse button) *) + let clean_locked = ref false in + ignore(source_view#event#connect#button_press + ~callback: + (fun button -> + if GdkEvent.Button.button button = 2 then + clean_locked := true; + false + )); + ignore(source_view#event#connect#button_release + ~callback:(fun button -> clean_locked := false; false)); + ignore(source_view#buffer#connect#after#apply_tag + ~callback:( + fun tag ~start:_ ~stop:_ -> + if !clean_locked && + tag#get_oid = (MatitaScript.current ())#locked_tag#get_oid + then + begin + clean_locked := false; + (MatitaScript.current ())#clean_dirty_lock; + clean_locked := true + end)); + (* math view handling *) + connect_menu_item main#newCicBrowserMenuItem (fun () -> + ignore (MatitaMathView.cicBrowser ())); + connect_menu_item main#increaseFontSizeMenuItem (fun () -> + self#increaseFontSize (); + MatitaMathView.increase_font_size (); + MatitaMathView.update_font_sizes ()); + connect_menu_item main#decreaseFontSizeMenuItem (fun () -> + self#decreaseFontSize (); + MatitaMathView.decrease_font_size (); + MatitaMathView.update_font_sizes ()); + connect_menu_item main#normalFontSizeMenuItem (fun () -> + self#resetFontSize (); + MatitaMathView.reset_font_size (); + MatitaMathView.update_font_sizes ()); + MatitaMathView.reset_font_size (); + + (** selections / clipboards handling *) + + method markupSelected = MatitaMathView.has_selection () + method private textSelected = + (source_buffer#get_iter_at_mark `INSERT)#compare + (source_buffer#get_iter_at_mark `SEL_BOUND) <> 0 + method private somethingSelected = self#markupSelected || self#textSelected + method private markupStored = MatitaMathView.has_clipboard () + method private textStored = clipboard#text <> None + method private somethingStored = self#markupStored || self#textStored + + method canCopy = self#somethingSelected + method canCut = self#textSelected + method canDelete = self#textSelected + method canPaste = self#somethingStored + method canPastePattern = self#markupStored + + method copy () = + if self#textSelected + then begin + MatitaMathView.empty_clipboard (); + source_view#buffer#copy_clipboard clipboard; + end else + MatitaMathView.copy_selection () + method cut () = + source_view#buffer#cut_clipboard clipboard; + MatitaMathView.empty_clipboard () + method delete () = ignore (source_view#buffer#delete_selection ()) + method paste () = + if MatitaMathView.has_clipboard () + then source_view#buffer#insert (MatitaMathView.paste_clipboard `Term) + else source_view#buffer#paste_clipboard clipboard; + (MatitaScript.current ())#clean_dirty_lock + method pastePattern () = + source_view#buffer#insert (MatitaMathView.paste_clipboard `Pattern) + + method private nextLigature () = + let iter = source_buffer#get_iter_at_mark `INSERT in + let write_ligature len s = + assert(Glib.Utf8.validate s); + source_buffer#delete ~start:iter ~stop:(iter#copy#backward_chars len); + source_buffer#insert ~iter:(source_buffer#get_iter_at_mark `INSERT) s + in + let get_ligature word = + let len = String.length word in + let aux_tex () = + try + for i = len - 1 downto 0 do + if HExtlib.is_alpha word.[i] then () + else + (if word.[i] = '\\' then raise (Found i) else raise (Found ~-1)) + done; + None + with Found i -> + if i = ~-1 then None else Some (String.sub word i (len - i)) + in + let aux_ligature () = + try + for i = len - 1 downto 0 do + if CicNotationLexer.is_ligature_char word.[i] then () + else raise (Found (i+1)) + done; + raise (Found 0) + with + | Found i -> + (try + Some (String.sub word i (len - i)) + with Invalid_argument _ -> None) + in + match aux_tex () with + | Some macro -> macro + | None -> (match aux_ligature () with Some l -> l | None -> word) + in + (match next_ligatures with + | [] -> (* find ligatures and fill next_ligatures, then try again *) + let last_word = + iter#get_slice + ~stop:(iter#copy#backward_find_char Glib.Unichar.isspace) + in + let ligature = get_ligature last_word in + (match CicNotationLexer.lookup_ligatures ligature with + | [] -> () + | hd :: tl -> + write_ligature (MatitaGtkMisc.utf8_string_length ligature) hd; + next_ligatures <- tl @ [ hd ]) + | hd :: tl -> + write_ligature 1 hd; + next_ligatures <- tl @ [ hd ]) + + method private externalEditor () = + let cmd = Helm_registry.get "matita.external_editor" in +(* ZACK uncomment to enable interactive ask of external editor command *) +(* let cmd = + let msg = + "External editor command: +%f will be substitute for the script name, +%p for the cursor position in bytes, +%l for the execution point in bytes." + in + ask_text ~gui:self ~title:"External editor" ~msg ~multiline:false + ~default:(Helm_registry.get "matita.external_editor") () + in *) + let fname = Librarian.filename () in + let slice mark = + source_buffer#start_iter#get_slice + ~stop:(source_buffer#get_iter_at_mark mark) + in + let script = MatitaScript.current () in + let locked = `MARK script#locked_mark in + let string_pos mark = string_of_int (String.length (slice mark)) in + let cursor_pos = string_pos `INSERT in + let locked_pos = string_pos locked in + let cmd = + Pcre.replace ~pat:"%f" ~templ:fname + (Pcre.replace ~pat:"%p" ~templ:cursor_pos + (Pcre.replace ~pat:"%l" ~templ:locked_pos + cmd)) + in + let locked_before = slice locked in + let locked_offset = (source_buffer#get_iter_at_mark locked)#offset in + ignore (Unix.system cmd); + source_buffer#set_text (HExtlib.input_file fname); + let locked_iter = source_buffer#get_iter (`OFFSET locked_offset) in + source_buffer#move_mark locked locked_iter; + source_buffer#apply_tag script#locked_tag + ~start:source_buffer#start_iter ~stop:locked_iter; + let locked_after = slice locked in + let line = ref 0 in + let col = ref 0 in + try + for i = 0 to String.length locked_before - 1 do + if locked_before.[i] <> locked_after.[i] then begin + source_buffer#place_cursor + ~where:(source_buffer#get_iter (`LINEBYTE (!line, !col))); + script#goto `Cursor (); + raise Exit + end else if locked_before.[i] = '\n' then begin + incr line; + col := 0 + end + done + with + | Exit -> () + | Invalid_argument _ -> script#goto `Bottom () + + method loadScript file = + let script = MatitaScript.current () in + script#reset (); + if Pcre.pmatch ~pat:"\\.p$" file then + begin + let tptppath = + Helm_registry.get_opt_default Helm_registry.string ~default:"./" + "matita.tptppath" + in + let data = Matitaprover.p_to_ma ~filename:file ~tptppath () in + let filename = Pcre.replace ~pat:"\\.p$" ~templ:".ma" file in + script#assignFileName filename; + source_view#source_buffer#begin_not_undoable_action (); + script#loadFromString data; + source_view#source_buffer#end_not_undoable_action (); + console#message ("'"^filename^"' loaded."); + self#_enableSaveTo filename + end + else + begin + script#assignFileName file; + let content = + if Sys.file_exists file then file + else BuildTimeConf.script_template + in + source_view#source_buffer#begin_not_undoable_action (); + script#loadFromFile content; + source_view#source_buffer#end_not_undoable_action (); + console#message ("'"^file^"' loaded."); + self#_enableSaveTo file + end + + method setStar name b = + let w = main#toplevel in + let set x = w#set_title x in + let name = "Matita - " ^ name in + if b then + set (name ^ " *") + else + set (name) + + method private _enableSaveTo file = + script_fname <- Some file; + self#main#saveMenuItem#misc#set_sensitive true + + method console = console + method sourceView: GSourceView.source_view = + (source_view: GSourceView.source_view) + method fileSel = fileSel + method findRepl = findRepl + method main = main + method develList = develList + method newDevel = newDevel + + method newBrowserWin () = + object (self) + inherit browserWin () + val combo = GEdit.combo_box_entry () + initializer + self#check_widgets (); + let combo_widget = combo#coerce in + uriHBox#pack ~from:`END ~fill:true ~expand:true combo_widget; + combo#entry#misc#grab_focus () + method browserUri = combo + end + + method newUriDialog () = + let dialog = new uriChoiceDialog () in + dialog#check_widgets (); + dialog + + method newConfirmationDialog () = + let dialog = new confirmationDialog () in + dialog#check_widgets (); + dialog + + method newEmptyDialog () = + let dialog = new emptyDialog () in + dialog#check_widgets (); + dialog + + method private addKeyBinding key callback = + List.iter (fun evbox -> add_key_binding key callback evbox) + keyBindingBoxes + + method setQuitCallback callback = + connect_menu_item main#quitMenuItem callback; + ignore (main#toplevel#event#connect#delete + (fun _ -> callback ();true)); + self#addKeyBinding GdkKeysyms._q callback + + method chooseFile ?(ok_not_exists = false) () = + _ok_not_exists <- ok_not_exists; + _only_directory <- false; + fileSel#fileSelectionWin#show (); + GtkThread.main (); + chosen_file + + method private chooseDir ?(ok_not_exists = false) () = + _ok_not_exists <- ok_not_exists; + _only_directory <- true; + fileSel#fileSelectionWin#show (); + GtkThread.main (); + (* we should check that this is a directory *) + chosen_file + + method createDevelopment ~containing = + next_devel_must_contain <- containing; + newDevel#toplevel#misc#show() + + method askText ?(title = "") ?(msg = "") () = + let dialog = new textDialog () in + dialog#textDialog#set_title title; + dialog#textDialogLabel#set_label msg; + let text = ref None in + let return v = + text := v; + dialog#textDialog#destroy (); + GMain.Main.quit () + in + ignore (dialog#textDialog#event#connect#delete (fun _ -> true)); + connect_button dialog#textDialogCancelButton (fun _ -> return None); + connect_button dialog#textDialogOkButton (fun _ -> + let text = dialog#textDialogTextView#buffer#get_text () in + return (Some text)); + dialog#textDialog#show (); + GtkThread.main (); + !text + + method private updateFontSize () = + self#sourceView#misc#modify_font_by_name + (sprintf "%s %d" BuildTimeConf.script_font font_size) + + method increaseFontSize () = + font_size <- font_size + 1; + self#updateFontSize () + + method decreaseFontSize () = + font_size <- font_size - 1; + self#updateFontSize () + + method resetFontSize () = + font_size <- default_font_size; + self#updateFontSize () + + end + +let gui () = + let g = new gui () in + gui_instance := Some g; + MatitaMathView.set_gui g; + g + +let instance = singleton gui + +let non p x = not (p x) + +(* this is a shit and should be changed :-{ *) +let interactive_uri_choice + ?(selection_mode:[`SINGLE|`MULTIPLE] = `MULTIPLE) ?(title = "") + ?(msg = "") ?(nonvars_button = false) ?(hide_uri_entry=false) + ?(hide_try=false) ?(ok_label="_Auto") ?(ok_action:[`SELECT|`AUTO] = `AUTO) + ?copy_cb () + ~id uris += + let gui = instance () in + let nonvars_uris = lazy (List.filter (non UriManager.uri_is_var) uris) in + if (selection_mode <> `SINGLE) && + (Helm_registry.get_opt_default Helm_registry.get_bool ~default:true "matita.auto_disambiguation") + then + Lazy.force nonvars_uris + else begin + let dialog = gui#newUriDialog () in + if hide_uri_entry then + dialog#uriEntryHBox#misc#hide (); + if hide_try then + begin + dialog#uriChoiceSelectedButton#misc#hide (); + dialog#uriChoiceConstantsButton#misc#hide (); + end; + dialog#okLabel#set_label ok_label; + dialog#uriChoiceTreeView#selection#set_mode + (selection_mode :> Gtk.Tags.selection_mode); + let model = new stringListModel dialog#uriChoiceTreeView in + let choices = ref None in + (match copy_cb with + | None -> () + | Some cb -> + dialog#copyButton#misc#show (); + connect_button dialog#copyButton + (fun _ -> + match model#easy_selection () with + | [u] -> (cb u) + | _ -> ())); + dialog#uriChoiceDialog#set_title title; + dialog#uriChoiceLabel#set_text msg; + List.iter model#easy_append (List.map UriManager.string_of_uri uris); + dialog#uriChoiceConstantsButton#misc#set_sensitive nonvars_button; + let return v = + choices := v; + dialog#uriChoiceDialog#destroy (); + GMain.Main.quit () + in + ignore (dialog#uriChoiceDialog#event#connect#delete (fun _ -> true)); + connect_button dialog#uriChoiceConstantsButton (fun _ -> + return (Some (Lazy.force nonvars_uris))); + if ok_action = `AUTO then + connect_button dialog#uriChoiceAutoButton (fun _ -> + Helm_registry.set_bool "matita.auto_disambiguation" true; + return (Some (Lazy.force nonvars_uris))) + else + connect_button dialog#uriChoiceAutoButton (fun _ -> + match model#easy_selection () with + | [] -> () + | uris -> return (Some (List.map UriManager.uri_of_string uris))); + connect_button dialog#uriChoiceSelectedButton (fun _ -> + match model#easy_selection () with + | [] -> () + | uris -> return (Some (List.map UriManager.uri_of_string uris))); + connect_button dialog#uriChoiceAbortButton (fun _ -> return None); + dialog#uriChoiceDialog#show (); + GtkThread.main (); + (match !choices with + | None -> raise MatitaTypes.Cancel + | Some uris -> uris) + end + +class interpModel = + let cols = new GTree.column_list in + let id_col = cols#add Gobject.Data.string in + let dsc_col = cols#add Gobject.Data.string in + let interp_no_col = cols#add Gobject.Data.int in + let tree_store = GTree.tree_store cols in + let id_renderer = GTree.cell_renderer_text [], ["text", id_col] in + let dsc_renderer = GTree.cell_renderer_text [], ["text", dsc_col] in + let id_view_col = GTree.view_column ~renderer:id_renderer () in + let dsc_view_col = GTree.view_column ~renderer:dsc_renderer () in + fun tree_view choices -> + object + initializer + tree_view#set_model (Some (tree_store :> GTree.model)); + ignore (tree_view#append_column id_view_col); + ignore (tree_view#append_column dsc_view_col); + let name_of_interp = + (* try to find a reasonable name for an interpretation *) + let idx = ref 0 in + fun interp -> + try + List.assoc "0" interp + with Not_found -> + incr idx; string_of_int !idx + in + tree_store#clear (); + let idx = ref ~-1 in + List.iter + (fun interp -> + incr idx; + let interp_row = tree_store#append () in + tree_store#set ~row:interp_row ~column:id_col + (name_of_interp interp); + tree_store#set ~row:interp_row ~column:interp_no_col !idx; + List.iter + (fun (id, dsc) -> + let row = tree_store#append ~parent:interp_row () in + tree_store#set ~row ~column:id_col id; + tree_store#set ~row ~column:dsc_col dsc; + tree_store#set ~row ~column:interp_no_col !idx) + interp) + choices + + method get_interp_no tree_path = + let iter = tree_store#get_iter tree_path in + tree_store#get ~row:iter ~column:interp_no_col + end + +let interactive_string_choice + text prefix_len ?(title = "") ?(msg = "") () ~id locs uris += + let gui = instance () in + let dialog = gui#newUriDialog () in + dialog#uriEntryHBox#misc#hide (); + dialog#uriChoiceSelectedButton#misc#hide (); + dialog#uriChoiceAutoButton#misc#hide (); + dialog#uriChoiceConstantsButton#misc#hide (); + dialog#uriChoiceTreeView#selection#set_mode + (`SINGLE :> Gtk.Tags.selection_mode); + let model = new stringListModel dialog#uriChoiceTreeView in + let choices = ref None in + dialog#uriChoiceDialog#set_title title; + let hack_len = MatitaGtkMisc.utf8_string_length text in + let rec colorize acc_len = function + | [] -> + let floc = HExtlib.floc_of_loc (acc_len,hack_len) in + fst(MatitaGtkMisc.utf8_parsed_text text floc) + | he::tl -> + let start, stop = HExtlib.loc_of_floc he in + let floc1 = HExtlib.floc_of_loc (acc_len,start) in + let str1,_=MatitaGtkMisc.utf8_parsed_text text floc1 in + let str2,_ = MatitaGtkMisc.utf8_parsed_text text he in + str1 ^ "" ^ str2 ^ "" ^ colorize stop tl + in +(* List.iter (fun l -> let start, stop = HExtlib.loc_of_floc l in + Printf.eprintf "(%d,%d)" start stop) locs; *) + let locs = + List.sort + (fun loc1 loc2 -> + fst (HExtlib.loc_of_floc loc1) - fst (HExtlib.loc_of_floc loc2)) + locs + in +(* prerr_endline "XXXXXXXXXXXXXXXXXXXX"; + List.iter (fun l -> let start, stop = HExtlib.loc_of_floc l in + Printf.eprintf "(%d,%d)" start stop) locs; + prerr_endline "XXXXXXXXXXXXXXXXXXXX2"; *) + dialog#uriChoiceLabel#set_use_markup true; + let txt = colorize 0 locs in + let txt,_ = MatitaGtkMisc.utf8_parsed_text txt + (HExtlib.floc_of_loc (prefix_len,MatitaGtkMisc.utf8_string_length txt)) + in + dialog#uriChoiceLabel#set_label txt; + List.iter model#easy_append uris; + let return v = + choices := v; + dialog#uriChoiceDialog#destroy (); + GMain.Main.quit () + in + ignore (dialog#uriChoiceDialog#event#connect#delete (fun _ -> true)); + connect_button dialog#uriChoiceForwardButton (fun _ -> + match model#easy_selection () with + | [] -> () + | uris -> return (Some uris)); + connect_button dialog#uriChoiceAbortButton (fun _ -> return None); + dialog#uriChoiceDialog#show (); + GtkThread.main (); + (match !choices with + | None -> raise MatitaTypes.Cancel + | Some uris -> uris) + +let interactive_interp_choice () text prefix_len choices = +(*List.iter (fun l -> prerr_endline "==="; List.iter (fun (_,id,dsc) -> prerr_endline (id ^ " = " ^ dsc)) l) choices;*) + let filter_choices filter = + let rec is_compatible filter = + function + [] -> true + | ([],_,_)::tl -> is_compatible filter tl + | (loc::tlloc,id,dsc)::tl -> + try + if List.assoc (loc,id) filter = dsc then + is_compatible filter ((tlloc,id,dsc)::tl) + else + false + with + Not_found -> true + in + List.filter (fun (_,interp) -> is_compatible filter interp) + in + let rec get_choices loc id = + function + [] -> [] + | (_,he)::tl -> + let _,_,dsc = + List.find (fun (locs,id',_) -> id = id' && List.mem loc locs) he + in + dsc :: (List.filter (fun dsc' -> dsc <> dsc') (get_choices loc id tl)) + in + let example_interp = + match choices with + [] -> assert false + | he::_ -> he in + let ask_user id locs choices = + interactive_string_choice + text prefix_len + ~title:"Ambiguous input" + ~msg:("Choose an interpretation for " ^ id) () ~id locs choices + in + let rec classify ids filter partial_interpretations = + match ids with + [] -> List.map fst partial_interpretations + | ([],_,_)::tl -> classify tl filter partial_interpretations + | (loc::tlloc,id,dsc)::tl -> + let choices = get_choices loc id partial_interpretations in + let chosen_dsc = + match choices with + [] -> prerr_endline ("NO CHOICES FOR " ^ id); assert false + | [dsc] -> dsc + | _ -> + match ask_user id [loc] choices with + [x] -> x + | _ -> assert false + in + let filter = ((loc,id),chosen_dsc)::filter in + let compatible_interps = filter_choices filter partial_interpretations in + classify ((tlloc,id,dsc)::tl) filter compatible_interps + in + let enumerated_choices = + let idx = ref ~-1 in + List.map (fun interp -> incr idx; !idx,interp) choices + in + classify example_interp [] enumerated_choices + +let _ = + (* disambiguator callbacks *) + GrafiteDisambiguator.set_choose_uris_callback (interactive_uri_choice ()); + GrafiteDisambiguator.set_choose_interp_callback (interactive_interp_choice ()); + (* gtk initialization *) + GtkMain.Rc.add_default_file BuildTimeConf.gtkrc_file; (* loads gtk rc *) + GMathView.add_configuration_path BuildTimeConf.gtkmathview_conf; + ignore (GMain.Main.init ()) + diff --git a/matita/matitaGui.mli b/matita/matitaGui.mli new file mode 100644 index 000000000..388c79e1a --- /dev/null +++ b/matita/matitaGui.mli @@ -0,0 +1,52 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** for debugging only *) +val all_disambiguation_passes: bool ref + + (** singleton instance of the gui *) +val instance: unit -> MatitaGuiTypes.gui + + (** {2 Disambiguation callbacks} + * Use singleton gui instance. *) + + (** @param selection_mode selection mode in uri list, default to `MULTIPLE + * @param title window title, defaults to "" + * @param msg message for the user, defaults to "" + * @param nonvars_button enable button to exclude vars?, defaults to false + * @raise MatitaTypes.Cancel *) +val interactive_uri_choice: + ?selection_mode:([`SINGLE|`MULTIPLE]) -> ?title:string -> + ?msg:string -> ?nonvars_button:bool -> + ?hide_uri_entry:bool -> ?hide_try:bool -> ?ok_label:string -> + ?ok_action:[`AUTO|`SELECT] -> + ?copy_cb:(string -> unit) -> unit -> + GrafiteDisambiguator.choose_uris_callback + + (** @raise MatitaTypes.Cancel *) +val interactive_interp_choice: + unit -> + GrafiteDisambiguator.choose_interp_callback + diff --git a/matita/matitaGuiTypes.mli b/matita/matitaGuiTypes.mli new file mode 100644 index 000000000..67d431040 --- /dev/null +++ b/matita/matitaGuiTypes.mli @@ -0,0 +1,152 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +class type console = +object + method message: string -> unit + method error: string -> unit + method warning: string -> unit + method debug: string -> unit + method clear: unit -> unit + + method log_callback: HLog.log_callback +end + +class type browserWin = +object + inherit MatitaGeneratedGui.browserWin + method browserUri: GEdit.combo_box_entry +end + +class type gui = +object + method setQuitCallback : (unit -> unit) -> unit + + (** {2 Access to singleton instances of lower-level GTK widgets} *) + + method fileSel : MatitaGeneratedGui.fileSelectionWin + method main : MatitaGeneratedGui.mainWin + method findRepl : MatitaGeneratedGui.findReplWin + method develList: MatitaGeneratedGui.develListWin + method newDevel: MatitaGeneratedGui.newDevelWin +(* method toolbar : MatitaGeneratedGui.toolBarWin *) + + method console: console + method sourceView: GSourceView.source_view + + (** {2 Dialogs instantiation} + * methods below create a new window on each invocation. You should + * remember to destroy windows after use *) + + method newBrowserWin: unit -> browserWin + method newUriDialog: unit -> MatitaGeneratedGui.uriChoiceDialog + method newConfirmationDialog: unit -> MatitaGeneratedGui.confirmationDialog + method newEmptyDialog: unit -> MatitaGeneratedGui.emptyDialog + + (** {2 Selections / clipboards handling} *) + + method canCopy: bool + method canCut: bool + method canDelete: bool + method canPaste: bool + method canPastePattern: bool + + method markupSelected: bool + + method copy: unit -> unit + method cut: unit -> unit + method delete: unit -> unit + method paste: unit -> unit + method pastePattern: unit -> unit + + (** {2 Utility methods} *) + + (** ask the used to choose a file with the file chooser + * @param ok_not_exists if set to true returns also non existent files + * (useful for save). Defaults to false *) + method chooseFile: ?ok_not_exists:bool -> unit -> string option + method createDevelopment: containing:string option -> unit + + (** prompt the user for a (multiline) text entry *) + method askText: ?title:string -> ?msg:string -> unit -> string option + + method loadScript: string -> unit + method setStar: string -> bool -> unit + + (** {3 Fonts} *) + method increaseFontSize: unit -> unit + method decreaseFontSize: unit -> unit + method resetFontSize: unit -> unit +end + +type paste_kind = [ `Term | `Pattern ] + + (** multi selection gtkMathView which handle mactions and hyperlinks. Mactions + * are handled internally. Hyperlinks are handled by calling an user provided + * callback *) +class type clickableMathView = +object + inherit GMathViewAux.multi_selection_math_view + + (** set hyperlink callback. None disable hyperlink handling *) + method set_href_callback: (string -> unit) option -> unit + + method has_selection: bool + + (** @raise Failure "no selection" *) + method strings_of_selection: (paste_kind * string) list + + method update_font_size: unit +end + +class type cicMathView = +object + inherit clickableMathView + + (** load a sequent and render it into parent widget *) + method load_sequent: Cic.metasenv -> int -> unit + + method load_object: Cic.obj -> unit +end + +class type sequentsViewer = +object + method reset: unit + method load_logo: unit + method load_logo_with_qed: unit + method load_sequents: GrafiteTypes.incomplete_proof -> unit + method goto_sequent: int -> unit (* to be called _after_ load_sequents *) + + method cicMathView: cicMathView +end + +class type cicBrowser = +object + method load: MatitaTypes.mathViewer_entry -> unit + (* method loadList: string list -> MatitaTypes.mathViewer_entry -> unit *) + method loadInput: string -> unit + method mathView: clickableMathView +end + diff --git a/matita/matitaInit.ml b/matita/matitaInit.ml new file mode 100644 index 000000000..e9d447c11 --- /dev/null +++ b/matita/matitaInit.ml @@ -0,0 +1,358 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +type thingsToInitilaize = + ConfigurationFile | Db | Environment | Getter | Makelib | CmdLine | Registry + +exception FailedToInitialize of thingsToInitilaize + +let wants s l = + List.iter ( + fun item -> + if not (List.exists (fun x -> x = item) l) then + raise (FailedToInitialize item)) + s + +let already_configured s l = + List.for_all (fun item -> List.exists (fun x -> x = item) l) s + +let conffile = ref BuildTimeConf.matita_conf + +let registry_defaults = [ + "matita.debug", "false"; + "matita.external_editor", "gvim -f -c 'go %p' %f"; + "matita.preserve", "false"; + "matita.profile", "true"; + "matita.system", "false"; + "matita.verbosity", "1"; + "matita.bench", "false"; + "matita.paste_unicode_as_tex", "false"; + "matita.noinnertypes", "false"; + "matita.do_heavy_checks", "true"; + (** verbosity level: 1 is the default, 0 is intuitively "quiet", > 1 is + * intuitively verbose *) +] + +let set_registry_values = + List.iter + (fun key, value -> + if not (Helm_registry.has key) then Helm_registry.set ~key ~value) + +let fill_registry init_status = + if not (already_configured [ Registry ] init_status) then begin + set_registry_values registry_defaults; + Registry :: init_status + end else + init_status + +let load_configuration init_status = + if not (already_configured [ConfigurationFile] init_status) then + begin + Helm_registry.load_from !conffile; + if not (Helm_registry.has "user.name") then begin + let login = (Unix.getpwuid (Unix.getuid ())).Unix.pw_name in + Helm_registry.set "user.name" login + end; + let home = Helm_registry.get_string "matita.basedir" in + let user_conf_file = home ^ "/matita.conf.xml" in + if HExtlib.is_regular user_conf_file then + begin + HLog.message ("Loading additional conf file from " ^ user_conf_file); + try + Helm_registry.load_from user_conf_file + with exn -> + HLog.error + ("While loading conf file: " ^ snd (MatitaExcPp.to_string exn)) + end; + ConfigurationFile::init_status + end + else + init_status + +let initialize_db init_status = + wants [ ConfigurationFile; CmdLine ] init_status; + if not (already_configured [ Db ] init_status) then + begin + if not (Helm_registry.get_bool "matita.system") then + MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner"); + LibraryDb.create_owner_environment (); + Db::init_status + end + else + init_status + +let initialize_makelib init_status = + wants [ConfigurationFile] init_status; + if not (already_configured [Makelib] init_status) then + begin + MatitamakeLib.initialize (); + Makelib::init_status + end + else + init_status + +let initialize_environment init_status = + wants [CmdLine] init_status; + if not (already_configured [Getter;Environment] init_status) then + begin + Http_getter.init (); + if Helm_registry.get_bool "matita.system" then + Http_getter_storage.activate_system_mode (); + CicEnvironment.set_trust (* environment trust *) + (let trust = + Helm_registry.get_opt_default Helm_registry.get_bool + ~default:true "matita.environment_trust" in + fun _ -> trust); + Getter::Environment::init_status + end + else + init_status + +let status = ref [] + +let usages = Hashtbl.create 11 (** app name (e.g. "matitac") -> usage string *) +let _ = + List.iter + (fun (name, s) -> Hashtbl.replace usages name s) + [ "matitac", + Printf.sprintf "MatitaC v%s +Usage: matitac [ OPTION ... ] FILE +Options:" + BuildTimeConf.version; + "gragrep", + Printf.sprintf "Grafite Grep v%s +Usage: gragrep [ -r ] PATH +Options:" + BuildTimeConf.version; + "matitaprover", + Printf.sprintf "Matita's prover v%s +Usage: matitaprover [ -tptppath ] FILE.p +Options:" + BuildTimeConf.version; + "matita", + Printf.sprintf "Matita v%s +Usage: matita [ OPTION ... ] [ FILE ... ] +Options:" + BuildTimeConf.version; + "cicbrowser", + Printf.sprintf + "CIC Browser v%s +Usage: cicbrowser [ URL | WHELP QUERY ] +Options:" + BuildTimeConf.version; + "matitadep", + Printf.sprintf "MatitaDep v%s +Usage: matitadep [ OPTION ... ] FILE ... +Options:" + BuildTimeConf.version; + "matitaclean", + Printf.sprintf "MatitaClean v%s +Usage: matitaclean all + matitaclean [ (FILE | URI) ... ] +Options:" + BuildTimeConf.version; + "matitamake", + Printf.sprintf "MatitaMake v%s +Usage: matitamake [ OPTION ... ] (init | clean | list | destroy | build) + init + Parameters: name (the name of the development, required) + root (the directory in which the delopment is rooted, + optional, default is current working directory) + Description: tells matitamake that a new development radicated + in the current working directory should be handled. + clean + Parameters: name (the name of the development to destroy, optional) + If omitted the development that holds the current working + directory is used (if any). + Description: clean the develpoment. + list + Parameters: + Description: lists the known developments and their roots. + destroy + Parameters: name (the name of the development to destroy, required) + Description: deletes a development (only from matitamake metadat, no + .ma files will be deleted). + build + Parameters: name (the name of the development to build, required) + Description: completely builds the develpoment. + publish + Parameters: name (the name of the development to publish, required) + Description: cleans the development in the user space, rebuilds it + in the system space ('ro' repositories, that for this operation + becames writable). +Notes: + If target is omitted an 'all' will be used as the default. + With -build you can build a development wherever it is. + If you specify a target it implicitly refers to the development that + holds the current working directory (if any). +Options:" + BuildTimeConf.version; + ] +let default_usage = + Printf.sprintf + "Matita v%s\nUsage: matita [ ARG ]\nOptions:" BuildTimeConf.version + +let usage () = + let basename = Filename.basename Sys.argv.(0) in + let usage_key = + try Filename.chop_extension basename with Invalid_argument _ -> basename + in + try Hashtbl.find usages usage_key with Not_found -> default_usage + +let extra_cmdline_specs = ref [] +let add_cmdline_spec l = extra_cmdline_specs := l @ !extra_cmdline_specs + +let parse_cmdline init_status = + if not (already_configured [CmdLine] init_status) then begin + wants [Registry] init_status; + let includes = ref [] in + let default_includes = [ + "."; + BuildTimeConf.stdlib_dir_devel; + BuildTimeConf.stdlib_dir_installed ; ] + in + let absolutize s = + if Pcre.pmatch ~pat:"^/" s then s else Sys.getcwd() ^"/"^s + in + let args = ref [] in + let add_l l = fun s -> l := s :: !l in + let reduce_verbosity () = + Helm_registry.set_int "matita.verbosity" + (Helm_registry.get_int "matita.verbosity" - 1) in + let print_version () = + Printf.printf "%s\n" BuildTimeConf.version;exit 0 in + let increase_verbosity () = + Helm_registry.set_int "matita.verbosity" + (Helm_registry.get_int "matita.verbosity" + 1) in + let no_innertypes () = + Helm_registry.set_bool "matita.noinnertypes" true in + let set_baseuri s = + match Str.split (Str.regexp "::") s with + | [path; uri] -> Helm_registry.set "matita.baseuri" + (HExtlib.normalize_path (absolutize path)^" "^uri) + | _ -> raise (Failure "bad baseuri, use -b 'path::uri'") + in + let arg_spec = + let std_arg_spec = [ + "-b", Arg.String set_baseuri, " forces the baseuri of path"; + "-I", Arg.String (add_l includes), + (" Adds path to the list of searched paths for the " + ^ "include command"); + "-conffile", Arg.Set_string conffile, + (Printf.sprintf (" Read configuration from filename" + ^^ "\n Default: %s") + BuildTimeConf.matita_conf); + "-force", + Arg.Unit (fun () -> Helm_registry.set_bool "matita.force" true), + ("Force actions that would not be executed per default"); + "-noprofile", + Arg.Unit (fun () -> Helm_registry.set_bool "matita.profile" false), + "Turns off profiling printings"; + "-noinnertypes", Arg.Unit no_innertypes, + "Turns off inner types generation while publishing"; + "-profile-only", + Arg.String (fun rex -> Helm_registry.set "matita.profile_only" rex), + "Activates only profiler with label matching the provided regex"; + "-bench", + Arg.Unit (fun () -> Helm_registry.set_bool "matita.bench" true), + "Turns on parsable output on stdout, that is timings for matitac..."; + "-preserve", + Arg.Unit (fun () -> Helm_registry.set_bool "matita.preserve" true), + "Turns off automatic baseuri cleaning"; + "-q", Arg.Unit reduce_verbosity, "Reduce verbosity"; + "-system", Arg.Unit (fun () -> + Helm_registry.set_bool "matita.system" true), + ("Act on the system library instead of the user one" + ^ "\n WARNING: not for the casual user"); + "-v", Arg.Unit increase_verbosity, "Increase verbosity"; + "--version", Arg.Unit print_version, "Prints version"; + ] in + let debug_arg_spec = + if BuildTimeConf.debug then + [ "-debug", + Arg.Unit (fun () -> Helm_registry.set_bool "matita.debug" true), + ("Do not catch top-level exception " + ^ "(useful for backtrace inspection)"); + "-onepass", + Arg.Unit (fun () -> GrafiteDisambiguator.only_one_pass := true), + "Enable only one disambiguation pass"; + ] + else [] + in + std_arg_spec @ debug_arg_spec @ !extra_cmdline_specs + in + let set_list ~key l = + Helm_registry.set_list Helm_registry.of_string ~key ~value:l + in + Arg.parse arg_spec (add_l args) (usage ()); + let includes = + List.map (fun x -> HExtlib.normalize_path (absolutize x)) + ((List.rev !includes) @ default_includes) + in + set_list ~key:"matita.includes" includes; + let args = List.rev (List.filter (fun x -> x <> "") !args) in + set_list ~key:"matita.args" args; + HExtlib.set_profiling_printings + (fun s -> + Helm_registry.get_bool "matita.profile" && + Pcre.pmatch + ~pat:(Helm_registry.get_opt_default + Helm_registry.string ~default:".*" "matita.profile_only") + s); + CmdLine :: init_status + end else + init_status + +let die_usage () = + print_endline (usage ()); + exit 1 + +let conf_components = + [ load_configuration; fill_registry; parse_cmdline] + +let other_components = + [ initialize_makelib; initialize_db; initialize_environment ] + +let initialize_all () = + status := + List.fold_left (fun s f -> f s) !status + (conf_components @ other_components) +(* initialize_notation + (initialize_environment + (initialize_db + (initialize_makelib + (load_configuration + (parse_cmdline !status))))) *) + +let parse_cmdline_and_configuration_file () = + status := List.fold_left (fun s f -> f s) !status conf_components + +let initialize_environment () = + status := initialize_environment !status + +let _ = + Inversion_principle.init () diff --git a/matita/matitaInit.mli b/matita/matitaInit.mli new file mode 100644 index 000000000..ac0dc6a75 --- /dev/null +++ b/matita/matitaInit.mli @@ -0,0 +1,40 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + + (** {2 global initialization} *) +val initialize_all: unit -> unit + + (** {2 per-components initialization} *) +val parse_cmdline_and_configuration_file: unit -> unit +val initialize_environment: unit -> unit + + (** {2 Utilities} *) + + (** die nicely: exit with return code 1 printing usage error message *) +val die_usage: unit -> 'a + + (** add extra command line options *) +val add_cmdline_spec: (Arg.key * Arg.spec * Arg.doc) list -> unit + diff --git a/matita/matitaMathView.ml b/matita/matitaMathView.ml new file mode 100644 index 000000000..23f57820d --- /dev/null +++ b/matita/matitaMathView.ml @@ -0,0 +1,1319 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://cs.unibo.it/helm/. + *) + +(* $Id$ *) + +open Printf + +open GrafiteTypes +open MatitaGtkMisc +open MatitaGuiTypes + +module Stack = Continuationals.Stack + +(** inherit from this class if you want to access current script *) +class scriptAccessor = +object (self) + method private script = MatitaScript.current () +end + +let cicBrowsers = ref [] +let gui_instance = ref None +let set_gui gui = gui_instance := Some gui +let get_gui () = + match !gui_instance with + | None -> assert false + | Some gui -> gui + +let default_font_size () = + Helm_registry.get_opt_default Helm_registry.int + ~default:BuildTimeConf.default_font_size "matita.font_size" +let current_font_size = ref ~-1 +let increase_font_size () = incr current_font_size +let decrease_font_size () = decr current_font_size +let reset_font_size () = current_font_size := default_font_size () + + (* is there any lablgtk2 constant corresponding to the various mouse + * buttons??? *) +let left_button = 1 +let middle_button = 2 +let right_button = 3 + +let near (x1, y1) (x2, y2) = + let distance = sqrt (((x2 -. x1) ** 2.) +. ((y2 -. y1) ** 2.)) in + (distance < 4.) + +let xlink_ns = Gdome.domString "http://www.w3.org/1999/xlink" +let helm_ns = Gdome.domString "http://www.cs.unibo.it/helm" +let href_ds = Gdome.domString "href" +let xref_ds = Gdome.domString "xref" + +let domImpl = Gdome.domImplementation () + + (** Gdome.element of a MathML document whose rendering should be blank. Used + * by cicBrowser to render "about:blank" document *) +let empty_mathml = lazy ( + domImpl#createDocument ~namespaceURI:(Some DomMisc.mathml_ns) + ~qualifiedName:(Gdome.domString "math") ~doctype:None) + +let empty_boxml = lazy ( + domImpl#createDocument ~namespaceURI:(Some DomMisc.boxml_ns) + ~qualifiedName:(Gdome.domString "box") ~doctype:None) + + (** shown for goals closed by side effects *) +let closed_goal_mathml = lazy ( + domImpl#createDocumentFromURI ~uri:BuildTimeConf.closed_xml ()) + +(* ids_to_terms should not be passed here, is just for debugging *) +let find_root_id annobj id ids_to_father_ids ids_to_terms ids_to_inner_types = + let find_parent id ids = + let rec aux id = +(* (prerr_endline (sprintf "id %s = %s" id + (try + CicPp.ppterm (Hashtbl.find ids_to_terms id) + with Not_found -> "NONE"))); *) + if List.mem id ids then Some id + else + (match + (try Hashtbl.find ids_to_father_ids id with Not_found -> None) + with + | None -> None + | Some id' -> aux id') + in + aux id + in + let return_father id ids = + match find_parent id ids with + | None -> assert false + | Some parent_id -> parent_id + in + let mk_ids terms = List.map CicUtil.id_of_annterm terms in + let inner_types = + Hashtbl.fold + (fun _ types acc -> + match types.Cic2acic.annexpected with + None -> types.Cic2acic.annsynthesized :: acc + | Some ty -> ty :: types.Cic2acic.annsynthesized :: acc + ) ids_to_inner_types [] in + match annobj with + | Cic.AConstant (_, _, _, Some bo, ty, _, _) + | Cic.AVariable (_, _, Some bo, ty, _, _) + | Cic.ACurrentProof (_, _, _, _, bo, ty, _, _) -> + return_father id (mk_ids (ty :: bo :: inner_types)) + | Cic.AConstant (_, _, _, None, ty, _, _) + | Cic.AVariable (_, _, None, ty, _, _) -> + return_father id (mk_ids (ty::inner_types)) + | Cic.AInductiveDefinition _ -> + assert false (* TODO *) + + (** @return string content of a dom node having a single text child node, e.g. + * bool *) +let string_of_dom_node node = + match node#get_firstChild with + | None -> "" + | Some node -> + (try + let text = new Gdome.text_of_node node in + text#get_data#to_string + with GdomeInit.DOMCastException _ -> "") + +let name_of_hypothesis = function + | Some (Cic.Name s, _) -> s + | _ -> assert false + +let id_of_node (node: Gdome.element) = + let xref_attr = + node#getAttributeNS ~namespaceURI:helm_ns ~localName:xref_ds in + try + List.hd (HExtlib.split ~sep:' ' xref_attr#to_string) + with Failure _ -> assert false + +type selected_term = + | SelTerm of Cic.term * string option (* term, parent hypothesis (if any) *) + | SelHyp of string * Cic.context (* hypothesis, context *) + +let hrefs_of_elt elt = + let localName = href_ds in + if elt#hasAttributeNS ~namespaceURI:xlink_ns ~localName then + let text = + (elt#getAttributeNS ~namespaceURI:xlink_ns ~localName)#to_string in + Some (HExtlib.split text) + else + None + +class clickableMathView obj = +let text_width = 80 in +object (self) + inherit GMathViewAux.multi_selection_math_view obj + + val mutable href_callback: (string -> unit) option = None + method set_href_callback f = href_callback <- f + + val mutable _cic_info = None + method private set_cic_info info = _cic_info <- info + method private cic_info = _cic_info + + val normal_cursor = Gdk.Cursor.create `LEFT_PTR + val href_cursor = Gdk.Cursor.create `HAND1 + + initializer + self#set_font_size !current_font_size; + ignore (self#connect#selection_changed self#choose_selection_cb); + ignore (self#event#connect#button_press self#button_press_cb); + ignore (self#event#connect#button_release self#button_release_cb); + ignore (self#event#connect#selection_clear self#selection_clear_cb); + ignore (self#connect#element_over self#element_over_cb); + ignore (self#coerce#misc#connect#selection_get self#selection_get_cb) + + val mutable button_press_x = -1. + val mutable button_press_y = -1. + val mutable selection_changed = false + val mutable href_statusbar_msg: + (GMisc.statusbar_context * Gtk.statusbar_message) option = None + (* *) + + method private selection_get_cb ctxt ~info ~time = + let text = + match ctxt#target with + | "PATTERN" -> self#text_of_selection `Pattern + | "TERM" | _ -> self#text_of_selection `Term + in + match text with + | None -> () + | Some s -> ctxt#return s + + method private text_of_selection fmt = + match self#get_selections with + | [] -> None + | node :: _ -> Some (self#string_of_node ~paste_kind:fmt node) + + method private selection_clear_cb sel_event = + self#remove_selections; + (GData.clipboard Gdk.Atom.clipboard)#clear (); + false + + method private button_press_cb gdk_button = + let button = GdkEvent.Button.button gdk_button in + if button = left_button then begin + button_press_x <- GdkEvent.Button.x gdk_button; + button_press_y <- GdkEvent.Button.y gdk_button; + selection_changed <- false + end else if button = right_button then + self#popup_contextual_menu (GdkEvent.Button.time gdk_button); + false + + method private element_over_cb (elt_opt, _, _, _) = + let win () = self#misc#window in + let leave_href () = + Gdk.Window.set_cursor (win ()) normal_cursor; + HExtlib.iter_option (fun (ctxt, msg) -> ctxt#remove msg) + href_statusbar_msg + in + match elt_opt with + | Some elt -> + (match hrefs_of_elt elt with + | Some ((_ :: _) as hrefs) -> + Gdk.Window.set_cursor (win ()) href_cursor; + let msg_text = (* now create statusbar msg and store it *) + match hrefs with + | [ href ] -> sprintf "Hyperlink to %s" href + | _ -> sprintf "Hyperlinks to: %s" (String.concat ", " hrefs) in + let ctxt = (get_gui ())#main#statusBar#new_context ~name:"href" in + let msg = ctxt#push msg_text in + href_statusbar_msg <- Some (ctxt, msg) + | _ -> leave_href ()) + | None -> leave_href () + + method private tactic_text_pattern_of_node node = + let id = id_of_node node in + let cic_info, unsh_sequent = self#get_cic_info id in + match self#get_term_by_id cic_info id with + | SelTerm (t, father_hyp) -> + let sequent = self#sequent_of_id ~paste_kind:`Pattern id in + let text = self#string_of_cic_sequent ~output_type:`Pattern sequent in + (match father_hyp with + | None -> None, [], Some text + | Some hyp_name -> None, [ hyp_name, text ], None) + | SelHyp (hyp_name, _ctxt) -> None, [ hyp_name, "%" ], None + + method private tactic_text_of_node node = + let id = id_of_node node in + let cic_info, unsh_sequent = self#get_cic_info id in + match self#get_term_by_id cic_info id with + | SelTerm (t, father_hyp) -> + let sequent = self#sequent_of_id ~paste_kind:`Term id in + let text = self#string_of_cic_sequent ~output_type:`Term sequent in + text + | SelHyp (hyp_name, _ctxt) -> hyp_name + + (** @return a pattern structure which contains pretty printed terms *) + method private tactic_text_pattern_of_selection = + match self#get_selections with + | [] -> assert false (* this method is invoked only if there's a sel. *) + | node :: _ -> self#tactic_text_pattern_of_node node + + method private popup_contextual_menu time = + let menu = GMenu.menu () in + let add_menu_item ?(menu = menu) ?stock ?label () = + GMenu.image_menu_item ?stock ?label ~packing:menu#append () in + let check = add_menu_item ~label:"Check" () in + let reductions_menu_item = GMenu.menu_item ~label:"βδιζ-reduce" () in + let tactics_menu_item = GMenu.menu_item ~label:"Apply tactic" () in + menu#append reductions_menu_item; + menu#append tactics_menu_item; + let reductions = GMenu.menu () in + let tactics = GMenu.menu () in + reductions_menu_item#set_submenu reductions; + tactics_menu_item#set_submenu tactics; + let normalize = add_menu_item ~menu:reductions ~label:"Normalize" () in + let reduce = add_menu_item ~menu:reductions ~label:"Reduce" () in + let simplify = add_menu_item ~menu:reductions ~label:"Simplify" () in + let whd = add_menu_item ~menu:reductions ~label:"Weak head" () in + menu#append (GMenu.separator_item ()); + let copy = add_menu_item ~stock:`COPY () in + let gui = get_gui () in + List.iter (fun item -> item#misc#set_sensitive gui#canCopy) + [ copy; check; normalize; reduce; simplify; whd ]; + let reduction_action kind () = + let pat = self#tactic_text_pattern_of_selection in + let statement = + let loc = HExtlib.dummy_floc in + "\n" ^ + GrafiteAstPp.pp_executable ~term_pp:(fun s -> s) + ~lazy_term_pp:(fun _ -> assert false) ~obj_pp:(fun _ -> assert false) + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + (GrafiteAst.Tactic (loc, + Some (GrafiteAst.Reduce (loc, kind, pat)), + GrafiteAst.Semicolon loc)) in + (MatitaScript.current ())#advance ~statement () in + connect_menu_item copy gui#copy; + connect_menu_item normalize (reduction_action `Normalize); + connect_menu_item reduce (reduction_action `Reduce); + connect_menu_item simplify (reduction_action `Simpl); + connect_menu_item whd (reduction_action `Whd); + menu#popup ~button:right_button ~time + + method private button_release_cb gdk_button = + if GdkEvent.Button.button gdk_button = left_button then begin + let button_release_x = GdkEvent.Button.x gdk_button in + let button_release_y = GdkEvent.Button.y gdk_button in + if selection_changed then + () + else (* selection _not_ changed *) + if near (button_press_x, button_press_y) + (button_release_x, button_release_y) + then + let x = int_of_float button_press_x in + let y = int_of_float button_press_y in + (match self#get_element_at x y with + | None -> () + | Some elt -> + (match hrefs_of_elt elt with + | Some hrefs -> self#invoke_href_callback hrefs gdk_button + | None -> ignore (self#action_toggle elt))) + end; + false + + method private invoke_href_callback hrefs gdk_button = + let button = GdkEvent.Button.button gdk_button in + if button = left_button then + let time = GdkEvent.Button.time gdk_button in + match href_callback with + | None -> () + | Some f -> + (match hrefs with + | [ uri ] -> f uri + | uris -> + let menu = GMenu.menu () in + List.iter + (fun uri -> + let menu_item = + GMenu.menu_item ~label:uri ~packing:menu#append () in + connect_menu_item menu_item + (fun () -> try f uri with Not_found -> assert false)) + uris; + menu#popup ~button ~time) + + method private choose_selection_cb gdome_elt = + let set_selection elt = + let misc = self#coerce#misc in + self#set_selection (Some elt); + misc#add_selection_target ~target:"STRING" Gdk.Atom.primary; + ignore (misc#grab_selection Gdk.Atom.primary); + in + let rec aux elt = + if (elt#getAttributeNS ~namespaceURI:helm_ns + ~localName:xref_ds)#to_string <> "" + then + set_selection elt + else + try + (match elt#get_parentNode with + | None -> assert false + | Some p -> aux (new Gdome.element_of_node p)) + with GdomeInit.DOMCastException _ -> () + in + (match gdome_elt with + | Some elt when (elt#getAttributeNS ~namespaceURI:xlink_ns + ~localName:href_ds)#to_string <> "" -> + set_selection elt + | Some elt -> aux elt + | None -> self#set_selection None); + selection_changed <- true + + method update_font_size = self#set_font_size !current_font_size + + (** find a term by id from stored CIC infos @return either `Hyp if the id + * correspond to an hypothesis or `Term (cic, hyp) if the id correspond to a + * term. In the latter case hyp is either None (if the term is a subterm of + * the sequent conclusion) or Some hyp_name if the term belongs to an + * hypothesis *) + method private get_term_by_id cic_info id = + let unsh_item, ids_to_terms, ids_to_hypotheses, ids_to_father_ids, _, _ = + cic_info in + let rec find_father_hyp id = + if Hashtbl.mem ids_to_hypotheses id + then Some (name_of_hypothesis (Hashtbl.find ids_to_hypotheses id)) + else + let father_id = + try Hashtbl.find ids_to_father_ids id + with Not_found -> assert false in + match father_id with + | Some id -> find_father_hyp id + | None -> None + in + try + let term = Hashtbl.find ids_to_terms id in + let father_hyp = find_father_hyp id in + SelTerm (term, father_hyp) + with Not_found -> + try + let hyp = Hashtbl.find ids_to_hypotheses id in + let _, context, _ = + match unsh_item with Some seq -> seq | None -> assert false in + let context' = MatitaMisc.list_tl_at hyp context in + SelHyp (name_of_hypothesis hyp, context') + with Not_found -> assert false + + method private find_obj_conclusion id = + match self#cic_info with + | None + | Some (_, _, _, _, _, None) -> assert false + | Some (_, ids_to_terms, _, ids_to_father_ids, ids_to_inner_types, Some annobj) -> + let id = + find_root_id annobj id ids_to_father_ids ids_to_terms ids_to_inner_types + in + (try Hashtbl.find ids_to_terms id with Not_found -> assert false) + + method private string_of_node ~(paste_kind:paste_kind) node = + if node#hasAttributeNS ~namespaceURI:helm_ns ~localName:xref_ds + then + match paste_kind with + | `Pattern -> + let tactic_text_pattern = self#tactic_text_pattern_of_node node in + GrafiteAstPp.pp_tactic_pattern + ~term_pp:(fun s -> s) ~lazy_term_pp:(fun _ -> assert false) + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + tactic_text_pattern + | `Term -> self#tactic_text_of_node node + else string_of_dom_node node + + method private string_of_cic_sequent ~output_type cic_sequent = + let script = MatitaScript.current () in + let metasenv = + if script#onGoingProof () then script#proofMetasenv else [] in + let map_unicode_to_tex = + Helm_registry.get_bool "matita.paste_unicode_as_tex" in + ApplyTransformation.txt_of_cic_sequent_conclusion ~map_unicode_to_tex + ~output_type text_width metasenv cic_sequent + + method private pattern_of term father_hyp unsh_sequent = + let _, unsh_context, conclusion = unsh_sequent in + let where = + match father_hyp with + None -> conclusion + | Some name -> + let rec aux = + function + [] -> assert false + | Some (Cic.Name name', Cic.Decl ty)::_ when name' = name -> ty + | Some (Cic.Name name', Cic.Def (bo,_))::_ when name' = name-> bo + | _::tl -> aux tl + in + aux unsh_context + in + ProofEngineHelpers.pattern_of ~term:where [term] + + method private get_cic_info id = + match self#cic_info with + | Some ((Some unsh_sequent, _, _, _, _, _) as info) -> info, unsh_sequent + | Some ((None, _, _, _, _, _) as info) -> + let t = self#find_obj_conclusion id in + info, (~-1, [], t) (* dummy sequent for obj *) + | None -> assert false + + method private sequent_of_id ~(paste_kind:paste_kind) id = + let cic_info, unsh_sequent = self#get_cic_info id in + let cic_sequent = + match self#get_term_by_id cic_info id with + | SelTerm (t, father_hyp) -> +(* +IDIOTA: PRIMA SI FA LA LOCATE, POI LA PATTERN_OF. MEGLIO UN'UNICA pattern_of CHE PRENDA IN INPUT UN TERMINE E UN SEQUENTE. PER IL MOMENTO RISOLVO USANDO LA father_hyp PER RITROVARE L'IPOTESI PERDUTA +*) + let occurrences = + ProofEngineHelpers.locate_in_conjecture t unsh_sequent in + (match occurrences with + | [ context, _t ] -> + (match paste_kind with + | `Term -> ~-1, context, t + | `Pattern -> ~-1, [], self#pattern_of t father_hyp unsh_sequent) + | _ -> + HLog.error (sprintf "found %d occurrences while 1 was expected" + (List.length occurrences)); + assert false) (* since it uses physical equality *) + | SelHyp (_name, context) -> ~-1, context, Cic.Rel 1 in + cic_sequent + + method private string_of_selection ~(paste_kind:paste_kind) = + match self#get_selections with + | [] -> None + | node :: _ -> Some (self#string_of_node ~paste_kind node) + + method has_selection = self#get_selections <> [] + + (** @return an associative list format -> string with all possible selection + * formats. Rationale: in order to convert the selection to TERM or PATTERN + * format we need the sequent, the metasenv, ... keeping all of them in a + * closure would be more expensive than keeping their already converted + * forms *) + method strings_of_selection = + try + let misc = self#coerce#misc in + List.iter + (fun target -> misc#add_selection_target ~target Gdk.Atom.clipboard) + [ "TERM"; "PATTERN"; "STRING" ]; + ignore (misc#grab_selection Gdk.Atom.clipboard); + List.map + (fun paste_kind -> + paste_kind, HExtlib.unopt (self#string_of_selection ~paste_kind)) + [ `Term; `Pattern ] + with Failure _ -> failwith "no selection" + +end + +let clickableMathView ?hadjustment ?vadjustment ?font_size ?log_verbosity = + GtkBase.Widget.size_params + ~cont:(OgtkMathViewProps.pack_return (fun p -> + OgtkMathViewProps.set_params + (new clickableMathView (GtkMathViewProps.MathView_GMetaDOM.create p)) + ~font_size:None ~log_verbosity:None)) + [] + +class cicMathView obj = +object (self) + inherit clickableMathView obj + + val mutable current_mathml = None + + method load_sequent metasenv metano = + let sequent = CicUtil.lookup_meta metano metasenv in + let (mathml, unsh_sequent, + (_, (ids_to_terms, ids_to_father_ids, ids_to_hypotheses,_ ))) + = + ApplyTransformation.mml_of_cic_sequent metasenv sequent + in + self#set_cic_info + (Some (Some unsh_sequent, + ids_to_terms, ids_to_hypotheses, ids_to_father_ids, + Hashtbl.create 1, None)); + if BuildTimeConf.debug then begin + let name = + "/tmp/sequent_viewer_" ^ string_of_int (Unix.getuid ()) ^ ".xml" in + HLog.debug ("load_sequent: dumping MathML to ./" ^ name); + ignore (domImpl#saveDocumentToFile ~name ~doc:mathml ()) + end; + self#load_root ~root:mathml#get_documentElement + + method load_object obj = + let use_diff = false in (* ZACK TODO use XmlDiff when re-rendering? *) + let (mathml, + (annobj, (ids_to_terms, ids_to_father_ids, _, ids_to_hypotheses, _, ids_to_inner_types))) + = + ApplyTransformation.mml_of_cic_object obj + in + self#set_cic_info + (Some (None, ids_to_terms, ids_to_hypotheses, ids_to_father_ids, ids_to_inner_types, Some annobj)); + (match current_mathml with + | Some current_mathml when use_diff -> + self#freeze; + XmlDiff.update_dom ~from:current_mathml mathml; + self#thaw + | _ -> + if BuildTimeConf.debug then begin + let name = + "/tmp/cic_browser_" ^ string_of_int (Unix.getuid ()) ^ ".xml" in + HLog.debug ("cic_browser: dumping MathML to ./" ^ name); + ignore (domImpl#saveDocumentToFile ~name ~doc:mathml ()) + end; + self#load_root ~root:mathml#get_documentElement; + current_mathml <- Some mathml); +end + +let tab_label meta_markup = + let rec aux = + function + | `Closed m -> sprintf "%s" (aux m) + | `Current m -> sprintf "%s" (aux m) + | `Shift (pos, m) -> sprintf "|%d: %s" pos (aux m) + | `Meta n -> sprintf "?%d" n + in + let markup = aux meta_markup in + (GMisc.label ~markup ~show:true ())#coerce + +let goal_of_switch = function Stack.Open g | Stack.Closed g -> g + +class sequentsViewer ~(notebook:GPack.notebook) ~(cicMathView:cicMathView) () = + object (self) + inherit scriptAccessor + + method cicMathView = cicMathView (** clickableMathView accessor *) + + val mutable pages = 0 + val mutable switch_page_callback = None + val mutable page2goal = [] (* associative list: page no -> goal no *) + val mutable goal2page = [] (* the other way round *) + val mutable goal2win = [] (* associative list: goal no -> scrolled win *) + val mutable _metasenv = [] + val mutable scrolledWin: GBin.scrolled_window option = None + (* scrolled window to which the sequentViewer is currently attached *) + val logo = (GMisc.image + ~file:(MatitaMisc.image_path "matita_medium.png") () + :> GObj.widget) + + val logo_with_qed = (GMisc.image + ~file:(MatitaMisc.image_path "matita_small.png") () + :> GObj.widget) + + method load_logo = + notebook#set_show_tabs false; + ignore(notebook#append_page logo) + + method load_logo_with_qed = + notebook#set_show_tabs false; + ignore(notebook#append_page logo_with_qed) + + method reset = + cicMathView#remove_selections; + (match scrolledWin with + | Some w -> + (* removing page from the notebook will destroy all contained widget, + * we do not want the cicMathView to be destroyed as well *) + w#remove cicMathView#coerce; + scrolledWin <- None + | None -> ()); + (match switch_page_callback with + | Some id -> + GtkSignal.disconnect notebook#as_widget id; + switch_page_callback <- None + | None -> ()); + for i = 0 to pages do notebook#remove_page 0 done; + notebook#set_show_tabs true; + pages <- 0; + page2goal <- []; + goal2page <- []; + goal2win <- []; + _metasenv <- []; + self#script#setGoal None + + method load_sequents + { proof = (_,metasenv,_subst,_,_, _) as proof; stack = stack } + = + _metasenv <- metasenv; + pages <- 0; + let win goal_switch = + let w = + GBin.scrolled_window ~hpolicy:`AUTOMATIC ~vpolicy:`ALWAYS + ~shadow_type:`IN ~show:true () + in + let reparent () = + scrolledWin <- Some w; + match cicMathView#misc#parent with + | None -> w#add cicMathView#coerce + | Some parent -> + let parent = + match cicMathView#misc#parent with + None -> assert false + | Some p -> GContainer.cast_container p + in + parent#remove cicMathView#coerce; + w#add cicMathView#coerce + in + goal2win <- (goal_switch, reparent) :: goal2win; + w#coerce + in + assert ( + let stack_goals = Stack.open_goals stack in + let proof_goals = ProofEngineTypes.goals_of_proof proof in + if + HExtlib.list_uniq (List.sort Pervasives.compare stack_goals) + <> List.sort Pervasives.compare proof_goals + then begin + prerr_endline ("STACK GOALS = " ^ String.concat " " (List.map string_of_int stack_goals)); + prerr_endline ("PROOF GOALS = " ^ String.concat " " (List.map string_of_int proof_goals)); + false + end + else true + ); + let render_switch = + function Stack.Open i ->`Meta i | Stack.Closed i ->`Closed (`Meta i) + in + let page = ref 0 in + let added_goals = ref [] in + (* goals can be duplicated on the tack due to focus, but we should avoid + * multiple labels in the user interface *) + let add_tab markup goal_switch = + let goal = Stack.goal_of_switch goal_switch in + if not (List.mem goal !added_goals) then begin + ignore(notebook#append_page + ~tab_label:(tab_label markup) (win goal_switch)); + page2goal <- (!page, goal_switch) :: page2goal; + goal2page <- (goal_switch, !page) :: goal2page; + incr page; + pages <- pages + 1; + added_goals := goal :: !added_goals + end + in + let add_switch _ _ (_, sw) = add_tab (render_switch sw) sw in + Stack.iter (** populate notebook with tabs *) + ~env:(fun depth tag (pos, sw) -> + let markup = + match depth, pos with + | 0, 0 -> `Current (render_switch sw) + | 0, _ -> `Shift (pos, `Current (render_switch sw)) + | 1, pos when Stack.head_tag stack = `BranchTag -> + `Shift (pos, render_switch sw) + | _ -> render_switch sw + in + add_tab markup sw) + ~cont:add_switch ~todo:add_switch + stack; + switch_page_callback <- + Some (notebook#connect#switch_page ~callback:(fun page -> + let goal_switch = + try List.assoc page page2goal with Not_found -> assert false + in + self#script#setGoal (Some (goal_of_switch goal_switch)); + self#render_page ~page ~goal_switch)) + + method private render_page ~page ~goal_switch = + (match goal_switch with + | Stack.Open goal -> cicMathView#load_sequent _metasenv goal + | Stack.Closed goal -> + let doc = Lazy.force closed_goal_mathml in + cicMathView#load_root ~root:doc#get_documentElement); + (try + cicMathView#set_selection None; + List.assoc goal_switch goal2win () + with Not_found -> assert false) + + method goto_sequent goal = + let goal_switch, page = + try + List.find + (function Stack.Open g, _ | Stack.Closed g, _ -> g = goal) + goal2page + with Not_found -> assert false + in + notebook#goto_page page; + self#render_page page goal_switch + + end + + (** constructors *) + +type 'widget constructor = + ?hadjustment:GData.adjustment -> + ?vadjustment:GData.adjustment -> + ?font_size:int -> + ?log_verbosity:int -> + ?width:int -> + ?height:int -> + ?packing:(GObj.widget -> unit) -> + ?show:bool -> + unit -> + 'widget + +let cicMathView ?hadjustment ?vadjustment ?font_size ?log_verbosity = + GtkBase.Widget.size_params + ~cont:(OgtkMathViewProps.pack_return (fun p -> + OgtkMathViewProps.set_params + (new cicMathView (GtkMathViewProps.MathView_GMetaDOM.create p)) + ~font_size ~log_verbosity)) + [] + +let blank_uri = BuildTimeConf.blank_uri +let current_proof_uri = BuildTimeConf.current_proof_uri + +type term_source = + [ `Ast of CicNotationPt.term + | `Cic of Cic.term * Cic.metasenv + | `String of string + ] + +class cicBrowser_impl ~(history:MatitaTypes.mathViewer_entry MatitaMisc.history) + () += + let whelp_RE = Pcre.regexp "^\\s*whelp" in + let uri_RE = + Pcre.regexp + "^cic:/([^/]+/)*[^/]+\\.(con|ind|var)(#xpointer\\(\\d+(/\\d+)+\\))?$" + in + let dir_RE = Pcre.regexp "^cic:((/([^/]+/)*[^/]+(/)?)|/|)$" in + let metadata_RE = Pcre.regexp "^metadata:/(deps)/(forward|backward)/(.*)$" in + let whelp_query_RE = Pcre.regexp + "^\\s*whelp\\s+([^\\s]+)\\s+(\"|\\()(.*)(\\)|\")$" + in + let is_metadata txt = Pcre.pmatch ~rex:metadata_RE txt in + let is_whelp txt = Pcre.pmatch ~rex:whelp_RE txt in + let is_uri txt = Pcre.pmatch ~rex:uri_RE txt in + let is_dir txt = Pcre.pmatch ~rex:dir_RE txt in + let gui = get_gui () in + let (win: MatitaGuiTypes.browserWin) = gui#newBrowserWin () in + let gviz = LablGraphviz.graphviz ~packing:win#graphScrolledWin#add () in + let queries = ["Locate";"Hint";"Match";"Elim";"Instance"] in + let combo,_ = GEdit.combo_box_text ~strings:queries () in + let activate_combo_query input q = + let q' = String.lowercase q in + let rec aux i = function + | [] -> failwith ("Whelp query '" ^ q ^ "' not found") + | h::_ when String.lowercase h = q' -> i + | _::tl -> aux (i+1) tl + in + win#queryInputText#set_text input; + combo#set_active (aux 0 queries); + in + let set_whelp_query txt = + let query, arg = + try + let q = Pcre.extract ~rex:whelp_query_RE txt in + q.(1), q.(3) + with Not_found -> failwith "Malformed Whelp query" + in + activate_combo_query arg query; + in + let toplevel = win#toplevel in + let mathView = cicMathView ~packing:win#scrolledBrowser#add () in + let fail message = + MatitaGtkMisc.report_error ~title:"Cic browser" ~message + ~parent:toplevel () + in + let tags = + [ "dir", GdkPixbuf.from_file (MatitaMisc.image_path "matita-folder.png"); + "obj", GdkPixbuf.from_file (MatitaMisc.image_path "matita-object.png") ] + in + let b = (not (Helm_registry.get_bool "matita.debug")) in + let handle_error f = + try + f () + with exn -> + if b then + fail (snd (MatitaExcPp.to_string exn)) + else raise exn + in + let handle_error' f = (fun () -> handle_error (fun () -> f ())) in + let load_easter_egg = lazy ( + win#browserImage#set_file (MatitaMisc.image_path "meegg.png")) + in + let load_coerchgraph tred () = + let str = CoercGraph.generate_dot_file () in + let filename, oc = Filename.open_temp_file "matita" ".dot" in + output_string oc str; + close_out oc; + if tred then + gviz#load_graph_from_file ~gviz_cmd:"tred|dot" filename + else + gviz#load_graph_from_file filename; + HExtlib.safe_remove filename + in + object (self) + inherit scriptAccessor + + (* Whelp bar queries *) + + val mutable gviz_graph = MetadataDeps.DepGraph.dummy + val mutable gviz_uri = UriManager.uri_of_string "cic:/dummy.con"; + + val dep_contextual_menu = GMenu.menu () + + initializer + activate_combo_query "" "locate"; + win#whelpBarComboVbox#add combo#coerce; + let start_query () = + let query = + try + String.lowercase (List.nth queries combo#active) + with Not_found -> assert false in + let input = win#queryInputText#text in + let statement = + if query = "locate" then + "whelp " ^ query ^ " \"" ^ input ^ "\"." + else + "whelp " ^ query ^ " (" ^ input ^ ")." + in + (MatitaScript.current ())#advance ~statement () + in + ignore(win#queryInputText#connect#activate ~callback:start_query); + ignore(combo#connect#changed ~callback:start_query); + win#whelpBarImage#set_file (MatitaMisc.image_path "whelp.png"); + win#mathOrListNotebook#set_show_tabs false; + win#browserForwardButton#misc#set_sensitive false; + win#browserBackButton#misc#set_sensitive false; + ignore (win#browserUri#entry#connect#activate (handle_error' (fun () -> + self#loadInput win#browserUri#entry#text))); + ignore (win#browserHomeButton#connect#clicked (handle_error' (fun () -> + self#load (`About `Current_proof)))); + ignore (win#browserRefreshButton#connect#clicked + (handle_error' (self#refresh ~force:true))); + ignore (win#browserBackButton#connect#clicked (handle_error' self#back)); + ignore (win#browserForwardButton#connect#clicked + (handle_error' self#forward)); + ignore (win#toplevel#event#connect#delete (fun _ -> + let my_id = Oo.id self in + cicBrowsers := List.filter (fun b -> Oo.id b <> my_id) !cicBrowsers; + if !cicBrowsers = [] && + Helm_registry.get "matita.mode" = "cicbrowser" + then + GMain.quit (); + false)); + ignore(win#whelpResultTreeview#connect#row_activated + ~callback:(fun _ _ -> + handle_error (fun () -> self#loadInput (self#_getSelectedUri ())))); + mathView#set_href_callback (Some (fun uri -> + handle_error (fun () -> + self#load (`Uri (UriManager.uri_of_string uri))))); + gviz#connect_href (fun button_ev attrs -> + let time = GdkEvent.Button.time button_ev in + let uri = List.assoc "href" attrs in + gviz_uri <- UriManager.uri_of_string uri; + match GdkEvent.Button.button button_ev with + | button when button = left_button -> self#load (`Uri gviz_uri) + | button when button = right_button -> + dep_contextual_menu#popup ~button ~time + | _ -> ()); + connect_menu_item win#depGraphMenuItem (fun () -> + match self#currentCicUri with + | Some uri -> self#load (`Metadata (`Deps (`Fwd, uri))) + | None -> ()); + connect_menu_item win#invDepGraphMenuItem (fun () -> + match self#currentCicUri with + | Some uri -> self#load (`Metadata (`Deps (`Back, uri))) + | None -> ()); + (* remove hbugs *) + (* + connect_menu_item win#hBugsTutorsMenuItem (fun () -> + self#load (`HBugs `Tutors)); + *) + win#hBugsTutorsMenuItem#misc#hide (); + connect_menu_item win#browserUrlMenuItem (fun () -> + win#browserUri#entry#misc#grab_focus ()); + + (* fill dep graph contextual menu *) + let go_menu_item = + GMenu.image_menu_item ~label:"Browse it" + ~packing:dep_contextual_menu#append () in + let expand_menu_item = + GMenu.image_menu_item ~label:"Expand" + ~packing:dep_contextual_menu#append () in + let collapse_menu_item = + GMenu.image_menu_item ~label:"Collapse" + ~packing:dep_contextual_menu#append () in + dep_contextual_menu#append (go_menu_item :> GMenu.menu_item); + dep_contextual_menu#append (expand_menu_item :> GMenu.menu_item); + dep_contextual_menu#append (collapse_menu_item :> GMenu.menu_item); + connect_menu_item go_menu_item (fun () -> self#load (`Uri gviz_uri)); + connect_menu_item expand_menu_item (fun () -> + MetadataDeps.DepGraph.expand gviz_uri gviz_graph; + self#redraw_gviz ~center_on:gviz_uri ()); + connect_menu_item collapse_menu_item (fun () -> + MetadataDeps.DepGraph.collapse gviz_uri gviz_graph; + self#redraw_gviz ~center_on:gviz_uri ()); + + self#_load (`About `Blank); + toplevel#show () + + val mutable current_entry = `About `Blank + + (** @return None if no object uri can be built from the current entry *) + method private currentCicUri = + match current_entry with + | `Uri uri + | `Metadata (`Deps (_, uri)) -> Some uri + | _ -> None + + val model = + new MatitaGtkMisc.taggedStringListModel tags win#whelpResultTreeview + + val mutable lastDir = "" (* last loaded "directory" *) + + method mathView = (mathView :> MatitaGuiTypes.clickableMathView) + + method private _getSelectedUri () = + match model#easy_selection () with + | [sel] when is_uri sel -> sel (* absolute URI selected *) +(* | [sel] -> win#browserUri#entry#text ^ sel |+ relative URI selected +| *) + | [sel] -> lastDir ^ sel + | _ -> assert false + + (** history RATIONALE + * + * All operations about history are done using _historyFoo. + * Only toplevel functions (ATM load and loadInput) call _historyAdd. + *) + + method private _historyAdd item = + history#add item; + win#browserBackButton#misc#set_sensitive true; + win#browserForwardButton#misc#set_sensitive false + + method private _historyPrev () = + let item = history#previous in + if history#is_begin then win#browserBackButton#misc#set_sensitive false; + win#browserForwardButton#misc#set_sensitive true; + item + + method private _historyNext () = + let item = history#next in + if history#is_end then win#browserForwardButton#misc#set_sensitive false; + win#browserBackButton#misc#set_sensitive true; + item + + (** notebook RATIONALE + * + * Use only these functions to switch between the tabs + *) + method private _showMath = win#mathOrListNotebook#goto_page 0 + method private _showList = win#mathOrListNotebook#goto_page 1 + method private _showGviz = win#mathOrListNotebook#goto_page 3 + method private _showHBugs = win#mathOrListNotebook#goto_page 4 + + method private back () = + try + self#_load (self#_historyPrev ()) + with MatitaMisc.History_failure -> () + + method private forward () = + try + self#_load (self#_historyNext ()) + with MatitaMisc.History_failure -> () + + (* loads a uri which can be a cic uri or an about:* uri + * @param uri string *) + method private _load ?(force=false) entry = + handle_error (fun () -> + if entry <> current_entry || entry = `About `Current_proof || entry = + `About `Coercions || entry = `About `CoercionsFull || force then + begin + (match entry with + | `About `Current_proof -> self#home () + | `About `Blank -> self#blank () + | `About `Us -> self#egg () + | `About `CoercionsFull -> self#coerchgraph false () + | `About `Coercions -> self#coerchgraph true () + | `Check term -> self#_loadCheck term + | `Cic (term, metasenv) -> self#_loadTermCic term metasenv + | `Development d -> self#_showDevelDeps d + | `Dir dir -> self#_loadDir dir + | `HBugs `Tutors -> self#_loadHBugsTutors + | `Metadata (`Deps ((`Fwd | `Back) as dir, uri)) -> + self#dependencies dir uri () + | `Uri uri -> self#_loadUriManagerUri uri + | `Whelp (query, results) -> + set_whelp_query query; + self#_loadList (List.map (fun r -> "obj", + UriManager.string_of_uri r) results)); + self#setEntry entry + end) + + method private blank () = + self#_showMath; + mathView#load_root (Lazy.force empty_mathml)#get_documentElement + + method private _loadCheck term = + failwith "not implemented _loadCheck"; +(* self#_showMath *) + + method private egg () = + win#mathOrListNotebook#goto_page 2; + Lazy.force load_easter_egg + + method private redraw_gviz ?center_on () = + let tmpfile, oc = Filename.open_temp_file "matita" ".dot" in + let fmt = Format.formatter_of_out_channel oc in + MetadataDeps.DepGraph.render fmt gviz_graph; + close_out oc; + gviz#load_graph_from_file ~gviz_cmd:"tred | dot" tmpfile; + (match center_on with + | None -> () + | Some uri -> gviz#center_on_href (UriManager.string_of_uri uri)); + HExtlib.safe_remove tmpfile + + method private dependencies direction uri () = + let dbd = LibraryDb.instance () in + let graph = + match direction with + | `Fwd -> MetadataDeps.DepGraph.direct_deps ~dbd uri + | `Back -> MetadataDeps.DepGraph.inverse_deps ~dbd uri in + gviz_graph <- graph; (** XXX check this for memory consuption *) + self#redraw_gviz ~center_on:uri (); + self#_showGviz + + method private coerchgraph tred () = + load_coerchgraph tred (); + self#_showGviz + + method private home () = + self#_showMath; + match self#script#grafite_status.proof_status with + | Proof (uri, metasenv, _subst, bo, ty, attrs) -> + let name = UriManager.name_of_uri (HExtlib.unopt uri) in + let obj = Cic.CurrentProof (name, metasenv, bo, ty, [], attrs) in + self#_loadObj obj + | Incomplete_proof { proof = (uri, metasenv, _subst, bo, ty, attrs) } -> + let name = UriManager.name_of_uri (HExtlib.unopt uri) in + let obj = Cic.CurrentProof (name, metasenv, bo, ty, [], attrs) in + self#_loadObj obj + | _ -> self#blank () + + (** loads a cic uri from the environment + * @param uri UriManager.uri *) + method private _loadUriManagerUri uri = + let uri = UriManager.strip_xpointer uri in + let (obj, _) = CicEnvironment.get_obj CicUniv.empty_ugraph uri in + self#_loadObj obj + + method private _loadDir dir = + let content = Http_getter.ls ~local:false dir in + let l = + List.fast_sort + Pervasives.compare + (List.map + (function + | Http_getter_types.Ls_section s -> "dir", s + | Http_getter_types.Ls_object o -> "obj", o.Http_getter_types.uri) + content) + in + lastDir <- dir; + self#_loadList l + + method private _loadHBugsTutors = + self#_showHBugs + + method private setEntry entry = + win#browserUri#entry#set_text (MatitaTypes.string_of_entry entry); + current_entry <- entry + + method private _showDevelDeps d = + match MatitamakeLib.development_for_name d with + | None -> () + | Some devel -> + (match MatitamakeLib.dot_for_development devel with + | None -> () + | Some fname -> + gviz#load_graph_from_file ~gviz_cmd:"tred | dot" fname; + self#_showGviz) + + method private _loadObj obj = + (* showMath must be done _before_ loading the document, since if the + * widget is not mapped (hidden by the notebook) the document is not + * rendered *) + self#_showMath; + mathView#load_object obj + + method private _loadTermCic term metasenv = + let context = self#script#proofContext in + let dummyno = CicMkImplicit.new_meta metasenv [] in + let sequent = (dummyno, context, term) in + mathView#load_sequent (sequent :: metasenv) dummyno; + self#_showMath + + method private _loadList l = + model#list_store#clear (); + List.iter (fun (tag, s) -> model#easy_append ~tag s) l; + self#_showList + + (** { public methods, all must call _load!! } *) + + method load entry = + handle_error (fun () -> self#_load entry; self#_historyAdd entry) + + (** this is what the browser does when you enter a string an hit enter *) + method loadInput txt = + let parse_metadata s = + let subs = Pcre.extract ~rex:metadata_RE s in + let uri = UriManager.uri_of_string ("cic:/" ^ subs.(3)) in + match subs.(1), subs.(2) with + | "deps", "forward" -> `Deps (`Fwd, uri) + | "deps", "backward" -> `Deps (`Back, uri) + | _ -> assert false + in + let txt = HExtlib.trim_blanks txt in + (* (* ZACK: what the heck? *) + let fix_uri txt = + UriManager.string_of_uri + (UriManager.strip_xpointer (UriManager.uri_of_string txt)) + in + *) + if is_whelp txt then begin + set_whelp_query txt; + (MatitaScript.current ())#advance ~statement:(txt ^ ".") () + end else begin + let entry = + match txt with + | txt when is_uri txt -> + `Uri (UriManager.uri_of_string ((*fix_uri*) txt)) + | txt when is_dir txt -> `Dir (MatitaMisc.normalize_dir txt) + | txt when is_metadata txt -> `Metadata (parse_metadata txt) + | "hbugs:/tutors/" -> `HBugs `Tutors + | txt -> + (try + MatitaTypes.entry_of_string txt + with Invalid_argument _ -> + raise + (GrafiteTypes.Command_error(sprintf "unsupported uri: %s" txt))) + in + self#_load entry; + self#_historyAdd entry + end + + (** {2 methods accessing underlying GtkMathView} *) + + method updateFontSize = mathView#set_font_size !current_font_size + + (** {2 methods used by constructor only} *) + + method win = win + method history = history + method currentEntry = current_entry + method refresh ~force () = self#_load ~force current_entry + + end + +let sequentsViewer ~(notebook:GPack.notebook) ~(cicMathView:cicMathView) (): + MatitaGuiTypes.sequentsViewer += + new sequentsViewer ~notebook ~cicMathView () + +let cicBrowser () = + let size = BuildTimeConf.browser_history_size in + let rec aux history = + let browser = new cicBrowser_impl ~history () in + let win = browser#win in + ignore (win#browserNewButton#connect#clicked (fun () -> + let history = + new MatitaMisc.browser_history ~memento:history#save size + (`About `Blank) + in + let newBrowser = aux history in + newBrowser#load browser#currentEntry)); +(* + (* attempt (failed) to close windows on CTRL-W ... *) + MatitaGtkMisc.connect_key win#browserWinEventBox#event ~modifiers:[`CONTROL] + GdkKeysyms._W (fun () -> win#toplevel#destroy ()); +*) + cicBrowsers := browser :: !cicBrowsers; + (browser :> MatitaGuiTypes.cicBrowser) + in + let history = new MatitaMisc.browser_history size (`About `Blank) in + aux history + +let default_cicMathView () = cicMathView ~show:true () +let cicMathView_instance = MatitaMisc.singleton default_cicMathView + +let default_sequentsViewer () = + let gui = get_gui () in + let cicMathView = cicMathView_instance () in + sequentsViewer ~notebook:gui#main#sequentsNotebook ~cicMathView () +let sequentsViewer_instance = MatitaMisc.singleton default_sequentsViewer + +let mathViewer () = + object(self) + method private get_browser reuse = + if reuse then + (match !cicBrowsers with + | [] -> cicBrowser () + | b :: _ -> (b :> MatitaGuiTypes.cicBrowser)) + else + (cicBrowser ()) + + method show_entry ?(reuse=false) t = (self#get_browser reuse)#load t + + method show_uri_list ?(reuse=false) ~entry l = + (self#get_browser reuse)#load entry + end + +let refresh_all_browsers () = + List.iter (fun b -> b#refresh ~force:false ()) !cicBrowsers + +let update_font_sizes () = + List.iter (fun b -> b#updateFontSize) !cicBrowsers; + (cicMathView_instance ())#update_font_size + +let get_math_views () = + ((cicMathView_instance ()) :> MatitaGuiTypes.clickableMathView) + :: (List.map (fun b -> b#mathView) !cicBrowsers) + +let find_selection_owner () = + let rec aux = + function + | [] -> raise Not_found + | mv :: tl -> + (match mv#get_selections with + | [] -> aux tl + | sel :: _ -> mv) + in + aux (get_math_views ()) + +let has_selection () = + try ignore (find_selection_owner ()); true + with Not_found -> false + +let math_view_clipboard = ref None (* associative list target -> string *) +let has_clipboard () = !math_view_clipboard <> None +let empty_clipboard () = math_view_clipboard := None + +let copy_selection () = + try + math_view_clipboard := + Some ((find_selection_owner ())#strings_of_selection) + with Not_found -> failwith "no selection" + +let paste_clipboard paste_kind = + match !math_view_clipboard with + | None -> failwith "empty clipboard" + | Some cb -> + (try List.assoc paste_kind cb with Not_found -> assert false) + diff --git a/matita/matitaMathView.mli b/matita/matitaMathView.mli new file mode 100644 index 000000000..ea0c077d8 --- /dev/null +++ b/matita/matitaMathView.mli @@ -0,0 +1,87 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(** {2 Constructors} *) + + (** meta constructor *) +type 'widget constructor = + ?hadjustment:GData.adjustment -> + ?vadjustment:GData.adjustment -> + ?font_size:int -> + ?log_verbosity:int -> + ?width:int -> + ?height:int -> + ?packing:(GObj.widget -> unit) -> + ?show:bool -> + unit -> + 'widget + +val clickableMathView: MatitaGuiTypes.clickableMathView constructor + +val cicMathView: MatitaGuiTypes.cicMathView constructor + +val sequentsViewer: + notebook:GPack.notebook -> + cicMathView:MatitaGuiTypes.cicMathView -> + unit -> + MatitaGuiTypes.sequentsViewer + +val cicBrowser: unit -> MatitaGuiTypes.cicBrowser + +(** {2 MathView wide functions} *) +(* TODO ZACK consider exporting here a single function which return a list of + * MatitaGuiTypes.clickableMathView and act on them externally ... *) + +val increase_font_size: unit -> unit +val decrease_font_size: unit -> unit +val reset_font_size: unit -> unit + +val refresh_all_browsers: unit -> unit (** act on all cicBrowsers *) +val update_font_sizes: unit -> unit + + (** {3 Clipboard & Selection handling} *) + +val has_selection: unit -> bool + + (** fills the clipboard with the current selection + * @raise Failure "no selection" *) +val copy_selection: unit -> unit +val has_clipboard: unit -> bool (** clipboard is not empty *) +val empty_clipboard: unit -> unit (** empty the clipboard *) + + (** @raise Failure "empty clipboard" *) +val paste_clipboard: MatitaGuiTypes.paste_kind -> string + +(** {2 Singleton instances} *) + +val cicMathView_instance: unit -> MatitaGuiTypes.cicMathView +val sequentsViewer_instance: unit -> MatitaGuiTypes.sequentsViewer + +val mathViewer: unit -> MatitaTypes.mathViewer + +(** {2 Initialization} *) + +val set_gui: MatitaGuiTypes.gui -> unit + diff --git a/matita/matitaMisc.ml b/matita/matitaMisc.ml new file mode 100644 index 000000000..bb745f703 --- /dev/null +++ b/matita/matitaMisc.ml @@ -0,0 +1,161 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +(** Functions "imported" from Http_getter_misc *) + +let normalize_dir = Http_getter_misc.normalize_dir +let strip_suffix ~suffix s = + try + Http_getter_misc.strip_suffix ~suffix s + with Invalid_argument _ -> s + +let absolute_path file = + if file.[0] = '/' then file else Unix.getcwd () ^ "/" ^ file + +let is_proof_script fname = true (** TODO Zack *) +let is_proof_object fname = true (** TODO Zack *) + +let append_phrase_sep s = + if not (Pcre.pmatch ~pat:(sprintf "%s$" BuildTimeConf.phrase_sep) s) then + s ^ BuildTimeConf.phrase_sep + else + s + +exception History_failure + +type 'a memento = 'a array * int * int * int (* data, hd, tl, cur *) + +class type ['a] history = + object + method add : 'a -> unit + method next : 'a + method previous : 'a + method load: 'a memento -> unit + method save: 'a memento + method is_begin: bool + method is_end: bool + end + +class basic_history (head, tail, cur) = + object + val mutable hd = head (* insertion point *) + val mutable tl = tail (* oldest inserted item *) + val mutable cur = cur (* current item for the history *) + + method is_begin = cur <= tl + method is_end = cur >= hd + end + + +class shell_history size = + let size = size + 1 in + let decr x = let x' = x - 1 in if x' < 0 then size + x' else x' in + let incr x = (x + 1) mod size in + object (self) + val data = Array.create size "" + + inherit basic_history (0, -1 , -1) + + method add s = + data.(hd) <- s; + if tl = -1 then tl <- hd; + hd <- incr hd; + if hd = tl then tl <- incr tl; + cur <- hd + method previous = + if cur = tl then raise History_failure; + cur <- decr cur; + data.(cur) + method next = + if cur = hd then raise History_failure; + cur <- incr cur; + if cur = hd then "" else data.(cur) + method load (data', hd', tl', cur') = + assert (Array.length data = Array.length data'); + hd <- hd'; tl <- tl'; cur <- cur'; + Array.blit data' 0 data 0 (Array.length data') + method save = (Array.copy data, hd, tl, cur) + end + +class ['a] browser_history ?memento size init = + object (self) + initializer match memento with Some m -> self#load m | _ -> () + val data = Array.create size init + + inherit basic_history (0, 0, 0) + + method previous = + if cur = tl then raise History_failure; + cur <- cur - 1; + if cur = ~-1 then cur <- size - 1; + data.(cur) + method next = + if cur = hd then raise History_failure; + cur <- cur + 1; + if cur = size then cur <- 0; + data.(cur) + method add (e:'a) = + if e <> data.(cur) then + begin + cur <- cur + 1; + if cur = size then cur <- 0; + if cur = tl then tl <- tl + 1; + if tl = size then tl <- 0; + hd <- cur; + data.(cur) <- e + end + method load (data', hd', tl', cur') = + assert (Array.length data = Array.length data'); + hd <- hd'; tl <- tl'; cur <- cur'; + Array.blit data' 0 data 0 (Array.length data') + method save = (Array.copy data, hd, tl, cur) + end + +let singleton f = + let instance = lazy (f ()) in + fun () -> Lazy.force instance + +let image_path n = sprintf "%s/%s" BuildTimeConf.images_dir n + +let end_ma_RE = Pcre.regexp "\\.ma$" + +let list_tl_at ?(equality=(==)) e l = + let rec aux = + function + | [] -> raise Not_found + | hd :: tl as l when equality hd e -> l + | hd :: tl -> aux tl + in + aux l + +let shutup () = + HLog.set_log_callback (fun _ _ -> ()); + let out = open_out "/dev/null" in + Unix.dup2 (Unix.descr_of_out_channel out) (Unix.descr_of_out_channel stderr) + diff --git a/matita/matitaMisc.mli b/matita/matitaMisc.mli new file mode 100644 index 000000000..b91275618 --- /dev/null +++ b/matita/matitaMisc.mli @@ -0,0 +1,78 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val absolute_path: string -> string + + (** @return true if file is a (textual) proof script *) +val is_proof_script: string -> bool + + (** @return true if file is a (binary) proof object *) +val is_proof_object: string -> bool + + (** given a phrase, if it doesn't end with BuildTimeConf.phrase_sep, append + * it *) +val append_phrase_sep: string -> string + +val normalize_dir: string -> string (** add trailing "/" if missing *) +val strip_suffix: suffix:string -> string -> string + + (** @return tl tail of a list starting at a given element + * @param eq equality to be used, defaults to physical equality (==) + * @raise Not_found *) +val list_tl_at: ?equality:('a -> 'a -> bool) -> 'a -> 'a list -> 'a list + +exception History_failure + +type 'a memento + +class type ['a] history = + object ('b) + method add : 'a -> unit + method next : 'a (** @raise History_failure *) + method previous : 'a (** @raise History_failure *) + method load: 'a memento -> unit + method save: 'a memento + method is_begin: bool + method is_end: bool + end + + (** shell like history: new items added at the end of the history + * @param size maximum history size *) +class shell_history : int -> [string] history + + (** browser like history: new items added at the current point of the history + * @param size maximum history size + * @param first element in history (this history is never empty) *) +class ['a] browser_history: ?memento:'a memento -> int -> 'a -> ['a] history + + (** create a singleton from a given function. Given function is invoked the + * first time it gets called. Next invocation will return first value *) +val singleton: (unit -> 'a) -> (unit -> 'a) + + (** given the base name of an image, returns its full path *) +val image_path: string -> string + + (** 2>/dev/null, HLog = (fun _ -> ()) *) +val shutup: unit -> unit diff --git a/matita/matitaScript.ml b/matita/matitaScript.ml new file mode 100644 index 000000000..182f6e165 --- /dev/null +++ b/matita/matitaScript.ml @@ -0,0 +1,1146 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf +open GrafiteTypes + +module TA = GrafiteAst + +let debug = false +let debug_print = if debug then prerr_endline else ignore + + (** raised when one of the script margins (top or bottom) is reached *) +exception Margin +exception NoUnfinishedProof +exception ActionCancelled of string + +let safe_substring s i j = + try String.sub s i j with Invalid_argument _ -> assert false + +let heading_nl_RE = Pcre.regexp "^\\s*\n\\s*" +let heading_nl_RE' = Pcre.regexp "^(\\s*\n\\s*)" +let only_dust_RE = Pcre.regexp "^(\\s|\n|%%[^\n]*\n)*$" +let multiline_RE = Pcre.regexp "^\n[^\n]+$" +let newline_RE = Pcre.regexp "\n" +let comment_RE = Pcre.regexp "\\(\\*(.|\n)*\\*\\)\n?" ~flags:[`UNGREEDY] + +let comment str = + if Pcre.pmatch ~rex:multiline_RE str then + "\n(** " ^ (Pcre.replace ~rex:newline_RE str) ^ " *)" + else + "\n(**\n" ^ str ^ "\n*)" + +let strip_comments str = + Pcre.qreplace ~templ:"\n" ~pat:"\n\n" (Pcre.qreplace ~rex:comment_RE str) +;; + +let first_line s = + let s = Pcre.replace ~rex:heading_nl_RE s in + try + let nl_pos = String.index s '\n' in + String.sub s 0 nl_pos + with Not_found -> s + +type guistuff = { + mathviewer:MatitaTypes.mathViewer; + urichooser: UriManager.uri list -> UriManager.uri list; + ask_confirmation: title:string -> message:string -> [`YES | `NO | `CANCEL]; + develcreator: containing:string option -> unit; +} + +let eval_with_engine guistuff lexicon_status grafite_status user_goal + skipped_txt nonskipped_txt st += + let module TAPp = GrafiteAstPp in + let module DTE = DisambiguateTypes.Environment in + let module DP = DisambiguatePp in + let parsed_text_length = + String.length skipped_txt + String.length nonskipped_txt + in + let text = skipped_txt ^ nonskipped_txt in + let prefix_len = MatitaGtkMisc.utf8_string_length skipped_txt in + let enriched_history_fragment = + MatitaEngine.eval_ast ~do_heavy_checks:(Helm_registry.get_bool + "matita.do_heavy_checks") + lexicon_status grafite_status (text,prefix_len,st) + in + let enriched_history_fragment = List.rev enriched_history_fragment in + (* really fragile *) + let res,_ = + List.fold_left + (fun (acc, to_prepend) (status,alias) -> + match alias with + | None -> (status,to_prepend ^ nonskipped_txt)::acc,"" + | Some (k,((v,_) as value)) -> + let newtxt = DP.pp_environment (DTE.add k value DTE.empty) in + (status,to_prepend ^ newtxt ^ "\n")::acc, "") + ([],skipped_txt) enriched_history_fragment + in + res,"",parsed_text_length + +let wrap_with_developments guistuff f arg = + let compile_needed_and_go_on lexiconfile d exc = + let target = Pcre.replace ~pat:"lexicon$" ~templ:"moo" lexiconfile in + let target = Pcre.replace ~pat:"metadata$" ~templ:"moo" target in + let refresh_cb () = + while Glib.Main.pending () do ignore(Glib.Main.iteration false); done + in + if not(MatitamakeLib.build_development_in_bg ~target refresh_cb d) then + raise exc + else + f arg + in + let do_nothing () = raise (ActionCancelled "Inclusion not performed") in + let check_if_file_is_exists f = + assert(Pcre.pmatch ~pat:"ma$" f); + let pwd = Sys.getcwd () in + let f_pwd = pwd ^ "/" ^ f in + if not (HExtlib.is_regular f_pwd) then + raise (ActionCancelled ("File "^f_pwd^" does not exists!")) + else + raise + (ActionCancelled + ("Internal error: "^f_pwd^" exists but I'm unable to include it!")) + in + let handle_with_devel d lexiconfile mafile exc = + let name = MatitamakeLib.name_for_development d in + let title = "Unable to include " ^ lexiconfile in + let message = + mafile ^ " is handled by development " ^ name ^ ".\n\n" ^ + "Should I compile it and Its dependencies?" + in + (match guistuff.ask_confirmation ~title ~message with + | `YES -> compile_needed_and_go_on lexiconfile d exc + | `NO -> raise exc + | `CANCEL -> do_nothing ()) + in + let handle_without_devel mafilename exc = + let title = "Unable to include " ^ mafilename in + let message = + mafilename ^ " is not handled by a development.\n" ^ + "All dependencies are automatically solved for a development.\n\n" ^ + "Do you want to set up a development?" + in + (match guistuff.ask_confirmation ~title ~message with + | `YES -> + guistuff.develcreator ~containing:(Some (Filename.dirname mafilename)); + do_nothing () + | `NO -> raise exc + | `CANCEL -> do_nothing()) + in + try + f arg + with + | DependenciesParser.UnableToInclude mafilename -> + assert (Pcre.pmatch ~pat:"ma$" mafilename); + check_if_file_is_exists mafilename + | LexiconEngine.IncludedFileNotCompiled (xfilename,mafilename) + | GrafiteEngine.IncludedFileNotCompiled (xfilename,mafilename) as exn -> + assert (Pcre.pmatch ~pat:"ma$" mafilename); + assert (Pcre.pmatch ~pat:"lexicon$" xfilename || + Pcre.pmatch ~pat:"mo$" xfilename ); + (* we know that someone was able to include the .ma, get the baseuri + * but was unable to get the compilation output 'xfilename' *) + match MatitamakeLib.development_for_dir (Filename.dirname mafilename) with + | None -> handle_without_devel mafilename exn + | Some d -> handle_with_devel d xfilename mafilename exn +;; + +let eval_with_engine + guistuff lexicon_status grafite_status user_goal + skipped_txt nonskipped_txt st += + wrap_with_developments guistuff + (eval_with_engine + guistuff lexicon_status grafite_status user_goal + skipped_txt nonskipped_txt) st +;; + +let pp_eager_statement_ast = + GrafiteAstPp.pp_statement ~term_pp:CicNotationPp.pp_term + ~lazy_term_pp:(fun _ -> assert false) ~obj_pp:(fun _ -> assert false) + +(* naive implementation of procedural proof script generation, + * starting from an applicatiove *auto generated) proof. + * this is out of place, but I like it :-P *) +let cic2grafite context menv t = + (* indents a proof script in a stupid way, better than nothing *) + let stupid_indenter s = + let next s = + let idx_square_o = try String.index s '[' with Not_found -> -1 in + let idx_square_c = try String.index s ']' with Not_found -> -1 in + let idx_pipe = try String.index s '|' with Not_found -> -1 in + let tok = + List.sort (fun (i,_) (j,_) -> compare i j) + [idx_square_o,'[';idx_square_c,']';idx_pipe,'|'] + in + let tok = List.filter (fun (i,_) -> i <> -1) tok in + match tok with + | (i,c)::_ -> Some (i,c) + | _ -> None + in + let break_apply n s = + let tab = String.make (n+1) ' ' in + Pcre.replace ~templ:(".\n" ^ tab ^ "apply") ~pat:"\\.apply" s + in + let rec ind n s = + match next s with + | None -> + s + | Some (position, char) -> + try + let s1, s2 = + String.sub s 0 position, + String.sub s (position+1) (String.length s - (position+1)) + in + match char with + | '[' -> break_apply n s1 ^ "\n" ^ String.make (n+2) ' ' ^ + "[" ^ ind (n+2) s2 + | '|' -> break_apply n s1 ^ "\n" ^ String.make n ' ' ^ + "|" ^ ind n s2 + | ']' -> break_apply n s1 ^ "\n" ^ String.make n ' ' ^ + "]" ^ ind (n-2) s2 + | _ -> assert false + with + Invalid_argument err -> + prerr_endline err; + s + in + ind 0 s + in + let module PT = CicNotationPt in + let module GA = GrafiteAst in + let pp_t context t = + let names = + List.map (function Some (n,_) -> Some n | None -> None) context + in + CicPp.pp t names + in + let sort_of context t = + try + let ty,_ = + CicTypeChecker.type_of_aux' menv context t + CicUniv.oblivion_ugraph + in + let sort,_ = CicTypeChecker.type_of_aux' menv context ty + CicUniv.oblivion_ugraph + in + match sort with + | Cic.Sort Cic.Prop -> true + | _ -> false + with + CicTypeChecker.TypeCheckerFailure _ -> + HLog.error "auto proof to sript transformation error"; false + in + let floc = HExtlib.dummy_floc in + (* minimalisti cic.term -> pt.term *) + let print_term c t = + let rec aux c = function + | Cic.Rel _ + | Cic.MutConstruct _ + | Cic.MutInd _ + | Cic.Const _ as t -> + PT.Ident (pp_t c t, None) + | Cic.Appl l -> PT.Appl (List.map (aux c) l) + | Cic.Implicit _ -> PT.Implicit + | Cic.Lambda (Cic.Name n, s, t) -> + PT.Binder (`Lambda, (PT.Ident (n,None), Some (aux c s)), + aux (Some (Cic.Name n, Cic.Decl s)::c) t) + | Cic.Prod (Cic.Name n, s, t) -> + PT.Binder (`Forall, (PT.Ident (n,None), Some (aux c s)), + aux (Some (Cic.Name n, Cic.Decl s)::c) t) + | Cic.LetIn (Cic.Name n, s, t) -> + PT.Binder (`Lambda, (PT.Ident (n,None), Some (aux c s)), + aux (Some (Cic.Name n, Cic.Def (s,None))::c) t) + | Cic.Meta _ -> PT.Implicit + | Cic.Sort (Cic.Type u) -> PT.Sort (`Type u) + | Cic.Sort Cic.Set -> PT.Sort `Set + | Cic.Sort Cic.CProp -> PT.Sort `CProp + | Cic.Sort Cic.Prop -> PT.Sort `Prop + | _ as t -> PT.Ident ("ERROR: "^CicPp.ppterm t, None) + in + aux c t + in + (* prints an applicative proof, that is an auto proof. + * don't use in the general case! *) + let rec print_proof context = function + | Cic.Rel _ + | Cic.Const _ as t -> + [GA.Executable (floc, + GA.Tactic (floc, + Some (GA.Apply (floc, print_term context t)), GA.Dot floc))] + | Cic.Appl (he::tl) -> + let tl = List.map (fun t -> t, sort_of context t) tl in + let subgoals = + HExtlib.filter_map (function (t,true) -> Some t | _ -> None) tl + in + let args = + List.map (function | (t,true) -> Cic.Implicit None | (t,_) -> t) tl + in + if List.length subgoals > 1 then + (* branch *) + [GA.Executable (floc, + GA.Tactic (floc, + Some (GA.Apply (floc, print_term context (Cic.Appl (he::args)))), + GA.Semicolon floc))] @ + [GA.Executable (floc, GA.Tactic (floc, None, GA.Branch floc))] @ + (HExtlib.list_concat + ~sep:[GA.Executable (floc, GA.Tactic (floc, None,GA.Shift floc))] + (List.map (print_proof context) subgoals)) @ + [GA.Executable (floc, GA.Tactic (floc, None,GA.Merge floc))] + else + (* simple apply *) + [GA.Executable (floc, + GA.Tactic (floc, + Some (GA.Apply + (floc, print_term context (Cic.Appl (he::args)) )), GA.Dot floc))] + @ + (match subgoals with + | [] -> [] + | [x] -> print_proof context x + | _ -> assert false) + | Cic.Lambda (Cic.Name n, ty, bo) -> + [GA.Executable (floc, + GA.Tactic (floc, + Some (GA.Cut (floc, Some n, (print_term context ty))), + GA.Branch floc))] @ + (print_proof (Some (Cic.Name n, Cic.Decl ty)::context) bo) @ + [GA.Executable (floc, GA.Tactic (floc, None,GA.Shift floc))] @ + [GA.Executable (floc, GA.Tactic (floc, + Some (GA.Assumption floc),GA.Merge floc))] + | _ -> [] + (* + debug_print (lazy (CicPp.ppterm t)); + assert false + *) + in + (* performs a lambda closure of the proof term abstracting metas. + * this is really an approximation of a closure, local subst of metas + * is not kept into account *) + let close_pt menv context t = + let metas = CicUtil.metas_of_term t in + let metas = + HExtlib.list_uniq ~eq:(fun (i,_) (j,_) -> i = j) + (List.sort (fun (i,_) (j,_) -> compare i j) metas) + in + let mk_rels_and_collapse_metas metas = + let rec aux i map acc acc1 = function + | [] -> acc, acc1, map + | (j,_ as m)::tl -> + let _,_,ty = CicUtil.lookup_meta j menv in + try + let n = List.assoc ty map in + aux i map (Cic.Rel n :: acc) (m::acc1) tl + with Not_found -> + let map = (ty, i)::map in + aux (i+1) map (Cic.Rel i :: acc) (m::acc1) tl + in + aux 1 [] [] [] metas + in + let rels, metas, map = mk_rels_and_collapse_metas metas in + let n_lambdas = List.length map in + let t = + if metas = [] then + t + else + let t = + ProofEngineReduction.replace_lifting + ~what:(List.map (fun (x,_) -> Cic.Meta (x,[])) metas) + ~with_what:rels + ~context:context + ~equality:(fun _ x y -> + match x,y with + | Cic.Meta(i,_), Cic.Meta(j,_) when i=j -> true + | _ -> false) + ~where:(CicSubstitution.lift n_lambdas t) + in + let rec mk_lam = function + | [] -> t + | (ty,n)::tl -> + let name = "fresh_"^ string_of_int n in + Cic.Lambda (Cic.Name name, ty, mk_lam tl) + in + mk_lam + (fst (List.fold_left + (fun (l,liftno) (ty,_) -> + (l @ [CicSubstitution.lift liftno ty,liftno] , liftno+1)) + ([],0) map)) + in + t + in + let ast = print_proof context (close_pt menv context t) in + let pp t = + (* ZACK: setting width to 80 will trigger a bug of BoxPp.render_to_string + * which will show up using the following command line: + * ./tptp2grafite -tptppath ~tassi/TPTP-v3.1.1 GRP170-1 *) + let width = max_int in + let term_pp content_term = + let pres_term = TermContentPres.pp_ast content_term in + let dummy_tbl = Hashtbl.create 1 in + let markup = CicNotationPres.render dummy_tbl pres_term in + let s = "(" ^ BoxPp.render_to_string + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + List.hd width markup ^ ")" in + Pcre.substitute + ~pat:"\\\\forall [Ha-z][a-z0-9_]*" ~subst:(fun x -> "\n" ^ x) s + in + CicNotationPp.set_pp_term term_pp; + let lazy_term_pp = fun x -> assert false in + let obj_pp = CicNotationPp.pp_obj CicNotationPp.pp_term in + GrafiteAstPp.pp_statement + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + ~term_pp ~lazy_term_pp ~obj_pp t + in + let script = String.concat "" (List.map pp ast) in + prerr_endline script; + stupid_indenter script +;; + +let rec eval_macro include_paths (buffer : GText.buffer) guistuff lexicon_status grafite_status user_goal unparsed_text parsed_text script mac = + let module TAPp = GrafiteAstPp in + let module MQ = MetadataQuery in + let module MDB = LibraryDb in + let module CTC = CicTypeChecker in + let module CU = CicUniv in + (* no idea why ocaml wants this *) + let parsed_text_length = String.length parsed_text in + let dbd = LibraryDb.instance () in + let pp_macro = + let f t = ProofEngineReduction.replace + ~equality:(fun _ t -> match t with Cic.Meta _ -> true | _ -> false) + ~what:[()] ~with_what:[Cic.Implicit None] ~where:t + in + let metasenv = GrafiteTypes.get_proof_metasenv grafite_status in + TAPp.pp_macro + ~term_pp:(fun x -> + ApplyTransformation.txt_of_cic_term max_int metasenv [] (f x) + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex")) + in + match mac with + (* WHELP's stuff *) + | TA.WMatch (loc, term) -> + let l = Whelp.match_term ~dbd term in + let entry = `Whelp (pp_macro mac, l) in + guistuff.mathviewer#show_uri_list ~reuse:true ~entry l; + [], "", parsed_text_length + | TA.WInstance (loc, term) -> + let l = Whelp.instance ~dbd term in + let entry = `Whelp (pp_macro mac, l) in + guistuff.mathviewer#show_uri_list ~reuse:true ~entry l; + [], "", parsed_text_length + | TA.WLocate (loc, s) -> + let l = Whelp.locate ~dbd s in + let entry = `Whelp (pp_macro mac, l) in + guistuff.mathviewer#show_uri_list ~reuse:true ~entry l; + [], "", parsed_text_length + | TA.WElim (loc, term) -> + let uri = + match term with + | Cic.MutInd (uri,n,_) -> UriManager.uri_of_uriref uri n None + | _ -> failwith "Not a MutInd" + in + let l = Whelp.elim ~dbd uri in + let entry = `Whelp (pp_macro mac, l) in + guistuff.mathviewer#show_uri_list ~reuse:true ~entry l; + [], "", parsed_text_length + | TA.WHint (loc, term) -> + let _subst = [] in + let s = ((None,[0,[],term], _subst, Cic.Meta (0,[]) ,term, []),0) in + let l = List.map fst (MQ.experimental_hint ~dbd s) in + let entry = `Whelp (pp_macro mac, l) in + guistuff.mathviewer#show_uri_list ~reuse:true ~entry l; + [], "", parsed_text_length + (* REAL macro *) + | TA.Hint (loc, rewrite) -> + let user_goal' = + match user_goal with + Some n -> n + | None -> raise NoUnfinishedProof + in + let proof = GrafiteTypes.get_current_proof grafite_status in + let proof_status = proof,user_goal' in + if rewrite then + let l = MQ.equations_for_goal ~dbd proof_status in + let l = List.filter (fun u -> not (LibraryObjects.in_eq_URIs u)) l in + let entry = `Whelp (pp_macro (TA.WHint(loc, Cic.Implicit None)), l) in + guistuff.mathviewer#show_uri_list ~reuse:true ~entry l; + [], "", parsed_text_length + else + let l = List.map fst (MQ.experimental_hint ~dbd proof_status) in + let selected = guistuff.urichooser l in + (match selected with + | [] -> [], "", parsed_text_length + | [uri] -> + let suri = UriManager.string_of_uri uri in + let ast loc = + TA.Executable (loc, (TA.Tactic (loc, + Some (TA.Apply (loc, CicNotationPt.Uri (suri, None))), + TA.Dot loc))) in + let text = + comment parsed_text ^ "\n" ^ + pp_eager_statement_ast (ast HExtlib.dummy_floc) + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + in + let text_len = MatitaGtkMisc.utf8_string_length text in + let loc = HExtlib.floc_of_loc (0,text_len) in + let statement = `Ast (GrafiteParser.LSome (ast loc),text) in + let res,_,_parsed_text_len = + eval_statement include_paths buffer guistuff lexicon_status + grafite_status user_goal script statement + in + (* we need to replace all the parsed_text *) + res,"",String.length parsed_text + | _ -> + HLog.error + "The result of the urichooser should be only 1 uri, not:\n"; + List.iter ( + fun u -> HLog.error (UriManager.string_of_uri u ^ "\n") + ) selected; + assert false) + | TA.Check (_,term) -> + let metasenv = GrafiteTypes.get_proof_metasenv grafite_status in + let context = + match user_goal with + None -> [] + | Some n -> GrafiteTypes.get_proof_context grafite_status n in + let ty,_ = CTC.type_of_aux' metasenv context term CicUniv.empty_ugraph in + let t_and_ty = Cic.Cast (term,ty) in + guistuff.mathviewer#show_entry (`Cic (t_and_ty,metasenv)); + [], "", parsed_text_length + | TA.AutoInteractive (_, params) -> + let user_goal' = + match user_goal with + Some n -> n + | None -> raise NoUnfinishedProof + in + let proof = GrafiteTypes.get_current_proof grafite_status in + let proof_status = proof,user_goal' in + (try + let _,menv,_,_,_,_ = proof in + let i,cc,ty = CicUtil.lookup_meta user_goal' menv in + let timestamp = Unix.gettimeofday () in + let (_,menv,subst,_,_,_), _ = + ProofEngineTypes.apply_tactic + (Auto.auto_tac ~dbd ~params + ~universe:grafite_status.GrafiteTypes.universe) proof_status + in + let proof_term = + let irl = + CicMkImplicit.identity_relocation_list_for_metavariable cc + in + CicMetaSubst.apply_subst subst (Cic.Meta (i,irl)) + in + let time = Unix.gettimeofday () -. timestamp in + let size, depth = Auto.size_and_depth cc menv proof_term in + let trailer = + Printf.sprintf + "\n(* end auto(%s) proof: TIME=%4.2f SIZE=%d DEPTH=%d *)" + Auto.revision time size depth + in + let proof_script = + if List.exists (fun (s,_) -> s = "paramodulation") params then + let proof_term, how_many_lambdas = + Auto.lambda_close ~prefix_name:"orrible_hack_" + proof_term menv cc + in + let ty,_ = + CicTypeChecker.type_of_aux' + menv [] proof_term CicUniv.empty_ugraph + in + prerr_endline (CicPp.ppterm proof_term); + (* use declarative output *) + let obj = + (* il proof_term vive in cc, devo metterci i lambda no? *) + (Cic.CurrentProof ("xxx",menv,proof_term,ty,[],[])) + in + ApplyTransformation.txt_of_cic_object + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + ~skip_thm_and_qed:true + ~skip_initial_lambdas:how_many_lambdas + 80 GrafiteAst.Declarative "" obj + else + if true then + (* use cic2grafite *) + cic2grafite cc menv proof_term + else + (* alternative using FG stuff *) + let proof_term, how_many_lambdas = + Auto.lambda_close ~prefix_name:"orrible_hack_" + proof_term menv cc + in + let ty,_ = + CicTypeChecker.type_of_aux' + menv [] proof_term CicUniv.empty_ugraph + in + let obj = + Cic.Constant ("",Some proof_term, ty, [], [`Flavour `Lemma]) + in + Pcre.qreplace ~templ:"?" ~pat:"orrible_hack_[0-9]+" + (strip_comments + (ApplyTransformation.txt_of_cic_object + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + ~skip_thm_and_qed:true + ~skip_initial_lambdas:how_many_lambdas + 80 (GrafiteAst.Procedural None) "" obj)) + in + let text = comment parsed_text ^ "\n" ^ proof_script ^ trailer in + [],text,parsed_text_length + with + ProofEngineTypes.Fail _ as exn -> + raise exn + (* [], comment parsed_text ^ "\nfail.\n", parsed_text_length *)) + | TA.Inline (_,style,suri,prefix) -> + let str = + ApplyTransformation.txt_of_inline_macro + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + style suri prefix + in + [], str, String.length parsed_text + +and eval_executable include_paths (buffer : GText.buffer) guistuff +lexicon_status grafite_status user_goal unparsed_text skipped_txt nonskipped_txt +script ex loc += + let module TAPp = GrafiteAstPp in + let module MD = GrafiteDisambiguator in + let module ML = MatitaMisc in + try + begin + match ex with + | TA.Command (_,TA.Set (_,"baseuri",u)) -> + if Http_getter_storage.is_read_only u then + raise (ActionCancelled ("baseuri " ^ u ^ " is readonly")); + if not (Http_getter_storage.is_empty ~local:true u) then + (match + guistuff.ask_confirmation + ~title:"Baseuri redefinition" + ~message:( + "Baseuri " ^ u ^ " already exists.\n" ^ + "Do you want to redefine the corresponding "^ + "part of the library?") + with + | `YES -> LibraryClean.clean_baseuris [u] + | `NO -> () + | `CANCEL -> raise MatitaTypes.Cancel) + | _ -> () + end; + ignore (buffer#move_mark (`NAME "beginning_of_statement") + ~where:((buffer#get_iter_at_mark (`NAME "locked"))#forward_chars + (Glib.Utf8.length skipped_txt))) ; + eval_with_engine + guistuff lexicon_status grafite_status user_goal skipped_txt nonskipped_txt + (TA.Executable (loc, ex)) + with + MatitaTypes.Cancel -> [], "", 0 + | GrafiteEngine.Macro (_loc,lazy_macro) -> + let context = + match user_goal with + None -> [] + | Some n -> GrafiteTypes.get_proof_context grafite_status n in + let grafite_status,macro = lazy_macro context in + eval_macro include_paths buffer guistuff lexicon_status grafite_status + user_goal unparsed_text (skipped_txt ^ nonskipped_txt) script macro + +and eval_statement include_paths (buffer : GText.buffer) guistuff lexicon_status + grafite_status user_goal script statement += + let (lexicon_status,st), unparsed_text = + match statement with + | `Raw text -> + if Pcre.pmatch ~rex:only_dust_RE text then raise Margin; + let ast = + wrap_with_developments guistuff + (GrafiteParser.parse_statement + (Ulexing.from_utf8_string text) ~include_paths) lexicon_status + in + ast, text + | `Ast (st, text) -> (lexicon_status, st), text + in + let text_of_loc floc = + let nonskipped_txt,_ = MatitaGtkMisc.utf8_parsed_text unparsed_text floc in + let start, stop = HExtlib.loc_of_floc floc in + let floc = HExtlib.floc_of_loc (0, start) in + let skipped_txt,_ = MatitaGtkMisc.utf8_parsed_text unparsed_text floc in + let floc = HExtlib.floc_of_loc (0, stop) in + let txt,len = MatitaGtkMisc.utf8_parsed_text unparsed_text floc in + txt,nonskipped_txt,skipped_txt,len + in + match st with + | GrafiteParser.LNone loc -> + let parsed_text, _, _, parsed_text_length = text_of_loc loc in + [(grafite_status,lexicon_status),parsed_text],"", + parsed_text_length + | GrafiteParser.LSome (GrafiteAst.Comment (loc, _)) -> + let parsed_text, _, _, parsed_text_length = text_of_loc loc in + let remain_len = String.length unparsed_text - parsed_text_length in + let s = String.sub unparsed_text parsed_text_length remain_len in + let s,text,len = + try + eval_statement include_paths buffer guistuff lexicon_status + grafite_status user_goal script (`Raw s) + with + HExtlib.Localized (floc, exn) -> + HExtlib.raise_localized_exception + ~offset:(MatitaGtkMisc.utf8_string_length parsed_text) floc exn + | GrafiteDisambiguator.DisambiguationError (offset,errorll) -> + raise + (GrafiteDisambiguator.DisambiguationError + (offset+parsed_text_length, errorll)) + in + assert (text=""); (* no macros inside comments, please! *) + (match s with + | (statuses,text)::tl -> + (statuses,parsed_text ^ text)::tl,"",parsed_text_length + len + | [] -> [], "", 0) + | GrafiteParser.LSome (GrafiteAst.Executable (loc, ex)) -> + let _, nonskipped, skipped, parsed_text_length = + text_of_loc loc + in + eval_executable include_paths buffer guistuff lexicon_status + grafite_status user_goal unparsed_text skipped nonskipped script ex loc + +let fresh_script_id = + let i = ref 0 in + fun () -> incr i; !i + +class script ~(source_view: GSourceView.source_view) + ~(mathviewer: MatitaTypes.mathViewer) + ~set_star + ~ask_confirmation + ~urichooser + ~develcreator + () = +let buffer = source_view#buffer in +let source_buffer = source_view#source_buffer in +let initial_statuses () = + (* these include_paths are used only to load the initial notation *) + let include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" in + let lexicon_status = + CicNotation2.load_notation ~include_paths + BuildTimeConf.core_notation_script in + let grafite_status = GrafiteSync.init () in + grafite_status,lexicon_status +in +object (self) + val mutable include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" + + val scriptId = fresh_script_id () + + val guistuff = { + mathviewer = mathviewer; + urichooser = urichooser; + ask_confirmation = ask_confirmation; + develcreator=develcreator;} + + initializer + ignore (GMain.Timeout.add ~ms:300000 + ~callback:(fun _ -> self#_saveToBackupFile ();true)); + ignore (buffer#connect#modified_changed + (fun _ -> set_star (Filename.basename (Librarian.filename ())) buffer#modified)) + + val mutable statements = [] (** executed statements *) + + val mutable history = [ initial_statuses () ] + (** list of states before having executed statements. Head element of this + * list is the current state, last element is the state at the beginning of + * the script. + * Invariant: this list length is 1 + length of statements *) + + (** goal as seen by the user (i.e. metano corresponding to current tab) *) + val mutable userGoal = None + + (** text mark and tag representing locked part of a script *) + val locked_mark = + buffer#create_mark ~name:"locked" ~left_gravity:true buffer#start_iter + val beginning_of_statement_mark = + buffer#create_mark ~name:"beginning_of_statement" + ~left_gravity:true buffer#start_iter + val locked_tag = buffer#create_tag [`BACKGROUND "lightblue"; `EDITABLE false] + val error_tag = buffer#create_tag [`UNDERLINE `SINGLE; `FOREGROUND "red"] + + method locked_mark = locked_mark + method locked_tag = locked_tag + method error_tag = error_tag + + (* history can't be empty, the invariant above grant that it contains at + * least the init grafite_status *) + method grafite_status = match history with (s,_)::_ -> s | _ -> assert false + method lexicon_status = match history with (_,ss)::_ -> ss | _ -> assert false + + method private _advance ?statement () = + let s = match statement with Some s -> s | None -> self#getFuture in + HLog.debug ("evaluating: " ^ first_line s ^ " ..."); + let entries, newtext, parsed_len = + try + eval_statement include_paths buffer guistuff self#lexicon_status + self#grafite_status userGoal self (`Raw s) + with End_of_file -> raise Margin + in + let new_statuses, new_statements = + let statuses, texts = List.split entries in + statuses, texts + in + history <- new_statuses @ history; + statements <- new_statements @ statements; + let start = buffer#get_iter_at_mark (`MARK locked_mark) in + let new_text = String.concat "" (List.rev new_statements) in + if statement <> None then + buffer#insert ~iter:start new_text + else begin + let parsed_text = String.sub s 0 parsed_len in + if new_text <> parsed_text then begin + let stop = start#copy#forward_chars (Glib.Utf8.length parsed_text) in + buffer#delete ~start ~stop; + buffer#insert ~iter:start new_text; + end; + end; + self#moveMark (Glib.Utf8.length new_text); + buffer#insert ~iter:(buffer#get_iter_at_mark (`MARK locked_mark)) newtext; + (* here we need to set the Goal in case we are going to cursor (or to + bottom) and we will face a macro *) + match self#grafite_status.proof_status with + Incomplete_proof p -> + userGoal <- + (try Some (Continuationals.Stack.find_goal p.stack) + with Failure _ -> None) + | _ -> userGoal <- None + + method private _retract offset lexicon_status grafite_status new_statements + new_history + = + let cur_grafite_status,cur_lexicon_status = + match history with s::_ -> s | [] -> assert false + in + LexiconSync.time_travel ~present:cur_lexicon_status ~past:lexicon_status; + GrafiteSync.time_travel ~present:cur_grafite_status ~past:grafite_status; + statements <- new_statements; + history <- new_history; + self#moveMark (- offset) + + method advance ?statement () = + try + self#_advance ?statement (); + self#notify + with + | Margin -> self#notify + | Not_found -> assert false + | Invalid_argument "Array.make" -> HLog.error "The script is too big!\n" + | exc -> self#notify; raise exc + + method retract () = + try + let cmp,new_statements,new_history,(grafite_status,lexicon_status) = + match statements,history with + stat::statements, _::(status::_ as history) -> + assert (Glib.Utf8.validate stat); + Glib.Utf8.length stat, statements, history, status + | [],[_] -> raise Margin + | _,_ -> assert false + in + self#_retract cmp lexicon_status grafite_status new_statements + new_history; + self#notify + with + | Margin -> self#notify + | Invalid_argument "Array.make" -> HLog.error "The script is too big!\n" + | exc -> self#notify; raise exc + + method private getFuture = + buffer#get_text ~start:(buffer#get_iter_at_mark (`MARK locked_mark)) + ~stop:buffer#end_iter () + + + (** @param rel_offset relative offset from current position of locked_mark *) + method private moveMark rel_offset = + let mark = `MARK locked_mark in + let old_insert = buffer#get_iter_at_mark `INSERT in + buffer#remove_tag locked_tag ~start:buffer#start_iter ~stop:buffer#end_iter; + let current_mark_pos = buffer#get_iter_at_mark mark in + let new_mark_pos = + match rel_offset with + | 0 -> current_mark_pos + | n when n > 0 -> current_mark_pos#forward_chars n + | n (* when n < 0 *) -> current_mark_pos#backward_chars (abs n) + in + buffer#move_mark mark ~where:new_mark_pos; + buffer#apply_tag locked_tag ~start:buffer#start_iter ~stop:new_mark_pos; + buffer#move_mark `INSERT old_insert; + let mark_position = buffer#get_iter_at_mark mark in + if source_view#move_mark_onscreen mark then + begin + buffer#move_mark mark mark_position; + source_view#scroll_to_mark ~use_align:true ~xalign:1.0 ~yalign:0.1 mark; + end; + while Glib.Main.pending () do ignore(Glib.Main.iteration false); done + + method clean_dirty_lock = + let lock_mark_iter = buffer#get_iter_at_mark (`MARK locked_mark) in + buffer#remove_tag locked_tag ~start:buffer#start_iter ~stop:buffer#end_iter; + buffer#apply_tag locked_tag ~start:buffer#start_iter ~stop:lock_mark_iter + + val mutable observers = [] + + method addObserver (o: LexiconEngine.status -> GrafiteTypes.status -> unit) = + observers <- o :: observers + + method private notify = + let lexicon_status = self#lexicon_status in + let grafite_status = self#grafite_status in + List.iter (fun o -> o lexicon_status grafite_status) observers + + method loadFromString s = + buffer#set_text s; + self#reset_buffer; + buffer#set_modified true + + method loadFromFile f = + buffer#set_text (HExtlib.input_file f); + self#reset_buffer; + buffer#set_modified false + + method assignFileName file = + let root, buri, file = Librarian.baseuri_of_script ~include_paths file in + Helm_registry.set "matita.filename" file + + method saveToFile () = + let oc = open_out (Librarian.filename ()) in + output_string oc (buffer#get_text ~start:buffer#start_iter + ~stop:buffer#end_iter ()); + close_out oc; + buffer#set_modified false + + method private _saveToBackupFile () = + if buffer#modified then + begin + let f = Librarian.filename () ^ "~" in + let oc = open_out f in + output_string oc (buffer#get_text ~start:buffer#start_iter + ~stop:buffer#end_iter ()); + close_out oc; + HLog.debug ("backup " ^ f ^ " saved") + end + + method private goto_top = + let grafite_status,lexicon_status = + let rec last x = function + | [] -> x + | hd::tl -> last hd tl + in + last (self#grafite_status,self#lexicon_status) history + in + (* FIXME: this is not correct since there is no undo for + * library_objects.set_default... *) + GrafiteSync.time_travel ~present:self#grafite_status ~past:grafite_status; + LexiconSync.time_travel ~present:self#lexicon_status ~past:lexicon_status + + method private reset_buffer = + statements <- []; + history <- [ initial_statuses () ]; + userGoal <- None; + self#notify; + buffer#remove_tag locked_tag ~start:buffer#start_iter ~stop:buffer#end_iter; + buffer#move_mark (`MARK locked_mark) ~where:buffer#start_iter + + method reset () = + self#reset_buffer; + source_buffer#begin_not_undoable_action (); + buffer#delete ~start:buffer#start_iter ~stop:buffer#end_iter; + source_buffer#end_not_undoable_action (); + buffer#set_modified false; + + method template () = + let template = HExtlib.input_file BuildTimeConf.script_template in + buffer#insert ~iter:(buffer#get_iter `START) template; + buffer#set_modified false; + set_star (Filename.basename (Librarian.filename ())) false + + method goto (pos: [`Top | `Bottom | `Cursor]) () = + try + let old_locked_mark = + `MARK + (buffer#create_mark ~name:"old_locked_mark" + ~left_gravity:true (buffer#get_iter_at_mark (`MARK locked_mark))) in + let getpos _ = buffer#get_iter_at_mark (`MARK locked_mark) in + let getoldpos _ = buffer#get_iter_at_mark old_locked_mark in + let dispose_old_locked_mark () = buffer#delete_mark old_locked_mark in + match pos with + | `Top -> + dispose_old_locked_mark (); + self#goto_top; + self#reset_buffer; + self#notify + | `Bottom -> + (try + let rec dowhile () = + self#_advance (); + let newpos = getpos () in + if (getoldpos ())#compare newpos < 0 then + begin + buffer#move_mark old_locked_mark newpos; + dowhile () + end + in + dowhile (); + dispose_old_locked_mark (); + self#notify + with + | Margin -> dispose_old_locked_mark (); self#notify + | exc -> dispose_old_locked_mark (); self#notify; raise exc) + | `Cursor -> + let locked_iter () = buffer#get_iter_at_mark (`NAME "locked") in + let cursor_iter () = buffer#get_iter_at_mark `INSERT in + let remember = + `MARK + (buffer#create_mark ~name:"initial_insert" + ~left_gravity:true (cursor_iter ())) in + let dispose_remember () = buffer#delete_mark remember in + let remember_iter () = + buffer#get_iter_at_mark (`NAME "initial_insert") in + let cmp () = (locked_iter ())#offset - (remember_iter ())#offset in + let icmp = cmp () in + let forward_until_cursor () = (* go forward until locked > cursor *) + let rec aux () = + self#_advance (); + if cmp () < 0 && (getoldpos ())#compare (getpos ()) < 0 + then + begin + buffer#move_mark old_locked_mark (getpos ()); + aux () + end + in + aux () + in + let rec back_until_cursor len = (* go backward until locked < cursor *) + function + statements, ((grafite_status,lexicon_status)::_ as history) + when len <= 0 -> + self#_retract (icmp - len) lexicon_status grafite_status statements + history + | statement::tl1, _::tl2 -> + back_until_cursor (len - MatitaGtkMisc.utf8_string_length statement) (tl1,tl2) + | _,_ -> assert false + in + (try + begin + if icmp < 0 then (* locked < cursor *) + (forward_until_cursor (); self#notify) + else if icmp > 0 then (* locked > cursor *) + (back_until_cursor icmp (statements,history); self#notify) + else (* cursor = locked *) + () + end ; + dispose_remember (); + dispose_old_locked_mark (); + with + | Margin -> dispose_remember (); dispose_old_locked_mark (); self#notify + | exc -> dispose_remember (); dispose_old_locked_mark (); + self#notify; raise exc) + with Invalid_argument "Array.make" -> + HLog.error "The script is too big!\n" + + method onGoingProof () = + match self#grafite_status.proof_status with + | No_proof | Proof _ -> false + | Incomplete_proof _ -> true + | Intermediate _ -> assert false + +(* method proofStatus = MatitaTypes.get_proof_status self#status *) + method proofMetasenv = GrafiteTypes.get_proof_metasenv self#grafite_status + + method proofContext = + match userGoal with + None -> [] + | Some n -> GrafiteTypes.get_proof_context self#grafite_status n + + method proofConclusion = + match userGoal with + None -> assert false + | Some n -> + GrafiteTypes.get_proof_conclusion self#grafite_status n + + method stack = GrafiteTypes.get_stack self#grafite_status + method setGoal n = userGoal <- n + method goal = userGoal + + method eos = + let rec is_there_only_comments lexicon_status s = + if Pcre.pmatch ~rex:only_dust_RE s then raise Margin; + let lexicon_status,st = + GrafiteParser.parse_statement (Ulexing.from_utf8_string s) + ~include_paths lexicon_status + in + match st with + | GrafiteParser.LSome (GrafiteAst.Comment (loc,_)) -> + let _,parsed_text_length = MatitaGtkMisc.utf8_parsed_text s loc in + (* CSC: why +1 in the following lines ???? *) + let parsed_text_length = parsed_text_length + 1 in +prerr_endline ("## " ^ string_of_int parsed_text_length); + let remain_len = String.length s - parsed_text_length in + let next = String.sub s parsed_text_length remain_len in + is_there_only_comments lexicon_status next + | GrafiteParser.LNone _ + | GrafiteParser.LSome (GrafiteAst.Executable _) -> false + in + try + is_there_only_comments self#lexicon_status self#getFuture + with + | LexiconEngine.IncludedFileNotCompiled _ + | HExtlib.Localized _ + | CicNotationParser.Parse_error _ -> false + | Margin | End_of_file -> true + | Invalid_argument "Array.make" -> false + + (* debug *) + method dump () = + HLog.debug "script status:"; + HLog.debug ("history size: " ^ string_of_int (List.length history)); + HLog.debug (sprintf "%d statements:" (List.length statements)); + List.iter HLog.debug statements; + HLog.debug ("Current file name: " ^ Librarian.filename ()); +end + +let _script = ref None + +let script ~source_view ~mathviewer ~urichooser ~develcreator ~ask_confirmation ~set_star () += + let s = new script + ~source_view ~mathviewer ~ask_confirmation ~urichooser ~develcreator ~set_star () + in + _script := Some s; + s + +let current () = match !_script with None -> assert false | Some s -> s + diff --git a/matita/matitaScript.mli b/matita/matitaScript.mli new file mode 100644 index 000000000..2dd58b595 --- /dev/null +++ b/matita/matitaScript.mli @@ -0,0 +1,103 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception NoUnfinishedProof +exception ActionCancelled of string + +class type script = +object + + method locked_mark : Gtk.text_mark + method locked_tag : GText.tag + method error_tag : GText.tag + + (** @return current status *) + method lexicon_status: LexiconEngine.status + method grafite_status: GrafiteTypes.status + + (** {2 Observers} *) + + method addObserver : + (LexiconEngine.status -> GrafiteTypes.status -> unit) -> unit + + (** {2 History} *) + + method advance : ?statement:string -> unit -> unit + method retract : unit -> unit + method goto: [`Top | `Bottom | `Cursor] -> unit -> unit + method reset: unit -> unit + method template: unit -> unit + + (** {2 Load/save} *) + + method assignFileName : string -> unit (* to the current active file *) + method loadFromFile : string -> unit + method loadFromString : string -> unit + method saveToFile : unit -> unit + + (** {2 Current proof} (if any) *) + + (** @return true if there is an ongoing proof, false otherise *) + method onGoingProof: unit -> bool + +(* method proofStatus: ProofEngineTypes.status |+* @raise Statement_error +| *) + method proofMetasenv: Cic.metasenv (** @raise Statement_error *) + method proofContext: Cic.context (** @raise Statement_error *) + method proofConclusion: Cic.term (** @raise Statement_error *) + method stack: Continuationals.Stack.t (** @raise Statement_error *) + + method setGoal: int option -> unit + method goal: int option + + (** end of script, true if the whole script has been executed *) + method eos: bool + + (** misc *) + method clean_dirty_lock: unit + + (* debug *) + method dump : unit -> unit + +end + + (** @param set_star callback used to set the modified symbol (usually a star + * "*") on the side of a script name *) +val script: + source_view:GSourceView.source_view -> + mathviewer: MatitaTypes.mathViewer-> + urichooser: (UriManager.uri list -> UriManager.uri list) -> + develcreator: (containing:string option -> unit) -> + ask_confirmation: + (title:string -> message:string -> [`YES | `NO | `CANCEL]) -> + set_star: (string -> bool -> unit) -> + unit -> + script + +(* each time script above is called an internal ref is set, instance will return + * the value of this ref *) +(* TODO Zack: orrible solution until we found a better one for having a single + * access point for the script *) +val current: unit -> script + diff --git a/matita/matitaTypes.ml b/matita/matitaTypes.ml new file mode 100644 index 000000000..23d0d832f --- /dev/null +++ b/matita/matitaTypes.ml @@ -0,0 +1,95 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf +open GrafiteTypes + + (** user hit the cancel button *) +exception Cancel + +type abouts = + [ `Blank + | `Current_proof + | `Us + | `Coercions + | `CoercionsFull + ] + +type mathViewer_entry = + [ `About of abouts (* current proof *) + | `Check of string (* term *) + | `Cic of Cic.term * Cic.metasenv + | `Development of string + | `Dir of string (* "directory" in cic uris namespace *) + | `HBugs of [ `Tutors ] (* list of available HBugs tutors *) + | `Metadata of [ `Deps of [`Fwd | `Back] * UriManager.uri ] + | `Uri of UriManager.uri (* cic object uri *) + | `Whelp of string * UriManager.uri list (* query and results *) + ] + +let string_of_entry = function + | `About `Blank -> "about:blank" + | `About `Current_proof -> "about:proof" + | `About `Us -> "about:us" + | `About `Coercions -> "about:coercions?tred=true" + | `About `CoercionsFull -> "about:coercions" + | `Check _ -> "check:" + | `Cic (_, _) -> "term:" + | `Development d -> "devel:/" ^ d + | `Dir uri -> uri + | `HBugs `Tutors -> "hbugs:/tutors/" + | `Metadata meta -> + "metadata:/" ^ + (match meta with + | `Deps (dir, uri) -> + "deps/" ^ + let suri = + let suri = UriManager.string_of_uri uri in + let len = String.length suri in + String.sub suri 4 (len - 4) in (* strip "cic:" prefix *) + (match dir with | `Fwd -> "forward" | `Back -> "backward") ^ suri) + | `Uri uri -> UriManager.string_of_uri uri + | `Whelp (query, _) -> query + +let entry_of_string = function + | "about:blank" -> `About `Blank + | "about:proof" -> `About `Current_proof + | "about:us" -> `About `Us + | "about:coercions?tred=true" -> `About `Coercions + | "about:coercions" -> `About `CoercionsFull + | _ -> (* only about entries supported ATM *) + raise (Invalid_argument "entry_of_string") + +class type mathViewer = + object + (** @param reuse if set reused last opened cic browser otherwise + * opens a new one. default is false + *) + method show_entry: ?reuse:bool -> mathViewer_entry -> unit + method show_uri_list: + ?reuse:bool -> entry:mathViewer_entry -> UriManager.uri list -> unit + end diff --git a/matita/matitaTypes.mli b/matita/matitaTypes.mli new file mode 100644 index 000000000..c71c99dcc --- /dev/null +++ b/matita/matitaTypes.mli @@ -0,0 +1,49 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +exception Cancel + +type abouts = [ `Blank | `Current_proof | `Us | `Coercions | `CoercionsFull] + +type mathViewer_entry = + [ `About of abouts + | `Check of string + | `Cic of Cic.term * Cic.metasenv + | `Development of string + | `Dir of string + | `HBugs of [ `Tutors ] + | `Metadata of [ `Deps of [`Fwd | `Back] * UriManager.uri ] + | `Uri of UriManager.uri + | `Whelp of string * UriManager.uri list ] + +val string_of_entry : mathViewer_entry -> string +val entry_of_string : string -> mathViewer_entry + +class type mathViewer = + object + method show_entry : ?reuse:bool -> mathViewer_entry -> unit + method show_uri_list : + ?reuse:bool -> entry:mathViewer_entry -> UriManager.uri list -> unit + end diff --git a/matita/matitaWiki.ml b/matita/matitaWiki.ml new file mode 100644 index 000000000..3c5607bd7 --- /dev/null +++ b/matita/matitaWiki.ml @@ -0,0 +1,271 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id: matitacLib.ml 7090 2006-12-12 14:04:59Z fguidi $ *) + +open Printf + +open GrafiteTypes + +exception AttemptToInsertAnAlias + + +(** {2 Initialization} *) + +let grafite_status = (ref [] : GrafiteTypes.status list ref) +let lexicon_status = (ref [] : LexiconEngine.status list ref) + +let run_script is eval_function = + let lexicon_status',grafite_status' = + match !lexicon_status,!grafite_status with + | ss::_, s::_ -> ss,s + | _,_ -> assert false + in + let cb = fun _ _ -> () in + let matita_debug = Helm_registry.get_bool "matita.debug" in + try + match eval_function lexicon_status' grafite_status' is cb with + [] -> raise End_of_file + | ((grafite_status'',lexicon_status''),None)::_ -> + lexicon_status := lexicon_status''::!lexicon_status; + grafite_status := grafite_status''::!grafite_status + | (s,Some _)::_ -> raise AttemptToInsertAnAlias + with + | GrafiteEngine.Drop + | End_of_file + | CicNotationParser.Parse_error _ + | HExtlib.Localized _ as exn -> raise exn + | exn -> + if not matita_debug then + HLog.error (snd (MatitaExcPp.to_string exn)) ; + raise exn + +let clean_exit n = + match !grafite_status with + [] -> exit n + | grafite_status::_ -> + try + let baseuri = GrafiteTypes.get_string_option grafite_status "baseuri" in + LibraryClean.clean_baseuris ~verbose:false [baseuri]; + exit n + with GrafiteTypes.Option_error("baseuri", "not found") -> + (* no baseuri ==> nothing to clean yet *) + exit n + +let terminate n = + let terminator = String.make 1 (Char.chr 249) in + let prompt = + (match n with + None -> "-1" + | Some n -> string_of_int n) ^ terminator + in + print_endline prompt; + prerr_endline prompt +;; + +let outer_syntax_parser () = + let text = ref "" in + let tag = ref `Do in + let callbacks = + { XmlPushParser.default_callbacks with + XmlPushParser.start_element = + (Some + (fun name attrs -> + match name with + "pgip" -> () + | "doitem" -> tag := `Do + | "undoitem" -> tag := `Undo + | _ -> assert false)) ; + XmlPushParser.character_data = + (Some (fun s -> text := !text ^ s)) ; + XmlPushParser.end_element = + (Some + (function + "pgip" -> raise (XmlPushParser.Parse_error "EOC") + | "doitem" + | "undoitem" -> () + | _ -> assert false)) + } + in + let parse = XmlPushParser.create_parser callbacks in + try + XmlPushParser.parse parse (`Channel stdin) ; + raise End_of_file + with + XmlPushParser.Parse_error "no element found" -> raise End_of_file + | XmlPushParser.Parse_error "EOC" -> + match !tag with + `Do -> `Do !text + | `Undo -> + try + `Undo (int_of_string !text) + with + Failure _ -> assert false +;; + +let include_paths = + lazy (Helm_registry.get_list Helm_registry.string "matita.includes") +;; + +let rec interactive_loop () = + (* every loop is terminated by a terminator both on stdout and stderr *) + let interactive_loop n = terminate n; interactive_loop () in + try + match outer_syntax_parser () with + `Undo n -> + let rec drop = + function + 0,l -> l + | n,_::l -> drop (n-1,l) + | _,[] -> assert false + in + let to_be_dropped = List.length !lexicon_status - n in + let safe_hd = function [] -> assert false | he::_ -> he in + let cur_lexicon_status = safe_hd !lexicon_status in + let cur_grafite_status = safe_hd !grafite_status in + lexicon_status := drop (to_be_dropped, !lexicon_status) ; + grafite_status := drop (to_be_dropped, !grafite_status) ; + let lexicon_status = safe_hd !lexicon_status in + let grafite_status = safe_hd !grafite_status in + LexiconSync.time_travel + ~present:cur_lexicon_status ~past:lexicon_status; + GrafiteSync.time_travel + ~present:cur_grafite_status ~past:grafite_status; + interactive_loop (Some n) + | `Do command -> + let str = Ulexing.from_utf8_string command in + let watch_statuses lexicon_status grafite_status = + match grafite_status.GrafiteTypes.proof_status with + GrafiteTypes.Incomplete_proof + {GrafiteTypes.proof = uri,metasenv,_subst,bo,ty,attrs ; + GrafiteTypes.stack = stack } -> + let open_goals = Continuationals.Stack.open_goals stack in + print_endline + (String.concat "\n" + (List.map + (fun i -> + ApplyTransformation.txt_of_cic_sequent 80 metasenv + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + (List.find (fun (j,_,_) -> j=i) metasenv) + ) open_goals)) + | _ -> () + in + run_script str + (MatitaEngine.eval_from_stream ~first_statement_only:true ~prompt:false + ~include_paths:(Lazy.force include_paths) ~watch_statuses) ; + interactive_loop (Some (List.length !lexicon_status)) + with + | GrafiteEngine.Macro (floc,_) -> + let x, y = HExtlib.loc_of_floc floc in + HLog.error + (sprintf "A macro has been found in a script at %d-%d" x y); + interactive_loop None + | Sys.Break -> HLog.error "user break!"; interactive_loop None + | GrafiteTypes.Command_error _ -> interactive_loop None + | HExtlib.Localized (floc,CicNotationParser.Parse_error err) -> + let x, y = HExtlib.loc_of_floc floc in + HLog.error (sprintf "Parse error at %d-%d: %s" x y err); + interactive_loop None + | End_of_file as exn -> raise exn + | exn -> HLog.error (Printexc.to_string exn); interactive_loop None + + +let main () = + MatitaInit.initialize_all (); + HLog.set_log_callback + (fun tag msg -> + let s = + match tag with + `Debug -> "
    Debug: " ^ msg ^ "

    \n" + | `Message -> "
    Info: " ^ msg ^ "

    \n" + | `Warning -> "
    Warn: " ^ msg ^ "

    \n" + | `Error -> "
    Error: " ^ msg ^ "

    \n" + in + output_string stderr s; + flush stderr + ); + (* must be called after init since args are set by cmdline parsing *) + let system_mode = Helm_registry.get_bool "matita.system" in + Helm_registry.set_int "matita.verbosity" 0; + let include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" in + grafite_status := [GrafiteSync.init ()]; + lexicon_status := + [CicNotation2.load_notation ~include_paths + BuildTimeConf.core_notation_script] ; + Sys.catch_break true; + let origcb = HLog.get_log_callback () in + let origcb t s = origcb t ((if system_mode then "[S] " else "") ^ s) in + let newcb tag s = + match tag with + | `Debug -> () + | `Message | `Warning | `Error -> origcb tag s + in + HLog.set_log_callback newcb; + let matita_debug = Helm_registry.get_bool "matita.debug" in + try + (try + interactive_loop () + with + | End_of_file -> () + | GrafiteEngine.Drop -> clean_exit 1 + ); + let proof_status,moo_content_rev,lexicon_content_rev = + match !lexicon_status,!grafite_status with + | ss::_, s::_ -> + s.proof_status, s.moo_content_rev, + ss.LexiconEngine.lexicon_content_rev + | _,_ -> assert false + in + if proof_status <> GrafiteTypes.No_proof then + begin + HLog.error + "there are still incomplete proofs at the end of the script"; + clean_exit 2 + end + else + begin + let baseuri = + GrafiteTypes.get_string_option + (match !grafite_status with + [] -> assert false + | s::_ -> s) "baseuri" in + let moo_fname = + LibraryMisc.obj_file_of_baseuri + ~must_exist:false ~baseuri ~writable:true + in + let lexicon_fname= + LibraryMisc.lexicon_file_of_baseuri + ~must_exist:false ~baseuri ~writable:true + in + GrafiteMarshal.save_moo moo_fname moo_content_rev; + LexiconMarshal.save_lexicon lexicon_fname lexicon_content_rev; + exit 0 + end + with + | exn -> + if matita_debug then raise exn; + clean_exit 3 diff --git a/matita/matitac.ml b/matita/matitac.ml new file mode 100644 index 000000000..179a0ba8e --- /dev/null +++ b/matita/matitac.ml @@ -0,0 +1,110 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +module G = GrafiteAst +module L = LexiconAst +module H = HExtlib + +(* from transcript *) + +let out_comment och s = + let s = if s <> "" && s.[0] = '*' then "#" ^ s else s in + Printf.fprintf och "%s%s%s\n\n" "(*" s "*)" + +let out_line_comment och s = + let l = 70 - String.length s in + let s = Printf.sprintf " %s %s" s (String.make l '*') in + out_comment och s + +let out_preamble och (path, lines) = + let ich = open_in path in + let rec print i = + if i > 0 then + let s = input_line ich in + begin Printf.fprintf och "%s\n" s; print (pred i) end + in + print lines; + out_line_comment och "This file was automatically generated: do not edit" + +(* from matitacLib *) + +let pp_ast_statement st = + GrafiteAstPp.pp_statement ~term_pp:CicNotationPp.pp_term + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + ~lazy_term_pp:CicNotationPp.pp_term ~obj_pp:(CicNotationPp.pp_obj CicNotationPp.pp_term) st + +(**) + +let dump f = + Helm_registry.set_bool "matita.moo" false; + let floc = H.dummy_floc in + let nl_ast = G.Comment (floc, G.Note (floc, "")) in + let och = open_out f in + let atexit () = close_out och in + let nl () = output_string och (pp_ast_statement nl_ast) in + let rt_base_dir = Filename.dirname Sys.argv.(0) in + let path = Filename.concat rt_base_dir "matita.ma.templ" in + let lines = 14 in + out_preamble och (path, lines); + let grafite_parser_cb fname = + let ast = G.Executable (floc, G.Command (floc, G.Include (floc, fname))) in + output_string och (pp_ast_statement ast); nl (); nl () + in + let matita_engine_cb = function + | G.Executable (_, G.Macro (_, G.Inline _)) + | G.Executable (_, G.Command (_, G.Include _)) -> () + | ast -> + output_string och (pp_ast_statement ast); nl (); nl () + in + let matitac_lib_cb = output_string och in + GrafiteParser.set_callback grafite_parser_cb; + MatitaEngine.set_callback matita_engine_cb; + MatitacLib.set_callback matitac_lib_cb; + at_exit atexit + +let main () = + Helm_registry.set_bool "matita.moo" true; + match Filename.basename Sys.argv.(0) with + |"gragrep" |"gragrep.opt" |"gragrep.opt.static" ->Gragrep.main() + |"matitadep" |"matitadep.opt" |"matitadep.opt.static" ->Matitadep.main() + |"matitaclean"|"matitaclean.opt"|"matitaclean.opt.static"->Matitaclean.main() + |"matitamake" |"matitamake.opt" |"matitamake.opt.static" ->Matitamake.main() + |"matitaprover"|"matitaprover.opt" + |"matitaprover.opt.static" ->Matitaprover.main() + |"matitawiki"|"matitawiki.opt" ->MatitaWiki.main() + | _ -> +(* + let _ = Paramodulation.Saturation.init () in *) +(* ALB to link paramodulation *) + let dump_msg = " Dump source with expanded macros to " in + MatitaInit.add_cmdline_spec ["-dump", Arg.String dump, dump_msg]; + let _ = MatitacLib.main `COMPILER in + () + +let _ = main () + diff --git a/matita/matitacLib.ml b/matita/matitacLib.ml new file mode 100644 index 000000000..3cb8ae419 --- /dev/null +++ b/matita/matitacLib.ml @@ -0,0 +1,443 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +open GrafiteTypes + +exception AttemptToInsertAnAlias + +let out = ref ignore + +let set_callback f = out := f + +let pp_ast_statement st = + GrafiteAstPp.pp_statement + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + ~term_pp:CicNotationPp.pp_term + ~lazy_term_pp:CicNotationPp.pp_term ~obj_pp:(CicNotationPp.pp_obj CicNotationPp.pp_term) st + +(** {2 Initialization} *) + +let grafite_status = (ref None : GrafiteTypes.status option ref) +let lexicon_status = (ref None : LexiconEngine.status option ref) + +let run_script is eval_function = + let lexicon_status',grafite_status' = + match !lexicon_status,!grafite_status with + | Some ss, Some s -> ss,s + | _,_ -> assert false + in + let slash_n_RE = Pcre.regexp "\\n" in + let cb = + if Helm_registry.get_int "matita.verbosity" < 1 then + (fun _ _ -> ()) + else + (fun grafite_status stm -> + (* dump_status grafite_status; *) + let stm = pp_ast_statement stm in + let stm = Pcre.replace ~rex:slash_n_RE stm in + let stm = + if String.length stm > 50 then + String.sub stm 0 50 ^ " ..." + else + stm + in + HLog.debug ("Executing: ``" ^ stm ^ "''")) + in + let matita_debug = Helm_registry.get_bool "matita.debug" in + try + match eval_function lexicon_status' grafite_status' is cb with + [] -> raise End_of_file + | ((grafite_status'',lexicon_status''),None)::_ -> + lexicon_status := Some lexicon_status''; + grafite_status := Some grafite_status'' + | (s,Some _)::_ -> raise AttemptToInsertAnAlias + with + | GrafiteEngine.Drop + | End_of_file + | CicNotationParser.Parse_error _ + | GrafiteEngine.Macro _ as exn -> raise exn + | exn -> + if not matita_debug then + HLog.error (snd (MatitaExcPp.to_string exn)) ; + raise exn + +let fname () = + let rec aux = function + | ""::tl -> aux tl + | [x] -> x + | [] -> MatitaInit.die_usage () + | l -> + prerr_endline + ("Wrong commands: " ^ + String.concat " " (List.map (fun x -> "'" ^ x ^ "'") l)); + MatitaInit.die_usage () + in + aux (Helm_registry.get_list Helm_registry.string "matita.args") + +let pp_ocaml_mode () = + HLog.message ""; + HLog.message " ** Entering Ocaml mode ** "; + HLog.message ""; + HLog.message "Type 'go ();;' to enter an interactive matitac"; + HLog.message "" + +let clean_exit n = + let opt_exit = + function + None -> () + | Some n -> exit n + in + match !grafite_status with + None -> opt_exit n + | Some grafite_status -> + try + let baseuri = GrafiteTypes.get_string_option grafite_status "baseuri" in + LibraryClean.clean_baseuris ~verbose:false [baseuri]; + opt_exit n + with GrafiteTypes.Option_error("baseuri", "not found") -> + (* no baseuri ==> nothing to clean yet *) + opt_exit n + +let get_macro_context = function + | Some {GrafiteTypes.proof_status = GrafiteTypes.No_proof} -> [] + | Some status -> + let stack = GrafiteTypes.get_stack status in + let goal = Continuationals.Stack.find_goal stack in + GrafiteTypes.get_proof_context status goal + | None -> assert false + +let rec interactive_loop () = + let str = Ulexing.from_utf8_channel stdin in + try + run_script str + (MatitaEngine.eval_from_stream ~first_statement_only:false ~prompt:true + ~include_paths:(Helm_registry.get_list Helm_registry.string + "matita.includes")) + with + | GrafiteEngine.Drop -> pp_ocaml_mode () + | GrafiteEngine.Macro (floc, f) -> + begin match f (get_macro_context !grafite_status) with + | _, GrafiteAst.Inline (_, style, suri, prefix) -> + let str = + ApplyTransformation.txt_of_inline_macro style suri prefix + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") + in + !out str; + interactive_loop () + | _ -> + let x, y = HExtlib.loc_of_floc floc in + HLog.error (sprintf "A macro has been found in a script at %d-%d" x y); + interactive_loop () + end + | Sys.Break -> HLog.error "user break!"; interactive_loop () + | GrafiteTypes.Command_error _ -> interactive_loop () + | End_of_file -> + print_newline (); + clean_exit (Some 0) + | HExtlib.Localized (floc,CicNotationParser.Parse_error err) -> + let x, y = HExtlib.loc_of_floc floc in + HLog.error (sprintf "Parse error at %d-%d: %s" x y err); + interactive_loop () + | exn -> HLog.error (Printexc.to_string exn); interactive_loop () + +let go () = + Helm_registry.load_from BuildTimeConf.matita_conf; + Http_getter.init (); + MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner"); + LibraryDb.create_owner_environment (); + CicEnvironment.set_trust (* environment trust *) + (let trust = + Helm_registry.get_opt_default Helm_registry.get_bool + ~default:true "matita.environment_trust" in + fun _ -> trust); + let include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" in + grafite_status := Some (GrafiteSync.init ()); + lexicon_status := + Some (CicNotation2.load_notation ~include_paths + BuildTimeConf.core_notation_script); + Sys.catch_break true; + interactive_loop () + +let pp_times fname bench_mode rc big_bang = + if bench_mode then + begin + let { Unix.tms_utime = u ; Unix.tms_stime = s} = Unix.times () in + let r = Unix.gettimeofday () -. big_bang in + let extra = try Sys.getenv "BENCH_EXTRA_TEXT" with Not_found -> "" in + let cc = + if Str.string_match (Str.regexp ".*opt$") Sys.argv.(0) 0 then + "matitac.opt" + else + "matitac" + in + let rc = if rc then "OK" else "FAIL" in + let times = + let fmt t = + let seconds = int_of_float t in + let cents = int_of_float ((t -. floor t) *. 100.0) in + let minutes = seconds / 60 in + let seconds = seconds mod 60 in + Printf.sprintf "%dm%02d.%02ds" minutes seconds cents + in + Printf.sprintf "%s %s %s" (fmt r) (fmt u) (fmt s) + in + let fname = + match MatitamakeLib.development_for_dir (Filename.dirname fname) with + | None -> fname + | Some d -> + let rootlen = String.length(MatitamakeLib.root_for_development d)in + let fnamelen = String.length fname in + assert (fnamelen > rootlen); + String.sub fname rootlen (fnamelen - rootlen) + in + let fname = + if fname.[0] = '/' then + String.sub fname 1 (String.length fname - 1) + else + fname + in + let s = Printf.sprintf "%s %-35s %-4s %s %s" cc fname rc times extra in + print_endline s; + flush stdout + end +;; + +let rec compiler_loop fname big_bang mode buf = + let include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" in + let clean_baseuri = not (Helm_registry.get_bool "matita.preserve") in + let matita_debug = Helm_registry.get_bool "matita.debug" in + let bench_mode = Helm_registry.get_bool "matita.bench" in + try + run_script buf + (MatitaEngine.eval_from_stream ~first_statement_only:false ~include_paths + ~clean_baseuri) + with + | End_of_file -> () + | Sys.Break as exn -> + if matita_debug then raise exn; + HLog.error "user break!"; + pp_times fname bench_mode false big_bang; + if mode = `COMPILER then + clean_exit (Some ~-1) + else + pp_ocaml_mode () + | GrafiteEngine.Drop -> + if mode = `COMPILER then + begin + pp_times fname bench_mode false big_bang; + clean_exit (Some 1) + end + else + pp_ocaml_mode () + | GrafiteEngine.Macro (floc, f) -> + begin match f (get_macro_context !grafite_status) with + | _, GrafiteAst.Inline (_, style, suri, prefix) -> + let str = + ApplyTransformation.txt_of_inline_macro style suri prefix + ~map_unicode_to_tex:(Helm_registry.get_bool + "matita.paste_unicode_as_tex") in + !out str; + compiler_loop fname big_bang mode buf + | _ -> + let x, y = HExtlib.loc_of_floc floc in + HLog.error (sprintf "A macro has been found in a script at %d-%d" x y); + if mode = `COMPILER then + begin + pp_times fname bench_mode false big_bang; + clean_exit (Some 1) + end + else + pp_ocaml_mode () + end + | HExtlib.Localized (floc,CicNotationParser.Parse_error err) -> + let (x, y) = HExtlib.loc_of_floc floc in + HLog.error (sprintf "Parse error at %d-%d: %s" x y err); + if mode = `COMPILER then + begin + pp_times fname bench_mode false big_bang; + clean_exit (Some 1) + end + else + pp_ocaml_mode () + | exn -> + if matita_debug then raise exn; + if mode = `COMPILER then + begin + pp_times fname bench_mode false big_bang; + clean_exit (Some 3) + end + else + pp_ocaml_mode () + +exception ReadOnlyUri of string + +let main ~mode = + let big_bang = Unix.gettimeofday () in + MatitaInit.initialize_all (); + (* must be called after init since args are set by cmdline parsing *) + let fname = fname () in + if false then + (let baseuri = + (* This does not work yet :-( + let baseuri = + GrafiteTypes.get_string_option + (match !grafite_status with None -> assert false | Some s -> s) + "baseuri" in*) + lazy + (let _root, buri, _fname = Librarian.baseuri_of_script ~include_paths:[] fname in + buri) + in + let mangled_baseuri = + lazy + ( let baseuri = Lazy.force baseuri in + let baseuri = String.sub baseuri 5 (String.length baseuri - 5) in + let baseuri = Pcre.replace ~pat:"/" ~templ:"_" baseuri in + String.uncapitalize baseuri + ) in + let f = + lazy + (open_out + (Filename.dirname fname ^ "/" ^ Lazy.force mangled_baseuri ^ ".ml")) in + LibrarySync.set_object_declaration_hook + (fun _ obj -> + output_string (Lazy.force f) + (CicExportation.ppobj (Lazy.force baseuri) obj); + flush (Lazy.force f))); + let system_mode = Helm_registry.get_bool "matita.system" in + let bench_mode = Helm_registry.get_bool "matita.bench" in + if bench_mode then + Helm_registry.set_int "matita.verbosity" 0; + let include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" in + grafite_status := Some (GrafiteSync.init ()); + lexicon_status := + Some (CicNotation2.load_notation ~include_paths + BuildTimeConf.core_notation_script); + Sys.catch_break true; + let origcb = HLog.get_log_callback () in + let origcb t s = origcb t ((if system_mode then "[S] " else "") ^ s) in + let newcb tag s = + match tag with + | `Debug | `Message -> () + | `Warning | `Error -> origcb tag s + in + if Helm_registry.get_int "matita.verbosity" < 1 then + HLog.set_log_callback newcb; + if bench_mode then MatitaMisc.shutup (); + let ich, fname, baseuri = + if fname = "stdin" || fname = "-" then + let fname = "/dev/fd/0" in + let _,baseuri,fname = + Librarian.baseuri_of_script ~include_paths:[] fname + in + stdin, fname, baseuri + else + let _,baseuri,fname = + Librarian.baseuri_of_script ~include_paths fname + in + open_in fname, fname, baseuri + in + (* PUT THIS IN A FUNCTION *) + if Http_getter_storage.is_read_only baseuri then begin + HLog.error (Printf.sprintf "uri %s belongs to a read-only repository" + baseuri); + raise (ReadOnlyUri baseuri) + end; + if (not (Http_getter_storage.is_empty ~local:true baseuri) || + LibraryClean.db_uris_of_baseuri baseuri <> []) + then begin + HLog.message ("baseuri " ^ baseuri ^ " is not empty"); + HLog.message ("cleaning baseuri " ^ baseuri); + LibraryClean.clean_baseuris [baseuri]; + assert (Http_getter_storage.is_empty ~local:true baseuri); + end; + if not (Helm_registry.get_opt_default Helm_registry.bool "matita.nodisk" + ~default:false) + then + HExtlib.mkdir + (Filename.dirname + (Http_getter.filename ~local:true ~writable:true (baseuri ^ + "foo.con"))); + (* PUT THIS IN A FUNCTION *) + let time = Unix.time () in + if Helm_registry.get_int "matita.verbosity" < 1 && not bench_mode then + origcb `Message ("compiling " ^ + Filename.basename fname ^ " in " ^ baseuri ^ " ...") + else + HLog.message (sprintf "execution of %s started in %s:" + (Filename.basename fname) baseuri); + let buf = Ulexing.from_utf8_channel ich in + compiler_loop fname big_bang mode buf; + let elapsed = Unix.time () -. time in + let tm = Unix.gmtime elapsed in + let sec = string_of_int tm.Unix.tm_sec ^ "''" in + let min = + if tm.Unix.tm_min > 0 then (string_of_int tm.Unix.tm_min ^ "' ") else "" + in + let hou = + if tm.Unix.tm_hour > 0 then (string_of_int tm.Unix.tm_hour ^ "h ") else "" + in + let proof_status,moo_content_rev,lexicon_content_rev = + match !lexicon_status,!grafite_status with + | Some ss, Some s -> + s.proof_status, s.moo_content_rev, + ss.LexiconEngine.lexicon_content_rev + | _,_ -> assert false + in + if proof_status <> GrafiteTypes.No_proof then + begin + HLog.error + "there are still incomplete proofs at the end of the script"; + pp_times fname bench_mode true big_bang; + clean_exit (Some 2) + end + else + begin + let moo_fname = + LibraryMisc.obj_file_of_baseuri + ~must_exist:false ~baseuri ~writable:true + in + let lexicon_fname= + LibraryMisc.lexicon_file_of_baseuri + ~must_exist:false ~baseuri ~writable:true + in + (* FG: we do not generate .moo when dumping .mma files *) + if Helm_registry.get_bool "matita.moo" then begin + GrafiteMarshal.save_moo moo_fname moo_content_rev; + LexiconMarshal.save_lexicon lexicon_fname lexicon_content_rev; + end; + HLog.message + (sprintf "execution of %s completed in %s." fname (hou^min^sec)); + pp_times fname bench_mode true big_bang; + exit 0 + end diff --git a/matita/matitacLib.mli b/matita/matitacLib.mli new file mode 100644 index 000000000..5e8a2635b --- /dev/null +++ b/matita/matitacLib.mli @@ -0,0 +1,40 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val interactive_loop : unit -> unit + +(** go initializes the status and calls interactive_loop *) +val go : unit -> unit +val main : mode:[ `COMPILER | `TOPLEVEL ] -> unit + +(** clean_exit n + if n = Some n it performs an exit [n] after a complete clean-up of what was + partially compiled + otherwise it performs the clean-up without exiting +*) +val clean_exit : int option -> unit + +(* this callback is called on the expansion of every inline macro *) +val set_callback: (string -> unit) -> unit diff --git a/matita/matitaclean.ml b/matita/matitaclean.ml new file mode 100644 index 000000000..5425a2217 --- /dev/null +++ b/matita/matitaclean.ml @@ -0,0 +1,108 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +module UM = UriManager +module TA = GrafiteAst + +let clean_suffixes = [ ".moo"; ".lexicon"; ".metadata"; ".xml.gz" ] + +let ask_confirmation _ = + print_string " + You are trying to delete the whole standard library. + Since this may be a dangerous operation, you are asked to type + + yes, I'm sure + + verbatim and press enter.\n\n> "; + flush stdout; + let str = input_line stdin in + if str = "yes, I'm sure" then + begin + print_string "deletion in progess...\n"; + flush stdout + end + else + begin + print_string "deletion cancelled.\n"; + flush stdout; + exit 1 + end +;; + +let main () = + let _ = MatitaInit.initialize_all () in + if Helm_registry.get_bool "matita.bench" then MatitaMisc.shutup (); + match Helm_registry.get_list Helm_registry.string "matita.args" with + | [ "all" ] -> + if Helm_registry.get_bool "matita.system" then + ask_confirmation (); + LibraryDb.clean_owner_environment (); + let prefixes = + HExtlib.filter_map + (fun s -> + if String.sub s 0 5 = "file:" then + Some (Str.replace_first (Str.regexp "^file://") "" s) + else + None) + (Http_getter_storage.list_writable_prefixes ()) + in + List.iter + (fun xmldir -> + let clean_pat = + String.concat " -o " + (List.map (fun suf -> "-name \\*" ^ suf) clean_suffixes) in + let clean_cmd = + sprintf "find %s \\( %s \\) -exec rm \\{\\} \\; 2> /dev/null" + xmldir clean_pat in + ignore (Sys.command clean_cmd); + ignore + (Sys.command ("find " ^ xmldir ^ + " -type d -exec rmdir -p {} \\; 2> /dev/null"))) + prefixes; + exit 0 + | [] -> MatitaInit.die_usage () + | files -> + let uris_to_remove = + List.fold_left + (fun uris_to_remove suri -> + let uri = + try + UM.buri_of_uri (UM.uri_of_string suri) + with UM.IllFormedUri _ -> + let _,u,_ = Librarian.baseuri_of_script ~include_paths:[] suri in + if String.length u < 5 || String.sub u 0 5 <> "cic:/" then begin + HLog.error (sprintf "File %s defines a bad baseuri: %s" + suri u); + exit 1 + end else + u + in + uri::uris_to_remove) [] files + in + LibraryClean.clean_baseuris uris_to_remove diff --git a/matita/matitaclean.mli b/matita/matitaclean.mli new file mode 100644 index 000000000..45d57a886 --- /dev/null +++ b/matita/matitaclean.mli @@ -0,0 +1,27 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val main: unit -> unit + diff --git a/matita/matitadep.ml b/matita/matitadep.ml new file mode 100644 index 000000000..f6ea9da8a --- /dev/null +++ b/matita/matitadep.ml @@ -0,0 +1,227 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +module GA = GrafiteAst +module U = UriManager + +let obj_file_of_baseuri writable baseuri = + try + LibraryMisc.obj_file_of_baseuri + ~must_exist:true ~baseuri ~writable + with + | Http_getter_types.Unresolvable_URI _ + | Http_getter_types.Key_not_found _ -> + LibraryMisc.obj_file_of_baseuri + ~must_exist:false ~baseuri ~writable:true +;; + +let main () = + (* all are maps from "file" to "something" *) + let include_deps = Hashtbl.create (Array.length Sys.argv) in + let include_deps_dot = Hashtbl.create (Array.length Sys.argv) in + let baseuri_of = Hashtbl.create (Array.length Sys.argv) in + let baseuri_of_inv = Hashtbl.create (Array.length Sys.argv) in + let uri_deps = Hashtbl.create (Array.length Sys.argv) in + let ma_topo = Hashtbl.create (Array.length Sys.argv) in + let ma_topo_keys = ref [] in + let buri alias = U.buri_of_uri (U.uri_of_string alias) in + let resolve alias current_buri = + let buri = buri alias in + if buri <> current_buri then Some buri else None in + let dot_file = ref "" in + let order_only = ref false in + MatitaInit.add_cmdline_spec + ["-dot", Arg.Set_string dot_file, + " Save dependency graph in dot format to the given file"; + "-order", Arg.Set order_only, + "Only print (one of the possibles) build order(s) for the given *.ma"]; + MatitaInit.parse_cmdline_and_configuration_file (); + MatitaInit.initialize_environment (); + MatitamakeLib.initialize (); + let include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" in + let args = Helm_registry.get_list Helm_registry.string "matita.args" in + if args = [] then + begin + prerr_endline "At least one .ma file must be specified"; + exit 1 + end; + let ma_files = args in + let bof = Hashtbl.create 10 in + let baseuri_of_script s = + try Hashtbl.find bof s + with Not_found -> + let _,b,_ = Librarian.baseuri_of_script ~include_paths s in + Hashtbl.add bof s b; b + in + List.iter + (fun ma_file -> + let ic = open_in ma_file in + let istream = Ulexing.from_utf8_channel ic in + let dependencies = DependenciesParser.parse_dependencies istream in + close_in ic; + if !order_only then begin + let relative_ma_file = + (* change a path leading to a .ma file into a path relative to its + * development root dir *) + let absolute_ma_file = + if Filename.is_relative ma_file then + Filename.concat (Sys.getcwd ()) ma_file + else + ma_file in + let ma_dir = Filename.dirname absolute_ma_file in + match MatitamakeLib.development_for_dir ma_dir with + | None -> + eprintf "no development setup for dir '%s'\n%!" ma_dir; + assert false + | Some devel -> + Pcre.replace + ~pat:(Pcre.quote(MatitamakeLib.root_for_development devel) ^ "/?") + ~templ:"" absolute_ma_file + in + ma_topo_keys := relative_ma_file :: !ma_topo_keys; + List.iter + (function + | DependenciesParser.IncludeDep path -> + Hashtbl.add ma_topo relative_ma_file path + | _ -> ()) + dependencies + end else + List.iter + (function + | DependenciesParser.UriDep uri -> + let uri = UriManager.string_of_uri uri in + if not (Http_getter_storage.is_legacy uri) then + Hashtbl.add uri_deps ma_file uri + | DependenciesParser.BaseuriDep uri -> + let uri = Http_getter_misc.strip_trailing_slash uri in + Hashtbl.add baseuri_of ma_file uri; + Hashtbl.add baseuri_of_inv uri ma_file + | DependenciesParser.IncludeDep path -> + try + let baseuri = baseuri_of_script path in + if not (Http_getter_storage.is_legacy baseuri) then + (let moo_file = obj_file_of_baseuri false baseuri in + Hashtbl.add include_deps ma_file moo_file; + Hashtbl.add include_deps_dot ma_file baseuri) + with Sys_error _ -> + HLog.warn + ("Unable to find " ^ path ^ " that is included in " ^ ma_file)) + dependencies) + ma_files; + Hashtbl.iter + (fun file alias -> + try + let dep = resolve alias (Hashtbl.find baseuri_of file) in + match dep with + | None -> () + | Some u -> + Hashtbl.add include_deps file (obj_file_of_baseuri false u) + with Not_found -> + prerr_endline ("File "^ file^" has no baseuri. Use set baseuri"); + exit 1) + uri_deps; + let gcp x y = + (* explode and implode from the OCaml Expert FAQ. *) + let explode s = + let rec exp i l = + if i < 0 then l else exp (i - 1) (s.[i] :: l) in + exp (String.length s - 1) [] + in + let implode l = + let res = String.create (List.length l) in + let rec imp i = function + | [] -> res + | c :: l -> res.[i] <- c; imp (i + 1) l in + imp 0 l + in + let rec aux = function + | x::tl1,y::tl2 when x = y -> x::(aux (tl1,tl2)) + | _ -> [] + in + implode (aux (explode x,explode y)) + in + let max_path = List.hd ma_files in + let max_path = List.fold_left gcp max_path ma_files in + let short x = Pcre.replace ~pat:("^"^max_path) x in + if !dot_file <> "" then (* generate dependency graph if required *) + begin + let oc = open_out !dot_file in + let fmt = Format.formatter_of_out_channel oc in + GraphvizPp.Dot.header (* ~graph_attrs:["rankdir","LR"] *) fmt; + List.iter + (fun ma_file -> + let deps = Hashtbl.find_all include_deps_dot ma_file in + let deps = + HExtlib.filter_map + (fun u -> + try Some (Hashtbl.find baseuri_of_inv u) + with Not_found -> None) + deps + in + let deps = List.fast_sort Pervasives.compare deps in + let deps = HExtlib.list_uniq deps in + GraphvizPp.Dot.node (short ma_file) fmt; + List.iter (fun dep -> GraphvizPp.Dot.edge (short ma_file) (short dep) fmt) deps) + ma_files; + GraphvizPp.Dot.trailer fmt; + close_out oc + end; + if !order_only then begin + let module OrdererString = + struct + type t = string + let compare = Pervasives.compare + end + in + let module Topo = HTopoSort.Make (OrdererString) in + let sorted_ma = + Topo.topological_sort !ma_topo_keys (Hashtbl.find_all ma_topo) in + List.iter print_endline sorted_ma + (*Hashtbl.iter (fun k v -> printf "%s: %s\n" k v) ma_topo*) + end else + List.iter (* generate regular .depend output *) + (fun ma_file -> + try + let deps = Hashtbl.find_all include_deps ma_file in + let deps = List.fast_sort Pervasives.compare deps in + let deps = HExtlib.list_uniq deps in + let deps = ma_file :: deps in + let baseuri = Hashtbl.find baseuri_of ma_file in + let moo = obj_file_of_baseuri true baseuri in + printf "%s: %s\n%s: %s\n%s: %s\n%s: %s\n" + moo (String.concat " " deps) + (Filename.basename(Pcre.replace ~pat:"ma$" ~templ:"mo" ma_file)) moo + (Pcre.replace ~pat:"ma$" ~templ:"mo" ma_file) moo + (Pcre.replace ~pat:"ma$" ~templ:"mo" (short ma_file)) moo + with Not_found -> + prerr_endline ("File "^ma_file^" has no baseuri. Use set baseuri"); + exit 1) + ma_files + diff --git a/matita/matitadep.mli b/matita/matitadep.mli new file mode 100644 index 000000000..45d57a886 --- /dev/null +++ b/matita/matitadep.mli @@ -0,0 +1,27 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val main: unit -> unit + diff --git a/matita/matitamake.ml b/matita/matitamake.ml new file mode 100644 index 000000000..ad4368738 --- /dev/null +++ b/matita/matitamake.ml @@ -0,0 +1,135 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +module MK = MatitamakeLib ;; + +let main () = + MatitaInit.parse_cmdline_and_configuration_file (); + MK.initialize (); + let usage = ref (fun () -> ()) in + let dev_of_name name = + match MK.development_for_name name with + | None -> + prerr_endline ("Unable to find a development called " ^ name); + exit 1 + | Some d -> d + in + let dev_for_dir dir = + match MK.development_for_dir dir with + | None -> + prerr_endline ("Unable to find a development holding directory: "^ dir); + exit 1 + | Some d -> d + in + let init_dev args = + let name, path = + match args with + | [ name; path ] when path.[0] = '/' -> name, path + | [ name; path ] -> name, Unix.getcwd () ^ "/" ^ path + | [ name ] -> name, Unix.getcwd () + | _ -> !usage (); (* should not be reached *) assert false + in + match MK.initialize_development name path with + | None -> exit 2 + | Some _ -> exit 0 + in + let list_dev args = + if List.length args <> 0 then !usage (); + match MK.list_known_developments () with + | [] -> print_string "No developments found.\n"; exit 0 + | l -> + List.iter + (fun (name, root) -> + print_string (Printf.sprintf "%-10s\trooted in %s\n" name root)) + l; + exit 0 + in + let destroy_dev args = + if List.length args <> 1 then !usage (); + let name = (List.hd args) in + let dev = dev_of_name name in + MK.destroy_development dev; + exit 0 + in + let clean_dev args = + let dev = + match args with + | [] -> dev_for_dir (Unix.getcwd ()) + | [name] -> dev_of_name name + | _ -> !usage (); exit 1 + in + match MK.clean_development dev with + | true -> exit 0 + | false -> exit 1 + in + let build_dev args = + if List.length args <> 1 then !usage (); + let name = (List.hd args) in + let dev = dev_of_name name in + match MK.build_development dev with + | true -> exit 0 + | false -> exit 1 + in + let publish_dev args = + if List.length args <> 1 then !usage (); + let name = (List.hd args) in + let dev = dev_of_name name in + match MK.publish_development dev with + | true -> exit 0 + | false -> exit 1 + in + let target args = + if List.length args < 1 then !usage (); + let dev = dev_for_dir (Unix.getcwd ()) in + List.iter + (fun t -> + ignore(MK.build_development ~target:t dev)) + args + in + let params = [ + "init", init_dev; + "clean", clean_dev; + "list", list_dev; + "destroy", destroy_dev; + "build", build_dev; + "publish", publish_dev; + ] + in + usage := MatitaInit.die_usage; + let parse args = + match args with + | [] -> target [ "all" ] + | s :: tl -> + let f, args = + try + (List.assoc s params), tl + with Not_found -> + if s.[0] = '-' then (!usage ();assert false) else target, args + in + f args + in + parse (Helm_registry.get_list Helm_registry.string "matita.args") diff --git a/matita/matitamake.mli b/matita/matitamake.mli new file mode 100644 index 000000000..47ea2fe34 --- /dev/null +++ b/matita/matitamake.mli @@ -0,0 +1,27 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val main : unit -> unit + diff --git a/matita/matitamakeLib.ml b/matita/matitamakeLib.ml new file mode 100644 index 000000000..499d0eaf3 --- /dev/null +++ b/matita/matitamakeLib.ml @@ -0,0 +1,394 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +open Printf + +let logger = fun mark -> + match mark with + | `Error -> HLog.error + | `Warning -> HLog.warn + | `Debug -> HLog.debug + | `Message -> HLog.message + +type development = + { root: string ; name: string } + +let developments = ref [] + +let pool () = Helm_registry.get "matita.basedir" ^ "/matitamake/" ;; +let rootfile = "/root" ;; + +(* /foo/./bar/..//baz -> /foo/baz *) +let normalize_path s = + let s = Str.global_replace (Str.regexp "//") "/" s in + let l = Str.split (Str.regexp "/") s in + let rec aux = function + | [] -> [] + | he::".."::tl -> aux tl + | he::"."::tl -> aux (he::tl) + | he::tl -> he :: aux tl + in + (if Str.string_match (Str.regexp "^/") s 0 then "/" else "") ^ + String.concat "/" (aux l) + ^ (if Str.string_match (Str.regexp "/$") s 0 then "/" else "") +;; + +let ls_dir dir = + try + let d = Unix.opendir dir in + let content = ref [] in + try + while true do + let name = Unix.readdir d in + if name <> "." && name <> ".." then + content := name :: !content + done; + Some [] + with End_of_file -> Unix.closedir d; Some !content + with Unix.Unix_error _ -> None + +let initialize () = + (* create a base env if none *) + HExtlib.mkdir (pool ()); + (* load developments *) + match ls_dir (pool ()) with + | None -> logger `Error ("Unable to list directory " ^ pool ()) + | Some l -> + let paths = + List.fold_left + (fun acc name -> + let root = + try + Some (HExtlib.input_file (pool () ^ name ^ rootfile)) + with Unix.Unix_error _ -> + logger `Warning ("Malformed development " ^ name); + None + in + match root with + | None -> acc + | Some root -> + developments := {root = root ; name = name} :: !developments; + root::acc) + [] l + in + let inc = Helm_registry.get_list Helm_registry.string "matita.includes" in + Helm_registry.set_list Helm_registry.of_string + ~key:"matita.includes" ~value:(inc @ paths) + +(* finds the makefile path for development devel *) +let makefile_for_development devel = + let develdir = pool () ^ devel.name in + develdir ^ "/makefile" + +let dot_for_development devel = + let dot_fname = pool () ^ devel.name ^ "/depend.dot" in + if Sys.file_exists dot_fname then Some dot_fname else None + +(* given a dir finds a development that is radicated in it or below *) +let development_for_dir dir = + let dir = normalize_path dir in + let is_prefix_of d1 d2 = + let len1 = String.length d1 in + let len2 = String.length d2 in + if len2 < len1 then + false + else + let pref = String.sub d2 0 len1 in + pref = d1 && (len1 = len2 || d2.[len1] = '/') + in + try + Some (List.find (fun d -> is_prefix_of d.root dir) !developments) + with Not_found | Failure _ -> None + +let development_for_name name = + try + Some (List.find (fun d -> d.name = name) !developments) + with Not_found -> None + +(* dumps the deveopment to disk *) +let dump_development devel = + let devel_dir = pool () ^ devel.name in + HExtlib.mkdir devel_dir; + HExtlib.output_file ~filename:(devel_dir ^ rootfile) ~text:devel.root + +let list_known_developments () = + List.map (fun r -> r.name,r.root) !developments + +let am_i_opt = lazy ( + if Pcre.pmatch ~pat:"\\.opt$" Sys.argv.(0) then ".opt" else "") + +let rebuild_makefile development = + let makefilepath = makefile_for_development development in + let template = + HExtlib.input_file BuildTimeConf.matitamake_makefile_template + in + let ext = Lazy.force am_i_opt in + let binpath = + if HExtlib.is_executable + (BuildTimeConf.runtime_base_dir ^ "/matitac" ^ ext) + then BuildTimeConf.runtime_base_dir ^ "/" else "" + in + let cc = binpath ^ "matitac" ^ ext in + let rm = binpath ^ "matitaclean" ^ ext in + let mm = binpath ^ "matitadep" ^ ext in + let df = pool () ^ development.name ^ "/depend" in + let template = Pcre.replace ~pat:"@ROOT@" ~templ:development.root template in + let template = Pcre.replace ~pat:"@CC@" ~templ:cc template in + let template = Pcre.replace ~pat:"@DEP@" ~templ:mm template in + let template = Pcre.replace ~pat:"@DEPFILE@" ~templ:df template in + let template = Pcre.replace ~pat:"@CLEAN@" ~templ:rm template in + HExtlib.output_file ~filename:makefilepath ~text:template + +let rebuild_makefile_devel development = + let path = development.root ^ "/makefile" in + if not (Sys.file_exists path) then + begin + let template = + HExtlib.input_file BuildTimeConf.matitamake_makefile_template_devel + in + let template = + Pcre.replace ~pat:"@MATITA_RT_BASE_DIR@" + ~templ:BuildTimeConf.runtime_base_dir template + in + HExtlib.output_file ~filename:path ~text:template + end + +(* creates a new development if possible *) +let initialize_development name dir = + let dir = normalize_path dir in + let name = Pcre.replace ~pat:" " ~templ:"_" name in + let dev = {name = name ; root = dir} in + dump_development dev; + rebuild_makefile dev; + rebuild_makefile_devel dev; + developments := dev :: !developments; + Some dev + +let make chdir args = + let old = Unix.getcwd () in + try + Unix.chdir chdir; + let cmd = String.concat " " ("make" :: List.map Filename.quote args) in + let rc = Unix.system cmd in + Unix.chdir old; + match rc with + | Unix.WEXITED 0 -> true + | Unix.WEXITED i -> logger `Error ("make returned " ^ string_of_int i);false + | _ -> logger `Error "make STOPPED or SIGNALED!";false + with Unix.Unix_error (_,cmd,err) -> + logger `Warning ("Unix Error: " ^ cmd ^ ": " ^ err); + false + +let call_make ?matita_flags development target make = + let matita_flags = + let already_defined = + match matita_flags with + | None -> (try Sys.getenv "MATITA_FLAGS" with Not_found -> "") + | Some s -> s + in + let bench = + if Helm_registry.get_bool "matita.bench" then " -bench" else "" + in + let system = + if Helm_registry.get_bool "matita.system" then " -system" else "" + in + let noinnertypes = + if Helm_registry.get_bool "matita.noinnertypes" then " -noinnertypes" else "" + in + already_defined ^ bench ^ system ^ noinnertypes + in + let csc = try ["SRC=" ^ Sys.getenv "SRC"] with Not_found -> [] in + rebuild_makefile development; + let makefile = makefile_for_development development in + let flags = [] in + let flags = + try + flags @ [ sprintf "MATITA_FLAGS=%s" matita_flags ] + with Not_found -> flags in + let flags = flags @ csc in + let args = + ["--no-print-directory"; "-s"; "-k"; "-f"; makefile; target] @ flags + in + (* prerr_endline (String.concat " " args); *) + make development.root args + +let build_development ?matita_flags ?(target="all") development = + call_make ?matita_flags development target make + +(* not really good vt100 *) +let vt100 s = + let rex = Pcre.regexp "\\[[0-9;]+m" in + let rex_i = Pcre.regexp "^Info" in + let rex_w = Pcre.regexp "^Warning" in + let rex_e = Pcre.regexp "^Error" in + let rex_d = Pcre.regexp "^Debug" in + let rex_noendline = Pcre.regexp "\\n" in + let s = Pcre.replace ~rex:rex_noendline s in + let tokens = Pcre.split ~rex s in + let logger = ref HLog.message in + let rec aux = + function + | [] -> () + | s::tl -> + (if Pcre.pmatch ~rex:rex_i s then + logger := HLog.message + else if Pcre.pmatch ~rex:rex_w s then + logger := HLog.warn + else if Pcre.pmatch ~rex:rex_e s then + logger := HLog.error + else if Pcre.pmatch ~rex:rex_d s then + logger := HLog.debug + else + !logger s); + aux tl + in + aux tokens + + +let mk_maker refresh_cb = + (fun chdir args -> + let out_r,out_w = Unix.pipe () in + let err_r,err_w = Unix.pipe () in + let pid = ref ~-1 in + let oldhandler = Sys.signal Sys.sigchld (Sys.Signal_ignore) in + try +(* prerr_endline (String.concat " " args); *) + let argv = Array.of_list ("make"::args) in + pid := Unix.create_process "make" argv Unix.stdin out_w err_w; + Unix.close out_w; + Unix.close err_w; + let buf = String.create 1024 in + let rec aux = function + | f::tl -> + let len = Unix.read f buf 0 1024 in + if len = 0 then + raise + (Unix.Unix_error + (Unix.EPIPE,"read","len = 0 (matita internal)")); + vt100 (String.sub buf 0 len); + aux tl + | _ -> () + in + while true do + let r,_,_ = Unix.select [out_r; err_r] [] [] (-. 1.) in + aux r; + refresh_cb () + done; + ignore(Sys.signal Sys.sigchld oldhandler); + true + with + | Unix.Unix_error (_,"read",_) + | Unix.Unix_error (_,"select",_) -> + ignore(Sys.signal Sys.sigchld oldhandler); + true) + +let build_development_in_bg ?matita_flags ?(target="all") refresh_cb development = + call_make ?matita_flags development target (mk_maker refresh_cb) + +let clean_development ?matita_flags development = + call_make ?matita_flags development "clean" make + +let clean_development_in_bg ?matita_flags refresh_cb development = + call_make development ?matita_flags "clean" (mk_maker refresh_cb) + +let destroy_development_aux development clean_development = + let delete_development development = + let unlink = HExtlib.safe_remove in + let rmdir dir = + try + Unix.rmdir dir + with Unix.Unix_error _ -> + logger `Warning ("Unable to remove dir " ^ dir); + match ls_dir dir with + | None -> logger `Error ("Unable to list directory " ^ dir) + | Some [] -> () + | Some l -> logger `Error ("The directory is not empty") + in + unlink (makefile_for_development development); + unlink (pool () ^ development.name ^ rootfile); + unlink (pool () ^ development.name ^ "/depend"); + unlink (pool () ^ development.name ^ "/depend.errors"); + unlink (pool () ^ development.name ^ "/depend.dot"); + rmdir (pool () ^ development.name); + developments := + List.filter (fun d -> d.name <> development.name) !developments + in + if not(clean_development development) then + begin + logger `Warning "Unable to clean the development problerly."; + logger `Warning "This may cause garbage." + end; + delete_development development + +let destroy_development ?matita_flags development = + destroy_development_aux development (clean_development ?matita_flags) + +let destroy_development_in_bg ?matita_flags refresh development = + destroy_development_aux development + (clean_development_in_bg refresh ?matita_flags ) + +let root_for_development development = development.root +let name_for_development development = development.name + +let publish_development_bstract build clean devel = + let matita_flags, matita_flags_system = + let orig_matita_flags = + try Sys.getenv "MATITA_FLAGS" with Not_found -> "" + in + orig_matita_flags, orig_matita_flags ^ " -system" + in + HLog.message "cleaning the development before publishing"; + if clean ~matita_flags devel then + begin + HLog.message "rebuilding the development in 'system' space"; + (* here we should use pristine metadata if we use sqlite *) + if build ~matita_flags:matita_flags_system devel then + begin + HLog.message "publishing succeded"; + true + end + else + begin + HLog.error "building process failed, reverting"; + if not (clean ~matita_flags devel) then + HLog.error "cleaning failed, end of the world (2)"; + false + end + end + else + (HLog.error "unable to clean the development, publishing failed"; false) + +let publish_development devel = + publish_development_bstract + (fun ~matita_flags devel -> build_development ~matita_flags devel) + (fun ~matita_flags devel -> clean_development ~matita_flags devel) devel +let publish_development_in_bg cb devel = + publish_development_bstract + (fun ~matita_flags devel -> build_development_in_bg cb ~matita_flags devel) + (fun ~matita_flags devel -> clean_development_in_bg cb ~matita_flags devel) + devel + diff --git a/matita/matitamakeLib.mli b/matita/matitamakeLib.mli new file mode 100644 index 000000000..8f6fda2e4 --- /dev/null +++ b/matita/matitamakeLib.mli @@ -0,0 +1,62 @@ +(* Copyright (C) 2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +type development + +(* initialize_development [name] [dir] + * ask matitamake to recorder [dir] as the root for thedevelopment [name] *) +val initialize_development: string -> string -> development option +(* make target [default all] *) +val build_development: ?matita_flags:string -> ?target:string -> development -> bool +(* make target [default all], the refresh cb is called after every output *) +val build_development_in_bg: + ?matita_flags:string -> ?target:string -> (unit -> unit) -> development -> bool +(* make clean *) +val clean_development: ?matita_flags:string -> development -> bool +val clean_development_in_bg: ?matita_flags:string -> (unit -> unit) -> development -> bool + +val publish_development_in_bg: (unit -> unit) -> development -> bool +val publish_development: development -> bool + +(* return the development that handles dir *) +val development_for_dir: string -> development option +(* return the development *) +val development_for_name: string -> development option +(* return the known list of name, development_root *) +val list_known_developments: unit -> (string * string ) list +(* cleans the development, forgetting about it *) +val destroy_development: ?matita_flags:string -> development -> unit +val destroy_development_in_bg: ?matita_flags:string -> (unit -> unit) -> development -> unit +(* initiale internal data structures *) +val initialize : unit -> unit +(* gives back the root *) +val root_for_development : development -> string +(* gives back the name *) +val name_for_development : development -> string + +(** @return dot file for a given development, if it exists *) +val dot_for_development : development -> string option + +val normalize_path: string -> string diff --git a/matita/matitaprover.ml b/matita/matitaprover.ml new file mode 100644 index 000000000..7a6503ab3 --- /dev/null +++ b/matita/matitaprover.ml @@ -0,0 +1,136 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +let raw_preamble buri = " +inductive eq (A:Type) (x:A) : A \\to Prop \\def refl_eq : eq A x x. + +theorem sym_eq : \\forall A:Type.\\forall x,y:A. eq A x y \\to eq A y x. +intros.elim H. apply refl_eq. +qed. + +theorem eq_elim_r: + \\forall A:Type.\\forall x:A. \\forall P: A \\to Prop. + P x \\to \\forall y:A. eq A y x \\to P y. +intros. elim (sym_eq ? ? ? H1).assumption. +qed. + +theorem trans_eq : + \\forall A:Type.\\forall x,y,z:A. eq A x y \\to eq A y z \\to eq A x z. +intros.elim H1.assumption. +qed. + +default \"equality\" + " ^ buri ^ "/eq.ind + " ^ buri ^ "/sym_eq.con + " ^ buri ^ "/trans_eq.con + " ^ buri ^ "/eq_ind.con + " ^ buri ^ "/eq_elim_r.con + " ^ buri ^ "/eq_f.con + " ^ buri ^ "/eq_f1.con. + +theorem eq_f: \\forall A,B:Type.\\forall f:A\\to B. + \\forall x,y:A. eq A x y \\to eq B (f x) (f y). +intros.elim H.reflexivity. +qed. + +theorem eq_f1: \\forall A,B:Type.\\forall f:A\\to B. + \\forall x,y:A. eq A x y \\to eq B (f y) (f x). +intros.elim H.reflexivity. +qed. + +inductive ex (A:Type) (P:A \\to Prop) : Prop \\def + ex_intro: \\forall x:A. P x \\to ex A P. +interpretation \"exists\" 'exists \\eta.x = + (" ^ buri ^ "/ex.ind#xpointer(1/1) _ x). + +notation < \"hvbox(\\exists ident i opt (: ty) break . p)\" + right associative with precedence 20 +for @{ 'exists ${default + @{\\lambda ${ident i} : $ty. $p)} + @{\\lambda ${ident i} . $p}}}. + +" +;; + +let p_to_ma ?timeout ~tptppath ~filename () = + let data = + Tptp2grafite.tptp2grafite ?timeout ~filename ~tptppath:tptppath + ~raw_preamble () + in + data +;; + +let main () = + let tptppath = ref "./" in + let timeout = ref 600 in + MatitaInit.add_cmdline_spec + ["-tptppath",Arg.String (fun s -> tptppath:= s), + "Where to find the Axioms/ and Problems/ directory"; + "-timeout", Arg.Int (fun x -> timeout := x), + "Timeout in seconds"]; + MatitaInit.parse_cmdline_and_configuration_file (); + Helm_registry.set_bool "matita.nodisk" true; + HLog.set_log_callback (fun _ _ -> ()); + let args = Helm_registry.get_list Helm_registry.string "matita.args" in + let inputfile = + match args with + | [file] -> file + | _ -> prerr_endline "You must specify exactly one .p file."; exit 1 + in + let data = + p_to_ma ~timeout:!timeout ~filename:inputfile ~tptppath:!tptppath () + in +(* prerr_endline data; *) + let is = Ulexing.from_utf8_string data in + let gs = GrafiteSync.init () in + let ls = + CicNotation2.load_notation ~include_paths:[] + BuildTimeConf.core_notation_script + in + Sys.catch_break true; + try + let _ = + MatitaEngine.eval_from_stream + ~first_statement_only:false + ~include_paths:[] + ~clean_baseuri:true + ~do_heavy_checks:false + ~prompt:false + ls gs is + (fun _ _ -> ()) +(* + (fun _ s -> + let pp_ast_statement = + GrafiteAstPp.pp_statement ~term_pp:CicNotationPp.pp_term + ~lazy_term_pp:CicNotationPp.pp_term ~obj_pp:CicNotationPp.pp_obj + in + prerr_endline (pp_ast_statement s)) +*) + in + exit 0 + with exn -> + prerr_endline (snd (MatitaExcPp.to_string exn)); + exit 1 +;; diff --git a/matita/matitaprover.mli b/matita/matitaprover.mli new file mode 100644 index 000000000..e0b9cbf0b --- /dev/null +++ b/matita/matitaprover.mli @@ -0,0 +1,29 @@ +(* Copyright (C) 2006, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +val main: unit -> unit + +val p_to_ma: ?timeout:int -> tptppath:string -> filename:string -> unit -> string + diff --git a/matita/matitatop.ml b/matita/matitatop.ml new file mode 100644 index 000000000..0aba1e9b5 --- /dev/null +++ b/matita/matitatop.ml @@ -0,0 +1,31 @@ +(* Copyright (C) 2004-2005, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +(* $Id$ *) + +let _ = + let _ = Topdirs.dir_quit in + Toploop.loop Format.std_formatter; + assert false diff --git a/matita/rottener.ml b/matita/rottener.ml new file mode 100644 index 000000000..dfb64037e --- /dev/null +++ b/matita/rottener.ml @@ -0,0 +1,169 @@ +(* Copyright (C) 2007, HELM Team. + * + * This file is part of HELM, an Hypertextual, Electronic + * Library of Mathematics, developed at the Computer Science + * Department, University of Bologna, Italy. + * + * HELM is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HELM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HELM; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + * For details, see the HELM World-Wide-Web page, + * http://helm.cs.unibo.it/ + *) + +open Printf + +module Ast = GrafiteAst +module Pt = CicNotationPt + + (* set to false to change identifier instead of adding extra identifiers *) +let add_ident = ref true + +let error_token = "O" +let error_token_len = String.length error_token + +let has_toplevel_term = function + | GrafiteParser.LSome (Ast.Executable (_, Ast.Command (_, Ast.Obj (loc, ( + Pt.Theorem ((`Definition | `Lemma | `Theorem), _, _, _) + (*| Pt.Inductive _*) + (*| Pt.Record _*) + ))))) -> + true + | _ -> false + +let flush_token_stream (stream, loc_func) = + let tok_count = ref ~-1 in + let rec aux acc = + let next_tok = + try Some (Stream.next stream) with Stream.Failure -> None in + match next_tok with + | None | Some ("EOI", _) -> List.rev acc + | Some tok -> + incr tok_count; + aux ((tok, loc_func !tok_count) :: acc) in + aux [] + +let rotten_script ~fname statement = + (* XXX terribly inefficient: the same script is read several times ... *) + let lexer = CicNotationLexer.level2_ast_lexer in + let token_stream, loc_func = + lexer.Token.tok_func (Obj.magic (Ulexing.from_utf8_string statement)) in + let tokens = flush_token_stream (token_stream, loc_func) in + let target_token, target_pos = + let rec sanitize_tokens acc = function + | [] -> List.rev acc + | (("IDENT", + ("theorem" | "definition" | "lemma" | "record" | "inductive")), _) + :: (("IDENT", _), _) :: tl -> + (* avoid rottening of object names *) + sanitize_tokens acc tl + | (("SYMBOL", ("∀" | "λ" | "Π")), _) :: (("IDENT", _), _) :: tl -> + (* avoid rottening of binders *) + let rec remove_args = function + | (("SYMBOL", ","), _) :: (("IDENT", _), _) :: tl -> + remove_args tl + | tl -> tl in + sanitize_tokens acc (remove_args tl) + | (("SYMBOL", "⇒"), _) as hd :: tl -> + (* avoid rottening of constructor names in pattern matching *) + let rec remove_until_branch_start = function + | (("SYMBOL", ("|" | "[")), _) :: tl -> tl + | hd :: tl -> remove_until_branch_start tl + | [] -> [] in + sanitize_tokens (hd :: remove_until_branch_start acc) tl + | hd :: tl -> (* every other identfier can be rottened! *) + sanitize_tokens (hd :: acc) tl in + let idents = + List.filter (function (("IDENT", _), _) -> true | _ -> false) + (sanitize_tokens [] tokens) in + List.nth idents (Random.int (List.length idents)) + in + let start_pos, end_pos = (* positions in bytecount *) + Glib.Utf8.offset_to_pos statement 0 (Stdpp.first_pos target_pos), + Glib.Utf8.offset_to_pos statement 0 (Stdpp.last_pos target_pos) in + let statement' = + if !add_ident then + String.sub statement 0 start_pos + ^ "O " + ^ String.sub statement start_pos (String.length statement - start_pos) + else + String.sub statement 0 start_pos + ^ "O" + ^ String.sub statement end_pos (String.length statement - end_pos) + in + let script = HExtlib.input_file fname in + let matches = + let rex = + Pcre.regexp ~flags:[`DOTALL] + (sprintf "^(.*)(%s)(.*)$" (Pcre.quote statement)) in + try + Pcre.extract ~rex script + with Not_found -> assert false + in + let trailer = (* trailing comment with machine parseable error location *) + let preamble_len = Glib.Utf8.length matches.(1) in + sprintf "\n(*\nerror-at: %d-%d\n*)\n" + (preamble_len + Stdpp.first_pos target_pos) + (preamble_len + Stdpp.first_pos target_pos + error_token_len) in + let script' = + sprintf "%s%s%s%s" matches.(1) statement' matches.(3) trailer in + let md5 = Digest.to_hex (Digest.string script') in + HExtlib.output_file + ~filename:(sprintf "%s.%s.rottened" fname md5) + ~text:script' + +let grep () = + let recursive = ref false in + let spec = [ + "-r", Arg.Set recursive, "enable directory recursion"; + ] in + MatitaInit.add_cmdline_spec spec; + MatitaInit.initialize_all (); + let include_paths = + Helm_registry.get_list Helm_registry.string "matita.includes" in + let status = + CicNotation2.load_notation ~include_paths + BuildTimeConf.core_notation_script in + let path = + match Helm_registry.get_list Helm_registry.string "matita.args" with + | [ path ] -> path + | _ -> MatitaInit.die_usage () in + let grep_fun = + if !recursive then + (fun dirname -> + let sane_statements = + GrafiteWalker.rgrep_statement ~status ~dirname has_toplevel_term in + List.iter (fun (fname, statement) -> rotten_script ~fname statement) + sane_statements) + else + (fun fname -> + let sane_statements = + GrafiteWalker.grep_statement ~status ~fname has_toplevel_term in + List.iter (fun statement -> rotten_script ~fname statement) + sane_statements) + in + grep_fun path + +let handle_localized_exns f arg = + try + f arg + with HExtlib.Localized (loc, exn) -> + let loc_begin, loc_end = HExtlib.loc_of_floc loc in + eprintf "Error at %d-%d: %s\n%!" loc_begin loc_end (Printexc.to_string exn) + +let _ = + Random.self_init (); + handle_localized_exns grep () + diff --git a/matita/rottenize_lib b/matita/rottenize_lib new file mode 100755 index 000000000..da4667566 --- /dev/null +++ b/matita/rottenize_lib @@ -0,0 +1,4 @@ +#!/bin/bash +set -x +make clean-rottened +./rottener.opt -r library/ diff --git a/matita/scripts/README b/matita/scripts/README new file mode 100644 index 000000000..831fbbd90 --- /dev/null +++ b/matita/scripts/README @@ -0,0 +1,17 @@ +bench.sql + the SQL code to generate the bench table + +crontab + install this crontab (may need tweaking) to have cron run the whole + stuff for you + +crontab.sh + the script crontab should run (includes a "pretty" report) + +do_tests.sh + script used by ../Makefile to run matitac[.opt] on some tests. supports some + options and prints out some informations neded my insert + +profile_svn.sh + SVN co, compilation, run + diff --git a/matita/scripts/bench.sql b/matita/scripts/bench.sql new file mode 100644 index 000000000..2a49a2d01 --- /dev/null +++ b/matita/scripts/bench.sql @@ -0,0 +1,13 @@ +DROP TABLE bench; + +CREATE TABLE bench ( + mark VARCHAR(30) NOT NULL, + time BIGINT NOT NULL, + timeuser BIGINT NOT NULL, + compilation ENUM('byte','opt') NOT NULL, + test VARCHAR(100) NOT NULL, + result ENUM('ok','fail') NOT NULL, + options SET('gc-off','gc-on') +); + +DESCRIBE bench; diff --git a/matita/scripts/clean_db.sh b/matita/scripts/clean_db.sh new file mode 100755 index 000000000..0d0767573 --- /dev/null +++ b/matita/scripts/clean_db.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +TBL=`echo show tables | mysql matita -u helm | grep -v _` +for X in $TBL; do + echo cleaning $X + echo "delete from $X where source like 'cic:/matita/%'" | mysql matita -u helm +done diff --git a/matita/scripts/crontab b/matita/scripts/crontab new file mode 100644 index 000000000..c44a1e4ae --- /dev/null +++ b/matita/scripts/crontab @@ -0,0 +1,4 @@ +MAILTO=helm@mowgli.cs.unibo.it +HOME=/home/sacerdot/ +#SVNOPTIONS='-r {2006-01-09}' +00 02 * * * sh /home/sacerdot/miohelm/matita/scripts/crontab.sh diff --git a/matita/scripts/crontab.sh b/matita/scripts/crontab.sh new file mode 100644 index 000000000..06cb81654 --- /dev/null +++ b/matita/scripts/crontab.sh @@ -0,0 +1,117 @@ +#!/bin/bash +#set -x + +#configuration +TODAY=`date +%Y%m%d` +YESTERDAY=`date -d yesterday +%Y%m%d` +TMPDIRNAME=$HOME/__${TODAY}_crontab +TMPDIRNAMEOLD=$HOME/__${YESTERDAY}_crontab +SVNROOT="svn+ssh://mowgli.cs.unibo.it/local/svn/helm/trunk/" +SHELLTIME2CENTSPHP=scripts/shell_time2cents.php +SHELLADDERPHP=scripts/shell_adder.php +COMMONPHP=scripts/public_html/common.php +MYSQL="mysql -u helm -h mowgli.cs.unibo.it matita" +SQLQMARK="select distinct mark from bench where mark like '%s%%' order by mark;" +SQLQTIME="select SUM(timeuser) from bench where mark = '%s' group by mark;" +SQLQFAILCOUNT="select count(distinct test) from bench where mark = '%s' and result = 'fail';" +SQLQFAIL="select distinct test from bench where mark = '%s' and result = 'fail';" +URL="http://mowgli.cs.unibo.it/~sacerdot/bench.php" + +#initialization +OLD=$PWD +mkdir -p $TMPDIRNAME +rm -rf $TMPDIRNAMEOLD +cd $TMPDIRNAME +rm -rf helm +svn co ${SVNROOT}helm/software/matita/scripts/ > LOG.svn 2>&1 + +#run tests +scripts/profile_svn.sh 2> LOG + +MARK=`printf "$SQLQMARK" "$TODAY" | $MYSQL | tail -n 1` +LASTMARK=`printf "$SQLQMARK" "$YESTERDAY" | $MYSQL | tail -n 1` + +if [ -z "$MARK" ]; then + echo "No benchmark records for $TODAY" + exit 1 +fi + +if [ -z "$LASTMARK" ]; then + echo "No benchmark records for $YESTERDAY" + exit 1 +fi + +#check for slowdown +CUR_TIME=`printf "$SQLQTIME" "$MARK" | $MYSQL | tail -n 1` +OLD_TIME=`printf "$SQLQTIME" "$LASTMARK" | $MYSQL | tail -n 1` + +if [ -z "$CUR_TIME" -o -z "$OLD_TIME" ]; then + cat < $TMP1 + printf "$SQLQFAIL" "$LASTMARK" | $MYSQL > $TMP2 + combine $TMP1 not $TMP2 > $TMP3 + + cat </dev/null + ./configure 1>/dev/null + make all opt 1>/dev/null + cd $LOCALOLD +} + +function run_tests { + LOCALOLD=$PWD + cd $1 + ./matitaclean all + #export OCAMLRUNPARAM='o=100000' + #testit "gc-off" + export OCAMLRUNPARAM='' + testit "gc-on" + cd $LOCALOLD +} + +#initialization +OLD=$PWD +rm -rf $TMPDIRNAME +mkdir $TMPDIRNAME +mkdir $TMPDIRNAME.HOME +cd $TMPDIRNAME + +#svn checkout +svn co -N $SVNROOT > $SVNLOG 2>&1 +cd trunk +svn update -N helm >> $SVNLOG 2>&1 +cd helm +svn update -N software >> $SVNLOG 2>&1 +cd software +svn update $SVNOPTIONS components >> $SVNLOG 2>&1 +svn update $SVNOPTIONS matita >> $SVNLOG 2>&1 +cd .. +cd .. +cd .. +ln -s trunk/helm . + +#compile +export HOME="`pwd`/../$TMPDIRNAME.HOME" +export USER="bench" +compile $PWD/helm/software/ + +#run +run_tests $PWD/helm/software/matita > LOG 2>LOG.run_tests.err + +#insert the db +cat LOG | grep "\(OK\|FAIL\)" | grep "\(gc-on\|gc-off\)" | grep -v "bad_tests" | grep -v "interactive" |\ + lua5.1 $PWD/helm/software/matita/scripts/functions.lua log2sql - > INSERT.sql +cat INSERT.sql | $MYSQL + +#save the revision +SVNREVISION=`svn info $PWD/helm/software/ | grep "^Revision:" | cut -d : -f 2` +echo "INSERT INTO bench_svn VALUES ('$MARK','$SVNREVISION')" | $MYSQL +cd $OLD +#rm -rf $TMPDIRNAME + +#eof diff --git a/matita/scripts/public_html/bench.php b/matita/scripts/public_html/bench.php new file mode 100644 index 000000000..1009ace52 --- /dev/null +++ b/matita/scripts/public_html/bench.php @@ -0,0 +1,430 @@ + $v) { + $last_mark = $v; + } +} +query($query_last_mark,"set_last_mark"); + +$query_last_svn_mark = "select revision from bench_svn where mark='$last_mark';"; +$last_svn_mark = ""; +function set_last_svn_mark($a) { + global $last_svn_mark; + foreach ($a as $k => $v) { + $last_svn_mark = trim($v); + } +} +query($query_last_svn_mark,"set_last_svn_mark"); + +$query_before_last_mark = "select mark from bench where mark <> '$last_mark' order by mark desc limit 1;"; +$before_last_mark = ""; +function set_before_last_mark($a) { + global $before_last_mark; + foreach ($a as $k => $v) { + $before_last_mark = $v; + } +} +query($query_before_last_mark,"set_before_last_mark"); + +$query_before_last_svn_mark = "select revision from bench_svn where mark='$before_last_mark';"; +$before_last_svn_mark = ""; +function set_before_last_svn_mark($a) { + global $before_last_svn_mark; + foreach ($a as $k => $v) { + $before_last_svn_mark = trim($v); + } +} +query($query_before_last_svn_mark,"set_before_last_svn_mark"); + + +$quey_all = urlencode(" +Whole content: +@@@ +select * from bench order by mark desc***"); + +$query_time_diff = urlencode(" +Time diff: +@@@ +select + b1.test as test, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts, + (b2.timeuser - b1.timeuser) as diff +from + bench as b1, bench as b2 +where + b1.test = b2.test and + b1.options = b2.options and + b1.compilation = b2.compilation and + b1.result = b2.result and + b1.mark = '$before_last_mark' and b2.mark= '$last_mark' and + ABS(b2.timeuser - b1.timeuser) > 100 +order by diff desc***"); + +$query_result_diff = urlencode(" +Result diff: +@@@ +select + b1.test as test, b1.result as oldresult, b2.result as newresult, b1.timeuser as oldtime, b2.timeuser as newtime, b1.compilation as comp, b1.options as opts, + (b2.timeuser - b1.timeuser) as diff +from + bench as b1, bench as b2 +where + b1.test = b2.test and + b1.options = b2.options and + b1.compilation = b2.compilation and + b1.result <> b2.result and + b1.mark = '$before_last_mark' and b2.mark= '$last_mark' +order by test desc***"); + +$query_fail = urlencode(" +Number of failures +@@@ +select + mark, count(distinct test) as fail_no +from bench +where result = 'fail' group by mark order by mark desc*** +### +Tests failed +@@@ +select distinct mark, test, result +from bench +where result = 'fail' order by mark desc***"); + +$query_gc = urlencode(" +GC usage +@@@ +select + bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead +from bench, bench as bench1 +where + bench.mark = bench1.mark and + bench.test = bench1.test and + bench.options = 'gc-on' and + bench1.options = 'gc-off' and + bench.compilation = bench1.compilation +group by mark*** +### +GC usage (opt) +@@@ +select + bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead +from bench, bench as bench1 +where + bench.mark = bench1.mark and + bench.test = bench1.test and + bench.options = 'gc-on' and + bench1.options = 'gc-off' and + bench.compilation = bench1.compilation and + bench.compilation = 'opt' +group by mark*** +### +GC usage (byte) +@@@ +select + bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead +from bench, bench as bench1 +where + bench.mark = bench1.mark and + bench.test = bench1.test and + bench.options = 'gc-on' and + bench1.options = 'gc-off' and + bench.compilation = bench1.compilation and + bench.compilation = 'byte' +group by mark***"); + +$query_auto = urlencode(" +Auto (with GC) +@@@ +select + mark, SUM(bench.time) as time +from + bench +where + test='auto.ma' and options = 'gc-on' +group by mark +order by mark desc*** +### +Auto (without GC) +@@@ +select + mark, SUM(bench.time) as time +from + bench +where + test='auto.ma' and options = 'gc-off' +group by mark +order by mark desc +*** +### +GC overhead +@@@ +select + bench.mark, SUM(bench.time) - SUM(bench1.time) as gc_hoverhead +from + bench, bench as bench1 +where + bench.mark = bench1.mark and + bench.test = bench1.test and + bench.options = 'gc-on' and + bench1.options = 'gc-off' and + bench.compilation = bench1.compilation and + bench.test = 'auto.ma' +group by mark +***"); + +$query_csc = urlencode(" +Performances (byte and GC) per mark +@@@ +select + bench_times.mark as mark, + bench_svn.revision, + bench_times.time as time, + bench_times.timeuser as timeuser, + bench_times_opt.time as time_opt, + bench_times_opt.timeuser as timeuser_opt, + bench_times.tests as tests, + bench_times_opt.tests as tests_opt, + bench_fails.count as fail, + bench_fails_opt.count as fail_opt +from + bench_svn, + (select + b1.mark as mark, SUM(b1.time) as time, + SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests + from bench as b1 + where + b1.options = 'gc-on' and + b1.compilation = 'opt' + group by b1.mark) as bench_times_opt, + (select + b1.mark as mark, SUM(b1.time) as time, + SUM(b1.timeuser) as timeuser,COUNT(DISTINCT b1.test) as tests + from bench as b1 + where + b1.options = 'gc-on' and + b1.compilation = 'byte' + group by b1.mark) as bench_times, + (select + b1.mark as mark, + SUM(if(b1.result='fail' and b1.compilation='byte' and b1.options='gc-on',1,0)) + as count + from bench as b1 + group by b1.mark) as bench_fails, + (select + b1.mark as mark, + SUM(if(b1.result='fail' and b1.compilation='opt' and b1.options='gc-on',1,0)) + as count + from bench as b1 + group by b1.mark) as bench_fails_opt +where + bench_times.mark = bench_fails.mark and + bench_times_opt.mark = bench_fails_opt.mark and + bench_times.mark = bench_times_opt.mark and + bench_svn.mark = bench_times.mark + order by bench_svn.mark desc +***"); + +$query_total = urlencode(" +Max N +@@@ +select + COUNT(DISTINCT test) as MAX +from + bench +group by mark +order by MAX desc +LIMIT 0,1; +### +Number of compiled tests +@@@ +select + mark, + COUNT(DISTINCT test) as N +from + bench +group by mark +order by mark desc +***"); + +function minus1_to_all($s){ + if ($s == "-1") + return "all"; + else + return $s; +} + +function links_of($name,$q,$limits){ + echo "
  • $name :   "; + if (strpos($q, urlencode("***")) === false) { + echo "all"; + } else { + foreach($limits as $l) { + $q1 = str_replace(urlencode("***"), " LIMIT 0,$l", $q); + echo "" . + minus1_to_all($l) . "  "; + } + $q1 = str_replace(urlencode("***"), " ", $q); + echo "" . + minus1_to_all("-1") . "  "; + } + echo "
  • "; +} + +function last_commits() { + global $last_svn_mark; + global $before_last_svn_mark; + $query = "svn log -r$last_svn_mark:$before_last_svn_mark -v svn://mowgli.cs.unibo.it/trunk/helm/software"; + echo $query; + exec($query,$res); + echo "
    ";
    + foreach ($res as $k => $v) { echo "$v\n"; }
    + echo "
    "; +} + +?> + + + + + + +

    QUERY the benchmark system

    +

    Last Commits

    + +

    Common Queries

    +

    +

      + + + + + + + + +
    +

    +

    Custom Query - Simple Interface

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Marks: + +
    Compilations: + +
    Options: + +
    Tests: + +
    Test results: + +
    Group By: + +
    Limit: + +
    +
    +

    Custom Query - raw SQL

    +
    + + + + + + + + + + + + + + + + + +
    'bench' table description:
    'bench_svn' table description:
    +SQL (only one query, ';' if present must terminate the query, no characters allowed after it):
    + +
    +
    +
    + + + diff --git a/matita/scripts/public_html/common.php b/matita/scripts/public_html/common.php new file mode 100644 index 000000000..d56c9d40b --- /dev/null +++ b/matita/scripts/public_html/common.php @@ -0,0 +1,80 @@ + $v){ + echo ""; + } +} + +function prettify($s,$name) { + if (preg_match("/^[0-9]{12}$/",$s)) { + $year = substr($s,0,4); + $month = substr($s,4,2); + $day = substr($s,6,2); + $hour = substr($s,8,2); + $minute = substr($s,10,2); + return $day . "/" . $month . "/" . $year . " " . $hour . ":" . $minute; + } else if (preg_match("/time/",$name)){ + $min = floor($s / 6000); + $sec = floor(($s - $min * 6000) / 100); + $cents = $s % 100; + return $min . "m" . $sec . "." . $cents . "s"; + } else + return rtrim($s); +} + + +function printer($q){ + global $i; + echo ""; + if ( $i == 0) { + foreach( $q as $name => $txt) { + echo "$name"; + } + } + echo "\n"; + if ( $i%2 == 0) + echo ""; + else + echo ""; + foreach( $q as $name => $txt) { + echo "" . prettify($txt,$name) . ""; + } + echo "\n"; + $i++; +} + + +function query($q,$f) { + $db = mysql_pconnect("localhost","helm"); + mysql_select_db("matita"); + $q = ltrim(rtrim(preg_replace("/\n/"," ",$q))); + if (!preg_match("/^(select|describe)[^\n;]*;?$/i",$q)) { + die("Query not allowed!
    " . $q . "
    "); + return; + } + $rc = mysql_query($q,$db); + if(!$rc) { + die("Query failed: " . mysql_error()); + } + while( $row = mysql_fetch_array($rc, MYSQL_ASSOC)){ + $f($row); + } + mysql_free_result($rc); + mysql_close($db); +} + +function time_2_cents($t) { + $matches = array(); + $rex = "/^(\d+)m(\d\d?)\.(\d{2})s$/"; + $m = preg_match($rex,$t,$matches); + if ( $m == 0 ) exit(1); + $t_minutes = $matches[1]; + $t_secs = $matches[2]; + $t_cents = $matches[3]; + return ((int) $t_cents) + ((int) $t_secs) * 100 + ((int)$t_minutes) * 6000 ; +} + +?> diff --git a/matita/scripts/public_html/composequery.php b/matita/scripts/public_html/composequery.php new file mode 100644 index 000000000..1c7366dea --- /dev/null +++ b/matita/scripts/public_html/composequery.php @@ -0,0 +1,46 @@ + $x) { + $v = $_GET[$x]; + if($v != "--") { + if($fst == false) { + $rc = $rc . " and "; + } else { + $rc = $rc . " "; + } + $fst = false; + $rc = $rc . $x . " = '" . $v . "'"; + } + } + return $rc; + } + + $gb = $_GET['groupby']; + $limit = $_GET['limit']; + if($gb != "--") + $what = "mark, SUM(time) as sum_time, SUM(timeuser) as sum_timeuser"; + else + $what = "mark, time, timeuser, compilation, test, result, options"; + $clause = clause_for($c); + if($clause != "") + $query = "select $what from bench where " . clause_for($c); + else + $query = "select $what from bench "; + if( $gb != "--"){ + $query = $query. "group by $gb"; + } + + if($limit != "--") { + $query = $query. " LIMIT 0,$limit"; + } + + $query = $query. ";"; + + header("Location: showquery.php?query=".urlencode("Custom:@@@" . $query)); + exit; +?> diff --git a/matita/scripts/public_html/index.html b/matita/scripts/public_html/index.html new file mode 100644 index 000000000..12fd7be9f --- /dev/null +++ b/matita/scripts/public_html/index.html @@ -0,0 +1,15 @@ + + + + + + + +

    MATITA BENCHMARKING SYSTEM

    +

    +

    + Go to the benchmark query page +
    +

    + + diff --git a/matita/scripts/public_html/showquery.php b/matita/scripts/public_html/showquery.php new file mode 100644 index 000000000..dfa0b4730 --- /dev/null +++ b/matita/scripts/public_html/showquery.php @@ -0,0 +1,35 @@ + + + + + + +

    QUERY results

    + $q) { $i=0;?> +

    +

    + +

    + + +
    + +

    BACK to the query page

    + + diff --git a/matita/scripts/public_html/style.css b/matita/scripts/public_html/style.css new file mode 100644 index 000000000..dc2df470d --- /dev/null +++ b/matita/scripts/public_html/style.css @@ -0,0 +1,55 @@ +body { + font-family: sans-serif; + font-size: 12pt; +} + +h1 { + text-align: center; + background-color: #87CEFA; +} + +h2 { + margin-right: auto; + border-bottom-color: #87CEFA; + border-bottom-style: solid; + border-bottom-width: 2px; +} + +a, .button { + border: 1px outset; + text-decoration: none; + background-color: #e9e9e9; + color: black; + cursor:pointer; + font-size: small; + padding-left:4px; + padding-right:4px; +} + +li { + margin-bottom: 10pt; +} + +ul { + list-style-type: upper-roman; +} + +table, td { + border-style:none; + padding: 2px 6px 2px 6px; +} + +tr.odd { + background-color:#EEEEEE; +} +tr.even { + background-color:#CECECE; +} + +th { + border-style:solid; + border-width:0px 0px 1px 0px; + border-color: gray; +} + + diff --git a/matita/template_makefile.in b/matita/template_makefile.in new file mode 100644 index 000000000..ac3e14498 --- /dev/null +++ b/matita/template_makefile.in @@ -0,0 +1,36 @@ +SRC=$(shell find @ROOT@ -name "*.ma" -a -type f) +SHORTSRC=$(echo $(SRC) | sed 's?^@ROOT@/??g') +TODO=$(SRC:%.ma=%.mo) + +MATITA_FLAGS= +MATITA_FLAGS+=-noprofile +NODB=false +ifeq ($(NODB),true) + MATITA_FLAGS += -nodb +endif + +MATITAC=@CC@ +MATITACLEAN=@CLEAN@ +MATITADEP=@DEP@ + +all: $(TODO) + +clean: + $(MATITACLEAN) $(MATITA_FLAGS) $(SRC) + rm -f $(TODO) @DEPFILE@ + +%.moo: + if [ -z "$<" ]; then \ + echo "missing dependencies for $@"; \ + else \ + $(MATITAC) $(MATITA_FLAGS) -q -I @ROOT@ $<; \ + fi + +@DEPFILE@ : $(SRC) + $(MATITADEP) $(MATITA_FLAGS) -I '@ROOT@' -dot @DEPFILE@.dot $^ \ + 1> @DEPFILE@ 2>@DEPFILE@.errors \ + || (echo;cat @DEPFILE@.errors;echo;rm @DEPFILE@;false) + +# this is the depend for full targets like: +# dir/dir/name.moo: dir/dir/name.ma dir/dep.moo +include @DEPFILE@ diff --git a/matita/template_makefile_devel.in b/matita/template_makefile_devel.in new file mode 100644 index 000000000..98b7c1f20 --- /dev/null +++ b/matita/template_makefile_devel.in @@ -0,0 +1,39 @@ +H=@ + +RT_BASEDIR=$(shell if [ -x "@MATITA_RT_BASE_DIR@/matitamake" -o -x "@MATITA_RT_BASE_DIR@/matitamake.opt" ]; then echo "@MATITA_RT_BASE_DIR@"; else echo ""; fi) +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX="SRC=$(SRC)" +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall.opt + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + +preall.opt: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) init $(devel) diff --git a/matita/tests/TPTP/README b/matita/tests/TPTP/README new file mode 100644 index 000000000..e5d4b04b1 --- /dev/null +++ b/matita/tests/TPTP/README @@ -0,0 +1,42 @@ +to generate the problems: + + cd ../../../components/binaries/tptp2grafite/ + make generate + cd ../../../matita/tests/TPTP + ./classify.sh + +to start a run: + + be sure to have matitac.opt in ../../ + ./try | tee logname + +if you have a file containing the list of files to execute, like + + ... + Unsatisfiable/BOO001-1.ma + Unsatisfiable/BOO002-1.ma + Unsatisfiable/BOO004-2.ma + Unsatisfiable/LCL113-2.ma + ... + + you can run + + ./try filewithproblemlist | tee logname + +logname format + + log.SECONDS.DAY-MONTH.MESSAGE + +other scripts + + simulate_casc.sh logfile + + Gives the results of the problems listed in elenco_CASC.txt + + merge_sorted_logs.awk + + Given a file composed by the sorted concatenation of 2 logs + returns the one obtaining using the best of duplicate lines + (use to merge a log with a successive run on the FAIL problems) + +# eof diff --git a/matita/tests/TPTP/Veloci/BOO001-1.p.ma b/matita/tests/TPTP/Veloci/BOO001-1.p.ma new file mode 100644 index 000000000..87ee6a7c5 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO001-1.p.ma @@ -0,0 +1,66 @@ +set "baseuri" "cic:/matita/TPTP/BOO001-1". +include "logic/equality.ma". +(* Inclusion of: BOO001-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO001-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra (Ternary) *) +(* Problem : In B3 algebra, inverse is an involution *) +(* Version : [OTTER] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [OTTER] *) +(* Names : tba_gg.in [OTTER] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of atoms : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-3 arity) *) +(* Number of variables : 13 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include ternary Boolean algebra axioms *) +(* Inclusion of: Axioms/BOO001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Algebra (Ternary Boolean) *) +(* Axioms : Ternary Boolean algebra (equality) axioms *) +(* Version : [OTTER] (equality) axioms. *) +(* English : *) +(* Refs : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* : [Win82] Winker (1982), Generation and Verification of Finite M *) +(* Source : [OTTER] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 0 RR) *) +(* Number of literals : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 1-3 arity) *) +(* Number of variables : 13 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : These axioms appear in [Win82], in which ternary_multiply_1 is *) +(* shown to be independant. *) +(* : These axioms are also used in [Wos88], p.222. *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_inverse_is_self_cancelling: + \forall Univ:Set. +\forall a:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y (inverse Y)) X. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (inverse Y) Y X) X. +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X X Y) X. +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (multiply Y X X) X. +\forall H4:\forall V:Univ.\forall W:Univ.\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply V W X) Y (multiply V W Z)) (multiply V W (multiply X Y Z)).eq Univ (inverse (inverse a)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO003-2.p.ma b/matita/tests/TPTP/Veloci/BOO003-2.p.ma new file mode 100644 index 000000000..a964a96ad --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO003-2.p.ma @@ -0,0 +1,75 @@ +set "baseuri" "cic:/matita/TPTP/BOO003-2". +include "logic/equality.ma". +(* Inclusion of: BOO003-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Multiplication is idempotent (X * X = X) *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : prob2_part1.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 1 RR) *) +(* Number of atoms : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_a_times_a_is_a: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H1:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H2:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H3:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H4:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H5:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H6:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H7:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (multiply a a) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO003-4.p.ma b/matita/tests/TPTP/Veloci/BOO003-4.p.ma new file mode 100644 index 000000000..efeca0198 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO003-4.p.ma @@ -0,0 +1,69 @@ +set "baseuri" "cic:/matita/TPTP/BOO003-4". +include "logic/equality.ma". +(* Inclusion of: BOO003-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-4 : TPTP v3.1.1. Released v1.1.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Multiplication is idempotent (X * X = X) *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TA [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 9 ( 0 non-Horn; 9 unit; 1 RR) *) +(* Number of atoms : 9 ( 9 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_a_times_a_is_a: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H1:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H3:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (multiply a a) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO004-2.p.ma b/matita/tests/TPTP/Veloci/BOO004-2.p.ma new file mode 100644 index 000000000..ff3cd85f9 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO004-2.p.ma @@ -0,0 +1,75 @@ +set "baseuri" "cic:/matita/TPTP/BOO004-2". +include "logic/equality.ma". +(* Inclusion of: BOO004-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Addition is idempotent (X + X = X) *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : prob2_part2.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 1 RR) *) +(* Number of atoms : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_a_plus_a_is_a: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H1:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H2:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H3:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H4:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H5:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H6:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H7:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (add a a) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO004-4.p.ma b/matita/tests/TPTP/Veloci/BOO004-4.p.ma new file mode 100644 index 000000000..1821077fe --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO004-4.p.ma @@ -0,0 +1,69 @@ +set "baseuri" "cic:/matita/TPTP/BOO004-4". +include "logic/equality.ma". +(* Inclusion of: BOO004-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-4 : TPTP v3.1.1. Released v1.1.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Addition is idempotent (X + X = X) *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TA [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 9 ( 0 non-Horn; 9 unit; 1 RR) *) +(* Number of atoms : 9 ( 9 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_a_plus_a_is_a: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H1:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H3:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (add a a) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO005-2.p.ma b/matita/tests/TPTP/Veloci/BOO005-2.p.ma new file mode 100644 index 000000000..5e3def47c --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO005-2.p.ma @@ -0,0 +1,76 @@ +set "baseuri" "cic:/matita/TPTP/BOO005-2". +include "logic/equality.ma". +(* Inclusion of: BOO005-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO005-2 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Boolean Algebra *) +(* Problem : Addition is bounded (X + 1 = 1) *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : prob3_part1.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 1 RR) *) +(* Number of atoms : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* Bugfixes : v1.2.1 - Clause prove_a_plus_1_is_a fixed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_a_plus_1_is_a: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H1:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H2:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H3:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H4:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H5:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H6:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H7:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (add a multiplicative_identity) multiplicative_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO005-4.p.ma b/matita/tests/TPTP/Veloci/BOO005-4.p.ma new file mode 100644 index 000000000..9bd9ce8a9 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO005-4.p.ma @@ -0,0 +1,70 @@ +set "baseuri" "cic:/matita/TPTP/BOO005-4". +include "logic/equality.ma". +(* Inclusion of: BOO005-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO005-4 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Boolean Algebra *) +(* Problem : Addition is bounded (X + 1 = 1) *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TB [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 9 ( 0 non-Horn; 9 unit; 1 RR) *) +(* Number of atoms : 9 ( 9 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* Bugfixes : v1.2.1 - Clause prove_a_plus_1_is_a fixed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_a_plus_1_is_a: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H1:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H3:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (add a multiplicative_identity) multiplicative_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO006-2.p.ma b/matita/tests/TPTP/Veloci/BOO006-2.p.ma new file mode 100644 index 000000000..77ea2d76b --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO006-2.p.ma @@ -0,0 +1,75 @@ +set "baseuri" "cic:/matita/TPTP/BOO006-2". +include "logic/equality.ma". +(* Inclusion of: BOO006-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO006-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Multiplication is bounded (X * 0 = 0) *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : prob3_part2.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 1 RR) *) +(* Number of atoms : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_right_identity: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H1:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H2:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H3:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H4:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H5:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H6:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H7:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (multiply a additive_identity) additive_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO006-4.p.ma b/matita/tests/TPTP/Veloci/BOO006-4.p.ma new file mode 100644 index 000000000..c05bd84fc --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO006-4.p.ma @@ -0,0 +1,69 @@ +set "baseuri" "cic:/matita/TPTP/BOO006-4". +include "logic/equality.ma". +(* Inclusion of: BOO006-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO006-4 : TPTP v3.1.1. Released v1.1.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Multiplication is bounded (X * 0 = 0) *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TB [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 9 ( 0 non-Horn; 9 unit; 1 RR) *) +(* Number of atoms : 9 ( 9 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_right_identity: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H1:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H3:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (multiply a additive_identity) additive_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO009-2.p.ma b/matita/tests/TPTP/Veloci/BOO009-2.p.ma new file mode 100644 index 000000000..ce93dc23b --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO009-2.p.ma @@ -0,0 +1,76 @@ +set "baseuri" "cic:/matita/TPTP/BOO009-2". +include "logic/equality.ma". +(* Inclusion of: BOO009-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO009-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Multiplication absorption (X * (X + Y) = X) *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : prob4_part1.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.50 v2.0.0 *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 1 RR) *) +(* Number of atoms : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_operation: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H1:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H2:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H3:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H4:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H5:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H6:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H7:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (multiply a (add a b)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO009-4.p.ma b/matita/tests/TPTP/Veloci/BOO009-4.p.ma new file mode 100644 index 000000000..67631beb7 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO009-4.p.ma @@ -0,0 +1,70 @@ +set "baseuri" "cic:/matita/TPTP/BOO009-4". +include "logic/equality.ma". +(* Inclusion of: BOO009-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO009-4 : TPTP v3.1.1. Released v1.1.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Multiplication absorption (X * (X + Y) = X) *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TC [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 9 ( 0 non-Horn; 9 unit; 1 RR) *) +(* Number of atoms : 9 ( 9 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_operation: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H1:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H3:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (multiply a (add a b)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO010-2.p.ma b/matita/tests/TPTP/Veloci/BOO010-2.p.ma new file mode 100644 index 000000000..9517fa3ed --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO010-2.p.ma @@ -0,0 +1,76 @@ +set "baseuri" "cic:/matita/TPTP/BOO010-2". +include "logic/equality.ma". +(* Inclusion of: BOO010-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO010-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Addition absorbtion (X + (X * Y) = X) *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : prob4_part2.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 1 RR) *) +(* Number of atoms : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_a_plus_ab_is_a: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H1:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H2:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H3:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H4:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H5:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H6:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H7:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (add a (multiply a b)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO010-4.p.ma b/matita/tests/TPTP/Veloci/BOO010-4.p.ma new file mode 100644 index 000000000..6cd030d5a --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO010-4.p.ma @@ -0,0 +1,70 @@ +set "baseuri" "cic:/matita/TPTP/BOO010-4". +include "logic/equality.ma". +(* Inclusion of: BOO010-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO010-4 : TPTP v3.1.1. Released v1.1.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Addition absorbtion (X + (X * Y) = X) *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TC [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0, 0.09 v2.6.0, 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 9 ( 0 non-Horn; 9 unit; 1 RR) *) +(* Number of atoms : 9 ( 9 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_a_plus_ab_is_a: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H1:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H3:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (add a (multiply a b)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO011-2.p.ma b/matita/tests/TPTP/Veloci/BOO011-2.p.ma new file mode 100644 index 000000000..33f8f9a87 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO011-2.p.ma @@ -0,0 +1,76 @@ +set "baseuri" "cic:/matita/TPTP/BOO011-2". +include "logic/equality.ma". +(* Inclusion of: BOO011-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO011-2 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Boolean Algebra *) +(* Problem : Inverse of additive identity = Multiplicative identity *) +(* Version : [ANL] (equality) axioms. *) +(* English : The inverse of the additive identity is the multiplicative *) +(* identity. *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : prob7.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 1 RR) *) +(* Number of atoms : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* Bugfixes : v1.2.1 - Clause prove_inverse_of_1_is_0 fixed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_inverse_of_1_is_0: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H1:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H2:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H3:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H4:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H5:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H6:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H7:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (inverse additive_identity) multiplicative_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO011-4.p.ma b/matita/tests/TPTP/Veloci/BOO011-4.p.ma new file mode 100644 index 000000000..5855e8aee --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO011-4.p.ma @@ -0,0 +1,69 @@ +set "baseuri" "cic:/matita/TPTP/BOO011-4". +include "logic/equality.ma". +(* Inclusion of: BOO011-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO011-4 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Boolean Algebra *) +(* Problem : Inverse of additive identity = Multiplicative identity *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TG [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 9 ( 0 non-Horn; 9 unit; 1 RR) *) +(* Number of atoms : 9 ( 9 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* Bugfixes : v1.2.1 - Clause prove_inverse_of_1_is_0 fixed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_inverse_of_1_is_0: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H1:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H3:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (inverse additive_identity) multiplicative_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO012-2.p.ma b/matita/tests/TPTP/Veloci/BOO012-2.p.ma new file mode 100644 index 000000000..3572d8750 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO012-2.p.ma @@ -0,0 +1,75 @@ +set "baseuri" "cic:/matita/TPTP/BOO012-2". +include "logic/equality.ma". +(* Inclusion of: BOO012-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO012-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Inverse is an involution *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : prob8.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 1 RR) *) +(* Number of atoms : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_inverse_is_an_involution: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall x:Univ. +\forall H0:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H1:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H2:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H3:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H4:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H5:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H6:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H7:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (inverse (inverse x)) x +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO012-4.p.ma b/matita/tests/TPTP/Veloci/BOO012-4.p.ma new file mode 100644 index 000000000..fb67030b9 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO012-4.p.ma @@ -0,0 +1,69 @@ +set "baseuri" "cic:/matita/TPTP/BOO012-4". +include "logic/equality.ma". +(* Inclusion of: BOO012-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO012-4 : TPTP v3.1.1. Released v1.1.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Inverse is an involution *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TF [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 9 ( 0 non-Horn; 9 unit; 1 RR) *) +(* Number of atoms : 9 ( 9 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_inverse_is_an_involution: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall x:Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H1:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H3:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (inverse (inverse x)) x +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO013-2.p.ma b/matita/tests/TPTP/Veloci/BOO013-2.p.ma new file mode 100644 index 000000000..0f538a7da --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO013-2.p.ma @@ -0,0 +1,83 @@ +set "baseuri" "cic:/matita/TPTP/BOO013-2". +include "logic/equality.ma". +(* Inclusion of: BOO013-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO013-2 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Boolean Algebra *) +(* Problem : The inverse of X is unique *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : prob9.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 19 ( 0 non-Horn; 19 unit; 5 RR) *) +(* Number of atoms : 19 ( 19 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 5 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* Bugfixes : v1.2.1 - Clauses b_and_multiplicative_identity and *) +(* c_and_multiplicative_identity fixed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_b_is_a: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall b:Univ. +\forall c:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (multiply a c) additive_identity. +\forall H1:eq Univ (multiply a b) additive_identity. +\forall H2:eq Univ (add a c) multiplicative_identity. +\forall H3:eq Univ (add a b) multiplicative_identity. +\forall H4:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H5:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H6:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H7:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H8:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H9:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H10:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H11:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H15:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H16:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H17:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ b c +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO013-4.p.ma b/matita/tests/TPTP/Veloci/BOO013-4.p.ma new file mode 100644 index 000000000..f4b986a97 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO013-4.p.ma @@ -0,0 +1,72 @@ +set "baseuri" "cic:/matita/TPTP/BOO013-4". +include "logic/equality.ma". +(* Inclusion of: BOO013-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO013-4 : TPTP v3.1.1. Released v1.1.0. *) +(* Domain : Boolean Algebra *) +(* Problem : The inverse of X is unique *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TE [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 11 ( 0 non-Horn; 11 unit; 3 RR) *) +(* Number of atoms : 11 ( 11 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_a_inverse_is_b: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (multiply a b) additive_identity. +\forall H1:eq Univ (add a b) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H3:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H4:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H5:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H6:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ b (inverse a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO016-2.p.ma b/matita/tests/TPTP/Veloci/BOO016-2.p.ma new file mode 100644 index 000000000..ee7c9969c --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO016-2.p.ma @@ -0,0 +1,78 @@ +set "baseuri" "cic:/matita/TPTP/BOO016-2". +include "logic/equality.ma". +(* Inclusion of: BOO016-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO016-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Relating product and sum (X * Y = Z -> X + Z = X) *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 2 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 5 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_sum: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:eq Univ (multiply x y) z. +\forall H1:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H2:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H3:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H4:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H5:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H6:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H7:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H8:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (add x z) x +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO017-2.p.ma b/matita/tests/TPTP/Veloci/BOO017-2.p.ma new file mode 100644 index 000000000..5691fcfb0 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO017-2.p.ma @@ -0,0 +1,78 @@ +set "baseuri" "cic:/matita/TPTP/BOO017-2". +include "logic/equality.ma". +(* Inclusion of: BOO017-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO017-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Relating sum and product (X + Y = Z -> X * Z = X) *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.50 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 2 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 5 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [ANL] (equality) axioms. *) +(* English : *) +(* Refs : *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 0 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 24 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_sum: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:eq Univ (add x y) z. +\forall H1:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H2:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H3:\forall X:Univ.eq Univ (multiply multiplicative_identity X) X. +\forall H4:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H5:\forall X:Univ.eq Univ (multiply (inverse X) X) additive_identity. +\forall H6:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H7:\forall X:Univ.eq Univ (add (inverse X) X) multiplicative_identity. +\forall H8:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (multiply X Y) Z) (multiply (add X Z) (add Y Z)). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (multiply x z) x +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO018-4.p.ma b/matita/tests/TPTP/Veloci/BOO018-4.p.ma new file mode 100644 index 000000000..32fe9a460 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO018-4.p.ma @@ -0,0 +1,69 @@ +set "baseuri" "cic:/matita/TPTP/BOO018-4". +include "logic/equality.ma". +(* Inclusion of: BOO018-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO018-4 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Boolean Algebra *) +(* Problem : Inverse of multiplicative identity = Additive identity *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : TG [Ver94] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 9 ( 0 non-Horn; 9 unit; 1 RR) *) +(* Number of atoms : 9 ( 9 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* Bugfixes : v1.2.1 - Clause prove_inverse_of_1_is_0 fixed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include boolean algebra axioms for equality formulation *) +(* Inclusion of: Axioms/BOO004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Boolean Algebra *) +(* Axioms : Boolean algebra (equality) axioms *) +(* Version : [Ver94] (equality) axioms. *) +(* English : *) +(* Refs : [Ver94] Veroff (1994), Problem Set *) +(* Source : [Ver94] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_inverse_of_1_is_0: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiplicative_identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) additive_identity. +\forall H1:\forall X:Univ.eq Univ (add X (inverse X)) multiplicative_identity. +\forall H2:\forall X:Univ.eq Univ (multiply X multiplicative_identity) X. +\forall H3:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (multiply Y Z)) (multiply (add X Y) (add X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y) (multiply Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (inverse multiplicative_identity) additive_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO034-1.p.ma b/matita/tests/TPTP/Veloci/BOO034-1.p.ma new file mode 100644 index 000000000..adab6c4ae --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO034-1.p.ma @@ -0,0 +1,75 @@ +set "baseuri" "cic:/matita/TPTP/BOO034-1". +include "logic/equality.ma". +(* Inclusion of: BOO034-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO034-1 : TPTP v3.1.1. Released v2.2.0. *) +(* Domain : Boolean Algebra (Ternary) *) +(* Problem : Ternary Boolean Algebra Single axiom is sound. *) +(* Version : [MP96] (equality) axioms. *) +(* English : We show that that an equation (which turns out to be a single *) +(* axiom for TBA) can be derived from the axioms of TBA. *) +(* Refs : [McC98] McCune (1998), Email to G. Sutcliffe *) +(* : [MP96] McCune & Padmanabhan (1996), Automated Deduction in Eq *) +(* Source : [McC98] *) +(* Names : TBA-1-a [MP96] *) +(* Status : Unsatisfiable *) +(* Rating : 0.21 v3.1.0, 0.11 v2.7.0, 0.27 v2.6.0, 0.33 v2.5.0, 0.00 v2.2.1 *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of atoms : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 7 constant; 0-3 arity) *) +(* Number of variables : 13 ( 2 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include ternary Boolean algebra axioms *) +(* Inclusion of: Axioms/BOO001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : BOO001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Algebra (Ternary Boolean) *) +(* Axioms : Ternary Boolean algebra (equality) axioms *) +(* Version : [OTTER] (equality) axioms. *) +(* English : *) +(* Refs : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* : [Win82] Winker (1982), Generation and Verification of Finite M *) +(* Source : [OTTER] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 0 RR) *) +(* Number of literals : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 1-3 arity) *) +(* Number of variables : 13 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : These axioms appear in [Win82], in which ternary_multiply_1 is *) +(* shown to be independant. *) +(* : These axioms are also used in [Wos88], p.222. *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Denial of single axiom: *) +theorem prove_single_axiom: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall d:Univ. +\forall e:Univ. +\forall f:Univ. +\forall g:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X Y (inverse Y)) X. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (inverse Y) Y X) X. +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X X Y) X. +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (multiply Y X X) X. +\forall H4:\forall V:Univ.\forall W:Univ.\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply V W X) Y (multiply V W Z)) (multiply V W (multiply X Y Z)).eq Univ (multiply (multiply a (inverse a) b) (inverse (multiply (multiply c d e) f (multiply c d g))) (multiply d (multiply g f e) c)) b +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO069-1.p.ma b/matita/tests/TPTP/Veloci/BOO069-1.p.ma new file mode 100644 index 000000000..38bbe0e44 --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO069-1.p.ma @@ -0,0 +1,38 @@ +set "baseuri" "cic:/matita/TPTP/BOO069-1". +include "logic/equality.ma". +(* Inclusion of: BOO069-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO069-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Boolean Algebra (Ternary) *) +(* Problem : Ternary Boolean Algebra Single axiom is complete, part 3 *) +(* Version : [MP96] (equality) axioms. *) +(* English : *) +(* Refs : [McC98] McCune (1998), Email to G. Sutcliffe *) +(* : [MP96] McCune & Padmanabhan (1996), Automated Deduction in Eq *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-3 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of BOO035-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_tba_axioms_3: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.\forall D:Univ.\forall E:Univ.\forall F:Univ.\forall G:Univ.eq Univ (multiply (multiply A (inverse A) B) (inverse (multiply (multiply C D E) F (multiply C D G))) (multiply D (multiply G F E) C)) B.eq Univ (multiply a b (inverse b)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO071-1.p.ma b/matita/tests/TPTP/Veloci/BOO071-1.p.ma new file mode 100644 index 000000000..1cddbb9ae --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO071-1.p.ma @@ -0,0 +1,38 @@ +set "baseuri" "cic:/matita/TPTP/BOO071-1". +include "logic/equality.ma". +(* Inclusion of: BOO071-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO071-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Boolean Algebra (Ternary) *) +(* Problem : Ternary Boolean Algebra Single axiom is complete, part 5 *) +(* Version : [MP96] (equality) axioms. *) +(* English : *) +(* Refs : [McC98] McCune (1998), Email to G. Sutcliffe *) +(* : [MP96] McCune & Padmanabhan (1996), Automated Deduction in Eq *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-3 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of BOO035-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_tba_axioms_5: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.\forall D:Univ.\forall E:Univ.\forall F:Univ.\forall G:Univ.eq Univ (multiply (multiply A (inverse A) B) (inverse (multiply (multiply C D E) F (multiply C D G))) (multiply D (multiply G F E) C)) B.eq Univ (multiply (inverse b) b a) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/BOO075-1.p.ma b/matita/tests/TPTP/Veloci/BOO075-1.p.ma new file mode 100644 index 000000000..971fa231a --- /dev/null +++ b/matita/tests/TPTP/Veloci/BOO075-1.p.ma @@ -0,0 +1,37 @@ +set "baseuri" "cic:/matita/TPTP/BOO075-1". +include "logic/equality.ma". +(* Inclusion of: BOO075-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO075-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Sh-1 is a single axiom for Boolean algebra, part 1 *) +(* Version : [EF+02] axioms. *) +(* English : *) +(* Refs : [EF+02] Ernst et al. (2002), More First-order Test Problems in *) +(* : [MV+02] McCune et al. (2002), Short Single Axioms for Boolean *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 1 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of BOO039-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_meredith_2_basis_1: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall nand:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (nand (nand A (nand (nand B A) A)) (nand B (nand C A))) B.eq Univ (nand (nand a a) (nand b a)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL004-3.p.ma b/matita/tests/TPTP/Veloci/COL004-3.p.ma new file mode 100644 index 000000000..f9a7712ee --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL004-3.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/COL004-3". +include "logic/equality.ma". +(* Inclusion of: COL004-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL004-3 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to U from S and K. *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combination is provided and checked. *) +(* English : Construct from S and K alone a combinator that behaves as the *) +(* combinator U does, where ((Sx)y)z = (xz)(yz), (Kx)y = x, *) +(* (Ux)y = y((xx)y). *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.21 v3.1.0, 0.22 v2.7.0, 0.27 v2.6.0, 0.17 v2.5.0, 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 5 ( 1 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----This is the U equivalent *) +theorem prove_u_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall k:Univ. +\forall s:Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply k X) Y) X. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply s X) Y) Z) (apply (apply X Z) (apply Y Z)).eq Univ (apply (apply (apply (apply s (apply k (apply s (apply (apply s k) k)))) (apply (apply s (apply (apply s k) k)) (apply (apply s k) k))) x) y) (apply y (apply (apply x x) y)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL007-1.p.ma b/matita/tests/TPTP/Veloci/COL007-1.p.ma new file mode 100644 index 000000000..655b2a2ce --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL007-1.p.ma @@ -0,0 +1,44 @@ +set "baseuri" "cic:/matita/TPTP/COL007-1". +include "logic/equality.ma". +(* Inclusion of: COL007-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL007-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for L *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinator L, where (Lx)y = x(yy). *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall combinator:Univ. +\forall l:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply l X) Y) (apply X (apply Y Y)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL008-1.p.ma b/matita/tests/TPTP/Veloci/COL008-1.p.ma new file mode 100644 index 000000000..a3ff086db --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL008-1.p.ma @@ -0,0 +1,48 @@ +set "baseuri" "cic:/matita/TPTP/COL008-1". +include "logic/equality.ma". +(* Inclusion of: COL008-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL008-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for M and B *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators M and B, where ((Bx)y)z = x(yz), Mx = xx. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* : [Wos93] Wos (1993), The Kernel Strategy and Its Use for the St *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* : Question 13 [Wos93] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 3 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall combinator:Univ. +\forall m:Univ. +\forall H0:\forall X:Univ.eq Univ (apply m X) (apply X X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL010-1.p.ma b/matita/tests/TPTP/Veloci/COL010-1.p.ma new file mode 100644 index 000000000..45bd7de31 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL010-1.p.ma @@ -0,0 +1,47 @@ +set "baseuri" "cic:/matita/TPTP/COL010-1". +include "logic/equality.ma". +(* Inclusion of: COL010-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL010-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for B and S2 *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators B and S2, where ((Bx)y)z = x(yz), *) +(* ((S2x)y)z = (xz)(yy). *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall combinator:Univ. +\forall s2:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply s2 X) Y) Z) (apply (apply X Z) (apply Y Y)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL012-1.p.ma b/matita/tests/TPTP/Veloci/COL012-1.p.ma new file mode 100644 index 000000000..866be5178 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL012-1.p.ma @@ -0,0 +1,44 @@ +set "baseuri" "cic:/matita/TPTP/COL012-1". +include "logic/equality.ma". +(* Inclusion of: COL012-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL012-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for U *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinator U, where (Ux)y = y((xx)y). *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall combinator:Univ. +\forall u:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply u X) Y) (apply Y (apply (apply X X) Y)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL013-1.p.ma b/matita/tests/TPTP/Veloci/COL013-1.p.ma new file mode 100644 index 000000000..07d594e3c --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL013-1.p.ma @@ -0,0 +1,47 @@ +set "baseuri" "cic:/matita/TPTP/COL013-1". +include "logic/equality.ma". +(* Inclusion of: COL013-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL013-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for S and L *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators S and L, where ((Sx)y)z = (xz)(yz), (Lx)y *) +(* = x(yy). *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 3 constant; 0-2 arity) *) +(* Number of variables : 6 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall combinator:Univ. +\forall l:Univ. +\forall s:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply l X) Y) (apply X (apply Y Y)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply s X) Y) Z) (apply (apply X Z) (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL014-1.p.ma b/matita/tests/TPTP/Veloci/COL014-1.p.ma new file mode 100644 index 000000000..6e618736a --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL014-1.p.ma @@ -0,0 +1,47 @@ +set "baseuri" "cic:/matita/TPTP/COL014-1". +include "logic/equality.ma". +(* Inclusion of: COL014-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL014-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for L and O *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators L and O, where (Lx)y = x(yy), (Ox)y *) +(* = y(xy). *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 3 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall combinator:Univ. +\forall l:Univ. +\forall o:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply o X) Y) (apply Y (apply X Y)). +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply l X) Y) (apply X (apply Y Y)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL015-1.p.ma b/matita/tests/TPTP/Veloci/COL015-1.p.ma new file mode 100644 index 000000000..fcff6921c --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL015-1.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL015-1". +include "logic/equality.ma". +(* Inclusion of: COL015-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL015-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for Q and M *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators Q and M, where Mx = xx, ((Qx)y)z = y(xz). *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 3 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall combinator:Univ. +\forall m:Univ. +\forall q:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply q X) Y) Z) (apply Y (apply X Z)). +\forall H1:\forall X:Univ.eq Univ (apply m X) (apply X X).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL016-1.p.ma b/matita/tests/TPTP/Veloci/COL016-1.p.ma new file mode 100644 index 000000000..37a3765cb --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL016-1.p.ma @@ -0,0 +1,49 @@ +set "baseuri" "cic:/matita/TPTP/COL016-1". +include "logic/equality.ma". +(* Inclusion of: COL016-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL016-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for B, M and L *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators B, M and L, where ((Bx)y)z = x(yz), (Lx)y *) +(* = x(yy), Mx = xx. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v3.1.0, 0.11 v2.7.0, 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 1 RR) *) +(* Number of atoms : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall combinator:Univ. +\forall l:Univ. +\forall m:Univ. +\forall H0:\forall X:Univ.eq Univ (apply m X) (apply X X). +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply l X) Y) (apply X (apply Y Y)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL017-1.p.ma b/matita/tests/TPTP/Veloci/COL017-1.p.ma new file mode 100644 index 000000000..36d03e6e5 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL017-1.p.ma @@ -0,0 +1,49 @@ +set "baseuri" "cic:/matita/TPTP/COL017-1". +include "logic/equality.ma". +(* Inclusion of: COL017-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL017-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for B, M, and T *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators B, M, and T, where ((Bx)y)z = x(yz), *) +(* Mx = xx, (Tx)y = yx. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 1 RR) *) +(* Number of atoms : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall combinator:Univ. +\forall m:Univ. +\forall t:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.eq Univ (apply m X) (apply X X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL018-1.p.ma b/matita/tests/TPTP/Veloci/COL018-1.p.ma new file mode 100644 index 000000000..e218bae4a --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL018-1.p.ma @@ -0,0 +1,49 @@ +set "baseuri" "cic:/matita/TPTP/COL018-1". +include "logic/equality.ma". +(* Inclusion of: COL018-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL018-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for W, Q, and L *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators W, Q, and L, where (Lx)y = x(yy), (Wx)y *) +(* = (xy)y, ((Qx)y)z = y(xz). *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 1 RR) *) +(* Number of atoms : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall combinator:Univ. +\forall l:Univ. +\forall q:Univ. +\forall w:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply q X) Y) Z) (apply Y (apply X Z)). +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply w X) Y) (apply (apply X Y) Y). +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply l X) Y) (apply X (apply Y Y)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL021-1.p.ma b/matita/tests/TPTP/Veloci/COL021-1.p.ma new file mode 100644 index 000000000..e8f9c3579 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL021-1.p.ma @@ -0,0 +1,49 @@ +set "baseuri" "cic:/matita/TPTP/COL021-1". +include "logic/equality.ma". +(* Inclusion of: COL021-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL021-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for B, M, and V *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators B, M, and V, where ((Bx)y)z = x(yz), *) +(* Mx = xx, ((Vx)y)z = (zx)y. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 1 RR) *) +(* Number of atoms : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall combinator:Univ. +\forall m:Univ. +\forall v:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply v X) Y) Z) (apply (apply Z X) Y). +\forall H1:\forall X:Univ.eq Univ (apply m X) (apply X X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL022-1.p.ma b/matita/tests/TPTP/Veloci/COL022-1.p.ma new file mode 100644 index 000000000..a311f146f --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL022-1.p.ma @@ -0,0 +1,49 @@ +set "baseuri" "cic:/matita/TPTP/COL022-1". +include "logic/equality.ma". +(* Inclusion of: COL022-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL022-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for B, O, and M *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators B, O, and M, where ((Bx)y)z = x(yz), *) +(* Mx = xx, (Ox)y = y(xy). *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 1 RR) *) +(* Number of atoms : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall combinator:Univ. +\forall m:Univ. +\forall o:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply o X) Y) (apply Y (apply X Y)). +\forall H1:\forall X:Univ.eq Univ (apply m X) (apply X X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL024-1.p.ma b/matita/tests/TPTP/Veloci/COL024-1.p.ma new file mode 100644 index 000000000..c38e40574 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL024-1.p.ma @@ -0,0 +1,49 @@ +set "baseuri" "cic:/matita/TPTP/COL024-1". +include "logic/equality.ma". +(* Inclusion of: COL024-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL024-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for B, M, and C *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators B, M, and C, where ((Bx)y)z = x(yz), *) +(* Mx = xx, ((Cx)y)z = (xz)y. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 1 RR) *) +(* Number of atoms : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall c:Univ. +\forall combinator:Univ. +\forall m:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply c X) Y) Z) (apply (apply X Z) Y). +\forall H1:\forall X:Univ.eq Univ (apply m X) (apply X X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL025-1.p.ma b/matita/tests/TPTP/Veloci/COL025-1.p.ma new file mode 100644 index 000000000..a7fa25856 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL025-1.p.ma @@ -0,0 +1,48 @@ +set "baseuri" "cic:/matita/TPTP/COL025-1". +include "logic/equality.ma". +(* Inclusion of: COL025-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL025-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for B and W *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators B and W, where ((Bx)y)z = x(yz), (Wx)y *) +(* = (xy)y. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [MW88] *) +(* Names : stage1.in & stage2.in [OTTER] *) +(* : - [MW88] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 3 constant; 0-2 arity) *) +(* Number of variables : 6 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall combinator:Univ. +\forall w:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply w X) Y) (apply (apply X Y) Y). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL045-1.p.ma b/matita/tests/TPTP/Veloci/COL045-1.p.ma new file mode 100644 index 000000000..df48469b0 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL045-1.p.ma @@ -0,0 +1,49 @@ +set "baseuri" "cic:/matita/TPTP/COL045-1". +include "logic/equality.ma". +(* Inclusion of: COL045-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL045-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for B, M and S *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators B, M and S, where ((Sx)y)z = (xz)(yz), *) +(* ((Bx)y)z = x(yz), Mx = xx. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [Wos89] Wos (1989), A Challenge Problem and a Recent Workshop *) +(* Source : [Wos89] *) +(* Names : - [Wos89] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 1 RR) *) +(* Number of atoms : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall combinator:Univ. +\forall m:Univ. +\forall s:Univ. +\forall H0:\forall X:Univ.eq Univ (apply m X) (apply X X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply s X) Y) Z) (apply (apply X Z) (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL048-1.p.ma b/matita/tests/TPTP/Veloci/COL048-1.p.ma new file mode 100644 index 000000000..a0435b2c2 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL048-1.p.ma @@ -0,0 +1,49 @@ +set "baseuri" "cic:/matita/TPTP/COL048-1". +include "logic/equality.ma". +(* Inclusion of: COL048-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL048-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Weak fixed point for B, W, and M *) +(* Version : [WM88] (equality) axioms. *) +(* English : The weak fixed point property holds for the set P consisting *) +(* of the combinators B, W, and M, where ((Bx)y)z = x(yz), (Wx)y *) +(* = (xy)y, Mx = xx. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [MW87] McCune & Wos (1987), A Case Study in Automated Theorem *) +(* : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [MW88] McCune & Wos (1988), Some Fixed Point Problems in Comb *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 1 RR) *) +(* Number of atoms : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_fixed_point: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall combinator:Univ. +\forall m:Univ. +\forall w:Univ. +\forall H0:\forall X:Univ.eq Univ (apply m X) (apply X X). +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply w X) Y) (apply (apply X Y) Y). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).\exist Y:Univ.eq Univ Y (apply combinator Y) +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL050-1.p.ma b/matita/tests/TPTP/Veloci/COL050-1.p.ma new file mode 100644 index 000000000..10f25dc2a --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL050-1.p.ma @@ -0,0 +1,56 @@ +set "baseuri" "cic:/matita/TPTP/COL050-1". +include "logic/equality.ma". +(* Inclusion of: COL050-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL050-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : The Significance of the Mockingbird *) +(* Version : Especial. *) +(* English : There exists a mocking bird. For all birds x and y, there *) +(* exists a bird z that composes x with y for all birds w. Prove *) +(* that every bird is fond of at least one other bird. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* Source : [ANL] *) +(* Names : bird1.ver1.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ---- There exists a mocking bird (Mock). *) +(* ---- TEx FAy [response(x,y) = response(y,y)]. *) +(* ---- response(Mock,y) = response(y,y). *) +(* ---- For all birds x and y, there exists a bird z that composes *) +(* ---- x with y for all birds w. *) +(* ---- FAx FAy TEz FAw [response(z,w) = response(x,response(y,w))] *) +(* ---- response(comp(x,y),w) = response(x,response(y,w)). *) +(* ---- Hypothesis: Every bird is fond of at least one other bird. *) +(* ---- -FAx TEy [response(x,y) = y]. *) +(* ---- TEx FAy -[response(x,y) = y]. *) +(* ---- Letting A = x, *) +(* ---- -[response(A,y) = y]. *) +theorem prove_all_fond_of_another: + \forall Univ:Set. +\forall a:Univ. +\forall compose:\forall _:Univ.\forall _:Univ.Univ. +\forall mocking_bird:Univ. +\forall response:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall W:Univ.\forall X:Univ.\forall Y:Univ.eq Univ (response (compose X Y) W) (response X (response Y W)). +\forall H1:\forall Y:Univ.eq Univ (response mocking_bird Y) (response Y Y).\exist Y:Univ.eq Univ (response a Y) Y +. +intros. +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL058-2.p.ma b/matita/tests/TPTP/Veloci/COL058-2.p.ma new file mode 100644 index 000000000..5b216a3d2 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL058-2.p.ma @@ -0,0 +1,42 @@ +set "baseuri" "cic:/matita/TPTP/COL058-2". +include "logic/equality.ma". +(* Inclusion of: COL058-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL058-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : If there's a lark, then there's an egocentric bird. *) +(* Version : Especial. *) +(* Theorem formulation : The egocentric bird is provided and *) +(* checked. *) +(* English : Suppose we are given a forest that contains a lark, and *) +(* we are not given any other information. Prove that at least *) +(* one bird in the forest must be egocentric. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [GO86] Glickfield & Overbeek (1986), A Foray into Combinatory *) +(* Source : [GO86] *) +(* Names : - [GO86] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 1 constant; 0-2 arity) *) +(* Number of variables : 2 ( 0 singleton) *) +(* Maximal term depth : 7 ( 5 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ---- There exists a lark *) +(* ---- Hypothesis: This bird is egocentric *) +theorem prove_the_bird_exists: + \forall Univ:Set. +\forall lark:Univ. +\forall response:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X1:Univ.\forall X2:Univ.eq Univ (response (response lark X1) X2) (response X1 (response X2 X2)).eq Univ (response (response (response lark (response (response lark (response lark lark)) (response lark (response lark lark)))) (response lark (response lark lark))) (response (response lark (response (response lark (response lark lark)) (response lark (response lark lark)))) (response lark (response lark lark)))) (response (response lark (response (response lark (response lark lark)) (response lark (response lark lark)))) (response lark (response lark lark))) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL058-3.p.ma b/matita/tests/TPTP/Veloci/COL058-3.p.ma new file mode 100644 index 000000000..2235cb57d --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL058-3.p.ma @@ -0,0 +1,42 @@ +set "baseuri" "cic:/matita/TPTP/COL058-3". +include "logic/equality.ma". +(* Inclusion of: COL058-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL058-3 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Combinatory Logic *) +(* Problem : If there's a lark, then there's an egocentric bird. *) +(* Version : Especial. *) +(* Theorem formulation : The egocentric bird is provided and *) +(* checked. *) +(* English : Suppose we are given a forest that conrtains a lark, and *) +(* we are not given any other information. Prove that at least *) +(* one bird in the forest must be egocentric. *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* : [GO86] Glickfield & Overbeek (1986), A Foray into Combinatory *) +(* Source : [GO86] *) +(* Names : - [GO86] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 1 constant; 0-2 arity) *) +(* Number of variables : 2 ( 0 singleton) *) +(* Maximal term depth : 6 ( 4 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ---- There exists a lark *) +(* ---- Hypothesis: This bird is egocentric *) +theorem prove_the_bird_exists: + \forall Univ:Set. +\forall lark:Univ. +\forall response:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X1:Univ.\forall X2:Univ.eq Univ (response (response lark X1) X2) (response X1 (response X2 X2)).eq Univ (response (response (response (response lark lark) (response lark (response lark lark))) (response lark (response lark lark))) (response (response (response lark lark) (response lark (response lark lark))) (response lark (response lark lark)))) (response (response (response lark lark) (response lark (response lark lark))) (response lark (response lark lark))) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL060-2.p.ma b/matita/tests/TPTP/Veloci/COL060-2.p.ma new file mode 100644 index 000000000..da151819a --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL060-2.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL060-2". +include "logic/equality.ma". +(* Inclusion of: COL060-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL060-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to Q from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator Q does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Qx)y)z = y(xz). *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.29 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the q equivalent *) +theorem prove_q_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply t b)) (apply (apply b b) t)) x) y) z) (apply y (apply x z)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL060-3.p.ma b/matita/tests/TPTP/Veloci/COL060-3.p.ma new file mode 100644 index 000000000..d1ff7bc9b --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL060-3.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL060-3". +include "logic/equality.ma". +(* Inclusion of: COL060-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL060-3 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to Q from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator Q does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Qx)y)z = y(xz). *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.29 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the q equivalent *) +theorem prove_q_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply t b)) b)) t) x) y) z) (apply y (apply x z)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL061-2.p.ma b/matita/tests/TPTP/Veloci/COL061-2.p.ma new file mode 100644 index 000000000..81adc265d --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL061-2.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL061-2". +include "logic/equality.ma". +(* Inclusion of: COL061-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL061-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to Q1 from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator Q1 does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Q1x)y)z = x(zy). *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.29 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the Q1 equivalent *) +theorem prove_q1_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply t t)) (apply (apply b b) b)) x) y) z) (apply x (apply z y)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL061-3.p.ma b/matita/tests/TPTP/Veloci/COL061-3.p.ma new file mode 100644 index 000000000..0359b3ce9 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL061-3.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL061-3". +include "logic/equality.ma". +(* Inclusion of: COL061-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL061-3 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to Q1 from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator Q1 does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Q1x)y)z = x(zy). *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.29 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the Q1 equivalent *) +theorem prove_q1_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply t t)) b)) b) x) y) z) (apply x (apply z y)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL062-2.p.ma b/matita/tests/TPTP/Veloci/COL062-2.p.ma new file mode 100644 index 000000000..383a285e8 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL062-2.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL062-2". +include "logic/equality.ma". +(* Inclusion of: COL062-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL062-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to C from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator C does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Cx)y)z = (xz)y *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.29 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the C equivalent *) +theorem prove_c_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply t (apply (apply b b) t))) (apply (apply b b) t)) x) y) z) (apply (apply x z) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL062-3.p.ma b/matita/tests/TPTP/Veloci/COL062-3.p.ma new file mode 100644 index 000000000..8b65e0c4f --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL062-3.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL062-3". +include "logic/equality.ma". +(* Inclusion of: COL062-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL062-3 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to C from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator C does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Cx)y)z = (xz)y *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.43 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 11 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the C equivalent *) +theorem prove_c_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply t (apply (apply b b) t))) b)) t) x) y) z) (apply (apply x z) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL063-2.p.ma b/matita/tests/TPTP/Veloci/COL063-2.p.ma new file mode 100644 index 000000000..02f91ef49 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL063-2.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL063-2". +include "logic/equality.ma". +(* Inclusion of: COL063-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL063-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to F from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator F does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Fx)y)z = (zy)x. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 8 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the F equivalent *) +theorem prove_f_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply t t)) (apply (apply b b) (apply (apply b b) t))) x) y) z) (apply (apply z y) x) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL063-3.p.ma b/matita/tests/TPTP/Veloci/COL063-3.p.ma new file mode 100644 index 000000000..70205ee89 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL063-3.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL063-3". +include "logic/equality.ma". +(* Inclusion of: COL063-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL063-3 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to F from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator F does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Fx)y)z = (zy)x. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.29 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the F equivalent *) +theorem prove_f_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply t t)) b)) (apply (apply b b) t)) x) y) z) (apply (apply z y) x) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL063-4.p.ma b/matita/tests/TPTP/Veloci/COL063-4.p.ma new file mode 100644 index 000000000..38bb35318 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL063-4.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL063-4". +include "logic/equality.ma". +(* Inclusion of: COL063-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL063-4 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to F from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator F does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Fx)y)z = (zy)x. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.43 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the F equivalent *) +theorem prove_f_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply t t)) (apply (apply b (apply (apply b b) b)) t)) x) y) z) (apply (apply z y) x) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL063-5.p.ma b/matita/tests/TPTP/Veloci/COL063-5.p.ma new file mode 100644 index 000000000..4c98273b5 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL063-5.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL063-5". +include "logic/equality.ma". +(* Inclusion of: COL063-5.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL063-5 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to F from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator F does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Fx)y)z = (zy)x. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.43 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the F equivalent *) +theorem prove_f_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply t t)) (apply (apply b b) b))) t) x) y) z) (apply (apply z y) x) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL063-6.p.ma b/matita/tests/TPTP/Veloci/COL063-6.p.ma new file mode 100644 index 000000000..19fbd39fa --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL063-6.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL063-6". +include "logic/equality.ma". +(* Inclusion of: COL063-6.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL063-6 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to F from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator F does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Fx)y)z = (zy)x. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.43 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 11 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the F equivalent *) +theorem prove_f_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply (apply b (apply t t)) b)) b)) t) x) y) z) (apply (apply z y) x) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL064-2.p.ma b/matita/tests/TPTP/Veloci/COL064-2.p.ma new file mode 100644 index 000000000..4e6d8af15 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL064-2.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL064-2". +include "logic/equality.ma". +(* Inclusion of: COL064-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL064-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to V from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator V does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Vx)y)z = (zx)y. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.57 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the V equivalent *) +theorem prove_v_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply t (apply (apply b b) t))) (apply (apply b b) (apply (apply b b) t))) x) y) z) (apply (apply z x) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL064-3.p.ma b/matita/tests/TPTP/Veloci/COL064-3.p.ma new file mode 100644 index 000000000..5644d38c1 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL064-3.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL064-3". +include "logic/equality.ma". +(* Inclusion of: COL064-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL064-3 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to V from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator V does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Vx)y)z = (zx)y. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.43 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 11 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the V equivalent *) +theorem prove_v_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply t (apply (apply b b) t))) b)) (apply (apply b b) t)) x) y) z) (apply (apply z x) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL064-4.p.ma b/matita/tests/TPTP/Veloci/COL064-4.p.ma new file mode 100644 index 000000000..34fbe9349 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL064-4.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL064-4". +include "logic/equality.ma". +(* Inclusion of: COL064-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL064-4 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to V from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator V does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Vx)y)z = (zx)y. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.57 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the V equivalent *) +theorem prove_v_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply t (apply (apply b b) t))) (apply (apply b (apply (apply b b) b)) t)) x) y) z) (apply (apply z x) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL064-5.p.ma b/matita/tests/TPTP/Veloci/COL064-5.p.ma new file mode 100644 index 000000000..414887588 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL064-5.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL064-5". +include "logic/equality.ma". +(* Inclusion of: COL064-5.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL064-5 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to V from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator V does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Vx)y)z = (zx)y. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.57 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 11 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the V equivalent *) +theorem prove_v_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply t (apply (apply b b) t))) (apply (apply b b) b))) t) x) y) z) (apply (apply z x) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL064-6.p.ma b/matita/tests/TPTP/Veloci/COL064-6.p.ma new file mode 100644 index 000000000..4d054e035 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL064-6.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL064-6". +include "logic/equality.ma". +(* Inclusion of: COL064-6.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL064-6 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to V from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator V does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Vx)y)z = (zx)y. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.43 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 13 ( 5 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the V equivalent *) +theorem prove_v_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply (apply b (apply t (apply (apply b b) t))) b)) b)) t) x) y) z) (apply (apply z x) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL064-7.p.ma b/matita/tests/TPTP/Veloci/COL064-7.p.ma new file mode 100644 index 000000000..1c3ddc2f2 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL064-7.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL064-7". +include "logic/equality.ma". +(* Inclusion of: COL064-7.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL064-7 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to V from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator V does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Vx)y)z = (zx)y. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.71 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the V equivalent *) +theorem prove_v_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply t (apply (apply b b) t))) (apply (apply b b) (apply (apply b t) t))) x) y) z) (apply (apply z x) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL064-8.p.ma b/matita/tests/TPTP/Veloci/COL064-8.p.ma new file mode 100644 index 000000000..120a6d047 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL064-8.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL064-8". +include "logic/equality.ma". +(* Inclusion of: COL064-8.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL064-8 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to V from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator V does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Vx)y)z = (zx)y. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.71 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 11 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the V equivalent *) +theorem prove_v_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply (apply b (apply t (apply (apply b b) t))) b)) (apply (apply b t) t)) x) y) z) (apply (apply z x) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL064-9.p.ma b/matita/tests/TPTP/Veloci/COL064-9.p.ma new file mode 100644 index 000000000..07591bb4c --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL064-9.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL064-9". +include "logic/equality.ma". +(* Inclusion of: COL064-9.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL064-9 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Find combinator equivalent to V from B and T *) +(* Version : [WM88] (equality) axioms. *) +(* Theorem formulation : The combinator is provided and checked. *) +(* English : Construct from B and T alone a combinator that behaves as the *) +(* combinator V does, where ((Bx)y)z = x(yz), (Tx)y = yx, *) +(* ((Vx)y)z = (zx)y. *) +(* Refs : [WM88] Wos & McCune (1988), Challenge Problems Focusing on Eq *) +(* : [WW+90] Wos et al. (1990), Automated Reasoning Contributes to *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.71 v2.0.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 5 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 9 ( 4 average) *) +(* Comments : *) +(* Bugfixes : v1.2.0 : Redundant [fgh]_substitution axioms removed. *) +(* -------------------------------------------------------------------------- *) +(* ----This is the V equivalent *) +theorem prove_v_combinator: + \forall Univ:Set. +\forall apply:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall t:Univ. +\forall x:Univ. +\forall y:Univ. +\forall z:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (apply (apply t X) Y) (apply Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (apply (apply (apply b X) Y) Z) (apply X (apply Y Z)).eq Univ (apply (apply (apply (apply (apply b (apply t (apply (apply b b) t))) (apply (apply b (apply (apply b b) t)) t)) x) y) z) (apply (apply z x) y) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL083-1.p.ma b/matita/tests/TPTP/Veloci/COL083-1.p.ma new file mode 100644 index 000000000..89d991761 --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL083-1.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL083-1". +include "logic/equality.ma". +(* Inclusion of: COL083-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL083-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Compatible Birds, part 1 *) +(* Version : Especial. *) +(* English : *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 6 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : A UEQ part of COL054-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_birds_are_compatible_1: + \forall Univ:Set. +\forall a:Univ. +\forall compose:\forall _:Univ.\forall _:Univ.Univ. +\forall mocking_bird:Univ. +\forall response:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (response (compose A B) C) (response A (response B C)). +\forall H1:\forall A:Univ.eq Univ (response mocking_bird A) (response A A).\exist A:Univ.\exist B:Univ.eq Univ (response a A) B +. +intros. +exists[ +2: +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL084-1.p.ma b/matita/tests/TPTP/Veloci/COL084-1.p.ma new file mode 100644 index 000000000..4d2d057bc --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL084-1.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/COL084-1". +include "logic/equality.ma". +(* Inclusion of: COL084-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL084-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Compatible Birds, part 2 *) +(* Version : Especial. *) +(* English : *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 6 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : A UEQ part of COL054-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_birds_are_compatible_2: + \forall Univ:Set. +\forall b:Univ. +\forall compose:\forall _:Univ.\forall _:Univ.Univ. +\forall mocking_bird:Univ. +\forall response:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (response (compose A B) C) (response A (response B C)). +\forall H1:\forall A:Univ.eq Univ (response mocking_bird A) (response A A).\exist A:Univ.\exist B:Univ.eq Univ (response b B) A +. +intros. +exists[ +2: +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL085-1.p.ma b/matita/tests/TPTP/Veloci/COL085-1.p.ma new file mode 100644 index 000000000..7fd4279ce --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL085-1.p.ma @@ -0,0 +1,44 @@ +set "baseuri" "cic:/matita/TPTP/COL085-1". +include "logic/equality.ma". +(* Inclusion of: COL085-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL085-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Happy Birds, part 1 *) +(* Version : Especial. *) +(* English : *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 2 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 2 constant; 0-2 arity) *) +(* Number of variables : 2 ( 2 singleton) *) +(* Maximal term depth : 2 ( 2 average) *) +(* Comments : A UEQ part of COL055-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_happiness_1: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall response:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (response a b) b.\exist A:Univ.\exist B:Univ.eq Univ (response a A) B +. +intros. +exists[ +2: +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/COL086-1.p.ma b/matita/tests/TPTP/Veloci/COL086-1.p.ma new file mode 100644 index 000000000..e4527c48b --- /dev/null +++ b/matita/tests/TPTP/Veloci/COL086-1.p.ma @@ -0,0 +1,44 @@ +set "baseuri" "cic:/matita/TPTP/COL086-1". +include "logic/equality.ma". +(* Inclusion of: COL086-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : COL086-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Combinatory Logic *) +(* Problem : Happy Birds, part 2 *) +(* Version : Especial. *) +(* English : *) +(* Refs : [Smu85] Smullyan (1978), To Mock a Mocking Bird and Other Logi *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 2 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 2 constant; 0-2 arity) *) +(* Number of variables : 2 ( 2 singleton) *) +(* Maximal term depth : 2 ( 2 average) *) +(* Comments : A UEQ part of COL055-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_happiness_2: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall response:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (response a b) b.\exist A:Univ.\exist B:Univ.eq Univ (response a B) A +. +intros. +exists[ +2: +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +| +skip] +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP001-2.p.ma b/matita/tests/TPTP/Veloci/GRP001-2.p.ma new file mode 100644 index 000000000..d4e79c748 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP001-2.p.ma @@ -0,0 +1,86 @@ +set "baseuri" "cic:/matita/TPTP/GRP001-2". +include "logic/equality.ma". +(* Inclusion of: GRP001-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP001-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Problem : X^2 = identity => commutativity *) +(* Version : [MOW76] (equality) axioms : Augmented. *) +(* English : If the square of every element is the identity, the system *) +(* is commutative. *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [LO85] Lusk & Overbeek (1985), Reasoning about Equality *) +(* : [LW92] Lusk & Wos (1992), Benchmark Problems in Which Equalit *) +(* Source : [ANL] *) +(* Names : GP1 [MOW76] *) +(* : Problem 1 [LO85] *) +(* : GT1 [LW92] *) +(* : xsquared.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 2 RR) *) +(* Number of atoms : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 4 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Redundant two axioms *) +theorem prove_b_times_a_is_c: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (multiply a b) c. +\forall H1:\forall X:Univ.eq Univ (multiply X X) identity. +\forall H2:\forall X:Univ.eq Univ (multiply X (inverse X)) identity. +\forall H3:\forall X:Univ.eq Univ (multiply X identity) X. +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H5:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H6:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (multiply b a) c +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP001-4.p.ma b/matita/tests/TPTP/Veloci/GRP001-4.p.ma new file mode 100644 index 000000000..544eaf116 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP001-4.p.ma @@ -0,0 +1,47 @@ +set "baseuri" "cic:/matita/TPTP/GRP001-4". +include "logic/equality.ma". +(* Inclusion of: GRP001-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP001-4 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Problem : X^2 = identity => commutativity *) +(* Version : [Wos65] (equality) axioms : Incomplete. *) +(* English : If the square of every element is the identity, the system *) +(* is commutative. *) +(* Refs : [Wos65] Wos (1965), Unpublished Note *) +(* : [Pel86] Pelletier (1986), Seventy-five Problems for Testing Au *) +(* Source : [Pel86] *) +(* Names : Pelletier 65 [Pel86] *) +(* : x2_quant.in [OTTER] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 2 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [Pel86] says "... problems, published I think, by Larry Wos *) +(* (but I cannot locate where)." *) +(* -------------------------------------------------------------------------- *) +(* ----The operation '*' is associative *) +(* ----There exists an identity element 'e' defined below. *) +theorem prove_b_times_a_is_c: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (multiply a b) c. +\forall H1:\forall X:Univ.eq Univ (multiply X X) identity. +\forall H2:\forall X:Univ.eq Univ (multiply identity X) X. +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)).eq Univ (multiply b a) c +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP010-4.p.ma b/matita/tests/TPTP/Veloci/GRP010-4.p.ma new file mode 100644 index 000000000..b6a3f51c1 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP010-4.p.ma @@ -0,0 +1,45 @@ +set "baseuri" "cic:/matita/TPTP/GRP010-4". +include "logic/equality.ma". +(* Inclusion of: GRP010-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP010-4 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Problem : Inverse is a symmetric relationship *) +(* Version : [Wos65] (equality) axioms : Incomplete. *) +(* English : If a is an inverse of b then b is an inverse of a. *) +(* Refs : [Wos65] Wos (1965), Unpublished Note *) +(* : [Pel86] Pelletier (1986), Seventy-five Problems for Testing Au *) +(* Source : [Pel86] *) +(* Names : Pelletier 64 [Pel86] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 2 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [Pel86] says "... problems, published I think, by Larry Wos *) +(* (but I cannot locate where)." *) +(* -------------------------------------------------------------------------- *) +(* ----The operation '*' is associative *) +(* ----There exists an identity element 'e' defined below. *) +theorem prove_b_times_c_is_e: + \forall Univ:Set. +\forall b:Univ. +\forall c:Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (multiply c b) identity. +\forall H1:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H2:\forall X:Univ.eq Univ (multiply identity X) X. +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)).eq Univ (multiply b c) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP011-4.p.ma b/matita/tests/TPTP/Veloci/GRP011-4.p.ma new file mode 100644 index 000000000..6391656ba --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP011-4.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/GRP011-4". +include "logic/equality.ma". +(* Inclusion of: GRP011-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP011-4 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Problem : Left cancellation *) +(* Version : [Wos65] (equality) axioms : Incomplete. *) +(* English : *) +(* Refs : [Wos65] Wos (1965), Unpublished Note *) +(* : [Pel86] Pelletier (1986), Seventy-five Problems for Testing Au *) +(* Source : [Pel86] *) +(* Names : Pelletier 63 [Pel86] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 2 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 4 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [Pel86] says "... problems, published I think, by Larry Wos *) +(* (but I cannot locate where)." *) +(* -------------------------------------------------------------------------- *) +(* ----The operation '*' is associative *) +(* ----There exists an identity element *) +theorem prove_left_cancellation: + \forall Univ:Set. +\forall b:Univ. +\forall c:Univ. +\forall d:Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (multiply b c) (multiply d c). +\forall H1:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H2:\forall X:Univ.eq Univ (multiply identity X) X. +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)).eq Univ b d +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP012-4.p.ma b/matita/tests/TPTP/Veloci/GRP012-4.p.ma new file mode 100644 index 000000000..ed5338825 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP012-4.p.ma @@ -0,0 +1,78 @@ +set "baseuri" "cic:/matita/TPTP/GRP012-4". +include "logic/equality.ma". +(* Inclusion of: GRP012-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP012-4 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Problem : Inverse of products = Product of inverses *) +(* Version : [MOW76] (equality) axioms : Augmented. *) +(* English : The inverse of products equals the product of the inverse, *) +(* in opposite order *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* Source : [ANL] *) +(* Names : - [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of atoms : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : In Lemmas.eq.clauses of [ANL] *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Redundant two axioms *) +theorem prove_inverse_of_product_is_product_of_inverses: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) identity. +\forall H1:\forall X:Univ.eq Univ (multiply X identity) X. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H3:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H4:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (inverse (multiply a b)) (multiply (inverse b) (inverse a)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP022-2.p.ma b/matita/tests/TPTP/Veloci/GRP022-2.p.ma new file mode 100644 index 000000000..db2519fe6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP022-2.p.ma @@ -0,0 +1,78 @@ +set "baseuri" "cic:/matita/TPTP/GRP022-2". +include "logic/equality.ma". +(* Inclusion of: GRP022-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP022-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Problem : Inverse is an involution *) +(* Version : [MOW76] (equality) axioms : Augmented. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [LO85] Lusk & Overbeek (1985), Reasoning about Equality *) +(* Source : [TPTP] *) +(* Names : Established lemma [MOW76] *) +(* : Problem 2 [LO85] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of atoms : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Redundant two axioms *) +theorem prove_inverse_of_inverse_is_original: + \forall Univ:Set. +\forall a:Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) identity. +\forall H1:\forall X:Univ.eq Univ (multiply X identity) X. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H3:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H4:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (inverse (inverse a)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP023-2.p.ma b/matita/tests/TPTP/Veloci/GRP023-2.p.ma new file mode 100644 index 000000000..4ad352201 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP023-2.p.ma @@ -0,0 +1,75 @@ +set "baseuri" "cic:/matita/TPTP/GRP023-2". +include "logic/equality.ma". +(* Inclusion of: GRP023-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP023-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Problem : The inverse of the identity is the identity *) +(* Version : [MOW76] (equality) axioms : Augmented. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* Source : [TPTP] *) +(* Names : Established lemma [MOW76] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of atoms : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Redundant two axioms *) +theorem prove_inverse_of_id_is_id: + \forall Univ:Set. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X (inverse X)) identity. +\forall H1:\forall X:Univ.eq Univ (multiply X identity) X. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H3:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H4:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (inverse identity) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP115-1.p.ma b/matita/tests/TPTP/Veloci/GRP115-1.p.ma new file mode 100644 index 000000000..6c605ee94 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP115-1.p.ma @@ -0,0 +1,36 @@ +set "baseuri" "cic:/matita/TPTP/GRP115-1". +include "logic/equality.ma". +(* Inclusion of: GRP115-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP115-1 : TPTP v3.1.1. Released v1.2.0. *) +(* Domain : Group Theory *) +(* Problem : Derive order 3 from a single axiom for groups order 3 *) +(* Version : [Wos96] (equality) axioms. *) +(* English : *) +(* Refs : [Wos96] Wos (1996), The Automation of Reasoning: An Experiment *) +(* Source : [OTTER] *) +(* Names : groups.exp3.in part 1 [OTTER] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_order3: + \forall Univ:Set. +\forall a:Univ. +\forall identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (multiply (multiply X (multiply (multiply X Y) Z)) (multiply identity (multiply Z Z)))) Y.eq Univ (multiply a (multiply a a)) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP116-1.p.ma b/matita/tests/TPTP/Veloci/GRP116-1.p.ma new file mode 100644 index 000000000..3cc4b5719 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP116-1.p.ma @@ -0,0 +1,36 @@ +set "baseuri" "cic:/matita/TPTP/GRP116-1". +include "logic/equality.ma". +(* Inclusion of: GRP116-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP116-1 : TPTP v3.1.1. Released v1.2.0. *) +(* Domain : Group Theory *) +(* Problem : Derive left identity from a single axiom for groups order 3 *) +(* Version : [Wos96] (equality) axioms. *) +(* English : *) +(* Refs : [Wos96] Wos (1996), The Automation of Reasoning: An Experiment *) +(* Source : [OTTER] *) +(* Names : groups.exp3.in part 2 [OTTER] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_order3: + \forall Univ:Set. +\forall a:Univ. +\forall identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (multiply (multiply X (multiply (multiply X Y) Z)) (multiply identity (multiply Z Z)))) Y.eq Univ (multiply identity a) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP117-1.p.ma b/matita/tests/TPTP/Veloci/GRP117-1.p.ma new file mode 100644 index 000000000..8768d0eab --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP117-1.p.ma @@ -0,0 +1,36 @@ +set "baseuri" "cic:/matita/TPTP/GRP117-1". +include "logic/equality.ma". +(* Inclusion of: GRP117-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP117-1 : TPTP v3.1.1. Released v1.2.0. *) +(* Domain : Group Theory *) +(* Problem : Derive right identity from a single axiom for groups order 3 *) +(* Version : [Wos96] (equality) axioms. *) +(* English : *) +(* Refs : [Wos96] Wos (1996), The Automation of Reasoning: An Experiment *) +(* Source : [OTTER] *) +(* Names : groups.exp3.in part 3 [OTTER] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_order3: + \forall Univ:Set. +\forall a:Univ. +\forall identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (multiply (multiply X (multiply (multiply X Y) Z)) (multiply identity (multiply Z Z)))) Y.eq Univ (multiply a identity) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP118-1.p.ma b/matita/tests/TPTP/Veloci/GRP118-1.p.ma new file mode 100644 index 000000000..4d01353ea --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP118-1.p.ma @@ -0,0 +1,38 @@ +set "baseuri" "cic:/matita/TPTP/GRP118-1". +include "logic/equality.ma". +(* Inclusion of: GRP118-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP118-1 : TPTP v3.1.1. Released v1.2.0. *) +(* Domain : Group Theory *) +(* Problem : Derive associativity from a single axiom for groups order 3 *) +(* Version : [Wos96] (equality) axioms. *) +(* English : *) +(* Refs : [Wos96] Wos (1996), The Automation of Reasoning: An Experiment *) +(* Source : [OTTER] *) +(* Names : groups.exp3.in part 4 [OTTER] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_order3: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall identity:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (multiply (multiply X (multiply (multiply X Y) Z)) (multiply identity (multiply Z Z)))) Y.eq Univ (multiply (multiply a b) c) (multiply a (multiply b c)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP136-1.p.ma b/matita/tests/TPTP/Veloci/GRP136-1.p.ma new file mode 100644 index 000000000..e108ae55b --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP136-1.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP136-1". +include "logic/equality.ma". +(* Inclusion of: GRP136-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP136-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove anti-symmetry axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original anti-symmetry axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_antisyma [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_antisyma: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (least_upper_bound a b) a. +\forall H1:eq Univ (least_upper_bound a b) b. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ a b +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP137-1.p.ma b/matita/tests/TPTP/Veloci/GRP137-1.p.ma new file mode 100644 index 000000000..322702cc5 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP137-1.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP137-1". +include "logic/equality.ma". +(* Inclusion of: GRP137-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP137-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove anti-symmetry axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original anti-symmetry axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_antisymb [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_antisymb: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (greatest_lower_bound a b) b. +\forall H1:eq Univ (greatest_lower_bound a b) a. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ a b +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP139-1.p.ma b/matita/tests/TPTP/Veloci/GRP139-1.p.ma new file mode 100644 index 000000000..cf868c306 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP139-1.p.ma @@ -0,0 +1,122 @@ +set "baseuri" "cic:/matita/TPTP/GRP139-1". +include "logic/equality.ma". +(* Inclusion of: GRP139-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP139-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove greatest lower-bound axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original axiom of anti-symmetry from *) +(* the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_glb1b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_glb1b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (greatest_lower_bound b c) c. +\forall H1:eq Univ (greatest_lower_bound a c) c. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound (greatest_lower_bound a b) c) c +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP141-1.p.ma b/matita/tests/TPTP/Veloci/GRP141-1.p.ma new file mode 100644 index 000000000..3706a25d7 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP141-1.p.ma @@ -0,0 +1,122 @@ +set "baseuri" "cic:/matita/TPTP/GRP141-1". +include "logic/equality.ma". +(* Inclusion of: GRP141-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP141-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove greatest lower-bound axiom using a transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original greatest lower-bound axiom *) +(* from the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_glb1d [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_glb1d: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (least_upper_bound b c) b. +\forall H1:eq Univ (least_upper_bound a c) a. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound (greatest_lower_bound a b) c) c +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP142-1.p.ma b/matita/tests/TPTP/Veloci/GRP142-1.p.ma new file mode 100644 index 000000000..1f13705e1 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP142-1.p.ma @@ -0,0 +1,117 @@ +set "baseuri" "cic:/matita/TPTP/GRP142-1". +include "logic/equality.ma". +(* Inclusion of: GRP142-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP142-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove greatest lower-bound axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original greatest lower-bound axiom *) +(* from the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_glb2a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_glb2a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (greatest_lower_bound a b) a) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP143-1.p.ma b/matita/tests/TPTP/Veloci/GRP143-1.p.ma new file mode 100644 index 000000000..be00186ae --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP143-1.p.ma @@ -0,0 +1,117 @@ +set "baseuri" "cic:/matita/TPTP/GRP143-1". +include "logic/equality.ma". +(* Inclusion of: GRP143-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP143-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove greatest lower-bound axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original greatest lower-bound axiom *) +(* from the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_glb2b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_glb2b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound (greatest_lower_bound a b) a) (greatest_lower_bound a b) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP144-1.p.ma b/matita/tests/TPTP/Veloci/GRP144-1.p.ma new file mode 100644 index 000000000..be20f1901 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP144-1.p.ma @@ -0,0 +1,117 @@ +set "baseuri" "cic:/matita/TPTP/GRP144-1". +include "logic/equality.ma". +(* Inclusion of: GRP144-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP144-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove greatest lower-bound axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original greatest lower-bound axiom *) +(* from the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_glb3a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_glb3a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (greatest_lower_bound a b) b) b +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP145-1.p.ma b/matita/tests/TPTP/Veloci/GRP145-1.p.ma new file mode 100644 index 000000000..032cdfd55 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP145-1.p.ma @@ -0,0 +1,117 @@ +set "baseuri" "cic:/matita/TPTP/GRP145-1". +include "logic/equality.ma". +(* Inclusion of: GRP145-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP145-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove greatest lower-bound axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original greatest lower-bound axiom *) +(* from the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_glb3b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_glb3b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound (greatest_lower_bound a b) b) (greatest_lower_bound a b) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP146-1.p.ma b/matita/tests/TPTP/Veloci/GRP146-1.p.ma new file mode 100644 index 000000000..6bacee188 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP146-1.p.ma @@ -0,0 +1,122 @@ +set "baseuri" "cic:/matita/TPTP/GRP146-1". +include "logic/equality.ma". +(* Inclusion of: GRP146-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP146-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove least upper-bound axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original least upper-bound axiom from *) +(* the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_lub1a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_lub1a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (least_upper_bound b c) c. +\forall H1:eq Univ (least_upper_bound a c) c. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (least_upper_bound a b) c) c +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP149-1.p.ma b/matita/tests/TPTP/Veloci/GRP149-1.p.ma new file mode 100644 index 000000000..e6c7d4ff6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP149-1.p.ma @@ -0,0 +1,122 @@ +set "baseuri" "cic:/matita/TPTP/GRP149-1". +include "logic/equality.ma". +(* Inclusion of: GRP149-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP149-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove least upper-bound axiom using a transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original least upper-bound axiom from *) +(* the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_lub1d [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_lub1d: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (greatest_lower_bound b c) b. +\forall H1:eq Univ (greatest_lower_bound a c) a. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (least_upper_bound a b) c) c +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP150-1.p.ma b/matita/tests/TPTP/Veloci/GRP150-1.p.ma new file mode 100644 index 000000000..f612ede8e --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP150-1.p.ma @@ -0,0 +1,117 @@ +set "baseuri" "cic:/matita/TPTP/GRP150-1". +include "logic/equality.ma". +(* Inclusion of: GRP150-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP150-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove least upper-bound axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original least upper-bound axiom from *) +(* the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_lub2a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_lub2a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound a (least_upper_bound a b)) (least_upper_bound a b) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP151-1.p.ma b/matita/tests/TPTP/Veloci/GRP151-1.p.ma new file mode 100644 index 000000000..240c266b2 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP151-1.p.ma @@ -0,0 +1,117 @@ +set "baseuri" "cic:/matita/TPTP/GRP151-1". +include "logic/equality.ma". +(* Inclusion of: GRP151-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP151-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove least upper-bound axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original least upper-bound axiom from *) +(* the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_lub2b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_lub2b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound a (least_upper_bound a b)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP152-1.p.ma b/matita/tests/TPTP/Veloci/GRP152-1.p.ma new file mode 100644 index 000000000..d9078e5fb --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP152-1.p.ma @@ -0,0 +1,117 @@ +set "baseuri" "cic:/matita/TPTP/GRP152-1". +include "logic/equality.ma". +(* Inclusion of: GRP152-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP152-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove least upper-bound axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original least upper-bound axiom from *) +(* the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_lub3a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_lub3a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound b (least_upper_bound a b)) (least_upper_bound a b) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP153-1.p.ma b/matita/tests/TPTP/Veloci/GRP153-1.p.ma new file mode 100644 index 000000000..7dc86aa7e --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP153-1.p.ma @@ -0,0 +1,117 @@ +set "baseuri" "cic:/matita/TPTP/GRP153-1". +include "logic/equality.ma". +(* Inclusion of: GRP153-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP153-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove least upper-bound axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original least upper-bound axiom from *) +(* the equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_lub3b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_lub3b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound b (least_upper_bound a b)) b +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP154-1.p.ma b/matita/tests/TPTP/Veloci/GRP154-1.p.ma new file mode 100644 index 000000000..51832886c --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP154-1.p.ma @@ -0,0 +1,121 @@ +set "baseuri" "cic:/matita/TPTP/GRP154-1". +include "logic/equality.ma". +(* Inclusion of: GRP154-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP154-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove monotonicity axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original mononicity axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_mono1a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_mono1a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (least_upper_bound a b) b. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (multiply a c) (multiply b c)) (multiply b c) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP155-1.p.ma b/matita/tests/TPTP/Veloci/GRP155-1.p.ma new file mode 100644 index 000000000..7a940e531 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP155-1.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP155-1". +include "logic/equality.ma". +(* Inclusion of: GRP155-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP155-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove monotonicity axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original monotonicity axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_mono1b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_mono1b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (greatest_lower_bound a b) a. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound (multiply a c) (multiply b c)) (multiply a c) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP156-1.p.ma b/matita/tests/TPTP/Veloci/GRP156-1.p.ma new file mode 100644 index 000000000..544290f56 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP156-1.p.ma @@ -0,0 +1,121 @@ +set "baseuri" "cic:/matita/TPTP/GRP156-1". +include "logic/equality.ma". +(* Inclusion of: GRP156-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP156-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove monotonicity axiom using a transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original monotonicity axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_mono1c [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_mono1c: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (least_upper_bound a b) b. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound (multiply a c) (multiply b c)) (multiply a c) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP157-1.p.ma b/matita/tests/TPTP/Veloci/GRP157-1.p.ma new file mode 100644 index 000000000..63868e1bf --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP157-1.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP157-1". +include "logic/equality.ma". +(* Inclusion of: GRP157-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP157-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove monotonicity axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original monotonicity axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_mono2a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_mono2a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (least_upper_bound a b) b. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (multiply c a) (multiply c b)) (multiply c b) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP158-1.p.ma b/matita/tests/TPTP/Veloci/GRP158-1.p.ma new file mode 100644 index 000000000..710c30a1b --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP158-1.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP158-1". +include "logic/equality.ma". +(* Inclusion of: GRP158-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP158-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove monotonicity axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original monotonicity axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_mono2b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_mono2b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (greatest_lower_bound a b) a. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound (multiply c a) (multiply c b)) (multiply c a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP159-1.p.ma b/matita/tests/TPTP/Veloci/GRP159-1.p.ma new file mode 100644 index 000000000..ca0b0ffdf --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP159-1.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP159-1". +include "logic/equality.ma". +(* Inclusion of: GRP159-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP159-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove monotonicity axiom using a transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original monotonicity axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_mono2c [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_mono2c: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (greatest_lower_bound a b) a. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (multiply c a) (multiply c b)) (multiply c b) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP160-1.p.ma b/matita/tests/TPTP/Veloci/GRP160-1.p.ma new file mode 100644 index 000000000..1d49bcea1 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP160-1.p.ma @@ -0,0 +1,116 @@ +set "baseuri" "cic:/matita/TPTP/GRP160-1". +include "logic/equality.ma". +(* Inclusion of: GRP160-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP160-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove reflexivity axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original reflexivity axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_refla [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 2 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_refla: + \forall Univ:Set. +\forall a:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound a a) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP161-1.p.ma b/matita/tests/TPTP/Veloci/GRP161-1.p.ma new file mode 100644 index 000000000..ff4878fbc --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP161-1.p.ma @@ -0,0 +1,116 @@ +set "baseuri" "cic:/matita/TPTP/GRP161-1". +include "logic/equality.ma". +(* Inclusion of: GRP161-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP161-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove reflexivity axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original reflexivity axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_reflb [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 2 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_reflb: + \forall Univ:Set. +\forall a:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound a a) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP162-1.p.ma b/matita/tests/TPTP/Veloci/GRP162-1.p.ma new file mode 100644 index 000000000..4d4fa4e5e --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP162-1.p.ma @@ -0,0 +1,120 @@ +set "baseuri" "cic:/matita/TPTP/GRP162-1". +include "logic/equality.ma". +(* Inclusion of: GRP162-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP162-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove transitivity axiom using the LUB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original transitivity axiom from the *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_transa [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_transa: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (least_upper_bound b c) c. +\forall H1:eq Univ (least_upper_bound a b) b. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound a c) c +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP163-1.p.ma b/matita/tests/TPTP/Veloci/GRP163-1.p.ma new file mode 100644 index 000000000..3065332b9 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP163-1.p.ma @@ -0,0 +1,120 @@ +set "baseuri" "cic:/matita/TPTP/GRP163-1". +include "logic/equality.ma". +(* Inclusion of: GRP163-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP163-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Prove transitivity axiom using the GLB transformation *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : This problem proves the original transitivity axiom from *) +(* equational axiomatization. *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : ax_transb [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_ax_transb: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (greatest_lower_bound b c) b. +\forall H1:eq Univ (greatest_lower_bound a b) a. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound a c) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP168-1.p.ma b/matita/tests/TPTP/Veloci/GRP168-1.p.ma new file mode 100644 index 000000000..905257851 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP168-1.p.ma @@ -0,0 +1,123 @@ +set "baseuri" "cic:/matita/TPTP/GRP168-1". +include "logic/equality.ma". +(* Inclusion of: GRP168-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP168-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Inner group autobatchmorphisms are order preserving *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* : [Dah95] Dahn (1995), Email to G. Sutcliffe *) +(* Source : [Sch95] *) +(* Names : p01a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c *) +(* : [Dah95] says "Not difficult by monotony. Sometimes useful *) +(* for transforming inequalities." *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p01a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (least_upper_bound a b) b. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (multiply (inverse c) (multiply a c)) (multiply (inverse c) (multiply b c))) (multiply (inverse c) (multiply b c)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP168-2.p.ma b/matita/tests/TPTP/Veloci/GRP168-2.p.ma new file mode 100644 index 000000000..8e6697270 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP168-2.p.ma @@ -0,0 +1,121 @@ +set "baseuri" "cic:/matita/TPTP/GRP168-2". +include "logic/equality.ma". +(* Inclusion of: GRP168-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP168-2 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Inner group autobatchmorphisms are order preserving *) +(* Version : [Fuc94] (equality) axioms. *) +(* Theorem formulation : Dual. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : p01b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p01b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (greatest_lower_bound a b) a. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound (multiply (inverse c) (multiply a c)) (multiply (inverse c) (multiply b c))) (multiply (inverse c) (multiply a c)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP173-1.p.ma b/matita/tests/TPTP/Veloci/GRP173-1.p.ma new file mode 100644 index 000000000..d6b61595c --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP173-1.p.ma @@ -0,0 +1,122 @@ +set "baseuri" "cic:/matita/TPTP/GRP173-1". +include "logic/equality.ma". +(* Inclusion of: GRP173-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP173-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Each subgroup of negative elements is trivial *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* : [Dah95] Dahn (1995), Email to G. Sutcliffe *) +(* Source : [Sch95] *) +(* Names : p05a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 2 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a *) +(* : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a *) +(* : [Dah95] says "The proof is not difficult but combines group *) +(* theory, lattice theory and monotonicity." *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p05a: + \forall Univ:Set. +\forall a:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (least_upper_bound identity (inverse a)) identity. +\forall H1:eq Univ (least_upper_bound identity a) identity. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ identity a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP174-1.p.ma b/matita/tests/TPTP/Veloci/GRP174-1.p.ma new file mode 100644 index 000000000..bd8fecc10 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP174-1.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP174-1". +include "logic/equality.ma". +(* Inclusion of: GRP174-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP174-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Each subgroup of positive elements is trivial *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : p05b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 18 ( 0 non-Horn; 18 unit; 3 RR) *) +(* Number of atoms : 18 ( 18 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 2 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a *) +(* : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p05b: + \forall Univ:Set. +\forall a:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (greatest_lower_bound identity (inverse a)) (inverse a). +\forall H1:eq Univ (greatest_lower_bound identity a) a. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H8:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H9:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H15:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H16:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ identity a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP176-1.p.ma b/matita/tests/TPTP/Veloci/GRP176-1.p.ma new file mode 100644 index 000000000..fe03f9f02 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP176-1.p.ma @@ -0,0 +1,125 @@ +set "baseuri" "cic:/matita/TPTP/GRP176-1". +include "logic/equality.ma". +(* Inclusion of: GRP176-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP176-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : General form of distributivity *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* : [Dah95] Dahn (1995), Email to G. Sutcliffe *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 5 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c > d *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c > d *) +(* : This is a standardized version of the problem that appears in *) +(* [Sch95]. *) +(* : [Dah95] says "Easy from equational axioms, More difficult from *) +(* monotonicity. The assumtion is a consequence of group theory." *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p07: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall d:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (multiply c (multiply (least_upper_bound a b) d)) (least_upper_bound (multiply c (multiply a d)) (multiply c (multiply b d))) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP176-2.p.ma b/matita/tests/TPTP/Veloci/GRP176-2.p.ma new file mode 100644 index 000000000..153ac5806 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP176-2.p.ma @@ -0,0 +1,121 @@ +set "baseuri" "cic:/matita/TPTP/GRP176-2". +include "logic/equality.ma". +(* Inclusion of: GRP176-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP176-2 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : General form of distributivity *) +(* Version : [Fuc94] (equality) axioms : Augmented. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : p07 [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 1 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 5 constant; 0-2 arity) *) +(* Number of variables : 35 ( 2 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b > c > d *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b > c > d *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p07: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall d:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (inverse (multiply X Y)) (multiply (inverse Y) (inverse X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (multiply c (multiply (least_upper_bound a b) d)) (least_upper_bound (multiply c (multiply a d)) (multiply c (multiply b d))) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP182-1.p.ma b/matita/tests/TPTP/Veloci/GRP182-1.p.ma new file mode 100644 index 000000000..b2166c28f --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP182-1.p.ma @@ -0,0 +1,127 @@ +set "baseuri" "cic:/matita/TPTP/GRP182-1". +include "logic/equality.ma". +(* Inclusion of: GRP182-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP182-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Positive part of the negative part is identity *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* : [Dah95] Dahn (1995), Email to G. Sutcliffe *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 2 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a *) +(* : This is a standardized version of the problem that appears in *) +(* [Sch95]. *) +(* : The theorem clause has been modified according to instructions *) +(* in [Dah95]. *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----This is Schulz's clause *) +(* input_clause(prove_p17a,negated_conjecture, *) +(* [--equal(least_upper_bound(identity,least_upper_bound(a,identity)), *) +(* least_upper_bound(a,identity))]). *) +(* ----This is Dahn's clause *) +theorem prove_p17a: + \forall Univ:Set. +\forall a:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound identity (greatest_lower_bound a identity)) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP182-2.p.ma b/matita/tests/TPTP/Veloci/GRP182-2.p.ma new file mode 100644 index 000000000..f8955ab0e --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP182-2.p.ma @@ -0,0 +1,128 @@ +set "baseuri" "cic:/matita/TPTP/GRP182-2". +include "logic/equality.ma". +(* Inclusion of: GRP182-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP182-2 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Positive part of the negative part is identity *) +(* Version : [Fuc94] (equality) axioms : Augmented. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* : [Dah95] Dahn (1995), Email to G. Sutcliffe *) +(* Source : [Sch95] *) +(* Names : p17a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 19 ( 0 non-Horn; 19 unit; 2 RR) *) +(* Number of atoms : 19 ( 19 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 2 constant; 0-2 arity) *) +(* Number of variables : 36 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a *) +(* : The theorem clause has been modified according to instructions *) +(* in [Dah95]. *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----This is Schulz's clause *) +(* input_clause(prove_p17a,negated_conjecture, *) +(* [--equal(least_upper_bound(identity,least_upper_bound(a,identity)), *) +(* least_upper_bound(a,identity))]). *) +(* ----This is Dahn's clause *) +theorem prove_p17a: + \forall Univ:Set. +\forall a:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (inverse (multiply X Y)) (multiply (inverse Y) (inverse X)). +\forall H1:\forall X:Univ.eq Univ (inverse (inverse X)) X. +\forall H2:eq Univ (inverse identity) identity. +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H9:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H10:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H15:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H16:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H17:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound identity (greatest_lower_bound a identity)) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP182-3.p.ma b/matita/tests/TPTP/Veloci/GRP182-3.p.ma new file mode 100644 index 000000000..fa4e6ce23 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP182-3.p.ma @@ -0,0 +1,120 @@ +set "baseuri" "cic:/matita/TPTP/GRP182-3". +include "logic/equality.ma". +(* Inclusion of: GRP182-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP182-3 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Positive part of the negative part is identity *) +(* Version : [Fuc94] (equality) axioms. *) +(* Theorem formulation : Dual. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 2 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a *) +(* : This is a standardized version of the problem that appears in *) +(* [Sch95]. *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p17b: + \forall Univ:Set. +\forall a:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound identity (least_upper_bound a identity)) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP182-4.p.ma b/matita/tests/TPTP/Veloci/GRP182-4.p.ma new file mode 100644 index 000000000..95fb312fb --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP182-4.p.ma @@ -0,0 +1,121 @@ +set "baseuri" "cic:/matita/TPTP/GRP182-4". +include "logic/equality.ma". +(* Inclusion of: GRP182-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP182-4 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Positive part of the negative part is identity *) +(* Version : [Fuc94] (equality) axioms : Augmented. *) +(* Theorem formulation : Dual. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : p17b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 19 ( 0 non-Horn; 19 unit; 2 RR) *) +(* Number of atoms : 19 ( 19 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 2 constant; 0-2 arity) *) +(* Number of variables : 36 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a *) +(* : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p17b: + \forall Univ:Set. +\forall a:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (inverse (multiply X Y)) (multiply (inverse Y) (inverse X)). +\forall H1:\forall X:Univ.eq Univ (inverse (inverse X)) X. +\forall H2:eq Univ (inverse identity) identity. +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H9:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H10:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H15:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H16:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H17:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound identity (least_upper_bound a identity)) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP186-3.p.ma b/matita/tests/TPTP/Veloci/GRP186-3.p.ma new file mode 100644 index 000000000..a39543178 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP186-3.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP186-3". +include "logic/equality.ma". +(* Inclusion of: GRP186-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP186-3 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Application of distributivity and group theory *) +(* Version : [Fuc94] (equality) axioms. *) +(* Theorem formulation : Switched from GLB to LUB. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* : This is a standardized version of the problem that appears in *) +(* [Sch95]. *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p23x: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (multiply a b) identity) (multiply a (least_upper_bound (inverse a) b)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP186-4.p.ma b/matita/tests/TPTP/Veloci/GRP186-4.p.ma new file mode 100644 index 000000000..be8354b19 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP186-4.p.ma @@ -0,0 +1,120 @@ +set "baseuri" "cic:/matita/TPTP/GRP186-4". +include "logic/equality.ma". +(* Inclusion of: GRP186-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP186-4 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Application of distributivity and group theory *) +(* Version : [Fuc94] (equality) axioms : Augmented. *) +(* Theorem formulation : Switched from GLB to LUB. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : p23x [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 19 ( 0 non-Horn; 19 unit; 2 RR) *) +(* Number of atoms : 19 ( 19 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 36 ( 2 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p23x: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (inverse (multiply X Y)) (multiply (inverse Y) (inverse X)). +\forall H1:\forall X:Univ.eq Univ (inverse (inverse X)) X. +\forall H2:eq Univ (inverse identity) identity. +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H9:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H10:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H15:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H16:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H17:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound (multiply a b) identity) (multiply a (least_upper_bound (inverse a) b)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP188-1.p.ma b/matita/tests/TPTP/Veloci/GRP188-1.p.ma new file mode 100644 index 000000000..da64fdee3 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP188-1.p.ma @@ -0,0 +1,118 @@ +set "baseuri" "cic:/matita/TPTP/GRP188-1". +include "logic/equality.ma". +(* Inclusion of: GRP188-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP188-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Consequence of lattice theory *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b *) +(* : This is a standardized version of the problem that appears in *) +(* [Sch95]. *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p38a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound b (least_upper_bound a b)) (least_upper_bound a b) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP188-2.p.ma b/matita/tests/TPTP/Veloci/GRP188-2.p.ma new file mode 100644 index 000000000..771056e01 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP188-2.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP188-2". +include "logic/equality.ma". +(* Inclusion of: GRP188-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP188-2 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Consequence of lattice theory *) +(* Version : [Fuc94] (equality) axioms : Augmented. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : p38a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 19 ( 0 non-Horn; 19 unit; 2 RR) *) +(* Number of atoms : 19 ( 19 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 36 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p38a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (inverse (multiply X Y)) (multiply (inverse Y) (inverse X)). +\forall H1:\forall X:Univ.eq Univ (inverse (inverse X)) X. +\forall H2:eq Univ (inverse identity) identity. +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H9:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H10:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H15:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H16:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H17:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (least_upper_bound b (least_upper_bound a b)) (least_upper_bound a b) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP189-1.p.ma b/matita/tests/TPTP/Veloci/GRP189-1.p.ma new file mode 100644 index 000000000..183e7b772 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP189-1.p.ma @@ -0,0 +1,118 @@ +set "baseuri" "cic:/matita/TPTP/GRP189-1". +include "logic/equality.ma". +(* Inclusion of: GRP189-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP189-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Consequence of lattice theory *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b *) +(* : This is a standardized version of the problem that appears in *) +(* [Sch95]. *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p38b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H6:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H7:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H13:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H14:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound b (least_upper_bound a b)) b +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP189-2.p.ma b/matita/tests/TPTP/Veloci/GRP189-2.p.ma new file mode 100644 index 000000000..0b47a1614 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP189-2.p.ma @@ -0,0 +1,119 @@ +set "baseuri" "cic:/matita/TPTP/GRP189-2". +include "logic/equality.ma". +(* Inclusion of: GRP189-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP189-2 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Consequence of lattice theory *) +(* Version : [Fuc94] (equality) axioms : Augmented. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : p38b [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 19 ( 0 non-Horn; 19 unit; 2 RR) *) +(* Number of atoms : 19 ( 19 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 36 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO greatest_lower_bound > least_upper_bound > *) +(* inverse > product > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p38b: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (inverse (multiply X Y)) (multiply (inverse Y) (inverse X)). +\forall H1:\forall X:Univ.eq Univ (inverse (inverse X)) X. +\forall H2:eq Univ (inverse identity) identity. +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H9:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H10:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H14:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H15:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H16:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H17:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (greatest_lower_bound b (least_upper_bound a b)) b +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP192-1.p.ma b/matita/tests/TPTP/Veloci/GRP192-1.p.ma new file mode 100644 index 000000000..01ca783b0 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP192-1.p.ma @@ -0,0 +1,118 @@ +set "baseuri" "cic:/matita/TPTP/GRP192-1". +include "logic/equality.ma". +(* Inclusion of: GRP192-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP192-1 : TPTP v3.1.1. Bugfixed v1.2.1. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Problem : Even elements implies trivial group *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : The assumption all(X,1 =< X) even implies that the group is *) +(* trivial, i.e., all(X, X = 1). *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : p40a [Sch95] *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.2.1, 0.33 v2.2.0, 0.43 v2.1.0, 0.14 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 1 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 34 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : ORDERING LPO inverse > product > greatest_lower_bound > *) +(* least_upper_bound > identity > a > b *) +(* Bugfixes : v1.2.1 - Duplicate axioms in GRP004-2.ax removed. *) +(* -------------------------------------------------------------------------- *) +(* ----Include equality group theory axioms *) +(* Inclusion of: Axioms/GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Group Theory *) +(* Axioms : Group theory (equality) axioms *) +(* Version : [MOW76] (equality) axioms : *) +(* Reduced > Complete. *) +(* English : *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : [MOW76] also contains redundant right_identity and *) +(* right_inverse axioms. *) +(* : These axioms are also used in [Wos88] p.186, also with *) +(* right_identity and right_inverse. *) +(* -------------------------------------------------------------------------- *) +(* ----For any x and y in the group x*y is also in the group. No clause *) +(* ----is needed here since this is an instance of reflexivity *) +(* ----There exists an identity element *) +(* ----For any x in the group, there exists an element y such that x*y = y*x *) +(* ----= identity. *) +(* ----The operation '*' is associative *) +(* -------------------------------------------------------------------------- *) +(* ----Include Lattice ordered group (equality) axioms *) +(* Inclusion of: Axioms/GRP004-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : GRP004-2 : TPTP v3.1.1. Bugfixed v1.2.0. *) +(* Domain : Group Theory (Lattice Ordered) *) +(* Axioms : Lattice ordered group (equality) axioms *) +(* Version : [Fuc94] (equality) axioms. *) +(* English : *) +(* Refs : [Fuc94] Fuchs (1994), The Application of Goal-Orientated Heuri *) +(* : [Sch95] Schulz (1995), Explanation Based Learning for Distribu *) +(* Source : [Sch95] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 0 RR) *) +(* Number of literals : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 0 constant; 2-2 arity) *) +(* Number of variables : 28 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Requires GRP004-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Specification of the least upper bound and greatest lower bound *) +(* ----Monotony of multiply *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_p40a: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall greatest_lower_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall least_upper_bound:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (least_upper_bound identity X) X. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (greatest_lower_bound Y Z) X) (greatest_lower_bound (multiply Y X) (multiply Z X)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (least_upper_bound Y Z) X) (least_upper_bound (multiply Y X) (multiply Z X)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (greatest_lower_bound Y Z)) (greatest_lower_bound (multiply X Y) (multiply X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (least_upper_bound Y Z)) (least_upper_bound (multiply X Y) (multiply X Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X (least_upper_bound X Y)) X. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X (greatest_lower_bound X Y)) X. +\forall H7:\forall X:Univ.eq Univ (greatest_lower_bound X X) X. +\forall H8:\forall X:Univ.eq Univ (least_upper_bound X X) X. +\forall H9:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (least_upper_bound X (least_upper_bound Y Z)) (least_upper_bound (least_upper_bound X Y) Z). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (greatest_lower_bound X (greatest_lower_bound Y Z)) (greatest_lower_bound (greatest_lower_bound X Y) Z). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (least_upper_bound X Y) (least_upper_bound Y X). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (greatest_lower_bound X Y) (greatest_lower_bound Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H14:\forall X:Univ.eq Univ (multiply (inverse X) X) identity. +\forall H15:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP206-1.p.ma b/matita/tests/TPTP/Veloci/GRP206-1.p.ma new file mode 100644 index 000000000..9c5b5bcce --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP206-1.p.ma @@ -0,0 +1,53 @@ +set "baseuri" "cic:/matita/TPTP/GRP206-1". +include "logic/equality.ma". +(* Inclusion of: GRP206-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP206-1 : TPTP v3.1.1. Released v2.3.0. *) +(* Domain : Group Theory (Loops) *) +(* Problem : In Loops, Moufang-4 => Moufang-1. *) +(* Version : [MP96] (equality) axioms. *) +(* English : *) +(* Refs : [Wos96] Wos (1996), OTTER and the Moufang Identity Problem *) +(* Source : [Wos96] *) +(* Names : - [Wos96] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.3.0 *) +(* Syntax : Number of clauses : 10 ( 0 non-Horn; 10 unit; 1 RR) *) +(* Number of atoms : 10 ( 10 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 4 constant; 0-2 arity) *) +(* Number of variables : 15 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Loop axioms: *) +(* ----Moufang-4 *) +(* ----Denial of Moufang-1 *) +theorem prove_moufang1: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall identity:Univ. +\forall left_division:\forall _:Univ.\forall _:Univ.Univ. +\forall left_inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall right_division:\forall _:Univ.\forall _:Univ.Univ. +\forall right_inverse:\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (multiply (multiply Y Z) X)) (multiply (multiply X Y) (multiply Z X)). +\forall H1:\forall X:Univ.eq Univ (multiply (left_inverse X) X) identity. +\forall H2:\forall X:Univ.eq Univ (multiply X (right_inverse X)) identity. +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (right_division (multiply X Y) Y) X. +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (right_division X Y) Y) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (left_division X (multiply X Y)) Y. +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X (left_division X Y)) Y. +\forall H7:\forall X:Univ.eq Univ (multiply X identity) X. +\forall H8:\forall X:Univ.eq Univ (multiply identity X) X.eq Univ (multiply (multiply a (multiply b c)) a) (multiply (multiply a b) (multiply c a)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP454-1.p.ma b/matita/tests/TPTP/Veloci/GRP454-1.p.ma new file mode 100644 index 000000000..257fdd49a --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP454-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP454-1". +include "logic/equality.ma". +(* Inclusion of: GRP454-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP454-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 8 ( 2 average) *) +(* Comments : A UEQ part of GRP066-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide A (divide B (divide (divide (divide A A) A) C)))) C) B.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP455-1.p.ma b/matita/tests/TPTP/Veloci/GRP455-1.p.ma new file mode 100644 index 000000000..deaa9a2f0 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP455-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP455-1". +include "logic/equality.ma". +(* Inclusion of: GRP455-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP455-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 8 ( 2 average) *) +(* Comments : A UEQ part of GRP066-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide A (divide B (divide (divide (divide A A) A) C)))) C) B.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP456-1.p.ma b/matita/tests/TPTP/Veloci/GRP456-1.p.ma new file mode 100644 index 000000000..228a4f3a6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP456-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP456-1". +include "logic/equality.ma". +(* Inclusion of: GRP456-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP456-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in division and identity, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 8 ( 3 average) *) +(* Comments : A UEQ part of GRP066-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide A (divide B (divide (divide (divide A A) A) C)))) C) B.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP457-1.p.ma b/matita/tests/TPTP/Veloci/GRP457-1.p.ma new file mode 100644 index 000000000..acd2050d2 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP457-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP457-1". +include "logic/equality.ma". +(* Inclusion of: GRP457-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP457-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 7 ( 2 average) *) +(* Comments : A UEQ part of GRP067-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide (divide A A) (divide A (divide B (divide (divide identity A) C)))) C) B.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP458-1.p.ma b/matita/tests/TPTP/Veloci/GRP458-1.p.ma new file mode 100644 index 000000000..44091f50e --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP458-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP458-1". +include "logic/equality.ma". +(* Inclusion of: GRP458-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP458-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 7 ( 2 average) *) +(* Comments : A UEQ part of GRP067-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide (divide A A) (divide A (divide B (divide (divide identity A) C)))) C) B.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP459-1.p.ma b/matita/tests/TPTP/Veloci/GRP459-1.p.ma new file mode 100644 index 000000000..303f73741 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP459-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP459-1". +include "logic/equality.ma". +(* Inclusion of: GRP459-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP459-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in division and identity, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP067-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide (divide A A) (divide A (divide B (divide (divide identity A) C)))) C) B.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP460-1.p.ma b/matita/tests/TPTP/Veloci/GRP460-1.p.ma new file mode 100644 index 000000000..698ac8a23 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP460-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP460-1". +include "logic/equality.ma". +(* Inclusion of: GRP460-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP460-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP068-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide A (divide (divide (divide identity B) C) (divide (divide (divide A A) A) C))) B.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP463-1.p.ma b/matita/tests/TPTP/Veloci/GRP463-1.p.ma new file mode 100644 index 000000000..fcd04c0c5 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP463-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP463-1". +include "logic/equality.ma". +(* Inclusion of: GRP463-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP463-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP069-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide A (divide (divide (divide (divide A A) B) C) (divide (divide identity A) C))) B.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP467-1.p.ma b/matita/tests/TPTP/Veloci/GRP467-1.p.ma new file mode 100644 index 000000000..1107f4b98 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP467-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP467-1". +include "logic/equality.ma". +(* Inclusion of: GRP467-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP467-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in division and inverse, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 6 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : A UEQ part of GRP070-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (inverse B)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.\forall D:Univ.eq Univ (divide (divide A A) (divide B (divide (divide C (divide D B)) (inverse D)))) C.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP481-1.p.ma b/matita/tests/TPTP/Veloci/GRP481-1.p.ma new file mode 100644 index 000000000..bf063d591 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP481-1.p.ma @@ -0,0 +1,42 @@ +set "baseuri" "cic:/matita/TPTP/GRP481-1". +include "logic/equality.ma". +(* Inclusion of: GRP481-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP481-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [Neu86] Neumann (1986), Yet Another Single Law for Groups *) +(* : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 7 ( 2 average) *) +(* Comments : A UEQ part of GRP075-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.\forall D:Univ.eq Univ (double_divide (double_divide (double_divide A (double_divide B identity)) (double_divide (double_divide C (double_divide D (double_divide D identity))) (double_divide A identity))) B) C.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP484-1.p.ma b/matita/tests/TPTP/Veloci/GRP484-1.p.ma new file mode 100644 index 000000000..e8588f917 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP484-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP484-1". +include "logic/equality.ma". +(* Inclusion of: GRP484-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP484-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP076-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide (double_divide A B) C) (double_divide B identity))) (double_divide identity identity)) C.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP485-1.p.ma b/matita/tests/TPTP/Veloci/GRP485-1.p.ma new file mode 100644 index 000000000..2a015e13e --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP485-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP485-1". +include "logic/equality.ma". +(* Inclusion of: GRP485-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP485-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP076-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide (double_divide A B) C) (double_divide B identity))) (double_divide identity identity)) C.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP486-1.p.ma b/matita/tests/TPTP/Veloci/GRP486-1.p.ma new file mode 100644 index 000000000..ccdaf0ea9 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP486-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP486-1". +include "logic/equality.ma". +(* Inclusion of: GRP486-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP486-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : A UEQ part of GRP076-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide (double_divide A B) C) (double_divide B identity))) (double_divide identity identity)) C.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP487-1.p.ma b/matita/tests/TPTP/Veloci/GRP487-1.p.ma new file mode 100644 index 000000000..a26acef17 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP487-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP487-1". +include "logic/equality.ma". +(* Inclusion of: GRP487-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP487-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 7 ( 2 average) *) +(* Comments : A UEQ part of GRP077-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide A (double_divide (double_divide (double_divide identity (double_divide (double_divide A identity) (double_divide B C))) B) identity)) C.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP488-1.p.ma b/matita/tests/TPTP/Veloci/GRP488-1.p.ma new file mode 100644 index 000000000..ff1c3c177 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP488-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP488-1". +include "logic/equality.ma". +(* Inclusion of: GRP488-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP488-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 7 ( 2 average) *) +(* Comments : A UEQ part of GRP077-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide A (double_divide (double_divide (double_divide identity (double_divide (double_divide A identity) (double_divide B C))) B) identity)) C.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP490-1.p.ma b/matita/tests/TPTP/Veloci/GRP490-1.p.ma new file mode 100644 index 000000000..78e958798 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP490-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP490-1". +include "logic/equality.ma". +(* Inclusion of: GRP490-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP490-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP078-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide identity A) (double_divide identity (double_divide (double_divide (double_divide A B) identity) (double_divide C B)))) C.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP491-1.p.ma b/matita/tests/TPTP/Veloci/GRP491-1.p.ma new file mode 100644 index 000000000..221fdb592 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP491-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP491-1". +include "logic/equality.ma". +(* Inclusion of: GRP491-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP491-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP078-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide identity A) (double_divide identity (double_divide (double_divide (double_divide A B) identity) (double_divide C B)))) C.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP492-1.p.ma b/matita/tests/TPTP/Veloci/GRP492-1.p.ma new file mode 100644 index 000000000..e9f198d2d --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP492-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP492-1". +include "logic/equality.ma". +(* Inclusion of: GRP492-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP492-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : A UEQ part of GRP078-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide identity A) (double_divide identity (double_divide (double_divide (double_divide A B) identity) (double_divide C B)))) C.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP493-1.p.ma b/matita/tests/TPTP/Veloci/GRP493-1.p.ma new file mode 100644 index 000000000..fc0bf16ce --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP493-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP493-1". +include "logic/equality.ma". +(* Inclusion of: GRP493-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP493-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP079-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide identity A) (double_divide (double_divide (double_divide B C) (double_divide identity identity)) (double_divide A C))) B.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP494-1.p.ma b/matita/tests/TPTP/Veloci/GRP494-1.p.ma new file mode 100644 index 000000000..ea863067a --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP494-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP494-1". +include "logic/equality.ma". +(* Inclusion of: GRP494-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP494-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP079-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide identity A) (double_divide (double_divide (double_divide B C) (double_divide identity identity)) (double_divide A C))) B.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP495-1.p.ma b/matita/tests/TPTP/Veloci/GRP495-1.p.ma new file mode 100644 index 000000000..225028412 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP495-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP495-1". +include "logic/equality.ma". +(* Inclusion of: GRP495-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP495-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP079-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide identity A) (double_divide (double_divide (double_divide B C) (double_divide identity identity)) (double_divide A C))) B.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP496-1.p.ma b/matita/tests/TPTP/Veloci/GRP496-1.p.ma new file mode 100644 index 000000000..efe2d3a94 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP496-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP496-1". +include "logic/equality.ma". +(* Inclusion of: GRP496-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP496-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP080-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide identity (double_divide A (double_divide B identity))) (double_divide (double_divide B (double_divide C A)) identity)) C.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP497-1.p.ma b/matita/tests/TPTP/Veloci/GRP497-1.p.ma new file mode 100644 index 000000000..c2f5d7be9 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP497-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP497-1". +include "logic/equality.ma". +(* Inclusion of: GRP497-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP497-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP080-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide identity (double_divide A (double_divide B identity))) (double_divide (double_divide B (double_divide C A)) identity)) C.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP498-1.p.ma b/matita/tests/TPTP/Veloci/GRP498-1.p.ma new file mode 100644 index 000000000..c5875b0b2 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP498-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP498-1". +include "logic/equality.ma". +(* Inclusion of: GRP498-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP498-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory *) +(* Problem : Axiom for group theory, in double division and identity, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP080-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide identity (double_divide A (double_divide B identity))) (double_divide (double_divide B (double_divide C A)) identity)) C.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP509-1.p.ma b/matita/tests/TPTP/Veloci/GRP509-1.p.ma new file mode 100644 index 000000000..25618b46a --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP509-1.p.ma @@ -0,0 +1,38 @@ +set "baseuri" "cic:/matita/TPTP/GRP509-1". +include "logic/equality.ma". +(* Inclusion of: GRP509-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP509-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [LW92] Lusk & Wos (1992), Benchmark Problems in Which Equalit *) +(* : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : A UEQ part of GRP085-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply (multiply (multiply A B) C) (inverse (multiply A C))) B.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP510-1.p.ma b/matita/tests/TPTP/Veloci/GRP510-1.p.ma new file mode 100644 index 000000000..1003a4014 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP510-1.p.ma @@ -0,0 +1,38 @@ +set "baseuri" "cic:/matita/TPTP/GRP510-1". +include "logic/equality.ma". +(* Inclusion of: GRP510-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP510-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [LW92] Lusk & Wos (1992), Benchmark Problems in Which Equalit *) +(* : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : A UEQ part of GRP085-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply (multiply (multiply A B) C) (inverse (multiply A C))) B.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP511-1.p.ma b/matita/tests/TPTP/Veloci/GRP511-1.p.ma new file mode 100644 index 000000000..ff8c9f4c0 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP511-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP511-1". +include "logic/equality.ma". +(* Inclusion of: GRP511-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP511-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [LW92] Lusk & Wos (1992), Benchmark Problems in Which Equalit *) +(* : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : A UEQ part of GRP085-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply (multiply (multiply A B) C) (inverse (multiply A C))) B.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP512-1.p.ma b/matita/tests/TPTP/Veloci/GRP512-1.p.ma new file mode 100644 index 000000000..19a8c4a94 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP512-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP512-1". +include "logic/equality.ma". +(* Inclusion of: GRP512-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP512-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [LW92] Lusk & Wos (1992), Benchmark Problems in Which Equalit *) +(* : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : A UEQ part of GRP085-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply (multiply (multiply A B) C) (inverse (multiply A C))) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP513-1.p.ma b/matita/tests/TPTP/Veloci/GRP513-1.p.ma new file mode 100644 index 000000000..03409c949 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP513-1.p.ma @@ -0,0 +1,37 @@ +set "baseuri" "cic:/matita/TPTP/GRP513-1". +include "logic/equality.ma". +(* Inclusion of: GRP513-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP513-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0, 0.09 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 5 ( 3 average) *) +(* Comments : A UEQ part of GRP086-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply A (multiply (multiply B C) (inverse (multiply A C)))) B.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP514-1.p.ma b/matita/tests/TPTP/Veloci/GRP514-1.p.ma new file mode 100644 index 000000000..90593b6c8 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP514-1.p.ma @@ -0,0 +1,37 @@ +set "baseuri" "cic:/matita/TPTP/GRP514-1". +include "logic/equality.ma". +(* Inclusion of: GRP514-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP514-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 5 ( 3 average) *) +(* Comments : A UEQ part of GRP086-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply A (multiply (multiply B C) (inverse (multiply A C)))) B.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP515-1.p.ma b/matita/tests/TPTP/Veloci/GRP515-1.p.ma new file mode 100644 index 000000000..7b526ef97 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP515-1.p.ma @@ -0,0 +1,38 @@ +set "baseuri" "cic:/matita/TPTP/GRP515-1". +include "logic/equality.ma". +(* Inclusion of: GRP515-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP515-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 5 ( 3 average) *) +(* Comments : A UEQ part of GRP086-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply A (multiply (multiply B C) (inverse (multiply A C)))) B.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP516-1.p.ma b/matita/tests/TPTP/Veloci/GRP516-1.p.ma new file mode 100644 index 000000000..af15eb7ee --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP516-1.p.ma @@ -0,0 +1,38 @@ +set "baseuri" "cic:/matita/TPTP/GRP516-1". +include "logic/equality.ma". +(* Inclusion of: GRP516-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP516-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP086-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply A (multiply (multiply B C) (inverse (multiply A C)))) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP517-1.p.ma b/matita/tests/TPTP/Veloci/GRP517-1.p.ma new file mode 100644 index 000000000..a488717cd --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP517-1.p.ma @@ -0,0 +1,37 @@ +set "baseuri" "cic:/matita/TPTP/GRP517-1". +include "logic/equality.ma". +(* Inclusion of: GRP517-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP517-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : A UEQ part of GRP087-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply A (multiply (multiply (inverse (multiply A B)) C) B)) C.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP518-1.p.ma b/matita/tests/TPTP/Veloci/GRP518-1.p.ma new file mode 100644 index 000000000..a953ab610 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP518-1.p.ma @@ -0,0 +1,37 @@ +set "baseuri" "cic:/matita/TPTP/GRP518-1". +include "logic/equality.ma". +(* Inclusion of: GRP518-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP518-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : A UEQ part of GRP087-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply A (multiply (multiply (inverse (multiply A B)) C) B)) C.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP520-1.p.ma b/matita/tests/TPTP/Veloci/GRP520-1.p.ma new file mode 100644 index 000000000..ea992df71 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP520-1.p.ma @@ -0,0 +1,38 @@ +set "baseuri" "cic:/matita/TPTP/GRP520-1". +include "logic/equality.ma". +(* Inclusion of: GRP520-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP520-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in product and inverse, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : A UEQ part of GRP087-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (multiply A (multiply (multiply (inverse (multiply A B)) C) B)) C.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP541-1.p.ma b/matita/tests/TPTP/Veloci/GRP541-1.p.ma new file mode 100644 index 000000000..a8f428a0d --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP541-1.p.ma @@ -0,0 +1,42 @@ +set "baseuri" "cic:/matita/TPTP/GRP541-1". +include "logic/equality.ma". +(* Inclusion of: GRP541-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP541-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP093-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide (divide (divide A B) C) A)) C) B.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP542-1.p.ma b/matita/tests/TPTP/Veloci/GRP542-1.p.ma new file mode 100644 index 000000000..848748d87 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP542-1.p.ma @@ -0,0 +1,42 @@ +set "baseuri" "cic:/matita/TPTP/GRP542-1". +include "logic/equality.ma". +(* Inclusion of: GRP542-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP542-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP093-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide (divide (divide A B) C) A)) C) B.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP543-1.p.ma b/matita/tests/TPTP/Veloci/GRP543-1.p.ma new file mode 100644 index 000000000..cfc5bab58 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP543-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP543-1". +include "logic/equality.ma". +(* Inclusion of: GRP543-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP543-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP093-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide (divide (divide A B) C) A)) C) B.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP544-1.p.ma b/matita/tests/TPTP/Veloci/GRP544-1.p.ma new file mode 100644 index 000000000..96fb69f73 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP544-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP544-1". +include "logic/equality.ma". +(* Inclusion of: GRP544-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP544-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP093-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide (divide (divide A B) C) A)) C) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP545-1.p.ma b/matita/tests/TPTP/Veloci/GRP545-1.p.ma new file mode 100644 index 000000000..302fb8916 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP545-1.p.ma @@ -0,0 +1,42 @@ +set "baseuri" "cic:/matita/TPTP/GRP545-1". +include "logic/equality.ma". +(* Inclusion of: GRP545-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP545-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : A UEQ part of GRP094-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide A B)) (divide (divide B C) A)) C.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP546-1.p.ma b/matita/tests/TPTP/Veloci/GRP546-1.p.ma new file mode 100644 index 000000000..2488a9484 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP546-1.p.ma @@ -0,0 +1,42 @@ +set "baseuri" "cic:/matita/TPTP/GRP546-1". +include "logic/equality.ma". +(* Inclusion of: GRP546-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP546-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : A UEQ part of GRP094-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide A B)) (divide (divide B C) A)) C.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP547-1.p.ma b/matita/tests/TPTP/Veloci/GRP547-1.p.ma new file mode 100644 index 000000000..24ede0fe7 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP547-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP547-1". +include "logic/equality.ma". +(* Inclusion of: GRP547-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP547-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : A UEQ part of GRP094-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide A B)) (divide (divide B C) A)) C.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP548-1.p.ma b/matita/tests/TPTP/Veloci/GRP548-1.p.ma new file mode 100644 index 000000000..a065d3f1b --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP548-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP548-1". +include "logic/equality.ma". +(* Inclusion of: GRP548-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP548-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : A UEQ part of GRP094-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity (divide A B)) (divide (divide B C) A)) C.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP549-1.p.ma b/matita/tests/TPTP/Veloci/GRP549-1.p.ma new file mode 100644 index 000000000..0bf4dbf1c --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP549-1.p.ma @@ -0,0 +1,42 @@ +set "baseuri" "cic:/matita/TPTP/GRP549-1". +include "logic/equality.ma". +(* Inclusion of: GRP549-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP549-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP095-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity A) (divide (divide (divide B A) C) B)) C.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP550-1.p.ma b/matita/tests/TPTP/Veloci/GRP550-1.p.ma new file mode 100644 index 000000000..a7482f9b5 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP550-1.p.ma @@ -0,0 +1,42 @@ +set "baseuri" "cic:/matita/TPTP/GRP550-1". +include "logic/equality.ma". +(* Inclusion of: GRP550-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP550-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP095-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity A) (divide (divide (divide B A) C) B)) C.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP551-1.p.ma b/matita/tests/TPTP/Veloci/GRP551-1.p.ma new file mode 100644 index 000000000..3144369c2 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP551-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP551-1". +include "logic/equality.ma". +(* Inclusion of: GRP551-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP551-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP095-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity A) (divide (divide (divide B A) C) B)) C.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP552-1.p.ma b/matita/tests/TPTP/Veloci/GRP552-1.p.ma new file mode 100644 index 000000000..9a776c962 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP552-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP552-1". +include "logic/equality.ma". +(* Inclusion of: GRP552-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP552-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and identity, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP095-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (divide A A). +\forall H1:\forall A:Univ.eq Univ (inverse A) (divide identity A). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (divide identity B)). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide identity A) (divide (divide (divide B A) C) B)) C.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP556-1.p.ma b/matita/tests/TPTP/Veloci/GRP556-1.p.ma new file mode 100644 index 000000000..f314261a2 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP556-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP556-1". +include "logic/equality.ma". +(* Inclusion of: GRP556-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP556-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and inverse, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : A UEQ part of GRP096-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (inverse B)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide A (inverse (divide B (divide A C)))) C) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP558-1.p.ma b/matita/tests/TPTP/Veloci/GRP558-1.p.ma new file mode 100644 index 000000000..35670d9cb --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP558-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP558-1". +include "logic/equality.ma". +(* Inclusion of: GRP558-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP558-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and inverse, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 5 ( 3 average) *) +(* Comments : A UEQ part of GRP097-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (inverse B)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide A (inverse (divide (divide B C) (divide A C)))) B.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP560-1.p.ma b/matita/tests/TPTP/Veloci/GRP560-1.p.ma new file mode 100644 index 000000000..113f49edf --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP560-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP560-1". +include "logic/equality.ma". +(* Inclusion of: GRP560-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP560-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and inverse, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP097-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (inverse B)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide A (inverse (divide (divide B C) (divide A C)))) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP561-1.p.ma b/matita/tests/TPTP/Veloci/GRP561-1.p.ma new file mode 100644 index 000000000..dc788b109 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP561-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP561-1". +include "logic/equality.ma". +(* Inclusion of: GRP561-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP561-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and inverse, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0, 0.09 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 5 ( 3 average) *) +(* Comments : A UEQ part of GRP098-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (inverse B)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide (divide A (inverse B)) C) (divide A C)) B.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP562-1.p.ma b/matita/tests/TPTP/Veloci/GRP562-1.p.ma new file mode 100644 index 000000000..99ea92789 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP562-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP562-1". +include "logic/equality.ma". +(* Inclusion of: GRP562-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP562-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and inverse, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 5 ( 3 average) *) +(* Comments : A UEQ part of GRP098-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (inverse B)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide (divide A (inverse B)) C) (divide A C)) B.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP564-1.p.ma b/matita/tests/TPTP/Veloci/GRP564-1.p.ma new file mode 100644 index 000000000..63b1c2d97 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP564-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP564-1". +include "logic/equality.ma". +(* Inclusion of: GRP564-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP564-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in division and inverse, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of GRP098-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (divide A (inverse B)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (divide (divide (divide A (inverse B)) C) (divide A C)) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP565-1.p.ma b/matita/tests/TPTP/Veloci/GRP565-1.p.ma new file mode 100644 index 000000000..ad4f93570 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP565-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP565-1". +include "logic/equality.ma". +(* Inclusion of: GRP565-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP565-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP099-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide A C)) (double_divide identity C))) (double_divide identity identity)) B.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP566-1.p.ma b/matita/tests/TPTP/Veloci/GRP566-1.p.ma new file mode 100644 index 000000000..71a827e47 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP566-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP566-1". +include "logic/equality.ma". +(* Inclusion of: GRP566-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP566-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP099-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide A C)) (double_divide identity C))) (double_divide identity identity)) B.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP567-1.p.ma b/matita/tests/TPTP/Veloci/GRP567-1.p.ma new file mode 100644 index 000000000..6fbd3492b --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP567-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP567-1". +include "logic/equality.ma". +(* Inclusion of: GRP567-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP567-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.14 v3.1.0, 0.11 v2.7.0, 0.09 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : A UEQ part of GRP099-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide A C)) (double_divide identity C))) (double_divide identity identity)) B.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP568-1.p.ma b/matita/tests/TPTP/Veloci/GRP568-1.p.ma new file mode 100644 index 000000000..884ed5e5c --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP568-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP568-1". +include "logic/equality.ma". +(* Inclusion of: GRP568-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP568-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.14 v3.1.0, 0.11 v2.7.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP099-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide A C)) (double_divide identity C))) (double_divide identity identity)) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP569-1.p.ma b/matita/tests/TPTP/Veloci/GRP569-1.p.ma new file mode 100644 index 000000000..931c933ba --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP569-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP569-1". +include "logic/equality.ma". +(* Inclusion of: GRP569-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP569-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP100-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide A C)) (double_divide C identity))) (double_divide identity identity)) B.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP570-1.p.ma b/matita/tests/TPTP/Veloci/GRP570-1.p.ma new file mode 100644 index 000000000..d6bdbbfc6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP570-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP570-1". +include "logic/equality.ma". +(* Inclusion of: GRP570-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP570-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP100-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide A C)) (double_divide C identity))) (double_divide identity identity)) B.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP572-1.p.ma b/matita/tests/TPTP/Veloci/GRP572-1.p.ma new file mode 100644 index 000000000..c3e517cef --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP572-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP572-1". +include "logic/equality.ma". +(* Inclusion of: GRP572-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP572-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP100-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide A C)) (double_divide C identity))) (double_divide identity identity)) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP573-1.p.ma b/matita/tests/TPTP/Veloci/GRP573-1.p.ma new file mode 100644 index 000000000..8076345cc --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP573-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP573-1". +include "logic/equality.ma". +(* Inclusion of: GRP573-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP573-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP101-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide C A)) (double_divide C identity))) (double_divide identity identity)) B.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP574-1.p.ma b/matita/tests/TPTP/Veloci/GRP574-1.p.ma new file mode 100644 index 000000000..e6f9dfcec --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP574-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP574-1". +include "logic/equality.ma". +(* Inclusion of: GRP574-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP574-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP101-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide C A)) (double_divide C identity))) (double_divide identity identity)) B.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP576-1.p.ma b/matita/tests/TPTP/Veloci/GRP576-1.p.ma new file mode 100644 index 000000000..aed52d2de --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP576-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP576-1". +include "logic/equality.ma". +(* Inclusion of: GRP576-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP576-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP101-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide B (double_divide C A)) (double_divide C identity))) (double_divide identity identity)) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP577-1.p.ma b/matita/tests/TPTP/Veloci/GRP577-1.p.ma new file mode 100644 index 000000000..ad7c58b9e --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP577-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP577-1". +include "logic/equality.ma". +(* Inclusion of: GRP577-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP577-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP102-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide (double_divide B A) C) (double_divide B identity))) (double_divide identity identity)) C.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP578-1.p.ma b/matita/tests/TPTP/Veloci/GRP578-1.p.ma new file mode 100644 index 000000000..7c9843da7 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP578-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP578-1". +include "logic/equality.ma". +(* Inclusion of: GRP578-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP578-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP102-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide (double_divide B A) C) (double_divide B identity))) (double_divide identity identity)) C.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP580-1.p.ma b/matita/tests/TPTP/Veloci/GRP580-1.p.ma new file mode 100644 index 000000000..4d729b995 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP580-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP580-1". +include "logic/equality.ma". +(* Inclusion of: GRP580-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP580-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP102-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide (double_divide B A) C) (double_divide B identity))) (double_divide identity identity)) C.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP581-1.p.ma b/matita/tests/TPTP/Veloci/GRP581-1.p.ma new file mode 100644 index 000000000..d826e2af1 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP581-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP581-1". +include "logic/equality.ma". +(* Inclusion of: GRP581-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP581-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP103-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide identity B) (double_divide C (double_divide B A)))) (double_divide identity identity)) C.eq Univ (multiply (inverse a1) a1) identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP582-1.p.ma b/matita/tests/TPTP/Veloci/GRP582-1.p.ma new file mode 100644 index 000000000..4c09bb39c --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP582-1.p.ma @@ -0,0 +1,41 @@ +set "baseuri" "cic:/matita/TPTP/GRP582-1". +include "logic/equality.ma". +(* Inclusion of: GRP582-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP582-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP103-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide identity B) (double_divide C (double_divide B A)))) (double_divide identity identity)) C.eq Univ (multiply identity a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP583-1.p.ma b/matita/tests/TPTP/Veloci/GRP583-1.p.ma new file mode 100644 index 000000000..fa95c336a --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP583-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP583-1". +include "logic/equality.ma". +(* Inclusion of: GRP583-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP583-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : A UEQ part of GRP103-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide identity B) (double_divide C (double_divide B A)))) (double_divide identity identity)) C.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP584-1.p.ma b/matita/tests/TPTP/Veloci/GRP584-1.p.ma new file mode 100644 index 000000000..db36e336b --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP584-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/GRP584-1". +include "logic/equality.ma". +(* Inclusion of: GRP584-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP584-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and id, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : A UEQ part of GRP103-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall identity:Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.eq Univ identity (double_divide A (inverse A)). +\forall H1:\forall A:Univ.eq Univ (inverse A) (double_divide A identity). +\forall H2:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (double_divide (double_divide B A) identity). +\forall H3:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A (double_divide (double_divide identity B) (double_divide C (double_divide B A)))) (double_divide identity identity)) C.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP586-1.p.ma b/matita/tests/TPTP/Veloci/GRP586-1.p.ma new file mode 100644 index 000000000..f38467e27 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP586-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP586-1". +include "logic/equality.ma". +(* Inclusion of: GRP586-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP586-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP104-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide A (inverse (double_divide (inverse (double_divide (double_divide A B) (inverse C))) B))) C.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP588-1.p.ma b/matita/tests/TPTP/Veloci/GRP588-1.p.ma new file mode 100644 index 000000000..1d13edfbe --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP588-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP588-1". +include "logic/equality.ma". +(* Inclusion of: GRP588-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP588-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP104-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide A (inverse (double_divide (inverse (double_divide (double_divide A B) (inverse C))) B))) C.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP590-1.p.ma b/matita/tests/TPTP/Veloci/GRP590-1.p.ma new file mode 100644 index 000000000..f678b3d83 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP590-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP590-1". +include "logic/equality.ma". +(* Inclusion of: GRP590-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP590-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP105-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (inverse (double_divide (double_divide A B) (inverse (double_divide A (inverse C))))) B) C.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP592-1.p.ma b/matita/tests/TPTP/Veloci/GRP592-1.p.ma new file mode 100644 index 000000000..5612e2720 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP592-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP592-1". +include "logic/equality.ma". +(* Inclusion of: GRP592-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP592-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP105-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (inverse (double_divide (double_divide A B) (inverse (double_divide A (inverse C))))) B) C.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP595-1.p.ma b/matita/tests/TPTP/Veloci/GRP595-1.p.ma new file mode 100644 index 000000000..e97f64cd3 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP595-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP595-1". +include "logic/equality.ma". +(* Inclusion of: GRP595-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP595-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP106-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (inverse (double_divide (double_divide A B) (inverse (double_divide A (inverse (double_divide C B)))))) C.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP596-1.p.ma b/matita/tests/TPTP/Veloci/GRP596-1.p.ma new file mode 100644 index 000000000..1d8e313ac --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP596-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP596-1". +include "logic/equality.ma". +(* Inclusion of: GRP596-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP596-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP106-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (inverse (double_divide (double_divide A B) (inverse (double_divide A (inverse (double_divide C B)))))) C.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP597-1.p.ma b/matita/tests/TPTP/Veloci/GRP597-1.p.ma new file mode 100644 index 000000000..5923b8e70 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP597-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP597-1". +include "logic/equality.ma". +(* Inclusion of: GRP597-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP597-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP107-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A B) (inverse (double_divide A (inverse (double_divide (inverse C) B))))) C.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP598-1.p.ma b/matita/tests/TPTP/Veloci/GRP598-1.p.ma new file mode 100644 index 000000000..133ed30f6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP598-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP598-1". +include "logic/equality.ma". +(* Inclusion of: GRP598-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP598-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP107-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A B) (inverse (double_divide A (inverse (double_divide (inverse C) B))))) C.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP599-1.p.ma b/matita/tests/TPTP/Veloci/GRP599-1.p.ma new file mode 100644 index 000000000..31716a710 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP599-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP599-1". +include "logic/equality.ma". +(* Inclusion of: GRP599-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP599-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP107-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A B) (inverse (double_divide A (inverse (double_divide (inverse C) B))))) C.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP600-1.p.ma b/matita/tests/TPTP/Veloci/GRP600-1.p.ma new file mode 100644 index 000000000..07535f9bb --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP600-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP600-1". +include "logic/equality.ma". +(* Inclusion of: GRP600-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP600-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP107-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (double_divide A B) (inverse (double_divide A (inverse (double_divide (inverse C) B))))) C.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP602-1.p.ma b/matita/tests/TPTP/Veloci/GRP602-1.p.ma new file mode 100644 index 000000000..620ddb94e --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP602-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP602-1". +include "logic/equality.ma". +(* Inclusion of: GRP602-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP602-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 8 ( 3 average) *) +(* Comments : A UEQ part of GRP108-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (inverse (double_divide (inverse (double_divide A (inverse (double_divide B (double_divide A C))))) C)) B.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP603-1.p.ma b/matita/tests/TPTP/Veloci/GRP603-1.p.ma new file mode 100644 index 000000000..6d7b92f84 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP603-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP603-1". +include "logic/equality.ma". +(* Inclusion of: GRP603-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP603-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 8 ( 3 average) *) +(* Comments : A UEQ part of GRP108-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (inverse (double_divide (inverse (double_divide A (inverse (double_divide B (double_divide A C))))) C)) B.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP604-1.p.ma b/matita/tests/TPTP/Veloci/GRP604-1.p.ma new file mode 100644 index 000000000..9e228851d --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP604-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP604-1". +include "logic/equality.ma". +(* Inclusion of: GRP604-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP604-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 8 ( 3 average) *) +(* Comments : A UEQ part of GRP108-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (inverse (double_divide (inverse (double_divide A (inverse (double_divide B (double_divide A C))))) C)) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP605-1.p.ma b/matita/tests/TPTP/Veloci/GRP605-1.p.ma new file mode 100644 index 000000000..89084a07b --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP605-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP605-1". +include "logic/equality.ma". +(* Inclusion of: GRP605-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP605-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP109-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (inverse (double_divide A (inverse (double_divide (inverse B) (double_divide A C))))) C) B.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP606-1.p.ma b/matita/tests/TPTP/Veloci/GRP606-1.p.ma new file mode 100644 index 000000000..09742e1ac --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP606-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP606-1". +include "logic/equality.ma". +(* Inclusion of: GRP606-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP606-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP109-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (inverse (double_divide A (inverse (double_divide (inverse B) (double_divide A C))))) C) B.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP608-1.p.ma b/matita/tests/TPTP/Veloci/GRP608-1.p.ma new file mode 100644 index 000000000..de5945331 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP608-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP608-1". +include "logic/equality.ma". +(* Inclusion of: GRP608-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP608-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP109-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (inverse (double_divide A (inverse (double_divide (inverse B) (double_divide A C))))) C) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP612-1.p.ma b/matita/tests/TPTP/Veloci/GRP612-1.p.ma new file mode 100644 index 000000000..3dec26708 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP612-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP612-1". +include "logic/equality.ma". +(* Inclusion of: GRP612-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP612-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP110-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (inverse (double_divide (inverse (double_divide (inverse (double_divide A B)) C)) (double_divide A C))) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP613-1.p.ma b/matita/tests/TPTP/Veloci/GRP613-1.p.ma new file mode 100644 index 000000000..206e1edcb --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP613-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP613-1". +include "logic/equality.ma". +(* Inclusion of: GRP613-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP613-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 1 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP111-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_1: + \forall Univ:Set. +\forall a1:Univ. +\forall b1:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (inverse (double_divide (inverse (double_divide A (inverse B))) C)) (double_divide A C)) B.eq Univ (multiply (inverse a1) a1) (multiply (inverse b1) b1) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP614-1.p.ma b/matita/tests/TPTP/Veloci/GRP614-1.p.ma new file mode 100644 index 000000000..203d3f216 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP614-1.p.ma @@ -0,0 +1,39 @@ +set "baseuri" "cic:/matita/TPTP/GRP614-1". +include "logic/equality.ma". +(* Inclusion of: GRP614-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP614-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 2 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP111-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_2: + \forall Univ:Set. +\forall a2:Univ. +\forall b2:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (inverse (double_divide (inverse (double_divide A (inverse B))) C)) (double_divide A C)) B.eq Univ (multiply (multiply (inverse b2) b2) a2) a2 +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP615-1.p.ma b/matita/tests/TPTP/Veloci/GRP615-1.p.ma new file mode 100644 index 000000000..2fe6234f6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP615-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP615-1". +include "logic/equality.ma". +(* Inclusion of: GRP615-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP615-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 3 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 3 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP111-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_3: + \forall Univ:Set. +\forall a3:Univ. +\forall b3:Univ. +\forall c3:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (inverse (double_divide (inverse (double_divide A (inverse B))) C)) (double_divide A C)) B.eq Univ (multiply (multiply a3 b3) c3) (multiply a3 (multiply b3 c3)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/GRP616-1.p.ma b/matita/tests/TPTP/Veloci/GRP616-1.p.ma new file mode 100644 index 000000000..6649a53d8 --- /dev/null +++ b/matita/tests/TPTP/Veloci/GRP616-1.p.ma @@ -0,0 +1,40 @@ +set "baseuri" "cic:/matita/TPTP/GRP616-1". +include "logic/equality.ma". +(* Inclusion of: GRP616-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : GRP616-1 : TPTP v3.1.1. Bugfixed v2.7.0. *) +(* Domain : Group Theory (Abelian) *) +(* Problem : Axiom for Abelian group theory, in double div and inv, part 4 *) +(* Version : [McC93] (equality) axioms. *) +(* English : *) +(* Refs : [McC93] McCune (1993), Single Axioms for Groups and Abelian Gr *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.7.0 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 0 singleton) *) +(* Maximal term depth : 7 ( 3 average) *) +(* Comments : A UEQ part of GRP111-1 *) +(* Bugfixes : v2.7.0 - Grounded conjecture *) +(* -------------------------------------------------------------------------- *) +theorem prove_these_axioms_4: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall double_divide:\forall _:Univ.\forall _:Univ.Univ. +\forall inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall A:Univ.\forall B:Univ.eq Univ (multiply A B) (inverse (double_divide B A)). +\forall H1:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (double_divide (inverse (double_divide (inverse (double_divide A (inverse B))) C)) (double_divide A C)) B.eq Univ (multiply a b) (multiply b a) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LAT008-1.p.ma b/matita/tests/TPTP/Veloci/LAT008-1.p.ma new file mode 100644 index 000000000..a8ee942e6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LAT008-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/LAT008-1". +include "logic/equality.ma". +(* Inclusion of: LAT008-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LAT008-1 : TPTP v3.1.1. Released v2.2.0. *) +(* Domain : Lattice Theory (Distributive lattices) *) +(* Problem : Sholander's basis for distributive lattices, part 5 (of 6). *) +(* Version : [MP96] (equality) axioms. *) +(* English : This is part of the proof that Sholanders 2-basis for *) +(* distributive lattices is correct. Here we prove the absorption *) +(* law x v (x ^ y) = x. *) +(* Refs : [McC98] McCune (1998), Email to G. Sutcliffe *) +(* : [MP96] McCune & Padmanabhan (1996), Automated Deduction in Eq *) +(* Source : [McC98] *) +(* Names : LT-3-f [MP96] *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.2.1 *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 1 RR) *) +(* Number of atoms : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 5 ( 1 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Sholander's 2-basis for distributive lattices: *) +(* ----Denial of the conclusion: *) +theorem prove_absorbtion_dual: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall join:\forall _:Univ.\forall _:Univ.Univ. +\forall meet:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet X (join Y Z)) (join (meet Z X) (meet Y X)). +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (meet X (join X Y)) X.eq Univ (join a (meet a b)) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LAT033-1.p.ma b/matita/tests/TPTP/Veloci/LAT033-1.p.ma new file mode 100644 index 000000000..e1897a414 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LAT033-1.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/LAT033-1". +include "logic/equality.ma". +(* Inclusion of: LAT033-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LAT033-1 : TPTP v3.1.1. Bugfixed v2.5.0. *) +(* Domain : Lattice Theory *) +(* Problem : Idempotency of join *) +(* Version : [McC88] (equality) axioms. *) +(* English : *) +(* Refs : [DeN00] DeNivelle (2000), Email to G. Sutcliffe *) +(* [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* Source : [DeN00] *) +(* Names : idemp_of_join [DeN00] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.5.0 *) +(* Syntax : Number of clauses : 7 ( 0 non-Horn; 7 unit; 1 RR) *) +(* Number of atoms : 7 ( 7 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 14 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* Bugfixes : v2.5.0 - Used axioms without the conjecture *) +(* -------------------------------------------------------------------------- *) +(* ----Include lattice theory axioms *) +(* include('Axioms/LAT001-0.ax'). *) +(* -------------------------------------------------------------------------- *) +theorem idempotence_of_join: + \forall Univ:Set. +\forall join:\forall _:Univ.\forall _:Univ.Univ. +\forall meet:\forall _:Univ.\forall _:Univ.Univ. +\forall xx:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join (join X Y) Z) (join X (join Y Z)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet (meet X Y) Z) (meet X (meet Y Z)). +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (join X Y) (join Y X). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (meet X Y) (meet Y X). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (join X (meet X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (meet X (join X Y)) X.eq Univ (join xx xx) xx +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LAT034-1.p.ma b/matita/tests/TPTP/Veloci/LAT034-1.p.ma new file mode 100644 index 000000000..37ce834ab --- /dev/null +++ b/matita/tests/TPTP/Veloci/LAT034-1.p.ma @@ -0,0 +1,46 @@ +set "baseuri" "cic:/matita/TPTP/LAT034-1". +include "logic/equality.ma". +(* Inclusion of: LAT034-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LAT034-1 : TPTP v3.1.1. Bugfixed v2.5.0. *) +(* Domain : Lattice Theory *) +(* Problem : Idempotency of meet *) +(* Version : [McC88] (equality) axioms. *) +(* English : *) +(* Refs : [DeN00] DeNivelle (2000), Email to G. Sutcliffe *) +(* [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* Source : [DeN00] *) +(* Names : idemp_of_meet [DeN00] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.5.0 *) +(* Syntax : Number of clauses : 7 ( 0 non-Horn; 7 unit; 1 RR) *) +(* Number of atoms : 7 ( 7 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 14 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* Bugfixes : v2.5.0 - Used axioms without the conjecture *) +(* -------------------------------------------------------------------------- *) +(* ----Include lattice theory axioms *) +(* include('Axioms/LAT001-0.ax'). *) +(* -------------------------------------------------------------------------- *) +theorem idempotence_of_meet: + \forall Univ:Set. +\forall join:\forall _:Univ.\forall _:Univ.Univ. +\forall meet:\forall _:Univ.\forall _:Univ.Univ. +\forall xx:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join (join X Y) Z) (join X (join Y Z)). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet (meet X Y) Z) (meet X (meet Y Z)). +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (join X Y) (join Y X). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (meet X Y) (meet Y X). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (join X (meet X Y)) X. +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (meet X (join X Y)) X.eq Univ (meet xx xx) xx +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LAT039-1.p.ma b/matita/tests/TPTP/Veloci/LAT039-1.p.ma new file mode 100644 index 000000000..8ad8654fc --- /dev/null +++ b/matita/tests/TPTP/Veloci/LAT039-1.p.ma @@ -0,0 +1,77 @@ +set "baseuri" "cic:/matita/TPTP/LAT039-1". +include "logic/equality.ma". +(* Inclusion of: LAT039-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LAT039-1 : TPTP v3.1.1. Released v2.4.0. *) +(* Domain : Lattice Theory *) +(* Problem : Every distributive lattice is modular *) +(* Version : [McC88] (equality) axioms. *) +(* Theorem formulation : Modularity is expressed by: *) +(* x <= y -> x v (y & z) = y & (x v z) *) +(* English : *) +(* Refs : [DeN00] DeNivelle (2000), Email to G. Sutcliffe *) +(* [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* Source : [DeN00] *) +(* Names : lattice-mod-2 [DeN00] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.4.0 *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 2 RR) *) +(* Number of atoms : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 22 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include lattice theory axioms *) +(* Inclusion of: Axioms/LAT001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LAT001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Lattice Theory *) +(* Axioms : Lattice theory (equality) axioms *) +(* Version : [McC88] (equality) axioms. *) +(* English : *) +(* Refs : [Bum65] Bumcroft (1965), Proceedings of the Glasgow Mathematic *) +(* : [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [McC88] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 2-2 arity) *) +(* Number of variables : 16 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----The following 8 clauses characterise lattices *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem rhs: + \forall Univ:Set. +\forall join:\forall _:Univ.\forall _:Univ.Univ. +\forall meet:\forall _:Univ.\forall _:Univ.Univ. +\forall xx:Univ. +\forall yy:Univ. +\forall zz:Univ. +\forall H0:eq Univ (join xx yy) yy. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet X (join Y Z)) (join (meet X Y) (meet X Z)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join X (meet Y Z)) (meet (join X Y) (join X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join (join X Y) Z) (join X (join Y Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet (meet X Y) Z) (meet X (meet Y Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (join X Y) (join Y X). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (meet X Y) (meet Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (join X (meet X Y)) X. +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (meet X (join X Y)) X. +\forall H9:\forall X:Univ.eq Univ (join X X) X. +\forall H10:\forall X:Univ.eq Univ (meet X X) X.eq Univ (join xx (meet yy zz)) (meet yy (join xx zz)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LAT039-2.p.ma b/matita/tests/TPTP/Veloci/LAT039-2.p.ma new file mode 100644 index 000000000..de4e55ffa --- /dev/null +++ b/matita/tests/TPTP/Veloci/LAT039-2.p.ma @@ -0,0 +1,76 @@ +set "baseuri" "cic:/matita/TPTP/LAT039-2". +include "logic/equality.ma". +(* Inclusion of: LAT039-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : LAT039-2 : TPTP v3.1.1. Released v2.4.0. *) +(* Domain : Lattice Theory *) +(* Problem : Every distributive lattice is modular *) +(* Version : [McC88] (equality) axioms. *) +(* English : Theorem formulation : Modularity is expressed by: *) +(* x <= y -> x v (y & z) = (x v y) & (x v z) *) +(* Refs : [DeN00] DeNivelle (2000), Email to G. Sutcliffe *) +(* [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* Source : [DeN00] *) +(* Names : lattice-mod-3 [DeN00] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.4.0 *) +(* Syntax : Number of clauses : 12 ( 0 non-Horn; 12 unit; 2 RR) *) +(* Number of atoms : 12 ( 12 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 22 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include lattice theory axioms *) +(* Inclusion of: Axioms/LAT001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LAT001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Lattice Theory *) +(* Axioms : Lattice theory (equality) axioms *) +(* Version : [McC88] (equality) axioms. *) +(* English : *) +(* Refs : [Bum65] Bumcroft (1965), Proceedings of the Glasgow Mathematic *) +(* : [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [McC88] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 2-2 arity) *) +(* Number of variables : 16 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----The following 8 clauses characterise lattices *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem rhs: + \forall Univ:Set. +\forall join:\forall _:Univ.\forall _:Univ.Univ. +\forall meet:\forall _:Univ.\forall _:Univ.Univ. +\forall xx:Univ. +\forall yy:Univ. +\forall zz:Univ. +\forall H0:eq Univ (join xx yy) yy. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet X (join Y Z)) (join (meet X Y) (meet X Z)). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join X (meet Y Z)) (meet (join X Y) (join X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join (join X Y) Z) (join X (join Y Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet (meet X Y) Z) (meet X (meet Y Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (join X Y) (join Y X). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (meet X Y) (meet Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (join X (meet X Y)) X. +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (meet X (join X Y)) X. +\forall H9:\forall X:Univ.eq Univ (join X X) X. +\forall H10:\forall X:Univ.eq Univ (meet X X) X.eq Univ (join xx (meet yy zz)) (meet (join xx yy) (join xx zz)) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LAT040-1.p.ma b/matita/tests/TPTP/Veloci/LAT040-1.p.ma new file mode 100644 index 000000000..a4ff6eff6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LAT040-1.p.ma @@ -0,0 +1,77 @@ +set "baseuri" "cic:/matita/TPTP/LAT040-1". +include "logic/equality.ma". +(* Inclusion of: LAT040-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LAT040-1 : TPTP v3.1.1. Released v2.4.0. *) +(* Domain : Lattice Theory *) +(* Problem : Another simplification rule for distributive lattices *) +(* Version : [McC88] (equality) axioms. *) +(* English : In every distributive lattice the simplification rule holds: *) +(* forall x, y, z: (x v y = x v z, x & y = x & z -> y = z ). *) +(* Refs : [DeN00] DeNivelle (2000), Email to G. Sutcliffe *) +(* [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* Source : [DeN00] *) +(* Names : lattice-simpl [DeN00] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.4.0 *) +(* Syntax : Number of clauses : 13 ( 0 non-Horn; 13 unit; 3 RR) *) +(* Number of atoms : 13 ( 13 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 22 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include lattice theory axioms *) +(* Inclusion of: Axioms/LAT001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LAT001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Lattice Theory *) +(* Axioms : Lattice theory (equality) axioms *) +(* Version : [McC88] (equality) axioms. *) +(* English : *) +(* Refs : [Bum65] Bumcroft (1965), Proceedings of the Glasgow Mathematic *) +(* : [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [McC88] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 2-2 arity) *) +(* Number of variables : 16 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----The following 8 clauses characterise lattices *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem rhs: + \forall Univ:Set. +\forall join:\forall _:Univ.\forall _:Univ.Univ. +\forall meet:\forall _:Univ.\forall _:Univ.Univ. +\forall xx:Univ. +\forall yy:Univ. +\forall zz:Univ. +\forall H0:eq Univ (meet xx yy) (meet xx zz). +\forall H1:eq Univ (join xx yy) (join xx zz). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet X (join Y Z)) (join (meet X Y) (meet X Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join X (meet Y Z)) (meet (join X Y) (join X Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join (join X Y) Z) (join X (join Y Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet (meet X Y) Z) (meet X (meet Y Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (join X Y) (join Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (meet X Y) (meet Y X). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (join X (meet X Y)) X. +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (meet X (join X Y)) X. +\forall H10:\forall X:Univ.eq Univ (join X X) X. +\forall H11:\forall X:Univ.eq Univ (meet X X) X.eq Univ yy zz +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LAT045-1.p.ma b/matita/tests/TPTP/Veloci/LAT045-1.p.ma new file mode 100644 index 000000000..0b58207db --- /dev/null +++ b/matita/tests/TPTP/Veloci/LAT045-1.p.ma @@ -0,0 +1,84 @@ +set "baseuri" "cic:/matita/TPTP/LAT045-1". +include "logic/equality.ma". +(* Inclusion of: LAT045-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LAT045-1 : TPTP v3.1.1. Released v2.5.0. *) +(* Domain : Lattice Theory *) +(* Problem : Lattice orthomodular law from modular lattice *) +(* Version : [McC88] (equality) axioms. *) +(* English : *) +(* Refs : [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* : [RW01] Rose & Wilkinson (2001), Application of Model Search *) +(* Source : [RW01] *) +(* Names : eqp-f.in [RW01] *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.5.0 *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 1 RR) *) +(* Number of atoms : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 26 ( 2 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include lattice axioms *) +(* Inclusion of: Axioms/LAT001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LAT001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Lattice Theory *) +(* Axioms : Lattice theory (equality) axioms *) +(* Version : [McC88] (equality) axioms. *) +(* English : *) +(* Refs : [Bum65] Bumcroft (1965), Proceedings of the Glasgow Mathematic *) +(* : [McC88] McCune (1988), Challenge Equality Problems in Lattice *) +(* : [Wos88] Wos (1988), Automated Reasoning - 33 Basic Research Pr *) +(* Source : [McC88] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 2-2 arity) *) +(* Number of variables : 16 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----The following 8 clauses characterise lattices *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Compatibility (6) *) +(* ----Invertability (5) *) +(* ----Modular law (7) *) +(* ----Denial of orthomodular law (8) *) +theorem prove_orthomodular_law: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall complement:\forall _:Univ.Univ. +\forall join:\forall _:Univ.\forall _:Univ.Univ. +\forall meet:\forall _:Univ.\forall _:Univ.Univ. +\forall n0:Univ. +\forall n1:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join X (meet Y (join X Z))) (meet (join X Y) (join X Z)). +\forall H1:\forall X:Univ.eq Univ (complement (complement X)) X. +\forall H2:\forall X:Univ.eq Univ (meet (complement X) X) n0. +\forall H3:\forall X:Univ.eq Univ (join (complement X) X) n1. +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (complement (meet X Y)) (join (complement X) (complement Y)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (complement (join X Y)) (meet (complement X) (complement Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (join (join X Y) Z) (join X (join Y Z)). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (meet (meet X Y) Z) (meet X (meet Y Z)). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (join X Y) (join Y X). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (meet X Y) (meet Y X). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (join X (meet X Y)) X. +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (meet X (join X Y)) X. +\forall H12:\forall X:Univ.eq Univ (join X X) X. +\forall H13:\forall X:Univ.eq Univ (meet X X) X.eq Univ (join a (meet (complement a) (join a b))) (join a b) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL110-2.p.ma b/matita/tests/TPTP/Veloci/LCL110-2.p.ma new file mode 100644 index 000000000..442ce5958 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL110-2.p.ma @@ -0,0 +1,71 @@ +set "baseuri" "cic:/matita/TPTP/LCL110-2". +include "logic/equality.ma". +(* Inclusion of: LCL110-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL110-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Many valued sentential) *) +(* Problem : MV-24 depends on the Meredith system *) +(* Version : [LW92] axioms. *) +(* Theorem formulation : Wajsberg algebra formulation *) +(* English : An axiomatisation of the many valued sentential calculus *) +(* is {MV-1,MV-2,MV-3,MV-5} by Meredith. Wajsberg presented *) +(* an equality axiomatisation. Show that MV-24 depends on the *) +(* Wajsberg axiomatisation. *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* : [LW92] Lusk & Wos (1992), Benchmark Problems in Which Equalit *) +(* Source : [LW92] *) +(* Names : MV1.1 [LW92] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_mv_24: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies (not (not x)) x) truth +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL112-2.p.ma b/matita/tests/TPTP/Veloci/LCL112-2.p.ma new file mode 100644 index 000000000..473cf328c --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL112-2.p.ma @@ -0,0 +1,72 @@ +set "baseuri" "cic:/matita/TPTP/LCL112-2". +include "logic/equality.ma". +(* Inclusion of: LCL112-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL112-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Many valued sentential) *) +(* Problem : MV-29 depends on the Meredith system *) +(* Version : [McC92] axioms. *) +(* Theorem formulation : Wajsberg algebra formulation *) +(* English : An axiomatisation of the many valued sentential calculus *) +(* is {MV-1,MV-2,MV-3,MV-5} by Meredith. Wajsberg presented *) +(* an equality axiomatisation. Show that MV-29 depends on the *) +(* Wajsberg axiomatisation. *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* : [LW92] Lusk & Wos (1992), Benchmark Problems in Which Equalit *) +(* : [McC92] McCune (1992), Email to G. Sutcliffe *) +(* Source : [McC92] *) +(* Names : MV1.2 [LW92] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_mv_29: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies x (not (not x))) truth +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL113-2.p.ma b/matita/tests/TPTP/Veloci/LCL113-2.p.ma new file mode 100644 index 000000000..c310916a7 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL113-2.p.ma @@ -0,0 +1,71 @@ +set "baseuri" "cic:/matita/TPTP/LCL113-2". +include "logic/equality.ma". +(* Inclusion of: LCL113-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL113-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Many valued sentential) *) +(* Problem : MV-33 depends on the Meredith system *) +(* Version : [TPTP] axioms. *) +(* Theorem formulation : Wajsberg algebra formulation *) +(* English : An axiomatisation of the many valued sentential calculus *) +(* is {MV-1,MV-2,MV-3,MV-5} by Meredith. Wajsberg presented *) +(* an equality axiomatisation. Show that MV-33 depends on the *) +(* Wajsberg axiomatisation. *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_mv_33: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies (implies (not x) y) (implies (not y) x)) truth +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL114-2.p.ma b/matita/tests/TPTP/Veloci/LCL114-2.p.ma new file mode 100644 index 000000000..46cc01727 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL114-2.p.ma @@ -0,0 +1,72 @@ +set "baseuri" "cic:/matita/TPTP/LCL114-2". +include "logic/equality.ma". +(* Inclusion of: LCL114-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL114-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Many valued sentential) *) +(* Problem : MV-36 depends on the Meredith system *) +(* Version : [LW92] axioms. *) +(* Theorem formulation : Wajsberg algebra formulation *) +(* English : An axiomatisation of the many valued sentential calculus *) +(* is {MV-1,MV-2,MV-3,MV-5} by Meredith. Wajsberg presented *) +(* an equality axiomatisation. Show that MV-36 depends on the *) +(* Wajsberg axiomatisation. *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* : [LW92] Lusk & Wos (1992), Benchmark Problems in Which Equalit *) +(* Source : [LW92] *) +(* Names : MV3 [LW92] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_mv_36: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies (implies x y) (implies (not y) (not x))) truth +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL115-2.p.ma b/matita/tests/TPTP/Veloci/LCL115-2.p.ma new file mode 100644 index 000000000..158fef7e8 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL115-2.p.ma @@ -0,0 +1,71 @@ +set "baseuri" "cic:/matita/TPTP/LCL115-2". +include "logic/equality.ma". +(* Inclusion of: LCL115-2.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL115-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Many valued sentential) *) +(* Problem : MV-39 depends on the Meredith system *) +(* Version : [TPTP] axioms. *) +(* Theorem formulation : Wajsberg algebra formulation *) +(* English : An axiomatisation of the many valued sentential calculus *) +(* is {MV-1,MV-2,MV-3,MV-5} by Meredith. Wajsberg presented *) +(* an equality axiomatisation. Show that MV-39 depends on the *) +(* Wajsberg axiomatisation. *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_mv_39: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies (not (implies a b)) (not b)) truth +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL132-1.p.ma b/matita/tests/TPTP/Veloci/LCL132-1.p.ma new file mode 100644 index 000000000..330e40369 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL132-1.p.ma @@ -0,0 +1,66 @@ +set "baseuri" "cic:/matita/TPTP/LCL132-1". +include "logic/equality.ma". +(* Inclusion of: LCL132-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL132-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : A lemma in Wajsberg algebras *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : Lemma 1 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_wajsberg_lemma: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies x x) truth +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL133-1.p.ma b/matita/tests/TPTP/Veloci/LCL133-1.p.ma new file mode 100644 index 000000000..acd9538be --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL133-1.p.ma @@ -0,0 +1,68 @@ +set "baseuri" "cic:/matita/TPTP/LCL133-1". +include "logic/equality.ma". +(* Inclusion of: LCL133-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL133-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : A lemma in Wajsberg algebras *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : Lemma 2 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of atoms : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 10 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_wajsberg_lemma: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies X Y) (implies Y X). +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H4:\forall X:Univ.eq Univ (implies truth X) X.eq Univ x y +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL134-1.p.ma b/matita/tests/TPTP/Veloci/LCL134-1.p.ma new file mode 100644 index 000000000..d400f7cff --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL134-1.p.ma @@ -0,0 +1,66 @@ +set "baseuri" "cic:/matita/TPTP/LCL134-1". +include "logic/equality.ma". +(* Inclusion of: LCL134-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL134-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : A lemma in Wajsberg algebras *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : Lemma 3 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_wajsberg_lemma: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies x truth) truth +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL135-1.p.ma b/matita/tests/TPTP/Veloci/LCL135-1.p.ma new file mode 100644 index 000000000..9a982d8af --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL135-1.p.ma @@ -0,0 +1,71 @@ +set "baseuri" "cic:/matita/TPTP/LCL135-1". +include "logic/equality.ma". +(* Inclusion of: LCL135-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL135-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : A lemma in Wajsberg algebras *) +(* Version : [Bon91] (equality) axioms. *) +(* English : An axiomatisation of the many valued sentential calculus *) +(* is {MV-1,MV-2,MV-3,MV-5} by Meredith. Wajsberg provided *) +(* a different axiomatisation. Show that MV-1 depends on the *) +(* Wajsberg system. *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [Bon91] *) +(* Names : Lemma 4 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_wajsberg_lemma: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies x (implies y x)) truth +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL139-1.p.ma b/matita/tests/TPTP/Veloci/LCL139-1.p.ma new file mode 100644 index 000000000..21a301128 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL139-1.p.ma @@ -0,0 +1,66 @@ +set "baseuri" "cic:/matita/TPTP/LCL139-1". +include "logic/equality.ma". +(* Inclusion of: LCL139-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL139-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : A lemma in Wajsberg algebras *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : Lemma 8 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_wajsberg_lemma: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies x (not truth)) (not x) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL140-1.p.ma b/matita/tests/TPTP/Veloci/LCL140-1.p.ma new file mode 100644 index 000000000..c5148d2a8 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL140-1.p.ma @@ -0,0 +1,66 @@ +set "baseuri" "cic:/matita/TPTP/LCL140-1". +include "logic/equality.ma". +(* Inclusion of: LCL140-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL140-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : A lemma in Wajsberg algebras *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : Lemma 9 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_wajsberg_lemma: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (not (not x)) x +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL141-1.p.ma b/matita/tests/TPTP/Veloci/LCL141-1.p.ma new file mode 100644 index 000000000..5f816e926 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL141-1.p.ma @@ -0,0 +1,71 @@ +set "baseuri" "cic:/matita/TPTP/LCL141-1". +include "logic/equality.ma". +(* Inclusion of: LCL141-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL141-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : A lemma in Wajsberg algebras *) +(* Version : [Bon91] (equality) axioms. *) +(* English : An axiomatisation of the many valued sentential calculus *) +(* is {MV-1,MV-2,MV-3,MV-5} by Meredith. Wajsberg provided *) +(* a different axiomatisation. Show that MV-5 depends on the *) +(* Wajsberg system. *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [Bon91] *) +(* Names : Lemma 10 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_wajsberg_lemma: + \forall Univ:Set. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H3:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (implies (not x) (not y)) (implies y x) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL153-1.p.ma b/matita/tests/TPTP/Veloci/LCL153-1.p.ma new file mode 100644 index 000000000..827b99214 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL153-1.p.ma @@ -0,0 +1,136 @@ +set "baseuri" "cic:/matita/TPTP/LCL153-1". +include "logic/equality.ma". +(* Inclusion of: LCL153-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL153-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : The 1st alternative Wajsberg algebra axiom *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : W' axiom 1 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra and and or definitions *) +(* Inclusion of: Axioms/LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra AND and OR definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 0 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 0 constant; 1-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : Requires LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of or and and, which are AC *) +(* -------------------------------------------------------------------------- *) +(* ----Include Alternative Wajsberg algebra definitions *) +(* Inclusion of: Axioms/LCL002-1.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL002-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Alternative Wajsberg algebra definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 2 constant; 0-2 arity) *) +(* Number of variables : 11 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : Requires LCL001-0.ax LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of and_star and xor, where and_star is AC and xor is C *) +(* ---I guess the next two can be derived from the AC of and *) +(* ----Definition of false in terms of truth *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_alternative_wajsberg_axiom: + \forall Univ:Set. +\forall myand:\forall _:Univ.\forall _:Univ.Univ. +\forall and_star:\forall _:Univ.\forall _:Univ.Univ. +\forall falsehood:Univ. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall or:\forall _:Univ.\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall xor:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (not truth) falsehood. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (and_star Y X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (and_star (and_star X Y) Z) (and_star X (and_star Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (not (or (not X) (not Y))). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (xor Y X). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (or (myand X (not Y)) (myand (not X) Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (myand Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (myand (myand X Y) Z) (myand X (myand Y Z)). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (not (or (not X) (not Y))). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (or Y X). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (or (or X Y) Z) (or X (or Y Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (implies (not X) Y). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H15:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (not x) (xor x truth) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL154-1.p.ma b/matita/tests/TPTP/Veloci/LCL154-1.p.ma new file mode 100644 index 000000000..169be886a --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL154-1.p.ma @@ -0,0 +1,136 @@ +set "baseuri" "cic:/matita/TPTP/LCL154-1". +include "logic/equality.ma". +(* Inclusion of: LCL154-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL154-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : The 2nd alternative Wajsberg algebra axiom *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : W' axiom 2 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra and and or definitions *) +(* Inclusion of: Axioms/LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra AND and OR definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 0 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 0 constant; 1-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : Requires LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of or and and, which are AC *) +(* -------------------------------------------------------------------------- *) +(* ----Include Alternative Wajsberg algebra definitions *) +(* Inclusion of: Axioms/LCL002-1.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL002-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Alternative Wajsberg algebra definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 2 constant; 0-2 arity) *) +(* Number of variables : 11 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : Requires LCL001-0.ax LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of and_star and xor, where and_star is AC and xor is C *) +(* ---I guess the next two can be derived from the AC of and *) +(* ----Definition of false in terms of truth *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_alternative_wajsberg_axiom: + \forall Univ:Set. +\forall myand:\forall _:Univ.\forall _:Univ.Univ. +\forall and_star:\forall _:Univ.\forall _:Univ.Univ. +\forall falsehood:Univ. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall or:\forall _:Univ.\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall xor:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (not truth) falsehood. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (and_star Y X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (and_star (and_star X Y) Z) (and_star X (and_star Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (not (or (not X) (not Y))). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (xor Y X). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (or (myand X (not Y)) (myand (not X) Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (myand Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (myand (myand X Y) Z) (myand X (myand Y Z)). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (not (or (not X) (not Y))). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (or Y X). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (or (or X Y) Z) (or X (or Y Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (implies (not X) Y). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H15:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (xor x falsehood) x +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL155-1.p.ma b/matita/tests/TPTP/Veloci/LCL155-1.p.ma new file mode 100644 index 000000000..d5cb7fb5e --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL155-1.p.ma @@ -0,0 +1,136 @@ +set "baseuri" "cic:/matita/TPTP/LCL155-1". +include "logic/equality.ma". +(* Inclusion of: LCL155-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL155-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : The 3rd alternative Wajsberg algebra axiom *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : W' axiom 3 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra and and or definitions *) +(* Inclusion of: Axioms/LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra AND and OR definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 0 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 0 constant; 1-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : Requires LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of or and and, which are AC *) +(* -------------------------------------------------------------------------- *) +(* ----Include Alternative Wajsberg algebra definitions *) +(* Inclusion of: Axioms/LCL002-1.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL002-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Alternative Wajsberg algebra definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 2 constant; 0-2 arity) *) +(* Number of variables : 11 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : Requires LCL001-0.ax LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of and_star and xor, where and_star is AC and xor is C *) +(* ---I guess the next two can be derived from the AC of and *) +(* ----Definition of false in terms of truth *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_alternative_wajsberg_axiom: + \forall Univ:Set. +\forall myand:\forall _:Univ.\forall _:Univ.Univ. +\forall and_star:\forall _:Univ.\forall _:Univ.Univ. +\forall falsehood:Univ. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall or:\forall _:Univ.\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall xor:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (not truth) falsehood. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (and_star Y X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (and_star (and_star X Y) Z) (and_star X (and_star Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (not (or (not X) (not Y))). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (xor Y X). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (or (myand X (not Y)) (myand (not X) Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (myand Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (myand (myand X Y) Z) (myand X (myand Y Z)). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (not (or (not X) (not Y))). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (or Y X). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (or (or X Y) Z) (or X (or Y Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (implies (not X) Y). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H15:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (xor x x) falsehood +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL156-1.p.ma b/matita/tests/TPTP/Veloci/LCL156-1.p.ma new file mode 100644 index 000000000..3d5df92b6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL156-1.p.ma @@ -0,0 +1,136 @@ +set "baseuri" "cic:/matita/TPTP/LCL156-1". +include "logic/equality.ma". +(* Inclusion of: LCL156-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL156-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : The 4th alternative Wajsberg algebra axiom *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : W' axiom 4 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra and and or definitions *) +(* Inclusion of: Axioms/LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra AND and OR definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 0 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 0 constant; 1-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : Requires LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of or and and, which are AC *) +(* -------------------------------------------------------------------------- *) +(* ----Include Alternative Wajsberg algebra definitions *) +(* Inclusion of: Axioms/LCL002-1.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL002-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Alternative Wajsberg algebra definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 2 constant; 0-2 arity) *) +(* Number of variables : 11 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : Requires LCL001-0.ax LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of and_star and xor, where and_star is AC and xor is C *) +(* ---I guess the next two can be derived from the AC of and *) +(* ----Definition of false in terms of truth *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_alternative_wajsberg_axiom: + \forall Univ:Set. +\forall myand:\forall _:Univ.\forall _:Univ.Univ. +\forall and_star:\forall _:Univ.\forall _:Univ.Univ. +\forall falsehood:Univ. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall or:\forall _:Univ.\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall xor:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (not truth) falsehood. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (and_star Y X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (and_star (and_star X Y) Z) (and_star X (and_star Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (not (or (not X) (not Y))). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (xor Y X). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (or (myand X (not Y)) (myand (not X) Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (myand Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (myand (myand X Y) Z) (myand X (myand Y Z)). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (not (or (not X) (not Y))). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (or Y X). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (or (or X Y) Z) (or X (or Y Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (implies (not X) Y). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H15:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (and_star x truth) x +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL157-1.p.ma b/matita/tests/TPTP/Veloci/LCL157-1.p.ma new file mode 100644 index 000000000..97ea2cad9 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL157-1.p.ma @@ -0,0 +1,136 @@ +set "baseuri" "cic:/matita/TPTP/LCL157-1". +include "logic/equality.ma". +(* Inclusion of: LCL157-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL157-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : The 5th alternative Wajsberg algebra axiom *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : W' axiom 5 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra and and or definitions *) +(* Inclusion of: Axioms/LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra AND and OR definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 0 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 0 constant; 1-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : Requires LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of or and and, which are AC *) +(* -------------------------------------------------------------------------- *) +(* ----Include Alternative Wajsberg algebra definitions *) +(* Inclusion of: Axioms/LCL002-1.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL002-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Alternative Wajsberg algebra definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 2 constant; 0-2 arity) *) +(* Number of variables : 11 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : Requires LCL001-0.ax LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of and_star and xor, where and_star is AC and xor is C *) +(* ---I guess the next two can be derived from the AC of and *) +(* ----Definition of false in terms of truth *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_alternative_wajsberg_axiom: + \forall Univ:Set. +\forall myand:\forall _:Univ.\forall _:Univ.Univ. +\forall and_star:\forall _:Univ.\forall _:Univ.Univ. +\forall falsehood:Univ. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall or:\forall _:Univ.\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall xor:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (not truth) falsehood. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (and_star Y X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (and_star (and_star X Y) Z) (and_star X (and_star Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (not (or (not X) (not Y))). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (xor Y X). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (or (myand X (not Y)) (myand (not X) Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (myand Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (myand (myand X Y) Z) (myand X (myand Y Z)). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (not (or (not X) (not Y))). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (or Y X). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (or (or X Y) Z) (or X (or Y Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (implies (not X) Y). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H15:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (and_star x falsehood) falsehood +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL158-1.p.ma b/matita/tests/TPTP/Veloci/LCL158-1.p.ma new file mode 100644 index 000000000..32a4518b7 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL158-1.p.ma @@ -0,0 +1,136 @@ +set "baseuri" "cic:/matita/TPTP/LCL158-1". +include "logic/equality.ma". +(* Inclusion of: LCL158-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL158-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : The 6th alternative Wajsberg algebra axiom *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : W' axiom 6 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 2 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 3 constant; 0-2 arity) *) +(* Number of variables : 33 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* : [MW92] McCune & Wos (1992), Experiments in Automated Deductio *) +(* Source : [MW92] *) +(* Names : MV Sentential Calculus [MW92] *) +(* Status : *) +(* Syntax : Number of clauses : 4 ( 0 non-Horn; 4 unit; 0 RR) *) +(* Number of literals : 4 ( 4 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 1 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Include Wajsberg algebra and and or definitions *) +(* Inclusion of: Axioms/LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL001-2 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Wajsberg algebra AND and OR definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 0 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 0 constant; 1-2 arity) *) +(* Number of variables : 14 ( 0 singleton) *) +(* Maximal term depth : 4 ( 3 average) *) +(* Comments : Requires LCL001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of or and and, which are AC *) +(* -------------------------------------------------------------------------- *) +(* ----Include Alternative Wajsberg algebra definitions *) +(* Inclusion of: Axioms/LCL002-1.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL002-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Alternative Wajsberg algebra definitions *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 6 ( 0 non-Horn; 6 unit; 1 RR) *) +(* Number of literals : 6 ( 6 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 2 constant; 0-2 arity) *) +(* Number of variables : 11 ( 0 singleton) *) +(* Maximal term depth : 4 ( 2 average) *) +(* Comments : Requires LCL001-0.ax LCL001-2.ax *) +(* -------------------------------------------------------------------------- *) +(* ----Definitions of and_star and xor, where and_star is AC and xor is C *) +(* ---I guess the next two can be derived from the AC of and *) +(* ----Definition of false in terms of truth *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_alternative_wajsberg_axiom: + \forall Univ:Set. +\forall myand:\forall _:Univ.\forall _:Univ.Univ. +\forall and_star:\forall _:Univ.\forall _:Univ.Univ. +\forall falsehood:Univ. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall or:\forall _:Univ.\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall xor:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (not truth) falsehood. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (and_star Y X). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (and_star (and_star X Y) Z) (and_star X (and_star Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (not (or (not X) (not Y))). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (xor Y X). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (or (myand X (not Y)) (myand (not X) Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (myand Y X). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (myand (myand X Y) Z) (myand X (myand Y Z)). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (myand X Y) (not (or (not X) (not Y))). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (or Y X). +\forall H10:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (or (or X Y) Z) (or X (or Y Z)). +\forall H11:\forall X:Univ.\forall Y:Univ.eq Univ (or X Y) (implies (not X) Y). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies (not X) (not Y)) (implies Y X)) truth. +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (implies (implies X Y) Y) (implies (implies Y X) X). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (implies (implies X Y) (implies (implies Y Z) (implies X Z))) truth. +\forall H15:\forall X:Univ.eq Univ (implies truth X) X.eq Univ (and_star (xor truth x) x) falsehood +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL161-1.p.ma b/matita/tests/TPTP/Veloci/LCL161-1.p.ma new file mode 100644 index 000000000..3961b05d8 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL161-1.p.ma @@ -0,0 +1,85 @@ +set "baseuri" "cic:/matita/TPTP/LCL161-1". +include "logic/equality.ma". +(* Inclusion of: LCL161-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL161-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : The 1st Wajsberg algebra axiom, from the alternative axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : W axiom 1 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 2 RR) *) +(* Number of atoms : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-2 arity) *) +(* Number of variables : 19 ( 1 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Alternative Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL002-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL002-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Alternative Wajsberg algebra axioms *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 10 ( 1 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : To be used in conjunction with the LAT003 alternative *) +(* Wajsberg algebra definitions. *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Include some Alternative Wajsberg algebra definitions *) +(* include('Axioms/LCL002-1.ax'). *) +(* ----Definition that and_star is AC and xor is C *) +(* ----Definition of false in terms of true *) +(* ----Include the definition of implies in terms of xor and and_star *) +theorem prove_wajsberg_axiom: + \forall Univ:Set. +\forall and_star:\forall _:Univ.\forall _:Univ.Univ. +\forall falsehood:Univ. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall xor:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies X Y) (xor truth (and_star X (xor truth Y))). +\forall H1:eq Univ (not truth) falsehood. +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (and_star Y X). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (and_star (and_star X Y) Z) (and_star X (and_star Y Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (xor Y X). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (and_star (xor (and_star (xor truth X) Y) truth) Y) (and_star (xor (and_star (xor truth Y) X) truth) X). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (xor X (xor truth Y)) (xor (xor X truth) Y). +\forall H7:\forall X:Univ.eq Univ (and_star (xor truth X) X) falsehood. +\forall H8:\forall X:Univ.eq Univ (and_star X falsehood) falsehood. +\forall H9:\forall X:Univ.eq Univ (and_star X truth) X. +\forall H10:\forall X:Univ.eq Univ (xor X X) falsehood. +\forall H11:\forall X:Univ.eq Univ (xor X falsehood) X. +\forall H12:\forall X:Univ.eq Univ (not X) (xor X truth).eq Univ (implies truth x) x +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LCL164-1.p.ma b/matita/tests/TPTP/Veloci/LCL164-1.p.ma new file mode 100644 index 000000000..8850280e9 --- /dev/null +++ b/matita/tests/TPTP/Veloci/LCL164-1.p.ma @@ -0,0 +1,86 @@ +set "baseuri" "cic:/matita/TPTP/LCL164-1". +include "logic/equality.ma". +(* Inclusion of: LCL164-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LCL164-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebra) *) +(* Problem : The 4th Wajsberg algebra axiom, from the alternative axioms *) +(* Version : [Bon91] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : W axiom 4 [Bon91] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.38 v2.0.0 *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 2 RR) *) +(* Number of atoms : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 4 constant; 0-2 arity) *) +(* Number of variables : 19 ( 1 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Alternative Wajsberg algebra axioms *) +(* Inclusion of: Axioms/LCL002-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : LCL002-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Logic Calculi (Wajsberg Algebras) *) +(* Axioms : Alternative Wajsberg algebra axioms *) +(* Version : [AB90] (equality) axioms. *) +(* English : *) +(* Refs : [FRT84] Font et al. (1984), Wajsberg Algebras *) +(* : [AB90] Anantharaman & Bonacina (1990), An Application of the *) +(* : [Bon91] Bonacina (1991), Problems in Lukasiewicz Logic *) +(* Source : [Bon91] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 0 RR) *) +(* Number of literals : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 10 ( 1 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : To be used in conjunction with the LAT003 alternative *) +(* Wajsberg algebra definitions. *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----Include some Alternative Wajsberg algebra definitions *) +(* include('Axioms/LCL002-1.ax'). *) +(* ----Definition that and_star is AC and xor is C *) +(* ----Definition of false in terms of true *) +(* ----Include the definition of implies in terms of xor and and_star *) +theorem prove_wajsberg_axiom: + \forall Univ:Set. +\forall and_star:\forall _:Univ.\forall _:Univ.Univ. +\forall falsehood:Univ. +\forall implies:\forall _:Univ.\forall _:Univ.Univ. +\forall not:\forall _:Univ.Univ. +\forall truth:Univ. +\forall x:Univ. +\forall xor:\forall _:Univ.\forall _:Univ.Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (implies X Y) (xor truth (and_star X (xor truth Y))). +\forall H1:eq Univ (not truth) falsehood. +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (and_star X Y) (and_star Y X). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (and_star (and_star X Y) Z) (and_star X (and_star Y Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (xor X Y) (xor Y X). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (and_star (xor (and_star (xor truth X) Y) truth) Y) (and_star (xor (and_star (xor truth Y) X) truth) X). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (xor X (xor truth Y)) (xor (xor X truth) Y). +\forall H7:\forall X:Univ.eq Univ (and_star (xor truth X) X) falsehood. +\forall H8:\forall X:Univ.eq Univ (and_star X falsehood) falsehood. +\forall H9:\forall X:Univ.eq Univ (and_star X truth) X. +\forall H10:\forall X:Univ.eq Univ (xor X X) falsehood. +\forall H11:\forall X:Univ.eq Univ (xor X falsehood) X. +\forall H12:\forall X:Univ.eq Univ (not X) (xor X truth).eq Univ (implies (implies (not x) (not y)) (implies y x)) truth +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LDA001-1.p.ma b/matita/tests/TPTP/Veloci/LDA001-1.p.ma new file mode 100644 index 000000000..48e8b32cc --- /dev/null +++ b/matita/tests/TPTP/Veloci/LDA001-1.p.ma @@ -0,0 +1,43 @@ +set "baseuri" "cic:/matita/TPTP/LDA001-1". +include "logic/equality.ma". +(* Inclusion of: LDA001-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : LDA001-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : LD-Algebras *) +(* Problem : Verify 3*2*U = UUU, where U = 2*2 *) +(* Version : [Jec93] (equality) axioms. *) +(* English : *) +(* Refs : [Jec93] Jech (1993), LD-Algebras *) +(* Source : [Jec93] *) +(* Names : Problem 1 [Jec93] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 4 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----A1: x(yz)=xy(xz) *) +(* ----3*2*U = U*U*U *) +theorem prove_equation: + \forall Univ:Set. +\forall f:\forall _:Univ.\forall _:Univ.Univ. +\forall n1:Univ. +\forall n2:Univ. +\forall n3:Univ. +\forall u:Univ. +\forall H0:eq Univ u (f n2 n2). +\forall H1:eq Univ n3 (f n2 n1). +\forall H2:eq Univ n2 (f n1 n1). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (f X (f Y Z)) (f (f X Y) (f X Z)).eq Univ (f (f n3 n2) u) (f (f u u) u) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/LDA007-3.p.ma b/matita/tests/TPTP/Veloci/LDA007-3.p.ma new file mode 100644 index 000000000..534a5a9fd --- /dev/null +++ b/matita/tests/TPTP/Veloci/LDA007-3.p.ma @@ -0,0 +1,51 @@ +set "baseuri" "cic:/matita/TPTP/LDA007-3". +include "logic/equality.ma". +(* Inclusion of: LDA007-3.p *) +(* -------------------------------------------------------------------------- *) +(* File : LDA007-3 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : LD-Algebras (Embedding algebras) *) +(* Problem : Let g = cr(t). Show that t(tsg) = tt(ts)(tg) *) +(* Version : [Jec93] axioms : Incomplete > Reduced & Augmented > Incomplete. *) +(* English : *) +(* Refs : [Jec93] Jech (1993), LD-Algebras *) +(* Source : [Jec93] *) +(* Names : Problem 8 [Jec93] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 7 ( 0 non-Horn; 7 unit; 6 RR) *) +(* Number of atoms : 7 ( 7 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 9 ( 8 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include Embedding algebra axioms *) +(* include('Axioms/LDA001-0.ax'). *) +(* -------------------------------------------------------------------------- *) +(* ----t(tsk) = tt(ts)(tk), where k=crit(t) *) +theorem prove_equation: + \forall Univ:Set. +\forall f:\forall _:Univ.\forall _:Univ.Univ. +\forall k:Univ. +\forall s:Univ. +\forall t:Univ. +\forall tk:Univ. +\forall ts:Univ. +\forall tsk:Univ. +\forall tt:Univ. +\forall tt_ts:Univ. +\forall H0:eq Univ tsk (f ts k). +\forall H1:eq Univ tk (f t k). +\forall H2:eq Univ tt_ts (f tt ts). +\forall H3:eq Univ ts (f t s). +\forall H4:eq Univ tt (f t t). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (f X (f Y Z)) (f (f X Y) (f X Z)).eq Univ (f t tsk) (f tt_ts tk) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/RNG007-4.p.ma b/matita/tests/TPTP/Veloci/RNG007-4.p.ma new file mode 100644 index 000000000..a9cdabd1d --- /dev/null +++ b/matita/tests/TPTP/Veloci/RNG007-4.p.ma @@ -0,0 +1,90 @@ +set "baseuri" "cic:/matita/TPTP/RNG007-4". +include "logic/equality.ma". +(* Inclusion of: RNG007-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : RNG007-4 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory *) +(* Problem : In Boolean rings, X is its own inverse *) +(* Version : [Peterson & Stickel, 1981] (equality) axioms. *) +(* Theorem formulation : Equality. *) +(* English : Given a ring in which for all x, x * x = x, prove that for *) +(* all x, x + x = additive_identity *) +(* Refs : [PS81] Peterson & Stickel (1981), Complete Sets of Reductions *) +(* Source : [ANL] *) +(* Names : lemma.ver2.in [ANL] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 2 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 2 constant; 0-2 arity) *) +(* Number of variables : 26 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include ring theory axioms *) +(* Inclusion of: Axioms/RNG002-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : RNG002-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory *) +(* Axioms : Ring theory (equality) axioms *) +(* Version : [PS81] (equality) axioms : *) +(* Reduced & Augmented > Complete. *) +(* English : *) +(* Refs : [PS81] Peterson & Stickel (1981), Complete Sets of Reductions *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 1 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 1 constant; 0-2 arity) *) +(* Number of variables : 25 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Not sure if these are complete. I don't know if the reductions *) +(* given in [PS81] are suitable for ATP. *) +(* -------------------------------------------------------------------------- *) +(* ----Existence of left identity for addition *) +(* ----Existence of left additive additive_inverse *) +(* ----Distributive property of product over sum *) +(* ----Inverse of identity is identity, stupid *) +(* ----Inverse of additive_inverse of X is X *) +(* ----Behavior of 0 and the multiplication operation *) +(* ----Inverse of (x + y) is additive_inverse(x) + additive_inverse(y) *) +(* ----x * additive_inverse(y) = additive_inverse (x * y) *) +(* ----Associativity of addition *) +(* ----Commutativity of addition *) +(* ----Associativity of product *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_inverse: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall additive_inverse:\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (multiply X X) X. +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (add X Y) Z) (add X (add Y Z)). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (additive_inverse X) Y) (additive_inverse (multiply X Y)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X (additive_inverse Y)) (additive_inverse (multiply X Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (additive_inverse (add X Y)) (add (additive_inverse X) (additive_inverse Y)). +\forall H7:\forall X:Univ.eq Univ (multiply additive_identity X) additive_identity. +\forall H8:\forall X:Univ.eq Univ (multiply X additive_identity) additive_identity. +\forall H9:\forall X:Univ.eq Univ (additive_inverse (additive_inverse X)) X. +\forall H10:eq Univ (additive_inverse additive_identity) additive_identity. +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H13:\forall X:Univ.eq Univ (add (additive_inverse X) X) additive_identity. +\forall H14:\forall X:Univ.eq Univ (add additive_identity X) X.eq Univ (add a a) additive_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/RNG008-4.p.ma b/matita/tests/TPTP/Veloci/RNG008-4.p.ma new file mode 100644 index 000000000..c56142d62 --- /dev/null +++ b/matita/tests/TPTP/Veloci/RNG008-4.p.ma @@ -0,0 +1,94 @@ +set "baseuri" "cic:/matita/TPTP/RNG008-4". +include "logic/equality.ma". +(* Inclusion of: RNG008-4.p *) +(* -------------------------------------------------------------------------- *) +(* File : RNG008-4 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory *) +(* Problem : Boolean rings are commutative *) +(* Version : [PS81] (equality) axioms. *) +(* Theorem formulation : Equality. *) +(* English : Given a ring in which for all x, x * x = x, prove that for *) +(* all x and y, x * y = y * x. *) +(* Refs : [MOW76] McCharen et al. (1976), Problems and Experiments for a *) +(* : [PS81] Peterson & Stickel (1981), Complete Sets of Reductions *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.07 v3.1.0, 0.11 v2.7.0, 0.00 v2.2.1, 0.22 v2.2.0, 0.29 v2.1.0, 0.25 v2.0.0 *) +(* Syntax : Number of clauses : 17 ( 0 non-Horn; 17 unit; 3 RR) *) +(* Number of atoms : 17 ( 17 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 4 constant; 0-2 arity) *) +(* Number of variables : 26 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include ring theory axioms *) +(* Inclusion of: Axioms/RNG002-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : RNG002-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory *) +(* Axioms : Ring theory (equality) axioms *) +(* Version : [PS81] (equality) axioms : *) +(* Reduced & Augmented > Complete. *) +(* English : *) +(* Refs : [PS81] Peterson & Stickel (1981), Complete Sets of Reductions *) +(* Source : [ANL] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 14 ( 0 non-Horn; 14 unit; 1 RR) *) +(* Number of literals : 14 ( 14 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 1 constant; 0-2 arity) *) +(* Number of variables : 25 ( 2 singleton) *) +(* Maximal term depth : 3 ( 2 average) *) +(* Comments : Not sure if these are complete. I don't know if the reductions *) +(* given in [PS81] are suitable for ATP. *) +(* -------------------------------------------------------------------------- *) +(* ----Existence of left identity for addition *) +(* ----Existence of left additive additive_inverse *) +(* ----Distributive property of product over sum *) +(* ----Inverse of identity is identity, stupid *) +(* ----Inverse of additive_inverse of X is X *) +(* ----Behavior of 0 and the multiplication operation *) +(* ----Inverse of (x + y) is additive_inverse(x) + additive_inverse(y) *) +(* ----x * additive_inverse(y) = additive_inverse (x * y) *) +(* ----Associativity of addition *) +(* ----Commutativity of addition *) +(* ----Associativity of product *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_commutativity: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall additive_inverse:\forall _:Univ.Univ. +\forall b:Univ. +\forall c:Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:eq Univ (multiply a b) c. +\forall H1:\forall X:Univ.eq Univ (multiply X X) X. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (multiply X Y) Z) (multiply X (multiply Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (add X Y) Z) (add X (add Y Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (additive_inverse X) Y) (additive_inverse (multiply X Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X (additive_inverse Y)) (additive_inverse (multiply X Y)). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (additive_inverse (add X Y)) (add (additive_inverse X) (additive_inverse Y)). +\forall H8:\forall X:Univ.eq Univ (multiply additive_identity X) additive_identity. +\forall H9:\forall X:Univ.eq Univ (multiply X additive_identity) additive_identity. +\forall H10:\forall X:Univ.eq Univ (additive_inverse (additive_inverse X)) X. +\forall H11:eq Univ (additive_inverse additive_identity) additive_identity. +\forall H12:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H14:\forall X:Univ.eq Univ (add (additive_inverse X) X) additive_identity. +\forall H15:\forall X:Univ.eq Univ (add additive_identity X) X.eq Univ (multiply b a) c +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/RNG011-5.p.ma b/matita/tests/TPTP/Veloci/RNG011-5.p.ma new file mode 100644 index 000000000..f7df33340 --- /dev/null +++ b/matita/tests/TPTP/Veloci/RNG011-5.p.ma @@ -0,0 +1,83 @@ +set "baseuri" "cic:/matita/TPTP/RNG011-5". +include "logic/equality.ma". +(* Inclusion of: RNG011-5.p *) +(* -------------------------------------------------------------------------- *) +(* File : RNG011-5 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory *) +(* Problem : In a right alternative ring (((X,X,Y)*X)*(X,X,Y)) = Add Id *) +(* Version : [Ove90] (equality) axioms : *) +(* Incomplete > Augmented > Incomplete. *) +(* English : *) +(* Refs : [Ove90] Overbeek (1990), ATP competition announced at CADE-10 *) +(* : [Ove93] Overbeek (1993), The CADE-11 Competitions: A Personal *) +(* : [LM93] Lusk & McCune (1993), Uniform Strategies: The CADE-11 *) +(* : [Zha93] Zhang (1993), Automated Proofs of Equality Problems in *) +(* Source : [Ove90] *) +(* Names : CADE-11 Competition Eq-10 [Ove90] *) +(* : THEOREM EQ-10 [LM93] *) +(* : PROBLEM 10 [Zha93] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 22 ( 0 non-Horn; 22 unit; 2 RR) *) +(* Number of atoms : 22 ( 22 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 3 constant; 0-3 arity) *) +(* Number of variables : 37 ( 2 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Commutativity of addition *) +(* ----Associativity of addition *) +(* ----Additive identity *) +(* ----Additive inverse *) +(* ----Inverse of identity is identity, stupid *) +(* ----Axiom of Overbeek *) +(* ----Inverse of (x + y) is additive_inverse(x) + additive_inverse(y), *) +(* ----Inverse of additive_inverse of X is X *) +(* ----Behavior of 0 and the multiplication operation *) +(* ----Axiom of Overbeek *) +(* ----x * additive_inverse(y) = additive_inverse (x * y), *) +(* ----Distributive property of product over sum *) +(* ----Right alternative law *) +(* ----Associator *) +(* ----Commutator *) +(* ----Middle associator identity *) +theorem prove_equality: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall additive_inverse:\forall _:Univ.Univ. +\forall associator:\forall _:Univ.\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall commutator:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply (associator X X Y) X) (associator X X Y)) additive_identity. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (commutator X Y) (add (multiply Y X) (additive_inverse (multiply X Y))). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (associator X Y Z) (add (multiply (multiply X Y) Z) (additive_inverse (multiply X (multiply Y Z)))). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply X Y) Y) (multiply X (multiply Y Y)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H5:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (additive_inverse X) Y) (additive_inverse (multiply X Y)). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X (additive_inverse Y)) (additive_inverse (multiply X Y)). +\forall H8:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (additive_inverse X) (additive_inverse Y)) (multiply X Y). +\forall H9:\forall X:Univ.eq Univ (multiply additive_identity X) additive_identity. +\forall H10:\forall X:Univ.eq Univ (multiply X additive_identity) additive_identity. +\forall H11:\forall X:Univ.eq Univ (additive_inverse (additive_inverse X)) X. +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (additive_inverse (add X Y)) (add (additive_inverse X) (additive_inverse Y)). +\forall H13:\forall X:Univ.\forall Y:Univ.eq Univ (add X (add (additive_inverse X) Y)) Y. +\forall H14:eq Univ (additive_inverse additive_identity) additive_identity. +\forall H15:\forall X:Univ.eq Univ (add (additive_inverse X) X) additive_identity. +\forall H16:\forall X:Univ.eq Univ (add X (additive_inverse X)) additive_identity. +\forall H17:\forall X:Univ.eq Univ (add additive_identity X) X. +\forall H18:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H19:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (add X Y) Z) (add X (add Y Z)). +\forall H20:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (multiply (multiply (associator a a b) a) (associator a a b)) additive_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/RNG023-6.p.ma b/matita/tests/TPTP/Veloci/RNG023-6.p.ma new file mode 100644 index 000000000..e69e40345 --- /dev/null +++ b/matita/tests/TPTP/Veloci/RNG023-6.p.ma @@ -0,0 +1,91 @@ +set "baseuri" "cic:/matita/TPTP/RNG023-6". +include "logic/equality.ma". +(* Inclusion of: RNG023-6.p *) +(* -------------------------------------------------------------------------- *) +(* File : RNG023-6 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory (Alternative) *) +(* Problem : Left alternative *) +(* Version : [Ste87] (equality) axioms. *) +(* Theorem formulation : In terms of associators *) +(* English : *) +(* Refs : [Ste87] Stevens (1987), Some Experiments in Nonassociative Rin *) +(* : [Ste92] Stevens (1992), Unpublished Note *) +(* Source : [Ste92] *) +(* Names : - [Ste87] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 3 constant; 0-3 arity) *) +(* Number of variables : 27 ( 2 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include nonassociative ring axioms *) +(* Inclusion of: Axioms/RNG003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : RNG003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory (Alternative) *) +(* Axioms : Alternative ring theory (equality) axioms *) +(* Version : [Ste87] (equality) axioms. *) +(* English : *) +(* Refs : [Ste87] Stevens (1987), Some Experiments in Nonassociative Rin *) +(* Source : [Ste87] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 0 RR) *) +(* Number of literals : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 1 constant; 0-3 arity) *) +(* Number of variables : 27 ( 2 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----There exists an additive identity element *) +(* ----Multiplicative zero *) +(* ----Existence of left additive additive_inverse *) +(* ----Inverse of additive_inverse of X is X *) +(* ----Distributive property of product over sum *) +(* ----Commutativity for addition *) +(* ----Associativity for addition *) +(* ----Right alternative law *) +(* ----Left alternative law *) +(* ----Associator *) +(* ----Commutator *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_left_alternative: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall additive_inverse:\forall _:Univ.Univ. +\forall associator:\forall _:Univ.\forall _:Univ.\forall _:Univ.Univ. +\forall commutator:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (commutator X Y) (add (multiply Y X) (additive_inverse (multiply X Y))). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (associator X Y Z) (add (multiply (multiply X Y) Z) (additive_inverse (multiply X (multiply Y Z)))). +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply X X) Y) (multiply X (multiply X Y)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply X Y) Y) (multiply X (multiply Y Y)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (add Y Z)) (add (add X Y) Z). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X). +\forall H6:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H8:\forall X:Univ.eq Univ (additive_inverse (additive_inverse X)) X. +\forall H9:\forall X:Univ.eq Univ (add X (additive_inverse X)) additive_identity. +\forall H10:\forall X:Univ.eq Univ (add (additive_inverse X) X) additive_identity. +\forall H11:\forall X:Univ.eq Univ (multiply X additive_identity) additive_identity. +\forall H12:\forall X:Univ.eq Univ (multiply additive_identity X) additive_identity. +\forall H13:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H14:\forall X:Univ.eq Univ (add additive_identity X) X.eq Univ (associator x x y) additive_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/RNG023-7.p.ma b/matita/tests/TPTP/Veloci/RNG023-7.p.ma new file mode 100644 index 000000000..49260d096 --- /dev/null +++ b/matita/tests/TPTP/Veloci/RNG023-7.p.ma @@ -0,0 +1,99 @@ +set "baseuri" "cic:/matita/TPTP/RNG023-7". +include "logic/equality.ma". +(* Inclusion of: RNG023-7.p *) +(* -------------------------------------------------------------------------- *) +(* File : RNG023-7 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory (Alternative) *) +(* Problem : Left alternative *) +(* Version : [Ste87] (equality) axioms : Augmented. *) +(* Theorem formulation : In terms of associators *) +(* English : *) +(* Refs : [Ste87] Stevens (1987), Some Experiments in Nonassociative Rin *) +(* : [Ste92] Stevens (1992), Unpublished Note *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.00 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 23 ( 0 non-Horn; 23 unit; 1 RR) *) +(* Number of atoms : 23 ( 23 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 3 constant; 0-3 arity) *) +(* Number of variables : 45 ( 2 singleton) *) +(* Maximal term depth : 5 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include nonassociative ring axioms *) +(* Inclusion of: Axioms/RNG003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : RNG003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory (Alternative) *) +(* Axioms : Alternative ring theory (equality) axioms *) +(* Version : [Ste87] (equality) axioms. *) +(* English : *) +(* Refs : [Ste87] Stevens (1987), Some Experiments in Nonassociative Rin *) +(* Source : [Ste87] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 0 RR) *) +(* Number of literals : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 1 constant; 0-3 arity) *) +(* Number of variables : 27 ( 2 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----There exists an additive identity element *) +(* ----Multiplicative zero *) +(* ----Existence of left additive additive_inverse *) +(* ----Inverse of additive_inverse of X is X *) +(* ----Distributive property of product over sum *) +(* ----Commutativity for addition *) +(* ----Associativity for addition *) +(* ----Right alternative law *) +(* ----Left alternative law *) +(* ----Associator *) +(* ----Commutator *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----The next 7 clause are extra lemmas which Stevens found useful *) +theorem prove_left_alternative: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall additive_inverse:\forall _:Univ.Univ. +\forall associator:\forall _:Univ.\forall _:Univ.\forall _:Univ.Univ. +\forall commutator:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) (additive_inverse Z)) (add (additive_inverse (multiply X Z)) (additive_inverse (multiply Y Z))). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (additive_inverse X) (add Y Z)) (add (additive_inverse (multiply X Y)) (additive_inverse (multiply X Z))). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X (additive_inverse Y)) Z) (add (multiply X Z) (additive_inverse (multiply Y Z))). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y (additive_inverse Z))) (add (multiply X Y) (additive_inverse (multiply X Z))). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X (additive_inverse Y)) (additive_inverse (multiply X Y)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (additive_inverse X) Y) (additive_inverse (multiply X Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (additive_inverse X) (additive_inverse Y)) (multiply X Y). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (commutator X Y) (add (multiply Y X) (additive_inverse (multiply X Y))). +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (associator X Y Z) (add (multiply (multiply X Y) Z) (additive_inverse (multiply X (multiply Y Z)))). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply X X) Y) (multiply X (multiply X Y)). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply X Y) Y) (multiply X (multiply Y Y)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (add Y Z)) (add (add X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H15:\forall X:Univ.eq Univ (additive_inverse (additive_inverse X)) X. +\forall H16:\forall X:Univ.eq Univ (add X (additive_inverse X)) additive_identity. +\forall H17:\forall X:Univ.eq Univ (add (additive_inverse X) X) additive_identity. +\forall H18:\forall X:Univ.eq Univ (multiply X additive_identity) additive_identity. +\forall H19:\forall X:Univ.eq Univ (multiply additive_identity X) additive_identity. +\forall H20:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H21:\forall X:Univ.eq Univ (add additive_identity X) X.eq Univ (associator x x y) additive_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/RNG024-6.p.ma b/matita/tests/TPTP/Veloci/RNG024-6.p.ma new file mode 100644 index 000000000..bdb4c04a7 --- /dev/null +++ b/matita/tests/TPTP/Veloci/RNG024-6.p.ma @@ -0,0 +1,91 @@ +set "baseuri" "cic:/matita/TPTP/RNG024-6". +include "logic/equality.ma". +(* Inclusion of: RNG024-6.p *) +(* -------------------------------------------------------------------------- *) +(* File : RNG024-6 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory (Alternative) *) +(* Problem : Right alternative *) +(* Version : [Ste87] (equality) axioms. *) +(* Theorem formulation : In terms of associators *) +(* English : *) +(* Refs : [Ste87] Stevens (1987), Some Experiments in Nonassociative Rin *) +(* : [Ste92] Stevens (1992), Unpublished Note *) +(* Source : [Ste92] *) +(* Names : - [Ste87] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 16 ( 0 non-Horn; 16 unit; 1 RR) *) +(* Number of atoms : 16 ( 16 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 3 constant; 0-3 arity) *) +(* Number of variables : 27 ( 2 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include nonassociative ring axioms *) +(* Inclusion of: Axioms/RNG003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : RNG003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory (Alternative) *) +(* Axioms : Alternative ring theory (equality) axioms *) +(* Version : [Ste87] (equality) axioms. *) +(* English : *) +(* Refs : [Ste87] Stevens (1987), Some Experiments in Nonassociative Rin *) +(* Source : [Ste87] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 0 RR) *) +(* Number of literals : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 1 constant; 0-3 arity) *) +(* Number of variables : 27 ( 2 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----There exists an additive identity element *) +(* ----Multiplicative zero *) +(* ----Existence of left additive additive_inverse *) +(* ----Inverse of additive_inverse of X is X *) +(* ----Distributive property of product over sum *) +(* ----Commutativity for addition *) +(* ----Associativity for addition *) +(* ----Right alternative law *) +(* ----Left alternative law *) +(* ----Associator *) +(* ----Commutator *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_right_alternative: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall additive_inverse:\forall _:Univ.Univ. +\forall associator:\forall _:Univ.\forall _:Univ.\forall _:Univ.Univ. +\forall commutator:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.eq Univ (commutator X Y) (add (multiply Y X) (additive_inverse (multiply X Y))). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (associator X Y Z) (add (multiply (multiply X Y) Z) (additive_inverse (multiply X (multiply Y Z)))). +\forall H2:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply X X) Y) (multiply X (multiply X Y)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply X Y) Y) (multiply X (multiply Y Y)). +\forall H4:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (add Y Z)) (add (add X Y) Z). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X). +\forall H6:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H7:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H8:\forall X:Univ.eq Univ (additive_inverse (additive_inverse X)) X. +\forall H9:\forall X:Univ.eq Univ (add X (additive_inverse X)) additive_identity. +\forall H10:\forall X:Univ.eq Univ (add (additive_inverse X) X) additive_identity. +\forall H11:\forall X:Univ.eq Univ (multiply X additive_identity) additive_identity. +\forall H12:\forall X:Univ.eq Univ (multiply additive_identity X) additive_identity. +\forall H13:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H14:\forall X:Univ.eq Univ (add additive_identity X) X.eq Univ (associator x y y) additive_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/RNG024-7.p.ma b/matita/tests/TPTP/Veloci/RNG024-7.p.ma new file mode 100644 index 000000000..afb63d9f6 --- /dev/null +++ b/matita/tests/TPTP/Veloci/RNG024-7.p.ma @@ -0,0 +1,99 @@ +set "baseuri" "cic:/matita/TPTP/RNG024-7". +include "logic/equality.ma". +(* Inclusion of: RNG024-7.p *) +(* -------------------------------------------------------------------------- *) +(* File : RNG024-7 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory (Alternative) *) +(* Problem : Right alternative *) +(* Version : [Ste87] (equality) axioms : Augmented. *) +(* Theorem formulation : In terms of associators *) +(* English : *) +(* Refs : [Ste87] Stevens (1987), Some Experiments in Nonassociative Rin *) +(* : [Ste92] Stevens (1992), Unpublished Note *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.00 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 23 ( 0 non-Horn; 23 unit; 1 RR) *) +(* Number of atoms : 23 ( 23 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 8 ( 3 constant; 0-3 arity) *) +(* Number of variables : 45 ( 2 singleton) *) +(* Maximal term depth : 5 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include nonassociative ring axioms *) +(* Inclusion of: Axioms/RNG003-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : RNG003-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Ring Theory (Alternative) *) +(* Axioms : Alternative ring theory (equality) axioms *) +(* Version : [Ste87] (equality) axioms. *) +(* English : *) +(* Refs : [Ste87] Stevens (1987), Some Experiments in Nonassociative Rin *) +(* Source : [Ste87] *) +(* Names : *) +(* Status : *) +(* Syntax : Number of clauses : 15 ( 0 non-Horn; 15 unit; 0 RR) *) +(* Number of literals : 15 ( 15 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 6 ( 1 constant; 0-3 arity) *) +(* Number of variables : 27 ( 2 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----There exists an additive identity element *) +(* ----Multiplicative zero *) +(* ----Existence of left additive additive_inverse *) +(* ----Inverse of additive_inverse of X is X *) +(* ----Distributive property of product over sum *) +(* ----Commutativity for addition *) +(* ----Associativity for addition *) +(* ----Right alternative law *) +(* ----Left alternative law *) +(* ----Associator *) +(* ----Commutator *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ----The next 7 clause are extra lemmas which Stevens found useful *) +theorem prove_right_alternative: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall additive_identity:Univ. +\forall additive_inverse:\forall _:Univ.Univ. +\forall associator:\forall _:Univ.\forall _:Univ.\forall _:Univ.Univ. +\forall commutator:\forall _:Univ.\forall _:Univ.Univ. +\forall multiply:\forall _:Univ.\forall _:Univ.Univ. +\forall x:Univ. +\forall y:Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) (additive_inverse Z)) (add (additive_inverse (multiply X Z)) (additive_inverse (multiply Y Z))). +\forall H1:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (additive_inverse X) (add Y Z)) (add (additive_inverse (multiply X Y)) (additive_inverse (multiply X Z))). +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X (additive_inverse Y)) Z) (add (multiply X Z) (additive_inverse (multiply Y Z))). +\forall H3:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y (additive_inverse Z))) (add (multiply X Y) (additive_inverse (multiply X Z))). +\forall H4:\forall X:Univ.\forall Y:Univ.eq Univ (multiply X (additive_inverse Y)) (additive_inverse (multiply X Y)). +\forall H5:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (additive_inverse X) Y) (additive_inverse (multiply X Y)). +\forall H6:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (additive_inverse X) (additive_inverse Y)) (multiply X Y). +\forall H7:\forall X:Univ.\forall Y:Univ.eq Univ (commutator X Y) (add (multiply Y X) (additive_inverse (multiply X Y))). +\forall H8:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (associator X Y Z) (add (multiply (multiply X Y) Z) (additive_inverse (multiply X (multiply Y Z)))). +\forall H9:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply X X) Y) (multiply X (multiply X Y)). +\forall H10:\forall X:Univ.\forall Y:Univ.eq Univ (multiply (multiply X Y) Y) (multiply X (multiply Y Y)). +\forall H11:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add X (add Y Z)) (add (add X Y) Z). +\forall H12:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X). +\forall H13:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply (add X Y) Z) (add (multiply X Z) (multiply Y Z)). +\forall H14:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (multiply X (add Y Z)) (add (multiply X Y) (multiply X Z)). +\forall H15:\forall X:Univ.eq Univ (additive_inverse (additive_inverse X)) X. +\forall H16:\forall X:Univ.eq Univ (add X (additive_inverse X)) additive_identity. +\forall H17:\forall X:Univ.eq Univ (add (additive_inverse X) X) additive_identity. +\forall H18:\forall X:Univ.eq Univ (multiply X additive_identity) additive_identity. +\forall H19:\forall X:Univ.eq Univ (multiply additive_identity X) additive_identity. +\forall H20:\forall X:Univ.eq Univ (add X additive_identity) X. +\forall H21:\forall X:Univ.eq Univ (add additive_identity X) X.eq Univ (associator x y y) additive_identity +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/ROB002-1.p.ma b/matita/tests/TPTP/Veloci/ROB002-1.p.ma new file mode 100644 index 000000000..81aabc975 --- /dev/null +++ b/matita/tests/TPTP/Veloci/ROB002-1.p.ma @@ -0,0 +1,66 @@ +set "baseuri" "cic:/matita/TPTP/ROB002-1". +include "logic/equality.ma". +(* Inclusion of: ROB002-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : ROB002-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Robbins Algebra *) +(* Problem : --X = X => Boolean *) +(* Version : [Win90] (equality) axioms. *) +(* English : If --X = X then the algebra is Boolean. *) +(* Refs : [HMT71] Henkin et al. (1971), Cylindrical Algebras *) +(* : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* Source : [Win90] *) +(* Names : Lemma 2.1 [Win90] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.11 v2.2.0, 0.14 v2.1.0, 0.13 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 1 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 8 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : Commutativity, associativity, and Huntington's axiom *) +(* axiomatize Boolean algebra. *) +(* -------------------------------------------------------------------------- *) +(* ----Include axioms for Robbins algebra *) +(* Inclusion of: Axioms/ROB001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : ROB001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Robbins algebra *) +(* Axioms : Robbins algebra axioms *) +(* Version : [Win90] (equality) axioms. *) +(* English : *) +(* Refs : [HMT71] Henkin et al. (1971), Cylindrical Algebras *) +(* : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* Source : [OTTER] *) +(* Names : Lemma 2.2 [Win90] *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 1-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_huntingtons_axiom: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall negate:\forall _:Univ.Univ. +\forall H0:\forall X:Univ.eq Univ (negate (negate X)) X. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (negate (add (negate (add X Y)) (negate (add X (negate Y))))) X. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (add X Y) Z) (add X (add Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (add (negate (add a (negate b))) (negate (add (negate a) (negate b)))) b +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/ROB009-1.p.ma b/matita/tests/TPTP/Veloci/ROB009-1.p.ma new file mode 100644 index 000000000..e3e2ad2b4 --- /dev/null +++ b/matita/tests/TPTP/Veloci/ROB009-1.p.ma @@ -0,0 +1,65 @@ +set "baseuri" "cic:/matita/TPTP/ROB009-1". +include "logic/equality.ma". +(* Inclusion of: ROB009-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : ROB009-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Robbins Algebra *) +(* Problem : If -(a + -(b + c)) = -(b + -(a + c)) then a = b *) +(* Version : [Win90] (equality) axioms. *) +(* English : *) +(* Refs : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* Source : [Win90] *) +(* Names : Lemma 3.2 [Win90] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1, 0.22 v2.2.0, 0.14 v2.1.0, 0.50 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 2 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include axioms for Robbins algebra *) +(* Inclusion of: Axioms/ROB001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : ROB001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Robbins algebra *) +(* Axioms : Robbins algebra axioms *) +(* Version : [Win90] (equality) axioms. *) +(* English : *) +(* Refs : [HMT71] Henkin et al. (1971), Cylindrical Algebras *) +(* : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* Source : [OTTER] *) +(* Names : Lemma 2.2 [Win90] *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 1-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_result: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall c:Univ. +\forall negate:\forall _:Univ.Univ. +\forall H0:eq Univ (negate (add a (negate (add b c)))) (negate (add b (negate (add a c)))). +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (negate (add (negate (add X Y)) (negate (add X (negate Y))))) X. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (add X Y) Z) (add X (add Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ a b +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/ROB010-1.p.ma b/matita/tests/TPTP/Veloci/ROB010-1.p.ma new file mode 100644 index 000000000..76f06f1af --- /dev/null +++ b/matita/tests/TPTP/Veloci/ROB010-1.p.ma @@ -0,0 +1,67 @@ +set "baseuri" "cic:/matita/TPTP/ROB010-1". +include "logic/equality.ma". +(* Inclusion of: ROB010-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : ROB010-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Robbins Algebra *) +(* Problem : If -(a + -b) = c then -(c + -(b + a)) = a *) +(* Version : [Win90] (equality) axioms. *) +(* English : *) +(* Refs : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* : [LW92] Lusk & Wos (1992), Benchmark Problems in Which Equalit *) +(* Source : [Win90] *) +(* Names : Lemma 3.3 [Win90] *) +(* : RA2 [LW92] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 2 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include axioms for Robbins algebra *) +(* Inclusion of: Axioms/ROB001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : ROB001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Robbins algebra *) +(* Axioms : Robbins algebra axioms *) +(* Version : [Win90] (equality) axioms. *) +(* English : *) +(* Refs : [HMT71] Henkin et al. (1971), Cylindrical Algebras *) +(* : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* Source : [OTTER] *) +(* Names : Lemma 2.2 [Win90] *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 1-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_result: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall c:Univ. +\forall negate:\forall _:Univ.Univ. +\forall H0:eq Univ (negate (add a (negate b))) c. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (negate (add (negate (add X Y)) (negate (add X (negate Y))))) X. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (add X Y) Z) (add X (add Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (negate (add c (negate (add b a)))) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/ROB013-1.p.ma b/matita/tests/TPTP/Veloci/ROB013-1.p.ma new file mode 100644 index 000000000..3039f3412 --- /dev/null +++ b/matita/tests/TPTP/Veloci/ROB013-1.p.ma @@ -0,0 +1,65 @@ +set "baseuri" "cic:/matita/TPTP/ROB013-1". +include "logic/equality.ma". +(* Inclusion of: ROB013-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : ROB013-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Robbins Algebra *) +(* Problem : If -(a + b) = c then -(c + -(-b + a)) = a *) +(* Version : [Win90] (equality) axioms. *) +(* English : *) +(* Refs : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* Source : [Win90] *) +(* Names : Lemma 3.5 [Win90] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 2 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 3 constant; 0-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Include axioms for Robbins algebra *) +(* Inclusion of: Axioms/ROB001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : ROB001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Robbins algebra *) +(* Axioms : Robbins algebra axioms *) +(* Version : [Win90] (equality) axioms. *) +(* English : *) +(* Refs : [HMT71] Henkin et al. (1971), Cylindrical Algebras *) +(* : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* Source : [OTTER] *) +(* Names : Lemma 2.2 [Win90] *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 1-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +theorem prove_result: + \forall Univ:Set. +\forall a:Univ. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall b:Univ. +\forall c:Univ. +\forall negate:\forall _:Univ.Univ. +\forall H0:eq Univ (negate (add a b)) c. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (negate (add (negate (add X Y)) (negate (add X (negate Y))))) X. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (add X Y) Z) (add X (add Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).eq Univ (negate (add c (negate (add (negate b) a)))) a +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/Veloci/ROB030-1.p.ma b/matita/tests/TPTP/Veloci/ROB030-1.p.ma new file mode 100644 index 000000000..72fe9de94 --- /dev/null +++ b/matita/tests/TPTP/Veloci/ROB030-1.p.ma @@ -0,0 +1,75 @@ +set "baseuri" "cic:/matita/TPTP/ROB030-1". +include "logic/equality.ma". +(* Inclusion of: ROB030-1.p *) +(* ------------------------------------------------------------------------------ *) +(* File : ROB030-1 : TPTP v3.1.1. Released v3.1.0. *) +(* Domain : Robbins Algebra *) +(* Problem : Exists absorbed element => Exists absorbed within negation element *) +(* Version : [Win90] (equality) axioms. *) +(* Theorem formulation : Denies Huntington's axiom. *) +(* English : If there are elements c and d such that c+d=d, then the *) +(* algebra is Boolean. *) +(* Refs : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* : [Loe04] Loechner (2004), Email to Geoff Sutcliffe *) +(* Source : [Loe04] *) +(* Names : (1) [Loe04] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v3.1.0 *) +(* Syntax : Number of clauses : 5 ( 0 non-Horn; 5 unit; 2 RR) *) +(* Number of atoms : 5 ( 5 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 4 ( 2 constant; 0-2 arity) *) +(* Number of variables : 9 ( 1 singleton) *) +(* Maximal term depth : 6 ( 2 average) *) +(* Comments : *) +(* ------------------------------------------------------------------------------ *) +(* ----Include axioms for Robbins algebra *) +(* Inclusion of: Axioms/ROB001-0.ax *) +(* -------------------------------------------------------------------------- *) +(* File : ROB001-0 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Robbins algebra *) +(* Axioms : Robbins algebra axioms *) +(* Version : [Win90] (equality) axioms. *) +(* English : *) +(* Refs : [HMT71] Henkin et al. (1971), Cylindrical Algebras *) +(* : [Win90] Winker (1990), Robbins Algebra: Conditions that make a *) +(* Source : [OTTER] *) +(* Names : Lemma 2.2 [Win90] *) +(* Status : *) +(* Syntax : Number of clauses : 3 ( 0 non-Horn; 3 unit; 0 RR) *) +(* Number of literals : 3 ( 3 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 2 ( 0 constant; 1-2 arity) *) +(* Number of variables : 7 ( 0 singleton) *) +(* Maximal term depth : 6 ( 3 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* -------------------------------------------------------------------------- *) +(* ------------------------------------------------------------------------------ *) +theorem prove_absorption_within_negation: + \forall Univ:Set. +\forall add:\forall _:Univ.\forall _:Univ.Univ. +\forall c:Univ. +\forall d:Univ. +\forall negate:\forall _:Univ.Univ. +\forall H0:eq Univ (add c d) d. +\forall H1:\forall X:Univ.\forall Y:Univ.eq Univ (negate (add (negate (add X Y)) (negate (add X (negate Y))))) X. +\forall H2:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (add (add X Y) Z) (add X (add Y Z)). +\forall H3:\forall X:Univ.\forall Y:Univ.eq Univ (add X Y) (add Y X).\exist A:Univ.\exist B:Univ.eq Univ (negate (add A B)) (negate B) +. +intros. +exists[ +2: +exists[ +2: +autobatch paramodulation timeout=100; +try assumption. +| +skip] +| +skip] +print proofterm. +qed. +(* ------------------------------------------------------------------------------ *) diff --git a/matita/tests/TPTP/Veloci/SYN083-1.p.ma b/matita/tests/TPTP/Veloci/SYN083-1.p.ma new file mode 100644 index 000000000..c8ac354f0 --- /dev/null +++ b/matita/tests/TPTP/Veloci/SYN083-1.p.ma @@ -0,0 +1,38 @@ +set "baseuri" "cic:/matita/TPTP/SYN083-1". +include "logic/equality.ma". +(* Inclusion of: SYN083-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : SYN083-1 : TPTP v3.1.1. Released v1.0.0. *) +(* Domain : Syntactic *) +(* Problem : Pelletier Problem 61 *) +(* Version : Especial. *) +(* English : *) +(* Refs : [Pel86] Pelletier (1986), Seventy-five Problems for Testing Au *) +(* Source : [Pel86] *) +(* Names : Pelletier 61 [Pel86] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.0.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 5 ( 4 constant; 0-2 arity) *) +(* Number of variables : 3 ( 0 singleton) *) +(* Maximal term depth : 4 ( 4 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +theorem prove_this: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall c:Univ. +\forall d:Univ. +\forall f:\forall _:Univ.\forall _:Univ.Univ. +\forall H0:\forall X:Univ.\forall Y:Univ.\forall Z:Univ.eq Univ (f X (f Y Z)) (f (f X Y) Z).eq Univ (f a (f b (f c d))) (f (f (f a b) c) d) +. +intros. +autobatch paramodulation timeout=100; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/TPTP/classify.sh b/matita/tests/TPTP/classify.sh new file mode 100755 index 000000000..54634e741 --- /dev/null +++ b/matita/tests/TPTP/classify.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +mkdir -p Open +mkdir -p Unknown +mkdir -p Satisfiable +mkdir -p Unsatisfiable + +for X in [A-Z]*.ma; do + echo -n classifying $X ... + STATUS=`grep "^(\* *Status *:" $X` + if [ `echo $STATUS | grep Open | wc -l` -eq 1 ]; then + mv $X Open/ + echo Open + fi + if [ `echo $STATUS | grep Unknown | wc -l` -eq 1 ]; then + mv $X Unknown/ + echo Unknown + fi + if [ `echo $STATUS | grep Satisfiable | wc -l` -eq 1 ]; then + mv $X Satisfiable/ + echo Satisfiable + fi + if [ `echo $STATUS | grep Unsatisfiable | wc -l` -eq 1 ]; then + mv $X Unsatisfiable/ + echo Unsatisfiable + fi +done diff --git a/matita/tests/TPTP/compare.ods b/matita/tests/TPTP/compare.ods new file mode 100644 index 0000000000000000000000000000000000000000..14f5524222998ade0fabb238b3808634e5871f49 GIT binary patch literal 247881 zcmb5V1zgnY_bp6!mvo099U|S*CCx#)29*ZsZd4j!XheomQUw9&ZibMM5{6JhLK^Nf zp7Z~m|Gn@3y`T3*@!*{E-K=Nrz4l)F8IGPNItB#_^212>muU1;i3EP|HS!Y&d_IFb zbMW?ecd&7He+sd)@rJm$3i!I(^Sjx2LA?0g+#Ou)-RyjxIkEjme=u`IplU{8k_7ECq; ze&2{p#E<3AhMewn4ShWuebSY@ban8J$*MJxe`JVQ;1=O_avgfheId2hcI*9C)av?t zqj_up<_}Km%juzM+Mx3oilB5Sj?SX)cey{-Qa(|64Ln>3bFz1=>KMOYl17Vw20jBLkl!o>yJ0#1%kDyzQ)-|F5z2t5)A zy&8~~z2*3FcAWUU+A8Fp?DhJw_D#!L^X&4?w06*i`a$h-+s(oBcFta#RlcLnEs5+k z@0y5e@R~njTeo_tCE)bp_|y4~K=pFl^5NUt^OM+9kokb~Z(O&(cfJkjg7l39GAD=n zonJ4U%AwATl20o|-B8`{Ih#FYvJ6(mJfHipPkXv45PEj-`xuTmG0}ZJRv#qw_$Dx8 z(!{Oju*c%;wdy=T|4A2|2k*b6X0z=`%>ZJvr_(frXmG zbp387#|kF+ZijwUkI9`Wiw`1sNtGudrpm3Nv{-(bCJN~&56DQHCxCQpgMTW{H>_y& ztW;4#I_45OxHHa(ZOhK8ee~i(-`Vx7q~0oMokY-;s+VGNT|g&ZN(y~;8HefjoO0=ftPgSzlgMIy?noBXR8)+k(e-s%VrQdAD=*smvTWuKFvrG42#j{cxbY# z?vbEFST46$A;WVqx-+F3UG=-{!F8hu>o2D0sGDdcwbGja_&DYYeJ3fS20WBwe5#lGTXlq2f`L+AW3a0F{8|!0X=-P9x z(&=(D+v;|tV0AK2yxMKf%XIupF5}bw7uoC9+h4n}#GAdo%O}C15x;ep+OB_}%obcd z4m}^cVz@Z0yuE-of0AoCzqm@;+ieD|>6`fSa6SKrS%KT*-y_@2$4Sew!G7YQ?~mH9 zljLSqE9G)!QOtJju6|F8!`eQGyDhii-5!6tdVT(jDb(-sditrX(if#5m(AOfpg@a2 z#$Q$x*LQr*yM#meW*NI3Zp?#x`z|%_9#n7CR|=pkb~7!9T$|id?Oei@4t|^hrgysJ zuD@S-H(h-SoRmK5cn)i;p50&0&(Aq3hz)gn-M4tvx7-$ZjY!`C@(aG*flqIGjiUse zZJa~~z8_geJzADHe)r4lcr$&hz$;|)XXcmCfYY5z69KuFi;EuE$95AVOj#KJfrNJW zm|1atUHc|||Cm2kSd#2AE?T&*FDE?d%igw^{<5FqjdsIkQb35=)!_n@rA+YIk5ky# z?M>JAGQ42aYOO_X<1+N(eV#%OL1j6_zE=h?VG z_6l**e9H7$VEy)nBL39hg;Dmgam(2;vD;EX2yN>v;t=boULfRLAlNNm`ShD+!SXbR z^Q1@7?N6&OSJz1vSE08(%ZX#nZMSW=AwMr~uhT-$ZbSSoSGn4*51)sgZR~H}-lkby zT{yL!?Y@?~zD|-oUvrX^8oAn2mAlw=ySY}C3rUr`k=wZC2w|N{k~@!my&Qa-ri&mx z3%X%CbsF#MKkB)Up?904VHg|MopT)VEUUixx=QG4%KV!`d!(Cyh;`a-DhEpI{n z?MU0`?dA6Zy=9@c+n(w#SB)AbiQeUX70R#W6!6xKudPTRpa ztty8E-I_uIK3MdhPP_gP>mS9lsvZ*5ZT)g~GB)leRFW@uGqC;rw*E5vYWem6Ml5$e zwm0N3FxGbVZNKem*Nfv@@txHKf!k%dpkJDwtZxdIuMfpEQIB?^aLXc2BnXimmnSmmcOqs`E1Gb-V2n zzBJ-AUCcv$!jvR)nSP^>n`ehxpUtb3JauP@QGe$?#4N)uqkc5vw4*;Z^@e0e|IUuS zxIvO)IX2#_;`}oE@8znG%TyV10%R|4&bHld4t^|K-Q0xm%k76SUP<}aUi?V7y`L$3 zCLT&_X!llZZ2NBhf;PVDCTey#R(7~Tj6x|||5l9r!{cuyLGSpxhVOcPuuxUbuBEFI znDsYAaR^IbnGSkLbNxb?R)HoM{1zE>rf?`+xtkuZai7uQ7}LSqBR%`ck2XrgFB!TA z;>zw-SUUNZ5Bc_la+)>^LXUF3+;N`lAVV-B^6M7u%-8bY&mxbNUB2m3`$|nF*eSv# zPxU{C6dIedBiRwUvm*o!sqpV1`z*@(=yL+r=pL+Ec?`;32w9)P!{{CeG20!5y(m$5 zDBLgDZ-_#(K-S+s8Y4G7`dhdHD0oyBG!5J6I_r^dlqmy@j;Y?9k3aBN49W z0-FKvUg0WqzOOJ^>wjPX7@ zr<6fy2MPk30fl)hH|W6vN|D$TUqjXfd}ZNgH>fal`#N+<6<&5HN4J8{ZvpJf-D{An|o zX|*o#wfL3mOJ5rnlAE7QZ;T<6Qr<18%xOJ96vH79)AA*?Zh|aq$gCm{bQaq zS52jj9_ME5+rOkT|B`y4ASPJGx9#DK_tP^Ftr`TUo_b!Hx5ObDuGdlH!cWqmmW1gj zLskFVba79Hs__hjjw%G9nVmD459la#^(n=6xW+BTkDS;NhXv5tUOoTF3J%!n#s|r;k6%9d3 zNf9`Lv$HW<;>X2)FOyBpbN^EZ7ZWFXliS5jq31ruYMg1r{w2+lY|nkN>|K(zG!^Y7 z-ZKr`eZ;O0#Sq(2&iq_&(=pmb#vYj+5k3%YPbE~>KHP5$0xo>(M|;hN%rQC0@xX9| zz5Y^iOY^;VA*ZocGVPps(sivag6Zn%(v#2fQWhi$l*FvdI1K8fS9Se1N2EtzDrs-0 zMt{sB(zu_bi9%XR3dmtLuNpvub0*H^@VegN!e7h<KPUm zSXxIO$)-MPd$>l-^bw8wx~;+QM3nZFdhNMtb*$V2IC>a*j2fzr{p7DOHm97rAo-lb zx8LD6I{DJJt1j&6>M-dEGu_2Q8?p)o#b?{;yE{RjM}p8RdkTR&)C>ibcn~#=pa!i1BwohaxALj6);@VuH4KVk+IEsv1dQN<9|c$ zdZLV~!`NK6HDH|dS7%sPm;tr>eBHevqe@jrw-ZrElYHYa5lU2gEm4r>u==kV9F8WL z^^eV#Tum|?AA>Yw77JEU zC-YRM#oYV#!TX;q&H;2>MauWtVSo`Y)FPGlyh2TNxf_FrzD;%A8-vzy>^MCfc_@nY z7G{~R@69$G1pNYj{dZ#M`C%`Ew7GYMc-?Dr9Yx)a9}7nW_x#tAIg|b}!}!Md`$QNCWNZFuKVYpC&0Y0J4p8F9;hTW zWF<`w`#PM5`EF>s!LFZ4`|l-JJXG{Q9^@Kk$&rf4kP^17MuYFgBS;z`v5#ltRoFVn%l$5Wdo$!%}3&Pg>}=eK!I z2yLL)z{+3e(p{~2cZ&z!{6%$4SjM`BWynd(3EfqOr@A)nH{dZ%m~U`GOTCA#cPIj^ z5CoEcTJ{8QokRRU<_7OynV*I-Ir#s=QeuzinHCh^e1aFL8 zJk6_(rw=ke(Y@kueE@=!vV-6l*@S(EBr)Ila6ErfsW3jTDReueAQkr)W)ft2x*3_d z*m13qIOzm0K4aR|&W^my_^W2jk;+1jM<|+Ku<4*|7o(nA; z7yWM+Dkv;vWcY}wT&wQWKj5C)L!X$zdy}u6jH6vcv}3-by<#-j!>g| zi19a9s8J(?3TP<>;Fh<)KT>g6YUXP6v@lAm*m!=BleOxp7OocV0(TLIe&vp``^tCe z!4Vwoc=PCOLqF~@f71vO!6)2;O(dPgE=E}uMk5u*KFt+Is};t8XA;0ObClV11yPZU zjCp0mqOQv$T7F5dd?!1j)Nu?$Onu!@MHZ-zKAAFfW_#$~gQiCamk~G#P zn>35`qln^PGx{Iqy~^wM%bkZMC80GIcASOgpeRtekVRq3V3g%!I5MN})9hooI-~z@ zQAk!0*)Yf$=h&7!H+&&Aub-lRs=m)gN_weAtw62tkxfnWv+hK;dtf^xolXHd8Jys1 z^o~`ETX3I4unDD~_0llwr@=^_u21t%gVj1+L1i*|Kmtm#+3#{9mdl_;EEP^4gj!oS z^*IL?T!B#1Su@Yf6f30FT(u;UN7%j0-c;s}tm#xXo`F+^SzfuTi4%`S9&U`|^- z7JAU?PJ`f#DqYW>@#f_H3KC5!n8pt5RA=#+VV11H$c2_qv#i1Dg%;qB6ltfT%nHf} ze~2*c#U#ZqsS52nGpR5Jml}%3-0dalO{S%uOqDg5E2{6X^I_b?N-3p)Dkkb+H*G)%3^9L`5$vc7hOC^bMCBR*k=9S0Mo2W^UC6BOVhXNyu6OieAAvO?2 z5)u$b0*tI;95AvZ$Gj6$yc4|R70k~KwJzuMi;mPp-xjfS3q}b>O@$?AvO^Vpda-n; zj|9bIL^&o5yIc%<98A%a1aklt*8RofQ(1}zV|d!Z&58!!@w7p@l>im($!106W<^au z9;z@#mo|v9nL1)PM$x_)PgOMd{f*=b5ln+{jQYq9RdO1xFtXA3%3WA&L;0B6CdJuB ztGL`LzVyrE;&P98PHNTx91nFa!A<~kg9DoMu~PB40amm;_8u=!wU}F#R;gFDFZoDr z?0~5gTp;w{eN;kQS>S=40Vy^L3^)`E3>YM2SDl6!3(Q??zi8qBB&$;umG(wK1E^ef z7NViFcU%C;YDkh(hZVISTbB8sx7-A-39px`Q1Go!KnCMWqqip@;W<=3P%6G{(RX_n z@?+je_@zTSPP&V1%tX|74+4@N1 z$4|b*UW%OWJA>)9-3&H*12qBs-ZgjciOSwQiiH-hF0^`GFtJj32en^v zi=R|2PJOy3F7|#ALy0{FIkDKYGjcw+c&5=&iNh5cS4-cX+Rw)>rwtG$N)je!M&&rX zZ$Ffq$w_@S=!!Q_xv7tPzr8B0eZ3Pa(Z#^7LR+Tt{>g5I_RGrqz(L)Q0}hJNak`Yh zdOk=rG@9i22Cw$bHKo5{PUaE<;-ABXu11LhQU5Uayiy#cX^sD0pPrUQuP(!yf60tE5M10#EFtk32@q`jZl7qhY!5@N*|C)v`AKpUK&~FZ4G_& zG{&2`4&HHM&X7igMK{@ztd8+9Ku?jQYv)`G+i~Ivm{1H^X4TuX>~IAzp(MeC+F}M1 zN>Z@i5?*5|5*VmB+04Bj;%ks49WW9udm|)$^@|uQSrTP3)w13_a1HE)ILsB~t8cks z`nV_^^ne32=0sDtwXL>DqS(l;t#)Lh7~lXU9_)qkj$tx^pUY%R?`fg*fcOFK@G^~jB^ zM?8QrefCLy>ftg4OaZQq=SdvBIL3&VrdlO2KAS;A9Qv5sPHmcvDW(Tnez((hB*z-V zOABQE1uuXVFE+wEBl;;(jF5i@uxW#2lRCQx3jSj$SMzn!CqxZzZ2kOHG2x1>r9BE8 z(C6&YrN>bCRQ5{Mu!Cs?xgZ=AxO->utZ0@cd^kYctJxC15&#N3l^hiKN|aeOWblU= zQyHXaE05AeRqEbhoEY}S+GMx@|3)6A5y^U?;>bOzdoj~92`raO32z2PJ3P1F6Tf$t zO44Y@MxhGLOJpk^fy*EBy zERpTc3frSbj2LT2kgJYl6&OS?uQb~S*gD_JtLNJ2jVRB|V6x9Cq;L%<22vLsd zse4bN`R(7eU!}IMM=&QE!mS@^i)exxeWV?!iL6l!WQ{5~mY3R;Bl7>E@NG7P%UspY zig%=9BhZ)3^nIM7Wy&m$LZt4!H+i~Q<-VLpsW(>xl|71hESeKS+K%r#^AwDy7UX!k z1ICjjay;GnSvA+NA(lh@v0f1_b?-RD*ZAvhsI0Je5d>)Vl^V3g%-ACdZQ+P zC*}@{ZJxxN3srNLw^eyxfo#0w2B5 z4r~sAuU#M;xf&=SlvJ}eh*?|H_uoCf*QH9RD)5Mar{*i)vW?Rwj99t+y$nML)JE@(hF22kAt>KfVI3NEvpu=ruphL;5w>ckMypL9i z;-~}KqUR<;5_fk-@U2!{-dPWzv*C#I?%d}ks#s~U>sl+L9hDO26}$&PG7l85HDo2g zM|pGtn-kz`JUahQn;yte<%1?0Fm0aR@sOloe(q$xlsC|zmqumUovne-yVepjz_{ldj?nqb za{SzSH!g|z0oJ%Ao%~;uUcWnhdl%0p(z8TDi)O~GhIMeY z_{VGSO7NAgH`J%Xm)@^8G^TxJXQ zL?%4g_hMfU_&_v(89n&nKXasub>%n_MUvVP6=s#Dg}n;H-a;WrDUR$f`MzzPg_(B1y79~#9O=a}{Zj?@xN9giIJWCh_Wu=N>uOe)%dtkVx<#Vd;eJSMv3%0uA^c^%YFHMi-mD(k)5CV0&V>h+ zuHWfR>#`Hrc;{Mh)&FC9=miH5f|~bZ7dUdz`RD$172vO$_n$A;^s~)T98+#ZRLgJ1 zsAR;b7^IGP2J%+VLN=eeC&^^$)z)b6E7yR5p;aX@YzuJJBEtR*QdT4`9LHLKtLoge z`7Zm-8DZv6bjd?!G0b40Y`?R_0cyz|`91|7=ycKdGO`gV*OhJyWXoerl=o`KfOheY z)4SerCTf%iIaf{sIUl#9awgiqgg*BTU}|PaQ7z)$qU-GLS|;hW*NY_}su-=(!BVAk zTzbn8PQwQ35tm9E5e5;CHA|CNd_O?%u8s7#7)X!XQ8hqsnwH(f5PoaR$UBGay*^=& zr=%2Xvt_+ihRT3FZD-snF(fDTs-m}LS;g*;qeH247Q)s_lo&Q2UiIZeggp`Z*DmlO z+RcX5?=zvwA_cu}%X-3^C=1IgODwBv zmv$I+)*6V!8z~ZoVcOwvv8?O`^0S3->j7C5_9QHWaayeoS}m+(9+b&+ta`t|Vm=y2 zN|cVD$$#t%nOA#yR##Owy{m~WQ6m}P2?Kd0fMRcKOSF-Z^)t6IkGNO*k(Pp{5T>S3 zHnGb=$Jca<`o;YCA3l=oH0j?&P$}^%*G0%*B;vpY(6X#^RkA{~g~_7|7_HF+l@oAT z(_T46cu?8A;_Vz>OmBZqjG_4(mBC**D}u@fkIF{a+c5l9rgD}iM`!xEO4e+pkMc1| z9^s%5V+IPzFfJ%rl)5-URjnwAQP$yKzNCn_M8SVaBSrMH4nG#>IE)kI;Ok5$7U;Cc zH!{MX_S0iQT=N>v-uvif+*lor$3tffkG?}Cgouk5>N9&GvBcj??;(WDC2~d_bn^Dn z48 zcY+}Nnnk_3-y*ki2Ba~?t{3&Phd3g9F+(U=P3wqJ2G~Z}U$tUrQp;1zLPt+P>_ZZdJhP|gv$&tq4e{P&<|;foO31-1|_TJsQ(lu z1dfd9;Kz&4)gnX{V=do*ym-SSx_>2!E}{XNr2sGO2r1n8RsBP+md9@-)@YH2=^v-} zMxySah+CK9swzta$0bUtG_AJ!6VZ*XC!#cJJ7@!-Wjx17eFMxR0ehAW5LKA{gv+Ze zW3Su~(C@qEBc!v)MN=NRXeJMvkJPppr=6NCYTz3%mUI4k#045+LwmJ&Maxo_X$4IW z*6fc4ultR$hU7d{#sf~QSybhvRv085qMBmYPo^KhWljcN3^?y}u4zSf zlZwLfagnb#yf0m~qTCsh8Q=$@Qc`8ua#pXHt1f{Chm<40{Q#Maq)^NTnH^X-kY)}n z9EM($VaC}^4 zA5^Fvg~ZAhrrMlXoLQ$h>trc=K{=rCU9u6}KNlE5$Ued}Og2*9qI@(Oq}Qrq^XnR; zBQ=;=jqzn^v5HxOirEWhBa#xKmyRi31UK6g(1-O`wZwnQ1j9@eN?tmV>-ZAk-Tct2 zQw-^e|GB(*=w#Va*<3n)Te^%fbXPpf(DDiAzp%~Oxm3D+X>0#Pe2{K+A z3>ysY7tGkxPL}?qF@blz!(}K`jhrkYdRfy_WCj=tf{{RL%>Bh9xq{CSqEAF%3m>w{ z-;V&T{d0f&A=|+J8Rvcxa^2|8PWWwH9(!v1OK7~JPaYPDC%XTf;5eYicNFhb1`98P zuyVT-KT*xAQyJuBG8e2aI*n=o<$5&eqJB115FOsh;l-Ll6#$YIfK)S>DCX@c=EX{_ zkoVLpLNJ7{mpvMhLdQj9fhCC9tQ$(sIg<-!o_DjUS7#5Bz+|8^6!v;kFCKxJb%sAn z`n%F%KH~&FV=a6mNcab6c|*JTNRBhA2y)}&<24__g}dm~8+(0zTq&_?j#R}zrmj+= z)>y>t(zbn<5Tq1Eo$+01=kshJRyArh9#q^XVg}(+AE4r>xQ>6LX#nY*&UJhT&=`Al ze)w-_jJ<5%Awm}J6pwwMHf%64s5MFZNglX+k)>G|LwWe2U?7>bZI{1He zLQp~UGA^>!cnkx#d?%|alW+3ujltwZ>71$k>jrVk4_LXYSJt0se_Byw#D7(FNsqI zU@MW{XL?J(kS+)vVEfeAa|NZUj{8RtYaYcr$lA!3_j6&3`7EXBzN+}qB3@v9q2WAp z6n_{L0g)Q37nrGZT_Imw#KqP)Qnx?k4l1TEsQKbGHu6&XW|W+UKvbH5fS7=oa&@(k zbu6&6OaEE^X$x#uISTGIGXX$HXQawC{}B`&plEK065W z7c4R(CZ6d+N8J8H52HKgUHZF(NP5~MeGb|g$A?DR^}`~BYqQ!{V~eX z)pg}G2~*RzlgnSU2>K<{Nbc%G)i77ad6Z1iKu~A#_`(@Rnj?}H&M~em-hTqgb_62> z6@WmUTxs9QGh_A|n^+FjlyvRo^C8ngr5US5oYHZTgG&22#Iu^c2VouPhT;ts_|iB6 zq$fknek3}qJ0@?tl+Gxb{ZP<3R$1fcA({*!!59X6z6jBwF+TZ zKg?xxzFx>P5qLPD?^Aq=AfKwh9S)HFrJ*0rqY`b9kU*%RuW(nTLmna$|UCKRdVGpY=*Ba`EP65;tIV#)&5;;JHPeW|CH z$SL>(x96TRW(5hQ4hzryyULhFB$()LaXEy~DHJ{M^gHk-WIl-qb1SRTGWM#*V!JvS zx;W7rG6Yon_UeBqn%!|QIjIA%J~;k?C2UwYsJEJ4WE&}LNHVDRA6PH~%8iU7;@Q!{ zeTV&1?{Ag;?1XvFtl3#=S!xv|0}2jBE9Aael8~Se{9Qk_JPnQRnhL?=!&XP%uxdp> zg~QFp*e%I<^t8*|p?b9n1l$4x!^sGdA~5q!CmP=>^wGqoMg2 zSf8T8!^4Y21?de*0;;Kc^*0KQew<8@ll#~KsCQbZ4GV4cR=W#rBdHBZY>`m!00uiS zxv(gCu|}5K$Gy>&_F>^Esst`u24b9RhJ;5rM`~D%5@jUEmeQVvG+Q$M7(O;=_4%qT zIEIC+daKGH7LFkaD~JVEMRo^LE;LGBv~M0qiU`th+6#`Pc)tPoecl7a$mbk!jzoEb zj@5txUm~LCOD(w5gzt9Hh$j=}uZ3|KOUT17jJ6L*LNIX{+vU~$;uU zV3sk|<>bs@&SSN#chtt6gn{G;Y_ae>Jqkfikj|M7S{hCdM3&=;?CIiY|C@8shC5v~cOn;PeCBDML1d>Z za;odx)>;;70W@~M-y3y8sq~CC;79M)K&R4!KGYJ55WF1U+>Z?8*ulHqo(x? zdHigEhT#wHycq-6@c<3QAAm=4fHQ%FrkO~uoW_CzMl zx=8Gu)60>ZvN^J>lbV$e`DD`p8nBaeI`GVRKt%Xt4M}zo9`A#9Fy88upc*@NXpmqt zhtz6{^dns*O_`A{O&NcIha0Wb*cpLKUIM-PC;6vKiQ(oT31eKAzqs{#VBX+|$rOHZ zg1fBqZp%IxZ3s`(qSjQU#e)1$m0R(GhvW(E+2DlDTks95a_v#N7ik ztW0zIZa|i*3uHkJN*NW4>pXpfqk#AmQ>5(qoNDe> zl`4n7XaU!H;cvS}4lVHOZFvdzh?Ba=!@nZNer8;3DZH5H3pdkcvE1d>{{ZuL0T6e& zaX$cv+AIK~UYtRohH>CtbV>4~w*i=~0tRDP-hNqpk)NQIp(IkrcWV zeXu}L@DGMrVWCENUg)&(FpzXsqoATu-^InL9pFMizSwgy`coV4(K6(D$-bfgabD(^ z#O}k#?8D4H)Fm9jFsQv#1pd&bhc7KeW4%1Khz`rD-rpihQ?GzS@JCbkkTfOFk)aNv z{C>YQCCd>8`r9UU&;j{9gmrs_$AUlcANEV@YRP|DAh~jltS!R3FUoPmJNMaH^Sjw+ zpKwWDAP5}Gm2$msm?xU<2Zfb#oN%NdaKJ&CBgp+K4$;P9pFB4G>|=8Z|J?s(Um6wb z{6hKQ2f1T14}quNGpArIiHfQtS%L_29*|dN%ZYM56_{s&&Ig5wavT+8UYS8G!8ikN z9%JvlCiN863CMP(0iRXgpp!;rKDQCJkMi?GOBNGZ|ihW zL@mN&7UkIH#l?BHEuo2ywo?jXF#8F?6nk<9<0YoCgkY@QxgZ8J(t6f8%DICU0@CA!ky=(CCa!hoCiLV6x?0B#5CD;3*qxS9qr|cybYhRJi4lob&;z&OKWMt2JfN&tHPq=Uzwi8jvS<}l5e>46usmpWdT2)( z#JRmW31I<~qRh@%7+6tNv_`Hju*E65^c<+3E9f@_WT4+fKG*>7JT9(t_Uwiwt2dUb^}YUEeY7N| zjWoD8yo*|>7*i6!Psty2YQMx2|3L1#L)fXUjUx{HlswW$ljOP^)Vqtgr74b|zD$g} z?EN96#<^NrniSzIi`S{D;KGPGflcYQ^y_XvsLEW8y&wtLE_fTPanE!w2 z@k)#M@wcdrPG3133Q3zM@>eywvxRcB?`~Ic_=U ze`KHL;*#ltl)ZYzKg0+!8=_)lx;#Wf(-bp6K|Rsz|3@UK0#Jnw z2^TWbqDNY%eX7e2ECnkn1vMPCNSc{C)1?=+^F&dI`HGKOep>NK6H3IdN7`)!Xc*s1 zpdm(*%u!aTXc&TeWF)p}x+usOW8Olub0``b6_n%Xc0lcvmxe%{v9hxivJ`j(0T?!# zsJBq=f4PC^m6v)v(ymvifZ+UZ+|d3PHxTEd44WcK{C6&R?}m}@&Qh2^7ML4NSship zSLW($1f2b9sX}y4FRu6q$TrKLZ2!Ib=rlr18?&3j739iPx+6a`7TA-ynnQJYkt-o^ z^{bA+)w>@dT|Fp2;OZAe%iQ4)R!irY7e)V+-`_h}H?BA#zW5(kzu3^=4zF`hTMjYw zznn;QH}H)-?2$~WLsv4G*Pf#xof(Q_tqHr}3O56W+9kL+4Iup$7%am&P_o?65CX3YNsBMROKB)s<~@lbWMt7+f8a1n zY}0yCgp*QuAM{A_coPp=!yZU(0{p3-2d!eyzox}7x3neUXjIwr0CaAeP5I@z`^t-T zGxzxq7Lo?t1}7;-HcKW@79H4J zJEFWh!;7QTTfV(DFyDua`kU7McX(X~(2tNy#|IH8nU62)*~yjk;3)gEZAmE`Lcg~50M>#qyr*F_(V$N6Ys;%4nlk7 z4k@Y&5|gaSLW&rj1f2w_;R>b;Gy}|4yIM9RQx>4%Vf~udiFA>A3HOB(&g&>SOM!-m zg?Oqs-iy?~Z(p<-+!B zg)r;9kML>@?5Kl#@?j`g8fc174{`szSocxHE6uhzhXVczN^w8wqgRP;-wR^5R%@*C zZU6@Ks2N|-qg>wq=~2&MDj)J@AX2+n&tM!4|84RvK+G0EkLvM#w%K;|`*u4p+_i-u zQ;=DZ8T7-*9m(pa>_2@PQ)*`CgjUNcMxUHKstj-t4i7qRQPu{m#bQ=(H#Z!mFn6jB5kr~~k3{WBL zCj(PC$(`8-ab;i}$4CPq4B|!*=!`*zen{-UAUMgPj&QY&lMxg8_(Ouh(>h?(8rJ~V zKpnyZ(HN6>|C#!=jW76ey!?24fV(|)s1fINVLnibSNv;lbHhnUUJ2Ya+1p%k5-7zB zY40u8*z-QNl%)Md^H-rwa|xUj^&Fvem_r;B!!z!#C&5KPSXv)Gy)8UUM5t=y6+v0A zw-)xi{lMo%30f|QO#2|gY~130)iurw?P;0sb%fG@Cjw*~Li4xhWf1Dm?=dcHZ$ z!gQ|FI*E)rhwFbK)*P8joDO;MQ~afcz$|I@x*A$J3$pSK+B2G4k>(RwH;L z@yp6VsKynsJgRALbJ%tRooHU>xHkyZh+ItgA83P6+d++3SkFc>NoRfrDA$4iho^(^ z;zPp9ERPnuPh1JNzLP&IM03`x%#ukaUEd8HI=)*|ijQZvL1!K!t|rCDvI`C!k2FK9 z9+NsllcNlu1Y&k4NAYo2jQ7FKL>HP>x;Zg5csE&UA~mCx{Ul)E6%Jvk)$URYfu=RO zp;$vH{(S<=4Irtnf)6raRvE7dS53ldPzlnzW4^AF*Vwr8j1{#E9;Ij9Vo4Cvy4sAt zcI}Vr^OE72d;d$CEw+TXNkevhkne@0@??5%{Tbtn9~+XaFVib#Rg>(dT!8GUerb%M z8U+yPY)d@V3m}S`1X6HJ0a7sS=9a-W4%lmoPEp+`vVrUkSuaO$llbmM4Y<^3TzFv+jl!ypO~^I z4IAumDb@D3tcROLS-~i(doTJH72f8b2EFw(taUnp1|KIsyv{`K#{#GHdQF=v>-k++ zO`G!lGN2_XB3qJP?xNRSfz$Pey}Jj=D!bfUt<({xw(e|i9WK#cfXfU<1+Q6!s)YJdwK|4QS>HSX`&{rhD0~qt>-JQwB}mldf|GhL---;duBKC11FvgDH=P}LWR&GN>Gd+^3f|!=yPYhz80R) z0h& zCC4RKhpX zk$(xc1^oa#p~*%;VSYh=!;a{W>G_U6TAk~1!Sh*@1_YH@4^yPn{~We)B?BDxm_BzB z9QK$V=PfwwKi3~1{6i;m{~ou6_2g(^-Dt!lxK%n8dIDLwhj z+_jaFA3_sF@WvnjtQP&q)q)1B7WT;1g61LYn11M<4AZ-mqJus!a7k~Ns`8V&q_A9B zFhelIuqZXNJO9mI?+Q&IjUz0zbSmFvtAv0EvmjQb4CCZ4z^+EiqL=bU{+qPGS9I(7 zY%HgM-EyShc|1JFYFif5=xF{*W=UK!AekM<)}*GPrqN(i(hL}z@J+K66E6L^AYOgv zXL7%wuhPNCEn(gWg0df=E%mRc6tMAJ(C2M=Eizxw<4z!XCO~f0k>tUzHdG3TXZzbj z-wOfuP`(dSI>3Qwtd&bqK5c%GlmNzNEf{Ype({@e8q%sVlVp!m&xvaz3p1S;Z!Q~9*i{_Ocs+3|{V`FrH*44{#( zNxaXmvHNoahJ8~Dv}&f` zUNg8eT`S*CD~0Mph54s|jM(!P-_ufOUz~P~odT4e(+4RI?x-iGz){|5>Go3Q0A=I% ziVmER>La$o>arf5kcT-!RqJ=AK_Cs9juvj^0^6 z^^OlYdt(309(-w4!xah1aFF2@2{JTfhSiW6CgVB)8J2DeuSLC6DvhT5vJHWoDG0<) z(HmXP5$;s3*?2W}3MRu{e#1r|20-Hk<{eIf{o^5Ki>%xh;N<$Efs<e;)27kXsHbt{b9YA_y1LUOMMXf_kboM4R%UeYQ2&11VG^0C@$r59i2sq zXC%*cq8k4tFkT9FxTfQ3{j?)mdQIo0!K0cek8qD7QT_(@y{hqcXN?83^6>D0dw=@l zyhPFD=zzKujBs)^KH2x*>_RrXCy|gAEondjrmUyCv50dJ>D;nVGew#bEnSz($@c$9XcOViSAQDfqF$fR|>mQNuBSnG_ zil-Kc1RXt8^gpT1^mEDd6Hb|8NzG)>4;Fv#YyINv1>1Eow z+rRw9S!VsUp=*@MCd^lG0rt)2B&}=P`R~vUgaGvUepvK>r zH-SN*8!D%&u0ounVK&iRe@kT53?Z+KRPd_VHVUrG-`b7djN*~zf*s`Ezbnn9xcaYl zDe?{cqc=B>F7}g$k{9lH)Fi8}K%B#2HsM@diVUXC8Y^Z8J5xWRCGT=lNH`x&q>+6v z0pcKU`Rt`QotI|tT!(HdkGyCPh(ib|4lVbc(fH~A#n_vNL*0M>Dm>B{r(KJY=*>=!uJ+lx>1BFesUHz}dcC^!a zL!^!70MJ(uxc{vf9ZH>~U!iOc|J!&lMFf6J!6qNQD0cKB{cs;ruvMR41kXPNDQ@`sth~nZk!lTXRXVwt6fWC#FL+gG_tBMTEbCw(3K?v7|qtv>uyWkG;kniY`_5 zC%9PRLINyz+TT0dZftO`NJQ?Ah%4k~&Y6-TYW|G*Z$s=k-SK}8x2%KhO_=9-m$CQ! z@p8IS*?OSLI|tQ>H!NuUmM2GgKbsB|K6D^D{xKGo5_shdhRM=)B^Lh?W*Scywq?Cs z8G$!p^qBYF$J?La=C3eeEaB{J`F{9f&ug{2lnf3I?OcF%i>p86`@89e{_ zO6OMkS8h4Q$hdKYKb7U6n$pMC>J1;)$^I}gr}sX`-_sp;WFU+*6obyYY~bxM(rX3d zeRT>_OdTk8f$^25@mHa*+*0hCO!mKGiOE%6*j3%FjPcpFQQ%_FhtIZU&M!KXG+?-l zlET8r0!1qguKFsjpL>_SUR@!H2QrCVZ2t#y9Z%s=`ldu~-32gBH4d~3E)dF}Ve_A1 zxA6Z3FC7sPd*ay|i@e)+3hRL=C5`Z%ZMj(Lu*j^Vb~Wd{uZb+>Cm=YmQ*`&$++$&j zSecWCQWmzLGp0oz7|r_2F~ z+O_G@Ymh*cY>tA!e*|XH1#abr?Cu?w5k3l!R1S{Ccgf7v)zuBw)PX3+t#ajI8J2OD zjepi+T7cEqT1W*d1Fg__Eu@WYyc`RF6;HdR?j|Y3ne!=gB9ALxR;5!O7YqH!2I;9L z-xQ}lR}lv$;=0Ppb9LKQ=k)&Yz#i@Y^SR>Ox>ISk^w9A?g}TIMLFM;@IjSRr4q*r# zQhROWYhO&ZwT40Djw`YvPo@#NL>m= zYVW`rl%30J1Yg_bOU33eZH&u)@N{)`C2r$Y<}yeh`pEA$QT$@Kv{Z40khOpC4d_aUq5o`YY`_NpBV_v< zXl%eH_2;j~i$LSwYk|5Nn$c6F(f+(D>6~9VPgqA6vk?Qi!JwWA&dCN1>g7Os4or23p zMPSlC@EI?avn>RF(UUjh$$^B@QfbZVUk60RuEYN%qAH4>IJC*X16B23v&zB$iP{EpD}ZZHSR<^yG&j^42RrK2ZWWc})FFxOM}%1&A3R0BtCwhgns+h6qt za+e)!uv~mxr<2XRSyx;@k#)Fv+2PgzYNiZ~XO|rW1|VR27(~O;9SWPdQ{}kk{bza9 z+_Ph@FCXpAdK9FghG9z1FT>5AezCNvA^9unywy*DnQ4+gp1g|TrGx_`I4?AzQfbKY z!RQ`X6UuTL35>viK;Il{zSSD?Bs3QSUC#hrf9MQsn3|6&^qATwSvUeu9$f`s7LLhhxU_{ZvzJHTeKn zdYPRMrp>z$;=2!HUkqn~E+y*cU2}sF>8QC2q9SeVlrW&C-vSAhNB-OtH@pWXqr+a07~0^0w=WFRcw4OCPX_FIpI+ zl=yi!$X$b7gOxuhm75`aGxJK&-n(>27Yu?oF`MM1vQWvLaqN^!Kv(aD0aU7$L3vJ0 z4{QKsX<-0#^@em6D_(Y}Sw3({m*r^&q^e4{%%+|Z$53yebs_i5AC3xIMDa9f%Twas7Y0mYr^6H z>M3tK`&1bYjA;&nF-ii``;ub9gBCR7p)nKu|s0$0q8e#KNE zKeI0W=8*R`I!N~{kLF}n3}5`{4XJQ1kQ9Wy4-prZdMvFQgFL#v-lMnbG~U^=#VjmA zwZ%OU4kzM8qT!h3%HnA-`i+JgFN1J6VGP1y!rRwNPeVp9qQVdJh_wofTgg! zkM$3quW6PVn^ux~#$YFXWGHXpAvtM*QAhr-T^Wde%dR|Uc~mC*qxsST-1Y^yZMj+q z&N%Ggue@J+ulRWVyOBo-EbUG7=K5oxsYdt^!PpVkQwcO3B1mH(O&QJgmCBwfM9-5nD`>VQbEbN zELEak6M~8WGh(Td6QbiBfieO*bufywScD32_cKbiDMC4?Nh-OyySjr8kFpOkDId#u zJ?GWLS28*Oi^JV?CsHPwha~3YupRcl@?bC^&oE&y3J%eGJjQOyB>)OdHV|qu|3a;K zPeNlEcR^j*n$Y1ejpn!sjox0lBbCVd<1J?Zb_wL7Z2^LQg0UH{Cl!2sKSA2`Uw~k_ zvgayttv4G+#ve#U!j#uFmDb(8iA=C2xqiZ~xgLU6MzBf8O16ZMSfYzj!oDCcE_%ya z)BFA!=pA^IZI@<_m774+MsGlEEQP3z(2tcTmTt7%h&z81vZ=L(4-$5FP4mv0yGmud z9Atul{SzH}kglmn)Lsp~{VJjdTJqPY`>#QE1(|lK640E&icl@Uu5_9cBhwB>(IC5e z`o%$Z{T1`bmCJ<1#Kgzj+j^<;Xb~ze`q*>Oyxp;D-S$egi}avJ{T_XFyFma8F0`FP zYLV6`KsRk~q*mz~fCY?xOcCmo%hFn)Kkqutv6fJEEL8qA0c=1YXL!}fKoq=IS|A5& zQ8W;>dg|$7@rqeksxhb-X{nw6E0i$|pbPDWT~ltzv|Q35H>l|$REqzsC4Q=S`g2M~ z#w5%4&SiE9%#YOkxtVT}xfw-W#BRs66D^*5^o{Jm(+soU+pG<=;F}cN^-66E11+gd zpzwDHc|`>d0EO3~wfBt)4ZjAgI(hDz8*1*FO%Li=xssO5+3 zXHDe%ye&5?UjS5Kn-EbfAzqYyxyNVvd8-XbI<73ft-#F=hHnxMui!>z3|81T3G&O( zMLP%rLOjg&Pvy&5gFOM4*?-@R25krTY|B5XpOE585w05JA}V>O8+Kz@BKt&C%!T7d zHrue!YEa%s<^mnw%PN&gR3L zv4@AX0=+HSeaogR4B6E)Y7;u_Jn%o*IVe{^_6l4;pwnrF^@DLV7y^A{8bU>ZQ1;qg z%!es>8&_ho@JW(tH|P)hx48KQ&jAvZBuG@T(2o_(yO-Pe zO0P|yU)!o(w5GX`#J4H|T+k3-8SuKLmmyxa*)-sFuegJZifWdn;Iq*avZbC0vK0Po zh`G7N>sH{>nvyI1@Sy=zRQrt0e-&-Ga&@qDm?(!IBEpwT76LJ+rd!6hXs?pZ8Wcc# zoyY}JG$>oNS4ohU<2VSsS`h8^&4*T$Co7#$omi^ybMH;@_?zNe?B&m7h`l^j3bB_< zf%%c&ne7s|P16Oh6v3G7OgK$}`5EkGLrSj5l`Z!2?d|$mO!aev$`P*NV=RiHdg5R3 zBj|Uvr7KoiS{bz_9e|pL1~3f=5;Ut$!?W7^W zgO^z*h}qS;0+wKmsss~@7UR)R*4#nr zv`Z{G9{V9nD#Dz7!dMvebhbxEj?D~Bs6G~31|8ir9y1!mC)V2H6Yr$pozN3?c+Z5L z6n-aQ0tTO$z@{}-kIx8g?p!U??NA=(%9z}dP~w{KAw?=;5BrjZFvKXXqw&O#G0{oI z??s3_f>4{&49_kcC#JxxC2opO=8pqFS`V7-W*pi-$-h5%raKIxxZHWP+b{|W2BS+X;2ckjS~^%O9?E#ogjuD z3YQ?7h2r1L0G%X=av@L*Jp^GiK3fjom$QcR`#v<8pG?q;7jT=sXD$y+R5V&!8qvr8 zNQ*Q8cI2RtSIxJ45Mh)~k9hZ4>WO?5gaoh=OMN2W--tJ3=pP{gMZA<08)Nj5`C)R# z6R(8#V!~~ua*D(n2L)#9PQ6|}K6BxOQSseq1K|)usqacO?j|$L+?5MWT>8q(jT2QSs{_NC9%7q_15BF?13A z*htcsD*|dCFvx)^Ba4gZ(aH-4^muPjN|Q$`-6W$4>>Vbj!gn2)DB}L_r4n8j32@~X z)DDFbPlH!K09jxRkOdM`09jznEs#cz8!8>XDL$#5du4wQ?YpIXDEP>8;3Mz1McIRO z8;PP<3U~Ng(oyJ3;0V?_t4ugB5{N^g)73^22!7h%L_y$_I4;pd{c;#cD8Cr+&iqqj z+fDub@f}7W1h1O8Aw<8OZoXEVz;e#yJPQYP~< zV$G0udtnlsK2RWotVK@EN#;|6eGEP+lcPx)xODLA?fGGl_^}7>m{_-yp9r1}f8V&P zmIY+~(ql9^v*W6YX|2q(9^eW};daxpX~rB1+!6<`7;_j40k7(SDy!--(^8WNyJ_bG zf0Q*cZU%T|nxmxy5O>XGZ@8D{kCwabi7sFlw3L(9A<8a~2!^f1zV4MVA4+hU(60Zi z?U-ne)&-`F=&Um0z`ziPw16pL2oQ%sve?>|Ah1jHR2dBu95r^4anu{P+|368HYSb6mzLi}7R*-JtkS z&0ygiS{X{bu8F&r(W?OVBq*=EEq9Du+~ofqIl6uLMwy}!NIX?xhfh~vvz(a zK5Vk&MD)Y1rHb#ek#)Q>iI*myL%kacyN3J|bM3a3VU+-V7#jzyApM;gSRt0rb{nul zEMMZbzaGqGn6k)B)}7z3AI5U_RoONyXx(?hc%LVUHK<8qHX{h^PzfL;lGeP($v_<% z0iFtUTke5c0ZILe2LId1zU>fmeJT&PJ-oP+4CAf6$^N|1d|hY7ouxzBP1;Rb@rW!( zUUWR_xcVvg?fqt&@XGfe235@h2g1@@)i8aU=X0^$HwF|G8Ux zACUeXNY8<|VeX%Wfb?eyj}AO^HIeM5rgC+KC69%HLO>W40*i`=hf?{)RVKc^Bj-*B z7dNTDE4m;GHHx67miGdwZ--;_b=wu40Ce>AL>d?bCntkAfN!frzE~uIl>smB^)CV~ zw{KcM*CX{=4$Sd(&+&fAhC2@w(tF~K1{&2M*@C-7XAq|CrB-bzE1oa z98v?g315R{-J$w|!M$76$uEdr9M1;jmiemA_>aeI*1JS@iC9gv8_D60jqIusCse0j zkn}Q7zHNnUD}qH6;txKj_l#fCd&c{b=9up~h-YB1{#{2P4fICD#2}>04h-{hKXOlX zy3y$ITNgvlb{Cp2>WqujgXer0t*va7@_GR0LnOEu&I7sAOU)PLrZ=6F%^FziPXP>R z-AoHMb;R9vh`uh4!O4`agF23}gF))cas+jj=cHY$aP~te3ARt^>0&vQeeMi$z)=$KyuRLG6NRiI2`2 zUv^x!&Hp0!GO9hwJ`cqQ-`1jl+wI64c^+wWijH$4AqF1j z3{e6wY(H-I<3@Fl{@9+9+yH%5w{X{RBJ1`+00}N8rp(Hn4R0M|0<8BTHc9#WY|xrx zVew9=jSYdY1pva@ArQ8prlUNKap74Hd<|PXD%f)Sz4w$QZ;0*yd+!Ooe2NTBwIQZU?|mXOjxX8D1|Al zQOGFQ`;StN$&gYcUP!4?x>5znwnWX4paGziW{7mzzmyU~j-gTq;SMO`MNyD^}0N0qgL<=pFOT>H~B@7=;>{ypAqgcod`EkAn;-j z?lVy^7KK3L)*L0b)FHxS-^qiZLA}$1Sn(;zJ4U3v0nH`iWS`8}B+l}h;!!BEt4JXE z`bQy`OF?47Ozf0G@Xf9ZP2eEFH;aIS0N<7>-E~o`Og@GzA_Rx99T>`3zB7H=d7^;Mg*aAYP!xy z1hJzDN|x5Z;l>3BJlNwRP4kBj?>t4U_~GF_TF^#DbBXbhxROfS_^{mb$i{0>A*faA z`Z||pvrq#_RbZl~08j&YOs-TA&V??0=f_E7t}_)~Z-y02g1 zwf}+Tb240N*rpi^n$zpNFscp*3~&v^wzvkR5ZAyPa1HPf*T5U%8jN|Cj!WLXmKxw; zbIHeph`cI<`62UKP6lEsYN@zMd21BxcI1pqvc?cXy5y)AcBr%!7n1K#1;!g$1>+fO z)N&2{&>A(g`rcrANJUYVb;|R(KRMHkowSjfoIKNC8u!Bk!M4lE+yEPJvZ>Mn^RWWACyS;RV+T7nHfW?7*{#sH4(n0p(fa_!__w zjF(LA`qX}iG%0v*h~gufJFBO}%u_f8M)uWseI?hlzOCuME7P&4_J4L0y*YTMgaOsA zy%lu~YGcTpki|J=YTp6jPSQAFJgE=B%Nryh=)y@T)Mu zQczJZu~r*muoRr*tB~V{K3gMzYZC%TqrW{)1vy#Kdx#JoKBRE|(;ZGej-lw$;0;fQ zc2xflDW4THJktRe<623vJ1OioKNxfX&9Nr1h|fqsv-r~HZ%c7}x$hJ#AE|@2=Uow| zxcHsXX(=Mn8d(_G?1UcVyrt}sZsc8F?V%ELvqIL|Q^vI=mh649g)|1~M83@t2S_J5 zpz>>%O*osqNJ1fPg2dG(v!b}278NC37Q0)~J9hEG*P9j8>g3ibHM0pPt-oB@;oa(2 zK)#cb+;75CvCi1>7YiH$=d#sd>6ixU(UwZZMAHJ?iJO`lixx;Wxc|%!>u)YP0p=eH2?qAiv~Xe5jXDNP#?Q>1&nzbWHY`v zkc&`lMW`>?1Av(jdv?f6o|Z zBrrl=VYFT+D-Q4019J#&ryszAKe`vtqLO^1&1MC?-HyK_&W9VqK%!0Ixc^6p_}k&o zCgC0ak5J-o2n#_q(OBDzfmy^R_0)K2OmIi0x$Or!En$sNHicUppTa@!5=`O+=xIoc zo*R?sX-FC!mu8qG7?%c*)z3!+9>gBZ@|j zUd&5xA~0a2s{n#AcVl!Mw^5Q{d>YIcZNzB= zUt%o8sM;aj6)UC=h=9B< z9B{M*F%SXf?Hq7U2@uQ~4B5dr?l*CsejZ~kufUNKWi$9N0|@jQXz)H6DiZ*KhK>95 z0XSlZ-YL}%Xxz++xzd~bwzW6~?B&#NEw*!G@No1v*pyG;#_+@cRjM%yPdVbF2;Do~ zyJT4N>iB^b`E#>M1vGYJ*dymWg9JZJ#fW;ECs$zb3WqcIpVEFifTfj z5rPY}5U%rp7D6DjZ;%992=pJ7RGFe1jY!)^+<_h8`@2PPk|y4}iDe;SYlcQ>y)+@hgo zC}29g?jS&eu=#EP6__{(zjLRCa2XfsCYQg?U5fKH0JE`Dzigp2b^z<|A3-O+rNh?$c1%oJI=Y-N0II`2Z`trgms)$hOFseDg6syk(0t51fr$D6vd#n1G&$OlSk`b1N{+ zE$U@GUj`nyz{Ia_O-WZ3?S=^8fp^B$Q&z8I48I$OHGm%gCTH5Q5!7>c$cY~+fE;IhdO52FiWO=%qZ zNO1q?6?ZuKmN;NdrC-wnGx=HMP{%Cth85hd+sF}jY&CTi%l+|G!3AhfYNgUoJMr;x zaA3~yBU@v~6-B!tLI?>cx}x~s^?MJn?? z;Fz__;zb94bPSyS_61{nmy1iw+bSz#;7)6mk}hi?g+d5=qj~jeM1!i`)ce9+zY@<| z0Xx&8x<3SJ993e&k>SrEc=2V5^lm(?}zyS)85cX=N{OBCj7 zl|EAh&nX25O9{A-<(gumbIX|>Wipl>1_w~D2T;k$2r@Z)dFktOPF1~|bcWX)q2?6vs6l$#UKTpJ zMFWsqjLUI7mIgzB+#*dUw=l-}>y^jXZ?xnYSsOenDZ|14BefzMff>kO4yHX1yh^{P zBLgu`L+Nd{`QWhx8}tv5^}9Q-8VJLGV{Cs_9=u{8EcF`{>fKP**SPQ*_3U$BwDy6; zD+XH1zbQ(;-TjCOFu-XVa@Cdi?HeQN^&+{V6W4BgYEO^7>V)*W*mYG90bnk_E75C& zphdtB_+81l25x>jG|zWU$hi#9zwCM5oBYD2^WOCvlUbL2oqkuI_}%SppJL;beVOJG zsv+ce`uT8onc^A&Ju6SvQ!$n&vVbDT{WBY$TR0Z3u+34N6`#f*3mm{5DoAb|Vj`Yl zntmcK7Qu=y+8OJ+Ggjjur7bz16(3DVfMKb2VeZ~mzavQG2GX$`uZxL)K+~#WYzoJn zcNwnm2O~a-OUt|rq%pRU)(CLbKgH+1JT?1rp(CAlQG16bNfJk+Z{;5{d5)r9&cb#%) z-CerUL>5pwUOu&Hbh#%Z(7m2t5OuLR3QP_3fzDuRutp(HI_P#2M)$5!5+{Mq|15wY zwXBgpKDKtrtWoMF9cm{TTLNoek3G%&F&rbcJ?4pa`OiDw@3D|}IibMb^L(XU3n45L zFc{`5xmv)<|MO7GCEqufJkOur*A!j4N_of_x&hbesgy3Z!h` zRlelW9geu5yLYlbRLtqE&+)h2v1ktdk%7=v#0L|y*HeoXFd$9ks!}eBu2e1}J^(IM zJr;@;8w&L$%u>Wdutnrh;6jY2Z%z?BPkF88v#oi@xYP(rci*1Xth+Z@eGja*^JUeQ z&*tt=NqF@~pj_RJ;Jl+)sg}xI53P+`G}k!X?y;TA#YQI7I0*JYYvWsMK7_B7sXT0y zw>yhUq27S4iM1}w8j#;fWAQ##BPSMMFIJ2t1cbPsj>nRc-UJ!3PMARiZqDba2#|hE zAp$oiNI%jb{lr2)9*MA{p86C>Ie#Ma>0<-cVXlP9{tz*zL7(G;-MscGMk50u`4Niz zdWK?yA*;{~8_YT!K&Xu9JcodhW;AUFeGYmfV5Ku4R7OCdQu0EPt%J*8xAIk}5j*JP zeT3k4WNUH2dhol z6$wRtDB)T3Z(qvB@>@#U5z5W5`DP4qzMWTh!M-Dkh^tRcjW%;Z%;8t1Y7&bF59ttw z_fj$v>`ZsW9}5=4y!I(B8uUX4iy6NL?#37vQNZg0MN4gA&Y35-mlS+WG>6`E zQT|e=^u=AWvO`8WRmb|&vZ$V6kw9<>ysn96BiuO43oWjJ0n95Ov^wF!8QWT;S3aET zz}*-NK7zqwJA=PHj?OZF<>RAH@K9$gTf924ym{Ecs`vA}HhK>*{EoJlhhXptP21-_ z2fGfzq$YsjcR(rHG*AN={`s1#GEdOP1hAHxg`_Z{+_5;{v6%i;kfN~H+Od89TspJO z#zwD!wE*ay(j?{&9#RJH3QTDx<^yXnK(CJu?3~UI@NDz#sk*xS!J7OWw^BZ(y7DPZ zm0&h}kgI!)aOtd5Zyrn46=ohN-eqvR^!T6^2^Z|am-YB?DnfyT8)Q0sd`^&9e$bZy z7mLNRPN3F;g`^^(yu3KSy!e$&Xn2{jBGq@pu;L?28%vqGoL4G6fncG-+@U(DNz5EP zBn1w0QZq60Zvx>0hbg6?trEb_cGLWYkBWaiLg^{8c!Ci37Pzo#yD z&c??}v zO>*^uTnApN^0l?D(owF`xnWLQu(0;E?T59g!~+s*mS*`Ep;HElE3}vVT)qSlRkFgh z2xddYZz{q5z7|1_0`2cJW)rW$W9&L>cxcJ&_LsW4qCq6MKfn4EejVI=c0~W+;pBbp zhlnMD%EMqiVi>GP_<39PD<;k@3&nPLII~L7J+8m)9735iQwKaw+Z&-w_qcxO;6nn7 zz^?sZ1ZYF16tlw~sat&S0CoJ(2^%?y2YHV0S!=S)t5WoI;gYH}1)H7_xLm89)f^w4n zseE6sm&M`qQKz~or?HF=Fd4s5DrOV(Z*4tgFj{FwV9o@OB!IfInyzd#cq9S)W(K?$ z5e*(mfI>Gz*-t(vJ~hrCJuDebHJsJucym!hgJP7NzlUfC6iC5J=h-$_S`?sOBNZ{5p(w?bWo>)&;V9D!M( ztoK3t&hijB*s^$FF#lL&kT_tpPi95()lq_7D-~EwBwW2MX_bx&@uz!0*P@G@`)2S; z053dDbf*zJB>-eq_XS_nRT7YRX$0nrvL-?j-5~;-Xz|Ek&B%dE;t5Zz9Oq`>jyKKc zbjZGaaYH3r6=)uuk>&VWxise@C`m=j3$?L73iI z`n#14Hk_fYY_QM#zgyYt3hTR%FW+cMH#&Wvv>MVv%QRosA>ZnYGhjEn0;(Ik(Zkd+cU%YiFnBfqQkt<${x#TjnEFIq6coQK z${V{ST~@oh&|IRRvzeG>6aqhVGzjY6Jk-QFD43LYf$p{_x(@`_tTt;T2WC;{P&arq zU{QxZ8|pGJ9t~LA-D3^N%vq%~RYzA!?m0;Sj6oQJ?+F`gCe)B-B{|PZa9lv-{dCktwij@EQZO zIm7_%-QWp<#fZ1!BeRdxrmc^yl&GANSOkMzr|&v7pXnI$*PpK~M{2(!g6{n|t@+7= zdGGh}EBfBi4R?dXh%&Mt+h8di{wLEiO@8#atw{X*bZKbhxcHdUi5sk3c*8fk?kt3h zo&xm?YL>|6?9WU7=Ji#Z_3P*EWxNcvmppNF#dk4XfaK|CCYT}HLO2Wld7A!5rWS(W za)~=$Bg4<;Nuv3!(Ltkmov@8t*GC6mMxwU2CDQ_1FL5Wa z=Ib9wRkv4{Yeoi5=D4J1Ok|JQUwU#XK4pk4Le9?PVUn}eoX*GGp4sw|=Fy%e<KtYsfBP*VxDwVx&HDvA?cndZ=M_Y|{MZZO9b(#MXv&i~b zdtPVB;E}$yRl=-6b%f$w>dB;|eW#}n_MNVFu|A_YZk!#7I7*wjMH!UHj6@jGEZN}` z?awEz1Es9=PhF~{zHBj-9zFT9P=hmzk`){u7-s!Jw0^f}iGZYgREF^9a3Oq_AHBbu{dn6mP zUj;WQSBY5U(^NC{RNjh4n10MXS%1k{P}1#Gey8{6EZN27J6(h3Sp5V>#NeJI@RlA#u8bC0<#iHY1EkU9_NPat|kADlcDpDp?{uD1YviGEcblFWE_sM z5lyt9S?DDwedh)50$8l`cjw8LNCXg_t;UCYb}jlicuD{TrL$!hmhZFq44!pW|XEHq+py^CR+&;^Ok~zt%G+TKDFB1_&UEa#9FfdY!_vc=PTy* zyEJ)c3uaUww_Y^(e_5DOs+@Y=h91uE3ZuAGOydaWRTrWf*^__DKYNjDbfxTi`++X* zzHLbgSIV|$Ia`nW9KG*dwEhUAQn8>}#h&al*y^fG*RTv|*gj~UL@>Yu4cq@}hyfaM zGc-){$`meP;@;9Qzdd-Mif7Sk&sfjzC#S&&Q+Z?=`f;QB;Cj*E|777tsqXuieo2HB zu!_lI67^{5Y|ma(d-HKo_av{_c0tpD6bqn}-zMwxXF?^XO8y_zirlC7BEXem7tVfS zTok{+s?N}RUi49of1&1{nB$^O&T{MoGsj@)*Y zGL7>pa^&M#durImEK20$Ihmsxo5asnQrgnGG&Le}tC;q`mb_OEEXmvrE_RN^m!Tz* z;2f$d5jf%z(`=!VILGj0;sP&+P>B&5y4R*P;9g6oLbrta4t5Q}-M4qY9*a;(YZ9^{ zP%equ{2}T&&wR>I+_=2}>SFM);Qk-C0VdFfanQP)^s5H6%;7lvWY;nRtd@z1WI+1HxNn* zkFjA=+qTPzr6W(XMCF5D%#j#_JAAwa0uhlHPikD~+Hezecl8JN+&H;xk@rr|0n!?Kvjp|+?a~Ks?+v-VrfH*>x9X25G0o-ko>z{o z>~UZp&xSkod4PXxk3*~6Shl2dkbOP%K;xu+BufAB%?mmOA2MzRa-C}gUQrW)R-y76GU7^zFYz%us|Ftg@1u@T3!n{TOQ*?nH| z9Vg6iAJ47&%)3Vybb2$V$Zqi7`Fg-~*z3^V4c_>#z`E=yz`C&}xzWk1HGKq9{kpbR z=VLxd#T+;ZsOX3TDk_ZSxI_inPf-u7P2L&l^IGCM_Y|mxlU?z09l}YG3_6%ry!a`Q zYB)$W)UEXchJcn7e71x{G$^pdTn3uyZIfJY?I`x$7XFTXyG{4D?Yw%Kp=YbsnYRCU zz`1=`lUefH?N4uO)5hIaRQVSSIpA#_UnU=QbZlG}`ZHnOVe;oo^3UmZ5H)|6rE!Mb zFx@fzLTG{OXPF4D7{j@4gVd=KS{{ySZ&a`B?^J+)=TcyA$%r}KH`1oiyepRv^Cbt$ zIH_q-11`L2U!KQ=6K}DdlDFeoSD#86XF8m&k`X!jc3H7BF2?V|$|=E9e;&)*G_rHB zuVaUXKUBQBy}s1Ir4|@qsh!TAfJ3lVUrQ zsOm-fEj8yQxvLZ7cL`wzQmpRDvSR~+SJSAQL`0sm6%XR$2ik1NJ%MM@Be^;U
    f zbjnJP*WrKk&(EIFy^{Dge&8SXSI@E-IcN0UKS!nkZO%h-S0={q6lx%Ih}F~TG*0UqLn?4mz1Zl@wYwl+%I)AH zFm0LFNEXbM`55`KTOhTpgFddIGj{f4LSB}qN`vj&uv zuaseStlBqisvab8I|tOMQUnc4BfP0iLUd@SGCBbJY-@JC3%aRgPHepS~9@1t%dZc-v({ z>q@NNM3M^LM#h^XzIR!MmYh<3QL8+82i|86QGB%?1lehw-49@=kDhSVcZ}UcC7-um z9{&4Z*r`=QYI!a=cNIGL$x8PuLVTAX{eH?WVwPxmgFiZGt$~Vp)R3EVRvMl+x3Qe7 z0TDz^Hl1)rs|4<=H^h`q5YU8Dz8aMBcinpKQ2#dki4#vp8uBH;oNAU5>4bc(5-~B9 zn&lq(#{B2C5j+!T#8CAE;cv1ZTpr0ikwXW@|34aXi}gJ?xhqt&#OY1AueTm#$#E;O zzDKb0F8-H;L!BFPpD*1t-f!JRa<}|bceX~Jj@}2t;YTMbfj$!CaJbRLU-a&)=Xfcd z`cg}+^DdN<09u-;^hhTpKc}Omd*$CXtGu{vLRH_=^L)k7er*TA{UVMB9^L|&p2RAlK|qBqa#iXlzQL*amKgSMlKmQr~Ls1Mmj(_ zz9+^ir50GzmrJwGap_Tq=5iZ<&*fHe>D~NkjP&oh(*f|cX*O#~ns7L2-vWk%wZw}5 zUpRyr#TG|>_xdV=8Kumlr^U*^A#vbjkK&YW(w-uN)Z@Hv5*(3pg>+dBng1(`fz_E& zLoQ=$K``F$PoTgK;Bc$MOJ)=-jsb_qbnd#O6q5Eo+fy)GY^rhhio36g?EjO3fVq9j ze5}$Vj*#36?jf7Vavp0*b1Wu3HXWyF0DwOtu`qQDN7B zzukV|HT*@=uhaOzI9^O=(%o*6vH0uY%_o;}x~6te1;lSDkwnNBE)nAfUcE=U5j?%L zlCJ7FBYt{#XOLEsSBiq#fACz9V>petKmmBp>A&zCB$4aSGw7TbC^hX4CgWS@Y#;u_ zKfLPWeT0&;&8NzveN~hJY|M!2i3D)HU8QDpwW{VRcAqM@PwUp>=Ya#dL7}Ibe+Apr z@??qay@*r5>FEn2BB9IJ!*4E%P3yMFM2Am0t@rv&6%>)4lGhuYsj}HVazeNw&Sy}x z0EfMdEgHH=BhFJema$Ici+@4qx-Bf4`flzjV%=6|Ru{I6-2$D_gr*z6SY*#bImdq8 zHk#+eQ)&!_RpdCNW8nXx<5qZN=r|>|>+@qQfEZHQ|B<^l8)+J(98IlT|J{Yz+>n9J zNO~s3I!S8_!as4SUAL83!LG+Xao}0E{R`ngRlc9q?QcBja-Xll+eWQjR!l!SZjwU|SUJHanA%bgXc9TOb z%~oOvd~=fn4-I^?=uS|!F!R`btStR@XY>ibL_UPmvJf;|nJQfv1v{37)C*D%^*Vdw zCkQ!N7VA-m@}Ob`G&Md}o(Lser`bjueyn5*{oB+aexu9{VZBf9Ze?>Y|LEf$N{DNs z`^&353RW4{9PUiai8oGBpqD3`Y~1pex*)Fz+2n?Syn=`F%07@+@K9bstJ#hC?49!? zH}T_|t6B6T+-MfM=}L2&;LSF(_3EzrGVEPQ;Jq9HOF`={P@b(ErI%-QgVh7Jg5}sR zv2}x-1OGZ(NZjtnp?2WOBX=J{Tpc5!%xP-pwVaJKAYJDv7zm@iZ(g^0`C(GRf!=6R zkp+)a)nny-bzd|26L!>L{}z!C2kYL3A=hL)`n+9tHO9F;_i?54hxOJx3{HN?C~)We zZk4`zn0eJlcZfE$V`y?{2VH2^{~3?XF(rr8sT-~ zt&YiCMv4nP82#n5J*oFgpL2By5Furp9U^vgz~@%k;O@*2F{1$>LI&!c@k?1Dj$E>& zUeymCckfFQ?+&&z@7H;m)+?H3t7fr>y|M6C?aBd>V-6v!YUdy115w{C?189$pIf&E zccX!*ejsY83y2Drg#%G$RELPk53s9^*YUymY}f;=*w`eMYPHjr=)|^A}{vVGqb+&puM6Spc&Q=$H&_nJqiyVbtj73#GPP+(00n^z4m>l(9f?@14Tn z>t}k`Vhe+Jb{7A=ZH2)Bs$ZfSsmi7=lEk|%sK4zGQmM%gjsqjVffOT^iYdR(eq9HF z6X;wzq(V<)df9cw2dbuuZ|4Ui@l(ZY%22T{1B(6eEaFu0`*S+qo1euTC(2AYyDL(e z6%|}dw<|eY^+cSE=4&2!+gkf{?yW%Z=m(m={o6@@d%8=(W%a4AXgX9PwRroqj+ap% zIF8%U$)cseud9*01sfGtHXe4pzUoo@#Z1D8D$Ros;Y84r*_rs>A#IHct502B4>PN{ z5H~5agB7n3aC-ZetWz7`tHX_;vc&hE;1Btm%i?<*TkwLfuWnYO&HEa=B74~)ZCj1^ z9B;@kseR2+U-R^v$YAj5&uyZN@LLk>xl$ZV3GU@sF0RE>|CMQrgD>fWn-?MVL<_2& zBr9d8&h9!?W*vp_vh5kpHoc7lr%^)&{l6QW6{fQCW{kDePoW|F94_0f<8`!G$6SXR zW!S6369ff2a}dm@ttOa16^4@bftiy@u2cA+XYq~JIb!(nO8 z`h19?%aY5!q+a=zb>OiN=^kqz+Ixo-e4PYt4JmjhJw`DC9Vs}O6g;;2%-(#cv5VBp zMgqnYIez?J8Lc?Lw>;854}+SyzX9@&;LZ`sx&M#6H;;$9efx*)WQeRqb|QrqOEK9c zgi#0ym9kW_UY01kR7#|U7-PwhqO>3+si-hzv?@zwnM!t{c#iWkgRbxO{XX}7|L))O z*Yom^rq3Lob2-jqd%urUwd*#R@Dxtuy!_X#tx66KImHlGC7`g%4Z^Be6js&N3GBqQJ<%P4$WowVeY9TZx`%yOFJgo9LV zs1?ikgH)r*;J~k-dNO5;P>?Er(CH6VWI39%yG<{P4P6z@s9ru6J!3Ueb_sD7{n|~3 zhC{1YbU?gv7>ifTbVTjnRTz8q`s=@|z&y~L*?U)U>%w0(?Pa0{N5^G(M!&)A-+S#l zR1imZ7}xW^t6%-frJ|17a=6{nvKmFv)mX)wnu)tQ;G9z# zurYhUnGN~yQ#d$+58}uJ&hM`3xPI-&DY`s42Bkbx+Hsw0s|RlJ2h;6LJviQ)^7QgD zvufQ#jm7ss96qH!6SoS)l?QB;26281Ct7L1S$bf3MW~HwyVpLyg1B5j z`|g7L^q(uIzaCxbSFr1n+CjMycE({T57_-E(?Td%m9swcr1ZeTVS!JN`1Phry$atv zZ5TEsYlSNEWSwip1GfmlSVjIeHM7Zee|36g*^_6**j$ZM{yA3$2t%Lii<&olxcPNs z#znYwnRhq$YhKg5U#JU~r~R#IstJVkp3!kIYzMzyfk&ConEiTXkLy5D&H-gctBw77 zU%IqUMt{f2-Bo+O0b<;4t5qj;RO&OaSahwQ#{t<2#+p6F*39_dtl1nkgsoY5#O|+i zE6*ZQSsPuQQr_BL)x2x5%WKHfK|@x19(#sh3}zgv#Lq;tXVhnUiLv7}Pw2E3`#Utu zvU7_x=$kmaNe^dU{YGiv*7rx5YHw;Tei?s+-#T6Q$|m?}$H`rH!qr5KS!4_K$K@M!R95}CW%JRCuR-UUG|CnjDAAWpk>TbW zpnRV*Z+3>imEFLp$|R}`P}b+n)!~9U?=;JUb$7R zlF7kN1|LD288FsUokK@LQ6g-t(ne3?s@N^b5I^+<|k;yx!JriDa)eWOpcsnE1oN zah0TLn;?hsbCuiQ?`*&-NTLqMu#^1H`7#XRm&`lWRU_=;OLJxoc|YGTg=E3%Rj@W> zNAeLDQFf&1+6vC(WWUasx#IPVzWVvh=zLr7JMxcPkQv$kJu`am(vetlX8D6S$b=Pf zc!|Gd!tXn5e}6?;jFoer|NWRC$YLP8s%^c=VlB>|H6B^p%FXfzYT4-}Gl;^glFx1D zS4|#;QbK3HdsIP8E!|wN7<7)%yW7ZppWx-Div=3J#V0FrMz_S`8_`wqs{M0yajY;#Mufw^=6qTEw%d>GX9Wl$UA_CR$=gv8#*#;jN=O8>dFiN9%3;%Gs?CZ za^O_qti{}nicH=1uWf?tW7nKTw}+&+39h>GQg9Vfa~~#D*6g1`Wzk5_g3v=HgR!W} zRjw^yt!ROlkcXOrYI!Fh5a3$I*y4+3*d8OtB05ToPw?@75`!Ty<((<@fWY`ZFi8Xi z<}^ZJx&VPWju4nyc2R|_#R4rfC@pktx&5W90j+6wzk6aqOg&>wheoeT+?hIX4Q-O_ zr5!I@D;iBdFt%Mj>vUR3rP5F!po>-*y2wCb1gtp|F%)KDqzHvcEO6RbY^RYBG(Pbg zP?(^yt6^_flq6%P&{xI`FR^MU(5Ab8@fLihG%A`gv~qroySQ(E*>!?G#(jwe3G^{u zR~WjyL(Quh;NLw0Et;5{mV}zr60?*LZTs&2oO(c%L$nRL7aWT@T0Jmm0D4xh9vV#! zVG)_Ctpm{W`+b99$oymDG#@8hPb*-6+iC#Z_6ldID&s!@;3kLxZmUs7A_9Qh?HwVy zlS!>J-*H3Vt!{t$-i$`q)xQrxgp43!@Zhf{ZD7_E&lW#z>*>e6+KuTXi}e$3{4Sx8 zN~lFCVznrSPDT|RP#dgo6*YAuovv+#LJwaQ!#{Tx`aGj~Md!~{pSD4vvqOugMom~nnV@oNDl@^BXssL%GWy$g+jEs@Zz`BjAtLMOP;N3TM`lmnhwP+ zgq|M&K{PLxUBoS_D+Uj?4xqF|1Y5mruzFqnFh>ajtX|i`>M7$TgtAatqJ*z59vmfv z(BXZdtPz!alE-w&i*XkOLhjtmJ@!XAM&jy^K%0*K#eF)Ne=o;eN97n|%^Lsdx>Kz+ z>0I|jF3s3~ZA7n-zw9ODHWbB*0k#JDdPl!QM8U}^ zt6=?(ezu4|^7S8q-^b|rx~pkN|GtQVgc`x}!LN$b6MDl^-v9%9f6|EKm_l5ElRXD{ z;^8~WV7Xh25$iolO@zh1>G5mq8wdz=!7UFL2)*JZwBe`HFeEMyP~zeXiOU0&xO8^r zHniRq4gF}e<=LmBf&H3~SKnRRv-{oBn$z{I&jhUb5*5qyEW{tWT6BBuDDiqn)3TSm zaKKkKba46iZ^ONw9?v=C-?VCI6jYxN6cST?FO;CF3n*ks!o~ORmj(fR ze?BB^3!@q<&|>e})`0Np?u{SpUnZ|0uFh3{{A&FJ!)+m9uxYtB?`N-#r-!yk%;De|JK=m?*_f#VCCCp@D45e*vlE zw8r5{Vwk3R%no z^upo!`m(rl>)z`lY<;Bht@X}zUlA03Mn18?Lm^Ao9H8*T0#W%t=rZ-KcQ1tGMEJ3Z zEQ}4E@!RrQN84%!$KH#IriS#q+`h{)Y|872`zHDc8X7IGZ#7K>e#6jcbp65!I)|42 z>Rq+V?KQq~w~^WSgDU|d_Xow)QjbM^Mn-M>D&Bjj{)*;nobpcs#=MCH0!HF%Q$(4V zn=75uQ6Es*-!{!(IfZSpZa+QaNW_2)irm7>5F|EH@tF*V4iCIf&0QϏBGFdp~Jt zd1cfRnkSG6hIlA&+ABK^%TwwCD&GpLzM+*5g2Ak3zZcd))eP-8M|V2>DOJen$QXzI z)9J+Vf5{}#!;EghrAM@LfQFkk5?M#;(=03 z7b85}#xiASIuDs6JoraZ-HJios#$;Qb#V9CS-DbzNe4*k07<1x4xYS#Rs^TNzg(^B zPp{Gir>D)Y2!SUoDJP@fFV38Ug5ho-Qr<$3t z8n*J3l@9#l%t{nX9)MV~CZKY%?Otll%X_JBJ0>jpbqegJ_jtF}xbb3VChrGNam{+; z2w)=o;EAqTI5X7X`0=Uc3r9lb!`Cy6d(MwrspKEOF0#lnpS`srWmP}a4+FA`-u3E3 zy?EPHbAOMsmHhRWBV{NaLXn%S*;I2aO~(jiu}(EhW04yp9*XergvgEc6PK#(i{N)= z)L_8QAvkyXRF^iI+0(Oi1|M~Gw!9~QG?UhIetC&={o}NQKi85-Ve0WN!Eq3#UGYT5%p2iAdUGiCUh}|>xLI|MD>PS(O-YynP{D;56Kj$?PB^bkFwH^UcX zxO_iac}M-^%GVor8gg50KK zHt@%6AUuwq4?Wedo{3I3mtt>1^>BO>EqCC`BMW(V#Bh^!6gcZE)-v5UF;*;LTz3H9 zufLD3y{pe|$sSsMFUkh6Q1_&Q=*RS$eg2TMy;w{B3{GCOHKbD5r9z~`S@8hMDx)pS zYrXLESo%=jTyX3LSULc}?{;jd641zk?S}AkP9|cbUC$c|zsI%%G2GOQ-FG&iMby=v z_Oj@~pQn0uFS!sBJGU*JOR#OBS9|MCB%|sBzKxqmBo?G7WN`~vV@1G}`t2V^&6)EL z=-j^qd_xhcd00`AnYG^cipeaGcyRFfgWpC+**$LLfp?Fsm%CgyqB|9_=>X@ML2hg9xhkN{@RlQSiY`(cnQ*l7 zx{)VRGob>fI^GJ^vbd4ft|o(B337OQ^CRB@)`y>>GnXtqb-(}HIAwY_&ON*6@vBkM zb>zGsP;PT4*mPXlpC)HCqef`Z=TMe?`06t**}x>Cz`Nu}c!fy(PgO)eB!7l?NNfzb z5u%BmAWMZE+d`VVu9PJhcJN)@-k2|+_25JJtMO31gN6#ljo|ieQ`ECgw1pIrhip03 zv&<<77q&&GM>$cPww2sqUYs?of*$_iIeE{F#7bAMoW4pe*bjmAZe}$ypgTI?Rg1L`M?kGsH zD8x4v`)D7j9_#fJT(>(D?6+*H{HSd)WxENfKwEm$HktzVdj+BZC7TI_6^$EOR}uW# z#82Zk{n#q~=6=~qwNt#7x(Z=Vfu6Iw?Si)5P~3S(M2fp<<`vOy;BEDO;$MVUeqgu5 zw?qTdu4^Y0Uc?#=NV_g%+~FuW)-`@m;H~yEe0J9I>!;s?FAwp)I8EZbxtIJYtR?to zXWXZ^=R|u1Z)s@XY)lg(j@&A~^-1r{)v`uM4PwiF!B>BQY)!Kw>qkYpcD4~ktVPxe zWF%V?<;WSvZLo1u;oS)x)*oMOxIP)~!7^j^>L7P1^Bc;PPeYnIaX{qe5gEuP%6(Th z^;U)H?)4c9=QvOa?ps;D2`CmsWpCX!<|d$6Ad;3cO7etrdVpdPUeg|Ie(PH!g*9{? z)vu{n$7is6=pgrTHshD+aKPqc*>ktadFh~|`Vke7`(K!oGzAa7*SAJS3QJpg;|KKm)X zC76;dv5fXbVp)jQt&y^&ifs|PBO70ond=dMujcq#1G6W|4;AcrL{vVZ*Ty_lAW)BH zPeRBYA?N4z+oH#G$2PtQ&{`KL@x37B5QsXoEHa^HFx$FlHe42uS6$W_6~kHNbI|VC zgBUArih5Esr-X2}m;FZk=UEnZKKE={{6WhaCdokCNZL3zMf6BxeZv6H`eYrW*GnRm z-)53rK4voO_CHrt6pqqOwQeqAiO?jL>TU%%$}A0q>CZF;9nzk$Y8&NdsqBECMjDUefvHLVMA69)Om zvc}_`dz^qebZOcv& zB!o#*k+Qb969fQBtPx0}XtSi~{VKy3?Qi(_g5*i>o({UXN=SCT?)&tbvLhw7d7x+H zM-5mmxrh1cq%fxlweP=67p*D14$IAKBoOCqFI1GPWGlrV=WQSa%gy=_mOE1BgrSBp zscolN)r@k+I<7S8k~r_Tw@9uZZ!s(P8!PM(h*Lf`qG|UPP5^NBgo>UwH9I~UNU$Ww z2JM5vnx`n)mgNv6Okl7|wzwQLSaZZKR#(B$EWe zBnlP%KD74jzDW?e&e>eJsJ&^Q@DaU((LBW(sY@*zlFyOS?c!-NBqu^VoPq{) z3fzxBCGhU^jM*IT*>=(NrZ?3lUTpG_;K;CAR;0PMO{19|iLYkmovA#Be6*R{aINee=t0Ip4ol8e7_Yp&m=@s+xoWcFI*^M%=f8vgp5nX1|t?i zK8HJT*qU{+x8cx9?O|)VV>xY|g4dX0bt8SZ^?MxC-*A;SvN5t&TNTa;m)W3~!-Imv zXzKv|K`*ukP*36Ef^)(gtMpTyKivNCw&ROoK%6k3pX$S{#GWt2nON4`64ru$j>mn0P1oI!&36bz-i3bH|^& zUAFx;*?Hrk*_SgCRz=!tF5A&2$u2&2YOmQu915UD;wH0b6Yr`~b(=n~#ax?`q){se zgVGb1b)}jz@+GUn!JS^D0%}`J zS*!)wvw9+HTe(nWe2${u>GckWe^HP4J#1NJzq0yIO>D)0GIJK|eeEjlyM7U$w4Ln& zk&ikKE_VF!#IiJM3{~63Q|enw1*`=XKxTa_mjJ4^i^IW;=C$eef7a0temN=opmMa`Z;*Z6_F~Rm#iOQgds;G?4kS zmCGEB(+VASMVo%FcdIu2kjeYvr)OxiS5WhLP+->j*>B#O>~EM3dbU$8mgJ3~G6f;0 z@Z)p9{2%yr8B|kgw*}hr&Kh70G~0`*PocCx*nL{LMg8h>;o)OZhH$i&2;W)Z8p$1C z8`}KcE=%pFalB`v1IJDG=RvkvR!6O<)xQFAO5H~f?T3rj!*pMy43)dbv^J(@EVKRa zrf7wsS$fN*w(w?~k&RN6@aE_q6b7AxFo@rr8s1C^Ki%F;&YcV#{&acZi&QTgJ}^EZ zm8MHv#OEP=Ojlge0f!m(mHHm`%-W{xec}4d+Bj~oamyrO+AMrF%-TlGP8Aiq_j$xi zG+bKy+9pzaawYG?u(emDwf4v&q3lQDEbM){y1P{_A}0gavpTZ(Ef>xnVP@}Jt)veT z4&(T+_wlgzH8dq@a}yNxu6DW1IP%sSd4y~z z+vsM_bJ=CtYzuA%K0Tt)_e?{}_yUY3f9>lf(b_cysg}&dNb9hnMzcrREuT}%o*EFF z6fs*E4z_UpDz402=|FILnd}DOKc6dtHg}~eab>>8F+9y^c5~xkClg;}!u3JlZI*rO zySj>VC>{@44?Kei121pa_q@okm&~2XM>g~@5C+fk5P6nP8TfR(h;re8&+((YI?1kk zugh@<4L{i_q5F|rxBnT$1o0>)Q07H3!2lK$2qZKYZwNfyO__|`5GYblf@p<7sNWFi zqqf*2V6PsY`XXL?^3%0}FM1!jL;8656x$MX1tpt{_#!m%r5u)f)E^kV1TngSr>8)S zZlK605`#w}pJa}1pic>3L`6@0Uwf(CMlD){QT4a>LA4+4k?h5(?BC4037-mfmcA`` z{PE1yfJVnhB=@FY;UkWXANeu}iw-oyeADC)^*#4C>Lv4L@_8D07>L7sx1+#?EDxWK zzoRJLt8M;3b)b=rs#8b?)!ORWg)iVC*zLOdnKTTJaLEo8~#98u%U2c-9YX;3+b)&Z2 zx@ave@ZpJKu?2Xx@D$@5+$w=xIa>lZN(<~_JNw6O3ha^=kf^AzF_ou%;j0b{?-LF- zu54f8Xr;`b|KoUhe~;Z?rk{V8YpY+jlQ!>IvgqyiWD3~lV9 z%PYCMk@ho)c*`qqi6%e*ZSzxW?M;jo8brR(Mv|lvZmplXvp##V$_hcU(Zmw&11(rA z8q`-;WORYNc-LaGk*I+LteoIeSUE0*A|p||&-- zA|TpZk41YDm8CQaJbZzbMlm5IfFm44VL`}o8ik#P0xTN|8t1kI)gUUVuGj76%1*&S zvokwYDe)qZXxt`!R=M!#()-I1$up29Y3^= z`d+$-Pn~ygk~z%j>3uLJUi&Gbs{+!FY-S3DRV*8)5+7eiGxYKtoayQ15&L*1L!b4) zbC{^Q{I0$_n&Aa9Zr9>ILs0`!n5Ypt64^5F>3Aijz`$sBKSxRRQy`x!1lf}6Sd~$F zB!Jg>2Wu{bl1%F=Zdg{S%#Sl3ZZlA~aW8C>Ocl>BO*(Jw9z2Nu}xaKl8gc;0jGhr=GCu z$gQbL^UT^IoRJ~TYNv7M%KhXAE5&H@a7or2Az*ZWm^Lnf(m6oTp0GWULv+pp-N z)X%k85j@9GT*?y#9k~rlH+{IWb!HM;XS7QfgM}j*2}C;CGkNDSQ6>2!oeY>@?{bl5 zP-M9E4;^9d`&va1STPiOYQsK$)xz8vo|{watE#31n@(A6h5jSOiu=v2fvpzGuUkIR zw))$DQFJWp^s#s~iz*cI#UmIn5lcKTeDs~tuUnk4M0@_Du!9U>qR#rg%g@C9kC%9o zbAR#N9A2+KnYe$mo^Rwp+0y0BMbmk^pEYS+s6K-_eY8s-15`*ddKuwlKjD=-&?-rZ za59(xsE{#Sn(m<^A9`^b>wj`8f@$(KlW6luwj(kZS^JvlsYcPtE?TJOPubdc7|wKm zo%Rz{-F*l;u)0(7rfwC}S~s^9Y|5Ux6-@(o+=Dtzea&nmoS={V(0-~-1c&3;vg|1~ z_0bp(xaXDBwXMiH|NPE|tmi*N+u6h%-a~koEmNqga&_vK&6pP-S@&A@6ohvqlx$J> z?T8{pEk#W{LybHdFH@J<*%F@~FKRinvQxm>YXL7AKWxPe4KTK@?kdtHyNA%ge*_SLNq)IHeznf&2jM>;5tT=1AEY`ZnQ@?Gs zw?35it!ovle}2x>hAgnrF+aPdNAOh=oElxTJ%nc`3=Rp!ykp%%SasZBAy`;TKBUG0 z&QJ?quIxn6IO#-zsy=6}kz$CiVq1*v5=qGmJcG3lSnag#6y5K9pkU&ezWG7S$rBVf zCX#SWqB-H1NWw8;;!{;N+;zkRe2i8|zn$hje%(S@F1s=%uHP3~beV~x-KnW342g}3 z9>Q_D8P*Ov!6E#VFEo_6${l1QOj}Gg%*^J70Avz@n&AR=r0dnnLQP4(2MH!ZMf+`p zrq;3#GKKW9^CicLJbdW5kJJ*+`RW2pE@aD1!jq?lyUxW`vfd;pHWLQowEZ|q1u zpoT*(`lr*0Wqr4Wc9<*$QA^-jmtn$d7s;tTO}s~Qo55f!+Og$$i?HX+^#!sddai|1f-EW}Y)Z#U2}^>C zjj1MyWF6@xLD9wwrG#_GE5`+Fuu_8XS#r9`S!m&-tCIc-CmueJv_uqh60w-G(O6=Y zV35rU+TsS|OliS|C~sfR_3EvokJ80|*&W3;Oin0sAE}Rrr1UdSji|5W^jwku1WMQn zF(opzdBSb7OXx%;tD%h|m&t+>k;pNGz|TFKB}jd%aV8#ICd_;hUCf3r_Jl+d0;TY! zR#+${a6;Q&iIzj4O7Nf1Hc$e4#R%@WO(bG->@vi|x|`D9qNc>tgut_LIk?!I&eWQ4 z77{FqzEb5GYli|%XBL@AtP%>cQKBv8GRc${TF{xeoW+JOqB6v5=D&~P%uX30mAHf_ z3aohFLH)L*Yc#cxK{KWFD>j3jxdaH65>TkriI|iqRH}_RV`#%i^8C`nao@%R^=@h# zzAzCvp~`XVN!FXsnn(H6@Ytq=m+!2@4w}bRvw)#MH-!y5xlF zO+sK4L1>U7Dk&|b63@wHGVy@*D;0})No0?>99?dc-^?VkXl%|xcuAldDM30QbCi1= zfZFhFrb?9!hA-F+ZLoNafZ{bF6t8W^;M<0UyVxHYw3$gs`Y_ZWgshuAm&ZmcojB z;N-(*F_`?%Sulb!#+JnYynPN`nqUTsCW|u>MSq zE`ch=e5+e(^EY4z)I3-0`;k(4emc3-WRppCa|CJtcEY7|8{si;gDj7mz)-tBVuUt zAGRh+_(Z&t5HBd00j6McTl0bmJ1vJ_Jx3NTC^pAl0I+!+pgC9xcW`f~mg9Dm;# zm<)Yq=9c8&swr(8qjU8Xr?6QK=On|_0?ArV-HWOd3;7swHcS~R!o)5 z&PW}bc^3A0+O=@ahpo!5p>==V?n7`MWmEG6c#F-|jnh0gWDD>{n}bzh04}zP@#D%b z?$*C#3DwcJ*ekw{`r^2gqntNs3H!RyLtgrFPN#S&#|KzBU*&CMzeF&oY#rB2f8-~1WFoEr|Za$a$diD3=Z zGgfOoLQZ)Ana*VE!^UJbAKiBtesfLNgV257zY? z(Xr3cMJ0UstZ8piAaO89HbY-Z+kboRX$bbK(Xet<_L1?7zzG>7G{NY!3t;dffc@N03G7tdjyES zQxrO|8D96*sDG{`bFo2@l7JK|moMn1F4aH^stq`JKiHj764;&fp4-6g^sw<=)*Yoo znfSpeg7%zZ1)xEE)zlK2b=i!$>3K1z_5or>7J-Q7gH?X8F+9cz?ju(ld5s zAFSzS!<;2nB4PB__st=WO3?a_dUi->`MvV0SC4u$y%d-XJ+=Aq3TJ|FASqacuufH} zlf{?BsY*^QGVDJhrM0h2N9wTYZNDz;zMyAK?kdD-8=NyjZ%0K{$$4B*yKyGiEJ@#= z_Q?>i=5oNAyXydJ_BAjuA$yl_MXXaDJ?u94@+!>2c$^~8SXHM#I5*T?uMw9ryJkV zGko?U2VwFFWkQfXdl8#37}B{m3KqNXb^w{xc3!&(0p0PuXr9s2;$>Uq*CQ}AZVS3) zKwo~OC~EEN!)}-Dn5H7P*z3QHH+7hXd@Mx1P*3>kjIGV@!o_60wCowk#~7`6ZN#GL zDbyKXN-&rSRg5x;k3%G>J{Fu}+ELwT_Pfz>=4Yh#AM0pQ{uR!I8=?6;Y47pj{CW>U zEme8A2YVk;`6+<6Zwmz65q!zG66f3Y+ZQ5goTsBF{2}6#N#U++(eZJ(v}HA8v_+G7 zMBnFoBgGD^9=-T}!c*7< zFnS~>$d64(nY^h(sg}z%(0V%)H&fiJY~OA9y)myIuw5XQMOQSM7_?VyH$vP(eXTu zv(9FpC+`$o_qnol?C_P#cHMxIj1;+~*{weM&akW{9yR|!ROx7>!D$}c(~bg%&G9v74r#fdG5eY&mMpiKmN)Mv_eV`_1_s+EfvZ9T_CPzm+Ozzw5YC#uQ>&z8<$ zZB!}2%Jv@%bE>vWBnK;FtrCLtD;=Kd2!GBr(pnQJ5n3>`PBjG1TUT!Ho2gauQ|2r! z8;d1Zg#fRHexvRK<24{aj8s7+)!w2AnlHjxc|&iu@XOa=;`t-xMaw<4&7e_MCk59$Haou0@e}w-G#uMTDXmEh?*R7 z`U3)QoIg)kiB<)3qps@LDIrtBs#IEs$FUBz6+`Nphutok$B$a;tiX7+s=%w=uaKo} zjvoVFtq8`eWt^w_?MB^>_o7IXM{x9Qt`9itdT7_6_bTjaE;HaGKYyyRkESOWwlb|C z-AD6&fxq6tI{D%j(4Va-?pf(+p){otDyMsvQ*tQi&sLPntVmpE&3mc$jmjzQbuA`G zM*<&Y6fni>*7~YkDsZe0^)9*}3Jv)lZ1Me95I33X$he_vopsYwe9*a28tXc1m4-iV z=(<$kqc#$LQ~T;MT+FehGJsgarE#IERS(rO805nPjrb(jC5a_g@)uGGC zGLA$H6l}z6tQw)(^c3>OzGKx`INz?RyGypKq5+4)r$ZfeP7NR}fyq9g%i_CDhSt zML~rz{%rZB6$sZwb#Yxf}l98K~I07LxeVE2p0a zoXvN{q}{+qYl)Xl&QkVH^RFU{se)wfz_GXzt<r9`vFY+JuBe(>sw(3fcvE zv1m$PYiW+Ppb4=jvagjZ2cf`>miAGvcPDjSn^PZ%t6@e7(GRbVfn=zS~PnZ*Hjl~C^Kxh_NGt+u zeawrk4UFAfXfmZvh_FArdr)Km1ycUbW0PlQ2cPKpJm326?c8uJ#@_Bv0J5e

    Bt= z`wqB!lR1RZhuQ`g4-i)r={7O9!Nmh8h+s7J(%|BO2;Ip-N`Tgyo=-(B!6JhPS>-ZV zoS9VBAID9a!%)iJu7_LS-XSu)M?L!&AJtjyY2bXUp>sZ#_Q+2H;n3}3?q}%l<&1}_ zR3ucT*y5oo#q@Bw0x{r7WAC%uYks!;z{KuR+K3*Nr$Q1VNY~2twZG>&CmU z!@5_VlB@M~{~0O_)vj{!a<6X6w_9J3p5z*^h-JO7wGy}awatW9If zO0}&Dlq2J9N17=|Q2LTJ%@wEN3^gP|%13Ax&kCR(foAcnvg`@4tBdx5F2o9qWvw5D zhAj2dUpL7uJFb#6NK;_|+dU%)*nZIq!1fqYRmqfZ0sHq61I|S>1DCE$dK!c<_*3xd zk+;3uyGTa@9uB(7H=&xv6FXw?PlEYDpZb+*&lStRyzD>!?6xiOnrk>RCGa;S?j87| zy*(|f?Ds8&vO6$qxBwxdxtIpc-7sq!G!U#gK?adLH&aH=1_A4*lGSt3yXj40ecx z*XHNOyP`*H-icc9{OHCalP7V+AC%qhs%sG#A*xz&ZgBh6jI4k)6;eACQ!Q5NrM5Zn}LHP7W+&i@WTS2(t3Y+PTM$;Sr()mHEW zytVO?Z%UobSc}g0iwtwBe>`(w@54_inF8XcDlS#QVlQ|tizL@be_$_3g?*1w= zw5kqM#%uW?D)*EnpkE zOdOB+rtIR^^Vq68CVaypr0VU$wyd2NKeloudE2;VNtSnol-2`|SEnFaKe)vSFwbaJ z8ysMs(W=oRki9)dH#xc)QKMDA--bksa`8+2WBfLw+|weq?3cFIT}@r|+$EyP1$Qg^ zQ7nr}pRVEVCX@%B%VXc=paKwe_A_P`fT$4=#Bg0Ieehhvp(Jf5g2Dj<;ak~=y~(74 zc!@Z~OI(jZ30?-G_P9!86#(#Ym0V7L&{uGk`Z%ap-vHvtzC3^eRLEKNJ)1AjK|eGD z1pU~>BIsv3R>t=-6tx$uG`0j$f|Xq9i0#KH77JG1dL5fnaYIUyw#BfcLEjq=Cc>oD zfWxvHP92SlJ*ilyv+#N)+pvI|k29i!@;}*~j`1Hsw1VQ4 zn|KG!cIa*_R3E(*?r-naS2h_t2BM&Rtsb~LpJZ_^UX?SCbW)mk0a<`gk9aY7r0YhL zcLDQ4NKhs-wETaKuZIqo6V0@b)iD&7{LOqp)j$jY)@jZobOXoZzA?{_oSVv?Q8gcN_!7QYn_98hy&s%ogQRbi}ard>Ax1H|A_`Ft2l1k@ObkbH@GIv zv7l^^vPJe#Dw~o*1v12;!y`mT`U>GLfi!JOM>LZxAlpRO^!+tM&roAwLDYHI^uhL_JL?@h~5 zRW|v+oKF@!_Xozeje2{>i5iE1z2`H;N6=Oo+NkMObPat5m09(FfWIn`$QOw1gCYKy zY5F%<mWK|mfR4MO?zxVCW`+lF9fyUkU<+I2udEJ zpkxq&k~$QWbUpxJIe~Bs7UWqIuO1=b;ST;2GyNq6iL)#|nhX-d{~UxhPzqCIoxueF zQ7k?|?{^k$q@crf+47qUys^KENxa^5mS0-(dH?36 zg_mp$q{9+;XL8rP6&mCU$<`4KuL4^EvvRLy<#hQkG6PSX@P3WTsZT!^uQws5Rvv}deUiCG1n2p%I`Z75} zUW93~*D|?z^71IA#ihI_ru&4Mp%*OX@vw_a5iT3QQkK<%-IKiwUSJq6&plSGL^ZVm z2%mc_S_xjjxF=gEZfZP-vg5$s)v0eDAK%VFO5rY|==cxDQxC#b*^9Co`+jZZuq6Rj zW``oILm&+zERd#5HMN7`f;44RX{VEfZR5hohNeDVwuHEkjgeZ(`?e#C;WEf%hkT4M z@-c`L(uL9Z9l?0)~C2=_KS+;oA&^rv!CxJy#S%Y?cN^ zLL6jLwpi~6YNxPHQKps^5v1%$Gm*+vT+tr^mN1RPjnH@lVWbEOA7DBUS+idEjaEH2 z6DEzaX0;w_lp3s(vNw${<2GzOG1_jzotw}QMyxW#A*m;8pYRnXC80cUxsQ7f&A6bOn^P~_aZmN# z-hDUh&>IaIfmexGZQ78~!fg;C6g|aiNKoTK!Wm@?8S-H@wnr9jaPq;Kuzh@slrATVMZ~a z-@`4RC}R$HcK3Vm=lxL(7+rts!cpBzTdY3Tl5>AkZ;o#_nuZJJ#((ZFPnp`jF<_^E z(Bo;ppo1H(&WtpkIlK+-kw~Y=nCY{wV&=7B5nH@PKSr7vf{Pa@o9g3N$R<^@jY=9i zNlxVAwAO{(K=i70g>p=7{&GgSXPMXao37ZA5~+OG$Kx0Ny44Dgwn*KKtq$U#P7U&f z`m9$Wfn*n3OxBOdW&x>;q{I%Sa*rmu`wz!&mf$6y&s-+f%u|*6P87N;SR=Z13c^Au@<%*$Qd%^v&5wu zA$x=lCF!CzPNjqdD3I8w*E{7pOnKaB)5Yy zje4xBW_fI8mMw13i;+f|=nz`FpZs5l%)>2DlXzxM8)2}e+^qU=YA&>;EN3SM_6RoU z0Xbl}1;_zYYM95LS>`b5aeNrA;-6W@HVK8JIU4&cPx3Lqa5t#V{wkQA;!ExQ5$(R+ zWvQgEXkP2C@7HvFfU;_KWiCni&(7)*1e$e;Qxl+x4-$w%m7i3YVOO`%C&$ z^!9S!!_IEb<;Q-rHyj>$6ZNsjk6Uyg33m!NQF5PYGI6aAMQ|??bSO$gwf+7K%V(W| zzw&ej#Qu2b^gW6G)At_79r?uasqXhPwc5tu_77Wv+u;l1qDw^wT#qpiO9X4Zln743 zO+03Q95?;iH8T9khorzKyFMYwymOL$Kr+YQB#VRO2MozDv6@c28S$AeUV>S{QV_&H(hsZcKn7?(B@jWd9Gp#?a~G!R>nJSj`P!3djGW z9PStVyu7=v+AHdJ?0-}CFP3xRPj>Ob0$7*(mTd2QQqfO(RS;gbbJM5&6E(xTy{OJ& z!zwOgr*>93h_$$i4JTQSof6NW|Nb36cItg7{dddNW2Z74=)YeRhv&8Ezw_eYc@gY) z{|uK+xt3@0hkoVDXce@rPj7V)vvw78@@b@b+;YF6o^@aSvk!T*R$y%Vlp1e^c+m@9 z37NYy7DfZ{-hoD@4cBI0Cf_58eV{Dy|N4LQXr&sjT(A*uB}wk{t7Bdb9|$o%eOwh| zu44XL)NFBWL!aLl;@f#O`r=O~@0`t-`CmO6icHW?cAxg}Ti;yrsM=EK4Y5q5lMtFr(h|?Cv z9kwt<$%QGJ&QI}w^XT+TE`Kfcg$?0dm?G=^6e*GOQ~cjN`Xhh0;tg^5V=6pf9=;@3 zsMq`SJvq1j9G^vQ&rAM$B&qGq1l`q1=@v%c;*W0KXf#=>?ybuEf9VU|FA4rywhQ}X zw=hrP`FRrJ=I8nU_GpmTub&U~tPOMV8UFEf+Z6s^{ch_l_CI~{Tm{>#--AvWQZ+6{_S+vPe z-lX3D_y96auB4^TB>F4<{jVLN8s#H&Lv@P8v6TK>_>rd0@poJmoA!EnhI)CfPAcey zkv$*Ie7!8#g>E+0Ts)ks=vK|Os<}LbZdYqUGW~`y85}=eH(a?)3U?3_z7U_fmdea9 zw+p{HK8#`vec?ALroa#;U;5mb^%FRm=r8+GrQIINc*6+Iw>K!Z9VVwXp@GL14J_{& z-XnNTJbhJ%hdo1+uvP5{9h;k6JMY+no@`pslQZ*rLS3+i|9CXQi>*RjY{9~DESzKJ z`E%^4KYxz@dyj^x@ha>L6)MIXA@6bg1A%>23x5R|!<%6y2G#3~k@tAR`}^XYYVOgp zeE@$gi~g})=`hb(}f*2O#ldnh8Yhfsq>qgkPG^UuZZwk z?XMO1f8D6VDE^Ju4;SLo?veh#wC|WB$GisU$mCZFw`+o=EZymAFKpXS-=F*pN4;Q5 z9%+3^U<3s}ul!>Czfi|HDaQA^GlpTSg1vq<@oB^zPTwi!MPK7!FNaVs2gWfWoBg`F zqySTWjSKN97vk$)E|o^_e`aB{*NX=!=I+n=yGzwM(5o(f$zRL(^hSfl-Usw&A3n8s zxCcEuk-s}OW0>)p052}BFRk--*5_%#{I<5Av!1uPA#bHE=WK4*z8H17kuF!yYZ=a; z|3cNlrrL^!SpU?-IcuXJLhojNg zV8t6XFVh9X9KOij>*_@6r-ekys)giP0lP_GTxo*eUvJ$&+( z`cW%vRcNZbLnWJQU6Yvozt*Uq6PWd`pL;LKk=0Fe&ZnKKQs+4jl0c8ks?_(dM$g|@ z7YX%R?I6aA4lI4ou}?2osV`?d>*69NX|XpFt)Po5kv>RxWubTxW|E#ytuQs~k)FkBi@$HLk&$^*re_xE_mFGk zpGtne{ybW`ZnShTVXMakP96zqy6E_aj4=%kzZ`@ByXE^b3%LdhIX5r-CeZ7L&x*Sq zz`Ms!p;!C@FNXaV&v}3c6WbsrS-e&s8Lfj~UX(K4^+xH*Ds%didz4&k#ANOcSUhY9 zcHtdBPNgG%sNnwj(XqF4y52eV$M1S+sq=e3vwh>jLwd`z7XIU57vnz$UQ&i%QqZ{J zxOM*fXCS8dmGH1^P7h@MbjJ%>!^~CE&Fb=KCxiw z6@VZADtTY{=f8YV5}>MfmQ6%{ZZO?2y3-f_7~R|lUxJ#yD5TUz|HskI54WnhqRLpn zA^AU!ZhpA0H(t1~g$4JYM>jXzVeQ^w0W&v)xxvh@-9J9~Z!TtH0P$JS%flnXr>+gX z8z?+ivBNuged=t-EOGWG8EoKf6COdFqo(#=UXP<6IopaB7V&l&YBlz zyqj(j$*dOB8)=z+)~u&^`2M5W;ZMYqGYW;r@6F!&J<=iCv)W`&#xI)g?|su9Ge2gB zI%eT2pZl}p$9_GzKU2~=%C0l_NA;vWf^0Vt+AdQL|Kw8V>`BCW-wW1rfhSPC_e#A2Cw#9t1(et+?-uvq{1Ljre4MOi0Gc>%HM|nFLIiYA_`ru^DSbcATQixOq zjV0Q5=F7m~@&x#2HFH^Eap83L3=tGL+IF6bGRZ~ef-bQ&z))?_l+mKT`qpMQeEV{JkQkV zB(t3i+b<7EzNg;5;CtsBwfEu%LTiF-x$odbL{=94g*p*QshoU~+uUA#xNKgXlU=+x zUJ`VW^SDwoI-$Plf!C8O%)Pv)yMj2`*g2LR?<_MAt#ImYDUWggLIu6YS!P+&)FD(Q zrf`X^wx4acx@Z!Hm3=l@+LsJ10dkf?a#A5V+0{VKAkLqkKi18`+xi%b{yomF0~Y0> z;M9+{+!C3QhjZ<=B8HR)wj~9F-^5H)QzxbdSPyu*4kYO$WciucPXsVD%;x$o^3F1R zTtkHS*Hw;Xkoy>cXFSWPllY6YIzJO%NWjY8k$9y3S;Nh)?&VK+SrtufV;xGJR4*wd zKlQ-erpNjBYMh$wz07N*hu$6#waSt7H@Tt_(7RzOk#;lZ;Ix82LxVgezgQ8eiEK8v{8BJ8!GG3c^*=(0u7WwZI09sBe1K6~y*85+A& zq3p!UBk(9-Q}8Gk?}A6kA|FZ}fA{!V$_)1x`UkzF3)S3`dPciit2*bk+y8aj!9TNL z#lfyZi0tj`@47oT@^A{$-Oyz7_q}r4!CuS~pGqVHy68pdqOQ3kyptSVdxKf3t`V7HJ(cI@<=KjGc#sC`b0BoXfY3m{~ecUg(s4 zuu?PbeX4tDSM~GV4-G4~^g8JK_FdgTR~8y~6?c4PIXrJRcmqmFnt4|(;tQeNNvOVeWXD;mq1=BUuBO}JIfAp73g`WV}VKnA5I zTaw;eb@bu3rSV7YIEP%n0oS|sC#m<)l_<}rE=M!`BbmWzlIM+Q?aYqLr~Lt&g2!2A z>_>%<(ps&}RWB}hfGx0+^Z{s#n(;^T{4K7wenC8TdBdDYH!%l&H7i-c0^gtqKeIAHi~rF*E}WJ*tj0&H&N!U=cfi~#!J17 z4rwNUCBliNsOBtZg`V-O7>rlA*)QfevrIX^zh}h9Peuw~>(JFWXK9_wSek%&nh@?! zzG$_f)(_ApitCFUZu#}1n_-$0n@c&NcJJ~!S14Du->KgZ??X2;z<(tzgxbk+$0`O> zBMK`1uoV5p@?xYdm&&~UJKjL#h?3LbqCbo>41KH$WP@@G==19PE$NRrI0 z&^|$^bcvP{uZ47Y*8B1grZo-7`i^Y{T70|F=qZ^ zf40{(U_B!=XF$w4C&b^zO@r5`_mgI?>%^Gfe%AYt9AG@uj>*lWIZZo%aS3kaxhEfw zi4Qc2z`mM~U9(7`>{KA!*uA17-Xo@8?85C3e|y88vRBoUl~+@b)KzEG5oN9c^pYV> z^*kBExC({sY8c+RP!}zm`t4$UYN^Fkgk^PhoCS8gGT$~2x?7GUQ-rT0&vcoVvSVhH z7#Rc<(dXvESi;6Q`SWf9sl(}wwHjKZC&e|ptYnv3_n_ti*+TC2g@`!j% zlGnGR&Gc$fIe75*60Mo0)iI(T1^r*#M2%KMDDk3WC{ZzzE24(eXO?9O`DjNxCj#=( z5Xy5CpKc=0)h~nR+B~lXxr3(qy_t{Hyh}H3ARACW=w?a_f3ZG0iv=EO?9Vle*)Omd znNabt)(H*p9n{izuV%5sTiBrMh8z2qt#=w3dm$c8@C2?fz`JPCykU+KbB9^!QwhFI z`9BQ#CUXi-+S!c0t>EA9V8x+!L#AwO=X=nOTXpWqgJa^|jT^t3va#KZjpXMxRfd&E zfn)ggxi_n5Pi!W38>?6E7&H50cCay{CHuGf{jfgQW;pmi{QJ#)q*lOEa>2lw#g}i8 z`gNn4qy1)aYg$5n)e_sq%VOmq_^{-Ku{uQ*dbNQ5TeZ-uxl|POB18}OtO24rO6G8K z3ds!xZ6i>2_nNY^C@(i%weHYPm*u&wd6wu`&pLrgDERTs?u)j(SSmqMfv$lFeD6HG zrt5fdKf7s?4^0xflKON-pfluXlU9^0yhTgNrXYt>Z8 z0nsmH&G&U?nI`-koEPLR@JzMbub!DSaOXH8)AZX0ewn7WAr=jq5=AO~z?8vhuD5QH5O>gZEK}iq1Jv@yv_|TV0=ZwXM-`kYYF+wyaB)}O0Tn!2`We=Jz>AZeb353}B9`M26aMLA zQ{1!qRQpGAh^i7aSh$#15{HW2Ex8(>4wR>33bE$$;Ni9aB=bp)) zombeP%VojqioHvh{68!($h+6y+7!%T-3@O)RjVXz8MEJK)gc=5LA%eU)%)SevL7RxR`Rhtgwdv$H-C@6C{veD@J z@E9u+h~Zk6Xxyeo8=XZay|dt++!>*F#s@~&FDdol)KQ(bHLpp3?9mo6IgOO+9tUa|U6=IR@xUYsUcGd#DAoF%g<+ZBVW0%|m|Xx+ z!boXi%ggIQ>ZlKygF3n{S6@M5%TIM7ALFO9)ZLu5Th$nu&KnX@eH&k9!VIq&ym;XbkNG8^>X~uB z+n;1R&s5ymTAiAC;P|bpA%@1n*q(~q`xah(x2{~|#*0SiQA^B-;NX{iXNuFiyl-F; z@BV(SP*XMf8*0uqN|mkr^wq(gsgZwwPK|u1k{bCcIaT2&fAzFTSzP6@h-QlC_<{Qh z65$t5Vk2)jF}@xg*loQ!*50%+lba52OjwSv*hFwa9E_;Cl3=e8 zyP?dnd{bi1^&8=*GA|h)e$aTUGouQT=1vSVaUBXV*#KU?px!}tBf`zRSrM$f)b-_V zc8=Z7B;9+dC9PGa)kXjU5FYD%etVK>d>q_b)jdP8+d8b-Z>Vl)vx2s>`8uO3=A7h? z4H0^(?#06Srw+#*P`LQY_42w9aPogIo$Rt+-38>{1<9?y%brb0w*rGx|>(aKv54tzWdS9BAU0&+y zN|Rl!+nzX~eFBek2X2(!Q&R6b09jesd2 z7I}q*PT0&b*{ln)ehLa&m%fZ79yr!Eb6yxbjVTbhH0n6Ysv!on)DU02^zD$=x;Z|Q z7=GLA6Mj)TqUu_}HtVL4KOsm)(e&cnmzTu5(+pPYM8Gx5OObKl8d+4^!@-aqG02j} zL#NPj2TJ>bC`X56SP&G>`~wPC>#4JbN%W%o)@%#?vO1ZKz%96J5y&e_sL6LZK6jnF zHg;j>QmqZpa^Ot;xF1xA>anw3tz;moD~!ha?ZW>)D@!(>4gUS6Z&H(ph6wOQ#<9-I zlOh@r{>j3AbY(Mr_vH?2)zPMtc%(jG^J=si0O1JnR_=KtaV^`**0!TV&NJZE{_99f z{r)kYzA8J!oM|AkPWGn!3o7_+w)!~+Ck>vT&UN3EqjzIm`jq6~((5X(g%qT8>G6^4 zqY$e&p^7O~GqaV`uLqbw)VYUeqt3l5h!TR|-`TNjTU6!)cKF*g23@Hs9tM`{qNB{gW>z4xG}vSHoj zn0C8?qee1+D}uecMY7A)=F>8_z1b1oS25kCE2ng-4f2^Nl!c@C*u?TJCj0g-sT0S3 zmOXwfT;}Ala9LQ1S=I0+grVDor@@TvMZeqx6sBfta?sWyLDcSrpTp&{-|xSP2n7-M z>A_1sKRtNi;M0R{=1;|+d1k+=iim=}^jN;G_J`iaYpvN>)}D@+S$y_WcbS!pjVko& zjdZ=hGzTd2?MTlOhHrGwysI_SVZB8V-YwN&rP2aRtFQ%DMg8vnDA@384zdZJwG0=(2xl4 zQ^saZXP5Am&FzDS6qU0B#4#aYA#QZ=Qn<1;h;>bO{?hNb;IfQcn!RSBd-%jc+K~C<}ja&efts8~^ZKQd1?aeVZCYFpRo!%b&+T zA3LFYLCH9T@(!Pgg+J6;#ZtcNarJ8)Mf;B=1(K~M1OdS~qE zHA4W{JFMbt&jADL$iB;xll*p~8aQ!CWm=7Y;@tReS{Dv>R0m`l{Gq|E3k=9SaJt%c zZJnC2df^cNr8n!T*v={y({2}n}C23e)M?AE&VB>@51q@8i_KgW%=J^qA%Ihj!F*#X@Jj|)K;UAfE zE=u0WrEbRw5s4jTVjyB)r!%Py0Q*Rb;*lPZ4>5xzj~W?o__XoK_{B)~BFhJSTfFg9 z6QBkzP}2DwUFxrMN49RcH6^s=visI8xpG2wKOeK7X*+5ZU>>;%o8De2ypL7+Qsmi5g)mmrjR-elrda?AZF47@K>4@Qnj6FpeI} zpO0bYCrakqPZ8%7VURyJZOeaO0uP^k9*Ed(K!V~Ahqjns>h1zi}5w$}FkCHA-UzmuWcvwL zm5!KwZcN!9Yca7Fga?5@Tornas3=LDFVH%pnO)l>a6xxBG`P^7fs80%VQMcpe=O{H z<0@cKUlbGmkq~V*wx~OHVyZ<1n7r&cD2%qR2*T(XqLo$nEYdu6qm)L)=Z-&jtYV(Y zHp1~ce$1!D5kD-SL#b%FX(y?{u?D7vJimR9_4S&9VnH;JwpjYJ%MIdh=HH1F$c0p} zxH_+{ELU@;ES zn(MFF7s!9H<)UefWKxudi;>RCPyM&1m-}q48@%U$zsYr5tj+yg(s>oh+J0H4uf9)d zkY6E&PG&|V;%hy!78d^g{MnJbW%;y=5tIGcW^ZW@Sm;X<@BGzTrAQ2Mu+#UGN5=7P znYPkNdfc!T^Q5RQZkpitYUG!pp&(f5Z0Ai_gUb8;H})SH^bT8Jbe2ch(RTTqk8S56 z5yS=(MgO=%*K3aBfV-m~>iFd=@+8}$AkE{N^)@b3`{Hb*fwb4G6S!8icjmF~&(FvlH?2SPX|r+6q?I)G>7C)KJpDu1ZH}lU zM=a;oO8V}P&DOb71a$Bw7mGmp37TcW*y3yRh|zv^p1jPHotYv7MBRVrrV;3d5agE! zbkhjwW^BN@0jMU9{(vII8`H&bU`;CToxJxR+3$_{_dQ>nY@0KA{j%2N^(Eq~n{?He z5#@4qV-K#$o2SU%MmtLCJH{P%2pVxLe4id}krzad9)6g2s?<#+2KT28>nv8$-FmPx zJ%-!&$Qpb6WQtAckmmk9`v-}+9XeDwVx5|8uIqXd)xN*&Ly!FaF8i?7 zYr}O{e<{^=u^Q?ZX~b0#uA=Z~=`)ia(R_UsQFdnhx4w!gD$K!(bPT%hcj&^8DC@w5 zJuceGo6Xg3{?(Z;F<#*r?!OEIPEb$)C4yaS3&U6PDvsx#ue%x=ZD=`sySL!#ipb?B zr97&SwLtU1rn;3Z7pX$g9qnbw{1I|=%#joYIfJX)Gk2AmPvWG zE)m~;tk&=oZ;M+*%oDMglTgA%kr4x6S>ZgYjJMdj$*s-$byA8$!2%)EAF%D zJa=E-)4L9Y&yCc;fWf_&sgp051pKG)@)P1i0lxuZ;fglRc&C!lg*Npz!BA8Rs5Z zGS2l@G2+B>R2XEhfI8r3esQ*X{7X<3^ZWh2Di5*6V=spx8N(o>w6v}eMsP3fOo8?u z%jNsGE9?49WUU(e$eS9^EC5fw(3xqi5_2|Rb*vZnGr5OWQ7KHT0Jh?68EtfZ-xlwf zb{8r5D8@79VS-gIW>d!{Db2;bCEX`ZJF76+eNMX4%~azV$TjOx-M4MW&@0CpRm1+W zatj8k3kIqS2C55@K%O0_+%0{E`Wu5>7Qz?&PrVyK>i1*S3-lmw*EwNYukHPxqO$>9 zRrm98C~@;v>j18UIDf3C5wmME z7CW8EsE`s#`$dSGIkLTONiuML1I$8htjNMO)Q3Nw&oj6&9Xa-j5!b)|u z>cJLz&jV zhQ#a8MQ|%T*-_6i#_x)on8={^m7fQ-?GFxWdzufXZe0BwwmQ29ZRn4f9)Ulref2(K zIP&wyVIfIG=iCS3ZgRlzV2n?IDqMyVc1lI^3k!GB?*;gEYM3_;PEjCOkle3serLYG ztUqaWaNMVUOPis)Lu-99-;{M$?(lxcJY5p_-X~N>MUPDP*xZL(0U>*V`A|3hcnMgx z;1XLd3oZekBBb>u_50#?J+`acUKxDZCS0{S4!z@K=hE-O8J|K9L?^6hn#K^W!%hZS zO!vR}4DXS{P8)YNe%x6XuIx+`eSh|=J9a-IpzfHbog~`C>AkaZVdd>Si~H>^OwmBg zv%m5}emnF4)5jPUG9P@mCP2uslD4Br=7S1^VQ*M)1-v1SPHd8%B9x;HHy^b4%y=ZT zzT7GclMf&=i0izQ|@BQb4; zm|e(=_im^~2@tn6x;y>`ALc%x^8I@(X&$F{ki=P(`~xQ=(Qzy@VaQe-1h%5UGBa-e z6y0ebG*bVeDnD}=B0IsXVoBJtYuS=NZh=9OT%RZxjC>s*-dj}<8yh=aj*$yN_Qiia zj;By0$yZJ1lD}6^Ja(nBC#2?K@Rm~TcXrXBgcxo3-Yyz3#uB-_e^7fyWO3KK{3XWd zo_!~v3?w4*+MG?7Xx-fSX8>f4f-WB2P&lz|R#Q0(5qT)>#dNA6|) zBeaQnl%2VKdL~;3GG}>h+;0gWCXAGC%$PsTC@z?394S+1b{dQ_t0&dD@t@_cR%Nw2MR!o{9wOozClD*Fp?b`{`qsgkfcuMMX%ytVIv=k z(=Fm}ET(0H=PF@=|H91C&yMLh#7c!;*>8tpir)?ZgmHoDCZ3K49PwR$hptP=eO{gW zpWaN>zpv^3GG6s<@iDO2C_BbPmX%rvEskq72PRUjOXsWIPodTPyNM(hepCA~*s3dW z$v+>M$T7Z&*r)PMgfJ;Ek&CH!1mY^eMndrE-D%&&RRT*%b^%2fnG_|kv;_G&4J>8A zJh;%(QexFFjANsd)7d71gz`AZYfbKr33KGb3eb!w^1^% zjCA6lo`;pH>hAcs7vhXzrF+kk-X! zCkM?vaT8rj1x~^6y~!UPVLt{*G7aD1FNS%HpxPV;|zlTHx_uhxDojtKm7-V<*9t2q0$+P&8v?08_M zu9do01=4&X6w-*-J+;O;5ipM&f@>vMe}TzgUxKuc-CYK zr}=zmJ#6xvmZ$BYIN3M5w>G(+Jbv!fe=qwOQbQR%H!-K`8SqYm@=E?tedP0X^^uRx z)<^ah)GO?mpHfg!%0)|QR-?0^01IMMaLtWu?Anw>~qc3sKT<7ee%emsaMgLl$jd#AnV)GR1aW4AGum*RVr3RhSG zA1WOHshjvGKe9FFQB!-ex@-R6(<8ApdNg*c6tms)>g+dqv=VZ4%nn&CoVuv~}y`(1pE)V0bX1do1`$2GK|71-9boE9OS zWTiq91OR9X0MHa5t&!>dxb$Mp8)VXu1LsEX7LXD%i>vrH@54Qby<9}+$Ay5^`m=L# z^tX<4lO%`V*klDWK=iocX~lr(1-Qr%mRP$#PiB^#RDl)xDHvLoOY2j;iqEF3!c+eru>k16 zQVnP+>BRPz$d?oid5~r}41u4Y-eztEpFm<;TG>! zY*#^oyT-OVgZ!437JG_RninOsrKg0X0Cgj2UkR_g7;Wea-%_sMam_G7gZomAj5l z_Lh?*)qhNsld5}6X@}L1b6;o!+@e=00^DkMp5U0vG@Mx(JTrg}vVQ!zA0p0*5OKby zQPuDzhP3Ks5X^cH*Mm4$>HD6Ak5MsLOy) zU0^;s4j5di#MtZC!&L5`mj%j>GxhvPZFc6HMXZIs5>|l{Y^&WswM1t%B}9&I58!8k zJv>yBImLu=4S_px#OIRMl1^i%HFv5;ESf)k$Skc9Ek&}@prjKvX$X9Y)3j*b%Bs=Y zGCFYJ|8r_Wwcq};oc?)1oL=I`>BROnO?K)yZwhjxnFb&=ugpwKAT|5LPMpAwYgq-y zVX-_yK-fgXl;GAkcfU2q?7rL`sM__UkIBl+niS;TTZ2H>%oP_)UBiPW&?1&+Y1f4cP&?R_ANCByOq&No*~!!aBQyUn&DeSlL-=!6@_EEp3R84j>i}yecmU z;u|9-V5GKAV2p1DWQ7Qqf90?xW7uSrDc_$}`Ti_@E|as4cY>D1)%?xGO3TM0kXdm~ zOf8ki(x|!m3BV@0_&j;!93ji1;0_|jYY=T-(4VmrABA7p*LgNLVI#;U>OnS94^pCf zkP_AFO6EY>gr88W^AFiX@trlG1z9x#JBAiUG^$2JSv9hs5dO%ro{Y9i*{Ht2s5Jw| z7=q*{0r#jK|1nq?|CYk2(JjLQ+z!^OuPfCavg=k8Yb=~D4ap*${XF8-%+d%WPxnKy z*q9%SEuGZDSIg#WjmbV^mV!)Fqf3ysMc`-#nPic&(a@A|ld6ANbyV-Eg`jX`e{umNKM8z_RSZwUImMU{EA~YYtO&twc=1#@Y<&g{ZNc{k zavCtFd$eCPP1*l*W(}5EI0VeZk7Eo>ngYNPP*0WsleODf-If9U-Il{w<)ahO4*Am{ zw(Omj*!|0g`e%G}?X=@{;*4NS8v2YV4ZR(dR2-s>E;&RSUU7&w(|it~(#g(IBMv=7;kseu9AF>scKyEoB45td8 z8kpfBMZxopw;#thUNmI9CKhdv{kWOvFIxXRKcN;e_onK*@gm4QEXytBi1na!>d*}b z4pdPVl0i7zJA%}C1rf9o^X~-BqVOB9lc$@L%oQ5t#h~;bL9`SG<&SwQg2?63V*wcT z)~ojGg9SG?5Zs(#nNVvm_r~)3$p+*eA~@MVaI(DM

    l+IpMNnA^*w*#jjVE=U-XZ zYha3v6D%YdM1rn_Lu@SCA=c2vAr|32aPabzYP71a9M7jbeKZsFB(fw<$6py~0{nfo z*#~tz6Ui@tzIhEt5DM7^wl@*-pny6O2*)2+Oz|1Wusqjr-)C@ak8)xBEy(4YWv%!n zuUx<|OAX!4FMcJ_NgjAr{4U3&&32JZ)!7L7Si`FhJXx#6heW@+3`-5Q=u$H~R)aN|SF9TDrR>j|mSkH+M@)}5->S-0t00tY6AiRML zRvXX1u*AV3%IW>s2>ez+(PA&nXw9}XeS z#d{ zQMia}FP-!xNl(FJNJyU;`tN9rHon1?hY+kWmbDjvhb)og3HBm6?HH_d^0dWO=3&ijn;O9GNE{%HkP^Y{=vt(6N2nj zJ*_)c06N#b@+m!wIrz!fF~jyO3ZR?U%e?JCoKypJ^YH|l%bv^(Kno(q13|=y#7ij| z34Q0B5@I;U>PtUPy9%d&mmm|{!q3DK*=-f=RD~eI*a*D2cDNLzQfSBgRDoHwwYsmR zQV*zRNWu!aKIJo66GV&|ECmN524=#}g3q97ZRi}%Qvds#%vv~L9CZ@oQ9=vkyNOe~ zdv-v@jEPovW6(~bg8IL)P#o66Zh0G5xArNLl?iC*Jj}}&(9k8_e$|;ki3+t>AgQY# zrbChpUOHpsJZKsuzsiJ}ub{GkiA*dZ`Yl}Y=X|xAZjd z<%K5A_w*KPkeNC6`!Oa^Y2^{KN(02h*T}(aK&C>=i>TCa*>*cE&{dcuj~lN~c)vVx z-n?ETsPRG5m!}reA8IV1wiMWD5$vQ1c1rBWbetFLq{-jODF=$Iax@Ja<)rqYHWrX+ zu&!Jh?~N`&rS2})HNFLP2ZCsTVS8Hs71+}ew7+r2k@YiRW!FjGw}7=(tM+W}r?9ZJ zzo*D;QzXo7ka#XJiz|KCt)k*Ew>{qbuH~#RS;abY#W{1D(XMqANho7=9NGplRv5bA zwzAL=s-5QliQIOAgt-fL$Y2(e1xfeJ4cj$(F^uZY>z}0iutBBhC6bi~jAR(*Wd@97 zMmO-cnUF`NePSaytY2ra)M8Nn!o=Ac@=MREN=4_^7!Dh*Krked|JN;Se_OiIS_TXA z@-9I-<_RdqG2rzllrrOz>-)ZD&mdzp#FIBSfwUj=h@doqBhF6~{G^34uU=%c` zw}=$ng7ozkixv>Y7O%q;!I$ws26M2(k>N;dsS`?PWsfU0%A5p13PS@3oA@y5-{CbC z`hO%W?~+x%CQmq1ve2A*?JwMIN`Q6*?D(OO;gUj_n$XzU67uLU6u^XnT+Z-ApsBlO zi=m6?Q2MQJQFzfR&72qzuz@|`z^8rlL_Y0XvXW`I@3$Y#_z*n$KYZG_yha<#u+ul_ zjdC^u7`s44Job>_j8ua^^uwgs3+Q$kM7QJS;!`!KlMNUg=(+*g`9ZM0rvy8Fjo#>P z{cU~an7PNCpdbV%@)>uA6;uT&@9M0mznC@^|A9{fQrp%9AY!L&>5X`+ZyS_)WQ>he zi$Vfe3j`qY1=#5mHAT6`{Fw$-l+ady@^i(>5588Eh+iv8C|fI*J#W%zwhToCvFIlA zkrhb1>m)`$*yl+O))_8@z7);K=&DIAB)lqrAEatYz)qV34Xg=plWKRdTJP^1f4%4o&uf!AncPzK`?hrkhvX4=bO{bX|x() zF1J6G05pJ!GlVoyo9NvB(0=4mU+E*hVKWJQ!}c)xYS`9a4O^E?D0C#+-XufReFn=Q z@PQZ!-tbIDfYV^!UcLw=M{I4EdHAV*%bJH=d#-ue>*2V=|A(u6|Ej1mW*W%*X?Fe}6Nm2-j zaQ4E@47WgzmDyyIMmdzm^brL?sg7`pYt@$N_?5&<%n=xi8tjySgxw%vs>B)z<;T zNDM1ll`~J-oT%gVI&p?RAl&^ROx(R7c=xDSrU;L@2!?CE54*tS%_ruN&(){ID^Q70 zi>pn1Hy*UO`aBC_mB*i=+V`Os9=A;q`Q^5p&Zb4@r-w&GR zd$dbfDHoYRH743%ff-EI!%|~xgtq_C_ZNm5Uckf9M~QDDFlRyfN}S0Oz$HtOua*??_e@0hb9T zMTx84M?TAyH(TjtoX1?_fac=>;d|jfkf?}SG)p^)WZnq_)8z7??_wo&GSNy3o@)il z;8unpRu7XpgT2gZ#i6;C+Unz>`<k*zZ6#seeA_05s%tSBpR7Q$C;6M9lSi zbwA+GUAn3tfo1*IY!dF1uYToxPZx+Hj%0RCwN>{IV}a0foYmOa&T$^Or6juGEjBj zX-EW=|K`vII?ALW)XUHVVO~C8kdEOXu&uzIXjxgo>9~n650}CZxj*Gy(&vkqLY#_Ht;l>s>3X`>|$o6$`DobMcKq zb(9cr6HwUJZCUpU0CE5Dt8(3=4 zT0{kNTcf)Fp4%D&t=%P}GIs^|Pn-<`jBTWS#LGq_7A-CKy+4zgA^#3X?=O5fP~H44 z|4iRbH7pM*ft!o(a&=(Hc?~#Uder8NC_MMHLr@o(Yg*caTv!V4{li zf&t6j9-9!RajG}6f4Z_jJ^#(j8oUXv!g=u>p}=Tn@k&(>w_CAssfscO#=t&UaU5T5 zXlmwpJp6KK%A;7kYMB04ikVR0za|giW9kZXOI2H@G)qx~o1oOVmb(thj5+F?Cda@$ zC^Xf1Dx~P2tz6KNLG}dLj`5s!vzKiI?U;ikZBK0yC^nK(ivt5;jX+5lzoFSIFgg`P zkNII z`_3ND(AJv?wPTl!ThwEGph379TJoN-8YmqDaH3{vm%pvYmbSfSdh#jguYhRx%ldM; z4y1y*DR2bIVhC4PkZq&CgC{#f`e#pCvX~sY-~YqFZN4YCZvb_~EM|YeUj`9{yPjp& z_+2_}HVekEP8X3qe}_oGquj;rRAvs`c=?53uBAF|%mlftIAKt0h_nlXx*Fd{>Hcc6 zua2#3J`7hb^bs<2JQLoWIQiQ2DY8|Jf2M*{?xY~U!+~_l=XIbleKqc`3202) z!+WwiYh|_|5EwYJF9_m5-a2(f3S13TCOc`Z0xmI^J-;|(sy>A|!eWbp3bhjZ2+K2MDIjo&C+DW3=-S6@< zRDD%OhlRkrkL&QjDHBTpuYW*AAji5qCW3iP#b0OoL2Uuz#dc7EqBgOs?csLn)wZ@J zezJuWBwKl3lP!6EvW49?jIu}%+&bsOzIC%5X$N(Rhk+dogOSSNxT@<>A3`%K)oUSU zOrDH_Mien|YF~54At(A;%EyLFf}|1TozNz%Tz=X)2{;o!?R=^^5cRs&>HnK`HeWb1 zA{jGMOHmMHzPtFD@56H`%cn#68D~C}amGpNKgsCj2lxP`B7F$!>jn$-$y9f94P155 z;k+PJh9#&~)qz%09cU%hCEjR%m_S`l%$Wn#sxL@~y-=5IRop6F@TQKsPHWAfL{p|#ooDxkM$Th0ntU>I5GS_bO3sPK@Bw*+nLRb^>0#t3c1ri=Tu||@KcTom%gwg zhpbqWz^1{-I{qVnWSx;IzW=d}UYA3kDd`B!>a_W!DD7W!)p|)4JvT}9SC@iz-?4$( zgqss%YB!f}s@pu(S!bIkf734zdCE95s7wk6S~A4#P23^C_$W627{}6A^{BNOe7{h) zrI|<>0OSOqdW!(ni|u?e2Frfw$mIMD?eLly%Xsx~%BU{}ZO|pyz)G+|)Y=9HJ`%TI z6Q!RzcR;=6Nh@8Mp??#{f&~>e(d6ezy}Du3AL++i@c=!gUjzBmbw zQySB$-G6r95R@GsdL^ZH+tUnATaZLpluUlMZf6W->xtPf;e*rd<*Q_L3$f}h5;E%Q%r-B1B{cK=-itMb?IqQ+o)U@65V6(l#j;V znJSO7Ef{m|0mt!HZrD=D zxEm4ng%(D;+7aO>@oS|mv&M1H{-sdl_;1r85>T^dRn7VJl7^t?k;y9f4{SS~^fTm1 z_Du1ey145gI@|!!#m}qYqVh}XiJbXP3) z_89e-P;Nsx38}nU+M*Zm>^{J=`&G>;dn-iQw|wi74y#a*;WmvqiF0+KS$XbB_JHP} z;Cl&PkV+vgC<)hd+LEU537BMnLx%aD^oE*xgj_6wGjN`D?a_AXsin3RK>0`kHk*f_ zvSP*>!kbr{3#O7lQ7}b(%mIIknF2a6CzP~tfgUZ@I#4Si2V21r=F_DG5^U(#FTk0W z`{e#XH!Wht$DS46vWW$2q3KHCOipWvUF!(o#DVU!U0(ply$o#kx%Inigc|Bf^8!oqS# zTk)7e8BjA zi5T;^z0Iuq4(ZEKPo=tKuHo}%wvgB#JGoYpCm`dg-QX50{jJx0L!2!VJGGu?+%<9HzM6-S{`OQYoeDLb0wK{ypN@wJsTD-50oO zagAk=-C@97EC$TQV!&K1#xNqRKKsiBFPBiQ1!RV^quUMb8IYySM8(Sv)bd9nYNbaq znF1kF@;S6w#`y(&!pu;i1liwl4L zB>DmW$6Ber2GwE?zMzEdXf+3#V1w(h0h?t5Hp`BiMMq)k+tP1>D$h&gz-EXB&WMv! z)@Wdp-`B59YEk_b7Ihl19W3Z8lVKRj1k9Jr^izurBEsO@szJ(l&wGB)Z%)wjtNz;a z!<&3#&;o~7OJVTJO=c_ zw5$0U)l>82vIHp22yvM^5f`GfT92#Mgr695S^IblNAJP8!*v$Tq9*sQxjt|9jN%QHlj7?)6sH`@8_*x8Xw@O*Tf4S_^&Yoi{LVJf&=!3UUw=&ncD zewDJ}z#$J=co_iEFUbB!pu@dFM%$-s+!9A@Ms+xCU+5qH%&ffun!A8s$;PyY>8v*3 zYW-l|wl)HqW@}@S!Jylt9oiZh&}d8;!p;Va#?a8Z5@vDfPzzT1O%!QP!MfZP?;1$7!rnx z0+JXgU_gjy>xc|ml|d${AVU&DLO%a5Ch7nAaK{-J0MoiIlbR= zzWdzo-t$j++UA|tyWX{aYyH+Ph^?E;X$gEoUNxVCPK8*2PDR@Zg6+T%I+`fWv>&cV z=5hp`3wg~spiS^?@xwn4-D`8gK%q7#b1L7~S3t+j$+ty!M(%{}j6cWZ)M@8e0VT(? z+$*zfTgo)Rc6CZltwJ-0*`*#%V}Yh_a;6@~&7~VTWqvCB5D87RKxpD{;%m9?cMtMf zxJYA%n6=|H8ngETP9R|yx@w57&i>CgqN1skY<7DBi zXBVqCyUv3X31VF8N+?0Z6=JYWP}k~KtSp=rQ*#T%)f>e1XAoB(5LX(AYb(JGa?AQb zk@iDw*mx6R1LZr*F>L!+BR12{g{XKz2k00liW2t?aSZbd- zu`J*zxn=H$_6NDup*B;q4r1+-u=Y%77EBrx3H@1UtAKd&tdlFYqd=`6})DmuQ0QC1mi5BipC3-uD&n z$fJ9YQ5^3=no-7lm%G^JPs29<3;|x(X^$k!wKqDG7Rh4!S%B!#rVSEMFH8`B42i!$ z2>h6^KGm69JxG|E$mJvm{Sd}rZ8qd+F^R!! zEH^I~(RMUB3A9}$?Gex4e`n=9w{9YmFYftj7x}9DbR4Utz#iuttC)N&Ox_J9Z=-q7 z4Vyf~Sdqz>!Q|649=C9@oW?PBpFRN#SbIh5Ccw}PVsHWs{bz!nsr#-{$->!9=b|Cb ze2oSwlD2>6C2GS=AgH-DoUUSwdW~@wLaR<|&3hKe;52gsWN?080t{ZE@fhVrzOu&R zc^1M;{>=FnX^QuPPt_+-1bFUj0|H!H$cVItOA8s1Op{YVnVQ>CYTMp%)V4T9J07*p znj$dg&X!n1yFwfl5A7Q3c#uh%LMh#UEQ;>_e#;gt6q$;JBB{)kUU%k7OkfFEAX6PKd==Lf&F$}Jf8boL zR9A4Wa@8!^y|aZTYc0V5d@IV?0ht;{Db7jiv-||PhomS_glpFvO$A&s8aS2oq>BPC zkXQDl!wt)z)Fs0W6LC8&;f9H$#P$3+P5p0xgbk^?OR)RhZmAh?f&9l9sX&stlPjWI zYh>-j?lN!T6J2;ND zUr6+_WZ#<)GIGurEJk0j7=6KF^ff(on$zxCYuEr)8XyaHGJEQqr)(8{B!?8T88^r> ziE*O;|C$Zrkf}Zg?5+PREyyEw3)6~1AL0%#G;3cyvX6T5AmmTcr5``F_`N+d8$sJ+Z;;|vqT zf*0nf!vSW_me{6%ja6u}S>7o=SCqTy7)~2<^51I|XBl64rkyex!e}#9yjG@c>VOqV zpv|2%XobC2rs!+ck8}g>zLRJFtJ-vMD1yo$X=`a?VV2F67lXG@wO1Hlj^q#lA-%l1 zE_DM}Xn2N3{|3M{r&7(J?jKwcYAdS zLy?`uuwYY}c#=S$JBx+bY<)Pk1x#hI&K9v6VJi0B;uBkV8#{0u3o!cnzZu*&yC0I7 zDAKFMO>%^C)-kk7&fuEU$t+%)t_vNx4}w%V7>>rFY<}UjZ-lXW={6Q86(r@8WNOv#b?wub;WfXbevQXThz-<=3x6a)rhm`_(y&uG znkWVdMvy3Gx5sRMPcJg_?4 zyy>1!vs(1IO7BfzS_43rlbNf_W(lPHx^rv|Fs%n;b2H(w36hg+;jtm97Zetb&mDU&ZVH{WN%DI)vG=0X27NDF5wnpmldSf)uds{pXCrTYc!>Gv@CV0+ zH-h1F>dqM{hG(P0huXjb@;aL24$*Hq9$+~|Ml3WJzWQceSCsI+hy9rHE+un#8GbIM znDW-dtc@s8-aRYICB8S7x5cP;U&8oV$)ju>os2P4YadsvVq=iC4^yRQFjaaNu{E^6 zEffT;|5>^v0LuvfX`cQi$WW~#kcR!<-uL*BR+SGkVEMV^V>6Ir&xapkY@U7xOXwZ` zEg%mrEzrCkVX&CYCsy%jLl~xvDUfE=ohw7cQwHKG1M!rBc*;OLMUK*|`bTwQaD-1rv!} z;K<*PK1jx6nplUqq}Nz@vL+q5s+k_i7#+Y8IL85}F($%kMM_v|UAL~V+yg(h`*H1- zUU0gAmZ;eAfK3z zi5``?Q()e^>{Fv5Un>5HcY+lEuoyL0_+YMF2#jn0@iWwiI%`wNhWEDVLQ7A$#;NtbQMaml+7o9-(ou8cpME{nKU&U{Bkb-Nc^nA9xlFMZx54?nhh==ki`{gg} z!SI`r;efnmFB_B%=9C69C&e)p6p;Ke?vQ_6H6x17wdh3vWvUE`mF3@uj4A|BUg>V< z<=gk76pc>=Az4-pKY4^TZr+5XYUKrOie$n|)i<;%lDYG;iO`2*!$h%dY6>JW)QE3c zL9Uiuh0zQJVPXx--=lA48v171EK-q5zfC?`^ad&P1fh;IlkJdZLJ@!wnk;-IZhj59o6Ui5n1KAYHE-8g!WtTM7!)>=O zPTnb97x;bo4M=nPQ^LG?2p*;ok4%A;TMX1dfKiQ~Vlb+13Zx=f_dGN;nqkcN3<7&y zja$z$XEdTIS_n7WiJLhS%a97R^4g?U*&yC~?&Zbk;3Z-1M}T7als!IIpJ^UzSt_Ut zLxyJNmO;47RS_@aku#LIg$eA;>)FD+l$RHIXO@IT-T!R7EYFs;x5yvicTa)nOaZxJ z77{je3ZHi^il?`Eer3M?wb&=iIgNd-~!~(X?58b*>jjHTJ~p}M0?=QZB~ zCA+-R--nQ0{1ZY>o!(IQP9FDqLv!3~B(IT{p+BC2arH9BIEKWi_%neO9?yE?Z-99( ztM$DD<~^-*)4a(D1Oh4Y56&UQc6u{60rn?TriCcN`X&z^jTV?e3QRWXyw*pj04By* zQpB{}c&XF#efDC02?8pMaLfe?Z64-cvuCuh4P*1P-jb@nvo`NTD;11Otg1{}=xOR_ z)rC^XvlSHbji1R&sQN{@eOmgj;$QB-i=ee_d}6{^y+;hht_5D*Sbd$RGOWH1N;WDz z7%-OFfDcw~KMgUP;7_`^eqcj=*O7Y=!Q_hs9HsjRb^1GanjgRWcF?V)e?Wn-%W~Cr zP3t`Y!JA#5EX3wwWxR~o|91p=BZz^*6YTs{C-{0RF4AtrN}74+2%yvjKS1Bn6W5EaC%O%nVmuYW-D~8D?Ir$IOcu#Jt$h z@J?QQ4g3Os?3K$OedXxUqlz97ZC#pH)QYV zqh`%`ejH9Dv0nb^+gkHxY8N8C+(UTGi`NzY#$$Z*(et)nV2;DQ@sHlsi82ekXTv%C zBeZhBhnJ;mYl~Y+qt9qgiX?||ADr7(Rx)A`0Uc5;1O}HgF54iUdVLgTGXkD!7ei7{jl``rY!t4b77UV;Z2udcVL7 zH@g(E@I^RH1dou_MFSqOQq}=!_C3omvW^0baAkg{jh`0(S0><3>-KH9==U)-a#KZE zc|^%eH2(0Ey2Z2RGd$o8AU z_BRL@`?g6pbxy;$nWotO@vZkuQR_480!X2-yFk{pdGe%Q@3R9@3(>$w% z61v~9TMH9i|54FB{Nc)&;)MCubFxgaD+517z>R1G`~<4s_xM7?Va&XW#>^`k<9>lD zZfpUfj}`#dEV2NopaTnd^@h{~g?M_{u9r&`HH7MU@v9V)<0a8yqy}CltLh?>18nZ= z0E+;d+X_KG^SmxtHtepjjL|~`mj>To9(84QkJ*#vOosG&Y_K_I3hQE~a2%Mzcj)}u z1RmvNlS8*EEF08~w?f@C&s8itUXr>CCk%yU?}BAFIaI+9Q+zUmE&^to{ncdD15;Ia zU{>J)7s)S1TV{OJ63}9#C2Sbdvh7$V%F-DWy~Ii;!E!PD1wP)uFb^d&dFiWMLct8Z z$D0}RciznChrF3_)x4E=uJ-$mp*IGX4k^$Zi;vKoR6uW3G4zH~mxO{?UI1btuiW9% zt>1Jbk4!)~=J@1}IzHqv4l*8C&^Ts{oq`1oKSYkn800KLmg&{X4@<+Sj@%4OOj9Wf zBgE;eEW*d|MzXc9z!*1&g56WLC3;WA>3}zOyxfN3joZiJjc3R3Mtx|v9XH1S!yDy$ zpQMHaFS@F`DHw8P)200(@67QG4hGjD?w z++kzvW{|A|O6aK(1s@(}%QAp7%uqN3+%yEvfciTCXGE3L8Z+pt?ZpMg0A;W#)}+z$ zJGilH#rQ{!{rJfk5vmZUDB=ZGwRT{$2L9?w;EE^3o?D5`x-k~2mmmdjOkviU{)fw; ziV5<7ri}Vm_@puaYPQfp+p_H5Y|O8RA0jyLN_ctNH2AgLX5hxr%IH{g!D#cUWVHE9 zwgImVrn^LF_6nezPyLJYS~{PC&@qbENPWd6LWfQmd=ATJGs?#;CLhWDg+=9d=&x^2)_EZ_}GiBHDQBZdk(pobQ5(ME)OmqD^wv{l?7ZT zx9EJh%@|)fYd3bAS7EpLGNQyxW2NPnHag!pi~47mF(rm$v=r=yAi&t|0KRg&ITMTx z(88d^E@QW2H{1?8|0CHQKS1di_-_cNkT-g@{zBtd{ySe|(DEuwnfz(upiIV19Fz$% zaZo16#E+2tA1~R66^Sy#q||9tN?pgKR1L4$yI#0$t)eb~87AULT>udAC8_+&S5wz( zV>KNjk(v&uZyhssrAvTmZpNMY>C>As$oFc@TDq|@3){CCY~Lbb-^_5nCFs6^UmLCK z3jC^6Vz4WS`=8+yx>S5Rbybemy`4zxKV>}{5X7eDJ z@hP|<3;M`neEcpvG{&d#`B+U;T>$m*Y|PZ8VWuV@F*W~KI@0Ovx!v#dJ747G{%1xf z7mQAg&lsKEW#9b?i+Kdq8$PmExYAVOXY7^Ac`ct70{H}x`4B()$YOP5Q~qfYihmR| z>XdcVYAk_Bge;bazV|01*9}*_9L@LLtH}4=%gt4@X7_G`5Rf%!xm$pu+yWFO4^R|7 z578A%8VmdNdHfw6Hh0ypFOawsy@tD!YP@mOT@Bnhy zA(&*L2qsyx1JVE>S42GF#^WLEKv2oTWA>H>cH`3!Whd&0HJpIG;|PL65@&AoL(|Cm zeaMP%C7D2pBMNOe1nNB^qO9rW6f9iHMP7;}of2Bh#ls1;1va2D8Ytq$DBmuRz6mIz zXt<$_$u-X=v-DWHF4+hiCP*ysoxV0w+4DJR>Z3aaD281npv&m&~ z1dTNNv4^<~5dMt1U<5)13>&Da2!;NVq|)f@NcoJ*IVH z2_%6%cUBx0xTM;khJ+pqvJL13`}>&9h^N{D^Sa>GU>9WOdqK}Sli2MeEK#$C7?3~E zSZvvlbWIXCaA%bweRSY7ZK03;x@hPl1^O5cHS|$dhDmgA*V@7)hQgqWlBJS3wLS6= z4s&K*dowfKE)!Gv02w37#{ultcM2#oiiO3TKiUBB87Ng5b?s#kYsvVG&u}<1zbHZG zBVBpoGrG^4i~`Z9?qfk54Tfi7!?UsBZQ#YJZ%DX#))@jvA{)g{z^!=9_|E$>u+pam6xx=Bv1p`2ie9Te+}P($H}6g%cX^_vcuKkGeb6AFiJbS4<%oWFdTBcyJ*z0C{lP2twfe zfOO38_5A=}rP!FtyeKyFiT4Wwy&ev^RD+UASwd`8{5NJRWwV{MR(17EoY zjK3ABj@EVKHY&f7Sp0j+XtoSPLEo_BnWvCBwoE^l6bz4sA0l|P36ikU?-wnJH?-qg*38P6(g|P00vLP)K~(h#w=j)*P%mEjOUvz zCzhFcIF*_ZUT-8nRv{DQ@A5qi(g?_7QqXvv0OS#ZVLKZFB1rBDP_mKS6QE=xxhETC z4UOf2YPJ)R;x8TCLxj`kSBwyS)2+Czkx zX)&uSs~)%fGeKy#M4>d*rZ-*8T=KcsAgrHVYBuoP5HgVHniRrqqgz{CSuW@~8hbVDjB|k< z$OxPn3Oleu1fZP=KsyoG(IP0oNl#rE8}lR&IG%a8o7QY%!^V;V1L)vVZGrL7ugqgX!Abglxq7iZ2Mq?s>G>_fwM^?}EeR-UzuksB zBzm2CZMKH7JuDHO>x=|O0;q#P-+_WRLl78&f;T_9^UG?h%FrpG=~ML2rB5aAE+PwT z2MK`1-xB9K1A(ZXQqKX}Mn^d9g4AiPYK*wR8D8TuN)2ZU5(jB%?qNY3Bn~JatR?0H z1eu_YgCOYzxiBtL{R0xPp!!F8vTy0qZD9Z3!rC{e7+g~BKcjAQp}++SWMx1XpbxDx zmYA#C$OObJqzggrJPqJDJ2izs7c{TysT=Cg@cdr<-DBrAJf1JU=>j2D_5L$N=))Dt zdnx+Jfj)@PN8L@V4~Xd^eMF7+(UAMZ7OsCn61}1kG!zO6hz$QS! zSQmsEM{&r4O%R12K73yiHOl77LSv%s8%71`*r-B)y%;?P8g>kP>=+t$?QDJHccK5s z{09^%=d;bB+*h;ox-(bG8e%r)f1eThX~D0ym=>PbT+Iltx%=={_DW6rNqR?CJQ9Ti zGi&5RYu!(FVnr+flG$J*GLenoXUf&XfM(t3H}5_$46k3^Anod0aTHi-vW83~8qiCz zEk-lptm+65U1}IKtb?GIc|JLv$NI)8AE_uMxC(uMdDZU+6{V0zIcW91Re3-}ISuBS z%$5^^2t-FpHR}X&n)GT`6g@6bxR+x)tsoGoWJNcW5ulQlpraQmSv~OTh6pcToaHoc z^Q9hEnW7k#Ct8du^(0Mlm~|$QM}9_QVUZ9v774MLH`$ci0tH9z9qH;pz0n6ggq~gG z@*~Spi$blL39Pb?p(V}CW@)Me0O*9TI1Z-~SG>Xp3V-=<=y_21E3mMg?ZDl8m3$vD zjQ8h(Mrv~}P|U$?Yz{gwhivjQoMH|c=p4L|Ik*?xl`Pb5T6hJGwJweWg@lw2gU?Rz zv{Gzb6(5~|*ZrCkOBo7wAaR615fkcv(HbZOqdVKwe2!`uosY0uftDVlfN{d$moM5! z^tpa|8^Zbb@9aNlqlrZLuSqkMkCY)j^atv)pa*(G9Q5Gn{G!+`Rfn@bOZ~{Aw$^-f z@_7+1ipl$q6xu}&4~{fwBs@H%bl%r7lmNt=yuxDjFmqY`u1)So3yL=&MR*HRQV)EJe2Fc^*2aRAI5R)AkAn*xfdZiUON6N;M!5yJ4HE` z&c=S$7B10aryE*nh;!oM@Vm|nJzI0&xej87?t~f-@B9Z6RS6dwueqb&6G?E}+}V3G zwqkq=neot|t}t3_L@+5verFvMt@#mOstlf=t~~G1_46AVqj{@dKr*&-*&yIuBMzb) zd*-`ffR^dn3;J82 zLJ8k3U4*LeKGd5;l7bF1&lGi92QhjZWk}uN!8$Ob)}IavH$ckN6yD}PB`vMAdwCL%ls9NZR3>Vs+3AFaI$@Xy5+ob`~%+V$Th8}6^u~}8F0A% zT%<(ikx|sEKf5sy;nHIqw}n_9qs=$KakKtLxqJPShey1+KP8){{-Gl(+HNqrXgh3H z6QSzNoO>$+6X&^HF03G`zW3ekoiBeE{d$YuCO;f!> z6ui-#`1`uh({P_`*U>?wOhI8P{1`s1GZ=-{tGF;oebjLt@Yt{c)#i^^cFz9Vutx-GIJ|$^Q=VD8DO12EbcYL;<_Lf*9)<@3R3Qqf>VW%GgwGd z;O^b>djVH#N59yiZ;2lo+&t&a;AVgX3L%VN2$_O~kSSP*W6H3y*)@X$`)Jr#LOMwI z^W7Eq&r34*dg{Oi>p5>0B0gQCvJ!l+;}1F*u0w))_{z>X@jLm{2^(757^B4*b^)jA zn6`L)tq93s=tJr2RnL{a22&Qeb!z4NXK4uo*4{}qyb#X4zM?VaG?ZqD!)2U+uTmh@ z4GeFnb^dA|R#Y<ubaulE0VWXeO8T-tR30_%7)Vqtt-@`}o|EJ9x$0~OI2<3I< z8|Df#^0CI#hMrB|?QMnOhAgyJ<;KvPb z5|+U(bjFI(z_az2%aE#t;xuW9(N}49NO=iJbE2ysUhz&ejgXdFppWxrD#{7~pqmgY z^ZL5%vEGS8EIbGS|2|YEG^aG|8g#po3q_PPp)3>>f%6B?Hcp(*!aUnrX2=R*~BL&!TAzUq07`I<6xgubW$cEBDKTO1-*gf+tV#!O!I zAO46HZ|+5AZQahDm3R$2D}{W#AS<{GGabD(;!DX<`{Hl(ebr}|uFygs#*b*g0W*BQlIK9v?zNa_-19r)|Z9AxxhIEam>A49=Mv}Gc zCPKj1BVQ-n)gz~`)oFFT7W3wBuRd+)@dK6Akgfs^r(q4<6b-i_4HxRPmi->{Camkz zh71F0uXgvLd)nRbjgJMu7G5aie~UbN;mYa;Ps5elzbp%wanP;j7pHZqg_h%rh`_6p z2j3FE?7sZieNr>dcHjhwZ}Hp+1+&ypuAlhKX4rTJeQl! zQS>`)ln-lx(nxjHQGJ2)TvpqB_xtDSF9gXdGsE0{5|OysW7bsk6Lk{SxZ<1zb*Z^I z;-ZA?IYkL@`4L9&&w>TdXFF=2sktr=MOdXy1yHr$Poobgj2zKWhSL3=MNUvPD@j(2 zSc>npSKcpTE69Iw9v)S0buwydLX8_Dw;b;{pvYbo6LVwW69}?mujtTCqG`P`Q3VxH z;L0p(;nNE8hvn$oam^DwIQ=nxE{O;`nt4A6N+)>`O1I#FlmTgl+*+}GJ>Nry%{iB zqVQ(5b&|Rr?bzU@MJdm)YHLo-J+a_3|LKE-J+Xa(9FNs~u?n4imAdVgb%pMChw9wp zwozjwL-M>o4BGPk7)i|Ur}#NM>d+_(m4w!^wMJ)x>UpYCvaT(CKG@-n3-y=>`&wBwnRtJf-1bxLd7 zI+qu3u$eNcxvx~Qz`u)ddGLiwH4%QE~uJMs4U`y6N3M$iloWr=XKgz4t7e#Gi`#RjoTBWCj~y z27frf418e*<=nX*Ap1W&7R7DqyIs)kdH$?4x;4tQ8l}CpY5mMEV%L>v~l!-hb}6<8q~! z&Ps{(MX9xaQ@6cxB`SN)h$uFVbtw6IALoqQw<9fTI~{XNEtU3dD(O{oc`y5JY9P6` zc>de!o1uG#tGkqiSNCYfL9?nNQAp$wuSF|+@ue$bXBlm{b`aTEr!xF0{voAnT6a_< zU|C0m+vjIx_Wo?drog&nMAN*MocB9R4t!NE-XHG#G@JuRQC0`>>3x1=0YjLwnsDoHlVo9;i&!m{k)Agx4g|U7S z)QA@{;>@z(q?o-r*}-n#a#}oK84_5A0kVvODV{s?YE%Uwhjy|p<-95Fhs+2AR@Y3r zEUrmm4>>0e8qX~|l@w#7V{inw$FTjT;|2aCnPujlSxtnW4NHpWw-F8)lEcZioY;0t z8u0=X*Skit=8<4Z(n3p}IU#QIpT2q~T-%%e{FeQNf#$j4wpqPvl|~=2p$GlGCr72?z3UF?5BY@LPp?V69J;n7{pB}%WldEo z!fM}3DnjcKM%BO`cKS$MAi+}B_G$aWk2NfVQ^z-nj?Sz!sv@jkr|F*NBs?5>=#$a^S?jWuz2xL0Ch6J#wdU)b zaJ0zS99H!~zDcg-CHi<-VFmC_(&U+yyK4wOK_Lq`C-P0Sa(8i5^Gzt$6emrm0%ooI zeivf7g@DP>s5Rc*LHOumFf{E9{6jNSlwQ{W{=%z5++bJuR zNY`yIrljDQjskMKW(x19#-qiJf4YcooD5srGzk&`j7WkJXL9%tPZYGfOzmNY?&%QX zn1+cYlSz06eJ0hN_`wjb^hT!1v5HMKuVeV-S0937hI zalF!m<9N44WloikUpwJ{b37Wds|i)oO8Y9(&G1Y0tYzc%a}|l1OE-u}8TCbp(*1%wA61h~2+q6B8dX3Ae=IlS4+DgbjvYT8IsQyrb3ux49Z4TOi9btg zplL6h#Qe{kL?)cXf2rY&qIZuhEX}9+^|RW-KPcmSD!rG|a;&|gqsaR_ zU|+X|wX05D&kWUklCHHS&r+P;S1{oaazhFNQGvbQr+#jnS^W#t5gz@H)i zg2$zr6>uMmv{bo*%G55JpUC4ayS(@**7@Z;n9av}6n^kNte2|vgt}Z;kN3#}; zprYlP-%jBu@7(>0Fn7H1!O+A>xGBcAq%K53`%p}`fP$V)F=bij2MX_??~xU0{rNv% zO+1O5OEC@4%zZHkSF>3Zbri1VN>P*z!>=HpydP2N>I_Z9I{GkI#Mb#I!)4lPqPlJ+ zcV*L`4VKN^6u11`>X&5GLd4MVq&|88hK>u>BN7CG2+PBBOvtA9KY4!0re%Iq##3R` zQAD-Y*Il{*s`Xx7rMgh7(~;=rU#ND ztXCaPp5Ny5(`m~0<=5YbWS@51WWdc#D#Bg6?+*6iPYr(~r1_`Jmxwe^iBfD5jvkmL z0=w8=e0M&@(KIM^^V~;9xBHie)1HQBf>F%NWIv76(r&z<)4}~7ERYU@!&iwgCI8OG zU4x8=PmTpDQS#(ct5zp*+9YpI=-R&vv@)0V^J}&>i`tO9XoQPn&;FJ$$%tE%6E8Mrtj?wU$(W_49AZO=BDOTMMn z%}KJrTS*zReWBb;_F`I~z3l1^isRvl8U1hC*i)ISFfWK7GAtf-qBdBkNF#|<5^pw9 zi4^H`(Z~*t$<+~#iAHs0RFxXuzWn^^PpvB4U9t%(`%ZeVY8K&yw?lHK+pOWMk9l)X z;sb5T0%`;CpyMIm5~Fd>95=%I(t|6witqF9YgF?7?pO0u+;)MNx$wr}4S3DkQXTAc zo=N_u$uvrR5bpmnXsb~Z=};(i@&^h0F)#323UM^w>20Mn5KfU%bTQ@;E~z@0Y!BLl z^;T1F^oTbLm`(Rp`U(@1vb1t-n^i+^Xx*{}mjyQC=eai;uXjU@J=#UKy2Px6O<`K6 zs8o_49m|=F!%m}xVZB&STGT%@H=LFgsjg&yigp|RAUolh%!~F{-X(pE9mvCNkyK+5e2-^EUEPh9)0H-3ekY48(R~6udxC{k4&!n>gKw zs8pMJv+R03KUJ4-F_$sLJZ@AVT0HQJDyT~4cij< zgKPE0fa^yh z0{#sCXo~o``h;$m2IB*cM-obk(|B6xg*tTyVHGl1#n^5pFzcj0T2J<$iCC_*YcMiE z1aD|e+?{!{tIiqp`SwaqY2e_4XlpA(J63-l=HQFU@M+9k|Cxk4i+6x6x!>_13SfKIm1*Da`t4K8?2`}wRSyKky+}sy#m~v$&Qcsn$?ZpuWo5dYbw#h1stO@DCW0ic zPB(F`cQBPoHjjyPIFnhM>$yBfE7uYeXiH3>EonzRtQX_L)iHre#{|ll5Tna9F;5;l zKo4tzgd1jJSNbzNg|clb1T9c7&s7MNQyL<+vxv_<$e!wDo%gm!G!b{jSf$LzkL>uT z=8<70_K*Iq%X9#hIZ==401ypV$0uaKXXDD_%Zipz9#7>U9kfjBjmA1~GEYRuUnMPg zusMhsm>*#|)pQ{of{T+}|oNU! zd!6+S+}}5}cfaisXAo@XM|CFqz7!AcRKX`~dEsPw)f;(5c<_q2wqHqGPw=u$CGT@Z zFp^hO*=8VJuR=LyAYDVn$7;W_KG^p~9y|bohb0l9Z)A>mSM{>=>PsOdAGCLBM-iPa zx#d5IX)QHOYpJ1EG?MXKe|0|cf?yqpaD>$J93M2GdN-CL|O!T!tIXc?g|O(bbDzgFy+4Usqg9#<8`FP zeyJcQ(uw}5ASY5TEmi82xvuD3=DNEEc+gt39~Y-QH3qMNXj>ICdd;@N_k0H%{X0zz zgIpS3AgU$-TL=6>R80bd7hPT*_mZK0#2r%>$)GISb%c(lCJmz}I`po*`m9w&VkYe} zUPpvYLxfF3#Le+Me^x&)d+^xxEUkid&CjbyVrxzP0-SbH;#^rNYIH!Yuvo-35FB5g z!lUHd_`K&gxd`g|f^T)f(! zwJq7V<>gkoQo^!)5)d`ei7uOGV`m|ON~ycq3ESLP zY{PIk@FM|K@lTN@#j811Y)kfgZf50HQHbHvgz$r#42DQ-H9XkWgS@~WK44Ba+AE?N zg=)UO=JZ*a9$BuS(jy2@S0;np^O)=dbN3PO4_-$2g;|79Bm(cS7dGQedT6VZCXKY8 z8%Gg(!3!6nX#uOroO?19ua#S)QJnkS`l07CP)AOyjpwIS+O6Dxi=pB8#tWPI(@*RdhwkDFJ#Yo61!5 zP!QX$=%HokU3>Len>~^i!^vf#Y@~<*5?U^Uc4bZq2kkyO`Yrt*zL&^xyoEZPS$8Xp6iOv^rEvLn4fM#`{Xg5g?2ip(F zN!?#3))hR1KboR~s9|$U!D6j8s`SGC@PI!+yCq5se$TB$ zjh!-<#~$?N-izavR9#h%rFQG;cO&p$06@+y06E7Xkh2ut$L=LFj0ThkFYG@T0GRVZ zl>V!?$hWA4pRp4qTY;Zlz< zO1lNY!=G7sI1RvVtpmS(g!%e2YdS3E-RVF<>v{DF7Y?&p@^=m#7YSJ2YdA@! z+X40MB;fN~_QqRr=EwS+#&D-3z3NZ#9JTG5mGuss`FDENbN_~oyc`=j(gPVec5kHU zlzQ>8hR+}m{fv6g#nE>}St!<37v$q@B)@kX34Dm_2fEx6t-9To!aeM`^P_Geb`RfK zr~vxdE|zLap>{vv>YMo-a9y-og5#=pC$1m>hU>vXqXRRqcwn2|ref#!bu% zXtK?MG@n8Fgp}9v3CNS~sAT^O&C%gU5iRR9(Lem>3faR<%c(h;p?f?XC1y-EB?+wb z3=$>t`^$h_=VlD{qVL3NCHp7cR$94#Z%uJH+SQr@kPR-A(QTcUkVdQu0DV3Xpf-Cv zG|;wLvoa%BKzvjXBHx_%FsWcl=VrL$PF&j6^R#whvWuR%JL>5(+ctlK!Me3?rWPH~ zom+TZgo3vnn=!O-Guu+m2grDIvY$Z4G5ULieGOuhBmMIv0kGQv^P~ZYb|cF+Cph)> z#p}@NW*8=#u=*2B)GQ%Q&dZIy!^_P_0o;VuD1e)g2I(!F)Hi3rYqd2`NYj^Z7RJK1 z{TYWzEeF@biG5l|IMn(Gxgked9~DDTgxzf|I7rw}z&A52H1=>)yAG%<&m)WjM>Ap> zUDb!Sa;qmL67Set1$f@Z$p2Ra-e>0Cse0GUNXdT5SczYpZXx@Dn>77X8Fy>nh?B5{ z#BTu z5d4q@_@OP}hdn5w`-YtScCZGnmYgvDjNQoVaL!s1C&9yl5b8SQj6*W}bGB>|*isj# zF5tu}Z!xcX?J;*+;-@zYPi-p*I^GMPscuKnSuq9$iWE>_ZuND5mGGZIb%9sw)#z*} z>)?Pk29TYLf$UriWM=|64~R|mr{MesVN|)K-?rk;AgiYC5(I!)ui+0U5fWAHJ}b4( z>ar+G*_`?*oTr%S+Jd4Gwk9ga98FY?g;6dASy5ALs*WA z!Io4H6t)aBHLoL)bv}dWn+Z}%`+QB6{_r)efhYj7LihtK{K@MP78?3IO0Mr&RMxWQ zXk7Rwcs`)3Qme~-urGg(13=Ki{iWv69|L_hN7c4;xA)^$IMF^6yI6Xx`|^a7Nkva; z!R4Hjd=;0na?Zv2^l@=im(wXyB zwjNOuCr#JSwbD0YuG}F2IPqgp85-s5R7hmP?4Jc8@{O?Kjv_$3;2$+Eokc|QhBC=D zlSF#p*6Nyh4b1>74h(XBKM%%4}G>Zcd00nDDIm9xD0 zdB{zz!sUoNngE}_*qcJ4Y&{RQDDOIIixPK_+M+ARY|)(SCGuWRhC`U$AC+ZWGsARiDWEjeK%fRw=j$r^Ah9qrzFN99yKTMp{h;JlFamZ?6aDFMpM;a z9WHzm;_zSs%lRwv^qmMoF;Kee>EP%cpk58B_8w#h?)-z)i^Ljv&qBbE_E{X7u?t@1 zZX3fnNDF^r)ddJr+1?lzi!&~(x}fj5bsEij%e2$-ouEX+rgZKEC2Gu_>)B(Bi%iz? z*wmh+wln5WaeMHgl81q}J;>{B6`ulk)3`V)8O~mO>UQ%QCDJS0zP;vY-Ql(`aQhCd z3(+}?ZupSvbv0wm?S3Xn)HV)!*wdXB0*woc=Oc{^Cn_a_%Un2-c38jhh|$3O+7Q*U zKTyF9VtE*$EguFAaz^^1w+>hMmvzK^@otLu${*?{&GetJ!}OOUGneU4*s)>y{Oj`a!&)31fez9)$ zvQ-oAtvwN(U4E7H@Hn@8c&6TjdkJ4WoxNLsWt-%9o^Wr+FIS9adW&k0r^zG#g$RvUNHo5DZv4xwIm?I>?w$PN>8xde6Yl-+%Yw-> z=X~ih|Hpgw?*ERBaZB*|cXacg{r!jX+w>pd{0AE8-?1@|_0#@yvp=gj|2EEMV|AIaFz0BeNIh*tU*yjBOW86}-sYw1m z%3}Y&Y4`quD|06U|3Awk`k%MI9siNv&!IJc;r9O}`Sq>;zsFtwA10gth5aiWw&4DMxW6O$w94aM6W)b)vI2&?(nj8Mjt@U58vOP0@W6xT z(Z}C!9hN5!zZai=ePQH%^wuHH)dBJG;r`?Ax@Q0o{mxmt=>3C{H+x2!FN_RV93NUX zbm^+^$iT?k{E^pjBL=0;!v-VoJ4d=k-nTUtCJaPtkMyODyh+1MG{eDQ?Ij3*1(U4SCv~fiC{rmeP2}NEbO~+$LZg+EDwl9kskwm;Vjyk>| zEHNPTdcf+7Bi9EyVce1IV|0V}p3S=xy_R-IkBG&0wHphQN7^cmziVUp*P1P7gD>}$oV2p>5KAgEyGD5lqrP?&=;x>$IMBGOa|NQn6s-!@83zFZW)p&>4Y$4c_G{|8mMjt}Fjk z^li-rkM!PmbNu5oY_GcIl<@1LXfe*BB}b5@Y_q5TeD7x8veOUiy6n7yHm;1m-FN{; z+hF|V&Ay)=9iRqIA<}KOpGx(`IE{klftT63zYANu4s|x4ohzi?T8dcYSwLSJ2Y&B))1Q z>2mKd5jh%rIGUT%Zeef{%vjaR9;SGJ8k4D-=k9RySXB*jIs?npc8D~zjj~Gzax`Ul zPkZ{a6c~20tNiw?(z=s#RVh`HFK47F*(Y{=Shb*4W#z{+H1he9|MvZq9D-^T!Obnr&Y$Vlblwct_V$W?e>;MF;k7RaFjuCu8y8>1MCM9>xmqK0 zjp3-uP8n)0XrpQcGeaZwUe`Jb@@_zvcKI*4=jP71c=O`(KP-1zZ8lpMIk#$X%?zUi z<@|^F=Sp!Vvm)oth}OD%vz202q-3>uf0Ft2Bf&1pYEcX4gpi77z3fQj#03TC)j7G_ zz7yAK1+w!!f;PB33nOjJo|k=InpNZh1)Jp7@}ut`=tg>Ju|og8Yt4c5GRLW+`diOpLU(z1 z{?zrjcwTNl z4{9YX@FlsK@mg~C&fWbj`}b2%Ld;g?xY5fRCc#YR#)j@{qyF@_vf{Z-RMX{cc8l5% zJRS1BB5ru18XIcb>PeczKGIg^`F^pk$|5BrSlNR5^NIik~O|RV5HMq~|?DjbxT3QKr%`fV_QQ73p)={zy zyQ|rqdid74<+b)Vvp6fDn-GsyIqj|ejp+|oRypi2Ir~+zhgRx>v!oD{=C9OY;skAD=Jgg;EB!?^ zR=(?sH`Z6v^@V5g{J0lQ8#%?-cH@+y%by3Q$5PC4hVQ!x%{JJq!rQn>yQu?(BYooF zZw3tTB>7FjH${^~&u-m9Hp%NJCuEbn@L#v@O>KPHyoQs1Egb2lA-DwTrsKY!=ul%; zhpVQ+8|e*&6gA}_v3}C-D{v6pm_{<#0iI@>HG@5$S2D5yg7kkLbw#IihX5Rzw{!CM`EN zIDpbHB#$WQxGxmJ4*P#ap}-FNOURT;3np?M!kO$^H?tN`2Wpwo+$K+atJzD>sXJqi zR+*Z3u^(5FG(zMw|L^Sln*u3Xsww%u3UEsJuzd60%)63O$=1d$X{TSf)v0_-0ZtP3 zs6Jc<69v(X$+C_KD5ECrB2!kTV=bPC8z-Yfx5eC1$SxSSp1w)Wih7eW5Kb4g~R;gu;oo0c~Ayym{x{J9x<-Y^g3 zW=avctIzeb9Xjhx(PwvQBd*a>YzZGh{9zxDK5Ak2cZ2>7tNDv61AT@**0#aQIqM<0AP*ji}5~Kw}Rho2^79bQ62+~yq1jPN$ z4g2o5?z?|1KNoV(otg8@GtbOPa;1wZQVCnD9E+y&Gf*I#%9uT}moxL4n0C@0F}kLd zbg$kPHOmsMwxrpG7uScwXLH#*?cEFQw8HY!{q4$@K8mDg$a@OC7>tU~=|pF$^t*C? zripBOLh2b;@6zdtr$OCf1|>2^NQx3JzryG)0laM)1i75Q-vk7?jM-%dAKjnz^;rLE zUFFIHG_;QY>0D@?L4NRn-u8qqx%6q~QSRFMcwxrREEO@H~LCp zg766T=EWZs#>xBRzl!fX`NnK>o-gM=w=2qS{!nO7Y#XIYN3Juqcs{r>SM{gdxZg;x znNI15k&ny9_U6v_`o!K|o=;<}^P|!D&)J*d;$%uBrE+@JUH^~b%9E@T#bOFT^8o)l zG=%1nep=$Zg=leU@ae!>yYaQSU;Q1N$tWgyQSaq?V+j;(|LsgD+Wr=Pm*dx;SY6pr zYQwrYTDCW26e*@rS$y1-sse(1cbM2bZcIm&$Pa4(Yvhu9nb<}1mn)6ETWid+*I>># zPu=`uYU8Svj|TXSL`uaW0tCe2a0;1Z-}Y%2uBbv>;7xkIcly`f2-3Q9JFSBMPK8Gx z1jFH103TwF!*Mgl9y))#6p$JH`~W;L9HW9iJp)BKk>A3!D6r0}Gbu?aLf3j;XBxz0 zxwnJKXzRR-WkKkIs)IFvpslNgwSl=dft^!iNab4y95Og1KCWKjj z%RFS<9199eNRm0WHmmO(SZDO<>5LNZwr+F8W9I&g90Cz+uG+tw%~ksq3C|51#wH1M ztx!n-7brEvuv zJ}O{}0Y#5%|2Zlsdiz|RFUg1Coj(C2?+Q7>0A}4gO~h^?8B-M4Y850rRZxiTDIx9C2ePX(IgddZy@Vv!ILp+srZ)l`-X1(+ygD7U!{f4itcC#dw$FL z?6%>gtRU~9pp}iYw^o>1`2@+lAl8Sg`N;*#Me>CutZyRAi^_}OF|#jt3S6~&JHuo% zzcw zl9Qus1|AuoQ=JrxlXpv6fU?$SoM^``sSPqvNfqaM@#Sq#PDN7QZ3`7p#>)765rCRI zhRdu-?BZjX;698SQxY-lH;l0|i_J3abGbM_yyxk^2@Sx~o;stNpMqj~hyRiq-Jn4K zB{gV)Z@gw*xqplOPDWl`@Grq9CPEzVKvCK3OeY zQt%s_U$fdEe$7U*_>NKP3Q}acD`T7UCu9~k%Jl_MU+z0;O~;^qUMyt0s+~mU?^6wy zn8K+Bh9esDgt~9!@s~knt+7Z-A>1viO+hqws^JjN>AN=SSK9UvvmOY&tzs|YI;;JX zImpHl62j55EsKJZB;z$=&oy4yzr=TRPz>)e-Pf6ENV>HdMvet!+1CluE!qsRG*YAB zk$$5#9Dd_@-BM3W;`}O3{_ZM{{;_2L>OryN3u9MRhw6C7-H{@5pW?i0<6czma!_FT z0g?CqzH8q{P(musYXZg9)-S#G;P_HCqPza8h(Pa@z@3E-q$-v+TGYE|q-ZjYQO?vz zuU=`NvoDd57%p+MP$c_0Wytwjh>6C1wX^me{o2cH)byTD`Z-rNmQo6tCt0PXozFH5 z4V!1JFj;L{=@>=-TRpS(2as*$1I8Cr(95Yhw;8turU+6+QjCf+FRX*b4MYEBrmV~$ ztT^PX{Z1UIRA%@jX>G4N=Wns@CeQFY%)d{CI*jsIx>{7Wxq4tegH?-_UfyEa5DUt3 z?tV2EI6o;7QLZgk`#$>v$*Hkt*Be47kk-2tOLj(YH2V6OsTl}NZ%6POk$3QYpQ>;; z>GvbxfT^dR)xGg@2LRgFcZOvFXkQzMr^jzHvgS7OQ^7Al)E+L7wxn^VzHFu!kX(Az z)36MG^k%^7TvCD&bK!!Wk0R9{sFTqe`y<8XyzvV^N^+iySiT{M#=)IrP-aO}RXF{d ztNDBXj)sn^PIDm-fpqXD!}FbmYO!JL#_E6~aqlb97@7iczQIqGnv#`0g&>wQ`qFbDB)&xP4stOFLh#$xY9H+86 zxQ=RX<^{`?oDv zVIP@`}Q{942x-Ku0e*($MA+4<%%H8S!- z!K4s}uT86*o1IXHOi_)v03nf))l)n3EI&B#8CI%*`o63V}g@_%BzD+^h@Su0KumynsfzMOq6)@bY6d0qCkm`!St)y4wORtPWo53WaAk_W0snR^yiKg^g*2u*TZ zyef|i6=OXTS10G-!;R{T%(JOSY^d5m*FEd1^)5LmyCQeBM;ArTG%17%HvvPbFRF|hZT&bpzr7$jmV*~z>6(2 zu8gxg%a{!!_)@3F`o$OS;bA@RCDIPwOJa#r8mDlL7YzgqzKrLmVx--^6ju>T4es4m z70G|?fs=&P+KCe-ug~jC?<(!NOVlur4!YQab+?bC_;^h3b43(7aV;D>MtKbwY*%Sp z(kBX!XvEj^bNp^M4#?els(!6t(|$_*lf46|_3vM)CxnW<_XRmT=UXJ72;&u)?b-RJ zZPtzRa&)nAVr4LZarRS1jVob$h4rbI!wv8C4m-?=xKF>; zLw0ZxbO}GV;w#JerkR&?6(?1X2?q*|noxj}st-GFz++J8>UP%PrKk~iUVl)Mmf)?V z;83esmjjVq1Hhpo;7|vR@H)LSi4GWQC_RdKJxQ8GKX02RUm5}$y8Flc6VE2zl(b)3 zGi>`6KP5(lF&Ask?pUmKe}`?K7c@>}*1b?D4FQeeePiP(zGr(JqB-2RZ*6?aydcp- z;YQ+yB8kCsm)6vx$bzu6$5?vnO z1v=ce`D5G^I*2HX)|TMz6aVOi?o%zN3%3u8fR0_yzF~za%ki2i3zblR(6O(4${wD- zLG&o4*k@K5cg%GzL#@SL1IjyjQRo#mLk0;2S&!0my?NxGEuPsU=ks*GdBN}{#E#=~ zU|WV>?oSN;4d?2z8yD`vi`T$9LM`%M9Q$&-E!Hvf7?N5pE?`h7TbcUxZKB%wVw;K( z^d3J)XaIKOyd3Z2!QuWBgM4P6EL|P1J8#!`NCMD-g;c~>We%UX!d`n1EGvhve&nFWhCgd z&kJ!#1MJ@4rTDfx5sB9uB*Zq{jlCfjI-aJ%0r7>O8MlD(-BVUojJN zdu@Aiq(8KCEznlN1_ zb^WS3<@7w3$yIFp_E$WBIzXBAl6@b$fF&xXw)c?EcIYNefA>vlc5$qA-1n16cN|vR zEcC3fMsuv&fsG;D*p%UY?AH)BA5V##FF-)kO@zHkLz{xFjN~}nULq|4R%F*0gRtj( zqfA%u&h%>Q@Kv#&^nR1a^RWWmQ-&IReN^FdR&&>vCb!u?DKSQG z@MulWBRM)^fYc?eIyIdT%RF9W{8swE4$RvhDS#@lb7{d1(ZE_}t*4<*hnX^{n@v<- z?w@PkQcP3J{9!Y(vyo5)mk;I)x4M`Ev6JGz*MQui>0!98Gu64FV?TRX+xFL=SYnpt z^e~orKFavr>DTi07|j-P@2dxZZCK9osh&Ob#xoyOU98s0;$B!Qjc+*|2NVyA0}OSsG9tP0B)&|o&CP04n! zM3Jfux~|WPsV7(Eu41B&33!z#$-`4#n_wtto76n(sO12{PfoFwFj=*(N$Pv#OlriZYz zQ7B2qRdQt@H+QQDUEx-+pey8?z zFgCoMnj#G{%2!;y#MvwS(Tc9Pi$j~7ZLNuvkOvi6)dZtzvN33Zso!5C|( zFvO#^ClhdcbdLGSgewin5-5jz;A3d0@4g?Ks5a`WPS>x8?F)N!M_N|usZf{>Y|81b z_){DWH8f!=Ey2Okh$1H(OK=Xnt`1`!M%uuV%5~kQFYg{Hq{;Y=mwhzRe|7ZOQSR-w z_Se<4jz+>exL3{9{72BAm1~F|1j&<8n1(iEliBUux&3{_!{q*L;B)`EN(enS0p1ki z-hUXaVj1cn$%I!!ckY=4cRrdp^X1N7)IK6%;5zYZ3BT4zsq5E9k9Roo!z2s_IW_2h>f!)_Yk1`ze*mu8knP2QcU*XkGrJDH(g!xx?sM#oR+i1S z#->*ZM~}*G9~Y~AXyWmd$oMcYP9r`Bp=!Mah3dhB$^gh+W2^So*)uXVzqaf`rsr$J zzf>Q~QH%&RY}gSNc}H4W%6?ZP^8O*{$yfQ^E1}N~@A6(+`_us6WnUF=MG&qXT!r@N z%T1JoOW^#_0>)TM6n{e+GnxbsVjwBN1n>noFNe|rnl2&&A&P?QI zzK%ivr^eh4t_0E*@QJ-cyk>v2EH_?_e022A-{Ys1oKr#=9BJ`7>|*CR7OJK1f}=lI z*KBjfQO4#xv-)=+D@E_hmeO3t(~#1?*xtOZzb}k*=QGa@&0HlUcDA@Gc3QZUmOnO1sDApXb#Re6!QQMbvJ~D`DO$2e-a}Z zb5VFXf7Ie($7uRDNy_MS?fM9fiXZ9+~!LqD}b_Vqa)_ z5OmSK|JX-;3U!G_?BswgnOjN-Pv?R&ach+S^SkI?niYe2Sy(q&La1OMjp@ObvCo|SP1$9vi zzeJITw!_jrFUw`Cr1LI}JeDCRA9I=o$rZ~K!cB^7ZldgmZz%wRIOlc1_{m!XUDb@Y z2B)+J`w$oY*m+Xyt6Ia$865KCsA2OtFDvP`U}0GKZXF4)113-2;(A|}#yh-Ts-7zY zMm~J2n^XE)$*H`A4vd7ap4yo+B;(X<^fIre=BYy1hsiSyjc!Dp$f@aYR0FMvGq}mO zN}4yyWa7jrdeiwUmxM~?-_#2^Jow-TNMqvu$KH?pu!5%ZI^YlbiB~2vsn(I+o5aqF zph%%kB!b+6i;U-pTynOP5MH~7?J*~D>VJFBms;5~0NAbjqBu#_?%|T3efhK~^8 zX;v&+o~h!-qcT;}h0&P_9hb;{2!2QnH++^)h9Ly3X_3ce-A>EC=5ack*~EM_9X>8p zp&9WHLhRNf(|ib~M9X1`fC8cuI7EFCVAqbzprlf!zh%UFw+-px0jOFMd-aM85)Hd5 z(TSX5js^yQdbrsfDwYxJtLGG&(F%gRrqzMSp#S7y+{%j3m(n322hoMC&B8GL+APJ4 z|8)De(NV73#JWXqtgW3d(21QAqliDf;7b0UU_DvcmB^`^>uKZEz7xRG*2!R_pRc5t zwT(MB`6@V&Bwm{w>PmF#N{1`niE(nG)W`I-sAZHmR}`bg^svC6mh(DaREOKHn*xR( znO4|Yag+H<|0wvH^=EN;rA+_Ehx_*Zoh!x0)Ck3X6%lB}j3c=Ez7qk8#`$*23rgzd zCsoT62eQ%&KY1jWHT7Ibv_$&R3}&WbrWbdkr+3=d(=5X^X(I>R z=Vey#vby_?;b2L$3Z;m(EeessG_%m)w2H0JKC3yASIcKpu05Ll5Y~Ys3qmGc>o9~x zIFXMp754(4tgcD!;O(>gW)lojfdixh45WgwQYx%>4O~8!E->;cf%;An4*ebY3IXkf zPPajWHeJkk%s0_xd8MMxxuK#CBolZ=Pf{c1$|3OMdbxouRtdqdj}Cv{ddWUGN$={L zVjjZxN*=p-h13*zsh_Ia!zH=iBdxAh`z2xVb-o7jyis1_1}?eu=Xd+M?yH$j@uxm1 zkt1hVv^WaOa29 ze1R{7&`PCg|GgNcl$i<+vaXOzM?Y91Mn25f@*21lnJ=bWM>>O z;Prh*0$(PcRv}>cQ^pE)^juYSwcdXbE)lY%;tUFbd1C)n{H2|gjJ>F=4n=iAtP}bo zc(mdRHZtw%MLrX6GWe%x-b|%k1R8 znVsz2W@4xsq>Mv+kFg%B1Q+S%y4xs2iRrH1n**V_7CaL8zi75F{C_lq+kz*QAFnZC za^x2xhJy1^Wt_S>?z~UT$0V|k2Ir^lL=4HRAL8)2GtCph4!C)6#SS6We9T?2LW3 zqcgVRQv=89shnpBpG#V5rVHD;&zn|1DEfl&O_^H_xY%;e1Nmk;#yi>YnNRZEplA$b z*RG%SSmuWTr;X+>(eIl*d4ZHWAw2C26=DOZ5O?2y00r?$ubh~%;?bV$QCCzN%h z8*^PflKambAF|=I=>p|(a?WHd!DdhlDLr4j8L+1NDFEbmp1Zkp`%Ym~rP2i2gCi7o z@bwrwMNP__%6qULR*LPxJi?x}id)I36)~NeB0~T-HX=RaF(NIMI{|uW0`w9I+|V>U zdkLbKL&{$75EN@ZHuc`G~Tmnh~h@p=c{ zJ%AuxxMaK=16b%6Ufu+W_k|CNY=Sd&C~pIv+7*(AOdjTTshh;YGJrNe_x|or$qeu4 zF(#LyFbI=2Yz`f0`%GF7*l-xr+&SJh_e1NH{O$^(fp`fVmxCgK?_K_v)*>eZ?N-|3 zeCcvKpkrxD2B2f>5f-hd?`_bx6o~`V&R;jr7DeP}$@3gawm0#D^3h+&08W#n2 zcP*OrxeavhDojrK@v)(&Cs$v-#IGU~&FSn66;CI5dEO_O$)UtSzCmJ3x5YC%mc_Fa zw`6sb4(D8ws6n=;6%ybo-LqTKAjcDlqUe#GVVSw;$(&qp0Lj|~)xF8eTmX!qJISPv zph>IcoJiI*WjA<#yb7@LFAPn3Tf_I0?gGtWxuZde@15^VF%qh6HVy19+1Z8{;Ho&6 z7EB|m^m=^uJ=;vRbv_ONjzMuBwt%RP?Ci?hF6U(DX;$90ZqoE$r()jas@WAUdEimt zElO?hsn~ZI9phN;R!52KQ?cB+1}Sd$)rC9YFTitepfdVlNak-TCSx9(73Mt>#JOtr z`G_k>_pxG`L{1&5yX!F=m$>;@5BNX*Z1>v#R&dR~L0pskMebb(bK_-aRA7Il=oVda zZ_#D`pLA*P7hN)czI2IwX=x{MlPM8EskPM63$FORhr{Pm!`T2X@oQt$L&Pg(ocdYr z?Cg369}4Dq;r=JeAJt;pY;nt-jJM@Af7FbO5RFb^FB>-Jxm$5Tq*=Bb*bfAGEl#Vr zG=5*J1#4d@Hd$TMu%(}?QMdcikSrY1sCPA8NyQV|UVSM7?CJsk(&Hj0JFXKzo=QJW3>nND+;W-*do2etsfM&=ByACQ7f z>3vc}7VC=WftrBx9eH@?#{f4y$}irq_+SMc^z#bc>0&++NxuSeNwM{FS?*lzucrGg z3Hj%gHFeBF3#kB+LI5JAi!L%}q8Q?(G5zL-JxLbn2f2t>KjH#GhXq_D0TfF|)a?;x7QTfCbWU$dz>X@^!W`M9NOy|z?s zT9Q*&6w}Pi&2EdinxxN{u21>9o{Sp_`bv4Cw%#~PXVc!w5JY>5C7JstLz`NMgtE}X z?257N29y*+Q|Mv+XmtAHO>I#`3h*k0nCs zfy=i~I2wSS&(mrcKn$i_umI}vVYIx9dlRYg-AXPk(Qgc@-zyE+2{`kQc zXnXpIO6jtFV!7>lf>Yn(AUkK_$C3Wnpz4*Cg;`I3Tl1X$1Xe8rJ{+8GQqHME@!~ZJ z>tej^>ti*v4yw)aKZbhmJ;OUQxyx}~H?ep|wj*jmop_b*)OGl_{So?J(1acGz2{Ud z@0;j0>0vSP8|Wn471=;zv4PgeNiy}fi- zcL4T_+-OU8yz}J=Ya__frS{;j--e}bJNN<3fVWr4TfUPM@abBES>(4?SvS&2U)fYp zCvRI7{>YdOe<4&j@#-hy7wYJ8LC_Yxd7~aDB3krtCZ&g{L^E`g#IiznkU zb)$2Kc66op(sm(n*g_K~F>L_t`vMF(27wK^$=7hehMb{mII=Z*@|i>O96Ss1N*`G*-(xY%bf_!NQ3X6y%h-iCN#{K)G2MOXrXu4|LYqCt+4k_K@qq@`S(#9y3HBEGq4inLZF@%npq_tfRZu6alwv1Kp32hlG?n(FO03EmIfdY_|!;q6hM~D1< z-;RmTriX*B6_H}$E^A;pC^M=@ssS9NeI18+N}IQ`bpCkN`@^a>z9yS>4V*os;f?*=qzp-}xP@bX4PeX*3skWQ)9k)a{>NHInNIkW z*sJ5Er5VRz%r4Njg?DqfOPr!N(s!207oV3i#MJIi`#DYkaU&w6nff`%>HAy#=;-7wCdiZM$UM&y=g6W7deU$Z?}FgM1lcRb~4Hz zn&M1W4ziQ~zV3fTwK;HyQri6|LsGUFvX9M>nT`qHM6#$JpdlcCwNH{uY4XibfX5J0vTKz1mE>@V`gmgotp2k{`C zQ~!)7Grd`Jfe%J$vec0lQUoSVh=R68bAnfYd_F4cvv)2{%SueM16#?iatb5tD%V(> zj__p9$xyc-Hzq1+kQ)=3>4~2t=v)&~v|$PGTu~7t=6vz6x2o8nD_h3m6xlMC#^f86 zNO}w2rX@$pBeDB8y5d#Ar*A;P{nLJh0m=g#gV?3-HLI&T|3aHhhJ!LtI-ntvEy!xXc z5R2Y}3l%9m;C0p4#*3?yfcW%q9mR3saFT1SHNx zoQ8LJ{{I?i-0Cn~YZPh_lqrh<@8o2rkA((vs+r(C3N?w!FBTy!)Itwb>`veN45PR_ zECImDnYrlQ-0efAZMep=V-dO)3+OH&7LO`}4*B+7lz}<|&5oIh0a1f9o>t&CP^bB4 z$JHcF0HG+iD6#Y*^AI2}CW^~}7ZRSX!@!GYFy)d3cFrE;;0L3UBg&-<_K9-S4Fv8c zk@*TssX%abwMEG=xSAb<$*mZ8vSaXUc%lb{1jq{Q(XCRn;hL$-ZN;`9?4|m2MXa0e zx@)iZDCO|i;ec<(ksD9$3$6b0NNeF9$DuX&AhF4MBqeIKSFHLf$J??4`k5Z%F*$Mz z{IHzHKpjE8QUmkC+1aJ@*648P7_8>rx!p&@r*bM#OhT#N6`v)*Mf=GWYk-U1^bMom z_4SQU#V_9)37n{gk|lS+J{cs72SM>9NEY#EQ6BnEAV*-z8T07sNhh!hu2k=>H&{h$ zKNea==nZXal{fJ_{|an`bH%YUAg~x_dk6?@Yr4qew3~tZC)w<(Whe%@*aBP}pd5|? zF4{!awYXjYP%E%2MHL64C*Bq&K{{M>pdC!qB5hk;X}a9hCUG`S#q3JIh#L)11|=#` zcfsqd&v{-OXx}Z&t4y1t5ow)7fkE%3JA1Vv94pqewa$6EFhSO+M_Nd=c*X0{3v@+{ zCwvFNy_uB5#as6t+`2ao+`ELvY$aB|8raC zwzk#ozuQ__?E3m_cZfx6xP!%Mt*2SDXg8l>=Sz(C5Kv$8W?9>#fYSsEEsH~I({@@x zEg&M^TM;S$Ga>{Kkt-8Npt;UO0@Wh&&n2`N?ZNplI_LD~iW@&Vz6QmZvLwz{9RTN~ zExRA1l3|amt%QS`&v|gSd3t}@o!JD>9#N7IGTQ&sOdFj4;b;v-lQd%McQ~tL0Hfmx zljXLi9MI3Uv4}Uwvq8${>Lgv&>g&V)>!Ih2^Rl;S3Hqin7}&zP!G{1&El=WjP1+{s zfm8{~B6p|iDfk2l*dLK8$!BfrwtTN(kaVTHvKpKcu(p*tbrB~*(KjXXNT9vyepZ!G zYaW^Pl9u3yx3m=N>#eMXrbc+18|-%IvU?7Ezd_-FxpAqYwjA(TfrKlpu*O8djWSaT zeV~sKwk{T$EuC}PF4lb%Nq=WUjPZTiVqP_TJ|8xW2i(FcZUODN1m4vS$2I?Ebhcc{ zWctO~lW#}_Lvad_7%C1ieV7+QeafZ9_8YXSp*<~mcz&Hhb7qM0@5P=0t0#eI^lx$m0- zrm9{B26O4qEE#;6v9aZej%G?e5QplSaa};m!{i0ap(#vd8Y`{~Fn$#i=bQm^LQq~6 zcMZh2@WJZ{;w@WHk zuiP<~lqK{e&ij81e}AH!(;7hlrxG*ZRH6r*N*IGviGrTc5AM1P*@5Rf5Cq0GEgjI@ zMVC8$7}+nm_^{Ov=JPc?Z0l$uNz~By%C?skI>qaMBx}oa zlv{|cpY{B>Qc)L4x@rWRUYCn!W`%V>1~T~a@I4-3LTgXPfef5lw0(T}bn735%eZkp zqx2rx*x^LUURn?NyYW=)FxZeB?p9Z@AvsCTNbvsfrZE84t{gk4kWXh8G6gLcs(?ID z$zKGj(YSn?|4e{R2V^7sc()Hic6qpid7wFE=YeMWrv|;Oq~bhYG}Q71ci<{XnG$Pj$;(+w>|>%C0pu-&ENrBM`S?xB z&c|=SiYi&K5wKzkp3@EMxbZRB+y@L!2(HO;ln&o;NV9c_BhU2Eb3UOngG&!@T`s{S zFNN9=IuMZ5`rD-AD5_FEq`2Wb_^3!1$+sGcn2Mkhn?3R1@VCuils0jAwUJ+cPDK#~ zYc0;b78Epm(Rhkv?h!xVyQWnD&Luy9c%^V#cz}4NB(0+wrrq_PRcKi-xr~TjA zOi`l5W(xCUHdFL{068`M(jKfcO^rK@3`H#Ud^m!1qqJ{LV9b-*lmqS$CNP(!X09b4 zARI3L#!d(DH;@iUalH$<)he3)`N{4T-5)^rZV5JQ3qwMQ4*JNWW z|29HU8}gwArYbgi4SZ4~1?XiJpqB|iFV8}=Xs8pMt<2j`SbsVH#smDl5w1Q3#?l=I z+*#dptVuC=b;HLYIVZgoXmrJ$a#EU5X8TkHgLD~HmfYdf0r)zldj{&WI_Lz@XPvB( zTXxq!@yPdLOP;6mF%W(edd|Kqq;me=DF9V^&ffSo^Ur@2t-78sJZI1v>0;YjD`dLAS-S|b%Xg?-b8ZSH5&(t9HPq6GVr`rf2X=ai4|+YR`}{l)bxud55Ah?;}!SCe=?(P7LEh z8pX6G&9#&m>4#8M#@%~QqD&T?UrVFFk7e3UMr-l=^@JlsL%pVx$8EP>kPSC=d41`M zE__upb&w^)6o2`+?mCIw_x_YrTAQW3($ltO759V2QEh44 zk7rV;t*VXXnEV~P1+Ussuid@(JnH6xuDU^1XS(6oN!?(!H6njn^E=xbl3Z?!C9G@& z{oaqnfjNo1leDp3Ug?n6x(s(eco;QFgemQT>rPT7dT$+@%St&B@><3e_v+GhO%hh_ z{qw7Wt(ekZrYic{kTVKjxtA*rOeis1FqywF-pIXYrAjQ_5yV&R61cA!OSjp+|E^vX z9kHv|YFEW?lO9LU;d{3U?9h&(YyYyJ4_4Sl;B=?zzGxXDykjyfD_WRTlFR}4t8fD8 z@jlWl?ENX>+%_1e`$3baHp`u5KZe4l>!PLK>SQ!w$p4v2R7h)E=3vLga;K6_NAFJ0 zWSpG@^7q+$9PYN8kJg%Q*-%Y^$JsKb=U##E%B-e8f3V_}w7DsDjg`BpxF_r^KKuv2 z9Q-C}c4ZV3tv!5WVWwu8_D5gq*U|OoKbY4RYr^mU;Jqe2Yg-!d`wz4_qIu{? zxbMY%adhWRu5G7VFfV@W3g<9ml`ktY(y!Vr&G@DBzZ}Z=sakH)Zp>TM{?cfDd z*1^L_*1>}otb-;IZI>NINRmsstjizI6j~QVwmebZ(HKp~4&IUp(GEu7_lW(*qUzd? z*h9eMCmoQPFBQz*ROo$1GP>`;I(Wg1oBaf!GAKHscsRr(8K)(I4C24r;)dMxUDLc}wSO#Hi;51q_xnd7hImcvTMi+& zBZx1e-+C1tlZ`d0sGubSKBEc0NyR;4x)U7Hv<<0H3hol=ornOya#<+~rNyx7spgswoca6V|!GnSV!Yai+IOa@;~!fBdzP$M<6M z%w6xjdN}KBN}vB)euMivZR|lfmoI?=-brs@iB(6;FLe;DKT<<)zucr<${bbLvCNEH zU-!F_m%qG@18|-pZYlsc&roB!RjiMI&sl6LU7N|>32i^Y^mVv6p(=v^evB}|S~l`5 zfzfcWKZ1Fx+k^kEiYqoSqgn<%<9A$f&!eDjjO?zJyLS$`C05v6kALSZ__ec@d?2I9 zqOYQ#Yu0os`;#jPaovUQs3KQb#jZxf+9n>4EBA1ee5z^VjCua+U4rkl@{WD+d;RL6 zkauupnUFUsb(cjjpZaQ+Wy*_M?t*QNnRh%ue6ZK&gv0a??OyKg^YgS55jH&)Q26kW zaQQ>|(-;urtM$}9;F&)WCx3el_m)rD#q{D+x4v8hBAjKjGt6N7I9P@8s$cgg2_BL2 zOx$3Z_0=tF2l-ll5U>E1M|ulc0QVLtF2mZGKA!%X5#7I-jQL*+G!H$No-C{@EJ^CF zNjZ$L+4Bti_ek7k4_u@E;8CM`k>tA%=e@z^=MgQX-VA6r*nS+Plkpfwc-*UgIVo4Z zqdr_=Dfc6DJ|rykcl9yq#cvqw8;eGTor0{$XIrr%|Ay5qF{OMfzKD~h#LQLVnVb>e zeM*E$DR6})?P|2#ZhPj&&0M8SF#4gD!(ES&ZK^zv-q$oOu>XB#=l0XN{ia-}$^9rf zzIj@nw3ks|ud;+1?B`uD@zCFx{p2#AK^ZmNi!QL*;8eF+FnI8Lzkjq~c5+p-NU>4= zv`2#E3*YPC=asHCCyvn&yBe8EbBRg|-N9V^{0k#D_lP;T6=G-1m(ZI0>&Ep9+m${A*23w0mohKs452yx_ubX9&`SFc0g@o`d#)gq^Q8d2bvv`~RN zdWY%xYrV-UDEW7a&GH&J(|uuQJ%i_Z9suT=*kc^kbUs>}hfdB@94s99CLjVW^b#y| zX5{$zqf#r$eLpR9tS>pO!{DRkw5bb37d(FcctgM!P1#ShB2I~bV>c(w$cmPL7vf9d zovi^Rp~utV$K$9MCKrwx(U<*fK~7HWIcPbt$0VvLuwD8K5hKgv(*V-K^r025|EERD zgI>(9hlBUNk%SK9#x5^AOq?G-Mz^8>duphe<_JIx`Q$Zcy9q`wrmFDWN=xH=E0P=L zRz6wm@2RL`@|mXxF*|ES_pe2|?s-NANTxtYZU9Jb5J{H2S^(iM`xeJS>{?@Rrp?}; z6KVepxc5}g`7ver`$p&joBVxu^{y76^YiX6$-}*uTSS?Nq`Urh)gEIx*M9j2$NAX> zZtCKVZgoN6&+A9rdv0u!*NZ@m1vJM~Fd%c#4X>+YM$0~#NnH57c|dEoMEAWdK)5^wW6{_XB? zTa8V#&#!Kw^GuK311q2@VW5t~HsH4NPTVN|%113b@yR%p0Or_IIHyqq$5D`VfJ3Nv z3ZkWCPy!~$_-8tayBmvas#>=4F7MC0J34E4vghO7i`ip$K{CMi4@VLR5&yD6&)&aQ zFg$v{ekgX|F9kj#8dsDnqAoi=v+CaTGv}*0xr@`RglE^C&nqGonc>+^RmMl}#}r8p z$U9MdWnXZOkmj~Q8Ru_jegk<0;gWX|cjA~)(z5vtkZhI|QZhT)oE^@%&}L^?zDiB` z9;S7UgSsa-n^tGFIf6i%FaZx!$MFGTv> zieYjat#;@sOyk>47-FUTR5lL`yIiiPv=jC?i@zuKaoaZ(FrXb6u>0Q((1-0_F3(&q z`taye-ccZ5uN5$MUdqV6MrNRD*P^WAw@A2*G0FcgBn;f{eFg&pqyY$!hCPSzsysXD zNA~Z$H0croPYrB0aBhD)2-`l6d+-IQhpwhFQw++wBK1I%!)SePvZ};d$AKjr{sl0#rcPCnIrkvr5ok%WtO3ku4=fSkOPQBYD1w?0Pptm*>hpp>_1 znksLLP4{%b&3)bF%e}daZZEVzyaPInCl!M)uL_a{F6kN59lF}=j);4jzH_5#)vWox zlSEEjN+~R<7PUTx^{g^Hc3%?)R^kOK342;%xVO;8#$T0Kc^5{0XE*J3qJ$EJGj z3Cr?i6n{3^AI@PqdC)kb#WK1t@y#{dM~%GU-9V<_tZu6ON~`zk+K*(QCxN~=hp#f^ z11$qEFCH=vZ{+UeB>BQjvhw7vR*b9%R3Btan+Q;SumeS=859{x^MR7o!V#mGiO3#ypv1VIZD zz=G35gc51O!VI4T4O^!6TXT=EK4spWK){X2^s)R(6!tvI#W$D(b()Shs&q1w4E4SF zBM9netoYgeOgCG0k%uVlvazApF!;murTf?>pv<|=`fAuT2_+xE>rK{`?6ly2hcc`}80DFKE^A66*BbmLi^cqG$P}Pw>iVa$MJUZVW0{AM;F{BZXla05A3Iuv3Z&CwgzuHRrc28 z+?}5*wcunCHOIASeajMAwj}|5Y)cT&2!2e&4?9WTHV+!g<0GpZXyjXP^glH66IU~a zNvUyQ^5Hz2Dp!!GK;o`%mD#$k* zH>ZTliSl(QsAFiLy2JcIVK_Bl+Em`J*!1t06K{aa?`>TUt2-skdU|uu!>TjK?zRj> zW7H8J%PjLEnD3($v;lT|X5m-6W_ zg&sHe1IheDeiSK?Jf01JkO6@iDLB&e6ea=%c9Jnr$v=czfCop8KYQE%B$&$N1TCFg zkkV@E#U!7TO&&B@xxSHYR3DrTYlgFe^u1L42S zU3k(lk}?ZdoRWz>(RGS{#^~+t4sNfiU0~l(;F(OODuAlJjM}p2<3fF(uR!Lt2Mocs zpN3ls2AAA;p&qAvH%1uWnQow+iu@QI^t%P@#`sA(T`NHu~Qt%6fS;PVaK6#;S_(-@LW8@u4WJ$6d3e+YP!-* zUC&XYsE1HpKPym|H6x%QG$XKGXjb5!-aFqzl;=x7x|pSwqmMNR5#gx29nw;X9f91x zbt@~tO;T)i#8g%d5(CXdRt#d<=DDsb!jpQ}Mbk4CS6n8wN;&;Gx zr=FfeGBJiHrvn8b!oI&n*bn{wPS`I411;vxNyt&1W#t|XvI+9 zJOCpsP&4g7&1@cuy)-M468LaM2~1k-^&nESqegczUls@=j)P)X?l6FOjhkVO(a@p#AAO zk5o*2#IKQsTLlmXD@uyl!_TK5P%Q2}kPrZp(u;mU;DIKp{QAlL_rSf$<|R+v==q;Z zhqO37z(!0T4pwq8X_AQ-uU`|zNx9|jOLfZuFd272;A7P>qxC!=2K@x7B0L|Y0t(w2 zI6RIXv}6?qmkF7Vt=jSi%u-kC2&UrC21k1&`c&1&Q zu3I+HKS`ymj+v{U++TNQ7L#`%mVrtm^WJnBuvR(%?bT8;U1FnK-kSbimT&_306S|3)_DNd zQQ<{E>!h^CLF?r6M*I;yP z>!O(l8GW1{;;9Ei#-cMM&=2c=|7Z;2346z39cV6*b$J7t+oT0U-Vsa%7rOSNXK)`+ z4}cE6u*Xi-qdF%^KLtm`m8nYpXzZKdCmCY+yB}d^Q_AArJ-YXaZXEI?XswR9soFh$ z7Cm>6XOt5fSaE`ZRrU3P)tP(B9SXOv557%m1`PjX!KudS?+s)Vm?Df*D2gNI+T&b6 zI3K-~M!qJ?1I>d_a~#2z<-NIOq2l=)piEGR8j1|7f2&t-cm~V;QYp4PgJ7aV1QQ*i zysR~wpR3zUFPgztUsqH^qZIW2G4|bIO=a8LV;2=WqJRx6ASehyv5hFq3}qOlL<0c@ zK_G-6RfFJIK&9xYM4Dv~i9$#aB?$x)qzFh+1d;%uh!lYUjzU1d@~wU1+;4Qe_xb&C zeV#icJNvA?_Fikh@4MD{l63j|*EyGRPa;2Eq+9NZQgBaKgXtGO*1-XNqSwKAyy^GY z7v7^=E}aQTZ?rx8__);#;i z79>D=vOh>B?0Zuvc=u=%AR!@aRtsLbIK*K3?F|8Jfy(5)u{>`l=DFd~<#9cF@!N!N z&KH>B$?0$dO&M1qRUTccio+dAk>W%r@i+KQ#u;qvsG;f99w51>kcj+Dk**2}9<|3a z8XlG9-&{ga=pPKA2FF)EYy%XxCyfU4f@9h>dgP=-M#j{YaBc`U>yH%CtAh{c&biCI zy}es&`S!Ay6BbTP#)#0!)Crca!hxAFb;1i*mISYrL_5-Q(_tCk2v26fylAf??iNf(J6tbbDCF&>B-3kh1*FsB(Xrw1b48E8)3o?$R29slM+G$+c1G!_95R}Qlvq42n2lZ@wyaRAzT{F0`W?!T$b?@wdv z5!pI)hDey}xipzEwaw3U_DWsX*%LBdXYcMT%LB^?>>&1C%L140tlr{!Uu|N0YLkJ- zcG{lgLfft9Vv>DZX{I(gbM8KxQuM3aG^%o~tF)KMx%9#nW~KSlANMsO{Afb>u^CX< z9$l4UD1C<#L(*Cq3O`+fyURxGwt=xyR{i{oSVMtvZiPMxu|R@p@*&XQFUc3E?b0crE!s z>x5Y?_q)*DU+>hVs~UrG#tu#!i)B&9Y8WQJayEv^&&3;$J9O3d?C8OgR@^I;v=XBc zZPJU;1AuMOau~D44Mq;@tj|lG;r!#z7H@_>A|yRv3x=c{IVdoHJD(eMZ%Y%#Q{XV3 zf}vP?Eyq!5wlS7PPxVVuEJ&<#z%pq)+iV^B46&Huvm<%Nw6<%mEW0p3)b+&7LR$6C z&y)NPRt-J^Y`oky(P!@BeVweeYF3?8gDv0>aN&EzneOECC`#uD;%?y zb`h=GETgnxW^lx(-mUt-Y8Z=q3v<>obLzXX&`$+d*7&8HWpv|2=#I%jk`U!kiWHc_ zrL4=TMT#<`rpNb-uw!1>h8^=#@CxHzcK(L0h87g>8N=uqQM@14BxcN?wsOrc%}PgC zg*sJDbIvcU!wU*xG-PpRO}}LnD@K{2J;)=h0iQ4@a_56j{2ap9XVAvlQM^cjb%c1K zap|KzF+&*}iRR&A);y&~0v)_+Bc(3XV|)0@hMTCz!05f6e6$GznjK*i{&l8_daw_F z5V)TdR$~+#fct|C+UvQkvhrhK_Bvt#?$uH2kQIFGQkh;Sm`V*yb!<|y8kj1DWp@co zwO_1V3apm*gN(lIm(GN-2$x_KWAXaZ-O0vwIo?~J0kC*biCYj{gI$U{za7R_K8z+d zjM)eN#!@gonwxrx(Uenj)w9*Z^J_wg{VHS&{XzWijl2=gki40Mk{l;4Fx z?77I;bFoxbS$D8-O@|~tXDw8{FL)G1%WzF)?#O$tFxbd@$^s!Nw zMFg)C^T8!SUA3)85i5bMxi|y)cvz zwX+L2FQ>*Yg2B$HO0{9IGuU7x`CuFvEOmtJlsV6AUyj{`U!8e4xFyUNgGhXBRbJ2B zv4o<5qAkxjGh#LJ6?HqgnU0~VOMrE~o$kYar#g8rKHGbgdCra++dGuE{lk=%wWw!c4e+I_(>F?WU!uB8dzSQT%4S>tiEY+_T{`p4Lb z0bD#v3}?cc_erE_z&=9|3hP18qqzfjtSdqPReu0}uqyO0KjWnHj(u$|7K7w;!&Xz% zLB+z?nrg<*nraiBwbag(?>nx*%*sprwIcT=C1Fo{%t`IeX$pTg&hDEmOM!t!C~|4Mj=w%&uhHy|MgzfwcKKYomi)n!|uQ zSJJ6Hq3U8pvE~orbd7+@KiKAZ6WDi_PxCW-1*X3X{}JPD*C?%DImh!g2m&G;k_V9> zpo4c42?8kTxki-a{=8_tn_OM`AWpcAvH(5+WDrYq0(O9=xIYh$^;VN@N~U8kpQrwa z5Mt)DL<#`JVy(R0KmVc`q@;9F7N87xh;5EV8#ziN&r((>DPEt4g?ObFEX2>Gz|yEn z)5wU}KK7rb=|xKu9e}STXIXOh(R*+u`ptA|E!kPW8Ezqk!UXTRbBS#{OYZzeank|3 zb}nq2E2Nlaka-H;BrDj;oE4dNgYYS_3QXafF8PMcKbGmWm3t^-? zFcQx)>W+M*7xIz1VWbNujf6YzRj)gqQI91%(ym1PTjesIw>;TFIa435@u6hBbzq`% zxwkdH52su14cK-kVB4L5ZFd5;U2g6kmT^tu6Qrs(5c;GQp3)*y9zWBM-sCB;bKJ4x+D%1K~+>2IvIF` zL9mn-kvnQ)EjRi9_9ae zc9Pzgi_p}jg|)vYN)@x?U;GaH(hN^}j9r9q=ooeq54v)8T!bvMMt%(UuokJ=_fSnx zkm|XWnylFz&|}3>Fnp@tMh9h<1EsJkYAwoDd4vU!m%sxmz};Yow`@GJ`N=yBCe*}I zug#sMwme5w6kq^Hn(EgcazXHRz_ZA5nEPRMZFr({qmLh7(QtF4JSBvvh*Clvq=bGc z+}I}$4cJY#zX-d@UJdOy+C!yblVWX2BtJ6AfV_gU`vrdf!g#aGsl`aw$Q93vB#u(!a~+Mi8Oo4i+<=dI0x*s#@mlkf3e0Q`GygxIOstUS6(iW_>wP zD$9=FcNtqlMk%(2qIQVL+dES>pK@tI?$C&`FtZVMdzqP-R0;>1SqmXE-lgdPXfL-vcohkIcvlhE1wb}^#US@XKiwG?Kke*=ihw}<-booAK zn4AsZT_=_|-}i;Q`JOM|6y1M(pWki3+c>vcHH4sBXQy6t_E!2lZk_6}naT4Y(m8cqBgmSd@vJPf{EIu=GvZ6&G409d2$#ErPeu)idbSNHQU@1hugBW9o_FWV^a&N zbPcjo9M9S>HbAT9%T__FmgB96yu80Z>u`=j^Mel&(bf^=Y=Vyf4q=CkiQwj`hzdMm z+#D`&;9&q~xvQp+xy2OkRQ$_Drc-7YzD|SmBMs6I21-9pC@_Z_6Zvn0F7jm~Fj{!| z%1yU`pDeNdPx?GU^Z+0T*t_U*<@hn+-A>u}%D7?sPGM$Zm?NImOrctP9Q|exlWc=Ri2k68Hdm#9ox-<#@{=$>SAx ze=3ICiY=@0B+8^AhlhdK*g$a4V3iZu+$W-zMe&U=puA$X%}`Rgw~$5>wt!p+?A;Gh7$wqii7zndqEnB}T|*z{K$(PA@-UW)*ac%w#N@-Z zN%M^rf<;RMg^dt;C`@8_}}muAUTgm;+PX zVrSZqAYBLMFqT)^2SZ+I*LiPh@PelAK1CW|m+~OjlM>0~YyVF}n%%ZO$Sjw)i6(#=nj@AfmYvo2eQW{LxDS9{rD`8qmgIM~u&gC@Eh1_^*|n|( z+l^o#l%ugB!@DPzoy>IF7>bc^!-#xife#@SLUUsxsb;K}+()3p@ z^Gu{L;3}Z#A&9nQj}8MlQ!PuNAoe<<$`E9k-M44%O+>c!eyq29AvqN^dj-06_MIFI5K>%zh&1_0#Rx!&;3n#5gtt(O3gAe@0Mv45m?wc;oi+jwS|_6-IdyNu4kV}Uy|u;0urfB3v;UOZG;<&GG@w|ejp=HL_r1a>4qqLU;DukGFCecI-xiP-Tqqs#i^^hS5P$`AW}aqE-{2n&>I+ z2a0%}G@uzM;tK|YhY$r(ETBvL34ey|`Wy(Y`^Fc&Q5jQt^IbLN&#~YXL=JL_bg?Va zl!+>X<*Kv17}aOXNH`S8yg8$(CeGB=w%)EQc^ zD|gP32e(yKG@Vq-LGq!>WO82+j8zpef-O26BiKx}?kL%b2c7X^zwWawNb_i;BQ!;l z$4*~c{aIMF2mKChk5}KKOw*JIoW8DY7RS+qqyT?~Q$ABuWh$KVUP{ah!zYyb^%8gK zBFRT2?gg-G!_Q-4`Wt}05MpMXR~v7|qNUDF(~P_gY~EwmG4)-X8^NAJXPNDUNC;>Vlz_3W=&Xhyy@X$gQ&saWU^+C)(-RE~|AQNvqh`s~w8I zd}gkO5P!wqH{)D2BIm-fu^A4vh=$Y1LvT-`RHJ*%Y56G5`9S{^%2um zUjq1aIpEXffKQhLK23|QHeSFH_}_VT%x zUdXcrsXSX4hHN3lb~JTFG`00hnB&WXwOAgku_fbkMZ+zG|2fDSTF^S$`7SM#Pk%cT zP$;v)w9F6ZmlOGh<3E${Z{Js8bHd^cP;o6rrf=k7cSH{7K-g8X@pd|M0t-$fSa5WPWSN-zJzti#&5%db+QQt6KhU8I>Dvxq}h;pxYKaI?J6Qnjd(t$05aZFe* zs4&h3-)0evbAKa0hd^PH`D{HV7e|+gg!YuB$uh`-Ojsf+WI^g;GGsw!T(K4D9gb?r zYNTRWko%V`ND5idFg>tO=SuT5z53-!dphwZ^l}#hg~*qQbP4io1g_&K8xcV^a`#=^ z-FL5pBp)>KWInFHwJWqBu(HlStqd0yWMxgcl{J@JX`cFI z%=qpTl{DER6c8>4FbQ2IFo{&@5_oX58AS5UAVu(~U1&MSZl_}(KF3oExKWw|EGGbP zojfK0aPiaXl6E}#y9$OXbvC1f@P|a3&Cp79c&4B_8sFv`Sg8m1P8#G_LtTYBUK_0x zz+h;l0Gb*?Fc{#QJ*anzllzG|_(|cl zcTe&r4sMxYm*d$ZH|vnxtSJcByd9HkM!BiY570}21s)QK%_%#Qhvb(D`2uUhHWG9s zy35(dAvpjC(}X}rOfmGc-!>c)gAx9=I@aH;ODDE2u!CS-`boE97}r|>mnt_flNUDG zQ$dON_Lm&Sps3-Q{kqx{Qov_J_=BR&MzE^i%2U@|30ik$TB{>iV^0SFcpZXYk}o0v zuM7aZDur;- z&Q1C1^yk6qgkDU4w^9#Ix|`gVz!qx!GyCO$8~5Jio_=uxyQWF=uxnZ%I(T<<-Ww6S z=_x-uFy5}! z#bVn} z?8{~EICj~K*YEQ7{eoGyGcSAODFTf77=tlsau~B5gE4E;KGYE@cbtN($$8lEsQ=}7 zd<&ayT*s_0asA(i{##M0eoHvDoqR}NzVB4z`z{)Met5I5kcXtW*@gZ{bGC+MAB3D_ zNe-i5B;nX^tPPa9GLSh{9RA;%NoY{UWd$vFU5!`6V3CX)fr zTp6cdQ~@JESC`)?xr$L7Rp9lu0%E&#@UYx@Q`C`^(Uu27@$V-HCyoCm z_TXtOB;@I=8*r8~c7k`yFWdT+y^O0K9Cq0w%JFWfG6<-A z-GMHfTK@45C3CFow|6-H?Hz683mSRRz-W~Ho6)GzdsAmmITI|EA0mIr50M%2LnO?w>zXgVjr<^t zyPN(Ou6SWf3AK%UWTD(S;6vz8hT`zX*po(6FhoS@3nJ2nAtH>w+y+9~Nh1QtY!BrJ zZ?V}K90%!SA#iAU(NTr+1E5WQ0Q?09Ktl4eXJpfpCbU%+!nmumGz@a>$%=)}jZD%#W7UfRX=o($^>sTd!ClU z_T-PQjRyQtgm?tVOrlfaAMyhx7+D4c5ExlXK9U7S{#SOZxhsA87g(X27IcFHtoITHF-ZW*@RG6YH` zN|tbqBFXw%swyOJ)_fW6JIR}WaL5Bq%Iy*L?`Lma_`d-)CUAQ)9Hf#9uvGG^BuB8K z=i?XH^2<3d!_Ijj)urW75WB@xLREDoz{5z%Y222z|IYisBv$u`o!0MJkZu9gEJWdN zA3)7=lu@MW2gT+5XpRh54yzLLD1bpmgaVihxS6ZWFR@rA-$szEqFBr{ zq{Bbl7n~N;c#&jrEj6*1$-M|UGsdpV-Hik8<~0ApY3!h9ez_>1gaT^YF+7YwNhb57 zA=&%yb}-Z2#Vk+kw*6j~whw?ok;L7ek_=Xe^59#_M3Um~=C0m3aZC+)u``wv+&sPW z73VBcfmR1ZQUubf>HNq=JjQ!m<0~NdP9{1>z~a8g=|-T;pc}}&ZXox%f!wP$hcjyE z9{a@dJRC|5x*;{_e)dcIjHN27tZGONl5**nGyuXn#+f&^+By_yLKx`-(1a*+?Dhnn z9?AdSq40sD?{1G#_h-HX+Sc7rl7!{=AK<+0^7H!=14qdb8u?YScaqBW`B+L$Yn5|@ zkZNr_;f>DQa(4L_2l;?Gh;8VqorWllhTa1)K)St?IBW#c?O){n_yNUXuNdtI1Z3FGqLvLQP!46McZ)kc^Eog<2u8~+G2t?OZlZ6RN)t{(;_l|06_?i zW&b-|F?fCJ4E+mq@z|kl`#Yc1V#Z@Y+th<>Uslo|;Pk7ru!kuFsNWi(eij}c2B3a) zluX1_H}0O0#e0&^15Cc)NW4B|aLZm23%I&2TyJM`^3?ls#t`sVus2|CP>sn!{tA)KN-{|Ja zAQ|cHoO;_t_5g3aU8cxC(!m$^cA7pdAH&L@3%&#qySc*7#*V z6&Q&t&jY@@VbzEI#lIL7GUmVq^pl6eN3EcL6?I*l@8}HWZv1-ArU)_|w}o@(`|VJi zkSVU6Yx9iCJ7-sxH*2`69)xS9AY4no2USGWMvx=_0$Bpl3Y2S75AodqHxchpG+Oei z%Pl59b?QFhq&RxnFMfi@unhkzRz>2x|rP z=NF1q+p#>=H-0}*W}f!a6b@~lC${EVY;4W1H$oC678(K2^WG&zZffYCi-aO(WE300 z)Q~9Daq9O2=j3VcY(^&W>o|JwN5na$;4qYDKVS!czU#5^Ogs}528t$-@9c;A&g|U6 zBuob?Hzf8v$I&sKN#cqbC_ngT{{fl+_{~|_`Al@R8aNz zBlU80!v=a`6bYxyA1321A-sXfc*A5Mm~de-5KJU68HJB^Wa*h)GAz<`B16)3L;qp5 ztQRd(HBpA6!#|uSBCrb;mYQNOmBCU|kX=B-ZVVcBW6-dl8;ICVq}Q%xYf!HxxCNpr zpfJ|l`KV0t@ABFE8IN;3FGe!g=sZ7FurBRnw8vwnY-&@vJE-9Pjec$G|Bt4At49;a zFL4e@;Kas3mP@U>k?XA*vZYVvmc+aiQ5C#hW6%j)Ei^+Xa5rxaV#jX|xAg6VTDX}+ z_7vcQ!UifvV7c*#XFoTJqyD^0T7Z`&>yE7d447Hbtk;bxN7 zqBbbpOd5~y`FNzcdRl%1$|S1U5kAj;Sv8ZGF%uK`Z4R(W%H{bm`U{zQ#B77RGYt)d zI!)LpQu!!>*eJp8e*5SlKCxUNm4~{3HVD|tJV#|rlXA3|@Tfgk@uObhml^fIjELE( zsex_41Uh3_c7LX0J6xi=PaFxdR^djIYjf28UbOxU)`u!FA3`ByU_*nXEs|Qqf z7`(!cbd_V3_5&=_CQsF442xCXiXO$5mh5?mzN?n09K(3ZXhh$2v)qKPoKw!1(5}Kt z4632TpmDapoX;&9W$C{yC%=2 z1HN=-3d3?~9>Prn+Uz7@_O3j5C}nskB6=v$r@$xvQ^0iKb;5~EfIzhVoj{a47s#T%Og8lx937#*2_xnx3<-Lu9%g@C!{i%B$tz3T7koKq( zR{l`ixHP?V-~CGf;vcYbIg};Kf<*ReiD?+`R>>dxMYYegs+zdH#%~A+80veoy7Y8Z z`5uC|wKX{hk#N2_*HxiBF6U5%B9zDFWORyd5WFqDDil>ghhWZbItgl1GL~An+ItI9 zR|z;>sE3L%-Xka4(xL)bw2iRqo;6JCVrNPM;K&~Vpp4%4Pc9kM#YK`y6b z*|KnZbNB4S zP)ijFp8(0MtE#t2*8X>$Lx*d(4j0kolW9YfX>?$M+{Kpr{e>!h1w8?kqYmEcdVLZug z1S=^Ghf5=U-UvdM1sU9%3=+EO&`^!WI&cmes>KXMMrz+v9Weh(5sAId zv24%5#b`vqNM0w_=3p&uv|2D_og;BYaoWmZj3{&ZvFOkFg5SeWzYzRxSN!zj#DxEmoW;-o^!B&&O*oM58F|5JDe5}F3##^P$ zE2d)gMLTfl9?Jg%H+1t4;NThw;|HFyk7|A_4faCIXD462QfRSzgJ(-@(1i)j)#Ir{6a1VnK!gE@rOX&@SJC`#}O0~ zZx3=a1UPP>hvBqo_70npiOi_X3L2{Af6n_?yQ)7$q7gT448MUoMc$TRmb@*&#v=AD z!M=y4=j|MJtV>Ki9u>E$3No?l@*!=(9w^AmgB@o9L^B5w4r2Ynl`iTp!H;^{_$HO~<;3PY^~hgap&pV7B#u9=hnjCk|Gv%o^5_+Jkw*DAnlu5K&2bOdJO z&;E5WCM8{$j#agO(rZ`*T~ncO?dB#Vz;;>}HGaj+9pNth=Ky!1*L*ut;JY#P zXEKQ0%mO6}1{21}`*L+cUoKlXN)fTdxxRdZFFyYH&cmu&&&7Hs%W74nQcBE7jA8jV zjk$KT-SHM!3R~HMdaB^PenQLKcI9 zzKvg**cW2apPq5boN@G|`Ah&}Kpdh8;t(w)4#_so?@>}sS{SA^rME>N+s5fW&_Ac` z)-S6xn`{^Mk@r0~B{-{Z-KKjpOYkYd{`v7LzzMV*GOtbD?bS=3BzhfwnOF)72Ca@DiiKx(C6L1 zE6mD>D`|=zf}2r!0zt!X1S0yayI1zD%t)Pg7up6LtvTL$FA!yA(C_F}$kB-HbavnY z9wRa@QaQ(w1g&ZQ(U^@Zx*?ccGx^kv$$&3i(K310a^qUbf~|U*N3MWaMIHZl6UR^6 zKSHmgxc!pfJ|~DDzfVxc$|q9ck`(E{twU1&28qAsJ;Cy+&|9MpgD*7MNVn@Q2Wqq8 zXEGJ}7RkWMWhu&-E|XlOi?M>*WEiT#f%`&U72wL=5sQhE!*EDOiBCeL0PYKR z@D_I|N8S~(+$+Q)o_wF8rn+9Wbg0}50$oRhD{8se!6MXUJFFeN`vH`Am9`Quz?iyJ z$T&!u^~B^yqb%Hl{T_Srtsh`m-ZR%m7%34(QdeD{ST@uMBYjl#uPR1o=gCRUVpo?? z>-H~goX&k>=0eNEk*U0|+a|)A3Bxm4udYBNCmu8uA|BKd389e_jjdH1;9*7illy|< zDdeb3Hg&KaUmHC>Zvkvp5~;ZmRkM>wco!x&n(au>#1-p{y2fUDZEl|eu!9ze<@p@w z)Fl$lT}&Yp3pEU$Tjk~^-wr|zyQ-GQt@Lm6g|m!I*8VE>wtk|^%*y#R)=+u;#nICui`9Q|TsViTsNnetR+Oy3MlwCSLKTvpS zs{J+%C->>iCc)pG z_Zn7;!2Wnr-y)ILvE4scewa47_}Qr+f7?2G83|{H^c)sFnj5lf)}n`Qd;23!zn!>( zp zA7S$*oc>qqIF0+qjo7SvFGXy5AH!J#$G+Fc@KVn)ZCS?8+EE!l0|lY9>gUSD=DBmn z-3%ww{2t{(M62?Cw1{XNdncoQv1?OT_~YZ;9O8l!L6ssjk-!m$gQMV1Hq%F zVcdt`EZeI%fq4I$VC^UYI?ghkTW6jzo0ne4b&97hR@ zX&X_ZF!>_&n(Bl*tsSO+UiJ3Pop0}VYAcyU-8I|pq1zo;v3ZohTu-ZFRTWj7UWa}2 z^!+tVZ@hg*eALe%`7sM3eoEHvi+=932BK5Hxm)rNTcKwjd9FBf| zYMEQa4!Q}a&i=^EWD`JXpIln8?+G-zc>;}YE;iF}JpFq?Hxgcc6a!N7Gf_hwMUxiG zfFm|#M$mZ3e?aqdyfppqliPOGFUEpay0Gdx^@Z2rg;fxm%IB?4E1w6t(0K@8NOOyQ z+OZIjTTQXW3%T_172!Y9#~`AI1ub{Rnc?Qx%y+%!aP{T6llYMwJ)S!TY7+G^P*aBh zf+$Uj)i$oA+rB@|Rv(1`c@@YWESmHt0siNi6wL_(*0H)IZc!tFlEjQ!q=Lc6{}5qX z*`(go8D?BVbazq-clWEE0?izOXJwf_uEJR zxId&pPvwXbJ++ckp}Pgt@axhbtDr$vv7Uc!_(WOCwq}o0yS^^>-}ZW9v?5#!_g|_Z zT60+?J*B(T>xk=*1OP8DtmtrZQeS2(;K&9 z=WR||Rtt3@W`?*qi*hEG2+tRc*F}7tlTA23)Y2$u3`UCh$5cKvX4W}WKIN(V9)BGYr>O1sAf5M2LF)GjQrkvQzyEIFf;HfI%<^7n z^?2E=L3NA2N==E2_fGig@GV>D^Rqp3X&RXgNZgcku^rqCCyHkIqsTNNm*=^CLhzkoa^h56#dTYJph`+w6;f(O<*1i8c^=%RcGde1%vzWMQ*8-9%=%laPe(>9z0wjY*L|{n#Sx=^yuCPp|BwPO7I(*nEoESe@^S`f%_4CM7A> z<)i4eEw+%$&2UjKEo&xIP z^!n##{@lMeUHDwH?PS$>4J$5o)UtYNP}a%sbpI~(&nlt*L^|T11;_gZrELVr`!2AJ z2y1R+%*)j3b>--ldLI!O{q*g0FRD8_Qwc8odj@(`0)S)1bLZO^&$S7^07Y&W%(pnb zgUdJFU^f$&eII6=aAD0?y=~#*f8Rh9Nm!M9ADi)kI&8+abuiyoc~OmeqqO^o1@a2DY5MDu1pNOgnE#4B!-QxOoe=9 z%F)W4I9M^MHvXZVvV-Vd^bD)wulJCNnzcwp>dL&bPXyVmy4?oS?%y=jMVcgoS(sx}@g9KIOqT=-=%muHrF&Ct^VF{L zyk$!1hvt|b4OR3nu+&zbzOUe`DbH8RE751usn#TCeRx{d833Zr01!0=uJKc1eFPo! zteN!9mQ0=O)bBe}s(~<(upl{A?*4LT5@OCoBIv|D`>?kAOyc*KCxKwiPc_g@kS~v= ze0eO<@?1dAOSe;Qs{5{uYwHqvEtwZz)L}OE^2BWH=?OMAEnXJ)OrOnrNxx39Ij;V% zG?Xr~p?F$G(HCK9sI@!|wT3j*Kz;bJKRs1A#qj$M@edQhR!x*UM1p*)PNN&1B98rE zep2_$&^<}eon6gm)xwm*V6Y8amqG{+|1J#etGr+pThO$}a5y zoG&GHRRb;~HLOddG$xn_H-2ai_kQ2_Aak^I*XQSNEJ}Aj$ewri^IK`_XYuD@<;@=X zAEy=Q1rd*BZ44RM`A3VFL*MN;4wVb37Kx-ZZq8cMMA%0&iJ4WfkJ8iGjSk?`4O2T$ z_gE$}=6L&kKYPcC9VmWPQ8;<_o+vk4BFf&K^aBfq+(KHXadW=Ak+O2SsEH)EtQ@qF z09?`bo_rxRQuVYM?@9j*7w9&Yx$O^V0u+|M#13A$P@LGrGOKmX+I7d+S`$m*n;?bP z_QubW_mztv+GA>(lMUNn&%S%}GOHZPsCzR$jr27TXk-t4vB}rbljZ zdiySJ4&5-c*TvlF*}lWfbc1h?z#)UbzkSVQ!-26vIJ7s|j%mI+84V``|DexMX3ECz zhMAO%9LKQ)g_MoJmN*yGC{KkjlUjqH_gd?g!T2Gn-);V7?U1eiIqCG!nm6;hU=xHGbDAJxi_;@;z9IUMu=Kj%#`oexjG&9!Ls}an0H)`{6mzG=5GPX1 zoJ>%h0OyMw+{qd0{4T`%-yX9gbV<*_+I=2xAiC;(X3aF=>65|yo*aM@CgMURxCC?HSasGmw*>sWaS7B2Bt+G zk5JBZNSwLnPUL~CsxT+$pBnM&iJ zmMSyJb%eyHL%@oy$}}mhM>;#88-qvbEcUKMtcU2VF1N-N*2A8Y${pw6g92^_O}@G3 zy~9l?pScO;GdH1p#%LpGR68R>j`nSd5Td$XBS0sOpy-=I{7)a85PZVhqkYNuf#iq_ zZ}}@PDOTg%?|St`H6g@~9eX;cfURHD1V&8c`^tCn5A)vJCRCMHezYGSLemQ;Az%>Zf371Gomgh_YIIDxgmErVjbD}YIB0t0zy z;IZO!%464v?SDoB=$dh|_}#b$SVem0pMwR3UDt`8Hwp-6N5bx0EySoA-^HjQ)RP^0 zdu<+@6>^e2zR7fO*R6eS>rSZF+DWx;KmHJE_Mk-8==skl4GCd)#RPbqd87k3cy|Yl z2n-J{0X&!l4Y+HvkJb>zf6y9wD;$`#r2kUw>lN|pmpvZIXjbl_yVe}&ppu~h_Wxf= z!A|?lxAuNIxiP}2BViw3J~eeO#9Dos+A3D*j>X9#mxe!d+0#p0%DqE6C*5eZQV?aM zmOFPm9Wwi%L$XJcl7b7#f!zmCumKAs`cO=Ftob3(UKdnG4n=k8eq3K0Kyu-Ef7~yA zUs#>(C{{Ffj)hiwQTvT1muRKL!Yj@;crXidyMu(p(_8(5PR-(TPX%0>@$|~qmBsT- znw~6d7-Q?aqOJJyqL`dp@QM|w$8^o3JBXk>R#ycVhyNSJy%mVw4gj_5APU?6jM^BK zGB4=&+#gN-CXr(_9tP-|aFS9ZK5(tin6U6ifZkBYZ+Hkg4)qbG1}~4d5D|Ta>hdmF zSL9u=BE1A!(Q$SGr=#d)&=jbF7pE?%7MZl@LCMos158ffnY%3GL-Di;tMLdF^{I>9 zA3|$`MLFKrps3I0O7M@SwMSH46TFBP*U0IVrK(HpOCdIu2@||PveUt{1cg@Wm7NVr zCq92z$8+jPvjkv#y>IkdRD^d$ifcHDPl#vZ-YewHJfd&O*++jWdZOP@GA7Erk{JL{ z5{OfuVmf!p5x9hZ%5zv7O!;_hak{Ti6Q0N>$CQSis62q-B_KtQ#xyB8>l?P2#%tOu zTf3@CC8ee%!@7WU`Lf~TsBHudG;qg9@^*AOI8(;?P%#2(SxwY93e>U>k@E42Ea2&f z=SOQ!P`A(UP=LHBr84<7IXEHD$ zepcCPYd5KLxtGh19zDIQI*@yJcmh>`D)96`MVEE$BuCxpR(@G8^wNr#*U?mdsiVQQ z(%hU(6+#xcj-0mWiXC5F3nMkcND7fq4qeD<6*kxOULFa_9p)Zg2bubSq806&Anv;9|I^`%S;Nlo0l(o-t$Y z;*D7ZxKqS7J8T+O9IF?<&Um(O<-vE~ywB=_%b1t-4ym5*L-b(9o+0pH{Iu{teeHy6 zvaUv1>CCpv^aQY}op~?By2Lum@us42`9UivKpSb8uUvBEy6l=oB5*Q~EQ!QdOZU9O zo=K1(vN#DqL$NT+_?1+6{_va1(iU32XH+S?spX$9jG9tvBcxMp$<8)H@YyrMG|#zn zLzXh_Z9yCBydiLp*#|QMI}J_(d<`p2MfOWEdW+T$ro;}lTwlwYbLlSc$F+}I{jPd2 zWV&Q_YKvXsVls5{P4{C1U9wl4<82S_rdQMx+>-g`5ms{U$9$Lo-bV7~KU9G(hQ73i z2{VuAal6;WKO`*w&2D^jj-~Yp!N-p=hd`An#5}IT6M5WCSN5mX?_P#9!D$J;l8z*o zWise$jJ=4+ZP^cDJ3lwvT-^6Y6pt<>-I(0oYO}5L?c6`^TVOd*u z+r<(PQ>cg;X%JeXwd{avS{j2! z7@1D^+-}JZ`e~yTzP&5vP_)zlnW;o65t*rkNV_+xC-H0tg1IBj1a)Bc#qaB{sl4ap zl;l=f8~o>#c{%=h+m+{8bU8>E`Y0fPD3~ki1PI`pnupt;PaM=q z4oMn5wpa@_dO8QyyXOWHaGdI-%(fXzjmzip-bA3@Q_iQ#@S#tR&iGh5?v>v_Wz7t^ z1WLf$U^kHXJ;xgGFYr?7iu`z^09xi(+p3a*-s={mFFV*xO~HZTx^JaQE8o1^S+)%WtKuIUUJC}`&sixL_#fKs`C*l9R2?eLs(ua=sd zdz@;Dw%n9H#$O%Nq34-sK zleak-`MCm=3>CB<@(S84bech>utBTP)Pm0Yanaze+a^aXKeaR2LDnMy@gwlwL$(Ne z@1Z>jd;s2icwdm4K5SJvjwsY%5=No&4KNC|p9vHyy>iEj$R4J)9-rM-8ccdaU)HO) ze6gNb%7n?pYYn5x#0S4K@85JQf&@KGTv?3{aK`J2-B}R(uIG6BRRytiT?Zoam;7Nu z=i!QN#EqFcgIC}sj=kuOEIG~rU=(&$uoIl(*8LoFsoUh~prU zTs)sQ^N6nMkIM1GjdN=qN%we_>%uE#jbK{au84jEAcW!Fl{T$T)Lgw&yJla{@eBc* zlsDNrwLf*p$OTdHQ}hlN*MSKKE5})p7D42w9v0h=*tK~#yz=nd_a}zYPWT;M2P3JK zmaC~SX2k<05udyE(mFqPn{2)FfA}65$Zdp97N<9KxizWRI;grNkoxz>ju!rr79J^D_S=SR=;&yv$JO6n zF|$RYNRoDPHjoA;=?5I(onU*@Z5`m9VCae&`BBf;#}D3d{vD9bk4Z|?dWDX#Ozbft z4{UBm)T~LLl-XcmzF?Whv4Ra#T@|L}{2LpDduA$q>2)Skerci#^#MJ1uKEkH!V5FC z@}4-(3qE8wD0Wo@Z9imr-vO|;OB=@`vR%_J$RduymMczpk&dZ?@cNMsD}oBry9^6d z#v)&SUsGfkc!0xG_g|mz31RX%34HBusI4qIU zib9E0kWxvU`pEC;T_;4E){7IJXSfhQ?pe09ea|xR%x~U?nEVN_R_#ba%HPNO#9KH_!9#ckg#U$MOAvW9FWjYp$6!v(`H2 zoNLkBHR}A_n87UYs`)LzeP9T6`Xw*&Kk7^!?X^L3Az-;Q6oN2nIx5ic zasn0v{T96jmhaX3A&iyr6aOWJ%+6}gg`uut1Z6s)KJdS*n1OvDw!;*98iQv?aWjJc zZw>snFuqkUyz|=neCTEI0IQb+o)&=B%b`3i6@ax(q!+dtb1eM>9xrTMR(2QWX2fqe z33WUju?pfkz;+VsWn7j~Lq(ptzkU!3P(GgDLw$Bn3Jn6h$N!J5gNIbrk$siqYEby; zbQVNh)CLq+4xs%FbTzHM7KL;T2UP(0pt_7=*7D=F!9RxO+cHq}Qs(DS>2P=AfX3^Y zsDs9jDJx;+NtGpKHo%mgb5v<>b^7Q2JC)VmwN3WB>dTa{0*(WS>-oTOpgN1~h#N!I zjAbjjR^AC=d)^2F{-hj1NrL|s@F!hhT1yvaDC~Ke4h0x{5KV&XFItGDUzGArFa2{r zP*?TEKZNSZ4B1F;o4Of$r+SE8{0~8kpur5Yt*u^UAUCRd15(PH4($K<3Y0SG_-2xi z#x|qQFYpDY&4=)Jvag_LS$Nl1T1I&F*y005%A_GsLd!oy1f0D!`KgIjyMYG*Y0LZZ34TLzV5`oA*Kf zA%N#wbIUwICLO||kW*>RhuO|zd6;eU&_V-DS<7bWiB9h?TmKk3G`H&EsbQua?nNvQ z6FrIlFws?FDrESI>lB=fUJ{}lXid{$$7C`1(+{BRN+IjNReSfYY^d(%_1R0Y!$ zv*l^7R))<7|IA^8)}85#jcoJ>9BvgWYXCztPFh$)Vd#$HSrrha%=*3cKfkQCWl?i= z6{pVJXn{3Y9C!tj)nIXi#9C;wCRA5dfn${Fe;nWJ>WQi5zHzRmzDLkVlWKF|97U;6 zc@CVTgokKX6-`c7&o0l#f#{h3M;LQgY16AubDGVQ&T`HYLjb1tPqDCuc1`CAnDi;c zE%`v-P5T1cVoLw>Y!(^Gv6?(^cME%u5PNdlN?6jT&WrwPj76>G@$gdPF56NRz^0DG z((lgJ*EizR!aw?4V}1l^pLLb96e)}006&NxXn5=F?jT1bKhm9h^DFIs!zKL}rP|cv z(ff(IpFr8_^pfNM^B=NO&Rc5TX{-I=N(+YeB%XY{nxQJ27N=t-?k)_;T) zEE#|9GP&lk>7nx1)qRGNGbmrL7vM90-TYw^F=cYhz^Yq7wx`NVH_GQvKRP`)d8>Na z^0roI9kiAIuMbqw6L7zYAH0$DfkuEfNrw_kjEkQnL%)RG_jj;0-s5kzsJA`fzU}NJ z{^{(7Sfgwrl4BcrHu*Lu1radK{Dmb?a^@d6qZeQ1rjRQ-wg9f!3Amz@&TX^HatUCP z{+m{uj&pXfqojJ+{Y6q$z*ej3$93!8MMR_%5@`&+|c?JE8O78d` z{zo1Utf*D!P^9rNt>r^61b}kizvm1T|IAEPy>9lY;}hncJK0W!+=4H5 zy=CO%U*J)Wg&OeSx}GtxGS>m{xDJ5FUazY1Y{5MK%E`-zn`^Py4z}Q8cOEIx-yiJ) z-=(@S_^cCCAL5(B0_Qvw>idaG*O1rL+RN0rZ#ofu#X$@(O~e4xL<}%Zf*br*urJL` zopC%p$cS^$qJXIx1;~SR_Q2Gn0;Z?1J^SpS3PSyca;t1qSLJA(J5!Ni zI`WAqP_}hi$_MMvVy_oA4k7^JHPkSjBoC6JJsa|5RDb-x3|-N z?hvK@1Un*?YGDl65iKo>c-4{VFC7vD!WNx-u9jI7Q3HM?{hyP$l>}BmEbb`CX;{sg zq6O3oY?a+;K#@kSe+T6Rvb&>>A`$dx{Wp2?AcCOhZs>m7HhKM$#Ts10@IMU!`1EO9 zwLugJ;9Hkf6j|-wA^vRLq*~>Z>|dXLhg3Mp7-2&rp3g2ice^KI%v}8phW__NL9SZ z0+eo0C>zdR5w^C#cZViYOWWI8r+xDs{QtkRnSEyqv59|TeXeSJZhX9Nv+?zUNQc)gh+mJ>-7F z=W!@@1oc%dBX))&+pyk6XTKGxqo5m4$-*z?DO5{Tl@Y+(Cd0q?-Jgt zv(dyNsr{gpd&F)Y|E0qSTJ)X>Z_T^&yYrhp43Xs$jGavJ*+rkm+~&Q^J=Qavf{1VT z3vA{WNJsnR_FRjz1jjd1p_fY&9rL>GIBlM!x2Fbly8R~KRA+hE&O2@(K39rklmWxd zI{msX9FTaYvSt?5jd;>KcaHjdl76;~O8Egp0IN;ss`0*Ua^1w4 zlPflH3b`A9Y-Cryx*(Y-`~H064x@j^*o2iUxvig`M7*y*rx}(9vcGS|3aOatmo+g_ zOql8JuNpvm?r$P*?ls<@lvvx(&(_gj2&Zh#MdI01z2@?^-%$OSaDv}tVGY)OCdg&z!xn(IVo&meb+?*9Arks4Ca5mPa z7p>OdGmjRg1A|(iuk*8m)6V(e9xLI%pp`Rz((v@)TZsw~kE0;vIbYvk`LTy{C*4<& z77w?W-myY0Tte9{u`z8awp#MaQQ@<6{$0*>mXb8#lK&y)sUYU)u{~eGF>XpqXh-#! zL493H#<1=6-YesAkC1`EjD!?FlZ`EBaf}jM#{S%E-1wA*H6iUeN#|l~(_FOKrabm< zcZyohJa%m)v)dro$`na=g*T^d+$W@eumgudT>d+EDHo{XD;okwZG(llvbYDMbk>y z{)(!I3eUq=AZTRCCt`izJ68+TFIa>TMl^C%I*5xoLL`}Af)O6&UmOPd@dXgAEoIHdk6_SpG88cSN1KGYM<;CCX z>4k4!5q-VCXu4h(B`beFngrjo%!q7ZVf^$wS*XA9--_3qq_z<+IOXXS4Z&D(7O)&6~W;e~hq zUhU922Ue_)yU1fx+ekzA(HgE{#XMX0-r&^C3Wt$Y{X0(&#F@*M!Im1*N`xQtgQ6#2 zEXvU}WvD9f=AwSJHnca>bk{;iT=U6?H6)w(hty|Hf)9=QSf<}=dCbVr# zImE1-Co`li`F>VI&fnmxQK39U&Se=PIRr)4nYq;t3(Y?r zTL}GCXx+#!GMNsdy(*AO@zW9FV9jAAL{TNrSTL6KdDP_wY0*BOiz2*0Zc=Y{=klwX zZ1rtZ%?pvasC{w=t9^&O@(YK})V4JGu`U}g7jpB!VOFbi)o-gB4eXWeH>SwW*;+bc$mySyv!iy#`UIrSRqCA97#Qtw7XED5v$18d9327t1Ae>f=m9b?yX@1YbWr z^Lq9jo@s1eAU4)1*gHHUYQNO$m`vC+Xk0U&pyzW1n+7Md1U1&o(;f)FyHG+a#(o?4^8vEqFR}8-*)4^VQ?Tq^wL6= zFEl<|VEmH(aOIF7@~FMh$7=3FY!zv2tnoUeFzjup2ZcrLd~fDf-uPVhpCl3S4)pHa z!tyBtB`!i!MDB#vNCi7DF2;h`D#E|3IEHK|%Y70(U#KLst|k-%O<|uLX~VcvNtMmv6`Ah3{*=m#l8~=fKF{qJc_soqbQ~CXY@=tx4@u&^Ff?t zgr7>XY5&|uMPz$iHSjmLqn{YVsA!WzQa4De&{f%2)Dk6vHWb&K&X`2{hWAN`v6$`! z3?@EgIKeTCI1tyh8jzSXEWKn|Z>CXKSIMq?r~xv#)|-upGy=0hlc0&eGMLND3uVpM zRU90I>=_;9)M!i0+k}IVReq=!#vfmbL0AiWz4286*Ocb3o|%6ehFE_&;XwwHoWew@ha<eou0)oAzK~NXm-Zs(=>bQ6WNRGrT8*2*C`&Y$X?izi8>bND%+lOq)`^U zg^jiGn%(OqemT1QOCS^W;O7XOtKW8<3V4cOTuC%vQhma?rnU3F9=hiqaz_sD?;X>s z6i5_Yx)Kc(;N-?1G-yrdHZC$>+DlPcr6f0oNW<4ihKX9!kIx*>m=s!mt}Tuk_7?eosSB7g1XCI)Toi@QrZ;~otxO?@kPpyYW3Vg))cmq z_&LQ@52w+{LaDl8y;wyAe-3w(Wfj*_8%CqOF)M_T1J>_tq8lKO|m)D_Py zx95oRzWHsxi=T6gO3B;V8TGe)v@fDwSC6dn3KH~LEMzx09 zKrL?xL%BXHocWFMA14hRD-IbpUcv&KKVh=Udr5hmlZ&&XMzhwZyu#vNo?)ID%+q<~ zz+q0w(tRoYgBD1svR4-qW5>AL4HjFniuh;7^8tmIcuqeGt+Kgn4vq!RHa{_+tlc?nTP=WDVz$Vy&%rZ^4(J#_LX;tT`qF z1E=WWkCgY4(~r(s*Vu_Q{2d%bs0CxMf9EtT&Sh~`Ek>MJ{v^bAj+hx<>DLZ1E>3oawlklFhkC@yaG zCm9RXpnV#xNTdv;-+?qPDpkiOT9K)e1_`lLS(fcP=3v}!T$Lu9lmGrZ%SlC5Mij2* z6-AGNjw~&b(-&^f z-rG`V37z5!8Laz0+iV%;c1S>L^xn*VgjE0crl5jBxrl+btAn zX>VJg!0Va~+yDUtMfHz=c>4Xvur z0*Y*X8b0^7(op{7%+3Seh{8Wr*G(@6Q zZg?%w0bM0IGa}K(?kTun>G4}5J0iCcTBOeVNi}umnX09*?o^XQK=K`?jjec}z+XjV zY)8q+Ou4g|gBzQ<*!ClBo*iRyhL^(3XatY{8kOvE0;{RM1juYLzl+~OS# zmcYQI%Hz(fj6^u*qneT3iu8#s%)aT2eL47oBJ)kXnJZ(DByL>!n7}#6xrK=(^C-p5 zPW+q(*@quiujCy@gp5?+qwepXTM!Yi`1!3XAO&X6xcqHj7E+xo*y=s6JR36#WSvZ` zV0}Ig;fAAL@zVPaFJej00<{N-iG>pm1RgtpS#m$i8y`C$eViA^PBpRWdX|Lk&9@@) zU1K#^DfHJ2u#V9KB9vrEqb%(BJqVDS$!f@>EIv`cV-dCXq`e{b`ndQ+fQrNK0{A89j>*Kl$t4vkMs1@?%T~P!{9} z#;)bmy5ia1-4wXmKBnmFwQCW0q@Hq1do$%9u|D;}fCBFHd;{CNVB*!J)vw^^nogJT z2fA3^ZAsR|WhOG?+q!K_yhFG$De$?+IBi`?yEB$cG;LGFX~3$ts7AJ|Hg8X|UQ_>t zTIr2j64DPz8}dA2&h@EIF7-{}-4}l1cE-wiVtD?}O2-HwO`YYQTMg$zqo2d18Wov` zqbr8H&MgUMGykovA z(UQaNVYa$&KA$qMu%#Xfm`eU#fbEah#kz$Ena_waU*iB2|J)mfKXcCqzVn4Y}% zy(TYvm5DiU`P7nTJ;~J~^CD!!hew4&bZjg#>3xm17RKG|FKF5Y;_?cTi9ZzHc$YQ6 zD_UloaGe@RE3#>LPeGm^Dc9OIS&SGy(aOeWzue8!PezRd8V$ym$Xzns|0xD;5V+H76oy@b2^rF{BqLVM%PCZ{LWm0Gm%_OWhI zyjGj-c!@=;!6m28IX2%me~`>Y5jF*CuW8LNSarM;3V2sys?UpG%xRb2H8^VfoXN_( zAacJQ-auyC-unsQTRgRLJ#%ljW^SL_veRe8@qwDV1ErHqVXBtrv&m8yB`6e3dws5W zE<=@&n1f_1(Z7GIsKb>$%33Sy1tpEoxfFa}OErC1TYxH7#4ioR-gYSpS;!dDlOH(K z-4O}#N5NwE5yP7wGZ4YTmCb*-%yrO!{bVRAk5sXOdtotK)J_nC{GO zhX-*MtF z`W=ud#A=hAX-A6<9ecT+bDOclQaQeV|JuGb>(d3Sx;vkrX0{f8VHpP0m}h-gx$klH zIXEmb3*r>eqkrg3(mOiA5}qEsd!5>ZbNuu)ZmXlE6n>QabMRT@TCybh2qNF|f~Q2g zh~&{5ng}tUhmL{39N0+qcrE0Buyos(J`<7V#(8&#EUst4 zR~w060en`)HsL}|)*0TJ>>yvr0l9g?o@{&Avx|XgD#$Cy(J7F28&9$BJxqT zFFxlqxw@$?YN;+>OFif3#g$yMwF%t(xz=r>$n&Is1?vYi*y@v&Uf<=Kz`#3BA?hs*GC*-wkUI+E2cCEZQEl z(=hka^u(d*7InIaQH1;{;gSnMm{5B~_hf{6-DbY`@Sh9BY8!TW>UoD@iA{SE96Mgl z6QG)?WM$?y_X2I4_@MUV=-_p@yWv%YdVltYO|~}7!6d+HW%=AW=-f*@ zG&~^J5Jhq9b!;enLzq}pwPy2DgqrL3H3)2)z`@C6*|RV|44YUs4B^6W4=W>@#b@fT zNZ~c!#3Urn1G&%f#loYAG(vadRK(vgpS%eXi!v}$N&TI<%p1B{Y->i-@p|dI8ZHB{ zT~$wBzL?XM54`iuh{8hk;xbSOBTUSwnzk`tU(Kp*sx5uS8rI*dVO0a+9@WpV75EmT*U$k2^5o!|rE0dp@P)DNP zyz|n4tY^3ioh%AH)T=^2Di~dn@5*_~i+c6#;aUy9z-B#}7nMOS%}rpNgzGbmi%AVC zs?QIpZaQcRJMm|giF(Y3rrH!5o1ngFH-@lAOk3L>6%vOv7mTZE9UH4dKF7|_ zS!GqYwkB4E{hduxsWj1`WM~>`x9h_W7cM#^oC*qJz0&Hec55RjK3mxhU)Z$v^EZ;; zO5TwYHHv`li1I`hrPpseZH%niQ{F8tq;X=^(iqxqp^Uw&q|peffjEE5dI9%n4~F8$ z{IsZ1T-a^yE^dwb#@rmSceqBNxGc-*0xDzZ3*a3wp?O^+xWbE2o5x+z4U|iA@rVSi z*6#UTk3N``{_0!F?0r=I(`c`P3<8^O;nUI4!i_*Cb01aTG@5lU24@YM$#ZsYY~wuJ zOy~9!QT%F8l43vgA9<>!^K#5CP9kiQAuPb{3zY;t z^w50aPVulo7EX^oXTmorGti3T>GOx|ov$pgENl&gXBN!~E7tUdvzUbSO}D;5?VkXm z)oC-1=_u@M^(To8l?#h68%dkQg3vB+{Xs^rgs0eXI8?B`MOLU)D!*!>DLzgM7K=V0 zL7_NIUSFdXLRrD#;KRO~^ultwzcl;=F^Y)nwYM*kf9gS1E>^z8ONr;^bKrSJ?;pY5 zHS-e|6vv{(zKc8WsI|;>-U}K2ITLTj;4d#KEqO8Ezi*nWQtSsCz?SJ-AYI04i}Htp z|E-rFbM7FHYkT%B>~pWGjBr;t9^j@^6^@8aUjdvUIn25)G&mAK+aLm6UATcl{x_(A_dsw$z<71Hcuyd}gNr zP!XkDLG7BksV^nANp0i!#s(OrW5!#rbMZDC__gU5Xo^Q*eKAR>sZmqFYDdg0o%&6=(<3 zZoMPWyo`XjTP=N00EexnW{oEcv!LynCMgbjsQ72FJ4XK1416?j6hpy#oM??_U=o{k z4-Y{*Rt?_n)Bhq7L_{2O5bEFU!BOh!^&4jZUg}*hVF#8Iq1AF~qTh{(i zR4@^!W@hICg)~qgPBMt>W*H2lBO!2r;pkqvT5AP*2WCWJ@R`jxgBc0}dZ~T`=q1+v z(}4gtJAEUS$-Uafj3`t-*PL@OAkg;Mcw=0h=<;mMzW>x(a!eqAf-FwwR@P<_jtTn@ zo$LmkbO6vIf%5@j&x8ubYTJWSb#Of16&~6+7xVl%DH(Lx^rw`PH*8?C`0Zh9#x}au zf?g^Zzw?1$1nBswAk=|<59=5xJ>f9W-9y;8hsDCpY0zXV&K!&ddLjqit%x|5Ak_Hn z!9ck19-t;vsBj$k{f}tnsF8+3(&Yw56&4}D(BWp9vSE5{syV^~qa z@VPzgbNd#64S|xU$M5(Awnn~9fU(K#=mi1Cwc``$qU`d96D9Ph`5mYz%^ZULtGoh# zo`8^;0aT*J7lT$pg#vZbz%uwGrT`#hG%r1~@9nRbzNq2Sb{d=UWi(WeETF$iT+I%- z^i;S**Q90wTD&7uje}KlD27GJ$~GddvfN43fcflAm>3p-j3%G=PWJ5wx2x?W6UtC^ z8krGYwG4NMbu=ZG(U<_SuYEz;S0hMiS$zPM%GsOGv{9f^wO9~`$2Epw5$^}_wJw9D z8#QdfP7}-L7*lGnJy5{rKU$m}MxH4fhw#O< ze+FY_=s;ESTeJv84fzse3dVIr*d@BBhDd2RINrV_R^&c?6Jb1JXyvT(3Mw)rGF}db z>hnNkP9wF!a^nE1w6h$l5tEU1ITyuUfKloN%(^^a)`gP%DzD;ofuvn03Hwy7jW_{;hHeWW0_I)E~qG z*~JkmE!LZ14M6V_^sNHHDk}H_%&|g{#?x#EdblnjBiv;3Do|Vl=qFO)wrav$FWojKI#Vwkd^?u-Hi_ z+FlRDf8J@l>C~#Nl!ciqN_0gOC~m`iJ`m2b+6iopkZMu!>pv=}w%@xj^nClQS=_;@ z+v0JKDvEmA=f!0dO32Bh8T9dJaxNA$s)K33 zSS1?R?RgD*s8oBW7Ddr(*8T2TWljz2n>=1a!K$>avMeESf&?MN!O}b##5J%;lhe z8D^6BHcL^3iA7Ot;5i_-3Dh-d+vu+uS+Le_HfW?&uXcPB*P(7i6rVAL;KCt)JvTH4 ztSnj30Y!XM4r8rAXPiaCS#eHBCy{?W3R<|)VdRu1cU#I@B#5ZVknF_TY{Urcwqt0= z9XxgQ86;%k0W;}E*V#Q`W}K{=B_10`41IGH;m<3o#5B*}#1Mhf)jAs+TK$tXCGrq8 zZ$5xFlO|$GfYmuL7C$gXZoL4JFlmn}o6&H|OCB17MPGmjn}|l10bgKaQDtNC6rBv< z+!co6J76;zSPO~INlBuv)NrM*bXt0ph$Y-lpXCVNPsKMk+-&qw++7{*-~S@mBe;LxxR&@tTB_;O8WuAr{ZJYM z4O>H`iJ zSVe-eT$$}C78gc~P^b}WX~x*%D@iodpT?I>;h7w&UAA@%lT6pO%7%+Z|B08JMSr98 zXPjg7EZa_h8%H(9QpJL$0Zz=})gogoNh@GsFI ziappaQDufBJzJ|`mt4$O5vRRm&>Q!;qg+Lwp@iQr9fsf6!;5Hw)7`j?B`)qZ>EiuV+SEupg-$?PlZdO8_$J1RlFu0&DCuQV(7aB_i`+U;k-3m35U12mb9i8M>1N0NUoU>Q_ARQcYj@Kce5Q^$-NCbu7q0F}4GrGb|mH z9vrOmXiuCTL;d+Q{z217&&fahF>4z=c=8z(%c^Nl1n@uK`r7&!WybLXX92V6Sy7-y zmU2Xvvf%O@g}N~V>q-|Kp8M;uq^SUkQgRZ+!Y&gke6=>)nsH>cSaf(5TD zylLsRA}r-hR!*di@k++?Zn*+Ufn?=0S{(0~hAv`jK&DGp{mZ?g=McSG! ze|&4TpY^tOdUmjG^=heEya=~t)oJs3(w#0Jpy8Ud?rmKNe_6(ANrKbNI@X&3xxL`5 z)nqd(AwwP??g4Cw@*6(aJ`D&akIb0Dj7J_4gxU=YTgC1|=~O3Ps$N(mQ2C@?4Ym>` zjSN?77YD%I$c(ut4;4nYII{uu5C0{`!>G@}@S|9vn~zynYNS2CQ?L3uwo~zbd;mr- zgDbu~4>;(Mkh~~Crnn4#K~AB6@{u(5fJAFM{4sp{p-nkScFixEOScTQQG&vfc<|=wjYd}@@^+Afs~I7BP(?9T6(RO9#WuxwFB@f zHs2U)WZP`t&+!-z@L;M{gy+w2N;S<;nYJeFa)SQmLt#_#xmg6u>OSA+bGb=H{`W}- zWhV7#4`rpH^JQ6W+8pruB7f%Z)ISxp2T(3k-oILbc9zW4V8EHE)FfG{VjbI?8r$dZ zN9I8v>02jQdv@nNW4Hi{*d!~}0J#PSi(fNr>M;;;o3^TZX@79hkBJvJV z?@eA#f0++C*YXH zXY`=$qU%%5hhv{YTgztinTR6Mto;AD z2CrWsDOVNj?gX=@bq_}PEx^4QlX3w_Q@PQiL>w!GdnAjP=t_Un0Ld#3EgDJz5iRS# z7Q9#wq^n~FZXTMpR+vEF4=7T=O=a@?mT?98%OhH-%icLG8JgH+&XI#}t+bU=D9ksf z0ntXwR4}O=q)k5fq)};3=b>bYx(51vNe|$4u0*la-m?Kkx6DZgaO}j|*P-QH&hi!Q z7FGlhM@n6P%nysQoEn*}5KIvgyD`o|&f6NX?J!ZzDnkjx>DDt8= z{H$|=&J&hUi)#kJy5uT(@@PZRMJP;C-7dL`6P(38eTe)~e$Y?*!9b?wOrJIXPhB z=ZqH{?wN6MkH{$kU0&(jCYO5sHm=yloF)QeR$kZU&q+tmsAya&s>BedBXCmP)~;wH z?k>-p7tnT%%@{>2M*watNnY#S^KD^Ror^m*W7q#Q9x8@4?w3PPeb%nlBbsJ4j=5us zZr55T=On9b3@sxh10t0oBzU7CDkvz844Dr`{G*+tQ1rZvaKpY&%;2^D^7ED|C@IfL9HO~4DVNCYPW#G6WMqpbKWj;J{wx$X@@D4uKP~?%^I;WRt|dC^(~%O}fP9HI*@0f0%b=WD4edykw}u*RHdo zoMk-JlX^!v-XMqC%smXkT9oG!e>8GAcYId-s#NM<4PZ+(*;4h0LW^!odoU0zhB9j} zjs9Ri@*0z*>lw9*`@DXrHh!q)B!ff~^?HdWx~H5wHp?(Igzn_8R*fQGFQG-NyE3y7 zep{#*gk|{7P8nb%`V<_sAyd2ri6A3WT7me3wA=S%ByC+dv+s}CgG4W+JsDRZ(w_5A z17fbJQC3K31%S>vwL=TG^N-o(lJYNU2j{{C?Gn>Zzcz%3KlQW=(?Y7U?CqjDwq5G~ z(aOPcgq2|{VDOxKK$Z?5X3x81(83)>Hmaco7Qo>yIzlL|vpys$0DTX_f&0Wd(Ku}nww zuvf-*dT4F}KSdacl17C+hMs8q%+=!VE(|&MU3sri6JbfvPzM*2NndC()vdn01#aYZ zz+Z)fr9D|!2VAQMfTTYf`b*81~i_;DnVq!I-8@@S1g21r0jmxgNjSOd<0a__vaf{u z@=nd$$AZT+O=qkgv8IgV=F@>L@_vZ*1pW+1*V}!4EREgZNrT1%lm%wP?W4h;);@dO zmc;Q?KuKy7ZDRB*>M8yJr#y_Gw=20H7|w@-av-h)b)M|0^X{EC6VGDX@$w2;Wa{|8 ziyNt9w2G!r`U$n4B+LwniqhKX+$OqmX_oS3ODX3|!zSec^>qyP(Tw+cqPcu396FuA zBayiC*2uo1LK$w^E$jE6OoZzUi6Zyj&whO{e*K%!I-PFz?~kuvTDE2*kmTKKGEYZt zs9mkUbY{XysrZ{8*;V#+{l!7dYTD|4#f{Cz{dtXGbHX}73E^#t54+F(h2WI#Ny)b0 zI>p_EE}J0azDd$`-RI8sUjKLV{r>&!`u*LCtgk9-l0T1 zvCsI##kZzT3UucC@6{pS^KU3(EpJAYenD?^O2lHSv$#_;wf zg0Gw_Yw~+Hl$&4jf(lLuN+|sJElp}LX*=K3AHASxh^&RDgHiBOMK1MDpi_HP=vRN; zJn{+VJ^4@;zq=G{5;?i_hh5)ZIV`$taO?|CJ=y#$W_*d3zrZRHvCB6lT-|Ks2++2) zuA;{2h|u|}!o8&x>P~ZPcyyovA4%)WRQ%`VbMAr^m|@2C+WkkT z(J&hD?`d1K3Smu(U@hoN7fkw*_q5&REM zp>5wuBA8e;E<)-brZ5VoKE^Gnu(hs2hdT~9y}rjpFuv(TQBT4&kRpwR7&$2!p!K5( zsX0GNZNucFv2)1a&6(eCARC*$aUS!$NMe7{mh>6H#w=OJku}M3c`QpH>V#&$)AbbbK`{uo&9J z3gC)K6G-FAC!;vioe^Qg&BWIp6BHrja_XhVeWZ9{hLnfq+Gc{*)P~WGm8AaAp_mSH zb20{a3sab{{j;zy+n&Q$V(9hyx`lM;tBn_}ZV~w+mBZWncbbt2#lgCl)jA=k!Pdu36YWttz{@HSyg)5wgcgM%GS#em zYvfypZf`8qsoGt>NLi2uQ@X>8Y8Xl5s{$*FtQX(2((6dVh`^ZR>sRug+WzAfq&pVQ zuFY`E`a4=~3hc$*cJSBqE6{*%c*igJ>$ePV`4D_@`8}jUsSw8PBAF2Szm#@#@V-MF zAB6FYb`^d1b^*MIUMpR~wj|M8K6qbTN9yR0TQqI4u$cjKrZA+fKVYSVEl)UKY9dZk z!P_i}eOJ)s@Pymjfq#!HrRNsC4CORR^fZOBTl%zb#+ez7NkBsBbZo6g&bvDII?Y=DdZ8R?xkHe^^^d`k1Mk^d(#`Kx zl>R~{_JL>^@3V>xSu`9yS$?T>B-CuJ#!rube3whi0$aI>rKe!8UW_>{J z;QxX7aJj9C7EK&>S6#^QsDyd?(MvI{!oM!Fz2W$xIaIws-ve{%W84eFHKgbtlLTGa z!xmyN{BH@vkgk#tKhUB(idOfMvoY9y<6XkhPYoXu)4O^>g@f8cd#%JDohooId9__0 z#OJsn;CdG93&CFrrt%VGtqKehkXJWR?|Kf+;Y`RaA_xe zlzb3-FqJy8TSrraZsr?hntkPI-Oi!3$m>Y*mx(Mn!A zV=O=3E3Moh(VG9{&hr{Y=TzF;U)r0rEV`sg$B`&KUW>#OW;}c~_|)U{bhQ_TBnP3F z1+bbJhJ)9oogdp{~~ftx$K9@mx9aB6`mjatG{k3=CbPR}L_C!{_G zNDxOJv)3)Y=7AM(xR*$Uov3L;ejm?0eJoyo{V74GR(H>K$2(Wxd#iin&K~{ijLt3U6ymnAr^VNG%OgikH?uFR0%7hu*uKv`{k?8FXlF2R- z*!{;Tj(jD*(!O4GBwgHlK?=R#MLK|8rUx!~eMLH85G3&25;=HH(LL!7mquJi(UQYY zd9fCpj#PWEaLJ%^$m>Dk(}0#BJ3>04w1v_jG|ddZDlbR+SQC45zUI(E?*oM=QR#Vn zJp}1B-MI=5MT@-YbvSu&Qz&{V&V>-zRbVz~)ZPjNc@xY(<}M z#Nx|Li)N$$N7!2iR2B5w!yLN1kr0qB>244Nm6nq3ZfOoF3P_hoh?In+q`;xOq(P(w z2|0iu&3_I)&%O8k^nPQ8z31$hJ@c!z*0ReIhGGZ*%Ey;)OJEh=%NHLGT{`uc;}7>I z^G1d$aaMSSpp7xwOSx*NK63Mm$zPhl$C%+rMflQP(fJv0TArElxWQ_0Fn@YV3JqH`<~K4v0x9=u8e zirC^@^j05X<*J-Hziq;+PZF|~7)ZjDQN6SGUb0{ULw{b_f zmSM?!gkx}-S9Z?2vn0b86KHHqG|t8<7Ec)iX>Iwj+PBsJp7(lH4*f7&nu*nKI1wK% z0FgnmwvOfss%n>A?+jHC*TJC;_cju+SW4SA$zhmI-`8wz@=f`@C%5ivph2r8gdQ_z z15^8zv;8i=s6A?up1gWY50|}2CcjMe-3^`fUOs)-ydYSmsntXDCqz)Bl~!N7IM`n} z`tZ(DmTzZ4I4|U~{pO2gPS%~IukZgb%ZU;3dUzcfV5+5q&4$*-gqCo^H)bt$p#oW& zPuWl#VA?cCFOWng8mM@E@bGZnVokyzQTq-NHXcI@*L)+ZbEN@J{JcBjoKPlgTkY_M zOXHO?0uwf8nTP^5dRe(hje6B_(&QBbQD+dAt|C>&@5k?lRIr<+BI~g8QHXZW<8wX^ zB`83W*F0^~(BWm5^&B%|&%-+uVuxy^&=S7E4$EgoREH|eL)=SLA{11Q@ScSvAl0A< ziyA~$2GLKyIry)MY!$Kx-5c8p*+1I|IlslbWy176t%pS3zQ#1;4qW68q^*&0fklac z>R|YEcV8y*39Iz0ukkbqe+{lHBP*|XZ`)Txx^upJRu@ZORjTpoB)Lv*P2AsFM-QyC zNo`GQeRnDbIyhl>DV<`ky%Y8Mo_VZ=- z@c<;I9uO_o1fii-%EuT6*Vg{!mdMkC$>J#hiQR63YxTZm`njRp{T_hCZijA8xP}0Ujo?XX znFhmtKXt_3J~Lv6Wg_FHwW|c36Mf>XTz5Usow^;-gY*ZV6V3BhD!3IwwN|c4Wl2Y6 zC?a$S?E_A<6yy~4aWgWg?0b5m z=wnmzbJLsRKOtqhva(z}vC%zf<_~o`pY`l6|2nP=X}=%1(b4JYS0!CVnV&B6;7a#Q z?Qm}5=)CVO2;3f-nJdz9y}|fs__xqLsy5o$>n~SH`z20)cqEZu6&qbF2ih7b^y!@P zqG-AmW--%}i@;$xsnd+pG9)PA+RaH|p(2^pwT*P#Y4 z;G7+ZEZnniPm+4Q>fl<1JbQESQF_W|b zJw;U)GyA5KQda-LBhMe7ft3 z(BAbcjIJ^cs}3`tE~|fRF4Dk^0v9E~Bl+Um z9-5+09ZxKv{8zc@8%!Oa!e)2-x52m>du%M|ClXL@c=Ssv4-;YyjC1gE;`&}uC8t1~ zs0d>S3As&V(BKp@FRtWq_&422}4hP@=}puVSL$8p7RAdku9!mGj11+fI8u)%dXjb6i?dxWSH zzvp9Pm5LGw~G<_Q>AKI;JPRA`L+FLE8 z39#c{Z0HiNKZbniZDv3t3>rkqf0k3iP(6)OXh2&QyY2wJWe)3-U1@`v+Z1Cy= zswC$=z6-!E(M5iNZO1(>ibk%u0d`oiN^&eOb`8P7_qy!mxyb!EJnP;#0w!M>jIc8- z9+}lKmEwNr0fhnz+0(fYGgojI{{E@eDvyYC-%I_j-Tw%y%l~23CeE#Z-r2f$O>(w z`3`GYAHHZ>D>aCA0aO!v>KVieBONl|0mk4)t0T9|LGH)rL8%Fs+XELixAxk(?9~5@ zHf$75yK4p`C6wq-Lsr6ML)o!~cHmMb+{0zWNQDeSUkbo1&~f|m(A~qGsLb9F@;wf{ zU|-=wL*GCTZlXc;XrUCcCh?)YK7GN+#$5p{o)(p3zf~!vq z-9EaB-@b+Tb+DOefRB9nPl)_2feN;AVwlxUF0Py7q6)i)6dHdK3|e4D%C3@*EKcB* zjf`{GW@bb?LEU->QPZRf>=gJ~iL=ab&o&3A&-)N{izAS8RqbpUlm2y8?Q;*d2wsj9 z$0ggM2$780iKW`Sn`VLl@44CvakiPDP}>V_>^*kE>e_knJ7ADi=cv3dc*^4MxzMU& zItIQ)5U-$MK_xS&5-^NNWOtE@P^(-#^z*()4TkQBLDe&;60u@T-+MsWFs?RMbj)bj z(MpSvlFV&~T$$Nd5S!%+cMjQV*Pi(0M$bt=y$RvBv{AI-I($!tnQahBukklGBz(tv z-iWz(50ntC&EHcyE!zu{i#<2&rhLkIx>qjGcm-n&thg0cCAaO;v+X*zdSm;1RL`Sb z1}A~0mdV3%hp`*z$}1N)3R$J1`F6adnI1$g=o=OGVi`cr#!0l6bB~|fQ7_RYXLw}u zXrq7Xc`PSRELJk-XmrEj(s5q!$sD7q%_HUk@(S#dBr^k+xi2nv>nH3uv(|_|id02W z3f)`(hvHH6lld(R?HBiwE0c;d&+g)8{M&mrS&B!D5M~5wkN30*uEv{0fyRIUnT7GX z$ig3dGUc0n`$PT1HW`u2SeS?kqyYLI%8T`xUADGW6TB^ry13?`rFJ=VhU<0of{-Nf zSDYv*kOLbeEg2Wt9ovz+2n_@2eZmyv6Ky0vdJ%?$n^cT`0G&<~VDaid7?^{6yIPwnLSSoVS9{ER;hum6ub_-%=vn2&@ zkG$B;Vn_-98p)s~U`hlmg)yVqMe`NHa*%PNV5$~sRPaz-S;bMjIeLc?Bx=Q{RPYjF zYTVGX^BKFxq2Z)(6}*crt?-}%=#RA3$Dw{TN|7s0L)dqV<|jEBMxm0w*4v1kDo-1H zRM77$^W--Rf@NZeYTyj&*^&ieYOu7hCinzgKtCVh{l6+&9|jvjpvlJeRgN%d^exqS^) zW?H<1Kp%#WA|0Iidf|r(0^}vM2><@hnYXiee&NmcIp)mbwWJB*uR+vxhPUSTFP&Oi z!v(j)R`e%j)kUL<#;dF z24gdjk)rS2B)x9#EY+WZ%i=cW@i9_t_||vc!P7RvKnOlzeg66mo@P8gA1u!dE*!3M zw%>mnZLD!G5r=W-oM+Xw^&UCt&AfYg>V)36;>U3ob<}U*fHPKZ}2hLZ>V1RYc^TpvC>H z?Ivuj5Jx*5F7HwPFQ5j7%PM!DMHYPShnW$}B?;M83E9eAR*!Oo+Md3okI9z5I6eM` z$Q;_XV3l3iclVMf+ID>;^_@DwiI^zq)RsXbbXQ>lVBv-9hpNGE&=x(@nt>0h>B_iWYSOUB7M1f>20(Z@_oVg?$m5M#@${4#O zoq60J%84bfNfsQNiaMQ)R9$jq%vBoC%-|1ytXlOTlps00wF7ZV4r>4F%`Fd$R_4$d zRAbc@7J5Fc`s$=Se_{sCGz_aAa;bpMRMcaum`VA7%M;l$ntZC))shSk>j}Sz>yek! zi%Xc_?%%`wgtUMzDuEd>fJG5vKX4#q89#Z>yW0x7f;^kC*T zwJ!;X;8^et-JReyi~zu4G%%c0$IjCBkBX12-etA=SNF)@$)70}i*wk0-F`epX4`_Z zhBxHv8*Xd(7hyc70|3PwC`a_nBipNE*r#P_7ek(97gAhNtv;aC zs;skb;fCJ?2+mTd)ZYyGg>5biHwTal&Y>}GSH;fK^^G~ia3GL+-R4vT?r;H31)cv3 zZ8N;@QE{RUsmruQa(*28krXDuWE=2|zx*UNPmg0jM104sR%tcaD~%oEdkD^h_2NeVZ(D0bV(Z z-ccOKIj90jIYZw)w}JV$-7nozI~!S;6b*miBw$jD?5f-O6RcjRf}>_wi@5ro^@}0h;RJ999U()dd00ybVmg z{sD)T3M{Yep&nLiZ{7fFHl{bHsACCr4DOW!?vaIQB*^A+vas7aU=VVkxP z;@}#(-7_DUcpFpcx*7s?*0WPPHmj{-(&K=rmP-4y54CnE=KsQM`j`%9$~Hh;LnWs~ zmK%ZCp0V7AzAVq)sYU>x%exmKoYhZL^#NW^o{&q=Vjr5SU;McIF1be+khWVy*tSzm ze8buKQa{xjR77Q$)*#Y*eWm3zRUEszsfg;4dmZM^GkE%0C#55ZQj;vVS7e4FW|1>x z@(9@9>v(U_%AP5EifB0omd`Xp%D$LP8-l_S!yU7c(>>=P0MM9r@{Yf$o?|ZvsV`ds zA&~ai{i@jg9HZXfYb>p-9G0ADr=-#3+6+J1(hb8&LCl5*zVG==XYx6AIX$(&YK#&H zG>VPyabe0~{52l`5HHApOq+tfKxJIR0#^w-+tQ*BDnKGS`9SKshx-PLFE|)k2m4+j z5+mPD6Q()^J7F{-Wg)CyAfp)f(d^w&rTRY;agN3|!!A@%7Lj9D2qQ}eOQY{(!C91 z;mV4Mk5YgSUbxFd5UnA;*-=Z;wE>)LQ>fwxdbsXehWv!#+sQq*ovddrda20tDiCJu zYp9|*p(e1Y&;0wrCy6asM#1oW8)E}IyivY}Yy55ArXiB5ybOaXr6O_Cxv50hPjT2__u9Zfm`Sp`1|GSI>1k-&vkM`8CXgc+^tpK1LwWFKvz77vgJ~)dqfi#v8ZC=ZaeH4u%8)xPjWCM)$ z)r^!EWL{Va2e&MC%#F-vJO2a)o{ZQki0!f4bPekIl!fu?ZnI>T{?}Rq z+hb$zqyGES6dv0OXNn2oh+Ve(F8Q3}K?C-K! zPq13%@t<0u~#ji0D*nuCm&jRXyrD(07utT8=)K%?|Sdj0fAbS&H6v8yI8TJ#= z_YM+Y+YuDPVlIMBlaQm^3LuvOR*Zj?*x_?Tqz9qd&LaODL5!5ULq!?Dp(e=9%xHvf z9;2N8?N`)D(K5RpSJ(Jzf`N#NCnORK-CaOn2EW-DvuEzMZRquc9UhM% z`xu{9A z&qI9ZC>jV`{I?HyVINdNlk;`%!YKEKQIf)A`sM0L+3+#Eh4p1n5@?1|Ji=odnt_5R5jPC))cX1;U0pr(~5bEn|&VIWZo9~+e zD6sC^J43X8i2sM9nK_HR$=w_qw4^!^s^TNjqywd+6zJZ!exth}Kr&Yq`*!`r?JF>-$~Sq}ThYjE@(tS}+BbvTGpI^wZ7k0HsSdco7^#&Hu53F03Z(QS zh|5?@=iV&N6}FSM(vR^d^bUpXC^^MXmCN9a&=trMd{^dERB}R0iY8yGpL=9X2s%Ya!id+G4H+Bijq`br3xf`Dvt`$ zm5<(}#h`u`eE2VXQh+`tJa4H2;dB5|h@S&wb6>T`8i1n$j!vMi%SWHrTKUCYm4f`} zf4iErV8bNRCd~w?DAS%uzdCAzRM|Xa|1dnq*OysUcyOs9rXht9=^fmmVg zLvcTlD1hnhuh8a=&7fe1VTG9uP9p8sMt$E`n8pbp?3B}513cL^v;i$yR%8$> zEXbotApOILHgHu*5_-xG{cjt*BXt}*kAK07|1*p?WeWouoOuSXAIJYN%!)maBsA^j zkrsTfmY4K~f?efjNH%62U{e7XRFFr(4nF9nM!9k$6g&_tlM`X!-R{8w-@SOum#2{U zuX*$d6o3Bjwa_P!;wl!b`~y3rUmcr12vRu1>^tA;bpL>}it~2;-I+RMkS6qqyGTZH z;|dyWOvu=mioBa*8-u06Ewo#V#OM($tH^_yXsHH4t^fBGF)(gnC~kxiiZzq=D`CGc zpXNa9e9`^q5TYgq#i#6fq@pSi)Xghso-rXC7|o`$2>)N8i7@3DCCo!E?;Z#gOd7w( z85XAiVLHsgbBJ6MgT`BKG-JqMcI$Knsc0@T=;C8wqd*;WFO>Dt4%1qd*1^{qgP{KG zgu;xOk$ayVWz`oGQYrApKrAMvPI)UFOn_exwA;wQqLtHp8(<_CGZoNAKBzTb7ioa3a-d3-pCukC%B^f ziF+Xioos0d+&EMIwI{zB7*#1Tn6Z*oX;4?#xzHg<5q|FS~M4ozz zR5FgQLd1F)Zj4n$YP7ORWn^}QYUjm*#C!<7=T0mK?iBcNG`)Hvv5u9fEB)rOQKGNu ztkj@2J_Vr6Q5*Hrjgv-ZDjd)aAMa7 zp^^{gh@6yRn$rkz}EK%Hmy487}K1tHQHPle9hrkvobbfptEggJjwBFrqgR z!;0D0Ir$dvidY!D$9||6s6ZZu8?&1wXOWBE3ycLgpEzI0o{3NWODZMmXu6HZ;VY~d zj$uJ1Tz1K5vP26IP$Wcp|2a8Va82G7@PH{w+Fp9;$hf9-r{&>gn@rpy;_Pq{h*cSgAG$2j_X6|F_0uQz}6S>`%bpE z-m)e8u~uGYo!{xJARl8`<2MFwZKyZ+yvghQQZe~`VayDSVJWD)ul#bzVcx*ePtLpe zjYJcNmjO}qP2o4Iq~z*RMO1l_+Vv2@X)tKeLiFbh`g1_wr z@4|v3Ky5LsENV!WYboaO7a&uI#-d%P!>CMt-S%GW&cUDz@EaA%OVMLe}?n-9-+Z-DoO{Bb{MlSn2~7H&#=q}9?n&) zbE9QMTL>-LF}%z$$PH*ZJ+h%``Tn}fV4!vWF#+NA)(_@=g+FVGO?v+BgH?a$zy}z* zGf7uohS8$b%!))rTWVivFwq6A9QLeKJAHVF^?Kvo*$kNpL~b~Y!Qolp+3^0nhzom> zbpE&EqBbFjRwB|fUz@`?VLXP*4#VPu8rISyRS+*vUz4idJU)2c$`f!#E}*~r=f$a_ z68At`&k=fPbH}?P*RY1tWeu!gj-0pGS4}^5^I!2k4F96OtW?Q?pSrzUEGew(>yp|= z&_SZ>#(cJK<68at%NOBlrN4&|>&lu)t6Rg5FA}byC;nwwM#k1SB>PtGADiM4A&55_ zzM;Xeh1LfgW^8!E{(aU@n>%R#*p(%-_`)*u*JTk*t~ufBrPuN z34hCv{+6TEf)UY%aG(jxMGYvdded{DITRy-@4Tu#hDn@658Els%jIzurEhF1$`?X#1dcDNKxQLMN>y+4E%D^gc;}JghT)Qw@RDgGiro`<2kY-)K%5Zx) zt1O@uPJ533lT^eEBTvz5<^Fug+WhJPxg?YaP^HVLmic3~5lY^>_dbXuK^|^6rUs8( zF>hZ%-@8nXrp{A=bE6W#!)U73pE2$n-tTB2l+;mN@+|ukglSUMj2geZ@?l{UBk&Ci zk@*gBAWlcu^RulPlNQ227V)@BSu?kRpd2`^HH|K@l#a$VAEjMB>%G-F6@LJObkS#5SMt3%?ns_A}q_!1{-L5kT5GHHS$|4z=!{27&@v zC027G;?FrqNDm_*^yCK74CoJFLo-XkZ|0UY#A&nTg@=AyHP z5A%+IG`)?C-W|tst0h@MGTP^3n6D;Gq#eA_Gay(dMrW2FPoy=jaZNd?3J_I`*XTC^ z`Nch&LaBR95s>+}N=~n=Zr|*M?qjZ3(<(pf(i~{J*<8oeO%na#9MJWL?LF$UJRD92 zfM%yrzfPF2+9FpzsL=Mc*t<$9zKne6 z!KLuCM#Ykz-b06KWnPNJ0ci@1)TVDhi_rD;x~^rM2@fLx_pur?>R7J(PV2Ah#sS=u zp~mU2n@sET&r?wBX%(UjqYBLnnmw5*V?q3o zV}RhSf#bt|=@NcKlT{3Br`8^z1~r28YC@Dw`HBl5Wp#48hCK5P^WRw5-W2|~DPp*& zkSdI)Ux-)w&10ZVbD>L%<9}Kc3v{Ib=EmWyk(vhBw=suNbr%H9QiV$%gC9}0Cs6xT zi^C4?710znTENv^ko@m|h3#`cJkG)>|E8>K-(%frzzx~FLJ&Z;<;Incfg5>ZS%S6$3dc_7OD?zo75F_f9t~=J z^zt#5X{RUuICIJ>n+ zp|8mOQP(!){9|T1Z<-QZ=6bC7b|B<@>GtAe@^8p_#Me!kui{T z>#^z6Ti64B{mkylCqFZZf$$PZhCvkDE-N#-z*yH@3}*&%fpu)FU>B+O7)id`84Ml2 zs;9w`fA+TupXJ=a(;zYIaO1BZ;z2wNQc9{q5@rJk0ND9Puq@rB{cJ9;4OaMYa@2zU zB%Z*ZTG9y|vj|K-QADS&dB95?;4IBT2!<@Ro>d1%URJiNi z%fMr+?3h%Cm0LnkP$Uz|KdT-RJ(S&A-o&YPhg*Y|>| zN^6A;?O#`DNo9%FO5$BRJ~vBdcugg&ApB{FMXb-a`WQviQu^&fw z;Wxq@2{q2s9OT=p%Vn2;#Rhp&a>t~yzN2{PWBcq0U&!+wLnKy(#_n$FgsV&;a1<|U zENBF|0y70|FzlcoSu)K%eAUymmVq57x&}7)$x3|M_45mA2IVdEuI*Dn{WjDzK|H`Ey&0$z7oqAXPv=?5`IuqOie^EUy#yJSA{*D1YeoNbf zYJu|e*lS_~E!kvK@U$2G0ra36!~2~BFz9SvxYy^NXr!YBfN#TyBKmKN7$dZr(LGFH(C z$~^C|W&rVPeGSz$a7;M^RD@Hl+-A87NAPAbH2~mc2Dwci z=lcz{2S|FDUOC09fF!md6qNHIN^w*IA|Q)|bFj%g6%31ghY$z>eJ8Z8k0bCM%{=jq z4}Ht_>}AAyl}JQ<-6P7x)A1LycK~o><0vBgcv$UfBK-O4}O0O+&&^6C&4hO4^X&P*tDqrI8rg8h@T}mj@X=X_BtlDb2}6@ zhe*Wv9Qvw3`jU~~oxM|`Q=7G~`*yE`|otN29n?O&9)O>EX99M;p%Al-&(Ec!UXT2~Y8 zx2;lGH_OX6R~E;&w&|u{iAh4P!_P1KZkujo4rfo6e-ngURi@`Y>brUNXYlrF`KD_) zB z7^bkSvfG^Y224;70oKgS!QuW_Z}2NztQfkNx4J3?k7RECkm!zyQ~3!T2{QS9eQWh| z&?aj6@|ynALx5!ZrS;E|VIK}UzlErm4W1u^1oHL{!uM!1-W6fJQopYGGS}VXGhn#)s%c1en z*HtC+nIoh1RmTH3fi=f|5=>#UVkBvT658{AswC>f%uq`QueXgZD?AB+NOVr?0F>rgiFtk0r&7aeiA;wM=w*0|Tl zy{4oxDDb7_?DBJpC$^XMfAX8&4Sged<0w8qp>HF78*VAFH0oEabPS%v)+c=n2ODsE zIHu;8ML_5b@nUQqi|Up$%{SF&hmzL@O^B-M zQVrhLyXrZ8sr_jK#Lt4qMm6Xq8!- z0y}iQ);|TU_0OH}F6=|U>*ddm*o#;0^YdHmT^+;HDIYj#7J$P#n#t#lAo1r%n;ZOh z>}pk~_h`hYaLV-T>m9Q>sRIS7=9&-eIZ;dd<@grHJ~_pOqVpzRH7|mEdRZSx06j5} z=%G;?>^Wvj+JVt8`?xxDa(&T5`{h5;5C=Dv=!_UT01mQy(sYtUK3}pcOahB)Jr5nG z%cG#q)VN~$q)lz}d}@D=j_-oyT5dFGT@8)N%ZLAev_QMLH$5_53;}&i0VCGCujVO6 zjQ_3zu5jPp-^bRwv&l&Mr6}cB9@+t!?*^xQJbY1tfN0e>AX){}qV*zf`#vh?Q&dyS zNnZS$Dn{EwLd38lpdW8p-f)~6)vm&&=_I>X-<(BIH$ zOLqCe@mV+3e|q^03MFR_P>d1#?hh_lh4$@+1(8TRJj^hxHRzhhHKmgec=z_uKG%D`v$o}s$Xc5z zny45-_lep}ILMk*RkSUtIga5mH#OTrG9|iT@k(-u(6DdNWS5b(ibxJU1Tq9n9~Hfr z6agFMk4Guj9YQSxA@OpUL+^uF!a>5fWoj zhk2SWFzWS~6j_X3*>_xj6HofIm_gmPnKyk2w6nzZ(?6NkU+$ev#ZPL>;GMp&>La+; z;xgS=pIp)j81*3`HsO_2t(KPF4(zjUM;*vfIc?j9_`BU6buC+J{IyY8Et4I7a8;KF zpWJdK{TkeBXRcd^U<1MKHtrA21$ZO3xqau-s&p5k@u_S5}-isFs)_nfXm7rd@ zMH4$ce^zdp<|SE7li+tdX(O}y4fp`-nO_fBoa5;t>1CGTS9q(IOo_Eiw5k#G4}f_< zv$~FNL*_3i}5 zzTF9o85Di|7;jCZVB}*m(kSFgif`+U`_=&1GnTGn~;&2x) zrd(gfFZC-T)%;T(%S->{di1Sii##*2xM_P`rYt_hTcS%?`edoFn=o{$rq-c0eU550 zReSkbH8z7?9Ox3dIN353Yb|f25Q!<-*zUgrOo$nu!e@}uX$*!*(-S{t+K9ebdd2T$ ztzdih=DP^5^=n`D4`d@Nd6(4lMtUmXj~ue{C+XY zLK0Bc7{v(CvSh;TN9*;Qj(0=#{1u!lZ|?xmC(-w1J$CaB&ebh2 zl)R08DS59~^;FRu&PA38fkF?sfiR|P0J$3|Zi*)OT=;&(rgOHF4n*ALPPAyG)&1c- zzoyep6|F6%M+{quLkVKv5z$kgC~jJCuhvt^l~yWdK!5xbDJ{m=r|ewKn= zcm>Ubn_#qqU{L_TGf1UJCX-;34`TVbFDDrw$ATJ`NR}|B)MwmSy8QpluhI9YD|JYPd#twwpF!yHe*h!MtJbKaQPDeyS2LV?&4bEF-~>%TNS^FxPzjLSSiVgA zh|8@I^6CQ-`NM-QM!;J7SETTVR;x;22IO_TtfIFge!#GKeMXndGFe?Pwmzzv)AF?} zispSlvq9Os?GSKUzwI04GS#%mz~hW>_iM9UAWpwl?)T#3KJk=6P^1Cf1Y(tXS7dfV zB9#S4VNKrCvnrI+vuF#?#-Du2#n7xAXWzf~?7V+&xV!IMn!NwqJL8f(F!wBbq#y4^ zki{!;wdIl}2h073)|T^U)2>L}pIu=*#6-0V2K7do;;2sFp|m!j!k4P_JVpSmbjo{)=C=+6zq=Ut?XFy>Ar1Icz9_3u2G^?qCvS?Xwq{NgMH8gI$zt zX=`$;Wvo4PZ_WF++mR6+z1Q34gi8gF1AwNTQ~Ew$IUykm6Uf zSqFV97zbC*L(`*cZ>((R&!r@~-Uq{nx2AobD!P8MGg$cDw5jp^gXFw;q`ASnu(U#} zV@mlfuuXun!$5jCvduP4`HkudZ{D z420%p^ps_V|Ga1(QzX07DRbJ4CMfL={?PmnS7sv0RC^>y;r#UHSc6z1f<#J1Yp;Rh za(cX(`Kirz81FloF^W6x)G3Zrqx2=bioV=N+*Wn0r~3b>;pY5hP8S1i%Rclxc}TU; z{V9XDDB0;V?saJHJtH`MoyQ(*+|WaSYN6R)ZuCD&1q=p#QY0d3Sq5oEHFa}8ad2M< zZXTp#0g*Gyhd|27Rd_Tvq)rpTi=Sjp+h7Fxl|-^X=r#g5tBo%4-;;GT?=VlMu0QS* zE1PeHza*CVV2=6`-~V0UF?T${MQcbM)^aIKK_uC}a^9CktzW0GEt8|{`L_XFZpoU$ z)WjljJ0|a@)Ytxh95tIqhkG(7w&G)dXz-bX>3$Vlbr8Kj|#}4odW_}P-5J4P(K~cmb@`n*D0^(Wh5X{TRdnD;Vty-_lC{ zR&%u)_-Ephn*U=vjJ7BY4$#?86Gku_UDv^y0|2G@7w+uDvcVUgy1j-7Zlf4ZBXiM{ zPP$VpA>hJrKc`!m^nAa zS#9q`DeD0?*EeEhpBr(dfaE3@HC1!{2X6K8`h)ZNGP@pYTM@tT-zv(*P~? z*M)oIRN~}OZ9&Q57f~h&gh1{Kbkd9?9v9&1qVj>mdjQ=m72w4+GR~>9Xar<7=T(KS z(!((XfO9+R&AZgcdO$8UcJ7-Wo?$HTSVnXhq9-BYY0j0fb1BN(S=QS7$um4WoFY0 zS9F&mw4)Q$wUT>TU$G3XInYb z3Y3vqE$WX^9v+$l0ab)Jw40f^gbY3jAhEVJO3T#^0lG~3`17L#U5c+J=9~1L=(p8; zg2S@S#k}B(`ixOXl4nH5Zk!ysxml8z2{lRt@g&s%ed)(3HE zKNk^_er0v>TZya(*)wyYo4so!@gF_cY30Kpktzf33cq&)-+Xf3be*f>99%^8F1{=} z*nL^{AsctZYWsb01kS;~VZJ>o^1NURKIAHznRg>Ov9Nd_^yTbOZmYPnxujPp-p^FB ztpz~~o6PM$IX`yG;94N(PQ5HvnOwJC!0)539X8k{ol*^UmI2yHv8H5SpB%%2&(u84 zH9`n`Bkp+Lc- zeYr;K6LR@-&M1?*XeZqB^U#wD7dhji`e5wn0GFE&54vGnkVYyh(Za?$ZB&xFy7+9oqqD=fcv z2I}{hA8cr9h%FqaF>mNz>GfOoe{8Ove3>D%p?jv+uh4Jl_@invD_vk?8ZE^!K)O*! z*Ed;sYrhsrxcqhft_9AxpadD@I=^q{DX61LwQFG!E^Xqa8E@k7+FGP&mOzSA>bGmz z8b$_uW&C+%4_?kBwMdQ6xw9<%78NKp6`>gaf#;iQPKCAo6V#RvJ4%+4|DQnnb$5F7pQp5q9sm^o3 z7kcw}!iO~*&4GGLMdMcT*>gyJ9GbUhiDu86`j%}jjY)mounSGP3jBULOSvWLoroHP znrp(Vl2;^+d35(46YQ$U0(f)s_R|9m6j?`^C+J?AarW~|5W7FUN$#$(C7cyJV7-Fv zRF5^cTjZW3mMoYB{;*O;V|MdY>rQ{5M@7Btb?CE?YrB{B;yQtrc9PnOoOuXxUb z!#u~V-3F>=`CqZ`1xP(Yeswss5*GSwDoZJ}9rZ>(d*wiI{C4d??9V8#;|k|GC;Z^A zBAob4(8x%Ya_H57xoe5H*QN2e?FmJxErt&rEg$p?t{qExtwKjIE!OT+eapn);)%gu z`egzX6f@y8rEGM6^hS8wl{xb?rTgnIgVlG2l`y=#KbemgMxDy8|C)U2s_@_E(v9cv zWtPrPQg^7nC74Urkrg~F>kwRr^+`HAr~U-zmsc6l{`&wT&@x2MwRu(qJD@zHLb(lVNJ)bg&$qC_CH!}N?@PRxaJcVKTmdtc zAR4ATdt`cXwFm1Hp}QKTAt(>66q43ndD)y0=Xm8dAQb$KI+p_;aFWx(Ie!!Oye1u1 zY_MJ?T^%U;Ktw?Ud}FrZr(|!!@Z}!%nL`Ur^I^h^iclKyHMni{c>$? zZ=Zr`UVs5xFVT+eZ2@;C!klM1rME$vr%5vJ7d(Ij z#6HpLpur^DRH4B}A!0P!ncJW4L0SX#!@BB)7By5Fl&P2Tu_atFsALU21*yJ$Qoblr zVJK)vvX573f1xcwYoCwtHsa6GDk-frODi5?DM4Ypu8*`svLE@Tqp~%~{yj>*S?rsg z-jn)~QiCyLxBF6!`d^%48bW^N&rbJaU6&5jn+la3^XTHf%t(QMO8XT?OKE%ZUAKSs zemwPrmt3Zs-e2O#K-wd=1$Bx&BmP}}UfuqdriF^(k(@M1I5Dl|%B#?l?F!hzoGpb! zSsy35v?i@;=<*@Cgz%o~tm7OBdj3ZPwBWu5K`3wgq-nAM+}n46?5tH>w`2C~U*~gD+rHl))ep&eGMh^>N&Hlnm;UWQN4*8@679B$ z;Xo|w?C~OoZ?WZ*KXX}CCh2c2-5VW&ln+MBn2*qK3H@+UO9pdMb}=k?4{J$>7WK2` zhb1iMDK4AIYjxtuABL|UzYtEE`?|gzV;4`LPS08>xAcJQ$h+S%Am-e^XHAgsBvq&X zCFZ#(>?Kz?PSjWGFYfyWEEueFL$YFde)#YV6!pI`Dmf}{WTU%8ieA1CJZOH<{(6c* z=#Gh5|LZf+014JtyTUAfwJ%2EMG5 z;OZigcV7H{sQB|Oep0hN2NC^~=ts-yzJX?!q5~vN+=y9k$_KA}xy0hf_*Wrx*}9eA zqTlqOP438pu|&Sj=yNU~oYzj-HINUy-s zAt5Qd-svscE(k(3|l1qxxO9=}|eY5!cz3=;7*LQt?p4mBP=ggUTo@egozGsYs zwhHY?{o{7A5O&1YbnIL&X-hPnXgsIgm_k zQC=H>hzuwf*lp?r&6&%Djd}*O+WFopK-ynFC>P;&8>N&)8N7viuwTw+dR5*0%RS$k zLQC1Hn!vb)U>fC>c*nNlz7+*j^y!G*%OHt0Jh!x35?_i-D48qFi7dC@SIayZ-E?QT zy1I1VQY<(t<3}Egx>dmCRgpTC@c3^|7rtpj`I^H4bA*y zB_kltb)vfOh5o^4zJH|+|pllTtZxP72((>a2sRPSje!uH*$2hX4h*k9qzcmfiRRosCh%8MXEWVigR;6ltqd?!6s%tx zvWIXnxc3qs7IY6-$5*s!xO&yJU}W{#*DU>fE2Z{>qF1(+P-L1(?TTTZ56OB=vEzEA zp82|ZHWc;qff9SXXAVU9_u6Vw$X2SfY-uC0x>8d#Uh`rYu~*$ru#*!jGlx>p9BlN* z&cmQNK)a_q+-0x9+*S105MTLT79tdMdi+DIW1@8P?#@K(ie9gO{<#WQDb|~$6^x6q4zVg3|B_C ze)$177)Ty*I~B%Yp&WLDZpg^tK&jSF6NVz@-fipF8ndXE8-j*gqdW}~A)SQo1skPV zYI1mg=;RTQR2a%!*%LIssV-oCF5p~VehW9&)BuSNrS>*=kk2c?G_Y`AS+T{5^)x`j z!l@_Cjpd2L$qliMrC$m5G$;dw%uy9)o(e1?nfA^=?9tOx<<8SAPp*LE#FW^`3JOB&|v;ENz6Wex#3(#YYAK zE3swW^?9{VZ}Q3K*p1=phQ>3?dk~mcKzc+2TTmn4m*urbehjmW8ydtr*L@XYk-iG* zN~WnT{=@rwLf`-VTeRE15}3^epOa0Z9vZ}pQ?OcTFGO5((Z-$1~c z9g@sC3HP*2G?^SrVm)!_8_Tokf2_*)aa-co*QYQu|WAhey)M7}NbGYu27u>5RqUSB^L9&VVQ6TW^(&0q?L+BtCHHUIo zWPkaWi9n6fM1yaM2EOoNO4RjbO(LUg&29jUdsBmC9UovXyx#jZA_Wiv zq8Xx{ySFT3h&L!8rXw?9z=S>FAEN6oo2-;bC1Q4aq*?13Z61$TE4LOeCwuoa#hx+Z zCO3ABc8SHr+c9CsDD%Y_oyEOLW{Ug%vLCapYS6i#^4WfASM(eIWoCBU3Cg#;SC82? z)Lw6SF=~KV`^t-6>NrMM?Mt$WxVbH6zh8Q6rZZ&K`$%W+NOcKi25DM71P+i;HhcA} zzVt|Wz&?x1!Ar6V_h6D}gArSN^e;+hT$vgjXFfGMwo%5FKzS7Aa)UG; zAKW%Py;qWAs6Qy~awROFh4Kg=?~k@-foH}U#z>0@PKgJrJ9vaqGJO?j8t-A;N--vg ztvqnKa&=Z{lJbZV&nF|NP%H?Hns_&bOm(m9p6qUm>jNk{uUC^67xpV2)E&UqmB9N` z7E-)f74AjYvN(+|xHXd3IrX z8Bt5}zK3zv&lsTI7RK_Hr%Ie+s&u3RPN-|df?sO1#-{!7hM*DNs4#V= zZP&2V;@>(Gfn=}SAwQkLu<{a@;$_qzG77r^)`G9sUT!hNQTVZ86B^vdBSERRI|=sY zEq*zxN=$?Crur4-`6c+KfGGUk>`yiMEu2_x$3x&<& zI*rtcK=Y4+d?B973lWI^3i&QoQlVni0$4;-O06Z{~0F`Qx!iJsCh8C)3 zF&FM_tjN=c?HySqkANWj9bNN1Z*uEtX`;n?+aq%;PH-?A6LhcLGvx@p8WVQzZW?&c zl&#?kV?ZN(Bb4btcNQ9ZV0(`M^j^ws6~ao-K^bioF`fy}_T1^aSYIL{JmJlvE-#0> z65(i2i4Ie)#oFgIoD~mNcm{r~%$Hm=qs0SH(4T#o#yza6W+k*(_c3KYjD)0Gg(u>I zQ`9t5hKZw*jis#oF(lUL>|=aj|0~gAF&VY)<#bXY#<^CvS^Y*^Pv#)GVf=Ti8ky*C; z6!WPK)bULEXRD|J-}&y> z5oNfa8T4kr82aZ*cJbjdlcy;2^E+(pYbrM6+XloSGAdwe4XzzKD z`z$N4;hvHJo7e{)#jJ^Km$!v!_Jx`JPZ2t&9{Y48I+7YYn}~=g_XMvE^t-62@t}}j zqId-OGSk>Rts}h+EwCo{pF&Z1)%+%zun~v}*z~L-uRw7d@&6McxZpw_yRuMeg9M@? z+E2IV_g2Zzmv}H?5P4V@b>CRL=j;3$*T)yPlJ+~n=Q0ZvJ$HHM1YEDaWtMn5cnrAr z*x2&UOO=7Mxb&aPvN8(65U`IShHl;S5R!z7&Dbx*ZW@%K<6>RAYD!H-hxR>L~oIaBNX%;7_1N^f_#}A;j$x= zby7n!o+B%X)F{SD&iEK&`_Yf}gWsUwnr4zSI)>ENWO{{6xX!WzDJ9wqvBZ~rblLrd zFR&(>I6g{F4wdNG*xk+=uq!uDsyolvrxzlvqPFEGiP=_hE?_BYT(vQ~YU_ocFZFf! zjk4EfPbOLASL~o!gL-Mn>WZ?a=p)PF{wo~_IIxgA{I)XHlW>@VAT;kSLNId{7HE1W#w3}qJZXY)9~?{MMQ z7C#`3?WP6%;qu>Sz{llBMA?%u7#DlKm69=hjh|h{shnn4iGHl^`e`CCZj_7XVG|Vm zuMPs1VV9)dLE!F*|7!fg2dHG&Rl=UAmw&1W#JsN9dbhAayaIu9RDNPdiH@>nL=i)e z1~_nHO={RtCN(y-I_~oNO%>xjyd} z-6k0=Yg|zT`cH9x`)SQ-yVDHK>`I(Ea;D61^9I9MS(3scntNoXR3!ui1_}Lw-4msZ zg~elwXw7CRp620O8Q{}bkO+#x_y2s6_`MgyIO%|5$@rD%Vs2tX`|Pxll)#gtbeJPU z{n*MnL9>$pBdDlPy!`?kh$~h!%$1@3)Y>{hw=>kExM7QDtDb2L`nvz)=W@YruEjQb zz2NGSCkJ+`_-3N45$u0}hHNDpx8`Z{OaViK0QL?HSLDBr3s5425v8+;+5(iQA z>(>gVbhKklbwdjtIS9oMKG=G&l-CL>bPPjl9^W8P_a2)OK0~^nNgybJn0`0AnC2@< z{U1%h-?A;@`50Q+X6Ce`?MHwQ#`o(IEG4bv5#)o1sFfm~s(KOCjSL$wN?X8Cw|~2K z*OW3Elilbz!Vqsc8Z3s{mZB59C9I4My4Jo(t$nHQ+LdA+LZSuueSsZn{ZJs%Hmsjr zOypkeEqQzFqi+&5KbQ~ekFRk2!n8dI_m*TCLXrydhXAWG)3ZkAt^kMCTbgbHv!5e* zi&*m3di8eaQ)j6;SIIF!@Ykj`O9fughSRJfvfsk8;x!{Lj~>CBkN(UN-N~_%KQ_n= zrLSAfsa zLi@XO%=o*e<1;2E{})Hc;FL&kB;32ED6`Y0lR(=fPU>xwDOtr9CgEC6yzKk@IxSwt zAK*T2dmF*b+aDHO&<0W5*ZzQA9&6z*CtDCDi|9X+3`0tI**4{l%ZrR0j{@AA-oNQ# zEpX|#>MQ@u6}V;0)1bh&ayL0=xO`;n2&_H}tkQdo8bXij$d-3VVF4ZOmvgz2@B*%! z)cRD~<-v~Ai2TEX*9B{y%@+>bqdr8(XB84^j}srlC5d%g>ep=gkNL+MnsmEV+|Qs) zl2N7lRiRuPQW2A!PNsL~BMW%09nHhQlDNth(4z!fOor${yLvQ>}92D zFRDXGpYtKfmjP1YftK-4GWzpgf}fl}CG*#Qzb#p%f9l=e(P1raHXY_QNQn0OQ?uJA z#ob(y7^k$XbI(UvQs48ZDAl+A#LnWYQZG$4Rnu2kHSY5>b+*Q8na*9naue#eCpJG` ziyXKSx>vEN&$$J^S%##69cV_l)`XU8ow4>#2$|=ZO|NoNLc&*XzCdr9Jt+E=_+^cl zM!uJT_*UY5i_x2yT;Kb7U#$)wt5+UB?jMvV!sUe%>^+sYM8rT3V$-Qtl&ofmSAMnk zcyBb-#$erP*>cAK19Kk!=Ug({q1#sBLYj_=R z-bDhby=YbJeUSGXq%tmpV;HySbY_G!7OniC@#Vt+!QeWFu5~S5^Wfs0 z8<-L5cGK5}<)vGdZC%x@OT>(p8U=$%1paA$@9xf-m8wX6Qt6|{G}7PEZS3QJ0kdHS zr@2jiRZD)#{IeFvKUQ=uVMl$w;WzvCsyyXr4#A#em$+Y`*G0s?czi=DqoX1yJF;No zVtvpFwHq8_wDn_PK{b7oq^!kn^Df*GH@m{yx4n7)z-N%`9a*0gd3Y8Xa{6-djZIzV z&WaJg)`}5B$4g+4N=iY@e^rz4-8gh*sljX3?^GofHq*k-vQ~8_@GpspueK|mKv<_>!BhAEn6<1X}9WP#_QLAyq(p1g8ephif2AF znYKPf_ixX!{NxaCFeaoW@y?a3#CE@B_#~nvO6yevS0(8GEsP|e6W^g|n61w*00?hs z--xF+3g}RdL8EhWWWkkK!)Qrj}cJEzp+hXo_9;Ppgg3C{*T z-05u@EEogVc~7z;L{KkU7rz#zf5tnnY5~t{m|qetbnOFgFIs(QY*Ay%Wb{tA7C@UC z_9ww=S*{%);<%~-YRbL1XrHs-GehO4_bZiq+xPR%&P_Sf?VEBJH)m};O8MSK%~n;^ z%d0>G(UGUF?Ut}5~b0xjJ zvINptx)r+f%`}HKo&5U7|JEcXJlm%aI?heUHqMSMRP|$;bgO9yL)m+TLFh9&Axw_POIlmH>;bEVF)<6qB|Y=c=b-d zQ0x4?s#S?U(7t7VO}b|z6(qAKH26^39Q9WiX?@vF(FU1`mn5$RV=iM*%j32oXrlf} zooD=%k9A*48<96Nj&0jl;`!VI=ues)1j-Np6v)Rn?^hPHNmki@#T`=B=A%+HXS(z* z&g0scjsd@r+lNrb&vqu{>j0<}b>@*Gy{Sngc@-o`%LFzr;y%pfJrvRJJp8On!gNEm zc#^~`7vBbj2;Q%!%M%qva$Vq=3*6?b#0|u z&B_)Z63KV%%1YO;;|E%@t#M+4J;ouB3aU4HAvvT(i@3Chzw!z1&-@3lOd*g*h%Lc< zEfZJTz+wu=WR)#sF9`z{_j4#r2lKG9DDF(>#|yxSe+hPMk(l3~9cW74VIzh&i~>fZ zUJG&(uA*Oal~FY{YovRmmEDeov$UF1W3&VDeq?h=$V1+eXF{}-Lfcmf;J%Q;=XVMi zXBeTvot|U3dHCwzG1~HSmy+$m2GVn$;>SkK#=*Tr2Mjy7MKho1#%dI(RKI&SOiPS> zSyuFe8US2%3jurPZWqnwrvVTbs0sX%SD=cSLtgzCU;;hTsD>mdq==w<9iGKG@5qF; z#~s(bd z9rA*HW}UZ?Li7tsmUv@z6I*o~q5E>8(|W^x?mo-DdpO-jT{ zLu_+BiF_V^48KWG80gnZWE~a5ReZ#KY)6MA1-l5;@je%v*qJjJ_A1_D|g`9Z@RbqQ?~I!6QA>@qCVk;ztv=FPy(h z1sA<&q2Bv0a_#$+w;OrNxv4Gl1X8fe;T1h}4Zkhk>D)QmOdp;c_z}-2dUI1AaZG`( z(`6V+wt;fN8$_8gK{~CYe;M*%qmq ztH0V`vAO$lEU|R+l?c6FPqBHGxlBMek3nCl(Xos9<>r8o{x6m9whC+siemu5WWz^K zE?lPH;bZ9*4TdG`v~@M;_D17!560+A zpG*=|DDO;)B#ORABrM&N)G2ZPn^qA{OfsQ-t|)osIp2FC{aa1QoCL=>;kx@h$mpLH z2_NtIWERdYgOEZ@l^*uq3Z=5EeE-Sq#-d6W%j%2F<*@RUcNyCKz3OfC(7lGDN^|NO zP;U8Nh;`WE#MyyjNJn0?*5{Ka!_}2B`SwX=QGa34-#EP25vckR#;2E#vuIkGF0$BM zVI-_rZy{$n&*bNre0#ec9y3UNI7(cqs<>N$&&1F7Co4J{p}6$ zY-cNu2=D{Vu z&^sFqZC~gQdk?Oj#N!9FwKUswzN0z>7kB}kEzLjfoE@6$&2w)DKn`ELq2u#@Bk?@8 zq$PlDTZZtA`a?i2Z7v9&@#UV)o9$2qe4{rDI)6B?N^%mSESS^+&WH;-cbVq^m*e4g z@XSh9&$cUeJC6h&+9=Sdh!Z2wQ7f&68VX**}YD-lZp=KLXrD?*hn)& z^oylj*}A3~wsoyUUKLlJU{72krUb_MK7$2vZMB*^C66WRl`!=;{|GYuxOgmC#X~87 zuDB_i%ws9Y$hY5P(qsnzCjAUP&l|B`Hm^+OATW3uHE6Zt=e(_wM7Bflz+0`i4CZ$& z7q0Hu&udE4nH{I?-?wmP`R;?=TtgvzrZ0lKxq3V;k41*~IoJEVjiIL#f7bz90eSTu zllPAmz>JWo$?>VT(VBz<9?n*P;Ph4ifzfMuU_9pteLDTmD;E6EiHCx^M~87Ahp%*u zy;5bMlm)@KGnH_NOaC+fN5yNCjj^wZ(g!V|6i>cuan^WSqP z0cVroxbYG|cUzA~HSZFg$em(#Cex8t3}I6A`cNG zX=lU822g{TI&2OL|F0)6-IiiOen zJJk=g5(;VK>fJ55OQa81sw3TsbIY3%>b~Jrc!LoBarFvwej2%gW7_zvk7L-zk>`>$ zWRWxG(_Kd6Zt?4(A)VRJWKT%%?w~xB{lg@#*l@jB?xlX~kvl`bG-yhgMdtSH>m$P7 zBh?YXM`))&isqR(cDZ(-Y$IN>vlwfbrne?HTR?jXO+Fh)e>?e1gSwwfL!^sNskf}t@KSD3}Ro{`^St8_;0EH^kJBTY+&l`90;7IDKkW# zU`Mn8jCm2AHivczyBZ?q7}cMi)8ovids>hmI7+`9xTS&e>^Ol>z9m`K>K{<30O+nu zfF+9hsq@&z*HE`l#%0XObRY^o=m-uL5hLTE`&l3%NlE|;)Sue zv;!0}$BQJW3@D0(*avMW?zTAnX;kZy9M2S{J=pZ+QgGc@N4!>ZhO6tc2JO{KsBD9X zw)Cs(1}ggOnWAGm=+DWWJ1}g$LDopNMdqH@;T8Nf(c!6O&SiV9qV{=}2Ipq7P!Fb}g;%a!jWUq+NTT%% z_=u|YCG!pUPYAD)|37+UZP<&&TFvEtziPCp*ncIio7fCOE#mYo$+8c<8j7zgg5s1s zjQcIuNq-bX)sOh@_p#j2YgwJ&O*3bVmX!LH-sQJnoHJe@HY13uW0C~p_!J|pWzV-x z+v-D7D!CcAt{zt@JZvqUtCco^eu3pTMtrdB}Pf?ig5JjyZXP-W!m0SA@D@<*{CYn=+i!?W;(*GdY68S=bnuF ztsXA`C-Av4F{&f0FM_aC&sUYbs4-*x#{`--uMr;RG`af8Tk^Y7*IKa8(OsRvb3&PO zlzG>cvxms_l9L!A^+7$f__6x^QnGF$ecX8Rm@V=4@S;+VtH*hA=I4KOjovWyw)O-u zZ|L4!0%f$srsTfj9Xzyd%*axGmp9xSZdKjhZQPV4;WFaae_3dJ88l}yY%_hjPb=aq zhdzS_jarwX`Yl6@*er@KZwjX=NE90vWpoXimyk+5nXr^EMyQyR+bGrM(rL?5g*LXG zjhmBG$k!S)N55XQ|89VG45J7EMGN5j(b-XrAQzG`X zPJvVnk;Uzpr>O3p{D??(rp_$pnNJL@uuKD=wR69RK6Y`&uT;ap+iD6jqJvZ{m5 zoHD4*WlG)hy!P631X2HR))I8v*#^a^!OAsFyp~p##m=}^gg`0IEN{OE^BHkKbw(xu z4zI?jqvUh3nf1g4x-t9;G@nZ1eQhn5yg4IEiY~ua{p#F@N5tIaSmKX@8P!s{+N#VC5Fu^-l6Ai9P_sKB zS3Hrh3Rdc-T4z(_@~BI4^C>J?BR=R5mjdAbu_D^I#?d2eVR>9(UYkV?EMYEpocBy` zx9_@N@oV%Oq&j>Vmo0-N-&d^|9svek#(Dcpb76B(bAlJJb65Un=9E{=`p@3Z>@(jGazF>6rC;-ilM;Bsm@*XUk1-zvMb zPCmuJYF^U*2&~pB+YZ1Har#9lc8CplPF`qSSKa4k?748onU@-9J(gu#^Y-(l|3DUZ z+~FR?30yw){Z@Mic< zVq}qHzxg1U&rWlDfc!q&#HMUQD7@kJ%lQNEWh92fFmgR zR#vQZMJJak3?L;+kP@(^Q!awiK}wQ%NJ0JyZY-(aSYn_fnebJ$R!lS{;IfM$2r94M zTE>ap9FC)N1sKU@A|~A=mzE&Ixpk9KS&wY|<`PF*>Bk1Lt!$#YEQy>fN(Yn#@x&BN zFz9oy&3Gil4O)u+#lva;?oLYRE{B%NgXgMMau92Y3S-VLi5il^K5UNVz{pv3FFqG` z4pn$c?8sgzqIQt^p-gns>)|4y)>!aUPU2sh@R&7Szj{u85IB$Aqi%d@B&qT}><7VI z9QqQY0EFkHV^04eitWk^| zAxl3l#O7{gRIW>5#EQV(9G(zotGUMRKlqMr6i0!R+f^p@mi z4lzIMFoOIO@d;WKI_b@)mY&o*Yd=s_MD}GrAc4RF5cv(K%Y&r=^ z=mBNoA<2E}p-g!%gOptLlo*uKgS@7DZ>fGcx(P`t_tZQ|amR3jBmznvVe#6bIT?xb znerKK{}uP}4$-N{JvF?qWn=Ccaz4qOhB>O(+U2EX;leq<3gu4F=3Oy_(CZkfC#&r| zDWQUFy^TvtF-tn4jvCghG&%y(dX0x&2M0gSl}HeRDdhfG&UqcdaC`XG6SnQ;waNCQ z(?Ldm=IvpjUj4n8C~1}gHe+X&S7%^m^Ffi zGj>y_Y+d6trgHiYSO?lA&HiO+YoaS(2nSZC&gk5?)o%fZjAOamoXOPnGwFKoPj9{d zlwgV(7!|2f2y+8WE@D&<9L!0CfF#^wY=!|^*&byg z;q(1dtoFv`QV^-hX z7?n{CsZS%?>}yjc%BzAxwwZ6pO%2XZE~|t>8w|QWvTewWm_8Dk*fqa7eJQC8oWa9) zS%^Kv*?Il&Xc7mF$kH>+3;7)V!uZ+x_q|sHTy?65=Lg-sCS8Cgpxb*skeqwLck~uc z7maUVA^=coI+km(Gz^`R-u0&#vXWmeXh7I}f&{Akh6=+Nz2%4jB$hW{x;6P1TRVUX zqZyCnzn>f2FS$>f_Uxa2%(sa3Jl28T_r2X8>h4PUi0&ef<#VsZP7tkobnTTe?YEBp zPw5|)QA~0BK6U2z`s@T@hDZ6#G_(^G?DYe~`5EdTrSy*ScVB~P^-hV-qzt0G<({Hj z^W)xRJ??sL--Qgt1Q71HX+R;Kk8@Ljl5ds^pi5m8rs^Oq0I_hB_0d*y@+|-YcZv*K zp{UikjLLA)iXw_k4J4fKW*n${2Ro|R;BikBpzq-MT*FfKo;c*K1V|3~n7tued5rs6 zu?%n^IFJ=xz}Qwv!tsF|&lYZ5`NalMn;u8wOTtAI4+!berIQy-9q{zRCypggHo;9S zqJWE)bQ2H@8-Kr8s=G-14O3;nGAtf^1UcxCi~^axI2|7NJ6z#(3#o%=fROd^f^w?& zo~{mm2pZM@mvTc2^`HiX#&nAc*b|;UDi-`dZ+Ey;4zxOdM@=GGQh!Ax=4^zmy^UNr z-FkF+MFu{6Jp(3XVHkG=D*l=SnmGy#jP9-il*regZyThm47yEibLN=G5@rDYG#^0v4o_n_zn5fg@4{@*Rb`&*Bbe1gN@maDudw_l$=%M+h~3*)ZJ9HP#B}%jvks~+?Fj{{9CR~y z#rKA@!XpC**lMqnbz!AcH|;7DJf}Re$*PJMT@++KuF1}dHb{Nr({cI~ez07l85k>? zB<9ExJEi_4DC^-qviC2sm;3p$tr(7If0L1GCq=uiV$Z=r^2wJ~Ny!HbQ5xU6D~`do zC$MK+9CxZ*lbpjYt8!dUY8m7SDhZt~;1~A`c7e>u(jFGrE^0t_A+>O>yA0Jy-$g@- z*IPRZq$!-t7+niCMCPMvvm?&-AqD7SEdw-6K+MNkxii(KTVz4CXEVV(f zT;~N-{|`lvks#9QVJ}1WI+bN^AR%6%1zJ^w&r)1*@b3vtM!bxyGX92r4>gywA zFMq)$V?lW{uDZiVRWeCej2rXPJcP$U7Nt8E7UF!+-4}ZOtzUYUQIOWAngH)+b z0*^bU5WyZx9N?`^K}&Uyd$Q`Huq}ngqorLv zK)hv=JE~h@rfAi$Mjbc%+sE%&ec@6*#@ATr?YjmwXZX&IIawz6wW3H9{Wgt0YJBL( z*XQ?qkM61~?nfM0@>ELY#LnspZkk-LS{QMy8b=Xb5ka_blcZae6{vU^3mK8k_9rwk zSz3qiP2!xsx0=>W_tqiow_Sg3=P_cd`uwFT2_i0;%=DVon_>1`zE~ht`NRir89-ss!xZM#DbJf>gaey!su_FR7{te_@7NnZ8^ zEePqKBaxC7Mum6p)Z#M1XTh;MM2&iZoW@oth#gJkueB#RCc*8hdyE(QA$N{)n3u(4 zF$um(BC$&`KNMiR{zoE4xUro|NZ6xCYwW5-?jpRT)$j6vvJ$UH<5(8R@yvkoj%{~! z$rsSQaRH?=fdGpB*b`XHlb}#Ni^7k+_f?~714uE}4hoVqyWDP7KHa58r(Ov04v0^J zJ=JP+XDGZeRu`@I>>C#Q`~b-EwsKpxmP;&;Pn;{gWtHa(aizyU%6yz8)vERedyA51 zpCP9?c5$b8J8EWL(?qKNp;8F1%k+GC~ovjoR~G(-Clet>P8xYmKCcmMz*t79WB|>PEcAcWqU$cv<~H zT3KvQ*Baq&9!_j^6XieMaCf{Li1ZYABrx5Rd1E;9MhR4dD%&JxsZuq_qiyJbsCsO? zj{r@ctGdUgve=}wFqs7sr)Nb|*;fEuhmaJc-@*~x-H@odYx0cm^_jcQqdzA%RA$Vj zp&E~Q9_=&VKuKfvdMUgwSVp%6=*3v~$bgTkGniw5epgmm%o2<+J*ODrx6|;tI+WiU z(Gfi*5Wz-@DFvo7uR{VBlAYi0U@DQKV1p_BHpy14`Ad-{i3IEL(L zy6oTC#-xrsMZ8^6;8SS4mqnEJOziZpeMt~$JPlz8G!g>F>xnyK&g|dn`k;D&p=P8*WNLvv~k4Ty^lrf|r`)2&k%<$%2eZ&jV$;}EON{<$r??6aO zPL}oY@5GlW??I}H7LLT_R>zs9d;~zj#M?-|Z0?_Fq+`Zt@ntsQ2dY{n^bc_`|rBKrE(T zMHd==Uq z+a;a8#=faNt>)u`T4c~{eCZ{ekw&>BjwIvI-#(WT3-micUM6wV9p`#k$n)vv&wL~& zlqgDCOk2aAPtAd>ZkW5$dv&jKpz_nC`NsV%#OunBLxCo#DG1H{;l|oC6lzClHZCrq z?hcnr_l@>(U&}k*%q7Y}a{}9de4*eJ2D-F}91w)|djX}Xk&&XOFARS5$g$QRq|@M( z3%`_{37Sewwf198wPM>r`b$BmtuJOC&`{{+5KIeL@gB3>y`Z_z_F8+K1c&SU3HO7# zS+(Z9*6FEs)I(nEDd0!7a1>N>Zy$f&kx5NG-S@fwUS20&Z{Evz?b*>jrzurX$p!u6 z;?T7GcIE4bN+M6`?)Qba>N`cj+OewJed%~M2d8=>gY|PWPhi#*#=|W8I@|?<{If25OEl~l&A!b3@4!dBtnLaK>vnhK&aL|f( zjJdooc@Z*j+?nu9VopqE&97E0Z|zuP9Fc62`rhc?9$29F;_0X)1ZJpj1ttGoQdDR- zrYl#ulj*w5KD!F-Yh+eLX^s-Vk1reA4DnRL=bjQRWljuYs~lhHmgTZ@?K5&!(N2~xG?UTK}4n3LsyYLmu@UOQ;h^zf^7^YoUS5*(-* zid)=Z=V@`k*0`OPyWI+*lTNVGCqt%hg1vs$%&+?0V_0w5GTJ#vfpq)5w*UIK#( zii2-*Q%W@+YN$S?p{Jb+QM-;1pEW@-Qm_LF1YBK z7@9*tKqzk{>!z5p>OrcfS|_`hXHDZ6lps)+GY`Z*r8jI=zL0^~zXhyYIghFbWbWai zV(FGWNQqSIIP5~hE=ywiEKCo0(wl0?{xTjnpnT98eeYG*KZmp8$T15|U_%iarYfj} zRi#eL*g`8iJ?Tr{#g!LfwR#DKS5`5fW2W%4hUxo|pUZgc0XLVo7A!f(fQ~Mf+R)NU z-o9*x(ptEq9QLHBn~Ftok`#A&X#vyt2+&VHf=W@;Z-K&~%dYIRmjoz^1G0b!Y6*+K z_x&n}t%LCwbz^lF(P*Hv_^*<00_pfyoA}?NHSRGw+sd|b7a z6S-$zeH8)edkd62z4ficAao)7jlX)mm!M3Q{uhf&5IB@i^)Kbb=s^eawQ%plA8nG# z%eR}53+UF(s&>GOoIob4Og^xBMil-b2F6(`6%?EOxD0(Kb~mNFCENIw;?Cc~&c|gi zo>;-unwGdpUCJ&=K9$H)Hp&{H)CA9>75MlAAW#e*g~$k6Do;{}Xz zF`4{gwrwT)t@`fQi9o(l4-?314;=c_@?oTzXb(RS2EHkz`-5Kl8~>)pBKyl9*Z|sj zjwIOqSdM-j?0aF2fFT@`w6QuNJJB;b5eD2wBH^pJ2w1X1(gRRB%MBEL!rdw;!bw&@ z179)Da^0%DOM{h0+;amA{5W;Nu9`qonn^9{fAlFa>d4qK!%nb1H*$T40~X!MuqO_w zcT|Y>D(Z1AR@YP+4jC2|j{wJipWVU>C}aM6onZ7o*OKt6@J-VHJOQkwyZ;ep0GXFM zKrZfx_ECYC%;&=;uila#0}TaW1lVKf304I&gWRoyje>Q{f6KC54+wn#JOSoFzhDPY zbWEBX{?%C{xJ5HOJ9cmB#}Gd^GY)=|{#OH7D*(hB8J<7`XbV1ti|3)v2$rXp^(Sax zC9ePDOqukxT1%f#wU#6ZJ`tvq)GnfrW_APkiIyL*`%UCi_Y*BY0{+c45z8cD+Rr$e z|7?oA_M|#oS9XgzKG-sqy^i7h^p)t~50$y56_Rsf{3AlQY0g{v6cQ9K*yUF`p#eM| zVFX@4|G{Xjy`$%5)VFrOQUXrpdCIpGVDS+2jxb-3FNBz|DF&~YOF2KY`POntqh^9u zhKAJG-lV+m(IsPfaz0&J^JKm@BoV!t-E6J5pXAW)<(fdgfp&rEzao$x*JZ;R5Ww#e zUD`ur>tq!Y14-o~ezDZ&OBzJ!-O<;E`0dZfjQ5@TU3XFVS=XT>jke_+yD~s|9ae05 z=eN&?BAFqAAki6Lc3dEb=225dQ20yULaU|02*WJUEG;5xT}lEQG_X`4zb$TX&Wpb= zeG|y5JmYvYx(u^#&<=#CjRs3SZv||@y)O+wbk$9X9azOS8xb8B03Qd^jnEtP+Lx8U z;%wom;nWM90ucA!0U{u_d6GIp?n5Lq_}IUCgaX>TJ6MI5ma74fbBGM#s+T=OQ4tGv zfZJct{8e5}Aiw1D2#98e7rdL$@a4W(c~cN0dCNG}utF&2sOi5L9WS_*BD(xbO`zkp z@ki|I{aex<=x=j!^_NV_@P)pRQxPCTVmf)|QZuszSQteSupz(Xk^uZHB;@n-U&WUk z&jhAD_v9{LCYv8X0REV_BAIA@VHJCgSj8R*F|ga5Lf}E@ta^ONFiG^^YvL6Hk(*I= z;@|P1?(MlSF`gb$piFt2tR|w^{BnW|3&GU^@gGC#&#-^Re^*hfXm`opa;#E(vlb}D zLzPi_21(Rl9v7#RT8l8)k%N1ra!)`9l45&1aMnB3Kwj>@{{Xb=^~>3u|Izx<^-jqg z5Yac5LQ%wOyKMk+AS1W^2SWcxdFX;w9tQkBgnw#4iO7RhBJPtMuMl~AMyF~%1CqgV zShzKi3>pmH_~PWW;)vrBZb(mBW`(-eC-`N;nXzD;jYvcYfZ+5NQiGvcWR)bqYP}@b z8*uw_F)VJUIxtumhGB=<#v~YKUqE6WV0>V-O8FI<|8bTl zmB~Fwj?`a3Xpb&TC6wX^avWQn{}BM%lg}`$#9T=BfFRIVzH5!q{kzNxqdbBaNb4<> zky!jQdeo#ai_hcl08NGYS}0>B(M@&f3nGdD$5k(LKv8iEc7Ux77(vJajY4m@TtK9> zLzCVHu2`ph6AahCal#^=k#!+upvn^-lxRm3);NzEHDhnGMtw9$yu%JsDP;e-0=hMK zN-FKK;h7-+v$AuJQWY~EK;ex78t@__+5)wd1xy;Juer$(JvWF^m_dwUFS9r6d-P9% z_83^TPH6(v_d*%SU>yr0E0dtbbPsngcs*~!FoYZEy|jVOXsnN{&gexriod~kACDKB zKn?s5C-6h|RdZWSCn_OD6QbQJbXE@X$7?jHDMLU7uJEt+58g^Y=r2?(vf7FFQ1UO3a^7x*fFI?5VO9fzD zoL(2R^5*v$cLiQngG@h2gL)Ms4xG}IXD7RarLnkbcw75l3vLVQ#i+Xip(19IO`Hz( zHyslj3qHVuu^Y7CLbzWO*14JMV@17JJ_GM5BHBX_z-S#>t`I&Q;2Bup%V*^24tzxVdhFShwOzZUj94k>fgvg~&Tu|PkF1>l%b zdj``I*q(tOXeQX5!Ui-`o}bdqV;15u3+$_VCp&6jg2xtgxyT=x=RoH<0dT5}UvXvT z5bo-y{p5A#v4oRWpa-oJ%FIo;ioEIuXK~ia`keN<*imN_JOSX&ET4A*YJ)2Y{YXf; zAsHR*_t}M65S@bkrVtN+XuqfTRx;3e_K$KX#EMQjOtEu^I0*9PBh;MF8slDha1;%* zXQ-oq08qU%bbr2}AQiqzATnhIR_#S3nMSPgLV9qy1!LB68K->+HM zocJR>+v)quCo2v02;W*88>ohxd>kL1DRVR{%pSgzp)LjFgHOQpaGu!wCt6k)%|L?o zWPll7JEb`YhCL2F3_L(x54IPd8E}HU+DRG1+lWd74h3cJ81j~puvP?YeWEy z>T4g1WxJ$4qv2Ss*YW>|`G74)$JtH#9Ic!yd>+sodJtiN676mP z>e(WXkh)_YncD-Nr)5q}X9o)RIOzt=i~W+Z!BJKT$<6aKrk|A01}`H`;vMjxT5!@% zJon7mrAh-)v%inxC|1Fj>|HMl6nvL}g3n|3n^JA5hPCS`O9AR| z6IwlIve>xa;08N&$bZZFSJg+=*pHwcy%Vr~cXOxp0Awoi(wJmVj+_EcSL?UVcNW6a znw$NO7yHc4Rtv#)v?Q+@EhYc0Aw~$s##Gg- ztFHZ0{J`t#bz_*kTJBFg$+&^`hDt1;Q}QET^`IB!Q6gH(_5=VrMR&R1x-Rdola_AY zeS+|)N>S@&1mCaCQ`crkdgmG*n3Ac z6?E;Rf>eRfMYS9fwBxd^j8v-B{Rje?)`^)@EZx5K& ztK{3$PFwl?m$^lmD4Y+(jTS0Wrt*>@h_3u|r#_pqds*anArLw0+JczI-c+pjrdBC= zsm6g4{KT3^Ab4dR(ecG>&I!E0(wRuri9-D=6aHn$8>sC%FgBA~1WZ2LdXX>k zvbc$EvpxPm6iAdHbHh8oImF|rik7pW8O|pK_`{@Dt5~uB_DD3&y=JodV z{NRFpc~)u~A~P$%iVMxpGc_XLg~On_5ccBO1~ zD6%!;BysRRaudrweMbJllNkCnjW428k9~mcZ1n5ir7xCieV2I;$P z*xbLF+x%d7U#nMD`!X)PP>wvvdQkmTz=)vTL+i{-gx^9<&~gN zy|3zyKI>gMTqMYdx~+)L$g5*hg!V)L%(@i}w$@+fVfbAwOgqJ%Gx~~hR9GrZ_u@f& zxI9+8qWGrK-1uW4Y7|cf&~)XD4ncSs#H?Ky1#vLAC#6gN`-0a1k{~|=9L@~eoVg(_ zXuB;9Bp)Sg91zB(`lC{53f8&Qq?)x!kBcf$ScWsd_D2?0$;5E?eD%W0xq3ucCANXoLpoep2~H4Hv0&BfOwFHVX8T{s@M% ze3%5=))7a$!m_miEFoSgHGk960bi5+J0$?ex0DjC(0&ejnq;udZg2SCpN zoIqSqn|++bJ0-1~$7A%p+}4SIRWOeEKw-YbJ79zA7&U%uUc)M6UNdlo7OXR3eLt1T z@P5i=%!~dX?jUW86WGJevH}9#O)dHL{xUZ8{<;4_3x;`h7N!NwSCE8V0sG9p^nTlf zc75}{f(y#j>~g=K(Pel)<8pQNWxlk-N)Xb1E)6jt zX#WrN5P&!U_rfc$;DmsbE%}1xEdp1N!2~p%cHFCiY}^aL2m(k;?-!zu13~Tf18@LB zNPnCU|0p`{wf67wjk5`Sc2D>op(k8b-0BKLDUQCP-K(0q0`k3|8U)_==6~Mzf9e6> z{ax126mj%Pj5zuqh!8yZIcGDhD`)cxCKxQT>-w*5YSolKkOJ2ndD$IUND}%U4K#>O zy@CxE)_5}(`LzBo++Z4z1c%(LMB-4177N)N079hRN2baL_bo&sJ_C7lvq4w5K}#G! zglybfea!m}eg`VSEi;t)|C=+#Z%=K_VOXE9&Xn*?=&S19m-3$5$)WXXWNud)nrstIo&io zpK?1@Y?Pp%?$0zHWA8pCOJ6qct{c9AB?V|16{Y?`20??}h7iDxb4#Gbf<596Qp`J0 zLkg@Lx8J|Rf%i4ZDG3=r)%>c!*qZRO`<1f{SpF_;tp5gLgr zb6?RjjrDfa{LKSFZw`4qG-K}Fzj$7X^HAyUUBZQcwj>Ew=o(X&=w%R*9IIQ2mH|FeCrb^-6*f4jo4*5O{s@MW0wk1K zXOa8z$vCQ@;Vb9=5i|*4r-`Z!Q*W6CQfrL915V2wgJ*KUy7Ag2!K@4cY>EUGgH1_l zYJHzTd)mCs?$dmvqMJO~&JU6-e0LrBxC_qzD$(-p4IJi4N6VmM76=NPdAYJe zfL&q%cEWw4eRDjy8vrh{l>eqz>tl-*eu<)r8(58pS4lGVX!?FWJAl>WIzFp!q!=#z z^d-jI@qTp}Kxk^xp3GGscO)q9gix^Vop|YIfXD+yB|0{Y-$}rUaT~IMf?q5d0vrVyNY35%_oY|Eo z;T?i-YQlFRAA={yJF}m5iRTJ**=B_V{q3E(&CpcXH{{4K!-NI^i{gYs+T&a>0}iky zb@}V=WmdldhX@F*&)4yV*}aDddV#;{G6`cqPoBX zVDE6X3XTv#kM#+}sE6bUh+EVD<+(|W=;|GgzDQNdA$Q-dkDU8QG$3!-uyNO0pIdQ& z@MB?BZQQ@y7qCVj{N-|E(JGL>0eZInuMnmoW8Q@aFGJ zivf_3*d4-gVDl3Z4=#O~=`EuXLG#mEU#NeR`g_d3J<;&DUTF0{qLe>rME|0u^M)UN zV-U+|OSyswrs*2C7rmq-at^EQECdkNmnZ8$rhs@}SpB{d&GENmfTNOksq}pYC9;+- z8rbQ4hu>jj)|;ZF9$|&Gr}!^C&;a(8*wc(ITBzd1Mr9D`;jg)_LFReMuY|0r?!y^h z;Q~p7ZaHtXA0npUWVjTm^sjJ=q}z&b0FpN$U0iH{a5M2SI@KJ22I>$2(7?HerHlq% zxzrqcP}9)`gATBTqG*ZrP>MNzVYxd13M38lqU%VtB$UsgUP*Q#7(N#PC<{{3Ts{v= zv~fo3H3l1CgrW%MS|O`SvBM*qYsCL5s~CJ)yK%<1 zWfdm}0~)jaTv;PvGO0H<9^?W4s7hbN(srZ?bi@@5kX>ta1w)kcpDgH!Xobh_Ph`!v z?~tBZMAvm*^6Y#dkYUR-=fVFk;?HsR(2be=e-M9;vq5c-XM_F&2mF8g&$JGU!vcl@ z>j#kDTxFAch1mbLIh^gPfp3=!tX}|ma~66xCJX(4kbrHLD~D;9vg8-BW|&a|`OGZK zkDG7mU1V&4L;K>xFr-grIp!M9^_@=_&Zi1w$e_*2vJQBmB4G(3gaD|Uuc#M`|1;^| z+~EU3Wk!UDNpfi7scu72E0K3FI{%;l%iYW2Zq zb9{wgR7su^p&pC(e&DmN3LA&6BE||v4aQY@%CVaeY7aF9*Y=`9+9Z(qmEk^+ckE8rkF?@y`;&Hg;>!U*?k=;lFAp~LBG3I! zgU_QbE9T`d5&~^@-$edAC5jaLd^1w))dAT0(YdFj(tg$ z0W@I5I=gpk{PEx1$TH;1O7YKs7H+Y$`v6Fz_E#YnssnbHxsgYkmq+^@Cx93VmlK!g zj-~UQ4^y71C2$pnvjnWFxoi2Wj9GBCi1(SOqzNS6)AADtPKEXjbPo=)|L!@NBBlFN zvAHb4*J8kh=yN#T34FU;zC1485}oCQa2`~++)Xncu*jN$qs)m`oLPBWcv}KzUn!kU z(bvM4)tm}>T57nsvg>8rQnm_apnneil4Et>p7;;+eMr z0v%r64a8s{1%)=cPvGj2T??YR8;|;Q`Zlv)N=n__Bi{ZM9^_2+&2s#um7#yBrq4S~ z9}VC#MFumR>q(?m#st5W{&++FOopkCQ=fpnkCCTknZzUSoq%IC1nG|cXPCz*@;U#< zlPZR!Y>%|JIR*79Fmp`H`!nDlxcIaKYG>mqfdul zsCIdE&10p^vLeH3VwotQ8WGxWujQj6^oF;k=EDk+?5>TPrjMpi$5UduJK?1XI+Q<+ zDBeoe%)TB$WB7LW5AW1wSj}fKTZ`;`@nuZ0Y%wTFoGUUBFd0eI!b?)PuV_f!7_$Y8xoTA{c5p6p?)JgMRrh@gNH)i0 zdw)GA&=FrVtUd-YHw78_pRPuVw3lG6bexc>rt(GlFg8&dFcu#E*{V+G=AoeSyICF9ALjFG>-%G4w>T zvnI~|bUbDvm(+S)z?kwAfgDNczG)faM+d{-6^=wax6>~%6V;?nz^jsKId15a>XO!O zAJT2zCqM_^Y@5@?XhP<=C6{Vez2DPS&`pT1+7@G4=ibs+X_A4X$h) z#bBNHS%);P{t=2d8>yJ z0Wu_Y>zI!`@hvDSRugw0yHR-V2c3Bl08urRimK9zgtz=%k*03HI|X-qmdZIb!VJfd zcyty28%mM;!02oPLebAyiOVD#_9YgXA70I-n(bc{aLPV7y$sEmRp#9IabSpyFDoxF zIsrY}Ne)D+7dj=J{W;+O?;}Jgyb7tpvzino(shK-(@k~`zNY7fYY6kRCV5c!Y4;uKN}n;vnY^1bDh!AkEpJ1FEhAP?w%lg|rL7f`He|F(?DIoOqFumoZc4xxp$(jNv-X=Rd6AmM+Qt4G!8G5BDL^aBnM;Tnk)D z^Yoec(5UO83l3s)=nS6uB+{N zyDv4!ZhUSe2Tbs?Ox$L{&|k)kzSE2*c!{y> zfObLjb0P#iCF|d-p>MWk_vpTwgD#eT4jQSV_}Q9&&!wV5d}_nmeL%(wR-c+VlR0y- zH-RmN>h8SMgQE@}F4t(S{~q6d5`!9mc7ckbzdDV-zaTlQTH4#W_^DGsDpnmV|Ljds zx(v$Zi<}&)&%8p*w?)%;x`_uBsOu}-p$i{4c<5B?IXbc+>xci~3DQ1z;&$#EA9=HN z^SzUId(!uLxY4Eo>0{d2b4@k|uu~^ktfzE=R7lszGf{G zWmoHXm}Y2=iP!F*d0Im?YP-Rp@xjK;_JJ3V2s6co9@`zl2)ctpE%o(}|we^&u@!=ttxk&(Yxl`P3C?!Ru<`3PW)?~KF3nNPb z|IX>xKvJdJ$qVaVhNaiJSwKti_B>z(7a zT!p_#W(`c*e_$XCk5b`|T%>0j|9m7Ii+TV(dK0Gc2{_tO+hN{4&Q8V}@UH$J;L&?!(9gZA z686}HSj8tO>)UALH}g$zPrJal8F#WLu$a+&3%;Dzf#2qZ3YO$$ucwk~DLq`~l_D!| zWT|T<0?FAqQx6;iLj?OmGbP(Lk1!d6$^Kl;zafE0prbJb^Sp}gTa6pye@ zEGRu8Wzq+E6X31qcGv5w5SqTPm4h>|>+3p43t51DkU0l>EBO;RS-J)+hg!dP=52AI zvR@*zCWIYyE;)UWGb~=}siq*uO+?2ZyE!NErn2b${^28E6O9wB^Y4u^NfgK4urEIG zr<$#V#WK#00Pb}_Iln?%t0N9VE<=+; zEU++X_$sbH=L1FqOlDd}e|>Xgy$1PW`hHh2AFEdfIf7FvhfQ1)0uD2cX-vlq!9ehu zHEk!k4X5({i|fwgkgoOsRigV7d2A(G7_3)!>l&V1j=!dl3a!MXghRGiMI&Rm*aWl; zP%BOD>v@wy(G+mjNv;p;+GO(>`^}+hGS}}Lm9pGupm4u@`ppQlD{M5rEa0(ns5B!Y z`=y7grq|mfoej9r2s8M5Uvqb!v7!-RAREC>&-UYELSa@A$@Dp6btBl4w(s<-AYCtP z757pt?5{8%Ac4U>i5j%7hOgWE?KTgG+bA8J$)C9nG&h(;@%+GP#$1ox1ttzcO}nSEDl@QJZC`%M2{5I$B{fqXe-mxYCB@Z@pk-ki zoPsaN(x43LYP6miHS2vA_IQ6{-})0^qd*8cj*rKAxUlEd6@>2ph}?Q{pTW(g_YG?h zeeqN@Xu56+eh#J<=P`>h`e5*G^Sj91{}ctj`1grrL_ZWC<#>nI(Y{b9z8Wn-E{~PB z#nFeh+;IK6y(!tZ zp&p-()xy!-=|aE@QgDFn`Lc)b0EV8N4668#?VRbHo}RB_wPe-)O%#9nJRIjW%m~qt zI2A&6+6UGur1mGC*+ibN(Q!xS^YxSs6G}~or(`W>E=Oqi%V|r7o%C$Wo;|+Z=brm5 zbNL%qUursD(@)bc--yN5k0(ebu#R_-Qq#|v*9U^*W;Tp5iaGsZcU||vTx85{(tdm} zee!JU4J(*YakKy`jt@mxCRrx=NZy>#EeMnld^34ghRiBv^k$Yo7sVJF(S17KZW7a~ z8?*5tqC1yNCa@Opu4QuLNshS-a3=U9}ZxQum%m5F0WWYPjHbxOk6QV+68$YDDWtSnJYT*xZ%A{@Z>Q0#oJ>WikI zJxfKP3Lq03v?tWzN5f6qTPRB`qzwGTaJnYz;CMU1 z2a2r4%tdg8lr`Vh_YV~nQgw9dS&NI<`tw-{T=k9I#d}S&+@tVTN=4pO{vI6=r4kSu zGn(0BCs@;i)_+Pk<}Si2$lz4+y3E4fAnu9kHr zXg+2ncf@M@fO*dOwb#7!BSV!*n!LY<{9Okp;_@%%s>tf#+YjDW?tghT_ft?~ebcCe z=>B|8&D;*C+vyafY`CO_+%F%?9YH6pdw)44Yur2~(-;t32SN^jq!k7210lW+@Ni#_ z^*MZ-n3rrN1i?Nr-L1fVtz;U(49zsw{vpp`th`;kT?apvUD{B>=yp^(G&GtYrAplE z+y4*<|I~Q;|F0SuXpEAHH3_aGP?8lP!9eT592;BsRxw5g#-v+6fAOvkO#xo@`&KgO zx(?+4V1iz~$f?1L!G{EDq+-A`^WS^Phg_DAC&J0{rV;F7}gl>$+0nxZv`9u1%zCF z?!Us_g-8$d#Z70AgPTn_Ex$717Ae4QKP&$`bMuF;uPWl^o`BC*lxeyp^&); zhI)E_$ht3Ci%PqKOI?;~D#n6~j@lY6#nPAE#{Iyh>l|tr@NE_w5?OiS z2(Xd7%B%E=wszpixmEEW0RC?_7Y-KDZakOy z;DPAMS`2$M=vX}rfSNhil*ZWiNL^{p-ht5G9haut+=i@wKgi5KzCAXaH_S68!2ZRd z(s0)Cy>W$cux3?v##h~2OpgM=xuu$cb24G`zkxJ_s_LyRh51H|7F13bi+^LRE2wUp zYk2)>D(`TdY;)q;UG(u`QtgSVaJ%uuf<~486LJ}T_v`Nj`NycszzVJ8=Dyu%Zm^x4 z^6^t~^2m}6gA5YvXW}K@Hp^vyE+nAra#Qo4eGYyUFnQCJm3JV}Et7dDnet1`u|^LG zmo)HeDb)bg9NW(%n@K`yIoA?Cz_u_C+CxiTDw>_BW7$4x`iDHZb8DMa-jl00YdOrH zl*}D%uA!^3l}*(pT|cD>@>L>0OLC~mg>_~vFE;qcvLOC-S~aKnIwjm!={^w6m8zm! z<2LI&3%gp}z}(Vp*FWq<hCj+e|{-zVQf%+<`Q=&4YZiFgxwQ)p-XE2smv? z6B3Yxfkv8;)`rG(hk}L=6K=hfxi%DxtTx1lu6BO)TX`;=n%@I3wn zcGkJ9SsdA>Wm5Oa`M>RM#^+m3tn=zpQUsJW-}2m()I2jut~RtzBeOPP@6Nv$Ph^;< zyZGAB`p=kJATwVNZ_jzgBJ!4B2m*)-qSFHr(E>dVRKCh(Qf1A9yr3VNCA+y47Lv@9 zhBIQOygtbAMxfm}=CP+oOc}dCZjkGh4bTot|3%9EO%pPq0nt0hDdingWs!*LVk}GQ zeG~<4IYKdxs0`7*PO&YV$lk&qRi-11xpM2(<}WBq_rSwD~*TcUzgp z30t8eTkW)R_9dI&_t?oVRR~I_!+w4P0M%il%KLBQKDAp-mTu*MUVYH`RG@a-Xi~@_ zEm%9=Rm}KQ1yf4!22^kf1QeNN7_X+Glcgz_0F0B5& zI*>?%a>V7;c$t*-^NcJ5RHnGSO&qf)yI${JSE(P4Q*^q@r7`UFC|2bD-W4Xe zqVC#>r$oJ0s1l-GZ(03kaKmQ7ORcKXmb+!r?Mt;F`e$MF(^?ODs|&>@SQMIz!JTYB zF$>vt%AzvzCzgP{p*OSmGtzPU;u4k1i*|gC-;MIFkRW ziO#x(-Qf)vtB3pE$$saCBW#_~RuNL%fJ>E5zign!G`Jfir z^o~RW4cgKD4=hJnfAAW0c<*=G`$}7YVBN*$jXzalw z_>=I;)dR&n|1%;5Gvv&V2zT)!k&z#0=^{04|j;r)Vk^-8+J#lGSQWi0=gx z>tA#V&&dqr8%=TMsET}e2zhL%|M<(s zKG|L)Rb6uvcRnhzS_%RCdqeBVf*Whv?Vaw2Z%O%fPEpsyihqG^>SEn)C4Rp_7|{{o zFM1<=?*N<_A6-cY;GT}Yt)*DbgrPts4!8Mqfx{yYQVI;Ra_S}&#mN7AOe$ecsg)Z5 zgaVHl)VPp^D>z_7-;Ce{LIRvPN#GCHWklrh3$lG8u8fDQ#t>;u-;YAR@wpkm5fmn6_Y?o`v0m#=j_ zGO^?Dz({i1bqV7Vqmt9W*AKxIEzn1-4B=BZtMPP-i7{2sJY%Yo$%^|E_MgVjI^5OWlX~6}&VAk%{!R-tRdp zIFGb4VpYd!Q@!oxsVH}Hg|4GDbSWJmT+#~7zvlk_^E=Aq2^G|Rpzb0dHlw_C`O-dG zo9jl&Rug_*gtFuo3Bh`Pe6o3&Sp0k7QIy(CZscKw3Ziz!C0qa0Izbbv31w$guVntH z38kjZUr)u=-ZL%<Pt&{X0oDEJ^U|espfbWo}~*=j#K{>*70)l7EhnpZT<2#~-X9w<0#K zA_=Q<&2kRB=Rk|~2g{MY9-h6A7rz}ir6seWFSFs~=_>cJ5h=WuAx@9~8zwLJ%Qj-3 z`&avoz{+BqlTLDVR`DjJzF9+Gy376E(b%n(ll+Jwhm_wok7-}MdPP$_I>=@=n+ zO*_8sz+YAd%OljS#%X=Lrz_KdZ~5m_GKa6!Vr8*Og48@!s-(1L{}+3ZNs}%-dE7{~ znk?Yr&z&Xzg_982&<6^?>)?<(PlPtOx3bCkH@FgFQ<*GnipU1Fbv7s7|4x&|!@h2K z90i^H&A{T}n(wvw-t28Y*WxPn8xjAVY+5|^&I7_cb%&4HaxydgBadhyzI&g4x+r`C zgj#(49yEnzfP8l~fAdG0399(wUO`cAE@cnh3|5l;2M9d3f^o-8t}uMJj);2>d+(U!o(Jmp2p_vNb#aQj;}%T zDqwb~!{CZNU#4B{+GuI2B$7i^1LC4${^r&LmO$u3H|1F;$la}jFxbxznvz6;*f^2~ z6x9n`66Z>?m+!Dsc7qk_thAFH*Iz^G^vx~!#ehnxSfzY%bI$@j*IpJ`3VcwuXU*?% z7(S%Z??!_S^@~~(?&z?C0Q2VeI@LtTv1S5K=$YqUhism{s;gp zJNm@3`iZ}92l9QGw3sYl+@3j7KA$z9t@oh4R~7nDWeSw|i1?{Q=K~$Cx%fqja7qLC zHplQ$5t;9xdCEfn`tPVxh?90s^5}T?x8{R|*QFbZ46A|+h@aL=x@ppLOH`2NUv71b z0aBiF@5!y$K~jHNp?HIg*6H$vgCHq5vyaYTx<>m$uH$O~*ucaF6e!7-*yiNU2kIc;CvlODG_oY>)>JR^@7s>aLn#8*56G=D*1lUNQf0tUU369Ab`jPH*%1CogK7DO1 z_r}aOq(A| zO$4E{y`zU_+jCu=VFVz;O_6Z2>1z{}Fg>APTyse7a;)W}1{<{)&zNO4^>nB{q-A8xmW9{_g!R+LR{i}Bs z)rTnXSpPCMcqu3s7Xnk{v3Rq6m^2NPU^biT(_rV`QUQAuD4fCqUROLcQA7?MBsfkN z1axPr(Spw>0)_a{z9>JfN9GnZA}r8-Ni4n%PkGUe0C`*kR71t{9Q}tfbikO279@;4 zKf9WllJubazP|~i<)m`x2WG`2hVo@bV?7bz9#O(j}z@20-JC!ma zB?fGpC@sORKT!KMa_%8XR$J)Fof{)fUk_D{|K5Q{4>B?D)WCnJfAIg_HF_H(D+{_j z+Y7lS_15jhWK!@ z>SQH>n17k9xtVa0a0h*k+Wv9kH?LUmk^uGxC9%s=U;@Rn&p2HW`MA3;(peF9hpU*^p08n@|4hni+Fvence= z-h|aX!{I)CXBozOV8$jqK{3hZPG%Oo35)+*ajLB`zRwN?D4*N}{?Y*mb+BU0ftUL- zhZ*Xt7qN?!!eE_-h@|F!JMU&DQ9-UXvnkCd>&Ek;`-F%40963rEwO|dkT%cpdWZ_y z{A+?4GxIbmpu$cZm?C-x|62wL@#e2gfDF>A`9poeeL*7HP!TM?^#iHrp7PWX0+yND z9siFEz@vqefgFHXb#qQnq~8yxKt5b+5M`X(*mzTU_g8z{arc_=miV_Yr3B!H zh4lNZAf*19qj)pR9_-$)L?lP0avgACBmF)KG_7x@&69{c(f&ytXjcOA?{A&}jgi_= zzI2;VZb-JK1VROA^92|AK8Ivm;xevE7N1*fL9C7V@^Mjyq9h?ft$x7?S3R>!4FxQ+UaUfx$a6$Qa#!M$LAVvcnf$xuZl2 z6>ANS`0J^fnl@351Ft0d1-uEYBRf?I^1RO9mPQydU<@BLuR^71{8VN_i{ahZYTan> z=)!$Q3?$!?`L%UZL%Q)2F8*e5taRg5JQC386o?`lAQ|iAW5FYi+7NaSUTjNg77=um z!qBZhCY74QkVuh6Rg*{!iB-K z&v;nN+6k;(JEg@Gud0+5Dl%iF2nwT^b4$ScB2rVfM0!HNylnZ>zY}8u0;UUs0)lmh zG@!@}Y>5J+_9!sA3aaT*%AH*+9xFZv1el@zdc(VnASoCyEe0i?@tAqE5zO>mBev^c z2s>rF211eZH!>w$PqihoiP|HoC}m1kNkq&E5bZyZnvy5dV~-VV^LrtMcSMbWZeSmvPAdx~6U{z&>$f;#5sm(Pvqz8*(?#PiNul0Ic63px{ zvmkH90K&h0rpSmn3@c2MK)G$`hmv7!Ng8I!UTonO{mthgr2rA)M?*J0Y+PG++MoyX4)C?;2J;h;NU(jYd$dTLGUy zcZ&<7W;S={@68ggd8N0$fVk#Q?oJb#07djAUL8s$c8ZLXm9W+)x1Vc%X_q%MBW@8q zKqS`2@t{AZV=af`TSgu!-zei~>%qgo+~)5f8A`m4luANzGom#+irG3^`RLQPh~0&# zQe2tadu|Nd_1a!HtvnlAGqnkFVwPF5U)LtwFt);MF;Oy9806bZtZgFDOG#Te!F7^< zy)L1F=!8T)9FS8$T;O4bdZ?URZ_(J`I(w50=xjP*>=*!JXSfH@{Nil`ZY&=ns;j1G7LE z1YAb7KfFl;9<<>X`^ygt{o0TZiqj>wDQdhYwzr7C*0XzWf*JBZ<=#tsXuO`9@!~;}hhiFF z*7#NKOJP6FtgMbdQZs#(R(K6?fdEtauq_!7v|LFoTE8yD%(B4IdWw6N!dpfH3E;8Fa|RNjv&*#^^)wiUt2FQ z8A6Q6V9d#0z&-&2c!2fBY{{L}sEzPgWj#P5_sV@Sx9cnuqg0Ssyo7@IJLpk;`X@{m zI|J+;E9f&M;zV)3#2)1prd}I)yo+FO4?R8Evy1q<;R`J2{cDBu7l(&ycJu9*=M`t` z!T3rAe8D#JP}e&W`hwhsQSrc{x^r=*Gt_6Zm*|$+!)}YMaLGu3VhUI%=YA78>%OC!eZhwc-rh&-G6f>1ctq zL!z_z8|s^Bi=J`I20jbJzykyN80nu#vnk7?B+KBy*PcyV7yFjMkA0|C^>=NZ`RBM* zlY<{`P1|@c-+l9ky1W|24021ZY^XTa+m{4-@U*I}SEF<0sbGQzyx*auA8=6HNQ-oH z^ggpZIC4&pqFx}}K(g6`W-fN=7_3u(r%a&_UXo#Hj1ttVeiU#vwNU4&|%6zUJj zv-*CEgd2Bl{4GCq5r4DhArdi~yAwrL7XFp_si0fPmtIPpeWq3j^E@A`|ZB+jH5lgQGL&OFW>3`k0a7^iikvMX_YiC{KnmZ!7vZ z)%x;wFjEiBpJZ}*@)NnOUzGUlJp)$!ZG8BJUnp%DrYDy-Up$c!YSj4x>Vzq(|H7j; zphi8WVgpH8%0uyd8pkHDR=xQ9xZ)o^C0m2uEDi-d8t;***|S_8Wi6{fH^A;U;7-Mnh8j3F2I|)( zcUGWJRxU@wC8HP^sd8;5>m_#DnITve3Y;?sE9Ahy({%PCFTPzx;acF1)MPW zpG&T(z@_GPIEpDp)9nCBOq8WP$uK#*%&5734Rsro&9 z;+!t$Ea{6^XSLm%@$ulEV$JGLfOnhRqvnvp8+!KPwRt>)1YzUs211f4Qy;5=c&d zNq(khZZ*%pY_NZeQcAo@INR|nf+LNoFXZ8KCxgtM2RLdAO$`%jk6Vb(I-qi`2p-1VP+md-Pp*x=f4qFO3?5?&bGBK{|4 zzpV|UNbV>j#|H6rb>=rT!>p+}9>q*u9$i;(pp<8=C$@W6WEO-Xq?;I})LiWen(2`! zHox0fpl|Z7b?Cr0*upSRKlBBt5>@%rmWS+A{=`~|Pz_v!U&?1_zhfzr;6z%!&UN4Q z59VWG*IjEL?|_zB&r}1YF5L{d-b%iaIjW!l=$Ho|(WJk;+;3a?tXIva9y7(}{Cx%P z#`Np8iLEQZ`2tyk1?}vVda>yn4W*LBVnTfd9>(py$LOdTo&NJE@Dh4nW_?<4 z>(u#a{0n~uB>Eii27H(?`s#0-Hh8#I!J7C!N%pZf2UbFYKKliYZSuLMx3$^tp8+#} zQlhWGMx1wKfCieaU^>5C)xW!6RGPTsGI&hzwv{DFi8V-aL^Hrq>Q`mvcpMTVlzsE~ zmF+^P*!wC=BdojlvK%xZdKL4X7Qm3kc6tP-B*Rp zm5&JfAls61bPc`NiBNasSYq4Jmas|_R$sj2XUR|l^8c%`uYilHiTb9yQ$jkVyIVkz zk_PEoLSUC>VF~FF6hTC35J?dbknZku>FzG+`WAhB9v^?t`+o22-u+FS^Pe;4&YhWi z&fPl~%7bIs9v6YCc%J^KQM?_70gIV*Ay_c7K$o)Dl-%pYER6TQC!})`qWF5%JAxaI zkbHAsP?;}9g6a(iYpl^`;9FAbv;gLNiN$kywj0Hq-i=faR=B!)SBeY@ekjKPkh}Ha5%D1w}+WL>|l)4 zlaTe{3q%h)!kV(XDwQsKRe;3i1Du7Qi}&Op{Jm7g%1IL+?-+MasOnj6o*Pg0au&kg zAjC}yZ^Gu^c;jI0udCJQSu-o`52Y@aN}5Q65vRmH1y^0cUzWbVej0k6QXF>kNy^M$ zuvDt2xPkCwFzpz1d%*g{hU~<%nd+kS=K1wR?+ts)O@F7<`ame+iA`zd4SPo+mnfP2 z;CFuNCj)^APr5D+O+N$2FZdDg>#lt7i~rFY8B%QzQRS_?jSu`x@(h- ze4`BXE-8NvHhGrNo*_We(*^VC@hhSQMPF;1JiASE2-cIpUydn-k@8yM_2NPX=MoQ>uq(Xo6WD>TKi&mF@NRs5g?>3iK5Pl zZ#h^E7t#SMqX;C!mS|vm*p52k>fdE{BSdOVu|=i@xb)q5WcvwS@@dvo+C;ytxOsFQ z;Djw4v~tE5wNog%EOx{uFMu&ylXz>*wQMEtj2m-A#94X=mK)!kYULMI$!5u`@qxjH zHkC3L6jEybVJ#f^!0vgHq)|8ff&{Rb;B4wR@bViNkrr^JuP8zZdJonLsj$NENnay8 zcvO4bMq!0}u(WK>KO0CV#(d!6NP;lCdRKD2WC!Qvp&7vhp5ItvmZStms?-Ee5d))_ zN9z4@$rrLofjCfInhs}RV+9Kb(_TQJVlE{Ngs(2hW*Pm({bx?z38QxqTk4npm4u=ku8m2!v;vZ zl%&u9mB_pa>1=IDrPQ7a z-E4S8Js9ymB(~7<2@&R<4@=k=a;LT_2)J>{X+Y}LzY7T6VFbv6!#z3a)1l^ux`4^u39OAQFX1;xO!$gD11yy zVY75*u^!oMGpX_;gs~_*XUA|e*XwiWg>S12yl_uyV;XS;#BO5at2mZnnc-#Wm{jN2 zZL3I0ci#!FjM>)f36VySsCe|XY9$#Ec6**G!A9=e!F6Fjw|rTGi9Q6iQf#Y8#;`G- za~bpLz2C5UpFwuBegi&Lah$COo>BH~p=vZUMX!w5$3L;=SEGNiU$?K^%7gC;jdco*oGRtgx$7zjzl+`jHLGia}FH) z5P9z0vk6*6hwJ)3*#~m{W8Vlwf0$j^?}fvU zzrbGG$#>*=Xb^?T0*p(^q%$UPRd#gI+t^~}9f2QXtn{-2q^GbEn4+ja-!a+|c={Gf zO_HCX9vxVday3i%AfIU>G9Pnx)aP47#g_Y5<6_7~ichN{s8&W&pi5WFYtpZ5A-Y0n z(UE<2UWjQz2}TQsjD!fy!mjEPFe34{NHs6v+1OOCd3F)ct%4`%nTa^LnbpB{iO$|w zm&)T|)~_|dvscbi+cNS3_ci1{b~f}E?myVL)c5@I& zG(Yq#JP#=9>>X%KQve82P!FrUFiMtZdo7U}%NlnE+Z!U{vaXpb=jjAJYaYgkfsVOp zQkh4a^EvG4W~{5|F&4&vC$oI}AVg}8V~-E)#*gRqP$Us=nf6Qi0753YZ;)e?Zq|+ogQvs5lRRp|BG4yQg zcT5+I3-I@B;YYa{60Nws8Gu#~ybLH}+CNyW)9bVx@F)<{kne;@&_3Zhes~F0@^wKO zd^`h9E4ivAB`itVLxSYl)FR)_ERhQJ@oPeqgifdkl&q{LUl#eLz8tc(z>}g2>pbt7 z0G~bQRDgBL%Z`!#{p+Iv|7$859Awd5%Yc5TRz`_%OC9S}z__q=#U@pQWT=My(#!1f z_lQz_`#P{UiHO#Au+LGe+Ph-=4E)rQ?p4L-6Lr`wp|}U{`;2e&3%i_5O<&sNz?W9d zBD1NG%_#K?Q#upk=U_OCExRI32f&5JXGNhq^h;+T1YC^1QH8e7CK+%~NTQL%gJA>e$ttnuI5YfwJ_W!T|{t%!yQZwDuNTJR~ijy0U$*#{0yBq45 zLqpZ-x?c0Y?b0=|h&Q%?J;1)G6`e~dt5bsr_f7E=HvbRWRah-EK%pt){>si4aEX5K zqe-M>{>m=|qv^v8twi=VyiqpJ>&3{rw$FUXr*I;4+9XKg@?czY7m6Uvzn1u`=)pl3dA5#|b2L^PsApldXo$*$J}(WW@s@0{dD zwcNbPKtg3v%Qc#toPG9I;_{P-!MPM>pzStfP!>l6ueu1ier%W{LMc7l5Q$)&Pb%5W zE7qJ1-KDpfM*8hEJ`45I1!-m$!9C(xQ+=8}L<<+1n6=#H!(%uoM!k2qtPWT^3XUj1tjHc<$1&*ISh7x=q7g2!h$a^Kl0BPx_Jfm|` z)NUmPbx!rF4f_Cjr~V!qMorr6Co{Guk;Oq@Bo{Bdnd;Omt$iNj_prTbA-A@sT_Dy% za5+C~lG4R8vyu69+#+IS>**-kj#EL|D5W^p_(Q5*yXW0lbErJl%sUR>WaUj8!ff)N&< zD*h(7Sjx=IblP<@a|7CCZdh(`JC5XGWx>$kca+jU{n)jsU^pt2X`h64W;#c6@s)d_ z-J@>vQ1Dv-{*|q1xoWgAYP8MK*?m4+^att_Wx~o4ylayrLl_OQJ=LT1FIfU< zGC5WKdX`tJ;UCV=PsIDA-9iIgK?7a$skItZDLt?^bIo#0*&MkXjc2CVPbnau#=j7x zO<-o3>ax2S|-qIY4mCiWHD|Y3!2A3T~nP*wCU%z@2WbZ^Qdm!WCQOhis&TF zaSx}3r)G0AXIshA5;55X1Xsup)R1{OwIg%#3|lqV^gpl1(uf%79g;q8TJL@$jSnpN zu;ex*&f#_yKHb67Mt>GOHB0dncPxQr9hE@9YTOW!)x2CiKA{b&fm^PZQ*A=GHx!+$APP7{wWbPr0 z0Vx+YZGLh46uo>q^@X;7dT?7$fqk=hX(?oY?#PmcQE5lPsZs7|oF#KPj%wlQ=GP;e z$62@h4CQ#-Da(~(Jaxehuijql4SUqLwG3SskPs;fGA)~{@V}TG&I`!C*8N@~L2-Qn zy;{xqbQ@0*#R2y9^z@{l;)1fR;G-%Wk9~Ao6MD^!ya!=U|CoJnqn4v7wVt~}RPi#U z0cya7WRu@=-i6mp6}|S(_mwiI8UbX89;%8^B{}RSp4L@<+Pp}lQHEVIzy%R^6L){x zYv{IoAB9a^)Us(A`W(Ua_PMeOkumC!c=$p$MPCc}bAzAhn1=2A1@izh){w%Bl>%F@ zD%(J+%~YVz+^3JV#n}9&rqCDi6t-hGAEB6GbH`3+dP!UUKc)kAyza{}WH>nT`*43v z2Y0i;-E<(A@yxsw5f1L|K!fEu0^H2+CIfLP*bj{dz{S-L1eBoT;pC>H0RSyQR(3!e z2|69^M;yX*Qj!?rAZu$oOMs{q$kN>r0CeNH>#y8uN&=B{?GqCj&; zfUBsRr6|Y=0Q|)w`a8AgkBWZgfF10B_7ZfqZm_qMadE+P&*{m>339RF;t>%M;rdZZ z_g7U`mVeVZxw|<0pt7>$0yqHfgmUHL;pE}^MSCaV|5d0v+TTS2fk1y(bk~NTP5eFN$tQv3(B4FCvmF?R#GNIrp~J^7)_pJ<%i3@Ua&cQDPr z3rw9{K+gb{Zd`)G+>SyF58dq?tT;rt`T51U{s8=0fu#$;+zoaHIjqdx0Fp2n1vy|} z9zks$Zc#pNQ69d(`2I~NZe=O@8-oxBkB~OEh^PRJM_8QeSK%F%gE`Q~-P{Hs2>^2F zX#FVrJL{(e04qB;SfAmr^sM*xQY zqlv#5|EBrL>h20~;jjW&+W`SqG(QOMdYc5@W1uyNhKG*pFOC1NWW4`3GQR&C8UNp8 zzq&eys~fCYu5NagKP7ZCw{QS(Sc2SvZW46DbU!mK0S*qo@&x(#c|`7D{_0txcMba| z^*8R1?EiV4cMo=9YumazS^&-M99+5FenmN*fHnYKhSCfXht>a6} zfmEA;({u5?ts|^GGaC+82CmkQ4(4aBlf(Ev3PA&eGVsL`{kN(Subzb4T6$r)ULTCr z_Kdr((cI_5p<2lyi6K+ZlH(5i1Y`kX)FZCcD28 z5>R&@Qn|B7x{9I{c6e@YukC%L~`l&&;nP8#z;Tqm@%$-9uA`^3up*aTX2W3j}A93HL<`i*@u3s~L zjm2QXck2nKPQK^nn5(DLx$Z1jr&?)#+kK+@-APs@YfO%$*AhcID)w?e=UPUX5}2Ov z{meYmc@z+8^}04nlf0LkTj1EXvdJUah_bNoUI8{+E)IF{VnuTTpE*^(mI{-f$I0-r zkJ%}`j^mokVL&UUBMX=&2~YQ(!Jg(qG+()vHzcEIaP!-Xy5=vXhC4{eeXqD`iE_On zKbucfo3ONbNMcPxFRH>61{GC8Dq^GZ{2`Nd2y(R!UGIDSMnc|-T^h)Khf*o@f1lsM z>^V-BiFl`DGL@bc@$uxV^XUAc_bqj{t;&a8vm z@|_QOOv;Lq4C2-Wq@~{Y#=!(T1^Y5F>Ik^+o#}!#M|aVn$s^r|HZLCMgLZ)@o>0ED z+Tt#z_epbO44)z*2}nHU$BDNF@@q#ZKMe-lGa&gi;PLE6E5y$r@=f;4wxpTd<79(R zskKgc`WD0nVN5 zx|7ug9XWXmugz&n@}{>0zFkFZYwWp9n!;1OSo#F0)y&NQ9ySFyDVIo_V@PnwWe>y9 zT38Ii)i-p!2`h|1R4I{V4s+>U%zby{*)wAwXk@uJruNDIzJzUD7!JXUQRO24#aJ_v ziq!A}#HO|2i!u3hVw}Pm;p`7dKGI&Vr<2XE2pGup#HjdgyeR_PO^okt%614vqa6Em z;}8&%8T&1d*oHvg(3eMoRO{k+mA%M#6XTI)Mp%UPty1a*1vNKpXbqV@d*5r>?ta6I zwf(xDo`#j>qcb#tp{xgvth}7+VPqkeJMnpbP}Qo^OzVMG0rK z>Fwqx#CVp^i%;05KHeL2O#fIel}_-smw9brdfg;jF7n0Y{`YC8xAG6kdvnOv;yFHi zs%64Ib!$)jK$Pd`a}u%(Rt1>&NRT<)Vwp#P&bf5Uv;6 z%s?6(&2Aw;Qsa=nWGz5b)o8`SCegOIorBPK?-N{vG@9OpELCmI@BC8cY7dp1{H zw|P+rUsXecKL@Mo2bJdNTJM5snI20CP7ZVoT2|^%Va*ZAK9wf}UOD~hjlFP_+0rG; zudg|7sI)oXl8;#isvhRe-q+rq2`jca=SGxmku)T!PVl58_1E@3LWxY6jqxii~l1GTZ<+R_aA>BWy9LV7JeEul=#&Ne&&`Yp= zlYF1A8p9o{I|$Qb>UwrMdfuoSxlH_?4|LWqRIE={g;@v*Cxhm6aidnm|B28P?Xtn! zu3|wX^3b3p9#N#KN0t19TAJ(PRp+C_niqfz;-WQ;0{)i-st>>6tvBk+2iGXU zsn+IYEHGeom?I^TSgyQN@J$q#CsO78a&)@qk|o*SLw|Noc|ZS!S-Rh+Be&_#;#RLA zF{JN$X`W>AVx7rp-(Y;5E!lZ)VGlS}dQC|K3=})DZu7_GHlkj_RqforZ*e%P5Pfa3 z{~XJ6XJ_hw`uk$@SwZfe|4?qF1(4Qxaao5&&ph^{FLnNC(@gvachpnt$#3DQeTa2SwX zd8q!Rr6Z!=+OwG>SYz4nV6^f3K6)b-#<{2V*EkMg9=Xwrs88w(rFeM zy11rkO0l?eV}n-x%x^dZi-U~o>Ik;<>Qt#MTJ=5lAkGgvqd)@!teej{fzBav~=abb%|y=2z<$#I|E#xL-JK-?ng^3!pMhzNM^%XfVfpZ9HT&*GYD zd_{93)9R+!na19tq+>rE`!dear)cDL^TVOiWUoO7KN#`9}vpj#SCBC;eWco+QA`JrNB z*67vh%A>Eu>aQ8o7!Y?&{dq%878ir>)x_ELVUEYv8yA($eQv$D8tHCR!0Z&xTz<&n zuO3gY=&(t{Tc>_e2R(Ryn0GKH;_D+P_(^Q^#8|PFC+uM-=anK3b1jvC=>ti6cMRc0 zcLbx(t>({KxUoCM7bCOB<;Cm$81%di>edgz$C`FkMt=IblInsS@%H5gb~DvG&$JH1 zvo9kfy`_ldS*~dxP~x$al4R#?c4)d4QaZlzu}*A<;!Jgbl0isvrX7mXLS=nJs~)+N zA$0OkQZ!C~ebotp-Scf#A z4-%IfaZ+Q=h1!Zvz$9QL|02PbNvDe4O%iKrFAgjYsK*_^=xWd+}Sf1I;wjzNUaL#oo* z=&M7+0iff)ceP)OtqDpg!;?57KpIKfXq)x$;EuiobdCslD*Pon3WUdYK@w+zHqrW1hApRr_#C0LkA0zyF?eaG*e#(c zLyHW1R}_(EVd@nE!BGFr5bxq^3o)&I#U}c_R|;y9HwaW4D4*qdxI6@qsFk`)1mKgakHgPPT z@lx%&dX*s~cjb05HfW~Bn#dBfc-bJc^i2mXq0&rhYu9Lr>>zxjAEiL1sKAaUoYp-O zjJj|WRrJ}EA;5$5E}D0q_pt0oEzU?j-b2Xbr-EPQu6u`Wv6qY~ z9}(9=H=Kx^z=LddlxVy4M}R_up|Ut6X8)1eRkL`(c}@2@MkeF0v`#cV3W}a688HrV zh!@zmi4S79zPfy!7MRZM(aT8RHFyBGn6g zcxwBGO6e~u50cuV#pG6f2jCHyKn1MwimVSc@nikAV!kIb%#e=4jh~ccMQ$&MxfHOb zEy#gYSCR-5yN@-ed z+>mPDD9VkM+g5bYs@_yvy{iNoRt3`(>Y=AHa!cYI89%8YPtXBgLFi?1aS_kgh5~}M zg(+}lbIRDS`Jn{Alq^w)9kQr#i(esG2HB9EfT!pJXK;s8oc)1@a~p{*(A8#xtL%8&POg>De<#_dPGKuHCm7$TDXy3%vk)XPF#o0RN? z{Fx-uHd3%z8A88Tcgj}Mhk`0yej>VuPYmTqNIPSq@(}mG5^8qVBv-J2X0g3h4&Gr( zC|k_SQG^5b(}~D?GhS(ayqA-*YC+;jjE~ihXh{p+rw#ET)TH(KZYjs=IjptWHoslR zf-*+(h~Yec;$eE`ORJxdPrzxzQnDbRwVlmhrZiVx zt~=|KyQ_t{3)e54-<^U8fAKT_3n%J7aLg@XHmaX?OD;=y7Z;d`^{$ir0=?t^)6;lo zf%+#b!J>Z(XYBxjnJE7e?T-3Slz%so45rFIQJg?d?oKe9ulwIk{4X5JyUf3X#(&|s zfNWd5 dXlzFO@9|Sz85!k{3>WsEjK>o9AFl*NcY6haEII(h5iov^@2qZZ0g}!p?>`@m+iXbiA1lpBHd`kA=Frbh>64ReycDA9OD}+`XpRS%3)!^igr{1}{ygrUMkcz$Ezqc|s*yMJ2eV&dl zUg&ZQMB*g3zK_X%F3|Ws>~g)o4_UXrj~jm(4zPtQyYGuxzx&u+zk89GSALjST%YgT z`#lZY!i~g@*&bgd$`-MHE2_IW#f%kB9-tt_4Wp517r)Af0{N8q72elA73@%8iix-Av!pvVR6)@hrg%F=*5VPh#BDNlR5GAa%! zFXC`lJ2=QxT%EA0ywB+9>QU3})Z12+WJ=vU{BfnI9Y30`qV%fns-di{p1klpa*^^- zFt~u6@lgUvx;Gn)g6e~7?@JdzsXPx-dAx{l?WACByOtW4|8$Ly@Oqmx6B>eFG#&}9l(sqFlL@AwG-(Ns6roIhg9 zU%Jt)2Oy&H;c&U|bUB|^$y(0#^(5~Ki)czw9xV>UoEd;b5kFt6zK>GdrrMMls28G!?N$LESjcnyjJTFO#=qGpfaZyog za7L`RuREGvJ>$Y0_2e`Sn^u;nXBt-SW0KlrW1zJ+6$Nx_cW7AL#MJvyk#i{}fz}A* z5d=7mA`V%EetGiix3||61T?Fb9QkB;fUK*R2UW0iuEqf%keOPOzJEhUzBO~R3XOMd z;$H-}`uKYUozkrBTIc@vL&-t=C$0STqFQzbo|d8VcChUu>;{T&>831UoUhje~9{JI$co0fbjE8>b4d9L75)TP=IkT)C7g&Q79h9FAz9 zXh>&i2Q3M=q>PJh(=FnhVb3YZyl*sa**v6KUN5JIS1L|)XiPY{Tr)4sQ!+CMqaT$E z+EdhrnFocP!T6nuBNMZ0POPg*xV9v;qN}&rd?+-K$KVi^lCwb%TsCzIQx8`+uLKLF zzwX9yq~QysA@+?Mgghb`rybq~LyFRCU>l#Rs)LKtSM#>I>6FIJ4IThAyw_acYS1n} z&)J$@!Kr)fq;lOjX>(<^rUT2gjv`g}7_K3#F=T)TL)cU40!LfjT@+cLimIxs9&G(q zcv;;Mx!2I|{HK!iLhp5 z+9%&khlV+8PYh^^l#V_!p$Z+UC39V8n~F=ZD3cDt1bq8gu5j?-;?B-1R>S^jfLBsF z7ei;l@+LF{FR4cgYyegWe^g1dZ$VHTq?@iu z@F&-n-7gQrAQO>p;HO_m;U^*JIjQu54^Gup1}@nt^f?4&QC?ahczLw+ zic(b~RejIP$T%=*89>PQAe|dkKq}AyLD2-*8|`C$RI|D0%jGL6ExAfj>cXaLKg{dA zi*g3H!0tjSs|vU2ph02(e>iOF)B_}%i* zzd}vk`79~}Z!`t8jw*5kqSQ!DS8%NidCeMaWUDY=X#ZJ{Iy&GYtc% zDi`<2(};i)=X|MvOArTOtp-plV;;NQm8~xzcEB;zUO*79yq%DT#uHo&SRiM_)Sp?+yQ}@=K_yW(;mU+To-T#R)RoN0Yfk5hO+o}-C1~Ca=o>+ zc2PR`uE7@$*TEU(pTtwp{+frb3XVSVIO?{Ol6619$2Uc5B!JXkM*wPszD>is5!F4W zPGhX@0ll;1zrw(Zp6Qt<;j|h^8_M)o*ahk69NIamo2$&7J*+GJmC#5~MS2Wl#0|vV zC{t(tB;VC@7^2ec;N0FIzYHE9m-M`I^l#ND=aQZZo@4WxLGaq|d+^M(XwpG7a@L@c zHyJTl>ZY6Poe>rEShE^-t-Vs-ME(5 zNPGx1md~`v@SLOfP!|4F+UbdSZS`*m^54*NsBATyabi2gZShg5hKt;8>WhgF(>&F6 z&bGqFo)hprVPtdOeo&s_2awry&IeUy@oPS%Z`H4bUyNh$u-YE`WOEPuCCRnL$Ye#x zY&mg?oKjdy5?@WHQ*ynS#^eQwe-a||MgI0zU@4%zRR^Py1)-I`bH%JPYt5%Su>5cU zJ$da)_+p%VnUr)NK*XC6pNT~G`W)&M2KfwgBE6u|IYG?l-aEOWPr1)BCx-XfxX2~4IlQKhfYtF!l0$k)^c!<`hun#=NqS~0dHtVCQ-hXfx zA$%X~jyR~ZfGQ|(JCif@A7BAK3P%=+I&=aG>Q1u^cflvtZqx8=)fMu}li@Gq&oRQ9 z%;KkV3VHznqg_#2TJ%d4Pp((iSrf>;+HqLDrjLvpBG+!4}Dl{kqM)9}1=Bgfe#Ox2I>HD1piUk)u$Y z{1ufjRtqHe)I|;pfQKKdpn3)&G*eN+m*hM>*O_wN zLBSbkA(-isn?>_n4U%?-_D>tg_Yq62F<&_G&h*I1`3qd*SnzKG88q9}j$WcWII@yB zNqde{vGy^qJ4T+4HnZe~0i{joTxlSSiE3VRtAnxvi{G5T6Mzn!^r?P4Cv!$Rmx! zZB`0lT>6;SOmq-0@gq5Xn}(d4{`QMlkgY7lq)zlmx@qxHHr8g*CvU_YsDmK`b%d8huGC*ocy)#x*oaQ&+6quc2s6P6sy5p{W=d7mcJqT}oKj63J>2 zg{EO?>AK98xdfIS)U`JlEx^PoV~mU#D=Co!bq@MI3)v?!x(8*jjFU;)Sw(L8Z{KcS zDI&`v443$Id6*D`p_GG`Z<*@eGZUFTIlL$Ga}##H$=GE@nWDM$*#l=Dx;q8|9$})rWq;(noBYJQhRM24n; zTn%Itv}@>egmiL|kOa%r9+v?9ZhpN)eLCF6ZlRxHVbkJOk9icUOCRG}Di%e_91K_a zS{b@QTL=B&6`%woUd^zW9@}c0gWjGKWl%AZ^`Ay9M`3ExIi~u;oFMvip+yEZkYCeK z65)A^XuF!pE)_#v}uvGMHl=m1UYBsXZyh`Y4TSAdb zN0mX64C$}^B82f1W|odXaH*MPRVl{!kK`DdUr!}fO3Hy$AP)(o-D9VLdl&eM+E5vg zyX$PO86rJT@hTjwQQG~C&t=VH+}E7mB<<#m{MNy`*Rw&kQueR&HBReEuJSd?M3*TY zfBrPLT=P&m_VrlL9lDDYFV8PG++iQ{Xu>nm;Aja*LaxQYtVO95+M={`nPqt9*Rxsn z`!5XhT&$%J!2gp!U4a;vhv14;&oJ4q%xSayhd-u6zT;+L0#^lMvdC}5?mqR(#H(l>R%OP9kQ|A5nkQw2ka>tu<3VNV1-!8`s&BAhtViYW`hAlX4!pELe;S8p zMyX&Y8-mDF{&CV&S3uq@;#3+Tn?mC{3ovQ)2@3^D0VxUBn zA$Jmoa83SYhCcH{d-2&{b0tr5zD5OC@6;W*&a_rmpowW7hdt{nIwt4UJ4kCtX78hh zd_(h(l7e}pC?nCtLs=dM3{p6GNtzqvTF7#xxJz$3OR!5VaChB z`R;2NYH6+atE5>iy{f_h$9~Bz88hc>(l)T;A7tnl1g15dF3SRz2vB+o4gBC>i;PE|@|cJ5)J7&hckjSOX;i5*CW44N>R0z(ixz zVY2hqNjk{x?IEyv2m+w|!ZH_Lt_au7rj#hSH&Kqr(!V~M9P=gSCp)(!M2lb2Z2XJJ zU}*DI-md`%tajGv(?!D>`tE@I4SNSzuVP{XYy}eR^oHi~1J&=vrEz@`pm+@rjtvtbO+8U}R>YLePezYM&@oGL)ozFBfoHz!+Suq#@ zDxVZVISzu^yYwMD@-noBaL;HJV(2q3S7WF>xv)j?42MER0B}Lqx^k>KCwBl{IV-Lk zNVt#zqvuu24g|!mY*uzS+2!QShGpSm9s=LO{JHitBnrqDrrve<#cLB#_-X&1U#-oZ zVflmdXl@jw=sSjGpq~KjRh-Czls^p0r`O0M<>mztfJOR6EHW=Noi65(LW|;obju6v zktR1Wd{`^U9YcT7fe?AQ9r07@)o|h>CA2+d(HFx-8^kod3gQ#;fnK4@T20z6%F@p& z{4)?~%CCd^;%oCsfD-cJ4I|^f5m=l4yhoXv)PsQ6L63r$L$o`tNI$CZquu|-(G=wr zCz1;nh7?tdj7I{?Dm`|n?m8*#k(470ts^x$%s}XEk`_@zzgr`~#{@->4K5vqA^Jj^ zDSG#ouB=DM_3|~0m;6g@NAc@njz%$S7Bgr2Du^FYA& zq3G3n$64^iuJxPI{O}=ewqwvuSsbG773#AUN1j-sgyK2I2Ah-2Zkro|+sxu4* z6&}&;HsPOoSRjjV^${5+@)P2sDaZH_Us`FL~s%j0#h><-2I76m6LC zr?gKg`eeSu(+yh-<1_FXwqmrccxe9N{tHzQ9=`N=J<6vgM%zl-I$ksB*-CA*ZxYLj z`Ap1W!KW1X)HvfY-<&0)tde^LP#_8RNLnwO4!e9-7Plh0a(n!#O@kScO_(JF5!xw& zD?oji{|Opc4WkAmlpJR|+n%bx>I4~m?YX$q-r0cA3j z1a*V-P-xK;^SO50kRVG=^el?@arsll(yy44B*Sb}NA1Yvl2}EW9B~+7z!+KvDNd(* zvKUpc;86xmw&~j4xQL@YeN-WEp6ca|t3L5D|AAcq;W7=#EDe1A;haWrpwT3$=6nF+ z$Lx8`K}5lXII{4KC%*UA;b|UlS*mYlSnQrQ=hVX`0Kt~-U?N)Q=NuqA#<@=_e{p}8 zym!z@y#Xr*VP1m2lG!>W&_5@Yqoz2g&C#Lsed22rmX_2<1 zwE2R~6FfHg*lqz%3}OyrA##l2&y>8FpP{mAWIr>r?tP$7J$fUeDaqDnMS2R%cmCa9 z9g0vM3Nu_qALc6L$&1p#-FiLPp9s)=Y;Z=$Lr1ZMXK&k_7W(mHp(tdbsOgk6rMqz&Ed4K} z%CM7beg`m6IZz2K*;3MIMBqjWZn# zHGfFbNp@^`;&~~GN>T{%aVbijA6{k1HgG{o6uvc9U^W!1kWhKK!l;4Bn9kwQSAwHM zJy&;&M`hyy%na1bmf<8V!Hiwhp+wEmU(6$xSIek3X(BOUQeOL(p3b*$mm_8CjHACj z<+&`-CL=?=L{d7?Wl#gd1<0z_3K^udK)eMOLza|&8P1bX{-GFK8jWj(ZN*p}b0VXy zi-v*1C7fpxT_O%CQ#2bidc>tXtdd*!NNFy|zUxH6;wG_)o}xkw__yCvF3LVM+*@K& zDn1^Y9zLLd*#~5AF9{md@>;Gf^5s~3)ZiY_%()CGzCXk(A|X2`!Evgtr~?U*b|1Q3 z9Ppj;Wgm4x0o)#yvO(wiE8cW&NU-RJHPFE=NN9+i!@|klNT0yxXD#ambJA$WZvyCE>6K`hT5uW;OL<5c`$_w zj1*)AxKZ@Y20;j9^Nej%-EHOG$be;7A2sxhFIOZbk>kab{H@T&bDDZ|#@<)}@w0ne zB7s-JDIk5iN4nbfyrAPgJBNc&g|@M3;npO_e>9|u)*pg)J4x3B?z5r8wPoeg`dqGu zb7JX=0Zkj*dH}De&m|OsG6{u+lDE>d|rc9IAXy{a?@mQnweWkWq`oe z8)C|7%7ZxS-WM@mN(%HfD<40zU>Nb zB_sQ;+BJgPUPm(w-XG(_&#;y&Ouy^G~mKU$KsC+HX}1lc2Ok@q8CO08Pj~|GQpbAl%j9^k?JD^4~svzqCs5P5j0* zrLAyq>bMl%VO?zOASX3Ok;=B!5_anGLy)jO5f3J-R!>&1Dn_O4OvG#KrK4eB*#6 zYinyHgL>5({#K^7CfI+pAkHYa9&t0E zupM>A`ZP^aZ6*yRE3pX9*4CuQfHKhYUkJ`Zm;J`MQa#fQyBJVKH*$JC`tm*TsgInP zD$^Y5yJii9-0KesSe_(1;}-JT%hhx&EuS|+ATS~PO(VH@!`3W z$Rf4<&PW%=cSd{hwgK4b#6LC3a%6<0600NRvJv ziyqEYGp3NYB={u@E)mw^E68hHmFqbMpIrb0ZKD0147fG6J#>=OxRo$_dvLSNU&5}# z1lq^9hvQbmz4$}iZ+=DtgmxE(c#q~v^Y zUK12eRwFbgW;``RAtGD|v``iv&M}E6!c}#f4&Gh4>n%#@nfSN1Rkh3_n(`o;-?jNW z#hlfOP^-o1G~*4MB#kN`eYkL0a5oRABXdsy0b2_F_ZI5^NS3T6>8lsF0llSJ&)_9K zAw|??4BvE;Skr+XGip%w91Yy6I9qAJ%u91x%UdT)fllM+oh%!b5trI|M90N`S;bDp zYh^JC7N3t`R~;?Zh#7NK$OI*27DZ`-yG7d zdbT7sSpf(yybBK6pq4d{CD#=1Z>Zi4hSQZ;94kiTkIpOKWaJoQSFZx6>!o zNQ2e5sRYcuv5(ZvH){LO1XntVfGB##5$MQ#%#k~M;nH_Q?j~m?m2cTeozM_F;N$yv z3j^Nk@sd5oWY%^{)~LO`CI%Zua@wEU!mr)omOEHp+Fd)s?!DoMU#6M&xO;G+(lSJE zgA(QA{6E~v8^`ay72+~8Cx1?HU2v*5J^+cgP{*(G#!Ya7F^m}$VvQ0Lk<|1mm>fB2 zCCs)cNSelyXdS5b0>R-)# z%8)tqJOL)#rq`!B1L{^GOgnf%WFpI{Dz#W6(fnPhX71= z+CoZ{PR-_qc*tbm`KG0WCbP04%`-`ojD(0*Nr~b_?qF{voDO)lb2s3z^^`_|_;S$GLfk|glZz-N z6=0k%%;gmo5il2guDOMRBQ+sK;?17O<;>=iw{bDQzAH-+QH2ECbp{m5@KKah_G8J z{TumcLx^~PxRrzBe#TqgjI|}G92)PRIa`I0PDkoR6#zaGO~ow;0o$>BK{1KGa689^ zt*g4wQUL7?^fO^smuEz(?0EDe|F)u6cG4FA*zg&fGw7EB%^+1pRd~sO9A!N(8P`)$ zO=gi>azD^RGZ=d{m25)Dx4KMp8PwAP>;e*aI!Xvjk|U^mkRz9$3^RMblELEyPtX?o z-p;Dhuyk8GhrMm4ml%MQCrTEMGpSn6D4OE9`z-4KeLY$KtMFGrOTk*#aOiZ>q%bMXK+^~UHS9MlsrWgN${@FSf72OuVa4V9+Sin^&gyUz&L~oDQ>`iFb+)RK(yl+n7jLP9sbfd+`^VTw+u|;6i+w;zxQ+nFJwi zw5&r>ZMW*W3Pqp|=L}mkKEF9!W~zGCm?MqZTk!M1LQK;JwQwolBd%rP3o-{VW5fEw ztsED=E{#r91$uaEAB)~+X3jNvhS3}rP`n#ImEsWqJTi!`5PNbPy*Ya{KCe^hTn}F& z@KO@9K5IyPebul#X?VxjDbaF4-GEOa%9Ys3w@`nAGAWm7dkJt@lziTo>AU94ONevh zlc5eMS>ED{u>PDbvh5r!qAhl#M$~RU>o9V;HI=eOtEH^uuwF*FLPeWR7!Yoil+4G} z%TJ9K%zHKFRtjgz7p5UjYkRTRDi)^GC>KC)VHk~B zypiMt2P!-2>D*n)p`(4Q*LdFaChomz2Y zlx}bjrp4qq)Mj6-fuK~pj0p?<+a;bw3CJH# z)6hCrDH3LWR9x&Bo-3H1%ebo0No7_1j;DG!?4WWg&7^Yb*S~*w78vkR3g-^k_u2JV zR?QK&uN3QZ!F6sN75SpKDRL)PJvQKW>QB2cCtjGw{Y(42HZKGn=|nU)rvx`BYiX%1 zHho?ezIP~wwL|Tv*S-_{OrDk6WAs#$vf#NbI5*f6LbB6==DlSTn_$#lZIM3B1xv&Z zB{TCr@qH&BleS#o{nX>wAY3107F=G3`o%g9g;K6;FzX*h?+?UOKQ67tKc?iW1r0}0 zaqd&K-JF-d7LDC0*^>*LCE$Z1?y1OBOltNO={%yD?I|aSCsWM8(O~Kb>gv{Hd@g8D z2&H>BAo=$en$~l6K{Z0yFdI+VuY!1W|3q}!gL%oF9Ft-kh81VIv>9_r(2Z=g)p$6k zhI40mz=W!Oq85GG=Y&vq`5o*d8uz!5*}&3a_q9;K9%ZG{Q>&e;$=5r9&>gZ$k=LlbRx-9iJcgI!~GGi4KwNj%8M@ zsdwsQ0tdr8la|**a!CWZLmAg&y@jrsc^zP*(n*qE4nCVr+m6}l*d3fd9q_FbMWYlY z+gE5LM10Kz&I78Aq{7d?+gEe<&9x%36Xu8 z{%>-Fo|?c;wy%s?6`wF*4S^yL*q>CT!1X>O)%&92zku>=71|>H5^$lks4`Aqbu5#b z-18wQ%%|-il^LMqwV*7sKyC7~n^xaZ>Dc+h?4DlNF%hlcg_XkyA)upQ&j-z1fziW; zWQ+#JMrHz9znbn>NW~{&Fy`FXZMNI8$<@!3KVUmC(4E@`H`QWhuVUz^I0N6A)1S*O zs93Z3?AlZV>kew5H&X@y+Xx<9mnL`*%LfllyBeG%Gh}NXX5=;z+u@W~NS#zu;jiNq z>mGxF-Z32qd1wn*0o5Z8ZUFk|6H2P*!zEGZ<;{@+#CY2|07ZE2Pi0YY);SX(BaE^U zM#+k(lB%TwNoUy0CKvD(+{wuTZPX;mtV+^@XM-DJ7EwRsBaJ4wJ>HJ|wp~1lUCTgr zgi)W0HQJ*h!(7rh)I67}3z$=jUj2DF4y%o@G^TJo8g%sFVvQ`NS&f|CS@rnZzE^2C zW$me?_|2mRMjhx=NhW|FuhN%lZPwFvve2xS2clOoz8X%o&k07$uDR;cSH&wL$ndXk z?mBBjjoB^0+uROan*}~@n?HI@E~=uI3TZsiTFfB-xaVFs4oG!`{;6hV09#_y>-aYz zs@>2nE)bO=aD^$nsN5Od;)HK;u%`imcMj4Mx`tIMiN=FC+(2)^iT5ai`y_i2nEq36 z%zZDFJwCm+W*8%d9t;oJOH*C2&yXWWY$6Z{F+k6VgYb-_SeQG=0J)-d-Fs_Um3Cfj zbMp0TLB2y-xRFo7Va6}>IbCs_)3qTb0Me+xLb!s^$S++g&^{`J2AJl*g6o13V9Cce z6L1ljnE~(rV`j0Cd=f#I*x}W0af!V^o=Ry`h;0vj8BrVDhuV={#$hv_`X<>H75)1e zTXKqz=BQ4xUi(E@T$;O)^Qlf4=48X0*yBH}0&kSblZPbGEeD(FiR5IXc-*TxSJMXl zF&RFmd;ezD(-m!<4NG=&tpf6v@i@{@V*HJdc(+jhi7T>{Tc%deKK3_F(<6GvUgZsz zl!|5fz+KCxci1FVi1Kr6O4NF?e?Dv0V?jzz-geySVlSC@HH4mRKv-f;2gTCDU>OS4 zdeJ*6vIhE1n7TpLa}c1_nrYql!p9QIO3K(@7Z?jJ2y;-iUgxvIrHEv`1s}Fe50?dm zHpe}}K%VLn9ZG&K$ZMs1ip@dv&^hQl656k5TlO>CO;g#9iGq~Ok@YPEuBA+P7KiEZ zW)jE!ppAJ)F3qZu;+r`bvaRTirNwqdfbHChzA=5bkS!uA4QQ7lO6I9l#UfBCU3v(g zW+m%GhS%aZU^3Y`tsYWGesz(511SarM@Coh!;y z_g5JMkKu3I0-J%PPtAK2=Z8uo&6I$AyWqj*puoDMni|IsDimh0jHCpm2xWfIXCO^hQ~ zCD=)*`dObfN4%C)GHeQ2l5yW3-=`_xOP{$K%q>TK<2+V8=7Q&t4o;bIJM~}S2W;Lo zcLs9#&MR(Qf-%|}=31KL+Tw)b%jvIapdMBGOOF88sSyW9BP14rZ))$NL9SEHSx+uo z-b+4n>DI+{yuhIXCJGAX=qQ69PuNQVRRg^~0+<8PTxrX=!e(AJ{4@9$b1Ne!(#qBQ z^bwls3%Ee1)HO>#O=(jA)CFOk1kWPTyQ@o#_N$Ato-^c3_@`5)qLHImtW*WXzgA%P znJt0hzwo`EcG7;3i2%J1BH9_e^Qh`)uL7Mb>j+_E8DLi5k7up`l^9zhi-5Bcm>Gy2 zGGWHBHS6gr*7>|S9b&SC0x;&Ug?K_%NO@?uHyK=pJ2`7(5IqpNg}7LQ)=WpFqlva< zC9pYIvkss|Yw{^95X1KbG4MEa&h0J;LOKL62LF!4d(zhZ0vdSK4LPEPf8%aR)7j(QO;$iiBFDtklXZIO~ebR9{mlM(bs;t{M>TFc5jizP@MqEbTdW zTAs0BbcDUF%p85+ABwFxTaF93I1f*AI`L+>NKypA`2KGVtl_butTIgeRPHq`k_7)^ z|9^3Y{pprYD|q-1VsqP%%K*MGOmhcqlTd^uIpO~6G7{4e!0rGlrho{4FrajuGgH6g z%#BjfB6Z09lQSSkl>u7ojH6Q-q^Ds&C@`hx5Yq|!A}t;k@DRHlaC8*|HrW0&5=p5k zhXA;)Q_TM!H{2zP7(@&})o37!u(ZsGf68w-|CJ*#o^%aI*l0|8LKsW-@g`LoELG7S zkgkqHF@z{s(5H~ykkxs0jNGa8F_k$hP*xdj zSU?Gc&q3oCi~F@{>Ar8Vugxg#kXP}8U*eqFmeb3jo_ACCL6za|kWcNNC&+Uyxyat% zykCDS+vk5_B$k4Jw)FeOxCXnYl~;;$i3Iq;^O54grt~jY!=A;jdW`>I_|1&FQqx71 zX1V}i4x$%4Ne_pIY*F{|=`tSVTpt&!KOQX|7kBo!+2=3Uv&kcHmH|&&)`r-3V!2@} zDZ(8M!!U(F!}te;1JHvUtFkO8+@w@~@AGE0_1jaPwP|Z5?)>X3*6u{~*u%|ET7gaM zBMqW47~2F(-9kUBbeo(Cr!namu2~drl7Vd7);wwpBrO2KE+D5F+^Ecwvmjj8Cz1Y( zpnb-w=5xiJ>e&L~VNICK)Yoy=e$*l zCwcNy%lPI`+cwy78;n{%1SFS&tTqUj1In6x=sVw{Kh?%@#mzZ6=Fa?*S~)AS&=_jl zCCAu|7zE_m`cqC7+>75%|V_F2Mrl%vG?loW>D z9rMPCL3FtxSr&}y@l1xZ>?c#HN=hROx-~w7<;hXq^>efmm(Xf#?jevIFwpqR&I?r4r9^QGc0`FrBv2PUwM7Q zI!rIz*HonYA~PdvS=iYXn5V2Vw^DiPE-5lBC^V#EslE?Qw^I0l<2canSHuIpcpEM| z*YKZr)omH$}P*NaUer&X8(JEDD@6eX$iLF zydTZ#PXnYozr;El{5MHMi}T(&Gag$`bWfa!s&)xJT;B&I3;Ynm<%q^g_9Z10cP|ymVGcnkUNn_t`PpYUFzwukEb0 zFd?m2MmEb6#Zoj;G)U3=2ip*`ixWZ;ZBduj5k^DV*=i(6clwY} zHTA|qnO&%r3mqJhsftQEaUU89h6!aExRLtD_OALaZ>=3xFIM z(mEQH>ep-m;|nuphj2Fg&?FGuY~tcvE4tKP(Oe5ZB+d>W&!{8HVdxjvPpK(kj;cAA zv1ws#6#jfje)ZkuFWj@A^+}N0zh)J_D#FXP5$I6TVk!uW!tL|93FBuZ(Ml>s@s;=` zzit*mKa=7bTh6Wb8ScxANnsZRin%^i@Ft1X+!-63pX@v%Id0Z9?xnvZ7Cks{voVz| zE6gnGysB`QpRj-NPcR~#Fi5V04d%#Ps5#ULR`|6Otk~)rKhzNk%@7`padkac0&E$)IC>0M1buD7KHISXp61Ib^k z8?XX3*ij2b>Yje;&0a-)usgtoA?(po1w5R7EI1*Y4EaG6iwiB@aFR;7(FiseaHG+P zur%j4&EI3F{*%2^X6nlm^{1FKLKnB8m3#a$_j(W2XlaUsP7_-5Aw}2HM(j`e)h%Zc zJBhkfcNXK}#2ZBpW1>9U_Zl?OOOK_!JB{58QN0!Acy?{}3RjU)E=+M#Lwwjqw&23L zcTR}c7i~^I%N@RWRvl69y`=~zD?z;6y{7arSWFaeMW|dd$7jR`NyteHEmFItVe_%^ z+S*ponMka75ucTW6I}#^Vz6QnO1CEfWD9={dmI9-e{AhOD)D=0u#h88ED`F{Ov|SB zk&a1lT`wWk6l0IcQ54b$*rdYfkVjG29cgJl(?c>|ps-c9A=D0}w7$vr!`J z3ZzEM-ZcFK0;-+)w`bOELzS5N$ey>>fzQ?U?n)PZtZZmrC_EK<3F78YtOItAJqHPuWN+q zBB9`WE|0h#qrP^!xW^!Q{dGZsoxJUfIqr!}*5(m@Fm#MLN0LFEllz1k!3s`&NCSsP zEJO|oSZ7MW^{F(QNr0B#Nwej2(*Q}N&hDq>Zx+GG^hN1H^=I&7Y)@tcSgjELw0iM@@r7T`HOfxBe1FIR>PXZENXUZ)_#@C`PS zB4ri)B;mojOa_=k<8vWpX#CT)7W27Y0s5e4gK=$4Db*Z|CF_|n9k>}34f3Ty;hs!} zdW(N|RV2yaa{<#Wf96*$!SA9pNni_Ua#c1u!g92!@vrk(;1tt2cO_*_G@qU6A%TG| zfj3&x=2xx4I=Vr#B8>hqZ)rB(`2uO@qodo-@LQYs6P%tYH7)VcT>XKkK(~s-ChMw8 zf3Ajgve2&D`UY|RK(p!w0){#YVIW>B?Nmz3Iv07y5C`*Up|O8-D=X$GT6el@x+@V= zs*+mH&#J5ewr3V2^1Lvym4H~4Jv59dF-tX{vYy2H3JfdSU}aR|=z3_jBbe<89_u|o z?bNk~KLXgw)*T~?HyaghOBiTt>2lbw+iJZ@O_M~jJ`!gG;|_dBg#ea1%%~SV=MovX z3omX|&Ffd!dZ+*52~$`T!*xojyU_r7?c-8bgJKwuLdjAH@af>{p8My%TX@eevw|x6 zo*{i?8u}eF6!t*{t{kEc<+vk;9goHtFL`yWB`XSp7lp}-#xi84C3|+kTF#K2v96zW zjsBW1>In*#av&@ZVm)rbK5-yxz#8HPP2bYilIJ)865n>gSI9a+>%;V?x0LO`3ha3su%ac zW+yL=b4xN`mnwFL25(R%N`WC?*$R^J?NTXuVILvKv|u0%8tEMommAmVjav-Kg?uyw zRd0_)zc3D3&~K*I!{IFVq2!^R#uGtH&Y9rSWJ$)}5bF=WXbG3BD97LyK;K-- z@<${fwME=WHtnn8ZYk`r0C%-Zn6W{0s!yPW3(R*~O2)GkKP}AI4wl;8LW;S>uPOno zp6P-JCm{Fb7#`duiVAr6G^0xyT$lU_*@+B%SS#wFSPgQ&1W?D-B0sk$SyG zmMpv$bPzMPw1QYV8`3guR}@_5XTohPF+^#USM}c>B{g`IU8KO*2lCuhDQ|C=b`A8r z(7j6(4X_duS*OKua7YFQ7Adl^e{q5x6z^B09sL$FieKphF_aO`AI{}T`xj4&h%%t^ zqH5AWPO1j2);bv?W}x#v8--FogqR3pr+<8-b%#$#`18xd_6VMBJoR!qA|--CrA#T- zYT(mxc?KM+bpnlfA0sCZW^0uv*CSfDOz02ZF$;eRU&aUpF!_f5s zUu*=5?MzD?V|fTdhhWeihi4dN+R)d_L+{S8!jkdaZ|TS9!$Vb4tS1Cq9?+9GcF}BO!I!K~a5mx+Pid zD6mJz<|s#S;|!YBxpjBo|2J$WE~2=$4CJWMT473X(TCF7%U|g zat3@n8*xDlB-Pbm6lgMbFoCk{k2~OuYFA;LZE}j!*jO3rQO~d}rjV4MHuh4(mIICs zW@wP0mj*SM9!EVYGaXt-{vKH>ifOX-z{-2Aw;%|xSQh6uCPB1qHHzYBZuzCWGW%p8 zOs1#YnU;gK>(!8=k(tK8a`SUXIfwq5jY^0sH#CEO#EQb#olk*9JbO z8I5V~B)a}3lL3nTD35l|?mp_`8-1O*-eQ)L{vJ*+eue{ch&o|mvcP9*Eyhl2p2wcK`P1%fEz+Mxb+EOkN2qp>tn_Y@X&X~O>W!!>I zI8%A2BRJ{V`lbns${KHE!|e#mYbiOTWzM;CmOSj|22zvI&nW(*8*L)Cin`j)jSD5r zosWH9p3sU2Uy$yMRWF&{4&dz#l#nwdWA3!5qo%RbBUhV52HeImH9H){6*LS%NSJ2s zgwa)$!8pE&|M(gLpJVT7UBq-j!}b-uZ@ytu_$Iy!-<{Le`0Pwp&m)a>2VV+Q(zMBqjpBF*%r1YPOjdR34iLULCf%1>z=N zdy0sEwoVs zJ|Gc^XiM9!og@Ef*%h^`jFV#8zqzYG(FPVYaxn~8`}-B8QCHdgJE|?fw~HFrMaAVN9#7@O7A2^$2R!YY9Xbb zqv14u__3Q>ft%>5k_XM%S=H8Dne|&yc8;12dhz5XxtrE~KwWJFu8x>c9XKB^EupIW(;2Nu4PLb_R9RRRCXm}N%XMy@1ozf13smE3#l}bd{ zSnnec?h)-@HnL|i;1@3@i6eL0_Lr{RlNZU0h~&n+%;szf*auGW*z_Q7!`tXHZy!&4 zwO-USE$)frcsCys^$TaQf30IxD+Usfb*L|uD(-|MyRF1Hj{*?ZwiL$^Bx+;5!gp4BUnp&qxgGN_;+$ff z!u({=%Ab&zY~JdX_8E2kAfU&+0$%zn1sxMpzpTbwk}N7qFW>xT*? z*dK=c9Q?*nfCW7Z9qB)DR5VCnbVQfi45L)-^Lp^tL*>X<{ ziNk&PQ%(f7AX9Q-7B{)Pj;Lsq!00?jcKO2XQOLRMCb;z;E|BCyM!n{;!yzf-L*`H# z4qcNoDUo_AF)_CnF|b6KEf7OQla?7b#XKtqdYs*^ro=vze%E5j5AEIudL2v2YfSP>th} z3>Fp0A4=h=BbRk7$$P2Bt`x^-fF|@8&CROn5hnLAg1D%s+y_|~{?e7S!Qo#@lY+$O zC+~vO`pmlZ{6r8HiRMH^q8ho%kvMTvub62bY7DV};Ot~>0kXx>J+YsOPwG^AWH!Rt zT%Yk6aGCHb{vw&EUFVwV7-y>7nV~V6$Zuh${iwOOfUCw5?%Cku=Eqy)B-H7UV~Yb) zWF_`6*>KAT-Il7&GZkYwcrZ+ z!}+g0MXQqJ{)yXyk6NZdudFUoEkg%!t-R$-d|;J;Tymcp>_hb6^||CWWavYiwXCuZ z_D87z?K%_Hzb@LLuR`clAB?}-;;7gjS+P5_WYVoK3-gppsA(khRG+gqx0}m&611*U zk|~1o+Q94)4JGw`)5@dq8{R3vVE^Q}$yi61Bv9A`%$ASaZ{oN|V$cf8z1P z>g?mhuqP3lhY)4RPqyZ4N(%wkfRlpP=7g*UPYNpQ(OggzMbT=Lc(LOXZ#CZJ(=mg6 zX6*CV0sfR;gpEoP9@m(Q8rV%VKOnB5uhNTNQZmW$hAFs5SOUex(tmvT5H~&_F-p*p z{M1!M@#h^UhC`ga zstolrnLL*uv>wYnp0*HkNuch64a;zlVjQ*m}4*Ii1y27|U{YxxRT&7$D4A zgH6l(@q+%v5`9>16bPxp5<6r8GeT`Lu4?@hDl7&^K_7UFc4qZAa~j#Ck{Ihcu=Gk=tWkhF=tEi>5uB;G^bpf!ir(P5} zik+(`51zf+;In~l+CTeZmvD8)*CdZ&Ip5e);QKPn|$YD`CX zftjtvX$}gR6b{f^*JjE}obi)Mw8*AJI*a`ZQ_eyAP(;5cT0Q(4xH-wmh=#9O@{t+E zp$mB#M%`ZoaqKKP*v@iI@?N%z%R0Ll@*Ph-VRo$kyFm^wF*~V3Hl$`^yqtY|0Zekx z;y{DRldk?0)6|By9Zh6jN}_XRUMwP=9l`3y5wfRpAWC)3gHKRikVG&-csL{DWX{WtX^3cesYk;UoQuu0$NV<|cUS6C^uDZ&Wd74)Dm ziN#hjH-xj0>!2+_@Jw>=oKsJGli#YOqhJ%_C8NE-+ia!bpez*tJHIZ%s13L8gJO%a zridJnXm2+dvJH^#g`7Zxs$Fp2zHF(s44!i*1IMBNWB{?IC&>Z2mFJwjcnD=8f97`IuH?ya|rD4 zLN?PAwk>12HDeWTQ>c)QWH+Bt*W6?p2hWN(mfGr^v2;3gLYyTTd&B#`$O|bf%9OS- zf@4agLWQJL$gb9m--lX^z$IOd-@7DNSOS~jyU|AN4>t94%_joejmy*FK@1~DD_B#> zMiS;aLvZ;_opr{F(Qby)!%O;2M3|2h+KMWpz!mVHPpWL4{_VIz>o&6xmLYGi25W!b zr?7`yAUM&9L}xCv8;t8mP)dI+6!kFI_i{FeRkDwj)z^@3^r`{7B4t-fIRO|od-=y{ z3^Q!%311c4SGFb0%2PttDl5c4KVKr0w z?ZvvAtr=^_H1F!{<8GsO&U%e|lb@hNmWjnIK~@G1Ja6?H9T>6}6u{LanoW`AcwVs&~ zA}ZMf3_7tiOSM&&5@sHf1Tm)2E6BxosnT2eDm(M{-x1nA;89!#)?rbWvt4z{jv&=; zY#gx%+msZfCNR;|+EFC0?@BVHY$*2LJg!AxKXD?UJe}f z{pGtM^VmZywG>n)RALQxVx<|TFr*o@75MW5_y=$A1%lcrMXcKYv>pfLPQ_WP4H1B$ zFhwGS2rB9#}cHG=$pZynl*YPIGxXuB)Vu^$O-XEtWCfr4Yq z6u}JQpP$ztFgX@x?ao=LdNTG_6A472q=mEbSzhs)KKRA&^txY+!!mT5lTYo@2jNGG z4c$6|SlQJ@)7Xxc>>(curZO0+?MaW^&HzkPdXDO^2lH)~ z7+hEA*8FtFLjXq!RPeJ)m`uC>*pYQOdDkFBP~4vPG`3ZO*4UkAI2_(t)}-G7C0iZi zZFl*7Jzbq$WwzRFbN6<;!@$KKgnH1xCwV-cp8RYaY&>M_^YJV|LRFBp=JIxVKCsB9 z?25<9joG$_TW}@Vi7R*kj^?*T7>Oqe;=~IVgjZ32)SCF2EgfJXp{AWEo1TteJ-qCE z7Ca{Y%sRMHx;%|cm7p|w=o*iZno9KVhFnAh=%#(ekY)a~jAm@&JNAz7mX;;v&U70eW_}4LfkrLRbJW93%izfT6BQsRSg=5Q^Mae0Y zi^X}l#AeTHG-uZ+eK`E`%md5adt*U{X30Vr2lCac0^%k?is$&AP1x>wSkBr&9#FV*3Lps4;`S?mA}YifSZRT$^HH)97(aEDs9Pn*JET-aLfxCG?{Q_Nnh?NA#S z9Z#>1aN&Asd#gSf(mkzbjE1B7%pux|2-B-XCp7-~&tJ!ymiI2Sid62u?P&&Osz4ErV2j;+&RK7%$ z(_=C1r4aRomPl}K9*c6#!gq^JL`1ptHruM z%H?P6Y-w+SuZ^0iXG)!^R$FfPVLx%nvmgu?GhRIyD-s+{@8&DY+A0qy)fUszr0Zkzf_vd-TTz64@x_o|BGqM0W`MT%>D^KaAIjo z*T=+O+S%4+;~l%_YC7??Sow0SwNq0XzP^D9;ZzF#N8#jFVg7yYS|Pu&Q#d=CVOfQ! zH&kl+Wm5f)ObL+4*Ot}k$pbX^Zvu`3Xi6x29g8ud>j5W}Q6(Bn8A_^l5<0~q3NxXz zUD}u1j)=wYGL+dR+voQBYH@YP*TW;5D24Iy=c6Vh%*%4XEXWe=PLg8Xf_3<9`}0%& zC{?-i{>{K@--|&JhWDe%$=)yiQ%Ds;Zovy!#})Q`cPF~@<_?R`9Oc_?_xv9e%{D!HHOEwaX z$RWqKU&@U4CdN07-=inon{&^h4Oib5@9Q&NZ4VRCD(L~9uYCH@C=}9W9Rfbx7-Vbd z$4+1T+T#{q2%e@m*Ror$Qiz$A9AxL)&HP5Foi4A>^ZwI~Z7uFL&)4%H9G~~&=hYw( zNX{ni*CN@^=gu}Sx6j*AW$3D(_dv0a-9N(oRC&XkX}lDyAcM~%p~l=Dfkor*amy?+@e-d?GWG+r|wAiUnH{C?DgbIOep zJ3b+mcD`?VyL~QmK0C9a5-hK-$Z~z|Bk6oabHCB}-njj~TW5Xm8vWkK6UBb+u6{;a zfADs`f8=_<-i&_EX8Ate62)S1eg30y_&l5IeZMH@`wnbrG*`hE%j@@k{k2hgqub^2 zwP*A0^?tb($;Z2y)9vwfeU-V<_+q!i+vWQbbiiy8whkBl?7-$gkgMpVOIZISA3c6e zN{SVLHv4l=l0@0_$@=j0z9&a`_quo5k=qG085a_}T5_{_;FLh={YIWe0Uf)nMbngv)k(>m2QXo=l&~e&EBwhp-}E#uFL!Gnoi8Z zX{*-*qA`J@UQu~t1mxk=&ekqxr^n;x*$qzbq(PAHaO(!I1lVqyx19p5kRcZLYuV?s zzP{G?{dW0dho}8$u2Sy%^Y-$qQ(I5Y_UFC!X8Zf-`ElbHkKaQyuf_PzNnQsBSDBK1 zlc{!PXmQJO{=3y^`@-*bJdK>~dA%(3`y5A`=;&3!^Lcodv5l1b3T=nm>hX2|-hUcg z<-*{;oi)ywTBp z_&?D9)yTp~&(P7%&B?@(*4@VXf20@i|Gxh(6B8RV^Z)Aq%lymJGcd8zGyVVlfB#R= zfBOFt3;d`5@Bd>b{JHXxO2lrDKlbqjiDtw~q?KXc-Yw&3@meq#wVrM=B0VD{Do^Mz zl~9EnH&y!a~a#U$l?!;Kd@)_^ZD}g{q)sorf19R+tK}T`{ndL z!~OH3_H+NiMz^!+<1-?J$J_1w^Ywto>-T+k6p6<7^ZDS$*Licz`+WeCoS^qPdNIov z_47IU+@N@Ua-$9~!Q= zv*r8x6K#`(c5wQj)^$cV8=^wj>)ZAA@iJ@o!}{Hd7vjgeD}@5c<*p-dt8dA*W2y!{BX6y z`_o5vd;Il)b}*M}){6J-`mp!#GCS?|_vfO2r2)ocb89Q}$Mfmqg>J{M>%-%7r_=1_ z%?FqJMbGbH`M&d`b*C47WK^TI_WNP*D)o+UbDPfV$M#Swg#N5o3p9ct)rZ-1h*$iH5ftmT%@eGcBO%voOi$Lq&p&+ z)!FQsyVc>`kJFELq4uxyRxm;|rBFBDbnWb^^@TegRehW7V3E?d#m7bLM)2gtp)8C`MfxzblWrCi=J|P$uO}M`cLT|oH>ViSw33YK)!oms zZgk=c?Pm4hi*e7W+^->^{B<_sWB7i^?Cyi6;)V^qZHIs13$!G!7rX?n^}zi-@(zDT z_O;XKqh{wd9@Eiz6jG}$(B=I;^p3B)+vnpRq%m}3wpOpJ^JDaC1C8zHYw^OZHTP%y z=Y-35y7%p!XmS4}Gq$%F?XmNuwx?Fx_zr9U4IlUpETRKAn66KseUkQ4Kb%r`EsTyI zS)6 zatcGQJN^OgIn45?R$@ee6;<_P4}`f-4z>6-Bo|>wv^*lsDk9DLcw-kA;Yf(J2p3_k zRRpcY?7w(jy-`XCRt|sFojf%DSaqlu8o8AO;M;p>G+B12Gf@dwYHOfYXV9)lmzpon zKU<`zJApVdsAZ(slC>O44q=H4E^jAOBUsfewXJ#Ao6@HW8BU{k0T@o}>lGt>P)66( zF6c8@57l5Qy{NF3mg)tlOGyoBYMLTQqgvTU&$UTS78oQBXK;mEx*-5lOd$cY^Ph)= zm5B2=3yG`rg*r_WF~vKSwDBA`vxoM>ynzm&osvY2!C*j<-Dr)OE4xeS4rrksd&`{A zSb*$=Yo+b7WVaH-?1XQ$Uk$4Pb@}{1-*Na~0d&(5a9n!?p`nL+3cXpD)*msaO zZ0S_o-AnD#m_XRwS)I`sz;qAS7PkVUbPvxiX>qS;b*bAyxO5k%c4OuF90e@(IOf~x zv6QYhMU+2FMt8+*yRoTMwY&he_({8F+UFUk*yDGmxE`#|*Pv5o4obcCV4yYD#J9%J-{r*@p66l{S=iL1BWEYoJ zeZB4Q$U8g?@+LrJ)YAjAZ8Tvt-UvbITpOgu28prF3Za!EffZ9?6-44wTn7P?2r-eB zrsztM#ELV9@s+8MMrPhziv%WVV_@&g)7hh}WQYvC*08BXO9am6pxxthWOpm8lwAx? zS8MXiM%E15iOt8cd5QMMVXK?NzbFXqNC@r=ME4P3-3;JuDgx^Ww(_ikMEQs`}r;zcXd=J#b zk@iwIFr&N=JWIxdk!hf+WI%cuWc!Ys>xxVil6D~+1~-@GO|BnAt*%I=S$k+kK3ZAD zCMwFwlJxP_nfdsHnbCbs)o+;T!nzpHP&zj~w;lHknu%JbHjf_3PVzo*@OHd1-SF88 zL=YC6v;iq0&{Ch7RVZnWHd{#Gse~_ZA_#3vN=42jtWx0D6~*}qc&NVpF)?OVKt0w~ zTB-6ch=TT<7d}?$0~X;g^KW3LICZvum_P5ZOrS3aZcAqO=_h( z#XlV(EJursAZ3hTk=Mc0mQ0|sl&Lmu-Z4d3)*>qMv^rPbv1*k6Vw=v2)r}R?@N@-t zi`Yhyu!OqwC#}P94-RI~pn@6KOi%_{Bf$3pseuPJM?=RjNUt=mFqEarJ5^8zEnrh& zC`F-vB&QCX%dALKq66+8oG#Uf-~d)HSVJz#Mji-r#}zSfMG=ueg@hR<*rN2bD8ort zo0B52tNreuK!{K*B(tpWOTu3!&3_jwula5^HR4Ywl^^TO!wlKvjFUosL`WU025J)) z;ENNs#c3mfgyeWSH2q5xA1FP^VzVM^J(j;WUlD`ek$3NmlR>1p1`N!T@7DKs`(34)IG8VQ#|Ut(*t9q z=&eNr3*?GlRYl|p)HUJ4+6gV8RHSKA{6f2W&({e-cWat=sd4q>w+SF33dX96!4@DV zp&Ak>q%bF;=_=F$bE`6iP;nm=g2C{ei_OHsGTppB?c_Y1)e@B^fv@hMcd~Th5h> zJ||F>2c&Gd<3-7H3s1|*O{j{Vez;7vbx0{Ll98NBItpilM)m@wO<797JiMbstjVK~ zl|I~Ct)0xcjd@a=1J9{S9@6JUquAD4Gwtbh2a?F^O9i%62pUT#ryQItp1e_CGWlj8 zh`MvC#8pBA3V(wJsS#nrf&%MIuUJ zIUhdFc8vhcl}$5b2Hsh=?GoFTp>wu{jej3!+g_c6df#&2!Zt+@Nfq4-#qYw50gCGP zBB1bu&>w~O@7-r}{yfl4xavJLN5FLGMvm4FPSRgLq{5uHoI2=Frw0d&xf7Pthm7sq)*376*DhGXVXd7Z zQT1C7gIp`GfQjzgha9QB>?aRAO8JUhHsVK*pV!4$zHOh3M;|$s-ch>m(2v*a}M`<03%=6F&1eY^}eCk+_^WFV~m~+ImS9b z#IoVbxh0WsFH|Lo-8wZ^`ak&3HMC1cIDkHYGn0SfW+eAv2*H>#tmxbRg=r~CZLa(~ zE2SW)n6wgCpsEz{o{Vir1Q^+|c{i!8vRG`s1eQK+MDj(c$ZW|BgeCQHLZAQVLovqQ zB!eFF4PE%s7)VhJFx*l8!M}G&DFSx9(5cwG&7XE39ho||Ouyj0XQ;c*pI(RnoWLUHMYrKoH%slb*-YpE9DRs$l0GM1j>>nJ93wIa^m&j9fSja0+W zfOAm~{obP02f~*$i-mq)Vq8}rMF~>+Mn1$ZCmCdDLjPKqPW6~Y1EV?+G_y1Rb$5}P z$*!caAyJfBM;&8YP~m86H`9C=GqKuAdiu={43L1 zuw~JenwUN*z(uhpVxRIst*EY8=h+HoQHz^q5Vw8G9!FBfjlQKXT?iTrhOVw@n~bS@ zNmU$@Il)ppq#I1aKOrQy8H@fbEvAY$4czRX5nf|c>-5uv?IitjRIU@{k$?;=`B;%K) zg&|tH^|4<03XPzPKJ3chrw$Q~2h`!@u2oSWlJHhODC3aTe)`<-1^Qfse3H9I5`CsF zZ8+NyKW%7sAlvzx%&yAS4V)O>iOZeu{!W^V?Hg7{&(tHC8>N{^!B@Sjq0Z!p`4@pA z?G%TITIMfyNLlc0z6BMJG?nq%WM{11+Cz~Iw#h>oeBF^j8Qqmp$Xzo0Rxmgyrcrm1 za=*xtPsX;x%Nan<#8AHFY*)f8>f|Ejc8TZzj<`KINfh2hBS?c>Q#1k z4%2#_)D|fPSqFkoYIhIQjd$H&kF7u%9H?L~k0I=c7Qfbf$>0*G#&kt~fHizP!=nE8@sO21n4IzJRK6Mb+KzB0>U|GqXM>@zt7zh8mAYw|XFuy`F_N+hx^n zv&&d6^V?-aGtM_$dKktZVzLjUl%#X*fs;4%>ua`K_AX zWnulaHD0vXdar;S!Crp^qAO3Dy@OGqw%xrYIU=8Af6^xp{P3{#{QJmS{E{@K8>=>3 zRFlN<8@K(GZiJlvPb|_iHe1>W%RJW@^SkJ9QD3$SDM|voRjCcE$(u1p*nS2X1yevdv3Q6a%seXs zFsar=*3Bc-maW(5_xNDidVe=XhfTcOeoEqO)ecAJ>fdA~Y2ra>2Ks&wDsOWE5}jdkt)9H;YjvOGFdZw^c3ytr7Zh0#>anI zEyg$dVYIw`AV<27x=2G^x(jxqYA!`1+gRSe4~&}{#y_~|LK?1)KnQXn1iDM`SQ;*H zdt1*u;H3R6!&n?Gt_xj%78Eyy(v*Ph+}v{>-Fm%mQ05|k1C%}S>)uA4)TfbSMeIUQm;oIVUyvS7s=8^{rMl^lmeoUDQyHzhhJp@y zfR@zji)H`Z+I_XIRmL-S!+J%wpZx_S#1`7rU^MeN-Z{pF{&#vApCY!m1X>OB2vOGKK%3CE|1G);j>T^ z|FY))BtbdjlMwEdYZ~tKYb{{X*KqG+wwN|5ZXt6%!^&h=CxS#!n>{x*jc&98s!NPe zmzdDW;$j;uG`p!v^yJL>d>prR?9|`@F3fK@%@?wI`&16DK#0dYLjScVc35^Tx-7ec z>9A}|0CjJxAl-l1pkrO?t}leDfrmRY->yQv%S^p`)$2U(umm4v3^>XdaAf<*7_^tv zX)CE8m(+Esr$}eOH$4oV0+0sXY2^uWTNjHlT1-iKd?`y{ixr`p%ny%htk{_}5XTVN z$9_8ua3-+F)Jb-eFx>d1kmart$oWo5oQ|KMsE}FE)lBuqQtEoFjkht@!mD)Me`=uA zCMrXHV{e3#z6Omg&JIo!F4^v&d%Sz7gPV@K)lf?Ge`@?``qJee5zYzLont4|GT)X| zZ^agSh5uJ=ZGg>oGF#EDA)r<=yB*B%E6G(a~;xjSP_S(b^wVs-19sVVc)| z0}H5GBuwloB_frlNjR7EdBw*txXD-rG~r+6wLgChtPyQz)J>4J7l^VS>NQ@GPm5W7CX33tTh;zfo27ANDC>3a#et0_8xTw0;x&$3- z+ z&XhQ0wI#F))*uwm&3_&~8G)&$2*fhPw=BAhV24=(%x$r2+kvLp=6V~3u1=7b1g3;k3!?~54b7QbVR0$=h zhTMb81gT?^A3WLBBhGi~&s}rj8WZ_W>hN3*TgY_#058E>WRI@;UBSxxK)7=jT=;X3J9_x`W0WvlHuM(@ znp_4ilFrrNMTs+UmaEkW2rtgx0Cq$aGx z3d~gd3unYbRLTOEM&fgTxSjbGp!|Taj=`=wna2^Lag`e(_0)2TKR;{fDg$7P1E}N^ z2soRoEHOShCVI>lBN{-k0?{^Fzx?EWRlaVr7e_+1lC9+86rr}n3q3Vcqq$cbCLC0& zyE>)4&pb+75C7kbNafua9yAa&gHzR4Vo%SJQ!L-^rwdo#ZXTY()<#Io{kcMj`26H! zohX`0X1kKWj*qonNmnMFW-s|s7$a3e8-A2zEP0Vlf69p8=?GLAfh{j$A5>Xk&7YEz zEpMTDtb42HFlYzAhgjEJLX)Sda~}JbJqNkhMWJBx#NL0}hp&YzLv9)kF$i0Y6zb|x z(Oa+?q#wE%CeW>g0-WfDgHfh~z4QEiYKOJo{l^P#@RZ*JCFIvH1O>8|)_9hxQD{ZHK|Qe{KH}G*Xz49949mI=wQ5jE2H^vKS;VJf$1luou&Z znx15=trksHpA(s<#MqNK&^8TYjEAwu&nx(5{uc);m@Rx#^zCtCd>&gFSYBoH3{%II zndt)?&~RIqHkQp8&n0~*`+KF25!f3$>q;N?Xp$}44Z@ozgcb{suL5RVwiuL=usg^m zK2*GpetygyT?}!^(1yYHy8E)kcu<(?=rzijcm12LH!Yl=Q!;L3RyS*`3EeV1XC_$W`g$)vH^JiWxs2GlXj zvsu@)3C{HgA1cG?Qx8QagYHDD9&t>lpk__INV&a4(sbqtQd}Xh_bWpl$P?IO2|2c~ zPlJBh#E`JWL=;Hk-a7f+tTB641!MONI>wejzb04QDSwx>Q^$p{e>{qfIU7I+6r%`o z8m7)1Taea~I&MT64Yx3p1srC#2`*dRE4qKC{D;FeRilaxlIxkNM;7V~sbMOAC5Ds` z6eA1uS|}!c9%WdYxZ}Jve5ipnPU-7m4x~!=l#d@u@fIr0MU?8ZPlp%Q#p3)Ae`w){el|&packfC=2bC*JCcD5Xzn8Cx*m85k}E5( ztghI{!2vdrOgVOGRpHm2gQDLR9d{BGRJ%TUWk4o3Wt2!aVhhd)rykGmy+Z%d-GCFL z7M?c5e_PuL^ogaWvCY}oLwBt^e!T#VJS;*+E+sW88334 zVM=QPd2>iduSImo)@4oDarBG*dD~DZzl~1}#QbIhL+FKx7C?sBi#okDXFh;wJu*Q0 zSJ;`!z0=)_sB5B{DZh;HdV`I?kUncLT%17YjGL%prR;)D*CxO+FlDKgpRPLI5ldg@ zrk<)gMj>>^%jt#R2BW|d@?AQf5M`CmofK`4hU5b{a($?C^jnC7sL)C;I#(staiKy| zZe^5Mu9hxf4dL$1_%)jeFo%sQzU}~Olvq-5C_T=mkix4LMk}cjbHth%BX|weUB$__ zIWaclMp|>Ehw9n3j1#VqP=(A!7Zd@}xjY0pGph<|s~G&qB|=bGTz5}}PBNklF(NcL zEUrs12z>k@8J-|>wvzOa=X?8jyp=$R+Z;CqQ2`c)&~m0WVvys;d~qTX7)s8vkW02j z^4~beYxiXB_$uo|L?(#F>;=9ORgK2>zwk=bG|{O+L3UQ%e8^E$$f^Ea1A`vETKJ=n z2X7R1*4wTM9PVjb8e1=ZXI=nOM++FHTJZ^H(CD!J=BrIWCwg~v>BDO5sN+u!VOZZA zXoMGf!gEB&2gVwC=%s`R3rmUavGKfpR9w^)w0lSe2&UOwl>unqTFkH|)`-lP*HPsE+}eB;kEnV&|*f0ju7cfVno6q$~}W} zHnJAY9_AA|;3A<2&8Drmf@3Pnd4uPR48_(}wh@IG@@nQI6vjlFccwA9i3rUg8ZCGA zu+c#(WvrLql*zA|)MCAd5}iU*{pOOjWP{9-KA^&SLx3*$H(>2Ga_&S3_kik=bPc_Ku(W5dZcM9MoSh_h8D~KR>+AX`mFhe`@2}1qKv%0gTUs zc3at80FBjuQ;Q|6LTd$wu=J3E<}&s_{1D)<+cmYFr6!h^e`3E>&a1&dehq zt$}yJB(GjZDuX(d#AV=vd*!E#Z8PL-<&=gnAT#7Fb}7fR*+(x}TretiV2#fA+^9d+9lXr zO7g?|$Pv%}6cSXC0lKb7Hr zCwh|eD7?tM2YoN)miSW2G5)5|8BarF#qZ*OB{~) zT=P?K_OY2WaYv=PXB97$Wjz(mrdB<)i4)DPl8|0Tjmm#3@l<83AF=n4iiZ`S58%)Vp}|*T9wONT8HY1_>gw=QR8^!bTIz69g9D!Wx(LKe*3;Pcns(kk#eM6}DiEF(zz8L+ z?Fbvv&LjtMBL$;^ghLM}dnNv7Eda)BxAsgxZ5yC*MscCZ8*&dwGjUP$L<__HW(A|e zM33pWb@T)YYU19c+*`HfiNaiBAm^_w3?7m=WVXObD@Cwn2BR$pMePMMe=--ZKpA^> zE}Y~=Fa;W1{t;Mjor%iZ=(vJwxpk1+{0iz;A_1XkE3}eaZXF1Vn*6syaRwr;rziG1 zF?LvqrD!W$Z3w%X3cUd&#moA8Bg#;^FW0qfKRy=E6_yL_lMnXJ9yrP@jmToF zFgAcF9#$dr9k$j1ZqNovmOHCum`G;;6^!w~$*<33njl>pcru3_mmfnesW38<(;sM3%EAK$O%G z8g~g9OC2?q)iTV2Be{BPq;nLZEp_uN`%ugJP>EnrQ3^An<)NWbQHZ8R$wiZ*<)cJd z1#9m{d*!cGmwUF~wAqAt9U#myidc8O$@V2dJf9WkUAf7!zTzX6?y@2(4mb`jW37u~ zPOOE0hpG#=S!4MDhfp34ZVG2kqr$J86&6>_&PAJ8Qvz(@>aJcz5ihM&V1qN88F<+i zAVf86MfCzQDk;gOx?lwa;JAdCf!(|TS{Hy)1TjpqbS}ktjg}}K$2g35E?v*zqk-BZ z51dRt>a%uZBPN}*P!r!J$g`iD*kf$`ku$Dxo)zu#p*x3$m%Xu z3!@L_8n4Rn06C3G{_Sy^OLawfattW}gDj`l2pWOM7W(1py^+RU46^XM-g1jE_2%%h zAjt)!n>LMdgL<1;y8SHXfR3Kg>f}nVD>AC7;86C5P8NuYy`pElD4|g~)4i^S)|v~- zMopzHmVXyJhK&k=z^*B7N(JP2Sp_5n;Lv@YvWmE95hZbBMMd0HNrhm*ZUe1Ezllfi zuWYX(OITh(zaK`f$Yij?BcT$EDlOskZc+(Jjzoys=|egMJ_Wd4n=DEwrjIfVWq1ct zziwhhWDm9O?@B2;;37bj7jci}zrBvYFCxk)%hKl$pt1>GMtGngi>!|hps1SEX1k~y zh0qOhC7U6|4OnBY2xjW9TSefm@K5tzuEUzf{j)!s8Jzp_ z<=-G9opPKD%NlqSxS~4CXZ{QowWT{7qkCkq2}L6L6`Nl5Hn4j8*p2}lHNzrT5>cmM z>9)~Q?Uv_PH72L4?;kuuBUYVk$}vn_v=lG0XkSk?Gxcoog#$_3n~eF{UvF`bauK+a z*NSJjtqrCWa8nP#y7u5m-N|~V}F|GaTxvo0b=;0HtWAG69Uyi>KqRZb_WLY>29K~ zc8c!F;prYZsA?7MFKF}(J*4xsWj$e7xSm2vK0lmYq;1@ai%{8~eGV|02klG}`2 z?(Po659Y4IzS<+hUrr58F68+HHqN@Mn)G)9@Ku>b+;*M;*fS8?<8p3Ie1`iXw(|h z$8Tt#0e2t?AyOW}*B}9ViZ|4{JjSqRbw_#7D8EwHoiEu^SDKvs|a% z2L|;%EA~Au8+4GqcXjY-F>2<3|5y9w{nUiA#c_&K0@8#~E>biI2+{NGO2-LMR5Q(nY{XM*_$d1VRz%MTsx--uoZk`+?8QnLTrM zXXoth?Cf`EcE`5K&c|}+%N7Or9JC5vGa8U4j~4Bnmas4Xsg>M`BLU~H%WX2gmoqbG z=P)%6vLxKIltW5Y*_Pe&df~TlE5P+A;0+pYyh;r0BDGzdQ)f7?Cn0GY)z>fw)13>w zTr6LFlvMFG?4oOJ6h4jd;OuLgZ4HMdhlDoiwphAl9Te=@jR%hgXUt<)G|L{m+nf*& zDXrPBDS0$LrU1NLs&o0hX4_;hJFqzE<%9 zTKaa_-#?Yy!e^3_n;$c1?Zf9PjHfG%o$wH<);_!TK73)pyJ^y65|1qkEOkZ1B zL;N>^T(u9sb}gF{Zk?2@k4SHfNE7u7UBp6>+p9GED{w)X zuN?dt3BQinvpe)9IeBV6dBM7%$!gDK=%pO!0vtTN7Fb`v5aAOEo;6dXXCn6={uY#2 z7>)|z%Z%Cv45um4f;J>!U1>_jC?sFsnE$=5+~hpd+Oe(2ZUzM?ua1YdtiTPu?(WeN z*$=t<4)o+`Kq8YhXx{-G%8?jnx0sBv^+~PkR7>kaczP#!2U|UpoJxA4GHv(AJ06hznB>aE^$6W0J)7}II=0N4jrMeBCdiz=$n@svmrrxb ze#U{? zf^Re23(+M#Vt@Mxq!$u_%f{fFZ`28%It2!LkuY0t7(*h`EdPWN;C;%D7bM}>L}xxJ z;r|=J0*?yN@N;lo@cb0x%BZm8j z<0kilDYeg3xDg3^{R*n_JB;c!2hM{c!fJvO4hz%0EVpb$I7M4V4e-mv-XTTJkWs=& zaRYmwMSj&z=*h~@j=GutmQdOn?Kf1ihWu6v8rFLJSMcE&9xK)#I(u(S#FGHUc@KWDPBmdLp_(SVPz55y*^FI?(|L{4&6NUvt5#+@X{nrdNfZ z=KgI-fUrs<3!eplSi5mxe4=8DqKkbNPCmi>hIt9q+h3pZf;Nobba??KxR0Z-I6yquMxUnenB7-m zRwxJDsggX$3vguxyzrJL>LWtLx)tb8MKAdJqP(!G9g01pq)DYDIMayoRB>QZA&;Ite zb%$~viW@5ce-sUyX}3e@3I}Yh{pRBYwus(`;U<_e885S4KSLDwe*VL!w_oegg*VKI zNa5Lsx4lvsh~?LNYe@YlSyee`5&tSgUU!Xd6QPy>Kk-c5CPeOU?= zE2+NS-8zdg7UKXjy2xUOhyei*`luV1sA{TFc-+k&2g*Td*gdWo-Lz7h*#DFJ8 zLAuu?$9y|r%nOc=zj7^LJJ?9y#*;Dp6$yzCx407qOa;CbV8pO^{%-{qFq@y?&_Slo z{*IpG^{iaWsNQZdj<2|kv%zAd#7IE>4}%!6I2G?ad+TV#ZU3w zC;h09X&hp|>bQJGmupEN*T{($v=qJQ_|4;>UF#t^fk%`XC4Z8 zzcutL!mxk5>ux*9dliPo1}tXfD@98wM@yM|9VJFQL#H`)uf!ZZF|u#mMzni@ViHq@ z>dZ(B0tA?rFf)gna;*=L3ZxIzz-nV=Xq#znx7d9{XB;UoKj%gk#_;maD@ncgN6IT=ck;N#H#Ez{1B+#> z!g13!_bYLmP4<=ysyZ@&FE!;1G7q$wZV3zz=n37dy>hpBWB;LHimNtG0f$c*xRH=H zs1NHwOy(a5lwSC4Zt{r%B|6&E-%=R3gNNWbR2tBEB`)_VCyFz6^eUzfI~*M zp&hg0kmJ-pBZdBwpfv?T#R@QYkH5H_RBm0<5fb~Tpf&61Q`i0M2m0VkR2O^}hi%OX z;X^{>?ETV6SYxMg<2q)N_P91#thh^>Tszl>7W3L%XytKw&-K}g^-1wQU(6hmm@!uX z=JAOAQwMb#A#G1v%E_=txIvc1?4c*l$8Im?AU7si%0gYAJ1MzH9ngkM+=c4owZoRt zA%5F#^B9|_zg`P`18@wdXT}Xz*d)H#dW=yBnAI?Snh7<83@Rf&X&_L3nNVZMpk~bY zKl1vi+Ef%x*Mm*o_8(wF zV>fx^Oj~fkNDXV*n0hsT!d4@yoJL~I556UKGM_lUuWoi^US6w~=j!v^TR*lJLl+QM z+UYd&N6l*5ULQoGArPv#Tl*a6PgzAJl`a*F0khtGr1W{70;wuo_83pS2^3+YtBm*a z8a^}`3bf5CMT)C0UD=%PKUZHR3s`^Y&emw;dZ-$OGS*lM3ixu;XvsS`Hr|m!viR+A zqOMypa#3vp8u^woZZzk8y}S}r{h2Flm4>V8*t^D2l4T7<<;u5p5jl_%i!Bc$N(M&d zR$0^DU+0iA%(N>qm7)6VhGp(Wu5OMiRBZOdNDN5?IerzmAk{clnpLA*{dsiIxh$q6 zi-UqteE!o2IUTq|py{%m7}>44Z~Omtaz04uJ?<%;;@S=_IKn-=M|0V3)XC3%glh1p zJJO0%IdnKqcO!-fkw9`o{y51`nlD#oa*ZE~WR=w2%8Gh>&Lvv-K=tkx{zic$dSS_s zLpXs+vFLnjPgMzE4DgY=KJA);$j9WDv9?deU)AI#@(d*yBy~~hJ)MF@6qUn*?U*Ru zCM{S;&xrTu@FG+51zFR_t)QBcOrg+5P)%_L|M^l7c@z#n!sAV@$ofZ@BvTo;AD6Da zDfI@aU7hlau5i^)%I1Pt-<(_X`@#x7&F*>QpyCa|!q->jQ1-U)^+$53J1BU)Uq+N! z258(2`R~`&e1FA%ySnhmxxGg!bLH=zvYqU4!xgQ6zp!3h+0Aa^N`}AO%YIf((Y$$) zNwLu}OJo-tK7XaIoIHZ|^Vka!`kALg27pADu|AfuQN>K`u_zEHr4p7`d5)buRthA# z2h*@&V(&*8U3ktS(aZE{qmLo44Po78Jq+P&VnNJ?z>qeT6bz$g&ge4a>a^zlnVTc- zX(}5z)8DhFssFq$57a4ck6@j5$IJYnM#<{Ejv-HZ;)Q-$#aByv5bc;#wgMOZ(b?n% zd%^ZMBCi5SFP$2+Whc|wmXFdt@r5yB@|hs2x9h(D4n-gCPjvj^uI|r!SYyxpzy4x) f#u;avamE>EoN>k(XPj}y{{jC36Xw2i0H6Q>%(^NT literal 0 HcmV?d00001 diff --git a/matita/tests/TPTP/risultati_CASC_2005.txt b/matita/tests/TPTP/risultati_CASC_2005.txt new file mode 100644 index 000000000..6b99bbe18 --- /dev/null +++ b/matita/tests/TPTP/risultati_CASC_2005.txt @@ -0,0 +1,120 @@ + Waldmeister Prover9 Vampire E Otter +BOO023-1 0.00 0.00 0.00 0.00 ---- +BOO073-1 0.00 0.00 40.00 0.00 ---- +COL002-5 ---- 0.00 ---- ---- 0.00 +COL004-1 0.00 0.00 39.80 0.00 ---- +COL006-1 0.00 19.80 209.90 ---- ---- +COL006-6 0.00 0.00 388.30 ---- ---- +COL006-7 0.00 0.00 40.00 ---- ---- +COL034-1 0.00 0.00 0.00 0.00 0.00 +COL036-1 0.00 9.90 159.70 0.00 0.00 +COL041-1 0.00 0.00 0.00 0.00 0.00 +COL042-1 0.00 0.00 ---- 19.70 ---- +COL043-3 0.00 0.00 ---- ---- ---- +COL044-1 0.00 0.00 0.00 0.00 0.00 +COL044-9 0.00 0.00 149.50 ---- ---- +COL046-1 0.00 0.00 19.50 9.80 ---- +COL049-1 0.00 0.00 20.00 0.00 0.00 +COL060-1 0.00 0.00 0.00 0.00 ---- +COL061-1 0.00 0.00 0.00 0.00 ---- +COL064-1 0.00 ---- 0.00 0.00 ---- +COL066-1 0.00 ---- 39.70 ---- ---- +GRP114-1 0.00 69.60 0.00 0.00 ---- +GRP167-4 0.00 59.80 0.00 0.00 ---- +GRP177-2 0.00 29.90 ---- ---- ---- +GRP179-1 0.00 222.00 0.00 0.00 ---- +GRP179-2 0.00 131.70 0.00 0.00 ---- +GRP179-3 0.00 74.40 0.00 0.00 ---- +GRP180-1 0.00 230.60 0.00 9.90 ---- +GRP181-1 0.00 89.80 9.80 59.90 ---- +GRP181-3 0.00 0.00 0.00 0.00 ---- +GRP183-1 0.00 119.90 149.40 0.00 69.10 +GRP183-3 0.00 148.80 149.80 0.00 ---- +GRP183-4 0.00 59.90 149.90 0.00 ---- +GRP184-1 0.00 0.00 109.30 0.00 ---- +GRP184-3 0.00 0.00 111.80 0.00 ---- +GRP186-1 0.00 109.70 0.00 0.00 ---- +GRP186-2 0.00 69.90 0.00 0.00 ---- +GRP196-1 ---- ---- 138.10 ---- ---- +GRP200-1 0.00 0.00 0.00 0.00 0.00 +GRP201-1 0.00 0.00 0.00 0.00 0.00 +GRP205-1 0.00 0.00 0.00 0.00 ---- +GRP405-1 0.00 0.00 9.90 0.00 0.00 +GRP410-1 0.00 0.00 0.00 9.90 ---- +GRP419-1 0.00 0.00 10.00 0.00 139.20 +GRP422-1 0.00 0.00 9.70 0.00 0.00 +GRP423-1 0.00 0.00 20.00 0.00 ---- +GRP444-1 0.00 0.00 0.00 0.00 ---- +GRP475-1 0.00 0.00 0.00 0.00 ---- +GRP476-1 0.00 0.00 0.00 0.00 ---- +GRP505-1 0.00 29.80 89.60 ---- ---- +GRP506-1 0.00 49.50 119.70 ---- ---- +GRP508-1 0.00 39.90 119.60 ---- ---- +LAT080-1 0.00 0.00 0.00 0.00 ---- +LAT081-1 0.00 0.00 0.00 0.00 ---- +LAT083-1 0.00 0.00 0.00 0.00 ---- +LAT084-1 0.00 ---- 0.00 0.00 ---- +LAT086-1 0.00 0.00 0.00 0.00 ---- +LAT087-1 0.00 0.00 0.00 0.00 ---- +LAT092-1 0.00 0.00 0.00 0.00 ---- +LAT093-1 0.00 0.00 0.00 0.00 ---- +LAT094-1 0.00 0.00 0.00 0.00 ---- +LAT096-1 0.00 0.00 0.00 0.00 ---- +LAT145-1 ---- ---- ---- ---- ---- +LAT147-1 0.00 ---- ---- ---- ---- +LAT148-1 ---- 29.90 ---- ---- ---- +LAT151-1 0.00 ---- ---- ---- ---- +LAT152-1 ---- ---- ---- ---- 19.00 +LAT154-1 ---- ---- ---- ---- 159.00 +LAT156-1 ---- ---- ---- ---- 65.00 +LAT160-1 0.00 ---- ---- ---- ---- +LAT162-1 ---- ---- ---- ---- ---- +LAT164-1 ---- ---- ---- ---- ---- +LAT165-1 0.00 ---- ---- ---- ---- +LAT169-1 ---- ---- ---- ---- ---- +LCL138-1 0.00 0.00 0.00 0.00 0.00 +RNG009-5 0.00 79.80 130.00 0.00 ---- +RNG009-7 0.00 89.60 0.00 0.00 ---- +RNG019-6 0.00 0.00 0.00 0.00 0.00 +RNG020-6 0.00 0.00 0.00 0.00 0.00 +RNG021-7 0.00 0.00 0.00 0.00 0.00 +RNG025-4 0.00 9.90 ---- ---- ---- +RNG025-5 0.00 9.20 ---- ---- 0.00 +RNG025-6 0.00 0.00 339.70 0.00 0.00 +RNG026-6 0.00 0.00 0.00 0.00 ---- +RNG026-7 0.00 0.00 0.00 0.00 ---- +RNG027-5 0.00 48.80 ---- ---- ---- +RNG027-7 0.00 140.00 ---- ---- ---- +RNG027-8 0.00 219.60 ---- ---- ---- +RNG027-9 0.00 259.00 ---- ---- ---- +RNG028-7 0.00 29.90 ---- ---- ---- +RNG028-8 0.00 29.90 ---- ---- ---- +RNG029-6 0.00 73.40 ---- ---- ---- +RNG029-7 0.00 69.80 ---- ---- ---- +RNG035-7 0.00 389.60 ---- 19.90 ---- +ROB006-1 0.00 119.80 ---- ---- ---- +GRP187-1 9.70 ---- 189.40 0.00 ---- +LAT020-1 9.80 0.00 109.90 29.90 ---- +GRP164-1 19.80 ---- ---- ---- ---- +BOO067-1 27.60 0.00 0.00 0.00 ---- +LAT171-1 29.80 ---- ---- ---- 0.00 +LAT150-1 36.80 ---- ---- ---- ---- +BOO076-1 39.90 139.80 359.80 ---- ---- +LAT146-1 159.60 ---- ---- ---- ---- +LAT172-1 196.80 ---- ---- ---- ---- +LAT175-1 199.80 ---- ---- ---- ---- +LAT144-1 221.30 ---- ---- ---- ---- +LAT157-1 229.60 ---- ---- ---- ---- +LAT155-1 239.20 ---- ---- ---- ---- +LAT158-1 259.70 ---- ---- ---- ---- +LAT166-1 309.50 ---- ---- ---- ---- +LAT153-1 369.60 ---- ---- ---- ---- +LAT174-1 369.70 40.00 ---- ---- ---- +LAT142-1 379.40 ---- ---- ---- ---- +LAT173-1 389.80 ---- ---- ---- ---- +LAT167-1 391.00 49.90 ---- ---- ---- +LAT163-1 399.00 ---- ---- ---- ---- +LAT176-1 449.00 ---- ---- ---- ---- +LAT159-1 489.20 ---- ---- ---- ---- +LAT149-1 489.80 ---- ---- ---- ---- +LAT170-1 496.20 56.10 ---- ---- ---- diff --git a/matita/tests/TPTP/simulate_casc.sh b/matita/tests/TPTP/simulate_casc.sh new file mode 100755 index 000000000..af58f3797 --- /dev/null +++ b/matita/tests/TPTP/simulate_casc.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +input=$1 + +for X in `cat elenco_CASC.txt`; do + grep ^$X $input +done diff --git a/matita/tests/TPTP/try.sh b/matita/tests/TPTP/try.sh new file mode 100755 index 000000000..685484d93 --- /dev/null +++ b/matita/tests/TPTP/try.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +prover=y + +MATITAC=../../matitac.opt +#MATITAC=../../matitac +MATITAPROVER=../../matitaprover.opt +TPTPPATH=/home/tassi/TPTP-v3.1.1/ + +if [ -z "$1" ]; then + if [ $prover = 'y' ]; then + TODO=`cat elenco_unsatisfiable.txt` + else + TODO=Unsatisfiable/[A-Z]*.ma + fi +else + TODO=`cat $1` +fi + +mkdir -p logs + +i=1 +for X in $TODO; do + echo -n "$X ... " + LOGNAME=logs/log.`basename $X` + if [ $prover = 'y' ]; then + $MATITAPROVER -tptppath $TPTPPATH $X > $LOGNAME 2>&1 + else + $MATITAC -nodb $X > $LOGNAME 2>&1 + fi + if [ $prover = 'y' ]; then + BASE=`echo $X | cut -c 1-3` + RATING=`grep "Rating" $TPTPPATH/Problems/$BASE/$X | sed 's/v.*//' | sed 's/%//'` + else + RATING=`grep "Rating" $X | sed 's/v.*//' | sed 's/(\*//'` + fi + if [ `grep "Found a proof" $LOGNAME | wc -l` -gt 0 ]; then + TIME=`grep "TIME" $LOGNAME` + MAXWEIGHT=`grep "max weight:" $LOGNAME` + echo OK $TIME $RATING $MAXWEIGHT $i + else + echo FAIL $RATING $i + fi + i=`expr $i + 1` + gzip -f $LOGNAME +done diff --git a/matita/tests/TPTP/unit_equality_problems.txt b/matita/tests/TPTP/unit_equality_problems.txt new file mode 100644 index 000000000..c296865bd --- /dev/null +++ b/matita/tests/TPTP/unit_equality_problems.txt @@ -0,0 +1,850 @@ +ALG005-1 +ALG006-1 +ALG007-1 +BOO001-1 +BOO002-1 +BOO002-2 +BOO003-2 +BOO003-4 +BOO004-2 +BOO004-4 +BOO005-2 +BOO005-4 +BOO006-2 +BOO006-4 +BOO007-2 +BOO007-4 +BOO008-2 +BOO008-4 +BOO009-2 +BOO009-4 +BOO010-2 +BOO010-4 +BOO011-2 +BOO011-4 +BOO012-2 +BOO012-4 +BOO013-2 +BOO013-4 +BOO014-2 +BOO014-4 +BOO015-2 +BOO015-4 +BOO016-2 +BOO017-2 +BOO018-4 +BOO019-1 +BOO021-1 +BOO022-1 +BOO023-1 +BOO024-1 +BOO025-1 +BOO026-1 +BOO027-1 +BOO028-1 +BOO029-1 +BOO030-1 +BOO031-1 +BOO032-1 +BOO033-1 +BOO034-1 +BOO036-1 +BOO037-2 +BOO037-3 +BOO067-1 +BOO068-1 +BOO069-1 +BOO070-1 +BOO071-1 +BOO072-1 +BOO073-1 +BOO074-1 +BOO075-1 +BOO076-1 +BOO077-1 +BOO078-1 +BOO079-1 +BOO080-1 +BOO081-1 +BOO082-1 +BOO083-1 +BOO084-1 +BOO085-1 +BOO086-1 +BOO087-1 +BOO088-1 +BOO089-1 +BOO090-1 +BOO091-1 +BOO092-1 +BOO093-1 +BOO094-1 +BOO095-1 +BOO096-1 +BOO097-1 +BOO098-1 +BOO099-1 +BOO100-1 +BOO101-1 +BOO102-1 +BOO103-1 +BOO104-1 +BOO105-1 +BOO106-1 +BOO107-1 +BOO108-1 +COL001-1 +COL001-2 +COL002-1 +COL002-4 +COL002-5 +COL003-1 +COL003-2 +COL004-1 +COL004-3 +COL005-1 +COL006-1 +COL006-5 +COL006-6 +COL006-7 +COL007-1 +COL008-1 +COL009-1 +COL010-1 +COL011-1 +COL012-1 +COL013-1 +COL014-1 +COL015-1 +COL016-1 +COL017-1 +COL018-1 +COL019-1 +COL020-1 +COL021-1 +COL022-1 +COL023-1 +COL024-1 +COL025-1 +COL026-1 +COL027-1 +COL029-1 +COL030-1 +COL031-1 +COL032-1 +COL033-1 +COL034-1 +COL035-1 +COL036-1 +COL037-1 +COL038-1 +COL039-1 +COL041-1 +COL042-1 +COL042-6 +COL042-7 +COL042-8 +COL042-9 +COL043-1 +COL043-3 +COL044-1 +COL044-6 +COL044-7 +COL044-8 +COL044-9 +COL045-1 +COL046-1 +COL047-1 +COL048-1 +COL049-1 +COL050-1 +COL051-1 +COL052-1 +COL053-1 +COL056-1 +COL057-1 +COL058-1 +COL058-2 +COL058-3 +COL059-1 +COL060-1 +COL060-2 +COL060-3 +COL061-1 +COL061-2 +COL061-3 +COL062-1 +COL062-2 +COL062-3 +COL063-1 +COL063-2 +COL063-3 +COL063-4 +COL063-5 +COL063-6 +COL064-1 +COL064-2 +COL064-3 +COL064-4 +COL064-5 +COL064-6 +COL064-7 +COL064-8 +COL064-9 +COL065-1 +COL066-1 +COL066-2 +COL066-3 +COL067-1 +COL068-1 +COL069-1 +COL070-1 +COL071-1 +COL073-1 +COL075-2 +COL083-1 +COL084-1 +COL085-1 +COL086-1 +COL087-1 +GRP001-2 +GRP001-4 +GRP002-2 +GRP002-3 +GRP002-4 +GRP010-4 +GRP011-4 +GRP012-4 +GRP014-1 +GRP022-2 +GRP023-2 +GRP024-5 +GRP114-1 +GRP115-1 +GRP116-1 +GRP117-1 +GRP118-1 +GRP119-1 +GRP120-1 +GRP121-1 +GRP122-1 +GRP136-1 +GRP137-1 +GRP138-1 +GRP139-1 +GRP140-1 +GRP141-1 +GRP142-1 +GRP143-1 +GRP144-1 +GRP145-1 +GRP146-1 +GRP147-1 +GRP148-1 +GRP149-1 +GRP150-1 +GRP151-1 +GRP152-1 +GRP153-1 +GRP154-1 +GRP155-1 +GRP156-1 +GRP157-1 +GRP158-1 +GRP159-1 +GRP160-1 +GRP161-1 +GRP162-1 +GRP163-1 +GRP164-1 +GRP164-2 +GRP165-1 +GRP165-2 +GRP166-1 +GRP166-2 +GRP166-3 +GRP166-4 +GRP167-1 +GRP167-2 +GRP167-3 +GRP167-4 +GRP167-5 +GRP168-1 +GRP168-2 +GRP169-1 +GRP169-2 +GRP170-1 +GRP170-2 +GRP170-3 +GRP170-4 +GRP171-1 +GRP171-2 +GRP172-1 +GRP172-2 +GRP173-1 +GRP174-1 +GRP175-1 +GRP175-2 +GRP175-3 +GRP175-4 +GRP176-1 +GRP176-2 +GRP177-1 +GRP177-2 +GRP178-1 +GRP178-2 +GRP179-1 +GRP179-2 +GRP179-3 +GRP180-1 +GRP180-2 +GRP181-1 +GRP181-2 +GRP181-3 +GRP181-4 +GRP182-1 +GRP182-2 +GRP182-3 +GRP182-4 +GRP183-1 +GRP183-2 +GRP183-3 +GRP183-4 +GRP184-1 +GRP184-2 +GRP184-3 +GRP184-4 +GRP185-1 +GRP185-2 +GRP185-3 +GRP185-4 +GRP186-1 +GRP186-2 +GRP186-3 +GRP186-4 +GRP187-1 +GRP188-1 +GRP188-2 +GRP189-1 +GRP189-2 +GRP190-1 +GRP190-2 +GRP191-1 +GRP191-2 +GRP192-1 +GRP193-1 +GRP193-2 +GRP195-1 +GRP196-1 +GRP200-1 +GRP201-1 +GRP202-1 +GRP203-1 +GRP204-1 +GRP205-1 +GRP206-1 +GRP207-1 +GRP393-2 +GRP394-3 +GRP399-1 +GRP403-1 +GRP404-1 +GRP405-1 +GRP406-1 +GRP407-1 +GRP408-1 +GRP409-1 +GRP410-1 +GRP411-1 +GRP412-1 +GRP413-1 +GRP414-1 +GRP415-1 +GRP416-1 +GRP417-1 +GRP418-1 +GRP419-1 +GRP420-1 +GRP421-1 +GRP422-1 +GRP423-1 +GRP424-1 +GRP425-1 +GRP426-1 +GRP427-1 +GRP428-1 +GRP429-1 +GRP430-1 +GRP431-1 +GRP432-1 +GRP433-1 +GRP434-1 +GRP435-1 +GRP436-1 +GRP437-1 +GRP438-1 +GRP439-1 +GRP440-1 +GRP441-1 +GRP442-1 +GRP443-1 +GRP444-1 +GRP445-1 +GRP446-1 +GRP447-1 +GRP448-1 +GRP449-1 +GRP450-1 +GRP451-1 +GRP452-1 +GRP453-1 +GRP454-1 +GRP455-1 +GRP456-1 +GRP457-1 +GRP458-1 +GRP459-1 +GRP460-1 +GRP461-1 +GRP462-1 +GRP463-1 +GRP464-1 +GRP465-1 +GRP466-1 +GRP467-1 +GRP468-1 +GRP469-1 +GRP470-1 +GRP471-1 +GRP472-1 +GRP473-1 +GRP474-1 +GRP475-1 +GRP476-1 +GRP477-1 +GRP478-1 +GRP479-1 +GRP480-1 +GRP481-1 +GRP482-1 +GRP483-1 +GRP484-1 +GRP485-1 +GRP486-1 +GRP487-1 +GRP488-1 +GRP489-1 +GRP490-1 +GRP491-1 +GRP492-1 +GRP493-1 +GRP494-1 +GRP495-1 +GRP496-1 +GRP497-1 +GRP498-1 +GRP499-1 +GRP500-1 +GRP501-1 +GRP502-1 +GRP503-1 +GRP504-1 +GRP505-1 +GRP506-1 +GRP507-1 +GRP508-1 +GRP509-1 +GRP510-1 +GRP511-1 +GRP512-1 +GRP513-1 +GRP514-1 +GRP515-1 +GRP516-1 +GRP517-1 +GRP518-1 +GRP519-1 +GRP520-1 +GRP521-1 +GRP522-1 +GRP523-1 +GRP524-1 +GRP525-1 +GRP526-1 +GRP527-1 +GRP528-1 +GRP529-1 +GRP530-1 +GRP531-1 +GRP532-1 +GRP533-1 +GRP534-1 +GRP535-1 +GRP536-1 +GRP537-1 +GRP538-1 +GRP539-1 +GRP540-1 +GRP541-1 +GRP542-1 +GRP543-1 +GRP544-1 +GRP545-1 +GRP546-1 +GRP547-1 +GRP548-1 +GRP549-1 +GRP550-1 +GRP551-1 +GRP552-1 +GRP553-1 +GRP554-1 +GRP555-1 +GRP556-1 +GRP557-1 +GRP558-1 +GRP559-1 +GRP560-1 +GRP561-1 +GRP562-1 +GRP563-1 +GRP564-1 +GRP565-1 +GRP566-1 +GRP567-1 +GRP568-1 +GRP569-1 +GRP570-1 +GRP571-1 +GRP572-1 +GRP573-1 +GRP574-1 +GRP575-1 +GRP576-1 +GRP577-1 +GRP578-1 +GRP579-1 +GRP580-1 +GRP581-1 +GRP582-1 +GRP583-1 +GRP584-1 +GRP585-1 +GRP586-1 +GRP587-1 +GRP588-1 +GRP589-1 +GRP590-1 +GRP591-1 +GRP592-1 +GRP593-1 +GRP594-1 +GRP595-1 +GRP596-1 +GRP597-1 +GRP598-1 +GRP599-1 +GRP600-1 +GRP601-1 +GRP602-1 +GRP603-1 +GRP604-1 +GRP605-1 +GRP606-1 +GRP607-1 +GRP608-1 +GRP609-1 +GRP610-1 +GRP611-1 +GRP612-1 +GRP613-1 +GRP614-1 +GRP615-1 +GRP616-1 +HWC004-1 +HWC004-2 +LAT006-1 +LAT007-1 +LAT008-1 +LAT009-1 +LAT010-1 +LAT011-1 +LAT012-1 +LAT013-1 +LAT014-1 +LAT016-1 +LAT017-1 +LAT018-1 +LAT019-1 +LAT020-1 +LAT021-1 +LAT022-1 +LAT023-1 +LAT024-1 +LAT025-1 +LAT026-1 +LAT027-1 +LAT028-1 +LAT031-1 +LAT032-1 +LAT033-1 +LAT034-1 +LAT038-1 +LAT039-1 +LAT039-2 +LAT040-1 +LAT042-1 +LAT043-1 +LAT044-1 +LAT045-1 +LAT046-1 +LAT047-1 +LAT048-1 +LAT049-1 +LAT050-1 +LAT051-1 +LAT052-1 +LAT053-1 +LAT054-1 +LAT055-2 +LAT059-1 +LAT060-1 +LAT061-1 +LAT062-1 +LAT063-1 +LAT070-1 +LAT071-1 +LAT072-1 +LAT073-1 +LAT074-1 +LAT075-1 +LAT076-1 +LAT077-1 +LAT078-1 +LAT079-1 +LAT080-1 +LAT081-1 +LAT082-1 +LAT083-1 +LAT084-1 +LAT085-1 +LAT086-1 +LAT087-1 +LAT088-1 +LAT089-1 +LAT090-1 +LAT091-1 +LAT092-1 +LAT093-1 +LAT094-1 +LAT095-1 +LAT096-1 +LAT097-1 +LAT098-1 +LAT099-1 +LAT100-1 +LAT101-1 +LAT102-1 +LAT103-1 +LAT104-1 +LAT105-1 +LAT106-1 +LAT107-1 +LAT108-1 +LAT109-1 +LAT110-1 +LAT111-1 +LAT112-1 +LAT113-1 +LAT114-1 +LAT115-1 +LAT116-1 +LAT117-1 +LAT118-1 +LAT119-1 +LAT120-1 +LAT121-1 +LAT122-1 +LAT123-1 +LAT124-1 +LAT125-1 +LAT126-1 +LAT127-1 +LAT128-1 +LAT129-1 +LAT130-1 +LAT131-1 +LAT132-1 +LAT133-1 +LAT134-1 +LAT135-1 +LAT136-1 +LAT137-1 +LAT138-1 +LAT139-1 +LAT140-1 +LAT141-1 +LAT142-1 +LAT143-1 +LAT144-1 +LAT145-1 +LAT146-1 +LAT147-1 +LAT148-1 +LAT149-1 +LAT150-1 +LAT151-1 +LAT152-1 +LAT153-1 +LAT154-1 +LAT155-1 +LAT156-1 +LAT157-1 +LAT158-1 +LAT159-1 +LAT160-1 +LAT161-1 +LAT162-1 +LAT163-1 +LAT164-1 +LAT165-1 +LAT166-1 +LAT167-1 +LAT168-1 +LAT169-1 +LAT170-1 +LAT171-1 +LAT172-1 +LAT173-1 +LAT174-1 +LAT175-1 +LAT176-1 +LAT177-1 +LCL109-2 +LCL109-6 +LCL110-2 +LCL111-2 +LCL112-2 +LCL113-2 +LCL114-2 +LCL115-2 +LCL116-2 +LCL132-1 +LCL133-1 +LCL134-1 +LCL135-1 +LCL136-1 +LCL137-1 +LCL138-1 +LCL139-1 +LCL140-1 +LCL141-1 +LCL153-1 +LCL154-1 +LCL155-1 +LCL156-1 +LCL157-1 +LCL158-1 +LCL159-1 +LCL160-1 +LCL161-1 +LCL162-1 +LCL163-1 +LCL164-1 +LCL165-1 +LCL407-1 +LCL407-2 +LCL409-1 +LCL410-1 +LDA001-1 +LDA002-1 +LDA007-3 +RNG007-4 +RNG008-3 +RNG008-4 +RNG008-7 +RNG009-5 +RNG009-7 +RNG010-5 +RNG010-6 +RNG010-7 +RNG011-5 +RNG012-6 +RNG013-6 +RNG014-6 +RNG015-6 +RNG016-6 +RNG017-6 +RNG018-6 +RNG019-6 +RNG019-7 +RNG020-6 +RNG020-7 +RNG021-6 +RNG021-7 +RNG023-6 +RNG023-7 +RNG024-6 +RNG024-7 +RNG025-4 +RNG025-5 +RNG025-6 +RNG025-7 +RNG025-8 +RNG025-9 +RNG026-6 +RNG026-7 +RNG027-5 +RNG027-7 +RNG027-8 +RNG027-9 +RNG028-5 +RNG028-7 +RNG028-8 +RNG028-9 +RNG029-5 +RNG029-6 +RNG029-7 +RNG030-6 +RNG030-7 +RNG031-6 +RNG031-7 +RNG032-6 +RNG032-7 +RNG033-6 +RNG033-7 +RNG033-8 +RNG033-9 +RNG035-7 +RNG036-7 +RNG042-2 +RNG042-3 +RNG043-1 +ROB001-1 +ROB002-1 +ROB003-1 +ROB004-1 +ROB005-1 +ROB006-1 +ROB006-2 +ROB007-1 +ROB007-2 +ROB008-1 +ROB009-1 +ROB010-1 +ROB013-1 +ROB020-1 +ROB020-2 +ROB022-1 +ROB023-1 +ROB024-1 +ROB026-1 +ROB027-1 +ROB028-1 +ROB030-1 +ROB031-1 +ROB032-1 +SYN080-1 +SYN083-1 +SYN305-1 +SYN552-1 diff --git a/matita/tests/absurd.ma b/matita/tests/absurd.ma new file mode 100644 index 000000000..3a9719e41 --- /dev/null +++ b/matita/tests/absurd.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/absurd/". +include "../legacy/coq.ma". +alias num (instance 0) = "natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias id "not" = "cic:/Coq/Init/Logic/not.con". + +theorem stupid : \forall a:Prop. a \to not a \to 0 = 1. +intros. +absurd a. +assumption. +assumption. +qed. diff --git a/matita/tests/apply.ma b/matita/tests/apply.ma new file mode 100644 index 000000000..a77c99ca1 --- /dev/null +++ b/matita/tests/apply.ma @@ -0,0 +1,57 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +(* test _with_ the WHD on the apply argument *) +set "baseuri" "cic:/matita/tests/apply/". +include "../legacy/coq.ma". + +alias id "not" = "cic:/Coq/Init/Logic/not.con". +alias id "False" = "cic:/Coq/Init/Logic/False.ind#xpointer(1/1)". + +theorem b: + \forall x:Prop. + (not x) \to x \to False. +intros. +apply H. +assumption. +qed. + +(* test _without_ the WHD on the apply argument *) + +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". + +theorem a: + \forall A:Set. + \forall x: A. + not (x=x) \to not (x=x). +intros. +apply H. +qed. + + +(* this test shows what happens when a term of type A -> ? is applied to + a goal of type A' -> B: if A unifies with A' the unifier becomes ? := B + and no goal is opened; otherwise the unifier becomes ? := A' -> B and a + new goal of type A is created. *) +theorem c: + \forall A,B:Prop. + A \to (\forall P: Prop. A \to P) \to (A \to B) \land (B \to B). + intros 4; split; [ apply H1 | apply H1; exact H ]. +qed. + +(* this test requires the delta-expansion of not in the type of the applied + term (to reveal a product) *) +theorem d: \forall A: Prop. \lnot A \to A \to False. + intros. apply H. assumption. +qed. diff --git a/matita/tests/apply2.ma b/matita/tests/apply2.ma new file mode 100644 index 000000000..db87636d7 --- /dev/null +++ b/matita/tests/apply2.ma @@ -0,0 +1,24 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/apply2". + +include "nat/nat.ma". + +(* in this test the type inferred for f is dependent! *) +definition test ≝ + ∀f,x. + f O (refl_eq nat O) = O ∧ + f x (refl_eq nat x) = O. + diff --git a/matita/tests/applys.ma b/matita/tests/applys.ma new file mode 100644 index 000000000..a26594613 --- /dev/null +++ b/matita/tests/applys.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/applys". + +include "nat/div_and_mod.ma". +include "nat/factorial.ma". +include "nat/primes.ma". + +theorem prova : \forall n. (n+O)*(S O) = n. +intro. +applyS times_n_SO. +qed. + +lemma foo: ∀n.(S n)! = (S n) * n!. +intro; reflexivity. +qed. + +theorem prova2 : + \forall n. S n \divides (S n)!. +intros. +(* se non trova subito sym_times poi si perde! *) +(* alternativamente si puo' abilitare la are_convertible nella + is_identity, ma poi va peggio nel resto (conv lunghe) *) +letin www \def sym_times. +clearbody www. +applyS (witness ? ? ? (refl_eq ? ?)). +qed. diff --git a/matita/tests/assumption.ma b/matita/tests/assumption.ma new file mode 100644 index 000000000..4b7859e6b --- /dev/null +++ b/matita/tests/assumption.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/assumption". +include "../legacy/coq.ma". + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias num (instance 0) = "Coq natural number". +alias symbol "and" (instance 0) = "Coq's logical and". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "plus" (instance 0) = "Coq's natural plus". + + +theorem stupid: + \forall a: 0 = 0. + \forall b: 3 + 2 = 5. + \forall c: (\lambda x:nat.x) 3 = 3. + 0=0 \land 3 + 2 = 5 \land 3 = 3. +intros. +split. +split. +clear H2. clear H1. +assumption. +clear H. +assumption. +assumption. +qed. + diff --git a/matita/tests/bad_induction.ma b/matita/tests/bad_induction.ma new file mode 100644 index 000000000..b009e18d1 --- /dev/null +++ b/matita/tests/bad_induction.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/nat/bad_induction". + +include "nat/nat.ma". + +include "logic/equality.ma". + +axiom bad_ind : ∀P : nat -> Prop. ∀n.(n = O -> P n) -> (∀n.P n -> P (S n)) -> P n. + +theorem absurd: ∀n. n = O. + intros. + letin P ≝ (λx:nat. n = O). + apply (bad_ind P n); simplify; intros; autobatch. +qed. \ No newline at end of file diff --git a/matita/tests/bad_tests/Makefile b/matita/tests/bad_tests/Makefile new file mode 100644 index 000000000..7620894f2 --- /dev/null +++ b/matita/tests/bad_tests/Makefile @@ -0,0 +1,57 @@ +SRC=$(wildcard *.ma) + +MATITA_FLAGS = -I ../.. +NODB=false +ifeq ($(NODB),true) + MATITA_FLAGS += -nodb +endif + +MATITAC=../../scripts/do_tests.sh $(DO_TESTS_OPTS) "../../matitac $(MATITA_FLAGS) -noprofile" "../../matitaclean $(MATITA_FLAGS)" /dev/null FAIL +MATITACOPT=../../scripts/do_tests.sh $(DO_TESTS_OPTS) "../../matitac.opt $(MATITA_FLAGS) -noprofile" "../../matitaclean.opt $(MATITA_FLAGS)" /dev/null FAIL +VERBOSEMATITAC=../../matitac $(MATITA_FLAGS) +VERBOSEMATITACOPT=../../matitac.opt $(MATITA_FLAGS) + +MATITACLEAN=../../matitaclean $(MATITA_FLAGS) +MATITACLEANOPT=../../matitaclean.opt $(MATITA_FLAGS) + +MATITADEP=../../matitadep $(MATITA_FLAGS) +MATITADEPOPT=../../matitadep.opt $(MATITA_FLAGS) + +DEPEND_NAME=.depend + +H=@ + +all: $(SRC:%.ma=%.mo) + +opt: + $(H)$(MAKE) MATITAC='$(MATITACOPT)' MATITACLEAN='$(MATITACLEANOPT)' MATITADEP='$(MATITADEPOPT)' all + +verbose: + $(H)$(MAKE) MATITAC='$(VERBOSEMATITAC)' MATITACLEAN='$(MATITACLEAN)' MATITADEP='$(MATITADEP)' all + +%.opt: + $(H)$(MAKE) MATITAC='$(MATITACOPT)' MATITACLEAN='$(MATITACLEANOPT)' MATITADEP='$(MATITADEPOPT)' $(@:%.opt=%) + +clean_: + $(H)rm -f __*not_for_matita + +clean: clean_ + $(H)$(MATITACLEAN) $(SRC) + +cleanall: clean_ + $(H)rm -f $(SRC:%.ma=%.moo) + $(H)$(MATITACLEAN) all + +depend: + $(H)rm -f $(DEPEND_NAME) + $(H)$(MAKE) $(DEPEND_NAME) +.PHONY: depend + +%.moo: + $(H)$(MATITAC) $< + +$(DEPEND_NAME): $(SRC) + $(H)$(MATITADEP) $(SRC) > $@ || rm -f $@ + +#include $(DEPEND_NAME) +include .depend diff --git a/matita/tests/bad_tests/auto.log b/matita/tests/bad_tests/auto.log new file mode 100644 index 000000000..0cac60da3 --- /dev/null +++ b/matita/tests/bad_tests/auto.log @@ -0,0 +1,100 @@ +Info: execution of auto.ma started: +Debug: Executing: ``set "baseuri" "cic:/matita/tests/auto/"'' +Debug: Executing: ``include cic:/matita/legacy/coq'' +Debug: Executing: ``Theorem a: @[\forall ((x): (@[nat])).(\forall ((y) ...'' +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Datatypes/nat.ind +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/eq.ind +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Peano/minus.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Peano/plus.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Peano/mult.con +Error: Bad name: a +Debug: Executing: ``intro.'' +Debug: Executing: ``auto.'' +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/trans_eq.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/Logic_lemmas/equality/A.var +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/Logic_lemmas/equality/x.var +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/Logic_lemmas/equality/y.var +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/Logic_lemmas/equality/z.var +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/f_equal3.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/f_equal2.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/f_equal.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/Logic_lemmas/equality/B.var +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Logic/Logic_lemmas/equality/f.var +WE HAVE NO UNIVERSE FILE FOR cic:/Nijmegen/QArith/sqrt2/add_sub_square_identity.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Peano/mult_n_Sm.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/TreeAutomata/semantics/conservation_0_0.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/MATHS/Z/Nat_complements/technical_lemma.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/ARITH/Chinese/Nat_complements/technical_lemma.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Minus/plus_minus.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Minus/minus_plus_simpl_l_reverse.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Minus/minus_plus.con +WE HAVE NO UNIVERSE FILE FOR cic:/Nijmegen/QArith/sqrt2/minus_minus.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_plus_distr_r.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_plus_distr_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/mult_plus_distr_r.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/HARDWARE/GENE/Arith_compl/mult_plus_distr2.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Minus/minus_n_n.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Minus/minus_n_O.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/HARDWARE/GENE/Arith_compl/minus_minus_lem1.con +WE HAVE NO UNIVERSE FILE FOR cic:/Cachan/SMC/mu/Splus_nm.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Peano/plus_n_Sm.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Peano/plus_Sn_m.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Plus/plus_Snm_nSm.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/TreeAutomata/bases/S_plus_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Nijmegen/QArith/Qpositive/mult_reg_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Plus/plus_reg_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Plus/plus_permute_2_in_4.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Plus/plus_permute.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Plus/plus_comm.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Plus/plus_assoc_reverse.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Plus/plus_assoc.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/eq_plus_reg_r.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/eq_plus_reg_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/Rsa/MiscRsa/plus_eq.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/HARDWARE/GENE/Arith_compl/plus_permute2.con +WE HAVE NO UNIVERSE FILE FOR cic:/Nijmegen/QArith/sqrt2/minus_eq_decompose.con +WE HAVE NO UNIVERSE FILE FOR cic:/Nijmegen/QArith/Qpositive/minus_decompose.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/Rsa/MiscRsa/minus_eq.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Peano/eq_add_S.con +WE HAVE NO UNIVERSE FILE FOR cic:/Nijmegen/QArith/sqrt2/expand_mult2.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/mult_n_2.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/ring/ArithRing/S_to_plus_one.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/ZArith/BinInt/ZL0.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/S_plus.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/HARDWARE/GENE/Arith_compl/plus_n_SO.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Peano/plus_n_O.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Plus/plus_0_r.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Plus/plus_0_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Marseille/GC/lib_arith/lib_plus/plus_O_O.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/Rsa/MiscRsa/plus_eqO.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/HARDWARE/GENE/Arith_compl/plus_O_O.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/Bertrand/Misc/plus_eqO.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/DEMOS/Demo_AutoRewrite/g0.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/DEMOS/Demo_AutoRewrite/McCarthy/g.var +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/Rsa/MiscRsa/mult_SO.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/Bertrand/Misc/mult_SO.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/DEMOS/Demo_AutoRewrite/Ack1.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/DEMOS/Demo_AutoRewrite/Ackermann/Ack.var +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_1_r.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_1_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Nijmegen/QArith/sqrt2/mult2_recompose.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/mult_n_1.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Init/Peano/mult_n_O.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_0_r.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_0_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_comm.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_assoc_reverse.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_assoc.con +WE HAVE NO UNIVERSE FILE FOR cic:/Nijmegen/QArith/sqrt2/square_recompose.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/mult_sym.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/mult_permut.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/mult_assoc_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/eq_mult_reg_r.con +WE HAVE NO UNIVERSE FILE FOR cic:/Rocq/SUBST/comparith/eq_mult_reg_l.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/Rsa/MiscRsa/mult_eq.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/HARDWARE/GENE/Arith_compl/mult_sym.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/HARDWARE/GENE/Arith_compl/mult_permute.con +WE HAVE NO UNIVERSE FILE FOR cic:/Sophia-Antipolis/Float/Faux/minus_inv_lt_aux.con +WE HAVE NO UNIVERSE FILE FOR cic:/Coq/Arith/Mult/mult_minus_distr_r.con +WE HAVE NO UNIVERSE FILE FOR cic:/Nijmegen/QArith/sqrt2/mult_minus_distr_l.con +Error: Tactic error: No Applicable theorem diff --git a/matita/tests/bad_tests/auto.ma b/matita/tests/bad_tests/auto.ma new file mode 100755 index 000000000..2972bfa62 --- /dev/null +++ b/matita/tests/bad_tests/auto.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/auto/". +include "../legacy/coq.ma". + +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "minus" (instance 0) = "Coq's natural minus". +alias symbol "plus" (instance 0) = "Coq's natural plus". +alias symbol "times" (instance 0) = "Coq's natural times". +theorem a : \forall x,y:nat. x*x+(S y) = O - x. +intros. +auto new depth = 4 width = 3 use_paramod = false. diff --git a/matita/tests/bad_tests/baseuri.log b/matita/tests/bad_tests/baseuri.log new file mode 100644 index 000000000..9185479df --- /dev/null +++ b/matita/tests/bad_tests/baseuri.log @@ -0,0 +1,4 @@ +Info: execution of baseuri.ma started: +Debug: Executing: ``set "baseuri" "cic:/matita/tests/baseuri/"'' +Debug: Executing: ``set "baseuri" "cic:/matita/tests/baseuri/"'' +Error: Error: Redefinition of 'baseuri' is forbidden. diff --git a/matita/tests/bad_tests/baseuri.ma b/matita/tests/bad_tests/baseuri.ma new file mode 100644 index 000000000..0e06223fa --- /dev/null +++ b/matita/tests/bad_tests/baseuri.ma @@ -0,0 +1,16 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/baseuri/". +set "baseuri" "cic:/matita/tests/baseuri/". diff --git a/matita/tests/bool.ma b/matita/tests/bool.ma new file mode 100644 index 000000000..fe39c310f --- /dev/null +++ b/matita/tests/bool.ma @@ -0,0 +1,633 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/bool/". + +include "../legacy/coq.ma". + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "eq" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)". +alias id "eq_ind" = "cic:/Coq/Init/Logic/eq_ind.con". +alias id "eq_ind_r" = "cic:/Coq/Init/Logic/eq_ind_r.con". +alias id "sym_eq" = "cic:/Coq/Init/Logic/sym_eq.con". + +(* + +theorem SKK: + \forall A:Set. + \forall app: A \to A \to A. + \forall K:A. + \forall S:A. + \forall H1: (\forall x,y:A.(app (app K x) y) = x). + \forall H2: (\forall x,y,z:A. + (app (app (app S x) y) z) = (app (app x z) (app y z))). + \forall x:A. + (app (app (app S K) K) x) = x. +intros.autobatch paramodulation. +qed. + +theorem bool1: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + (inv zero) = one. +intros.autobatch paramodulation. +qed. + +theorem bool2: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x:A. (mult x zero) = zero. +intros.autobatch paramodulation. +qed. + +theorem bool3: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x:A. (inv (inv x)) = x. +intros.autobatch paramodulation. +qed. + +theorem bool266: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. (mult x (add (inv x) y)) = (mult x y). +intros.autobatch paramodulation. +qed. +*) +theorem bool507: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. zero = (mult x (mult (inv x) y)). +intros.autobatch paramodulation. +qed. +(* +theorem bool515: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. zero = mult (inv x) (mult x y). +intros.autobatch paramodulation. +qed. + +theorem bool304: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. x = (mult (add y x) x). +intros.autobatch paramodulation. +qed. + +theorem bool531: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. zero = (mult (inv (add x y)) y). +intros.autobatch paramodulation. +qed. + +theorem bool253: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. (add (inv x) (mult y x)) = (add (inv x) y). +intros.autobatch paramodulation. +qed. + +theorem bool557: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. + inv x = (add (inv x) (inv (add y x))). +intros.autobatch paramodulation. +qed. + +theorem bool609: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. + inv x = (add (inv (add y x)) (inv x)). +intros.autobatch paramodulation. +qed. +(* +theorem bool260: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y,z:A. + add x (mult x y) = mult x (add x y). +intros.autobatch paramodulation. +qed. + +theorem bool276: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y,z,u:A. + (mult (add x y) (add z (add x u))) = (add (mult (add x y) z) (add x (mult y u))). +intros.autobatch paramodulation. +qed. + +theorem bool250: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y,z:A. + add x (mult y z) = mult (add y x) (add x z). +intros.autobatch paramodulation. +qed. + +theorem bool756minimal: + \forall A:Set. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall hint1: (\forall x,y,z,u:A. + add y (add x (mult x u)) = (add (mult (add x y) z) (add x (mult y u)))). + \forall hint2: (\forall x,y:A. x = (mult (add y x) x)). + \forall x,y,z:A. + add x (add y (mult y z)) = add x (add y (mult x z)). +intros; +autobatch paramodulation. +qed. + +theorem bool756simplified: + \forall A:Set. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall hint1: (\forall x,y,z,u:A. + (mult (add x y) (add z (add x u))) = (add (mult (add x y) z) (add x (mult y u)))). + \forall hint2: (\forall x,y:A. x = (mult (add y x) x)). + \forall hint3: (\forall x,y,z:A. + add x (mult y z) = mult (add y x) (add x z)). + \forall hint4: (\forall x,y:A. + add x (mult x y) = mult x (add x y)). + \forall x,y,z:A. + add x (add y (mult y z)) = add x (add y (mult x z)). +intros; +autobatch paramodulation. +qed. + +theorem bool756: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall hint1: (\forall x,y,z,u:A. + (mult (add x y) (add z (add x u))) = (add (mult (add x y) z) (add x (mult y u)))). + \forall hint2: (\forall x,y:A. x = (mult (add y x) x)). + \forall hint3: (\forall x,y,z:A. + add x (mult y z) = mult (add y x) (add x z)). + \forall hint4: (\forall x,y:A. + add x (mult x y) = mult x (add x y)). + \forall x,y,z:A. + add x y = add x (add y (mult x z)). +intros; +cut (mult (add y x) (add x (add y z)) = add x (add y (mult x z))); +[autobatch paramodulation +|autobatch paramodulation] +qed. + +theorem bool756full: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y,z:A. + add x y = add x (add y (mult x z)). +intros;autobatch paramodulation. +qed. + +theorem bool1164: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y,z:A. + (add x y) = (add (add x (mult y z)) y). +intros.autobatch paramodulation. +qed. + +theorem bool1230: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y,z:A. + \forall c1z: (\forall x:A.(add x z) = (add z x)). + add (add x y) z = add (add x y) (add z y). +intros.autobatch paramodulation. +qed. + +theorem bool1230: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y,z:A. + add (add x y) z = add (add x y) (add z y). +intros.autobatch paramodulation. +qed. + +theorem bool1372: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y,z:A. + add x (add y z) = add (add x z) y. +intros.autobatch paramodulation. +qed. + +theorem bool381: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. + add (inv x) y = add (mult x y) (inv x). +intros.autobatch paramodulation. +qed. + +theorem bool5hint1: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall hint1731:(\forall x,y:A. add (inv (add x y)) y = add y (inv x)). + \forall hint1735:(\forall x,y:A. add (inv (add x y)) x = add x (inv y)). + \forall hint623:(\forall x,y:A. inv (mult x y) = add (inv x) (inv (mult x y))). + \forall x,y:A. + (inv (mult x y)) = (add (inv x) (inv y)). +intros.autobatch paramodulation. +qed. + +theorem bool5hint2: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall hint1731:(\forall x,y:A. add (inv (add x y)) y = add y (inv x)). + \forall hint623:(\forall x,y:A. inv (mult x y) = add (inv x) (inv (mult x y))). + \forall x,y:A. + (inv (mult x y)) = (add (inv x) (inv y)). +intros.autobatch paramodulation. +qed. + +theorem bool5hint3: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall hint1731:(\forall x,y:A. add (inv (add x y)) y = add y (inv x)). + \forall hint609:(\forall x,y:A. inv x = add (inv (add y x)) (inv x)). + \forall x,y:A. + (inv (mult x y)) = (add (inv x) (inv y)). +intros.autobatch paramodulation. +qed. + +theorem bool5: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y:A. + (inv (mult x y)) = (add (inv x) (inv y)). +intros.autobatch paramodulation. +qed. + +*)*) + diff --git a/matita/tests/change.ma b/matita/tests/change.ma new file mode 100644 index 000000000..214d0fbe3 --- /dev/null +++ b/matita/tests/change.ma @@ -0,0 +1,40 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/change/". +include "../legacy/coq.ma". +alias num (instance 0) = "Coq natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "plus" (instance 0) = "Coq's natural plus". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". + +theorem stupid: + \forall a:nat. + a = 5 \to + (3 + 2) = a. +intros. +change in \vdash (? ? % ?) with 5. +rewrite < H in \vdash (? ? % ?). +reflexivity. +qed. + +(* tests changing a term under a binder *) +alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)". +theorem t: (\forall x:nat. x=x) \to True. + intro H. + change in match x in H : (\forall _.%) with (0+x). + change in H: (\forall _.(? ? ? (? % ?))) with 0. + constructor 1. +qed. + diff --git a/matita/tests/clear.ma b/matita/tests/clear.ma new file mode 100644 index 000000000..617965258 --- /dev/null +++ b/matita/tests/clear.ma @@ -0,0 +1,30 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/clear". +include "../legacy/coq.ma". +alias num (instance 0) = "natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)". + +theorem stupid: + \forall a: True. + \forall b: 0 = 0. + 0 = 0. +intros 1 (H). +clear H. +intros 1 (H). +exact H. +qed. + diff --git a/matita/tests/clearbody.ma b/matita/tests/clearbody.ma new file mode 100644 index 000000000..3c95a8a1f --- /dev/null +++ b/matita/tests/clearbody.ma @@ -0,0 +1,30 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/clearbody". +include "../legacy/coq.ma". +alias num (instance 0) = "Coq natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "plus" (instance 0) = "Coq's natural plus". + +theorem stupid : + let x \def 0 + 1 in x + 2 = x + 2. + intros. + clearbody x. + simplify. + generalize in \vdash (? ? (? % ?) (? % ?)). + intros. + reflexivity. + qed. + diff --git a/matita/tests/coercions.ma b/matita/tests/coercions.ma new file mode 100644 index 000000000..ca8c4abab --- /dev/null +++ b/matita/tests/coercions.ma @@ -0,0 +1,148 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/coercions/". + +include "nat/compare.ma". +include "nat/times.ma". + +inductive pos: Set \def +| one : pos +| next : pos \to pos. + +inductive int: Set \def +| positive: nat \to int +| negative : nat \to int. + +inductive empty : Set \def . + +let rec pos2nat x \def + match x with + [ one \Rightarrow (S O) + | (next z) \Rightarrow S (pos2nat z)]. + +definition nat2int \def \lambda x. positive x. + +coercion cic:/matita/tests/coercions/pos2nat.con. + +coercion cic:/matita/tests/coercions/nat2int.con. + +definition fst \def \lambda x,y:int.x. + +theorem a: fst O one = fst (positive O) (next one). +reflexivity. +qed. + +definition double: + \forall f:int \to int. pos \to int +\def + \lambda f:int \to int. \lambda x : pos .f (nat2int x). + +definition double1: + \forall f:int \to int. pos \to int +\def + \lambda f:int \to int. \lambda x : pos .f (pos2nat x). + +definition double2: + \forall f:int \to int. pos \to int +\def + \lambda f:int \to int. \lambda x : pos .f (nat2int (pos2nat x)). + +(* This used to test eq_f as a coercion. However, posing both eq_f and sym_eq + as coercions made the qed time of some TPTP problems reach infty. + Thus eq_f is no longer a coercion (nor is sym_eq). +theorem coercion_svelta : \forall T,S:Type.\forall f:T \to S.\forall x,y:T.x=y \to f y = f x. + intros. + apply ((\lambda h:f y = f x.h) H). +qed. +*) + +variant pos2nat' : ? \def pos2nat. + +inductive initial: Set \def iii : initial. + +definition i2pos: ? \def \lambda x:initial.one. + +coercion cic:/matita/tests/coercions/i2pos.con. + +coercion cic:/matita/tests/coercions/pos2nat'.con. + +inductive listn (A:Type) : nat \to Type \def + | Nil : listn A O + | Next : \forall n.\forall l:listn A n.\forall a:A.listn A (S n). + +definition if : \forall A:Type.\forall b:bool.\forall a,c:A.A \def + \lambda A,b,a,c. + match b with + [ true \Rightarrow a + | false \Rightarrow c]. + +let rec ith (A:Type) (n,m:nat) (dummy:A) (l:listn A n) on l \def + match l with + [ Nil \Rightarrow dummy + | (Next w l x) \Rightarrow if A (eqb w m) x (ith A w m dummy l)]. + +definition listn2function: + \forall A:Type.\forall dummy:A.\forall n.listn A n \to nat \to A +\def + \lambda A,dummy,n,l,m.ith A n m dummy l. + +definition natlist2map: ? \def listn2function nat O. + +coercion cic:/matita/tests/coercions/natlist2map.con 1. +definition map: \forall n:nat.\forall l:listn nat n. nat \to nat \def + \lambda n:nat.\lambda l:listn nat n.\lambda m:nat.l m. + +definition church: nat \to nat \to nat \def times. + +coercion cic:/matita/tests/coercions/church.con 1. +lemma foo0 : ∀n:nat. n n = n * n. +intros; reflexivity; +qed. +lemma foo01 : ∀n:nat. n n n = n * n * n. +intros; reflexivity; +qed. + +definition mapmult: \forall n:nat.\forall l:listn nat n. nat \to nat \to nat \def + \lambda n:nat.\lambda l:listn nat n.\lambda m,o:nat. + l (m m) o (o o o). + +lemma foo : ∀n:nat. n n n n n n = n * n * n * n * n * n. +intros; reflexivity; +qed. + +axiom f : nat → nat. + +lemma foo1 : ∀n:nat. f n n = f n * n. + +axiom T0 : Type. +axiom T1 : Type. +axiom T2 : Type. +axiom T3 : Type. + +axiom c1 : T0 -> T1. +axiom c2 : T1 -> T2. +axiom c3 : T2 -> T3. +axiom c4 : T2 -> T1. + +coercion cic:/matita/tests/coercions/c1.con. +coercion cic:/matita/tests/coercions/c2.con. +coercion cic:/matita/tests/coercions/c3.con. +coercion cic:/matita/tests/coercions/c4.con. + + + + + + \ No newline at end of file diff --git a/matita/tests/coercions_contravariant.ma b/matita/tests/coercions_contravariant.ma new file mode 100644 index 000000000..64f85ea75 --- /dev/null +++ b/matita/tests/coercions_contravariant.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/". + +include "logic/equality.ma". +include "nat/nat.ma". + +axiom A : nat -> Type. +axiom B : nat -> Type. +axiom A1: nat -> Type. +axiom B1: nat -> Type. +axiom c : ∀n,m. A1 n -> A m. +axiom d : ∀n,m. B n -> B1 m. +axiom f : ∀n,m. A n -> B m. +axiom g : ∀n.B n. + +coercion cic:/matita/test/c.con. +coercion cic:/matita/test/d.con. + +definition foo := λn,n1,m,m1.(λx.d m m1 (f n m (c n1 n x)) : A1 n1 -> B1 m1). +definition foo1_1 := λn,n1,m,m1.(f n m : A1 n1 -> B1 m1). + +definition h := λn,m.λx:A n.g m. +definition foo2 := λn,n1,m,m1.(h n m : A1 n1 -> B1 m1). +definition foo3 := λn1,n,m,m1.(h n m : A1 n1 -> B1 m1). +definition foo4 := λn1,n,m1,m.(h n m : A1 n1 -> B1 m1). \ No newline at end of file diff --git a/matita/tests/coercions_dependent.ma b/matita/tests/coercions_dependent.ma new file mode 100644 index 000000000..b89abbf21 --- /dev/null +++ b/matita/tests/coercions_dependent.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/". + +include "nat/nat.ma". +include "list/list.ma". +include "decidable_kit/list_aux.ma". +(* tests from "Dependent Coersion" by Luo and Soloviev *) + +inductive vec (A : Type) : nat -> Type := + | vnil : vec A O + | vcons : ∀a:A.∀n:nat.vec A n -> vec A (S n). + +axiom c : ∀A,B.∀l:list A.vec B (length A l). + +axiom veclen : ∀A,n.vec A n -> nat. + +coercion cic:/matita/test/c.con. + +alias num (instance 0) = "natural number". +definition xxx := veclen nat ? [3; 4; 7]. diff --git a/matita/tests/coercions_dupelim.ma b/matita/tests/coercions_dupelim.ma new file mode 100644 index 000000000..bfe2b3438 --- /dev/null +++ b/matita/tests/coercions_dupelim.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/". + +include "nat/nat.ma". + +axiom A : Type. + +inductive vec : nat -> Type := + | vnil : vec O + | vcons : ∀x:A.∀n:nat. vec n -> vec (S n). + +definition f := λx,n.λv:vec n.vcons x n v. +definition g := λn,x.λv:vec n.vcons x n v. + +include "logic/equality.ma". + +(* definition xx := f = g. *) +theorem xx1 : ∀n.∀x1:vec n.f ? ? x1 = g ? ? x1. diff --git a/matita/tests/coercions_nonuniform.ma b/matita/tests/coercions_nonuniform.ma new file mode 100644 index 000000000..0cf156537 --- /dev/null +++ b/matita/tests/coercions_nonuniform.ma @@ -0,0 +1,46 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/coercions_nonuniform/". + +axiom A : Type. +axiom B : A -> Type. +axiom f : A -> A. +axiom f1 : A -> A. + +axiom k : ∀a:A.B (f a). + +coercion cic:/matita/test/coercions_nonuniform/k.con. + +axiom C : Type. + +(* axiom c1 : ∀a:A. B (f a) -> C. *) (* COQ NO: non uniform *) +(* axiom c1 : ∀a:A. B (f1 a) -> C. *) (* non si compongono, ma almeno ho le 2 non composte le ho e le posso usare *) +(* axiom c1 : ∀f.∀a:A.B (f a) -> C. *) (* COQ NO: non uniform *) + +(* COQ NO: non uniform *) +axiom c2 : ∀a.B (f a) -> B (f1 a). +axiom c1 : ∀a:A. B (f1 a) -> C. + +coercion cic:/matita/test/coercions_nonuniform/c1.con. +coercion cic:/matita/test/coercions_nonuniform/c2.con. + +axiom g : C -> C. + +definition test := λa:A.g a. + +(* +Coq < Coercion c1 : B >-> C. +User error: c1 does not respect the inheritance uniform condition +*) \ No newline at end of file diff --git a/matita/tests/coercions_open.ma b/matita/tests/coercions_open.ma new file mode 100644 index 000000000..d0d8caedb --- /dev/null +++ b/matita/tests/coercions_open.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/". + +include "logic/equality.ma". +include "nat/nat.ma". + +axiom A : nat -> Type. +axiom B : nat -> Type. +axiom AB : \forall x. A x = B x. + +axiom eatA : ∀n. A n -> A O. +axiom eatB : ∀n. B n -> A O. + +axiom jmcBA : ∀n,m.∀p:A n = B m.B m -> A n. +axiom jmcAB : ∀n,m.∀p:A n = B m.A n -> B m. + +coercion cic:/matita/test/jmcAB.con. +coercion cic:/matita/test/jmcBA.con. + +axiom daemon : ∀x,y:A O.x = y. + +alias num (instance 0) = "natural number". +lemma xx : ∀b:B 2.∀a:A 1.eatA ? b = eatB ? a. +intros; [3,5,7,9: apply AB|1: apply daemon];skip. +qed. \ No newline at end of file diff --git a/matita/tests/coercions_propagation.ma b/matita/tests/coercions_propagation.ma new file mode 100644 index 000000000..63c48e66b --- /dev/null +++ b/matita/tests/coercions_propagation.ma @@ -0,0 +1,138 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/coercions_propagation/". + +include "logic/connectives.ma". +include "nat/orders.ma". + +inductive sigma (A:Type) (P:A → Prop) : Type ≝ + sigma_intro: ∀a:A. P a → sigma A P. + +interpretation "sigma" 'exists \eta.x = + (cic:/matita/test/coercions_propagation/sigma.ind#xpointer(1/1) _ x). + +definition inject ≝ λP.λa:nat.λp:P a. sigma_intro ? P ? p. + +coercion cic:/matita/test/coercions_propagation/inject.con 0 1. + +definition eject ≝ λP.λc: ∃n:nat.P n. match c with [ sigma_intro w _ ⇒ w]. + +coercion cic:/matita/test/coercions_propagation/eject.con. + +alias num (instance 0) = "natural number". +theorem test: ∃n. 0 ≤ n. + apply (S O : ∃n. 0 ≤ n). + autobatch. +qed. + +theorem test2: nat → ∃n. 0 ≤ n. + apply ((λn:nat. 0) : nat → ∃n. 0 ≤ n); + autobatch. +qed. + +theorem test3: (∃n. 0 ≤ n) → nat. + apply ((λn:nat.n) : (∃n. 0 ≤ n) → nat). +qed. + +theorem test4: (∃n. 1 ≤ n) → ∃n. 0 < n. + apply ((λn:nat.n) : (∃n. 1 ≤ n) → ∃n. 0 < n); + cases s; + assumption. +qed. + +theorem test5: nat → ∃n. 1 ≤ n. +apply ( + let rec aux n : nat ≝ + match n with + [ O ⇒ 1 + | S m ⇒ S (aux m) + ] + in + aux +: nat → ∃n. 1 ≤ n); +[ cases (aux n1); simplify; ] autobatch; +qed. + +inductive NN (A:Type) : nat -> Type ≝ + | NO : NN A O + | NS : ∀n:nat. NN A n → NN A (S n). + +definition injectN ≝ λA,k.λP.λa:NN A k.λp:P a. sigma_intro ? P ? p. + +coercion cic:/matita/test/coercions_propagation/injectN.con 0 1. + +definition ejectN ≝ λA,k.λP.λc: ∃n:NN A k.P n. match c with [ sigma_intro w _ ⇒ w]. + +coercion cic:/matita/test/coercions_propagation/ejectN.con. + +definition PN := + λA,k.λx:NN A k. 1 <= k. + +theorem test51_byhand: ∀A,k. NN A k → ∃n:NN A (S k). PN ? ? n. +intros 1; +apply ( + let rec aux (w : nat) (n : NN A w) on n : ∃p:NN A (S w).PN ? ? p ≝ + match n in NN return λx.λm:NN A x.∃p:NN A (S x).PN ? ? p with + [ NO ⇒ injectN ? ? ? (NS A ? (NO A)) ? + | NS x m ⇒ injectN ? ? ? (NS A (S x) (ejectN ? ? ? (aux ? m))) ? + ] + in + aux +: ∀n:nat. NN A n → ∃m:NN A (S n). PN ? ? m); +[2: cases (aux x m); simplify; autobatch ] unfold PN; autobatch; +qed. + +theorem f : nat -> nat -> ∃n:nat.O <= n. +apply (λx,y:nat.y : nat -> nat -> ∃n:nat. O <= n). +apply le_O_n; +qed. + +axiom F : nat -> nat -> nat. + +theorem f1 : nat -> nat -> ∃n:nat.O <= n. +apply (F : nat -> nat -> ∃n:nat. O <= n). +apply le_O_n; +qed. + +theorem test51: ∀A,k. NN A k → ∃n:NN A (S k). PN ? ? n. +intros 1; +letin xxx ≝ ( + let rec aux (w : nat) (n : NN A w) on n : NN A (S w) ≝ + match n in NN return λx.λm:NN A x.NN A (S x) with + [ NO ⇒ NS A ? (NO A) + | NS x m ⇒ NS A (S x) (aux ? m) + ] + in + aux +: ∀n:nat. NN A n → ∃m:NN A (S n). PN ? ? m); [3: apply xxx]; +unfold PN in aux ⊢ %; [cases (aux n2 n3)] autobatch; +qed. + +(* guarded troppo debole *) +theorem test522: nat → ∃n. 1 ≤ n. +apply ( + let rec aux n : nat ≝ + match n with + [ O ⇒ 1 + | S m ⇒ S (aux m) + ] + in + aux +: nat → ∃n. 1 ≤ n); +[ cases (aux n1); simplify; + autobatch +| autobatch]. +qed. + diff --git a/matita/tests/coercions_russell.ma b/matita/tests/coercions_russell.ma new file mode 100644 index 000000000..36217ad9d --- /dev/null +++ b/matita/tests/coercions_russell.ma @@ -0,0 +1,144 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/russell/". + +include "nat/orders.ma". +include "list/list.ma". +include "datatypes/constructors.ma". + +inductive sigma (A:Type) (P:A → Prop) : Type ≝ + sig_intro: ∀a:A. P a → sigma A P. + +interpretation "sigma" 'exists \eta.x = + (cic:/matita/test/russell/sigma.ind#xpointer(1/1) _ x). + +definition inject ≝ λP.λa:list nat.λp:P a. sig_intro ? P ? p. + +coercion cic:/matita/test/russell/inject.con 0 1. + +definition eject ≝ λP.λc: ∃n:list nat.P n. match c with [ sig_intro w _ ⇒ w]. + +coercion cic:/matita/test/russell/eject.con. + +alias symbol "exists" (instance 2) = "exists". +lemma tl : ∀l:list nat. l ≠ [] → ∃l1.∃a.a :: l1 = l. +letin program ≝ + (λl:list nat. λH:l ≠ [].match l with [ nil ⇒ λH.[] | cons x l1 ⇒ λH.l1] H); +letin program_spec ≝ (program : ∀l:list nat. l ≠ [] → ∃l1.∃a.a :: l1 = l); + [ generalize in match H; cases l; [intros (h1); cases (h1 ?); reflexivity] + intros; apply (ex_intro ? ? n); apply eq_f; reflexivity; ] +exact program_spec; +qed. + +alias symbol "exists" (instance 3) = "exists". +lemma tl2 : ∀l:∃l:list nat. l ≠ []. ∃l1.∃a.a :: l1 = l. +letin program ≝ + (λl:list nat. match l with [ nil ⇒ [] | cons x l1 ⇒ l1]); +letin program_spec ≝ + (program : ∀l:∃l:list nat. l ≠ []. ∃l1.∃a.a :: l1 = l); + [ autobatch; | generalize in match H; clear H; cases s; simplify; + intros; cases (H H1); ] +exact program_spec. +qed. + +definition nat_return := λn:nat. Some ? n. + +coercion cic:/matita/test/russell/nat_return.con. + +definition raise_exn := None nat. + +definition try_with := + λx,e. match x with [ None => e | Some (x : nat) => x]. + +lemma hd : list nat → option nat := + λl.match l with [ nil ⇒ raise_exn | cons x _ ⇒ nat_return x ]. + +axiom f : nat -> nat. + +definition bind ≝ λf:nat->nat.λx. + match x with [None ⇒ raise_exn| Some x ⇒ nat_return(f x)]. + +include "datatypes/bool.ma". +include "list/sort.ma". +include "nat/compare.ma". + +definition inject_opt ≝ λP.λa:option nat.λp:P a. sig_intro ? P ? p. + +coercion cic:/matita/test/russell/inject_opt.con 0 1. + +definition eject_opt ≝ λP.λc: ∃n:option nat.P n. match c with [ sig_intro w _ ⇒ w]. + +coercion cic:/matita/test/russell/eject_opt.con. + +(* we may define mem as in the following lemma and get rid of it *) +definition find_spec ≝ + λl,p.λres:option nat. + match res with + [ None ⇒ ∀y. mem ? eqb y l = true → p y = false + | Some x ⇒ mem ? eqb x l = true ∧ + p x = true ∧ + ∀y.mem ? eqb y l = true → p y = true → x ≠ y → + ∃l1,l2,l3.l = l1 @ [x] @ l2 @ [y] @ l3]. + +lemma mem_x_to_ex_l1_l2 : ∀l,x.mem ? eqb x l = true → ∃l1,l2.l = l1 @ [x] @ l2. +intros 2; elim l (H hd tl IH H); [simplify in H; destruct H] +generalize in match H; clear H; +simplify; apply (eqb_elim x hd); simplify; intros; +[1:clear IH; rewrite < H; apply (ex_intro ? ? []); +|2:lapply(IH H1); clear H1 IH; decompose; rewrite > H2; clear H2] +simplify; autobatch; +qed. + +definition if : ∀A:Type.bool → A → A → A ≝ + λA,b,t,f. match b with [ true ⇒ t | false ⇒ f]. + +notation < "'If' \nbsp b \nbsp 'Then' \nbsp t \nbsp 'Else' \nbsp f" for @{ 'if $b $t $f }. +notation > "'If' b 'Then' t 'Else' f" for @{ 'if $b $t $f }. +interpretation "if" 'if a b c = (cic:/matita/test/russell/if.con _ a b c). + +definition sigma_find_spec : ∀p,l. sigma ? (λres.find_spec l p res). +(* define the find function *) +letin find ≝ (λp. + let rec aux l ≝ + match l with + [ nil ⇒ raise_exn + | cons x l ⇒ If p x Then nat_return x Else aux l] + in aux); +(* manca una delta?! *) unfold if in find; +apply (find: ∀p.∀l.sigma ? (λres.find_spec l p res)); clear find; +(* l = x::tl ∧ p x = false *) +[1: cases (aux l1); clear aux; + generalize in match H2; clear H2; cases a; clear a; simplify; + [1: intros 2; apply (eqb_elim y n); intros (Eyn); [rewrite > Eyn; assumption] + apply H3; simplify in H2; assumption; + |2: intros; decompose; repeat split; [2: assumption]; intros; + [1: cases (eqb n1 n); simplify; autobatch; + |2: generalize in match (refl_eq ? (eqb y n)); generalize in ⊢ (? ? ? %→?); + intro; cases b; clear b; intro Eyn; rewrite > Eyn in H3; simplify in H3; + [1: rewrite > (eqb_true_to_eq ? ? Eyn) in H6; rewrite > H1 in H6; destruct H6; + |2: lapply H4; try assumption; decompose; clear H4; rewrite > H8; + simplify; autobatch depth = 4;]]] +(* l = x::tl ∧ p x = true *) +|2: unfold find_spec; unfold nat_return; simplify; repeat split; [2: assumption] + [1: rewrite > eqb_n_n; reflexivity + |2: intro; generalize in match (refl_eq ? (eqb y n)); generalize in ⊢ (? ? ? %→?); + intro; cases b; clear b; intro Eyn; rewrite > Eyn; + [1: rewrite > (eqb_true_to_eq ? ? Eyn);] clear Eyn; simplify; intros; + [1: cases H4; reflexivity + |2: lapply (mem_x_to_ex_l1_l2 ? ? H2); decompose; rewrite > H6; + apply (ex_intro ? ? []); simplify; autobatch;]] +(* l = [] *) +|3: unfold raise_exn; simplify; intros; destruct H1;] +qed. diff --git a/matita/tests/comments.ma b/matita/tests/comments.ma new file mode 100644 index 000000000..cb54a90d3 --- /dev/null +++ b/matita/tests/comments.ma @@ -0,0 +1,36 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/comments/". +include "../legacy/coq.ma". + +(* commento che va nell'ast, ma non viene contato + come step perche' non e' un executable +*) + +alias num (instance 0) = "natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +theorem a:0=0. + +(* nota *) +(** + + +apply Prop. +*) +reflexivity. +(* commenti che non devono essere colorati perche' + non c'e' nulla di eseguibile dopo di loro +*) +qed. diff --git a/matita/tests/compose.ma b/matita/tests/compose.ma new file mode 100644 index 000000000..5d6035777 --- /dev/null +++ b/matita/tests/compose.ma @@ -0,0 +1,53 @@ +set "baseuri" "cic:/matita/tests/compose/LCL002-1". +include "logic/equality.ma". + +theorem an_1: +∀ Univ:Set. +∀ a:Univ. +∀ is_a_theorem:Univ → Prop. +∀ not:Univ → Univ. +∀ or:Univ → Univ → Univ. +∀ H0:∀ U:Univ.∀ V:Univ.∀ X:Univ.∀ Y:Univ.∀ Z:Univ. + is_a_theorem + (or (not (or (not (or (not X) Y)) (or Z (or U V)))) + (or (not (or (not U) X)) (or Z (or V X)))). +∀ H1:∀ X:Univ.∀ Y:Univ. + is_a_theorem (or (not X) Y) → is_a_theorem X → is_a_theorem Y. +∀ ABS:∀ X.is_a_theorem X. +True. +. +intros 5. +intros (H H1 ABS). + +(* H1 o H *) +compose (H) with (H1) (primo secondo). +letin verifica_primo ≝ (primo ? ? ? ? ? ? = H1 ? ? ? (H ? ? ? ? ?)); +try assumption; [1,2: apply ABS] +letin verifica_secondo ≝ (secondo ? ? ? ? ? ? ? = H1 ? ? (H ? ? ? ? ?) ?); +try assumption; [1,2: apply ABS] +clear verifica_primo verifica_secondo. +compose (H) with (primo) (terzo). +compose (H) with (secondo) (quarto). +letin verifica_terzo_quarto ≝ (terzo ? ? ? ? ? = quarto ? ? ? ? ?); +try assumption. +clear verifica_terzo_quarto. +clear primo secondo terzo quarto. + +(* H1 o H1 *) +compose (H1) with (H1) (primo secondo). +letin verifica_primo ≝ (primo ? ? ? ? ? ? = H1 ? ? ? (H1 ? ? ? ?)); +try assumption; [1,2,3,4,5,6: apply ABS] +letin verifica_secondo ≝ (secondo ? ? ? ? ? ? = H1 ? ? (H1 ? ? ? ?) ?); +try assumption; [1,2,3,4,5,6: apply ABS] +clear verifica_primo verifica_secondo. +clear primo secondo. + +(* close H1 o H1 with H *) +compose H1 with H1 0. +(* +leaving the result under the sequent line and calling compose without +the with parameter, will compose H with all the stuff under the sequent line +*) +compose 3 (H) (i1 i2 p1 p2 p3 p4 p5 p6 q1 q2 q3 q4 q5 q6 q7 q8 q9 q10 q11 q12 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12). +exact I. +qed. diff --git a/matita/tests/constructor.ma b/matita/tests/constructor.ma new file mode 100644 index 000000000..f33044f12 --- /dev/null +++ b/matita/tests/constructor.ma @@ -0,0 +1,23 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/constructor". +include "../legacy/coq.ma". +alias num (instance 0) = "natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". + + +theorem stupid: 1 = 1. +constructor 1. +qed. diff --git a/matita/tests/continuationals.ma b/matita/tests/continuationals.ma new file mode 100644 index 000000000..a9d85ce25 --- /dev/null +++ b/matita/tests/continuationals.ma @@ -0,0 +1,80 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/continuationals". +include "../legacy/coq.ma". + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". +alias id "trans_equal" = "cic:/Coq/Init/Logic/trans_equal.con". +alias id "refl_equal" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)". +alias id "Z" = "cic:/Coq/ZArith/BinInt/Z.ind#xpointer(1/1)". + +theorem semicolon: \forall p:Prop.p\to p\land p. +intros (p); split; assumption. +qed. + +theorem branch:\forall x:nat.x=x. +intros (n); +elim n +[ reflexivity; +| reflexivity ]. +qed. + +theorem pos:\forall x:Z.x=x. +intros (n); +elim n; +[ 3: reflexivity; +| 2: reflexivity; +| reflexivity ] +qed. + +theorem dot:\forall x:Z.x=x. +intros (x). +elim x. +reflexivity. reflexivity. reflexivity. +qed. + +theorem dot_slice:\forall x:Z.x=x. +intros (x). +elim x; +[ elim x. reflexivity. reflexivity. reflexivity; +| reflexivity +| reflexivity ]; +qed. + +theorem focus:\forall x:Z.x=x. +intros (x); elim x. +focus 16 17; + reflexivity; +unfocus. +reflexivity. +qed. + +theorem skip:\forall x:nat.x=x. +intros (x). +apply trans_equal; +[ 2: apply (refl_equal nat x); +| skip +| reflexivity +] +qed. + +theorem skip_focus:\forall x:nat.x=x. +intros (x). +apply trans_equal; +[ focus 18; apply (refl_equal nat x); unfocus; +| skip +| reflexivity ] +qed. diff --git a/matita/tests/contradiction.ma b/matita/tests/contradiction.ma new file mode 100644 index 000000000..ed1ef6b3c --- /dev/null +++ b/matita/tests/contradiction.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/contradiction". +include "../legacy/coq.ma". +alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)". +alias id "not" = "cic:/Coq/Init/Logic/not.con". +alias num (instance 0) = "natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". + + + +theorem stupid: \forall a:Prop. a \to not a \to 0 = 2. +intros. +letin H \def (H1 H). +contradiction. +qed. + + + diff --git a/matita/tests/cut.ma b/matita/tests/cut.ma new file mode 100644 index 000000000..24d17f13d --- /dev/null +++ b/matita/tests/cut.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/cut". +include "../legacy/coq.ma". +alias num (instance 0) = "natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". + +theorem stupid: 3 = 3. + cut (3 = 3). + assumption. + reflexivity. +qed. + diff --git a/matita/tests/decl.ma b/matita/tests/decl.ma new file mode 100644 index 000000000..40f8d3700 --- /dev/null +++ b/matita/tests/decl.ma @@ -0,0 +1,202 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/decl". + +include "nat/times.ma". +include "nat/orders.ma". + +theorem easy: ∀n,m. n * m = O → n = O ∨ m = O. + assume n: nat. + assume m: nat. + (* base case *) + by (refl_eq ? O) we proved (O = O) (trivial). + by (or_introl ? ? trivial) we proved (O = O ∨ m = O) (trivial2). + by (λ_.trivial2) we proved (O*m=O → O=O ∨ m=O) (base_case). + (* inductive case *) + we need to prove + (∀n1. (n1 * m = O → n1 = O ∨ m = O) → (S n1) * m = O → (S n1) = O ∨ m = O) + (inductive_case). + assume n1: nat. + suppose (n1 * m = O → n1 = O ∨ m = O) (inductive_hyp). + (* base case *) + by (or_intror ? ? trivial) we proved (S n1 = O ∨ O = O) (pre_base_case2). + by (λ_.pre_base_case2) we proved (S n1*O = O → S n1 = O ∨ O = O) (base_case2). + (* inductive case *) + we need to prove + (∀m1. (S n1 * m1 = O → S n1 = O ∨ m1 = O) → + (S n1 * S m1 = O → S n1 = O ∨ S m1 = O)) (inductive_hyp2). + assume m1: nat. + suppose (S n1 * m1 = O → S n1 = O ∨ m1 = O) (useless). + suppose (S n1 * S m1 = O) (absurd_hyp). + simplify in absurd_hyp. + by (sym_eq ? ? ? absurd_hyp) we proved (O = S (m1+n1*S m1)) (absurd_hyp'). + by (not_eq_O_S ? absurd_hyp') we proved False (the_absurd). + by (False_ind ? the_absurd) + done. + (* the induction *) + by (nat_ind (λm.S n1 * m = O → S n1 = O ∨ m = O) base_case2 inductive_hyp2 m) + done. + (* the induction *) + by (nat_ind (λn.n*m=O → n=O ∨ m=O) base_case inductive_case n) +done. +qed. + +theorem easy2: ∀n,m. n * m = O → n = O ∨ m = O. + intros 2. + elim n 0 + [ intro; + left; + reflexivity + | intro; + elim m 0 + [ intros; + right; + reflexivity + | intros; + simplify in H2; + lapply (sym_eq ? ? ? H2); + elim (not_eq_O_S ? Hletin) + ] + ] +qed. + +theorem easy15: ∀n,m. n * m = O → n = O ∨ m = O. + assume n: nat. + assume m: nat. + (* base case *) + by _ we proved (O = O) (trivial). + by _ we proved (O = O ∨ m = O) (trivial2). + by _ we proved (O*m=O → O=O ∨ m=O) (base_case). + (* inductive case *) + we need to prove + (∀n1. (n1 * m = O → n1 = O ∨ m = O) → (S n1) * m = O → (S n1) = O ∨ m = O) + (inductive_case). + assume n1: nat. + suppose (n1 * m = O → n1 = O ∨ m = O) (inductive_hyp). + (* base case *) + by _ we proved (S n1 = O ∨ O = O) (pre_base_case2). + by _ we proved (S n1*O = O → S n1 = O ∨ O = O) (base_case2). + (* inductive case *) + we need to prove + (∀m1. (S n1 * m1 = O → S n1 = O ∨ m1 = O) → + (S n1 * S m1 = O → S n1 = O ∨ S m1 = O)) (inductive_hyp2). + assume m1: nat. + suppose (S n1 * m1 = O → S n1 = O ∨ m1 = O) (useless). + suppose (S n1 * S m1 = O) (absurd_hyp). + simplify in absurd_hyp. + by _ we proved (O = S (m1+n1*S m1)) (absurd_hyp'). + (* BUG: automation failure *) + by (not_eq_O_S ? absurd_hyp') we proved False (the_absurd). + (* BUG: automation failure *) + by (False_ind ? the_absurd) + done. + (* the induction *) + by (nat_ind (λm.S n1 * m = O → S n1 = O ∨ m = O) base_case2 inductive_hyp2 m) + done. + (* the induction *) + by (nat_ind (λn.n*m=O → n=O ∨ m=O) base_case inductive_case n) +done. +qed. + +theorem easy3: ∀A:Prop. (A ∧ ∃n:nat.n ≠ n) → True. + assume P: Prop. + suppose (P ∧ ∃m:nat.m ≠ m) (H). + by H we have P (H1) and (∃x:nat.x≠x) (H2). + by H2 let q:nat such that (q ≠ q) (Ineq). + by I done. +qed. + +theorem easy4: ∀n,m,p. n = m → S m = S p → n = S p → S n = n. +assume n: nat. +assume m:nat. +assume p:nat. +suppose (n=m) (H). +suppose (S m = S p) (K). +suppose (n = S p) (L). +conclude (S n) = (S m) by (eq_f ? ? ? ? ? H). + = (S p) by K. + = n by (sym_eq ? ? ? L) +done. +qed. + +theorem easy45: ∀n,m,p. n = m → S m = S p → n = S p → S n = n. +assume n: nat. +assume m:nat. +assume p:nat. +suppose (n=m) (H). +suppose (S m = S p) (K). +suppose (n = S p) (L). +conclude (S n) = (S m) by _. + = (S p) by _. + = n by _ +done. +qed. + +theorem easy5: ∀n:nat. n*O=O. +assume n: nat. +(* Bug here: False should be n*0=0 *) +we proceed by induction on n to prove False. + case O. + the thesis becomes (O*O=O). + by (refl_eq ? O) done. + case S (m:nat). + by induction hypothesis we know (m*O=O) (I). + the thesis becomes (S m * O = O). + (* Bug here: missing that is equivalent to *) + simplify. + by I done. +qed. + +inductive tree : Type ≝ + Empty: tree + | Node: tree → tree → tree. + +let rec size t ≝ + match t with + [ Empty ⇒ O + | (Node t1 t2) ⇒ S ((size t1) + (size t2)) + ]. + +theorem easy6: ∀t. O ≮ O → O < size t → t ≠ Empty. + assume t: tree. + suppose (O ≮ O) (trivial). + (*Bug here: False should be something else *) + we proceed by induction on t to prove False. + case Empty. + the thesis becomes (O < size Empty → Empty ≠ Empty). + suppose (O < size Empty) (absurd) + that is equivalent to (O < O). + (* Here the "natural" language is not natural at all *) + we proceed by induction on (trivial absurd) to prove False. + (*Bug here: this is what we want + case Node (t1:tree) (t2:tree). + by induction hypothesis we know (O < size t1 → t1 ≠ Empty) (Ht1). + by induction hypothesis we know (O < size t2 → t2 ≠ Empty) (Ht2). *) + (*This is the best we can do right now*) + case Node. + assume t1: tree. + by induction hypothesis we know (O < size t1 → t1 ≠ Empty) (Ht1). + assume t2: tree. + by induction hypothesis we know (O < size t2 → t2 ≠ Empty) (Ht2). + suppose (O < size (Node t1 t2)) (useless). + we need to prove (Node t1 t2 ≠ Empty) (final) + or equivalently (Node t1 t2 = Empty → False). + suppose (Node t1 t2 = Empty) (absurd). + (* Discriminate should really generate a theorem to be useful with + declarative tactics *) + destruct absurd. + by final + done. +qed. diff --git a/matita/tests/decompose.ma b/matita/tests/decompose.ma new file mode 100644 index 000000000..2ba58c158 --- /dev/null +++ b/matita/tests/decompose.ma @@ -0,0 +1,29 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/decompose". + +include "logic/connectives.ma". + +theorem stupid: + \forall a,b,c:Prop. + (a \land c \lor b \land c) \to (c \land (b \lor a)). + intros.decompose.split.assumption.right.assumption. + split.assumption.left.assumption.qed. + +definition MyFalse \def False. + +theorem ex_falso_quodlibet: \forall (P:Prop). MyFalse \to P. + intros. decompose. +qed. diff --git a/matita/tests/demodulation_coq.ma b/matita/tests/demodulation_coq.ma new file mode 100644 index 000000000..cb7a830eb --- /dev/null +++ b/matita/tests/demodulation_coq.ma @@ -0,0 +1,53 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/demodulation/". + +include "../legacy/coq.ma". + +alias num = "Coq natural number". +alias symbol "times" = "Coq's natural times". +alias symbol "plus" = "Coq's natural plus". +alias symbol "eq" = "Coq's leibnitz's equality". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". + +theorem p0 : \forall m:nat. m+O = m. +intro. demodulate.reflexivity. +qed. + +theorem p: \forall m.1*m = m. +intros.demodulate.reflexivity. +qed. + +theorem p2: \forall x,y:nat.(S x)*y = (y+x*y). +intros.demodulate.reflexivity. +qed. + +theorem p1: \forall x,y:nat.(S ((S x)*y+x))=(S x)+(y*x+y). +intros.demodulate.reflexivity. +qed. + +theorem p3: \forall x,y:nat. (x+y)*(x+y) = x*x + 2*(x*y) + (y*y). +intros.demodulate.reflexivity. +qed. + +theorem p4: \forall x:nat. (x+1)*(x-1)=x*x - 1. +intro. +apply (nat_case x) +[simplify.reflexivity +|intro.demodulate.reflexivity] +qed. + diff --git a/matita/tests/demodulation_matita.ma b/matita/tests/demodulation_matita.ma new file mode 100644 index 000000000..0f4827e46 --- /dev/null +++ b/matita/tests/demodulation_matita.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/demodulation_matita/". + +include "nat/minus.ma". + +theorem p2: \forall x,y:nat. x+x = (S(S O))*x. +intros.demodulate.reflexivity. +qed. + +theorem p4: \forall x:nat. (x+(S O))*(x-(S O))=x*x - (S O). +intro. +apply (nat_case x) +[simplify.reflexivity +|intro.demodulate.reflexivity] +qed. + +theorem p5: \forall x,y:nat. (x+y)*(x+y) = x*x + (S(S O))*(x*y) + (y*y). +intros.demodulate.reflexivity. +qed. + diff --git a/matita/tests/dependent_injection.ma b/matita/tests/dependent_injection.ma new file mode 100644 index 000000000..e217a7652 --- /dev/null +++ b/matita/tests/dependent_injection.ma @@ -0,0 +1,48 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/dependent_injection". + +include "../legacy/coq.ma". + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "bool" = "cic:/Coq/Init/Datatypes/bool.ind#xpointer(1/1)". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". + +inductive ttree : Type → Type := + tempty: ttree nat + | tnode : ∀A. ttree A → ttree A → ttree A. + +(* CSC: there is an undecidable unification problem here: + consider a constructor k : \forall x. f x -> i (g x) + The head of the outtype of the injection MutCase should be (f ?1) + such that (f ?1) unifies with (g d) [ where d is the Rel that binds + the corresponding right parameter in the outtype ] + Coq dodges the problem by generating an equality between sigma-types + (that state the existence of a ?1 such that ...) *) +theorem injection_test3: + ∀t,t'. tnode nat t tempty = tnode nat t' tempty → t = t'. + intros. + destruct H. + reflexivity. +qed. + +theorem injection_test3: + ∀t,t'. + tnode nat (tnode nat t t') tempty = tnode nat (tnode nat t' tempty) tempty → + t = t'. + intros; + destruct H; + assumption. +qed. diff --git a/matita/tests/dependent_type_inference.ma b/matita/tests/dependent_type_inference.ma new file mode 100644 index 000000000..11a42acac --- /dev/null +++ b/matita/tests/dependent_type_inference.ma @@ -0,0 +1,19 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/dependent_type_inference/". + +include "nat/nat.ma". + +definition foo ≝ λP.λy:nat.λa:y=y.λb. P y a ∧ P (S y) b. \ No newline at end of file diff --git a/matita/tests/destruct.ma b/matita/tests/destruct.ma new file mode 100644 index 000000000..55275c480 --- /dev/null +++ b/matita/tests/destruct.ma @@ -0,0 +1,95 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/discriminate". + +include "logic/equality.ma". +include "nat/nat.ma". +include "datatypes/constructors.ma". + +theorem stupid: + (S O) = O \to (\forall p:Prop. p \to Not p). + intros. + generalize in match I. + destruct H. +qed. + +inductive bar_list (A:Set): Set \def + | bar_nil: bar_list A + | bar_cons: A \to bar_list A \to bar_list A. + +theorem stupid2: + \forall A:Set.\forall x:A.\forall l:bar_list A. + bar_nil A = bar_cons A x l \to False. + intros. + destruct H. +qed. + +inductive dt (A:Type): Type \to Type \def + | k1: \forall T:Type. dt A T + | k2: \forall T:Type. \forall T':Type. dt A (T \to T'). + +theorem stupid3: + k1 False (False → True) = k2 False False True → False. + intros; + destruct H. +qed. + +inductive dddt (A:Type): Type \to Type \def + | kkk1: dddt A nat + | kkk2: dddt A nat. + +theorem stupid4: kkk1 False = kkk2 False \to False. + intros; + destruct H. +qed. + +theorem recursive: S (S (S O)) = S (S O) \to False. + intros; + destruct H. +qed. + +inductive complex (A,B : Type) : B → A → Type ≝ +| C1 : ∀x:nat.∀a:A.∀b:B. complex A B b a +| C2 : ∀a,a1:A.∀b,b1:B.∀x:nat. complex A B b1 a1 → complex A B b a. + +theorem recursive1: ∀ x,y : nat. + (C1 ? ? O (Some ? x) y) = + (C1 ? ? (S O) (Some ? x) y) → False. +intros; destruct H. +qed. + +theorem recursive2: ∀ x,y,z,t : nat. + (C1 ? ? t (Some ? x) y) = + (C1 ? ? z (Some ? x) y) → t=z. +intros; destruct H; reflexivity. +qed. + +theorem recursive3: ∀ x,y,z,t : nat. + C2 ? ? (None ?) ? (S O) ? z (C1 ? ? (S O) (Some ? x) y) = + C2 ? ? (None ?) ? (S O) ? t (C1 ? ? (S O) (Some ? x) y) → z=t. +intros; destruct H; reflexivity. +qed. + +theorem recursive4: ∀ x,y,z,t : nat. + C2 ? ? (None ?) ? (S O) ? z (C1 ? ? (S O) (Some ? z) y) = + C2 ? ? (None ?) ? (S O) ? t (C1 ? ? (S O) (Some ? x) y) → z=t. +intros; destruct H; reflexivity. +qed. + +theorem recursive2: ∀ x,y : nat. + C2 ? ? (None ?) ? (S O) ? O (C1 ? ? O (Some ? x) y) = + C2 ? ? (None ?) ? (S O) ? O (C1 ? ? (S O) (Some ? x) y) → False. +intros; destruct H. +qed. \ No newline at end of file diff --git a/matita/tests/elim.ma b/matita/tests/elim.ma new file mode 100644 index 000000000..e038c5da2 --- /dev/null +++ b/matita/tests/elim.ma @@ -0,0 +1,79 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/elim". +include "../legacy/coq.ma". + +inductive stupidtype: Set \def + | Base : stupidtype + | Next : stupidtype \to stupidtype + | Pair : stupidtype \to stupidtype \to stupidtype. + +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "exists" (instance 0) = "Coq's exists". +alias symbol "or" (instance 0) = "Coq's logical or". +alias num (instance 0) = "natural number". +alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)". +alias id "refl_equal" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)". + +theorem serious: + \forall a:stupidtype. + a = Base + \lor + (\exists b:stupidtype.a = Next b) + \lor + (\exists c,d:stupidtype.a = Pair c d). +intros. +elim a. +clear a.left.left. + reflexivity. +clear H.clear a.left.right. + exists.exact s.reflexivity. +clear H.clear H1.clear a.right. + exists.exact s.exists.exact s1.reflexivity. +qed. + +theorem t: 0=0 \to stupidtype. + intros; constructor 1. +qed. + +(* In this test "elim t" should open a new goal 0=0 and put it in the *) +(* goallist so that the THEN tactical closes it using reflexivity. *) +theorem foo: let ax \def refl_equal ? 0 in t ax = t ax. + elim t; reflexivity. +qed. + +(* This test shows a bug where elim opens a new unus{ed,eful} goal *) + +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". + +inductive sum (n:nat) : nat \to nat \to Set \def + k: \forall x,y. n = x + y \to sum n x y. + +theorem t': \forall x,y. \forall H: sum x y O. + match H with [ (k a b p) \Rightarrow a ] = x. + intros. + cut (y = y \to O = O \to match H with [ (k a b p) \Rightarrow a] = x). + apply Hcut; reflexivity. + apply + (sum_ind ? + (\lambda a,b,K. y=a \to O=b \to + match K with [ (k a b p) \Rightarrow a ] = x) + ? ? ? H). + simplify. intros. + generalize in match H1. + rewrite < H2; rewrite < H3.intro. + rewrite > H4.autobatch library. +qed. diff --git a/matita/tests/fguidi.ma b/matita/tests/fguidi.ma new file mode 100644 index 000000000..a95e954c1 --- /dev/null +++ b/matita/tests/fguidi.ma @@ -0,0 +1,117 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/fguidi/". +include "../legacy/coq.ma". + +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". +alias id "le" = "cic:/matita/fguidi/le.ind#xpointer(1/1)". +alias id "False_ind" = "cic:/Coq/Init/Logic/False_ind.con". +alias id "I" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1/1)". +alias id "ex_intro" = "cic:/Coq/Init/Logic/ex.ind#xpointer(1/1/1)". +alias id "False" = "cic:/Coq/Init/Logic/False.ind#xpointer(1/1)". +alias id "True" = "cic:/Coq/Init/Logic/True.ind#xpointer(1/1)". + +alias symbol "and" (instance 0) = "Coq's logical and". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "exists" (instance 0) = "Coq's exists". + +definition is_S: nat \to Prop \def + \lambda n. match n with + [ O \Rightarrow False + | (S n) \Rightarrow True + ]. + +definition pred: nat \to nat \def + \lambda n. match n with + [ O \Rightarrow O + | (S n) \Rightarrow n + ]. + +theorem eq_gen_S_O: \forall x. (S x = O) \to \forall P:Prop. P. +intros. apply False_ind. cut (is_S O). elim Hcut. rewrite < H. apply I. +qed. + +theorem eq_gen_S_O_cc: (\forall P:Prop. P) \to \forall x. (S x = O). +intros. apply H. +qed. + +theorem eq_gen_S_S: \forall m,n. (S m) = (S n) \to m = n. +intros. cut ((pred (S m)) = (pred (S n))). +assumption. elim H. autobatch. +qed. + +theorem eq_gen_S_S_cc: \forall m,n. m = n \to (S m) = (S n). +intros. elim H. autobatch. +qed. + +inductive le: nat \to nat \to Prop \def + le_zero: \forall n. (le O n) + | le_succ: \forall m, n. (le m n) \to (le (S m) (S n)). + +theorem le_refl: \forall x. (le x x). +intros. elim x; autobatch. +qed. + +theorem le_gen_x_O_aux: \forall x, y. (le x y) \to (y =O) \to + (x = O). +intros 3. elim H. autobatch. apply eq_gen_S_O. exact n1. autobatch. +qed. + +theorem le_gen_x_O: \forall x. (le x O) \to (x = O). +intros. apply le_gen_x_O_aux. exact O. autobatch. autobatch. +qed. + +theorem le_gen_x_O_cc: \forall x. (x = O) \to (le x O). +intros. elim H. autobatch. +qed. + +theorem le_gen_S_x_aux: \forall m,x,y. (le y x) \to (y = S m) \to + (\exists n. x = (S n) \land (le m n)). +intros 4. elim H; clear H x y. +apply eq_gen_S_O. exact m. elim H1. autobatch. +clear H2. cut (n = m). +elim Hcut. apply ex_intro. exact n1. split; autobatch. +apply eq_gen_S_S. autobatch. +qed. + +theorem le_gen_S_x: \forall m,x. (le (S m) x) \to + (\exists n. x = (S n) \land (le m n)). +intros. apply le_gen_S_x_aux. exact (S m). autobatch. autobatch. +qed. + +theorem le_gen_S_x_cc: \forall m,x. (\exists n. x = (S n) \land (le m n)) \to + (le (S m) x). +intros. elim H. elim H1. cut ((S x1) = x). elim Hcut. autobatch. +elim H2. autobatch. +qed. + +theorem le_gen_S_S: \forall m,n. (le (S m) (S n)) \to (le m n). +intros. +lapply le_gen_S_x to H as H0. elim H0. elim H1. +lapply eq_gen_S_S to H2 as H4. rewrite > H4. assumption. +qed. + +theorem le_gen_S_S_cc: \forall m,n. (le m n) \to (le (S m) (S n)). +intros. autobatch. +qed. + +(* +theorem le_trans: \forall x,y. (le x y) \to \forall z. (le y z) \to (le x z). +intros 1. elim x; clear H. clear x. +autobatch. +fwd H1 [H]. decompose. +*) diff --git a/matita/tests/first.ma b/matita/tests/first.ma new file mode 100644 index 000000000..4fca7b199 --- /dev/null +++ b/matita/tests/first.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/first/". + +inductive nat : Set \def + | O : nat + | S : nat \to nat. + +inductive eq (A:Set): A \to A \to Prop \def + refl: \forall x:A.eq A x x. + +inductive list (A:Set) : Set \def + | nil : list A + | cons : A \to list A \to list A. + +let rec list_len (A:Set) (l:list A) on l \def + match l with + [ nil \Rightarrow O + | (cons a tl) \Rightarrow S (list_len A tl)]. + +theorem stupid: \forall A:Set.eq ? (list_len A (nil ?)) O. +intros. +normalize. +apply refl. +qed. diff --git a/matita/tests/fix_betareduction.ma b/matita/tests/fix_betareduction.ma new file mode 100644 index 000000000..65c916f17 --- /dev/null +++ b/matita/tests/fix_betareduction.ma @@ -0,0 +1,27 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/fix_betareduction/". +include "../legacy/coq.ma". + +alias id "eq" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)". +alias id "n" = "cic:/Suresnes/BDD/canonicite/Canonicity_BDT/n.con". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +theorem a: + (\forall p: nat \to Prop. + \forall n: nat. p n \to p n ) \to (eq nat n n). +intro. +apply (H (\lambda n:nat.(eq nat n n))). +reflexivity. +qed. diff --git a/matita/tests/fold.ma b/matita/tests/fold.ma new file mode 100644 index 000000000..cd507c7de --- /dev/null +++ b/matita/tests/fold.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/fold". +include "../legacy/coq.ma". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias num (instance 0) = "natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "plus" (instance 0) = "Coq's natural plus". +theorem t: \forall x:nat. 0+x=x. + intro. + simplify in match (0+x) in \vdash (? ? % ?). + fold simplify (0 + x) in \vdash (? ? % ?). + reflexivity. +qed. diff --git a/matita/tests/generalize.ma b/matita/tests/generalize.ma new file mode 100644 index 000000000..a3aacd3bf --- /dev/null +++ b/matita/tests/generalize.ma @@ -0,0 +1,37 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/generalize". +include "../legacy/coq.ma". + +alias num (instance 0) = "Coq natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "plus" (instance 0) = "Coq's natural plus". +alias id "plus_comm" = "cic:/Coq/Arith/Plus/plus_comm.con". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". + +(* This tests is for the case of a pattern that contains metavariables *) +theorem t: \forall x. x + 4 = 4 + x. + intro. + generalize in match (S ?). + intro; apply plus_comm. +qed. + +(* This test used to fail because x was used in the wrong context *) +(* Once this was fixed it still did not work since apply is not *) +(* able to solve a goal that ends in a product. *) +theorem test2: \forall x. 4 + x = x + 4. + generalize in match 4. + exact plus_comm. +qed. diff --git a/matita/tests/hard_refine.ma b/matita/tests/hard_refine.ma new file mode 100644 index 000000000..059a27be3 --- /dev/null +++ b/matita/tests/hard_refine.ma @@ -0,0 +1,67 @@ +set "baseuri" "cic:/matita/TPTP/BOO024-1". +include "../legacy/coq.ma". +alias id "eq" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)". +(* Inclusion of: BOO024-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO024-1 : TPTP v3.1.1. Released v2.2.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Half of Padmanabhan's 6-basis with Pixley, part 2. *) +(* Version : [MP96] (equality) axioms : Especial. *) +(* English : Part 2 (of 3) of the proof that half of Padmanaban's self-dual *) +(* independent 6-basis for Boolean Algebra, together with a Pixley *) +(* polynomial, is a basis for Boolean algebra. *) +(* Refs : [McC98] McCune (1998), Email to G. Sutcliffe *) +(* : [MP96] McCune & Padmanabhan (1996), Automated Deduction in Eq *) +(* Source : [McC98] *) +(* Names : DUAL-BA-2-b [MP96] *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.2.1 *) +(* Syntax : Number of clauses : 8 ( 0 non-Horn; 8 unit; 1 RR) *) +(* Number of atoms : 8 ( 8 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 7 ( 3 constant; 0-3 arity) *) +(* Number of variables : 15 ( 2 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : *) +(* -------------------------------------------------------------------------- *) +(* ----Half of Padmanabhan's self-dual independent 6-basis for Boolean Algebra: *) +(* ----pixley(X,Y,Z) is a Pixley polynomial: *) +(* ----Denial of conclusion: *) + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "eq" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)". +alias id "eq_ind" = "cic:/Coq/Init/Logic/eq_ind.con". +alias id "eq_ind_r" = "cic:/Coq/Init/Logic/eq_ind_r.con". +alias id "sym_eq" = "cic:/Coq/Init/Logic/sym_eq.con". +alias id "refl_equal" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)". + +theorem prove_add_multiply: \forall (A: (Set)).(\forall (a: (A)).(\forall (add: ((A) \to ((A) \to (A)))).(\forall (b: (A)).(\forall (inverse: ((A) \to (A))).(\forall (multiply: ((A) \to ((A) \to (A)))).(\forall (n1: (A)).(\forall (pixley: ((A) \to ((A) \to ((A) \to (A))))).(\forall (H0: (\forall (X: (A)).(\forall (Y: (A)).((eq) (A) ((pixley) (X) (Y) (X)) (X))))).(\forall (H1: (\forall (X: (A)).(\forall (Y: (A)).((eq) (A) ((pixley) (X) (Y) (Y)) (X))))).(\forall (H2: (\forall (X: (A)).(\forall (Y: (A)).((eq) (A) ((pixley) (X) (X) (Y)) (Y))))).(\forall (H3: (\forall (X: (A)).(\forall (Y: (A)).(\forall (Z: (A)).((eq) (A) ((pixley) (X) (Y) (Z)) ((add) ((multiply) (X) ((inverse) (Y))) ((add) ((multiply) (X) (Z)) ((multiply) ((inverse) (Y)) (Z))))))))).(\forall (H4: (\forall (X: (A)).((eq) (A) ((add) (X) ((inverse) (X))) (n1)))).(\forall (H5: (\forall (X: (A)).(\forall (Y: (A)).(\forall (Z: (A)).((eq) (A) ((multiply) (X) ((add) (Y) (Z))) ((add) ((multiply) (Y) (X)) ((multiply) (Z) (X)))))))).(\forall (H6: (\forall (X: (A)).(\forall (Y: (A)).((eq) (A) ((multiply) ((add) (X) (Y)) (Y)) (Y))))). + \forall HH:(\forall x:A.eq A (multiply (add x x) n1) (add (add x x) (add x x))). + \forall HH1:(\forall x:A.eq A (multiply (add x x) n1) (add x x)). +((eq) (A) ((add) ((multiply) (a) (b)) (b)) (b)))))))))))))))) . +intros. +(* sotto termine piu' piccolo, comunque lentissimo *) +letin k \def (eq_ind_r A (add (multiply ? (inverse ?)) (multiply b n1)) (\lambda x:A.(eq A (multiply b n1) x)) (eq_ind A (multiply (multiply b n1) n1) (\lambda x:A.(eq A (multiply b n1) (add (multiply ? (inverse ?)) x))) (eq_ind A (pixley ? ? (multiply b n1)) (\lambda x:A.(eq A x (add (multiply ? (inverse ?)) (multiply (multiply b n1) n1)))) (eq_ind A (add ? (inverse ?)) (\lambda x:A.(eq A (pixley ? ? (multiply b n1)) (add (multiply ? (inverse ?)) (multiply (multiply b n1) x)))) (eq_ind_r A (add (multiply ? (multiply b n1)) (multiply (inverse ?) (multiply b n1))) (\lambda x:A.(eq A (pixley ? ? (multiply b n1)) (add (multiply ? (inverse ?)) x))) (H3 ? ? (multiply b n1)) (multiply (multiply b n1) (add ? (inverse ?))) (H5 (multiply b n1) ? (inverse ?))) n1 (H4 ?)) (multiply b n1) (H2 ? (multiply b n1))) (multiply b n1) (eq_ind_r A (multiply n1 (add b b)) (\lambda x:A.(eq A (multiply (multiply b n1) n1) x)) (eq_ind_r A (multiply n1 (add b b)) (\lambda x:A.(eq A (multiply x n1) (multiply n1 (add b b)))) (eq_ind_r A (add (multiply b n1) (multiply b n1)) (\lambda x:A.(eq A (multiply (multiply n1 (add b b)) n1) x)) (eq_ind_r A (add (multiply b n1) (multiply b n1)) (\lambda x:A.(eq A (multiply x n1) (add (multiply b n1) (multiply b n1)))) (H8 (multiply b n1)) (multiply n1 (add b b)) (H5 n1 b b)) (multiply n1 (add b b)) (H5 n1 b b)) (multiply b n1) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b x) (multiply n1 (add b b)))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b (add n1 n1)) (multiply x (add b b)))) (eq_ind_r A (add (multiply b (add n1 n1)) (multiply b (add n1 n1))) (\lambda x:A.(eq A (multiply b (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (multiply b (add n1 n1)) (add (multiply b (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A x (add (multiply b (add n1 n1)) (add (multiply n1 b) (multiply n1 b))))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (add (multiply n1 b) (multiply n1 b)) (add x (add (multiply n1 b) (multiply n1 b))))) (eq_ind A (multiply (add (multiply n1 b) (multiply n1 b)) n1) (\lambda x:A.(eq A x (add (add (multiply n1 b) (multiply n1 b)) (add (multiply n1 b) (multiply n1 b))))) (H7 (multiply n1 b)) (add (multiply n1 b) (multiply n1 b)) (H8 (multiply n1 b))) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply (add n1 n1) (add b b)) (H5 (add n1 n1) b b)) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1)))) (multiply b n1) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b x) (multiply n1 (add b b)))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b (add n1 n1)) (multiply x (add b b)))) (eq_ind_r A (add (multiply b (add n1 n1)) (multiply b (add n1 n1))) (\lambda x:A.(eq A (multiply b (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (multiply b (add n1 n1)) (add (multiply b (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A x (add (multiply b (add n1 n1)) (add (multiply n1 b) (multiply n1 b))))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (add (multiply n1 b) (multiply n1 b)) (add x (add (multiply n1 b) (multiply n1 b))))) (eq_ind A (multiply (add (multiply n1 b) (multiply n1 b)) n1) (\lambda x:A.(eq A x (add (add (multiply n1 b) (multiply n1 b)) (add (multiply n1 b) (multiply n1 b))))) (H7 (multiply n1 b)) (add (multiply n1 b) (multiply n1 b)) (H8 (multiply n1 b))) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply (add n1 n1) (add b b)) (H5 (add n1 n1) b b)) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))))) b (eq_ind A (pixley ? ? b) (\lambda x:A.(eq A x (add (multiply ? (inverse ?)) (multiply b n1)))) (eq_ind A (add ? (inverse ?)) (\lambda x:A.(eq A (pixley ? ? b) (add (multiply ? (inverse ?)) (multiply b x)))) (eq_ind_r A (add (multiply ? b) (multiply (inverse ?) b)) (\lambda x:A.(eq A (pixley ? ? b) (add (multiply ? (inverse ?)) x))) (H3 ? ? b) (multiply b (add ? (inverse ?))) (H5 b ? (inverse ?))) n1 (H4 ?)) b (H2 ? b))). +focus 162. clearbody k. +letin k1 \def (eq_ind_r A (add (multiply ? (inverse ?)) (multiply b n1)) (\lambda x:A.(eq A (multiply b n1) x)) (eq_ind A (multiply (multiply b n1) n1) (\lambda x:A.(eq A (multiply b n1) (add (multiply ? (inverse ?)) x))) (eq_ind A (pixley ? ? (multiply b n1)) (\lambda x:A.(eq A x (add (multiply ? (inverse ?)) (multiply (multiply b n1) n1)))) (eq_ind A (add ? (inverse ?)) (\lambda x:A.(eq A (pixley ? ? (multiply b n1)) (add (multiply ? (inverse ?)) (multiply (multiply b n1) x)))) (eq_ind_r A (add (multiply ? (multiply b n1)) (multiply (inverse ?) (multiply b n1))) (\lambda x:A.(eq A (pixley ? ? (multiply b n1)) (add (multiply ? (inverse ?)) x))) (H3 ? ? (multiply b n1)) (multiply (multiply b n1) (add ? (inverse ?))) (H5 (multiply b n1) ? (inverse ?))) n1 (H4 ?)) (multiply b n1) (H2 ? (multiply b n1))) (multiply b n1) (eq_ind_r A (multiply n1 (add b b)) (\lambda x:A.(eq A (multiply (multiply b n1) n1) x)) (eq_ind_r A (multiply n1 (add b b)) (\lambda x:A.(eq A (multiply x n1) (multiply n1 (add b b)))) (eq_ind_r A (add (multiply b n1) (multiply b n1)) (\lambda x:A.(eq A (multiply (multiply n1 (add b b)) n1) x)) (eq_ind_r A (add (multiply b n1) (multiply b n1)) (\lambda x:A.(eq A (multiply x n1) (add (multiply b n1) (multiply b n1)))) (H8 (multiply b n1)) (multiply n1 (add b b)) (H5 n1 b b)) (multiply n1 (add b b)) (H5 n1 b b)) (multiply b n1) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b x) (multiply n1 (add b b)))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b (add n1 n1)) (multiply x (add b b)))) (eq_ind_r A (add (multiply b (add n1 n1)) (multiply b (add n1 n1))) (\lambda x:A.(eq A (multiply b (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (multiply b (add n1 n1)) (add (multiply b (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A x (add (multiply b (add n1 n1)) (add (multiply n1 b) (multiply n1 b))))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (add (multiply n1 b) (multiply n1 b)) (add x (add (multiply n1 b) (multiply n1 b))))) (eq_ind A (multiply (add (multiply n1 b) (multiply n1 b)) n1) (\lambda x:A.(eq A x (add (add (multiply n1 b) (multiply n1 b)) (add (multiply n1 b) (multiply n1 b))))) (H7 (multiply n1 b)) (add (multiply n1 b) (multiply n1 b)) (H8 (multiply n1 b))) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply (add n1 n1) (add b b)) (H5 (add n1 n1) b b)) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1)))) (multiply b n1) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b x) (multiply n1 (add b b)))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b (add n1 n1)) (multiply x (add b b)))) (eq_ind_r A (add (multiply b (add n1 n1)) (multiply b (add n1 n1))) (\lambda x:A.(eq A (multiply b (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (multiply b (add n1 n1)) (add (multiply b (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A x (add (multiply b (add n1 n1)) (add (multiply n1 b) (multiply n1 b))))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (add (multiply n1 b) (multiply n1 b)) (add x (add (multiply n1 b) (multiply n1 b))))) (eq_ind A (multiply (add (multiply n1 b) (multiply n1 b)) n1) (\lambda x:A.(eq A x (add (add (multiply n1 b) (multiply n1 b)) (add (multiply n1 b) (multiply n1 b))))) (H7 (multiply n1 b)) (add (multiply n1 b) (multiply n1 b)) (H8 (multiply n1 b))) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply (add n1 n1) (add b b)) (H5 (add n1 n1) b b)) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))))) b (eq_ind A (pixley ? ? b) (\lambda x:A.(eq A x (add (multiply ? (inverse ?)) (multiply b n1)))) (eq_ind A (add ? (inverse ?)) (\lambda x:A.(eq A (pixley ? ? b) (add (multiply ? (inverse ?)) (multiply b x)))) (eq_ind_r A (add (multiply ? b) (multiply (inverse ?) b)) (\lambda x:A.(eq A (pixley ? ? b) (add (multiply ? (inverse ?)) x))) (H3 ? ? b) (multiply b (add ? (inverse ?))) (H5 b ? (inverse ?))) n1 (H4 ?)) b (H2 ? b))). +focus 319. clearbody k1. +letin k2 \def (eq_ind A (multiply (add a n1) n1) (\lambda x:A.(eq A x (add a n1))) (eq_ind_r A (add (multiply ? (inverse ?)) (multiply (add a n1) n1)) (\lambda x:A.(eq A (multiply (add a n1) n1) x)) (eq_ind A (multiply (multiply (add a n1) n1) n1) (\lambda x:A.(eq A (multiply (add a n1) n1) (add (multiply ? (inverse ?)) x))) (eq_ind A (pixley ? ? (multiply (add a n1) n1)) (\lambda x:A.(eq A x (add (multiply ? (inverse ?)) (multiply (multiply (add a n1) n1) n1)))) (eq_ind A (add ? (inverse ?)) (\lambda x:A.(eq A (pixley ? ? (multiply (add a n1) n1)) (add (multiply ? (inverse ?)) (multiply (multiply (add a n1) n1) x)))) (eq_ind_r A (add (multiply ? (multiply (add a n1) n1)) (multiply (inverse ?) (multiply (add a n1) n1))) (\lambda x:A.(eq A (pixley ? ? (multiply (add a n1) n1)) (add (multiply ? (inverse ?)) x))) (H3 ? ? (multiply (add a n1) n1)) (multiply (multiply (add a n1) n1) (add ? (inverse ?))) (H5 (multiply (add a n1) n1) ? (inverse ?))) n1 (H4 ?)) (multiply (add a n1) n1) (H2 ? (multiply (add a n1) n1))) (multiply (add a n1) n1) (eq_ind_r A (multiply n1 (add (add a n1) (add a n1))) (\lambda x:A.(eq A (multiply (multiply (add a n1) n1) n1) x)) (eq_ind_r A (multiply n1 (add (add a n1) (add a n1))) (\lambda x:A.(eq A (multiply x n1) (multiply n1 (add (add a n1) (add a n1))))) (eq_ind_r A (add (multiply (add a n1) n1) (multiply (add a n1) n1)) (\lambda x:A.(eq A (multiply (multiply n1 (add (add a n1) (add a n1))) n1) x)) (eq_ind_r A (add (multiply (add a n1) n1) (multiply (add a n1) n1)) (\lambda x:A.(eq A (multiply x n1) (add (multiply (add a n1) n1) (multiply (add a n1) n1)))) (H8 (multiply (add a n1) n1)) (multiply n1 (add (add a n1) (add a n1))) (H5 n1 (add a n1) (add a n1))) (multiply n1 (add (add a n1) (add a n1))) (H5 n1 (add a n1) (add a n1))) (multiply (add a n1) n1) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply (add a n1) x) (multiply n1 (add (add a n1) (add a n1))))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply (add a n1) (add n1 n1)) (multiply x (add (add a n1) (add a n1))))) (eq_ind_r A (add (multiply (add a n1) (add n1 n1)) (multiply (add a n1) (add n1 n1))) (\lambda x:A.(eq A (multiply (add a n1) (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (\lambda x:A.(eq A (multiply (add a n1) (add n1 n1)) (add (multiply (add a n1) (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (\lambda x:A.(eq A x (add (multiply (add a n1) (add n1 n1)) (add (multiply n1 (add a n1)) (multiply n1 (add a n1)))))) (eq_ind_r A (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (\lambda x:A.(eq A (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (add x (add (multiply n1 (add a n1)) (multiply n1 (add a n1)))))) (eq_ind A (multiply (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) n1) (\lambda x:A.(eq A x (add (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (add (multiply n1 (add a n1)) (multiply n1 (add a n1)))))) (H7 (multiply n1 (add a n1))) (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (H8 (multiply n1 (add a n1)))) (multiply (add a n1) (add n1 n1)) (H5 (add a n1) n1 n1)) (multiply (add a n1) (add n1 n1)) (H5 (add a n1) n1 n1)) (multiply (add a n1) (add n1 n1)) (H5 (add a n1) n1 n1)) (multiply (add n1 n1) (add (add a n1) (add a n1))) (H5 (add n1 n1) (add a n1) (add a n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1)))) (multiply (add a n1) n1) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply (add a n1) x) (multiply n1 (add (add a n1) (add a n1))))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply (add a n1) (add n1 n1)) (multiply x (add (add a n1) (add a n1))))) (eq_ind_r A (add (multiply (add a n1) (add n1 n1)) (multiply (add a n1) (add n1 n1))) (\lambda x:A.(eq A (multiply (add a n1) (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (\lambda x:A.(eq A (multiply (add a n1) (add n1 n1)) (add (multiply (add a n1) (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (\lambda x:A.(eq A x (add (multiply (add a n1) (add n1 n1)) (add (multiply n1 (add a n1)) (multiply n1 (add a n1)))))) (eq_ind_r A (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (\lambda x:A.(eq A (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (add x (add (multiply n1 (add a n1)) (multiply n1 (add a n1)))))) (eq_ind A (multiply (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) n1) (\lambda x:A.(eq A x (add (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (add (multiply n1 (add a n1)) (multiply n1 (add a n1)))))) (H7 (multiply n1 (add a n1))) (add (multiply n1 (add a n1)) (multiply n1 (add a n1))) (H8 (multiply n1 (add a n1)))) (multiply (add a n1) (add n1 n1)) (H5 (add a n1) n1 n1)) (multiply (add a n1) (add n1 n1)) (H5 (add a n1) n1 n1)) (multiply (add a n1) (add n1 n1)) (H5 (add a n1) n1 n1)) (multiply (add n1 n1) (add (add a n1) (add a n1))) (H5 (add n1 n1) (add a n1) (add a n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))))) (add a n1) (eq_ind A (pixley ? ? (add a n1)) (\lambda x:A.(eq A x (add (multiply ? (inverse ?)) (multiply (add a n1) n1)))) (eq_ind A (add ? (inverse ?)) (\lambda x:A.(eq A (pixley ? ? (add a n1)) (add (multiply ? (inverse ?)) (multiply (add a n1) x)))) (eq_ind_r A (add (multiply ? (add a n1)) (multiply (inverse ?) (add a n1))) (\lambda x:A.(eq A (pixley ? ? (add a n1)) (add (multiply ? (inverse ?)) x))) (H3 ? ? (add a n1)) (multiply (add a n1) (add ? (inverse ?))) (H5 (add a n1) ? (inverse ?))) n1 (H4 ?)) (add a n1) (H2 ? (add a n1)))) n1 (H6 a n1)). +focus 476. clearbody k2. +letin k3 \def (eq_ind_r A (add (multiply ? (inverse ?)) (multiply b n1)) (\lambda x:A.(eq A (multiply b n1) x)) (eq_ind A (multiply (multiply b n1) n1) (\lambda x:A.(eq A (multiply b n1) (add (multiply ? (inverse ?)) x))) (eq_ind A (pixley ? ? (multiply b n1)) (\lambda x:A.(eq A x (add (multiply ? (inverse ?)) (multiply (multiply b n1) n1)))) (eq_ind A (add ? (inverse ?)) (\lambda x:A.(eq A (pixley ? ? (multiply b n1)) (add (multiply ? (inverse ?)) (multiply (multiply b n1) x)))) (eq_ind_r A (add (multiply ? (multiply b n1)) (multiply (inverse ?) (multiply b n1))) (\lambda x:A.(eq A (pixley ? ? (multiply b n1)) (add (multiply ? (inverse ?)) x))) (H3 ? ? (multiply b n1)) (multiply (multiply b n1) (add ? (inverse ?))) (H5 (multiply b n1) ? (inverse ?))) n1 (H4 ?)) (multiply b n1) (H2 ? (multiply b n1))) (multiply b n1) (eq_ind_r A (multiply n1 (add b b)) (\lambda x:A.(eq A (multiply (multiply b n1) n1) x)) (eq_ind_r A (multiply n1 (add b b)) (\lambda x:A.(eq A (multiply x n1) (multiply n1 (add b b)))) (eq_ind_r A (add (multiply b n1) (multiply b n1)) (\lambda x:A.(eq A (multiply (multiply n1 (add b b)) n1) x)) (eq_ind_r A (add (multiply b n1) (multiply b n1)) (\lambda x:A.(eq A (multiply x n1) (add (multiply b n1) (multiply b n1)))) (H8 (multiply b n1)) (multiply n1 (add b b)) (H5 n1 b b)) (multiply n1 (add b b)) (H5 n1 b b)) (multiply b n1) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b x) (multiply n1 (add b b)))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b (add n1 n1)) (multiply x (add b b)))) (eq_ind_r A (add (multiply b (add n1 n1)) (multiply b (add n1 n1))) (\lambda x:A.(eq A (multiply b (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (multiply b (add n1 n1)) (add (multiply b (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A x (add (multiply b (add n1 n1)) (add (multiply n1 b) (multiply n1 b))))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (add (multiply n1 b) (multiply n1 b)) (add x (add (multiply n1 b) (multiply n1 b))))) (eq_ind A (multiply (add (multiply n1 b) (multiply n1 b)) n1) (\lambda x:A.(eq A x (add (add (multiply n1 b) (multiply n1 b)) (add (multiply n1 b) (multiply n1 b))))) (H7 (multiply n1 b)) (add (multiply n1 b) (multiply n1 b)) (H8 (multiply n1 b))) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply (add n1 n1) (add b b)) (H5 (add n1 n1) b b)) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1)))) (multiply b n1) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b x) (multiply n1 (add b b)))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b (add n1 n1)) (multiply x (add b b)))) (eq_ind_r A (add (multiply b (add n1 n1)) (multiply b (add n1 n1))) (\lambda x:A.(eq A (multiply b (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (multiply b (add n1 n1)) (add (multiply b (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A x (add (multiply b (add n1 n1)) (add (multiply n1 b) (multiply n1 b))))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (add (multiply n1 b) (multiply n1 b)) (add x (add (multiply n1 b) (multiply n1 b))))) (eq_ind A (multiply (add (multiply n1 b) (multiply n1 b)) n1) (\lambda x:A.(eq A x (add (add (multiply n1 b) (multiply n1 b)) (add (multiply n1 b) (multiply n1 b))))) (H7 (multiply n1 b)) (add (multiply n1 b) (multiply n1 b)) (H8 (multiply n1 b))) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply (add n1 n1) (add b b)) (H5 (add n1 n1) b b)) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))))) b (eq_ind A (pixley ? ? b) (\lambda x:A.(eq A x (add (multiply ? (inverse ?)) (multiply b n1)))) (eq_ind A (add ? (inverse ?)) (\lambda x:A.(eq A (pixley ? ? b) (add (multiply ? (inverse ?)) (multiply b x)))) (eq_ind_r A (add (multiply ? b) (multiply (inverse ?) b)) (\lambda x:A.(eq A (pixley ? ? b) (add (multiply ? (inverse ?)) x))) (H3 ? ? b) (multiply b (add ? (inverse ?))) (H5 b ? (inverse ?))) n1 (H4 ?)) b (H2 ? b))). +focus 633. clearbody k3. +exact +(eq_ind A b (\lambda x:A.(eq A x b)) (refl_equal A b) (add (multiply a b) b) (eq_ind A (multiply b n1) (\lambda x:A.(eq A x (add (multiply a b) b))) (eq_ind_r A (add a n1) (\lambda x:A.(eq A (multiply b x) (add (multiply a b) b))) (eq_ind_r A (multiply n1 b) (\lambda x:A.(eq A (multiply b (add a n1)) (add (multiply a b) x))) (H5 b a n1) b (eq_ind A (multiply b n1) (\lambda x:A.(eq A b (multiply n1 x))) (eq_ind A (multiply b n1) (\lambda x:A.(eq A x (multiply n1 (multiply b n1)))) (eq_ind_r A (add b b) (\lambda x:A.(eq A (multiply b n1) (multiply n1 x))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b x) (multiply n1 (add b b)))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b (add n1 n1)) (multiply x (add b b)))) (eq_ind_r A (add (multiply b (add n1 n1)) (multiply b (add n1 n1))) (\lambda x:A.(eq A (multiply b (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (multiply b (add n1 n1)) (add (multiply b (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A x (add (multiply b (add n1 n1)) (add (multiply n1 b) (multiply n1 b))))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (add (multiply n1 b) (multiply n1 b)) (add x (add (multiply n1 b) (multiply n1 b))))) (eq_ind A (multiply (add (multiply n1 b) (multiply n1 b)) n1) (\lambda x:A.(eq A x (add (add (multiply n1 b) (multiply n1 b)) (add (multiply n1 b) (multiply n1 b))))) (H7 (multiply n1 b)) (add (multiply n1 b) (multiply n1 b)) (H8 (multiply n1 b))) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply (add n1 n1) (add b b)) (H5 (add n1 n1) b b)) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) (multiply b n1) (eq_ind_r A (multiply n1 (add b b)) (\lambda x:A.(eq A x (add b b))) (eq_ind A (multiply (add b b) n1) (\lambda x:A.(eq A (multiply n1 (add b b)) x)) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply n1 (add b b)) (multiply (add b b) x))) (eq_ind_r A (add (multiply n1 (add b b)) (multiply n1 (add b b))) (\lambda x:A.(eq A (multiply n1 (add b b)) x)) (eq_ind_r A (add (multiply b n1) (multiply b n1)) (\lambda x:A.(eq A (multiply n1 (add b b)) (add (multiply n1 (add b b)) x))) (eq_ind_r A (add (multiply b n1) (multiply b n1)) (\lambda x:A.(eq A x (add (multiply n1 (add b b)) (add (multiply b n1) (multiply b n1))))) (eq_ind_r A (add (multiply b n1) (multiply b n1)) (\lambda x:A.(eq A (add (multiply b n1) (multiply b n1)) (add x (add (multiply b n1) (multiply b n1))))) (eq_ind A (multiply (add (multiply b n1) (multiply b n1)) n1) (\lambda x:A.(eq A x (add (add (multiply b n1) (multiply b n1)) (add (multiply b n1) (multiply b n1))))) (H7 (multiply b n1)) (add (multiply b n1) (multiply b n1)) (H8 (multiply b n1))) (multiply n1 (add b b)) (H5 n1 b b)) (multiply n1 (add b b)) (H5 n1 b b)) (multiply n1 (add b b)) (H5 n1 b b)) (multiply (add b b) (add n1 n1)) (H5 (add b b) n1 n1)) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) (add b b) (H8 b)) (multiply b n1) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b x) (multiply n1 (add b b)))) (eq_ind A (add n1 n1) (\lambda x:A.(eq A (multiply b (add n1 n1)) (multiply x (add b b)))) (eq_ind_r A (add (multiply b (add n1 n1)) (multiply b (add n1 n1))) (\lambda x:A.(eq A (multiply b (add n1 n1)) x)) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (multiply b (add n1 n1)) (add (multiply b (add n1 n1)) x))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A x (add (multiply b (add n1 n1)) (add (multiply n1 b) (multiply n1 b))))) (eq_ind_r A (add (multiply n1 b) (multiply n1 b)) (\lambda x:A.(eq A (add (multiply n1 b) (multiply n1 b)) (add x (add (multiply n1 b) (multiply n1 b))))) (eq_ind A (multiply (add (multiply n1 b) (multiply n1 b)) n1) (\lambda x:A.(eq A x (add (add (multiply n1 b) (multiply n1 b)) (add (multiply n1 b) (multiply n1 b))))) (H7 (multiply n1 b)) (add (multiply n1 b) (multiply n1 b)) (H8 (multiply n1 b))) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply b (add n1 n1)) (H5 b n1 n1)) (multiply (add n1 n1) (add b b)) (H5 (add n1 n1) b b)) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))) n1 (eq_ind A (multiply (add n1 n1) n1) (\lambda x:A.(eq A x n1)) (H6 n1 n1) (add n1 n1) (H8 n1))))) b ?) b ?)) n1 ?) b ?)). +autobatch. +autobatch. +autobatch. +autobatch. +unfocus. +autobatch. +unfocus. +autobatch. +unfocus. +autobatch. +unfocus. +autobatch. +qed. diff --git a/matita/tests/injection.ma b/matita/tests/injection.ma new file mode 100644 index 000000000..2cc7110ff --- /dev/null +++ b/matita/tests/injection.ma @@ -0,0 +1,62 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/injection". + +include "../legacy/coq.ma". + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "bool" = "cic:/Coq/Init/Datatypes/bool.ind#xpointer(1/1)". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". + +inductive t0 : Type := + k0 : nat → nat → t0 + | k0' : bool → bool → t0. + +theorem injection_test0: ∀n,n',m,m'. k0 n m = k0 n' m' → m = m'. + intros; + destruct H; + reflexivity. +qed. + +inductive t : Type → Type := + k : nat → t nat + | k': bool → t bool. + +theorem injection_test1: ∀n,n'. k n = k n' → n = n'. + intros; + destruct H; + reflexivity. +qed. + +inductive tt (A:Type) : Type -> Type := + k1: nat → nat → tt A nat + | k2: bool → bool → tt A bool. + +theorem injection_test2: ∀n,n',m,m'. k1 bool n n' = k1 bool m m' → n' = m'. + intros; + destruct H; + reflexivity. +qed. + +inductive ttree : Type → Type := + tempty: ttree nat + | tnode : ∀A. ttree A → ttree A → ttree A. + +theorem injection_test4: + ∀n,n',m,m'. k1 bool (S n) (S (S m)) = k1 bool (S n') (S (S (S m'))) → m = S m'. + intros; + destruct H; + reflexivity. +qed. diff --git a/matita/tests/interactive/automatic_insertion.ma b/matita/tests/interactive/automatic_insertion.ma new file mode 100644 index 000000000..56212bdc5 --- /dev/null +++ b/matita/tests/interactive/automatic_insertion.ma @@ -0,0 +1,17 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/xxx". + +theorem t: And True (eq nat O O). split. exact (refl_equal nat O). exact I. qed. \ No newline at end of file diff --git a/matita/tests/interactive/drop.ma b/matita/tests/interactive/drop.ma new file mode 100644 index 000000000..b8718cdb8 --- /dev/null +++ b/matita/tests/interactive/drop.ma @@ -0,0 +1,8 @@ +set "baseuri" "cic:/matita/tests/drop". + +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". +alias num (instance 0) = "natural number". +alias symbol "eq" (instance 0) = "leibnitz's equality". +alias symbol "plus" (instance 0) = "natural plus". +theorem a : O + 1 = 1. +drop. diff --git a/matita/tests/interactive/grafite.ma b/matita/tests/interactive/grafite.ma new file mode 100644 index 000000000..aaf570091 --- /dev/null +++ b/matita/tests/interactive/grafite.ma @@ -0,0 +1,34 @@ +set "baseuri" "cic:/matita/tests/grafite/". + +(* commento *) +(** hint. *) + +inductive pippo : Type \def + | a : Type \to pippo + | b : Prop \to pippo + | c : Set \to pippo. + +definition pollo : Set \to Set \def + \lambda a:Set.a. + +inductive paolo : Prop \def t:paolo. + +theorem comeno : \forall p:pippo.pippo. +intros.assumption. +qed. + +definition f : pippo \to paolo \def + \lambda x:pippo. + match x with + [ (a z) \Rightarrow t + | (b z) \Rightarrow t + | (c z) \Rightarrow t ]. + +record w : Type \def { + mario : Prop; + pippo : Set +}. + +whelp locate pippo. + +print "coercions". diff --git a/matita/tests/interactive/test5.ma b/matita/tests/interactive/test5.ma new file mode 100644 index 000000000..e48cc827e --- /dev/null +++ b/matita/tests/interactive/test5.ma @@ -0,0 +1,7 @@ +set "baseuri" "cic:/matita/tests/interactive/test5/". + +whelp instance + \lambda A:Set. + \lambda f: A \to A \to A. + \forall x,y : A. + f x y = f y x. diff --git a/matita/tests/interactive/test6.ma b/matita/tests/interactive/test6.ma new file mode 100644 index 000000000..4afdd3741 --- /dev/null +++ b/matita/tests/interactive/test6.ma @@ -0,0 +1,7 @@ +set "baseuri" "cic:/matita/tests/interactive/test6/". + +whelp instance + \lambda A:Set. + \lambda f:A \to A \to A. + \forall x,y,z:A. + f x (f y z) = f (f x y) z. diff --git a/matita/tests/interactive/test7.ma b/matita/tests/interactive/test7.ma new file mode 100644 index 000000000..d7347ed9f --- /dev/null +++ b/matita/tests/interactive/test7.ma @@ -0,0 +1,7 @@ +set "baseuri" "cic:/matita/tests/interactive/test7/". + +whelp instance + \lambda A:Set. + \lambda r:A \to A \to Prop. + \forall x:A. + r x x. diff --git a/matita/tests/interactive/test_instance.ma b/matita/tests/interactive/test_instance.ma new file mode 100644 index 000000000..7e02c0fff --- /dev/null +++ b/matita/tests/interactive/test_instance.ma @@ -0,0 +1,16 @@ +set "baseuri" "cic:/matita/tests/interactive/instance/". + +whelp instance \lambda A:Set.\lambda P:A \to A \to Prop.\forall x:A. P x x. +whelp instance \lambda A:Set.\lambda P:A \to A \to Prop.\forall x,y:A. P x y \to P y x. +whelp instance \lambda A:Set.\lambda P:A \to A \to Prop.\forall x,y,z:A. P x y \to P y z \to P y z. +whelp instance \lambda A:Set.\lambda f:A \to A \to A. \forall x,y:A. f x y = f y x. +whelp instance \lambda A:Set.\lambda r : A \to A \to Prop. \forall x,y,z:A. r x y \to r y z \to r x z. + + +whelp instance \lambda A:Set.\lambda R:A \to A \to Prop.\forall x:A.\forall y:A.(R x y) \to \forall z:A.(R x z) \to \exists u:A.(R y u) \land (R z u). + +whelp instance λA:Set.λR:A→A→Prop.∀x:A.∀y:A.(R x y)→∀z:A.(R x z)→∃u:A.(R y u)∧(R z u). + +whelp instance \lambda A:Set. \lambda R:A\to A\to Prop. confluence A R. + +whelp instance \lambda A:Set. \lambda f:A\to A\to A. \lambda g:A\to A\to A. \forall x,y,z : A . f x (g y z) = g (f x y ) (f x z). diff --git a/matita/tests/inversion.ma b/matita/tests/inversion.ma new file mode 100644 index 000000000..4c33beee0 --- /dev/null +++ b/matita/tests/inversion.ma @@ -0,0 +1,61 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/inversion_sum/". +include "../legacy/coq.ma". + + +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". + +inductive sum (n:nat) : nat \to nat \to Set \def + k: \forall x,y. n = x + y \to sum n x y. + + + + +theorem t: \forall x,y. \forall H: sum x y O. + match H with [ (k a b p) \Rightarrow a ] = x. + intros. + inversion H. + + (* + cut (y = y \to O = O \to match H with [ (k a b p) \Rightarrow a] = x). + apply Hcut; reflexivity. + apply + (sum_ind ? + (\lambda a,b,K. y=a \to O=b \to + match K with [ (k a b p) \Rightarrow a ] = x) + ? ? ? H). + goal 16.*) + simplify. intros. + generalize in match H1. + rewrite < H2; rewrite < H3.intro. + rewrite > H4.autobatch library. +qed. + +theorem t1: \forall x,y. sum x y O \to x = y. +intros. + +(* +cut y=y \to O=O \to x = y. +apply Hcut.reflexivity. reflexivity. +apply (sum_ind ? (\lambda a,b,K. y=a \to O=b \to x=a) ? ? ? s).*) + +(*apply (sum_ind ? (\lambda a,b,K. y = a \to O = b \to x = a) ? ? ? s).*) +inversion s. +intros.simplify. +intros. +rewrite > H. rewrite < H2. autobatch library. +qed. diff --git a/matita/tests/inversion2.ma b/matita/tests/inversion2.ma new file mode 100644 index 000000000..c99c59bcf --- /dev/null +++ b/matita/tests/inversion2.ma @@ -0,0 +1,63 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/inversion2/". +include "../legacy/coq.ma". + +inductive nat : Set \def + O : nat + | S : nat \to nat. + + +inductive le (n:nat) : nat \to Prop \def + leO : le n n + | leS : \forall m. le n m \to le n (S m). + +theorem le_inv2: + \forall n,m. + \forall P: nat -> nat -> Prop. + ? -> ? -> le n m -> P n m. +[7: + intros; + inversion H; + [ apply x + | simplify; + apply x1 + ] +| skip +| skip +| skip +| skip +| skip +| skip +] +qed. + +inductive ledx : nat \to nat \to Prop \def + ledxO : \forall n. ledx n n + | ledxS : \forall m.\forall n. ledx n m \to ledx n (S m). + + +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". + +theorem test_inversion: \forall n. le n O \to n=O. + intros. + inversion H. + (* cut n=n \to O=O \to n=O. + apply Hcut; reflexivity. *) + (* elim H. BUG DI UNSHARING *) + (*apply (ledx_ind (\lambda x.\lambda y. n=x \to O=y \to x=y) ? ? ? ? H).*) + simplify. intros. reflexivity. + simplify. intros. destruct H3. +qed. diff --git a/matita/tests/letrec.ma b/matita/tests/letrec.ma new file mode 100644 index 000000000..55933cd31 --- /dev/null +++ b/matita/tests/letrec.ma @@ -0,0 +1,25 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/letrec/". + + +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". + +let rec plus n m \def + match n with + [ O \Rightarrow m + | (S x) \Rightarrow S (plus x m) ]. diff --git a/matita/tests/letrecand.ma b/matita/tests/letrecand.ma new file mode 100644 index 000000000..d9dfec329 --- /dev/null +++ b/matita/tests/letrecand.ma @@ -0,0 +1,74 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/letrecand". + +include "nat/nat.ma". + +let rec pari n : Prop := + match n with + [ O ⇒ True + | S n ⇒ dispari n + ] +and dispari n : Prop := + match n with + [ O => False + | S n => pari n + ]. + +definition pari2 ≝ +let rec pari n : Prop := + match n with + [ O ⇒ True + | S n ⇒ dispari n + ] +and dispari n : Prop := + match n with + [ O => False + | S n => pari n + ] +in pari. + +definition dispari2 ≝ +let rec pari n : Prop := + match n with + [ O ⇒ True + | S n ⇒ dispari n + ] +and dispari n : Prop := + match n with + [ O => False + | S n => pari n + ] +in dispari. + +lemma test_pari: pari (S (S O)). +simplify. +constructor 1. +qed. + +lemma test_pari2: pari2 (S (S O)). +simplify. +constructor 1. +qed. + +lemma test_dispari: dispari (S O). +simplify. +constructor 1. +qed. + +lemma test_dispari2: dispari2 (S O). +simplify. +constructor 1. +qed. diff --git a/matita/tests/makefile b/matita/tests/makefile new file mode 100644 index 000000000..c610118b6 --- /dev/null +++ b/matita/tests/makefile @@ -0,0 +1,37 @@ +H=@ + +RT_BASEDIR=../ +OPTIONS=-bench +MMAKE=$(RT_BASEDIR)matitamake $(OPTIONS) +CLEAN=$(RT_BASEDIR)matitaclean $(OPTIONS) +MMAKEO=$(RT_BASEDIR)matitamake.opt $(OPTIONS) +CLEANO=$(RT_BASEDIR)matitaclean.opt $(OPTIONS) + +devel:=$(shell basename `pwd`) + +ifneq "$(SRC)" "" + XXX=SRC=$(SRC) +endif + +all: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) build $(devel) +clean: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) clean $(devel) +cleanall: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEAN) all + +all.opt opt: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) build $(devel) +clean.opt: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) clean $(devel) +cleanall.opt: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MCLEANO) all + +%.mo: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) $@ +%.mo.opt: preall + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKEO) $(@:.opt=) + +preall: + $(H)$(XXX) MATITA_FLAGS=$(MATITA_FLAGS) $(MMAKE) init $(devel) + diff --git a/matita/tests/match_inference.ma b/matita/tests/match_inference.ma new file mode 100644 index 000000000..0e27ce409 --- /dev/null +++ b/matita/tests/match_inference.ma @@ -0,0 +1,52 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/match_inference/". + +inductive pos: Set \def +| one : pos +| next : pos \to pos. + +inductive nat:Set \def +| O : nat +| S : nat \to nat. + +definition pos2nat : pos \to nat \def + \lambda x:pos . match x with + [ one \Rightarrow O + | (next z) \Rightarrow O]. + +inductive empty (x:nat) : nat \to Set \def . + +definition empty2nat : (empty O O) \to nat \def + \lambda x : (empty O O). S (match x in empty with []). + +inductive le (n:nat) : nat \to Prop \def + | le_n : le n n + | le_S : \forall m:nat. le n m \to le n (S m). + +inductive True : Prop \def + I : True. + +definition r : True \def + match (le_n O) with + [ le_n \Rightarrow I + | (le_S y p') \Rightarrow I ]. + +inductive Prod (A,B:Set): Set \def +pair : A \to B \to Prod A B. + +definition fst : \forall A,B:Set. (Prod A B) \to A \def +\lambda A,B:Set. \lambda p:(Prod A B). match p with +[(pair a b) \Rightarrow a]. diff --git a/matita/tests/metasenv_ordering.ma b/matita/tests/metasenv_ordering.ma new file mode 100644 index 000000000..de9746d52 --- /dev/null +++ b/matita/tests/metasenv_ordering.ma @@ -0,0 +1,139 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/metasenv_ordering". + +include "../legacy/coq.ma". + +alias num (instance 0) = "natural number". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". + +(* REWRITE *) + +theorem th1 : + \forall P:Prop. + \forall H:(\forall G1: Set. \forall G2:Prop. \forall G3 : Type. 1 = 0). + 1 = 1 \land 1 = 0 \land 2 = 2. + intros. split; split; + [ reflexivity + | rewrite > H; + [ reflexivity | exact nat | exact (0=0) | exact Type ] + ] +qed. + +theorem th2 : + \forall P:Prop. + \forall H:(\forall G1: Set. \forall G2:Prop. \forall G3 : Type. 1 = 0). + 1 = 1 \land 1 = 0 \land 3 = 3. + intros. split. split. + focus 13. + rewrite > (H ?); [reflexivity | exact nat | exact (0=0) | exact Type]. + unfocus. + reflexivity. + reflexivity. +qed. + +theorem th3 : + \forall P:Prop. + \forall H:(\forall G1: Set. \forall G2:Prop. \forall G3 : Type. 1 = 0). + 1 = 1 \land 1 = 0 \land 4 = 4. + intros. split. split. + focus 13. + rewrite > (H ? ?); [reflexivity | exact nat | exact (0=0) | exact Type]. + unfocus. + reflexivity. + reflexivity. +qed. + +theorem th4 : + \forall P:Prop. + \forall H:(\forall G1: Set. \forall G2:Prop. \forall G3 : Type. 1 = 0). + 1 = 1 \land 1 = 0 \land 5 = 5. + intros. split. split. + focus 13. + rewrite > (H ? ? ?); [reflexivity | exact nat | exact (0=0) | exact Type]. + unfocus. + reflexivity. + reflexivity. +qed. + +(* APPLY *) + +theorem th5 : + \forall P:Prop. + \forall H:(\forall G1: Set. \forall G2:Prop. \forall G3 : Type. 1 = 0). + 1 = 1 \land 1 = 0 \land 6 = 6. + intros. split. split. + focus 13. + apply H; [exact nat | exact (0=0) | exact Type]. + unfocus. + reflexivity. + reflexivity. +qed. + +theorem th6 : + \forall P:Prop. + \forall H:(\forall G1: Set. \forall G2:Prop. \forall G3 : Type. 1 = 0). + 1 = 1 \land 1 = 0 \land 7 = 7. + intros. split. split. + focus 13. + apply (H ?); [exact nat | exact (0=0) | exact Type]. + unfocus. + reflexivity. + reflexivity. +qed. + +theorem th7 : + \forall P:Prop. + \forall H:(\forall G1: Set. \forall G2:Prop. \forall G3 : Type. 1 = 0). + 1 = 1 \land 1 = 0 \land 8 = 8. + intros. split. split. + focus 13. + apply (H ? ?); [exact nat | exact (0=0) | exact Type]. + unfocus. + reflexivity. + reflexivity. +qed. + +theorem th8 : + \forall P:Prop. + \forall H:(\forall G1: Set. \forall G2:Prop. \forall G3 : Type. 1 = 0). + 1 = 1 \land 1 = 0 \land 9 = 9. + intros. split. split. + focus 13. + apply (H ? ? ?); [exact nat | exact (0=0) | exact Type]. + unfocus. + reflexivity. + reflexivity. +qed. + +(* ELIM *) + +theorem th9: + \forall P,Q,R,S : Prop. R \to S \to \forall E:(R \to S \to P \land Q). P \land Q. + intros (P Q R S r s H). + elim (H ? ?); [split; assumption | exact r | exact s]. + qed. + +theorem th10: + \forall P,Q,R,S : Prop. R \to S \to \forall E:(R \to S \to P \land Q). P \land Q. + intros (P Q R S r s H). + elim (H ?); [split; assumption | exact r | exact s]. + qed. + +theorem th11: + \forall P,Q,R,S : Prop. R \to S \to \forall E:(R \to S \to P \land Q). P \land Q. + intros (P Q R S r s H). + elim H; [split; assumption | exact r | exact s]. + qed. diff --git a/matita/tests/multiple_inheritance.ma b/matita/tests/multiple_inheritance.ma new file mode 100644 index 000000000..df15e704f --- /dev/null +++ b/matita/tests/multiple_inheritance.ma @@ -0,0 +1,58 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/". + +include "logic/equality.ma". + +record R1 : Type := { C:> Type; plus: C \to C \to C}. +record R2 : Type := { K:> Type; mult: K \to K \to K}. + +(* Missing syntactic sugar: + record R : Type := { r1 :> R1; r2 :> R2 with C r1 = K r2} +*) +record R : Type := { r1 :> R1; r2_ : R2; with_: C r1 = K r2_ }. + +(* This can be done automatically *) +lemma r2 : R → R2. + intro; + apply mk_R2; + [ exact (C r) + | rewrite > (with_ r); exact (mult (r2_ r))] +qed. +coercion cic:/matita/test/r2.con. + +(* convertibility test *) +lemma conv_test : ∀r:R.C r -> K r. + intros. + change with (C (r1 r)). + change with (K (r2 r)). + change with (C (r1 r)). + assumption. +qed. + +(* Let's play with it *) +definition f ≝ λr:R.λx:r.plus ? (mult ? x x) x. + +axiom plus_idempotent: ∀r1:R1.∀x:r1. plus ? x x = x. +axiom mult_idempotent: ∀r2:R2.∀x:r2. mult ? x x = x. + +lemma test: ∀r:R. ∀x:r. f ? x = x. + intros; + unfold f; + autobatch paramodulation. +qed. + + + diff --git a/matita/tests/mysql_escaping.ma b/matita/tests/mysql_escaping.ma new file mode 100644 index 000000000..bd0eb8d5a --- /dev/null +++ b/matita/tests/mysql_escaping.ma @@ -0,0 +1,17 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/mysql_escaping/". + +theorem a' : Prop \to Prop.intros.assumption.qed. diff --git a/matita/tests/naiveparamod.ma b/matita/tests/naiveparamod.ma new file mode 100644 index 000000000..624604842 --- /dev/null +++ b/matita/tests/naiveparamod.ma @@ -0,0 +1,47 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/naiveparamod". + +include "logic/equality.ma". + +inductive TT : Prop \def II:TT. + +theorem prova1: + \forall A,B,C:Prop. + \forall S:Set. + \forall a:B -> A. + \forall w:B \to Prop. + \forall h:(A -> \forall x:B. w x -> TT -> C). + \forall b:B. + \forall s:S. + \forall wb:w b. (* ASK ANDREA: what if b1 *) + C. + intros (A B C S a w h b wb). + (* exact (h s (a b) b wb II). *) + autobatch width = 5 depth = 3. (* look at h parameters! *) + qed. + +(* c'e' qualcosa di imperativo, se si cambia l'rdine delle ipotesi poi sclera *) +theorem prova2: + \forall A,B,C:Prop. (* SE METTO SET NON VA *) + \forall a:B -> A. + \forall h:A -> B -> A = B. + (* \forall h:A -> C -> A = B. *) + \forall b:B. + A=B. + intros. + autobatch paramodulation. + try assumption. + qed. \ No newline at end of file diff --git a/matita/tests/overred.ma b/matita/tests/overred.ma new file mode 100644 index 000000000..2034001bd --- /dev/null +++ b/matita/tests/overred.ma @@ -0,0 +1,33 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/overred/". + +include "logic/equality.ma". + +axiom T1 : Type. +axiom X : Type. +axiom x : X. +definition T2 : Type := T1. +definition T3 : Type := T2. +axiom t3 : T3. +axiom c : T2 -> X -> X. + +coercion cic:/matita/test/overred/c.con 1. + +axiom daemon : c t3 x = x. + +theorem find_a_coercion_from_T2_for_a_term_in_T3 : (* c *) t3 x = x. +apply daemon. +qed. \ No newline at end of file diff --git a/matita/tests/paramodulation.ma b/matita/tests/paramodulation.ma new file mode 100644 index 000000000..2d090e1b0 --- /dev/null +++ b/matita/tests/paramodulation.ma @@ -0,0 +1,32 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/paramodulation". +include "../legacy/coq.ma". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "plus" (instance 0) = "Coq's natural plus". +alias num (instance 0) = "Coq natural number". +alias symbol "times" (instance 0) = "Coq's natural times". + +theorem para1: + \forall n,m,n1,m1:nat. + n=m \to n1 = m1 \to (n + n1) = (m + m1). +intros. autobatch paramodulation. +qed. + +theorem para2: + \forall n:nat. n + n = 2 * n. +intros. autobatch paramodulation. +qed. diff --git a/matita/tests/paramodulation/BOO075-1.ma b/matita/tests/paramodulation/BOO075-1.ma new file mode 100644 index 000000000..7c46167f4 --- /dev/null +++ b/matita/tests/paramodulation/BOO075-1.ma @@ -0,0 +1,101 @@ +set "baseuri" "cic:/matita/TPTP/BOO075-1". + +inductive eq (A:Type) (x:A) : A \to Prop \def refl_eq : eq A x x. + +theorem sym_eq : \forall A:Type.\forall x,y:A. eq A x y \to eq A y x. +intros.elim H. apply refl_eq. +qed. + +theorem eq_elim_r: + \forall A:Type.\forall x:A. \forall P: A \to Prop. + P x \to \forall y:A. eq A y x \to P y. +intros. elim (sym_eq ? ? ? H1).assumption. +qed. + +theorem eq_elim_r': + \forall A:Type.\forall x:A. \forall P: A \to Set. + P x \to \forall y:A. eq A y x \to P y. +intros. elim (sym_eq ? ? ? H).assumption. +qed. + +theorem eq_elim_r'': + \forall A:Type.\forall x:A. \forall P: A \to Type. + P x \to \forall y:A. eq A y x \to P y. +intros. elim (sym_eq ? ? ? H).assumption. +qed. + +theorem trans_eq : + \forall A:Type.\forall x,y,z:A. eq A x y \to eq A y z \to eq A x z. +intros.elim H1.assumption. +qed. + +default "equality" + cic:/matita/TPTP/BOO075-1/eq.ind + cic:/matita/TPTP/BOO075-1/sym_eq.con + cic:/matita/TPTP/BOO075-1/trans_eq.con + cic:/matita/TPTP/BOO075-1/eq_ind.con + cic:/matita/TPTP/BOO075-1/eq_elim_r.con + cic:/matita/TPTP/BOO075-1/eq_rec.con + cic:/matita/TPTP/BOO075-1/eq_elim_r'.con + cic:/matita/TPTP/BOO075-1/eq_rect.con + cic:/matita/TPTP/BOO075-1/eq_elim_r''.con + cic:/matita/TPTP/BOO075-1/eq_f.con + cic:/matita/TPTP/BOO075-1/eq_f1.con. + +theorem eq_f: \forall A,B:Type.\forall f:A\to B. + \forall x,y:A. eq A x y \to eq B (f x) (f y). +intros.elim H.reflexivity. +qed. + +theorem eq_f1: \forall A,B:Type.\forall f:A\to B. + \forall x,y:A. eq A x y \to eq B (f y) (f x). +intros.elim H.reflexivity. +qed. + +inductive ex (A:Type) (P:A \to Prop) : Prop \def + ex_intro: \forall x:A. P x \to ex A P. +interpretation "exists" 'exists \eta.x = + (cic:/matita/TPTP/BOO075-1/ex.ind#xpointer(1/1) _ x). + +notation < "hvbox(\exists ident i opt (: ty) break . p)" + right associative with precedence 20 +for @{ 'exists ${default + @{\lambda ${ident i} : $ty. $p)} + @{\lambda ${ident i} . $p}}}. + + +(* Inclusion of: BOO075-1.p *) +(* -------------------------------------------------------------------------- *) +(* File : BOO075-1 : TPTP v3.1.1. Released v2.6.0. *) +(* Domain : Boolean Algebra *) +(* Problem : Sh-1 is a single axiom for Boolean algebra, part 1 *) +(* Version : [EF+02] axioms. *) +(* English : *) +(* Refs : [EF+02] Ernst et al. (2002), More First-order Test Problems in *) +(* : [MV+02] McCune et al. (2002), Short Single Axioms for Boolean *) +(* Source : [TPTP] *) +(* Names : *) +(* Status : Unsatisfiable *) +(* Rating : 0.00 v2.6.0 *) +(* Syntax : Number of clauses : 2 ( 0 non-Horn; 2 unit; 1 RR) *) +(* Number of atoms : 2 ( 2 equality) *) +(* Maximal clause size : 1 ( 1 average) *) +(* Number of predicates : 1 ( 0 propositional; 2-2 arity) *) +(* Number of functors : 3 ( 2 constant; 0-2 arity) *) +(* Number of variables : 3 ( 1 singleton) *) +(* Maximal term depth : 5 ( 2 average) *) +(* Comments : A UEQ part of BOO039-1 *) +(* -------------------------------------------------------------------------- *) +theorem prove_meredith_2_basis_1: + \forall Univ:Set. +\forall a:Univ. +\forall b:Univ. +\forall nand:Univ\rarr Univ\rarr Univ. +\forall H0:\forall A:Univ.\forall B:Univ.\forall C:Univ.eq Univ (nand (nand A (nand (nand B A) A)) (nand B (nand C A))) B.eq Univ (nand (nand a a) (nand b a)) a +. +intros. +autobatch paramodulation timeout=600; +try assumption. +print proofterm. +qed. +(* -------------------------------------------------------------------------- *) diff --git a/matita/tests/paramodulation/boolean_algebra.ma b/matita/tests/paramodulation/boolean_algebra.ma new file mode 100644 index 000000000..ab47854da --- /dev/null +++ b/matita/tests/paramodulation/boolean_algebra.ma @@ -0,0 +1,520 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/SK/". + +include "../legacy/coq.ma". + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "eq" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)". +alias id "eq_ind" = "cic:/Coq/Init/Logic/eq_ind.con". +alias id "eq_ind_r" = "cic:/Coq/Init/Logic/eq_ind_r.con". +alias id "sym_eq" = "cic:/Coq/Init/Logic/sym_eq.con". + +definition bool_algebra \def + \lambda A:Set. + \lambda one:A. + \lambda zero:A. + \lambda add: A \to A \to A. + \lambda mult: A \to A \to A. + \lambda inv: A \to A. + (\forall x:A. (add x (inv x)) = one)\land + (\forall x:A. (mult x (inv x)) = zero)\land + (\forall x:A. (mult x one) = x)\land + (\forall x:A. (add x zero) = x)\land + (\forall x,y,z:A.(mult x (add y z)) = (add (mult x y) (mult x z)))\land + (\forall x,y,z:A.(add x (mult y z)) = (mult (add x y) (add x z)))\land + (\forall x,y:A.(mult x y) = (mult y x))\land + (\forall x,y:A.(add x y) = (add y x)). + +(* +theorem SKK: + \forall A:Set. + \forall app: A \to A \to A. + \forall K:A. + \forall S:A. + \forall H1: (\forall x,y:A.(app (app K x) y) = x). + \forall H2: (\forall x,y,z:A. + (app (app (app S x) y) z) = (app (app x z) (app y z))). + \forall x:A. + (app (app (app S K) K) x) = x. +intros.auto paramodulation. +qed. +*) +(* +theorem bool1: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + (inv zero) = one. +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool2: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x:A. (mult x zero) = zero. +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool3: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x:A. (inv (inv x)) = x. +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool266: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. (mult x (add (inv x) y)) = (mult x y). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool507: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. zero = (mult x (mult (inv x) y)). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool515: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. zero = mult (inv x) (mult x y). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool304: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. x = (mult (add y x) x). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool531: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. zero = (mult (inv (add x y)) y). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool253: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. (add (inv x) (mult y x)) = (add (inv x) y). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool557: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. + inv x = (add (inv x) (inv (add y x))). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool609: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. + inv x = (add (inv (add y x)) (inv x)). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool260: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y,z:A. + add x (mult x y) = mult x (add x y). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool276: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y,z,u:A. + (mult (add x y) (add z (add x u))) = (add (mult (add x y) z) (add x (mult y u))). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool250: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y,z:A. + add x (mult y z) = mult (add y x) (add x z). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool756minimal: + \forall A:Set. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall hint1: (\forall x,y,z,u:A. + add y (add x (mult x u)) = (add (mult (add x y) z) (add x (mult y u)))). + \forall hint2: (\forall x,y:A. x = (mult (add y x) x)). + \forall x,y,z:A. + add x (add y (mult y z)) = add x (add y (mult x z)). +intros. +auto paramodulation. +qed. +*) +(* +theorem bool756simplified: + \forall A:Set. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall hint1: (\forall x,y,z,u:A. + (mult (add x y) (add z (add x u))) = (add (mult (add x y) z) (add x (mult y u)))). + \forall hint2: (\forall x,y:A. x = (mult (add y x) x)). + \forall hint3: (\forall x,y,z:A. + add x (mult y z) = mult (add y x) (add x z)). + \forall hint4: (\forall x,y:A. + add x (mult x y) = mult x (add x y)). + \forall x,y,z:A. + add x (add y (mult y z)) = add x (add y (mult x z)). +intros. +auto paramodulation. +qed. +*) +(* +theorem bool756: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall hint1: (\forall x,y,z,u:A. + (mult (add x y) (add z (add x u))) = (add (mult (add x y) z) (add x (mult y u)))). + \forall hint2: (\forall x,y:A. x = (mult (add y x) x)). + \forall hint3: (\forall x,y,z:A. + add x (mult y z) = mult (add y x) (add x z)). + \forall hint4: (\forall x,y:A. + add x (mult x y) = mult x (add x y)). + \forall x,y,z:A. + add x y = add x (add y (mult x z)). +intros; +cut (mult (add y x) (add x (add y z)) = add x (add y (mult x z))); +[auto paramodulation +|auto paramodulation] +qed. +*) +(* +theorem bool756full: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y,z:A. + add x y = add x (add y (mult x z)). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool1164: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y,z:A. + (add x y) = (add (add x (mult y z)) y). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool1230: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall x,y,z:A. + \forall c1z: (\forall x:A.(add x z) = (add z x)). + add (add x y) z = add (add x y) (add z y). +intros. +auto paramodulation. +qed. +*) +(* +theorem bool1230: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y,z:A. + add (add x y) z = add (add x y) (add z y). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool1372: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y,z:A. + add x (add y z) = add (add x z) y. +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool381: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. + add (inv x) y = add (mult x y) (inv x). +intros. +unfold bool_algebra in H. +decompose +auto paramodulation. +qed. +*) +(* +theorem bool5hint1: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall hint1731:(\forall x,y:A. add (inv (add x y)) y = add y (inv x)). + \forall hint1735:(\forall x,y:A. add (inv (add x y)) x = add x (inv y)). + \forall hint623:(\forall x,y:A. inv (mult x y) = add (inv x) (inv (mult x y))). + \forall x,y:A. + (inv (mult x y)) = (add (inv x) (inv y)). +intros. +auto paramodulation. +qed. +*) +(* +theorem bool5hint2: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall hint1731:(\forall x,y:A. add (inv (add x y)) y = add y (inv x)). + \forall hint623:(\forall x,y:A. inv (mult x y) = add (inv x) (inv (mult x y))). + \forall x,y:A. + (inv (mult x y)) = (add (inv x) (inv y)). +intros. +auto paramodulation. +qed. +*) +(* +theorem bool5hint3: + \forall A:Set. + \forall one:A. + \forall zero:A. + \forall add: A \to A \to A. + \forall mult: A \to A \to A. + \forall inv: A \to A. + \forall c1:(\forall x,y:A.(add x y) = (add y x)). + \forall c2:(\forall x,y:A.(mult x y) = (mult y x)). + \forall d1: (\forall x,y,z:A. + (add x (mult y z)) = (mult (add x y) (add x z))). + \forall d2: (\forall x,y,z:A. + (mult x (add y z)) = (add (mult x y) (mult x z))). + \forall i1: (\forall x:A. (add x zero) = x). + \forall i2: (\forall x:A. (mult x one) = x). + \forall inv1: (\forall x:A. (add x (inv x)) = one). + \forall inv2: (\forall x:A. (mult x (inv x)) = zero). + \forall hint1731:(\forall x,y:A. add (inv (add x y)) y = add y (inv x)). + \forall hint609:(\forall x,y:A. inv x = add (inv (add y x)) (inv x)). + \forall x,y:A. + (inv (mult x y)) = (add (inv x) (inv y)). +intros. +auto paramodulation. +qed. +*) +theorem bool5: + \forall A: Set. + \forall one,zero: A. + \forall add,mult: A \to A \to A. + \forall inv: A \to A. + \forall H: bool_algebra A one zero add mult inv. + \forall x,y:A. + (inv (mult x y)) = (add (inv x) (inv y)). +intros. +unfold bool_algebra in H. +decompose. +autobatch paramodulation timeout=120. +qed. diff --git a/matita/tests/paramodulation/group.ma b/matita/tests/paramodulation/group.ma new file mode 100644 index 000000000..621e2d449 --- /dev/null +++ b/matita/tests/paramodulation/group.ma @@ -0,0 +1,51 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/paramodulation/group". + +include "../legacy/coq.ma". + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "eq" = "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1)". +alias id "eq_ind" = "cic:/Coq/Init/Logic/eq_ind.con". +alias id "eq_ind_r" = "cic:/Coq/Init/Logic/eq_ind_r.con". +alias id "sym_eq" = "cic:/Coq/Init/Logic/sym_eq.con". + + +theorem self: + \forall A:Set. + \forall f,g:A \to A. + \forall H:(\forall x,y:A. x = y). + \forall H:(\forall x,y,z:A. f x = y). + \forall x,y:A. x=y. +intros.autobatch paramodulation. +qed. + +theorem GRP049_simple: + \forall A:Set. + \forall inv: A \to A. + \forall mult: A \to A \to A. + \forall H: (\forall x,y,z:A.mult z (inv (mult (inv (mult (inv (mult z y)) x)) (inv (mult y (mult (inv y) y))))) = x). + \forall a,b:A. mult (inv a) a = mult (inv b) b. +intros.autobatch paramodulation; exact a. +qed. + +theorem GRP049 : + \forall A:Set. + \forall inv: A \to A. + \forall mult: A \to A \to A. + \forall H: (\forall x,y,z:A.mult z (inv (mult (inv (mult (inv (mult z y)) x)) (inv (mult y (mult (inv y) y))))) = x). + \forall a,b:A. mult a (inv a)= mult b (inv b). +intros.autobatch paramodulation timeout = 600;exact a. +qed. diff --git a/matita/tests/paramodulation/irratsqrt2.ma b/matita/tests/paramodulation/irratsqrt2.ma new file mode 100644 index 000000000..5c976bcb9 --- /dev/null +++ b/matita/tests/paramodulation/irratsqrt2.ma @@ -0,0 +1,160 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| A.Asperti, C.Sacerdoti Coen, *) +(* ||A|| E.Tassi, S.Zacchiroli *) +(* \ / *) +(* \ / Matita is distributed under the terms of the *) +(* v GNU Lesser General Public License Version 2.1 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/paramodulation/irratsqrt2/". + +include "nat/times.ma". +include "nat/minus.ma". + +theorem prova : + \forall n,m:nat. + \forall P:nat \to Prop. + \forall H:P (S (S O)). + \forall H:P (S (S (S O))). + \forall H1: \forall x.P x \to O = x. + O = S (S (S (S (S O)))). + intros. + autobatch. + qed. + +theorem example2: +\forall x: nat. (x+S O)*(x-S O) = x*x - S O. +intro; +apply (nat_case x); + [ autobatch timeout = 1.|intro.autobatch timeout = 1.] +qed. + +theorem irratsqrt2_byhand: + \forall A:Set. + \forall m:A \to A \to A. + \forall divides: A \to A \to Prop. + \forall o,a,b,two:A. + \forall H1:\forall x.m o x = x. + \forall H1:\forall x.m x o = x. + \forall H1:\forall x,y,z.m x (m y z) = m (m x y) z. + \forall H1:\forall x.m x o = x. + \forall H2:\forall x,y.m x y = m y x. + \forall H3:\forall x,y,z. m x y = m x z \to y = z. + (* \forall H4:\forall x,y.(\exists z.m x z = y) \to divides x y. *) + \forall H4:\forall x,y.(divides x y \to (\exists z.m x z = y)). + \forall H4:\forall x,y,z.m x z = y \to divides x y. + \forall H4:\forall x,y.divides two (m x y) \to divides two x ∨ divides two y. + \forall H5:m a a = m two (m b b). + \forall H6:\forall x.divides x a \to divides x b \to x = o. + two = o. + intros. + cut (divides two a); + [2:elim (H8 a a);[assumption.|assumption|rewrite > H9.autobatch.] + |elim (H6 ? ? Hcut). + cut (divides two b); + [ apply (H10 ? Hcut Hcut1). + | elim (H8 b b);[assumption.|assumption| + apply (H7 ? ? (m a1 a1)); + apply (H5 two ? ?);rewrite < H9. + rewrite < H11.rewrite < H2. + apply eq_f.rewrite > H2.rewrite > H4.reflexivity. + ] + ] + ] +qed. + +theorem irratsqrt2_byhand': + \forall A:Set. + \forall m,f:A \to A \to A. + \forall divides: A \to A \to Prop. + \forall o,a,b,two:A. + \forall H1:\forall x.m o x = x. + \forall H1:\forall x.m x o = x. + \forall H1:\forall x,y,z.m x (m y z) = m (m x y) z. + \forall H1:\forall x.m x o = x. + \forall H2:\forall x,y.m x y = m y x. + \forall H3:\forall x,y,z. m x y = m x z \to y = z. + (* \forall H4:\forall x,y.(\exists z.m x z = y) \to divides x y. *) + \forall H4:\forall x,y.(divides x y \to m x (f x y) = y). + \forall H4:\forall x,y,z.m x z = y \to divides x y. + \forall H4:\forall x,y.divides two (m x y) \to divides two x ∨ divides two y. + \forall H5:m a a = m two (m b b). + \forall H6:\forall x.divides x a \to divides x b \to x = o. + two = o. + intros. + cut (divides two a); + [2:elim (H8 a a);[assumption.|assumption|rewrite > H9.autobatch.] + |(*elim (H6 ? ? Hcut). *) + cut (divides two b); + [ apply (H10 ? Hcut Hcut1). + | elim (H8 b b);[assumption.|assumption| + + apply (H7 ? ? (m (f two a) (f two a))); + apply (H5 two ? ?); + rewrite < H9. + rewrite < (H6 two a Hcut) in \vdash (? ? ? %). + rewrite < H2.apply eq_f. + rewrite < H4 in \vdash (? ? ? %). + rewrite > H2.reflexivity. + ] + ] + ] +qed. + +theorem irratsqrt2: + \forall A:Set. + \forall m,f:A \to A \to A. + \forall divides: A \to A \to Prop. + \forall o,a,b,two:A. + \forall H1:\forall x.m o x = x. + \forall H1:\forall x.m x o = x. + \forall H1:\forall x,y,z.m x (m y z) = m (m x y) z. + \forall H1:\forall x.m x o = x. + \forall H2:\forall x,y.m x y = m y x. + \forall H3:\forall x,y,z. m x y = m x z \to y = z. + (* \forall H4:\forall x,y.(\exists z.m x z = y) \to divides x y. *) + \forall H4:\forall x,y.(divides x y \to m x (f x y) = y). + \forall H4:\forall x,y,z.m x z = y \to divides x y. + \forall H4:\forall x.divides two (m x x) \to divides two x. + \forall H5:m a a = m two (m b b). + \forall H6:\forall x.divides x a \to divides x b \to x = o. + two = o. +intros. +autobatch depth = 5 timeout = 180. +qed. + +(* time: 146s *) + + +(* intermediate attempts + + cut (divides two a);[| + (* apply H8;apply (H7 two (m a a) (m b b));symmetry;assumption. *) + autobatch depth = 4 width = 3 use_paramod = false. ] + (*autobatch depth = 5.*) + + apply H10; + [ assumption. + |(*autobatch depth = 4.*) apply H8; + (*autobatch.*) + apply (H7 ? ? (m (f two a) (f two a))); + apply (H5 two ? ?); + cut ((\lambda x:A.m x (m two ?)=m x (m b b))?); + [|||simplify; + autobatch paramodulation. + (*autobatch new.*) + rewrite < H9. + rewrite < (H6 two a Hcut) in \vdash (? ? ? %). + rewrite < H2.apply eq_f. + rewrite < H4 in \vdash (? ? ? %). + rewrite > H2.reflexivity. + ] + +qed. +*) diff --git a/matita/tests/pullback.ma b/matita/tests/pullback.ma new file mode 100644 index 000000000..935a90dcf --- /dev/null +++ b/matita/tests/pullback.ma @@ -0,0 +1,42 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/pullback". + +inductive T : Type \def t : T. +inductive L : Type \def l : L. +inductive R : Type \def r : R. +inductive R1 : Type \def r1 : R1. +inductive P1 : Type \def p1 : P1. +inductive P2 : Type \def p2 : P2. + +definition L_to_T : L \to T \def \lambda x.t. +definition R_to_T : R \to T \def \lambda x.t. +definition P1_to_L : P1 \to L \def \lambda x.l. +definition P1_to_R1 : P1 \to R1 \def \lambda x.r1. +definition R1_to_P2 : R1 \to P2 \def \lambda x.p2. +definition R1_to_R : R1 \to R \def \lambda x.r. +definition P2_to_L : P2 \to L \def \lambda x.l. +definition P2_to_R : P2 \to R \def \lambda x.r. +definition P1_to_P1 : P1 \to P1 \def \lambda x.p1. + +coercion cic:/matita/tests/pullback/L_to_T.con. +coercion cic:/matita/tests/pullback/R_to_T.con. +coercion cic:/matita/tests/pullback/P1_to_L.con. +coercion cic:/matita/tests/pullback/P1_to_R1.con. +coercion cic:/matita/tests/pullback/R1_to_R.con. +coercion cic:/matita/tests/pullback/R1_to_P2.con. +coercion cic:/matita/tests/pullback/P2_to_L.con. +coercion cic:/matita/tests/pullback/P2_to_R.con. +coercion cic:/matita/tests/pullback/P1_to_P1.con. diff --git a/matita/tests/record.ma b/matita/tests/record.ma new file mode 100644 index 000000000..bc5d2e217 --- /dev/null +++ b/matita/tests/record.ma @@ -0,0 +1,44 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/record/". + +record empty : Type \def {}. + +inductive True : Prop \def I: True. + +record pippo : Type \def +{ +a: Set ; +b: a \to Prop; +c: \forall x:a.(b x) \to a \to Type +}. + +record pluto (A, B:Set) : Type \def { +d: A \to B \to Prop; +e: \forall y:A.\forall z:B. (d y z) \to A \to B; +mario: \forall y:A.\forall z:B. \forall h:(d y z). \forall i : B \to Prop. + i (e y z h y) +}. + +record paperino: Prop \def { + paolo : Type; + pippo : paolo \to paolo; + piero : True +}. + +(* the following test used to show the following bug: the left + parameter A in the type of t was not unified with the left + parameter A in the type of the constructor of the record *) +record t (A:Type) : Type := { f : A }. \ No newline at end of file diff --git a/matita/tests/replace.ma b/matita/tests/replace.ma new file mode 100644 index 000000000..2961fdc7e --- /dev/null +++ b/matita/tests/replace.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/replace/". +include "../legacy/coq.ma". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias num (instance 0) = "Coq natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "plus" (instance 0) = "Coq's natural plus". +alias symbol "times" (instance 0) = "Coq's natural times". +alias id "mult_n_O" = "cic:/Coq/Init/Peano/mult_n_O.con". +alias id "plus_n_O" = "cic:/Coq/Init/Peano/plus_n_O.con". + +theorem t: \forall x:nat. x * (x + 0) = (0 + x) * (x + x * 0). + intro. + replace in \vdash (? ? (? ? %) (? % %)) with x. + reflexivity. + rewrite < (mult_n_O x). + rewrite < (plus_n_O x). + reflexivity. + reflexivity. + autobatch library. +qed. + +(* This test tests "replace in match t" where t contains some metavariables *) +theorem t2: 2 + (3 * 4) = (5 + 5) + 2 * 2. + replace in match (5+?) with (6 + 4); [reflexivity | reflexivity]. +qed. diff --git a/matita/tests/rewrite.ma b/matita/tests/rewrite.ma new file mode 100644 index 000000000..dff3b2300 --- /dev/null +++ b/matita/tests/rewrite.ma @@ -0,0 +1,71 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/rewrite/". +include "../legacy/coq.ma". + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias num (instance 0) = "Coq natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias symbol "plus" (instance 0) = "Coq's natural plus". +alias id "plus_n_O" = "cic:/Coq/Init/Peano/plus_n_O.con". + +theorem a: + \forall a,b:nat. + a = b \to b + a + b + a= (\lambda j.((\lambda w.((\lambda x.x + b + w + j) a)) b)) a. +intros. +rewrite < H in \vdash (? ? ? ((\lambda j.((\lambda w.%) ?)) ?)). + +rewrite < H in \vdash (? ? % ?). + +simplify in \vdash (? ? ? ((\lambda _.((\lambda _.%) ?)) ?)). + +rewrite < H in \vdash (? ? ? (% ?)). +simplify. +reflexivity. +qed. + +theorem t: \forall n. 0=0 \to n = n + 0. + intros. + apply plus_n_O. +qed. + +(* In this test "rewrite < t" should open a new goal 0=0 and put it in *) +(* the goallist so that the THEN tactical closes it using reflexivity. *) +theorem foo: \forall n. n = n + 0. + intros. + rewrite < t; reflexivity. +qed. + +theorem test_rewrite_in_hyp: + \forall n,m. n + 0 = m \to m = n + 0 \to n=m \land m+0=n+0. + intros. + rewrite < plus_n_O in H. + rewrite > plus_n_O in H1. + split; [ exact H | exact H1]. +qed. + +theorem test_rewrite_in_hyp2: + \forall n,m. n + 0 = m \to n + 0 = m \to n=m \land n+0=m. + intros. + rewrite < plus_n_O in H H1 \vdash (? ? %). + split; [ exact H | exact H1]. +qed. + +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". +theorem test_rewrite_under_pi: \forall x,y. x = O \to y = O \to x = x \to O = x. +intros 3. +rewrite > H in \vdash (? \to ? ? % % \to ? ? ? %). +intros. reflexivity. +qed. diff --git a/matita/tests/second.ma b/matita/tests/second.ma new file mode 100644 index 000000000..450c67671 --- /dev/null +++ b/matita/tests/second.ma @@ -0,0 +1,24 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/second/". +alias id "nat" = "cic:/matita/tests/first/nat.ind#xpointer(1/1)". +alias id "O" = "cic:/matita/tests/first/nat.ind#xpointer(1/1/1)". +alias id "eq" = "cic:/matita/tests/first/eq.ind#xpointer(1/1)". +alias id "refl" = "cic:/matita/tests/first/eq.ind#xpointer(1/1/1)". + +theorem ultrastupid : eq nat O O. +apply refl. +qed. + diff --git a/matita/tests/simpl.ma b/matita/tests/simpl.ma new file mode 100644 index 000000000..61150e817 --- /dev/null +++ b/matita/tests/simpl.ma @@ -0,0 +1,39 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/simpl/". +include "../legacy/coq.ma". + +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +alias id "plus" = "cic:/Coq/Init/Peano/plus.con". +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". +alias id "not" = "cic:/Coq/Init/Logic/not.con". +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias id "plus_comm" = "cic:/Coq/Arith/Plus/plus_comm.con". + +theorem t: let f \def \lambda x,y. x y in f (\lambda x.S x) O = S O. + intros. simplify. change in \vdash (? ? (? ? %) ?) with O. + reflexivity. qed. + +theorem X: \forall x:nat. let myplus \def plus x in myplus (S O) = S x. + intros. simplify. change in \vdash (? ? (% ?) ?) with (plus x). + +rewrite > plus_comm. reflexivity. qed. + +theorem R: \forall x:nat. let uno \def x + O in S O + uno = 1 + x. + intros. simplify. + change in \vdash (? ? (? %) ?) with (x + O). + rewrite > plus_comm. reflexivity. qed. + diff --git a/matita/tests/tacticals.ma b/matita/tests/tacticals.ma new file mode 100644 index 000000000..a44e80a86 --- /dev/null +++ b/matita/tests/tacticals.ma @@ -0,0 +1,50 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/test/tacticals". + +inductive myand (A, B: Prop) : Prop \def + | myconj : ∀a:A.∀b:B. myand A B. + +lemma prova: + ∀A,B,C,D:Prop.∀a:A.∀b:B.∀c:C.∀d:D.myand (myand A B) (myand C D). + intros; try (apply myconj); try assumption; try (apply myconj); + try assumption. +qed. + +lemma prova2: + ∀A,B,C,D:Prop.∀a:A.∀b:B.∀c:C.∀d:D.myand (myand A B) (myand C D). + intros; progress (apply myconj; apply myconj); + solve [assumption]. +qed. + +lemma prova3: + ∀A,B,C,D:Prop.∀a:A.∀b:B.∀c:C.∀d:D.myand (myand A B) (myand C D). + intros; repeat first [ assumption | apply myconj]. +qed. + +lemma prova4: + ∀A,B,C,D:Prop.∀a:A.∀b:B.∀c:C.∀d:D.myand (myand A B) (myand C D). + intros; + repeat apply myconj; + assumption. +qed. + +lemma prova6: + ∀A,B,C,D:Prop.∀a:A.∀b:B.∀c:C.∀d:D.myand (myand A B) (myand C D). + intros; apply myconj; + [1:repeat (constructor 1; try assumption) + |2:repeat (constructor 1; try assumption) + ] +qed. \ No newline at end of file diff --git a/matita/tests/test2.ma b/matita/tests/test2.ma new file mode 100644 index 000000000..93da2ecce --- /dev/null +++ b/matita/tests/test2.ma @@ -0,0 +1,26 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/test2/". +include "../legacy/coq.ma". + +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +alias symbol "and" (instance 0) = "Coq's logical and". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +theorem a:\forall x:nat.x=x\land x=x. +intro. +split. +reflexivity. +reflexivity. +qed. diff --git a/matita/tests/test3.ma b/matita/tests/test3.ma new file mode 100644 index 000000000..85180da5b --- /dev/null +++ b/matita/tests/test3.ma @@ -0,0 +1,31 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/test3/". +include "../legacy/coq.ma". + +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +theorem a:\forall x.x=x. +alias id "nat" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1)". +[ exact nat. +| intro. reflexivity. +] +qed. +alias num (instance 0) = "natural number". +alias symbol "times" (instance 0) = "Coq's natural times". + +theorem b:\forall p:nat. p * 0=0. +intro. +autobatch library. +qed. diff --git a/matita/tests/test4.ma b/matita/tests/test4.ma new file mode 100644 index 000000000..55cfb6aaf --- /dev/null +++ b/matita/tests/test4.ma @@ -0,0 +1,38 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/test4/". +include "../legacy/coq.ma". + + +(* commento che va nell'ast, ma non viene contato + come step perche' non e' un executable +*) + +alias num (instance 0) = "natural number". +alias symbol "eq" (instance 0) = "Coq's leibnitz's equality". +theorem a:0=0. + +(* nota *) +(** + + +apply Prop. +*) +apply cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1). + +(* commenti che non devono essere colorati perche' + non c'e' nulla di eseguibile dopo di loro +*) +qed. diff --git a/matita/tests/third.ma b/matita/tests/third.ma new file mode 100644 index 000000000..124cdc121 --- /dev/null +++ b/matita/tests/third.ma @@ -0,0 +1,24 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/third/". +alias id "nat" = "cic:/matita/tests/first/nat.ind#xpointer(1/1)". +alias id "O" = "cic:/matita/tests/first/nat.ind#xpointer(1/1/1)". +alias id "eq" = "cic:/matita/tests/first/eq.ind#xpointer(1/1)". +alias id "ultrastupid" = "cic:/matita/tests/second/ultrastupid.con". + +theorem iperstupid : eq nat O O. +exact ultrastupid. +qed. + diff --git a/matita/tests/tinycals.ma b/matita/tests/tinycals.ma new file mode 100644 index 000000000..465d7c06e --- /dev/null +++ b/matita/tests/tinycals.ma @@ -0,0 +1,53 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/tests/tinycals". + +theorem prova: + \forall A,B,C:Prop. + \forall H:A \to A \to C \to A \to A \to B.A \to C \to B. +intros. +apply H; + [assumption + |3,5: + [ exact H2; + | exact H1 ] + |4:assumption + |*:assumption + ] +qed. + +theorem prova1: + \forall A,B:Prop. + \forall H:A \to A \to A \to A \to A \to B.A \to B. +intros. +apply H; + [*:assumption] +qed. + +include "logic/connectives.ma". + +theorem prova2: + \forall A,B:Prop. + \forall H:A \to A \to A \to (A \land A) \to A \to B.A \to B. +intros. +apply H; + [2:assumption + |4:split.assumption + |3,5:assumption + |*:assumption + ] +assumption. +qed. + diff --git a/matita/tests/unfold.ma b/matita/tests/unfold.ma new file mode 100644 index 000000000..3318db17d --- /dev/null +++ b/matita/tests/unfold.ma @@ -0,0 +1,41 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The HELM team. *) +(* ||A|| http://helm.cs.unibo.it *) +(* \ / *) +(* \ / This file is distributed under the terms of the *) +(* v GNU General Public License Version 2 *) +(* *) +(**************************************************************************) + +set "baseuri" "cic:/matita/unfold". + +include "../legacy/coq.ma". + +alias symbol "plus" (instance 0) = "Coq's natural plus". +definition myplus \def \lambda x,y. x+y. + +alias id "S" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/2)". +lemma lem: \forall n. S (n + n) = (S n) + n. + intro; reflexivity. +qed. + +theorem trivial: \forall n. S (myplus n n) = myplus (S n) n. + unfold myplus in \vdash (\forall _.(? ? ? %)). + intro. + unfold myplus. + rewrite > lem. + reflexivity. +qed. + +(* This test needs to parse "uno" in the context of the hypothesis H, + not in the context of the goal. *) +alias id "O" = "cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1/1)". +theorem t: let uno \def S O in uno + uno = S uno \to uno=uno. + intros. unfold uno in H. + reflexivity. +qed. -- 2.39.2